@veevarts/design-system 2.1.0-beta.18 → 2.1.0-beta.20

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/dist/index.cjs CHANGED
@@ -1,19 +1,19 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),c=require("@heroui/react"),h=require("react"),X=require("lucide-react"),Te=require("framer-motion"),ws=require("@tiptap/react"),ua=require("@tiptap/core"),Zo=require("@tiptap/extension-bold"),Xo=require("@tiptap/extension-italic"),Jo=require("@tiptap/extension-strike"),ec=require("@tiptap/extension-underline"),tc=require("@tiptap/extension-code"),nc=require("@tiptap/extension-color"),sc=require("@tiptap/extension-highlight"),ac=require("@tiptap/extension-link"),rc=require("@tiptap/extension-text-style"),ic=require("@tiptap/extension-heading"),lc=require("@tiptap/extension-paragraph"),oc=require("@tiptap/extension-bullet-list"),cc=require("@tiptap/extension-ordered-list"),dc=require("@tiptap/extension-task-list"),uc=require("@tiptap/extension-task-item"),mc=require("@tiptap/extension-list-item"),fc=require("@tiptap/extension-code-block"),xc=require("@tiptap/extension-blockquote"),pc=require("@tiptap/extension-horizontal-rule"),hc=require("@tiptap/extension-hard-break"),ma=require("@tiptap/extension-history"),bc=require("@tiptap/extension-text-align"),gc=require("@tiptap/extension-document"),yc=require("@tiptap/extension-text"),vc=require("@tiptap/extension-dropcursor"),jc=require("@tiptap/extension-gapcursor"),De={brand:{primary:{500:"#C14615",DEFAULT:"#C14615"}},semantic:{success:"#057A54",danger:"#B62214",info:"#2563EB"},neutral:{white:"#FFFFFF",gray:{100:"#F3F4F6",200:"#E5E7EB",300:"#D1D5DB",400:"#9CA3AF",500:"#6B7280",700:"#374151",800:"#1F2937",900:"#111827"}},palettes:{warning:{100:"#fef3c7",200:"#fde68a",700:"#b45309"}}},pe={xs:"0.25rem",sm:"0.5rem",md:"1rem",lg:"1.5rem",xl:"2rem"},ge={fontFamily:{mono:'"JetBrains Mono", Consolas, monospace'},fontSize:{sm:"0.875rem",base:"1rem",lg:"1.125rem",xl:"1.25rem","2xl":"1.5rem","4xl":"2.25rem"},fontWeight:{semibold:"600",bold:"700"},lineHeight:{tight:"1.25",normal:"1.5"}},{gray:en}=De.neutral,wc=De.palettes.warning[700],Nc=De.palettes.warning[100],dt={rustFill:"#FBEBE4",rustBorder:"#EBC3B1",page:"#F6F7F8",border:"#E7E9EC",hair:"#EEF0F2",okFill:"#E6F4EF",dangerFill:"#FBEAE8",infoFill:"#E8EEFC"},Ns={"--rust":De.brand.primary[500],"--rust-fill":dt.rustFill,"--rust-border":dt.rustBorder,"--page":dt.page,"--surface":De.neutral.white,"--border":dt.border,"--hair":dt.hair,"--ink":en[900],"--ink2":en[700],"--sub":en[500],"--muted":en[400],"--ok":De.semantic.success,"--ok-fill":dt.okFill,"--warn":wc,"--warn-fill":Nc,"--danger":De.semantic.danger,"--danger-fill":dt.dangerFill,"--info":De.semantic.info,"--info-fill":dt.infoFill};Object.fromEntries(Object.entries(Ns).map(([e,n])=>[e.replace(/^--/,""),n]));function Cc({scope:e=".acct",fontFamily:n="'NeueMontreal', system-ui, sans-serif"}={}){const s=Object.entries(Ns).map(([r,i])=>` ${r}: ${i};`).join(`
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),c=require("@heroui/react"),h=require("react"),X=require("lucide-react"),Te=require("framer-motion"),Ns=require("@tiptap/react"),fa=require("@tiptap/core"),Jo=require("@tiptap/extension-bold"),ec=require("@tiptap/extension-italic"),tc=require("@tiptap/extension-strike"),nc=require("@tiptap/extension-underline"),sc=require("@tiptap/extension-code"),ac=require("@tiptap/extension-color"),rc=require("@tiptap/extension-highlight"),ic=require("@tiptap/extension-link"),lc=require("@tiptap/extension-text-style"),oc=require("@tiptap/extension-heading"),cc=require("@tiptap/extension-paragraph"),dc=require("@tiptap/extension-bullet-list"),uc=require("@tiptap/extension-ordered-list"),mc=require("@tiptap/extension-task-list"),fc=require("@tiptap/extension-task-item"),xc=require("@tiptap/extension-list-item"),pc=require("@tiptap/extension-code-block"),hc=require("@tiptap/extension-blockquote"),bc=require("@tiptap/extension-horizontal-rule"),gc=require("@tiptap/extension-hard-break"),xa=require("@tiptap/extension-history"),yc=require("@tiptap/extension-text-align"),vc=require("@tiptap/extension-document"),jc=require("@tiptap/extension-text"),wc=require("@tiptap/extension-dropcursor"),Nc=require("@tiptap/extension-gapcursor"),Ee={brand:{primary:{500:"#C14615",DEFAULT:"#C14615"}},semantic:{success:"#057A54",danger:"#B62214",info:"#2563EB"},neutral:{white:"#FFFFFF",gray:{100:"#F3F4F6",200:"#E5E7EB",300:"#D1D5DB",400:"#9CA3AF",500:"#6B7280",700:"#374151",800:"#1F2937",900:"#111827"}},palettes:{warning:{100:"#fef3c7",200:"#fde68a",700:"#b45309"}}},pe={xs:"0.25rem",sm:"0.5rem",md:"1rem",lg:"1.5rem",xl:"2rem"},ge={fontFamily:{mono:'"JetBrains Mono", Consolas, monospace'},fontSize:{sm:"0.875rem",base:"1rem",lg:"1.125rem",xl:"1.25rem","2xl":"1.5rem","4xl":"2.25rem"},fontWeight:{semibold:"600",bold:"700"},lineHeight:{tight:"1.25",normal:"1.5"}},{gray:en}=Ee.neutral,Cc=Ee.palettes.warning[700],kc=Ee.palettes.warning[100],dt={rustFill:"#FBEBE4",rustBorder:"#EBC3B1",page:"#F6F7F8",border:"#E7E9EC",hair:"#EEF0F2",okFill:"#E6F4EF",dangerFill:"#FBEAE8",infoFill:"#E8EEFC"},Cs={"--rust":Ee.brand.primary[500],"--rust-fill":dt.rustFill,"--rust-border":dt.rustBorder,"--page":dt.page,"--surface":Ee.neutral.white,"--border":dt.border,"--hair":dt.hair,"--ink":en[900],"--ink2":en[700],"--sub":en[500],"--muted":en[400],"--ok":Ee.semantic.success,"--ok-fill":dt.okFill,"--warn":Cc,"--warn-fill":kc,"--danger":Ee.semantic.danger,"--danger-fill":dt.dangerFill,"--info":Ee.semantic.info,"--info-fill":dt.infoFill};Object.fromEntries(Object.entries(Cs).map(([e,n])=>[e.replace(/^--/,""),n]));function Sc({scope:e=".acct",fontFamily:n="'NeueMontreal', system-ui, sans-serif"}={}){const s=Object.entries(Cs).map(([r,i])=>` ${r}: ${i};`).join(`
2
2
  `),a=n?`
3
3
  font-family: ${n};
4
4
  color: var(--ink);`:"";return`${e} {
5
5
  ${s}${a}
6
6
  }
7
- `}const ie={line:"#E7E7E9","line-2":"#F1F1F3",hair:"#F0F0F1",page:"#FBFBFB",field:"#E5E5E5","line-strong":"#D4D4D8",ink:"#18181B",muted:"#71717A",faint:"#A1A1AA","ok-fill":"#EAF3DE",ok:"#3B6D11","warn-fill":"#FAEEDA",warn:"#854F0B","warn-icon":"#EFD9B2","danger-fill":"#FCEBEB",danger:De.semantic.danger,"danger-icon":"#F3D3CF","info-fill":"#EAF1FC",info:"#1D4FA8","violet-fill":"#F1ECFB",violet:"#6D28D9","neutral-fill":"#F4F4F5",neutral:"#52525B",destructive:"#A32D2D"};({...ie});const kr=h.createContext(void 0);function Sr(){return h.useContext(kr)}function kc({children:e,closeLabel:n,locale:s}){const a=Sr();return t.jsx(c.HeroUIProvider,{locale:s,children:t.jsx(kr.Provider,{value:n??a,children:e})})}const $r=h.createContext("default");function Cn(){return h.useContext($r)}function Sc(e){return Cn()==="touch"?"lg":e}function $c({density:e,children:n}){return t.jsx($r.Provider,{value:e,children:n})}function Ac(e,n){const s=e.icons,a=e.aliases||Object.create(null),r=Object.create(null);function i(o){if(s[o])return r[o]=[];if(!(o in r)){r[o]=null;const l=a[o]&&a[o].parent,d=l&&i(l);d&&(r[o]=[l].concat(d))}return r[o]}return Object.keys(s).concat(Object.keys(a)).forEach(i),r}const Ar=Object.freeze({left:0,top:0,width:16,height:16}),xn=Object.freeze({rotate:0,vFlip:!1,hFlip:!1}),Cs=Object.freeze({...Ar,...xn}),rs=Object.freeze({...Cs,body:"",hidden:!1});function Dc(e,n){const s={};!e.hFlip!=!n.hFlip&&(s.hFlip=!0),!e.vFlip!=!n.vFlip&&(s.vFlip=!0);const a=((e.rotate||0)+(n.rotate||0))%4;return a&&(s.rotate=a),s}function fa(e,n){const s=Dc(e,n);for(const a in rs)a in xn?a in e&&!(a in s)&&(s[a]=xn[a]):a in n?s[a]=n[a]:a in e&&(s[a]=e[a]);return s}function Ec(e,n,s){const a=e.icons,r=e.aliases||Object.create(null);let i={};function o(l){i=fa(a[l]||r[l],i)}return o(n),s.forEach(o),fa(e,i)}function Dr(e,n){const s=[];if(typeof e!="object"||typeof e.icons!="object")return s;e.not_found instanceof Array&&e.not_found.forEach(r=>{n(r,null),s.push(r)});const a=Ac(e);for(const r in a){const i=a[r];i&&(n(r,Ec(e,r,i)),s.push(r))}return s}const Lc={provider:"",aliases:{},not_found:{},...Ar};function Tn(e,n){for(const s in n)if(s in e&&typeof e[s]!=typeof n[s])return!1;return!0}function Er(e){if(typeof e!="object"||e===null)return null;const n=e;if(typeof n.prefix!="string"||!e.icons||typeof e.icons!="object"||!Tn(e,Lc))return null;const s=n.icons;for(const r in s){const i=s[r];if(!r||typeof i.body!="string"||!Tn(i,rs))return null}const a=n.aliases||Object.create(null);for(const r in a){const i=a[r],o=i.parent;if(!r||typeof o!="string"||!s[o]&&!a[o]||!Tn(i,rs))return null}return n}const xa=Object.create(null);function Fc(e,n){return{provider:e,prefix:n,icons:Object.create(null),missing:new Set}}function At(e,n){const s=xa[e]||(xa[e]=Object.create(null));return s[n]||(s[n]=Fc(e,n))}function Lr(e,n){return Er(n)?Dr(n,(s,a)=>{a?e.icons[s]=a:e.missing.add(s)}):[]}function Rc(e,n,s){try{if(typeof s.body=="string")return e.icons[n]={...s},!0}catch{}return!1}const Fr=/^[a-z0-9]+(-[a-z0-9]+)*$/,kn=(e,n,s,a="")=>{const r=e.split(":");if(e.slice(0,1)==="@"){if(r.length<2||r.length>3)return null;a=r.shift().slice(1)}if(r.length>3||!r.length)return null;if(r.length>1){const l=r.pop(),d=r.pop(),u={provider:r.length>0?r[0]:a,prefix:d,name:l};return n&&!on(u)?null:u}const i=r[0],o=i.split("-");if(o.length>1){const l={provider:a,prefix:o.shift(),name:o.join("-")};return n&&!on(l)?null:l}if(s&&a===""){const l={provider:a,prefix:"",name:i};return n&&!on(l,s)?null:l}return null},on=(e,n)=>e?!!((n&&e.prefix===""||e.prefix)&&e.name):!1;let qt=!1;function Rr(e){return typeof e=="boolean"&&(qt=e),qt}function pa(e){const n=typeof e=="string"?kn(e,!0,qt):e;if(n){const s=At(n.provider,n.prefix),a=n.name;return s.icons[a]||(s.missing.has(a)?null:void 0)}}function _c(e,n){const s=kn(e,!0,qt);if(!s)return!1;const a=At(s.provider,s.prefix);return n?Rc(a,s.name,n):(a.missing.add(s.name),!0)}function Mc(e,n){if(typeof e!="object")return!1;if(typeof n!="string"&&(n=e.provider||""),qt&&!n&&!e.prefix){let r=!1;return Er(e)&&(e.prefix="",Dr(e,(i,o)=>{_c(i,o)&&(r=!0)})),r}const s=e.prefix;if(!on({prefix:s,name:"a"}))return!1;const a=At(n,s);return!!Lr(a,e)}const _r=Object.freeze({width:null,height:null}),Mr=Object.freeze({..._r,...xn}),Pc=/(-?[0-9.]*[0-9]+[0-9.]*)/g,Tc=/^-?[0-9.]*[0-9]+[0-9.]*$/g;function ha(e,n,s){if(n===1)return e;if(s=s||100,typeof e=="number")return Math.ceil(e*n*s)/s;if(typeof e!="string")return e;const a=e.split(Pc);if(a===null||!a.length)return e;const r=[];let i=a.shift(),o=Tc.test(i);for(;;){if(o){const l=parseFloat(i);isNaN(l)?r.push(i):r.push(Math.ceil(l*n*s)/s)}else r.push(i);if(i=a.shift(),i===void 0)return r.join("");o=!o}}function Ic(e,n="defs"){let s="";const a=e.indexOf("<"+n);for(;a>=0;){const r=e.indexOf(">",a),i=e.indexOf("</"+n);if(r===-1||i===-1)break;const o=e.indexOf(">",i);if(o===-1)break;s+=e.slice(r+1,i).trim(),e=e.slice(0,a).trim()+e.slice(o+1)}return{defs:s,content:e}}function Oc(e,n){return e?"<defs>"+e+"</defs>"+n:n}function zc(e,n,s){const a=Ic(e);return Oc(a.defs,n+a.content+s)}const Bc=e=>e==="unset"||e==="undefined"||e==="none";function Vc(e,n){const s={...Cs,...e},a={...Mr,...n},r={left:s.left,top:s.top,width:s.width,height:s.height};let i=s.body;[s,a].forEach(y=>{const b=[],j=y.hFlip,w=y.vFlip;let $=y.rotate;j?w?$+=2:(b.push("translate("+(r.width+r.left).toString()+" "+(0-r.top).toString()+")"),b.push("scale(-1 1)"),r.top=r.left=0):w&&(b.push("translate("+(0-r.left).toString()+" "+(r.height+r.top).toString()+")"),b.push("scale(1 -1)"),r.top=r.left=0);let N;switch($<0&&($-=Math.floor($/4)*4),$=$%4,$){case 1:N=r.height/2+r.top,b.unshift("rotate(90 "+N.toString()+" "+N.toString()+")");break;case 2:b.unshift("rotate(180 "+(r.width/2+r.left).toString()+" "+(r.height/2+r.top).toString()+")");break;case 3:N=r.width/2+r.left,b.unshift("rotate(-90 "+N.toString()+" "+N.toString()+")");break}$%2===1&&(r.left!==r.top&&(N=r.left,r.left=r.top,r.top=N),r.width!==r.height&&(N=r.width,r.width=r.height,r.height=N)),b.length&&(i=zc(i,'<g transform="'+b.join(" ")+'">',"</g>"))});const o=a.width,l=a.height,d=r.width,u=r.height;let f,m;o===null?(m=l===null?"1em":l==="auto"?u:l,f=ha(m,d/u)):(f=o==="auto"?d:o,m=l===null?ha(f,u/d):l==="auto"?u:l);const p={},x=(y,b)=>{Bc(b)||(p[y]=b.toString())};x("width",f),x("height",m);const g=[r.left,r.top,d,u];return p.viewBox=g.join(" "),{attributes:p,viewBox:g,body:i}}const Uc=/\sid="(\S+)"/g,Hc="IconifyId"+Date.now().toString(16)+(Math.random()*16777216|0).toString(16);let Wc=0;function qc(e,n=Hc){const s=[];let a;for(;a=Uc.exec(e);)s.push(a[1]);if(!s.length)return e;const r="suffix"+(Math.random()*16777216|Date.now()).toString(16);return s.forEach(i=>{const o=typeof n=="function"?n(i):n+(Wc++).toString(),l=i.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");e=e.replace(new RegExp('([#;"])('+l+')([")]|\\.[a-z])',"g"),"$1"+o+r+"$3")}),e=e.replace(new RegExp(r,"g"),""),e}const is=Object.create(null);function Gc(e,n){is[e]=n}function ls(e){return is[e]||is[""]}function ks(e){let n;if(typeof e.resources=="string")n=[e.resources];else if(n=e.resources,!(n instanceof Array)||!n.length)return null;return{resources:n,path:e.path||"/",maxURL:e.maxURL||500,rotate:e.rotate||750,timeout:e.timeout||5e3,random:e.random===!0,index:e.index||0,dataAfterTimeout:e.dataAfterTimeout!==!1}}const Ss=Object.create(null),Rt=["https://api.simplesvg.com","https://api.unisvg.com"],cn=[];for(;Rt.length>0;)Rt.length===1||Math.random()>.5?cn.push(Rt.shift()):cn.push(Rt.pop());Ss[""]=ks({resources:["https://api.iconify.design"].concat(cn)});function Kc(e,n){const s=ks(n);return s===null?!1:(Ss[e]=s,!0)}function $s(e){return Ss[e]}const Yc=()=>{let e;try{if(e=fetch,typeof e=="function")return e}catch{}};let ba=Yc();function Qc(e,n){const s=$s(e);if(!s)return 0;let a;if(!s.maxURL)a=0;else{let r=0;s.resources.forEach(o=>{r=Math.max(r,o.length)});const i=n+".json?icons=";a=s.maxURL-r-s.path.length-i.length}return a}function Zc(e){return e===404}const Xc=(e,n,s)=>{const a=[],r=Qc(e,n),i="icons";let o={type:i,provider:e,prefix:n,icons:[]},l=0;return s.forEach((d,u)=>{l+=d.length+1,l>=r&&u>0&&(a.push(o),o={type:i,provider:e,prefix:n,icons:[]},l=d.length),o.icons.push(d)}),a.push(o),a};function Jc(e){if(typeof e=="string"){const n=$s(e);if(n)return n.path}return"/"}const ed=(e,n,s)=>{if(!ba){s("abort",424);return}let a=Jc(n.provider);switch(n.type){case"icons":{const i=n.prefix,l=n.icons.join(","),d=new URLSearchParams({icons:l});a+=i+".json?"+d.toString();break}case"custom":{const i=n.uri;a+=i.slice(0,1)==="/"?i.slice(1):i;break}default:s("abort",400);return}let r=503;ba(e+a).then(i=>{const o=i.status;if(o!==200){setTimeout(()=>{s(Zc(o)?"abort":"next",o)});return}return r=501,i.json()}).then(i=>{if(typeof i!="object"||i===null){setTimeout(()=>{i===404?s("abort",i):s("next",r)});return}setTimeout(()=>{s("success",i)})}).catch(()=>{s("next",r)})},td={prepare:Xc,send:ed};function Pr(e,n){e.forEach(s=>{const a=s.loaderCallbacks;a&&(s.loaderCallbacks=a.filter(r=>r.id!==n))})}function nd(e){e.pendingCallbacksFlag||(e.pendingCallbacksFlag=!0,setTimeout(()=>{e.pendingCallbacksFlag=!1;const n=e.loaderCallbacks?e.loaderCallbacks.slice(0):[];if(!n.length)return;let s=!1;const a=e.provider,r=e.prefix;n.forEach(i=>{const o=i.icons,l=o.pending.length;o.pending=o.pending.filter(d=>{if(d.prefix!==r)return!0;const u=d.name;if(e.icons[u])o.loaded.push({provider:a,prefix:r,name:u});else if(e.missing.has(u))o.missing.push({provider:a,prefix:r,name:u});else return s=!0,!0;return!1}),o.pending.length!==l&&(s||Pr([e],i.id),i.callback(o.loaded.slice(0),o.missing.slice(0),o.pending.slice(0),i.abort))})}))}let sd=0;function ad(e,n,s){const a=sd++,r=Pr.bind(null,s,a);if(!n.pending.length)return r;const i={id:a,icons:n,callback:e,abort:r};return s.forEach(o=>{(o.loaderCallbacks||(o.loaderCallbacks=[])).push(i)}),r}function rd(e){const n={loaded:[],missing:[],pending:[]},s=Object.create(null);e.sort((r,i)=>r.provider!==i.provider?r.provider.localeCompare(i.provider):r.prefix!==i.prefix?r.prefix.localeCompare(i.prefix):r.name.localeCompare(i.name));let a={provider:"",prefix:"",name:""};return e.forEach(r=>{if(a.name===r.name&&a.prefix===r.prefix&&a.provider===r.provider)return;a=r;const i=r.provider,o=r.prefix,l=r.name,d=s[i]||(s[i]=Object.create(null)),u=d[o]||(d[o]=At(i,o));let f;l in u.icons?f=n.loaded:o===""||u.missing.has(l)?f=n.missing:f=n.pending;const m={provider:i,prefix:o,name:l};f.push(m)}),n}function id(e,n=!0,s=!1){const a=[];return e.forEach(r=>{const i=typeof r=="string"?kn(r,n,s):r;i&&a.push(i)}),a}const ld={resources:[],index:0,timeout:2e3,rotate:750,random:!1,dataAfterTimeout:!1};function od(e,n,s,a){const r=e.resources.length,i=e.random?Math.floor(Math.random()*r):e.index;let o;if(e.random){let k=e.resources.slice(0);for(o=[];k.length>1;){const C=Math.floor(Math.random()*k.length);o.push(k[C]),k=k.slice(0,C).concat(k.slice(C+1))}o=o.concat(k)}else o=e.resources.slice(i).concat(e.resources.slice(0,i));const l=Date.now();let d="pending",u=0,f,m=null,p=[],x=[];typeof a=="function"&&x.push(a);function g(){m&&(clearTimeout(m),m=null)}function y(){d==="pending"&&(d="aborted"),g(),p.forEach(k=>{k.status==="pending"&&(k.status="aborted")}),p=[]}function b(k,C){C&&(x=[]),typeof k=="function"&&x.push(k)}function j(){return{startTime:l,payload:n,status:d,queriesSent:u,queriesPending:p.length,subscribe:b,abort:y}}function w(){d="failed",x.forEach(k=>{k(void 0,f)})}function $(){p.forEach(k=>{k.status==="pending"&&(k.status="aborted")}),p=[]}function N(k,C,D){const S=C!=="success";switch(p=p.filter(_=>_!==k),d){case"pending":break;case"failed":if(S||!e.dataAfterTimeout)return;break;default:return}if(C==="abort"){f=D,w();return}if(S){f=D,p.length||(o.length?A():w());return}if(g(),$(),!e.random){const _=e.resources.indexOf(k.resource);_!==-1&&_!==e.index&&(e.index=_)}d="completed",x.forEach(_=>{_(D)})}function A(){if(d!=="pending")return;g();const k=o.shift();if(k===void 0){if(p.length){m=setTimeout(()=>{g(),d==="pending"&&($(),w())},e.timeout);return}w();return}const C={status:"pending",resource:k,callback:(D,S)=>{N(C,D,S)}};p.push(C),u++,m=setTimeout(A,e.rotate),s(k,n,C.callback)}return setTimeout(A),j}function Tr(e){const n={...ld,...e};let s=[];function a(){s=s.filter(l=>l().status==="pending")}function r(l,d,u){const f=od(n,l,d,(m,p)=>{a(),u&&u(m,p)});return s.push(f),f}function i(l){return s.find(d=>l(d))||null}return{query:r,find:i,setIndex:l=>{n.index=l},getIndex:()=>n.index,cleanup:a}}function ga(){}const In=Object.create(null);function cd(e){if(!In[e]){const n=$s(e);if(!n)return;const s=Tr(n),a={config:n,redundancy:s};In[e]=a}return In[e]}function dd(e,n,s){let a,r;if(typeof e=="string"){const i=ls(e);if(!i)return s(void 0,424),ga;r=i.send;const o=cd(e);o&&(a=o.redundancy)}else{const i=ks(e);if(i){a=Tr(i);const o=e.resources?e.resources[0]:"",l=ls(o);l&&(r=l.send)}}return!a||!r?(s(void 0,424),ga):a.query(n,r,s)().abort}function ya(){}function ud(e){e.iconsLoaderFlag||(e.iconsLoaderFlag=!0,setTimeout(()=>{e.iconsLoaderFlag=!1,nd(e)}))}function md(e){const n=[],s=[];return e.forEach(a=>{(a.match(Fr)?n:s).push(a)}),{valid:n,invalid:s}}function _t(e,n,s){function a(){const r=e.pendingIcons;n.forEach(i=>{r&&r.delete(i),e.icons[i]||e.missing.add(i)})}if(s&&typeof s=="object")try{if(!Lr(e,s).length){a();return}}catch(r){console.error(r)}a(),ud(e)}function va(e,n){e instanceof Promise?e.then(s=>{n(s)}).catch(()=>{n(null)}):n(e)}function fd(e,n){e.iconsToLoad?e.iconsToLoad=e.iconsToLoad.concat(n).sort():e.iconsToLoad=n,e.iconsQueueFlag||(e.iconsQueueFlag=!0,setTimeout(()=>{e.iconsQueueFlag=!1;const{provider:s,prefix:a}=e,r=e.iconsToLoad;if(delete e.iconsToLoad,!r||!r.length)return;const i=e.loadIcon;if(e.loadIcons&&(r.length>1||!i)){va(e.loadIcons(r,a,s),f=>{_t(e,r,f)});return}if(i){r.forEach(f=>{const m=i(f,a,s);va(m,p=>{const x=p?{prefix:a,icons:{[f]:p}}:null;_t(e,[f],x)})});return}const{valid:o,invalid:l}=md(r);if(l.length&&_t(e,l,null),!o.length)return;const d=a.match(Fr)?ls(s):null;if(!d){_t(e,o,null);return}d.prepare(s,a,o).forEach(f=>{dd(s,f,m=>{_t(e,f.icons,m)})})}))}const xd=(e,n)=>{const s=id(e,!0,Rr()),a=rd(s);if(!a.pending.length){let d=!0;return n&&setTimeout(()=>{d&&n(a.loaded,a.missing,a.pending,ya)}),()=>{d=!1}}const r=Object.create(null),i=[];let o,l;return a.pending.forEach(d=>{const{provider:u,prefix:f}=d;if(f===l&&u===o)return;o=u,l=f,i.push(At(u,f));const m=r[u]||(r[u]=Object.create(null));m[f]||(m[f]=[])}),a.pending.forEach(d=>{const{provider:u,prefix:f,name:m}=d,p=At(u,f),x=p.pendingIcons||(p.pendingIcons=new Set);x.has(m)||(x.add(m),r[u][f].push(m))}),i.forEach(d=>{const u=r[d.provider][d.prefix];u.length&&fd(d,u)}),n?ad(n,a,i):ya};function pd(e,n){const s={...e};for(const a in n){const r=n[a],i=typeof r;a in _r?(r===null||r&&(i==="string"||i==="number"))&&(s[a]=r):i===typeof s[a]&&(s[a]=a==="rotate"?r%4:r)}return s}const hd=/[\s,]+/;function bd(e,n){n.split(hd).forEach(s=>{switch(s.trim()){case"horizontal":e.hFlip=!0;break;case"vertical":e.vFlip=!0;break}})}function gd(e,n=0){const s=e.replace(/^-?[0-9.]*/,"");function a(r){for(;r<0;)r+=4;return r%4}if(s===""){const r=parseInt(e);return isNaN(r)?0:a(r)}else if(s!==e){let r=0;switch(s){case"%":r=25;break;case"deg":r=90}if(r){let i=parseFloat(e.slice(0,e.length-s.length));return isNaN(i)?0:(i=i/r,i%1===0?a(i):0)}}return n}function yd(e,n){let s=e.indexOf("xlink:")===-1?"":' xmlns:xlink="http://www.w3.org/1999/xlink"';for(const a in n)s+=" "+a+'="'+n[a]+'"';return'<svg xmlns="http://www.w3.org/2000/svg"'+s+">"+e+"</svg>"}function vd(e){return e.replace(/"/g,"'").replace(/%/g,"%25").replace(/#/g,"%23").replace(/</g,"%3C").replace(/>/g,"%3E").replace(/\s+/g," ")}function jd(e){return"data:image/svg+xml,"+vd(e)}function wd(e){return'url("'+jd(e)+'")'}let Ut;function Nd(){try{Ut=window.trustedTypes.createPolicy("iconify",{createHTML:e=>e})}catch{Ut=null}}function Cd(e){return Ut===void 0&&Nd(),Ut?Ut.createHTML(e):e}const Ir={...Mr,inline:!1},kd={xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink","aria-hidden":!0,role:"img"},Sd={display:"inline-block"},os={backgroundColor:"currentColor"},Or={backgroundColor:"transparent"},ja={Image:"var(--svg)",Repeat:"no-repeat",Size:"100% 100%"},wa={WebkitMask:os,mask:os,background:Or};for(const e in wa){const n=wa[e];for(const s in ja)n[e+s]=ja[s]}const $d={...Ir,inline:!0};function Na(e){return e+(e.match(/^[-0-9.]+$/)?"px":"")}const Ad=(e,n,s)=>{const a=n.inline?$d:Ir,r=pd(a,n),i=n.mode||"svg",o={},l=n.style||{},d={...i==="svg"?kd:{}};if(s){const b=kn(s,!1,!0);if(b){const j=["iconify"],w=["provider","prefix"];for(const $ of w)b[$]&&j.push("iconify--"+b[$]);d.className=j.join(" ")}}for(let b in n){const j=n[b];if(j!==void 0)switch(b){case"icon":case"style":case"children":case"onLoad":case"mode":case"ssr":case"fallback":break;case"_ref":d.ref=j;break;case"className":d[b]=(d[b]?d[b]+" ":"")+j;break;case"inline":case"hFlip":case"vFlip":r[b]=j===!0||j==="true"||j===1;break;case"flip":typeof j=="string"&&bd(r,j);break;case"color":o.color=j;break;case"rotate":typeof j=="string"?r[b]=gd(j):typeof j=="number"&&(r[b]=j);break;case"ariaHidden":case"aria-hidden":j!==!0&&j!=="true"&&delete d["aria-hidden"];break;default:a[b]===void 0&&(d[b]=j)}}const u=Vc(e,r),f=u.attributes;if(r.inline&&(o.verticalAlign="-0.125em"),i==="svg"){d.style={...o,...l},Object.assign(d,f);let b=0,j=n.id;return typeof j=="string"&&(j=j.replace(/-/g,"_")),d.dangerouslySetInnerHTML={__html:Cd(qc(u.body,j?()=>j+"ID"+b++:"iconifyReact"))},h.createElement("svg",d)}const{body:m,width:p,height:x}=e,g=i==="mask"||(i==="bg"?!1:m.indexOf("currentColor")!==-1),y=yd(m,{...f,width:p+"",height:x+""});return d.style={...o,"--svg":wd(y),width:Na(f.width),height:Na(f.height),...Sd,...g?os:Or,...l},h.createElement("span",d)};Rr(!0);Gc("",td);if(typeof document<"u"&&typeof window<"u"){const e=window;if(e.IconifyPreload!==void 0){const n=e.IconifyPreload,s="Invalid IconifyPreload syntax.";typeof n=="object"&&n!==null&&(n instanceof Array?n:[n]).forEach(a=>{try{(typeof a!="object"||a===null||a instanceof Array||typeof a.icons!="object"||typeof a.prefix!="string"||!Mc(a))&&console.error(s)}catch{console.error(s)}})}if(e.IconifyProviders!==void 0){const n=e.IconifyProviders;if(typeof n=="object"&&n!==null)for(let s in n){const a="IconifyProviders["+s+"] is invalid.";try{const r=n[s];if(typeof r!="object"||!r||r.resources===void 0)continue;Kc(s,r)||console.error(a)}catch{console.error(a)}}}}function zr(e){const[n,s]=h.useState(!!e.ssr),[a,r]=h.useState({});function i(x){if(x){const g=e.icon;if(typeof g=="object")return{name:"",data:g};const y=pa(g);if(y)return{name:g,data:y}}return{name:""}}const[o,l]=h.useState(i(!!e.ssr));function d(){const x=a.callback;x&&(x(),r({}))}function u(x){if(JSON.stringify(o)!==JSON.stringify(x))return d(),l(x),!0}function f(){var x;const g=e.icon;if(typeof g=="object"){u({name:"",data:g});return}const y=pa(g);if(u({name:g,data:y}))if(y===void 0){const b=xd([g],f);r({callback:b})}else y&&((x=e.onLoad)===null||x===void 0||x.call(e,g))}h.useEffect(()=>(s(!0),d),[]),h.useEffect(()=>{n&&f()},[e.icon,n]);const{name:m,data:p}=o;return p?Ad({...Cs,...p},e,m):e.children?e.children:e.fallback?e.fallback:h.createElement("span",{})}const P=h.forwardRef((e,n)=>zr({...e,_ref:n}));h.forwardRef((e,n)=>zr({inline:!0,...e,_ref:n}));const O=h.forwardRef(({color:e="primary",radius:n="full",testId:s="veevart-button",...a},r)=>t.jsx(c.Button,{ref:r,color:e,radius:n,"data-testid":s,...a}));O.displayName="Button";function Br({code:e,amount:n,onRemove:s,label:a="Gift Card",removeAriaLabel:r="Remove gift card",testId:i="veevart-applied-code-card"}){return t.jsx(c.Card,{"data-testid":i,shadow:"sm",className:"w-full",children:t.jsxs(c.CardBody,{className:"flex flex-row items-start justify-between gap-2 p-4",children:[t.jsxs("div",{className:"flex min-w-0 flex-col gap-1",children:[t.jsx("span",{className:"text-xs text-default-500",children:a}),t.jsx("span",{"data-testid":`${i}-code`,className:"truncate font-medium text-foreground",children:e}),t.jsx("span",{"data-testid":`${i}-amount`,className:"text-lg font-semibold text-primary",children:n})]}),t.jsx(O,{testId:`${i}-remove`,isIconOnly:!0,size:"sm",variant:"light","aria-label":r,onPress:s,children:t.jsx(P,{icon:"solar:close-circle-linear",className:"size-4","aria-hidden":"true"})})]})})}function On(e,n){return e-n*Math.floor(e/n)}const Vr=1721426;function tn(e,n,s,a){n=As(e,n);let r=n-1,i=-2;return s<=2?i=0:dn(n)&&(i=-1),Vr-1+365*r+Math.floor(r/4)-Math.floor(r/100)+Math.floor(r/400)+Math.floor((367*s-362)/12+i+a)}function dn(e){return e%4===0&&(e%100!==0||e%400===0)}function As(e,n){return e==="BC"?1-n:n}function Dd(e){let n="AD";return e<=0&&(n="BC",e=1-e),[n,e]}const Ed={standard:[31,28,31,30,31,30,31,31,30,31,30,31],leapyear:[31,29,31,30,31,30,31,31,30,31,30,31]};class Sn{fromJulianDay(n){let s=n,a=s-Vr,r=Math.floor(a/146097),i=On(a,146097),o=Math.floor(i/36524),l=On(i,36524),d=Math.floor(l/1461),u=On(l,1461),f=Math.floor(u/365),m=r*400+o*100+d*4+f+(o!==4&&f!==4?1:0),[p,x]=Dd(m),g=s-tn(p,x,1,1),y=2;s<tn(p,x,3,1)?y=0:dn(x)&&(y=1);let b=Math.floor(((g+y)*12+373)/367),j=s-tn(p,x,b,1)+1;return new Gt(p,x,b,j)}toJulianDay(n){return tn(n.era,n.year,n.month,n.day)}getDaysInMonth(n){return Ed[dn(n.year)?"leapyear":"standard"][n.month-1]}getMonthsInYear(n){return 12}getDaysInYear(n){return dn(n.year)?366:365}getMaximumMonthsInYear(){return 12}getMaximumDaysInMonth(){return 31}getYearsInEra(n){return 9999}getEras(){return["BC","AD"]}isInverseEra(n){return n.era==="BC"}balanceDate(n){n.year<=0&&(n.era=n.era==="BC"?"AD":"BC",n.year=1-n.year)}constructor(){this.identifier="gregory"}}function Ld(e,n){var s,a,r,i;return(i=(r=(s=e.isEqual)===null||s===void 0?void 0:s.call(e,n))!==null&&r!==void 0?r:(a=n.isEqual)===null||a===void 0?void 0:a.call(n,e))!==null&&i!==void 0?i:e.identifier===n.identifier}function Ur(e,n){return e.calendar.toJulianDay(e)-n.calendar.toJulianDay(n)}function Hr(e,n){return Ca(e)-Ca(n)}function Ca(e){return e.hour*36e5+e.minute*6e4+e.second*1e3+e.millisecond}let zn=null;function Wr(){return zn==null&&(zn=new Intl.DateTimeFormat().resolvedOptions().timeZone),zn}function ka(e){e=Ds(e,new Sn);let n=As(e.era,e.year);return qr(n,e.month,e.day,e.hour,e.minute,e.second,e.millisecond)}function qr(e,n,s,a,r,i,o){let l=new Date;return l.setUTCHours(a,r,i,o),l.setUTCFullYear(e,n-1,s),l.getTime()}function Sa(e,n){if(n==="UTC")return 0;if(e>0&&n===Wr())return new Date(e).getTimezoneOffset()*-6e4;let{year:s,month:a,day:r,hour:i,minute:o,second:l}=Gr(e,n);return qr(s,a,r,i,o,l,0)-Math.floor(e/1e3)*1e3}const $a=new Map;function Gr(e,n){let s=$a.get(n);s||(s=new Intl.DateTimeFormat("en-US",{timeZone:n,hour12:!1,era:"short",year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric"}),$a.set(n,s));let a=s.formatToParts(new Date(e)),r={};for(let i of a)i.type!=="literal"&&(r[i.type]=i.value);return{year:r.era==="BC"||r.era==="B"?-r.year+1:+r.year,month:+r.month,day:+r.day,hour:r.hour==="24"?0:+r.hour,minute:+r.minute,second:+r.second}}const Aa=864e5;function Fd(e,n,s,a){return(s===a?[s]:[s,a]).filter(i=>Rd(e,n,i))}function Rd(e,n,s){let a=Gr(s,n);return e.year===a.year&&e.month===a.month&&e.day===a.day&&e.hour===a.hour&&e.minute===a.minute&&e.second===a.second}function _d(e,n,s="compatible"){let a=Yr(e);if(n==="UTC")return ka(a);if(n===Wr()&&s==="compatible"){a=Ds(a,new Sn);let d=new Date,u=As(a.era,a.year);return d.setFullYear(u,a.month-1,a.day),d.setHours(a.hour,a.minute,a.second,a.millisecond),d.getTime()}let r=ka(a),i=Sa(r-Aa,n),o=Sa(r+Aa,n),l=Fd(a,n,r-i,r-o);if(l.length===1)return l[0];if(l.length>1)switch(s){case"compatible":case"earlier":return l[0];case"later":return l[l.length-1];case"reject":throw new RangeError("Multiple possible absolute times found")}switch(s){case"earlier":return Math.min(r-i,r-o);case"compatible":case"later":return Math.max(r-i,r-o);case"reject":throw new RangeError("No such absolute time found")}}function Kr(e,n,s="compatible"){return new Date(_d(e,n,s))}function Yr(e,n){let s=0,a=0,r=0,i=0;if("timeZone"in e)({hour:s,minute:a,second:r,millisecond:i}=e);else if("hour"in e&&!n)return e;return n&&({hour:s,minute:a,second:r,millisecond:i}=n),new pn(e.calendar,e.era,e.year,e.month,e.day,s,a,r,i)}function Ds(e,n){if(Ld(e.calendar,n))return e;let s=n.fromJulianDay(e.calendar.toJulianDay(e)),a=e.copy();return a.calendar=n,a.era=s.era,a.year=s.year,a.month=s.month,a.day=s.day,Dt(a),a}function Es(e,n){let s=e.copy(),a="hour"in s?ni(s,n):0;cs(s,n.years||0),s.calendar.balanceYearMonth&&s.calendar.balanceYearMonth(s,e),s.month+=n.months||0,ds(s),Qr(s),s.day+=(n.weeks||0)*7,s.day+=n.days||0,s.day+=a,Md(s),s.calendar.balanceDate&&s.calendar.balanceDate(s),s.year<1&&(s.year=1,s.month=1,s.day=1);let r=s.calendar.getYearsInEra(s);if(s.year>r){var i,o;let d=(i=(o=s.calendar).isInverseEra)===null||i===void 0?void 0:i.call(o,s);s.year=r,s.month=d?1:s.calendar.getMonthsInYear(s),s.day=d?1:s.calendar.getDaysInMonth(s)}s.month<1&&(s.month=1,s.day=1);let l=s.calendar.getMonthsInYear(s);return s.month>l&&(s.month=l,s.day=s.calendar.getDaysInMonth(s)),s.day=Math.max(1,Math.min(s.calendar.getDaysInMonth(s),s.day)),s}function cs(e,n){var s,a;!((s=(a=e.calendar).isInverseEra)===null||s===void 0)&&s.call(a,e)&&(n=-n),e.year+=n}function ds(e){for(;e.month<1;)cs(e,-1),e.month+=e.calendar.getMonthsInYear(e);let n=0;for(;e.month>(n=e.calendar.getMonthsInYear(e));)e.month-=n,cs(e,1)}function Md(e){for(;e.day<1;)e.month--,ds(e),e.day+=e.calendar.getDaysInMonth(e);for(;e.day>e.calendar.getDaysInMonth(e);)e.day-=e.calendar.getDaysInMonth(e),e.month++,ds(e)}function Qr(e){e.month=Math.max(1,Math.min(e.calendar.getMonthsInYear(e),e.month)),e.day=Math.max(1,Math.min(e.calendar.getDaysInMonth(e),e.day))}function Dt(e){e.calendar.constrainDate&&e.calendar.constrainDate(e),e.year=Math.max(1,Math.min(e.calendar.getYearsInEra(e),e.year)),Qr(e)}function Zr(e){let n={};for(let s in e)typeof e[s]=="number"&&(n[s]=-e[s]);return n}function Xr(e,n){return Es(e,Zr(n))}function Jr(e,n){let s=e.copy();return n.era!=null&&(s.era=n.era),n.year!=null&&(s.year=n.year),n.month!=null&&(s.month=n.month),n.day!=null&&(s.day=n.day),Dt(s),s}function ei(e,n){let s=e.copy();return n.hour!=null&&(s.hour=n.hour),n.minute!=null&&(s.minute=n.minute),n.second!=null&&(s.second=n.second),n.millisecond!=null&&(s.millisecond=n.millisecond),ti(s),s}function Pd(e){e.second+=Math.floor(e.millisecond/1e3),e.millisecond=nn(e.millisecond,1e3),e.minute+=Math.floor(e.second/60),e.second=nn(e.second,60),e.hour+=Math.floor(e.minute/60),e.minute=nn(e.minute,60);let n=Math.floor(e.hour/24);return e.hour=nn(e.hour,24),n}function ti(e){e.millisecond=Math.max(0,Math.min(e.millisecond,1e3)),e.second=Math.max(0,Math.min(e.second,59)),e.minute=Math.max(0,Math.min(e.minute,59)),e.hour=Math.max(0,Math.min(e.hour,23))}function nn(e,n){let s=e%n;return s<0&&(s+=n),s}function ni(e,n){return e.hour+=n.hours||0,e.minute+=n.minutes||0,e.second+=n.seconds||0,e.millisecond+=n.milliseconds||0,Pd(e)}function si(e,n){let s=e.copy();return ni(s,n),s}function Td(e,n){return si(e,Zr(n))}function ai(e,n,s,a){let r=e.copy();switch(n){case"era":{let l=e.calendar.getEras(),d=l.indexOf(e.era);if(d<0)throw new Error("Invalid era: "+e.era);d=mt(d,s,0,l.length-1,a?.round),r.era=l[d],Dt(r);break}case"year":var i,o;!((i=(o=r.calendar).isInverseEra)===null||i===void 0)&&i.call(o,r)&&(s=-s),r.year=mt(e.year,s,-1/0,9999,a?.round),r.year===-1/0&&(r.year=1),r.calendar.balanceYearMonth&&r.calendar.balanceYearMonth(r,e);break;case"month":r.month=mt(e.month,s,1,e.calendar.getMonthsInYear(e),a?.round);break;case"day":r.day=mt(e.day,s,1,e.calendar.getDaysInMonth(e),a?.round);break;default:throw new Error("Unsupported field "+n)}return e.calendar.balanceDate&&e.calendar.balanceDate(r),Dt(r),r}function ri(e,n,s,a){let r=e.copy();switch(n){case"hour":{let i=e.hour,o=0,l=23;if(a?.hourCycle===12){let d=i>=12;o=d?12:0,l=d?23:11}r.hour=mt(i,s,o,l,a?.round);break}case"minute":r.minute=mt(e.minute,s,0,59,a?.round);break;case"second":r.second=mt(e.second,s,0,59,a?.round);break;case"millisecond":r.millisecond=mt(e.millisecond,s,0,999,a?.round);break;default:throw new Error("Unsupported field "+n)}return r}function mt(e,n,s,a,r=!1){if(r){e+=Math.sign(n),e<s&&(e=a);let i=Math.abs(n);n>0?e=Math.ceil(e/i)*i:e=Math.floor(e/i)*i,e>a&&(e=s)}else e+=n,e<s?e=a-(s-e-1):e>a&&(e=s+(e-a-1));return e}const Id=/^([+-]\d{6}|\d{4})-(\d{2})-(\d{2})$/,Od=/^([+-]\d{6}|\d{4})-(\d{2})-(\d{2})(?:T(\d{2}))?(?::(\d{2}))?(?::(\d{2}))?(\.\d+)?(?:(?:([+-]\d{2})(?::?(\d{2}))?)|Z)$/;function zd(e){let n=e.match(Id);if(!n)throw Od.test(e)?new Error(`Invalid ISO 8601 date string: ${e}. Use parseAbsolute() instead.`):new Error("Invalid ISO 8601 date string: "+e);let s=new Gt(Bn(n[1],0,9999),Bn(n[2],1,12),1);return s.day=Bn(n[3],1,s.calendar.getDaysInMonth(s)),s}function Bn(e,n,s){let a=Number(e);if(a<n||a>s)throw new RangeError(`Value out of range: ${n} <= ${a} <= ${s}`);return a}function ii(e){return`${String(e.hour).padStart(2,"0")}:${String(e.minute).padStart(2,"0")}:${String(e.second).padStart(2,"0")}${e.millisecond?String(e.millisecond/1e3).slice(1):""}`}function li(e){let n=Ds(e,new Sn),s;return n.era==="BC"?s=n.year===1?"0000":"-"+String(Math.abs(1-n.year)).padStart(6,"00"):s=String(n.year).padStart(4,"0"),`${s}-${String(n.month).padStart(2,"0")}-${String(n.day).padStart(2,"0")}`}function Bd(e){return`${li(e)}T${ii(e)}`}function Vd(e,n){if(n.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function Ls(e,n,s){Vd(e,n),n.set(e,s)}function oi(e){let n=typeof e[0]=="object"?e.shift():new Sn,s;if(typeof e[0]=="string")s=e.shift();else{let o=n.getEras();s=o[o.length-1]}let a=e.shift(),r=e.shift(),i=e.shift();return[n,s,a,r,i]}var Ud=new WeakMap;class Gt{copy(){return this.era?new Gt(this.calendar,this.era,this.year,this.month,this.day):new Gt(this.calendar,this.year,this.month,this.day)}add(n){return Es(this,n)}subtract(n){return Xr(this,n)}set(n){return Jr(this,n)}cycle(n,s,a){return ai(this,n,s,a)}toDate(n){return Kr(this,n)}toString(){return li(this)}compare(n){return Ur(this,n)}constructor(...n){Ls(this,Ud,{writable:!0,value:void 0});let[s,a,r,i,o]=oi(n);this.calendar=s,this.era=a,this.year=r,this.month=i,this.day=o,Dt(this)}}var Hd=new WeakMap;class $n{copy(){return new $n(this.hour,this.minute,this.second,this.millisecond)}add(n){return si(this,n)}subtract(n){return Td(this,n)}set(n){return ei(this,n)}cycle(n,s,a){return ri(this,n,s,a)}toString(){return ii(this)}compare(n){return Hr(this,n)}constructor(n=0,s=0,a=0,r=0){Ls(this,Hd,{writable:!0,value:void 0}),this.hour=n,this.minute=s,this.second=a,this.millisecond=r,ti(this)}}var Wd=new WeakMap;class pn{copy(){return this.era?new pn(this.calendar,this.era,this.year,this.month,this.day,this.hour,this.minute,this.second,this.millisecond):new pn(this.calendar,this.year,this.month,this.day,this.hour,this.minute,this.second,this.millisecond)}add(n){return Es(this,n)}subtract(n){return Xr(this,n)}set(n){return Jr(ei(this,n),n)}cycle(n,s,a){switch(n){case"era":case"year":case"month":case"day":return ai(this,n,s,a);default:return ri(this,n,s,a)}}toDate(n,s){return Kr(this,n,s)}toString(){return Bd(this)}compare(n){let s=Ur(this,n);return s===0?Hr(this,Yr(n)):s}constructor(...n){Ls(this,Wd,{writable:!0,value:void 0});let[s,a,r,i,o]=oi(n);this.calendar=s,this.era=a,this.year=r,this.month=i,this.day=o,this.hour=n.shift()||0,this.minute=n.shift()||0,this.second=n.shift()||0,this.millisecond=n.shift()||0,Dt(this)}}const qd="Open time options",Gd=320;function Da(e,n){return typeof n=="string"&&n.length>0?`${e} ${n}`:e}function Vn(e){if(!e)return null;const n="hour"in e&&typeof e.hour=="number"?e.hour:0,s="minute"in e&&typeof e.minute=="number"?e.minute:0,a="second"in e&&typeof e.second=="number"?e.second:0;return new $n(n,s,a)}function Kd(e,n){const s=new Date(2e3,0,1,e.hour,e.minute,e.second);return new Intl.DateTimeFormat("en-US",{hour:"numeric",minute:"2-digit",hour12:n===12}).format(s)}function Yd(e){const n=[];for(let s=0;s<24;s+=1)for(let a=0;a<60;a+=e)n.push(new $n(s,a));return n}function Qd(e){const{minuteStep:n=15,timeListClassName:s,timeListLabel:a=qd,selectorButtonProps:r,endContent:i,onChange:o,value:l,defaultValue:d,hourCycle:u=12,...f}=e,m=l!==void 0,[p,x]=h.useState(()=>Vn(d)),g=m?Vn(l):p,y=h.useMemo(()=>Yd(n),[n]),b=w=>{m||x(w),o?.(w)},j=t.jsxs(c.Popover,{placement:"bottom-end",children:[t.jsx(c.PopoverTrigger,{children:t.jsx(c.Button,{isIconOnly:!0,variant:"light","aria-label":a,...r,onPress:void 0,children:t.jsx(X.Clock3,{className:"size-4",strokeWidth:1.75})})}),t.jsx(c.PopoverContent,{className:"min-w-[8.5rem] p-0",children:t.jsx(c.ScrollShadow,{className:s??"max-h-64 py-1",children:t.jsx("div",{className:"flex flex-col p-1",children:y.map(w=>{const $=g?.hour===w.hour&&g?.minute===w.minute;return t.jsx(c.Button,{variant:$?"flat":"light",color:$?"primary":"default",className:"h-9 min-w-0 justify-start px-3",onPress:()=>b(w),children:Kd(w,u)},`${w.hour}:${w.minute}`)})})})})]});return t.jsx(c.TimeInput,{...f,value:m?g:void 0,defaultValue:m?void 0:d,hourCycle:u,endContent:t.jsxs("div",{className:"flex items-center gap-1",children:[i,j]}),onChange:w=>b(Vn(w))})}function Fs(e){if(e.mode==="time")return t.jsx(Qd,{...e});if(e.mode==="datetime"){const{mode:r,granularity:i="minute",hideTimeZone:o=!0,calendarWidth:l=Gd,disableAnimation:d=!0,classNames:u,...f}=e;return t.jsx(c.DatePicker,{...f,calendarWidth:l,classNames:{...u,popoverContent:Da("min-w-[20rem]",u?.popoverContent),calendarContent:Da("min-h-[18rem]",u?.calendarContent)},disableAnimation:d,granularity:i,hideTimeZone:o})}const{mode:n,granularity:s="day",...a}=e;return t.jsx(c.DatePicker,{...a,granularity:s})}function Zd({label:e,...n}){return t.jsx("button",{...n,"aria-label":e,children:t.jsx("svg",{"aria-hidden":"true",className:"fill-current",fill:"none",focusable:"false",height:"1em",role:"presentation",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,viewBox:"0 0 24 24",width:"1em",children:t.jsx("path",{d:"M18 6L6 18M6 6l12 12"})})})}function Xd(e){return e!==void 0&&e.trim()!==""}function ci(e,n){const s=Sr();if(h.isValidElement(n))return n;const a=[e,s].find(Xd);return a===void 0?void 0:t.jsx(Zd,{label:a})}const di=h.forwardRef(({closeLabel:e,closeButton:n,...s},a)=>{const r=ci(e,n);return t.jsx(c.Drawer,{ref:a,...s,closeButton:r})});di.displayName="Drawer";const Qt=h.forwardRef(({closeLabel:e,closeButton:n,...s},a)=>{const r=ci(e,n);return t.jsx(c.Modal,{ref:a,...s,closeButton:r})});Qt.displayName="Modal";function Jd(e){const n=e?.closest('[role="dialog"]');return n?.parentElement??n??void 0}const Xe=h.forwardRef(({popoverProps:e,...n},s)=>{const a=h.useRef(null),[r,i]=h.useState(void 0),{"data-react-aria-top-layer":o,...l}=e??{},d=o==="true"||o===void 0&&r!==void 0,u={...l,disableDialogFocus:l.disableDialogFocus??(r?!0:void 0),portalContainer:l.portalContainer??r,...d?{"data-react-aria-top-layer":"true"}:{}};return h.useEffect(()=>{i(Jd(a.current))},[]),t.jsx("span",{ref:a,className:"contents",children:t.jsx(c.Select,{ref:s,...n,popoverProps:u})})});Xe.displayName="Select";const eu="text-default-600 data-[hover=true]:text-default-700",Rs=h.forwardRef(({classNames:e,...n},s)=>t.jsx(c.Table,{ref:s,...n,classNames:{...e,th:c.cn(eu,e?.th)}}));Rs.displayName="Table";function tu({state:e,onSubmit:n,onRemove:s,appliedCredit:a,errorMessage:r,label:i="Gift Card",placeholder:o="GC-XXXX-XXXX-XXXX",applyLabel:l="Apply",removeAriaLabel:d="Remove gift card",testId:u="veevart-redeem-code-input"}){const[f,m]=h.useState(""),p=h.useId(),[x,g]=h.useState(e);e!==x&&(g(e),e==="applied"&&m(""));const y=()=>{const w=f.trim();w&&n(w)},b=w=>{w.key==="Enter"&&(w.preventDefault(),y())};if(e==="applied"&&a)return t.jsx("div",{"data-testid":u,children:t.jsx(Br,{code:a.code,amount:a.amount,onRemove:s,removeAriaLabel:d,testId:`${u}-card`})});const j=e==="error"&&r!=null;return t.jsxs("div",{"data-testid":u,className:"flex flex-col gap-1",children:[t.jsxs("div",{className:"flex items-end gap-2",children:[t.jsx(c.Input,{"data-testid":`${u}-input`,label:i,labelPlacement:"outside",variant:"bordered",radius:"lg",classNames:{label:"text-xs text-default-500 group-data-[filled-within=true]:text-default-500 group-data-[filled-within=true]:-translate-y-[calc(100%_+_var(--heroui-font-size-small)/2_+_16px)]",inputWrapper:"border-small"},placeholder:o,value:f,onValueChange:m,onKeyDown:b,isDisabled:e==="loading",isInvalid:e==="error","aria-describedby":j?p:void 0}),t.jsx(O,{testId:`${u}-button`,isLoading:e==="loading",isDisabled:!f.trim(),onPress:y,children:l})]}),j&&t.jsx("p",{id:p,"data-testid":`${u}-error`,className:"text-tiny text-danger",children:r})]})}const nu={login:"Login",logout:"Logout",selectLanguage:"Select your language"};function su({languages:e,selectedLanguage:n,onLanguageChange:s,label:a}){const r=e.find(i=>i.code===n);return t.jsx("div",{className:"flex items-center",children:t.jsxs("div",{className:"relative flex items-center",children:[t.jsx(Xe,{"data-testid":"language-select-desktop",variant:"bordered","aria-label":a,selectedKeys:n?[n]:[],onSelectionChange:i=>{const o=Array.from(i)[0]||n;s?.(o)},className:"min-w-36 hidden md:inline-flex",isDisabled:e.length===0,placeholder:a,startContent:t.jsx(X.Globe,{className:"w-5 h-5 text-black"}),renderValue:()=>t.jsx("span",{children:r?.label||a}),size:"md",radius:"full",children:e.map(i=>t.jsx(c.SelectItem,{textValue:i.label,"data-testid":`language-select-option-${i.code}`,children:i.label},i.code))}),t.jsx(Xe,{"aria-label":a,"data-testid":"language-select-mobile",variant:"bordered",selectedKeys:n?[n]:[],onSelectionChange:i=>{const o=Array.from(i)[0]||n;s?.(o)},className:"w-24 inline-flex md:hidden",isDisabled:e.length===0,placeholder:"",startContent:t.jsx(X.Globe,{className:"w-6 h-6 text-black"}),renderValue:()=>t.jsx("span",{children:r?.code.toUpperCase()||""}),size:"md",radius:"full",children:e.map(i=>t.jsx(c.SelectItem,{textValue:i.code.toUpperCase(),"data-testid":`language-select-option-mobile-${i.code}`,children:i.code.toUpperCase()},i.code))})]})})}function au({isLoggedIn:e,onLogin:n,onLogout:s,labels:a}){return e?t.jsxs(O,{"data-testid":"navbar-auth-button",className:"px-2 py-1 w-1 min-w-12 md:min-w-24 rounded-full bg-black text-white text-sm flex items-center",onPress:s,size:"md",children:[t.jsx(X.User,{className:"inline w-5 h-5"}),t.jsx("span",{className:"hidden md:inline",children:a.logout})]}):t.jsxs(O,{"data-testid":"navbar-auth-button",className:"px-2 py-1 min-w-12 md:min-w-24 rounded-full bg-black text-white text-sm flex items-center",onPress:n,size:"md",children:[t.jsx(X.User,{className:"inline w-5 h-5"}),t.jsx("span",{className:"hidden md:inline",children:a.login})]})}function ru({logo:e,languages:n=[],selectedLanguage:s,onLanguageChange:a,isLoggedIn:r,onLogin:i,onLogout:o,hasLanguages:l,hasAuth:d,labels:u={},className:f}){const m={...nu,...u};return t.jsxs("nav",{"data-testid":"navbar",className:c.cn("w-full px-4 md:px-8 py-3 bg-white border-b border-zinc-100 flex items-center justify-between",f),children:[t.jsx("div",{className:"flex items-center min-w-10",children:e&&t.jsx("a",{href:"/",className:"block",children:t.jsx("img",{"data-testid":"navbar-logo",src:e,alt:"Logo",className:"h-8 w-auto max-w-28 md:max-w-40 object-contain"})})}),t.jsxs("div",{className:"flex items-center gap-2 md:gap-4",children:[(l||n.length>0)&&t.jsx(su,{languages:n,selectedLanguage:s,onLanguageChange:a,label:m.selectLanguage}),d&&t.jsx(au,{isLoggedIn:r,onLogin:i,onLogout:o,labels:m})]})]})}function iu(e){return t.jsx("div",{className:"min-h-screen flex flex-col",children:t.jsx("div",{className:"flex-1 flex items-center justify-center p-12",children:t.jsx(c.Alert,{description:"This template combines Navbar, Footer, and a confirmation Card. Include title, message, confirmation number, details list, icon, and action buttons. Use Card for the confirmation content.",title:"TODO: Implement ConfirmationPageTemplate",variant:"faded",className:"max-w-2xl"})})})}var Un;const lu=typeof document<"u"?(Un=h.useInsertionEffect)!==null&&Un!==void 0?Un:h.useLayoutEffect:()=>{};function An(e,n,s){let[a,r]=h.useState(e||n),i=h.useRef(a),o=h.useRef(e!==void 0),l=e!==void 0;h.useEffect(()=>{let m=o.current;m!==l&&process.env.NODE_ENV!=="production"&&console.warn(`WARN: A component changed from ${m?"controlled":"uncontrolled"} to ${l?"controlled":"uncontrolled"}.`),o.current=l},[l]);let d=l?e:a;lu(()=>{i.current=d});let[,u]=h.useReducer(()=>({}),{}),f=h.useCallback((m,...p)=>{let x=typeof m=="function"?m(i.current):m;Object.is(i.current,x)||(i.current=x,r(x),u(),s?.(x,...p))},[s]);return[d,f]}function ui(e){return t.jsx("svg",{...e,fill:"none",stroke:"currentColor",strokeWidth:2,viewBox:"0 0 24 24",children:t.jsx(Te.m.path,{animate:{pathLength:1},d:"M5 13l4 4L19 7",initial:{pathLength:0},strokeLinecap:"round",strokeLinejoin:"round",transition:{delay:.2,type:"tween",ease:"easeOut",duration:.3}})})}const mi=h.forwardRef(({color:e="primary",variant:n="default",stepsCount:s=3,defaultStep:a=0,label:r,stepLabels:i,showStepLabelTooltip:o=!1,stepLabelTooltipPlacement:l="top",showStepCounter:d=!1,stepCounterPosition:u="right",layout:f="compact",stepCounterFormat:m,onStepChange:p,currentStep:x,hideProgressBars:g=!1,stepClassName:y,className:b,isDisabled:j=!1,...w},$)=>{const[N,A]=An(x,a,p),k=h.useMemo(()=>{let C,D;const S=["[--active-fg-color:hsl(var(--step-fg-color))]","[--active-border-color:hsl(var(--step-color))]","[--active-color:hsl(var(--step-color))]","[--complete-background-color:hsl(var(--step-color))]","[--complete-border-color:hsl(var(--step-color))]","[--inactive-border-color:hsl(var(--heroui-default-300))]","[--inactive-color:hsl(var(--heroui-default-300))]"];switch(e){case"primary":C="[--step-color:var(--heroui-primary)]",D="[--step-fg-color:var(--heroui-primary-foreground)]";break;case"secondary":C="[--step-color:var(--heroui-secondary)]",D="[--step-fg-color:var(--heroui-secondary-foreground)]";break;case"success":C="[--step-color:var(--heroui-success)]",D="[--step-fg-color:var(--heroui-success-foreground)]";break;case"warning":C="[--step-color:var(--heroui-warning)]",D="[--step-fg-color:var(--heroui-warning-foreground)]";break;case"danger":C="[--step-color:var(--heroui-danger)]",D="[--step-fg-color:var(--heroui-danger-foreground)]";break;case"default":C="[--step-color:var(--heroui-default)]",D="[--step-fg-color:var(--heroui-default-foreground)]";break;default:C="[--step-color:var(--heroui-primary)]",D="[--step-fg-color:var(--heroui-primary-foreground)]";break}return S.unshift(D),S.unshift(C),S},[e]);return t.jsxs("nav",{ref:$,"aria-label":"Progress",className:c.cn("flex items-center overflow-x-auto",f==="spread"?"w-full justify-between gap-6":"max-w-fit gap-3",b),"data-testid":"stepper-root",...w,children:[d&&u==="left"?t.jsx("span",{className:"text-default-500 text-2xl whitespace-nowrap","data-testid":"stepper-counter",children:m?m(N+1,s):`Step ${N+1} of ${s}`}):null,r&&t.jsx("label",{className:"text-small text-default-foreground lg:text-medium font-light whitespace-nowrap me-3","data-testid":"stepper-label",children:r}),t.jsx("ol",{className:c.cn("flex flex-row flex-nowrap gap-x-3",k,b),"data-testid":"stepper-list",children:Array.from({length:s})?.map((C,D)=>{const S=N===D?"active":N<D?"inactive":"complete",_=n==="activeLabel"&&S==="active"&&!!i?.[D],F=o&&S!=="active"&&!!i?.[D];return t.jsxs("li",{className:"relative flex shrink-0 items-center gap-x-3","data-testid":`stepper-step-${D}`,children:[t.jsx(c.Tooltip,{content:F?i?.[D]:void 0,isDisabled:!F,offset:12,placement:l,classNames:{base:"px-0 py-0",content:"rounded-full border border-default-200 bg-white px-4 py-2 text-small font-medium text-default-700 shadow-sm"},children:t.jsxs("button",{"aria-current":S==="active"?"step":void 0,className:c.cn("group rounded-large flex w-full cursor-pointer flex-row items-center justify-center gap-x-3 py-2.5",{"rounded-full border border-(--active-border-color)/20 bg-(--active-border-color)/10 pl-2 pr-4 py-1.5":_},{"cursor-not-allowed opacity-50":j},y),onClick:()=>!j&&A(D),disabled:j,"data-testid":`stepper-step-btn-${D}`,children:[t.jsx("div",{className:"h-full relative flex items-center",children:t.jsx(Te.LazyMotion,{features:Te.domAnimation,children:t.jsx(Te.m.div,{animate:S,className:"relative z-10",children:t.jsx(Te.m.div,{animate:S,className:c.cn("border-medium text-large text-default-foreground relative z-10 flex h-[26px] w-[26px] shrink-0 items-center justify-center rounded-full font-semibold bg-white",{"border-(--complete-border-color) bg-(--complete-background-color) text-(--active-fg-color)":_,"bg-(--complete-background-color)":S==="complete","shadow-lg":S==="complete"}),initial:!1,transition:{duration:.25},variants:{inactive:{backgroundColor:"transparent",borderColor:"var(--inactive-border-color)",color:"var(--inactive-color)"},active:{backgroundColor:"transparent",borderColor:"var(--active-border-color)",color:"var(--active-color)"},complete:{backgroundColor:"var(--complete-background-color)",borderColor:"var(--complete-border-color)",color:"var(--active-fg-color)"}},children:t.jsx("div",{className:"flex items-center justify-center",children:S==="complete"&&n==="default"?t.jsx(ui,{className:"h-5 w-5 text-(--active-fg-color)","data-testid":`stepper-step-check-${D}`}):t.jsx("span",{children:D+1})})})})})}),_?t.jsx("span",{className:"pr-2 text-2xl leading-none font-medium whitespace-nowrap text-(--active-color)","data-testid":`stepper-step-label-${D}`,children:i[D]}):null]},D)}),D<s-1&&!g&&t.jsx("div",{"aria-hidden":"true",className:"pointer-events-none z-0 w-12 flex-none items-center",style:{"--idx":D},children:t.jsx("div",{className:c.cn("bg-default-200 relative h-0.5 w-full transition-colors duration-300","after:absolute after:block after:h-full after:w-0 after:bg-(--active-border-color) after:transition-[width] after:duration-300 after:content-['']",{"after:w-full":D<N})})})]},D)})}),d&&u==="right"?t.jsx("span",{className:"text-default-500 text-2xl whitespace-nowrap","data-testid":"stepper-counter",children:m?m(N+1,s):`Step ${N+1} of ${s}`}):null]})});mi.displayName="Stepper";function ou(e){return t.jsx("div",{className:"min-h-screen flex flex-col",children:t.jsx("div",{className:"flex-1 flex items-center justify-center p-12",children:t.jsx(c.Alert,{description:"This template combines Navbar, Stepper, Footer, and an event details Card. Include event image, category/spots chips, tags, details grid, and action buttons. Use Card, CardHeader, CardBody for content structure.",title:"TODO: Implement EventDetailsTemplate",variant:"faded",className:"max-w-2xl"})})})}function fe(e,n="en-US",s="USD"){try{return new Intl.NumberFormat(n,{style:"currency",currency:s}).format(e)}catch{return`${s} ${e.toFixed(2)}`}}function Et(e,n="en-US"){try{const s=new Intl.NumberFormat(n,{style:"currency",currency:e}).resolvedOptions();return typeof s.maximumFractionDigits=="number"?s.maximumFractionDigits:2}catch{return 2}}function _s(e,n,s="en-US"){const a=Et(n,s),r=Math.pow(10,a);return Math.round(e*r)/r}function us(e,n,s,a){return _s(e-n,s,a)}const Ea={primary:{active:"hsl(var(--heroui-primary))",fg:"hsl(var(--heroui-primary-foreground))"},secondary:{active:"hsl(var(--heroui-secondary))",fg:"hsl(var(--heroui-secondary-foreground))"},success:{active:"hsl(var(--heroui-success))",fg:"hsl(var(--heroui-success-foreground))"},warning:{active:"hsl(var(--heroui-warning))",fg:"hsl(var(--heroui-warning-foreground))"},danger:{active:"hsl(var(--heroui-danger))",fg:"hsl(var(--heroui-danger-foreground))"},default:{active:"hsl(var(--heroui-default))",fg:"hsl(var(--heroui-default-foreground))"}},cu="rgb(156 163 175)",du="rgb(107 114 128)",fi=h.forwardRef(function({color:n="primary",steps:s=[],defaultStep:a=0,onStepChange:r,currentStep:i,hideProgressBars:o=!1,activeColor:l,activeForegroundColor:d,inactiveColor:u=cu,inactiveLabelColor:f=du,activeStepVariant:m="bordered",stepClassName:p,circleClassName:x,progressBarClassName:g,labelsClassName:y,labelSlotClassName:b,activeLabelClassName:j,inactiveLabelClassName:w,className:$,ariaLabel:N="Progress",invalidLabelSuffix:A=", has errors",testId:k,isStepReachable:C,...D},S){const[_,F]=An(i,a,r),L=Ea[n]??Ea.primary,M=l??L.active,I=d??L.fg,W=(K,z)=>{const G=K.ariaLabel??(typeof K.title=="string"?K.title:null)??`${z+1}`;return K.invalid?`${G}${A}`:G};return t.jsxs("nav",{...D,"aria-label":N,...k?{"data-testid":k}:{},children:[t.jsx("div",{className:c.cn("flex items-center",$),children:s?.map((K,z)=>{const ne=z===_?"active":z<_?"complete":"inactive",G=C?C(z):!0;return t.jsxs(h.Fragment,{children:[t.jsx(O,{ref:S,isIconOnly:!0,disableAnimation:!0,radius:"full",variant:"light",testId:`${k??"horizontal-steps"}-step-${z}`,"aria-current":ne==="active"?"step":void 0,"aria-describedby":K.describedBy,"aria-label":W(K,z),"data-invalid":K.invalid?"true":void 0,isDisabled:!G,className:c.cn("size-8 min-w-8 shrink-0 overflow-visible bg-transparent p-0","data-[hover=true]:bg-transparent",G?"cursor-pointer":"cursor-not-allowed","data-[disabled=true]:opacity-40",K.className,p),onPress:()=>{if(i===void 0){F(z);return}r?.(z)},children:t.jsx(Te.LazyMotion,{features:Te.domAnimation,children:t.jsx(Te.m.div,{animate:ne,className:c.cn("relative flex size-8 items-center justify-center rounded-full text-[13px] font-medium",x),initial:!1,transition:{duration:.2},variants:{inactive:{backgroundColor:"transparent",borderColor:u,borderWidth:"1.5px",color:u},active:{backgroundColor:m==="solid"?M:"transparent",borderColor:M,borderWidth:"1.5px",color:m==="solid"?I:M},complete:{backgroundColor:M,borderColor:M,borderWidth:"1.5px",color:M}},children:ne==="complete"?t.jsx(ui,{className:"size-4",style:{color:I}}):t.jsx("span",{children:z+1})})})}),z<s.length-1&&!o&&t.jsx("div",{"aria-hidden":!0,className:c.cn("mx-1 h-px w-6 shrink-0 transition-colors duration-300 sm:mx-1.5 sm:w-14 md:w-20",g),style:{backgroundColor:z<_?M:u}})]},z)})}),t.jsx("div",{className:c.cn("mt-2.5 hidden md:flex",y),children:s?.map((K,z)=>{const ne=z<=_;return t.jsxs(h.Fragment,{children:[t.jsx("div",{className:c.cn("relative flex w-8 shrink-0 justify-center overflow-visible",b),children:t.jsx("span",{className:c.cn("absolute left-1/2 top-0 -translate-x-1/2 whitespace-nowrap text-center text-[12px] font-medium transition-colors duration-200",ne?j:w),style:{color:ne?M:f},children:K.title})}),z<s.length-1&&!o&&t.jsx("div",{className:c.cn("mx-1 w-6 shrink-0 sm:mx-1.5 sm:w-14 md:w-20",g)})]},z)})})]})});fi.displayName="HorizontalSteps";function uu(){return t.jsxs("footer",{"data-testid":"footer",className:"fixed left-0 bottom-0 w-full text-left p-4 bg-white font-inter font-light text-base text-zinc-500",children:["Powered by Veevart ® ",new Date().getFullYear()]})}const mu=e=>{const n=h.useMemo(()=>JSON.stringify({allItems:e.allItems,selected:e.selected}),[e.allItems,e.selected]);return t.jsx(fu,{...e},n)},fu=({allItems:e,selected:n,onSelectedChange:s,titleLeft:a,titleRight:r})=>{const[i,o]=h.useState([]),[l,d]=h.useState([]),[u,f]=h.useState(null),[m,p]=h.useState(null),x=h.useMemo(()=>new Set(n),[n]),g=h.useMemo(()=>new Set(e),[e]),y=h.useMemo(()=>e.filter(F=>!x.has(F)),[e,x]),b=F=>{if(F.length===0)return;const L=Array.from(new Set([...n,...F]));s(L)},j=F=>{if(F.length===0)return;const L=new Set(F);s(n.filter(M=>!L.has(M)))},w=()=>{i.length!==0&&(b(i),o([]))},$=()=>{l.length!==0&&(j(l),d([]))},N=()=>{y.length!==0&&(b(y),o([]))},A=()=>{n.length!==0&&(s([]),d([]))},k=(F,L,M)=>{const I=Math.min(L,M),W=Math.max(L,M);return F.slice(I,W+1)},C=(F,L,M)=>{if(M&&u!==null){o(k(y,u,L)),d([]),f(L);return}const I=i.includes(F);o(I?i.filter(W=>W!==F):[...i,F]),d([]),f(L)},D=(F,L,M)=>{if(M&&m!==null){d(k(n,m,L)),o([]),p(L);return}const I=l.includes(F);d(I?l.filter(W=>W!==F):[...l,F]),o([]),p(L)},S=(F,L,M)=>{const I=M==="available"?i.includes(L)?i:[L]:l.includes(L)?l:[L];F.dataTransfer.setData("text/plain",JSON.stringify({source:M,items:I})),F.dataTransfer.effectAllowed="move"},_=(F,L)=>{F.preventDefault();const M=F.dataTransfer.getData("text/plain");if(M)try{const I=JSON.parse(M),W=(I.items||[]).filter(K=>g.has(K));if(W.length===0||I.source===L)return;L==="selected"?(b(W),o([])):(j(W),d([]))}catch{return}};return t.jsxs("div",{className:"flex flex-col gap-6 md:flex-row md:items-start md:justify-between",children:[t.jsxs("div",{className:"flex w-full flex-col gap-3 md:w-2/5",children:[t.jsx("h2",{className:"text-sm font-medium text-gray-700",children:a}),t.jsx(c.Card,{className:"w-full border border-gray-200 shadow-none",children:t.jsx(c.CardBody,{className:"h-60 gap-2 overflow-y-auto",onDragOver:F=>F.preventDefault(),onDrop:F=>_(F,"available"),children:y.map((F,L)=>{const M=i.includes(F);return t.jsx("button",{type:"button",onClick:I=>{C(F,L,I.shiftKey)},onMouseDown:I=>{I.shiftKey&&I.preventDefault()},draggable:!0,onDragStart:I=>S(I,F,"available"),className:`rounded-md px-3 py-2 text-left text-sm transition ${M?"bg-[#E4571E]/10 text-[#E4571E]":"text-gray-700 hover:bg-gray-100"}`,children:F},F)})})})]}),t.jsxs("div",{className:"flex flex-row items-center justify-center gap-3 md:flex-col md:pt-6",children:[t.jsx(O,{variant:"light",className:"h-10 w-10 min-w-0 text-2xl font-semibold text-[#E4571E] hover:bg-[#E4571E]/10",isIconOnly:!0,"data-testid":"move-selected-to-available",onPress:w,isDisabled:i.length===0,"aria-label":"Move selected to right",children:"›"}),t.jsx(O,{variant:"light",className:"h-10 w-10 min-w-0 text-2xl font-semibold text-[#E4571E] hover:bg-[#E4571E]/10",isIconOnly:!0,"data-testid":"move-selected-to-available",onPress:$,isDisabled:l.length===0,"aria-label":"Move selected to left",children:"‹"}),t.jsx(O,{variant:"light",className:"h-10 w-10 min-w-0 text-2xl font-semibold text-[#E4571E] hover:bg-[#E4571E]/10",isIconOnly:!0,"data-testid":"move-all-to-selected",onPress:N,isDisabled:y.length===0,"aria-label":"Move all to right",children:"»"}),t.jsx(O,{variant:"light",className:"h-10 w-10 min-w-0 text-2xl font-semibold text-[#E4571E] hover:bg-[#E4571E]/10",isIconOnly:!0,onPress:A,"data-testid":"move-all-to-available",isDisabled:n.length===0,"aria-label":"Move all to left",children:"«"})]}),t.jsxs("div",{className:"flex w-full flex-col gap-3 md:w-2/5",children:[t.jsx("h2",{className:"text-sm font-medium text-gray-700",children:r}),t.jsx(c.Card,{className:"w-full border border-gray-200 shadow-none",children:t.jsx(c.CardBody,{className:"h-60 gap-2 overflow-y-auto",onDragOver:F=>F.preventDefault(),onDrop:F=>_(F,"selected"),children:n.map((F,L)=>{const M=l.includes(F);return t.jsx("button",{type:"button",onClick:I=>{D(F,L,I.shiftKey)},onMouseDown:I=>{I.shiftKey&&I.preventDefault()},draggable:!0,onDragStart:I=>S(I,F,"selected"),className:`rounded-md px-3 py-2 text-left text-sm transition ${M?"bg-[#E4571E]/10 text-[#E4571E]":"text-gray-700 hover:bg-gray-100"}`,children:F},F)})})})]})]})};function Kt(e){return typeof e=="string"?e:e.type}function xt({className:e}){return t.jsx("div",{className:`flex items-center h-6 ${e||""}`,children:t.jsx(c.Divider,{orientation:"vertical"})})}function ht({icon:e,label:n,isActive:s=!1,isDisabled:a=!1,onClick:r,shortcut:i,iconSize:o=16,className:l}){const d=i?`${n} (${i})`:n;return t.jsx(c.Tooltip,{content:d,placement:"top",offset:10,children:t.jsx(O,{size:"sm",radius:"sm",color:s?"primary":"default",variant:s?"solid":"bordered",isIconOnly:!0,isDisabled:a,onPress:r,"aria-label":n,className:l,children:t.jsx(e,{size:o})})})}const lt={bold:{execute:({editor:e})=>e.chain().focus().toggleBold().run(),canExecute:e=>e.can().chain().focus().toggleBold().run(),isActive:e=>e.isActive("bold"),shortcut:"Mod-b",label:"Bold"},italic:{execute:({editor:e})=>e.chain().focus().toggleItalic().run(),canExecute:e=>e.can().chain().focus().toggleItalic().run(),isActive:e=>e.isActive("italic"),shortcut:"Mod-i",label:"Italic"},strike:{execute:({editor:e})=>e.chain().focus().toggleStrike().run(),canExecute:e=>e.can().chain().focus().toggleStrike().run(),isActive:e=>e.isActive("strike"),shortcut:"Mod-Shift-x",label:"Strikethrough"},underline:{execute:({editor:e})=>e.chain().focus().toggleUnderline().run(),canExecute:e=>e.can().chain().focus().toggleUnderline().run(),isActive:e=>e.isActive("underline"),shortcut:"Mod-u",label:"Underline"},code:{execute:({editor:e})=>e.chain().focus().toggleCode().run(),canExecute:e=>e.can().chain().focus().toggleCode().run(),isActive:e=>e.isActive("code"),shortcut:"Mod-e",label:"Inline code"},textColor:{execute:({editor:e,config:n})=>{const s=n?.type==="textColor"?n.color:"";s?e.chain().focus().setColor(s).run():e.chain().focus().unsetColor().run()},canExecute:()=>!0,isActive:e=>e.isActive("textStyle"),label:"Text color"},highlight:{execute:({editor:e,config:n})=>{const s=n?.type==="highlight"?n.color:"";s?e.chain().focus().setHighlight({color:s}).run():e.chain().focus().unsetHighlight().run()},canExecute:()=>!0,isActive:e=>e.isActive("highlight"),label:"Highlight"},link:{execute:({editor:e,config:n})=>{const s=n?.type==="link"?n.href:"";if(s){const a=n?.type==="link"?n.target:void 0,r=n?.type==="link"?n.rel:void 0;e.chain().focus().setLink({href:s,target:a,rel:r}).run()}else e.chain().focus().unsetLink().run()},canExecute:()=>!0,isActive:e=>e.isActive("link"),shortcut:"Mod-k",label:"Link"},paragraph:{execute:({editor:e})=>e.chain().focus().setParagraph().run(),canExecute:e=>e.can().chain().focus().setParagraph().run(),isActive:e=>e.isActive("paragraph"),shortcut:"Mod-Alt-0",label:"Paragraph"},heading:{execute:({editor:e,config:n})=>{const s=n?.type==="heading"?n.level:1;e.chain().focus().toggleHeading({level:s}).run()},canExecute:(e,n)=>{const s=n?.type==="heading"?n.level:1;return e.can().chain().focus().toggleHeading({level:s}).run()},isActive:(e,n)=>n?.type==="heading"?e.isActive("heading",{level:n.level}):e.isActive("heading"),label:"Heading"},bulletList:{execute:({editor:e})=>e.chain().focus().toggleBulletList().run(),canExecute:e=>e.can().chain().focus().toggleBulletList().run(),isActive:e=>e.isActive("bulletList"),shortcut:"Mod-Shift-8",label:"Bullet list"},orderedList:{execute:({editor:e})=>e.chain().focus().toggleOrderedList().run(),canExecute:e=>e.can().chain().focus().toggleOrderedList().run(),isActive:e=>e.isActive("orderedList"),shortcut:"Mod-Shift-7",label:"Numbered list"},taskList:{execute:({editor:e})=>e.chain().focus().toggleTaskList().run(),canExecute:e=>e.can().chain().focus().toggleTaskList().run(),isActive:e=>e.isActive("taskList"),label:"Task list"},codeBlock:{execute:({editor:e})=>e.chain().focus().toggleCodeBlock().run(),canExecute:e=>e.can().chain().focus().toggleCodeBlock().run(),isActive:e=>e.isActive("codeBlock"),shortcut:"Mod-Alt-c",label:"Code block"},blockquote:{execute:({editor:e})=>e.chain().focus().toggleBlockquote().run(),canExecute:e=>e.can().chain().focus().toggleBlockquote().run(),isActive:e=>e.isActive("blockquote"),shortcut:"Mod-Shift-b",label:"Blockquote"},horizontalRule:{execute:({editor:e})=>e.chain().focus().setHorizontalRule().run(),canExecute:e=>e.can().chain().focus().setHorizontalRule().run(),isActive:()=>!1,label:"Horizontal rule"},hardBreak:{execute:({editor:e})=>e.chain().focus().setHardBreak().run(),canExecute:e=>e.can().chain().focus().setHardBreak().run(),isActive:()=>!1,shortcut:"Mod-Enter",label:"Line break"},textAlign:{execute:({editor:e,config:n})=>{const s=n?.type==="textAlign"?n.alignment:"left";e.chain().focus().setTextAlign(s).run()},canExecute:()=>!0,isActive:(e,n)=>n?.type==="textAlign"?e.isActive({textAlign:n.alignment}):!1,label:"Text alignment"},clearMarks:{execute:({editor:e})=>e.chain().focus().unsetAllMarks().run(),canExecute:e=>e.can().chain().focus().unsetAllMarks().run(),isActive:()=>!1,label:"Clear formatting"},clearNodes:{execute:({editor:e})=>e.chain().focus().clearNodes().run(),canExecute:e=>e.can().chain().focus().clearNodes().run(),isActive:()=>!1,label:"Clear nodes"},undo:{execute:({editor:e})=>e.chain().focus().undo().run(),canExecute:e=>e.can().chain().focus().undo().run(),isActive:()=>!1,shortcut:"Mod-z",label:"Undo"},redo:{execute:({editor:e})=>e.chain().focus().redo().run(),canExecute:e=>e.can().chain().focus().redo().run(),isActive:()=>!1,shortcut:"Mod-Shift-z",label:"Redo"}},xu={1:"Heading 1",2:"Heading 2",3:"Heading 3",4:"Heading 4",5:"Heading 5",6:"Heading 6"};function pu({editor:e,levels:n=[1,2,3,4,5,6],isDisabled:s=!1}){const[,a]=h.useState(0);h.useEffect(()=>{const o=()=>a(l=>l+1);return e.on("selectionUpdate",o),e.on("transaction",o),()=>{e.off("selectionUpdate",o),e.off("transaction",o)}},[e]);const r=n.find(o=>e.isActive("heading",{level:o})),i=o=>{const l=Number(o),d=lt.heading;d&&d.execute({editor:e,config:{type:"heading",level:l}})};return t.jsxs(c.Dropdown,{placement:"top-start",offset:10,children:[t.jsx(c.DropdownTrigger,{children:t.jsx(O,{size:"sm",radius:"sm",variant:r?"solid":"bordered",color:r?"primary":"default",isDisabled:s,startContent:t.jsx(X.Heading,{size:16}),"aria-label":"Select heading level",children:r?`H${r}`:"H"})}),t.jsx(c.DropdownMenu,{"aria-label":"Heading levels",selectionMode:"single",selectedKeys:r?new Set([String(r)]):new Set,onAction:i,children:n.map(o=>t.jsx(c.DropdownItem,{startContent:e.isActive("heading",{level:o})?t.jsx(X.Check,{size:16}):t.jsx("div",{className:"w-4"}),children:xu[o]},o))})]})}const Hn={bulletList:{label:"Bullet List",icon:X.List},orderedList:{label:"Numbered List",icon:X.ListOrdered},taskList:{label:"Task List",icon:X.ListTodo}};function hu({editor:e,types:n=["bulletList","orderedList","taskList"],isDisabled:s=!1}){const[,a]=h.useState(0);h.useEffect(()=>{const l=()=>a(d=>d+1);return e.on("selectionUpdate",l),e.on("transaction",l),()=>{e.off("selectionUpdate",l),e.off("transaction",l)}},[e]);const r=n.find(l=>e.isActive(l)),i=r?Hn[r].icon:X.List,o=l=>{const u=lt[l];u&&u.execute({editor:e})};return t.jsxs(c.Dropdown,{placement:"top-start",offset:10,children:[t.jsx(c.DropdownTrigger,{children:t.jsx(O,{size:"sm",radius:"sm",variant:r?"solid":"bordered",color:r?"primary":"default",isDisabled:s,isIconOnly:!0,"aria-label":"Select list type",children:t.jsx(i,{size:16})})}),t.jsx(c.DropdownMenu,{"aria-label":"List types",selectionMode:"single",selectedKeys:r?new Set([r]):new Set,onAction:o,children:n.map(l=>{const d=Hn[l].icon;return t.jsx(c.DropdownItem,{startContent:t.jsx(d,{size:16}),children:Hn[l].label},l)})})]})}function bu({colors:e,selectedColor:n,onColorSelect:s,columns:a=4}){return t.jsx("div",{className:"grid gap-2",style:{gridTemplateColumns:`repeat(${a}, minmax(0, 1fr))`},children:e.map(r=>{const i=n===r;return t.jsx("button",{type:"button",onClick:()=>s(r),className:`
7
+ `}const le={line:"#E7E7E9","line-2":"#F1F1F3",hair:"#F0F0F1",page:"#FBFBFB",field:"#E5E5E5","line-strong":"#D4D4D8",ink:"#18181B",muted:"#71717A",faint:"#A1A1AA","ok-fill":"#EAF3DE",ok:"#3B6D11","warn-fill":"#FAEEDA",warn:"#854F0B","warn-icon":"#EFD9B2","danger-fill":"#FCEBEB",danger:Ee.semantic.danger,"danger-icon":"#F3D3CF","info-fill":"#EAF1FC",info:"#1D4FA8","violet-fill":"#F1ECFB",violet:"#6D28D9","neutral-fill":"#F4F4F5",neutral:"#52525B",destructive:"#A32D2D"};({...le});const $r=h.createContext(void 0);function Ar(){return h.useContext($r)}function $c({children:e,closeLabel:n,locale:s,reducedMotion:a="user"}){const r=Ar();return t.jsx(c.HeroUIProvider,{locale:s,reducedMotion:a,children:t.jsx($r.Provider,{value:n??r,children:e})})}const Er="(prefers-reduced-motion: reduce)",Dr="data-pos-reduce-motion",ke="motion-reduce:transition-none [html[data-pos-reduce-motion=true]_&]:transition-none",Lr="motion-reduce:animate-none [html[data-pos-reduce-motion=true]_&]:animate-none",on=`rounded-[0.375rem] bg-[linear-gradient(90deg,#F0F0F1_0,#F9F9FA_12.5rem,#F0F0F1_25rem)] bg-[length:50rem_100%] animate-record-shimmer ${Lr}`;function Ac(){return typeof document>"u"?!1:document.documentElement.getAttribute(Dr)==="true"?!0:typeof window.matchMedia=="function"&&window.matchMedia(Er).matches}function Cn(){const[e,n]=h.useState(!1);return h.useEffect(()=>{const s=()=>n(Ac()),a=typeof window.matchMedia=="function"?window.matchMedia(Er):null;a?.addEventListener?.("change",s);const r=typeof MutationObserver>"u"?null:new MutationObserver(s);return r?.observe(document.documentElement,{attributes:!0,attributeFilter:[Dr]}),s(),()=>{a?.removeEventListener?.("change",s),r?.disconnect()}},[]),e}const Ec="whitespace-normal overflow-visible text-clip break-words";function Dc({toastProps:e,disableAnimation:n,...s}){const a=Cn();return t.jsx(c.ToastProvider,{...s,disableAnimation:n??(a||void 0),toastProps:{...e,classNames:{...e?.classNames,title:c.cn(Ec,e?.classNames?.title)}}})}const Fr=h.createContext("default");function kn(){return h.useContext(Fr)}function Lc(e){return kn()==="touch"?"lg":e}function Fc({density:e,children:n}){return t.jsx(Fr.Provider,{value:e,children:n})}function Rc(e,n){const s=e.icons,a=e.aliases||Object.create(null),r=Object.create(null);function i(o){if(s[o])return r[o]=[];if(!(o in r)){r[o]=null;const l=a[o]&&a[o].parent,d=l&&i(l);d&&(r[o]=[l].concat(d))}return r[o]}return Object.keys(s).concat(Object.keys(a)).forEach(i),r}const Rr=Object.freeze({left:0,top:0,width:16,height:16}),xn=Object.freeze({rotate:0,vFlip:!1,hFlip:!1}),ks=Object.freeze({...Rr,...xn}),is=Object.freeze({...ks,body:"",hidden:!1});function _c(e,n){const s={};!e.hFlip!=!n.hFlip&&(s.hFlip=!0),!e.vFlip!=!n.vFlip&&(s.vFlip=!0);const a=((e.rotate||0)+(n.rotate||0))%4;return a&&(s.rotate=a),s}function pa(e,n){const s=_c(e,n);for(const a in is)a in xn?a in e&&!(a in s)&&(s[a]=xn[a]):a in n?s[a]=n[a]:a in e&&(s[a]=e[a]);return s}function Mc(e,n,s){const a=e.icons,r=e.aliases||Object.create(null);let i={};function o(l){i=pa(a[l]||r[l],i)}return o(n),s.forEach(o),pa(e,i)}function _r(e,n){const s=[];if(typeof e!="object"||typeof e.icons!="object")return s;e.not_found instanceof Array&&e.not_found.forEach(r=>{n(r,null),s.push(r)});const a=Rc(e);for(const r in a){const i=a[r];i&&(n(r,Mc(e,r,i)),s.push(r))}return s}const Pc={provider:"",aliases:{},not_found:{},...Rr};function In(e,n){for(const s in n)if(s in e&&typeof e[s]!=typeof n[s])return!1;return!0}function Mr(e){if(typeof e!="object"||e===null)return null;const n=e;if(typeof n.prefix!="string"||!e.icons||typeof e.icons!="object"||!In(e,Pc))return null;const s=n.icons;for(const r in s){const i=s[r];if(!r||typeof i.body!="string"||!In(i,is))return null}const a=n.aliases||Object.create(null);for(const r in a){const i=a[r],o=i.parent;if(!r||typeof o!="string"||!s[o]&&!a[o]||!In(i,is))return null}return n}const ha=Object.create(null);function Tc(e,n){return{provider:e,prefix:n,icons:Object.create(null),missing:new Set}}function At(e,n){const s=ha[e]||(ha[e]=Object.create(null));return s[n]||(s[n]=Tc(e,n))}function Pr(e,n){return Mr(n)?_r(n,(s,a)=>{a?e.icons[s]=a:e.missing.add(s)}):[]}function Ic(e,n,s){try{if(typeof s.body=="string")return e.icons[n]={...s},!0}catch{}return!1}const Tr=/^[a-z0-9]+(-[a-z0-9]+)*$/,Sn=(e,n,s,a="")=>{const r=e.split(":");if(e.slice(0,1)==="@"){if(r.length<2||r.length>3)return null;a=r.shift().slice(1)}if(r.length>3||!r.length)return null;if(r.length>1){const l=r.pop(),d=r.pop(),u={provider:r.length>0?r[0]:a,prefix:d,name:l};return n&&!cn(u)?null:u}const i=r[0],o=i.split("-");if(o.length>1){const l={provider:a,prefix:o.shift(),name:o.join("-")};return n&&!cn(l)?null:l}if(s&&a===""){const l={provider:a,prefix:"",name:i};return n&&!cn(l,s)?null:l}return null},cn=(e,n)=>e?!!((n&&e.prefix===""||e.prefix)&&e.name):!1;let Wt=!1;function Ir(e){return typeof e=="boolean"&&(Wt=e),Wt}function ba(e){const n=typeof e=="string"?Sn(e,!0,Wt):e;if(n){const s=At(n.provider,n.prefix),a=n.name;return s.icons[a]||(s.missing.has(a)?null:void 0)}}function Oc(e,n){const s=Sn(e,!0,Wt);if(!s)return!1;const a=At(s.provider,s.prefix);return n?Ic(a,s.name,n):(a.missing.add(s.name),!0)}function zc(e,n){if(typeof e!="object")return!1;if(typeof n!="string"&&(n=e.provider||""),Wt&&!n&&!e.prefix){let r=!1;return Mr(e)&&(e.prefix="",_r(e,(i,o)=>{Oc(i,o)&&(r=!0)})),r}const s=e.prefix;if(!cn({prefix:s,name:"a"}))return!1;const a=At(n,s);return!!Pr(a,e)}const Or=Object.freeze({width:null,height:null}),zr=Object.freeze({...Or,...xn}),Bc=/(-?[0-9.]*[0-9]+[0-9.]*)/g,Vc=/^-?[0-9.]*[0-9]+[0-9.]*$/g;function ga(e,n,s){if(n===1)return e;if(s=s||100,typeof e=="number")return Math.ceil(e*n*s)/s;if(typeof e!="string")return e;const a=e.split(Bc);if(a===null||!a.length)return e;const r=[];let i=a.shift(),o=Vc.test(i);for(;;){if(o){const l=parseFloat(i);isNaN(l)?r.push(i):r.push(Math.ceil(l*n*s)/s)}else r.push(i);if(i=a.shift(),i===void 0)return r.join("");o=!o}}function Uc(e,n="defs"){let s="";const a=e.indexOf("<"+n);for(;a>=0;){const r=e.indexOf(">",a),i=e.indexOf("</"+n);if(r===-1||i===-1)break;const o=e.indexOf(">",i);if(o===-1)break;s+=e.slice(r+1,i).trim(),e=e.slice(0,a).trim()+e.slice(o+1)}return{defs:s,content:e}}function Hc(e,n){return e?"<defs>"+e+"</defs>"+n:n}function Wc(e,n,s){const a=Uc(e);return Hc(a.defs,n+a.content+s)}const qc=e=>e==="unset"||e==="undefined"||e==="none";function Gc(e,n){const s={...ks,...e},a={...zr,...n},r={left:s.left,top:s.top,width:s.width,height:s.height};let i=s.body;[s,a].forEach(y=>{const b=[],v=y.hFlip,w=y.vFlip;let $=y.rotate;v?w?$+=2:(b.push("translate("+(r.width+r.left).toString()+" "+(0-r.top).toString()+")"),b.push("scale(-1 1)"),r.top=r.left=0):w&&(b.push("translate("+(0-r.left).toString()+" "+(r.height+r.top).toString()+")"),b.push("scale(1 -1)"),r.top=r.left=0);let N;switch($<0&&($-=Math.floor($/4)*4),$=$%4,$){case 1:N=r.height/2+r.top,b.unshift("rotate(90 "+N.toString()+" "+N.toString()+")");break;case 2:b.unshift("rotate(180 "+(r.width/2+r.left).toString()+" "+(r.height/2+r.top).toString()+")");break;case 3:N=r.width/2+r.left,b.unshift("rotate(-90 "+N.toString()+" "+N.toString()+")");break}$%2===1&&(r.left!==r.top&&(N=r.left,r.left=r.top,r.top=N),r.width!==r.height&&(N=r.width,r.width=r.height,r.height=N)),b.length&&(i=Wc(i,'<g transform="'+b.join(" ")+'">',"</g>"))});const o=a.width,l=a.height,d=r.width,u=r.height;let f,m;o===null?(m=l===null?"1em":l==="auto"?u:l,f=ga(m,d/u)):(f=o==="auto"?d:o,m=l===null?ga(f,u/d):l==="auto"?u:l);const p={},x=(y,b)=>{qc(b)||(p[y]=b.toString())};x("width",f),x("height",m);const g=[r.left,r.top,d,u];return p.viewBox=g.join(" "),{attributes:p,viewBox:g,body:i}}const Kc=/\sid="(\S+)"/g,Yc="IconifyId"+Date.now().toString(16)+(Math.random()*16777216|0).toString(16);let Qc=0;function Zc(e,n=Yc){const s=[];let a;for(;a=Kc.exec(e);)s.push(a[1]);if(!s.length)return e;const r="suffix"+(Math.random()*16777216|Date.now()).toString(16);return s.forEach(i=>{const o=typeof n=="function"?n(i):n+(Qc++).toString(),l=i.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");e=e.replace(new RegExp('([#;"])('+l+')([")]|\\.[a-z])',"g"),"$1"+o+r+"$3")}),e=e.replace(new RegExp(r,"g"),""),e}const ls=Object.create(null);function Xc(e,n){ls[e]=n}function os(e){return ls[e]||ls[""]}function Ss(e){let n;if(typeof e.resources=="string")n=[e.resources];else if(n=e.resources,!(n instanceof Array)||!n.length)return null;return{resources:n,path:e.path||"/",maxURL:e.maxURL||500,rotate:e.rotate||750,timeout:e.timeout||5e3,random:e.random===!0,index:e.index||0,dataAfterTimeout:e.dataAfterTimeout!==!1}}const $s=Object.create(null),Ft=["https://api.simplesvg.com","https://api.unisvg.com"],dn=[];for(;Ft.length>0;)Ft.length===1||Math.random()>.5?dn.push(Ft.shift()):dn.push(Ft.pop());$s[""]=Ss({resources:["https://api.iconify.design"].concat(dn)});function Jc(e,n){const s=Ss(n);return s===null?!1:($s[e]=s,!0)}function As(e){return $s[e]}const ed=()=>{let e;try{if(e=fetch,typeof e=="function")return e}catch{}};let ya=ed();function td(e,n){const s=As(e);if(!s)return 0;let a;if(!s.maxURL)a=0;else{let r=0;s.resources.forEach(o=>{r=Math.max(r,o.length)});const i=n+".json?icons=";a=s.maxURL-r-s.path.length-i.length}return a}function nd(e){return e===404}const sd=(e,n,s)=>{const a=[],r=td(e,n),i="icons";let o={type:i,provider:e,prefix:n,icons:[]},l=0;return s.forEach((d,u)=>{l+=d.length+1,l>=r&&u>0&&(a.push(o),o={type:i,provider:e,prefix:n,icons:[]},l=d.length),o.icons.push(d)}),a.push(o),a};function ad(e){if(typeof e=="string"){const n=As(e);if(n)return n.path}return"/"}const rd=(e,n,s)=>{if(!ya){s("abort",424);return}let a=ad(n.provider);switch(n.type){case"icons":{const i=n.prefix,l=n.icons.join(","),d=new URLSearchParams({icons:l});a+=i+".json?"+d.toString();break}case"custom":{const i=n.uri;a+=i.slice(0,1)==="/"?i.slice(1):i;break}default:s("abort",400);return}let r=503;ya(e+a).then(i=>{const o=i.status;if(o!==200){setTimeout(()=>{s(nd(o)?"abort":"next",o)});return}return r=501,i.json()}).then(i=>{if(typeof i!="object"||i===null){setTimeout(()=>{i===404?s("abort",i):s("next",r)});return}setTimeout(()=>{s("success",i)})}).catch(()=>{s("next",r)})},id={prepare:sd,send:rd};function Br(e,n){e.forEach(s=>{const a=s.loaderCallbacks;a&&(s.loaderCallbacks=a.filter(r=>r.id!==n))})}function ld(e){e.pendingCallbacksFlag||(e.pendingCallbacksFlag=!0,setTimeout(()=>{e.pendingCallbacksFlag=!1;const n=e.loaderCallbacks?e.loaderCallbacks.slice(0):[];if(!n.length)return;let s=!1;const a=e.provider,r=e.prefix;n.forEach(i=>{const o=i.icons,l=o.pending.length;o.pending=o.pending.filter(d=>{if(d.prefix!==r)return!0;const u=d.name;if(e.icons[u])o.loaded.push({provider:a,prefix:r,name:u});else if(e.missing.has(u))o.missing.push({provider:a,prefix:r,name:u});else return s=!0,!0;return!1}),o.pending.length!==l&&(s||Br([e],i.id),i.callback(o.loaded.slice(0),o.missing.slice(0),o.pending.slice(0),i.abort))})}))}let od=0;function cd(e,n,s){const a=od++,r=Br.bind(null,s,a);if(!n.pending.length)return r;const i={id:a,icons:n,callback:e,abort:r};return s.forEach(o=>{(o.loaderCallbacks||(o.loaderCallbacks=[])).push(i)}),r}function dd(e){const n={loaded:[],missing:[],pending:[]},s=Object.create(null);e.sort((r,i)=>r.provider!==i.provider?r.provider.localeCompare(i.provider):r.prefix!==i.prefix?r.prefix.localeCompare(i.prefix):r.name.localeCompare(i.name));let a={provider:"",prefix:"",name:""};return e.forEach(r=>{if(a.name===r.name&&a.prefix===r.prefix&&a.provider===r.provider)return;a=r;const i=r.provider,o=r.prefix,l=r.name,d=s[i]||(s[i]=Object.create(null)),u=d[o]||(d[o]=At(i,o));let f;l in u.icons?f=n.loaded:o===""||u.missing.has(l)?f=n.missing:f=n.pending;const m={provider:i,prefix:o,name:l};f.push(m)}),n}function ud(e,n=!0,s=!1){const a=[];return e.forEach(r=>{const i=typeof r=="string"?Sn(r,n,s):r;i&&a.push(i)}),a}const md={resources:[],index:0,timeout:2e3,rotate:750,random:!1,dataAfterTimeout:!1};function fd(e,n,s,a){const r=e.resources.length,i=e.random?Math.floor(Math.random()*r):e.index;let o;if(e.random){let k=e.resources.slice(0);for(o=[];k.length>1;){const C=Math.floor(Math.random()*k.length);o.push(k[C]),k=k.slice(0,C).concat(k.slice(C+1))}o=o.concat(k)}else o=e.resources.slice(i).concat(e.resources.slice(0,i));const l=Date.now();let d="pending",u=0,f,m=null,p=[],x=[];typeof a=="function"&&x.push(a);function g(){m&&(clearTimeout(m),m=null)}function y(){d==="pending"&&(d="aborted"),g(),p.forEach(k=>{k.status==="pending"&&(k.status="aborted")}),p=[]}function b(k,C){C&&(x=[]),typeof k=="function"&&x.push(k)}function v(){return{startTime:l,payload:n,status:d,queriesSent:u,queriesPending:p.length,subscribe:b,abort:y}}function w(){d="failed",x.forEach(k=>{k(void 0,f)})}function $(){p.forEach(k=>{k.status==="pending"&&(k.status="aborted")}),p=[]}function N(k,C,E){const S=C!=="success";switch(p=p.filter(_=>_!==k),d){case"pending":break;case"failed":if(S||!e.dataAfterTimeout)return;break;default:return}if(C==="abort"){f=E,w();return}if(S){f=E,p.length||(o.length?A():w());return}if(g(),$(),!e.random){const _=e.resources.indexOf(k.resource);_!==-1&&_!==e.index&&(e.index=_)}d="completed",x.forEach(_=>{_(E)})}function A(){if(d!=="pending")return;g();const k=o.shift();if(k===void 0){if(p.length){m=setTimeout(()=>{g(),d==="pending"&&($(),w())},e.timeout);return}w();return}const C={status:"pending",resource:k,callback:(E,S)=>{N(C,E,S)}};p.push(C),u++,m=setTimeout(A,e.rotate),s(k,n,C.callback)}return setTimeout(A),v}function Vr(e){const n={...md,...e};let s=[];function a(){s=s.filter(l=>l().status==="pending")}function r(l,d,u){const f=fd(n,l,d,(m,p)=>{a(),u&&u(m,p)});return s.push(f),f}function i(l){return s.find(d=>l(d))||null}return{query:r,find:i,setIndex:l=>{n.index=l},getIndex:()=>n.index,cleanup:a}}function va(){}const On=Object.create(null);function xd(e){if(!On[e]){const n=As(e);if(!n)return;const s=Vr(n),a={config:n,redundancy:s};On[e]=a}return On[e]}function pd(e,n,s){let a,r;if(typeof e=="string"){const i=os(e);if(!i)return s(void 0,424),va;r=i.send;const o=xd(e);o&&(a=o.redundancy)}else{const i=Ss(e);if(i){a=Vr(i);const o=e.resources?e.resources[0]:"",l=os(o);l&&(r=l.send)}}return!a||!r?(s(void 0,424),va):a.query(n,r,s)().abort}function ja(){}function hd(e){e.iconsLoaderFlag||(e.iconsLoaderFlag=!0,setTimeout(()=>{e.iconsLoaderFlag=!1,ld(e)}))}function bd(e){const n=[],s=[];return e.forEach(a=>{(a.match(Tr)?n:s).push(a)}),{valid:n,invalid:s}}function Rt(e,n,s){function a(){const r=e.pendingIcons;n.forEach(i=>{r&&r.delete(i),e.icons[i]||e.missing.add(i)})}if(s&&typeof s=="object")try{if(!Pr(e,s).length){a();return}}catch(r){console.error(r)}a(),hd(e)}function wa(e,n){e instanceof Promise?e.then(s=>{n(s)}).catch(()=>{n(null)}):n(e)}function gd(e,n){e.iconsToLoad?e.iconsToLoad=e.iconsToLoad.concat(n).sort():e.iconsToLoad=n,e.iconsQueueFlag||(e.iconsQueueFlag=!0,setTimeout(()=>{e.iconsQueueFlag=!1;const{provider:s,prefix:a}=e,r=e.iconsToLoad;if(delete e.iconsToLoad,!r||!r.length)return;const i=e.loadIcon;if(e.loadIcons&&(r.length>1||!i)){wa(e.loadIcons(r,a,s),f=>{Rt(e,r,f)});return}if(i){r.forEach(f=>{const m=i(f,a,s);wa(m,p=>{const x=p?{prefix:a,icons:{[f]:p}}:null;Rt(e,[f],x)})});return}const{valid:o,invalid:l}=bd(r);if(l.length&&Rt(e,l,null),!o.length)return;const d=a.match(Tr)?os(s):null;if(!d){Rt(e,o,null);return}d.prepare(s,a,o).forEach(f=>{pd(s,f,m=>{Rt(e,f.icons,m)})})}))}const yd=(e,n)=>{const s=ud(e,!0,Ir()),a=dd(s);if(!a.pending.length){let d=!0;return n&&setTimeout(()=>{d&&n(a.loaded,a.missing,a.pending,ja)}),()=>{d=!1}}const r=Object.create(null),i=[];let o,l;return a.pending.forEach(d=>{const{provider:u,prefix:f}=d;if(f===l&&u===o)return;o=u,l=f,i.push(At(u,f));const m=r[u]||(r[u]=Object.create(null));m[f]||(m[f]=[])}),a.pending.forEach(d=>{const{provider:u,prefix:f,name:m}=d,p=At(u,f),x=p.pendingIcons||(p.pendingIcons=new Set);x.has(m)||(x.add(m),r[u][f].push(m))}),i.forEach(d=>{const u=r[d.provider][d.prefix];u.length&&gd(d,u)}),n?cd(n,a,i):ja};function vd(e,n){const s={...e};for(const a in n){const r=n[a],i=typeof r;a in Or?(r===null||r&&(i==="string"||i==="number"))&&(s[a]=r):i===typeof s[a]&&(s[a]=a==="rotate"?r%4:r)}return s}const jd=/[\s,]+/;function wd(e,n){n.split(jd).forEach(s=>{switch(s.trim()){case"horizontal":e.hFlip=!0;break;case"vertical":e.vFlip=!0;break}})}function Nd(e,n=0){const s=e.replace(/^-?[0-9.]*/,"");function a(r){for(;r<0;)r+=4;return r%4}if(s===""){const r=parseInt(e);return isNaN(r)?0:a(r)}else if(s!==e){let r=0;switch(s){case"%":r=25;break;case"deg":r=90}if(r){let i=parseFloat(e.slice(0,e.length-s.length));return isNaN(i)?0:(i=i/r,i%1===0?a(i):0)}}return n}function Cd(e,n){let s=e.indexOf("xlink:")===-1?"":' xmlns:xlink="http://www.w3.org/1999/xlink"';for(const a in n)s+=" "+a+'="'+n[a]+'"';return'<svg xmlns="http://www.w3.org/2000/svg"'+s+">"+e+"</svg>"}function kd(e){return e.replace(/"/g,"'").replace(/%/g,"%25").replace(/#/g,"%23").replace(/</g,"%3C").replace(/>/g,"%3E").replace(/\s+/g," ")}function Sd(e){return"data:image/svg+xml,"+kd(e)}function $d(e){return'url("'+Sd(e)+'")'}let Vt;function Ad(){try{Vt=window.trustedTypes.createPolicy("iconify",{createHTML:e=>e})}catch{Vt=null}}function Ed(e){return Vt===void 0&&Ad(),Vt?Vt.createHTML(e):e}const Ur={...zr,inline:!1},Dd={xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink","aria-hidden":!0,role:"img"},Ld={display:"inline-block"},cs={backgroundColor:"currentColor"},Hr={backgroundColor:"transparent"},Na={Image:"var(--svg)",Repeat:"no-repeat",Size:"100% 100%"},Ca={WebkitMask:cs,mask:cs,background:Hr};for(const e in Ca){const n=Ca[e];for(const s in Na)n[e+s]=Na[s]}const Fd={...Ur,inline:!0};function ka(e){return e+(e.match(/^[-0-9.]+$/)?"px":"")}const Rd=(e,n,s)=>{const a=n.inline?Fd:Ur,r=vd(a,n),i=n.mode||"svg",o={},l=n.style||{},d={...i==="svg"?Dd:{}};if(s){const b=Sn(s,!1,!0);if(b){const v=["iconify"],w=["provider","prefix"];for(const $ of w)b[$]&&v.push("iconify--"+b[$]);d.className=v.join(" ")}}for(let b in n){const v=n[b];if(v!==void 0)switch(b){case"icon":case"style":case"children":case"onLoad":case"mode":case"ssr":case"fallback":break;case"_ref":d.ref=v;break;case"className":d[b]=(d[b]?d[b]+" ":"")+v;break;case"inline":case"hFlip":case"vFlip":r[b]=v===!0||v==="true"||v===1;break;case"flip":typeof v=="string"&&wd(r,v);break;case"color":o.color=v;break;case"rotate":typeof v=="string"?r[b]=Nd(v):typeof v=="number"&&(r[b]=v);break;case"ariaHidden":case"aria-hidden":v!==!0&&v!=="true"&&delete d["aria-hidden"];break;default:a[b]===void 0&&(d[b]=v)}}const u=Gc(e,r),f=u.attributes;if(r.inline&&(o.verticalAlign="-0.125em"),i==="svg"){d.style={...o,...l},Object.assign(d,f);let b=0,v=n.id;return typeof v=="string"&&(v=v.replace(/-/g,"_")),d.dangerouslySetInnerHTML={__html:Ed(Zc(u.body,v?()=>v+"ID"+b++:"iconifyReact"))},h.createElement("svg",d)}const{body:m,width:p,height:x}=e,g=i==="mask"||(i==="bg"?!1:m.indexOf("currentColor")!==-1),y=Cd(m,{...f,width:p+"",height:x+""});return d.style={...o,"--svg":$d(y),width:ka(f.width),height:ka(f.height),...Ld,...g?cs:Hr,...l},h.createElement("span",d)};Ir(!0);Xc("",id);if(typeof document<"u"&&typeof window<"u"){const e=window;if(e.IconifyPreload!==void 0){const n=e.IconifyPreload,s="Invalid IconifyPreload syntax.";typeof n=="object"&&n!==null&&(n instanceof Array?n:[n]).forEach(a=>{try{(typeof a!="object"||a===null||a instanceof Array||typeof a.icons!="object"||typeof a.prefix!="string"||!zc(a))&&console.error(s)}catch{console.error(s)}})}if(e.IconifyProviders!==void 0){const n=e.IconifyProviders;if(typeof n=="object"&&n!==null)for(let s in n){const a="IconifyProviders["+s+"] is invalid.";try{const r=n[s];if(typeof r!="object"||!r||r.resources===void 0)continue;Jc(s,r)||console.error(a)}catch{console.error(a)}}}}function Wr(e){const[n,s]=h.useState(!!e.ssr),[a,r]=h.useState({});function i(x){if(x){const g=e.icon;if(typeof g=="object")return{name:"",data:g};const y=ba(g);if(y)return{name:g,data:y}}return{name:""}}const[o,l]=h.useState(i(!!e.ssr));function d(){const x=a.callback;x&&(x(),r({}))}function u(x){if(JSON.stringify(o)!==JSON.stringify(x))return d(),l(x),!0}function f(){var x;const g=e.icon;if(typeof g=="object"){u({name:"",data:g});return}const y=ba(g);if(u({name:g,data:y}))if(y===void 0){const b=yd([g],f);r({callback:b})}else y&&((x=e.onLoad)===null||x===void 0||x.call(e,g))}h.useEffect(()=>(s(!0),d),[]),h.useEffect(()=>{n&&f()},[e.icon,n]);const{name:m,data:p}=o;return p?Rd({...ks,...p},e,m):e.children?e.children:e.fallback?e.fallback:h.createElement("span",{})}const P=h.forwardRef((e,n)=>Wr({...e,_ref:n}));h.forwardRef((e,n)=>Wr({inline:!0,...e,_ref:n}));const O=h.forwardRef(({color:e="primary",radius:n="full",testId:s="veevart-button",...a},r)=>t.jsx(c.Button,{ref:r,color:e,radius:n,"data-testid":s,...a}));O.displayName="Button";function qr({code:e,amount:n,onRemove:s,label:a="Gift Card",removeAriaLabel:r="Remove gift card",testId:i="veevart-applied-code-card"}){return t.jsx(c.Card,{"data-testid":i,shadow:"sm",className:"w-full",children:t.jsxs(c.CardBody,{className:"flex flex-row items-start justify-between gap-2 p-4",children:[t.jsxs("div",{className:"flex min-w-0 flex-col gap-1",children:[t.jsx("span",{className:"text-xs text-default-500",children:a}),t.jsx("span",{"data-testid":`${i}-code`,className:"truncate font-medium text-foreground",children:e}),t.jsx("span",{"data-testid":`${i}-amount`,className:"text-lg font-semibold text-primary",children:n})]}),t.jsx(O,{testId:`${i}-remove`,isIconOnly:!0,size:"sm",variant:"light","aria-label":r,onPress:s,children:t.jsx(P,{icon:"solar:close-circle-linear",className:"size-4","aria-hidden":"true"})})]})})}function zn(e,n){return e-n*Math.floor(e/n)}const Gr=1721426;function tn(e,n,s,a){n=Es(e,n);let r=n-1,i=-2;return s<=2?i=0:un(n)&&(i=-1),Gr-1+365*r+Math.floor(r/4)-Math.floor(r/100)+Math.floor(r/400)+Math.floor((367*s-362)/12+i+a)}function un(e){return e%4===0&&(e%100!==0||e%400===0)}function Es(e,n){return e==="BC"?1-n:n}function _d(e){let n="AD";return e<=0&&(n="BC",e=1-e),[n,e]}const Md={standard:[31,28,31,30,31,30,31,31,30,31,30,31],leapyear:[31,29,31,30,31,30,31,31,30,31,30,31]};class $n{fromJulianDay(n){let s=n,a=s-Gr,r=Math.floor(a/146097),i=zn(a,146097),o=Math.floor(i/36524),l=zn(i,36524),d=Math.floor(l/1461),u=zn(l,1461),f=Math.floor(u/365),m=r*400+o*100+d*4+f+(o!==4&&f!==4?1:0),[p,x]=_d(m),g=s-tn(p,x,1,1),y=2;s<tn(p,x,3,1)?y=0:un(x)&&(y=1);let b=Math.floor(((g+y)*12+373)/367),v=s-tn(p,x,b,1)+1;return new qt(p,x,b,v)}toJulianDay(n){return tn(n.era,n.year,n.month,n.day)}getDaysInMonth(n){return Md[un(n.year)?"leapyear":"standard"][n.month-1]}getMonthsInYear(n){return 12}getDaysInYear(n){return un(n.year)?366:365}getMaximumMonthsInYear(){return 12}getMaximumDaysInMonth(){return 31}getYearsInEra(n){return 9999}getEras(){return["BC","AD"]}isInverseEra(n){return n.era==="BC"}balanceDate(n){n.year<=0&&(n.era=n.era==="BC"?"AD":"BC",n.year=1-n.year)}constructor(){this.identifier="gregory"}}function Pd(e,n){var s,a,r,i;return(i=(r=(s=e.isEqual)===null||s===void 0?void 0:s.call(e,n))!==null&&r!==void 0?r:(a=n.isEqual)===null||a===void 0?void 0:a.call(n,e))!==null&&i!==void 0?i:e.identifier===n.identifier}function Kr(e,n){return e.calendar.toJulianDay(e)-n.calendar.toJulianDay(n)}function Yr(e,n){return Sa(e)-Sa(n)}function Sa(e){return e.hour*36e5+e.minute*6e4+e.second*1e3+e.millisecond}let Bn=null;function Qr(){return Bn==null&&(Bn=new Intl.DateTimeFormat().resolvedOptions().timeZone),Bn}function $a(e){e=Ds(e,new $n);let n=Es(e.era,e.year);return Zr(n,e.month,e.day,e.hour,e.minute,e.second,e.millisecond)}function Zr(e,n,s,a,r,i,o){let l=new Date;return l.setUTCHours(a,r,i,o),l.setUTCFullYear(e,n-1,s),l.getTime()}function Aa(e,n){if(n==="UTC")return 0;if(e>0&&n===Qr())return new Date(e).getTimezoneOffset()*-6e4;let{year:s,month:a,day:r,hour:i,minute:o,second:l}=Xr(e,n);return Zr(s,a,r,i,o,l,0)-Math.floor(e/1e3)*1e3}const Ea=new Map;function Xr(e,n){let s=Ea.get(n);s||(s=new Intl.DateTimeFormat("en-US",{timeZone:n,hour12:!1,era:"short",year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric"}),Ea.set(n,s));let a=s.formatToParts(new Date(e)),r={};for(let i of a)i.type!=="literal"&&(r[i.type]=i.value);return{year:r.era==="BC"||r.era==="B"?-r.year+1:+r.year,month:+r.month,day:+r.day,hour:r.hour==="24"?0:+r.hour,minute:+r.minute,second:+r.second}}const Da=864e5;function Td(e,n,s,a){return(s===a?[s]:[s,a]).filter(i=>Id(e,n,i))}function Id(e,n,s){let a=Xr(s,n);return e.year===a.year&&e.month===a.month&&e.day===a.day&&e.hour===a.hour&&e.minute===a.minute&&e.second===a.second}function Od(e,n,s="compatible"){let a=ei(e);if(n==="UTC")return $a(a);if(n===Qr()&&s==="compatible"){a=Ds(a,new $n);let d=new Date,u=Es(a.era,a.year);return d.setFullYear(u,a.month-1,a.day),d.setHours(a.hour,a.minute,a.second,a.millisecond),d.getTime()}let r=$a(a),i=Aa(r-Da,n),o=Aa(r+Da,n),l=Td(a,n,r-i,r-o);if(l.length===1)return l[0];if(l.length>1)switch(s){case"compatible":case"earlier":return l[0];case"later":return l[l.length-1];case"reject":throw new RangeError("Multiple possible absolute times found")}switch(s){case"earlier":return Math.min(r-i,r-o);case"compatible":case"later":return Math.max(r-i,r-o);case"reject":throw new RangeError("No such absolute time found")}}function Jr(e,n,s="compatible"){return new Date(Od(e,n,s))}function ei(e,n){let s=0,a=0,r=0,i=0;if("timeZone"in e)({hour:s,minute:a,second:r,millisecond:i}=e);else if("hour"in e&&!n)return e;return n&&({hour:s,minute:a,second:r,millisecond:i}=n),new pn(e.calendar,e.era,e.year,e.month,e.day,s,a,r,i)}function Ds(e,n){if(Pd(e.calendar,n))return e;let s=n.fromJulianDay(e.calendar.toJulianDay(e)),a=e.copy();return a.calendar=n,a.era=s.era,a.year=s.year,a.month=s.month,a.day=s.day,Et(a),a}function Ls(e,n){let s=e.copy(),a="hour"in s?li(s,n):0;ds(s,n.years||0),s.calendar.balanceYearMonth&&s.calendar.balanceYearMonth(s,e),s.month+=n.months||0,us(s),ti(s),s.day+=(n.weeks||0)*7,s.day+=n.days||0,s.day+=a,zd(s),s.calendar.balanceDate&&s.calendar.balanceDate(s),s.year<1&&(s.year=1,s.month=1,s.day=1);let r=s.calendar.getYearsInEra(s);if(s.year>r){var i,o;let d=(i=(o=s.calendar).isInverseEra)===null||i===void 0?void 0:i.call(o,s);s.year=r,s.month=d?1:s.calendar.getMonthsInYear(s),s.day=d?1:s.calendar.getDaysInMonth(s)}s.month<1&&(s.month=1,s.day=1);let l=s.calendar.getMonthsInYear(s);return s.month>l&&(s.month=l,s.day=s.calendar.getDaysInMonth(s)),s.day=Math.max(1,Math.min(s.calendar.getDaysInMonth(s),s.day)),s}function ds(e,n){var s,a;!((s=(a=e.calendar).isInverseEra)===null||s===void 0)&&s.call(a,e)&&(n=-n),e.year+=n}function us(e){for(;e.month<1;)ds(e,-1),e.month+=e.calendar.getMonthsInYear(e);let n=0;for(;e.month>(n=e.calendar.getMonthsInYear(e));)e.month-=n,ds(e,1)}function zd(e){for(;e.day<1;)e.month--,us(e),e.day+=e.calendar.getDaysInMonth(e);for(;e.day>e.calendar.getDaysInMonth(e);)e.day-=e.calendar.getDaysInMonth(e),e.month++,us(e)}function ti(e){e.month=Math.max(1,Math.min(e.calendar.getMonthsInYear(e),e.month)),e.day=Math.max(1,Math.min(e.calendar.getDaysInMonth(e),e.day))}function Et(e){e.calendar.constrainDate&&e.calendar.constrainDate(e),e.year=Math.max(1,Math.min(e.calendar.getYearsInEra(e),e.year)),ti(e)}function ni(e){let n={};for(let s in e)typeof e[s]=="number"&&(n[s]=-e[s]);return n}function si(e,n){return Ls(e,ni(n))}function ai(e,n){let s=e.copy();return n.era!=null&&(s.era=n.era),n.year!=null&&(s.year=n.year),n.month!=null&&(s.month=n.month),n.day!=null&&(s.day=n.day),Et(s),s}function ri(e,n){let s=e.copy();return n.hour!=null&&(s.hour=n.hour),n.minute!=null&&(s.minute=n.minute),n.second!=null&&(s.second=n.second),n.millisecond!=null&&(s.millisecond=n.millisecond),ii(s),s}function Bd(e){e.second+=Math.floor(e.millisecond/1e3),e.millisecond=nn(e.millisecond,1e3),e.minute+=Math.floor(e.second/60),e.second=nn(e.second,60),e.hour+=Math.floor(e.minute/60),e.minute=nn(e.minute,60);let n=Math.floor(e.hour/24);return e.hour=nn(e.hour,24),n}function ii(e){e.millisecond=Math.max(0,Math.min(e.millisecond,1e3)),e.second=Math.max(0,Math.min(e.second,59)),e.minute=Math.max(0,Math.min(e.minute,59)),e.hour=Math.max(0,Math.min(e.hour,23))}function nn(e,n){let s=e%n;return s<0&&(s+=n),s}function li(e,n){return e.hour+=n.hours||0,e.minute+=n.minutes||0,e.second+=n.seconds||0,e.millisecond+=n.milliseconds||0,Bd(e)}function oi(e,n){let s=e.copy();return li(s,n),s}function Vd(e,n){return oi(e,ni(n))}function ci(e,n,s,a){let r=e.copy();switch(n){case"era":{let l=e.calendar.getEras(),d=l.indexOf(e.era);if(d<0)throw new Error("Invalid era: "+e.era);d=mt(d,s,0,l.length-1,a?.round),r.era=l[d],Et(r);break}case"year":var i,o;!((i=(o=r.calendar).isInverseEra)===null||i===void 0)&&i.call(o,r)&&(s=-s),r.year=mt(e.year,s,-1/0,9999,a?.round),r.year===-1/0&&(r.year=1),r.calendar.balanceYearMonth&&r.calendar.balanceYearMonth(r,e);break;case"month":r.month=mt(e.month,s,1,e.calendar.getMonthsInYear(e),a?.round);break;case"day":r.day=mt(e.day,s,1,e.calendar.getDaysInMonth(e),a?.round);break;default:throw new Error("Unsupported field "+n)}return e.calendar.balanceDate&&e.calendar.balanceDate(r),Et(r),r}function di(e,n,s,a){let r=e.copy();switch(n){case"hour":{let i=e.hour,o=0,l=23;if(a?.hourCycle===12){let d=i>=12;o=d?12:0,l=d?23:11}r.hour=mt(i,s,o,l,a?.round);break}case"minute":r.minute=mt(e.minute,s,0,59,a?.round);break;case"second":r.second=mt(e.second,s,0,59,a?.round);break;case"millisecond":r.millisecond=mt(e.millisecond,s,0,999,a?.round);break;default:throw new Error("Unsupported field "+n)}return r}function mt(e,n,s,a,r=!1){if(r){e+=Math.sign(n),e<s&&(e=a);let i=Math.abs(n);n>0?e=Math.ceil(e/i)*i:e=Math.floor(e/i)*i,e>a&&(e=s)}else e+=n,e<s?e=a-(s-e-1):e>a&&(e=s+(e-a-1));return e}const Ud=/^([+-]\d{6}|\d{4})-(\d{2})-(\d{2})$/,Hd=/^([+-]\d{6}|\d{4})-(\d{2})-(\d{2})(?:T(\d{2}))?(?::(\d{2}))?(?::(\d{2}))?(\.\d+)?(?:(?:([+-]\d{2})(?::?(\d{2}))?)|Z)$/;function Wd(e){let n=e.match(Ud);if(!n)throw Hd.test(e)?new Error(`Invalid ISO 8601 date string: ${e}. Use parseAbsolute() instead.`):new Error("Invalid ISO 8601 date string: "+e);let s=new qt(Vn(n[1],0,9999),Vn(n[2],1,12),1);return s.day=Vn(n[3],1,s.calendar.getDaysInMonth(s)),s}function Vn(e,n,s){let a=Number(e);if(a<n||a>s)throw new RangeError(`Value out of range: ${n} <= ${a} <= ${s}`);return a}function ui(e){return`${String(e.hour).padStart(2,"0")}:${String(e.minute).padStart(2,"0")}:${String(e.second).padStart(2,"0")}${e.millisecond?String(e.millisecond/1e3).slice(1):""}`}function mi(e){let n=Ds(e,new $n),s;return n.era==="BC"?s=n.year===1?"0000":"-"+String(Math.abs(1-n.year)).padStart(6,"00"):s=String(n.year).padStart(4,"0"),`${s}-${String(n.month).padStart(2,"0")}-${String(n.day).padStart(2,"0")}`}function qd(e){return`${mi(e)}T${ui(e)}`}function Gd(e,n){if(n.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function Fs(e,n,s){Gd(e,n),n.set(e,s)}function fi(e){let n=typeof e[0]=="object"?e.shift():new $n,s;if(typeof e[0]=="string")s=e.shift();else{let o=n.getEras();s=o[o.length-1]}let a=e.shift(),r=e.shift(),i=e.shift();return[n,s,a,r,i]}var Kd=new WeakMap;class qt{copy(){return this.era?new qt(this.calendar,this.era,this.year,this.month,this.day):new qt(this.calendar,this.year,this.month,this.day)}add(n){return Ls(this,n)}subtract(n){return si(this,n)}set(n){return ai(this,n)}cycle(n,s,a){return ci(this,n,s,a)}toDate(n){return Jr(this,n)}toString(){return mi(this)}compare(n){return Kr(this,n)}constructor(...n){Fs(this,Kd,{writable:!0,value:void 0});let[s,a,r,i,o]=fi(n);this.calendar=s,this.era=a,this.year=r,this.month=i,this.day=o,Et(this)}}var Yd=new WeakMap;class An{copy(){return new An(this.hour,this.minute,this.second,this.millisecond)}add(n){return oi(this,n)}subtract(n){return Vd(this,n)}set(n){return ri(this,n)}cycle(n,s,a){return di(this,n,s,a)}toString(){return ui(this)}compare(n){return Yr(this,n)}constructor(n=0,s=0,a=0,r=0){Fs(this,Yd,{writable:!0,value:void 0}),this.hour=n,this.minute=s,this.second=a,this.millisecond=r,ii(this)}}var Qd=new WeakMap;class pn{copy(){return this.era?new pn(this.calendar,this.era,this.year,this.month,this.day,this.hour,this.minute,this.second,this.millisecond):new pn(this.calendar,this.year,this.month,this.day,this.hour,this.minute,this.second,this.millisecond)}add(n){return Ls(this,n)}subtract(n){return si(this,n)}set(n){return ai(ri(this,n),n)}cycle(n,s,a){switch(n){case"era":case"year":case"month":case"day":return ci(this,n,s,a);default:return di(this,n,s,a)}}toDate(n,s){return Jr(this,n,s)}toString(){return qd(this)}compare(n){let s=Kr(this,n);return s===0?Yr(this,ei(n)):s}constructor(...n){Fs(this,Qd,{writable:!0,value:void 0});let[s,a,r,i,o]=fi(n);this.calendar=s,this.era=a,this.year=r,this.month=i,this.day=o,this.hour=n.shift()||0,this.minute=n.shift()||0,this.second=n.shift()||0,this.millisecond=n.shift()||0,Et(this)}}const Zd="Open time options",Xd=320;function La(e,n){return typeof n=="string"&&n.length>0?`${e} ${n}`:e}function Un(e){if(!e)return null;const n="hour"in e&&typeof e.hour=="number"?e.hour:0,s="minute"in e&&typeof e.minute=="number"?e.minute:0,a="second"in e&&typeof e.second=="number"?e.second:0;return new An(n,s,a)}function Jd(e,n){const s=new Date(2e3,0,1,e.hour,e.minute,e.second);return new Intl.DateTimeFormat("en-US",{hour:"numeric",minute:"2-digit",hour12:n===12}).format(s)}function eu(e){const n=[];for(let s=0;s<24;s+=1)for(let a=0;a<60;a+=e)n.push(new An(s,a));return n}function tu(e){const{minuteStep:n=15,timeListClassName:s,timeListLabel:a=Zd,selectorButtonProps:r,endContent:i,onChange:o,value:l,defaultValue:d,hourCycle:u=12,...f}=e,m=l!==void 0,[p,x]=h.useState(()=>Un(d)),g=m?Un(l):p,y=h.useMemo(()=>eu(n),[n]),b=w=>{m||x(w),o?.(w)},v=t.jsxs(c.Popover,{placement:"bottom-end",children:[t.jsx(c.PopoverTrigger,{children:t.jsx(c.Button,{isIconOnly:!0,variant:"light","aria-label":a,...r,onPress:void 0,children:t.jsx(X.Clock3,{className:"size-4",strokeWidth:1.75})})}),t.jsx(c.PopoverContent,{className:"min-w-[8.5rem] p-0",children:t.jsx(c.ScrollShadow,{className:s??"max-h-64 py-1",children:t.jsx("div",{className:"flex flex-col p-1",children:y.map(w=>{const $=g?.hour===w.hour&&g?.minute===w.minute;return t.jsx(c.Button,{variant:$?"flat":"light",color:$?"primary":"default",className:"h-9 min-w-0 justify-start px-3",onPress:()=>b(w),children:Jd(w,u)},`${w.hour}:${w.minute}`)})})})})]});return t.jsx(c.TimeInput,{...f,value:m?g:void 0,defaultValue:m?void 0:d,hourCycle:u,endContent:t.jsxs("div",{className:"flex items-center gap-1",children:[i,v]}),onChange:w=>b(Un(w))})}function Rs(e){if(e.mode==="time")return t.jsx(tu,{...e});if(e.mode==="datetime"){const{mode:r,granularity:i="minute",hideTimeZone:o=!0,calendarWidth:l=Xd,disableAnimation:d=!0,classNames:u,...f}=e;return t.jsx(c.DatePicker,{...f,calendarWidth:l,classNames:{...u,popoverContent:La("min-w-[20rem]",u?.popoverContent),calendarContent:La("min-h-[18rem]",u?.calendarContent)},disableAnimation:d,granularity:i,hideTimeZone:o})}const{mode:n,granularity:s="day",...a}=e;return t.jsx(c.DatePicker,{...a,granularity:s})}function nu({label:e,...n}){return t.jsx("button",{...n,"aria-label":e,children:t.jsx("svg",{"aria-hidden":"true",className:"fill-current",fill:"none",focusable:"false",height:"1em",role:"presentation",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,viewBox:"0 0 24 24",width:"1em",children:t.jsx("path",{d:"M18 6L6 18M6 6l12 12"})})})}function su(e){return e!==void 0&&e.trim()!==""}function xi(e,n){const s=Ar();if(h.isValidElement(n))return n;const a=[e,s].find(su);return a===void 0?void 0:t.jsx(nu,{label:a})}const pi=h.forwardRef(({closeLabel:e,closeButton:n,...s},a)=>{const r=xi(e,n);return t.jsx(c.Drawer,{ref:a,...s,closeButton:r})});pi.displayName="Drawer";const Yt=h.forwardRef(({closeLabel:e,closeButton:n,...s},a)=>{const r=xi(e,n);return t.jsx(c.Modal,{ref:a,...s,closeButton:r})});Yt.displayName="Modal";function au(e){const n=e?.closest('[role="dialog"]');return n?.parentElement??n??void 0}const Xe=h.forwardRef(({popoverProps:e,...n},s)=>{const a=h.useRef(null),[r,i]=h.useState(void 0),{"data-react-aria-top-layer":o,...l}=e??{},d=o==="true"||o===void 0&&r!==void 0,u={...l,disableDialogFocus:l.disableDialogFocus??(r?!0:void 0),portalContainer:l.portalContainer??r,...d?{"data-react-aria-top-layer":"true"}:{}};return h.useEffect(()=>{i(au(a.current))},[]),t.jsx("span",{ref:a,className:"contents",children:t.jsx(c.Select,{ref:s,...n,popoverProps:u})})});Xe.displayName="Select";const ru="text-default-600 data-[hover=true]:text-default-700",_s=h.forwardRef(({classNames:e,...n},s)=>t.jsx(c.Table,{ref:s,...n,classNames:{...e,th:c.cn(ru,e?.th)}}));_s.displayName="Table";function iu({state:e,onSubmit:n,onRemove:s,appliedCredit:a,errorMessage:r,label:i="Gift Card",placeholder:o="GC-XXXX-XXXX-XXXX",applyLabel:l="Apply",removeAriaLabel:d="Remove gift card",testId:u="veevart-redeem-code-input"}){const[f,m]=h.useState(""),p=h.useId(),[x,g]=h.useState(e);e!==x&&(g(e),e==="applied"&&m(""));const y=()=>{const w=f.trim();w&&n(w)},b=w=>{w.key==="Enter"&&(w.preventDefault(),y())};if(e==="applied"&&a)return t.jsx("div",{"data-testid":u,children:t.jsx(qr,{code:a.code,amount:a.amount,onRemove:s,removeAriaLabel:d,testId:`${u}-card`})});const v=e==="error"&&r!=null;return t.jsxs("div",{"data-testid":u,className:"flex flex-col gap-1",children:[t.jsxs("div",{className:"flex items-end gap-2",children:[t.jsx(c.Input,{"data-testid":`${u}-input`,label:i,labelPlacement:"outside",variant:"bordered",radius:"lg",classNames:{label:"text-xs text-default-500 group-data-[filled-within=true]:text-default-500 group-data-[filled-within=true]:-translate-y-[calc(100%_+_var(--heroui-font-size-small)/2_+_16px)]",inputWrapper:"border-small"},placeholder:o,value:f,onValueChange:m,onKeyDown:b,isDisabled:e==="loading",isInvalid:e==="error","aria-describedby":v?p:void 0}),t.jsx(O,{testId:`${u}-button`,isLoading:e==="loading",isDisabled:!f.trim(),onPress:y,children:l})]}),v&&t.jsx("p",{id:p,"data-testid":`${u}-error`,className:"text-tiny text-danger",children:r})]})}const lu={login:"Login",logout:"Logout",selectLanguage:"Select your language"};function ou({languages:e,selectedLanguage:n,onLanguageChange:s,label:a}){const r=e.find(i=>i.code===n);return t.jsx("div",{className:"flex items-center",children:t.jsxs("div",{className:"relative flex items-center",children:[t.jsx(Xe,{"data-testid":"language-select-desktop",variant:"bordered","aria-label":a,selectedKeys:n?[n]:[],onSelectionChange:i=>{const o=Array.from(i)[0]||n;s?.(o)},className:"min-w-36 hidden md:inline-flex",isDisabled:e.length===0,placeholder:a,startContent:t.jsx(X.Globe,{className:"w-5 h-5 text-black"}),renderValue:()=>t.jsx("span",{children:r?.label||a}),size:"md",radius:"full",children:e.map(i=>t.jsx(c.SelectItem,{textValue:i.label,"data-testid":`language-select-option-${i.code}`,children:i.label},i.code))}),t.jsx(Xe,{"aria-label":a,"data-testid":"language-select-mobile",variant:"bordered",selectedKeys:n?[n]:[],onSelectionChange:i=>{const o=Array.from(i)[0]||n;s?.(o)},className:"w-24 inline-flex md:hidden",isDisabled:e.length===0,placeholder:"",startContent:t.jsx(X.Globe,{className:"w-6 h-6 text-black"}),renderValue:()=>t.jsx("span",{children:r?.code.toUpperCase()||""}),size:"md",radius:"full",children:e.map(i=>t.jsx(c.SelectItem,{textValue:i.code.toUpperCase(),"data-testid":`language-select-option-mobile-${i.code}`,children:i.code.toUpperCase()},i.code))})]})})}function cu({isLoggedIn:e,onLogin:n,onLogout:s,labels:a}){return e?t.jsxs(O,{"data-testid":"navbar-auth-button",className:"px-2 py-1 w-1 min-w-12 md:min-w-24 rounded-full bg-black text-white text-sm flex items-center",onPress:s,size:"md",children:[t.jsx(X.User,{className:"inline w-5 h-5"}),t.jsx("span",{className:"hidden md:inline",children:a.logout})]}):t.jsxs(O,{"data-testid":"navbar-auth-button",className:"px-2 py-1 min-w-12 md:min-w-24 rounded-full bg-black text-white text-sm flex items-center",onPress:n,size:"md",children:[t.jsx(X.User,{className:"inline w-5 h-5"}),t.jsx("span",{className:"hidden md:inline",children:a.login})]})}function du({logo:e,languages:n=[],selectedLanguage:s,onLanguageChange:a,isLoggedIn:r,onLogin:i,onLogout:o,hasLanguages:l,hasAuth:d,labels:u={},className:f}){const m={...lu,...u};return t.jsxs("nav",{"data-testid":"navbar",className:c.cn("w-full px-4 md:px-8 py-3 bg-white border-b border-zinc-100 flex items-center justify-between",f),children:[t.jsx("div",{className:"flex items-center min-w-10",children:e&&t.jsx("a",{href:"/",className:"block",children:t.jsx("img",{"data-testid":"navbar-logo",src:e,alt:"Logo",className:"h-8 w-auto max-w-28 md:max-w-40 object-contain"})})}),t.jsxs("div",{className:"flex items-center gap-2 md:gap-4",children:[(l||n.length>0)&&t.jsx(ou,{languages:n,selectedLanguage:s,onLanguageChange:a,label:m.selectLanguage}),d&&t.jsx(cu,{isLoggedIn:r,onLogin:i,onLogout:o,labels:m})]})]})}function uu(e){return t.jsx("div",{className:"min-h-screen flex flex-col",children:t.jsx("div",{className:"flex-1 flex items-center justify-center p-12",children:t.jsx(c.Alert,{description:"This template combines Navbar, Footer, and a confirmation Card. Include title, message, confirmation number, details list, icon, and action buttons. Use Card for the confirmation content.",title:"TODO: Implement ConfirmationPageTemplate",variant:"faded",className:"max-w-2xl"})})})}var Hn;const mu=typeof document<"u"?(Hn=h.useInsertionEffect)!==null&&Hn!==void 0?Hn:h.useLayoutEffect:()=>{};function En(e,n,s){let[a,r]=h.useState(e||n),i=h.useRef(a),o=h.useRef(e!==void 0),l=e!==void 0;h.useEffect(()=>{let m=o.current;m!==l&&process.env.NODE_ENV!=="production"&&console.warn(`WARN: A component changed from ${m?"controlled":"uncontrolled"} to ${l?"controlled":"uncontrolled"}.`),o.current=l},[l]);let d=l?e:a;mu(()=>{i.current=d});let[,u]=h.useReducer(()=>({}),{}),f=h.useCallback((m,...p)=>{let x=typeof m=="function"?m(i.current):m;Object.is(i.current,x)||(i.current=x,r(x),u(),s?.(x,...p))},[s]);return[d,f]}function hi(e){return t.jsx("svg",{...e,fill:"none",stroke:"currentColor",strokeWidth:2,viewBox:"0 0 24 24",children:t.jsx(Te.m.path,{animate:{pathLength:1},d:"M5 13l4 4L19 7",initial:{pathLength:0},strokeLinecap:"round",strokeLinejoin:"round",transition:{delay:.2,type:"tween",ease:"easeOut",duration:.3}})})}const bi=h.forwardRef(({color:e="primary",variant:n="default",stepsCount:s=3,defaultStep:a=0,label:r,stepLabels:i,showStepLabelTooltip:o=!1,stepLabelTooltipPlacement:l="top",showStepCounter:d=!1,stepCounterPosition:u="right",layout:f="compact",stepCounterFormat:m,onStepChange:p,currentStep:x,hideProgressBars:g=!1,stepClassName:y,className:b,isDisabled:v=!1,...w},$)=>{const[N,A]=En(x,a,p),k=h.useMemo(()=>{let C,E;const S=["[--active-fg-color:hsl(var(--step-fg-color))]","[--active-border-color:hsl(var(--step-color))]","[--active-color:hsl(var(--step-color))]","[--complete-background-color:hsl(var(--step-color))]","[--complete-border-color:hsl(var(--step-color))]","[--inactive-border-color:hsl(var(--heroui-default-300))]","[--inactive-color:hsl(var(--heroui-default-300))]"];switch(e){case"primary":C="[--step-color:var(--heroui-primary)]",E="[--step-fg-color:var(--heroui-primary-foreground)]";break;case"secondary":C="[--step-color:var(--heroui-secondary)]",E="[--step-fg-color:var(--heroui-secondary-foreground)]";break;case"success":C="[--step-color:var(--heroui-success)]",E="[--step-fg-color:var(--heroui-success-foreground)]";break;case"warning":C="[--step-color:var(--heroui-warning)]",E="[--step-fg-color:var(--heroui-warning-foreground)]";break;case"danger":C="[--step-color:var(--heroui-danger)]",E="[--step-fg-color:var(--heroui-danger-foreground)]";break;case"default":C="[--step-color:var(--heroui-default)]",E="[--step-fg-color:var(--heroui-default-foreground)]";break;default:C="[--step-color:var(--heroui-primary)]",E="[--step-fg-color:var(--heroui-primary-foreground)]";break}return S.unshift(E),S.unshift(C),S},[e]);return t.jsxs("nav",{ref:$,"aria-label":"Progress",className:c.cn("flex items-center overflow-x-auto",f==="spread"?"w-full justify-between gap-6":"max-w-fit gap-3",b),"data-testid":"stepper-root",...w,children:[d&&u==="left"?t.jsx("span",{className:"text-default-500 text-2xl whitespace-nowrap","data-testid":"stepper-counter",children:m?m(N+1,s):`Step ${N+1} of ${s}`}):null,r&&t.jsx("label",{className:"text-small text-default-foreground lg:text-medium font-light whitespace-nowrap me-3","data-testid":"stepper-label",children:r}),t.jsx("ol",{className:c.cn("flex flex-row flex-nowrap gap-x-3",k,b),"data-testid":"stepper-list",children:Array.from({length:s})?.map((C,E)=>{const S=N===E?"active":N<E?"inactive":"complete",_=n==="activeLabel"&&S==="active"&&!!i?.[E],F=o&&S!=="active"&&!!i?.[E];return t.jsxs("li",{className:"relative flex shrink-0 items-center gap-x-3","data-testid":`stepper-step-${E}`,children:[t.jsx(c.Tooltip,{content:F?i?.[E]:void 0,isDisabled:!F,offset:12,placement:l,classNames:{base:"px-0 py-0",content:"rounded-full border border-default-200 bg-white px-4 py-2 text-small font-medium text-default-700 shadow-sm"},children:t.jsxs("button",{"aria-current":S==="active"?"step":void 0,className:c.cn("group rounded-large flex w-full cursor-pointer flex-row items-center justify-center gap-x-3 py-2.5",{"rounded-full border border-(--active-border-color)/20 bg-(--active-border-color)/10 pl-2 pr-4 py-1.5":_},{"cursor-not-allowed opacity-50":v},y),onClick:()=>!v&&A(E),disabled:v,"data-testid":`stepper-step-btn-${E}`,children:[t.jsx("div",{className:"h-full relative flex items-center",children:t.jsx(Te.LazyMotion,{features:Te.domAnimation,children:t.jsx(Te.m.div,{animate:S,className:"relative z-10",children:t.jsx(Te.m.div,{animate:S,className:c.cn("border-medium text-large text-default-foreground relative z-10 flex h-[26px] w-[26px] shrink-0 items-center justify-center rounded-full font-semibold bg-white",{"border-(--complete-border-color) bg-(--complete-background-color) text-(--active-fg-color)":_,"bg-(--complete-background-color)":S==="complete","shadow-lg":S==="complete"}),initial:!1,transition:{duration:.25},variants:{inactive:{backgroundColor:"transparent",borderColor:"var(--inactive-border-color)",color:"var(--inactive-color)"},active:{backgroundColor:"transparent",borderColor:"var(--active-border-color)",color:"var(--active-color)"},complete:{backgroundColor:"var(--complete-background-color)",borderColor:"var(--complete-border-color)",color:"var(--active-fg-color)"}},children:t.jsx("div",{className:"flex items-center justify-center",children:S==="complete"&&n==="default"?t.jsx(hi,{className:"h-5 w-5 text-(--active-fg-color)","data-testid":`stepper-step-check-${E}`}):t.jsx("span",{children:E+1})})})})})}),_?t.jsx("span",{className:"pr-2 text-2xl leading-none font-medium whitespace-nowrap text-(--active-color)","data-testid":`stepper-step-label-${E}`,children:i[E]}):null]},E)}),E<s-1&&!g&&t.jsx("div",{"aria-hidden":"true",className:"pointer-events-none z-0 w-12 flex-none items-center",style:{"--idx":E},children:t.jsx("div",{className:c.cn("bg-default-200 relative h-0.5 w-full transition-colors duration-300","after:absolute after:block after:h-full after:w-0 after:bg-(--active-border-color) after:transition-[width] after:duration-300 after:content-['']",{"after:w-full":E<N})})})]},E)})}),d&&u==="right"?t.jsx("span",{className:"text-default-500 text-2xl whitespace-nowrap","data-testid":"stepper-counter",children:m?m(N+1,s):`Step ${N+1} of ${s}`}):null]})});bi.displayName="Stepper";function fu(e){return t.jsx("div",{className:"min-h-screen flex flex-col",children:t.jsx("div",{className:"flex-1 flex items-center justify-center p-12",children:t.jsx(c.Alert,{description:"This template combines Navbar, Stepper, Footer, and an event details Card. Include event image, category/spots chips, tags, details grid, and action buttons. Use Card, CardHeader, CardBody for content structure.",title:"TODO: Implement EventDetailsTemplate",variant:"faded",className:"max-w-2xl"})})})}function fe(e,n="en-US",s="USD"){try{return new Intl.NumberFormat(n,{style:"currency",currency:s}).format(e)}catch{return`${s} ${e.toFixed(2)}`}}function Dt(e,n="en-US"){try{const s=new Intl.NumberFormat(n,{style:"currency",currency:e}).resolvedOptions();return typeof s.maximumFractionDigits=="number"?s.maximumFractionDigits:2}catch{return 2}}function Ms(e,n,s="en-US"){const a=Dt(n,s),r=Math.pow(10,a);return Math.round(e*r)/r}function ms(e,n,s,a){return Ms(e-n,s,a)}const Fa={primary:{active:"hsl(var(--heroui-primary))",fg:"hsl(var(--heroui-primary-foreground))"},secondary:{active:"hsl(var(--heroui-secondary))",fg:"hsl(var(--heroui-secondary-foreground))"},success:{active:"hsl(var(--heroui-success))",fg:"hsl(var(--heroui-success-foreground))"},warning:{active:"hsl(var(--heroui-warning))",fg:"hsl(var(--heroui-warning-foreground))"},danger:{active:"hsl(var(--heroui-danger))",fg:"hsl(var(--heroui-danger-foreground))"},default:{active:"hsl(var(--heroui-default))",fg:"hsl(var(--heroui-default-foreground))"}},xu="rgb(156 163 175)",pu="rgb(107 114 128)",gi=h.forwardRef(function({color:n="primary",steps:s=[],defaultStep:a=0,onStepChange:r,currentStep:i,hideProgressBars:o=!1,activeColor:l,activeForegroundColor:d,inactiveColor:u=xu,inactiveLabelColor:f=pu,activeStepVariant:m="bordered",stepClassName:p,circleClassName:x,progressBarClassName:g,labelsClassName:y,labelSlotClassName:b,activeLabelClassName:v,inactiveLabelClassName:w,className:$,ariaLabel:N="Progress",invalidLabelSuffix:A=", has errors",testId:k,isStepReachable:C,...E},S){const[_,F]=En(i,a,r),L=Fa[n]??Fa.primary,M=l??L.active,I=d??L.fg,W=(K,z)=>{const G=K.ariaLabel??(typeof K.title=="string"?K.title:null)??`${z+1}`;return K.invalid?`${G}${A}`:G};return t.jsxs("nav",{...E,"aria-label":N,...k?{"data-testid":k}:{},children:[t.jsx("div",{className:c.cn("flex items-center",$),children:s?.map((K,z)=>{const ne=z===_?"active":z<_?"complete":"inactive",G=C?C(z):!0;return t.jsxs(h.Fragment,{children:[t.jsx(O,{ref:S,isIconOnly:!0,disableAnimation:!0,radius:"full",variant:"light",testId:`${k??"horizontal-steps"}-step-${z}`,"aria-current":ne==="active"?"step":void 0,"aria-describedby":K.describedBy,"aria-label":W(K,z),"data-invalid":K.invalid?"true":void 0,isDisabled:!G,className:c.cn("size-8 min-w-8 shrink-0 overflow-visible bg-transparent p-0","data-[hover=true]:bg-transparent",G?"cursor-pointer":"cursor-not-allowed","data-[disabled=true]:opacity-40",K.className,p),onPress:()=>{if(i===void 0){F(z);return}r?.(z)},children:t.jsx(Te.LazyMotion,{features:Te.domAnimation,children:t.jsx(Te.m.div,{animate:ne,className:c.cn("relative flex size-8 items-center justify-center rounded-full text-[13px] font-medium",x),initial:!1,transition:{duration:.2},variants:{inactive:{backgroundColor:"transparent",borderColor:u,borderWidth:"1.5px",color:u},active:{backgroundColor:m==="solid"?M:"transparent",borderColor:M,borderWidth:"1.5px",color:m==="solid"?I:M},complete:{backgroundColor:M,borderColor:M,borderWidth:"1.5px",color:M}},children:ne==="complete"?t.jsx(hi,{className:"size-4",style:{color:I}}):t.jsx("span",{children:z+1})})})}),z<s.length-1&&!o&&t.jsx("div",{"aria-hidden":!0,className:c.cn("mx-1 h-px w-6 shrink-0 transition-colors duration-300 sm:mx-1.5 sm:w-14 md:w-20",g),style:{backgroundColor:z<_?M:u}})]},z)})}),t.jsx("div",{className:c.cn("mt-2.5 hidden md:flex",y),children:s?.map((K,z)=>{const ne=z<=_;return t.jsxs(h.Fragment,{children:[t.jsx("div",{className:c.cn("relative flex w-8 shrink-0 justify-center overflow-visible",b),children:t.jsx("span",{className:c.cn("absolute left-1/2 top-0 -translate-x-1/2 whitespace-nowrap text-center text-[12px] font-medium transition-colors duration-200",ne?v:w),style:{color:ne?M:f},children:K.title})}),z<s.length-1&&!o&&t.jsx("div",{className:c.cn("mx-1 w-6 shrink-0 sm:mx-1.5 sm:w-14 md:w-20",g)})]},z)})})]})});gi.displayName="HorizontalSteps";function hu(){return t.jsxs("footer",{"data-testid":"footer",className:"fixed left-0 bottom-0 w-full text-left p-4 bg-white font-inter font-light text-base text-zinc-500",children:["Powered by Veevart ® ",new Date().getFullYear()]})}const bu=e=>{const n=h.useMemo(()=>JSON.stringify({allItems:e.allItems,selected:e.selected}),[e.allItems,e.selected]);return t.jsx(gu,{...e},n)},gu=({allItems:e,selected:n,onSelectedChange:s,titleLeft:a,titleRight:r})=>{const[i,o]=h.useState([]),[l,d]=h.useState([]),[u,f]=h.useState(null),[m,p]=h.useState(null),x=h.useMemo(()=>new Set(n),[n]),g=h.useMemo(()=>new Set(e),[e]),y=h.useMemo(()=>e.filter(F=>!x.has(F)),[e,x]),b=F=>{if(F.length===0)return;const L=Array.from(new Set([...n,...F]));s(L)},v=F=>{if(F.length===0)return;const L=new Set(F);s(n.filter(M=>!L.has(M)))},w=()=>{i.length!==0&&(b(i),o([]))},$=()=>{l.length!==0&&(v(l),d([]))},N=()=>{y.length!==0&&(b(y),o([]))},A=()=>{n.length!==0&&(s([]),d([]))},k=(F,L,M)=>{const I=Math.min(L,M),W=Math.max(L,M);return F.slice(I,W+1)},C=(F,L,M)=>{if(M&&u!==null){o(k(y,u,L)),d([]),f(L);return}const I=i.includes(F);o(I?i.filter(W=>W!==F):[...i,F]),d([]),f(L)},E=(F,L,M)=>{if(M&&m!==null){d(k(n,m,L)),o([]),p(L);return}const I=l.includes(F);d(I?l.filter(W=>W!==F):[...l,F]),o([]),p(L)},S=(F,L,M)=>{const I=M==="available"?i.includes(L)?i:[L]:l.includes(L)?l:[L];F.dataTransfer.setData("text/plain",JSON.stringify({source:M,items:I})),F.dataTransfer.effectAllowed="move"},_=(F,L)=>{F.preventDefault();const M=F.dataTransfer.getData("text/plain");if(M)try{const I=JSON.parse(M),W=(I.items||[]).filter(K=>g.has(K));if(W.length===0||I.source===L)return;L==="selected"?(b(W),o([])):(v(W),d([]))}catch{return}};return t.jsxs("div",{className:"flex flex-col gap-6 md:flex-row md:items-start md:justify-between",children:[t.jsxs("div",{className:"flex w-full flex-col gap-3 md:w-2/5",children:[t.jsx("h2",{className:"text-sm font-medium text-gray-700",children:a}),t.jsx(c.Card,{className:"w-full border border-gray-200 shadow-none",children:t.jsx(c.CardBody,{className:"h-60 gap-2 overflow-y-auto",onDragOver:F=>F.preventDefault(),onDrop:F=>_(F,"available"),children:y.map((F,L)=>{const M=i.includes(F);return t.jsx("button",{type:"button",onClick:I=>{C(F,L,I.shiftKey)},onMouseDown:I=>{I.shiftKey&&I.preventDefault()},draggable:!0,onDragStart:I=>S(I,F,"available"),className:`rounded-md px-3 py-2 text-left text-sm transition ${M?"bg-[#E4571E]/10 text-[#E4571E]":"text-gray-700 hover:bg-gray-100"}`,children:F},F)})})})]}),t.jsxs("div",{className:"flex flex-row items-center justify-center gap-3 md:flex-col md:pt-6",children:[t.jsx(O,{variant:"light",className:"h-10 w-10 min-w-0 text-2xl font-semibold text-[#E4571E] hover:bg-[#E4571E]/10",isIconOnly:!0,"data-testid":"move-selected-to-available",onPress:w,isDisabled:i.length===0,"aria-label":"Move selected to right",children:"›"}),t.jsx(O,{variant:"light",className:"h-10 w-10 min-w-0 text-2xl font-semibold text-[#E4571E] hover:bg-[#E4571E]/10",isIconOnly:!0,"data-testid":"move-selected-to-available",onPress:$,isDisabled:l.length===0,"aria-label":"Move selected to left",children:"‹"}),t.jsx(O,{variant:"light",className:"h-10 w-10 min-w-0 text-2xl font-semibold text-[#E4571E] hover:bg-[#E4571E]/10",isIconOnly:!0,"data-testid":"move-all-to-selected",onPress:N,isDisabled:y.length===0,"aria-label":"Move all to right",children:"»"}),t.jsx(O,{variant:"light",className:"h-10 w-10 min-w-0 text-2xl font-semibold text-[#E4571E] hover:bg-[#E4571E]/10",isIconOnly:!0,onPress:A,"data-testid":"move-all-to-available",isDisabled:n.length===0,"aria-label":"Move all to left",children:"«"})]}),t.jsxs("div",{className:"flex w-full flex-col gap-3 md:w-2/5",children:[t.jsx("h2",{className:"text-sm font-medium text-gray-700",children:r}),t.jsx(c.Card,{className:"w-full border border-gray-200 shadow-none",children:t.jsx(c.CardBody,{className:"h-60 gap-2 overflow-y-auto",onDragOver:F=>F.preventDefault(),onDrop:F=>_(F,"selected"),children:n.map((F,L)=>{const M=l.includes(F);return t.jsx("button",{type:"button",onClick:I=>{E(F,L,I.shiftKey)},onMouseDown:I=>{I.shiftKey&&I.preventDefault()},draggable:!0,onDragStart:I=>S(I,F,"selected"),className:`rounded-md px-3 py-2 text-left text-sm transition ${M?"bg-[#E4571E]/10 text-[#E4571E]":"text-gray-700 hover:bg-gray-100"}`,children:F},F)})})})]})]})};function Gt(e){return typeof e=="string"?e:e.type}function xt({className:e}){return t.jsx("div",{className:`flex items-center h-6 ${e||""}`,children:t.jsx(c.Divider,{orientation:"vertical"})})}function ht({icon:e,label:n,isActive:s=!1,isDisabled:a=!1,onClick:r,shortcut:i,iconSize:o=16,className:l}){const d=i?`${n} (${i})`:n;return t.jsx(c.Tooltip,{content:d,placement:"top",offset:10,children:t.jsx(O,{size:"sm",radius:"sm",color:s?"primary":"default",variant:s?"solid":"bordered",isIconOnly:!0,isDisabled:a,onPress:r,"aria-label":n,className:l,children:t.jsx(e,{size:o})})})}const lt={bold:{execute:({editor:e})=>e.chain().focus().toggleBold().run(),canExecute:e=>e.can().chain().focus().toggleBold().run(),isActive:e=>e.isActive("bold"),shortcut:"Mod-b",label:"Bold"},italic:{execute:({editor:e})=>e.chain().focus().toggleItalic().run(),canExecute:e=>e.can().chain().focus().toggleItalic().run(),isActive:e=>e.isActive("italic"),shortcut:"Mod-i",label:"Italic"},strike:{execute:({editor:e})=>e.chain().focus().toggleStrike().run(),canExecute:e=>e.can().chain().focus().toggleStrike().run(),isActive:e=>e.isActive("strike"),shortcut:"Mod-Shift-x",label:"Strikethrough"},underline:{execute:({editor:e})=>e.chain().focus().toggleUnderline().run(),canExecute:e=>e.can().chain().focus().toggleUnderline().run(),isActive:e=>e.isActive("underline"),shortcut:"Mod-u",label:"Underline"},code:{execute:({editor:e})=>e.chain().focus().toggleCode().run(),canExecute:e=>e.can().chain().focus().toggleCode().run(),isActive:e=>e.isActive("code"),shortcut:"Mod-e",label:"Inline code"},textColor:{execute:({editor:e,config:n})=>{const s=n?.type==="textColor"?n.color:"";s?e.chain().focus().setColor(s).run():e.chain().focus().unsetColor().run()},canExecute:()=>!0,isActive:e=>e.isActive("textStyle"),label:"Text color"},highlight:{execute:({editor:e,config:n})=>{const s=n?.type==="highlight"?n.color:"";s?e.chain().focus().setHighlight({color:s}).run():e.chain().focus().unsetHighlight().run()},canExecute:()=>!0,isActive:e=>e.isActive("highlight"),label:"Highlight"},link:{execute:({editor:e,config:n})=>{const s=n?.type==="link"?n.href:"";if(s){const a=n?.type==="link"?n.target:void 0,r=n?.type==="link"?n.rel:void 0;e.chain().focus().setLink({href:s,target:a,rel:r}).run()}else e.chain().focus().unsetLink().run()},canExecute:()=>!0,isActive:e=>e.isActive("link"),shortcut:"Mod-k",label:"Link"},paragraph:{execute:({editor:e})=>e.chain().focus().setParagraph().run(),canExecute:e=>e.can().chain().focus().setParagraph().run(),isActive:e=>e.isActive("paragraph"),shortcut:"Mod-Alt-0",label:"Paragraph"},heading:{execute:({editor:e,config:n})=>{const s=n?.type==="heading"?n.level:1;e.chain().focus().toggleHeading({level:s}).run()},canExecute:(e,n)=>{const s=n?.type==="heading"?n.level:1;return e.can().chain().focus().toggleHeading({level:s}).run()},isActive:(e,n)=>n?.type==="heading"?e.isActive("heading",{level:n.level}):e.isActive("heading"),label:"Heading"},bulletList:{execute:({editor:e})=>e.chain().focus().toggleBulletList().run(),canExecute:e=>e.can().chain().focus().toggleBulletList().run(),isActive:e=>e.isActive("bulletList"),shortcut:"Mod-Shift-8",label:"Bullet list"},orderedList:{execute:({editor:e})=>e.chain().focus().toggleOrderedList().run(),canExecute:e=>e.can().chain().focus().toggleOrderedList().run(),isActive:e=>e.isActive("orderedList"),shortcut:"Mod-Shift-7",label:"Numbered list"},taskList:{execute:({editor:e})=>e.chain().focus().toggleTaskList().run(),canExecute:e=>e.can().chain().focus().toggleTaskList().run(),isActive:e=>e.isActive("taskList"),label:"Task list"},codeBlock:{execute:({editor:e})=>e.chain().focus().toggleCodeBlock().run(),canExecute:e=>e.can().chain().focus().toggleCodeBlock().run(),isActive:e=>e.isActive("codeBlock"),shortcut:"Mod-Alt-c",label:"Code block"},blockquote:{execute:({editor:e})=>e.chain().focus().toggleBlockquote().run(),canExecute:e=>e.can().chain().focus().toggleBlockquote().run(),isActive:e=>e.isActive("blockquote"),shortcut:"Mod-Shift-b",label:"Blockquote"},horizontalRule:{execute:({editor:e})=>e.chain().focus().setHorizontalRule().run(),canExecute:e=>e.can().chain().focus().setHorizontalRule().run(),isActive:()=>!1,label:"Horizontal rule"},hardBreak:{execute:({editor:e})=>e.chain().focus().setHardBreak().run(),canExecute:e=>e.can().chain().focus().setHardBreak().run(),isActive:()=>!1,shortcut:"Mod-Enter",label:"Line break"},textAlign:{execute:({editor:e,config:n})=>{const s=n?.type==="textAlign"?n.alignment:"left";e.chain().focus().setTextAlign(s).run()},canExecute:()=>!0,isActive:(e,n)=>n?.type==="textAlign"?e.isActive({textAlign:n.alignment}):!1,label:"Text alignment"},clearMarks:{execute:({editor:e})=>e.chain().focus().unsetAllMarks().run(),canExecute:e=>e.can().chain().focus().unsetAllMarks().run(),isActive:()=>!1,label:"Clear formatting"},clearNodes:{execute:({editor:e})=>e.chain().focus().clearNodes().run(),canExecute:e=>e.can().chain().focus().clearNodes().run(),isActive:()=>!1,label:"Clear nodes"},undo:{execute:({editor:e})=>e.chain().focus().undo().run(),canExecute:e=>e.can().chain().focus().undo().run(),isActive:()=>!1,shortcut:"Mod-z",label:"Undo"},redo:{execute:({editor:e})=>e.chain().focus().redo().run(),canExecute:e=>e.can().chain().focus().redo().run(),isActive:()=>!1,shortcut:"Mod-Shift-z",label:"Redo"}},yu={1:"Heading 1",2:"Heading 2",3:"Heading 3",4:"Heading 4",5:"Heading 5",6:"Heading 6"};function vu({editor:e,levels:n=[1,2,3,4,5,6],isDisabled:s=!1}){const[,a]=h.useState(0);h.useEffect(()=>{const o=()=>a(l=>l+1);return e.on("selectionUpdate",o),e.on("transaction",o),()=>{e.off("selectionUpdate",o),e.off("transaction",o)}},[e]);const r=n.find(o=>e.isActive("heading",{level:o})),i=o=>{const l=Number(o),d=lt.heading;d&&d.execute({editor:e,config:{type:"heading",level:l}})};return t.jsxs(c.Dropdown,{placement:"top-start",offset:10,children:[t.jsx(c.DropdownTrigger,{children:t.jsx(O,{size:"sm",radius:"sm",variant:r?"solid":"bordered",color:r?"primary":"default",isDisabled:s,startContent:t.jsx(X.Heading,{size:16}),"aria-label":"Select heading level",children:r?`H${r}`:"H"})}),t.jsx(c.DropdownMenu,{"aria-label":"Heading levels",selectionMode:"single",selectedKeys:r?new Set([String(r)]):new Set,onAction:i,children:n.map(o=>t.jsx(c.DropdownItem,{startContent:e.isActive("heading",{level:o})?t.jsx(X.Check,{size:16}):t.jsx("div",{className:"w-4"}),children:yu[o]},o))})]})}const Wn={bulletList:{label:"Bullet List",icon:X.List},orderedList:{label:"Numbered List",icon:X.ListOrdered},taskList:{label:"Task List",icon:X.ListTodo}};function ju({editor:e,types:n=["bulletList","orderedList","taskList"],isDisabled:s=!1}){const[,a]=h.useState(0);h.useEffect(()=>{const l=()=>a(d=>d+1);return e.on("selectionUpdate",l),e.on("transaction",l),()=>{e.off("selectionUpdate",l),e.off("transaction",l)}},[e]);const r=n.find(l=>e.isActive(l)),i=r?Wn[r].icon:X.List,o=l=>{const u=lt[l];u&&u.execute({editor:e})};return t.jsxs(c.Dropdown,{placement:"top-start",offset:10,children:[t.jsx(c.DropdownTrigger,{children:t.jsx(O,{size:"sm",radius:"sm",variant:r?"solid":"bordered",color:r?"primary":"default",isDisabled:s,isIconOnly:!0,"aria-label":"Select list type",children:t.jsx(i,{size:16})})}),t.jsx(c.DropdownMenu,{"aria-label":"List types",selectionMode:"single",selectedKeys:r?new Set([r]):new Set,onAction:o,children:n.map(l=>{const d=Wn[l].icon;return t.jsx(c.DropdownItem,{startContent:t.jsx(d,{size:16}),children:Wn[l].label},l)})})]})}function wu({colors:e,selectedColor:n,onColorSelect:s,columns:a=4}){return t.jsx("div",{className:"grid gap-2",style:{gridTemplateColumns:`repeat(${a}, minmax(0, 1fr))`},children:e.map(r=>{const i=n===r;return t.jsx("button",{type:"button",onClick:()=>s(r),className:`
8
8
  w-8 h-8 rounded-full border-2 cursor-pointer
9
9
  transition-all duration-200
10
10
  hover:scale-110 hover:shadow-md
11
11
  focus:outline-none focus:ring-2 focus:ring-primary focus:ring-offset-2
12
12
  ${i?"border-primary ring-2 ring-primary ring-offset-2 scale-110":"border-divider"}
13
- `,style:{backgroundColor:r},"aria-label":`Select color ${r}`,title:r},r)})})}const gu=["#000000","#374151","#6B7280","#EF4444","#F59E0B","#10B981","#3B82F6","#8B5CF6","#EC4899","#14B8A6","#F97316","#A855F7"],yu=["#FEF3C7","#DBEAFE","#D1FAE5","#FCE7F3","#E0E7FF","#FED7AA","#F3E8FF","#CCFBF1","#FEE2E2","#E5E7EB","#FAE8FF","#BFDBFE"];function Wn(e){return/^#([0-9A-F]{3}){1,2}$/i.test(e)}const Le={min:50,max:200,step:10,default:100},La={lineHeight:24,toolbarHeight:60},vu={bold:X.Bold,italic:X.Italic,strike:X.Strikethrough,underline:X.Underline,code:X.Code,textColor:X.Palette,highlight:X.Highlighter,link:X.Link2,paragraph:X.FileText,heading:X.Heading,bulletList:X.List,orderedList:X.ListOrdered,taskList:X.ListTodo,codeBlock:X.CodeSquare,blockquote:X.Quote,horizontalRule:X.Minus,clearMarks:X.Eraser,clearNodes:X.Eraser,undo:X.Undo2,redo:X.Redo2,hardBreak:X.CornerDownLeft,textAlign:X.AlignLeft},ju={left:X.AlignLeft,center:X.AlignCenter,right:X.AlignRight,justify:X.AlignJustify};function kt(e){return vu[e]}function wu({value:e,onChange:n,onApply:s,placeholder:a="#000000"}){const[r,i]=h.useState(""),o=u=>{const f=u.target.value;n(f),r&&i("")},l=()=>{if(!e){i("Please enter a color");return}if(!Wn(e)){i("Invalid hex color (e.g., #FF0000)");return}i(""),s(e)},d=u=>{u.key==="Enter"&&(u.preventDefault(),l())};return t.jsxs("div",{className:"space-y-2",children:[t.jsxs("div",{className:"flex gap-2",children:[t.jsx(c.Input,{type:"text",value:e,onChange:o,onKeyDown:d,placeholder:a,size:"sm",variant:"bordered","aria-label":"Custom color hex code",isInvalid:!!r,errorMessage:r,startContent:t.jsx("div",{className:"w-4 h-4 rounded border border-divider",style:{backgroundColor:Wn(e)?e:"transparent"}})}),t.jsx(O,{size:"sm",color:"primary",variant:"flat",isIconOnly:!0,onPress:l,"aria-label":"Apply custom color",isDisabled:!e||!Wn(e),children:t.jsx(X.Check,{size:16})})]}),t.jsx("p",{className:"text-xs text-default-500",children:"Enter a hex color code (e.g., #FF0000)"})]})}function Fa({editor:e,type:n,allowCustomColor:s=!0,label:a,isDisabled:r=!1}){const[i,o]=h.useState(!1),[l,d]=h.useState(""),u=n==="textColor"?gu:yu,f=y=>{const b=lt[n];b&&b.execute({editor:e,config:{type:n,color:y}}),o(!1),d("")},m=y=>{f(y)},p=()=>{const y=lt[n];y&&y.execute({editor:e,config:{type:n,color:""}}),o(!1)},x=n==="textColor"?e.isActive("textStyle"):e.isActive("highlight"),g=n==="textColor"?X.Palette:X.Highlighter;return t.jsxs(c.Popover,{isOpen:i,onOpenChange:o,placement:"top",offset:10,showArrow:!0,children:[t.jsx(c.PopoverTrigger,{children:t.jsx(O,{size:"sm",radius:"sm",variant:x?"solid":"bordered",color:x?"primary":"default",isIconOnly:!0,isDisabled:r,"aria-label":a,children:t.jsx(g,{size:16})})}),t.jsx(c.PopoverContent,{className:"w-64",children:t.jsxs("div",{className:"px-2 py-3 space-y-3",children:[t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsx("span",{className:"text-sm font-semibold",children:a}),t.jsx(O,{size:"sm",variant:"light",isIconOnly:!0,onPress:p,"aria-label":"Clear color",children:t.jsx(X.X,{size:16})})]}),t.jsx(bu,{colors:u,onColorSelect:f}),s&&t.jsxs(t.Fragment,{children:[t.jsx(c.Divider,{}),t.jsxs("div",{children:[t.jsx("p",{className:"text-xs font-semibold mb-2 text-default-700",children:"Custom Color"}),t.jsx(wu,{value:l,onChange:d,onApply:m})]})]})]})})]})}function Nu({zoom:e,onZoomChange:n,min:s=Le.min,max:a=Le.max,step:r=Le.step}){const i=()=>{const m=Math.max(s,e-r);n(m)},o=()=>{const m=Math.min(a,e+r);n(m)},l=()=>{n(Le.default)},d=e<=s,u=e>=a,f=e===Le.default;return t.jsxs("div",{className:"flex items-center gap-1",children:[t.jsx(c.Tooltip,{content:"Zoom out",placement:"top",offset:10,children:t.jsx(O,{size:"sm",radius:"sm",color:"default",variant:"bordered",isIconOnly:!0,isDisabled:d,onPress:i,"aria-label":"Zoom out",children:t.jsx(X.ZoomOut,{size:16})})}),t.jsx(c.Tooltip,{content:f?"Zoom percentage":"Click to reset zoom",placement:"top",offset:10,children:t.jsxs("button",{type:"button",onClick:l,disabled:f,className:`
13
+ `,style:{backgroundColor:r},"aria-label":`Select color ${r}`,title:r},r)})})}const Nu=["#000000","#374151","#6B7280","#EF4444","#F59E0B","#10B981","#3B82F6","#8B5CF6","#EC4899","#14B8A6","#F97316","#A855F7"],Cu=["#FEF3C7","#DBEAFE","#D1FAE5","#FCE7F3","#E0E7FF","#FED7AA","#F3E8FF","#CCFBF1","#FEE2E2","#E5E7EB","#FAE8FF","#BFDBFE"];function qn(e){return/^#([0-9A-F]{3}){1,2}$/i.test(e)}const Le={min:50,max:200,step:10,default:100},Ra={lineHeight:24,toolbarHeight:60},ku={bold:X.Bold,italic:X.Italic,strike:X.Strikethrough,underline:X.Underline,code:X.Code,textColor:X.Palette,highlight:X.Highlighter,link:X.Link2,paragraph:X.FileText,heading:X.Heading,bulletList:X.List,orderedList:X.ListOrdered,taskList:X.ListTodo,codeBlock:X.CodeSquare,blockquote:X.Quote,horizontalRule:X.Minus,clearMarks:X.Eraser,clearNodes:X.Eraser,undo:X.Undo2,redo:X.Redo2,hardBreak:X.CornerDownLeft,textAlign:X.AlignLeft},Su={left:X.AlignLeft,center:X.AlignCenter,right:X.AlignRight,justify:X.AlignJustify};function kt(e){return ku[e]}function $u({value:e,onChange:n,onApply:s,placeholder:a="#000000"}){const[r,i]=h.useState(""),o=u=>{const f=u.target.value;n(f),r&&i("")},l=()=>{if(!e){i("Please enter a color");return}if(!qn(e)){i("Invalid hex color (e.g., #FF0000)");return}i(""),s(e)},d=u=>{u.key==="Enter"&&(u.preventDefault(),l())};return t.jsxs("div",{className:"space-y-2",children:[t.jsxs("div",{className:"flex gap-2",children:[t.jsx(c.Input,{type:"text",value:e,onChange:o,onKeyDown:d,placeholder:a,size:"sm",variant:"bordered","aria-label":"Custom color hex code",isInvalid:!!r,errorMessage:r,startContent:t.jsx("div",{className:"w-4 h-4 rounded border border-divider",style:{backgroundColor:qn(e)?e:"transparent"}})}),t.jsx(O,{size:"sm",color:"primary",variant:"flat",isIconOnly:!0,onPress:l,"aria-label":"Apply custom color",isDisabled:!e||!qn(e),children:t.jsx(X.Check,{size:16})})]}),t.jsx("p",{className:"text-xs text-default-500",children:"Enter a hex color code (e.g., #FF0000)"})]})}function _a({editor:e,type:n,allowCustomColor:s=!0,label:a,isDisabled:r=!1}){const[i,o]=h.useState(!1),[l,d]=h.useState(""),u=n==="textColor"?Nu:Cu,f=y=>{const b=lt[n];b&&b.execute({editor:e,config:{type:n,color:y}}),o(!1),d("")},m=y=>{f(y)},p=()=>{const y=lt[n];y&&y.execute({editor:e,config:{type:n,color:""}}),o(!1)},x=n==="textColor"?e.isActive("textStyle"):e.isActive("highlight"),g=n==="textColor"?X.Palette:X.Highlighter;return t.jsxs(c.Popover,{isOpen:i,onOpenChange:o,placement:"top",offset:10,showArrow:!0,children:[t.jsx(c.PopoverTrigger,{children:t.jsx(O,{size:"sm",radius:"sm",variant:x?"solid":"bordered",color:x?"primary":"default",isIconOnly:!0,isDisabled:r,"aria-label":a,children:t.jsx(g,{size:16})})}),t.jsx(c.PopoverContent,{className:"w-64",children:t.jsxs("div",{className:"px-2 py-3 space-y-3",children:[t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsx("span",{className:"text-sm font-semibold",children:a}),t.jsx(O,{size:"sm",variant:"light",isIconOnly:!0,onPress:p,"aria-label":"Clear color",children:t.jsx(X.X,{size:16})})]}),t.jsx(wu,{colors:u,onColorSelect:f}),s&&t.jsxs(t.Fragment,{children:[t.jsx(c.Divider,{}),t.jsxs("div",{children:[t.jsx("p",{className:"text-xs font-semibold mb-2 text-default-700",children:"Custom Color"}),t.jsx($u,{value:l,onChange:d,onApply:m})]})]})]})})]})}function Au({zoom:e,onZoomChange:n,min:s=Le.min,max:a=Le.max,step:r=Le.step}){const i=()=>{const m=Math.max(s,e-r);n(m)},o=()=>{const m=Math.min(a,e+r);n(m)},l=()=>{n(Le.default)},d=e<=s,u=e>=a,f=e===Le.default;return t.jsxs("div",{className:"flex items-center gap-1",children:[t.jsx(c.Tooltip,{content:"Zoom out",placement:"top",offset:10,children:t.jsx(O,{size:"sm",radius:"sm",color:"default",variant:"bordered",isIconOnly:!0,isDisabled:d,onPress:i,"aria-label":"Zoom out",children:t.jsx(X.ZoomOut,{size:16})})}),t.jsx(c.Tooltip,{content:f?"Zoom percentage":"Click to reset zoom",placement:"top",offset:10,children:t.jsxs("button",{type:"button",onClick:l,disabled:f,className:`
14
14
  text-xs text-default-500 min-w-[3ch] text-center px-2
15
15
  ${f?"cursor-default":"cursor-pointer hover:text-primary"}
16
- `,"aria-label":`Zoom level ${e}%`,children:[e,"%"]})}),t.jsx(c.Tooltip,{content:"Zoom in",placement:"top",offset:10,children:t.jsx(O,{size:"sm",radius:"sm",color:"default",variant:"bordered",isIconOnly:!0,isDisabled:u,onPress:o,"aria-label":"Zoom in",children:t.jsx(X.ZoomIn,{size:16})})})]})}function Cu({editor:e,isDisabled:n=!1}){const[s,a]=h.useState(!1),[r,i]=h.useState(""),[o,l]=h.useState(""),[d,u]=h.useState(!1),f=e.isActive("link"),m=x=>{if(x){const{from:g,to:y}=e.state.selection,b=e.isActive("link");let j="";if(b){const $=e.schema.marks.link,N=e.state.doc.resolve(g),A=ua.getMarkRange(N,$);A&&(j=e.state.doc.textBetween(A.from,A.to,""))}else j=e.state.doc.textBetween(g,y,"");const w=e.getAttributes("link").href||"";i(j),l(w),u(b)}a(x)},p=()=>{if(o.trim()){const{from:x,to:g}=e.state.selection,y=e.schema.marks.link,b=e.state.doc.resolve(x),j=ua.getMarkRange(b,y),w=j?.from??x,$=j?.to??g,N=e.state.doc.textBetween(w,$,"");r.trim()&&r!==N?e.chain().focus().setTextSelection({from:w,to:$}).deleteSelection().insertContent(`<a href="${o.trim()}">${r.trim()}</a>`).run():e.chain().focus().extendMarkRange("link").updateAttributes("link",{href:o.trim()}).run()}a(!1)};return t.jsxs(c.Popover,{isOpen:s,onOpenChange:m,placement:"bottom",children:[t.jsx(c.PopoverTrigger,{children:t.jsx(O,{size:"sm",radius:"sm",variant:f?"solid":"bordered",color:f?"primary":"default",isIconOnly:!0,isDisabled:n,"aria-label":"Link",children:t.jsx(X.Link,{size:16})})}),t.jsx(c.PopoverContent,{children:t.jsxs("div",{className:"flex flex-col gap-3 p-3 w-72",children:[t.jsx(c.Input,{size:"sm",variant:"bordered",label:"Name",labelPlacement:"outside",placeholder:"Link text",value:r,onChange:x=>i(x.target.value),classNames:{inputWrapper:"focus-within:border-default-400"}}),t.jsx(c.Input,{size:"sm",variant:"bordered",label:"Link",labelPlacement:"outside",placeholder:"https://example.com",value:o,onChange:x=>l(x.target.value),onKeyDown:x=>x.key==="Enter"&&p(),classNames:{inputWrapper:"focus-within:border-default-400"}}),t.jsx(O,{size:"sm",color:"primary",onPress:p,isDisabled:!o.trim(),children:d?"Update":"Apply"})]})})]})}function ku({children:e,id:n,label:s,className:a,useButtonGroup:r=!0}){return r?t.jsx(c.ButtonGroup,{size:"sm",id:n,"aria-label":s,className:a,children:e}):t.jsx("div",{id:n,role:"group","aria-label":s,className:`flex items-center gap-2 ${a||""}`,children:e})}function xi(e,n){const s=h.useMemo(()=>{if(!e)return{};const i={};return Array.from(new Set(n.map(l=>Kt(l)))).forEach(l=>{const d=lt[l];if(d)try{const u=d.canExecute?.(e)??!0,f=d.isActive?.(e)??!1;i[l]={isActive:f,isDisabled:!u,canExecute:u}}catch(u){console.warn(`Extension not available for modifier: ${l}`,u),i[l]={isActive:!1,isDisabled:!0,canExecute:!1}}}),i},[e,n]),[a,r]=h.useState(s);return h.useEffect(()=>{if(!e)return;const i=()=>{const o={};Array.from(new Set(n.map(d=>Kt(d)))).forEach(d=>{const u=lt[d];if(u)try{const f=u.canExecute?.(e)??!0,m=u.isActive?.(e)??!1;o[d]={isActive:m,isDisabled:!f,canExecute:f}}catch(f){console.warn(`Extension not available for modifier: ${d}`,f),o[d]={isActive:!1,isDisabled:!0,canExecute:!1}}}),r(o)};return e.on("selectionUpdate",i),e.on("transaction",i),()=>{e.off("selectionUpdate",i),e.off("transaction",i)}},[e,n,s]),a}function pi(e,n){const s=h.useCallback((o,l)=>{if(!e)return;const d=lt[o];if(d)try{d.execute({editor:e,config:l}),n?.({type:"toggle",modifier:o})}catch(u){console.warn(`Failed to execute command for modifier: ${o}`,u)}},[e,n]),a=h.useCallback(o=>{s(o)},[s]),r=h.useCallback((o,l)=>{if(!e)return!1;const d=lt[o];try{return d?.canExecute?.(e,l)??!1}catch(u){return console.warn(`Failed to check canExecute for modifier: ${o}`,u),!1}},[e]),i=h.useCallback((o,l)=>{if(!e)return!1;const d=lt[o];try{return d?.isActive?.(e,l)??!1}catch(u){return console.warn(`Failed to check isActive for modifier: ${o}`,u),!1}},[e]);return{executeCommand:s,toggleModifier:a,canExecute:r,isActive:i}}function Su(e=Le.default){const[n,s]=h.useState(e),a=h.useCallback((l=Le.step)=>{s(d=>Math.min(Le.max,d+l))},[]),r=h.useCallback((l=Le.step)=>{s(d=>Math.max(Le.min,d-l))},[]),i=h.useCallback(()=>{s(Le.default)},[]),o=h.useCallback(l=>{const d=Math.max(Le.min,Math.min(Le.max,l));s(d)},[]);return{zoom:n,setZoom:o,zoomIn:a,zoomOut:r,resetZoom:i,isMinZoom:n<=Le.min,isMaxZoom:n>=Le.max,isDefaultZoom:n===Le.default}}const $u=["bold","italic","strike","underline","code"];function Au({editor:e,modifiers:n,onToolbarAction:s}){const a=xi(e,n),{toggleModifier:r}=pi(e,s);if(!e)return null;const i=n.map(o=>Kt(o)).filter(o=>$u.includes(o));return i.length===0?null:t.jsx(ku,{id:"text-formatting",label:"Text formatting",children:i.map(o=>{const l=a[o],d=kt(o);return t.jsx(ht,{icon:d,label:o.charAt(0).toUpperCase()+o.slice(1),isActive:l?.isActive,isDisabled:l?.isDisabled,onClick:()=>r(o)},o)})})}function Du({editor:e,modifiers:n,zoom:s=100,onZoomChange:a,sticky:r=!0,className:i,onToolbarAction:o}){const l=xi(e,n),{toggleModifier:d,executeCommand:u}=pi(e,o);if(!e)return null;const f=n.map(C=>Kt(C)),m=f.some(C=>["bold","italic","strike","underline","code"].includes(C)),p=f.some(C=>["textColor","highlight"].includes(C)),x=f.includes("heading"),g=f.includes("textAlign"),y=f.some(C=>["bulletList","orderedList","taskList"].includes(C)),b=f.includes("blockquote"),j=f.includes("codeBlock"),w=f.includes("link"),$=f.includes("horizontalRule"),N=f.some(C=>["undo","redo"].includes(C)),A=s!==void 0&&a!==void 0,k=r?"sticky top-0 z-10":"";return t.jsx("div",{className:`w-full p-2 bg-background border-b border-divider ${k} ${i||""}`,children:t.jsxs("div",{className:"flex flex-row flex-wrap gap-2 w-full items-center",children:[m&&t.jsxs(t.Fragment,{children:[t.jsx(Au,{editor:e,modifiers:n,onToolbarAction:o}),(p||x||g||y||b||j||w||$||N||A)&&t.jsx(xt,{})]}),p&&t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"flex items-center gap-1",children:[f.includes("textColor")&&t.jsx(Fa,{editor:e,type:"textColor",label:"Text color",isDisabled:l.textColor?.isDisabled}),f.includes("highlight")&&t.jsx(Fa,{editor:e,type:"highlight",label:"Highlight",isDisabled:l.highlight?.isDisabled})]}),(x||g||y||b||j||w||$||N||A)&&t.jsx(xt,{})]}),x&&t.jsxs(t.Fragment,{children:[t.jsx(pu,{editor:e}),(g||y||b||j||w||$||N||A)&&t.jsx(xt,{})]}),g&&t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"flex items-center gap-1",children:["left","center","right","justify"].map(C=>{const D=ju[C],S=e.isActive({textAlign:C});return t.jsx(ht,{icon:D,label:`Align ${C}`,isActive:S,onClick:()=>u("textAlign",{type:"textAlign",alignment:C})},C)})}),(y||b||j||w||$||N||A)&&t.jsx(xt,{})]}),y&&t.jsxs(t.Fragment,{children:[t.jsx(hu,{editor:e,types:f.filter(C=>["bulletList","orderedList","taskList"].includes(C))}),(b||j||w||$||N||A)&&t.jsx(xt,{})]}),(b||j||w||$)&&t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"flex items-center gap-1",children:[b&&t.jsx(ht,{icon:kt("blockquote"),label:"Blockquote",isActive:l.blockquote?.isActive,isDisabled:l.blockquote?.isDisabled,onClick:()=>d("blockquote")}),j&&t.jsx(ht,{icon:kt("codeBlock"),label:"Code block",isActive:l.codeBlock?.isActive,isDisabled:l.codeBlock?.isDisabled,onClick:()=>d("codeBlock")}),w&&t.jsx(Cu,{editor:e,isDisabled:l.link?.isDisabled}),$&&t.jsx(ht,{icon:kt("horizontalRule"),label:"Horizontal rule",onClick:()=>d("horizontalRule")})]}),(N||A)&&t.jsx(xt,{})]}),N&&t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"flex items-center gap-1",children:[f.includes("undo")&&t.jsx(ht,{icon:kt("undo"),label:"Undo",isDisabled:l.undo?.isDisabled,onClick:()=>d("undo")}),f.includes("redo")&&t.jsx(ht,{icon:kt("redo"),label:"Redo",isDisabled:l.redo?.isDisabled,onClick:()=>d("redo")})]}),A&&t.jsx(xt,{})]}),A&&t.jsx(Nu,{zoom:s,onZoomChange:C=>{a?.(C),o?.({type:"zoom",modifier:`${C}%`})}})]})})}const Mt={bold:{category:"mark",extension:Zo.Bold,priority:100},italic:{category:"mark",extension:Xo.Italic,priority:100},strike:{category:"mark",extension:Jo.Strike,priority:100},underline:{category:"mark",extension:ec.Underline,priority:100},code:{category:"mark",extension:tc.Code,priority:100},textColor:{category:"mark",extension:nc.Color,defaultOptions:{types:["textStyle","heading","paragraph","listItem","taskItem","blockquote"]},priority:90},highlight:{category:"mark",extension:sc.Highlight,defaultOptions:{multicolor:!0},priority:90},link:{category:"mark",extension:ac.Link,defaultOptions:{autolink:!0,linkOnPaste:!0,openOnClick:!1,HTMLAttributes:{class:"text-primary underline cursor-pointer"}},priority:100},heading:{category:"node",extension:ic.Heading,defaultOptions:{levels:[1,2,3,4,5,6]},priority:100},bulletList:{category:"node",extension:oc.BulletList,defaultOptions:{HTMLAttributes:{class:"list-disc"}},priority:90},orderedList:{category:"node",extension:cc.OrderedList,defaultOptions:{HTMLAttributes:{class:"list-decimal"}},priority:90},taskList:{category:"node",extension:dc.TaskList,defaultOptions:{HTMLAttributes:{class:"task-list"}},priority:90},codeBlock:{category:"node",extension:fc.CodeBlock,priority:100},blockquote:{category:"node",extension:xc.Blockquote,priority:100},horizontalRule:{category:"node",extension:pc.HorizontalRule,priority:100},hardBreak:{category:"node",extension:hc.HardBreak,priority:100},undo:{category:"extension",extension:ma.History,priority:50},redo:{category:"extension",extension:ma.History,priority:50},textAlign:{category:"extension",extension:bc.TextAlign,defaultOptions:{types:["heading","paragraph","listItem","bulletList","orderedList","taskList","taskItem","blockquote"],alignments:["left","center","right","justify"],defaultAlignment:"left"},priority:80},clearMarks:{category:"extension",extension:null,priority:50},clearNodes:{category:"extension",extension:null,priority:50}},Eu=[gc.Document,yc.Text,lc.Paragraph,rc.TextStyle.configure({HTMLAttributes:{}}),mc.ListItem.configure({HTMLAttributes:{}}),uc.TaskItem.configure({nested:!0}),vc.Dropcursor,jc.Gapcursor];function Lu(e){const n=[],s=new Set,a=new Set;Eu.forEach(l=>{l&&(n.push(l),a.add(l.name))});const r=e.map(l=>Kt(l)),i=new Set;return r.forEach(l=>{const d=Mt[l];d?.requiredExtensions&&d.requiredExtensions.forEach(u=>{i.add(u)})}),i.forEach(l=>{if(s.has(l))return;const d=Mt[l];if(!d||d.extension===null)return;const u=d.extension.name;if(a.has(u)){s.add(l);return}const f=d.defaultOptions?d.extension.configure(d.defaultOptions):d.extension;n.push(f),s.add(l),a.add(u)}),r.forEach(l=>{if(s.has(l))return;const d=Mt[l];if(!d){console.warn(`Extension config not found for modifier: ${l}`);return}if(d.extension===null){s.add(l);return}const u=d.extension.name;if(a.has(u)){s.add(l);return}const f=d.defaultOptions?d.extension.configure(d.defaultOptions):d.extension;n.push(f),s.add(l),a.add(u)}),n.sort((l,d)=>{const u=Object.values(Mt).find(x=>x?.extension?.name===l.name),f=Object.values(Mt).find(x=>x?.extension?.name===d.name),m=u?.priority??100;return(f?.priority??100)-m})}const hi={simple:["bold","italic","bulletList","orderedList","undo","redo"],blog:["bold","italic","underline",{type:"heading",level:2},{type:"heading",level:3},"textAlign","bulletList","orderedList","link","blockquote","undo","redo"],documentation:["bold","italic","strike","underline","code","clearMarks",{type:"heading",level:1},{type:"heading",level:2},{type:"heading",level:3},{type:"heading",level:4},{type:"heading",level:5},{type:"heading",level:6},"textAlign","bulletList","orderedList","taskList","link","textColor","highlight","codeBlock","blockquote","horizontalRule","hardBreak","undo","redo"],comment:["bold","italic","link","undo","redo"],full:["bold","italic","strike","underline","code","clearMarks",{type:"heading",level:1},{type:"heading",level:2},{type:"heading",level:3},{type:"heading",level:4},{type:"heading",level:5},{type:"heading",level:6},"textAlign","bulletList","orderedList","taskList","link","textColor","highlight","codeBlock","blockquote","horizontalRule","hardBreak","undo","redo"]},Fu={h1:`font-size: ${ge.fontSize["4xl"]}; font-weight: ${ge.fontWeight.semibold}; line-height: ${ge.lineHeight.tight}; margin: ${pe.md} 0 ${pe.sm} 0;`,h2:`font-size: ${ge.fontSize["2xl"]}; font-weight: ${ge.fontWeight.semibold}; line-height: ${ge.lineHeight.tight}; margin: ${pe.md} 0 ${pe.sm} 0;`,h3:`font-size: ${ge.fontSize.xl}; font-weight: ${ge.fontWeight.semibold}; line-height: ${ge.lineHeight.tight}; margin: ${pe.md} 0 ${pe.sm} 0;`,h4:`font-size: ${ge.fontSize.lg}; font-weight: ${ge.fontWeight.semibold}; line-height: ${ge.lineHeight.tight}; margin: ${pe.md} 0 ${pe.sm} 0;`,h5:`font-size: ${ge.fontSize.base}; font-weight: ${ge.fontWeight.semibold}; line-height: ${ge.lineHeight.tight}; margin: ${pe.md} 0 ${pe.sm} 0;`,h6:`font-size: ${ge.fontSize.sm}; font-weight: ${ge.fontWeight.semibold}; line-height: ${ge.lineHeight.tight}; margin: ${pe.md} 0 ${pe.sm} 0;`,p:`min-height: ${ge.lineHeight.normal}em; margin: 0;`,ul:`list-style-type: disc; list-style-position: outside; padding-left: ${pe.xl}; margin: ${pe.md} 0;`,ol:`list-style-type: decimal; list-style-position: outside; padding-left: ${pe.xl}; margin: ${pe.md} 0;`,li:`display: list-item; margin: ${pe.xs} 0;`,strong:`font-weight: ${ge.fontWeight.bold};`,em:"font-style: italic;",s:"text-decoration: line-through;",u:"text-decoration: underline;",code:`background-color: ${De.neutral.gray[100]}; border-radius: 0.4rem; font-size: ${ge.fontSize.sm}; padding: 0.25em 0.3em; font-family: ${ge.fontFamily.mono};`,pre:`background: ${De.neutral.gray[800]}; border-radius: ${pe.sm}; color: ${De.neutral.gray[100]}; font-family: ${ge.fontFamily.mono}; margin: ${pe.lg} 0; padding: 0.75rem ${pe.md}; overflow-x: auto;`,blockquote:`border-left: 3px solid ${De.neutral.gray[300]}; margin: ${pe.lg} 0; padding-left: ${pe.md}; color: ${De.neutral.gray[500]};`,hr:`border: none; border-top: 1px solid ${De.neutral.gray[200]}; margin: ${pe.xl} 0;`,a:`color: ${De.brand.primary.DEFAULT}; text-decoration: underline; cursor: pointer;`,mark:`background-color: ${De.palettes.warning[200]}; border-radius: ${pe.xs}; padding: 0 0.125rem;`,label:`display: flex; align-items: center; gap: ${pe.sm}; cursor: pointer;`,input:"cursor: pointer; margin: 0;"},Ru={taskList:"list-style: none; padding-left: 0; margin: 1rem 0;",taskItem:"display: flex; align-items: flex-start; gap: 0.5rem; margin: 0.5rem 0;"};function _u(e){if(!e)return e;let n=e;for(const[s,a]of Object.entries(Ru)){const r=new RegExp(`(<(?:ul|li)[^>]*data-type="${s}"[^>]*)>`,"gi");n=n.replace(r,(i,o)=>i.includes('style="')?i.replace(/style="([^"]*)"/,`style="$1 ${a}"`):`${o} style="${a}">`)}for(const[s,a]of Object.entries(Fu)){const r=new RegExp(`<${s}(\\s[^>]*)?>`,"gi");n=n.replace(r,i=>{if(i.includes('data-type="taskList"')||i.includes('data-type="taskItem"'))return i;if(i.includes('style="'))return i.replace(/style="([^"]*)"/,`style="$1 ${a}"`);if(i.includes("style='"))return i.replace(/style='([^']*)'/,`style='$1 ${a}'`);{const o=i.indexOf(">");return`${i.slice(0,o)} style="${a}"${i.slice(o)}`}})}return n}const Mu=({modifiers:e,zoom:n,onZoomChange:s,onToolbarAction:a})=>{const{editor:r}=ws.useCurrentEditor();return t.jsx(Du,{editor:r,modifiers:e,zoom:n,onZoomChange:s,onToolbarAction:a})},Pu=({showCharacterCount:e,showWordCount:n})=>{const{editor:s}=ws.useCurrentEditor();if(!s||!e&&!n)return null;const a=s.getText(),r=a.length,i=a.split(/\s+/).filter(o=>o.length>0).length;return t.jsxs("div",{className:"flex gap-4 text-xs text-default-500 px-2 pb-1",children:[e&&t.jsxs("span",{children:[r," characters"]}),n&&t.jsxs("span",{children:[i," words"]})]})},ms=h.forwardRef((e,n)=>{const{minRows:s=10,maxRows:a=30,disableAutosize:r=!1,showCharacterCount:i=!1,showWordCount:o=!1,showToolbar:l=!0,modifiers:d=hi.full,variant:u="bordered",initialContent:f,content:m,onContentChange:p,onUpdate:x,onToolbarAction:g,isReadOnly:y=!1,isDisabled:b=!1,includeInlineStyles:j=!0,...w}=e,{zoom:$,setZoom:N}=Su(),A=La.lineHeight,k=s*A,C=r?void 0:a*A,D=h.useMemo(()=>Lu(d),[d]),{Component:S,label:_,shouldLabelBeOutside:F,getBaseProps:L,getLabelProps:M,getInputWrapperProps:I}=c.useInput({...w,variant:u,ref:n,isMultiline:!0}),W=_?t.jsx("label",{...M(),children:_}):null,K=h.useCallback(({editor:z})=>{const ne=z.getHTML(),G=j?_u(ne):ne,se=z.getJSON(),Y=z.getText(),oe=Y.length,J=Y.split(/\s+/).filter(re=>re.length>0).length,q={html:G,json:se,text:Y,characters:oe,words:J};if(p?.(q),x?.(q),"onChange"in w&&typeof w.onChange=="function"){const re={target:{value:G},currentTarget:{value:G}};w.onChange(re)}},[p,x,w,j]);return t.jsxs(S,{...L(),children:[F?W:null,t.jsx("div",{...I(),className:c.cn(I().className,"flex flex-col w-full p-0 gap-0 rich-text-editor"),style:{maxHeight:C?`${C+La.toolbarHeight}px`:void 0,overflow:C?"auto":void 0},children:t.jsx(ws.EditorProvider,{editable:!y&&!b,slotBefore:l?t.jsx(Mu,{modifiers:d,zoom:$,onZoomChange:N,onToolbarAction:g}):void 0,slotAfter:t.jsx(Pu,{showCharacterCount:i,showWordCount:o}),editorContainerProps:{className:"w-full flex-1 outline-none",style:{minHeight:`${k}px`,fontSize:`${$}%`,display:"flex",flexDirection:"column"}},editorProps:{attributes:{class:"focus:outline-none w-full h-full"}},extensions:D,content:m||f||e.defaultValue||"",onUpdate:K})})]})});ms.displayName="TipTapEditor";const bi=h.forwardRef((e,n)=>{const{adapter:s="tiptap",variant:a="bordered",...r}=e;return s==="tiptap"?t.jsx(ms,{...r,variant:a,ref:n}):(console.warn(`Adapter "${s}" is not supported. Using TipTap.`),t.jsx(ms,{...r,variant:a,ref:n}))});bi.displayName="RichTextArea";function Ra(e,n="en-US",s="USD",a=!0){try{return new Intl.NumberFormat(n,a?{style:"currency",currency:s,minimumFractionDigits:0,maximumFractionDigits:2}:{style:"currency",currency:s}).format(e)}catch(r){return console.warn(`Invalid currency formatting: ${r}`),`${s} ${e.toFixed(2)}`}}const gi="(prefers-reduced-motion: reduce)",yi="data-pos-reduce-motion",Se="motion-reduce:transition-none [html[data-pos-reduce-motion=true]_&]:transition-none",vi="motion-reduce:animate-none [html[data-pos-reduce-motion=true]_&]:animate-none",un=`rounded-[0.375rem] bg-[linear-gradient(90deg,#F0F0F1_0,#F9F9FA_12.5rem,#F0F0F1_25rem)] bg-[length:50rem_100%] animate-record-shimmer ${vi}`;function Tu(){return typeof document>"u"?!1:document.documentElement.getAttribute(yi)==="true"?!0:typeof window.matchMedia=="function"&&window.matchMedia(gi).matches}function ji(){const[e,n]=h.useState(!1);return h.useEffect(()=>{const s=()=>n(Tu()),a=typeof window.matchMedia=="function"?window.matchMedia(gi):null;a?.addEventListener?.("change",s);const r=typeof MutationObserver>"u"?null:new MutationObserver(s);return r?.observe(document.documentElement,{attributes:!0,attributeFilter:[yi]}),s(),()=>{a?.removeEventListener?.("change",s),r?.disconnect()}},[]),e}const _a=`h-auto min-w-0 w-full flex-col gap-0 border bg-white text-center shadow-none transition-colors data-[focus-visible=true]:outline-primary ${Se} motion-reduce:data-[pressed=true]:scale-100 [html[data-pos-reduce-motion=true]_&]:data-[pressed=true]:scale-100`,Ma=`border bg-white shadow-none ${Se}`,Iu={tile:{root:"flex flex-col",title:"mb-5 text-xs font-semibold uppercase tracking-[.04em] text-pos-muted",eyebrow:"mb-1 text-xs font-semibold uppercase tracking-[.08em] text-pos-muted",caption:"mb-3 text-sm text-pos-muted",grid:"grid gap-2",preset:`${_a} rounded-xl px-1 py-3.5`,presetIdle:"border-pos-field text-pos-ink data-[hover=true]:border-pos-line-strong data-[hover=true]:bg-white",presetSelected:"border-primary bg-primary/[.09] text-primary data-[hover=true]:bg-primary/[.09]",amount:"text-base font-bold leading-[1.1875rem]",amountSelected:"",sublabel:"mt-1 text-xs font-semibold text-pos-neutral",customLabel:"mb-1.5 block text-sm font-semibold text-pos-ink",inputBase:"mt-2",inputWrapper:`${Ma} rounded-xl border-pos-field px-3.5 data-[hover=true]:border-pos-field group-data-[focus=true]:border-primary group-data-[focus=true]:data-[hover=true]:border-primary group-data-[focus=true]:shadow-[0_0_0_0.125rem_hsl(var(--heroui-primary)/0.14)]`,inputWrapperActive:"border-primary data-[hover=true]:border-primary",input:"text-pos-ink placeholder:text-pos-faint"},pos:{root:"flex flex-col",title:"mb-1.5 block text-[0.8125rem] font-semibold leading-[1.21875rem] text-pos-ink",eyebrow:"mb-1 text-[0.6875rem] font-semibold uppercase leading-[1.03125rem] tracking-[.08em] text-pos-muted",caption:"mb-3 text-[0.8125rem] leading-[1.21875rem] text-pos-muted",grid:"mb-3.5 grid grid-cols-[repeat(auto-fit,minmax(6rem,1fr))] gap-2.5",preset:`${_a} rounded-[0.875rem] px-2.5 py-3`,presetIdle:"border-pos-line data-[hover=true]:border-primary data-[hover=true]:bg-white",presetSelected:"border-primary bg-primary/5 data-[hover=true]:bg-primary/5",amount:"text-[1.1875rem] font-semibold leading-[1.1875rem] text-pos-ink",amountSelected:"",sublabel:"mt-[0.3125rem] text-[0.71875rem] font-semibold leading-[0.875rem] text-pos-neutral",customLabel:"mb-1.5 block text-[0.8125rem] font-semibold leading-[1.21875rem] text-pos-ink",inputBase:"",inputWrapper:`${Ma} rounded-lg border-pos-line px-3 data-[hover=true]:border-pos-line group-data-[focus=true]:border-primary group-data-[focus=true]:data-[hover=true]:border-primary group-data-[focus=true]:shadow-[0_0_0_0.1875rem_hsl(var(--heroui-primary)/0.1)]`,inputWrapperActive:"border-primary data-[hover=true]:border-primary",input:"text-pos-ink placeholder:text-pos-muted"}},Ou={tile:{sm:{wrapper:"h-8 min-h-8",input:"text-sm"},md:{wrapper:"h-[2.375rem] min-h-[2.375rem]",input:"text-sm"},lg:{wrapper:"h-12 min-h-12",input:"text-base"}},pos:{sm:{wrapper:"h-8 min-h-8",input:"text-sm"},md:{wrapper:"h-10 min-h-10",input:"text-sm"},lg:{wrapper:"h-12 min-h-12",input:"text-base"}}},Pa=[{id:"100",amount:100},{id:"250",amount:250},{id:"500",amount:500},{id:"1000",amount:1e3},{id:"2000",amount:2e3}],zu={title:"Donation Amount",customAmountPlaceholder:"Custom donation amount",customAmountAriaLabel:"Custom donation amount",addDonationButton:"Add Donation",presetsAriaLabel:"Suggested amounts"},wi=({presetAmounts:e=Pa,selectedDonation:n,defaultSelectedDonation:s=null,onChange:a,onAddDonation:r,currency:i="USD",locale:o="en-US",showCustomAmount:l=!0,minCustomAmount:d=.5,maxCustomAmount:u=1e6,labels:f,mobileColumns:m=2,desktopColumns:p=3,isDisabled:x=!1,buttonVariant:g="bordered",buttonColor:y="default",inputVariant:b="bordered",size:j="md",className:w="",showCard:$=!0,variant:N="pill",isRequired:A=!1})=>{const k={...zu,...f},C=h.useId(),D=`${C}-title`,S=`${C}-custom`,_=Array.isArray(e)?e:Pa,F={2:"grid-cols-2",3:"grid-cols-3"},L={3:"sm:grid-cols-3",4:"sm:grid-cols-4",5:"sm:grid-cols-5",6:"sm:grid-cols-6"},M=`${F[m]} ${L[p]}`,[I,W]=An(n,s,a),[K,z]=h.useState(""),[ne,G]=h.useState(!1),[se,Y]=h.useState(0),oe=h.useCallback(Z=>{if(x)return;const he={amount:Z.amount,isCustom:!1,presetId:Z.id};W(he),z(""),G(!1),Y(Je=>Je+1),r?.(he)},[x,W,r]),J=h.useCallback(Z=>{if(x)return;if(z(Z!==void 0?String(Z):""),r){W(null);return}if(G(!1),Z===void 0||isNaN(Z)){W(null);return}W({amount:Z,isCustom:!0})},[x,W,r]),q=h.useCallback(()=>{if(x)return;const Z=K!==""?parseFloat(K):void 0;Z===void 0||isNaN(Z)||r?.({amount:Z,isCustom:!0})},[x,K,r]),re=h.useMemo(()=>({style:"currency",currency:i,currencyDisplay:"symbol"}),[i]),V=Z=>I!==null&&!I.isCustom&&I.presetId===Z.id,ee=(Z,he)=>{const Je=I?.isCustom===!0,We=!r&&ne;return t.jsxs("div",{className:Z.root,"data-testid":"donation-amounts-root","data-variant":N,children:[k.eyebrow&&t.jsx("p",{className:Z.eyebrow,"data-testid":"donation-amounts-eyebrow",children:k.eyebrow}),k.title&&t.jsxs("p",{id:D,className:Z.title,"data-testid":"donation-amounts-title",children:[k.title,A&&t.jsx("span",{"aria-hidden":"true",className:"ml-0.5 text-pos-danger",children:"*"})]}),k.caption&&t.jsx("p",{className:Z.caption,"data-testid":"donation-amounts-caption",children:k.caption}),_.length>0&&t.jsx("div",{role:"group","aria-labelledby":k.title?D:void 0,"aria-label":k.title?void 0:k.presetsAriaLabel,className:c.cn(Z.grid,N==="tile"&&M),"data-testid":"donation-amounts-presets",children:_.map(ve=>{const qe=V(ve)&&!We;return t.jsxs(O,{color:"default",variant:"bordered",disableRipple:!0,"aria-pressed":qe,className:c.cn(Z.preset,qe?Z.presetSelected:Z.presetIdle),onPress:()=>oe(ve),isDisabled:x,"data-selected":qe||void 0,"data-testid":`donation-amounts-preset-${ve.id}`,children:[t.jsx("span",{className:c.cn(Z.amount,qe&&Z.amountSelected),children:ve.label||Ra(ve.amount,o,i,N!=="pos")}),ve.sublabel&&" ",ve.sublabel&&t.jsx("span",{className:Z.sublabel,"data-testid":`donation-amounts-preset-${ve.id}-sublabel`,children:ve.sublabel})]},ve.id)})}),l&&t.jsxs("div",{className:c.cn("flex flex-col",Z.inputBase),children:[k.customAmountLabel&&t.jsx("label",{htmlFor:S,className:Z.customLabel,"data-testid":"donation-amounts-custom-label",children:k.customAmountLabel}),t.jsxs("div",{className:"flex items-start gap-3",children:[t.jsx(c.NumberInput,{id:S,placeholder:k.customAmountPlaceholder,"aria-label":k.customAmountLabel?void 0:k.customAmountAriaLabel,onInput:r?()=>{W(null),G(!0)}:()=>G(!0),onBlur:r?void 0:()=>G(!1),variant:"bordered",minValue:d,maxValue:u,step:.01,formatOptions:re,value:K!==""?parseFloat(K):void 0,onValueChange:J,isDisabled:x,className:"flex-1",classNames:{inputWrapper:c.cn(Z.inputWrapper,he.wrapper,(Je||We)&&Z.inputWrapperActive),input:c.cn(Z.input,he.input)},"data-testid":"donation-amounts-custom-input",hideStepper:!0},r?`custom-${se}`:I?.isCustom===!1?I.presetId:"custom"),r&&t.jsx(O,{color:"primary",variant:"solid",size:j,className:"shrink-0",onPress:q,isDisabled:x||!ne,"data-testid":"donation-amounts-add-button",children:k.addDonationButton})]})]})]})},te=t.jsxs("div",{className:"space-y-4","data-testid":"donation-amounts-root",children:[k.title&&t.jsx("h2",{id:D,className:"text-base font-semibold","data-testid":"donation-amounts-title",children:k.title}),_.length>0&&t.jsx("div",{role:"group","aria-labelledby":k.title?D:void 0,"aria-label":k.title?void 0:k.presetsAriaLabel,className:c.cn("grid gap-3",M),"data-testid":"donation-amounts-presets",children:_.map(Z=>{const he=I!==null&&!I.isCustom&&I.presetId===Z.id;return t.jsx(O,{color:he?"primary":y,variant:he?"solid":g,className:"w-full","aria-pressed":he,onPress:()=>oe(Z),isDisabled:x,"data-testid":`donation-amounts-preset-${Z.id}`,children:Z.label||Ra(Z.amount,o,i)},Z.id)})}),l&&t.jsxs("div",{className:"flex gap-3 items-start",children:[t.jsx(c.NumberInput,{placeholder:k.customAmountPlaceholder,"aria-label":k.customAmountAriaLabel,onInput:r?()=>{W(null),G(!0)}:void 0,variant:b,radius:"full",size:j,minValue:d,maxValue:u,step:.01,formatOptions:re,value:K!==""?parseFloat(K):void 0,onValueChange:J,isDisabled:x,className:"flex-1 [&_[data-slot=input-wrapper]]:!h-10 [&_[data-slot=input-wrapper]]:!min-h-10","data-testid":"donation-amounts-custom-input",hideStepper:!0},r?`custom-${se}`:I?.isCustom===!1?I.presetId:"custom"),r&&t.jsx(O,{color:"primary",variant:"solid",radius:"full",size:j,className:"shrink-0",onPress:q,isDisabled:x||!ne,"data-testid":"donation-amounts-add-button",children:k.addDonationButton})]})]}),Fe=N==="pill"?te:ee(Iu[N],Ou[N][j]);return $?t.jsx(c.Card,{className:c.cn("w-full",w),"data-testid":"donation-amounts-card",children:t.jsx(c.CardBody,{children:Fe})}):t.jsx("div",{className:c.cn("w-full",w),"data-testid":"donation-amounts-plain",children:Fe})};wi.displayName="DonationAmounts";const Bu=e=>{const n=Math.max(0,e),s=Math.floor(n/60).toString().padStart(2,"0"),a=(n%60).toString().padStart(2,"0");return`${s}:${a} minutes`},Vu=e=>{switch(e){case"warning":return X.Clock;case"error":return X.AlertCircle;case"success":return X.CheckCircle;default:return X.Clock}},Uu=e=>{switch(e){case"primary":return"bg-primary-500";case"secondary":return"bg-gray-700";case"success":return"bg-green-600";case"warning":return"bg-amber-500";case"danger":return"bg-red-600";default:return"bg-primary-500"}},Ni=h.forwardRef(({timeLeft:e,defaultTimeLeft:n=1200,onTimeChange:s,onExpire:a,variant:r="info",color:i="primary",message:o="Your cart expires in:",showIcon:l=!0,icon:d,position:u="fixed",autoStart:f=!0,formatTime:m=Bu,className:p,...x},g)=>{const[y,b]=An(e!==void 0?Math.max(0,e):void 0,Math.max(0,n),s),j=h.useRef(null),w=h.useRef(!1);h.useEffect(()=>()=>{j.current&&clearInterval(j.current)},[]),h.useEffect(()=>{if(!f||y<=0){j.current&&(clearInterval(j.current),j.current=null);return}return j.current=setInterval(()=>{b(k=>k<=1?(j.current&&(clearInterval(j.current),j.current=null),w.current||(w.current=!0,a?.()),0):k-1)},1e3),()=>{j.current&&(clearInterval(j.current),j.current=null)}},[f,y,b,a]),h.useEffect(()=>{y>0&&(w.current=!1)},[y]);const $=d||Vu(r),N=Uu(i),A={fixed:"fixed top-0 left-0",sticky:"sticky top-0",static:"static"};return t.jsx("div",{ref:g,role:"banner","aria-live":"polite","aria-label":`${o} ${m(y)}`,"data-testid":"expire-cart-timer",className:c.cn("w-full text-white z-50",N,A[u],p),...x,children:t.jsx("div",{className:"container mx-auto px-4 py-3 sm:py-2.5","data-testid":"expire-cart-timer-container",children:t.jsxs("div",{className:"flex items-center justify-between gap-3 sm:gap-4",children:[t.jsxs("div",{className:"flex items-center gap-3 sm:gap-2.5 flex-1 min-w-0","data-testid":"expire-cart-timer-left",children:[l&&t.jsx("div",{className:"flex-shrink-0 w-[0.875rem] h-[0.875rem] sm:w-4 sm:h-4 rounded-full bg-white flex items-center justify-center overflow-hidden","data-testid":"expire-cart-timer-icon-wrapper",children:t.jsx($,{className:"text-primary-500 sm:text-primary-600","aria-hidden":"true",size:14,"data-testid":"expire-cart-timer-icon"})}),t.jsx("p",{className:"text-sm sm:text-base font-medium text-white","data-testid":"expire-cart-timer-message",children:o})]}),t.jsx("div",{className:"flex-shrink-0","data-testid":"expire-cart-timer-right",children:t.jsx("span",{className:"text-sm sm:text-base font-semibold text-white","aria-label":`Time remaining: ${m(y)}`,"data-testid":"expire-cart-timer-value",children:m(y)})})]})})})});Ni.displayName="ExpireCartTimer";const vt=({icon:e,children:n,testId:s})=>t.jsxs("div",{className:"flex items-center gap-2 text-sm text-gray-600","data-testid":s,children:[t.jsx(P,{icon:e,width:20,className:"text-default-500"}),t.jsx("span",{children:n})]}),Hu=({classes:e="",name:n,imageUrl:s,eventDate:a,eventTime:r,location:i,description:o,showImage:l=!1,compact:d=!1,layout:u="stacked",imageLoading:f="eager",showMoreButtonClassName:m,labels:p})=>{const[x,g]=h.useState(!1),[y,b]=h.useState(!1),j=h.useRef(null);return h.useEffect(()=>{const w=()=>{if(j.current){const $=j.current.scrollHeight>j.current.clientHeight;b($)}};return w(),window.addEventListener("resize",w),()=>window.removeEventListener("resize",w)},[o]),u==="horizontal"?t.jsx(c.Card,{className:c.cn("border-0 shadow-none",e),"data-testid":"event-details-root",children:t.jsx(c.CardBody,{className:"p-0","data-testid":"event-details-horizontal-layout",children:t.jsxs("div",{className:"flex flex-col items-start gap-5 sm:flex-row sm:gap-8",children:[l&&s&&t.jsx("div",{className:"w-full shrink-0 overflow-hidden rounded-xl aspect-[3/2] sm:w-[360px]","data-testid":"event-details-image-wrapper",children:t.jsx(c.Image,{removeWrapper:!0,loading:f,alt:`Event image for ${n}`,className:"w-full h-full object-cover object-center",src:s,"data-testid":"event-details-image"})}),t.jsxs("div",{className:"min-w-0 flex-1 space-y-3",children:[t.jsx("h2",{className:"font-semibold text-2xl text-gray-800","data-testid":"event-details-title",children:n}),t.jsx("h3",{className:"font-semibold text-base text-gray-700","data-testid":"event-details-info-label",children:p.eventInformation}),t.jsxs("div",{className:"flex flex-wrap gap-4","data-testid":"event-details-info",children:[a&&t.jsx(vt,{icon:"solar:calendar-minimalistic-linear",testId:"event-details-date",children:a}),r&&t.jsx(vt,{icon:"solar:clock-circle-linear",testId:"event-details-time",children:r}),i&&t.jsx(vt,{icon:"solar:map-point-linear",testId:"event-details-location",children:i})]}),o&&t.jsxs("div",{className:"relative","data-testid":"event-details-description-wrapper",children:[t.jsxs("div",{className:"relative",children:[t.jsx("div",{ref:j,className:c.cn("text-sm text-gray-700 leading-relaxed transition-all",!x&&"line-clamp-3"),"data-testid":"event-details-description",dangerouslySetInnerHTML:{__html:o}}),!x&&y&&t.jsx("div",{className:"absolute inset-x-0 -bottom-1 h-8 bg-gradient-to-t from-white via-white/70 to-transparent pointer-events-none","data-testid":"event-details-description-fade"})]}),(y||x)&&t.jsx("div",{className:"flex justify-end mt-1",children:t.jsx(O,{onPress:()=>g(!x),variant:"light",className:c.cn("text-primary",m),size:"md",startContent:t.jsx(P,{icon:x?"solar:eye-closed-linear":"solar:eye-linear",width:20}),"data-testid":"event-details-toggle-description",children:x?p.showLess||"Hide":p.showMore||"Show"})})]})]})]})})}):t.jsxs(c.Card,{className:c.cn("border-0 shadow-none",e),"data-testid":"event-details-root",children:[t.jsxs(c.CardHeader,{className:c.cn("pt-2 pb-0 flex-col items-start",d?"space-y-1":"space-y-2"),"data-testid":"event-details-header",children:[l&&s&&t.jsx("div",{className:c.cn("w-full overflow-hidden rounded-xl","aspect-[3/1]"),"data-testid":"event-details-image-wrapper",children:t.jsx(c.Image,{removeWrapper:!0,loading:f,alt:`Event image for ${n}`,className:"w-full h-full object-cover object-center",src:s,"data-testid":"event-details-image"})}),t.jsx("h2",{className:c.cn("font-semibold text-gray-800",d?"text-base":"text-xl"),"data-testid":"event-details-title",children:n})]}),t.jsxs(c.CardBody,{className:c.cn("space-y-3",d?"py-1 space-y-2":"py-3"),"data-testid":"event-details-body",children:[t.jsx("h3",{className:c.cn("font-semibold text-base text-gray-700",d?"text-sm":""),"data-testid":"event-details-info-label",children:p.eventInformation}),t.jsxs("div",{className:"flex flex-wrap gap-4","data-testid":"event-details-info",children:[a&&t.jsx(vt,{icon:"solar:calendar-minimalistic-linear",testId:"event-details-date",children:a}),r&&t.jsx(vt,{icon:"solar:clock-circle-linear",testId:"event-details-time",children:r}),i&&t.jsx(vt,{icon:"solar:map-point-linear",testId:"event-details-location",children:i})]}),o&&t.jsxs("div",{className:"relative","data-testid":"event-details-description-wrapper",children:[t.jsxs("div",{className:"relative",children:[t.jsx("div",{ref:j,className:c.cn("text-sm text-gray-700 leading-relaxed transition-all",d?"text-xs":"",!x&&"line-clamp-3"),"data-testid":"event-details-description",dangerouslySetInnerHTML:{__html:o}}),!x&&y&&t.jsx("div",{className:"absolute inset-x-0 -bottom-1 h-8 bg-gradient-to-t from-white via-white/70 to-transparent pointer-events-none","data-testid":"event-details-description-fade"})]}),(y||x)&&t.jsx("div",{className:"flex justify-end mt-1",children:t.jsx(O,{onPress:()=>g(!x),variant:"light",className:c.cn("text-primary",m),size:d?"sm":"md",startContent:t.jsx(P,{icon:x?"solar:eye-closed-linear":"solar:eye-linear",width:d?16:20}),"data-testid":"event-details-toggle-description",children:x?p.showLess||"Hide":p.showMore||"Show"})})]})]})]})};function fs(e,n="en-US",s="USD"){try{return new Intl.NumberFormat(n,{style:"currency",currency:s,minimumFractionDigits:2,maximumFractionDigits:2}).format(e)}catch(a){return console.warn(`Invalid currency formatting: ${a}`),`${s} ${e.toFixed(2)}`}}function Wu(e){const n=e.replace(/[^\d.,-]/g,""),s=n.match(/,\d{1,2}$/);let a;s?a=n.replace(/\./g,"").replace(",","."):a=n.replace(/,/g,"");const r=parseFloat(a);return isNaN(r)?null:r}const qu={person:"Person",people:"People",tickets:"Tickets:",soldOut:"Sold Out",maxReached:"Maximum number of tickets allowed reached",ruleBlocked:"Unavailable for selected ticket options",disabled:"Ticket selection is unavailable"},jt=e=>typeof e=="number"&&!isNaN(e),hn=({offer:e,quantity:n,defaultQuantity:s=0,onQuantityChange:a,currency:r="USD",locale:i="en-US",labels:o,slots:l,isDisabled:d=!1,buttonVariant:u="bordered",buttonColor:f="default",showCard:m=!0,showDescription:p=!0,showPeopleCount:x=!0,showPrice:g=!0,priceDisplay:y,classNames:b={},"data-testid":j,selectedColor:w="default",selectionMode:$="stepper",compact:N=!1,isSoldOut:A,isMaxReached:k,isRuleBlocked:C,statusTone:D="default",statusLabel:S,disabledReason:_,disabled:F})=>{const L=h.useMemo(()=>({...qu,...o}),[o]),[M,I]=h.useState(s),W=n!==void 0?n:M,K=!!(d||F),z=N||!!e.compact,ne=$==="press-to-add",G=h.useMemo(()=>typeof A=="boolean"?A:typeof e.isSoldOut=="boolean"?e.isSoldOut:!jt(e.totalTicketsSold)||!jt(e.ticketsAllowed)?!1:e.totalTicketsSold>=e.ticketsAllowed,[A,e.isSoldOut,e.totalTicketsSold,e.ticketsAllowed]),se=h.useMemo(()=>typeof k=="boolean"?k:typeof e.isMaxReached=="boolean"?e.isMaxReached:G||!jt(e.ticketsAllowed)?!1:W>=e.ticketsAllowed-(e.totalTicketsSold??0),[k,e.isMaxReached,G,e.ticketsAllowed,e.totalTicketsSold,W]),Y=h.useMemo(()=>typeof C=="boolean"?C:typeof e.isRuleBlocked=="boolean"?e.isRuleBlocked:!1,[C,e.isRuleBlocked]),oe=_||e.disabledReason,J=K||G||Y,q=me=>{if(J||me>0&&se)return;const $e=Math.max(0,W+me);n===void 0&&I($e),a?.(e.id,$e)},re=h.useMemo(()=>{if(G)return"soldOut";if(Y)return"ruleBlocked";if(K)return"disabled"},[G,Y,K]),V=h.useMemo(()=>D||(G||Y?"danger":se?"warning":"default"),[D,G,Y,se]),ee=h.useMemo(()=>{if(re)return re==="ruleBlocked"?S||oe||L.ruleBlocked:re==="soldOut"?S||oe||L.soldOut:re==="disabled"?S||oe||L.disabled:S||L.maxReached},[re,S,oe,L]),te={soldOut:"danger",ruleBlocked:V,disabled:"default",maxReached:"warning"},Fe={soldOut:"offer-card-sold-out-chip",maxReached:"offer-card-max-reached-chip",ruleBlocked:"offer-card-ruleBlocked-chip",disabled:"offer-card-disabled-chip"},Z=()=>l?.renderName?l.renderName(e.name,e):t.jsx("h2",{"data-testid":"offer-card-name",className:c.cn("text-base font-medium",z&&"text-sm",b.name),children:e.name}),he=()=>{if(!g)return null;const me=y?.price??e.price,$e=y?.originalPrice,et=fs(me,i,r);if(l?.renderPrice)return l.renderPrice(me,et,e);if(jt($e)&&jt(me)&&$e>me){const E=fs($e,i,r);return t.jsxs("div",{"data-testid":"offer-card-price",className:c.cn("flex items-center gap-2 mt-1",z&&"mt-0.5",b.price),children:[t.jsxs("span",{className:"sr-only",children:["Original price ",E,", discounted price ",et]}),t.jsx("span",{"aria-hidden":"true","data-testid":"offer-card-original-price",className:c.cn("text-gray-400 line-through text-sm",z&&"text-xs",b.originalPrice),children:E}),t.jsx("span",{"aria-hidden":"true","data-testid":"offer-card-discounted-price",className:c.cn("text-primary text-base font-semibold",z&&"text-sm",b.discountedPrice),children:et})]})}return t.jsx("p",{"data-testid":"offer-card-price",className:c.cn("text-primary text-base mt-1",z&&"text-sm mt-0.5",b.price),children:et})},Je=()=>!p||!e.description?null:l?.renderDescription?l.renderDescription(e.description,e):t.jsx("p",{"data-testid":"offer-card-description",className:c.cn("mb-4 text-sm text-gray-700 leading-relaxed",z&&"mb-2 text-xs text-gray-600",b.description),children:e.description}),We=()=>{if(!x||!jt(e.numberOfPeople)||e.numberOfPeople<=0)return null;const me=e.numberOfPeople===1?L.person:L.people;return l?.renderPeopleCount?l.renderPeopleCount(e.numberOfPeople,me,e):t.jsxs("p",{"data-testid":"offer-card-people-count",className:c.cn("text-sm text-gray-600 flex items-center mt-2",z&&"mt-1 text-xs",b.peopleCount),children:[t.jsx(P,{icon:e.numberOfPeople<=1?"solar:user-rounded-outline":"solar:users-group-rounded-outline",width:20,className:"mr-1"}),e.numberOfPeople," ",me]})},ve=()=>{const me=W===0||J,$e=se||J;return l?.renderQuantitySelector?l.renderQuantitySelector({quantity:W,onIncrement:()=>q(1),onDecrement:()=>q(-1),isDecrementDisabled:me,isIncrementDisabled:$e,isDisabled:J}):t.jsxs("div",{className:c.cn("flex items-center gap-2",b.quantitySelector),children:[t.jsx(O,{"data-testid":"offer-card-decrement-button",onPress:()=>q(-1),isDisabled:me,variant:u,color:W>0?w:f,radius:"full",isIconOnly:!0,size:z?"md":"sm","aria-label":"Decrease quantity",children:t.jsx(P,{icon:"gravity-ui:minus",width:16})}),t.jsx("span",{"data-testid":"offer-card-quantity",className:c.cn("min-w-[2rem] text-center font-medium",z&&"text-sm"),children:W}),t.jsx(O,{"data-testid":"offer-card-increment-button",onPress:()=>q(1),isDisabled:$e,variant:u,color:W>0?w:f,radius:"full",isIconOnly:!0,size:z?"md":"sm","aria-label":"Increase quantity",children:t.jsx(P,{icon:"gravity-ui:plus",width:16})})]})},qe=(me,$e)=>l?.renderDisabledState?l.renderDisabledState(me,$e):me==="soldOut"&&l?.renderSoldOut?l.renderSoldOut($e):me==="maxReached"&&l?.renderMaxReachedAlert?l.renderMaxReachedAlert($e):t.jsx(c.Chip,{"data-testid":Fe[me],color:te[me],variant:me==="maxReached"?"flat":"solid",className:c.cn("gap-2 px-4",me==="maxReached"?"h-8":"h-10",me==="soldOut"&&b.soldOut,me==="maxReached"&&b.maxReachedAlert,z&&"h-8"),startContent:t.jsx(P,{icon:"gravity-ui:triangle-exclamation-fill",width:14}),children:t.jsx("span",{className:"font-medium text-sm",children:$e})}),ot=t.jsxs("div",{className:c.cn("grid grid-cols-1 md:grid-cols-1 xl:grid-cols-3 lg:grid-cols-3 items-start",z?"gap-1":"gap-2"),children:[t.jsxs("div",{className:c.cn("h-full col-span-2",J||se?"opacity-50 pointer-events-none select-none":""),children:[Z(),he(),t.jsxs("div",{className:c.cn("md:col-span-1 xl:col-span-2 lg:col-span-1",z?"mb-1":"mb-2"),children:[We(),Je()]})]}),!ne&&t.jsx("div",{className:c.cn("space-x-2 pt-0 pb-2 md:p-2 h-full flex items-center justify-start md:justify-start lg:justify-end",z&&"space-x-1 pb-1 md:p-1",b.compactFooter),children:re&&ee?qe(re,ee):ve()})]}),Ge=se&&!G&&!Y&&!K?t.jsx(Te.motion.div,{className:c.cn("w-full sm:max-w-[60%] md:max-w-[60%] lg:max-w-[60%]",b.compactFooter),initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:10},transition:{duration:.3},children:qe("maxReached",ee||L.maxReached)}):null;return m?t.jsxs(c.Card,{className:c.cn("w-full",ne&&!J&&!se&&"cursor-pointer",z&&b.compact,b.base),"data-testid":j||`offer-card-${e.id}`,isPressable:ne&&!J&&!se,onPress:ne&&!J&&!se?()=>q(1):void 0,children:[t.jsx(c.CardBody,{className:c.cn("pt-1 pb-0",z?"pb-0.5":"",b.body),children:ot}),t.jsx(Te.AnimatePresence,{children:Ge&&t.jsx(c.CardFooter,{className:c.cn("w-full mt-0 pt-0",z?"pt-1":"",b.footer),children:Ge})})]}):t.jsxs("div",{className:c.cn("w-full",z&&b.compact,b.base),"data-testid":j||`offer-card-${e.id}`,children:[t.jsx("div",{className:c.cn("pt-1 pb-0",z?"pb-0.5":"",b.body),children:ot}),t.jsx(Te.AnimatePresence,{children:Ge&&t.jsx("div",{className:c.cn("w-full mt-0 pt-0",z?"pt-1":"",b.footer),children:Ge})})]})};hn.displayName="OfferCard";const Ci=({message:e="No offers available.",icon:n="solar:ticket-sale-outline",iconSize:s=48,showCard:a=!0,classNames:r={},renderEmpty:i})=>{if(i){const l=i();return a?t.jsx(c.Card,{"data-testid":"offer-card-empty",className:c.cn("w-full",r.base),children:t.jsx(c.CardBody,{"data-testid":"offer-card-empty-body",children:l})}):t.jsx("div",{"data-testid":"offer-card-empty",className:c.cn("w-full",r.base),children:l})}const o=t.jsxs("div",{"data-testid":"offer-card-empty-content",className:c.cn("flex flex-col items-center justify-center p-8 text-center text-gray-500",r.content),children:[t.jsx(P,{"data-testid":"offer-card-empty-icon",icon:n,width:s,className:c.cn("mb-4",r.icon)}),t.jsx("h3",{"data-testid":"offer-card-empty-message",className:c.cn("text-lg",r.message),children:e})]});return a?t.jsx(c.Card,{"data-testid":"offer-card-empty",className:c.cn("w-full",r.base),children:t.jsx(c.CardBody,{"data-testid":"offer-card-empty-body",children:o})}):t.jsx("div",{"data-testid":"offer-card-empty",className:c.cn("w-full",r.base),children:o})};Ci.displayName="OfferCardEmpty";const Gu={title:"Error Fetching Offers",description:"An error occurred while fetching offers."},ki=({error:e,labels:n,showCard:s=!0,color:a="danger",classNames:r={}})=>{const i={...Gu,...n},o=t.jsx(c.Alert,{"data-testid":"offer-card-error-alert",color:a,title:i.title,description:e||i.description,className:r.alert});return s?t.jsx(c.Card,{"data-testid":"offer-card-error",className:c.cn("w-full",r.base),children:t.jsx(c.CardBody,{"data-testid":"offer-card-error-body",children:o})}):t.jsx("div",{"data-testid":"offer-card-error",className:c.cn("w-full",r.base),children:o})};ki.displayName="OfferCardError";const Ku={1:"space-y-1",2:"space-y-2",3:"space-y-3",4:"space-y-4",5:"space-y-5",6:"space-y-6"},Si=({quantity:e=2,gap:n=4,classNames:s={}})=>{const a=Ku[n];return t.jsx("div",{"data-testid":"offer-card-skeleton-container",className:c.cn(a,s.base),children:Array.from({length:e}).map((r,i)=>t.jsxs(c.Card,{"data-testid":`offer-card-skeleton-${i}`,className:c.cn("w-full",s.card),children:[t.jsx(c.CardHeader,{"data-testid":`offer-card-skeleton-header-${i}`,className:"flex justify-between items-start pb-0",children:t.jsxs("div",{className:"space-y-2 w-full",children:[t.jsx(c.Skeleton,{"data-testid":`offer-card-skeleton-title-${i}`,className:"w-1/3 rounded-lg",children:t.jsx("div",{className:"h-4 bg-default-200 rounded-lg"})}),t.jsx(c.Skeleton,{"data-testid":`offer-card-skeleton-subtitle-${i}`,className:"w-1/4 rounded-lg",children:t.jsx("div",{className:"h-3 bg-default-300 rounded-lg"})})]})}),t.jsx(c.CardBody,{"data-testid":`offer-card-skeleton-body-${i}`,className:"pt-2 pb-0",children:t.jsxs("div",{className:"grid grid-cols-1 xl:grid-cols-3 gap-2 items-start",children:[t.jsxs("div",{className:"xl:col-span-2 space-y-2",children:[t.jsx(c.Skeleton,{"data-testid":`offer-card-skeleton-people-${i}`,className:"w-1/4 rounded-lg",children:t.jsx("div",{className:"h-4 bg-default-300 rounded-lg"})}),t.jsx(c.Skeleton,{"data-testid":`offer-card-skeleton-description-${i}`,className:"w-3/4 rounded-lg",children:t.jsx("div",{className:"h-4 bg-default-200 rounded-lg"})})]}),t.jsx("div",{className:"flex items-start justify-end",children:t.jsxs("div",{"data-testid":`offer-card-skeleton-controls-${i}`,className:"flex items-center justify-end gap-2 w-full px-4 py-2",children:[t.jsx(c.Skeleton,{"data-testid":`offer-card-skeleton-label-${i}`,className:"w-24 h-4 rounded-md bg-default-200"}),t.jsxs("div",{className:"flex gap-2",children:[t.jsx(c.Skeleton,{"data-testid":`offer-card-skeleton-btn-dec-${i}`,className:"w-8 h-8 rounded-md bg-default-300"}),t.jsx(c.Skeleton,{"data-testid":`offer-card-skeleton-btn-qty-${i}`,className:"w-8 h-8 rounded-md bg-default-200"}),t.jsx(c.Skeleton,{"data-testid":`offer-card-skeleton-btn-inc-${i}`,className:"w-8 h-8 rounded-md bg-default-300"})]})]})})]})})]},i))})};Si.displayName="OfferCardSkeleton";const $i={hidden:{opacity:0},show:{opacity:1,transition:{staggerChildren:.15,delayChildren:.1}}},Ai={hidden:{opacity:0,y:8},show:{opacity:1,y:0,transition:{duration:.45,ease:"easeOut"}},exit:{opacity:0,y:-5,transition:{duration:.35,ease:"easeIn"}}},Yu={1:"gap-1",2:"gap-2",3:"gap-3",4:"gap-4",5:"gap-5",6:"gap-6"},Di=({offers:e=[],mapOffer:n,selection:s,defaultSelection:a={},onSelectionChange:r,onQuantityChange:i,currency:o="USD",locale:l="en-US",labels:d,slots:u,isDisabled:f=!1,buttonVariant:m="bordered",buttonColor:p="default",showCard:x=!0,animated:g=!0,gap:y=2,compact:b=!1,classNames:j={}})=>{const[w,$]=h.useState(a),N=s!==void 0?s:w,A=h.useCallback((F,L)=>{const M={...N,[F]:Math.max(0,L)};s===void 0&&$(M),r?.(M),i?.(F,M[F])},[N,s,r,i]),k=[...e].sort((F,L)=>(F.position??0)-(L.position??0)),C=F=>{const L=n?n(F):F,M=(N??{})[L.id]||0;return{offer:L,quantity:M,onQuantityChange:A,currency:o,locale:l,labels:d,slots:u,isDisabled:f,buttonVariant:m,buttonColor:p,showCard:x,compact:b}},D=Yu[y],S=c.cn("grid mx-auto pt-2",D,j.base),_=F=>{const L=C(F);return t.jsx(hn,{offer:L.offer,quantity:L.quantity,onQuantityChange:L.onQuantityChange,currency:L.currency,locale:L.locale,labels:L.labels,slots:L.slots,isDisabled:L.isDisabled,buttonVariant:L.buttonVariant,buttonColor:L.buttonColor,showCard:L.showCard,compact:L.compact,classNames:j.card},L.offer.id)};return g?t.jsx(Te.motion.div,{"data-testid":"offer-card-list",className:S,variants:$i,initial:"hidden",animate:"show",children:t.jsx(Te.AnimatePresence,{children:k.map(F=>{const L=C(F);return t.jsx(Te.motion.div,{"data-testid":`offer-card-list-item-${L.offer.id}`,className:j.cardWrapper,variants:Ai,exit:{opacity:0,y:-20},transition:{duration:.3},children:t.jsx(hn,{offer:L.offer,quantity:L.quantity,onQuantityChange:A,currency:o,locale:l,labels:d,slots:u,isDisabled:f,buttonVariant:m,buttonColor:p,showCard:x,compact:b||L.offer.compact,classNames:j.card})},L.offer.id)})})}):t.jsx("div",{"data-testid":"offer-card-list",className:S,children:k.map(_)})};Di.displayName="OfferCardList";var Zt=e=>e.type==="checkbox",bt=e=>e instanceof Date,Oe=e=>e==null;const Ei=e=>typeof e=="object";var ke=e=>!Oe(e)&&!Array.isArray(e)&&Ei(e)&&!bt(e),Li=e=>ke(e)&&e.target?Zt(e.target)?e.target.checked:e.target.value:e,Qu=e=>e.substring(0,e.search(/\.\d+(\.|$)/))||e,Fi=(e,n)=>e.has(Qu(n)),Zu=e=>{const n=e.constructor&&e.constructor.prototype;return ke(n)&&n.hasOwnProperty("isPrototypeOf")},Ms=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function we(e){if(e instanceof Date)return new Date(e);const n=typeof FileList<"u"&&e instanceof FileList;if(Ms&&(e instanceof Blob||n))return e;const s=Array.isArray(e);if(!s&&!(ke(e)&&Zu(e)))return e;const a=s?[]:Object.create(Object.getPrototypeOf(e));for(const r in e)Object.prototype.hasOwnProperty.call(e,r)&&(a[r]=we(e[r]));return a}var Dn=e=>/^\w*$/.test(e),be=e=>e===void 0,Ps=e=>Array.isArray(e)?e.filter(Boolean):[],Ts=e=>Ps(e.replace(/["|']|\]/g,"").split(/\.|\[/)),H=(e,n,s)=>{if(!n||!ke(e))return s;const a=(Dn(n)?[n]:Ts(n)).reduce((r,i)=>Oe(r)?r:r[i],e);return be(a)||a===e?be(e[n])?s:e[n]:a},Ve=e=>typeof e=="boolean",Pe=e=>typeof e=="function",xe=(e,n,s)=>{let a=-1;const r=Dn(n)?[n]:Ts(n),i=r.length,o=i-1;for(;++a<i;){const l=r[a];let d=s;if(a!==o){const u=e[l];d=ke(u)||Array.isArray(u)?u:isNaN(+r[a+1])?{}:[]}if(l==="__proto__"||l==="constructor"||l==="prototype")return;e[l]=d,e=e[l]}};const bn={BLUR:"blur",FOCUS_OUT:"focusout",CHANGE:"change"},Qe={onBlur:"onBlur",onChange:"onChange",onSubmit:"onSubmit",onTouched:"onTouched",all:"all"},st={max:"max",min:"min",maxLength:"maxLength",minLength:"minLength",pattern:"pattern",required:"required",validate:"validate"},Ri=h.createContext(null);Ri.displayName="HookFormControlContext";const Is=()=>h.useContext(Ri);var _i=(e,n,s,a=!0)=>{const r={defaultValues:n._defaultValues};for(const i in e)Object.defineProperty(r,i,{get:()=>{const o=i;return n._proxyFormState[o]!==Qe.all&&(n._proxyFormState[o]=!a||Qe.all),s&&(s[o]=!0),e[o]}});return r};const Os=typeof window<"u"?h.useLayoutEffect:h.useEffect;function Xu(e){const n=Is(),{control:s=n,disabled:a,name:r,exact:i}=e||{},[o,l]=h.useState(s._formState),d=h.useRef({isDirty:!1,isLoading:!1,dirtyFields:!1,touchedFields:!1,validatingFields:!1,isValidating:!1,isValid:!1,errors:!1});return Os(()=>s._subscribe({name:r,formState:d.current,exact:i,callback:u=>{!a&&l({...s._formState,...u})}}),[r,a,i]),h.useEffect(()=>{d.current.isValid&&s._setValid(!0)},[s]),h.useMemo(()=>_i(o,s,d.current,!1),[o,s])}var Ue=e=>typeof e=="string",xs=(e,n,s,a,r)=>Ue(e)?(a&&n.watch.add(e),H(s,e,r)):Array.isArray(e)?e.map(i=>(a&&n.watch.add(i),H(s,i))):(a&&(n.watchAll=!0),s),ps=e=>Oe(e)||!Ei(e);function Ze(e,n,s=new WeakSet){if(ps(e)||ps(n))return Object.is(e,n);if(bt(e)&&bt(n))return Object.is(e.getTime(),n.getTime());const a=Object.keys(e),r=Object.keys(n);if(a.length!==r.length)return!1;if(s.has(e)||s.has(n))return!0;s.add(e),s.add(n);for(const i of a){const o=e[i];if(!r.includes(i))return!1;if(i!=="ref"){const l=n[i];if(bt(o)&&bt(l)||ke(o)&&ke(l)||Array.isArray(o)&&Array.isArray(l)?!Ze(o,l,s):!Object.is(o,l))return!1}}return!0}function Ju(e){const n=Is(),{control:s=n,name:a,defaultValue:r,disabled:i,exact:o,compute:l}=e||{},d=h.useRef(r),u=h.useRef(l),f=h.useRef(void 0),m=h.useRef(s),p=h.useRef(a);u.current=l;const[x,g]=h.useState(()=>{const N=s._getWatch(a,d.current);return u.current?u.current(N):N}),y=h.useCallback(N=>{const A=xs(a,s._names,N||s._formValues,!1,d.current);return u.current?u.current(A):A},[s._formValues,s._names,a]),b=h.useCallback(N=>{if(!i){const A=xs(a,s._names,N||s._formValues,!1,d.current);if(u.current){const k=u.current(A);Ze(k,f.current)||(g(k),f.current=k)}else g(A)}},[s._formValues,s._names,i,a]);Os(()=>((m.current!==s||!Ze(p.current,a))&&(m.current=s,p.current=a,b()),s._subscribe({name:a,formState:{values:!0},exact:o,callback:N=>{b(N.values)}})),[s,o,a,b]),h.useEffect(()=>s._removeUnmounted());const j=m.current!==s,w=p.current,$=h.useMemo(()=>{if(i)return null;const N=!j&&!Ze(w,a);return j||N?y():null},[i,j,a,w,y]);return $!==null?$:x}function em(e){const n=Is(),{name:s,disabled:a,control:r=n,shouldUnregister:i,defaultValue:o,exact:l=!0}=e,d=Fi(r._names.array,s),u=h.useMemo(()=>H(r._formValues,s,H(r._defaultValues,s,o)),[r,s,o]),f=Ju({control:r,name:s,defaultValue:u,exact:l}),m=Xu({control:r,name:s,exact:l}),p=h.useRef(e),x=h.useRef(void 0),g=h.useRef(r.register(s,{...e.rules,value:f,...Ve(e.disabled)?{disabled:e.disabled}:{}}));p.current=e;const y=h.useMemo(()=>Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!H(m.errors,s)},isDirty:{enumerable:!0,get:()=>!!H(m.dirtyFields,s)},isTouched:{enumerable:!0,get:()=>!!H(m.touchedFields,s)},isValidating:{enumerable:!0,get:()=>!!H(m.validatingFields,s)},error:{enumerable:!0,get:()=>H(m.errors,s)}}),[m,s]),b=h.useCallback(N=>g.current.onChange({target:{value:Li(N),name:s},type:bn.CHANGE}),[s]),j=h.useCallback(()=>g.current.onBlur({target:{value:H(r._formValues,s),name:s},type:bn.BLUR}),[s,r._formValues]),w=h.useCallback(N=>{const A=H(r._fields,s);A&&A._f&&N&&(A._f.ref={focus:()=>Pe(N.focus)&&N.focus(),select:()=>Pe(N.select)&&N.select(),setCustomValidity:k=>Pe(N.setCustomValidity)&&N.setCustomValidity(k),reportValidity:()=>Pe(N.reportValidity)&&N.reportValidity()})},[r._fields,s]),$=h.useMemo(()=>({name:s,value:f,...Ve(a)||m.disabled?{disabled:m.disabled||a}:{},onChange:b,onBlur:j,ref:w}),[s,a,m.disabled,b,j,w,f]);return h.useEffect(()=>{const N=r._options.shouldUnregister||i,A=x.current;A&&A!==s&&!d&&r.unregister(A),r.register(s,{...p.current.rules,...Ve(p.current.disabled)?{disabled:p.current.disabled}:{}});const k=(C,D)=>{const S=H(r._fields,C);S&&S._f&&(S._f.mount=D)};if(k(s,!0),N){const C=we(H(r._options.defaultValues,s,p.current.defaultValue));xe(r._defaultValues,s,C),be(H(r._formValues,s))&&xe(r._formValues,s,C)}return!d&&r.register(s),x.current=s,()=>{(d?N&&!r._state.action:N)?r.unregister(s):k(s,!1)}},[s,r,d,i]),h.useEffect(()=>{r._setDisabledField({disabled:a,name:s})},[a,s,r]),h.useMemo(()=>({field:$,formState:m,fieldState:y}),[$,m,y])}const tm=h.createContext(null);tm.displayName="HookFormContext";var nm=(e,n,s,a,r)=>n?{...s[e],types:{...s[e]&&s[e].types?s[e].types:{},[a]:r||!0}}:{},Ht=e=>Array.isArray(e)?e:[e],Ta=()=>{let e=[];return{get observers(){return e},next:r=>{for(const i of e)i.next&&i.next(r)},subscribe:r=>(e.push(r),{unsubscribe:()=>{e=e.filter(i=>i!==r)}}),unsubscribe:()=>{e=[]}}};function Mi(e,n){const s={};for(const a in e)if(e.hasOwnProperty(a)){const r=e[a],i=n[a];if(r&&ke(r)&&i){const o=Mi(r,i);ke(o)&&(s[a]=o)}else e[a]&&(s[a]=i)}return s}var Me=e=>ke(e)&&!Object.keys(e).length,zs=e=>e.type==="file",gn=e=>{if(!Ms)return!1;const n=e?e.ownerDocument:0;return e instanceof(n&&n.defaultView?n.defaultView.HTMLElement:HTMLElement)},Pi=e=>e.type==="select-multiple",Bs=e=>e.type==="radio",sm=e=>Bs(e)||Zt(e),qn=e=>gn(e)&&e.isConnected;function am(e,n){const s=n.slice(0,-1).length;let a=0;for(;a<s;)e=be(e)?a++:e[n[a++]];return e}function rm(e){for(const n in e)if(e.hasOwnProperty(n)&&!be(e[n]))return!1;return!0}function Ne(e,n){const s=Array.isArray(n)?n:Dn(n)?[n]:Ts(n),a=s.length===1?e:am(e,s),r=s.length-1,i=s[r];return a&&delete a[i],r!==0&&(ke(a)&&Me(a)||Array.isArray(a)&&rm(a))&&Ne(e,s.slice(0,-1)),e}var im=e=>{for(const n in e)if(Pe(e[n]))return!0;return!1};function Ti(e){return Array.isArray(e)||ke(e)&&!im(e)}function hs(e,n={}){for(const s in e){const a=e[s];Ti(a)?(n[s]=Array.isArray(a)?[]:{},hs(a,n[s])):be(a)||(n[s]=!0)}return n}function St(e,n,s){s||(s=hs(n));for(const a in e){const r=e[a];if(Ti(r))be(n)||ps(s[a])?s[a]=hs(r,Array.isArray(r)?[]:{}):St(r,Oe(n)?{}:n[a],s[a]);else{const i=n[a];s[a]=!Ze(r,i)}}return s}const Ia={value:!1,isValid:!1},Oa={value:!0,isValid:!0};var Ii=e=>{if(Array.isArray(e)){if(e.length>1){const n=e.filter(s=>s&&s.checked&&!s.disabled).map(s=>s.value);return{value:n,isValid:!!n.length}}return e[0].checked&&!e[0].disabled?e[0].attributes&&!be(e[0].attributes.value)?be(e[0].value)||e[0].value===""?Oa:{value:e[0].value,isValid:!0}:Oa:Ia}return Ia},Oi=(e,{valueAsNumber:n,valueAsDate:s,setValueAs:a})=>be(e)?e:n?e===""?NaN:e&&+e:s&&Ue(e)?new Date(e):a?a(e):e;const za={isValid:!1,value:null};var zi=e=>Array.isArray(e)?e.reduce((n,s)=>s&&s.checked&&!s.disabled?{isValid:!0,value:s.value}:n,za):za;function Ba(e){const n=e.ref;return zs(n)?n.files:Bs(n)?zi(e.refs).value:Pi(n)?[...n.selectedOptions].map(({value:s})=>s):Zt(n)?Ii(e.refs).value:Oi(be(n.value)?e.ref.value:n.value,e)}var lm=(e,n,s,a)=>{const r={};for(const i of e){const o=H(n,i);o&&xe(r,i,o._f)}return{criteriaMode:s,names:[...e],fields:r,shouldUseNativeValidation:a}},yn=e=>e instanceof RegExp,Pt=e=>be(e)?e:yn(e)?e.source:ke(e)?yn(e.value)?e.value.source:e.value:e,Va=e=>({isOnSubmit:!e||e===Qe.onSubmit,isOnBlur:e===Qe.onBlur,isOnChange:e===Qe.onChange,isOnAll:e===Qe.all,isOnTouch:e===Qe.onTouched});const Ua="AsyncFunction";var om=e=>!!e&&!!e.validate&&!!(Pe(e.validate)&&e.validate.constructor.name===Ua||ke(e.validate)&&Object.values(e.validate).find(n=>n.constructor.name===Ua)),cm=e=>e.mount&&(e.required||e.min||e.max||e.maxLength||e.minLength||e.pattern||e.validate),Ha=(e,n,s)=>!s&&(n.watchAll||n.watch.has(e)||[...n.watch].some(a=>e.startsWith(a)&&/^\.\w+/.test(e.slice(a.length))));const Wt=(e,n,s,a)=>{for(const r of s||Object.keys(e)){const i=H(e,r);if(i){const{_f:o,...l}=i;if(o){if(o.refs&&o.refs[0]&&n(o.refs[0],r)&&!a)return!0;if(o.ref&&n(o.ref,o.name)&&!a)return!0;if(Wt(l,n))break}else if(ke(l)&&Wt(l,n))break}}};function Wa(e,n,s){const a=H(e,s);if(a||Dn(s))return{error:a,name:s};const r=s.split(".");for(;r.length;){const i=r.join("."),o=H(n,i),l=H(e,i);if(o&&!Array.isArray(o)&&s!==i)return{name:s};if(l&&l.type)return{name:i,error:l};if(l&&l.root&&l.root.type)return{name:`${i}.root`,error:l.root};r.pop()}return{name:s}}var dm=(e,n,s,a)=>{s(e);const{name:r,...i}=e;return Me(i)||Object.keys(i).length>=Object.keys(n).length||Object.keys(i).find(o=>n[o]===(!a||Qe.all))},um=(e,n,s)=>!e||!n||e===n||Ht(e).some(a=>a&&(s?a===n:a.startsWith(n)||n.startsWith(a))),mm=(e,n,s,a,r)=>r.isOnAll?!1:!s&&r.isOnTouch?!(n||e):(s?a.isOnBlur:r.isOnBlur)?!e:(s?a.isOnChange:r.isOnChange)?e:!0,fm=(e,n)=>!Ps(H(e,n)).length&&Ne(e,n),xm=(e,n,s)=>{const a=Ht(H(e,s));return xe(a,"root",n[s]),xe(e,s,a),e};function qa(e,n,s="validate"){if(Ue(e)||Array.isArray(e)&&e.every(Ue)||Ve(e)&&!e)return{type:s,message:Ue(e)?e:"",ref:n}}var wt=e=>ke(e)&&!yn(e)?e:{value:e,message:""},Ga=async(e,n,s,a,r,i)=>{const{ref:o,refs:l,required:d,maxLength:u,minLength:f,min:m,max:p,pattern:x,validate:g,name:y,valueAsNumber:b,mount:j}=e._f,w=H(s,y);if(!j||n.has(y))return{};const $=l?l[0]:o,N=L=>{r&&$.reportValidity&&($.setCustomValidity(Ve(L)?"":L||""),$.reportValidity())},A={},k=Bs(o),C=Zt(o),D=k||C,S=(b||zs(o))&&be(o.value)&&be(w)||gn(o)&&o.value===""||w===""||Array.isArray(w)&&!w.length,_=nm.bind(null,y,a,A),F=(L,M,I,W=st.maxLength,K=st.minLength)=>{const z=L?M:I;A[y]={type:L?W:K,message:z,ref:o,..._(L?W:K,z)}};if(i?!Array.isArray(w)||!w.length:d&&(!D&&(S||Oe(w))||Ve(w)&&!w||C&&!Ii(l).isValid||k&&!zi(l).isValid)){const{value:L,message:M}=Ue(d)?{value:!!d,message:d}:wt(d);if(L&&(A[y]={type:st.required,message:M,ref:$,..._(st.required,M)},!a))return N(M),A}if(!S&&(!Oe(m)||!Oe(p))){let L,M;const I=wt(p),W=wt(m);if(!Oe(w)&&!isNaN(w)){const K=o.valueAsNumber||w&&+w;Oe(I.value)||(L=K>I.value),Oe(W.value)||(M=K<W.value)}else{const K=o.valueAsDate||new Date(w),z=se=>new Date(new Date().toDateString()+" "+se),ne=o.type=="time",G=o.type=="week";Ue(I.value)&&w&&(L=ne?z(w)>z(I.value):G?w>I.value:K>new Date(I.value)),Ue(W.value)&&w&&(M=ne?z(w)<z(W.value):G?w<W.value:K<new Date(W.value))}if((L||M)&&(F(!!L,I.message,W.message,st.max,st.min),!a))return N(A[y].message),A}if((u||f)&&!S&&(Ue(w)||i&&Array.isArray(w))){const L=wt(u),M=wt(f),I=!Oe(L.value)&&w.length>+L.value,W=!Oe(M.value)&&w.length<+M.value;if((I||W)&&(F(I,L.message,M.message),!a))return N(A[y].message),A}if(x&&!S&&Ue(w)){const{value:L,message:M}=wt(x);if(yn(L)&&!w.match(L)&&(A[y]={type:st.pattern,message:M,ref:o,..._(st.pattern,M)},!a))return N(M),A}if(g){if(Pe(g)){const L=await g(w,s),M=qa(L,$);if(M&&(A[y]={...M,..._(st.validate,M.message)},!a))return N(M.message),A}else if(ke(g)){let L={};for(const M in g){if(!Me(L)&&!a)break;const I=qa(await g[M](w,s),$,M);I&&(L={...I,..._(M,I.message)},N(I.message),a&&(A[y]=L))}if(!Me(L)&&(A[y]={ref:$,...L},!a))return A}}return N(!0),A};const pm={mode:Qe.onSubmit,reValidateMode:Qe.onChange,shouldFocusError:!0};function hm(e={}){let n={...pm,...e},s={submitCount:0,isDirty:!1,isReady:!1,isLoading:Pe(n.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{},errors:n.errors||{},disabled:n.disabled||!1},a={},r=ke(n.defaultValues)||ke(n.values)?we(n.defaultValues||n.values)||{}:{},i=n.shouldUnregister?{}:we(r),o={action:!1,mount:!1,watch:!1,keepIsValid:!1},l={mount:new Set,disabled:new Set,unMount:new Set,array:new Set,watch:new Set},d,u=0;const f={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1},m={...f};let p={...m};const x={array:Ta(),state:Ta()},g=n.criteriaMode===Qe.all,y=v=>E=>{clearTimeout(u),u=setTimeout(v,E)},b=async v=>{if(!o.keepIsValid&&!n.disabled&&(m.isValid||p.isValid||v)){let E;n.resolver?(E=Me((await D()).errors),j()):E=await _(a,!0),E!==s.isValid&&x.state.next({isValid:E})}},j=(v,E)=>{!n.disabled&&(m.isValidating||m.validatingFields||p.isValidating||p.validatingFields)&&((v||Array.from(l.mount)).forEach(R=>{R&&(E?xe(s.validatingFields,R,E):Ne(s.validatingFields,R))}),x.state.next({validatingFields:s.validatingFields,isValidating:!Me(s.validatingFields)}))},w=(v,E=[],R,U,B=!0,T=!0)=>{if(U&&R&&!n.disabled){if(o.action=!0,T&&Array.isArray(H(a,v))){const Q=R(H(a,v),U.argA,U.argB);B&&xe(a,v,Q)}if(T&&Array.isArray(H(s.errors,v))){const Q=R(H(s.errors,v),U.argA,U.argB);B&&xe(s.errors,v,Q),fm(s.errors,v)}if((m.touchedFields||p.touchedFields)&&T&&Array.isArray(H(s.touchedFields,v))){const Q=R(H(s.touchedFields,v),U.argA,U.argB);B&&xe(s.touchedFields,v,Q)}(m.dirtyFields||p.dirtyFields)&&(s.dirtyFields=St(r,i)),x.state.next({name:v,isDirty:L(v,E),dirtyFields:s.dirtyFields,errors:s.errors,isValid:s.isValid})}else xe(i,v,E)},$=(v,E)=>{xe(s.errors,v,E),x.state.next({errors:s.errors})},N=v=>{s.errors=v,x.state.next({errors:s.errors,isValid:!1})},A=(v,E,R,U)=>{const B=H(a,v);if(B){const T=H(i,v,be(R)?H(r,v):R);be(T)||U&&U.defaultChecked||E?xe(i,v,E?T:Ba(B._f)):W(v,T),o.mount&&!o.action&&b()}},k=(v,E,R,U,B)=>{let T=!1,Q=!1;const de={name:v};if(!n.disabled){if(!R||U){(m.isDirty||p.isDirty)&&(Q=s.isDirty,s.isDirty=de.isDirty=L(),T=Q!==de.isDirty);const ue=Ze(H(r,v),E);Q=!!H(s.dirtyFields,v),ue?Ne(s.dirtyFields,v):xe(s.dirtyFields,v,!0),de.dirtyFields=s.dirtyFields,T=T||(m.dirtyFields||p.dirtyFields)&&Q!==!ue}if(R){const ue=H(s.touchedFields,v);ue||(xe(s.touchedFields,v,R),de.touchedFields=s.touchedFields,T=T||(m.touchedFields||p.touchedFields)&&ue!==R)}T&&B&&x.state.next(de)}return T?de:{}},C=(v,E,R,U)=>{const B=H(s.errors,v),T=(m.isValid||p.isValid)&&Ve(E)&&s.isValid!==E;if(n.delayError&&R?(d=y(()=>$(v,R)),d(n.delayError)):(clearTimeout(u),d=null,R?xe(s.errors,v,R):Ne(s.errors,v)),(R?!Ze(B,R):B)||!Me(U)||T){const Q={...U,...T&&Ve(E)?{isValid:E}:{},errors:s.errors,name:v};s={...s,...Q},x.state.next(Q)}},D=async v=>(j(v,!0),await n.resolver(i,n.context,lm(v||l.mount,a,n.criteriaMode,n.shouldUseNativeValidation))),S=async v=>{const{errors:E}=await D(v);if(j(v),v)for(const R of v){const U=H(E,R);U?xe(s.errors,R,U):Ne(s.errors,R)}else s.errors=E;return E},_=async(v,E,R={valid:!0})=>{for(const U in v){const B=v[U];if(B){const{_f:T,...Q}=B;if(T){const de=l.array.has(T.name),ue=B._f&&om(B._f);ue&&m.validatingFields&&j([T.name],!0);const Re=await Ga(B,l.disabled,i,g,n.shouldUseNativeValidation&&!E,de);if(ue&&m.validatingFields&&j([T.name]),Re[T.name]&&(R.valid=!1,E||e.shouldUseNativeValidation))break;!E&&(H(Re,T.name)?de?xm(s.errors,Re,T.name):xe(s.errors,T.name,Re[T.name]):Ne(s.errors,T.name))}!Me(Q)&&await _(Q,E,R)}}return R.valid},F=()=>{for(const v of l.unMount){const E=H(a,v);E&&(E._f.refs?E._f.refs.every(R=>!qn(R)):!qn(E._f.ref))&&te(v)}l.unMount=new Set},L=(v,E)=>!n.disabled&&(v&&E&&xe(i,v,E),!Ze(Y(),r)),M=(v,E,R)=>xs(v,l,{...o.mount?i:be(E)?r:Ue(v)?{[v]:E}:E},R,E),I=v=>Ps(H(o.mount?i:r,v,n.shouldUnregister?H(r,v,[]):[])),W=(v,E,R={})=>{const U=H(a,v);let B=E;if(U){const T=U._f;T&&(!T.disabled&&xe(i,v,Oi(E,T)),B=gn(T.ref)&&Oe(E)?"":E,Pi(T.ref)?[...T.ref.options].forEach(Q=>Q.selected=B.includes(Q.value)):T.refs?Zt(T.ref)?T.refs.forEach(Q=>{(!Q.defaultChecked||!Q.disabled)&&(Array.isArray(B)?Q.checked=!!B.find(de=>de===Q.value):Q.checked=B===Q.value||!!B)}):T.refs.forEach(Q=>Q.checked=Q.value===B):zs(T.ref)?T.ref.value="":(T.ref.value=B,T.ref.type||x.state.next({name:v,values:we(i)})))}(R.shouldDirty||R.shouldTouch)&&k(v,B,R.shouldTouch,R.shouldDirty,!0),R.shouldValidate&&se(v)},K=(v,E,R)=>{for(const U in E){if(!E.hasOwnProperty(U))return;const B=E[U],T=v+"."+U,Q=H(a,T);(l.array.has(v)||ke(B)||Q&&!Q._f)&&!bt(B)?K(T,B,R):W(T,B,R)}},z=(v,E,R={})=>{const U=H(a,v),B=l.array.has(v),T=we(E);xe(i,v,T),B?(x.array.next({name:v,values:we(i)}),(m.isDirty||m.dirtyFields||p.isDirty||p.dirtyFields)&&R.shouldDirty&&x.state.next({name:v,dirtyFields:St(r,i),isDirty:L(v,T)})):U&&!U._f&&!Oe(T)?K(v,T,R):W(v,T,R),Ha(v,l)?x.state.next({...s,name:v,values:we(i)}):x.state.next({name:o.mount?v:void 0,values:we(i)})},ne=async v=>{o.mount=!0;const E=v.target;let R=E.name,U=!0;const B=H(a,R),T=ue=>{U=Number.isNaN(ue)||bt(ue)&&isNaN(ue.getTime())||Ze(ue,H(i,R,ue))},Q=Va(n.mode),de=Va(n.reValidateMode);if(B){let ue,Re;const ft=E.type?Ba(B._f):Li(v),ct=v.type===bn.BLUR||v.type===bn.FOCUS_OUT,Ko=!cm(B._f)&&!n.resolver&&!H(s.errors,R)&&!B._f.deps||mm(ct,H(s.touchedFields,R),s.isSubmitted,de,Q),Mn=Ha(R,l,ct);xe(i,R,ft),ct?(!E||!E.readOnly)&&(B._f.onBlur&&B._f.onBlur(v),d&&d(0)):B._f.onChange&&B._f.onChange(v);const Pn=k(R,ft,ct),Yo=!Me(Pn)||Mn;if(!ct&&x.state.next({name:R,type:v.type,values:we(i)}),Ko)return(m.isValid||p.isValid)&&(n.mode==="onBlur"?ct&&b():ct||b()),Yo&&x.state.next({name:R,...Mn?{}:Pn});if(!ct&&Mn&&x.state.next({...s}),n.resolver){const{errors:ca}=await D([R]);if(j([R]),T(ft),U){const Qo=Wa(s.errors,a,R),da=Wa(ca,a,Qo.name||R);ue=da.error,R=da.name,Re=Me(ca)}}else j([R],!0),ue=(await Ga(B,l.disabled,i,g,n.shouldUseNativeValidation))[R],j([R]),T(ft),U&&(ue?Re=!1:(m.isValid||p.isValid)&&(Re=await _(a,!0)));U&&(B._f.deps&&(!Array.isArray(B._f.deps)||B._f.deps.length>0)&&se(B._f.deps),C(R,Re,ue,Pn))}},G=(v,E)=>{if(H(s.errors,E)&&v.focus)return v.focus(),1},se=async(v,E={})=>{let R,U;const B=Ht(v);if(n.resolver){const T=await S(be(v)?v:B);R=Me(T),U=v?!B.some(Q=>H(T,Q)):R}else v?(U=(await Promise.all(B.map(async T=>{const Q=H(a,T);return await _(Q&&Q._f?{[T]:Q}:Q)}))).every(Boolean),!(!U&&!s.isValid)&&b()):U=R=await _(a);return x.state.next({...!Ue(v)||(m.isValid||p.isValid)&&R!==s.isValid?{}:{name:v},...n.resolver||!v?{isValid:R}:{},errors:s.errors}),E.shouldFocus&&!U&&Wt(a,G,v?B:l.mount),U},Y=(v,E)=>{let R={...o.mount?i:r};return E&&(R=Mi(E.dirtyFields?s.dirtyFields:s.touchedFields,R)),be(v)?R:Ue(v)?H(R,v):v.map(U=>H(R,U))},oe=(v,E)=>({invalid:!!H((E||s).errors,v),isDirty:!!H((E||s).dirtyFields,v),error:H((E||s).errors,v),isValidating:!!H(s.validatingFields,v),isTouched:!!H((E||s).touchedFields,v)}),J=v=>{v&&Ht(v).forEach(E=>Ne(s.errors,E)),x.state.next({errors:v?s.errors:{}})},q=(v,E,R)=>{const U=(H(a,v,{_f:{}})._f||{}).ref,B=H(s.errors,v)||{},{ref:T,message:Q,type:de,...ue}=B;xe(s.errors,v,{...ue,...E,ref:U}),x.state.next({name:v,errors:s.errors,isValid:!1}),R&&R.shouldFocus&&U&&U.focus&&U.focus()},re=(v,E)=>Pe(v)?x.state.subscribe({next:R=>"values"in R&&v(M(void 0,E),R)}):M(v,E,!0),V=v=>x.state.subscribe({next:E=>{um(v.name,E.name,v.exact)&&dm(E,v.formState||m,me,v.reRenderRoot)&&v.callback({values:{...i},...s,...E,defaultValues:r})}}).unsubscribe,ee=v=>(o.mount=!0,p={...p,...v.formState},V({...v,formState:{...f,...v.formState}})),te=(v,E={})=>{for(const R of v?Ht(v):l.mount)l.mount.delete(R),l.array.delete(R),E.keepValue||(Ne(a,R),Ne(i,R)),!E.keepError&&Ne(s.errors,R),!E.keepDirty&&Ne(s.dirtyFields,R),!E.keepTouched&&Ne(s.touchedFields,R),!E.keepIsValidating&&Ne(s.validatingFields,R),!n.shouldUnregister&&!E.keepDefaultValue&&Ne(r,R);x.state.next({values:we(i)}),x.state.next({...s,...E.keepDirty?{isDirty:L()}:{}}),!E.keepIsValid&&b()},Fe=({disabled:v,name:E})=>{if(Ve(v)&&o.mount||v||l.disabled.has(E)){const B=l.disabled.has(E)!==!!v;v?l.disabled.add(E):l.disabled.delete(E),B&&o.mount&&!o.action&&b()}},Z=(v,E={})=>{let R=H(a,v);const U=Ve(E.disabled)||Ve(n.disabled);return xe(a,v,{...R||{},_f:{...R&&R._f?R._f:{ref:{name:v}},name:v,mount:!0,...E}}),l.mount.add(v),R?Fe({disabled:Ve(E.disabled)?E.disabled:n.disabled,name:v}):A(v,!0,E.value),{...U?{disabled:E.disabled||n.disabled}:{},...n.progressive?{required:!!E.required,min:Pt(E.min),max:Pt(E.max),minLength:Pt(E.minLength),maxLength:Pt(E.maxLength),pattern:Pt(E.pattern)}:{},name:v,onChange:ne,onBlur:ne,ref:B=>{if(B){Z(v,E),R=H(a,v);const T=be(B.value)&&B.querySelectorAll&&B.querySelectorAll("input,select,textarea")[0]||B,Q=sm(T),de=R._f.refs||[];if(Q?de.find(ue=>ue===T):T===R._f.ref)return;xe(a,v,{_f:{...R._f,...Q?{refs:[...de.filter(qn),T,...Array.isArray(H(r,v))?[{}]:[]],ref:{type:T.type,name:v}}:{ref:T}}}),A(v,!1,void 0,T)}else R=H(a,v,{}),R._f&&(R._f.mount=!1),(n.shouldUnregister||E.shouldUnregister)&&!(Fi(l.array,v)&&o.action)&&l.unMount.add(v)}}},he=()=>n.shouldFocusError&&Wt(a,G,l.mount),Je=v=>{Ve(v)&&(x.state.next({disabled:v}),Wt(a,(E,R)=>{const U=H(a,R);U&&(E.disabled=U._f.disabled||v,Array.isArray(U._f.refs)&&U._f.refs.forEach(B=>{B.disabled=U._f.disabled||v}))},0,!1))},We=(v,E)=>async R=>{let U;R&&(R.preventDefault&&R.preventDefault(),R.persist&&R.persist());let B=we(i);if(x.state.next({isSubmitting:!0}),n.resolver){const{errors:T,values:Q}=await D();j(),s.errors=T,B=we(Q)}else await _(a);if(l.disabled.size)for(const T of l.disabled)Ne(B,T);if(Ne(s.errors,"root"),Me(s.errors)){x.state.next({errors:{}});try{await v(B,R)}catch(T){U=T}}else E&&await E({...s.errors},R),he(),setTimeout(he);if(x.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:Me(s.errors)&&!U,submitCount:s.submitCount+1,errors:s.errors}),U)throw U},ve=(v,E={})=>{H(a,v)&&(be(E.defaultValue)?z(v,we(H(r,v))):(z(v,E.defaultValue),xe(r,v,we(E.defaultValue))),E.keepTouched||Ne(s.touchedFields,v),E.keepDirty||(Ne(s.dirtyFields,v),s.isDirty=E.defaultValue?L(v,we(H(r,v))):L()),E.keepError||(Ne(s.errors,v),m.isValid&&b()),x.state.next({...s}))},qe=(v,E={})=>{const R=v?we(v):r,U=we(R),B=Me(v),T=B?r:U;if(E.keepDefaultValues||(r=R),!E.keepValues){if(E.keepDirtyValues){const Q=new Set([...l.mount,...Object.keys(St(r,i))]);for(const de of Array.from(Q)){const ue=H(s.dirtyFields,de),Re=H(i,de),ft=H(T,de);ue&&!be(Re)?xe(T,de,Re):!ue&&!be(ft)&&z(de,ft)}}else{if(Ms&&be(v))for(const Q of l.mount){const de=H(a,Q);if(de&&de._f){const ue=Array.isArray(de._f.refs)?de._f.refs[0]:de._f.ref;if(gn(ue)){const Re=ue.closest("form");if(Re){Re.reset();break}}}}if(E.keepFieldsRef)for(const Q of l.mount)z(Q,H(T,Q));else a={}}i=n.shouldUnregister?E.keepDefaultValues?we(r):{}:we(T),x.array.next({values:{...T}}),x.state.next({values:{...T}})}l={mount:E.keepDirtyValues?l.mount:new Set,unMount:new Set,array:new Set,disabled:new Set,watch:new Set,watchAll:!1,focus:""},o.mount=!m.isValid||!!E.keepIsValid||!!E.keepDirtyValues||!n.shouldUnregister&&!Me(T),o.watch=!!n.shouldUnregister,o.keepIsValid=!!E.keepIsValid,o.action=!1,E.keepErrors||(s.errors={}),x.state.next({submitCount:E.keepSubmitCount?s.submitCount:0,isDirty:B?!1:E.keepDirty?s.isDirty:!!(E.keepDefaultValues&&!Ze(v,r)),isSubmitted:E.keepIsSubmitted?s.isSubmitted:!1,dirtyFields:B?{}:E.keepDirtyValues?E.keepDefaultValues&&i?St(r,i):s.dirtyFields:E.keepDefaultValues&&v?St(r,v):E.keepDirty?s.dirtyFields:{},touchedFields:E.keepTouched?s.touchedFields:{},errors:E.keepErrors?s.errors:{},isSubmitSuccessful:E.keepIsSubmitSuccessful?s.isSubmitSuccessful:!1,isSubmitting:!1,defaultValues:r})},ot=(v,E)=>qe(Pe(v)?v(i):v,{...n.resetOptions,...E}),Ge=(v,E={})=>{const R=H(a,v),U=R&&R._f;if(U){const B=U.refs?U.refs[0]:U.ref;B.focus&&setTimeout(()=>{B.focus(),E.shouldSelect&&Pe(B.select)&&B.select()})}},me=v=>{s={...s,...v}},et={control:{register:Z,unregister:te,getFieldState:oe,handleSubmit:We,setError:q,_subscribe:V,_runSchema:D,_updateIsValidating:j,_focusError:he,_getWatch:M,_getDirty:L,_setValid:b,_setFieldArray:w,_setDisabledField:Fe,_setErrors:N,_getFieldArray:I,_reset:qe,_resetDefaultValues:()=>Pe(n.defaultValues)&&n.defaultValues().then(v=>{ot(v,n.resetOptions),x.state.next({isLoading:!1})}),_removeUnmounted:F,_disableForm:Je,_subjects:x,_proxyFormState:m,get _fields(){return a},get _formValues(){return i},get _state(){return o},set _state(v){o=v},get _defaultValues(){return r},get _names(){return l},set _names(v){l=v},get _formState(){return s},get _options(){return n},set _options(v){n={...n,...v}}},subscribe:ee,trigger:se,register:Z,handleSubmit:We,watch:re,setValue:z,getValues:Y,reset:ot,resetField:ve,clearErrors:J,unregister:te,setError:q,setFocus:Ge,getFieldState:oe};return{...et,formControl:et}}function bm(e={}){const n=h.useRef(void 0),s=h.useRef(void 0),[a,r]=h.useState({isDirty:!1,isValidating:!1,isLoading:Pe(e.defaultValues),isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,submitCount:0,dirtyFields:{},touchedFields:{},validatingFields:{},errors:e.errors||{},disabled:e.disabled||!1,isReady:!1,defaultValues:Pe(e.defaultValues)?void 0:e.defaultValues});if(!n.current)if(e.formControl)n.current={...e.formControl,formState:a},e.defaultValues&&!Pe(e.defaultValues)&&e.formControl.reset(e.defaultValues,e.resetOptions);else{const{formControl:o,...l}=hm(e);n.current={...l,formState:a}}const i=n.current.control;return i._options=e,Os(()=>{const o=i._subscribe({formState:i._proxyFormState,callback:()=>r({...i._formState}),reRenderRoot:!0});return r(l=>({...l,isReady:!0})),i._formState.isReady=!0,o},[i]),h.useEffect(()=>i._disableForm(e.disabled),[i,e.disabled]),h.useEffect(()=>{e.mode&&(i._options.mode=e.mode),e.reValidateMode&&(i._options.reValidateMode=e.reValidateMode)},[i,e.mode,e.reValidateMode]),h.useEffect(()=>{e.errors&&(i._setErrors(e.errors),i._focusError())},[i,e.errors]),h.useEffect(()=>{e.shouldUnregister&&i._subjects.state.next({values:i._getWatch()})},[i,e.shouldUnregister]),h.useEffect(()=>{if(i._proxyFormState.isDirty){const o=i._getDirty();o!==a.isDirty&&i._subjects.state.next({isDirty:o})}},[i,a.isDirty]),h.useEffect(()=>{var o;e.values&&!Ze(e.values,s.current)?(i._reset(e.values,{keepFieldsRef:!0,...i._options.resetOptions}),!((o=i._options.resetOptions)===null||o===void 0)&&o.keepIsValid||i._setValid(),s.current=e.values,r(l=>({...l}))):i._resetDefaultValues()},[i,e.values]),h.useEffect(()=>{i._state.mount||(i._setValid(),i._state.mount=!0),i._state.watch&&(i._state.watch=!1,i._subjects.state.next({...i._formState})),i._removeUnmounted()}),n.current.formState=h.useMemo(()=>_i(a,i),[i,a]),n.current}function gm(e,n=3){return e%1===0?e.toString():e.toFixed(n).replace(/\.?0+$/,"")}function ym(e,n="en-US",s="USD"){try{return new Intl.NumberFormat(n,{style:"currency",currency:s,minimumFractionDigits:2,maximumFractionDigits:2}).format(e)}catch(a){return console.warn(`Invalid currency formatting: ${a}`),`${s} ${e.toFixed(2)}`}}function vm(e="USD",n="en-US"){try{return new Intl.NumberFormat(n,{style:"currency",currency:e}).formatToParts(0).find(i=>i.type==="currency")?.value??"$"}catch{return"$"}}function jm(e){const n=e.replace(/[^\d.,-]/g,""),s=n.match(/,\d{1,2}$/);let a;s?a=n.replace(/\./g,"").replace(",","."):a=n.replace(/,/g,"");const r=parseFloat(a);return isNaN(r)?null:r}function wm(e,n,s=.001){const a=e-n,r=Math.abs(a)<=s;return{difference:a,isBalanced:r,isUnderAllocated:!r&&a>0,isOverAllocated:!r&&a<0}}function Vs(){return`dist-${Date.now()}-${Math.random().toString(36).substr(2,9)}`}Vs();const Nm={amount:"Amount",glAccount:"GL Account",taxDeductible:"Tax Deductible",amountPlaceholder:"0.00",glAccountPlaceholder:"Search GL Account",noGlAccountsFound:"No GL Accounts found. Try another search term",searching:"Searching for GL Accounts...",amountTooltip:"Enter the amount for this distribution",glAccountTooltip:"Select the General Ledger account for this distribution",taxDeductibleTooltip:"Check if this distribution is tax deductible",deleteButton:"Delete",currencySymbol:"$"},Gn=()=>({id:Vs(),amount:0,glAccount:null,isTaxDeductible:!1}),Bi=({distribution:e,defaultDistribution:n,glAccounts:s=[],isLoadingGlAccounts:a=!1,onSearchGlAccounts:r,onDistributionChange:i,onAmountChange:o,onGlAccountChange:l,onTaxDeductibleChange:d,onDelete:u,canDelete:f=!0,canEditTaxDeductible:m=!0,isDisabled:p=!1,labels:x,classNames:g={},"data-testid":y,control:b,name:j,rules:w})=>{const $={...Nm,...x},N=b!==void 0&&j!==void 0,A=bm({defaultValues:{_internal:n||Gn()}}),k=em({control:N?b:A.control,name:N?j:"_internal",rules:N?w:void 0}),[C,D]=h.useState(n||Gn()),S=N?k.field.value??Gn():e??C,_=N&&!!k.fieldState?.error,F=N&&(k.fieldState?.isTouched??!1),L=_||F,M=L&&(!S.amount||S.amount<=0),I=L&&!S.glAccount,[W,K]=h.useState(S.glAccount?.name||""),z=h.useCallback(q=>{const re={...S,...q};N&&k.field.onChange(re),!N&&e===void 0&&D(re),i?.(re)},[S,e,i,N,k]),ne=h.useCallback(q=>{const re=q||0;z({amount:re}),o?.(re)},[z,o]),G=h.useCallback(q=>{K(q),r?.(q)},[r]),se=h.useCallback(q=>{if(q===null){z({glAccount:null}),l?.(null);return}const V=s.find(ee=>String(ee.id)===String(q))||null;z({glAccount:V}),l?.(V)},[s,z,l]),Y=h.useCallback(()=>{K(""),z({glAccount:null}),l?.(null)},[z,l]),oe=h.useCallback(q=>{z({isTaxDeductible:q}),d?.(q)},[z,d]),J=h.useCallback(()=>{u?.()},[u]);return t.jsx(c.Card,{radius:"md",shadow:"sm","data-testid":y||"revenue-distribution-card",className:c.cn(g.base),children:t.jsxs(c.CardBody,{className:c.cn("flex flex-row flex-nowrap items-start gap-4",g.body),children:[t.jsx("div",{className:c.cn("shrink-0",g.amountContainer),children:t.jsx(c.NumberInput,{"data-testid":`${y||"revenue-distribution-card"}-amount-input`,label:t.jsxs("span",{className:"flex items-center gap-1",children:[$.amount,t.jsx(c.Tooltip,{content:$.amountTooltip,children:t.jsx(P,{icon:"solar:info-circle-linear",className:"text-default-400 cursor-help",width:16})})]}),value:S.amount||void 0,onValueChange:ne,labelPlacement:"outside",placeholder:$.amountPlaceholder,isWheelDisabled:!0,hideStepper:!0,variant:"bordered",isDisabled:p,isInvalid:M,errorMessage:M?"Amount is required":void 0,minValue:0,step:.01,className:g.amountInput,startContent:t.jsx("div",{className:"pointer-events-none flex items-center",children:t.jsx("span",{className:"text-default-400 text-small",children:$.currencySymbol})})})}),t.jsx("div",{className:c.cn("grow",g.glAccountContainer),children:t.jsx(c.Autocomplete,{"data-testid":`${y||"revenue-distribution-card"}-gl-account-input`,label:t.jsxs("span",{className:"flex items-center gap-1",children:[$.glAccount,t.jsx(c.Tooltip,{content:$.glAccountTooltip,children:t.jsx(P,{icon:"solar:info-circle-linear",className:"text-default-400 cursor-help",width:16})})]}),isLoading:a,isClearable:!0,labelPlacement:"outside",variant:"bordered",items:s,menuTrigger:"input",inputValue:S.glAccount?.name??W,selectedKey:S.glAccount?.id??null,isDisabled:p,isInvalid:I,errorMessage:I?"GL Account is required":void 0,listboxProps:{emptyContent:a?$.searching:$.noGlAccountsFound},placeholder:$.glAccountPlaceholder,onInputChange:G,onSelectionChange:se,onClear:Y,className:g.glAccountInput,children:q=>t.jsx(c.AutocompleteItem,{textValue:q.name,children:t.jsxs("div",{className:"flex flex-col",children:[t.jsx("span",{children:q.name}),q.code&&t.jsx("span",{className:"text-xs text-default-400",children:q.code})]})},q.id)})}),t.jsx("div",{className:c.cn("shrink-0 pt-6 flex items-center",g.taxDeductibleContainer),children:t.jsx(c.Checkbox,{radius:"full","data-testid":`${y||"revenue-distribution-card"}-tax-deductible`,isSelected:S.isTaxDeductible,onValueChange:oe,isDisabled:p||!m,className:g.taxDeductibleCheckbox,children:$.taxDeductible})}),t.jsx("div",{className:c.cn("shrink-0 pt-6",g.deleteContainer),children:t.jsx(O,{"data-testid":`${y||"revenue-distribution-card"}-delete-button`,size:"sm",color:"danger",variant:"flat",isDisabled:p||!f,onPress:J,startContent:t.jsx(P,{icon:"solar:trash-bin-trash-linear",width:16}),className:c.cn("text-danger",g.deleteButton),children:$.deleteButton})})]})})};Bi.displayName="RevenueDistributionCard";const Vi=({message:e="No distributions configured",icon:n="solar:document-text-outline",iconSize:s=48,showCard:a=!0,classNames:r={},renderEmpty:i})=>{if(i)return t.jsx(t.Fragment,{children:i()});const o=t.jsxs("div",{className:c.cn("flex flex-col items-center justify-center py-8",r.content),children:[t.jsx(P,{icon:n,width:s,className:c.cn("text-default-300 mb-4",r.icon)}),t.jsx("p",{className:c.cn("text-default-500 text-sm text-center",r.message),children:e})]});return a?t.jsx(c.Card,{radius:"sm",shadow:"sm","data-testid":"revenue-distribution-empty",className:c.cn("w-full",r.base),children:t.jsx(c.CardBody,{children:o})}):t.jsx("div",{"data-testid":"revenue-distribution-empty",className:c.cn("w-full",r.base),children:o})};Vi.displayName="RevenueDistributionEmpty";const Cm={title:"Error Loading Distributions",description:"An error occurred while loading the distribution configuration. Please try again."},Ui=({error:e,labels:n,showCard:s=!0,color:a="danger",classNames:r={}})=>{const i={...Cm,...n},o=t.jsx(c.Alert,{"data-testid":"revenue-distribution-error-alert",color:a,title:i.title,description:e||i.description,className:r.alert});return s?t.jsx(c.Card,{radius:"sm",shadow:"sm","data-testid":"revenue-distribution-error",className:c.cn("w-full",r.base),children:t.jsx(c.CardBody,{children:o})}):t.jsx("div",{"data-testid":"revenue-distribution-error",className:c.cn("w-full",r.base),children:o})};Ui.displayName="RevenueDistributionError";const Hi=({rows:e=1,showCard:n=!0,classNames:s={}})=>{const a=Array.from({length:e},(i,o)=>o),r=i=>t.jsxs("div",{className:c.cn("flex flex-row flex-nowrap items-end gap-4",s.row),children:[t.jsxs("div",{className:"shrink-0 flex flex-col gap-1",children:[t.jsxs("div",{className:"flex items-center gap-1",children:[t.jsx(c.Skeleton,{className:"h-4 w-14 rounded-md"}),t.jsx(c.Skeleton,{className:"h-4 w-4 rounded-full"})]}),t.jsx(c.Skeleton,{className:"h-10 w-32 rounded-lg"})]}),t.jsxs("div",{className:"grow flex flex-col gap-1",children:[t.jsxs("div",{className:"flex items-center gap-1",children:[t.jsx(c.Skeleton,{className:"h-4 w-20 rounded-md"}),t.jsx(c.Skeleton,{className:"h-4 w-4 rounded-full"})]}),t.jsx(c.Skeleton,{className:"h-10 w-full rounded-lg"})]}),t.jsxs("div",{className:"shrink-0 pb-2 flex items-center gap-2",children:[t.jsx(c.Skeleton,{className:"h-5 w-5 rounded-full"}),t.jsx(c.Skeleton,{className:"h-4 w-24 rounded-md"})]}),t.jsx("div",{className:"shrink-0 pb-2",children:t.jsx(c.Skeleton,{className:"h-8 w-20 rounded-lg"})})]},i);return n?t.jsx("div",{className:c.cn("flex flex-col gap-3",s.base),children:a.map(i=>t.jsx(c.Card,{radius:"md",shadow:"sm","data-testid":`revenue-distribution-skeleton-${i}`,children:t.jsx(c.CardBody,{children:r(i)})},i))}):t.jsx("div",{"data-testid":"revenue-distribution-skeleton",className:c.cn("flex flex-col gap-3",s.base),children:a.map(i=>r(i))})};Hi.displayName="RevenueDistributionSkeleton";function Us({isOpen:e,labels:n,icon:s,isConfirming:a=!1,confirmColor:r="danger",iconTone:i="danger",portalContainer:o,shouldBlockScroll:l,classNames:d,onClose:u,onConfirm:f}){return t.jsx(Qt,{isOpen:e,size:"md",placement:"center",portalContainer:o,shouldBlockScroll:l,classNames:{...d,base:c.cn("max-w-[440px] rounded-3xl",d?.base),closeButton:c.cn("right-5 top-5 text-zinc-500",d?.closeButton)},onOpenChange:m=>!m&&u(),children:t.jsxs(c.ModalContent,{children:[t.jsxs(c.ModalHeader,{className:"flex flex-col items-start gap-4 px-7 pb-0 pt-7",children:[s&&t.jsx("span",{className:c.cn("flex h-12 w-12 shrink-0 items-center justify-center rounded-full",i==="warning"?"bg-brand/15 text-brand":"bg-danger-100 text-danger-600"),children:s}),t.jsx("span",{className:"text-lg font-semibold leading-6 text-zinc-950",children:n.title})]}),t.jsx(c.ModalBody,{className:"px-7 pb-3 pt-4",children:t.jsx("div",{className:"text-sm leading-6 text-zinc-500",children:n.description})}),t.jsxs(c.ModalFooter,{className:"grid grid-cols-2 gap-3 px-7 pb-7 pt-3",children:[t.jsx(O,{type:"button",size:"md",variant:"bordered",radius:"full",className:"h-10 border-zinc-200 bg-white text-sm font-normal text-zinc-900",onPress:u,children:n.cancel}),t.jsx(O,{type:"button",size:"md",color:r,radius:"full",className:c.cn("h-10 text-sm font-normal text-white",r==="danger"?"bg-danger-600":"bg-brand"),isLoading:a,onPress:f,children:n.confirm})]})]})})}const km=()=>({id:crypto.randomUUID(),fund:null,percentage:0});function Ka(e){return!e.fund&&Number(e.percentage||0)<=0}function Sm({mode:e,assignments:n}){const s=n.filter(i=>i.fund),a=s.reduce((i,o)=>i+Number(o.percentage||0),0),r=n.some(i=>!i.fund||Number(i.percentage||0)<=0);return s.length>=1&&!r&&Math.round(a*100)/100===100}const $m={title:"Payment assignment",saved:"Saved",singleFund:"Single fund",splitFunds:"Split across multiple funds",saveAssignment:"Save assignment",assignSpecificFund:"Assign specific fund",addFund:"Add account",emptySingle:"You have not assign any specific fund for this opportunity",emptySplit:"Select a fund and assign percentages that total 100%",selectedFund:"Selected fund",percentage:"Percentage",total:"Total",totalError:"Select a fund for each row and enter percentages that total 100%.",removeFund:"Remove fund",modalTitle:"Select an specific fund",searchPlaceholder:"Search...",glCode:"GL Code",accountName:"Specific Fund Name",type:"Type",actions:"Actions",select:"Select",noFunds:"No specific funds available",modifyAssignedFundsTitle:"Modify Assigned Funds",modifyAssignedFundsDescription:"Changing the assigned funds will only affect up and coming payments.",modifyAssignedFundsWarning:"Payments already paid will still keep the previous configuration.",modifyAssignedFundsCancel:"Cancel",modifyAssignedFundsConfirm:"Continue"},Wi={base:"min-h-11 rounded-full bg-zinc-100 px-4 py-2 shadow-none",iconWrapper:"!h-4 !w-4 shrink-0 !bg-transparent !shadow-none !border-0 text-zinc-900",alertIcon:"!static !h-4 !w-4 !translate-x-0 !translate-y-0 text-zinc-900",mainWrapper:"min-w-0",title:"text-sm font-normal text-zinc-900"},Tt={...Wi,base:"min-h-11 rounded-2xl px-4 py-2 shadow-none",title:"text-sm font-medium"},Am={inputWrapper:"h-9 rounded-xl border border-zinc-200 bg-white shadow-none hover:border-zinc-300 data-[hover=true]:border-zinc-300 group-data-[focus=true]:border-zinc-400 group-data-[focus-visible=true]:ring-0"},Dm={wrapper:"!absolute !inset-0 !z-50 !h-auto !w-auto !items-center !justify-center !p-4",backdrop:"!absolute !inset-0 !z-40 !h-auto !w-auto rounded-2xl"};function Em(){return t.jsxs("svg",{"aria-hidden":"true",className:"size-4 text-zinc-500",fill:"none",viewBox:"0 0 16 16",children:[t.jsx("rect",{x:"3",y:"3",width:"4",height:"4",rx:"1",stroke:"currentColor",strokeWidth:"1.4"}),t.jsx("rect",{x:"9",y:"3",width:"4",height:"4",rx:"1",stroke:"currentColor",strokeWidth:"1.4"}),t.jsx("rect",{x:"3",y:"9",width:"4",height:"4",rx:"1",stroke:"currentColor",strokeWidth:"1.4"}),t.jsx("rect",{x:"9",y:"9",width:"4",height:"4",rx:"1",stroke:"currentColor",strokeWidth:"1.4"})]})}const Lm=e=>Number.isFinite(e)?Math.max(0,Math.min(100,Math.round(e*100)/100)):0,Fm=e=>e.fund!==null;function Rm({assignments:e,funds:n,labels:s,classNames:a,isSaving:r=!1,hasSavedAssignments:i=!1,showSavedIndicator:o=!1,isCollapsed:l,isFundPickerOpen:d=!1,activeAssignmentId:u=null,modalPortalContainer:f,footer:m,onAssignmentsChange:p,onOpenFundPicker:x,onCloseFundPicker:g,onCollapseChange:y,onSave:b}){const[j,w]=h.useState(null),$=f??j??void 0,N={...$m,...s},A=e.filter(V=>!Ka(V)),C=A.filter(Fm).length>0,D=h.useMemo(()=>e.filter(V=>!Ka(V)).reduce((V,ee)=>V+Number(ee.percentage||0),0),[e]),S=Math.round(D*100)/100,_=A.some(V=>!V.fund||Number(V.percentage||0)<=0),F=C&&(S!==100||_),L=`${N.totalError} (${N.total} ${Number(D.toFixed(2))}%)`,M=Sm({mode:"split",assignments:e}),I=C&&S>=100,[W,K]=h.useState(!1),[z,ne]=h.useState(!1),G=t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(Em,{}),t.jsx("span",{className:"text-base font-medium leading-6 text-zinc-950",children:N.title}),o?t.jsx(c.Chip,{size:"sm",radius:"full",color:"success",variant:"flat",children:N.saved}):null]}),se=(V,ee)=>{p(e.map(te=>te.id===V?{...te,...ee}:te))},Y=()=>{I||p([...e,km()])},oe=V=>{e.length<=1||p(e.filter(ee=>ee.id!==V))},J=()=>{if(!r){if(!M){ne(!0);return}if(!i){b();return}K(!0)}},q=()=>{K(!1),b()},re=V=>{const ee=u??e.find(te=>!te.fund)?.id??e[0]?.id;ee&&(p(e.map(te=>te.id===ee?{...te,fund:V}:te)),g())};return t.jsxs("div",{ref:w,className:c.cn("vvt-pa relative min-w-0 w-full font-sans text-zinc-900 [container-type:inline-size]",d&&!f&&"min-h-[560px]",a?.root),children:[t.jsx(c.Accordion,{variant:"splitted",defaultSelectedKeys:l===void 0?["installment-fund-assignment"]:void 0,selectedKeys:l===void 0?void 0:new Set(l?[]:["installment-fund-assignment"]),className:c.cn("w-full gap-0 px-0",a?.panel),itemClasses:{base:"w-full rounded-2xl border border-zinc-200 bg-white p-0 shadow-sm",trigger:c.cn("px-4 py-4",a?.header),title:"w-full",content:"w-full px-4 pb-4 pt-0",indicator:"text-zinc-500 [&>svg]:size-4"},onSelectionChange:V=>y?.(!(V==="all"||Array.from(V).length>0)),children:t.jsx(c.AccordionItem,{"aria-label":N.title,title:G,children:t.jsxs("div",{className:c.cn("flex w-full flex-col gap-4",a?.content),children:[t.jsxs("div",{className:"flex w-full flex-col gap-4",children:[!C&&t.jsx(c.Alert,{icon:t.jsx(P,{icon:"solar:info-circle-outline",className:"size-4"}),hideIconWrapper:!0,isClosable:!1,classNames:Wi,color:"default",variant:"flat",title:N.emptySplit}),C&&t.jsx(_m,{assignments:e,labels:N,total:D,hasTotalError:z&&!M||F,validationMessage:L,onSelectFund:V=>x(V),onRemoveFund:oe,onPercentageChange:(V,ee)=>se(V,{percentage:Lm(ee)})}),t.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[t.jsx(O,{type:"button",size:"lg",color:"default",radius:"full",className:"h-11 bg-zinc-950 px-4 text-lg font-normal text-white disabled:opacity-50 [@container(max-width:479px)]:w-full",startContent:t.jsx(X.Plus,{className:"size-5",strokeWidth:2}),isDisabled:I,onPress:()=>C?Y():x(),children:N.assignSpecificFund}),t.jsx(O,{type:"button","data-testid":"installment-fund-assignment-save-button",size:"md",color:"primary",radius:"full",className:"ml-auto h-10 min-w-40 px-4 text-sm font-medium [@container(max-width:479px)]:w-full",startContent:r?void 0:t.jsx(P,{icon:"solar:cloud-upload-outline",className:"size-4"}),isLoading:r,isDisabled:!M||r,onPress:J,children:N.saveAssignment})]})]}),m]})},"installment-fund-assignment")}),d&&t.jsx(Mm,{funds:n,labels:N,selectedFundIds:e.map(V=>V.fund?.id).filter(Boolean),portalContainer:$,onSelect:re,onClose:g}),t.jsx(Us,{isOpen:W,labels:{title:N.modifyAssignedFundsTitle,description:t.jsxs(t.Fragment,{children:[t.jsx("p",{children:N.modifyAssignedFundsDescription}),t.jsx("p",{className:"mt-3",children:N.modifyAssignedFundsWarning})]}),cancel:N.modifyAssignedFundsCancel,confirm:N.modifyAssignedFundsConfirm},icon:t.jsx(P,{icon:"solar:info-circle-outline",className:"size-7"}),iconTone:"warning",confirmColor:"primary",portalContainer:$,shouldBlockScroll:!1,classNames:Dm,onClose:()=>K(!1),onConfirm:q})]})}function _m({assignments:e,labels:n,total:s,hasTotalError:a,validationMessage:r,onSelectFund:i,onRemoveFund:o,onPercentageChange:l}){return t.jsxs("div",{className:"flex flex-col gap-3",children:[e.map((d,u)=>t.jsxs("div",{"data-testid":"installment-fund-assignment-row",className:"flex min-h-15 w-full flex-wrap items-center gap-3 rounded-2xl border border-zinc-200 bg-white px-3 py-2",children:[t.jsx("div",{className:c.cn("flex min-h-11 min-w-0 basis-full items-center gap-2","[@container(min-width:560px)]:basis-0 [@container(min-width:560px)]:flex-1 [@container(min-width:560px)]:gap-4"),children:d.fund?t.jsxs(t.Fragment,{children:[t.jsxs("span",{className:"min-w-0 break-words rounded-2xl bg-zinc-100 px-4 py-1.5 text-sm text-zinc-950",children:[d.fund.glCode," - ",d.fund.accountName]}),t.jsx(O,{type:"button",variant:"light",color:"primary",radius:"full",className:"flex-none px-2 text-sm font-normal",onPress:()=>i(d.id),children:"Replace"})]}):t.jsx(O,{type:"button",size:"lg",variant:"light",radius:"full",className:"max-w-full justify-start px-4 text-lg font-normal text-zinc-900",startContent:t.jsx(X.Plus,{className:"size-5",strokeWidth:2}),onPress:()=>i(d.id),children:n.assignSpecificFund})}),t.jsx("label",{className:"flex min-w-0 flex-1 items-center [@container(min-width:560px)]:w-48 [@container(min-width:560px)]:flex-none",children:t.jsx(c.Input,{variant:"bordered",type:"number",min:0,max:100,step:.01,value:String(d.percentage||""),onChange:f=>l(d.id,Number(f.target.value)),endContent:t.jsx("span",{className:"text-sm text-zinc-500",children:"%"}),classNames:Am})}),e.length>1&&t.jsx(O,{type:"button",isIconOnly:!0,variant:"flat",radius:"full",className:c.cn("h-10 w-10 flex-none p-0",u===0?"bg-danger-100 text-danger-500 opacity-60":"bg-danger-600 text-white"),style:{height:40,minWidth:40,width:40},isDisabled:u===0,onPress:()=>o(d.id),"aria-label":n.removeFund,children:t.jsx(P,{icon:"solar:trash-bin-minimalistic-outline",className:"size-5"})})]},d.id)),t.jsx(c.Alert,{icon:t.jsx(P,{icon:a?"solar:info-circle-outline":"solar:check-circle-outline",className:"size-4"}),hideIconWrapper:!0,isClosable:!1,color:a?"warning":"success",variant:"flat",classNames:{...Tt,base:c.cn(Tt.base,a?"bg-warning-50 text-warning-700":"bg-success-50 text-success-700"),iconWrapper:c.cn(Tt.iconWrapper,a?"text-warning-700":"text-success-700"),alertIcon:c.cn(Tt.alertIcon,a?"text-warning-700":"text-success-700"),title:c.cn(Tt.title,a?"text-warning-700":"text-success-700")},title:a?r:`${n.total} ${Number(s.toFixed(2))}%`})]})}function Mm({funds:e,labels:n,selectedFundIds:s,portalContainer:a,onSelect:r,onClose:i}){const[o,l]=h.useState(""),d=e.filter(u=>{if(s.includes(u.id))return!1;const f=o.trim().toLowerCase();return f?`${u.glCode} ${u.accountName} ${u.type}`.toLowerCase().includes(f):!0});return t.jsx(Qt,{isOpen:!0,size:"3xl",placement:"center",scrollBehavior:"inside",shouldBlockScroll:!1,portalContainer:a,classNames:{wrapper:"!absolute !inset-0 !z-50 !h-auto !w-auto !items-center !justify-center !p-4",backdrop:"!absolute !inset-0 !z-40 !h-auto !w-auto rounded-2xl",base:"max-h-[calc(100%-2rem)] w-full max-w-3xl rounded-3xl",closeButton:"right-6 top-6 text-zinc-500"},onOpenChange:u=>!u&&i(),children:t.jsxs(c.ModalContent,{className:"max-h-full",children:[t.jsx(c.ModalHeader,{className:"px-6 pr-12 pt-6 text-xl font-semibold leading-7 text-zinc-950",children:n.modalTitle}),t.jsxs(c.ModalBody,{className:"flex min-h-0 flex-1 flex-col px-6 pb-6",children:[t.jsx(c.Input,{variant:"bordered","aria-label":n.searchPlaceholder,value:o,placeholder:n.searchPlaceholder,onChange:u=>l(u.target.value),startContent:t.jsx(P,{icon:"solar:magnifer-outline",className:"size-5 text-zinc-500"}),classNames:{input:"text-sm placeholder:text-zinc-500",inputWrapper:"h-10 rounded-2xl border border-zinc-200 bg-white px-4 shadow-none hover:border-zinc-300 data-[hover=true]:border-zinc-300 group-data-[focus=true]:border-zinc-400 group-data-[focus-visible=true]:ring-0"}}),t.jsxs("div",{className:"mt-4 min-h-0 flex-1 overflow-auto [container-type:inline-size]",children:[t.jsxs("div",{className:"hidden grid-cols-[1fr_1.3fr_0.6fr] gap-5 border-b border-zinc-200 px-3 pb-3 text-sm font-medium leading-5 text-zinc-900 [@container(min-width:520px)]:grid",children:[t.jsx("span",{children:n.glCode}),t.jsx("span",{children:n.accountName}),t.jsx("span",{children:n.actions})]}),d.length===0&&t.jsx("div",{className:"p-4 text-sm text-zinc-500",children:n.noFunds}),d.map(u=>t.jsxs("div",{"data-testid":"installment-fund-picker-row",className:"grid grid-cols-[minmax(0,1fr)_auto] items-center gap-x-3 border-b border-zinc-100 px-3 py-2.5 text-sm leading-5 text-zinc-900 last:border-b-0 [@container(min-width:520px)]:grid-cols-[1fr_1.3fr_0.6fr] [@container(min-width:520px)]:gap-5 [@container(min-width:520px)]:border-b-0",children:[t.jsx("span",{className:"col-start-1 row-start-1 font-medium [@container(min-width:520px)]:font-normal",children:u.glCode}),t.jsx("span",{className:"col-start-1 row-start-2 min-w-0 break-words text-zinc-600 [@container(min-width:520px)]:col-start-2 [@container(min-width:520px)]:row-start-1 [@container(min-width:520px)]:text-zinc-900",children:u.accountName}),t.jsx(O,{type:"button",size:"sm",variant:"bordered",radius:"full",className:"col-start-2 row-span-2 row-start-1 h-9 min-w-20 border-zinc-200 bg-white text-sm font-medium text-zinc-900 [@container(min-width:520px)]:col-start-3 [@container(min-width:520px)]:row-span-1 [@container(min-width:520px)]:min-w-24",onPress:()=>r(u),children:n.select})]},u.id))]})]})]})})}function Pm(){return t.jsxs("section",{className:"flex w-full flex-col gap-4 rounded-2xl border border-zinc-200 bg-white p-4 shadow-sm","aria-busy":"true",children:[t.jsxs("div",{className:"flex items-start justify-between gap-3",children:[t.jsx(c.Skeleton,{className:"h-7 w-56 rounded-lg"}),t.jsx(c.Skeleton,{className:"size-8 rounded-full"})]}),t.jsxs("div",{className:"flex items-center justify-between gap-3",children:[t.jsx(c.Skeleton,{className:"h-10 w-72 rounded-full"}),t.jsx(c.Skeleton,{className:"h-10 w-40 rounded-full"})]}),t.jsxs("div",{className:"grid grid-cols-[minmax(0,1fr)_160px] items-center gap-4 rounded-2xl border border-zinc-100 p-3",children:[t.jsx(c.Skeleton,{className:"h-8 w-full max-w-xs rounded-full"}),t.jsx(c.Skeleton,{className:"h-8 w-full rounded-xl"})]}),t.jsx(c.Skeleton,{className:"h-11 w-40 rounded-full"})]})}const Tm={totalAmount:"Total Amount:",remainingBalance:"Remaining Balance",amountReceived:"Amount Received:"};function Im({totalAmount:e,remainingBalance:n,amountReceived:s,currency:a="USD",locale:r="en-US",labels:i,className:o}){const l={...Tm,...i},d=new Intl.NumberFormat(r,{style:"currency",currency:a});return t.jsx("div",{className:c.cn("w-full rounded-2xl border border-zinc-200 bg-white px-4 py-2.5 font-sans text-base leading-6",o),children:t.jsxs("div",{className:"flex w-full flex-wrap items-center gap-x-5 gap-y-2",children:[t.jsx(Kn,{label:l.totalAmount,value:d.format(e)}),t.jsx(Kn,{label:l.remainingBalance,value:d.format(n)}),t.jsx(Kn,{label:l.amountReceived,value:d.format(s)})]})})}function Kn({label:e,value:n}){return t.jsxs("div",{className:"flex items-center gap-3 whitespace-nowrap",children:[t.jsx("span",{className:"font-medium text-zinc-700",children:e}),t.jsx("span",{className:"font-normal text-zinc-950",children:n})]})}const Om={monthly:1,quarterly:3,annual:12},qi=e=>{const[n,s,a]=e.split("-").map(Number);return{year:n,month:s,day:a}},zm=(e,n)=>new Date(e,n+1,0).getDate(),Bm=e=>{const n=e.getFullYear(),s=String(e.getMonth()+1).padStart(2,"0"),a=String(e.getDate()).padStart(2,"0");return`${n}-${s}-${a}`},Vm=(e,n)=>{const{year:s,month:a,day:r}=qi(e),i=a-1+n,o=s+Math.floor(i/12),l=(i%12+12)%12,d=Math.min(r,zm(o,l));return new Date(o,l,d)},Um=(e,n)=>{const{year:s,month:a,day:r}=qi(e),i=new Date(s,a-1,r);return i.setDate(i.getDate()+n),i};function Gi(e,n){const s=Math.max(1,Math.floor(n.numberOfInstallments||1)),a=Math.round(e*100),r=Math.floor(a/s),i=a-r*s,o=Om[n.frequency];return Array.from({length:s},(l,d)=>{const u=n.frequency==="weekly"?Um(n.firstInstallmentDate,d*7):Vm(n.firstInstallmentDate,d*(o??1));return{id:crypto.randomUUID(),dueDate:Bm(u),amount:(r+(d===0?i:0))/100}})}function Hm(e){return new Set(e.map((n,s)=>{const a=e[s+1]?.dueDate;return n.dueDate&&a&&n.dueDate>a?n.id:null}).filter(n=>!!n))}function Wm(e){return{missingDateRows:new Set(e.filter(n=>!n.dueDate).map(n=>n.id)),invalidDateRows:Hm(e),invalidAmountRows:new Set(e.filter(n=>Number(n.amount||0)<=0).map(n=>n.id))}}function qm(e){return e.missingDateRows.size>0||e.invalidDateRows.size>0||e.invalidAmountRows.size>0}function Gm(e,n){const s=e[0];return!s||!n||s.dueDate===n?e:[{...s,dueDate:n},...e.slice(1)]}const Km=new Set(["paid","partially_refunded","refunded"]);function gt(e){return e!==void 0&&Km.has(e)}const Ym={title:"Payments",saved:"Saved",automaticMode:"Auto",manualMode:"Manual",createInstallments:"Create Payments",generateSchedule:"Generate Schedule",saveInstallments:"Save Payments",cancelEdit:"Cancel",addInstallment:"Add Payment",emptyAutomatic:"No payments have been generated for this opportunity",emptyManual:"Add payments with custom dates and amounts",numberOfInstallments:"Number of payments",frequency:"Frequency",dayOfMonth:"Day of month",firstInstallmentDate:"First payment date",installment:"Payment",dueDate:"Due date",amount:"Amount",total:"Total",remaining:"Remaining",deleteInstallment:"Delete installment",weekly:"Weekly",monthly:"Monthly",quarterly:"Quarterly",annual:"Annual",totalError:"Payment total must equal the total amount",totalIncreaseWarning:"Saving will update the donation/contribution total to match the scheduled payments.",totalIncreaseConfirmationTitle:"Update Donation Total",totalIncreaseConfirmationDescription:"The scheduled payments total is greater than the current donation/contribution total. Saving will update the donation/contribution total to match the scheduled payments.",totalIncreaseConfirmationCancel:"Cancel",totalIncreaseConfirmationConfirm:"Save Payments",dateOrderError:"Payment date must be on or before the next payment date.",dueDateRequiredError:"Payment date is required.",amountGreaterThanZeroError:"Payment amount must be greater than 0."},Qm=["weekly","monthly","quarterly","annual"],Zm=Array.from({length:31},(e,n)=>n+1),Xm=["numberOfInstallments","frequency","firstInstallmentDate"],Ya=()=>({id:crypto.randomUUID(),dueDate:new Date().toISOString().slice(0,10),amount:0}),vn=e=>Math.round(e*100)/100,Jm=(e,n)=>{const s=new Date(`${e}T00:00:00`);return Number.isNaN(s.getTime())?e:new Intl.DateTimeFormat(n,{month:"short",day:"numeric",year:"numeric"}).format(s)},En=e=>{if(!e)return null;try{return zd(e)}catch{return null}},ef=e=>En(e)?.day??1,tf=(e,n)=>new Date(e,n,0).getDate(),nf=(e,n)=>{const s=En(e);if(!s)return e;const a=Math.min(n,tf(s.year,s.month));return s.set({day:a}).toString()},Qa=e=>{const n=e%100>=11&&e%100<=13?"th":e%10===1?"st":e%10===2?"nd":e%10===3?"rd":"th";return`${e}${n}`};function sf({mode:e,donationAmount:n,currency:s="USD",locale:a="en-US",installments:r,automaticSettings:i,defaultTab:o="automatic",showTitle:l=!0,showCard:d=!0,showSavePayment:u=!0,showTabs:f=!0,inputs:m=Xm,startDate:p,firstInstallmentDateOverride:x,labels:g,classNames:y,isSaving:b=!1,showSavedIndicator:j=!1,isModeSwitchDisabled:w=!1,onModeChange:$,onAutomaticSettingsChange:N,onInstallmentsChange:A,onSave:k,onCancel:C}){const[D,S]=h.useState(o),_={...Ym,...g},F=e??D,L=h.useMemo(()=>new Intl.NumberFormat(a,{style:"currency",currency:s}),[s,a]),M=h.useMemo(()=>({...i,firstInstallmentDate:m.includes("firstInstallmentDate")?i.firstInstallmentDate:m.includes("dayOfMonth")?i.firstInstallmentDate||p||"":p||i.firstInstallmentDate}),[i,m,p]),I=F==="automatic"?Gm(Gi(n,M),m.includes("firstInstallmentDate")?void 0:x):r,W=h.useMemo(()=>vn(I.reduce((te,Fe)=>te+Number(Fe.amount||0),0)),[I]),K=Math.abs(W-n)>.009,z=vn(n-W)<=0,ne=h.useMemo(()=>Wm(r),[r]),G=F==="manual"&&qm(ne),se=K||G,Y=l?t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(X.CircleDollarSign,{className:"size-4 text-zinc-500",strokeWidth:1.75}),t.jsx("span",{className:"text-base font-medium leading-6 text-zinc-950",children:_.title}),j?t.jsx(c.Chip,{size:"sm",radius:"full",color:"success",variant:"flat",children:_.saved}):null]}):void 0,oe=te=>{te!==F&&(e||S(te),$?.(te),te==="manual"&&r.length===0&&A([Ya()]))},J=(te,Fe)=>{const Z=r.find(he=>he.id===te);gt(Z?.status)||A(r.map(he=>he.id===te?{...he,...Fe}:he))},q=()=>{A([...r,Ya()])},re=te=>{const Fe=r.find(Z=>Z.id===te);gt(Fe?.status)||A(r.filter(Z=>Z.id!==te))},V=()=>{b||se||k?.()},ee=t.jsxs("div",{className:c.cn("flex w-full flex-col gap-4",y?.content),children:[f||u||C?t.jsxs("div",{className:"flex w-full items-center justify-between gap-6",children:[f?t.jsx(af,{mode:F,labels:_,onModeChange:oe,isDisabled:w,className:y?.tabs}):null,t.jsxs("div",{className:"ml-auto flex items-center gap-3",children:[C?t.jsx(O,{type:"button","data-testid":"installment-schedule-cancel-button",size:"md",variant:"bordered",radius:"full",className:"min-w-28",isDisabled:b,onPress:C,children:_.cancelEdit}):null,u?t.jsx(O,{type:"button","data-testid":"installment-schedule-save-button",size:"md",color:"primary",radius:"full",className:"min-w-36",startContent:b?void 0:t.jsx(P,{icon:"solar:cloud-upload-outline",className:"size-4"}),isLoading:b,isDisabled:b||se,onPress:V,children:_.saveInstallments}):null]})]}):null,t.jsxs("div",{className:c.cn("flex w-full flex-col gap-4",y?.preview),children:[F==="automatic"&&t.jsx(rf,{settings:M,inputs:m,labels:_,className:y?.controls,onSettingsChange:N}),I.length===0&&t.jsx(c.Alert,{isClosable:!1,color:"default",variant:"flat",radius:"full",title:F==="automatic"?_.emptyAutomatic:_.emptyManual}),I.length>0&&t.jsx(lf,{mode:F,installments:I,rowErrors:ne,labels:_,formatter:L,locale:a,onUpdateInstallment:J,onRemoveInstallment:re}),F==="manual"&&t.jsx("div",{className:"flex flex-wrap gap-3",children:t.jsx(O,{type:"button",size:"md",variant:"bordered",radius:"full",className:"h-10 border-zinc-200 bg-white px-4 text-sm font-normal text-zinc-900",startContent:t.jsx(X.Plus,{className:"size-5",strokeWidth:2}),isDisabled:z,onPress:q,children:_.addInstallment})}),t.jsx(uf,{total:W,donationAmount:n,hasTotalMismatch:K,mode:F,installments:I,formatter:L,labels:_,className:y?.summary})]})]});return t.jsx("div",{className:c.cn("vvt-ps relative font-sans text-zinc-900",y?.root),children:d?t.jsx(c.Accordion,{variant:"splitted",defaultSelectedKeys:["installment-schedule"],className:c.cn("w-full gap-0 px-0",y?.panel),itemClasses:{base:"w-full rounded-2xl border border-zinc-200 bg-white p-0 shadow-sm",trigger:c.cn("px-4 py-4",y?.header),title:"w-full",content:"w-full px-4 pb-4 pt-0",indicator:"text-zinc-500 [&>svg]:size-4"},children:t.jsx(c.AccordionItem,{"aria-label":_.title,title:Y,children:ee},"installment-schedule")}):ee})}function af({mode:e,labels:n,className:s,isDisabled:a=!1,onModeChange:r}){return t.jsxs(c.Tabs,{"aria-label":n.title,selectedKey:e,isDisabled:a,color:"primary",size:"lg",radius:"full",className:c.cn("w-fit",s),onSelectionChange:i=>r(i),children:[t.jsx(c.Tab,{title:n.automaticMode},"automatic"),t.jsx(c.Tab,{title:n.manualMode},"manual")]})}function rf({settings:e,inputs:n,labels:s,className:a,onSettingsChange:r}){const i=o=>{if(o==="numberOfInstallments")return t.jsx("div",{className:"min-w-0",children:t.jsx(c.Input,{variant:"bordered",label:s.numberOfInstallments,labelPlacement:"outside",type:"number",min:1,step:1,value:e.numberOfInstallments>0?String(e.numberOfInstallments):"",onWheel:l=>l.currentTarget.blur(),onChange:l=>{const d=l.target.value;r({...e,numberOfInstallments:d===""?0:Math.max(1,Number(d))})}})},o);if(o==="frequency")return t.jsx("div",{className:"min-w-0",children:t.jsx(Xe,{variant:"bordered",label:s.frequency,labelPlacement:"outside",selectedKeys:[e.frequency],onSelectionChange:l=>{const d=Array.from(l)[0];typeof d=="string"&&r({...e,frequency:d})},children:Qm.map(l=>t.jsx(c.SelectItem,{textValue:s[l],children:s[l]},l))})},o);if(o==="dayOfMonth"){const l=String(ef(e.firstInstallmentDate));return t.jsx("div",{className:"min-w-0",children:t.jsx(Xe,{variant:"bordered",label:s.dayOfMonth,labelPlacement:"outside",selectedKeys:[l],onSelectionChange:d=>{const u=Number(Array.from(d)[0]);Number.isFinite(u)&&r({...e,firstInstallmentDate:nf(e.firstInstallmentDate,u)})},children:Zm.map(d=>t.jsx(c.SelectItem,{textValue:Qa(d),children:Qa(d)},String(d)))})},o)}return t.jsx("div",{className:"min-w-0",children:t.jsx(Fs,{variant:"bordered",label:s.firstInstallmentDate,labelPlacement:"outside",value:En(e.firstInstallmentDate),onChange:l=>r({...e,firstInstallmentDate:l?l.toString():""}),startContent:t.jsx(P,{icon:"solar:calendar-outline",className:"size-4 text-zinc-500"})})},o)};return n.length===0?null:t.jsx("div",{className:c.cn("grid gap-4",a),style:{gridTemplateColumns:"repeat(auto-fit, minmax(min(100%, 14rem), 1fr))"},children:n.map(i)})}function lf({mode:e,installments:n,rowErrors:s,labels:a,formatter:r,locale:i,onUpdateInstallment:o,onRemoveInstallment:l}){return e==="automatic"?t.jsx("div",{className:"rounded-2xl border border-zinc-200 bg-zinc-50 p-4",children:t.jsx("div",{className:c.cn("flex flex-col gap-3",n.length>5&&"max-h-[264px] overflow-y-auto pr-2"),children:n.map((d,u)=>t.jsxs("div",{className:c.cn("flex min-h-10 items-center justify-between rounded-xl px-4 py-2 text-base",u===0&&"border border-primary/25 bg-primary/5 text-primary"),children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsxs("span",{children:["#",u+1]}),t.jsx("span",{children:"▪"}),t.jsx("span",{children:Jm(d.dueDate,i)}),u===0&&n.length>1&&t.jsx(c.Chip,{size:"sm",color:"primary",variant:"solid",radius:"full",children:"First charge"})]}),t.jsx("span",{className:"text-zinc-950",children:r.format(d.amount)})]},d.id))})}):t.jsx("div",{className:"flex flex-col gap-2",children:n.map((d,u)=>{const f=s.missingDateRows.has(d.id),m=s.invalidDateRows.has(d.id),p=s.invalidAmountRows.has(d.id);return t.jsx("div",{className:"flex w-full flex-col gap-1",children:t.jsxs("div",{className:"grid w-full grid-cols-[2rem_minmax(0,1fr)_minmax(0,1fr)_2.25rem] items-start gap-4",children:[t.jsx("span",{className:"pt-2 text-sm font-medium text-zinc-500",children:u+1}),t.jsx("div",{className:"min-w-0 flex-1",children:t.jsx(Fs,{variant:"bordered","aria-label":`${a.dueDate} ${u+1}`,isDisabled:gt(d.status),isInvalid:f||m,errorMessage:f?a.dueDateRequiredError:m?a.dateOrderError:void 0,value:En(d.dueDate),onChange:x=>o(d.id,{dueDate:x?x.toString():""})})}),t.jsx("div",{className:"min-w-0 flex-1",children:t.jsx(cf,{amount:d.amount,ariaLabel:`${a.amount} ${u+1}`,isDisabled:gt(d.status),isInvalid:p,errorMessage:a.amountGreaterThanZeroError,onAmountChange:x=>o(d.id,{amount:x})})}),t.jsx(df,{isDisabled:n.length<=1,isPaid:gt(d.status),label:a.deleteInstallment,onRemove:()=>l(d.id)})]})},d.id)})})}const of=/^\d*(?:[.,]\d{0,2})?$/;function cf({amount:e,ariaLabel:n,isDisabled:s,isInvalid:a,errorMessage:r,onAmountChange:i}){const[o,l]=h.useState(null);return t.jsx(c.Input,{variant:"bordered","aria-label":n,type:"text",inputMode:"decimal",autoComplete:"off",isDisabled:s,isInvalid:a,errorMessage:a?r:void 0,value:o??(e?String(e):""),onChange:d=>{const u=d.target.value.trim();if(!of.test(u))return;l(u);const f=Number(u.replace(",","."));i(vn(Number.isFinite(f)?f:0))},onBlur:()=>l(null),startContent:t.jsx("span",{className:"text-zinc-900",children:"$"})})}function df({isDisabled:e,isPaid:n,label:s,onRemove:a}){const r=t.jsx(O,{type:"button",isIconOnly:!0,variant:"flat",radius:"full",className:"h-9 w-9 flex-none bg-danger-100 p-0 text-danger-600",style:{height:36,minWidth:36,width:36},isDisabled:e||n,onPress:a,"aria-label":s,children:t.jsx(P,{icon:"solar:trash-bin-minimalistic-outline",className:"size-5"})});return n?t.jsx(c.Tooltip,{content:"This payment cannot be edited or deleted because it has already been paid.",placement:"top",children:t.jsx("span",{className:"inline-flex",children:r})}):r}function uf({total:e,donationAmount:n,hasTotalMismatch:s,mode:a,installments:r,formatter:i,labels:o,className:l}){const d=r.length,u=r[0]?.amount??0,f=r[1]?.amount??u,m=d>1&&Math.round(u*100)!==Math.round(f*100),p=vn(n-e),x=Math.max(p,0),g=Math.max(-p,0),y=s?t.jsxs("span",{children:[o.totalError,". Total scheduled: ",t.jsx("strong",{children:i.format(e)})," /"," ",t.jsx("strong",{children:i.format(n)}),"."]}):a==="automatic"?m?t.jsxs("span",{children:["Saving will create ",t.jsx("strong",{children:d})," scheduled payment records:"," ",t.jsx("strong",{children:i.format(u)})," first charge and"," ",t.jsx("strong",{children:i.format(f)})," for each remaining charge."]}):t.jsxs("span",{children:["Saving will create ",t.jsx("strong",{children:d})," scheduled payment records of"," ",t.jsx("strong",{children:i.format(u)})," each."]}):t.jsxs("span",{children:["Total scheduled: ",t.jsx("strong",{children:i.format(e)})," /"," ",t.jsx("strong",{children:i.format(n)}),"."]}),b=a==="automatic"?`Total: ${i.format(e)}`:g>0?`Exceeds by: ${i.format(g)}`:`${o.remaining}: ${i.format(x)}`;return t.jsx(c.Alert,{isClosable:!1,color:s?"danger":"default",variant:"flat",radius:"full",className:l,endContent:t.jsx("span",{className:"whitespace-nowrap",children:b}),title:y})}function mf(){return t.jsxs("section",{className:"flex w-full flex-col gap-4 rounded-2xl border border-zinc-200 bg-white p-4 shadow-sm","aria-busy":"true",children:[t.jsxs("div",{className:"flex items-start justify-between gap-3",children:[t.jsx(c.Skeleton,{className:"h-7 w-56 rounded-lg"}),t.jsx(c.Skeleton,{className:"size-8 rounded-full"})]}),t.jsxs("div",{className:"flex items-center justify-between gap-3",children:[t.jsx(c.Skeleton,{className:"h-10 w-72 rounded-full"}),t.jsx(c.Skeleton,{className:"h-10 w-40 rounded-full"})]}),t.jsxs("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-end sm:justify-between",children:[t.jsxs("div",{className:"flex w-full max-w-[280px] flex-col gap-2",children:[t.jsx(c.Skeleton,{className:"h-4 w-36 rounded-md"}),t.jsx(c.Skeleton,{className:"h-9 w-full rounded-xl"})]}),t.jsx(c.Skeleton,{className:"h-9 w-36 rounded-full"})]}),t.jsx("div",{className:"flex flex-col gap-3",children:Array.from({length:4}).map((e,n)=>t.jsxs("div",{className:"grid grid-cols-[minmax(0,1fr)_160px] items-center gap-4 rounded-2xl border border-zinc-100 p-3",children:[t.jsx(c.Skeleton,{className:"h-8 w-full max-w-xs rounded-full"}),t.jsx(c.Skeleton,{className:"h-8 w-full rounded-xl"})]},n))})]})}const Za={paid:"bg-emerald-50 text-emerald-700",scheduled:"bg-blue-50 text-blue-700",schedule:"bg-blue-50 text-blue-700",payment_due:"bg-amber-50 text-amber-700",overdue:"bg-orange-50 text-orange-700",failed:"bg-red-50 text-red-700",refunded:"bg-zinc-100 text-zinc-600",partially_refunded:"bg-lime-50 text-lime-800",disputed:"bg-purple-50 text-purple-700",canceled:"bg-zinc-100 text-zinc-600",processing:"bg-sky-50 text-sky-700",pending_confirmation:"bg-indigo-50 text-indigo-700"},Ki={paid:"Paid",scheduled:"Scheduled",schedule:"Scheduled",payment_due:"Payment Due",overdue:"Overdue",failed:"Failed",refunded:"Refunded",partially_refunded:"Partially refunded",disputed:"Disputed",canceled:"Canceled",processing:"Processing",pending_confirmation:"Pending Confirmation"},ff={title:"Payments",saved:"Saved",searchLabel:"Search a payment",searchPlaceholder:"Search a payment by name, ID, or date...",editInstallments:"Edit Payment",installmentId:"Payment",amount:"Amount",scheduledDate:"Scheduled Date",paidOn:"Paid on",partiallyRefunded:Ki.partially_refunded,refundedAmount:"Refunded",status:"Status",actions:"Actions",payNow:"Pay now",sendLink:"Send Link",sendLinkDescription:"Send a payment link to the contact",dangerZone:"Danger zone",deleteInstallment:"Delete Payment",deleteInstallmentDescription:"Remove Payment from Opportunity",deleteInstallmentConfirmationTitle:"Delete Payment",deleteInstallmentConfirmationDescription:t.jsxs(t.Fragment,{children:["Are you sure you want to delete this payment? ",t.jsx("strong",{children:"This action cannot be undone."})]}),deleteInstallmentConfirmationCancel:"Cancel",deleteInstallmentConfirmationConfirm:"Confirm",noInstallmentsFound:"No payments found."},xf={wrapper:"!absolute !inset-0 !z-50 !items-center !justify-center !p-4",backdrop:"!absolute !inset-0 !z-40 rounded-2xl"},pf=[];function hf({installments:e,currency:n,locale:s="en-US",showTitle:a=!0,showCard:r=!0,showEditPayment:i=!0,showDelete:o=!0,payNowHiddenStatuses:l=pf,showSavedIndicator:d=!1,labels:u,isSaving:f=!1,onEditInstallments:m,onPayInstallment:p,onDeleteInstallment:x}){const[g,y]=h.useState(null),b={...ff,...u},[j,w]=h.useState(""),$=new Intl.NumberFormat(s,{style:"currency",currency:n}),N=e.some(S=>Yi(S)!==null),A=e.some(S=>S.status==="partially_refunded"),k=a?t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(X.CircleDollarSign,{className:"size-4 text-zinc-500",strokeWidth:1.75}),t.jsx("span",{className:"text-base font-medium leading-6 text-zinc-950",children:b.title}),d?t.jsx(c.Chip,{size:"sm",radius:"full",color:"success",variant:"flat",children:b.saved}):null]}):void 0,C=h.useMemo(()=>{const S=j.trim().toLowerCase();if(!S)return e;const _=new Intl.NumberFormat(s,{style:"currency",currency:n});return e.filter(F=>{const L=F.status??"scheduled";return[Yn(F),F.id,F.amount,F.dueDate,mn(F.dueDate,s),Qn(F,b.paidOn,s),Zn(F,b.refundedAmount,_),L,Xn(L,b.partiallyRefunded)].join(" ").toLowerCase().includes(S)})},[s,n,e,j,b.paidOn,b.refundedAmount,b.partiallyRefunded]),D=t.jsxs("div",{className:"flex min-w-0 w-full flex-col gap-4 overflow-x-hidden [container-type:inline-size]",children:[t.jsxs("div",{className:"flex min-w-0 w-full flex-wrap items-end justify-between gap-4",children:[t.jsxs("div",{className:"min-w-0 w-full max-w-[280px]",children:[t.jsx("label",{className:"mb-1 block text-sm font-normal text-zinc-950",children:b.searchLabel}),t.jsx(c.Input,{variant:"bordered",size:"md",value:j,placeholder:b.searchPlaceholder,onChange:S=>w(S.target.value),startContent:t.jsx(P,{icon:"solar:magnifer-outline",className:"size-4 text-zinc-500"})})]}),i?t.jsx(O,{type:"button",variant:"bordered",radius:"full",size:"md",className:"h-10 border-zinc-200 bg-white px-4 text-sm font-normal text-zinc-900",startContent:t.jsx(P,{icon:"solar:pen-outline",className:"size-4"}),isLoading:f,onPress:m,children:b.editInstallments}):null]}),t.jsx("div",{className:c.cn("hidden [@container(max-width:767px)]:block",C.length>3&&"max-h-[560px] overflow-y-auto pr-1"),children:t.jsxs("div",{className:"flex flex-col gap-2",children:[C.map((S,_)=>{const F=S.status??"scheduled",L=Yn(S),M=Qn(S,b.paidOn,s),I=Zn(S,b.refundedAmount,$);return t.jsx(c.Card,{radius:"lg",shadow:"none",className:"border border-default-200",children:t.jsxs(c.CardBody,{className:"gap-3 p-3",children:[t.jsxs("div",{className:"flex items-start justify-between gap-2",children:[t.jsxs("div",{className:"min-w-0",children:[t.jsxs("p",{className:"text-xs text-default-500",children:["#",_+1]}),t.jsx("p",{className:"truncate text-sm font-medium text-foreground",children:L||`PMT-${_+1}`})]}),t.jsx(Xa,{status:F,label:Xn(F,b.partiallyRefunded)})]}),t.jsxs("div",{className:"grid grid-cols-2 gap-2 text-sm",children:[t.jsxs("div",{children:[t.jsx("p",{className:"text-xs text-default-500",children:b.amount}),t.jsx("p",{className:"font-medium text-foreground",children:$.format(S.amount)}),I?t.jsx("p",{className:"text-xs text-default-500",children:I}):null]}),t.jsxs("div",{className:"text-right",children:[t.jsx("p",{className:"text-xs text-default-500",children:b.scheduledDate}),t.jsx("p",{className:"font-medium text-foreground",children:mn(S.dueDate,s)}),M?t.jsx("p",{className:"text-xs text-default-500",children:M}):null]})]}),t.jsx(Ja,{status:F,installment:S,labels:b,portalContainer:g??void 0,showDelete:o,payNowHiddenStatuses:l,onPayInstallment:p,onDeleteInstallment:x})]})},S.id)}),C.length===0&&t.jsx("div",{className:"rounded-lg border border-default-200 px-4 py-6 text-center text-sm text-default-500",children:b.noInstallmentsFound})]})}),t.jsx("div",{className:c.cn("w-full overflow-x-hidden [@container(max-width:767px)]:hidden",C.length>5&&"max-h-[344px] overflow-y-auto pr-1"),children:t.jsxs("table",{className:"w-full table-fixed border-collapse text-left text-sm",children:[t.jsxs("colgroup",{children:[t.jsx("col",{className:"w-12"}),t.jsx("col",{}),t.jsx("col",{className:N?"w-32":"w-24"}),t.jsx("col",{className:"w-36"}),t.jsx("col",{className:A?"w-44":"w-36"}),t.jsx("col",{className:"w-44"})]}),t.jsx("thead",{children:t.jsxs("tr",{className:"sticky top-0 z-10 border-b border-zinc-200 bg-white text-zinc-900",children:[t.jsx("th",{className:"px-2 py-3 font-medium",children:"#"}),t.jsx("th",{className:"px-2 py-3 font-medium",children:b.installmentId}),t.jsx("th",{className:"px-2 py-3 font-medium",children:b.amount}),t.jsx("th",{className:"px-2 py-3 font-medium",children:b.scheduledDate}),t.jsx("th",{className:"whitespace-nowrap px-2 py-3 font-medium",children:b.status}),t.jsx("th",{className:"whitespace-nowrap py-3 pl-4 pr-2 font-medium",children:b.actions})]})}),t.jsxs("tbody",{children:[C.map((S,_)=>{const F=S.status??"scheduled",L=Yn(S),M=Qn(S,b.paidOn,s),I=Zn(S,b.refundedAmount,$);return t.jsxs("tr",{className:"text-zinc-500",children:[t.jsx("td",{className:"px-2 py-3",children:_+1}),t.jsx("td",{className:"overflow-hidden px-2 py-3",children:t.jsx("span",{className:"block w-full truncate",children:L||`PMT-${_+1}`})}),t.jsxs("td",{className:"px-2 py-3",children:[$.format(S.amount),I?t.jsx("span",{className:"block text-xs",children:I}):null]}),t.jsxs("td",{className:"px-2 py-3",children:[mn(S.dueDate,s),M?t.jsx("span",{className:"block text-xs",children:M}):null]}),t.jsx("td",{className:"whitespace-nowrap px-2 py-3",children:t.jsx(Xa,{status:F,label:Xn(F,b.partiallyRefunded)})}),t.jsx("td",{className:"whitespace-nowrap py-3 pl-4 pr-2",children:t.jsx(Ja,{status:F,installment:S,labels:b,portalContainer:g??void 0,showDelete:o,payNowHiddenStatuses:l,onPayInstallment:p,onDeleteInstallment:x})})]},S.id)}),C.length===0&&t.jsx("tr",{children:t.jsx("td",{colSpan:6,className:"px-2 py-6 text-center text-zinc-500",children:b.noInstallmentsFound})})]})]})})]});return t.jsx("div",{ref:y,className:"vvt-ps relative min-w-0 w-full overflow-x-hidden [container-type:inline-size] font-sans text-zinc-900",children:r?t.jsx(c.Accordion,{variant:"splitted",defaultSelectedKeys:["installment-table"],className:"min-w-0 w-full gap-0 px-0",itemClasses:{base:"min-w-0 w-full overflow-x-hidden rounded-2xl border border-zinc-200 bg-white p-0 shadow-sm",trigger:"px-4 py-4",title:"w-full",content:"min-w-0 w-full overflow-x-hidden px-4 pb-4 pt-0",indicator:"text-zinc-500 [&>svg]:size-4"},children:t.jsx(c.AccordionItem,{"aria-label":b.title,title:k,children:D},"installment-table")}):D})}function Yn(e){return e.name?.trim()||e.id}function Qn(e,n,s){return!gt(e.status)||!e.fulfilledAt?null:`${n} ${mn(e.fulfilledAt,s)}`}function Yi(e){const{refundedAmount:n}=e;return e.status!=="partially_refunded"||typeof n!="number"||!Number.isFinite(n)||n<=0?null:n}function Zn(e,n,s){const a=Yi(e);return a===null?null:`${n} ${s.format(a)}`}function Xn(e,n){return e==="partially_refunded"?n:Ki[e]??e}function Xa({status:e,label:n}){return t.jsx(c.Chip,{size:"md",radius:"lg",className:c.cn("justify-center px-4",Za[e]??Za.scheduled),startContent:t.jsx(gf,{status:e}),children:n})}function Ja({status:e,installment:n,labels:s,portalContainer:a,showDelete:r,payNowHiddenStatuses:i,onPayInstallment:o,onDeleteInstallment:l}){const d=!i.includes(e),u=gt(e);return t.jsxs("div",{className:"flex min-w-36 items-center justify-start gap-2",children:[d?t.jsx(O,{type:"button",size:"md",color:"primary",variant:"solid",radius:"full",className:"min-w-[104px] shrink-0",isDisabled:u,startContent:t.jsx(P,{icon:"solar:dollar-minimalistic-outline",className:"size-4"}),onPress:()=>o?.(n),children:s.payNow}):null,t.jsx(bf,{isFulfilled:u,showDelete:r,labels:s,portalContainer:a,onDelete:()=>l(n.id)})]})}function bf({isFulfilled:e,showDelete:n,labels:s,portalContainer:a,onDelete:r}){const[i,o]=h.useState(!1);return t.jsxs(t.Fragment,{children:[t.jsxs(c.Dropdown,{placement:"bottom-end",radius:"lg",children:[t.jsx(c.DropdownTrigger,{children:t.jsx(O,{type:"button",isIconOnly:!0,size:"sm",variant:"light",className:"text-zinc-900","aria-label":"More actions",children:t.jsx(P,{icon:"solar:menu-dots-bold",className:"size-4"})})}),t.jsxs(c.DropdownMenu,{"aria-label":"Installment actions",disabledKeys:e?["send-link","delete"]:[],className:"w-72 p-2",onAction:l=>{l==="delete"&&n&&!e&&o(!0)},children:[t.jsx(c.DropdownSection,{title:"Actions",showDivider:n,children:t.jsx(c.DropdownItem,{textValue:s.sendLink,description:s.sendLinkDescription,startContent:t.jsx(P,{icon:"solar:link-outline",className:"size-5 text-zinc-500"}),children:s.sendLink},"send-link")}),n?t.jsx(c.DropdownSection,{title:s.dangerZone,children:t.jsx(c.DropdownItem,{textValue:s.deleteInstallment,className:"text-danger-600",color:"danger",description:s.deleteInstallmentDescription,startContent:t.jsx(P,{icon:"solar:trash-bin-minimalistic-outline",className:"size-5"}),children:s.deleteInstallment},"delete")}):null]})]}),n?t.jsx(Us,{isOpen:i,labels:{title:s.deleteInstallmentConfirmationTitle,description:s.deleteInstallmentConfirmationDescription,cancel:s.deleteInstallmentConfirmationCancel,confirm:s.deleteInstallmentConfirmationConfirm},icon:t.jsx(P,{icon:"solar:danger-triangle-outline",className:"size-7"}),confirmColor:"danger",portalContainer:a,shouldBlockScroll:!1,classNames:xf,onClose:()=>o(!1),onConfirm:()=>{o(!1),r()}}):null]})}function gf({status:e}){return e==="paid"?t.jsx(P,{icon:"solar:check-circle-bold",className:"size-3"}):e==="failed"?t.jsx(P,{icon:"solar:close-circle-bold",className:"size-3"}):e==="partially_refunded"?t.jsx(P,{icon:"solar:undo-left-round-bold",className:"size-3"}):e==="processing"?t.jsx(P,{icon:"solar:refresh-circle-bold",className:"size-3"}):e==="pending_confirmation"?t.jsx(P,{icon:"solar:clock-circle-bold",className:"size-3"}):t.jsx(P,{icon:"solar:calendar-outline",className:"size-3"})}const yf=/^\d{4}-\d{2}-\d{2}$/;function mn(e,n){const s=yf.test(e)?new Date(`${e}T00:00:00`):new Date(e);return Number.isNaN(s.getTime())?e:new Intl.DateTimeFormat(n,{month:"short",day:"numeric",year:"numeric"}).format(s)}const vf={title:"Select Membership",renewalTitle:"Automatic Renewal",renewalDescription:"Membership will automatically renew at the end of each period"},jf=({cards:e,locale:n,currency:s,listHeightClassName:a="",labels:r,showRenewal:i=!0,defaultRenewalValue:o=!1,initialSelectedMembershipId:l=null,allowReselect:d=!0,onRenewalChange:u,onCardSelect:f,className:m=""})=>{const p=Array.isArray(e)?e:[],[x,g]=h.useState(l),[y,b]=h.useState(o),j={...vf,...r};h.useEffect(()=>{g(l)},[l]);const w=N=>{if(N===x){d&&f?.(N);return}g(N),f?.(N)},$=N=>{b(N),u?.(N)};return t.jsxs("div",{className:c.cn("w-full flex flex-col gap-4 items-start p-4 h-svh",m),"data-testid":"membership-select-cards",children:[t.jsx("span",{className:"hidden","data-testid":"membership-select-cards-selected-id",children:x??""}),t.jsx("p",{className:"text-2xl font-semibold text-left","data-testid":"membership-select-cards-title",children:j.title}),i&&t.jsx(el,{title:j.renewalTitle,description:j.renewalDescription,value:y,onValueChange:$}),t.jsx("div",{className:c.cn("w-full min-h-0 flex flex-col gap-4 overflow-y-auto",a===""?"flex-1":c.cn("shrink-0",a)),"data-testid":"membership-select-cards-list",children:p.map(N=>t.jsx(Qi,{itemKey:N.id,name:N.name,type:N.type,price:N.price,locale:n,currency:s,isSelected:x===N.id,onSelect:w},N.id))})]})},Qi=({itemKey:e,name:n,type:s,price:a,locale:r="en-US",currency:i="USD",showPrice:o=!0,isSelected:l=!1,onSelect:d,compact:u=!1,isDisabled:f=!1,disabledReason:m,statusLabel:p,statusTone:x="default",className:g=""})=>{const y=new Intl.NumberFormat(r,{style:"currency",currency:i,minimumFractionDigits:0,maximumFractionDigits:2}).format(a),b=!!d&&!f,j=m||p,w=()=>{b&&d?.(e)};return t.jsx(c.Card,{shadow:"none",isPressable:!!d,onPress:w,className:c.cn("w-full min-h-fit border rounded-3xl",l?"border-primary bg-primary/5":"border-default",f?"opacity-60":"",u?"rounded-2xl":"",g),"data-testid":"item-card","data-selected":l,isDisabled:f,children:t.jsxs("div",{className:c.cn("px-4 py-8 flex gap-6 items-center justify-between",u&&"px-3 py-3 gap-4"),children:[t.jsxs("div",{className:"w-max flex flex-col gap-1 items-start",children:[t.jsx("p",{className:c.cn("font-semibold text-left",u?"text-sm":"text-xl"),"data-testid":"item-card-name",children:n}),s&&t.jsx("div",{"data-testid":"item-card-type",className:"w-fit bg-default-300 px-4 py-2 text-sm rounded-xl",children:t.jsx("p",{className:"text-center",children:s})}),j&&t.jsx(c.Chip,{"data-testid":"item-card-status",color:x,size:"sm",variant:"flat",className:"px-2",children:j})]}),o&&t.jsx("p",{className:c.cn("font-semibold text-right",u?"text-lg":"text-2xl"),"data-testid":"item-card-price",children:y})]})})},er="w-full bg-gray-100",tr={variant:"light",color:"default"},Zi=({id:e,title:n,media:s,imageUrl:a,imageAlt:r,imageClassName:i="",imageAspect:o="aspect-[4/3]",meta:l=[],price:d,action:u,footer:f,onPress:m,isPressable:p=!1,isDisabled:x=!1,compact:g=!1,className:y="",bodyClassName:b="",footerClassName:j="",dataTestId:w})=>{const $=!!(d&&d.value),N=!!u?.label,A=p&&!!m&&!N,k=!A,C=N?{variant:u?.variant??tr.variant,color:u?.color??tr.color,size:u?.size??"sm",isDisabled:x||u?.isDisabled,startContent:u?.icon?t.jsx(P,{icon:u.icon,width:16}):void 0}:null,D=s??(a?t.jsx("div",{className:c.cn("relative overflow-hidden rounded-xl",o,er,i),children:t.jsx(c.Image,{removeWrapper:!0,src:a,alt:r||n,className:"size-full object-cover",classNames:{wrapper:"absolute inset-0"}})}):t.jsx("div",{className:c.cn("relative overflow-hidden rounded-xl",o,er,"grid place-items-center",i),"data-testid":`catalog-item-card-${e??"media"}-fallback`,children:t.jsx(P,{icon:"solar:ticket-outline",width:48,className:"text-default-400"})}));return t.jsxs(c.Card,{"data-testid":w||`catalog-item-card-${e??"item"}`,className:c.cn("w-full overflow-hidden",y),isPressable:A,onPress:m,isDisabled:x,shadow:"sm",radius:"lg",children:[t.jsx("div",{children:D}),t.jsxs(c.CardBody,{className:c.cn("gap-3",g?"p-3":"p-4",b),children:[t.jsx("h3",{"data-testid":`catalog-item-card-title-${e??""}`,className:c.cn("line-clamp-2 text-base font-semibold text-gray-900",g?"text-sm":""),children:n}),l.length>0?t.jsx("div",{className:"flex flex-col gap-1.5 text-sm text-gray-600","data-testid":`catalog-item-card-meta-${e??""}`,children:l.map((S,_)=>t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(P,{icon:S.icon,className:"size-4 text-gray-400",width:16}),t.jsx("span",{children:S.label})]},`${S.label}-${_}`))}):null,($||N)&&t.jsxs("div",{className:c.cn("flex items-center justify-end gap-2 pt-1 text-sm",g?"pt-0.5":"",j),children:[$?t.jsxs("span",{className:c.cn("mr-auto text-gray-500",g?"text-xs":""),"data-testid":`catalog-item-card-price-${e??""}`,children:[d?.label&&t.jsxs("span",{children:[d.label," "]}),t.jsx("span",{className:"font-semibold text-brand",children:d?.value})]}):t.jsx("span",{className:"ml-auto","aria-hidden":!0}),N&&k?t.jsx(O,{className:c.cn("rounded-full",u?.className),onPress:u?.onPress,variant:C?.variant,color:C?.color,size:C?.size,startContent:C?.startContent,isDisabled:C?.isDisabled,"aria-label":u?.ariaLabel||u?.label,children:u?.label}):null]}),f?t.jsx("div",{className:"pt-1",children:f}):null]})]})};Zi.displayName="CatalogItemCard";const wf={open:"Open","selling-fast":"Selling fast","sold-out":"Sold out"};function Xi({title:e,subtitle:n,price:s,imageUrl:a,status:r,isDisabled:i=!1,onPress:o,className:l}){return t.jsx(c.Card,{isPressable:!!o,isDisabled:i,onPress:o,shadow:"none",radius:"lg",className:c.cn("w-full border border-pos-hair",l),children:t.jsxs(c.CardBody,{className:"flex-row items-center gap-5 p-4",children:[t.jsx("div",{className:"grid size-[4.875rem] shrink-0 place-items-center overflow-hidden rounded-xl bg-default-100 text-default-500",children:a?t.jsx(c.Image,{removeWrapper:!0,src:a,alt:"",className:"size-full object-cover"}):t.jsx(P,{icon:"solar:ticket-outline",width:28})}),t.jsxs("div",{className:"min-w-0 flex-1",children:[t.jsx("h3",{className:"truncate text-lg font-semibold text-foreground",children:e}),t.jsx("p",{className:"mt-1 text-base text-default-500",children:n})]}),r?t.jsx("span",{"data-status":r,className:"rounded-full bg-default-100 px-3 py-1 text-sm font-medium text-default-600",children:wf[r]}):null,s?t.jsxs("strong",{className:"ml-5 whitespace-nowrap text-xl",children:["from ",s]}):null]})})}Xi.displayName="ProgramListItem";const Nf={card:"gap-3 rounded-xl border border-dashed px-6 py-12",panel:"px-6 py-[72px]"},Cf={card:"size-12 rounded-2xl",panel:"size-[76px] rounded-[20px] border mb-[18px]"},kf={card:"text-base font-medium text-default-900",panel:"text-[17px] font-semibold text-acct-ink"},Sf={card:"max-w-sm text-sm text-default-600",panel:"max-w-[380px] text-sm text-acct-sub mt-1.5"},$f={card:"mt-1",panel:"mt-[22px]"},Af="bg-acct-page border-acct-border text-acct-muted",Df={empty:"solar:inbox-line-duotone",error:"solar:danger-triangle-outline",success:"solar:check-circle-bold"},Ef={empty:"border-default-200 bg-white",error:"border-danger-200 bg-white",success:"border-success-100 bg-success-50/40",loading:"border-default-200 bg-white"},Lf={empty:"bg-default-100 text-default-400",error:"bg-danger-50 text-danger-600",success:"bg-success-100 text-success-700",loading:"bg-primary-50 text-primary"},Ff={empty:"status",error:"alert",success:"status",loading:"status"},Rf={empty:"polite",error:"assertive",success:"polite",loading:"polite"};function _f(e,n,s,a){if(n===!1)return null;if(e==="loading"&&n===void 0)return t.jsx(c.Spinner,{size:"lg",color:"primary",className:a.spinner});if(h.isValidElement(n))return t.jsx(t.Fragment,{children:n});const r=typeof n=="string"?n:Df[e];return r?t.jsx(P,{icon:r,width:s,height:s,"aria-hidden":"true",className:a.icon}):null}function Lt({variant:e="empty",surface:n="card",title:s,titleAs:a="p",description:r,icon:i,actions:o,role:l=Ff[e],ariaLive:d=Rf[e],iconSize:u=24,className:f,classNames:m={},"data-testid":p="feedback-state"}){const x=_f(e,i,u,m);return t.jsxs("div",{role:l,"aria-live":d,"data-variant":e,"data-testid":p,"data-surface":n,className:c.cn("flex flex-col items-center justify-center text-center",Nf[n],n==="card"?Ef[e]:"bg-transparent",f,m.base),children:[x?t.jsx("span",{"aria-hidden":"true","data-testid":`${p}-icon`,className:c.cn("inline-flex items-center justify-center",Cf[n],e==="success"&&n==="card"&&"rounded-full",n==="panel"?Af:Lf[e],m.iconWrapper),children:x}):null,t.jsxs("div",{className:c.cn("flex flex-col items-center",n==="card"&&"gap-1"),children:[t.jsx(a,{"data-testid":`${p}-title`,className:c.cn(kf[n],m.title),children:s}),r?t.jsx("p",{"data-testid":`${p}-description`,className:c.cn(Sf[n],m.description),children:r}):null]}),o?t.jsx("div",{"data-testid":`${p}-actions`,className:c.cn("flex flex-wrap items-center justify-center gap-2",$f[n],m.actions),children:o}):null]})}function Hs(e){return t.jsx(Lt,{...e,variant:"empty"})}function Ws(e){return t.jsx(Lt,{...e,variant:"error"})}function qs(e){return t.jsx(Lt,{...e,variant:"loading"})}function Ji(e){return t.jsx(Lt,{...e,variant:"success"})}Lt.displayName="FeedbackState";Hs.displayName="EmptyState";Ws.displayName="ErrorState";qs.displayName="LoadingState";Ji.displayName="SuccessState";const el=({title:e,value:n,description:s,onValueChange:a,className:r=""})=>{const i=h.useId();return t.jsxs("div",{className:c.cn("w-full flex flex-row items-center",e||s?"justify-between gap-6":"justify-start",r),"data-testid":"toggle",children:[t.jsxs("div",{className:"flex flex-col items-start",children:[e&&t.jsx("label",{htmlFor:i,className:"font-medium text-left","data-testid":"toggle-title",children:e}),s&&t.jsx("p",{className:"text-left text-gray-500","data-testid":"toggle-description",children:s})]}),t.jsx(c.Switch,{id:i,isSelected:n,onValueChange:a,"data-testid":"toggle-switch"})]})},Mf={ticketSelectionTitle:"Choose tickets to be upgraded",ticketsAllowedToRedeem:"Tickets allowed to redeem:",ticketsSelectedToRedeem:"Tickets selected to redeem",noUpgradeTicketsAvailable:"No upgrade tickets available to select",selectAllButtonLabel:"Select All"},Pf=(e,n)=>new Intl.NumberFormat(e,{style:"currency",currency:n}),tl=e=>Object.values(e).reduce((n,s)=>n+Object.values(s).reduce((a,r)=>a+Object.values(r).reduce((i,o)=>i+o.selectedQuantity,0),0),0),Tf=e=>e.reduce((n,s)=>n+s.dates.reduce((a,r)=>a+r.tickets.reduce((i,o)=>i+o.max,0),0),0),Gs=e=>e.flatMap(n=>n.dates.flatMap(s=>s.tickets.map(a=>({exhibition:n,dateGroup:s,ticket:a})))),nr=(e,n,s)=>{const a={};let r=s?n??Tf(e):0;for(const{exhibition:i,dateGroup:o,ticket:l}of Gs(e)){a[i.id]??={},a[i.id][o.id]??={};const d=s?Math.min(l.max,r):0;a[i.id][o.id][l.id]={id:l.id,selectedQuantity:d,originalPrice:l.originalPrice,discountedPrice:l.price},r-=d}return a},sr=(e,n,s)=>`${e}::${n}::${s}`,If=(e,n,s)=>{const a=tl(n);for(const{exhibition:r,dateGroup:i,ticket:o}of Gs(e)){const l=n[r.id]?.[i.id]?.[o.id]?.selectedQuantity??0,d=s===void 0?o.max:Math.min(o.max,s-(a-l));if(d>0&&l<d)return!1}return!0},Of=({initialQuantity:e=1,minQuantity:n=1,maxQuantity:s=10,onChange:a,disabled:r=!1})=>{const i=Math.max(n,Math.min(s,e)),[o,l]=h.useState(()=>String(i)),[d,u]=h.useState(!1),f=d?o:String(i),m=()=>{r||i>=s||a?.(i+1)},p=()=>{r||i<=n||a?.(i-1)},x=N=>{if(r)return;l(N.target.value);const A=parseInt(N.target.value,10);isNaN(A)||a?.(Math.max(n,Math.min(s,A)))},g=N=>{const A=parseInt(N.target.value,10);if(u(!1),isNaN(A)){a?.(n);return}const k=Math.max(n,Math.min(s,A));k!==A?a?.(k):l(String(k))},y=i<=n,b=i>=s,j="w-10 h-10 flex items-center justify-center border-0 rounded-full cursor-pointer transition-colors duration-150 text-white text-2xl font-regular",w="bg-primary hover:bg-primary/80",$="bg-primary/40 cursor-not-allowed";return t.jsxs("div",{className:"flex items-center gap-4","data-testid":"quantity-selector",children:[t.jsx("button",{type:"button",onClick:p,disabled:r||y,className:c.cn(j,r||y?$:w),"aria-label":"Decrement quantity","data-testid":"quantity-decrement",children:"-"}),t.jsx("input",{type:"number",value:f,onChange:x,onFocus:()=>u(!0),onBlur:g,disabled:r,min:n,max:s,step:"1",className:"w-12 h-10 rounded-md border-0 bg-zinc-100 text-center text-2xl font-medium text-zinc-900 [appearance:textfield] [&::-webkit-inner-spin-button]:appearance-none [&::-webkit-outer-spin-button]:appearance-none","aria-label":`Selected quantity: ${i}`,"data-testid":"quantity-input"}),t.jsx("button",{type:"button",onClick:m,disabled:r||b,className:c.cn(j,r||b?$:w),"aria-label":"Increment quantity","data-testid":"quantity-increment",children:"+"})]})},zf=({label:e,checked:n=!1,onChange:s,disabled:a=!1})=>{const r=()=>{a||s?.(!n)};return t.jsxs("button",{type:"button",onClick:r,disabled:a,role:"checkbox","aria-checked":n,"data-testid":"checkbox-button","data-checked":n,className:c.cn("flex items-center gap-1.5 px-4 py-3 border-0 rounded-full cursor-pointer text-sm min-h-[30px]","outline-none select-none transition-colors bg-zinc-100 hover:bg-zinc-200 text-primary",a&&"cursor-not-allowed opacity-60"),children:[t.jsxs("span",{className:"relative flex items-center justify-center w-5 h-5 flex-shrink-0",children:[t.jsx("input",{type:"checkbox",checked:n,onChange:()=>{},disabled:a,className:"absolute opacity-0 w-0 h-0 pointer-events-none",tabIndex:-1,readOnly:!0}),t.jsx("span",{className:c.cn("block w-3.5 h-3.5 rounded-sm relative",n?"bg-primary":"bg-white ring-1 ring-zinc-300"),children:n&&t.jsx("span",{className:"absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-[60%] rotate-45 w-[3px] h-[5px] border border-white border-t-0 border-l-0","aria-hidden":"true"})})]}),t.jsx("p",{className:"flex-1 m-0 text-left leading-snug",children:e})]})},Bf=({item:e,quantity:n,onChange:s,getTotalSelectedTickets:a,userMaxLimit:r,settings:i,labels:o})=>{const l=()=>{if(!a||r===void 0)return e.max;const m=a();return Math.min(e.max,r-(m-n))},d=i?.locale??"en-US",u=i?.currency??"USD",f=Pf(d,u);return t.jsxs("div",{children:[t.jsxs("div",{className:"flex items-center justify-between bg-white px-3 py-2.5 gap-8","data-testid":"upgrade-ticket-item",children:[t.jsxs("div",{className:"min-w-0 flex flex-1 flex-col gap-2",children:[t.jsxs("div",{className:"flex min-w-0 items-start gap-3",children:[t.jsxs("h3",{className:"min-w-0 text-base font-semibold text-zinc-900 m-0","data-testid":"ticket-name",children:[e.name,typeof e.purchasedQuantity=="number"&&e.purchasedQuantity>1?t.jsx("span",{"data-testid":"ticket-purchased-quantity",children:` x${e.purchasedQuantity}`}):null]}),t.jsxs("div",{className:"flex shrink-0 items-center gap-1.5",children:[t.jsx("h3",{className:"line-through text-zinc-500 text-[0.9rem] font-normal m-0","data-testid":"ticket-original-price",children:f.format(e.originalPrice)}),t.jsx("h3",{className:"text-base font-semibold text-zinc-900 m-0","data-testid":"ticket-discounted-price",children:f.format(e.price)})]})]}),e.membershipName?t.jsx("div",{"data-testid":"ticket-membership-name",className:"max-w-full self-start rounded-2xl bg-default-100 px-3 py-1 text-xs text-default-700",title:e.membershipName,children:t.jsx("p",{className:"max-w-full truncate text-center",children:e.membershipName})}):null,t.jsx("div",{className:"text-sm text-zinc-500",children:t.jsxs("p",{className:"m-0","data-testid":"ticket-max",children:[o.ticketsAllowedToRedeem," ",e.max]})})]}),t.jsx(Of,{initialQuantity:n,minQuantity:0,maxQuantity:l(),onChange:s})]}),e.membershipAlert?t.jsx(c.Alert,{"data-testid":"ticket-membership-alert",color:"warning",variant:"flat",radius:"full",className:"ticket-selection-membership-alert mb-2 w-full max-w-full py-0 shadow-none",classNames:{base:"ticket-selection-membership-alert-base !min-h-8 !items-center !bg-[#F5CB24]/15 !text-[#5B2C0F] shadow-none",mainWrapper:"ticket-selection-membership-alert-main-wrapper m-0 min-h-8 !py-0 !px-0",alertIcon:"ticket-selection-membership-alert-icon w-4 h-4 !text-[#5B2C0F]",iconWrapper:"ticket-selection-membership-alert-icon-wrapper !min-w-0 !bg-transparent !border-none !shadow-none !rounded-none !p-0 !m-0 !w-4 !h-4",description:"ticket-selection-membership-alert-description !ms-2 !my-2 !text-[#5B2C0F]"},description:t.jsx("span",{className:"ticket-selection-membership-alert-description-text block w-full whitespace-normal break-words text-sm leading-4 text-[#5B2C0F]",children:e.membershipAlert})}):null]})},Vf=({exhibitionId:e,dateGroup:n,isLast:s=!1,onQuantityChange:a,getTicketQuantity:r,getTotalSelectedTickets:i,userMaxLimit:o,settings:l,labels:d})=>t.jsxs("div",{className:c.cn("flex flex-col gap-2 pb-3",!s&&"border-b border-zinc-200"),"data-testid":"upgrade-ticket-date-group",children:[t.jsx("p",{className:"m-0 text-sm text-left text-zinc-500","data-testid":"upgrade-ticket-date",children:n.date}),n.tickets.map((u,f)=>t.jsxs("div",{children:[t.jsx(Bf,{item:u,quantity:r(e,n.id,u.id),onChange:m=>a(e,n.id,u.id,m),getTotalSelectedTickets:i,userMaxLimit:o,settings:l,labels:d}),f<n.tickets.length-1?t.jsx(c.Divider,{className:"bg-zinc-200","data-testid":"upgrade-ticket-divider"}):null]},u.id))]}),Uf=({title:e,exhibition:n,onQuantityChange:s,getTicketQuantity:a,getTotalSelectedTickets:r,userMaxLimit:i,settings:o,labels:l,initialExpanded:d=!1})=>{const[u,f]=h.useState(d),m=n.dates.reduce((x,g)=>x+g.tickets.reduce((y,b)=>y+a(n.id,g.id,b.id),0),0),p=n.dates.some(x=>x.tickets.length>0);return t.jsxs("div",{className:"w-full overflow-hidden border-b border-zinc-200","data-testid":"upgrade-ticket-header",children:[t.jsx("button",{type:"button",className:"flex items-center w-full px-5 py-4 border-0 cursor-pointer transition-all bg-white hover:bg-zinc-100",onClick:()=>f(!u),"aria-expanded":u,"aria-controls":`upgrade-items-${n.id}`,"data-testid":"upgrade-ticket-header-button",children:t.jsxs("div",{className:"flex justify-between items-center w-full gap-6",children:[t.jsx("h4",{className:"m-0 text-base font-semibold text-left text-zinc-900","data-testid":"upgrade-ticket-header-title",children:e}),t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsxs("p",{className:"m-0 text-sm text-right text-zinc-500","data-testid":"upgrade-ticket-header-count",children:[m," ",l.ticketsSelectedToRedeem]}),t.jsx("span",{className:c.cn("inline-flex items-center justify-center text-zinc-500 text-xl transition-transform duration-200",u&&"rotate-180"),"aria-hidden":"true",children:t.jsx(P,{icon:"mdi:chevron-down"})})]})]})}),t.jsx("div",{id:`upgrade-items-${n.id}`,className:c.cn("transition-all duration-300 overflow-hidden",u?"max-h-[1000px] opacity-100":"max-h-0 opacity-0"),"aria-hidden":!u,children:u&&t.jsx("div",{className:"px-5 flex flex-col gap-6","data-testid":"upgrade-ticket-items",children:p?n.dates.map((x,g)=>t.jsx(Vf,{exhibitionId:n.id,dateGroup:x,isLast:g===n.dates.length-1,onQuantityChange:s,getTicketQuantity:a,getTotalSelectedTickets:r,userMaxLimit:i,settings:o,labels:l},x.id)):t.jsx("div",{className:"px-5 py-10 text-center",children:t.jsx("p",{className:"m-0 text-zinc-500 italic",children:l.noUpgradeTicketsAvailable})})})})]})},Hf=({initialExpanded:e=!1,userMaxLimit:n,labels:s,settings:a,ticketSelectionData:r,className:i="",onSelectionChange:o})=>{const l=h.useMemo(()=>r??[],[r]),d={...Mf,...s},[u,f]=h.useState(()=>nr(l,n,!0)),m=h.useRef(!1),p=h.useMemo(()=>{const w=Gs(l).map(({exhibition:$,dateGroup:N,ticket:A})=>[sr($.id,N.id,A.id),A]);return new Map(w)},[l]),x=If(l,u,n),g=(w,$,N)=>u[w]?.[$]?.[N]?.selectedQuantity??0,y=()=>tl(u),b=(w,$,N,A)=>{const k=g(w,$,N),C=y()-k;if(n!==void 0&&C+A>n)return;const D=p.get(sr(w,$,N));if(!D)return;const S={...u,[w]:{...u[w],[$]:{...u[w]?.[$],[N]:{id:N,selectedQuantity:A,originalPrice:D.originalPrice,discountedPrice:D.price}}}};f(S),o?.(S)},j=w=>{const $=nr(l,n,w);f($),o?.($)};return h.useEffect(()=>{!m.current&&x&&(o?.(u),m.current=!0)},[x,u,o]),t.jsxs("div",{className:c.cn("flex flex-col w-full font-sans",i),"data-testid":"ticket-selection",children:[t.jsxs("div",{className:"flex items-center justify-between py-2 gap-4","data-testid":"ticket-selection-header",children:[t.jsx("h3",{className:"text-xl font-semibold m-0","data-testid":"ticket-selection-title",children:d.ticketSelectionTitle}),t.jsx(zf,{label:d.selectAllButtonLabel,checked:x,onChange:j})]}),l.map(w=>t.jsx(Uf,{title:w.exhibitionName,exhibition:w,onQuantityChange:b,getTicketQuantity:g,getTotalSelectedTickets:y,userMaxLimit:n,settings:a,labels:d,initialExpanded:e},w.id))]})},Jn={confirm:"Confirm",clear:"Clear",noLabel:"Filters"},es=e=>{const n={};for(const s of e)s.type==="checkbox"?n[s.id]=[...s.selectedValues]:n[s.id]=s.selectedValue?[s.selectedValue]:[];return n},Wf=(e,n)=>{const s={};for(const a of n){if(a.type==="checkbox"){s[a.id]=e[a.id]??[...a.selectedValues];continue}const r=e[a.id]??[];s[a.id]=r.length>0?r[0]:null}return s},qf=e=>e.type==="checkbox"?e.selectedValues.length>0:e.selectedValue!==null,nl=({triggerLabel:e,triggerAriaLabel:n,triggerIcon:s="solar:tuning-square-outline",triggerVariant:a="bordered",triggerColor:r="default",triggerSize:i="sm",triggerClassName:o,popoverClassName:l,className:d,sections:u,onConfirm:f,onClear:m,appliedCount:p,countAriaLabel:x,countDisplay:g="badge",confirmLabel:y=Jn.confirm,clearLabel:b=Jn.clear,isOpen:j,defaultOpen:w=!1,onOpenChange:$,isDisabled:N=!1,closeOnConfirm:A=!0,keepOpenAfterClear:k=!1})=>{const[C,D]=h.useState(w),[S,_]=h.useState(()=>es(u)),F=j??C,L=p??u.filter(Y=>qf(Y)).length,M=Y=>{Y&&_(es(u)),j||D(Y),$?.(Y)},I=(Y,oe)=>{_(J=>({...J,[Y.id]:oe}))},W=(Y,oe)=>{_(J=>({...J,[Y.id]:oe?[oe]:[]}))},K=async()=>{_(es(u.map(Y=>Y.type==="checkbox"?{...Y,selectedValues:[]}:{...Y,selectedValue:null}))),await m(),k||M(!1)},z=async()=>{const Y=Wf(S,u);await f(Y),A&&M(!1)},ne=Y=>{if(Y.type==="checkbox")return t.jsx(c.CheckboxGroup,{label:Y.label,value:S[Y.id]??[],onValueChange:J=>I(Y,J),children:Y.options.map(J=>t.jsx(c.Checkbox,{value:J.value,isDisabled:J.isDisabled,children:J.label},J.value))},Y.id);const oe=S[Y.id]?.[0]??"";return t.jsx(c.RadioGroup,{label:Y.label,value:oe,onValueChange:J=>W(Y,J||null),children:Y.options.map(J=>t.jsx(c.Radio,{value:J.value,isDisabled:J.isDisabled,children:J.label},J.value))},Y.id)},G=h.useMemo(()=>L>0?x?.(L)||`${L} filters applied`:void 0,[x,L]),se=h.useMemo(()=>L===0?e||Jn.noLabel:x?x(L):`${e} (${L})`,[L,e,x]);return t.jsx("div",{className:d,children:t.jsxs(c.Popover,{isOpen:F,onOpenChange:M,placement:"bottom-end",children:[t.jsx(c.PopoverTrigger,{children:t.jsxs(O,{isDisabled:N,variant:a,color:r,size:i,className:o,"aria-label":n,"aria-haspopup":"dialog","aria-expanded":F,children:[t.jsx(P,{icon:s,width:16}),t.jsx("span",{children:e}),g==="badge"&&L>0?t.jsx("span",{className:"ml-1 inline-flex h-5 min-w-5 items-center justify-center rounded-full bg-gray-900 px-1.5 text-xs font-medium text-white","aria-label":G,children:L}):g==="summary"&&se!==e?t.jsx("span",{className:"text-xs",children:se}):null]})}),t.jsx(c.PopoverContent,{className:l,children:t.jsxs("div",{className:"flex w-full flex-col gap-5 px-4 py-4",children:[u.map(Y=>ne(Y)),t.jsxs("div",{className:"flex items-center justify-end gap-2 border-t border-gray-200 pt-3",children:[t.jsx(O,{variant:"light",color:"default",size:"sm",onPress:K,children:b}),t.jsx(O,{color:"primary",size:"sm",onPress:z,children:y})]})]})})]})})};nl.displayName="FilterPopover";const Gf="No sessions available for this date",Kf=e=>e==="sold-out"||e==="closed"?"danger":"success",Yf=e=>{const n=e.seatsRemaining;return e.status==="sold-out"||e.status==="closed"?"Sold out":e.status==="limited"?typeof n=="number"?`${n} left`:"Limited":typeof n=="number"?`${n} seats available`:"Available"},ar=e=>e.isDisabled?!0:e.status==="sold-out"||e.status==="closed",Qf=(e,n)=>n&&e.some(s=>s.date===n)?n:e[0]?.date??null,sl=({heading:e,subheading:n,days:s,selectedDate:a,onDateSelect:r,quickDates:i,selectedSessionId:o=null,onSessionSelect:l,emptyStateMessage:d=Gf,statusLabel:u,statusTone:f,sessionAriaLabel:m,dayButtonClassName:p,calendarSlot:x,dayGroupAriaLabel:g,sessionGridAriaLabel:y,className:b,headingClassName:j,subheadingClassName:w})=>{const $=Qf(s,a),N=s.find(S=>S.date===$),A=i??s.map(S=>({date:S.date,label:S.label})),k=N?.sessions??[],C=S=>S===$?"solid":"bordered",D=S=>{if(!ar(S)){if(S.id===o){l(null);return}l(S.id)}};return t.jsxs("section",{className:c.cn("flex flex-col gap-4 rounded-xl bg-white p-3 sm:p-4",b),"data-testid":"session-timeline-root",children:[t.jsxs("header",{className:"flex flex-col gap-1",children:[t.jsx("h2",{className:c.cn("text-base font-semibold text-gray-900",j),children:e}),n?t.jsx("p",{className:c.cn("text-sm text-gray-700",w),children:n}):null]}),t.jsxs("div",{className:"flex flex-wrap items-center gap-2",role:"group","aria-label":g||"Session days",children:[A.map(S=>t.jsx(O,{size:"sm",variant:C(S.date),color:"default",className:c.cn("rounded-full",p),isDisabled:S.isDisabled,onPress:()=>{r(S.date)},children:t.jsx("span",{children:S.label})},S.date)),x?t.jsx("div",{children:x}):null]}),t.jsxs("ul",{className:"grid grid-cols-1 gap-2 sm:grid-cols-3","aria-label":y||"Sessions",children:[k.length===0?t.jsx("li",{className:"rounded-lg bg-white px-4 py-6 text-center text-sm text-gray-600 sm:col-span-3",children:d}):null,k.map(S=>{const _=ar(S),F=S.id===o;return t.jsx("li",{className:"rounded-xl",children:t.jsx(c.Card,{shadow:"sm",radius:"lg",isPressable:!_,onPress:()=>{D(S)},"aria-disabled":_,"aria-pressed":_?void 0:F,className:c.cn("w-full",_?"bg-gray-100 opacity-70":"",F?"w-full ring-2 ring-gray-900":""),"aria-label":m?m(S,{isSelected:F,isUnavailable:_}):_?`${S.startTime} ${S.endTime} sold out`:`${S.startTime} ${S.endTime} available`,children:t.jsxs(c.CardBody,{className:"flex flex-col items-center gap-3 p-4 text-center",children:[t.jsxs("span",{className:"text-sm font-semibold text-gray-900",children:[S.startTime," – ",S.endTime]}),t.jsx(c.Chip,{size:"sm",color:f?f(S):Kf(S.status),variant:"flat",children:u?u(S):Yf(S)})]})})},S.id)})]})]})};sl.displayName="SessionTimeline";const bs=16,it=e=>`${e/bs}rem`;function Zf(){if(typeof document>"u"||typeof getComputedStyle!="function")return bs;const e=parseFloat(getComputedStyle(document.documentElement).fontSize);return Number.isFinite(e)&&e>0?e:bs}const Xt=(e,n)=>e>=n*Zf(),Xf=1120;function Ft(){const e=h.useRef(null),[n,s]=h.useState(0),[,a]=h.useState("");return h.useLayoutEffect(()=>{const r=e.current;if(!r||typeof ResizeObserver>"u")return;const i=new ResizeObserver(o=>{const l=o[o.length-1];l&&s(l.borderBoxSize?.[0]?.inlineSize??l.contentRect.width)});return s(r.getBoundingClientRect().width),i.observe(r),()=>i.disconnect()},[]),h.useEffect(()=>{if(typeof MutationObserver>"u")return;const r=document.documentElement,i=new MutationObserver(()=>a(getComputedStyle(r).fontSize));return i.observe(r,{attributes:!0,attributeFilter:["style","class"]}),()=>i.disconnect()},[]),{ref:e,width:n}}const Jf=48,Ke={base:"flex items-start gap-4",baseWide:"mb-5 flex-nowrap",baseNarrow:"mb-[0.875rem] flex-wrap",identity:"flex min-w-0 items-center gap-4",text:"min-w-0",titleWide:"text-[1.6875rem] font-semibold leading-[1.5] tracking-[-.02em] text-default-900",titleNarrow:"text-[1.375rem] font-semibold leading-[1.5] tracking-[-.02em] text-default-900",subtitleWide:"mt-[0.4375rem] max-w-[47.5rem] text-[0.875rem] leading-[1.55] text-default-500",subtitleNarrow:"mt-[0.4375rem] max-w-[47.5rem] text-[0.84375rem] leading-[1.55] text-default-500",actionsWide:"ml-auto flex shrink-0 items-center gap-2.5",actionsNarrow:"flex shrink-0 items-center gap-2.5"},ex=(e,n)=>typeof e=="string"?t.jsx(P,{icon:e,className:"size-5","aria-hidden":"true"}):e||n||null,al=({title:e,subtitle:n,eyebrow:s,icon:a,initials:r,actions:i,titleAs:o="h1",className:l,classNames:d={},"data-testid":u="page-header",list:f,narrow:m,headerRef:p})=>{const x=ex(a,r);return t.jsxs("header",{ref:p,"data-testid":u,"data-variant":f?"list":void 0,"data-size":f?m?"narrow":"wide":void 0,className:c.cn(f?c.cn(Ke.base,m?Ke.baseNarrow:Ke.baseWide):"flex flex-wrap items-start justify-between gap-4",l,d.base),children:[t.jsxs("div",{className:f?Ke.identity:"flex items-center gap-4",children:[x?t.jsx("div",{"aria-hidden":"true","data-testid":`${u}-icon`,className:c.cn("flex size-12 shrink-0 items-center justify-center rounded-xl bg-gray-900 text-sm font-semibold text-white",d.iconWrapper),children:x}):null,t.jsxs("div",{className:f?Ke.text:void 0,children:[s?t.jsx("p",{"data-testid":`${u}-eyebrow`,className:c.cn("text-brand text-sm font-medium uppercase tracking-wide",d.eyebrow),children:s}):null,t.jsx(o,{"data-testid":`${u}-title`,className:c.cn(f?m?Ke.titleNarrow:Ke.titleWide:"text-3xl font-semibold text-gray-950",d.title),children:e}),n?t.jsx("p",{"data-testid":`${u}-subtitle`,className:c.cn(f?m?Ke.subtitleNarrow:Ke.subtitleWide:"mt-1 text-sm text-gray-600",d.subtitle),children:n}):null]})]}),i?t.jsx("div",{"data-testid":`${u}-actions`,className:c.cn(f?m?Ke.actionsNarrow:Ke.actionsWide:"flex flex-wrap items-center gap-2",d.actions),children:i}):null]})},tx=e=>{const{ref:n,width:s}=Ft(),a=s>0&&!Xt(s,Jf);return t.jsx(al,{...e,list:!0,narrow:a,headerRef:n})},rl=e=>e.variant==="list"?t.jsx(tx,{...e}):t.jsx(al,{...e,list:!1,narrow:!1});rl.displayName="PageHeader";const He={ok:{fg:ie.ok,bg:ie["ok-fill"]},warn:{fg:ie.warn,bg:ie["warn-fill"]},danger:{fg:ie.danger,bg:ie["danger-fill"]},info:{fg:ie.info,bg:ie["info-fill"]},violet:{fg:ie.violet,bg:ie["violet-fill"]},neutral:{fg:ie.neutral,bg:ie["neutral-fill"]}};function Jt(e){if(e==="positive")return{color:ie.ok};if(e==="negative")return{color:ie.danger}}const nx={active:"success",success:"success",draft:"warning",pending:"warning",warning:"warning",danger:"danger",archived:"default",inactive:"default",neutral:"default",info:"default",violet:"default"},gs={active:{fg:"#057A54",bg:"#E6F4EF"},success:{fg:"#057A54",bg:"#E6F4EF"},draft:{fg:"#B7791F",bg:"#FBF0DD"},pending:{fg:"#B7791F",bg:"#FBF0DD"},warning:{fg:"#B7791F",bg:"#FBF0DD"},danger:{fg:"#B62214",bg:"#FBEAE8"},archived:{fg:"#9CA3AF",bg:"#F1F2F4"},inactive:{fg:"#9CA3AF",bg:"#F1F2F4"},neutral:{fg:"#9CA3AF",bg:"#F1F2F4"},info:He.info,violet:He.violet},sx={active:"ok",success:"ok",draft:"warn",pending:"warn",warning:"warn",danger:"danger",archived:"neutral",inactive:"neutral",neutral:"neutral",info:"info",violet:"violet"},ax={sm:"px-[0.5625rem] py-[0.1875rem] text-[0.75rem]",md:"px-3 py-[0.3125rem] text-[0.8125rem]",lg:"px-3 py-[0.3125rem] text-[0.8125rem]"},rx={info:gs.info,violet:gs.violet},il=({status:e,label:n,variant:s="flat",size:a="sm",color:r,startContent:i,className:o,"data-testid":l="status-chip"})=>{if(s==="plain"){const u=He[sx[e]];return t.jsxs("span",{"data-testid":l,"data-status":e,"data-variant":"plain",className:c.cn("inline-flex items-center gap-1.5 whitespace-nowrap rounded-full font-normal",ax[a],"leading-[1.35]",o),style:{color:u.fg,backgroundColor:u.bg},children:[i,n]})}if(s==="dot"){const u=gs[e];return t.jsxs("span",{"data-testid":l,"data-status":e,className:c.cn("inline-flex items-center gap-1.5 whitespace-nowrap rounded-full px-2.5 py-[3px] text-[12px] font-semibold leading-[1.4]",o),style:{color:u.fg,backgroundColor:u.bg},children:[t.jsx("span",{"aria-hidden":"true",className:"size-1.5 shrink-0 rounded-full",style:{backgroundColor:"currentColor"}}),n]})}const d=r?void 0:rx[e];return t.jsx(c.Chip,{color:r??nx[e],variant:s,size:a,startContent:i,"data-testid":l,"data-status":e,className:c.cn("font-medium",o),style:d?{color:d.fg,backgroundColor:d.bg}:void 0,children:n})};il.displayName="StatusChip";const ix={sm:"gap-1 rounded-md px-2 py-0.5 text-[11.5px] leading-normal",md:"gap-1.5 rounded-lg px-2.5 py-1 text-xs leading-normal"},sn={base:"inline-flex items-baseline gap-1 whitespace-nowrap rounded-[0.4375rem] border border-pos-hair bg-default-100",sm:"px-2 py-0.5 text-[0.75rem] leading-[1.5]",md:"px-2.5 py-1 text-[0.8125rem] leading-[1.5]",label:"font-normal text-default-600",value:"font-semibold text-default-900"},Ln=({label:e,value:n,size:s="sm",variant:a="default",className:r,"data-testid":i="key-value-chip"})=>a==="record"?t.jsxs("span",{"data-testid":i,"data-variant":"record",className:c.cn(sn.base,sn[s],r),children:[t.jsx("span",{className:sn.label,children:e}),t.jsx("span",{className:sn.value,children:n})]}):t.jsxs("span",{"data-testid":i,className:c.cn("inline-flex items-baseline whitespace-nowrap border border-default-200 bg-default-100",ix[s],r),children:[t.jsx("span",{className:"font-medium text-default-400",children:e}),t.jsx("span",{className:"font-semibold text-default-700",children:n})]});Ln.displayName="KeyValueChip";const ll=({columns:e,rows:n=6,label:s="Loading",barHeight:a=12,alignLastRight:r=!1,appearance:i="pulse",className:o,classNames:l={},"data-testid":d="table-skeleton"})=>t.jsxs("div",{role:"status","aria-busy":"true","data-testid":d,className:c.cn("w-full",o,l.base),children:[t.jsx("span",{className:"sr-only",children:s}),t.jsx("div",{"aria-hidden":"true",children:Array.from({length:n}).map((u,f)=>i==="shimmer"?t.jsx("div",{"data-testid":`${d}-row`,className:c.cn("flex items-center border-b border-pos-hair",l.row),children:e.map((m,p)=>{const x=p===e.length-1;return t.jsx("div",{className:c.cn("min-w-0 flex-1 px-4 py-5",r&&x&&"flex justify-end"),children:t.jsx("div",{className:c.cn(un,l.bar),style:{height:it(a),width:m==="fill"?"60%":it(m),maxWidth:"100%"}})},p)})},f):t.jsx("div",{"data-testid":`${d}-row`,className:c.cn("flex items-center gap-3 border-t border-default-100 px-5 py-4",l.row),children:e.map((m,p)=>{const x=p===e.length-1;return t.jsx("div",{className:c.cn(m==="fill"?"flex-1":"shrink-0",r&&x&&"flex justify-end"),style:m==="fill"?void 0:{width:m},children:t.jsx("div",{className:c.cn("animate-pulse rounded bg-default-200",l.bar),style:{height:a,width:m==="fill"?"60%":m}})},p)})},f))})]});ll.displayName="TableSkeleton";const ol="text-left text-[11px] font-semibold uppercase tracking-[.04em] text-acct-sub px-4 pt-4 pb-3 whitespace-nowrap bg-transparent",cl="px-4 text-[13.5px] text-acct-ink2 align-middle",dl="border-t border-acct-hair transition-colors duration-150 hover:bg-acct-page data-[hover=true]:bg-acct-page",ul="w-full",ml="border-t border-acct-border px-5 py-3.5",an={base:"overflow-x-auto",th:"h-auto whitespace-nowrap border-b border-pos-hair bg-transparent px-4 py-[0.875rem] text-left text-[0.6875rem] font-semibold uppercase leading-[1.5] tracking-[.055em] text-default-500 first:rounded-none last:rounded-none last:pr-3",tr:`border-t border-pos-hair transition-colors duration-[120ms] first:border-t-0 data-[focus-visible=true]:outline-offset-[-2px] [tbody>&]:hover:bg-default-50 [tbody>&]:data-[hover=true]:bg-default-50 ${Se}`,td:"h-[3.875rem] px-4 data-[focus-visible=true]:outline-offset-[-2px] py-[0.625rem] align-middle text-[0.875rem] text-default-900 last:pr-3"},fl=({columns:e,children:n,emptyContent:s,footer:a,ariaLabel:r,variant:i="default",className:o,classNames:l={},"data-testid":d="admin-table"})=>{const u=i==="framed";return t.jsxs("div",{className:c.cn(u&&an.base,o,l.base),"data-testid":d,"data-variant":u?"framed":void 0,children:[t.jsxs(Rs,{"aria-label":r,removeWrapper:!0,classNames:{table:c.cn(ul,l.table),th:c.cn(u?an.th:ol,l.th),tr:c.cn(u?an.tr:dl,l.tr),td:c.cn(u?an.td:cl,l.td)},children:[t.jsx(c.TableHeader,{columns:e,children:f=>t.jsx(c.TableColumn,{align:f.align==="right"?"end":"start",width:f.width,children:f.label},f.key)}),t.jsx(c.TableBody,{emptyContent:s,children:n})]}),a?t.jsx("div",{"data-testid":`${d}-footer`,className:c.cn(!u&&ml,l.footer),children:a}):null]})};fl.displayName="AdminTable";const It={base:"flex flex-wrap items-center gap-3 mb-4",trailing:"ml-auto",icon:"flex text-acct-muted",inputWrapper:["h-10 min-h-10 !h-10 rounded-[11px] border border-acct-border bg-acct-surface px-3","data-[hover=true]:border-acct-rust-border","group-data-[focus=true]:border-acct-rust"].join(" "),input:"text-[13.5px] text-acct-ink"},lx={md:"w-[280px]",lg:"w-[360px]",fill:"min-w-[12.5rem] flex-1"},ox=48,tt={base:"flex flex-wrap items-center gap-2.5 border-b border-pos-hair px-4 py-[0.875rem]",narrow:"[&_[data-slot=filter-select-group]]:flex [&_[data-slot=filter-select-group]]:flex-wrap [&_[data-slot=filter-select-group]]:!max-w-none [&_[data-slot=filter-select]]:!max-w-none [&_[data-slot=filter-select]]:!min-w-[calc(50%-0.3125rem)] [&_[data-slot=filter-select]]:grow [&_[data-slot=filter-select]]:basis-[calc(50%-0.3125rem)]",searchWide:"ml-auto",searchFill:"min-w-[12.5rem] flex-1",searchNarrow:"basis-full",inputBaseNarrow:"w-full",inputWrapper:"h-[2.375rem] min-h-[2.375rem] !h-[2.375rem] rounded-[0.625rem] border border-pos-field bg-white pl-3 pr-3 shadow-none data-[hover=true]:border-pos-field group-data-[focus=true]:border-primary",innerWrapper:"gap-[0.3125rem]",input:"text-ellipsis text-[0.875rem] text-default-900 data-[has-start-content=true]:ps-0.5",icon:"flex text-default-400 [&_svg]:size-4"},rr={md:"w-[15.625rem]",lg:"w-[22.5rem]",fill:"w-full"},jn={inputWrapper:"h-12 min-h-12 !h-12",input:"text-base",icon:"[&_svg]:size-5"},ir={button:"shrink-0 text-default-500",input:"[&::-webkit-search-cancel-button]:appearance-none"},lr={md:{button:"size-8 min-w-8",icon:"size-4"},lg:{button:"size-11 min-w-11",icon:"size-5"}},xl=({searchValue:e,onSearchChange:n,searchLabel:s,searchPlaceholder:a,searchClearable:r,clearLabel:i,size:o,dataTestId:l,startContent:d,classNames:u})=>{const f=h.useRef(null),m=o==="lg",p=r&&e!==""?t.jsx(O,{isIconOnly:!0,size:"sm",variant:"light",color:"default",radius:"full","aria-label":i,onPress:()=>{n(""),f.current?.focus()},className:c.cn(ir.button,lr[o].button),testId:`${l}-search-clear`,children:t.jsx(P,{icon:"lucide:x","aria-hidden":"true",className:lr[o].icon})}):void 0;return t.jsx(c.Input,{ref:f,type:"search","aria-label":s,placeholder:a??s,value:e,onValueChange:n,startContent:d,endContent:p,"data-testid":`${l}-search`,variant:"bordered",radius:"none",classNames:{base:u.base,inputWrapper:c.cn(u.inputWrapper,m&&jn.inputWrapper),innerWrapper:u.innerWrapper,input:c.cn(u.input,m&&jn.input,r&&ir.input)}})},cx=({searchValue:e,onSearchChange:n,searchLabel:s,searchPlaceholder:a,searchIcon:r,searchClearable:i=!1,clearLabel:o,children:l,trailing:d,searchWidth:u="md",size:f,className:m,"data-testid":p="admin-toolbar"})=>{const{ref:x,width:g}=Ft(),y=g>0&&!Xt(g,ox),b=u==="fill";return t.jsxs("div",{ref:x,role:"search","data-testid":p,"data-variant":"framed","data-size":y?"narrow":"wide",className:c.cn(tt.base,y&&tt.narrow,m),children:[l,t.jsx("div",{"data-testid":`${p}-search-slot`,className:b?tt.searchFill:y?tt.searchNarrow:tt.searchWide,children:t.jsx(xl,{searchValue:e,onSearchChange:n,searchLabel:s,searchPlaceholder:a,searchClearable:i,clearLabel:o,size:f,dataTestId:p,startContent:t.jsx("span",{"aria-hidden":"true","data-testid":`${p}-search-icon`,className:c.cn(tt.icon,f==="lg"&&jn.icon),children:r??t.jsx(P,{icon:"lucide:search"})}),classNames:{base:b?rr.fill:y?tt.inputBaseNarrow:rr[u],inputWrapper:tt.inputWrapper,innerWrapper:tt.innerWrapper,input:tt.input}})}),d]})},pl=({searchValue:e,onSearchChange:n,searchLabel:s,searchPlaceholder:a,searchIcon:r,searchClearable:i=!1,clearLabel:o="Clear search",children:l,trailing:d,searchWidth:u="md",size:f="md",variant:m="default",className:p,"data-testid":x="admin-toolbar"})=>m==="framed"?t.jsx(cx,{searchValue:e,onSearchChange:n,searchLabel:s,searchPlaceholder:a,searchIcon:r,searchClearable:i,clearLabel:o,trailing:d,searchWidth:u,size:f,className:p,"data-testid":x,children:l}):t.jsxs("div",{role:"search","data-testid":x,className:c.cn(It.base,p),children:[t.jsx(xl,{searchValue:e,onSearchChange:n,searchLabel:s,searchPlaceholder:a,searchClearable:i,clearLabel:o,size:f,dataTestId:x,startContent:r?t.jsx("span",{"aria-hidden":"true",className:c.cn(It.icon,f==="lg"&&jn.icon),children:r}):void 0,classNames:{base:lx[u],inputWrapper:It.inputWrapper,input:It.input}}),l,d?t.jsx("div",{className:It.trailing,children:d}):null]});pl.displayName="AdminToolbar";const dx="ml-0.5 inline-flex min-w-[18px] items-center justify-center rounded-full bg-primary px-1.5 text-xs font-semibold text-primary-foreground",ux="ml-0.5 inline-flex min-w-[1.125rem] items-center justify-center rounded-full bg-primary px-1.5 text-xs font-semibold text-primary-foreground",mx="h-9 gap-1.5 rounded-full border border-gray-200 bg-white px-3.5 text-sm font-medium text-gray-700 hover:bg-gray-50 data-[pressed=true]:bg-gray-50",hl=h.forwardRef(function({icon:n,children:s,count:a,appearance:r="pill",className:i,testId:o,...l},d){return r==="outline"?t.jsxs(O,{ref:d,"data-testid":o,"data-appearance":"outline",color:"default",variant:"bordered",radius:"md",size:"md",className:c.cn("rounded-[0.75rem] font-normal",i),...l,children:[t.jsx(P,{icon:n,className:"size-4","aria-hidden":!0}),t.jsx("span",{children:s}),a!==void 0&&a>0&&t.jsx("span",{className:ux,children:a})]}):t.jsxs(O,{ref:d,"data-testid":o,variant:"light",size:"sm",className:c.cn(mx,i),...l,children:[t.jsx(P,{icon:n,className:"size-4 text-gray-500","aria-hidden":!0}),t.jsx("span",{children:s}),a!==void 0&&a>0&&t.jsx("span",{className:dx,children:a})]})});hl.displayName="ToolbarButton";const or="w-full mb-4 border-b border-pos-line",cr=["max-w-fit h-auto rounded-none border-b-2 border-transparent","data-[selected=true]:border-primary","data-[disabled=true]:opacity-40 data-[hover-unselected=true]:opacity-100",Se].join(" "),fx={md:{base:"w-full mb-6",tabList:"gap-7 w-full relative rounded-none p-0 border-b border-acct-border",cursor:"w-full bg-acct-rust",tab:`max-w-fit px-0.5 h-auto pb-3 ${Se}`,tabContent:`text-[0.9375rem] font-medium text-acct-sub group-data-[selected=true]:font-semibold group-data-[selected=true]:text-acct-rust ${Se}`},"sm-primary":{base:or,tabList:"w-full -mb-px gap-6 rounded-none px-0.5 py-0",cursor:"hidden",tab:`${cr} px-0.5 py-2.5`,tabContent:`text-[0.84375rem] leading-4 font-medium text-pos-muted group-data-[selected=true]:text-pos-ink ${Se}`},"sm-secondary":{base:or,tabList:"w-full -mb-px gap-0 rounded-none p-0",cursor:"hidden",tab:`${cr} px-[1.125rem] py-[0.5625rem]`,tabContent:`text-[0.8125rem] leading-4 font-semibold text-pos-muted group-data-[selected=true]:text-primary ${Se}`}},xx="data-[animated=true]:transition-none";function bl({items:e,value:n,onChange:s,ariaLabel:a,size:r="md",level:i="primary",className:o,"data-testid":l="underline-tabs"}){const d=ji(),u=r==="sm",f=fx[u?`sm-${i}`:"md"],m=e.filter(p=>p.isDisabled).map(p=>p.key);return t.jsx(c.Tabs,{"aria-label":a,variant:"underlined",selectedKey:n,onSelectionChange:p=>s(String(p)),disabledKeys:m,disableCursorAnimation:u,"data-testid":l,"data-size":r,classNames:{...f,base:c.cn(f.base,o),cursor:c.cn(f.cursor,d&&xx),panel:"p-0"},children:e.map(p=>t.jsx(c.Tab,{title:p.label,titleValue:p.hint,"data-testid":`${l}-${p.key}`,children:p.content},p.key))})}bl.displayName="UnderlineTabs";const Ks="text-[11px] font-semibold uppercase tracking-[.04em] text-acct-muted mb-1.5",Ys="font-normal normal-case tracking-normal",gl=["h-[38px] min-h-[38px] !h-[38px] rounded-[11px] border border-acct-border bg-acct-surface px-3","data-[hover=true]:border-acct-rust-border","group-data-[focus=true]:border-acct-rust"].join(" "),yl="text-[13.5px] text-acct-ink",vl="bg-acct-page text-acct-muted cursor-default",jl="mt-[5px] text-xs text-acct-sub",wl="mt-[5px] text-xs text-acct-danger",Nl=({children:e,suffix:n,className:s,"data-testid":a="admin-field-label"})=>t.jsxs("div",{"data-testid":a,className:c.cn(Ks,s),children:[e,n?t.jsxs("span",{className:Ys,children:[" ",n]}):null]});Nl.displayName="AdminFieldLabel";const Cl=({label:e,labelSuffix:n,value:s,onChange:a,placeholder:r,disabled:i=!1,readOnly:o=!1,mono:l=!1,autoFocus:d=!1,hint:u,invalid:f=!1,className:m,"data-testid":p="admin-text-field"})=>t.jsx(c.Input,{labelPlacement:e?"outside":void 0,label:e&&n?t.jsxs(t.Fragment,{children:[e,t.jsxs("span",{className:Ys,children:[" ",n]})]}):e,value:s,placeholder:r,isDisabled:i,isReadOnly:o,autoFocus:d,isInvalid:f,description:!f&&u?u:void 0,errorMessage:f?u:void 0,onValueChange:a,"data-testid":p,variant:"bordered",radius:"none",classNames:{base:c.cn("w-full",m),label:Ks,inputWrapper:gl,input:c.cn(yl,(l||o)&&"font-mono",o&&vl),description:jl,errorMessage:wl}});Cl.displayName="AdminTextField";const px={sm:"size-6 min-w-6",md:"size-[30px] min-w-[30px]"},kl=({actions:e,size:n="md",className:s,"data-testid":a="row-actions"})=>t.jsx("div",{role:"presentation","data-testid":a,className:c.cn("inline-flex gap-0.5",s),onClick:r=>r.stopPropagation(),children:e.map(r=>t.jsx(O,{isIconOnly:!0,variant:"light",radius:"sm",size:"sm",onPress:r.onPress,isDisabled:r.disabled,"aria-label":r.label,title:r.label,"data-testid":`${a}-${r.key}`,className:c.cn("text-acct-sub data-[hover=true]:bg-acct-hair",px[n]),children:r.icon},r.key))});kl.displayName="RowActions";const Sl=({children:e,placeholder:n="Select…",onOpen:s,onClear:a,ariaLabel:r,icon:i,trailingIcon:o,clearIcon:l,disabled:d=!1,className:u,"data-testid":f="picker-row"})=>{const m=e!=null;return t.jsxs("div",{"data-testid":f,className:c.cn("flex w-full min-h-10 items-center rounded-[10px] border border-acct-border bg-acct-surface px-[11px] transition-colors duration-150",d?"opacity-60":"hover:border-acct-rust-border",u),children:[t.jsxs(O,{variant:"light",radius:"none",disableAnimation:!0,onPress:s,isDisabled:d,"aria-haspopup":"dialog","aria-label":r,"data-testid":`${f}-trigger`,className:"flex h-auto min-h-0 min-w-0 flex-1 items-center justify-start gap-2.5 bg-transparent px-0 py-2 text-left text-inherit data-[hover=true]:bg-transparent",children:[i?t.jsx("span",{className:"flex shrink-0 text-acct-muted",children:i}):null,m?t.jsx("span",{className:"flex min-w-0 items-center gap-2",children:e}):t.jsx("span",{className:"text-[13.5px] font-semibold text-acct-sub",children:n}),o?t.jsx("span",{className:"ml-auto flex shrink-0 text-acct-muted",children:o}):null]}),m&&a?t.jsx(O,{isIconOnly:!0,variant:"light",radius:"sm",size:"sm",onPress:a,isDisabled:d,"aria-label":`Clear ${r}`,title:"Clear","data-testid":`${f}-clear`,className:"ml-1.5 size-6 min-w-6 shrink-0 text-acct-muted data-[hover=true]:bg-acct-hair",children:l}):null]})};Sl.displayName="PickerRow";const ze={base:"relative flex w-full items-center gap-2 transition-colors",content:"flex min-w-0 flex-1 items-center gap-3 text-left",pressTarget:["static z-auto flex h-auto min-h-0 min-w-0 flex-1 items-center justify-start gap-3","overflow-visible whitespace-normal transform-none rounded-none bg-transparent px-0","text-left font-normal text-inherit no-underline","data-[hover=true]:bg-transparent data-[hover=true]:opacity-100 data-[pressed=true]:opacity-100","hover:!opacity-100 active:!opacity-100","outline-none data-[focus-visible=true]:outline-0","after:absolute after:inset-0","data-[focus-visible=true]:after:ring-2 data-[focus-visible=true]:after:ring-focus"].join(" "),text:"flex min-w-0 flex-col",titleLine:"flex min-w-0 items-center gap-2",title:"truncate font-medium text-default-900",subtitle:"truncate text-default-600",tags:"flex shrink-0 items-center gap-1",side:"relative z-10 flex shrink-0 items-center gap-1",chevron:"flex shrink-0 text-default-500",menuTrigger:"text-default-600",avatar:"shrink-0 bg-default-200 text-default-700",dangerItem:"text-danger"},hx={default:void 0,primary:"text-primary-800",success:void 0,warning:"text-warning-800",danger:void 0},bx={plain:{row:"rounded-xl px-2",hover:"hover:bg-default-100",overlay:"after:rounded-xl"},bordered:{row:"rounded-lg border border-default-200 bg-white px-3",hover:"hover:bg-default-50",overlay:"after:rounded-lg"}},$l={md:{row:"min-h-12",content:"py-1",title:"text-sm leading-6",subtitle:"text-xs leading-4",avatar:"sm",control:"md"},lg:{row:"min-h-14",content:"py-1.5",title:"text-base leading-6",subtitle:"text-sm leading-5",avatar:"md",control:"lg"}},gx={md:void 0,lg:"min-h-12 text-base"},yx={none:"",sm:"gap-1",md:"gap-2"},Al="m-0 flex list-none flex-col p-0",Nt={row:"flex items-center gap-3 px-2",avatar:{md:"size-8 shrink-0 rounded-full",lg:"size-10 shrink-0 rounded-full"},lines:"flex flex-col gap-2",title:"h-4 rounded-md",subtitle:"h-3 w-44 rounded-md",titleWidths:["w-32","w-28","w-36","w-24","w-40","w-28"]},Dl=h.createContext(!1),vx=()=>t.jsx("svg",{viewBox:"0 0 24 24",width:"20",height:"20",fill:"none","aria-hidden":"true",focusable:"false",children:t.jsx("path",{d:"m9 5 7 7-7 7",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),jx=()=>t.jsxs("svg",{viewBox:"0 0 24 24",width:"20",height:"20",fill:"none","aria-hidden":"true",focusable:"false",children:[t.jsx("circle",{cx:"5",cy:"12",r:"1.75",stroke:"currentColor",strokeWidth:"1.5"}),t.jsx("circle",{cx:"12",cy:"12",r:"1.75",stroke:"currentColor",strokeWidth:"1.5"}),t.jsx("circle",{cx:"19",cy:"12",r:"1.75",stroke:"currentColor",strokeWidth:"1.5"})]});function wx(e){const n=e.trim().split(/\s+/).filter(Boolean);if(n.length===0)return"—";const s=n[0]?.charAt(0)??"",a=n.length>1?n[n.length-1]?.charAt(0)??"":"";return`${s}${a}`.toUpperCase()}function le(e){return e!=null&&e!==!1&&e!==""}const El=({title:e,subtitle:n,leading:s,tags:a,onPress:r,href:i,linkAs:o,"aria-haspopup":l,trailing:d,showChevron:u=!1,chevronIcon:f,actions:m,actionsLabel:p,actionsIcon:x,size:g,variant:y="plain",isDisabled:b=!1,as:j,className:w,"data-testid":$="entity-row"})=>{const N=h.useContext(Dl),A=Cn(),k=g??(A==="touch"?"lg":"md"),C=$l[k],D=bx[y],S=j??(N?"li":"div"),_=h.useId(),F=h.useId(),L=h.useId(),M=i!==void 0||r!==void 0,I=a!==void 0&&a.length>0,W=le(n),K=m!==void 0&&m.length>0,z=typeof e=="string"?e:void 0,ne=s?t.jsx(c.Avatar,{"aria-hidden":"true",size:C.avatar,radius:s.shape==="square"?"lg":"full",src:s.src,icon:s.icon,name:s.icon!==void 0?void 0:s.initials??s.name??z,getInitials:s.initials!==void 0?q=>q:wx,showFallback:s.src!==void 0,classNames:{base:ze.avatar},"data-testid":`${$}-leading`}):null,G=t.jsxs(t.Fragment,{children:[ne,t.jsxs("span",{className:ze.text,children:[t.jsxs("span",{className:ze.titleLine,children:[t.jsx("span",{id:_,className:c.cn(ze.title,C.title),title:z,children:e}),I&&t.jsx("span",{id:F,className:ze.tags,children:a.map(q=>t.jsx(c.Chip,{size:"sm",variant:"flat",color:q.tone??"default",className:hx[q.tone??"default"],"data-testid":`${$}-tag-${q.key}`,children:q.label},q.key))})]}),W&&t.jsx("span",{id:L,className:c.cn(ze.subtitle,C.subtitle),children:n})]})]}),se=[I?F:null,W?L:null].filter(Boolean).join(" "),Y={"aria-labelledby":_,"aria-describedby":se===""?void 0:se,isDisabled:b,className:c.cn(ze.pressTarget,D.overlay,C.content)},oe=`${$}-trigger`;let J;return i!==void 0?J=t.jsx(c.Link,{...Y,"data-testid":oe,as:o,href:i,color:"foreground",underline:"none",onPress:r,children:G}):r!==void 0?J=t.jsx(O,{...Y,testId:oe,variant:"light",color:"default",radius:"none",disableAnimation:!0,disableRipple:!0,"aria-haspopup":l,onPress:r,children:G}):J=t.jsx("div",{className:c.cn(ze.content,C.content),children:G}),t.jsxs(S,{"data-testid":$,"data-size":k,"data-disabled":b||void 0,className:c.cn(ze.base,D.row,C.row,M&&!b&&D.hover,w),children:[J,(le(d)||K)&&t.jsxs("div",{className:ze.side,children:[d,K&&t.jsxs(c.Dropdown,{placement:"bottom-end",children:[t.jsx(c.DropdownTrigger,{children:t.jsx(O,{isIconOnly:!0,size:C.control,variant:"light",color:"default",radius:"full",isDisabled:b,"aria-label":p,testId:`${$}-menu-trigger`,className:ze.menuTrigger,children:x??t.jsx(jx,{})})}),t.jsx(c.DropdownMenu,{"aria-label":p,"data-testid":`${$}-menu`,disabledKeys:m.filter(q=>q.isDisabled).map(q=>q.key),onAction:q=>{m.find(re=>re.key===q)?.onAction()},items:m,children:q=>t.jsx(c.DropdownItem,{textValue:q.label,color:q.tone==="danger"?"danger":"default",className:c.cn(q.tone==="danger"&&ze.dangerItem,gx[k]),startContent:q.icon,"data-testid":q["data-testid"]??`${$}-menu-${q.key}`,children:q.label},q.key)})]})]}),u&&t.jsx("span",{"aria-hidden":"true",className:ze.chevron,"data-testid":`${$}-chevron`,children:f??t.jsx(vx,{})})]})};El.displayName="EntityRow";const Ll=({children:e,"aria-label":n,"aria-labelledby":s,gap:a="none",className:r,"data-testid":i="entity-list"})=>t.jsx("ul",{"aria-label":n,"aria-labelledby":s,"data-testid":i,className:c.cn(Al,yx[a],r),children:t.jsx(Dl.Provider,{value:!0,children:e})});Ll.displayName="EntityList";const Fl=({label:e,rows:n=6,size:s,className:a,"data-testid":r="entity-list-skeleton"})=>{const i=Cn(),o=s??(i==="touch"?"lg":"md"),{titleWidths:l}=Nt;return t.jsxs("div",{"data-testid":r,className:a,children:[t.jsx("span",{role:"status",className:"sr-only",children:e}),t.jsx("ul",{"aria-hidden":"true",className:Al,children:Array.from({length:n},(d,u)=>t.jsxs("li",{"data-testid":`${r}-row`,className:c.cn(Nt.row,$l[o].row),children:[t.jsx(c.Skeleton,{className:Nt.avatar[o]}),t.jsxs("span",{className:Nt.lines,children:[t.jsx(c.Skeleton,{className:c.cn(Nt.title,l[u%l.length])}),t.jsx(c.Skeleton,{className:Nt.subtitle})]})]},u))})]})};Fl.displayName="EntityListSkeleton";function Rl(e,n,s){if(s<=0||n<=0||e<=0)return{from:0,to:0};const a=(e-1)*n+1;return a>s?{from:0,to:0}:{from:a,to:Math.min(s,e*n)}}const _l=({page:e,pageSize:n,total:s,unit:a,announce:r=!0,format:i,className:o,classNames:l={},"data-testid":d="pagination-summary"})=>{const{from:u,to:f}=Rl(e,n,s),m=c.cn("font-semibold text-default-700",l.emphasis);return t.jsx("p",{"data-testid":d,"aria-live":r?"polite":void 0,className:c.cn("text-sm text-default-500",o,l.base),children:i?i({from:u,to:f,total:s}):t.jsxs(t.Fragment,{children:["Showing"," ",t.jsx("span",{"data-testid":`${d}-range`,className:m,children:u===0?0:`${u}–${f}`})," ","of"," ",t.jsx("span",{"data-testid":`${d}-total`,className:m,children:s}),a?t.jsxs(t.Fragment,{children:[" ",a]}):null]})})};_l.displayName="PaginationSummary";const Fn="shadow-[0_1px_4px_rgba(0,0,0,.06),0_4px_12px_rgba(0,0,0,.06)]",at={base:"overflow-hidden rounded-2xl border border-pos-line bg-white",title:"m-0 min-w-0 text-[0.90625rem] font-semibold text-default-900 [overflow-wrap:anywhere]",count:"rounded-full bg-default-100 px-2 py-px text-[0.75rem] font-semibold text-default-600",icon:"flex shrink-0 text-default-500 [&_svg]:size-[1.125rem]",action:"ml-auto",description:"m-0 text-[0.84375rem] leading-[1.55] text-default-500 [&_b]:font-bold [&_b]:tabular-nums [&_b]:text-default-900",footer:"flex flex-wrap gap-2",footerAfterContent:"mt-[0.875rem]",footerAfterDescription:"mt-3"},Nx={card:Fn,flat:""},Cx={section:"flex flex-wrap items-center gap-2 px-5 pt-4",aside:"flex flex-wrap items-center gap-[0.5625rem] px-[1.125rem] pt-[0.9375rem]"},kx={section:{padded:"px-5 pb-[1.125rem] pt-[0.875rem]",rows:"px-5 pb-[1.125rem] pt-2.5",flush:"pt-3",none:""},aside:{padded:"px-[1.125rem] pb-[1.125rem] pt-3",rows:"px-[1.125rem] pb-[1.125rem] pt-3",flush:"pt-3",none:""}},Ml=({isLoading:e=!1,isError:n=!1,isEmpty:s=!1,loadingTitle:a="Loading…",loadingContent:r,errorTitle:i="Something went wrong",errorDescription:o,retryLabel:l="Retry",onRetry:d,errorActions:u,errorContent:f,emptyTitle:m="Nothing here yet",emptyDescription:p,emptyIcon:x,emptyActions:g,emptyContent:y,children:b,toolbar:j,variant:w="default",className:$,classNames:N={},"data-testid":A="list-panel"})=>{const k=w==="framed",C={base:c.cn("border-0 bg-transparent py-12",N.state)},D=k?{base:c.cn("px-6 py-[3.625rem]",N.state),iconWrapper:"mb-[1.125rem] size-[4.75rem] rounded-[1.25rem] border-0 bg-default-100 text-default-400",icon:"size-[2.875rem]",title:"text-[1.0625rem] font-semibold text-default-900",description:"mt-1.5 max-w-[26.25rem] text-[0.875rem] leading-[1.55] text-default-500",actions:"mt-[1.375rem] gap-2.5"}:C;let S;return e?S=r??t.jsx(qs,{title:a,classNames:C,"data-testid":`${A}-loading`}):n?S=f??t.jsx(Ws,{title:i,description:o,classNames:C,"data-testid":`${A}-error`,actions:u??(d?t.jsx(O,{color:"primary",variant:"flat",onPress:d,children:l}):void 0)}):s?S=y??t.jsx(Hs,{surface:k?"panel":void 0,title:m,description:p,icon:x,actions:g,classNames:D,"data-testid":`${A}-empty`}):S=b,t.jsxs("section",{"data-testid":A,"data-variant":k?"framed":void 0,className:c.cn(k?`overflow-hidden rounded-2xl border border-pos-line bg-white ${Fn}`:"rounded-xl bg-white p-2 shadow-sm",$,N.base),children:[j,S]})};Ml.displayName="ListPanel";const Qs=(e,n)=>n<=0?/^\d*$/.test(e):new RegExp(`^\\d*(?:[.,]\\d{0,${n}})?$`).test(e),Yt=e=>{const n=Number.parseFloat(e.replace(",","."));return Number.isFinite(n)?n:null},Pl=(e,n)=>{const[s,a]=h.useState(()=>n(e)),r=(Yt(s)??0)===(e??0)?s:n(e),i=h.useCallback(()=>{a(o=>{const l=Yt(o);return l===null?"":String(l)})},[]);return{draft:r,setDraft:a,normalize:i}},Sx=/^[\d.,]+$/,Tl=(e,n=Object.is)=>{const s=h.useRef(e),a=h.useRef(null);h.useLayoutEffect(()=>{s.current=e},[e]);const r=h.useCallback(()=>{const l=a.current,d=s.current;return l===null||!(n(d,l.source)||n(d,l.emitted))},[n]),i=h.useCallback(l=>{a.current={source:s.current,emitted:l}},[]),o=h.useCallback(()=>{a.current=null},[]);return h.useMemo(()=>({isUntouched:r,markEdited:i,markUntouched:o}),[r,i,o])},Il=(e,n)=>{const s=h.useRef(null),a=h.useRef(n);return h.useLayoutEffect(()=>{a.current=n},[n]),h.useEffect(()=>{const r=s.current;if(!r)return;const i=l=>{e()&&(l.inputType==="insertText"&&l.data&&Sx.test(l.data)?(l.preventDefault(),a.current(l.data)):l.inputType.startsWith("delete")&&(l.preventDefault(),a.current("")))},o=()=>{requestAnimationFrame(()=>{r.isConnected&&e()&&r.select()})};return r.addEventListener("beforeinput",i),r.addEventListener("pointerup",o),()=>{r.removeEventListener("beforeinput",i),r.removeEventListener("pointerup",o)}},[e]),s},$x=350,Ax={receivedLabel:"Cash Received",receivedPlaceholder:"$0.00",changeLabel:"Change",changeMessageTemplate:"You have to give back the client {change} in change",insufficientMessageTemplate:"Amount received must be at least {due}",exactAmountLabel:"Exact",exactAmountAriaTemplate:"Exact amount {amount}",quickAmountsLabel:"Quick cash amounts",quickAmountAriaTemplate:"Add {amount}"},Dx=7,Ex=e=>[...new Set((e??[]).filter(n=>Number.isFinite(n)&&n>0))].sort((n,s)=>n-s).slice(0,Dx),Lx=(e,n,s)=>{if(!Number.isInteger(e))return fe(e,n,s);try{return new Intl.NumberFormat(n,{style:"currency",currency:s,minimumFractionDigits:0}).format(e)}catch{return fe(e,n,s)}},Fx=(e,n)=>(e??0)===(n??0),Ot=(e,n)=>Object.entries(n).reduce((s,[a,r])=>s.replace(`{${a}}`,r),e),Rx=({dueAmount:e,received:n,defaultReceived:s=null,onChange:a,locale:r="en-US",labels:i,isDisabled:o=!1,maxAmount:l,quickAmounts:d,showExactAmount:u=!0,autoFocus:f=!1,className:m,"data-testid":p="cash-tender-form"})=>{const x={...Ax,...i},g=Et(e.currency,r),y=n!==void 0,[b,j]=h.useState(s??null),w=y?n:b,{draft:$,setDraft:N,normalize:A}=Pl(w,V=>V==null?"":String(V)),{isUntouched:k,markEdited:C,markUntouched:D}=Tl(w,Fx),S=h.useMemo(()=>{const V=typeof w=="number"&&Number.isFinite(w)?w:0,ee=us(V,e.value,e.currency,r);return{received:V,change:ee>0?ee:0,isValid:V>=e.value&&V>0}},[w,e.value,e.currency,r]),_=h.useCallback(V=>{const ee=V.currentTarget;requestAnimationFrame(()=>{ee.isConnected&&ee.select()})},[]),F=h.useCallback(V=>{y||j(V);const ee=typeof V=="number"&&Number.isFinite(V)?V:0,te=us(ee,e.value,e.currency,r);a?.({received:ee,change:te>0?te:0,isValid:ee>=e.value&&ee>0})},[y,e.value,e.currency,r,a]),L=h.useCallback(V=>{if(o)return;const ee=V.replace(/[^\d.,]/g,"");if(!Qs(ee,g))return;const te=Yt(ee);te!==null&&l!==void 0&&te>l||(N(ee),C(te),F(te))},[o,l,N,C,g,F]),M=Il(k,L),I=h.useMemo(()=>Ex(d),[d]),W=V=>l!==void 0&&V>l,K=()=>{o||W(e.value)||(N(String(e.value)),D(),F(e.value))},z=V=>{if(o)return;const ee=k()||typeof w!="number"||!Number.isFinite(w)?0:w,te=_s(ee+V,e.currency,r);W(te)||(N(String(te)),C(te),F(te))},ne=S.isValid&&S.change>0,G=!S.isValid&&S.received>0,se=fe(S.change,r,e.currency),Y=fe(e.value,r,e.currency),[oe,J]=h.useState(""),q=h.useRef(null);h.useEffect(()=>{q.current&&clearTimeout(q.current);const V=ne?Ot(x.changeMessageTemplate,{change:se}):"",ee=ne?$x:0;return q.current=setTimeout(()=>J(V),ee),()=>{q.current&&clearTimeout(q.current)}},[ne,se,x.changeMessageTemplate]);const re=`${p}-received`;return t.jsxs("div",{className:c.cn("flex flex-col gap-3",m),"data-testid":p,children:[t.jsx(c.Input,{ref:M,id:re,label:x.receivedLabel,labelPlacement:"outside",type:"text",inputMode:g===0?"numeric":"decimal",pattern:g===0?"[0-9]*":"[0-9]*[.,]?[0-9]*",value:$,onChange:V=>L(V.target.value),onFocus:_,onBlur:A,placeholder:x.receivedPlaceholder,isDisabled:o,isInvalid:G,errorMessage:G?Ot(x.insufficientMessageTemplate,{due:Y}):void 0,variant:"bordered",radius:"lg",autoFocus:f,"data-testid":`${p}-received-input`}),I.length>0&&t.jsx("div",{className:"[container-type:inline-size]",children:t.jsxs("div",{role:"group","aria-label":x.quickAmountsLabel,className:"grid grid-cols-4 gap-2 [@container(min-width:55rem)]:grid-cols-8","data-testid":`${p}-quick-amounts`,children:[u&&t.jsxs(O,{variant:"flat",color:"primary",radius:"lg",className:"h-auto min-h-11 min-w-0 whitespace-normal px-2 py-1 text-sm font-semibold leading-tight",isDisabled:o,"aria-label":Ot(x.exactAmountAriaTemplate,{amount:Y}),onPress:K,"data-testid":`${p}-quick-amount-exact`,children:[x.exactAmountLabel," ",Y]}),I.map(V=>{const ee=Lx(V,r,e.currency);return t.jsx(O,{variant:"bordered",color:"default",radius:"lg",className:"h-auto min-h-11 min-w-0 px-2 text-base font-semibold text-default-900",isDisabled:o,"aria-label":Ot(x.quickAmountAriaTemplate,{amount:ee}),onPress:()=>z(V),"data-testid":`${p}-quick-amount-${V}`,children:ee},V)})]})}),ne&&t.jsx(c.Alert,{"data-testid":`${p}-change-alert`,color:"primary",variant:"flat",radius:"lg",title:x.changeLabel,description:Ot(x.changeMessageTemplate,{change:se}),icon:t.jsx(P,{icon:"lucide:info",width:20,height:20,"aria-hidden":"true"}),"aria-live":"off",classNames:{base:"bg-info-50 text-info-700",title:"font-semibold",description:"text-sm leading-relaxed",iconWrapper:"bg-transparent shadow-none border-0"}}),t.jsx("span",{role:"status","aria-live":"polite",className:"sr-only",children:oe})]})},_x={checkNumberLabel:"Check Number",checkNumberPlaceholder:"e.g. 11234",bankNameLabel:"Bank Name",bankNamePlaceholder:"e.g. Chase Bank",dateLabel:"Date",checkNumberRequiredMessage:"Check number is required"},dr=()=>{const e=new Date,n=s=>String(s).padStart(2,"0");return`${e.getFullYear()}-${n(e.getMonth()+1)}-${n(e.getDate())}`},Ol=({dueAmount:e,value:n,defaultValue:s,onChange:a,labels:r,hideDate:i=!1,hideBankName:o=!1,isDisabled:l=!1,checkNumberMaxLength:d=34,bankNameMaxLength:u=100,autoFocus:f=!1,className:m,"data-testid":p="check-tender-form"})=>{const x={..._x,...r},g=n!==void 0,[y,b]=h.useState({checkNumber:s?.checkNumber??"",bankName:s?.bankName??"",date:s?.date??dr()}),[j,w]=h.useState(!!s?.checkNumber),$=h.useMemo(()=>g?{checkNumber:n?.checkNumber??"",bankName:n?.bankName??"",date:n?.date??dr()}:y,[g,n,y]),N=h.useCallback(F=>{g||b(F);const L=F.checkNumber.trim(),M={amount:e.value,checkNumber:L,bankName:F.bankName.trim()||void 0,date:i?void 0:F.date,isValid:L.length>0&&e.value>0};a?.(M)},[g,e.value,i,a]),A=h.useCallback(F=>L=>{l||(F==="checkNumber"&&L.length>0&&w(!0),N({...$,[F]:L}))},[$,N,l]),k=h.useCallback(()=>{l||w(!0)},[l]),C=j&&$.checkNumber.trim()==="",D=`${p}-check-number`,S=`${p}-bank-name`,_=`${p}-date`;return t.jsxs("div",{className:c.cn("grid grid-cols-1 sm:grid-cols-2 gap-4",m),"data-testid":p,children:[t.jsx(c.Input,{id:D,label:x.checkNumberLabel,labelPlacement:"outside",type:"text",value:$.checkNumber,onChange:F=>A("checkNumber")(F.target.value),onBlur:k,placeholder:x.checkNumberPlaceholder,maxLength:d,isRequired:!0,isInvalid:C,errorMessage:C?x.checkNumberRequiredMessage:void 0,isDisabled:l,variant:"bordered",radius:"lg",autoFocus:f,"data-testid":`${p}-check-number-input`}),!o&&t.jsx(c.Input,{id:S,label:x.bankNameLabel,labelPlacement:"outside",type:"text",value:$.bankName,onChange:F=>A("bankName")(F.target.value),placeholder:x.bankNamePlaceholder,maxLength:u,isDisabled:l,variant:"bordered",radius:"lg","data-testid":`${p}-bank-name-input`}),!i&&t.jsx(c.Input,{id:_,label:x.dateLabel,labelPlacement:"outside",type:"date",value:$.date,onChange:F=>A("date")(F.target.value),isDisabled:l,variant:"bordered",radius:"lg","data-testid":`${p}-date-input`,className:"sm:col-span-2"})]})};Ol.displayName="CheckTenderForm";const Mx={methodLabel:"Method",methodPlaceholder:"Select a payment method",referenceLabel:"Reference",referencePlaceholder:"e.g. Voucher #1234",methodRequiredMessage:"Method is required"},Px=[{value:"ach",label:"ACH"},{value:"wire",label:"Wire"},{value:"gift_card",label:"Gift Card"},{value:"voucher",label:"Voucher"},{value:"other",label:"Other"}],zl=({dueAmount:e,methodOptions:n=Px,value:s,defaultValue:a,onChange:r,labels:i,showReference:o=!1,isDisabled:l=!1,className:d,"data-testid":u="other-tender-form"})=>{const f={...Mx,...i},m=s!==void 0,[p,x]=h.useState({method:a?.method??"",reference:a?.reference??""}),g=h.useMemo(()=>m?{method:s?.method??"",reference:s?.reference??""}:p,[m,s,p]),y=h.useCallback(A=>n.find(k=>k.value===A)?.label??"",[n]),b=h.useCallback(A=>{m||x(A);const k=y(A.method),C={amount:e.value,method:A.method,description:k,reference:A.reference.trim()||void 0,isValid:A.method!==""};r?.(C)},[m,e.value,r,y]),j=h.useCallback(A=>{if(l)return;const k=typeof A=="string"?A:Array.from(A)[0]?.toString()??"";b({...g,method:k})},[g,b,l]),w=h.useCallback(A=>{l||b({...g,reference:A})},[g,b,l]),$=`${u}-method`,N=`${u}-reference`;return t.jsxs("div",{className:c.cn("flex flex-col gap-3",d),"data-testid":u,children:[t.jsx(Xe,{id:$,label:f.methodLabel,labelPlacement:"outside",placeholder:f.methodPlaceholder,selectedKeys:g.method?[g.method]:[],onSelectionChange:j,isDisabled:l,isRequired:!0,variant:"bordered",radius:"lg","data-testid":`${u}-method-select`,popoverProps:{placement:"bottom-start",classNames:{content:"bg-white border border-default-200 shadow-lg rounded-xl p-1"}},listboxProps:{classNames:{list:"max-h-[var(--popover-available-height,40vh)] overflow-y-auto"},itemClasses:{base:["rounded-lg","px-3 py-2","text-default-800","data-[hover=true]:bg-default-100","data-[selectable=true]:focus:bg-default-100","data-[selected=true]:bg-primary-50","data-[selected=true]:text-primary","data-[selected=true]:font-medium"]}},children:n.map(A=>t.jsx(c.SelectItem,{"data-testid":`${u}-method-option-${A.value}`,children:A.label},A.value))}),o&&t.jsx(c.Input,{id:N,label:f.referenceLabel,labelPlacement:"outside",type:"text",value:g.reference,onChange:A=>w(A.target.value),placeholder:f.referencePlaceholder,isDisabled:l,variant:"bordered",radius:"lg","data-testid":`${u}-reference-input`})]})};zl.displayName="OtherTenderForm";const Tx={collectedHeading:"Collected",remainingLabel:"Remaining:",completeLabel:"Complete",removeAriaLabel:"Remove this tender",removeTooltipForRecorded:"Already recorded",statusPending:"Pending",statusRecorded:"Approved",statusFailed:"Failed"},Ix={card:"lucide:credit-card",cash:"lucide:dollar-sign",check:"lucide:edit-3",other:"lucide:more-horizontal"},Ox={pending:"warning",recorded:"success",failed:"danger"},zx=e=>e==="pending"||e==="recorded",Bx=e=>`#${e+1}`,Bl=({total:e,tenders:n,onRemove:s,locale:a="en-US",labels:r,hideCollectedList:i=!1,variant:o="banner",className:l,"data-testid":d="split-payment-summary"})=>{const u={...Tx,...r},{collected:f,remaining:m,isComplete:p}=h.useMemo(()=>{const g=n.reduce((b,j)=>zx(j.status)?b+j.amount:b,0),y=Math.max(e.value-g,0);return{collected:g,remaining:y,isComplete:g>=e.value&&e.value>0}},[n,e.value]),x=g=>g==="pending"?u.statusPending:g==="recorded"?u.statusRecorded:u.statusFailed;return t.jsxs("div",{className:c.cn("flex flex-col gap-4",l),"data-testid":d,children:[o==="compact"?t.jsxs("div",{className:"flex items-baseline justify-between gap-3","data-testid":`${d}-remaining-banner`,children:[t.jsx("span",{className:"text-sm text-default-600",children:p?u.completeLabel:u.remainingLabel}),t.jsx("span",{className:"text-base font-semibold tracking-tight","data-testid":`${d}-remaining-amount`,children:fe(p?f:m,a,e.currency)})]}):t.jsxs("div",{className:"rounded-2xl bg-default-100 px-6 py-5 text-center","data-testid":`${d}-remaining-banner`,children:[t.jsx("div",{className:"text-sm text-default-600",children:p?u.completeLabel:u.remainingLabel}),t.jsx("div",{className:"mt-1 text-4xl font-bold tracking-tight","data-testid":`${d}-remaining-amount`,children:fe(p?f:m,a,e.currency)})]}),!i&&n.length>0&&t.jsxs("div",{className:"flex flex-col gap-2","data-testid":`${d}-collected-list`,children:[t.jsx("h3",{className:"text-base font-semibold",children:u.collectedHeading}),n.map((g,y)=>t.jsx(Vx,{index:y,tender:g,locale:a,currency:e.currency,removable:!!s&&g.status!=="recorded",onRemove:s?()=>s(g.id):void 0,statusLabel:x(g.status),removeAriaLabel:u.removeAriaLabel,recordedTooltip:u.removeTooltipForRecorded,dataTestId:`${d}-row-${y}`},g.id))]})]})};Bl.displayName="SplitPaymentSummary";const Vx=({index:e,tender:n,locale:s,currency:a,removable:r,onRemove:i,statusLabel:o,removeAriaLabel:l,recordedTooltip:d,dataTestId:u})=>{const f=i?t.jsx(O,{isIconOnly:!0,variant:"light",radius:"full",size:"sm",onPress:i,isDisabled:!r,"aria-label":l,"data-testid":`${u}-remove`,className:c.cn(r?"text-default-700 hover:bg-default-200":"text-default-300"),children:t.jsx(P,{icon:"lucide:x",width:18,height:18,"aria-hidden":"true"})}):null;return t.jsxs("div",{className:"flex items-center gap-3 rounded-xl bg-default-50 px-4 py-3 motion-safe:animate-[pp-row-in_200ms_ease-out]","data-testid":u,children:[t.jsx("span",{className:"text-sm font-medium text-default-500 w-6 shrink-0",children:Bx(e)}),t.jsx(P,{icon:Ix[n.type],width:20,height:20,className:"text-default-700 shrink-0","aria-hidden":"true"}),t.jsx("span",{className:"flex-1 truncate","data-testid":`${u}-label`,children:n.label}),t.jsx("span",{className:"font-semibold tabular-nums","data-testid":`${u}-amount`,children:fe(n.amount,s,a)}),t.jsx(c.Chip,{size:"sm",radius:"full",variant:"flat",color:Ox[n.status],startContent:n.status==="recorded"?t.jsx(P,{icon:"lucide:check-circle",width:14,height:14,"aria-hidden":"true"}):n.status==="failed"?t.jsx(P,{icon:"lucide:alert-circle",width:14,height:14,"aria-hidden":"true"}):void 0,"data-testid":`${u}-status`,children:o}),f&&(r?f:t.jsx(c.Tooltip,{content:d,placement:"left",children:t.jsx("span",{tabIndex:0,"aria-label":d,children:f})}))]})},Ux=`
16
+ `,"aria-label":`Zoom level ${e}%`,children:[e,"%"]})}),t.jsx(c.Tooltip,{content:"Zoom in",placement:"top",offset:10,children:t.jsx(O,{size:"sm",radius:"sm",color:"default",variant:"bordered",isIconOnly:!0,isDisabled:u,onPress:o,"aria-label":"Zoom in",children:t.jsx(X.ZoomIn,{size:16})})})]})}function Eu({editor:e,isDisabled:n=!1}){const[s,a]=h.useState(!1),[r,i]=h.useState(""),[o,l]=h.useState(""),[d,u]=h.useState(!1),f=e.isActive("link"),m=x=>{if(x){const{from:g,to:y}=e.state.selection,b=e.isActive("link");let v="";if(b){const $=e.schema.marks.link,N=e.state.doc.resolve(g),A=fa.getMarkRange(N,$);A&&(v=e.state.doc.textBetween(A.from,A.to,""))}else v=e.state.doc.textBetween(g,y,"");const w=e.getAttributes("link").href||"";i(v),l(w),u(b)}a(x)},p=()=>{if(o.trim()){const{from:x,to:g}=e.state.selection,y=e.schema.marks.link,b=e.state.doc.resolve(x),v=fa.getMarkRange(b,y),w=v?.from??x,$=v?.to??g,N=e.state.doc.textBetween(w,$,"");r.trim()&&r!==N?e.chain().focus().setTextSelection({from:w,to:$}).deleteSelection().insertContent(`<a href="${o.trim()}">${r.trim()}</a>`).run():e.chain().focus().extendMarkRange("link").updateAttributes("link",{href:o.trim()}).run()}a(!1)};return t.jsxs(c.Popover,{isOpen:s,onOpenChange:m,placement:"bottom",children:[t.jsx(c.PopoverTrigger,{children:t.jsx(O,{size:"sm",radius:"sm",variant:f?"solid":"bordered",color:f?"primary":"default",isIconOnly:!0,isDisabled:n,"aria-label":"Link",children:t.jsx(X.Link,{size:16})})}),t.jsx(c.PopoverContent,{children:t.jsxs("div",{className:"flex flex-col gap-3 p-3 w-72",children:[t.jsx(c.Input,{size:"sm",variant:"bordered",label:"Name",labelPlacement:"outside",placeholder:"Link text",value:r,onChange:x=>i(x.target.value),classNames:{inputWrapper:"focus-within:border-default-400"}}),t.jsx(c.Input,{size:"sm",variant:"bordered",label:"Link",labelPlacement:"outside",placeholder:"https://example.com",value:o,onChange:x=>l(x.target.value),onKeyDown:x=>x.key==="Enter"&&p(),classNames:{inputWrapper:"focus-within:border-default-400"}}),t.jsx(O,{size:"sm",color:"primary",onPress:p,isDisabled:!o.trim(),children:d?"Update":"Apply"})]})})]})}function Du({children:e,id:n,label:s,className:a,useButtonGroup:r=!0}){return r?t.jsx(c.ButtonGroup,{size:"sm",id:n,"aria-label":s,className:a,children:e}):t.jsx("div",{id:n,role:"group","aria-label":s,className:`flex items-center gap-2 ${a||""}`,children:e})}function yi(e,n){const s=h.useMemo(()=>{if(!e)return{};const i={};return Array.from(new Set(n.map(l=>Gt(l)))).forEach(l=>{const d=lt[l];if(d)try{const u=d.canExecute?.(e)??!0,f=d.isActive?.(e)??!1;i[l]={isActive:f,isDisabled:!u,canExecute:u}}catch(u){console.warn(`Extension not available for modifier: ${l}`,u),i[l]={isActive:!1,isDisabled:!0,canExecute:!1}}}),i},[e,n]),[a,r]=h.useState(s);return h.useEffect(()=>{if(!e)return;const i=()=>{const o={};Array.from(new Set(n.map(d=>Gt(d)))).forEach(d=>{const u=lt[d];if(u)try{const f=u.canExecute?.(e)??!0,m=u.isActive?.(e)??!1;o[d]={isActive:m,isDisabled:!f,canExecute:f}}catch(f){console.warn(`Extension not available for modifier: ${d}`,f),o[d]={isActive:!1,isDisabled:!0,canExecute:!1}}}),r(o)};return e.on("selectionUpdate",i),e.on("transaction",i),()=>{e.off("selectionUpdate",i),e.off("transaction",i)}},[e,n,s]),a}function vi(e,n){const s=h.useCallback((o,l)=>{if(!e)return;const d=lt[o];if(d)try{d.execute({editor:e,config:l}),n?.({type:"toggle",modifier:o})}catch(u){console.warn(`Failed to execute command for modifier: ${o}`,u)}},[e,n]),a=h.useCallback(o=>{s(o)},[s]),r=h.useCallback((o,l)=>{if(!e)return!1;const d=lt[o];try{return d?.canExecute?.(e,l)??!1}catch(u){return console.warn(`Failed to check canExecute for modifier: ${o}`,u),!1}},[e]),i=h.useCallback((o,l)=>{if(!e)return!1;const d=lt[o];try{return d?.isActive?.(e,l)??!1}catch(u){return console.warn(`Failed to check isActive for modifier: ${o}`,u),!1}},[e]);return{executeCommand:s,toggleModifier:a,canExecute:r,isActive:i}}function Lu(e=Le.default){const[n,s]=h.useState(e),a=h.useCallback((l=Le.step)=>{s(d=>Math.min(Le.max,d+l))},[]),r=h.useCallback((l=Le.step)=>{s(d=>Math.max(Le.min,d-l))},[]),i=h.useCallback(()=>{s(Le.default)},[]),o=h.useCallback(l=>{const d=Math.max(Le.min,Math.min(Le.max,l));s(d)},[]);return{zoom:n,setZoom:o,zoomIn:a,zoomOut:r,resetZoom:i,isMinZoom:n<=Le.min,isMaxZoom:n>=Le.max,isDefaultZoom:n===Le.default}}const Fu=["bold","italic","strike","underline","code"];function Ru({editor:e,modifiers:n,onToolbarAction:s}){const a=yi(e,n),{toggleModifier:r}=vi(e,s);if(!e)return null;const i=n.map(o=>Gt(o)).filter(o=>Fu.includes(o));return i.length===0?null:t.jsx(Du,{id:"text-formatting",label:"Text formatting",children:i.map(o=>{const l=a[o],d=kt(o);return t.jsx(ht,{icon:d,label:o.charAt(0).toUpperCase()+o.slice(1),isActive:l?.isActive,isDisabled:l?.isDisabled,onClick:()=>r(o)},o)})})}function _u({editor:e,modifiers:n,zoom:s=100,onZoomChange:a,sticky:r=!0,className:i,onToolbarAction:o}){const l=yi(e,n),{toggleModifier:d,executeCommand:u}=vi(e,o);if(!e)return null;const f=n.map(C=>Gt(C)),m=f.some(C=>["bold","italic","strike","underline","code"].includes(C)),p=f.some(C=>["textColor","highlight"].includes(C)),x=f.includes("heading"),g=f.includes("textAlign"),y=f.some(C=>["bulletList","orderedList","taskList"].includes(C)),b=f.includes("blockquote"),v=f.includes("codeBlock"),w=f.includes("link"),$=f.includes("horizontalRule"),N=f.some(C=>["undo","redo"].includes(C)),A=s!==void 0&&a!==void 0,k=r?"sticky top-0 z-10":"";return t.jsx("div",{className:`w-full p-2 bg-background border-b border-divider ${k} ${i||""}`,children:t.jsxs("div",{className:"flex flex-row flex-wrap gap-2 w-full items-center",children:[m&&t.jsxs(t.Fragment,{children:[t.jsx(Ru,{editor:e,modifiers:n,onToolbarAction:o}),(p||x||g||y||b||v||w||$||N||A)&&t.jsx(xt,{})]}),p&&t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"flex items-center gap-1",children:[f.includes("textColor")&&t.jsx(_a,{editor:e,type:"textColor",label:"Text color",isDisabled:l.textColor?.isDisabled}),f.includes("highlight")&&t.jsx(_a,{editor:e,type:"highlight",label:"Highlight",isDisabled:l.highlight?.isDisabled})]}),(x||g||y||b||v||w||$||N||A)&&t.jsx(xt,{})]}),x&&t.jsxs(t.Fragment,{children:[t.jsx(vu,{editor:e}),(g||y||b||v||w||$||N||A)&&t.jsx(xt,{})]}),g&&t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"flex items-center gap-1",children:["left","center","right","justify"].map(C=>{const E=Su[C],S=e.isActive({textAlign:C});return t.jsx(ht,{icon:E,label:`Align ${C}`,isActive:S,onClick:()=>u("textAlign",{type:"textAlign",alignment:C})},C)})}),(y||b||v||w||$||N||A)&&t.jsx(xt,{})]}),y&&t.jsxs(t.Fragment,{children:[t.jsx(ju,{editor:e,types:f.filter(C=>["bulletList","orderedList","taskList"].includes(C))}),(b||v||w||$||N||A)&&t.jsx(xt,{})]}),(b||v||w||$)&&t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"flex items-center gap-1",children:[b&&t.jsx(ht,{icon:kt("blockquote"),label:"Blockquote",isActive:l.blockquote?.isActive,isDisabled:l.blockquote?.isDisabled,onClick:()=>d("blockquote")}),v&&t.jsx(ht,{icon:kt("codeBlock"),label:"Code block",isActive:l.codeBlock?.isActive,isDisabled:l.codeBlock?.isDisabled,onClick:()=>d("codeBlock")}),w&&t.jsx(Eu,{editor:e,isDisabled:l.link?.isDisabled}),$&&t.jsx(ht,{icon:kt("horizontalRule"),label:"Horizontal rule",onClick:()=>d("horizontalRule")})]}),(N||A)&&t.jsx(xt,{})]}),N&&t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"flex items-center gap-1",children:[f.includes("undo")&&t.jsx(ht,{icon:kt("undo"),label:"Undo",isDisabled:l.undo?.isDisabled,onClick:()=>d("undo")}),f.includes("redo")&&t.jsx(ht,{icon:kt("redo"),label:"Redo",isDisabled:l.redo?.isDisabled,onClick:()=>d("redo")})]}),A&&t.jsx(xt,{})]}),A&&t.jsx(Au,{zoom:s,onZoomChange:C=>{a?.(C),o?.({type:"zoom",modifier:`${C}%`})}})]})})}const _t={bold:{category:"mark",extension:Jo.Bold,priority:100},italic:{category:"mark",extension:ec.Italic,priority:100},strike:{category:"mark",extension:tc.Strike,priority:100},underline:{category:"mark",extension:nc.Underline,priority:100},code:{category:"mark",extension:sc.Code,priority:100},textColor:{category:"mark",extension:ac.Color,defaultOptions:{types:["textStyle","heading","paragraph","listItem","taskItem","blockquote"]},priority:90},highlight:{category:"mark",extension:rc.Highlight,defaultOptions:{multicolor:!0},priority:90},link:{category:"mark",extension:ic.Link,defaultOptions:{autolink:!0,linkOnPaste:!0,openOnClick:!1,HTMLAttributes:{class:"text-primary underline cursor-pointer"}},priority:100},heading:{category:"node",extension:oc.Heading,defaultOptions:{levels:[1,2,3,4,5,6]},priority:100},bulletList:{category:"node",extension:dc.BulletList,defaultOptions:{HTMLAttributes:{class:"list-disc"}},priority:90},orderedList:{category:"node",extension:uc.OrderedList,defaultOptions:{HTMLAttributes:{class:"list-decimal"}},priority:90},taskList:{category:"node",extension:mc.TaskList,defaultOptions:{HTMLAttributes:{class:"task-list"}},priority:90},codeBlock:{category:"node",extension:pc.CodeBlock,priority:100},blockquote:{category:"node",extension:hc.Blockquote,priority:100},horizontalRule:{category:"node",extension:bc.HorizontalRule,priority:100},hardBreak:{category:"node",extension:gc.HardBreak,priority:100},undo:{category:"extension",extension:xa.History,priority:50},redo:{category:"extension",extension:xa.History,priority:50},textAlign:{category:"extension",extension:yc.TextAlign,defaultOptions:{types:["heading","paragraph","listItem","bulletList","orderedList","taskList","taskItem","blockquote"],alignments:["left","center","right","justify"],defaultAlignment:"left"},priority:80},clearMarks:{category:"extension",extension:null,priority:50},clearNodes:{category:"extension",extension:null,priority:50}},Mu=[vc.Document,jc.Text,cc.Paragraph,lc.TextStyle.configure({HTMLAttributes:{}}),xc.ListItem.configure({HTMLAttributes:{}}),fc.TaskItem.configure({nested:!0}),wc.Dropcursor,Nc.Gapcursor];function Pu(e){const n=[],s=new Set,a=new Set;Mu.forEach(l=>{l&&(n.push(l),a.add(l.name))});const r=e.map(l=>Gt(l)),i=new Set;return r.forEach(l=>{const d=_t[l];d?.requiredExtensions&&d.requiredExtensions.forEach(u=>{i.add(u)})}),i.forEach(l=>{if(s.has(l))return;const d=_t[l];if(!d||d.extension===null)return;const u=d.extension.name;if(a.has(u)){s.add(l);return}const f=d.defaultOptions?d.extension.configure(d.defaultOptions):d.extension;n.push(f),s.add(l),a.add(u)}),r.forEach(l=>{if(s.has(l))return;const d=_t[l];if(!d){console.warn(`Extension config not found for modifier: ${l}`);return}if(d.extension===null){s.add(l);return}const u=d.extension.name;if(a.has(u)){s.add(l);return}const f=d.defaultOptions?d.extension.configure(d.defaultOptions):d.extension;n.push(f),s.add(l),a.add(u)}),n.sort((l,d)=>{const u=Object.values(_t).find(x=>x?.extension?.name===l.name),f=Object.values(_t).find(x=>x?.extension?.name===d.name),m=u?.priority??100;return(f?.priority??100)-m})}const ji={simple:["bold","italic","bulletList","orderedList","undo","redo"],blog:["bold","italic","underline",{type:"heading",level:2},{type:"heading",level:3},"textAlign","bulletList","orderedList","link","blockquote","undo","redo"],documentation:["bold","italic","strike","underline","code","clearMarks",{type:"heading",level:1},{type:"heading",level:2},{type:"heading",level:3},{type:"heading",level:4},{type:"heading",level:5},{type:"heading",level:6},"textAlign","bulletList","orderedList","taskList","link","textColor","highlight","codeBlock","blockquote","horizontalRule","hardBreak","undo","redo"],comment:["bold","italic","link","undo","redo"],full:["bold","italic","strike","underline","code","clearMarks",{type:"heading",level:1},{type:"heading",level:2},{type:"heading",level:3},{type:"heading",level:4},{type:"heading",level:5},{type:"heading",level:6},"textAlign","bulletList","orderedList","taskList","link","textColor","highlight","codeBlock","blockquote","horizontalRule","hardBreak","undo","redo"]},Tu={h1:`font-size: ${ge.fontSize["4xl"]}; font-weight: ${ge.fontWeight.semibold}; line-height: ${ge.lineHeight.tight}; margin: ${pe.md} 0 ${pe.sm} 0;`,h2:`font-size: ${ge.fontSize["2xl"]}; font-weight: ${ge.fontWeight.semibold}; line-height: ${ge.lineHeight.tight}; margin: ${pe.md} 0 ${pe.sm} 0;`,h3:`font-size: ${ge.fontSize.xl}; font-weight: ${ge.fontWeight.semibold}; line-height: ${ge.lineHeight.tight}; margin: ${pe.md} 0 ${pe.sm} 0;`,h4:`font-size: ${ge.fontSize.lg}; font-weight: ${ge.fontWeight.semibold}; line-height: ${ge.lineHeight.tight}; margin: ${pe.md} 0 ${pe.sm} 0;`,h5:`font-size: ${ge.fontSize.base}; font-weight: ${ge.fontWeight.semibold}; line-height: ${ge.lineHeight.tight}; margin: ${pe.md} 0 ${pe.sm} 0;`,h6:`font-size: ${ge.fontSize.sm}; font-weight: ${ge.fontWeight.semibold}; line-height: ${ge.lineHeight.tight}; margin: ${pe.md} 0 ${pe.sm} 0;`,p:`min-height: ${ge.lineHeight.normal}em; margin: 0;`,ul:`list-style-type: disc; list-style-position: outside; padding-left: ${pe.xl}; margin: ${pe.md} 0;`,ol:`list-style-type: decimal; list-style-position: outside; padding-left: ${pe.xl}; margin: ${pe.md} 0;`,li:`display: list-item; margin: ${pe.xs} 0;`,strong:`font-weight: ${ge.fontWeight.bold};`,em:"font-style: italic;",s:"text-decoration: line-through;",u:"text-decoration: underline;",code:`background-color: ${Ee.neutral.gray[100]}; border-radius: 0.4rem; font-size: ${ge.fontSize.sm}; padding: 0.25em 0.3em; font-family: ${ge.fontFamily.mono};`,pre:`background: ${Ee.neutral.gray[800]}; border-radius: ${pe.sm}; color: ${Ee.neutral.gray[100]}; font-family: ${ge.fontFamily.mono}; margin: ${pe.lg} 0; padding: 0.75rem ${pe.md}; overflow-x: auto;`,blockquote:`border-left: 3px solid ${Ee.neutral.gray[300]}; margin: ${pe.lg} 0; padding-left: ${pe.md}; color: ${Ee.neutral.gray[500]};`,hr:`border: none; border-top: 1px solid ${Ee.neutral.gray[200]}; margin: ${pe.xl} 0;`,a:`color: ${Ee.brand.primary.DEFAULT}; text-decoration: underline; cursor: pointer;`,mark:`background-color: ${Ee.palettes.warning[200]}; border-radius: ${pe.xs}; padding: 0 0.125rem;`,label:`display: flex; align-items: center; gap: ${pe.sm}; cursor: pointer;`,input:"cursor: pointer; margin: 0;"},Iu={taskList:"list-style: none; padding-left: 0; margin: 1rem 0;",taskItem:"display: flex; align-items: flex-start; gap: 0.5rem; margin: 0.5rem 0;"};function Ou(e){if(!e)return e;let n=e;for(const[s,a]of Object.entries(Iu)){const r=new RegExp(`(<(?:ul|li)[^>]*data-type="${s}"[^>]*)>`,"gi");n=n.replace(r,(i,o)=>i.includes('style="')?i.replace(/style="([^"]*)"/,`style="$1 ${a}"`):`${o} style="${a}">`)}for(const[s,a]of Object.entries(Tu)){const r=new RegExp(`<${s}(\\s[^>]*)?>`,"gi");n=n.replace(r,i=>{if(i.includes('data-type="taskList"')||i.includes('data-type="taskItem"'))return i;if(i.includes('style="'))return i.replace(/style="([^"]*)"/,`style="$1 ${a}"`);if(i.includes("style='"))return i.replace(/style='([^']*)'/,`style='$1 ${a}'`);{const o=i.indexOf(">");return`${i.slice(0,o)} style="${a}"${i.slice(o)}`}})}return n}const zu=({modifiers:e,zoom:n,onZoomChange:s,onToolbarAction:a})=>{const{editor:r}=Ns.useCurrentEditor();return t.jsx(_u,{editor:r,modifiers:e,zoom:n,onZoomChange:s,onToolbarAction:a})},Bu=({showCharacterCount:e,showWordCount:n})=>{const{editor:s}=Ns.useCurrentEditor();if(!s||!e&&!n)return null;const a=s.getText(),r=a.length,i=a.split(/\s+/).filter(o=>o.length>0).length;return t.jsxs("div",{className:"flex gap-4 text-xs text-default-500 px-2 pb-1",children:[e&&t.jsxs("span",{children:[r," characters"]}),n&&t.jsxs("span",{children:[i," words"]})]})},fs=h.forwardRef((e,n)=>{const{minRows:s=10,maxRows:a=30,disableAutosize:r=!1,showCharacterCount:i=!1,showWordCount:o=!1,showToolbar:l=!0,modifiers:d=ji.full,variant:u="bordered",initialContent:f,content:m,onContentChange:p,onUpdate:x,onToolbarAction:g,isReadOnly:y=!1,isDisabled:b=!1,includeInlineStyles:v=!0,...w}=e,{zoom:$,setZoom:N}=Lu(),A=Ra.lineHeight,k=s*A,C=r?void 0:a*A,E=h.useMemo(()=>Pu(d),[d]),{Component:S,label:_,shouldLabelBeOutside:F,getBaseProps:L,getLabelProps:M,getInputWrapperProps:I}=c.useInput({...w,variant:u,ref:n,isMultiline:!0}),W=_?t.jsx("label",{...M(),children:_}):null,K=h.useCallback(({editor:z})=>{const ne=z.getHTML(),G=v?Ou(ne):ne,se=z.getJSON(),Y=z.getText(),oe=Y.length,J=Y.split(/\s+/).filter(ie=>ie.length>0).length,q={html:G,json:se,text:Y,characters:oe,words:J};if(p?.(q),x?.(q),"onChange"in w&&typeof w.onChange=="function"){const ie={target:{value:G},currentTarget:{value:G}};w.onChange(ie)}},[p,x,w,v]);return t.jsxs(S,{...L(),children:[F?W:null,t.jsx("div",{...I(),className:c.cn(I().className,"flex flex-col w-full p-0 gap-0 rich-text-editor"),style:{maxHeight:C?`${C+Ra.toolbarHeight}px`:void 0,overflow:C?"auto":void 0},children:t.jsx(Ns.EditorProvider,{editable:!y&&!b,slotBefore:l?t.jsx(zu,{modifiers:d,zoom:$,onZoomChange:N,onToolbarAction:g}):void 0,slotAfter:t.jsx(Bu,{showCharacterCount:i,showWordCount:o}),editorContainerProps:{className:"w-full flex-1 outline-none",style:{minHeight:`${k}px`,fontSize:`${$}%`,display:"flex",flexDirection:"column"}},editorProps:{attributes:{class:"focus:outline-none w-full h-full"}},extensions:E,content:m||f||e.defaultValue||"",onUpdate:K})})]})});fs.displayName="TipTapEditor";const wi=h.forwardRef((e,n)=>{const{adapter:s="tiptap",variant:a="bordered",...r}=e;return s==="tiptap"?t.jsx(fs,{...r,variant:a,ref:n}):(console.warn(`Adapter "${s}" is not supported. Using TipTap.`),t.jsx(fs,{...r,variant:a,ref:n}))});wi.displayName="RichTextArea";function Ma(e,n="en-US",s="USD",a=!0){try{return new Intl.NumberFormat(n,a?{style:"currency",currency:s,minimumFractionDigits:0,maximumFractionDigits:2}:{style:"currency",currency:s}).format(e)}catch(r){return console.warn(`Invalid currency formatting: ${r}`),`${s} ${e.toFixed(2)}`}}const Pa=`h-auto min-w-0 w-full flex-col gap-0 border bg-white text-center shadow-none transition-colors data-[focus-visible=true]:outline-primary ${ke} motion-reduce:data-[pressed=true]:scale-100 [html[data-pos-reduce-motion=true]_&]:data-[pressed=true]:scale-100`,Ta=`border bg-white shadow-none ${ke}`,Vu={tile:{root:"flex flex-col",title:"mb-5 text-xs font-semibold uppercase tracking-[.04em] text-pos-muted",eyebrow:"mb-1 text-xs font-semibold uppercase tracking-[.08em] text-pos-muted",caption:"mb-3 text-sm text-pos-muted",grid:"grid gap-2",preset:`${Pa} rounded-xl px-1 py-3.5`,presetIdle:"border-pos-field text-pos-ink data-[hover=true]:border-pos-line-strong data-[hover=true]:bg-white",presetSelected:"border-primary bg-primary/[.09] text-primary data-[hover=true]:bg-primary/[.09]",amount:"text-base font-bold leading-[1.1875rem]",amountSelected:"",sublabel:"mt-1 text-xs font-semibold text-pos-neutral",customLabel:"mb-1.5 block text-sm font-semibold text-pos-ink",inputBase:"mt-2",inputWrapper:`${Ta} rounded-xl border-pos-field px-3.5 data-[hover=true]:border-pos-field group-data-[focus=true]:border-primary group-data-[focus=true]:data-[hover=true]:border-primary group-data-[focus=true]:shadow-[0_0_0_0.125rem_hsl(var(--heroui-primary)/0.14)]`,inputWrapperActive:"border-primary data-[hover=true]:border-primary",input:"text-pos-ink placeholder:text-pos-faint"},pos:{root:"flex flex-col",title:"mb-1.5 block text-[0.8125rem] font-semibold leading-[1.21875rem] text-pos-ink",eyebrow:"mb-1 text-[0.6875rem] font-semibold uppercase leading-[1.03125rem] tracking-[.08em] text-pos-muted",caption:"mb-3 text-[0.8125rem] leading-[1.21875rem] text-pos-muted",grid:"mb-3.5 grid grid-cols-[repeat(auto-fit,minmax(6rem,1fr))] gap-2.5",preset:`${Pa} rounded-[0.875rem] px-2.5 py-3`,presetIdle:"border-pos-line data-[hover=true]:border-primary data-[hover=true]:bg-white",presetSelected:"border-primary bg-primary/5 data-[hover=true]:bg-primary/5",amount:"text-[1.1875rem] font-semibold leading-[1.1875rem] text-pos-ink",amountSelected:"",sublabel:"mt-[0.3125rem] text-[0.71875rem] font-semibold leading-[0.875rem] text-pos-neutral",customLabel:"mb-1.5 block text-[0.8125rem] font-semibold leading-[1.21875rem] text-pos-ink",inputBase:"",inputWrapper:`${Ta} rounded-lg border-pos-line px-3 data-[hover=true]:border-pos-line group-data-[focus=true]:border-primary group-data-[focus=true]:data-[hover=true]:border-primary group-data-[focus=true]:shadow-[0_0_0_0.1875rem_hsl(var(--heroui-primary)/0.1)]`,inputWrapperActive:"border-primary data-[hover=true]:border-primary",input:"text-pos-ink placeholder:text-pos-muted"}},Uu={tile:{sm:{wrapper:"h-8 min-h-8",input:"text-sm"},md:{wrapper:"h-[2.375rem] min-h-[2.375rem]",input:"text-sm"},lg:{wrapper:"h-12 min-h-12",input:"text-base"}},pos:{sm:{wrapper:"h-8 min-h-8",input:"text-sm"},md:{wrapper:"h-10 min-h-10",input:"text-sm"},lg:{wrapper:"h-12 min-h-12",input:"text-base"}}},Ia=[{id:"100",amount:100},{id:"250",amount:250},{id:"500",amount:500},{id:"1000",amount:1e3},{id:"2000",amount:2e3}],Hu={title:"Donation Amount",customAmountPlaceholder:"Custom donation amount",customAmountAriaLabel:"Custom donation amount",addDonationButton:"Add Donation",presetsAriaLabel:"Suggested amounts"},Ni=({presetAmounts:e=Ia,selectedDonation:n,defaultSelectedDonation:s=null,onChange:a,onAddDonation:r,currency:i="USD",locale:o="en-US",showCustomAmount:l=!0,minCustomAmount:d=.5,maxCustomAmount:u=1e6,labels:f,mobileColumns:m=2,desktopColumns:p=3,isDisabled:x=!1,buttonVariant:g="bordered",buttonColor:y="default",inputVariant:b="bordered",size:v="md",className:w="",showCard:$=!0,variant:N="pill",isRequired:A=!1})=>{const k={...Hu,...f},C=h.useId(),E=`${C}-title`,S=`${C}-custom`,_=Array.isArray(e)?e:Ia,F={2:"grid-cols-2",3:"grid-cols-3"},L={3:"sm:grid-cols-3",4:"sm:grid-cols-4",5:"sm:grid-cols-5",6:"sm:grid-cols-6"},M=`${F[m]} ${L[p]}`,[I,W]=En(n,s,a),[K,z]=h.useState(""),[ne,G]=h.useState(!1),[se,Y]=h.useState(0),oe=h.useCallback(Z=>{if(x)return;const he={amount:Z.amount,isCustom:!1,presetId:Z.id};W(he),z(""),G(!1),Y(Je=>Je+1),r?.(he)},[x,W,r]),J=h.useCallback(Z=>{if(x)return;if(z(Z!==void 0?String(Z):""),r){W(null);return}if(G(!1),Z===void 0||isNaN(Z)){W(null);return}W({amount:Z,isCustom:!0})},[x,W,r]),q=h.useCallback(()=>{if(x)return;const Z=K!==""?parseFloat(K):void 0;Z===void 0||isNaN(Z)||r?.({amount:Z,isCustom:!0})},[x,K,r]),ie=h.useMemo(()=>({style:"currency",currency:i,currencyDisplay:"symbol"}),[i]),V=Z=>I!==null&&!I.isCustom&&I.presetId===Z.id,ee=(Z,he)=>{const Je=I?.isCustom===!0,We=!r&&ne;return t.jsxs("div",{className:Z.root,"data-testid":"donation-amounts-root","data-variant":N,children:[k.eyebrow&&t.jsx("p",{className:Z.eyebrow,"data-testid":"donation-amounts-eyebrow",children:k.eyebrow}),k.title&&t.jsxs("p",{id:E,className:Z.title,"data-testid":"donation-amounts-title",children:[k.title,A&&t.jsx("span",{"aria-hidden":"true",className:"ml-0.5 text-pos-danger",children:"*"})]}),k.caption&&t.jsx("p",{className:Z.caption,"data-testid":"donation-amounts-caption",children:k.caption}),_.length>0&&t.jsx("div",{role:"group","aria-labelledby":k.title?E:void 0,"aria-label":k.title?void 0:k.presetsAriaLabel,className:c.cn(Z.grid,N==="tile"&&M),"data-testid":"donation-amounts-presets",children:_.map(ve=>{const qe=V(ve)&&!We;return t.jsxs(O,{color:"default",variant:"bordered",disableRipple:!0,"aria-pressed":qe,className:c.cn(Z.preset,qe?Z.presetSelected:Z.presetIdle),onPress:()=>oe(ve),isDisabled:x,"data-selected":qe||void 0,"data-testid":`donation-amounts-preset-${ve.id}`,children:[t.jsx("span",{className:c.cn(Z.amount,qe&&Z.amountSelected),children:ve.label||Ma(ve.amount,o,i,N!=="pos")}),ve.sublabel&&" ",ve.sublabel&&t.jsx("span",{className:Z.sublabel,"data-testid":`donation-amounts-preset-${ve.id}-sublabel`,children:ve.sublabel})]},ve.id)})}),l&&t.jsxs("div",{className:c.cn("flex flex-col",Z.inputBase),children:[k.customAmountLabel&&t.jsx("label",{htmlFor:S,className:Z.customLabel,"data-testid":"donation-amounts-custom-label",children:k.customAmountLabel}),t.jsxs("div",{className:"flex items-start gap-3",children:[t.jsx(c.NumberInput,{id:S,placeholder:k.customAmountPlaceholder,"aria-label":k.customAmountLabel?void 0:k.customAmountAriaLabel,onInput:r?()=>{W(null),G(!0)}:()=>G(!0),onBlur:r?void 0:()=>G(!1),variant:"bordered",minValue:d,maxValue:u,step:.01,formatOptions:ie,value:K!==""?parseFloat(K):void 0,onValueChange:J,isDisabled:x,className:"flex-1",classNames:{inputWrapper:c.cn(Z.inputWrapper,he.wrapper,(Je||We)&&Z.inputWrapperActive),input:c.cn(Z.input,he.input)},"data-testid":"donation-amounts-custom-input",hideStepper:!0},r?`custom-${se}`:I?.isCustom===!1?I.presetId:"custom"),r&&t.jsx(O,{color:"primary",variant:"solid",size:v,className:"shrink-0",onPress:q,isDisabled:x||!ne,"data-testid":"donation-amounts-add-button",children:k.addDonationButton})]})]})]})},te=t.jsxs("div",{className:"space-y-4","data-testid":"donation-amounts-root",children:[k.title&&t.jsx("h2",{id:E,className:"text-base font-semibold","data-testid":"donation-amounts-title",children:k.title}),_.length>0&&t.jsx("div",{role:"group","aria-labelledby":k.title?E:void 0,"aria-label":k.title?void 0:k.presetsAriaLabel,className:c.cn("grid gap-3",M),"data-testid":"donation-amounts-presets",children:_.map(Z=>{const he=I!==null&&!I.isCustom&&I.presetId===Z.id;return t.jsx(O,{color:he?"primary":y,variant:he?"solid":g,className:"w-full","aria-pressed":he,onPress:()=>oe(Z),isDisabled:x,"data-testid":`donation-amounts-preset-${Z.id}`,children:Z.label||Ma(Z.amount,o,i)},Z.id)})}),l&&t.jsxs("div",{className:"flex gap-3 items-start",children:[t.jsx(c.NumberInput,{placeholder:k.customAmountPlaceholder,"aria-label":k.customAmountAriaLabel,onInput:r?()=>{W(null),G(!0)}:void 0,variant:b,radius:"full",size:v,minValue:d,maxValue:u,step:.01,formatOptions:ie,value:K!==""?parseFloat(K):void 0,onValueChange:J,isDisabled:x,className:"flex-1 [&_[data-slot=input-wrapper]]:!h-10 [&_[data-slot=input-wrapper]]:!min-h-10","data-testid":"donation-amounts-custom-input",hideStepper:!0},r?`custom-${se}`:I?.isCustom===!1?I.presetId:"custom"),r&&t.jsx(O,{color:"primary",variant:"solid",radius:"full",size:v,className:"shrink-0",onPress:q,isDisabled:x||!ne,"data-testid":"donation-amounts-add-button",children:k.addDonationButton})]})]}),Fe=N==="pill"?te:ee(Vu[N],Uu[N][v]);return $?t.jsx(c.Card,{className:c.cn("w-full",w),"data-testid":"donation-amounts-card",children:t.jsx(c.CardBody,{children:Fe})}):t.jsx("div",{className:c.cn("w-full",w),"data-testid":"donation-amounts-plain",children:Fe})};Ni.displayName="DonationAmounts";const Wu=e=>{const n=Math.max(0,e),s=Math.floor(n/60).toString().padStart(2,"0"),a=(n%60).toString().padStart(2,"0");return`${s}:${a} minutes`},qu=e=>{switch(e){case"warning":return X.Clock;case"error":return X.AlertCircle;case"success":return X.CheckCircle;default:return X.Clock}},Gu=e=>{switch(e){case"primary":return"bg-primary-500";case"secondary":return"bg-gray-700";case"success":return"bg-green-600";case"warning":return"bg-amber-500";case"danger":return"bg-red-600";default:return"bg-primary-500"}},Ci=h.forwardRef(({timeLeft:e,defaultTimeLeft:n=1200,onTimeChange:s,onExpire:a,variant:r="info",color:i="primary",message:o="Your cart expires in:",showIcon:l=!0,icon:d,position:u="fixed",autoStart:f=!0,formatTime:m=Wu,className:p,...x},g)=>{const[y,b]=En(e!==void 0?Math.max(0,e):void 0,Math.max(0,n),s),v=h.useRef(null),w=h.useRef(!1);h.useEffect(()=>()=>{v.current&&clearInterval(v.current)},[]),h.useEffect(()=>{if(!f||y<=0){v.current&&(clearInterval(v.current),v.current=null);return}return v.current=setInterval(()=>{b(k=>k<=1?(v.current&&(clearInterval(v.current),v.current=null),w.current||(w.current=!0,a?.()),0):k-1)},1e3),()=>{v.current&&(clearInterval(v.current),v.current=null)}},[f,y,b,a]),h.useEffect(()=>{y>0&&(w.current=!1)},[y]);const $=d||qu(r),N=Gu(i),A={fixed:"fixed top-0 left-0",sticky:"sticky top-0",static:"static"};return t.jsx("div",{ref:g,role:"banner","aria-live":"polite","aria-label":`${o} ${m(y)}`,"data-testid":"expire-cart-timer",className:c.cn("w-full text-white z-50",N,A[u],p),...x,children:t.jsx("div",{className:"container mx-auto px-4 py-3 sm:py-2.5","data-testid":"expire-cart-timer-container",children:t.jsxs("div",{className:"flex items-center justify-between gap-3 sm:gap-4",children:[t.jsxs("div",{className:"flex items-center gap-3 sm:gap-2.5 flex-1 min-w-0","data-testid":"expire-cart-timer-left",children:[l&&t.jsx("div",{className:"flex-shrink-0 w-[0.875rem] h-[0.875rem] sm:w-4 sm:h-4 rounded-full bg-white flex items-center justify-center overflow-hidden","data-testid":"expire-cart-timer-icon-wrapper",children:t.jsx($,{className:"text-primary-500 sm:text-primary-600","aria-hidden":"true",size:14,"data-testid":"expire-cart-timer-icon"})}),t.jsx("p",{className:"text-sm sm:text-base font-medium text-white","data-testid":"expire-cart-timer-message",children:o})]}),t.jsx("div",{className:"flex-shrink-0","data-testid":"expire-cart-timer-right",children:t.jsx("span",{className:"text-sm sm:text-base font-semibold text-white","aria-label":`Time remaining: ${m(y)}`,"data-testid":"expire-cart-timer-value",children:m(y)})})]})})})});Ci.displayName="ExpireCartTimer";const vt=({icon:e,children:n,testId:s})=>t.jsxs("div",{className:"flex items-center gap-2 text-sm text-gray-600","data-testid":s,children:[t.jsx(P,{icon:e,width:20,className:"text-default-500"}),t.jsx("span",{children:n})]}),Ku=({classes:e="",name:n,imageUrl:s,eventDate:a,eventTime:r,location:i,description:o,showImage:l=!1,compact:d=!1,layout:u="stacked",imageLoading:f="eager",showMoreButtonClassName:m,labels:p})=>{const[x,g]=h.useState(!1),[y,b]=h.useState(!1),v=h.useRef(null);return h.useEffect(()=>{const w=()=>{if(v.current){const $=v.current.scrollHeight>v.current.clientHeight;b($)}};return w(),window.addEventListener("resize",w),()=>window.removeEventListener("resize",w)},[o]),u==="horizontal"?t.jsx(c.Card,{className:c.cn("border-0 shadow-none",e),"data-testid":"event-details-root",children:t.jsx(c.CardBody,{className:"p-0","data-testid":"event-details-horizontal-layout",children:t.jsxs("div",{className:"flex flex-col items-start gap-5 sm:flex-row sm:gap-8",children:[l&&s&&t.jsx("div",{className:"w-full shrink-0 overflow-hidden rounded-xl aspect-[3/2] sm:w-[360px]","data-testid":"event-details-image-wrapper",children:t.jsx(c.Image,{removeWrapper:!0,loading:f,alt:`Event image for ${n}`,className:"w-full h-full object-cover object-center",src:s,"data-testid":"event-details-image"})}),t.jsxs("div",{className:"min-w-0 flex-1 space-y-3",children:[t.jsx("h2",{className:"font-semibold text-2xl text-gray-800","data-testid":"event-details-title",children:n}),t.jsx("h3",{className:"font-semibold text-base text-gray-700","data-testid":"event-details-info-label",children:p.eventInformation}),t.jsxs("div",{className:"flex flex-wrap gap-4","data-testid":"event-details-info",children:[a&&t.jsx(vt,{icon:"solar:calendar-minimalistic-linear",testId:"event-details-date",children:a}),r&&t.jsx(vt,{icon:"solar:clock-circle-linear",testId:"event-details-time",children:r}),i&&t.jsx(vt,{icon:"solar:map-point-linear",testId:"event-details-location",children:i})]}),o&&t.jsxs("div",{className:"relative","data-testid":"event-details-description-wrapper",children:[t.jsxs("div",{className:"relative",children:[t.jsx("div",{ref:v,className:c.cn("text-sm text-gray-700 leading-relaxed transition-all",!x&&"line-clamp-3"),"data-testid":"event-details-description",dangerouslySetInnerHTML:{__html:o}}),!x&&y&&t.jsx("div",{className:"absolute inset-x-0 -bottom-1 h-8 bg-gradient-to-t from-white via-white/70 to-transparent pointer-events-none","data-testid":"event-details-description-fade"})]}),(y||x)&&t.jsx("div",{className:"flex justify-end mt-1",children:t.jsx(O,{onPress:()=>g(!x),variant:"light",className:c.cn("text-primary",m),size:"md",startContent:t.jsx(P,{icon:x?"solar:eye-closed-linear":"solar:eye-linear",width:20}),"data-testid":"event-details-toggle-description",children:x?p.showLess||"Hide":p.showMore||"Show"})})]})]})]})})}):t.jsxs(c.Card,{className:c.cn("border-0 shadow-none",e),"data-testid":"event-details-root",children:[t.jsxs(c.CardHeader,{className:c.cn("pt-2 pb-0 flex-col items-start",d?"space-y-1":"space-y-2"),"data-testid":"event-details-header",children:[l&&s&&t.jsx("div",{className:c.cn("w-full overflow-hidden rounded-xl","aspect-[3/1]"),"data-testid":"event-details-image-wrapper",children:t.jsx(c.Image,{removeWrapper:!0,loading:f,alt:`Event image for ${n}`,className:"w-full h-full object-cover object-center",src:s,"data-testid":"event-details-image"})}),t.jsx("h2",{className:c.cn("font-semibold text-gray-800",d?"text-base":"text-xl"),"data-testid":"event-details-title",children:n})]}),t.jsxs(c.CardBody,{className:c.cn("space-y-3",d?"py-1 space-y-2":"py-3"),"data-testid":"event-details-body",children:[t.jsx("h3",{className:c.cn("font-semibold text-base text-gray-700",d?"text-sm":""),"data-testid":"event-details-info-label",children:p.eventInformation}),t.jsxs("div",{className:"flex flex-wrap gap-4","data-testid":"event-details-info",children:[a&&t.jsx(vt,{icon:"solar:calendar-minimalistic-linear",testId:"event-details-date",children:a}),r&&t.jsx(vt,{icon:"solar:clock-circle-linear",testId:"event-details-time",children:r}),i&&t.jsx(vt,{icon:"solar:map-point-linear",testId:"event-details-location",children:i})]}),o&&t.jsxs("div",{className:"relative","data-testid":"event-details-description-wrapper",children:[t.jsxs("div",{className:"relative",children:[t.jsx("div",{ref:v,className:c.cn("text-sm text-gray-700 leading-relaxed transition-all",d?"text-xs":"",!x&&"line-clamp-3"),"data-testid":"event-details-description",dangerouslySetInnerHTML:{__html:o}}),!x&&y&&t.jsx("div",{className:"absolute inset-x-0 -bottom-1 h-8 bg-gradient-to-t from-white via-white/70 to-transparent pointer-events-none","data-testid":"event-details-description-fade"})]}),(y||x)&&t.jsx("div",{className:"flex justify-end mt-1",children:t.jsx(O,{onPress:()=>g(!x),variant:"light",className:c.cn("text-primary",m),size:d?"sm":"md",startContent:t.jsx(P,{icon:x?"solar:eye-closed-linear":"solar:eye-linear",width:d?16:20}),"data-testid":"event-details-toggle-description",children:x?p.showLess||"Hide":p.showMore||"Show"})})]})]})]})};function xs(e,n="en-US",s="USD"){try{return new Intl.NumberFormat(n,{style:"currency",currency:s,minimumFractionDigits:2,maximumFractionDigits:2}).format(e)}catch(a){return console.warn(`Invalid currency formatting: ${a}`),`${s} ${e.toFixed(2)}`}}function Yu(e){const n=e.replace(/[^\d.,-]/g,""),s=n.match(/,\d{1,2}$/);let a;s?a=n.replace(/\./g,"").replace(",","."):a=n.replace(/,/g,"");const r=parseFloat(a);return isNaN(r)?null:r}const Qu={person:"Person",people:"People",tickets:"Tickets:",soldOut:"Sold Out",maxReached:"Maximum number of tickets allowed reached",ruleBlocked:"Unavailable for selected ticket options",disabled:"Ticket selection is unavailable"},jt=e=>typeof e=="number"&&!isNaN(e),hn=({offer:e,quantity:n,defaultQuantity:s=0,onQuantityChange:a,currency:r="USD",locale:i="en-US",labels:o,slots:l,isDisabled:d=!1,buttonVariant:u="bordered",buttonColor:f="default",showCard:m=!0,showDescription:p=!0,showPeopleCount:x=!0,showPrice:g=!0,priceDisplay:y,classNames:b={},"data-testid":v,selectedColor:w="default",selectionMode:$="stepper",compact:N=!1,isSoldOut:A,isMaxReached:k,isRuleBlocked:C,statusTone:E="default",statusLabel:S,disabledReason:_,disabled:F})=>{const L=h.useMemo(()=>({...Qu,...o}),[o]),[M,I]=h.useState(s),W=n!==void 0?n:M,K=!!(d||F),z=N||!!e.compact,ne=$==="press-to-add",G=h.useMemo(()=>typeof A=="boolean"?A:typeof e.isSoldOut=="boolean"?e.isSoldOut:!jt(e.totalTicketsSold)||!jt(e.ticketsAllowed)?!1:e.totalTicketsSold>=e.ticketsAllowed,[A,e.isSoldOut,e.totalTicketsSold,e.ticketsAllowed]),se=h.useMemo(()=>typeof k=="boolean"?k:typeof e.isMaxReached=="boolean"?e.isMaxReached:G||!jt(e.ticketsAllowed)?!1:W>=e.ticketsAllowed-(e.totalTicketsSold??0),[k,e.isMaxReached,G,e.ticketsAllowed,e.totalTicketsSold,W]),Y=h.useMemo(()=>typeof C=="boolean"?C:typeof e.isRuleBlocked=="boolean"?e.isRuleBlocked:!1,[C,e.isRuleBlocked]),oe=_||e.disabledReason,J=K||G||Y,q=me=>{if(J||me>0&&se)return;const $e=Math.max(0,W+me);n===void 0&&I($e),a?.(e.id,$e)},ie=h.useMemo(()=>{if(G)return"soldOut";if(Y)return"ruleBlocked";if(K)return"disabled"},[G,Y,K]),V=h.useMemo(()=>E||(G||Y?"danger":se?"warning":"default"),[E,G,Y,se]),ee=h.useMemo(()=>{if(ie)return ie==="ruleBlocked"?S||oe||L.ruleBlocked:ie==="soldOut"?S||oe||L.soldOut:ie==="disabled"?S||oe||L.disabled:S||L.maxReached},[ie,S,oe,L]),te={soldOut:"danger",ruleBlocked:V,disabled:"default",maxReached:"warning"},Fe={soldOut:"offer-card-sold-out-chip",maxReached:"offer-card-max-reached-chip",ruleBlocked:"offer-card-ruleBlocked-chip",disabled:"offer-card-disabled-chip"},Z=()=>l?.renderName?l.renderName(e.name,e):t.jsx("h2",{"data-testid":"offer-card-name",className:c.cn("text-base font-medium",z&&"text-sm",b.name),children:e.name}),he=()=>{if(!g)return null;const me=y?.price??e.price,$e=y?.originalPrice,et=xs(me,i,r);if(l?.renderPrice)return l.renderPrice(me,et,e);if(jt($e)&&jt(me)&&$e>me){const D=xs($e,i,r);return t.jsxs("div",{"data-testid":"offer-card-price",className:c.cn("flex items-center gap-2 mt-1",z&&"mt-0.5",b.price),children:[t.jsxs("span",{className:"sr-only",children:["Original price ",D,", discounted price ",et]}),t.jsx("span",{"aria-hidden":"true","data-testid":"offer-card-original-price",className:c.cn("text-gray-400 line-through text-sm",z&&"text-xs",b.originalPrice),children:D}),t.jsx("span",{"aria-hidden":"true","data-testid":"offer-card-discounted-price",className:c.cn("text-primary text-base font-semibold",z&&"text-sm",b.discountedPrice),children:et})]})}return t.jsx("p",{"data-testid":"offer-card-price",className:c.cn("text-primary text-base mt-1",z&&"text-sm mt-0.5",b.price),children:et})},Je=()=>!p||!e.description?null:l?.renderDescription?l.renderDescription(e.description,e):t.jsx("p",{"data-testid":"offer-card-description",className:c.cn("mb-4 text-sm text-gray-700 leading-relaxed",z&&"mb-2 text-xs text-gray-600",b.description),children:e.description}),We=()=>{if(!x||!jt(e.numberOfPeople)||e.numberOfPeople<=0)return null;const me=e.numberOfPeople===1?L.person:L.people;return l?.renderPeopleCount?l.renderPeopleCount(e.numberOfPeople,me,e):t.jsxs("p",{"data-testid":"offer-card-people-count",className:c.cn("text-sm text-gray-600 flex items-center mt-2",z&&"mt-1 text-xs",b.peopleCount),children:[t.jsx(P,{icon:e.numberOfPeople<=1?"solar:user-rounded-outline":"solar:users-group-rounded-outline",width:20,className:"mr-1"}),e.numberOfPeople," ",me]})},ve=()=>{const me=W===0||J,$e=se||J;return l?.renderQuantitySelector?l.renderQuantitySelector({quantity:W,onIncrement:()=>q(1),onDecrement:()=>q(-1),isDecrementDisabled:me,isIncrementDisabled:$e,isDisabled:J}):t.jsxs("div",{className:c.cn("flex items-center gap-2",b.quantitySelector),children:[t.jsx(O,{"data-testid":"offer-card-decrement-button",onPress:()=>q(-1),isDisabled:me,variant:u,color:W>0?w:f,radius:"full",isIconOnly:!0,size:z?"md":"sm","aria-label":"Decrease quantity",children:t.jsx(P,{icon:"gravity-ui:minus",width:16})}),t.jsx("span",{"data-testid":"offer-card-quantity",className:c.cn("min-w-[2rem] text-center font-medium",z&&"text-sm"),children:W}),t.jsx(O,{"data-testid":"offer-card-increment-button",onPress:()=>q(1),isDisabled:$e,variant:u,color:W>0?w:f,radius:"full",isIconOnly:!0,size:z?"md":"sm","aria-label":"Increase quantity",children:t.jsx(P,{icon:"gravity-ui:plus",width:16})})]})},qe=(me,$e)=>l?.renderDisabledState?l.renderDisabledState(me,$e):me==="soldOut"&&l?.renderSoldOut?l.renderSoldOut($e):me==="maxReached"&&l?.renderMaxReachedAlert?l.renderMaxReachedAlert($e):t.jsx(c.Chip,{"data-testid":Fe[me],color:te[me],variant:me==="maxReached"?"flat":"solid",className:c.cn("gap-2 px-4",me==="maxReached"?"h-8":"h-10",me==="soldOut"&&b.soldOut,me==="maxReached"&&b.maxReachedAlert,z&&"h-8"),startContent:t.jsx(P,{icon:"gravity-ui:triangle-exclamation-fill",width:14}),children:t.jsx("span",{className:"font-medium text-sm",children:$e})}),ot=t.jsxs("div",{className:c.cn("grid grid-cols-1 md:grid-cols-1 xl:grid-cols-3 lg:grid-cols-3 items-start",z?"gap-1":"gap-2"),children:[t.jsxs("div",{className:c.cn("h-full col-span-2",J||se?"opacity-50 pointer-events-none select-none":""),children:[Z(),he(),t.jsxs("div",{className:c.cn("md:col-span-1 xl:col-span-2 lg:col-span-1",z?"mb-1":"mb-2"),children:[We(),Je()]})]}),!ne&&t.jsx("div",{className:c.cn("space-x-2 pt-0 pb-2 md:p-2 h-full flex items-center justify-start md:justify-start lg:justify-end",z&&"space-x-1 pb-1 md:p-1",b.compactFooter),children:ie&&ee?qe(ie,ee):ve()})]}),Ge=se&&!G&&!Y&&!K?t.jsx(Te.motion.div,{className:c.cn("w-full sm:max-w-[60%] md:max-w-[60%] lg:max-w-[60%]",b.compactFooter),initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:10},transition:{duration:.3},children:qe("maxReached",ee||L.maxReached)}):null;return m?t.jsxs(c.Card,{className:c.cn("w-full",ne&&!J&&!se&&"cursor-pointer",z&&b.compact,b.base),"data-testid":v||`offer-card-${e.id}`,isPressable:ne&&!J&&!se,onPress:ne&&!J&&!se?()=>q(1):void 0,children:[t.jsx(c.CardBody,{className:c.cn("pt-1 pb-0",z?"pb-0.5":"",b.body),children:ot}),t.jsx(Te.AnimatePresence,{children:Ge&&t.jsx(c.CardFooter,{className:c.cn("w-full mt-0 pt-0",z?"pt-1":"",b.footer),children:Ge})})]}):t.jsxs("div",{className:c.cn("w-full",z&&b.compact,b.base),"data-testid":v||`offer-card-${e.id}`,children:[t.jsx("div",{className:c.cn("pt-1 pb-0",z?"pb-0.5":"",b.body),children:ot}),t.jsx(Te.AnimatePresence,{children:Ge&&t.jsx("div",{className:c.cn("w-full mt-0 pt-0",z?"pt-1":"",b.footer),children:Ge})})]})};hn.displayName="OfferCard";const ki=({message:e="No offers available.",icon:n="solar:ticket-sale-outline",iconSize:s=48,showCard:a=!0,classNames:r={},renderEmpty:i})=>{if(i){const l=i();return a?t.jsx(c.Card,{"data-testid":"offer-card-empty",className:c.cn("w-full",r.base),children:t.jsx(c.CardBody,{"data-testid":"offer-card-empty-body",children:l})}):t.jsx("div",{"data-testid":"offer-card-empty",className:c.cn("w-full",r.base),children:l})}const o=t.jsxs("div",{"data-testid":"offer-card-empty-content",className:c.cn("flex flex-col items-center justify-center p-8 text-center text-gray-500",r.content),children:[t.jsx(P,{"data-testid":"offer-card-empty-icon",icon:n,width:s,className:c.cn("mb-4",r.icon)}),t.jsx("h3",{"data-testid":"offer-card-empty-message",className:c.cn("text-lg",r.message),children:e})]});return a?t.jsx(c.Card,{"data-testid":"offer-card-empty",className:c.cn("w-full",r.base),children:t.jsx(c.CardBody,{"data-testid":"offer-card-empty-body",children:o})}):t.jsx("div",{"data-testid":"offer-card-empty",className:c.cn("w-full",r.base),children:o})};ki.displayName="OfferCardEmpty";const Zu={title:"Error Fetching Offers",description:"An error occurred while fetching offers."},Si=({error:e,labels:n,showCard:s=!0,color:a="danger",classNames:r={}})=>{const i={...Zu,...n},o=t.jsx(c.Alert,{"data-testid":"offer-card-error-alert",color:a,title:i.title,description:e||i.description,className:r.alert});return s?t.jsx(c.Card,{"data-testid":"offer-card-error",className:c.cn("w-full",r.base),children:t.jsx(c.CardBody,{"data-testid":"offer-card-error-body",children:o})}):t.jsx("div",{"data-testid":"offer-card-error",className:c.cn("w-full",r.base),children:o})};Si.displayName="OfferCardError";const Xu={1:"space-y-1",2:"space-y-2",3:"space-y-3",4:"space-y-4",5:"space-y-5",6:"space-y-6"},$i=({quantity:e=2,gap:n=4,classNames:s={}})=>{const a=Xu[n];return t.jsx("div",{"data-testid":"offer-card-skeleton-container",className:c.cn(a,s.base),children:Array.from({length:e}).map((r,i)=>t.jsxs(c.Card,{"data-testid":`offer-card-skeleton-${i}`,className:c.cn("w-full",s.card),children:[t.jsx(c.CardHeader,{"data-testid":`offer-card-skeleton-header-${i}`,className:"flex justify-between items-start pb-0",children:t.jsxs("div",{className:"space-y-2 w-full",children:[t.jsx(c.Skeleton,{"data-testid":`offer-card-skeleton-title-${i}`,className:"w-1/3 rounded-lg",children:t.jsx("div",{className:"h-4 bg-default-200 rounded-lg"})}),t.jsx(c.Skeleton,{"data-testid":`offer-card-skeleton-subtitle-${i}`,className:"w-1/4 rounded-lg",children:t.jsx("div",{className:"h-3 bg-default-300 rounded-lg"})})]})}),t.jsx(c.CardBody,{"data-testid":`offer-card-skeleton-body-${i}`,className:"pt-2 pb-0",children:t.jsxs("div",{className:"grid grid-cols-1 xl:grid-cols-3 gap-2 items-start",children:[t.jsxs("div",{className:"xl:col-span-2 space-y-2",children:[t.jsx(c.Skeleton,{"data-testid":`offer-card-skeleton-people-${i}`,className:"w-1/4 rounded-lg",children:t.jsx("div",{className:"h-4 bg-default-300 rounded-lg"})}),t.jsx(c.Skeleton,{"data-testid":`offer-card-skeleton-description-${i}`,className:"w-3/4 rounded-lg",children:t.jsx("div",{className:"h-4 bg-default-200 rounded-lg"})})]}),t.jsx("div",{className:"flex items-start justify-end",children:t.jsxs("div",{"data-testid":`offer-card-skeleton-controls-${i}`,className:"flex items-center justify-end gap-2 w-full px-4 py-2",children:[t.jsx(c.Skeleton,{"data-testid":`offer-card-skeleton-label-${i}`,className:"w-24 h-4 rounded-md bg-default-200"}),t.jsxs("div",{className:"flex gap-2",children:[t.jsx(c.Skeleton,{"data-testid":`offer-card-skeleton-btn-dec-${i}`,className:"w-8 h-8 rounded-md bg-default-300"}),t.jsx(c.Skeleton,{"data-testid":`offer-card-skeleton-btn-qty-${i}`,className:"w-8 h-8 rounded-md bg-default-200"}),t.jsx(c.Skeleton,{"data-testid":`offer-card-skeleton-btn-inc-${i}`,className:"w-8 h-8 rounded-md bg-default-300"})]})]})})]})})]},i))})};$i.displayName="OfferCardSkeleton";const Ai={hidden:{opacity:0},show:{opacity:1,transition:{staggerChildren:.15,delayChildren:.1}}},Ei={hidden:{opacity:0,y:8},show:{opacity:1,y:0,transition:{duration:.45,ease:"easeOut"}},exit:{opacity:0,y:-5,transition:{duration:.35,ease:"easeIn"}}},Ju={1:"gap-1",2:"gap-2",3:"gap-3",4:"gap-4",5:"gap-5",6:"gap-6"},Di=({offers:e=[],mapOffer:n,selection:s,defaultSelection:a={},onSelectionChange:r,onQuantityChange:i,currency:o="USD",locale:l="en-US",labels:d,slots:u,isDisabled:f=!1,buttonVariant:m="bordered",buttonColor:p="default",showCard:x=!0,animated:g=!0,gap:y=2,compact:b=!1,classNames:v={}})=>{const[w,$]=h.useState(a),N=s!==void 0?s:w,A=h.useCallback((F,L)=>{const M={...N,[F]:Math.max(0,L)};s===void 0&&$(M),r?.(M),i?.(F,M[F])},[N,s,r,i]),k=[...e].sort((F,L)=>(F.position??0)-(L.position??0)),C=F=>{const L=n?n(F):F,M=(N??{})[L.id]||0;return{offer:L,quantity:M,onQuantityChange:A,currency:o,locale:l,labels:d,slots:u,isDisabled:f,buttonVariant:m,buttonColor:p,showCard:x,compact:b}},E=Ju[y],S=c.cn("grid mx-auto pt-2",E,v.base),_=F=>{const L=C(F);return t.jsx(hn,{offer:L.offer,quantity:L.quantity,onQuantityChange:L.onQuantityChange,currency:L.currency,locale:L.locale,labels:L.labels,slots:L.slots,isDisabled:L.isDisabled,buttonVariant:L.buttonVariant,buttonColor:L.buttonColor,showCard:L.showCard,compact:L.compact,classNames:v.card},L.offer.id)};return g?t.jsx(Te.motion.div,{"data-testid":"offer-card-list",className:S,variants:Ai,initial:"hidden",animate:"show",children:t.jsx(Te.AnimatePresence,{children:k.map(F=>{const L=C(F);return t.jsx(Te.motion.div,{"data-testid":`offer-card-list-item-${L.offer.id}`,className:v.cardWrapper,variants:Ei,exit:{opacity:0,y:-20},transition:{duration:.3},children:t.jsx(hn,{offer:L.offer,quantity:L.quantity,onQuantityChange:A,currency:o,locale:l,labels:d,slots:u,isDisabled:f,buttonVariant:m,buttonColor:p,showCard:x,compact:b||L.offer.compact,classNames:v.card})},L.offer.id)})})}):t.jsx("div",{"data-testid":"offer-card-list",className:S,children:k.map(_)})};Di.displayName="OfferCardList";var Qt=e=>e.type==="checkbox",bt=e=>e instanceof Date,Oe=e=>e==null;const Li=e=>typeof e=="object";var Se=e=>!Oe(e)&&!Array.isArray(e)&&Li(e)&&!bt(e),Fi=e=>Se(e)&&e.target?Qt(e.target)?e.target.checked:e.target.value:e,em=e=>e.substring(0,e.search(/\.\d+(\.|$)/))||e,Ri=(e,n)=>e.has(em(n)),tm=e=>{const n=e.constructor&&e.constructor.prototype;return Se(n)&&n.hasOwnProperty("isPrototypeOf")},Ps=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function we(e){if(e instanceof Date)return new Date(e);const n=typeof FileList<"u"&&e instanceof FileList;if(Ps&&(e instanceof Blob||n))return e;const s=Array.isArray(e);if(!s&&!(Se(e)&&tm(e)))return e;const a=s?[]:Object.create(Object.getPrototypeOf(e));for(const r in e)Object.prototype.hasOwnProperty.call(e,r)&&(a[r]=we(e[r]));return a}var Dn=e=>/^\w*$/.test(e),be=e=>e===void 0,Ts=e=>Array.isArray(e)?e.filter(Boolean):[],Is=e=>Ts(e.replace(/["|']|\]/g,"").split(/\.|\[/)),H=(e,n,s)=>{if(!n||!Se(e))return s;const a=(Dn(n)?[n]:Is(n)).reduce((r,i)=>Oe(r)?r:r[i],e);return be(a)||a===e?be(e[n])?s:e[n]:a},Ve=e=>typeof e=="boolean",Pe=e=>typeof e=="function",xe=(e,n,s)=>{let a=-1;const r=Dn(n)?[n]:Is(n),i=r.length,o=i-1;for(;++a<i;){const l=r[a];let d=s;if(a!==o){const u=e[l];d=Se(u)||Array.isArray(u)?u:isNaN(+r[a+1])?{}:[]}if(l==="__proto__"||l==="constructor"||l==="prototype")return;e[l]=d,e=e[l]}};const bn={BLUR:"blur",FOCUS_OUT:"focusout",CHANGE:"change"},Qe={onBlur:"onBlur",onChange:"onChange",onSubmit:"onSubmit",onTouched:"onTouched",all:"all"},st={max:"max",min:"min",maxLength:"maxLength",minLength:"minLength",pattern:"pattern",required:"required",validate:"validate"},_i=h.createContext(null);_i.displayName="HookFormControlContext";const Os=()=>h.useContext(_i);var Mi=(e,n,s,a=!0)=>{const r={defaultValues:n._defaultValues};for(const i in e)Object.defineProperty(r,i,{get:()=>{const o=i;return n._proxyFormState[o]!==Qe.all&&(n._proxyFormState[o]=!a||Qe.all),s&&(s[o]=!0),e[o]}});return r};const zs=typeof window<"u"?h.useLayoutEffect:h.useEffect;function nm(e){const n=Os(),{control:s=n,disabled:a,name:r,exact:i}=e||{},[o,l]=h.useState(s._formState),d=h.useRef({isDirty:!1,isLoading:!1,dirtyFields:!1,touchedFields:!1,validatingFields:!1,isValidating:!1,isValid:!1,errors:!1});return zs(()=>s._subscribe({name:r,formState:d.current,exact:i,callback:u=>{!a&&l({...s._formState,...u})}}),[r,a,i]),h.useEffect(()=>{d.current.isValid&&s._setValid(!0)},[s]),h.useMemo(()=>Mi(o,s,d.current,!1),[o,s])}var Ue=e=>typeof e=="string",ps=(e,n,s,a,r)=>Ue(e)?(a&&n.watch.add(e),H(s,e,r)):Array.isArray(e)?e.map(i=>(a&&n.watch.add(i),H(s,i))):(a&&(n.watchAll=!0),s),hs=e=>Oe(e)||!Li(e);function Ze(e,n,s=new WeakSet){if(hs(e)||hs(n))return Object.is(e,n);if(bt(e)&&bt(n))return Object.is(e.getTime(),n.getTime());const a=Object.keys(e),r=Object.keys(n);if(a.length!==r.length)return!1;if(s.has(e)||s.has(n))return!0;s.add(e),s.add(n);for(const i of a){const o=e[i];if(!r.includes(i))return!1;if(i!=="ref"){const l=n[i];if(bt(o)&&bt(l)||Se(o)&&Se(l)||Array.isArray(o)&&Array.isArray(l)?!Ze(o,l,s):!Object.is(o,l))return!1}}return!0}function sm(e){const n=Os(),{control:s=n,name:a,defaultValue:r,disabled:i,exact:o,compute:l}=e||{},d=h.useRef(r),u=h.useRef(l),f=h.useRef(void 0),m=h.useRef(s),p=h.useRef(a);u.current=l;const[x,g]=h.useState(()=>{const N=s._getWatch(a,d.current);return u.current?u.current(N):N}),y=h.useCallback(N=>{const A=ps(a,s._names,N||s._formValues,!1,d.current);return u.current?u.current(A):A},[s._formValues,s._names,a]),b=h.useCallback(N=>{if(!i){const A=ps(a,s._names,N||s._formValues,!1,d.current);if(u.current){const k=u.current(A);Ze(k,f.current)||(g(k),f.current=k)}else g(A)}},[s._formValues,s._names,i,a]);zs(()=>((m.current!==s||!Ze(p.current,a))&&(m.current=s,p.current=a,b()),s._subscribe({name:a,formState:{values:!0},exact:o,callback:N=>{b(N.values)}})),[s,o,a,b]),h.useEffect(()=>s._removeUnmounted());const v=m.current!==s,w=p.current,$=h.useMemo(()=>{if(i)return null;const N=!v&&!Ze(w,a);return v||N?y():null},[i,v,a,w,y]);return $!==null?$:x}function am(e){const n=Os(),{name:s,disabled:a,control:r=n,shouldUnregister:i,defaultValue:o,exact:l=!0}=e,d=Ri(r._names.array,s),u=h.useMemo(()=>H(r._formValues,s,H(r._defaultValues,s,o)),[r,s,o]),f=sm({control:r,name:s,defaultValue:u,exact:l}),m=nm({control:r,name:s,exact:l}),p=h.useRef(e),x=h.useRef(void 0),g=h.useRef(r.register(s,{...e.rules,value:f,...Ve(e.disabled)?{disabled:e.disabled}:{}}));p.current=e;const y=h.useMemo(()=>Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!H(m.errors,s)},isDirty:{enumerable:!0,get:()=>!!H(m.dirtyFields,s)},isTouched:{enumerable:!0,get:()=>!!H(m.touchedFields,s)},isValidating:{enumerable:!0,get:()=>!!H(m.validatingFields,s)},error:{enumerable:!0,get:()=>H(m.errors,s)}}),[m,s]),b=h.useCallback(N=>g.current.onChange({target:{value:Fi(N),name:s},type:bn.CHANGE}),[s]),v=h.useCallback(()=>g.current.onBlur({target:{value:H(r._formValues,s),name:s},type:bn.BLUR}),[s,r._formValues]),w=h.useCallback(N=>{const A=H(r._fields,s);A&&A._f&&N&&(A._f.ref={focus:()=>Pe(N.focus)&&N.focus(),select:()=>Pe(N.select)&&N.select(),setCustomValidity:k=>Pe(N.setCustomValidity)&&N.setCustomValidity(k),reportValidity:()=>Pe(N.reportValidity)&&N.reportValidity()})},[r._fields,s]),$=h.useMemo(()=>({name:s,value:f,...Ve(a)||m.disabled?{disabled:m.disabled||a}:{},onChange:b,onBlur:v,ref:w}),[s,a,m.disabled,b,v,w,f]);return h.useEffect(()=>{const N=r._options.shouldUnregister||i,A=x.current;A&&A!==s&&!d&&r.unregister(A),r.register(s,{...p.current.rules,...Ve(p.current.disabled)?{disabled:p.current.disabled}:{}});const k=(C,E)=>{const S=H(r._fields,C);S&&S._f&&(S._f.mount=E)};if(k(s,!0),N){const C=we(H(r._options.defaultValues,s,p.current.defaultValue));xe(r._defaultValues,s,C),be(H(r._formValues,s))&&xe(r._formValues,s,C)}return!d&&r.register(s),x.current=s,()=>{(d?N&&!r._state.action:N)?r.unregister(s):k(s,!1)}},[s,r,d,i]),h.useEffect(()=>{r._setDisabledField({disabled:a,name:s})},[a,s,r]),h.useMemo(()=>({field:$,formState:m,fieldState:y}),[$,m,y])}const rm=h.createContext(null);rm.displayName="HookFormContext";var im=(e,n,s,a,r)=>n?{...s[e],types:{...s[e]&&s[e].types?s[e].types:{},[a]:r||!0}}:{},Ut=e=>Array.isArray(e)?e:[e],Oa=()=>{let e=[];return{get observers(){return e},next:r=>{for(const i of e)i.next&&i.next(r)},subscribe:r=>(e.push(r),{unsubscribe:()=>{e=e.filter(i=>i!==r)}}),unsubscribe:()=>{e=[]}}};function Pi(e,n){const s={};for(const a in e)if(e.hasOwnProperty(a)){const r=e[a],i=n[a];if(r&&Se(r)&&i){const o=Pi(r,i);Se(o)&&(s[a]=o)}else e[a]&&(s[a]=i)}return s}var Me=e=>Se(e)&&!Object.keys(e).length,Bs=e=>e.type==="file",gn=e=>{if(!Ps)return!1;const n=e?e.ownerDocument:0;return e instanceof(n&&n.defaultView?n.defaultView.HTMLElement:HTMLElement)},Ti=e=>e.type==="select-multiple",Vs=e=>e.type==="radio",lm=e=>Vs(e)||Qt(e),Gn=e=>gn(e)&&e.isConnected;function om(e,n){const s=n.slice(0,-1).length;let a=0;for(;a<s;)e=be(e)?a++:e[n[a++]];return e}function cm(e){for(const n in e)if(e.hasOwnProperty(n)&&!be(e[n]))return!1;return!0}function Ne(e,n){const s=Array.isArray(n)?n:Dn(n)?[n]:Is(n),a=s.length===1?e:om(e,s),r=s.length-1,i=s[r];return a&&delete a[i],r!==0&&(Se(a)&&Me(a)||Array.isArray(a)&&cm(a))&&Ne(e,s.slice(0,-1)),e}var dm=e=>{for(const n in e)if(Pe(e[n]))return!0;return!1};function Ii(e){return Array.isArray(e)||Se(e)&&!dm(e)}function bs(e,n={}){for(const s in e){const a=e[s];Ii(a)?(n[s]=Array.isArray(a)?[]:{},bs(a,n[s])):be(a)||(n[s]=!0)}return n}function St(e,n,s){s||(s=bs(n));for(const a in e){const r=e[a];if(Ii(r))be(n)||hs(s[a])?s[a]=bs(r,Array.isArray(r)?[]:{}):St(r,Oe(n)?{}:n[a],s[a]);else{const i=n[a];s[a]=!Ze(r,i)}}return s}const za={value:!1,isValid:!1},Ba={value:!0,isValid:!0};var Oi=e=>{if(Array.isArray(e)){if(e.length>1){const n=e.filter(s=>s&&s.checked&&!s.disabled).map(s=>s.value);return{value:n,isValid:!!n.length}}return e[0].checked&&!e[0].disabled?e[0].attributes&&!be(e[0].attributes.value)?be(e[0].value)||e[0].value===""?Ba:{value:e[0].value,isValid:!0}:Ba:za}return za},zi=(e,{valueAsNumber:n,valueAsDate:s,setValueAs:a})=>be(e)?e:n?e===""?NaN:e&&+e:s&&Ue(e)?new Date(e):a?a(e):e;const Va={isValid:!1,value:null};var Bi=e=>Array.isArray(e)?e.reduce((n,s)=>s&&s.checked&&!s.disabled?{isValid:!0,value:s.value}:n,Va):Va;function Ua(e){const n=e.ref;return Bs(n)?n.files:Vs(n)?Bi(e.refs).value:Ti(n)?[...n.selectedOptions].map(({value:s})=>s):Qt(n)?Oi(e.refs).value:zi(be(n.value)?e.ref.value:n.value,e)}var um=(e,n,s,a)=>{const r={};for(const i of e){const o=H(n,i);o&&xe(r,i,o._f)}return{criteriaMode:s,names:[...e],fields:r,shouldUseNativeValidation:a}},yn=e=>e instanceof RegExp,Mt=e=>be(e)?e:yn(e)?e.source:Se(e)?yn(e.value)?e.value.source:e.value:e,Ha=e=>({isOnSubmit:!e||e===Qe.onSubmit,isOnBlur:e===Qe.onBlur,isOnChange:e===Qe.onChange,isOnAll:e===Qe.all,isOnTouch:e===Qe.onTouched});const Wa="AsyncFunction";var mm=e=>!!e&&!!e.validate&&!!(Pe(e.validate)&&e.validate.constructor.name===Wa||Se(e.validate)&&Object.values(e.validate).find(n=>n.constructor.name===Wa)),fm=e=>e.mount&&(e.required||e.min||e.max||e.maxLength||e.minLength||e.pattern||e.validate),qa=(e,n,s)=>!s&&(n.watchAll||n.watch.has(e)||[...n.watch].some(a=>e.startsWith(a)&&/^\.\w+/.test(e.slice(a.length))));const Ht=(e,n,s,a)=>{for(const r of s||Object.keys(e)){const i=H(e,r);if(i){const{_f:o,...l}=i;if(o){if(o.refs&&o.refs[0]&&n(o.refs[0],r)&&!a)return!0;if(o.ref&&n(o.ref,o.name)&&!a)return!0;if(Ht(l,n))break}else if(Se(l)&&Ht(l,n))break}}};function Ga(e,n,s){const a=H(e,s);if(a||Dn(s))return{error:a,name:s};const r=s.split(".");for(;r.length;){const i=r.join("."),o=H(n,i),l=H(e,i);if(o&&!Array.isArray(o)&&s!==i)return{name:s};if(l&&l.type)return{name:i,error:l};if(l&&l.root&&l.root.type)return{name:`${i}.root`,error:l.root};r.pop()}return{name:s}}var xm=(e,n,s,a)=>{s(e);const{name:r,...i}=e;return Me(i)||Object.keys(i).length>=Object.keys(n).length||Object.keys(i).find(o=>n[o]===(!a||Qe.all))},pm=(e,n,s)=>!e||!n||e===n||Ut(e).some(a=>a&&(s?a===n:a.startsWith(n)||n.startsWith(a))),hm=(e,n,s,a,r)=>r.isOnAll?!1:!s&&r.isOnTouch?!(n||e):(s?a.isOnBlur:r.isOnBlur)?!e:(s?a.isOnChange:r.isOnChange)?e:!0,bm=(e,n)=>!Ts(H(e,n)).length&&Ne(e,n),gm=(e,n,s)=>{const a=Ut(H(e,s));return xe(a,"root",n[s]),xe(e,s,a),e};function Ka(e,n,s="validate"){if(Ue(e)||Array.isArray(e)&&e.every(Ue)||Ve(e)&&!e)return{type:s,message:Ue(e)?e:"",ref:n}}var wt=e=>Se(e)&&!yn(e)?e:{value:e,message:""},Ya=async(e,n,s,a,r,i)=>{const{ref:o,refs:l,required:d,maxLength:u,minLength:f,min:m,max:p,pattern:x,validate:g,name:y,valueAsNumber:b,mount:v}=e._f,w=H(s,y);if(!v||n.has(y))return{};const $=l?l[0]:o,N=L=>{r&&$.reportValidity&&($.setCustomValidity(Ve(L)?"":L||""),$.reportValidity())},A={},k=Vs(o),C=Qt(o),E=k||C,S=(b||Bs(o))&&be(o.value)&&be(w)||gn(o)&&o.value===""||w===""||Array.isArray(w)&&!w.length,_=im.bind(null,y,a,A),F=(L,M,I,W=st.maxLength,K=st.minLength)=>{const z=L?M:I;A[y]={type:L?W:K,message:z,ref:o,..._(L?W:K,z)}};if(i?!Array.isArray(w)||!w.length:d&&(!E&&(S||Oe(w))||Ve(w)&&!w||C&&!Oi(l).isValid||k&&!Bi(l).isValid)){const{value:L,message:M}=Ue(d)?{value:!!d,message:d}:wt(d);if(L&&(A[y]={type:st.required,message:M,ref:$,..._(st.required,M)},!a))return N(M),A}if(!S&&(!Oe(m)||!Oe(p))){let L,M;const I=wt(p),W=wt(m);if(!Oe(w)&&!isNaN(w)){const K=o.valueAsNumber||w&&+w;Oe(I.value)||(L=K>I.value),Oe(W.value)||(M=K<W.value)}else{const K=o.valueAsDate||new Date(w),z=se=>new Date(new Date().toDateString()+" "+se),ne=o.type=="time",G=o.type=="week";Ue(I.value)&&w&&(L=ne?z(w)>z(I.value):G?w>I.value:K>new Date(I.value)),Ue(W.value)&&w&&(M=ne?z(w)<z(W.value):G?w<W.value:K<new Date(W.value))}if((L||M)&&(F(!!L,I.message,W.message,st.max,st.min),!a))return N(A[y].message),A}if((u||f)&&!S&&(Ue(w)||i&&Array.isArray(w))){const L=wt(u),M=wt(f),I=!Oe(L.value)&&w.length>+L.value,W=!Oe(M.value)&&w.length<+M.value;if((I||W)&&(F(I,L.message,M.message),!a))return N(A[y].message),A}if(x&&!S&&Ue(w)){const{value:L,message:M}=wt(x);if(yn(L)&&!w.match(L)&&(A[y]={type:st.pattern,message:M,ref:o,..._(st.pattern,M)},!a))return N(M),A}if(g){if(Pe(g)){const L=await g(w,s),M=Ka(L,$);if(M&&(A[y]={...M,..._(st.validate,M.message)},!a))return N(M.message),A}else if(Se(g)){let L={};for(const M in g){if(!Me(L)&&!a)break;const I=Ka(await g[M](w,s),$,M);I&&(L={...I,..._(M,I.message)},N(I.message),a&&(A[y]=L))}if(!Me(L)&&(A[y]={ref:$,...L},!a))return A}}return N(!0),A};const ym={mode:Qe.onSubmit,reValidateMode:Qe.onChange,shouldFocusError:!0};function vm(e={}){let n={...ym,...e},s={submitCount:0,isDirty:!1,isReady:!1,isLoading:Pe(n.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{},errors:n.errors||{},disabled:n.disabled||!1},a={},r=Se(n.defaultValues)||Se(n.values)?we(n.defaultValues||n.values)||{}:{},i=n.shouldUnregister?{}:we(r),o={action:!1,mount:!1,watch:!1,keepIsValid:!1},l={mount:new Set,disabled:new Set,unMount:new Set,array:new Set,watch:new Set},d,u=0;const f={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1},m={...f};let p={...m};const x={array:Oa(),state:Oa()},g=n.criteriaMode===Qe.all,y=j=>D=>{clearTimeout(u),u=setTimeout(j,D)},b=async j=>{if(!o.keepIsValid&&!n.disabled&&(m.isValid||p.isValid||j)){let D;n.resolver?(D=Me((await E()).errors),v()):D=await _(a,!0),D!==s.isValid&&x.state.next({isValid:D})}},v=(j,D)=>{!n.disabled&&(m.isValidating||m.validatingFields||p.isValidating||p.validatingFields)&&((j||Array.from(l.mount)).forEach(R=>{R&&(D?xe(s.validatingFields,R,D):Ne(s.validatingFields,R))}),x.state.next({validatingFields:s.validatingFields,isValidating:!Me(s.validatingFields)}))},w=(j,D=[],R,U,B=!0,T=!0)=>{if(U&&R&&!n.disabled){if(o.action=!0,T&&Array.isArray(H(a,j))){const Q=R(H(a,j),U.argA,U.argB);B&&xe(a,j,Q)}if(T&&Array.isArray(H(s.errors,j))){const Q=R(H(s.errors,j),U.argA,U.argB);B&&xe(s.errors,j,Q),bm(s.errors,j)}if((m.touchedFields||p.touchedFields)&&T&&Array.isArray(H(s.touchedFields,j))){const Q=R(H(s.touchedFields,j),U.argA,U.argB);B&&xe(s.touchedFields,j,Q)}(m.dirtyFields||p.dirtyFields)&&(s.dirtyFields=St(r,i)),x.state.next({name:j,isDirty:L(j,D),dirtyFields:s.dirtyFields,errors:s.errors,isValid:s.isValid})}else xe(i,j,D)},$=(j,D)=>{xe(s.errors,j,D),x.state.next({errors:s.errors})},N=j=>{s.errors=j,x.state.next({errors:s.errors,isValid:!1})},A=(j,D,R,U)=>{const B=H(a,j);if(B){const T=H(i,j,be(R)?H(r,j):R);be(T)||U&&U.defaultChecked||D?xe(i,j,D?T:Ua(B._f)):W(j,T),o.mount&&!o.action&&b()}},k=(j,D,R,U,B)=>{let T=!1,Q=!1;const de={name:j};if(!n.disabled){if(!R||U){(m.isDirty||p.isDirty)&&(Q=s.isDirty,s.isDirty=de.isDirty=L(),T=Q!==de.isDirty);const ue=Ze(H(r,j),D);Q=!!H(s.dirtyFields,j),ue?Ne(s.dirtyFields,j):xe(s.dirtyFields,j,!0),de.dirtyFields=s.dirtyFields,T=T||(m.dirtyFields||p.dirtyFields)&&Q!==!ue}if(R){const ue=H(s.touchedFields,j);ue||(xe(s.touchedFields,j,R),de.touchedFields=s.touchedFields,T=T||(m.touchedFields||p.touchedFields)&&ue!==R)}T&&B&&x.state.next(de)}return T?de:{}},C=(j,D,R,U)=>{const B=H(s.errors,j),T=(m.isValid||p.isValid)&&Ve(D)&&s.isValid!==D;if(n.delayError&&R?(d=y(()=>$(j,R)),d(n.delayError)):(clearTimeout(u),d=null,R?xe(s.errors,j,R):Ne(s.errors,j)),(R?!Ze(B,R):B)||!Me(U)||T){const Q={...U,...T&&Ve(D)?{isValid:D}:{},errors:s.errors,name:j};s={...s,...Q},x.state.next(Q)}},E=async j=>(v(j,!0),await n.resolver(i,n.context,um(j||l.mount,a,n.criteriaMode,n.shouldUseNativeValidation))),S=async j=>{const{errors:D}=await E(j);if(v(j),j)for(const R of j){const U=H(D,R);U?xe(s.errors,R,U):Ne(s.errors,R)}else s.errors=D;return D},_=async(j,D,R={valid:!0})=>{for(const U in j){const B=j[U];if(B){const{_f:T,...Q}=B;if(T){const de=l.array.has(T.name),ue=B._f&&mm(B._f);ue&&m.validatingFields&&v([T.name],!0);const Re=await Ya(B,l.disabled,i,g,n.shouldUseNativeValidation&&!D,de);if(ue&&m.validatingFields&&v([T.name]),Re[T.name]&&(R.valid=!1,D||e.shouldUseNativeValidation))break;!D&&(H(Re,T.name)?de?gm(s.errors,Re,T.name):xe(s.errors,T.name,Re[T.name]):Ne(s.errors,T.name))}!Me(Q)&&await _(Q,D,R)}}return R.valid},F=()=>{for(const j of l.unMount){const D=H(a,j);D&&(D._f.refs?D._f.refs.every(R=>!Gn(R)):!Gn(D._f.ref))&&te(j)}l.unMount=new Set},L=(j,D)=>!n.disabled&&(j&&D&&xe(i,j,D),!Ze(Y(),r)),M=(j,D,R)=>ps(j,l,{...o.mount?i:be(D)?r:Ue(j)?{[j]:D}:D},R,D),I=j=>Ts(H(o.mount?i:r,j,n.shouldUnregister?H(r,j,[]):[])),W=(j,D,R={})=>{const U=H(a,j);let B=D;if(U){const T=U._f;T&&(!T.disabled&&xe(i,j,zi(D,T)),B=gn(T.ref)&&Oe(D)?"":D,Ti(T.ref)?[...T.ref.options].forEach(Q=>Q.selected=B.includes(Q.value)):T.refs?Qt(T.ref)?T.refs.forEach(Q=>{(!Q.defaultChecked||!Q.disabled)&&(Array.isArray(B)?Q.checked=!!B.find(de=>de===Q.value):Q.checked=B===Q.value||!!B)}):T.refs.forEach(Q=>Q.checked=Q.value===B):Bs(T.ref)?T.ref.value="":(T.ref.value=B,T.ref.type||x.state.next({name:j,values:we(i)})))}(R.shouldDirty||R.shouldTouch)&&k(j,B,R.shouldTouch,R.shouldDirty,!0),R.shouldValidate&&se(j)},K=(j,D,R)=>{for(const U in D){if(!D.hasOwnProperty(U))return;const B=D[U],T=j+"."+U,Q=H(a,T);(l.array.has(j)||Se(B)||Q&&!Q._f)&&!bt(B)?K(T,B,R):W(T,B,R)}},z=(j,D,R={})=>{const U=H(a,j),B=l.array.has(j),T=we(D);xe(i,j,T),B?(x.array.next({name:j,values:we(i)}),(m.isDirty||m.dirtyFields||p.isDirty||p.dirtyFields)&&R.shouldDirty&&x.state.next({name:j,dirtyFields:St(r,i),isDirty:L(j,T)})):U&&!U._f&&!Oe(T)?K(j,T,R):W(j,T,R),qa(j,l)?x.state.next({...s,name:j,values:we(i)}):x.state.next({name:o.mount?j:void 0,values:we(i)})},ne=async j=>{o.mount=!0;const D=j.target;let R=D.name,U=!0;const B=H(a,R),T=ue=>{U=Number.isNaN(ue)||bt(ue)&&isNaN(ue.getTime())||Ze(ue,H(i,R,ue))},Q=Ha(n.mode),de=Ha(n.reValidateMode);if(B){let ue,Re;const ft=D.type?Ua(B._f):Fi(j),ct=j.type===bn.BLUR||j.type===bn.FOCUS_OUT,Qo=!fm(B._f)&&!n.resolver&&!H(s.errors,R)&&!B._f.deps||hm(ct,H(s.touchedFields,R),s.isSubmitted,de,Q),Pn=qa(R,l,ct);xe(i,R,ft),ct?(!D||!D.readOnly)&&(B._f.onBlur&&B._f.onBlur(j),d&&d(0)):B._f.onChange&&B._f.onChange(j);const Tn=k(R,ft,ct),Zo=!Me(Tn)||Pn;if(!ct&&x.state.next({name:R,type:j.type,values:we(i)}),Qo)return(m.isValid||p.isValid)&&(n.mode==="onBlur"?ct&&b():ct||b()),Zo&&x.state.next({name:R,...Pn?{}:Tn});if(!ct&&Pn&&x.state.next({...s}),n.resolver){const{errors:ua}=await E([R]);if(v([R]),T(ft),U){const Xo=Ga(s.errors,a,R),ma=Ga(ua,a,Xo.name||R);ue=ma.error,R=ma.name,Re=Me(ua)}}else v([R],!0),ue=(await Ya(B,l.disabled,i,g,n.shouldUseNativeValidation))[R],v([R]),T(ft),U&&(ue?Re=!1:(m.isValid||p.isValid)&&(Re=await _(a,!0)));U&&(B._f.deps&&(!Array.isArray(B._f.deps)||B._f.deps.length>0)&&se(B._f.deps),C(R,Re,ue,Tn))}},G=(j,D)=>{if(H(s.errors,D)&&j.focus)return j.focus(),1},se=async(j,D={})=>{let R,U;const B=Ut(j);if(n.resolver){const T=await S(be(j)?j:B);R=Me(T),U=j?!B.some(Q=>H(T,Q)):R}else j?(U=(await Promise.all(B.map(async T=>{const Q=H(a,T);return await _(Q&&Q._f?{[T]:Q}:Q)}))).every(Boolean),!(!U&&!s.isValid)&&b()):U=R=await _(a);return x.state.next({...!Ue(j)||(m.isValid||p.isValid)&&R!==s.isValid?{}:{name:j},...n.resolver||!j?{isValid:R}:{},errors:s.errors}),D.shouldFocus&&!U&&Ht(a,G,j?B:l.mount),U},Y=(j,D)=>{let R={...o.mount?i:r};return D&&(R=Pi(D.dirtyFields?s.dirtyFields:s.touchedFields,R)),be(j)?R:Ue(j)?H(R,j):j.map(U=>H(R,U))},oe=(j,D)=>({invalid:!!H((D||s).errors,j),isDirty:!!H((D||s).dirtyFields,j),error:H((D||s).errors,j),isValidating:!!H(s.validatingFields,j),isTouched:!!H((D||s).touchedFields,j)}),J=j=>{j&&Ut(j).forEach(D=>Ne(s.errors,D)),x.state.next({errors:j?s.errors:{}})},q=(j,D,R)=>{const U=(H(a,j,{_f:{}})._f||{}).ref,B=H(s.errors,j)||{},{ref:T,message:Q,type:de,...ue}=B;xe(s.errors,j,{...ue,...D,ref:U}),x.state.next({name:j,errors:s.errors,isValid:!1}),R&&R.shouldFocus&&U&&U.focus&&U.focus()},ie=(j,D)=>Pe(j)?x.state.subscribe({next:R=>"values"in R&&j(M(void 0,D),R)}):M(j,D,!0),V=j=>x.state.subscribe({next:D=>{pm(j.name,D.name,j.exact)&&xm(D,j.formState||m,me,j.reRenderRoot)&&j.callback({values:{...i},...s,...D,defaultValues:r})}}).unsubscribe,ee=j=>(o.mount=!0,p={...p,...j.formState},V({...j,formState:{...f,...j.formState}})),te=(j,D={})=>{for(const R of j?Ut(j):l.mount)l.mount.delete(R),l.array.delete(R),D.keepValue||(Ne(a,R),Ne(i,R)),!D.keepError&&Ne(s.errors,R),!D.keepDirty&&Ne(s.dirtyFields,R),!D.keepTouched&&Ne(s.touchedFields,R),!D.keepIsValidating&&Ne(s.validatingFields,R),!n.shouldUnregister&&!D.keepDefaultValue&&Ne(r,R);x.state.next({values:we(i)}),x.state.next({...s,...D.keepDirty?{isDirty:L()}:{}}),!D.keepIsValid&&b()},Fe=({disabled:j,name:D})=>{if(Ve(j)&&o.mount||j||l.disabled.has(D)){const B=l.disabled.has(D)!==!!j;j?l.disabled.add(D):l.disabled.delete(D),B&&o.mount&&!o.action&&b()}},Z=(j,D={})=>{let R=H(a,j);const U=Ve(D.disabled)||Ve(n.disabled);return xe(a,j,{...R||{},_f:{...R&&R._f?R._f:{ref:{name:j}},name:j,mount:!0,...D}}),l.mount.add(j),R?Fe({disabled:Ve(D.disabled)?D.disabled:n.disabled,name:j}):A(j,!0,D.value),{...U?{disabled:D.disabled||n.disabled}:{},...n.progressive?{required:!!D.required,min:Mt(D.min),max:Mt(D.max),minLength:Mt(D.minLength),maxLength:Mt(D.maxLength),pattern:Mt(D.pattern)}:{},name:j,onChange:ne,onBlur:ne,ref:B=>{if(B){Z(j,D),R=H(a,j);const T=be(B.value)&&B.querySelectorAll&&B.querySelectorAll("input,select,textarea")[0]||B,Q=lm(T),de=R._f.refs||[];if(Q?de.find(ue=>ue===T):T===R._f.ref)return;xe(a,j,{_f:{...R._f,...Q?{refs:[...de.filter(Gn),T,...Array.isArray(H(r,j))?[{}]:[]],ref:{type:T.type,name:j}}:{ref:T}}}),A(j,!1,void 0,T)}else R=H(a,j,{}),R._f&&(R._f.mount=!1),(n.shouldUnregister||D.shouldUnregister)&&!(Ri(l.array,j)&&o.action)&&l.unMount.add(j)}}},he=()=>n.shouldFocusError&&Ht(a,G,l.mount),Je=j=>{Ve(j)&&(x.state.next({disabled:j}),Ht(a,(D,R)=>{const U=H(a,R);U&&(D.disabled=U._f.disabled||j,Array.isArray(U._f.refs)&&U._f.refs.forEach(B=>{B.disabled=U._f.disabled||j}))},0,!1))},We=(j,D)=>async R=>{let U;R&&(R.preventDefault&&R.preventDefault(),R.persist&&R.persist());let B=we(i);if(x.state.next({isSubmitting:!0}),n.resolver){const{errors:T,values:Q}=await E();v(),s.errors=T,B=we(Q)}else await _(a);if(l.disabled.size)for(const T of l.disabled)Ne(B,T);if(Ne(s.errors,"root"),Me(s.errors)){x.state.next({errors:{}});try{await j(B,R)}catch(T){U=T}}else D&&await D({...s.errors},R),he(),setTimeout(he);if(x.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:Me(s.errors)&&!U,submitCount:s.submitCount+1,errors:s.errors}),U)throw U},ve=(j,D={})=>{H(a,j)&&(be(D.defaultValue)?z(j,we(H(r,j))):(z(j,D.defaultValue),xe(r,j,we(D.defaultValue))),D.keepTouched||Ne(s.touchedFields,j),D.keepDirty||(Ne(s.dirtyFields,j),s.isDirty=D.defaultValue?L(j,we(H(r,j))):L()),D.keepError||(Ne(s.errors,j),m.isValid&&b()),x.state.next({...s}))},qe=(j,D={})=>{const R=j?we(j):r,U=we(R),B=Me(j),T=B?r:U;if(D.keepDefaultValues||(r=R),!D.keepValues){if(D.keepDirtyValues){const Q=new Set([...l.mount,...Object.keys(St(r,i))]);for(const de of Array.from(Q)){const ue=H(s.dirtyFields,de),Re=H(i,de),ft=H(T,de);ue&&!be(Re)?xe(T,de,Re):!ue&&!be(ft)&&z(de,ft)}}else{if(Ps&&be(j))for(const Q of l.mount){const de=H(a,Q);if(de&&de._f){const ue=Array.isArray(de._f.refs)?de._f.refs[0]:de._f.ref;if(gn(ue)){const Re=ue.closest("form");if(Re){Re.reset();break}}}}if(D.keepFieldsRef)for(const Q of l.mount)z(Q,H(T,Q));else a={}}i=n.shouldUnregister?D.keepDefaultValues?we(r):{}:we(T),x.array.next({values:{...T}}),x.state.next({values:{...T}})}l={mount:D.keepDirtyValues?l.mount:new Set,unMount:new Set,array:new Set,disabled:new Set,watch:new Set,watchAll:!1,focus:""},o.mount=!m.isValid||!!D.keepIsValid||!!D.keepDirtyValues||!n.shouldUnregister&&!Me(T),o.watch=!!n.shouldUnregister,o.keepIsValid=!!D.keepIsValid,o.action=!1,D.keepErrors||(s.errors={}),x.state.next({submitCount:D.keepSubmitCount?s.submitCount:0,isDirty:B?!1:D.keepDirty?s.isDirty:!!(D.keepDefaultValues&&!Ze(j,r)),isSubmitted:D.keepIsSubmitted?s.isSubmitted:!1,dirtyFields:B?{}:D.keepDirtyValues?D.keepDefaultValues&&i?St(r,i):s.dirtyFields:D.keepDefaultValues&&j?St(r,j):D.keepDirty?s.dirtyFields:{},touchedFields:D.keepTouched?s.touchedFields:{},errors:D.keepErrors?s.errors:{},isSubmitSuccessful:D.keepIsSubmitSuccessful?s.isSubmitSuccessful:!1,isSubmitting:!1,defaultValues:r})},ot=(j,D)=>qe(Pe(j)?j(i):j,{...n.resetOptions,...D}),Ge=(j,D={})=>{const R=H(a,j),U=R&&R._f;if(U){const B=U.refs?U.refs[0]:U.ref;B.focus&&setTimeout(()=>{B.focus(),D.shouldSelect&&Pe(B.select)&&B.select()})}},me=j=>{s={...s,...j}},et={control:{register:Z,unregister:te,getFieldState:oe,handleSubmit:We,setError:q,_subscribe:V,_runSchema:E,_updateIsValidating:v,_focusError:he,_getWatch:M,_getDirty:L,_setValid:b,_setFieldArray:w,_setDisabledField:Fe,_setErrors:N,_getFieldArray:I,_reset:qe,_resetDefaultValues:()=>Pe(n.defaultValues)&&n.defaultValues().then(j=>{ot(j,n.resetOptions),x.state.next({isLoading:!1})}),_removeUnmounted:F,_disableForm:Je,_subjects:x,_proxyFormState:m,get _fields(){return a},get _formValues(){return i},get _state(){return o},set _state(j){o=j},get _defaultValues(){return r},get _names(){return l},set _names(j){l=j},get _formState(){return s},get _options(){return n},set _options(j){n={...n,...j}}},subscribe:ee,trigger:se,register:Z,handleSubmit:We,watch:ie,setValue:z,getValues:Y,reset:ot,resetField:ve,clearErrors:J,unregister:te,setError:q,setFocus:Ge,getFieldState:oe};return{...et,formControl:et}}function jm(e={}){const n=h.useRef(void 0),s=h.useRef(void 0),[a,r]=h.useState({isDirty:!1,isValidating:!1,isLoading:Pe(e.defaultValues),isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,submitCount:0,dirtyFields:{},touchedFields:{},validatingFields:{},errors:e.errors||{},disabled:e.disabled||!1,isReady:!1,defaultValues:Pe(e.defaultValues)?void 0:e.defaultValues});if(!n.current)if(e.formControl)n.current={...e.formControl,formState:a},e.defaultValues&&!Pe(e.defaultValues)&&e.formControl.reset(e.defaultValues,e.resetOptions);else{const{formControl:o,...l}=vm(e);n.current={...l,formState:a}}const i=n.current.control;return i._options=e,zs(()=>{const o=i._subscribe({formState:i._proxyFormState,callback:()=>r({...i._formState}),reRenderRoot:!0});return r(l=>({...l,isReady:!0})),i._formState.isReady=!0,o},[i]),h.useEffect(()=>i._disableForm(e.disabled),[i,e.disabled]),h.useEffect(()=>{e.mode&&(i._options.mode=e.mode),e.reValidateMode&&(i._options.reValidateMode=e.reValidateMode)},[i,e.mode,e.reValidateMode]),h.useEffect(()=>{e.errors&&(i._setErrors(e.errors),i._focusError())},[i,e.errors]),h.useEffect(()=>{e.shouldUnregister&&i._subjects.state.next({values:i._getWatch()})},[i,e.shouldUnregister]),h.useEffect(()=>{if(i._proxyFormState.isDirty){const o=i._getDirty();o!==a.isDirty&&i._subjects.state.next({isDirty:o})}},[i,a.isDirty]),h.useEffect(()=>{var o;e.values&&!Ze(e.values,s.current)?(i._reset(e.values,{keepFieldsRef:!0,...i._options.resetOptions}),!((o=i._options.resetOptions)===null||o===void 0)&&o.keepIsValid||i._setValid(),s.current=e.values,r(l=>({...l}))):i._resetDefaultValues()},[i,e.values]),h.useEffect(()=>{i._state.mount||(i._setValid(),i._state.mount=!0),i._state.watch&&(i._state.watch=!1,i._subjects.state.next({...i._formState})),i._removeUnmounted()}),n.current.formState=h.useMemo(()=>Mi(a,i),[i,a]),n.current}function wm(e,n=3){return e%1===0?e.toString():e.toFixed(n).replace(/\.?0+$/,"")}function Nm(e,n="en-US",s="USD"){try{return new Intl.NumberFormat(n,{style:"currency",currency:s,minimumFractionDigits:2,maximumFractionDigits:2}).format(e)}catch(a){return console.warn(`Invalid currency formatting: ${a}`),`${s} ${e.toFixed(2)}`}}function Cm(e="USD",n="en-US"){try{return new Intl.NumberFormat(n,{style:"currency",currency:e}).formatToParts(0).find(i=>i.type==="currency")?.value??"$"}catch{return"$"}}function km(e){const n=e.replace(/[^\d.,-]/g,""),s=n.match(/,\d{1,2}$/);let a;s?a=n.replace(/\./g,"").replace(",","."):a=n.replace(/,/g,"");const r=parseFloat(a);return isNaN(r)?null:r}function Sm(e,n,s=.001){const a=e-n,r=Math.abs(a)<=s;return{difference:a,isBalanced:r,isUnderAllocated:!r&&a>0,isOverAllocated:!r&&a<0}}function Us(){return`dist-${Date.now()}-${Math.random().toString(36).substr(2,9)}`}Us();const $m={amount:"Amount",glAccount:"GL Account",taxDeductible:"Tax Deductible",amountPlaceholder:"0.00",glAccountPlaceholder:"Search GL Account",noGlAccountsFound:"No GL Accounts found. Try another search term",searching:"Searching for GL Accounts...",amountTooltip:"Enter the amount for this distribution",glAccountTooltip:"Select the General Ledger account for this distribution",taxDeductibleTooltip:"Check if this distribution is tax deductible",deleteButton:"Delete",currencySymbol:"$"},Kn=()=>({id:Us(),amount:0,glAccount:null,isTaxDeductible:!1}),Vi=({distribution:e,defaultDistribution:n,glAccounts:s=[],isLoadingGlAccounts:a=!1,onSearchGlAccounts:r,onDistributionChange:i,onAmountChange:o,onGlAccountChange:l,onTaxDeductibleChange:d,onDelete:u,canDelete:f=!0,canEditTaxDeductible:m=!0,isDisabled:p=!1,labels:x,classNames:g={},"data-testid":y,control:b,name:v,rules:w})=>{const $={...$m,...x},N=b!==void 0&&v!==void 0,A=jm({defaultValues:{_internal:n||Kn()}}),k=am({control:N?b:A.control,name:N?v:"_internal",rules:N?w:void 0}),[C,E]=h.useState(n||Kn()),S=N?k.field.value??Kn():e??C,_=N&&!!k.fieldState?.error,F=N&&(k.fieldState?.isTouched??!1),L=_||F,M=L&&(!S.amount||S.amount<=0),I=L&&!S.glAccount,[W,K]=h.useState(S.glAccount?.name||""),z=h.useCallback(q=>{const ie={...S,...q};N&&k.field.onChange(ie),!N&&e===void 0&&E(ie),i?.(ie)},[S,e,i,N,k]),ne=h.useCallback(q=>{const ie=q||0;z({amount:ie}),o?.(ie)},[z,o]),G=h.useCallback(q=>{K(q),r?.(q)},[r]),se=h.useCallback(q=>{if(q===null){z({glAccount:null}),l?.(null);return}const V=s.find(ee=>String(ee.id)===String(q))||null;z({glAccount:V}),l?.(V)},[s,z,l]),Y=h.useCallback(()=>{K(""),z({glAccount:null}),l?.(null)},[z,l]),oe=h.useCallback(q=>{z({isTaxDeductible:q}),d?.(q)},[z,d]),J=h.useCallback(()=>{u?.()},[u]);return t.jsx(c.Card,{radius:"md",shadow:"sm","data-testid":y||"revenue-distribution-card",className:c.cn(g.base),children:t.jsxs(c.CardBody,{className:c.cn("flex flex-row flex-nowrap items-start gap-4",g.body),children:[t.jsx("div",{className:c.cn("shrink-0",g.amountContainer),children:t.jsx(c.NumberInput,{"data-testid":`${y||"revenue-distribution-card"}-amount-input`,label:t.jsxs("span",{className:"flex items-center gap-1",children:[$.amount,t.jsx(c.Tooltip,{content:$.amountTooltip,children:t.jsx(P,{icon:"solar:info-circle-linear",className:"text-default-400 cursor-help",width:16})})]}),value:S.amount||void 0,onValueChange:ne,labelPlacement:"outside",placeholder:$.amountPlaceholder,isWheelDisabled:!0,hideStepper:!0,variant:"bordered",isDisabled:p,isInvalid:M,errorMessage:M?"Amount is required":void 0,minValue:0,step:.01,className:g.amountInput,startContent:t.jsx("div",{className:"pointer-events-none flex items-center",children:t.jsx("span",{className:"text-default-400 text-small",children:$.currencySymbol})})})}),t.jsx("div",{className:c.cn("grow",g.glAccountContainer),children:t.jsx(c.Autocomplete,{"data-testid":`${y||"revenue-distribution-card"}-gl-account-input`,label:t.jsxs("span",{className:"flex items-center gap-1",children:[$.glAccount,t.jsx(c.Tooltip,{content:$.glAccountTooltip,children:t.jsx(P,{icon:"solar:info-circle-linear",className:"text-default-400 cursor-help",width:16})})]}),isLoading:a,isClearable:!0,labelPlacement:"outside",variant:"bordered",items:s,menuTrigger:"input",inputValue:S.glAccount?.name??W,selectedKey:S.glAccount?.id??null,isDisabled:p,isInvalid:I,errorMessage:I?"GL Account is required":void 0,listboxProps:{emptyContent:a?$.searching:$.noGlAccountsFound},placeholder:$.glAccountPlaceholder,onInputChange:G,onSelectionChange:se,onClear:Y,className:g.glAccountInput,children:q=>t.jsx(c.AutocompleteItem,{textValue:q.name,children:t.jsxs("div",{className:"flex flex-col",children:[t.jsx("span",{children:q.name}),q.code&&t.jsx("span",{className:"text-xs text-default-400",children:q.code})]})},q.id)})}),t.jsx("div",{className:c.cn("shrink-0 pt-6 flex items-center",g.taxDeductibleContainer),children:t.jsx(c.Checkbox,{radius:"full","data-testid":`${y||"revenue-distribution-card"}-tax-deductible`,isSelected:S.isTaxDeductible,onValueChange:oe,isDisabled:p||!m,className:g.taxDeductibleCheckbox,children:$.taxDeductible})}),t.jsx("div",{className:c.cn("shrink-0 pt-6",g.deleteContainer),children:t.jsx(O,{"data-testid":`${y||"revenue-distribution-card"}-delete-button`,size:"sm",color:"danger",variant:"flat",isDisabled:p||!f,onPress:J,startContent:t.jsx(P,{icon:"solar:trash-bin-trash-linear",width:16}),className:c.cn("text-danger",g.deleteButton),children:$.deleteButton})})]})})};Vi.displayName="RevenueDistributionCard";const Ui=({message:e="No distributions configured",icon:n="solar:document-text-outline",iconSize:s=48,showCard:a=!0,classNames:r={},renderEmpty:i})=>{if(i)return t.jsx(t.Fragment,{children:i()});const o=t.jsxs("div",{className:c.cn("flex flex-col items-center justify-center py-8",r.content),children:[t.jsx(P,{icon:n,width:s,className:c.cn("text-default-300 mb-4",r.icon)}),t.jsx("p",{className:c.cn("text-default-500 text-sm text-center",r.message),children:e})]});return a?t.jsx(c.Card,{radius:"sm",shadow:"sm","data-testid":"revenue-distribution-empty",className:c.cn("w-full",r.base),children:t.jsx(c.CardBody,{children:o})}):t.jsx("div",{"data-testid":"revenue-distribution-empty",className:c.cn("w-full",r.base),children:o})};Ui.displayName="RevenueDistributionEmpty";const Am={title:"Error Loading Distributions",description:"An error occurred while loading the distribution configuration. Please try again."},Hi=({error:e,labels:n,showCard:s=!0,color:a="danger",classNames:r={}})=>{const i={...Am,...n},o=t.jsx(c.Alert,{"data-testid":"revenue-distribution-error-alert",color:a,title:i.title,description:e||i.description,className:r.alert});return s?t.jsx(c.Card,{radius:"sm",shadow:"sm","data-testid":"revenue-distribution-error",className:c.cn("w-full",r.base),children:t.jsx(c.CardBody,{children:o})}):t.jsx("div",{"data-testid":"revenue-distribution-error",className:c.cn("w-full",r.base),children:o})};Hi.displayName="RevenueDistributionError";const Wi=({rows:e=1,showCard:n=!0,classNames:s={}})=>{const a=Array.from({length:e},(i,o)=>o),r=i=>t.jsxs("div",{className:c.cn("flex flex-row flex-nowrap items-end gap-4",s.row),children:[t.jsxs("div",{className:"shrink-0 flex flex-col gap-1",children:[t.jsxs("div",{className:"flex items-center gap-1",children:[t.jsx(c.Skeleton,{className:"h-4 w-14 rounded-md"}),t.jsx(c.Skeleton,{className:"h-4 w-4 rounded-full"})]}),t.jsx(c.Skeleton,{className:"h-10 w-32 rounded-lg"})]}),t.jsxs("div",{className:"grow flex flex-col gap-1",children:[t.jsxs("div",{className:"flex items-center gap-1",children:[t.jsx(c.Skeleton,{className:"h-4 w-20 rounded-md"}),t.jsx(c.Skeleton,{className:"h-4 w-4 rounded-full"})]}),t.jsx(c.Skeleton,{className:"h-10 w-full rounded-lg"})]}),t.jsxs("div",{className:"shrink-0 pb-2 flex items-center gap-2",children:[t.jsx(c.Skeleton,{className:"h-5 w-5 rounded-full"}),t.jsx(c.Skeleton,{className:"h-4 w-24 rounded-md"})]}),t.jsx("div",{className:"shrink-0 pb-2",children:t.jsx(c.Skeleton,{className:"h-8 w-20 rounded-lg"})})]},i);return n?t.jsx("div",{className:c.cn("flex flex-col gap-3",s.base),children:a.map(i=>t.jsx(c.Card,{radius:"md",shadow:"sm","data-testid":`revenue-distribution-skeleton-${i}`,children:t.jsx(c.CardBody,{children:r(i)})},i))}):t.jsx("div",{"data-testid":"revenue-distribution-skeleton",className:c.cn("flex flex-col gap-3",s.base),children:a.map(i=>r(i))})};Wi.displayName="RevenueDistributionSkeleton";function Hs({isOpen:e,labels:n,icon:s,isConfirming:a=!1,confirmColor:r="danger",iconTone:i="danger",portalContainer:o,shouldBlockScroll:l,classNames:d,onClose:u,onConfirm:f}){return t.jsx(Yt,{isOpen:e,size:"md",placement:"center",portalContainer:o,shouldBlockScroll:l,classNames:{...d,base:c.cn("max-w-[440px] rounded-3xl",d?.base),closeButton:c.cn("right-5 top-5 text-zinc-500",d?.closeButton)},onOpenChange:m=>!m&&u(),children:t.jsxs(c.ModalContent,{children:[t.jsxs(c.ModalHeader,{className:"flex flex-col items-start gap-4 px-7 pb-0 pt-7",children:[s&&t.jsx("span",{className:c.cn("flex h-12 w-12 shrink-0 items-center justify-center rounded-full",i==="warning"?"bg-brand/15 text-brand":"bg-danger-100 text-danger-600"),children:s}),t.jsx("span",{className:"text-lg font-semibold leading-6 text-zinc-950",children:n.title})]}),t.jsx(c.ModalBody,{className:"px-7 pb-3 pt-4",children:t.jsx("div",{className:"text-sm leading-6 text-zinc-500",children:n.description})}),t.jsxs(c.ModalFooter,{className:"grid grid-cols-2 gap-3 px-7 pb-7 pt-3",children:[t.jsx(O,{type:"button",size:"md",variant:"bordered",radius:"full",className:"h-10 border-zinc-200 bg-white text-sm font-normal text-zinc-900",onPress:u,children:n.cancel}),t.jsx(O,{type:"button",size:"md",color:r,radius:"full",className:c.cn("h-10 text-sm font-normal text-white",r==="danger"?"bg-danger-600":"bg-brand"),isLoading:a,onPress:f,children:n.confirm})]})]})})}const Em=()=>({id:crypto.randomUUID(),fund:null,percentage:0});function Qa(e){return!e.fund&&Number(e.percentage||0)<=0}function Dm({mode:e,assignments:n}){const s=n.filter(i=>i.fund),a=s.reduce((i,o)=>i+Number(o.percentage||0),0),r=n.some(i=>!i.fund||Number(i.percentage||0)<=0);return s.length>=1&&!r&&Math.round(a*100)/100===100}const Lm={title:"Payment assignment",saved:"Saved",singleFund:"Single fund",splitFunds:"Split across multiple funds",saveAssignment:"Save assignment",assignSpecificFund:"Assign specific fund",addFund:"Add account",emptySingle:"You have not assign any specific fund for this opportunity",emptySplit:"Select a fund and assign percentages that total 100%",selectedFund:"Selected fund",percentage:"Percentage",total:"Total",totalError:"Select a fund for each row and enter percentages that total 100%.",removeFund:"Remove fund",modalTitle:"Select an specific fund",searchPlaceholder:"Search...",glCode:"GL Code",accountName:"Specific Fund Name",type:"Type",actions:"Actions",select:"Select",noFunds:"No specific funds available",modifyAssignedFundsTitle:"Modify Assigned Funds",modifyAssignedFundsDescription:"Changing the assigned funds will only affect up and coming payments.",modifyAssignedFundsWarning:"Payments already paid will still keep the previous configuration.",modifyAssignedFundsCancel:"Cancel",modifyAssignedFundsConfirm:"Continue"},qi={base:"min-h-11 rounded-full bg-zinc-100 px-4 py-2 shadow-none",iconWrapper:"!h-4 !w-4 shrink-0 !bg-transparent !shadow-none !border-0 text-zinc-900",alertIcon:"!static !h-4 !w-4 !translate-x-0 !translate-y-0 text-zinc-900",mainWrapper:"min-w-0",title:"text-sm font-normal text-zinc-900"},Pt={...qi,base:"min-h-11 rounded-2xl px-4 py-2 shadow-none",title:"text-sm font-medium"},Fm={inputWrapper:"h-9 rounded-xl border border-zinc-200 bg-white shadow-none hover:border-zinc-300 data-[hover=true]:border-zinc-300 group-data-[focus=true]:border-zinc-400 group-data-[focus-visible=true]:ring-0"},Rm={wrapper:"!absolute !inset-0 !z-50 !h-auto !w-auto !items-center !justify-center !p-4",backdrop:"!absolute !inset-0 !z-40 !h-auto !w-auto rounded-2xl"};function _m(){return t.jsxs("svg",{"aria-hidden":"true",className:"size-4 text-zinc-500",fill:"none",viewBox:"0 0 16 16",children:[t.jsx("rect",{x:"3",y:"3",width:"4",height:"4",rx:"1",stroke:"currentColor",strokeWidth:"1.4"}),t.jsx("rect",{x:"9",y:"3",width:"4",height:"4",rx:"1",stroke:"currentColor",strokeWidth:"1.4"}),t.jsx("rect",{x:"3",y:"9",width:"4",height:"4",rx:"1",stroke:"currentColor",strokeWidth:"1.4"}),t.jsx("rect",{x:"9",y:"9",width:"4",height:"4",rx:"1",stroke:"currentColor",strokeWidth:"1.4"})]})}const Mm=e=>Number.isFinite(e)?Math.max(0,Math.min(100,Math.round(e*100)/100)):0,Pm=e=>e.fund!==null;function Tm({assignments:e,funds:n,labels:s,classNames:a,isSaving:r=!1,hasSavedAssignments:i=!1,showSavedIndicator:o=!1,isCollapsed:l,isFundPickerOpen:d=!1,activeAssignmentId:u=null,modalPortalContainer:f,footer:m,onAssignmentsChange:p,onOpenFundPicker:x,onCloseFundPicker:g,onCollapseChange:y,onSave:b}){const[v,w]=h.useState(null),$=f??v??void 0,N={...Lm,...s},A=e.filter(V=>!Qa(V)),C=A.filter(Pm).length>0,E=h.useMemo(()=>e.filter(V=>!Qa(V)).reduce((V,ee)=>V+Number(ee.percentage||0),0),[e]),S=Math.round(E*100)/100,_=A.some(V=>!V.fund||Number(V.percentage||0)<=0),F=C&&(S!==100||_),L=`${N.totalError} (${N.total} ${Number(E.toFixed(2))}%)`,M=Dm({mode:"split",assignments:e}),I=C&&S>=100,[W,K]=h.useState(!1),[z,ne]=h.useState(!1),G=t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(_m,{}),t.jsx("span",{className:"text-base font-medium leading-6 text-zinc-950",children:N.title}),o?t.jsx(c.Chip,{size:"sm",radius:"full",color:"success",variant:"flat",children:N.saved}):null]}),se=(V,ee)=>{p(e.map(te=>te.id===V?{...te,...ee}:te))},Y=()=>{I||p([...e,Em()])},oe=V=>{e.length<=1||p(e.filter(ee=>ee.id!==V))},J=()=>{if(!r){if(!M){ne(!0);return}if(!i){b();return}K(!0)}},q=()=>{K(!1),b()},ie=V=>{const ee=u??e.find(te=>!te.fund)?.id??e[0]?.id;ee&&(p(e.map(te=>te.id===ee?{...te,fund:V}:te)),g())};return t.jsxs("div",{ref:w,className:c.cn("vvt-pa relative min-w-0 w-full font-sans text-zinc-900 [container-type:inline-size]",d&&!f&&"min-h-[560px]",a?.root),children:[t.jsx(c.Accordion,{variant:"splitted",defaultSelectedKeys:l===void 0?["installment-fund-assignment"]:void 0,selectedKeys:l===void 0?void 0:new Set(l?[]:["installment-fund-assignment"]),className:c.cn("w-full gap-0 px-0",a?.panel),itemClasses:{base:"w-full rounded-2xl border border-zinc-200 bg-white p-0 shadow-sm",trigger:c.cn("px-4 py-4",a?.header),title:"w-full",content:"w-full px-4 pb-4 pt-0",indicator:"text-zinc-500 [&>svg]:size-4"},onSelectionChange:V=>y?.(!(V==="all"||Array.from(V).length>0)),children:t.jsx(c.AccordionItem,{"aria-label":N.title,title:G,children:t.jsxs("div",{className:c.cn("flex w-full flex-col gap-4",a?.content),children:[t.jsxs("div",{className:"flex w-full flex-col gap-4",children:[!C&&t.jsx(c.Alert,{icon:t.jsx(P,{icon:"solar:info-circle-outline",className:"size-4"}),hideIconWrapper:!0,isClosable:!1,classNames:qi,color:"default",variant:"flat",title:N.emptySplit}),C&&t.jsx(Im,{assignments:e,labels:N,total:E,hasTotalError:z&&!M||F,validationMessage:L,onSelectFund:V=>x(V),onRemoveFund:oe,onPercentageChange:(V,ee)=>se(V,{percentage:Mm(ee)})}),t.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[t.jsx(O,{type:"button",size:"lg",color:"default",radius:"full",className:"h-11 bg-zinc-950 px-4 text-lg font-normal text-white disabled:opacity-50 [@container(max-width:479px)]:w-full",startContent:t.jsx(X.Plus,{className:"size-5",strokeWidth:2}),isDisabled:I,onPress:()=>C?Y():x(),children:N.assignSpecificFund}),t.jsx(O,{type:"button","data-testid":"installment-fund-assignment-save-button",size:"md",color:"primary",radius:"full",className:"ml-auto h-10 min-w-40 px-4 text-sm font-medium [@container(max-width:479px)]:w-full",startContent:r?void 0:t.jsx(P,{icon:"solar:cloud-upload-outline",className:"size-4"}),isLoading:r,isDisabled:!M||r,onPress:J,children:N.saveAssignment})]})]}),m]})},"installment-fund-assignment")}),d&&t.jsx(Om,{funds:n,labels:N,selectedFundIds:e.map(V=>V.fund?.id).filter(Boolean),portalContainer:$,onSelect:ie,onClose:g}),t.jsx(Hs,{isOpen:W,labels:{title:N.modifyAssignedFundsTitle,description:t.jsxs(t.Fragment,{children:[t.jsx("p",{children:N.modifyAssignedFundsDescription}),t.jsx("p",{className:"mt-3",children:N.modifyAssignedFundsWarning})]}),cancel:N.modifyAssignedFundsCancel,confirm:N.modifyAssignedFundsConfirm},icon:t.jsx(P,{icon:"solar:info-circle-outline",className:"size-7"}),iconTone:"warning",confirmColor:"primary",portalContainer:$,shouldBlockScroll:!1,classNames:Rm,onClose:()=>K(!1),onConfirm:q})]})}function Im({assignments:e,labels:n,total:s,hasTotalError:a,validationMessage:r,onSelectFund:i,onRemoveFund:o,onPercentageChange:l}){return t.jsxs("div",{className:"flex flex-col gap-3",children:[e.map((d,u)=>t.jsxs("div",{"data-testid":"installment-fund-assignment-row",className:"flex min-h-15 w-full flex-wrap items-center gap-3 rounded-2xl border border-zinc-200 bg-white px-3 py-2",children:[t.jsx("div",{className:c.cn("flex min-h-11 min-w-0 basis-full items-center gap-2","[@container(min-width:560px)]:basis-0 [@container(min-width:560px)]:flex-1 [@container(min-width:560px)]:gap-4"),children:d.fund?t.jsxs(t.Fragment,{children:[t.jsxs("span",{className:"min-w-0 break-words rounded-2xl bg-zinc-100 px-4 py-1.5 text-sm text-zinc-950",children:[d.fund.glCode," - ",d.fund.accountName]}),t.jsx(O,{type:"button",variant:"light",color:"primary",radius:"full",className:"flex-none px-2 text-sm font-normal",onPress:()=>i(d.id),children:"Replace"})]}):t.jsx(O,{type:"button",size:"lg",variant:"light",radius:"full",className:"max-w-full justify-start px-4 text-lg font-normal text-zinc-900",startContent:t.jsx(X.Plus,{className:"size-5",strokeWidth:2}),onPress:()=>i(d.id),children:n.assignSpecificFund})}),t.jsx("label",{className:"flex min-w-0 flex-1 items-center [@container(min-width:560px)]:w-48 [@container(min-width:560px)]:flex-none",children:t.jsx(c.Input,{variant:"bordered",type:"number",min:0,max:100,step:.01,value:String(d.percentage||""),onChange:f=>l(d.id,Number(f.target.value)),endContent:t.jsx("span",{className:"text-sm text-zinc-500",children:"%"}),classNames:Fm})}),e.length>1&&t.jsx(O,{type:"button",isIconOnly:!0,variant:"flat",radius:"full",className:c.cn("h-10 w-10 flex-none p-0",u===0?"bg-danger-100 text-danger-500 opacity-60":"bg-danger-600 text-white"),style:{height:40,minWidth:40,width:40},isDisabled:u===0,onPress:()=>o(d.id),"aria-label":n.removeFund,children:t.jsx(P,{icon:"solar:trash-bin-minimalistic-outline",className:"size-5"})})]},d.id)),t.jsx(c.Alert,{icon:t.jsx(P,{icon:a?"solar:info-circle-outline":"solar:check-circle-outline",className:"size-4"}),hideIconWrapper:!0,isClosable:!1,color:a?"warning":"success",variant:"flat",classNames:{...Pt,base:c.cn(Pt.base,a?"bg-warning-50 text-warning-700":"bg-success-50 text-success-700"),iconWrapper:c.cn(Pt.iconWrapper,a?"text-warning-700":"text-success-700"),alertIcon:c.cn(Pt.alertIcon,a?"text-warning-700":"text-success-700"),title:c.cn(Pt.title,a?"text-warning-700":"text-success-700")},title:a?r:`${n.total} ${Number(s.toFixed(2))}%`})]})}function Om({funds:e,labels:n,selectedFundIds:s,portalContainer:a,onSelect:r,onClose:i}){const[o,l]=h.useState(""),d=e.filter(u=>{if(s.includes(u.id))return!1;const f=o.trim().toLowerCase();return f?`${u.glCode} ${u.accountName} ${u.type}`.toLowerCase().includes(f):!0});return t.jsx(Yt,{isOpen:!0,size:"3xl",placement:"center",scrollBehavior:"inside",shouldBlockScroll:!1,portalContainer:a,classNames:{wrapper:"!absolute !inset-0 !z-50 !h-auto !w-auto !items-center !justify-center !p-4",backdrop:"!absolute !inset-0 !z-40 !h-auto !w-auto rounded-2xl",base:"max-h-[calc(100%-2rem)] w-full max-w-3xl rounded-3xl",closeButton:"right-6 top-6 text-zinc-500"},onOpenChange:u=>!u&&i(),children:t.jsxs(c.ModalContent,{className:"max-h-full",children:[t.jsx(c.ModalHeader,{className:"px-6 pr-12 pt-6 text-xl font-semibold leading-7 text-zinc-950",children:n.modalTitle}),t.jsxs(c.ModalBody,{className:"flex min-h-0 flex-1 flex-col px-6 pb-6",children:[t.jsx(c.Input,{variant:"bordered","aria-label":n.searchPlaceholder,value:o,placeholder:n.searchPlaceholder,onChange:u=>l(u.target.value),startContent:t.jsx(P,{icon:"solar:magnifer-outline",className:"size-5 text-zinc-500"}),classNames:{input:"text-sm placeholder:text-zinc-500",inputWrapper:"h-10 rounded-2xl border border-zinc-200 bg-white px-4 shadow-none hover:border-zinc-300 data-[hover=true]:border-zinc-300 group-data-[focus=true]:border-zinc-400 group-data-[focus-visible=true]:ring-0"}}),t.jsxs("div",{className:"mt-4 min-h-0 flex-1 overflow-auto [container-type:inline-size]",children:[t.jsxs("div",{className:"hidden grid-cols-[1fr_1.3fr_0.6fr] gap-5 border-b border-zinc-200 px-3 pb-3 text-sm font-medium leading-5 text-zinc-900 [@container(min-width:520px)]:grid",children:[t.jsx("span",{children:n.glCode}),t.jsx("span",{children:n.accountName}),t.jsx("span",{children:n.actions})]}),d.length===0&&t.jsx("div",{className:"p-4 text-sm text-zinc-500",children:n.noFunds}),d.map(u=>t.jsxs("div",{"data-testid":"installment-fund-picker-row",className:"grid grid-cols-[minmax(0,1fr)_auto] items-center gap-x-3 border-b border-zinc-100 px-3 py-2.5 text-sm leading-5 text-zinc-900 last:border-b-0 [@container(min-width:520px)]:grid-cols-[1fr_1.3fr_0.6fr] [@container(min-width:520px)]:gap-5 [@container(min-width:520px)]:border-b-0",children:[t.jsx("span",{className:"col-start-1 row-start-1 font-medium [@container(min-width:520px)]:font-normal",children:u.glCode}),t.jsx("span",{className:"col-start-1 row-start-2 min-w-0 break-words text-zinc-600 [@container(min-width:520px)]:col-start-2 [@container(min-width:520px)]:row-start-1 [@container(min-width:520px)]:text-zinc-900",children:u.accountName}),t.jsx(O,{type:"button",size:"sm",variant:"bordered",radius:"full",className:"col-start-2 row-span-2 row-start-1 h-9 min-w-20 border-zinc-200 bg-white text-sm font-medium text-zinc-900 [@container(min-width:520px)]:col-start-3 [@container(min-width:520px)]:row-span-1 [@container(min-width:520px)]:min-w-24",onPress:()=>r(u),children:n.select})]},u.id))]})]})]})})}function zm(){return t.jsxs("section",{className:"flex w-full flex-col gap-4 rounded-2xl border border-zinc-200 bg-white p-4 shadow-sm","aria-busy":"true",children:[t.jsxs("div",{className:"flex items-start justify-between gap-3",children:[t.jsx(c.Skeleton,{className:"h-7 w-56 rounded-lg"}),t.jsx(c.Skeleton,{className:"size-8 rounded-full"})]}),t.jsxs("div",{className:"flex items-center justify-between gap-3",children:[t.jsx(c.Skeleton,{className:"h-10 w-72 rounded-full"}),t.jsx(c.Skeleton,{className:"h-10 w-40 rounded-full"})]}),t.jsxs("div",{className:"grid grid-cols-[minmax(0,1fr)_160px] items-center gap-4 rounded-2xl border border-zinc-100 p-3",children:[t.jsx(c.Skeleton,{className:"h-8 w-full max-w-xs rounded-full"}),t.jsx(c.Skeleton,{className:"h-8 w-full rounded-xl"})]}),t.jsx(c.Skeleton,{className:"h-11 w-40 rounded-full"})]})}const Bm={totalAmount:"Total Amount:",remainingBalance:"Remaining Balance",amountReceived:"Amount Received:"};function Vm({totalAmount:e,remainingBalance:n,amountReceived:s,currency:a="USD",locale:r="en-US",labels:i,className:o}){const l={...Bm,...i},d=new Intl.NumberFormat(r,{style:"currency",currency:a});return t.jsx("div",{className:c.cn("w-full rounded-2xl border border-zinc-200 bg-white px-4 py-2.5 font-sans text-base leading-6",o),children:t.jsxs("div",{className:"flex w-full flex-wrap items-center gap-x-5 gap-y-2",children:[t.jsx(Yn,{label:l.totalAmount,value:d.format(e)}),t.jsx(Yn,{label:l.remainingBalance,value:d.format(n)}),t.jsx(Yn,{label:l.amountReceived,value:d.format(s)})]})})}function Yn({label:e,value:n}){return t.jsxs("div",{className:"flex items-center gap-3 whitespace-nowrap",children:[t.jsx("span",{className:"font-medium text-zinc-700",children:e}),t.jsx("span",{className:"font-normal text-zinc-950",children:n})]})}const Um={monthly:1,quarterly:3,annual:12},Gi=e=>{const[n,s,a]=e.split("-").map(Number);return{year:n,month:s,day:a}},Hm=(e,n)=>new Date(e,n+1,0).getDate(),Wm=e=>{const n=e.getFullYear(),s=String(e.getMonth()+1).padStart(2,"0"),a=String(e.getDate()).padStart(2,"0");return`${n}-${s}-${a}`},qm=(e,n)=>{const{year:s,month:a,day:r}=Gi(e),i=a-1+n,o=s+Math.floor(i/12),l=(i%12+12)%12,d=Math.min(r,Hm(o,l));return new Date(o,l,d)},Gm=(e,n)=>{const{year:s,month:a,day:r}=Gi(e),i=new Date(s,a-1,r);return i.setDate(i.getDate()+n),i};function Ki(e,n){const s=Math.max(1,Math.floor(n.numberOfInstallments||1)),a=Math.round(e*100),r=Math.floor(a/s),i=a-r*s,o=Um[n.frequency];return Array.from({length:s},(l,d)=>{const u=n.frequency==="weekly"?Gm(n.firstInstallmentDate,d*7):qm(n.firstInstallmentDate,d*(o??1));return{id:crypto.randomUUID(),dueDate:Wm(u),amount:(r+(d===0?i:0))/100}})}function Km(e){return new Set(e.map((n,s)=>{const a=e[s+1]?.dueDate;return n.dueDate&&a&&n.dueDate>a?n.id:null}).filter(n=>!!n))}function Ym(e){return{missingDateRows:new Set(e.filter(n=>!n.dueDate).map(n=>n.id)),invalidDateRows:Km(e),invalidAmountRows:new Set(e.filter(n=>Number(n.amount||0)<=0).map(n=>n.id))}}function Qm(e){return e.missingDateRows.size>0||e.invalidDateRows.size>0||e.invalidAmountRows.size>0}function Zm(e,n){const s=e[0];return!s||!n||s.dueDate===n?e:[{...s,dueDate:n},...e.slice(1)]}const Xm=new Set(["paid","partially_refunded","refunded"]);function gt(e){return e!==void 0&&Xm.has(e)}const Jm={title:"Payments",saved:"Saved",automaticMode:"Auto",manualMode:"Manual",createInstallments:"Create Payments",generateSchedule:"Generate Schedule",saveInstallments:"Save Payments",cancelEdit:"Cancel",addInstallment:"Add Payment",emptyAutomatic:"No payments have been generated for this opportunity",emptyManual:"Add payments with custom dates and amounts",numberOfInstallments:"Number of payments",frequency:"Frequency",dayOfMonth:"Day of month",firstInstallmentDate:"First payment date",installment:"Payment",dueDate:"Due date",amount:"Amount",total:"Total",remaining:"Remaining",deleteInstallment:"Delete installment",weekly:"Weekly",monthly:"Monthly",quarterly:"Quarterly",annual:"Annual",totalError:"Payment total must equal the total amount",totalIncreaseWarning:"Saving will update the donation/contribution total to match the scheduled payments.",totalIncreaseConfirmationTitle:"Update Donation Total",totalIncreaseConfirmationDescription:"The scheduled payments total is greater than the current donation/contribution total. Saving will update the donation/contribution total to match the scheduled payments.",totalIncreaseConfirmationCancel:"Cancel",totalIncreaseConfirmationConfirm:"Save Payments",dateOrderError:"Payment date must be on or before the next payment date.",dueDateRequiredError:"Payment date is required.",amountGreaterThanZeroError:"Payment amount must be greater than 0."},ef=["weekly","monthly","quarterly","annual"],tf=Array.from({length:31},(e,n)=>n+1),nf=["numberOfInstallments","frequency","firstInstallmentDate"],Za=()=>({id:crypto.randomUUID(),dueDate:new Date().toISOString().slice(0,10),amount:0}),vn=e=>Math.round(e*100)/100,sf=(e,n)=>{const s=new Date(`${e}T00:00:00`);return Number.isNaN(s.getTime())?e:new Intl.DateTimeFormat(n,{month:"short",day:"numeric",year:"numeric"}).format(s)},Ln=e=>{if(!e)return null;try{return Wd(e)}catch{return null}},af=e=>Ln(e)?.day??1,rf=(e,n)=>new Date(e,n,0).getDate(),lf=(e,n)=>{const s=Ln(e);if(!s)return e;const a=Math.min(n,rf(s.year,s.month));return s.set({day:a}).toString()},Xa=e=>{const n=e%100>=11&&e%100<=13?"th":e%10===1?"st":e%10===2?"nd":e%10===3?"rd":"th";return`${e}${n}`};function of({mode:e,donationAmount:n,currency:s="USD",locale:a="en-US",installments:r,automaticSettings:i,defaultTab:o="automatic",showTitle:l=!0,showCard:d=!0,showSavePayment:u=!0,showTabs:f=!0,inputs:m=nf,startDate:p,firstInstallmentDateOverride:x,labels:g,classNames:y,isSaving:b=!1,showSavedIndicator:v=!1,isModeSwitchDisabled:w=!1,onModeChange:$,onAutomaticSettingsChange:N,onInstallmentsChange:A,onSave:k,onCancel:C}){const[E,S]=h.useState(o),_={...Jm,...g},F=e??E,L=h.useMemo(()=>new Intl.NumberFormat(a,{style:"currency",currency:s}),[s,a]),M=h.useMemo(()=>({...i,firstInstallmentDate:m.includes("firstInstallmentDate")?i.firstInstallmentDate:m.includes("dayOfMonth")?i.firstInstallmentDate||p||"":p||i.firstInstallmentDate}),[i,m,p]),I=F==="automatic"?Zm(Ki(n,M),m.includes("firstInstallmentDate")?void 0:x):r,W=h.useMemo(()=>vn(I.reduce((te,Fe)=>te+Number(Fe.amount||0),0)),[I]),K=Math.abs(W-n)>.009,z=vn(n-W)<=0,ne=h.useMemo(()=>Ym(r),[r]),G=F==="manual"&&Qm(ne),se=K||G,Y=l?t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(X.CircleDollarSign,{className:"size-4 text-zinc-500",strokeWidth:1.75}),t.jsx("span",{className:"text-base font-medium leading-6 text-zinc-950",children:_.title}),v?t.jsx(c.Chip,{size:"sm",radius:"full",color:"success",variant:"flat",children:_.saved}):null]}):void 0,oe=te=>{te!==F&&(e||S(te),$?.(te),te==="manual"&&r.length===0&&A([Za()]))},J=(te,Fe)=>{const Z=r.find(he=>he.id===te);gt(Z?.status)||A(r.map(he=>he.id===te?{...he,...Fe}:he))},q=()=>{A([...r,Za()])},ie=te=>{const Fe=r.find(Z=>Z.id===te);gt(Fe?.status)||A(r.filter(Z=>Z.id!==te))},V=()=>{b||se||k?.()},ee=t.jsxs("div",{className:c.cn("flex w-full flex-col gap-4",y?.content),children:[f||u||C?t.jsxs("div",{className:"flex w-full items-center justify-between gap-6",children:[f?t.jsx(cf,{mode:F,labels:_,onModeChange:oe,isDisabled:w,className:y?.tabs}):null,t.jsxs("div",{className:"ml-auto flex items-center gap-3",children:[C?t.jsx(O,{type:"button","data-testid":"installment-schedule-cancel-button",size:"md",variant:"bordered",radius:"full",className:"min-w-28",isDisabled:b,onPress:C,children:_.cancelEdit}):null,u?t.jsx(O,{type:"button","data-testid":"installment-schedule-save-button",size:"md",color:"primary",radius:"full",className:"min-w-36",startContent:b?void 0:t.jsx(P,{icon:"solar:cloud-upload-outline",className:"size-4"}),isLoading:b,isDisabled:b||se,onPress:V,children:_.saveInstallments}):null]})]}):null,t.jsxs("div",{className:c.cn("flex w-full flex-col gap-4",y?.preview),children:[F==="automatic"&&t.jsx(df,{settings:M,inputs:m,labels:_,className:y?.controls,onSettingsChange:N}),I.length===0&&t.jsx(c.Alert,{isClosable:!1,color:"default",variant:"flat",radius:"full",title:F==="automatic"?_.emptyAutomatic:_.emptyManual}),I.length>0&&t.jsx(uf,{mode:F,installments:I,rowErrors:ne,labels:_,formatter:L,locale:a,onUpdateInstallment:J,onRemoveInstallment:ie}),F==="manual"&&t.jsx("div",{className:"flex flex-wrap gap-3",children:t.jsx(O,{type:"button",size:"md",variant:"bordered",radius:"full",className:"h-10 border-zinc-200 bg-white px-4 text-sm font-normal text-zinc-900",startContent:t.jsx(X.Plus,{className:"size-5",strokeWidth:2}),isDisabled:z,onPress:q,children:_.addInstallment})}),t.jsx(pf,{total:W,donationAmount:n,hasTotalMismatch:K,mode:F,installments:I,formatter:L,labels:_,className:y?.summary})]})]});return t.jsx("div",{className:c.cn("vvt-ps relative font-sans text-zinc-900",y?.root),children:d?t.jsx(c.Accordion,{variant:"splitted",defaultSelectedKeys:["installment-schedule"],className:c.cn("w-full gap-0 px-0",y?.panel),itemClasses:{base:"w-full rounded-2xl border border-zinc-200 bg-white p-0 shadow-sm",trigger:c.cn("px-4 py-4",y?.header),title:"w-full",content:"w-full px-4 pb-4 pt-0",indicator:"text-zinc-500 [&>svg]:size-4"},children:t.jsx(c.AccordionItem,{"aria-label":_.title,title:Y,children:ee},"installment-schedule")}):ee})}function cf({mode:e,labels:n,className:s,isDisabled:a=!1,onModeChange:r}){return t.jsxs(c.Tabs,{"aria-label":n.title,selectedKey:e,isDisabled:a,color:"primary",size:"lg",radius:"full",className:c.cn("w-fit",s),onSelectionChange:i=>r(i),children:[t.jsx(c.Tab,{title:n.automaticMode},"automatic"),t.jsx(c.Tab,{title:n.manualMode},"manual")]})}function df({settings:e,inputs:n,labels:s,className:a,onSettingsChange:r}){const i=o=>{if(o==="numberOfInstallments")return t.jsx("div",{className:"min-w-0",children:t.jsx(c.Input,{variant:"bordered",label:s.numberOfInstallments,labelPlacement:"outside",type:"number",min:1,step:1,value:e.numberOfInstallments>0?String(e.numberOfInstallments):"",onWheel:l=>l.currentTarget.blur(),onChange:l=>{const d=l.target.value;r({...e,numberOfInstallments:d===""?0:Math.max(1,Number(d))})}})},o);if(o==="frequency")return t.jsx("div",{className:"min-w-0",children:t.jsx(Xe,{variant:"bordered",label:s.frequency,labelPlacement:"outside",selectedKeys:[e.frequency],onSelectionChange:l=>{const d=Array.from(l)[0];typeof d=="string"&&r({...e,frequency:d})},children:ef.map(l=>t.jsx(c.SelectItem,{textValue:s[l],children:s[l]},l))})},o);if(o==="dayOfMonth"){const l=String(af(e.firstInstallmentDate));return t.jsx("div",{className:"min-w-0",children:t.jsx(Xe,{variant:"bordered",label:s.dayOfMonth,labelPlacement:"outside",selectedKeys:[l],onSelectionChange:d=>{const u=Number(Array.from(d)[0]);Number.isFinite(u)&&r({...e,firstInstallmentDate:lf(e.firstInstallmentDate,u)})},children:tf.map(d=>t.jsx(c.SelectItem,{textValue:Xa(d),children:Xa(d)},String(d)))})},o)}return t.jsx("div",{className:"min-w-0",children:t.jsx(Rs,{variant:"bordered",label:s.firstInstallmentDate,labelPlacement:"outside",value:Ln(e.firstInstallmentDate),onChange:l=>r({...e,firstInstallmentDate:l?l.toString():""}),startContent:t.jsx(P,{icon:"solar:calendar-outline",className:"size-4 text-zinc-500"})})},o)};return n.length===0?null:t.jsx("div",{className:c.cn("grid gap-4",a),style:{gridTemplateColumns:"repeat(auto-fit, minmax(min(100%, 14rem), 1fr))"},children:n.map(i)})}function uf({mode:e,installments:n,rowErrors:s,labels:a,formatter:r,locale:i,onUpdateInstallment:o,onRemoveInstallment:l}){return e==="automatic"?t.jsx("div",{className:"rounded-2xl border border-zinc-200 bg-zinc-50 p-4",children:t.jsx("div",{className:c.cn("flex flex-col gap-3",n.length>5&&"max-h-[264px] overflow-y-auto pr-2"),children:n.map((d,u)=>t.jsxs("div",{className:c.cn("flex min-h-10 items-center justify-between rounded-xl px-4 py-2 text-base",u===0&&"border border-primary/25 bg-primary/5 text-primary"),children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsxs("span",{children:["#",u+1]}),t.jsx("span",{children:"▪"}),t.jsx("span",{children:sf(d.dueDate,i)}),u===0&&n.length>1&&t.jsx(c.Chip,{size:"sm",color:"primary",variant:"solid",radius:"full",children:"First charge"})]}),t.jsx("span",{className:"text-zinc-950",children:r.format(d.amount)})]},d.id))})}):t.jsx("div",{className:"flex flex-col gap-2",children:n.map((d,u)=>{const f=s.missingDateRows.has(d.id),m=s.invalidDateRows.has(d.id),p=s.invalidAmountRows.has(d.id);return t.jsx("div",{className:"flex w-full flex-col gap-1",children:t.jsxs("div",{className:"grid w-full grid-cols-[2rem_minmax(0,1fr)_minmax(0,1fr)_2.25rem] items-start gap-4",children:[t.jsx("span",{className:"pt-2 text-sm font-medium text-zinc-500",children:u+1}),t.jsx("div",{className:"min-w-0 flex-1",children:t.jsx(Rs,{variant:"bordered","aria-label":`${a.dueDate} ${u+1}`,isDisabled:gt(d.status),isInvalid:f||m,errorMessage:f?a.dueDateRequiredError:m?a.dateOrderError:void 0,value:Ln(d.dueDate),onChange:x=>o(d.id,{dueDate:x?x.toString():""})})}),t.jsx("div",{className:"min-w-0 flex-1",children:t.jsx(ff,{amount:d.amount,ariaLabel:`${a.amount} ${u+1}`,isDisabled:gt(d.status),isInvalid:p,errorMessage:a.amountGreaterThanZeroError,onAmountChange:x=>o(d.id,{amount:x})})}),t.jsx(xf,{isDisabled:n.length<=1,isPaid:gt(d.status),label:a.deleteInstallment,onRemove:()=>l(d.id)})]})},d.id)})})}const mf=/^\d*(?:[.,]\d{0,2})?$/;function ff({amount:e,ariaLabel:n,isDisabled:s,isInvalid:a,errorMessage:r,onAmountChange:i}){const[o,l]=h.useState(null);return t.jsx(c.Input,{variant:"bordered","aria-label":n,type:"text",inputMode:"decimal",autoComplete:"off",isDisabled:s,isInvalid:a,errorMessage:a?r:void 0,value:o??(e?String(e):""),onChange:d=>{const u=d.target.value.trim();if(!mf.test(u))return;l(u);const f=Number(u.replace(",","."));i(vn(Number.isFinite(f)?f:0))},onBlur:()=>l(null),startContent:t.jsx("span",{className:"text-zinc-900",children:"$"})})}function xf({isDisabled:e,isPaid:n,label:s,onRemove:a}){const r=t.jsx(O,{type:"button",isIconOnly:!0,variant:"flat",radius:"full",className:"h-9 w-9 flex-none bg-danger-100 p-0 text-danger-600",style:{height:36,minWidth:36,width:36},isDisabled:e||n,onPress:a,"aria-label":s,children:t.jsx(P,{icon:"solar:trash-bin-minimalistic-outline",className:"size-5"})});return n?t.jsx(c.Tooltip,{content:"This payment cannot be edited or deleted because it has already been paid.",placement:"top",children:t.jsx("span",{className:"inline-flex",children:r})}):r}function pf({total:e,donationAmount:n,hasTotalMismatch:s,mode:a,installments:r,formatter:i,labels:o,className:l}){const d=r.length,u=r[0]?.amount??0,f=r[1]?.amount??u,m=d>1&&Math.round(u*100)!==Math.round(f*100),p=vn(n-e),x=Math.max(p,0),g=Math.max(-p,0),y=s?t.jsxs("span",{children:[o.totalError,". Total scheduled: ",t.jsx("strong",{children:i.format(e)})," /"," ",t.jsx("strong",{children:i.format(n)}),"."]}):a==="automatic"?m?t.jsxs("span",{children:["Saving will create ",t.jsx("strong",{children:d})," scheduled payment records:"," ",t.jsx("strong",{children:i.format(u)})," first charge and"," ",t.jsx("strong",{children:i.format(f)})," for each remaining charge."]}):t.jsxs("span",{children:["Saving will create ",t.jsx("strong",{children:d})," scheduled payment records of"," ",t.jsx("strong",{children:i.format(u)})," each."]}):t.jsxs("span",{children:["Total scheduled: ",t.jsx("strong",{children:i.format(e)})," /"," ",t.jsx("strong",{children:i.format(n)}),"."]}),b=a==="automatic"?`Total: ${i.format(e)}`:g>0?`Exceeds by: ${i.format(g)}`:`${o.remaining}: ${i.format(x)}`;return t.jsx(c.Alert,{isClosable:!1,color:s?"danger":"default",variant:"flat",radius:"full",className:l,endContent:t.jsx("span",{className:"whitespace-nowrap",children:b}),title:y})}function hf(){return t.jsxs("section",{className:"flex w-full flex-col gap-4 rounded-2xl border border-zinc-200 bg-white p-4 shadow-sm","aria-busy":"true",children:[t.jsxs("div",{className:"flex items-start justify-between gap-3",children:[t.jsx(c.Skeleton,{className:"h-7 w-56 rounded-lg"}),t.jsx(c.Skeleton,{className:"size-8 rounded-full"})]}),t.jsxs("div",{className:"flex items-center justify-between gap-3",children:[t.jsx(c.Skeleton,{className:"h-10 w-72 rounded-full"}),t.jsx(c.Skeleton,{className:"h-10 w-40 rounded-full"})]}),t.jsxs("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-end sm:justify-between",children:[t.jsxs("div",{className:"flex w-full max-w-[280px] flex-col gap-2",children:[t.jsx(c.Skeleton,{className:"h-4 w-36 rounded-md"}),t.jsx(c.Skeleton,{className:"h-9 w-full rounded-xl"})]}),t.jsx(c.Skeleton,{className:"h-9 w-36 rounded-full"})]}),t.jsx("div",{className:"flex flex-col gap-3",children:Array.from({length:4}).map((e,n)=>t.jsxs("div",{className:"grid grid-cols-[minmax(0,1fr)_160px] items-center gap-4 rounded-2xl border border-zinc-100 p-3",children:[t.jsx(c.Skeleton,{className:"h-8 w-full max-w-xs rounded-full"}),t.jsx(c.Skeleton,{className:"h-8 w-full rounded-xl"})]},n))})]})}const Ja={paid:"bg-emerald-50 text-emerald-700",scheduled:"bg-blue-50 text-blue-700",schedule:"bg-blue-50 text-blue-700",payment_due:"bg-amber-50 text-amber-700",overdue:"bg-orange-50 text-orange-700",failed:"bg-red-50 text-red-700",refunded:"bg-zinc-100 text-zinc-600",partially_refunded:"bg-lime-50 text-lime-800",disputed:"bg-purple-50 text-purple-700",canceled:"bg-zinc-100 text-zinc-600",processing:"bg-sky-50 text-sky-700",pending_confirmation:"bg-indigo-50 text-indigo-700"},Yi={paid:"Paid",scheduled:"Scheduled",schedule:"Scheduled",payment_due:"Payment Due",overdue:"Overdue",failed:"Failed",refunded:"Refunded",partially_refunded:"Partially refunded",disputed:"Disputed",canceled:"Canceled",processing:"Processing",pending_confirmation:"Pending Confirmation"},bf={title:"Payments",saved:"Saved",searchLabel:"Search a payment",searchPlaceholder:"Search a payment by name, ID, or date...",editInstallments:"Edit Payment",installmentId:"Payment",amount:"Amount",scheduledDate:"Scheduled Date",paidOn:"Paid on",partiallyRefunded:Yi.partially_refunded,refundedAmount:"Refunded",status:"Status",actions:"Actions",payNow:"Pay now",sendLink:"Send Link",sendLinkDescription:"Send a payment link to the contact",dangerZone:"Danger zone",deleteInstallment:"Delete Payment",deleteInstallmentDescription:"Remove Payment from Opportunity",deleteInstallmentConfirmationTitle:"Delete Payment",deleteInstallmentConfirmationDescription:t.jsxs(t.Fragment,{children:["Are you sure you want to delete this payment? ",t.jsx("strong",{children:"This action cannot be undone."})]}),deleteInstallmentConfirmationCancel:"Cancel",deleteInstallmentConfirmationConfirm:"Confirm",noInstallmentsFound:"No payments found."},gf={wrapper:"!absolute !inset-0 !z-50 !items-center !justify-center !p-4",backdrop:"!absolute !inset-0 !z-40 rounded-2xl"},yf=[];function vf({installments:e,currency:n,locale:s="en-US",showTitle:a=!0,showCard:r=!0,showEditPayment:i=!0,showDelete:o=!0,payNowHiddenStatuses:l=yf,showSavedIndicator:d=!1,labels:u,isSaving:f=!1,onEditInstallments:m,onPayInstallment:p,onDeleteInstallment:x}){const[g,y]=h.useState(null),b={...bf,...u},[v,w]=h.useState(""),$=new Intl.NumberFormat(s,{style:"currency",currency:n}),N=e.some(S=>Qi(S)!==null),A=e.some(S=>S.status==="partially_refunded"),k=a?t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(X.CircleDollarSign,{className:"size-4 text-zinc-500",strokeWidth:1.75}),t.jsx("span",{className:"text-base font-medium leading-6 text-zinc-950",children:b.title}),d?t.jsx(c.Chip,{size:"sm",radius:"full",color:"success",variant:"flat",children:b.saved}):null]}):void 0,C=h.useMemo(()=>{const S=v.trim().toLowerCase();if(!S)return e;const _=new Intl.NumberFormat(s,{style:"currency",currency:n});return e.filter(F=>{const L=F.status??"scheduled";return[Qn(F),F.id,F.amount,F.dueDate,mn(F.dueDate,s),Zn(F,b.paidOn,s),Xn(F,b.refundedAmount,_),L,Jn(L,b.partiallyRefunded)].join(" ").toLowerCase().includes(S)})},[s,n,e,v,b.paidOn,b.refundedAmount,b.partiallyRefunded]),E=t.jsxs("div",{className:"flex min-w-0 w-full flex-col gap-4 overflow-x-hidden [container-type:inline-size]",children:[t.jsxs("div",{className:"flex min-w-0 w-full flex-wrap items-end justify-between gap-4",children:[t.jsxs("div",{className:"min-w-0 w-full max-w-[280px]",children:[t.jsx("label",{className:"mb-1 block text-sm font-normal text-zinc-950",children:b.searchLabel}),t.jsx(c.Input,{variant:"bordered",size:"md",value:v,placeholder:b.searchPlaceholder,onChange:S=>w(S.target.value),startContent:t.jsx(P,{icon:"solar:magnifer-outline",className:"size-4 text-zinc-500"})})]}),i?t.jsx(O,{type:"button",variant:"bordered",radius:"full",size:"md",className:"h-10 border-zinc-200 bg-white px-4 text-sm font-normal text-zinc-900",startContent:t.jsx(P,{icon:"solar:pen-outline",className:"size-4"}),isLoading:f,onPress:m,children:b.editInstallments}):null]}),t.jsx("div",{className:c.cn("hidden [@container(max-width:767px)]:block",C.length>3&&"max-h-[560px] overflow-y-auto pr-1"),children:t.jsxs("div",{className:"flex flex-col gap-2",children:[C.map((S,_)=>{const F=S.status??"scheduled",L=Qn(S),M=Zn(S,b.paidOn,s),I=Xn(S,b.refundedAmount,$);return t.jsx(c.Card,{radius:"lg",shadow:"none",className:"border border-default-200",children:t.jsxs(c.CardBody,{className:"gap-3 p-3",children:[t.jsxs("div",{className:"flex items-start justify-between gap-2",children:[t.jsxs("div",{className:"min-w-0",children:[t.jsxs("p",{className:"text-xs text-default-500",children:["#",_+1]}),t.jsx("p",{className:"truncate text-sm font-medium text-foreground",children:L||`PMT-${_+1}`})]}),t.jsx(er,{status:F,label:Jn(F,b.partiallyRefunded)})]}),t.jsxs("div",{className:"grid grid-cols-2 gap-2 text-sm",children:[t.jsxs("div",{children:[t.jsx("p",{className:"text-xs text-default-500",children:b.amount}),t.jsx("p",{className:"font-medium text-foreground",children:$.format(S.amount)}),I?t.jsx("p",{className:"text-xs text-default-500",children:I}):null]}),t.jsxs("div",{className:"text-right",children:[t.jsx("p",{className:"text-xs text-default-500",children:b.scheduledDate}),t.jsx("p",{className:"font-medium text-foreground",children:mn(S.dueDate,s)}),M?t.jsx("p",{className:"text-xs text-default-500",children:M}):null]})]}),t.jsx(tr,{status:F,installment:S,labels:b,portalContainer:g??void 0,showDelete:o,payNowHiddenStatuses:l,onPayInstallment:p,onDeleteInstallment:x})]})},S.id)}),C.length===0&&t.jsx("div",{className:"rounded-lg border border-default-200 px-4 py-6 text-center text-sm text-default-500",children:b.noInstallmentsFound})]})}),t.jsx("div",{className:c.cn("w-full overflow-x-hidden [@container(max-width:767px)]:hidden",C.length>5&&"max-h-[344px] overflow-y-auto pr-1"),children:t.jsxs("table",{className:"w-full table-fixed border-collapse text-left text-sm",children:[t.jsxs("colgroup",{children:[t.jsx("col",{className:"w-12"}),t.jsx("col",{}),t.jsx("col",{className:N?"w-32":"w-24"}),t.jsx("col",{className:"w-36"}),t.jsx("col",{className:A?"w-44":"w-36"}),t.jsx("col",{className:"w-44"})]}),t.jsx("thead",{children:t.jsxs("tr",{className:"sticky top-0 z-10 border-b border-zinc-200 bg-white text-zinc-900",children:[t.jsx("th",{className:"px-2 py-3 font-medium",children:"#"}),t.jsx("th",{className:"px-2 py-3 font-medium",children:b.installmentId}),t.jsx("th",{className:"px-2 py-3 font-medium",children:b.amount}),t.jsx("th",{className:"px-2 py-3 font-medium",children:b.scheduledDate}),t.jsx("th",{className:"whitespace-nowrap px-2 py-3 font-medium",children:b.status}),t.jsx("th",{className:"whitespace-nowrap py-3 pl-4 pr-2 font-medium",children:b.actions})]})}),t.jsxs("tbody",{children:[C.map((S,_)=>{const F=S.status??"scheduled",L=Qn(S),M=Zn(S,b.paidOn,s),I=Xn(S,b.refundedAmount,$);return t.jsxs("tr",{className:"text-zinc-500",children:[t.jsx("td",{className:"px-2 py-3",children:_+1}),t.jsx("td",{className:"overflow-hidden px-2 py-3",children:t.jsx("span",{className:"block w-full truncate",children:L||`PMT-${_+1}`})}),t.jsxs("td",{className:"px-2 py-3",children:[$.format(S.amount),I?t.jsx("span",{className:"block text-xs",children:I}):null]}),t.jsxs("td",{className:"px-2 py-3",children:[mn(S.dueDate,s),M?t.jsx("span",{className:"block text-xs",children:M}):null]}),t.jsx("td",{className:"whitespace-nowrap px-2 py-3",children:t.jsx(er,{status:F,label:Jn(F,b.partiallyRefunded)})}),t.jsx("td",{className:"whitespace-nowrap py-3 pl-4 pr-2",children:t.jsx(tr,{status:F,installment:S,labels:b,portalContainer:g??void 0,showDelete:o,payNowHiddenStatuses:l,onPayInstallment:p,onDeleteInstallment:x})})]},S.id)}),C.length===0&&t.jsx("tr",{children:t.jsx("td",{colSpan:6,className:"px-2 py-6 text-center text-zinc-500",children:b.noInstallmentsFound})})]})]})})]});return t.jsx("div",{ref:y,className:"vvt-ps relative min-w-0 w-full overflow-x-hidden [container-type:inline-size] font-sans text-zinc-900",children:r?t.jsx(c.Accordion,{variant:"splitted",defaultSelectedKeys:["installment-table"],className:"min-w-0 w-full gap-0 px-0",itemClasses:{base:"min-w-0 w-full overflow-x-hidden rounded-2xl border border-zinc-200 bg-white p-0 shadow-sm",trigger:"px-4 py-4",title:"w-full",content:"min-w-0 w-full overflow-x-hidden px-4 pb-4 pt-0",indicator:"text-zinc-500 [&>svg]:size-4"},children:t.jsx(c.AccordionItem,{"aria-label":b.title,title:k,children:E},"installment-table")}):E})}function Qn(e){return e.name?.trim()||e.id}function Zn(e,n,s){return!gt(e.status)||!e.fulfilledAt?null:`${n} ${mn(e.fulfilledAt,s)}`}function Qi(e){const{refundedAmount:n}=e;return e.status!=="partially_refunded"||typeof n!="number"||!Number.isFinite(n)||n<=0?null:n}function Xn(e,n,s){const a=Qi(e);return a===null?null:`${n} ${s.format(a)}`}function Jn(e,n){return e==="partially_refunded"?n:Yi[e]??e}function er({status:e,label:n}){return t.jsx(c.Chip,{size:"md",radius:"lg",className:c.cn("justify-center px-4",Ja[e]??Ja.scheduled),startContent:t.jsx(wf,{status:e}),children:n})}function tr({status:e,installment:n,labels:s,portalContainer:a,showDelete:r,payNowHiddenStatuses:i,onPayInstallment:o,onDeleteInstallment:l}){const d=!i.includes(e),u=gt(e);return t.jsxs("div",{className:"flex min-w-36 items-center justify-start gap-2",children:[d?t.jsx(O,{type:"button",size:"md",color:"primary",variant:"solid",radius:"full",className:"min-w-[104px] shrink-0",isDisabled:u,startContent:t.jsx(P,{icon:"solar:dollar-minimalistic-outline",className:"size-4"}),onPress:()=>o?.(n),children:s.payNow}):null,t.jsx(jf,{isFulfilled:u,showDelete:r,labels:s,portalContainer:a,onDelete:()=>l(n.id)})]})}function jf({isFulfilled:e,showDelete:n,labels:s,portalContainer:a,onDelete:r}){const[i,o]=h.useState(!1);return t.jsxs(t.Fragment,{children:[t.jsxs(c.Dropdown,{placement:"bottom-end",radius:"lg",children:[t.jsx(c.DropdownTrigger,{children:t.jsx(O,{type:"button",isIconOnly:!0,size:"sm",variant:"light",className:"text-zinc-900","aria-label":"More actions",children:t.jsx(P,{icon:"solar:menu-dots-bold",className:"size-4"})})}),t.jsxs(c.DropdownMenu,{"aria-label":"Installment actions",disabledKeys:e?["send-link","delete"]:[],className:"w-72 p-2",onAction:l=>{l==="delete"&&n&&!e&&o(!0)},children:[t.jsx(c.DropdownSection,{title:"Actions",showDivider:n,children:t.jsx(c.DropdownItem,{textValue:s.sendLink,description:s.sendLinkDescription,startContent:t.jsx(P,{icon:"solar:link-outline",className:"size-5 text-zinc-500"}),children:s.sendLink},"send-link")}),n?t.jsx(c.DropdownSection,{title:s.dangerZone,children:t.jsx(c.DropdownItem,{textValue:s.deleteInstallment,className:"text-danger-600",color:"danger",description:s.deleteInstallmentDescription,startContent:t.jsx(P,{icon:"solar:trash-bin-minimalistic-outline",className:"size-5"}),children:s.deleteInstallment},"delete")}):null]})]}),n?t.jsx(Hs,{isOpen:i,labels:{title:s.deleteInstallmentConfirmationTitle,description:s.deleteInstallmentConfirmationDescription,cancel:s.deleteInstallmentConfirmationCancel,confirm:s.deleteInstallmentConfirmationConfirm},icon:t.jsx(P,{icon:"solar:danger-triangle-outline",className:"size-7"}),confirmColor:"danger",portalContainer:a,shouldBlockScroll:!1,classNames:gf,onClose:()=>o(!1),onConfirm:()=>{o(!1),r()}}):null]})}function wf({status:e}){return e==="paid"?t.jsx(P,{icon:"solar:check-circle-bold",className:"size-3"}):e==="failed"?t.jsx(P,{icon:"solar:close-circle-bold",className:"size-3"}):e==="partially_refunded"?t.jsx(P,{icon:"solar:undo-left-round-bold",className:"size-3"}):e==="processing"?t.jsx(P,{icon:"solar:refresh-circle-bold",className:"size-3"}):e==="pending_confirmation"?t.jsx(P,{icon:"solar:clock-circle-bold",className:"size-3"}):t.jsx(P,{icon:"solar:calendar-outline",className:"size-3"})}const Nf=/^\d{4}-\d{2}-\d{2}$/;function mn(e,n){const s=Nf.test(e)?new Date(`${e}T00:00:00`):new Date(e);return Number.isNaN(s.getTime())?e:new Intl.DateTimeFormat(n,{month:"short",day:"numeric",year:"numeric"}).format(s)}const Cf={title:"Select Membership",renewalTitle:"Automatic Renewal",renewalDescription:"Membership will automatically renew at the end of each period"},kf=({cards:e,locale:n,currency:s,listHeightClassName:a="",labels:r,showRenewal:i=!0,defaultRenewalValue:o=!1,initialSelectedMembershipId:l=null,allowReselect:d=!0,onRenewalChange:u,onCardSelect:f,className:m=""})=>{const p=Array.isArray(e)?e:[],[x,g]=h.useState(l),[y,b]=h.useState(o),v={...Cf,...r};h.useEffect(()=>{g(l)},[l]);const w=N=>{if(N===x){d&&f?.(N);return}g(N),f?.(N)},$=N=>{b(N),u?.(N)};return t.jsxs("div",{className:c.cn("w-full flex flex-col gap-4 items-start p-4 h-svh",m),"data-testid":"membership-select-cards",children:[t.jsx("span",{className:"hidden","data-testid":"membership-select-cards-selected-id",children:x??""}),t.jsx("p",{className:"text-2xl font-semibold text-left","data-testid":"membership-select-cards-title",children:v.title}),i&&t.jsx(nl,{title:v.renewalTitle,description:v.renewalDescription,value:y,onValueChange:$}),t.jsx("div",{className:c.cn("w-full min-h-0 flex flex-col gap-4 overflow-y-auto",a===""?"flex-1":c.cn("shrink-0",a)),"data-testid":"membership-select-cards-list",children:p.map(N=>t.jsx(Zi,{itemKey:N.id,name:N.name,type:N.type,price:N.price,locale:n,currency:s,isSelected:x===N.id,onSelect:w},N.id))})]})},Zi=({itemKey:e,name:n,type:s,price:a,locale:r="en-US",currency:i="USD",showPrice:o=!0,isSelected:l=!1,onSelect:d,compact:u=!1,isDisabled:f=!1,disabledReason:m,statusLabel:p,statusTone:x="default",className:g=""})=>{const y=new Intl.NumberFormat(r,{style:"currency",currency:i,minimumFractionDigits:0,maximumFractionDigits:2}).format(a),b=!!d&&!f,v=m||p,w=()=>{b&&d?.(e)};return t.jsx(c.Card,{shadow:"none",isPressable:!!d,onPress:w,className:c.cn("w-full min-h-fit border rounded-3xl",l?"border-primary bg-primary/5":"border-default",f?"opacity-60":"",u?"rounded-2xl":"",g),"data-testid":"item-card","data-selected":l,isDisabled:f,children:t.jsxs("div",{className:c.cn("px-4 py-8 flex gap-6 items-center justify-between",u&&"px-3 py-3 gap-4"),children:[t.jsxs("div",{className:"w-max flex flex-col gap-1 items-start",children:[t.jsx("p",{className:c.cn("font-semibold text-left",u?"text-sm":"text-xl"),"data-testid":"item-card-name",children:n}),s&&t.jsx("div",{"data-testid":"item-card-type",className:"w-fit bg-default-300 px-4 py-2 text-sm rounded-xl",children:t.jsx("p",{className:"text-center",children:s})}),v&&t.jsx(c.Chip,{"data-testid":"item-card-status",color:x,size:"sm",variant:"flat",className:"px-2",children:v})]}),o&&t.jsx("p",{className:c.cn("font-semibold text-right",u?"text-lg":"text-2xl"),"data-testid":"item-card-price",children:y})]})})},nr="w-full bg-gray-100",sr={variant:"light",color:"default"},Xi=({id:e,title:n,media:s,imageUrl:a,imageAlt:r,imageClassName:i="",imageAspect:o="aspect-[4/3]",meta:l=[],price:d,action:u,footer:f,onPress:m,isPressable:p=!1,isDisabled:x=!1,compact:g=!1,className:y="",bodyClassName:b="",footerClassName:v="",dataTestId:w})=>{const $=!!(d&&d.value),N=!!u?.label,A=p&&!!m&&!N,k=!A,C=N?{variant:u?.variant??sr.variant,color:u?.color??sr.color,size:u?.size??"sm",isDisabled:x||u?.isDisabled,startContent:u?.icon?t.jsx(P,{icon:u.icon,width:16}):void 0}:null,E=s??(a?t.jsx("div",{className:c.cn("relative overflow-hidden rounded-xl",o,nr,i),children:t.jsx(c.Image,{removeWrapper:!0,src:a,alt:r||n,className:"size-full object-cover",classNames:{wrapper:"absolute inset-0"}})}):t.jsx("div",{className:c.cn("relative overflow-hidden rounded-xl",o,nr,"grid place-items-center",i),"data-testid":`catalog-item-card-${e??"media"}-fallback`,children:t.jsx(P,{icon:"solar:ticket-outline",width:48,className:"text-default-400"})}));return t.jsxs(c.Card,{"data-testid":w||`catalog-item-card-${e??"item"}`,className:c.cn("w-full overflow-hidden",y),isPressable:A,onPress:m,isDisabled:x,shadow:"sm",radius:"lg",children:[t.jsx("div",{children:E}),t.jsxs(c.CardBody,{className:c.cn("gap-3",g?"p-3":"p-4",b),children:[t.jsx("h3",{"data-testid":`catalog-item-card-title-${e??""}`,className:c.cn("line-clamp-2 text-base font-semibold text-gray-900",g?"text-sm":""),children:n}),l.length>0?t.jsx("div",{className:"flex flex-col gap-1.5 text-sm text-gray-600","data-testid":`catalog-item-card-meta-${e??""}`,children:l.map((S,_)=>t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(P,{icon:S.icon,className:"size-4 text-gray-400",width:16}),t.jsx("span",{children:S.label})]},`${S.label}-${_}`))}):null,($||N)&&t.jsxs("div",{className:c.cn("flex items-center justify-end gap-2 pt-1 text-sm",g?"pt-0.5":"",v),children:[$?t.jsxs("span",{className:c.cn("mr-auto text-gray-500",g?"text-xs":""),"data-testid":`catalog-item-card-price-${e??""}`,children:[d?.label&&t.jsxs("span",{children:[d.label," "]}),t.jsx("span",{className:"font-semibold text-brand",children:d?.value})]}):t.jsx("span",{className:"ml-auto","aria-hidden":!0}),N&&k?t.jsx(O,{className:c.cn("rounded-full",u?.className),onPress:u?.onPress,variant:C?.variant,color:C?.color,size:C?.size,startContent:C?.startContent,isDisabled:C?.isDisabled,"aria-label":u?.ariaLabel||u?.label,children:u?.label}):null]}),f?t.jsx("div",{className:"pt-1",children:f}):null]})]})};Xi.displayName="CatalogItemCard";const Sf={open:"Open","selling-fast":"Selling fast","sold-out":"Sold out"};function Ji({title:e,subtitle:n,price:s,imageUrl:a,status:r,isDisabled:i=!1,onPress:o,className:l}){return t.jsx(c.Card,{isPressable:!!o,isDisabled:i,onPress:o,shadow:"none",radius:"lg",className:c.cn("w-full border border-pos-hair",l),children:t.jsxs(c.CardBody,{className:"flex-row items-center gap-5 p-4",children:[t.jsx("div",{className:"grid size-[4.875rem] shrink-0 place-items-center overflow-hidden rounded-xl bg-default-100 text-default-500",children:a?t.jsx(c.Image,{removeWrapper:!0,src:a,alt:"",className:"size-full object-cover"}):t.jsx(P,{icon:"solar:ticket-outline",width:28})}),t.jsxs("div",{className:"min-w-0 flex-1",children:[t.jsx("h3",{className:"truncate text-lg font-semibold text-foreground",children:e}),t.jsx("p",{className:"mt-1 text-base text-default-500",children:n})]}),r?t.jsx("span",{"data-status":r,className:"rounded-full bg-default-100 px-3 py-1 text-sm font-medium text-default-600",children:Sf[r]}):null,s?t.jsxs("strong",{className:"ml-5 whitespace-nowrap text-xl",children:["from ",s]}):null]})})}Ji.displayName="ProgramListItem";const $f={card:"gap-3 rounded-xl border border-dashed px-6 py-12",panel:"px-6 py-[72px]"},Af={card:"size-12 rounded-2xl",panel:"size-[76px] rounded-[20px] border mb-[18px]"},Ef={card:"text-base font-medium text-default-900",panel:"text-[17px] font-semibold text-acct-ink"},Df={card:"max-w-sm text-sm text-default-600",panel:"max-w-[380px] text-sm text-acct-sub mt-1.5"},Lf={card:"text-xs text-default-500",panel:"text-xs text-acct-sub mt-2"},Ff={card:"mt-1",panel:"mt-[22px]"},Rf="bg-acct-page border-acct-border text-acct-muted",_f={empty:"solar:inbox-line-duotone",error:"solar:danger-triangle-outline",success:"solar:check-circle-bold"},Mf={empty:"border-default-200 bg-white",error:"border-danger-200 bg-white",success:"border-success-100 bg-success-50/40",loading:"border-default-200 bg-white"},Pf={empty:"bg-default-100 text-default-400",error:"bg-danger-50 text-danger-600",success:"bg-success-100 text-success-700",loading:"bg-primary-50 text-primary"},Tf={empty:"status",error:"alert",success:"status",loading:"status"},If={empty:"polite",error:"assertive",success:"polite",loading:"polite"};function Of(e,n,s,a){if(n===!1)return null;if(e==="loading"&&n===void 0)return t.jsx(c.Spinner,{size:"lg",color:"primary",className:a.spinner});if(h.isValidElement(n))return t.jsx(t.Fragment,{children:n});const r=typeof n=="string"?n:_f[e];return r?t.jsx(P,{icon:r,width:s,height:s,"aria-hidden":"true",className:a.icon}):null}function el({variant:e="empty",surface:n="card",title:s,titleAs:a="p",description:r,icon:i,actions:o,role:l=Tf[e],ariaLive:d=If[e],iconSize:u=24,className:f,classNames:m={},"data-testid":p="feedback-state",referenceCode:x,referenceCodeLabel:g="Reference code:"}){const y=Of(e,i,u,m);return t.jsxs("div",{role:l,"aria-live":d,"data-variant":e,"data-testid":p,"data-surface":n,className:c.cn("flex flex-col items-center justify-center text-center",$f[n],n==="card"?Mf[e]:"bg-transparent",f,m.base),children:[y?t.jsx("span",{"aria-hidden":"true","data-testid":`${p}-icon`,className:c.cn("inline-flex items-center justify-center",Af[n],e==="success"&&n==="card"&&"rounded-full",n==="panel"?Rf:Pf[e],m.iconWrapper),children:y}):null,t.jsxs("div",{className:c.cn("flex flex-col items-center",n==="card"&&"gap-1"),children:[t.jsx(a,{"data-testid":`${p}-title`,className:c.cn(Ef[n],m.title),children:s}),r?t.jsx("p",{"data-testid":`${p}-description`,className:c.cn(Df[n],m.description),children:r}):null,x?t.jsxs("p",{"data-testid":`${p}-reference-code`,className:c.cn(Lf[n],m.referenceCode),children:[g," ",t.jsx("span",{className:"select-all font-mono",children:x})]}):null]}),o?t.jsx("div",{"data-testid":`${p}-actions`,className:c.cn("flex flex-wrap items-center justify-center gap-2",Ff[n],m.actions),children:o}):null]})}function Zt(e){return t.jsx(el,{...e})}function Ws(e){return t.jsx(Zt,{...e,variant:"empty"})}function qs(e){return t.jsx(el,{...e,variant:"error"})}function Gs(e){return t.jsx(Zt,{...e,variant:"loading"})}function tl(e){return t.jsx(Zt,{...e,variant:"success"})}Zt.displayName="FeedbackState";Ws.displayName="EmptyState";qs.displayName="ErrorState";Gs.displayName="LoadingState";tl.displayName="SuccessState";const nl=({title:e,value:n,description:s,onValueChange:a,className:r=""})=>{const i=h.useId();return t.jsxs("div",{className:c.cn("w-full flex flex-row items-center",e||s?"justify-between gap-6":"justify-start",r),"data-testid":"toggle",children:[t.jsxs("div",{className:"flex flex-col items-start",children:[e&&t.jsx("label",{htmlFor:i,className:"font-medium text-left","data-testid":"toggle-title",children:e}),s&&t.jsx("p",{className:"text-left text-gray-500","data-testid":"toggle-description",children:s})]}),t.jsx(c.Switch,{id:i,isSelected:n,onValueChange:a,"data-testid":"toggle-switch"})]})},zf={ticketSelectionTitle:"Choose tickets to be upgraded",ticketsAllowedToRedeem:"Tickets allowed to redeem:",ticketsSelectedToRedeem:"Tickets selected to redeem",noUpgradeTicketsAvailable:"No upgrade tickets available to select",selectAllButtonLabel:"Select All"},Bf=(e,n)=>new Intl.NumberFormat(e,{style:"currency",currency:n}),sl=e=>Object.values(e).reduce((n,s)=>n+Object.values(s).reduce((a,r)=>a+Object.values(r).reduce((i,o)=>i+o.selectedQuantity,0),0),0),Vf=e=>e.reduce((n,s)=>n+s.dates.reduce((a,r)=>a+r.tickets.reduce((i,o)=>i+o.max,0),0),0),Ks=e=>e.flatMap(n=>n.dates.flatMap(s=>s.tickets.map(a=>({exhibition:n,dateGroup:s,ticket:a})))),ar=(e,n,s)=>{const a={};let r=s?n??Vf(e):0;for(const{exhibition:i,dateGroup:o,ticket:l}of Ks(e)){a[i.id]??={},a[i.id][o.id]??={};const d=s?Math.min(l.max,r):0;a[i.id][o.id][l.id]={id:l.id,selectedQuantity:d,originalPrice:l.originalPrice,discountedPrice:l.price},r-=d}return a},rr=(e,n,s)=>`${e}::${n}::${s}`,Uf=(e,n,s)=>{const a=sl(n);for(const{exhibition:r,dateGroup:i,ticket:o}of Ks(e)){const l=n[r.id]?.[i.id]?.[o.id]?.selectedQuantity??0,d=s===void 0?o.max:Math.min(o.max,s-(a-l));if(d>0&&l<d)return!1}return!0},Hf=({initialQuantity:e=1,minQuantity:n=1,maxQuantity:s=10,onChange:a,disabled:r=!1})=>{const i=Math.max(n,Math.min(s,e)),[o,l]=h.useState(()=>String(i)),[d,u]=h.useState(!1),f=d?o:String(i),m=()=>{r||i>=s||a?.(i+1)},p=()=>{r||i<=n||a?.(i-1)},x=N=>{if(r)return;l(N.target.value);const A=parseInt(N.target.value,10);isNaN(A)||a?.(Math.max(n,Math.min(s,A)))},g=N=>{const A=parseInt(N.target.value,10);if(u(!1),isNaN(A)){a?.(n);return}const k=Math.max(n,Math.min(s,A));k!==A?a?.(k):l(String(k))},y=i<=n,b=i>=s,v="w-10 h-10 flex items-center justify-center border-0 rounded-full cursor-pointer transition-colors duration-150 text-white text-2xl font-regular",w="bg-primary hover:bg-primary/80",$="bg-primary/40 cursor-not-allowed";return t.jsxs("div",{className:"flex items-center gap-4","data-testid":"quantity-selector",children:[t.jsx("button",{type:"button",onClick:p,disabled:r||y,className:c.cn(v,r||y?$:w),"aria-label":"Decrement quantity","data-testid":"quantity-decrement",children:"-"}),t.jsx("input",{type:"number",value:f,onChange:x,onFocus:()=>u(!0),onBlur:g,disabled:r,min:n,max:s,step:"1",className:"w-12 h-10 rounded-md border-0 bg-zinc-100 text-center text-2xl font-medium text-zinc-900 [appearance:textfield] [&::-webkit-inner-spin-button]:appearance-none [&::-webkit-outer-spin-button]:appearance-none","aria-label":`Selected quantity: ${i}`,"data-testid":"quantity-input"}),t.jsx("button",{type:"button",onClick:m,disabled:r||b,className:c.cn(v,r||b?$:w),"aria-label":"Increment quantity","data-testid":"quantity-increment",children:"+"})]})},Wf=({label:e,checked:n=!1,onChange:s,disabled:a=!1})=>{const r=()=>{a||s?.(!n)};return t.jsxs("button",{type:"button",onClick:r,disabled:a,role:"checkbox","aria-checked":n,"data-testid":"checkbox-button","data-checked":n,className:c.cn("flex items-center gap-1.5 px-4 py-3 border-0 rounded-full cursor-pointer text-sm min-h-[30px]","outline-none select-none transition-colors bg-zinc-100 hover:bg-zinc-200 text-primary",a&&"cursor-not-allowed opacity-60"),children:[t.jsxs("span",{className:"relative flex items-center justify-center w-5 h-5 flex-shrink-0",children:[t.jsx("input",{type:"checkbox",checked:n,onChange:()=>{},disabled:a,className:"absolute opacity-0 w-0 h-0 pointer-events-none",tabIndex:-1,readOnly:!0}),t.jsx("span",{className:c.cn("block w-3.5 h-3.5 rounded-sm relative",n?"bg-primary":"bg-white ring-1 ring-zinc-300"),children:n&&t.jsx("span",{className:"absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-[60%] rotate-45 w-[3px] h-[5px] border border-white border-t-0 border-l-0","aria-hidden":"true"})})]}),t.jsx("p",{className:"flex-1 m-0 text-left leading-snug",children:e})]})},qf=({item:e,quantity:n,onChange:s,getTotalSelectedTickets:a,userMaxLimit:r,settings:i,labels:o})=>{const l=()=>{if(!a||r===void 0)return e.max;const m=a();return Math.min(e.max,r-(m-n))},d=i?.locale??"en-US",u=i?.currency??"USD",f=Bf(d,u);return t.jsxs("div",{children:[t.jsxs("div",{className:"flex items-center justify-between bg-white px-3 py-2.5 gap-8","data-testid":"upgrade-ticket-item",children:[t.jsxs("div",{className:"min-w-0 flex flex-1 flex-col gap-2",children:[t.jsxs("div",{className:"flex min-w-0 items-start gap-3",children:[t.jsxs("h3",{className:"min-w-0 text-base font-semibold text-zinc-900 m-0","data-testid":"ticket-name",children:[e.name,typeof e.purchasedQuantity=="number"&&e.purchasedQuantity>1?t.jsx("span",{"data-testid":"ticket-purchased-quantity",children:` x${e.purchasedQuantity}`}):null]}),t.jsxs("div",{className:"flex shrink-0 items-center gap-1.5",children:[t.jsx("h3",{className:"line-through text-zinc-500 text-[0.9rem] font-normal m-0","data-testid":"ticket-original-price",children:f.format(e.originalPrice)}),t.jsx("h3",{className:"text-base font-semibold text-zinc-900 m-0","data-testid":"ticket-discounted-price",children:f.format(e.price)})]})]}),e.membershipName?t.jsx("div",{"data-testid":"ticket-membership-name",className:"max-w-full self-start rounded-2xl bg-default-100 px-3 py-1 text-xs text-default-700",title:e.membershipName,children:t.jsx("p",{className:"max-w-full truncate text-center",children:e.membershipName})}):null,t.jsx("div",{className:"text-sm text-zinc-500",children:t.jsxs("p",{className:"m-0","data-testid":"ticket-max",children:[o.ticketsAllowedToRedeem," ",e.max]})})]}),t.jsx(Hf,{initialQuantity:n,minQuantity:0,maxQuantity:l(),onChange:s})]}),e.membershipAlert?t.jsx(c.Alert,{"data-testid":"ticket-membership-alert",color:"warning",variant:"flat",radius:"full",className:"ticket-selection-membership-alert mb-2 w-full max-w-full py-0 shadow-none",classNames:{base:"ticket-selection-membership-alert-base !min-h-8 !items-center !bg-[#F5CB24]/15 !text-[#5B2C0F] shadow-none",mainWrapper:"ticket-selection-membership-alert-main-wrapper m-0 min-h-8 !py-0 !px-0",alertIcon:"ticket-selection-membership-alert-icon w-4 h-4 !text-[#5B2C0F]",iconWrapper:"ticket-selection-membership-alert-icon-wrapper !min-w-0 !bg-transparent !border-none !shadow-none !rounded-none !p-0 !m-0 !w-4 !h-4",description:"ticket-selection-membership-alert-description !ms-2 !my-2 !text-[#5B2C0F]"},description:t.jsx("span",{className:"ticket-selection-membership-alert-description-text block w-full whitespace-normal break-words text-sm leading-4 text-[#5B2C0F]",children:e.membershipAlert})}):null]})},Gf=({exhibitionId:e,dateGroup:n,isLast:s=!1,onQuantityChange:a,getTicketQuantity:r,getTotalSelectedTickets:i,userMaxLimit:o,settings:l,labels:d})=>t.jsxs("div",{className:c.cn("flex flex-col gap-2 pb-3",!s&&"border-b border-zinc-200"),"data-testid":"upgrade-ticket-date-group",children:[t.jsx("p",{className:"m-0 text-sm text-left text-zinc-500","data-testid":"upgrade-ticket-date",children:n.date}),n.tickets.map((u,f)=>t.jsxs("div",{children:[t.jsx(qf,{item:u,quantity:r(e,n.id,u.id),onChange:m=>a(e,n.id,u.id,m),getTotalSelectedTickets:i,userMaxLimit:o,settings:l,labels:d}),f<n.tickets.length-1?t.jsx(c.Divider,{className:"bg-zinc-200","data-testid":"upgrade-ticket-divider"}):null]},u.id))]}),Kf=({title:e,exhibition:n,onQuantityChange:s,getTicketQuantity:a,getTotalSelectedTickets:r,userMaxLimit:i,settings:o,labels:l,initialExpanded:d=!1})=>{const[u,f]=h.useState(d),m=n.dates.reduce((x,g)=>x+g.tickets.reduce((y,b)=>y+a(n.id,g.id,b.id),0),0),p=n.dates.some(x=>x.tickets.length>0);return t.jsxs("div",{className:"w-full overflow-hidden border-b border-zinc-200","data-testid":"upgrade-ticket-header",children:[t.jsx("button",{type:"button",className:"flex items-center w-full px-5 py-4 border-0 cursor-pointer transition-all bg-white hover:bg-zinc-100",onClick:()=>f(!u),"aria-expanded":u,"aria-controls":`upgrade-items-${n.id}`,"data-testid":"upgrade-ticket-header-button",children:t.jsxs("div",{className:"flex justify-between items-center w-full gap-6",children:[t.jsx("h4",{className:"m-0 text-base font-semibold text-left text-zinc-900","data-testid":"upgrade-ticket-header-title",children:e}),t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsxs("p",{className:"m-0 text-sm text-right text-zinc-500","data-testid":"upgrade-ticket-header-count",children:[m," ",l.ticketsSelectedToRedeem]}),t.jsx("span",{className:c.cn("inline-flex items-center justify-center text-zinc-500 text-xl transition-transform duration-200",u&&"rotate-180"),"aria-hidden":"true",children:t.jsx(P,{icon:"mdi:chevron-down"})})]})]})}),t.jsx("div",{id:`upgrade-items-${n.id}`,className:c.cn("transition-all duration-300 overflow-hidden",u?"max-h-[1000px] opacity-100":"max-h-0 opacity-0"),"aria-hidden":!u,children:u&&t.jsx("div",{className:"px-5 flex flex-col gap-6","data-testid":"upgrade-ticket-items",children:p?n.dates.map((x,g)=>t.jsx(Gf,{exhibitionId:n.id,dateGroup:x,isLast:g===n.dates.length-1,onQuantityChange:s,getTicketQuantity:a,getTotalSelectedTickets:r,userMaxLimit:i,settings:o,labels:l},x.id)):t.jsx("div",{className:"px-5 py-10 text-center",children:t.jsx("p",{className:"m-0 text-zinc-500 italic",children:l.noUpgradeTicketsAvailable})})})})]})},Yf=({initialExpanded:e=!1,userMaxLimit:n,labels:s,settings:a,ticketSelectionData:r,className:i="",onSelectionChange:o})=>{const l=h.useMemo(()=>r??[],[r]),d={...zf,...s},[u,f]=h.useState(()=>ar(l,n,!0)),m=h.useRef(!1),p=h.useMemo(()=>{const w=Ks(l).map(({exhibition:$,dateGroup:N,ticket:A})=>[rr($.id,N.id,A.id),A]);return new Map(w)},[l]),x=Uf(l,u,n),g=(w,$,N)=>u[w]?.[$]?.[N]?.selectedQuantity??0,y=()=>sl(u),b=(w,$,N,A)=>{const k=g(w,$,N),C=y()-k;if(n!==void 0&&C+A>n)return;const E=p.get(rr(w,$,N));if(!E)return;const S={...u,[w]:{...u[w],[$]:{...u[w]?.[$],[N]:{id:N,selectedQuantity:A,originalPrice:E.originalPrice,discountedPrice:E.price}}}};f(S),o?.(S)},v=w=>{const $=ar(l,n,w);f($),o?.($)};return h.useEffect(()=>{!m.current&&x&&(o?.(u),m.current=!0)},[x,u,o]),t.jsxs("div",{className:c.cn("flex flex-col w-full font-sans",i),"data-testid":"ticket-selection",children:[t.jsxs("div",{className:"flex items-center justify-between py-2 gap-4","data-testid":"ticket-selection-header",children:[t.jsx("h3",{className:"text-xl font-semibold m-0","data-testid":"ticket-selection-title",children:d.ticketSelectionTitle}),t.jsx(Wf,{label:d.selectAllButtonLabel,checked:x,onChange:v})]}),l.map(w=>t.jsx(Kf,{title:w.exhibitionName,exhibition:w,onQuantityChange:b,getTicketQuantity:g,getTotalSelectedTickets:y,userMaxLimit:n,settings:a,labels:d,initialExpanded:e},w.id))]})},es={confirm:"Confirm",clear:"Clear",noLabel:"Filters"},ts=e=>{const n={};for(const s of e)s.type==="checkbox"?n[s.id]=[...s.selectedValues]:n[s.id]=s.selectedValue?[s.selectedValue]:[];return n},Qf=(e,n)=>{const s={};for(const a of n){if(a.type==="checkbox"){s[a.id]=e[a.id]??[...a.selectedValues];continue}const r=e[a.id]??[];s[a.id]=r.length>0?r[0]:null}return s},Zf=e=>e.type==="checkbox"?e.selectedValues.length>0:e.selectedValue!==null,al=({triggerLabel:e,triggerAriaLabel:n,triggerIcon:s="solar:tuning-square-outline",triggerVariant:a="bordered",triggerColor:r="default",triggerSize:i="sm",triggerClassName:o,popoverClassName:l,className:d,sections:u,onConfirm:f,onClear:m,appliedCount:p,countAriaLabel:x,countDisplay:g="badge",confirmLabel:y=es.confirm,clearLabel:b=es.clear,isOpen:v,defaultOpen:w=!1,onOpenChange:$,isDisabled:N=!1,closeOnConfirm:A=!0,keepOpenAfterClear:k=!1})=>{const[C,E]=h.useState(w),[S,_]=h.useState(()=>ts(u)),F=v??C,L=p??u.filter(Y=>Zf(Y)).length,M=Y=>{Y&&_(ts(u)),v||E(Y),$?.(Y)},I=(Y,oe)=>{_(J=>({...J,[Y.id]:oe}))},W=(Y,oe)=>{_(J=>({...J,[Y.id]:oe?[oe]:[]}))},K=async()=>{_(ts(u.map(Y=>Y.type==="checkbox"?{...Y,selectedValues:[]}:{...Y,selectedValue:null}))),await m(),k||M(!1)},z=async()=>{const Y=Qf(S,u);await f(Y),A&&M(!1)},ne=Y=>{if(Y.type==="checkbox")return t.jsx(c.CheckboxGroup,{label:Y.label,value:S[Y.id]??[],onValueChange:J=>I(Y,J),children:Y.options.map(J=>t.jsx(c.Checkbox,{value:J.value,isDisabled:J.isDisabled,children:J.label},J.value))},Y.id);const oe=S[Y.id]?.[0]??"";return t.jsx(c.RadioGroup,{label:Y.label,value:oe,onValueChange:J=>W(Y,J||null),children:Y.options.map(J=>t.jsx(c.Radio,{value:J.value,isDisabled:J.isDisabled,children:J.label},J.value))},Y.id)},G=h.useMemo(()=>L>0?x?.(L)||`${L} filters applied`:void 0,[x,L]),se=h.useMemo(()=>L===0?e||es.noLabel:x?x(L):`${e} (${L})`,[L,e,x]);return t.jsx("div",{className:d,children:t.jsxs(c.Popover,{isOpen:F,onOpenChange:M,placement:"bottom-end",children:[t.jsx(c.PopoverTrigger,{children:t.jsxs(O,{isDisabled:N,variant:a,color:r,size:i,className:o,"aria-label":n,"aria-haspopup":"dialog","aria-expanded":F,children:[t.jsx(P,{icon:s,width:16}),t.jsx("span",{children:e}),g==="badge"&&L>0?t.jsx("span",{className:"ml-1 inline-flex h-5 min-w-5 items-center justify-center rounded-full bg-gray-900 px-1.5 text-xs font-medium text-white","aria-label":G,children:L}):g==="summary"&&se!==e?t.jsx("span",{className:"text-xs",children:se}):null]})}),t.jsx(c.PopoverContent,{className:l,children:t.jsxs("div",{className:"flex w-full flex-col gap-5 px-4 py-4",children:[u.map(Y=>ne(Y)),t.jsxs("div",{className:"flex items-center justify-end gap-2 border-t border-gray-200 pt-3",children:[t.jsx(O,{variant:"light",color:"default",size:"sm",onPress:K,children:b}),t.jsx(O,{color:"primary",size:"sm",onPress:z,children:y})]})]})})]})})};al.displayName="FilterPopover";const Xf="No sessions available for this date",Jf=e=>e==="sold-out"||e==="closed"?"danger":"success",ex=e=>{const n=e.seatsRemaining;return e.status==="sold-out"||e.status==="closed"?"Sold out":e.status==="limited"?typeof n=="number"?`${n} left`:"Limited":typeof n=="number"?`${n} seats available`:"Available"},ir=e=>e.isDisabled?!0:e.status==="sold-out"||e.status==="closed",tx=(e,n)=>n&&e.some(s=>s.date===n)?n:e[0]?.date??null,rl=({heading:e,subheading:n,days:s,selectedDate:a,onDateSelect:r,quickDates:i,selectedSessionId:o=null,onSessionSelect:l,emptyStateMessage:d=Xf,statusLabel:u,statusTone:f,sessionAriaLabel:m,dayButtonClassName:p,calendarSlot:x,dayGroupAriaLabel:g,sessionGridAriaLabel:y,className:b,headingClassName:v,subheadingClassName:w})=>{const $=tx(s,a),N=s.find(S=>S.date===$),A=i??s.map(S=>({date:S.date,label:S.label})),k=N?.sessions??[],C=S=>S===$?"solid":"bordered",E=S=>{if(!ir(S)){if(S.id===o){l(null);return}l(S.id)}};return t.jsxs("section",{className:c.cn("flex flex-col gap-4 rounded-xl bg-white p-3 sm:p-4",b),"data-testid":"session-timeline-root",children:[t.jsxs("header",{className:"flex flex-col gap-1",children:[t.jsx("h2",{className:c.cn("text-base font-semibold text-gray-900",v),children:e}),n?t.jsx("p",{className:c.cn("text-sm text-gray-700",w),children:n}):null]}),t.jsxs("div",{className:"flex flex-wrap items-center gap-2",role:"group","aria-label":g||"Session days",children:[A.map(S=>t.jsx(O,{size:"sm",variant:C(S.date),color:"default",className:c.cn("rounded-full",p),isDisabled:S.isDisabled,onPress:()=>{r(S.date)},children:t.jsx("span",{children:S.label})},S.date)),x?t.jsx("div",{children:x}):null]}),t.jsxs("ul",{className:"grid grid-cols-1 gap-2 sm:grid-cols-3","aria-label":y||"Sessions",children:[k.length===0?t.jsx("li",{className:"rounded-lg bg-white px-4 py-6 text-center text-sm text-gray-600 sm:col-span-3",children:d}):null,k.map(S=>{const _=ir(S),F=S.id===o;return t.jsx("li",{className:"rounded-xl",children:t.jsx(c.Card,{shadow:"sm",radius:"lg",isPressable:!_,onPress:()=>{E(S)},"aria-disabled":_,"aria-pressed":_?void 0:F,className:c.cn("w-full",_?"bg-gray-100 opacity-70":"",F?"w-full ring-2 ring-gray-900":""),"aria-label":m?m(S,{isSelected:F,isUnavailable:_}):_?`${S.startTime} ${S.endTime} sold out`:`${S.startTime} ${S.endTime} available`,children:t.jsxs(c.CardBody,{className:"flex flex-col items-center gap-3 p-4 text-center",children:[t.jsxs("span",{className:"text-sm font-semibold text-gray-900",children:[S.startTime," – ",S.endTime]}),t.jsx(c.Chip,{size:"sm",color:f?f(S):Jf(S.status),variant:"flat",children:u?u(S):ex(S)})]})})},S.id)})]})]})};rl.displayName="SessionTimeline";const gs=16,it=e=>`${e/gs}rem`;function nx(){if(typeof document>"u"||typeof getComputedStyle!="function")return gs;const e=parseFloat(getComputedStyle(document.documentElement).fontSize);return Number.isFinite(e)&&e>0?e:gs}const Xt=(e,n)=>e>=n*nx(),sx=1120;function Lt(){const e=h.useRef(null),[n,s]=h.useState(0),[,a]=h.useState("");return h.useLayoutEffect(()=>{const r=e.current;if(!r||typeof ResizeObserver>"u")return;const i=new ResizeObserver(o=>{const l=o[o.length-1];l&&s(l.borderBoxSize?.[0]?.inlineSize??l.contentRect.width)});return s(r.getBoundingClientRect().width),i.observe(r),()=>i.disconnect()},[]),h.useEffect(()=>{if(typeof MutationObserver>"u")return;const r=document.documentElement,i=new MutationObserver(()=>a(getComputedStyle(r).fontSize));return i.observe(r,{attributes:!0,attributeFilter:["style","class"]}),()=>i.disconnect()},[]),{ref:e,width:n}}const ax=48,Ke={base:"flex items-start gap-4",baseWide:"mb-5 flex-nowrap",baseNarrow:"mb-[0.875rem] flex-wrap",identity:"flex min-w-0 items-center gap-4",text:"min-w-0",titleWide:"text-[1.6875rem] font-semibold leading-[1.5] tracking-[-.02em] text-default-900",titleNarrow:"text-[1.375rem] font-semibold leading-[1.5] tracking-[-.02em] text-default-900",subtitleWide:"mt-[0.4375rem] max-w-[47.5rem] text-[0.875rem] leading-[1.55] text-default-500",subtitleNarrow:"mt-[0.4375rem] max-w-[47.5rem] text-[0.84375rem] leading-[1.55] text-default-500",actionsWide:"ml-auto flex shrink-0 items-center gap-2.5",actionsNarrow:"flex shrink-0 items-center gap-2.5"},rx=(e,n)=>typeof e=="string"?t.jsx(P,{icon:e,className:"size-5","aria-hidden":"true"}):e||n||null,il=({title:e,subtitle:n,eyebrow:s,icon:a,initials:r,actions:i,titleAs:o="h1",className:l,classNames:d={},"data-testid":u="page-header",list:f,narrow:m,headerRef:p})=>{const x=rx(a,r);return t.jsxs("header",{ref:p,"data-testid":u,"data-variant":f?"list":void 0,"data-size":f?m?"narrow":"wide":void 0,className:c.cn(f?c.cn(Ke.base,m?Ke.baseNarrow:Ke.baseWide):"flex flex-wrap items-start justify-between gap-4",l,d.base),children:[t.jsxs("div",{className:f?Ke.identity:"flex items-center gap-4",children:[x?t.jsx("div",{"aria-hidden":"true","data-testid":`${u}-icon`,className:c.cn("flex size-12 shrink-0 items-center justify-center rounded-xl bg-gray-900 text-sm font-semibold text-white",d.iconWrapper),children:x}):null,t.jsxs("div",{className:f?Ke.text:void 0,children:[s?t.jsx("p",{"data-testid":`${u}-eyebrow`,className:c.cn("text-brand text-sm font-medium uppercase tracking-wide",d.eyebrow),children:s}):null,t.jsx(o,{"data-testid":`${u}-title`,className:c.cn(f?m?Ke.titleNarrow:Ke.titleWide:"text-3xl font-semibold text-gray-950",d.title),children:e}),n?t.jsx("p",{"data-testid":`${u}-subtitle`,className:c.cn(f?m?Ke.subtitleNarrow:Ke.subtitleWide:"mt-1 text-sm text-gray-600",d.subtitle),children:n}):null]})]}),i?t.jsx("div",{"data-testid":`${u}-actions`,className:c.cn(f?m?Ke.actionsNarrow:Ke.actionsWide:"flex flex-wrap items-center gap-2",d.actions),children:i}):null]})},ix=e=>{const{ref:n,width:s}=Lt(),a=s>0&&!Xt(s,ax);return t.jsx(il,{...e,list:!0,narrow:a,headerRef:n})},ll=e=>e.variant==="list"?t.jsx(ix,{...e}):t.jsx(il,{...e,list:!1,narrow:!1});ll.displayName="PageHeader";const He={ok:{fg:le.ok,bg:le["ok-fill"]},warn:{fg:le.warn,bg:le["warn-fill"]},danger:{fg:le.danger,bg:le["danger-fill"]},info:{fg:le.info,bg:le["info-fill"]},violet:{fg:le.violet,bg:le["violet-fill"]},neutral:{fg:le.neutral,bg:le["neutral-fill"]}};function Jt(e){if(e==="positive")return{color:le.ok};if(e==="negative")return{color:le.danger}}const lx={active:"success",success:"success",draft:"warning",pending:"warning",warning:"warning",danger:"danger",archived:"default",inactive:"default",neutral:"default",info:"default",violet:"default"},ys={active:{fg:"#057A54",bg:"#E6F4EF"},success:{fg:"#057A54",bg:"#E6F4EF"},draft:{fg:"#B7791F",bg:"#FBF0DD"},pending:{fg:"#B7791F",bg:"#FBF0DD"},warning:{fg:"#B7791F",bg:"#FBF0DD"},danger:{fg:"#B62214",bg:"#FBEAE8"},archived:{fg:"#9CA3AF",bg:"#F1F2F4"},inactive:{fg:"#9CA3AF",bg:"#F1F2F4"},neutral:{fg:"#9CA3AF",bg:"#F1F2F4"},info:He.info,violet:He.violet},ox={active:"ok",success:"ok",draft:"warn",pending:"warn",warning:"warn",danger:"danger",archived:"neutral",inactive:"neutral",neutral:"neutral",info:"info",violet:"violet"},cx={sm:"px-[0.5625rem] py-[0.1875rem] text-[0.75rem]",md:"px-3 py-[0.3125rem] text-[0.8125rem]",lg:"px-3 py-[0.3125rem] text-[0.8125rem]"},dx={info:ys.info,violet:ys.violet},ol=({status:e,label:n,variant:s="flat",size:a="sm",color:r,startContent:i,className:o,"data-testid":l="status-chip"})=>{if(s==="plain"){const u=He[ox[e]];return t.jsxs("span",{"data-testid":l,"data-status":e,"data-variant":"plain",className:c.cn("inline-flex items-center gap-1.5 whitespace-nowrap rounded-full font-normal",cx[a],"leading-[1.35]",o),style:{color:u.fg,backgroundColor:u.bg},children:[i,n]})}if(s==="dot"){const u=ys[e];return t.jsxs("span",{"data-testid":l,"data-status":e,className:c.cn("inline-flex items-center gap-1.5 whitespace-nowrap rounded-full px-2.5 py-[3px] text-[12px] font-semibold leading-[1.4]",o),style:{color:u.fg,backgroundColor:u.bg},children:[t.jsx("span",{"aria-hidden":"true",className:"size-1.5 shrink-0 rounded-full",style:{backgroundColor:"currentColor"}}),n]})}const d=r?void 0:dx[e];return t.jsx(c.Chip,{color:r??lx[e],variant:s,size:a,startContent:i,"data-testid":l,"data-status":e,className:c.cn("font-medium",o),style:d?{color:d.fg,backgroundColor:d.bg}:void 0,children:n})};ol.displayName="StatusChip";const ux={sm:"gap-1 rounded-md px-2 py-0.5 text-[11.5px] leading-normal",md:"gap-1.5 rounded-lg px-2.5 py-1 text-xs leading-normal"},sn={base:"inline-flex items-baseline gap-1 whitespace-nowrap rounded-[0.4375rem] border border-pos-hair bg-default-100",sm:"px-2 py-0.5 text-[0.75rem] leading-[1.5]",md:"px-2.5 py-1 text-[0.8125rem] leading-[1.5]",label:"font-normal text-default-600",value:"font-semibold text-default-900"},Fn=({label:e,value:n,size:s="sm",variant:a="default",className:r,"data-testid":i="key-value-chip"})=>a==="record"?t.jsxs("span",{"data-testid":i,"data-variant":"record",className:c.cn(sn.base,sn[s],r),children:[t.jsx("span",{className:sn.label,children:e}),t.jsx("span",{className:sn.value,children:n})]}):t.jsxs("span",{"data-testid":i,className:c.cn("inline-flex items-baseline whitespace-nowrap border border-default-200 bg-default-100",ux[s],r),children:[t.jsx("span",{className:"font-medium text-default-400",children:e}),t.jsx("span",{className:"font-semibold text-default-700",children:n})]});Fn.displayName="KeyValueChip";const cl=({columns:e,rows:n=6,label:s="Loading",barHeight:a=12,alignLastRight:r=!1,appearance:i="pulse",className:o,classNames:l={},"data-testid":d="table-skeleton"})=>t.jsxs("div",{role:"status","aria-busy":"true","data-testid":d,className:c.cn("w-full",o,l.base),children:[t.jsx("span",{className:"sr-only",children:s}),t.jsx("div",{"aria-hidden":"true",children:Array.from({length:n}).map((u,f)=>i==="shimmer"?t.jsx("div",{"data-testid":`${d}-row`,className:c.cn("flex items-center border-b border-pos-hair",l.row),children:e.map((m,p)=>{const x=p===e.length-1;return t.jsx("div",{className:c.cn("min-w-0 flex-1 px-4 py-5",r&&x&&"flex justify-end"),children:t.jsx("div",{className:c.cn(on,l.bar),style:{height:it(a),width:m==="fill"?"60%":it(m),maxWidth:"100%"}})},p)})},f):t.jsx("div",{"data-testid":`${d}-row`,className:c.cn("flex items-center gap-3 border-t border-default-100 px-5 py-4",l.row),children:e.map((m,p)=>{const x=p===e.length-1;return t.jsx("div",{className:c.cn(m==="fill"?"flex-1":"shrink-0",r&&x&&"flex justify-end"),style:m==="fill"?void 0:{width:m},children:t.jsx("div",{className:c.cn("animate-pulse rounded bg-default-200",l.bar),style:{height:a,width:m==="fill"?"60%":m}})},p)})},f))})]});cl.displayName="TableSkeleton";const dl="text-left text-[11px] font-semibold uppercase tracking-[.04em] text-acct-sub px-4 pt-4 pb-3 whitespace-nowrap bg-transparent",ul="px-4 text-[13.5px] text-acct-ink2 align-middle",ml="border-t border-acct-hair transition-colors duration-150 hover:bg-acct-page data-[hover=true]:bg-acct-page",fl="w-full",xl="border-t border-acct-border px-5 py-3.5",an={base:"overflow-x-auto",th:"h-auto whitespace-nowrap border-b border-pos-hair bg-transparent px-4 py-[0.875rem] text-left text-[0.6875rem] font-semibold uppercase leading-[1.5] tracking-[.055em] text-default-500 first:rounded-none last:rounded-none last:pr-3",tr:`border-t border-pos-hair transition-colors duration-[120ms] first:border-t-0 data-[focus-visible=true]:outline-offset-[-2px] [tbody>&]:hover:bg-default-50 [tbody>&]:data-[hover=true]:bg-default-50 ${ke}`,td:"h-[3.875rem] px-4 data-[focus-visible=true]:outline-offset-[-2px] py-[0.625rem] align-middle text-[0.875rem] text-default-900 last:pr-3"},pl=({columns:e,children:n,emptyContent:s,footer:a,ariaLabel:r,variant:i="default",className:o,classNames:l={},"data-testid":d="admin-table"})=>{const u=i==="framed";return t.jsxs("div",{className:c.cn(u&&an.base,o,l.base),"data-testid":d,"data-variant":u?"framed":void 0,children:[t.jsxs(_s,{"aria-label":r,removeWrapper:!0,classNames:{table:c.cn(fl,l.table),th:c.cn(u?an.th:dl,l.th),tr:c.cn(u?an.tr:ml,l.tr),td:c.cn(u?an.td:ul,l.td)},children:[t.jsx(c.TableHeader,{columns:e,children:f=>t.jsx(c.TableColumn,{align:f.align==="right"?"end":"start",width:f.width,children:f.label},f.key)}),t.jsx(c.TableBody,{emptyContent:s,children:n})]}),a?t.jsx("div",{"data-testid":`${d}-footer`,className:c.cn(!u&&xl,l.footer),children:a}):null]})};pl.displayName="AdminTable";const Tt={base:"flex flex-wrap items-center gap-3 mb-4",trailing:"ml-auto",icon:"flex text-acct-muted",inputWrapper:["h-10 min-h-10 !h-10 rounded-[11px] border border-acct-border bg-acct-surface px-3","data-[hover=true]:border-acct-rust-border","group-data-[focus=true]:border-acct-rust"].join(" "),input:"text-[13.5px] text-acct-ink"},mx={md:"w-[280px]",lg:"w-[360px]",fill:"min-w-[12.5rem] flex-1"},fx=48,tt={base:"flex flex-wrap items-center gap-2.5 border-b border-pos-hair px-4 py-[0.875rem]",narrow:"[&_[data-slot=filter-select-group]]:flex [&_[data-slot=filter-select-group]]:flex-wrap [&_[data-slot=filter-select-group]]:!max-w-none [&_[data-slot=filter-select]]:!max-w-none [&_[data-slot=filter-select]]:!min-w-[calc(50%-0.3125rem)] [&_[data-slot=filter-select]]:grow [&_[data-slot=filter-select]]:basis-[calc(50%-0.3125rem)]",searchWide:"ml-auto",searchFill:"min-w-[12.5rem] flex-1",searchNarrow:"basis-full",inputBaseNarrow:"w-full",inputWrapper:"h-[2.375rem] min-h-[2.375rem] !h-[2.375rem] rounded-[0.625rem] border border-pos-field bg-white pl-3 pr-3 shadow-none data-[hover=true]:border-pos-field group-data-[focus=true]:border-primary",innerWrapper:"gap-[0.3125rem]",input:"text-ellipsis text-[0.875rem] text-default-900 data-[has-start-content=true]:ps-0.5",icon:"flex text-default-400 [&_svg]:size-4"},lr={md:"w-[15.625rem]",lg:"w-[22.5rem]",fill:"w-full"},jn={inputWrapper:"h-12 min-h-12 !h-12",input:"text-base",icon:"[&_svg]:size-5"},or={button:"shrink-0 text-default-500",input:"[&::-webkit-search-cancel-button]:appearance-none"},cr={md:{button:"size-8 min-w-8",icon:"size-4"},lg:{button:"size-11 min-w-11",icon:"size-5"}},hl=({searchValue:e,onSearchChange:n,searchLabel:s,searchPlaceholder:a,searchClearable:r,clearLabel:i,size:o,dataTestId:l,startContent:d,classNames:u})=>{const f=h.useRef(null),m=o==="lg",p=r&&e!==""?t.jsx(O,{isIconOnly:!0,size:"sm",variant:"light",color:"default",radius:"full","aria-label":i,onPress:()=>{n(""),f.current?.focus()},className:c.cn(or.button,cr[o].button),testId:`${l}-search-clear`,children:t.jsx(P,{icon:"lucide:x","aria-hidden":"true",className:cr[o].icon})}):void 0;return t.jsx(c.Input,{ref:f,type:"search","aria-label":s,placeholder:a??s,value:e,onValueChange:n,startContent:d,endContent:p,"data-testid":`${l}-search`,variant:"bordered",radius:"none",classNames:{base:u.base,inputWrapper:c.cn(u.inputWrapper,m&&jn.inputWrapper),innerWrapper:u.innerWrapper,input:c.cn(u.input,m&&jn.input,r&&or.input)}})},xx=({searchValue:e,onSearchChange:n,searchLabel:s,searchPlaceholder:a,searchIcon:r,searchClearable:i=!1,clearLabel:o,children:l,trailing:d,searchWidth:u="md",size:f,className:m,"data-testid":p="admin-toolbar"})=>{const{ref:x,width:g}=Lt(),y=g>0&&!Xt(g,fx),b=u==="fill";return t.jsxs("div",{ref:x,role:"search","data-testid":p,"data-variant":"framed","data-size":y?"narrow":"wide",className:c.cn(tt.base,y&&tt.narrow,m),children:[l,t.jsx("div",{"data-testid":`${p}-search-slot`,className:b?tt.searchFill:y?tt.searchNarrow:tt.searchWide,children:t.jsx(hl,{searchValue:e,onSearchChange:n,searchLabel:s,searchPlaceholder:a,searchClearable:i,clearLabel:o,size:f,dataTestId:p,startContent:t.jsx("span",{"aria-hidden":"true","data-testid":`${p}-search-icon`,className:c.cn(tt.icon,f==="lg"&&jn.icon),children:r??t.jsx(P,{icon:"lucide:search"})}),classNames:{base:b?lr.fill:y?tt.inputBaseNarrow:lr[u],inputWrapper:tt.inputWrapper,innerWrapper:tt.innerWrapper,input:tt.input}})}),d]})},bl=({searchValue:e,onSearchChange:n,searchLabel:s,searchPlaceholder:a,searchIcon:r,searchClearable:i=!1,clearLabel:o="Clear search",children:l,trailing:d,searchWidth:u="md",size:f="md",variant:m="default",className:p,"data-testid":x="admin-toolbar"})=>m==="framed"?t.jsx(xx,{searchValue:e,onSearchChange:n,searchLabel:s,searchPlaceholder:a,searchIcon:r,searchClearable:i,clearLabel:o,trailing:d,searchWidth:u,size:f,className:p,"data-testid":x,children:l}):t.jsxs("div",{role:"search","data-testid":x,className:c.cn(Tt.base,p),children:[t.jsx(hl,{searchValue:e,onSearchChange:n,searchLabel:s,searchPlaceholder:a,searchClearable:i,clearLabel:o,size:f,dataTestId:x,startContent:r?t.jsx("span",{"aria-hidden":"true",className:c.cn(Tt.icon,f==="lg"&&jn.icon),children:r}):void 0,classNames:{base:mx[u],inputWrapper:Tt.inputWrapper,input:Tt.input}}),l,d?t.jsx("div",{className:Tt.trailing,children:d}):null]});bl.displayName="AdminToolbar";const px="ml-0.5 inline-flex min-w-[18px] items-center justify-center rounded-full bg-primary px-1.5 text-xs font-semibold text-primary-foreground",hx="ml-0.5 inline-flex min-w-[1.125rem] items-center justify-center rounded-full bg-primary px-1.5 text-xs font-semibold text-primary-foreground",bx="h-9 gap-1.5 rounded-full border border-gray-200 bg-white px-3.5 text-sm font-medium text-gray-700 hover:bg-gray-50 data-[pressed=true]:bg-gray-50",gl=h.forwardRef(function({icon:n,children:s,count:a,appearance:r="pill",className:i,testId:o,...l},d){return r==="outline"?t.jsxs(O,{ref:d,"data-testid":o,"data-appearance":"outline",color:"default",variant:"bordered",radius:"md",size:"md",className:c.cn("rounded-[0.75rem] font-normal",i),...l,children:[t.jsx(P,{icon:n,className:"size-4","aria-hidden":!0}),t.jsx("span",{children:s}),a!==void 0&&a>0&&t.jsx("span",{className:hx,children:a})]}):t.jsxs(O,{ref:d,"data-testid":o,variant:"light",size:"sm",className:c.cn(bx,i),...l,children:[t.jsx(P,{icon:n,className:"size-4 text-gray-500","aria-hidden":!0}),t.jsx("span",{children:s}),a!==void 0&&a>0&&t.jsx("span",{className:px,children:a})]})});gl.displayName="ToolbarButton";const dr="w-full mb-4 border-b border-pos-line",ur=["max-w-fit h-auto rounded-none border-b-2 border-transparent","data-[selected=true]:border-primary","data-[disabled=true]:opacity-40 data-[hover-unselected=true]:opacity-100",ke].join(" "),gx={md:{base:"w-full mb-6",tabList:"gap-7 w-full relative rounded-none p-0 border-b border-acct-border",cursor:"w-full bg-acct-rust",tab:`max-w-fit px-0.5 h-auto pb-3 ${ke}`,tabContent:`text-[0.9375rem] font-medium text-acct-sub group-data-[selected=true]:font-semibold group-data-[selected=true]:text-acct-rust ${ke}`},"sm-primary":{base:dr,tabList:"w-full -mb-px gap-6 rounded-none px-0.5 py-0",cursor:"hidden",tab:`${ur} px-0.5 py-2.5`,tabContent:`text-[0.84375rem] leading-4 font-medium text-pos-muted group-data-[selected=true]:text-pos-ink ${ke}`},"sm-secondary":{base:dr,tabList:"w-full -mb-px gap-0 rounded-none p-0",cursor:"hidden",tab:`${ur} px-[1.125rem] py-[0.5625rem]`,tabContent:`text-[0.8125rem] leading-4 font-semibold text-pos-muted group-data-[selected=true]:text-primary ${ke}`}},yx="data-[animated=true]:transition-none";function yl({items:e,value:n,onChange:s,ariaLabel:a,size:r="md",level:i="primary",className:o,"data-testid":l="underline-tabs"}){const d=Cn(),u=r==="sm",f=gx[u?`sm-${i}`:"md"],m=e.filter(p=>p.isDisabled).map(p=>p.key);return t.jsx(c.Tabs,{"aria-label":a,variant:"underlined",selectedKey:n,onSelectionChange:p=>s(String(p)),disabledKeys:m,disableCursorAnimation:u,"data-testid":l,"data-size":r,classNames:{...f,base:c.cn(f.base,o),cursor:c.cn(f.cursor,d&&yx),panel:"p-0"},children:e.map(p=>t.jsx(c.Tab,{title:p.label,titleValue:p.hint,"data-testid":`${l}-${p.key}`,children:p.content},p.key))})}yl.displayName="UnderlineTabs";const Ys="text-[11px] font-semibold uppercase tracking-[.04em] text-acct-muted mb-1.5",Qs="font-normal normal-case tracking-normal",vl=["h-[38px] min-h-[38px] !h-[38px] rounded-[11px] border border-acct-border bg-acct-surface px-3","data-[hover=true]:border-acct-rust-border","group-data-[focus=true]:border-acct-rust"].join(" "),jl="text-[13.5px] text-acct-ink",wl="bg-acct-page text-acct-muted cursor-default",Nl="mt-[5px] text-xs text-acct-sub",Cl="mt-[5px] text-xs text-acct-danger",kl=({children:e,suffix:n,className:s,"data-testid":a="admin-field-label"})=>t.jsxs("div",{"data-testid":a,className:c.cn(Ys,s),children:[e,n?t.jsxs("span",{className:Qs,children:[" ",n]}):null]});kl.displayName="AdminFieldLabel";const Sl=({label:e,labelSuffix:n,value:s,onChange:a,placeholder:r,disabled:i=!1,readOnly:o=!1,mono:l=!1,autoFocus:d=!1,hint:u,invalid:f=!1,className:m,"data-testid":p="admin-text-field"})=>t.jsx(c.Input,{labelPlacement:e?"outside":void 0,label:e&&n?t.jsxs(t.Fragment,{children:[e,t.jsxs("span",{className:Qs,children:[" ",n]})]}):e,value:s,placeholder:r,isDisabled:i,isReadOnly:o,autoFocus:d,isInvalid:f,description:!f&&u?u:void 0,errorMessage:f?u:void 0,onValueChange:a,"data-testid":p,variant:"bordered",radius:"none",classNames:{base:c.cn("w-full",m),label:Ys,inputWrapper:vl,input:c.cn(jl,(l||o)&&"font-mono",o&&wl),description:Nl,errorMessage:Cl}});Sl.displayName="AdminTextField";const vx={sm:"size-6 min-w-6",md:"size-[30px] min-w-[30px]"},$l=({actions:e,size:n="md",className:s,"data-testid":a="row-actions"})=>t.jsx("div",{role:"presentation","data-testid":a,className:c.cn("inline-flex gap-0.5",s),onClick:r=>r.stopPropagation(),children:e.map(r=>t.jsx(O,{isIconOnly:!0,variant:"light",radius:"sm",size:"sm",onPress:r.onPress,isDisabled:r.disabled,"aria-label":r.label,title:r.label,"data-testid":`${a}-${r.key}`,className:c.cn("text-acct-sub data-[hover=true]:bg-acct-hair",vx[n]),children:r.icon},r.key))});$l.displayName="RowActions";const Al=({children:e,placeholder:n="Select…",onOpen:s,onClear:a,ariaLabel:r,icon:i,trailingIcon:o,clearIcon:l,disabled:d=!1,className:u,"data-testid":f="picker-row"})=>{const m=e!=null;return t.jsxs("div",{"data-testid":f,className:c.cn("flex w-full min-h-10 items-center rounded-[10px] border border-acct-border bg-acct-surface px-[11px] transition-colors duration-150",d?"opacity-60":"hover:border-acct-rust-border",u),children:[t.jsxs(O,{variant:"light",radius:"none",disableAnimation:!0,onPress:s,isDisabled:d,"aria-haspopup":"dialog","aria-label":r,"data-testid":`${f}-trigger`,className:"flex h-auto min-h-0 min-w-0 flex-1 items-center justify-start gap-2.5 bg-transparent px-0 py-2 text-left text-inherit data-[hover=true]:bg-transparent",children:[i?t.jsx("span",{className:"flex shrink-0 text-acct-muted",children:i}):null,m?t.jsx("span",{className:"flex min-w-0 items-center gap-2",children:e}):t.jsx("span",{className:"text-[13.5px] font-semibold text-acct-sub",children:n}),o?t.jsx("span",{className:"ml-auto flex shrink-0 text-acct-muted",children:o}):null]}),m&&a?t.jsx(O,{isIconOnly:!0,variant:"light",radius:"sm",size:"sm",onPress:a,isDisabled:d,"aria-label":`Clear ${r}`,title:"Clear","data-testid":`${f}-clear`,className:"ml-1.5 size-6 min-w-6 shrink-0 text-acct-muted data-[hover=true]:bg-acct-hair",children:l}):null]})};Al.displayName="PickerRow";const ze={base:"relative flex w-full items-center gap-2 transition-colors",content:"flex min-w-0 flex-1 items-center gap-3 text-left",pressTarget:["static z-auto flex h-auto min-h-0 min-w-0 flex-1 items-center justify-start gap-3","overflow-visible whitespace-normal transform-none rounded-none bg-transparent px-0","text-left font-normal text-inherit no-underline","data-[hover=true]:bg-transparent data-[hover=true]:opacity-100 data-[pressed=true]:opacity-100","hover:!opacity-100 active:!opacity-100","outline-none data-[focus-visible=true]:outline-0","after:absolute after:inset-0","data-[focus-visible=true]:after:ring-2 data-[focus-visible=true]:after:ring-focus"].join(" "),text:"flex min-w-0 flex-col",titleLine:"flex min-w-0 items-center gap-2",title:"truncate font-medium text-default-900",subtitle:"truncate text-default-600",tags:"flex shrink-0 items-center gap-1",side:"relative z-10 flex shrink-0 items-center gap-1",chevron:"flex shrink-0 text-default-500",menuTrigger:"text-default-600",avatar:"shrink-0 bg-default-200 text-default-700",dangerItem:"text-danger"},jx={default:void 0,primary:"text-primary-800",success:void 0,warning:"text-warning-800",danger:void 0},wx={plain:{row:"rounded-xl px-2",hover:"hover:bg-default-100",overlay:"after:rounded-xl"},bordered:{row:"rounded-lg border border-default-200 bg-white px-3",hover:"hover:bg-default-50",overlay:"after:rounded-lg"}},El={md:{row:"min-h-12",content:"py-1",title:"text-sm leading-6",subtitle:"text-xs leading-4",avatar:"sm",control:"md"},lg:{row:"min-h-14",content:"py-1.5",title:"text-base leading-6",subtitle:"text-sm leading-5",avatar:"md",control:"lg"}},Nx={md:void 0,lg:"min-h-12 text-base"},Cx={none:"",sm:"gap-1",md:"gap-2"},Dl="m-0 flex list-none flex-col p-0",Nt={row:"flex items-center gap-3 px-2",avatar:{md:"size-8 shrink-0 rounded-full",lg:"size-10 shrink-0 rounded-full"},lines:"flex flex-col gap-2",title:"h-4 rounded-md",subtitle:"h-3 w-44 rounded-md",titleWidths:["w-32","w-28","w-36","w-24","w-40","w-28"]},Ll=h.createContext(!1),kx=()=>t.jsx("svg",{viewBox:"0 0 24 24",width:"20",height:"20",fill:"none","aria-hidden":"true",focusable:"false",children:t.jsx("path",{d:"m9 5 7 7-7 7",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),Sx=()=>t.jsxs("svg",{viewBox:"0 0 24 24",width:"20",height:"20",fill:"none","aria-hidden":"true",focusable:"false",children:[t.jsx("circle",{cx:"5",cy:"12",r:"1.75",stroke:"currentColor",strokeWidth:"1.5"}),t.jsx("circle",{cx:"12",cy:"12",r:"1.75",stroke:"currentColor",strokeWidth:"1.5"}),t.jsx("circle",{cx:"19",cy:"12",r:"1.75",stroke:"currentColor",strokeWidth:"1.5"})]});function $x(e){const n=e.trim().split(/\s+/).filter(Boolean);if(n.length===0)return"—";const s=n[0]?.charAt(0)??"",a=n.length>1?n[n.length-1]?.charAt(0)??"":"";return`${s}${a}`.toUpperCase()}function re(e){return e!=null&&e!==!1&&e!==""}const Fl=({title:e,subtitle:n,leading:s,tags:a,onPress:r,href:i,linkAs:o,"aria-haspopup":l,trailing:d,showChevron:u=!1,chevronIcon:f,actions:m,actionsLabel:p,actionsIcon:x,size:g,variant:y="plain",isDisabled:b=!1,as:v,className:w,"data-testid":$="entity-row"})=>{const N=h.useContext(Ll),A=kn(),k=g??(A==="touch"?"lg":"md"),C=El[k],E=wx[y],S=v??(N?"li":"div"),_=h.useId(),F=h.useId(),L=h.useId(),M=i!==void 0||r!==void 0,I=a!==void 0&&a.length>0,W=re(n),K=m!==void 0&&m.length>0,z=typeof e=="string"?e:void 0,ne=s?t.jsx(c.Avatar,{"aria-hidden":"true",size:C.avatar,radius:s.shape==="square"?"lg":"full",src:s.src,icon:s.icon,name:s.icon!==void 0?void 0:s.initials??s.name??z,getInitials:s.initials!==void 0?q=>q:$x,showFallback:s.src!==void 0,classNames:{base:ze.avatar},"data-testid":`${$}-leading`}):null,G=t.jsxs(t.Fragment,{children:[ne,t.jsxs("span",{className:ze.text,children:[t.jsxs("span",{className:ze.titleLine,children:[t.jsx("span",{id:_,className:c.cn(ze.title,C.title),title:z,children:e}),I&&t.jsx("span",{id:F,className:ze.tags,children:a.map(q=>t.jsx(c.Chip,{size:"sm",variant:"flat",color:q.tone??"default",className:jx[q.tone??"default"],"data-testid":`${$}-tag-${q.key}`,children:q.label},q.key))})]}),W&&t.jsx("span",{id:L,className:c.cn(ze.subtitle,C.subtitle),children:n})]})]}),se=[I?F:null,W?L:null].filter(Boolean).join(" "),Y={"aria-labelledby":_,"aria-describedby":se===""?void 0:se,isDisabled:b,className:c.cn(ze.pressTarget,E.overlay,C.content)},oe=`${$}-trigger`;let J;return i!==void 0?J=t.jsx(c.Link,{...Y,"data-testid":oe,as:o,href:i,color:"foreground",underline:"none",onPress:r,children:G}):r!==void 0?J=t.jsx(O,{...Y,testId:oe,variant:"light",color:"default",radius:"none",disableAnimation:!0,disableRipple:!0,"aria-haspopup":l,onPress:r,children:G}):J=t.jsx("div",{className:c.cn(ze.content,C.content),children:G}),t.jsxs(S,{"data-testid":$,"data-size":k,"data-disabled":b||void 0,className:c.cn(ze.base,E.row,C.row,M&&!b&&E.hover,w),children:[J,(re(d)||K)&&t.jsxs("div",{className:ze.side,children:[d,K&&t.jsxs(c.Dropdown,{placement:"bottom-end",children:[t.jsx(c.DropdownTrigger,{children:t.jsx(O,{isIconOnly:!0,size:C.control,variant:"light",color:"default",radius:"full",isDisabled:b,"aria-label":p,testId:`${$}-menu-trigger`,className:ze.menuTrigger,children:x??t.jsx(Sx,{})})}),t.jsx(c.DropdownMenu,{"aria-label":p,"data-testid":`${$}-menu`,disabledKeys:m.filter(q=>q.isDisabled).map(q=>q.key),onAction:q=>{m.find(ie=>ie.key===q)?.onAction()},items:m,children:q=>t.jsx(c.DropdownItem,{textValue:q.label,color:q.tone==="danger"?"danger":"default",className:c.cn(q.tone==="danger"&&ze.dangerItem,Nx[k]),startContent:q.icon,"data-testid":q["data-testid"]??`${$}-menu-${q.key}`,children:q.label},q.key)})]})]}),u&&t.jsx("span",{"aria-hidden":"true",className:ze.chevron,"data-testid":`${$}-chevron`,children:f??t.jsx(kx,{})})]})};Fl.displayName="EntityRow";const Rl=({children:e,"aria-label":n,"aria-labelledby":s,gap:a="none",className:r,"data-testid":i="entity-list"})=>t.jsx("ul",{"aria-label":n,"aria-labelledby":s,"data-testid":i,className:c.cn(Dl,Cx[a],r),children:t.jsx(Ll.Provider,{value:!0,children:e})});Rl.displayName="EntityList";const _l=({label:e,rows:n=6,size:s,className:a,"data-testid":r="entity-list-skeleton"})=>{const i=kn(),o=s??(i==="touch"?"lg":"md"),{titleWidths:l}=Nt;return t.jsxs("div",{"data-testid":r,className:a,children:[t.jsx("span",{role:"status",className:"sr-only",children:e}),t.jsx("ul",{"aria-hidden":"true",className:Dl,children:Array.from({length:n},(d,u)=>t.jsxs("li",{"data-testid":`${r}-row`,className:c.cn(Nt.row,El[o].row),children:[t.jsx(c.Skeleton,{className:Nt.avatar[o]}),t.jsxs("span",{className:Nt.lines,children:[t.jsx(c.Skeleton,{className:c.cn(Nt.title,l[u%l.length])}),t.jsx(c.Skeleton,{className:Nt.subtitle})]})]},u))})]})};_l.displayName="EntityListSkeleton";function Ml(e,n,s){if(s<=0||n<=0||e<=0)return{from:0,to:0};const a=(e-1)*n+1;return a>s?{from:0,to:0}:{from:a,to:Math.min(s,e*n)}}const Pl=({page:e,pageSize:n,total:s,unit:a,announce:r=!0,format:i,className:o,classNames:l={},"data-testid":d="pagination-summary"})=>{const{from:u,to:f}=Ml(e,n,s),m=c.cn("font-semibold text-default-700",l.emphasis);return t.jsx("p",{"data-testid":d,"aria-live":r?"polite":void 0,className:c.cn("text-sm text-default-500",o,l.base),children:i?i({from:u,to:f,total:s}):t.jsxs(t.Fragment,{children:["Showing"," ",t.jsx("span",{"data-testid":`${d}-range`,className:m,children:u===0?0:`${u}–${f}`})," ","of"," ",t.jsx("span",{"data-testid":`${d}-total`,className:m,children:s}),a?t.jsxs(t.Fragment,{children:[" ",a]}):null]})})};Pl.displayName="PaginationSummary";const Rn="shadow-[0_1px_4px_rgba(0,0,0,.06),0_4px_12px_rgba(0,0,0,.06)]",at={base:"overflow-hidden rounded-2xl border border-pos-line bg-white",title:"m-0 min-w-0 text-[0.90625rem] font-semibold text-default-900 [overflow-wrap:anywhere]",count:"rounded-full bg-default-100 px-2 py-px text-[0.75rem] font-semibold text-default-600",icon:"flex shrink-0 text-default-500 [&_svg]:size-[1.125rem]",action:"ml-auto",description:"m-0 text-[0.84375rem] leading-[1.55] text-default-500 [&_b]:font-bold [&_b]:tabular-nums [&_b]:text-default-900",footer:"flex flex-wrap gap-2",footerAfterContent:"mt-[0.875rem]",footerAfterDescription:"mt-3"},Ax={card:Rn,flat:""},Ex={section:"flex flex-wrap items-center gap-2 px-5 pt-4",aside:"flex flex-wrap items-center gap-[0.5625rem] px-[1.125rem] pt-[0.9375rem]"},Dx={section:{padded:"px-5 pb-[1.125rem] pt-[0.875rem]",rows:"px-5 pb-[1.125rem] pt-2.5",flush:"pt-3",none:""},aside:{padded:"px-[1.125rem] pb-[1.125rem] pt-3",rows:"px-[1.125rem] pb-[1.125rem] pt-3",flush:"pt-3",none:""}},Tl=({isLoading:e=!1,isError:n=!1,isEmpty:s=!1,loadingTitle:a="Loading…",loadingContent:r,errorTitle:i="Something went wrong",errorDescription:o,retryLabel:l="Retry",onRetry:d,errorActions:u,errorContent:f,emptyTitle:m="Nothing here yet",emptyDescription:p,emptyIcon:x,emptyActions:g,emptyContent:y,children:b,toolbar:v,variant:w="default",className:$,classNames:N={},"data-testid":A="list-panel"})=>{const k=w==="framed",C={base:c.cn("border-0 bg-transparent py-12",N.state)},E=k?{base:c.cn("px-6 py-[3.625rem]",N.state),iconWrapper:"mb-[1.125rem] size-[4.75rem] rounded-[1.25rem] border-0 bg-default-100 text-default-400",icon:"size-[2.875rem]",title:"text-[1.0625rem] font-semibold text-default-900",description:"mt-1.5 max-w-[26.25rem] text-[0.875rem] leading-[1.55] text-default-500",actions:"mt-[1.375rem] gap-2.5"}:C;let S;return e?S=r??t.jsx(Gs,{title:a,classNames:C,"data-testid":`${A}-loading`}):n?S=f??t.jsx(qs,{title:i,description:o,classNames:C,"data-testid":`${A}-error`,actions:u??(d?t.jsx(O,{color:"primary",variant:"flat",onPress:d,children:l}):void 0)}):s?S=y??t.jsx(Ws,{surface:k?"panel":void 0,title:m,description:p,icon:x,actions:g,classNames:E,"data-testid":`${A}-empty`}):S=b,t.jsxs("section",{"data-testid":A,"data-variant":k?"framed":void 0,className:c.cn(k?`overflow-hidden rounded-2xl border border-pos-line bg-white ${Rn}`:"rounded-xl bg-white p-2 shadow-sm",$,N.base),children:[v,S]})};Tl.displayName="ListPanel";const Zs=(e,n)=>n<=0?/^\d*$/.test(e):new RegExp(`^\\d*(?:[.,]\\d{0,${n}})?$`).test(e),Kt=e=>{const n=Number.parseFloat(e.replace(",","."));return Number.isFinite(n)?n:null},Il=(e,n)=>{const[s,a]=h.useState(()=>n(e)),r=(Kt(s)??0)===(e??0)?s:n(e),i=h.useCallback(()=>{a(o=>{const l=Kt(o);return l===null?"":String(l)})},[]);return{draft:r,setDraft:a,normalize:i}},Lx=/^[\d.,]+$/,Ol=(e,n=Object.is)=>{const s=h.useRef(e),a=h.useRef(null);h.useLayoutEffect(()=>{s.current=e},[e]);const r=h.useCallback(()=>{const l=a.current,d=s.current;return l===null||!(n(d,l.source)||n(d,l.emitted))},[n]),i=h.useCallback(l=>{a.current={source:s.current,emitted:l}},[]),o=h.useCallback(()=>{a.current=null},[]);return h.useMemo(()=>({isUntouched:r,markEdited:i,markUntouched:o}),[r,i,o])},zl=(e,n)=>{const s=h.useRef(null),a=h.useRef(n);return h.useLayoutEffect(()=>{a.current=n},[n]),h.useEffect(()=>{const r=s.current;if(!r)return;const i=l=>{e()&&(l.inputType==="insertText"&&l.data&&Lx.test(l.data)?(l.preventDefault(),a.current(l.data)):l.inputType.startsWith("delete")&&(l.preventDefault(),a.current("")))},o=()=>{requestAnimationFrame(()=>{r.isConnected&&e()&&r.select()})};return r.addEventListener("beforeinput",i),r.addEventListener("pointerup",o),()=>{r.removeEventListener("beforeinput",i),r.removeEventListener("pointerup",o)}},[e]),s},Fx=350,Rx={receivedLabel:"Cash Received",receivedPlaceholder:"$0.00",changeLabel:"Change",changeMessageTemplate:"You have to give back the client {change} in change",insufficientMessageTemplate:"Amount received must be at least {due}",exactAmountLabel:"Exact",exactAmountAriaTemplate:"Exact amount {amount}",quickAmountsLabel:"Quick cash amounts",quickAmountAriaTemplate:"Add {amount}"},_x=7,Mx=e=>[...new Set((e??[]).filter(n=>Number.isFinite(n)&&n>0))].sort((n,s)=>n-s).slice(0,_x),Px=(e,n,s)=>{if(!Number.isInteger(e))return fe(e,n,s);try{return new Intl.NumberFormat(n,{style:"currency",currency:s,minimumFractionDigits:0}).format(e)}catch{return fe(e,n,s)}},Tx=(e,n)=>(e??0)===(n??0),It=(e,n)=>Object.entries(n).reduce((s,[a,r])=>s.replace(`{${a}}`,r),e),Ix=({dueAmount:e,received:n,defaultReceived:s=null,onChange:a,locale:r="en-US",labels:i,isDisabled:o=!1,maxAmount:l,quickAmounts:d,showExactAmount:u=!0,autoFocus:f=!1,className:m,"data-testid":p="cash-tender-form"})=>{const x={...Rx,...i},g=Dt(e.currency,r),y=n!==void 0,[b,v]=h.useState(s??null),w=y?n:b,{draft:$,setDraft:N,normalize:A}=Il(w,V=>V==null?"":String(V)),{isUntouched:k,markEdited:C,markUntouched:E}=Ol(w,Tx),S=h.useMemo(()=>{const V=typeof w=="number"&&Number.isFinite(w)?w:0,ee=ms(V,e.value,e.currency,r);return{received:V,change:ee>0?ee:0,isValid:V>=e.value&&V>0}},[w,e.value,e.currency,r]),_=h.useCallback(V=>{const ee=V.currentTarget;requestAnimationFrame(()=>{ee.isConnected&&ee.select()})},[]),F=h.useCallback(V=>{y||v(V);const ee=typeof V=="number"&&Number.isFinite(V)?V:0,te=ms(ee,e.value,e.currency,r);a?.({received:ee,change:te>0?te:0,isValid:ee>=e.value&&ee>0})},[y,e.value,e.currency,r,a]),L=h.useCallback(V=>{if(o)return;const ee=V.replace(/[^\d.,]/g,"");if(!Zs(ee,g))return;const te=Kt(ee);te!==null&&l!==void 0&&te>l||(N(ee),C(te),F(te))},[o,l,N,C,g,F]),M=zl(k,L),I=h.useMemo(()=>Mx(d),[d]),W=V=>l!==void 0&&V>l,K=()=>{o||W(e.value)||(N(String(e.value)),E(),F(e.value))},z=V=>{if(o)return;const ee=k()||typeof w!="number"||!Number.isFinite(w)?0:w,te=Ms(ee+V,e.currency,r);W(te)||(N(String(te)),C(te),F(te))},ne=S.isValid&&S.change>0,G=!S.isValid&&S.received>0,se=fe(S.change,r,e.currency),Y=fe(e.value,r,e.currency),[oe,J]=h.useState(""),q=h.useRef(null);h.useEffect(()=>{q.current&&clearTimeout(q.current);const V=ne?It(x.changeMessageTemplate,{change:se}):"",ee=ne?Fx:0;return q.current=setTimeout(()=>J(V),ee),()=>{q.current&&clearTimeout(q.current)}},[ne,se,x.changeMessageTemplate]);const ie=`${p}-received`;return t.jsxs("div",{className:c.cn("flex flex-col gap-3",m),"data-testid":p,children:[t.jsx(c.Input,{ref:M,id:ie,label:x.receivedLabel,labelPlacement:"outside",type:"text",inputMode:g===0?"numeric":"decimal",pattern:g===0?"[0-9]*":"[0-9]*[.,]?[0-9]*",value:$,onChange:V=>L(V.target.value),onFocus:_,onBlur:A,placeholder:x.receivedPlaceholder,isDisabled:o,isInvalid:G,errorMessage:G?It(x.insufficientMessageTemplate,{due:Y}):void 0,variant:"bordered",radius:"lg",autoFocus:f,"data-testid":`${p}-received-input`}),I.length>0&&t.jsx("div",{className:"[container-type:inline-size]",children:t.jsxs("div",{role:"group","aria-label":x.quickAmountsLabel,className:"grid grid-cols-4 gap-2 [@container(min-width:55rem)]:grid-cols-8","data-testid":`${p}-quick-amounts`,children:[u&&t.jsxs(O,{variant:"flat",color:"primary",radius:"lg",className:"h-auto min-h-11 min-w-0 whitespace-normal px-2 py-1 text-sm font-semibold leading-tight",isDisabled:o,"aria-label":It(x.exactAmountAriaTemplate,{amount:Y}),onPress:K,"data-testid":`${p}-quick-amount-exact`,children:[x.exactAmountLabel," ",Y]}),I.map(V=>{const ee=Px(V,r,e.currency);return t.jsx(O,{variant:"bordered",color:"default",radius:"lg",className:"h-auto min-h-11 min-w-0 px-2 text-base font-semibold text-default-900",isDisabled:o,"aria-label":It(x.quickAmountAriaTemplate,{amount:ee}),onPress:()=>z(V),"data-testid":`${p}-quick-amount-${V}`,children:ee},V)})]})}),ne&&t.jsx(c.Alert,{"data-testid":`${p}-change-alert`,color:"primary",variant:"flat",radius:"lg",title:x.changeLabel,description:It(x.changeMessageTemplate,{change:se}),icon:t.jsx(P,{icon:"lucide:info",width:20,height:20,"aria-hidden":"true"}),"aria-live":"off",classNames:{base:"bg-info-50 text-info-700",title:"font-semibold",description:"text-sm leading-relaxed",iconWrapper:"bg-transparent shadow-none border-0"}}),t.jsx("span",{role:"status","aria-live":"polite",className:"sr-only",children:oe})]})},Ox={checkNumberLabel:"Check Number",checkNumberPlaceholder:"e.g. 11234",bankNameLabel:"Bank Name",bankNamePlaceholder:"e.g. Chase Bank",dateLabel:"Date",checkNumberRequiredMessage:"Check number is required"},mr=()=>{const e=new Date,n=s=>String(s).padStart(2,"0");return`${e.getFullYear()}-${n(e.getMonth()+1)}-${n(e.getDate())}`},Bl=({dueAmount:e,value:n,defaultValue:s,onChange:a,labels:r,hideDate:i=!1,hideBankName:o=!1,isDisabled:l=!1,checkNumberMaxLength:d=34,bankNameMaxLength:u=100,autoFocus:f=!1,className:m,"data-testid":p="check-tender-form"})=>{const x={...Ox,...r},g=n!==void 0,[y,b]=h.useState({checkNumber:s?.checkNumber??"",bankName:s?.bankName??"",date:s?.date??mr()}),[v,w]=h.useState(!!s?.checkNumber),$=h.useMemo(()=>g?{checkNumber:n?.checkNumber??"",bankName:n?.bankName??"",date:n?.date??mr()}:y,[g,n,y]),N=h.useCallback(F=>{g||b(F);const L=F.checkNumber.trim(),M={amount:e.value,checkNumber:L,bankName:F.bankName.trim()||void 0,date:i?void 0:F.date,isValid:L.length>0&&e.value>0};a?.(M)},[g,e.value,i,a]),A=h.useCallback(F=>L=>{l||(F==="checkNumber"&&L.length>0&&w(!0),N({...$,[F]:L}))},[$,N,l]),k=h.useCallback(()=>{l||w(!0)},[l]),C=v&&$.checkNumber.trim()==="",E=`${p}-check-number`,S=`${p}-bank-name`,_=`${p}-date`;return t.jsxs("div",{className:c.cn("grid grid-cols-1 sm:grid-cols-2 gap-4",m),"data-testid":p,children:[t.jsx(c.Input,{id:E,label:x.checkNumberLabel,labelPlacement:"outside",type:"text",value:$.checkNumber,onChange:F=>A("checkNumber")(F.target.value),onBlur:k,placeholder:x.checkNumberPlaceholder,maxLength:d,isRequired:!0,isInvalid:C,errorMessage:C?x.checkNumberRequiredMessage:void 0,isDisabled:l,variant:"bordered",radius:"lg",autoFocus:f,"data-testid":`${p}-check-number-input`}),!o&&t.jsx(c.Input,{id:S,label:x.bankNameLabel,labelPlacement:"outside",type:"text",value:$.bankName,onChange:F=>A("bankName")(F.target.value),placeholder:x.bankNamePlaceholder,maxLength:u,isDisabled:l,variant:"bordered",radius:"lg","data-testid":`${p}-bank-name-input`}),!i&&t.jsx(c.Input,{id:_,label:x.dateLabel,labelPlacement:"outside",type:"date",value:$.date,onChange:F=>A("date")(F.target.value),isDisabled:l,variant:"bordered",radius:"lg","data-testid":`${p}-date-input`,className:"sm:col-span-2"})]})};Bl.displayName="CheckTenderForm";const zx={methodLabel:"Method",methodPlaceholder:"Select a payment method",referenceLabel:"Reference",referencePlaceholder:"e.g. Voucher #1234",methodRequiredMessage:"Method is required"},Bx=[{value:"ach",label:"ACH"},{value:"wire",label:"Wire"},{value:"gift_card",label:"Gift Card"},{value:"voucher",label:"Voucher"},{value:"other",label:"Other"}],Vl=({dueAmount:e,methodOptions:n=Bx,value:s,defaultValue:a,onChange:r,labels:i,showReference:o=!1,isDisabled:l=!1,className:d,"data-testid":u="other-tender-form"})=>{const f={...zx,...i},m=s!==void 0,[p,x]=h.useState({method:a?.method??"",reference:a?.reference??""}),g=h.useMemo(()=>m?{method:s?.method??"",reference:s?.reference??""}:p,[m,s,p]),y=h.useCallback(A=>n.find(k=>k.value===A)?.label??"",[n]),b=h.useCallback(A=>{m||x(A);const k=y(A.method),C={amount:e.value,method:A.method,description:k,reference:A.reference.trim()||void 0,isValid:A.method!==""};r?.(C)},[m,e.value,r,y]),v=h.useCallback(A=>{if(l)return;const k=typeof A=="string"?A:Array.from(A)[0]?.toString()??"";b({...g,method:k})},[g,b,l]),w=h.useCallback(A=>{l||b({...g,reference:A})},[g,b,l]),$=`${u}-method`,N=`${u}-reference`;return t.jsxs("div",{className:c.cn("flex flex-col gap-3",d),"data-testid":u,children:[t.jsx(Xe,{id:$,label:f.methodLabel,labelPlacement:"outside",placeholder:f.methodPlaceholder,selectedKeys:g.method?[g.method]:[],onSelectionChange:v,isDisabled:l,isRequired:!0,variant:"bordered",radius:"lg","data-testid":`${u}-method-select`,popoverProps:{placement:"bottom-start",classNames:{content:"bg-white border border-default-200 shadow-lg rounded-xl p-1"}},listboxProps:{classNames:{list:"max-h-[var(--popover-available-height,40vh)] overflow-y-auto"},itemClasses:{base:["rounded-lg","px-3 py-2","text-default-800","data-[hover=true]:bg-default-100","data-[selectable=true]:focus:bg-default-100","data-[selected=true]:bg-primary-50","data-[selected=true]:text-primary","data-[selected=true]:font-medium"]}},children:n.map(A=>t.jsx(c.SelectItem,{"data-testid":`${u}-method-option-${A.value}`,children:A.label},A.value))}),o&&t.jsx(c.Input,{id:N,label:f.referenceLabel,labelPlacement:"outside",type:"text",value:g.reference,onChange:A=>w(A.target.value),placeholder:f.referencePlaceholder,isDisabled:l,variant:"bordered",radius:"lg","data-testid":`${u}-reference-input`})]})};Vl.displayName="OtherTenderForm";const Vx={collectedHeading:"Collected",remainingLabel:"Remaining:",completeLabel:"Complete",removeAriaLabel:"Remove this tender",removeTooltipForRecorded:"Already recorded",statusPending:"Pending",statusRecorded:"Approved",statusFailed:"Failed"},Ux={card:"lucide:credit-card",cash:"lucide:dollar-sign",check:"lucide:edit-3",other:"lucide:more-horizontal"},Hx={pending:"warning",recorded:"success",failed:"danger"},Wx=e=>e==="pending"||e==="recorded",qx=e=>`#${e+1}`,Ul=({total:e,tenders:n,onRemove:s,locale:a="en-US",labels:r,hideCollectedList:i=!1,variant:o="banner",className:l,"data-testid":d="split-payment-summary"})=>{const u={...Vx,...r},{collected:f,remaining:m,isComplete:p}=h.useMemo(()=>{const g=n.reduce((b,v)=>Wx(v.status)?b+v.amount:b,0),y=Math.max(e.value-g,0);return{collected:g,remaining:y,isComplete:g>=e.value&&e.value>0}},[n,e.value]),x=g=>g==="pending"?u.statusPending:g==="recorded"?u.statusRecorded:u.statusFailed;return t.jsxs("div",{className:c.cn("flex flex-col gap-4",l),"data-testid":d,children:[o==="compact"?t.jsxs("div",{className:"flex items-baseline justify-between gap-3","data-testid":`${d}-remaining-banner`,children:[t.jsx("span",{className:"text-sm text-default-600",children:p?u.completeLabel:u.remainingLabel}),t.jsx("span",{className:"text-base font-semibold tracking-tight","data-testid":`${d}-remaining-amount`,children:fe(p?f:m,a,e.currency)})]}):t.jsxs("div",{className:"rounded-2xl bg-default-100 px-6 py-5 text-center","data-testid":`${d}-remaining-banner`,children:[t.jsx("div",{className:"text-sm text-default-600",children:p?u.completeLabel:u.remainingLabel}),t.jsx("div",{className:"mt-1 text-4xl font-bold tracking-tight","data-testid":`${d}-remaining-amount`,children:fe(p?f:m,a,e.currency)})]}),!i&&n.length>0&&t.jsxs("div",{className:"flex flex-col gap-2","data-testid":`${d}-collected-list`,children:[t.jsx("h3",{className:"text-base font-semibold",children:u.collectedHeading}),n.map((g,y)=>t.jsx(Gx,{index:y,tender:g,locale:a,currency:e.currency,removable:!!s&&g.status!=="recorded",onRemove:s?()=>s(g.id):void 0,statusLabel:x(g.status),removeAriaLabel:u.removeAriaLabel,recordedTooltip:u.removeTooltipForRecorded,dataTestId:`${d}-row-${y}`},g.id))]})]})};Ul.displayName="SplitPaymentSummary";const Gx=({index:e,tender:n,locale:s,currency:a,removable:r,onRemove:i,statusLabel:o,removeAriaLabel:l,recordedTooltip:d,dataTestId:u})=>{const f=i?t.jsx(O,{isIconOnly:!0,variant:"light",radius:"full",size:"sm",onPress:i,isDisabled:!r,"aria-label":l,"data-testid":`${u}-remove`,className:c.cn(r?"text-default-700 hover:bg-default-200":"text-default-300"),children:t.jsx(P,{icon:"lucide:x",width:18,height:18,"aria-hidden":"true"})}):null;return t.jsxs("div",{className:"flex items-center gap-3 rounded-xl bg-default-50 px-4 py-3 motion-safe:animate-[pp-row-in_200ms_ease-out]","data-testid":u,children:[t.jsx("span",{className:"text-sm font-medium text-default-500 w-6 shrink-0",children:qx(e)}),t.jsx(P,{icon:Ux[n.type],width:20,height:20,className:"text-default-700 shrink-0","aria-hidden":"true"}),t.jsx("span",{className:"flex-1 truncate","data-testid":`${u}-label`,children:n.label}),t.jsx("span",{className:"font-semibold tabular-nums","data-testid":`${u}-amount`,children:fe(n.amount,s,a)}),t.jsx(c.Chip,{size:"sm",radius:"full",variant:"flat",color:Hx[n.status],startContent:n.status==="recorded"?t.jsx(P,{icon:"lucide:check-circle",width:14,height:14,"aria-hidden":"true"}):n.status==="failed"?t.jsx(P,{icon:"lucide:alert-circle",width:14,height:14,"aria-hidden":"true"}):void 0,"data-testid":`${u}-status`,children:o}),f&&(r?f:t.jsx(c.Tooltip,{content:d,placement:"left",children:t.jsx("span",{tabIndex:0,"aria-label":d,children:f})}))]})},Kx=`
17
17
  @keyframes pp-modal-in {
18
18
  from { opacity: 0; transform: scale(0.96); }
19
19
  to { opacity: 1; transform: scale(1); }
@@ -38,5 +38,5 @@ ${s}${a}
38
38
  from { opacity: 0; transform: translateY(-6px); }
39
39
  to { opacity: 1; transform: translateY(0); }
40
40
  }
41
- `,Vl=h.forwardRef(({children:e,relativeOverlayRoot:n=!0,className:s,style:a,"data-testid":r="modal-shell"},i)=>t.jsxs(t.Fragment,{children:[t.jsx("style",{children:Ux}),t.jsx("div",{ref:i,"data-testid":r,style:a,className:c.cn("flex flex-col gap-4 p-4 rounded-3xl bg-white shadow-xl","md:gap-5 md:p-6",n&&"relative","motion-safe:animate-[pp-modal-in_220ms_ease-out]","motion-safe:transition-[min-height] motion-safe:duration-[420ms] motion-safe:ease-in-out",s),children:e})]}));Vl.displayName="ModalShell";const Ul=({title:e,subtitle:n,leading:s,titleClassName:a,onClose:r,closeLabel:i="Close",actions:o,className:l,"data-testid":d="modal-shell-header"})=>t.jsxs("header",{className:c.cn("flex items-center justify-between gap-3",l),"data-testid":d,children:[t.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[s,t.jsxs("div",{className:"min-w-0",children:[t.jsx("h2",{className:c.cn("text-xl font-semibold",a),"data-testid":`${d}-title`,children:e}),n&&t.jsx("div",{className:"text-xs font-semibold text-default-500","data-testid":`${d}-subtitle`,children:n})]})]}),t.jsxs("div",{className:"flex items-center gap-2",children:[o,r&&t.jsx(O,{isIconOnly:!0,variant:"light",radius:"full",size:"sm",onPress:r,"aria-label":i,"data-testid":`${d}-close`,children:t.jsx(P,{icon:"lucide:x",width:20,height:20,"aria-hidden":"true"})})]})]});Ul.displayName="ModalShellHeader";const Hl=({children:e,columns:n=2,className:s,"data-testid":a="modal-shell-footer"})=>t.jsx("footer",{className:c.cn("mt-2 gap-3",n===2?"flex flex-col md:grid md:grid-cols-2 [&>*]:w-full [&>*:first-child]:md:order-2 [&>*:nth-child(2)]:md:order-1":"grid grid-cols-1",s),"data-testid":a,children:e});Hl.displayName="ModalShellFooter";const Hx={2:"sm:grid-cols-2",3:"sm:grid-cols-3",4:"sm:grid-cols-4",5:"sm:grid-cols-5",6:"sm:grid-cols-6"},Wx={1:"grid-cols-1",2:"grid-cols-2"},$t={grid:"gap-2",tile:`flex flex-col items-center justify-center gap-[0.3125rem] h-auto min-h-0 min-w-0 rounded-xl border px-1 py-2.5 transition-colors ${Se} motion-reduce:data-[pressed=true]:scale-100 [html[data-pos-reduce-motion=true]_&]:data-[pressed=true]:scale-100`,idle:"border-pos-field bg-white text-pos-ink data-[hover=true]:border-pos-line-strong data-[hover=true]:bg-white",active:"border-primary bg-primary/[.09] text-primary data-[hover=true]:bg-primary/[.09]",icon:"flex h-[1.0625rem] w-[1.0625rem] items-center justify-center",label:"text-[0.71875rem] font-medium leading-[0.875rem]"},ts=e=>typeof e=="string"?t.jsx(P,{icon:e,width:20,height:20,"aria-hidden":"true"}):e,qx=e=>t.jsx("span",{"aria-hidden":"true",className:$t.icon,children:typeof e=="string"?t.jsx(P,{icon:e,width:"100%",height:"100%","aria-hidden":"true"}):e}),rn=`h-[2.125rem] min-h-0 min-w-fit flex-1 whitespace-nowrap rounded-full px-2.5 text-[0.8125rem] font-medium transition-colors ${Se}`,Gx="pointer-events-none absolute -left-[9999px] top-0 flex flex-row gap-1 p-1 opacity-0",ur="flex-none",Kx=typeof window<"u"?h.useLayoutEffect:h.useEffect,mr=e=>e?"bg-white text-default-900 shadow-[0_2px_8px_rgba(0,0,0,0.06)] data-[hover=true]:bg-white data-[pressed=true]:bg-white data-[hover=true]:opacity-100":"bg-transparent text-default-600 data-[hover=true]:bg-transparent data-[pressed=true]:bg-transparent data-[hover=true]:opacity-100 data-[hover=true]:text-default-900",Wl=({options:e,selectedKey:n,onSelect:s,heading:a,ariaLabel:r="Select an option",variant:i="tiles",maxVisible:o,moreLabel:l="More",columnsDesktop:d=3,columnsMobile:u=2,size:f="md",className:m,"data-testid":p="tile-select"})=>{const x=f==="sm",g=e.find(y=>y.key===n);return i==="compact"?t.jsx(Yx,{options:e,selectedKey:n,onSelect:s,ariaLabel:r,moreLabel:l,dataTestId:p,...a!==void 0?{heading:a}:{},...o!==void 0?{maxVisible:o}:{},...m!==void 0?{className:m}:{}}):t.jsxs("div",{className:c.cn("flex flex-col gap-3",m),"data-testid":p,children:[a&&t.jsx("h3",{className:"text-sm font-medium text-default-700",id:`${p}-heading`,children:a}),t.jsx("div",{className:"md:hidden",children:t.jsx(Xe,{"aria-label":a?void 0:r,"aria-labelledby":a?`${p}-heading`:void 0,selectedKeys:n?[n]:[],onSelectionChange:y=>{const j=Array.from(y)[0];typeof j=="string"&&s(j)},placeholder:r,variant:"bordered",radius:"lg","data-testid":`${p}-mobile-select`,startContent:g?t.jsx("span",{"aria-hidden":"true",className:"shrink-0",children:ts(g.icon)}):void 0,popoverProps:{placement:"bottom-start",classNames:{content:"bg-white border border-default-200 shadow-lg rounded-xl p-1"}},listboxProps:{classNames:{list:"max-h-[var(--popover-available-height,40vh)] overflow-y-auto"},itemClasses:{base:["rounded-lg","px-3 py-2","text-default-800","data-[hover=true]:bg-default-100","data-[selectable=true]:focus:bg-default-100","data-[selected=true]:bg-primary-50","data-[selected=true]:text-primary","data-[selected=true]:font-medium"]}},children:e.map(y=>t.jsx(c.SelectItem,{isDisabled:y.isDisabled,startContent:t.jsx("span",{"aria-hidden":"true",className:"shrink-0",children:ts(y.icon)}),"data-testid":y["data-testid"]??`${p}-${y.key}-mobile`,children:y.label},y.key))})}),t.jsx("div",{role:"group","aria-labelledby":a?`${p}-heading`:void 0,"aria-label":a?void 0:r,className:c.cn("hidden md:grid",x?$t.grid:"gap-3",Wx[u],Hx[d]),"data-size":f,children:e.map(y=>{const b=n===y.key;return t.jsxs(O,{variant:"bordered",radius:"lg","aria-pressed":b,"aria-label":y.label,isDisabled:y.isDisabled,onPress:()=>s(y.key),"data-testid":y["data-testid"]??`${p}-${y.key}`,className:x?c.cn($t.tile,b?$t.active:$t.idle):c.cn("flex flex-col items-center justify-center gap-2 h-auto min-h-20 px-4 py-4","border bg-transparent transition-colors",Se,b?"border-primary bg-primary-50 text-primary":"border-default-200 text-default-800 hover:bg-default-50"),"data-size":f,children:[x?qx(y.icon):t.jsx("span",{"aria-hidden":"true",children:ts(y.icon)}),t.jsx("span",{className:x?$t.label:"text-sm font-medium",children:y.label})]},y.key)})})]})};Wl.displayName="TileSelect";function Yx({options:e,selectedKey:n,onSelect:s,heading:a,ariaLabel:r,maxVisible:i,moreLabel:o,className:l,dataTestId:d}){const u=h.useRef(null),f=h.useRef(null),m=h.useMemo(()=>e.map((D,S)=>({option:D,index:S})).filter(({option:D})=>D.alwaysInMenu!==!0).map(({index:D})=>D),[e]),p=m.length<e.length,x=h.useCallback(D=>{const S=m.map(F=>({index:F,priority:e[F]?.priority??0})).sort((F,L)=>F.priority-L.priority||L.index-F.index),_=new Set(S.slice(0,m.length-D).map(F=>F.index));return m.filter(F=>!_.has(F))},[e,m]),[g,y]=h.useState(e.length);Kx(()=>{const D=u.current,S=f.current;if(!D||!S)return;const _=()=>{const L=Array.from(S.children),M=L.slice(0,e.length).map(G=>G.getBoundingClientRect().width),I=L[e.length]?.getBoundingClientRect().width??0,W=window.getComputedStyle(D),K=Number.parseFloat(W.columnGap)||0,z=D.clientWidth-(Number.parseFloat(W.paddingLeft)||0)-(Number.parseFloat(W.paddingRight)||0);if(z<=0||M.some(G=>G===0)){y(m.length);return}const ne=G=>{const se=p||G<m.length,Y=G+(se?1:0);return x(G).reduce((J,q)=>J+(M[q]??0),0)+(se?I:0)+K*(Y-1)<=z};for(let G=m.length;G>=1;G-=1)if(ne(G)){y(G);return}y(1)};_();const F=new ResizeObserver(_);return F.observe(D),()=>F.disconnect()},[e,o,x,m,p]);const b=Math.max(1,Math.min(g,i??m.length,m.length)),w=!p&&b===m.length-1&&g===m.length?m.length:b,$=p||w<m.length,N=new Set(x(w)),A=e.filter((D,S)=>N.has(S)),k=$?e.filter((D,S)=>!N.has(S)):[],C=k.find(D=>D.key===n);return t.jsxs("div",{className:c.cn("relative flex flex-col gap-3",l),"data-testid":d,children:[a&&t.jsx("h3",{className:"text-sm font-medium text-default-700",id:`${d}-heading`,children:a}),t.jsxs("div",{ref:u,role:"group","aria-labelledby":a?`${d}-heading`:void 0,"aria-label":a?void 0:r,className:"flex flex-row gap-1 rounded-full bg-default-100 p-1",children:[A.map(D=>t.jsx(O,{variant:"light",radius:"full","aria-pressed":n===D.key,isDisabled:D.isDisabled,onPress:()=>s(D.key),"data-testid":D["data-testid"]??`${d}-${D.key}`,className:c.cn(rn,mr(n===D.key)),children:D.label},D.key)),k.length>0&&t.jsxs(c.Dropdown,{placement:"bottom-end",radius:"lg",children:[t.jsx(c.DropdownTrigger,{children:t.jsxs(O,{variant:"light",radius:"full","aria-pressed":C!==void 0,"data-testid":`${d}-more`,className:c.cn(rn,"gap-1",C!==void 0?"min-w-0":"min-w-fit",mr(C!==void 0)),children:[t.jsx("span",{className:"min-w-0 truncate",children:C?.label??o}),t.jsx(P,{icon:"lucide:chevron-down",width:14,height:14,"aria-hidden":"true"})]})}),t.jsx(c.DropdownMenu,{"aria-label":o,className:"w-64 p-2",selectionMode:"single",selectedKeys:C?[C.key]:[],disabledKeys:k.filter(D=>D.isDisabled).map(D=>D.key),onAction:D=>s(String(D)),children:k.map(D=>t.jsx(c.DropdownItem,{textValue:D.label,...D.description!==void 0?{description:D.description}:{},"data-testid":D["data-testid"]??`${d}-${D.key}`,children:D.label},D.key))})]})]}),t.jsxs("div",{ref:f,"aria-hidden":"true",className:Gx,children:[e.map(D=>t.jsx(O,{variant:"light",radius:"full",tabIndex:-1,className:c.cn(rn,ur),children:D.label},D.key)),t.jsxs(O,{variant:"light",radius:"full",tabIndex:-1,className:c.cn(rn,ur,"gap-1"),children:[o,t.jsx(P,{icon:"lucide:chevron-down",width:14,height:14})]})]})]})}const Qx={subtle:{wrapper:"bg-default-100",amount:"text-default-900"},success:{wrapper:"bg-success-50 text-success-700",amount:"text-success-700"}},ql=({total:e,label:n,locale:s="en-US",variant:a="subtle",className:r,"data-testid":i="payment-total-banner"})=>{const o=Qx[a];return t.jsxs("div",{"data-testid":i,className:c.cn("rounded-2xl px-6 py-5 text-center",o.wrapper,r),children:[t.jsx("div",{className:"text-sm text-default-600",children:n}),t.jsx("div",{className:c.cn("mt-1 text-4xl font-bold tracking-tight",o.amount),"data-testid":`${i}-amount`,children:fe(e.value,s,e.currency)})]})};ql.displayName="PaymentTotalBanner";const Zx={white:"bg-white/70 backdrop-blur-sm",transparent:"bg-transparent"},Gl=({title:e,subtitle:n,backdrop:s="white",exiting:a=!1,className:r,"data-testid":i="loading-overlay"})=>t.jsxs("div",{role:"status","aria-live":a?"off":"polite","aria-hidden":a||void 0,"data-testid":i,"data-state":a?"exiting":"visible",className:c.cn("absolute inset-0 z-10 flex flex-col items-center justify-center gap-4 rounded-3xl",Zx[s],a?"pointer-events-none motion-safe:animate-[pp-fade-out_280ms_ease-in_forwards]":"motion-safe:animate-[pp-fade-in_150ms_ease-out]",r),children:[t.jsx("div",{"aria-hidden":"true","data-testid":`${i}-spinner`,className:"h-16 w-16 rounded-full border-4 border-primary-100 border-t-primary animate-spin motion-safe:animate-[pp-scale-in_200ms_ease-out,spin_1s_linear_infinite]"}),t.jsxs("div",{className:"text-center",children:[t.jsx("div",{className:"text-xl font-semibold","data-testid":`${i}-title`,children:e}),n&&t.jsx("div",{className:"mt-1 text-sm text-default-600",children:n})]})]});Gl.displayName="LoadingOverlay";const Zs=({cashChange:e,label:n="Cash to return",secondaryLine:s,locale:a="en-US",onDismiss:r,dismissAriaLabel:i="Dismiss",align:o="left",className:l,"data-testid":d="payment-cash-change-banner"})=>{if(!e||e.value<=0)return null;const u=o==="center";return t.jsxs("div",{role:"status","aria-live":"polite","data-testid":d,className:c.cn("flex w-full items-center gap-3 rounded-2xl border border-info-200 bg-info-50 px-5 py-4",u?"justify-center text-center":"text-left","motion-safe:animate-[pp-slide-down_200ms_ease-out]",l),children:[t.jsx(P,{icon:"lucide:info",width:28,height:28,className:"shrink-0 text-info-700","aria-hidden":"true"}),t.jsxs("div",{className:c.cn("flex flex-col",u?"items-center":"flex-1"),children:[t.jsx("span",{className:"text-xs font-medium uppercase tracking-wider text-info-700",children:n}),t.jsx("span",{className:"text-2xl font-bold text-info-700","data-testid":`${d}-amount`,children:fe(e.value,a,e.currency)}),s&&t.jsx("span",{className:"mt-0.5 text-xs text-info-700/80",children:s})]}),r&&t.jsx(O,{isIconOnly:!0,variant:"light",radius:"full",size:"sm",onPress:r,"aria-label":i,"data-testid":`${d}-dismiss`,className:"shrink-0 text-info-700 hover:bg-info-100",children:t.jsx(P,{icon:"lucide:x",width:18,height:18,"aria-hidden":"true"})})]})};Zs.displayName="PaymentCashChangeBanner";const Kl=({title:e,subtitle:n,emailLine:s,confirmationEmail:a,cashChange:r,cashChangeLabel:i="Cash to return",locale:o="en-US",closeLabel:l="Close",onClose:d,className:u,"data-testid":f="payment-success-view"})=>{const m=!!(r&&r.value>0);return t.jsxs("div",{"data-testid":f,className:c.cn("flex flex-col items-center gap-6 py-8 px-4 text-center","motion-safe:animate-[pp-fade-in_250ms_ease-out]",u),children:[t.jsx("div",{"aria-hidden":"true",className:"flex items-center justify-center rounded-full bg-[#A2D9C6] p-[10px]",children:t.jsx(P,{icon:"gravity-ui:circle-check-fill",width:76,height:76,className:"text-[#10B981]","aria-hidden":"true"})}),t.jsxs("div",{className:"space-y-3",children:[t.jsx("h2",{className:"text-2xl font-bold","data-testid":`${f}-title`,children:e}),t.jsx("p",{className:"text-default-700",children:n}),s&&a&&t.jsxs("p",{className:"text-default-700",children:[s,t.jsx("br",{}),t.jsx("strong",{className:"font-semibold",children:a})]})]}),m&&r&&t.jsx(Zs,{cashChange:r,label:i,locale:o,align:"center",className:"max-w-[400px]","data-testid":`${f}-cash-change`}),d&&t.jsx(O,{color:"default",variant:"bordered",radius:"full",size:"lg",onPress:d,"data-testid":`${f}-close`,className:"mt-4 w-full",children:l})]})};Kl.displayName="PaymentSuccessView";const Xs=({heading:e,amountLabel:n,value:s,defaultValue:a,onChange:r,onBlur:i,placeholder:o,isDisabled:l,isInvalid:d,errorMessage:u,autoFocus:f,maxAmount:m,hideHeading:p=!1,className:x,"data-testid":g="payment-sub-amount-input"})=>{const y=`${g}-input`,b=s!==void 0,[j,w]=h.useState(a??""),$=b?s:j,{isUntouched:N,markEdited:A}=Tl($),k=h.useCallback(S=>{if(m!==void 0){const _=Number.parseFloat(S.replace(",","."));if(Number.isFinite(_)&&_>m)return}A(S),b||w(S),r?.(S)},[m,r,A,b]),C=Il(N,k),D=h.useCallback(S=>{const _=S.currentTarget;requestAnimationFrame(()=>{_.isConnected&&_.select()})},[]);return t.jsxs("div",{className:c.cn("flex flex-col gap-3 border-t border-default-100 pt-5",x),"data-testid":g,children:[t.jsx("h3",{className:c.cn("text-lg font-semibold",p&&"sr-only"),"data-testid":`${g}-heading`,children:e}),t.jsx(c.Input,{ref:C,id:y,label:n,labelPlacement:"outside",classNames:p?{label:"sr-only"}:void 0,type:"text",inputMode:"decimal",pattern:"[0-9]*[.,]?[0-9]*",value:$,onChange:S=>k(S.target.value),onFocus:D,onBlur:i,placeholder:o,isDisabled:l,isInvalid:d,errorMessage:d?u:void 0,variant:"bordered",radius:"lg","aria-invalid":d||void 0,autoFocus:f,"data-testid":`${g}-field`})]})};Xs.displayName="PaymentSubAmountInput";const Xx={danger:{tile:"bg-danger-50 text-danger-600",icon:"solar:danger-circle-outline",confirmColor:"danger"},warning:{tile:"bg-warning-50 text-warning-600",icon:"solar:danger-triangle-outline",confirmColor:"warning"}},Jx=e=>typeof e=="string"?t.jsx(P,{icon:e,className:"size-5","aria-hidden":"true"}):e,Js=({isOpen:e,title:n,confirmLabel:s,onConfirm:a,onOpenChange:r,children:i,description:o,cancelLabel:l="Cancel",variant:d="danger",isPending:u=!1,isDismissable:f,isKeyboardDismissDisabled:m=!1,hideIcon:p=!1,icon:x,"data-testid":g="confirm-dialog"})=>{const y=i??o??null,b=Xx[d],j=p?null:Jx(x??b.icon);return t.jsx(Qt,{isOpen:e,onOpenChange:w=>r?.(w),placement:"center",size:"md",isDismissable:(f??!0)&&!u,isKeyboardDismissDisabled:m||u,hideCloseButton:u,className:"gap-4 p-6",classNames:{base:"rounded-3xl"},"data-testid":g,children:t.jsxs(c.ModalContent,{role:"alertdialog",children:[t.jsxs(c.ModalHeader,{className:"flex flex-col items-center gap-3 p-0 text-center",children:[j?t.jsx("div",{"aria-hidden":"true","data-testid":`${g}-icon`,className:c.cn("flex size-10 items-center justify-center rounded-full",b.tile),children:j}):null,t.jsx("span",{"data-testid":`${g}-title`,className:"text-lg font-semibold text-zinc-950",children:n})]}),y!==null?t.jsx(c.ModalBody,{"data-testid":`${g}-body`,className:"gap-0 p-0",children:typeof y=="string"?t.jsx("p",{className:"mx-auto max-w-sm text-center text-sm text-gray-600",children:y}):y}):null,t.jsxs(c.ModalFooter,{className:"flex flex-col-reverse gap-2 p-0 sm:flex-row sm:gap-3",children:[t.jsx(O,{variant:"bordered",color:"default",radius:"full",onPress:()=>r?.(!1),isDisabled:u,"data-testid":`${g}-dismiss`,className:"w-full sm:flex-1",children:l}),t.jsx(O,{color:b.confirmColor,variant:"solid",radius:"full",onPress:a,isLoading:u,"data-testid":`${g}-confirm`,className:"w-full sm:flex-1",children:s})]})]})})};Js.displayName="ConfirmDialog";const pt={item:"list-none",box:"outline-none focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus",body:"gap-3 px-4 py-3",text:"flex min-w-0 flex-col gap-1",message:"text-sm text-gray-900 [overflow-wrap:anywhere]",description:"text-sm text-gray-600 [overflow-wrap:anywhere]",actions:"flex flex-wrap items-center gap-2"},ep={danger:"bg-danger-50",warning:"bg-warning-50"},Yl=({message:e,description:n,confirmLabel:s,cancelLabel:a="Cancel",onConfirm:r,onCancel:i,variant:o="danger",isPending:l=!1,initialFocus:d="cancel",containEscape:u=!0,size:f="sm",as:m="div",className:p,"data-testid":x="inline-confirm"})=>{const g=h.useId(),y=h.useId(),b=h.useRef(null),j=h.useRef(null),w=h.useRef(null),$=n!=null,N=h.useRef({isPending:l,containEscape:u,onCancel:i});N.current={isPending:l,containEscape:u,onCancel:i},h.useEffect(()=>{(d==="confirm"?j:w).current?.focus()},[]),h.useEffect(()=>{const C=b.current;if(C===null)return;const D=S=>{S.key==="Escape"&&(N.current.containEscape&&S.stopPropagation(),!N.current.isPending&&N.current.onCancel())};return C.addEventListener("keydown",D),()=>C.removeEventListener("keydown",D)},[]);const A=h.useRef(!1);h.useLayoutEffect(()=>{const C=b.current;if(C===null)return;const D=document.activeElement;if(l){const S=D===null||D===document.body||!C.contains(D),_=D instanceof HTMLButtonElement&&D.disabled;A.current&&(S||_)&&C.focus({preventScroll:!0});return}D===C&&(d==="confirm"?j:w).current?.focus()},[l,d]);const k=t.jsx(c.Card,{ref:b,role:"alertdialog","aria-modal":"false","aria-labelledby":g,"aria-describedby":$?y:void 0,"aria-busy":l||void 0,tabIndex:-1,shadow:"none",radius:"lg",onFocus:()=>{A.current=!0},onBlur:C=>{const D=C.relatedTarget;A.current=D instanceof Node&&C.currentTarget.contains(D)},className:c.cn(pt.box,ep[o],m==="div"&&p),"data-testid":x,children:t.jsxs(c.CardBody,{className:pt.body,children:[t.jsxs("div",{className:pt.text,children:[t.jsx("p",{id:g,className:pt.message,children:e}),$?t.jsx("p",{id:y,className:pt.description,children:n}):null]}),t.jsxs("div",{className:pt.actions,children:[t.jsx(O,{ref:j,size:f,color:o,variant:"solid",onPress:r,isLoading:l,"data-testid":`${x}-confirm`,children:s}),t.jsx(O,{ref:w,size:f,color:"default",variant:"light",onPress:i,isDisabled:l,"data-testid":`${x}-cancel`,children:a})]})]})});return m==="li"?t.jsx("li",{className:c.cn(pt.item,p),children:k}):k};Yl.displayName="InlineConfirm";const tp={guardScope:(e,n)=>n(),bypass:e=>e(),report:()=>{},unreport:()=>{}},Rn=h.createContext(tp),ea=h.createContext(null);function np(e){const{report:n,unreport:s}=h.useContext(Rn),a=h.useContext(ea),r=h.useId();h.useEffect(()=>{n(r,{scope:a,isDirty:e})},[n,r,a,e]),h.useEffect(()=>()=>s(r),[s,r])}function sp(){const{guardScope:e,bypass:n}=h.useContext(Rn);return h.useMemo(()=>({guard:s=>e(null,s),bypass:n}),[e,n])}function Ql(){const{guardScope:e}=h.useContext(Rn),n=h.useContext(ea);return h.useCallback(s=>e(n,s),[e,n])}const ap=({scope:e,children:n})=>t.jsx(ea.Provider,{value:e,children:n}),Zl=({guard:e,children:n,title:s="Discard changes?",description:a="What you entered will be lost.",confirmLabel:r="Discard",keepEditingLabel:i="Keep editing","data-testid":o="discard-guard"})=>{const{pending:l,confirmKey:d,confirm:u,keepEditing:f,report:m,unreport:p,guardScope:x}=e.internals,g=h.useMemo(()=>({guardScope:x,bypass:e.bypass,report:m,unreport:p}),[x,e.bypass,m,p]);return t.jsxs(Rn.Provider,{value:g,children:[n,t.jsx(Js,{isOpen:l!==null,onOpenChange:y=>{y||f()},onConfirm:u,variant:"warning",title:s,description:a,confirmLabel:r,cancelLabel:i,"data-testid":o},d)]})};Zl.displayName="DiscardGuard";const ta=h.createContext(null);function rp(){const e=h.useContext(ta),n=Ql(),s=e?.back,a=h.useCallback(()=>{s&&n(s)},[n,s]);return{isActive:e?.isActive??!0,canGoBack:e?.canGoBack??!1,back:a}}const ip=["button:not([disabled])","a[href]",'input:not([disabled]):not([type="hidden"])',"select:not([disabled])","textarea:not([disabled])",'[tabindex]:not([tabindex="-1"])','[contenteditable="true"]'].join(",");function lp(e){for(const n of e.querySelectorAll(ip))if(!n.closest('[hidden], [inert], [aria-hidden="true"]'))return n;return null}function fr(e,n){return!e||!e.isConnected||!n.contains(e)||e.matches(":disabled")?!1:!e.closest("[hidden], [inert]")}const op=new Set(["menu","listbox","dialog","grid","tree"]);function cp(e){for(const n of e.querySelectorAll('[aria-expanded="true"][aria-controls]')){const s=n.ownerDocument.getElementById(n.getAttribute("aria-controls")??"");if(!s?.isConnected)continue;if((n.getAttribute("aria-haspopup")??"false")!=="false"||op.has(s.getAttribute("role")??""))return s}return null}const xr="react-aria-focus-scope-restore";class dp{panels=new Map;active=null;setContainer(n,s){s?this.panels.set(n,{entry:null,last:null,...this.panels.get(n),container:s}):this.panels.delete(n)}setEntry(n,s){const a=this.panels.get(n);a?a.entry=s:s&&this.panels.set(n,{container:null,entry:s,last:null})}remember(n,s){const a=this.panels.get(n);a&&(a.last=s)}setActive(n,s){this.active={key:n,isReturn:s}}focusActive(){if(!this.active)return;const n=this.panels.get(this.active.key),s=n?.container;if(!n||!s||s.contains(document.activeElement))return;((this.active.isReturn&&fr(n.last,s)?n.last:null)??(fr(n.entry,s)?n.entry:null)??lp(s))?.focus()}recoverFocus(){const n=this.active?this.panels.get(this.active.key)?.container:null,s=n?cp(n):null;s?.focus(),s?.contains(document.activeElement)||this.focusActive()}}const up="flex flex-initial items-center gap-2 py-4 pl-4 pr-12 text-large font-semibold",mp="min-w-0 flex-1 truncate text-large font-semibold",fp="flex shrink-0 items-center gap-2",xp="size-5";function pp({panels:e,children:n}){const[s]=h.useState(()=>new dp),{entries:a,back:r}=e,i=a[a.length-1].key,o=h.useRef(null);return h.useLayoutEffect(()=>{const l=o.current;o.current={activeKey:i,keys:new Set(a.map(d=>d.key))},!(!l||l.activeKey===i)&&(s.setActive(i,l.keys.has(i)),s.focusActive())},[i,a,s]),t.jsx(t.Fragment,{children:a.map((l,d)=>t.jsx(hp,{entryKey:l.key,isActive:d===a.length-1,canGoBack:d>0,back:r,memory:s,children:n(l.panel,l)},l.key))})}const hp=({entryKey:e,isActive:n,canGoBack:s,back:a,memory:r,children:i})=>{const o=h.useRef(null),l=h.useCallback(u=>r.setEntry(e,u),[r,e]);h.useLayoutEffect(()=>{const u=o.current;if(r.setContainer(e,u),!u)return;const f=m=>{u.hidden&&(m.preventDefault(),r.recoverFocus())};return u.addEventListener(xr,f),()=>{u.removeEventListener(xr,f),r.setContainer(e,null)}},[r,e]);const d=h.useMemo(()=>({isActive:n,canGoBack:s,back:a,setEntryFocus:l}),[n,s,a,l]);return t.jsx(ta.Provider,{value:d,children:t.jsx(ap,{scope:e,children:t.jsx("div",{ref:o,hidden:!n,style:{display:n?"contents":"none"},onFocus:u=>{u.currentTarget.contains(u.target)&&r.remember(e,u.target)},children:i})})})},Xl=({title:e,onBack:n,backLabel:s="Back",isBackDisabled:a,size:r="md",actions:i,className:o,"data-testid":l="modal-panel-header"})=>{const d=h.useContext(ta),u=Ql(),f=h.useId(),m=n??(d?.canGoBack?d.back:void 0);return t.jsxs("header",{className:c.cn(up,o),"data-testid":l,children:[m?t.jsx(O,{ref:d?.setEntryFocus,isIconOnly:!0,variant:"light",color:"default",size:r,"aria-label":s,"aria-describedby":f,isDisabled:a,onPress:()=>u(m),"data-testid":`${l}-back`,children:t.jsx(P,{icon:"solar:arrow-left-outline",className:xp,"aria-hidden":"true"})}):null,t.jsx("h2",{id:f,className:mp,"data-testid":`${l}-title`,children:e}),i?t.jsx("div",{className:fp,children:i}):null]})};Xl.displayName="ModalPanelHeader";function bp(e){const n=h.useRef(1),[s]=h.useState(e),[a,r]=h.useState(()=>[{key:"panel-0",panel:e}]),i=h.useCallback(f=>{const m=`panel-${n.current}`;return n.current+=1,{key:m,panel:f}},[]),o=h.useCallback(f=>{const m=i(f);r(p=>[...p,m])},[i]),l=h.useCallback(()=>{r(f=>f.length>1?f.slice(0,-1):f)},[]),d=h.useCallback(f=>{const m=i(f);r(p=>[...p.slice(0,-1),m])},[i]),u=h.useCallback(f=>{r([i(f===void 0?s:f)])},[i,s]);return h.useMemo(()=>({current:a[a.length-1].panel,entries:a,canGoBack:a.length>1,push:o,back:l,replace:d,reset:u}),[a,o,l,d,u])}function gp(){const e=h.useRef(new Map),[n,s]=h.useState(0),[a,r]=h.useState(null),[i,o]=h.useState(0),l=h.useCallback(()=>{let b=0;for(const j of e.current.values())j.isDirty&&(b+=1);s(b)},[]),d=h.useCallback((b,j)=>{e.current.set(b,j),l()},[l]),u=h.useCallback(b=>{e.current.delete(b),l()},[l]),f=h.useCallback((b,j)=>{let w=!1;for(const $ of e.current.values())$.isDirty&&(b===null||$.scope===b)&&(w=!0);w?r({leave:j}):j()},[]),m=h.useCallback(b=>f(null,b),[f]),p=h.useCallback(b=>{for(const j of e.current.values())j.isDirty=!1;l(),r(null),b()},[l]),x=h.useCallback(b=>j=>{j?b(!0):m(()=>b(!1))},[m]),g=h.useCallback(()=>{const b=a?.leave;r(null),o(j=>j+1),b?.()},[a]),y=h.useCallback(()=>r(null),[]);return h.useMemo(()=>({isDirty:n>0,guard:m,bypass:p,guardOpenChange:x,internals:{pending:a,confirmKey:i,confirm:g,keepEditing:y,report:d,unreport:u,guardScope:f}}),[n,m,p,x,a,i,g,y,d,u,f])}const yp=60,vp=(e,n,s=yp)=>n?e>s:e<-s,Jl=(e,n)=>Math.max(0,Math.min(e,n)),jp=160,wp=(e,n,s=jp)=>Math.min(e,Math.max(0,n-s)),Np=(e,n,s)=>Jl(e-n,s),Cp=(e,n,s)=>e!==null?Jl(e,s):n?s:0,kp=e=>e?"":"transition-[height] duration-300 ease-out",Sp=e=>({onDrag:(n,s)=>{const a=e.open?e.fullHeight:0;e.setDragHeight(Np(a,s?.offset?.y??0,e.fullHeight))},onDragEnd:(n,s)=>{vp(s?.offset?.y??0,e.open)&&e.onToggleOpen?.(),e.setDragHeight(null)}}),yt=(e,n)=>fe(e.value,n,e.currency),pr=`opacity-60 transition-opacity ${Se}`,na=({item:e,locale:n,onRemove:s,removeAriaLabel:a,showRemoveButton:r=!0,compact:i=!1})=>{const o=!!e.children&&e.children.length>0,l=!!s&&r&&e.removable!==!1,d=e.tone?"text-default-600":"text-default-500";return t.jsxs("div",{"data-testid":`summary-item-${e.id}`,className:c.cn(i?"flex flex-col gap-1 py-3 first:pt-0":"flex flex-col gap-2",e.tone&&"-mx-2 rounded-lg px-2 py-1.5"),style:e.tone?{backgroundColor:He[e.tone].bg}:void 0,children:[t.jsxs("div",{className:i?"flex items-start justify-between gap-2":"flex min-h-9 items-center justify-between gap-2",children:[t.jsxs("div",{className:"flex min-w-0 items-center gap-2 text-base text-foreground",children:[!i&&typeof e.quantity=="number"&&t.jsxs("span",{"data-testid":`summary-item-qty-${e.id}`,className:"shrink-0",children:[e.quantity," x"]}),e.leadingIcon,t.jsx("span",{"data-testid":`summary-item-name-${e.id}`,className:i?"line-clamp-2 text-sm font-semibold":c.cn("truncate",e.emphasis&&"font-medium"),children:e.name})]}),t.jsxs("div",{className:"flex shrink-0 items-center",children:[e.originalAmount&&t.jsx("span",{"data-testid":`summary-item-original-${e.id}`,className:c.cn("mr-2 whitespace-nowrap text-[0.8125rem] text-default-600 line-through",e.pending&&pr),children:e.originalAmount}),e.amount&&t.jsx("span",{"data-testid":`summary-item-amount-${e.id}`,"data-pending":e.pending?"true":void 0,className:c.cn(i?"whitespace-nowrap text-sm font-semibold text-foreground":"whitespace-nowrap text-base text-foreground",e.pending&&pr),children:yt(e.amount,n)}),l&&t.jsx(O,{isIconOnly:!0,size:"sm",variant:"light",radius:"full",className:c.cn("ml-1 size-8 min-w-8 p-2 text-danger",i&&"-my-1.5"),"aria-label":a,"data-testid":`summary-remove-${e.id}`,onPress:()=>s(e.id),children:t.jsx(P,{icon:"lucide:trash-2",width:16,height:16,className:"text-danger"})})]})]}),le(e.trailing)&&t.jsx("div",{"data-testid":`summary-item-trailing-${e.id}`,className:"flex justify-end",children:e.trailing}),e.dateLabel&&t.jsxs("div",{"data-testid":`summary-item-date-${e.id}`,className:c.cn("flex items-center gap-2 text-sm",d),children:[t.jsx(P,{icon:"lucide:calendar",width:16,height:16,className:"shrink-0"}),t.jsx("span",{className:"truncate",children:e.dateLabel})]}),e.dateRange&&t.jsxs("div",{"data-testid":`summary-item-daterange-${e.id}`,className:c.cn("flex items-center gap-2 text-sm",d),children:[t.jsx(P,{icon:"lucide:calendar",width:16,height:16,className:"shrink-0"}),t.jsx("span",{children:e.dateRange.from}),t.jsx(P,{icon:"lucide:arrow-right",width:16,height:16,className:"shrink-0"}),t.jsx("span",{children:e.dateRange.to})]}),e.details?.map((u,f)=>t.jsxs("div",{"data-testid":`summary-item-detail-${e.id}-${u.key??f}`,className:c.cn("flex items-center justify-between gap-2",i?"text-xs":"text-sm",d),children:[t.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[u.icon,t.jsx("span",{className:"truncate",children:u.label})]}),(u.value!=null||u.tooltip!=null)&&t.jsxs("div",{className:"flex shrink-0 items-center gap-1",children:[u.value!=null&&t.jsx("span",{className:c.cn("whitespace-nowrap",u.valueTone==="primary"&&c.cn("font-medium",e.tone?"text-primary-600":"text-primary")),children:u.value}),u.tooltip!=null&&t.jsx(c.Tooltip,{content:u.tooltip,children:t.jsx("span",{"data-testid":`summary-item-detail-tooltip-${e.id}-${u.key??f}`,className:"flex shrink-0 items-center",children:t.jsx(P,{icon:"lucide:info",width:16,height:16,className:c.cn(u.valueTone==="primary"?"text-primary":"text-default-400")})})})]})]},u.key??f)),o&&t.jsx("div",{"data-testid":`summary-children-${e.id}`,className:"flex flex-col gap-2 pl-6",children:e.children.map(u=>t.jsx(na,{item:u,locale:n,onRemove:s,removeAriaLabel:a,showRemoveButton:r,compact:i},u.id))})]})};na.displayName="SummaryItemRow";const eo=({fee:e,locale:n,className:s})=>t.jsxs("div",{"data-testid":"summary-service-fee",className:c.cn("flex items-center justify-between gap-2",s),children:[t.jsxs("button",{type:"button",role:"switch","aria-checked":!!e.isSelected,"aria-label":typeof e.label=="string"?e.label:"Pay Service fee","data-testid":"summary-service-fee-toggle",onClick:e.onToggle,className:"flex min-w-0 items-center gap-2 text-left",children:[t.jsx("span",{"aria-hidden":"true",className:c.cn("flex size-4 shrink-0 items-center justify-center rounded-full border",e.isSelected?"border-primary":"border-default-200"),children:e.isSelected&&t.jsx("span",{className:"size-2 rounded-full bg-primary"})}),t.jsx("span",{className:"truncate text-sm font-medium text-foreground",children:e.label})]}),t.jsx("span",{"data-testid":"summary-service-fee-amount",className:"whitespace-nowrap text-base text-foreground",children:yt(e.amount,n)})]});eo.displayName="SummaryServiceFeeRow";const sa=({row:e,locale:n,emphasized:s,onRemove:a,removeAriaLabel:r,showRemoveButton:i=!0,compact:o=!1})=>{const l=!!a&&i&&!!e.id,d=t.jsx("span",{"data-testid":`summary-row-label-${e.key}`,className:o?void 0:c.cn(s?"text-xl font-semibold leading-7":"text-base"),children:e.label});return t.jsxs("div",{"data-testid":`summary-row-${e.key}`,className:o?"flex items-center justify-between text-sm text-default-500":"flex items-center justify-between text-foreground",children:[l?t.jsxs("div",{className:"flex min-w-0 items-center",children:[d,t.jsx(O,{isIconOnly:!0,size:"sm",variant:"light",radius:"full",className:c.cn("ml-1 size-8 min-w-8 shrink-0 p-2 text-danger",o&&"-my-1.5"),"aria-label":r,"data-testid":`summary-remove-row-${e.id}`,onPress:()=>a(e.id),children:t.jsx(P,{icon:"lucide:trash-2",width:16,height:16,className:"text-danger"})})]}):d,t.jsx("span",{"data-testid":`summary-row-amount-${e.key}`,className:c.cn("whitespace-nowrap",!o&&"text-base",e.amountTone==="success"&&"text-success"),children:yt(e.amount,n)})]})};sa.displayName="SummaryTotalsLineRow";const to=({pricesInLabel:e,currency:n,items:s,serviceFee:a,rows:r,locale:i,onRemoveItem:o,removeAriaLabel:l,onRemoveTotalRow:d,removeTotalRowAriaLabel:u,showRemoveButton:f,emptyState:m,compact:p=!1,classNames:x})=>{const g=(s?.length??0)>0;return t.jsxs(t.Fragment,{children:[!p&&t.jsxs("div",{"data-testid":"summary-prices",className:c.cn("flex items-center justify-between text-xs text-default-500",x.prices),children:[t.jsx("span",{children:e}),n!=null&&t.jsx("span",{children:n})]}),g?t.jsx("div",{className:c.cn(p?"flex flex-col divide-y divide-default-100":"flex flex-col gap-4",x.items),children:s.map(y=>t.jsx(na,{item:y,locale:i,onRemove:o,removeAriaLabel:l,showRemoveButton:f,compact:p},y.id))}):t.jsx("div",{"data-testid":"summary-empty",children:m}),a&&t.jsxs(t.Fragment,{children:[t.jsx(c.Divider,{className:"bg-default-100"}),t.jsx(eo,{fee:a,locale:i,className:x.serviceFee})]}),r&&r.length>0&&t.jsx("div",{className:c.cn(p?c.cn("flex flex-col gap-1 pt-3",!a&&"border-t border-default-100"):"flex flex-col gap-4",x.totalsRows),children:r.map((y,b)=>t.jsx(sa,{row:y,locale:i,emphasized:!p&&b===0,onRemove:d,removeAriaLabel:u,showRemoveButton:f,compact:p},y.key))})]})};to.displayName="SummaryBody";const no=({total:e,locale:n,compact:s=!1,className:a})=>{const r=s?"text-lg":"text-xl";return t.jsxs("div",{"data-testid":"summary-total",className:c.cn(`flex items-center justify-between ${r} font-semibold leading-7 text-foreground`,a),children:[t.jsx("span",{children:e.label??"Total"}),t.jsx("span",{"data-testid":"summary-total-amount",className:`whitespace-nowrap ${r} font-semibold leading-7`,children:yt(e.amount,n)})]})};no.displayName="SummaryGrandTotalRow";const so=({secondaryTotal:e,locale:n,className:s})=>t.jsxs("div",{"data-testid":"summary-secondary-total",className:c.cn("flex items-center justify-between text-lg font-semibold leading-7 text-primary",s),children:[t.jsx("span",{children:e.label}),t.jsx("span",{"data-testid":"summary-secondary-total-amount",className:"whitespace-nowrap text-lg font-semibold leading-7",children:yt(e.amount,n)})]});so.displayName="SummarySecondaryTotalRow";const wn=({action:e,disabledByLoading:n,className:s,testId:a="summary-cta"})=>t.jsx(O,{color:"primary",radius:"full",className:c.cn("px-[18px] py-[14px] font-medium",s),"data-testid":a,isLoading:e.isLoading,isDisabled:e.isDisabled||n,onPress:e.onPress,endContent:t.jsx(P,{icon:"lucide:arrow-right",width:16,height:16}),children:e.label});wn.displayName="SummaryPrimaryCta";const ao=({title:e,total:n,secondaryTotal:s,locale:a,open:r,progress:i,dragging:o,toggleAriaLabel:l,onToggleOpen:d,classNames:u})=>t.jsx("h2",{children:t.jsxs("button",{type:"button","data-testid":"summary-collapse-toggle","aria-expanded":r,"aria-label":l,onClick:d,className:c.cn("-mx-4 -mt-4 grid w-[calc(100%_+_32px)] grid-cols-1 px-4 pb-4 pt-4 text-left",u.header),children:[t.jsxs("span",{"aria-hidden":!r,style:{opacity:i},className:c.cn("col-start-1 row-start-1 flex items-center justify-between",!o&&"transition-opacity duration-300"),children:[t.jsx("span",{"data-testid":"summary-title",className:c.cn("text-xl font-semibold leading-7 text-foreground",u.title),children:e}),t.jsx("span",{"data-testid":"summary-close","aria-hidden":"true",className:c.cn("shrink-0 text-foreground",u.closeButton),children:t.jsx(P,{icon:"lucide:x",width:20,height:20})})]}),t.jsxs("span",{"aria-hidden":r,style:{opacity:1-i},className:c.cn("col-start-1 row-start-1 flex flex-col gap-2",!o&&"transition-opacity duration-300"),children:[t.jsxs("span",{className:"flex items-center justify-between text-xl font-semibold leading-7 text-foreground",children:[t.jsx("span",{children:n.label??"Total"}),t.jsx("span",{className:"whitespace-nowrap",children:yt(n.amount,a)})]}),s&&t.jsxs("span",{className:"flex items-center justify-between text-lg font-semibold leading-7 text-primary",children:[t.jsx("span",{children:s.label}),t.jsx("span",{className:"whitespace-nowrap",children:yt(s.amount,a)})]})]})]})});ao.displayName="SummaryCollapseHeader";const ro=({cart:e,ariaLabel:n,onPress:s,className:a})=>t.jsxs("button",{type:"button","data-testid":"summary-cart","aria-label":n,onClick:s,className:c.cn("relative flex size-[52px] shrink-0 items-center justify-center rounded-full border border-default-200 bg-content1",a),children:[t.jsx(P,{icon:"lucide:shopping-bag",width:24,height:24,className:"text-foreground"}),e.count!=null&&t.jsx("span",{"data-testid":"summary-cart-badge",className:"absolute -right-1 -top-1 flex size-4 items-center justify-center rounded-full bg-primary text-xs text-primary-foreground",children:e.count})]});ro.displayName="SummaryCartButton";const io=({open:e,progress:n,dragging:s,primaryAction:a,isLoading:r,cart:i,cartAriaLabel:o,ctaCaption:l,ctaError:d,onToggleOpen:u,classNames:f})=>t.jsxs("div",{"data-testid":"summary-mobile-bar",className:c.cn("flex flex-col gap-4",f.mobileBar),children:[t.jsx(c.Divider,{className:"bg-default-200"}),d&&t.jsx("div",{children:d}),t.jsxs("div",{className:"grid",children:[t.jsxs("div",{"aria-hidden":e,style:{opacity:1-n},className:c.cn("col-start-1 row-start-1 flex items-stretch gap-2.5",e&&"pointer-events-none",!s&&"transition-opacity duration-300"),children:[i&&t.jsx(ro,{cart:i,ariaLabel:o,className:f.cart,onPress:()=>{u?.(),i.onPress?.()}}),a&&t.jsx(wn,{action:a,disabledByLoading:r,className:c.cn("h-[52px] flex-1",f.cta),testId:"summary-cta-compact"})]}),a&&t.jsx("div",{"aria-hidden":!e,style:{opacity:n},className:c.cn("col-start-1 row-start-1 flex",!e&&"pointer-events-none",!s&&"transition-opacity duration-300"),children:t.jsx(wn,{action:a,disabledByLoading:r,className:c.cn("h-[52px] w-full",f.cta)})})]}),l&&t.jsx("div",{children:l})]});io.displayName="SummaryActionBar";const $p="(max-width: 767px)",Ap=e=>typeof window<"u"&&typeof window.matchMedia=="function"?window.matchMedia(e).matches:!1,Dp=(e=$p)=>{const[n,s]=h.useState(()=>Ap(e));return h.useEffect(()=>{if(typeof window>"u"||typeof window.matchMedia!="function")return;const a=window.matchMedia(e),r=()=>s(a.matches);return r(),a.addEventListener("change",r),()=>a.removeEventListener("change",r)},[e]),n},lo=({title:e="Summary",pricesInLabel:n="Prices are in",currency:s,locale:a="en-US",items:r,serviceFee:i,rows:o,total:l,postTotalRows:d,onRemoveTotalRow:u,onRemovePostTotalRow:f,secondaryTotal:m,collapsible:p,isOpen:x,onToggleOpen:g,defaultOpen:y=!1,primaryAction:b,isLoading:j=!1,onRemoveItem:w,showRemoveButton:$,ctaCaption:N,ctaError:A,variant:k,cart:C,emptyState:D,labels:S,classNames:_={},density:F="default","data-testid":L="summary",className:M})=>{const I=S?.removeAriaLabel??"Remove item",W=S?.removeTotalRowAriaLabel??"Remove discount",K=S?.removePostTotalRowAriaLabel??"Remove applied code",z=S?.toggleAriaLabel??"Toggle summary",ne=S?.cartAriaLabel??"View cart",G=F==="compact",se=Dp(),oe=p??(k??(se?"mobile":"main"))==="mobile",[J,q]=h.useState(y),re=x!==void 0,V=!oe||(re?x:J),ee=h.useCallback(()=>{re||q(T=>!T),g?.()},[re,g]),[te,Fe]=h.useState(0),[Z,he]=h.useState(null),Je=h.useRef(null),We=h.useRef(null),ve=h.useCallback(()=>{const T=Je.current;T&&Fe(wp(T.scrollHeight,window.innerHeight))},[]),qe=h.useCallback(T=>{We.current?.disconnect(),We.current=null,Je.current=T,T&&(ve(),typeof ResizeObserver<"u"&&(We.current=new ResizeObserver(ve),We.current.observe(T)))},[ve]);h.useEffect(()=>(window.addEventListener("resize",ve),()=>window.removeEventListener("resize",ve)),[ve]);const ot=Sp({open:V,fullHeight:te,setDragHeight:he,onToggleOpen:ee}),Ge=Z!==null,me=Cp(Z,V,te),$e=te>0?Math.min(1,Math.max(0,me/te)):V?1:0,et=t.jsx(no,{total:l,locale:a,compact:G,className:_.total}),v=d&&d.length>0&&t.jsx("div",{"data-testid":"summary-post-total-rows",className:"flex flex-col gap-4",children:d.map(T=>t.jsx(sa,{row:T,locale:a,emphasized:!1,onRemove:f,removeAriaLabel:K,showRemoveButton:$,compact:G},T.key))}),E=m&&t.jsx(so,{secondaryTotal:m,locale:a,className:_.secondaryTotal}),R=N!=null&&t.jsx("p",{"data-testid":"summary-cta-caption",className:c.cn("text-center text-sm text-default-500",_.ctaCaption),children:N}),U=A!=null&&t.jsx("p",{role:"alert","data-testid":"summary-cta-error",className:c.cn("text-center text-sm text-danger",_.ctaError),children:A}),B=t.jsx(to,{pricesInLabel:n,currency:s,items:r,serviceFee:i,rows:o,locale:a,onRemoveItem:w,removeAriaLabel:I,onRemoveTotalRow:u,removeTotalRowAriaLabel:W,showRemoveButton:$,emptyState:D,compact:G,classNames:_});return oe?t.jsxs(Te.motion.section,{"data-testid":L,drag:"y",dragConstraints:{top:0,bottom:0},dragElastic:.12,dragSnapToOrigin:!0,onDrag:ot.onDrag,onDragEnd:ot.onDragEnd,className:c.cn("fixed inset-x-0 bottom-0 z-50 flex max-h-full w-full flex-col rounded-t-2xl bg-content1 p-4 drop-shadow-[0_-2px_2px_rgba(0,0,0,0.1)]",M,_.base),children:[t.jsx(ao,{title:e,total:l,secondaryTotal:m,locale:a,open:V,progress:$e,dragging:Ge,toggleAriaLabel:z,onToggleOpen:ee,classNames:_}),t.jsx("div",{"data-testid":"summary-reveal","aria-hidden":!V,style:{height:me},className:c.cn("min-h-0",V&&!Ge?"overflow-y-auto overscroll-contain [scrollbar-width:none] [&::-webkit-scrollbar]:hidden":"overflow-hidden",!V&&"pointer-events-none",kp(Ge)),children:t.jsxs("div",{ref:qe,className:G?"flex flex-col gap-3 pb-4":"flex flex-col gap-4 pb-4",children:[B,!G&&t.jsx(c.Divider,{className:"bg-default-200"}),et,v,E]})}),t.jsx(io,{open:V,progress:$e,dragging:Ge,primaryAction:b,isLoading:j,cart:C,cartAriaLabel:ne,ctaCaption:R,ctaError:U,onToggleOpen:ee,classNames:_})]}):t.jsxs("section",{"data-testid":L,className:c.cn(G?"flex w-full flex-col gap-3 rounded-2xl border border-default-200 bg-content1 p-4":"flex w-full flex-col gap-4 rounded-2xl border border-default-200 bg-content1 p-4",M,_.base),children:[!G&&t.jsx("div",{className:c.cn("flex items-center justify-between",_.header),children:t.jsx("h2",{"data-testid":"summary-title",className:c.cn("text-xl font-semibold leading-7 text-foreground",_.title),children:e})}),B,!G&&t.jsx(c.Divider,{className:"bg-default-200"}),et,v,E,m&&b&&t.jsx(c.Divider,{className:"bg-default-200"}),b&&t.jsx(wn,{action:b,disabledByLoading:j,className:c.cn("w-full",_.cta)}),U,R]})};lo.displayName="Summary";const nt={bare:"flex gap-1.5",list:"m-0 flex list-none gap-4 p-0",item:"flex min-w-0 flex-1 flex-col",step:"flex min-w-0 flex-1 flex-col items-stretch gap-1.5 text-left",button:"cursor-pointer rounded-md border-none bg-transparent p-0 font-[inherit] outline-none focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-[0.1875rem] focus-visible:outline-primary disabled:cursor-default",segment:"block h-1 rounded-full",name:"flex min-w-0 items-center gap-[0.3125rem] truncate text-xs font-semibold leading-[1.125rem]",check:"flex h-[0.8125rem] w-[0.8125rem] shrink-0"},hr={done:"bg-pos-ok",active:"bg-primary",upcoming:"bg-pos-line"},Ep={done:"text-pos-ok",active:"text-pos-ink",upcoming:"text-pos-muted"},Lp={ariaLabel:"Progress",completed:"completed"},aa=({steps:e,activeStepId:n,showLabels:s=!0,onStepPress:a,isStepReachable:r,labels:i,className:o,"data-testid":l="step-progress"})=>{const d={...Lp,...i},u=e.filter(p=>p.state!=="skipped"),f=Math.max(0,u.findIndex(p=>p.id===n)),m=p=>p<f?"done":p===f?"active":"upcoming";return s?t.jsx("ol",{"aria-label":d.ariaLabel,className:c.cn(nt.list,o),"data-testid":l,children:u.map((p,x)=>{const g=m(x),y=t.jsxs(t.Fragment,{children:[t.jsx("span",{"aria-hidden":"true",className:c.cn(nt.segment,"w-full",hr[g]),"data-testid":`${l}-segment-${p.id}`}),t.jsxs("span",{className:c.cn(nt.name,Ep[g]),"data-testid":`${l}-name-${p.id}`,children:[g==="done"&&t.jsx("span",{"aria-hidden":"true",className:nt.check,"data-testid":`${l}-check-${p.id}`,children:t.jsx(P,{icon:"solar:check-circle-bold",width:"100%",height:"100%"})}),t.jsx("span",{className:"truncate",children:p.label}),g==="done"&&t.jsxs("span",{className:"sr-only",children:[", ",d.completed]})]})]}),b=r?r(p.id,x):x<f,j=g==="active"?"step":void 0;return t.jsx("li",{className:nt.item,"aria-current":a?void 0:j,"data-state":g,"data-testid":`${l}-step-${p.id}`,children:a?t.jsx("button",{type:"button",className:c.cn(nt.step,nt.button),disabled:!b,"aria-current":j,onClick:()=>a(p.id),"data-testid":`${l}-button-${p.id}`,children:y}):t.jsx("div",{className:nt.step,children:y})},p.id)})}):t.jsx("div",{"aria-hidden":"true",className:c.cn(nt.bare,o),"data-testid":l,children:u.map((p,x)=>t.jsx("span",{className:c.cn(nt.segment,"flex-1",hr[m(x)]),"data-state":m(x)},p.id))})};aa.displayName="StepProgress";const Fp={back:"Back",close:"Close",cancel:"Cancel",partialBadge:"Partial refund",owesBadge:"Customer owes",ofSeparator:"of"},Rp={backgroundColor:ie.destructive,color:"#fff"},_p={warn:{backgroundColor:ie["warn-fill"],color:ie.warn},ok:{backgroundColor:ie["ok-fill"],color:ie.ok},neutral:{backgroundColor:"hsl(var(--heroui-default-100))",color:"hsl(var(--heroui-default-600))",border:`1px solid ${ie.line}`}},ns="inline-flex h-[22px] items-center gap-[5px] whitespace-nowrap rounded-full px-[9px] text-xs font-medium leading-none",ss="absolute top-0 h-5 w-5 opacity-0",oo=({onClose:e,steps:n,activeStepId:s,subtitle:a,onBack:r,primaryAction:i,totalRow:o,secondaryAction:l,hideChrome:d,footerSummary:u,labels:f,className:m,"data-testid":p="wizard-shell",children:x})=>{const g={...Fp,...f},y=n.find(w=>w.id===s),b=r??e,j=r?g.back:g.cancel;return t.jsxs("div",{className:c.cn("flex h-full min-h-0 w-full flex-col bg-white text-default-900",m),"data-testid":p,children:[!d&&t.jsxs("header",{className:"flex shrink-0 flex-wrap items-center gap-2.5 border-b border-pos-line px-6 py-4","data-testid":`${p}-header`,children:[b&&t.jsx(O,{variant:"light",className:"h-10 min-w-0 gap-2 rounded-xl px-4 text-sm font-semibold text-default-600",onPress:b,"data-testid":`${p}-header-back`,startContent:t.jsx(P,{icon:"lucide:circle-chevron-left",width:18,height:18,"aria-hidden":"true"}),children:j}),t.jsxs("div",{className:"min-w-0",children:[t.jsx("h2",{className:"text-lg font-semibold","data-testid":`${p}-header-title`,children:y?.label??""}),a&&t.jsx("div",{className:"mt-0.5 text-[12.5px] text-default-500","data-testid":`${p}-header-subtitle`,children:a})]}),t.jsxs("div",{className:"relative flex-1","data-testid":`${p}-footer`,children:[e&&t.jsx("button",{type:"button","aria-label":g.close,onClick:e,className:c.cn(ss,"left-0"),"data-testid":`${p}-header-close`}),r&&t.jsx("button",{type:"button","aria-label":g.back,onClick:r,className:c.cn(ss,"left-6"),"data-testid":`${p}-back`}),l&&t.jsx("button",{type:"button","aria-label":l.label,disabled:l.disabled,onClick:l.onClick,className:c.cn(ss,"left-12"),"data-testid":`${p}-secondary`})]}),t.jsxs("div",{className:"flex w-full flex-wrap items-center justify-between gap-3 sm:w-auto sm:flex-nowrap sm:justify-end sm:gap-4",children:[o&&t.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-[12.5px] font-semibold text-default-600","data-testid":`${p}-total`,children:[t.jsx("span",{children:o.label}),o.amount&&t.jsx("span",{className:"tabular-nums text-default-900",children:fe(o.amount.value,void 0,o.amount.currency)}),o.of&&t.jsxs(t.Fragment,{children:[t.jsx("span",{children:g.ofSeparator}),t.jsx("span",{className:"tabular-nums text-default-900","data-testid":`${p}-total-of`,children:fe(o.of.value,void 0,o.of.currency)})]}),o.badge==="partial"&&t.jsx("span",{className:c.cn(ns,"bg-pos-warn-fill text-pos-warn"),"data-testid":`${p}-total-partial`,children:g.partialBadge}),o.badge==="owes"&&t.jsx("span",{className:c.cn(ns,"border border-pos-line bg-default-100 text-default-600"),"data-testid":`${p}-total-owes`,children:g.owesBadge}),typeof o.badge=="object"&&t.jsx("span",{className:ns,style:_p[o.badge.tone],"data-tone":o.badge.tone,"data-testid":`${p}-total-badge`,children:o.badge.label})]}),t.jsx(O,{color:"primary",className:c.cn("h-12 min-w-0 rounded-[14px] px-5 text-[15px] font-semibold",i.tone==="destructive"&&"bg-pos-destructive text-white"),style:i.tone==="destructive"?Rp:void 0,isLoading:i.loading,isDisabled:i.disabled,onPress:i.onClick,"data-testid":`${p}-primary`,children:i.label})]})]}),t.jsx(aa,{steps:n,activeStepId:s,showLabels:!1,className:"shrink-0 px-6 py-2.5","data-testid":`${p}-stepper`}),t.jsx("div",{className:"min-h-0 flex-1 overflow-auto px-6 py-[22px]","data-testid":`${p}-body`,children:x}),u]})};oo.displayName="WizardShell";const Mp=(e,n,s)=>Math.min(Math.max(e,n),s);function ys(e,n,s){const a=Math.max(1,Math.trunc(n)),r=Mp(Math.trunc(s),0,a);if(r===a)return{...e};if(r===0)return{value:0,currency:e.currency};const i=Math.pow(10,Et(e.currency)),o=Math.round(e.value*i),l=Math.floor(o/a),d=o-l*a;return{value:(l*r+Math.min(r,d))/i,currency:e.currency}}function Pp(e,n){return ys(e,n,1)}const Tp=e=>Number.isFinite(e)?e.toFixed(2):"",vs=({value:e,expected:n,max:s,onChange:a,ariaLabel:r,isDisabled:i,className:o,"data-testid":l,inputTestId:d})=>{const[u,f]=h.useState(null),m=h.useRef(null),p=Math.abs(e-n)>.004;return t.jsxs("span",{className:c.cn("inline-flex h-11 items-center gap-px rounded-[10px] border px-2.5","focus-within:border-primary focus-within:ring-[3px] focus-within:ring-primary/10",p?"border-primary bg-primary-50":"border-pos-line bg-white",o),"data-testid":l,children:[t.jsx("span",{className:"text-[13px] text-default-600",children:"$"}),t.jsx("input",{ref:m,type:"text",inputMode:"decimal","aria-label":r,disabled:i,className:"w-full border-none bg-transparent p-0 text-right text-sm font-semibold tabular-nums text-default-900 outline-none",value:u??Tp(e),onChange:x=>{const g=x.target.value,y=Number.parseFloat(g.replace(",","."));s!==void 0&&Number.isFinite(y)&&y>s+.004||(f(g),Number.isFinite(y)&&y>=0?a(y):g.trim()===""&&a(0))},onFocus:x=>x.currentTarget.select(),onBlur:()=>f(null),"data-testid":d})]})};vs.displayName="AmountCell";const Ip={refunded:"Refunded",ineligible:"Ineligible",partialLink:"Refund partial $ of this line",partialOf:"of {amount}",partialCancel:"Cancel",restockTitle:"Restock this item",restockHint:"Returns to current location.",decrease:"Decrease {name}",increase:"Increase {name}",amount:"Refund amount for {name}",adjustmentNote:"Item stays with customer — price adjustment",maxNote:"Max {count} purchased",disposition:"Disposition",dispositionStock:"Back to stock",dispositionNoRestock:"Not restocked",dispositionDamaged:"Damaged → Cardex",amountOnlyAdd:"Refund an amount",amountOnlyTitle:"Refund an amount",amountOnlyDetail:"Not tied to an item · up to {amount} remaining",amountOnlyRemove:"Remove amount refund"},Op="inline-flex h-[22px] shrink-0 items-center gap-[5px] whitespace-nowrap rounded-full border border-pos-line bg-default-100 px-[9px] text-xs font-medium leading-none text-default-600",br="flex h-11 flex-1 items-center justify-center bg-white text-lg text-default-900 outline-none transition-colors hover:bg-default-100 disabled:opacity-50 focus-visible:outline focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-primary",as="absolute h-5 w-5 opacity-0",zp=e=>{const n=fe(e.paidAmount.value,void 0,e.paidAmount.currency);if(e.quantity<=1)return n;const s=Pp(e.paidAmount,e.quantity);return`${e.quantity} × ${fe(s.value,void 0,s.currency)} · ${n}`},co=({items:e,selections:n,onSelectionChange:s,onRestockToggle:a,onDispositionChange:r,amountOnly:i,labels:o,className:l,"data-testid":d="line-item-list"})=>{const u={...Ip,...o},f=[{key:"stock",label:u.dispositionStock},{key:"norestock",label:u.dispositionNoRestock},{key:"damaged",label:u.dispositionDamaged}];return t.jsxs("div",{className:c.cn("flex flex-col text-default-900",l),"data-testid":d,children:[e.map(m=>{const p=n[m.id],x=m.state==="already_refunded"||m.state==="non_refundable",g=`${d}-row-${m.id}`,y=Math.max(1,Math.trunc(m.quantity)),b=p?.quantity,j=p?.selected?Math.min(b??y,y):b??0,w=ys(m.paidAmount,y,j).value,$=p?.amount??(p?.selected?w:0),N=j===0&&$>.004,A=C=>s(m.id,{selected:C.quantity>0||C.amount>.004,mode:"full",...C}),k=C=>{const D=Math.min(Math.max(C,0),y);A({quantity:D,amount:ys(m.paidAmount,y,D).value})};return t.jsxs("div",{className:c.cn("relative flex items-start gap-3 border-b border-pos-line-2 py-3 last:border-b-0",x&&"opacity-60"),"data-testid":g,children:[t.jsx("div",{className:"flex h-10 w-10 shrink-0 items-center justify-center rounded-[10px] bg-default-100 text-default-600","data-testid":`${g}-icon`,children:t.jsx(P,{icon:m.icon??"lucide:package",width:19,height:19,"aria-hidden":"true"})}),t.jsxs("div",{className:"min-w-0 flex-1",children:[t.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[t.jsxs("div",{className:"min-w-0",children:[t.jsx("p",{className:"truncate text-sm font-semibold",children:m.name}),t.jsx("p",{className:"text-[12.5px] text-default-500","data-testid":`${g}-detail`,children:m.detail??zp(m)}),N&&t.jsx("p",{className:"mt-[3px] text-[12.5px] italic text-default-500","data-testid":`${g}-adjustment-note`,children:u.adjustmentNote})]}),t.jsxs("div",{className:"flex w-full flex-wrap items-center gap-2.5 sm:w-auto sm:flex-nowrap","data-testid":`${g}-partial`,children:[x?t.jsx("span",{className:"text-sm font-semibold tabular-nums",children:fe(m.paidAmount.value,void 0,m.paidAmount.currency)}):t.jsx(vs,{value:$,expected:w,max:m.paidAmount.value,onChange:C=>A({quantity:j,amount:C}),ariaLabel:u.amount.replace("{name}",m.name),className:"w-[120px]","data-testid":`${g}-amount`,inputTestId:`${g}-partial-input-field`}),x?t.jsx("span",{className:Op,"data-testid":`${g}-blocked`,children:m.state==="already_refunded"?u.refunded:u.ineligible}):t.jsxs("div",{role:"group","aria-label":m.name,className:"flex w-[160px] shrink-0 items-center gap-0.5 overflow-hidden rounded-[10px] border border-pos-line","data-testid":`${g}-qty`,children:[t.jsx("button",{type:"button",className:br,"aria-label":u.decrease.replace("{name}",m.name),disabled:j===0,onClick:()=>k(j-1),"data-testid":`${g}-qty-decrease`,children:"−"}),t.jsx("span",{"aria-live":"polite",className:"min-w-8 flex-1 text-center text-[15px] font-semibold tabular-nums","data-testid":`${g}-qty-value`,children:j}),t.jsx("button",{type:"button",className:br,"aria-label":u.increase.replace("{name}",m.name),disabled:j===y,onClick:()=>k(j+1),"data-testid":`${g}-qty-increase`,children:"+"})]})]})]}),j>=y&&t.jsx("p",{className:"mt-2 text-xs text-default-500","data-testid":`${g}-max-note`,children:u.maxNote.replace("{count}",String(y))}),p?.selected&&!m.restock.available&&m.restock.unavailableHint&&t.jsx("p",{className:"mt-2 text-xs text-default-500",children:m.restock.unavailableHint}),m.warning&&t.jsxs("div",{className:"mt-2.5 flex items-start gap-2 rounded-[10px] bg-pos-warn-fill px-2.5 py-2 text-[12.5px] text-pos-warn","data-testid":`${g}-warning`,children:[t.jsx(P,{icon:"gravity-ui:triangle-exclamation-fill",width:15,height:15,className:"mt-0.5 shrink-0","aria-hidden":"true"}),t.jsx("span",{children:m.warning})]}),j>0&&m.restock.available&&t.jsxs("div",{className:"mt-2.5 flex flex-wrap items-center gap-2",children:[t.jsx("span",{className:"mr-0.5 text-[11px] font-semibold uppercase tracking-[.04em] text-default-500",children:u.disposition}),t.jsx(Xe,{"aria-label":u.disposition,className:"w-[220px]",selectedKeys:[m.restock.disposition??(m.restock.on?"stock":"norestock")],onSelectionChange:C=>{if(C==="all")return;const D=[...C][0];D&&(r?.(m.id,D),a(m.id,D==="stock"))},"data-testid":`${g}-restock`,children:f.map(C=>t.jsx(c.SelectItem,{children:C.label},C.key))})]})]}),!x&&t.jsxs(t.Fragment,{children:[t.jsx(c.Checkbox,{className:c.cn(as,"right-0 top-0 m-0 p-0"),isSelected:!!p?.selected,onValueChange:C=>s(m.id,{selected:C,mode:"full"}),"aria-label":m.name,"data-testid":`${g}-checkbox`}),t.jsx("button",{type:"button","aria-label":u.partialLink,onClick:()=>document.querySelector(`[data-testid="${g}-partial-input-field"]`)?.focus(),className:c.cn(as,"left-0 top-0"),"data-testid":`${g}-partial-link`}),t.jsx("button",{type:"button","aria-label":u.partialCancel,onClick:()=>A({quantity:j,amount:w}),className:c.cn(as,"left-5 top-0"),"data-testid":`${g}-partial-cancel`})]})]},m.id)}),i&&(i.value===null?t.jsxs("button",{type:"button",onClick:i.onAdd,className:"mt-1 inline-flex items-center gap-1.5 self-start rounded pt-3 text-[12.5px] font-semibold text-primary outline-none hover:text-primary-600 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary","data-testid":`${d}-amount-only-add`,children:[t.jsx(P,{icon:"lucide:plus",width:13,height:13,"aria-hidden":"true"}),u.amountOnlyAdd]}):t.jsxs("div",{className:"flex items-start gap-3 border-b border-pos-line-2 pb-3 pt-5 last:border-b-0","data-testid":`${d}-amount-only`,children:[t.jsx("div",{className:"flex h-10 w-10 shrink-0 items-center justify-center rounded-[10px] bg-default-100 text-default-600",children:t.jsx(P,{icon:"lucide:circle-dollar-sign",width:19,height:19,"aria-hidden":"true"})}),t.jsx("div",{className:"min-w-0 flex-1",children:t.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[t.jsxs("div",{className:"min-w-0",children:[t.jsx("p",{className:"text-sm font-semibold",children:u.amountOnlyTitle}),t.jsx("p",{className:"text-[12.5px] text-default-500",children:u.amountOnlyDetail.replace("{amount}",fe(i.max.value,void 0,i.max.currency))})]}),t.jsxs("div",{className:"flex w-full flex-wrap items-center gap-2.5 sm:w-[290px] sm:flex-nowrap",children:[t.jsx(vs,{value:i.value,expected:i.value,max:i.max.value,onChange:i.onChange,ariaLabel:u.amountOnlyTitle,className:"flex-1",inputTestId:`${d}-amount-only-input`}),t.jsx("button",{type:"button","aria-label":u.amountOnlyRemove,onClick:i.onRemove,className:"flex h-11 w-11 shrink-0 items-center justify-center rounded-full bg-pos-danger-fill text-pos-danger outline-none transition-colors hover:bg-[#F8D6D6] focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-pos-danger","data-testid":`${d}-amount-only-remove`,children:t.jsx(P,{icon:"lucide:trash-2",width:17,height:17,"aria-hidden":"true"})})]})]})})]}))]})};co.displayName="LineItemList";const Bp={color:ie.danger},uo=({children:e,className:n,"data-testid":s="meta-card"})=>t.jsx("div",{className:c.cn("mx-auto mt-[18px] flex max-w-[1040px] flex-col gap-3",n),"data-testid":s,children:t.jsx("div",{className:"rounded-[14px] border border-pos-line bg-white px-4 py-3.5 text-default-900",children:e})});uo.displayName="MetaCard";const mo=({label:e,htmlFor:n,required:s,children:a,className:r,"data-testid":i="meta-card-row"})=>t.jsxs("div",{className:c.cn("flex flex-wrap items-center justify-between gap-4",r),"data-testid":i,children:[t.jsxs("label",{htmlFor:n,className:"text-[13px] font-medium text-default-600",children:[e,s&&t.jsx("span",{"aria-hidden":"true",className:"ms-0.5 text-danger",style:Bp,"data-testid":`${i}-required`,children:"*"})]}),t.jsx("div",{className:"w-full sm:w-[290px] sm:shrink-0",children:a})]});mo.displayName="MetaCard.Row";const fo=({label:e,children:n,className:s,"data-testid":a="meta-card-section"})=>t.jsxs("div",{className:c.cn("mt-3.5 flex flex-col gap-2.5 border-t border-pos-line pt-3",s),"data-testid":a,children:[e&&t.jsx("p",{className:"text-[13px] font-medium text-default-600",children:e}),n]});fo.displayName="MetaCard.Section";const Vp=Object.assign(uo,{Row:mo,Section:fo}),xo=({heading:e,icon:n="lucide:rotate-ccw",action:s,children:a,className:r,"data-testid":i="section-panel"})=>t.jsxs("section",{className:c.cn("mx-auto max-w-[1040px] rounded-2xl border border-pos-line bg-white px-[18px] py-4",r),"data-testid":i,children:[t.jsxs("div",{className:"mb-3 flex items-center gap-2 text-[13px] font-semibold text-default-600",children:[t.jsx(P,{icon:n,width:16,height:16,"aria-hidden":"true"}),t.jsx("h3",{"data-testid":`${i}-heading`,children:e}),t.jsx("div",{className:"flex-1"}),s&&t.jsxs("button",{type:"button",disabled:s.disabled,onClick:s.onClick,className:c.cn("inline-flex min-h-8 shrink-0 items-center gap-1.5 rounded-full border border-primary","bg-primary/5 px-3 py-[7px] text-[12.5px] font-semibold text-primary outline-none","transition-colors hover:bg-primary/10 disabled:cursor-not-allowed disabled:opacity-60","focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary"),"data-testid":`${i}-action`,children:[t.jsx(P,{icon:s.icon??"lucide:plus",width:14,height:14,"aria-hidden":"true"}),s.label]})]}),a]});xo.displayName="SectionPanel";const po=({name:e,detail:n,icon:s="lucide:users",labels:a,className:r,"data-testid":i="customer-card"})=>t.jsxs("div",{className:c.cn("mb-3.5 flex items-center gap-3 rounded-xl bg-default-100 px-3.5 py-3",r),"data-testid":i,children:[t.jsx("div",{className:"flex h-[38px] w-[38px] shrink-0 items-center justify-center rounded-[10px] bg-default-100 text-default-600",children:t.jsx(P,{icon:s,width:18,height:18,"aria-hidden":"true"})}),t.jsxs("div",{className:"min-w-0 flex-1",children:[t.jsx("p",{className:"mb-0.5 text-[11px] font-semibold uppercase tracking-[.08em] text-default-500",children:a?.heading??"Customer"}),t.jsx("p",{className:"text-sm font-semibold","data-testid":`${i}-name`,children:e}),n&&t.jsx("p",{className:"text-[12.5px] text-default-500",children:n})]})]});po.displayName="CustomerCard";const Up={label:"Reason for the return",placeholder:"Select a reason…"},ho=({options:e,value:n,onChange:s,error:a,isRequired:r,labels:i,className:o,"data-testid":l="reason-select"})=>{const d={...Up,...i};return t.jsx(Xe,{label:d.label,labelPlacement:"outside",placeholder:d.placeholder,selectedKeys:n?[n]:[],isRequired:r,isInvalid:!!a,errorMessage:a,className:c.cn(o),"data-testid":l,onSelectionChange:u=>{if(u==="all")return;const f=[...u][0];f&&s(String(f))},children:e.map(u=>t.jsx(c.SelectItem,{children:u.label},u.id))})};ho.displayName="ReasonSelect";const Hp={toggle:"Add a note",optionalTag:"(optional)",heading:"Additional note",placeholder:"Add a note (optional)"},bo=({value:e,onChange:n,maxLength:s,alwaysExpanded:a=!1,hideLabel:r=!1,labels:i,className:o,"data-testid":l="notes-field"})=>{const d={...Hp,...i},[u,f]=h.useState(e!=="");return a?t.jsxs("div",{className:c.cn("flex flex-col gap-2",o),"data-testid":l,children:[!r&&t.jsx("label",{htmlFor:`${l}-textarea`,className:"text-[13px] font-medium text-default-600",children:d.heading}),t.jsx("textarea",{id:`${l}-textarea`,"aria-label":r?d.heading:void 0,value:e,onChange:m=>n(m.target.value),maxLength:s,placeholder:d.placeholder,className:c.cn("min-h-[52px] w-full resize-y rounded-[10px] border border-pos-line bg-white px-3 py-2.5","text-[13.5px] leading-[1.45] text-default-900 outline-none","placeholder:text-default-500","focus:border-primary focus:ring-[3px] focus:ring-primary/10"),"data-testid":`${l}-textarea`})]}):t.jsx("div",{className:c.cn(o),"data-testid":l,children:u?t.jsx(c.Textarea,{value:e,onChange:m=>n(m.target.value),maxLength:s,placeholder:d.toggle,"aria-label":d.toggle,variant:"bordered",radius:"lg","data-testid":`${l}-textarea`}):t.jsxs(O,{variant:"light",className:"h-auto min-w-0 px-1 py-0.5 text-xs font-semibold text-primary",onPress:()=>f(!0),"data-testid":`${l}-toggle`,children:[d.toggle,t.jsx("span",{className:"ml-1 font-normal text-default-400",children:d.optionalTag})]})})};bo.displayName="NotesField";const Wp={danger:{surface:"bg-pos-danger-fill",disc:"bg-pos-danger-icon text-pos-danger",title:"text-pos-danger"},warning:{surface:"bg-pos-warn-fill",disc:"bg-pos-warn-icon text-pos-warn",title:"text-pos-warn"}},qp={danger:"gravity-ui:circle-exclamation-fill",warning:"gravity-ui:triangle-exclamation-fill"},gr="h-8 min-w-0 rounded-[10px] px-3 text-[13px] font-semibold",_n=({tone:e,title:n,body:s,onRetry:a,retryLabel:r,onChooseDifferent:i,chooseDifferentLabel:o,className:l,"data-testid":d,retryTestId:u,chooseDifferentTestId:f})=>{const m=Wp[e];return t.jsxs("div",{role:"alert",className:c.cn("flex items-start gap-3.5 rounded-[14px] p-4 px-[18px]",m.surface,l),"data-testid":d,children:[t.jsx("div",{className:c.cn("flex h-10 w-10 shrink-0 items-center justify-center rounded-full",m.disc),"aria-hidden":"true",children:t.jsx(P,{icon:qp[e],width:22,height:22})}),t.jsxs("div",{className:"min-w-0 flex-1",children:[n&&t.jsx("p",{className:c.cn("font-semibold",m.title),children:n}),t.jsx("p",{className:"mt-0.5 text-[13px] text-default-600",children:s}),t.jsxs("div",{className:"mt-3 flex gap-2.5",children:[a&&t.jsx(O,{color:"primary",className:gr,onPress:a,"data-testid":u,children:r}),t.jsx(O,{variant:"bordered",className:c.cn(gr,"border-1 border-pos-line bg-white text-default-900"),onPress:i,"data-testid":f,children:o})]})]})]})};_n.displayName="TenderBanner";const Gp={split:"Split across multiple methods",declinedTitle:"Refund declined",declinedBody:"The processor declined this refund. Nothing was sent.",networkTitle:"Network error",networkBody:"Couldn't reach the processor. Nothing was sent.",retry:"Try again",chooseDifferent:"Choose different method",destinationsHeading:"Money back to"},Kp={card:"lucide:credit-card",cash:"lucide:dollar-sign",check:"lucide:edit-3",other:"lucide:more-horizontal"},go=({tenders:e,selectedTenderId:n,onSelect:s,onSplit:a,error:r,labels:i,className:o,"data-testid":l="tender-methods"})=>{const d={...Gp,...i},u=r?.kind==="processor_declined";return t.jsxs("div",{className:c.cn("flex flex-col text-default-900",o),"data-testid":l,children:[r&&t.jsx(_n,{tone:u?"danger":"warning",title:u?d.declinedTitle:d.networkTitle,body:u?d.declinedBody:d.networkBody,onRetry:r.onRetry,retryLabel:d.retry,onChooseDifferent:r.onChooseDifferent,chooseDifferentLabel:d.chooseDifferent,className:"mb-[18px]","data-testid":`${l}-error`,retryTestId:`${l}-retry`,chooseDifferentTestId:`${l}-choose-different`}),t.jsx("p",{className:"mb-3 text-[11px] font-semibold uppercase tracking-[.08em] text-default-500",children:d.title??d.destinationsHeading}),t.jsxs("div",{role:"radiogroup","aria-label":d.title??d.destinationsHeading,className:"mb-0.5 grid grid-cols-3 gap-2.5","data-testid":`${l}-tiles`,children:[e.map(f=>{const m=f.tenderId===n;return t.jsxs("button",{type:"button",role:"radio","aria-checked":m,onClick:()=>s(f.tenderId),className:c.cn("flex items-center gap-[11px] rounded-[14px] border-[1.5px] bg-white px-[15px] py-[11px] text-left","outline-none transition-colors","focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary",m?"border-primary bg-primary/5":"border-pos-line hover:border-primary"),"data-testid":`${l}-tile-${f.tenderId}`,children:[t.jsx("span",{className:c.cn("flex h-[34px] w-[34px] shrink-0 items-center justify-center rounded-[10px]",m?"bg-primary text-white":"bg-default-100 text-default-600"),children:t.jsx(P,{icon:Kp[f.kind],width:18,height:18,"aria-hidden":"true"})}),t.jsxs("span",{className:"min-w-0",children:[t.jsx("span",{className:"block text-sm font-semibold",children:f.label}),t.jsx("span",{className:"block text-xs text-default-500",children:fe(f.maxRefundable.value,void 0,f.maxRefundable.currency)})]})]},f.tenderId)}),t.jsxs("button",{type:"button",onClick:a,className:c.cn("flex items-center gap-[11px] rounded-[14px] border-[1.5px] border-pos-line bg-white px-[15px] py-[11px] text-left","outline-none transition-colors hover:border-primary","focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary"),"data-testid":`${l}-split`,children:[t.jsx("span",{className:"flex h-[34px] w-[34px] shrink-0 items-center justify-center rounded-[10px] bg-default-100 text-default-600",children:t.jsx(P,{icon:"lucide:split",width:18,height:18,"aria-hidden":"true"})}),t.jsx("span",{className:"min-w-0 text-sm font-semibold",children:d.split})]})]})]})};go.displayName="TenderMethods";const Yp=e=>e.refunded!==null,Qp={title:"Split refund",refundedSoFar:"Refunded so far",remaining:"Remaining",amountForPart:"Amount for this part",partHeading:"Part #{n}",submit:"Refund this part →",back:"Back",partDeclinedBody:"This part was declined. Completed parts are preserved.",partNetworkBody:"Couldn't reach the processor. Completed parts are preserved.",declinedTitle:"Refund declined",networkTitle:"Network error",retry:"Try again",chooseDifferent:"Choose different method",pending:"Pending",succeeded:"Refunded"},Zp="mb-2 text-[11px] font-semibold uppercase tracking-[.08em] text-default-500",Xp="inline-flex h-[22px] shrink-0 items-center gap-[5px] whitespace-nowrap rounded-full px-[9px] text-xs font-medium leading-none",yo=({parts:e,refundedSoFar:n,remaining:s,current:a,methods:r,onRefundPart:i,partError:o,onBack:l,busy:d,hideActions:u,labels:f,className:m,"data-testid":p="split-tender-panel"})=>{const x={...Qp,...f},g=e.filter(Yp),y=e.find(C=>C.tenderId===a.tenderId)?.label,b=!!(r?.length&&a.onTenderChange),j=Et(s.currency),{draft:w,setDraft:$,normalize:N}=Pl(a.amount,String),A=h.useCallback(C=>{Qs(C,j)&&($(C),a.onAmountChange(Yt(C)??0))},[a,$,j]),k=o?.kind==="processor_declined";return t.jsxs("div",{className:c.cn("flex flex-col text-default-900",m),"data-testid":p,children:[t.jsx("h3",{className:"sr-only","data-testid":`${p}-title`,children:x.title}),o&&t.jsx(_n,{tone:k?"danger":"warning",title:k?x.declinedTitle:x.networkTitle,body:k?x.partDeclinedBody:x.partNetworkBody,onRetry:o.onRetry,retryLabel:x.retry,onChooseDifferent:o.onChooseDifferent,chooseDifferentLabel:x.chooseDifferent,className:"mb-[18px]","data-testid":`${p}-part-error`,retryTestId:`${p}-retry`,chooseDifferentTestId:`${p}-choose-different`}),t.jsxs("div",{"data-testid":`${p}-totals`,children:[t.jsxs("div",{className:"mb-4 flex items-center justify-between gap-2.5 rounded-xl bg-default-100 px-4 py-3.5",children:[t.jsx("span",{className:"text-[13px] font-semibold text-default-500",children:x.remaining}),t.jsx("span",{className:"text-[22px] font-semibold tabular-nums",children:fe(s.value,void 0,s.currency)}),t.jsxs("span",{className:"sr-only",children:[x.refundedSoFar,": ",fe(n.value,void 0,n.currency)]})]}),g.length>0&&t.jsxs("div",{children:[t.jsx("p",{className:Zp,children:x.refundedSoFar}),g.map((C,D)=>t.jsxs("div",{className:"mb-2 flex items-center gap-2.5 rounded-xl border border-pos-line px-3 py-2.5","data-testid":`${p}-part-${C.tenderId}-done`,children:[t.jsxs("span",{className:"w-[22px] shrink-0 font-bold text-default-600",children:["#",D+1]}),t.jsx("span",{className:"flex h-8 w-8 shrink-0 items-center justify-center rounded-[9px] bg-default-100 text-default-600",children:t.jsx(P,{icon:C.icon??"lucide:credit-card",width:15,height:15,"aria-hidden":"true"})}),t.jsxs("span",{className:"min-w-0 flex-1",children:[t.jsx("span",{className:"block text-[13.5px] font-semibold",children:C.label}),C.feeNote&&t.jsx("span",{className:"block text-[11.5px] text-default-500",children:C.feeNote})]}),t.jsx("span",{className:"font-semibold tabular-nums",children:fe(C.refunded.value,void 0,C.refunded.currency)}),t.jsx("span",{className:c.cn(Xp,C.status==="pending"?"bg-pos-warn-fill text-pos-warn":"bg-pos-ok-fill text-pos-ok"),children:C.status==="pending"?x.pending:x.succeeded})]},C.tenderId))]})]}),t.jsxs("div",{className:"mt-3.5","data-testid":`${p}-current`,children:[t.jsxs("div",{className:"mb-2 flex items-center justify-between gap-2",children:[t.jsx("span",{className:"text-sm font-semibold",children:x.partHeading.replace("{n}",String(g.length+1))}),y&&t.jsx("span",{className:"text-xs text-default-500",children:y})]}),t.jsx("p",{"aria-hidden":"true",className:"mb-1.5 text-[13px] font-semibold","data-testid":`${p}-amount-label`,children:x.amountForPart}),t.jsx(Xs,{heading:x.amountForPart,amountLabel:x.amountForPart,hideHeading:!0,placeholder:"$0.00",value:w,onChange:A,onBlur:N,maxAmount:s.value,isDisabled:d,className:"gap-0 border-t-0 pt-0","data-testid":`${p}-amount`}),b&&t.jsx("div",{className:"mt-2.5 flex gap-2","data-testid":`${p}-methods`,children:r?.map(C=>{const D=C.tenderId===a.tenderId;return t.jsxs("button",{type:"button","aria-pressed":D,disabled:C.disabled||d,onClick:()=>a.onTenderChange?.(C.tenderId),className:c.cn("flex h-11 flex-1 items-center justify-center gap-2 rounded-xl border-[1.5px] bg-white","text-[13px] font-semibold outline-none transition-colors","disabled:cursor-not-allowed disabled:opacity-50","focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary",D?"border-primary bg-primary/5 text-primary":"border-pos-line text-default-600"),"data-testid":`${p}-method-${C.tenderId}`,children:[C.icon&&t.jsx(P,{icon:C.icon,width:15,height:15,"aria-hidden":"true"}),C.label]},C.tenderId)})})]}),!u&&t.jsxs("div",{className:"mt-4 flex items-center gap-3",children:[t.jsx(O,{variant:"bordered",className:"h-12 min-w-0 flex-1 rounded-[14px] border-1 border-pos-line bg-white px-5 text-[15px] font-semibold text-default-900",onPress:l,"data-testid":`${p}-back`,children:x.back}),t.jsx(O,{color:"primary",className:"h-12 min-w-0 flex-1 rounded-[14px] px-5 text-[15px] font-semibold",isDisabled:d,isLoading:d,onPress:i,"data-testid":`${p}-submit`,children:x.submit})]})]})};yo.displayName="SplitTenderPanel";const vo="hsl(var(--heroui-primary))",Jp="hsl(var(--heroui-primary) / 0.05)",jo="hsl(var(--heroui-default-100))",wo="hsl(var(--heroui-default-600))",ra={card:"lucide:credit-card",cash:"lucide:dollar-sign",check:"lucide:edit-3",store_credit:"lucide:gift",reader:"lucide:nfc",other:"lucide:more-horizontal"},ce={root:"flex flex-col text-default-900",banner:"mb-[18px]",eyebrowRow:"mb-3 flex min-h-6 items-center justify-between gap-3",eyebrow:"text-[11px] font-semibold uppercase tracking-[.08em] text-default-500",grid:"grid grid-cols-3 gap-2.5",card:"relative flex min-h-[132px] flex-col rounded-[14px] border-[1.5px] bg-white transition-colors",focusRing:"outline-none focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary",toggle:"flex w-full items-center gap-[11px] rounded-[12px] px-[15px] pt-[13px] text-left disabled:cursor-not-allowed",toggleUnselected:"flex-1 flex-col items-stretch gap-3 pb-[13px]",toggleHeader:"flex w-full items-center gap-[11px]",toggleRemovable:"pr-12",iconBox:"flex h-[38px] w-[38px] shrink-0 items-center justify-center rounded-[10px]",text:"min-w-0 flex-1",label:"block truncate text-[15px] font-semibold leading-5",subtitle:"block truncate text-xs text-default-500",status:"block truncate text-xs font-semibold",lowerSlot:"mt-auto flex h-11 w-full items-center rounded-[10px] px-3 text-[13px] font-medium tabular-nums",amountSlot:"mt-auto px-[15px] pb-[13px] pt-3",amountWrapper:"h-11 min-h-11 rounded-[10px] bg-white shadow-none",amountInput:"text-[15px] font-semibold tabular-nums",remove:"absolute right-1 top-1 flex h-11 w-11 items-center justify-center rounded-[10px] text-default-500 hover:text-default-900 disabled:cursor-not-allowed",badge:"inline-flex h-[22px] shrink-0 items-center whitespace-nowrap rounded-full px-[9px] text-xs font-medium leading-none",another:"flex min-h-[132px] w-full flex-col items-start justify-center gap-3 rounded-[14px] border-[1.5px] border-dashed bg-white px-[15px] py-[13px] text-left transition-colors disabled:cursor-not-allowed",anotherOpen:"aria-expanded:scale-100",menuItem:"py-2"},eh={idle:{borderColor:ie.line,backgroundColor:"#fff"},selected:{borderColor:vo,backgroundColor:Jp},declined:{borderColor:ie.danger,backgroundColor:ie["danger-fill"]}},Nn={idle:{backgroundColor:jo,color:wo},selected:{backgroundColor:vo,color:"#fff"}},th={backgroundColor:jo,color:wo},nh={borderColor:ie.line},yr={declined:{color:ie.danger},pending:{color:ie.warn,backgroundColor:ie["warn-fill"]},done:{color:ie.ok,backgroundColor:ie["ok-fill"]}},sh={heading:"Money back to",upTo:"Up to {amount}",noCap:"Tap to add an amount",amountFor:"Amount to {method}",remove:"Remove {method}",declined:"Declined",pending:"Pending",done:"Refunded",retry:"Try again",chooseDifferent:"Choose different method"},ah=e=>{try{return new Intl.NumberFormat("en-US",{style:"currency",currency:e}).formatToParts(0).find(n=>n.type==="currency")?.value??e}catch{return e}},rh=({method:e,currency:n,busy:s,labels:a,onToggle:r,onAmountChange:i,onAmountBlur:o,onRemove:l,testId:d})=>{const u=e.status??"idle",f=u==="pending"||u==="done",m=s||f,p=!!(e.removable&&l),x=e.cap?.currency??n,g=Et(x),y=`${d}-amount`,b=a.amountFor.replace("{method}",e.label),j=h.useCallback(k=>{if(!Qs(k,g))return;const C=Yt(k);e.cap&&C!==null&&C>e.cap.value||i(e.id,k)},[g,e.cap,e.id,i]),w=h.useCallback(k=>{const C=k.currentTarget;requestAnimationFrame(()=>{C.isConnected&&C.select()})},[]),$=u==="declined"?"declined":e.selected?"selected":"idle",N=e.statusLabel??(u==="idle"?void 0:a[u]),A=t.jsxs("span",{className:ce.toggleHeader,children:[t.jsx("span",{className:ce.iconBox,style:e.selected?Nn.selected:Nn.idle,"data-testid":`${d}-icon`,children:t.jsx(P,{icon:ra[e.kind],width:18,height:18,"aria-hidden":"true"})}),t.jsxs("span",{className:ce.text,children:[t.jsx("span",{className:ce.label,children:e.label}),u==="declined"&&N?t.jsx("span",{className:ce.status,style:yr.declined,"data-testid":`${d}-status`,children:N}):e.subtitle&&t.jsx("span",{className:ce.subtitle,children:e.subtitle})]}),f&&N&&t.jsx("span",{className:ce.badge,style:yr[u],"data-testid":`${d}-status`,children:N})]});return t.jsxs("div",{className:ce.card,style:eh[$],"data-selected":e.selected||void 0,"data-status":u,"data-testid":d,children:[e.selected?t.jsxs(t.Fragment,{children:[t.jsx("button",{type:"button","aria-pressed":!0,disabled:m,onClick:()=>r(e.id),className:c.cn(ce.toggle,ce.focusRing,p&&ce.toggleRemovable),"data-testid":`${d}-toggle`,children:A}),t.jsxs("div",{className:ce.amountSlot,children:[t.jsx("label",{htmlFor:y,className:"sr-only",children:b}),t.jsx(c.Input,{id:y,"aria-label":b,type:"text",inputMode:"decimal",placeholder:"0.00",value:e.amount??"",onChange:k=>j(k.target.value),onFocus:w,onBlur:()=>o?.(e.id),isDisabled:m,variant:"bordered",startContent:t.jsx("span",{className:"text-[15px] font-semibold text-default-500","aria-hidden":"true",children:ah(x)}),classNames:{inputWrapper:ce.amountWrapper,input:ce.amountInput},"data-testid":`${d}-amount`})]})]}):t.jsxs("button",{type:"button","aria-pressed":!1,disabled:m,onClick:()=>r(e.id),className:c.cn(ce.toggle,ce.toggleUnselected,ce.focusRing,p&&ce.toggleRemovable),"data-testid":`${d}-toggle`,children:[A,t.jsx("span",{className:ce.lowerSlot,style:th,"data-testid":`${d}-cap`,children:e.cap?a.upTo.replace("{amount}",fe(e.cap.value,void 0,e.cap.currency)):a.noCap})]}),p&&t.jsx("button",{type:"button","aria-label":a.remove.replace("{method}",e.label),disabled:s,onClick:()=>l?.(e.id),className:c.cn(ce.remove,ce.focusRing),"data-testid":`${d}-remove`,children:t.jsx(P,{icon:"lucide:x",width:16,height:16,"aria-hidden":"true"})})]})},No=({methods:e,onToggle:n,onAmountChange:s,onAmountBlur:a,onRemove:r,currency:i="USD",paidWith:o,anotherMethod:l,error:d,busy:u=!1,labels:f,className:m,"data-testid":p="refund-method-cards"})=>{const x={...sh,...f};return t.jsxs("div",{className:c.cn(ce.root,m),"data-testid":p,children:[d&&t.jsx(_n,{tone:d.tone,title:d.title,body:d.body,onRetry:d.onRetry,retryLabel:x.retry,onChooseDifferent:d.onChooseDifferent,chooseDifferentLabel:x.chooseDifferent,className:ce.banner,"data-testid":`${p}-error`,retryTestId:`${p}-retry`,chooseDifferentTestId:`${p}-choose-different`}),t.jsxs("div",{className:ce.eyebrowRow,children:[t.jsx("p",{className:ce.eyebrow,children:x.heading}),o&&t.jsx(Ln,{variant:"record",label:o.label,value:o.value,"data-testid":`${p}-paid-with`})]}),t.jsxs("div",{role:"group","aria-label":x.heading,className:ce.grid,"data-testid":`${p}-grid`,children:[e.map(g=>t.jsx(rh,{method:g,currency:i,busy:u,labels:x,onToggle:n,onAmountChange:s,onAmountBlur:a,onRemove:r,testId:`${p}-method-${g.id}`},g.id)),l&&t.jsxs(c.Dropdown,{placement:"bottom-start",isDisabled:u,classNames:{trigger:ce.anotherOpen},children:[t.jsx(c.DropdownTrigger,{children:t.jsxs("button",{type:"button",className:c.cn(ce.another,ce.focusRing),style:nh,"data-testid":`${p}-another`,children:[t.jsx("span",{className:ce.iconBox,style:Nn.idle,children:t.jsx(P,{icon:"lucide:plus",width:18,height:18,"aria-hidden":"true"})}),t.jsxs("span",{className:"min-w-0",children:[t.jsx("span",{className:ce.label,children:l.label}),t.jsx("span",{className:ce.subtitle,children:l.subtitle})]})]})}),t.jsx(c.DropdownMenu,{"aria-label":l.label,items:l.options,onAction:g=>l.onPick(String(g)),"data-testid":`${p}-another-menu`,children:g=>t.jsx(c.DropdownItem,{textValue:g.label,description:g.description,className:ce.menuItem,startContent:t.jsx("span",{className:ce.iconBox,style:Nn.idle,children:t.jsx(P,{icon:ra[g.kind],width:18,height:18,"aria-hidden":"true"})}),"data-testid":`${p}-another-option-${g.id}`,children:g.label},g.id)})]})]})]})};No.displayName="RefundMethodCards";const Ie={root:"flex flex-col text-default-900",eyebrow:"mb-3 text-[11px] font-semibold uppercase tracking-[.08em] text-default-500",list:"flex flex-col gap-2.5",row:"flex flex-col gap-3 rounded-[14px] border-[1.5px] px-[15px] py-[13px] transition-colors",main:"flex items-center gap-[11px]",iconBox:"flex h-[38px] w-[38px] shrink-0 items-center justify-center rounded-[10px]",text:"min-w-0 flex-1",label:"block truncate text-[15px] font-semibold leading-5",note:"block truncate text-xs text-default-500",amount:"shrink-0 text-[15px] font-semibold tabular-nums",badge:"inline-flex h-[22px] shrink-0 items-center gap-[5px] whitespace-nowrap rounded-full px-[9px] text-xs font-medium leading-none",prompt:"flex flex-wrap items-center gap-3 rounded-[10px] px-3 py-2",promptText:"min-w-0 flex-1 text-[13px] font-medium",action:"h-11 min-w-0 rounded-[12px] px-4 text-[14px] font-semibold"},Co="hsl(var(--heroui-primary))",ih={idle:{borderColor:ie.line,backgroundColor:"#fff"},active:{borderColor:Co,backgroundColor:"hsl(var(--heroui-primary) / 0.05)"},failed:{borderColor:ie.danger,backgroundColor:ie["danger-fill"]}},vr={idle:{backgroundColor:"hsl(var(--heroui-default-100))",color:"hsl(var(--heroui-default-600))"},active:{backgroundColor:Co,color:"#fff"}},lh={backgroundColor:"#fff",color:ie.neutral},Ct=e=>({color:He[e].fg,backgroundColor:He[e].bg}),oh={queued:Ct("neutral"),processing:Ct("info"),waiting_reader:Ct("warn"),waiting_cash:Ct("warn"),done:Ct("ok"),failed:Ct("danger")},ch={heading:"Refunding",queued:"Queued",processing:"Processing",waitingReader:"Waiting for reader",waitingCash:"Waiting for cash",done:"Refunded",failed:"Failed"},dh={queued:"queued",processing:"processing",waiting_reader:"waitingReader",waiting_cash:"waitingCash",done:"done",failed:"failed"},jr={waiting_reader:"lucide:nfc",waiting_cash:"lucide:banknote"},uh=e=>e.status==="processing"||e.status==="waiting_reader"||e.status==="waiting_cash",ko=({parts:e,activeId:n,labels:s,className:a,"data-testid":r="refund-progress-list"})=>{const i={...ch,...s},o=n??e.find(uh)?.id;return t.jsxs("div",{className:c.cn(Ie.root,a),"data-testid":r,children:[t.jsx("p",{className:Ie.eyebrow,children:i.heading}),t.jsx("ol",{"aria-label":i.heading,className:Ie.list,children:e.map(l=>{const d=l.id===o,u=`${r}-part-${l.id}`,f=d?"active":l.status==="failed"?"failed":"idle";return t.jsxs("li",{"aria-current":d?"step":void 0,className:Ie.row,style:ih[f],"data-status":l.status,"data-active":d||void 0,"data-testid":u,children:[t.jsxs("div",{className:Ie.main,children:[t.jsx("span",{className:Ie.iconBox,style:d?vr.active:vr.idle,children:t.jsx(P,{icon:ra[l.kind],width:18,height:18,"aria-hidden":"true"})}),t.jsxs("span",{className:Ie.text,children:[t.jsx("span",{className:Ie.label,children:l.label}),l.note&&t.jsx("span",{className:Ie.note,children:l.note})]}),t.jsx("span",{className:Ie.amount,children:fe(l.amount.value,void 0,l.amount.currency)}),t.jsxs("span",{className:Ie.badge,style:oh[l.status],"data-testid":`${u}-status`,children:[l.status==="processing"&&t.jsx(P,{icon:"lucide:loader-circle",width:12,height:12,className:"animate-spin","aria-hidden":"true"}),i[dh[l.status]]]})]}),(l.prompt||l.action)&&t.jsxs("div",{role:"status",className:Ie.prompt,style:lh,"data-testid":`${u}-prompt`,children:[jr[l.status]&&t.jsx(P,{icon:jr[l.status],width:18,height:18,"aria-hidden":"true"}),l.prompt&&t.jsx("span",{className:Ie.promptText,children:l.prompt}),l.action&&t.jsx(O,{color:"primary",className:Ie.action,onPress:l.action.onPress,isLoading:l.action.loading,isDisabled:l.action.disabled,"data-testid":`${u}-action`,children:l.action.label})]})]},l.id)})})]})};ko.displayName="RefundProgressList";const mh={label:"Supervisor authorization",placeholder:"••••"},So=({pin:e,onChange:n,hint:s,error:a,labels:r,className:i,"data-testid":o="pin-field"})=>{const l={...mh,...r};return t.jsxs("div",{className:c.cn("mx-auto max-w-[460px] rounded-[20px] border border-pos-line bg-white px-7 py-[26px]","text-center text-default-900 shadow-[0_1px_2px_rgba(0,0,0,0.05)]",i),"data-testid":o,children:[t.jsx("div",{className:"mx-auto mb-4 flex h-[70px] w-[70px] items-center justify-center rounded-full bg-pos-danger-fill text-primary",children:t.jsx(P,{icon:"lucide:lock",width:26,height:26,"aria-hidden":"true"})}),t.jsx("p",{className:"text-[17px] font-semibold",children:l.label}),s&&t.jsx("p",{className:"mt-1.5 text-[13px] text-default-500",children:s}),t.jsx(c.Input,{type:"password",inputMode:"numeric","aria-label":l.label,placeholder:l.placeholder,value:e,onChange:d=>n(d.target.value.replace(/\D/g,"").slice(0,6)),isInvalid:!!a,errorMessage:a,variant:"bordered",radius:"lg",classNames:{inputWrapper:"h-11",input:"text-center text-[28px] tracking-[.4em] tabular-nums"},className:"mx-auto mt-[18px] max-w-[160px]","data-testid":`${o}-input`})]})};So.displayName="PinField";const fh={processing:"Processing refund…",title:"Refund complete",destinationsTitle:"Refund destinations",sendReceipt:"Send receipt",email:"Email",print:"Print",done:"Done",pending:"Pending",succeeded:"Refunded",reason:"Reason · {reason}",authorizedBy:"Authorized by {name}",paidWithTitle:"Paid with",outcomeTitle:"Outcome",changeDue:"Change due",emailPlaceholder:"Add email…",emailAriaLabel:"Add email address",removeEmail:"Remove {email}",sendEmail:"Send receipt"},xh={refund:{},payment:{title:"Payment complete",done:"New sale",authorizedBy:"Handled by {name}"}},ph={succeeded:"bg-pos-ok-fill text-pos-ok",pending:"bg-pos-warn-fill text-pos-warn"},hh="inline-flex h-[1.375rem] items-center gap-[0.3125rem] whitespace-nowrap rounded-full px-[0.5625rem] text-xs font-medium leading-none",zt="mb-1.5 text-[0.6875rem] font-semibold uppercase tracking-[.05em] text-pos-muted",bh="mx-auto max-w-[65rem] rounded-[1.25rem] border border-pos-line bg-white px-7 py-[1.625rem] shadow-[0_0.0625rem_0.125rem_rgba(0,0,0,0.05)]",gh=["email","print"],fn=`${Se} motion-reduce:data-[pressed=true]:scale-100 [html[data-pos-reduce-motion=true]_&]:data-[pressed=true]:scale-100`,je={paidRow:"flex w-full items-center gap-3 border-b border-transparent py-[0.6875rem] text-left",paidIcon:"flex h-[2.125rem] w-[2.125rem] shrink-0 items-center justify-center rounded-[0.5625rem] bg-pos-neutral-fill text-pos-neutral",paidLabel:"text-sm font-semibold",paidAmount:"ml-1.5 text-sm font-semibold tabular-nums",paidStatus:"ml-auto whitespace-nowrap rounded-full bg-pos-neutral-fill px-2.5 py-1 text-[0.71875rem] font-semibold text-pos-neutral",groups:"flex w-full flex-col gap-3 border-y border-pos-line-2 py-3 text-left",groupLabel:"mb-1.5 text-[0.6875rem] font-semibold uppercase tracking-[.05em] text-pos-muted",groupItems:"flex flex-wrap gap-1.5",groupItem:"rounded-lg bg-pos-neutral-fill px-2.5 py-1 text-[0.8125rem] text-pos-ink",receiptRow:"mt-2 flex flex-wrap items-center gap-3.5",receiptAction:`h-10 min-w-0 flex-1 gap-2 rounded-xl border border-pos-line bg-white px-4 text-sm font-semibold text-pos-ink data-[hover=true]:bg-pos-neutral-fill ${fn}`,receiptActionExpanded:"bg-pos-neutral-fill",emailBox:"mt-5 flex w-full flex-col gap-2.5",chipWrap:"flex min-h-11 w-full flex-wrap items-center gap-1.5 rounded-xl border px-2 py-[0.3125rem]",chip:"inline-flex items-center gap-1 rounded-full border border-pos-line bg-pos-neutral-fill py-[0.1875rem] pl-2.5 pr-1 text-[0.8125rem] font-medium text-pos-ink",chipRemove:`h-11 w-11 min-w-0 -my-[0.8125rem] -mr-2.5 rounded-full bg-transparent text-pos-muted data-[hover=true]:bg-transparent data-[hover=true]:text-pos-ink data-[focus-visible=true]:outline-offset-[-0.5rem] ${fn}`,send:`h-10 w-full rounded-xl px-4 text-sm font-semibold ${fn}`,changeTitle:"text-[0.9375rem] font-medium text-pos-muted",changeLabel:"mt-4 text-sm font-semibold text-pos-neutral",changeAmount:"mt-0.5 text-[3.125rem] font-medium leading-[1.05] tracking-[-.02em] tabular-nums",changeCaption:"mt-2.5 text-[0.8125rem] text-pos-muted"},$o=({state:e,kind:n="refund",total:s,destinations:a,subtitle:r,reason:i,paidWith:o,outcomeGroups:l,changeDue:d,authorizedBy:u,selectedReceipts:f,onSendReceipt:m,receiptActions:p,emailReceipt:x,onDone:g,frameless:y=!1,labels:b,className:j,"data-testid":w="outcome-view"})=>{const $={...fh,...xh[n],...b},N=h.useId(),A=s?fe(s.value,void 0,s.currency):null;return e==="processing"?t.jsx("div",{className:c.cn("flex flex-col items-center justify-center text-center text-pos-ink",j),"aria-live":"polite","data-testid":w,children:t.jsxs("div",{className:"flex flex-col items-center px-5 py-[3.75rem]","data-testid":`${w}-processing`,children:[t.jsx("div",{className:`mb-4 h-[3.25rem] w-[3.25rem] animate-spin rounded-full border-[0.3125rem] border-pos-neutral-fill border-t-primary ${vi}`,role:"presentation"}),t.jsx("p",{className:"text-[1.0625rem] font-semibold",children:$.processing}),A&&t.jsx("p",{className:"mt-2 text-[0.9375rem] font-semibold tabular-nums","data-testid":`${w}-processing-total`,children:A})]})}):t.jsxs("div",{className:c.cn("flex flex-col text-pos-ink",!y&&bh,j),"aria-live":"polite","data-testid":w,children:[t.jsxs("div",{className:c.cn("text-center",n==="refund"&&"pb-0.5 pt-1"),children:[t.jsx("div",{className:"mx-auto mb-3.5 flex h-[4.875rem] w-[4.875rem] items-center justify-center rounded-full bg-pos-ok-fill text-pos-ok",children:t.jsx("span",{"aria-hidden":"true",className:"flex h-[2.875rem] w-[2.875rem]",children:t.jsx(P,{icon:"solar:check-circle-bold",width:"100%",height:"100%"})})}),d?t.jsxs(t.Fragment,{children:[t.jsx("p",{className:je.changeTitle,"data-testid":`${w}-title`,children:$.title}),t.jsx("p",{className:je.changeLabel,children:$.changeDue}),t.jsx("p",{className:je.changeAmount,"data-testid":`${w}-change`,children:fe(d.amount.value,void 0,d.amount.currency)}),d.caption&&t.jsx("p",{className:je.changeCaption,"data-testid":`${w}-change-caption`,children:d.caption})]}):t.jsxs(t.Fragment,{children:[t.jsx("p",{className:"text-[1.375rem] font-semibold","data-testid":`${w}-title`,children:$.title}),A&&t.jsx("p",{className:"my-1 text-[1.875rem] font-semibold tabular-nums","data-testid":`${w}-total`,children:A}),r&&t.jsx("p",{className:"text-[0.8125rem] text-pos-muted","data-testid":`${w}-subtitle`,children:r})]}),i&&t.jsx("p",{className:"text-[0.8125rem] text-pos-muted","data-testid":`${w}-reason`,children:$.reason.replace("{reason}",i)})]}),o&&o.length>0&&t.jsxs("div",{className:"mt-5 text-left","data-testid":`${w}-paid-with`,children:[t.jsx("p",{className:zt,children:$.paidWithTitle}),o.map((k,C)=>t.jsxs("div",{className:je.paidRow,"data-testid":`${w}-paid-with-${C}`,children:[k.icon&&t.jsx("span",{className:je.paidIcon,"aria-hidden":"true",children:t.jsx("span",{className:"flex h-4 w-4",children:t.jsx(P,{icon:k.icon,width:"100%",height:"100%"})})}),t.jsx("span",{className:je.paidLabel,children:k.label}),t.jsx("span",{className:je.paidAmount,children:fe(k.amount.value,void 0,k.amount.currency)}),k.status&&t.jsx("span",{className:je.paidStatus,children:k.status})]},`${k.label}-${C}`))]}),l&&l.length>0&&t.jsxs("div",{className:"mt-5 text-left","data-testid":`${w}-outcome`,children:[t.jsx("p",{className:zt,children:$.outcomeTitle}),t.jsx("div",{className:je.groups,children:l.map((k,C)=>t.jsxs("div",{"data-testid":`${w}-outcome-${C}`,children:[t.jsx("p",{className:je.groupLabel,children:k.label}),t.jsx("ul",{className:je.groupItems,"aria-label":k.label,children:k.items.map((D,S)=>t.jsx("li",{className:je.groupItem,children:D},`${D}-${S}`))})]},`${k.label}-${C}`))})]}),a&&t.jsxs("div",{className:"mt-5 text-left",children:[t.jsx("p",{className:zt,children:$.destinationsTitle}),a.map((k,C)=>t.jsxs("div",{className:"flex items-center justify-between gap-2.5 border-b border-pos-line-2 py-[0.6875rem] text-sm last:border-b-0","data-testid":`${w}-destination-${C}-${k.status}`,children:[t.jsx("span",{className:"font-semibold",children:k.label}),t.jsxs("div",{className:"flex items-center gap-2.5",children:[t.jsx("span",{className:"tabular-nums text-pos-neutral",children:fe(k.amount.value,void 0,k.amount.currency)}),t.jsx("span",{className:c.cn(hh,ph[k.status]),children:k.status==="succeeded"?$.succeeded:$.pending})]})]},`${k.label}-${C}`))]}),p&&p.length>0?t.jsxs("div",{className:"mt-5 flex flex-col text-left","data-testid":`${w}-receipt-actions`,children:[t.jsx("p",{className:zt,children:$.sendReceipt}),t.jsx("div",{className:je.receiptRow,children:p.map(k=>t.jsx(yh,{action:k,controls:k.expanded?N:void 0,"data-testid":`${w}-receipt-action-${k.key}`},k.key))}),x&&t.jsx(vh,{id:N,email:x,labels:$,"data-testid":`${w}-email`})]}):m&&t.jsxs("div",{className:"mt-5 text-left",children:[t.jsx("p",{className:zt,children:$.sendReceipt}),t.jsx("div",{className:"flex flex-col gap-2",children:gh.map(k=>{const C=f?.includes(k)??!1;return t.jsxs("button",{type:"button",role:"checkbox","aria-checked":C,onClick:()=>m(k),className:`flex min-h-11 w-full items-center gap-2.5 rounded-[0.625rem] p-2 text-left text-sm outline-none transition-colors hover:bg-pos-neutral-fill focus-visible:outline focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-primary ${Se}`,"data-testid":`${w}-receipt-${k}`,children:[t.jsx("span",{"aria-hidden":"true",className:"pointer-events-none flex",children:t.jsx(c.Checkbox,{isSelected:C,isReadOnly:!0,tabIndex:-1})}),t.jsx("span",{children:$[k]})]},k)})})]}),u&&t.jsx("p",{className:"mt-4 text-[0.78125rem] text-pos-muted","data-testid":`${w}-authorized-by`,children:$.authorizedBy.replace("{name}",u)}),t.jsx("div",{className:"mt-auto pt-5",children:t.jsx(O,{color:"primary",className:`h-12 w-full rounded-[0.875rem] px-5 text-[0.9375rem] font-semibold ${fn}`,onPress:g,"data-testid":`${w}-done`,children:$.done})})]})};$o.displayName="OutcomeView";function yh({action:e,controls:n,"data-testid":s}){return t.jsx(O,{variant:"bordered",color:"default",disableRipple:!0,className:c.cn(je.receiptAction,e.expanded&&je.receiptActionExpanded),"aria-expanded":e.expanded,"aria-controls":n,isDisabled:e.isDisabled,onPress:e.onPress,startContent:e.icon?t.jsx("span",{"aria-hidden":"true",className:"flex h-4 w-4 shrink-0",children:t.jsx(P,{icon:e.icon,width:"100%",height:"100%"})}):void 0,"data-testid":s,children:e.label})}function vh({id:e,email:n,labels:s,"data-testid":a}){const r=n.isSendDisabled??n.emails.length===0;return t.jsxs("div",{id:e,className:je.emailBox,"data-testid":a,children:[t.jsxs("div",{className:c.cn(je.chipWrap,n.isInvalid?"border-pos-danger":"border-pos-line"),"data-invalid":n.isInvalid||void 0,"data-testid":`${a}-recipients`,children:[n.emails.map(i=>t.jsxs("span",{className:je.chip,"data-testid":`${a}-chip`,children:[i,t.jsx(O,{isIconOnly:!0,variant:"light",color:"default",disableRipple:!0,className:je.chipRemove,"aria-label":s.removeEmail.replace("{email}",i),onPress:()=>n.onRemoveEmail(i),"data-testid":`${a}-remove`,children:t.jsx("span",{"aria-hidden":"true",className:"flex h-[0.9375rem] w-[0.9375rem]",children:t.jsx(P,{icon:"lucide:x",width:"100%",height:"100%"})})})]},i)),t.jsx(c.Input,{"aria-label":s.emailAriaLabel,placeholder:s.emailPlaceholder,type:"email",value:n.draft,onValueChange:n.onDraftChange,onKeyDown:i=>{i.key==="Enter"&&n.draft.trim()!==""&&(i.preventDefault(),n.onAddEmail(n.draft.trim()))},isInvalid:n.isInvalid,classNames:{base:"w-auto min-w-[7.5rem] flex-1",inputWrapper:`h-[1.6875rem] min-h-[1.6875rem] bg-transparent px-0.5 py-0 shadow-none data-[hover=true]:bg-transparent group-data-[focus=true]:bg-transparent group-data-[invalid=true]:bg-transparent ${Se}`,input:"text-[0.8125rem] text-pos-ink placeholder:text-pos-muted group-data-[invalid=true]:text-pos-ink"},"data-testid":`${a}-input`})]}),t.jsx(O,{color:"secondary",className:je.send,isDisabled:r,isLoading:n.isSending,onPress:n.onSend,"data-testid":`${a}-send`,children:s.sendEmail})]})}const _e={base:"relative inline-grid min-w-[var(--filter-select-min)] max-w-max shrink grow basis-[var(--filter-select-min)] grid-cols-[minmax(0,1fr)] [--filter-select-min:6rem]",baseActive:"[--filter-select-min:8rem]",cell:"[grid-area:1/1]",sizer:"invisible h-0 max-w-[20rem] overflow-hidden whitespace-nowrap border-x-2 border-transparent pl-2 pr-[2.0625rem] text-[0.875rem]",sizerActive:"pr-[3.4375rem] font-semibold",select:"w-full [contain:inline-size]",trigger:"h-[2.375rem] min-h-[2.375rem] rounded-[0.625rem] border-medium border-pos-field bg-white px-2 shadow-none data-[hover=true]:border-default-300 data-[focus=true]:border-primary data-[open=true]:border-primary data-[focus-visible=true]:ring-2 data-[focus-visible=true]:ring-primary data-[focus-visible=true]:ring-offset-1",triggerActive:"!border-acct-rust-border !bg-acct-rust-fill pr-[1.875rem]",value:"text-[0.875rem] !text-default-900",valueActive:"font-semibold !text-primary-600",iconActive:"!text-primary-600",clear:"absolute right-[1.875rem] top-1/2 z-20 inline-flex size-[1.25rem] -translate-y-1/2 items-center justify-center rounded-md text-primary-600 outline-none hover:bg-white/70 focus-visible:outline focus-visible:outline-2 focus-visible:outline-primary",clearIcon:"size-[0.8125rem]",optionTitle:"whitespace-normal break-words"},jh="grid shrink grow basis-0 grid-flow-col auto-cols-auto gap-2.5 [--filter-select-cap:16rem] max-w-[calc(var(--filter-select-count)*var(--filter-select-cap)+(var(--filter-select-count)-1)*0.625rem)] [&>[data-slot=filter-select]]:max-w-none",wh="calc(100vw - 1.5rem)",Ao=({label:e,value:n,options:s,onChange:a,clearLabel:r,minWidth:i,"data-testid":o="filter-select"})=>{const l=n!==null,d=l?s.find(x=>x.value===n)?.label:void 0,u=h.useRef(null),f=h.useRef(null),[m,p]=h.useState();return t.jsxs("div",{ref:u,"data-testid":o,"data-slot":"filter-select","data-active":l?"true":void 0,title:d,className:c.cn(_e.base,l&&_e.baseActive),style:i===void 0?void 0:{"--filter-select-min":it(i)},children:[t.jsx(Xe,{"aria-label":e,placeholder:e,size:"sm",variant:"bordered",radius:"md",selectedKeys:n===null?[]:[n],onSelectionChange:x=>{if(x==="all")return;const g=[...x][0];a(g===void 0?null:String(g))},onOpenChange:x=>{x&&p(u.current?.getBoundingClientRect().width)},popoverProps:{ref:f,placement:"bottom-start",style:{minWidth:m,maxWidth:wh}},"data-testid":`${o}-trigger`,classNames:{base:c.cn(_e.select,_e.cell),trigger:c.cn(_e.trigger,l&&_e.triggerActive),value:c.cn(_e.value,l&&_e.valueActive),selectorIcon:c.cn(l&&_e.iconActive)},children:s.map(x=>t.jsx(c.SelectItem,{classNames:{title:_e.optionTitle},children:x.label},x.value))}),t.jsx("span",{"aria-hidden":"true","data-testid":`${o}-sizer`,className:c.cn(_e.sizer,l&&_e.sizerActive,_e.cell),children:d??e}),l&&t.jsx("button",{type:"button","aria-label":r,onClick:()=>{a(null),u.current?.querySelector('[data-slot="trigger"]')?.focus()},"data-testid":`${o}-clear`,className:_e.clear,children:t.jsx(P,{icon:"lucide:x",className:_e.clearIcon,"aria-hidden":"true"})})]})};Ao.displayName="FilterSelect";const Do=({children:e,className:n,"data-testid":s="filter-select-group"})=>t.jsx("div",{"data-testid":s,"data-slot":"filter-select-group",className:c.cn(jh,n),style:{"--filter-select-count":h.Children.toArray(e).length},children:e});Do.displayName="FilterSelectGroup";const ut={base:"flex flex-wrap items-center justify-center gap-2.5 border-t border-pos-hair px-5 py-[0.875rem] text-[0.84375rem] text-default-500",idle:"w-full",sentinel:"h-px w-full",spinner:"inline-flex",error:"text-pos-danger"},Eo=({status:e,onLoadMore:n,loadingLabel:s,errorLabel:a,retryLabel:r,endLabel:i,"data-testid":o="load-more-footer"})=>{const l=h.useRef(null),d=h.useRef(n),u=h.useRef(!1);return h.useEffect(()=>{d.current=n},[n]),h.useEffect(()=>{if(e!=="idle"){u.current=!1;return}const f=l.current;if(!f||typeof IntersectionObserver>"u")return;const m=new IntersectionObserver(p=>{u.current||!p.some(x=>x.isIntersecting)||(u.current=!0,d.current())},{rootMargin:"0px 0px 200px 0px"});return m.observe(f),()=>m.disconnect()},[e]),e==="idle"?t.jsx("div",{"data-testid":o,"data-status":"idle",className:ut.idle,children:t.jsx("div",{ref:l,"aria-hidden":"true","data-testid":`${o}-sentinel`,className:ut.sentinel})}):e==="loading"?t.jsxs("div",{"data-testid":o,"data-status":"loading",role:"status","aria-live":"polite",className:ut.base,children:[t.jsx("span",{"aria-hidden":"true",className:ut.spinner,children:t.jsx(c.Spinner,{size:"sm",color:"default"})}),t.jsx("span",{"data-testid":`${o}-loading`,children:s})]}):e==="error"?t.jsxs("div",{"data-testid":o,"data-status":"error",className:ut.base,children:[t.jsx("span",{role:"alert","data-testid":`${o}-error`,className:ut.error,children:a}),t.jsx(O,{size:"sm",color:"default",variant:"bordered",radius:"md",onPress:n,testId:`${o}-retry`,children:r})]}):t.jsx("div",{"data-testid":o,"data-status":"end",className:i?ut.base:ut.idle,children:i&&t.jsx("span",{"data-testid":`${o}-end`,children:i})})};Eo.displayName="LoadMoreFooter";const Ce={base:"w-full",list:"m-0 list-none p-0",item:"relative border-b border-pos-hair last:border-b-0",card:"block w-full px-4 py-[0.875rem] text-left",cardInteractive:`cursor-pointer outline-none transition-colors hover:bg-default-50 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-[-2px] focus-visible:outline-primary ${Se}`,headline:"flex items-baseline gap-2.5",headlineWithActions:"pr-[3.25rem]",title:"min-w-0 text-[0.90625rem] font-semibold text-primary [overflow-wrap:anywhere]",amount:"ml-auto shrink-0 whitespace-nowrap text-[0.9375rem] font-bold tabular-nums text-default-900",actions:"absolute right-4 top-[0.1875rem] z-[1]",chips:"mt-[0.5625rem] flex flex-wrap gap-1.5",chipsLine:"mt-[0.5625rem] flex items-center gap-2.5",chipsInline:"flex min-w-0 flex-wrap gap-1.5",rows:"mt-[0.5625rem] block",row:"flex items-baseline gap-3 py-[0.1875rem] text-[0.8125rem]",rowLabel:"shrink-0 text-default-500",rowValue:"ml-auto min-w-0 text-right text-default-700 [overflow-wrap:anywhere]",skeletonRow:"border-b border-pos-hair p-4 last:border-b-0"},wr=({item:e,withActions:n})=>t.jsxs(t.Fragment,{children:[t.jsxs("span",{className:c.cn(Ce.headline,n&&Ce.headlineWithActions),children:[t.jsx("span",{className:Ce.title,children:e.title}),le(e.amount)&&!n&&t.jsx("span",{className:Ce.amount,children:e.amount})]}),n?(le(e.chips)||le(e.amount))&&t.jsxs("span",{className:Ce.chipsLine,children:[le(e.chips)&&t.jsx("span",{className:Ce.chipsInline,children:e.chips}),le(e.amount)&&t.jsx("span",{className:Ce.amount,children:e.amount})]}):le(e.chips)&&t.jsx("span",{className:Ce.chips,children:e.chips}),e.rows&&e.rows.length>0&&t.jsx("span",{className:Ce.rows,children:e.rows.map((s,a)=>t.jsxs("span",{className:Ce.row,children:[t.jsx("span",{className:Ce.rowLabel,children:s.label}),t.jsx("span",{className:Ce.rowValue,children:s.value})]},a))})]}),Lo=({items:e,ariaLabel:n,onSelect:s,loading:a=!1,skeletonCount:r=6,"data-testid":i="card-list"})=>t.jsx("div",{"data-testid":i,className:Ce.base,children:a?t.jsx("div",{role:"status","aria-busy":"true","aria-label":n,"data-testid":`${i}-skeleton`,children:t.jsx("div",{"aria-hidden":"true",children:Array.from({length:r},(o,l)=>t.jsxs("div",{"data-testid":`${i}-skeleton-row`,className:Ce.skeletonRow,children:[t.jsx("div",{className:un,style:{height:it(13),width:it(130)}}),t.jsx("div",{className:un,style:{height:it(11),width:"70%",marginTop:it(10)}}),t.jsx("div",{className:un,style:{height:it(11),width:"45%",marginTop:it(8)}})]},l))})}):t.jsx("ul",{"aria-label":n,className:Ce.list,children:e.map(o=>{const l=le(o.actions);return t.jsxs("li",{"data-testid":`${i}-item-${o.id}`,className:Ce.item,children:[s?t.jsx("button",{type:"button",onClick:()=>s(o.id),className:c.cn(Ce.card,Ce.cardInteractive),children:t.jsx(wr,{item:o,withActions:l})}):t.jsx("div",{className:Ce.card,children:t.jsx(wr,{item:o,withActions:l})}),l&&t.jsx("div",{"data-testid":`${i}-item-${o.id}-actions`,className:Ce.actions,children:o.actions})]},o.id)})})});Lo.displayName="CardList";const Nh=48,ae={base:`mb-4 overflow-hidden rounded-2xl border border-pos-line bg-white ${Fn}`,band:"flex items-center gap-2.5 border-b border-pos-hair bg-pos-page px-4 py-2.5",back:`inline-flex size-[1.625rem] shrink-0 items-center justify-center rounded-[0.625rem] text-default-500 outline-none transition-colors hover:bg-default-100 focus-visible:outline focus-visible:outline-2 focus-visible:outline-primary ${Se}`,backIcon:"size-[0.875rem]",breadcrumb:"min-w-0 flex-1",breadcrumbList:"flex-nowrap gap-[0.375rem]",crumbBase:"min-w-0",crumb:"whitespace-nowrap text-[0.875rem] text-default-500 data-[disabled=true]:opacity-100 data-[current=true]:overflow-hidden data-[current=true]:font-normal data-[current=true]:text-default-900",crumbSeparator:"ms-[0.375rem] px-0 text-default-400 data-[disabled=true]:opacity-100",body:"flex flex-wrap gap-5",bodyWide:"px-5 pb-5 pt-[1.125rem]",bodyNarrow:"p-4",identity:"min-w-0 flex-[1_1_18.75rem]",title:"m-0 font-semibold tracking-[-.02em] text-default-900 [overflow-wrap:anywhere]",titleWide:"text-[1.5rem]",titleNarrow:"text-[1.3125rem]",meta:"m-0 mt-[0.6875rem] flex list-none flex-col gap-[0.4375rem] p-0",metaLine:"flex min-w-0 items-center gap-[0.5625rem] text-[0.84375rem] text-default-700",metaIcon:"flex shrink-0 text-default-400 [&_svg]:size-[0.9375rem]",metaText:"min-w-0 truncate",money:"flex flex-col gap-[0.3125rem]",moneyWide:"ml-auto min-w-[12.5rem] flex-none items-end text-right",moneyNarrow:"w-full items-start text-left",amountLabel:"text-[0.8125rem] text-default-500",amount:"whitespace-nowrap font-bold tracking-[-.03em] tabular-nums text-default-900",amountWide:"text-[1.9375rem] leading-[1.1]",amountNarrow:"text-[1.6875rem] leading-[1.1]",amountCaption:"text-[0.8125rem] text-default-500",recordId:"text-[0.8125rem] text-default-500",chips:"mt-[0.1875rem] flex flex-wrap gap-1.5",chipsWide:"justify-end",chipsNarrow:"justify-start",statItems:"m-0 mt-2.5 flex flex-wrap gap-[1.375rem]",stat:"flex flex-col-reverse",statWide:"text-right",statNarrow:"text-left",statValue:"m-0 text-[0.9375rem] font-bold tabular-nums text-default-900",statLabel:"mt-0.5 text-[0.75rem] text-default-500",statsWide:"px-5 pb-5",statsNarrow:"px-4 pb-4"},Fo=h.forwardRef((e,n)=>t.jsx("li",{ref:n,...Object.fromEntries(Object.entries(e).filter(([s])=>s!=="data-testid"))}));Fo.displayName="CrumbBase";const Ro=({breadcrumb:e=[],onBack:n,backLabel:s,title:a,meta:r,amountLabel:i,amount:o,amountCaption:l,recordId:d,chips:u,statItems:f,stats:m,banner:p,"data-testid":x="record-header"})=>{const{ref:g,width:y}=Ft(),b=!Xt(y,Nh),j=e.length>0||!!n,w=!!(f&&f.length>0),$=!!i||le(o)||le(l)||le(d)||le(u)||w;return t.jsxs("div",{ref:g,"data-testid":x,"data-size":b?"narrow":"wide",className:ae.base,children:[j&&t.jsxs("div",{"data-testid":`${x}-band`,className:ae.band,children:[n&&t.jsx("button",{type:"button",onClick:n,"aria-label":s,"data-testid":`${x}-back`,className:ae.back,children:t.jsx(P,{icon:"lucide:chevron-left",className:ae.backIcon,"aria-hidden":"true"})}),t.jsx(c.Breadcrumbs,{separator:"/","data-testid":`${x}-breadcrumb`,classNames:{base:ae.breadcrumb,list:ae.breadcrumbList},itemClasses:{base:ae.crumbBase,item:ae.crumb,separator:ae.crumbSeparator},children:e.map((N,A)=>t.jsx(c.BreadcrumbItem,{as:Fo,"data-testid":`${x}-crumb-${A}`,isDisabled:!N.onClick&&A<e.length-1,onPress:N.onClick?()=>N.onClick?.():void 0,children:N.label},A))})]}),t.jsxs("div",{className:c.cn(ae.body,b?ae.bodyNarrow:ae.bodyWide),children:[t.jsxs("div",{className:ae.identity,children:[t.jsx("h1",{"data-testid":`${x}-title`,className:c.cn(ae.title,b?ae.titleNarrow:ae.titleWide),children:a}),r&&r.length>0&&t.jsx("ul",{"data-testid":`${x}-meta`,className:ae.meta,children:r.map((N,A)=>t.jsxs("li",{className:ae.metaLine,children:[N.icon!=null&&t.jsx("span",{"aria-hidden":"true",className:ae.metaIcon,children:N.icon}),t.jsx("span",{className:ae.metaText,children:N.text})]},A))})]}),$&&t.jsxs("div",{"data-testid":`${x}-money`,className:c.cn(ae.money,b?ae.moneyNarrow:ae.moneyWide),children:[i&&t.jsx("div",{className:ae.amountLabel,children:i}),le(o)&&t.jsx("div",{"data-testid":`${x}-amount`,className:c.cn(ae.amount,b?ae.amountNarrow:ae.amountWide),children:o}),le(l)&&t.jsx("div",{className:ae.amountCaption,children:l}),le(d)&&t.jsx("div",{"data-testid":`${x}-record-id`,className:ae.recordId,children:d}),le(u)&&t.jsx("div",{"data-testid":`${x}-chips`,className:c.cn(ae.chips,b?ae.chipsNarrow:ae.chipsWide),children:u}),w&&t.jsx("dl",{"data-testid":`${x}-stat-items`,className:ae.statItems,children:f?.map((N,A)=>t.jsxs("div",{"data-testid":`${x}-stat-${A}`,className:c.cn(ae.stat,b?ae.statNarrow:ae.statWide),children:[t.jsx("dt",{"data-testid":`${x}-stat-${A}-label`,className:ae.statLabel,children:N.label}),t.jsx("dd",{"data-testid":`${x}-stat-${A}-value`,className:ae.statValue,style:N.tone?{color:He[N.tone].fg}:void 0,children:N.value})]},N.id??A))})]})]}),le(m)&&t.jsx("div",{"data-testid":`${x}-stats`,className:b?ae.statsNarrow:ae.statsWide,children:m}),le(p)&&t.jsx("div",{"data-testid":`${x}-banner`,children:p})]})};Ro.displayName="RecordHeader";const Ch=50,Bt={base:"grid items-start gap-4",split:"grid-cols-[minmax(0,1fr)_23.25rem]",stacked:"grid-cols-[minmax(0,1fr)]",column:"min-w-0",aside:"flex min-w-0 flex-col gap-[0.875rem]"},_o=({children:e,aside:n,"data-testid":s="record-layout"})=>{const{ref:a,width:r}=Ft(),i=le(n),o=i&&r>0&&Xt(r,Ch),l=t.jsx("div",{"data-testid":`${s}-main`,className:Bt.column,children:e},"main"),d=i?t.jsx("div",{"data-testid":`${s}-aside`,className:Bt.aside,children:n},"aside"):null;return t.jsx("div",{ref:a,"data-testid":s,"data-layout":o?"split":"stacked",className:c.cn(Bt.base,o?Bt.split:Bt.stacked),children:o?[l,d]:[d,l]})};_o.displayName="RecordLayout";const kh=560,Vt={base:"grid gap-3",tile:"min-w-0 rounded-[14px] border border-pos-line bg-white px-[18px] py-4 shadow-[0_1px_4px_rgba(0,0,0,.06),0_4px_12px_rgba(0,0,0,.06)]",value:"text-[23px] font-bold leading-[1.2] tracking-[-.02em] tabular-nums text-default-900 [overflow-wrap:anywhere]",label:"mt-[5px] text-[13.5px] text-default-500",caption:"mt-0.5 text-[12.5px] text-default-500"},Mo=({items:e,"data-testid":n="stat-tiles"})=>{const{ref:s,width:a}=Ft(),r=a>=Xf?Math.max(e.length,1):a>=kh?2:1;return t.jsx("div",{ref:s,"data-testid":n,"data-columns":r,className:Vt.base,style:{gridTemplateColumns:`repeat(${r}, minmax(0, 1fr))`},children:e.map((i,o)=>t.jsxs("div",{"data-testid":`${n}-item-${o}`,className:Vt.tile,children:[t.jsx("div",{"data-testid":`${n}-item-${o}-value`,className:Vt.value,style:i.tone?{color:He[i.tone].fg}:void 0,children:i.value}),t.jsx("div",{"data-testid":`${n}-item-${o}-label`,className:Vt.label,children:i.label}),le(i.caption)&&t.jsx("div",{"data-testid":`${n}-item-${o}-caption`,className:Vt.caption,children:i.caption})]},o))})};Mo.displayName="StatTiles";const rt={base:"mb-3.5 w-full",tabList:"w-full gap-1 rounded-full border border-pos-line bg-default-100 p-1",cursor:"rounded-full bg-white shadow-[0_1px_3px_rgba(0,0,0,.10)]",tab:"h-auto flex-1 data-[hover-unselected=true]:opacity-100",tabStill:"rounded-full data-[selected=true]:bg-white data-[selected=true]:shadow-[0_1px_3px_rgba(0,0,0,.10)]",tabContent:"leading-[1.5] font-normal text-default-600 group-data-[selected=true]:font-semibold group-data-[selected=true]:text-default-900",title:"flex items-center whitespace-nowrap",icon:"flex shrink-0",count:"rounded-full bg-default-200 py-px leading-[1.5] font-semibold text-default-600 group-data-[selected=true]:bg-acct-rust-fill group-data-[selected=true]:text-primary-600"},Sh={md:{tab:"px-[0.875rem] py-[0.5625rem]",tabContent:"text-[0.84375rem]",title:"gap-[0.4375rem]",icon:"[&_svg]:size-4",count:"px-[0.4375rem] text-[0.71875rem]"},lg:{tab:"px-4 py-3",tabContent:"text-base",title:"gap-2",icon:"[&_svg]:size-5",count:"px-2 text-[0.8125rem]"}},ia="pill-tabs",la=(e,n=ia)=>`${n}-tab-${e}`,oa=(e,n=ia)=>`${n}-panel-${e}`,$h=(e,n=ia)=>({role:"tabpanel",id:oa(e,n),"aria-labelledby":la(e,n),tabIndex:0}),Po=({items:e,value:n,onChange:s,ariaLabel:a,idPrefix:r,size:i="md","data-testid":o="pill-tabs"})=>{const l=ji(),d=!!c.useProviderContext()?.disableAnimation,u=r??o,f=Sh[i];return t.jsx(c.Tabs,{"aria-label":a,variant:"solid",radius:"full",fullWidth:!0,disableAnimation:l||void 0,selectedKey:n,onSelectionChange:m=>s(String(m)),"data-testid":o,"data-size":i,classNames:{base:rt.base,tabList:rt.tabList,cursor:rt.cursor,tab:c.cn(rt.tab,f.tab,(l||d)&&rt.tabStill),tabContent:c.cn(f.tabContent,rt.tabContent)},children:e.map(m=>{const p=m["data-testid"]??`${o}-${m.key}`;return t.jsx(c.Tab,{id:la(m.key,u),"aria-controls":oa(m.key,u),"data-testid":p,title:t.jsxs("span",{className:c.cn(rt.title,f.title),children:[le(m.icon)&&t.jsx("span",{"aria-hidden":"true","data-testid":`${p}-icon`,className:c.cn(rt.icon,f.icon),children:m.icon}),m.label,m.count!==void 0&&t.jsx("span",{"data-testid":`${p}-count`,className:c.cn(f.count,rt.count),children:m.count})]})},m.key)})})};Po.displayName="PillTabs";const ye={base:"w-full",list:"m-0 list-none p-0",item:"border-t border-pos-hair",row:"flex w-full items-start gap-3 px-5 py-3 text-left",rowInteractive:`cursor-pointer outline-none transition-colors hover:bg-default-50 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-[-2px] focus-visible:outline-primary ${Se}`,dot:"mt-[0.4375rem] size-[0.4375rem] shrink-0 rounded-full",body:"flex min-w-0 flex-1 flex-col",title:"text-[0.875rem] font-semibold text-default-900 [overflow-wrap:anywhere] [text-wrap:pretty]",meta:"mt-1 flex min-w-0 flex-wrap items-center gap-[0.4375rem] text-[0.78125rem] text-default-500",reference:"min-w-0 font-normal text-primary [overflow-wrap:anywhere]",separator:"text-default-400",timestamp:"tabular-nums",detail:"mt-[0.1875rem] text-[0.78125rem] text-default-500 [overflow-wrap:anywhere] [text-wrap:pretty]",trailing:"max-w-[45%] min-w-min shrink-0 text-right text-[0.90625rem]",amount:"whitespace-nowrap text-[0.90625rem] font-bold tabular-nums text-default-900",note:"text-[0.78125rem] italic text-default-500 [overflow-wrap:anywhere]",footer:"flex items-baseline gap-3 border-t border-pos-line bg-pos-page px-5 py-[0.8125rem]",footerLabel:"min-w-0 text-[0.875rem] font-bold text-default-900 [overflow-wrap:anywhere]",footerAmount:"ml-auto whitespace-nowrap text-[1rem] font-bold tabular-nums text-default-900",footerNote:"border-t border-pos-hair px-5 py-[0.8125rem] text-[0.78125rem] leading-[1.6] text-default-500",empty:"px-5 pb-5 pt-[0.875rem] text-[0.875rem] text-default-500"},Nr=({row:e,testId:n})=>t.jsxs(t.Fragment,{children:[t.jsx("span",{"aria-hidden":"true",className:ye.dot,style:{backgroundColor:He[e.tone].fg}}),t.jsxs("span",{className:ye.body,children:[t.jsx("span",{className:ye.title,children:e.title}),(e.reference!=null||e.timestamp!=null)&&t.jsxs("span",{className:ye.meta,children:[e.reference!=null&&t.jsx("span",{className:ye.reference,children:e.reference}),e.reference!=null&&e.timestamp!=null&&t.jsx("span",{"aria-hidden":"true",className:ye.separator,children:"·"}),e.timestamp!=null&&t.jsx("span",{className:ye.timestamp,children:e.timestamp})]}),e.detail!=null&&t.jsx("span",{className:ye.detail,children:e.detail})]}),t.jsx("span",{className:ye.trailing,children:e.amount!=null?t.jsx("span",{"data-testid":`${n}-amount`,className:ye.amount,style:Jt(e.amountTone),children:e.amount}):e.note!=null?t.jsx("span",{"data-testid":`${n}-note`,className:ye.note,style:e.noteTone==="warn"?{color:He.warn.fg}:void 0,children:e.note}):null})]}),To=({rows:e,footer:n,emptyContent:s,onSelect:a,"data-testid":r="amount-list"})=>e.length===0?t.jsx("div",{"data-testid":r,className:ye.base,children:s!=null&&t.jsx("div",{"data-testid":`${r}-empty`,className:ye.empty,children:s})}):t.jsxs("div",{"data-testid":r,className:ye.base,children:[t.jsx("ul",{className:ye.list,children:e.map(i=>{const o=`${r}-row-${i.id}`;return t.jsx("li",{"data-testid":o,className:ye.item,children:a?t.jsx("button",{type:"button",onClick:()=>a(i.id),className:c.cn(ye.row,ye.rowInteractive),children:t.jsx(Nr,{row:i,testId:o})}):t.jsx("div",{className:ye.row,children:t.jsx(Nr,{row:i,testId:o})})},i.id)})}),n&&t.jsxs(t.Fragment,{children:[t.jsxs("div",{"data-testid":`${r}-footer`,className:ye.footer,children:[t.jsx("span",{className:ye.footerLabel,children:n.label}),t.jsx("span",{"data-testid":`${r}-footer-amount`,className:ye.footerAmount,style:Jt(n.amountTone),children:n.amount})]}),n.note!=null&&t.jsx("div",{"data-testid":`${r}-footer-note`,className:ye.footerNote,children:n.note})]})]});To.displayName="AmountList";const Be={list:"m-0 list-none p-0 pl-0.5",event:"flex gap-3.5",eventSpaced:"pb-4",rail:"flex flex-none flex-col items-center",dot:"mt-[0.3125rem] size-2.5 rounded-full",connector:"mt-1 w-[1.5px] flex-1 bg-pos-hair",body:"min-w-0 flex-1 pb-0.5",head:"flex min-w-0 flex-wrap items-baseline gap-x-3",title:"min-w-0 text-[0.90625rem] font-semibold text-default-900 [overflow-wrap:anywhere]",timestamp:"ml-auto min-w-0 max-w-full text-[0.8125rem] tabular-nums text-default-500 [overflow-wrap:anywhere]",detail:"mt-[0.1875rem] min-w-0 text-[0.84375rem] leading-[1.5] text-default-500 [overflow-wrap:anywhere]",actor:"mt-[0.1875rem] min-w-0 text-[0.78125rem] text-default-500 [overflow-wrap:anywhere]",empty:"text-[0.875rem] text-default-500"},Io=({events:e,emptyContent:n,"data-testid":s="activity-timeline"})=>e.length===0?t.jsx("div",{"data-testid":s,children:n!=null&&t.jsx("div",{"data-testid":`${s}-empty`,className:Be.empty,children:n})}):t.jsx("ol",{"data-testid":s,className:Be.list,children:e.map((a,r)=>{const i=r===e.length-1,o=`${s}-event-${a.id}`;return t.jsxs("li",{"data-testid":o,className:c.cn(Be.event,!i&&Be.eventSpaced),children:[t.jsxs("span",{"aria-hidden":"true",className:Be.rail,children:[t.jsx("span",{className:Be.dot,style:{backgroundColor:He[a.tone].fg}}),!i&&t.jsx("span",{"data-testid":`${o}-connector`,className:Be.connector})]}),t.jsxs("div",{className:Be.body,children:[t.jsxs("div",{className:Be.head,children:[t.jsx("span",{className:Be.title,children:a.title}),t.jsx("span",{className:Be.timestamp,children:a.timestamp})]}),le(a.detail)&&t.jsx("div",{className:Be.detail,children:a.detail}),le(a.actor)&&t.jsx("div",{"data-testid":`${o}-actor`,className:Be.actor,children:a.actor})]})]},a.id)})});Io.displayName="ActivityTimeline";const Ae={base:`overflow-hidden rounded-2xl border border-pos-line bg-white ${Fn}`,header:"flex flex-wrap items-center gap-2 px-5 pt-4",title:"m-0 min-w-0 text-[0.90625rem] font-semibold text-default-900 [overflow-wrap:anywhere]",count:"rounded-full bg-default-100 px-2 py-px text-[0.75rem] font-semibold text-default-600",list:"m-0 list-none p-0",item:"border-t border-pos-hair",itemFirstHeadless:"border-t-0",row:"flex w-full items-center gap-2.5 px-5 py-3 text-left",rowInteractive:`cursor-pointer outline-none transition-colors hover:bg-default-50 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-[-2px] focus-visible:outline-primary ${Se}`,rowBody:"flex min-w-0 flex-1 flex-col",rowHead:"flex min-w-0 flex-wrap items-center gap-2",primaryLinked:"min-w-0 text-[0.875rem] font-normal text-primary [overflow-wrap:anywhere]",primaryPlain:"min-w-0 text-[0.875rem] font-normal text-default-900 [overflow-wrap:anywhere]",secondary:"mt-[0.1875rem] block min-w-0 truncate text-[0.8125rem] text-default-500",amount:"max-w-[45%] shrink-0 text-right text-[0.875rem] font-semibold tabular-nums text-default-900 [overflow-wrap:anywhere]",empty:"min-w-0 px-5 pb-5 pt-[0.875rem] text-[0.875rem] text-default-500 [overflow-wrap:anywhere]",emptyHeadless:"pt-5"},Cr=({row:e,testId:n})=>t.jsxs(t.Fragment,{children:[t.jsxs("span",{className:Ae.rowBody,children:[t.jsxs("span",{className:Ae.rowHead,children:[t.jsx("span",{className:e.onSelect?Ae.primaryLinked:Ae.primaryPlain,children:e.primary}),e.chip]}),!!e.secondary&&t.jsx("span",{className:Ae.secondary,children:e.secondary})]}),!!e.amount&&t.jsx("span",{"data-testid":`${n}-amount`,className:Ae.amount,style:Jt(e.amountTone),children:e.amount})]}),Oo=({title:e,count:n,rows:s,emptyContent:a,"data-testid":r="related-record-list"})=>{const i=h.useId(),o=!!e;return t.jsxs("section",{"data-testid":r,role:o?"group":void 0,"aria-labelledby":o?i:void 0,className:Ae.base,children:[o&&t.jsxs("div",{className:Ae.header,children:[t.jsx("h3",{id:i,className:Ae.title,children:e}),n!==void 0&&t.jsx("span",{"data-testid":`${r}-count`,className:Ae.count,children:n})]}),s.length===0?!!a&&t.jsx("div",{"data-testid":`${r}-empty`,className:c.cn(Ae.empty,!o&&Ae.emptyHeadless),children:a}):t.jsx("ul",{className:Ae.list,children:s.map((l,d)=>{const u=`${r}-row-${l.id}`;return t.jsx("li",{"data-testid":u,className:c.cn(Ae.item,d===0&&!o&&Ae.itemFirstHeadless),children:l.onSelect?t.jsx("button",{type:"button",onClick:l.onSelect,className:c.cn(Ae.row,Ae.rowInteractive),children:t.jsx(Cr,{row:l,testId:u})}):t.jsx("div",{className:Ae.row,children:t.jsx(Cr,{row:l,testId:u})})},l.id)})})]})};Oo.displayName="RelatedRecordList";const zo=({title:e,titleAs:n="h2",icon:s,count:a,badge:r,action:i,description:o,footer:l,variant:d="section",body:u="padded",surface:f="card",className:m,children:p,"data-testid":x="record-card"})=>{const g=h.useId(),y=le(e);return t.jsxs("section",{"data-testid":x,"data-variant":d,"data-surface":f,role:y?"group":void 0,"aria-labelledby":y?g:void 0,className:c.cn(at.base,Nx[f],m),children:[y&&t.jsxs("div",{"data-testid":`${x}-header`,className:Cx[d],children:[le(s)&&t.jsx("span",{"aria-hidden":"true",className:at.icon,children:s}),t.jsx(n,{id:g,className:at.title,children:e}),le(a)&&t.jsx("span",{"data-testid":`${x}-count`,className:at.count,children:a}),r,le(i)&&t.jsx("span",{"data-testid":`${x}-action`,className:at.action,children:i})]}),t.jsxs("div",{"data-testid":`${x}-body`,className:kx[d][u],children:[le(o)&&t.jsx("p",{"data-testid":`${x}-description`,className:at.description,children:o}),p,le(l)&&t.jsx("div",{"data-testid":`${x}-footer`,className:c.cn(at.footer,le(p)?at.footerAfterContent:at.footerAfterDescription),children:l})]})]})};zo.displayName="RecordCard";const Ah={stack:"flex min-w-0 flex-col gap-[0.875rem]",grid:"grid min-w-0 grid-cols-[repeat(auto-fit,minmax(min(100%,18.75rem),1fr))] items-start gap-[0.875rem]"},Bo=({layout:e="stack",className:n,children:s,"data-testid":a="card-stack",...r})=>t.jsx("div",{...r,"data-testid":a,"data-layout":e,className:c.cn(Ah[e],n),children:s});Bo.displayName="CardStack";const ln={list:"m-0 divide-y divide-pos-hair",row:"flex items-baseline gap-3",label:"min-w-0 text-[0.84375rem] text-default-500",value:"m-0 ml-auto flex min-w-0 flex-wrap justify-end gap-[0.3125rem] text-right text-[0.875rem] text-default-900 [overflow-wrap:anywhere]"},Dh={regular:"py-[0.5625rem]",compact:"py-2"},Vo=({rows:e,density:n="regular","data-testid":s="key-value-rows"})=>t.jsx("dl",{"data-testid":s,className:ln.list,children:e.map((a,r)=>t.jsxs("div",{"data-testid":`${s}-row-${a.id??r}`,className:c.cn(ln.row,Dh[n]),children:[t.jsx("dt",{className:ln.label,children:a.label}),t.jsx("dd",{className:ln.value,children:a.value})]},a.id??r))});Vo.displayName="KeyValueRows";const Ye={list:"m-0 list-none p-0",row:"flex items-start gap-[0.875rem] border-t border-pos-hair px-5 py-3",body:"min-w-0 flex-1",name:"text-[0.90625rem] font-semibold text-default-900 [overflow-wrap:anywhere] [text-wrap:pretty]",details:"mt-[0.3125rem] flex flex-wrap items-center gap-[0.4375rem] text-[0.8125rem] text-default-500",separator:"text-default-400",detail:"tabular-nums",trailing:"flex shrink-0 flex-col items-end gap-1.5 text-right",amounts:"inline-flex items-baseline gap-2",original:"text-[0.8125rem] tabular-nums text-default-500 line-through",amount:"whitespace-nowrap text-[0.9375rem] font-bold tabular-nums text-default-900"},Uo=({items:e,ariaLabel:n,originalAmountLabel:s,"data-testid":a="line-item-rows"})=>t.jsx("ul",{"aria-label":n,"data-testid":a,className:Ye.list,children:e.map(r=>{const i=`${a}-item-${r.id}`,o=le(r.originalAmount);return t.jsxs("li",{"data-testid":i,className:Ye.row,style:r.tone?{backgroundColor:He[r.tone].bg}:void 0,children:[t.jsxs("div",{className:Ye.body,children:[t.jsx("div",{className:Ye.name,children:r.name}),r.details&&r.details.length>0&&t.jsx("div",{"data-testid":`${i}-details`,className:Ye.details,children:r.details.map((l,d)=>t.jsxs(h.Fragment,{children:[d>0&&t.jsx("span",{"aria-hidden":"true",className:Ye.separator,children:"·"}),t.jsx("span",{className:Ye.detail,children:l})]},d))})]}),t.jsxs("div",{className:Ye.trailing,children:[t.jsxs("span",{className:Ye.amounts,children:[o&&t.jsxs("s",{"data-testid":`${i}-original`,className:Ye.original,children:[s&&t.jsxs("span",{className:"sr-only",children:[s," "]}),r.originalAmount]}),t.jsx("span",{"data-testid":`${i}-amount`,className:Ye.amount,style:o?{color:He.ok.fg}:void 0,children:r.amount})]}),r.chip]})]},r.id)})});Uo.displayName="LineItemRows";const Eh=37.5,Ee={base:"mx-5 border-t border-pos-hair pb-[1.125rem] pt-2.5",rowWide:"flex items-baseline gap-4",rowNarrow:"flex flex-wrap items-baseline gap-x-3",labelWide:"shrink-0 grow-0 basis-[11.875rem]",labelNarrow:"flex-auto",noteWide:"min-w-0 flex-1",noteNarrow:"order-3 mt-px basis-full",row:"py-2",label:"text-[0.875rem] text-default-900",note:"text-[0.8125rem] text-default-500",value:"ml-auto shrink-0 whitespace-nowrap text-right text-[0.875rem] tabular-nums text-default-900",totalRule:"mt-1.5 border-t border-pos-line",totalRow:"pt-3",totalLabel:"text-[0.9375rem] font-bold text-default-900",totalValue:"ml-auto shrink-0 whitespace-nowrap text-right text-[1.0625rem] font-bold tabular-nums text-default-900",memo:"mt-2 text-[0.78125rem] leading-[1.6] text-default-500"},Ho=({rows:e,total:n,memo:s,"data-testid":a="record-totals"})=>{const{ref:r,width:i}=Ft(),o=i>0&&!Xt(i,Eh),l=o?Ee.rowNarrow:Ee.rowWide,d=o?Ee.labelNarrow:Ee.labelWide,u=o?Ee.noteNarrow:Ee.noteWide;return t.jsxs("div",{ref:r,"data-testid":a,"data-size":o?"narrow":"wide",className:Ee.base,children:[e.map(f=>{const m=`${a}-row-${f.id}`;return t.jsxs("div",{"data-testid":m,className:c.cn(l,Ee.row),children:[t.jsx("span",{"data-testid":`${m}-label`,className:c.cn(d,Ee.label),children:f.label}),t.jsx("span",{"data-testid":`${m}-note`,className:c.cn(u,Ee.note),children:f.note}),t.jsx("span",{"data-testid":`${m}-value`,className:Ee.value,style:Jt(f.tone),children:f.value})]},f.id)}),t.jsx("div",{className:Ee.totalRule,children:t.jsxs("div",{"data-testid":`${a}-total`,className:c.cn(l,Ee.totalRow),children:[t.jsx("span",{className:c.cn(d,Ee.totalLabel),children:n.label}),t.jsx("span",{"data-testid":`${a}-total-value`,className:Ee.totalValue,children:n.value})]})}),le(s)&&t.jsx("div",{"data-testid":`${a}-memo`,className:Ee.memo,children:s})]})};Ho.displayName="RecordTotals";const js={base:"whitespace-nowrap text-[0.875rem]",secondary:"text-default-500",chipStack:"inline-flex flex-col items-start gap-[0.3125rem]"},Lh={text:"text-default-900",reference:"font-normal text-primary",amount:"font-semibold tabular-nums text-default-900"},Wo=({variant:e="text",tone:n,secondary:s,children:a,"data-testid":r="cell-text"})=>t.jsxs("span",{"data-testid":r,className:c.cn(js.base,Lh[e]),style:Jt(n),children:[a,le(s)&&t.jsxs("span",{"data-testid":`${r}-secondary`,className:js.secondary,children:[t.jsx("span",{"aria-hidden":"true",children:" · "}),s]})]});Wo.displayName="CellText";const qo=({children:e,"data-testid":n="chip-stack"})=>t.jsx("span",{"data-testid":n,className:js.chipStack,children:e});qo.displayName="ChipStack";function Go({testId:e,title:n,description:s}){return t.jsx(c.Card,{shadow:"sm",className:"min-h-52 rounded-2xl shadow-none","data-testid":e,children:t.jsxs(c.CardBody,{className:"flex flex-col gap-2 p-4 text-sm",role:"alert",children:[t.jsx("span",{className:"font-semibold text-gray-900",children:n}),t.jsx("p",{className:"text-default-600 leading-snug",children:s})]})})}Go.displayName="SessionExpiredCard";exports.ActivityTimeline=Io;exports.AdminFieldLabel=Nl;exports.AdminTable=fl;exports.AdminTextField=Cl;exports.AdminToolbar=pl;exports.AmountList=To;exports.AppliedCodeCard=Br;exports.Button=O;exports.CardList=Lo;exports.CardStack=Bo;exports.CashTenderForm=Rx;exports.CatalogItemCard=Zi;exports.CellText=Wo;exports.CheckTenderForm=Ol;exports.ChipStack=qo;exports.CommitmentDetails=Im;exports.ConfirmDialog=Js;exports.ConfirmationModal=Us;exports.ConfirmationPageTemplate=iu;exports.CustomerCard=po;exports.DatePicker=Fs;exports.DensityProvider=$c;exports.DimensionChip=Ln;exports.DiscardGuard=Zl;exports.DonationAmounts=wi;exports.Drawer=di;exports.EmptyState=Hs;exports.EntityList=Ll;exports.EntityListSkeleton=Fl;exports.EntityRow=El;exports.ErrorState=Ws;exports.EventDetails=Hu;exports.EventDetailsTemplate=ou;exports.ExpireCartTimer=Ni;exports.FeedbackState=Lt;exports.FilterPopover=nl;exports.FilterSelect=Ao;exports.FilterSelectGroup=Do;exports.Footer=uu;exports.HeroUIProvider=kc;exports.HorizontalSteps=fi;exports.InlineConfirm=Yl;exports.InstallmentFundAssignment=Rm;exports.InstallmentFundAssignmentSkeleton=Pm;exports.InstallmentSchedule=sf;exports.InstallmentScheduleSkeleton=mf;exports.InstallmentTable=hf;exports.ItemCard=Qi;exports.KeyValueChip=Ln;exports.KeyValueRows=Vo;exports.LineItemList=co;exports.LineItemRows=Uo;exports.ListPanel=Ml;exports.LoadMoreFooter=Eo;exports.LoadingOverlay=Gl;exports.LoadingState=qs;exports.MembershipSelectCards=jf;exports.MetaCard=Vp;exports.Modal=Qt;exports.ModalPanelHeader=Xl;exports.ModalPanels=pp;exports.ModalShell=Vl;exports.ModalShellFooter=Hl;exports.ModalShellHeader=Ul;exports.Multiselect=mu;exports.Navbar=ru;exports.NotesField=bo;exports.OfferCard=hn;exports.OfferCardEmpty=Ci;exports.OfferCardError=ki;exports.OfferCardList=Di;exports.OfferCardSkeleton=Si;exports.OtherTenderForm=zl;exports.OutcomeView=$o;exports.PageHeader=rl;exports.PaginationSummary=_l;exports.PaymentCashChangeBanner=Zs;exports.PaymentSubAmountInput=Xs;exports.PaymentSuccessView=Kl;exports.PaymentTotalBanner=ql;exports.PickerRow=Sl;exports.PillTabs=Po;exports.PinField=So;exports.ProgramListItem=Xi;exports.RICH_TEXT_PRESETS=hi;exports.ReasonSelect=ho;exports.RecordCard=zo;exports.RecordHeader=Ro;exports.RecordLayout=_o;exports.RecordTotals=Ho;exports.RedeemCodeInput=tu;exports.RefundMethodCards=No;exports.RefundProgressList=ko;exports.RelatedRecordList=Oo;exports.RevenueDistributionCard=Bi;exports.RevenueDistributionEmpty=Vi;exports.RevenueDistributionError=Ui;exports.RevenueDistributionSkeleton=Hi;exports.RichTextArea=bi;exports.RowActions=kl;exports.SectionPanel=xo;exports.Select=Xe;exports.SessionExpiredCard=Go;exports.SessionTimeline=sl;exports.SplitPaymentSummary=Bl;exports.SplitTenderPanel=yo;exports.StatTiles=Mo;exports.StatusChip=il;exports.StepProgress=aa;exports.Stepper=mi;exports.SuccessState=Ji;exports.Summary=lo;exports.Table=Rs;exports.TableSkeleton=ll;exports.TenderMethods=go;exports.TicketSelection=Hf;exports.TileSelect=Wl;exports.Toggle=el;exports.ToolbarButton=hl;exports.UnderlineTabs=bl;exports.WizardShell=oo;exports.adminFieldErrorClass=wl;exports.adminFieldHintClass=jl;exports.adminFieldLabelClass=Ks;exports.adminFieldLabelSuffixClass=Ys;exports.adminInputClass=yl;exports.adminInputReadOnlyClass=vl;exports.adminInputWrapperClass=gl;exports.adminRowClass=dl;exports.adminSurfaceCss=Cc;exports.adminSurfaceTokens=Ns;exports.adminTableClass=ul;exports.adminTableFooterClass=ml;exports.adminTdClass=cl;exports.adminThClass=ol;exports.calculateAllocationDifference=wm;exports.computeChange=us;exports.currencyFractionDigits=Et;exports.formatMoney=fe;exports.formatOfferCurrency=fs;exports.formatRevenueAmount=gm;exports.formatRevenueCurrency=ym;exports.generateAutomaticInstallments=Gi;exports.generateDistributionId=Vs;exports.getCurrencySymbol=vm;exports.offerCardVariants=Ai;exports.offerListVariants=$i;exports.pageRange=Rl;exports.parseOfferCurrency=Wu;exports.parseRevenueCurrency=jm;exports.pillTabId=la;exports.pillTabPanelId=oa;exports.pillTabPanelProps=$h;exports.posSurfaceTokens=ie;exports.roundToCurrency=_s;exports.useControlSize=Sc;exports.useDensity=Cn;exports.useDiscardGuard=gp;exports.useDiscardGuardActions=sp;exports.useModalPanel=rp;exports.useModalPanels=bp;exports.useReportUnsavedChanges=np;Object.keys(c).forEach(e=>{e!=="default"&&!Object.prototype.hasOwnProperty.call(exports,e)&&Object.defineProperty(exports,e,{enumerable:!0,get:()=>c[e]})});
41
+ `,Hl=h.forwardRef(({children:e,relativeOverlayRoot:n=!0,className:s,style:a,"data-testid":r="modal-shell"},i)=>t.jsxs(t.Fragment,{children:[t.jsx("style",{children:Kx}),t.jsx("div",{ref:i,"data-testid":r,style:a,className:c.cn("flex flex-col gap-4 p-4 rounded-3xl bg-white shadow-xl","md:gap-5 md:p-6",n&&"relative","motion-safe:animate-[pp-modal-in_220ms_ease-out]","motion-safe:transition-[min-height] motion-safe:duration-[420ms] motion-safe:ease-in-out",s),children:e})]}));Hl.displayName="ModalShell";const Wl=({title:e,subtitle:n,leading:s,titleClassName:a,onClose:r,closeLabel:i="Close",actions:o,className:l,"data-testid":d="modal-shell-header"})=>t.jsxs("header",{className:c.cn("flex items-center justify-between gap-3",l),"data-testid":d,children:[t.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[s,t.jsxs("div",{className:"min-w-0",children:[t.jsx("h2",{className:c.cn("text-xl font-semibold",a),"data-testid":`${d}-title`,children:e}),n&&t.jsx("div",{className:"text-xs font-semibold text-default-500","data-testid":`${d}-subtitle`,children:n})]})]}),t.jsxs("div",{className:"flex items-center gap-2",children:[o,r&&t.jsx(O,{isIconOnly:!0,variant:"light",radius:"full",size:"sm",onPress:r,"aria-label":i,"data-testid":`${d}-close`,children:t.jsx(P,{icon:"lucide:x",width:20,height:20,"aria-hidden":"true"})})]})]});Wl.displayName="ModalShellHeader";const ql=({children:e,columns:n=2,className:s,"data-testid":a="modal-shell-footer"})=>t.jsx("footer",{className:c.cn("mt-2 gap-3",n===2?"flex flex-col md:grid md:grid-cols-2 [&>*]:w-full [&>*:first-child]:md:order-2 [&>*:nth-child(2)]:md:order-1":"grid grid-cols-1",s),"data-testid":a,children:e});ql.displayName="ModalShellFooter";const Yx={2:"sm:grid-cols-2",3:"sm:grid-cols-3",4:"sm:grid-cols-4",5:"sm:grid-cols-5",6:"sm:grid-cols-6"},Qx={1:"grid-cols-1",2:"grid-cols-2"},$t={grid:"gap-2",tile:`flex flex-col items-center justify-center gap-[0.3125rem] h-auto min-h-0 min-w-0 rounded-xl border px-1 py-2.5 transition-colors ${ke} motion-reduce:data-[pressed=true]:scale-100 [html[data-pos-reduce-motion=true]_&]:data-[pressed=true]:scale-100`,idle:"border-pos-field bg-white text-pos-ink data-[hover=true]:border-pos-line-strong data-[hover=true]:bg-white",active:"border-primary bg-primary/[.09] text-primary data-[hover=true]:bg-primary/[.09]",icon:"flex h-[1.0625rem] w-[1.0625rem] items-center justify-center",label:"text-[0.71875rem] font-medium leading-[0.875rem]"},ns=e=>typeof e=="string"?t.jsx(P,{icon:e,width:20,height:20,"aria-hidden":"true"}):e,Zx=e=>t.jsx("span",{"aria-hidden":"true",className:$t.icon,children:typeof e=="string"?t.jsx(P,{icon:e,width:"100%",height:"100%","aria-hidden":"true"}):e}),rn=`h-[2.125rem] min-h-0 min-w-fit flex-1 whitespace-nowrap rounded-full px-2.5 text-[0.8125rem] font-medium transition-colors ${ke}`,Xx="pointer-events-none absolute -left-[9999px] top-0 flex flex-row gap-1 p-1 opacity-0",fr="flex-none",Jx=typeof window<"u"?h.useLayoutEffect:h.useEffect,xr=e=>e?"bg-white text-default-900 shadow-[0_2px_8px_rgba(0,0,0,0.06)] data-[hover=true]:bg-white data-[pressed=true]:bg-white data-[hover=true]:opacity-100":"bg-transparent text-default-600 data-[hover=true]:bg-transparent data-[pressed=true]:bg-transparent data-[hover=true]:opacity-100 data-[hover=true]:text-default-900",Gl=({options:e,selectedKey:n,onSelect:s,heading:a,ariaLabel:r="Select an option",variant:i="tiles",maxVisible:o,moreLabel:l="More",columnsDesktop:d=3,columnsMobile:u=2,size:f="md",className:m,"data-testid":p="tile-select"})=>{const x=f==="sm",g=e.find(y=>y.key===n);return i==="compact"?t.jsx(ep,{options:e,selectedKey:n,onSelect:s,ariaLabel:r,moreLabel:l,dataTestId:p,...a!==void 0?{heading:a}:{},...o!==void 0?{maxVisible:o}:{},...m!==void 0?{className:m}:{}}):t.jsxs("div",{className:c.cn("flex flex-col gap-3",m),"data-testid":p,children:[a&&t.jsx("h3",{className:"text-sm font-medium text-default-700",id:`${p}-heading`,children:a}),t.jsx("div",{className:"md:hidden",children:t.jsx(Xe,{"aria-label":a?void 0:r,"aria-labelledby":a?`${p}-heading`:void 0,selectedKeys:n?[n]:[],onSelectionChange:y=>{const v=Array.from(y)[0];typeof v=="string"&&s(v)},placeholder:r,variant:"bordered",radius:"lg","data-testid":`${p}-mobile-select`,startContent:g?t.jsx("span",{"aria-hidden":"true",className:"shrink-0",children:ns(g.icon)}):void 0,popoverProps:{placement:"bottom-start",classNames:{content:"bg-white border border-default-200 shadow-lg rounded-xl p-1"}},listboxProps:{classNames:{list:"max-h-[var(--popover-available-height,40vh)] overflow-y-auto"},itemClasses:{base:["rounded-lg","px-3 py-2","text-default-800","data-[hover=true]:bg-default-100","data-[selectable=true]:focus:bg-default-100","data-[selected=true]:bg-primary-50","data-[selected=true]:text-primary","data-[selected=true]:font-medium"]}},children:e.map(y=>t.jsx(c.SelectItem,{isDisabled:y.isDisabled,startContent:t.jsx("span",{"aria-hidden":"true",className:"shrink-0",children:ns(y.icon)}),"data-testid":y["data-testid"]??`${p}-${y.key}-mobile`,children:y.label},y.key))})}),t.jsx("div",{role:"group","aria-labelledby":a?`${p}-heading`:void 0,"aria-label":a?void 0:r,className:c.cn("hidden md:grid",x?$t.grid:"gap-3",Qx[u],Yx[d]),"data-size":f,children:e.map(y=>{const b=n===y.key;return t.jsxs(O,{variant:"bordered",radius:"lg","aria-pressed":b,"aria-label":y.label,isDisabled:y.isDisabled,onPress:()=>s(y.key),"data-testid":y["data-testid"]??`${p}-${y.key}`,className:x?c.cn($t.tile,b?$t.active:$t.idle):c.cn("flex flex-col items-center justify-center gap-2 h-auto min-h-20 px-4 py-4","border bg-transparent transition-colors",ke,b?"border-primary bg-primary-50 text-primary":"border-default-200 text-default-800 hover:bg-default-50"),"data-size":f,children:[x?Zx(y.icon):t.jsx("span",{"aria-hidden":"true",children:ns(y.icon)}),t.jsx("span",{className:x?$t.label:"text-sm font-medium",children:y.label})]},y.key)})})]})};Gl.displayName="TileSelect";function ep({options:e,selectedKey:n,onSelect:s,heading:a,ariaLabel:r,maxVisible:i,moreLabel:o,className:l,dataTestId:d}){const u=h.useRef(null),f=h.useRef(null),m=h.useMemo(()=>e.map((E,S)=>({option:E,index:S})).filter(({option:E})=>E.alwaysInMenu!==!0).map(({index:E})=>E),[e]),p=m.length<e.length,x=h.useCallback(E=>{const S=m.map(F=>({index:F,priority:e[F]?.priority??0})).sort((F,L)=>F.priority-L.priority||L.index-F.index),_=new Set(S.slice(0,m.length-E).map(F=>F.index));return m.filter(F=>!_.has(F))},[e,m]),[g,y]=h.useState(e.length);Jx(()=>{const E=u.current,S=f.current;if(!E||!S)return;const _=()=>{const L=Array.from(S.children),M=L.slice(0,e.length).map(G=>G.getBoundingClientRect().width),I=L[e.length]?.getBoundingClientRect().width??0,W=window.getComputedStyle(E),K=Number.parseFloat(W.columnGap)||0,z=E.clientWidth-(Number.parseFloat(W.paddingLeft)||0)-(Number.parseFloat(W.paddingRight)||0);if(z<=0||M.some(G=>G===0)){y(m.length);return}const ne=G=>{const se=p||G<m.length,Y=G+(se?1:0);return x(G).reduce((J,q)=>J+(M[q]??0),0)+(se?I:0)+K*(Y-1)<=z};for(let G=m.length;G>=1;G-=1)if(ne(G)){y(G);return}y(1)};_();const F=new ResizeObserver(_);return F.observe(E),()=>F.disconnect()},[e,o,x,m,p]);const b=Math.max(1,Math.min(g,i??m.length,m.length)),w=!p&&b===m.length-1&&g===m.length?m.length:b,$=p||w<m.length,N=new Set(x(w)),A=e.filter((E,S)=>N.has(S)),k=$?e.filter((E,S)=>!N.has(S)):[],C=k.find(E=>E.key===n);return t.jsxs("div",{className:c.cn("relative flex flex-col gap-3",l),"data-testid":d,children:[a&&t.jsx("h3",{className:"text-sm font-medium text-default-700",id:`${d}-heading`,children:a}),t.jsxs("div",{ref:u,role:"group","aria-labelledby":a?`${d}-heading`:void 0,"aria-label":a?void 0:r,className:"flex flex-row gap-1 rounded-full bg-default-100 p-1",children:[A.map(E=>t.jsx(O,{variant:"light",radius:"full","aria-pressed":n===E.key,isDisabled:E.isDisabled,onPress:()=>s(E.key),"data-testid":E["data-testid"]??`${d}-${E.key}`,className:c.cn(rn,xr(n===E.key)),children:E.label},E.key)),k.length>0&&t.jsxs(c.Dropdown,{placement:"bottom-end",radius:"lg",children:[t.jsx(c.DropdownTrigger,{children:t.jsxs(O,{variant:"light",radius:"full","aria-pressed":C!==void 0,"data-testid":`${d}-more`,className:c.cn(rn,"gap-1",C!==void 0?"min-w-0":"min-w-fit",xr(C!==void 0)),children:[t.jsx("span",{className:"min-w-0 truncate",children:C?.label??o}),t.jsx(P,{icon:"lucide:chevron-down",width:14,height:14,"aria-hidden":"true"})]})}),t.jsx(c.DropdownMenu,{"aria-label":o,className:"w-64 p-2",selectionMode:"single",selectedKeys:C?[C.key]:[],disabledKeys:k.filter(E=>E.isDisabled).map(E=>E.key),onAction:E=>s(String(E)),children:k.map(E=>t.jsx(c.DropdownItem,{textValue:E.label,...E.description!==void 0?{description:E.description}:{},"data-testid":E["data-testid"]??`${d}-${E.key}`,children:E.label},E.key))})]})]}),t.jsxs("div",{ref:f,"aria-hidden":"true",className:Xx,children:[e.map(E=>t.jsx(O,{variant:"light",radius:"full",tabIndex:-1,className:c.cn(rn,fr),children:E.label},E.key)),t.jsxs(O,{variant:"light",radius:"full",tabIndex:-1,className:c.cn(rn,fr,"gap-1"),children:[o,t.jsx(P,{icon:"lucide:chevron-down",width:14,height:14})]})]})]})}const tp={subtle:{wrapper:"bg-default-100",amount:"text-default-900"},success:{wrapper:"bg-success-50 text-success-700",amount:"text-success-700"}},Kl=({total:e,label:n,locale:s="en-US",variant:a="subtle",className:r,"data-testid":i="payment-total-banner"})=>{const o=tp[a];return t.jsxs("div",{"data-testid":i,className:c.cn("rounded-2xl px-6 py-5 text-center",o.wrapper,r),children:[t.jsx("div",{className:"text-sm text-default-600",children:n}),t.jsx("div",{className:c.cn("mt-1 text-4xl font-bold tracking-tight",o.amount),"data-testid":`${i}-amount`,children:fe(e.value,s,e.currency)})]})};Kl.displayName="PaymentTotalBanner";const np={white:"bg-white/70 backdrop-blur-sm",transparent:"bg-transparent"},Yl=({title:e,subtitle:n,backdrop:s="white",exiting:a=!1,className:r,"data-testid":i="loading-overlay"})=>t.jsxs("div",{role:"status","aria-live":a?"off":"polite","aria-hidden":a||void 0,"data-testid":i,"data-state":a?"exiting":"visible",className:c.cn("absolute inset-0 z-10 flex flex-col items-center justify-center gap-4 rounded-3xl",np[s],a?"pointer-events-none motion-safe:animate-[pp-fade-out_280ms_ease-in_forwards]":"motion-safe:animate-[pp-fade-in_150ms_ease-out]",r),children:[t.jsx("div",{"aria-hidden":"true","data-testid":`${i}-spinner`,className:"h-16 w-16 rounded-full border-4 border-primary-100 border-t-primary animate-spin motion-safe:animate-[pp-scale-in_200ms_ease-out,spin_1s_linear_infinite]"}),t.jsxs("div",{className:"text-center",children:[t.jsx("div",{className:"text-xl font-semibold","data-testid":`${i}-title`,children:e}),n&&t.jsx("div",{className:"mt-1 text-sm text-default-600",children:n})]})]});Yl.displayName="LoadingOverlay";const Xs=({cashChange:e,label:n="Cash to return",secondaryLine:s,locale:a="en-US",onDismiss:r,dismissAriaLabel:i="Dismiss",align:o="left",className:l,"data-testid":d="payment-cash-change-banner"})=>{if(!e||e.value<=0)return null;const u=o==="center";return t.jsxs("div",{role:"status","aria-live":"polite","data-testid":d,className:c.cn("flex w-full items-center gap-3 rounded-2xl border border-info-200 bg-info-50 px-5 py-4",u?"justify-center text-center":"text-left","motion-safe:animate-[pp-slide-down_200ms_ease-out]",l),children:[t.jsx(P,{icon:"lucide:info",width:28,height:28,className:"shrink-0 text-info-700","aria-hidden":"true"}),t.jsxs("div",{className:c.cn("flex flex-col",u?"items-center":"flex-1"),children:[t.jsx("span",{className:"text-xs font-medium uppercase tracking-wider text-info-700",children:n}),t.jsx("span",{className:"text-2xl font-bold text-info-700","data-testid":`${d}-amount`,children:fe(e.value,a,e.currency)}),s&&t.jsx("span",{className:"mt-0.5 text-xs text-info-700/80",children:s})]}),r&&t.jsx(O,{isIconOnly:!0,variant:"light",radius:"full",size:"sm",onPress:r,"aria-label":i,"data-testid":`${d}-dismiss`,className:"shrink-0 text-info-700 hover:bg-info-100",children:t.jsx(P,{icon:"lucide:x",width:18,height:18,"aria-hidden":"true"})})]})};Xs.displayName="PaymentCashChangeBanner";const Ql=({title:e,subtitle:n,emailLine:s,confirmationEmail:a,cashChange:r,cashChangeLabel:i="Cash to return",locale:o="en-US",closeLabel:l="Close",onClose:d,className:u,"data-testid":f="payment-success-view"})=>{const m=!!(r&&r.value>0);return t.jsxs("div",{"data-testid":f,className:c.cn("flex flex-col items-center gap-6 py-8 px-4 text-center","motion-safe:animate-[pp-fade-in_250ms_ease-out]",u),children:[t.jsx("div",{"aria-hidden":"true",className:"flex items-center justify-center rounded-full bg-[#A2D9C6] p-[10px]",children:t.jsx(P,{icon:"gravity-ui:circle-check-fill",width:76,height:76,className:"text-[#10B981]","aria-hidden":"true"})}),t.jsxs("div",{className:"space-y-3",children:[t.jsx("h2",{className:"text-2xl font-bold","data-testid":`${f}-title`,children:e}),t.jsx("p",{className:"text-default-700",children:n}),s&&a&&t.jsxs("p",{className:"text-default-700",children:[s,t.jsx("br",{}),t.jsx("strong",{className:"font-semibold",children:a})]})]}),m&&r&&t.jsx(Xs,{cashChange:r,label:i,locale:o,align:"center",className:"max-w-[400px]","data-testid":`${f}-cash-change`}),d&&t.jsx(O,{color:"default",variant:"bordered",radius:"full",size:"lg",onPress:d,"data-testid":`${f}-close`,className:"mt-4 w-full",children:l})]})};Ql.displayName="PaymentSuccessView";const Js=({heading:e,amountLabel:n,value:s,defaultValue:a,onChange:r,onBlur:i,placeholder:o,isDisabled:l,isInvalid:d,errorMessage:u,autoFocus:f,maxAmount:m,hideHeading:p=!1,className:x,"data-testid":g="payment-sub-amount-input"})=>{const y=`${g}-input`,b=s!==void 0,[v,w]=h.useState(a??""),$=b?s:v,{isUntouched:N,markEdited:A}=Ol($),k=h.useCallback(S=>{if(m!==void 0){const _=Number.parseFloat(S.replace(",","."));if(Number.isFinite(_)&&_>m)return}A(S),b||w(S),r?.(S)},[m,r,A,b]),C=zl(N,k),E=h.useCallback(S=>{const _=S.currentTarget;requestAnimationFrame(()=>{_.isConnected&&_.select()})},[]);return t.jsxs("div",{className:c.cn("flex flex-col gap-3 border-t border-default-100 pt-5",x),"data-testid":g,children:[t.jsx("h3",{className:c.cn("text-lg font-semibold",p&&"sr-only"),"data-testid":`${g}-heading`,children:e}),t.jsx(c.Input,{ref:C,id:y,label:n,labelPlacement:"outside",classNames:p?{label:"sr-only"}:void 0,type:"text",inputMode:"decimal",pattern:"[0-9]*[.,]?[0-9]*",value:$,onChange:S=>k(S.target.value),onFocus:E,onBlur:i,placeholder:o,isDisabled:l,isInvalid:d,errorMessage:d?u:void 0,variant:"bordered",radius:"lg","aria-invalid":d||void 0,autoFocus:f,"data-testid":`${g}-field`})]})};Js.displayName="PaymentSubAmountInput";const sp={danger:{tile:"bg-danger-50 text-danger-600",icon:"solar:danger-circle-outline",confirmColor:"danger"},warning:{tile:"bg-warning-50 text-warning-600",icon:"solar:danger-triangle-outline",confirmColor:"warning"}},ap=e=>typeof e=="string"?t.jsx(P,{icon:e,className:"size-5","aria-hidden":"true"}):e,ea=({isOpen:e,title:n,confirmLabel:s,onConfirm:a,onOpenChange:r,children:i,description:o,cancelLabel:l="Cancel",variant:d="danger",isPending:u=!1,isDismissable:f,isKeyboardDismissDisabled:m=!1,hideIcon:p=!1,icon:x,"data-testid":g="confirm-dialog"})=>{const y=i??o??null,b=sp[d],v=p?null:ap(x??b.icon);return t.jsx(Yt,{isOpen:e,onOpenChange:w=>r?.(w),placement:"center",size:"md",isDismissable:(f??!0)&&!u,isKeyboardDismissDisabled:m||u,hideCloseButton:u,className:"gap-4 p-6",classNames:{base:"rounded-3xl"},"data-testid":g,children:t.jsxs(c.ModalContent,{role:"alertdialog",children:[t.jsxs(c.ModalHeader,{className:"flex flex-col items-center gap-3 p-0 text-center",children:[v?t.jsx("div",{"aria-hidden":"true","data-testid":`${g}-icon`,className:c.cn("flex size-10 items-center justify-center rounded-full",b.tile),children:v}):null,t.jsx("span",{"data-testid":`${g}-title`,className:"text-lg font-semibold text-zinc-950",children:n})]}),y!==null?t.jsx(c.ModalBody,{"data-testid":`${g}-body`,className:"gap-0 p-0",children:typeof y=="string"?t.jsx("p",{className:"mx-auto max-w-sm text-center text-sm text-gray-600",children:y}):y}):null,t.jsxs(c.ModalFooter,{className:"flex flex-col-reverse gap-2 p-0 sm:flex-row sm:gap-3",children:[t.jsx(O,{variant:"bordered",color:"default",radius:"full",onPress:()=>r?.(!1),isDisabled:u,"data-testid":`${g}-dismiss`,className:"w-full sm:flex-1",children:l}),t.jsx(O,{color:b.confirmColor,variant:"solid",radius:"full",onPress:a,isLoading:u,"data-testid":`${g}-confirm`,className:"w-full sm:flex-1",children:s})]})]})})};ea.displayName="ConfirmDialog";const pt={item:"list-none",box:"outline-none focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus",body:"gap-3 px-4 py-3",text:"flex min-w-0 flex-col gap-1",message:"text-sm text-gray-900 [overflow-wrap:anywhere]",description:"text-sm text-gray-600 [overflow-wrap:anywhere]",actions:"flex flex-wrap items-center gap-2"},rp={danger:"bg-danger-50",warning:"bg-warning-50"},Zl=({message:e,description:n,confirmLabel:s,cancelLabel:a="Cancel",onConfirm:r,onCancel:i,variant:o="danger",isPending:l=!1,initialFocus:d="cancel",containEscape:u=!0,size:f="sm",as:m="div",className:p,"data-testid":x="inline-confirm"})=>{const g=h.useId(),y=h.useId(),b=h.useRef(null),v=h.useRef(null),w=h.useRef(null),$=n!=null,N=h.useRef({isPending:l,containEscape:u,onCancel:i});N.current={isPending:l,containEscape:u,onCancel:i},h.useEffect(()=>{(d==="confirm"?v:w).current?.focus()},[]),h.useEffect(()=>{const C=b.current;if(C===null)return;const E=S=>{S.key==="Escape"&&(N.current.containEscape&&S.stopPropagation(),!N.current.isPending&&N.current.onCancel())};return C.addEventListener("keydown",E),()=>C.removeEventListener("keydown",E)},[]);const A=h.useRef(!1);h.useLayoutEffect(()=>{const C=b.current;if(C===null)return;const E=document.activeElement;if(l){const S=E===null||E===document.body||!C.contains(E),_=E instanceof HTMLButtonElement&&E.disabled;A.current&&(S||_)&&C.focus({preventScroll:!0});return}E===C&&(d==="confirm"?v:w).current?.focus()},[l,d]);const k=t.jsx(c.Card,{ref:b,role:"alertdialog","aria-modal":"false","aria-labelledby":g,"aria-describedby":$?y:void 0,"aria-busy":l||void 0,tabIndex:-1,shadow:"none",radius:"lg",onFocus:()=>{A.current=!0},onBlur:C=>{const E=C.relatedTarget;A.current=E instanceof Node&&C.currentTarget.contains(E)},className:c.cn(pt.box,rp[o],m==="div"&&p),"data-testid":x,children:t.jsxs(c.CardBody,{className:pt.body,children:[t.jsxs("div",{className:pt.text,children:[t.jsx("p",{id:g,className:pt.message,children:e}),$?t.jsx("p",{id:y,className:pt.description,children:n}):null]}),t.jsxs("div",{className:pt.actions,children:[t.jsx(O,{ref:v,size:f,color:o,variant:"solid",onPress:r,isLoading:l,"data-testid":`${x}-confirm`,children:s}),t.jsx(O,{ref:w,size:f,color:"default",variant:"light",onPress:i,isDisabled:l,"data-testid":`${x}-cancel`,children:a})]})]})});return m==="li"?t.jsx("li",{className:c.cn(pt.item,p),children:k}):k};Zl.displayName="InlineConfirm";const ip={guardScope:(e,n)=>n(),bypass:e=>e(),report:()=>{},unreport:()=>{}},_n=h.createContext(ip),ta=h.createContext(null);function lp(e){const{report:n,unreport:s}=h.useContext(_n),a=h.useContext(ta),r=h.useId();h.useEffect(()=>{n(r,{scope:a,isDirty:e})},[n,r,a,e]),h.useEffect(()=>()=>s(r),[s,r])}function op(){const{guardScope:e,bypass:n}=h.useContext(_n);return h.useMemo(()=>({guard:s=>e(null,s),bypass:n}),[e,n])}function Xl(){const{guardScope:e}=h.useContext(_n),n=h.useContext(ta);return h.useCallback(s=>e(n,s),[e,n])}const cp=({scope:e,children:n})=>t.jsx(ta.Provider,{value:e,children:n}),Jl=({guard:e,children:n,title:s="Discard changes?",description:a="What you entered will be lost.",confirmLabel:r="Discard",keepEditingLabel:i="Keep editing","data-testid":o="discard-guard"})=>{const{pending:l,confirmKey:d,confirm:u,keepEditing:f,report:m,unreport:p,guardScope:x}=e.internals,g=h.useMemo(()=>({guardScope:x,bypass:e.bypass,report:m,unreport:p}),[x,e.bypass,m,p]);return t.jsxs(_n.Provider,{value:g,children:[n,t.jsx(ea,{isOpen:l!==null,onOpenChange:y=>{y||f()},onConfirm:u,variant:"warning",title:s,description:a,confirmLabel:r,cancelLabel:i,"data-testid":o},d)]})};Jl.displayName="DiscardGuard";const na=h.createContext(null);function dp(){const e=h.useContext(na),n=Xl(),s=e?.back,a=h.useCallback(()=>{s&&n(s)},[n,s]);return{isActive:e?.isActive??!0,canGoBack:e?.canGoBack??!1,back:a}}const up=["button:not([disabled])","a[href]",'input:not([disabled]):not([type="hidden"])',"select:not([disabled])","textarea:not([disabled])",'[tabindex]:not([tabindex="-1"])','[contenteditable="true"]'].join(",");function mp(e){for(const n of e.querySelectorAll(up))if(!n.closest('[hidden], [inert], [aria-hidden="true"]'))return n;return null}function pr(e,n){return!e||!e.isConnected||!n.contains(e)||e.matches(":disabled")?!1:!e.closest("[hidden], [inert]")}const fp=new Set(["menu","listbox","dialog","grid","tree"]);function xp(e){for(const n of e.querySelectorAll('[aria-expanded="true"][aria-controls]')){const s=n.ownerDocument.getElementById(n.getAttribute("aria-controls")??"");if(!s?.isConnected)continue;if((n.getAttribute("aria-haspopup")??"false")!=="false"||fp.has(s.getAttribute("role")??""))return s}return null}const hr="react-aria-focus-scope-restore";class pp{panels=new Map;active=null;setContainer(n,s){s?this.panels.set(n,{entry:null,last:null,...this.panels.get(n),container:s}):this.panels.delete(n)}setEntry(n,s){const a=this.panels.get(n);a?a.entry=s:s&&this.panels.set(n,{container:null,entry:s,last:null})}remember(n,s){const a=this.panels.get(n);a&&(a.last=s)}setActive(n,s){this.active={key:n,isReturn:s}}focusActive(){if(!this.active)return;const n=this.panels.get(this.active.key),s=n?.container;if(!n||!s||s.contains(document.activeElement))return;((this.active.isReturn&&pr(n.last,s)?n.last:null)??(pr(n.entry,s)?n.entry:null)??mp(s))?.focus()}recoverFocus(){const n=this.active?this.panels.get(this.active.key)?.container:null,s=n?xp(n):null;s?.focus(),s?.contains(document.activeElement)||this.focusActive()}}const hp="flex flex-initial items-center gap-2 py-4 pl-4 pr-12 text-large font-semibold",bp="min-w-0 flex-1 truncate text-large font-semibold",gp="flex shrink-0 items-center gap-2",yp="size-5";function vp({panels:e,children:n}){const[s]=h.useState(()=>new pp),{entries:a,back:r}=e,i=a[a.length-1].key,o=h.useRef(null);return h.useLayoutEffect(()=>{const l=o.current;o.current={activeKey:i,keys:new Set(a.map(d=>d.key))},!(!l||l.activeKey===i)&&(s.setActive(i,l.keys.has(i)),s.focusActive())},[i,a,s]),t.jsx(t.Fragment,{children:a.map((l,d)=>t.jsx(jp,{entryKey:l.key,isActive:d===a.length-1,canGoBack:d>0,back:r,memory:s,children:n(l.panel,l)},l.key))})}const jp=({entryKey:e,isActive:n,canGoBack:s,back:a,memory:r,children:i})=>{const o=h.useRef(null),l=h.useCallback(u=>r.setEntry(e,u),[r,e]);h.useLayoutEffect(()=>{const u=o.current;if(r.setContainer(e,u),!u)return;const f=m=>{u.hidden&&(m.preventDefault(),r.recoverFocus())};return u.addEventListener(hr,f),()=>{u.removeEventListener(hr,f),r.setContainer(e,null)}},[r,e]);const d=h.useMemo(()=>({isActive:n,canGoBack:s,back:a,setEntryFocus:l}),[n,s,a,l]);return t.jsx(na.Provider,{value:d,children:t.jsx(cp,{scope:e,children:t.jsx("div",{ref:o,hidden:!n,style:{display:n?"contents":"none"},onFocus:u=>{u.currentTarget.contains(u.target)&&r.remember(e,u.target)},children:i})})})},eo=({title:e,onBack:n,backLabel:s="Back",isBackDisabled:a,size:r="md",actions:i,className:o,"data-testid":l="modal-panel-header"})=>{const d=h.useContext(na),u=Xl(),f=h.useId(),m=n??(d?.canGoBack?d.back:void 0);return t.jsxs("header",{className:c.cn(hp,o),"data-testid":l,children:[m?t.jsx(O,{ref:d?.setEntryFocus,isIconOnly:!0,variant:"light",color:"default",size:r,"aria-label":s,"aria-describedby":f,isDisabled:a,onPress:()=>u(m),"data-testid":`${l}-back`,children:t.jsx(P,{icon:"solar:arrow-left-outline",className:yp,"aria-hidden":"true"})}):null,t.jsx("h2",{id:f,className:bp,"data-testid":`${l}-title`,children:e}),i?t.jsx("div",{className:gp,children:i}):null]})};eo.displayName="ModalPanelHeader";function wp(e){const n=h.useRef(1),[s]=h.useState(e),[a,r]=h.useState(()=>[{key:"panel-0",panel:e}]),i=h.useCallback(f=>{const m=`panel-${n.current}`;return n.current+=1,{key:m,panel:f}},[]),o=h.useCallback(f=>{const m=i(f);r(p=>[...p,m])},[i]),l=h.useCallback(()=>{r(f=>f.length>1?f.slice(0,-1):f)},[]),d=h.useCallback(f=>{const m=i(f);r(p=>[...p.slice(0,-1),m])},[i]),u=h.useCallback(f=>{r([i(f===void 0?s:f)])},[i,s]);return h.useMemo(()=>({current:a[a.length-1].panel,entries:a,canGoBack:a.length>1,push:o,back:l,replace:d,reset:u}),[a,o,l,d,u])}function Np(){const e=h.useRef(new Map),[n,s]=h.useState(0),[a,r]=h.useState(null),[i,o]=h.useState(0),l=h.useCallback(()=>{let b=0;for(const v of e.current.values())v.isDirty&&(b+=1);s(b)},[]),d=h.useCallback((b,v)=>{e.current.set(b,v),l()},[l]),u=h.useCallback(b=>{e.current.delete(b),l()},[l]),f=h.useCallback((b,v)=>{let w=!1;for(const $ of e.current.values())$.isDirty&&(b===null||$.scope===b)&&(w=!0);w?r({leave:v}):v()},[]),m=h.useCallback(b=>f(null,b),[f]),p=h.useCallback(b=>{for(const v of e.current.values())v.isDirty=!1;l(),r(null),b()},[l]),x=h.useCallback(b=>v=>{v?b(!0):m(()=>b(!1))},[m]),g=h.useCallback(()=>{const b=a?.leave;r(null),o(v=>v+1),b?.()},[a]),y=h.useCallback(()=>r(null),[]);return h.useMemo(()=>({isDirty:n>0,guard:m,bypass:p,guardOpenChange:x,internals:{pending:a,confirmKey:i,confirm:g,keepEditing:y,report:d,unreport:u,guardScope:f}}),[n,m,p,x,a,i,g,y,d,u,f])}const Cp=60,kp=(e,n,s=Cp)=>n?e>s:e<-s,to=(e,n)=>Math.max(0,Math.min(e,n)),Sp=160,$p=(e,n,s=Sp)=>Math.min(e,Math.max(0,n-s)),Ap=(e,n,s)=>to(e-n,s),Ep=(e,n,s)=>e!==null?to(e,s):n?s:0,Dp=e=>e?"":"transition-[height] duration-300 ease-out",Lp=e=>({onDrag:(n,s)=>{const a=e.open?e.fullHeight:0;e.setDragHeight(Ap(a,s?.offset?.y??0,e.fullHeight))},onDragEnd:(n,s)=>{kp(s?.offset?.y??0,e.open)&&e.onToggleOpen?.(),e.setDragHeight(null)}}),yt=(e,n)=>fe(e.value,n,e.currency),br=`opacity-60 transition-opacity ${ke}`,sa=({item:e,locale:n,onRemove:s,removeAriaLabel:a,showRemoveButton:r=!0,compact:i=!1})=>{const o=!!e.children&&e.children.length>0,l=!!s&&r&&e.removable!==!1,d=e.tone?"text-default-600":"text-default-500";return t.jsxs("div",{"data-testid":`summary-item-${e.id}`,className:c.cn(i?"flex flex-col gap-1 py-3 first:pt-0":"flex flex-col gap-2",e.tone&&"-mx-2 rounded-lg px-2 py-1.5"),style:e.tone?{backgroundColor:He[e.tone].bg}:void 0,children:[t.jsxs("div",{className:i?"flex items-start justify-between gap-2":"flex min-h-9 items-center justify-between gap-2",children:[t.jsxs("div",{className:"flex min-w-0 items-center gap-2 text-base text-foreground",children:[!i&&typeof e.quantity=="number"&&t.jsxs("span",{"data-testid":`summary-item-qty-${e.id}`,className:"shrink-0",children:[e.quantity," x"]}),e.leadingIcon,t.jsx("span",{"data-testid":`summary-item-name-${e.id}`,className:i?"line-clamp-2 text-sm font-semibold":c.cn("truncate",e.emphasis&&"font-medium"),children:e.name})]}),t.jsxs("div",{className:"flex shrink-0 items-center",children:[e.originalAmount&&t.jsx("span",{"data-testid":`summary-item-original-${e.id}`,className:c.cn("mr-2 whitespace-nowrap text-[0.8125rem] text-default-600 line-through",e.pending&&br),children:e.originalAmount}),e.amount&&t.jsx("span",{"data-testid":`summary-item-amount-${e.id}`,"data-pending":e.pending?"true":void 0,className:c.cn(i?"whitespace-nowrap text-sm font-semibold text-foreground":"whitespace-nowrap text-base text-foreground",e.pending&&br),children:yt(e.amount,n)}),l&&t.jsx(O,{isIconOnly:!0,size:"sm",variant:"light",radius:"full",className:c.cn("ml-1 size-8 min-w-8 p-2 text-danger",i&&"-my-1.5"),"aria-label":a,"data-testid":`summary-remove-${e.id}`,onPress:()=>s(e.id),children:t.jsx(P,{icon:"lucide:trash-2",width:16,height:16,className:"text-danger"})})]})]}),re(e.trailing)&&t.jsx("div",{"data-testid":`summary-item-trailing-${e.id}`,className:"flex justify-end",children:e.trailing}),e.dateLabel&&t.jsxs("div",{"data-testid":`summary-item-date-${e.id}`,className:c.cn("flex items-center gap-2 text-sm",d),children:[t.jsx(P,{icon:"lucide:calendar",width:16,height:16,className:"shrink-0"}),t.jsx("span",{className:"truncate",children:e.dateLabel})]}),e.dateRange&&t.jsxs("div",{"data-testid":`summary-item-daterange-${e.id}`,className:c.cn("flex items-center gap-2 text-sm",d),children:[t.jsx(P,{icon:"lucide:calendar",width:16,height:16,className:"shrink-0"}),t.jsx("span",{children:e.dateRange.from}),t.jsx(P,{icon:"lucide:arrow-right",width:16,height:16,className:"shrink-0"}),t.jsx("span",{children:e.dateRange.to})]}),e.details?.map((u,f)=>t.jsxs("div",{"data-testid":`summary-item-detail-${e.id}-${u.key??f}`,className:c.cn("flex items-center justify-between gap-2",i?"text-xs":"text-sm",d),children:[t.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[u.icon,t.jsx("span",{className:"truncate",children:u.label})]}),(u.value!=null||u.tooltip!=null)&&t.jsxs("div",{className:"flex shrink-0 items-center gap-1",children:[u.value!=null&&t.jsx("span",{className:c.cn("whitespace-nowrap",u.valueTone==="primary"&&c.cn("font-medium",e.tone?"text-primary-600":"text-primary")),children:u.value}),u.tooltip!=null&&t.jsx(c.Tooltip,{content:u.tooltip,children:t.jsx("span",{"data-testid":`summary-item-detail-tooltip-${e.id}-${u.key??f}`,className:"flex shrink-0 items-center",children:t.jsx(P,{icon:"lucide:info",width:16,height:16,className:c.cn(u.valueTone==="primary"?"text-primary":"text-default-400")})})})]})]},u.key??f)),o&&t.jsx("div",{"data-testid":`summary-children-${e.id}`,className:"flex flex-col gap-2 pl-6",children:e.children.map(u=>t.jsx(sa,{item:u,locale:n,onRemove:s,removeAriaLabel:a,showRemoveButton:r,compact:i},u.id))})]})};sa.displayName="SummaryItemRow";const no=({fee:e,locale:n,className:s})=>t.jsxs("div",{"data-testid":"summary-service-fee",className:c.cn("flex items-center justify-between gap-2",s),children:[t.jsxs("button",{type:"button",role:"switch","aria-checked":!!e.isSelected,"aria-label":typeof e.label=="string"?e.label:"Pay Service fee","data-testid":"summary-service-fee-toggle",onClick:e.onToggle,className:"flex min-w-0 items-center gap-2 text-left",children:[t.jsx("span",{"aria-hidden":"true",className:c.cn("flex size-4 shrink-0 items-center justify-center rounded-full border",e.isSelected?"border-primary":"border-default-200"),children:e.isSelected&&t.jsx("span",{className:"size-2 rounded-full bg-primary"})}),t.jsx("span",{className:"truncate text-sm font-medium text-foreground",children:e.label})]}),t.jsx("span",{"data-testid":"summary-service-fee-amount",className:"whitespace-nowrap text-base text-foreground",children:yt(e.amount,n)})]});no.displayName="SummaryServiceFeeRow";const aa=({row:e,locale:n,emphasized:s,onRemove:a,removeAriaLabel:r,showRemoveButton:i=!0,compact:o=!1})=>{const l=!!a&&i&&!!e.id,d=t.jsx("span",{"data-testid":`summary-row-label-${e.key}`,className:o?void 0:c.cn(s?"text-xl font-semibold leading-7":"text-base"),children:e.label});return t.jsxs("div",{"data-testid":`summary-row-${e.key}`,className:o?"flex items-center justify-between text-sm text-default-500":"flex items-center justify-between text-foreground",children:[l?t.jsxs("div",{className:"flex min-w-0 items-center",children:[d,t.jsx(O,{isIconOnly:!0,size:"sm",variant:"light",radius:"full",className:c.cn("ml-1 size-8 min-w-8 shrink-0 p-2 text-danger",o&&"-my-1.5"),"aria-label":r,"data-testid":`summary-remove-row-${e.id}`,onPress:()=>a(e.id),children:t.jsx(P,{icon:"lucide:trash-2",width:16,height:16,className:"text-danger"})})]}):d,t.jsx("span",{"data-testid":`summary-row-amount-${e.key}`,className:c.cn("whitespace-nowrap",!o&&"text-base",e.amountTone==="success"&&"text-success"),children:yt(e.amount,n)})]})};aa.displayName="SummaryTotalsLineRow";const so=({pricesInLabel:e,currency:n,items:s,serviceFee:a,rows:r,locale:i,onRemoveItem:o,removeAriaLabel:l,onRemoveTotalRow:d,removeTotalRowAriaLabel:u,showRemoveButton:f,emptyState:m,compact:p=!1,classNames:x})=>{const g=(s?.length??0)>0;return t.jsxs(t.Fragment,{children:[!p&&t.jsxs("div",{"data-testid":"summary-prices",className:c.cn("flex items-center justify-between text-xs text-default-500",x.prices),children:[t.jsx("span",{children:e}),n!=null&&t.jsx("span",{children:n})]}),g?t.jsx("div",{className:c.cn(p?"flex flex-col divide-y divide-default-100":"flex flex-col gap-4",x.items),children:s.map(y=>t.jsx(sa,{item:y,locale:i,onRemove:o,removeAriaLabel:l,showRemoveButton:f,compact:p},y.id))}):t.jsx("div",{"data-testid":"summary-empty",children:m}),a&&t.jsxs(t.Fragment,{children:[t.jsx(c.Divider,{className:"bg-default-100"}),t.jsx(no,{fee:a,locale:i,className:x.serviceFee})]}),r&&r.length>0&&t.jsx("div",{className:c.cn(p?c.cn("flex flex-col gap-1 pt-3",!a&&"border-t border-default-100"):"flex flex-col gap-4",x.totalsRows),children:r.map((y,b)=>t.jsx(aa,{row:y,locale:i,emphasized:!p&&b===0,onRemove:d,removeAriaLabel:u,showRemoveButton:f,compact:p},y.key))})]})};so.displayName="SummaryBody";const ao=({total:e,locale:n,compact:s=!1,className:a})=>{const r=s?"text-lg":"text-xl";return t.jsxs("div",{"data-testid":"summary-total",className:c.cn(`flex items-center justify-between ${r} font-semibold leading-7 text-foreground`,a),children:[t.jsx("span",{children:e.label??"Total"}),t.jsx("span",{"data-testid":"summary-total-amount",className:`whitespace-nowrap ${r} font-semibold leading-7`,children:yt(e.amount,n)})]})};ao.displayName="SummaryGrandTotalRow";const ro=({secondaryTotal:e,locale:n,className:s})=>t.jsxs("div",{"data-testid":"summary-secondary-total",className:c.cn("flex items-center justify-between text-lg font-semibold leading-7 text-primary",s),children:[t.jsx("span",{children:e.label}),t.jsx("span",{"data-testid":"summary-secondary-total-amount",className:"whitespace-nowrap text-lg font-semibold leading-7",children:yt(e.amount,n)})]});ro.displayName="SummarySecondaryTotalRow";const wn=({action:e,disabledByLoading:n,className:s,testId:a="summary-cta"})=>t.jsx(O,{color:"primary",radius:"full",className:c.cn("px-[18px] py-[14px] font-medium",s),"data-testid":a,isLoading:e.isLoading,isDisabled:e.isDisabled||n,onPress:e.onPress,endContent:t.jsx(P,{icon:"lucide:arrow-right",width:16,height:16}),children:e.label});wn.displayName="SummaryPrimaryCta";const io=({title:e,total:n,secondaryTotal:s,locale:a,open:r,progress:i,dragging:o,toggleAriaLabel:l,onToggleOpen:d,classNames:u})=>t.jsx("h2",{children:t.jsxs("button",{type:"button","data-testid":"summary-collapse-toggle","aria-expanded":r,"aria-label":l,onClick:d,className:c.cn("-mx-4 -mt-4 grid w-[calc(100%_+_32px)] grid-cols-1 px-4 pb-4 pt-4 text-left",u.header),children:[t.jsxs("span",{"aria-hidden":!r,style:{opacity:i},className:c.cn("col-start-1 row-start-1 flex items-center justify-between",!o&&"transition-opacity duration-300"),children:[t.jsx("span",{"data-testid":"summary-title",className:c.cn("text-xl font-semibold leading-7 text-foreground",u.title),children:e}),t.jsx("span",{"data-testid":"summary-close","aria-hidden":"true",className:c.cn("shrink-0 text-foreground",u.closeButton),children:t.jsx(P,{icon:"lucide:x",width:20,height:20})})]}),t.jsxs("span",{"aria-hidden":r,style:{opacity:1-i},className:c.cn("col-start-1 row-start-1 flex flex-col gap-2",!o&&"transition-opacity duration-300"),children:[t.jsxs("span",{className:"flex items-center justify-between text-xl font-semibold leading-7 text-foreground",children:[t.jsx("span",{children:n.label??"Total"}),t.jsx("span",{className:"whitespace-nowrap",children:yt(n.amount,a)})]}),s&&t.jsxs("span",{className:"flex items-center justify-between text-lg font-semibold leading-7 text-primary",children:[t.jsx("span",{children:s.label}),t.jsx("span",{className:"whitespace-nowrap",children:yt(s.amount,a)})]})]})]})});io.displayName="SummaryCollapseHeader";const lo=({cart:e,ariaLabel:n,onPress:s,className:a})=>t.jsxs("button",{type:"button","data-testid":"summary-cart","aria-label":n,onClick:s,className:c.cn("relative flex size-[52px] shrink-0 items-center justify-center rounded-full border border-default-200 bg-content1",a),children:[t.jsx(P,{icon:"lucide:shopping-bag",width:24,height:24,className:"text-foreground"}),e.count!=null&&t.jsx("span",{"data-testid":"summary-cart-badge",className:"absolute -right-1 -top-1 flex size-4 items-center justify-center rounded-full bg-primary text-xs text-primary-foreground",children:e.count})]});lo.displayName="SummaryCartButton";const oo=({open:e,progress:n,dragging:s,primaryAction:a,isLoading:r,cart:i,cartAriaLabel:o,ctaCaption:l,ctaError:d,onToggleOpen:u,classNames:f})=>t.jsxs("div",{"data-testid":"summary-mobile-bar",className:c.cn("flex flex-col gap-4",f.mobileBar),children:[t.jsx(c.Divider,{className:"bg-default-200"}),d&&t.jsx("div",{children:d}),t.jsxs("div",{className:"grid",children:[t.jsxs("div",{"aria-hidden":e,style:{opacity:1-n},className:c.cn("col-start-1 row-start-1 flex items-stretch gap-2.5",e&&"pointer-events-none",!s&&"transition-opacity duration-300"),children:[i&&t.jsx(lo,{cart:i,ariaLabel:o,className:f.cart,onPress:()=>{u?.(),i.onPress?.()}}),a&&t.jsx(wn,{action:a,disabledByLoading:r,className:c.cn("h-[52px] flex-1",f.cta),testId:"summary-cta-compact"})]}),a&&t.jsx("div",{"aria-hidden":!e,style:{opacity:n},className:c.cn("col-start-1 row-start-1 flex",!e&&"pointer-events-none",!s&&"transition-opacity duration-300"),children:t.jsx(wn,{action:a,disabledByLoading:r,className:c.cn("h-[52px] w-full",f.cta)})})]}),l&&t.jsx("div",{children:l})]});oo.displayName="SummaryActionBar";const Fp="(max-width: 767px)",Rp=e=>typeof window<"u"&&typeof window.matchMedia=="function"?window.matchMedia(e).matches:!1,_p=(e=Fp)=>{const[n,s]=h.useState(()=>Rp(e));return h.useEffect(()=>{if(typeof window>"u"||typeof window.matchMedia!="function")return;const a=window.matchMedia(e),r=()=>s(a.matches);return r(),a.addEventListener("change",r),()=>a.removeEventListener("change",r)},[e]),n},co=({title:e="Summary",pricesInLabel:n="Prices are in",currency:s,locale:a="en-US",items:r,serviceFee:i,rows:o,total:l,postTotalRows:d,onRemoveTotalRow:u,onRemovePostTotalRow:f,secondaryTotal:m,collapsible:p,isOpen:x,onToggleOpen:g,defaultOpen:y=!1,primaryAction:b,isLoading:v=!1,onRemoveItem:w,showRemoveButton:$,ctaCaption:N,ctaError:A,variant:k,cart:C,emptyState:E,labels:S,classNames:_={},density:F="default","data-testid":L="summary",className:M})=>{const I=S?.removeAriaLabel??"Remove item",W=S?.removeTotalRowAriaLabel??"Remove discount",K=S?.removePostTotalRowAriaLabel??"Remove applied code",z=S?.toggleAriaLabel??"Toggle summary",ne=S?.cartAriaLabel??"View cart",G=F==="compact",se=_p(),oe=p??(k??(se?"mobile":"main"))==="mobile",[J,q]=h.useState(y),ie=x!==void 0,V=!oe||(ie?x:J),ee=h.useCallback(()=>{ie||q(T=>!T),g?.()},[ie,g]),[te,Fe]=h.useState(0),[Z,he]=h.useState(null),Je=h.useRef(null),We=h.useRef(null),ve=h.useCallback(()=>{const T=Je.current;T&&Fe($p(T.scrollHeight,window.innerHeight))},[]),qe=h.useCallback(T=>{We.current?.disconnect(),We.current=null,Je.current=T,T&&(ve(),typeof ResizeObserver<"u"&&(We.current=new ResizeObserver(ve),We.current.observe(T)))},[ve]);h.useEffect(()=>(window.addEventListener("resize",ve),()=>window.removeEventListener("resize",ve)),[ve]);const ot=Lp({open:V,fullHeight:te,setDragHeight:he,onToggleOpen:ee}),Ge=Z!==null,me=Ep(Z,V,te),$e=te>0?Math.min(1,Math.max(0,me/te)):V?1:0,et=t.jsx(ao,{total:l,locale:a,compact:G,className:_.total}),j=d&&d.length>0&&t.jsx("div",{"data-testid":"summary-post-total-rows",className:"flex flex-col gap-4",children:d.map(T=>t.jsx(aa,{row:T,locale:a,emphasized:!1,onRemove:f,removeAriaLabel:K,showRemoveButton:$,compact:G},T.key))}),D=m&&t.jsx(ro,{secondaryTotal:m,locale:a,className:_.secondaryTotal}),R=N!=null&&t.jsx("p",{"data-testid":"summary-cta-caption",className:c.cn("text-center text-sm text-default-500",_.ctaCaption),children:N}),U=A!=null&&t.jsx("p",{role:"alert","data-testid":"summary-cta-error",className:c.cn("text-center text-sm text-danger",_.ctaError),children:A}),B=t.jsx(so,{pricesInLabel:n,currency:s,items:r,serviceFee:i,rows:o,locale:a,onRemoveItem:w,removeAriaLabel:I,onRemoveTotalRow:u,removeTotalRowAriaLabel:W,showRemoveButton:$,emptyState:E,compact:G,classNames:_});return oe?t.jsxs(Te.motion.section,{"data-testid":L,drag:"y",dragConstraints:{top:0,bottom:0},dragElastic:.12,dragSnapToOrigin:!0,onDrag:ot.onDrag,onDragEnd:ot.onDragEnd,className:c.cn("fixed inset-x-0 bottom-0 z-50 flex max-h-full w-full flex-col rounded-t-2xl bg-content1 p-4 drop-shadow-[0_-2px_2px_rgba(0,0,0,0.1)]",M,_.base),children:[t.jsx(io,{title:e,total:l,secondaryTotal:m,locale:a,open:V,progress:$e,dragging:Ge,toggleAriaLabel:z,onToggleOpen:ee,classNames:_}),t.jsx("div",{"data-testid":"summary-reveal","aria-hidden":!V,style:{height:me},className:c.cn("min-h-0",V&&!Ge?"overflow-y-auto overscroll-contain [scrollbar-width:none] [&::-webkit-scrollbar]:hidden":"overflow-hidden",!V&&"pointer-events-none",Dp(Ge)),children:t.jsxs("div",{ref:qe,className:G?"flex flex-col gap-3 pb-4":"flex flex-col gap-4 pb-4",children:[B,!G&&t.jsx(c.Divider,{className:"bg-default-200"}),et,j,D]})}),t.jsx(oo,{open:V,progress:$e,dragging:Ge,primaryAction:b,isLoading:v,cart:C,cartAriaLabel:ne,ctaCaption:R,ctaError:U,onToggleOpen:ee,classNames:_})]}):t.jsxs("section",{"data-testid":L,className:c.cn(G?"flex w-full flex-col gap-3 rounded-2xl border border-default-200 bg-content1 p-4":"flex w-full flex-col gap-4 rounded-2xl border border-default-200 bg-content1 p-4",M,_.base),children:[!G&&t.jsx("div",{className:c.cn("flex items-center justify-between",_.header),children:t.jsx("h2",{"data-testid":"summary-title",className:c.cn("text-xl font-semibold leading-7 text-foreground",_.title),children:e})}),B,!G&&t.jsx(c.Divider,{className:"bg-default-200"}),et,j,D,m&&b&&t.jsx(c.Divider,{className:"bg-default-200"}),b&&t.jsx(wn,{action:b,disabledByLoading:v,className:c.cn("w-full",_.cta)}),U,R]})};co.displayName="Summary";const nt={bare:"flex gap-1.5",list:"m-0 flex list-none gap-4 p-0",item:"flex min-w-0 flex-1 flex-col",step:"flex min-w-0 flex-1 flex-col items-stretch gap-1.5 text-left",button:"cursor-pointer rounded-md border-none bg-transparent p-0 font-[inherit] outline-none focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-[0.1875rem] focus-visible:outline-primary disabled:cursor-default",segment:"block h-1 rounded-full",name:"flex min-w-0 items-center gap-[0.3125rem] truncate text-xs font-semibold leading-[1.125rem]",check:"flex h-[0.8125rem] w-[0.8125rem] shrink-0"},gr={done:"bg-pos-ok",active:"bg-primary",upcoming:"bg-pos-line"},Mp={done:"text-pos-ok",active:"text-pos-ink",upcoming:"text-pos-muted"},Pp={ariaLabel:"Progress",completed:"completed"},ra=({steps:e,activeStepId:n,showLabels:s=!0,onStepPress:a,isStepReachable:r,labels:i,className:o,"data-testid":l="step-progress"})=>{const d={...Pp,...i},u=e.filter(p=>p.state!=="skipped"),f=Math.max(0,u.findIndex(p=>p.id===n)),m=p=>p<f?"done":p===f?"active":"upcoming";return s?t.jsx("ol",{"aria-label":d.ariaLabel,className:c.cn(nt.list,o),"data-testid":l,children:u.map((p,x)=>{const g=m(x),y=t.jsxs(t.Fragment,{children:[t.jsx("span",{"aria-hidden":"true",className:c.cn(nt.segment,"w-full",gr[g]),"data-testid":`${l}-segment-${p.id}`}),t.jsxs("span",{className:c.cn(nt.name,Mp[g]),"data-testid":`${l}-name-${p.id}`,children:[g==="done"&&t.jsx("span",{"aria-hidden":"true",className:nt.check,"data-testid":`${l}-check-${p.id}`,children:t.jsx(P,{icon:"solar:check-circle-bold",width:"100%",height:"100%"})}),t.jsx("span",{className:"truncate",children:p.label}),g==="done"&&t.jsxs("span",{className:"sr-only",children:[", ",d.completed]})]})]}),b=r?r(p.id,x):x<f,v=g==="active"?"step":void 0;return t.jsx("li",{className:nt.item,"aria-current":a?void 0:v,"data-state":g,"data-testid":`${l}-step-${p.id}`,children:a?t.jsx("button",{type:"button",className:c.cn(nt.step,nt.button),disabled:!b,"aria-current":v,onClick:()=>a(p.id),"data-testid":`${l}-button-${p.id}`,children:y}):t.jsx("div",{className:nt.step,children:y})},p.id)})}):t.jsx("div",{"aria-hidden":"true",className:c.cn(nt.bare,o),"data-testid":l,children:u.map((p,x)=>t.jsx("span",{className:c.cn(nt.segment,"flex-1",gr[m(x)]),"data-state":m(x)},p.id))})};ra.displayName="StepProgress";const Tp={back:"Back",close:"Close",cancel:"Cancel",partialBadge:"Partial refund",owesBadge:"Customer owes",ofSeparator:"of"},Ip={backgroundColor:le.destructive,color:"#fff"},Op={warn:{backgroundColor:le["warn-fill"],color:le.warn},ok:{backgroundColor:le["ok-fill"],color:le.ok},neutral:{backgroundColor:"hsl(var(--heroui-default-100))",color:"hsl(var(--heroui-default-600))",border:`1px solid ${le.line}`}},ss="inline-flex h-[22px] items-center gap-[5px] whitespace-nowrap rounded-full px-[9px] text-xs font-medium leading-none",as="absolute top-0 h-5 w-5 opacity-0",uo=({onClose:e,steps:n,activeStepId:s,subtitle:a,onBack:r,primaryAction:i,totalRow:o,secondaryAction:l,hideChrome:d,footerSummary:u,labels:f,className:m,"data-testid":p="wizard-shell",children:x})=>{const g={...Tp,...f},y=n.find(w=>w.id===s),b=r??e,v=r?g.back:g.cancel;return t.jsxs("div",{className:c.cn("flex h-full min-h-0 w-full flex-col bg-white text-default-900",m),"data-testid":p,children:[!d&&t.jsxs("header",{className:"flex shrink-0 flex-wrap items-center gap-2.5 border-b border-pos-line px-6 py-4","data-testid":`${p}-header`,children:[b&&t.jsx(O,{variant:"light",className:"h-10 min-w-0 gap-2 rounded-xl px-4 text-sm font-semibold text-default-600",onPress:b,"data-testid":`${p}-header-back`,startContent:t.jsx(P,{icon:"lucide:circle-chevron-left",width:18,height:18,"aria-hidden":"true"}),children:v}),t.jsxs("div",{className:"min-w-0",children:[t.jsx("h2",{className:"text-lg font-semibold","data-testid":`${p}-header-title`,children:y?.label??""}),a&&t.jsx("div",{className:"mt-0.5 text-[12.5px] text-default-500","data-testid":`${p}-header-subtitle`,children:a})]}),t.jsxs("div",{className:"relative flex-1","data-testid":`${p}-footer`,children:[e&&t.jsx("button",{type:"button","aria-label":g.close,onClick:e,className:c.cn(as,"left-0"),"data-testid":`${p}-header-close`}),r&&t.jsx("button",{type:"button","aria-label":g.back,onClick:r,className:c.cn(as,"left-6"),"data-testid":`${p}-back`}),l&&t.jsx("button",{type:"button","aria-label":l.label,disabled:l.disabled,onClick:l.onClick,className:c.cn(as,"left-12"),"data-testid":`${p}-secondary`})]}),t.jsxs("div",{className:"flex w-full flex-wrap items-center justify-between gap-3 sm:w-auto sm:flex-nowrap sm:justify-end sm:gap-4",children:[o&&t.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-[12.5px] font-semibold text-default-600","data-testid":`${p}-total`,children:[t.jsx("span",{children:o.label}),o.amount&&t.jsx("span",{className:"tabular-nums text-default-900",children:fe(o.amount.value,void 0,o.amount.currency)}),o.of&&t.jsxs(t.Fragment,{children:[t.jsx("span",{children:g.ofSeparator}),t.jsx("span",{className:"tabular-nums text-default-900","data-testid":`${p}-total-of`,children:fe(o.of.value,void 0,o.of.currency)})]}),o.badge==="partial"&&t.jsx("span",{className:c.cn(ss,"bg-pos-warn-fill text-pos-warn"),"data-testid":`${p}-total-partial`,children:g.partialBadge}),o.badge==="owes"&&t.jsx("span",{className:c.cn(ss,"border border-pos-line bg-default-100 text-default-600"),"data-testid":`${p}-total-owes`,children:g.owesBadge}),typeof o.badge=="object"&&t.jsx("span",{className:ss,style:Op[o.badge.tone],"data-tone":o.badge.tone,"data-testid":`${p}-total-badge`,children:o.badge.label})]}),t.jsx(O,{color:"primary",className:c.cn("h-12 min-w-0 rounded-[14px] px-5 text-[15px] font-semibold",i.tone==="destructive"&&"bg-pos-destructive text-white"),style:i.tone==="destructive"?Ip:void 0,isLoading:i.loading,isDisabled:i.disabled,onPress:i.onClick,"data-testid":`${p}-primary`,children:i.label})]})]}),t.jsx(ra,{steps:n,activeStepId:s,showLabels:!1,className:"shrink-0 px-6 py-2.5","data-testid":`${p}-stepper`}),t.jsx("div",{className:"min-h-0 flex-1 overflow-auto px-6 py-[22px]","data-testid":`${p}-body`,children:x}),u]})};uo.displayName="WizardShell";const zp=(e,n,s)=>Math.min(Math.max(e,n),s);function vs(e,n,s){const a=Math.max(1,Math.trunc(n)),r=zp(Math.trunc(s),0,a);if(r===a)return{...e};if(r===0)return{value:0,currency:e.currency};const i=Math.pow(10,Dt(e.currency)),o=Math.round(e.value*i),l=Math.floor(o/a),d=o-l*a;return{value:(l*r+Math.min(r,d))/i,currency:e.currency}}function Bp(e,n){return vs(e,n,1)}const Vp=e=>Number.isFinite(e)?e.toFixed(2):"",js=({value:e,expected:n,max:s,onChange:a,ariaLabel:r,isDisabled:i,className:o,"data-testid":l,inputTestId:d})=>{const[u,f]=h.useState(null),m=h.useRef(null),p=Math.abs(e-n)>.004;return t.jsxs("span",{className:c.cn("inline-flex h-11 items-center gap-px rounded-[10px] border px-2.5","focus-within:border-primary focus-within:ring-[3px] focus-within:ring-primary/10",p?"border-primary bg-primary-50":"border-pos-line bg-white",o),"data-testid":l,children:[t.jsx("span",{className:"text-[13px] text-default-600",children:"$"}),t.jsx("input",{ref:m,type:"text",inputMode:"decimal","aria-label":r,disabled:i,className:"w-full border-none bg-transparent p-0 text-right text-sm font-semibold tabular-nums text-default-900 outline-none",value:u??Vp(e),onChange:x=>{const g=x.target.value,y=Number.parseFloat(g.replace(",","."));s!==void 0&&Number.isFinite(y)&&y>s+.004||(f(g),Number.isFinite(y)&&y>=0?a(y):g.trim()===""&&a(0))},onFocus:x=>x.currentTarget.select(),onBlur:()=>f(null),"data-testid":d})]})};js.displayName="AmountCell";const Up={refunded:"Refunded",ineligible:"Ineligible",partialLink:"Refund partial $ of this line",partialOf:"of {amount}",partialCancel:"Cancel",restockTitle:"Restock this item",restockHint:"Returns to current location.",decrease:"Decrease {name}",increase:"Increase {name}",amount:"Refund amount for {name}",adjustmentNote:"Item stays with customer (price adjustment)",maxNote:"Max {count} purchased",disposition:"Disposition",dispositionStock:"Back to stock",dispositionNoRestock:"Not restocked",dispositionDamaged:"Damaged → Cardex",amountOnlyAdd:"Refund an amount",amountOnlyTitle:"Refund an amount",amountOnlyDetail:"Not tied to an item · up to {amount} remaining",amountOnlyRemove:"Remove amount refund"},Hp="inline-flex h-[22px] shrink-0 items-center gap-[5px] whitespace-nowrap rounded-full border border-pos-line bg-default-100 px-[9px] text-xs font-medium leading-none text-default-600",yr="flex h-11 flex-1 items-center justify-center bg-white text-lg text-default-900 outline-none transition-colors hover:bg-default-100 disabled:opacity-50 focus-visible:outline focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-primary",rs="absolute h-5 w-5 opacity-0",Wp=e=>{const n=fe(e.paidAmount.value,void 0,e.paidAmount.currency);if(e.quantity<=1)return n;const s=Bp(e.paidAmount,e.quantity);return`${e.quantity} × ${fe(s.value,void 0,s.currency)} · ${n}`},mo=({items:e,selections:n,onSelectionChange:s,onRestockToggle:a,onDispositionChange:r,amountOnly:i,labels:o,className:l,"data-testid":d="line-item-list"})=>{const u={...Up,...o},f=[{key:"stock",label:u.dispositionStock},{key:"norestock",label:u.dispositionNoRestock},{key:"damaged",label:u.dispositionDamaged}];return t.jsxs("div",{className:c.cn("flex flex-col text-default-900",l),"data-testid":d,children:[e.map(m=>{const p=n[m.id],x=m.state==="already_refunded"||m.state==="non_refundable",g=`${d}-row-${m.id}`,y=Math.max(1,Math.trunc(m.quantity)),b=p?.quantity,v=p?.selected?Math.min(b??y,y):b??0,w=vs(m.paidAmount,y,v).value,$=p?.amount??(p?.selected?w:0),N=v===0&&$>.004,A=C=>s(m.id,{selected:C.quantity>0||C.amount>.004,mode:"full",...C}),k=C=>{const E=Math.min(Math.max(C,0),y);A({quantity:E,amount:vs(m.paidAmount,y,E).value})};return t.jsxs("div",{className:c.cn("relative flex items-start gap-3 border-b border-pos-line-2 py-3 last:border-b-0",x&&"opacity-60"),"data-testid":g,children:[t.jsx("div",{className:"flex h-10 w-10 shrink-0 items-center justify-center rounded-[10px] bg-default-100 text-default-600","data-testid":`${g}-icon`,children:t.jsx(P,{icon:m.icon??"lucide:package",width:19,height:19,"aria-hidden":"true"})}),t.jsxs("div",{className:"min-w-0 flex-1",children:[t.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[t.jsxs("div",{className:"min-w-0",children:[t.jsx("p",{className:"truncate text-sm font-semibold",children:m.name}),t.jsx("p",{className:"text-[12.5px] text-default-500","data-testid":`${g}-detail`,children:m.detail??Wp(m)}),N&&t.jsx("p",{className:"mt-[3px] text-[12.5px] italic text-default-500","data-testid":`${g}-adjustment-note`,children:u.adjustmentNote})]}),t.jsxs("div",{className:"flex w-full flex-wrap items-center gap-2.5 sm:w-auto sm:flex-nowrap","data-testid":`${g}-partial`,children:[x?t.jsx("span",{className:"text-sm font-semibold tabular-nums",children:fe(m.paidAmount.value,void 0,m.paidAmount.currency)}):t.jsx(js,{value:$,expected:w,max:m.paidAmount.value,onChange:C=>A({quantity:v,amount:C}),ariaLabel:u.amount.replace("{name}",m.name),className:"w-[120px]","data-testid":`${g}-amount`,inputTestId:`${g}-partial-input-field`}),x?t.jsx("span",{className:Hp,"data-testid":`${g}-blocked`,children:m.state==="already_refunded"?u.refunded:u.ineligible}):t.jsxs("div",{role:"group","aria-label":m.name,className:"flex w-[160px] shrink-0 items-center gap-0.5 overflow-hidden rounded-[10px] border border-pos-line","data-testid":`${g}-qty`,children:[t.jsx("button",{type:"button",className:yr,"aria-label":u.decrease.replace("{name}",m.name),disabled:v===0,onClick:()=>k(v-1),"data-testid":`${g}-qty-decrease`,children:"−"}),t.jsx("span",{"aria-live":"polite",className:"min-w-8 flex-1 text-center text-[15px] font-semibold tabular-nums","data-testid":`${g}-qty-value`,children:v}),t.jsx("button",{type:"button",className:yr,"aria-label":u.increase.replace("{name}",m.name),disabled:v===y,onClick:()=>k(v+1),"data-testid":`${g}-qty-increase`,children:"+"})]})]})]}),v>=y&&t.jsx("p",{className:"mt-2 text-xs text-default-500","data-testid":`${g}-max-note`,children:u.maxNote.replace("{count}",String(y))}),p?.selected&&!m.restock.available&&m.restock.unavailableHint&&t.jsx("p",{className:"mt-2 text-xs text-default-500",children:m.restock.unavailableHint}),m.warning&&t.jsxs("div",{className:"mt-2.5 flex items-start gap-2 rounded-[10px] bg-pos-warn-fill px-2.5 py-2 text-[12.5px] text-pos-warn","data-testid":`${g}-warning`,children:[t.jsx(P,{icon:"gravity-ui:triangle-exclamation-fill",width:15,height:15,className:"mt-0.5 shrink-0","aria-hidden":"true"}),t.jsx("span",{children:m.warning})]}),v>0&&m.restock.available&&t.jsxs("div",{className:"mt-2.5 flex flex-wrap items-center gap-2",children:[t.jsx("span",{className:"mr-0.5 text-[11px] font-semibold uppercase tracking-[.04em] text-default-500",children:u.disposition}),t.jsx(Xe,{"aria-label":u.disposition,className:"w-[220px]",selectedKeys:[m.restock.disposition??(m.restock.on?"stock":"norestock")],onSelectionChange:C=>{if(C==="all")return;const E=[...C][0];E&&(r?.(m.id,E),a(m.id,E==="stock"))},"data-testid":`${g}-restock`,children:f.map(C=>t.jsx(c.SelectItem,{children:C.label},C.key))})]})]}),!x&&t.jsxs(t.Fragment,{children:[t.jsx(c.Checkbox,{className:c.cn(rs,"right-0 top-0 m-0 p-0"),isSelected:!!p?.selected,onValueChange:C=>s(m.id,{selected:C,mode:"full"}),"aria-label":m.name,"data-testid":`${g}-checkbox`}),t.jsx("button",{type:"button","aria-label":u.partialLink,onClick:()=>document.querySelector(`[data-testid="${g}-partial-input-field"]`)?.focus(),className:c.cn(rs,"left-0 top-0"),"data-testid":`${g}-partial-link`}),t.jsx("button",{type:"button","aria-label":u.partialCancel,onClick:()=>A({quantity:v,amount:w}),className:c.cn(rs,"left-5 top-0"),"data-testid":`${g}-partial-cancel`})]})]},m.id)}),i&&(i.value===null?t.jsxs("button",{type:"button",onClick:i.onAdd,className:"mt-1 inline-flex items-center gap-1.5 self-start rounded pt-3 text-[12.5px] font-semibold text-primary outline-none hover:text-primary-600 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary","data-testid":`${d}-amount-only-add`,children:[t.jsx(P,{icon:"lucide:plus",width:13,height:13,"aria-hidden":"true"}),u.amountOnlyAdd]}):t.jsxs("div",{className:"flex items-start gap-3 border-b border-pos-line-2 pb-3 pt-5 last:border-b-0","data-testid":`${d}-amount-only`,children:[t.jsx("div",{className:"flex h-10 w-10 shrink-0 items-center justify-center rounded-[10px] bg-default-100 text-default-600",children:t.jsx(P,{icon:"lucide:circle-dollar-sign",width:19,height:19,"aria-hidden":"true"})}),t.jsx("div",{className:"min-w-0 flex-1",children:t.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[t.jsxs("div",{className:"min-w-0",children:[t.jsx("p",{className:"text-sm font-semibold",children:u.amountOnlyTitle}),t.jsx("p",{className:"text-[12.5px] text-default-500",children:u.amountOnlyDetail.replace("{amount}",fe(i.max.value,void 0,i.max.currency))})]}),t.jsxs("div",{className:"flex w-full flex-wrap items-center gap-2.5 sm:w-[290px] sm:flex-nowrap",children:[t.jsx(js,{value:i.value,expected:i.value,max:i.max.value,onChange:i.onChange,ariaLabel:u.amountOnlyTitle,className:"flex-1",inputTestId:`${d}-amount-only-input`}),t.jsx("button",{type:"button","aria-label":u.amountOnlyRemove,onClick:i.onRemove,className:"flex h-11 w-11 shrink-0 items-center justify-center rounded-full bg-pos-danger-fill text-pos-danger outline-none transition-colors hover:bg-[#F8D6D6] focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-pos-danger","data-testid":`${d}-amount-only-remove`,children:t.jsx(P,{icon:"lucide:trash-2",width:17,height:17,"aria-hidden":"true"})})]})]})})]}))]})};mo.displayName="LineItemList";const qp={color:le.danger},fo=({children:e,className:n,"data-testid":s="meta-card"})=>t.jsx("div",{className:c.cn("mx-auto mt-[18px] flex max-w-[1040px] flex-col gap-3",n),"data-testid":s,children:t.jsx("div",{className:"rounded-[14px] border border-pos-line bg-white px-4 py-3.5 text-default-900",children:e})});fo.displayName="MetaCard";const xo=({label:e,htmlFor:n,required:s,children:a,className:r,"data-testid":i="meta-card-row"})=>t.jsxs("div",{className:c.cn("flex flex-wrap items-center justify-between gap-4",r),"data-testid":i,children:[t.jsxs("label",{htmlFor:n,className:"text-[13px] font-medium text-default-600",children:[e,s&&t.jsx("span",{"aria-hidden":"true",className:"ms-0.5 text-danger",style:qp,"data-testid":`${i}-required`,children:"*"})]}),t.jsx("div",{className:"w-full sm:w-[290px] sm:shrink-0",children:a})]});xo.displayName="MetaCard.Row";const po=({label:e,children:n,className:s,"data-testid":a="meta-card-section"})=>t.jsxs("div",{className:c.cn("mt-3.5 flex flex-col gap-2.5 border-t border-pos-line pt-3",s),"data-testid":a,children:[e&&t.jsx("p",{className:"text-[13px] font-medium text-default-600",children:e}),n]});po.displayName="MetaCard.Section";const Gp=Object.assign(fo,{Row:xo,Section:po}),ho=({heading:e,icon:n="lucide:rotate-ccw",action:s,children:a,className:r,"data-testid":i="section-panel"})=>t.jsxs("section",{className:c.cn("mx-auto max-w-[1040px] rounded-2xl border border-pos-line bg-white px-[18px] py-4",r),"data-testid":i,children:[t.jsxs("div",{className:"mb-3 flex items-center gap-2 text-[13px] font-semibold text-default-600",children:[t.jsx(P,{icon:n,width:16,height:16,"aria-hidden":"true"}),t.jsx("h3",{"data-testid":`${i}-heading`,children:e}),t.jsx("div",{className:"flex-1"}),s&&t.jsxs("button",{type:"button",disabled:s.disabled,onClick:s.onClick,className:c.cn("inline-flex min-h-8 shrink-0 items-center gap-1.5 rounded-full border border-primary","bg-primary/5 px-3 py-[7px] text-[12.5px] font-semibold text-primary outline-none","transition-colors hover:bg-primary/10 disabled:cursor-not-allowed disabled:opacity-60","focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary"),"data-testid":`${i}-action`,children:[t.jsx(P,{icon:s.icon??"lucide:plus",width:14,height:14,"aria-hidden":"true"}),s.label]})]}),a]});ho.displayName="SectionPanel";const bo=({name:e,detail:n,icon:s="lucide:users",labels:a,className:r,"data-testid":i="customer-card"})=>t.jsxs("div",{className:c.cn("mb-3.5 flex items-center gap-3 rounded-xl bg-default-100 px-3.5 py-3",r),"data-testid":i,children:[t.jsx("div",{className:"flex h-[38px] w-[38px] shrink-0 items-center justify-center rounded-[10px] bg-default-100 text-default-600",children:t.jsx(P,{icon:s,width:18,height:18,"aria-hidden":"true"})}),t.jsxs("div",{className:"min-w-0 flex-1",children:[t.jsx("p",{className:"mb-0.5 text-[11px] font-semibold uppercase tracking-[.08em] text-default-500",children:a?.heading??"Customer"}),t.jsx("p",{className:"text-sm font-semibold","data-testid":`${i}-name`,children:e}),n&&t.jsx("p",{className:"text-[12.5px] text-default-500",children:n})]})]});bo.displayName="CustomerCard";const Kp={label:"Reason for the return",placeholder:"Select a reason…"},go=({options:e,value:n,onChange:s,error:a,isRequired:r,labels:i,className:o,"data-testid":l="reason-select"})=>{const d={...Kp,...i};return t.jsx(Xe,{label:d.label,labelPlacement:"outside",placeholder:d.placeholder,selectedKeys:n?[n]:[],isRequired:r,isInvalid:!!a,errorMessage:a,className:c.cn(o),"data-testid":l,onSelectionChange:u=>{if(u==="all")return;const f=[...u][0];f&&s(String(f))},children:e.map(u=>t.jsx(c.SelectItem,{children:u.label},u.id))})};go.displayName="ReasonSelect";const Yp={toggle:"Add a note",optionalTag:"(optional)",heading:"Additional note",placeholder:"Add a note (optional)"},yo=({value:e,onChange:n,maxLength:s,alwaysExpanded:a=!1,hideLabel:r=!1,labels:i,className:o,"data-testid":l="notes-field"})=>{const d={...Yp,...i},[u,f]=h.useState(e!=="");return a?t.jsxs("div",{className:c.cn("flex flex-col gap-2",o),"data-testid":l,children:[!r&&t.jsx("label",{htmlFor:`${l}-textarea`,className:"text-[13px] font-medium text-default-600",children:d.heading}),t.jsx("textarea",{id:`${l}-textarea`,"aria-label":r?d.heading:void 0,value:e,onChange:m=>n(m.target.value),maxLength:s,placeholder:d.placeholder,className:c.cn("min-h-[52px] w-full resize-y rounded-[10px] border border-pos-line bg-white px-3 py-2.5","text-[13.5px] leading-[1.45] text-default-900 outline-none","placeholder:text-default-500","focus:border-primary focus:ring-[3px] focus:ring-primary/10"),"data-testid":`${l}-textarea`})]}):t.jsx("div",{className:c.cn(o),"data-testid":l,children:u?t.jsx(c.Textarea,{value:e,onChange:m=>n(m.target.value),maxLength:s,placeholder:d.toggle,"aria-label":d.toggle,variant:"bordered",radius:"lg","data-testid":`${l}-textarea`}):t.jsxs(O,{variant:"light",className:"h-auto min-w-0 px-1 py-0.5 text-xs font-semibold text-primary",onPress:()=>f(!0),"data-testid":`${l}-toggle`,children:[d.toggle,t.jsx("span",{className:"ml-1 font-normal text-default-400",children:d.optionalTag})]})})};yo.displayName="NotesField";const Qp={info:"solar:info-circle-bold",success:"solar:check-circle-bold",warning:"solar:danger-triangle-bold",danger:"solar:danger-circle-bold"},Zp="solar:close-circle-linear",Xp={callout:{root:"flex items-start gap-[0.5625rem] rounded-xl px-3.5 py-3 text-[0.78125rem] leading-normal",iconWrapper:"flex h-[1.5em] shrink-0 items-center",iconSize:"1.25em",text:"min-w-0 flex-1 [overflow-wrap:anywhere]",title:"font-semibold",description:"",actions:"mt-2 flex flex-wrap items-center gap-2",dismiss:"-my-1.5 -me-2 size-8 min-w-8 shrink-0 text-current"},banner:{root:"flex items-start gap-3.5 rounded-[0.875rem] px-[1.125rem] py-4 text-pos-ink",iconWrapper:"flex size-10 shrink-0 items-center justify-center rounded-full",iconSize:"1.375rem",text:"min-w-0 flex-1 [overflow-wrap:anywhere]",title:"font-semibold",description:"text-[0.8125rem] text-pos-neutral",actions:"mt-3 flex flex-wrap gap-2.5",dismiss:"-my-1 -me-1.5 size-8 min-w-8 shrink-0 text-pos-neutral"}},Jp={info:{callout:"bg-pos-info-fill text-pos-info",banner:"bg-pos-info-fill",disc:"bg-pos-info/15 text-pos-info",title:"text-pos-info"},success:{callout:"bg-pos-ok-fill text-pos-ok",banner:"bg-pos-ok-fill",disc:"bg-pos-ok/15 text-pos-ok",title:"text-pos-ok"},warning:{callout:"bg-pos-warn-fill text-pos-warn",banner:"bg-pos-warn-fill",disc:"bg-pos-warn-icon text-pos-warn",title:"text-pos-warn"},danger:{callout:"bg-pos-danger-fill text-pos-danger",banner:"bg-pos-danger-fill",disc:"bg-pos-danger-icon text-pos-danger",title:"text-pos-danger"}},eh={info:"status",success:"status",warning:"alert",danger:"alert"};function ia({tone:e="info",variant:n="callout",title:s,description:a,actions:r,onDismiss:i,dismissLabel:o="Dismiss",role:l=eh[e],className:d,"data-testid":u="notice"}){const f=Cn(),m=Xp[n],p=Jp[e],x=n==="banner",g=re(s),y=re(a),b=g?x?t.jsx("p",{"data-testid":`${u}-title`,className:c.cn(m.title,p.title),children:s}):t.jsx("span",{"data-testid":`${u}-title`,className:m.title,children:s}):null,v=y?x?t.jsx("p",{"data-testid":`${u}-description`,className:c.cn(m.description,g&&"mt-0.5"),children:a}):t.jsx("span",{"data-testid":`${u}-description`,className:m.description,children:a}):null;return t.jsxs("div",{role:l,"aria-live":l==="alert"?"assertive":"polite","data-tone":e,"data-variant":n,"data-testid":u,className:c.cn(m.root,x?p.banner:p.callout,d),children:[t.jsx("span",{"aria-hidden":"true","data-testid":`${u}-icon`,className:c.cn(m.iconWrapper,x&&p.disc),children:t.jsx(P,{icon:Qp[e],width:m.iconSize,height:m.iconSize})}),t.jsxs("div",{className:m.text,children:[x?t.jsxs(t.Fragment,{children:[b,v]}):t.jsxs("p",{children:[b,g&&y?" ":null,v]}),r?t.jsx("div",{"data-testid":`${u}-actions`,className:m.actions,children:r}):null]}),i?t.jsx(O,{isIconOnly:!0,color:"default",size:"sm",radius:"full",variant:"light","aria-label":o,onPress:i,disableAnimation:f,className:c.cn(m.dismiss,ke),"data-testid":`${u}-dismiss`,children:t.jsx(P,{icon:Zp,width:"1.125rem",height:"1.125rem"})}):null]})}ia.displayName="Notice";const vr="h-8 min-w-0 rounded-[0.625rem] px-3 text-[0.8125rem] font-semibold",Mn=({tone:e,title:n,body:s,onRetry:a,retryLabel:r,onChooseDifferent:i,chooseDifferentLabel:o,className:l,"data-testid":d,retryTestId:u,chooseDifferentTestId:f})=>t.jsx(ia,{variant:"banner",tone:e,title:n,description:s,className:l,"data-testid":d,actions:t.jsxs(t.Fragment,{children:[a&&t.jsx(O,{color:"primary",className:vr,onPress:a,"data-testid":u,children:r}),t.jsx(O,{variant:"bordered",className:c.cn(vr,"border-1 border-pos-line bg-white text-default-900"),onPress:i,"data-testid":f,children:o})]})});Mn.displayName="TenderBanner";const th={split:"Split across multiple methods",declinedTitle:"Refund declined",declinedBody:"The processor declined this refund. Nothing was sent.",networkTitle:"Network error",networkBody:"Couldn't reach the processor. Nothing was sent.",retry:"Try again",chooseDifferent:"Choose different method",destinationsHeading:"Money back to"},nh={card:"lucide:credit-card",cash:"lucide:dollar-sign",check:"lucide:edit-3",other:"lucide:more-horizontal"},vo=({tenders:e,selectedTenderId:n,onSelect:s,onSplit:a,error:r,labels:i,className:o,"data-testid":l="tender-methods"})=>{const d={...th,...i},u=r?.kind==="processor_declined";return t.jsxs("div",{className:c.cn("flex flex-col text-default-900",o),"data-testid":l,children:[r&&t.jsx(Mn,{tone:u?"danger":"warning",title:u?d.declinedTitle:d.networkTitle,body:u?d.declinedBody:d.networkBody,onRetry:r.onRetry,retryLabel:d.retry,onChooseDifferent:r.onChooseDifferent,chooseDifferentLabel:d.chooseDifferent,className:"mb-[18px]","data-testid":`${l}-error`,retryTestId:`${l}-retry`,chooseDifferentTestId:`${l}-choose-different`}),t.jsx("p",{className:"mb-3 text-[11px] font-semibold uppercase tracking-[.08em] text-default-500",children:d.title??d.destinationsHeading}),t.jsxs("div",{role:"radiogroup","aria-label":d.title??d.destinationsHeading,className:"mb-0.5 grid grid-cols-3 gap-2.5","data-testid":`${l}-tiles`,children:[e.map(f=>{const m=f.tenderId===n;return t.jsxs("button",{type:"button",role:"radio","aria-checked":m,onClick:()=>s(f.tenderId),className:c.cn("flex items-center gap-[11px] rounded-[14px] border-[1.5px] bg-white px-[15px] py-[11px] text-left","outline-none transition-colors","focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary",m?"border-primary bg-primary/5":"border-pos-line hover:border-primary"),"data-testid":`${l}-tile-${f.tenderId}`,children:[t.jsx("span",{className:c.cn("flex h-[34px] w-[34px] shrink-0 items-center justify-center rounded-[10px]",m?"bg-primary text-white":"bg-default-100 text-default-600"),children:t.jsx(P,{icon:nh[f.kind],width:18,height:18,"aria-hidden":"true"})}),t.jsxs("span",{className:"min-w-0",children:[t.jsx("span",{className:"block text-sm font-semibold",children:f.label}),t.jsx("span",{className:"block text-xs text-default-500",children:fe(f.maxRefundable.value,void 0,f.maxRefundable.currency)})]})]},f.tenderId)}),t.jsxs("button",{type:"button",onClick:a,className:c.cn("flex items-center gap-[11px] rounded-[14px] border-[1.5px] border-pos-line bg-white px-[15px] py-[11px] text-left","outline-none transition-colors hover:border-primary","focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary"),"data-testid":`${l}-split`,children:[t.jsx("span",{className:"flex h-[34px] w-[34px] shrink-0 items-center justify-center rounded-[10px] bg-default-100 text-default-600",children:t.jsx(P,{icon:"lucide:split",width:18,height:18,"aria-hidden":"true"})}),t.jsx("span",{className:"min-w-0 text-sm font-semibold",children:d.split})]})]})]})};vo.displayName="TenderMethods";const sh=e=>e.refunded!==null,ah={title:"Split refund",refundedSoFar:"Refunded so far",remaining:"Remaining",amountForPart:"Amount for this part",partHeading:"Part #{n}",submit:"Refund this part →",back:"Back",partDeclinedBody:"This part was declined. Completed parts are preserved.",partNetworkBody:"Couldn't reach the processor. Completed parts are preserved.",declinedTitle:"Refund declined",networkTitle:"Network error",retry:"Try again",chooseDifferent:"Choose different method",pending:"Pending",succeeded:"Refunded"},rh="mb-2 text-[11px] font-semibold uppercase tracking-[.08em] text-default-500",ih="inline-flex h-[22px] shrink-0 items-center gap-[5px] whitespace-nowrap rounded-full px-[9px] text-xs font-medium leading-none",jo=({parts:e,refundedSoFar:n,remaining:s,current:a,methods:r,onRefundPart:i,partError:o,onBack:l,busy:d,hideActions:u,labels:f,className:m,"data-testid":p="split-tender-panel"})=>{const x={...ah,...f},g=e.filter(sh),y=e.find(C=>C.tenderId===a.tenderId)?.label,b=!!(r?.length&&a.onTenderChange),v=Dt(s.currency),{draft:w,setDraft:$,normalize:N}=Il(a.amount,String),A=h.useCallback(C=>{Zs(C,v)&&($(C),a.onAmountChange(Kt(C)??0))},[a,$,v]),k=o?.kind==="processor_declined";return t.jsxs("div",{className:c.cn("flex flex-col text-default-900",m),"data-testid":p,children:[t.jsx("h3",{className:"sr-only","data-testid":`${p}-title`,children:x.title}),o&&t.jsx(Mn,{tone:k?"danger":"warning",title:k?x.declinedTitle:x.networkTitle,body:k?x.partDeclinedBody:x.partNetworkBody,onRetry:o.onRetry,retryLabel:x.retry,onChooseDifferent:o.onChooseDifferent,chooseDifferentLabel:x.chooseDifferent,className:"mb-[18px]","data-testid":`${p}-part-error`,retryTestId:`${p}-retry`,chooseDifferentTestId:`${p}-choose-different`}),t.jsxs("div",{"data-testid":`${p}-totals`,children:[t.jsxs("div",{className:"mb-4 flex items-center justify-between gap-2.5 rounded-xl bg-default-100 px-4 py-3.5",children:[t.jsx("span",{className:"text-[13px] font-semibold text-default-500",children:x.remaining}),t.jsx("span",{className:"text-[22px] font-semibold tabular-nums",children:fe(s.value,void 0,s.currency)}),t.jsxs("span",{className:"sr-only",children:[x.refundedSoFar,": ",fe(n.value,void 0,n.currency)]})]}),g.length>0&&t.jsxs("div",{children:[t.jsx("p",{className:rh,children:x.refundedSoFar}),g.map((C,E)=>t.jsxs("div",{className:"mb-2 flex items-center gap-2.5 rounded-xl border border-pos-line px-3 py-2.5","data-testid":`${p}-part-${C.tenderId}-done`,children:[t.jsxs("span",{className:"w-[22px] shrink-0 font-bold text-default-600",children:["#",E+1]}),t.jsx("span",{className:"flex h-8 w-8 shrink-0 items-center justify-center rounded-[9px] bg-default-100 text-default-600",children:t.jsx(P,{icon:C.icon??"lucide:credit-card",width:15,height:15,"aria-hidden":"true"})}),t.jsxs("span",{className:"min-w-0 flex-1",children:[t.jsx("span",{className:"block text-[13.5px] font-semibold",children:C.label}),C.feeNote&&t.jsx("span",{className:"block text-[11.5px] text-default-500",children:C.feeNote})]}),t.jsx("span",{className:"font-semibold tabular-nums",children:fe(C.refunded.value,void 0,C.refunded.currency)}),t.jsx("span",{className:c.cn(ih,C.status==="pending"?"bg-pos-warn-fill text-pos-warn":"bg-pos-ok-fill text-pos-ok"),children:C.status==="pending"?x.pending:x.succeeded})]},C.tenderId))]})]}),t.jsxs("div",{className:"mt-3.5","data-testid":`${p}-current`,children:[t.jsxs("div",{className:"mb-2 flex items-center justify-between gap-2",children:[t.jsx("span",{className:"text-sm font-semibold",children:x.partHeading.replace("{n}",String(g.length+1))}),y&&t.jsx("span",{className:"text-xs text-default-500",children:y})]}),t.jsx("p",{"aria-hidden":"true",className:"mb-1.5 text-[13px] font-semibold","data-testid":`${p}-amount-label`,children:x.amountForPart}),t.jsx(Js,{heading:x.amountForPart,amountLabel:x.amountForPart,hideHeading:!0,placeholder:"$0.00",value:w,onChange:A,onBlur:N,maxAmount:s.value,isDisabled:d,className:"gap-0 border-t-0 pt-0","data-testid":`${p}-amount`}),b&&t.jsx("div",{className:"mt-2.5 flex gap-2","data-testid":`${p}-methods`,children:r?.map(C=>{const E=C.tenderId===a.tenderId;return t.jsxs("button",{type:"button","aria-pressed":E,disabled:C.disabled||d,onClick:()=>a.onTenderChange?.(C.tenderId),className:c.cn("flex h-11 flex-1 items-center justify-center gap-2 rounded-xl border-[1.5px] bg-white","text-[13px] font-semibold outline-none transition-colors","disabled:cursor-not-allowed disabled:opacity-50","focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary",E?"border-primary bg-primary/5 text-primary":"border-pos-line text-default-600"),"data-testid":`${p}-method-${C.tenderId}`,children:[C.icon&&t.jsx(P,{icon:C.icon,width:15,height:15,"aria-hidden":"true"}),C.label]},C.tenderId)})})]}),!u&&t.jsxs("div",{className:"mt-4 flex items-center gap-3",children:[t.jsx(O,{variant:"bordered",className:"h-12 min-w-0 flex-1 rounded-[14px] border-1 border-pos-line bg-white px-5 text-[15px] font-semibold text-default-900",onPress:l,"data-testid":`${p}-back`,children:x.back}),t.jsx(O,{color:"primary",className:"h-12 min-w-0 flex-1 rounded-[14px] px-5 text-[15px] font-semibold",isDisabled:d,isLoading:d,onPress:i,"data-testid":`${p}-submit`,children:x.submit})]})]})};jo.displayName="SplitTenderPanel";const wo="hsl(var(--heroui-primary))",lh="hsl(var(--heroui-primary) / 0.05)",No="hsl(var(--heroui-default-100))",Co="hsl(var(--heroui-default-600))",la={card:"lucide:credit-card",cash:"lucide:dollar-sign",check:"lucide:edit-3",store_credit:"lucide:gift",reader:"lucide:nfc",other:"lucide:more-horizontal"},ce={root:"flex flex-col text-default-900",banner:"mb-[18px]",eyebrowRow:"mb-3 flex min-h-6 items-center justify-between gap-3",eyebrow:"text-[11px] font-semibold uppercase tracking-[.08em] text-default-500",grid:"grid grid-cols-3 gap-2.5",card:"relative flex min-h-[132px] flex-col rounded-[14px] border-[1.5px] bg-white transition-colors",focusRing:"outline-none focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary",toggle:"flex w-full items-center gap-[11px] rounded-[12px] px-[15px] pt-[13px] text-left disabled:cursor-not-allowed",toggleUnselected:"flex-1 flex-col items-stretch gap-3 pb-[13px]",toggleHeader:"flex w-full items-center gap-[11px]",toggleRemovable:"pr-12",iconBox:"flex h-[38px] w-[38px] shrink-0 items-center justify-center rounded-[10px]",text:"min-w-0 flex-1",label:"block truncate text-[15px] font-semibold leading-5",subtitle:"block truncate text-xs text-default-500",status:"block truncate text-xs font-semibold",lowerSlot:"mt-auto flex h-11 w-full items-center rounded-[10px] px-3 text-[13px] font-medium tabular-nums",amountSlot:"mt-auto px-[15px] pb-[13px] pt-3",amountWrapper:"h-11 min-h-11 rounded-[10px] bg-white shadow-none",amountInput:"text-[15px] font-semibold tabular-nums",remove:"absolute right-1 top-1 flex h-11 w-11 items-center justify-center rounded-[10px] text-default-500 hover:text-default-900 disabled:cursor-not-allowed",badge:"inline-flex h-[22px] shrink-0 items-center whitespace-nowrap rounded-full px-[9px] text-xs font-medium leading-none",another:"flex min-h-[132px] w-full flex-col items-start justify-center gap-3 rounded-[14px] border-[1.5px] border-dashed bg-white px-[15px] py-[13px] text-left transition-colors disabled:cursor-not-allowed",anotherOpen:"aria-expanded:scale-100",menuItem:"py-2"},oh={idle:{borderColor:le.line,backgroundColor:"#fff"},selected:{borderColor:wo,backgroundColor:lh},declined:{borderColor:le.danger,backgroundColor:le["danger-fill"]}},Nn={idle:{backgroundColor:No,color:Co},selected:{backgroundColor:wo,color:"#fff"}},ch={backgroundColor:No,color:Co},dh={borderColor:le.line},jr={declined:{color:le.danger},pending:{color:le.warn,backgroundColor:le["warn-fill"]},done:{color:le.ok,backgroundColor:le["ok-fill"]}},uh={heading:"Money back to",upTo:"Up to {amount}",noCap:"Tap to add an amount",amountFor:"Amount to {method}",remove:"Remove {method}",declined:"Declined",pending:"Pending",done:"Refunded",retry:"Try again",chooseDifferent:"Choose different method"},mh=e=>{try{return new Intl.NumberFormat("en-US",{style:"currency",currency:e}).formatToParts(0).find(n=>n.type==="currency")?.value??e}catch{return e}},fh=({method:e,currency:n,busy:s,labels:a,onToggle:r,onAmountChange:i,onAmountBlur:o,onRemove:l,testId:d})=>{const u=e.status??"idle",f=u==="pending"||u==="done",m=s||f,p=!!(e.removable&&l),x=e.cap?.currency??n,g=Dt(x),y=`${d}-amount`,b=a.amountFor.replace("{method}",e.label),v=h.useCallback(k=>{if(!Zs(k,g))return;const C=Kt(k);e.cap&&C!==null&&C>e.cap.value||i(e.id,k)},[g,e.cap,e.id,i]),w=h.useCallback(k=>{const C=k.currentTarget;requestAnimationFrame(()=>{C.isConnected&&C.select()})},[]),$=u==="declined"?"declined":e.selected?"selected":"idle",N=e.statusLabel??(u==="idle"?void 0:a[u]),A=t.jsxs("span",{className:ce.toggleHeader,children:[t.jsx("span",{className:ce.iconBox,style:e.selected?Nn.selected:Nn.idle,"data-testid":`${d}-icon`,children:t.jsx(P,{icon:la[e.kind],width:18,height:18,"aria-hidden":"true"})}),t.jsxs("span",{className:ce.text,children:[t.jsx("span",{className:ce.label,children:e.label}),u==="declined"&&N?t.jsx("span",{className:ce.status,style:jr.declined,"data-testid":`${d}-status`,children:N}):e.subtitle&&t.jsx("span",{className:ce.subtitle,children:e.subtitle})]}),f&&N&&t.jsx("span",{className:ce.badge,style:jr[u],"data-testid":`${d}-status`,children:N})]});return t.jsxs("div",{className:ce.card,style:oh[$],"data-selected":e.selected||void 0,"data-status":u,"data-testid":d,children:[e.selected?t.jsxs(t.Fragment,{children:[t.jsx("button",{type:"button","aria-pressed":!0,disabled:m,onClick:()=>r(e.id),className:c.cn(ce.toggle,ce.focusRing,p&&ce.toggleRemovable),"data-testid":`${d}-toggle`,children:A}),t.jsxs("div",{className:ce.amountSlot,children:[t.jsx("label",{htmlFor:y,className:"sr-only",children:b}),t.jsx(c.Input,{id:y,"aria-label":b,type:"text",inputMode:"decimal",placeholder:"0.00",value:e.amount??"",onChange:k=>v(k.target.value),onFocus:w,onBlur:()=>o?.(e.id),isDisabled:m,variant:"bordered",startContent:t.jsx("span",{className:"text-[15px] font-semibold text-default-500","aria-hidden":"true",children:mh(x)}),classNames:{inputWrapper:ce.amountWrapper,input:ce.amountInput},"data-testid":`${d}-amount`})]})]}):t.jsxs("button",{type:"button","aria-pressed":!1,disabled:m,onClick:()=>r(e.id),className:c.cn(ce.toggle,ce.toggleUnselected,ce.focusRing,p&&ce.toggleRemovable),"data-testid":`${d}-toggle`,children:[A,t.jsx("span",{className:ce.lowerSlot,style:ch,"data-testid":`${d}-cap`,children:e.cap?a.upTo.replace("{amount}",fe(e.cap.value,void 0,e.cap.currency)):a.noCap})]}),p&&t.jsx("button",{type:"button","aria-label":a.remove.replace("{method}",e.label),disabled:s,onClick:()=>l?.(e.id),className:c.cn(ce.remove,ce.focusRing),"data-testid":`${d}-remove`,children:t.jsx(P,{icon:"lucide:x",width:16,height:16,"aria-hidden":"true"})})]})},ko=({methods:e,onToggle:n,onAmountChange:s,onAmountBlur:a,onRemove:r,currency:i="USD",paidWith:o,anotherMethod:l,error:d,busy:u=!1,labels:f,className:m,"data-testid":p="refund-method-cards"})=>{const x={...uh,...f};return t.jsxs("div",{className:c.cn(ce.root,m),"data-testid":p,children:[d&&t.jsx(Mn,{tone:d.tone,title:d.title,body:d.body,onRetry:d.onRetry,retryLabel:x.retry,onChooseDifferent:d.onChooseDifferent,chooseDifferentLabel:x.chooseDifferent,className:ce.banner,"data-testid":`${p}-error`,retryTestId:`${p}-retry`,chooseDifferentTestId:`${p}-choose-different`}),t.jsxs("div",{className:ce.eyebrowRow,children:[t.jsx("p",{className:ce.eyebrow,children:x.heading}),o&&t.jsx(Fn,{variant:"record",label:o.label,value:o.value,"data-testid":`${p}-paid-with`})]}),t.jsxs("div",{role:"group","aria-label":x.heading,className:ce.grid,"data-testid":`${p}-grid`,children:[e.map(g=>t.jsx(fh,{method:g,currency:i,busy:u,labels:x,onToggle:n,onAmountChange:s,onAmountBlur:a,onRemove:r,testId:`${p}-method-${g.id}`},g.id)),l&&t.jsxs(c.Dropdown,{placement:"bottom-start",isDisabled:u,classNames:{trigger:ce.anotherOpen},children:[t.jsx(c.DropdownTrigger,{children:t.jsxs("button",{type:"button",className:c.cn(ce.another,ce.focusRing),style:dh,"data-testid":`${p}-another`,children:[t.jsx("span",{className:ce.iconBox,style:Nn.idle,children:t.jsx(P,{icon:"lucide:plus",width:18,height:18,"aria-hidden":"true"})}),t.jsxs("span",{className:"min-w-0",children:[t.jsx("span",{className:ce.label,children:l.label}),t.jsx("span",{className:ce.subtitle,children:l.subtitle})]})]})}),t.jsx(c.DropdownMenu,{"aria-label":l.label,items:l.options,onAction:g=>l.onPick(String(g)),"data-testid":`${p}-another-menu`,children:g=>t.jsx(c.DropdownItem,{textValue:g.label,description:g.description,className:ce.menuItem,startContent:t.jsx("span",{className:ce.iconBox,style:Nn.idle,children:t.jsx(P,{icon:la[g.kind],width:18,height:18,"aria-hidden":"true"})}),"data-testid":`${p}-another-option-${g.id}`,children:g.label},g.id)})]})]})]})};ko.displayName="RefundMethodCards";const Ie={root:"flex flex-col text-default-900",eyebrow:"mb-3 text-[11px] font-semibold uppercase tracking-[.08em] text-default-500",list:"flex flex-col gap-2.5",row:"flex flex-col gap-3 rounded-[14px] border-[1.5px] px-[15px] py-[13px] transition-colors",main:"flex items-center gap-[11px]",iconBox:"flex h-[38px] w-[38px] shrink-0 items-center justify-center rounded-[10px]",text:"min-w-0 flex-1",label:"block truncate text-[15px] font-semibold leading-5",note:"block truncate text-xs text-default-500",amount:"shrink-0 text-[15px] font-semibold tabular-nums",badge:"inline-flex h-[22px] shrink-0 items-center gap-[5px] whitespace-nowrap rounded-full px-[9px] text-xs font-medium leading-none",prompt:"flex flex-wrap items-center gap-3 rounded-[10px] px-3 py-2",promptText:"min-w-0 flex-1 text-[13px] font-medium",action:"h-11 min-w-0 rounded-[12px] px-4 text-[14px] font-semibold"},So="hsl(var(--heroui-primary))",xh={idle:{borderColor:le.line,backgroundColor:"#fff"},active:{borderColor:So,backgroundColor:"hsl(var(--heroui-primary) / 0.05)"},failed:{borderColor:le.danger,backgroundColor:le["danger-fill"]}},wr={idle:{backgroundColor:"hsl(var(--heroui-default-100))",color:"hsl(var(--heroui-default-600))"},active:{backgroundColor:So,color:"#fff"}},ph={backgroundColor:"#fff",color:le.neutral},Ct=e=>({color:He[e].fg,backgroundColor:He[e].bg}),hh={queued:Ct("neutral"),processing:Ct("info"),waiting_reader:Ct("warn"),waiting_cash:Ct("warn"),done:Ct("ok"),failed:Ct("danger")},bh={heading:"Refunding",queued:"Queued",processing:"Processing",waitingReader:"Waiting for reader",waitingCash:"Waiting for cash",done:"Refunded",failed:"Failed"},gh={queued:"queued",processing:"processing",waiting_reader:"waitingReader",waiting_cash:"waitingCash",done:"done",failed:"failed"},Nr={waiting_reader:"lucide:nfc",waiting_cash:"lucide:banknote"},yh=e=>e.status==="processing"||e.status==="waiting_reader"||e.status==="waiting_cash",$o=({parts:e,activeId:n,labels:s,className:a,"data-testid":r="refund-progress-list"})=>{const i={...bh,...s},o=n??e.find(yh)?.id;return t.jsxs("div",{className:c.cn(Ie.root,a),"data-testid":r,children:[t.jsx("p",{className:Ie.eyebrow,children:i.heading}),t.jsx("ol",{"aria-label":i.heading,className:Ie.list,children:e.map(l=>{const d=l.id===o,u=`${r}-part-${l.id}`,f=d?"active":l.status==="failed"?"failed":"idle";return t.jsxs("li",{"aria-current":d?"step":void 0,className:Ie.row,style:xh[f],"data-status":l.status,"data-active":d||void 0,"data-testid":u,children:[t.jsxs("div",{className:Ie.main,children:[t.jsx("span",{className:Ie.iconBox,style:d?wr.active:wr.idle,children:t.jsx(P,{icon:la[l.kind],width:18,height:18,"aria-hidden":"true"})}),t.jsxs("span",{className:Ie.text,children:[t.jsx("span",{className:Ie.label,children:l.label}),l.note&&t.jsx("span",{className:Ie.note,children:l.note})]}),t.jsx("span",{className:Ie.amount,children:fe(l.amount.value,void 0,l.amount.currency)}),t.jsxs("span",{className:Ie.badge,style:hh[l.status],"data-testid":`${u}-status`,children:[l.status==="processing"&&t.jsx(P,{icon:"lucide:loader-circle",width:12,height:12,className:"animate-spin","aria-hidden":"true"}),i[gh[l.status]]]})]}),(l.prompt||l.action)&&t.jsxs("div",{role:"status",className:Ie.prompt,style:ph,"data-testid":`${u}-prompt`,children:[Nr[l.status]&&t.jsx(P,{icon:Nr[l.status],width:18,height:18,"aria-hidden":"true"}),l.prompt&&t.jsx("span",{className:Ie.promptText,children:l.prompt}),l.action&&t.jsx(O,{color:"primary",className:Ie.action,onPress:l.action.onPress,isLoading:l.action.loading,isDisabled:l.action.disabled,"data-testid":`${u}-action`,children:l.action.label})]})]},l.id)})})]})};$o.displayName="RefundProgressList";const vh={label:"Supervisor authorization",placeholder:"••••"},Ao=({pin:e,onChange:n,hint:s,error:a,labels:r,className:i,"data-testid":o="pin-field"})=>{const l={...vh,...r};return t.jsxs("div",{className:c.cn("mx-auto max-w-[460px] rounded-[20px] border border-pos-line bg-white px-7 py-[26px]","text-center text-default-900 shadow-[0_1px_2px_rgba(0,0,0,0.05)]",i),"data-testid":o,children:[t.jsx("div",{className:"mx-auto mb-4 flex h-[70px] w-[70px] items-center justify-center rounded-full bg-pos-danger-fill text-primary",children:t.jsx(P,{icon:"lucide:lock",width:26,height:26,"aria-hidden":"true"})}),t.jsx("p",{className:"text-[17px] font-semibold",children:l.label}),s&&t.jsx("p",{className:"mt-1.5 text-[13px] text-default-500",children:s}),t.jsx(c.Input,{type:"password",inputMode:"numeric","aria-label":l.label,placeholder:l.placeholder,value:e,onChange:d=>n(d.target.value.replace(/\D/g,"").slice(0,6)),isInvalid:!!a,errorMessage:a,variant:"bordered",radius:"lg",classNames:{inputWrapper:"h-11",input:"text-center text-[28px] tracking-[.4em] tabular-nums"},className:"mx-auto mt-[18px] max-w-[160px]","data-testid":`${o}-input`})]})};Ao.displayName="PinField";const jh={processing:"Processing refund…",title:"Refund complete",destinationsTitle:"Refund destinations",sendReceipt:"Send receipt",email:"Email",print:"Print",done:"Done",pending:"Pending",succeeded:"Refunded",reason:"Reason · {reason}",authorizedBy:"Authorized by {name}",paidWithTitle:"Paid with",outcomeTitle:"Outcome",changeDue:"Change due",emailPlaceholder:"Add email…",emailAriaLabel:"Add email address",removeEmail:"Remove {email}",sendEmail:"Send receipt"},wh={refund:{},payment:{title:"Payment complete",done:"New sale",authorizedBy:"Handled by {name}"}},Nh={succeeded:"bg-pos-ok-fill text-pos-ok",pending:"bg-pos-warn-fill text-pos-warn"},Ch="inline-flex h-[1.375rem] items-center gap-[0.3125rem] whitespace-nowrap rounded-full px-[0.5625rem] text-xs font-medium leading-none",Ot="mb-1.5 text-[0.6875rem] font-semibold uppercase tracking-[.05em] text-pos-muted",kh="mx-auto max-w-[65rem] rounded-[1.25rem] border border-pos-line bg-white px-7 py-[1.625rem] shadow-[0_0.0625rem_0.125rem_rgba(0,0,0,0.05)]",Sh=["email","print"],fn=`${ke} motion-reduce:data-[pressed=true]:scale-100 [html[data-pos-reduce-motion=true]_&]:data-[pressed=true]:scale-100`,je={paidRow:"flex w-full items-center gap-3 border-b border-transparent py-[0.6875rem] text-left",paidIcon:"flex h-[2.125rem] w-[2.125rem] shrink-0 items-center justify-center rounded-[0.5625rem] bg-pos-neutral-fill text-pos-neutral",paidLabel:"text-sm font-semibold",paidAmount:"ml-1.5 text-sm font-semibold tabular-nums",paidStatus:"ml-auto whitespace-nowrap rounded-full bg-pos-neutral-fill px-2.5 py-1 text-[0.71875rem] font-semibold text-pos-neutral",groups:"flex w-full flex-col gap-3 border-y border-pos-line-2 py-3 text-left",groupLabel:"mb-1.5 text-[0.6875rem] font-semibold uppercase tracking-[.05em] text-pos-muted",groupItems:"flex flex-wrap gap-1.5",groupItem:"rounded-lg bg-pos-neutral-fill px-2.5 py-1 text-[0.8125rem] text-pos-ink",receiptRow:"mt-2 flex flex-wrap items-center gap-3.5",receiptAction:`h-10 min-w-0 flex-1 gap-2 rounded-xl border border-pos-line bg-white px-4 text-sm font-semibold text-pos-ink data-[hover=true]:bg-pos-neutral-fill ${fn}`,receiptActionExpanded:"bg-pos-neutral-fill",emailBox:"mt-5 flex w-full flex-col gap-2.5",chipWrap:"flex min-h-11 w-full flex-wrap items-center gap-1.5 rounded-xl border px-2 py-[0.3125rem]",chip:"inline-flex items-center gap-1 rounded-full border border-pos-line bg-pos-neutral-fill py-[0.1875rem] pl-2.5 pr-1 text-[0.8125rem] font-medium text-pos-ink",chipRemove:`h-11 w-11 min-w-0 -my-[0.8125rem] -mr-2.5 rounded-full bg-transparent text-pos-muted data-[hover=true]:bg-transparent data-[hover=true]:text-pos-ink data-[focus-visible=true]:outline-offset-[-0.5rem] ${fn}`,send:`h-10 w-full rounded-xl px-4 text-sm font-semibold ${fn}`,changeTitle:"text-[0.9375rem] font-medium text-pos-muted",changeLabel:"mt-4 text-sm font-semibold text-pos-neutral",changeAmount:"mt-0.5 text-[3.125rem] font-medium leading-[1.05] tracking-[-.02em] tabular-nums",changeCaption:"mt-2.5 text-[0.8125rem] text-pos-muted"},Eo=({state:e,kind:n="refund",total:s,destinations:a,subtitle:r,reason:i,paidWith:o,outcomeGroups:l,changeDue:d,authorizedBy:u,selectedReceipts:f,onSendReceipt:m,receiptActions:p,emailReceipt:x,onDone:g,frameless:y=!1,labels:b,className:v,"data-testid":w="outcome-view"})=>{const $={...jh,...wh[n],...b},N=h.useId(),A=s?fe(s.value,void 0,s.currency):null;return e==="processing"?t.jsx("div",{className:c.cn("flex flex-col items-center justify-center text-center text-pos-ink",v),"aria-live":"polite","data-testid":w,children:t.jsxs("div",{className:"flex flex-col items-center px-5 py-[3.75rem]","data-testid":`${w}-processing`,children:[t.jsx("div",{className:`mb-4 h-[3.25rem] w-[3.25rem] animate-spin rounded-full border-[0.3125rem] border-pos-neutral-fill border-t-primary ${Lr}`,role:"presentation"}),t.jsx("p",{className:"text-[1.0625rem] font-semibold",children:$.processing}),A&&t.jsx("p",{className:"mt-2 text-[0.9375rem] font-semibold tabular-nums","data-testid":`${w}-processing-total`,children:A})]})}):t.jsxs("div",{className:c.cn("flex flex-col text-pos-ink",!y&&kh,v),"aria-live":"polite","data-testid":w,children:[t.jsxs("div",{className:c.cn("text-center",n==="refund"&&"pb-0.5 pt-1"),children:[t.jsx("div",{className:"mx-auto mb-3.5 flex h-[4.875rem] w-[4.875rem] items-center justify-center rounded-full bg-pos-ok-fill text-pos-ok",children:t.jsx("span",{"aria-hidden":"true",className:"flex h-[2.875rem] w-[2.875rem]",children:t.jsx(P,{icon:"solar:check-circle-bold",width:"100%",height:"100%"})})}),d?t.jsxs(t.Fragment,{children:[t.jsx("p",{className:je.changeTitle,"data-testid":`${w}-title`,children:$.title}),t.jsx("p",{className:je.changeLabel,children:$.changeDue}),t.jsx("p",{className:je.changeAmount,"data-testid":`${w}-change`,children:fe(d.amount.value,void 0,d.amount.currency)}),d.caption&&t.jsx("p",{className:je.changeCaption,"data-testid":`${w}-change-caption`,children:d.caption})]}):t.jsxs(t.Fragment,{children:[t.jsx("p",{className:"text-[1.375rem] font-semibold","data-testid":`${w}-title`,children:$.title}),A&&t.jsx("p",{className:"my-1 text-[1.875rem] font-semibold tabular-nums","data-testid":`${w}-total`,children:A}),r&&t.jsx("p",{className:"text-[0.8125rem] text-pos-muted","data-testid":`${w}-subtitle`,children:r})]}),i&&t.jsx("p",{className:"text-[0.8125rem] text-pos-muted","data-testid":`${w}-reason`,children:$.reason.replace("{reason}",i)})]}),o&&o.length>0&&t.jsxs("div",{className:"mt-5 text-left","data-testid":`${w}-paid-with`,children:[t.jsx("p",{className:Ot,children:$.paidWithTitle}),o.map((k,C)=>t.jsxs("div",{className:je.paidRow,"data-testid":`${w}-paid-with-${C}`,children:[k.icon&&t.jsx("span",{className:je.paidIcon,"aria-hidden":"true",children:t.jsx("span",{className:"flex h-4 w-4",children:t.jsx(P,{icon:k.icon,width:"100%",height:"100%"})})}),t.jsx("span",{className:je.paidLabel,children:k.label}),t.jsx("span",{className:je.paidAmount,children:fe(k.amount.value,void 0,k.amount.currency)}),k.status&&t.jsx("span",{className:je.paidStatus,children:k.status})]},`${k.label}-${C}`))]}),l&&l.length>0&&t.jsxs("div",{className:"mt-5 text-left","data-testid":`${w}-outcome`,children:[t.jsx("p",{className:Ot,children:$.outcomeTitle}),t.jsx("div",{className:je.groups,children:l.map((k,C)=>t.jsxs("div",{"data-testid":`${w}-outcome-${C}`,children:[t.jsx("p",{className:je.groupLabel,children:k.label}),t.jsx("ul",{className:je.groupItems,"aria-label":k.label,children:k.items.map((E,S)=>t.jsx("li",{className:je.groupItem,children:E},`${E}-${S}`))})]},`${k.label}-${C}`))})]}),a&&t.jsxs("div",{className:"mt-5 text-left",children:[t.jsx("p",{className:Ot,children:$.destinationsTitle}),a.map((k,C)=>t.jsxs("div",{className:"flex items-center justify-between gap-2.5 border-b border-pos-line-2 py-[0.6875rem] text-sm last:border-b-0","data-testid":`${w}-destination-${C}-${k.status}`,children:[t.jsx("span",{className:"font-semibold",children:k.label}),t.jsxs("div",{className:"flex items-center gap-2.5",children:[t.jsx("span",{className:"tabular-nums text-pos-neutral",children:fe(k.amount.value,void 0,k.amount.currency)}),t.jsx("span",{className:c.cn(Ch,Nh[k.status]),children:k.status==="succeeded"?$.succeeded:$.pending})]})]},`${k.label}-${C}`))]}),p&&p.length>0?t.jsxs("div",{className:"mt-5 flex flex-col text-left","data-testid":`${w}-receipt-actions`,children:[t.jsx("p",{className:Ot,children:$.sendReceipt}),t.jsx("div",{className:je.receiptRow,children:p.map(k=>t.jsx($h,{action:k,controls:k.expanded?N:void 0,"data-testid":`${w}-receipt-action-${k.key}`},k.key))}),x&&t.jsx(Ah,{id:N,email:x,labels:$,"data-testid":`${w}-email`})]}):m&&t.jsxs("div",{className:"mt-5 text-left",children:[t.jsx("p",{className:Ot,children:$.sendReceipt}),t.jsx("div",{className:"flex flex-col gap-2",children:Sh.map(k=>{const C=f?.includes(k)??!1;return t.jsxs("button",{type:"button",role:"checkbox","aria-checked":C,onClick:()=>m(k),className:`flex min-h-11 w-full items-center gap-2.5 rounded-[0.625rem] p-2 text-left text-sm outline-none transition-colors hover:bg-pos-neutral-fill focus-visible:outline focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-primary ${ke}`,"data-testid":`${w}-receipt-${k}`,children:[t.jsx("span",{"aria-hidden":"true",className:"pointer-events-none flex",children:t.jsx(c.Checkbox,{isSelected:C,isReadOnly:!0,tabIndex:-1})}),t.jsx("span",{children:$[k]})]},k)})})]}),u&&t.jsx("p",{className:"mt-4 text-[0.78125rem] text-pos-muted","data-testid":`${w}-authorized-by`,children:$.authorizedBy.replace("{name}",u)}),t.jsx("div",{className:"mt-auto pt-5",children:t.jsx(O,{color:"primary",className:`h-12 w-full rounded-[0.875rem] px-5 text-[0.9375rem] font-semibold ${fn}`,onPress:g,"data-testid":`${w}-done`,children:$.done})})]})};Eo.displayName="OutcomeView";function $h({action:e,controls:n,"data-testid":s}){return t.jsx(O,{variant:"bordered",color:"default",disableRipple:!0,className:c.cn(je.receiptAction,e.expanded&&je.receiptActionExpanded),"aria-expanded":e.expanded,"aria-controls":n,isDisabled:e.isDisabled,onPress:e.onPress,startContent:e.icon?t.jsx("span",{"aria-hidden":"true",className:"flex h-4 w-4 shrink-0",children:t.jsx(P,{icon:e.icon,width:"100%",height:"100%"})}):void 0,"data-testid":s,children:e.label})}function Ah({id:e,email:n,labels:s,"data-testid":a}){const r=n.isSendDisabled??n.emails.length===0;return t.jsxs("div",{id:e,className:je.emailBox,"data-testid":a,children:[t.jsxs("div",{className:c.cn(je.chipWrap,n.isInvalid?"border-pos-danger":"border-pos-line"),"data-invalid":n.isInvalid||void 0,"data-testid":`${a}-recipients`,children:[n.emails.map(i=>t.jsxs("span",{className:je.chip,"data-testid":`${a}-chip`,children:[i,t.jsx(O,{isIconOnly:!0,variant:"light",color:"default",disableRipple:!0,className:je.chipRemove,"aria-label":s.removeEmail.replace("{email}",i),onPress:()=>n.onRemoveEmail(i),"data-testid":`${a}-remove`,children:t.jsx("span",{"aria-hidden":"true",className:"flex h-[0.9375rem] w-[0.9375rem]",children:t.jsx(P,{icon:"lucide:x",width:"100%",height:"100%"})})})]},i)),t.jsx(c.Input,{"aria-label":s.emailAriaLabel,placeholder:s.emailPlaceholder,type:"email",value:n.draft,onValueChange:n.onDraftChange,onKeyDown:i=>{i.key==="Enter"&&n.draft.trim()!==""&&(i.preventDefault(),n.onAddEmail(n.draft.trim()))},isInvalid:n.isInvalid,classNames:{base:"w-auto min-w-[7.5rem] flex-1",inputWrapper:`h-[1.6875rem] min-h-[1.6875rem] bg-transparent px-0.5 py-0 shadow-none data-[hover=true]:bg-transparent group-data-[focus=true]:bg-transparent group-data-[invalid=true]:bg-transparent ${ke}`,input:"text-[0.8125rem] text-pos-ink placeholder:text-pos-muted group-data-[invalid=true]:text-pos-ink"},"data-testid":`${a}-input`})]}),t.jsx(O,{color:"secondary",className:je.send,isDisabled:r,isLoading:n.isSending,onPress:n.onSend,"data-testid":`${a}-send`,children:s.sendEmail})]})}const _e={base:"relative inline-grid min-w-[var(--filter-select-min)] max-w-max shrink grow basis-[var(--filter-select-min)] grid-cols-[minmax(0,1fr)] [--filter-select-min:6rem]",baseActive:"[--filter-select-min:8rem]",cell:"[grid-area:1/1]",sizer:"invisible h-0 max-w-[20rem] overflow-hidden whitespace-nowrap border-x-2 border-transparent pl-2 pr-[2.0625rem] text-[0.875rem]",sizerActive:"pr-[3.4375rem] font-semibold",select:"w-full [contain:inline-size]",trigger:"h-[2.375rem] min-h-[2.375rem] rounded-[0.625rem] border-medium border-pos-field bg-white px-2 shadow-none data-[hover=true]:border-default-300 data-[focus=true]:border-primary data-[open=true]:border-primary data-[focus-visible=true]:ring-2 data-[focus-visible=true]:ring-primary data-[focus-visible=true]:ring-offset-1",triggerActive:"!border-acct-rust-border !bg-acct-rust-fill pr-[1.875rem]",value:"text-[0.875rem] !text-default-900",valueActive:"font-semibold !text-primary-600",iconActive:"!text-primary-600",clear:"absolute right-[1.875rem] top-1/2 z-20 inline-flex size-[1.25rem] -translate-y-1/2 items-center justify-center rounded-md text-primary-600 outline-none hover:bg-white/70 focus-visible:outline focus-visible:outline-2 focus-visible:outline-primary",clearIcon:"size-[0.8125rem]",optionTitle:"whitespace-normal break-words"},Eh="grid shrink grow basis-0 grid-flow-col auto-cols-auto gap-2.5 [--filter-select-cap:16rem] max-w-[calc(var(--filter-select-count)*var(--filter-select-cap)+(var(--filter-select-count)-1)*0.625rem)] [&>[data-slot=filter-select]]:max-w-none",Dh="calc(100vw - 1.5rem)",Do=({label:e,value:n,options:s,onChange:a,clearLabel:r,minWidth:i,"data-testid":o="filter-select"})=>{const l=n!==null,d=l?s.find(x=>x.value===n)?.label:void 0,u=h.useRef(null),f=h.useRef(null),[m,p]=h.useState();return t.jsxs("div",{ref:u,"data-testid":o,"data-slot":"filter-select","data-active":l?"true":void 0,title:d,className:c.cn(_e.base,l&&_e.baseActive),style:i===void 0?void 0:{"--filter-select-min":it(i)},children:[t.jsx(Xe,{"aria-label":e,placeholder:e,size:"sm",variant:"bordered",radius:"md",selectedKeys:n===null?[]:[n],onSelectionChange:x=>{if(x==="all")return;const g=[...x][0];a(g===void 0?null:String(g))},onOpenChange:x=>{x&&p(u.current?.getBoundingClientRect().width)},popoverProps:{ref:f,placement:"bottom-start",style:{minWidth:m,maxWidth:Dh}},"data-testid":`${o}-trigger`,classNames:{base:c.cn(_e.select,_e.cell),trigger:c.cn(_e.trigger,l&&_e.triggerActive),value:c.cn(_e.value,l&&_e.valueActive),selectorIcon:c.cn(l&&_e.iconActive)},children:s.map(x=>t.jsx(c.SelectItem,{classNames:{title:_e.optionTitle},children:x.label},x.value))}),t.jsx("span",{"aria-hidden":"true","data-testid":`${o}-sizer`,className:c.cn(_e.sizer,l&&_e.sizerActive,_e.cell),children:d??e}),l&&t.jsx("button",{type:"button","aria-label":r,onClick:()=>{a(null),u.current?.querySelector('[data-slot="trigger"]')?.focus()},"data-testid":`${o}-clear`,className:_e.clear,children:t.jsx(P,{icon:"lucide:x",className:_e.clearIcon,"aria-hidden":"true"})})]})};Do.displayName="FilterSelect";const Lo=({children:e,className:n,"data-testid":s="filter-select-group"})=>t.jsx("div",{"data-testid":s,"data-slot":"filter-select-group",className:c.cn(Eh,n),style:{"--filter-select-count":h.Children.toArray(e).length},children:e});Lo.displayName="FilterSelectGroup";const ut={base:"flex flex-wrap items-center justify-center gap-2.5 border-t border-pos-hair px-5 py-[0.875rem] text-[0.84375rem] text-default-500",idle:"w-full",sentinel:"h-px w-full",spinner:"inline-flex",error:"text-pos-danger"},Fo=({status:e,onLoadMore:n,loadingLabel:s,errorLabel:a,retryLabel:r,endLabel:i,"data-testid":o="load-more-footer"})=>{const l=h.useRef(null),d=h.useRef(n),u=h.useRef(!1);return h.useEffect(()=>{d.current=n},[n]),h.useEffect(()=>{if(e!=="idle"){u.current=!1;return}const f=l.current;if(!f||typeof IntersectionObserver>"u")return;const m=new IntersectionObserver(p=>{u.current||!p.some(x=>x.isIntersecting)||(u.current=!0,d.current())},{rootMargin:"0px 0px 200px 0px"});return m.observe(f),()=>m.disconnect()},[e]),e==="idle"?t.jsx("div",{"data-testid":o,"data-status":"idle",className:ut.idle,children:t.jsx("div",{ref:l,"aria-hidden":"true","data-testid":`${o}-sentinel`,className:ut.sentinel})}):e==="loading"?t.jsxs("div",{"data-testid":o,"data-status":"loading",role:"status","aria-live":"polite",className:ut.base,children:[t.jsx("span",{"aria-hidden":"true",className:ut.spinner,children:t.jsx(c.Spinner,{size:"sm",color:"default"})}),t.jsx("span",{"data-testid":`${o}-loading`,children:s})]}):e==="error"?t.jsxs("div",{"data-testid":o,"data-status":"error",className:ut.base,children:[t.jsx("span",{role:"alert","data-testid":`${o}-error`,className:ut.error,children:a}),t.jsx(O,{size:"sm",color:"default",variant:"bordered",radius:"md",onPress:n,testId:`${o}-retry`,children:r})]}):t.jsx("div",{"data-testid":o,"data-status":"end",className:i?ut.base:ut.idle,children:i&&t.jsx("span",{"data-testid":`${o}-end`,children:i})})};Fo.displayName="LoadMoreFooter";const Ce={base:"w-full",list:"m-0 list-none p-0",item:"relative border-b border-pos-hair last:border-b-0",card:"block w-full px-4 py-[0.875rem] text-left",cardInteractive:`cursor-pointer outline-none transition-colors hover:bg-default-50 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-[-2px] focus-visible:outline-primary ${ke}`,headline:"flex items-baseline gap-2.5",headlineWithActions:"pr-[3.25rem]",title:"min-w-0 text-[0.90625rem] font-semibold text-primary [overflow-wrap:anywhere]",amount:"ml-auto shrink-0 whitespace-nowrap text-[0.9375rem] font-bold tabular-nums text-default-900",actions:"absolute right-4 top-[0.1875rem] z-[1]",chips:"mt-[0.5625rem] flex flex-wrap gap-1.5",chipsLine:"mt-[0.5625rem] flex items-center gap-2.5",chipsInline:"flex min-w-0 flex-wrap gap-1.5",rows:"mt-[0.5625rem] block",row:"flex items-baseline gap-3 py-[0.1875rem] text-[0.8125rem]",rowLabel:"shrink-0 text-default-500",rowValue:"ml-auto min-w-0 text-right text-default-700 [overflow-wrap:anywhere]",skeletonRow:"border-b border-pos-hair p-4 last:border-b-0"},Cr=({item:e,withActions:n})=>t.jsxs(t.Fragment,{children:[t.jsxs("span",{className:c.cn(Ce.headline,n&&Ce.headlineWithActions),children:[t.jsx("span",{className:Ce.title,children:e.title}),re(e.amount)&&!n&&t.jsx("span",{className:Ce.amount,children:e.amount})]}),n?(re(e.chips)||re(e.amount))&&t.jsxs("span",{className:Ce.chipsLine,children:[re(e.chips)&&t.jsx("span",{className:Ce.chipsInline,children:e.chips}),re(e.amount)&&t.jsx("span",{className:Ce.amount,children:e.amount})]}):re(e.chips)&&t.jsx("span",{className:Ce.chips,children:e.chips}),e.rows&&e.rows.length>0&&t.jsx("span",{className:Ce.rows,children:e.rows.map((s,a)=>t.jsxs("span",{className:Ce.row,children:[t.jsx("span",{className:Ce.rowLabel,children:s.label}),t.jsx("span",{className:Ce.rowValue,children:s.value})]},a))})]}),Ro=({items:e,ariaLabel:n,onSelect:s,loading:a=!1,skeletonCount:r=6,"data-testid":i="card-list"})=>t.jsx("div",{"data-testid":i,className:Ce.base,children:a?t.jsx("div",{role:"status","aria-busy":"true","aria-label":n,"data-testid":`${i}-skeleton`,children:t.jsx("div",{"aria-hidden":"true",children:Array.from({length:r},(o,l)=>t.jsxs("div",{"data-testid":`${i}-skeleton-row`,className:Ce.skeletonRow,children:[t.jsx("div",{className:on,style:{height:it(13),width:it(130)}}),t.jsx("div",{className:on,style:{height:it(11),width:"70%",marginTop:it(10)}}),t.jsx("div",{className:on,style:{height:it(11),width:"45%",marginTop:it(8)}})]},l))})}):t.jsx("ul",{"aria-label":n,className:Ce.list,children:e.map(o=>{const l=re(o.actions);return t.jsxs("li",{"data-testid":`${i}-item-${o.id}`,className:Ce.item,children:[s?t.jsx("button",{type:"button",onClick:()=>s(o.id),className:c.cn(Ce.card,Ce.cardInteractive),children:t.jsx(Cr,{item:o,withActions:l})}):t.jsx("div",{className:Ce.card,children:t.jsx(Cr,{item:o,withActions:l})}),l&&t.jsx("div",{"data-testid":`${i}-item-${o.id}-actions`,className:Ce.actions,children:o.actions})]},o.id)})})});Ro.displayName="CardList";const Lh=48,ae={base:`mb-4 overflow-hidden rounded-2xl border border-pos-line bg-white ${Rn}`,band:"flex items-center gap-2.5 border-b border-pos-hair bg-pos-page px-4 py-2.5",back:`inline-flex size-[1.625rem] shrink-0 items-center justify-center rounded-[0.625rem] text-default-500 outline-none transition-colors hover:bg-default-100 focus-visible:outline focus-visible:outline-2 focus-visible:outline-primary ${ke}`,backIcon:"size-[0.875rem]",breadcrumb:"min-w-0 flex-1",breadcrumbList:"flex-nowrap gap-[0.375rem]",crumbBase:"min-w-0",crumb:"whitespace-nowrap text-[0.875rem] text-default-500 data-[disabled=true]:opacity-100 data-[current=true]:overflow-hidden data-[current=true]:font-normal data-[current=true]:text-default-900",crumbSeparator:"ms-[0.375rem] px-0 text-default-400 data-[disabled=true]:opacity-100",body:"flex flex-wrap gap-5",bodyWide:"px-5 pb-5 pt-[1.125rem]",bodyNarrow:"p-4",identity:"min-w-0 flex-[1_1_18.75rem]",title:"m-0 font-semibold tracking-[-.02em] text-default-900 [overflow-wrap:anywhere]",titleWide:"text-[1.5rem]",titleNarrow:"text-[1.3125rem]",meta:"m-0 mt-[0.6875rem] flex list-none flex-col gap-[0.4375rem] p-0",metaLine:"flex min-w-0 items-center gap-[0.5625rem] text-[0.84375rem] text-default-700",metaIcon:"flex shrink-0 text-default-400 [&_svg]:size-[0.9375rem]",metaText:"min-w-0 truncate",money:"flex flex-col gap-[0.3125rem]",moneyWide:"ml-auto min-w-[12.5rem] flex-none items-end text-right",moneyNarrow:"w-full items-start text-left",amountLabel:"text-[0.8125rem] text-default-500",amount:"whitespace-nowrap font-bold tracking-[-.03em] tabular-nums text-default-900",amountWide:"text-[1.9375rem] leading-[1.1]",amountNarrow:"text-[1.6875rem] leading-[1.1]",amountCaption:"text-[0.8125rem] text-default-500",recordId:"text-[0.8125rem] text-default-500",chips:"mt-[0.1875rem] flex flex-wrap gap-1.5",chipsWide:"justify-end",chipsNarrow:"justify-start",statItems:"m-0 mt-2.5 flex flex-wrap gap-[1.375rem]",stat:"flex flex-col-reverse",statWide:"text-right",statNarrow:"text-left",statValue:"m-0 text-[0.9375rem] font-bold tabular-nums text-default-900",statLabel:"mt-0.5 text-[0.75rem] text-default-500",statsWide:"px-5 pb-5",statsNarrow:"px-4 pb-4"},_o=h.forwardRef((e,n)=>t.jsx("li",{ref:n,...Object.fromEntries(Object.entries(e).filter(([s])=>s!=="data-testid"))}));_o.displayName="CrumbBase";const Mo=({breadcrumb:e=[],onBack:n,backLabel:s,title:a,meta:r,amountLabel:i,amount:o,amountCaption:l,recordId:d,chips:u,statItems:f,stats:m,banner:p,"data-testid":x="record-header"})=>{const{ref:g,width:y}=Lt(),b=!Xt(y,Lh),v=e.length>0||!!n,w=!!(f&&f.length>0),$=!!i||re(o)||re(l)||re(d)||re(u)||w;return t.jsxs("div",{ref:g,"data-testid":x,"data-size":b?"narrow":"wide",className:ae.base,children:[v&&t.jsxs("div",{"data-testid":`${x}-band`,className:ae.band,children:[n&&t.jsx("button",{type:"button",onClick:n,"aria-label":s,"data-testid":`${x}-back`,className:ae.back,children:t.jsx(P,{icon:"lucide:chevron-left",className:ae.backIcon,"aria-hidden":"true"})}),t.jsx(c.Breadcrumbs,{separator:"/","data-testid":`${x}-breadcrumb`,classNames:{base:ae.breadcrumb,list:ae.breadcrumbList},itemClasses:{base:ae.crumbBase,item:ae.crumb,separator:ae.crumbSeparator},children:e.map((N,A)=>t.jsx(c.BreadcrumbItem,{as:_o,"data-testid":`${x}-crumb-${A}`,isDisabled:!N.onClick&&A<e.length-1,onPress:N.onClick?()=>N.onClick?.():void 0,children:N.label},A))})]}),t.jsxs("div",{className:c.cn(ae.body,b?ae.bodyNarrow:ae.bodyWide),children:[t.jsxs("div",{className:ae.identity,children:[t.jsx("h1",{"data-testid":`${x}-title`,className:c.cn(ae.title,b?ae.titleNarrow:ae.titleWide),children:a}),r&&r.length>0&&t.jsx("ul",{"data-testid":`${x}-meta`,className:ae.meta,children:r.map((N,A)=>t.jsxs("li",{className:ae.metaLine,children:[N.icon!=null&&t.jsx("span",{"aria-hidden":"true",className:ae.metaIcon,children:N.icon}),t.jsx("span",{className:ae.metaText,children:N.text})]},A))})]}),$&&t.jsxs("div",{"data-testid":`${x}-money`,className:c.cn(ae.money,b?ae.moneyNarrow:ae.moneyWide),children:[i&&t.jsx("div",{className:ae.amountLabel,children:i}),re(o)&&t.jsx("div",{"data-testid":`${x}-amount`,className:c.cn(ae.amount,b?ae.amountNarrow:ae.amountWide),children:o}),re(l)&&t.jsx("div",{className:ae.amountCaption,children:l}),re(d)&&t.jsx("div",{"data-testid":`${x}-record-id`,className:ae.recordId,children:d}),re(u)&&t.jsx("div",{"data-testid":`${x}-chips`,className:c.cn(ae.chips,b?ae.chipsNarrow:ae.chipsWide),children:u}),w&&t.jsx("dl",{"data-testid":`${x}-stat-items`,className:ae.statItems,children:f?.map((N,A)=>t.jsxs("div",{"data-testid":`${x}-stat-${A}`,className:c.cn(ae.stat,b?ae.statNarrow:ae.statWide),children:[t.jsx("dt",{"data-testid":`${x}-stat-${A}-label`,className:ae.statLabel,children:N.label}),t.jsx("dd",{"data-testid":`${x}-stat-${A}-value`,className:ae.statValue,style:N.tone?{color:He[N.tone].fg}:void 0,children:N.value})]},N.id??A))})]})]}),re(m)&&t.jsx("div",{"data-testid":`${x}-stats`,className:b?ae.statsNarrow:ae.statsWide,children:m}),re(p)&&t.jsx("div",{"data-testid":`${x}-banner`,children:p})]})};Mo.displayName="RecordHeader";const Fh=50,zt={base:"grid items-start gap-4",split:"grid-cols-[minmax(0,1fr)_23.25rem]",stacked:"grid-cols-[minmax(0,1fr)]",column:"min-w-0",aside:"flex min-w-0 flex-col gap-[0.875rem]"},Po=({children:e,aside:n,"data-testid":s="record-layout"})=>{const{ref:a,width:r}=Lt(),i=re(n),o=i&&r>0&&Xt(r,Fh),l=t.jsx("div",{"data-testid":`${s}-main`,className:zt.column,children:e},"main"),d=i?t.jsx("div",{"data-testid":`${s}-aside`,className:zt.aside,children:n},"aside"):null;return t.jsx("div",{ref:a,"data-testid":s,"data-layout":o?"split":"stacked",className:c.cn(zt.base,o?zt.split:zt.stacked),children:o?[l,d]:[d,l]})};Po.displayName="RecordLayout";const Rh=560,Bt={base:"grid gap-3",tile:"min-w-0 rounded-[14px] border border-pos-line bg-white px-[18px] py-4 shadow-[0_1px_4px_rgba(0,0,0,.06),0_4px_12px_rgba(0,0,0,.06)]",value:"text-[23px] font-bold leading-[1.2] tracking-[-.02em] tabular-nums text-default-900 [overflow-wrap:anywhere]",label:"mt-[5px] text-[13.5px] text-default-500",caption:"mt-0.5 text-[12.5px] text-default-500"},To=({items:e,"data-testid":n="stat-tiles"})=>{const{ref:s,width:a}=Lt(),r=a>=sx?Math.max(e.length,1):a>=Rh?2:1;return t.jsx("div",{ref:s,"data-testid":n,"data-columns":r,className:Bt.base,style:{gridTemplateColumns:`repeat(${r}, minmax(0, 1fr))`},children:e.map((i,o)=>t.jsxs("div",{"data-testid":`${n}-item-${o}`,className:Bt.tile,children:[t.jsx("div",{"data-testid":`${n}-item-${o}-value`,className:Bt.value,style:i.tone?{color:He[i.tone].fg}:void 0,children:i.value}),t.jsx("div",{"data-testid":`${n}-item-${o}-label`,className:Bt.label,children:i.label}),re(i.caption)&&t.jsx("div",{"data-testid":`${n}-item-${o}-caption`,className:Bt.caption,children:i.caption})]},o))})};To.displayName="StatTiles";const rt={base:"mb-3.5 w-full",tabList:"w-full gap-1 rounded-full border border-pos-line bg-default-100 p-1",cursor:"rounded-full bg-white shadow-[0_1px_3px_rgba(0,0,0,.10)]",tab:"h-auto flex-1 data-[hover-unselected=true]:opacity-100",tabStill:"rounded-full data-[selected=true]:bg-white data-[selected=true]:shadow-[0_1px_3px_rgba(0,0,0,.10)]",tabContent:"leading-[1.5] font-normal text-default-600 group-data-[selected=true]:font-semibold group-data-[selected=true]:text-default-900",title:"flex items-center whitespace-nowrap",icon:"flex shrink-0",count:"rounded-full bg-default-200 py-px leading-[1.5] font-semibold text-default-600 group-data-[selected=true]:bg-acct-rust-fill group-data-[selected=true]:text-primary-600"},_h={md:{tab:"px-[0.875rem] py-[0.5625rem]",tabContent:"text-[0.84375rem]",title:"gap-[0.4375rem]",icon:"[&_svg]:size-4",count:"px-[0.4375rem] text-[0.71875rem]"},lg:{tab:"px-4 py-3",tabContent:"text-base",title:"gap-2",icon:"[&_svg]:size-5",count:"px-2 text-[0.8125rem]"}},oa="pill-tabs",ca=(e,n=oa)=>`${n}-tab-${e}`,da=(e,n=oa)=>`${n}-panel-${e}`,Mh=(e,n=oa)=>({role:"tabpanel",id:da(e,n),"aria-labelledby":ca(e,n),tabIndex:0}),Io=({items:e,value:n,onChange:s,ariaLabel:a,idPrefix:r,size:i="md","data-testid":o="pill-tabs"})=>{const l=Cn(),d=!!c.useProviderContext()?.disableAnimation,u=r??o,f=_h[i];return t.jsx(c.Tabs,{"aria-label":a,variant:"solid",radius:"full",fullWidth:!0,disableAnimation:l||void 0,selectedKey:n,onSelectionChange:m=>s(String(m)),"data-testid":o,"data-size":i,classNames:{base:rt.base,tabList:rt.tabList,cursor:rt.cursor,tab:c.cn(rt.tab,f.tab,(l||d)&&rt.tabStill),tabContent:c.cn(f.tabContent,rt.tabContent)},children:e.map(m=>{const p=m["data-testid"]??`${o}-${m.key}`;return t.jsx(c.Tab,{id:ca(m.key,u),"aria-controls":da(m.key,u),"data-testid":p,title:t.jsxs("span",{className:c.cn(rt.title,f.title),children:[re(m.icon)&&t.jsx("span",{"aria-hidden":"true","data-testid":`${p}-icon`,className:c.cn(rt.icon,f.icon),children:m.icon}),m.label,m.count!==void 0&&t.jsx("span",{"data-testid":`${p}-count`,className:c.cn(f.count,rt.count),children:m.count})]})},m.key)})})};Io.displayName="PillTabs";const ye={base:"w-full",list:"m-0 list-none p-0",item:"border-t border-pos-hair",row:"flex w-full items-start gap-3 px-5 py-3 text-left",rowInteractive:`cursor-pointer outline-none transition-colors hover:bg-default-50 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-[-2px] focus-visible:outline-primary ${ke}`,dot:"mt-[0.4375rem] size-[0.4375rem] shrink-0 rounded-full",body:"flex min-w-0 flex-1 flex-col",title:"text-[0.875rem] font-semibold text-default-900 [overflow-wrap:anywhere] [text-wrap:pretty]",meta:"mt-1 flex min-w-0 flex-wrap items-center gap-[0.4375rem] text-[0.78125rem] text-default-500",reference:"min-w-0 font-normal text-primary [overflow-wrap:anywhere]",separator:"text-default-400",timestamp:"tabular-nums",detail:"mt-[0.1875rem] text-[0.78125rem] text-default-500 [overflow-wrap:anywhere] [text-wrap:pretty]",trailing:"max-w-[45%] min-w-min shrink-0 text-right text-[0.90625rem]",amount:"whitespace-nowrap text-[0.90625rem] font-bold tabular-nums text-default-900",note:"text-[0.78125rem] italic text-default-500 [overflow-wrap:anywhere]",footer:"flex items-baseline gap-3 border-t border-pos-line bg-pos-page px-5 py-[0.8125rem]",footerLabel:"min-w-0 text-[0.875rem] font-bold text-default-900 [overflow-wrap:anywhere]",footerAmount:"ml-auto whitespace-nowrap text-[1rem] font-bold tabular-nums text-default-900",footerNote:"border-t border-pos-hair px-5 py-[0.8125rem] text-[0.78125rem] leading-[1.6] text-default-500",empty:"px-5 pb-5 pt-[0.875rem] text-[0.875rem] text-default-500"},kr=({row:e,testId:n})=>t.jsxs(t.Fragment,{children:[t.jsx("span",{"aria-hidden":"true",className:ye.dot,style:{backgroundColor:He[e.tone].fg}}),t.jsxs("span",{className:ye.body,children:[t.jsx("span",{className:ye.title,children:e.title}),(e.reference!=null||e.timestamp!=null)&&t.jsxs("span",{className:ye.meta,children:[e.reference!=null&&t.jsx("span",{className:ye.reference,children:e.reference}),e.reference!=null&&e.timestamp!=null&&t.jsx("span",{"aria-hidden":"true",className:ye.separator,children:"·"}),e.timestamp!=null&&t.jsx("span",{className:ye.timestamp,children:e.timestamp})]}),e.detail!=null&&t.jsx("span",{className:ye.detail,children:e.detail})]}),t.jsx("span",{className:ye.trailing,children:e.amount!=null?t.jsx("span",{"data-testid":`${n}-amount`,className:ye.amount,style:Jt(e.amountTone),children:e.amount}):e.note!=null?t.jsx("span",{"data-testid":`${n}-note`,className:ye.note,style:e.noteTone==="warn"?{color:He.warn.fg}:void 0,children:e.note}):null})]}),Oo=({rows:e,footer:n,emptyContent:s,onSelect:a,"data-testid":r="amount-list"})=>e.length===0?t.jsx("div",{"data-testid":r,className:ye.base,children:s!=null&&t.jsx("div",{"data-testid":`${r}-empty`,className:ye.empty,children:s})}):t.jsxs("div",{"data-testid":r,className:ye.base,children:[t.jsx("ul",{className:ye.list,children:e.map(i=>{const o=`${r}-row-${i.id}`;return t.jsx("li",{"data-testid":o,className:ye.item,children:a?t.jsx("button",{type:"button",onClick:()=>a(i.id),className:c.cn(ye.row,ye.rowInteractive),children:t.jsx(kr,{row:i,testId:o})}):t.jsx("div",{className:ye.row,children:t.jsx(kr,{row:i,testId:o})})},i.id)})}),n&&t.jsxs(t.Fragment,{children:[t.jsxs("div",{"data-testid":`${r}-footer`,className:ye.footer,children:[t.jsx("span",{className:ye.footerLabel,children:n.label}),t.jsx("span",{"data-testid":`${r}-footer-amount`,className:ye.footerAmount,style:Jt(n.amountTone),children:n.amount})]}),n.note!=null&&t.jsx("div",{"data-testid":`${r}-footer-note`,className:ye.footerNote,children:n.note})]})]});Oo.displayName="AmountList";const Be={list:"m-0 list-none p-0 pl-0.5",event:"flex gap-3.5",eventSpaced:"pb-4",rail:"flex flex-none flex-col items-center",dot:"mt-[0.3125rem] size-2.5 rounded-full",connector:"mt-1 w-[1.5px] flex-1 bg-pos-hair",body:"min-w-0 flex-1 pb-0.5",head:"flex min-w-0 flex-wrap items-baseline gap-x-3",title:"min-w-0 text-[0.90625rem] font-semibold text-default-900 [overflow-wrap:anywhere]",timestamp:"ml-auto min-w-0 max-w-full text-[0.8125rem] tabular-nums text-default-500 [overflow-wrap:anywhere]",detail:"mt-[0.1875rem] min-w-0 text-[0.84375rem] leading-[1.5] text-default-500 [overflow-wrap:anywhere]",actor:"mt-[0.1875rem] min-w-0 text-[0.78125rem] text-default-500 [overflow-wrap:anywhere]",empty:"text-[0.875rem] text-default-500"},zo=({events:e,emptyContent:n,"data-testid":s="activity-timeline"})=>e.length===0?t.jsx("div",{"data-testid":s,children:n!=null&&t.jsx("div",{"data-testid":`${s}-empty`,className:Be.empty,children:n})}):t.jsx("ol",{"data-testid":s,className:Be.list,children:e.map((a,r)=>{const i=r===e.length-1,o=`${s}-event-${a.id}`;return t.jsxs("li",{"data-testid":o,className:c.cn(Be.event,!i&&Be.eventSpaced),children:[t.jsxs("span",{"aria-hidden":"true",className:Be.rail,children:[t.jsx("span",{className:Be.dot,style:{backgroundColor:He[a.tone].fg}}),!i&&t.jsx("span",{"data-testid":`${o}-connector`,className:Be.connector})]}),t.jsxs("div",{className:Be.body,children:[t.jsxs("div",{className:Be.head,children:[t.jsx("span",{className:Be.title,children:a.title}),t.jsx("span",{className:Be.timestamp,children:a.timestamp})]}),re(a.detail)&&t.jsx("div",{className:Be.detail,children:a.detail}),re(a.actor)&&t.jsx("div",{"data-testid":`${o}-actor`,className:Be.actor,children:a.actor})]})]},a.id)})});zo.displayName="ActivityTimeline";const Ae={base:`overflow-hidden rounded-2xl border border-pos-line bg-white ${Rn}`,header:"flex flex-wrap items-center gap-2 px-5 pt-4",title:"m-0 min-w-0 text-[0.90625rem] font-semibold text-default-900 [overflow-wrap:anywhere]",count:"rounded-full bg-default-100 px-2 py-px text-[0.75rem] font-semibold text-default-600",list:"m-0 list-none p-0",item:"border-t border-pos-hair",itemFirstHeadless:"border-t-0",row:"flex w-full items-center gap-2.5 px-5 py-3 text-left",rowInteractive:`cursor-pointer outline-none transition-colors hover:bg-default-50 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-[-2px] focus-visible:outline-primary ${ke}`,rowBody:"flex min-w-0 flex-1 flex-col",rowHead:"flex min-w-0 flex-wrap items-center gap-2",primaryLinked:"min-w-0 text-[0.875rem] font-normal text-primary [overflow-wrap:anywhere]",primaryPlain:"min-w-0 text-[0.875rem] font-normal text-default-900 [overflow-wrap:anywhere]",secondary:"mt-[0.1875rem] block min-w-0 truncate text-[0.8125rem] text-default-500",amount:"max-w-[45%] shrink-0 text-right text-[0.875rem] font-semibold tabular-nums text-default-900 [overflow-wrap:anywhere]",empty:"min-w-0 px-5 pb-5 pt-[0.875rem] text-[0.875rem] text-default-500 [overflow-wrap:anywhere]",emptyHeadless:"pt-5"},Sr=({row:e,testId:n})=>t.jsxs(t.Fragment,{children:[t.jsxs("span",{className:Ae.rowBody,children:[t.jsxs("span",{className:Ae.rowHead,children:[t.jsx("span",{className:e.onSelect?Ae.primaryLinked:Ae.primaryPlain,children:e.primary}),e.chip]}),!!e.secondary&&t.jsx("span",{className:Ae.secondary,children:e.secondary})]}),!!e.amount&&t.jsx("span",{"data-testid":`${n}-amount`,className:Ae.amount,style:Jt(e.amountTone),children:e.amount})]}),Bo=({title:e,count:n,rows:s,emptyContent:a,"data-testid":r="related-record-list"})=>{const i=h.useId(),o=!!e;return t.jsxs("section",{"data-testid":r,role:o?"group":void 0,"aria-labelledby":o?i:void 0,className:Ae.base,children:[o&&t.jsxs("div",{className:Ae.header,children:[t.jsx("h3",{id:i,className:Ae.title,children:e}),n!==void 0&&t.jsx("span",{"data-testid":`${r}-count`,className:Ae.count,children:n})]}),s.length===0?!!a&&t.jsx("div",{"data-testid":`${r}-empty`,className:c.cn(Ae.empty,!o&&Ae.emptyHeadless),children:a}):t.jsx("ul",{className:Ae.list,children:s.map((l,d)=>{const u=`${r}-row-${l.id}`;return t.jsx("li",{"data-testid":u,className:c.cn(Ae.item,d===0&&!o&&Ae.itemFirstHeadless),children:l.onSelect?t.jsx("button",{type:"button",onClick:l.onSelect,className:c.cn(Ae.row,Ae.rowInteractive),children:t.jsx(Sr,{row:l,testId:u})}):t.jsx("div",{className:Ae.row,children:t.jsx(Sr,{row:l,testId:u})})},l.id)})})]})};Bo.displayName="RelatedRecordList";const Vo=({title:e,titleAs:n="h2",icon:s,count:a,badge:r,action:i,description:o,footer:l,variant:d="section",body:u="padded",surface:f="card",className:m,children:p,"data-testid":x="record-card"})=>{const g=h.useId(),y=re(e);return t.jsxs("section",{"data-testid":x,"data-variant":d,"data-surface":f,role:y?"group":void 0,"aria-labelledby":y?g:void 0,className:c.cn(at.base,Ax[f],m),children:[y&&t.jsxs("div",{"data-testid":`${x}-header`,className:Ex[d],children:[re(s)&&t.jsx("span",{"aria-hidden":"true",className:at.icon,children:s}),t.jsx(n,{id:g,className:at.title,children:e}),re(a)&&t.jsx("span",{"data-testid":`${x}-count`,className:at.count,children:a}),r,re(i)&&t.jsx("span",{"data-testid":`${x}-action`,className:at.action,children:i})]}),t.jsxs("div",{"data-testid":`${x}-body`,className:Dx[d][u],children:[re(o)&&t.jsx("p",{"data-testid":`${x}-description`,className:at.description,children:o}),p,re(l)&&t.jsx("div",{"data-testid":`${x}-footer`,className:c.cn(at.footer,re(p)?at.footerAfterContent:at.footerAfterDescription),children:l})]})]})};Vo.displayName="RecordCard";const Ph={stack:"flex min-w-0 flex-col gap-[0.875rem]",grid:"grid min-w-0 grid-cols-[repeat(auto-fit,minmax(min(100%,18.75rem),1fr))] items-start gap-[0.875rem]"},Uo=({layout:e="stack",className:n,children:s,"data-testid":a="card-stack",...r})=>t.jsx("div",{...r,"data-testid":a,"data-layout":e,className:c.cn(Ph[e],n),children:s});Uo.displayName="CardStack";const ln={list:"m-0 divide-y divide-pos-hair",row:"flex items-baseline gap-3",label:"min-w-0 text-[0.84375rem] text-default-500",value:"m-0 ml-auto flex min-w-0 flex-wrap justify-end gap-[0.3125rem] text-right text-[0.875rem] text-default-900 [overflow-wrap:anywhere]"},Th={regular:"py-[0.5625rem]",compact:"py-2"},Ho=({rows:e,density:n="regular","data-testid":s="key-value-rows"})=>t.jsx("dl",{"data-testid":s,className:ln.list,children:e.map((a,r)=>t.jsxs("div",{"data-testid":`${s}-row-${a.id??r}`,className:c.cn(ln.row,Th[n]),children:[t.jsx("dt",{className:ln.label,children:a.label}),t.jsx("dd",{className:ln.value,children:a.value})]},a.id??r))});Ho.displayName="KeyValueRows";const Ye={list:"m-0 list-none p-0",row:"flex items-start gap-[0.875rem] border-t border-pos-hair px-5 py-3",body:"min-w-0 flex-1",name:"text-[0.90625rem] font-semibold text-default-900 [overflow-wrap:anywhere] [text-wrap:pretty]",details:"mt-[0.3125rem] flex flex-wrap items-center gap-[0.4375rem] text-[0.8125rem] text-default-500",separator:"text-default-400",detail:"tabular-nums",trailing:"flex shrink-0 flex-col items-end gap-1.5 text-right",amounts:"inline-flex items-baseline gap-2",original:"text-[0.8125rem] tabular-nums text-default-500 line-through",amount:"whitespace-nowrap text-[0.9375rem] font-bold tabular-nums text-default-900"},Wo=({items:e,ariaLabel:n,originalAmountLabel:s,"data-testid":a="line-item-rows"})=>t.jsx("ul",{"aria-label":n,"data-testid":a,className:Ye.list,children:e.map(r=>{const i=`${a}-item-${r.id}`,o=re(r.originalAmount);return t.jsxs("li",{"data-testid":i,className:Ye.row,style:r.tone?{backgroundColor:He[r.tone].bg}:void 0,children:[t.jsxs("div",{className:Ye.body,children:[t.jsx("div",{className:Ye.name,children:r.name}),r.details&&r.details.length>0&&t.jsx("div",{"data-testid":`${i}-details`,className:Ye.details,children:r.details.map((l,d)=>t.jsxs(h.Fragment,{children:[d>0&&t.jsx("span",{"aria-hidden":"true",className:Ye.separator,children:"·"}),t.jsx("span",{className:Ye.detail,children:l})]},d))})]}),t.jsxs("div",{className:Ye.trailing,children:[t.jsxs("span",{className:Ye.amounts,children:[o&&t.jsxs("s",{"data-testid":`${i}-original`,className:Ye.original,children:[s&&t.jsxs("span",{className:"sr-only",children:[s," "]}),r.originalAmount]}),t.jsx("span",{"data-testid":`${i}-amount`,className:Ye.amount,style:o?{color:He.ok.fg}:void 0,children:r.amount})]}),r.chip]})]},r.id)})});Wo.displayName="LineItemRows";const Ih=37.5,De={base:"mx-5 border-t border-pos-hair pb-[1.125rem] pt-2.5",rowWide:"flex items-baseline gap-4",rowNarrow:"flex flex-wrap items-baseline gap-x-3",labelWide:"shrink-0 grow-0 basis-[11.875rem]",labelNarrow:"flex-auto",noteWide:"min-w-0 flex-1",noteNarrow:"order-3 mt-px basis-full",row:"py-2",label:"text-[0.875rem] text-default-900",note:"text-[0.8125rem] text-default-500",value:"ml-auto shrink-0 whitespace-nowrap text-right text-[0.875rem] tabular-nums text-default-900",totalRule:"mt-1.5 border-t border-pos-line",totalRow:"pt-3",totalLabel:"text-[0.9375rem] font-bold text-default-900",totalValue:"ml-auto shrink-0 whitespace-nowrap text-right text-[1.0625rem] font-bold tabular-nums text-default-900",memo:"mt-2 text-[0.78125rem] leading-[1.6] text-default-500"},qo=({rows:e,total:n,memo:s,"data-testid":a="record-totals"})=>{const{ref:r,width:i}=Lt(),o=i>0&&!Xt(i,Ih),l=o?De.rowNarrow:De.rowWide,d=o?De.labelNarrow:De.labelWide,u=o?De.noteNarrow:De.noteWide;return t.jsxs("div",{ref:r,"data-testid":a,"data-size":o?"narrow":"wide",className:De.base,children:[e.map(f=>{const m=`${a}-row-${f.id}`;return t.jsxs("div",{"data-testid":m,className:c.cn(l,De.row),children:[t.jsx("span",{"data-testid":`${m}-label`,className:c.cn(d,De.label),children:f.label}),t.jsx("span",{"data-testid":`${m}-note`,className:c.cn(u,De.note),children:f.note}),t.jsx("span",{"data-testid":`${m}-value`,className:De.value,style:Jt(f.tone),children:f.value})]},f.id)}),t.jsx("div",{className:De.totalRule,children:t.jsxs("div",{"data-testid":`${a}-total`,className:c.cn(l,De.totalRow),children:[t.jsx("span",{className:c.cn(d,De.totalLabel),children:n.label}),t.jsx("span",{"data-testid":`${a}-total-value`,className:De.totalValue,children:n.value})]})}),re(s)&&t.jsx("div",{"data-testid":`${a}-memo`,className:De.memo,children:s})]})};qo.displayName="RecordTotals";const ws={base:"whitespace-nowrap text-[0.875rem]",secondary:"text-default-500",chipStack:"inline-flex flex-col items-start gap-[0.3125rem]"},Oh={text:"text-default-900",reference:"font-normal text-primary",amount:"font-semibold tabular-nums text-default-900"},Go=({variant:e="text",tone:n,secondary:s,children:a,"data-testid":r="cell-text"})=>t.jsxs("span",{"data-testid":r,className:c.cn(ws.base,Oh[e]),style:Jt(n),children:[a,re(s)&&t.jsxs("span",{"data-testid":`${r}-secondary`,className:ws.secondary,children:[t.jsx("span",{"aria-hidden":"true",children:" · "}),s]})]});Go.displayName="CellText";const Ko=({children:e,"data-testid":n="chip-stack"})=>t.jsx("span",{"data-testid":n,className:ws.chipStack,children:e});Ko.displayName="ChipStack";function Yo({testId:e,title:n,description:s}){return t.jsx(c.Card,{shadow:"sm",className:"min-h-52 rounded-2xl shadow-none","data-testid":e,children:t.jsxs(c.CardBody,{className:"flex flex-col gap-2 p-4 text-sm",role:"alert",children:[t.jsx("span",{className:"font-semibold text-gray-900",children:n}),t.jsx("p",{className:"text-default-600 leading-snug",children:s})]})})}Yo.displayName="SessionExpiredCard";exports.ActivityTimeline=zo;exports.AdminFieldLabel=kl;exports.AdminTable=pl;exports.AdminTextField=Sl;exports.AdminToolbar=bl;exports.AmountList=Oo;exports.AppliedCodeCard=qr;exports.Button=O;exports.CardList=Ro;exports.CardStack=Uo;exports.CashTenderForm=Ix;exports.CatalogItemCard=Xi;exports.CellText=Go;exports.CheckTenderForm=Bl;exports.ChipStack=Ko;exports.CommitmentDetails=Vm;exports.ConfirmDialog=ea;exports.ConfirmationModal=Hs;exports.ConfirmationPageTemplate=uu;exports.CustomerCard=bo;exports.DatePicker=Rs;exports.DensityProvider=Fc;exports.DimensionChip=Fn;exports.DiscardGuard=Jl;exports.DonationAmounts=Ni;exports.Drawer=pi;exports.EmptyState=Ws;exports.EntityList=Rl;exports.EntityListSkeleton=_l;exports.EntityRow=Fl;exports.ErrorState=qs;exports.EventDetails=Ku;exports.EventDetailsTemplate=fu;exports.ExpireCartTimer=Ci;exports.FeedbackState=Zt;exports.FilterPopover=al;exports.FilterSelect=Do;exports.FilterSelectGroup=Lo;exports.Footer=hu;exports.HeroUIProvider=$c;exports.HorizontalSteps=gi;exports.InlineConfirm=Zl;exports.InstallmentFundAssignment=Tm;exports.InstallmentFundAssignmentSkeleton=zm;exports.InstallmentSchedule=of;exports.InstallmentScheduleSkeleton=hf;exports.InstallmentTable=vf;exports.ItemCard=Zi;exports.KeyValueChip=Fn;exports.KeyValueRows=Ho;exports.LineItemList=mo;exports.LineItemRows=Wo;exports.ListPanel=Tl;exports.LoadMoreFooter=Fo;exports.LoadingOverlay=Yl;exports.LoadingState=Gs;exports.MembershipSelectCards=kf;exports.MetaCard=Gp;exports.Modal=Yt;exports.ModalPanelHeader=eo;exports.ModalPanels=vp;exports.ModalShell=Hl;exports.ModalShellFooter=ql;exports.ModalShellHeader=Wl;exports.Multiselect=bu;exports.Navbar=du;exports.NotesField=yo;exports.Notice=ia;exports.OfferCard=hn;exports.OfferCardEmpty=ki;exports.OfferCardError=Si;exports.OfferCardList=Di;exports.OfferCardSkeleton=$i;exports.OtherTenderForm=Vl;exports.OutcomeView=Eo;exports.PageHeader=ll;exports.PaginationSummary=Pl;exports.PaymentCashChangeBanner=Xs;exports.PaymentSubAmountInput=Js;exports.PaymentSuccessView=Ql;exports.PaymentTotalBanner=Kl;exports.PickerRow=Al;exports.PillTabs=Io;exports.PinField=Ao;exports.ProgramListItem=Ji;exports.RICH_TEXT_PRESETS=ji;exports.ReasonSelect=go;exports.RecordCard=Vo;exports.RecordHeader=Mo;exports.RecordLayout=Po;exports.RecordTotals=qo;exports.RedeemCodeInput=iu;exports.RefundMethodCards=ko;exports.RefundProgressList=$o;exports.RelatedRecordList=Bo;exports.RevenueDistributionCard=Vi;exports.RevenueDistributionEmpty=Ui;exports.RevenueDistributionError=Hi;exports.RevenueDistributionSkeleton=Wi;exports.RichTextArea=wi;exports.RowActions=$l;exports.SectionPanel=ho;exports.Select=Xe;exports.SessionExpiredCard=Yo;exports.SessionTimeline=rl;exports.SplitPaymentSummary=Ul;exports.SplitTenderPanel=jo;exports.StatTiles=To;exports.StatusChip=ol;exports.StepProgress=ra;exports.Stepper=bi;exports.SuccessState=tl;exports.Summary=co;exports.Table=_s;exports.TableSkeleton=cl;exports.TenderMethods=vo;exports.TicketSelection=Yf;exports.TileSelect=Gl;exports.ToastProvider=Dc;exports.Toggle=nl;exports.ToolbarButton=gl;exports.UnderlineTabs=yl;exports.WizardShell=uo;exports.adminFieldErrorClass=Cl;exports.adminFieldHintClass=Nl;exports.adminFieldLabelClass=Ys;exports.adminFieldLabelSuffixClass=Qs;exports.adminInputClass=jl;exports.adminInputReadOnlyClass=wl;exports.adminInputWrapperClass=vl;exports.adminRowClass=ml;exports.adminSurfaceCss=Sc;exports.adminSurfaceTokens=Cs;exports.adminTableClass=fl;exports.adminTableFooterClass=xl;exports.adminTdClass=ul;exports.adminThClass=dl;exports.calculateAllocationDifference=Sm;exports.computeChange=ms;exports.currencyFractionDigits=Dt;exports.formatMoney=fe;exports.formatOfferCurrency=xs;exports.formatRevenueAmount=wm;exports.formatRevenueCurrency=Nm;exports.generateAutomaticInstallments=Ki;exports.generateDistributionId=Us;exports.getCurrencySymbol=Cm;exports.offerCardVariants=Ei;exports.offerListVariants=Ai;exports.pageRange=Ml;exports.parseOfferCurrency=Yu;exports.parseRevenueCurrency=km;exports.pillTabId=ca;exports.pillTabPanelId=da;exports.pillTabPanelProps=Mh;exports.posSurfaceTokens=le;exports.roundToCurrency=Ms;exports.useControlSize=Lc;exports.useDensity=kn;exports.useDiscardGuard=Np;exports.useDiscardGuardActions=op;exports.useModalPanel=dp;exports.useModalPanels=wp;exports.useReportUnsavedChanges=lp;Object.keys(c).forEach(e=>{e!=="default"&&!Object.prototype.hasOwnProperty.call(exports,e)&&Object.defineProperty(exports,e,{enumerable:!0,get:()=>c[e]})});
42
42
  (function(){"use strict";try{if(typeof document<"u"){var r=document.createElement("style");r.appendChild(document.createTextNode('.ProseMirror{flex:1;width:100%;min-height:100%;height:100%;cursor:text;background-color:#fff;padding:1rem;overflow-y:auto;box-sizing:border-box}.ProseMirror p{min-height:1.5em}.dark .ProseMirror{background-color:rgb(var(--nextui-background))}.ProseMirror ul{list-style-type:disc!important;list-style-position:outside!important;padding-left:2rem!important;margin:1rem 0!important;display:block!important}.ProseMirror ol{list-style-type:decimal!important;list-style-position:outside!important;padding-left:2rem!important;margin:1rem 0!important;display:block!important}.ProseMirror ul li,.ProseMirror ol li{display:list-item!important;list-style:inherit!important;margin:.25rem 0!important}.ProseMirror ul li p,.ProseMirror ol li p{margin:0!important;display:inline!important}.ProseMirror ul[data-type=taskList]{list-style:none!important;padding-left:0!important;margin:1rem 0!important}.ProseMirror ul[data-type=taskList] li{display:flex!important;align-items:flex-start!important;margin:.5rem 0!important}.ProseMirror ul[data-type=taskList] li label{margin-right:.5rem;-webkit-user-select:none;-moz-user-select:none;user-select:none}.ProseMirror ul[data-type=taskList] li input[type=checkbox]{cursor:pointer;margin-top:.25rem}.ProseMirror h1,.ProseMirror h2,.ProseMirror h3,.ProseMirror h4,.ProseMirror h5,.ProseMirror h6{line-height:1.2!important;margin:1rem 0 .5rem!important;font-weight:600!important}.ProseMirror h1{font-size:2rem!important}.ProseMirror h2{font-size:1.5rem!important}.ProseMirror h3{font-size:1.25rem!important}.ProseMirror h4{font-size:1.1rem!important}.ProseMirror h5{font-size:1rem!important;font-weight:600!important}.ProseMirror h6{font-size:.9rem!important;font-weight:600!important}.ProseMirror code{background-color:rgb(var(--nextui-default-100));border-radius:.4rem;color:rgb(var(--nextui-default-800));font-size:.85rem;padding:.25em .3em}.ProseMirror pre{background:rgb(var(--nextui-default-900));border-radius:.5rem;color:rgb(var(--nextui-default-50));font-family:JetBrainsMono,monospace;margin:1.5rem 0;padding:.75rem 1rem;overflow-x:auto}.ProseMirror pre code{background:none;color:inherit;font-size:.8rem;padding:0}.ProseMirror mark{background-color:#faf594;border-radius:.4rem;-webkit-box-decoration-break:clone;box-decoration-break:clone;padding:.1rem .3rem}.ProseMirror blockquote{border-left:3px solid rgb(var(--nextui-default-300));margin:1.5rem 0;padding-left:1rem;color:rgb(var(--nextui-default-600))}.ProseMirror hr{border:none;border-top:1px solid rgb(var(--nextui-divider));margin:2rem 0}.ProseMirror a{color:rgb(var(--nextui-primary));text-decoration:underline;cursor:pointer}.ProseMirror a:hover{text-decoration:underline}.ProseMirror strong{font-weight:700!important}.ProseMirror em{font-style:italic!important}.ProseMirror s{text-decoration:line-through!important}.ProseMirror u{text-decoration:underline!important}.ProseMirror .has-text-align-left,.ProseMirror [style*="text-align: left"]{text-align:left!important}.ProseMirror .has-text-align-center,.ProseMirror [style*="text-align: center"]{text-align:center!important}.ProseMirror .has-text-align-right,.ProseMirror [style*="text-align: right"]{text-align:right!important}.ProseMirror .has-text-align-justify,.ProseMirror [style*="text-align: justify"]{text-align:justify!important}.ProseMirror ul li[style*="text-align: left"],.ProseMirror ol li[style*="text-align: left"]{text-align:left!important;list-style-position:inside!important}.ProseMirror ul li[style*="text-align: center"],.ProseMirror ol li[style*="text-align: center"]{text-align:center!important;list-style-position:inside!important}.ProseMirror ul li[style*="text-align: right"],.ProseMirror ol li[style*="text-align: right"]{text-align:right!important;list-style-position:inside!important}.ProseMirror ul li[style*="text-align: justify"],.ProseMirror ol li[style*="text-align: justify"]{text-align:justify!important;list-style-position:inside!important}.ProseMirror ul[data-type=taskList] li[style*="text-align: left"]{justify-content:flex-start!important}.ProseMirror ul[data-type=taskList] li[style*="text-align: center"]{justify-content:center!important}.ProseMirror ul[data-type=taskList] li[style*="text-align: right"]{justify-content:flex-end!important}.ProseMirror p.is-editor-empty:first-child:before{color:rgb(var(--nextui-default-400));content:attr(data-placeholder);float:left;height:0;pointer-events:none}')),document.head.appendChild(r)}}catch(t){console.error("vite-plugin-css-injected-by-js",t)}})();