@veevarts/design-system 2.0.0-alpha.57 → 2.0.0-alpha.58
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/components/DatePicker/DatePicker.d.ts +9 -2
- package/dist/components/DatePicker/defaults.d.ts +28 -0
- package/dist/components/DatePicker/index.d.ts +1 -0
- package/dist/components/index.d.ts +1 -1
- package/dist/index.cjs +6 -6
- package/dist/index.js +4475 -4301
- package/dist/patterns/TimeField/TimeField.d.ts +6 -0
- package/dist/patterns/TimeField/index.d.ts +3 -0
- package/dist/patterns/TimeField/time.d.ts +40 -0
- package/dist/patterns/TimeField/types.d.ts +77 -0
- package/dist/patterns/index.d.ts +2 -0
- package/package.json +1 -1
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"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),c=require("@heroui/react"),h=require("react"),te=require("lucide-react"),We=require("framer-motion"),Bn=require("@tiptap/react"),Pa=require("@tiptap/core"),Rc=require("@tiptap/extension-bold"),Mc=require("@tiptap/extension-italic"),Pc=require("@tiptap/extension-strike"),Tc=require("@tiptap/extension-underline"),Ic=require("@tiptap/extension-code"),Oc=require("@tiptap/extension-color"),Bc=require("@tiptap/extension-highlight"),zc=require("@tiptap/extension-link"),Vc=require("@tiptap/extension-text-style"),Uc=require("@tiptap/extension-heading"),Hc=require("@tiptap/extension-paragraph"),Wc=require("@tiptap/extension-bullet-list"),qc=require("@tiptap/extension-ordered-list"),Gc=require("@tiptap/extension-task-list"),Kc=require("@tiptap/extension-task-item"),Yc=require("@tiptap/extension-list-item"),Qc=require("@tiptap/extension-code-block"),Zc=require("@tiptap/extension-blockquote"),Xc=require("@tiptap/extension-horizontal-rule"),Jc=require("@tiptap/extension-hard-break"),Ta=require("@tiptap/extension-history"),ed=require("@tiptap/extension-text-align"),td=require("@tiptap/extension-document"),sd=require("@tiptap/extension-text"),nd=require("@tiptap/extension-dropcursor"),ad=require("@tiptap/extension-gapcursor"),Te={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:{50:"#fffbeb",100:"#fef3c7",200:"#fde68a",700:"#b45309"}}},be={xs:"0.25rem",sm:"0.5rem",md:"1rem",lg:"1.5rem",xl:"2rem"},we={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:fs}=Te.neutral,rd=Te.palettes.warning[700],id=Te.palettes.warning[100],xt={rustFill:"#FBEBE4",rustBorder:"#EBC3B1",page:"#F6F7F8",border:"#E7E9EC",hair:"#EEF0F2",okFill:"#E6F4EF",dangerFill:"#FBEAE8",infoFill:"#E8EEFC"},ls={"--rust":Te.brand.primary[500],"--rust-fill":xt.rustFill,"--rust-border":xt.rustBorder,"--page":xt.page,"--surface":Te.neutral.white,"--border":xt.border,"--hair":xt.hair,"--ink":fs[900],"--ink2":fs[700],"--sub":fs[500],"--muted":fs[400],"--ok":Te.semantic.success,"--ok-fill":xt.okFill,"--warn":rd,"--warn-fill":id,"--danger":Te.semantic.danger,"--danger-fill":xt.dangerFill,"--info":Te.semantic.info,"--info-fill":xt.infoFill};Object.fromEntries(Object.entries(ls).map(([e,s])=>[e.replace(/^--/,""),s]));function ld({scope:e=".acct",fontFamily:s="'NeueMontreal', system-ui, sans-serif"}={}){const n=Object.entries(ls).map(([r,i])=>` ${r}: ${i};`).join(`
|
|
2
2
|
`),a=s?`
|
|
3
3
|
font-family: ${s};
|
|
4
4
|
color: var(--ink);`:"";return`${e} {
|
|
5
5
|
${n}${a}
|
|
6
6
|
}
|
|
7
|
-
`}const oe={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:_e.semantic.danger,"danger-icon":"#F3D3CF","info-fill":"#EAF1FC",info:"#1D4FA8","violet-fill":"#F1ECFB",violet:"#6D28D9","neutral-fill":"#F4F4F5",neutral:"#52525B",destructive:"#A32D2D"};({...oe});const qr=h.createContext(void 0);function Gr(){return h.useContext(qr)}function Xc({children:e,closeLabel:s,locale:n,reducedMotion:a="user"}){const r=Gr();return t.jsx(c.HeroUIProvider,{locale:n,reducedMotion:a,children:t.jsx(qr.Provider,{value:s??r,children:e})})}const Kr="(prefers-reduced-motion: reduce)",Yr="data-pos-reduce-motion",Ne="motion-reduce:transition-none [html[data-pos-reduce-motion=true]_&]:transition-none",Pn="motion-reduce:animate-none [html[data-pos-reduce-motion=true]_&]:animate-none",ys=`rounded-[0.375rem] bg-[linear-gradient(90deg,#F0F0F1_0,#F9F9FA_12.5rem,#F0F0F1_25rem)] bg-[length:50rem_100%] animate-record-shimmer ${Pn}`;function Jc(){return typeof document>"u"?!1:document.documentElement.getAttribute(Yr)==="true"?!0:typeof window.matchMedia=="function"&&window.matchMedia(Kr).matches}function Ms(){const[e,s]=h.useState(!1);return h.useEffect(()=>{const n=()=>s(Jc()),a=typeof window.matchMedia=="function"?window.matchMedia(Kr):null;a?.addEventListener?.("change",n);const r=typeof MutationObserver>"u"?null:new MutationObserver(n);return r?.observe(document.documentElement,{attributes:!0,attributeFilter:[Yr]}),n(),()=>{a?.removeEventListener?.("change",n),r?.disconnect()}},[]),e}const ed="whitespace-normal overflow-visible text-clip break-words",Ot={base:"gap-x-2 sm:w-auto sm:min-w-[356px] sm:max-w-[min(32rem,calc(100vw_-_11rem))]",closeButton:"relative inset-auto self-start shrink-0 -my-3 -me-3 h-11 w-11 min-w-11 opacity-100",closeIcon:"h-6 w-6",title:`${ed} me-0`,description:"me-0"};function td(e){return{...e,base:c.cn(Ot.base,e?.base),closeButton:c.cn(Ot.closeButton,e?.closeButton),closeIcon:c.cn(Ot.closeIcon,e?.closeIcon),title:c.cn(Ot.title,e?.title),description:c.cn(Ot.description,e?.description)}}function sd({toastProps:e,disableAnimation:s,...n}){const a=Ms();return t.jsx(c.ToastProvider,{...n,disableAnimation:s??(a||void 0),toastProps:{...e,classNames:td(e?.classNames)}})}const Qr=h.createContext("default");function Ps(){return h.useContext(Qr)}function nd(e){return Ps()==="touch"?"lg":e}function ad({density:e,children:s}){return t.jsx(Qr.Provider,{value:e,children:s})}function rd(e,s){const n=e.icons,a=e.aliases||Object.create(null),r=Object.create(null);function i(o){if(n[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(n).concat(Object.keys(a)).forEach(i),r}const Zr=Object.freeze({left:0,top:0,width:16,height:16}),ks=Object.freeze({rotate:0,vFlip:!1,hFlip:!1}),Tn=Object.freeze({...Zr,...ks}),gn=Object.freeze({...Tn,body:"",hidden:!1});function id(e,s){const n={};!e.hFlip!=!s.hFlip&&(n.hFlip=!0),!e.vFlip!=!s.vFlip&&(n.vFlip=!0);const a=((e.rotate||0)+(s.rotate||0))%4;return a&&(n.rotate=a),n}function _a(e,s){const n=id(e,s);for(const a in gn)a in ks?a in e&&!(a in n)&&(n[a]=ks[a]):a in s?n[a]=s[a]:a in e&&(n[a]=e[a]);return n}function ld(e,s,n){const a=e.icons,r=e.aliases||Object.create(null);let i={};function o(l){i=_a(a[l]||r[l],i)}return o(s),n.forEach(o),_a(e,i)}function Xr(e,s){const n=[];if(typeof e!="object"||typeof e.icons!="object")return n;e.not_found instanceof Array&&e.not_found.forEach(r=>{s(r,null),n.push(r)});const a=rd(e);for(const r in a){const i=a[r];i&&(s(r,ld(e,r,i)),n.push(r))}return n}const od={provider:"",aliases:{},not_found:{},...Zr};function Ks(e,s){for(const n in s)if(n in e&&typeof e[n]!=typeof s[n])return!1;return!0}function Jr(e){if(typeof e!="object"||e===null)return null;const s=e;if(typeof s.prefix!="string"||!e.icons||typeof e.icons!="object"||!Ks(e,od))return null;const n=s.icons;for(const r in n){const i=n[r];if(!r||typeof i.body!="string"||!Ks(i,gn))return null}const a=s.aliases||Object.create(null);for(const r in a){const i=a[r],o=i.parent;if(!r||typeof o!="string"||!n[o]&&!a[o]||!Ks(i,gn))return null}return s}const Ra=Object.create(null);function cd(e,s){return{provider:e,prefix:s,icons:Object.create(null),missing:new Set}}function Mt(e,s){const n=Ra[e]||(Ra[e]=Object.create(null));return n[s]||(n[s]=cd(e,s))}function ei(e,s){return Jr(s)?Xr(s,(n,a)=>{a?e.icons[n]=a:e.missing.add(n)}):[]}function dd(e,s,n){try{if(typeof n.body=="string")return e.icons[s]={...n},!0}catch{}return!1}const ti=/^[a-z0-9]+(-[a-z0-9]+)*$/,Ts=(e,s,n,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 s&&!vs(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 s&&!vs(l)?null:l}if(n&&a===""){const l={provider:a,prefix:"",name:i};return s&&!vs(l,n)?null:l}return null},vs=(e,s)=>e?!!((s&&e.prefix===""||e.prefix)&&e.name):!1;let es=!1;function si(e){return typeof e=="boolean"&&(es=e),es}function Ma(e){const s=typeof e=="string"?Ts(e,!0,es):e;if(s){const n=Mt(s.provider,s.prefix),a=s.name;return n.icons[a]||(n.missing.has(a)?null:void 0)}}function ud(e,s){const n=Ts(e,!0,es);if(!n)return!1;const a=Mt(n.provider,n.prefix);return s?dd(a,n.name,s):(a.missing.add(n.name),!0)}function md(e,s){if(typeof e!="object")return!1;if(typeof s!="string"&&(s=e.provider||""),es&&!s&&!e.prefix){let r=!1;return Jr(e)&&(e.prefix="",Xr(e,(i,o)=>{ud(i,o)&&(r=!0)})),r}const n=e.prefix;if(!vs({prefix:n,name:"a"}))return!1;const a=Mt(s,n);return!!ei(a,e)}const ni=Object.freeze({width:null,height:null}),ai=Object.freeze({...ni,...ks}),fd=/(-?[0-9.]*[0-9]+[0-9.]*)/g,xd=/^-?[0-9.]*[0-9]+[0-9.]*$/g;function Pa(e,s,n){if(s===1)return e;if(n=n||100,typeof e=="number")return Math.ceil(e*s*n)/n;if(typeof e!="string")return e;const a=e.split(fd);if(a===null||!a.length)return e;const r=[];let i=a.shift(),o=xd.test(i);for(;;){if(o){const l=parseFloat(i);isNaN(l)?r.push(i):r.push(Math.ceil(l*s*n)/n)}else r.push(i);if(i=a.shift(),i===void 0)return r.join("");o=!o}}function pd(e,s="defs"){let n="";const a=e.indexOf("<"+s);for(;a>=0;){const r=e.indexOf(">",a),i=e.indexOf("</"+s);if(r===-1||i===-1)break;const o=e.indexOf(">",i);if(o===-1)break;n+=e.slice(r+1,i).trim(),e=e.slice(0,a).trim()+e.slice(o+1)}return{defs:n,content:e}}function hd(e,s){return e?"<defs>"+e+"</defs>"+s:s}function bd(e,s,n){const a=pd(e);return hd(a.defs,s+a.content+n)}const gd=e=>e==="unset"||e==="undefined"||e==="none";function yd(e,s){const n={...Tn,...e},a={...ai,...s},r={left:n.left,top:n.top,width:n.width,height:n.height};let i=n.body;[n,a].forEach(v=>{const g=[],y=v.hFlip,N=v.vFlip;let k=v.rotate;y?N?k+=2:(g.push("translate("+(r.width+r.left).toString()+" "+(0-r.top).toString()+")"),g.push("scale(-1 1)"),r.top=r.left=0):N&&(g.push("translate("+(0-r.left).toString()+" "+(r.height+r.top).toString()+")"),g.push("scale(1 -1)"),r.top=r.left=0);let w;switch(k<0&&(k-=Math.floor(k/4)*4),k=k%4,k){case 1:w=r.height/2+r.top,g.unshift("rotate(90 "+w.toString()+" "+w.toString()+")");break;case 2:g.unshift("rotate(180 "+(r.width/2+r.left).toString()+" "+(r.height/2+r.top).toString()+")");break;case 3:w=r.width/2+r.left,g.unshift("rotate(-90 "+w.toString()+" "+w.toString()+")");break}k%2===1&&(r.left!==r.top&&(w=r.left,r.left=r.top,r.top=w),r.width!==r.height&&(w=r.width,r.width=r.height,r.height=w)),g.length&&(i=bd(i,'<g transform="'+g.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=Pa(m,d/u)):(f=o==="auto"?d:o,m=l===null?Pa(f,u/d):l==="auto"?u:l);const p={},x=(v,g)=>{gd(g)||(p[v]=g.toString())};x("width",f),x("height",m);const b=[r.left,r.top,d,u];return p.viewBox=b.join(" "),{attributes:p,viewBox:b,body:i}}const vd=/\sid="(\S+)"/g,jd="IconifyId"+Date.now().toString(16)+(Math.random()*16777216|0).toString(16);let wd=0;function Nd(e,s=jd){const n=[];let a;for(;a=vd.exec(e);)n.push(a[1]);if(!n.length)return e;const r="suffix"+(Math.random()*16777216|Date.now()).toString(16);return n.forEach(i=>{const o=typeof s=="function"?s(i):s+(wd++).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 yn=Object.create(null);function Cd(e,s){yn[e]=s}function vn(e){return yn[e]||yn[""]}function In(e){let s;if(typeof e.resources=="string")s=[e.resources];else if(s=e.resources,!(s instanceof Array)||!s.length)return null;return{resources:s,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 On=Object.create(null),Bt=["https://api.simplesvg.com","https://api.unisvg.com"],js=[];for(;Bt.length>0;)Bt.length===1||Math.random()>.5?js.push(Bt.shift()):js.push(Bt.pop());On[""]=In({resources:["https://api.iconify.design"].concat(js)});function kd(e,s){const n=In(s);return n===null?!1:(On[e]=n,!0)}function Bn(e){return On[e]}const Sd=()=>{let e;try{if(e=fetch,typeof e=="function")return e}catch{}};let Ta=Sd();function $d(e,s){const n=Bn(e);if(!n)return 0;let a;if(!n.maxURL)a=0;else{let r=0;n.resources.forEach(o=>{r=Math.max(r,o.length)});const i=s+".json?icons=";a=n.maxURL-r-n.path.length-i.length}return a}function Ad(e){return e===404}const Dd=(e,s,n)=>{const a=[],r=$d(e,s),i="icons";let o={type:i,provider:e,prefix:s,icons:[]},l=0;return n.forEach((d,u)=>{l+=d.length+1,l>=r&&u>0&&(a.push(o),o={type:i,provider:e,prefix:s,icons:[]},l=d.length),o.icons.push(d)}),a.push(o),a};function Ed(e){if(typeof e=="string"){const s=Bn(e);if(s)return s.path}return"/"}const Ld=(e,s,n)=>{if(!Ta){n("abort",424);return}let a=Ed(s.provider);switch(s.type){case"icons":{const i=s.prefix,l=s.icons.join(","),d=new URLSearchParams({icons:l});a+=i+".json?"+d.toString();break}case"custom":{const i=s.uri;a+=i.slice(0,1)==="/"?i.slice(1):i;break}default:n("abort",400);return}let r=503;Ta(e+a).then(i=>{const o=i.status;if(o!==200){setTimeout(()=>{n(Ad(o)?"abort":"next",o)});return}return r=501,i.json()}).then(i=>{if(typeof i!="object"||i===null){setTimeout(()=>{i===404?n("abort",i):n("next",r)});return}setTimeout(()=>{n("success",i)})}).catch(()=>{n("next",r)})},Fd={prepare:Dd,send:Ld};function ri(e,s){e.forEach(n=>{const a=n.loaderCallbacks;a&&(n.loaderCallbacks=a.filter(r=>r.id!==s))})}function _d(e){e.pendingCallbacksFlag||(e.pendingCallbacksFlag=!0,setTimeout(()=>{e.pendingCallbacksFlag=!1;const s=e.loaderCallbacks?e.loaderCallbacks.slice(0):[];if(!s.length)return;let n=!1;const a=e.provider,r=e.prefix;s.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 n=!0,!0;return!1}),o.pending.length!==l&&(n||ri([e],i.id),i.callback(o.loaded.slice(0),o.missing.slice(0),o.pending.slice(0),i.abort))})}))}let Rd=0;function Md(e,s,n){const a=Rd++,r=ri.bind(null,n,a);if(!s.pending.length)return r;const i={id:a,icons:s,callback:e,abort:r};return n.forEach(o=>{(o.loaderCallbacks||(o.loaderCallbacks=[])).push(i)}),r}function Pd(e){const s={loaded:[],missing:[],pending:[]},n=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=n[i]||(n[i]=Object.create(null)),u=d[o]||(d[o]=Mt(i,o));let f;l in u.icons?f=s.loaded:o===""||u.missing.has(l)?f=s.missing:f=s.pending;const m={provider:i,prefix:o,name:l};f.push(m)}),s}function Td(e,s=!0,n=!1){const a=[];return e.forEach(r=>{const i=typeof r=="string"?Ts(r,s,n):r;i&&a.push(i)}),a}const Id={resources:[],index:0,timeout:2e3,rotate:750,random:!1,dataAfterTimeout:!1};function Od(e,s,n,a){const r=e.resources.length,i=e.random?Math.floor(Math.random()*r):e.index;let o;if(e.random){let A=e.resources.slice(0);for(o=[];A.length>1;){const j=Math.floor(Math.random()*A.length);o.push(A[j]),A=A.slice(0,j).concat(A.slice(j+1))}o=o.concat(A)}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 b(){m&&(clearTimeout(m),m=null)}function v(){d==="pending"&&(d="aborted"),b(),p.forEach(A=>{A.status==="pending"&&(A.status="aborted")}),p=[]}function g(A,j){j&&(x=[]),typeof A=="function"&&x.push(A)}function y(){return{startTime:l,payload:s,status:d,queriesSent:u,queriesPending:p.length,subscribe:g,abort:v}}function N(){d="failed",x.forEach(A=>{A(void 0,f)})}function k(){p.forEach(A=>{A.status==="pending"&&(A.status="aborted")}),p=[]}function w(A,j,L){const S=j!=="success";switch(p=p.filter(M=>M!==A),d){case"pending":break;case"failed":if(S||!e.dataAfterTimeout)return;break;default:return}if(j==="abort"){f=L,N();return}if(S){f=L,p.length||(o.length?$():N());return}if(b(),k(),!e.random){const M=e.resources.indexOf(A.resource);M!==-1&&M!==e.index&&(e.index=M)}d="completed",x.forEach(M=>{M(L)})}function $(){if(d!=="pending")return;b();const A=o.shift();if(A===void 0){if(p.length){m=setTimeout(()=>{b(),d==="pending"&&(k(),N())},e.timeout);return}N();return}const j={status:"pending",resource:A,callback:(L,S)=>{w(j,L,S)}};p.push(j),u++,m=setTimeout($,e.rotate),n(A,s,j.callback)}return setTimeout($),y}function ii(e){const s={...Id,...e};let n=[];function a(){n=n.filter(l=>l().status==="pending")}function r(l,d,u){const f=Od(s,l,d,(m,p)=>{a(),u&&u(m,p)});return n.push(f),f}function i(l){return n.find(d=>l(d))||null}return{query:r,find:i,setIndex:l=>{s.index=l},getIndex:()=>s.index,cleanup:a}}function Ia(){}const Ys=Object.create(null);function Bd(e){if(!Ys[e]){const s=Bn(e);if(!s)return;const n=ii(s),a={config:s,redundancy:n};Ys[e]=a}return Ys[e]}function zd(e,s,n){let a,r;if(typeof e=="string"){const i=vn(e);if(!i)return n(void 0,424),Ia;r=i.send;const o=Bd(e);o&&(a=o.redundancy)}else{const i=In(e);if(i){a=ii(i);const o=e.resources?e.resources[0]:"",l=vn(o);l&&(r=l.send)}}return!a||!r?(n(void 0,424),Ia):a.query(s,r,n)().abort}function Oa(){}function Vd(e){e.iconsLoaderFlag||(e.iconsLoaderFlag=!0,setTimeout(()=>{e.iconsLoaderFlag=!1,_d(e)}))}function Ud(e){const s=[],n=[];return e.forEach(a=>{(a.match(ti)?s:n).push(a)}),{valid:s,invalid:n}}function zt(e,s,n){function a(){const r=e.pendingIcons;s.forEach(i=>{r&&r.delete(i),e.icons[i]||e.missing.add(i)})}if(n&&typeof n=="object")try{if(!ei(e,n).length){a();return}}catch(r){console.error(r)}a(),Vd(e)}function Ba(e,s){e instanceof Promise?e.then(n=>{s(n)}).catch(()=>{s(null)}):s(e)}function Hd(e,s){e.iconsToLoad?e.iconsToLoad=e.iconsToLoad.concat(s).sort():e.iconsToLoad=s,e.iconsQueueFlag||(e.iconsQueueFlag=!0,setTimeout(()=>{e.iconsQueueFlag=!1;const{provider:n,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)){Ba(e.loadIcons(r,a,n),f=>{zt(e,r,f)});return}if(i){r.forEach(f=>{const m=i(f,a,n);Ba(m,p=>{const x=p?{prefix:a,icons:{[f]:p}}:null;zt(e,[f],x)})});return}const{valid:o,invalid:l}=Ud(r);if(l.length&&zt(e,l,null),!o.length)return;const d=a.match(ti)?vn(n):null;if(!d){zt(e,o,null);return}d.prepare(n,a,o).forEach(f=>{zd(n,f,m=>{zt(e,f.icons,m)})})}))}const Wd=(e,s)=>{const n=Td(e,!0,si()),a=Pd(n);if(!a.pending.length){let d=!0;return s&&setTimeout(()=>{d&&s(a.loaded,a.missing,a.pending,Oa)}),()=>{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(Mt(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=Mt(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&&Hd(d,u)}),s?Md(s,a,i):Oa};function qd(e,s){const n={...e};for(const a in s){const r=s[a],i=typeof r;a in ni?(r===null||r&&(i==="string"||i==="number"))&&(n[a]=r):i===typeof n[a]&&(n[a]=a==="rotate"?r%4:r)}return n}const Gd=/[\s,]+/;function Kd(e,s){s.split(Gd).forEach(n=>{switch(n.trim()){case"horizontal":e.hFlip=!0;break;case"vertical":e.vFlip=!0;break}})}function Yd(e,s=0){const n=e.replace(/^-?[0-9.]*/,"");function a(r){for(;r<0;)r+=4;return r%4}if(n===""){const r=parseInt(e);return isNaN(r)?0:a(r)}else if(n!==e){let r=0;switch(n){case"%":r=25;break;case"deg":r=90}if(r){let i=parseFloat(e.slice(0,e.length-n.length));return isNaN(i)?0:(i=i/r,i%1===0?a(i):0)}}return s}function Qd(e,s){let n=e.indexOf("xlink:")===-1?"":' xmlns:xlink="http://www.w3.org/1999/xlink"';for(const a in s)n+=" "+a+'="'+s[a]+'"';return'<svg xmlns="http://www.w3.org/2000/svg"'+n+">"+e+"</svg>"}function Zd(e){return e.replace(/"/g,"'").replace(/%/g,"%25").replace(/#/g,"%23").replace(/</g,"%3C").replace(/>/g,"%3E").replace(/\s+/g," ")}function Xd(e){return"data:image/svg+xml,"+Zd(e)}function Jd(e){return'url("'+Xd(e)+'")'}let Zt;function eu(){try{Zt=window.trustedTypes.createPolicy("iconify",{createHTML:e=>e})}catch{Zt=null}}function tu(e){return Zt===void 0&&eu(),Zt?Zt.createHTML(e):e}const li={...ai,inline:!1},su={xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink","aria-hidden":!0,role:"img"},nu={display:"inline-block"},jn={backgroundColor:"currentColor"},oi={backgroundColor:"transparent"},za={Image:"var(--svg)",Repeat:"no-repeat",Size:"100% 100%"},Va={WebkitMask:jn,mask:jn,background:oi};for(const e in Va){const s=Va[e];for(const n in za)s[e+n]=za[n]}const au={...li,inline:!0};function Ua(e){return e+(e.match(/^[-0-9.]+$/)?"px":"")}const ru=(e,s,n)=>{const a=s.inline?au:li,r=qd(a,s),i=s.mode||"svg",o={},l=s.style||{},d={...i==="svg"?su:{}};if(n){const g=Ts(n,!1,!0);if(g){const y=["iconify"],N=["provider","prefix"];for(const k of N)g[k]&&y.push("iconify--"+g[k]);d.className=y.join(" ")}}for(let g in s){const y=s[g];if(y!==void 0)switch(g){case"icon":case"style":case"children":case"onLoad":case"mode":case"ssr":case"fallback":break;case"_ref":d.ref=y;break;case"className":d[g]=(d[g]?d[g]+" ":"")+y;break;case"inline":case"hFlip":case"vFlip":r[g]=y===!0||y==="true"||y===1;break;case"flip":typeof y=="string"&&Kd(r,y);break;case"color":o.color=y;break;case"rotate":typeof y=="string"?r[g]=Yd(y):typeof y=="number"&&(r[g]=y);break;case"ariaHidden":case"aria-hidden":y!==!0&&y!=="true"&&delete d["aria-hidden"];break;default:a[g]===void 0&&(d[g]=y)}}const u=yd(e,r),f=u.attributes;if(r.inline&&(o.verticalAlign="-0.125em"),i==="svg"){d.style={...o,...l},Object.assign(d,f);let g=0,y=s.id;return typeof y=="string"&&(y=y.replace(/-/g,"_")),d.dangerouslySetInnerHTML={__html:tu(Nd(u.body,y?()=>y+"ID"+g++:"iconifyReact"))},h.createElement("svg",d)}const{body:m,width:p,height:x}=e,b=i==="mask"||(i==="bg"?!1:m.indexOf("currentColor")!==-1),v=Qd(m,{...f,width:p+"",height:x+""});return d.style={...o,"--svg":Jd(v),width:Ua(f.width),height:Ua(f.height),...nu,...b?jn:oi,...l},h.createElement("span",d)};si(!0);Cd("",Fd);if(typeof document<"u"&&typeof window<"u"){const e=window;if(e.IconifyPreload!==void 0){const s=e.IconifyPreload,n="Invalid IconifyPreload syntax.";typeof s=="object"&&s!==null&&(s instanceof Array?s:[s]).forEach(a=>{try{(typeof a!="object"||a===null||a instanceof Array||typeof a.icons!="object"||typeof a.prefix!="string"||!md(a))&&console.error(n)}catch{console.error(n)}})}if(e.IconifyProviders!==void 0){const s=e.IconifyProviders;if(typeof s=="object"&&s!==null)for(let n in s){const a="IconifyProviders["+n+"] is invalid.";try{const r=s[n];if(typeof r!="object"||!r||r.resources===void 0)continue;kd(n,r)||console.error(a)}catch{console.error(a)}}}}function ci(e){const[s,n]=h.useState(!!e.ssr),[a,r]=h.useState({});function i(x){if(x){const b=e.icon;if(typeof b=="object")return{name:"",data:b};const v=Ma(b);if(v)return{name:b,data:v}}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 b=e.icon;if(typeof b=="object"){u({name:"",data:b});return}const v=Ma(b);if(u({name:b,data:v}))if(v===void 0){const g=Wd([b],f);r({callback:g})}else v&&((x=e.onLoad)===null||x===void 0||x.call(e,b))}h.useEffect(()=>(n(!0),d),[]),h.useEffect(()=>{s&&f()},[e.icon,s]);const{name:m,data:p}=o;return p?ru({...Tn,...p},e,m):e.children?e.children:e.fallback?e.fallback:h.createElement("span",{})}const P=h.forwardRef((e,s)=>ci({...e,_ref:s}));h.forwardRef((e,s)=>ci({inline:!0,...e,_ref:s}));const I=h.forwardRef(({color:e="primary",radius:s="full",testId:n="veevart-button",...a},r)=>t.jsx(c.Button,{ref:r,color:e,radius:s,"data-testid":n,...a}));I.displayName="Button";function di({code:e,amount:s,onRemove:n,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:s})]}),t.jsx(I,{testId:`${i}-remove`,isIconOnly:!0,size:"sm",variant:"light","aria-label":r,onPress:n,children:t.jsx(P,{icon:"solar:close-circle-linear",className:"size-4","aria-hidden":"true"})})]})})}function Qs(e,s){return e-s*Math.floor(e/s)}const ui=1721426;function ms(e,s,n,a){s=zn(e,s);let r=s-1,i=-2;return n<=2?i=0:ws(s)&&(i=-1),ui-1+365*r+Math.floor(r/4)-Math.floor(r/100)+Math.floor(r/400)+Math.floor((367*n-362)/12+i+a)}function ws(e){return e%4===0&&(e%100!==0||e%400===0)}function zn(e,s){return e==="BC"?1-s:s}function iu(e){let s="AD";return e<=0&&(s="BC",e=1-e),[s,e]}const lu={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 Is{fromJulianDay(s){let n=s,a=n-ui,r=Math.floor(a/146097),i=Qs(a,146097),o=Math.floor(i/36524),l=Qs(i,36524),d=Math.floor(l/1461),u=Qs(l,1461),f=Math.floor(u/365),m=r*400+o*100+d*4+f+(o!==4&&f!==4?1:0),[p,x]=iu(m),b=n-ms(p,x,1,1),v=2;n<ms(p,x,3,1)?v=0:ws(x)&&(v=1);let g=Math.floor(((b+v)*12+373)/367),y=n-ms(p,x,g,1)+1;return new ts(p,x,g,y)}toJulianDay(s){return ms(s.era,s.year,s.month,s.day)}getDaysInMonth(s){return lu[ws(s.year)?"leapyear":"standard"][s.month-1]}getMonthsInYear(s){return 12}getDaysInYear(s){return ws(s.year)?366:365}getMaximumMonthsInYear(){return 12}getMaximumDaysInMonth(){return 31}getYearsInEra(s){return 9999}getEras(){return["BC","AD"]}isInverseEra(s){return s.era==="BC"}balanceDate(s){s.year<=0&&(s.era=s.era==="BC"?"AD":"BC",s.year=1-s.year)}constructor(){this.identifier="gregory"}}function ou(e,s){var n,a,r,i;return(i=(r=(n=e.isEqual)===null||n===void 0?void 0:n.call(e,s))!==null&&r!==void 0?r:(a=s.isEqual)===null||a===void 0?void 0:a.call(s,e))!==null&&i!==void 0?i:e.identifier===s.identifier}function mi(e,s){return e.calendar.toJulianDay(e)-s.calendar.toJulianDay(s)}function fi(e,s){return Ha(e)-Ha(s)}function Ha(e){return e.hour*36e5+e.minute*6e4+e.second*1e3+e.millisecond}let Zs=null;function xi(){return Zs==null&&(Zs=new Intl.DateTimeFormat().resolvedOptions().timeZone),Zs}function Wa(e){e=Vn(e,new Is);let s=zn(e.era,e.year);return pi(s,e.month,e.day,e.hour,e.minute,e.second,e.millisecond)}function pi(e,s,n,a,r,i,o){let l=new Date;return l.setUTCHours(a,r,i,o),l.setUTCFullYear(e,s-1,n),l.getTime()}function qa(e,s){if(s==="UTC")return 0;if(e>0&&s===xi())return new Date(e).getTimezoneOffset()*-6e4;let{year:n,month:a,day:r,hour:i,minute:o,second:l}=hi(e,s);return pi(n,a,r,i,o,l,0)-Math.floor(e/1e3)*1e3}const Ga=new Map;function hi(e,s){let n=Ga.get(s);n||(n=new Intl.DateTimeFormat("en-US",{timeZone:s,hour12:!1,era:"short",year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric"}),Ga.set(s,n));let a=n.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 Ka=864e5;function cu(e,s,n,a){return(n===a?[n]:[n,a]).filter(i=>du(e,s,i))}function du(e,s,n){let a=hi(n,s);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 uu(e,s,n="compatible"){let a=gi(e);if(s==="UTC")return Wa(a);if(s===xi()&&n==="compatible"){a=Vn(a,new Is);let d=new Date,u=zn(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=Wa(a),i=qa(r-Ka,s),o=qa(r+Ka,s),l=cu(a,s,r-i,r-o);if(l.length===1)return l[0];if(l.length>1)switch(n){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(n){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 bi(e,s,n="compatible"){return new Date(uu(e,s,n))}function gi(e,s){let n=0,a=0,r=0,i=0;if("timeZone"in e)({hour:n,minute:a,second:r,millisecond:i}=e);else if("hour"in e&&!s)return e;return s&&({hour:n,minute:a,second:r,millisecond:i}=s),new Ss(e.calendar,e.era,e.year,e.month,e.day,n,a,r,i)}function Vn(e,s){if(ou(e.calendar,s))return e;let n=s.fromJulianDay(e.calendar.toJulianDay(e)),a=e.copy();return a.calendar=s,a.era=n.era,a.year=n.year,a.month=n.month,a.day=n.day,Pt(a),a}function Un(e,s){let n=e.copy(),a="hour"in n?ki(n,s):0;wn(n,s.years||0),n.calendar.balanceYearMonth&&n.calendar.balanceYearMonth(n,e),n.month+=s.months||0,Nn(n),yi(n),n.day+=(s.weeks||0)*7,n.day+=s.days||0,n.day+=a,mu(n),n.calendar.balanceDate&&n.calendar.balanceDate(n),n.year<1&&(n.year=1,n.month=1,n.day=1);let r=n.calendar.getYearsInEra(n);if(n.year>r){var i,o;let d=(i=(o=n.calendar).isInverseEra)===null||i===void 0?void 0:i.call(o,n);n.year=r,n.month=d?1:n.calendar.getMonthsInYear(n),n.day=d?1:n.calendar.getDaysInMonth(n)}n.month<1&&(n.month=1,n.day=1);let l=n.calendar.getMonthsInYear(n);return n.month>l&&(n.month=l,n.day=n.calendar.getDaysInMonth(n)),n.day=Math.max(1,Math.min(n.calendar.getDaysInMonth(n),n.day)),n}function wn(e,s){var n,a;!((n=(a=e.calendar).isInverseEra)===null||n===void 0)&&n.call(a,e)&&(s=-s),e.year+=s}function Nn(e){for(;e.month<1;)wn(e,-1),e.month+=e.calendar.getMonthsInYear(e);let s=0;for(;e.month>(s=e.calendar.getMonthsInYear(e));)e.month-=s,wn(e,1)}function mu(e){for(;e.day<1;)e.month--,Nn(e),e.day+=e.calendar.getDaysInMonth(e);for(;e.day>e.calendar.getDaysInMonth(e);)e.day-=e.calendar.getDaysInMonth(e),e.month++,Nn(e)}function yi(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 Pt(e){e.calendar.constrainDate&&e.calendar.constrainDate(e),e.year=Math.max(1,Math.min(e.calendar.getYearsInEra(e),e.year)),yi(e)}function vi(e){let s={};for(let n in e)typeof e[n]=="number"&&(s[n]=-e[n]);return s}function ji(e,s){return Un(e,vi(s))}function wi(e,s){let n=e.copy();return s.era!=null&&(n.era=s.era),s.year!=null&&(n.year=s.year),s.month!=null&&(n.month=s.month),s.day!=null&&(n.day=s.day),Pt(n),n}function Ni(e,s){let n=e.copy();return s.hour!=null&&(n.hour=s.hour),s.minute!=null&&(n.minute=s.minute),s.second!=null&&(n.second=s.second),s.millisecond!=null&&(n.millisecond=s.millisecond),Ci(n),n}function fu(e){e.second+=Math.floor(e.millisecond/1e3),e.millisecond=fs(e.millisecond,1e3),e.minute+=Math.floor(e.second/60),e.second=fs(e.second,60),e.hour+=Math.floor(e.minute/60),e.minute=fs(e.minute,60);let s=Math.floor(e.hour/24);return e.hour=fs(e.hour,24),s}function Ci(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 fs(e,s){let n=e%s;return n<0&&(n+=s),n}function ki(e,s){return e.hour+=s.hours||0,e.minute+=s.minutes||0,e.second+=s.seconds||0,e.millisecond+=s.milliseconds||0,fu(e)}function Si(e,s){let n=e.copy();return ki(n,s),n}function xu(e,s){return Si(e,vi(s))}function $i(e,s,n,a){let r=e.copy();switch(s){case"era":{let l=e.calendar.getEras(),d=l.indexOf(e.era);if(d<0)throw new Error("Invalid era: "+e.era);d=bt(d,n,0,l.length-1,a?.round),r.era=l[d],Pt(r);break}case"year":var i,o;!((i=(o=r.calendar).isInverseEra)===null||i===void 0)&&i.call(o,r)&&(n=-n),r.year=bt(e.year,n,-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=bt(e.month,n,1,e.calendar.getMonthsInYear(e),a?.round);break;case"day":r.day=bt(e.day,n,1,e.calendar.getDaysInMonth(e),a?.round);break;default:throw new Error("Unsupported field "+s)}return e.calendar.balanceDate&&e.calendar.balanceDate(r),Pt(r),r}function Ai(e,s,n,a){let r=e.copy();switch(s){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=bt(i,n,o,l,a?.round);break}case"minute":r.minute=bt(e.minute,n,0,59,a?.round);break;case"second":r.second=bt(e.second,n,0,59,a?.round);break;case"millisecond":r.millisecond=bt(e.millisecond,n,0,999,a?.round);break;default:throw new Error("Unsupported field "+s)}return r}function bt(e,s,n,a,r=!1){if(r){e+=Math.sign(s),e<n&&(e=a);let i=Math.abs(s);s>0?e=Math.ceil(e/i)*i:e=Math.floor(e/i)*i,e>a&&(e=n)}else e+=s,e<n?e=a-(n-e-1):e>a&&(e=n+(e-a-1));return e}const pu=/^([+-]\d{6}|\d{4})-(\d{2})-(\d{2})$/,hu=/^([+-]\d{6}|\d{4})-(\d{2})-(\d{2})(?:T(\d{2}))?(?::(\d{2}))?(?::(\d{2}))?(\.\d+)?(?:(?:([+-]\d{2})(?::?(\d{2}))?)|Z)$/;function bu(e){let s=e.match(pu);if(!s)throw hu.test(e)?new Error(`Invalid ISO 8601 date string: ${e}. Use parseAbsolute() instead.`):new Error("Invalid ISO 8601 date string: "+e);let n=new ts(Xs(s[1],0,9999),Xs(s[2],1,12),1);return n.day=Xs(s[3],1,n.calendar.getDaysInMonth(n)),n}function Xs(e,s,n){let a=Number(e);if(a<s||a>n)throw new RangeError(`Value out of range: ${s} <= ${a} <= ${n}`);return a}function Di(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 Ei(e){let s=Vn(e,new Is),n;return s.era==="BC"?n=s.year===1?"0000":"-"+String(Math.abs(1-s.year)).padStart(6,"00"):n=String(s.year).padStart(4,"0"),`${n}-${String(s.month).padStart(2,"0")}-${String(s.day).padStart(2,"0")}`}function gu(e){return`${Ei(e)}T${Di(e)}`}function yu(e,s){if(s.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function Hn(e,s,n){yu(e,s),s.set(e,n)}function Li(e){let s=typeof e[0]=="object"?e.shift():new Is,n;if(typeof e[0]=="string")n=e.shift();else{let o=s.getEras();n=o[o.length-1]}let a=e.shift(),r=e.shift(),i=e.shift();return[s,n,a,r,i]}var vu=new WeakMap;class ts{copy(){return this.era?new ts(this.calendar,this.era,this.year,this.month,this.day):new ts(this.calendar,this.year,this.month,this.day)}add(s){return Un(this,s)}subtract(s){return ji(this,s)}set(s){return wi(this,s)}cycle(s,n,a){return $i(this,s,n,a)}toDate(s){return bi(this,s)}toString(){return Ei(this)}compare(s){return mi(this,s)}constructor(...s){Hn(this,vu,{writable:!0,value:void 0});let[n,a,r,i,o]=Li(s);this.calendar=n,this.era=a,this.year=r,this.month=i,this.day=o,Pt(this)}}var ju=new WeakMap;class Os{copy(){return new Os(this.hour,this.minute,this.second,this.millisecond)}add(s){return Si(this,s)}subtract(s){return xu(this,s)}set(s){return Ni(this,s)}cycle(s,n,a){return Ai(this,s,n,a)}toString(){return Di(this)}compare(s){return fi(this,s)}constructor(s=0,n=0,a=0,r=0){Hn(this,ju,{writable:!0,value:void 0}),this.hour=s,this.minute=n,this.second=a,this.millisecond=r,Ci(this)}}var wu=new WeakMap;class Ss{copy(){return this.era?new Ss(this.calendar,this.era,this.year,this.month,this.day,this.hour,this.minute,this.second,this.millisecond):new Ss(this.calendar,this.year,this.month,this.day,this.hour,this.minute,this.second,this.millisecond)}add(s){return Un(this,s)}subtract(s){return ji(this,s)}set(s){return wi(Ni(this,s),s)}cycle(s,n,a){switch(s){case"era":case"year":case"month":case"day":return $i(this,s,n,a);default:return Ai(this,s,n,a)}}toDate(s,n){return bi(this,s,n)}toString(){return gu(this)}compare(s){let n=mi(this,s);return n===0?fi(this,gi(s)):n}constructor(...s){Hn(this,wu,{writable:!0,value:void 0});let[n,a,r,i,o]=Li(s);this.calendar=n,this.era=a,this.year=r,this.month=i,this.day=o,this.hour=s.shift()||0,this.minute=s.shift()||0,this.second=s.shift()||0,this.millisecond=s.shift()||0,Pt(this)}}const Nu="Open time options",Cu=320;function Ya(e,s){return typeof s=="string"&&s.length>0?`${e} ${s}`:e}function Js(e){if(!e)return null;const s="hour"in e&&typeof e.hour=="number"?e.hour:0,n="minute"in e&&typeof e.minute=="number"?e.minute:0,a="second"in e&&typeof e.second=="number"?e.second:0;return new Os(s,n,a)}function ku(e,s){const n=new Date(2e3,0,1,e.hour,e.minute,e.second);return new Intl.DateTimeFormat("en-US",{hour:"numeric",minute:"2-digit",hour12:s===12}).format(n)}function Su(e){const s=[];for(let n=0;n<24;n+=1)for(let a=0;a<60;a+=e)s.push(new Os(n,a));return s}function $u(e){const{minuteStep:s=15,timeListClassName:n,timeListLabel:a=Nu,selectorButtonProps:r,endContent:i,onChange:o,value:l,defaultValue:d,hourCycle:u=12,...f}=e,m=l!==void 0,[p,x]=h.useState(()=>Js(d)),b=m?Js(l):p,v=h.useMemo(()=>Su(s),[s]),g=N=>{m||x(N),o?.(N)},y=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(J.Clock3,{className:"size-4",strokeWidth:1.75})})}),t.jsx(c.PopoverContent,{className:"min-w-[8.5rem] p-0",children:t.jsx(c.ScrollShadow,{className:n??"max-h-64 py-1",children:t.jsx("div",{className:"flex flex-col p-1",children:v.map(N=>{const k=b?.hour===N.hour&&b?.minute===N.minute;return t.jsx(c.Button,{variant:k?"flat":"light",color:k?"primary":"default",className:"h-9 min-w-0 justify-start px-3",onPress:()=>g(N),children:ku(N,u)},`${N.hour}:${N.minute}`)})})})})]});return t.jsx(c.TimeInput,{...f,value:m?b:void 0,defaultValue:m?void 0:d,hourCycle:u,endContent:t.jsxs("div",{className:"flex items-center gap-1",children:[i,y]}),onChange:N=>g(Js(N))})}function Wn(e){if(e.mode==="time")return t.jsx($u,{...e});if(e.mode==="datetime"){const{mode:r,granularity:i="minute",hideTimeZone:o=!0,calendarWidth:l=Cu,disableAnimation:d=!0,classNames:u,...f}=e;return t.jsx(c.DatePicker,{...f,calendarWidth:l,classNames:{...u,popoverContent:Ya("min-w-[20rem]",u?.popoverContent),calendarContent:Ya("min-h-[18rem]",u?.calendarContent)},disableAnimation:d,granularity:i,hideTimeZone:o})}const{mode:s,granularity:n="day",...a}=e;return t.jsx(c.DatePicker,{...a,granularity:n})}function Au({label:e,...s}){return t.jsx("button",{...s,"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 Du(e){return e!==void 0&&e.trim()!==""}function Fi(e,s){const n=Gr();if(h.isValidElement(s))return s;const a=[e,n].find(Du);return a===void 0?void 0:t.jsx(Au,{label:a})}const _i=h.forwardRef(({closeLabel:e,closeButton:s,...n},a)=>{const r=Fi(e,s);return t.jsx(c.Drawer,{ref:a,...n,closeButton:r})});_i.displayName="Drawer";const rs=h.forwardRef(({closeLabel:e,closeButton:s,...n},a)=>{const r=Fi(e,s);return t.jsx(c.Modal,{ref:a,...n,closeButton:r})});rs.displayName="Modal";function Eu(e){const s=e?.closest('[role="dialog"]');return s?.parentElement??s??void 0}const rt=h.forwardRef(({popoverProps:e,...s},n)=>{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(Eu(a.current))},[]),t.jsx("span",{ref:a,className:"contents",children:t.jsx(c.Select,{ref:n,...s,popoverProps:u})})});rt.displayName="Select";const Lu="motion-reduce:animate-none motion-reduce:transition-none motion-reduce:before:animate-none motion-reduce:before:transition-none motion-reduce:after:transition-none",ie=h.forwardRef(({classNames:e,...s},n)=>t.jsx(c.Skeleton,{ref:n,...s,classNames:{...e,base:c.cn(Lu,e?.base)}}));ie.displayName="Skeleton";const Fu="text-default-600 data-[hover=true]:text-default-700",qn=h.forwardRef(({classNames:e,...s},n)=>t.jsx(c.Table,{ref:n,...s,classNames:{...e,th:c.cn(Fu,e?.th)}}));qn.displayName="Table";function _u({state:e,onSubmit:s,onRemove:n,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,b]=h.useState(e);e!==x&&(b(e),e==="applied"&&m(""));const v=()=>{const N=f.trim();N&&s(N)},g=N=>{N.key==="Enter"&&(N.preventDefault(),v())};if(e==="applied"&&a)return t.jsx("div",{"data-testid":u,children:t.jsx(di,{code:a.code,amount:a.amount,onRemove:n,removeAriaLabel:d,testId:`${u}-card`})});const y=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:g,isDisabled:e==="loading",isInvalid:e==="error","aria-describedby":y?p:void 0}),t.jsx(I,{testId:`${u}-button`,isLoading:e==="loading",isDisabled:!f.trim(),onPress:v,children:l})]}),y&&t.jsx("p",{id:p,"data-testid":`${u}-error`,className:"text-tiny text-danger",children:r})]})}const Ru={login:"Login",logout:"Logout",selectLanguage:"Select your language"};function Mu({languages:e,selectedLanguage:s,onLanguageChange:n,label:a}){const r=e.find(i=>i.code===s);return t.jsx("div",{className:"flex items-center",children:t.jsxs("div",{className:"relative flex items-center",children:[t.jsx(rt,{"data-testid":"language-select-desktop",variant:"bordered","aria-label":a,selectedKeys:s?[s]:[],onSelectionChange:i=>{const o=Array.from(i)[0]||s;n?.(o)},className:"min-w-36 hidden md:inline-flex",isDisabled:e.length===0,placeholder:a,startContent:t.jsx(J.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(rt,{"aria-label":a,"data-testid":"language-select-mobile",variant:"bordered",selectedKeys:s?[s]:[],onSelectionChange:i=>{const o=Array.from(i)[0]||s;n?.(o)},className:"w-24 inline-flex md:hidden",isDisabled:e.length===0,placeholder:"",startContent:t.jsx(J.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 Pu({isLoggedIn:e,onLogin:s,onLogout:n,labels:a}){return e?t.jsxs(I,{"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:n,size:"md",children:[t.jsx(J.User,{className:"inline w-5 h-5"}),t.jsx("span",{className:"hidden md:inline",children:a.logout})]}):t.jsxs(I,{"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:s,size:"md",children:[t.jsx(J.User,{className:"inline w-5 h-5"}),t.jsx("span",{className:"hidden md:inline",children:a.login})]})}function Tu({logo:e,languages:s=[],selectedLanguage:n,onLanguageChange:a,isLoggedIn:r,onLogin:i,onLogout:o,hasLanguages:l,hasAuth:d,labels:u={},className:f}){const m={...Ru,...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||s.length>0)&&t.jsx(Mu,{languages:s,selectedLanguage:n,onLanguageChange:a,label:m.selectLanguage}),d&&t.jsx(Pu,{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 en;const Ou=typeof document<"u"?(en=h.useInsertionEffect)!==null&&en!==void 0?en:h.useLayoutEffect:()=>{};function is(e,s,n){let[a,r]=h.useState(e||s),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;Ou(()=>{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(),n?.(x,...p))},[n]);return[d,f]}function Ri(e){return t.jsx("svg",{...e,fill:"none",stroke:"currentColor",strokeWidth:2,viewBox:"0 0 24 24",children:t.jsx(Ve.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:s="default",stepsCount:n=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:b=!1,stepClassName:v,className:g,isDisabled:y=!1,...N},k)=>{const[w,$]=is(x,a,p),A=h.useMemo(()=>{let j,L;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":j="[--step-color:var(--heroui-primary)]",L="[--step-fg-color:var(--heroui-primary-foreground)]";break;case"secondary":j="[--step-color:var(--heroui-secondary)]",L="[--step-fg-color:var(--heroui-secondary-foreground)]";break;case"success":j="[--step-color:var(--heroui-success)]",L="[--step-fg-color:var(--heroui-success-foreground)]";break;case"warning":j="[--step-color:var(--heroui-warning)]",L="[--step-fg-color:var(--heroui-warning-foreground)]";break;case"danger":j="[--step-color:var(--heroui-danger)]",L="[--step-fg-color:var(--heroui-danger-foreground)]";break;case"default":j="[--step-color:var(--heroui-default)]",L="[--step-fg-color:var(--heroui-default-foreground)]";break;default:j="[--step-color:var(--heroui-primary)]",L="[--step-fg-color:var(--heroui-primary-foreground)]";break}return S.unshift(L),S.unshift(j),S},[e]);return t.jsxs("nav",{ref:k,"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",g),"data-testid":"stepper-root",...N,children:[d&&u==="left"?t.jsx("span",{className:"text-default-500 text-2xl whitespace-nowrap","data-testid":"stepper-counter",children:m?m(w+1,n):`Step ${w+1} of ${n}`}):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",A,g),"data-testid":"stepper-list",children:Array.from({length:n})?.map((j,L)=>{const S=w===L?"active":w<L?"inactive":"complete",M=s==="activeLabel"&&S==="active"&&!!i?.[L],D=o&&S!=="active"&&!!i?.[L];return t.jsxs("li",{className:"relative flex shrink-0 items-center gap-x-3","data-testid":`stepper-step-${L}`,children:[t.jsx(c.Tooltip,{content:D?i?.[L]:void 0,isDisabled:!D,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":M},{"cursor-not-allowed opacity-50":y},v),onClick:()=>!y&&$(L),disabled:y,"data-testid":`stepper-step-btn-${L}`,children:[t.jsx("div",{className:"h-full relative flex items-center",children:t.jsx(Ve.LazyMotion,{features:Ve.domAnimation,children:t.jsx(Ve.m.div,{animate:S,className:"relative z-10",children:t.jsx(Ve.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)":M,"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"&&s==="default"?t.jsx(Ri,{className:"h-5 w-5 text-(--active-fg-color)","data-testid":`stepper-step-check-${L}`}):t.jsx("span",{children:L+1})})})})})}),M?t.jsx("span",{className:"pr-2 text-2xl leading-none font-medium whitespace-nowrap text-(--active-color)","data-testid":`stepper-step-label-${L}`,children:i[L]}):null]},L)}),L<n-1&&!b&&t.jsx("div",{"aria-hidden":"true",className:"pointer-events-none z-0 w-12 flex-none items-center",style:{"--idx":L},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":L<w})})})]},L)})}),d&&u==="right"?t.jsx("span",{className:"text-default-500 text-2xl whitespace-nowrap","data-testid":"stepper-counter",children:m?m(w+1,n):`Step ${w+1} of ${n}`}):null]})});Mi.displayName="Stepper";function Bu(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 xe(e,s="en-US",n="USD"){try{return new Intl.NumberFormat(s,{style:"currency",currency:n}).format(e)}catch{return`${n} ${e.toFixed(2)}`}}function Tt(e,s="en-US"){try{const n=new Intl.NumberFormat(s,{style:"currency",currency:e}).resolvedOptions();return typeof n.maximumFractionDigits=="number"?n.maximumFractionDigits:2}catch{return 2}}function Gn(e,s,n="en-US"){const a=Tt(s,n),r=Math.pow(10,a);return Math.round(e*r)/r}function Cn(e,s,n,a){return Gn(e-s,n,a)}const Qa={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))"}},zu="rgb(156 163 175)",Vu="rgb(107 114 128)",Pi=h.forwardRef(function({color:s="primary",steps:n=[],defaultStep:a=0,onStepChange:r,currentStep:i,hideProgressBars:o=!1,activeColor:l,activeForegroundColor:d,inactiveColor:u=zu,inactiveLabelColor:f=Vu,activeStepVariant:m="bordered",stepClassName:p,circleClassName:x,progressBarClassName:b,labelsClassName:v,labelSlotClassName:g,activeLabelClassName:y,inactiveLabelClassName:N,className:k,ariaLabel:w="Progress",invalidLabelSuffix:$=", has errors",testId:A,isStepReachable:j,...L},S){const[M,D]=is(i,a,r),E=Qa[s]??Qa.primary,R=l??E.active,T=d??E.fg,H=(K,B)=>{const G=K.ariaLabel??(typeof K.title=="string"?K.title:null)??`${B+1}`;return K.invalid?`${G}${$}`:G};return t.jsxs("nav",{...L,"aria-label":w,...A?{"data-testid":A}:{},children:[t.jsx("div",{className:c.cn("flex items-center",k),children:n?.map((K,B)=>{const se=B===M?"active":B<M?"complete":"inactive",G=j?j(B):!0;return t.jsxs(h.Fragment,{children:[t.jsx(I,{ref:S,isIconOnly:!0,disableAnimation:!0,radius:"full",variant:"light",testId:`${A??"horizontal-steps"}-step-${B}`,"aria-current":se==="active"?"step":void 0,"aria-describedby":K.describedBy,"aria-label":H(K,B),"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){D(B);return}r?.(B)},children:t.jsx(Ve.LazyMotion,{features:Ve.domAnimation,children:t.jsx(Ve.m.div,{animate:se,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"?R:"transparent",borderColor:R,borderWidth:"1.5px",color:m==="solid"?T:R},complete:{backgroundColor:R,borderColor:R,borderWidth:"1.5px",color:R}},children:se==="complete"?t.jsx(Ri,{className:"size-4",style:{color:T}}):t.jsx("span",{children:B+1})})})}),B<n.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",b),style:{backgroundColor:B<M?R:u}})]},B)})}),t.jsx("div",{className:c.cn("mt-2.5 hidden md:flex",v),children:n?.map((K,B)=>{const se=B<=M;return t.jsxs(h.Fragment,{children:[t.jsx("div",{className:c.cn("relative flex w-8 shrink-0 justify-center overflow-visible",g),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",se?y:N),style:{color:se?R:f},children:K.title})}),B<n.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",b)})]},B)})})]})});Pi.displayName="HorizontalSteps";function te(e){return e!=null&&e!==!1&&e!==""}const Ze=e=>as[e],Uu={done:"solar:check-circle-bold","needs-fix":"solar:danger-triangle-bold",optional:"solar:record-outline"},Ti={done:{icon:Ze("--ok"),meta:Ze("--sub")},"needs-fix":{icon:Ze("--warn"),meta:Ze("--warn")},optional:{icon:Ze("--muted"),meta:Ze("--sub")}},Hu=Ze("--ink"),Wu={ready:"solar:check-circle-bold",fix:"solar:danger-triangle-bold",live:"solar:check-circle-bold"},qu={ready:{fill:Ze("--ok-fill"),text:Ze("--ok")},fix:{fill:Ze("--warn-fill"),text:Ze("--warn")},live:{fill:Ze("--ok-fill"),text:Ze("--ok")}},st={root:"flex min-h-0 flex-col gap-3 overflow-y-auto overscroll-contain",nav:"rounded-2xl border border-acct-border bg-acct-surface p-1.5",list:"m-0 flex list-none flex-col gap-0.5 p-0",row:["h-auto min-h-0 w-full justify-start items-start gap-2.5 whitespace-normal","rounded-xl px-2.5 py-2 text-left font-normal","bg-transparent data-[hover=true]:bg-acct-page","data-[disabled=true]:opacity-40 data-[disabled=true]:cursor-not-allowed"].join(" "),rowCurrent:"bg-acct-hair data-[hover=true]:bg-acct-hair",icon:"mt-px size-5 shrink-0",text:"flex min-w-0 flex-1 flex-col gap-0.5",label:"text-sm leading-5",labelCurrent:"font-semibold",meta:"text-xs leading-4 [overflow-wrap:anywhere]"},Vt={root:"flex items-start gap-2.5 rounded-2xl px-4 py-3",icon:"mt-0.5 size-5 shrink-0",text:"flex min-w-0 flex-col",title:"text-sm font-semibold leading-5",description:"text-xs leading-4"},St={root:"flex flex-wrap items-center justify-between gap-3",spacer:"min-w-0 flex-1 basis-0",progress:"shrink-0 text-xs text-acct-sub",endSlot:"flex min-w-0 flex-1 basis-0 justify-end",arrow:"size-4"};function Gu({step:e,labels:s}){const n=Ti[e.status];if(e.status==="optional")return t.jsxs("span",{className:st.meta,style:{color:n.meta},children:[s.optional,te(e.summary)?t.jsxs(t.Fragment,{children:[" · ",e.summary]}):null]});const a=e.status==="needs-fix"&&te(e.reason)?e.reason:e.summary,r=e.status==="done"?s.done:s.needsFix;return t.jsxs(t.Fragment,{children:[t.jsx("span",{className:"sr-only",children:r})," ",te(a)?t.jsx("span",{className:st.meta,style:{color:n.meta},children:a}):null]})}function Ii({steps:e,currentStep:s,defaultStep:n=0,onStepChange:a,isStepReachable:r,ariaLabel:i,statusLabels:o,header:l,maxHeight:d,className:u,style:f,"data-testid":m="vertical-steps",...p}){const[x,b]=is(s,n,a);return t.jsxs("div",{...p,"data-testid":m,className:c.cn(st.root,u),style:d===void 0?f:{maxHeight:d,...f},children:[l,t.jsx("nav",{"aria-label":i,className:st.nav,children:t.jsx("ol",{className:st.list,children:e.map((v,g)=>{const y=g===x,N=r?r(g):!0;return t.jsx("li",{children:t.jsxs(I,{variant:"light",color:"default",radius:"none",disableAnimation:!0,testId:v.testId??`${m}-step-${v.key}`,"data-state":v.status,"data-current":y?"true":void 0,"aria-current":y?"step":void 0,isDisabled:!N,className:c.cn(st.row,y&&st.rowCurrent),onPress:()=>b(g),children:[t.jsx(P,{"aria-hidden":!0,icon:Uu[v.status],className:st.icon,style:{color:Ti[v.status].icon}}),t.jsxs("span",{className:st.text,children:[t.jsx("span",{className:c.cn(st.label,y&&st.labelCurrent),style:{color:Hu},children:`${g+1}. ${v.label}`})," ",t.jsx(Gu,{step:v,labels:o})]})]})},v.key)})})})]})}Ii.displayName="VerticalSteps";function Oi({variant:e,title:s,description:n,className:a,"data-testid":r="steps-readiness"}){const i=qu[e];return t.jsxs("div",{role:"status","data-testid":r,"data-variant":e,"data-ready":e==="fix"?"false":"true",className:c.cn(Vt.root,a),style:{backgroundColor:i.fill,color:i.text},children:[t.jsx(P,{"aria-hidden":!0,icon:Wu[e],className:Vt.icon}),t.jsxs("span",{className:Vt.text,children:[t.jsx("span",{className:Vt.title,children:s})," ",te(n)?t.jsx("span",{className:Vt.description,children:n}):null]})]})}Oi.displayName="StepsReadiness";function Bi({steps:e,currentStep:s,onStepChange:n,progressLabel:a,nextLabel:r,previousLabel:i=b=>b.label,finalActionLabel:o,onFinalAction:l,isFinalActionDisabled:d=!1,className:u,"data-testid":f="step-pager",previousTestId:m=`${f}-prev`,nextTestId:p=`${f}-next`,finalActionTestId:x=`${f}-final`}){const b=e[s-1],v=e[s+1],g=s===e.length-1;return t.jsxs("div",{"data-testid":f,className:c.cn(St.root,u),children:[t.jsx("div",{className:St.spacer,children:b?t.jsx(I,{variant:"bordered",color:"default",testId:m,startContent:t.jsx(P,{"aria-hidden":!0,icon:"solar:arrow-left-outline",className:St.arrow}),onPress:()=>n(s-1),children:i(b)}):null}),t.jsx("span",{className:St.progress,children:a(s+1,e.length)}),t.jsx("div",{className:St.endSlot,children:v?t.jsx(I,{color:"primary",testId:p,endContent:t.jsx(P,{"aria-hidden":!0,icon:"solar:arrow-right-outline",className:St.arrow}),onPress:()=>n(s+1),children:r(v)}):g&&o!==void 0&&l?t.jsx(I,{color:"primary",testId:x,isDisabled:d,onPress:l,children:o}):null})]})}Bi.displayName="StepPager";function Ku(){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 Yu=e=>{const s=h.useMemo(()=>JSON.stringify({allItems:e.allItems,selected:e.selected}),[e.allItems,e.selected]);return t.jsx(Qu,{...e},s)},Qu=({allItems:e,selected:s,onSelectedChange:n,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(s),[s]),b=h.useMemo(()=>new Set(e),[e]),v=h.useMemo(()=>e.filter(D=>!x.has(D)),[e,x]),g=D=>{if(D.length===0)return;const E=Array.from(new Set([...s,...D]));n(E)},y=D=>{if(D.length===0)return;const E=new Set(D);n(s.filter(R=>!E.has(R)))},N=()=>{i.length!==0&&(g(i),o([]))},k=()=>{l.length!==0&&(y(l),d([]))},w=()=>{v.length!==0&&(g(v),o([]))},$=()=>{s.length!==0&&(n([]),d([]))},A=(D,E,R)=>{const T=Math.min(E,R),H=Math.max(E,R);return D.slice(T,H+1)},j=(D,E,R)=>{if(R&&u!==null){o(A(v,u,E)),d([]),f(E);return}const T=i.includes(D);o(T?i.filter(H=>H!==D):[...i,D]),d([]),f(E)},L=(D,E,R)=>{if(R&&m!==null){d(A(s,m,E)),o([]),p(E);return}const T=l.includes(D);d(T?l.filter(H=>H!==D):[...l,D]),o([]),p(E)},S=(D,E,R)=>{const T=R==="available"?i.includes(E)?i:[E]:l.includes(E)?l:[E];D.dataTransfer.setData("text/plain",JSON.stringify({source:R,items:T})),D.dataTransfer.effectAllowed="move"},M=(D,E)=>{D.preventDefault();const R=D.dataTransfer.getData("text/plain");if(R)try{const T=JSON.parse(R),H=(T.items||[]).filter(K=>b.has(K));if(H.length===0||T.source===E)return;E==="selected"?(g(H),o([])):(y(H),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:D=>D.preventDefault(),onDrop:D=>M(D,"available"),children:v.map((D,E)=>{const R=i.includes(D);return t.jsx("button",{type:"button",onClick:T=>{j(D,E,T.shiftKey)},onMouseDown:T=>{T.shiftKey&&T.preventDefault()},draggable:!0,onDragStart:T=>S(T,D,"available"),className:`rounded-md px-3 py-2 text-left text-sm transition ${R?"bg-[#E4571E]/10 text-[#E4571E]":"text-gray-700 hover:bg-gray-100"}`,children:D},D)})})})]}),t.jsxs("div",{className:"flex flex-row items-center justify-center gap-3 md:flex-col md:pt-6",children:[t.jsx(I,{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:N,isDisabled:i.length===0,"aria-label":"Move selected to right",children:"›"}),t.jsx(I,{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:k,isDisabled:l.length===0,"aria-label":"Move selected to left",children:"‹"}),t.jsx(I,{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:w,isDisabled:v.length===0,"aria-label":"Move all to right",children:"»"}),t.jsx(I,{variant:"light",className:"h-10 w-10 min-w-0 text-2xl font-semibold text-[#E4571E] hover:bg-[#E4571E]/10",isIconOnly:!0,onPress:$,"data-testid":"move-all-to-available",isDisabled:s.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:D=>D.preventDefault(),onDrop:D=>M(D,"selected"),children:s.map((D,E)=>{const R=l.includes(D);return t.jsx("button",{type:"button",onClick:T=>{L(D,E,T.shiftKey)},onMouseDown:T=>{T.shiftKey&&T.preventDefault()},draggable:!0,onDragStart:T=>S(T,D,"selected"),className:`rounded-md px-3 py-2 text-left text-sm transition ${R?"bg-[#E4571E]/10 text-[#E4571E]":"text-gray-700 hover:bg-gray-100"}`,children:D},D)})})})]})]})};function ss(e){return typeof e=="string"?e:e.type}function yt({className:e}){return t.jsx("div",{className:`flex items-center h-6 ${e||""}`,children:t.jsx(c.Divider,{orientation:"vertical"})})}function jt({icon:e,label:s,isActive:n=!1,isDisabled:a=!1,onClick:r,shortcut:i,iconSize:o=16,className:l}){const d=i?`${s} (${i})`:s;return t.jsx(c.Tooltip,{content:d,placement:"top",offset:10,children:t.jsx(I,{size:"sm",radius:"sm",color:n?"primary":"default",variant:n?"solid":"bordered",isIconOnly:!0,isDisabled:a,onPress:r,"aria-label":s,className:l,children:t.jsx(e,{size:o})})})}const ft={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:s})=>{const n=s?.type==="textColor"?s.color:"";n?e.chain().focus().setColor(n).run():e.chain().focus().unsetColor().run()},canExecute:()=>!0,isActive:e=>e.isActive("textStyle"),label:"Text color"},highlight:{execute:({editor:e,config:s})=>{const n=s?.type==="highlight"?s.color:"";n?e.chain().focus().setHighlight({color:n}).run():e.chain().focus().unsetHighlight().run()},canExecute:()=>!0,isActive:e=>e.isActive("highlight"),label:"Highlight"},link:{execute:({editor:e,config:s})=>{const n=s?.type==="link"?s.href:"";if(n){const a=s?.type==="link"?s.target:void 0,r=s?.type==="link"?s.rel:void 0;e.chain().focus().setLink({href:n,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:s})=>{const n=s?.type==="heading"?s.level:1;e.chain().focus().toggleHeading({level:n}).run()},canExecute:(e,s)=>{const n=s?.type==="heading"?s.level:1;return e.can().chain().focus().toggleHeading({level:n}).run()},isActive:(e,s)=>s?.type==="heading"?e.isActive("heading",{level:s.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:s})=>{const n=s?.type==="textAlign"?s.alignment:"left";e.chain().focus().setTextAlign(n).run()},canExecute:()=>!0,isActive:(e,s)=>s?.type==="textAlign"?e.isActive({textAlign:s.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"}},Zu={1:"Heading 1",2:"Heading 2",3:"Heading 3",4:"Heading 4",5:"Heading 5",6:"Heading 6"};function Xu({editor:e,levels:s=[1,2,3,4,5,6],isDisabled:n=!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=s.find(o=>e.isActive("heading",{level:o})),i=o=>{const l=Number(o),d=ft.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(I,{size:"sm",radius:"sm",variant:r?"solid":"bordered",color:r?"primary":"default",isDisabled:n,startContent:t.jsx(J.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:s.map(o=>t.jsx(c.DropdownItem,{startContent:e.isActive("heading",{level:o})?t.jsx(J.Check,{size:16}):t.jsx("div",{className:"w-4"}),children:Zu[o]},o))})]})}const tn={bulletList:{label:"Bullet List",icon:J.List},orderedList:{label:"Numbered List",icon:J.ListOrdered},taskList:{label:"Task List",icon:J.ListTodo}};function Ju({editor:e,types:s=["bulletList","orderedList","taskList"],isDisabled:n=!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=s.find(l=>e.isActive(l)),i=r?tn[r].icon:J.List,o=l=>{const u=ft[l];u&&u.execute({editor:e})};return t.jsxs(c.Dropdown,{placement:"top-start",offset:10,children:[t.jsx(c.DropdownTrigger,{children:t.jsx(I,{size:"sm",radius:"sm",variant:r?"solid":"bordered",color:r?"primary":"default",isDisabled:n,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:s.map(l=>{const d=tn[l].icon;return t.jsx(c.DropdownItem,{startContent:t.jsx(d,{size:16}),children:tn[l].label},l)})})]})}function em({colors:e,selectedColor:s,onColorSelect:n,columns:a=4}){return t.jsx("div",{className:"grid gap-2",style:{gridTemplateColumns:`repeat(${a}, minmax(0, 1fr))`},children:e.map(r=>{const i=s===r;return t.jsx("button",{type:"button",onClick:()=>n(r),className:`
|
|
7
|
+
`}const de={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:Te.semantic.danger,"danger-icon":"#F3D3CF","info-fill":"#EAF1FC",info:"#1D4FA8","violet-fill":"#F1ECFB",violet:"#6D28D9","neutral-fill":"#F4F4F5",neutral:"#52525B",destructive:"#A32D2D"};({...de});const ei=h.createContext(void 0);function ti(){return h.useContext(ei)}function od({children:e,closeLabel:s,locale:n,reducedMotion:a="user"}){const r=ti();return t.jsx(c.HeroUIProvider,{locale:n,reducedMotion:a,children:t.jsx(ei.Provider,{value:s??r,children:e})})}const si="(prefers-reduced-motion: reduce)",ni="data-pos-reduce-motion",ke="motion-reduce:transition-none [html[data-pos-reduce-motion=true]_&]:transition-none",zn="motion-reduce:animate-none [html[data-pos-reduce-motion=true]_&]:animate-none",js=`rounded-[0.375rem] bg-[linear-gradient(90deg,#F0F0F1_0,#F9F9FA_12.5rem,#F0F0F1_25rem)] bg-[length:50rem_100%] animate-record-shimmer ${zn}`;function cd(){return typeof document>"u"?!1:document.documentElement.getAttribute(ni)==="true"?!0:typeof window.matchMedia=="function"&&window.matchMedia(si).matches}function Is(){const[e,s]=h.useState(!1);return h.useEffect(()=>{const n=()=>s(cd()),a=typeof window.matchMedia=="function"?window.matchMedia(si):null;a?.addEventListener?.("change",n);const r=typeof MutationObserver>"u"?null:new MutationObserver(n);return r?.observe(document.documentElement,{attributes:!0,attributeFilter:[ni]}),n(),()=>{a?.removeEventListener?.("change",n),r?.disconnect()}},[]),e}const dd="whitespace-normal overflow-visible text-clip break-words",zt={base:"gap-x-2 sm:w-auto sm:min-w-[356px] sm:max-w-[min(32rem,calc(100vw_-_11rem))]",closeButton:"relative inset-auto self-start shrink-0 -my-3 -me-3 h-11 w-11 min-w-11 opacity-100",closeIcon:"h-6 w-6",title:`${dd} me-0`,description:"me-0"};function ud(e){return{...e,base:c.cn(zt.base,e?.base),closeButton:c.cn(zt.closeButton,e?.closeButton),closeIcon:c.cn(zt.closeIcon,e?.closeIcon),title:c.cn(zt.title,e?.title),description:c.cn(zt.description,e?.description)}}function md({toastProps:e,disableAnimation:s,...n}){const a=Is();return t.jsx(c.ToastProvider,{...n,disableAnimation:s??(a||void 0),toastProps:{...e,classNames:ud(e?.classNames)}})}const ai=h.createContext("default");function Os(){return h.useContext(ai)}function fd(e){return Os()==="touch"?"lg":e}function pd({density:e,children:s}){return t.jsx(ai.Provider,{value:e,children:s})}function xd(e,s){const n=e.icons,a=e.aliases||Object.create(null),r=Object.create(null);function i(o){if(n[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(n).concat(Object.keys(a)).forEach(i),r}const ri=Object.freeze({left:0,top:0,width:16,height:16}),$s=Object.freeze({rotate:0,vFlip:!1,hFlip:!1}),Vn=Object.freeze({...ri,...$s}),jn=Object.freeze({...Vn,body:"",hidden:!1});function hd(e,s){const n={};!e.hFlip!=!s.hFlip&&(n.hFlip=!0),!e.vFlip!=!s.vFlip&&(n.vFlip=!0);const a=((e.rotate||0)+(s.rotate||0))%4;return a&&(n.rotate=a),n}function Ia(e,s){const n=hd(e,s);for(const a in jn)a in $s?a in e&&!(a in n)&&(n[a]=$s[a]):a in s?n[a]=s[a]:a in e&&(n[a]=e[a]);return n}function bd(e,s,n){const a=e.icons,r=e.aliases||Object.create(null);let i={};function o(l){i=Ia(a[l]||r[l],i)}return o(s),n.forEach(o),Ia(e,i)}function ii(e,s){const n=[];if(typeof e!="object"||typeof e.icons!="object")return n;e.not_found instanceof Array&&e.not_found.forEach(r=>{s(r,null),n.push(r)});const a=xd(e);for(const r in a){const i=a[r];i&&(s(r,bd(e,r,i)),n.push(r))}return n}const gd={provider:"",aliases:{},not_found:{},...ri};function Zs(e,s){for(const n in s)if(n in e&&typeof e[n]!=typeof s[n])return!1;return!0}function li(e){if(typeof e!="object"||e===null)return null;const s=e;if(typeof s.prefix!="string"||!e.icons||typeof e.icons!="object"||!Zs(e,gd))return null;const n=s.icons;for(const r in n){const i=n[r];if(!r||typeof i.body!="string"||!Zs(i,jn))return null}const a=s.aliases||Object.create(null);for(const r in a){const i=a[r],o=i.parent;if(!r||typeof o!="string"||!n[o]&&!a[o]||!Zs(i,jn))return null}return s}const Oa=Object.create(null);function yd(e,s){return{provider:e,prefix:s,icons:Object.create(null),missing:new Set}}function Pt(e,s){const n=Oa[e]||(Oa[e]=Object.create(null));return n[s]||(n[s]=yd(e,s))}function oi(e,s){return li(s)?ii(s,(n,a)=>{a?e.icons[n]=a:e.missing.add(n)}):[]}function vd(e,s,n){try{if(typeof n.body=="string")return e.icons[s]={...n},!0}catch{}return!1}const ci=/^[a-z0-9]+(-[a-z0-9]+)*$/,Bs=(e,s,n,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 s&&!ws(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 s&&!ws(l)?null:l}if(n&&a===""){const l={provider:a,prefix:"",name:i};return s&&!ws(l,n)?null:l}return null},ws=(e,s)=>e?!!((s&&e.prefix===""||e.prefix)&&e.name):!1;let ns=!1;function di(e){return typeof e=="boolean"&&(ns=e),ns}function Ba(e){const s=typeof e=="string"?Bs(e,!0,ns):e;if(s){const n=Pt(s.provider,s.prefix),a=s.name;return n.icons[a]||(n.missing.has(a)?null:void 0)}}function jd(e,s){const n=Bs(e,!0,ns);if(!n)return!1;const a=Pt(n.provider,n.prefix);return s?vd(a,n.name,s):(a.missing.add(n.name),!0)}function wd(e,s){if(typeof e!="object")return!1;if(typeof s!="string"&&(s=e.provider||""),ns&&!s&&!e.prefix){let r=!1;return li(e)&&(e.prefix="",ii(e,(i,o)=>{jd(i,o)&&(r=!0)})),r}const n=e.prefix;if(!ws({prefix:n,name:"a"}))return!1;const a=Pt(s,n);return!!oi(a,e)}const ui=Object.freeze({width:null,height:null}),mi=Object.freeze({...ui,...$s}),Nd=/(-?[0-9.]*[0-9]+[0-9.]*)/g,Cd=/^-?[0-9.]*[0-9]+[0-9.]*$/g;function za(e,s,n){if(s===1)return e;if(n=n||100,typeof e=="number")return Math.ceil(e*s*n)/n;if(typeof e!="string")return e;const a=e.split(Nd);if(a===null||!a.length)return e;const r=[];let i=a.shift(),o=Cd.test(i);for(;;){if(o){const l=parseFloat(i);isNaN(l)?r.push(i):r.push(Math.ceil(l*s*n)/n)}else r.push(i);if(i=a.shift(),i===void 0)return r.join("");o=!o}}function kd(e,s="defs"){let n="";const a=e.indexOf("<"+s);for(;a>=0;){const r=e.indexOf(">",a),i=e.indexOf("</"+s);if(r===-1||i===-1)break;const o=e.indexOf(">",i);if(o===-1)break;n+=e.slice(r+1,i).trim(),e=e.slice(0,a).trim()+e.slice(o+1)}return{defs:n,content:e}}function Sd(e,s){return e?"<defs>"+e+"</defs>"+s:s}function $d(e,s,n){const a=kd(e);return Sd(a.defs,s+a.content+n)}const Ad=e=>e==="unset"||e==="undefined"||e==="none";function Dd(e,s){const n={...Vn,...e},a={...mi,...s},r={left:n.left,top:n.top,width:n.width,height:n.height};let i=n.body;[n,a].forEach(v=>{const g=[],y=v.hFlip,w=v.vFlip;let k=v.rotate;y?w?k+=2:(g.push("translate("+(r.width+r.left).toString()+" "+(0-r.top).toString()+")"),g.push("scale(-1 1)"),r.top=r.left=0):w&&(g.push("translate("+(0-r.left).toString()+" "+(r.height+r.top).toString()+")"),g.push("scale(1 -1)"),r.top=r.left=0);let N;switch(k<0&&(k-=Math.floor(k/4)*4),k=k%4,k){case 1:N=r.height/2+r.top,g.unshift("rotate(90 "+N.toString()+" "+N.toString()+")");break;case 2:g.unshift("rotate(180 "+(r.width/2+r.left).toString()+" "+(r.height/2+r.top).toString()+")");break;case 3:N=r.width/2+r.left,g.unshift("rotate(-90 "+N.toString()+" "+N.toString()+")");break}k%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)),g.length&&(i=$d(i,'<g transform="'+g.join(" ")+'">',"</g>"))});const o=a.width,l=a.height,d=r.width,u=r.height;let p,m;o===null?(m=l===null?"1em":l==="auto"?u:l,p=za(m,d/u)):(p=o==="auto"?d:o,m=l===null?za(p,u/d):l==="auto"?u:l);const x={},f=(v,g)=>{Ad(g)||(x[v]=g.toString())};f("width",p),f("height",m);const b=[r.left,r.top,d,u];return x.viewBox=b.join(" "),{attributes:x,viewBox:b,body:i}}const Ed=/\sid="(\S+)"/g,Ld="IconifyId"+Date.now().toString(16)+(Math.random()*16777216|0).toString(16);let Fd=0;function _d(e,s=Ld){const n=[];let a;for(;a=Ed.exec(e);)n.push(a[1]);if(!n.length)return e;const r="suffix"+(Math.random()*16777216|Date.now()).toString(16);return n.forEach(i=>{const o=typeof s=="function"?s(i):s+(Fd++).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 wn=Object.create(null);function Rd(e,s){wn[e]=s}function Nn(e){return wn[e]||wn[""]}function Un(e){let s;if(typeof e.resources=="string")s=[e.resources];else if(s=e.resources,!(s instanceof Array)||!s.length)return null;return{resources:s,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 Hn=Object.create(null),Vt=["https://api.simplesvg.com","https://api.unisvg.com"],Ns=[];for(;Vt.length>0;)Vt.length===1||Math.random()>.5?Ns.push(Vt.shift()):Ns.push(Vt.pop());Hn[""]=Un({resources:["https://api.iconify.design"].concat(Ns)});function Md(e,s){const n=Un(s);return n===null?!1:(Hn[e]=n,!0)}function Wn(e){return Hn[e]}const Pd=()=>{let e;try{if(e=fetch,typeof e=="function")return e}catch{}};let Va=Pd();function Td(e,s){const n=Wn(e);if(!n)return 0;let a;if(!n.maxURL)a=0;else{let r=0;n.resources.forEach(o=>{r=Math.max(r,o.length)});const i=s+".json?icons=";a=n.maxURL-r-n.path.length-i.length}return a}function Id(e){return e===404}const Od=(e,s,n)=>{const a=[],r=Td(e,s),i="icons";let o={type:i,provider:e,prefix:s,icons:[]},l=0;return n.forEach((d,u)=>{l+=d.length+1,l>=r&&u>0&&(a.push(o),o={type:i,provider:e,prefix:s,icons:[]},l=d.length),o.icons.push(d)}),a.push(o),a};function Bd(e){if(typeof e=="string"){const s=Wn(e);if(s)return s.path}return"/"}const zd=(e,s,n)=>{if(!Va){n("abort",424);return}let a=Bd(s.provider);switch(s.type){case"icons":{const i=s.prefix,l=s.icons.join(","),d=new URLSearchParams({icons:l});a+=i+".json?"+d.toString();break}case"custom":{const i=s.uri;a+=i.slice(0,1)==="/"?i.slice(1):i;break}default:n("abort",400);return}let r=503;Va(e+a).then(i=>{const o=i.status;if(o!==200){setTimeout(()=>{n(Id(o)?"abort":"next",o)});return}return r=501,i.json()}).then(i=>{if(typeof i!="object"||i===null){setTimeout(()=>{i===404?n("abort",i):n("next",r)});return}setTimeout(()=>{n("success",i)})}).catch(()=>{n("next",r)})},Vd={prepare:Od,send:zd};function fi(e,s){e.forEach(n=>{const a=n.loaderCallbacks;a&&(n.loaderCallbacks=a.filter(r=>r.id!==s))})}function Ud(e){e.pendingCallbacksFlag||(e.pendingCallbacksFlag=!0,setTimeout(()=>{e.pendingCallbacksFlag=!1;const s=e.loaderCallbacks?e.loaderCallbacks.slice(0):[];if(!s.length)return;let n=!1;const a=e.provider,r=e.prefix;s.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 n=!0,!0;return!1}),o.pending.length!==l&&(n||fi([e],i.id),i.callback(o.loaded.slice(0),o.missing.slice(0),o.pending.slice(0),i.abort))})}))}let Hd=0;function Wd(e,s,n){const a=Hd++,r=fi.bind(null,n,a);if(!s.pending.length)return r;const i={id:a,icons:s,callback:e,abort:r};return n.forEach(o=>{(o.loaderCallbacks||(o.loaderCallbacks=[])).push(i)}),r}function qd(e){const s={loaded:[],missing:[],pending:[]},n=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=n[i]||(n[i]=Object.create(null)),u=d[o]||(d[o]=Pt(i,o));let p;l in u.icons?p=s.loaded:o===""||u.missing.has(l)?p=s.missing:p=s.pending;const m={provider:i,prefix:o,name:l};p.push(m)}),s}function Gd(e,s=!0,n=!1){const a=[];return e.forEach(r=>{const i=typeof r=="string"?Bs(r,s,n):r;i&&a.push(i)}),a}const Kd={resources:[],index:0,timeout:2e3,rotate:750,random:!1,dataAfterTimeout:!1};function Yd(e,s,n,a){const r=e.resources.length,i=e.random?Math.floor(Math.random()*r):e.index;let o;if(e.random){let E=e.resources.slice(0);for(o=[];E.length>1;){const j=Math.floor(Math.random()*E.length);o.push(E[j]),E=E.slice(0,j).concat(E.slice(j+1))}o=o.concat(E)}else o=e.resources.slice(i).concat(e.resources.slice(0,i));const l=Date.now();let d="pending",u=0,p,m=null,x=[],f=[];typeof a=="function"&&f.push(a);function b(){m&&(clearTimeout(m),m=null)}function v(){d==="pending"&&(d="aborted"),b(),x.forEach(E=>{E.status==="pending"&&(E.status="aborted")}),x=[]}function g(E,j){j&&(f=[]),typeof E=="function"&&f.push(E)}function y(){return{startTime:l,payload:s,status:d,queriesSent:u,queriesPending:x.length,subscribe:g,abort:v}}function w(){d="failed",f.forEach(E=>{E(void 0,p)})}function k(){x.forEach(E=>{E.status==="pending"&&(E.status="aborted")}),x=[]}function N(E,j,L){const S=j!=="success";switch(x=x.filter(M=>M!==E),d){case"pending":break;case"failed":if(S||!e.dataAfterTimeout)return;break;default:return}if(j==="abort"){p=L,w();return}if(S){p=L,x.length||(o.length?$():w());return}if(b(),k(),!e.random){const M=e.resources.indexOf(E.resource);M!==-1&&M!==e.index&&(e.index=M)}d="completed",f.forEach(M=>{M(L)})}function $(){if(d!=="pending")return;b();const E=o.shift();if(E===void 0){if(x.length){m=setTimeout(()=>{b(),d==="pending"&&(k(),w())},e.timeout);return}w();return}const j={status:"pending",resource:E,callback:(L,S)=>{N(j,L,S)}};x.push(j),u++,m=setTimeout($,e.rotate),n(E,s,j.callback)}return setTimeout($),y}function pi(e){const s={...Kd,...e};let n=[];function a(){n=n.filter(l=>l().status==="pending")}function r(l,d,u){const p=Yd(s,l,d,(m,x)=>{a(),u&&u(m,x)});return n.push(p),p}function i(l){return n.find(d=>l(d))||null}return{query:r,find:i,setIndex:l=>{s.index=l},getIndex:()=>s.index,cleanup:a}}function Ua(){}const Xs=Object.create(null);function Qd(e){if(!Xs[e]){const s=Wn(e);if(!s)return;const n=pi(s),a={config:s,redundancy:n};Xs[e]=a}return Xs[e]}function Zd(e,s,n){let a,r;if(typeof e=="string"){const i=Nn(e);if(!i)return n(void 0,424),Ua;r=i.send;const o=Qd(e);o&&(a=o.redundancy)}else{const i=Un(e);if(i){a=pi(i);const o=e.resources?e.resources[0]:"",l=Nn(o);l&&(r=l.send)}}return!a||!r?(n(void 0,424),Ua):a.query(s,r,n)().abort}function Ha(){}function Xd(e){e.iconsLoaderFlag||(e.iconsLoaderFlag=!0,setTimeout(()=>{e.iconsLoaderFlag=!1,Ud(e)}))}function Jd(e){const s=[],n=[];return e.forEach(a=>{(a.match(ci)?s:n).push(a)}),{valid:s,invalid:n}}function Ut(e,s,n){function a(){const r=e.pendingIcons;s.forEach(i=>{r&&r.delete(i),e.icons[i]||e.missing.add(i)})}if(n&&typeof n=="object")try{if(!oi(e,n).length){a();return}}catch(r){console.error(r)}a(),Xd(e)}function Wa(e,s){e instanceof Promise?e.then(n=>{s(n)}).catch(()=>{s(null)}):s(e)}function eu(e,s){e.iconsToLoad?e.iconsToLoad=e.iconsToLoad.concat(s).sort():e.iconsToLoad=s,e.iconsQueueFlag||(e.iconsQueueFlag=!0,setTimeout(()=>{e.iconsQueueFlag=!1;const{provider:n,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,n),p=>{Ut(e,r,p)});return}if(i){r.forEach(p=>{const m=i(p,a,n);Wa(m,x=>{const f=x?{prefix:a,icons:{[p]:x}}:null;Ut(e,[p],f)})});return}const{valid:o,invalid:l}=Jd(r);if(l.length&&Ut(e,l,null),!o.length)return;const d=a.match(ci)?Nn(n):null;if(!d){Ut(e,o,null);return}d.prepare(n,a,o).forEach(p=>{Zd(n,p,m=>{Ut(e,p.icons,m)})})}))}const tu=(e,s)=>{const n=Gd(e,!0,di()),a=qd(n);if(!a.pending.length){let d=!0;return s&&setTimeout(()=>{d&&s(a.loaded,a.missing,a.pending,Ha)}),()=>{d=!1}}const r=Object.create(null),i=[];let o,l;return a.pending.forEach(d=>{const{provider:u,prefix:p}=d;if(p===l&&u===o)return;o=u,l=p,i.push(Pt(u,p));const m=r[u]||(r[u]=Object.create(null));m[p]||(m[p]=[])}),a.pending.forEach(d=>{const{provider:u,prefix:p,name:m}=d,x=Pt(u,p),f=x.pendingIcons||(x.pendingIcons=new Set);f.has(m)||(f.add(m),r[u][p].push(m))}),i.forEach(d=>{const u=r[d.provider][d.prefix];u.length&&eu(d,u)}),s?Wd(s,a,i):Ha};function su(e,s){const n={...e};for(const a in s){const r=s[a],i=typeof r;a in ui?(r===null||r&&(i==="string"||i==="number"))&&(n[a]=r):i===typeof n[a]&&(n[a]=a==="rotate"?r%4:r)}return n}const nu=/[\s,]+/;function au(e,s){s.split(nu).forEach(n=>{switch(n.trim()){case"horizontal":e.hFlip=!0;break;case"vertical":e.vFlip=!0;break}})}function ru(e,s=0){const n=e.replace(/^-?[0-9.]*/,"");function a(r){for(;r<0;)r+=4;return r%4}if(n===""){const r=parseInt(e);return isNaN(r)?0:a(r)}else if(n!==e){let r=0;switch(n){case"%":r=25;break;case"deg":r=90}if(r){let i=parseFloat(e.slice(0,e.length-n.length));return isNaN(i)?0:(i=i/r,i%1===0?a(i):0)}}return s}function iu(e,s){let n=e.indexOf("xlink:")===-1?"":' xmlns:xlink="http://www.w3.org/1999/xlink"';for(const a in s)n+=" "+a+'="'+s[a]+'"';return'<svg xmlns="http://www.w3.org/2000/svg"'+n+">"+e+"</svg>"}function lu(e){return e.replace(/"/g,"'").replace(/%/g,"%25").replace(/#/g,"%23").replace(/</g,"%3C").replace(/>/g,"%3E").replace(/\s+/g," ")}function ou(e){return"data:image/svg+xml,"+lu(e)}function cu(e){return'url("'+ou(e)+'")'}let es;function du(){try{es=window.trustedTypes.createPolicy("iconify",{createHTML:e=>e})}catch{es=null}}function uu(e){return es===void 0&&du(),es?es.createHTML(e):e}const xi={...mi,inline:!1},mu={xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink","aria-hidden":!0,role:"img"},fu={display:"inline-block"},Cn={backgroundColor:"currentColor"},hi={backgroundColor:"transparent"},qa={Image:"var(--svg)",Repeat:"no-repeat",Size:"100% 100%"},Ga={WebkitMask:Cn,mask:Cn,background:hi};for(const e in Ga){const s=Ga[e];for(const n in qa)s[e+n]=qa[n]}const pu={...xi,inline:!0};function Ka(e){return e+(e.match(/^[-0-9.]+$/)?"px":"")}const xu=(e,s,n)=>{const a=s.inline?pu:xi,r=su(a,s),i=s.mode||"svg",o={},l=s.style||{},d={...i==="svg"?mu:{}};if(n){const g=Bs(n,!1,!0);if(g){const y=["iconify"],w=["provider","prefix"];for(const k of w)g[k]&&y.push("iconify--"+g[k]);d.className=y.join(" ")}}for(let g in s){const y=s[g];if(y!==void 0)switch(g){case"icon":case"style":case"children":case"onLoad":case"mode":case"ssr":case"fallback":break;case"_ref":d.ref=y;break;case"className":d[g]=(d[g]?d[g]+" ":"")+y;break;case"inline":case"hFlip":case"vFlip":r[g]=y===!0||y==="true"||y===1;break;case"flip":typeof y=="string"&&au(r,y);break;case"color":o.color=y;break;case"rotate":typeof y=="string"?r[g]=ru(y):typeof y=="number"&&(r[g]=y);break;case"ariaHidden":case"aria-hidden":y!==!0&&y!=="true"&&delete d["aria-hidden"];break;default:a[g]===void 0&&(d[g]=y)}}const u=Dd(e,r),p=u.attributes;if(r.inline&&(o.verticalAlign="-0.125em"),i==="svg"){d.style={...o,...l},Object.assign(d,p);let g=0,y=s.id;return typeof y=="string"&&(y=y.replace(/-/g,"_")),d.dangerouslySetInnerHTML={__html:uu(_d(u.body,y?()=>y+"ID"+g++:"iconifyReact"))},h.createElement("svg",d)}const{body:m,width:x,height:f}=e,b=i==="mask"||(i==="bg"?!1:m.indexOf("currentColor")!==-1),v=iu(m,{...p,width:x+"",height:f+""});return d.style={...o,"--svg":cu(v),width:Ka(p.width),height:Ka(p.height),...fu,...b?Cn:hi,...l},h.createElement("span",d)};di(!0);Rd("",Vd);if(typeof document<"u"&&typeof window<"u"){const e=window;if(e.IconifyPreload!==void 0){const s=e.IconifyPreload,n="Invalid IconifyPreload syntax.";typeof s=="object"&&s!==null&&(s instanceof Array?s:[s]).forEach(a=>{try{(typeof a!="object"||a===null||a instanceof Array||typeof a.icons!="object"||typeof a.prefix!="string"||!wd(a))&&console.error(n)}catch{console.error(n)}})}if(e.IconifyProviders!==void 0){const s=e.IconifyProviders;if(typeof s=="object"&&s!==null)for(let n in s){const a="IconifyProviders["+n+"] is invalid.";try{const r=s[n];if(typeof r!="object"||!r||r.resources===void 0)continue;Md(n,r)||console.error(a)}catch{console.error(a)}}}}function bi(e){const[s,n]=h.useState(!!e.ssr),[a,r]=h.useState({});function i(f){if(f){const b=e.icon;if(typeof b=="object")return{name:"",data:b};const v=Ba(b);if(v)return{name:b,data:v}}return{name:""}}const[o,l]=h.useState(i(!!e.ssr));function d(){const f=a.callback;f&&(f(),r({}))}function u(f){if(JSON.stringify(o)!==JSON.stringify(f))return d(),l(f),!0}function p(){var f;const b=e.icon;if(typeof b=="object"){u({name:"",data:b});return}const v=Ba(b);if(u({name:b,data:v}))if(v===void 0){const g=tu([b],p);r({callback:g})}else v&&((f=e.onLoad)===null||f===void 0||f.call(e,b))}h.useEffect(()=>(n(!0),d),[]),h.useEffect(()=>{s&&p()},[e.icon,s]);const{name:m,data:x}=o;return x?xu({...Vn,...x},e,m):e.children?e.children:e.fallback?e.fallback:h.createElement("span",{})}const P=h.forwardRef((e,s)=>bi({...e,_ref:s}));h.forwardRef((e,s)=>bi({inline:!0,...e,_ref:s}));const O=h.forwardRef(({color:e="primary",radius:s="full",testId:n="veevart-button",...a},r)=>t.jsx(c.Button,{ref:r,color:e,radius:s,"data-testid":n,...a}));O.displayName="Button";function gi({code:e,amount:s,onRemove:n,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:s})]}),t.jsx(O,{testId:`${i}-remove`,isIconOnly:!0,size:"sm",variant:"light","aria-label":r,onPress:n,children:t.jsx(P,{icon:"solar:close-circle-linear",className:"size-4","aria-hidden":"true"})})]})})}function Js(e,s){return e-s*Math.floor(e/s)}const yi=1721426;function ps(e,s,n,a){s=qn(e,s);let r=s-1,i=-2;return n<=2?i=0:Cs(s)&&(i=-1),yi-1+365*r+Math.floor(r/4)-Math.floor(r/100)+Math.floor(r/400)+Math.floor((367*n-362)/12+i+a)}function Cs(e){return e%4===0&&(e%100!==0||e%400===0)}function qn(e,s){return e==="BC"?1-s:s}function hu(e){let s="AD";return e<=0&&(s="BC",e=1-e),[s,e]}const bu={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 zs{fromJulianDay(s){let n=s,a=n-yi,r=Math.floor(a/146097),i=Js(a,146097),o=Math.floor(i/36524),l=Js(i,36524),d=Math.floor(l/1461),u=Js(l,1461),p=Math.floor(u/365),m=r*400+o*100+d*4+p+(o!==4&&p!==4?1:0),[x,f]=hu(m),b=n-ps(x,f,1,1),v=2;n<ps(x,f,3,1)?v=0:Cs(f)&&(v=1);let g=Math.floor(((b+v)*12+373)/367),y=n-ps(x,f,g,1)+1;return new as(x,f,g,y)}toJulianDay(s){return ps(s.era,s.year,s.month,s.day)}getDaysInMonth(s){return bu[Cs(s.year)?"leapyear":"standard"][s.month-1]}getMonthsInYear(s){return 12}getDaysInYear(s){return Cs(s.year)?366:365}getMaximumMonthsInYear(){return 12}getMaximumDaysInMonth(){return 31}getYearsInEra(s){return 9999}getEras(){return["BC","AD"]}isInverseEra(s){return s.era==="BC"}balanceDate(s){s.year<=0&&(s.era=s.era==="BC"?"AD":"BC",s.year=1-s.year)}constructor(){this.identifier="gregory"}}function gu(e,s){var n,a,r,i;return(i=(r=(n=e.isEqual)===null||n===void 0?void 0:n.call(e,s))!==null&&r!==void 0?r:(a=s.isEqual)===null||a===void 0?void 0:a.call(s,e))!==null&&i!==void 0?i:e.identifier===s.identifier}function vi(e,s){return e.calendar.toJulianDay(e)-s.calendar.toJulianDay(s)}function ji(e,s){return Ya(e)-Ya(s)}function Ya(e){return e.hour*36e5+e.minute*6e4+e.second*1e3+e.millisecond}let en=null;function wi(){return en==null&&(en=new Intl.DateTimeFormat().resolvedOptions().timeZone),en}function Qa(e){e=Gn(e,new zs);let s=qn(e.era,e.year);return Ni(s,e.month,e.day,e.hour,e.minute,e.second,e.millisecond)}function Ni(e,s,n,a,r,i,o){let l=new Date;return l.setUTCHours(a,r,i,o),l.setUTCFullYear(e,s-1,n),l.getTime()}function Za(e,s){if(s==="UTC")return 0;if(e>0&&s===wi())return new Date(e).getTimezoneOffset()*-6e4;let{year:n,month:a,day:r,hour:i,minute:o,second:l}=Ci(e,s);return Ni(n,a,r,i,o,l,0)-Math.floor(e/1e3)*1e3}const Xa=new Map;function Ci(e,s){let n=Xa.get(s);n||(n=new Intl.DateTimeFormat("en-US",{timeZone:s,hour12:!1,era:"short",year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric"}),Xa.set(s,n));let a=n.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 Ja=864e5;function yu(e,s,n,a){return(n===a?[n]:[n,a]).filter(i=>vu(e,s,i))}function vu(e,s,n){let a=Ci(n,s);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 ju(e,s,n="compatible"){let a=Si(e);if(s==="UTC")return Qa(a);if(s===wi()&&n==="compatible"){a=Gn(a,new zs);let d=new Date,u=qn(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=Qa(a),i=Za(r-Ja,s),o=Za(r+Ja,s),l=yu(a,s,r-i,r-o);if(l.length===1)return l[0];if(l.length>1)switch(n){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(n){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 ki(e,s,n="compatible"){return new Date(ju(e,s,n))}function Si(e,s){let n=0,a=0,r=0,i=0;if("timeZone"in e)({hour:n,minute:a,second:r,millisecond:i}=e);else if("hour"in e&&!s)return e;return s&&({hour:n,minute:a,second:r,millisecond:i}=s),new As(e.calendar,e.era,e.year,e.month,e.day,n,a,r,i)}function Gn(e,s){if(gu(e.calendar,s))return e;let n=s.fromJulianDay(e.calendar.toJulianDay(e)),a=e.copy();return a.calendar=s,a.era=n.era,a.year=n.year,a.month=n.month,a.day=n.day,Tt(a),a}function Kn(e,s){let n=e.copy(),a="hour"in n?_i(n,s):0;kn(n,s.years||0),n.calendar.balanceYearMonth&&n.calendar.balanceYearMonth(n,e),n.month+=s.months||0,Sn(n),$i(n),n.day+=(s.weeks||0)*7,n.day+=s.days||0,n.day+=a,wu(n),n.calendar.balanceDate&&n.calendar.balanceDate(n),n.year<1&&(n.year=1,n.month=1,n.day=1);let r=n.calendar.getYearsInEra(n);if(n.year>r){var i,o;let d=(i=(o=n.calendar).isInverseEra)===null||i===void 0?void 0:i.call(o,n);n.year=r,n.month=d?1:n.calendar.getMonthsInYear(n),n.day=d?1:n.calendar.getDaysInMonth(n)}n.month<1&&(n.month=1,n.day=1);let l=n.calendar.getMonthsInYear(n);return n.month>l&&(n.month=l,n.day=n.calendar.getDaysInMonth(n)),n.day=Math.max(1,Math.min(n.calendar.getDaysInMonth(n),n.day)),n}function kn(e,s){var n,a;!((n=(a=e.calendar).isInverseEra)===null||n===void 0)&&n.call(a,e)&&(s=-s),e.year+=s}function Sn(e){for(;e.month<1;)kn(e,-1),e.month+=e.calendar.getMonthsInYear(e);let s=0;for(;e.month>(s=e.calendar.getMonthsInYear(e));)e.month-=s,kn(e,1)}function wu(e){for(;e.day<1;)e.month--,Sn(e),e.day+=e.calendar.getDaysInMonth(e);for(;e.day>e.calendar.getDaysInMonth(e);)e.day-=e.calendar.getDaysInMonth(e),e.month++,Sn(e)}function $i(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 Tt(e){e.calendar.constrainDate&&e.calendar.constrainDate(e),e.year=Math.max(1,Math.min(e.calendar.getYearsInEra(e),e.year)),$i(e)}function Ai(e){let s={};for(let n in e)typeof e[n]=="number"&&(s[n]=-e[n]);return s}function Di(e,s){return Kn(e,Ai(s))}function Ei(e,s){let n=e.copy();return s.era!=null&&(n.era=s.era),s.year!=null&&(n.year=s.year),s.month!=null&&(n.month=s.month),s.day!=null&&(n.day=s.day),Tt(n),n}function Li(e,s){let n=e.copy();return s.hour!=null&&(n.hour=s.hour),s.minute!=null&&(n.minute=s.minute),s.second!=null&&(n.second=s.second),s.millisecond!=null&&(n.millisecond=s.millisecond),Fi(n),n}function Nu(e){e.second+=Math.floor(e.millisecond/1e3),e.millisecond=xs(e.millisecond,1e3),e.minute+=Math.floor(e.second/60),e.second=xs(e.second,60),e.hour+=Math.floor(e.minute/60),e.minute=xs(e.minute,60);let s=Math.floor(e.hour/24);return e.hour=xs(e.hour,24),s}function Fi(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 xs(e,s){let n=e%s;return n<0&&(n+=s),n}function _i(e,s){return e.hour+=s.hours||0,e.minute+=s.minutes||0,e.second+=s.seconds||0,e.millisecond+=s.milliseconds||0,Nu(e)}function Ri(e,s){let n=e.copy();return _i(n,s),n}function Cu(e,s){return Ri(e,Ai(s))}function Mi(e,s,n,a){let r=e.copy();switch(s){case"era":{let l=e.calendar.getEras(),d=l.indexOf(e.era);if(d<0)throw new Error("Invalid era: "+e.era);d=bt(d,n,0,l.length-1,a?.round),r.era=l[d],Tt(r);break}case"year":var i,o;!((i=(o=r.calendar).isInverseEra)===null||i===void 0)&&i.call(o,r)&&(n=-n),r.year=bt(e.year,n,-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=bt(e.month,n,1,e.calendar.getMonthsInYear(e),a?.round);break;case"day":r.day=bt(e.day,n,1,e.calendar.getDaysInMonth(e),a?.round);break;default:throw new Error("Unsupported field "+s)}return e.calendar.balanceDate&&e.calendar.balanceDate(r),Tt(r),r}function Pi(e,s,n,a){let r=e.copy();switch(s){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=bt(i,n,o,l,a?.round);break}case"minute":r.minute=bt(e.minute,n,0,59,a?.round);break;case"second":r.second=bt(e.second,n,0,59,a?.round);break;case"millisecond":r.millisecond=bt(e.millisecond,n,0,999,a?.round);break;default:throw new Error("Unsupported field "+s)}return r}function bt(e,s,n,a,r=!1){if(r){e+=Math.sign(s),e<n&&(e=a);let i=Math.abs(s);s>0?e=Math.ceil(e/i)*i:e=Math.floor(e/i)*i,e>a&&(e=n)}else e+=s,e<n?e=a-(n-e-1):e>a&&(e=n+(e-a-1));return e}const ku=/^([+-]\d{6}|\d{4})-(\d{2})-(\d{2})$/,Su=/^([+-]\d{6}|\d{4})-(\d{2})-(\d{2})(?:T(\d{2}))?(?::(\d{2}))?(?::(\d{2}))?(\.\d+)?(?:(?:([+-]\d{2})(?::?(\d{2}))?)|Z)$/;function $u(e){let s=e.match(ku);if(!s)throw Su.test(e)?new Error(`Invalid ISO 8601 date string: ${e}. Use parseAbsolute() instead.`):new Error("Invalid ISO 8601 date string: "+e);let n=new as(tn(s[1],0,9999),tn(s[2],1,12),1);return n.day=tn(s[3],1,n.calendar.getDaysInMonth(n)),n}function tn(e,s,n){let a=Number(e);if(a<s||a>n)throw new RangeError(`Value out of range: ${s} <= ${a} <= ${n}`);return a}function Ti(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 Ii(e){let s=Gn(e,new zs),n;return s.era==="BC"?n=s.year===1?"0000":"-"+String(Math.abs(1-s.year)).padStart(6,"00"):n=String(s.year).padStart(4,"0"),`${n}-${String(s.month).padStart(2,"0")}-${String(s.day).padStart(2,"0")}`}function Au(e){return`${Ii(e)}T${Ti(e)}`}function Du(e,s){if(s.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function Yn(e,s,n){Du(e,s),s.set(e,n)}function Oi(e){let s=typeof e[0]=="object"?e.shift():new zs,n;if(typeof e[0]=="string")n=e.shift();else{let o=s.getEras();n=o[o.length-1]}let a=e.shift(),r=e.shift(),i=e.shift();return[s,n,a,r,i]}var Eu=new WeakMap;class as{copy(){return this.era?new as(this.calendar,this.era,this.year,this.month,this.day):new as(this.calendar,this.year,this.month,this.day)}add(s){return Kn(this,s)}subtract(s){return Di(this,s)}set(s){return Ei(this,s)}cycle(s,n,a){return Mi(this,s,n,a)}toDate(s){return ki(this,s)}toString(){return Ii(this)}compare(s){return vi(this,s)}constructor(...s){Yn(this,Eu,{writable:!0,value:void 0});let[n,a,r,i,o]=Oi(s);this.calendar=n,this.era=a,this.year=r,this.month=i,this.day=o,Tt(this)}}var Lu=new WeakMap;class Vs{copy(){return new Vs(this.hour,this.minute,this.second,this.millisecond)}add(s){return Ri(this,s)}subtract(s){return Cu(this,s)}set(s){return Li(this,s)}cycle(s,n,a){return Pi(this,s,n,a)}toString(){return Ti(this)}compare(s){return ji(this,s)}constructor(s=0,n=0,a=0,r=0){Yn(this,Lu,{writable:!0,value:void 0}),this.hour=s,this.minute=n,this.second=a,this.millisecond=r,Fi(this)}}var Fu=new WeakMap;class As{copy(){return this.era?new As(this.calendar,this.era,this.year,this.month,this.day,this.hour,this.minute,this.second,this.millisecond):new As(this.calendar,this.year,this.month,this.day,this.hour,this.minute,this.second,this.millisecond)}add(s){return Kn(this,s)}subtract(s){return Di(this,s)}set(s){return Ei(Li(this,s),s)}cycle(s,n,a){switch(s){case"era":case"year":case"month":case"day":return Mi(this,s,n,a);default:return Pi(this,s,n,a)}}toDate(s,n){return ki(this,s,n)}toString(){return Au(this)}compare(s){let n=vi(this,s);return n===0?ji(this,Si(s)):n}constructor(...s){Yn(this,Fu,{writable:!0,value:void 0});let[n,a,r,i,o]=Oi(s);this.calendar=n,this.era=a,this.year=r,this.month=i,this.day=o,this.hour=s.shift()||0,this.minute=s.shift()||0,this.second=s.shift()||0,this.millisecond=s.shift()||0,Tt(this)}}const _u={firstDayOfWeek:"mon",showMonthAndYearPickers:!0,markToday:!0},Ru="data-[today=true]:font-semibold data-[today=true]:ring-1 data-[today=true]:ring-inset data-[today=true]:ring-primary",Mu="Open time options",Pu=320;function $n(e,s){return typeof s=="string"&&s.length>0?`${e} ${s}`:e}function er(e,s){return s?{...e,classNames:{...e?.classNames,cellButton:$n(Ru,e?.classNames?.cellButton)}}:e}function sn(e){if(!e)return null;const s="hour"in e&&typeof e.hour=="number"?e.hour:0,n="minute"in e&&typeof e.minute=="number"?e.minute:0,a="second"in e&&typeof e.second=="number"?e.second:0;return new Vs(s,n,a)}function Tu(e,s){const n=new Date(2e3,0,1,e.hour,e.minute,e.second);return new Intl.DateTimeFormat("en-US",{hour:"numeric",minute:"2-digit",hour12:s===12}).format(n)}function Iu(e){const s=[];for(let n=0;n<24;n+=1)for(let a=0;a<60;a+=e)s.push(new Vs(n,a));return s}function Ou(e){const{minuteStep:s=15,timeListClassName:n,timeListLabel:a=Mu,selectorButtonProps:r,endContent:i,onChange:o,value:l,defaultValue:d,hourCycle:u=12,...p}=e,m=l!==void 0,[x,f]=h.useState(()=>sn(d)),b=m?sn(l):x,v=h.useMemo(()=>Iu(s),[s]),g=w=>{m||f(w),o?.(w)},y=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(te.Clock3,{className:"size-4",strokeWidth:1.75})})}),t.jsx(c.PopoverContent,{className:"min-w-[8.5rem] p-0",children:t.jsx(c.ScrollShadow,{className:n??"max-h-64 py-1",children:t.jsx("div",{className:"flex flex-col p-1",children:v.map(w=>{const k=b?.hour===w.hour&&b?.minute===w.minute;return t.jsx(c.Button,{variant:k?"flat":"light",color:k?"primary":"default",className:"h-9 min-w-0 justify-start px-3",onPress:()=>g(w),children:Tu(w,u)},`${w.hour}:${w.minute}`)})})})})]});return t.jsx(c.TimeInput,{...p,value:m?b:void 0,defaultValue:m?void 0:d,hourCycle:u,endContent:t.jsxs("div",{className:"flex items-center gap-1",children:[i,y]}),onChange:w=>g(sn(w))})}function Qn(e){if(e.mode==="time")return t.jsx(Ou,{...e});if(e.mode==="datetime"){const{mode:o,granularity:l="minute",hideTimeZone:d=!0,calendarWidth:u=Pu,disableAnimation:p=!0,classNames:m,markToday:x,calendarProps:f,...b}=e;return t.jsx(c.DatePicker,{...b,calendarProps:er(f,x),calendarWidth:u,classNames:{...m,popoverContent:$n("min-w-[20rem]",m?.popoverContent),calendarContent:$n("min-h-[18rem]",m?.calendarContent)},disableAnimation:p,granularity:l,hideTimeZone:d})}const{mode:s,granularity:n="day",markToday:a,calendarProps:r,...i}=e;return t.jsx(c.DatePicker,{...i,calendarProps:er(r,a),granularity:n})}function Bu({label:e,...s}){return t.jsx("button",{...s,"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 zu(e){return e!==void 0&&e.trim()!==""}function Bi(e,s){const n=ti();if(h.isValidElement(s))return s;const a=[e,n].find(zu);return a===void 0?void 0:t.jsx(Bu,{label:a})}const zi=h.forwardRef(({closeLabel:e,closeButton:s,...n},a)=>{const r=Bi(e,s);return t.jsx(c.Drawer,{ref:a,...n,closeButton:r})});zi.displayName="Drawer";const os=h.forwardRef(({closeLabel:e,closeButton:s,...n},a)=>{const r=Bi(e,s);return t.jsx(c.Modal,{ref:a,...n,closeButton:r})});os.displayName="Modal";function Vu(e){const s=e?.closest('[role="dialog"]');return s?.parentElement??s??void 0}const it=h.forwardRef(({popoverProps:e,...s},n)=>{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(Vu(a.current))},[]),t.jsx("span",{ref:a,className:"contents",children:t.jsx(c.Select,{ref:n,...s,popoverProps:u})})});it.displayName="Select";const Uu="motion-reduce:animate-none motion-reduce:transition-none motion-reduce:before:animate-none motion-reduce:before:transition-none motion-reduce:after:transition-none",oe=h.forwardRef(({classNames:e,...s},n)=>t.jsx(c.Skeleton,{ref:n,...s,classNames:{...e,base:c.cn(Uu,e?.base)}}));oe.displayName="Skeleton";const Hu="text-default-600 data-[hover=true]:text-default-700",Zn=h.forwardRef(({classNames:e,...s},n)=>t.jsx(c.Table,{ref:n,...s,classNames:{...e,th:c.cn(Hu,e?.th)}}));Zn.displayName="Table";function Wu({state:e,onSubmit:s,onRemove:n,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[p,m]=h.useState(""),x=h.useId(),[f,b]=h.useState(e);e!==f&&(b(e),e==="applied"&&m(""));const v=()=>{const w=p.trim();w&&s(w)},g=w=>{w.key==="Enter"&&(w.preventDefault(),v())};if(e==="applied"&&a)return t.jsx("div",{"data-testid":u,children:t.jsx(gi,{code:a.code,amount:a.amount,onRemove:n,removeAriaLabel:d,testId:`${u}-card`})});const y=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:p,onValueChange:m,onKeyDown:g,isDisabled:e==="loading",isInvalid:e==="error","aria-describedby":y?x:void 0}),t.jsx(O,{testId:`${u}-button`,isLoading:e==="loading",isDisabled:!p.trim(),onPress:v,children:l})]}),y&&t.jsx("p",{id:x,"data-testid":`${u}-error`,className:"text-tiny text-danger",children:r})]})}const qu={login:"Login",logout:"Logout",selectLanguage:"Select your language"};function Gu({languages:e,selectedLanguage:s,onLanguageChange:n,label:a}){const r=e.find(i=>i.code===s);return t.jsx("div",{className:"flex items-center",children:t.jsxs("div",{className:"relative flex items-center",children:[t.jsx(it,{"data-testid":"language-select-desktop",variant:"bordered","aria-label":a,selectedKeys:s?[s]:[],onSelectionChange:i=>{const o=Array.from(i)[0]||s;n?.(o)},className:"min-w-36 hidden md:inline-flex",isDisabled:e.length===0,placeholder:a,startContent:t.jsx(te.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(it,{"aria-label":a,"data-testid":"language-select-mobile",variant:"bordered",selectedKeys:s?[s]:[],onSelectionChange:i=>{const o=Array.from(i)[0]||s;n?.(o)},className:"w-24 inline-flex md:hidden",isDisabled:e.length===0,placeholder:"",startContent:t.jsx(te.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 Ku({isLoggedIn:e,onLogin:s,onLogout:n,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:n,size:"md",children:[t.jsx(te.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:s,size:"md",children:[t.jsx(te.User,{className:"inline w-5 h-5"}),t.jsx("span",{className:"hidden md:inline",children:a.login})]})}function Yu({logo:e,languages:s=[],selectedLanguage:n,onLanguageChange:a,isLoggedIn:r,onLogin:i,onLogout:o,hasLanguages:l,hasAuth:d,labels:u={},className:p}){const m={...qu,...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",p),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||s.length>0)&&t.jsx(Gu,{languages:s,selectedLanguage:n,onLanguageChange:a,label:m.selectLanguage}),d&&t.jsx(Ku,{isLoggedIn:r,onLogin:i,onLogout:o,labels:m})]})]})}function Qu(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 nn;const Zu=typeof document<"u"?(nn=h.useInsertionEffect)!==null&&nn!==void 0?nn:h.useLayoutEffect:()=>{};function It(e,s,n){let[a,r]=h.useState(e||s),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;Zu(()=>{i.current=d});let[,u]=h.useReducer(()=>({}),{}),p=h.useCallback((m,...x)=>{let f=typeof m=="function"?m(i.current):m;Object.is(i.current,f)||(i.current=f,r(f),u(),n?.(f,...x))},[n]);return[d,p]}function Vi(e){return t.jsx("svg",{...e,fill:"none",stroke:"currentColor",strokeWidth:2,viewBox:"0 0 24 24",children:t.jsx(We.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 Ui=h.forwardRef(({color:e="primary",variant:s="default",stepsCount:n=3,defaultStep:a=0,label:r,stepLabels:i,showStepLabelTooltip:o=!1,stepLabelTooltipPlacement:l="top",showStepCounter:d=!1,stepCounterPosition:u="right",layout:p="compact",stepCounterFormat:m,onStepChange:x,currentStep:f,hideProgressBars:b=!1,stepClassName:v,className:g,isDisabled:y=!1,...w},k)=>{const[N,$]=It(f,a,x),E=h.useMemo(()=>{let j,L;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":j="[--step-color:var(--heroui-primary)]",L="[--step-fg-color:var(--heroui-primary-foreground)]";break;case"secondary":j="[--step-color:var(--heroui-secondary)]",L="[--step-fg-color:var(--heroui-secondary-foreground)]";break;case"success":j="[--step-color:var(--heroui-success)]",L="[--step-fg-color:var(--heroui-success-foreground)]";break;case"warning":j="[--step-color:var(--heroui-warning)]",L="[--step-fg-color:var(--heroui-warning-foreground)]";break;case"danger":j="[--step-color:var(--heroui-danger)]",L="[--step-fg-color:var(--heroui-danger-foreground)]";break;case"default":j="[--step-color:var(--heroui-default)]",L="[--step-fg-color:var(--heroui-default-foreground)]";break;default:j="[--step-color:var(--heroui-primary)]",L="[--step-fg-color:var(--heroui-primary-foreground)]";break}return S.unshift(L),S.unshift(j),S},[e]);return t.jsxs("nav",{ref:k,"aria-label":"Progress",className:c.cn("flex items-center overflow-x-auto",p==="spread"?"w-full justify-between gap-6":"max-w-fit gap-3",g),"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,n):`Step ${N+1} of ${n}`}):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",E,g),"data-testid":"stepper-list",children:Array.from({length:n})?.map((j,L)=>{const S=N===L?"active":N<L?"inactive":"complete",M=s==="activeLabel"&&S==="active"&&!!i?.[L],D=o&&S!=="active"&&!!i?.[L];return t.jsxs("li",{className:"relative flex shrink-0 items-center gap-x-3","data-testid":`stepper-step-${L}`,children:[t.jsx(c.Tooltip,{content:D?i?.[L]:void 0,isDisabled:!D,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":M},{"cursor-not-allowed opacity-50":y},v),onClick:()=>!y&&$(L),disabled:y,"data-testid":`stepper-step-btn-${L}`,children:[t.jsx("div",{className:"h-full relative flex items-center",children:t.jsx(We.LazyMotion,{features:We.domAnimation,children:t.jsx(We.m.div,{animate:S,className:"relative z-10",children:t.jsx(We.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)":M,"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"&&s==="default"?t.jsx(Vi,{className:"h-5 w-5 text-(--active-fg-color)","data-testid":`stepper-step-check-${L}`}):t.jsx("span",{children:L+1})})})})})}),M?t.jsx("span",{className:"pr-2 text-2xl leading-none font-medium whitespace-nowrap text-(--active-color)","data-testid":`stepper-step-label-${L}`,children:i[L]}):null]},L)}),L<n-1&&!b&&t.jsx("div",{"aria-hidden":"true",className:"pointer-events-none z-0 w-12 flex-none items-center",style:{"--idx":L},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":L<N})})})]},L)})}),d&&u==="right"?t.jsx("span",{className:"text-default-500 text-2xl whitespace-nowrap","data-testid":"stepper-counter",children:m?m(N+1,n):`Step ${N+1} of ${n}`}):null]})});Ui.displayName="Stepper";function Xu(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 xe(e,s="en-US",n="USD"){try{return new Intl.NumberFormat(s,{style:"currency",currency:n}).format(e)}catch{return`${n} ${e.toFixed(2)}`}}function Ot(e,s="en-US"){try{const n=new Intl.NumberFormat(s,{style:"currency",currency:e}).resolvedOptions();return typeof n.maximumFractionDigits=="number"?n.maximumFractionDigits:2}catch{return 2}}function Xn(e,s,n="en-US"){const a=Ot(s,n),r=Math.pow(10,a);return Math.round(e*r)/r}function An(e,s,n,a){return Xn(e-s,n,a)}const tr={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))"}},Ju="rgb(156 163 175)",em="rgb(107 114 128)",Hi=h.forwardRef(function({color:s="primary",steps:n=[],defaultStep:a=0,onStepChange:r,currentStep:i,hideProgressBars:o=!1,activeColor:l,activeForegroundColor:d,inactiveColor:u=Ju,inactiveLabelColor:p=em,activeStepVariant:m="bordered",stepClassName:x,circleClassName:f,progressBarClassName:b,labelsClassName:v,labelSlotClassName:g,activeLabelClassName:y,inactiveLabelClassName:w,className:k,ariaLabel:N="Progress",invalidLabelSuffix:$=", has errors",testId:E,isStepReachable:j,...L},S){const[M,D]=It(i,a,r),A=tr[s]??tr.primary,R=l??A.active,T=d??A.fg,U=(G,I)=>{const q=G.ariaLabel??(typeof G.title=="string"?G.title:null)??`${I+1}`;return G.invalid?`${q}${$}`:q};return t.jsxs("nav",{...L,"aria-label":N,...E?{"data-testid":E}:{},children:[t.jsx("div",{className:c.cn("flex items-center",k),children:n?.map((G,I)=>{const se=I===M?"active":I<M?"complete":"inactive",q=j?j(I):!0;return t.jsxs(h.Fragment,{children:[t.jsx(O,{ref:S,isIconOnly:!0,disableAnimation:!0,radius:"full",variant:"light",testId:`${E??"horizontal-steps"}-step-${I}`,"aria-current":se==="active"?"step":void 0,"aria-describedby":G.describedBy,"aria-label":U(G,I),"data-invalid":G.invalid?"true":void 0,isDisabled:!q,className:c.cn("size-8 min-w-8 shrink-0 overflow-visible bg-transparent p-0","data-[hover=true]:bg-transparent",q?"cursor-pointer":"cursor-not-allowed","data-[disabled=true]:opacity-40",G.className,x),onPress:()=>{if(i===void 0){D(I);return}r?.(I)},children:t.jsx(We.LazyMotion,{features:We.domAnimation,children:t.jsx(We.m.div,{animate:se,className:c.cn("relative flex size-8 items-center justify-center rounded-full text-[13px] font-medium",f),initial:!1,transition:{duration:.2},variants:{inactive:{backgroundColor:"transparent",borderColor:u,borderWidth:"1.5px",color:u},active:{backgroundColor:m==="solid"?R:"transparent",borderColor:R,borderWidth:"1.5px",color:m==="solid"?T:R},complete:{backgroundColor:R,borderColor:R,borderWidth:"1.5px",color:R}},children:se==="complete"?t.jsx(Vi,{className:"size-4",style:{color:T}}):t.jsx("span",{children:I+1})})})}),I<n.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",b),style:{backgroundColor:I<M?R:u}})]},I)})}),t.jsx("div",{className:c.cn("mt-2.5 hidden md:flex",v),children:n?.map((G,I)=>{const se=I<=M;return t.jsxs(h.Fragment,{children:[t.jsx("div",{className:c.cn("relative flex w-8 shrink-0 justify-center overflow-visible",g),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",se?y:w),style:{color:se?R:p},children:G.title})}),I<n.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",b)})]},I)})})]})});Hi.displayName="HorizontalSteps";function re(e){return e!=null&&e!==!1&&e!==""}const Ze=e=>ls[e],tm={done:"solar:check-circle-bold","needs-fix":"solar:danger-triangle-bold",optional:"solar:record-outline"},Wi={done:{icon:Ze("--ok"),meta:Ze("--sub")},"needs-fix":{icon:Ze("--warn"),meta:Ze("--warn")},optional:{icon:Ze("--muted"),meta:Ze("--sub")}},sm=Ze("--ink"),nm={ready:"solar:check-circle-bold",fix:"solar:danger-triangle-bold",live:"solar:check-circle-bold"},am={ready:{fill:Ze("--ok-fill"),text:Ze("--ok")},fix:{fill:Ze("--warn-fill"),text:Ze("--warn")},live:{fill:Ze("--ok-fill"),text:Ze("--ok")}},nt={root:"flex min-h-0 flex-col gap-3 overflow-y-auto overscroll-contain",nav:"rounded-2xl border border-acct-border bg-acct-surface p-1.5",list:"m-0 flex list-none flex-col gap-0.5 p-0",row:["h-auto min-h-0 w-full justify-start items-start gap-2.5 whitespace-normal","rounded-xl px-2.5 py-2 text-left font-normal","bg-transparent data-[hover=true]:bg-acct-page","data-[disabled=true]:opacity-40 data-[disabled=true]:cursor-not-allowed"].join(" "),rowCurrent:"bg-acct-hair data-[hover=true]:bg-acct-hair",icon:"mt-px size-5 shrink-0",text:"flex min-w-0 flex-1 flex-col gap-0.5",label:"text-sm leading-5",labelCurrent:"font-semibold",meta:"text-xs leading-4 [overflow-wrap:anywhere]"},Ht={root:"flex items-start gap-2.5 rounded-2xl px-4 py-3",icon:"mt-0.5 size-5 shrink-0",text:"flex min-w-0 flex-col",title:"text-sm font-semibold leading-5",description:"text-xs leading-4"},$t={root:"flex flex-wrap items-center justify-between gap-3",spacer:"min-w-0 flex-1 basis-0",progress:"shrink-0 text-xs text-acct-sub",endSlot:"flex min-w-0 flex-1 basis-0 justify-end",arrow:"size-4"};function rm({step:e,labels:s}){const n=Wi[e.status];if(e.status==="optional")return t.jsxs("span",{className:nt.meta,style:{color:n.meta},children:[s.optional,re(e.summary)?t.jsxs(t.Fragment,{children:[" · ",e.summary]}):null]});const a=e.status==="needs-fix"&&re(e.reason)?e.reason:e.summary,r=e.status==="done"?s.done:s.needsFix;return t.jsxs(t.Fragment,{children:[t.jsx("span",{className:"sr-only",children:r})," ",re(a)?t.jsx("span",{className:nt.meta,style:{color:n.meta},children:a}):null]})}function qi({steps:e,currentStep:s,defaultStep:n=0,onStepChange:a,isStepReachable:r,ariaLabel:i,statusLabels:o,header:l,maxHeight:d,className:u,style:p,"data-testid":m="vertical-steps",...x}){const[f,b]=It(s,n,a);return t.jsxs("div",{...x,"data-testid":m,className:c.cn(nt.root,u),style:d===void 0?p:{maxHeight:d,...p},children:[l,t.jsx("nav",{"aria-label":i,className:nt.nav,children:t.jsx("ol",{className:nt.list,children:e.map((v,g)=>{const y=g===f,w=r?r(g):!0;return t.jsx("li",{children:t.jsxs(O,{variant:"light",color:"default",radius:"none",disableAnimation:!0,testId:v.testId??`${m}-step-${v.key}`,"data-state":v.status,"data-current":y?"true":void 0,"aria-current":y?"step":void 0,isDisabled:!w,className:c.cn(nt.row,y&&nt.rowCurrent),onPress:()=>b(g),children:[t.jsx(P,{"aria-hidden":!0,icon:tm[v.status],className:nt.icon,style:{color:Wi[v.status].icon}}),t.jsxs("span",{className:nt.text,children:[t.jsx("span",{className:c.cn(nt.label,y&&nt.labelCurrent),style:{color:sm},children:`${g+1}. ${v.label}`})," ",t.jsx(rm,{step:v,labels:o})]})]})},v.key)})})})]})}qi.displayName="VerticalSteps";function Gi({variant:e,title:s,description:n,className:a,"data-testid":r="steps-readiness"}){const i=am[e];return t.jsxs("div",{role:"status","data-testid":r,"data-variant":e,"data-ready":e==="fix"?"false":"true",className:c.cn(Ht.root,a),style:{backgroundColor:i.fill,color:i.text},children:[t.jsx(P,{"aria-hidden":!0,icon:nm[e],className:Ht.icon}),t.jsxs("span",{className:Ht.text,children:[t.jsx("span",{className:Ht.title,children:s})," ",re(n)?t.jsx("span",{className:Ht.description,children:n}):null]})]})}Gi.displayName="StepsReadiness";function Ki({steps:e,currentStep:s,onStepChange:n,progressLabel:a,nextLabel:r,previousLabel:i=b=>b.label,finalActionLabel:o,onFinalAction:l,isFinalActionDisabled:d=!1,className:u,"data-testid":p="step-pager",previousTestId:m=`${p}-prev`,nextTestId:x=`${p}-next`,finalActionTestId:f=`${p}-final`}){const b=e[s-1],v=e[s+1],g=s===e.length-1;return t.jsxs("div",{"data-testid":p,className:c.cn($t.root,u),children:[t.jsx("div",{className:$t.spacer,children:b?t.jsx(O,{variant:"bordered",color:"default",testId:m,startContent:t.jsx(P,{"aria-hidden":!0,icon:"solar:arrow-left-outline",className:$t.arrow}),onPress:()=>n(s-1),children:i(b)}):null}),t.jsx("span",{className:$t.progress,children:a(s+1,e.length)}),t.jsx("div",{className:$t.endSlot,children:v?t.jsx(O,{color:"primary",testId:x,endContent:t.jsx(P,{"aria-hidden":!0,icon:"solar:arrow-right-outline",className:$t.arrow}),onPress:()=>n(s+1),children:r(v)}):g&&o!==void 0&&l?t.jsx(O,{color:"primary",testId:f,isDisabled:d,onPress:l,children:o}):null})]})}Ki.displayName="StepPager";function im(){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 lm=e=>{const s=h.useMemo(()=>JSON.stringify({allItems:e.allItems,selected:e.selected}),[e.allItems,e.selected]);return t.jsx(om,{...e},s)},om=({allItems:e,selected:s,onSelectedChange:n,titleLeft:a,titleRight:r})=>{const[i,o]=h.useState([]),[l,d]=h.useState([]),[u,p]=h.useState(null),[m,x]=h.useState(null),f=h.useMemo(()=>new Set(s),[s]),b=h.useMemo(()=>new Set(e),[e]),v=h.useMemo(()=>e.filter(D=>!f.has(D)),[e,f]),g=D=>{if(D.length===0)return;const A=Array.from(new Set([...s,...D]));n(A)},y=D=>{if(D.length===0)return;const A=new Set(D);n(s.filter(R=>!A.has(R)))},w=()=>{i.length!==0&&(g(i),o([]))},k=()=>{l.length!==0&&(y(l),d([]))},N=()=>{v.length!==0&&(g(v),o([]))},$=()=>{s.length!==0&&(n([]),d([]))},E=(D,A,R)=>{const T=Math.min(A,R),U=Math.max(A,R);return D.slice(T,U+1)},j=(D,A,R)=>{if(R&&u!==null){o(E(v,u,A)),d([]),p(A);return}const T=i.includes(D);o(T?i.filter(U=>U!==D):[...i,D]),d([]),p(A)},L=(D,A,R)=>{if(R&&m!==null){d(E(s,m,A)),o([]),x(A);return}const T=l.includes(D);d(T?l.filter(U=>U!==D):[...l,D]),o([]),x(A)},S=(D,A,R)=>{const T=R==="available"?i.includes(A)?i:[A]:l.includes(A)?l:[A];D.dataTransfer.setData("text/plain",JSON.stringify({source:R,items:T})),D.dataTransfer.effectAllowed="move"},M=(D,A)=>{D.preventDefault();const R=D.dataTransfer.getData("text/plain");if(R)try{const T=JSON.parse(R),U=(T.items||[]).filter(G=>b.has(G));if(U.length===0||T.source===A)return;A==="selected"?(g(U),o([])):(y(U),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:D=>D.preventDefault(),onDrop:D=>M(D,"available"),children:v.map((D,A)=>{const R=i.includes(D);return t.jsx("button",{type:"button",onClick:T=>{j(D,A,T.shiftKey)},onMouseDown:T=>{T.shiftKey&&T.preventDefault()},draggable:!0,onDragStart:T=>S(T,D,"available"),className:`rounded-md px-3 py-2 text-left text-sm transition ${R?"bg-[#E4571E]/10 text-[#E4571E]":"text-gray-700 hover:bg-gray-100"}`,children:D},D)})})})]}),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:k,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:v.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:$,"data-testid":"move-all-to-available",isDisabled:s.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:D=>D.preventDefault(),onDrop:D=>M(D,"selected"),children:s.map((D,A)=>{const R=l.includes(D);return t.jsx("button",{type:"button",onClick:T=>{L(D,A,T.shiftKey)},onMouseDown:T=>{T.shiftKey&&T.preventDefault()},draggable:!0,onDragStart:T=>S(T,D,"selected"),className:`rounded-md px-3 py-2 text-left text-sm transition ${R?"bg-[#E4571E]/10 text-[#E4571E]":"text-gray-700 hover:bg-gray-100"}`,children:D},D)})})})]})]})};function rs(e){return typeof e=="string"?e:e.type}function vt({className:e}){return t.jsx("div",{className:`flex items-center h-6 ${e||""}`,children:t.jsx(c.Divider,{orientation:"vertical"})})}function wt({icon:e,label:s,isActive:n=!1,isDisabled:a=!1,onClick:r,shortcut:i,iconSize:o=16,className:l}){const d=i?`${s} (${i})`:s;return t.jsx(c.Tooltip,{content:d,placement:"top",offset:10,children:t.jsx(O,{size:"sm",radius:"sm",color:n?"primary":"default",variant:n?"solid":"bordered",isIconOnly:!0,isDisabled:a,onPress:r,"aria-label":s,className:l,children:t.jsx(e,{size:o})})})}const ft={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:s})=>{const n=s?.type==="textColor"?s.color:"";n?e.chain().focus().setColor(n).run():e.chain().focus().unsetColor().run()},canExecute:()=>!0,isActive:e=>e.isActive("textStyle"),label:"Text color"},highlight:{execute:({editor:e,config:s})=>{const n=s?.type==="highlight"?s.color:"";n?e.chain().focus().setHighlight({color:n}).run():e.chain().focus().unsetHighlight().run()},canExecute:()=>!0,isActive:e=>e.isActive("highlight"),label:"Highlight"},link:{execute:({editor:e,config:s})=>{const n=s?.type==="link"?s.href:"";if(n){const a=s?.type==="link"?s.target:void 0,r=s?.type==="link"?s.rel:void 0;e.chain().focus().setLink({href:n,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:s})=>{const n=s?.type==="heading"?s.level:1;e.chain().focus().toggleHeading({level:n}).run()},canExecute:(e,s)=>{const n=s?.type==="heading"?s.level:1;return e.can().chain().focus().toggleHeading({level:n}).run()},isActive:(e,s)=>s?.type==="heading"?e.isActive("heading",{level:s.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:s})=>{const n=s?.type==="textAlign"?s.alignment:"left";e.chain().focus().setTextAlign(n).run()},canExecute:()=>!0,isActive:(e,s)=>s?.type==="textAlign"?e.isActive({textAlign:s.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"}},cm={1:"Heading 1",2:"Heading 2",3:"Heading 3",4:"Heading 4",5:"Heading 5",6:"Heading 6"};function dm({editor:e,levels:s=[1,2,3,4,5,6],isDisabled:n=!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=s.find(o=>e.isActive("heading",{level:o})),i=o=>{const l=Number(o),d=ft.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:n,startContent:t.jsx(te.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:s.map(o=>t.jsx(c.DropdownItem,{startContent:e.isActive("heading",{level:o})?t.jsx(te.Check,{size:16}):t.jsx("div",{className:"w-4"}),children:cm[o]},o))})]})}const an={bulletList:{label:"Bullet List",icon:te.List},orderedList:{label:"Numbered List",icon:te.ListOrdered},taskList:{label:"Task List",icon:te.ListTodo}};function um({editor:e,types:s=["bulletList","orderedList","taskList"],isDisabled:n=!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=s.find(l=>e.isActive(l)),i=r?an[r].icon:te.List,o=l=>{const u=ft[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:n,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:s.map(l=>{const d=an[l].icon;return t.jsx(c.DropdownItem,{startContent:t.jsx(d,{size:16}),children:an[l].label},l)})})]})}function mm({colors:e,selectedColor:s,onColorSelect:n,columns:a=4}){return t.jsx("div",{className:"grid gap-2",style:{gridTemplateColumns:`repeat(${a}, minmax(0, 1fr))`},children:e.map(r=>{const i=s===r;return t.jsx("button",{type:"button",onClick:()=>n(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
|
|
13
|
+
`,style:{backgroundColor:r},"aria-label":`Select color ${r}`,title:r},r)})})}const fm=["#000000","#374151","#6B7280","#EF4444","#F59E0B","#10B981","#3B82F6","#8B5CF6","#EC4899","#14B8A6","#F97316","#A855F7"],pm=["#FEF3C7","#DBEAFE","#D1FAE5","#FCE7F3","#E0E7FF","#FED7AA","#F3E8FF","#CCFBF1","#FEE2E2","#E5E7EB","#FAE8FF","#BFDBFE"];function rn(e){return/^#([0-9A-F]{3}){1,2}$/i.test(e)}const Be={min:50,max:200,step:10,default:100},sr={lineHeight:24,toolbarHeight:60},xm={bold:te.Bold,italic:te.Italic,strike:te.Strikethrough,underline:te.Underline,code:te.Code,textColor:te.Palette,highlight:te.Highlighter,link:te.Link2,paragraph:te.FileText,heading:te.Heading,bulletList:te.List,orderedList:te.ListOrdered,taskList:te.ListTodo,codeBlock:te.CodeSquare,blockquote:te.Quote,horizontalRule:te.Minus,clearMarks:te.Eraser,clearNodes:te.Eraser,undo:te.Undo2,redo:te.Redo2,hardBreak:te.CornerDownLeft,textAlign:te.AlignLeft},hm={left:te.AlignLeft,center:te.AlignCenter,right:te.AlignRight,justify:te.AlignJustify};function Rt(e){return xm[e]}function bm({value:e,onChange:s,onApply:n,placeholder:a="#000000"}){const[r,i]=h.useState(""),o=u=>{const p=u.target.value;s(p),r&&i("")},l=()=>{if(!e){i("Please enter a color");return}if(!rn(e)){i("Invalid hex color (e.g., #FF0000)");return}i(""),n(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:rn(e)?e:"transparent"}})}),t.jsx(O,{size:"sm",color:"primary",variant:"flat",isIconOnly:!0,onPress:l,"aria-label":"Apply custom color",isDisabled:!e||!rn(e),children:t.jsx(te.Check,{size:16})})]}),t.jsx("p",{className:"text-xs text-default-500",children:"Enter a hex color code (e.g., #FF0000)"})]})}function nr({editor:e,type:s,allowCustomColor:n=!0,label:a,isDisabled:r=!1}){const[i,o]=h.useState(!1),[l,d]=h.useState(""),u=s==="textColor"?fm:pm,p=v=>{const g=ft[s];g&&g.execute({editor:e,config:{type:s,color:v}}),o(!1),d("")},m=v=>{p(v)},x=()=>{const v=ft[s];v&&v.execute({editor:e,config:{type:s,color:""}}),o(!1)},f=s==="textColor"?e.isActive("textStyle"):e.isActive("highlight"),b=s==="textColor"?te.Palette:te.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:f?"solid":"bordered",color:f?"primary":"default",isIconOnly:!0,isDisabled:r,"aria-label":a,children:t.jsx(b,{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:x,"aria-label":"Clear color",children:t.jsx(te.X,{size:16})})]}),t.jsx(mm,{colors:u,onColorSelect:p}),n&&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(bm,{value:l,onChange:d,onApply:m})]})]})]})})]})}function gm({zoom:e,onZoomChange:s,min:n=Be.min,max:a=Be.max,step:r=Be.step}){const i=()=>{const m=Math.max(n,e-r);s(m)},o=()=>{const m=Math.min(a,e+r);s(m)},l=()=>{s(Be.default)},d=e<=n,u=e>=a,p=e===Be.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(te.ZoomOut,{size:16})})}),t.jsx(c.Tooltip,{content:p?"Zoom percentage":"Click to reset zoom",placement:"top",offset:10,children:t.jsxs("button",{type:"button",onClick:l,disabled:p,className:`
|
|
14
14
|
text-xs text-default-500 min-w-[3ch] text-center px-2
|
|
15
|
-
${
|
|
16
|
-
`,"aria-label":`Zoom level ${e}%`,children:[e,"%"]})}),t.jsx(c.Tooltip,{content:"Zoom in",placement:"top",offset:10,children:t.jsx(I,{size:"sm",radius:"sm",color:"default",variant:"bordered",isIconOnly:!0,isDisabled:u,onPress:o,"aria-label":"Zoom in",children:t.jsx(J.ZoomIn,{size:16})})})]})}function lm({editor:e,isDisabled:s=!1}){const[n,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:b,to:v}=e.state.selection,g=e.isActive("link");let y="";if(g){const k=e.schema.marks.link,w=e.state.doc.resolve(b),$=La.getMarkRange(w,k);$&&(y=e.state.doc.textBetween($.from,$.to,""))}else y=e.state.doc.textBetween(b,v,"");const N=e.getAttributes("link").href||"";i(y),l(N),u(g)}a(x)},p=()=>{if(o.trim()){const{from:x,to:b}=e.state.selection,v=e.schema.marks.link,g=e.state.doc.resolve(x),y=La.getMarkRange(g,v),N=y?.from??x,k=y?.to??b,w=e.state.doc.textBetween(N,k,"");r.trim()&&r!==w?e.chain().focus().setTextSelection({from:N,to:k}).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:n,onOpenChange:m,placement:"bottom",children:[t.jsx(c.PopoverTrigger,{children:t.jsx(I,{size:"sm",radius:"sm",variant:f?"solid":"bordered",color:f?"primary":"default",isIconOnly:!0,isDisabled:s,"aria-label":"Link",children:t.jsx(J.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(I,{size:"sm",color:"primary",onPress:p,isDisabled:!o.trim(),children:d?"Update":"Apply"})]})})]})}function om({children:e,id:s,label:n,className:a,useButtonGroup:r=!0}){return r?t.jsx(c.ButtonGroup,{size:"sm",id:s,"aria-label":n,className:a,children:e}):t.jsx("div",{id:s,role:"group","aria-label":n,className:`flex items-center gap-2 ${a||""}`,children:e})}function zi(e,s){const n=h.useMemo(()=>{if(!e)return{};const i={};return Array.from(new Set(s.map(l=>ss(l)))).forEach(l=>{const d=ft[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,s]),[a,r]=h.useState(n);return h.useEffect(()=>{if(!e)return;const i=()=>{const o={};Array.from(new Set(s.map(d=>ss(d)))).forEach(d=>{const u=ft[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,s,n]),a}function Vi(e,s){const n=h.useCallback((o,l)=>{if(!e)return;const d=ft[o];if(d)try{d.execute({editor:e,config:l}),s?.({type:"toggle",modifier:o})}catch(u){console.warn(`Failed to execute command for modifier: ${o}`,u)}},[e,s]),a=h.useCallback(o=>{n(o)},[n]),r=h.useCallback((o,l)=>{if(!e)return!1;const d=ft[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=ft[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:n,toggleModifier:a,canExecute:r,isActive:i}}function cm(e=Te.default){const[s,n]=h.useState(e),a=h.useCallback((l=Te.step)=>{n(d=>Math.min(Te.max,d+l))},[]),r=h.useCallback((l=Te.step)=>{n(d=>Math.max(Te.min,d-l))},[]),i=h.useCallback(()=>{n(Te.default)},[]),o=h.useCallback(l=>{const d=Math.max(Te.min,Math.min(Te.max,l));n(d)},[]);return{zoom:s,setZoom:o,zoomIn:a,zoomOut:r,resetZoom:i,isMinZoom:s<=Te.min,isMaxZoom:s>=Te.max,isDefaultZoom:s===Te.default}}const dm=["bold","italic","strike","underline","code"];function um({editor:e,modifiers:s,onToolbarAction:n}){const a=zi(e,s),{toggleModifier:r}=Vi(e,n);if(!e)return null;const i=s.map(o=>ss(o)).filter(o=>dm.includes(o));return i.length===0?null:t.jsx(om,{id:"text-formatting",label:"Text formatting",children:i.map(o=>{const l=a[o],d=_t(o);return t.jsx(jt,{icon:d,label:o.charAt(0).toUpperCase()+o.slice(1),isActive:l?.isActive,isDisabled:l?.isDisabled,onClick:()=>r(o)},o)})})}function mm({editor:e,modifiers:s,zoom:n=100,onZoomChange:a,sticky:r=!0,className:i,onToolbarAction:o}){const l=zi(e,s),{toggleModifier:d,executeCommand:u}=Vi(e,o);if(!e)return null;const f=s.map(j=>ss(j)),m=f.some(j=>["bold","italic","strike","underline","code"].includes(j)),p=f.some(j=>["textColor","highlight"].includes(j)),x=f.includes("heading"),b=f.includes("textAlign"),v=f.some(j=>["bulletList","orderedList","taskList"].includes(j)),g=f.includes("blockquote"),y=f.includes("codeBlock"),N=f.includes("link"),k=f.includes("horizontalRule"),w=f.some(j=>["undo","redo"].includes(j)),$=n!==void 0&&a!==void 0,A=r?"sticky top-0 z-10":"";return t.jsx("div",{className:`w-full p-2 bg-background border-b border-divider ${A} ${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(um,{editor:e,modifiers:s,onToolbarAction:o}),(p||x||b||v||g||y||N||k||w||$)&&t.jsx(yt,{})]}),p&&t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"flex items-center gap-1",children:[f.includes("textColor")&&t.jsx(Xa,{editor:e,type:"textColor",label:"Text color",isDisabled:l.textColor?.isDisabled}),f.includes("highlight")&&t.jsx(Xa,{editor:e,type:"highlight",label:"Highlight",isDisabled:l.highlight?.isDisabled})]}),(x||b||v||g||y||N||k||w||$)&&t.jsx(yt,{})]}),x&&t.jsxs(t.Fragment,{children:[t.jsx(Xu,{editor:e}),(b||v||g||y||N||k||w||$)&&t.jsx(yt,{})]}),b&&t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"flex items-center gap-1",children:["left","center","right","justify"].map(j=>{const L=am[j],S=e.isActive({textAlign:j});return t.jsx(jt,{icon:L,label:`Align ${j}`,isActive:S,onClick:()=>u("textAlign",{type:"textAlign",alignment:j})},j)})}),(v||g||y||N||k||w||$)&&t.jsx(yt,{})]}),v&&t.jsxs(t.Fragment,{children:[t.jsx(Ju,{editor:e,types:f.filter(j=>["bulletList","orderedList","taskList"].includes(j))}),(g||y||N||k||w||$)&&t.jsx(yt,{})]}),(g||y||N||k)&&t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"flex items-center gap-1",children:[g&&t.jsx(jt,{icon:_t("blockquote"),label:"Blockquote",isActive:l.blockquote?.isActive,isDisabled:l.blockquote?.isDisabled,onClick:()=>d("blockquote")}),y&&t.jsx(jt,{icon:_t("codeBlock"),label:"Code block",isActive:l.codeBlock?.isActive,isDisabled:l.codeBlock?.isDisabled,onClick:()=>d("codeBlock")}),N&&t.jsx(lm,{editor:e,isDisabled:l.link?.isDisabled}),k&&t.jsx(jt,{icon:_t("horizontalRule"),label:"Horizontal rule",onClick:()=>d("horizontalRule")})]}),(w||$)&&t.jsx(yt,{})]}),w&&t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"flex items-center gap-1",children:[f.includes("undo")&&t.jsx(jt,{icon:_t("undo"),label:"Undo",isDisabled:l.undo?.isDisabled,onClick:()=>d("undo")}),f.includes("redo")&&t.jsx(jt,{icon:_t("redo"),label:"Redo",isDisabled:l.redo?.isDisabled,onClick:()=>d("redo")})]}),$&&t.jsx(yt,{})]}),$&&t.jsx(im,{zoom:n,onZoomChange:j=>{a?.(j),o?.({type:"zoom",modifier:`${j}%`})}})]})})}const Ut={bold:{category:"mark",extension:Cc.Bold,priority:100},italic:{category:"mark",extension:kc.Italic,priority:100},strike:{category:"mark",extension:Sc.Strike,priority:100},underline:{category:"mark",extension:$c.Underline,priority:100},code:{category:"mark",extension:Ac.Code,priority:100},textColor:{category:"mark",extension:Dc.Color,defaultOptions:{types:["textStyle","heading","paragraph","listItem","taskItem","blockquote"]},priority:90},highlight:{category:"mark",extension:Ec.Highlight,defaultOptions:{multicolor:!0},priority:90},link:{category:"mark",extension:Lc.Link,defaultOptions:{autolink:!0,linkOnPaste:!0,openOnClick:!1,HTMLAttributes:{class:"text-primary underline cursor-pointer"}},priority:100},heading:{category:"node",extension:_c.Heading,defaultOptions:{levels:[1,2,3,4,5,6]},priority:100},bulletList:{category:"node",extension:Mc.BulletList,defaultOptions:{HTMLAttributes:{class:"list-disc"}},priority:90},orderedList:{category:"node",extension:Pc.OrderedList,defaultOptions:{HTMLAttributes:{class:"list-decimal"}},priority:90},taskList:{category:"node",extension:Tc.TaskList,defaultOptions:{HTMLAttributes:{class:"task-list"}},priority:90},codeBlock:{category:"node",extension:Bc.CodeBlock,priority:100},blockquote:{category:"node",extension:zc.Blockquote,priority:100},horizontalRule:{category:"node",extension:Vc.HorizontalRule,priority:100},hardBreak:{category:"node",extension:Uc.HardBreak,priority:100},undo:{category:"extension",extension:Fa.History,priority:50},redo:{category:"extension",extension:Fa.History,priority:50},textAlign:{category:"extension",extension:Hc.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}},fm=[Wc.Document,qc.Text,Rc.Paragraph,Fc.TextStyle.configure({HTMLAttributes:{}}),Oc.ListItem.configure({HTMLAttributes:{}}),Ic.TaskItem.configure({nested:!0}),Gc.Dropcursor,Kc.Gapcursor];function xm(e){const s=[],n=new Set,a=new Set;fm.forEach(l=>{l&&(s.push(l),a.add(l.name))});const r=e.map(l=>ss(l)),i=new Set;return r.forEach(l=>{const d=Ut[l];d?.requiredExtensions&&d.requiredExtensions.forEach(u=>{i.add(u)})}),i.forEach(l=>{if(n.has(l))return;const d=Ut[l];if(!d||d.extension===null)return;const u=d.extension.name;if(a.has(u)){n.add(l);return}const f=d.defaultOptions?d.extension.configure(d.defaultOptions):d.extension;s.push(f),n.add(l),a.add(u)}),r.forEach(l=>{if(n.has(l))return;const d=Ut[l];if(!d){console.warn(`Extension config not found for modifier: ${l}`);return}if(d.extension===null){n.add(l);return}const u=d.extension.name;if(a.has(u)){n.add(l);return}const f=d.defaultOptions?d.extension.configure(d.defaultOptions):d.extension;s.push(f),n.add(l),a.add(u)}),s.sort((l,d)=>{const u=Object.values(Ut).find(x=>x?.extension?.name===l.name),f=Object.values(Ut).find(x=>x?.extension?.name===d.name),m=u?.priority??100;return(f?.priority??100)-m})}const Ui={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"]},pm={h1:`font-size: ${ge.fontSize["4xl"]}; font-weight: ${ge.fontWeight.semibold}; line-height: ${ge.lineHeight.tight}; margin: ${he.md} 0 ${he.sm} 0;`,h2:`font-size: ${ge.fontSize["2xl"]}; font-weight: ${ge.fontWeight.semibold}; line-height: ${ge.lineHeight.tight}; margin: ${he.md} 0 ${he.sm} 0;`,h3:`font-size: ${ge.fontSize.xl}; font-weight: ${ge.fontWeight.semibold}; line-height: ${ge.lineHeight.tight}; margin: ${he.md} 0 ${he.sm} 0;`,h4:`font-size: ${ge.fontSize.lg}; font-weight: ${ge.fontWeight.semibold}; line-height: ${ge.lineHeight.tight}; margin: ${he.md} 0 ${he.sm} 0;`,h5:`font-size: ${ge.fontSize.base}; font-weight: ${ge.fontWeight.semibold}; line-height: ${ge.lineHeight.tight}; margin: ${he.md} 0 ${he.sm} 0;`,h6:`font-size: ${ge.fontSize.sm}; font-weight: ${ge.fontWeight.semibold}; line-height: ${ge.lineHeight.tight}; margin: ${he.md} 0 ${he.sm} 0;`,p:`min-height: ${ge.lineHeight.normal}em; margin: 0;`,ul:`list-style-type: disc; list-style-position: outside; padding-left: ${he.xl}; margin: ${he.md} 0;`,ol:`list-style-type: decimal; list-style-position: outside; padding-left: ${he.xl}; margin: ${he.md} 0;`,li:`display: list-item; margin: ${he.xs} 0;`,strong:`font-weight: ${ge.fontWeight.bold};`,em:"font-style: italic;",s:"text-decoration: line-through;",u:"text-decoration: underline;",code:`background-color: ${_e.neutral.gray[100]}; border-radius: 0.4rem; font-size: ${ge.fontSize.sm}; padding: 0.25em 0.3em; font-family: ${ge.fontFamily.mono};`,pre:`background: ${_e.neutral.gray[800]}; border-radius: ${he.sm}; color: ${_e.neutral.gray[100]}; font-family: ${ge.fontFamily.mono}; margin: ${he.lg} 0; padding: 0.75rem ${he.md}; overflow-x: auto;`,blockquote:`border-left: 3px solid ${_e.neutral.gray[300]}; margin: ${he.lg} 0; padding-left: ${he.md}; color: ${_e.neutral.gray[500]};`,hr:`border: none; border-top: 1px solid ${_e.neutral.gray[200]}; margin: ${he.xl} 0;`,a:`color: ${_e.brand.primary.DEFAULT}; text-decoration: underline; cursor: pointer;`,mark:`background-color: ${_e.palettes.warning[200]}; border-radius: ${he.xs}; padding: 0 0.125rem;`,label:`display: flex; align-items: center; gap: ${he.sm}; cursor: pointer;`,input:"cursor: pointer; margin: 0;"},hm={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 bm(e){if(!e)return e;let s=e;for(const[n,a]of Object.entries(hm)){const r=new RegExp(`(<(?:ul|li)[^>]*data-type="${n}"[^>]*)>`,"gi");s=s.replace(r,(i,o)=>i.includes('style="')?i.replace(/style="([^"]*)"/,`style="$1 ${a}"`):`${o} style="${a}">`)}for(const[n,a]of Object.entries(pm)){const r=new RegExp(`<${n}(\\s[^>]*)?>`,"gi");s=s.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 s}const gm=({modifiers:e,zoom:s,onZoomChange:n,onToolbarAction:a})=>{const{editor:r}=Mn.useCurrentEditor();return t.jsx(mm,{editor:r,modifiers:e,zoom:s,onZoomChange:n,onToolbarAction:a})},ym=({showCharacterCount:e,showWordCount:s})=>{const{editor:n}=Mn.useCurrentEditor();if(!n||!e&&!s)return null;const a=n.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"]}),s&&t.jsxs("span",{children:[i," words"]})]})},kn=h.forwardRef((e,s)=>{const{minRows:n=10,maxRows:a=30,disableAutosize:r=!1,showCharacterCount:i=!1,showWordCount:o=!1,showToolbar:l=!0,modifiers:d=Ui.full,variant:u="bordered",initialContent:f,content:m,onContentChange:p,onUpdate:x,onToolbarAction:b,isReadOnly:v=!1,isDisabled:g=!1,includeInlineStyles:y=!0,...N}=e,{zoom:k,setZoom:w}=cm(),$=Za.lineHeight,A=n*$,j=r?void 0:a*$,L=h.useMemo(()=>xm(d),[d]),{Component:S,label:M,shouldLabelBeOutside:D,getBaseProps:E,getLabelProps:R,getInputWrapperProps:T}=c.useInput({...N,variant:u,ref:s,isMultiline:!0}),H=M?t.jsx("label",{...R(),children:M}):null,K=h.useCallback(({editor:B})=>{const se=B.getHTML(),G=y?bm(se):se,Q=B.getJSON(),Y=B.getText(),ce=Y.length,ne=Y.split(/\s+/).filter(le=>le.length>0).length,ee={html:G,json:Q,text:Y,characters:ce,words:ne};if(p?.(ee),x?.(ee),"onChange"in N&&typeof N.onChange=="function"){const le={target:{value:G},currentTarget:{value:G}};N.onChange(le)}},[p,x,N,y]);return t.jsxs(S,{...E(),children:[D?H:null,t.jsx("div",{...T(),className:c.cn(T().className,"flex flex-col w-full p-0 gap-0 rich-text-editor"),style:{maxHeight:j?`${j+Za.toolbarHeight}px`:void 0,overflow:j?"auto":void 0},children:t.jsx(Mn.EditorProvider,{editable:!v&&!g,slotBefore:l?t.jsx(gm,{modifiers:d,zoom:k,onZoomChange:w,onToolbarAction:b}):void 0,slotAfter:t.jsx(ym,{showCharacterCount:i,showWordCount:o}),editorContainerProps:{className:"w-full flex-1 outline-none",style:{minHeight:`${A}px`,fontSize:`${k}%`,display:"flex",flexDirection:"column"}},editorProps:{attributes:{class:"focus:outline-none w-full h-full"}},extensions:L,content:m||f||e.defaultValue||"",onUpdate:K})})]})});kn.displayName="TipTapEditor";const Hi=h.forwardRef((e,s)=>{const{adapter:n="tiptap",variant:a="bordered",...r}=e;return n==="tiptap"?t.jsx(kn,{...r,variant:a,ref:s}):(console.warn(`Adapter "${n}" is not supported. Using TipTap.`),t.jsx(kn,{...r,variant:a,ref:s}))});Hi.displayName="RichTextArea";function Ja(e,s="en-US",n="USD",a=!0){try{return new Intl.NumberFormat(s,a?{style:"currency",currency:n,minimumFractionDigits:0,maximumFractionDigits:2}:{style:"currency",currency:n}).format(e)}catch(r){return console.warn(`Invalid currency formatting: ${r}`),`${n} ${e.toFixed(2)}`}}function vm(e="en-US",s="USD"){try{const n=new Intl.NumberFormat(e,{style:"currency",currency:s,currencyDisplay:"symbol"}),a=n.formatToParts(1),r=a.findIndex(d=>d.type==="currency"),i=a.findIndex(d=>d.type==="integer"),{minimumFractionDigits:o,maximumFractionDigits:l}=n.resolvedOptions();return{symbol:a[r]?.value??s,position:r>i?"end":"start",formatOptions:{style:"decimal",minimumFractionDigits:o,maximumFractionDigits:l}}}catch(n){return console.warn(`Invalid currency formatting: ${n}`),{symbol:s,position:"start",formatOptions:{style:"decimal",minimumFractionDigits:2,maximumFractionDigits:2}}}}const er=`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 ${Ne} motion-reduce:data-[pressed=true]:scale-100 [html[data-pos-reduce-motion=true]_&]:data-[pressed=true]:scale-100`,tr=`border bg-white shadow-none ${Ne}`,jm={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:`${er} 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:`${tr} 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:`${er} 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:`${tr} 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"}},$t={row:"flex flex-wrap gap-2",preset:"w-auto flex-[1_1_4.5rem] min-h-12 py-0",field:"flex-[2_1_10rem] min-w-0",inputWrapper:"h-12 min-h-12",input:"text-[0.9375rem] data-[has-start-content=true]:ps-1 data-[has-end-content=true]:pe-1",affix:"shrink-0 text-sm text-pos-neutral"},wm={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"}}},sr=[{id:"100",amount:100},{id:"250",amount:250},{id:"500",amount:500},{id:"1000",amount:1e3},{id:"2000",amount:2e3}],Nm={title:"Donation Amount",customAmountPlaceholder:"Custom donation amount",customAmountAriaLabel:"Custom donation amount",addDonationButton:"Add Donation",presetsAriaLabel:"Suggested amounts"},Wi=({presetAmounts:e=sr,selectedDonation:s,defaultSelectedDonation:n=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:b="bordered",buttonColor:v="default",inputVariant:g="bordered",size:y="md",className:N="",showCard:k=!0,variant:w="pill",customAmountPlacement:$="below",isRequired:A=!1})=>{const j={...Nm,...f},L=h.useId(),S=`${L}-title`,M=`${L}-custom`,D=Array.isArray(e)?e:sr,E={2:"grid-cols-2",3:"grid-cols-3"},R={3:"sm:grid-cols-3",4:"sm:grid-cols-4",5:"sm:grid-cols-5",6:"sm:grid-cols-6"},T=`${E[m]} ${R[p]}`,[H,K]=is(s,n,a),[B,se]=h.useState(""),[G,Q]=h.useState(!1),[Y,ce]=h.useState(0),ne=h.useCallback(ae=>{if(x)return;const Se={amount:ae.amount,isCustom:!1,presetId:ae.id};K(Se),se(""),Q(!1),ce(He=>He+1),r?.(Se)},[x,K,r]),ee=h.useCallback(ae=>{if(x)return;if(se(ae!==void 0?String(ae):""),r){K(null);return}if(Q(!1),ae===void 0||isNaN(ae)){K(null);return}K({amount:ae,isCustom:!0})},[x,K,r]),le=h.useCallback(()=>{if(x)return;const ae=B!==""?parseFloat(B):void 0;ae===void 0||isNaN(ae)||r?.({amount:ae,isCustom:!0})},[x,B,r]),U=h.useMemo(()=>({style:"currency",currency:i,currencyDisplay:"symbol"}),[i]),z=h.useMemo(()=>vm(o,i),[o,i]),Z=ae=>H!==null&&!H.isCustom&&H.presetId===ae.id,Ue=(ae,Se)=>{const He=H?.isCustom===!0,it=!r&&G,je=w==="tile"&&$==="inline",We=je?t.jsx("span",{className:$t.affix,"data-testid":"donation-amounts-custom-symbol",children:z.symbol}):void 0,ue=t.jsxs("div",{className:c.cn("flex items-start gap-3",je&&$t.field),"data-testid":"donation-amounts-custom-field",children:[t.jsx(c.NumberInput,{id:M,placeholder:j.customAmountPlaceholder,"aria-label":je?j.customAmountLabel??j.customAmountAriaLabel:j.customAmountLabel?void 0:j.customAmountAriaLabel,onInput:r?()=>{K(null),Q(!0)}:()=>Q(!0),onBlur:r?void 0:()=>Q(!1),variant:"bordered",minValue:d,maxValue:u,step:.01,formatOptions:je?z.formatOptions:U,startContent:z.position==="start"?We:void 0,endContent:z.position==="end"?We:void 0,value:B!==""?parseFloat(B):void 0,onValueChange:ee,isDisabled:x,className:"flex-1",classNames:{inputWrapper:c.cn(ae.inputWrapper,Se.wrapper,je&&$t.inputWrapper,(He||it)&&ae.inputWrapperActive),input:c.cn(ae.input,Se.input,je&&$t.input)},"data-testid":"donation-amounts-custom-input",hideStepper:!0},r?`custom-${Y}`:H?.isCustom===!1?H.presetId:"custom"),r&&t.jsx(I,{color:"primary",variant:"solid",size:y,className:"shrink-0",onPress:le,isDisabled:x||!G,"data-testid":"donation-amounts-add-button",children:j.addDonationButton})]}),we=l&&(je?ue:t.jsxs("div",{className:c.cn("flex flex-col",ae.inputBase),children:[j.customAmountLabel&&t.jsx("label",{htmlFor:M,className:ae.customLabel,"data-testid":"donation-amounts-custom-label",children:j.customAmountLabel}),ue]}));return t.jsxs("div",{className:ae.root,"data-testid":"donation-amounts-root","data-variant":w,"data-custom-placement":je?"inline":void 0,children:[j.eyebrow&&t.jsx("p",{className:ae.eyebrow,"data-testid":"donation-amounts-eyebrow",children:j.eyebrow}),j.title&&t.jsxs("p",{id:S,className:ae.title,"data-testid":"donation-amounts-title",children:[j.title,A&&t.jsx("span",{"aria-hidden":"true",className:"ml-0.5 text-pos-danger",children:"*"})]}),j.caption&&t.jsx("p",{className:ae.caption,"data-testid":"donation-amounts-caption",children:j.caption}),(D.length>0||je&&we)&&t.jsxs("div",{role:"group","aria-labelledby":j.title?S:void 0,"aria-label":j.title?void 0:j.presetsAriaLabel,className:je?$t.row:c.cn(ae.grid,w==="tile"&&T),"data-testid":"donation-amounts-presets",children:[D.map(Ce=>{const C=Z(Ce)&&!it;return t.jsxs(I,{color:"default",variant:"bordered",disableRipple:!0,"aria-pressed":C,className:c.cn(ae.preset,je&&$t.preset,C?ae.presetSelected:ae.presetIdle),onPress:()=>ne(Ce),isDisabled:x,"data-selected":C||void 0,"data-testid":`donation-amounts-preset-${Ce.id}`,children:[t.jsx("span",{className:c.cn(ae.amount,C&&ae.amountSelected),children:Ce.label||Ja(Ce.amount,o,i,w!=="pos")}),Ce.sublabel&&" ",Ce.sublabel&&t.jsx("span",{className:ae.sublabel,"data-testid":`donation-amounts-preset-${Ce.id}-sublabel`,children:Ce.sublabel})]},Ce.id)}),je&&we]}),!je&&we]})},Re=t.jsxs("div",{className:"space-y-4","data-testid":"donation-amounts-root",children:[j.title&&t.jsx("h2",{id:S,className:"text-base font-semibold","data-testid":"donation-amounts-title",children:j.title}),D.length>0&&t.jsx("div",{role:"group","aria-labelledby":j.title?S:void 0,"aria-label":j.title?void 0:j.presetsAriaLabel,className:c.cn("grid gap-3",T),"data-testid":"donation-amounts-presets",children:D.map(ae=>{const Se=H!==null&&!H.isCustom&&H.presetId===ae.id;return t.jsx(I,{color:Se?"primary":v,variant:Se?"solid":b,className:"w-full","aria-pressed":Se,onPress:()=>ne(ae),isDisabled:x,"data-testid":`donation-amounts-preset-${ae.id}`,children:ae.label||Ja(ae.amount,o,i)},ae.id)})}),l&&t.jsxs("div",{className:"flex gap-3 items-start",children:[t.jsx(c.NumberInput,{placeholder:j.customAmountPlaceholder,"aria-label":j.customAmountAriaLabel,onInput:r?()=>{K(null),Q(!0)}:void 0,variant:g,radius:"full",size:y,minValue:d,maxValue:u,step:.01,formatOptions:U,value:B!==""?parseFloat(B):void 0,onValueChange:ee,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-${Y}`:H?.isCustom===!1?H.presetId:"custom"),r&&t.jsx(I,{color:"primary",variant:"solid",radius:"full",size:y,className:"shrink-0",onPress:le,isDisabled:x||!G,"data-testid":"donation-amounts-add-button",children:j.addDonationButton})]})]}),Me=w==="pill"?Re:Ue(jm[w],wm[w][y]);return k?t.jsx(c.Card,{className:c.cn("w-full",N),"data-testid":"donation-amounts-card",children:t.jsx(c.CardBody,{children:Me})}):t.jsx("div",{className:c.cn("w-full",N),"data-testid":"donation-amounts-plain",children:Me})};Wi.displayName="DonationAmounts";const Cm=e=>{const s=Math.max(0,e),n=Math.floor(s/60).toString().padStart(2,"0"),a=(s%60).toString().padStart(2,"0");return`${n}:${a} minutes`},km=e=>{switch(e){case"warning":return J.Clock;case"error":return J.AlertCircle;case"success":return J.CheckCircle;default:return J.Clock}},Sm=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"}},qi=h.forwardRef(({timeLeft:e,defaultTimeLeft:s=1200,onTimeChange:n,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=Cm,className:p,...x},b)=>{const[v,g]=is(e!==void 0?Math.max(0,e):void 0,Math.max(0,s),n),y=h.useRef(null),N=h.useRef(!1);h.useEffect(()=>()=>{y.current&&clearInterval(y.current)},[]),h.useEffect(()=>{if(!f||v<=0){y.current&&(clearInterval(y.current),y.current=null);return}return y.current=setInterval(()=>{g(A=>A<=1?(y.current&&(clearInterval(y.current),y.current=null),N.current||(N.current=!0,a?.()),0):A-1)},1e3),()=>{y.current&&(clearInterval(y.current),y.current=null)}},[f,v,g,a]),h.useEffect(()=>{v>0&&(N.current=!1)},[v]);const k=d||km(r),w=Sm(i),$={fixed:"fixed top-0 left-0",sticky:"sticky top-0",static:"static"};return t.jsx("div",{ref:b,role:"banner","aria-live":"polite","aria-label":`${o} ${m(v)}`,"data-testid":"expire-cart-timer",className:c.cn("w-full text-white z-50",w,$[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(k,{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(v)}`,"data-testid":"expire-cart-timer-value",children:m(v)})})]})})})});qi.displayName="ExpireCartTimer";const At=({icon:e,children:s,testId:n})=>t.jsxs("div",{className:"flex items-center gap-2 text-sm text-gray-600","data-testid":n,children:[t.jsx(P,{icon:e,width:20,className:"text-default-500"}),t.jsx("span",{children:s})]}),$m=({classes:e="",name:s,imageUrl:n,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,b]=h.useState(!1),[v,g]=h.useState(!1),y=h.useRef(null);return h.useEffect(()=>{const N=()=>{if(y.current){const k=y.current.scrollHeight>y.current.clientHeight;g(k)}};return N(),window.addEventListener("resize",N),()=>window.removeEventListener("resize",N)},[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&&n&&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 ${s}`,className:"w-full h-full object-cover object-center",src:n,"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:s}),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(At,{icon:"solar:calendar-minimalistic-linear",testId:"event-details-date",children:a}),r&&t.jsx(At,{icon:"solar:clock-circle-linear",testId:"event-details-time",children:r}),i&&t.jsx(At,{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:y,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&&v&&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"})]}),(v||x)&&t.jsx("div",{className:"flex justify-end mt-1",children:t.jsx(I,{onPress:()=>b(!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&&n&&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 ${s}`,className:"w-full h-full object-cover object-center",src:n,"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:s})]}),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(At,{icon:"solar:calendar-minimalistic-linear",testId:"event-details-date",children:a}),r&&t.jsx(At,{icon:"solar:clock-circle-linear",testId:"event-details-time",children:r}),i&&t.jsx(At,{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:y,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&&v&&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"})]}),(v||x)&&t.jsx("div",{className:"flex justify-end mt-1",children:t.jsx(I,{onPress:()=>b(!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 Sn(e,s="en-US",n="USD"){try{return new Intl.NumberFormat(s,{style:"currency",currency:n,minimumFractionDigits:2,maximumFractionDigits:2}).format(e)}catch(a){return console.warn(`Invalid currency formatting: ${a}`),`${n} ${e.toFixed(2)}`}}function Am(e){const s=e.replace(/[^\d.,-]/g,""),n=s.match(/,\d{1,2}$/);let a;n?a=s.replace(/\./g,"").replace(",","."):a=s.replace(/,/g,"");const r=parseFloat(a);return isNaN(r)?null:r}const Dm={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"},Dt=e=>typeof e=="number"&&!isNaN(e),$s=({offer:e,quantity:s,defaultQuantity:n=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:b=!0,priceDisplay:v,classNames:g={},"data-testid":y,selectedColor:N="default",selectionMode:k="stepper",compact:w=!1,isSoldOut:$,isMaxReached:A,isRuleBlocked:j,statusTone:L="default",statusLabel:S,disabledReason:M,disabled:D})=>{const E=h.useMemo(()=>({...Dm,...o}),[o]),[R,T]=h.useState(n),H=s!==void 0?s:R,K=!!(d||D),B=w||!!e.compact,se=k==="press-to-add",G=h.useMemo(()=>typeof $=="boolean"?$:typeof e.isSoldOut=="boolean"?e.isSoldOut:!Dt(e.totalTicketsSold)||!Dt(e.ticketsAllowed)?!1:e.totalTicketsSold>=e.ticketsAllowed,[$,e.isSoldOut,e.totalTicketsSold,e.ticketsAllowed]),Q=h.useMemo(()=>typeof A=="boolean"?A:typeof e.isMaxReached=="boolean"?e.isMaxReached:G||!Dt(e.ticketsAllowed)?!1:H>=e.ticketsAllowed-(e.totalTicketsSold??0),[A,e.isMaxReached,G,e.ticketsAllowed,e.totalTicketsSold,H]),Y=h.useMemo(()=>typeof j=="boolean"?j:typeof e.isRuleBlocked=="boolean"?e.isRuleBlocked:!1,[j,e.isRuleBlocked]),ce=M||e.disabledReason,ne=K||G||Y,ee=ue=>{if(ne||ue>0&&Q)return;const we=Math.max(0,H+ue);s===void 0&&T(we),a?.(e.id,we)},le=h.useMemo(()=>{if(G)return"soldOut";if(Y)return"ruleBlocked";if(K)return"disabled"},[G,Y,K]),U=h.useMemo(()=>L||(G||Y?"danger":Q?"warning":"default"),[L,G,Y,Q]),z=h.useMemo(()=>{if(le)return le==="ruleBlocked"?S||ce||E.ruleBlocked:le==="soldOut"?S||ce||E.soldOut:le==="disabled"?S||ce||E.disabled:S||E.maxReached},[le,S,ce,E]),Z={soldOut:"danger",ruleBlocked:U,disabled:"default",maxReached:"warning"},Ue={soldOut:"offer-card-sold-out-chip",maxReached:"offer-card-max-reached-chip",ruleBlocked:"offer-card-ruleBlocked-chip",disabled:"offer-card-disabled-chip"},Re=()=>l?.renderName?l.renderName(e.name,e):t.jsx("h2",{"data-testid":"offer-card-name",className:c.cn("text-base font-medium",B&&"text-sm",g.name),children:e.name}),Me=()=>{if(!b)return null;const ue=v?.price??e.price,we=v?.originalPrice,Ce=Sn(ue,i,r);if(l?.renderPrice)return l.renderPrice(ue,Ce,e);if(Dt(we)&&Dt(ue)&&we>ue){const F=Sn(we,i,r);return t.jsxs("div",{"data-testid":"offer-card-price",className:c.cn("flex items-center gap-2 mt-1",B&&"mt-0.5",g.price),children:[t.jsxs("span",{className:"sr-only",children:["Original price ",F,", discounted price ",Ce]}),t.jsx("span",{"aria-hidden":"true","data-testid":"offer-card-original-price",className:c.cn("text-gray-400 line-through text-sm",B&&"text-xs",g.originalPrice),children:F}),t.jsx("span",{"aria-hidden":"true","data-testid":"offer-card-discounted-price",className:c.cn("text-primary text-base font-semibold",B&&"text-sm",g.discountedPrice),children:Ce})]})}return t.jsx("p",{"data-testid":"offer-card-price",className:c.cn("text-primary text-base mt-1",B&&"text-sm mt-0.5",g.price),children:Ce})},ae=()=>!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",B&&"mb-2 text-xs text-gray-600",g.description),children:e.description}),Se=()=>{if(!x||!Dt(e.numberOfPeople)||e.numberOfPeople<=0)return null;const ue=e.numberOfPeople===1?E.person:E.people;return l?.renderPeopleCount?l.renderPeopleCount(e.numberOfPeople,ue,e):t.jsxs("p",{"data-testid":"offer-card-people-count",className:c.cn("text-sm text-gray-600 flex items-center mt-2",B&&"mt-1 text-xs",g.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," ",ue]})},He=()=>{const ue=H===0||ne,we=Q||ne;return l?.renderQuantitySelector?l.renderQuantitySelector({quantity:H,onIncrement:()=>ee(1),onDecrement:()=>ee(-1),isDecrementDisabled:ue,isIncrementDisabled:we,isDisabled:ne}):t.jsxs("div",{className:c.cn("flex items-center gap-2",g.quantitySelector),children:[t.jsx(I,{"data-testid":"offer-card-decrement-button",onPress:()=>ee(-1),isDisabled:ue,variant:u,color:H>0?N:f,radius:"full",isIconOnly:!0,size:B?"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",B&&"text-sm"),children:H}),t.jsx(I,{"data-testid":"offer-card-increment-button",onPress:()=>ee(1),isDisabled:we,variant:u,color:H>0?N:f,radius:"full",isIconOnly:!0,size:B?"md":"sm","aria-label":"Increase quantity",children:t.jsx(P,{icon:"gravity-ui:plus",width:16})})]})},it=(ue,we)=>l?.renderDisabledState?l.renderDisabledState(ue,we):ue==="soldOut"&&l?.renderSoldOut?l.renderSoldOut(we):ue==="maxReached"&&l?.renderMaxReachedAlert?l.renderMaxReachedAlert(we):t.jsx(c.Chip,{"data-testid":Ue[ue],color:Z[ue],variant:ue==="maxReached"?"flat":"solid",className:c.cn("gap-2 px-4",ue==="maxReached"?"h-8":"h-10",ue==="soldOut"&&g.soldOut,ue==="maxReached"&&g.maxReachedAlert,B&&"h-8"),startContent:t.jsx(P,{icon:"gravity-ui:triangle-exclamation-fill",width:14}),children:t.jsx("span",{className:"font-medium text-sm",children:we})}),je=t.jsxs("div",{className:c.cn("grid grid-cols-1 md:grid-cols-1 xl:grid-cols-3 lg:grid-cols-3 items-start",B?"gap-1":"gap-2"),children:[t.jsxs("div",{className:c.cn("h-full col-span-2",ne||Q?"opacity-50 pointer-events-none select-none":""),children:[Re(),Me(),t.jsxs("div",{className:c.cn("md:col-span-1 xl:col-span-2 lg:col-span-1",B?"mb-1":"mb-2"),children:[Se(),ae()]})]}),!se&&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",B&&"space-x-1 pb-1 md:p-1",g.compactFooter),children:le&&z?it(le,z):He()})]}),We=Q&&!G&&!Y&&!K?t.jsx(Ve.motion.div,{className:c.cn("w-full sm:max-w-[60%] md:max-w-[60%] lg:max-w-[60%]",g.compactFooter),initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:10},transition:{duration:.3},children:it("maxReached",z||E.maxReached)}):null;return m?t.jsxs(c.Card,{className:c.cn("w-full",se&&!ne&&!Q&&"cursor-pointer",B&&g.compact,g.base),"data-testid":y||`offer-card-${e.id}`,isPressable:se&&!ne&&!Q,onPress:se&&!ne&&!Q?()=>ee(1):void 0,children:[t.jsx(c.CardBody,{className:c.cn("pt-1 pb-0",B?"pb-0.5":"",g.body),children:je}),t.jsx(Ve.AnimatePresence,{children:We&&t.jsx(c.CardFooter,{className:c.cn("w-full mt-0 pt-0",B?"pt-1":"",g.footer),children:We})})]}):t.jsxs("div",{className:c.cn("w-full",B&&g.compact,g.base),"data-testid":y||`offer-card-${e.id}`,children:[t.jsx("div",{className:c.cn("pt-1 pb-0",B?"pb-0.5":"",g.body),children:je}),t.jsx(Ve.AnimatePresence,{children:We&&t.jsx("div",{className:c.cn("w-full mt-0 pt-0",B?"pt-1":"",g.footer),children:We})})]})};$s.displayName="OfferCard";const Gi=({message:e="No offers available.",icon:s="solar:ticket-sale-outline",iconSize:n=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:s,width:n,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})};Gi.displayName="OfferCardEmpty";const Em={title:"Error Fetching Offers",description:"An error occurred while fetching offers."},Ki=({error:e,labels:s,showCard:n=!0,color:a="danger",classNames:r={}})=>{const i={...Em,...s},o=t.jsx(c.Alert,{"data-testid":"offer-card-error-alert",color:a,title:i.title,description:e||i.description,className:r.alert});return n?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 Lm={1:"space-y-1",2:"space-y-2",3:"space-y-3",4:"space-y-4",5:"space-y-5",6:"space-y-6"},Yi=({quantity:e=2,gap:s=4,classNames:n={}})=>{const a=Lm[s];return t.jsx("div",{"data-testid":"offer-card-skeleton-container",className:c.cn(a,n.base),children:Array.from({length:e}).map((r,i)=>t.jsxs(c.Card,{"data-testid":`offer-card-skeleton-${i}`,className:c.cn("w-full",n.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(ie,{"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(ie,{"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(ie,{"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(ie,{"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(ie,{"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(ie,{"data-testid":`offer-card-skeleton-btn-dec-${i}`,className:"w-8 h-8 rounded-md bg-default-300"}),t.jsx(ie,{"data-testid":`offer-card-skeleton-btn-qty-${i}`,className:"w-8 h-8 rounded-md bg-default-200"}),t.jsx(ie,{"data-testid":`offer-card-skeleton-btn-inc-${i}`,className:"w-8 h-8 rounded-md bg-default-300"})]})]})})]})})]},i))})};Yi.displayName="OfferCardSkeleton";const Qi={hidden:{opacity:0},show:{opacity:1,transition:{staggerChildren:.15,delayChildren:.1}}},Zi={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"}}},Fm={1:"gap-1",2:"gap-2",3:"gap-3",4:"gap-4",5:"gap-5",6:"gap-6"},Xi=({offers:e=[],mapOffer:s,selection:n,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:b=!0,gap:v=2,compact:g=!1,classNames:y={}})=>{const[N,k]=h.useState(a),w=n!==void 0?n:N,$=h.useCallback((D,E)=>{const R={...w,[D]:Math.max(0,E)};n===void 0&&k(R),r?.(R),i?.(D,R[D])},[w,n,r,i]),A=[...e].sort((D,E)=>(D.position??0)-(E.position??0)),j=D=>{const E=s?s(D):D,R=(w??{})[E.id]||0;return{offer:E,quantity:R,onQuantityChange:$,currency:o,locale:l,labels:d,slots:u,isDisabled:f,buttonVariant:m,buttonColor:p,showCard:x,compact:g}},L=Fm[v],S=c.cn("grid mx-auto pt-2",L,y.base),M=D=>{const E=j(D);return t.jsx($s,{offer:E.offer,quantity:E.quantity,onQuantityChange:E.onQuantityChange,currency:E.currency,locale:E.locale,labels:E.labels,slots:E.slots,isDisabled:E.isDisabled,buttonVariant:E.buttonVariant,buttonColor:E.buttonColor,showCard:E.showCard,compact:E.compact,classNames:y.card},E.offer.id)};return b?t.jsx(Ve.motion.div,{"data-testid":"offer-card-list",className:S,variants:Qi,initial:"hidden",animate:"show",children:t.jsx(Ve.AnimatePresence,{children:A.map(D=>{const E=j(D);return t.jsx(Ve.motion.div,{"data-testid":`offer-card-list-item-${E.offer.id}`,className:y.cardWrapper,variants:Zi,exit:{opacity:0,y:-20},transition:{duration:.3},children:t.jsx($s,{offer:E.offer,quantity:E.quantity,onQuantityChange:$,currency:o,locale:l,labels:d,slots:u,isDisabled:f,buttonVariant:m,buttonColor:p,showCard:x,compact:g||E.offer.compact,classNames:y.card})},E.offer.id)})})}):t.jsx("div",{"data-testid":"offer-card-list",className:S,children:A.map(M)})};Xi.displayName="OfferCardList";var ls=e=>e.type==="checkbox",Nt=e=>e instanceof Date,Ke=e=>e==null;const Ji=e=>typeof e=="object";var Ee=e=>!Ke(e)&&!Array.isArray(e)&&Ji(e)&&!Nt(e),el=e=>Ee(e)&&e.target?ls(e.target)?e.target.checked:e.target.value:e,_m=e=>e.substring(0,e.search(/\.\d+(\.|$)/))||e,tl=(e,s)=>e.has(_m(s)),Rm=e=>{const s=e.constructor&&e.constructor.prototype;return Ee(s)&&s.hasOwnProperty("isPrototypeOf")},Kn=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function $e(e){if(e instanceof Date)return new Date(e);const s=typeof FileList<"u"&&e instanceof FileList;if(Kn&&(e instanceof Blob||s))return e;const n=Array.isArray(e);if(!n&&!(Ee(e)&&Rm(e)))return e;const a=n?[]:Object.create(Object.getPrototypeOf(e));for(const r in e)Object.prototype.hasOwnProperty.call(e,r)&&(a[r]=$e(e[r]));return a}var Bs=e=>/^\w*$/.test(e),be=e=>e===void 0,Yn=e=>Array.isArray(e)?e.filter(Boolean):[],Qn=e=>Yn(e.replace(/["|']|\]/g,"").split(/\.|\[/)),q=(e,s,n)=>{if(!s||!Ee(e))return n;const a=(Bs(s)?[s]:Qn(s)).reduce((r,i)=>Ke(r)?r:r[i],e);return be(a)||a===e?be(e[s])?n:e[s]:a},Qe=e=>typeof e=="boolean",ze=e=>typeof e=="function",pe=(e,s,n)=>{let a=-1;const r=Bs(s)?[s]:Qn(s),i=r.length,o=i-1;for(;++a<i;){const l=r[a];let d=n;if(a!==o){const u=e[l];d=Ee(u)||Array.isArray(u)?u:isNaN(+r[a+1])?{}:[]}if(l==="__proto__"||l==="constructor"||l==="prototype")return;e[l]=d,e=e[l]}};const As={BLUR:"blur",FOCUS_OUT:"focusout",CHANGE:"change"},nt={onBlur:"onBlur",onChange:"onChange",onSubmit:"onSubmit",onTouched:"onTouched",all:"all"},ct={max:"max",min:"min",maxLength:"maxLength",minLength:"minLength",pattern:"pattern",required:"required",validate:"validate"},sl=h.createContext(null);sl.displayName="HookFormControlContext";const Zn=()=>h.useContext(sl);var nl=(e,s,n,a=!0)=>{const r={defaultValues:s._defaultValues};for(const i in e)Object.defineProperty(r,i,{get:()=>{const o=i;return s._proxyFormState[o]!==nt.all&&(s._proxyFormState[o]=!a||nt.all),n&&(n[o]=!0),e[o]}});return r};const Xn=typeof window<"u"?h.useLayoutEffect:h.useEffect;function Mm(e){const s=Zn(),{control:n=s,disabled:a,name:r,exact:i}=e||{},[o,l]=h.useState(n._formState),d=h.useRef({isDirty:!1,isLoading:!1,dirtyFields:!1,touchedFields:!1,validatingFields:!1,isValidating:!1,isValid:!1,errors:!1});return Xn(()=>n._subscribe({name:r,formState:d.current,exact:i,callback:u=>{!a&&l({...n._formState,...u})}}),[r,a,i]),h.useEffect(()=>{d.current.isValid&&n._setValid(!0)},[n]),h.useMemo(()=>nl(o,n,d.current,!1),[o,n])}var Xe=e=>typeof e=="string",$n=(e,s,n,a,r)=>Xe(e)?(a&&s.watch.add(e),q(n,e,r)):Array.isArray(e)?e.map(i=>(a&&s.watch.add(i),q(n,i))):(a&&(s.watchAll=!0),n),An=e=>Ke(e)||!Ji(e);function at(e,s,n=new WeakSet){if(An(e)||An(s))return Object.is(e,s);if(Nt(e)&&Nt(s))return Object.is(e.getTime(),s.getTime());const a=Object.keys(e),r=Object.keys(s);if(a.length!==r.length)return!1;if(n.has(e)||n.has(s))return!0;n.add(e),n.add(s);for(const i of a){const o=e[i];if(!r.includes(i))return!1;if(i!=="ref"){const l=s[i];if(Nt(o)&&Nt(l)||Ee(o)&&Ee(l)||Array.isArray(o)&&Array.isArray(l)?!at(o,l,n):!Object.is(o,l))return!1}}return!0}function Pm(e){const s=Zn(),{control:n=s,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(n),p=h.useRef(a);u.current=l;const[x,b]=h.useState(()=>{const w=n._getWatch(a,d.current);return u.current?u.current(w):w}),v=h.useCallback(w=>{const $=$n(a,n._names,w||n._formValues,!1,d.current);return u.current?u.current($):$},[n._formValues,n._names,a]),g=h.useCallback(w=>{if(!i){const $=$n(a,n._names,w||n._formValues,!1,d.current);if(u.current){const A=u.current($);at(A,f.current)||(b(A),f.current=A)}else b($)}},[n._formValues,n._names,i,a]);Xn(()=>((m.current!==n||!at(p.current,a))&&(m.current=n,p.current=a,g()),n._subscribe({name:a,formState:{values:!0},exact:o,callback:w=>{g(w.values)}})),[n,o,a,g]),h.useEffect(()=>n._removeUnmounted());const y=m.current!==n,N=p.current,k=h.useMemo(()=>{if(i)return null;const w=!y&&!at(N,a);return y||w?v():null},[i,y,a,N,v]);return k!==null?k:x}function Tm(e){const s=Zn(),{name:n,disabled:a,control:r=s,shouldUnregister:i,defaultValue:o,exact:l=!0}=e,d=tl(r._names.array,n),u=h.useMemo(()=>q(r._formValues,n,q(r._defaultValues,n,o)),[r,n,o]),f=Pm({control:r,name:n,defaultValue:u,exact:l}),m=Mm({control:r,name:n,exact:l}),p=h.useRef(e),x=h.useRef(void 0),b=h.useRef(r.register(n,{...e.rules,value:f,...Qe(e.disabled)?{disabled:e.disabled}:{}}));p.current=e;const v=h.useMemo(()=>Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!q(m.errors,n)},isDirty:{enumerable:!0,get:()=>!!q(m.dirtyFields,n)},isTouched:{enumerable:!0,get:()=>!!q(m.touchedFields,n)},isValidating:{enumerable:!0,get:()=>!!q(m.validatingFields,n)},error:{enumerable:!0,get:()=>q(m.errors,n)}}),[m,n]),g=h.useCallback(w=>b.current.onChange({target:{value:el(w),name:n},type:As.CHANGE}),[n]),y=h.useCallback(()=>b.current.onBlur({target:{value:q(r._formValues,n),name:n},type:As.BLUR}),[n,r._formValues]),N=h.useCallback(w=>{const $=q(r._fields,n);$&&$._f&&w&&($._f.ref={focus:()=>ze(w.focus)&&w.focus(),select:()=>ze(w.select)&&w.select(),setCustomValidity:A=>ze(w.setCustomValidity)&&w.setCustomValidity(A),reportValidity:()=>ze(w.reportValidity)&&w.reportValidity()})},[r._fields,n]),k=h.useMemo(()=>({name:n,value:f,...Qe(a)||m.disabled?{disabled:m.disabled||a}:{},onChange:g,onBlur:y,ref:N}),[n,a,m.disabled,g,y,N,f]);return h.useEffect(()=>{const w=r._options.shouldUnregister||i,$=x.current;$&&$!==n&&!d&&r.unregister($),r.register(n,{...p.current.rules,...Qe(p.current.disabled)?{disabled:p.current.disabled}:{}});const A=(j,L)=>{const S=q(r._fields,j);S&&S._f&&(S._f.mount=L)};if(A(n,!0),w){const j=$e(q(r._options.defaultValues,n,p.current.defaultValue));pe(r._defaultValues,n,j),be(q(r._formValues,n))&&pe(r._formValues,n,j)}return!d&&r.register(n),x.current=n,()=>{(d?w&&!r._state.action:w)?r.unregister(n):A(n,!1)}},[n,r,d,i]),h.useEffect(()=>{r._setDisabledField({disabled:a,name:n})},[a,n,r]),h.useMemo(()=>({field:k,formState:m,fieldState:v}),[k,m,v])}const Im=h.createContext(null);Im.displayName="HookFormContext";var Om=(e,s,n,a,r)=>s?{...n[e],types:{...n[e]&&n[e].types?n[e].types:{},[a]:r||!0}}:{},Xt=e=>Array.isArray(e)?e:[e],nr=()=>{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 al(e,s){const n={};for(const a in e)if(e.hasOwnProperty(a)){const r=e[a],i=s[a];if(r&&Ee(r)&&i){const o=al(r,i);Ee(o)&&(n[a]=o)}else e[a]&&(n[a]=i)}return n}var Be=e=>Ee(e)&&!Object.keys(e).length,Jn=e=>e.type==="file",Ds=e=>{if(!Kn)return!1;const s=e?e.ownerDocument:0;return e instanceof(s&&s.defaultView?s.defaultView.HTMLElement:HTMLElement)},rl=e=>e.type==="select-multiple",ea=e=>e.type==="radio",Bm=e=>ea(e)||ls(e),nn=e=>Ds(e)&&e.isConnected;function zm(e,s){const n=s.slice(0,-1).length;let a=0;for(;a<n;)e=be(e)?a++:e[s[a++]];return e}function Vm(e){for(const s in e)if(e.hasOwnProperty(s)&&!be(e[s]))return!1;return!0}function Ae(e,s){const n=Array.isArray(s)?s:Bs(s)?[s]:Qn(s),a=n.length===1?e:zm(e,n),r=n.length-1,i=n[r];return a&&delete a[i],r!==0&&(Ee(a)&&Be(a)||Array.isArray(a)&&Vm(a))&&Ae(e,n.slice(0,-1)),e}var Um=e=>{for(const s in e)if(ze(e[s]))return!0;return!1};function il(e){return Array.isArray(e)||Ee(e)&&!Um(e)}function Dn(e,s={}){for(const n in e){const a=e[n];il(a)?(s[n]=Array.isArray(a)?[]:{},Dn(a,s[n])):be(a)||(s[n]=!0)}return s}function Rt(e,s,n){n||(n=Dn(s));for(const a in e){const r=e[a];if(il(r))be(s)||An(n[a])?n[a]=Dn(r,Array.isArray(r)?[]:{}):Rt(r,Ke(s)?{}:s[a],n[a]);else{const i=s[a];n[a]=!at(r,i)}}return n}const ar={value:!1,isValid:!1},rr={value:!0,isValid:!0};var ll=e=>{if(Array.isArray(e)){if(e.length>1){const s=e.filter(n=>n&&n.checked&&!n.disabled).map(n=>n.value);return{value:s,isValid:!!s.length}}return e[0].checked&&!e[0].disabled?e[0].attributes&&!be(e[0].attributes.value)?be(e[0].value)||e[0].value===""?rr:{value:e[0].value,isValid:!0}:rr:ar}return ar},ol=(e,{valueAsNumber:s,valueAsDate:n,setValueAs:a})=>be(e)?e:s?e===""?NaN:e&&+e:n&&Xe(e)?new Date(e):a?a(e):e;const ir={isValid:!1,value:null};var cl=e=>Array.isArray(e)?e.reduce((s,n)=>n&&n.checked&&!n.disabled?{isValid:!0,value:n.value}:s,ir):ir;function lr(e){const s=e.ref;return Jn(s)?s.files:ea(s)?cl(e.refs).value:rl(s)?[...s.selectedOptions].map(({value:n})=>n):ls(s)?ll(e.refs).value:ol(be(s.value)?e.ref.value:s.value,e)}var Hm=(e,s,n,a)=>{const r={};for(const i of e){const o=q(s,i);o&&pe(r,i,o._f)}return{criteriaMode:n,names:[...e],fields:r,shouldUseNativeValidation:a}},Es=e=>e instanceof RegExp,Ht=e=>be(e)?e:Es(e)?e.source:Ee(e)?Es(e.value)?e.value.source:e.value:e,or=e=>({isOnSubmit:!e||e===nt.onSubmit,isOnBlur:e===nt.onBlur,isOnChange:e===nt.onChange,isOnAll:e===nt.all,isOnTouch:e===nt.onTouched});const cr="AsyncFunction";var Wm=e=>!!e&&!!e.validate&&!!(ze(e.validate)&&e.validate.constructor.name===cr||Ee(e.validate)&&Object.values(e.validate).find(s=>s.constructor.name===cr)),qm=e=>e.mount&&(e.required||e.min||e.max||e.maxLength||e.minLength||e.pattern||e.validate),dr=(e,s,n)=>!n&&(s.watchAll||s.watch.has(e)||[...s.watch].some(a=>e.startsWith(a)&&/^\.\w+/.test(e.slice(a.length))));const Jt=(e,s,n,a)=>{for(const r of n||Object.keys(e)){const i=q(e,r);if(i){const{_f:o,...l}=i;if(o){if(o.refs&&o.refs[0]&&s(o.refs[0],r)&&!a)return!0;if(o.ref&&s(o.ref,o.name)&&!a)return!0;if(Jt(l,s))break}else if(Ee(l)&&Jt(l,s))break}}};function ur(e,s,n){const a=q(e,n);if(a||Bs(n))return{error:a,name:n};const r=n.split(".");for(;r.length;){const i=r.join("."),o=q(s,i),l=q(e,i);if(o&&!Array.isArray(o)&&n!==i)return{name:n};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:n}}var Gm=(e,s,n,a)=>{n(e);const{name:r,...i}=e;return Be(i)||Object.keys(i).length>=Object.keys(s).length||Object.keys(i).find(o=>s[o]===(!a||nt.all))},Km=(e,s,n)=>!e||!s||e===s||Xt(e).some(a=>a&&(n?a===s:a.startsWith(s)||s.startsWith(a))),Ym=(e,s,n,a,r)=>r.isOnAll?!1:!n&&r.isOnTouch?!(s||e):(n?a.isOnBlur:r.isOnBlur)?!e:(n?a.isOnChange:r.isOnChange)?e:!0,Qm=(e,s)=>!Yn(q(e,s)).length&&Ae(e,s),Zm=(e,s,n)=>{const a=Xt(q(e,n));return pe(a,"root",s[n]),pe(e,n,a),e};function mr(e,s,n="validate"){if(Xe(e)||Array.isArray(e)&&e.every(Xe)||Qe(e)&&!e)return{type:n,message:Xe(e)?e:"",ref:s}}var Et=e=>Ee(e)&&!Es(e)?e:{value:e,message:""},fr=async(e,s,n,a,r,i)=>{const{ref:o,refs:l,required:d,maxLength:u,minLength:f,min:m,max:p,pattern:x,validate:b,name:v,valueAsNumber:g,mount:y}=e._f,N=q(n,v);if(!y||s.has(v))return{};const k=l?l[0]:o,w=E=>{r&&k.reportValidity&&(k.setCustomValidity(Qe(E)?"":E||""),k.reportValidity())},$={},A=ea(o),j=ls(o),L=A||j,S=(g||Jn(o))&&be(o.value)&&be(N)||Ds(o)&&o.value===""||N===""||Array.isArray(N)&&!N.length,M=Om.bind(null,v,a,$),D=(E,R,T,H=ct.maxLength,K=ct.minLength)=>{const B=E?R:T;$[v]={type:E?H:K,message:B,ref:o,...M(E?H:K,B)}};if(i?!Array.isArray(N)||!N.length:d&&(!L&&(S||Ke(N))||Qe(N)&&!N||j&&!ll(l).isValid||A&&!cl(l).isValid)){const{value:E,message:R}=Xe(d)?{value:!!d,message:d}:Et(d);if(E&&($[v]={type:ct.required,message:R,ref:k,...M(ct.required,R)},!a))return w(R),$}if(!S&&(!Ke(m)||!Ke(p))){let E,R;const T=Et(p),H=Et(m);if(!Ke(N)&&!isNaN(N)){const K=o.valueAsNumber||N&&+N;Ke(T.value)||(E=K>T.value),Ke(H.value)||(R=K<H.value)}else{const K=o.valueAsDate||new Date(N),B=Q=>new Date(new Date().toDateString()+" "+Q),se=o.type=="time",G=o.type=="week";Xe(T.value)&&N&&(E=se?B(N)>B(T.value):G?N>T.value:K>new Date(T.value)),Xe(H.value)&&N&&(R=se?B(N)<B(H.value):G?N<H.value:K<new Date(H.value))}if((E||R)&&(D(!!E,T.message,H.message,ct.max,ct.min),!a))return w($[v].message),$}if((u||f)&&!S&&(Xe(N)||i&&Array.isArray(N))){const E=Et(u),R=Et(f),T=!Ke(E.value)&&N.length>+E.value,H=!Ke(R.value)&&N.length<+R.value;if((T||H)&&(D(T,E.message,R.message),!a))return w($[v].message),$}if(x&&!S&&Xe(N)){const{value:E,message:R}=Et(x);if(Es(E)&&!N.match(E)&&($[v]={type:ct.pattern,message:R,ref:o,...M(ct.pattern,R)},!a))return w(R),$}if(b){if(ze(b)){const E=await b(N,n),R=mr(E,k);if(R&&($[v]={...R,...M(ct.validate,R.message)},!a))return w(R.message),$}else if(Ee(b)){let E={};for(const R in b){if(!Be(E)&&!a)break;const T=mr(await b[R](N,n),k,R);T&&(E={...T,...M(R,T.message)},w(T.message),a&&($[v]=E))}if(!Be(E)&&($[v]={ref:k,...E},!a))return $}}return w(!0),$};const Xm={mode:nt.onSubmit,reValidateMode:nt.onChange,shouldFocusError:!0};function Jm(e={}){let s={...Xm,...e},n={submitCount:0,isDirty:!1,isReady:!1,isLoading:ze(s.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{},errors:s.errors||{},disabled:s.disabled||!1},a={},r=Ee(s.defaultValues)||Ee(s.values)?$e(s.defaultValues||s.values)||{}:{},i=s.shouldUnregister?{}:$e(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:nr(),state:nr()},b=s.criteriaMode===nt.all,v=C=>F=>{clearTimeout(u),u=setTimeout(C,F)},g=async C=>{if(!o.keepIsValid&&!s.disabled&&(m.isValid||p.isValid||C)){let F;s.resolver?(F=Be((await L()).errors),y()):F=await M(a,!0),F!==n.isValid&&x.state.next({isValid:F})}},y=(C,F)=>{!s.disabled&&(m.isValidating||m.validatingFields||p.isValidating||p.validatingFields)&&((C||Array.from(l.mount)).forEach(_=>{_&&(F?pe(n.validatingFields,_,F):Ae(n.validatingFields,_))}),x.state.next({validatingFields:n.validatingFields,isValidating:!Be(n.validatingFields)}))},N=(C,F=[],_,W,V=!0,O=!0)=>{if(W&&_&&!s.disabled){if(o.action=!0,O&&Array.isArray(q(a,C))){const X=_(q(a,C),W.argA,W.argB);V&&pe(a,C,X)}if(O&&Array.isArray(q(n.errors,C))){const X=_(q(n.errors,C),W.argA,W.argB);V&&pe(n.errors,C,X),Qm(n.errors,C)}if((m.touchedFields||p.touchedFields)&&O&&Array.isArray(q(n.touchedFields,C))){const X=_(q(n.touchedFields,C),W.argA,W.argB);V&&pe(n.touchedFields,C,X)}(m.dirtyFields||p.dirtyFields)&&(n.dirtyFields=Rt(r,i)),x.state.next({name:C,isDirty:E(C,F),dirtyFields:n.dirtyFields,errors:n.errors,isValid:n.isValid})}else pe(i,C,F)},k=(C,F)=>{pe(n.errors,C,F),x.state.next({errors:n.errors})},w=C=>{n.errors=C,x.state.next({errors:n.errors,isValid:!1})},$=(C,F,_,W)=>{const V=q(a,C);if(V){const O=q(i,C,be(_)?q(r,C):_);be(O)||W&&W.defaultChecked||F?pe(i,C,F?O:lr(V._f)):H(C,O),o.mount&&!o.action&&g()}},A=(C,F,_,W,V)=>{let O=!1,X=!1;const me={name:C};if(!s.disabled){if(!_||W){(m.isDirty||p.isDirty)&&(X=n.isDirty,n.isDirty=me.isDirty=E(),O=X!==me.isDirty);const fe=at(q(r,C),F);X=!!q(n.dirtyFields,C),fe?Ae(n.dirtyFields,C):pe(n.dirtyFields,C,!0),me.dirtyFields=n.dirtyFields,O=O||(m.dirtyFields||p.dirtyFields)&&X!==!fe}if(_){const fe=q(n.touchedFields,C);fe||(pe(n.touchedFields,C,_),me.touchedFields=n.touchedFields,O=O||(m.touchedFields||p.touchedFields)&&fe!==_)}O&&V&&x.state.next(me)}return O?me:{}},j=(C,F,_,W)=>{const V=q(n.errors,C),O=(m.isValid||p.isValid)&&Qe(F)&&n.isValid!==F;if(s.delayError&&_?(d=v(()=>k(C,_)),d(s.delayError)):(clearTimeout(u),d=null,_?pe(n.errors,C,_):Ae(n.errors,C)),(_?!at(V,_):V)||!Be(W)||O){const X={...W,...O&&Qe(F)?{isValid:F}:{},errors:n.errors,name:C};n={...n,...X},x.state.next(X)}},L=async C=>(y(C,!0),await s.resolver(i,s.context,Hm(C||l.mount,a,s.criteriaMode,s.shouldUseNativeValidation))),S=async C=>{const{errors:F}=await L(C);if(y(C),C)for(const _ of C){const W=q(F,_);W?pe(n.errors,_,W):Ae(n.errors,_)}else n.errors=F;return F},M=async(C,F,_={valid:!0})=>{for(const W in C){const V=C[W];if(V){const{_f:O,...X}=V;if(O){const me=l.array.has(O.name),fe=V._f&&Wm(V._f);fe&&m.validatingFields&&y([O.name],!0);const Ie=await fr(V,l.disabled,i,b,s.shouldUseNativeValidation&&!F,me);if(fe&&m.validatingFields&&y([O.name]),Ie[O.name]&&(_.valid=!1,F||e.shouldUseNativeValidation))break;!F&&(q(Ie,O.name)?me?Zm(n.errors,Ie,O.name):pe(n.errors,O.name,Ie[O.name]):Ae(n.errors,O.name))}!Be(X)&&await M(X,F,_)}}return _.valid},D=()=>{for(const C of l.unMount){const F=q(a,C);F&&(F._f.refs?F._f.refs.every(_=>!nn(_)):!nn(F._f.ref))&&Z(C)}l.unMount=new Set},E=(C,F)=>!s.disabled&&(C&&F&&pe(i,C,F),!at(Y(),r)),R=(C,F,_)=>$n(C,l,{...o.mount?i:be(F)?r:Xe(C)?{[C]:F}:F},_,F),T=C=>Yn(q(o.mount?i:r,C,s.shouldUnregister?q(r,C,[]):[])),H=(C,F,_={})=>{const W=q(a,C);let V=F;if(W){const O=W._f;O&&(!O.disabled&&pe(i,C,ol(F,O)),V=Ds(O.ref)&&Ke(F)?"":F,rl(O.ref)?[...O.ref.options].forEach(X=>X.selected=V.includes(X.value)):O.refs?ls(O.ref)?O.refs.forEach(X=>{(!X.defaultChecked||!X.disabled)&&(Array.isArray(V)?X.checked=!!V.find(me=>me===X.value):X.checked=V===X.value||!!V)}):O.refs.forEach(X=>X.checked=X.value===V):Jn(O.ref)?O.ref.value="":(O.ref.value=V,O.ref.type||x.state.next({name:C,values:$e(i)})))}(_.shouldDirty||_.shouldTouch)&&A(C,V,_.shouldTouch,_.shouldDirty,!0),_.shouldValidate&&Q(C)},K=(C,F,_)=>{for(const W in F){if(!F.hasOwnProperty(W))return;const V=F[W],O=C+"."+W,X=q(a,O);(l.array.has(C)||Ee(V)||X&&!X._f)&&!Nt(V)?K(O,V,_):H(O,V,_)}},B=(C,F,_={})=>{const W=q(a,C),V=l.array.has(C),O=$e(F);pe(i,C,O),V?(x.array.next({name:C,values:$e(i)}),(m.isDirty||m.dirtyFields||p.isDirty||p.dirtyFields)&&_.shouldDirty&&x.state.next({name:C,dirtyFields:Rt(r,i),isDirty:E(C,O)})):W&&!W._f&&!Ke(O)?K(C,O,_):H(C,O,_),dr(C,l)?x.state.next({...n,name:C,values:$e(i)}):x.state.next({name:o.mount?C:void 0,values:$e(i)})},se=async C=>{o.mount=!0;const F=C.target;let _=F.name,W=!0;const V=q(a,_),O=fe=>{W=Number.isNaN(fe)||Nt(fe)&&isNaN(fe.getTime())||at(fe,q(i,_,fe))},X=or(s.mode),me=or(s.reValidateMode);if(V){let fe,Ie;const gt=F.type?lr(V._f):el(C),xt=C.type===As.BLUR||C.type===As.FOCUS_OUT,jc=!qm(V._f)&&!s.resolver&&!q(n.errors,_)&&!V._f.deps||Ym(xt,q(n.touchedFields,_),n.isSubmitted,me,X),qs=dr(_,l,xt);pe(i,_,gt),xt?(!F||!F.readOnly)&&(V._f.onBlur&&V._f.onBlur(C),d&&d(0)):V._f.onChange&&V._f.onChange(C);const Gs=A(_,gt,xt),wc=!Be(Gs)||qs;if(!xt&&x.state.next({name:_,type:C.type,values:$e(i)}),jc)return(m.isValid||p.isValid)&&(s.mode==="onBlur"?xt&&g():xt||g()),wc&&x.state.next({name:_,...qs?{}:Gs});if(!xt&&qs&&x.state.next({...n}),s.resolver){const{errors:Da}=await L([_]);if(y([_]),O(gt),W){const Nc=ur(n.errors,a,_),Ea=ur(Da,a,Nc.name||_);fe=Ea.error,_=Ea.name,Ie=Be(Da)}}else y([_],!0),fe=(await fr(V,l.disabled,i,b,s.shouldUseNativeValidation))[_],y([_]),O(gt),W&&(fe?Ie=!1:(m.isValid||p.isValid)&&(Ie=await M(a,!0)));W&&(V._f.deps&&(!Array.isArray(V._f.deps)||V._f.deps.length>0)&&Q(V._f.deps),j(_,Ie,fe,Gs))}},G=(C,F)=>{if(q(n.errors,F)&&C.focus)return C.focus(),1},Q=async(C,F={})=>{let _,W;const V=Xt(C);if(s.resolver){const O=await S(be(C)?C:V);_=Be(O),W=C?!V.some(X=>q(O,X)):_}else C?(W=(await Promise.all(V.map(async O=>{const X=q(a,O);return await M(X&&X._f?{[O]:X}:X)}))).every(Boolean),!(!W&&!n.isValid)&&g()):W=_=await M(a);return x.state.next({...!Xe(C)||(m.isValid||p.isValid)&&_!==n.isValid?{}:{name:C},...s.resolver||!C?{isValid:_}:{},errors:n.errors}),F.shouldFocus&&!W&&Jt(a,G,C?V:l.mount),W},Y=(C,F)=>{let _={...o.mount?i:r};return F&&(_=al(F.dirtyFields?n.dirtyFields:n.touchedFields,_)),be(C)?_:Xe(C)?q(_,C):C.map(W=>q(_,W))},ce=(C,F)=>({invalid:!!q((F||n).errors,C),isDirty:!!q((F||n).dirtyFields,C),error:q((F||n).errors,C),isValidating:!!q(n.validatingFields,C),isTouched:!!q((F||n).touchedFields,C)}),ne=C=>{C&&Xt(C).forEach(F=>Ae(n.errors,F)),x.state.next({errors:C?n.errors:{}})},ee=(C,F,_)=>{const W=(q(a,C,{_f:{}})._f||{}).ref,V=q(n.errors,C)||{},{ref:O,message:X,type:me,...fe}=V;pe(n.errors,C,{...fe,...F,ref:W}),x.state.next({name:C,errors:n.errors,isValid:!1}),_&&_.shouldFocus&&W&&W.focus&&W.focus()},le=(C,F)=>ze(C)?x.state.subscribe({next:_=>"values"in _&&C(R(void 0,F),_)}):R(C,F,!0),U=C=>x.state.subscribe({next:F=>{Km(C.name,F.name,C.exact)&&Gm(F,C.formState||m,ue,C.reRenderRoot)&&C.callback({values:{...i},...n,...F,defaultValues:r})}}).unsubscribe,z=C=>(o.mount=!0,p={...p,...C.formState},U({...C,formState:{...f,...C.formState}})),Z=(C,F={})=>{for(const _ of C?Xt(C):l.mount)l.mount.delete(_),l.array.delete(_),F.keepValue||(Ae(a,_),Ae(i,_)),!F.keepError&&Ae(n.errors,_),!F.keepDirty&&Ae(n.dirtyFields,_),!F.keepTouched&&Ae(n.touchedFields,_),!F.keepIsValidating&&Ae(n.validatingFields,_),!s.shouldUnregister&&!F.keepDefaultValue&&Ae(r,_);x.state.next({values:$e(i)}),x.state.next({...n,...F.keepDirty?{isDirty:E()}:{}}),!F.keepIsValid&&g()},Ue=({disabled:C,name:F})=>{if(Qe(C)&&o.mount||C||l.disabled.has(F)){const V=l.disabled.has(F)!==!!C;C?l.disabled.add(F):l.disabled.delete(F),V&&o.mount&&!o.action&&g()}},Re=(C,F={})=>{let _=q(a,C);const W=Qe(F.disabled)||Qe(s.disabled);return pe(a,C,{..._||{},_f:{..._&&_._f?_._f:{ref:{name:C}},name:C,mount:!0,...F}}),l.mount.add(C),_?Ue({disabled:Qe(F.disabled)?F.disabled:s.disabled,name:C}):$(C,!0,F.value),{...W?{disabled:F.disabled||s.disabled}:{},...s.progressive?{required:!!F.required,min:Ht(F.min),max:Ht(F.max),minLength:Ht(F.minLength),maxLength:Ht(F.maxLength),pattern:Ht(F.pattern)}:{},name:C,onChange:se,onBlur:se,ref:V=>{if(V){Re(C,F),_=q(a,C);const O=be(V.value)&&V.querySelectorAll&&V.querySelectorAll("input,select,textarea")[0]||V,X=Bm(O),me=_._f.refs||[];if(X?me.find(fe=>fe===O):O===_._f.ref)return;pe(a,C,{_f:{..._._f,...X?{refs:[...me.filter(nn),O,...Array.isArray(q(r,C))?[{}]:[]],ref:{type:O.type,name:C}}:{ref:O}}}),$(C,!1,void 0,O)}else _=q(a,C,{}),_._f&&(_._f.mount=!1),(s.shouldUnregister||F.shouldUnregister)&&!(tl(l.array,C)&&o.action)&&l.unMount.add(C)}}},Me=()=>s.shouldFocusError&&Jt(a,G,l.mount),ae=C=>{Qe(C)&&(x.state.next({disabled:C}),Jt(a,(F,_)=>{const W=q(a,_);W&&(F.disabled=W._f.disabled||C,Array.isArray(W._f.refs)&&W._f.refs.forEach(V=>{V.disabled=W._f.disabled||C}))},0,!1))},Se=(C,F)=>async _=>{let W;_&&(_.preventDefault&&_.preventDefault(),_.persist&&_.persist());let V=$e(i);if(x.state.next({isSubmitting:!0}),s.resolver){const{errors:O,values:X}=await L();y(),n.errors=O,V=$e(X)}else await M(a);if(l.disabled.size)for(const O of l.disabled)Ae(V,O);if(Ae(n.errors,"root"),Be(n.errors)){x.state.next({errors:{}});try{await C(V,_)}catch(O){W=O}}else F&&await F({...n.errors},_),Me(),setTimeout(Me);if(x.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:Be(n.errors)&&!W,submitCount:n.submitCount+1,errors:n.errors}),W)throw W},He=(C,F={})=>{q(a,C)&&(be(F.defaultValue)?B(C,$e(q(r,C))):(B(C,F.defaultValue),pe(r,C,$e(F.defaultValue))),F.keepTouched||Ae(n.touchedFields,C),F.keepDirty||(Ae(n.dirtyFields,C),n.isDirty=F.defaultValue?E(C,$e(q(r,C))):E()),F.keepError||(Ae(n.errors,C),m.isValid&&g()),x.state.next({...n}))},it=(C,F={})=>{const _=C?$e(C):r,W=$e(_),V=Be(C),O=V?r:W;if(F.keepDefaultValues||(r=_),!F.keepValues){if(F.keepDirtyValues){const X=new Set([...l.mount,...Object.keys(Rt(r,i))]);for(const me of Array.from(X)){const fe=q(n.dirtyFields,me),Ie=q(i,me),gt=q(O,me);fe&&!be(Ie)?pe(O,me,Ie):!fe&&!be(gt)&&B(me,gt)}}else{if(Kn&&be(C))for(const X of l.mount){const me=q(a,X);if(me&&me._f){const fe=Array.isArray(me._f.refs)?me._f.refs[0]:me._f.ref;if(Ds(fe)){const Ie=fe.closest("form");if(Ie){Ie.reset();break}}}}if(F.keepFieldsRef)for(const X of l.mount)B(X,q(O,X));else a={}}i=s.shouldUnregister?F.keepDefaultValues?$e(r):{}:$e(O),x.array.next({values:{...O}}),x.state.next({values:{...O}})}l={mount:F.keepDirtyValues?l.mount:new Set,unMount:new Set,array:new Set,disabled:new Set,watch:new Set,watchAll:!1,focus:""},o.mount=!m.isValid||!!F.keepIsValid||!!F.keepDirtyValues||!s.shouldUnregister&&!Be(O),o.watch=!!s.shouldUnregister,o.keepIsValid=!!F.keepIsValid,o.action=!1,F.keepErrors||(n.errors={}),x.state.next({submitCount:F.keepSubmitCount?n.submitCount:0,isDirty:V?!1:F.keepDirty?n.isDirty:!!(F.keepDefaultValues&&!at(C,r)),isSubmitted:F.keepIsSubmitted?n.isSubmitted:!1,dirtyFields:V?{}:F.keepDirtyValues?F.keepDefaultValues&&i?Rt(r,i):n.dirtyFields:F.keepDefaultValues&&C?Rt(r,C):F.keepDirty?n.dirtyFields:{},touchedFields:F.keepTouched?n.touchedFields:{},errors:F.keepErrors?n.errors:{},isSubmitSuccessful:F.keepIsSubmitSuccessful?n.isSubmitSuccessful:!1,isSubmitting:!1,defaultValues:r})},je=(C,F)=>it(ze(C)?C(i):C,{...s.resetOptions,...F}),We=(C,F={})=>{const _=q(a,C),W=_&&_._f;if(W){const V=W.refs?W.refs[0]:W.ref;V.focus&&setTimeout(()=>{V.focus(),F.shouldSelect&&ze(V.select)&&V.select()})}},ue=C=>{n={...n,...C}},Ce={control:{register:Re,unregister:Z,getFieldState:ce,handleSubmit:Se,setError:ee,_subscribe:U,_runSchema:L,_updateIsValidating:y,_focusError:Me,_getWatch:R,_getDirty:E,_setValid:g,_setFieldArray:N,_setDisabledField:Ue,_setErrors:w,_getFieldArray:T,_reset:it,_resetDefaultValues:()=>ze(s.defaultValues)&&s.defaultValues().then(C=>{je(C,s.resetOptions),x.state.next({isLoading:!1})}),_removeUnmounted:D,_disableForm:ae,_subjects:x,_proxyFormState:m,get _fields(){return a},get _formValues(){return i},get _state(){return o},set _state(C){o=C},get _defaultValues(){return r},get _names(){return l},set _names(C){l=C},get _formState(){return n},get _options(){return s},set _options(C){s={...s,...C}}},subscribe:z,trigger:Q,register:Re,handleSubmit:Se,watch:le,setValue:B,getValues:Y,reset:je,resetField:He,clearErrors:ne,unregister:Z,setError:ee,setFocus:We,getFieldState:ce};return{...Ce,formControl:Ce}}function ef(e={}){const s=h.useRef(void 0),n=h.useRef(void 0),[a,r]=h.useState({isDirty:!1,isValidating:!1,isLoading:ze(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:ze(e.defaultValues)?void 0:e.defaultValues});if(!s.current)if(e.formControl)s.current={...e.formControl,formState:a},e.defaultValues&&!ze(e.defaultValues)&&e.formControl.reset(e.defaultValues,e.resetOptions);else{const{formControl:o,...l}=Jm(e);s.current={...l,formState:a}}const i=s.current.control;return i._options=e,Xn(()=>{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&&!at(e.values,n.current)?(i._reset(e.values,{keepFieldsRef:!0,...i._options.resetOptions}),!((o=i._options.resetOptions)===null||o===void 0)&&o.keepIsValid||i._setValid(),n.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()}),s.current.formState=h.useMemo(()=>nl(a,i),[i,a]),s.current}function tf(e,s=3){return e%1===0?e.toString():e.toFixed(s).replace(/\.?0+$/,"")}function sf(e,s="en-US",n="USD"){try{return new Intl.NumberFormat(s,{style:"currency",currency:n,minimumFractionDigits:2,maximumFractionDigits:2}).format(e)}catch(a){return console.warn(`Invalid currency formatting: ${a}`),`${n} ${e.toFixed(2)}`}}function nf(e="USD",s="en-US"){try{return new Intl.NumberFormat(s,{style:"currency",currency:e}).formatToParts(0).find(i=>i.type==="currency")?.value??"$"}catch{return"$"}}function af(e){const s=e.replace(/[^\d.,-]/g,""),n=s.match(/,\d{1,2}$/);let a;n?a=s.replace(/\./g,"").replace(",","."):a=s.replace(/,/g,"");const r=parseFloat(a);return isNaN(r)?null:r}function rf(e,s,n=.001){const a=e-s,r=Math.abs(a)<=n;return{difference:a,isBalanced:r,isUnderAllocated:!r&&a>0,isOverAllocated:!r&&a<0}}function ta(){return`dist-${Date.now()}-${Math.random().toString(36).substr(2,9)}`}ta();const lf={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:"$"},an=()=>({id:ta(),amount:0,glAccount:null,isTaxDeductible:!1}),dl=({distribution:e,defaultDistribution:s,glAccounts:n=[],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:b={},"data-testid":v,control:g,name:y,rules:N})=>{const k={...lf,...x},w=g!==void 0&&y!==void 0,$=ef({defaultValues:{_internal:s||an()}}),A=Tm({control:w?g:$.control,name:w?y:"_internal",rules:w?N:void 0}),[j,L]=h.useState(s||an()),S=w?A.field.value??an():e??j,M=w&&!!A.fieldState?.error,D=w&&(A.fieldState?.isTouched??!1),E=M||D,R=E&&(!S.amount||S.amount<=0),T=E&&!S.glAccount,[H,K]=h.useState(S.glAccount?.name||""),B=h.useCallback(ee=>{const le={...S,...ee};w&&A.field.onChange(le),!w&&e===void 0&&L(le),i?.(le)},[S,e,i,w,A]),se=h.useCallback(ee=>{const le=ee||0;B({amount:le}),o?.(le)},[B,o]),G=h.useCallback(ee=>{K(ee),r?.(ee)},[r]),Q=h.useCallback(ee=>{if(ee===null){B({glAccount:null}),l?.(null);return}const U=n.find(z=>String(z.id)===String(ee))||null;B({glAccount:U}),l?.(U)},[n,B,l]),Y=h.useCallback(()=>{K(""),B({glAccount:null}),l?.(null)},[B,l]),ce=h.useCallback(ee=>{B({isTaxDeductible:ee}),d?.(ee)},[B,d]),ne=h.useCallback(()=>{u?.()},[u]);return t.jsx(c.Card,{radius:"md",shadow:"sm","data-testid":v||"revenue-distribution-card",className:c.cn(b.base),children:t.jsxs(c.CardBody,{className:c.cn("flex flex-row flex-nowrap items-start gap-4",b.body),children:[t.jsx("div",{className:c.cn("shrink-0",b.amountContainer),children:t.jsx(c.NumberInput,{"data-testid":`${v||"revenue-distribution-card"}-amount-input`,label:t.jsxs("span",{className:"flex items-center gap-1",children:[k.amount,t.jsx(c.Tooltip,{content:k.amountTooltip,children:t.jsx(P,{icon:"solar:info-circle-linear",className:"text-default-400 cursor-help",width:16})})]}),value:S.amount||void 0,onValueChange:se,labelPlacement:"outside",placeholder:k.amountPlaceholder,isWheelDisabled:!0,hideStepper:!0,variant:"bordered",isDisabled:p,isInvalid:R,errorMessage:R?"Amount is required":void 0,minValue:0,step:.01,className:b.amountInput,startContent:t.jsx("div",{className:"pointer-events-none flex items-center",children:t.jsx("span",{className:"text-default-400 text-small",children:k.currencySymbol})})})}),t.jsx("div",{className:c.cn("grow",b.glAccountContainer),children:t.jsx(c.Autocomplete,{"data-testid":`${v||"revenue-distribution-card"}-gl-account-input`,label:t.jsxs("span",{className:"flex items-center gap-1",children:[k.glAccount,t.jsx(c.Tooltip,{content:k.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:n,menuTrigger:"input",inputValue:S.glAccount?.name??H,selectedKey:S.glAccount?.id??null,isDisabled:p,isInvalid:T,errorMessage:T?"GL Account is required":void 0,listboxProps:{emptyContent:a?k.searching:k.noGlAccountsFound},placeholder:k.glAccountPlaceholder,onInputChange:G,onSelectionChange:Q,onClear:Y,className:b.glAccountInput,children:ee=>t.jsx(c.AutocompleteItem,{textValue:ee.name,children:t.jsxs("div",{className:"flex flex-col",children:[t.jsx("span",{children:ee.name}),ee.code&&t.jsx("span",{className:"text-xs text-default-400",children:ee.code})]})},ee.id)})}),t.jsx("div",{className:c.cn("shrink-0 pt-6 flex items-center",b.taxDeductibleContainer),children:t.jsx(c.Checkbox,{radius:"full","data-testid":`${v||"revenue-distribution-card"}-tax-deductible`,isSelected:S.isTaxDeductible,onValueChange:ce,isDisabled:p||!m,className:b.taxDeductibleCheckbox,children:k.taxDeductible})}),t.jsx("div",{className:c.cn("shrink-0 pt-6",b.deleteContainer),children:t.jsx(I,{"data-testid":`${v||"revenue-distribution-card"}-delete-button`,size:"sm",color:"danger",variant:"flat",isDisabled:p||!f,onPress:ne,startContent:t.jsx(P,{icon:"solar:trash-bin-trash-linear",width:16}),className:c.cn("text-danger",b.deleteButton),children:k.deleteButton})})]})})};dl.displayName="RevenueDistributionCard";const ul=({message:e="No distributions configured",icon:s="solar:document-text-outline",iconSize:n=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:s,width:n,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})};ul.displayName="RevenueDistributionEmpty";const of={title:"Error Loading Distributions",description:"An error occurred while loading the distribution configuration. Please try again."},ml=({error:e,labels:s,showCard:n=!0,color:a="danger",classNames:r={}})=>{const i={...of,...s},o=t.jsx(c.Alert,{"data-testid":"revenue-distribution-error-alert",color:a,title:i.title,description:e||i.description,className:r.alert});return n?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})};ml.displayName="RevenueDistributionError";const fl=({rows:e=1,showCard:s=!0,classNames:n={}})=>{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",n.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(ie,{className:"h-4 w-14 rounded-md"}),t.jsx(ie,{className:"h-4 w-4 rounded-full"})]}),t.jsx(ie,{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(ie,{className:"h-4 w-20 rounded-md"}),t.jsx(ie,{className:"h-4 w-4 rounded-full"})]}),t.jsx(ie,{className:"h-10 w-full rounded-lg"})]}),t.jsxs("div",{className:"shrink-0 pb-2 flex items-center gap-2",children:[t.jsx(ie,{className:"h-5 w-5 rounded-full"}),t.jsx(ie,{className:"h-4 w-24 rounded-md"})]}),t.jsx("div",{className:"shrink-0 pb-2",children:t.jsx(ie,{className:"h-8 w-20 rounded-lg"})})]},i);return s?t.jsx("div",{className:c.cn("flex flex-col gap-3",n.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",n.base),children:a.map(i=>r(i))})};fl.displayName="RevenueDistributionSkeleton";function sa({isOpen:e,labels:s,icon:n,isConfirming:a=!1,confirmColor:r="danger",iconTone:i="danger",portalContainer:o,shouldBlockScroll:l,classNames:d,onClose:u,onConfirm:f}){return t.jsx(rs,{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:[n&&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:n}),t.jsx("span",{className:"text-lg font-semibold leading-6 text-zinc-950",children:s.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:s.description})}),t.jsxs(c.ModalFooter,{className:"grid grid-cols-2 gap-3 px-7 pb-7 pt-3",children:[t.jsx(I,{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:s.cancel}),t.jsx(I,{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:s.confirm})]})]})})}const cf=()=>({id:crypto.randomUUID(),fund:null,percentage:0});function xr(e){return!e.fund&&Number(e.percentage||0)<=0}function df({mode:e,assignments:s}){const n=s.filter(i=>i.fund),a=n.reduce((i,o)=>i+Number(o.percentage||0),0),r=s.some(i=>!i.fund||Number(i.percentage||0)<=0);return n.length>=1&&!r&&Math.round(a*100)/100===100}const uf={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"},xl={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"},Wt={...xl,base:"min-h-11 rounded-2xl px-4 py-2 shadow-none",title:"text-sm font-medium"},mf={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"},ff={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 xf(){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 pf=e=>Number.isFinite(e)?Math.max(0,Math.min(100,Math.round(e*100)/100)):0,hf=e=>e.fund!==null;function bf({assignments:e,funds:s,labels:n,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:b,onCollapseChange:v,onSave:g}){const[y,N]=h.useState(null),k=f??y??void 0,w={...uf,...n},$=e.filter(U=>!xr(U)),j=$.filter(hf).length>0,L=h.useMemo(()=>e.filter(U=>!xr(U)).reduce((U,z)=>U+Number(z.percentage||0),0),[e]),S=Math.round(L*100)/100,M=$.some(U=>!U.fund||Number(U.percentage||0)<=0),D=j&&(S!==100||M),E=`${w.totalError} (${w.total} ${Number(L.toFixed(2))}%)`,R=df({mode:"split",assignments:e}),T=j&&S>=100,[H,K]=h.useState(!1),[B,se]=h.useState(!1),G=t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(xf,{}),t.jsx("span",{className:"text-base font-medium leading-6 text-zinc-950",children:w.title}),o?t.jsx(c.Chip,{size:"sm",radius:"full",color:"success",variant:"flat",children:w.saved}):null]}),Q=(U,z)=>{p(e.map(Z=>Z.id===U?{...Z,...z}:Z))},Y=()=>{T||p([...e,cf()])},ce=U=>{e.length<=1||p(e.filter(z=>z.id!==U))},ne=()=>{if(!r){if(!R){se(!0);return}if(!i){g();return}K(!0)}},ee=()=>{K(!1),g()},le=U=>{const z=u??e.find(Z=>!Z.fund)?.id??e[0]?.id;z&&(p(e.map(Z=>Z.id===z?{...Z,fund:U}:Z)),b())};return t.jsxs("div",{ref:N,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:U=>v?.(!(U==="all"||Array.from(U).length>0)),children:t.jsx(c.AccordionItem,{"aria-label":w.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:[!j&&t.jsx(c.Alert,{icon:t.jsx(P,{icon:"solar:info-circle-outline",className:"size-4"}),hideIconWrapper:!0,isClosable:!1,classNames:xl,color:"default",variant:"flat",title:w.emptySplit}),j&&t.jsx(gf,{assignments:e,labels:w,total:L,hasTotalError:B&&!R||D,validationMessage:E,onSelectFund:U=>x(U),onRemoveFund:ce,onPercentageChange:(U,z)=>Q(U,{percentage:pf(z)})}),t.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[t.jsx(I,{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(J.Plus,{className:"size-5",strokeWidth:2}),isDisabled:T,onPress:()=>j?Y():x(),children:w.assignSpecificFund}),t.jsx(I,{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:!R||r,onPress:ne,children:w.saveAssignment})]})]}),m]})},"installment-fund-assignment")}),d&&t.jsx(yf,{funds:s,labels:w,selectedFundIds:e.map(U=>U.fund?.id).filter(Boolean),portalContainer:k,onSelect:le,onClose:b}),t.jsx(sa,{isOpen:H,labels:{title:w.modifyAssignedFundsTitle,description:t.jsxs(t.Fragment,{children:[t.jsx("p",{children:w.modifyAssignedFundsDescription}),t.jsx("p",{className:"mt-3",children:w.modifyAssignedFundsWarning})]}),cancel:w.modifyAssignedFundsCancel,confirm:w.modifyAssignedFundsConfirm},icon:t.jsx(P,{icon:"solar:info-circle-outline",className:"size-7"}),iconTone:"warning",confirmColor:"primary",portalContainer:k,shouldBlockScroll:!1,classNames:ff,onClose:()=>K(!1),onConfirm:ee})]})}function gf({assignments:e,labels:s,total:n,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(I,{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(I,{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(J.Plus,{className:"size-5",strokeWidth:2}),onPress:()=>i(d.id),children:s.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:mf})}),e.length>1&&t.jsx(I,{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":s.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:{...Wt,base:c.cn(Wt.base,a?"bg-warning-50 text-warning-700":"bg-success-50 text-success-700"),iconWrapper:c.cn(Wt.iconWrapper,a?"text-warning-700":"text-success-700"),alertIcon:c.cn(Wt.alertIcon,a?"text-warning-700":"text-success-700"),title:c.cn(Wt.title,a?"text-warning-700":"text-success-700")},title:a?r:`${s.total} ${Number(n.toFixed(2))}%`})]})}function yf({funds:e,labels:s,selectedFundIds:n,portalContainer:a,onSelect:r,onClose:i}){const[o,l]=h.useState(""),d=e.filter(u=>{if(n.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(rs,{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:s.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":s.searchPlaceholder,value:o,placeholder:s.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:s.glCode}),t.jsx("span",{children:s.accountName}),t.jsx("span",{children:s.actions})]}),d.length===0&&t.jsx("div",{className:"p-4 text-sm text-zinc-500",children:s.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(I,{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:s.select})]},u.id))]})]})]})})}function vf(){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(ie,{className:"h-7 w-56 rounded-lg"}),t.jsx(ie,{className:"size-8 rounded-full"})]}),t.jsxs("div",{className:"flex items-center justify-between gap-3",children:[t.jsx(ie,{className:"h-10 w-72 rounded-full"}),t.jsx(ie,{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(ie,{className:"h-8 w-full max-w-xs rounded-full"}),t.jsx(ie,{className:"h-8 w-full rounded-xl"})]}),t.jsx(ie,{className:"h-11 w-40 rounded-full"})]})}const jf={totalAmount:"Total Amount:",remainingBalance:"Remaining Balance",amountReceived:"Amount Received:"};function wf({totalAmount:e,remainingBalance:s,amountReceived:n,currency:a="USD",locale:r="en-US",labels:i,className:o}){const l={...jf,...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(rn,{label:l.totalAmount,value:d.format(e)}),t.jsx(rn,{label:l.remainingBalance,value:d.format(s)}),t.jsx(rn,{label:l.amountReceived,value:d.format(n)})]})})}function rn({label:e,value:s}){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:s})]})}const Nf={monthly:1,quarterly:3,annual:12},pl=e=>{const[s,n,a]=e.split("-").map(Number);return{year:s,month:n,day:a}},Cf=(e,s)=>new Date(e,s+1,0).getDate(),kf=e=>{const s=e.getFullYear(),n=String(e.getMonth()+1).padStart(2,"0"),a=String(e.getDate()).padStart(2,"0");return`${s}-${n}-${a}`},Sf=(e,s)=>{const{year:n,month:a,day:r}=pl(e),i=a-1+s,o=n+Math.floor(i/12),l=(i%12+12)%12,d=Math.min(r,Cf(o,l));return new Date(o,l,d)},$f=(e,s)=>{const{year:n,month:a,day:r}=pl(e),i=new Date(n,a-1,r);return i.setDate(i.getDate()+s),i};function hl(e,s){const n=Math.max(1,Math.floor(s.numberOfInstallments||1)),a=Math.round(e*100),r=Math.floor(a/n),i=a-r*n,o=Nf[s.frequency];return Array.from({length:n},(l,d)=>{const u=s.frequency==="weekly"?$f(s.firstInstallmentDate,d*7):Sf(s.firstInstallmentDate,d*(o??1));return{id:crypto.randomUUID(),dueDate:kf(u),amount:(r+(d===0?i:0))/100}})}function Af(e){return new Set(e.map((s,n)=>{const a=e[n+1]?.dueDate;return s.dueDate&&a&&s.dueDate>a?s.id:null}).filter(s=>!!s))}function Df(e){return{missingDateRows:new Set(e.filter(s=>!s.dueDate).map(s=>s.id)),invalidDateRows:Af(e),invalidAmountRows:new Set(e.filter(s=>Number(s.amount||0)<=0).map(s=>s.id))}}function Ef(e){return e.missingDateRows.size>0||e.invalidDateRows.size>0||e.invalidAmountRows.size>0}function Lf(e,s){const n=e[0];return!n||!s||n.dueDate===s?e:[{...n,dueDate:s},...e.slice(1)]}const Ff=new Set(["paid","partially_refunded","refunded"]);function Ct(e){return e!==void 0&&Ff.has(e)}const _f={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."},Rf=["weekly","monthly","quarterly","annual"],Mf=Array.from({length:31},(e,s)=>s+1),Pf=["numberOfInstallments","frequency","firstInstallmentDate"],pr=()=>({id:crypto.randomUUID(),dueDate:new Date().toISOString().slice(0,10),amount:0}),Ls=e=>Math.round(e*100)/100,Tf=(e,s)=>{const n=new Date(`${e}T00:00:00`);return Number.isNaN(n.getTime())?e:new Intl.DateTimeFormat(s,{month:"short",day:"numeric",year:"numeric"}).format(n)},zs=e=>{if(!e)return null;try{return bu(e)}catch{return null}},If=e=>zs(e)?.day??1,Of=(e,s)=>new Date(e,s,0).getDate(),Bf=(e,s)=>{const n=zs(e);if(!n)return e;const a=Math.min(s,Of(n.year,n.month));return n.set({day:a}).toString()},hr=e=>{const s=e%100>=11&&e%100<=13?"th":e%10===1?"st":e%10===2?"nd":e%10===3?"rd":"th";return`${e}${s}`};function zf({mode:e,donationAmount:s,currency:n="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=Pf,startDate:p,firstInstallmentDateOverride:x,labels:b,classNames:v,isSaving:g=!1,showSavedIndicator:y=!1,isModeSwitchDisabled:N=!1,onModeChange:k,onAutomaticSettingsChange:w,onInstallmentsChange:$,onSave:A,onCancel:j}){const[L,S]=h.useState(o),M={..._f,...b},D=e??L,E=h.useMemo(()=>new Intl.NumberFormat(a,{style:"currency",currency:n}),[n,a]),R=h.useMemo(()=>({...i,firstInstallmentDate:m.includes("firstInstallmentDate")?i.firstInstallmentDate:m.includes("dayOfMonth")?i.firstInstallmentDate||p||"":p||i.firstInstallmentDate}),[i,m,p]),T=D==="automatic"?Lf(hl(s,R),m.includes("firstInstallmentDate")?void 0:x):r,H=h.useMemo(()=>Ls(T.reduce((Z,Ue)=>Z+Number(Ue.amount||0),0)),[T]),K=Math.abs(H-s)>.009,B=Ls(s-H)<=0,se=h.useMemo(()=>Df(r),[r]),G=D==="manual"&&Ef(se),Q=K||G,Y=l?t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(J.CircleDollarSign,{className:"size-4 text-zinc-500",strokeWidth:1.75}),t.jsx("span",{className:"text-base font-medium leading-6 text-zinc-950",children:M.title}),y?t.jsx(c.Chip,{size:"sm",radius:"full",color:"success",variant:"flat",children:M.saved}):null]}):void 0,ce=Z=>{Z!==D&&(e||S(Z),k?.(Z),Z==="manual"&&r.length===0&&$([pr()]))},ne=(Z,Ue)=>{const Re=r.find(Me=>Me.id===Z);Ct(Re?.status)||$(r.map(Me=>Me.id===Z?{...Me,...Ue}:Me))},ee=()=>{$([...r,pr()])},le=Z=>{const Ue=r.find(Re=>Re.id===Z);Ct(Ue?.status)||$(r.filter(Re=>Re.id!==Z))},U=()=>{g||Q||A?.()},z=t.jsxs("div",{className:c.cn("flex w-full flex-col gap-4",v?.content),children:[f||u||j?t.jsxs("div",{className:"flex w-full items-center justify-between gap-6",children:[f?t.jsx(Vf,{mode:D,labels:M,onModeChange:ce,isDisabled:N,className:v?.tabs}):null,t.jsxs("div",{className:"ml-auto flex items-center gap-3",children:[j?t.jsx(I,{type:"button","data-testid":"installment-schedule-cancel-button",size:"md",variant:"bordered",radius:"full",className:"min-w-28",isDisabled:g,onPress:j,children:M.cancelEdit}):null,u?t.jsx(I,{type:"button","data-testid":"installment-schedule-save-button",size:"md",color:"primary",radius:"full",className:"min-w-36",startContent:g?void 0:t.jsx(P,{icon:"solar:cloud-upload-outline",className:"size-4"}),isLoading:g,isDisabled:g||Q,onPress:U,children:M.saveInstallments}):null]})]}):null,t.jsxs("div",{className:c.cn("flex w-full flex-col gap-4",v?.preview),children:[D==="automatic"&&t.jsx(Uf,{settings:R,inputs:m,labels:M,className:v?.controls,onSettingsChange:w}),T.length===0&&t.jsx(c.Alert,{isClosable:!1,color:"default",variant:"flat",radius:"full",title:D==="automatic"?M.emptyAutomatic:M.emptyManual}),T.length>0&&t.jsx(Hf,{mode:D,installments:T,rowErrors:se,labels:M,formatter:E,locale:a,onUpdateInstallment:ne,onRemoveInstallment:le}),D==="manual"&&t.jsx("div",{className:"flex flex-wrap gap-3",children:t.jsx(I,{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(J.Plus,{className:"size-5",strokeWidth:2}),isDisabled:B,onPress:ee,children:M.addInstallment})}),t.jsx(Kf,{total:H,donationAmount:s,hasTotalMismatch:K,mode:D,installments:T,formatter:E,labels:M,className:v?.summary})]})]});return t.jsx("div",{className:c.cn("vvt-ps relative font-sans text-zinc-900",v?.root),children:d?t.jsx(c.Accordion,{variant:"splitted",defaultSelectedKeys:["installment-schedule"],className:c.cn("w-full gap-0 px-0",v?.panel),itemClasses:{base:"w-full rounded-2xl border border-zinc-200 bg-white p-0 shadow-sm",trigger:c.cn("px-4 py-4",v?.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":M.title,title:Y,children:z},"installment-schedule")}):z})}function Vf({mode:e,labels:s,className:n,isDisabled:a=!1,onModeChange:r}){return t.jsxs(c.Tabs,{"aria-label":s.title,selectedKey:e,isDisabled:a,color:"primary",size:"lg",radius:"full",className:c.cn("w-fit",n),onSelectionChange:i=>r(i),children:[t.jsx(c.Tab,{title:s.automaticMode},"automatic"),t.jsx(c.Tab,{title:s.manualMode},"manual")]})}function Uf({settings:e,inputs:s,labels:n,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:n.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(rt,{variant:"bordered",label:n.frequency,labelPlacement:"outside",selectedKeys:[e.frequency],onSelectionChange:l=>{const d=Array.from(l)[0];typeof d=="string"&&r({...e,frequency:d})},children:Rf.map(l=>t.jsx(c.SelectItem,{textValue:n[l],children:n[l]},l))})},o);if(o==="dayOfMonth"){const l=String(If(e.firstInstallmentDate));return t.jsx("div",{className:"min-w-0",children:t.jsx(rt,{variant:"bordered",label:n.dayOfMonth,labelPlacement:"outside",selectedKeys:[l],onSelectionChange:d=>{const u=Number(Array.from(d)[0]);Number.isFinite(u)&&r({...e,firstInstallmentDate:Bf(e.firstInstallmentDate,u)})},children:Mf.map(d=>t.jsx(c.SelectItem,{textValue:hr(d),children:hr(d)},String(d)))})},o)}return t.jsx("div",{className:"min-w-0",children:t.jsx(Wn,{variant:"bordered",label:n.firstInstallmentDate,labelPlacement:"outside",value:zs(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 s.length===0?null:t.jsx("div",{className:c.cn("grid gap-4",a),style:{gridTemplateColumns:"repeat(auto-fit, minmax(min(100%, 14rem), 1fr))"},children:s.map(i)})}function Hf({mode:e,installments:s,rowErrors:n,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",s.length>5&&"max-h-[264px] overflow-y-auto pr-2"),children:s.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:Tf(d.dueDate,i)}),u===0&&s.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:s.map((d,u)=>{const f=n.missingDateRows.has(d.id),m=n.invalidDateRows.has(d.id),p=n.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(Wn,{variant:"bordered","aria-label":`${a.dueDate} ${u+1}`,isDisabled:Ct(d.status),isInvalid:f||m,errorMessage:f?a.dueDateRequiredError:m?a.dateOrderError:void 0,value:zs(d.dueDate),onChange:x=>o(d.id,{dueDate:x?x.toString():""})})}),t.jsx("div",{className:"min-w-0 flex-1",children:t.jsx(qf,{amount:d.amount,ariaLabel:`${a.amount} ${u+1}`,isDisabled:Ct(d.status),isInvalid:p,errorMessage:a.amountGreaterThanZeroError,onAmountChange:x=>o(d.id,{amount:x})})}),t.jsx(Gf,{isDisabled:s.length<=1,isPaid:Ct(d.status),label:a.deleteInstallment,onRemove:()=>l(d.id)})]})},d.id)})})}const Wf=/^\d*(?:[.,]\d{0,2})?$/;function qf({amount:e,ariaLabel:s,isDisabled:n,isInvalid:a,errorMessage:r,onAmountChange:i}){const[o,l]=h.useState(null);return t.jsx(c.Input,{variant:"bordered","aria-label":s,type:"text",inputMode:"decimal",autoComplete:"off",isDisabled:n,isInvalid:a,errorMessage:a?r:void 0,value:o??(e?String(e):""),onChange:d=>{const u=d.target.value.trim();if(!Wf.test(u))return;l(u);const f=Number(u.replace(",","."));i(Ls(Number.isFinite(f)?f:0))},onBlur:()=>l(null),startContent:t.jsx("span",{className:"text-zinc-900",children:"$"})})}function Gf({isDisabled:e,isPaid:s,label:n,onRemove:a}){const r=t.jsx(I,{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||s,onPress:a,"aria-label":n,children:t.jsx(P,{icon:"solar:trash-bin-minimalistic-outline",className:"size-5"})});return s?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 Kf({total:e,donationAmount:s,hasTotalMismatch:n,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=Ls(s-e),x=Math.max(p,0),b=Math.max(-p,0),v=n?t.jsxs("span",{children:[o.totalError,". Total scheduled: ",t.jsx("strong",{children:i.format(e)})," /"," ",t.jsx("strong",{children:i.format(s)}),"."]}):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(s)}),"."]}),g=a==="automatic"?`Total: ${i.format(e)}`:b>0?`Exceeds by: ${i.format(b)}`:`${o.remaining}: ${i.format(x)}`;return t.jsx(c.Alert,{isClosable:!1,color:n?"danger":"default",variant:"flat",radius:"full",className:l,endContent:t.jsx("span",{className:"whitespace-nowrap",children:g}),title:v})}function Yf(){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(ie,{className:"h-7 w-56 rounded-lg"}),t.jsx(ie,{className:"size-8 rounded-full"})]}),t.jsxs("div",{className:"flex items-center justify-between gap-3",children:[t.jsx(ie,{className:"h-10 w-72 rounded-full"}),t.jsx(ie,{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(ie,{className:"h-4 w-36 rounded-md"}),t.jsx(ie,{className:"h-9 w-full rounded-xl"})]}),t.jsx(ie,{className:"h-9 w-36 rounded-full"})]}),t.jsx("div",{className:"flex flex-col gap-3",children:Array.from({length:4}).map((e,s)=>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(ie,{className:"h-8 w-full max-w-xs rounded-full"}),t.jsx(ie,{className:"h-8 w-full rounded-xl"})]},s))})]})}const br={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"},bl={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"},Qf={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:bl.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."},Zf={wrapper:"!absolute !inset-0 !z-50 !items-center !justify-center !p-4",backdrop:"!absolute !inset-0 !z-40 rounded-2xl"},Xf=[];function Jf({installments:e,currency:s,locale:n="en-US",showTitle:a=!0,showCard:r=!0,showEditPayment:i=!0,showDelete:o=!0,payNowHiddenStatuses:l=Xf,showSavedIndicator:d=!1,labels:u,isSaving:f=!1,onEditInstallments:m,onPayInstallment:p,onDeleteInstallment:x}){const[b,v]=h.useState(null),g={...Qf,...u},[y,N]=h.useState(""),k=new Intl.NumberFormat(n,{style:"currency",currency:s}),w=e.some(S=>gl(S)!==null),$=e.some(S=>S.status==="partially_refunded"),A=a?t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(J.CircleDollarSign,{className:"size-4 text-zinc-500",strokeWidth:1.75}),t.jsx("span",{className:"text-base font-medium leading-6 text-zinc-950",children:g.title}),d?t.jsx(c.Chip,{size:"sm",radius:"full",color:"success",variant:"flat",children:g.saved}):null]}):void 0,j=h.useMemo(()=>{const S=y.trim().toLowerCase();if(!S)return e;const M=new Intl.NumberFormat(n,{style:"currency",currency:s});return e.filter(D=>{const E=D.status??"scheduled";return[ln(D),D.id,D.amount,D.dueDate,Ns(D.dueDate,n),on(D,g.paidOn,n),cn(D,g.refundedAmount,M),E,dn(E,g.partiallyRefunded)].join(" ").toLowerCase().includes(S)})},[n,s,e,y,g.paidOn,g.refundedAmount,g.partiallyRefunded]),L=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:g.searchLabel}),t.jsx(c.Input,{variant:"bordered",size:"md",value:y,placeholder:g.searchPlaceholder,onChange:S=>N(S.target.value),startContent:t.jsx(P,{icon:"solar:magnifer-outline",className:"size-4 text-zinc-500"})})]}),i?t.jsx(I,{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:g.editInstallments}):null]}),t.jsx("div",{className:c.cn("hidden [@container(max-width:767px)]:block",j.length>3&&"max-h-[560px] overflow-y-auto pr-1"),children:t.jsxs("div",{className:"flex flex-col gap-2",children:[j.map((S,M)=>{const D=S.status??"scheduled",E=ln(S),R=on(S,g.paidOn,n),T=cn(S,g.refundedAmount,k);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:["#",M+1]}),t.jsx("p",{className:"truncate text-sm font-medium text-foreground",children:E||`PMT-${M+1}`})]}),t.jsx(gr,{status:D,label:dn(D,g.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:g.amount}),t.jsx("p",{className:"font-medium text-foreground",children:k.format(S.amount)}),T?t.jsx("p",{className:"text-xs text-default-500",children:T}):null]}),t.jsxs("div",{className:"text-right",children:[t.jsx("p",{className:"text-xs text-default-500",children:g.scheduledDate}),t.jsx("p",{className:"font-medium text-foreground",children:Ns(S.dueDate,n)}),R?t.jsx("p",{className:"text-xs text-default-500",children:R}):null]})]}),t.jsx(yr,{status:D,installment:S,labels:g,portalContainer:b??void 0,showDelete:o,payNowHiddenStatuses:l,onPayInstallment:p,onDeleteInstallment:x})]})},S.id)}),j.length===0&&t.jsx("div",{className:"rounded-lg border border-default-200 px-4 py-6 text-center text-sm text-default-500",children:g.noInstallmentsFound})]})}),t.jsx("div",{className:c.cn("w-full overflow-x-hidden [@container(max-width:767px)]:hidden",j.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:w?"w-32":"w-24"}),t.jsx("col",{className:"w-36"}),t.jsx("col",{className:$?"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:g.installmentId}),t.jsx("th",{className:"px-2 py-3 font-medium",children:g.amount}),t.jsx("th",{className:"px-2 py-3 font-medium",children:g.scheduledDate}),t.jsx("th",{className:"whitespace-nowrap px-2 py-3 font-medium",children:g.status}),t.jsx("th",{className:"whitespace-nowrap py-3 pl-4 pr-2 font-medium",children:g.actions})]})}),t.jsxs("tbody",{children:[j.map((S,M)=>{const D=S.status??"scheduled",E=ln(S),R=on(S,g.paidOn,n),T=cn(S,g.refundedAmount,k);return t.jsxs("tr",{className:"text-zinc-500",children:[t.jsx("td",{className:"px-2 py-3",children:M+1}),t.jsx("td",{className:"overflow-hidden px-2 py-3",children:t.jsx("span",{className:"block w-full truncate",children:E||`PMT-${M+1}`})}),t.jsxs("td",{className:"px-2 py-3",children:[k.format(S.amount),T?t.jsx("span",{className:"block text-xs",children:T}):null]}),t.jsxs("td",{className:"px-2 py-3",children:[Ns(S.dueDate,n),R?t.jsx("span",{className:"block text-xs",children:R}):null]}),t.jsx("td",{className:"whitespace-nowrap px-2 py-3",children:t.jsx(gr,{status:D,label:dn(D,g.partiallyRefunded)})}),t.jsx("td",{className:"whitespace-nowrap py-3 pl-4 pr-2",children:t.jsx(yr,{status:D,installment:S,labels:g,portalContainer:b??void 0,showDelete:o,payNowHiddenStatuses:l,onPayInstallment:p,onDeleteInstallment:x})})]},S.id)}),j.length===0&&t.jsx("tr",{children:t.jsx("td",{colSpan:6,className:"px-2 py-6 text-center text-zinc-500",children:g.noInstallmentsFound})})]})]})})]});return t.jsx("div",{ref:v,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":g.title,title:A,children:L},"installment-table")}):L})}function ln(e){return e.name?.trim()||e.id}function on(e,s,n){return!Ct(e.status)||!e.fulfilledAt?null:`${s} ${Ns(e.fulfilledAt,n)}`}function gl(e){const{refundedAmount:s}=e;return e.status!=="partially_refunded"||typeof s!="number"||!Number.isFinite(s)||s<=0?null:s}function cn(e,s,n){const a=gl(e);return a===null?null:`${s} ${n.format(a)}`}function dn(e,s){return e==="partially_refunded"?s:bl[e]??e}function gr({status:e,label:s}){return t.jsx(c.Chip,{size:"md",radius:"lg",className:c.cn("justify-center px-4",br[e]??br.scheduled),startContent:t.jsx(tx,{status:e}),children:s})}function yr({status:e,installment:s,labels:n,portalContainer:a,showDelete:r,payNowHiddenStatuses:i,onPayInstallment:o,onDeleteInstallment:l}){const d=!i.includes(e),u=Ct(e);return t.jsxs("div",{className:"flex min-w-36 items-center justify-start gap-2",children:[d?t.jsx(I,{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?.(s),children:n.payNow}):null,t.jsx(ex,{isFulfilled:u,showDelete:r,labels:n,portalContainer:a,onDelete:()=>l(s.id)})]})}function ex({isFulfilled:e,showDelete:s,labels:n,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(I,{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"&&s&&!e&&o(!0)},children:[t.jsx(c.DropdownSection,{title:"Actions",showDivider:s,children:t.jsx(c.DropdownItem,{textValue:n.sendLink,description:n.sendLinkDescription,startContent:t.jsx(P,{icon:"solar:link-outline",className:"size-5 text-zinc-500"}),children:n.sendLink},"send-link")}),s?t.jsx(c.DropdownSection,{title:n.dangerZone,children:t.jsx(c.DropdownItem,{textValue:n.deleteInstallment,className:"text-danger-600",color:"danger",description:n.deleteInstallmentDescription,startContent:t.jsx(P,{icon:"solar:trash-bin-minimalistic-outline",className:"size-5"}),children:n.deleteInstallment},"delete")}):null]})]}),s?t.jsx(sa,{isOpen:i,labels:{title:n.deleteInstallmentConfirmationTitle,description:n.deleteInstallmentConfirmationDescription,cancel:n.deleteInstallmentConfirmationCancel,confirm:n.deleteInstallmentConfirmationConfirm},icon:t.jsx(P,{icon:"solar:danger-triangle-outline",className:"size-7"}),confirmColor:"danger",portalContainer:a,shouldBlockScroll:!1,classNames:Zf,onClose:()=>o(!1),onConfirm:()=>{o(!1),r()}}):null]})}function tx({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 sx=/^\d{4}-\d{2}-\d{2}$/;function Ns(e,s){const n=sx.test(e)?new Date(`${e}T00:00:00`):new Date(e);return Number.isNaN(n.getTime())?e:new Intl.DateTimeFormat(s,{month:"short",day:"numeric",year:"numeric"}).format(n)}const nx={title:"Select Membership",renewalTitle:"Automatic Renewal",renewalDescription:"Membership will automatically renew at the end of each period"},ax=({cards:e,locale:s,currency:n,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,b]=h.useState(l),[v,g]=h.useState(o),y={...nx,...r};h.useEffect(()=>{b(l)},[l]);const N=w=>{if(w===x){d&&f?.(w);return}b(w),f?.(w)},k=w=>{g(w),u?.(w)};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:y.title}),i&&t.jsx(Cl,{title:y.renewalTitle,description:y.renewalDescription,value:v,onValueChange:k}),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(w=>t.jsx(yl,{itemKey:w.id,name:w.name,type:w.type,price:w.price,locale:s,currency:n,isSelected:x===w.id,onSelect:N},w.id))})]})},yl=({itemKey:e,name:s,type:n,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:b=""})=>{const v=new Intl.NumberFormat(r,{style:"currency",currency:i,minimumFractionDigits:0,maximumFractionDigits:2}).format(a),g=!!d&&!f,y=m||p,N=()=>{g&&d?.(e)};return t.jsx(c.Card,{shadow:"none",isPressable:!!d,onPress:N,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":"",b),"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:s}),n&&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:n})}),y&&t.jsx(c.Chip,{"data-testid":"item-card-status",color:x,size:"sm",variant:"flat",className:"px-2",children:y})]}),o&&t.jsx("p",{className:c.cn("font-semibold text-right",u?"text-lg":"text-2xl"),"data-testid":"item-card-price",children:v})]})})},vr="w-full bg-gray-100",jr={variant:"light",color:"default"},vl=({id:e,title:s,media:n,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:b=!1,className:v="",bodyClassName:g="",footerClassName:y="",dataTestId:N})=>{const k=!!(d&&d.value),w=!!u?.label,$=p&&!!m&&!w,A=!$,j=w?{variant:u?.variant??jr.variant,color:u?.color??jr.color,size:u?.size??"sm",isDisabled:x||u?.isDisabled,startContent:u?.icon?t.jsx(P,{icon:u.icon,width:16}):void 0}:null,L=n??(a?t.jsx("div",{className:c.cn("relative overflow-hidden rounded-xl",o,vr,i),children:t.jsx(c.Image,{removeWrapper:!0,src:a,alt:r||s,className:"size-full object-cover",classNames:{wrapper:"absolute inset-0"}})}):t.jsx("div",{className:c.cn("relative overflow-hidden rounded-xl",o,vr,"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":N||`catalog-item-card-${e??"item"}`,className:c.cn("w-full overflow-hidden",v),isPressable:$,onPress:m,isDisabled:x,shadow:"sm",radius:"lg",children:[t.jsx("div",{children:L}),t.jsxs(c.CardBody,{className:c.cn("gap-3",b?"p-3":"p-4",g),children:[t.jsx("h3",{"data-testid":`catalog-item-card-title-${e??""}`,className:c.cn("line-clamp-2 text-base font-semibold text-gray-900",b?"text-sm":""),children:s}),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,M)=>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}-${M}`))}):null,(k||w)&&t.jsxs("div",{className:c.cn("flex items-center justify-end gap-2 pt-1 text-sm",b?"pt-0.5":"",y),children:[k?t.jsxs("span",{className:c.cn("mr-auto text-gray-500",b?"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}),w&&A?t.jsx(I,{className:c.cn("rounded-full",u?.className),onPress:u?.onPress,variant:j?.variant,color:j?.color,size:j?.size,startContent:j?.startContent,isDisabled:j?.isDisabled,"aria-label":u?.ariaLabel||u?.label,children:u?.label}):null]}),f?t.jsx("div",{className:"pt-1",children:f}):null]})]})};vl.displayName="CatalogItemCard";const rx={open:"Open","selling-fast":"Selling fast","sold-out":"Sold out"};function jl({title:e,subtitle:s,price:n,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:s})]}),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:rx[r]}):null,n?t.jsxs("strong",{className:"ml-5 whitespace-nowrap text-xl",children:["from ",n]}):null]})})}jl.displayName="ProgramListItem";const ix={card:"gap-3 rounded-xl border border-dashed px-6 py-12",panel:"px-6 py-[72px]"},lx={card:"size-12 rounded-2xl",panel:"size-[76px] rounded-[20px] border mb-[18px]"},ox={card:"text-base font-medium text-default-900",panel:"text-[17px] font-semibold text-acct-ink"},cx={card:"max-w-sm text-sm text-default-600",panel:"max-w-[380px] text-sm text-acct-sub mt-1.5"},dx={card:"text-xs text-default-500",panel:"text-xs text-acct-sub mt-2"},ux={card:"mt-1",panel:"mt-[22px]"},mx="bg-acct-page border-acct-border text-acct-muted",fx={empty:"solar:inbox-line-duotone",error:"solar:danger-triangle-outline",success:"solar:check-circle-bold"},xx={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"},px={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"},hx={empty:"status",error:"alert",success:"status",loading:"status"},bx={empty:"polite",error:"assertive",success:"polite",loading:"polite"};function gx(e,s,n,a){if(s===!1)return null;if(e==="loading"&&s===void 0)return t.jsx(c.Spinner,{size:"lg",color:"primary",className:a.spinner});if(h.isValidElement(s))return t.jsx(t.Fragment,{children:s});const r=typeof s=="string"?s:fx[e];return r?t.jsx(P,{icon:r,width:n,height:n,"aria-hidden":"true",className:a.icon}):null}function wl({variant:e="empty",surface:s="card",title:n,titleAs:a="p",description:r,icon:i,actions:o,role:l=hx[e],ariaLive:d=bx[e],iconSize:u=24,className:f,classNames:m={},"data-testid":p="feedback-state",referenceCode:x,referenceCodeLabel:b="Reference code:"}){const v=gx(e,i,u,m);return t.jsxs("div",{role:l,"aria-live":d,"data-variant":e,"data-testid":p,"data-surface":s,className:c.cn("flex flex-col items-center justify-center text-center",ix[s],s==="card"?xx[e]:"bg-transparent",f,m.base),children:[v?t.jsx("span",{"aria-hidden":"true","data-testid":`${p}-icon`,className:c.cn("inline-flex items-center justify-center",lx[s],e==="success"&&s==="card"&&"rounded-full",s==="panel"?mx:px[e],m.iconWrapper),children:v}):null,t.jsxs("div",{className:c.cn("flex flex-col items-center",s==="card"&&"gap-1"),children:[t.jsx(a,{"data-testid":`${p}-title`,className:c.cn(ox[s],m.title),children:n}),r?t.jsx("p",{"data-testid":`${p}-description`,className:c.cn(cx[s],m.description),children:r}):null,x?t.jsxs("p",{"data-testid":`${p}-reference-code`,className:c.cn(dx[s],m.referenceCode),children:[b," ",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",ux[s],m.actions),children:o}):null]})}function os(e){return t.jsx(wl,{...e})}function na(e){return t.jsx(os,{...e,variant:"empty"})}function aa(e){return t.jsx(wl,{...e,variant:"error"})}function ra(e){return t.jsx(os,{...e,variant:"loading"})}function Nl(e){return t.jsx(os,{...e,variant:"success"})}os.displayName="FeedbackState";na.displayName="EmptyState";aa.displayName="ErrorState";ra.displayName="LoadingState";Nl.displayName="SuccessState";const Cl=({title:e,value:s,description:n,onValueChange:a,className:r=""})=>{const i=h.useId();return t.jsxs("div",{className:c.cn("w-full flex flex-row items-center",e||n?"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}),n&&t.jsx("p",{className:"text-left text-gray-500","data-testid":"toggle-description",children:n})]}),t.jsx(c.Switch,{id:i,isSelected:s,onValueChange:a,"data-testid":"toggle-switch"})]})},yx={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"},vx=(e,s)=>new Intl.NumberFormat(e,{style:"currency",currency:s}),kl=e=>Object.values(e).reduce((s,n)=>s+Object.values(n).reduce((a,r)=>a+Object.values(r).reduce((i,o)=>i+o.selectedQuantity,0),0),0),jx=e=>e.reduce((s,n)=>s+n.dates.reduce((a,r)=>a+r.tickets.reduce((i,o)=>i+o.max,0),0),0),ia=e=>e.flatMap(s=>s.dates.flatMap(n=>n.tickets.map(a=>({exhibition:s,dateGroup:n,ticket:a})))),wr=(e,s,n)=>{const a={};let r=n?s??jx(e):0;for(const{exhibition:i,dateGroup:o,ticket:l}of ia(e)){a[i.id]??={},a[i.id][o.id]??={};const d=n?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},Nr=(e,s,n)=>`${e}::${s}::${n}`,wx=(e,s,n)=>{const a=kl(s);for(const{exhibition:r,dateGroup:i,ticket:o}of ia(e)){const l=s[r.id]?.[i.id]?.[o.id]?.selectedQuantity??0,d=n===void 0?o.max:Math.min(o.max,n-(a-l));if(d>0&&l<d)return!1}return!0},Nx=({initialQuantity:e=1,minQuantity:s=1,maxQuantity:n=10,onChange:a,disabled:r=!1})=>{const i=Math.max(s,Math.min(n,e)),[o,l]=h.useState(()=>String(i)),[d,u]=h.useState(!1),f=d?o:String(i),m=()=>{r||i>=n||a?.(i+1)},p=()=>{r||i<=s||a?.(i-1)},x=w=>{if(r)return;l(w.target.value);const $=parseInt(w.target.value,10);isNaN($)||a?.(Math.max(s,Math.min(n,$)))},b=w=>{const $=parseInt(w.target.value,10);if(u(!1),isNaN($)){a?.(s);return}const A=Math.max(s,Math.min(n,$));A!==$?a?.(A):l(String(A))},v=i<=s,g=i>=n,y="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",N="bg-primary hover:bg-primary/80",k="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||v,className:c.cn(y,r||v?k:N),"aria-label":"Decrement quantity","data-testid":"quantity-decrement",children:"-"}),t.jsx("input",{type:"number",value:f,onChange:x,onFocus:()=>u(!0),onBlur:b,disabled:r,min:s,max:n,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||g,className:c.cn(y,r||g?k:N),"aria-label":"Increment quantity","data-testid":"quantity-increment",children:"+"})]})},Cx=({label:e,checked:s=!1,onChange:n,disabled:a=!1})=>{const r=()=>{a||n?.(!s)};return t.jsxs("button",{type:"button",onClick:r,disabled:a,role:"checkbox","aria-checked":s,"data-testid":"checkbox-button","data-checked":s,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:s,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",s?"bg-primary":"bg-white ring-1 ring-zinc-300"),children:s&&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})]})},kx=({item:e,quantity:s,onChange:n,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-s))},d=i?.locale??"en-US",u=i?.currency??"USD",f=vx(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(Nx,{initialQuantity:s,minQuantity:0,maxQuantity:l(),onChange:n})]}),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]})},Sx=({exhibitionId:e,dateGroup:s,isLast:n=!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",!n&&"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:s.date}),s.tickets.map((u,f)=>t.jsxs("div",{children:[t.jsx(kx,{item:u,quantity:r(e,s.id,u.id),onChange:m=>a(e,s.id,u.id,m),getTotalSelectedTickets:i,userMaxLimit:o,settings:l,labels:d}),f<s.tickets.length-1?t.jsx(c.Divider,{className:"bg-zinc-200","data-testid":"upgrade-ticket-divider"}):null]},u.id))]}),$x=({title:e,exhibition:s,onQuantityChange:n,getTicketQuantity:a,getTotalSelectedTickets:r,userMaxLimit:i,settings:o,labels:l,initialExpanded:d=!1})=>{const[u,f]=h.useState(d),m=s.dates.reduce((x,b)=>x+b.tickets.reduce((v,g)=>v+a(s.id,b.id,g.id),0),0),p=s.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-${s.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-${s.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?s.dates.map((x,b)=>t.jsx(Sx,{exhibitionId:s.id,dateGroup:x,isLast:b===s.dates.length-1,onQuantityChange:n,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})})})})]})},Ax=({initialExpanded:e=!1,userMaxLimit:s,labels:n,settings:a,ticketSelectionData:r,className:i="",onSelectionChange:o})=>{const l=h.useMemo(()=>r??[],[r]),d={...yx,...n},[u,f]=h.useState(()=>wr(l,s,!0)),m=h.useRef(!1),p=h.useMemo(()=>{const N=ia(l).map(({exhibition:k,dateGroup:w,ticket:$})=>[Nr(k.id,w.id,$.id),$]);return new Map(N)},[l]),x=wx(l,u,s),b=(N,k,w)=>u[N]?.[k]?.[w]?.selectedQuantity??0,v=()=>kl(u),g=(N,k,w,$)=>{const A=b(N,k,w),j=v()-A;if(s!==void 0&&j+$>s)return;const L=p.get(Nr(N,k,w));if(!L)return;const S={...u,[N]:{...u[N],[k]:{...u[N]?.[k],[w]:{id:w,selectedQuantity:$,originalPrice:L.originalPrice,discountedPrice:L.price}}}};f(S),o?.(S)},y=N=>{const k=wr(l,s,N);f(k),o?.(k)};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(Cx,{label:d.selectAllButtonLabel,checked:x,onChange:y})]}),l.map(N=>t.jsx($x,{title:N.exhibitionName,exhibition:N,onQuantityChange:g,getTicketQuantity:b,getTotalSelectedTickets:v,userMaxLimit:s,settings:a,labels:d,initialExpanded:e},N.id))]})},un={confirm:"Confirm",clear:"Clear",noLabel:"Filters"},mn=e=>{const s={};for(const n of e)n.type==="checkbox"?s[n.id]=[...n.selectedValues]:s[n.id]=n.selectedValue?[n.selectedValue]:[];return s},Dx=(e,s)=>{const n={};for(const a of s){if(a.type==="checkbox"){n[a.id]=e[a.id]??[...a.selectedValues];continue}const r=e[a.id]??[];n[a.id]=r.length>0?r[0]:null}return n},Ex=e=>e.type==="checkbox"?e.selectedValues.length>0:e.selectedValue!==null,Sl=({triggerLabel:e,triggerAriaLabel:s,triggerIcon:n="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:b="badge",confirmLabel:v=un.confirm,clearLabel:g=un.clear,isOpen:y,defaultOpen:N=!1,onOpenChange:k,isDisabled:w=!1,closeOnConfirm:$=!0,keepOpenAfterClear:A=!1})=>{const[j,L]=h.useState(N),[S,M]=h.useState(()=>mn(u)),D=y??j,E=p??u.filter(Y=>Ex(Y)).length,R=Y=>{Y&&M(mn(u)),y||L(Y),k?.(Y)},T=(Y,ce)=>{M(ne=>({...ne,[Y.id]:ce}))},H=(Y,ce)=>{M(ne=>({...ne,[Y.id]:ce?[ce]:[]}))},K=async()=>{M(mn(u.map(Y=>Y.type==="checkbox"?{...Y,selectedValues:[]}:{...Y,selectedValue:null}))),await m(),A||R(!1)},B=async()=>{const Y=Dx(S,u);await f(Y),$&&R(!1)},se=Y=>{if(Y.type==="checkbox")return t.jsx(c.CheckboxGroup,{label:Y.label,value:S[Y.id]??[],onValueChange:ne=>T(Y,ne),children:Y.options.map(ne=>t.jsx(c.Checkbox,{value:ne.value,isDisabled:ne.isDisabled,children:ne.label},ne.value))},Y.id);const ce=S[Y.id]?.[0]??"";return t.jsx(c.RadioGroup,{label:Y.label,value:ce,onValueChange:ne=>H(Y,ne||null),children:Y.options.map(ne=>t.jsx(c.Radio,{value:ne.value,isDisabled:ne.isDisabled,children:ne.label},ne.value))},Y.id)},G=h.useMemo(()=>E>0?x?.(E)||`${E} filters applied`:void 0,[x,E]),Q=h.useMemo(()=>E===0?e||un.noLabel:x?x(E):`${e} (${E})`,[E,e,x]);return t.jsx("div",{className:d,children:t.jsxs(c.Popover,{isOpen:D,onOpenChange:R,placement:"bottom-end",children:[t.jsx(c.PopoverTrigger,{children:t.jsxs(I,{isDisabled:w,variant:a,color:r,size:i,className:o,"aria-label":s,"aria-haspopup":"dialog","aria-expanded":D,children:[t.jsx(P,{icon:n,width:16}),t.jsx("span",{children:e}),b==="badge"&&E>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:E}):b==="summary"&&Q!==e?t.jsx("span",{className:"text-xs",children:Q}):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=>se(Y)),t.jsxs("div",{className:"flex items-center justify-end gap-2 border-t border-gray-200 pt-3",children:[t.jsx(I,{variant:"light",color:"default",size:"sm",onPress:K,children:g}),t.jsx(I,{color:"primary",size:"sm",onPress:B,children:v})]})]})})]})})};Sl.displayName="FilterPopover";const Lx="No sessions available for this date",Fx=e=>e==="sold-out"||e==="closed"?"danger":"success",_x=e=>{const s=e.seatsRemaining;return e.status==="sold-out"||e.status==="closed"?"Sold out":e.status==="limited"?typeof s=="number"?`${s} left`:"Limited":typeof s=="number"?`${s} seats available`:"Available"},Cr=e=>e.isDisabled?!0:e.status==="sold-out"||e.status==="closed",Rx=(e,s)=>s&&e.some(n=>n.date===s)?s:e[0]?.date??null,$l=({heading:e,subheading:s,days:n,selectedDate:a,onDateSelect:r,quickDates:i,selectedSessionId:o=null,onSessionSelect:l,emptyStateMessage:d=Lx,statusLabel:u,statusTone:f,sessionAriaLabel:m,dayButtonClassName:p,calendarSlot:x,dayGroupAriaLabel:b,sessionGridAriaLabel:v,className:g,headingClassName:y,subheadingClassName:N})=>{const k=Rx(n,a),w=n.find(S=>S.date===k),$=i??n.map(S=>({date:S.date,label:S.label})),A=w?.sessions??[],j=S=>S===k?"solid":"bordered",L=S=>{if(!Cr(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",g),"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",y),children:e}),s?t.jsx("p",{className:c.cn("text-sm text-gray-700",N),children:s}):null]}),t.jsxs("div",{className:"flex flex-wrap items-center gap-2",role:"group","aria-label":b||"Session days",children:[$.map(S=>t.jsx(I,{size:"sm",variant:j(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":v||"Sessions",children:[A.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,A.map(S=>{const M=Cr(S),D=S.id===o;return t.jsx("li",{className:"rounded-xl",children:t.jsx(c.Card,{shadow:"sm",radius:"lg",isPressable:!M,onPress:()=>{L(S)},"aria-disabled":M,"aria-pressed":M?void 0:D,className:c.cn("w-full",M?"bg-gray-100 opacity-70":"",D?"w-full ring-2 ring-gray-900":""),"aria-label":m?m(S,{isSelected:D,isUnavailable:M}):M?`${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):Fx(S.status),variant:"flat",children:u?u(S):_x(S)})]})})},S.id)})]})]})};$l.displayName="SessionTimeline";const En=16,mt=e=>`${e/En}rem`;function Mx(){if(typeof document>"u"||typeof getComputedStyle!="function")return En;const e=parseFloat(getComputedStyle(document.documentElement).fontSize);return Number.isFinite(e)&&e>0?e:En}const cs=(e,s)=>e>=s*Mx(),Px=1120;function It(){const e=h.useRef(null),[s,n]=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&&n(l.borderBoxSize?.[0]?.inlineSize??l.contentRect.width)});return n(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:s}}const Tx=48,et={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"},Ix=(e,s)=>typeof e=="string"?t.jsx(P,{icon:e,className:"size-5","aria-hidden":"true"}):e||s||null,Al=({title:e,subtitle:s,eyebrow:n,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=Ix(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(et.base,m?et.baseNarrow:et.baseWide):"flex flex-wrap items-start justify-between gap-4",l,d.base),children:[t.jsxs("div",{className:f?et.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?et.text:void 0,children:[n?t.jsx("p",{"data-testid":`${u}-eyebrow`,className:c.cn("text-brand text-sm font-medium uppercase tracking-wide",d.eyebrow),children:n}):null,t.jsx(o,{"data-testid":`${u}-title`,className:c.cn(f?m?et.titleNarrow:et.titleWide:"text-3xl font-semibold text-gray-950",d.title),children:e}),s?t.jsx("p",{"data-testid":`${u}-subtitle`,className:c.cn(f?m?et.subtitleNarrow:et.subtitleWide:"mt-1 text-sm text-gray-600",d.subtitle),children:s}):null]})]}),i?t.jsx("div",{"data-testid":`${u}-actions`,className:c.cn(f?m?et.actionsNarrow:et.actionsWide:"flex flex-wrap items-center gap-2",d.actions),children:i}):null]})},Ox=e=>{const{ref:s,width:n}=It(),a=n>0&&!cs(n,Tx);return t.jsx(Al,{...e,list:!0,narrow:a,headerRef:s})},Dl=e=>e.variant==="list"?t.jsx(Ox,{...e}):t.jsx(Al,{...e,list:!1,narrow:!1});Dl.displayName="PageHeader";const Je={ok:{fg:oe.ok,bg:oe["ok-fill"]},warn:{fg:oe.warn,bg:oe["warn-fill"]},danger:{fg:oe.danger,bg:oe["danger-fill"]},info:{fg:oe.info,bg:oe["info-fill"]},violet:{fg:oe.violet,bg:oe["violet-fill"]},neutral:{fg:oe.neutral,bg:oe["neutral-fill"]}};function ds(e){if(e==="positive")return{color:oe.ok};if(e==="negative")return{color:oe.danger}}const Bx={active:"success",success:"success",draft:"warning",pending:"warning",warning:"warning",danger:"danger",archived:"default",inactive:"default",neutral:"default",info:"default",violet:"default"},Ln={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:Je.info,violet:Je.violet},zx={active:"ok",success:"ok",draft:"warn",pending:"warn",warning:"warn",danger:"danger",archived:"neutral",inactive:"neutral",neutral:"neutral",info:"info",violet:"violet"},Vx={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]"},Ux={info:Ln.info,violet:Ln.violet},El=({status:e,label:s,variant:n="flat",size:a="sm",color:r,startContent:i,className:o,"data-testid":l="status-chip"})=>{if(n==="plain"){const u=Je[zx[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",Vx[a],"leading-[1.35]",o),style:{color:u.fg,backgroundColor:u.bg},children:[i,s]})}if(n==="dot"){const u=Ln[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"}}),s]})}const d=r?void 0:Ux[e];return t.jsx(c.Chip,{color:r??Bx[e],variant:n,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:s})};El.displayName="StatusChip";const Hx={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"},xs={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"},Vs=({label:e,value:s,size:n="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(xs.base,xs[n],r),children:[t.jsx("span",{className:xs.label,children:e}),t.jsx("span",{className:xs.value,children:s})]}):t.jsxs("span",{"data-testid":i,className:c.cn("inline-flex items-baseline whitespace-nowrap border border-default-200 bg-default-100",Hx[n],r),children:[t.jsx("span",{className:"font-medium text-default-400",children:e}),t.jsx("span",{className:"font-semibold text-default-700",children:s})]});Vs.displayName="KeyValueChip";const Ll=({columns:e,rows:s=6,label:n="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:n}),t.jsx("div",{"aria-hidden":"true",children:Array.from({length:s}).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(ys,l.bar),style:{height:mt(a),width:m==="fill"?"60%":mt(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",Pn,l.bar),style:{height:a,width:m==="fill"?"60%":m}})},p)})},f))})]});Ll.displayName="TableSkeleton";const la="text-left text-[11px] font-semibold uppercase tracking-[.04em] text-acct-sub px-4 pt-4 pb-3 whitespace-nowrap bg-transparent",oa="px-4 text-[13.5px] text-acct-ink2 align-middle",ca="border-t border-acct-hair transition-colors duration-150 hover:bg-acct-page data-[hover=true]:bg-acct-page",da="w-full",Fl="border-t border-acct-border px-5 py-3.5",ps={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 ${Ne}`,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"},_l=({columns:e,children:s,emptyContent:n,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&&ps.base,o,l.base),"data-testid":d,"data-variant":u?"framed":void 0,children:[t.jsxs(qn,{"aria-label":r,removeWrapper:!0,classNames:{table:c.cn(da,l.table),th:c.cn(u?ps.th:la,l.th),tr:c.cn(u?ps.tr:ca,l.tr),td:c.cn(u?ps.td:oa,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:n,children:s})]}),a?t.jsx("div",{"data-testid":`${d}-footer`,className:c.cn(!u&&Fl,l.footer),children:a}):null]})};_l.displayName="AdminTable";const Wx={sm:"size-6 min-w-6",md:"size-[30px] min-w-[30px]"},ua=({actions:e,size:s="md",className:n,"data-testid":a="row-actions"})=>t.jsx("div",{role:"presentation","data-testid":a,className:c.cn("inline-flex gap-0.5",n),onClick:r=>r.stopPropagation(),children:e.map(r=>t.jsx(I,{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",Wx[s]),children:r.icon},r.key))});ua.displayName="RowActions";const qx=_e.palettes.warning[50],Gx="solar:alt-arrow-down-outline",Kx="solar:pen-2-outline",Yx={sm:"hidden sm:table-cell",md:"hidden md:table-cell",lg:"hidden lg:table-cell"},ye={root:"w-full overflow-x-auto rounded-2xl border border-acct-border bg-acct-surface",table:da,th:la,alignRight:"text-right",thActions:"w-px",row:ca,rowOpen:"bg-acct-page hover:bg-acct-page",td:c.cn(oa,"py-3"),tdActions:"w-px whitespace-nowrap py-2 pl-2 pr-3 align-middle",actions:"flex items-center justify-end gap-0.5",toggle:"gap-1.5 text-acct-ink2 data-[hover=true]:bg-acct-hair",toggleOpen:"bg-acct-surface shadow-sm ring-1 ring-acct-border data-[hover=true]:bg-acct-surface",chevron:`size-4 shrink-0 transition-transform duration-150 ${Ne}`,chevronOpen:"rotate-180",panelRow:"bg-acct-page",panelCell:"px-4 pb-4 pt-0",panel:"rounded-xl border border-acct-border bg-acct-surface p-4 shadow-sm",panelTitle:"mb-4 flex items-center gap-1.5 border-b border-acct-hair pb-3 text-xs font-semibold uppercase tracking-wide text-acct-sub",panelTitleIcon:"size-3.5 shrink-0",panelFooter:"mt-4 flex flex-wrap items-center justify-end gap-2 border-t border-acct-hair pt-3",done:"border-acct-border bg-acct-surface",empty:"px-4 py-10 text-center text-sm text-acct-sub"},Qx=new Set(["text","search","email","tel","url","number","password"]);function Zx(e){return e instanceof HTMLInputElement&&Qx.has(e.type)&&e.getAttribute("aria-expanded")!=="true"}function kr(e){return c.cn(e.align==="right"&&ye.alignRight,e.hideBelow&&Yx[e.hideBelow])}function Rl({ariaLabel:e,columns:s,rows:n,getRowKey:a,getRowLabel:r,renderCell:i,renderExpanded:o,renderExpandedActions:l,getRowActions:d,rowNeedsFix:u,expandedKeys:f,defaultExpandedKeys:m,onExpandedChange:p,labels:x,emptyContent:b,className:v,"data-testid":g="expandable-table"}){const y=h.useId(),N=f!==void 0,[k,w]=h.useState(()=>new Set(m??[])),$=h.useMemo(()=>N?new Set(f):k,[N,f,k]),A=h.useRef(new Map),j=h.useRef(null),L=(D,E,R)=>{if($.has(D)===E)return;const T=new Set($);E?T.add(D):T.delete(D),N||w(T),p?.(T,{key:D,expanded:E,reason:R})};h.useLayoutEffect(()=>{const D=j.current;if(D===null||$.has(D))return;j.current=null;const E=document.activeElement;(E===null||E===document.body)&&A.current.get(D)?.focus()});const S=D=>E=>{if(E.defaultPrevented||E.nativeEvent.isComposing)return;const R=E.key==="Escape"?"escape":E.key==="Enter"&&Zx(E.target)?"enter":null;R!==null&&(E.preventDefault(),E.stopPropagation(),L(D,!1,R))},M=s.length+1;return t.jsx("div",{"data-testid":g,className:c.cn(ye.root,v),children:t.jsxs("table",{"aria-label":e,className:ye.table,children:[t.jsx("thead",{children:t.jsxs("tr",{children:[s.map(D=>t.jsx("th",{scope:"col",className:c.cn(ye.th,kr(D)),style:D.width===void 0?void 0:{width:D.width},children:D.label},D.key)),t.jsx("th",{scope:"col",className:c.cn(ye.th,ye.thActions),children:t.jsx("span",{className:"sr-only",children:x.actions})})]})}),n.length===0&&te(b)?t.jsx("tbody",{children:t.jsx("tr",{children:t.jsx("td",{colSpan:M,className:ye.empty,"data-testid":`${g}-empty`,children:b})})}):null,n.map((D,E)=>{const R=a(D),T=$.has(R),H=u?.(D)??!1,K=x.toggleRow(r(D)),B=`${y}-panel-${E}`,se=d?.(D,E)??[],G={rowIndex:E,close:()=>L(R,!1,"done")};return t.jsxs("tbody",{"data-testid":`${g}-row-${R}`,"data-expanded":T?"true":"false","data-needs-fix":H?"true":void 0,children:[t.jsxs("tr",{className:c.cn(ye.row,T&&ye.rowOpen),style:H&&!T?{backgroundColor:qx}:void 0,children:[s.map(Q=>t.jsx("td",{className:c.cn(ye.td,kr(Q)),children:i(D,Q.key,E)},Q.key)),t.jsx("td",{className:ye.tdActions,children:t.jsxs("div",{className:ye.actions,children:[t.jsx(I,{ref:Q=>{Q?A.current.set(R,Q):A.current.delete(R)},variant:"light",color:"default",size:"sm",testId:`${g}-toggle-${R}`,"aria-label":K,"aria-expanded":T,"aria-controls":T?B:void 0,className:c.cn(ye.toggle,T&&ye.toggleOpen),endContent:t.jsx(P,{"aria-hidden":!0,icon:Gx,className:c.cn(ye.chevron,T&&ye.chevronOpen)}),onPress:()=>L(R,!T,"toggle"),children:x.toggle}),se.length>0?t.jsx(ua,{actions:se,"data-testid":`${g}-actions-${R}`}):null]})})]}),T?t.jsx("tr",{className:ye.panelRow,children:t.jsx("td",{colSpan:M,className:ye.panelCell,children:t.jsxs("div",{role:"region",id:B,"aria-label":K,"data-testid":`${g}-panel-${R}`,className:ye.panel,onKeyDown:S(R),onFocus:()=>{j.current=R},onBlur:Q=>{const Y=Q.relatedTarget;Y&&!Q.currentTarget.contains(Y)&&(j.current=null)},children:[te(x.panelTitle)?t.jsxs("p",{className:ye.panelTitle,children:[t.jsx(P,{"aria-hidden":!0,icon:Kx,className:ye.panelTitleIcon}),x.panelTitle]}):null,o(D,G),t.jsxs("div",{className:ye.panelFooter,children:[l?.(D,G),t.jsx(I,{variant:"bordered",color:"default",size:"sm",testId:`${g}-done-${R}`,className:ye.done,onPress:G.close,children:x.done})]})]})})}):null]},R)})]})})}Rl.displayName="ExpandableTable";const Xx=as["--warn"],Sr={root:"inline-flex shrink-0 items-center",dot:"block size-1.5 shrink-0 rounded-full"};function ma({label:e,className:s,"data-testid":n="needs-fix-dot"}){return t.jsxs("span",{"data-testid":n,className:c.cn(Sr.root,s),children:[t.jsx("span",{"aria-hidden":"true","data-testid":`${n}-mark`,className:Sr.dot,style:{backgroundColor:Xx}}),t.jsx("span",{className:"sr-only",children:e})]})}ma.displayName="NeedsFixDot";function Jx(e,s){return e.find(n=>n.needsFix&&!n.isDisabled)?.key??s}const qt={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"},ep={md:"w-[280px]",lg:"w-[360px]",fill:"min-w-[12.5rem] flex-1"},tp=48,lt={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"},$r={md:"w-[15.625rem]",lg:"w-[22.5rem]",fill:"w-full"},Fs={inputWrapper:"h-12 min-h-12 !h-12",input:"text-base",icon:"[&_svg]:size-5"},Ar={button:"shrink-0 text-default-500",input:"[&::-webkit-search-cancel-button]:appearance-none"},Dr={md:{button:"size-8 min-w-8",icon:"size-4"},lg:{button:"size-11 min-w-11",icon:"size-5"}},Ml=({searchValue:e,onSearchChange:s,searchLabel:n,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(I,{isIconOnly:!0,size:"sm",variant:"light",color:"default",radius:"full","aria-label":i,onPress:()=>{s(""),f.current?.focus()},className:c.cn(Ar.button,Dr[o].button),testId:`${l}-search-clear`,children:t.jsx(P,{icon:"lucide:x","aria-hidden":"true",className:Dr[o].icon})}):void 0;return t.jsx(c.Input,{ref:f,type:"search","aria-label":n,placeholder:a??n,value:e,onValueChange:s,startContent:d,endContent:p,"data-testid":`${l}-search`,variant:"bordered",radius:"none",classNames:{base:u.base,inputWrapper:c.cn(u.inputWrapper,m&&Fs.inputWrapper),innerWrapper:u.innerWrapper,input:c.cn(u.input,m&&Fs.input,r&&Ar.input)}})},sp=({searchValue:e,onSearchChange:s,searchLabel:n,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:b}=It(),v=b>0&&!cs(b,tp),g=u==="fill";return t.jsxs("div",{ref:x,role:"search","data-testid":p,"data-variant":"framed","data-size":v?"narrow":"wide",className:c.cn(lt.base,v&<.narrow,m),children:[l,t.jsx("div",{"data-testid":`${p}-search-slot`,className:g?lt.searchFill:v?lt.searchNarrow:lt.searchWide,children:t.jsx(Ml,{searchValue:e,onSearchChange:s,searchLabel:n,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(lt.icon,f==="lg"&&Fs.icon),children:r??t.jsx(P,{icon:"lucide:search"})}),classNames:{base:g?$r.fill:v?lt.inputBaseNarrow:$r[u],inputWrapper:lt.inputWrapper,innerWrapper:lt.innerWrapper,input:lt.input}})}),d]})},Pl=({searchValue:e,onSearchChange:s,searchLabel:n,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(sp,{searchValue:e,onSearchChange:s,searchLabel:n,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(qt.base,p),children:[t.jsx(Ml,{searchValue:e,onSearchChange:s,searchLabel:n,searchPlaceholder:a,searchClearable:i,clearLabel:o,size:f,dataTestId:x,startContent:r?t.jsx("span",{"aria-hidden":"true",className:c.cn(qt.icon,f==="lg"&&Fs.icon),children:r}):void 0,classNames:{base:ep[u],inputWrapper:qt.inputWrapper,input:qt.input}}),l,d?t.jsx("div",{className:qt.trailing,children:d}):null]});Pl.displayName="AdminToolbar";const np="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",ap="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",rp="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",Tl=h.forwardRef(function({icon:s,children:n,count:a,appearance:r="pill",className:i,testId:o,...l},d){return r==="outline"?t.jsxs(I,{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:s,className:"size-4","aria-hidden":!0}),t.jsx("span",{children:n}),a!==void 0&&a>0&&t.jsx("span",{className:ap,children:a})]}):t.jsxs(I,{ref:d,"data-testid":o,variant:"light",size:"sm",className:c.cn(rp,i),...l,children:[t.jsx(P,{icon:s,className:"size-4 text-gray-500","aria-hidden":!0}),t.jsx("span",{children:n}),a!==void 0&&a>0&&t.jsx("span",{className:np,children:a})]})});Tl.displayName="ToolbarButton";const fn="w-full mb-4 border-b border-pos-line",xn=["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",Ne].join(" "),ip={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 ${Ne}`,tabContent:`text-[0.9375rem] font-medium text-acct-sub group-data-[selected=true]:font-semibold group-data-[selected=true]:text-acct-rust ${Ne}`},lg:{base:fn,tabList:"w-full -mb-px gap-2 rounded-none p-0",cursor:"hidden",tab:`${xn} min-h-11 px-5 py-0`,tabContent:`text-[0.9375rem] leading-5 font-semibold text-pos-neutral group-data-[selected=true]:text-primary ${Ne}`},"sm-primary":{base:fn,tabList:"w-full -mb-px gap-6 rounded-none px-0.5 py-0",cursor:"hidden",tab:`${xn} px-0.5 py-2.5`,tabContent:`text-[0.84375rem] leading-4 font-medium text-pos-muted group-data-[selected=true]:text-pos-ink ${Ne}`},"sm-secondary":{base:fn,tabList:"w-full -mb-px gap-0 rounded-none p-0",cursor:"hidden",tab:`${xn} px-[1.125rem] py-[0.5625rem]`,tabContent:`text-[0.8125rem] leading-4 font-semibold text-pos-muted group-data-[selected=true]:text-primary ${Ne}`}},Er={base:"mb-0 border-b-0",tabList:"mb-0 border-b-0"},lp="inline-flex items-center gap-1.5",op="data-[animated=true]:transition-none";function Il({items:e,value:s,onChange:n,ariaLabel:a,size:r="md",level:i="primary",showDivider:o=!0,needsFixLabel:l,className:d,"data-testid":u="underline-tabs"}){const f=Ms(),m=ip[r==="sm"?`sm-${i}`:r],p=r!=="md",x=e.filter(b=>b.isDisabled).map(b=>b.key);return t.jsx(c.Tabs,{"aria-label":a,variant:"underlined",selectedKey:s,onSelectionChange:b=>n(String(b)),disabledKeys:x,disableCursorAnimation:p,"data-testid":u,"data-size":r,classNames:{...m,base:c.cn(m.base,!o&&Er.base,d),tabList:c.cn(m.tabList,!o&&Er.tabList),cursor:c.cn(m.cursor,f&&op),panel:"p-0"},children:e.map(b=>{const v=`${u}-${b.key}`;return t.jsx(c.Tab,{title:b.needsFix?t.jsxs("span",{className:lp,children:[b.label," ",t.jsx(ma,{label:l??"","data-testid":`${v}-needs-fix`})]}):b.label,titleValue:b.hint,"data-testid":v,"data-needs-fix":b.needsFix?"true":void 0,children:b.content},b.key)})})}Il.displayName="UnderlineTabs";const fa="text-[11px] font-semibold uppercase tracking-[.04em] text-acct-muted mb-1.5",Ol="font-normal normal-case tracking-normal",Bl="ms-0.5 text-acct-danger",zl="mb-0 min-h-[calc(var(--heroui-font-size-small)_+_10px)] text-foreground",Vl="after:content-none",Ul="ms-0.5 -my-1.5 size-6 min-w-6 align-middle text-acct-sub data-[hover=true]:bg-acct-page data-[hover=true]:text-acct-ink",Hl="size-4",Wl="max-w-xs rounded-xl px-3 py-2 text-xs leading-normal text-acct-ink2",ql=["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(" "),Gl="text-[13.5px] text-acct-ink",Kl="bg-acct-page text-acct-muted cursor-default",Yl="mt-[5px] text-xs text-acct-sub",Ql="mt-[5px] text-xs text-acct-danger";function cp({label:e}){return t.jsxs(t.Fragment,{children:[t.jsx("span",{"aria-hidden":"true",className:Bl,children:"*"}),e?t.jsxs(t.Fragment,{children:[" ",t.jsx("span",{className:"sr-only",children:e})]}):null]})}function dp({help:e,label:s,labelledBy:n,testId:a}){const r=s?{"aria-label":s}:{"aria-labelledby":n};return t.jsxs(c.Popover,{placement:"top",showArrow:!0,children:[t.jsx(c.PopoverTrigger,{children:t.jsx(I,{isIconOnly:!0,size:"sm",variant:"light",color:"default",radius:"full",...r,testId:a,className:Ul,children:t.jsx(P,{"aria-hidden":!0,icon:"solar:info-circle-outline",className:Hl})})}),t.jsx(c.PopoverContent,{...r,"data-testid":`${a}-content`,className:Wl,children:e})]})}function Zl(e,s,n,a){return t.jsxs(t.Fragment,{children:[e,s?t.jsxs("span",{className:Ol,children:[" ",s]}):null,n?t.jsx(cp,{label:a}):null]})}const xa=({children:e,suffix:s,htmlFor:n,id:a,isRequired:r,requiredLabel:i,help:o,helpLabel:l,className:d,"data-testid":u="admin-field-label"})=>{const f=h.useId(),m=Zl(e,s,r,i),p=te(o),x=a??(p?f:void 0);return t.jsxs("div",{"data-testid":u,className:c.cn(fa,d),children:[n?t.jsx("label",{id:x,htmlFor:n,children:m}):x?t.jsx("span",{id:x,children:m}):m,p&&x?t.jsx(dp,{help:o,label:l,labelledBy:x,testId:`${u}-help`}):null]})};xa.displayName="AdminFieldLabel";const Xl=({label:e,labelSuffix:s,value:n,onChange:a,placeholder:r,disabled:i=!1,readOnly:o=!1,mono:l=!1,autoFocus:d=!1,hint:u,invalid:f=!1,isRequired:m=!1,requiredLabel:p,help:x,helpLabel:b,className:v,"data-testid":g="admin-text-field"})=>{const y=h.useId(),N=h.useId(),k=te(e),w=k&&te(x),$=t.jsx(c.Input,{labelPlacement:k&&!w?"outside":void 0,label:k&&!w?Zl(e,s,m,p):void 0,id:w?y:void 0,"aria-labelledby":w?N:void 0,value:n,placeholder:r,isDisabled:i,isReadOnly:o,autoFocus:d,isInvalid:f,isRequired:k&&m,validationBehavior:"aria",description:!f&&u?u:void 0,errorMessage:f?u:void 0,onValueChange:a,"data-testid":g,variant:"bordered",radius:"none",classNames:{base:c.cn("w-full",!w&&v),label:c.cn(fa,Vl),inputWrapper:ql,input:c.cn(Gl,(l||o)&&"font-mono",o&&Kl),description:Yl,errorMessage:Ql}});return w?t.jsxs("div",{className:c.cn("w-full",v),children:[t.jsx(xa,{id:N,htmlFor:y,suffix:s,isRequired:m,requiredLabel:p,help:x,helpLabel:b,className:zl,"data-testid":`${g}-label`,children:e}),$]}):$};Xl.displayName="AdminTextField";const Jl=({children:e,placeholder:s="Select…",onOpen:n,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(I,{variant:"light",radius:"none",disableAnimation:!0,onPress:n,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:s}),o?t.jsx("span",{className:"ml-auto flex shrink-0 text-acct-muted",children:o}):null]}),m&&a?t.jsx(I,{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]})};Jl.displayName="PickerRow";const Le={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",menuWithDescriptions:"max-w-xs",menuItemDescription:"whitespace-normal text-default-600",menuItemDisabledWithDescription:"opacity-100",menuItemDimmed:"opacity-disabled",menuItemDimmedIcon:"flex shrink-0 opacity-disabled",avatar:"shrink-0 bg-default-200 text-default-700",dangerItem:"text-danger"},up={default:void 0,primary:"text-primary-800",success:void 0,warning:"text-warning-800",danger:void 0},mp={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"}},eo={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"}},fp={md:void 0,lg:"min-h-12 text-base"},xp={none:"",sm:"gap-1",md:"gap-2"},to="m-0 flex list-none flex-col p-0",Lt={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"]},so=h.createContext(!1),pp=()=>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"})}),hp=()=>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 bp(e){const s=e.trim().split(/\s+/).filter(Boolean);if(s.length===0)return"—";const n=s[0]?.charAt(0)??"",a=s.length>1?s[s.length-1]?.charAt(0)??"":"";return`${n}${a}`.toUpperCase()}const no=({title:e,subtitle:s,leading:n,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:b,variant:v="plain",isDisabled:g=!1,as:y,className:N,"data-testid":k="entity-row"})=>{const w=h.useContext(so),$=Ps(),A=b??($==="touch"?"lg":"md"),j=eo[A],L=mp[v],S=y??(w?"li":"div"),M=h.useId(),D=h.useId(),E=h.useId(),R=h.useId(),T=i!==void 0||r!==void 0,H=a!==void 0&&a.length>0,K=te(s),B=m!==void 0&&m.length>0,se=typeof e=="string"?e:void 0,G=B&&m.some(z=>te(z.description)),Q=B?m.filter(z=>z.isDisabled===!0&&te(z.description)).map(z=>`${z.label}: ${z.description}`).join(" "):"",Y=n?t.jsx(c.Avatar,{"aria-hidden":"true",size:j.avatar,radius:n.shape==="square"?"lg":"full",src:n.src,icon:n.icon,name:n.icon!==void 0?void 0:n.initials??n.name??se,getInitials:n.initials!==void 0?z=>z:bp,showFallback:n.src!==void 0,classNames:{base:Le.avatar},"data-testid":`${k}-leading`}):null,ce=t.jsxs(t.Fragment,{children:[Y,t.jsxs("span",{className:Le.text,children:[t.jsxs("span",{className:Le.titleLine,children:[t.jsx("span",{id:M,className:c.cn(Le.title,j.title),title:se,children:e}),H&&t.jsx("span",{id:D,className:Le.tags,children:a.map(z=>t.jsx(c.Chip,{size:"sm",variant:"flat",color:z.tone??"default",className:up[z.tone??"default"],"data-testid":`${k}-tag-${z.key}`,children:z.label},z.key))})]}),K&&t.jsx("span",{id:E,className:c.cn(Le.subtitle,j.subtitle),children:s})]})]}),ne=[H?D:null,K?E:null].filter(Boolean).join(" "),ee={"aria-labelledby":M,"aria-describedby":ne===""?void 0:ne,isDisabled:g,className:c.cn(Le.pressTarget,L.overlay,j.content)},le=`${k}-trigger`;let U;return i!==void 0?U=t.jsx(c.Link,{...ee,"data-testid":le,as:o,href:i,color:"foreground",underline:"none",onPress:r,children:ce}):r!==void 0?U=t.jsx(I,{...ee,testId:le,variant:"light",color:"default",radius:"none",disableAnimation:!0,disableRipple:!0,"aria-haspopup":l,onPress:r,children:ce}):U=t.jsx("div",{className:c.cn(Le.content,j.content),children:ce}),t.jsxs(S,{"data-testid":k,"data-size":A,"data-disabled":g||void 0,className:c.cn(Le.base,L.row,j.row,T&&!g&&L.hover,N),children:[U,(te(d)||B)&&t.jsxs("div",{className:Le.side,children:[d,B&&t.jsxs(c.Dropdown,{placement:"bottom-end",children:[t.jsx(c.DropdownTrigger,{children:t.jsx(I,{isIconOnly:!0,size:j.control,variant:"light",color:"default",radius:"full",isDisabled:g,"aria-label":p,"aria-describedby":Q===""?void 0:R,testId:`${k}-menu-trigger`,className:Le.menuTrigger,children:x??t.jsx(hp,{})})}),t.jsx(c.DropdownMenu,{"aria-label":p,"data-testid":`${k}-menu`,className:G?Le.menuWithDescriptions:void 0,disabledKeys:m.filter(z=>z.isDisabled).map(z=>z.key),onAction:z=>{m.find(Z=>Z.key===z)?.onAction()},items:m,children:z=>{const Z=z.isDisabled===!0&&te(z.description);return t.jsx(c.DropdownItem,{textValue:z.label,description:z.description,color:z.tone==="danger"?"danger":"default",className:c.cn(z.tone==="danger"&&Le.dangerItem,fp[A],Z&&Le.menuItemDisabledWithDescription),classNames:{title:Z?Le.menuItemDimmed:void 0,description:c.cn(Le.menuItemDescription,j.subtitle)},startContent:Z&&z.icon!==void 0?t.jsx("span",{className:Le.menuItemDimmedIcon,children:z.icon}):z.icon,"data-testid":z["data-testid"]??`${k}-menu-${z.key}`,children:z.label},z.key)}})]}),Q!==""&&t.jsx("span",{id:R,hidden:!0,"data-testid":`${k}-menu-trigger-description`,children:Q})]}),u&&t.jsx("span",{"aria-hidden":"true",className:Le.chevron,"data-testid":`${k}-chevron`,children:f??t.jsx(pp,{})})]})};no.displayName="EntityRow";const ao=({children:e,"aria-label":s,"aria-labelledby":n,gap:a="none",className:r,"data-testid":i="entity-list"})=>t.jsx("ul",{"aria-label":s,"aria-labelledby":n,"data-testid":i,className:c.cn(to,xp[a],r),children:t.jsx(so.Provider,{value:!0,children:e})});ao.displayName="EntityList";const ro=({label:e,rows:s=6,size:n,className:a,"data-testid":r="entity-list-skeleton"})=>{const i=Ps(),o=n??(i==="touch"?"lg":"md"),{titleWidths:l}=Lt;return t.jsxs("div",{"aria-busy":"true","data-testid":r,className:a,children:[t.jsx("span",{role:"status",className:"sr-only",children:e}),t.jsx("ul",{"aria-hidden":"true",className:to,children:Array.from({length:s},(d,u)=>t.jsxs("li",{"data-testid":`${r}-row`,className:c.cn(Lt.row,eo[o].row),children:[t.jsx(ie,{className:Lt.avatar[o]}),t.jsxs("span",{className:Lt.lines,children:[t.jsx(ie,{className:c.cn(Lt.title,l[u%l.length])}),t.jsx(ie,{className:Lt.subtitle})]})]},u))})]})};ro.displayName="EntityListSkeleton";function io(e,s,n){if(n<=0||s<=0||e<=0)return{from:0,to:0};const a=(e-1)*s+1;return a>n?{from:0,to:0}:{from:a,to:Math.min(n,e*s)}}const lo=({page:e,pageSize:s,total:n,unit:a,announce:r=!0,format:i,className:o,classNames:l={},"data-testid":d="pagination-summary"})=>{const{from:u,to:f}=io(e,s,n),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:n}):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:n}),a?t.jsxs(t.Fragment,{children:[" ",a]}):null]})})};lo.displayName="PaginationSummary";const Us="shadow-[0_1px_4px_rgba(0,0,0,.06),0_4px_12px_rgba(0,0,0,.06)]",dt={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"},gp={card:Us,flat:""},yp={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]"},vp={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:""}},oo=({isLoading:e=!1,isError:s=!1,isEmpty:n=!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:b,emptyContent:v,children:g,toolbar:y,variant:N="default",className:k,classNames:w={},"data-testid":$="list-panel"})=>{const A=N==="framed",j={base:c.cn("border-0 bg-transparent py-12",w.state)},L=A?{base:c.cn("px-6 py-[3.625rem]",w.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"}:j;let S;return e?S=r??t.jsx(ra,{title:a,classNames:j,"data-testid":`${$}-loading`}):s?S=f??t.jsx(aa,{title:i,description:o,classNames:j,"data-testid":`${$}-error`,actions:u??(d?t.jsx(I,{color:"primary",variant:"flat",onPress:d,children:l}):void 0)}):n?S=v??t.jsx(na,{surface:A?"panel":void 0,title:m,description:p,icon:x,actions:b,classNames:L,"data-testid":`${$}-empty`}):S=g,t.jsxs("section",{"data-testid":$,"data-variant":A?"framed":void 0,className:c.cn(A?`overflow-hidden rounded-2xl border border-pos-line bg-white ${Us}`:"rounded-xl bg-white p-2 shadow-sm",k,w.base),children:[y,S]})};oo.displayName="ListPanel";const pa=(e,s)=>s<=0?/^\d*$/.test(e):new RegExp(`^\\d*(?:[.,]\\d{0,${s}})?$`).test(e),ns=e=>{const s=Number.parseFloat(e.replace(",","."));return Number.isFinite(s)?s:null},co=(e,s)=>{const[n,a]=h.useState(()=>s(e)),r=(ns(n)??0)===(e??0)?n:s(e),i=h.useCallback(()=>{a(o=>{const l=ns(o);return l===null?"":String(l)})},[]);return{draft:r,setDraft:a,normalize:i}},jp=/^[\d.,]+$/,uo=(e,s=Object.is)=>{const n=h.useRef(e),a=h.useRef(null);h.useLayoutEffect(()=>{n.current=e},[e]);const r=h.useCallback(()=>{const l=a.current,d=n.current;return l===null||!(s(d,l.source)||s(d,l.emitted))},[s]),i=h.useCallback(l=>{a.current={source:n.current,emitted:l}},[]),o=h.useCallback(()=>{a.current=null},[]);return h.useMemo(()=>({isUntouched:r,markEdited:i,markUntouched:o}),[r,i,o])},mo=(e,s)=>{const n=h.useRef(null),a=h.useRef(s);return h.useLayoutEffect(()=>{a.current=s},[s]),h.useEffect(()=>{const r=n.current;if(!r)return;const i=l=>{e()&&(l.inputType==="insertText"&&l.data&&jp.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]),n},wp=350,Np={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}"},Cp=7,kp=e=>[...new Set((e??[]).filter(s=>Number.isFinite(s)&&s>0))].sort((s,n)=>s-n).slice(0,Cp),Sp=(e,s,n)=>{if(!Number.isInteger(e))return xe(e,s,n);try{return new Intl.NumberFormat(s,{style:"currency",currency:n,minimumFractionDigits:0}).format(e)}catch{return xe(e,s,n)}},$p=(e,s)=>(e??0)===(s??0),Gt=(e,s)=>Object.entries(s).reduce((n,[a,r])=>n.replace(`{${a}}`,r),e),Ap=({dueAmount:e,received:s,defaultReceived:n=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={...Np,...i},b=Tt(e.currency,r),v=s!==void 0,[g,y]=h.useState(n??null),N=v?s:g,{draft:k,setDraft:w,normalize:$}=co(N,U=>U==null?"":String(U)),{isUntouched:A,markEdited:j,markUntouched:L}=uo(N,$p),S=h.useMemo(()=>{const U=typeof N=="number"&&Number.isFinite(N)?N:0,z=Cn(U,e.value,e.currency,r);return{received:U,change:z>0?z:0,isValid:U>=e.value&&U>0}},[N,e.value,e.currency,r]),M=h.useCallback(U=>{const z=U.currentTarget;requestAnimationFrame(()=>{z.isConnected&&z.select()})},[]),D=h.useCallback(U=>{v||y(U);const z=typeof U=="number"&&Number.isFinite(U)?U:0,Z=Cn(z,e.value,e.currency,r);a?.({received:z,change:Z>0?Z:0,isValid:z>=e.value&&z>0})},[v,e.value,e.currency,r,a]),E=h.useCallback(U=>{if(o)return;const z=U.replace(/[^\d.,]/g,"");if(!pa(z,b))return;const Z=ns(z);Z!==null&&l!==void 0&&Z>l||(w(z),j(Z),D(Z))},[o,l,w,j,b,D]),R=mo(A,E),T=h.useMemo(()=>kp(d),[d]),H=U=>l!==void 0&&U>l,K=()=>{o||H(e.value)||(w(String(e.value)),L(),D(e.value))},B=U=>{if(o)return;const z=A()||typeof N!="number"||!Number.isFinite(N)?0:N,Z=Gn(z+U,e.currency,r);H(Z)||(w(String(Z)),j(Z),D(Z))},se=S.isValid&&S.change>0,G=!S.isValid&&S.received>0,Q=xe(S.change,r,e.currency),Y=xe(e.value,r,e.currency),[ce,ne]=h.useState(""),ee=h.useRef(null);h.useEffect(()=>{ee.current&&clearTimeout(ee.current);const U=se?Gt(x.changeMessageTemplate,{change:Q}):"",z=se?wp:0;return ee.current=setTimeout(()=>ne(U),z),()=>{ee.current&&clearTimeout(ee.current)}},[se,Q,x.changeMessageTemplate]);const le=`${p}-received`;return t.jsxs("div",{className:c.cn("flex flex-col gap-3",m),"data-testid":p,children:[t.jsx(c.Input,{ref:R,id:le,label:x.receivedLabel,labelPlacement:"outside",type:"text",inputMode:b===0?"numeric":"decimal",pattern:b===0?"[0-9]*":"[0-9]*[.,]?[0-9]*",value:k,onChange:U=>E(U.target.value),onFocus:M,onBlur:$,placeholder:x.receivedPlaceholder,isDisabled:o,isInvalid:G,errorMessage:G?Gt(x.insufficientMessageTemplate,{due:Y}):void 0,variant:"bordered",radius:"lg",autoFocus:f,"data-testid":`${p}-received-input`}),T.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(I,{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":Gt(x.exactAmountAriaTemplate,{amount:Y}),onPress:K,"data-testid":`${p}-quick-amount-exact`,children:[x.exactAmountLabel," ",Y]}),T.map(U=>{const z=Sp(U,r,e.currency);return t.jsx(I,{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":Gt(x.quickAmountAriaTemplate,{amount:z}),onPress:()=>B(U),"data-testid":`${p}-quick-amount-${U}`,children:z},U)})]})}),se&&t.jsx(c.Alert,{"data-testid":`${p}-change-alert`,color:"primary",variant:"flat",radius:"lg",title:x.changeLabel,description:Gt(x.changeMessageTemplate,{change:Q}),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:ce})]})},Dp={checkNumberLabel:"Check Number",checkNumberPlaceholder:"e.g. 11234",bankNameLabel:"Bank Name",bankNamePlaceholder:"e.g. Chase Bank",dateLabel:"Date",checkNumberRequiredMessage:"Check number is required"},Lr=()=>{const e=new Date,s=n=>String(n).padStart(2,"0");return`${e.getFullYear()}-${s(e.getMonth()+1)}-${s(e.getDate())}`},fo=({dueAmount:e,value:s,defaultValue:n,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={...Dp,...r},b=s!==void 0,[v,g]=h.useState({checkNumber:n?.checkNumber??"",bankName:n?.bankName??"",date:n?.date??Lr()}),[y,N]=h.useState(!!n?.checkNumber),k=h.useMemo(()=>b?{checkNumber:s?.checkNumber??"",bankName:s?.bankName??"",date:s?.date??Lr()}:v,[b,s,v]),w=h.useCallback(D=>{b||g(D);const E=D.checkNumber.trim(),R={amount:e.value,checkNumber:E,bankName:D.bankName.trim()||void 0,date:i?void 0:D.date,isValid:E.length>0&&e.value>0};a?.(R)},[b,e.value,i,a]),$=h.useCallback(D=>E=>{l||(D==="checkNumber"&&E.length>0&&N(!0),w({...k,[D]:E}))},[k,w,l]),A=h.useCallback(()=>{l||N(!0)},[l]),j=y&&k.checkNumber.trim()==="",L=`${p}-check-number`,S=`${p}-bank-name`,M=`${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:L,label:x.checkNumberLabel,labelPlacement:"outside",type:"text",value:k.checkNumber,onChange:D=>$("checkNumber")(D.target.value),onBlur:A,placeholder:x.checkNumberPlaceholder,maxLength:d,isRequired:!0,isInvalid:j,errorMessage:j?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:k.bankName,onChange:D=>$("bankName")(D.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:M,label:x.dateLabel,labelPlacement:"outside",type:"date",value:k.date,onChange:D=>$("date")(D.target.value),isDisabled:l,variant:"bordered",radius:"lg","data-testid":`${p}-date-input`,className:"sm:col-span-2"})]})};fo.displayName="CheckTenderForm";const Ep={methodLabel:"Method",methodPlaceholder:"Select a payment method",referenceLabel:"Reference",referencePlaceholder:"e.g. Voucher #1234",methodRequiredMessage:"Method is required"},Lp=[{value:"ach",label:"ACH"},{value:"wire",label:"Wire"},{value:"gift_card",label:"Gift Card"},{value:"voucher",label:"Voucher"},{value:"other",label:"Other"}],xo=({dueAmount:e,methodOptions:s=Lp,value:n,defaultValue:a,onChange:r,labels:i,showReference:o=!1,isDisabled:l=!1,className:d,"data-testid":u="other-tender-form"})=>{const f={...Ep,...i},m=n!==void 0,[p,x]=h.useState({method:a?.method??"",reference:a?.reference??""}),b=h.useMemo(()=>m?{method:n?.method??"",reference:n?.reference??""}:p,[m,n,p]),v=h.useCallback($=>s.find(A=>A.value===$)?.label??"",[s]),g=h.useCallback($=>{m||x($);const A=v($.method),j={amount:e.value,method:$.method,description:A,reference:$.reference.trim()||void 0,isValid:$.method!==""};r?.(j)},[m,e.value,r,v]),y=h.useCallback($=>{if(l)return;const A=typeof $=="string"?$:Array.from($)[0]?.toString()??"";g({...b,method:A})},[b,g,l]),N=h.useCallback($=>{l||g({...b,reference:$})},[b,g,l]),k=`${u}-method`,w=`${u}-reference`;return t.jsxs("div",{className:c.cn("flex flex-col gap-3",d),"data-testid":u,children:[t.jsx(rt,{id:k,label:f.methodLabel,labelPlacement:"outside",placeholder:f.methodPlaceholder,selectedKeys:b.method?[b.method]:[],onSelectionChange:y,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:s.map($=>t.jsx(c.SelectItem,{"data-testid":`${u}-method-option-${$.value}`,children:$.label},$.value))}),o&&t.jsx(c.Input,{id:w,label:f.referenceLabel,labelPlacement:"outside",type:"text",value:b.reference,onChange:$=>N($.target.value),placeholder:f.referencePlaceholder,isDisabled:l,variant:"bordered",radius:"lg","data-testid":`${u}-reference-input`})]})};xo.displayName="OtherTenderForm";const Fp={collectedHeading:"Collected",remainingLabel:"Remaining:",completeLabel:"Complete",removeAriaLabel:"Remove this tender",removeTooltipForRecorded:"Already recorded",statusPending:"Pending",statusRecorded:"Approved",statusFailed:"Failed"},_p={card:"lucide:credit-card",cash:"lucide:dollar-sign",check:"lucide:edit-3",other:"lucide:more-horizontal"},Rp={pending:"warning",recorded:"success",failed:"danger"},Mp=e=>e==="pending"||e==="recorded",Pp=e=>`#${e+1}`,po=({total:e,tenders:s,onRemove:n,locale:a="en-US",labels:r,hideCollectedList:i=!1,variant:o="banner",className:l,"data-testid":d="split-payment-summary"})=>{const u={...Fp,...r},{collected:f,remaining:m,isComplete:p}=h.useMemo(()=>{const b=s.reduce((g,y)=>Mp(y.status)?g+y.amount:g,0),v=Math.max(e.value-b,0);return{collected:b,remaining:v,isComplete:b>=e.value&&e.value>0}},[s,e.value]),x=b=>b==="pending"?u.statusPending:b==="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:xe(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:xe(p?f:m,a,e.currency)})]}),!i&&s.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}),s.map((b,v)=>t.jsx(Tp,{index:v,tender:b,locale:a,currency:e.currency,removable:!!n&&b.status!=="recorded",onRemove:n?()=>n(b.id):void 0,statusLabel:x(b.status),removeAriaLabel:u.removeAriaLabel,recordedTooltip:u.removeTooltipForRecorded,dataTestId:`${d}-row-${v}`},b.id))]})]})};po.displayName="SplitPaymentSummary";const Tp=({index:e,tender:s,locale:n,currency:a,removable:r,onRemove:i,statusLabel:o,removeAriaLabel:l,recordedTooltip:d,dataTestId:u})=>{const f=i?t.jsx(I,{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:Pp(e)}),t.jsx(P,{icon:_p[s.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:s.label}),t.jsx("span",{className:"font-semibold tabular-nums","data-testid":`${u}-amount`,children:xe(s.amount,n,a)}),t.jsx(c.Chip,{size:"sm",radius:"full",variant:"flat",color:Rp[s.status],startContent:s.status==="recorded"?t.jsx(P,{icon:"lucide:check-circle",width:14,height:14,"aria-hidden":"true"}):s.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})}))]})},Ip=`
|
|
15
|
+
${p?"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(te.ZoomIn,{size:16})})})]})}function ym({editor:e,isDisabled:s=!1}){const[n,a]=h.useState(!1),[r,i]=h.useState(""),[o,l]=h.useState(""),[d,u]=h.useState(!1),p=e.isActive("link"),m=f=>{if(f){const{from:b,to:v}=e.state.selection,g=e.isActive("link");let y="";if(g){const k=e.schema.marks.link,N=e.state.doc.resolve(b),$=Pa.getMarkRange(N,k);$&&(y=e.state.doc.textBetween($.from,$.to,""))}else y=e.state.doc.textBetween(b,v,"");const w=e.getAttributes("link").href||"";i(y),l(w),u(g)}a(f)},x=()=>{if(o.trim()){const{from:f,to:b}=e.state.selection,v=e.schema.marks.link,g=e.state.doc.resolve(f),y=Pa.getMarkRange(g,v),w=y?.from??f,k=y?.to??b,N=e.state.doc.textBetween(w,k,"");r.trim()&&r!==N?e.chain().focus().setTextSelection({from:w,to:k}).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:n,onOpenChange:m,placement:"bottom",children:[t.jsx(c.PopoverTrigger,{children:t.jsx(O,{size:"sm",radius:"sm",variant:p?"solid":"bordered",color:p?"primary":"default",isIconOnly:!0,isDisabled:s,"aria-label":"Link",children:t.jsx(te.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:f=>i(f.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:f=>l(f.target.value),onKeyDown:f=>f.key==="Enter"&&x(),classNames:{inputWrapper:"focus-within:border-default-400"}}),t.jsx(O,{size:"sm",color:"primary",onPress:x,isDisabled:!o.trim(),children:d?"Update":"Apply"})]})})]})}function vm({children:e,id:s,label:n,className:a,useButtonGroup:r=!0}){return r?t.jsx(c.ButtonGroup,{size:"sm",id:s,"aria-label":n,className:a,children:e}):t.jsx("div",{id:s,role:"group","aria-label":n,className:`flex items-center gap-2 ${a||""}`,children:e})}function Yi(e,s){const n=h.useMemo(()=>{if(!e)return{};const i={};return Array.from(new Set(s.map(l=>rs(l)))).forEach(l=>{const d=ft[l];if(d)try{const u=d.canExecute?.(e)??!0,p=d.isActive?.(e)??!1;i[l]={isActive:p,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,s]),[a,r]=h.useState(n);return h.useEffect(()=>{if(!e)return;const i=()=>{const o={};Array.from(new Set(s.map(d=>rs(d)))).forEach(d=>{const u=ft[d];if(u)try{const p=u.canExecute?.(e)??!0,m=u.isActive?.(e)??!1;o[d]={isActive:m,isDisabled:!p,canExecute:p}}catch(p){console.warn(`Extension not available for modifier: ${d}`,p),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,s,n]),a}function Qi(e,s){const n=h.useCallback((o,l)=>{if(!e)return;const d=ft[o];if(d)try{d.execute({editor:e,config:l}),s?.({type:"toggle",modifier:o})}catch(u){console.warn(`Failed to execute command for modifier: ${o}`,u)}},[e,s]),a=h.useCallback(o=>{n(o)},[n]),r=h.useCallback((o,l)=>{if(!e)return!1;const d=ft[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=ft[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:n,toggleModifier:a,canExecute:r,isActive:i}}function jm(e=Be.default){const[s,n]=h.useState(e),a=h.useCallback((l=Be.step)=>{n(d=>Math.min(Be.max,d+l))},[]),r=h.useCallback((l=Be.step)=>{n(d=>Math.max(Be.min,d-l))},[]),i=h.useCallback(()=>{n(Be.default)},[]),o=h.useCallback(l=>{const d=Math.max(Be.min,Math.min(Be.max,l));n(d)},[]);return{zoom:s,setZoom:o,zoomIn:a,zoomOut:r,resetZoom:i,isMinZoom:s<=Be.min,isMaxZoom:s>=Be.max,isDefaultZoom:s===Be.default}}const wm=["bold","italic","strike","underline","code"];function Nm({editor:e,modifiers:s,onToolbarAction:n}){const a=Yi(e,s),{toggleModifier:r}=Qi(e,n);if(!e)return null;const i=s.map(o=>rs(o)).filter(o=>wm.includes(o));return i.length===0?null:t.jsx(vm,{id:"text-formatting",label:"Text formatting",children:i.map(o=>{const l=a[o],d=Rt(o);return t.jsx(wt,{icon:d,label:o.charAt(0).toUpperCase()+o.slice(1),isActive:l?.isActive,isDisabled:l?.isDisabled,onClick:()=>r(o)},o)})})}function Cm({editor:e,modifiers:s,zoom:n=100,onZoomChange:a,sticky:r=!0,className:i,onToolbarAction:o}){const l=Yi(e,s),{toggleModifier:d,executeCommand:u}=Qi(e,o);if(!e)return null;const p=s.map(j=>rs(j)),m=p.some(j=>["bold","italic","strike","underline","code"].includes(j)),x=p.some(j=>["textColor","highlight"].includes(j)),f=p.includes("heading"),b=p.includes("textAlign"),v=p.some(j=>["bulletList","orderedList","taskList"].includes(j)),g=p.includes("blockquote"),y=p.includes("codeBlock"),w=p.includes("link"),k=p.includes("horizontalRule"),N=p.some(j=>["undo","redo"].includes(j)),$=n!==void 0&&a!==void 0,E=r?"sticky top-0 z-10":"";return t.jsx("div",{className:`w-full p-2 bg-background border-b border-divider ${E} ${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(Nm,{editor:e,modifiers:s,onToolbarAction:o}),(x||f||b||v||g||y||w||k||N||$)&&t.jsx(vt,{})]}),x&&t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"flex items-center gap-1",children:[p.includes("textColor")&&t.jsx(nr,{editor:e,type:"textColor",label:"Text color",isDisabled:l.textColor?.isDisabled}),p.includes("highlight")&&t.jsx(nr,{editor:e,type:"highlight",label:"Highlight",isDisabled:l.highlight?.isDisabled})]}),(f||b||v||g||y||w||k||N||$)&&t.jsx(vt,{})]}),f&&t.jsxs(t.Fragment,{children:[t.jsx(dm,{editor:e}),(b||v||g||y||w||k||N||$)&&t.jsx(vt,{})]}),b&&t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"flex items-center gap-1",children:["left","center","right","justify"].map(j=>{const L=hm[j],S=e.isActive({textAlign:j});return t.jsx(wt,{icon:L,label:`Align ${j}`,isActive:S,onClick:()=>u("textAlign",{type:"textAlign",alignment:j})},j)})}),(v||g||y||w||k||N||$)&&t.jsx(vt,{})]}),v&&t.jsxs(t.Fragment,{children:[t.jsx(um,{editor:e,types:p.filter(j=>["bulletList","orderedList","taskList"].includes(j))}),(g||y||w||k||N||$)&&t.jsx(vt,{})]}),(g||y||w||k)&&t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"flex items-center gap-1",children:[g&&t.jsx(wt,{icon:Rt("blockquote"),label:"Blockquote",isActive:l.blockquote?.isActive,isDisabled:l.blockquote?.isDisabled,onClick:()=>d("blockquote")}),y&&t.jsx(wt,{icon:Rt("codeBlock"),label:"Code block",isActive:l.codeBlock?.isActive,isDisabled:l.codeBlock?.isDisabled,onClick:()=>d("codeBlock")}),w&&t.jsx(ym,{editor:e,isDisabled:l.link?.isDisabled}),k&&t.jsx(wt,{icon:Rt("horizontalRule"),label:"Horizontal rule",onClick:()=>d("horizontalRule")})]}),(N||$)&&t.jsx(vt,{})]}),N&&t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"flex items-center gap-1",children:[p.includes("undo")&&t.jsx(wt,{icon:Rt("undo"),label:"Undo",isDisabled:l.undo?.isDisabled,onClick:()=>d("undo")}),p.includes("redo")&&t.jsx(wt,{icon:Rt("redo"),label:"Redo",isDisabled:l.redo?.isDisabled,onClick:()=>d("redo")})]}),$&&t.jsx(vt,{})]}),$&&t.jsx(gm,{zoom:n,onZoomChange:j=>{a?.(j),o?.({type:"zoom",modifier:`${j}%`})}})]})})}const Wt={bold:{category:"mark",extension:Rc.Bold,priority:100},italic:{category:"mark",extension:Mc.Italic,priority:100},strike:{category:"mark",extension:Pc.Strike,priority:100},underline:{category:"mark",extension:Tc.Underline,priority:100},code:{category:"mark",extension:Ic.Code,priority:100},textColor:{category:"mark",extension:Oc.Color,defaultOptions:{types:["textStyle","heading","paragraph","listItem","taskItem","blockquote"]},priority:90},highlight:{category:"mark",extension:Bc.Highlight,defaultOptions:{multicolor:!0},priority:90},link:{category:"mark",extension:zc.Link,defaultOptions:{autolink:!0,linkOnPaste:!0,openOnClick:!1,HTMLAttributes:{class:"text-primary underline cursor-pointer"}},priority:100},heading:{category:"node",extension:Uc.Heading,defaultOptions:{levels:[1,2,3,4,5,6]},priority:100},bulletList:{category:"node",extension:Wc.BulletList,defaultOptions:{HTMLAttributes:{class:"list-disc"}},priority:90},orderedList:{category:"node",extension:qc.OrderedList,defaultOptions:{HTMLAttributes:{class:"list-decimal"}},priority:90},taskList:{category:"node",extension:Gc.TaskList,defaultOptions:{HTMLAttributes:{class:"task-list"}},priority:90},codeBlock:{category:"node",extension:Qc.CodeBlock,priority:100},blockquote:{category:"node",extension:Zc.Blockquote,priority:100},horizontalRule:{category:"node",extension:Xc.HorizontalRule,priority:100},hardBreak:{category:"node",extension:Jc.HardBreak,priority:100},undo:{category:"extension",extension:Ta.History,priority:50},redo:{category:"extension",extension:Ta.History,priority:50},textAlign:{category:"extension",extension:ed.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}},km=[td.Document,sd.Text,Hc.Paragraph,Vc.TextStyle.configure({HTMLAttributes:{}}),Yc.ListItem.configure({HTMLAttributes:{}}),Kc.TaskItem.configure({nested:!0}),nd.Dropcursor,ad.Gapcursor];function Sm(e){const s=[],n=new Set,a=new Set;km.forEach(l=>{l&&(s.push(l),a.add(l.name))});const r=e.map(l=>rs(l)),i=new Set;return r.forEach(l=>{const d=Wt[l];d?.requiredExtensions&&d.requiredExtensions.forEach(u=>{i.add(u)})}),i.forEach(l=>{if(n.has(l))return;const d=Wt[l];if(!d||d.extension===null)return;const u=d.extension.name;if(a.has(u)){n.add(l);return}const p=d.defaultOptions?d.extension.configure(d.defaultOptions):d.extension;s.push(p),n.add(l),a.add(u)}),r.forEach(l=>{if(n.has(l))return;const d=Wt[l];if(!d){console.warn(`Extension config not found for modifier: ${l}`);return}if(d.extension===null){n.add(l);return}const u=d.extension.name;if(a.has(u)){n.add(l);return}const p=d.defaultOptions?d.extension.configure(d.defaultOptions):d.extension;s.push(p),n.add(l),a.add(u)}),s.sort((l,d)=>{const u=Object.values(Wt).find(f=>f?.extension?.name===l.name),p=Object.values(Wt).find(f=>f?.extension?.name===d.name),m=u?.priority??100;return(p?.priority??100)-m})}const Zi={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"]},$m={h1:`font-size: ${we.fontSize["4xl"]}; font-weight: ${we.fontWeight.semibold}; line-height: ${we.lineHeight.tight}; margin: ${be.md} 0 ${be.sm} 0;`,h2:`font-size: ${we.fontSize["2xl"]}; font-weight: ${we.fontWeight.semibold}; line-height: ${we.lineHeight.tight}; margin: ${be.md} 0 ${be.sm} 0;`,h3:`font-size: ${we.fontSize.xl}; font-weight: ${we.fontWeight.semibold}; line-height: ${we.lineHeight.tight}; margin: ${be.md} 0 ${be.sm} 0;`,h4:`font-size: ${we.fontSize.lg}; font-weight: ${we.fontWeight.semibold}; line-height: ${we.lineHeight.tight}; margin: ${be.md} 0 ${be.sm} 0;`,h5:`font-size: ${we.fontSize.base}; font-weight: ${we.fontWeight.semibold}; line-height: ${we.lineHeight.tight}; margin: ${be.md} 0 ${be.sm} 0;`,h6:`font-size: ${we.fontSize.sm}; font-weight: ${we.fontWeight.semibold}; line-height: ${we.lineHeight.tight}; margin: ${be.md} 0 ${be.sm} 0;`,p:`min-height: ${we.lineHeight.normal}em; margin: 0;`,ul:`list-style-type: disc; list-style-position: outside; padding-left: ${be.xl}; margin: ${be.md} 0;`,ol:`list-style-type: decimal; list-style-position: outside; padding-left: ${be.xl}; margin: ${be.md} 0;`,li:`display: list-item; margin: ${be.xs} 0;`,strong:`font-weight: ${we.fontWeight.bold};`,em:"font-style: italic;",s:"text-decoration: line-through;",u:"text-decoration: underline;",code:`background-color: ${Te.neutral.gray[100]}; border-radius: 0.4rem; font-size: ${we.fontSize.sm}; padding: 0.25em 0.3em; font-family: ${we.fontFamily.mono};`,pre:`background: ${Te.neutral.gray[800]}; border-radius: ${be.sm}; color: ${Te.neutral.gray[100]}; font-family: ${we.fontFamily.mono}; margin: ${be.lg} 0; padding: 0.75rem ${be.md}; overflow-x: auto;`,blockquote:`border-left: 3px solid ${Te.neutral.gray[300]}; margin: ${be.lg} 0; padding-left: ${be.md}; color: ${Te.neutral.gray[500]};`,hr:`border: none; border-top: 1px solid ${Te.neutral.gray[200]}; margin: ${be.xl} 0;`,a:`color: ${Te.brand.primary.DEFAULT}; text-decoration: underline; cursor: pointer;`,mark:`background-color: ${Te.palettes.warning[200]}; border-radius: ${be.xs}; padding: 0 0.125rem;`,label:`display: flex; align-items: center; gap: ${be.sm}; cursor: pointer;`,input:"cursor: pointer; margin: 0;"},Am={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 Dm(e){if(!e)return e;let s=e;for(const[n,a]of Object.entries(Am)){const r=new RegExp(`(<(?:ul|li)[^>]*data-type="${n}"[^>]*)>`,"gi");s=s.replace(r,(i,o)=>i.includes('style="')?i.replace(/style="([^"]*)"/,`style="$1 ${a}"`):`${o} style="${a}">`)}for(const[n,a]of Object.entries($m)){const r=new RegExp(`<${n}(\\s[^>]*)?>`,"gi");s=s.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 s}const Em=({modifiers:e,zoom:s,onZoomChange:n,onToolbarAction:a})=>{const{editor:r}=Bn.useCurrentEditor();return t.jsx(Cm,{editor:r,modifiers:e,zoom:s,onZoomChange:n,onToolbarAction:a})},Lm=({showCharacterCount:e,showWordCount:s})=>{const{editor:n}=Bn.useCurrentEditor();if(!n||!e&&!s)return null;const a=n.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"]}),s&&t.jsxs("span",{children:[i," words"]})]})},Dn=h.forwardRef((e,s)=>{const{minRows:n=10,maxRows:a=30,disableAutosize:r=!1,showCharacterCount:i=!1,showWordCount:o=!1,showToolbar:l=!0,modifiers:d=Zi.full,variant:u="bordered",initialContent:p,content:m,onContentChange:x,onUpdate:f,onToolbarAction:b,isReadOnly:v=!1,isDisabled:g=!1,includeInlineStyles:y=!0,...w}=e,{zoom:k,setZoom:N}=jm(),$=sr.lineHeight,E=n*$,j=r?void 0:a*$,L=h.useMemo(()=>Sm(d),[d]),{Component:S,label:M,shouldLabelBeOutside:D,getBaseProps:A,getLabelProps:R,getInputWrapperProps:T}=c.useInput({...w,variant:u,ref:s,isMultiline:!0}),U=M?t.jsx("label",{...R(),children:M}):null,G=h.useCallback(({editor:I})=>{const se=I.getHTML(),q=y?Dm(se):se,Q=I.getJSON(),Y=I.getText(),ce=Y.length,ne=Y.split(/\s+/).filter(ie=>ie.length>0).length,X={html:q,json:Q,text:Y,characters:ce,words:ne};if(x?.(X),f?.(X),"onChange"in w&&typeof w.onChange=="function"){const ie={target:{value:q},currentTarget:{value:q}};w.onChange(ie)}},[x,f,w,y]);return t.jsxs(S,{...A(),children:[D?U:null,t.jsx("div",{...T(),className:c.cn(T().className,"flex flex-col w-full p-0 gap-0 rich-text-editor"),style:{maxHeight:j?`${j+sr.toolbarHeight}px`:void 0,overflow:j?"auto":void 0},children:t.jsx(Bn.EditorProvider,{editable:!v&&!g,slotBefore:l?t.jsx(Em,{modifiers:d,zoom:k,onZoomChange:N,onToolbarAction:b}):void 0,slotAfter:t.jsx(Lm,{showCharacterCount:i,showWordCount:o}),editorContainerProps:{className:"w-full flex-1 outline-none",style:{minHeight:`${E}px`,fontSize:`${k}%`,display:"flex",flexDirection:"column"}},editorProps:{attributes:{class:"focus:outline-none w-full h-full"}},extensions:L,content:m||p||e.defaultValue||"",onUpdate:G})})]})});Dn.displayName="TipTapEditor";const Xi=h.forwardRef((e,s)=>{const{adapter:n="tiptap",variant:a="bordered",...r}=e;return n==="tiptap"?t.jsx(Dn,{...r,variant:a,ref:s}):(console.warn(`Adapter "${n}" is not supported. Using TipTap.`),t.jsx(Dn,{...r,variant:a,ref:s}))});Xi.displayName="RichTextArea";function ar(e,s="en-US",n="USD",a=!0){try{return new Intl.NumberFormat(s,a?{style:"currency",currency:n,minimumFractionDigits:0,maximumFractionDigits:2}:{style:"currency",currency:n}).format(e)}catch(r){return console.warn(`Invalid currency formatting: ${r}`),`${n} ${e.toFixed(2)}`}}function Fm(e="en-US",s="USD"){try{const n=new Intl.NumberFormat(e,{style:"currency",currency:s,currencyDisplay:"symbol"}),a=n.formatToParts(1),r=a.findIndex(d=>d.type==="currency"),i=a.findIndex(d=>d.type==="integer"),{minimumFractionDigits:o,maximumFractionDigits:l}=n.resolvedOptions();return{symbol:a[r]?.value??s,position:r>i?"end":"start",formatOptions:{style:"decimal",minimumFractionDigits:o,maximumFractionDigits:l}}}catch(n){return console.warn(`Invalid currency formatting: ${n}`),{symbol:s,position:"start",formatOptions:{style:"decimal",minimumFractionDigits:2,maximumFractionDigits:2}}}}const rr=`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`,ir=`border bg-white shadow-none ${ke}`,_m={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:`${rr} 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:`${ir} 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:`${rr} 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:`${ir} 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"}},At={row:"flex flex-wrap gap-2",preset:"w-auto flex-[1_1_4.5rem] min-h-12 py-0",field:"flex-[2_1_10rem] min-w-0",inputWrapper:"h-12 min-h-12",input:"text-[0.9375rem] data-[has-start-content=true]:ps-1 data-[has-end-content=true]:pe-1",affix:"shrink-0 text-sm text-pos-neutral"},Rm={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"}}},lr=[{id:"100",amount:100},{id:"250",amount:250},{id:"500",amount:500},{id:"1000",amount:1e3},{id:"2000",amount:2e3}],Mm={title:"Donation Amount",customAmountPlaceholder:"Custom donation amount",customAmountAriaLabel:"Custom donation amount",addDonationButton:"Add Donation",presetsAriaLabel:"Suggested amounts"},Ji=({presetAmounts:e=lr,selectedDonation:s,defaultSelectedDonation:n=null,onChange:a,onAddDonation:r,currency:i="USD",locale:o="en-US",showCustomAmount:l=!0,minCustomAmount:d=.5,maxCustomAmount:u=1e6,labels:p,mobileColumns:m=2,desktopColumns:x=3,isDisabled:f=!1,buttonVariant:b="bordered",buttonColor:v="default",inputVariant:g="bordered",size:y="md",className:w="",showCard:k=!0,variant:N="pill",customAmountPlacement:$="below",isRequired:E=!1})=>{const j={...Mm,...p},L=h.useId(),S=`${L}-title`,M=`${L}-custom`,D=Array.isArray(e)?e:lr,A={2:"grid-cols-2",3:"grid-cols-3"},R={3:"sm:grid-cols-3",4:"sm:grid-cols-4",5:"sm:grid-cols-5",6:"sm:grid-cols-6"},T=`${A[m]} ${R[x]}`,[U,G]=It(s,n,a),[I,se]=h.useState(""),[q,Q]=h.useState(!1),[Y,ce]=h.useState(0),ne=h.useCallback(ae=>{if(f)return;const je={amount:ae.amount,isCustom:!1,presetId:ae.id};G(je),se(""),Q(!1),ce(_e=>_e+1),r?.(je)},[f,G,r]),X=h.useCallback(ae=>{if(f)return;if(se(ae!==void 0?String(ae):""),r){G(null);return}if(Q(!1),ae===void 0||isNaN(ae)){G(null);return}G({amount:ae,isCustom:!0})},[f,G,r]),ie=h.useCallback(()=>{if(f)return;const ae=I!==""?parseFloat(I):void 0;ae===void 0||isNaN(ae)||r?.({amount:ae,isCustom:!0})},[f,I,r]),V=h.useMemo(()=>({style:"currency",currency:i,currencyDisplay:"symbol"}),[i]),z=h.useMemo(()=>Fm(o,i),[o,i]),Z=ae=>U!==null&&!U.isCustom&&U.presetId===ae.id,Ie=(ae,je)=>{const _e=U?.isCustom===!0,et=!r&&q,ge=N==="tile"&&$==="inline",Re=ge?t.jsx("span",{className:At.affix,"data-testid":"donation-amounts-custom-symbol",children:z.symbol}):void 0,ue=t.jsxs("div",{className:c.cn("flex items-start gap-3",ge&&At.field),"data-testid":"donation-amounts-custom-field",children:[t.jsx(c.NumberInput,{id:M,placeholder:j.customAmountPlaceholder,"aria-label":ge?j.customAmountLabel??j.customAmountAriaLabel:j.customAmountLabel?void 0:j.customAmountAriaLabel,onInput:r?()=>{G(null),Q(!0)}:()=>Q(!0),onBlur:r?void 0:()=>Q(!1),variant:"bordered",minValue:d,maxValue:u,step:.01,formatOptions:ge?z.formatOptions:V,startContent:z.position==="start"?Re:void 0,endContent:z.position==="end"?Re:void 0,value:I!==""?parseFloat(I):void 0,onValueChange:X,isDisabled:f,className:"flex-1",classNames:{inputWrapper:c.cn(ae.inputWrapper,je.wrapper,ge&&At.inputWrapper,(_e||et)&&ae.inputWrapperActive),input:c.cn(ae.input,je.input,ge&&At.input)},"data-testid":"donation-amounts-custom-input",hideStepper:!0},r?`custom-${Y}`:U?.isCustom===!1?U.presetId:"custom"),r&&t.jsx(O,{color:"primary",variant:"solid",size:y,className:"shrink-0",onPress:ie,isDisabled:f||!q,"data-testid":"donation-amounts-add-button",children:j.addDonationButton})]}),ye=l&&(ge?ue:t.jsxs("div",{className:c.cn("flex flex-col",ae.inputBase),children:[j.customAmountLabel&&t.jsx("label",{htmlFor:M,className:ae.customLabel,"data-testid":"donation-amounts-custom-label",children:j.customAmountLabel}),ue]}));return t.jsxs("div",{className:ae.root,"data-testid":"donation-amounts-root","data-variant":N,"data-custom-placement":ge?"inline":void 0,children:[j.eyebrow&&t.jsx("p",{className:ae.eyebrow,"data-testid":"donation-amounts-eyebrow",children:j.eyebrow}),j.title&&t.jsxs("p",{id:S,className:ae.title,"data-testid":"donation-amounts-title",children:[j.title,E&&t.jsx("span",{"aria-hidden":"true",className:"ml-0.5 text-pos-danger",children:"*"})]}),j.caption&&t.jsx("p",{className:ae.caption,"data-testid":"donation-amounts-caption",children:j.caption}),(D.length>0||ge&&ye)&&t.jsxs("div",{role:"group","aria-labelledby":j.title?S:void 0,"aria-label":j.title?void 0:j.presetsAriaLabel,className:ge?At.row:c.cn(ae.grid,N==="tile"&&T),"data-testid":"donation-amounts-presets",children:[D.map(J=>{const C=Z(J)&&!et;return t.jsxs(O,{color:"default",variant:"bordered",disableRipple:!0,"aria-pressed":C,className:c.cn(ae.preset,ge&&At.preset,C?ae.presetSelected:ae.presetIdle),onPress:()=>ne(J),isDisabled:f,"data-selected":C||void 0,"data-testid":`donation-amounts-preset-${J.id}`,children:[t.jsx("span",{className:c.cn(ae.amount,C&&ae.amountSelected),children:J.label||ar(J.amount,o,i,N!=="pos")}),J.sublabel&&" ",J.sublabel&&t.jsx("span",{className:ae.sublabel,"data-testid":`donation-amounts-preset-${J.id}-sublabel`,children:J.sublabel})]},J.id)}),ge&&ye]}),!ge&&ye]})},Le=t.jsxs("div",{className:"space-y-4","data-testid":"donation-amounts-root",children:[j.title&&t.jsx("h2",{id:S,className:"text-base font-semibold","data-testid":"donation-amounts-title",children:j.title}),D.length>0&&t.jsx("div",{role:"group","aria-labelledby":j.title?S:void 0,"aria-label":j.title?void 0:j.presetsAriaLabel,className:c.cn("grid gap-3",T),"data-testid":"donation-amounts-presets",children:D.map(ae=>{const je=U!==null&&!U.isCustom&&U.presetId===ae.id;return t.jsx(O,{color:je?"primary":v,variant:je?"solid":b,className:"w-full","aria-pressed":je,onPress:()=>ne(ae),isDisabled:f,"data-testid":`donation-amounts-preset-${ae.id}`,children:ae.label||ar(ae.amount,o,i)},ae.id)})}),l&&t.jsxs("div",{className:"flex gap-3 items-start",children:[t.jsx(c.NumberInput,{placeholder:j.customAmountPlaceholder,"aria-label":j.customAmountAriaLabel,onInput:r?()=>{G(null),Q(!0)}:void 0,variant:g,radius:"full",size:y,minValue:d,maxValue:u,step:.01,formatOptions:V,value:I!==""?parseFloat(I):void 0,onValueChange:X,isDisabled:f,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-${Y}`:U?.isCustom===!1?U.presetId:"custom"),r&&t.jsx(O,{color:"primary",variant:"solid",radius:"full",size:y,className:"shrink-0",onPress:ie,isDisabled:f||!q,"data-testid":"donation-amounts-add-button",children:j.addDonationButton})]})]}),Fe=N==="pill"?Le:Ie(_m[N],Rm[N][y]);return k?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})};Ji.displayName="DonationAmounts";const Pm=e=>{const s=Math.max(0,e),n=Math.floor(s/60).toString().padStart(2,"0"),a=(s%60).toString().padStart(2,"0");return`${n}:${a} minutes`},Tm=e=>{switch(e){case"warning":return te.Clock;case"error":return te.AlertCircle;case"success":return te.CheckCircle;default:return te.Clock}},Im=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"}},el=h.forwardRef(({timeLeft:e,defaultTimeLeft:s=1200,onTimeChange:n,onExpire:a,variant:r="info",color:i="primary",message:o="Your cart expires in:",showIcon:l=!0,icon:d,position:u="fixed",autoStart:p=!0,formatTime:m=Pm,className:x,...f},b)=>{const[v,g]=It(e!==void 0?Math.max(0,e):void 0,Math.max(0,s),n),y=h.useRef(null),w=h.useRef(!1);h.useEffect(()=>()=>{y.current&&clearInterval(y.current)},[]),h.useEffect(()=>{if(!p||v<=0){y.current&&(clearInterval(y.current),y.current=null);return}return y.current=setInterval(()=>{g(E=>E<=1?(y.current&&(clearInterval(y.current),y.current=null),w.current||(w.current=!0,a?.()),0):E-1)},1e3),()=>{y.current&&(clearInterval(y.current),y.current=null)}},[p,v,g,a]),h.useEffect(()=>{v>0&&(w.current=!1)},[v]);const k=d||Tm(r),N=Im(i),$={fixed:"fixed top-0 left-0",sticky:"sticky top-0",static:"static"};return t.jsx("div",{ref:b,role:"banner","aria-live":"polite","aria-label":`${o} ${m(v)}`,"data-testid":"expire-cart-timer",className:c.cn("w-full text-white z-50",N,$[u],x),...f,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(k,{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(v)}`,"data-testid":"expire-cart-timer-value",children:m(v)})})]})})})});el.displayName="ExpireCartTimer";const Dt=({icon:e,children:s,testId:n})=>t.jsxs("div",{className:"flex items-center gap-2 text-sm text-gray-600","data-testid":n,children:[t.jsx(P,{icon:e,width:20,className:"text-default-500"}),t.jsx("span",{children:s})]}),Om=({classes:e="",name:s,imageUrl:n,eventDate:a,eventTime:r,location:i,description:o,showImage:l=!1,compact:d=!1,layout:u="stacked",imageLoading:p="eager",showMoreButtonClassName:m,labels:x})=>{const[f,b]=h.useState(!1),[v,g]=h.useState(!1),y=h.useRef(null);return h.useEffect(()=>{const w=()=>{if(y.current){const k=y.current.scrollHeight>y.current.clientHeight;g(k)}};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&&n&&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:p,alt:`Event image for ${s}`,className:"w-full h-full object-cover object-center",src:n,"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:s}),t.jsx("h3",{className:"font-semibold text-base text-gray-700","data-testid":"event-details-info-label",children:x.eventInformation}),t.jsxs("div",{className:"flex flex-wrap gap-4","data-testid":"event-details-info",children:[a&&t.jsx(Dt,{icon:"solar:calendar-minimalistic-linear",testId:"event-details-date",children:a}),r&&t.jsx(Dt,{icon:"solar:clock-circle-linear",testId:"event-details-time",children:r}),i&&t.jsx(Dt,{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:y,className:c.cn("text-sm text-gray-700 leading-relaxed transition-all",!f&&"line-clamp-3"),"data-testid":"event-details-description",dangerouslySetInnerHTML:{__html:o}}),!f&&v&&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"})]}),(v||f)&&t.jsx("div",{className:"flex justify-end mt-1",children:t.jsx(O,{onPress:()=>b(!f),variant:"light",className:c.cn("text-primary",m),size:"md",startContent:t.jsx(P,{icon:f?"solar:eye-closed-linear":"solar:eye-linear",width:20}),"data-testid":"event-details-toggle-description",children:f?x.showLess||"Hide":x.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&&n&&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:p,alt:`Event image for ${s}`,className:"w-full h-full object-cover object-center",src:n,"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:s})]}),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:x.eventInformation}),t.jsxs("div",{className:"flex flex-wrap gap-4","data-testid":"event-details-info",children:[a&&t.jsx(Dt,{icon:"solar:calendar-minimalistic-linear",testId:"event-details-date",children:a}),r&&t.jsx(Dt,{icon:"solar:clock-circle-linear",testId:"event-details-time",children:r}),i&&t.jsx(Dt,{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:y,className:c.cn("text-sm text-gray-700 leading-relaxed transition-all",d?"text-xs":"",!f&&"line-clamp-3"),"data-testid":"event-details-description",dangerouslySetInnerHTML:{__html:o}}),!f&&v&&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"})]}),(v||f)&&t.jsx("div",{className:"flex justify-end mt-1",children:t.jsx(O,{onPress:()=>b(!f),variant:"light",className:c.cn("text-primary",m),size:d?"sm":"md",startContent:t.jsx(P,{icon:f?"solar:eye-closed-linear":"solar:eye-linear",width:d?16:20}),"data-testid":"event-details-toggle-description",children:f?x.showLess||"Hide":x.showMore||"Show"})})]})]})]})};function En(e,s="en-US",n="USD"){try{return new Intl.NumberFormat(s,{style:"currency",currency:n,minimumFractionDigits:2,maximumFractionDigits:2}).format(e)}catch(a){return console.warn(`Invalid currency formatting: ${a}`),`${n} ${e.toFixed(2)}`}}function Bm(e){const s=e.replace(/[^\d.,-]/g,""),n=s.match(/,\d{1,2}$/);let a;n?a=s.replace(/\./g,"").replace(",","."):a=s.replace(/,/g,"");const r=parseFloat(a);return isNaN(r)?null:r}const zm={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"},Et=e=>typeof e=="number"&&!isNaN(e),Ds=({offer:e,quantity:s,defaultQuantity:n=0,onQuantityChange:a,currency:r="USD",locale:i="en-US",labels:o,slots:l,isDisabled:d=!1,buttonVariant:u="bordered",buttonColor:p="default",showCard:m=!0,showDescription:x=!0,showPeopleCount:f=!0,showPrice:b=!0,priceDisplay:v,classNames:g={},"data-testid":y,selectedColor:w="default",selectionMode:k="stepper",compact:N=!1,isSoldOut:$,isMaxReached:E,isRuleBlocked:j,statusTone:L="default",statusLabel:S,disabledReason:M,disabled:D})=>{const A=h.useMemo(()=>({...zm,...o}),[o]),[R,T]=h.useState(n),U=s!==void 0?s:R,G=!!(d||D),I=N||!!e.compact,se=k==="press-to-add",q=h.useMemo(()=>typeof $=="boolean"?$:typeof e.isSoldOut=="boolean"?e.isSoldOut:!Et(e.totalTicketsSold)||!Et(e.ticketsAllowed)?!1:e.totalTicketsSold>=e.ticketsAllowed,[$,e.isSoldOut,e.totalTicketsSold,e.ticketsAllowed]),Q=h.useMemo(()=>typeof E=="boolean"?E:typeof e.isMaxReached=="boolean"?e.isMaxReached:q||!Et(e.ticketsAllowed)?!1:U>=e.ticketsAllowed-(e.totalTicketsSold??0),[E,e.isMaxReached,q,e.ticketsAllowed,e.totalTicketsSold,U]),Y=h.useMemo(()=>typeof j=="boolean"?j:typeof e.isRuleBlocked=="boolean"?e.isRuleBlocked:!1,[j,e.isRuleBlocked]),ce=M||e.disabledReason,ne=G||q||Y,X=ue=>{if(ne||ue>0&&Q)return;const ye=Math.max(0,U+ue);s===void 0&&T(ye),a?.(e.id,ye)},ie=h.useMemo(()=>{if(q)return"soldOut";if(Y)return"ruleBlocked";if(G)return"disabled"},[q,Y,G]),V=h.useMemo(()=>L||(q||Y?"danger":Q?"warning":"default"),[L,q,Y,Q]),z=h.useMemo(()=>{if(ie)return ie==="ruleBlocked"?S||ce||A.ruleBlocked:ie==="soldOut"?S||ce||A.soldOut:ie==="disabled"?S||ce||A.disabled:S||A.maxReached},[ie,S,ce,A]),Z={soldOut:"danger",ruleBlocked:V,disabled:"default",maxReached:"warning"},Ie={soldOut:"offer-card-sold-out-chip",maxReached:"offer-card-max-reached-chip",ruleBlocked:"offer-card-ruleBlocked-chip",disabled:"offer-card-disabled-chip"},Le=()=>l?.renderName?l.renderName(e.name,e):t.jsx("h2",{"data-testid":"offer-card-name",className:c.cn("text-base font-medium",I&&"text-sm",g.name),children:e.name}),Fe=()=>{if(!b)return null;const ue=v?.price??e.price,ye=v?.originalPrice,J=En(ue,i,r);if(l?.renderPrice)return l.renderPrice(ue,J,e);if(Et(ye)&&Et(ue)&&ye>ue){const F=En(ye,i,r);return t.jsxs("div",{"data-testid":"offer-card-price",className:c.cn("flex items-center gap-2 mt-1",I&&"mt-0.5",g.price),children:[t.jsxs("span",{className:"sr-only",children:["Original price ",F,", discounted price ",J]}),t.jsx("span",{"aria-hidden":"true","data-testid":"offer-card-original-price",className:c.cn("text-gray-400 line-through text-sm",I&&"text-xs",g.originalPrice),children:F}),t.jsx("span",{"aria-hidden":"true","data-testid":"offer-card-discounted-price",className:c.cn("text-primary text-base font-semibold",I&&"text-sm",g.discountedPrice),children:J})]})}return t.jsx("p",{"data-testid":"offer-card-price",className:c.cn("text-primary text-base mt-1",I&&"text-sm mt-0.5",g.price),children:J})},ae=()=>!x||!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",I&&"mb-2 text-xs text-gray-600",g.description),children:e.description}),je=()=>{if(!f||!Et(e.numberOfPeople)||e.numberOfPeople<=0)return null;const ue=e.numberOfPeople===1?A.person:A.people;return l?.renderPeopleCount?l.renderPeopleCount(e.numberOfPeople,ue,e):t.jsxs("p",{"data-testid":"offer-card-people-count",className:c.cn("text-sm text-gray-600 flex items-center mt-2",I&&"mt-1 text-xs",g.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," ",ue]})},_e=()=>{const ue=U===0||ne,ye=Q||ne;return l?.renderQuantitySelector?l.renderQuantitySelector({quantity:U,onIncrement:()=>X(1),onDecrement:()=>X(-1),isDecrementDisabled:ue,isIncrementDisabled:ye,isDisabled:ne}):t.jsxs("div",{className:c.cn("flex items-center gap-2",g.quantitySelector),children:[t.jsx(O,{"data-testid":"offer-card-decrement-button",onPress:()=>X(-1),isDisabled:ue,variant:u,color:U>0?w:p,radius:"full",isIconOnly:!0,size:I?"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",I&&"text-sm"),children:U}),t.jsx(O,{"data-testid":"offer-card-increment-button",onPress:()=>X(1),isDisabled:ye,variant:u,color:U>0?w:p,radius:"full",isIconOnly:!0,size:I?"md":"sm","aria-label":"Increase quantity",children:t.jsx(P,{icon:"gravity-ui:plus",width:16})})]})},et=(ue,ye)=>l?.renderDisabledState?l.renderDisabledState(ue,ye):ue==="soldOut"&&l?.renderSoldOut?l.renderSoldOut(ye):ue==="maxReached"&&l?.renderMaxReachedAlert?l.renderMaxReachedAlert(ye):t.jsx(c.Chip,{"data-testid":Ie[ue],color:Z[ue],variant:ue==="maxReached"?"flat":"solid",className:c.cn("gap-2 px-4",ue==="maxReached"?"h-8":"h-10",ue==="soldOut"&&g.soldOut,ue==="maxReached"&&g.maxReachedAlert,I&&"h-8"),startContent:t.jsx(P,{icon:"gravity-ui:triangle-exclamation-fill",width:14}),children:t.jsx("span",{className:"font-medium text-sm",children:ye})}),ge=t.jsxs("div",{className:c.cn("grid grid-cols-1 md:grid-cols-1 xl:grid-cols-3 lg:grid-cols-3 items-start",I?"gap-1":"gap-2"),children:[t.jsxs("div",{className:c.cn("h-full col-span-2",ne||Q?"opacity-50 pointer-events-none select-none":""),children:[Le(),Fe(),t.jsxs("div",{className:c.cn("md:col-span-1 xl:col-span-2 lg:col-span-1",I?"mb-1":"mb-2"),children:[je(),ae()]})]}),!se&&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",I&&"space-x-1 pb-1 md:p-1",g.compactFooter),children:ie&&z?et(ie,z):_e()})]}),Re=Q&&!q&&!Y&&!G?t.jsx(We.motion.div,{className:c.cn("w-full sm:max-w-[60%] md:max-w-[60%] lg:max-w-[60%]",g.compactFooter),initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:10},transition:{duration:.3},children:et("maxReached",z||A.maxReached)}):null;return m?t.jsxs(c.Card,{className:c.cn("w-full",se&&!ne&&!Q&&"cursor-pointer",I&&g.compact,g.base),"data-testid":y||`offer-card-${e.id}`,isPressable:se&&!ne&&!Q,onPress:se&&!ne&&!Q?()=>X(1):void 0,children:[t.jsx(c.CardBody,{className:c.cn("pt-1 pb-0",I?"pb-0.5":"",g.body),children:ge}),t.jsx(We.AnimatePresence,{children:Re&&t.jsx(c.CardFooter,{className:c.cn("w-full mt-0 pt-0",I?"pt-1":"",g.footer),children:Re})})]}):t.jsxs("div",{className:c.cn("w-full",I&&g.compact,g.base),"data-testid":y||`offer-card-${e.id}`,children:[t.jsx("div",{className:c.cn("pt-1 pb-0",I?"pb-0.5":"",g.body),children:ge}),t.jsx(We.AnimatePresence,{children:Re&&t.jsx("div",{className:c.cn("w-full mt-0 pt-0",I?"pt-1":"",g.footer),children:Re})})]})};Ds.displayName="OfferCard";const tl=({message:e="No offers available.",icon:s="solar:ticket-sale-outline",iconSize:n=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:s,width:n,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})};tl.displayName="OfferCardEmpty";const Vm={title:"Error Fetching Offers",description:"An error occurred while fetching offers."},sl=({error:e,labels:s,showCard:n=!0,color:a="danger",classNames:r={}})=>{const i={...Vm,...s},o=t.jsx(c.Alert,{"data-testid":"offer-card-error-alert",color:a,title:i.title,description:e||i.description,className:r.alert});return n?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})};sl.displayName="OfferCardError";const Um={1:"space-y-1",2:"space-y-2",3:"space-y-3",4:"space-y-4",5:"space-y-5",6:"space-y-6"},nl=({quantity:e=2,gap:s=4,classNames:n={}})=>{const a=Um[s];return t.jsx("div",{"data-testid":"offer-card-skeleton-container",className:c.cn(a,n.base),children:Array.from({length:e}).map((r,i)=>t.jsxs(c.Card,{"data-testid":`offer-card-skeleton-${i}`,className:c.cn("w-full",n.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(oe,{"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(oe,{"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(oe,{"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(oe,{"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(oe,{"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(oe,{"data-testid":`offer-card-skeleton-btn-dec-${i}`,className:"w-8 h-8 rounded-md bg-default-300"}),t.jsx(oe,{"data-testid":`offer-card-skeleton-btn-qty-${i}`,className:"w-8 h-8 rounded-md bg-default-200"}),t.jsx(oe,{"data-testid":`offer-card-skeleton-btn-inc-${i}`,className:"w-8 h-8 rounded-md bg-default-300"})]})]})})]})})]},i))})};nl.displayName="OfferCardSkeleton";const al={hidden:{opacity:0},show:{opacity:1,transition:{staggerChildren:.15,delayChildren:.1}}},rl={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"}}},Hm={1:"gap-1",2:"gap-2",3:"gap-3",4:"gap-4",5:"gap-5",6:"gap-6"},il=({offers:e=[],mapOffer:s,selection:n,defaultSelection:a={},onSelectionChange:r,onQuantityChange:i,currency:o="USD",locale:l="en-US",labels:d,slots:u,isDisabled:p=!1,buttonVariant:m="bordered",buttonColor:x="default",showCard:f=!0,animated:b=!0,gap:v=2,compact:g=!1,classNames:y={}})=>{const[w,k]=h.useState(a),N=n!==void 0?n:w,$=h.useCallback((D,A)=>{const R={...N,[D]:Math.max(0,A)};n===void 0&&k(R),r?.(R),i?.(D,R[D])},[N,n,r,i]),E=[...e].sort((D,A)=>(D.position??0)-(A.position??0)),j=D=>{const A=s?s(D):D,R=(N??{})[A.id]||0;return{offer:A,quantity:R,onQuantityChange:$,currency:o,locale:l,labels:d,slots:u,isDisabled:p,buttonVariant:m,buttonColor:x,showCard:f,compact:g}},L=Hm[v],S=c.cn("grid mx-auto pt-2",L,y.base),M=D=>{const A=j(D);return t.jsx(Ds,{offer:A.offer,quantity:A.quantity,onQuantityChange:A.onQuantityChange,currency:A.currency,locale:A.locale,labels:A.labels,slots:A.slots,isDisabled:A.isDisabled,buttonVariant:A.buttonVariant,buttonColor:A.buttonColor,showCard:A.showCard,compact:A.compact,classNames:y.card},A.offer.id)};return b?t.jsx(We.motion.div,{"data-testid":"offer-card-list",className:S,variants:al,initial:"hidden",animate:"show",children:t.jsx(We.AnimatePresence,{children:E.map(D=>{const A=j(D);return t.jsx(We.motion.div,{"data-testid":`offer-card-list-item-${A.offer.id}`,className:y.cardWrapper,variants:rl,exit:{opacity:0,y:-20},transition:{duration:.3},children:t.jsx(Ds,{offer:A.offer,quantity:A.quantity,onQuantityChange:$,currency:o,locale:l,labels:d,slots:u,isDisabled:p,buttonVariant:m,buttonColor:x,showCard:f,compact:g||A.offer.compact,classNames:y.card})},A.offer.id)})})}):t.jsx("div",{"data-testid":"offer-card-list",className:S,children:E.map(M)})};il.displayName="OfferCardList";var cs=e=>e.type==="checkbox",Ct=e=>e instanceof Date,Ke=e=>e==null;const ll=e=>typeof e=="object";var Ee=e=>!Ke(e)&&!Array.isArray(e)&&ll(e)&&!Ct(e),ol=e=>Ee(e)&&e.target?cs(e.target)?e.target.checked:e.target.value:e,Wm=e=>e.substring(0,e.search(/\.\d+(\.|$)/))||e,cl=(e,s)=>e.has(Wm(s)),qm=e=>{const s=e.constructor&&e.constructor.prototype;return Ee(s)&&s.hasOwnProperty("isPrototypeOf")},Jn=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function $e(e){if(e instanceof Date)return new Date(e);const s=typeof FileList<"u"&&e instanceof FileList;if(Jn&&(e instanceof Blob||s))return e;const n=Array.isArray(e);if(!n&&!(Ee(e)&&qm(e)))return e;const a=n?[]:Object.create(Object.getPrototypeOf(e));for(const r in e)Object.prototype.hasOwnProperty.call(e,r)&&(a[r]=$e(e[r]));return a}var Us=e=>/^\w*$/.test(e),ve=e=>e===void 0,ea=e=>Array.isArray(e)?e.filter(Boolean):[],ta=e=>ea(e.replace(/["|']|\]/g,"").split(/\.|\[/)),K=(e,s,n)=>{if(!s||!Ee(e))return n;const a=(Us(s)?[s]:ta(s)).reduce((r,i)=>Ke(r)?r:r[i],e);return ve(a)||a===e?ve(e[s])?n:e[s]:a},Qe=e=>typeof e=="boolean",He=e=>typeof e=="function",he=(e,s,n)=>{let a=-1;const r=Us(s)?[s]:ta(s),i=r.length,o=i-1;for(;++a<i;){const l=r[a];let d=n;if(a!==o){const u=e[l];d=Ee(u)||Array.isArray(u)?u:isNaN(+r[a+1])?{}:[]}if(l==="__proto__"||l==="constructor"||l==="prototype")return;e[l]=d,e=e[l]}};const Es={BLUR:"blur",FOCUS_OUT:"focusout",CHANGE:"change"},at={onBlur:"onBlur",onChange:"onChange",onSubmit:"onSubmit",onTouched:"onTouched",all:"all"},ct={max:"max",min:"min",maxLength:"maxLength",minLength:"minLength",pattern:"pattern",required:"required",validate:"validate"},dl=h.createContext(null);dl.displayName="HookFormControlContext";const sa=()=>h.useContext(dl);var ul=(e,s,n,a=!0)=>{const r={defaultValues:s._defaultValues};for(const i in e)Object.defineProperty(r,i,{get:()=>{const o=i;return s._proxyFormState[o]!==at.all&&(s._proxyFormState[o]=!a||at.all),n&&(n[o]=!0),e[o]}});return r};const na=typeof window<"u"?h.useLayoutEffect:h.useEffect;function Gm(e){const s=sa(),{control:n=s,disabled:a,name:r,exact:i}=e||{},[o,l]=h.useState(n._formState),d=h.useRef({isDirty:!1,isLoading:!1,dirtyFields:!1,touchedFields:!1,validatingFields:!1,isValidating:!1,isValid:!1,errors:!1});return na(()=>n._subscribe({name:r,formState:d.current,exact:i,callback:u=>{!a&&l({...n._formState,...u})}}),[r,a,i]),h.useEffect(()=>{d.current.isValid&&n._setValid(!0)},[n]),h.useMemo(()=>ul(o,n,d.current,!1),[o,n])}var Xe=e=>typeof e=="string",Ln=(e,s,n,a,r)=>Xe(e)?(a&&s.watch.add(e),K(n,e,r)):Array.isArray(e)?e.map(i=>(a&&s.watch.add(i),K(n,i))):(a&&(s.watchAll=!0),n),Fn=e=>Ke(e)||!ll(e);function rt(e,s,n=new WeakSet){if(Fn(e)||Fn(s))return Object.is(e,s);if(Ct(e)&&Ct(s))return Object.is(e.getTime(),s.getTime());const a=Object.keys(e),r=Object.keys(s);if(a.length!==r.length)return!1;if(n.has(e)||n.has(s))return!0;n.add(e),n.add(s);for(const i of a){const o=e[i];if(!r.includes(i))return!1;if(i!=="ref"){const l=s[i];if(Ct(o)&&Ct(l)||Ee(o)&&Ee(l)||Array.isArray(o)&&Array.isArray(l)?!rt(o,l,n):!Object.is(o,l))return!1}}return!0}function Km(e){const s=sa(),{control:n=s,name:a,defaultValue:r,disabled:i,exact:o,compute:l}=e||{},d=h.useRef(r),u=h.useRef(l),p=h.useRef(void 0),m=h.useRef(n),x=h.useRef(a);u.current=l;const[f,b]=h.useState(()=>{const N=n._getWatch(a,d.current);return u.current?u.current(N):N}),v=h.useCallback(N=>{const $=Ln(a,n._names,N||n._formValues,!1,d.current);return u.current?u.current($):$},[n._formValues,n._names,a]),g=h.useCallback(N=>{if(!i){const $=Ln(a,n._names,N||n._formValues,!1,d.current);if(u.current){const E=u.current($);rt(E,p.current)||(b(E),p.current=E)}else b($)}},[n._formValues,n._names,i,a]);na(()=>((m.current!==n||!rt(x.current,a))&&(m.current=n,x.current=a,g()),n._subscribe({name:a,formState:{values:!0},exact:o,callback:N=>{g(N.values)}})),[n,o,a,g]),h.useEffect(()=>n._removeUnmounted());const y=m.current!==n,w=x.current,k=h.useMemo(()=>{if(i)return null;const N=!y&&!rt(w,a);return y||N?v():null},[i,y,a,w,v]);return k!==null?k:f}function Ym(e){const s=sa(),{name:n,disabled:a,control:r=s,shouldUnregister:i,defaultValue:o,exact:l=!0}=e,d=cl(r._names.array,n),u=h.useMemo(()=>K(r._formValues,n,K(r._defaultValues,n,o)),[r,n,o]),p=Km({control:r,name:n,defaultValue:u,exact:l}),m=Gm({control:r,name:n,exact:l}),x=h.useRef(e),f=h.useRef(void 0),b=h.useRef(r.register(n,{...e.rules,value:p,...Qe(e.disabled)?{disabled:e.disabled}:{}}));x.current=e;const v=h.useMemo(()=>Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!K(m.errors,n)},isDirty:{enumerable:!0,get:()=>!!K(m.dirtyFields,n)},isTouched:{enumerable:!0,get:()=>!!K(m.touchedFields,n)},isValidating:{enumerable:!0,get:()=>!!K(m.validatingFields,n)},error:{enumerable:!0,get:()=>K(m.errors,n)}}),[m,n]),g=h.useCallback(N=>b.current.onChange({target:{value:ol(N),name:n},type:Es.CHANGE}),[n]),y=h.useCallback(()=>b.current.onBlur({target:{value:K(r._formValues,n),name:n},type:Es.BLUR}),[n,r._formValues]),w=h.useCallback(N=>{const $=K(r._fields,n);$&&$._f&&N&&($._f.ref={focus:()=>He(N.focus)&&N.focus(),select:()=>He(N.select)&&N.select(),setCustomValidity:E=>He(N.setCustomValidity)&&N.setCustomValidity(E),reportValidity:()=>He(N.reportValidity)&&N.reportValidity()})},[r._fields,n]),k=h.useMemo(()=>({name:n,value:p,...Qe(a)||m.disabled?{disabled:m.disabled||a}:{},onChange:g,onBlur:y,ref:w}),[n,a,m.disabled,g,y,w,p]);return h.useEffect(()=>{const N=r._options.shouldUnregister||i,$=f.current;$&&$!==n&&!d&&r.unregister($),r.register(n,{...x.current.rules,...Qe(x.current.disabled)?{disabled:x.current.disabled}:{}});const E=(j,L)=>{const S=K(r._fields,j);S&&S._f&&(S._f.mount=L)};if(E(n,!0),N){const j=$e(K(r._options.defaultValues,n,x.current.defaultValue));he(r._defaultValues,n,j),ve(K(r._formValues,n))&&he(r._formValues,n,j)}return!d&&r.register(n),f.current=n,()=>{(d?N&&!r._state.action:N)?r.unregister(n):E(n,!1)}},[n,r,d,i]),h.useEffect(()=>{r._setDisabledField({disabled:a,name:n})},[a,n,r]),h.useMemo(()=>({field:k,formState:m,fieldState:v}),[k,m,v])}const Qm=h.createContext(null);Qm.displayName="HookFormContext";var Zm=(e,s,n,a,r)=>s?{...n[e],types:{...n[e]&&n[e].types?n[e].types:{},[a]:r||!0}}:{},ts=e=>Array.isArray(e)?e:[e],or=()=>{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 ml(e,s){const n={};for(const a in e)if(e.hasOwnProperty(a)){const r=e[a],i=s[a];if(r&&Ee(r)&&i){const o=ml(r,i);Ee(o)&&(n[a]=o)}else e[a]&&(n[a]=i)}return n}var Ue=e=>Ee(e)&&!Object.keys(e).length,aa=e=>e.type==="file",Ls=e=>{if(!Jn)return!1;const s=e?e.ownerDocument:0;return e instanceof(s&&s.defaultView?s.defaultView.HTMLElement:HTMLElement)},fl=e=>e.type==="select-multiple",ra=e=>e.type==="radio",Xm=e=>ra(e)||cs(e),ln=e=>Ls(e)&&e.isConnected;function Jm(e,s){const n=s.slice(0,-1).length;let a=0;for(;a<n;)e=ve(e)?a++:e[s[a++]];return e}function ef(e){for(const s in e)if(e.hasOwnProperty(s)&&!ve(e[s]))return!1;return!0}function Ae(e,s){const n=Array.isArray(s)?s:Us(s)?[s]:ta(s),a=n.length===1?e:Jm(e,n),r=n.length-1,i=n[r];return a&&delete a[i],r!==0&&(Ee(a)&&Ue(a)||Array.isArray(a)&&ef(a))&&Ae(e,n.slice(0,-1)),e}var tf=e=>{for(const s in e)if(He(e[s]))return!0;return!1};function pl(e){return Array.isArray(e)||Ee(e)&&!tf(e)}function _n(e,s={}){for(const n in e){const a=e[n];pl(a)?(s[n]=Array.isArray(a)?[]:{},_n(a,s[n])):ve(a)||(s[n]=!0)}return s}function Mt(e,s,n){n||(n=_n(s));for(const a in e){const r=e[a];if(pl(r))ve(s)||Fn(n[a])?n[a]=_n(r,Array.isArray(r)?[]:{}):Mt(r,Ke(s)?{}:s[a],n[a]);else{const i=s[a];n[a]=!rt(r,i)}}return n}const cr={value:!1,isValid:!1},dr={value:!0,isValid:!0};var xl=e=>{if(Array.isArray(e)){if(e.length>1){const s=e.filter(n=>n&&n.checked&&!n.disabled).map(n=>n.value);return{value:s,isValid:!!s.length}}return e[0].checked&&!e[0].disabled?e[0].attributes&&!ve(e[0].attributes.value)?ve(e[0].value)||e[0].value===""?dr:{value:e[0].value,isValid:!0}:dr:cr}return cr},hl=(e,{valueAsNumber:s,valueAsDate:n,setValueAs:a})=>ve(e)?e:s?e===""?NaN:e&&+e:n&&Xe(e)?new Date(e):a?a(e):e;const ur={isValid:!1,value:null};var bl=e=>Array.isArray(e)?e.reduce((s,n)=>n&&n.checked&&!n.disabled?{isValid:!0,value:n.value}:s,ur):ur;function mr(e){const s=e.ref;return aa(s)?s.files:ra(s)?bl(e.refs).value:fl(s)?[...s.selectedOptions].map(({value:n})=>n):cs(s)?xl(e.refs).value:hl(ve(s.value)?e.ref.value:s.value,e)}var sf=(e,s,n,a)=>{const r={};for(const i of e){const o=K(s,i);o&&he(r,i,o._f)}return{criteriaMode:n,names:[...e],fields:r,shouldUseNativeValidation:a}},Fs=e=>e instanceof RegExp,qt=e=>ve(e)?e:Fs(e)?e.source:Ee(e)?Fs(e.value)?e.value.source:e.value:e,fr=e=>({isOnSubmit:!e||e===at.onSubmit,isOnBlur:e===at.onBlur,isOnChange:e===at.onChange,isOnAll:e===at.all,isOnTouch:e===at.onTouched});const pr="AsyncFunction";var nf=e=>!!e&&!!e.validate&&!!(He(e.validate)&&e.validate.constructor.name===pr||Ee(e.validate)&&Object.values(e.validate).find(s=>s.constructor.name===pr)),af=e=>e.mount&&(e.required||e.min||e.max||e.maxLength||e.minLength||e.pattern||e.validate),xr=(e,s,n)=>!n&&(s.watchAll||s.watch.has(e)||[...s.watch].some(a=>e.startsWith(a)&&/^\.\w+/.test(e.slice(a.length))));const ss=(e,s,n,a)=>{for(const r of n||Object.keys(e)){const i=K(e,r);if(i){const{_f:o,...l}=i;if(o){if(o.refs&&o.refs[0]&&s(o.refs[0],r)&&!a)return!0;if(o.ref&&s(o.ref,o.name)&&!a)return!0;if(ss(l,s))break}else if(Ee(l)&&ss(l,s))break}}};function hr(e,s,n){const a=K(e,n);if(a||Us(n))return{error:a,name:n};const r=n.split(".");for(;r.length;){const i=r.join("."),o=K(s,i),l=K(e,i);if(o&&!Array.isArray(o)&&n!==i)return{name:n};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:n}}var rf=(e,s,n,a)=>{n(e);const{name:r,...i}=e;return Ue(i)||Object.keys(i).length>=Object.keys(s).length||Object.keys(i).find(o=>s[o]===(!a||at.all))},lf=(e,s,n)=>!e||!s||e===s||ts(e).some(a=>a&&(n?a===s:a.startsWith(s)||s.startsWith(a))),of=(e,s,n,a,r)=>r.isOnAll?!1:!n&&r.isOnTouch?!(s||e):(n?a.isOnBlur:r.isOnBlur)?!e:(n?a.isOnChange:r.isOnChange)?e:!0,cf=(e,s)=>!ea(K(e,s)).length&&Ae(e,s),df=(e,s,n)=>{const a=ts(K(e,n));return he(a,"root",s[n]),he(e,n,a),e};function br(e,s,n="validate"){if(Xe(e)||Array.isArray(e)&&e.every(Xe)||Qe(e)&&!e)return{type:n,message:Xe(e)?e:"",ref:s}}var Lt=e=>Ee(e)&&!Fs(e)?e:{value:e,message:""},gr=async(e,s,n,a,r,i)=>{const{ref:o,refs:l,required:d,maxLength:u,minLength:p,min:m,max:x,pattern:f,validate:b,name:v,valueAsNumber:g,mount:y}=e._f,w=K(n,v);if(!y||s.has(v))return{};const k=l?l[0]:o,N=A=>{r&&k.reportValidity&&(k.setCustomValidity(Qe(A)?"":A||""),k.reportValidity())},$={},E=ra(o),j=cs(o),L=E||j,S=(g||aa(o))&&ve(o.value)&&ve(w)||Ls(o)&&o.value===""||w===""||Array.isArray(w)&&!w.length,M=Zm.bind(null,v,a,$),D=(A,R,T,U=ct.maxLength,G=ct.minLength)=>{const I=A?R:T;$[v]={type:A?U:G,message:I,ref:o,...M(A?U:G,I)}};if(i?!Array.isArray(w)||!w.length:d&&(!L&&(S||Ke(w))||Qe(w)&&!w||j&&!xl(l).isValid||E&&!bl(l).isValid)){const{value:A,message:R}=Xe(d)?{value:!!d,message:d}:Lt(d);if(A&&($[v]={type:ct.required,message:R,ref:k,...M(ct.required,R)},!a))return N(R),$}if(!S&&(!Ke(m)||!Ke(x))){let A,R;const T=Lt(x),U=Lt(m);if(!Ke(w)&&!isNaN(w)){const G=o.valueAsNumber||w&&+w;Ke(T.value)||(A=G>T.value),Ke(U.value)||(R=G<U.value)}else{const G=o.valueAsDate||new Date(w),I=Q=>new Date(new Date().toDateString()+" "+Q),se=o.type=="time",q=o.type=="week";Xe(T.value)&&w&&(A=se?I(w)>I(T.value):q?w>T.value:G>new Date(T.value)),Xe(U.value)&&w&&(R=se?I(w)<I(U.value):q?w<U.value:G<new Date(U.value))}if((A||R)&&(D(!!A,T.message,U.message,ct.max,ct.min),!a))return N($[v].message),$}if((u||p)&&!S&&(Xe(w)||i&&Array.isArray(w))){const A=Lt(u),R=Lt(p),T=!Ke(A.value)&&w.length>+A.value,U=!Ke(R.value)&&w.length<+R.value;if((T||U)&&(D(T,A.message,R.message),!a))return N($[v].message),$}if(f&&!S&&Xe(w)){const{value:A,message:R}=Lt(f);if(Fs(A)&&!w.match(A)&&($[v]={type:ct.pattern,message:R,ref:o,...M(ct.pattern,R)},!a))return N(R),$}if(b){if(He(b)){const A=await b(w,n),R=br(A,k);if(R&&($[v]={...R,...M(ct.validate,R.message)},!a))return N(R.message),$}else if(Ee(b)){let A={};for(const R in b){if(!Ue(A)&&!a)break;const T=br(await b[R](w,n),k,R);T&&(A={...T,...M(R,T.message)},N(T.message),a&&($[v]=A))}if(!Ue(A)&&($[v]={ref:k,...A},!a))return $}}return N(!0),$};const uf={mode:at.onSubmit,reValidateMode:at.onChange,shouldFocusError:!0};function mf(e={}){let s={...uf,...e},n={submitCount:0,isDirty:!1,isReady:!1,isLoading:He(s.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{},errors:s.errors||{},disabled:s.disabled||!1},a={},r=Ee(s.defaultValues)||Ee(s.values)?$e(s.defaultValues||s.values)||{}:{},i=s.shouldUnregister?{}:$e(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 p={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1},m={...p};let x={...m};const f={array:or(),state:or()},b=s.criteriaMode===at.all,v=C=>F=>{clearTimeout(u),u=setTimeout(C,F)},g=async C=>{if(!o.keepIsValid&&!s.disabled&&(m.isValid||x.isValid||C)){let F;s.resolver?(F=Ue((await L()).errors),y()):F=await M(a,!0),F!==n.isValid&&f.state.next({isValid:F})}},y=(C,F)=>{!s.disabled&&(m.isValidating||m.validatingFields||x.isValidating||x.validatingFields)&&((C||Array.from(l.mount)).forEach(_=>{_&&(F?he(n.validatingFields,_,F):Ae(n.validatingFields,_))}),f.state.next({validatingFields:n.validatingFields,isValidating:!Ue(n.validatingFields)}))},w=(C,F=[],_,W,H=!0,B=!0)=>{if(W&&_&&!s.disabled){if(o.action=!0,B&&Array.isArray(K(a,C))){const ee=_(K(a,C),W.argA,W.argB);H&&he(a,C,ee)}if(B&&Array.isArray(K(n.errors,C))){const ee=_(K(n.errors,C),W.argA,W.argB);H&&he(n.errors,C,ee),cf(n.errors,C)}if((m.touchedFields||x.touchedFields)&&B&&Array.isArray(K(n.touchedFields,C))){const ee=_(K(n.touchedFields,C),W.argA,W.argB);H&&he(n.touchedFields,C,ee)}(m.dirtyFields||x.dirtyFields)&&(n.dirtyFields=Mt(r,i)),f.state.next({name:C,isDirty:A(C,F),dirtyFields:n.dirtyFields,errors:n.errors,isValid:n.isValid})}else he(i,C,F)},k=(C,F)=>{he(n.errors,C,F),f.state.next({errors:n.errors})},N=C=>{n.errors=C,f.state.next({errors:n.errors,isValid:!1})},$=(C,F,_,W)=>{const H=K(a,C);if(H){const B=K(i,C,ve(_)?K(r,C):_);ve(B)||W&&W.defaultChecked||F?he(i,C,F?B:mr(H._f)):U(C,B),o.mount&&!o.action&&g()}},E=(C,F,_,W,H)=>{let B=!1,ee=!1;const fe={name:C};if(!s.disabled){if(!_||W){(m.isDirty||x.isDirty)&&(ee=n.isDirty,n.isDirty=fe.isDirty=A(),B=ee!==fe.isDirty);const pe=rt(K(r,C),F);ee=!!K(n.dirtyFields,C),pe?Ae(n.dirtyFields,C):he(n.dirtyFields,C,!0),fe.dirtyFields=n.dirtyFields,B=B||(m.dirtyFields||x.dirtyFields)&&ee!==!pe}if(_){const pe=K(n.touchedFields,C);pe||(he(n.touchedFields,C,_),fe.touchedFields=n.touchedFields,B=B||(m.touchedFields||x.touchedFields)&&pe!==_)}B&&H&&f.state.next(fe)}return B?fe:{}},j=(C,F,_,W)=>{const H=K(n.errors,C),B=(m.isValid||x.isValid)&&Qe(F)&&n.isValid!==F;if(s.delayError&&_?(d=v(()=>k(C,_)),d(s.delayError)):(clearTimeout(u),d=null,_?he(n.errors,C,_):Ae(n.errors,C)),(_?!rt(H,_):H)||!Ue(W)||B){const ee={...W,...B&&Qe(F)?{isValid:F}:{},errors:n.errors,name:C};n={...n,...ee},f.state.next(ee)}},L=async C=>(y(C,!0),await s.resolver(i,s.context,sf(C||l.mount,a,s.criteriaMode,s.shouldUseNativeValidation))),S=async C=>{const{errors:F}=await L(C);if(y(C),C)for(const _ of C){const W=K(F,_);W?he(n.errors,_,W):Ae(n.errors,_)}else n.errors=F;return F},M=async(C,F,_={valid:!0})=>{for(const W in C){const H=C[W];if(H){const{_f:B,...ee}=H;if(B){const fe=l.array.has(B.name),pe=H._f&&nf(H._f);pe&&m.validatingFields&&y([B.name],!0);const ze=await gr(H,l.disabled,i,b,s.shouldUseNativeValidation&&!F,fe);if(pe&&m.validatingFields&&y([B.name]),ze[B.name]&&(_.valid=!1,F||e.shouldUseNativeValidation))break;!F&&(K(ze,B.name)?fe?df(n.errors,ze,B.name):he(n.errors,B.name,ze[B.name]):Ae(n.errors,B.name))}!Ue(ee)&&await M(ee,F,_)}}return _.valid},D=()=>{for(const C of l.unMount){const F=K(a,C);F&&(F._f.refs?F._f.refs.every(_=>!ln(_)):!ln(F._f.ref))&&Z(C)}l.unMount=new Set},A=(C,F)=>!s.disabled&&(C&&F&&he(i,C,F),!rt(Y(),r)),R=(C,F,_)=>Ln(C,l,{...o.mount?i:ve(F)?r:Xe(C)?{[C]:F}:F},_,F),T=C=>ea(K(o.mount?i:r,C,s.shouldUnregister?K(r,C,[]):[])),U=(C,F,_={})=>{const W=K(a,C);let H=F;if(W){const B=W._f;B&&(!B.disabled&&he(i,C,hl(F,B)),H=Ls(B.ref)&&Ke(F)?"":F,fl(B.ref)?[...B.ref.options].forEach(ee=>ee.selected=H.includes(ee.value)):B.refs?cs(B.ref)?B.refs.forEach(ee=>{(!ee.defaultChecked||!ee.disabled)&&(Array.isArray(H)?ee.checked=!!H.find(fe=>fe===ee.value):ee.checked=H===ee.value||!!H)}):B.refs.forEach(ee=>ee.checked=ee.value===H):aa(B.ref)?B.ref.value="":(B.ref.value=H,B.ref.type||f.state.next({name:C,values:$e(i)})))}(_.shouldDirty||_.shouldTouch)&&E(C,H,_.shouldTouch,_.shouldDirty,!0),_.shouldValidate&&Q(C)},G=(C,F,_)=>{for(const W in F){if(!F.hasOwnProperty(W))return;const H=F[W],B=C+"."+W,ee=K(a,B);(l.array.has(C)||Ee(H)||ee&&!ee._f)&&!Ct(H)?G(B,H,_):U(B,H,_)}},I=(C,F,_={})=>{const W=K(a,C),H=l.array.has(C),B=$e(F);he(i,C,B),H?(f.array.next({name:C,values:$e(i)}),(m.isDirty||m.dirtyFields||x.isDirty||x.dirtyFields)&&_.shouldDirty&&f.state.next({name:C,dirtyFields:Mt(r,i),isDirty:A(C,B)})):W&&!W._f&&!Ke(B)?G(C,B,_):U(C,B,_),xr(C,l)?f.state.next({...n,name:C,values:$e(i)}):f.state.next({name:o.mount?C:void 0,values:$e(i)})},se=async C=>{o.mount=!0;const F=C.target;let _=F.name,W=!0;const H=K(a,_),B=pe=>{W=Number.isNaN(pe)||Ct(pe)&&isNaN(pe.getTime())||rt(pe,K(i,_,pe))},ee=fr(s.mode),fe=fr(s.reValidateMode);if(H){let pe,ze;const yt=F.type?mr(H._f):ol(C),pt=C.type===Es.BLUR||C.type===Es.FOCUS_OUT,Lc=!af(H._f)&&!s.resolver&&!K(n.errors,_)&&!H._f.deps||of(pt,K(n.touchedFields,_),n.isSubmitted,fe,ee),Ys=xr(_,l,pt);he(i,_,yt),pt?(!F||!F.readOnly)&&(H._f.onBlur&&H._f.onBlur(C),d&&d(0)):H._f.onChange&&H._f.onChange(C);const Qs=E(_,yt,pt),Fc=!Ue(Qs)||Ys;if(!pt&&f.state.next({name:_,type:C.type,values:$e(i)}),Lc)return(m.isValid||x.isValid)&&(s.mode==="onBlur"?pt&&g():pt||g()),Fc&&f.state.next({name:_,...Ys?{}:Qs});if(!pt&&Ys&&f.state.next({...n}),s.resolver){const{errors:Ra}=await L([_]);if(y([_]),B(yt),W){const _c=hr(n.errors,a,_),Ma=hr(Ra,a,_c.name||_);pe=Ma.error,_=Ma.name,ze=Ue(Ra)}}else y([_],!0),pe=(await gr(H,l.disabled,i,b,s.shouldUseNativeValidation))[_],y([_]),B(yt),W&&(pe?ze=!1:(m.isValid||x.isValid)&&(ze=await M(a,!0)));W&&(H._f.deps&&(!Array.isArray(H._f.deps)||H._f.deps.length>0)&&Q(H._f.deps),j(_,ze,pe,Qs))}},q=(C,F)=>{if(K(n.errors,F)&&C.focus)return C.focus(),1},Q=async(C,F={})=>{let _,W;const H=ts(C);if(s.resolver){const B=await S(ve(C)?C:H);_=Ue(B),W=C?!H.some(ee=>K(B,ee)):_}else C?(W=(await Promise.all(H.map(async B=>{const ee=K(a,B);return await M(ee&&ee._f?{[B]:ee}:ee)}))).every(Boolean),!(!W&&!n.isValid)&&g()):W=_=await M(a);return f.state.next({...!Xe(C)||(m.isValid||x.isValid)&&_!==n.isValid?{}:{name:C},...s.resolver||!C?{isValid:_}:{},errors:n.errors}),F.shouldFocus&&!W&&ss(a,q,C?H:l.mount),W},Y=(C,F)=>{let _={...o.mount?i:r};return F&&(_=ml(F.dirtyFields?n.dirtyFields:n.touchedFields,_)),ve(C)?_:Xe(C)?K(_,C):C.map(W=>K(_,W))},ce=(C,F)=>({invalid:!!K((F||n).errors,C),isDirty:!!K((F||n).dirtyFields,C),error:K((F||n).errors,C),isValidating:!!K(n.validatingFields,C),isTouched:!!K((F||n).touchedFields,C)}),ne=C=>{C&&ts(C).forEach(F=>Ae(n.errors,F)),f.state.next({errors:C?n.errors:{}})},X=(C,F,_)=>{const W=(K(a,C,{_f:{}})._f||{}).ref,H=K(n.errors,C)||{},{ref:B,message:ee,type:fe,...pe}=H;he(n.errors,C,{...pe,...F,ref:W}),f.state.next({name:C,errors:n.errors,isValid:!1}),_&&_.shouldFocus&&W&&W.focus&&W.focus()},ie=(C,F)=>He(C)?f.state.subscribe({next:_=>"values"in _&&C(R(void 0,F),_)}):R(C,F,!0),V=C=>f.state.subscribe({next:F=>{lf(C.name,F.name,C.exact)&&rf(F,C.formState||m,ue,C.reRenderRoot)&&C.callback({values:{...i},...n,...F,defaultValues:r})}}).unsubscribe,z=C=>(o.mount=!0,x={...x,...C.formState},V({...C,formState:{...p,...C.formState}})),Z=(C,F={})=>{for(const _ of C?ts(C):l.mount)l.mount.delete(_),l.array.delete(_),F.keepValue||(Ae(a,_),Ae(i,_)),!F.keepError&&Ae(n.errors,_),!F.keepDirty&&Ae(n.dirtyFields,_),!F.keepTouched&&Ae(n.touchedFields,_),!F.keepIsValidating&&Ae(n.validatingFields,_),!s.shouldUnregister&&!F.keepDefaultValue&&Ae(r,_);f.state.next({values:$e(i)}),f.state.next({...n,...F.keepDirty?{isDirty:A()}:{}}),!F.keepIsValid&&g()},Ie=({disabled:C,name:F})=>{if(Qe(C)&&o.mount||C||l.disabled.has(F)){const H=l.disabled.has(F)!==!!C;C?l.disabled.add(F):l.disabled.delete(F),H&&o.mount&&!o.action&&g()}},Le=(C,F={})=>{let _=K(a,C);const W=Qe(F.disabled)||Qe(s.disabled);return he(a,C,{..._||{},_f:{..._&&_._f?_._f:{ref:{name:C}},name:C,mount:!0,...F}}),l.mount.add(C),_?Ie({disabled:Qe(F.disabled)?F.disabled:s.disabled,name:C}):$(C,!0,F.value),{...W?{disabled:F.disabled||s.disabled}:{},...s.progressive?{required:!!F.required,min:qt(F.min),max:qt(F.max),minLength:qt(F.minLength),maxLength:qt(F.maxLength),pattern:qt(F.pattern)}:{},name:C,onChange:se,onBlur:se,ref:H=>{if(H){Le(C,F),_=K(a,C);const B=ve(H.value)&&H.querySelectorAll&&H.querySelectorAll("input,select,textarea")[0]||H,ee=Xm(B),fe=_._f.refs||[];if(ee?fe.find(pe=>pe===B):B===_._f.ref)return;he(a,C,{_f:{..._._f,...ee?{refs:[...fe.filter(ln),B,...Array.isArray(K(r,C))?[{}]:[]],ref:{type:B.type,name:C}}:{ref:B}}}),$(C,!1,void 0,B)}else _=K(a,C,{}),_._f&&(_._f.mount=!1),(s.shouldUnregister||F.shouldUnregister)&&!(cl(l.array,C)&&o.action)&&l.unMount.add(C)}}},Fe=()=>s.shouldFocusError&&ss(a,q,l.mount),ae=C=>{Qe(C)&&(f.state.next({disabled:C}),ss(a,(F,_)=>{const W=K(a,_);W&&(F.disabled=W._f.disabled||C,Array.isArray(W._f.refs)&&W._f.refs.forEach(H=>{H.disabled=W._f.disabled||C}))},0,!1))},je=(C,F)=>async _=>{let W;_&&(_.preventDefault&&_.preventDefault(),_.persist&&_.persist());let H=$e(i);if(f.state.next({isSubmitting:!0}),s.resolver){const{errors:B,values:ee}=await L();y(),n.errors=B,H=$e(ee)}else await M(a);if(l.disabled.size)for(const B of l.disabled)Ae(H,B);if(Ae(n.errors,"root"),Ue(n.errors)){f.state.next({errors:{}});try{await C(H,_)}catch(B){W=B}}else F&&await F({...n.errors},_),Fe(),setTimeout(Fe);if(f.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:Ue(n.errors)&&!W,submitCount:n.submitCount+1,errors:n.errors}),W)throw W},_e=(C,F={})=>{K(a,C)&&(ve(F.defaultValue)?I(C,$e(K(r,C))):(I(C,F.defaultValue),he(r,C,$e(F.defaultValue))),F.keepTouched||Ae(n.touchedFields,C),F.keepDirty||(Ae(n.dirtyFields,C),n.isDirty=F.defaultValue?A(C,$e(K(r,C))):A()),F.keepError||(Ae(n.errors,C),m.isValid&&g()),f.state.next({...n}))},et=(C,F={})=>{const _=C?$e(C):r,W=$e(_),H=Ue(C),B=H?r:W;if(F.keepDefaultValues||(r=_),!F.keepValues){if(F.keepDirtyValues){const ee=new Set([...l.mount,...Object.keys(Mt(r,i))]);for(const fe of Array.from(ee)){const pe=K(n.dirtyFields,fe),ze=K(i,fe),yt=K(B,fe);pe&&!ve(ze)?he(B,fe,ze):!pe&&!ve(yt)&&I(fe,yt)}}else{if(Jn&&ve(C))for(const ee of l.mount){const fe=K(a,ee);if(fe&&fe._f){const pe=Array.isArray(fe._f.refs)?fe._f.refs[0]:fe._f.ref;if(Ls(pe)){const ze=pe.closest("form");if(ze){ze.reset();break}}}}if(F.keepFieldsRef)for(const ee of l.mount)I(ee,K(B,ee));else a={}}i=s.shouldUnregister?F.keepDefaultValues?$e(r):{}:$e(B),f.array.next({values:{...B}}),f.state.next({values:{...B}})}l={mount:F.keepDirtyValues?l.mount:new Set,unMount:new Set,array:new Set,disabled:new Set,watch:new Set,watchAll:!1,focus:""},o.mount=!m.isValid||!!F.keepIsValid||!!F.keepDirtyValues||!s.shouldUnregister&&!Ue(B),o.watch=!!s.shouldUnregister,o.keepIsValid=!!F.keepIsValid,o.action=!1,F.keepErrors||(n.errors={}),f.state.next({submitCount:F.keepSubmitCount?n.submitCount:0,isDirty:H?!1:F.keepDirty?n.isDirty:!!(F.keepDefaultValues&&!rt(C,r)),isSubmitted:F.keepIsSubmitted?n.isSubmitted:!1,dirtyFields:H?{}:F.keepDirtyValues?F.keepDefaultValues&&i?Mt(r,i):n.dirtyFields:F.keepDefaultValues&&C?Mt(r,C):F.keepDirty?n.dirtyFields:{},touchedFields:F.keepTouched?n.touchedFields:{},errors:F.keepErrors?n.errors:{},isSubmitSuccessful:F.keepIsSubmitSuccessful?n.isSubmitSuccessful:!1,isSubmitting:!1,defaultValues:r})},ge=(C,F)=>et(He(C)?C(i):C,{...s.resetOptions,...F}),Re=(C,F={})=>{const _=K(a,C),W=_&&_._f;if(W){const H=W.refs?W.refs[0]:W.ref;H.focus&&setTimeout(()=>{H.focus(),F.shouldSelect&&He(H.select)&&H.select()})}},ue=C=>{n={...n,...C}},J={control:{register:Le,unregister:Z,getFieldState:ce,handleSubmit:je,setError:X,_subscribe:V,_runSchema:L,_updateIsValidating:y,_focusError:Fe,_getWatch:R,_getDirty:A,_setValid:g,_setFieldArray:w,_setDisabledField:Ie,_setErrors:N,_getFieldArray:T,_reset:et,_resetDefaultValues:()=>He(s.defaultValues)&&s.defaultValues().then(C=>{ge(C,s.resetOptions),f.state.next({isLoading:!1})}),_removeUnmounted:D,_disableForm:ae,_subjects:f,_proxyFormState:m,get _fields(){return a},get _formValues(){return i},get _state(){return o},set _state(C){o=C},get _defaultValues(){return r},get _names(){return l},set _names(C){l=C},get _formState(){return n},get _options(){return s},set _options(C){s={...s,...C}}},subscribe:z,trigger:Q,register:Le,handleSubmit:je,watch:ie,setValue:I,getValues:Y,reset:ge,resetField:_e,clearErrors:ne,unregister:Z,setError:X,setFocus:Re,getFieldState:ce};return{...J,formControl:J}}function ff(e={}){const s=h.useRef(void 0),n=h.useRef(void 0),[a,r]=h.useState({isDirty:!1,isValidating:!1,isLoading:He(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:He(e.defaultValues)?void 0:e.defaultValues});if(!s.current)if(e.formControl)s.current={...e.formControl,formState:a},e.defaultValues&&!He(e.defaultValues)&&e.formControl.reset(e.defaultValues,e.resetOptions);else{const{formControl:o,...l}=mf(e);s.current={...l,formState:a}}const i=s.current.control;return i._options=e,na(()=>{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&&!rt(e.values,n.current)?(i._reset(e.values,{keepFieldsRef:!0,...i._options.resetOptions}),!((o=i._options.resetOptions)===null||o===void 0)&&o.keepIsValid||i._setValid(),n.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()}),s.current.formState=h.useMemo(()=>ul(a,i),[i,a]),s.current}function pf(e,s=3){return e%1===0?e.toString():e.toFixed(s).replace(/\.?0+$/,"")}function xf(e,s="en-US",n="USD"){try{return new Intl.NumberFormat(s,{style:"currency",currency:n,minimumFractionDigits:2,maximumFractionDigits:2}).format(e)}catch(a){return console.warn(`Invalid currency formatting: ${a}`),`${n} ${e.toFixed(2)}`}}function hf(e="USD",s="en-US"){try{return new Intl.NumberFormat(s,{style:"currency",currency:e}).formatToParts(0).find(i=>i.type==="currency")?.value??"$"}catch{return"$"}}function bf(e){const s=e.replace(/[^\d.,-]/g,""),n=s.match(/,\d{1,2}$/);let a;n?a=s.replace(/\./g,"").replace(",","."):a=s.replace(/,/g,"");const r=parseFloat(a);return isNaN(r)?null:r}function gf(e,s,n=.001){const a=e-s,r=Math.abs(a)<=n;return{difference:a,isBalanced:r,isUnderAllocated:!r&&a>0,isOverAllocated:!r&&a<0}}function ia(){return`dist-${Date.now()}-${Math.random().toString(36).substr(2,9)}`}ia();const yf={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:"$"},on=()=>({id:ia(),amount:0,glAccount:null,isTaxDeductible:!1}),gl=({distribution:e,defaultDistribution:s,glAccounts:n=[],isLoadingGlAccounts:a=!1,onSearchGlAccounts:r,onDistributionChange:i,onAmountChange:o,onGlAccountChange:l,onTaxDeductibleChange:d,onDelete:u,canDelete:p=!0,canEditTaxDeductible:m=!0,isDisabled:x=!1,labels:f,classNames:b={},"data-testid":v,control:g,name:y,rules:w})=>{const k={...yf,...f},N=g!==void 0&&y!==void 0,$=ff({defaultValues:{_internal:s||on()}}),E=Ym({control:N?g:$.control,name:N?y:"_internal",rules:N?w:void 0}),[j,L]=h.useState(s||on()),S=N?E.field.value??on():e??j,M=N&&!!E.fieldState?.error,D=N&&(E.fieldState?.isTouched??!1),A=M||D,R=A&&(!S.amount||S.amount<=0),T=A&&!S.glAccount,[U,G]=h.useState(S.glAccount?.name||""),I=h.useCallback(X=>{const ie={...S,...X};N&&E.field.onChange(ie),!N&&e===void 0&&L(ie),i?.(ie)},[S,e,i,N,E]),se=h.useCallback(X=>{const ie=X||0;I({amount:ie}),o?.(ie)},[I,o]),q=h.useCallback(X=>{G(X),r?.(X)},[r]),Q=h.useCallback(X=>{if(X===null){I({glAccount:null}),l?.(null);return}const V=n.find(z=>String(z.id)===String(X))||null;I({glAccount:V}),l?.(V)},[n,I,l]),Y=h.useCallback(()=>{G(""),I({glAccount:null}),l?.(null)},[I,l]),ce=h.useCallback(X=>{I({isTaxDeductible:X}),d?.(X)},[I,d]),ne=h.useCallback(()=>{u?.()},[u]);return t.jsx(c.Card,{radius:"md",shadow:"sm","data-testid":v||"revenue-distribution-card",className:c.cn(b.base),children:t.jsxs(c.CardBody,{className:c.cn("flex flex-row flex-nowrap items-start gap-4",b.body),children:[t.jsx("div",{className:c.cn("shrink-0",b.amountContainer),children:t.jsx(c.NumberInput,{"data-testid":`${v||"revenue-distribution-card"}-amount-input`,label:t.jsxs("span",{className:"flex items-center gap-1",children:[k.amount,t.jsx(c.Tooltip,{content:k.amountTooltip,children:t.jsx(P,{icon:"solar:info-circle-linear",className:"text-default-400 cursor-help",width:16})})]}),value:S.amount||void 0,onValueChange:se,labelPlacement:"outside",placeholder:k.amountPlaceholder,isWheelDisabled:!0,hideStepper:!0,variant:"bordered",isDisabled:x,isInvalid:R,errorMessage:R?"Amount is required":void 0,minValue:0,step:.01,className:b.amountInput,startContent:t.jsx("div",{className:"pointer-events-none flex items-center",children:t.jsx("span",{className:"text-default-400 text-small",children:k.currencySymbol})})})}),t.jsx("div",{className:c.cn("grow",b.glAccountContainer),children:t.jsx(c.Autocomplete,{"data-testid":`${v||"revenue-distribution-card"}-gl-account-input`,label:t.jsxs("span",{className:"flex items-center gap-1",children:[k.glAccount,t.jsx(c.Tooltip,{content:k.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:n,menuTrigger:"input",inputValue:S.glAccount?.name??U,selectedKey:S.glAccount?.id??null,isDisabled:x,isInvalid:T,errorMessage:T?"GL Account is required":void 0,listboxProps:{emptyContent:a?k.searching:k.noGlAccountsFound},placeholder:k.glAccountPlaceholder,onInputChange:q,onSelectionChange:Q,onClear:Y,className:b.glAccountInput,children:X=>t.jsx(c.AutocompleteItem,{textValue:X.name,children:t.jsxs("div",{className:"flex flex-col",children:[t.jsx("span",{children:X.name}),X.code&&t.jsx("span",{className:"text-xs text-default-400",children:X.code})]})},X.id)})}),t.jsx("div",{className:c.cn("shrink-0 pt-6 flex items-center",b.taxDeductibleContainer),children:t.jsx(c.Checkbox,{radius:"full","data-testid":`${v||"revenue-distribution-card"}-tax-deductible`,isSelected:S.isTaxDeductible,onValueChange:ce,isDisabled:x||!m,className:b.taxDeductibleCheckbox,children:k.taxDeductible})}),t.jsx("div",{className:c.cn("shrink-0 pt-6",b.deleteContainer),children:t.jsx(O,{"data-testid":`${v||"revenue-distribution-card"}-delete-button`,size:"sm",color:"danger",variant:"flat",isDisabled:x||!p,onPress:ne,startContent:t.jsx(P,{icon:"solar:trash-bin-trash-linear",width:16}),className:c.cn("text-danger",b.deleteButton),children:k.deleteButton})})]})})};gl.displayName="RevenueDistributionCard";const yl=({message:e="No distributions configured",icon:s="solar:document-text-outline",iconSize:n=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:s,width:n,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})};yl.displayName="RevenueDistributionEmpty";const vf={title:"Error Loading Distributions",description:"An error occurred while loading the distribution configuration. Please try again."},vl=({error:e,labels:s,showCard:n=!0,color:a="danger",classNames:r={}})=>{const i={...vf,...s},o=t.jsx(c.Alert,{"data-testid":"revenue-distribution-error-alert",color:a,title:i.title,description:e||i.description,className:r.alert});return n?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})};vl.displayName="RevenueDistributionError";const jl=({rows:e=1,showCard:s=!0,classNames:n={}})=>{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",n.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(oe,{className:"h-4 w-14 rounded-md"}),t.jsx(oe,{className:"h-4 w-4 rounded-full"})]}),t.jsx(oe,{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(oe,{className:"h-4 w-20 rounded-md"}),t.jsx(oe,{className:"h-4 w-4 rounded-full"})]}),t.jsx(oe,{className:"h-10 w-full rounded-lg"})]}),t.jsxs("div",{className:"shrink-0 pb-2 flex items-center gap-2",children:[t.jsx(oe,{className:"h-5 w-5 rounded-full"}),t.jsx(oe,{className:"h-4 w-24 rounded-md"})]}),t.jsx("div",{className:"shrink-0 pb-2",children:t.jsx(oe,{className:"h-8 w-20 rounded-lg"})})]},i);return s?t.jsx("div",{className:c.cn("flex flex-col gap-3",n.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",n.base),children:a.map(i=>r(i))})};jl.displayName="RevenueDistributionSkeleton";function la({isOpen:e,labels:s,icon:n,isConfirming:a=!1,confirmColor:r="danger",iconTone:i="danger",portalContainer:o,shouldBlockScroll:l,classNames:d,onClose:u,onConfirm:p}){return t.jsx(os,{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:[n&&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:n}),t.jsx("span",{className:"text-lg font-semibold leading-6 text-zinc-950",children:s.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:s.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:s.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:p,children:s.confirm})]})]})})}const jf=()=>({id:crypto.randomUUID(),fund:null,percentage:0});function yr(e){return!e.fund&&Number(e.percentage||0)<=0}function wf({mode:e,assignments:s}){const n=s.filter(i=>i.fund),a=n.reduce((i,o)=>i+Number(o.percentage||0),0),r=s.some(i=>!i.fund||Number(i.percentage||0)<=0);return n.length>=1&&!r&&Math.round(a*100)/100===100}const Nf={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"},wl={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"},Gt={...wl,base:"min-h-11 rounded-2xl px-4 py-2 shadow-none",title:"text-sm font-medium"},Cf={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"},kf={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 Sf(){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 $f=e=>Number.isFinite(e)?Math.max(0,Math.min(100,Math.round(e*100)/100)):0,Af=e=>e.fund!==null;function Df({assignments:e,funds:s,labels:n,classNames:a,isSaving:r=!1,hasSavedAssignments:i=!1,showSavedIndicator:o=!1,isCollapsed:l,isFundPickerOpen:d=!1,activeAssignmentId:u=null,modalPortalContainer:p,footer:m,onAssignmentsChange:x,onOpenFundPicker:f,onCloseFundPicker:b,onCollapseChange:v,onSave:g}){const[y,w]=h.useState(null),k=p??y??void 0,N={...Nf,...n},$=e.filter(V=>!yr(V)),j=$.filter(Af).length>0,L=h.useMemo(()=>e.filter(V=>!yr(V)).reduce((V,z)=>V+Number(z.percentage||0),0),[e]),S=Math.round(L*100)/100,M=$.some(V=>!V.fund||Number(V.percentage||0)<=0),D=j&&(S!==100||M),A=`${N.totalError} (${N.total} ${Number(L.toFixed(2))}%)`,R=wf({mode:"split",assignments:e}),T=j&&S>=100,[U,G]=h.useState(!1),[I,se]=h.useState(!1),q=t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(Sf,{}),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]}),Q=(V,z)=>{x(e.map(Z=>Z.id===V?{...Z,...z}:Z))},Y=()=>{T||x([...e,jf()])},ce=V=>{e.length<=1||x(e.filter(z=>z.id!==V))},ne=()=>{if(!r){if(!R){se(!0);return}if(!i){g();return}G(!0)}},X=()=>{G(!1),g()},ie=V=>{const z=u??e.find(Z=>!Z.fund)?.id??e[0]?.id;z&&(x(e.map(Z=>Z.id===z?{...Z,fund:V}:Z)),b())};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&&!p&&"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=>v?.(!(V==="all"||Array.from(V).length>0)),children:t.jsx(c.AccordionItem,{"aria-label":N.title,title:q,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:[!j&&t.jsx(c.Alert,{icon:t.jsx(P,{icon:"solar:info-circle-outline",className:"size-4"}),hideIconWrapper:!0,isClosable:!1,classNames:wl,color:"default",variant:"flat",title:N.emptySplit}),j&&t.jsx(Ef,{assignments:e,labels:N,total:L,hasTotalError:I&&!R||D,validationMessage:A,onSelectFund:V=>f(V),onRemoveFund:ce,onPercentageChange:(V,z)=>Q(V,{percentage:$f(z)})}),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(te.Plus,{className:"size-5",strokeWidth:2}),isDisabled:T,onPress:()=>j?Y():f(),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:!R||r,onPress:ne,children:N.saveAssignment})]})]}),m]})},"installment-fund-assignment")}),d&&t.jsx(Lf,{funds:s,labels:N,selectedFundIds:e.map(V=>V.fund?.id).filter(Boolean),portalContainer:k,onSelect:ie,onClose:b}),t.jsx(la,{isOpen:U,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:k,shouldBlockScroll:!1,classNames:kf,onClose:()=>G(!1),onConfirm:X})]})}function Ef({assignments:e,labels:s,total:n,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(te.Plus,{className:"size-5",strokeWidth:2}),onPress:()=>i(d.id),children:s.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:p=>l(d.id,Number(p.target.value)),endContent:t.jsx("span",{className:"text-sm text-zinc-500",children:"%"}),classNames:Cf})}),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":s.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:{...Gt,base:c.cn(Gt.base,a?"bg-warning-50 text-warning-700":"bg-success-50 text-success-700"),iconWrapper:c.cn(Gt.iconWrapper,a?"text-warning-700":"text-success-700"),alertIcon:c.cn(Gt.alertIcon,a?"text-warning-700":"text-success-700"),title:c.cn(Gt.title,a?"text-warning-700":"text-success-700")},title:a?r:`${s.total} ${Number(n.toFixed(2))}%`})]})}function Lf({funds:e,labels:s,selectedFundIds:n,portalContainer:a,onSelect:r,onClose:i}){const[o,l]=h.useState(""),d=e.filter(u=>{if(n.includes(u.id))return!1;const p=o.trim().toLowerCase();return p?`${u.glCode} ${u.accountName} ${u.type}`.toLowerCase().includes(p):!0});return t.jsx(os,{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:s.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":s.searchPlaceholder,value:o,placeholder:s.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:s.glCode}),t.jsx("span",{children:s.accountName}),t.jsx("span",{children:s.actions})]}),d.length===0&&t.jsx("div",{className:"p-4 text-sm text-zinc-500",children:s.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:s.select})]},u.id))]})]})]})})}function Ff(){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(oe,{className:"h-7 w-56 rounded-lg"}),t.jsx(oe,{className:"size-8 rounded-full"})]}),t.jsxs("div",{className:"flex items-center justify-between gap-3",children:[t.jsx(oe,{className:"h-10 w-72 rounded-full"}),t.jsx(oe,{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(oe,{className:"h-8 w-full max-w-xs rounded-full"}),t.jsx(oe,{className:"h-8 w-full rounded-xl"})]}),t.jsx(oe,{className:"h-11 w-40 rounded-full"})]})}const _f={totalAmount:"Total Amount:",remainingBalance:"Remaining Balance",amountReceived:"Amount Received:"};function Rf({totalAmount:e,remainingBalance:s,amountReceived:n,currency:a="USD",locale:r="en-US",labels:i,className:o}){const l={..._f,...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(cn,{label:l.totalAmount,value:d.format(e)}),t.jsx(cn,{label:l.remainingBalance,value:d.format(s)}),t.jsx(cn,{label:l.amountReceived,value:d.format(n)})]})})}function cn({label:e,value:s}){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:s})]})}const Mf={monthly:1,quarterly:3,annual:12},Nl=e=>{const[s,n,a]=e.split("-").map(Number);return{year:s,month:n,day:a}},Pf=(e,s)=>new Date(e,s+1,0).getDate(),Tf=e=>{const s=e.getFullYear(),n=String(e.getMonth()+1).padStart(2,"0"),a=String(e.getDate()).padStart(2,"0");return`${s}-${n}-${a}`},If=(e,s)=>{const{year:n,month:a,day:r}=Nl(e),i=a-1+s,o=n+Math.floor(i/12),l=(i%12+12)%12,d=Math.min(r,Pf(o,l));return new Date(o,l,d)},Of=(e,s)=>{const{year:n,month:a,day:r}=Nl(e),i=new Date(n,a-1,r);return i.setDate(i.getDate()+s),i};function Cl(e,s){const n=Math.max(1,Math.floor(s.numberOfInstallments||1)),a=Math.round(e*100),r=Math.floor(a/n),i=a-r*n,o=Mf[s.frequency];return Array.from({length:n},(l,d)=>{const u=s.frequency==="weekly"?Of(s.firstInstallmentDate,d*7):If(s.firstInstallmentDate,d*(o??1));return{id:crypto.randomUUID(),dueDate:Tf(u),amount:(r+(d===0?i:0))/100}})}function Bf(e){return new Set(e.map((s,n)=>{const a=e[n+1]?.dueDate;return s.dueDate&&a&&s.dueDate>a?s.id:null}).filter(s=>!!s))}function zf(e){return{missingDateRows:new Set(e.filter(s=>!s.dueDate).map(s=>s.id)),invalidDateRows:Bf(e),invalidAmountRows:new Set(e.filter(s=>Number(s.amount||0)<=0).map(s=>s.id))}}function Vf(e){return e.missingDateRows.size>0||e.invalidDateRows.size>0||e.invalidAmountRows.size>0}function Uf(e,s){const n=e[0];return!n||!s||n.dueDate===s?e:[{...n,dueDate:s},...e.slice(1)]}const Hf=new Set(["paid","partially_refunded","refunded"]);function kt(e){return e!==void 0&&Hf.has(e)}const Wf={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."},qf=["weekly","monthly","quarterly","annual"],Gf=Array.from({length:31},(e,s)=>s+1),Kf=["numberOfInstallments","frequency","firstInstallmentDate"],vr=()=>({id:crypto.randomUUID(),dueDate:new Date().toISOString().slice(0,10),amount:0}),_s=e=>Math.round(e*100)/100,Yf=(e,s)=>{const n=new Date(`${e}T00:00:00`);return Number.isNaN(n.getTime())?e:new Intl.DateTimeFormat(s,{month:"short",day:"numeric",year:"numeric"}).format(n)},Hs=e=>{if(!e)return null;try{return $u(e)}catch{return null}},Qf=e=>Hs(e)?.day??1,Zf=(e,s)=>new Date(e,s,0).getDate(),Xf=(e,s)=>{const n=Hs(e);if(!n)return e;const a=Math.min(s,Zf(n.year,n.month));return n.set({day:a}).toString()},jr=e=>{const s=e%100>=11&&e%100<=13?"th":e%10===1?"st":e%10===2?"nd":e%10===3?"rd":"th";return`${e}${s}`};function Jf({mode:e,donationAmount:s,currency:n="USD",locale:a="en-US",installments:r,automaticSettings:i,defaultTab:o="automatic",showTitle:l=!0,showCard:d=!0,showSavePayment:u=!0,showTabs:p=!0,inputs:m=Kf,startDate:x,firstInstallmentDateOverride:f,labels:b,classNames:v,isSaving:g=!1,showSavedIndicator:y=!1,isModeSwitchDisabled:w=!1,onModeChange:k,onAutomaticSettingsChange:N,onInstallmentsChange:$,onSave:E,onCancel:j}){const[L,S]=h.useState(o),M={...Wf,...b},D=e??L,A=h.useMemo(()=>new Intl.NumberFormat(a,{style:"currency",currency:n}),[n,a]),R=h.useMemo(()=>({...i,firstInstallmentDate:m.includes("firstInstallmentDate")?i.firstInstallmentDate:m.includes("dayOfMonth")?i.firstInstallmentDate||x||"":x||i.firstInstallmentDate}),[i,m,x]),T=D==="automatic"?Uf(Cl(s,R),m.includes("firstInstallmentDate")?void 0:f):r,U=h.useMemo(()=>_s(T.reduce((Z,Ie)=>Z+Number(Ie.amount||0),0)),[T]),G=Math.abs(U-s)>.009,I=_s(s-U)<=0,se=h.useMemo(()=>zf(r),[r]),q=D==="manual"&&Vf(se),Q=G||q,Y=l?t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(te.CircleDollarSign,{className:"size-4 text-zinc-500",strokeWidth:1.75}),t.jsx("span",{className:"text-base font-medium leading-6 text-zinc-950",children:M.title}),y?t.jsx(c.Chip,{size:"sm",radius:"full",color:"success",variant:"flat",children:M.saved}):null]}):void 0,ce=Z=>{Z!==D&&(e||S(Z),k?.(Z),Z==="manual"&&r.length===0&&$([vr()]))},ne=(Z,Ie)=>{const Le=r.find(Fe=>Fe.id===Z);kt(Le?.status)||$(r.map(Fe=>Fe.id===Z?{...Fe,...Ie}:Fe))},X=()=>{$([...r,vr()])},ie=Z=>{const Ie=r.find(Le=>Le.id===Z);kt(Ie?.status)||$(r.filter(Le=>Le.id!==Z))},V=()=>{g||Q||E?.()},z=t.jsxs("div",{className:c.cn("flex w-full flex-col gap-4",v?.content),children:[p||u||j?t.jsxs("div",{className:"flex w-full items-center justify-between gap-6",children:[p?t.jsx(ep,{mode:D,labels:M,onModeChange:ce,isDisabled:w,className:v?.tabs}):null,t.jsxs("div",{className:"ml-auto flex items-center gap-3",children:[j?t.jsx(O,{type:"button","data-testid":"installment-schedule-cancel-button",size:"md",variant:"bordered",radius:"full",className:"min-w-28",isDisabled:g,onPress:j,children:M.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:g?void 0:t.jsx(P,{icon:"solar:cloud-upload-outline",className:"size-4"}),isLoading:g,isDisabled:g||Q,onPress:V,children:M.saveInstallments}):null]})]}):null,t.jsxs("div",{className:c.cn("flex w-full flex-col gap-4",v?.preview),children:[D==="automatic"&&t.jsx(tp,{settings:R,inputs:m,labels:M,className:v?.controls,onSettingsChange:N}),T.length===0&&t.jsx(c.Alert,{isClosable:!1,color:"default",variant:"flat",radius:"full",title:D==="automatic"?M.emptyAutomatic:M.emptyManual}),T.length>0&&t.jsx(sp,{mode:D,installments:T,rowErrors:se,labels:M,formatter:A,locale:a,onUpdateInstallment:ne,onRemoveInstallment:ie}),D==="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(te.Plus,{className:"size-5",strokeWidth:2}),isDisabled:I,onPress:X,children:M.addInstallment})}),t.jsx(ip,{total:U,donationAmount:s,hasTotalMismatch:G,mode:D,installments:T,formatter:A,labels:M,className:v?.summary})]})]});return t.jsx("div",{className:c.cn("vvt-ps relative font-sans text-zinc-900",v?.root),children:d?t.jsx(c.Accordion,{variant:"splitted",defaultSelectedKeys:["installment-schedule"],className:c.cn("w-full gap-0 px-0",v?.panel),itemClasses:{base:"w-full rounded-2xl border border-zinc-200 bg-white p-0 shadow-sm",trigger:c.cn("px-4 py-4",v?.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":M.title,title:Y,children:z},"installment-schedule")}):z})}function ep({mode:e,labels:s,className:n,isDisabled:a=!1,onModeChange:r}){return t.jsxs(c.Tabs,{"aria-label":s.title,selectedKey:e,isDisabled:a,color:"primary",size:"lg",radius:"full",className:c.cn("w-fit",n),onSelectionChange:i=>r(i),children:[t.jsx(c.Tab,{title:s.automaticMode},"automatic"),t.jsx(c.Tab,{title:s.manualMode},"manual")]})}function tp({settings:e,inputs:s,labels:n,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:n.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(it,{variant:"bordered",label:n.frequency,labelPlacement:"outside",selectedKeys:[e.frequency],onSelectionChange:l=>{const d=Array.from(l)[0];typeof d=="string"&&r({...e,frequency:d})},children:qf.map(l=>t.jsx(c.SelectItem,{textValue:n[l],children:n[l]},l))})},o);if(o==="dayOfMonth"){const l=String(Qf(e.firstInstallmentDate));return t.jsx("div",{className:"min-w-0",children:t.jsx(it,{variant:"bordered",label:n.dayOfMonth,labelPlacement:"outside",selectedKeys:[l],onSelectionChange:d=>{const u=Number(Array.from(d)[0]);Number.isFinite(u)&&r({...e,firstInstallmentDate:Xf(e.firstInstallmentDate,u)})},children:Gf.map(d=>t.jsx(c.SelectItem,{textValue:jr(d),children:jr(d)},String(d)))})},o)}return t.jsx("div",{className:"min-w-0",children:t.jsx(Qn,{variant:"bordered",label:n.firstInstallmentDate,labelPlacement:"outside",value:Hs(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 s.length===0?null:t.jsx("div",{className:c.cn("grid gap-4",a),style:{gridTemplateColumns:"repeat(auto-fit, minmax(min(100%, 14rem), 1fr))"},children:s.map(i)})}function sp({mode:e,installments:s,rowErrors:n,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",s.length>5&&"max-h-[264px] overflow-y-auto pr-2"),children:s.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:Yf(d.dueDate,i)}),u===0&&s.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:s.map((d,u)=>{const p=n.missingDateRows.has(d.id),m=n.invalidDateRows.has(d.id),x=n.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(Qn,{variant:"bordered","aria-label":`${a.dueDate} ${u+1}`,isDisabled:kt(d.status),isInvalid:p||m,errorMessage:p?a.dueDateRequiredError:m?a.dateOrderError:void 0,value:Hs(d.dueDate),onChange:f=>o(d.id,{dueDate:f?f.toString():""})})}),t.jsx("div",{className:"min-w-0 flex-1",children:t.jsx(ap,{amount:d.amount,ariaLabel:`${a.amount} ${u+1}`,isDisabled:kt(d.status),isInvalid:x,errorMessage:a.amountGreaterThanZeroError,onAmountChange:f=>o(d.id,{amount:f})})}),t.jsx(rp,{isDisabled:s.length<=1,isPaid:kt(d.status),label:a.deleteInstallment,onRemove:()=>l(d.id)})]})},d.id)})})}const np=/^\d*(?:[.,]\d{0,2})?$/;function ap({amount:e,ariaLabel:s,isDisabled:n,isInvalid:a,errorMessage:r,onAmountChange:i}){const[o,l]=h.useState(null);return t.jsx(c.Input,{variant:"bordered","aria-label":s,type:"text",inputMode:"decimal",autoComplete:"off",isDisabled:n,isInvalid:a,errorMessage:a?r:void 0,value:o??(e?String(e):""),onChange:d=>{const u=d.target.value.trim();if(!np.test(u))return;l(u);const p=Number(u.replace(",","."));i(_s(Number.isFinite(p)?p:0))},onBlur:()=>l(null),startContent:t.jsx("span",{className:"text-zinc-900",children:"$"})})}function rp({isDisabled:e,isPaid:s,label:n,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||s,onPress:a,"aria-label":n,children:t.jsx(P,{icon:"solar:trash-bin-minimalistic-outline",className:"size-5"})});return s?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 ip({total:e,donationAmount:s,hasTotalMismatch:n,mode:a,installments:r,formatter:i,labels:o,className:l}){const d=r.length,u=r[0]?.amount??0,p=r[1]?.amount??u,m=d>1&&Math.round(u*100)!==Math.round(p*100),x=_s(s-e),f=Math.max(x,0),b=Math.max(-x,0),v=n?t.jsxs("span",{children:[o.totalError,". Total scheduled: ",t.jsx("strong",{children:i.format(e)})," /"," ",t.jsx("strong",{children:i.format(s)}),"."]}):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(p)})," 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(s)}),"."]}),g=a==="automatic"?`Total: ${i.format(e)}`:b>0?`Exceeds by: ${i.format(b)}`:`${o.remaining}: ${i.format(f)}`;return t.jsx(c.Alert,{isClosable:!1,color:n?"danger":"default",variant:"flat",radius:"full",className:l,endContent:t.jsx("span",{className:"whitespace-nowrap",children:g}),title:v})}function lp(){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(oe,{className:"h-7 w-56 rounded-lg"}),t.jsx(oe,{className:"size-8 rounded-full"})]}),t.jsxs("div",{className:"flex items-center justify-between gap-3",children:[t.jsx(oe,{className:"h-10 w-72 rounded-full"}),t.jsx(oe,{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(oe,{className:"h-4 w-36 rounded-md"}),t.jsx(oe,{className:"h-9 w-full rounded-xl"})]}),t.jsx(oe,{className:"h-9 w-36 rounded-full"})]}),t.jsx("div",{className:"flex flex-col gap-3",children:Array.from({length:4}).map((e,s)=>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(oe,{className:"h-8 w-full max-w-xs rounded-full"}),t.jsx(oe,{className:"h-8 w-full rounded-xl"})]},s))})]})}const wr={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"},kl={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"},op={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:kl.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."},cp={wrapper:"!absolute !inset-0 !z-50 !items-center !justify-center !p-4",backdrop:"!absolute !inset-0 !z-40 rounded-2xl"},dp=[];function up({installments:e,currency:s,locale:n="en-US",showTitle:a=!0,showCard:r=!0,showEditPayment:i=!0,showDelete:o=!0,payNowHiddenStatuses:l=dp,showSavedIndicator:d=!1,labels:u,isSaving:p=!1,onEditInstallments:m,onPayInstallment:x,onDeleteInstallment:f}){const[b,v]=h.useState(null),g={...op,...u},[y,w]=h.useState(""),k=new Intl.NumberFormat(n,{style:"currency",currency:s}),N=e.some(S=>Sl(S)!==null),$=e.some(S=>S.status==="partially_refunded"),E=a?t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(te.CircleDollarSign,{className:"size-4 text-zinc-500",strokeWidth:1.75}),t.jsx("span",{className:"text-base font-medium leading-6 text-zinc-950",children:g.title}),d?t.jsx(c.Chip,{size:"sm",radius:"full",color:"success",variant:"flat",children:g.saved}):null]}):void 0,j=h.useMemo(()=>{const S=y.trim().toLowerCase();if(!S)return e;const M=new Intl.NumberFormat(n,{style:"currency",currency:s});return e.filter(D=>{const A=D.status??"scheduled";return[dn(D),D.id,D.amount,D.dueDate,ks(D.dueDate,n),un(D,g.paidOn,n),mn(D,g.refundedAmount,M),A,fn(A,g.partiallyRefunded)].join(" ").toLowerCase().includes(S)})},[n,s,e,y,g.paidOn,g.refundedAmount,g.partiallyRefunded]),L=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:g.searchLabel}),t.jsx(c.Input,{variant:"bordered",size:"md",value:y,placeholder:g.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:p,onPress:m,children:g.editInstallments}):null]}),t.jsx("div",{className:c.cn("hidden [@container(max-width:767px)]:block",j.length>3&&"max-h-[560px] overflow-y-auto pr-1"),children:t.jsxs("div",{className:"flex flex-col gap-2",children:[j.map((S,M)=>{const D=S.status??"scheduled",A=dn(S),R=un(S,g.paidOn,n),T=mn(S,g.refundedAmount,k);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:["#",M+1]}),t.jsx("p",{className:"truncate text-sm font-medium text-foreground",children:A||`PMT-${M+1}`})]}),t.jsx(Nr,{status:D,label:fn(D,g.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:g.amount}),t.jsx("p",{className:"font-medium text-foreground",children:k.format(S.amount)}),T?t.jsx("p",{className:"text-xs text-default-500",children:T}):null]}),t.jsxs("div",{className:"text-right",children:[t.jsx("p",{className:"text-xs text-default-500",children:g.scheduledDate}),t.jsx("p",{className:"font-medium text-foreground",children:ks(S.dueDate,n)}),R?t.jsx("p",{className:"text-xs text-default-500",children:R}):null]})]}),t.jsx(Cr,{status:D,installment:S,labels:g,portalContainer:b??void 0,showDelete:o,payNowHiddenStatuses:l,onPayInstallment:x,onDeleteInstallment:f})]})},S.id)}),j.length===0&&t.jsx("div",{className:"rounded-lg border border-default-200 px-4 py-6 text-center text-sm text-default-500",children:g.noInstallmentsFound})]})}),t.jsx("div",{className:c.cn("w-full overflow-x-hidden [@container(max-width:767px)]:hidden",j.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:$?"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:g.installmentId}),t.jsx("th",{className:"px-2 py-3 font-medium",children:g.amount}),t.jsx("th",{className:"px-2 py-3 font-medium",children:g.scheduledDate}),t.jsx("th",{className:"whitespace-nowrap px-2 py-3 font-medium",children:g.status}),t.jsx("th",{className:"whitespace-nowrap py-3 pl-4 pr-2 font-medium",children:g.actions})]})}),t.jsxs("tbody",{children:[j.map((S,M)=>{const D=S.status??"scheduled",A=dn(S),R=un(S,g.paidOn,n),T=mn(S,g.refundedAmount,k);return t.jsxs("tr",{className:"text-zinc-500",children:[t.jsx("td",{className:"px-2 py-3",children:M+1}),t.jsx("td",{className:"overflow-hidden px-2 py-3",children:t.jsx("span",{className:"block w-full truncate",children:A||`PMT-${M+1}`})}),t.jsxs("td",{className:"px-2 py-3",children:[k.format(S.amount),T?t.jsx("span",{className:"block text-xs",children:T}):null]}),t.jsxs("td",{className:"px-2 py-3",children:[ks(S.dueDate,n),R?t.jsx("span",{className:"block text-xs",children:R}):null]}),t.jsx("td",{className:"whitespace-nowrap px-2 py-3",children:t.jsx(Nr,{status:D,label:fn(D,g.partiallyRefunded)})}),t.jsx("td",{className:"whitespace-nowrap py-3 pl-4 pr-2",children:t.jsx(Cr,{status:D,installment:S,labels:g,portalContainer:b??void 0,showDelete:o,payNowHiddenStatuses:l,onPayInstallment:x,onDeleteInstallment:f})})]},S.id)}),j.length===0&&t.jsx("tr",{children:t.jsx("td",{colSpan:6,className:"px-2 py-6 text-center text-zinc-500",children:g.noInstallmentsFound})})]})]})})]});return t.jsx("div",{ref:v,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":g.title,title:E,children:L},"installment-table")}):L})}function dn(e){return e.name?.trim()||e.id}function un(e,s,n){return!kt(e.status)||!e.fulfilledAt?null:`${s} ${ks(e.fulfilledAt,n)}`}function Sl(e){const{refundedAmount:s}=e;return e.status!=="partially_refunded"||typeof s!="number"||!Number.isFinite(s)||s<=0?null:s}function mn(e,s,n){const a=Sl(e);return a===null?null:`${s} ${n.format(a)}`}function fn(e,s){return e==="partially_refunded"?s:kl[e]??e}function Nr({status:e,label:s}){return t.jsx(c.Chip,{size:"md",radius:"lg",className:c.cn("justify-center px-4",wr[e]??wr.scheduled),startContent:t.jsx(fp,{status:e}),children:s})}function Cr({status:e,installment:s,labels:n,portalContainer:a,showDelete:r,payNowHiddenStatuses:i,onPayInstallment:o,onDeleteInstallment:l}){const d=!i.includes(e),u=kt(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?.(s),children:n.payNow}):null,t.jsx(mp,{isFulfilled:u,showDelete:r,labels:n,portalContainer:a,onDelete:()=>l(s.id)})]})}function mp({isFulfilled:e,showDelete:s,labels:n,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"&&s&&!e&&o(!0)},children:[t.jsx(c.DropdownSection,{title:"Actions",showDivider:s,children:t.jsx(c.DropdownItem,{textValue:n.sendLink,description:n.sendLinkDescription,startContent:t.jsx(P,{icon:"solar:link-outline",className:"size-5 text-zinc-500"}),children:n.sendLink},"send-link")}),s?t.jsx(c.DropdownSection,{title:n.dangerZone,children:t.jsx(c.DropdownItem,{textValue:n.deleteInstallment,className:"text-danger-600",color:"danger",description:n.deleteInstallmentDescription,startContent:t.jsx(P,{icon:"solar:trash-bin-minimalistic-outline",className:"size-5"}),children:n.deleteInstallment},"delete")}):null]})]}),s?t.jsx(la,{isOpen:i,labels:{title:n.deleteInstallmentConfirmationTitle,description:n.deleteInstallmentConfirmationDescription,cancel:n.deleteInstallmentConfirmationCancel,confirm:n.deleteInstallmentConfirmationConfirm},icon:t.jsx(P,{icon:"solar:danger-triangle-outline",className:"size-7"}),confirmColor:"danger",portalContainer:a,shouldBlockScroll:!1,classNames:cp,onClose:()=>o(!1),onConfirm:()=>{o(!1),r()}}):null]})}function fp({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 pp=/^\d{4}-\d{2}-\d{2}$/;function ks(e,s){const n=pp.test(e)?new Date(`${e}T00:00:00`):new Date(e);return Number.isNaN(n.getTime())?e:new Intl.DateTimeFormat(s,{month:"short",day:"numeric",year:"numeric"}).format(n)}const xp={title:"Select Membership",renewalTitle:"Automatic Renewal",renewalDescription:"Membership will automatically renew at the end of each period"},hp=({cards:e,locale:s,currency:n,listHeightClassName:a="",labels:r,showRenewal:i=!0,defaultRenewalValue:o=!1,initialSelectedMembershipId:l=null,allowReselect:d=!0,onRenewalChange:u,onCardSelect:p,className:m=""})=>{const x=Array.isArray(e)?e:[],[f,b]=h.useState(l),[v,g]=h.useState(o),y={...xp,...r};h.useEffect(()=>{b(l)},[l]);const w=N=>{if(N===f){d&&p?.(N);return}b(N),p?.(N)},k=N=>{g(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:f??""}),t.jsx("p",{className:"text-2xl font-semibold text-left","data-testid":"membership-select-cards-title",children:y.title}),i&&t.jsx(Fl,{title:y.renewalTitle,description:y.renewalDescription,value:v,onValueChange:k}),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:x.map(N=>t.jsx($l,{itemKey:N.id,name:N.name,type:N.type,price:N.price,locale:s,currency:n,isSelected:f===N.id,onSelect:w},N.id))})]})},$l=({itemKey:e,name:s,type:n,price:a,locale:r="en-US",currency:i="USD",showPrice:o=!0,isSelected:l=!1,onSelect:d,compact:u=!1,isDisabled:p=!1,disabledReason:m,statusLabel:x,statusTone:f="default",className:b=""})=>{const v=new Intl.NumberFormat(r,{style:"currency",currency:i,minimumFractionDigits:0,maximumFractionDigits:2}).format(a),g=!!d&&!p,y=m||x,w=()=>{g&&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",p?"opacity-60":"",u?"rounded-2xl":"",b),"data-testid":"item-card","data-selected":l,isDisabled:p,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:s}),n&&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:n})}),y&&t.jsx(c.Chip,{"data-testid":"item-card-status",color:f,size:"sm",variant:"flat",className:"px-2",children:y})]}),o&&t.jsx("p",{className:c.cn("font-semibold text-right",u?"text-lg":"text-2xl"),"data-testid":"item-card-price",children:v})]})})},kr="w-full bg-gray-100",Sr={variant:"light",color:"default"},Al=({id:e,title:s,media:n,imageUrl:a,imageAlt:r,imageClassName:i="",imageAspect:o="aspect-[4/3]",meta:l=[],price:d,action:u,footer:p,onPress:m,isPressable:x=!1,isDisabled:f=!1,compact:b=!1,className:v="",bodyClassName:g="",footerClassName:y="",dataTestId:w})=>{const k=!!(d&&d.value),N=!!u?.label,$=x&&!!m&&!N,E=!$,j=N?{variant:u?.variant??Sr.variant,color:u?.color??Sr.color,size:u?.size??"sm",isDisabled:f||u?.isDisabled,startContent:u?.icon?t.jsx(P,{icon:u.icon,width:16}):void 0}:null,L=n??(a?t.jsx("div",{className:c.cn("relative overflow-hidden rounded-xl",o,kr,i),children:t.jsx(c.Image,{removeWrapper:!0,src:a,alt:r||s,className:"size-full object-cover",classNames:{wrapper:"absolute inset-0"}})}):t.jsx("div",{className:c.cn("relative overflow-hidden rounded-xl",o,kr,"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",v),isPressable:$,onPress:m,isDisabled:f,shadow:"sm",radius:"lg",children:[t.jsx("div",{children:L}),t.jsxs(c.CardBody,{className:c.cn("gap-3",b?"p-3":"p-4",g),children:[t.jsx("h3",{"data-testid":`catalog-item-card-title-${e??""}`,className:c.cn("line-clamp-2 text-base font-semibold text-gray-900",b?"text-sm":""),children:s}),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,M)=>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}-${M}`))}):null,(k||N)&&t.jsxs("div",{className:c.cn("flex items-center justify-end gap-2 pt-1 text-sm",b?"pt-0.5":"",y),children:[k?t.jsxs("span",{className:c.cn("mr-auto text-gray-500",b?"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&&E?t.jsx(O,{className:c.cn("rounded-full",u?.className),onPress:u?.onPress,variant:j?.variant,color:j?.color,size:j?.size,startContent:j?.startContent,isDisabled:j?.isDisabled,"aria-label":u?.ariaLabel||u?.label,children:u?.label}):null]}),p?t.jsx("div",{className:"pt-1",children:p}):null]})]})};Al.displayName="CatalogItemCard";const bp={open:"Open","selling-fast":"Selling fast","sold-out":"Sold out"};function Dl({title:e,subtitle:s,price:n,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:s})]}),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:bp[r]}):null,n?t.jsxs("strong",{className:"ml-5 whitespace-nowrap text-xl",children:["from ",n]}):null]})})}Dl.displayName="ProgramListItem";const gp={card:"gap-3 rounded-xl border border-dashed px-6 py-12",panel:"px-6 py-[72px]"},yp={card:"size-12 rounded-2xl",panel:"size-[76px] rounded-[20px] border mb-[18px]"},vp={card:"text-base font-medium text-default-900",panel:"text-[17px] font-semibold text-acct-ink"},jp={card:"max-w-sm text-sm text-default-600",panel:"max-w-[380px] text-sm text-acct-sub mt-1.5"},wp={card:"text-xs text-default-500",panel:"text-xs text-acct-sub mt-2"},Np={card:"mt-1",panel:"mt-[22px]"},Cp="bg-acct-page border-acct-border text-acct-muted",kp={empty:"solar:inbox-line-duotone",error:"solar:danger-triangle-outline",success:"solar:check-circle-bold"},Sp={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"},$p={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"},Ap={empty:"status",error:"alert",success:"status",loading:"status"},Dp={empty:"polite",error:"assertive",success:"polite",loading:"polite"};function Ep(e,s,n,a){if(s===!1)return null;if(e==="loading"&&s===void 0)return t.jsx(c.Spinner,{size:"lg",color:"primary",className:a.spinner});if(h.isValidElement(s))return t.jsx(t.Fragment,{children:s});const r=typeof s=="string"?s:kp[e];return r?t.jsx(P,{icon:r,width:n,height:n,"aria-hidden":"true",className:a.icon}):null}function El({variant:e="empty",surface:s="card",title:n,titleAs:a="p",description:r,icon:i,actions:o,role:l=Ap[e],ariaLive:d=Dp[e],iconSize:u=24,className:p,classNames:m={},"data-testid":x="feedback-state",referenceCode:f,referenceCodeLabel:b="Reference code:"}){const v=Ep(e,i,u,m);return t.jsxs("div",{role:l,"aria-live":d,"data-variant":e,"data-testid":x,"data-surface":s,className:c.cn("flex flex-col items-center justify-center text-center",gp[s],s==="card"?Sp[e]:"bg-transparent",p,m.base),children:[v?t.jsx("span",{"aria-hidden":"true","data-testid":`${x}-icon`,className:c.cn("inline-flex items-center justify-center",yp[s],e==="success"&&s==="card"&&"rounded-full",s==="panel"?Cp:$p[e],m.iconWrapper),children:v}):null,t.jsxs("div",{className:c.cn("flex flex-col items-center",s==="card"&&"gap-1"),children:[t.jsx(a,{"data-testid":`${x}-title`,className:c.cn(vp[s],m.title),children:n}),r?t.jsx("p",{"data-testid":`${x}-description`,className:c.cn(jp[s],m.description),children:r}):null,f?t.jsxs("p",{"data-testid":`${x}-reference-code`,className:c.cn(wp[s],m.referenceCode),children:[b," ",t.jsx("span",{className:"select-all font-mono",children:f})]}):null]}),o?t.jsx("div",{"data-testid":`${x}-actions`,className:c.cn("flex flex-wrap items-center justify-center gap-2",Np[s],m.actions),children:o}):null]})}function ds(e){return t.jsx(El,{...e})}function oa(e){return t.jsx(ds,{...e,variant:"empty"})}function ca(e){return t.jsx(El,{...e,variant:"error"})}function da(e){return t.jsx(ds,{...e,variant:"loading"})}function Ll(e){return t.jsx(ds,{...e,variant:"success"})}ds.displayName="FeedbackState";oa.displayName="EmptyState";ca.displayName="ErrorState";da.displayName="LoadingState";Ll.displayName="SuccessState";const Fl=({title:e,value:s,description:n,onValueChange:a,className:r=""})=>{const i=h.useId();return t.jsxs("div",{className:c.cn("w-full flex flex-row items-center",e||n?"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}),n&&t.jsx("p",{className:"text-left text-gray-500","data-testid":"toggle-description",children:n})]}),t.jsx(c.Switch,{id:i,isSelected:s,onValueChange:a,"data-testid":"toggle-switch"})]})},Lp={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"},Fp=(e,s)=>new Intl.NumberFormat(e,{style:"currency",currency:s}),_l=e=>Object.values(e).reduce((s,n)=>s+Object.values(n).reduce((a,r)=>a+Object.values(r).reduce((i,o)=>i+o.selectedQuantity,0),0),0),_p=e=>e.reduce((s,n)=>s+n.dates.reduce((a,r)=>a+r.tickets.reduce((i,o)=>i+o.max,0),0),0),ua=e=>e.flatMap(s=>s.dates.flatMap(n=>n.tickets.map(a=>({exhibition:s,dateGroup:n,ticket:a})))),$r=(e,s,n)=>{const a={};let r=n?s??_p(e):0;for(const{exhibition:i,dateGroup:o,ticket:l}of ua(e)){a[i.id]??={},a[i.id][o.id]??={};const d=n?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},Ar=(e,s,n)=>`${e}::${s}::${n}`,Rp=(e,s,n)=>{const a=_l(s);for(const{exhibition:r,dateGroup:i,ticket:o}of ua(e)){const l=s[r.id]?.[i.id]?.[o.id]?.selectedQuantity??0,d=n===void 0?o.max:Math.min(o.max,n-(a-l));if(d>0&&l<d)return!1}return!0},Mp=({initialQuantity:e=1,minQuantity:s=1,maxQuantity:n=10,onChange:a,disabled:r=!1})=>{const i=Math.max(s,Math.min(n,e)),[o,l]=h.useState(()=>String(i)),[d,u]=h.useState(!1),p=d?o:String(i),m=()=>{r||i>=n||a?.(i+1)},x=()=>{r||i<=s||a?.(i-1)},f=N=>{if(r)return;l(N.target.value);const $=parseInt(N.target.value,10);isNaN($)||a?.(Math.max(s,Math.min(n,$)))},b=N=>{const $=parseInt(N.target.value,10);if(u(!1),isNaN($)){a?.(s);return}const E=Math.max(s,Math.min(n,$));E!==$?a?.(E):l(String(E))},v=i<=s,g=i>=n,y="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",k="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:x,disabled:r||v,className:c.cn(y,r||v?k:w),"aria-label":"Decrement quantity","data-testid":"quantity-decrement",children:"-"}),t.jsx("input",{type:"number",value:p,onChange:f,onFocus:()=>u(!0),onBlur:b,disabled:r,min:s,max:n,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||g,className:c.cn(y,r||g?k:w),"aria-label":"Increment quantity","data-testid":"quantity-increment",children:"+"})]})},Pp=({label:e,checked:s=!1,onChange:n,disabled:a=!1})=>{const r=()=>{a||n?.(!s)};return t.jsxs("button",{type:"button",onClick:r,disabled:a,role:"checkbox","aria-checked":s,"data-testid":"checkbox-button","data-checked":s,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:s,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",s?"bg-primary":"bg-white ring-1 ring-zinc-300"),children:s&&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})]})},Tp=({item:e,quantity:s,onChange:n,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-s))},d=i?.locale??"en-US",u=i?.currency??"USD",p=Fp(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:p.format(e.originalPrice)}),t.jsx("h3",{className:"text-base font-semibold text-zinc-900 m-0","data-testid":"ticket-discounted-price",children:p.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(Mp,{initialQuantity:s,minQuantity:0,maxQuantity:l(),onChange:n})]}),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]})},Ip=({exhibitionId:e,dateGroup:s,isLast:n=!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",!n&&"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:s.date}),s.tickets.map((u,p)=>t.jsxs("div",{children:[t.jsx(Tp,{item:u,quantity:r(e,s.id,u.id),onChange:m=>a(e,s.id,u.id,m),getTotalSelectedTickets:i,userMaxLimit:o,settings:l,labels:d}),p<s.tickets.length-1?t.jsx(c.Divider,{className:"bg-zinc-200","data-testid":"upgrade-ticket-divider"}):null]},u.id))]}),Op=({title:e,exhibition:s,onQuantityChange:n,getTicketQuantity:a,getTotalSelectedTickets:r,userMaxLimit:i,settings:o,labels:l,initialExpanded:d=!1})=>{const[u,p]=h.useState(d),m=s.dates.reduce((f,b)=>f+b.tickets.reduce((v,g)=>v+a(s.id,b.id,g.id),0),0),x=s.dates.some(f=>f.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:()=>p(!u),"aria-expanded":u,"aria-controls":`upgrade-items-${s.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-${s.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:x?s.dates.map((f,b)=>t.jsx(Ip,{exhibitionId:s.id,dateGroup:f,isLast:b===s.dates.length-1,onQuantityChange:n,getTicketQuantity:a,getTotalSelectedTickets:r,userMaxLimit:i,settings:o,labels:l},f.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})})})})]})},Bp=({initialExpanded:e=!1,userMaxLimit:s,labels:n,settings:a,ticketSelectionData:r,className:i="",onSelectionChange:o})=>{const l=h.useMemo(()=>r??[],[r]),d={...Lp,...n},[u,p]=h.useState(()=>$r(l,s,!0)),m=h.useRef(!1),x=h.useMemo(()=>{const w=ua(l).map(({exhibition:k,dateGroup:N,ticket:$})=>[Ar(k.id,N.id,$.id),$]);return new Map(w)},[l]),f=Rp(l,u,s),b=(w,k,N)=>u[w]?.[k]?.[N]?.selectedQuantity??0,v=()=>_l(u),g=(w,k,N,$)=>{const E=b(w,k,N),j=v()-E;if(s!==void 0&&j+$>s)return;const L=x.get(Ar(w,k,N));if(!L)return;const S={...u,[w]:{...u[w],[k]:{...u[w]?.[k],[N]:{id:N,selectedQuantity:$,originalPrice:L.originalPrice,discountedPrice:L.price}}}};p(S),o?.(S)},y=w=>{const k=$r(l,s,w);p(k),o?.(k)};return h.useEffect(()=>{!m.current&&f&&(o?.(u),m.current=!0)},[f,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(Pp,{label:d.selectAllButtonLabel,checked:f,onChange:y})]}),l.map(w=>t.jsx(Op,{title:w.exhibitionName,exhibition:w,onQuantityChange:g,getTicketQuantity:b,getTotalSelectedTickets:v,userMaxLimit:s,settings:a,labels:d,initialExpanded:e},w.id))]})},pn={confirm:"Confirm",clear:"Clear",noLabel:"Filters"},xn=e=>{const s={};for(const n of e)n.type==="checkbox"?s[n.id]=[...n.selectedValues]:s[n.id]=n.selectedValue?[n.selectedValue]:[];return s},zp=(e,s)=>{const n={};for(const a of s){if(a.type==="checkbox"){n[a.id]=e[a.id]??[...a.selectedValues];continue}const r=e[a.id]??[];n[a.id]=r.length>0?r[0]:null}return n},Vp=e=>e.type==="checkbox"?e.selectedValues.length>0:e.selectedValue!==null,Rl=({triggerLabel:e,triggerAriaLabel:s,triggerIcon:n="solar:tuning-square-outline",triggerVariant:a="bordered",triggerColor:r="default",triggerSize:i="sm",triggerClassName:o,popoverClassName:l,className:d,sections:u,onConfirm:p,onClear:m,appliedCount:x,countAriaLabel:f,countDisplay:b="badge",confirmLabel:v=pn.confirm,clearLabel:g=pn.clear,isOpen:y,defaultOpen:w=!1,onOpenChange:k,isDisabled:N=!1,closeOnConfirm:$=!0,keepOpenAfterClear:E=!1})=>{const[j,L]=h.useState(w),[S,M]=h.useState(()=>xn(u)),D=y??j,A=x??u.filter(Y=>Vp(Y)).length,R=Y=>{Y&&M(xn(u)),y||L(Y),k?.(Y)},T=(Y,ce)=>{M(ne=>({...ne,[Y.id]:ce}))},U=(Y,ce)=>{M(ne=>({...ne,[Y.id]:ce?[ce]:[]}))},G=async()=>{M(xn(u.map(Y=>Y.type==="checkbox"?{...Y,selectedValues:[]}:{...Y,selectedValue:null}))),await m(),E||R(!1)},I=async()=>{const Y=zp(S,u);await p(Y),$&&R(!1)},se=Y=>{if(Y.type==="checkbox")return t.jsx(c.CheckboxGroup,{label:Y.label,value:S[Y.id]??[],onValueChange:ne=>T(Y,ne),children:Y.options.map(ne=>t.jsx(c.Checkbox,{value:ne.value,isDisabled:ne.isDisabled,children:ne.label},ne.value))},Y.id);const ce=S[Y.id]?.[0]??"";return t.jsx(c.RadioGroup,{label:Y.label,value:ce,onValueChange:ne=>U(Y,ne||null),children:Y.options.map(ne=>t.jsx(c.Radio,{value:ne.value,isDisabled:ne.isDisabled,children:ne.label},ne.value))},Y.id)},q=h.useMemo(()=>A>0?f?.(A)||`${A} filters applied`:void 0,[f,A]),Q=h.useMemo(()=>A===0?e||pn.noLabel:f?f(A):`${e} (${A})`,[A,e,f]);return t.jsx("div",{className:d,children:t.jsxs(c.Popover,{isOpen:D,onOpenChange:R,placement:"bottom-end",children:[t.jsx(c.PopoverTrigger,{children:t.jsxs(O,{isDisabled:N,variant:a,color:r,size:i,className:o,"aria-label":s,"aria-haspopup":"dialog","aria-expanded":D,children:[t.jsx(P,{icon:n,width:16}),t.jsx("span",{children:e}),b==="badge"&&A>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":q,children:A}):b==="summary"&&Q!==e?t.jsx("span",{className:"text-xs",children:Q}):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=>se(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:G,children:g}),t.jsx(O,{color:"primary",size:"sm",onPress:I,children:v})]})]})})]})})};Rl.displayName="FilterPopover";const Up="No sessions available for this date",Hp=e=>e==="sold-out"||e==="closed"?"danger":"success",Wp=e=>{const s=e.seatsRemaining;return e.status==="sold-out"||e.status==="closed"?"Sold out":e.status==="limited"?typeof s=="number"?`${s} left`:"Limited":typeof s=="number"?`${s} seats available`:"Available"},Dr=e=>e.isDisabled?!0:e.status==="sold-out"||e.status==="closed",qp=(e,s)=>s&&e.some(n=>n.date===s)?s:e[0]?.date??null,Ml=({heading:e,subheading:s,days:n,selectedDate:a,onDateSelect:r,quickDates:i,selectedSessionId:o=null,onSessionSelect:l,emptyStateMessage:d=Up,statusLabel:u,statusTone:p,sessionAriaLabel:m,dayButtonClassName:x,calendarSlot:f,dayGroupAriaLabel:b,sessionGridAriaLabel:v,className:g,headingClassName:y,subheadingClassName:w})=>{const k=qp(n,a),N=n.find(S=>S.date===k),$=i??n.map(S=>({date:S.date,label:S.label})),E=N?.sessions??[],j=S=>S===k?"solid":"bordered",L=S=>{if(!Dr(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",g),"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",y),children:e}),s?t.jsx("p",{className:c.cn("text-sm text-gray-700",w),children:s}):null]}),t.jsxs("div",{className:"flex flex-wrap items-center gap-2",role:"group","aria-label":b||"Session days",children:[$.map(S=>t.jsx(O,{size:"sm",variant:j(S.date),color:"default",className:c.cn("rounded-full",x),isDisabled:S.isDisabled,onPress:()=>{r(S.date)},children:t.jsx("span",{children:S.label})},S.date)),f?t.jsx("div",{children:f}):null]}),t.jsxs("ul",{className:"grid grid-cols-1 gap-2 sm:grid-cols-3","aria-label":v||"Sessions",children:[E.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,E.map(S=>{const M=Dr(S),D=S.id===o;return t.jsx("li",{className:"rounded-xl",children:t.jsx(c.Card,{shadow:"sm",radius:"lg",isPressable:!M,onPress:()=>{L(S)},"aria-disabled":M,"aria-pressed":M?void 0:D,className:c.cn("w-full",M?"bg-gray-100 opacity-70":"",D?"w-full ring-2 ring-gray-900":""),"aria-label":m?m(S,{isSelected:D,isUnavailable:M}):M?`${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:p?p(S):Hp(S.status),variant:"flat",children:u?u(S):Wp(S)})]})})},S.id)})]})]})};Ml.displayName="SessionTimeline";const Rn=16,mt=e=>`${e/Rn}rem`;function Gp(){if(typeof document>"u"||typeof getComputedStyle!="function")return Rn;const e=parseFloat(getComputedStyle(document.documentElement).fontSize);return Number.isFinite(e)&&e>0?e:Rn}const us=(e,s)=>e>=s*Gp(),Kp=1120;function Bt(){const e=h.useRef(null),[s,n]=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&&n(l.borderBoxSize?.[0]?.inlineSize??l.contentRect.width)});return n(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:s}}const Yp=48,tt={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"},Qp=(e,s)=>typeof e=="string"?t.jsx(P,{icon:e,className:"size-5","aria-hidden":"true"}):e||s||null,Pl=({title:e,subtitle:s,eyebrow:n,icon:a,initials:r,actions:i,titleAs:o="h1",className:l,classNames:d={},"data-testid":u="page-header",list:p,narrow:m,headerRef:x})=>{const f=Qp(a,r);return t.jsxs("header",{ref:x,"data-testid":u,"data-variant":p?"list":void 0,"data-size":p?m?"narrow":"wide":void 0,className:c.cn(p?c.cn(tt.base,m?tt.baseNarrow:tt.baseWide):"flex flex-wrap items-start justify-between gap-4",l,d.base),children:[t.jsxs("div",{className:p?tt.identity:"flex items-center gap-4",children:[f?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:f}):null,t.jsxs("div",{className:p?tt.text:void 0,children:[n?t.jsx("p",{"data-testid":`${u}-eyebrow`,className:c.cn("text-brand text-sm font-medium uppercase tracking-wide",d.eyebrow),children:n}):null,t.jsx(o,{"data-testid":`${u}-title`,className:c.cn(p?m?tt.titleNarrow:tt.titleWide:"text-3xl font-semibold text-gray-950",d.title),children:e}),s?t.jsx("p",{"data-testid":`${u}-subtitle`,className:c.cn(p?m?tt.subtitleNarrow:tt.subtitleWide:"mt-1 text-sm text-gray-600",d.subtitle),children:s}):null]})]}),i?t.jsx("div",{"data-testid":`${u}-actions`,className:c.cn(p?m?tt.actionsNarrow:tt.actionsWide:"flex flex-wrap items-center gap-2",d.actions),children:i}):null]})},Zp=e=>{const{ref:s,width:n}=Bt(),a=n>0&&!us(n,Yp);return t.jsx(Pl,{...e,list:!0,narrow:a,headerRef:s})},Tl=e=>e.variant==="list"?t.jsx(Zp,{...e}):t.jsx(Pl,{...e,list:!1,narrow:!1});Tl.displayName="PageHeader";const Je={ok:{fg:de.ok,bg:de["ok-fill"]},warn:{fg:de.warn,bg:de["warn-fill"]},danger:{fg:de.danger,bg:de["danger-fill"]},info:{fg:de.info,bg:de["info-fill"]},violet:{fg:de.violet,bg:de["violet-fill"]},neutral:{fg:de.neutral,bg:de["neutral-fill"]}};function ms(e){if(e==="positive")return{color:de.ok};if(e==="negative")return{color:de.danger}}const Xp={active:"success",success:"success",draft:"warning",pending:"warning",warning:"warning",danger:"danger",archived:"default",inactive:"default",neutral:"default",info:"default",violet:"default"},Mn={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:Je.info,violet:Je.violet},Jp={active:"ok",success:"ok",draft:"warn",pending:"warn",warning:"warn",danger:"danger",archived:"neutral",inactive:"neutral",neutral:"neutral",info:"info",violet:"violet"},ex={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]"},tx={info:Mn.info,violet:Mn.violet},Il=({status:e,label:s,variant:n="flat",size:a="sm",color:r,startContent:i,className:o,"data-testid":l="status-chip"})=>{if(n==="plain"){const u=Je[Jp[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",ex[a],"leading-[1.35]",o),style:{color:u.fg,backgroundColor:u.bg},children:[i,s]})}if(n==="dot"){const u=Mn[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"}}),s]})}const d=r?void 0:tx[e];return t.jsx(c.Chip,{color:r??Xp[e],variant:n,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:s})};Il.displayName="StatusChip";const sx={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"},hs={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"},Ws=({label:e,value:s,size:n="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(hs.base,hs[n],r),children:[t.jsx("span",{className:hs.label,children:e}),t.jsx("span",{className:hs.value,children:s})]}):t.jsxs("span",{"data-testid":i,className:c.cn("inline-flex items-baseline whitespace-nowrap border border-default-200 bg-default-100",sx[n],r),children:[t.jsx("span",{className:"font-medium text-default-400",children:e}),t.jsx("span",{className:"font-semibold text-default-700",children:s})]});Ws.displayName="KeyValueChip";const Ol=({columns:e,rows:s=6,label:n="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:n}),t.jsx("div",{"aria-hidden":"true",children:Array.from({length:s}).map((u,p)=>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,x)=>{const f=x===e.length-1;return t.jsx("div",{className:c.cn("min-w-0 flex-1 px-4 py-5",r&&f&&"flex justify-end"),children:t.jsx("div",{className:c.cn(js,l.bar),style:{height:mt(a),width:m==="fill"?"60%":mt(m),maxWidth:"100%"}})},x)})},p):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,x)=>{const f=x===e.length-1;return t.jsx("div",{className:c.cn(m==="fill"?"flex-1":"shrink-0",r&&f&&"flex justify-end"),style:m==="fill"?void 0:{width:m},children:t.jsx("div",{className:c.cn("animate-pulse rounded bg-default-200",zn,l.bar),style:{height:a,width:m==="fill"?"60%":m}})},x)})},p))})]});Ol.displayName="TableSkeleton";const ma="text-left text-[11px] font-semibold uppercase tracking-[.04em] text-acct-sub px-4 pt-4 pb-3 whitespace-nowrap bg-transparent",fa="px-4 text-[13.5px] text-acct-ink2 align-middle",pa="border-t border-acct-hair transition-colors duration-150 hover:bg-acct-page data-[hover=true]:bg-acct-page",xa="w-full",Bl="border-t border-acct-border px-5 py-3.5",bs={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"},zl=({columns:e,children:s,emptyContent:n,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&&bs.base,o,l.base),"data-testid":d,"data-variant":u?"framed":void 0,children:[t.jsxs(Zn,{"aria-label":r,removeWrapper:!0,classNames:{table:c.cn(xa,l.table),th:c.cn(u?bs.th:ma,l.th),tr:c.cn(u?bs.tr:pa,l.tr),td:c.cn(u?bs.td:fa,l.td)},children:[t.jsx(c.TableHeader,{columns:e,children:p=>t.jsx(c.TableColumn,{align:p.align==="right"?"end":"start",width:p.width,children:p.label},p.key)}),t.jsx(c.TableBody,{emptyContent:n,children:s})]}),a?t.jsx("div",{"data-testid":`${d}-footer`,className:c.cn(!u&&Bl,l.footer),children:a}):null]})};zl.displayName="AdminTable";const nx={sm:"size-6 min-w-6",md:"size-[30px] min-w-[30px]"},ha=({actions:e,size:s="md",className:n,"data-testid":a="row-actions"})=>t.jsx("div",{role:"presentation","data-testid":a,className:c.cn("inline-flex gap-0.5",n),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",nx[s]),children:r.icon},r.key))});ha.displayName="RowActions";const ax=Te.palettes.warning[50],rx="solar:alt-arrow-down-outline",ix="solar:pen-2-outline",lx={sm:"hidden sm:table-cell",md:"hidden md:table-cell",lg:"hidden lg:table-cell"},Ne={root:"w-full overflow-x-auto rounded-2xl border border-acct-border bg-acct-surface",table:xa,th:ma,alignRight:"text-right",thActions:"w-px",row:pa,rowOpen:"bg-acct-page hover:bg-acct-page",td:c.cn(fa,"py-3"),tdActions:"w-px whitespace-nowrap py-2 pl-2 pr-3 align-middle",actions:"flex items-center justify-end gap-0.5",toggle:"gap-1.5 text-acct-ink2 data-[hover=true]:bg-acct-hair",toggleOpen:"bg-acct-surface shadow-sm ring-1 ring-acct-border data-[hover=true]:bg-acct-surface",chevron:`size-4 shrink-0 transition-transform duration-150 ${ke}`,chevronOpen:"rotate-180",panelRow:"bg-acct-page",panelCell:"px-4 pb-4 pt-0",panel:"rounded-xl border border-acct-border bg-acct-surface p-4 shadow-sm",panelTitle:"mb-4 flex items-center gap-1.5 border-b border-acct-hair pb-3 text-xs font-semibold uppercase tracking-wide text-acct-sub",panelTitleIcon:"size-3.5 shrink-0",panelFooter:"mt-4 flex flex-wrap items-center justify-end gap-2 border-t border-acct-hair pt-3",done:"border-acct-border bg-acct-surface",empty:"px-4 py-10 text-center text-sm text-acct-sub"},ox=new Set(["text","search","email","tel","url","number","password"]);function cx(e){return e instanceof HTMLInputElement&&ox.has(e.type)&&e.getAttribute("aria-expanded")!=="true"}function Er(e){return c.cn(e.align==="right"&&Ne.alignRight,e.hideBelow&&lx[e.hideBelow])}function Vl({ariaLabel:e,columns:s,rows:n,getRowKey:a,getRowLabel:r,renderCell:i,renderExpanded:o,renderExpandedActions:l,getRowActions:d,rowNeedsFix:u,expandedKeys:p,defaultExpandedKeys:m,onExpandedChange:x,labels:f,emptyContent:b,className:v,"data-testid":g="expandable-table"}){const y=h.useId(),w=p!==void 0,[k,N]=h.useState(()=>new Set(m??[])),$=h.useMemo(()=>w?new Set(p):k,[w,p,k]),E=h.useRef(new Map),j=h.useRef(null),L=(D,A,R)=>{if($.has(D)===A)return;const T=new Set($);A?T.add(D):T.delete(D),w||N(T),x?.(T,{key:D,expanded:A,reason:R})};h.useLayoutEffect(()=>{const D=j.current;if(D===null||$.has(D))return;j.current=null;const A=document.activeElement;(A===null||A===document.body)&&E.current.get(D)?.focus()});const S=D=>A=>{if(A.defaultPrevented||A.nativeEvent.isComposing)return;const R=A.key==="Escape"?"escape":A.key==="Enter"&&cx(A.target)?"enter":null;R!==null&&(A.preventDefault(),A.stopPropagation(),L(D,!1,R))},M=s.length+1;return t.jsx("div",{"data-testid":g,className:c.cn(Ne.root,v),children:t.jsxs("table",{"aria-label":e,className:Ne.table,children:[t.jsx("thead",{children:t.jsxs("tr",{children:[s.map(D=>t.jsx("th",{scope:"col",className:c.cn(Ne.th,Er(D)),style:D.width===void 0?void 0:{width:D.width},children:D.label},D.key)),t.jsx("th",{scope:"col",className:c.cn(Ne.th,Ne.thActions),children:t.jsx("span",{className:"sr-only",children:f.actions})})]})}),n.length===0&&re(b)?t.jsx("tbody",{children:t.jsx("tr",{children:t.jsx("td",{colSpan:M,className:Ne.empty,"data-testid":`${g}-empty`,children:b})})}):null,n.map((D,A)=>{const R=a(D),T=$.has(R),U=u?.(D)??!1,G=f.toggleRow(r(D)),I=`${y}-panel-${A}`,se=d?.(D,A)??[],q={rowIndex:A,close:()=>L(R,!1,"done")};return t.jsxs("tbody",{"data-testid":`${g}-row-${R}`,"data-expanded":T?"true":"false","data-needs-fix":U?"true":void 0,children:[t.jsxs("tr",{className:c.cn(Ne.row,T&&Ne.rowOpen),style:U&&!T?{backgroundColor:ax}:void 0,children:[s.map(Q=>t.jsx("td",{className:c.cn(Ne.td,Er(Q)),children:i(D,Q.key,A)},Q.key)),t.jsx("td",{className:Ne.tdActions,children:t.jsxs("div",{className:Ne.actions,children:[t.jsx(O,{ref:Q=>{Q?E.current.set(R,Q):E.current.delete(R)},variant:"light",color:"default",size:"sm",testId:`${g}-toggle-${R}`,"aria-label":G,"aria-expanded":T,"aria-controls":T?I:void 0,className:c.cn(Ne.toggle,T&&Ne.toggleOpen),endContent:t.jsx(P,{"aria-hidden":!0,icon:rx,className:c.cn(Ne.chevron,T&&Ne.chevronOpen)}),onPress:()=>L(R,!T,"toggle"),children:f.toggle}),se.length>0?t.jsx(ha,{actions:se,"data-testid":`${g}-actions-${R}`}):null]})})]}),T?t.jsx("tr",{className:Ne.panelRow,children:t.jsx("td",{colSpan:M,className:Ne.panelCell,children:t.jsxs("div",{role:"region",id:I,"aria-label":G,"data-testid":`${g}-panel-${R}`,className:Ne.panel,onKeyDown:S(R),onFocus:()=>{j.current=R},onBlur:Q=>{const Y=Q.relatedTarget;Y&&!Q.currentTarget.contains(Y)&&(j.current=null)},children:[re(f.panelTitle)?t.jsxs("p",{className:Ne.panelTitle,children:[t.jsx(P,{"aria-hidden":!0,icon:ix,className:Ne.panelTitleIcon}),f.panelTitle]}):null,o(D,q),t.jsxs("div",{className:Ne.panelFooter,children:[l?.(D,q),t.jsx(O,{variant:"bordered",color:"default",size:"sm",testId:`${g}-done-${R}`,className:Ne.done,onPress:q.close,children:f.done})]})]})})}):null]},R)})]})})}Vl.displayName="ExpandableTable";const dx=ls["--warn"],Lr={root:"inline-flex shrink-0 items-center",dot:"block size-1.5 shrink-0 rounded-full"};function ba({label:e,className:s,"data-testid":n="needs-fix-dot"}){return t.jsxs("span",{"data-testid":n,className:c.cn(Lr.root,s),children:[t.jsx("span",{"aria-hidden":"true","data-testid":`${n}-mark`,className:Lr.dot,style:{backgroundColor:dx}}),t.jsx("span",{className:"sr-only",children:e})]})}ba.displayName="NeedsFixDot";function ux(e,s){return e.find(n=>n.needsFix&&!n.isDisabled)?.key??s}const Kt={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,lt={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"},Fr={md:"w-[15.625rem]",lg:"w-[22.5rem]",fill:"w-full"},Rs={inputWrapper:"h-12 min-h-12 !h-12",input:"text-base",icon:"[&_svg]:size-5"},_r={button:"shrink-0 text-default-500",input:"[&::-webkit-search-cancel-button]:appearance-none"},Rr={md:{button:"size-8 min-w-8",icon:"size-4"},lg:{button:"size-11 min-w-11",icon:"size-5"}},Ul=({searchValue:e,onSearchChange:s,searchLabel:n,searchPlaceholder:a,searchClearable:r,clearLabel:i,size:o,dataTestId:l,startContent:d,classNames:u})=>{const p=h.useRef(null),m=o==="lg",x=r&&e!==""?t.jsx(O,{isIconOnly:!0,size:"sm",variant:"light",color:"default",radius:"full","aria-label":i,onPress:()=>{s(""),p.current?.focus()},className:c.cn(_r.button,Rr[o].button),testId:`${l}-search-clear`,children:t.jsx(P,{icon:"lucide:x","aria-hidden":"true",className:Rr[o].icon})}):void 0;return t.jsx(c.Input,{ref:p,type:"search","aria-label":n,placeholder:a??n,value:e,onValueChange:s,startContent:d,endContent:x,"data-testid":`${l}-search`,variant:"bordered",radius:"none",classNames:{base:u.base,inputWrapper:c.cn(u.inputWrapper,m&&Rs.inputWrapper),innerWrapper:u.innerWrapper,input:c.cn(u.input,m&&Rs.input,r&&_r.input)}})},px=({searchValue:e,onSearchChange:s,searchLabel:n,searchPlaceholder:a,searchIcon:r,searchClearable:i=!1,clearLabel:o,children:l,trailing:d,searchWidth:u="md",size:p,className:m,"data-testid":x="admin-toolbar"})=>{const{ref:f,width:b}=Bt(),v=b>0&&!us(b,fx),g=u==="fill";return t.jsxs("div",{ref:f,role:"search","data-testid":x,"data-variant":"framed","data-size":v?"narrow":"wide",className:c.cn(lt.base,v&<.narrow,m),children:[l,t.jsx("div",{"data-testid":`${x}-search-slot`,className:g?lt.searchFill:v?lt.searchNarrow:lt.searchWide,children:t.jsx(Ul,{searchValue:e,onSearchChange:s,searchLabel:n,searchPlaceholder:a,searchClearable:i,clearLabel:o,size:p,dataTestId:x,startContent:t.jsx("span",{"aria-hidden":"true","data-testid":`${x}-search-icon`,className:c.cn(lt.icon,p==="lg"&&Rs.icon),children:r??t.jsx(P,{icon:"lucide:search"})}),classNames:{base:g?Fr.fill:v?lt.inputBaseNarrow:Fr[u],inputWrapper:lt.inputWrapper,innerWrapper:lt.innerWrapper,input:lt.input}})}),d]})},Hl=({searchValue:e,onSearchChange:s,searchLabel:n,searchPlaceholder:a,searchIcon:r,searchClearable:i=!1,clearLabel:o="Clear search",children:l,trailing:d,searchWidth:u="md",size:p="md",variant:m="default",className:x,"data-testid":f="admin-toolbar"})=>m==="framed"?t.jsx(px,{searchValue:e,onSearchChange:s,searchLabel:n,searchPlaceholder:a,searchIcon:r,searchClearable:i,clearLabel:o,trailing:d,searchWidth:u,size:p,className:x,"data-testid":f,children:l}):t.jsxs("div",{role:"search","data-testid":f,className:c.cn(Kt.base,x),children:[t.jsx(Ul,{searchValue:e,onSearchChange:s,searchLabel:n,searchPlaceholder:a,searchClearable:i,clearLabel:o,size:p,dataTestId:f,startContent:r?t.jsx("span",{"aria-hidden":"true",className:c.cn(Kt.icon,p==="lg"&&Rs.icon),children:r}):void 0,classNames:{base:mx[u],inputWrapper:Kt.inputWrapper,input:Kt.input}}),l,d?t.jsx("div",{className:Kt.trailing,children:d}):null]});Hl.displayName="AdminToolbar";const xx="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",Wl=h.forwardRef(function({icon:s,children:n,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:s,className:"size-4","aria-hidden":!0}),t.jsx("span",{children:n}),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:s,className:"size-4 text-gray-500","aria-hidden":!0}),t.jsx("span",{children:n}),a!==void 0&&a>0&&t.jsx("span",{className:xx,children:a})]})});Wl.displayName="ToolbarButton";const hn="w-full mb-4 border-b border-pos-line",bn=["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}`},lg:{base:hn,tabList:"w-full -mb-px gap-2 rounded-none p-0",cursor:"hidden",tab:`${bn} min-h-11 px-5 py-0`,tabContent:`text-[0.9375rem] leading-5 font-semibold text-pos-neutral group-data-[selected=true]:text-primary ${ke}`},"sm-primary":{base:hn,tabList:"w-full -mb-px gap-6 rounded-none px-0.5 py-0",cursor:"hidden",tab:`${bn} 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:hn,tabList:"w-full -mb-px gap-0 rounded-none p-0",cursor:"hidden",tab:`${bn} px-[1.125rem] py-[0.5625rem]`,tabContent:`text-[0.8125rem] leading-4 font-semibold text-pos-muted group-data-[selected=true]:text-primary ${ke}`}},Mr={base:"mb-0 border-b-0",tabList:"mb-0 border-b-0"},yx="inline-flex items-center gap-1.5",vx="data-[animated=true]:transition-none";function ql({items:e,value:s,onChange:n,ariaLabel:a,size:r="md",level:i="primary",showDivider:o=!0,needsFixLabel:l,className:d,"data-testid":u="underline-tabs"}){const p=Is(),m=gx[r==="sm"?`sm-${i}`:r],x=r!=="md",f=e.filter(b=>b.isDisabled).map(b=>b.key);return t.jsx(c.Tabs,{"aria-label":a,variant:"underlined",selectedKey:s,onSelectionChange:b=>n(String(b)),disabledKeys:f,disableCursorAnimation:x,"data-testid":u,"data-size":r,classNames:{...m,base:c.cn(m.base,!o&&Mr.base,d),tabList:c.cn(m.tabList,!o&&Mr.tabList),cursor:c.cn(m.cursor,p&&vx),panel:"p-0"},children:e.map(b=>{const v=`${u}-${b.key}`;return t.jsx(c.Tab,{title:b.needsFix?t.jsxs("span",{className:yx,children:[b.label," ",t.jsx(ba,{label:l??"","data-testid":`${v}-needs-fix`})]}):b.label,titleValue:b.hint,"data-testid":v,"data-needs-fix":b.needsFix?"true":void 0,children:b.content},b.key)})})}ql.displayName="UnderlineTabs";const ga="text-[11px] font-semibold uppercase tracking-[.04em] text-acct-muted mb-1.5",Gl="font-normal normal-case tracking-normal",Kl="ms-0.5 text-acct-danger",Yl="mb-0 min-h-[calc(var(--heroui-font-size-small)_+_10px)] text-foreground",Ql="after:content-none",Zl="ms-0.5 -my-1.5 size-6 min-w-6 align-middle text-acct-sub data-[hover=true]:bg-acct-page data-[hover=true]:text-acct-ink",Xl="size-4",Jl="max-w-xs rounded-xl px-3 py-2 text-xs leading-normal text-acct-ink2",eo=["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(" "),to="text-[13.5px] text-acct-ink",so="bg-acct-page text-acct-muted cursor-default",no="mt-[5px] text-xs text-acct-sub",ao="mt-[5px] text-xs text-acct-danger";function jx({label:e}){return t.jsxs(t.Fragment,{children:[t.jsx("span",{"aria-hidden":"true",className:Kl,children:"*"}),e?t.jsxs(t.Fragment,{children:[" ",t.jsx("span",{className:"sr-only",children:e})]}):null]})}function wx({help:e,label:s,labelledBy:n,testId:a}){const r=s?{"aria-label":s}:{"aria-labelledby":n};return t.jsxs(c.Popover,{placement:"top",showArrow:!0,children:[t.jsx(c.PopoverTrigger,{children:t.jsx(O,{isIconOnly:!0,size:"sm",variant:"light",color:"default",radius:"full",...r,testId:a,className:Zl,children:t.jsx(P,{"aria-hidden":!0,icon:"solar:info-circle-outline",className:Xl})})}),t.jsx(c.PopoverContent,{...r,"data-testid":`${a}-content`,className:Jl,children:e})]})}function ro(e,s,n,a){return t.jsxs(t.Fragment,{children:[e,s?t.jsxs("span",{className:Gl,children:[" ",s]}):null,n?t.jsx(jx,{label:a}):null]})}const ya=({children:e,suffix:s,htmlFor:n,id:a,isRequired:r,requiredLabel:i,help:o,helpLabel:l,className:d,"data-testid":u="admin-field-label"})=>{const p=h.useId(),m=ro(e,s,r,i),x=re(o),f=a??(x?p:void 0);return t.jsxs("div",{"data-testid":u,className:c.cn(ga,d),children:[n?t.jsx("label",{id:f,htmlFor:n,children:m}):f?t.jsx("span",{id:f,children:m}):m,x&&f?t.jsx(wx,{help:o,label:l,labelledBy:f,testId:`${u}-help`}):null]})};ya.displayName="AdminFieldLabel";const io=({label:e,labelSuffix:s,value:n,onChange:a,placeholder:r,disabled:i=!1,readOnly:o=!1,mono:l=!1,autoFocus:d=!1,hint:u,invalid:p=!1,isRequired:m=!1,requiredLabel:x,help:f,helpLabel:b,className:v,"data-testid":g="admin-text-field"})=>{const y=h.useId(),w=h.useId(),k=re(e),N=k&&re(f),$=t.jsx(c.Input,{labelPlacement:k&&!N?"outside":void 0,label:k&&!N?ro(e,s,m,x):void 0,id:N?y:void 0,"aria-labelledby":N?w:void 0,value:n,placeholder:r,isDisabled:i,isReadOnly:o,autoFocus:d,isInvalid:p,isRequired:k&&m,validationBehavior:"aria",description:!p&&u?u:void 0,errorMessage:p?u:void 0,onValueChange:a,"data-testid":g,variant:"bordered",radius:"none",classNames:{base:c.cn("w-full",!N&&v),label:c.cn(ga,Ql),inputWrapper:eo,input:c.cn(to,(l||o)&&"font-mono",o&&so),description:no,errorMessage:ao}});return N?t.jsxs("div",{className:c.cn("w-full",v),children:[t.jsx(ya,{id:w,htmlFor:y,suffix:s,isRequired:m,requiredLabel:x,help:f,helpLabel:b,className:Yl,"data-testid":`${g}-label`,children:e}),$]}):$};io.displayName="AdminTextField";const Nx=1440,gt=e=>String(e).padStart(2,"0"),lo=e=>e.toLowerCase().replace(/[\s.]/g,"");function Ms(e){const[s=0,n=0]=e.split(":").map(Number);return s*60+n}function Cx(e){return`${gt(Math.floor(e/60))}:${gt(e%60)}`}function Pn(e){const s=/^(\d{1,2}):?(\d{2})?(?:(a|p)m?)?$/.exec(lo(e));if(!s)return null;let n=Number(s[1]);const a=Number(s[2]??0),r=s[3];if(a>59)return null;if(r){if(n<1||n>12)return null;n=n%12+(r==="p"?12:0)}else{if(n>23)return null;n>=1&&n<=6&&(n+=12)}return`${gt(n)}:${gt(a)}`}function kx(e,s,n){const a=Math.floor(n);if(!(a>=1))return[];const r=[],i=Math.min(Ms(s),Nx-1);for(let o=Ms(e);o<=i;o+=a)r.push(Cx(o));return r}function Pr(e,s){return s.includes(":")?e.startsWith(s):e.replace(":","").startsWith(s)}function Sx(e,s){const n=/^([\d:]*)(?:(a|p)m?)?$/.exec(lo(s));if(!n)return!1;const[,a="",r]=n,[i=0,o=0]=e.split(":").map(Number),l=`${i%12||12}:${gt(o)}`;return r?r==="p"!=i>=12?!1:Pr(l,a):[l,`${gt(i)}:${gt(o)}`,`${i}:${gt(o)}`].some(d=>Pr(d,a))}const Tr=new Map;function Ir(e,s){let n=Tr.get(s);n||(n=new Intl.DateTimeFormat(s,{hour:"numeric",minute:"2-digit"}),Tr.set(s,n));const[a=0,r=0]=e.split(":").map(Number);return n.format(new Date(2e3,0,1,a,r)).replace(/[\u00a0\u202f]/g," ")}const Yt=(e,s)=>s===void 0||Ms(e)>=Ms(s);function oo({value:e,defaultValue:s=null,onChange:n,label:a,"aria-label":r,placeholder:i,emptyContent:o,invalidMessage:l,minTime:d,minTimeMessage:u,listStart:p="07:00",listEnd:m="21:00",listStep:x=30,locale:f="en-US",isRequired:b=!1,isDisabled:v=!1,isInvalid:g=!1,errorMessage:y,isClearable:w=!1,clearLabel:k,onBlur:N,size:$,variant:E="bordered",labelPlacement:j="outside-top",className:L,inputProps:S,popoverProps:M,"data-testid":D="time-field"}){const[A,R]=It(e,s,n),T=J=>J?Ir(J,f):"",U=T(A),[G,I]=h.useState(U),[se,q]=h.useState(null),[Q,Y]=h.useState(!1),[ce,ne]=h.useState(U);U!==ce&&(ne(U),I(U),q(null));const X=G.trim()!==""&&G!==U,ie=X?Pn(G):null,V=X?"typed":G.trim()===""&&!Q?"none":"all",z=X?G:"",Z=h.useMemo(()=>kx(p,m,x),[p,m,x]),Ie=h.useMemo(()=>{const J=Z.filter(F=>Yt(F,d));let C;if(V==="typed"){const F=J.filter(W=>Sx(W,z)),_=Pn(z);C=_!==null&&Yt(_,d)?[_,...F.filter(W=>W!==_)]:F}else V==="none"?C=[]:A!==null&&Yt(A,d)&&!J.includes(A)?C=[...J,A].sort():C=J;return C.map(F=>({key:F,label:Ir(F,f)}))},[Z,d,V,z,A,f]),Le=h.useCallback(J=>t.jsx(c.AutocompleteItem,{textValue:J.label,"data-testid":`${D}-option-${J.key}`,children:J.label},J.key),[D]),Fe=!X&&A!==null&&Ie.some(J=>J.key===A)?A:null,ae=J=>{q(null),R(J),I(T(J))},je=()=>{if(G.trim()===""){w?ae(null):(I(U),q(null));return}X&&(ie===null?q("invalid"):Yt(ie,d)?ae(ie):q("min"))},_e=h.useRef(!1),et=J=>{J!==null&&(_e.current=!0,queueMicrotask(()=>{_e.current=!1}),ae(String(J)))},ge=A!==null&&!Yt(A,d),Re=se??(ge?"min":null),ue=Re!==null||g,ye=Re==="invalid"?l:Re==="min"?u??l:y;return t.jsx(c.Autocomplete,{label:a,"aria-label":r,labelPlacement:j,placeholder:i,size:$,variant:E,className:L,"data-testid":D,allowsCustomValue:!0,isClearable:w,onClear:w?()=>ae(null):void 0,clearButtonProps:w&&k?{"aria-label":k}:void 0,isRequired:b,isDisabled:v,isInvalid:ue,errorMessage:ue?ye:void 0,validationBehavior:"aria",items:Ie,inputValue:G,onInputChange:J=>{I(J),Y(!1),se&&q(null)},selectedKey:Fe,onSelectionChange:et,onOpenChange:(J,C)=>Y(J&&(C==="focus"||C==="manual")),onBlur:J=>{je(),N?.(J)},onKeyDown:J=>{J.key==="Enter"&&!_e.current&&je(),(J.key==="ArrowDown"||J.key==="ArrowUp")&&Y(!0),"continuePropagation"in J&&J.continuePropagation()},inputProps:S,popoverProps:M,listboxProps:{emptyContent:o},children:Le})}oo.displayName="TimeField";const co=({children:e,placeholder:s="Select…",onOpen:n,onClear:a,ariaLabel:r,icon:i,trailingIcon:o,clearIcon:l,disabled:d=!1,className:u,"data-testid":p="picker-row"})=>{const m=e!=null;return t.jsxs("div",{"data-testid":p,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:n,isDisabled:d,"aria-haspopup":"dialog","aria-label":r,"data-testid":`${p}-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:s}),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":`${p}-clear`,className:"ml-1.5 size-6 min-w-6 shrink-0 text-acct-muted data-[hover=true]:bg-acct-hair",children:l}):null]})};co.displayName="PickerRow";const Me={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",menuWithDescriptions:"max-w-xs",menuItemDescription:"whitespace-normal text-default-600",menuItemDisabledWithDescription:"opacity-100",menuItemDimmed:"opacity-disabled",menuItemDimmedIcon:"flex shrink-0 opacity-disabled",avatar:"shrink-0 bg-default-200 text-default-700",dangerItem:"text-danger"},$x={default:void 0,primary:"text-primary-800",success:void 0,warning:"text-warning-800",danger:void 0},Ax={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"}},uo={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"}},Dx={md:void 0,lg:"min-h-12 text-base"},Ex={none:"",sm:"gap-1",md:"gap-2"},mo="m-0 flex list-none flex-col p-0",Ft={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"]},fo=h.createContext(!1),Lx=()=>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"})}),Fx=()=>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 s=e.trim().split(/\s+/).filter(Boolean);if(s.length===0)return"—";const n=s[0]?.charAt(0)??"",a=s.length>1?s[s.length-1]?.charAt(0)??"":"";return`${n}${a}`.toUpperCase()}const po=({title:e,subtitle:s,leading:n,tags:a,onPress:r,href:i,linkAs:o,"aria-haspopup":l,trailing:d,showChevron:u=!1,chevronIcon:p,actions:m,actionsLabel:x,actionsIcon:f,size:b,variant:v="plain",isDisabled:g=!1,as:y,className:w,"data-testid":k="entity-row"})=>{const N=h.useContext(fo),$=Os(),E=b??($==="touch"?"lg":"md"),j=uo[E],L=Ax[v],S=y??(N?"li":"div"),M=h.useId(),D=h.useId(),A=h.useId(),R=h.useId(),T=i!==void 0||r!==void 0,U=a!==void 0&&a.length>0,G=re(s),I=m!==void 0&&m.length>0,se=typeof e=="string"?e:void 0,q=I&&m.some(z=>re(z.description)),Q=I?m.filter(z=>z.isDisabled===!0&&re(z.description)).map(z=>`${z.label}: ${z.description}`).join(" "):"",Y=n?t.jsx(c.Avatar,{"aria-hidden":"true",size:j.avatar,radius:n.shape==="square"?"lg":"full",src:n.src,icon:n.icon,name:n.icon!==void 0?void 0:n.initials??n.name??se,getInitials:n.initials!==void 0?z=>z:_x,showFallback:n.src!==void 0,classNames:{base:Me.avatar},"data-testid":`${k}-leading`}):null,ce=t.jsxs(t.Fragment,{children:[Y,t.jsxs("span",{className:Me.text,children:[t.jsxs("span",{className:Me.titleLine,children:[t.jsx("span",{id:M,className:c.cn(Me.title,j.title),title:se,children:e}),U&&t.jsx("span",{id:D,className:Me.tags,children:a.map(z=>t.jsx(c.Chip,{size:"sm",variant:"flat",color:z.tone??"default",className:$x[z.tone??"default"],"data-testid":`${k}-tag-${z.key}`,children:z.label},z.key))})]}),G&&t.jsx("span",{id:A,className:c.cn(Me.subtitle,j.subtitle),children:s})]})]}),ne=[U?D:null,G?A:null].filter(Boolean).join(" "),X={"aria-labelledby":M,"aria-describedby":ne===""?void 0:ne,isDisabled:g,className:c.cn(Me.pressTarget,L.overlay,j.content)},ie=`${k}-trigger`;let V;return i!==void 0?V=t.jsx(c.Link,{...X,"data-testid":ie,as:o,href:i,color:"foreground",underline:"none",onPress:r,children:ce}):r!==void 0?V=t.jsx(O,{...X,testId:ie,variant:"light",color:"default",radius:"none",disableAnimation:!0,disableRipple:!0,"aria-haspopup":l,onPress:r,children:ce}):V=t.jsx("div",{className:c.cn(Me.content,j.content),children:ce}),t.jsxs(S,{"data-testid":k,"data-size":E,"data-disabled":g||void 0,className:c.cn(Me.base,L.row,j.row,T&&!g&&L.hover,w),children:[V,(re(d)||I)&&t.jsxs("div",{className:Me.side,children:[d,I&&t.jsxs(c.Dropdown,{placement:"bottom-end",children:[t.jsx(c.DropdownTrigger,{children:t.jsx(O,{isIconOnly:!0,size:j.control,variant:"light",color:"default",radius:"full",isDisabled:g,"aria-label":x,"aria-describedby":Q===""?void 0:R,testId:`${k}-menu-trigger`,className:Me.menuTrigger,children:f??t.jsx(Fx,{})})}),t.jsx(c.DropdownMenu,{"aria-label":x,"data-testid":`${k}-menu`,className:q?Me.menuWithDescriptions:void 0,disabledKeys:m.filter(z=>z.isDisabled).map(z=>z.key),onAction:z=>{m.find(Z=>Z.key===z)?.onAction()},items:m,children:z=>{const Z=z.isDisabled===!0&&re(z.description);return t.jsx(c.DropdownItem,{textValue:z.label,description:z.description,color:z.tone==="danger"?"danger":"default",className:c.cn(z.tone==="danger"&&Me.dangerItem,Dx[E],Z&&Me.menuItemDisabledWithDescription),classNames:{title:Z?Me.menuItemDimmed:void 0,description:c.cn(Me.menuItemDescription,j.subtitle)},startContent:Z&&z.icon!==void 0?t.jsx("span",{className:Me.menuItemDimmedIcon,children:z.icon}):z.icon,"data-testid":z["data-testid"]??`${k}-menu-${z.key}`,children:z.label},z.key)}})]}),Q!==""&&t.jsx("span",{id:R,hidden:!0,"data-testid":`${k}-menu-trigger-description`,children:Q})]}),u&&t.jsx("span",{"aria-hidden":"true",className:Me.chevron,"data-testid":`${k}-chevron`,children:p??t.jsx(Lx,{})})]})};po.displayName="EntityRow";const xo=({children:e,"aria-label":s,"aria-labelledby":n,gap:a="none",className:r,"data-testid":i="entity-list"})=>t.jsx("ul",{"aria-label":s,"aria-labelledby":n,"data-testid":i,className:c.cn(mo,Ex[a],r),children:t.jsx(fo.Provider,{value:!0,children:e})});xo.displayName="EntityList";const ho=({label:e,rows:s=6,size:n,className:a,"data-testid":r="entity-list-skeleton"})=>{const i=Os(),o=n??(i==="touch"?"lg":"md"),{titleWidths:l}=Ft;return t.jsxs("div",{"aria-busy":"true","data-testid":r,className:a,children:[t.jsx("span",{role:"status",className:"sr-only",children:e}),t.jsx("ul",{"aria-hidden":"true",className:mo,children:Array.from({length:s},(d,u)=>t.jsxs("li",{"data-testid":`${r}-row`,className:c.cn(Ft.row,uo[o].row),children:[t.jsx(oe,{className:Ft.avatar[o]}),t.jsxs("span",{className:Ft.lines,children:[t.jsx(oe,{className:c.cn(Ft.title,l[u%l.length])}),t.jsx(oe,{className:Ft.subtitle})]})]},u))})]})};ho.displayName="EntityListSkeleton";function bo(e,s,n){if(n<=0||s<=0||e<=0)return{from:0,to:0};const a=(e-1)*s+1;return a>n?{from:0,to:0}:{from:a,to:Math.min(n,e*s)}}const go=({page:e,pageSize:s,total:n,unit:a,announce:r=!0,format:i,className:o,classNames:l={},"data-testid":d="pagination-summary"})=>{const{from:u,to:p}=bo(e,s,n),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:p,total:n}):t.jsxs(t.Fragment,{children:["Showing"," ",t.jsx("span",{"data-testid":`${d}-range`,className:m,children:u===0?0:`${u}–${p}`})," ","of"," ",t.jsx("span",{"data-testid":`${d}-total`,className:m,children:n}),a?t.jsxs(t.Fragment,{children:[" ",a]}):null]})})};go.displayName="PaginationSummary";const qs="shadow-[0_1px_4px_rgba(0,0,0,.06),0_4px_12px_rgba(0,0,0,.06)]",dt={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"},Rx={card:qs,flat:""},Mx={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]"},Px={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:""}},yo=({isLoading:e=!1,isError:s=!1,isEmpty:n=!1,loadingTitle:a="Loading…",loadingContent:r,errorTitle:i="Something went wrong",errorDescription:o,retryLabel:l="Retry",onRetry:d,errorActions:u,errorContent:p,emptyTitle:m="Nothing here yet",emptyDescription:x,emptyIcon:f,emptyActions:b,emptyContent:v,children:g,toolbar:y,variant:w="default",className:k,classNames:N={},"data-testid":$="list-panel"})=>{const E=w==="framed",j={base:c.cn("border-0 bg-transparent py-12",N.state)},L=E?{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"}:j;let S;return e?S=r??t.jsx(da,{title:a,classNames:j,"data-testid":`${$}-loading`}):s?S=p??t.jsx(ca,{title:i,description:o,classNames:j,"data-testid":`${$}-error`,actions:u??(d?t.jsx(O,{color:"primary",variant:"flat",onPress:d,children:l}):void 0)}):n?S=v??t.jsx(oa,{surface:E?"panel":void 0,title:m,description:x,icon:f,actions:b,classNames:L,"data-testid":`${$}-empty`}):S=g,t.jsxs("section",{"data-testid":$,"data-variant":E?"framed":void 0,className:c.cn(E?`overflow-hidden rounded-2xl border border-pos-line bg-white ${qs}`:"rounded-xl bg-white p-2 shadow-sm",k,N.base),children:[y,S]})};yo.displayName="ListPanel";const va=(e,s)=>s<=0?/^\d*$/.test(e):new RegExp(`^\\d*(?:[.,]\\d{0,${s}})?$`).test(e),is=e=>{const s=Number.parseFloat(e.replace(",","."));return Number.isFinite(s)?s:null},vo=(e,s)=>{const[n,a]=h.useState(()=>s(e)),r=(is(n)??0)===(e??0)?n:s(e),i=h.useCallback(()=>{a(o=>{const l=is(o);return l===null?"":String(l)})},[]);return{draft:r,setDraft:a,normalize:i}},Tx=/^[\d.,]+$/,jo=(e,s=Object.is)=>{const n=h.useRef(e),a=h.useRef(null);h.useLayoutEffect(()=>{n.current=e},[e]);const r=h.useCallback(()=>{const l=a.current,d=n.current;return l===null||!(s(d,l.source)||s(d,l.emitted))},[s]),i=h.useCallback(l=>{a.current={source:n.current,emitted:l}},[]),o=h.useCallback(()=>{a.current=null},[]);return h.useMemo(()=>({isUntouched:r,markEdited:i,markUntouched:o}),[r,i,o])},wo=(e,s)=>{const n=h.useRef(null),a=h.useRef(s);return h.useLayoutEffect(()=>{a.current=s},[s]),h.useEffect(()=>{const r=n.current;if(!r)return;const i=l=>{e()&&(l.inputType==="insertText"&&l.data&&Tx.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]),n},Ix=350,Ox={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}"},Bx=7,zx=e=>[...new Set((e??[]).filter(s=>Number.isFinite(s)&&s>0))].sort((s,n)=>s-n).slice(0,Bx),Vx=(e,s,n)=>{if(!Number.isInteger(e))return xe(e,s,n);try{return new Intl.NumberFormat(s,{style:"currency",currency:n,minimumFractionDigits:0}).format(e)}catch{return xe(e,s,n)}},Ux=(e,s)=>(e??0)===(s??0),Qt=(e,s)=>Object.entries(s).reduce((n,[a,r])=>n.replace(`{${a}}`,r),e),Hx=({dueAmount:e,received:s,defaultReceived:n=null,onChange:a,locale:r="en-US",labels:i,isDisabled:o=!1,maxAmount:l,quickAmounts:d,showExactAmount:u=!0,autoFocus:p=!1,className:m,"data-testid":x="cash-tender-form"})=>{const f={...Ox,...i},b=Ot(e.currency,r),v=s!==void 0,[g,y]=h.useState(n??null),w=v?s:g,{draft:k,setDraft:N,normalize:$}=vo(w,V=>V==null?"":String(V)),{isUntouched:E,markEdited:j,markUntouched:L}=jo(w,Ux),S=h.useMemo(()=>{const V=typeof w=="number"&&Number.isFinite(w)?w:0,z=An(V,e.value,e.currency,r);return{received:V,change:z>0?z:0,isValid:V>=e.value&&V>0}},[w,e.value,e.currency,r]),M=h.useCallback(V=>{const z=V.currentTarget;requestAnimationFrame(()=>{z.isConnected&&z.select()})},[]),D=h.useCallback(V=>{v||y(V);const z=typeof V=="number"&&Number.isFinite(V)?V:0,Z=An(z,e.value,e.currency,r);a?.({received:z,change:Z>0?Z:0,isValid:z>=e.value&&z>0})},[v,e.value,e.currency,r,a]),A=h.useCallback(V=>{if(o)return;const z=V.replace(/[^\d.,]/g,"");if(!va(z,b))return;const Z=is(z);Z!==null&&l!==void 0&&Z>l||(N(z),j(Z),D(Z))},[o,l,N,j,b,D]),R=wo(E,A),T=h.useMemo(()=>zx(d),[d]),U=V=>l!==void 0&&V>l,G=()=>{o||U(e.value)||(N(String(e.value)),L(),D(e.value))},I=V=>{if(o)return;const z=E()||typeof w!="number"||!Number.isFinite(w)?0:w,Z=Xn(z+V,e.currency,r);U(Z)||(N(String(Z)),j(Z),D(Z))},se=S.isValid&&S.change>0,q=!S.isValid&&S.received>0,Q=xe(S.change,r,e.currency),Y=xe(e.value,r,e.currency),[ce,ne]=h.useState(""),X=h.useRef(null);h.useEffect(()=>{X.current&&clearTimeout(X.current);const V=se?Qt(f.changeMessageTemplate,{change:Q}):"",z=se?Ix:0;return X.current=setTimeout(()=>ne(V),z),()=>{X.current&&clearTimeout(X.current)}},[se,Q,f.changeMessageTemplate]);const ie=`${x}-received`;return t.jsxs("div",{className:c.cn("flex flex-col gap-3",m),"data-testid":x,children:[t.jsx(c.Input,{ref:R,id:ie,label:f.receivedLabel,labelPlacement:"outside",type:"text",inputMode:b===0?"numeric":"decimal",pattern:b===0?"[0-9]*":"[0-9]*[.,]?[0-9]*",value:k,onChange:V=>A(V.target.value),onFocus:M,onBlur:$,placeholder:f.receivedPlaceholder,isDisabled:o,isInvalid:q,errorMessage:q?Qt(f.insufficientMessageTemplate,{due:Y}):void 0,variant:"bordered",radius:"lg",autoFocus:p,"data-testid":`${x}-received-input`}),T.length>0&&t.jsx("div",{className:"[container-type:inline-size]",children:t.jsxs("div",{role:"group","aria-label":f.quickAmountsLabel,className:"grid grid-cols-4 gap-2 [@container(min-width:55rem)]:grid-cols-8","data-testid":`${x}-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":Qt(f.exactAmountAriaTemplate,{amount:Y}),onPress:G,"data-testid":`${x}-quick-amount-exact`,children:[f.exactAmountLabel," ",Y]}),T.map(V=>{const z=Vx(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":Qt(f.quickAmountAriaTemplate,{amount:z}),onPress:()=>I(V),"data-testid":`${x}-quick-amount-${V}`,children:z},V)})]})}),se&&t.jsx(c.Alert,{"data-testid":`${x}-change-alert`,color:"primary",variant:"flat",radius:"lg",title:f.changeLabel,description:Qt(f.changeMessageTemplate,{change:Q}),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:ce})]})},Wx={checkNumberLabel:"Check Number",checkNumberPlaceholder:"e.g. 11234",bankNameLabel:"Bank Name",bankNamePlaceholder:"e.g. Chase Bank",dateLabel:"Date",checkNumberRequiredMessage:"Check number is required"},Or=()=>{const e=new Date,s=n=>String(n).padStart(2,"0");return`${e.getFullYear()}-${s(e.getMonth()+1)}-${s(e.getDate())}`},No=({dueAmount:e,value:s,defaultValue:n,onChange:a,labels:r,hideDate:i=!1,hideBankName:o=!1,isDisabled:l=!1,checkNumberMaxLength:d=34,bankNameMaxLength:u=100,autoFocus:p=!1,className:m,"data-testid":x="check-tender-form"})=>{const f={...Wx,...r},b=s!==void 0,[v,g]=h.useState({checkNumber:n?.checkNumber??"",bankName:n?.bankName??"",date:n?.date??Or()}),[y,w]=h.useState(!!n?.checkNumber),k=h.useMemo(()=>b?{checkNumber:s?.checkNumber??"",bankName:s?.bankName??"",date:s?.date??Or()}:v,[b,s,v]),N=h.useCallback(D=>{b||g(D);const A=D.checkNumber.trim(),R={amount:e.value,checkNumber:A,bankName:D.bankName.trim()||void 0,date:i?void 0:D.date,isValid:A.length>0&&e.value>0};a?.(R)},[b,e.value,i,a]),$=h.useCallback(D=>A=>{l||(D==="checkNumber"&&A.length>0&&w(!0),N({...k,[D]:A}))},[k,N,l]),E=h.useCallback(()=>{l||w(!0)},[l]),j=y&&k.checkNumber.trim()==="",L=`${x}-check-number`,S=`${x}-bank-name`,M=`${x}-date`;return t.jsxs("div",{className:c.cn("grid grid-cols-1 sm:grid-cols-2 gap-4",m),"data-testid":x,children:[t.jsx(c.Input,{id:L,label:f.checkNumberLabel,labelPlacement:"outside",type:"text",value:k.checkNumber,onChange:D=>$("checkNumber")(D.target.value),onBlur:E,placeholder:f.checkNumberPlaceholder,maxLength:d,isRequired:!0,isInvalid:j,errorMessage:j?f.checkNumberRequiredMessage:void 0,isDisabled:l,variant:"bordered",radius:"lg",autoFocus:p,"data-testid":`${x}-check-number-input`}),!o&&t.jsx(c.Input,{id:S,label:f.bankNameLabel,labelPlacement:"outside",type:"text",value:k.bankName,onChange:D=>$("bankName")(D.target.value),placeholder:f.bankNamePlaceholder,maxLength:u,isDisabled:l,variant:"bordered",radius:"lg","data-testid":`${x}-bank-name-input`}),!i&&t.jsx(c.Input,{id:M,label:f.dateLabel,labelPlacement:"outside",type:"date",value:k.date,onChange:D=>$("date")(D.target.value),isDisabled:l,variant:"bordered",radius:"lg","data-testid":`${x}-date-input`,className:"sm:col-span-2"})]})};No.displayName="CheckTenderForm";const qx={methodLabel:"Method",methodPlaceholder:"Select a payment method",referenceLabel:"Reference",referencePlaceholder:"e.g. Voucher #1234",methodRequiredMessage:"Method is required"},Gx=[{value:"ach",label:"ACH"},{value:"wire",label:"Wire"},{value:"gift_card",label:"Gift Card"},{value:"voucher",label:"Voucher"},{value:"other",label:"Other"}],Co=({dueAmount:e,methodOptions:s=Gx,value:n,defaultValue:a,onChange:r,labels:i,showReference:o=!1,isDisabled:l=!1,className:d,"data-testid":u="other-tender-form"})=>{const p={...qx,...i},m=n!==void 0,[x,f]=h.useState({method:a?.method??"",reference:a?.reference??""}),b=h.useMemo(()=>m?{method:n?.method??"",reference:n?.reference??""}:x,[m,n,x]),v=h.useCallback($=>s.find(E=>E.value===$)?.label??"",[s]),g=h.useCallback($=>{m||f($);const E=v($.method),j={amount:e.value,method:$.method,description:E,reference:$.reference.trim()||void 0,isValid:$.method!==""};r?.(j)},[m,e.value,r,v]),y=h.useCallback($=>{if(l)return;const E=typeof $=="string"?$:Array.from($)[0]?.toString()??"";g({...b,method:E})},[b,g,l]),w=h.useCallback($=>{l||g({...b,reference:$})},[b,g,l]),k=`${u}-method`,N=`${u}-reference`;return t.jsxs("div",{className:c.cn("flex flex-col gap-3",d),"data-testid":u,children:[t.jsx(it,{id:k,label:p.methodLabel,labelPlacement:"outside",placeholder:p.methodPlaceholder,selectedKeys:b.method?[b.method]:[],onSelectionChange:y,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:s.map($=>t.jsx(c.SelectItem,{"data-testid":`${u}-method-option-${$.value}`,children:$.label},$.value))}),o&&t.jsx(c.Input,{id:N,label:p.referenceLabel,labelPlacement:"outside",type:"text",value:b.reference,onChange:$=>w($.target.value),placeholder:p.referencePlaceholder,isDisabled:l,variant:"bordered",radius:"lg","data-testid":`${u}-reference-input`})]})};Co.displayName="OtherTenderForm";const Kx={collectedHeading:"Collected",remainingLabel:"Remaining:",completeLabel:"Complete",removeAriaLabel:"Remove this tender",removeTooltipForRecorded:"Already recorded",statusPending:"Pending",statusRecorded:"Approved",statusFailed:"Failed"},Yx={card:"lucide:credit-card",cash:"lucide:dollar-sign",check:"lucide:edit-3",other:"lucide:more-horizontal"},Qx={pending:"warning",recorded:"success",failed:"danger"},Zx=e=>e==="pending"||e==="recorded",Xx=e=>`#${e+1}`,ko=({total:e,tenders:s,onRemove:n,locale:a="en-US",labels:r,hideCollectedList:i=!1,variant:o="banner",className:l,"data-testid":d="split-payment-summary"})=>{const u={...Kx,...r},{collected:p,remaining:m,isComplete:x}=h.useMemo(()=>{const b=s.reduce((g,y)=>Zx(y.status)?g+y.amount:g,0),v=Math.max(e.value-b,0);return{collected:b,remaining:v,isComplete:b>=e.value&&e.value>0}},[s,e.value]),f=b=>b==="pending"?u.statusPending:b==="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:x?u.completeLabel:u.remainingLabel}),t.jsx("span",{className:"text-base font-semibold tracking-tight","data-testid":`${d}-remaining-amount`,children:xe(x?p: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:x?u.completeLabel:u.remainingLabel}),t.jsx("div",{className:"mt-1 text-4xl font-bold tracking-tight","data-testid":`${d}-remaining-amount`,children:xe(x?p:m,a,e.currency)})]}),!i&&s.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}),s.map((b,v)=>t.jsx(Jx,{index:v,tender:b,locale:a,currency:e.currency,removable:!!n&&b.status!=="recorded",onRemove:n?()=>n(b.id):void 0,statusLabel:f(b.status),removeAriaLabel:u.removeAriaLabel,recordedTooltip:u.removeTooltipForRecorded,dataTestId:`${d}-row-${v}`},b.id))]})]})};ko.displayName="SplitPaymentSummary";const Jx=({index:e,tender:s,locale:n,currency:a,removable:r,onRemove:i,statusLabel:o,removeAriaLabel:l,recordedTooltip:d,dataTestId:u})=>{const p=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:Xx(e)}),t.jsx(P,{icon:Yx[s.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:s.label}),t.jsx("span",{className:"font-semibold tabular-nums","data-testid":`${u}-amount`,children:xe(s.amount,n,a)}),t.jsx(c.Chip,{size:"sm",radius:"full",variant:"flat",color:Qx[s.status],startContent:s.status==="recorded"?t.jsx(P,{icon:"lucide:check-circle",width:14,height:14,"aria-hidden":"true"}):s.status==="failed"?t.jsx(P,{icon:"lucide:alert-circle",width:14,height:14,"aria-hidden":"true"}):void 0,"data-testid":`${u}-status`,children:o}),p&&(r?p:t.jsx(c.Tooltip,{content:d,placement:"left",children:t.jsx("span",{tabIndex:0,"aria-label":d,children:p})}))]})},eh=`
|
|
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 @@ ${n}${a}
|
|
|
38
38
|
from { opacity: 0; transform: translateY(-6px); }
|
|
39
39
|
to { opacity: 1; transform: translateY(0); }
|
|
40
40
|
}
|
|
41
|
-
`,ho=h.forwardRef(({children:e,relativeOverlayRoot:s=!0,className:n,style:a,"data-testid":r="modal-shell"},i)=>t.jsxs(t.Fragment,{children:[t.jsx("style",{children:Ip}),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",s&&"relative","motion-safe:animate-[pp-modal-in_220ms_ease-out]","motion-safe:transition-[min-height] motion-safe:duration-[420ms] motion-safe:ease-in-out",n),children:e})]}));ho.displayName="ModalShell";const bo=({title:e,subtitle:s,leading:n,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:[n,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}),s&&t.jsx("div",{className:"text-xs font-semibold text-default-500","data-testid":`${d}-subtitle`,children:s})]})]}),t.jsxs("div",{className:"flex items-center gap-2",children:[o,r&&t.jsx(I,{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"})})]})]});bo.displayName="ModalShellHeader";const go=({children:e,columns:s=2,className:n,"data-testid":a="modal-shell-footer"})=>t.jsx("footer",{className:c.cn("mt-2 gap-3",s===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",n),"data-testid":a,children:e});go.displayName="ModalShellFooter";const Op={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"},Bp={1:"grid-cols-1",2:"grid-cols-2"},wt={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 ${Ne} 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]",locked:"cursor-not-allowed border-dashed border-pos-line-strong bg-white text-pos-muted data-[hover=true]:border-pos-line-strong data-[hover=true]:bg-white data-[pressed=true]:scale-100"},qe={tile:`flex flex-col items-center justify-center gap-2 h-auto min-h-20 px-4 py-4 border bg-transparent transition-colors ${Ne}`,idle:"border-default-200 text-default-800 hover:bg-default-50",active:"border-primary bg-primary-50 text-primary",label:"text-sm font-medium",detailed:"items-start justify-start gap-1 whitespace-normal text-left",header:"mb-1 flex w-full flex-wrap items-start justify-between gap-2",description:"text-xs font-normal leading-snug text-default-600",lockedDescription:"text-default-500",badge:"shrink-0 whitespace-nowrap rounded-full bg-default-100 px-2 py-0.5 text-[11px] font-medium leading-4 text-default-600",locked:"cursor-not-allowed border-dashed border-default-300 bg-default-50 text-default-500 hover:bg-default-50 data-[hover=true]:opacity-100 data-[pressed=true]:scale-100",lockedIcon:"text-default-400"},hs=e=>typeof e=="string"?t.jsx(P,{icon:e,width:20,height:20,"aria-hidden":"true"}):e,zp=(e,s,n)=>{const a=`${e}-${s.key}`;return{badge:n&&s.badge!==void 0?`${a}-badge`:void 0,reason:`${a}-reason`,description:n&&s.description!==void 0?`${a}-description`:void 0}},Vp=e=>t.jsx("span",{"aria-hidden":"true",className:wt.icon,children:typeof e=="string"?t.jsx(P,{icon:e,width:"100%",height:"100%","aria-hidden":"true"}):e}),bs=`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 ${Ne}`,Up="pointer-events-none absolute -left-[9999px] top-0 flex flex-row gap-1 p-1 opacity-0",Fr="flex-none",Hp=typeof window<"u"?h.useLayoutEffect:h.useEffect,_r=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",yo=({options:e,selectedKey:s,onSelect:n,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",b=e.find(y=>y.key===s),v=e.some(y=>y.badge!==void 0||y.isLocked===!0),g=!x&&v;return i==="compact"?t.jsx(Wp,{options:e,selectedKey:s,onSelect:n,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(rt,{"aria-label":a?void 0:r,"aria-labelledby":a?`${p}-heading`:void 0,selectedKeys:s?[s]:[],onSelectionChange:y=>{const k=Array.from(y)[0];typeof k=="string"&&n(k)},placeholder:r,variant:"bordered",radius:"lg","data-testid":`${p}-mobile-select`,startContent:b?t.jsx("span",{"aria-hidden":"true",className:"shrink-0",children:hs(b.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||y.isLocked,...v&&y.description!==void 0?{description:y.description}:{},endContent:y.badge!==void 0?t.jsx("span",{className:qe.badge,children:y.badge}):void 0,startContent:t.jsx("span",{"aria-hidden":"true",className:"shrink-0",children:hs(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?wt.grid:"gap-3",Bp[u],Op[d]),"data-size":f,children:e.map(y=>{const N=s===y.key,k=y.isLocked===!0&&y.isDisabled!==!0,w=y.lockedReason??y.badge,$=zp(p,y,g),A=[$.badge,k&&w!==void 0&&(x||w!==y.badge)?$.reason:void 0,$.description].filter(Boolean).join(" ");return t.jsxs(I,{variant:"bordered",radius:"lg","aria-pressed":N,"aria-label":y.label,"aria-disabled":k||void 0,"aria-describedby":A||void 0,isDisabled:y.isDisabled,onPress:()=>{k||n(y.key)},"data-testid":y["data-testid"]??`${p}-${y.key}`,"data-locked":k||void 0,className:x?c.cn(wt.tile,k?wt.locked:N?wt.active:wt.idle):c.cn(qe.tile,g&&qe.detailed,k?qe.locked:N?qe.active:qe.idle),"data-size":f,children:[x?t.jsxs(t.Fragment,{children:[Vp(y.icon),t.jsx("span",{className:wt.label,children:y.label})]}):g?t.jsxs(t.Fragment,{children:[t.jsxs("span",{className:qe.header,children:[t.jsx("span",{"aria-hidden":"true",className:k?qe.lockedIcon:void 0,children:hs(y.icon)}),y.badge!==void 0?t.jsx("span",{id:$.badge,className:qe.badge,children:y.badge}):null]}),t.jsx("span",{className:qe.label,children:y.label}),y.description!==void 0?t.jsx("span",{id:$.description,className:c.cn(qe.description,k&&qe.lockedDescription),children:y.description}):null]}):t.jsxs(t.Fragment,{children:[t.jsx("span",{"aria-hidden":"true",className:k?qe.lockedIcon:void 0,children:hs(y.icon)}),t.jsx("span",{className:qe.label,children:y.label})]}),k&&w!==void 0&&(x||w!==y.badge)?t.jsx("span",{id:$.reason,className:"sr-only",children:w}):null]},y.key)})})]})};yo.displayName="TileSelect";function Wp({options:e,selectedKey:s,onSelect:n,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((L,S)=>({option:L,index:S})).filter(({option:L})=>L.alwaysInMenu!==!0).map(({index:L})=>L),[e]),p=m.length<e.length,x=h.useCallback(L=>{const S=m.map(D=>({index:D,priority:e[D]?.priority??0})).sort((D,E)=>D.priority-E.priority||E.index-D.index),M=new Set(S.slice(0,m.length-L).map(D=>D.index));return m.filter(D=>!M.has(D))},[e,m]),[b,v]=h.useState(e.length);Hp(()=>{const L=u.current,S=f.current;if(!L||!S)return;const M=()=>{const E=Array.from(S.children),R=E.slice(0,e.length).map(G=>G.getBoundingClientRect().width),T=E[e.length]?.getBoundingClientRect().width??0,H=window.getComputedStyle(L),K=Number.parseFloat(H.columnGap)||0,B=L.clientWidth-(Number.parseFloat(H.paddingLeft)||0)-(Number.parseFloat(H.paddingRight)||0);if(B<=0||R.some(G=>G===0)){v(m.length);return}const se=G=>{const Q=p||G<m.length,Y=G+(Q?1:0);return x(G).reduce((ne,ee)=>ne+(R[ee]??0),0)+(Q?T:0)+K*(Y-1)<=B};for(let G=m.length;G>=1;G-=1)if(se(G)){v(G);return}v(1)};M();const D=new ResizeObserver(M);return D.observe(L),()=>D.disconnect()},[e,o,x,m,p]);const g=Math.max(1,Math.min(b,i??m.length,m.length)),N=!p&&g===m.length-1&&b===m.length?m.length:g,k=p||N<m.length,w=new Set(x(N)),$=e.filter((L,S)=>w.has(S)),A=k?e.filter((L,S)=>!w.has(S)):[],j=A.find(L=>L.key===s);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:[$.map(L=>t.jsx(I,{variant:"light",radius:"full","aria-pressed":s===L.key,isDisabled:L.isDisabled||L.isLocked,onPress:()=>n(L.key),"data-testid":L["data-testid"]??`${d}-${L.key}`,className:c.cn(bs,_r(s===L.key)),children:L.label},L.key)),A.length>0&&t.jsxs(c.Dropdown,{placement:"bottom-end",radius:"lg",children:[t.jsx(c.DropdownTrigger,{children:t.jsxs(I,{variant:"light",radius:"full","aria-pressed":j!==void 0,"data-testid":`${d}-more`,className:c.cn(bs,"gap-1",j!==void 0?"min-w-0":"min-w-fit",_r(j!==void 0)),children:[t.jsx("span",{className:"min-w-0 truncate",children:j?.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:j?[j.key]:[],disabledKeys:A.filter(L=>L.isDisabled||L.isLocked).map(L=>L.key),onAction:L=>n(String(L)),children:A.map(L=>t.jsx(c.DropdownItem,{textValue:L.label,...L.description!==void 0?{description:L.description}:{},"data-testid":L["data-testid"]??`${d}-${L.key}`,children:L.label},L.key))})]})]}),t.jsxs("div",{ref:f,"aria-hidden":"true",className:Up,children:[e.map(L=>t.jsx(I,{variant:"light",radius:"full",tabIndex:-1,className:c.cn(bs,Fr),children:L.label},L.key)),t.jsxs(I,{variant:"light",radius:"full",tabIndex:-1,className:c.cn(bs,Fr,"gap-1"),children:[o,t.jsx(P,{icon:"lucide:chevron-down",width:14,height:14})]})]})]})}const qp={subtle:{wrapper:"bg-default-100",amount:"text-default-900"},success:{wrapper:"bg-success-50 text-success-700",amount:"text-success-700"}},vo=({total:e,label:s,locale:n="en-US",variant:a="subtle",className:r,"data-testid":i="payment-total-banner"})=>{const o=qp[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:s}),t.jsx("div",{className:c.cn("mt-1 text-4xl font-bold tracking-tight",o.amount),"data-testid":`${i}-amount`,children:xe(e.value,n,e.currency)})]})};vo.displayName="PaymentTotalBanner";const Gp={white:"bg-white/70 backdrop-blur-sm",transparent:"bg-transparent"},jo=({title:e,subtitle:s,backdrop:n="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",Gp[n],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}),s&&t.jsx("div",{className:"mt-1 text-sm text-default-600",children:s})]})]});jo.displayName="LoadingOverlay";const ha=({cashChange:e,label:s="Cash to return",secondaryLine:n,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:s}),t.jsx("span",{className:"text-2xl font-bold text-info-700","data-testid":`${d}-amount`,children:xe(e.value,a,e.currency)}),n&&t.jsx("span",{className:"mt-0.5 text-xs text-info-700/80",children:n})]}),r&&t.jsx(I,{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"})})]})};ha.displayName="PaymentCashChangeBanner";const wo=({title:e,subtitle:s,emailLine:n,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:s}),n&&a&&t.jsxs("p",{className:"text-default-700",children:[n,t.jsx("br",{}),t.jsx("strong",{className:"font-semibold",children:a})]})]}),m&&r&&t.jsx(ha,{cashChange:r,label:i,locale:o,align:"center",className:"max-w-[400px]","data-testid":`${f}-cash-change`}),d&&t.jsx(I,{color:"default",variant:"bordered",radius:"full",size:"lg",onPress:d,"data-testid":`${f}-close`,className:"mt-4 w-full",children:l})]})};wo.displayName="PaymentSuccessView";const ba=({heading:e,amountLabel:s,value:n,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":b="payment-sub-amount-input"})=>{const v=`${b}-input`,g=n!==void 0,[y,N]=h.useState(a??""),k=g?n:y,{isUntouched:w,markEdited:$}=uo(k),A=h.useCallback(S=>{if(m!==void 0){const M=Number.parseFloat(S.replace(",","."));if(Number.isFinite(M)&&M>m)return}$(S),g||N(S),r?.(S)},[m,r,$,g]),j=mo(w,A),L=h.useCallback(S=>{const M=S.currentTarget;requestAnimationFrame(()=>{M.isConnected&&M.select()})},[]);return t.jsxs("div",{className:c.cn("flex flex-col gap-3 border-t border-default-100 pt-5",x),"data-testid":b,children:[t.jsx("h3",{className:c.cn("text-lg font-semibold",p&&"sr-only"),"data-testid":`${b}-heading`,children:e}),t.jsx(c.Input,{ref:j,id:v,label:s,labelPlacement:"outside",classNames:p?{label:"sr-only"}:void 0,type:"text",inputMode:"decimal",pattern:"[0-9]*[.,]?[0-9]*",value:k,onChange:S=>A(S.target.value),onFocus:L,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":`${b}-field`})]})};ba.displayName="PaymentSubAmountInput";const Kp={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"}},Yp=e=>typeof e=="string"?t.jsx(P,{icon:e,className:"size-5","aria-hidden":"true"}):e,ga=({isOpen:e,title:s,confirmLabel:n,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":b="confirm-dialog"})=>{const v=i??o??null,g=Kp[d],y=p?null:Yp(x??g.icon);return t.jsx(rs,{isOpen:e,onOpenChange:N=>r?.(N),placement:"center",size:"md",isDismissable:(f??!0)&&!u,isKeyboardDismissDisabled:m||u,hideCloseButton:u,className:"gap-4 p-6",classNames:{base:"rounded-3xl"},"data-testid":b,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:[y?t.jsx("div",{"aria-hidden":"true","data-testid":`${b}-icon`,className:c.cn("flex size-10 items-center justify-center rounded-full",g.tile),children:y}):null,t.jsx("span",{"data-testid":`${b}-title`,className:"text-lg font-semibold text-zinc-950",children:s})]}),v!==null?t.jsx(c.ModalBody,{"data-testid":`${b}-body`,className:"gap-0 p-0",children:typeof v=="string"?t.jsx("p",{className:"mx-auto max-w-sm text-center text-sm text-gray-600",children:v}):v}):null,t.jsxs(c.ModalFooter,{className:"flex flex-col-reverse gap-2 p-0 sm:flex-row sm:gap-3",children:[t.jsx(I,{variant:"bordered",color:"default",radius:"full",onPress:()=>r?.(!1),isDisabled:u,"data-testid":`${b}-dismiss`,className:"w-full sm:flex-1",children:l}),t.jsx(I,{color:g.confirmColor,variant:"solid",radius:"full",onPress:a,isLoading:u,"data-testid":`${b}-confirm`,className:"w-full sm:flex-1",children:n})]})]})})};ga.displayName="ConfirmDialog";const vt={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"},Qp={danger:"bg-danger-50",warning:"bg-warning-50"},No=({message:e,description:s,confirmLabel:n,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 b=h.useId(),v=h.useId(),g=h.useRef(null),y=h.useRef(null),N=h.useRef(null),k=s!=null,w=h.useRef({isPending:l,containEscape:u,onCancel:i});w.current={isPending:l,containEscape:u,onCancel:i},h.useEffect(()=>{(d==="confirm"?y:N).current?.focus()},[]),h.useEffect(()=>{const j=g.current;if(j===null)return;const L=S=>{S.key==="Escape"&&(w.current.containEscape&&S.stopPropagation(),!w.current.isPending&&w.current.onCancel())};return j.addEventListener("keydown",L),()=>j.removeEventListener("keydown",L)},[]);const $=h.useRef(!1);h.useLayoutEffect(()=>{const j=g.current;if(j===null)return;const L=document.activeElement;if(l){const S=L===null||L===document.body||!j.contains(L),M=L instanceof HTMLButtonElement&&L.disabled;$.current&&(S||M)&&j.focus({preventScroll:!0});return}L===j&&(d==="confirm"?y:N).current?.focus()},[l,d]);const A=t.jsx(c.Card,{ref:g,role:"alertdialog","aria-modal":"false","aria-labelledby":b,"aria-describedby":k?v:void 0,"aria-busy":l||void 0,tabIndex:-1,shadow:"none",radius:"lg",onFocus:()=>{$.current=!0},onBlur:j=>{const L=j.relatedTarget;$.current=L instanceof Node&&j.currentTarget.contains(L)},className:c.cn(vt.box,Qp[o],m==="div"&&p),"data-testid":x,children:t.jsxs(c.CardBody,{className:vt.body,children:[t.jsxs("div",{className:vt.text,children:[t.jsx("p",{id:b,className:vt.message,children:e}),k?t.jsx("p",{id:v,className:vt.description,children:s}):null]}),t.jsxs("div",{className:vt.actions,children:[t.jsx(I,{ref:y,size:f,color:o,variant:"solid",onPress:r,isLoading:l,"data-testid":`${x}-confirm`,children:n}),t.jsx(I,{ref:N,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(vt.item,p),children:A}):A};No.displayName="InlineConfirm";const Zp={guardScope:(e,s)=>s(),bypass:e=>e(),report:()=>{},unreport:()=>{}},Hs=h.createContext(Zp),ya=h.createContext(null);function Xp(e){const{report:s,unreport:n}=h.useContext(Hs),a=h.useContext(ya),r=h.useId();h.useEffect(()=>{s(r,{scope:a,isDirty:e})},[s,r,a,e]),h.useEffect(()=>()=>n(r),[n,r])}function Jp(){const{guardScope:e,bypass:s}=h.useContext(Hs);return h.useMemo(()=>({guard:n=>e(null,n),bypass:s}),[e,s])}function Co(){const{guardScope:e}=h.useContext(Hs),s=h.useContext(ya);return h.useCallback(n=>e(s,n),[e,s])}const eh=({scope:e,children:s})=>t.jsx(ya.Provider,{value:e,children:s}),ko=({guard:e,children:s,title:n="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,b=h.useMemo(()=>({guardScope:x,bypass:e.bypass,report:m,unreport:p}),[x,e.bypass,m,p]);return t.jsxs(Hs.Provider,{value:b,children:[s,t.jsx(ga,{isOpen:l!==null,onOpenChange:v=>{v||f()},onConfirm:u,variant:"warning",title:n,description:a,confirmLabel:r,cancelLabel:i,"data-testid":o},d)]})};ko.displayName="DiscardGuard";const va=h.createContext(null);function th(){const e=h.useContext(va),s=Co(),n=e?.back,a=h.useCallback(()=>{n&&s(n)},[s,n]);return{isActive:e?.isActive??!0,canGoBack:e?.canGoBack??!1,back:a}}const sh=["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 nh(e){for(const s of e.querySelectorAll(sh))if(!s.closest('[hidden], [inert], [aria-hidden="true"]'))return s;return null}function Rr(e,s){return!e||!e.isConnected||!s.contains(e)||e.matches(":disabled")?!1:!e.closest("[hidden], [inert]")}const ah=new Set(["menu","listbox","dialog","grid","tree"]);function rh(e){for(const s of e.querySelectorAll('[aria-expanded="true"][aria-controls]')){const n=s.ownerDocument.getElementById(s.getAttribute("aria-controls")??"");if(!n?.isConnected)continue;if((s.getAttribute("aria-haspopup")??"false")!=="false"||ah.has(n.getAttribute("role")??""))return n}return null}const Mr="react-aria-focus-scope-restore";class ih{panels=new Map;active=null;setContainer(s,n){n?this.panels.set(s,{entry:null,last:null,...this.panels.get(s),container:n}):this.panels.delete(s)}setEntry(s,n){const a=this.panels.get(s);a?a.entry=n:n&&this.panels.set(s,{container:null,entry:n,last:null})}remember(s,n){const a=this.panels.get(s);a&&(a.last=n)}setActive(s,n){this.active={key:s,isReturn:n}}focusActive(){if(!this.active)return;const s=this.panels.get(this.active.key),n=s?.container;if(!s||!n||n.contains(document.activeElement))return;((this.active.isReturn&&Rr(s.last,n)?s.last:null)??(Rr(s.entry,n)?s.entry:null)??nh(n))?.focus()}recoverFocus(){const s=this.active?this.panels.get(this.active.key)?.container:null,n=s?rh(s):null;n?.focus(),n?.contains(document.activeElement)||this.focusActive()}}const lh="flex flex-initial items-center gap-2 py-4 pl-4 pr-12 text-large font-semibold",oh="min-w-0 flex-1 truncate text-large font-semibold",ch="flex shrink-0 items-center gap-2",dh="size-5";function uh({panels:e,children:s}){const[n]=h.useState(()=>new ih),{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)&&(n.setActive(i,l.keys.has(i)),n.focusActive())},[i,a,n]),t.jsx(t.Fragment,{children:a.map((l,d)=>t.jsx(mh,{entryKey:l.key,isActive:d===a.length-1,canGoBack:d>0,back:r,memory:n,children:s(l.panel,l)},l.key))})}const mh=({entryKey:e,isActive:s,canGoBack:n,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(Mr,f),()=>{u.removeEventListener(Mr,f),r.setContainer(e,null)}},[r,e]);const d=h.useMemo(()=>({isActive:s,canGoBack:n,back:a,setEntryFocus:l}),[s,n,a,l]);return t.jsx(va.Provider,{value:d,children:t.jsx(eh,{scope:e,children:t.jsx("div",{ref:o,hidden:!s,style:{display:s?"contents":"none"},onFocus:u=>{u.currentTarget.contains(u.target)&&r.remember(e,u.target)},children:i})})})},So=({title:e,onBack:s,backLabel:n="Back",isBackDisabled:a,size:r="md",actions:i,className:o,"data-testid":l="modal-panel-header"})=>{const d=h.useContext(va),u=Co(),f=h.useId(),m=s??(d?.canGoBack?d.back:void 0);return t.jsxs("header",{className:c.cn(lh,o),"data-testid":l,children:[m?t.jsx(I,{ref:d?.setEntryFocus,isIconOnly:!0,variant:"light",color:"default",size:r,"aria-label":n,"aria-describedby":f,isDisabled:a,onPress:()=>u(m),"data-testid":`${l}-back`,children:t.jsx(P,{icon:"solar:arrow-left-outline",className:dh,"aria-hidden":"true"})}):null,t.jsx("h2",{id:f,className:oh,"data-testid":`${l}-title`,children:e}),i?t.jsx("div",{className:ch,children:i}):null]})};So.displayName="ModalPanelHeader";function fh(e){const s=h.useRef(1),[n]=h.useState(e),[a,r]=h.useState(()=>[{key:"panel-0",panel:e}]),i=h.useCallback(f=>{const m=`panel-${s.current}`;return s.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?n:f)])},[i,n]);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 xh(){const e=h.useRef(new Map),[s,n]=h.useState(0),[a,r]=h.useState(null),[i,o]=h.useState(0),l=h.useCallback(()=>{let g=0;for(const y of e.current.values())y.isDirty&&(g+=1);n(g)},[]),d=h.useCallback((g,y)=>{e.current.set(g,y),l()},[l]),u=h.useCallback(g=>{e.current.delete(g),l()},[l]),f=h.useCallback((g,y)=>{let N=!1;for(const k of e.current.values())k.isDirty&&(g===null||k.scope===g)&&(N=!0);N?r({leave:y}):y()},[]),m=h.useCallback(g=>f(null,g),[f]),p=h.useCallback(g=>{for(const y of e.current.values())y.isDirty=!1;l(),r(null),g()},[l]),x=h.useCallback(g=>y=>{y?g(!0):m(()=>g(!1))},[m]),b=h.useCallback(()=>{const g=a?.leave;r(null),o(y=>y+1),g?.()},[a]),v=h.useCallback(()=>r(null),[]);return h.useMemo(()=>({isDirty:s>0,guard:m,bypass:p,guardOpenChange:x,internals:{pending:a,confirmKey:i,confirm:b,keepEditing:v,report:d,unreport:u,guardScope:f}}),[s,m,p,x,a,i,b,v,d,u,f])}const ph=60,hh=(e,s,n=ph)=>s?e>n:e<-n,$o=(e,s)=>Math.max(0,Math.min(e,s)),bh=160,gh=(e,s,n=bh)=>Math.min(e,Math.max(0,s-n)),yh=(e,s,n)=>$o(e-s,n),vh=(e,s,n)=>e!==null?$o(e,n):s?n:0,jh=e=>e?"":"transition-[height] duration-300 ease-out",wh=e=>({onDrag:(s,n)=>{const a=e.open?e.fullHeight:0;e.setDragHeight(yh(a,n?.offset?.y??0,e.fullHeight))},onDragEnd:(s,n)=>{hh(n?.offset?.y??0,e.open)&&e.onToggleOpen?.(),e.setDragHeight(null)}}),kt=(e,s)=>xe(e.value,s,e.currency),Pr=`opacity-60 transition-opacity ${Ne}`,ja=({item:e,locale:s,onRemove:n,removeAriaLabel:a,showRemoveButton:r=!0,compact:i=!1})=>{const o=!!e.children&&e.children.length>0,l=!!n&&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:Je[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:kt(e.amount,s)}),l&&t.jsx(I,{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:()=>n(e.id),children:t.jsx(P,{icon:"lucide:trash-2",width:16,height:16,className:"text-danger"})})]})]}),te(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(ja,{item:u,locale:s,onRemove:n,removeAriaLabel:a,showRemoveButton:r,compact:i},u.id))})]})};ja.displayName="SummaryItemRow";const Ao=({fee:e,locale:s,className:n})=>t.jsxs("div",{"data-testid":"summary-service-fee",className:c.cn("flex items-center justify-between gap-2",n),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:kt(e.amount,s)})]});Ao.displayName="SummaryServiceFeeRow";const wa=({row:e,locale:s,emphasized:n,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(n?"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(I,{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:kt(e.amount,s)})]})};wa.displayName="SummaryTotalsLineRow";const Do=({pricesInLabel:e,currency:s,items:n,serviceFee:a,rows:r,locale:i,onRemoveItem:o,removeAriaLabel:l,onRemoveTotalRow:d,removeTotalRowAriaLabel:u,showRemoveButton:f,emptyState:m,compact:p=!1,classNames:x})=>{const b=(n?.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}),s!=null&&t.jsx("span",{children:s})]}),b?t.jsx("div",{className:c.cn(p?"flex flex-col divide-y divide-default-100":"flex flex-col gap-4",x.items),children:n.map(v=>t.jsx(ja,{item:v,locale:i,onRemove:o,removeAriaLabel:l,showRemoveButton:f,compact:p},v.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(Ao,{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((v,g)=>t.jsx(wa,{row:v,locale:i,emphasized:!p&&g===0,onRemove:d,removeAriaLabel:u,showRemoveButton:f,compact:p},v.key))})]})};Do.displayName="SummaryBody";const Eo=({total:e,locale:s,compact:n=!1,className:a})=>{const r=n?"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:kt(e.amount,s)})]})};Eo.displayName="SummaryGrandTotalRow";const Lo=({secondaryTotal:e,locale:s,className:n})=>t.jsxs("div",{"data-testid":"summary-secondary-total",className:c.cn("flex items-center justify-between text-lg font-semibold leading-7 text-primary",n),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:kt(e.amount,s)})]});Lo.displayName="SummarySecondaryTotalRow";const _s=({action:e,disabledByLoading:s,className:n,testId:a="summary-cta"})=>t.jsx(I,{color:"primary",radius:"full",className:c.cn("px-[18px] py-[14px] font-medium",n),"data-testid":a,isLoading:e.isLoading,isDisabled:e.isDisabled||s,onPress:e.onPress,endContent:t.jsx(P,{icon:"lucide:arrow-right",width:16,height:16}),children:e.label});_s.displayName="SummaryPrimaryCta";const Fo=({title:e,total:s,secondaryTotal:n,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:s.label??"Total"}),t.jsx("span",{className:"whitespace-nowrap",children:kt(s.amount,a)})]}),n&&t.jsxs("span",{className:"flex items-center justify-between text-lg font-semibold leading-7 text-primary",children:[t.jsx("span",{children:n.label}),t.jsx("span",{className:"whitespace-nowrap",children:kt(n.amount,a)})]})]})]})});Fo.displayName="SummaryCollapseHeader";const _o=({cart:e,ariaLabel:s,onPress:n,className:a})=>t.jsxs("button",{type:"button","data-testid":"summary-cart","aria-label":s,onClick:n,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})]});_o.displayName="SummaryCartButton";const Ro=({open:e,progress:s,dragging:n,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-s},className:c.cn("col-start-1 row-start-1 flex items-stretch gap-2.5",e&&"pointer-events-none",!n&&"transition-opacity duration-300"),children:[i&&t.jsx(_o,{cart:i,ariaLabel:o,className:f.cart,onPress:()=>{u?.(),i.onPress?.()}}),a&&t.jsx(_s,{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:s},className:c.cn("col-start-1 row-start-1 flex",!e&&"pointer-events-none",!n&&"transition-opacity duration-300"),children:t.jsx(_s,{action:a,disabledByLoading:r,className:c.cn("h-[52px] w-full",f.cta)})})]}),l&&t.jsx("div",{children:l})]});Ro.displayName="SummaryActionBar";const Nh="(max-width: 767px)",Ch=e=>typeof window<"u"&&typeof window.matchMedia=="function"?window.matchMedia(e).matches:!1,kh=(e=Nh)=>{const[s,n]=h.useState(()=>Ch(e));return h.useEffect(()=>{if(typeof window>"u"||typeof window.matchMedia!="function")return;const a=window.matchMedia(e),r=()=>n(a.matches);return r(),a.addEventListener("change",r),()=>a.removeEventListener("change",r)},[e]),s},Mo=({title:e="Summary",pricesInLabel:s="Prices are in",currency:n,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:b,defaultOpen:v=!1,primaryAction:g,isLoading:y=!1,onRemoveItem:N,showRemoveButton:k,ctaCaption:w,ctaError:$,variant:A,cart:j,emptyState:L,labels:S,classNames:M={},density:D="default","data-testid":E="summary",className:R})=>{const T=S?.removeAriaLabel??"Remove item",H=S?.removeTotalRowAriaLabel??"Remove discount",K=S?.removePostTotalRowAriaLabel??"Remove applied code",B=S?.toggleAriaLabel??"Toggle summary",se=S?.cartAriaLabel??"View cart",G=D==="compact",Q=kh(),ce=p??(A??(Q?"mobile":"main"))==="mobile",[ne,ee]=h.useState(v),le=x!==void 0,U=!ce||(le?x:ne),z=h.useCallback(()=>{le||ee(O=>!O),b?.()},[le,b]),[Z,Ue]=h.useState(0),[Re,Me]=h.useState(null),ae=h.useRef(null),Se=h.useRef(null),He=h.useCallback(()=>{const O=ae.current;O&&Ue(gh(O.scrollHeight,window.innerHeight))},[]),it=h.useCallback(O=>{Se.current?.disconnect(),Se.current=null,ae.current=O,O&&(He(),typeof ResizeObserver<"u"&&(Se.current=new ResizeObserver(He),Se.current.observe(O)))},[He]);h.useEffect(()=>(window.addEventListener("resize",He),()=>window.removeEventListener("resize",He)),[He]);const je=wh({open:U,fullHeight:Z,setDragHeight:Me,onToggleOpen:z}),We=Re!==null,ue=vh(Re,U,Z),we=Z>0?Math.min(1,Math.max(0,ue/Z)):U?1:0,Ce=t.jsx(Eo,{total:l,locale:a,compact:G,className:M.total}),C=d&&d.length>0&&t.jsx("div",{"data-testid":"summary-post-total-rows",className:"flex flex-col gap-4",children:d.map(O=>t.jsx(wa,{row:O,locale:a,emphasized:!1,onRemove:f,removeAriaLabel:K,showRemoveButton:k,compact:G},O.key))}),F=m&&t.jsx(Lo,{secondaryTotal:m,locale:a,className:M.secondaryTotal}),_=w!=null&&t.jsx("p",{"data-testid":"summary-cta-caption",className:c.cn("text-center text-sm text-default-500",M.ctaCaption),children:w}),W=$!=null&&t.jsx("p",{role:"alert","data-testid":"summary-cta-error",className:c.cn("text-center text-sm text-danger",M.ctaError),children:$}),V=t.jsx(Do,{pricesInLabel:s,currency:n,items:r,serviceFee:i,rows:o,locale:a,onRemoveItem:N,removeAriaLabel:T,onRemoveTotalRow:u,removeTotalRowAriaLabel:H,showRemoveButton:k,emptyState:L,compact:G,classNames:M});return ce?t.jsxs(Ve.motion.section,{"data-testid":E,drag:"y",dragConstraints:{top:0,bottom:0},dragElastic:.12,dragSnapToOrigin:!0,onDrag:je.onDrag,onDragEnd:je.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)]",R,M.base),children:[t.jsx(Fo,{title:e,total:l,secondaryTotal:m,locale:a,open:U,progress:we,dragging:We,toggleAriaLabel:B,onToggleOpen:z,classNames:M}),t.jsx("div",{"data-testid":"summary-reveal","aria-hidden":!U,style:{height:ue},className:c.cn("min-h-0",U&&!We?"overflow-y-auto overscroll-contain [scrollbar-width:none] [&::-webkit-scrollbar]:hidden":"overflow-hidden",!U&&"pointer-events-none",jh(We)),children:t.jsxs("div",{ref:it,className:G?"flex flex-col gap-3 pb-4":"flex flex-col gap-4 pb-4",children:[V,!G&&t.jsx(c.Divider,{className:"bg-default-200"}),Ce,C,F]})}),t.jsx(Ro,{open:U,progress:we,dragging:We,primaryAction:g,isLoading:y,cart:j,cartAriaLabel:se,ctaCaption:_,ctaError:W,onToggleOpen:z,classNames:M})]}):t.jsxs("section",{"data-testid":E,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",R,M.base),children:[!G&&t.jsx("div",{className:c.cn("flex items-center justify-between",M.header),children:t.jsx("h2",{"data-testid":"summary-title",className:c.cn("text-xl font-semibold leading-7 text-foreground",M.title),children:e})}),V,!G&&t.jsx(c.Divider,{className:"bg-default-200"}),Ce,C,F,m&&g&&t.jsx(c.Divider,{className:"bg-default-200"}),g&&t.jsx(_s,{action:g,disabledByLoading:y,className:c.cn("w-full",M.cta)}),W,_]})};Mo.displayName="Summary";const ot={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"},Tr={done:"bg-pos-ok",active:"bg-primary",upcoming:"bg-pos-line"},Sh={done:"text-pos-ok",active:"text-pos-ink",upcoming:"text-pos-muted"},$h={ariaLabel:"Progress",completed:"completed"},Na=({steps:e,activeStepId:s,showLabels:n=!0,onStepPress:a,isStepReachable:r,labels:i,className:o,"data-testid":l="step-progress"})=>{const d={...$h,...i},u=e.filter(p=>p.state!=="skipped"),f=Math.max(0,u.findIndex(p=>p.id===s)),m=p=>p<f?"done":p===f?"active":"upcoming";return n?t.jsx("ol",{"aria-label":d.ariaLabel,className:c.cn(ot.list,o),"data-testid":l,children:u.map((p,x)=>{const b=m(x),v=t.jsxs(t.Fragment,{children:[t.jsx("span",{"aria-hidden":"true",className:c.cn(ot.segment,"w-full",Tr[b]),"data-testid":`${l}-segment-${p.id}`}),t.jsxs("span",{className:c.cn(ot.name,Sh[b]),"data-testid":`${l}-name-${p.id}`,children:[b==="done"&&t.jsx("span",{"aria-hidden":"true",className:ot.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}),b==="done"&&t.jsxs("span",{className:"sr-only",children:[", ",d.completed]})]})]}),g=r?r(p.id,x):x<f,y=b==="active"?"step":void 0;return t.jsx("li",{className:ot.item,"aria-current":a?void 0:y,"data-state":b,"data-testid":`${l}-step-${p.id}`,children:a?t.jsx("button",{type:"button",className:c.cn(ot.step,ot.button),disabled:!g,"aria-current":y,onClick:()=>a(p.id),"data-testid":`${l}-button-${p.id}`,children:v}):t.jsx("div",{className:ot.step,children:v})},p.id)})}):t.jsx("div",{"aria-hidden":"true",className:c.cn(ot.bare,o),"data-testid":l,children:u.map((p,x)=>t.jsx("span",{className:c.cn(ot.segment,"flex-1",Tr[m(x)]),"data-state":m(x)},p.id))})};Na.displayName="StepProgress";const Ah={back:"Back",close:"Close",cancel:"Cancel",partialBadge:"Partial refund",owesBadge:"Customer owes",ofSeparator:"of"},Dh={backgroundColor:oe.destructive,color:"#fff"},Eh={warn:{backgroundColor:oe["warn-fill"],color:oe.warn},ok:{backgroundColor:oe["ok-fill"],color:oe.ok},neutral:{backgroundColor:"hsl(var(--heroui-default-100))",color:"hsl(var(--heroui-default-600))",border:`1px solid ${oe.line}`}},pn="inline-flex h-[22px] items-center gap-[5px] whitespace-nowrap rounded-full px-[9px] text-xs font-medium leading-none",hn="absolute top-0 h-5 w-5 opacity-0",Po=({onClose:e,steps:s,activeStepId:n,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 b={...Ah,...f},v=s.find(N=>N.id===n),g=r??e,y=r?b.back:b.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:[g&&t.jsx(I,{variant:"light",className:"h-10 min-w-0 gap-2 rounded-xl px-4 text-sm font-semibold text-default-600",onPress:g,"data-testid":`${p}-header-back`,startContent:t.jsx(P,{icon:"lucide:circle-chevron-left",width:18,height:18,"aria-hidden":"true"}),children:y}),t.jsxs("div",{className:"min-w-0",children:[t.jsx("h2",{className:"text-lg font-semibold","data-testid":`${p}-header-title`,children:v?.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":b.close,onClick:e,className:c.cn(hn,"left-0"),"data-testid":`${p}-header-close`}),r&&t.jsx("button",{type:"button","aria-label":b.back,onClick:r,className:c.cn(hn,"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(hn,"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:xe(o.amount.value,void 0,o.amount.currency)}),o.of&&t.jsxs(t.Fragment,{children:[t.jsx("span",{children:b.ofSeparator}),t.jsx("span",{className:"tabular-nums text-default-900","data-testid":`${p}-total-of`,children:xe(o.of.value,void 0,o.of.currency)})]}),o.badge==="partial"&&t.jsx("span",{className:c.cn(pn,"bg-pos-warn-fill text-pos-warn"),"data-testid":`${p}-total-partial`,children:b.partialBadge}),o.badge==="owes"&&t.jsx("span",{className:c.cn(pn,"border border-pos-line bg-default-100 text-default-600"),"data-testid":`${p}-total-owes`,children:b.owesBadge}),typeof o.badge=="object"&&t.jsx("span",{className:pn,style:Eh[o.badge.tone],"data-tone":o.badge.tone,"data-testid":`${p}-total-badge`,children:o.badge.label})]}),t.jsx(I,{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"?Dh:void 0,isLoading:i.loading,isDisabled:i.disabled,onPress:i.onClick,"data-testid":`${p}-primary`,children:i.label})]})]}),t.jsx(Na,{steps:s,activeStepId:n,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]})};Po.displayName="WizardShell";const Lh=(e,s,n)=>Math.min(Math.max(e,s),n);function Fn(e,s,n){const a=Math.max(1,Math.trunc(s)),r=Lh(Math.trunc(n),0,a);if(r===a)return{...e};if(r===0)return{value:0,currency:e.currency};const i=Math.pow(10,Tt(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 Fh(e,s){return Fn(e,s,1)}const _h=e=>Number.isFinite(e)?e.toFixed(2):"",_n=({value:e,expected:s,max:n,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-s)>.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??_h(e),onChange:x=>{const b=x.target.value,v=Number.parseFloat(b.replace(",","."));n!==void 0&&Number.isFinite(v)&&v>n+.004||(f(b),Number.isFinite(v)&&v>=0?a(v):b.trim()===""&&a(0))},onFocus:x=>x.currentTarget.select(),onBlur:()=>f(null),"data-testid":d})]})};_n.displayName="AmountCell";const Rh={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"},Mh="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",Ir="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",bn="absolute h-5 w-5 opacity-0",Ph=e=>{const s=xe(e.paidAmount.value,void 0,e.paidAmount.currency);if(e.quantity<=1)return s;const n=Fh(e.paidAmount,e.quantity);return`${e.quantity} × ${xe(n.value,void 0,n.currency)} · ${s}`},To=({items:e,selections:s,onSelectionChange:n,onRestockToggle:a,onDispositionChange:r,amountOnly:i,labels:o,className:l,"data-testid":d="line-item-list"})=>{const u={...Rh,...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=s[m.id],x=m.state==="already_refunded"||m.state==="non_refundable",b=`${d}-row-${m.id}`,v=Math.max(1,Math.trunc(m.quantity)),g=p?.quantity,y=p?.selected?Math.min(g??v,v):g??0,N=Fn(m.paidAmount,v,y).value,k=p?.amount??(p?.selected?N:0),w=y===0&&k>.004,$=j=>n(m.id,{selected:j.quantity>0||j.amount>.004,mode:"full",...j}),A=j=>{const L=Math.min(Math.max(j,0),v);$({quantity:L,amount:Fn(m.paidAmount,v,L).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":b,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":`${b}-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":`${b}-detail`,children:m.detail??Ph(m)}),w&&t.jsx("p",{className:"mt-[3px] text-[12.5px] italic text-default-500","data-testid":`${b}-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":`${b}-partial`,children:[x?t.jsx("span",{className:"text-sm font-semibold tabular-nums",children:xe(m.paidAmount.value,void 0,m.paidAmount.currency)}):t.jsx(_n,{value:k,expected:N,max:m.paidAmount.value,onChange:j=>$({quantity:y,amount:j}),ariaLabel:u.amount.replace("{name}",m.name),className:"w-[120px]","data-testid":`${b}-amount`,inputTestId:`${b}-partial-input-field`}),x?t.jsx("span",{className:Mh,"data-testid":`${b}-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":`${b}-qty`,children:[t.jsx("button",{type:"button",className:Ir,"aria-label":u.decrease.replace("{name}",m.name),disabled:y===0,onClick:()=>A(y-1),"data-testid":`${b}-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":`${b}-qty-value`,children:y}),t.jsx("button",{type:"button",className:Ir,"aria-label":u.increase.replace("{name}",m.name),disabled:y===v,onClick:()=>A(y+1),"data-testid":`${b}-qty-increase`,children:"+"})]})]})]}),y>=v&&t.jsx("p",{className:"mt-2 text-xs text-default-500","data-testid":`${b}-max-note`,children:u.maxNote.replace("{count}",String(v))}),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":`${b}-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})]}),y>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(rt,{"aria-label":u.disposition,className:"w-[220px]",selectedKeys:[m.restock.disposition??(m.restock.on?"stock":"norestock")],onSelectionChange:j=>{if(j==="all")return;const L=[...j][0];L&&(r?.(m.id,L),a(m.id,L==="stock"))},"data-testid":`${b}-restock`,children:f.map(j=>t.jsx(c.SelectItem,{children:j.label},j.key))})]})]}),!x&&t.jsxs(t.Fragment,{children:[t.jsx(c.Checkbox,{className:c.cn(bn,"right-0 top-0 m-0 p-0"),isSelected:!!p?.selected,onValueChange:j=>n(m.id,{selected:j,mode:"full"}),"aria-label":m.name,"data-testid":`${b}-checkbox`}),t.jsx("button",{type:"button","aria-label":u.partialLink,onClick:()=>document.querySelector(`[data-testid="${b}-partial-input-field"]`)?.focus(),className:c.cn(bn,"left-0 top-0"),"data-testid":`${b}-partial-link`}),t.jsx("button",{type:"button","aria-label":u.partialCancel,onClick:()=>$({quantity:y,amount:N}),className:c.cn(bn,"left-5 top-0"),"data-testid":`${b}-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}",xe(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(_n,{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"})})]})]})})]}))]})};To.displayName="LineItemList";const Th={color:oe.danger},Io=({children:e,className:s,"data-testid":n="meta-card"})=>t.jsx("div",{className:c.cn("mx-auto mt-[18px] flex max-w-[1040px] flex-col gap-3",s),"data-testid":n,children:t.jsx("div",{className:"rounded-[14px] border border-pos-line bg-white px-4 py-3.5 text-default-900",children:e})});Io.displayName="MetaCard";const Oo=({label:e,htmlFor:s,required:n,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:s,className:"text-[13px] font-medium text-default-600",children:[e,n&&t.jsx("span",{"aria-hidden":"true",className:"ms-0.5 text-danger",style:Th,"data-testid":`${i}-required`,children:"*"})]}),t.jsx("div",{className:"w-full sm:w-[290px] sm:shrink-0",children:a})]});Oo.displayName="MetaCard.Row";const Bo=({label:e,children:s,className:n,"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",n),"data-testid":a,children:[e&&t.jsx("p",{className:"text-[13px] font-medium text-default-600",children:e}),s]});Bo.displayName="MetaCard.Section";const Ih=Object.assign(Io,{Row:Oo,Section:Bo}),zo=({heading:e,icon:s="lucide:rotate-ccw",action:n,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:s,width:16,height:16,"aria-hidden":"true"}),t.jsx("h3",{"data-testid":`${i}-heading`,children:e}),t.jsx("div",{className:"flex-1"}),n&&t.jsxs("button",{type:"button",disabled:n.disabled,onClick:n.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:n.icon??"lucide:plus",width:14,height:14,"aria-hidden":"true"}),n.label]})]}),a]});zo.displayName="SectionPanel";const Vo=({name:e,detail:s,icon:n="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:n,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}),s&&t.jsx("p",{className:"text-[12.5px] text-default-500",children:s})]})]});Vo.displayName="CustomerCard";const Oh={label:"Reason for the return",placeholder:"Select a reason…"},Uo=({options:e,value:s,onChange:n,error:a,isRequired:r,labels:i,className:o,"data-testid":l="reason-select"})=>{const d={...Oh,...i};return t.jsx(rt,{label:d.label,labelPlacement:"outside",placeholder:d.placeholder,selectedKeys:s?[s]:[],isRequired:r,isInvalid:!!a,errorMessage:a,className:c.cn(o),"data-testid":l,onSelectionChange:u=>{if(u==="all")return;const f=[...u][0];f&&n(String(f))},children:e.map(u=>t.jsx(c.SelectItem,{children:u.label},u.id))})};Uo.displayName="ReasonSelect";const Bh={toggle:"Add a note",optionalTag:"(optional)",heading:"Additional note",placeholder:"Add a note (optional)"},Ho=({value:e,onChange:s,maxLength:n,alwaysExpanded:a=!1,hideLabel:r=!1,labels:i,className:o,"data-testid":l="notes-field"})=>{const d={...Bh,...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=>s(m.target.value),maxLength:n,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=>s(m.target.value),maxLength:n,placeholder:d.toggle,"aria-label":d.toggle,variant:"bordered",radius:"lg","data-testid":`${l}-textarea`}):t.jsxs(I,{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})]})})};Ho.displayName="NotesField";const zh={info:"solar:info-circle-bold",success:"solar:check-circle-bold",warning:"solar:danger-triangle-bold",danger:"solar:danger-circle-bold"},Vh="solar:close-circle-linear",Uh={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"}},Hh={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"}},Wh={info:"status",success:"status",warning:"alert",danger:"alert"};function Ca({tone:e="info",variant:s="callout",title:n,description:a,actions:r,onDismiss:i,dismissLabel:o="Dismiss",role:l=Wh[e],className:d,"data-testid":u="notice"}){const f=Ms(),m=Uh[s],p=Hh[e],x=s==="banner",b=te(n),v=te(a),g=b?x?t.jsx("p",{"data-testid":`${u}-title`,className:c.cn(m.title,p.title),children:n}):t.jsx("span",{"data-testid":`${u}-title`,className:m.title,children:n}):null,y=v?x?t.jsx("p",{"data-testid":`${u}-description`,className:c.cn(m.description,b&&"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":s,"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:zh[e],width:m.iconSize,height:m.iconSize})}),t.jsxs("div",{className:m.text,children:[x?t.jsxs(t.Fragment,{children:[g,y]}):t.jsxs("p",{children:[g,b&&v?" ":null,y]}),r?t.jsx("div",{"data-testid":`${u}-actions`,className:m.actions,children:r}):null]}),i?t.jsx(I,{isIconOnly:!0,color:"default",size:"sm",radius:"full",variant:"light","aria-label":o,onPress:i,disableAnimation:f,className:c.cn(m.dismiss,Ne),"data-testid":`${u}-dismiss`,children:t.jsx(P,{icon:Vh,width:"1.125rem",height:"1.125rem"})}):null]})}Ca.displayName="Notice";const Or="h-8 min-w-0 rounded-[0.625rem] px-3 text-[0.8125rem] font-semibold",Ws=({tone:e,title:s,body:n,onRetry:a,retryLabel:r,onChooseDifferent:i,chooseDifferentLabel:o,className:l,"data-testid":d,retryTestId:u,chooseDifferentTestId:f})=>t.jsx(Ca,{variant:"banner",tone:e,title:s,description:n,className:l,"data-testid":d,actions:t.jsxs(t.Fragment,{children:[a&&t.jsx(I,{color:"primary",className:Or,onPress:a,"data-testid":u,children:r}),t.jsx(I,{variant:"bordered",className:c.cn(Or,"border-1 border-pos-line bg-white text-default-900"),onPress:i,"data-testid":f,children:o})]})});Ws.displayName="TenderBanner";const qh={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"},Gh={card:"lucide:credit-card",cash:"lucide:dollar-sign",check:"lucide:edit-3",other:"lucide:more-horizontal"},Wo=({tenders:e,selectedTenderId:s,onSelect:n,onSplit:a,error:r,labels:i,className:o,"data-testid":l="tender-methods"})=>{const d={...qh,...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(Ws,{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===s;return t.jsxs("button",{type:"button",role:"radio","aria-checked":m,onClick:()=>n(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:Gh[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:xe(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})]})]})]})};Wo.displayName="TenderMethods";const Kh=e=>e.refunded!==null,Yh={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"},Qh="mb-2 text-[11px] font-semibold uppercase tracking-[.08em] text-default-500",Zh="inline-flex h-[22px] shrink-0 items-center gap-[5px] whitespace-nowrap rounded-full px-[9px] text-xs font-medium leading-none",qo=({parts:e,refundedSoFar:s,remaining:n,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={...Yh,...f},b=e.filter(Kh),v=e.find(j=>j.tenderId===a.tenderId)?.label,g=!!(r?.length&&a.onTenderChange),y=Tt(n.currency),{draft:N,setDraft:k,normalize:w}=co(a.amount,String),$=h.useCallback(j=>{pa(j,y)&&(k(j),a.onAmountChange(ns(j)??0))},[a,k,y]),A=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(Ws,{tone:A?"danger":"warning",title:A?x.declinedTitle:x.networkTitle,body:A?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:xe(n.value,void 0,n.currency)}),t.jsxs("span",{className:"sr-only",children:[x.refundedSoFar,": ",xe(s.value,void 0,s.currency)]})]}),b.length>0&&t.jsxs("div",{children:[t.jsx("p",{className:Qh,children:x.refundedSoFar}),b.map((j,L)=>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-${j.tenderId}-done`,children:[t.jsxs("span",{className:"w-[22px] shrink-0 font-bold text-default-600",children:["#",L+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:j.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:j.label}),j.feeNote&&t.jsx("span",{className:"block text-[11.5px] text-default-500",children:j.feeNote})]}),t.jsx("span",{className:"font-semibold tabular-nums",children:xe(j.refunded.value,void 0,j.refunded.currency)}),t.jsx("span",{className:c.cn(Zh,j.status==="pending"?"bg-pos-warn-fill text-pos-warn":"bg-pos-ok-fill text-pos-ok"),children:j.status==="pending"?x.pending:x.succeeded})]},j.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(b.length+1))}),v&&t.jsx("span",{className:"text-xs text-default-500",children:v})]}),t.jsx("p",{"aria-hidden":"true",className:"mb-1.5 text-[13px] font-semibold","data-testid":`${p}-amount-label`,children:x.amountForPart}),t.jsx(ba,{heading:x.amountForPart,amountLabel:x.amountForPart,hideHeading:!0,placeholder:"$0.00",value:N,onChange:$,onBlur:w,maxAmount:n.value,isDisabled:d,className:"gap-0 border-t-0 pt-0","data-testid":`${p}-amount`}),g&&t.jsx("div",{className:"mt-2.5 flex gap-2","data-testid":`${p}-methods`,children:r?.map(j=>{const L=j.tenderId===a.tenderId;return t.jsxs("button",{type:"button","aria-pressed":L,disabled:j.disabled||d,onClick:()=>a.onTenderChange?.(j.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",L?"border-primary bg-primary/5 text-primary":"border-pos-line text-default-600"),"data-testid":`${p}-method-${j.tenderId}`,children:[j.icon&&t.jsx(P,{icon:j.icon,width:15,height:15,"aria-hidden":"true"}),j.label]},j.tenderId)})})]}),!u&&t.jsxs("div",{className:"mt-4 flex items-center gap-3",children:[t.jsx(I,{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(I,{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})]})]})};qo.displayName="SplitTenderPanel";const Go="hsl(var(--heroui-primary))",Xh="hsl(var(--heroui-primary) / 0.05)",Ko="hsl(var(--heroui-default-100))",Yo="hsl(var(--heroui-default-600))",ka={card:"lucide:credit-card",cash:"lucide:dollar-sign",check:"lucide:edit-3",store_credit:"lucide:gift",reader:"lucide:nfc",other:"lucide:more-horizontal"},de={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"},Jh={idle:{borderColor:oe.line,backgroundColor:"#fff"},selected:{borderColor:Go,backgroundColor:Xh},declined:{borderColor:oe.danger,backgroundColor:oe["danger-fill"]}},Rs={idle:{backgroundColor:Ko,color:Yo},selected:{backgroundColor:Go,color:"#fff"}},eb={backgroundColor:Ko,color:Yo},tb={borderColor:oe.line},Br={declined:{color:oe.danger},pending:{color:oe.warn,backgroundColor:oe["warn-fill"]},done:{color:oe.ok,backgroundColor:oe["ok-fill"]}},sb={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"},nb=e=>{try{return new Intl.NumberFormat("en-US",{style:"currency",currency:e}).formatToParts(0).find(s=>s.type==="currency")?.value??e}catch{return e}},ab=({method:e,currency:s,busy:n,labels:a,onToggle:r,onAmountChange:i,onAmountBlur:o,onRemove:l,testId:d})=>{const u=e.status??"idle",f=u==="pending"||u==="done",m=n||f,p=!!(e.removable&&l),x=e.cap?.currency??s,b=Tt(x),v=`${d}-amount`,g=a.amountFor.replace("{method}",e.label),y=h.useCallback(A=>{if(!pa(A,b))return;const j=ns(A);e.cap&&j!==null&&j>e.cap.value||i(e.id,A)},[b,e.cap,e.id,i]),N=h.useCallback(A=>{const j=A.currentTarget;requestAnimationFrame(()=>{j.isConnected&&j.select()})},[]),k=u==="declined"?"declined":e.selected?"selected":"idle",w=e.statusLabel??(u==="idle"?void 0:a[u]),$=t.jsxs("span",{className:de.toggleHeader,children:[t.jsx("span",{className:de.iconBox,style:e.selected?Rs.selected:Rs.idle,"data-testid":`${d}-icon`,children:t.jsx(P,{icon:ka[e.kind],width:18,height:18,"aria-hidden":"true"})}),t.jsxs("span",{className:de.text,children:[t.jsx("span",{className:de.label,children:e.label}),u==="declined"&&w?t.jsx("span",{className:de.status,style:Br.declined,"data-testid":`${d}-status`,children:w}):e.subtitle&&t.jsx("span",{className:de.subtitle,children:e.subtitle})]}),f&&w&&t.jsx("span",{className:de.badge,style:Br[u],"data-testid":`${d}-status`,children:w})]});return t.jsxs("div",{className:de.card,style:Jh[k],"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(de.toggle,de.focusRing,p&&de.toggleRemovable),"data-testid":`${d}-toggle`,children:$}),t.jsxs("div",{className:de.amountSlot,children:[t.jsx("label",{htmlFor:v,className:"sr-only",children:g}),t.jsx(c.Input,{id:v,"aria-label":g,type:"text",inputMode:"decimal",placeholder:"0.00",value:e.amount??"",onChange:A=>y(A.target.value),onFocus:N,onBlur:()=>o?.(e.id),isDisabled:m,variant:"bordered",startContent:t.jsx("span",{className:"text-[15px] font-semibold text-default-500","aria-hidden":"true",children:nb(x)}),classNames:{inputWrapper:de.amountWrapper,input:de.amountInput},"data-testid":`${d}-amount`})]})]}):t.jsxs("button",{type:"button","aria-pressed":!1,disabled:m,onClick:()=>r(e.id),className:c.cn(de.toggle,de.toggleUnselected,de.focusRing,p&&de.toggleRemovable),"data-testid":`${d}-toggle`,children:[$,t.jsx("span",{className:de.lowerSlot,style:eb,"data-testid":`${d}-cap`,children:e.cap?a.upTo.replace("{amount}",xe(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:n,onClick:()=>l?.(e.id),className:c.cn(de.remove,de.focusRing),"data-testid":`${d}-remove`,children:t.jsx(P,{icon:"lucide:x",width:16,height:16,"aria-hidden":"true"})})]})},Qo=({methods:e,onToggle:s,onAmountChange:n,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={...sb,...f};return t.jsxs("div",{className:c.cn(de.root,m),"data-testid":p,children:[d&&t.jsx(Ws,{tone:d.tone,title:d.title,body:d.body,onRetry:d.onRetry,retryLabel:x.retry,onChooseDifferent:d.onChooseDifferent,chooseDifferentLabel:x.chooseDifferent,className:de.banner,"data-testid":`${p}-error`,retryTestId:`${p}-retry`,chooseDifferentTestId:`${p}-choose-different`}),t.jsxs("div",{className:de.eyebrowRow,children:[t.jsx("p",{className:de.eyebrow,children:x.heading}),o&&t.jsx(Vs,{variant:"record",label:o.label,value:o.value,"data-testid":`${p}-paid-with`})]}),t.jsxs("div",{role:"group","aria-label":x.heading,className:de.grid,"data-testid":`${p}-grid`,children:[e.map(b=>t.jsx(ab,{method:b,currency:i,busy:u,labels:x,onToggle:s,onAmountChange:n,onAmountBlur:a,onRemove:r,testId:`${p}-method-${b.id}`},b.id)),l&&t.jsxs(c.Dropdown,{placement:"bottom-start",isDisabled:u,classNames:{trigger:de.anotherOpen},children:[t.jsx(c.DropdownTrigger,{children:t.jsxs("button",{type:"button",className:c.cn(de.another,de.focusRing),style:tb,"data-testid":`${p}-another`,children:[t.jsx("span",{className:de.iconBox,style:Rs.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:de.label,children:l.label}),t.jsx("span",{className:de.subtitle,children:l.subtitle})]})]})}),t.jsx(c.DropdownMenu,{"aria-label":l.label,items:l.options,onAction:b=>l.onPick(String(b)),"data-testid":`${p}-another-menu`,children:b=>t.jsx(c.DropdownItem,{textValue:b.label,description:b.description,className:de.menuItem,startContent:t.jsx("span",{className:de.iconBox,style:Rs.idle,children:t.jsx(P,{icon:ka[b.kind],width:18,height:18,"aria-hidden":"true"})}),"data-testid":`${p}-another-option-${b.id}`,children:b.label},b.id)})]})]})]})};Qo.displayName="RefundMethodCards";const Ge={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"},Zo="hsl(var(--heroui-primary))",rb={idle:{borderColor:oe.line,backgroundColor:"#fff"},active:{borderColor:Zo,backgroundColor:"hsl(var(--heroui-primary) / 0.05)"},failed:{borderColor:oe.danger,backgroundColor:oe["danger-fill"]}},zr={idle:{backgroundColor:"hsl(var(--heroui-default-100))",color:"hsl(var(--heroui-default-600))"},active:{backgroundColor:Zo,color:"#fff"}},ib={backgroundColor:"#fff",color:oe.neutral},Ft=e=>({color:Je[e].fg,backgroundColor:Je[e].bg}),lb={queued:Ft("neutral"),processing:Ft("info"),waiting_reader:Ft("warn"),waiting_cash:Ft("warn"),done:Ft("ok"),failed:Ft("danger")},ob={heading:"Refunding",queued:"Queued",processing:"Processing",waitingReader:"Waiting for reader",waitingCash:"Waiting for cash",done:"Refunded",failed:"Failed"},cb={queued:"queued",processing:"processing",waiting_reader:"waitingReader",waiting_cash:"waitingCash",done:"done",failed:"failed"},Vr={waiting_reader:"lucide:nfc",waiting_cash:"lucide:banknote"},db=e=>e.status==="processing"||e.status==="waiting_reader"||e.status==="waiting_cash",Xo=({parts:e,activeId:s,labels:n,className:a,"data-testid":r="refund-progress-list"})=>{const i={...ob,...n},o=s??e.find(db)?.id;return t.jsxs("div",{className:c.cn(Ge.root,a),"data-testid":r,children:[t.jsx("p",{className:Ge.eyebrow,children:i.heading}),t.jsx("ol",{"aria-label":i.heading,className:Ge.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:Ge.row,style:rb[f],"data-status":l.status,"data-active":d||void 0,"data-testid":u,children:[t.jsxs("div",{className:Ge.main,children:[t.jsx("span",{className:Ge.iconBox,style:d?zr.active:zr.idle,children:t.jsx(P,{icon:ka[l.kind],width:18,height:18,"aria-hidden":"true"})}),t.jsxs("span",{className:Ge.text,children:[t.jsx("span",{className:Ge.label,children:l.label}),l.note&&t.jsx("span",{className:Ge.note,children:l.note})]}),t.jsx("span",{className:Ge.amount,children:xe(l.amount.value,void 0,l.amount.currency)}),t.jsxs("span",{className:Ge.badge,style:lb[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[cb[l.status]]]})]}),(l.prompt||l.action)&&t.jsxs("div",{role:"status",className:Ge.prompt,style:ib,"data-testid":`${u}-prompt`,children:[Vr[l.status]&&t.jsx(P,{icon:Vr[l.status],width:18,height:18,"aria-hidden":"true"}),l.prompt&&t.jsx("span",{className:Ge.promptText,children:l.prompt}),l.action&&t.jsx(I,{color:"primary",className:Ge.action,onPress:l.action.onPress,isLoading:l.action.loading,isDisabled:l.action.disabled,"data-testid":`${u}-action`,children:l.action.label})]})]},l.id)})})]})};Xo.displayName="RefundProgressList";const ub={label:"Supervisor authorization",placeholder:"••••"},Jo=({pin:e,onChange:s,hint:n,error:a,labels:r,className:i,"data-testid":o="pin-field"})=>{const l={...ub,...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}),n&&t.jsx("p",{className:"mt-1.5 text-[13px] text-default-500",children:n}),t.jsx(c.Input,{type:"password",inputMode:"numeric","aria-label":l.label,placeholder:l.placeholder,value:e,onChange:d=>s(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`})]})};Jo.displayName="PinField";const mb={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"},fb={refund:{},payment:{title:"Payment complete",done:"New sale",authorizedBy:"Handled by {name}"}},xb={succeeded:"bg-pos-ok-fill text-pos-ok",pending:"bg-pos-warn-fill text-pos-warn"},pb="inline-flex h-[1.375rem] items-center gap-[0.3125rem] whitespace-nowrap rounded-full px-[0.5625rem] text-xs font-medium leading-none",Kt="mb-1.5 text-[0.6875rem] font-semibold uppercase tracking-[.05em] text-pos-muted",hb="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)]",bb=["email","print"],Cs=`${Ne} motion-reduce:data-[pressed=true]:scale-100 [html[data-pos-reduce-motion=true]_&]:data-[pressed=true]:scale-100`,ke={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 ${Cs}`,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] ${Cs}`,send:`h-10 w-full rounded-xl px-4 text-sm font-semibold ${Cs}`,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"},ec=({state:e,kind:s="refund",total:n,destinations:a,subtitle:r,reason:i,paidWith:o,outcomeGroups:l,changeDue:d,authorizedBy:u,selectedReceipts:f,onSendReceipt:m,receiptActions:p,emailReceipt:x,onDone:b,frameless:v=!1,labels:g,className:y,"data-testid":N="outcome-view"})=>{const k={...mb,...fb[s],...g},w=h.useId(),$=n?xe(n.value,void 0,n.currency):null;return e==="processing"?t.jsx("div",{className:c.cn("flex flex-col items-center justify-center text-center text-pos-ink",y),"aria-live":"polite","data-testid":N,children:t.jsxs("div",{className:"flex flex-col items-center px-5 py-[3.75rem]","data-testid":`${N}-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 ${Pn}`,role:"presentation"}),t.jsx("p",{className:"text-[1.0625rem] font-semibold",children:k.processing}),$&&t.jsx("p",{className:"mt-2 text-[0.9375rem] font-semibold tabular-nums","data-testid":`${N}-processing-total`,children:$})]})}):t.jsxs("div",{className:c.cn("flex flex-col text-pos-ink",!v&&hb,y),"aria-live":"polite","data-testid":N,children:[t.jsxs("div",{className:c.cn("text-center",s==="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:ke.changeTitle,"data-testid":`${N}-title`,children:k.title}),t.jsx("p",{className:ke.changeLabel,children:k.changeDue}),t.jsx("p",{className:ke.changeAmount,"data-testid":`${N}-change`,children:xe(d.amount.value,void 0,d.amount.currency)}),d.caption&&t.jsx("p",{className:ke.changeCaption,"data-testid":`${N}-change-caption`,children:d.caption})]}):t.jsxs(t.Fragment,{children:[t.jsx("p",{className:"text-[1.375rem] font-semibold","data-testid":`${N}-title`,children:k.title}),$&&t.jsx("p",{className:"my-1 text-[1.875rem] font-semibold tabular-nums","data-testid":`${N}-total`,children:$}),r&&t.jsx("p",{className:"text-[0.8125rem] text-pos-muted","data-testid":`${N}-subtitle`,children:r})]}),i&&t.jsx("p",{className:"text-[0.8125rem] text-pos-muted","data-testid":`${N}-reason`,children:k.reason.replace("{reason}",i)})]}),o&&o.length>0&&t.jsxs("div",{className:"mt-5 text-left","data-testid":`${N}-paid-with`,children:[t.jsx("p",{className:Kt,children:k.paidWithTitle}),o.map((A,j)=>t.jsxs("div",{className:ke.paidRow,"data-testid":`${N}-paid-with-${j}`,children:[A.icon&&t.jsx("span",{className:ke.paidIcon,"aria-hidden":"true",children:t.jsx("span",{className:"flex h-4 w-4",children:t.jsx(P,{icon:A.icon,width:"100%",height:"100%"})})}),t.jsx("span",{className:ke.paidLabel,children:A.label}),t.jsx("span",{className:ke.paidAmount,children:xe(A.amount.value,void 0,A.amount.currency)}),A.status&&t.jsx("span",{className:ke.paidStatus,children:A.status})]},`${A.label}-${j}`))]}),l&&l.length>0&&t.jsxs("div",{className:"mt-5 text-left","data-testid":`${N}-outcome`,children:[t.jsx("p",{className:Kt,children:k.outcomeTitle}),t.jsx("div",{className:ke.groups,children:l.map((A,j)=>t.jsxs("div",{"data-testid":`${N}-outcome-${j}`,children:[t.jsx("p",{className:ke.groupLabel,children:A.label}),t.jsx("ul",{className:ke.groupItems,"aria-label":A.label,children:A.items.map((L,S)=>t.jsx("li",{className:ke.groupItem,children:L},`${L}-${S}`))})]},`${A.label}-${j}`))})]}),a&&t.jsxs("div",{className:"mt-5 text-left",children:[t.jsx("p",{className:Kt,children:k.destinationsTitle}),a.map((A,j)=>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":`${N}-destination-${j}-${A.status}`,children:[t.jsx("span",{className:"font-semibold",children:A.label}),t.jsxs("div",{className:"flex items-center gap-2.5",children:[t.jsx("span",{className:"tabular-nums text-pos-neutral",children:xe(A.amount.value,void 0,A.amount.currency)}),t.jsx("span",{className:c.cn(pb,xb[A.status]),children:A.status==="succeeded"?k.succeeded:k.pending})]})]},`${A.label}-${j}`))]}),p&&p.length>0?t.jsxs("div",{className:"mt-5 flex flex-col text-left","data-testid":`${N}-receipt-actions`,children:[t.jsx("p",{className:Kt,children:k.sendReceipt}),t.jsx("div",{className:ke.receiptRow,children:p.map(A=>t.jsx(gb,{action:A,controls:A.expanded?w:void 0,"data-testid":`${N}-receipt-action-${A.key}`},A.key))}),x&&t.jsx(yb,{id:w,email:x,labels:k,"data-testid":`${N}-email`})]}):m&&t.jsxs("div",{className:"mt-5 text-left",children:[t.jsx("p",{className:Kt,children:k.sendReceipt}),t.jsx("div",{className:"flex flex-col gap-2",children:bb.map(A=>{const j=f?.includes(A)??!1;return t.jsxs("button",{type:"button",role:"checkbox","aria-checked":j,onClick:()=>m(A),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 ${Ne}`,"data-testid":`${N}-receipt-${A}`,children:[t.jsx("span",{"aria-hidden":"true",className:"pointer-events-none flex",children:t.jsx(c.Checkbox,{isSelected:j,isReadOnly:!0,tabIndex:-1})}),t.jsx("span",{children:k[A]})]},A)})})]}),u&&t.jsx("p",{className:"mt-4 text-[0.78125rem] text-pos-muted","data-testid":`${N}-authorized-by`,children:k.authorizedBy.replace("{name}",u)}),t.jsx("div",{className:"mt-auto pt-5",children:t.jsx(I,{color:"primary",className:`h-12 w-full rounded-[0.875rem] px-5 text-[0.9375rem] font-semibold ${Cs}`,onPress:b,"data-testid":`${N}-done`,children:k.done})})]})};ec.displayName="OutcomeView";function gb({action:e,controls:s,"data-testid":n}){return t.jsx(I,{variant:"bordered",color:"default",disableRipple:!0,className:c.cn(ke.receiptAction,e.expanded&&ke.receiptActionExpanded),"aria-expanded":e.expanded,"aria-controls":s,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":n,children:e.label})}function yb({id:e,email:s,labels:n,"data-testid":a}){const r=s.isSendDisabled??s.emails.length===0;return t.jsxs("div",{id:e,className:ke.emailBox,"data-testid":a,children:[t.jsxs("div",{className:c.cn(ke.chipWrap,s.isInvalid?"border-pos-danger":"border-pos-line"),"data-invalid":s.isInvalid||void 0,"data-testid":`${a}-recipients`,children:[s.emails.map(i=>t.jsxs("span",{className:ke.chip,"data-testid":`${a}-chip`,children:[i,t.jsx(I,{isIconOnly:!0,variant:"light",color:"default",disableRipple:!0,className:ke.chipRemove,"aria-label":n.removeEmail.replace("{email}",i),onPress:()=>s.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":n.emailAriaLabel,placeholder:n.emailPlaceholder,type:"email",value:s.draft,onValueChange:s.onDraftChange,onKeyDown:i=>{i.key==="Enter"&&s.draft.trim()!==""&&(i.preventDefault(),s.onAddEmail(s.draft.trim()))},isInvalid:s.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 ${Ne}`,input:"text-[0.8125rem] text-pos-ink placeholder:text-pos-muted group-data-[invalid=true]:text-pos-ink"},"data-testid":`${a}-input`})]}),t.jsx(I,{color:"secondary",className:ke.send,isDisabled:r,isLoading:s.isSending,onPress:s.onSend,"data-testid":`${a}-send`,children:n.sendEmail})]})}const Oe={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"},vb="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",jb="calc(100vw - 1.5rem)",tc=({label:e,value:s,options:n,onChange:a,clearLabel:r,minWidth:i,"data-testid":o="filter-select"})=>{const l=s!==null,d=l?n.find(x=>x.value===s)?.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(Oe.base,l&&Oe.baseActive),style:i===void 0?void 0:{"--filter-select-min":mt(i)},children:[t.jsx(rt,{"aria-label":e,placeholder:e,size:"sm",variant:"bordered",radius:"md",selectedKeys:s===null?[]:[s],onSelectionChange:x=>{if(x==="all")return;const b=[...x][0];a(b===void 0?null:String(b))},onOpenChange:x=>{x&&p(u.current?.getBoundingClientRect().width)},popoverProps:{ref:f,placement:"bottom-start",style:{minWidth:m,maxWidth:jb}},"data-testid":`${o}-trigger`,classNames:{base:c.cn(Oe.select,Oe.cell),trigger:c.cn(Oe.trigger,l&&Oe.triggerActive),value:c.cn(Oe.value,l&&Oe.valueActive),selectorIcon:c.cn(l&&Oe.iconActive)},children:n.map(x=>t.jsx(c.SelectItem,{classNames:{title:Oe.optionTitle},children:x.label},x.value))}),t.jsx("span",{"aria-hidden":"true","data-testid":`${o}-sizer`,className:c.cn(Oe.sizer,l&&Oe.sizerActive,Oe.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:Oe.clear,children:t.jsx(P,{icon:"lucide:x",className:Oe.clearIcon,"aria-hidden":"true"})})]})};tc.displayName="FilterSelect";const sc=({children:e,className:s,"data-testid":n="filter-select-group"})=>t.jsx("div",{"data-testid":n,"data-slot":"filter-select-group",className:c.cn(vb,s),style:{"--filter-select-count":h.Children.toArray(e).length},children:e});sc.displayName="FilterSelectGroup";const ht={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"},nc=({status:e,onLoadMore:s,loadingLabel:n,errorLabel:a,retryLabel:r,endLabel:i,"data-testid":o="load-more-footer"})=>{const l=h.useRef(null),d=h.useRef(s),u=h.useRef(!1);return h.useEffect(()=>{d.current=s},[s]),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:ht.idle,children:t.jsx("div",{ref:l,"aria-hidden":"true","data-testid":`${o}-sentinel`,className:ht.sentinel})}):e==="loading"?t.jsxs("div",{"data-testid":o,"data-status":"loading",role:"status","aria-live":"polite",className:ht.base,children:[t.jsx("span",{"aria-hidden":"true",className:ht.spinner,children:t.jsx(c.Spinner,{size:"sm",color:"default"})}),t.jsx("span",{"data-testid":`${o}-loading`,children:n})]}):e==="error"?t.jsxs("div",{"data-testid":o,"data-status":"error",className:ht.base,children:[t.jsx("span",{role:"alert","data-testid":`${o}-error`,className:ht.error,children:a}),t.jsx(I,{size:"sm",color:"default",variant:"bordered",radius:"md",onPress:s,testId:`${o}-retry`,children:r})]}):t.jsx("div",{"data-testid":o,"data-status":"end",className:i?ht.base:ht.idle,children:i&&t.jsx("span",{"data-testid":`${o}-end`,children:i})})};nc.displayName="LoadMoreFooter";const De={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 ${Ne}`,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"},Ur=({item:e,withActions:s})=>t.jsxs(t.Fragment,{children:[t.jsxs("span",{className:c.cn(De.headline,s&&De.headlineWithActions),children:[t.jsx("span",{className:De.title,children:e.title}),te(e.amount)&&!s&&t.jsx("span",{className:De.amount,children:e.amount})]}),s?(te(e.chips)||te(e.amount))&&t.jsxs("span",{className:De.chipsLine,children:[te(e.chips)&&t.jsx("span",{className:De.chipsInline,children:e.chips}),te(e.amount)&&t.jsx("span",{className:De.amount,children:e.amount})]}):te(e.chips)&&t.jsx("span",{className:De.chips,children:e.chips}),e.rows&&e.rows.length>0&&t.jsx("span",{className:De.rows,children:e.rows.map((n,a)=>t.jsxs("span",{className:De.row,children:[t.jsx("span",{className:De.rowLabel,children:n.label}),t.jsx("span",{className:De.rowValue,children:n.value})]},a))})]}),ac=({items:e,ariaLabel:s,onSelect:n,loading:a=!1,skeletonCount:r=6,"data-testid":i="card-list"})=>t.jsx("div",{"data-testid":i,className:De.base,children:a?t.jsx("div",{role:"status","aria-busy":"true","aria-label":s,"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:De.skeletonRow,children:[t.jsx("div",{className:ys,style:{height:mt(13),width:mt(130)}}),t.jsx("div",{className:ys,style:{height:mt(11),width:"70%",marginTop:mt(10)}}),t.jsx("div",{className:ys,style:{height:mt(11),width:"45%",marginTop:mt(8)}})]},l))})}):t.jsx("ul",{"aria-label":s,className:De.list,children:e.map(o=>{const l=te(o.actions);return t.jsxs("li",{"data-testid":`${i}-item-${o.id}`,className:De.item,children:[n?t.jsx("button",{type:"button",onClick:()=>n(o.id),className:c.cn(De.card,De.cardInteractive),children:t.jsx(Ur,{item:o,withActions:l})}):t.jsx("div",{className:De.card,children:t.jsx(Ur,{item:o,withActions:l})}),l&&t.jsx("div",{"data-testid":`${i}-item-${o.id}-actions`,className:De.actions,children:o.actions})]},o.id)})})});ac.displayName="CardList";const wb=48,re={base:`mb-4 overflow-hidden rounded-2xl border border-pos-line bg-white ${Us}`,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 ${Ne}`,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"},rc=h.forwardRef((e,s)=>t.jsx("li",{ref:s,...Object.fromEntries(Object.entries(e).filter(([n])=>n!=="data-testid"))}));rc.displayName="CrumbBase";const ic=({breadcrumb:e=[],onBack:s,backLabel:n,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:b,width:v}=It(),g=!cs(v,wb),y=e.length>0||!!s,N=!!(f&&f.length>0),k=!!i||te(o)||te(l)||te(d)||te(u)||N;return t.jsxs("div",{ref:b,"data-testid":x,"data-size":g?"narrow":"wide",className:re.base,children:[y&&t.jsxs("div",{"data-testid":`${x}-band`,className:re.band,children:[s&&t.jsx("button",{type:"button",onClick:s,"aria-label":n,"data-testid":`${x}-back`,className:re.back,children:t.jsx(P,{icon:"lucide:chevron-left",className:re.backIcon,"aria-hidden":"true"})}),t.jsx(c.Breadcrumbs,{separator:"/","data-testid":`${x}-breadcrumb`,classNames:{base:re.breadcrumb,list:re.breadcrumbList},itemClasses:{base:re.crumbBase,item:re.crumb,separator:re.crumbSeparator},children:e.map((w,$)=>t.jsx(c.BreadcrumbItem,{as:rc,"data-testid":`${x}-crumb-${$}`,isDisabled:!w.onClick&&$<e.length-1,onPress:w.onClick?()=>w.onClick?.():void 0,children:w.label},$))})]}),t.jsxs("div",{className:c.cn(re.body,g?re.bodyNarrow:re.bodyWide),children:[t.jsxs("div",{className:re.identity,children:[t.jsx("h1",{"data-testid":`${x}-title`,className:c.cn(re.title,g?re.titleNarrow:re.titleWide),children:a}),r&&r.length>0&&t.jsx("ul",{"data-testid":`${x}-meta`,className:re.meta,children:r.map((w,$)=>t.jsxs("li",{className:re.metaLine,children:[w.icon!=null&&t.jsx("span",{"aria-hidden":"true",className:re.metaIcon,children:w.icon}),t.jsx("span",{className:re.metaText,children:w.text})]},$))})]}),k&&t.jsxs("div",{"data-testid":`${x}-money`,className:c.cn(re.money,g?re.moneyNarrow:re.moneyWide),children:[i&&t.jsx("div",{className:re.amountLabel,children:i}),te(o)&&t.jsx("div",{"data-testid":`${x}-amount`,className:c.cn(re.amount,g?re.amountNarrow:re.amountWide),children:o}),te(l)&&t.jsx("div",{className:re.amountCaption,children:l}),te(d)&&t.jsx("div",{"data-testid":`${x}-record-id`,className:re.recordId,children:d}),te(u)&&t.jsx("div",{"data-testid":`${x}-chips`,className:c.cn(re.chips,g?re.chipsNarrow:re.chipsWide),children:u}),N&&t.jsx("dl",{"data-testid":`${x}-stat-items`,className:re.statItems,children:f?.map((w,$)=>t.jsxs("div",{"data-testid":`${x}-stat-${$}`,className:c.cn(re.stat,g?re.statNarrow:re.statWide),children:[t.jsx("dt",{"data-testid":`${x}-stat-${$}-label`,className:re.statLabel,children:w.label}),t.jsx("dd",{"data-testid":`${x}-stat-${$}-value`,className:re.statValue,style:w.tone?{color:Je[w.tone].fg}:void 0,children:w.value})]},w.id??$))})]})]}),te(m)&&t.jsx("div",{"data-testid":`${x}-stats`,className:g?re.statsNarrow:re.statsWide,children:m}),te(p)&&t.jsx("div",{"data-testid":`${x}-banner`,children:p})]})};ic.displayName="RecordHeader";const Nb=50,Yt={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]"},lc=({children:e,aside:s,"data-testid":n="record-layout"})=>{const{ref:a,width:r}=It(),i=te(s),o=i&&r>0&&cs(r,Nb),l=t.jsx("div",{"data-testid":`${n}-main`,className:Yt.column,children:e},"main"),d=i?t.jsx("div",{"data-testid":`${n}-aside`,className:Yt.aside,children:s},"aside"):null;return t.jsx("div",{ref:a,"data-testid":n,"data-layout":o?"split":"stacked",className:c.cn(Yt.base,o?Yt.split:Yt.stacked),children:o?[l,d]:[d,l]})};lc.displayName="RecordLayout";const Cb=560,Qt={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"},oc=({items:e,"data-testid":s="stat-tiles"})=>{const{ref:n,width:a}=It(),r=a>=Px?Math.max(e.length,1):a>=Cb?2:1;return t.jsx("div",{ref:n,"data-testid":s,"data-columns":r,className:Qt.base,style:{gridTemplateColumns:`repeat(${r}, minmax(0, 1fr))`},children:e.map((i,o)=>t.jsxs("div",{"data-testid":`${s}-item-${o}`,className:Qt.tile,children:[t.jsx("div",{"data-testid":`${s}-item-${o}-value`,className:Qt.value,style:i.tone?{color:Je[i.tone].fg}:void 0,children:i.value}),t.jsx("div",{"data-testid":`${s}-item-${o}-label`,className:Qt.label,children:i.label}),te(i.caption)&&t.jsx("div",{"data-testid":`${s}-item-${o}-caption`,className:Qt.caption,children:i.caption})]},o))})};oc.displayName="StatTiles";const ut={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"},kb={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]"}},Sa="pill-tabs",$a=(e,s=Sa)=>`${s}-tab-${e}`,Aa=(e,s=Sa)=>`${s}-panel-${e}`,Sb=(e,s=Sa)=>({role:"tabpanel",id:Aa(e,s),"aria-labelledby":$a(e,s),tabIndex:0}),cc=({items:e,value:s,onChange:n,ariaLabel:a,idPrefix:r,size:i="md","data-testid":o="pill-tabs"})=>{const l=Ms(),d=!!c.useProviderContext()?.disableAnimation,u=r??o,f=kb[i];return t.jsx(c.Tabs,{"aria-label":a,variant:"solid",radius:"full",fullWidth:!0,disableAnimation:l||void 0,selectedKey:s,onSelectionChange:m=>n(String(m)),"data-testid":o,"data-size":i,classNames:{base:ut.base,tabList:ut.tabList,cursor:ut.cursor,tab:c.cn(ut.tab,f.tab,(l||d)&&ut.tabStill),tabContent:c.cn(f.tabContent,ut.tabContent)},children:e.map(m=>{const p=m["data-testid"]??`${o}-${m.key}`;return t.jsx(c.Tab,{id:$a(m.key,u),"aria-controls":Aa(m.key,u),"data-testid":p,title:t.jsxs("span",{className:c.cn(ut.title,f.title),children:[te(m.icon)&&t.jsx("span",{"aria-hidden":"true","data-testid":`${p}-icon`,className:c.cn(ut.icon,f.icon),children:m.icon}),m.label,m.count!==void 0&&t.jsx("span",{"data-testid":`${p}-count`,className:c.cn(f.count,ut.count),children:m.count})]})},m.key)})})};cc.displayName="PillTabs";const ve={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 ${Ne}`,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"},Hr=({row:e,testId:s})=>t.jsxs(t.Fragment,{children:[t.jsx("span",{"aria-hidden":"true",className:ve.dot,style:{backgroundColor:Je[e.tone].fg}}),t.jsxs("span",{className:ve.body,children:[t.jsx("span",{className:ve.title,children:e.title}),(e.reference!=null||e.timestamp!=null)&&t.jsxs("span",{className:ve.meta,children:[e.reference!=null&&t.jsx("span",{className:ve.reference,children:e.reference}),e.reference!=null&&e.timestamp!=null&&t.jsx("span",{"aria-hidden":"true",className:ve.separator,children:"·"}),e.timestamp!=null&&t.jsx("span",{className:ve.timestamp,children:e.timestamp})]}),e.detail!=null&&t.jsx("span",{className:ve.detail,children:e.detail})]}),t.jsx("span",{className:ve.trailing,children:e.amount!=null?t.jsx("span",{"data-testid":`${s}-amount`,className:ve.amount,style:ds(e.amountTone),children:e.amount}):e.note!=null?t.jsx("span",{"data-testid":`${s}-note`,className:ve.note,style:e.noteTone==="warn"?{color:Je.warn.fg}:void 0,children:e.note}):null})]}),dc=({rows:e,footer:s,emptyContent:n,onSelect:a,"data-testid":r="amount-list"})=>e.length===0?t.jsx("div",{"data-testid":r,className:ve.base,children:n!=null&&t.jsx("div",{"data-testid":`${r}-empty`,className:ve.empty,children:n})}):t.jsxs("div",{"data-testid":r,className:ve.base,children:[t.jsx("ul",{className:ve.list,children:e.map(i=>{const o=`${r}-row-${i.id}`;return t.jsx("li",{"data-testid":o,className:ve.item,children:a?t.jsx("button",{type:"button",onClick:()=>a(i.id),className:c.cn(ve.row,ve.rowInteractive),children:t.jsx(Hr,{row:i,testId:o})}):t.jsx("div",{className:ve.row,children:t.jsx(Hr,{row:i,testId:o})})},i.id)})}),s&&t.jsxs(t.Fragment,{children:[t.jsxs("div",{"data-testid":`${r}-footer`,className:ve.footer,children:[t.jsx("span",{className:ve.footerLabel,children:s.label}),t.jsx("span",{"data-testid":`${r}-footer-amount`,className:ve.footerAmount,style:ds(s.amountTone),children:s.amount})]}),s.note!=null&&t.jsx("div",{"data-testid":`${r}-footer-note`,className:ve.footerNote,children:s.note})]})]});dc.displayName="AmountList";const Ye={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"},uc=({events:e,emptyContent:s,"data-testid":n="activity-timeline"})=>e.length===0?t.jsx("div",{"data-testid":n,children:s!=null&&t.jsx("div",{"data-testid":`${n}-empty`,className:Ye.empty,children:s})}):t.jsx("ol",{"data-testid":n,className:Ye.list,children:e.map((a,r)=>{const i=r===e.length-1,o=`${n}-event-${a.id}`;return t.jsxs("li",{"data-testid":o,className:c.cn(Ye.event,!i&&Ye.eventSpaced),children:[t.jsxs("span",{"aria-hidden":"true",className:Ye.rail,children:[t.jsx("span",{className:Ye.dot,style:{backgroundColor:Je[a.tone].fg}}),!i&&t.jsx("span",{"data-testid":`${o}-connector`,className:Ye.connector})]}),t.jsxs("div",{className:Ye.body,children:[t.jsxs("div",{className:Ye.head,children:[t.jsx("span",{className:Ye.title,children:a.title}),t.jsx("span",{className:Ye.timestamp,children:a.timestamp})]}),te(a.detail)&&t.jsx("div",{className:Ye.detail,children:a.detail}),te(a.actor)&&t.jsx("div",{"data-testid":`${o}-actor`,className:Ye.actor,children:a.actor})]})]},a.id)})});uc.displayName="ActivityTimeline";const Fe={base:`overflow-hidden rounded-2xl border border-pos-line bg-white ${Us}`,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 ${Ne}`,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"},Wr=({row:e,testId:s})=>t.jsxs(t.Fragment,{children:[t.jsxs("span",{className:Fe.rowBody,children:[t.jsxs("span",{className:Fe.rowHead,children:[t.jsx("span",{className:e.onSelect?Fe.primaryLinked:Fe.primaryPlain,children:e.primary}),e.chip]}),!!e.secondary&&t.jsx("span",{className:Fe.secondary,children:e.secondary})]}),!!e.amount&&t.jsx("span",{"data-testid":`${s}-amount`,className:Fe.amount,style:ds(e.amountTone),children:e.amount})]}),mc=({title:e,count:s,rows:n,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:Fe.base,children:[o&&t.jsxs("div",{className:Fe.header,children:[t.jsx("h3",{id:i,className:Fe.title,children:e}),s!==void 0&&t.jsx("span",{"data-testid":`${r}-count`,className:Fe.count,children:s})]}),n.length===0?!!a&&t.jsx("div",{"data-testid":`${r}-empty`,className:c.cn(Fe.empty,!o&&Fe.emptyHeadless),children:a}):t.jsx("ul",{className:Fe.list,children:n.map((l,d)=>{const u=`${r}-row-${l.id}`;return t.jsx("li",{"data-testid":u,className:c.cn(Fe.item,d===0&&!o&&Fe.itemFirstHeadless),children:l.onSelect?t.jsx("button",{type:"button",onClick:l.onSelect,className:c.cn(Fe.row,Fe.rowInteractive),children:t.jsx(Wr,{row:l,testId:u})}):t.jsx("div",{className:Fe.row,children:t.jsx(Wr,{row:l,testId:u})})},l.id)})})]})};mc.displayName="RelatedRecordList";const fc=({title:e,titleAs:s="h2",icon:n,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 b=h.useId(),v=te(e);return t.jsxs("section",{"data-testid":x,"data-variant":d,"data-surface":f,role:v?"group":void 0,"aria-labelledby":v?b:void 0,className:c.cn(dt.base,gp[f],m),children:[v&&t.jsxs("div",{"data-testid":`${x}-header`,className:yp[d],children:[te(n)&&t.jsx("span",{"aria-hidden":"true",className:dt.icon,children:n}),t.jsx(s,{id:b,className:dt.title,children:e}),te(a)&&t.jsx("span",{"data-testid":`${x}-count`,className:dt.count,children:a}),r,te(i)&&t.jsx("span",{"data-testid":`${x}-action`,className:dt.action,children:i})]}),t.jsxs("div",{"data-testid":`${x}-body`,className:vp[d][u],children:[te(o)&&t.jsx("p",{"data-testid":`${x}-description`,className:dt.description,children:o}),p,te(l)&&t.jsx("div",{"data-testid":`${x}-footer`,className:c.cn(dt.footer,te(p)?dt.footerAfterContent:dt.footerAfterDescription),children:l})]})]})};fc.displayName="RecordCard";const $b={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]"},xc=({layout:e="stack",className:s,children:n,"data-testid":a="card-stack",...r})=>t.jsx("div",{...r,"data-testid":a,"data-layout":e,className:c.cn($b[e],s),children:n});xc.displayName="CardStack";const gs={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]"},Ab={regular:"py-[0.5625rem]",compact:"py-2"},pc=({rows:e,density:s="regular","data-testid":n="key-value-rows"})=>t.jsx("dl",{"data-testid":n,className:gs.list,children:e.map((a,r)=>t.jsxs("div",{"data-testid":`${n}-row-${a.id??r}`,className:c.cn(gs.row,Ab[s]),children:[t.jsx("dt",{className:gs.label,children:a.label}),t.jsx("dd",{className:gs.value,children:a.value})]},a.id??r))});pc.displayName="KeyValueRows";const tt={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"},hc=({items:e,ariaLabel:s,originalAmountLabel:n,"data-testid":a="line-item-rows"})=>t.jsx("ul",{"aria-label":s,"data-testid":a,className:tt.list,children:e.map(r=>{const i=`${a}-item-${r.id}`,o=te(r.originalAmount);return t.jsxs("li",{"data-testid":i,className:tt.row,style:r.tone?{backgroundColor:Je[r.tone].bg}:void 0,children:[t.jsxs("div",{className:tt.body,children:[t.jsx("div",{className:tt.name,children:r.name}),r.details&&r.details.length>0&&t.jsx("div",{"data-testid":`${i}-details`,className:tt.details,children:r.details.map((l,d)=>t.jsxs(h.Fragment,{children:[d>0&&t.jsx("span",{"aria-hidden":"true",className:tt.separator,children:"·"}),t.jsx("span",{className:tt.detail,children:l})]},d))})]}),t.jsxs("div",{className:tt.trailing,children:[t.jsxs("span",{className:tt.amounts,children:[o&&t.jsxs("s",{"data-testid":`${i}-original`,className:tt.original,children:[n&&t.jsxs("span",{className:"sr-only",children:[n," "]}),r.originalAmount]}),t.jsx("span",{"data-testid":`${i}-amount`,className:tt.amount,style:o?{color:Je.ok.fg}:void 0,children:r.amount})]}),r.chip]})]},r.id)})});hc.displayName="LineItemRows";const Db=37.5,Pe={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"},bc=({rows:e,total:s,memo:n,"data-testid":a="record-totals"})=>{const{ref:r,width:i}=It(),o=i>0&&!cs(i,Db),l=o?Pe.rowNarrow:Pe.rowWide,d=o?Pe.labelNarrow:Pe.labelWide,u=o?Pe.noteNarrow:Pe.noteWide;return t.jsxs("div",{ref:r,"data-testid":a,"data-size":o?"narrow":"wide",className:Pe.base,children:[e.map(f=>{const m=`${a}-row-${f.id}`;return t.jsxs("div",{"data-testid":m,className:c.cn(l,Pe.row),children:[t.jsx("span",{"data-testid":`${m}-label`,className:c.cn(d,Pe.label),children:f.label}),t.jsx("span",{"data-testid":`${m}-note`,className:c.cn(u,Pe.note),children:f.note}),t.jsx("span",{"data-testid":`${m}-value`,className:Pe.value,style:ds(f.tone),children:f.value})]},f.id)}),t.jsx("div",{className:Pe.totalRule,children:t.jsxs("div",{"data-testid":`${a}-total`,className:c.cn(l,Pe.totalRow),children:[t.jsx("span",{className:c.cn(d,Pe.totalLabel),children:s.label}),t.jsx("span",{"data-testid":`${a}-total-value`,className:Pe.totalValue,children:s.value})]})}),te(n)&&t.jsx("div",{"data-testid":`${a}-memo`,className:Pe.memo,children:n})]})};bc.displayName="RecordTotals";const Rn={base:"whitespace-nowrap text-[0.875rem]",secondary:"text-default-500",chipStack:"inline-flex flex-col items-start gap-[0.3125rem]"},Eb={text:"text-default-900",reference:"font-normal text-primary",amount:"font-semibold tabular-nums text-default-900"},gc=({variant:e="text",tone:s,secondary:n,children:a,"data-testid":r="cell-text"})=>t.jsxs("span",{"data-testid":r,className:c.cn(Rn.base,Eb[e]),style:ds(s),children:[a,te(n)&&t.jsxs("span",{"data-testid":`${r}-secondary`,className:Rn.secondary,children:[t.jsx("span",{"aria-hidden":"true",children:" · "}),n]})]});gc.displayName="CellText";const yc=({children:e,"data-testid":s="chip-stack"})=>t.jsx("span",{"data-testid":s,className:Rn.chipStack,children:e});yc.displayName="ChipStack";function vc({testId:e,title:s,description:n}){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:s}),t.jsx("p",{className:"text-default-600 leading-snug",children:n})]})})}vc.displayName="SessionExpiredCard";exports.ActivityTimeline=uc;exports.AdminFieldLabel=xa;exports.AdminTable=_l;exports.AdminTextField=Xl;exports.AdminToolbar=Pl;exports.AmountList=dc;exports.AppliedCodeCard=di;exports.Button=I;exports.CardList=ac;exports.CardStack=xc;exports.CashTenderForm=Ap;exports.CatalogItemCard=vl;exports.CellText=gc;exports.CheckTenderForm=fo;exports.ChipStack=yc;exports.CommitmentDetails=wf;exports.ConfirmDialog=ga;exports.ConfirmationModal=sa;exports.ConfirmationPageTemplate=Iu;exports.CustomerCard=Vo;exports.DatePicker=Wn;exports.DensityProvider=ad;exports.DimensionChip=Vs;exports.DiscardGuard=ko;exports.DonationAmounts=Wi;exports.Drawer=_i;exports.EmptyState=na;exports.EntityList=ao;exports.EntityListSkeleton=ro;exports.EntityRow=no;exports.ErrorState=aa;exports.EventDetails=$m;exports.EventDetailsTemplate=Bu;exports.ExpandableTable=Rl;exports.ExpireCartTimer=qi;exports.FeedbackState=os;exports.FilterPopover=Sl;exports.FilterSelect=tc;exports.FilterSelectGroup=sc;exports.Footer=Ku;exports.HeroUIProvider=Xc;exports.HorizontalSteps=Pi;exports.InlineConfirm=No;exports.InstallmentFundAssignment=bf;exports.InstallmentFundAssignmentSkeleton=vf;exports.InstallmentSchedule=zf;exports.InstallmentScheduleSkeleton=Yf;exports.InstallmentTable=Jf;exports.ItemCard=yl;exports.KeyValueChip=Vs;exports.KeyValueRows=pc;exports.LineItemList=To;exports.LineItemRows=hc;exports.ListPanel=oo;exports.LoadMoreFooter=nc;exports.LoadingOverlay=jo;exports.LoadingState=ra;exports.MembershipSelectCards=ax;exports.MetaCard=Ih;exports.Modal=rs;exports.ModalPanelHeader=So;exports.ModalPanels=uh;exports.ModalShell=ho;exports.ModalShellFooter=go;exports.ModalShellHeader=bo;exports.Multiselect=Yu;exports.Navbar=Tu;exports.NeedsFixDot=ma;exports.NotesField=Ho;exports.Notice=Ca;exports.OfferCard=$s;exports.OfferCardEmpty=Gi;exports.OfferCardError=Ki;exports.OfferCardList=Xi;exports.OfferCardSkeleton=Yi;exports.OtherTenderForm=xo;exports.OutcomeView=ec;exports.PageHeader=Dl;exports.PaginationSummary=lo;exports.PaymentCashChangeBanner=ha;exports.PaymentSubAmountInput=ba;exports.PaymentSuccessView=wo;exports.PaymentTotalBanner=vo;exports.PickerRow=Jl;exports.PillTabs=cc;exports.PinField=Jo;exports.ProgramListItem=jl;exports.RICH_TEXT_PRESETS=Ui;exports.ReasonSelect=Uo;exports.RecordCard=fc;exports.RecordHeader=ic;exports.RecordLayout=lc;exports.RecordTotals=bc;exports.RedeemCodeInput=_u;exports.RefundMethodCards=Qo;exports.RefundProgressList=Xo;exports.RelatedRecordList=mc;exports.RevenueDistributionCard=dl;exports.RevenueDistributionEmpty=ul;exports.RevenueDistributionError=ml;exports.RevenueDistributionSkeleton=fl;exports.RichTextArea=Hi;exports.RowActions=ua;exports.SectionPanel=zo;exports.Select=rt;exports.SessionExpiredCard=vc;exports.SessionTimeline=$l;exports.Skeleton=ie;exports.SplitPaymentSummary=po;exports.SplitTenderPanel=qo;exports.StatTiles=oc;exports.StatusChip=El;exports.StepPager=Bi;exports.StepProgress=Na;exports.Stepper=Mi;exports.StepsReadiness=Oi;exports.SuccessState=Nl;exports.Summary=Mo;exports.Table=qn;exports.TableSkeleton=Ll;exports.TenderMethods=Wo;exports.TicketSelection=Ax;exports.TileSelect=yo;exports.ToastProvider=sd;exports.Toggle=Cl;exports.ToolbarButton=Tl;exports.UnderlineTabs=Il;exports.VerticalSteps=Ii;exports.WizardShell=Po;exports.adminFieldErrorClass=Ql;exports.adminFieldHelpButtonClass=Ul;exports.adminFieldHelpContentClass=Wl;exports.adminFieldHelpIconClass=Hl;exports.adminFieldHintClass=Yl;exports.adminFieldLabelClass=fa;exports.adminFieldLabelNoAutoMarkClass=Vl;exports.adminFieldLabelRowClass=zl;exports.adminFieldLabelSuffixClass=Ol;exports.adminFieldRequiredClass=Bl;exports.adminInputClass=Gl;exports.adminInputReadOnlyClass=Kl;exports.adminInputWrapperClass=ql;exports.adminRowClass=ca;exports.adminSurfaceCss=Zc;exports.adminSurfaceTokens=as;exports.adminTableClass=da;exports.adminTableFooterClass=Fl;exports.adminTdClass=oa;exports.adminThClass=la;exports.calculateAllocationDifference=rf;exports.computeChange=Cn;exports.currencyFractionDigits=Tt;exports.firstNeedsFixKey=Jx;exports.formatMoney=xe;exports.formatOfferCurrency=Sn;exports.formatRevenueAmount=tf;exports.formatRevenueCurrency=sf;exports.generateAutomaticInstallments=hl;exports.generateDistributionId=ta;exports.getCurrencySymbol=nf;exports.offerCardVariants=Zi;exports.offerListVariants=Qi;exports.pageRange=io;exports.parseOfferCurrency=Am;exports.parseRevenueCurrency=af;exports.pillTabId=$a;exports.pillTabPanelId=Aa;exports.pillTabPanelProps=Sb;exports.posSurfaceTokens=oe;exports.roundToCurrency=Gn;exports.useControlSize=nd;exports.useDensity=Ps;exports.useDiscardGuard=xh;exports.useDiscardGuardActions=Jp;exports.useModalPanel=th;exports.useModalPanels=fh;exports.useReportUnsavedChanges=Xp;Object.keys(c).forEach(e=>{e!=="default"&&!Object.prototype.hasOwnProperty.call(exports,e)&&Object.defineProperty(exports,e,{enumerable:!0,get:()=>c[e]})});
|
|
41
|
+
`,So=h.forwardRef(({children:e,relativeOverlayRoot:s=!0,className:n,style:a,"data-testid":r="modal-shell"},i)=>t.jsxs(t.Fragment,{children:[t.jsx("style",{children:eh}),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",s&&"relative","motion-safe:animate-[pp-modal-in_220ms_ease-out]","motion-safe:transition-[min-height] motion-safe:duration-[420ms] motion-safe:ease-in-out",n),children:e})]}));So.displayName="ModalShell";const $o=({title:e,subtitle:s,leading:n,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:[n,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}),s&&t.jsx("div",{className:"text-xs font-semibold text-default-500","data-testid":`${d}-subtitle`,children:s})]})]}),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"})})]})]});$o.displayName="ModalShellHeader";const Ao=({children:e,columns:s=2,className:n,"data-testid":a="modal-shell-footer"})=>t.jsx("footer",{className:c.cn("mt-2 gap-3",s===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",n),"data-testid":a,children:e});Ao.displayName="ModalShellFooter";const th={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"},sh={1:"grid-cols-1",2:"grid-cols-2"},Nt={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]",locked:"cursor-not-allowed border-dashed border-pos-line-strong bg-white text-pos-muted data-[hover=true]:border-pos-line-strong data-[hover=true]:bg-white data-[pressed=true]:scale-100"},qe={tile:`flex flex-col items-center justify-center gap-2 h-auto min-h-20 px-4 py-4 border bg-transparent transition-colors ${ke}`,idle:"border-default-200 text-default-800 hover:bg-default-50",active:"border-primary bg-primary-50 text-primary",label:"text-sm font-medium",detailed:"items-start justify-start gap-1 whitespace-normal text-left",header:"mb-1 flex w-full flex-wrap items-start justify-between gap-2",description:"text-xs font-normal leading-snug text-default-600",lockedDescription:"text-default-500",badge:"shrink-0 whitespace-nowrap rounded-full bg-default-100 px-2 py-0.5 text-[11px] font-medium leading-4 text-default-600",locked:"cursor-not-allowed border-dashed border-default-300 bg-default-50 text-default-500 hover:bg-default-50 data-[hover=true]:opacity-100 data-[pressed=true]:scale-100",lockedIcon:"text-default-400"},gs=e=>typeof e=="string"?t.jsx(P,{icon:e,width:20,height:20,"aria-hidden":"true"}):e,nh=(e,s,n)=>{const a=`${e}-${s.key}`;return{badge:n&&s.badge!==void 0?`${a}-badge`:void 0,reason:`${a}-reason`,description:n&&s.description!==void 0?`${a}-description`:void 0}},ah=e=>t.jsx("span",{"aria-hidden":"true",className:Nt.icon,children:typeof e=="string"?t.jsx(P,{icon:e,width:"100%",height:"100%","aria-hidden":"true"}):e}),ys=`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}`,rh="pointer-events-none absolute -left-[9999px] top-0 flex flex-row gap-1 p-1 opacity-0",Br="flex-none",ih=typeof window<"u"?h.useLayoutEffect:h.useEffect,zr=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",Do=({options:e,selectedKey:s,onSelect:n,heading:a,ariaLabel:r="Select an option",variant:i="tiles",maxVisible:o,moreLabel:l="More",columnsDesktop:d=3,columnsMobile:u=2,size:p="md",className:m,"data-testid":x="tile-select"})=>{const f=p==="sm",b=e.find(y=>y.key===s),v=e.some(y=>y.badge!==void 0||y.isLocked===!0),g=!f&&v;return i==="compact"?t.jsx(lh,{options:e,selectedKey:s,onSelect:n,ariaLabel:r,moreLabel:l,dataTestId:x,...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":x,children:[a&&t.jsx("h3",{className:"text-sm font-medium text-default-700",id:`${x}-heading`,children:a}),t.jsx("div",{className:"md:hidden",children:t.jsx(it,{"aria-label":a?void 0:r,"aria-labelledby":a?`${x}-heading`:void 0,selectedKeys:s?[s]:[],onSelectionChange:y=>{const k=Array.from(y)[0];typeof k=="string"&&n(k)},placeholder:r,variant:"bordered",radius:"lg","data-testid":`${x}-mobile-select`,startContent:b?t.jsx("span",{"aria-hidden":"true",className:"shrink-0",children:gs(b.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||y.isLocked,...v&&y.description!==void 0?{description:y.description}:{},endContent:y.badge!==void 0?t.jsx("span",{className:qe.badge,children:y.badge}):void 0,startContent:t.jsx("span",{"aria-hidden":"true",className:"shrink-0",children:gs(y.icon)}),"data-testid":y["data-testid"]??`${x}-${y.key}-mobile`,children:y.label},y.key))})}),t.jsx("div",{role:"group","aria-labelledby":a?`${x}-heading`:void 0,"aria-label":a?void 0:r,className:c.cn("hidden md:grid",f?Nt.grid:"gap-3",sh[u],th[d]),"data-size":p,children:e.map(y=>{const w=s===y.key,k=y.isLocked===!0&&y.isDisabled!==!0,N=y.lockedReason??y.badge,$=nh(x,y,g),E=[$.badge,k&&N!==void 0&&(f||N!==y.badge)?$.reason:void 0,$.description].filter(Boolean).join(" ");return t.jsxs(O,{variant:"bordered",radius:"lg","aria-pressed":w,"aria-label":y.label,"aria-disabled":k||void 0,"aria-describedby":E||void 0,isDisabled:y.isDisabled,onPress:()=>{k||n(y.key)},"data-testid":y["data-testid"]??`${x}-${y.key}`,"data-locked":k||void 0,className:f?c.cn(Nt.tile,k?Nt.locked:w?Nt.active:Nt.idle):c.cn(qe.tile,g&&qe.detailed,k?qe.locked:w?qe.active:qe.idle),"data-size":p,children:[f?t.jsxs(t.Fragment,{children:[ah(y.icon),t.jsx("span",{className:Nt.label,children:y.label})]}):g?t.jsxs(t.Fragment,{children:[t.jsxs("span",{className:qe.header,children:[t.jsx("span",{"aria-hidden":"true",className:k?qe.lockedIcon:void 0,children:gs(y.icon)}),y.badge!==void 0?t.jsx("span",{id:$.badge,className:qe.badge,children:y.badge}):null]}),t.jsx("span",{className:qe.label,children:y.label}),y.description!==void 0?t.jsx("span",{id:$.description,className:c.cn(qe.description,k&&qe.lockedDescription),children:y.description}):null]}):t.jsxs(t.Fragment,{children:[t.jsx("span",{"aria-hidden":"true",className:k?qe.lockedIcon:void 0,children:gs(y.icon)}),t.jsx("span",{className:qe.label,children:y.label})]}),k&&N!==void 0&&(f||N!==y.badge)?t.jsx("span",{id:$.reason,className:"sr-only",children:N}):null]},y.key)})})]})};Do.displayName="TileSelect";function lh({options:e,selectedKey:s,onSelect:n,heading:a,ariaLabel:r,maxVisible:i,moreLabel:o,className:l,dataTestId:d}){const u=h.useRef(null),p=h.useRef(null),m=h.useMemo(()=>e.map((L,S)=>({option:L,index:S})).filter(({option:L})=>L.alwaysInMenu!==!0).map(({index:L})=>L),[e]),x=m.length<e.length,f=h.useCallback(L=>{const S=m.map(D=>({index:D,priority:e[D]?.priority??0})).sort((D,A)=>D.priority-A.priority||A.index-D.index),M=new Set(S.slice(0,m.length-L).map(D=>D.index));return m.filter(D=>!M.has(D))},[e,m]),[b,v]=h.useState(e.length);ih(()=>{const L=u.current,S=p.current;if(!L||!S)return;const M=()=>{const A=Array.from(S.children),R=A.slice(0,e.length).map(q=>q.getBoundingClientRect().width),T=A[e.length]?.getBoundingClientRect().width??0,U=window.getComputedStyle(L),G=Number.parseFloat(U.columnGap)||0,I=L.clientWidth-(Number.parseFloat(U.paddingLeft)||0)-(Number.parseFloat(U.paddingRight)||0);if(I<=0||R.some(q=>q===0)){v(m.length);return}const se=q=>{const Q=x||q<m.length,Y=q+(Q?1:0);return f(q).reduce((ne,X)=>ne+(R[X]??0),0)+(Q?T:0)+G*(Y-1)<=I};for(let q=m.length;q>=1;q-=1)if(se(q)){v(q);return}v(1)};M();const D=new ResizeObserver(M);return D.observe(L),()=>D.disconnect()},[e,o,f,m,x]);const g=Math.max(1,Math.min(b,i??m.length,m.length)),w=!x&&g===m.length-1&&b===m.length?m.length:g,k=x||w<m.length,N=new Set(f(w)),$=e.filter((L,S)=>N.has(S)),E=k?e.filter((L,S)=>!N.has(S)):[],j=E.find(L=>L.key===s);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:[$.map(L=>t.jsx(O,{variant:"light",radius:"full","aria-pressed":s===L.key,isDisabled:L.isDisabled||L.isLocked,onPress:()=>n(L.key),"data-testid":L["data-testid"]??`${d}-${L.key}`,className:c.cn(ys,zr(s===L.key)),children:L.label},L.key)),E.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":j!==void 0,"data-testid":`${d}-more`,className:c.cn(ys,"gap-1",j!==void 0?"min-w-0":"min-w-fit",zr(j!==void 0)),children:[t.jsx("span",{className:"min-w-0 truncate",children:j?.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:j?[j.key]:[],disabledKeys:E.filter(L=>L.isDisabled||L.isLocked).map(L=>L.key),onAction:L=>n(String(L)),children:E.map(L=>t.jsx(c.DropdownItem,{textValue:L.label,...L.description!==void 0?{description:L.description}:{},"data-testid":L["data-testid"]??`${d}-${L.key}`,children:L.label},L.key))})]})]}),t.jsxs("div",{ref:p,"aria-hidden":"true",className:rh,children:[e.map(L=>t.jsx(O,{variant:"light",radius:"full",tabIndex:-1,className:c.cn(ys,Br),children:L.label},L.key)),t.jsxs(O,{variant:"light",radius:"full",tabIndex:-1,className:c.cn(ys,Br,"gap-1"),children:[o,t.jsx(P,{icon:"lucide:chevron-down",width:14,height:14})]})]})]})}const oh={subtle:{wrapper:"bg-default-100",amount:"text-default-900"},success:{wrapper:"bg-success-50 text-success-700",amount:"text-success-700"}},Eo=({total:e,label:s,locale:n="en-US",variant:a="subtle",className:r,"data-testid":i="payment-total-banner"})=>{const o=oh[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:s}),t.jsx("div",{className:c.cn("mt-1 text-4xl font-bold tracking-tight",o.amount),"data-testid":`${i}-amount`,children:xe(e.value,n,e.currency)})]})};Eo.displayName="PaymentTotalBanner";const ch={white:"bg-white/70 backdrop-blur-sm",transparent:"bg-transparent"},Lo=({title:e,subtitle:s,backdrop:n="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",ch[n],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}),s&&t.jsx("div",{className:"mt-1 text-sm text-default-600",children:s})]})]});Lo.displayName="LoadingOverlay";const ja=({cashChange:e,label:s="Cash to return",secondaryLine:n,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:s}),t.jsx("span",{className:"text-2xl font-bold text-info-700","data-testid":`${d}-amount`,children:xe(e.value,a,e.currency)}),n&&t.jsx("span",{className:"mt-0.5 text-xs text-info-700/80",children:n})]}),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"})})]})};ja.displayName="PaymentCashChangeBanner";const Fo=({title:e,subtitle:s,emailLine:n,confirmationEmail:a,cashChange:r,cashChangeLabel:i="Cash to return",locale:o="en-US",closeLabel:l="Close",onClose:d,className:u,"data-testid":p="payment-success-view"})=>{const m=!!(r&&r.value>0);return t.jsxs("div",{"data-testid":p,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":`${p}-title`,children:e}),t.jsx("p",{className:"text-default-700",children:s}),n&&a&&t.jsxs("p",{className:"text-default-700",children:[n,t.jsx("br",{}),t.jsx("strong",{className:"font-semibold",children:a})]})]}),m&&r&&t.jsx(ja,{cashChange:r,label:i,locale:o,align:"center",className:"max-w-[400px]","data-testid":`${p}-cash-change`}),d&&t.jsx(O,{color:"default",variant:"bordered",radius:"full",size:"lg",onPress:d,"data-testid":`${p}-close`,className:"mt-4 w-full",children:l})]})};Fo.displayName="PaymentSuccessView";const wa=({heading:e,amountLabel:s,value:n,defaultValue:a,onChange:r,onBlur:i,placeholder:o,isDisabled:l,isInvalid:d,errorMessage:u,autoFocus:p,maxAmount:m,hideHeading:x=!1,className:f,"data-testid":b="payment-sub-amount-input"})=>{const v=`${b}-input`,g=n!==void 0,[y,w]=h.useState(a??""),k=g?n:y,{isUntouched:N,markEdited:$}=jo(k),E=h.useCallback(S=>{if(m!==void 0){const M=Number.parseFloat(S.replace(",","."));if(Number.isFinite(M)&&M>m)return}$(S),g||w(S),r?.(S)},[m,r,$,g]),j=wo(N,E),L=h.useCallback(S=>{const M=S.currentTarget;requestAnimationFrame(()=>{M.isConnected&&M.select()})},[]);return t.jsxs("div",{className:c.cn("flex flex-col gap-3 border-t border-default-100 pt-5",f),"data-testid":b,children:[t.jsx("h3",{className:c.cn("text-lg font-semibold",x&&"sr-only"),"data-testid":`${b}-heading`,children:e}),t.jsx(c.Input,{ref:j,id:v,label:s,labelPlacement:"outside",classNames:x?{label:"sr-only"}:void 0,type:"text",inputMode:"decimal",pattern:"[0-9]*[.,]?[0-9]*",value:k,onChange:S=>E(S.target.value),onFocus:L,onBlur:i,placeholder:o,isDisabled:l,isInvalid:d,errorMessage:d?u:void 0,variant:"bordered",radius:"lg","aria-invalid":d||void 0,autoFocus:p,"data-testid":`${b}-field`})]})};wa.displayName="PaymentSubAmountInput";const dh={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"}},uh=e=>typeof e=="string"?t.jsx(P,{icon:e,className:"size-5","aria-hidden":"true"}):e,Na=({isOpen:e,title:s,confirmLabel:n,onConfirm:a,onOpenChange:r,children:i,description:o,cancelLabel:l="Cancel",variant:d="danger",isPending:u=!1,isDismissable:p,isKeyboardDismissDisabled:m=!1,hideIcon:x=!1,icon:f,"data-testid":b="confirm-dialog"})=>{const v=i??o??null,g=dh[d],y=x?null:uh(f??g.icon);return t.jsx(os,{isOpen:e,onOpenChange:w=>r?.(w),placement:"center",size:"md",isDismissable:(p??!0)&&!u,isKeyboardDismissDisabled:m||u,hideCloseButton:u,className:"gap-4 p-6",classNames:{base:"rounded-3xl"},"data-testid":b,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:[y?t.jsx("div",{"aria-hidden":"true","data-testid":`${b}-icon`,className:c.cn("flex size-10 items-center justify-center rounded-full",g.tile),children:y}):null,t.jsx("span",{"data-testid":`${b}-title`,className:"text-lg font-semibold text-zinc-950",children:s})]}),v!==null?t.jsx(c.ModalBody,{"data-testid":`${b}-body`,className:"gap-0 p-0",children:typeof v=="string"?t.jsx("p",{className:"mx-auto max-w-sm text-center text-sm text-gray-600",children:v}):v}):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":`${b}-dismiss`,className:"w-full sm:flex-1",children:l}),t.jsx(O,{color:g.confirmColor,variant:"solid",radius:"full",onPress:a,isLoading:u,"data-testid":`${b}-confirm`,className:"w-full sm:flex-1",children:n})]})]})})};Na.displayName="ConfirmDialog";const jt={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"},mh={danger:"bg-danger-50",warning:"bg-warning-50"},_o=({message:e,description:s,confirmLabel:n,cancelLabel:a="Cancel",onConfirm:r,onCancel:i,variant:o="danger",isPending:l=!1,initialFocus:d="cancel",containEscape:u=!0,size:p="sm",as:m="div",className:x,"data-testid":f="inline-confirm"})=>{const b=h.useId(),v=h.useId(),g=h.useRef(null),y=h.useRef(null),w=h.useRef(null),k=s!=null,N=h.useRef({isPending:l,containEscape:u,onCancel:i});N.current={isPending:l,containEscape:u,onCancel:i},h.useEffect(()=>{(d==="confirm"?y:w).current?.focus()},[]),h.useEffect(()=>{const j=g.current;if(j===null)return;const L=S=>{S.key==="Escape"&&(N.current.containEscape&&S.stopPropagation(),!N.current.isPending&&N.current.onCancel())};return j.addEventListener("keydown",L),()=>j.removeEventListener("keydown",L)},[]);const $=h.useRef(!1);h.useLayoutEffect(()=>{const j=g.current;if(j===null)return;const L=document.activeElement;if(l){const S=L===null||L===document.body||!j.contains(L),M=L instanceof HTMLButtonElement&&L.disabled;$.current&&(S||M)&&j.focus({preventScroll:!0});return}L===j&&(d==="confirm"?y:w).current?.focus()},[l,d]);const E=t.jsx(c.Card,{ref:g,role:"alertdialog","aria-modal":"false","aria-labelledby":b,"aria-describedby":k?v:void 0,"aria-busy":l||void 0,tabIndex:-1,shadow:"none",radius:"lg",onFocus:()=>{$.current=!0},onBlur:j=>{const L=j.relatedTarget;$.current=L instanceof Node&&j.currentTarget.contains(L)},className:c.cn(jt.box,mh[o],m==="div"&&x),"data-testid":f,children:t.jsxs(c.CardBody,{className:jt.body,children:[t.jsxs("div",{className:jt.text,children:[t.jsx("p",{id:b,className:jt.message,children:e}),k?t.jsx("p",{id:v,className:jt.description,children:s}):null]}),t.jsxs("div",{className:jt.actions,children:[t.jsx(O,{ref:y,size:p,color:o,variant:"solid",onPress:r,isLoading:l,"data-testid":`${f}-confirm`,children:n}),t.jsx(O,{ref:w,size:p,color:"default",variant:"light",onPress:i,isDisabled:l,"data-testid":`${f}-cancel`,children:a})]})]})});return m==="li"?t.jsx("li",{className:c.cn(jt.item,x),children:E}):E};_o.displayName="InlineConfirm";const fh={guardScope:(e,s)=>s(),bypass:e=>e(),report:()=>{},unreport:()=>{}},Gs=h.createContext(fh),Ca=h.createContext(null);function ph(e){const{report:s,unreport:n}=h.useContext(Gs),a=h.useContext(Ca),r=h.useId();h.useEffect(()=>{s(r,{scope:a,isDirty:e})},[s,r,a,e]),h.useEffect(()=>()=>n(r),[n,r])}function xh(){const{guardScope:e,bypass:s}=h.useContext(Gs);return h.useMemo(()=>({guard:n=>e(null,n),bypass:s}),[e,s])}function Ro(){const{guardScope:e}=h.useContext(Gs),s=h.useContext(Ca);return h.useCallback(n=>e(s,n),[e,s])}const hh=({scope:e,children:s})=>t.jsx(Ca.Provider,{value:e,children:s}),Mo=({guard:e,children:s,title:n="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:p,report:m,unreport:x,guardScope:f}=e.internals,b=h.useMemo(()=>({guardScope:f,bypass:e.bypass,report:m,unreport:x}),[f,e.bypass,m,x]);return t.jsxs(Gs.Provider,{value:b,children:[s,t.jsx(Na,{isOpen:l!==null,onOpenChange:v=>{v||p()},onConfirm:u,variant:"warning",title:n,description:a,confirmLabel:r,cancelLabel:i,"data-testid":o},d)]})};Mo.displayName="DiscardGuard";const ka=h.createContext(null);function bh(){const e=h.useContext(ka),s=Ro(),n=e?.back,a=h.useCallback(()=>{n&&s(n)},[s,n]);return{isActive:e?.isActive??!0,canGoBack:e?.canGoBack??!1,back:a}}const gh=["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 yh(e){for(const s of e.querySelectorAll(gh))if(!s.closest('[hidden], [inert], [aria-hidden="true"]'))return s;return null}function Vr(e,s){return!e||!e.isConnected||!s.contains(e)||e.matches(":disabled")?!1:!e.closest("[hidden], [inert]")}const vh=new Set(["menu","listbox","dialog","grid","tree"]);function jh(e){for(const s of e.querySelectorAll('[aria-expanded="true"][aria-controls]')){const n=s.ownerDocument.getElementById(s.getAttribute("aria-controls")??"");if(!n?.isConnected)continue;if((s.getAttribute("aria-haspopup")??"false")!=="false"||vh.has(n.getAttribute("role")??""))return n}return null}const Ur="react-aria-focus-scope-restore";class wh{panels=new Map;active=null;setContainer(s,n){n?this.panels.set(s,{entry:null,last:null,...this.panels.get(s),container:n}):this.panels.delete(s)}setEntry(s,n){const a=this.panels.get(s);a?a.entry=n:n&&this.panels.set(s,{container:null,entry:n,last:null})}remember(s,n){const a=this.panels.get(s);a&&(a.last=n)}setActive(s,n){this.active={key:s,isReturn:n}}focusActive(){if(!this.active)return;const s=this.panels.get(this.active.key),n=s?.container;if(!s||!n||n.contains(document.activeElement))return;((this.active.isReturn&&Vr(s.last,n)?s.last:null)??(Vr(s.entry,n)?s.entry:null)??yh(n))?.focus()}recoverFocus(){const s=this.active?this.panels.get(this.active.key)?.container:null,n=s?jh(s):null;n?.focus(),n?.contains(document.activeElement)||this.focusActive()}}const Nh="flex flex-initial items-center gap-2 py-4 pl-4 pr-12 text-large font-semibold",Ch="min-w-0 flex-1 truncate text-large font-semibold",kh="flex shrink-0 items-center gap-2",Sh="size-5";function $h({panels:e,children:s}){const[n]=h.useState(()=>new wh),{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)&&(n.setActive(i,l.keys.has(i)),n.focusActive())},[i,a,n]),t.jsx(t.Fragment,{children:a.map((l,d)=>t.jsx(Ah,{entryKey:l.key,isActive:d===a.length-1,canGoBack:d>0,back:r,memory:n,children:s(l.panel,l)},l.key))})}const Ah=({entryKey:e,isActive:s,canGoBack:n,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 p=m=>{u.hidden&&(m.preventDefault(),r.recoverFocus())};return u.addEventListener(Ur,p),()=>{u.removeEventListener(Ur,p),r.setContainer(e,null)}},[r,e]);const d=h.useMemo(()=>({isActive:s,canGoBack:n,back:a,setEntryFocus:l}),[s,n,a,l]);return t.jsx(ka.Provider,{value:d,children:t.jsx(hh,{scope:e,children:t.jsx("div",{ref:o,hidden:!s,style:{display:s?"contents":"none"},onFocus:u=>{u.currentTarget.contains(u.target)&&r.remember(e,u.target)},children:i})})})},Po=({title:e,onBack:s,backLabel:n="Back",isBackDisabled:a,size:r="md",actions:i,className:o,"data-testid":l="modal-panel-header"})=>{const d=h.useContext(ka),u=Ro(),p=h.useId(),m=s??(d?.canGoBack?d.back:void 0);return t.jsxs("header",{className:c.cn(Nh,o),"data-testid":l,children:[m?t.jsx(O,{ref:d?.setEntryFocus,isIconOnly:!0,variant:"light",color:"default",size:r,"aria-label":n,"aria-describedby":p,isDisabled:a,onPress:()=>u(m),"data-testid":`${l}-back`,children:t.jsx(P,{icon:"solar:arrow-left-outline",className:Sh,"aria-hidden":"true"})}):null,t.jsx("h2",{id:p,className:Ch,"data-testid":`${l}-title`,children:e}),i?t.jsx("div",{className:kh,children:i}):null]})};Po.displayName="ModalPanelHeader";function Dh(e){const s=h.useRef(1),[n]=h.useState(e),[a,r]=h.useState(()=>[{key:"panel-0",panel:e}]),i=h.useCallback(p=>{const m=`panel-${s.current}`;return s.current+=1,{key:m,panel:p}},[]),o=h.useCallback(p=>{const m=i(p);r(x=>[...x,m])},[i]),l=h.useCallback(()=>{r(p=>p.length>1?p.slice(0,-1):p)},[]),d=h.useCallback(p=>{const m=i(p);r(x=>[...x.slice(0,-1),m])},[i]),u=h.useCallback(p=>{r([i(p===void 0?n:p)])},[i,n]);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 Eh(){const e=h.useRef(new Map),[s,n]=h.useState(0),[a,r]=h.useState(null),[i,o]=h.useState(0),l=h.useCallback(()=>{let g=0;for(const y of e.current.values())y.isDirty&&(g+=1);n(g)},[]),d=h.useCallback((g,y)=>{e.current.set(g,y),l()},[l]),u=h.useCallback(g=>{e.current.delete(g),l()},[l]),p=h.useCallback((g,y)=>{let w=!1;for(const k of e.current.values())k.isDirty&&(g===null||k.scope===g)&&(w=!0);w?r({leave:y}):y()},[]),m=h.useCallback(g=>p(null,g),[p]),x=h.useCallback(g=>{for(const y of e.current.values())y.isDirty=!1;l(),r(null),g()},[l]),f=h.useCallback(g=>y=>{y?g(!0):m(()=>g(!1))},[m]),b=h.useCallback(()=>{const g=a?.leave;r(null),o(y=>y+1),g?.()},[a]),v=h.useCallback(()=>r(null),[]);return h.useMemo(()=>({isDirty:s>0,guard:m,bypass:x,guardOpenChange:f,internals:{pending:a,confirmKey:i,confirm:b,keepEditing:v,report:d,unreport:u,guardScope:p}}),[s,m,x,f,a,i,b,v,d,u,p])}const Lh=60,Fh=(e,s,n=Lh)=>s?e>n:e<-n,To=(e,s)=>Math.max(0,Math.min(e,s)),_h=160,Rh=(e,s,n=_h)=>Math.min(e,Math.max(0,s-n)),Mh=(e,s,n)=>To(e-s,n),Ph=(e,s,n)=>e!==null?To(e,n):s?n:0,Th=e=>e?"":"transition-[height] duration-300 ease-out",Ih=e=>({onDrag:(s,n)=>{const a=e.open?e.fullHeight:0;e.setDragHeight(Mh(a,n?.offset?.y??0,e.fullHeight))},onDragEnd:(s,n)=>{Fh(n?.offset?.y??0,e.open)&&e.onToggleOpen?.(),e.setDragHeight(null)}}),St=(e,s)=>xe(e.value,s,e.currency),Hr=`opacity-60 transition-opacity ${ke}`,Sa=({item:e,locale:s,onRemove:n,removeAriaLabel:a,showRemoveButton:r=!0,compact:i=!1})=>{const o=!!e.children&&e.children.length>0,l=!!n&&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:Je[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&&Hr),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&&Hr),children:St(e.amount,s)}),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:()=>n(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,p)=>t.jsxs("div",{"data-testid":`summary-item-detail-${e.id}-${u.key??p}`,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??p}`,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??p)),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:s,onRemove:n,removeAriaLabel:a,showRemoveButton:r,compact:i},u.id))})]})};Sa.displayName="SummaryItemRow";const Io=({fee:e,locale:s,className:n})=>t.jsxs("div",{"data-testid":"summary-service-fee",className:c.cn("flex items-center justify-between gap-2",n),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:St(e.amount,s)})]});Io.displayName="SummaryServiceFeeRow";const $a=({row:e,locale:s,emphasized:n,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(n?"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:St(e.amount,s)})]})};$a.displayName="SummaryTotalsLineRow";const Oo=({pricesInLabel:e,currency:s,items:n,serviceFee:a,rows:r,locale:i,onRemoveItem:o,removeAriaLabel:l,onRemoveTotalRow:d,removeTotalRowAriaLabel:u,showRemoveButton:p,emptyState:m,compact:x=!1,classNames:f})=>{const b=(n?.length??0)>0;return t.jsxs(t.Fragment,{children:[!x&&t.jsxs("div",{"data-testid":"summary-prices",className:c.cn("flex items-center justify-between text-xs text-default-500",f.prices),children:[t.jsx("span",{children:e}),s!=null&&t.jsx("span",{children:s})]}),b?t.jsx("div",{className:c.cn(x?"flex flex-col divide-y divide-default-100":"flex flex-col gap-4",f.items),children:n.map(v=>t.jsx(Sa,{item:v,locale:i,onRemove:o,removeAriaLabel:l,showRemoveButton:p,compact:x},v.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(Io,{fee:a,locale:i,className:f.serviceFee})]}),r&&r.length>0&&t.jsx("div",{className:c.cn(x?c.cn("flex flex-col gap-1 pt-3",!a&&"border-t border-default-100"):"flex flex-col gap-4",f.totalsRows),children:r.map((v,g)=>t.jsx($a,{row:v,locale:i,emphasized:!x&&g===0,onRemove:d,removeAriaLabel:u,showRemoveButton:p,compact:x},v.key))})]})};Oo.displayName="SummaryBody";const Bo=({total:e,locale:s,compact:n=!1,className:a})=>{const r=n?"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:St(e.amount,s)})]})};Bo.displayName="SummaryGrandTotalRow";const zo=({secondaryTotal:e,locale:s,className:n})=>t.jsxs("div",{"data-testid":"summary-secondary-total",className:c.cn("flex items-center justify-between text-lg font-semibold leading-7 text-primary",n),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:St(e.amount,s)})]});zo.displayName="SummarySecondaryTotalRow";const Ps=({action:e,disabledByLoading:s,className:n,testId:a="summary-cta"})=>t.jsx(O,{color:"primary",radius:"full",className:c.cn("px-[18px] py-[14px] font-medium",n),"data-testid":a,isLoading:e.isLoading,isDisabled:e.isDisabled||s,onPress:e.onPress,endContent:t.jsx(P,{icon:"lucide:arrow-right",width:16,height:16}),children:e.label});Ps.displayName="SummaryPrimaryCta";const Vo=({title:e,total:s,secondaryTotal:n,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:s.label??"Total"}),t.jsx("span",{className:"whitespace-nowrap",children:St(s.amount,a)})]}),n&&t.jsxs("span",{className:"flex items-center justify-between text-lg font-semibold leading-7 text-primary",children:[t.jsx("span",{children:n.label}),t.jsx("span",{className:"whitespace-nowrap",children:St(n.amount,a)})]})]})]})});Vo.displayName="SummaryCollapseHeader";const Uo=({cart:e,ariaLabel:s,onPress:n,className:a})=>t.jsxs("button",{type:"button","data-testid":"summary-cart","aria-label":s,onClick:n,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})]});Uo.displayName="SummaryCartButton";const Ho=({open:e,progress:s,dragging:n,primaryAction:a,isLoading:r,cart:i,cartAriaLabel:o,ctaCaption:l,ctaError:d,onToggleOpen:u,classNames:p})=>t.jsxs("div",{"data-testid":"summary-mobile-bar",className:c.cn("flex flex-col gap-4",p.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-s},className:c.cn("col-start-1 row-start-1 flex items-stretch gap-2.5",e&&"pointer-events-none",!n&&"transition-opacity duration-300"),children:[i&&t.jsx(Uo,{cart:i,ariaLabel:o,className:p.cart,onPress:()=>{u?.(),i.onPress?.()}}),a&&t.jsx(Ps,{action:a,disabledByLoading:r,className:c.cn("h-[52px] flex-1",p.cta),testId:"summary-cta-compact"})]}),a&&t.jsx("div",{"aria-hidden":!e,style:{opacity:s},className:c.cn("col-start-1 row-start-1 flex",!e&&"pointer-events-none",!n&&"transition-opacity duration-300"),children:t.jsx(Ps,{action:a,disabledByLoading:r,className:c.cn("h-[52px] w-full",p.cta)})})]}),l&&t.jsx("div",{children:l})]});Ho.displayName="SummaryActionBar";const Oh="(max-width: 767px)",Bh=e=>typeof window<"u"&&typeof window.matchMedia=="function"?window.matchMedia(e).matches:!1,zh=(e=Oh)=>{const[s,n]=h.useState(()=>Bh(e));return h.useEffect(()=>{if(typeof window>"u"||typeof window.matchMedia!="function")return;const a=window.matchMedia(e),r=()=>n(a.matches);return r(),a.addEventListener("change",r),()=>a.removeEventListener("change",r)},[e]),s},Wo=({title:e="Summary",pricesInLabel:s="Prices are in",currency:n,locale:a="en-US",items:r,serviceFee:i,rows:o,total:l,postTotalRows:d,onRemoveTotalRow:u,onRemovePostTotalRow:p,secondaryTotal:m,collapsible:x,isOpen:f,onToggleOpen:b,defaultOpen:v=!1,primaryAction:g,isLoading:y=!1,onRemoveItem:w,showRemoveButton:k,ctaCaption:N,ctaError:$,variant:E,cart:j,emptyState:L,labels:S,classNames:M={},density:D="default","data-testid":A="summary",className:R})=>{const T=S?.removeAriaLabel??"Remove item",U=S?.removeTotalRowAriaLabel??"Remove discount",G=S?.removePostTotalRowAriaLabel??"Remove applied code",I=S?.toggleAriaLabel??"Toggle summary",se=S?.cartAriaLabel??"View cart",q=D==="compact",Q=zh(),ce=x??(E??(Q?"mobile":"main"))==="mobile",[ne,X]=h.useState(v),ie=f!==void 0,V=!ce||(ie?f:ne),z=h.useCallback(()=>{ie||X(B=>!B),b?.()},[ie,b]),[Z,Ie]=h.useState(0),[Le,Fe]=h.useState(null),ae=h.useRef(null),je=h.useRef(null),_e=h.useCallback(()=>{const B=ae.current;B&&Ie(Rh(B.scrollHeight,window.innerHeight))},[]),et=h.useCallback(B=>{je.current?.disconnect(),je.current=null,ae.current=B,B&&(_e(),typeof ResizeObserver<"u"&&(je.current=new ResizeObserver(_e),je.current.observe(B)))},[_e]);h.useEffect(()=>(window.addEventListener("resize",_e),()=>window.removeEventListener("resize",_e)),[_e]);const ge=Ih({open:V,fullHeight:Z,setDragHeight:Fe,onToggleOpen:z}),Re=Le!==null,ue=Ph(Le,V,Z),ye=Z>0?Math.min(1,Math.max(0,ue/Z)):V?1:0,J=t.jsx(Bo,{total:l,locale:a,compact:q,className:M.total}),C=d&&d.length>0&&t.jsx("div",{"data-testid":"summary-post-total-rows",className:"flex flex-col gap-4",children:d.map(B=>t.jsx($a,{row:B,locale:a,emphasized:!1,onRemove:p,removeAriaLabel:G,showRemoveButton:k,compact:q},B.key))}),F=m&&t.jsx(zo,{secondaryTotal:m,locale:a,className:M.secondaryTotal}),_=N!=null&&t.jsx("p",{"data-testid":"summary-cta-caption",className:c.cn("text-center text-sm text-default-500",M.ctaCaption),children:N}),W=$!=null&&t.jsx("p",{role:"alert","data-testid":"summary-cta-error",className:c.cn("text-center text-sm text-danger",M.ctaError),children:$}),H=t.jsx(Oo,{pricesInLabel:s,currency:n,items:r,serviceFee:i,rows:o,locale:a,onRemoveItem:w,removeAriaLabel:T,onRemoveTotalRow:u,removeTotalRowAriaLabel:U,showRemoveButton:k,emptyState:L,compact:q,classNames:M});return ce?t.jsxs(We.motion.section,{"data-testid":A,drag:"y",dragConstraints:{top:0,bottom:0},dragElastic:.12,dragSnapToOrigin:!0,onDrag:ge.onDrag,onDragEnd:ge.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)]",R,M.base),children:[t.jsx(Vo,{title:e,total:l,secondaryTotal:m,locale:a,open:V,progress:ye,dragging:Re,toggleAriaLabel:I,onToggleOpen:z,classNames:M}),t.jsx("div",{"data-testid":"summary-reveal","aria-hidden":!V,style:{height:ue},className:c.cn("min-h-0",V&&!Re?"overflow-y-auto overscroll-contain [scrollbar-width:none] [&::-webkit-scrollbar]:hidden":"overflow-hidden",!V&&"pointer-events-none",Th(Re)),children:t.jsxs("div",{ref:et,className:q?"flex flex-col gap-3 pb-4":"flex flex-col gap-4 pb-4",children:[H,!q&&t.jsx(c.Divider,{className:"bg-default-200"}),J,C,F]})}),t.jsx(Ho,{open:V,progress:ye,dragging:Re,primaryAction:g,isLoading:y,cart:j,cartAriaLabel:se,ctaCaption:_,ctaError:W,onToggleOpen:z,classNames:M})]}):t.jsxs("section",{"data-testid":A,className:c.cn(q?"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",R,M.base),children:[!q&&t.jsx("div",{className:c.cn("flex items-center justify-between",M.header),children:t.jsx("h2",{"data-testid":"summary-title",className:c.cn("text-xl font-semibold leading-7 text-foreground",M.title),children:e})}),H,!q&&t.jsx(c.Divider,{className:"bg-default-200"}),J,C,F,m&&g&&t.jsx(c.Divider,{className:"bg-default-200"}),g&&t.jsx(Ps,{action:g,disabledByLoading:y,className:c.cn("w-full",M.cta)}),W,_]})};Wo.displayName="Summary";const ot={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"},Wr={done:"bg-pos-ok",active:"bg-primary",upcoming:"bg-pos-line"},Vh={done:"text-pos-ok",active:"text-pos-ink",upcoming:"text-pos-muted"},Uh={ariaLabel:"Progress",completed:"completed"},Aa=({steps:e,activeStepId:s,showLabels:n=!0,onStepPress:a,isStepReachable:r,labels:i,className:o,"data-testid":l="step-progress"})=>{const d={...Uh,...i},u=e.filter(x=>x.state!=="skipped"),p=Math.max(0,u.findIndex(x=>x.id===s)),m=x=>x<p?"done":x===p?"active":"upcoming";return n?t.jsx("ol",{"aria-label":d.ariaLabel,className:c.cn(ot.list,o),"data-testid":l,children:u.map((x,f)=>{const b=m(f),v=t.jsxs(t.Fragment,{children:[t.jsx("span",{"aria-hidden":"true",className:c.cn(ot.segment,"w-full",Wr[b]),"data-testid":`${l}-segment-${x.id}`}),t.jsxs("span",{className:c.cn(ot.name,Vh[b]),"data-testid":`${l}-name-${x.id}`,children:[b==="done"&&t.jsx("span",{"aria-hidden":"true",className:ot.check,"data-testid":`${l}-check-${x.id}`,children:t.jsx(P,{icon:"solar:check-circle-bold",width:"100%",height:"100%"})}),t.jsx("span",{className:"truncate",children:x.label}),b==="done"&&t.jsxs("span",{className:"sr-only",children:[", ",d.completed]})]})]}),g=r?r(x.id,f):f<p,y=b==="active"?"step":void 0;return t.jsx("li",{className:ot.item,"aria-current":a?void 0:y,"data-state":b,"data-testid":`${l}-step-${x.id}`,children:a?t.jsx("button",{type:"button",className:c.cn(ot.step,ot.button),disabled:!g,"aria-current":y,onClick:()=>a(x.id),"data-testid":`${l}-button-${x.id}`,children:v}):t.jsx("div",{className:ot.step,children:v})},x.id)})}):t.jsx("div",{"aria-hidden":"true",className:c.cn(ot.bare,o),"data-testid":l,children:u.map((x,f)=>t.jsx("span",{className:c.cn(ot.segment,"flex-1",Wr[m(f)]),"data-state":m(f)},x.id))})};Aa.displayName="StepProgress";const Hh={back:"Back",close:"Close",cancel:"Cancel",partialBadge:"Partial refund",owesBadge:"Customer owes",ofSeparator:"of"},Wh={backgroundColor:de.destructive,color:"#fff"},qh={warn:{backgroundColor:de["warn-fill"],color:de.warn},ok:{backgroundColor:de["ok-fill"],color:de.ok},neutral:{backgroundColor:"hsl(var(--heroui-default-100))",color:"hsl(var(--heroui-default-600))",border:`1px solid ${de.line}`}},gn="inline-flex h-[22px] items-center gap-[5px] whitespace-nowrap rounded-full px-[9px] text-xs font-medium leading-none",yn="absolute top-0 h-5 w-5 opacity-0",qo=({onClose:e,steps:s,activeStepId:n,subtitle:a,onBack:r,primaryAction:i,totalRow:o,secondaryAction:l,hideChrome:d,footerSummary:u,labels:p,className:m,"data-testid":x="wizard-shell",children:f})=>{const b={...Hh,...p},v=s.find(w=>w.id===n),g=r??e,y=r?b.back:b.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":x,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":`${x}-header`,children:[g&&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:g,"data-testid":`${x}-header-back`,startContent:t.jsx(P,{icon:"lucide:circle-chevron-left",width:18,height:18,"aria-hidden":"true"}),children:y}),t.jsxs("div",{className:"min-w-0",children:[t.jsx("h2",{className:"text-lg font-semibold","data-testid":`${x}-header-title`,children:v?.label??""}),a&&t.jsx("div",{className:"mt-0.5 text-[12.5px] text-default-500","data-testid":`${x}-header-subtitle`,children:a})]}),t.jsxs("div",{className:"relative flex-1","data-testid":`${x}-footer`,children:[e&&t.jsx("button",{type:"button","aria-label":b.close,onClick:e,className:c.cn(yn,"left-0"),"data-testid":`${x}-header-close`}),r&&t.jsx("button",{type:"button","aria-label":b.back,onClick:r,className:c.cn(yn,"left-6"),"data-testid":`${x}-back`}),l&&t.jsx("button",{type:"button","aria-label":l.label,disabled:l.disabled,onClick:l.onClick,className:c.cn(yn,"left-12"),"data-testid":`${x}-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":`${x}-total`,children:[t.jsx("span",{children:o.label}),o.amount&&t.jsx("span",{className:"tabular-nums text-default-900",children:xe(o.amount.value,void 0,o.amount.currency)}),o.of&&t.jsxs(t.Fragment,{children:[t.jsx("span",{children:b.ofSeparator}),t.jsx("span",{className:"tabular-nums text-default-900","data-testid":`${x}-total-of`,children:xe(o.of.value,void 0,o.of.currency)})]}),o.badge==="partial"&&t.jsx("span",{className:c.cn(gn,"bg-pos-warn-fill text-pos-warn"),"data-testid":`${x}-total-partial`,children:b.partialBadge}),o.badge==="owes"&&t.jsx("span",{className:c.cn(gn,"border border-pos-line bg-default-100 text-default-600"),"data-testid":`${x}-total-owes`,children:b.owesBadge}),typeof o.badge=="object"&&t.jsx("span",{className:gn,style:qh[o.badge.tone],"data-tone":o.badge.tone,"data-testid":`${x}-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"?Wh:void 0,isLoading:i.loading,isDisabled:i.disabled,onPress:i.onClick,"data-testid":`${x}-primary`,children:i.label})]})]}),t.jsx(Aa,{steps:s,activeStepId:n,showLabels:!1,className:"shrink-0 px-6 py-2.5","data-testid":`${x}-stepper`}),t.jsx("div",{className:"min-h-0 flex-1 overflow-auto px-6 py-[22px]","data-testid":`${x}-body`,children:f}),u]})};qo.displayName="WizardShell";const Gh=(e,s,n)=>Math.min(Math.max(e,s),n);function Tn(e,s,n){const a=Math.max(1,Math.trunc(s)),r=Gh(Math.trunc(n),0,a);if(r===a)return{...e};if(r===0)return{value:0,currency:e.currency};const i=Math.pow(10,Ot(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 Kh(e,s){return Tn(e,s,1)}const Yh=e=>Number.isFinite(e)?e.toFixed(2):"",In=({value:e,expected:s,max:n,onChange:a,ariaLabel:r,isDisabled:i,className:o,"data-testid":l,inputTestId:d})=>{const[u,p]=h.useState(null),m=h.useRef(null),x=Math.abs(e-s)>.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",x?"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??Yh(e),onChange:f=>{const b=f.target.value,v=Number.parseFloat(b.replace(",","."));n!==void 0&&Number.isFinite(v)&&v>n+.004||(p(b),Number.isFinite(v)&&v>=0?a(v):b.trim()===""&&a(0))},onFocus:f=>f.currentTarget.select(),onBlur:()=>p(null),"data-testid":d})]})};In.displayName="AmountCell";const Qh={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"},Zh="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",qr="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",vn="absolute h-5 w-5 opacity-0",Xh=e=>{const s=xe(e.paidAmount.value,void 0,e.paidAmount.currency);if(e.quantity<=1)return s;const n=Kh(e.paidAmount,e.quantity);return`${e.quantity} × ${xe(n.value,void 0,n.currency)} · ${s}`},Go=({items:e,selections:s,onSelectionChange:n,onRestockToggle:a,onDispositionChange:r,amountOnly:i,labels:o,className:l,"data-testid":d="line-item-list"})=>{const u={...Qh,...o},p=[{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 x=s[m.id],f=m.state==="already_refunded"||m.state==="non_refundable",b=`${d}-row-${m.id}`,v=Math.max(1,Math.trunc(m.quantity)),g=x?.quantity,y=x?.selected?Math.min(g??v,v):g??0,w=Tn(m.paidAmount,v,y).value,k=x?.amount??(x?.selected?w:0),N=y===0&&k>.004,$=j=>n(m.id,{selected:j.quantity>0||j.amount>.004,mode:"full",...j}),E=j=>{const L=Math.min(Math.max(j,0),v);$({quantity:L,amount:Tn(m.paidAmount,v,L).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",f&&"opacity-60"),"data-testid":b,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":`${b}-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":`${b}-detail`,children:m.detail??Xh(m)}),N&&t.jsx("p",{className:"mt-[3px] text-[12.5px] italic text-default-500","data-testid":`${b}-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":`${b}-partial`,children:[f?t.jsx("span",{className:"text-sm font-semibold tabular-nums",children:xe(m.paidAmount.value,void 0,m.paidAmount.currency)}):t.jsx(In,{value:k,expected:w,max:m.paidAmount.value,onChange:j=>$({quantity:y,amount:j}),ariaLabel:u.amount.replace("{name}",m.name),className:"w-[120px]","data-testid":`${b}-amount`,inputTestId:`${b}-partial-input-field`}),f?t.jsx("span",{className:Zh,"data-testid":`${b}-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":`${b}-qty`,children:[t.jsx("button",{type:"button",className:qr,"aria-label":u.decrease.replace("{name}",m.name),disabled:y===0,onClick:()=>E(y-1),"data-testid":`${b}-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":`${b}-qty-value`,children:y}),t.jsx("button",{type:"button",className:qr,"aria-label":u.increase.replace("{name}",m.name),disabled:y===v,onClick:()=>E(y+1),"data-testid":`${b}-qty-increase`,children:"+"})]})]})]}),y>=v&&t.jsx("p",{className:"mt-2 text-xs text-default-500","data-testid":`${b}-max-note`,children:u.maxNote.replace("{count}",String(v))}),x?.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":`${b}-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})]}),y>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(it,{"aria-label":u.disposition,className:"w-[220px]",selectedKeys:[m.restock.disposition??(m.restock.on?"stock":"norestock")],onSelectionChange:j=>{if(j==="all")return;const L=[...j][0];L&&(r?.(m.id,L),a(m.id,L==="stock"))},"data-testid":`${b}-restock`,children:p.map(j=>t.jsx(c.SelectItem,{children:j.label},j.key))})]})]}),!f&&t.jsxs(t.Fragment,{children:[t.jsx(c.Checkbox,{className:c.cn(vn,"right-0 top-0 m-0 p-0"),isSelected:!!x?.selected,onValueChange:j=>n(m.id,{selected:j,mode:"full"}),"aria-label":m.name,"data-testid":`${b}-checkbox`}),t.jsx("button",{type:"button","aria-label":u.partialLink,onClick:()=>document.querySelector(`[data-testid="${b}-partial-input-field"]`)?.focus(),className:c.cn(vn,"left-0 top-0"),"data-testid":`${b}-partial-link`}),t.jsx("button",{type:"button","aria-label":u.partialCancel,onClick:()=>$({quantity:y,amount:w}),className:c.cn(vn,"left-5 top-0"),"data-testid":`${b}-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}",xe(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(In,{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"})})]})]})})]}))]})};Go.displayName="LineItemList";const Jh={color:de.danger},Ko=({children:e,className:s,"data-testid":n="meta-card"})=>t.jsx("div",{className:c.cn("mx-auto mt-[18px] flex max-w-[1040px] flex-col gap-3",s),"data-testid":n,children:t.jsx("div",{className:"rounded-[14px] border border-pos-line bg-white px-4 py-3.5 text-default-900",children:e})});Ko.displayName="MetaCard";const Yo=({label:e,htmlFor:s,required:n,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:s,className:"text-[13px] font-medium text-default-600",children:[e,n&&t.jsx("span",{"aria-hidden":"true",className:"ms-0.5 text-danger",style:Jh,"data-testid":`${i}-required`,children:"*"})]}),t.jsx("div",{className:"w-full sm:w-[290px] sm:shrink-0",children:a})]});Yo.displayName="MetaCard.Row";const Qo=({label:e,children:s,className:n,"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",n),"data-testid":a,children:[e&&t.jsx("p",{className:"text-[13px] font-medium text-default-600",children:e}),s]});Qo.displayName="MetaCard.Section";const eb=Object.assign(Ko,{Row:Yo,Section:Qo}),Zo=({heading:e,icon:s="lucide:rotate-ccw",action:n,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:s,width:16,height:16,"aria-hidden":"true"}),t.jsx("h3",{"data-testid":`${i}-heading`,children:e}),t.jsx("div",{className:"flex-1"}),n&&t.jsxs("button",{type:"button",disabled:n.disabled,onClick:n.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:n.icon??"lucide:plus",width:14,height:14,"aria-hidden":"true"}),n.label]})]}),a]});Zo.displayName="SectionPanel";const Xo=({name:e,detail:s,icon:n="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:n,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}),s&&t.jsx("p",{className:"text-[12.5px] text-default-500",children:s})]})]});Xo.displayName="CustomerCard";const tb={label:"Reason for the return",placeholder:"Select a reason…"},Jo=({options:e,value:s,onChange:n,error:a,isRequired:r,labels:i,className:o,"data-testid":l="reason-select"})=>{const d={...tb,...i};return t.jsx(it,{label:d.label,labelPlacement:"outside",placeholder:d.placeholder,selectedKeys:s?[s]:[],isRequired:r,isInvalid:!!a,errorMessage:a,className:c.cn(o),"data-testid":l,onSelectionChange:u=>{if(u==="all")return;const p=[...u][0];p&&n(String(p))},children:e.map(u=>t.jsx(c.SelectItem,{children:u.label},u.id))})};Jo.displayName="ReasonSelect";const sb={toggle:"Add a note",optionalTag:"(optional)",heading:"Additional note",placeholder:"Add a note (optional)"},ec=({value:e,onChange:s,maxLength:n,alwaysExpanded:a=!1,hideLabel:r=!1,labels:i,className:o,"data-testid":l="notes-field"})=>{const d={...sb,...i},[u,p]=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=>s(m.target.value),maxLength:n,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=>s(m.target.value),maxLength:n,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:()=>p(!0),"data-testid":`${l}-toggle`,children:[d.toggle,t.jsx("span",{className:"ml-1 font-normal text-default-400",children:d.optionalTag})]})})};ec.displayName="NotesField";const nb={info:"solar:info-circle-bold",success:"solar:check-circle-bold",warning:"solar:danger-triangle-bold",danger:"solar:danger-circle-bold"},ab="solar:close-circle-linear",rb={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"}},ib={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"}},lb={info:"status",success:"status",warning:"alert",danger:"alert"};function Da({tone:e="info",variant:s="callout",title:n,description:a,actions:r,onDismiss:i,dismissLabel:o="Dismiss",role:l=lb[e],className:d,"data-testid":u="notice"}){const p=Is(),m=rb[s],x=ib[e],f=s==="banner",b=re(n),v=re(a),g=b?f?t.jsx("p",{"data-testid":`${u}-title`,className:c.cn(m.title,x.title),children:n}):t.jsx("span",{"data-testid":`${u}-title`,className:m.title,children:n}):null,y=v?f?t.jsx("p",{"data-testid":`${u}-description`,className:c.cn(m.description,b&&"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":s,"data-testid":u,className:c.cn(m.root,f?x.banner:x.callout,d),children:[t.jsx("span",{"aria-hidden":"true","data-testid":`${u}-icon`,className:c.cn(m.iconWrapper,f&&x.disc),children:t.jsx(P,{icon:nb[e],width:m.iconSize,height:m.iconSize})}),t.jsxs("div",{className:m.text,children:[f?t.jsxs(t.Fragment,{children:[g,y]}):t.jsxs("p",{children:[g,b&&v?" ":null,y]}),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:p,className:c.cn(m.dismiss,ke),"data-testid":`${u}-dismiss`,children:t.jsx(P,{icon:ab,width:"1.125rem",height:"1.125rem"})}):null]})}Da.displayName="Notice";const Gr="h-8 min-w-0 rounded-[0.625rem] px-3 text-[0.8125rem] font-semibold",Ks=({tone:e,title:s,body:n,onRetry:a,retryLabel:r,onChooseDifferent:i,chooseDifferentLabel:o,className:l,"data-testid":d,retryTestId:u,chooseDifferentTestId:p})=>t.jsx(Da,{variant:"banner",tone:e,title:s,description:n,className:l,"data-testid":d,actions:t.jsxs(t.Fragment,{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":p,children:o})]})});Ks.displayName="TenderBanner";const ob={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"},cb={card:"lucide:credit-card",cash:"lucide:dollar-sign",check:"lucide:edit-3",other:"lucide:more-horizontal"},tc=({tenders:e,selectedTenderId:s,onSelect:n,onSplit:a,error:r,labels:i,className:o,"data-testid":l="tender-methods"})=>{const d={...ob,...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(Ks,{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(p=>{const m=p.tenderId===s;return t.jsxs("button",{type:"button",role:"radio","aria-checked":m,onClick:()=>n(p.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-${p.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:cb[p.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:p.label}),t.jsx("span",{className:"block text-xs text-default-500",children:xe(p.maxRefundable.value,void 0,p.maxRefundable.currency)})]})]},p.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})]})]})]})};tc.displayName="TenderMethods";const db=e=>e.refunded!==null,ub={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"},mb="mb-2 text-[11px] font-semibold uppercase tracking-[.08em] text-default-500",fb="inline-flex h-[22px] shrink-0 items-center gap-[5px] whitespace-nowrap rounded-full px-[9px] text-xs font-medium leading-none",sc=({parts:e,refundedSoFar:s,remaining:n,current:a,methods:r,onRefundPart:i,partError:o,onBack:l,busy:d,hideActions:u,labels:p,className:m,"data-testid":x="split-tender-panel"})=>{const f={...ub,...p},b=e.filter(db),v=e.find(j=>j.tenderId===a.tenderId)?.label,g=!!(r?.length&&a.onTenderChange),y=Ot(n.currency),{draft:w,setDraft:k,normalize:N}=vo(a.amount,String),$=h.useCallback(j=>{va(j,y)&&(k(j),a.onAmountChange(is(j)??0))},[a,k,y]),E=o?.kind==="processor_declined";return t.jsxs("div",{className:c.cn("flex flex-col text-default-900",m),"data-testid":x,children:[t.jsx("h3",{className:"sr-only","data-testid":`${x}-title`,children:f.title}),o&&t.jsx(Ks,{tone:E?"danger":"warning",title:E?f.declinedTitle:f.networkTitle,body:E?f.partDeclinedBody:f.partNetworkBody,onRetry:o.onRetry,retryLabel:f.retry,onChooseDifferent:o.onChooseDifferent,chooseDifferentLabel:f.chooseDifferent,className:"mb-[18px]","data-testid":`${x}-part-error`,retryTestId:`${x}-retry`,chooseDifferentTestId:`${x}-choose-different`}),t.jsxs("div",{"data-testid":`${x}-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:f.remaining}),t.jsx("span",{className:"text-[22px] font-semibold tabular-nums",children:xe(n.value,void 0,n.currency)}),t.jsxs("span",{className:"sr-only",children:[f.refundedSoFar,": ",xe(s.value,void 0,s.currency)]})]}),b.length>0&&t.jsxs("div",{children:[t.jsx("p",{className:mb,children:f.refundedSoFar}),b.map((j,L)=>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":`${x}-part-${j.tenderId}-done`,children:[t.jsxs("span",{className:"w-[22px] shrink-0 font-bold text-default-600",children:["#",L+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:j.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:j.label}),j.feeNote&&t.jsx("span",{className:"block text-[11.5px] text-default-500",children:j.feeNote})]}),t.jsx("span",{className:"font-semibold tabular-nums",children:xe(j.refunded.value,void 0,j.refunded.currency)}),t.jsx("span",{className:c.cn(fb,j.status==="pending"?"bg-pos-warn-fill text-pos-warn":"bg-pos-ok-fill text-pos-ok"),children:j.status==="pending"?f.pending:f.succeeded})]},j.tenderId))]})]}),t.jsxs("div",{className:"mt-3.5","data-testid":`${x}-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:f.partHeading.replace("{n}",String(b.length+1))}),v&&t.jsx("span",{className:"text-xs text-default-500",children:v})]}),t.jsx("p",{"aria-hidden":"true",className:"mb-1.5 text-[13px] font-semibold","data-testid":`${x}-amount-label`,children:f.amountForPart}),t.jsx(wa,{heading:f.amountForPart,amountLabel:f.amountForPart,hideHeading:!0,placeholder:"$0.00",value:w,onChange:$,onBlur:N,maxAmount:n.value,isDisabled:d,className:"gap-0 border-t-0 pt-0","data-testid":`${x}-amount`}),g&&t.jsx("div",{className:"mt-2.5 flex gap-2","data-testid":`${x}-methods`,children:r?.map(j=>{const L=j.tenderId===a.tenderId;return t.jsxs("button",{type:"button","aria-pressed":L,disabled:j.disabled||d,onClick:()=>a.onTenderChange?.(j.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",L?"border-primary bg-primary/5 text-primary":"border-pos-line text-default-600"),"data-testid":`${x}-method-${j.tenderId}`,children:[j.icon&&t.jsx(P,{icon:j.icon,width:15,height:15,"aria-hidden":"true"}),j.label]},j.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":`${x}-back`,children:f.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":`${x}-submit`,children:f.submit})]})]})};sc.displayName="SplitTenderPanel";const nc="hsl(var(--heroui-primary))",pb="hsl(var(--heroui-primary) / 0.05)",ac="hsl(var(--heroui-default-100))",rc="hsl(var(--heroui-default-600))",Ea={card:"lucide:credit-card",cash:"lucide:dollar-sign",check:"lucide:edit-3",store_credit:"lucide:gift",reader:"lucide:nfc",other:"lucide:more-horizontal"},me={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"},xb={idle:{borderColor:de.line,backgroundColor:"#fff"},selected:{borderColor:nc,backgroundColor:pb},declined:{borderColor:de.danger,backgroundColor:de["danger-fill"]}},Ts={idle:{backgroundColor:ac,color:rc},selected:{backgroundColor:nc,color:"#fff"}},hb={backgroundColor:ac,color:rc},bb={borderColor:de.line},Kr={declined:{color:de.danger},pending:{color:de.warn,backgroundColor:de["warn-fill"]},done:{color:de.ok,backgroundColor:de["ok-fill"]}},gb={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"},yb=e=>{try{return new Intl.NumberFormat("en-US",{style:"currency",currency:e}).formatToParts(0).find(s=>s.type==="currency")?.value??e}catch{return e}},vb=({method:e,currency:s,busy:n,labels:a,onToggle:r,onAmountChange:i,onAmountBlur:o,onRemove:l,testId:d})=>{const u=e.status??"idle",p=u==="pending"||u==="done",m=n||p,x=!!(e.removable&&l),f=e.cap?.currency??s,b=Ot(f),v=`${d}-amount`,g=a.amountFor.replace("{method}",e.label),y=h.useCallback(E=>{if(!va(E,b))return;const j=is(E);e.cap&&j!==null&&j>e.cap.value||i(e.id,E)},[b,e.cap,e.id,i]),w=h.useCallback(E=>{const j=E.currentTarget;requestAnimationFrame(()=>{j.isConnected&&j.select()})},[]),k=u==="declined"?"declined":e.selected?"selected":"idle",N=e.statusLabel??(u==="idle"?void 0:a[u]),$=t.jsxs("span",{className:me.toggleHeader,children:[t.jsx("span",{className:me.iconBox,style:e.selected?Ts.selected:Ts.idle,"data-testid":`${d}-icon`,children:t.jsx(P,{icon:Ea[e.kind],width:18,height:18,"aria-hidden":"true"})}),t.jsxs("span",{className:me.text,children:[t.jsx("span",{className:me.label,children:e.label}),u==="declined"&&N?t.jsx("span",{className:me.status,style:Kr.declined,"data-testid":`${d}-status`,children:N}):e.subtitle&&t.jsx("span",{className:me.subtitle,children:e.subtitle})]}),p&&N&&t.jsx("span",{className:me.badge,style:Kr[u],"data-testid":`${d}-status`,children:N})]});return t.jsxs("div",{className:me.card,style:xb[k],"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(me.toggle,me.focusRing,x&&me.toggleRemovable),"data-testid":`${d}-toggle`,children:$}),t.jsxs("div",{className:me.amountSlot,children:[t.jsx("label",{htmlFor:v,className:"sr-only",children:g}),t.jsx(c.Input,{id:v,"aria-label":g,type:"text",inputMode:"decimal",placeholder:"0.00",value:e.amount??"",onChange:E=>y(E.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:yb(f)}),classNames:{inputWrapper:me.amountWrapper,input:me.amountInput},"data-testid":`${d}-amount`})]})]}):t.jsxs("button",{type:"button","aria-pressed":!1,disabled:m,onClick:()=>r(e.id),className:c.cn(me.toggle,me.toggleUnselected,me.focusRing,x&&me.toggleRemovable),"data-testid":`${d}-toggle`,children:[$,t.jsx("span",{className:me.lowerSlot,style:hb,"data-testid":`${d}-cap`,children:e.cap?a.upTo.replace("{amount}",xe(e.cap.value,void 0,e.cap.currency)):a.noCap})]}),x&&t.jsx("button",{type:"button","aria-label":a.remove.replace("{method}",e.label),disabled:n,onClick:()=>l?.(e.id),className:c.cn(me.remove,me.focusRing),"data-testid":`${d}-remove`,children:t.jsx(P,{icon:"lucide:x",width:16,height:16,"aria-hidden":"true"})})]})},ic=({methods:e,onToggle:s,onAmountChange:n,onAmountBlur:a,onRemove:r,currency:i="USD",paidWith:o,anotherMethod:l,error:d,busy:u=!1,labels:p,className:m,"data-testid":x="refund-method-cards"})=>{const f={...gb,...p};return t.jsxs("div",{className:c.cn(me.root,m),"data-testid":x,children:[d&&t.jsx(Ks,{tone:d.tone,title:d.title,body:d.body,onRetry:d.onRetry,retryLabel:f.retry,onChooseDifferent:d.onChooseDifferent,chooseDifferentLabel:f.chooseDifferent,className:me.banner,"data-testid":`${x}-error`,retryTestId:`${x}-retry`,chooseDifferentTestId:`${x}-choose-different`}),t.jsxs("div",{className:me.eyebrowRow,children:[t.jsx("p",{className:me.eyebrow,children:f.heading}),o&&t.jsx(Ws,{variant:"record",label:o.label,value:o.value,"data-testid":`${x}-paid-with`})]}),t.jsxs("div",{role:"group","aria-label":f.heading,className:me.grid,"data-testid":`${x}-grid`,children:[e.map(b=>t.jsx(vb,{method:b,currency:i,busy:u,labels:f,onToggle:s,onAmountChange:n,onAmountBlur:a,onRemove:r,testId:`${x}-method-${b.id}`},b.id)),l&&t.jsxs(c.Dropdown,{placement:"bottom-start",isDisabled:u,classNames:{trigger:me.anotherOpen},children:[t.jsx(c.DropdownTrigger,{children:t.jsxs("button",{type:"button",className:c.cn(me.another,me.focusRing),style:bb,"data-testid":`${x}-another`,children:[t.jsx("span",{className:me.iconBox,style:Ts.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:me.label,children:l.label}),t.jsx("span",{className:me.subtitle,children:l.subtitle})]})]})}),t.jsx(c.DropdownMenu,{"aria-label":l.label,items:l.options,onAction:b=>l.onPick(String(b)),"data-testid":`${x}-another-menu`,children:b=>t.jsx(c.DropdownItem,{textValue:b.label,description:b.description,className:me.menuItem,startContent:t.jsx("span",{className:me.iconBox,style:Ts.idle,children:t.jsx(P,{icon:Ea[b.kind],width:18,height:18,"aria-hidden":"true"})}),"data-testid":`${x}-another-option-${b.id}`,children:b.label},b.id)})]})]})]})};ic.displayName="RefundMethodCards";const Ge={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"},lc="hsl(var(--heroui-primary))",jb={idle:{borderColor:de.line,backgroundColor:"#fff"},active:{borderColor:lc,backgroundColor:"hsl(var(--heroui-primary) / 0.05)"},failed:{borderColor:de.danger,backgroundColor:de["danger-fill"]}},Yr={idle:{backgroundColor:"hsl(var(--heroui-default-100))",color:"hsl(var(--heroui-default-600))"},active:{backgroundColor:lc,color:"#fff"}},wb={backgroundColor:"#fff",color:de.neutral},_t=e=>({color:Je[e].fg,backgroundColor:Je[e].bg}),Nb={queued:_t("neutral"),processing:_t("info"),waiting_reader:_t("warn"),waiting_cash:_t("warn"),done:_t("ok"),failed:_t("danger")},Cb={heading:"Refunding",queued:"Queued",processing:"Processing",waitingReader:"Waiting for reader",waitingCash:"Waiting for cash",done:"Refunded",failed:"Failed"},kb={queued:"queued",processing:"processing",waiting_reader:"waitingReader",waiting_cash:"waitingCash",done:"done",failed:"failed"},Qr={waiting_reader:"lucide:nfc",waiting_cash:"lucide:banknote"},Sb=e=>e.status==="processing"||e.status==="waiting_reader"||e.status==="waiting_cash",oc=({parts:e,activeId:s,labels:n,className:a,"data-testid":r="refund-progress-list"})=>{const i={...Cb,...n},o=s??e.find(Sb)?.id;return t.jsxs("div",{className:c.cn(Ge.root,a),"data-testid":r,children:[t.jsx("p",{className:Ge.eyebrow,children:i.heading}),t.jsx("ol",{"aria-label":i.heading,className:Ge.list,children:e.map(l=>{const d=l.id===o,u=`${r}-part-${l.id}`,p=d?"active":l.status==="failed"?"failed":"idle";return t.jsxs("li",{"aria-current":d?"step":void 0,className:Ge.row,style:jb[p],"data-status":l.status,"data-active":d||void 0,"data-testid":u,children:[t.jsxs("div",{className:Ge.main,children:[t.jsx("span",{className:Ge.iconBox,style:d?Yr.active:Yr.idle,children:t.jsx(P,{icon:Ea[l.kind],width:18,height:18,"aria-hidden":"true"})}),t.jsxs("span",{className:Ge.text,children:[t.jsx("span",{className:Ge.label,children:l.label}),l.note&&t.jsx("span",{className:Ge.note,children:l.note})]}),t.jsx("span",{className:Ge.amount,children:xe(l.amount.value,void 0,l.amount.currency)}),t.jsxs("span",{className:Ge.badge,style:Nb[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[kb[l.status]]]})]}),(l.prompt||l.action)&&t.jsxs("div",{role:"status",className:Ge.prompt,style:wb,"data-testid":`${u}-prompt`,children:[Qr[l.status]&&t.jsx(P,{icon:Qr[l.status],width:18,height:18,"aria-hidden":"true"}),l.prompt&&t.jsx("span",{className:Ge.promptText,children:l.prompt}),l.action&&t.jsx(O,{color:"primary",className:Ge.action,onPress:l.action.onPress,isLoading:l.action.loading,isDisabled:l.action.disabled,"data-testid":`${u}-action`,children:l.action.label})]})]},l.id)})})]})};oc.displayName="RefundProgressList";const $b={label:"Supervisor authorization",placeholder:"••••"},cc=({pin:e,onChange:s,hint:n,error:a,labels:r,className:i,"data-testid":o="pin-field"})=>{const l={...$b,...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}),n&&t.jsx("p",{className:"mt-1.5 text-[13px] text-default-500",children:n}),t.jsx(c.Input,{type:"password",inputMode:"numeric","aria-label":l.label,placeholder:l.placeholder,value:e,onChange:d=>s(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`})]})};cc.displayName="PinField";const Ab={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"},Db={refund:{},payment:{title:"Payment complete",done:"New sale",authorizedBy:"Handled by {name}"}},Eb={succeeded:"bg-pos-ok-fill text-pos-ok",pending:"bg-pos-warn-fill text-pos-warn"},Lb="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",Fb="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)]",_b=["email","print"],Ss=`${ke} motion-reduce:data-[pressed=true]:scale-100 [html[data-pos-reduce-motion=true]_&]:data-[pressed=true]:scale-100`,Se={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 ${Ss}`,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] ${Ss}`,send:`h-10 w-full rounded-xl px-4 text-sm font-semibold ${Ss}`,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"},dc=({state:e,kind:s="refund",total:n,destinations:a,subtitle:r,reason:i,paidWith:o,outcomeGroups:l,changeDue:d,authorizedBy:u,selectedReceipts:p,onSendReceipt:m,receiptActions:x,emailReceipt:f,onDone:b,frameless:v=!1,labels:g,className:y,"data-testid":w="outcome-view"})=>{const k={...Ab,...Db[s],...g},N=h.useId(),$=n?xe(n.value,void 0,n.currency):null;return e==="processing"?t.jsx("div",{className:c.cn("flex flex-col items-center justify-center text-center text-pos-ink",y),"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 ${zn}`,role:"presentation"}),t.jsx("p",{className:"text-[1.0625rem] font-semibold",children:k.processing}),$&&t.jsx("p",{className:"mt-2 text-[0.9375rem] font-semibold tabular-nums","data-testid":`${w}-processing-total`,children:$})]})}):t.jsxs("div",{className:c.cn("flex flex-col text-pos-ink",!v&&Fb,y),"aria-live":"polite","data-testid":w,children:[t.jsxs("div",{className:c.cn("text-center",s==="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:Se.changeTitle,"data-testid":`${w}-title`,children:k.title}),t.jsx("p",{className:Se.changeLabel,children:k.changeDue}),t.jsx("p",{className:Se.changeAmount,"data-testid":`${w}-change`,children:xe(d.amount.value,void 0,d.amount.currency)}),d.caption&&t.jsx("p",{className:Se.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:k.title}),$&&t.jsx("p",{className:"my-1 text-[1.875rem] font-semibold tabular-nums","data-testid":`${w}-total`,children:$}),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:k.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:k.paidWithTitle}),o.map((E,j)=>t.jsxs("div",{className:Se.paidRow,"data-testid":`${w}-paid-with-${j}`,children:[E.icon&&t.jsx("span",{className:Se.paidIcon,"aria-hidden":"true",children:t.jsx("span",{className:"flex h-4 w-4",children:t.jsx(P,{icon:E.icon,width:"100%",height:"100%"})})}),t.jsx("span",{className:Se.paidLabel,children:E.label}),t.jsx("span",{className:Se.paidAmount,children:xe(E.amount.value,void 0,E.amount.currency)}),E.status&&t.jsx("span",{className:Se.paidStatus,children:E.status})]},`${E.label}-${j}`))]}),l&&l.length>0&&t.jsxs("div",{className:"mt-5 text-left","data-testid":`${w}-outcome`,children:[t.jsx("p",{className:Zt,children:k.outcomeTitle}),t.jsx("div",{className:Se.groups,children:l.map((E,j)=>t.jsxs("div",{"data-testid":`${w}-outcome-${j}`,children:[t.jsx("p",{className:Se.groupLabel,children:E.label}),t.jsx("ul",{className:Se.groupItems,"aria-label":E.label,children:E.items.map((L,S)=>t.jsx("li",{className:Se.groupItem,children:L},`${L}-${S}`))})]},`${E.label}-${j}`))})]}),a&&t.jsxs("div",{className:"mt-5 text-left",children:[t.jsx("p",{className:Zt,children:k.destinationsTitle}),a.map((E,j)=>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-${j}-${E.status}`,children:[t.jsx("span",{className:"font-semibold",children:E.label}),t.jsxs("div",{className:"flex items-center gap-2.5",children:[t.jsx("span",{className:"tabular-nums text-pos-neutral",children:xe(E.amount.value,void 0,E.amount.currency)}),t.jsx("span",{className:c.cn(Lb,Eb[E.status]),children:E.status==="succeeded"?k.succeeded:k.pending})]})]},`${E.label}-${j}`))]}),x&&x.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:k.sendReceipt}),t.jsx("div",{className:Se.receiptRow,children:x.map(E=>t.jsx(Rb,{action:E,controls:E.expanded?N:void 0,"data-testid":`${w}-receipt-action-${E.key}`},E.key))}),f&&t.jsx(Mb,{id:N,email:f,labels:k,"data-testid":`${w}-email`})]}):m&&t.jsxs("div",{className:"mt-5 text-left",children:[t.jsx("p",{className:Zt,children:k.sendReceipt}),t.jsx("div",{className:"flex flex-col gap-2",children:_b.map(E=>{const j=p?.includes(E)??!1;return t.jsxs("button",{type:"button",role:"checkbox","aria-checked":j,onClick:()=>m(E),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-${E}`,children:[t.jsx("span",{"aria-hidden":"true",className:"pointer-events-none flex",children:t.jsx(c.Checkbox,{isSelected:j,isReadOnly:!0,tabIndex:-1})}),t.jsx("span",{children:k[E]})]},E)})})]}),u&&t.jsx("p",{className:"mt-4 text-[0.78125rem] text-pos-muted","data-testid":`${w}-authorized-by`,children:k.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 ${Ss}`,onPress:b,"data-testid":`${w}-done`,children:k.done})})]})};dc.displayName="OutcomeView";function Rb({action:e,controls:s,"data-testid":n}){return t.jsx(O,{variant:"bordered",color:"default",disableRipple:!0,className:c.cn(Se.receiptAction,e.expanded&&Se.receiptActionExpanded),"aria-expanded":e.expanded,"aria-controls":s,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":n,children:e.label})}function Mb({id:e,email:s,labels:n,"data-testid":a}){const r=s.isSendDisabled??s.emails.length===0;return t.jsxs("div",{id:e,className:Se.emailBox,"data-testid":a,children:[t.jsxs("div",{className:c.cn(Se.chipWrap,s.isInvalid?"border-pos-danger":"border-pos-line"),"data-invalid":s.isInvalid||void 0,"data-testid":`${a}-recipients`,children:[s.emails.map(i=>t.jsxs("span",{className:Se.chip,"data-testid":`${a}-chip`,children:[i,t.jsx(O,{isIconOnly:!0,variant:"light",color:"default",disableRipple:!0,className:Se.chipRemove,"aria-label":n.removeEmail.replace("{email}",i),onPress:()=>s.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":n.emailAriaLabel,placeholder:n.emailPlaceholder,type:"email",value:s.draft,onValueChange:s.onDraftChange,onKeyDown:i=>{i.key==="Enter"&&s.draft.trim()!==""&&(i.preventDefault(),s.onAddEmail(s.draft.trim()))},isInvalid:s.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:Se.send,isDisabled:r,isLoading:s.isSending,onPress:s.onSend,"data-testid":`${a}-send`,children:n.sendEmail})]})}const Ve={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"},Pb="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",Tb="calc(100vw - 1.5rem)",uc=({label:e,value:s,options:n,onChange:a,clearLabel:r,minWidth:i,"data-testid":o="filter-select"})=>{const l=s!==null,d=l?n.find(f=>f.value===s)?.label:void 0,u=h.useRef(null),p=h.useRef(null),[m,x]=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(Ve.base,l&&Ve.baseActive),style:i===void 0?void 0:{"--filter-select-min":mt(i)},children:[t.jsx(it,{"aria-label":e,placeholder:e,size:"sm",variant:"bordered",radius:"md",selectedKeys:s===null?[]:[s],onSelectionChange:f=>{if(f==="all")return;const b=[...f][0];a(b===void 0?null:String(b))},onOpenChange:f=>{f&&x(u.current?.getBoundingClientRect().width)},popoverProps:{ref:p,placement:"bottom-start",style:{minWidth:m,maxWidth:Tb}},"data-testid":`${o}-trigger`,classNames:{base:c.cn(Ve.select,Ve.cell),trigger:c.cn(Ve.trigger,l&&Ve.triggerActive),value:c.cn(Ve.value,l&&Ve.valueActive),selectorIcon:c.cn(l&&Ve.iconActive)},children:n.map(f=>t.jsx(c.SelectItem,{classNames:{title:Ve.optionTitle},children:f.label},f.value))}),t.jsx("span",{"aria-hidden":"true","data-testid":`${o}-sizer`,className:c.cn(Ve.sizer,l&&Ve.sizerActive,Ve.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:Ve.clear,children:t.jsx(P,{icon:"lucide:x",className:Ve.clearIcon,"aria-hidden":"true"})})]})};uc.displayName="FilterSelect";const mc=({children:e,className:s,"data-testid":n="filter-select-group"})=>t.jsx("div",{"data-testid":n,"data-slot":"filter-select-group",className:c.cn(Pb,s),style:{"--filter-select-count":h.Children.toArray(e).length},children:e});mc.displayName="FilterSelectGroup";const ht={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"},fc=({status:e,onLoadMore:s,loadingLabel:n,errorLabel:a,retryLabel:r,endLabel:i,"data-testid":o="load-more-footer"})=>{const l=h.useRef(null),d=h.useRef(s),u=h.useRef(!1);return h.useEffect(()=>{d.current=s},[s]),h.useEffect(()=>{if(e!=="idle"){u.current=!1;return}const p=l.current;if(!p||typeof IntersectionObserver>"u")return;const m=new IntersectionObserver(x=>{u.current||!x.some(f=>f.isIntersecting)||(u.current=!0,d.current())},{rootMargin:"0px 0px 200px 0px"});return m.observe(p),()=>m.disconnect()},[e]),e==="idle"?t.jsx("div",{"data-testid":o,"data-status":"idle",className:ht.idle,children:t.jsx("div",{ref:l,"aria-hidden":"true","data-testid":`${o}-sentinel`,className:ht.sentinel})}):e==="loading"?t.jsxs("div",{"data-testid":o,"data-status":"loading",role:"status","aria-live":"polite",className:ht.base,children:[t.jsx("span",{"aria-hidden":"true",className:ht.spinner,children:t.jsx(c.Spinner,{size:"sm",color:"default"})}),t.jsx("span",{"data-testid":`${o}-loading`,children:n})]}):e==="error"?t.jsxs("div",{"data-testid":o,"data-status":"error",className:ht.base,children:[t.jsx("span",{role:"alert","data-testid":`${o}-error`,className:ht.error,children:a}),t.jsx(O,{size:"sm",color:"default",variant:"bordered",radius:"md",onPress:s,testId:`${o}-retry`,children:r})]}):t.jsx("div",{"data-testid":o,"data-status":"end",className:i?ht.base:ht.idle,children:i&&t.jsx("span",{"data-testid":`${o}-end`,children:i})})};fc.displayName="LoadMoreFooter";const De={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"},Zr=({item:e,withActions:s})=>t.jsxs(t.Fragment,{children:[t.jsxs("span",{className:c.cn(De.headline,s&&De.headlineWithActions),children:[t.jsx("span",{className:De.title,children:e.title}),re(e.amount)&&!s&&t.jsx("span",{className:De.amount,children:e.amount})]}),s?(re(e.chips)||re(e.amount))&&t.jsxs("span",{className:De.chipsLine,children:[re(e.chips)&&t.jsx("span",{className:De.chipsInline,children:e.chips}),re(e.amount)&&t.jsx("span",{className:De.amount,children:e.amount})]}):re(e.chips)&&t.jsx("span",{className:De.chips,children:e.chips}),e.rows&&e.rows.length>0&&t.jsx("span",{className:De.rows,children:e.rows.map((n,a)=>t.jsxs("span",{className:De.row,children:[t.jsx("span",{className:De.rowLabel,children:n.label}),t.jsx("span",{className:De.rowValue,children:n.value})]},a))})]}),pc=({items:e,ariaLabel:s,onSelect:n,loading:a=!1,skeletonCount:r=6,"data-testid":i="card-list"})=>t.jsx("div",{"data-testid":i,className:De.base,children:a?t.jsx("div",{role:"status","aria-busy":"true","aria-label":s,"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:De.skeletonRow,children:[t.jsx("div",{className:js,style:{height:mt(13),width:mt(130)}}),t.jsx("div",{className:js,style:{height:mt(11),width:"70%",marginTop:mt(10)}}),t.jsx("div",{className:js,style:{height:mt(11),width:"45%",marginTop:mt(8)}})]},l))})}):t.jsx("ul",{"aria-label":s,className:De.list,children:e.map(o=>{const l=re(o.actions);return t.jsxs("li",{"data-testid":`${i}-item-${o.id}`,className:De.item,children:[n?t.jsx("button",{type:"button",onClick:()=>n(o.id),className:c.cn(De.card,De.cardInteractive),children:t.jsx(Zr,{item:o,withActions:l})}):t.jsx("div",{className:De.card,children:t.jsx(Zr,{item:o,withActions:l})}),l&&t.jsx("div",{"data-testid":`${i}-item-${o.id}-actions`,className:De.actions,children:o.actions})]},o.id)})})});pc.displayName="CardList";const Ib=48,le={base:`mb-4 overflow-hidden rounded-2xl border border-pos-line bg-white ${qs}`,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"},xc=h.forwardRef((e,s)=>t.jsx("li",{ref:s,...Object.fromEntries(Object.entries(e).filter(([n])=>n!=="data-testid"))}));xc.displayName="CrumbBase";const hc=({breadcrumb:e=[],onBack:s,backLabel:n,title:a,meta:r,amountLabel:i,amount:o,amountCaption:l,recordId:d,chips:u,statItems:p,stats:m,banner:x,"data-testid":f="record-header"})=>{const{ref:b,width:v}=Bt(),g=!us(v,Ib),y=e.length>0||!!s,w=!!(p&&p.length>0),k=!!i||re(o)||re(l)||re(d)||re(u)||w;return t.jsxs("div",{ref:b,"data-testid":f,"data-size":g?"narrow":"wide",className:le.base,children:[y&&t.jsxs("div",{"data-testid":`${f}-band`,className:le.band,children:[s&&t.jsx("button",{type:"button",onClick:s,"aria-label":n,"data-testid":`${f}-back`,className:le.back,children:t.jsx(P,{icon:"lucide:chevron-left",className:le.backIcon,"aria-hidden":"true"})}),t.jsx(c.Breadcrumbs,{separator:"/","data-testid":`${f}-breadcrumb`,classNames:{base:le.breadcrumb,list:le.breadcrumbList},itemClasses:{base:le.crumbBase,item:le.crumb,separator:le.crumbSeparator},children:e.map((N,$)=>t.jsx(c.BreadcrumbItem,{as:xc,"data-testid":`${f}-crumb-${$}`,isDisabled:!N.onClick&&$<e.length-1,onPress:N.onClick?()=>N.onClick?.():void 0,children:N.label},$))})]}),t.jsxs("div",{className:c.cn(le.body,g?le.bodyNarrow:le.bodyWide),children:[t.jsxs("div",{className:le.identity,children:[t.jsx("h1",{"data-testid":`${f}-title`,className:c.cn(le.title,g?le.titleNarrow:le.titleWide),children:a}),r&&r.length>0&&t.jsx("ul",{"data-testid":`${f}-meta`,className:le.meta,children:r.map((N,$)=>t.jsxs("li",{className:le.metaLine,children:[N.icon!=null&&t.jsx("span",{"aria-hidden":"true",className:le.metaIcon,children:N.icon}),t.jsx("span",{className:le.metaText,children:N.text})]},$))})]}),k&&t.jsxs("div",{"data-testid":`${f}-money`,className:c.cn(le.money,g?le.moneyNarrow:le.moneyWide),children:[i&&t.jsx("div",{className:le.amountLabel,children:i}),re(o)&&t.jsx("div",{"data-testid":`${f}-amount`,className:c.cn(le.amount,g?le.amountNarrow:le.amountWide),children:o}),re(l)&&t.jsx("div",{className:le.amountCaption,children:l}),re(d)&&t.jsx("div",{"data-testid":`${f}-record-id`,className:le.recordId,children:d}),re(u)&&t.jsx("div",{"data-testid":`${f}-chips`,className:c.cn(le.chips,g?le.chipsNarrow:le.chipsWide),children:u}),w&&t.jsx("dl",{"data-testid":`${f}-stat-items`,className:le.statItems,children:p?.map((N,$)=>t.jsxs("div",{"data-testid":`${f}-stat-${$}`,className:c.cn(le.stat,g?le.statNarrow:le.statWide),children:[t.jsx("dt",{"data-testid":`${f}-stat-${$}-label`,className:le.statLabel,children:N.label}),t.jsx("dd",{"data-testid":`${f}-stat-${$}-value`,className:le.statValue,style:N.tone?{color:Je[N.tone].fg}:void 0,children:N.value})]},N.id??$))})]})]}),re(m)&&t.jsx("div",{"data-testid":`${f}-stats`,className:g?le.statsNarrow:le.statsWide,children:m}),re(x)&&t.jsx("div",{"data-testid":`${f}-banner`,children:x})]})};hc.displayName="RecordHeader";const Ob=50,Xt={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]"},bc=({children:e,aside:s,"data-testid":n="record-layout"})=>{const{ref:a,width:r}=Bt(),i=re(s),o=i&&r>0&&us(r,Ob),l=t.jsx("div",{"data-testid":`${n}-main`,className:Xt.column,children:e},"main"),d=i?t.jsx("div",{"data-testid":`${n}-aside`,className:Xt.aside,children:s},"aside"):null;return t.jsx("div",{ref:a,"data-testid":n,"data-layout":o?"split":"stacked",className:c.cn(Xt.base,o?Xt.split:Xt.stacked),children:o?[l,d]:[d,l]})};bc.displayName="RecordLayout";const Bb=560,Jt={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"},gc=({items:e,"data-testid":s="stat-tiles"})=>{const{ref:n,width:a}=Bt(),r=a>=Kp?Math.max(e.length,1):a>=Bb?2:1;return t.jsx("div",{ref:n,"data-testid":s,"data-columns":r,className:Jt.base,style:{gridTemplateColumns:`repeat(${r}, minmax(0, 1fr))`},children:e.map((i,o)=>t.jsxs("div",{"data-testid":`${s}-item-${o}`,className:Jt.tile,children:[t.jsx("div",{"data-testid":`${s}-item-${o}-value`,className:Jt.value,style:i.tone?{color:Je[i.tone].fg}:void 0,children:i.value}),t.jsx("div",{"data-testid":`${s}-item-${o}-label`,className:Jt.label,children:i.label}),re(i.caption)&&t.jsx("div",{"data-testid":`${s}-item-${o}-caption`,className:Jt.caption,children:i.caption})]},o))})};gc.displayName="StatTiles";const ut={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"},zb={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]"}},La="pill-tabs",Fa=(e,s=La)=>`${s}-tab-${e}`,_a=(e,s=La)=>`${s}-panel-${e}`,Vb=(e,s=La)=>({role:"tabpanel",id:_a(e,s),"aria-labelledby":Fa(e,s),tabIndex:0}),yc=({items:e,value:s,onChange:n,ariaLabel:a,idPrefix:r,size:i="md","data-testid":o="pill-tabs"})=>{const l=Is(),d=!!c.useProviderContext()?.disableAnimation,u=r??o,p=zb[i];return t.jsx(c.Tabs,{"aria-label":a,variant:"solid",radius:"full",fullWidth:!0,disableAnimation:l||void 0,selectedKey:s,onSelectionChange:m=>n(String(m)),"data-testid":o,"data-size":i,classNames:{base:ut.base,tabList:ut.tabList,cursor:ut.cursor,tab:c.cn(ut.tab,p.tab,(l||d)&&ut.tabStill),tabContent:c.cn(p.tabContent,ut.tabContent)},children:e.map(m=>{const x=m["data-testid"]??`${o}-${m.key}`;return t.jsx(c.Tab,{id:Fa(m.key,u),"aria-controls":_a(m.key,u),"data-testid":x,title:t.jsxs("span",{className:c.cn(ut.title,p.title),children:[re(m.icon)&&t.jsx("span",{"aria-hidden":"true","data-testid":`${x}-icon`,className:c.cn(ut.icon,p.icon),children:m.icon}),m.label,m.count!==void 0&&t.jsx("span",{"data-testid":`${x}-count`,className:c.cn(p.count,ut.count),children:m.count})]})},m.key)})})};yc.displayName="PillTabs";const Ce={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"},Xr=({row:e,testId:s})=>t.jsxs(t.Fragment,{children:[t.jsx("span",{"aria-hidden":"true",className:Ce.dot,style:{backgroundColor:Je[e.tone].fg}}),t.jsxs("span",{className:Ce.body,children:[t.jsx("span",{className:Ce.title,children:e.title}),(e.reference!=null||e.timestamp!=null)&&t.jsxs("span",{className:Ce.meta,children:[e.reference!=null&&t.jsx("span",{className:Ce.reference,children:e.reference}),e.reference!=null&&e.timestamp!=null&&t.jsx("span",{"aria-hidden":"true",className:Ce.separator,children:"·"}),e.timestamp!=null&&t.jsx("span",{className:Ce.timestamp,children:e.timestamp})]}),e.detail!=null&&t.jsx("span",{className:Ce.detail,children:e.detail})]}),t.jsx("span",{className:Ce.trailing,children:e.amount!=null?t.jsx("span",{"data-testid":`${s}-amount`,className:Ce.amount,style:ms(e.amountTone),children:e.amount}):e.note!=null?t.jsx("span",{"data-testid":`${s}-note`,className:Ce.note,style:e.noteTone==="warn"?{color:Je.warn.fg}:void 0,children:e.note}):null})]}),vc=({rows:e,footer:s,emptyContent:n,onSelect:a,"data-testid":r="amount-list"})=>e.length===0?t.jsx("div",{"data-testid":r,className:Ce.base,children:n!=null&&t.jsx("div",{"data-testid":`${r}-empty`,className:Ce.empty,children:n})}):t.jsxs("div",{"data-testid":r,className:Ce.base,children:[t.jsx("ul",{className:Ce.list,children:e.map(i=>{const o=`${r}-row-${i.id}`;return t.jsx("li",{"data-testid":o,className:Ce.item,children:a?t.jsx("button",{type:"button",onClick:()=>a(i.id),className:c.cn(Ce.row,Ce.rowInteractive),children:t.jsx(Xr,{row:i,testId:o})}):t.jsx("div",{className:Ce.row,children:t.jsx(Xr,{row:i,testId:o})})},i.id)})}),s&&t.jsxs(t.Fragment,{children:[t.jsxs("div",{"data-testid":`${r}-footer`,className:Ce.footer,children:[t.jsx("span",{className:Ce.footerLabel,children:s.label}),t.jsx("span",{"data-testid":`${r}-footer-amount`,className:Ce.footerAmount,style:ms(s.amountTone),children:s.amount})]}),s.note!=null&&t.jsx("div",{"data-testid":`${r}-footer-note`,className:Ce.footerNote,children:s.note})]})]});vc.displayName="AmountList";const Ye={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"},jc=({events:e,emptyContent:s,"data-testid":n="activity-timeline"})=>e.length===0?t.jsx("div",{"data-testid":n,children:s!=null&&t.jsx("div",{"data-testid":`${n}-empty`,className:Ye.empty,children:s})}):t.jsx("ol",{"data-testid":n,className:Ye.list,children:e.map((a,r)=>{const i=r===e.length-1,o=`${n}-event-${a.id}`;return t.jsxs("li",{"data-testid":o,className:c.cn(Ye.event,!i&&Ye.eventSpaced),children:[t.jsxs("span",{"aria-hidden":"true",className:Ye.rail,children:[t.jsx("span",{className:Ye.dot,style:{backgroundColor:Je[a.tone].fg}}),!i&&t.jsx("span",{"data-testid":`${o}-connector`,className:Ye.connector})]}),t.jsxs("div",{className:Ye.body,children:[t.jsxs("div",{className:Ye.head,children:[t.jsx("span",{className:Ye.title,children:a.title}),t.jsx("span",{className:Ye.timestamp,children:a.timestamp})]}),re(a.detail)&&t.jsx("div",{className:Ye.detail,children:a.detail}),re(a.actor)&&t.jsx("div",{"data-testid":`${o}-actor`,className:Ye.actor,children:a.actor})]})]},a.id)})});jc.displayName="ActivityTimeline";const Pe={base:`overflow-hidden rounded-2xl border border-pos-line bg-white ${qs}`,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"},Jr=({row:e,testId:s})=>t.jsxs(t.Fragment,{children:[t.jsxs("span",{className:Pe.rowBody,children:[t.jsxs("span",{className:Pe.rowHead,children:[t.jsx("span",{className:e.onSelect?Pe.primaryLinked:Pe.primaryPlain,children:e.primary}),e.chip]}),!!e.secondary&&t.jsx("span",{className:Pe.secondary,children:e.secondary})]}),!!e.amount&&t.jsx("span",{"data-testid":`${s}-amount`,className:Pe.amount,style:ms(e.amountTone),children:e.amount})]}),wc=({title:e,count:s,rows:n,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:Pe.base,children:[o&&t.jsxs("div",{className:Pe.header,children:[t.jsx("h3",{id:i,className:Pe.title,children:e}),s!==void 0&&t.jsx("span",{"data-testid":`${r}-count`,className:Pe.count,children:s})]}),n.length===0?!!a&&t.jsx("div",{"data-testid":`${r}-empty`,className:c.cn(Pe.empty,!o&&Pe.emptyHeadless),children:a}):t.jsx("ul",{className:Pe.list,children:n.map((l,d)=>{const u=`${r}-row-${l.id}`;return t.jsx("li",{"data-testid":u,className:c.cn(Pe.item,d===0&&!o&&Pe.itemFirstHeadless),children:l.onSelect?t.jsx("button",{type:"button",onClick:l.onSelect,className:c.cn(Pe.row,Pe.rowInteractive),children:t.jsx(Jr,{row:l,testId:u})}):t.jsx("div",{className:Pe.row,children:t.jsx(Jr,{row:l,testId:u})})},l.id)})})]})};wc.displayName="RelatedRecordList";const Nc=({title:e,titleAs:s="h2",icon:n,count:a,badge:r,action:i,description:o,footer:l,variant:d="section",body:u="padded",surface:p="card",className:m,children:x,"data-testid":f="record-card"})=>{const b=h.useId(),v=re(e);return t.jsxs("section",{"data-testid":f,"data-variant":d,"data-surface":p,role:v?"group":void 0,"aria-labelledby":v?b:void 0,className:c.cn(dt.base,Rx[p],m),children:[v&&t.jsxs("div",{"data-testid":`${f}-header`,className:Mx[d],children:[re(n)&&t.jsx("span",{"aria-hidden":"true",className:dt.icon,children:n}),t.jsx(s,{id:b,className:dt.title,children:e}),re(a)&&t.jsx("span",{"data-testid":`${f}-count`,className:dt.count,children:a}),r,re(i)&&t.jsx("span",{"data-testid":`${f}-action`,className:dt.action,children:i})]}),t.jsxs("div",{"data-testid":`${f}-body`,className:Px[d][u],children:[re(o)&&t.jsx("p",{"data-testid":`${f}-description`,className:dt.description,children:o}),x,re(l)&&t.jsx("div",{"data-testid":`${f}-footer`,className:c.cn(dt.footer,re(x)?dt.footerAfterContent:dt.footerAfterDescription),children:l})]})]})};Nc.displayName="RecordCard";const Ub={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]"},Cc=({layout:e="stack",className:s,children:n,"data-testid":a="card-stack",...r})=>t.jsx("div",{...r,"data-testid":a,"data-layout":e,className:c.cn(Ub[e],s),children:n});Cc.displayName="CardStack";const vs={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]"},Hb={regular:"py-[0.5625rem]",compact:"py-2"},kc=({rows:e,density:s="regular","data-testid":n="key-value-rows"})=>t.jsx("dl",{"data-testid":n,className:vs.list,children:e.map((a,r)=>t.jsxs("div",{"data-testid":`${n}-row-${a.id??r}`,className:c.cn(vs.row,Hb[s]),children:[t.jsx("dt",{className:vs.label,children:a.label}),t.jsx("dd",{className:vs.value,children:a.value})]},a.id??r))});kc.displayName="KeyValueRows";const st={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"},Sc=({items:e,ariaLabel:s,originalAmountLabel:n,"data-testid":a="line-item-rows"})=>t.jsx("ul",{"aria-label":s,"data-testid":a,className:st.list,children:e.map(r=>{const i=`${a}-item-${r.id}`,o=re(r.originalAmount);return t.jsxs("li",{"data-testid":i,className:st.row,style:r.tone?{backgroundColor:Je[r.tone].bg}:void 0,children:[t.jsxs("div",{className:st.body,children:[t.jsx("div",{className:st.name,children:r.name}),r.details&&r.details.length>0&&t.jsx("div",{"data-testid":`${i}-details`,className:st.details,children:r.details.map((l,d)=>t.jsxs(h.Fragment,{children:[d>0&&t.jsx("span",{"aria-hidden":"true",className:st.separator,children:"·"}),t.jsx("span",{className:st.detail,children:l})]},d))})]}),t.jsxs("div",{className:st.trailing,children:[t.jsxs("span",{className:st.amounts,children:[o&&t.jsxs("s",{"data-testid":`${i}-original`,className:st.original,children:[n&&t.jsxs("span",{className:"sr-only",children:[n," "]}),r.originalAmount]}),t.jsx("span",{"data-testid":`${i}-amount`,className:st.amount,style:o?{color:Je.ok.fg}:void 0,children:r.amount})]}),r.chip]})]},r.id)})});Sc.displayName="LineItemRows";const Wb=37.5,Oe={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"},$c=({rows:e,total:s,memo:n,"data-testid":a="record-totals"})=>{const{ref:r,width:i}=Bt(),o=i>0&&!us(i,Wb),l=o?Oe.rowNarrow:Oe.rowWide,d=o?Oe.labelNarrow:Oe.labelWide,u=o?Oe.noteNarrow:Oe.noteWide;return t.jsxs("div",{ref:r,"data-testid":a,"data-size":o?"narrow":"wide",className:Oe.base,children:[e.map(p=>{const m=`${a}-row-${p.id}`;return t.jsxs("div",{"data-testid":m,className:c.cn(l,Oe.row),children:[t.jsx("span",{"data-testid":`${m}-label`,className:c.cn(d,Oe.label),children:p.label}),t.jsx("span",{"data-testid":`${m}-note`,className:c.cn(u,Oe.note),children:p.note}),t.jsx("span",{"data-testid":`${m}-value`,className:Oe.value,style:ms(p.tone),children:p.value})]},p.id)}),t.jsx("div",{className:Oe.totalRule,children:t.jsxs("div",{"data-testid":`${a}-total`,className:c.cn(l,Oe.totalRow),children:[t.jsx("span",{className:c.cn(d,Oe.totalLabel),children:s.label}),t.jsx("span",{"data-testid":`${a}-total-value`,className:Oe.totalValue,children:s.value})]})}),re(n)&&t.jsx("div",{"data-testid":`${a}-memo`,className:Oe.memo,children:n})]})};$c.displayName="RecordTotals";const On={base:"whitespace-nowrap text-[0.875rem]",secondary:"text-default-500",chipStack:"inline-flex flex-col items-start gap-[0.3125rem]"},qb={text:"text-default-900",reference:"font-normal text-primary",amount:"font-semibold tabular-nums text-default-900"},Ac=({variant:e="text",tone:s,secondary:n,children:a,"data-testid":r="cell-text"})=>t.jsxs("span",{"data-testid":r,className:c.cn(On.base,qb[e]),style:ms(s),children:[a,re(n)&&t.jsxs("span",{"data-testid":`${r}-secondary`,className:On.secondary,children:[t.jsx("span",{"aria-hidden":"true",children:" · "}),n]})]});Ac.displayName="CellText";const Dc=({children:e,"data-testid":s="chip-stack"})=>t.jsx("span",{"data-testid":s,className:On.chipStack,children:e});Dc.displayName="ChipStack";function Ec({testId:e,title:s,description:n}){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:s}),t.jsx("p",{className:"text-default-600 leading-snug",children:n})]})})}Ec.displayName="SessionExpiredCard";exports.ActivityTimeline=jc;exports.AdminFieldLabel=ya;exports.AdminTable=zl;exports.AdminTextField=io;exports.AdminToolbar=Hl;exports.AmountList=vc;exports.AppliedCodeCard=gi;exports.Button=O;exports.CardList=pc;exports.CardStack=Cc;exports.CashTenderForm=Hx;exports.CatalogItemCard=Al;exports.CellText=Ac;exports.CheckTenderForm=No;exports.ChipStack=Dc;exports.CommitmentDetails=Rf;exports.ConfirmDialog=Na;exports.ConfirmationModal=la;exports.ConfirmationPageTemplate=Qu;exports.CustomerCard=Xo;exports.DATE_PICKER_DAY_DEFAULTS=_u;exports.DatePicker=Qn;exports.DensityProvider=pd;exports.DimensionChip=Ws;exports.DiscardGuard=Mo;exports.DonationAmounts=Ji;exports.Drawer=zi;exports.EmptyState=oa;exports.EntityList=xo;exports.EntityListSkeleton=ho;exports.EntityRow=po;exports.ErrorState=ca;exports.EventDetails=Om;exports.EventDetailsTemplate=Xu;exports.ExpandableTable=Vl;exports.ExpireCartTimer=el;exports.FeedbackState=ds;exports.FilterPopover=Rl;exports.FilterSelect=uc;exports.FilterSelectGroup=mc;exports.Footer=im;exports.HeroUIProvider=od;exports.HorizontalSteps=Hi;exports.InlineConfirm=_o;exports.InstallmentFundAssignment=Df;exports.InstallmentFundAssignmentSkeleton=Ff;exports.InstallmentSchedule=Jf;exports.InstallmentScheduleSkeleton=lp;exports.InstallmentTable=up;exports.ItemCard=$l;exports.KeyValueChip=Ws;exports.KeyValueRows=kc;exports.LineItemList=Go;exports.LineItemRows=Sc;exports.ListPanel=yo;exports.LoadMoreFooter=fc;exports.LoadingOverlay=Lo;exports.LoadingState=da;exports.MembershipSelectCards=hp;exports.MetaCard=eb;exports.Modal=os;exports.ModalPanelHeader=Po;exports.ModalPanels=$h;exports.ModalShell=So;exports.ModalShellFooter=Ao;exports.ModalShellHeader=$o;exports.Multiselect=lm;exports.Navbar=Yu;exports.NeedsFixDot=ba;exports.NotesField=ec;exports.Notice=Da;exports.OfferCard=Ds;exports.OfferCardEmpty=tl;exports.OfferCardError=sl;exports.OfferCardList=il;exports.OfferCardSkeleton=nl;exports.OtherTenderForm=Co;exports.OutcomeView=dc;exports.PageHeader=Tl;exports.PaginationSummary=go;exports.PaymentCashChangeBanner=ja;exports.PaymentSubAmountInput=wa;exports.PaymentSuccessView=Fo;exports.PaymentTotalBanner=Eo;exports.PickerRow=co;exports.PillTabs=yc;exports.PinField=cc;exports.ProgramListItem=Dl;exports.RICH_TEXT_PRESETS=Zi;exports.ReasonSelect=Jo;exports.RecordCard=Nc;exports.RecordHeader=hc;exports.RecordLayout=bc;exports.RecordTotals=$c;exports.RedeemCodeInput=Wu;exports.RefundMethodCards=ic;exports.RefundProgressList=oc;exports.RelatedRecordList=wc;exports.RevenueDistributionCard=gl;exports.RevenueDistributionEmpty=yl;exports.RevenueDistributionError=vl;exports.RevenueDistributionSkeleton=jl;exports.RichTextArea=Xi;exports.RowActions=ha;exports.SectionPanel=Zo;exports.Select=it;exports.SessionExpiredCard=Ec;exports.SessionTimeline=Ml;exports.Skeleton=oe;exports.SplitPaymentSummary=ko;exports.SplitTenderPanel=sc;exports.StatTiles=gc;exports.StatusChip=Il;exports.StepPager=Ki;exports.StepProgress=Aa;exports.Stepper=Ui;exports.StepsReadiness=Gi;exports.SuccessState=Ll;exports.Summary=Wo;exports.Table=Zn;exports.TableSkeleton=Ol;exports.TenderMethods=tc;exports.TicketSelection=Bp;exports.TileSelect=Do;exports.TimeField=oo;exports.ToastProvider=md;exports.Toggle=Fl;exports.ToolbarButton=Wl;exports.UnderlineTabs=ql;exports.VerticalSteps=qi;exports.WizardShell=qo;exports.adminFieldErrorClass=ao;exports.adminFieldHelpButtonClass=Zl;exports.adminFieldHelpContentClass=Jl;exports.adminFieldHelpIconClass=Xl;exports.adminFieldHintClass=no;exports.adminFieldLabelClass=ga;exports.adminFieldLabelNoAutoMarkClass=Ql;exports.adminFieldLabelRowClass=Yl;exports.adminFieldLabelSuffixClass=Gl;exports.adminFieldRequiredClass=Kl;exports.adminInputClass=to;exports.adminInputReadOnlyClass=so;exports.adminInputWrapperClass=eo;exports.adminRowClass=pa;exports.adminSurfaceCss=ld;exports.adminSurfaceTokens=ls;exports.adminTableClass=xa;exports.adminTableFooterClass=Bl;exports.adminTdClass=fa;exports.adminThClass=ma;exports.calculateAllocationDifference=gf;exports.computeChange=An;exports.currencyFractionDigits=Ot;exports.firstNeedsFixKey=ux;exports.formatMoney=xe;exports.formatOfferCurrency=En;exports.formatRevenueAmount=pf;exports.formatRevenueCurrency=xf;exports.generateAutomaticInstallments=Cl;exports.generateDistributionId=ia;exports.getCurrencySymbol=hf;exports.offerCardVariants=rl;exports.offerListVariants=al;exports.pageRange=bo;exports.parseOfferCurrency=Bm;exports.parseRevenueCurrency=bf;exports.parseTimeInput=Pn;exports.pillTabId=Fa;exports.pillTabPanelId=_a;exports.pillTabPanelProps=Vb;exports.posSurfaceTokens=de;exports.roundToCurrency=Xn;exports.useControlSize=fd;exports.useDensity=Os;exports.useDiscardGuard=Eh;exports.useDiscardGuardActions=xh;exports.useModalPanel=bh;exports.useModalPanels=Dh;exports.useReportUnsavedChanges=ph;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)}})();
|