@veevarts/design-system 2.0.0-alpha.61 → 2.0.0-alpha.63
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +10 -1
- package/dist/assistant.cjs +2 -1
- package/dist/assistant.d.ts +10 -0
- package/dist/assistant.js +1046 -389
- package/dist/index.cjs +6 -6
- package/dist/index.js +4047 -3950
- package/dist/patterns/ActionsMenu/ActionsMenu.d.ts +3 -0
- package/dist/patterns/ActionsMenu/icons.d.ts +2 -0
- package/dist/patterns/ActionsMenu/index.d.ts +2 -0
- package/dist/patterns/ActionsMenu/styles.d.ts +20 -0
- package/dist/patterns/ActionsMenu/types.d.ts +35 -0
- package/dist/patterns/ArtifactCard/ArtifactCard.d.ts +19 -0
- package/dist/patterns/ArtifactCard/index.d.ts +2 -0
- package/dist/patterns/ArtifactCard/styles.d.ts +31 -0
- package/dist/patterns/ArtifactCard/types.d.ts +36 -0
- package/dist/patterns/AssistantMarkdown/AssistantMarkdown.d.ts +17 -0
- package/dist/patterns/AssistantMarkdown/index.d.ts +3 -0
- package/dist/patterns/AssistantMarkdown/links.d.ts +43 -0
- package/dist/patterns/AssistantMarkdown/parser.d.ts +5 -0
- package/dist/patterns/AssistantMarkdown/styles.d.ts +39 -0
- package/dist/patterns/AssistantMarkdown/types.d.ts +48 -0
- package/dist/patterns/CitationMarker/CitationMarker.d.ts +16 -0
- package/dist/patterns/CitationMarker/index.d.ts +2 -0
- package/dist/patterns/CitationMarker/styles.d.ts +19 -0
- package/dist/patterns/CitationMarker/types.d.ts +13 -0
- package/dist/patterns/SourceList/SourceList.d.ts +14 -0
- package/dist/patterns/SourceList/index.d.ts +2 -0
- package/dist/patterns/SourceList/styles.d.ts +20 -0
- package/dist/patterns/SourceList/types.d.ts +32 -0
- package/dist/patterns/SourcePill/SourcePill.d.ts +13 -0
- package/dist/patterns/SourcePill/index.d.ts +2 -0
- package/dist/patterns/SourcePill/styles.d.ts +19 -0
- package/dist/patterns/SourcePill/types.d.ts +20 -0
- package/dist/patterns/index.d.ts +2 -0
- package/package.json +3 -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"),o=require("@heroui/react"),h=require("react"),p=require("./hasContent-JfCtoDIu.cjs"),J=require("lucide-react"),ze=require("framer-motion"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),o=require("@heroui/react"),h=require("react"),p=require("./hasContent-JfCtoDIu.cjs"),J=require("lucide-react"),ze=require("framer-motion"),ys=require("@tiptap/react"),un=require("@tiptap/core"),To=require("@tiptap/extension-bold"),Oo=require("@tiptap/extension-italic"),zo=require("@tiptap/extension-strike"),Vo=require("@tiptap/extension-underline"),Uo=require("@tiptap/extension-code"),Ho=require("@tiptap/extension-color"),Wo=require("@tiptap/extension-highlight"),qo=require("@tiptap/extension-link"),Go=require("@tiptap/extension-text-style"),Ko=require("@tiptap/extension-heading"),Yo=require("@tiptap/extension-paragraph"),Zo=require("@tiptap/extension-bullet-list"),Qo=require("@tiptap/extension-ordered-list"),Xo=require("@tiptap/extension-task-list"),Jo=require("@tiptap/extension-task-item"),ec=require("@tiptap/extension-list-item"),tc=require("@tiptap/extension-code-block"),ac=require("@tiptap/extension-blockquote"),sc=require("@tiptap/extension-horizontal-rule"),nc=require("@tiptap/extension-hard-break"),mn=require("@tiptap/extension-history"),rc=require("@tiptap/extension-text-align"),ic=require("@tiptap/extension-document"),lc=require("@tiptap/extension-text"),oc=require("@tiptap/extension-dropcursor"),cc=require("@tiptap/extension-gapcursor"),Ae={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"},info:{100:"#dbeafe",200:"#bfdbfe",300:"#93c5fd",400:"#60a5fa",500:"#2563EB",600:"#1d4ed8",800:"#1e3a8a",900:"#172554"}}},pe={xs:"0.25rem",sm:"0.5rem",md:"1rem",lg:"1.5rem",xl:"2rem"},ye={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:na}=Ae.neutral,dc=Ae.palettes.warning[700],uc=Ae.palettes.warning[100],dt={rustFill:"#FBEBE4",rustBorder:"#EBC3B1",page:"#F6F7F8",border:"#E7E9EC",hair:"#EEF0F2",okFill:"#E6F4EF",dangerFill:"#FBEAE8",infoFill:"#E8EEFC"},Jt={"--rust":Ae.brand.primary[500],"--rust-fill":dt.rustFill,"--rust-border":dt.rustBorder,"--page":dt.page,"--surface":Ae.neutral.white,"--border":dt.border,"--hair":dt.hair,"--ink":na[900],"--ink2":na[700],"--sub":na[500],"--muted":na[400],"--ok":Ae.semantic.success,"--ok-fill":dt.okFill,"--warn":dc,"--warn-fill":uc,"--danger":Ae.semantic.danger,"--danger-fill":dt.dangerFill,"--info":Ae.semantic.info,"--info-fill":dt.infoFill};Object.fromEntries(Object.entries(Jt).map(([e,a])=>[e.replace(/^--/,""),a]));function mc({scope:e=".acct",fontFamily:a="'NeueMontreal', system-ui, sans-serif"}={}){const s=Object.entries(Jt).map(([r,i])=>` ${r}: ${i};`).join(`
|
|
2
2
|
`),n=a?`
|
|
3
3
|
font-family: ${a};
|
|
4
4
|
color: var(--ink);`:"";return`${e} {
|
|
5
5
|
${s}${n}
|
|
6
6
|
}
|
|
7
|
-
`}const le={line:"#E7E7E9","line-2":"#F1F1F3",hair:"#F0F0F1",page:"#FBFBFB",field:"#E5E5E5","line-strong":"#D4D4D8",ink:"#18181B",muted:"#71717A",faint:"#A1A1AA","ok-fill":"#EAF3DE",ok:"#3B6D11","warn-fill":"#FAEEDA",warn:"#854F0B","warn-icon":"#EFD9B2","danger-fill":"#FCEBEB",danger:Ae.semantic.danger,"danger-icon":"#F3D3CF","info-fill":"#EAF1FC",info:"#1D4FA8","violet-fill":"#F1ECFB",violet:"#6D28D9","neutral-fill":"#F4F4F5",neutral:"#52525B",destructive:"#A32D2D"};({...le});const ut=Ae.palettes.info,na={light:{content1:"#ffffff",content2:"#f4f4f5"},dark:{content1:"#18181b",content2:"#27272a"}},yr=["accent","fill","border","user-bubble","assistant-bubble","focus"],ys={light:{accent:ut[600],fill:ut[100],border:ut[200],"user-bubble":na.light.content2,"assistant-bubble":na.light.content1,focus:ut[500]},dark:{accent:ut[300],fill:ut[900],border:ut[800],"user-bubble":na.dark.content2,"assistant-bubble":na.dark.content1,focus:ut[400]}};function vr(e){if(!/^#[0-9a-f]{6}$/i.test(e))throw new Error(`bad hex: ${e}`);return[1,3,5].map(a=>parseInt(e.slice(a,a+2),16)).join(" ")}const jr=e=>`--ai-${e}`,mn=e=>Object.fromEntries(yr.map(a=>[jr(a),vr(ys[e][a])])),fn={light:':root, .light, [data-theme="light"]',dark:".dark"};fn.light+"",mn("light"),fn.dark+"",mn("dark");Object.fromEntries(yr.map(e=>[e,`rgb(var(${jr(e)}, ${vr(ys.light[e])}) / <alpha-value>)`]));function uc({children:e,closeLabel:a,locale:s,reducedMotion:n="user"}){const r=p.useCloseLabel();return t.jsx(o.HeroUIProvider,{locale:s,reducedMotion:n,children:t.jsx(p.CloseLabelContext.Provider,{value:a??r,children:e})})}const mc="whitespace-normal overflow-visible text-clip break-words",Mt={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:`${mc} me-0`,description:"me-0"};function fc(e){return{...e,base:o.cn(Mt.base,e?.base),closeButton:o.cn(Mt.closeButton,e?.closeButton),closeIcon:o.cn(Mt.closeIcon,e?.closeIcon),title:o.cn(Mt.title,e?.title),description:o.cn(Mt.description,e?.description)}}function xc({toastProps:e,disableAnimation:a,...s}){const n=p.useReducedMotion();return t.jsx(o.ToastProvider,{...s,disableAnimation:a??(n||void 0),toastProps:{...e,classNames:fc(e?.classNames)}})}const wr=h.createContext("default");function ka(){return h.useContext(wr)}function pc(e){return ka()==="touch"?"lg":e}function hc({density:e,children:a}){return t.jsx(wr.Provider,{value:e,children:a})}function Nr({code:e,amount:a,onRemove:s,label:n="Gift Card",removeAriaLabel:r="Remove gift card",testId:i="veevart-applied-code-card"}){return t.jsx(o.Card,{"data-testid":i,shadow:"sm",className:"w-full",children:t.jsxs(o.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:n}),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:a})]}),t.jsx(p.Button,{testId:`${i}-remove`,isIconOnly:!0,size:"sm",variant:"light","aria-label":r,onPress:s,children:t.jsx(p.Icon,{icon:"solar:close-circle-linear",className:"size-4","aria-hidden":"true"})})]})})}function Ma(e,a){return e-a*Math.floor(e/a)}const Cr=1721426;function ra(e,a,s,n){a=vs(e,a);let r=a-1,i=-2;return s<=2?i=0:ma(a)&&(i=-1),Cr-1+365*r+Math.floor(r/4)-Math.floor(r/100)+Math.floor(r/400)+Math.floor((367*s-362)/12+i+n)}function ma(e){return e%4===0&&(e%100!==0||e%400===0)}function vs(e,a){return e==="BC"?1-a:a}function bc(e){let a="AD";return e<=0&&(a="BC",e=1-e),[a,e]}const gc={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 Sa{fromJulianDay(a){let s=a,n=s-Cr,r=Math.floor(n/146097),i=Ma(n,146097),c=Math.floor(i/36524),l=Ma(i,36524),d=Math.floor(l/1461),u=Ma(l,1461),x=Math.floor(u/365),m=r*400+c*100+d*4+x+(c!==4&&x!==4?1:0),[b,f]=bc(m),g=s-ra(b,f,1,1),j=2;s<ra(b,f,3,1)?j=0:ma(f)&&(j=1);let y=Math.floor(((g+j)*12+373)/367),v=s-ra(b,f,y,1)+1;return new Yt(b,f,y,v)}toJulianDay(a){return ra(a.era,a.year,a.month,a.day)}getDaysInMonth(a){return gc[ma(a.year)?"leapyear":"standard"][a.month-1]}getMonthsInYear(a){return 12}getDaysInYear(a){return ma(a.year)?366:365}getMaximumMonthsInYear(){return 12}getMaximumDaysInMonth(){return 31}getYearsInEra(a){return 9999}getEras(){return["BC","AD"]}isInverseEra(a){return a.era==="BC"}balanceDate(a){a.year<=0&&(a.era=a.era==="BC"?"AD":"BC",a.year=1-a.year)}constructor(){this.identifier="gregory"}}function yc(e,a){var s,n,r,i;return(i=(r=(s=e.isEqual)===null||s===void 0?void 0:s.call(e,a))!==null&&r!==void 0?r:(n=a.isEqual)===null||n===void 0?void 0:n.call(a,e))!==null&&i!==void 0?i:e.identifier===a.identifier}function kr(e,a){return e.calendar.toJulianDay(e)-a.calendar.toJulianDay(a)}function Sr(e,a){return xn(e)-xn(a)}function xn(e){return e.hour*36e5+e.minute*6e4+e.second*1e3+e.millisecond}let Ba=null;function $r(){return Ba==null&&(Ba=new Intl.DateTimeFormat().resolvedOptions().timeZone),Ba}function pn(e){e=js(e,new Sa);let a=vs(e.era,e.year);return Ar(a,e.month,e.day,e.hour,e.minute,e.second,e.millisecond)}function Ar(e,a,s,n,r,i,c){let l=new Date;return l.setUTCHours(n,r,i,c),l.setUTCFullYear(e,a-1,s),l.getTime()}function hn(e,a){if(a==="UTC")return 0;if(e>0&&a===$r())return new Date(e).getTimezoneOffset()*-6e4;let{year:s,month:n,day:r,hour:i,minute:c,second:l}=Dr(e,a);return Ar(s,n,r,i,c,l,0)-Math.floor(e/1e3)*1e3}const bn=new Map;function Dr(e,a){let s=bn.get(a);s||(s=new Intl.DateTimeFormat("en-US",{timeZone:a,hour12:!1,era:"short",year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric"}),bn.set(a,s));let n=s.formatToParts(new Date(e)),r={};for(let i of n)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 gn=864e5;function vc(e,a,s,n){return(s===n?[s]:[s,n]).filter(i=>jc(e,a,i))}function jc(e,a,s){let n=Dr(s,a);return e.year===n.year&&e.month===n.month&&e.day===n.day&&e.hour===n.hour&&e.minute===n.minute&&e.second===n.second}function wc(e,a,s="compatible"){let n=Lr(e);if(a==="UTC")return pn(n);if(a===$r()&&s==="compatible"){n=js(n,new Sa);let d=new Date,u=vs(n.era,n.year);return d.setFullYear(u,n.month-1,n.day),d.setHours(n.hour,n.minute,n.second,n.millisecond),d.getTime()}let r=pn(n),i=hn(r-gn,a),c=hn(r+gn,a),l=vc(n,a,r-i,r-c);if(l.length===1)return l[0];if(l.length>1)switch(s){case"compatible":case"earlier":return l[0];case"later":return l[l.length-1];case"reject":throw new RangeError("Multiple possible absolute times found")}switch(s){case"earlier":return Math.min(r-i,r-c);case"compatible":case"later":return Math.max(r-i,r-c);case"reject":throw new RangeError("No such absolute time found")}}function Er(e,a,s="compatible"){return new Date(wc(e,a,s))}function Lr(e,a){let s=0,n=0,r=0,i=0;if("timeZone"in e)({hour:s,minute:n,second:r,millisecond:i}=e);else if("hour"in e&&!a)return e;return a&&({hour:s,minute:n,second:r,millisecond:i}=a),new pa(e.calendar,e.era,e.year,e.month,e.day,s,n,r,i)}function js(e,a){if(yc(e.calendar,a))return e;let s=a.fromJulianDay(e.calendar.toJulianDay(e)),n=e.copy();return n.calendar=a,n.era=s.era,n.year=s.year,n.month=s.month,n.day=s.day,Ft(n),n}function ws(e,a){let s=e.copy(),n="hour"in s?Pr(s,a):0;ss(s,a.years||0),s.calendar.balanceYearMonth&&s.calendar.balanceYearMonth(s,e),s.month+=a.months||0,ns(s),Fr(s),s.day+=(a.weeks||0)*7,s.day+=a.days||0,s.day+=n,Nc(s),s.calendar.balanceDate&&s.calendar.balanceDate(s),s.year<1&&(s.year=1,s.month=1,s.day=1);let r=s.calendar.getYearsInEra(s);if(s.year>r){var i,c;let d=(i=(c=s.calendar).isInverseEra)===null||i===void 0?void 0:i.call(c,s);s.year=r,s.month=d?1:s.calendar.getMonthsInYear(s),s.day=d?1:s.calendar.getDaysInMonth(s)}s.month<1&&(s.month=1,s.day=1);let l=s.calendar.getMonthsInYear(s);return s.month>l&&(s.month=l,s.day=s.calendar.getDaysInMonth(s)),s.day=Math.max(1,Math.min(s.calendar.getDaysInMonth(s),s.day)),s}function ss(e,a){var s,n;!((s=(n=e.calendar).isInverseEra)===null||s===void 0)&&s.call(n,e)&&(a=-a),e.year+=a}function ns(e){for(;e.month<1;)ss(e,-1),e.month+=e.calendar.getMonthsInYear(e);let a=0;for(;e.month>(a=e.calendar.getMonthsInYear(e));)e.month-=a,ss(e,1)}function Nc(e){for(;e.day<1;)e.month--,ns(e),e.day+=e.calendar.getDaysInMonth(e);for(;e.day>e.calendar.getDaysInMonth(e);)e.day-=e.calendar.getDaysInMonth(e),e.month++,ns(e)}function Fr(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 Ft(e){e.calendar.constrainDate&&e.calendar.constrainDate(e),e.year=Math.max(1,Math.min(e.calendar.getYearsInEra(e),e.year)),Fr(e)}function _r(e){let a={};for(let s in e)typeof e[s]=="number"&&(a[s]=-e[s]);return a}function Rr(e,a){return ws(e,_r(a))}function Ir(e,a){let s=e.copy();return a.era!=null&&(s.era=a.era),a.year!=null&&(s.year=a.year),a.month!=null&&(s.month=a.month),a.day!=null&&(s.day=a.day),Ft(s),s}function Mr(e,a){let s=e.copy();return a.hour!=null&&(s.hour=a.hour),a.minute!=null&&(s.minute=a.minute),a.second!=null&&(s.second=a.second),a.millisecond!=null&&(s.millisecond=a.millisecond),Br(s),s}function Cc(e){e.second+=Math.floor(e.millisecond/1e3),e.millisecond=ia(e.millisecond,1e3),e.minute+=Math.floor(e.second/60),e.second=ia(e.second,60),e.hour+=Math.floor(e.minute/60),e.minute=ia(e.minute,60);let a=Math.floor(e.hour/24);return e.hour=ia(e.hour,24),a}function Br(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 ia(e,a){let s=e%a;return s<0&&(s+=a),s}function Pr(e,a){return e.hour+=a.hours||0,e.minute+=a.minutes||0,e.second+=a.seconds||0,e.millisecond+=a.milliseconds||0,Cc(e)}function Tr(e,a){let s=e.copy();return Pr(s,a),s}function kc(e,a){return Tr(e,_r(a))}function Or(e,a,s,n){let r=e.copy();switch(a){case"era":{let l=e.calendar.getEras(),d=l.indexOf(e.era);if(d<0)throw new Error("Invalid era: "+e.era);d=ft(d,s,0,l.length-1,n?.round),r.era=l[d],Ft(r);break}case"year":var i,c;!((i=(c=r.calendar).isInverseEra)===null||i===void 0)&&i.call(c,r)&&(s=-s),r.year=ft(e.year,s,-1/0,9999,n?.round),r.year===-1/0&&(r.year=1),r.calendar.balanceYearMonth&&r.calendar.balanceYearMonth(r,e);break;case"month":r.month=ft(e.month,s,1,e.calendar.getMonthsInYear(e),n?.round);break;case"day":r.day=ft(e.day,s,1,e.calendar.getDaysInMonth(e),n?.round);break;default:throw new Error("Unsupported field "+a)}return e.calendar.balanceDate&&e.calendar.balanceDate(r),Ft(r),r}function zr(e,a,s,n){let r=e.copy();switch(a){case"hour":{let i=e.hour,c=0,l=23;if(n?.hourCycle===12){let d=i>=12;c=d?12:0,l=d?23:11}r.hour=ft(i,s,c,l,n?.round);break}case"minute":r.minute=ft(e.minute,s,0,59,n?.round);break;case"second":r.second=ft(e.second,s,0,59,n?.round);break;case"millisecond":r.millisecond=ft(e.millisecond,s,0,999,n?.round);break;default:throw new Error("Unsupported field "+a)}return r}function ft(e,a,s,n,r=!1){if(r){e+=Math.sign(a),e<s&&(e=n);let i=Math.abs(a);a>0?e=Math.ceil(e/i)*i:e=Math.floor(e/i)*i,e>n&&(e=s)}else e+=a,e<s?e=n-(s-e-1):e>n&&(e=s+(e-n-1));return e}const Sc=/^([+-]\d{6}|\d{4})-(\d{2})-(\d{2})$/,$c=/^([+-]\d{6}|\d{4})-(\d{2})-(\d{2})(?:T(\d{2}))?(?::(\d{2}))?(?::(\d{2}))?(\.\d+)?(?:(?:([+-]\d{2})(?::?(\d{2}))?)|Z)$/;function Ac(e){let a=e.match(Sc);if(!a)throw $c.test(e)?new Error(`Invalid ISO 8601 date string: ${e}. Use parseAbsolute() instead.`):new Error("Invalid ISO 8601 date string: "+e);let s=new Yt(Pa(a[1],0,9999),Pa(a[2],1,12),1);return s.day=Pa(a[3],1,s.calendar.getDaysInMonth(s)),s}function Pa(e,a,s){let n=Number(e);if(n<a||n>s)throw new RangeError(`Value out of range: ${a} <= ${n} <= ${s}`);return n}function Vr(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 Ur(e){let a=js(e,new Sa),s;return a.era==="BC"?s=a.year===1?"0000":"-"+String(Math.abs(1-a.year)).padStart(6,"00"):s=String(a.year).padStart(4,"0"),`${s}-${String(a.month).padStart(2,"0")}-${String(a.day).padStart(2,"0")}`}function Dc(e){return`${Ur(e)}T${Vr(e)}`}function Ec(e,a){if(a.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function Ns(e,a,s){Ec(e,a),a.set(e,s)}function Hr(e){let a=typeof e[0]=="object"?e.shift():new Sa,s;if(typeof e[0]=="string")s=e.shift();else{let c=a.getEras();s=c[c.length-1]}let n=e.shift(),r=e.shift(),i=e.shift();return[a,s,n,r,i]}var Lc=new WeakMap;class Yt{copy(){return this.era?new Yt(this.calendar,this.era,this.year,this.month,this.day):new Yt(this.calendar,this.year,this.month,this.day)}add(a){return ws(this,a)}subtract(a){return Rr(this,a)}set(a){return Ir(this,a)}cycle(a,s,n){return Or(this,a,s,n)}toDate(a){return Er(this,a)}toString(){return Ur(this)}compare(a){return kr(this,a)}constructor(...a){Ns(this,Lc,{writable:!0,value:void 0});let[s,n,r,i,c]=Hr(a);this.calendar=s,this.era=n,this.year=r,this.month=i,this.day=c,Ft(this)}}var Fc=new WeakMap;class $a{copy(){return new $a(this.hour,this.minute,this.second,this.millisecond)}add(a){return Tr(this,a)}subtract(a){return kc(this,a)}set(a){return Mr(this,a)}cycle(a,s,n){return zr(this,a,s,n)}toString(){return Vr(this)}compare(a){return Sr(this,a)}constructor(a=0,s=0,n=0,r=0){Ns(this,Fc,{writable:!0,value:void 0}),this.hour=a,this.minute=s,this.second=n,this.millisecond=r,Br(this)}}var _c=new WeakMap;class pa{copy(){return this.era?new pa(this.calendar,this.era,this.year,this.month,this.day,this.hour,this.minute,this.second,this.millisecond):new pa(this.calendar,this.year,this.month,this.day,this.hour,this.minute,this.second,this.millisecond)}add(a){return ws(this,a)}subtract(a){return Rr(this,a)}set(a){return Ir(Mr(this,a),a)}cycle(a,s,n){switch(a){case"era":case"year":case"month":case"day":return Or(this,a,s,n);default:return zr(this,a,s,n)}}toDate(a,s){return Er(this,a,s)}toString(){return Dc(this)}compare(a){let s=kr(this,a);return s===0?Sr(this,Lr(a)):s}constructor(...a){Ns(this,_c,{writable:!0,value:void 0});let[s,n,r,i,c]=Hr(a);this.calendar=s,this.era=n,this.year=r,this.month=i,this.day=c,this.hour=a.shift()||0,this.minute=a.shift()||0,this.second=a.shift()||0,this.millisecond=a.shift()||0,Ft(this)}}const Rc={firstDayOfWeek:"mon",showMonthAndYearPickers:!0,markToday:!0},Ic="data-[today=true]:font-semibold data-[today=true]:ring-1 data-[today=true]:ring-inset data-[today=true]:ring-primary",Mc="Open time options",Bc=320;function rs(e,a){return typeof a=="string"&&a.length>0?`${e} ${a}`:e}function yn(e,a){return a?{...e,classNames:{...e?.classNames,cellButton:rs(Ic,e?.classNames?.cellButton)}}:e}function Ta(e){if(!e)return null;const a="hour"in e&&typeof e.hour=="number"?e.hour:0,s="minute"in e&&typeof e.minute=="number"?e.minute:0,n="second"in e&&typeof e.second=="number"?e.second:0;return new $a(a,s,n)}function Pc(e,a){const s=new Date(2e3,0,1,e.hour,e.minute,e.second);return new Intl.DateTimeFormat("en-US",{hour:"numeric",minute:"2-digit",hour12:a===12}).format(s)}function Tc(e){const a=[];for(let s=0;s<24;s+=1)for(let n=0;n<60;n+=e)a.push(new $a(s,n));return a}function Oc(e){const{minuteStep:a=15,timeListClassName:s,timeListLabel:n=Mc,selectorButtonProps:r,endContent:i,onChange:c,value:l,defaultValue:d,hourCycle:u=12,...x}=e,m=l!==void 0,[b,f]=h.useState(()=>Ta(d)),g=m?Ta(l):b,j=h.useMemo(()=>Tc(a),[a]),y=C=>{m||f(C),c?.(C)},v=t.jsxs(o.Popover,{placement:"bottom-end",children:[t.jsx(o.PopoverTrigger,{children:t.jsx(o.Button,{isIconOnly:!0,variant:"light","aria-label":n,...r,onPress:void 0,children:t.jsx(J.Clock3,{className:"size-4",strokeWidth:1.75})})}),t.jsx(o.PopoverContent,{className:"min-w-[8.5rem] p-0",children:t.jsx(o.ScrollShadow,{className:s??"max-h-64 py-1",children:t.jsx("div",{className:"flex flex-col p-1",children:j.map(C=>{const S=g?.hour===C.hour&&g?.minute===C.minute;return t.jsx(o.Button,{variant:S?"flat":"light",color:S?"primary":"default",className:"h-9 min-w-0 justify-start px-3",onPress:()=>y(C),children:Pc(C,u)},`${C.hour}:${C.minute}`)})})})})]});return t.jsx(o.TimeInput,{...x,value:m?g:void 0,defaultValue:m?void 0:d,hourCycle:u,endContent:t.jsxs("div",{className:"flex items-center gap-1",children:[i,v]}),onChange:C=>y(Ta(C))})}function Cs(e){if(e.mode==="time")return t.jsx(Oc,{...e});if(e.mode==="datetime"){const{mode:c,granularity:l="minute",hideTimeZone:d=!0,calendarWidth:u=Bc,disableAnimation:x=!0,classNames:m,markToday:b,calendarProps:f,...g}=e;return t.jsx(o.DatePicker,{...g,calendarProps:yn(f,b),calendarWidth:u,classNames:{...m,popoverContent:rs("min-w-[20rem]",m?.popoverContent),calendarContent:rs("min-h-[18rem]",m?.calendarContent)},disableAnimation:x,granularity:l,hideTimeZone:d})}const{mode:a,granularity:s="day",markToday:n,calendarProps:r,...i}=e;return t.jsx(o.DatePicker,{...i,calendarProps:yn(r,n),granularity:s})}function zc({state:e,onSubmit:a,onRemove:s,appliedCredit:n,errorMessage:r,label:i="Gift Card",placeholder:c="GC-XXXX-XXXX-XXXX",applyLabel:l="Apply",removeAriaLabel:d="Remove gift card",testId:u="veevart-redeem-code-input"}){const[x,m]=h.useState(""),b=h.useId(),[f,g]=h.useState(e);e!==f&&(g(e),e==="applied"&&m(""));const j=()=>{const C=x.trim();C&&a(C)},y=C=>{C.key==="Enter"&&(C.preventDefault(),j())};if(e==="applied"&&n)return t.jsx("div",{"data-testid":u,children:t.jsx(Nr,{code:n.code,amount:n.amount,onRemove:s,removeAriaLabel:d,testId:`${u}-card`})});const v=e==="error"&&r!=null;return t.jsxs("div",{"data-testid":u,className:"flex flex-col gap-1",children:[t.jsxs("div",{className:"flex items-end gap-2",children:[t.jsx(o.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:c,value:x,onValueChange:m,onKeyDown:y,isDisabled:e==="loading",isInvalid:e==="error","aria-describedby":v?b:void 0}),t.jsx(p.Button,{testId:`${u}-button`,isLoading:e==="loading",isDisabled:!x.trim(),onPress:j,children:l})]}),v&&t.jsx("p",{id:b,"data-testid":`${u}-error`,className:"text-tiny text-danger",children:r})]})}const Vc={login:"Login",logout:"Logout",selectLanguage:"Select your language"};function Uc({languages:e,selectedLanguage:a,onLanguageChange:s,label:n}){const r=e.find(i=>i.code===a);return t.jsx("div",{className:"flex items-center",children:t.jsxs("div",{className:"relative flex items-center",children:[t.jsx(p.Select,{"data-testid":"language-select-desktop",variant:"bordered","aria-label":n,selectedKeys:a?[a]:[],onSelectionChange:i=>{const c=Array.from(i)[0]||a;s?.(c)},className:"min-w-36 hidden md:inline-flex",isDisabled:e.length===0,placeholder:n,startContent:t.jsx(J.Globe,{className:"w-5 h-5 text-black"}),renderValue:()=>t.jsx("span",{children:r?.label||n}),size:"md",radius:"full",children:e.map(i=>t.jsx(o.SelectItem,{textValue:i.label,"data-testid":`language-select-option-${i.code}`,children:i.label},i.code))}),t.jsx(p.Select,{"aria-label":n,"data-testid":"language-select-mobile",variant:"bordered",selectedKeys:a?[a]:[],onSelectionChange:i=>{const c=Array.from(i)[0]||a;s?.(c)},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(o.SelectItem,{textValue:i.code.toUpperCase(),"data-testid":`language-select-option-mobile-${i.code}`,children:i.code.toUpperCase()},i.code))})]})})}function Hc({isLoggedIn:e,onLogin:a,onLogout:s,labels:n}){return e?t.jsxs(p.Button,{"data-testid":"navbar-auth-button",className:"px-2 py-1 w-1 min-w-12 md:min-w-24 rounded-full bg-black text-white text-sm flex items-center",onPress:s,size:"md",children:[t.jsx(J.User,{className:"inline w-5 h-5"}),t.jsx("span",{className:"hidden md:inline",children:n.logout})]}):t.jsxs(p.Button,{"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:a,size:"md",children:[t.jsx(J.User,{className:"inline w-5 h-5"}),t.jsx("span",{className:"hidden md:inline",children:n.login})]})}function Wc({logo:e,languages:a=[],selectedLanguage:s,onLanguageChange:n,isLoggedIn:r,onLogin:i,onLogout:c,hasLanguages:l,hasAuth:d,labels:u={},className:x}){const m={...Vc,...u};return t.jsxs("nav",{"data-testid":"navbar",className:o.cn("w-full px-4 md:px-8 py-3 bg-white border-b border-zinc-100 flex items-center justify-between",x),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||a.length>0)&&t.jsx(Uc,{languages:a,selectedLanguage:s,onLanguageChange:n,label:m.selectLanguage}),d&&t.jsx(Hc,{isLoggedIn:r,onLogin:i,onLogout:c,labels:m})]})]})}function qc(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(o.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 Oa;const Gc=typeof document<"u"?(Oa=h.useInsertionEffect)!==null&&Oa!==void 0?Oa:h.useLayoutEffect:()=>{};function _t(e,a,s){let[n,r]=h.useState(e||a),i=h.useRef(n),c=h.useRef(e!==void 0),l=e!==void 0;h.useEffect(()=>{let m=c.current;m!==l&&process.env.NODE_ENV!=="production"&&console.warn(`WARN: A component changed from ${m?"controlled":"uncontrolled"} to ${l?"controlled":"uncontrolled"}.`),c.current=l},[l]);let d=l?e:n;Gc(()=>{i.current=d});let[,u]=h.useReducer(()=>({}),{}),x=h.useCallback((m,...b)=>{let f=typeof m=="function"?m(i.current):m;Object.is(i.current,f)||(i.current=f,r(f),u(),s?.(f,...b))},[s]);return[d,x]}function Wr(e){return t.jsx("svg",{...e,fill:"none",stroke:"currentColor",strokeWidth:2,viewBox:"0 0 24 24",children:t.jsx(ze.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 qr=h.forwardRef(({color:e="primary",variant:a="default",stepsCount:s=3,defaultStep:n=0,label:r,stepLabels:i,showStepLabelTooltip:c=!1,stepLabelTooltipPlacement:l="top",showStepCounter:d=!1,stepCounterPosition:u="right",layout:x="compact",stepCounterFormat:m,onStepChange:b,currentStep:f,hideProgressBars:g=!1,stepClassName:j,className:y,isDisabled:v=!1,...C},S)=>{const[k,$]=_t(f,n,b),_=h.useMemo(()=>{let w,F;const A=["[--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":w="[--step-color:var(--heroui-primary)]",F="[--step-fg-color:var(--heroui-primary-foreground)]";break;case"secondary":w="[--step-color:var(--heroui-secondary)]",F="[--step-fg-color:var(--heroui-secondary-foreground)]";break;case"success":w="[--step-color:var(--heroui-success)]",F="[--step-fg-color:var(--heroui-success-foreground)]";break;case"warning":w="[--step-color:var(--heroui-warning)]",F="[--step-fg-color:var(--heroui-warning-foreground)]";break;case"danger":w="[--step-color:var(--heroui-danger)]",F="[--step-fg-color:var(--heroui-danger-foreground)]";break;case"default":w="[--step-color:var(--heroui-default)]",F="[--step-fg-color:var(--heroui-default-foreground)]";break;default:w="[--step-color:var(--heroui-primary)]",F="[--step-fg-color:var(--heroui-primary-foreground)]";break}return A.unshift(F),A.unshift(w),A},[e]);return t.jsxs("nav",{ref:S,"aria-label":"Progress",className:o.cn("flex items-center overflow-x-auto",x==="spread"?"w-full justify-between gap-6":"max-w-fit gap-3",y),"data-testid":"stepper-root",...C,children:[d&&u==="left"?t.jsx("span",{className:"text-default-500 text-2xl whitespace-nowrap","data-testid":"stepper-counter",children:m?m(k+1,s):`Step ${k+1} of ${s}`}):null,r&&t.jsx("label",{className:"text-small text-default-foreground lg:text-medium font-light whitespace-nowrap me-3","data-testid":"stepper-label",children:r}),t.jsx("ol",{className:o.cn("flex flex-row flex-nowrap gap-x-3",_,y),"data-testid":"stepper-list",children:Array.from({length:s})?.map((w,F)=>{const A=k===F?"active":k<F?"inactive":"complete",M=a==="activeLabel"&&A==="active"&&!!i?.[F],E=c&&A!=="active"&&!!i?.[F];return t.jsxs("li",{className:"relative flex shrink-0 items-center gap-x-3","data-testid":`stepper-step-${F}`,children:[t.jsx(o.Tooltip,{content:E?i?.[F]:void 0,isDisabled:!E,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":A==="active"?"step":void 0,className:o.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":v},j),onClick:()=>!v&&$(F),disabled:v,"data-testid":`stepper-step-btn-${F}`,children:[t.jsx("div",{className:"h-full relative flex items-center",children:t.jsx(ze.LazyMotion,{features:ze.domAnimation,children:t.jsx(ze.m.div,{animate:A,className:"relative z-10",children:t.jsx(ze.m.div,{animate:A,className:o.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)":A==="complete","shadow-lg":A==="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:A==="complete"&&a==="default"?t.jsx(Wr,{className:"h-5 w-5 text-(--active-fg-color)","data-testid":`stepper-step-check-${F}`}):t.jsx("span",{children:F+1})})})})})}),M?t.jsx("span",{className:"pr-2 text-2xl leading-none font-medium whitespace-nowrap text-(--active-color)","data-testid":`stepper-step-label-${F}`,children:i[F]}):null]},F)}),F<s-1&&!g&&t.jsx("div",{"aria-hidden":"true",className:"pointer-events-none z-0 w-12 flex-none items-center",style:{"--idx":F},children:t.jsx("div",{className:o.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":F<k})})})]},F)})}),d&&u==="right"?t.jsx("span",{className:"text-default-500 text-2xl whitespace-nowrap","data-testid":"stepper-counter",children:m?m(k+1,s):`Step ${k+1} of ${s}`}):null]})});qr.displayName="Stepper";function Kc(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(o.Alert,{description:"This template combines Navbar, Stepper, Footer, and an event details Card. Include event image, category/spots chips, tags, details grid, and action buttons. Use Card, CardHeader, CardBody for content structure.",title:"TODO: Implement EventDetailsTemplate",variant:"faded",className:"max-w-2xl"})})})}function fe(e,a="en-US",s="USD"){try{return new Intl.NumberFormat(a,{style:"currency",currency:s}).format(e)}catch{return`${s} ${e.toFixed(2)}`}}function Rt(e,a="en-US"){try{const s=new Intl.NumberFormat(a,{style:"currency",currency:e}).resolvedOptions();return typeof s.maximumFractionDigits=="number"?s.maximumFractionDigits:2}catch{return 2}}function ks(e,a,s="en-US"){const n=Rt(a,s),r=Math.pow(10,n);return Math.round(e*r)/r}function is(e,a,s,n){return ks(e-a,s,n)}const vn={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))"}},Yc="rgb(156 163 175)",Zc="rgb(107 114 128)",Gr=h.forwardRef(function({color:a="primary",steps:s=[],defaultStep:n=0,onStepChange:r,currentStep:i,hideProgressBars:c=!1,activeColor:l,activeForegroundColor:d,inactiveColor:u=Yc,inactiveLabelColor:x=Zc,activeStepVariant:m="bordered",stepClassName:b,circleClassName:f,progressBarClassName:g,labelsClassName:j,labelSlotClassName:y,activeLabelClassName:v,inactiveLabelClassName:C,className:S,ariaLabel:k="Progress",invalidLabelSuffix:$=", has errors",testId:_,isStepReachable:w,...F},A){const[M,E]=_t(i,n,r),D=vn[a]??vn.primary,I=l??D.active,B=d??D.fg,z=(q,P)=>{const W=q.ariaLabel??(typeof q.title=="string"?q.title:null)??`${P+1}`;return q.invalid?`${W}${$}`:W};return t.jsxs("nav",{...F,"aria-label":k,..._?{"data-testid":_}:{},children:[t.jsx("div",{className:o.cn("flex items-center",S),children:s?.map((q,P)=>{const ee=P===M?"active":P<M?"complete":"inactive",W=w?w(P):!0;return t.jsxs(h.Fragment,{children:[t.jsx(p.Button,{ref:A,isIconOnly:!0,disableAnimation:!0,radius:"full",variant:"light",testId:`${_??"horizontal-steps"}-step-${P}`,"aria-current":ee==="active"?"step":void 0,"aria-describedby":q.describedBy,"aria-label":z(q,P),"data-invalid":q.invalid?"true":void 0,isDisabled:!W,className:o.cn("size-8 min-w-8 shrink-0 overflow-visible bg-transparent p-0","data-[hover=true]:bg-transparent",W?"cursor-pointer":"cursor-not-allowed","data-[disabled=true]:opacity-40",q.className,b),onPress:()=>{if(i===void 0){E(P);return}r?.(P)},children:t.jsx(ze.LazyMotion,{features:ze.domAnimation,children:t.jsx(ze.m.div,{animate:ee,className:o.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"?I:"transparent",borderColor:I,borderWidth:"1.5px",color:m==="solid"?B:I},complete:{backgroundColor:I,borderColor:I,borderWidth:"1.5px",color:I}},children:ee==="complete"?t.jsx(Wr,{className:"size-4",style:{color:B}}):t.jsx("span",{children:P+1})})})}),P<s.length-1&&!c&&t.jsx("div",{"aria-hidden":!0,className:o.cn("mx-1 h-px w-6 shrink-0 transition-colors duration-300 sm:mx-1.5 sm:w-14 md:w-20",g),style:{backgroundColor:P<M?I:u}})]},P)})}),t.jsx("div",{className:o.cn("mt-2.5 hidden md:flex",j),children:s?.map((q,P)=>{const ee=P<=M;return t.jsxs(h.Fragment,{children:[t.jsx("div",{className:o.cn("relative flex w-8 shrink-0 justify-center overflow-visible",y),children:t.jsx("span",{className:o.cn("absolute left-1/2 top-0 -translate-x-1/2 whitespace-nowrap text-center text-[12px] font-medium transition-colors duration-200",ee?v:C),style:{color:ee?I:x},children:q.title})}),P<s.length-1&&!c&&t.jsx("div",{className:o.cn("mx-1 w-6 shrink-0 sm:mx-1.5 sm:w-14 md:w-20",g)})]},P)})})]})});Gr.displayName="HorizontalSteps";const Ke=e=>Xt[e],Qc={done:"solar:check-circle-bold","needs-fix":"solar:danger-triangle-bold",optional:"solar:record-outline"},Kr={done:{icon:Ke("--ok"),meta:Ke("--sub")},"needs-fix":{icon:Ke("--warn"),meta:Ke("--warn")},optional:{icon:Ke("--muted"),meta:Ke("--sub")}},Xc=Ke("--ink"),Jc={ready:"solar:check-circle-bold",fix:"solar:danger-triangle-bold",live:"solar:check-circle-bold"},ed={ready:{fill:Ke("--ok-fill"),text:Ke("--ok")},fix:{fill:Ke("--warn-fill"),text:Ke("--warn")},live:{fill:Ke("--ok-fill"),text:Ke("--ok")}},Je={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]"},Bt={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"},Nt={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 td({step:e,labels:a}){const s=Kr[e.status];if(e.status==="optional")return t.jsxs("span",{className:Je.meta,style:{color:s.meta},children:[a.optional,p.hasContent(e.summary)?t.jsxs(t.Fragment,{children:[" · ",e.summary]}):null]});const n=e.status==="needs-fix"&&p.hasContent(e.reason)?e.reason:e.summary,r=e.status==="done"?a.done:a.needsFix;return t.jsxs(t.Fragment,{children:[t.jsx("span",{className:"sr-only",children:r})," ",p.hasContent(n)?t.jsx("span",{className:Je.meta,style:{color:s.meta},children:n}):null]})}function Yr({steps:e,currentStep:a,defaultStep:s=0,onStepChange:n,isStepReachable:r,ariaLabel:i,statusLabels:c,header:l,maxHeight:d,className:u,style:x,"data-testid":m="vertical-steps",...b}){const[f,g]=_t(a,s,n);return t.jsxs("div",{...b,"data-testid":m,className:o.cn(Je.root,u),style:d===void 0?x:{maxHeight:d,...x},children:[l,t.jsx("nav",{"aria-label":i,className:Je.nav,children:t.jsx("ol",{className:Je.list,children:e.map((j,y)=>{const v=y===f,C=r?r(y):!0;return t.jsx("li",{children:t.jsxs(p.Button,{variant:"light",color:"default",radius:"none",disableAnimation:!0,testId:j.testId??`${m}-step-${j.key}`,"data-state":j.status,"data-current":v?"true":void 0,"aria-current":v?"step":void 0,isDisabled:!C,className:o.cn(Je.row,v&&Je.rowCurrent),onPress:()=>g(y),children:[t.jsx(p.Icon,{"aria-hidden":!0,icon:Qc[j.status],className:Je.icon,style:{color:Kr[j.status].icon}}),t.jsxs("span",{className:Je.text,children:[t.jsx("span",{className:o.cn(Je.label,v&&Je.labelCurrent),style:{color:Xc},children:`${y+1}. ${j.label}`})," ",t.jsx(td,{step:j,labels:c})]})]})},j.key)})})})]})}Yr.displayName="VerticalSteps";function Zr({variant:e,title:a,description:s,className:n,"data-testid":r="steps-readiness"}){const i=ed[e];return t.jsxs("div",{role:"status","data-testid":r,"data-variant":e,"data-ready":e==="fix"?"false":"true",className:o.cn(Bt.root,n),style:{backgroundColor:i.fill,color:i.text},children:[t.jsx(p.Icon,{"aria-hidden":!0,icon:Jc[e],className:Bt.icon}),t.jsxs("span",{className:Bt.text,children:[t.jsx("span",{className:Bt.title,children:a})," ",p.hasContent(s)?t.jsx("span",{className:Bt.description,children:s}):null]})]})}Zr.displayName="StepsReadiness";function Qr({steps:e,currentStep:a,onStepChange:s,progressLabel:n,nextLabel:r,previousLabel:i=g=>g.label,finalActionLabel:c,onFinalAction:l,isFinalActionDisabled:d=!1,className:u,"data-testid":x="step-pager",previousTestId:m=`${x}-prev`,nextTestId:b=`${x}-next`,finalActionTestId:f=`${x}-final`}){const g=e[a-1],j=e[a+1],y=a===e.length-1;return t.jsxs("div",{"data-testid":x,className:o.cn(Nt.root,u),children:[t.jsx("div",{className:Nt.spacer,children:g?t.jsx(p.Button,{variant:"bordered",color:"default",testId:m,startContent:t.jsx(p.Icon,{"aria-hidden":!0,icon:"solar:arrow-left-outline",className:Nt.arrow}),onPress:()=>s(a-1),children:i(g)}):null}),t.jsx("span",{className:Nt.progress,children:n(a+1,e.length)}),t.jsx("div",{className:Nt.endSlot,children:j?t.jsx(p.Button,{color:"primary",testId:b,endContent:t.jsx(p.Icon,{"aria-hidden":!0,icon:"solar:arrow-right-outline",className:Nt.arrow}),onPress:()=>s(a+1),children:r(j)}):y&&c!==void 0&&l?t.jsx(p.Button,{color:"primary",testId:f,isDisabled:d,onPress:l,children:c}):null})]})}Qr.displayName="StepPager";function ad(){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 sd=e=>{const a=h.useMemo(()=>JSON.stringify({allItems:e.allItems,selected:e.selected}),[e.allItems,e.selected]);return t.jsx(nd,{...e},a)},nd=({allItems:e,selected:a,onSelectedChange:s,titleLeft:n,titleRight:r})=>{const[i,c]=h.useState([]),[l,d]=h.useState([]),[u,x]=h.useState(null),[m,b]=h.useState(null),f=h.useMemo(()=>new Set(a),[a]),g=h.useMemo(()=>new Set(e),[e]),j=h.useMemo(()=>e.filter(E=>!f.has(E)),[e,f]),y=E=>{if(E.length===0)return;const D=Array.from(new Set([...a,...E]));s(D)},v=E=>{if(E.length===0)return;const D=new Set(E);s(a.filter(I=>!D.has(I)))},C=()=>{i.length!==0&&(y(i),c([]))},S=()=>{l.length!==0&&(v(l),d([]))},k=()=>{j.length!==0&&(y(j),c([]))},$=()=>{a.length!==0&&(s([]),d([]))},_=(E,D,I)=>{const B=Math.min(D,I),z=Math.max(D,I);return E.slice(B,z+1)},w=(E,D,I)=>{if(I&&u!==null){c(_(j,u,D)),d([]),x(D);return}const B=i.includes(E);c(B?i.filter(z=>z!==E):[...i,E]),d([]),x(D)},F=(E,D,I)=>{if(I&&m!==null){d(_(a,m,D)),c([]),b(D);return}const B=l.includes(E);d(B?l.filter(z=>z!==E):[...l,E]),c([]),b(D)},A=(E,D,I)=>{const B=I==="available"?i.includes(D)?i:[D]:l.includes(D)?l:[D];E.dataTransfer.setData("text/plain",JSON.stringify({source:I,items:B})),E.dataTransfer.effectAllowed="move"},M=(E,D)=>{E.preventDefault();const I=E.dataTransfer.getData("text/plain");if(I)try{const B=JSON.parse(I),z=(B.items||[]).filter(q=>g.has(q));if(z.length===0||B.source===D)return;D==="selected"?(y(z),c([])):(v(z),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:n}),t.jsx(o.Card,{className:"w-full border border-gray-200 shadow-none",children:t.jsx(o.CardBody,{className:"h-60 gap-2 overflow-y-auto",onDragOver:E=>E.preventDefault(),onDrop:E=>M(E,"available"),children:j.map((E,D)=>{const I=i.includes(E);return t.jsx("button",{type:"button",onClick:B=>{w(E,D,B.shiftKey)},onMouseDown:B=>{B.shiftKey&&B.preventDefault()},draggable:!0,onDragStart:B=>A(B,E,"available"),className:`rounded-md px-3 py-2 text-left text-sm transition ${I?"bg-[#E4571E]/10 text-[#E4571E]":"text-gray-700 hover:bg-gray-100"}`,children:E},E)})})})]}),t.jsxs("div",{className:"flex flex-row items-center justify-center gap-3 md:flex-col md:pt-6",children:[t.jsx(p.Button,{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:C,isDisabled:i.length===0,"aria-label":"Move selected to right",children:"›"}),t.jsx(p.Button,{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:S,isDisabled:l.length===0,"aria-label":"Move selected to left",children:"‹"}),t.jsx(p.Button,{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:k,isDisabled:j.length===0,"aria-label":"Move all to right",children:"»"}),t.jsx(p.Button,{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:a.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(o.Card,{className:"w-full border border-gray-200 shadow-none",children:t.jsx(o.CardBody,{className:"h-60 gap-2 overflow-y-auto",onDragOver:E=>E.preventDefault(),onDrop:E=>M(E,"selected"),children:a.map((E,D)=>{const I=l.includes(E);return t.jsx("button",{type:"button",onClick:B=>{F(E,D,B.shiftKey)},onMouseDown:B=>{B.shiftKey&&B.preventDefault()},draggable:!0,onDragStart:B=>A(B,E,"selected"),className:`rounded-md px-3 py-2 text-left text-sm transition ${I?"bg-[#E4571E]/10 text-[#E4571E]":"text-gray-700 hover:bg-gray-100"}`,children:E},E)})})})]})]})};function Zt(e){return typeof e=="string"?e:e.type}function ht({className:e}){return t.jsx("div",{className:`flex items-center h-6 ${e||""}`,children:t.jsx(o.Divider,{orientation:"vertical"})})}function gt({icon:e,label:a,isActive:s=!1,isDisabled:n=!1,onClick:r,shortcut:i,iconSize:c=16,className:l}){const d=i?`${a} (${i})`:a;return t.jsx(o.Tooltip,{content:d,placement:"top",offset:10,children:t.jsx(p.Button,{size:"sm",radius:"sm",color:s?"primary":"default",variant:s?"solid":"bordered",isIconOnly:!0,isDisabled:n,onPress:r,"aria-label":a,className:l,children:t.jsx(e,{size:c})})})}const ot={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:a})=>{const s=a?.type==="textColor"?a.color:"";s?e.chain().focus().setColor(s).run():e.chain().focus().unsetColor().run()},canExecute:()=>!0,isActive:e=>e.isActive("textStyle"),label:"Text color"},highlight:{execute:({editor:e,config:a})=>{const s=a?.type==="highlight"?a.color:"";s?e.chain().focus().setHighlight({color:s}).run():e.chain().focus().unsetHighlight().run()},canExecute:()=>!0,isActive:e=>e.isActive("highlight"),label:"Highlight"},link:{execute:({editor:e,config:a})=>{const s=a?.type==="link"?a.href:"";if(s){const n=a?.type==="link"?a.target:void 0,r=a?.type==="link"?a.rel:void 0;e.chain().focus().setLink({href:s,target:n,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:a})=>{const s=a?.type==="heading"?a.level:1;e.chain().focus().toggleHeading({level:s}).run()},canExecute:(e,a)=>{const s=a?.type==="heading"?a.level:1;return e.can().chain().focus().toggleHeading({level:s}).run()},isActive:(e,a)=>a?.type==="heading"?e.isActive("heading",{level:a.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:a})=>{const s=a?.type==="textAlign"?a.alignment:"left";e.chain().focus().setTextAlign(s).run()},canExecute:()=>!0,isActive:(e,a)=>a?.type==="textAlign"?e.isActive({textAlign:a.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"}},rd={1:"Heading 1",2:"Heading 2",3:"Heading 3",4:"Heading 4",5:"Heading 5",6:"Heading 6"};function id({editor:e,levels:a=[1,2,3,4,5,6],isDisabled:s=!1}){const[,n]=h.useState(0);h.useEffect(()=>{const c=()=>n(l=>l+1);return e.on("selectionUpdate",c),e.on("transaction",c),()=>{e.off("selectionUpdate",c),e.off("transaction",c)}},[e]);const r=a.find(c=>e.isActive("heading",{level:c})),i=c=>{const l=Number(c),d=ot.heading;d&&d.execute({editor:e,config:{type:"heading",level:l}})};return t.jsxs(o.Dropdown,{placement:"top-start",offset:10,children:[t.jsx(o.DropdownTrigger,{children:t.jsx(p.Button,{size:"sm",radius:"sm",variant:r?"solid":"bordered",color:r?"primary":"default",isDisabled:s,startContent:t.jsx(J.Heading,{size:16}),"aria-label":"Select heading level",children:r?`H${r}`:"H"})}),t.jsx(o.DropdownMenu,{"aria-label":"Heading levels",selectionMode:"single",selectedKeys:r?new Set([String(r)]):new Set,onAction:i,children:a.map(c=>t.jsx(o.DropdownItem,{startContent:e.isActive("heading",{level:c})?t.jsx(J.Check,{size:16}):t.jsx("div",{className:"w-4"}),children:rd[c]},c))})]})}const za={bulletList:{label:"Bullet List",icon:J.List},orderedList:{label:"Numbered List",icon:J.ListOrdered},taskList:{label:"Task List",icon:J.ListTodo}};function ld({editor:e,types:a=["bulletList","orderedList","taskList"],isDisabled:s=!1}){const[,n]=h.useState(0);h.useEffect(()=>{const l=()=>n(d=>d+1);return e.on("selectionUpdate",l),e.on("transaction",l),()=>{e.off("selectionUpdate",l),e.off("transaction",l)}},[e]);const r=a.find(l=>e.isActive(l)),i=r?za[r].icon:J.List,c=l=>{const u=ot[l];u&&u.execute({editor:e})};return t.jsxs(o.Dropdown,{placement:"top-start",offset:10,children:[t.jsx(o.DropdownTrigger,{children:t.jsx(p.Button,{size:"sm",radius:"sm",variant:r?"solid":"bordered",color:r?"primary":"default",isDisabled:s,isIconOnly:!0,"aria-label":"Select list type",children:t.jsx(i,{size:16})})}),t.jsx(o.DropdownMenu,{"aria-label":"List types",selectionMode:"single",selectedKeys:r?new Set([r]):new Set,onAction:c,children:a.map(l=>{const d=za[l].icon;return t.jsx(o.DropdownItem,{startContent:t.jsx(d,{size:16}),children:za[l].label},l)})})]})}function od({colors:e,selectedColor:a,onColorSelect:s,columns:n=4}){return t.jsx("div",{className:"grid gap-2",style:{gridTemplateColumns:`repeat(${n}, minmax(0, 1fr))`},children:e.map(r=>{const i=a===r;return t.jsx("button",{type:"button",onClick:()=>s(r),className:`
|
|
7
|
+
`}const le={line:"#E7E7E9","line-2":"#F1F1F3",hair:"#F0F0F1",page:"#FBFBFB",field:"#E5E5E5","line-strong":"#D4D4D8",ink:"#18181B",muted:"#71717A",faint:"#A1A1AA","ok-fill":"#EAF3DE",ok:"#3B6D11","warn-fill":"#FAEEDA",warn:"#854F0B","warn-icon":"#EFD9B2","danger-fill":"#FCEBEB",danger:Ae.semantic.danger,"danger-icon":"#F3D3CF","info-fill":"#EAF1FC",info:"#1D4FA8","violet-fill":"#F1ECFB",violet:"#6D28D9","neutral-fill":"#F4F4F5",neutral:"#52525B",destructive:"#A32D2D"};({...le});const ut=Ae.palettes.info,ra={light:{content1:"#ffffff",content2:"#f4f4f5"},dark:{content1:"#18181b",content2:"#27272a"}},vr=["accent","fill","border","user-bubble","assistant-bubble","focus"],vs={light:{accent:ut[600],fill:ut[100],border:ut[200],"user-bubble":ra.light.content2,"assistant-bubble":ra.light.content1,focus:ut[500]},dark:{accent:ut[300],fill:ut[900],border:ut[800],"user-bubble":ra.dark.content2,"assistant-bubble":ra.dark.content1,focus:ut[400]}};function jr(e){if(!/^#[0-9a-f]{6}$/i.test(e))throw new Error(`bad hex: ${e}`);return[1,3,5].map(a=>parseInt(e.slice(a,a+2),16)).join(" ")}const wr=e=>`--ai-${e}`,fn=e=>Object.fromEntries(vr.map(a=>[wr(a),jr(vs[e][a])])),xn={light:':root, .light, [data-theme="light"]',dark:".dark"};xn.light+"",fn("light"),xn.dark+"",fn("dark");Object.fromEntries(vr.map(e=>[e,`rgb(var(${wr(e)}, ${jr(vs.light[e])}) / <alpha-value>)`]));function fc({children:e,closeLabel:a,locale:s,reducedMotion:n="user"}){const r=p.useCloseLabel();return t.jsx(o.HeroUIProvider,{locale:s,reducedMotion:n,children:t.jsx(p.CloseLabelContext.Provider,{value:a??r,children:e})})}const xc="whitespace-normal overflow-visible text-clip break-words",Bt={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:`${xc} me-0`,description:"me-0"};function pc(e){return{...e,base:o.cn(Bt.base,e?.base),closeButton:o.cn(Bt.closeButton,e?.closeButton),closeIcon:o.cn(Bt.closeIcon,e?.closeIcon),title:o.cn(Bt.title,e?.title),description:o.cn(Bt.description,e?.description)}}function hc({toastProps:e,disableAnimation:a,...s}){const n=p.useReducedMotion();return t.jsx(o.ToastProvider,{...s,disableAnimation:a??(n||void 0),toastProps:{...e,classNames:pc(e?.classNames)}})}const Nr=h.createContext("default");function Sa(){return h.useContext(Nr)}function bc(e){return Sa()==="touch"?"lg":e}function gc({density:e,children:a}){return t.jsx(Nr.Provider,{value:e,children:a})}function Cr({code:e,amount:a,onRemove:s,label:n="Gift Card",removeAriaLabel:r="Remove gift card",testId:i="veevart-applied-code-card"}){return t.jsx(o.Card,{"data-testid":i,shadow:"sm",className:"w-full",children:t.jsxs(o.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:n}),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:a})]}),t.jsx(p.Button,{testId:`${i}-remove`,isIconOnly:!0,size:"sm",variant:"light","aria-label":r,onPress:s,children:t.jsx(p.Icon,{icon:"solar:close-circle-linear",className:"size-4","aria-hidden":"true"})})]})})}function Ba(e,a){return e-a*Math.floor(e/a)}const kr=1721426;function ia(e,a,s,n){a=js(e,a);let r=a-1,i=-2;return s<=2?i=0:fa(a)&&(i=-1),kr-1+365*r+Math.floor(r/4)-Math.floor(r/100)+Math.floor(r/400)+Math.floor((367*s-362)/12+i+n)}function fa(e){return e%4===0&&(e%100!==0||e%400===0)}function js(e,a){return e==="BC"?1-a:a}function yc(e){let a="AD";return e<=0&&(a="BC",e=1-e),[a,e]}const vc={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 $a{fromJulianDay(a){let s=a,n=s-kr,r=Math.floor(n/146097),i=Ba(n,146097),c=Math.floor(i/36524),l=Ba(i,36524),d=Math.floor(l/1461),u=Ba(l,1461),f=Math.floor(u/365),m=r*400+c*100+d*4+f+(c!==4&&f!==4?1:0),[b,x]=yc(m),g=s-ia(b,x,1,1),j=2;s<ia(b,x,3,1)?j=0:fa(x)&&(j=1);let y=Math.floor(((g+j)*12+373)/367),v=s-ia(b,x,y,1)+1;return new Zt(b,x,y,v)}toJulianDay(a){return ia(a.era,a.year,a.month,a.day)}getDaysInMonth(a){return vc[fa(a.year)?"leapyear":"standard"][a.month-1]}getMonthsInYear(a){return 12}getDaysInYear(a){return fa(a.year)?366:365}getMaximumMonthsInYear(){return 12}getMaximumDaysInMonth(){return 31}getYearsInEra(a){return 9999}getEras(){return["BC","AD"]}isInverseEra(a){return a.era==="BC"}balanceDate(a){a.year<=0&&(a.era=a.era==="BC"?"AD":"BC",a.year=1-a.year)}constructor(){this.identifier="gregory"}}function jc(e,a){var s,n,r,i;return(i=(r=(s=e.isEqual)===null||s===void 0?void 0:s.call(e,a))!==null&&r!==void 0?r:(n=a.isEqual)===null||n===void 0?void 0:n.call(a,e))!==null&&i!==void 0?i:e.identifier===a.identifier}function Sr(e,a){return e.calendar.toJulianDay(e)-a.calendar.toJulianDay(a)}function $r(e,a){return pn(e)-pn(a)}function pn(e){return e.hour*36e5+e.minute*6e4+e.second*1e3+e.millisecond}let Pa=null;function Ar(){return Pa==null&&(Pa=new Intl.DateTimeFormat().resolvedOptions().timeZone),Pa}function hn(e){e=ws(e,new $a);let a=js(e.era,e.year);return Dr(a,e.month,e.day,e.hour,e.minute,e.second,e.millisecond)}function Dr(e,a,s,n,r,i,c){let l=new Date;return l.setUTCHours(n,r,i,c),l.setUTCFullYear(e,a-1,s),l.getTime()}function bn(e,a){if(a==="UTC")return 0;if(e>0&&a===Ar())return new Date(e).getTimezoneOffset()*-6e4;let{year:s,month:n,day:r,hour:i,minute:c,second:l}=Er(e,a);return Dr(s,n,r,i,c,l,0)-Math.floor(e/1e3)*1e3}const gn=new Map;function Er(e,a){let s=gn.get(a);s||(s=new Intl.DateTimeFormat("en-US",{timeZone:a,hour12:!1,era:"short",year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric"}),gn.set(a,s));let n=s.formatToParts(new Date(e)),r={};for(let i of n)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 yn=864e5;function wc(e,a,s,n){return(s===n?[s]:[s,n]).filter(i=>Nc(e,a,i))}function Nc(e,a,s){let n=Er(s,a);return e.year===n.year&&e.month===n.month&&e.day===n.day&&e.hour===n.hour&&e.minute===n.minute&&e.second===n.second}function Cc(e,a,s="compatible"){let n=Fr(e);if(a==="UTC")return hn(n);if(a===Ar()&&s==="compatible"){n=ws(n,new $a);let d=new Date,u=js(n.era,n.year);return d.setFullYear(u,n.month-1,n.day),d.setHours(n.hour,n.minute,n.second,n.millisecond),d.getTime()}let r=hn(n),i=bn(r-yn,a),c=bn(r+yn,a),l=wc(n,a,r-i,r-c);if(l.length===1)return l[0];if(l.length>1)switch(s){case"compatible":case"earlier":return l[0];case"later":return l[l.length-1];case"reject":throw new RangeError("Multiple possible absolute times found")}switch(s){case"earlier":return Math.min(r-i,r-c);case"compatible":case"later":return Math.max(r-i,r-c);case"reject":throw new RangeError("No such absolute time found")}}function Lr(e,a,s="compatible"){return new Date(Cc(e,a,s))}function Fr(e,a){let s=0,n=0,r=0,i=0;if("timeZone"in e)({hour:s,minute:n,second:r,millisecond:i}=e);else if("hour"in e&&!a)return e;return a&&({hour:s,minute:n,second:r,millisecond:i}=a),new ha(e.calendar,e.era,e.year,e.month,e.day,s,n,r,i)}function ws(e,a){if(jc(e.calendar,a))return e;let s=a.fromJulianDay(e.calendar.toJulianDay(e)),n=e.copy();return n.calendar=a,n.era=s.era,n.year=s.year,n.month=s.month,n.day=s.day,_t(n),n}function Ns(e,a){let s=e.copy(),n="hour"in s?Tr(s,a):0;ns(s,a.years||0),s.calendar.balanceYearMonth&&s.calendar.balanceYearMonth(s,e),s.month+=a.months||0,rs(s),_r(s),s.day+=(a.weeks||0)*7,s.day+=a.days||0,s.day+=n,kc(s),s.calendar.balanceDate&&s.calendar.balanceDate(s),s.year<1&&(s.year=1,s.month=1,s.day=1);let r=s.calendar.getYearsInEra(s);if(s.year>r){var i,c;let d=(i=(c=s.calendar).isInverseEra)===null||i===void 0?void 0:i.call(c,s);s.year=r,s.month=d?1:s.calendar.getMonthsInYear(s),s.day=d?1:s.calendar.getDaysInMonth(s)}s.month<1&&(s.month=1,s.day=1);let l=s.calendar.getMonthsInYear(s);return s.month>l&&(s.month=l,s.day=s.calendar.getDaysInMonth(s)),s.day=Math.max(1,Math.min(s.calendar.getDaysInMonth(s),s.day)),s}function ns(e,a){var s,n;!((s=(n=e.calendar).isInverseEra)===null||s===void 0)&&s.call(n,e)&&(a=-a),e.year+=a}function rs(e){for(;e.month<1;)ns(e,-1),e.month+=e.calendar.getMonthsInYear(e);let a=0;for(;e.month>(a=e.calendar.getMonthsInYear(e));)e.month-=a,ns(e,1)}function kc(e){for(;e.day<1;)e.month--,rs(e),e.day+=e.calendar.getDaysInMonth(e);for(;e.day>e.calendar.getDaysInMonth(e);)e.day-=e.calendar.getDaysInMonth(e),e.month++,rs(e)}function _r(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 _t(e){e.calendar.constrainDate&&e.calendar.constrainDate(e),e.year=Math.max(1,Math.min(e.calendar.getYearsInEra(e),e.year)),_r(e)}function Rr(e){let a={};for(let s in e)typeof e[s]=="number"&&(a[s]=-e[s]);return a}function Ir(e,a){return Ns(e,Rr(a))}function Mr(e,a){let s=e.copy();return a.era!=null&&(s.era=a.era),a.year!=null&&(s.year=a.year),a.month!=null&&(s.month=a.month),a.day!=null&&(s.day=a.day),_t(s),s}function Br(e,a){let s=e.copy();return a.hour!=null&&(s.hour=a.hour),a.minute!=null&&(s.minute=a.minute),a.second!=null&&(s.second=a.second),a.millisecond!=null&&(s.millisecond=a.millisecond),Pr(s),s}function Sc(e){e.second+=Math.floor(e.millisecond/1e3),e.millisecond=la(e.millisecond,1e3),e.minute+=Math.floor(e.second/60),e.second=la(e.second,60),e.hour+=Math.floor(e.minute/60),e.minute=la(e.minute,60);let a=Math.floor(e.hour/24);return e.hour=la(e.hour,24),a}function Pr(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 la(e,a){let s=e%a;return s<0&&(s+=a),s}function Tr(e,a){return e.hour+=a.hours||0,e.minute+=a.minutes||0,e.second+=a.seconds||0,e.millisecond+=a.milliseconds||0,Sc(e)}function Or(e,a){let s=e.copy();return Tr(s,a),s}function $c(e,a){return Or(e,Rr(a))}function zr(e,a,s,n){let r=e.copy();switch(a){case"era":{let l=e.calendar.getEras(),d=l.indexOf(e.era);if(d<0)throw new Error("Invalid era: "+e.era);d=ft(d,s,0,l.length-1,n?.round),r.era=l[d],_t(r);break}case"year":var i,c;!((i=(c=r.calendar).isInverseEra)===null||i===void 0)&&i.call(c,r)&&(s=-s),r.year=ft(e.year,s,-1/0,9999,n?.round),r.year===-1/0&&(r.year=1),r.calendar.balanceYearMonth&&r.calendar.balanceYearMonth(r,e);break;case"month":r.month=ft(e.month,s,1,e.calendar.getMonthsInYear(e),n?.round);break;case"day":r.day=ft(e.day,s,1,e.calendar.getDaysInMonth(e),n?.round);break;default:throw new Error("Unsupported field "+a)}return e.calendar.balanceDate&&e.calendar.balanceDate(r),_t(r),r}function Vr(e,a,s,n){let r=e.copy();switch(a){case"hour":{let i=e.hour,c=0,l=23;if(n?.hourCycle===12){let d=i>=12;c=d?12:0,l=d?23:11}r.hour=ft(i,s,c,l,n?.round);break}case"minute":r.minute=ft(e.minute,s,0,59,n?.round);break;case"second":r.second=ft(e.second,s,0,59,n?.round);break;case"millisecond":r.millisecond=ft(e.millisecond,s,0,999,n?.round);break;default:throw new Error("Unsupported field "+a)}return r}function ft(e,a,s,n,r=!1){if(r){e+=Math.sign(a),e<s&&(e=n);let i=Math.abs(a);a>0?e=Math.ceil(e/i)*i:e=Math.floor(e/i)*i,e>n&&(e=s)}else e+=a,e<s?e=n-(s-e-1):e>n&&(e=s+(e-n-1));return e}const Ac=/^([+-]\d{6}|\d{4})-(\d{2})-(\d{2})$/,Dc=/^([+-]\d{6}|\d{4})-(\d{2})-(\d{2})(?:T(\d{2}))?(?::(\d{2}))?(?::(\d{2}))?(\.\d+)?(?:(?:([+-]\d{2})(?::?(\d{2}))?)|Z)$/;function Ec(e){let a=e.match(Ac);if(!a)throw Dc.test(e)?new Error(`Invalid ISO 8601 date string: ${e}. Use parseAbsolute() instead.`):new Error("Invalid ISO 8601 date string: "+e);let s=new Zt(Ta(a[1],0,9999),Ta(a[2],1,12),1);return s.day=Ta(a[3],1,s.calendar.getDaysInMonth(s)),s}function Ta(e,a,s){let n=Number(e);if(n<a||n>s)throw new RangeError(`Value out of range: ${a} <= ${n} <= ${s}`);return n}function Ur(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 Hr(e){let a=ws(e,new $a),s;return a.era==="BC"?s=a.year===1?"0000":"-"+String(Math.abs(1-a.year)).padStart(6,"00"):s=String(a.year).padStart(4,"0"),`${s}-${String(a.month).padStart(2,"0")}-${String(a.day).padStart(2,"0")}`}function Lc(e){return`${Hr(e)}T${Ur(e)}`}function Fc(e,a){if(a.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function Cs(e,a,s){Fc(e,a),a.set(e,s)}function Wr(e){let a=typeof e[0]=="object"?e.shift():new $a,s;if(typeof e[0]=="string")s=e.shift();else{let c=a.getEras();s=c[c.length-1]}let n=e.shift(),r=e.shift(),i=e.shift();return[a,s,n,r,i]}var _c=new WeakMap;class Zt{copy(){return this.era?new Zt(this.calendar,this.era,this.year,this.month,this.day):new Zt(this.calendar,this.year,this.month,this.day)}add(a){return Ns(this,a)}subtract(a){return Ir(this,a)}set(a){return Mr(this,a)}cycle(a,s,n){return zr(this,a,s,n)}toDate(a){return Lr(this,a)}toString(){return Hr(this)}compare(a){return Sr(this,a)}constructor(...a){Cs(this,_c,{writable:!0,value:void 0});let[s,n,r,i,c]=Wr(a);this.calendar=s,this.era=n,this.year=r,this.month=i,this.day=c,_t(this)}}var Rc=new WeakMap;class Aa{copy(){return new Aa(this.hour,this.minute,this.second,this.millisecond)}add(a){return Or(this,a)}subtract(a){return $c(this,a)}set(a){return Br(this,a)}cycle(a,s,n){return Vr(this,a,s,n)}toString(){return Ur(this)}compare(a){return $r(this,a)}constructor(a=0,s=0,n=0,r=0){Cs(this,Rc,{writable:!0,value:void 0}),this.hour=a,this.minute=s,this.second=n,this.millisecond=r,Pr(this)}}var Ic=new WeakMap;class ha{copy(){return this.era?new ha(this.calendar,this.era,this.year,this.month,this.day,this.hour,this.minute,this.second,this.millisecond):new ha(this.calendar,this.year,this.month,this.day,this.hour,this.minute,this.second,this.millisecond)}add(a){return Ns(this,a)}subtract(a){return Ir(this,a)}set(a){return Mr(Br(this,a),a)}cycle(a,s,n){switch(a){case"era":case"year":case"month":case"day":return zr(this,a,s,n);default:return Vr(this,a,s,n)}}toDate(a,s){return Lr(this,a,s)}toString(){return Lc(this)}compare(a){let s=Sr(this,a);return s===0?$r(this,Fr(a)):s}constructor(...a){Cs(this,Ic,{writable:!0,value:void 0});let[s,n,r,i,c]=Wr(a);this.calendar=s,this.era=n,this.year=r,this.month=i,this.day=c,this.hour=a.shift()||0,this.minute=a.shift()||0,this.second=a.shift()||0,this.millisecond=a.shift()||0,_t(this)}}const Mc={firstDayOfWeek:"mon",showMonthAndYearPickers:!0,markToday:!0},Bc="data-[today=true]:font-semibold data-[today=true]:ring-1 data-[today=true]:ring-inset data-[today=true]:ring-primary",Pc="Open time options",Tc=320;function is(e,a){return typeof a=="string"&&a.length>0?`${e} ${a}`:e}function vn(e,a){return a?{...e,classNames:{...e?.classNames,cellButton:is(Bc,e?.classNames?.cellButton)}}:e}function Oa(e){if(!e)return null;const a="hour"in e&&typeof e.hour=="number"?e.hour:0,s="minute"in e&&typeof e.minute=="number"?e.minute:0,n="second"in e&&typeof e.second=="number"?e.second:0;return new Aa(a,s,n)}function Oc(e,a){const s=new Date(2e3,0,1,e.hour,e.minute,e.second);return new Intl.DateTimeFormat("en-US",{hour:"numeric",minute:"2-digit",hour12:a===12}).format(s)}function zc(e){const a=[];for(let s=0;s<24;s+=1)for(let n=0;n<60;n+=e)a.push(new Aa(s,n));return a}function Vc(e){const{minuteStep:a=15,timeListClassName:s,timeListLabel:n=Pc,selectorButtonProps:r,endContent:i,onChange:c,value:l,defaultValue:d,hourCycle:u=12,...f}=e,m=l!==void 0,[b,x]=h.useState(()=>Oa(d)),g=m?Oa(l):b,j=h.useMemo(()=>zc(a),[a]),y=C=>{m||x(C),c?.(C)},v=t.jsxs(o.Popover,{placement:"bottom-end",children:[t.jsx(o.PopoverTrigger,{children:t.jsx(o.Button,{isIconOnly:!0,variant:"light","aria-label":n,...r,onPress:void 0,children:t.jsx(J.Clock3,{className:"size-4",strokeWidth:1.75})})}),t.jsx(o.PopoverContent,{className:"min-w-[8.5rem] p-0",children:t.jsx(o.ScrollShadow,{className:s??"max-h-64 py-1",children:t.jsx("div",{className:"flex flex-col p-1",children:j.map(C=>{const S=g?.hour===C.hour&&g?.minute===C.minute;return t.jsx(o.Button,{variant:S?"flat":"light",color:S?"primary":"default",className:"h-9 min-w-0 justify-start px-3",onPress:()=>y(C),children:Oc(C,u)},`${C.hour}:${C.minute}`)})})})})]});return t.jsx(o.TimeInput,{...f,value:m?g:void 0,defaultValue:m?void 0:d,hourCycle:u,endContent:t.jsxs("div",{className:"flex items-center gap-1",children:[i,v]}),onChange:C=>y(Oa(C))})}function ks(e){if(e.mode==="time")return t.jsx(Vc,{...e});if(e.mode==="datetime"){const{mode:c,granularity:l="minute",hideTimeZone:d=!0,calendarWidth:u=Tc,disableAnimation:f=!0,classNames:m,markToday:b,calendarProps:x,...g}=e;return t.jsx(o.DatePicker,{...g,calendarProps:vn(x,b),calendarWidth:u,classNames:{...m,popoverContent:is("min-w-[20rem]",m?.popoverContent),calendarContent:is("min-h-[18rem]",m?.calendarContent)},disableAnimation:f,granularity:l,hideTimeZone:d})}const{mode:a,granularity:s="day",markToday:n,calendarProps:r,...i}=e;return t.jsx(o.DatePicker,{...i,calendarProps:vn(r,n),granularity:s})}function Uc({state:e,onSubmit:a,onRemove:s,appliedCredit:n,errorMessage:r,label:i="Gift Card",placeholder:c="GC-XXXX-XXXX-XXXX",applyLabel:l="Apply",removeAriaLabel:d="Remove gift card",testId:u="veevart-redeem-code-input"}){const[f,m]=h.useState(""),b=h.useId(),[x,g]=h.useState(e);e!==x&&(g(e),e==="applied"&&m(""));const j=()=>{const C=f.trim();C&&a(C)},y=C=>{C.key==="Enter"&&(C.preventDefault(),j())};if(e==="applied"&&n)return t.jsx("div",{"data-testid":u,children:t.jsx(Cr,{code:n.code,amount:n.amount,onRemove:s,removeAriaLabel:d,testId:`${u}-card`})});const v=e==="error"&&r!=null;return t.jsxs("div",{"data-testid":u,className:"flex flex-col gap-1",children:[t.jsxs("div",{className:"flex items-end gap-2",children:[t.jsx(o.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:c,value:f,onValueChange:m,onKeyDown:y,isDisabled:e==="loading",isInvalid:e==="error","aria-describedby":v?b:void 0}),t.jsx(p.Button,{testId:`${u}-button`,isLoading:e==="loading",isDisabled:!f.trim(),onPress:j,children:l})]}),v&&t.jsx("p",{id:b,"data-testid":`${u}-error`,className:"text-tiny text-danger",children:r})]})}const Hc={login:"Login",logout:"Logout",selectLanguage:"Select your language"};function Wc({languages:e,selectedLanguage:a,onLanguageChange:s,label:n}){const r=e.find(i=>i.code===a);return t.jsx("div",{className:"flex items-center",children:t.jsxs("div",{className:"relative flex items-center",children:[t.jsx(p.Select,{"data-testid":"language-select-desktop",variant:"bordered","aria-label":n,selectedKeys:a?[a]:[],onSelectionChange:i=>{const c=Array.from(i)[0]||a;s?.(c)},className:"min-w-36 hidden md:inline-flex",isDisabled:e.length===0,placeholder:n,startContent:t.jsx(J.Globe,{className:"w-5 h-5 text-black"}),renderValue:()=>t.jsx("span",{children:r?.label||n}),size:"md",radius:"full",children:e.map(i=>t.jsx(o.SelectItem,{textValue:i.label,"data-testid":`language-select-option-${i.code}`,children:i.label},i.code))}),t.jsx(p.Select,{"aria-label":n,"data-testid":"language-select-mobile",variant:"bordered",selectedKeys:a?[a]:[],onSelectionChange:i=>{const c=Array.from(i)[0]||a;s?.(c)},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(o.SelectItem,{textValue:i.code.toUpperCase(),"data-testid":`language-select-option-mobile-${i.code}`,children:i.code.toUpperCase()},i.code))})]})})}function qc({isLoggedIn:e,onLogin:a,onLogout:s,labels:n}){return e?t.jsxs(p.Button,{"data-testid":"navbar-auth-button",className:"px-2 py-1 w-1 min-w-12 md:min-w-24 rounded-full bg-black text-white text-sm flex items-center",onPress:s,size:"md",children:[t.jsx(J.User,{className:"inline w-5 h-5"}),t.jsx("span",{className:"hidden md:inline",children:n.logout})]}):t.jsxs(p.Button,{"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:a,size:"md",children:[t.jsx(J.User,{className:"inline w-5 h-5"}),t.jsx("span",{className:"hidden md:inline",children:n.login})]})}function Gc({logo:e,languages:a=[],selectedLanguage:s,onLanguageChange:n,isLoggedIn:r,onLogin:i,onLogout:c,hasLanguages:l,hasAuth:d,labels:u={},className:f}){const m={...Hc,...u};return t.jsxs("nav",{"data-testid":"navbar",className:o.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||a.length>0)&&t.jsx(Wc,{languages:a,selectedLanguage:s,onLanguageChange:n,label:m.selectLanguage}),d&&t.jsx(qc,{isLoggedIn:r,onLogin:i,onLogout:c,labels:m})]})]})}function Kc(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(o.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 za;const Yc=typeof document<"u"?(za=h.useInsertionEffect)!==null&&za!==void 0?za:h.useLayoutEffect:()=>{};function Rt(e,a,s){let[n,r]=h.useState(e||a),i=h.useRef(n),c=h.useRef(e!==void 0),l=e!==void 0;h.useEffect(()=>{let m=c.current;m!==l&&process.env.NODE_ENV!=="production"&&console.warn(`WARN: A component changed from ${m?"controlled":"uncontrolled"} to ${l?"controlled":"uncontrolled"}.`),c.current=l},[l]);let d=l?e:n;Yc(()=>{i.current=d});let[,u]=h.useReducer(()=>({}),{}),f=h.useCallback((m,...b)=>{let x=typeof m=="function"?m(i.current):m;Object.is(i.current,x)||(i.current=x,r(x),u(),s?.(x,...b))},[s]);return[d,f]}function qr(e){return t.jsx("svg",{...e,fill:"none",stroke:"currentColor",strokeWidth:2,viewBox:"0 0 24 24",children:t.jsx(ze.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 Gr=h.forwardRef(({color:e="primary",variant:a="default",stepsCount:s=3,defaultStep:n=0,label:r,stepLabels:i,showStepLabelTooltip:c=!1,stepLabelTooltipPlacement:l="top",showStepCounter:d=!1,stepCounterPosition:u="right",layout:f="compact",stepCounterFormat:m,onStepChange:b,currentStep:x,hideProgressBars:g=!1,stepClassName:j,className:y,isDisabled:v=!1,...C},S)=>{const[k,$]=Rt(x,n,b),_=h.useMemo(()=>{let w,F;const A=["[--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":w="[--step-color:var(--heroui-primary)]",F="[--step-fg-color:var(--heroui-primary-foreground)]";break;case"secondary":w="[--step-color:var(--heroui-secondary)]",F="[--step-fg-color:var(--heroui-secondary-foreground)]";break;case"success":w="[--step-color:var(--heroui-success)]",F="[--step-fg-color:var(--heroui-success-foreground)]";break;case"warning":w="[--step-color:var(--heroui-warning)]",F="[--step-fg-color:var(--heroui-warning-foreground)]";break;case"danger":w="[--step-color:var(--heroui-danger)]",F="[--step-fg-color:var(--heroui-danger-foreground)]";break;case"default":w="[--step-color:var(--heroui-default)]",F="[--step-fg-color:var(--heroui-default-foreground)]";break;default:w="[--step-color:var(--heroui-primary)]",F="[--step-fg-color:var(--heroui-primary-foreground)]";break}return A.unshift(F),A.unshift(w),A},[e]);return t.jsxs("nav",{ref:S,"aria-label":"Progress",className:o.cn("flex items-center overflow-x-auto",f==="spread"?"w-full justify-between gap-6":"max-w-fit gap-3",y),"data-testid":"stepper-root",...C,children:[d&&u==="left"?t.jsx("span",{className:"text-default-500 text-2xl whitespace-nowrap","data-testid":"stepper-counter",children:m?m(k+1,s):`Step ${k+1} of ${s}`}):null,r&&t.jsx("label",{className:"text-small text-default-foreground lg:text-medium font-light whitespace-nowrap me-3","data-testid":"stepper-label",children:r}),t.jsx("ol",{className:o.cn("flex flex-row flex-nowrap gap-x-3",_,y),"data-testid":"stepper-list",children:Array.from({length:s})?.map((w,F)=>{const A=k===F?"active":k<F?"inactive":"complete",M=a==="activeLabel"&&A==="active"&&!!i?.[F],E=c&&A!=="active"&&!!i?.[F];return t.jsxs("li",{className:"relative flex shrink-0 items-center gap-x-3","data-testid":`stepper-step-${F}`,children:[t.jsx(o.Tooltip,{content:E?i?.[F]:void 0,isDisabled:!E,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":A==="active"?"step":void 0,className:o.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":v},j),onClick:()=>!v&&$(F),disabled:v,"data-testid":`stepper-step-btn-${F}`,children:[t.jsx("div",{className:"h-full relative flex items-center",children:t.jsx(ze.LazyMotion,{features:ze.domAnimation,children:t.jsx(ze.m.div,{animate:A,className:"relative z-10",children:t.jsx(ze.m.div,{animate:A,className:o.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)":A==="complete","shadow-lg":A==="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:A==="complete"&&a==="default"?t.jsx(qr,{className:"h-5 w-5 text-(--active-fg-color)","data-testid":`stepper-step-check-${F}`}):t.jsx("span",{children:F+1})})})})})}),M?t.jsx("span",{className:"pr-2 text-2xl leading-none font-medium whitespace-nowrap text-(--active-color)","data-testid":`stepper-step-label-${F}`,children:i[F]}):null]},F)}),F<s-1&&!g&&t.jsx("div",{"aria-hidden":"true",className:"pointer-events-none z-0 w-12 flex-none items-center",style:{"--idx":F},children:t.jsx("div",{className:o.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":F<k})})})]},F)})}),d&&u==="right"?t.jsx("span",{className:"text-default-500 text-2xl whitespace-nowrap","data-testid":"stepper-counter",children:m?m(k+1,s):`Step ${k+1} of ${s}`}):null]})});Gr.displayName="Stepper";function Zc(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(o.Alert,{description:"This template combines Navbar, Stepper, Footer, and an event details Card. Include event image, category/spots chips, tags, details grid, and action buttons. Use Card, CardHeader, CardBody for content structure.",title:"TODO: Implement EventDetailsTemplate",variant:"faded",className:"max-w-2xl"})})})}function fe(e,a="en-US",s="USD"){try{return new Intl.NumberFormat(a,{style:"currency",currency:s}).format(e)}catch{return`${s} ${e.toFixed(2)}`}}function It(e,a="en-US"){try{const s=new Intl.NumberFormat(a,{style:"currency",currency:e}).resolvedOptions();return typeof s.maximumFractionDigits=="number"?s.maximumFractionDigits:2}catch{return 2}}function Ss(e,a,s="en-US"){const n=It(a,s),r=Math.pow(10,n);return Math.round(e*r)/r}function ls(e,a,s,n){return Ss(e-a,s,n)}const jn={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))"}},Qc="rgb(156 163 175)",Xc="rgb(107 114 128)",Kr=h.forwardRef(function({color:a="primary",steps:s=[],defaultStep:n=0,onStepChange:r,currentStep:i,hideProgressBars:c=!1,activeColor:l,activeForegroundColor:d,inactiveColor:u=Qc,inactiveLabelColor:f=Xc,activeStepVariant:m="bordered",stepClassName:b,circleClassName:x,progressBarClassName:g,labelsClassName:j,labelSlotClassName:y,activeLabelClassName:v,inactiveLabelClassName:C,className:S,ariaLabel:k="Progress",invalidLabelSuffix:$=", has errors",testId:_,isStepReachable:w,...F},A){const[M,E]=Rt(i,n,r),D=jn[a]??jn.primary,I=l??D.active,B=d??D.fg,z=(q,P)=>{const W=q.ariaLabel??(typeof q.title=="string"?q.title:null)??`${P+1}`;return q.invalid?`${W}${$}`:W};return t.jsxs("nav",{...F,"aria-label":k,..._?{"data-testid":_}:{},children:[t.jsx("div",{className:o.cn("flex items-center",S),children:s?.map((q,P)=>{const ee=P===M?"active":P<M?"complete":"inactive",W=w?w(P):!0;return t.jsxs(h.Fragment,{children:[t.jsx(p.Button,{ref:A,isIconOnly:!0,disableAnimation:!0,radius:"full",variant:"light",testId:`${_??"horizontal-steps"}-step-${P}`,"aria-current":ee==="active"?"step":void 0,"aria-describedby":q.describedBy,"aria-label":z(q,P),"data-invalid":q.invalid?"true":void 0,isDisabled:!W,className:o.cn("size-8 min-w-8 shrink-0 overflow-visible bg-transparent p-0","data-[hover=true]:bg-transparent",W?"cursor-pointer":"cursor-not-allowed","data-[disabled=true]:opacity-40",q.className,b),onPress:()=>{if(i===void 0){E(P);return}r?.(P)},children:t.jsx(ze.LazyMotion,{features:ze.domAnimation,children:t.jsx(ze.m.div,{animate:ee,className:o.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"?I:"transparent",borderColor:I,borderWidth:"1.5px",color:m==="solid"?B:I},complete:{backgroundColor:I,borderColor:I,borderWidth:"1.5px",color:I}},children:ee==="complete"?t.jsx(qr,{className:"size-4",style:{color:B}}):t.jsx("span",{children:P+1})})})}),P<s.length-1&&!c&&t.jsx("div",{"aria-hidden":!0,className:o.cn("mx-1 h-px w-6 shrink-0 transition-colors duration-300 sm:mx-1.5 sm:w-14 md:w-20",g),style:{backgroundColor:P<M?I:u}})]},P)})}),t.jsx("div",{className:o.cn("mt-2.5 hidden md:flex",j),children:s?.map((q,P)=>{const ee=P<=M;return t.jsxs(h.Fragment,{children:[t.jsx("div",{className:o.cn("relative flex w-8 shrink-0 justify-center overflow-visible",y),children:t.jsx("span",{className:o.cn("absolute left-1/2 top-0 -translate-x-1/2 whitespace-nowrap text-center text-[12px] font-medium transition-colors duration-200",ee?v:C),style:{color:ee?I:f},children:q.title})}),P<s.length-1&&!c&&t.jsx("div",{className:o.cn("mx-1 w-6 shrink-0 sm:mx-1.5 sm:w-14 md:w-20",g)})]},P)})})]})});Kr.displayName="HorizontalSteps";const Ke=e=>Jt[e],Jc={done:"solar:check-circle-bold","needs-fix":"solar:danger-triangle-bold",optional:"solar:record-outline"},Yr={done:{icon:Ke("--ok"),meta:Ke("--sub")},"needs-fix":{icon:Ke("--warn"),meta:Ke("--warn")},optional:{icon:Ke("--muted"),meta:Ke("--sub")}},ed=Ke("--ink"),td={ready:"solar:check-circle-bold",fix:"solar:danger-triangle-bold",live:"solar:check-circle-bold"},ad={ready:{fill:Ke("--ok-fill"),text:Ke("--ok")},fix:{fill:Ke("--warn-fill"),text:Ke("--warn")},live:{fill:Ke("--ok-fill"),text:Ke("--ok")}},Je={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]"},Pt={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"},Ct={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 sd({step:e,labels:a}){const s=Yr[e.status];if(e.status==="optional")return t.jsxs("span",{className:Je.meta,style:{color:s.meta},children:[a.optional,p.hasContent(e.summary)?t.jsxs(t.Fragment,{children:[" · ",e.summary]}):null]});const n=e.status==="needs-fix"&&p.hasContent(e.reason)?e.reason:e.summary,r=e.status==="done"?a.done:a.needsFix;return t.jsxs(t.Fragment,{children:[t.jsx("span",{className:"sr-only",children:r})," ",p.hasContent(n)?t.jsx("span",{className:Je.meta,style:{color:s.meta},children:n}):null]})}function Zr({steps:e,currentStep:a,defaultStep:s=0,onStepChange:n,isStepReachable:r,ariaLabel:i,statusLabels:c,header:l,maxHeight:d,className:u,style:f,"data-testid":m="vertical-steps",...b}){const[x,g]=Rt(a,s,n);return t.jsxs("div",{...b,"data-testid":m,className:o.cn(Je.root,u),style:d===void 0?f:{maxHeight:d,...f},children:[l,t.jsx("nav",{"aria-label":i,className:Je.nav,children:t.jsx("ol",{className:Je.list,children:e.map((j,y)=>{const v=y===x,C=r?r(y):!0;return t.jsx("li",{children:t.jsxs(p.Button,{variant:"light",color:"default",radius:"none",disableAnimation:!0,testId:j.testId??`${m}-step-${j.key}`,"data-state":j.status,"data-current":v?"true":void 0,"aria-current":v?"step":void 0,isDisabled:!C,className:o.cn(Je.row,v&&Je.rowCurrent),onPress:()=>g(y),children:[t.jsx(p.Icon,{"aria-hidden":!0,icon:Jc[j.status],className:Je.icon,style:{color:Yr[j.status].icon}}),t.jsxs("span",{className:Je.text,children:[t.jsx("span",{className:o.cn(Je.label,v&&Je.labelCurrent),style:{color:ed},children:`${y+1}. ${j.label}`})," ",t.jsx(sd,{step:j,labels:c})]})]})},j.key)})})})]})}Zr.displayName="VerticalSteps";function Qr({variant:e,title:a,description:s,className:n,"data-testid":r="steps-readiness"}){const i=ad[e];return t.jsxs("div",{role:"status","data-testid":r,"data-variant":e,"data-ready":e==="fix"?"false":"true",className:o.cn(Pt.root,n),style:{backgroundColor:i.fill,color:i.text},children:[t.jsx(p.Icon,{"aria-hidden":!0,icon:td[e],className:Pt.icon}),t.jsxs("span",{className:Pt.text,children:[t.jsx("span",{className:Pt.title,children:a})," ",p.hasContent(s)?t.jsx("span",{className:Pt.description,children:s}):null]})]})}Qr.displayName="StepsReadiness";function Xr({steps:e,currentStep:a,onStepChange:s,progressLabel:n,nextLabel:r,previousLabel:i=g=>g.label,finalActionLabel:c,onFinalAction:l,isFinalActionDisabled:d=!1,className:u,"data-testid":f="step-pager",previousTestId:m=`${f}-prev`,nextTestId:b=`${f}-next`,finalActionTestId:x=`${f}-final`}){const g=e[a-1],j=e[a+1],y=a===e.length-1;return t.jsxs("div",{"data-testid":f,className:o.cn(Ct.root,u),children:[t.jsx("div",{className:Ct.spacer,children:g?t.jsx(p.Button,{variant:"bordered",color:"default",testId:m,startContent:t.jsx(p.Icon,{"aria-hidden":!0,icon:"solar:arrow-left-outline",className:Ct.arrow}),onPress:()=>s(a-1),children:i(g)}):null}),t.jsx("span",{className:Ct.progress,children:n(a+1,e.length)}),t.jsx("div",{className:Ct.endSlot,children:j?t.jsx(p.Button,{color:"primary",testId:b,endContent:t.jsx(p.Icon,{"aria-hidden":!0,icon:"solar:arrow-right-outline",className:Ct.arrow}),onPress:()=>s(a+1),children:r(j)}):y&&c!==void 0&&l?t.jsx(p.Button,{color:"primary",testId:x,isDisabled:d,onPress:l,children:c}):null})]})}Xr.displayName="StepPager";function nd(){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 rd=e=>{const a=h.useMemo(()=>JSON.stringify({allItems:e.allItems,selected:e.selected}),[e.allItems,e.selected]);return t.jsx(id,{...e},a)},id=({allItems:e,selected:a,onSelectedChange:s,titleLeft:n,titleRight:r})=>{const[i,c]=h.useState([]),[l,d]=h.useState([]),[u,f]=h.useState(null),[m,b]=h.useState(null),x=h.useMemo(()=>new Set(a),[a]),g=h.useMemo(()=>new Set(e),[e]),j=h.useMemo(()=>e.filter(E=>!x.has(E)),[e,x]),y=E=>{if(E.length===0)return;const D=Array.from(new Set([...a,...E]));s(D)},v=E=>{if(E.length===0)return;const D=new Set(E);s(a.filter(I=>!D.has(I)))},C=()=>{i.length!==0&&(y(i),c([]))},S=()=>{l.length!==0&&(v(l),d([]))},k=()=>{j.length!==0&&(y(j),c([]))},$=()=>{a.length!==0&&(s([]),d([]))},_=(E,D,I)=>{const B=Math.min(D,I),z=Math.max(D,I);return E.slice(B,z+1)},w=(E,D,I)=>{if(I&&u!==null){c(_(j,u,D)),d([]),f(D);return}const B=i.includes(E);c(B?i.filter(z=>z!==E):[...i,E]),d([]),f(D)},F=(E,D,I)=>{if(I&&m!==null){d(_(a,m,D)),c([]),b(D);return}const B=l.includes(E);d(B?l.filter(z=>z!==E):[...l,E]),c([]),b(D)},A=(E,D,I)=>{const B=I==="available"?i.includes(D)?i:[D]:l.includes(D)?l:[D];E.dataTransfer.setData("text/plain",JSON.stringify({source:I,items:B})),E.dataTransfer.effectAllowed="move"},M=(E,D)=>{E.preventDefault();const I=E.dataTransfer.getData("text/plain");if(I)try{const B=JSON.parse(I),z=(B.items||[]).filter(q=>g.has(q));if(z.length===0||B.source===D)return;D==="selected"?(y(z),c([])):(v(z),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:n}),t.jsx(o.Card,{className:"w-full border border-gray-200 shadow-none",children:t.jsx(o.CardBody,{className:"h-60 gap-2 overflow-y-auto",onDragOver:E=>E.preventDefault(),onDrop:E=>M(E,"available"),children:j.map((E,D)=>{const I=i.includes(E);return t.jsx("button",{type:"button",onClick:B=>{w(E,D,B.shiftKey)},onMouseDown:B=>{B.shiftKey&&B.preventDefault()},draggable:!0,onDragStart:B=>A(B,E,"available"),className:`rounded-md px-3 py-2 text-left text-sm transition ${I?"bg-[#E4571E]/10 text-[#E4571E]":"text-gray-700 hover:bg-gray-100"}`,children:E},E)})})})]}),t.jsxs("div",{className:"flex flex-row items-center justify-center gap-3 md:flex-col md:pt-6",children:[t.jsx(p.Button,{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:C,isDisabled:i.length===0,"aria-label":"Move selected to right",children:"›"}),t.jsx(p.Button,{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:S,isDisabled:l.length===0,"aria-label":"Move selected to left",children:"‹"}),t.jsx(p.Button,{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:k,isDisabled:j.length===0,"aria-label":"Move all to right",children:"»"}),t.jsx(p.Button,{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:a.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(o.Card,{className:"w-full border border-gray-200 shadow-none",children:t.jsx(o.CardBody,{className:"h-60 gap-2 overflow-y-auto",onDragOver:E=>E.preventDefault(),onDrop:E=>M(E,"selected"),children:a.map((E,D)=>{const I=l.includes(E);return t.jsx("button",{type:"button",onClick:B=>{F(E,D,B.shiftKey)},onMouseDown:B=>{B.shiftKey&&B.preventDefault()},draggable:!0,onDragStart:B=>A(B,E,"selected"),className:`rounded-md px-3 py-2 text-left text-sm transition ${I?"bg-[#E4571E]/10 text-[#E4571E]":"text-gray-700 hover:bg-gray-100"}`,children:E},E)})})})]})]})};function Qt(e){return typeof e=="string"?e:e.type}function ht({className:e}){return t.jsx("div",{className:`flex items-center h-6 ${e||""}`,children:t.jsx(o.Divider,{orientation:"vertical"})})}function yt({icon:e,label:a,isActive:s=!1,isDisabled:n=!1,onClick:r,shortcut:i,iconSize:c=16,className:l}){const d=i?`${a} (${i})`:a;return t.jsx(o.Tooltip,{content:d,placement:"top",offset:10,children:t.jsx(p.Button,{size:"sm",radius:"sm",color:s?"primary":"default",variant:s?"solid":"bordered",isIconOnly:!0,isDisabled:n,onPress:r,"aria-label":a,className:l,children:t.jsx(e,{size:c})})})}const ot={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:a})=>{const s=a?.type==="textColor"?a.color:"";s?e.chain().focus().setColor(s).run():e.chain().focus().unsetColor().run()},canExecute:()=>!0,isActive:e=>e.isActive("textStyle"),label:"Text color"},highlight:{execute:({editor:e,config:a})=>{const s=a?.type==="highlight"?a.color:"";s?e.chain().focus().setHighlight({color:s}).run():e.chain().focus().unsetHighlight().run()},canExecute:()=>!0,isActive:e=>e.isActive("highlight"),label:"Highlight"},link:{execute:({editor:e,config:a})=>{const s=a?.type==="link"?a.href:"";if(s){const n=a?.type==="link"?a.target:void 0,r=a?.type==="link"?a.rel:void 0;e.chain().focus().setLink({href:s,target:n,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:a})=>{const s=a?.type==="heading"?a.level:1;e.chain().focus().toggleHeading({level:s}).run()},canExecute:(e,a)=>{const s=a?.type==="heading"?a.level:1;return e.can().chain().focus().toggleHeading({level:s}).run()},isActive:(e,a)=>a?.type==="heading"?e.isActive("heading",{level:a.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:a})=>{const s=a?.type==="textAlign"?a.alignment:"left";e.chain().focus().setTextAlign(s).run()},canExecute:()=>!0,isActive:(e,a)=>a?.type==="textAlign"?e.isActive({textAlign:a.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"}},ld={1:"Heading 1",2:"Heading 2",3:"Heading 3",4:"Heading 4",5:"Heading 5",6:"Heading 6"};function od({editor:e,levels:a=[1,2,3,4,5,6],isDisabled:s=!1}){const[,n]=h.useState(0);h.useEffect(()=>{const c=()=>n(l=>l+1);return e.on("selectionUpdate",c),e.on("transaction",c),()=>{e.off("selectionUpdate",c),e.off("transaction",c)}},[e]);const r=a.find(c=>e.isActive("heading",{level:c})),i=c=>{const l=Number(c),d=ot.heading;d&&d.execute({editor:e,config:{type:"heading",level:l}})};return t.jsxs(o.Dropdown,{placement:"top-start",offset:10,children:[t.jsx(o.DropdownTrigger,{children:t.jsx(p.Button,{size:"sm",radius:"sm",variant:r?"solid":"bordered",color:r?"primary":"default",isDisabled:s,startContent:t.jsx(J.Heading,{size:16}),"aria-label":"Select heading level",children:r?`H${r}`:"H"})}),t.jsx(o.DropdownMenu,{"aria-label":"Heading levels",selectionMode:"single",selectedKeys:r?new Set([String(r)]):new Set,onAction:i,children:a.map(c=>t.jsx(o.DropdownItem,{startContent:e.isActive("heading",{level:c})?t.jsx(J.Check,{size:16}):t.jsx("div",{className:"w-4"}),children:ld[c]},c))})]})}const Va={bulletList:{label:"Bullet List",icon:J.List},orderedList:{label:"Numbered List",icon:J.ListOrdered},taskList:{label:"Task List",icon:J.ListTodo}};function cd({editor:e,types:a=["bulletList","orderedList","taskList"],isDisabled:s=!1}){const[,n]=h.useState(0);h.useEffect(()=>{const l=()=>n(d=>d+1);return e.on("selectionUpdate",l),e.on("transaction",l),()=>{e.off("selectionUpdate",l),e.off("transaction",l)}},[e]);const r=a.find(l=>e.isActive(l)),i=r?Va[r].icon:J.List,c=l=>{const u=ot[l];u&&u.execute({editor:e})};return t.jsxs(o.Dropdown,{placement:"top-start",offset:10,children:[t.jsx(o.DropdownTrigger,{children:t.jsx(p.Button,{size:"sm",radius:"sm",variant:r?"solid":"bordered",color:r?"primary":"default",isDisabled:s,isIconOnly:!0,"aria-label":"Select list type",children:t.jsx(i,{size:16})})}),t.jsx(o.DropdownMenu,{"aria-label":"List types",selectionMode:"single",selectedKeys:r?new Set([r]):new Set,onAction:c,children:a.map(l=>{const d=Va[l].icon;return t.jsx(o.DropdownItem,{startContent:t.jsx(d,{size:16}),children:Va[l].label},l)})})]})}function dd({colors:e,selectedColor:a,onColorSelect:s,columns:n=4}){return t.jsx("div",{className:"grid gap-2",style:{gridTemplateColumns:`repeat(${n}, minmax(0, 1fr))`},children:e.map(r=>{const i=a===r;return t.jsx("button",{type:"button",onClick:()=>s(r),className:`
|
|
8
8
|
w-8 h-8 rounded-full border-2 cursor-pointer
|
|
9
9
|
transition-all duration-200
|
|
10
10
|
hover:scale-110 hover:shadow-md
|
|
11
11
|
focus:outline-none focus:ring-2 focus:ring-primary focus:ring-offset-2
|
|
12
12
|
${i?"border-primary ring-2 ring-primary ring-offset-2 scale-110":"border-divider"}
|
|
13
|
-
`,style:{backgroundColor:r},"aria-label":`Select color ${r}`,title:r},r)})})}const
|
|
13
|
+
`,style:{backgroundColor:r},"aria-label":`Select color ${r}`,title:r},r)})})}const ud=["#000000","#374151","#6B7280","#EF4444","#F59E0B","#10B981","#3B82F6","#8B5CF6","#EC4899","#14B8A6","#F97316","#A855F7"],md=["#FEF3C7","#DBEAFE","#D1FAE5","#FCE7F3","#E0E7FF","#FED7AA","#F3E8FF","#CCFBF1","#FEE2E2","#E5E7EB","#FAE8FF","#BFDBFE"];function Ua(e){return/^#([0-9A-F]{3}){1,2}$/i.test(e)}const Me={min:50,max:200,step:10,default:100},wn={lineHeight:24,toolbarHeight:60},fd={bold:J.Bold,italic:J.Italic,strike:J.Strikethrough,underline:J.Underline,code:J.Code,textColor:J.Palette,highlight:J.Highlighter,link:J.Link2,paragraph:J.FileText,heading:J.Heading,bulletList:J.List,orderedList:J.ListOrdered,taskList:J.ListTodo,codeBlock:J.CodeSquare,blockquote:J.Quote,horizontalRule:J.Minus,clearMarks:J.Eraser,clearNodes:J.Eraser,undo:J.Undo2,redo:J.Redo2,hardBreak:J.CornerDownLeft,textAlign:J.AlignLeft},xd={left:J.AlignLeft,center:J.AlignCenter,right:J.AlignRight,justify:J.AlignJustify};function Lt(e){return fd[e]}function pd({value:e,onChange:a,onApply:s,placeholder:n="#000000"}){const[r,i]=h.useState(""),c=u=>{const f=u.target.value;a(f),r&&i("")},l=()=>{if(!e){i("Please enter a color");return}if(!Ua(e)){i("Invalid hex color (e.g., #FF0000)");return}i(""),s(e)},d=u=>{u.key==="Enter"&&(u.preventDefault(),l())};return t.jsxs("div",{className:"space-y-2",children:[t.jsxs("div",{className:"flex gap-2",children:[t.jsx(o.Input,{type:"text",value:e,onChange:c,onKeyDown:d,placeholder:n,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:Ua(e)?e:"transparent"}})}),t.jsx(p.Button,{size:"sm",color:"primary",variant:"flat",isIconOnly:!0,onPress:l,"aria-label":"Apply custom color",isDisabled:!e||!Ua(e),children:t.jsx(J.Check,{size:16})})]}),t.jsx("p",{className:"text-xs text-default-500",children:"Enter a hex color code (e.g., #FF0000)"})]})}function Nn({editor:e,type:a,allowCustomColor:s=!0,label:n,isDisabled:r=!1}){const[i,c]=h.useState(!1),[l,d]=h.useState(""),u=a==="textColor"?ud:md,f=j=>{const y=ot[a];y&&y.execute({editor:e,config:{type:a,color:j}}),c(!1),d("")},m=j=>{f(j)},b=()=>{const j=ot[a];j&&j.execute({editor:e,config:{type:a,color:""}}),c(!1)},x=a==="textColor"?e.isActive("textStyle"):e.isActive("highlight"),g=a==="textColor"?J.Palette:J.Highlighter;return t.jsxs(o.Popover,{isOpen:i,onOpenChange:c,placement:"top",offset:10,showArrow:!0,children:[t.jsx(o.PopoverTrigger,{children:t.jsx(p.Button,{size:"sm",radius:"sm",variant:x?"solid":"bordered",color:x?"primary":"default",isIconOnly:!0,isDisabled:r,"aria-label":n,children:t.jsx(g,{size:16})})}),t.jsx(o.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:n}),t.jsx(p.Button,{size:"sm",variant:"light",isIconOnly:!0,onPress:b,"aria-label":"Clear color",children:t.jsx(J.X,{size:16})})]}),t.jsx(dd,{colors:u,onColorSelect:f}),s&&t.jsxs(t.Fragment,{children:[t.jsx(o.Divider,{}),t.jsxs("div",{children:[t.jsx("p",{className:"text-xs font-semibold mb-2 text-default-700",children:"Custom Color"}),t.jsx(pd,{value:l,onChange:d,onApply:m})]})]})]})})]})}function hd({zoom:e,onZoomChange:a,min:s=Me.min,max:n=Me.max,step:r=Me.step}){const i=()=>{const m=Math.max(s,e-r);a(m)},c=()=>{const m=Math.min(n,e+r);a(m)},l=()=>{a(Me.default)},d=e<=s,u=e>=n,f=e===Me.default;return t.jsxs("div",{className:"flex items-center gap-1",children:[t.jsx(o.Tooltip,{content:"Zoom out",placement:"top",offset:10,children:t.jsx(p.Button,{size:"sm",radius:"sm",color:"default",variant:"bordered",isIconOnly:!0,isDisabled:d,onPress:i,"aria-label":"Zoom out",children:t.jsx(J.ZoomOut,{size:16})})}),t.jsx(o.Tooltip,{content:f?"Zoom percentage":"Click to reset zoom",placement:"top",offset:10,children:t.jsxs("button",{type:"button",onClick:l,disabled:f,className:`
|
|
14
14
|
text-xs text-default-500 min-w-[3ch] text-center px-2
|
|
15
|
-
${
|
|
16
|
-
`,"aria-label":`Zoom level ${e}%`,children:[e,"%"]})}),t.jsx(o.Tooltip,{content:"Zoom in",placement:"top",offset:10,children:t.jsx(p.Button,{size:"sm",radius:"sm",color:"default",variant:"bordered",isIconOnly:!0,isDisabled:u,onPress:c,"aria-label":"Zoom in",children:t.jsx(J.ZoomIn,{size:16})})})]})}function pd({editor:e,isDisabled:a=!1}){const[s,n]=h.useState(!1),[r,i]=h.useState(""),[c,l]=h.useState(""),[d,u]=h.useState(!1),x=e.isActive("link"),m=f=>{if(f){const{from:g,to:j}=e.state.selection,y=e.isActive("link");let v="";if(y){const S=e.schema.marks.link,k=e.state.doc.resolve(g),$=dn.getMarkRange(k,S);$&&(v=e.state.doc.textBetween($.from,$.to,""))}else v=e.state.doc.textBetween(g,j,"");const C=e.getAttributes("link").href||"";i(v),l(C),u(y)}n(f)},b=()=>{if(c.trim()){const{from:f,to:g}=e.state.selection,j=e.schema.marks.link,y=e.state.doc.resolve(f),v=dn.getMarkRange(y,j),C=v?.from??f,S=v?.to??g,k=e.state.doc.textBetween(C,S,"");r.trim()&&r!==k?e.chain().focus().setTextSelection({from:C,to:S}).deleteSelection().insertContent(`<a href="${c.trim()}">${r.trim()}</a>`).run():e.chain().focus().extendMarkRange("link").updateAttributes("link",{href:c.trim()}).run()}n(!1)};return t.jsxs(o.Popover,{isOpen:s,onOpenChange:m,placement:"bottom",children:[t.jsx(o.PopoverTrigger,{children:t.jsx(p.Button,{size:"sm",radius:"sm",variant:x?"solid":"bordered",color:x?"primary":"default",isIconOnly:!0,isDisabled:a,"aria-label":"Link",children:t.jsx(J.Link,{size:16})})}),t.jsx(o.PopoverContent,{children:t.jsxs("div",{className:"flex flex-col gap-3 p-3 w-72",children:[t.jsx(o.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(o.Input,{size:"sm",variant:"bordered",label:"Link",labelPlacement:"outside",placeholder:"https://example.com",value:c,onChange:f=>l(f.target.value),onKeyDown:f=>f.key==="Enter"&&b(),classNames:{inputWrapper:"focus-within:border-default-400"}}),t.jsx(p.Button,{size:"sm",color:"primary",onPress:b,isDisabled:!c.trim(),children:d?"Update":"Apply"})]})})]})}function hd({children:e,id:a,label:s,className:n,useButtonGroup:r=!0}){return r?t.jsx(o.ButtonGroup,{size:"sm",id:a,"aria-label":s,className:n,children:e}):t.jsx("div",{id:a,role:"group","aria-label":s,className:`flex items-center gap-2 ${n||""}`,children:e})}function Xr(e,a){const s=h.useMemo(()=>{if(!e)return{};const i={};return Array.from(new Set(a.map(l=>Zt(l)))).forEach(l=>{const d=ot[l];if(d)try{const u=d.canExecute?.(e)??!0,x=d.isActive?.(e)??!1;i[l]={isActive:x,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,a]),[n,r]=h.useState(s);return h.useEffect(()=>{if(!e)return;const i=()=>{const c={};Array.from(new Set(a.map(d=>Zt(d)))).forEach(d=>{const u=ot[d];if(u)try{const x=u.canExecute?.(e)??!0,m=u.isActive?.(e)??!1;c[d]={isActive:m,isDisabled:!x,canExecute:x}}catch(x){console.warn(`Extension not available for modifier: ${d}`,x),c[d]={isActive:!1,isDisabled:!0,canExecute:!1}}}),r(c)};return e.on("selectionUpdate",i),e.on("transaction",i),()=>{e.off("selectionUpdate",i),e.off("transaction",i)}},[e,a,s]),n}function Jr(e,a){const s=h.useCallback((c,l)=>{if(!e)return;const d=ot[c];if(d)try{d.execute({editor:e,config:l}),a?.({type:"toggle",modifier:c})}catch(u){console.warn(`Failed to execute command for modifier: ${c}`,u)}},[e,a]),n=h.useCallback(c=>{s(c)},[s]),r=h.useCallback((c,l)=>{if(!e)return!1;const d=ot[c];try{return d?.canExecute?.(e,l)??!1}catch(u){return console.warn(`Failed to check canExecute for modifier: ${c}`,u),!1}},[e]),i=h.useCallback((c,l)=>{if(!e)return!1;const d=ot[c];try{return d?.isActive?.(e,l)??!1}catch(u){return console.warn(`Failed to check isActive for modifier: ${c}`,u),!1}},[e]);return{executeCommand:s,toggleModifier:n,canExecute:r,isActive:i}}function bd(e=Me.default){const[a,s]=h.useState(e),n=h.useCallback((l=Me.step)=>{s(d=>Math.min(Me.max,d+l))},[]),r=h.useCallback((l=Me.step)=>{s(d=>Math.max(Me.min,d-l))},[]),i=h.useCallback(()=>{s(Me.default)},[]),c=h.useCallback(l=>{const d=Math.max(Me.min,Math.min(Me.max,l));s(d)},[]);return{zoom:a,setZoom:c,zoomIn:n,zoomOut:r,resetZoom:i,isMinZoom:a<=Me.min,isMaxZoom:a>=Me.max,isDefaultZoom:a===Me.default}}const gd=["bold","italic","strike","underline","code"];function yd({editor:e,modifiers:a,onToolbarAction:s}){const n=Xr(e,a),{toggleModifier:r}=Jr(e,s);if(!e)return null;const i=a.map(c=>Zt(c)).filter(c=>gd.includes(c));return i.length===0?null:t.jsx(hd,{id:"text-formatting",label:"Text formatting",children:i.map(c=>{const l=n[c],d=Et(c);return t.jsx(gt,{icon:d,label:c.charAt(0).toUpperCase()+c.slice(1),isActive:l?.isActive,isDisabled:l?.isDisabled,onClick:()=>r(c)},c)})})}function vd({editor:e,modifiers:a,zoom:s=100,onZoomChange:n,sticky:r=!0,className:i,onToolbarAction:c}){const l=Xr(e,a),{toggleModifier:d,executeCommand:u}=Jr(e,c);if(!e)return null;const x=a.map(w=>Zt(w)),m=x.some(w=>["bold","italic","strike","underline","code"].includes(w)),b=x.some(w=>["textColor","highlight"].includes(w)),f=x.includes("heading"),g=x.includes("textAlign"),j=x.some(w=>["bulletList","orderedList","taskList"].includes(w)),y=x.includes("blockquote"),v=x.includes("codeBlock"),C=x.includes("link"),S=x.includes("horizontalRule"),k=x.some(w=>["undo","redo"].includes(w)),$=s!==void 0&&n!==void 0,_=r?"sticky top-0 z-10":"";return t.jsx("div",{className:`w-full p-2 bg-background border-b border-divider ${_} ${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(yd,{editor:e,modifiers:a,onToolbarAction:c}),(b||f||g||j||y||v||C||S||k||$)&&t.jsx(ht,{})]}),b&&t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"flex items-center gap-1",children:[x.includes("textColor")&&t.jsx(wn,{editor:e,type:"textColor",label:"Text color",isDisabled:l.textColor?.isDisabled}),x.includes("highlight")&&t.jsx(wn,{editor:e,type:"highlight",label:"Highlight",isDisabled:l.highlight?.isDisabled})]}),(f||g||j||y||v||C||S||k||$)&&t.jsx(ht,{})]}),f&&t.jsxs(t.Fragment,{children:[t.jsx(id,{editor:e}),(g||j||y||v||C||S||k||$)&&t.jsx(ht,{})]}),g&&t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"flex items-center gap-1",children:["left","center","right","justify"].map(w=>{const F=md[w],A=e.isActive({textAlign:w});return t.jsx(gt,{icon:F,label:`Align ${w}`,isActive:A,onClick:()=>u("textAlign",{type:"textAlign",alignment:w})},w)})}),(j||y||v||C||S||k||$)&&t.jsx(ht,{})]}),j&&t.jsxs(t.Fragment,{children:[t.jsx(ld,{editor:e,types:x.filter(w=>["bulletList","orderedList","taskList"].includes(w))}),(y||v||C||S||k||$)&&t.jsx(ht,{})]}),(y||v||C||S)&&t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"flex items-center gap-1",children:[y&&t.jsx(gt,{icon:Et("blockquote"),label:"Blockquote",isActive:l.blockquote?.isActive,isDisabled:l.blockquote?.isDisabled,onClick:()=>d("blockquote")}),v&&t.jsx(gt,{icon:Et("codeBlock"),label:"Code block",isActive:l.codeBlock?.isActive,isDisabled:l.codeBlock?.isDisabled,onClick:()=>d("codeBlock")}),C&&t.jsx(pd,{editor:e,isDisabled:l.link?.isDisabled}),S&&t.jsx(gt,{icon:Et("horizontalRule"),label:"Horizontal rule",onClick:()=>d("horizontalRule")})]}),(k||$)&&t.jsx(ht,{})]}),k&&t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"flex items-center gap-1",children:[x.includes("undo")&&t.jsx(gt,{icon:Et("undo"),label:"Undo",isDisabled:l.undo?.isDisabled,onClick:()=>d("undo")}),x.includes("redo")&&t.jsx(gt,{icon:Et("redo"),label:"Redo",isDisabled:l.redo?.isDisabled,onClick:()=>d("redo")})]}),$&&t.jsx(ht,{})]}),$&&t.jsx(xd,{zoom:s,onZoomChange:w=>{n?.(w),c?.({type:"zoom",modifier:`${w}%`})}})]})})}const Pt={bold:{category:"mark",extension:Bo.Bold,priority:100},italic:{category:"mark",extension:Po.Italic,priority:100},strike:{category:"mark",extension:To.Strike,priority:100},underline:{category:"mark",extension:Oo.Underline,priority:100},code:{category:"mark",extension:zo.Code,priority:100},textColor:{category:"mark",extension:Vo.Color,defaultOptions:{types:["textStyle","heading","paragraph","listItem","taskItem","blockquote"]},priority:90},highlight:{category:"mark",extension:Uo.Highlight,defaultOptions:{multicolor:!0},priority:90},link:{category:"mark",extension:Ho.Link,defaultOptions:{autolink:!0,linkOnPaste:!0,openOnClick:!1,HTMLAttributes:{class:"text-primary underline cursor-pointer"}},priority:100},heading:{category:"node",extension:qo.Heading,defaultOptions:{levels:[1,2,3,4,5,6]},priority:100},bulletList:{category:"node",extension:Ko.BulletList,defaultOptions:{HTMLAttributes:{class:"list-disc"}},priority:90},orderedList:{category:"node",extension:Yo.OrderedList,defaultOptions:{HTMLAttributes:{class:"list-decimal"}},priority:90},taskList:{category:"node",extension:Zo.TaskList,defaultOptions:{HTMLAttributes:{class:"task-list"}},priority:90},codeBlock:{category:"node",extension:Jo.CodeBlock,priority:100},blockquote:{category:"node",extension:ec.Blockquote,priority:100},horizontalRule:{category:"node",extension:tc.HorizontalRule,priority:100},hardBreak:{category:"node",extension:ac.HardBreak,priority:100},undo:{category:"extension",extension:un.History,priority:50},redo:{category:"extension",extension:un.History,priority:50},textAlign:{category:"extension",extension:sc.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}},jd=[nc.Document,rc.Text,Go.Paragraph,Wo.TextStyle.configure({HTMLAttributes:{}}),Xo.ListItem.configure({HTMLAttributes:{}}),Qo.TaskItem.configure({nested:!0}),ic.Dropcursor,lc.Gapcursor];function wd(e){const a=[],s=new Set,n=new Set;jd.forEach(l=>{l&&(a.push(l),n.add(l.name))});const r=e.map(l=>Zt(l)),i=new Set;return r.forEach(l=>{const d=Pt[l];d?.requiredExtensions&&d.requiredExtensions.forEach(u=>{i.add(u)})}),i.forEach(l=>{if(s.has(l))return;const d=Pt[l];if(!d||d.extension===null)return;const u=d.extension.name;if(n.has(u)){s.add(l);return}const x=d.defaultOptions?d.extension.configure(d.defaultOptions):d.extension;a.push(x),s.add(l),n.add(u)}),r.forEach(l=>{if(s.has(l))return;const d=Pt[l];if(!d){console.warn(`Extension config not found for modifier: ${l}`);return}if(d.extension===null){s.add(l);return}const u=d.extension.name;if(n.has(u)){s.add(l);return}const x=d.defaultOptions?d.extension.configure(d.defaultOptions):d.extension;a.push(x),s.add(l),n.add(u)}),a.sort((l,d)=>{const u=Object.values(Pt).find(f=>f?.extension?.name===l.name),x=Object.values(Pt).find(f=>f?.extension?.name===d.name),m=u?.priority??100;return(x?.priority??100)-m})}const ei={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"]},Nd={h1:`font-size: ${ye.fontSize["4xl"]}; font-weight: ${ye.fontWeight.semibold}; line-height: ${ye.lineHeight.tight}; margin: ${pe.md} 0 ${pe.sm} 0;`,h2:`font-size: ${ye.fontSize["2xl"]}; font-weight: ${ye.fontWeight.semibold}; line-height: ${ye.lineHeight.tight}; margin: ${pe.md} 0 ${pe.sm} 0;`,h3:`font-size: ${ye.fontSize.xl}; font-weight: ${ye.fontWeight.semibold}; line-height: ${ye.lineHeight.tight}; margin: ${pe.md} 0 ${pe.sm} 0;`,h4:`font-size: ${ye.fontSize.lg}; font-weight: ${ye.fontWeight.semibold}; line-height: ${ye.lineHeight.tight}; margin: ${pe.md} 0 ${pe.sm} 0;`,h5:`font-size: ${ye.fontSize.base}; font-weight: ${ye.fontWeight.semibold}; line-height: ${ye.lineHeight.tight}; margin: ${pe.md} 0 ${pe.sm} 0;`,h6:`font-size: ${ye.fontSize.sm}; font-weight: ${ye.fontWeight.semibold}; line-height: ${ye.lineHeight.tight}; margin: ${pe.md} 0 ${pe.sm} 0;`,p:`min-height: ${ye.lineHeight.normal}em; margin: 0;`,ul:`list-style-type: disc; list-style-position: outside; padding-left: ${pe.xl}; margin: ${pe.md} 0;`,ol:`list-style-type: decimal; list-style-position: outside; padding-left: ${pe.xl}; margin: ${pe.md} 0;`,li:`display: list-item; margin: ${pe.xs} 0;`,strong:`font-weight: ${ye.fontWeight.bold};`,em:"font-style: italic;",s:"text-decoration: line-through;",u:"text-decoration: underline;",code:`background-color: ${Ae.neutral.gray[100]}; border-radius: 0.4rem; font-size: ${ye.fontSize.sm}; padding: 0.25em 0.3em; font-family: ${ye.fontFamily.mono};`,pre:`background: ${Ae.neutral.gray[800]}; border-radius: ${pe.sm}; color: ${Ae.neutral.gray[100]}; font-family: ${ye.fontFamily.mono}; margin: ${pe.lg} 0; padding: 0.75rem ${pe.md}; overflow-x: auto;`,blockquote:`border-left: 3px solid ${Ae.neutral.gray[300]}; margin: ${pe.lg} 0; padding-left: ${pe.md}; color: ${Ae.neutral.gray[500]};`,hr:`border: none; border-top: 1px solid ${Ae.neutral.gray[200]}; margin: ${pe.xl} 0;`,a:`color: ${Ae.brand.primary.DEFAULT}; text-decoration: underline; cursor: pointer;`,mark:`background-color: ${Ae.palettes.warning[200]}; border-radius: ${pe.xs}; padding: 0 0.125rem;`,label:`display: flex; align-items: center; gap: ${pe.sm}; cursor: pointer;`,input:"cursor: pointer; margin: 0;"},Cd={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 kd(e){if(!e)return e;let a=e;for(const[s,n]of Object.entries(Cd)){const r=new RegExp(`(<(?:ul|li)[^>]*data-type="${s}"[^>]*)>`,"gi");a=a.replace(r,(i,c)=>i.includes('style="')?i.replace(/style="([^"]*)"/,`style="$1 ${n}"`):`${c} style="${n}">`)}for(const[s,n]of Object.entries(Nd)){const r=new RegExp(`<${s}(\\s[^>]*)?>`,"gi");a=a.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 ${n}"`);if(i.includes("style='"))return i.replace(/style='([^']*)'/,`style='$1 ${n}'`);{const c=i.indexOf(">");return`${i.slice(0,c)} style="${n}"${i.slice(c)}`}})}return a}const Sd=({modifiers:e,zoom:a,onZoomChange:s,onToolbarAction:n})=>{const{editor:r}=gs.useCurrentEditor();return t.jsx(vd,{editor:r,modifiers:e,zoom:a,onZoomChange:s,onToolbarAction:n})},$d=({showCharacterCount:e,showWordCount:a})=>{const{editor:s}=gs.useCurrentEditor();if(!s||!e&&!a)return null;const n=s.getText(),r=n.length,i=n.split(/\s+/).filter(c=>c.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"]}),a&&t.jsxs("span",{children:[i," words"]})]})},ls=h.forwardRef((e,a)=>{const{minRows:s=10,maxRows:n=30,disableAutosize:r=!1,showCharacterCount:i=!1,showWordCount:c=!1,showToolbar:l=!0,modifiers:d=ei.full,variant:u="bordered",initialContent:x,content:m,onContentChange:b,onUpdate:f,onToolbarAction:g,isReadOnly:j=!1,isDisabled:y=!1,includeInlineStyles:v=!0,...C}=e,{zoom:S,setZoom:k}=bd(),$=jn.lineHeight,_=s*$,w=r?void 0:n*$,F=h.useMemo(()=>wd(d),[d]),{Component:A,label:M,shouldLabelBeOutside:E,getBaseProps:D,getLabelProps:I,getInputWrapperProps:B}=o.useInput({...C,variant:u,ref:a,isMultiline:!0}),z=M?t.jsx("label",{...I(),children:M}):null,q=h.useCallback(({editor:P})=>{const ee=P.getHTML(),W=v?kd(ee):ee,Y=P.getJSON(),K=P.getText(),ie=K.length,te=K.split(/\s+/).filter(ne=>ne.length>0).length,Q={html:W,json:Y,text:K,characters:ie,words:te};if(b?.(Q),f?.(Q),"onChange"in C&&typeof C.onChange=="function"){const ne={target:{value:W},currentTarget:{value:W}};C.onChange(ne)}},[b,f,C,v]);return t.jsxs(A,{...D(),children:[E?z:null,t.jsx("div",{...B(),className:o.cn(B().className,"flex flex-col w-full p-0 gap-0 rich-text-editor"),style:{maxHeight:w?`${w+jn.toolbarHeight}px`:void 0,overflow:w?"auto":void 0},children:t.jsx(gs.EditorProvider,{editable:!j&&!y,slotBefore:l?t.jsx(Sd,{modifiers:d,zoom:S,onZoomChange:k,onToolbarAction:g}):void 0,slotAfter:t.jsx($d,{showCharacterCount:i,showWordCount:c}),editorContainerProps:{className:"w-full flex-1 outline-none",style:{minHeight:`${_}px`,fontSize:`${S}%`,display:"flex",flexDirection:"column"}},editorProps:{attributes:{class:"focus:outline-none w-full h-full"}},extensions:F,content:m||x||e.defaultValue||"",onUpdate:q})})]})});ls.displayName="TipTapEditor";const ti=h.forwardRef((e,a)=>{const{adapter:s="tiptap",variant:n="bordered",...r}=e;return s==="tiptap"?t.jsx(ls,{...r,variant:n,ref:a}):(console.warn(`Adapter "${s}" is not supported. Using TipTap.`),t.jsx(ls,{...r,variant:n,ref:a}))});ti.displayName="RichTextArea";function Nn(e,a="en-US",s="USD",n=!0){try{return new Intl.NumberFormat(a,n?{style:"currency",currency:s,minimumFractionDigits:0,maximumFractionDigits:2}:{style:"currency",currency:s}).format(e)}catch(r){return console.warn(`Invalid currency formatting: ${r}`),`${s} ${e.toFixed(2)}`}}function Ad(e="en-US",a="USD"){try{const s=new Intl.NumberFormat(e,{style:"currency",currency:a,currencyDisplay:"symbol"}),n=s.formatToParts(1),r=n.findIndex(d=>d.type==="currency"),i=n.findIndex(d=>d.type==="integer"),{minimumFractionDigits:c,maximumFractionDigits:l}=s.resolvedOptions();return{symbol:n[r]?.value??a,position:r>i?"end":"start",formatOptions:{style:"decimal",minimumFractionDigits:c,maximumFractionDigits:l}}}catch(s){return console.warn(`Invalid currency formatting: ${s}`),{symbol:a,position:"start",formatOptions:{style:"decimal",minimumFractionDigits:2,maximumFractionDigits:2}}}}const Cn=`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 ${p.stillTransitionClass} motion-reduce:data-[pressed=true]:scale-100 [html[data-pos-reduce-motion=true]_&]:data-[pressed=true]:scale-100`,kn=`border bg-white shadow-none ${p.stillTransitionClass}`,Dd={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:`${Cn} 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:`${kn} 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:`${Cn} 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:`${kn} 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"}},Ct={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"},Ed={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"}}},Sn=[{id:"100",amount:100},{id:"250",amount:250},{id:"500",amount:500},{id:"1000",amount:1e3},{id:"2000",amount:2e3}],Ld={title:"Donation Amount",customAmountPlaceholder:"Custom donation amount",customAmountAriaLabel:"Custom donation amount",addDonationButton:"Add Donation",presetsAriaLabel:"Suggested amounts"},ai=({presetAmounts:e=Sn,selectedDonation:a,defaultSelectedDonation:s=null,onChange:n,onAddDonation:r,currency:i="USD",locale:c="en-US",showCustomAmount:l=!0,minCustomAmount:d=.5,maxCustomAmount:u=1e6,labels:x,mobileColumns:m=2,desktopColumns:b=3,isDisabled:f=!1,buttonVariant:g="bordered",buttonColor:j="default",inputVariant:y="bordered",size:v="md",className:C="",showCard:S=!0,variant:k="pill",customAmountPlacement:$="below",isRequired:_=!1})=>{const w={...Ld,...x},F=h.useId(),A=`${F}-title`,M=`${F}-custom`,E=Array.isArray(e)?e:Sn,D={2:"grid-cols-2",3:"grid-cols-3"},I={3:"sm:grid-cols-3",4:"sm:grid-cols-4",5:"sm:grid-cols-5",6:"sm:grid-cols-6"},B=`${D[m]} ${I[b]}`,[z,q]=_t(a,s,n),[P,ee]=h.useState(()=>!r&&z?.isCustom?String(z.amount):""),[W,Y]=h.useState(!1),[K,ie]=h.useState(0),te=h.useCallback(ae=>{if(f)return;const be={amount:ae.amount,isCustom:!1,presetId:ae.id};q(be),ee(""),Y(!1),ie($e=>$e+1),r?.(be)},[f,q,r]),Q=h.useCallback(ae=>{if(f)return;if(ee(ae!==void 0?String(ae):""),r){q(null);return}if(Y(!1),ae===void 0||isNaN(ae)){q(null);return}q({amount:ae,isCustom:!0})},[f,q,r]),ne=h.useCallback(()=>{if(f)return;const ae=P!==""?parseFloat(P):void 0;ae===void 0||isNaN(ae)||r?.({amount:ae,isCustom:!0})},[f,P,r]),V=h.useMemo(()=>({style:"currency",currency:i,currencyDisplay:"symbol"}),[i]),O=h.useMemo(()=>Ad(c,i),[c,i]),Z=ae=>z!==null&&!z.isCustom&&z.presetId===ae.id,Re=(ae,be)=>{const $e=!r&&W,ge=k==="tile"&&$==="inline",We=ge?t.jsx("span",{className:Ct.affix,"data-testid":"donation-amounts-custom-symbol",children:O.symbol}):void 0,Le=t.jsxs("div",{className:o.cn("flex items-start gap-3",ge&&Ct.field),"data-testid":"donation-amounts-custom-field",children:[t.jsx(o.NumberInput,{id:M,placeholder:w.customAmountPlaceholder,"aria-label":ge?w.customAmountLabel??w.customAmountAriaLabel:w.customAmountLabel?void 0:w.customAmountAriaLabel,onInput:r?()=>{q(null),Y(!0)}:()=>Y(!0),onBlur:r?void 0:()=>Y(!1),variant:"bordered",minValue:d,maxValue:u,step:.01,formatOptions:ge?O.formatOptions:V,startContent:O.position==="start"?We:void 0,endContent:O.position==="end"?We:void 0,value:P!==""?parseFloat(P):void 0,onValueChange:Q,isDisabled:f,className:"flex-1",classNames:{inputWrapper:o.cn(ae.inputWrapper,be.wrapper,ge&&Ct.inputWrapper,$e&&ae.inputWrapperActive),input:o.cn(ae.input,be.input,ge&&Ct.input)},"data-testid":"donation-amounts-custom-input",hideStepper:!0},r?`custom-${K}`:z?.isCustom===!1?z.presetId:"custom"),r&&t.jsx(p.Button,{color:"primary",variant:"solid",size:v,className:"shrink-0",onPress:ne,isDisabled:f||!W,"data-testid":"donation-amounts-add-button",children:w.addDonationButton})]}),oe=l&&(ge?Le:t.jsxs("div",{className:o.cn("flex flex-col",ae.inputBase),children:[w.customAmountLabel&&t.jsx("label",{htmlFor:M,className:ae.customLabel,"data-testid":"donation-amounts-custom-label",children:w.customAmountLabel}),Le]}));return t.jsxs("div",{className:ae.root,"data-testid":"donation-amounts-root","data-variant":k,"data-custom-placement":ge?"inline":void 0,children:[w.eyebrow&&t.jsx("p",{className:ae.eyebrow,"data-testid":"donation-amounts-eyebrow",children:w.eyebrow}),w.title&&t.jsxs("p",{id:A,className:ae.title,"data-testid":"donation-amounts-title",children:[w.title,_&&t.jsx("span",{"aria-hidden":"true",className:"ml-0.5 text-pos-danger",children:"*"})]}),w.caption&&t.jsx("p",{className:ae.caption,"data-testid":"donation-amounts-caption",children:w.caption}),(E.length>0||ge&&oe)&&t.jsxs("div",{role:"group","aria-labelledby":w.title?A:void 0,"aria-label":w.title?void 0:w.presetsAriaLabel,className:ge?Ct.row:o.cn(ae.grid,k==="tile"&&B),"data-testid":"donation-amounts-presets",children:[E.map(de=>{const se=Z(de)&&!$e;return t.jsxs(p.Button,{color:"default",variant:"bordered",disableRipple:!0,"aria-pressed":se,className:o.cn(ae.preset,ge&&Ct.preset,se?ae.presetSelected:ae.presetIdle),onPress:()=>te(de),isDisabled:f,"data-selected":se||void 0,"data-testid":`donation-amounts-preset-${de.id}`,children:[t.jsx("span",{className:o.cn(ae.amount,se&&ae.amountSelected),children:de.label||Nn(de.amount,c,i,k!=="pos")}),de.sublabel&&" ",de.sublabel&&t.jsx("span",{className:ae.sublabel,"data-testid":`donation-amounts-preset-${de.id}-sublabel`,children:de.sublabel})]},de.id)}),ge&&oe]}),!ge&&oe]})},De=t.jsxs("div",{className:"space-y-4","data-testid":"donation-amounts-root",children:[w.title&&t.jsx("h2",{id:A,className:"text-base font-semibold","data-testid":"donation-amounts-title",children:w.title}),E.length>0&&t.jsx("div",{role:"group","aria-labelledby":w.title?A:void 0,"aria-label":w.title?void 0:w.presetsAriaLabel,className:o.cn("grid gap-3",B),"data-testid":"donation-amounts-presets",children:E.map(ae=>{const be=z!==null&&!z.isCustom&&z.presetId===ae.id;return t.jsx(p.Button,{color:be?"primary":j,variant:be?"solid":g,className:"w-full","aria-pressed":be,onPress:()=>te(ae),isDisabled:f,"data-testid":`donation-amounts-preset-${ae.id}`,children:ae.label||Nn(ae.amount,c,i)},ae.id)})}),l&&t.jsxs("div",{className:"flex gap-3 items-start",children:[t.jsx(o.NumberInput,{placeholder:w.customAmountPlaceholder,"aria-label":w.customAmountAriaLabel,onInput:r?()=>{q(null),Y(!0)}:void 0,variant:y,radius:"full",size:v,minValue:d,maxValue:u,step:.01,formatOptions:V,value:P!==""?parseFloat(P):void 0,onValueChange:Q,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-${K}`:z?.isCustom===!1?z.presetId:"custom"),r&&t.jsx(p.Button,{color:"primary",variant:"solid",radius:"full",size:v,className:"shrink-0",onPress:ne,isDisabled:f||!W,"data-testid":"donation-amounts-add-button",children:w.addDonationButton})]})]}),Ee=k==="pill"?De:Re(Dd[k],Ed[k][v]);return S?t.jsx(o.Card,{className:o.cn("w-full",C),"data-testid":"donation-amounts-card",children:t.jsx(o.CardBody,{children:Ee})}):t.jsx("div",{className:o.cn("w-full",C),"data-testid":"donation-amounts-plain",children:Ee})};ai.displayName="DonationAmounts";const Fd=e=>{const a=Math.max(0,e),s=Math.floor(a/60).toString().padStart(2,"0"),n=(a%60).toString().padStart(2,"0");return`${s}:${n} minutes`},_d=e=>{switch(e){case"warning":return J.Clock;case"error":return J.AlertCircle;case"success":return J.CheckCircle;default:return J.Clock}},Rd=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"}},si=h.forwardRef(({timeLeft:e,defaultTimeLeft:a=1200,onTimeChange:s,onExpire:n,variant:r="info",color:i="primary",message:c="Your cart expires in:",showIcon:l=!0,icon:d,position:u="fixed",autoStart:x=!0,formatTime:m=Fd,className:b,...f},g)=>{const[j,y]=_t(e!==void 0?Math.max(0,e):void 0,Math.max(0,a),s),v=h.useRef(null),C=h.useRef(!1);h.useEffect(()=>()=>{v.current&&clearInterval(v.current)},[]),h.useEffect(()=>{if(!x||j<=0){v.current&&(clearInterval(v.current),v.current=null);return}return v.current=setInterval(()=>{y(_=>_<=1?(v.current&&(clearInterval(v.current),v.current=null),C.current||(C.current=!0,n?.()),0):_-1)},1e3),()=>{v.current&&(clearInterval(v.current),v.current=null)}},[x,j,y,n]),h.useEffect(()=>{j>0&&(C.current=!1)},[j]);const S=d||_d(r),k=Rd(i),$={fixed:"fixed top-0 left-0",sticky:"sticky top-0",static:"static"};return t.jsx("div",{ref:g,role:"banner","aria-live":"polite","aria-label":`${c} ${m(j)}`,"data-testid":"expire-cart-timer",className:o.cn("w-full text-white z-50",k,$[u],b),...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(S,{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:c})]}),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(j)}`,"data-testid":"expire-cart-timer-value",children:m(j)})})]})})})});si.displayName="ExpireCartTimer";const kt=({icon:e,children:a,testId:s})=>t.jsxs("div",{className:"flex items-center gap-2 text-sm text-gray-600","data-testid":s,children:[t.jsx(p.Icon,{icon:e,width:20,className:"text-default-500"}),t.jsx("span",{children:a})]}),Id=({classes:e="",name:a,imageUrl:s,eventDate:n,eventTime:r,location:i,description:c,showImage:l=!1,compact:d=!1,layout:u="stacked",imageLoading:x="eager",showMoreButtonClassName:m,labels:b})=>{const[f,g]=h.useState(!1),[j,y]=h.useState(!1),v=h.useRef(null);return h.useEffect(()=>{const C=()=>{if(v.current){const S=v.current.scrollHeight>v.current.clientHeight;y(S)}};return C(),window.addEventListener("resize",C),()=>window.removeEventListener("resize",C)},[c]),u==="horizontal"?t.jsx(o.Card,{className:o.cn("border-0 shadow-none",e),"data-testid":"event-details-root",children:t.jsx(o.CardBody,{className:"p-0","data-testid":"event-details-horizontal-layout",children:t.jsxs("div",{className:"flex flex-col items-start gap-5 sm:flex-row sm:gap-8",children:[l&&s&&t.jsx("div",{className:"w-full shrink-0 overflow-hidden rounded-xl aspect-[3/2] sm:w-[360px]","data-testid":"event-details-image-wrapper",children:t.jsx(o.Image,{removeWrapper:!0,loading:x,alt:`Event image for ${a}`,className:"w-full h-full object-cover object-center",src:s,"data-testid":"event-details-image"})}),t.jsxs("div",{className:"min-w-0 flex-1 space-y-3",children:[t.jsx("h2",{className:"font-semibold text-2xl text-gray-800","data-testid":"event-details-title",children:a}),t.jsx("h3",{className:"font-semibold text-base text-gray-700","data-testid":"event-details-info-label",children:b.eventInformation}),t.jsxs("div",{className:"flex flex-wrap gap-4","data-testid":"event-details-info",children:[n&&t.jsx(kt,{icon:"solar:calendar-minimalistic-linear",testId:"event-details-date",children:n}),r&&t.jsx(kt,{icon:"solar:clock-circle-linear",testId:"event-details-time",children:r}),i&&t.jsx(kt,{icon:"solar:map-point-linear",testId:"event-details-location",children:i})]}),c&&t.jsxs("div",{className:"relative","data-testid":"event-details-description-wrapper",children:[t.jsxs("div",{className:"relative",children:[t.jsx("div",{ref:v,className:o.cn("text-sm text-gray-700 leading-relaxed transition-all",!f&&"line-clamp-3"),"data-testid":"event-details-description",dangerouslySetInnerHTML:{__html:c}}),!f&&j&&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"})]}),(j||f)&&t.jsx("div",{className:"flex justify-end mt-1",children:t.jsx(p.Button,{onPress:()=>g(!f),variant:"light",className:o.cn("text-primary",m),size:"md",startContent:t.jsx(p.Icon,{icon:f?"solar:eye-closed-linear":"solar:eye-linear",width:20}),"data-testid":"event-details-toggle-description",children:f?b.showLess||"Hide":b.showMore||"Show"})})]})]})]})})}):t.jsxs(o.Card,{className:o.cn("border-0 shadow-none",e),"data-testid":"event-details-root",children:[t.jsxs(o.CardHeader,{className:o.cn("pt-2 pb-0 flex-col items-start",d?"space-y-1":"space-y-2"),"data-testid":"event-details-header",children:[l&&s&&t.jsx("div",{className:o.cn("w-full overflow-hidden rounded-xl","aspect-[3/1]"),"data-testid":"event-details-image-wrapper",children:t.jsx(o.Image,{removeWrapper:!0,loading:x,alt:`Event image for ${a}`,className:"w-full h-full object-cover object-center",src:s,"data-testid":"event-details-image"})}),t.jsx("h2",{className:o.cn("font-semibold text-gray-800",d?"text-base":"text-xl"),"data-testid":"event-details-title",children:a})]}),t.jsxs(o.CardBody,{className:o.cn("space-y-3",d?"py-1 space-y-2":"py-3"),"data-testid":"event-details-body",children:[t.jsx("h3",{className:o.cn("font-semibold text-base text-gray-700",d?"text-sm":""),"data-testid":"event-details-info-label",children:b.eventInformation}),t.jsxs("div",{className:"flex flex-wrap gap-4","data-testid":"event-details-info",children:[n&&t.jsx(kt,{icon:"solar:calendar-minimalistic-linear",testId:"event-details-date",children:n}),r&&t.jsx(kt,{icon:"solar:clock-circle-linear",testId:"event-details-time",children:r}),i&&t.jsx(kt,{icon:"solar:map-point-linear",testId:"event-details-location",children:i})]}),c&&t.jsxs("div",{className:"relative","data-testid":"event-details-description-wrapper",children:[t.jsxs("div",{className:"relative",children:[t.jsx("div",{ref:v,className:o.cn("text-sm text-gray-700 leading-relaxed transition-all",d?"text-xs":"",!f&&"line-clamp-3"),"data-testid":"event-details-description",dangerouslySetInnerHTML:{__html:c}}),!f&&j&&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"})]}),(j||f)&&t.jsx("div",{className:"flex justify-end mt-1",children:t.jsx(p.Button,{onPress:()=>g(!f),variant:"light",className:o.cn("text-primary",m),size:d?"sm":"md",startContent:t.jsx(p.Icon,{icon:f?"solar:eye-closed-linear":"solar:eye-linear",width:d?16:20}),"data-testid":"event-details-toggle-description",children:f?b.showLess||"Hide":b.showMore||"Show"})})]})]})]})};function os(e,a="en-US",s="USD"){try{return new Intl.NumberFormat(a,{style:"currency",currency:s,minimumFractionDigits:2,maximumFractionDigits:2}).format(e)}catch(n){return console.warn(`Invalid currency formatting: ${n}`),`${s} ${e.toFixed(2)}`}}function Md(e){const a=e.replace(/[^\d.,-]/g,""),s=a.match(/,\d{1,2}$/);let n;s?n=a.replace(/\./g,"").replace(",","."):n=a.replace(/,/g,"");const r=parseFloat(n);return isNaN(r)?null:r}const Bd={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"},St=e=>typeof e=="number"&&!isNaN(e),ha=({offer:e,quantity:a,defaultQuantity:s=0,onQuantityChange:n,currency:r="USD",locale:i="en-US",labels:c,slots:l,isDisabled:d=!1,buttonVariant:u="bordered",buttonColor:x="default",showCard:m=!0,showDescription:b=!0,showPeopleCount:f=!0,showPrice:g=!0,priceDisplay:j,classNames:y={},"data-testid":v,selectedColor:C="default",selectionMode:S="stepper",compact:k=!1,isSoldOut:$,isMaxReached:_,isRuleBlocked:w,statusTone:F="default",statusLabel:A,disabledReason:M,disabled:E})=>{const D=h.useMemo(()=>({...Bd,...c}),[c]),[I,B]=h.useState(s),z=a!==void 0?a:I,q=!!(d||E),P=k||!!e.compact,ee=S==="press-to-add",W=h.useMemo(()=>typeof $=="boolean"?$:typeof e.isSoldOut=="boolean"?e.isSoldOut:!St(e.totalTicketsSold)||!St(e.ticketsAllowed)?!1:e.totalTicketsSold>=e.ticketsAllowed,[$,e.isSoldOut,e.totalTicketsSold,e.ticketsAllowed]),Y=h.useMemo(()=>typeof _=="boolean"?_:typeof e.isMaxReached=="boolean"?e.isMaxReached:W||!St(e.ticketsAllowed)?!1:z>=e.ticketsAllowed-(e.totalTicketsSold??0),[_,e.isMaxReached,W,e.ticketsAllowed,e.totalTicketsSold,z]),K=h.useMemo(()=>typeof w=="boolean"?w:typeof e.isRuleBlocked=="boolean"?e.isRuleBlocked:!1,[w,e.isRuleBlocked]),ie=M||e.disabledReason,te=q||W||K,Q=oe=>{if(te||oe>0&&Y)return;const de=Math.max(0,z+oe);a===void 0&&B(de),n?.(e.id,de)},ne=h.useMemo(()=>{if(W)return"soldOut";if(K)return"ruleBlocked";if(q)return"disabled"},[W,K,q]),V=h.useMemo(()=>F||(W||K?"danger":Y?"warning":"default"),[F,W,K,Y]),O=h.useMemo(()=>{if(ne)return ne==="ruleBlocked"?A||ie||D.ruleBlocked:ne==="soldOut"?A||ie||D.soldOut:ne==="disabled"?A||ie||D.disabled:A||D.maxReached},[ne,A,ie,D]),Z={soldOut:"danger",ruleBlocked:V,disabled:"default",maxReached:"warning"},Re={soldOut:"offer-card-sold-out-chip",maxReached:"offer-card-max-reached-chip",ruleBlocked:"offer-card-ruleBlocked-chip",disabled:"offer-card-disabled-chip"},De=()=>l?.renderName?l.renderName(e.name,e):t.jsx("h2",{"data-testid":"offer-card-name",className:o.cn("text-base font-medium",P&&"text-sm",y.name),children:e.name}),Ee=()=>{if(!g)return null;const oe=j?.price??e.price,de=j?.originalPrice,se=os(oe,i,r);if(l?.renderPrice)return l.renderPrice(oe,se,e);if(St(de)&&St(oe)&&de>oe){const L=os(de,i,r);return t.jsxs("div",{"data-testid":"offer-card-price",className:o.cn("flex items-center gap-2 mt-1",P&&"mt-0.5",y.price),children:[t.jsxs("span",{className:"sr-only",children:["Original price ",L,", discounted price ",se]}),t.jsx("span",{"aria-hidden":"true","data-testid":"offer-card-original-price",className:o.cn("text-gray-400 line-through text-sm",P&&"text-xs",y.originalPrice),children:L}),t.jsx("span",{"aria-hidden":"true","data-testid":"offer-card-discounted-price",className:o.cn("text-primary text-base font-semibold",P&&"text-sm",y.discountedPrice),children:se})]})}return t.jsx("p",{"data-testid":"offer-card-price",className:o.cn("text-primary text-base mt-1",P&&"text-sm mt-0.5",y.price),children:se})},ae=()=>!b||!e.description?null:l?.renderDescription?l.renderDescription(e.description,e):t.jsx("p",{"data-testid":"offer-card-description",className:o.cn("mb-4 text-sm text-gray-700 leading-relaxed",P&&"mb-2 text-xs text-gray-600",y.description),children:e.description}),be=()=>{if(!f||!St(e.numberOfPeople)||e.numberOfPeople<=0)return null;const oe=e.numberOfPeople===1?D.person:D.people;return l?.renderPeopleCount?l.renderPeopleCount(e.numberOfPeople,oe,e):t.jsxs("p",{"data-testid":"offer-card-people-count",className:o.cn("text-sm text-gray-600 flex items-center mt-2",P&&"mt-1 text-xs",y.peopleCount),children:[t.jsx(p.Icon,{icon:e.numberOfPeople<=1?"solar:user-rounded-outline":"solar:users-group-rounded-outline",width:20,className:"mr-1"}),e.numberOfPeople," ",oe]})},$e=()=>{const oe=z===0||te,de=Y||te;return l?.renderQuantitySelector?l.renderQuantitySelector({quantity:z,onIncrement:()=>Q(1),onDecrement:()=>Q(-1),isDecrementDisabled:oe,isIncrementDisabled:de,isDisabled:te}):t.jsxs("div",{className:o.cn("flex items-center gap-2",y.quantitySelector),children:[t.jsx(p.Button,{"data-testid":"offer-card-decrement-button",onPress:()=>Q(-1),isDisabled:oe,variant:u,color:z>0?C:x,radius:"full",isIconOnly:!0,size:P?"md":"sm","aria-label":"Decrease quantity",children:t.jsx(p.Icon,{icon:"gravity-ui:minus",width:16})}),t.jsx("span",{"data-testid":"offer-card-quantity",className:o.cn("min-w-[2rem] text-center font-medium",P&&"text-sm"),children:z}),t.jsx(p.Button,{"data-testid":"offer-card-increment-button",onPress:()=>Q(1),isDisabled:de,variant:u,color:z>0?C:x,radius:"full",isIconOnly:!0,size:P?"md":"sm","aria-label":"Increase quantity",children:t.jsx(p.Icon,{icon:"gravity-ui:plus",width:16})})]})},ge=(oe,de)=>l?.renderDisabledState?l.renderDisabledState(oe,de):oe==="soldOut"&&l?.renderSoldOut?l.renderSoldOut(de):oe==="maxReached"&&l?.renderMaxReachedAlert?l.renderMaxReachedAlert(de):t.jsx(o.Chip,{"data-testid":Re[oe],color:Z[oe],variant:oe==="maxReached"?"flat":"solid",className:o.cn("gap-2 px-4",oe==="maxReached"?"h-8":"h-10",oe==="soldOut"&&y.soldOut,oe==="maxReached"&&y.maxReachedAlert,P&&"h-8"),startContent:t.jsx(p.Icon,{icon:"gravity-ui:triangle-exclamation-fill",width:14}),children:t.jsx("span",{className:"font-medium text-sm",children:de})}),We=t.jsxs("div",{className:o.cn("grid grid-cols-1 md:grid-cols-1 xl:grid-cols-3 lg:grid-cols-3 items-start",P?"gap-1":"gap-2"),children:[t.jsxs("div",{className:o.cn("h-full col-span-2",te||Y?"opacity-50 pointer-events-none select-none":""),children:[De(),Ee(),t.jsxs("div",{className:o.cn("md:col-span-1 xl:col-span-2 lg:col-span-1",P?"mb-1":"mb-2"),children:[be(),ae()]})]}),!ee&&t.jsx("div",{className:o.cn("space-x-2 pt-0 pb-2 md:p-2 h-full flex items-center justify-start md:justify-start lg:justify-end",P&&"space-x-1 pb-1 md:p-1",y.compactFooter),children:ne&&O?ge(ne,O):$e()})]}),Le=Y&&!W&&!K&&!q?t.jsx(ze.motion.div,{className:o.cn("w-full sm:max-w-[60%] md:max-w-[60%] lg:max-w-[60%]",y.compactFooter),initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:10},transition:{duration:.3},children:ge("maxReached",O||D.maxReached)}):null;return m?t.jsxs(o.Card,{className:o.cn("w-full",ee&&!te&&!Y&&"cursor-pointer",P&&y.compact,y.base),"data-testid":v||`offer-card-${e.id}`,isPressable:ee&&!te&&!Y,onPress:ee&&!te&&!Y?()=>Q(1):void 0,children:[t.jsx(o.CardBody,{className:o.cn("pt-1 pb-0",P?"pb-0.5":"",y.body),children:We}),t.jsx(ze.AnimatePresence,{children:Le&&t.jsx(o.CardFooter,{className:o.cn("w-full mt-0 pt-0",P?"pt-1":"",y.footer),children:Le})})]}):t.jsxs("div",{className:o.cn("w-full",P&&y.compact,y.base),"data-testid":v||`offer-card-${e.id}`,children:[t.jsx("div",{className:o.cn("pt-1 pb-0",P?"pb-0.5":"",y.body),children:We}),t.jsx(ze.AnimatePresence,{children:Le&&t.jsx("div",{className:o.cn("w-full mt-0 pt-0",P?"pt-1":"",y.footer),children:Le})})]})};ha.displayName="OfferCard";const ni=({message:e="No offers available.",icon:a="solar:ticket-sale-outline",iconSize:s=48,showCard:n=!0,classNames:r={},renderEmpty:i})=>{if(i){const l=i();return n?t.jsx(o.Card,{"data-testid":"offer-card-empty",className:o.cn("w-full",r.base),children:t.jsx(o.CardBody,{"data-testid":"offer-card-empty-body",children:l})}):t.jsx("div",{"data-testid":"offer-card-empty",className:o.cn("w-full",r.base),children:l})}const c=t.jsxs("div",{"data-testid":"offer-card-empty-content",className:o.cn("flex flex-col items-center justify-center p-8 text-center text-gray-500",r.content),children:[t.jsx(p.Icon,{"data-testid":"offer-card-empty-icon",icon:a,width:s,className:o.cn("mb-4",r.icon)}),t.jsx("h3",{"data-testid":"offer-card-empty-message",className:o.cn("text-lg",r.message),children:e})]});return n?t.jsx(o.Card,{"data-testid":"offer-card-empty",className:o.cn("w-full",r.base),children:t.jsx(o.CardBody,{"data-testid":"offer-card-empty-body",children:c})}):t.jsx("div",{"data-testid":"offer-card-empty",className:o.cn("w-full",r.base),children:c})};ni.displayName="OfferCardEmpty";const Pd={title:"Error Fetching Offers",description:"An error occurred while fetching offers."},ri=({error:e,labels:a,showCard:s=!0,color:n="danger",classNames:r={}})=>{const i={...Pd,...a},c=t.jsx(o.Alert,{"data-testid":"offer-card-error-alert",color:n,title:i.title,description:e||i.description,className:r.alert});return s?t.jsx(o.Card,{"data-testid":"offer-card-error",className:o.cn("w-full",r.base),children:t.jsx(o.CardBody,{"data-testid":"offer-card-error-body",children:c})}):t.jsx("div",{"data-testid":"offer-card-error",className:o.cn("w-full",r.base),children:c})};ri.displayName="OfferCardError";const Td={1:"space-y-1",2:"space-y-2",3:"space-y-3",4:"space-y-4",5:"space-y-5",6:"space-y-6"},ii=({quantity:e=2,gap:a=4,classNames:s={}})=>{const n=Td[a];return t.jsx("div",{"data-testid":"offer-card-skeleton-container",className:o.cn(n,s.base),children:Array.from({length:e}).map((r,i)=>t.jsxs(o.Card,{"data-testid":`offer-card-skeleton-${i}`,className:o.cn("w-full",s.card),children:[t.jsx(o.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(p.Skeleton,{"data-testid":`offer-card-skeleton-title-${i}`,className:"w-1/3 rounded-lg",children:t.jsx("div",{className:"h-4 bg-default-200 rounded-lg"})}),t.jsx(p.Skeleton,{"data-testid":`offer-card-skeleton-subtitle-${i}`,className:"w-1/4 rounded-lg",children:t.jsx("div",{className:"h-3 bg-default-300 rounded-lg"})})]})}),t.jsx(o.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(p.Skeleton,{"data-testid":`offer-card-skeleton-people-${i}`,className:"w-1/4 rounded-lg",children:t.jsx("div",{className:"h-4 bg-default-300 rounded-lg"})}),t.jsx(p.Skeleton,{"data-testid":`offer-card-skeleton-description-${i}`,className:"w-3/4 rounded-lg",children:t.jsx("div",{className:"h-4 bg-default-200 rounded-lg"})})]}),t.jsx("div",{className:"flex items-start justify-end",children:t.jsxs("div",{"data-testid":`offer-card-skeleton-controls-${i}`,className:"flex items-center justify-end gap-2 w-full px-4 py-2",children:[t.jsx(p.Skeleton,{"data-testid":`offer-card-skeleton-label-${i}`,className:"w-24 h-4 rounded-md bg-default-200"}),t.jsxs("div",{className:"flex gap-2",children:[t.jsx(p.Skeleton,{"data-testid":`offer-card-skeleton-btn-dec-${i}`,className:"w-8 h-8 rounded-md bg-default-300"}),t.jsx(p.Skeleton,{"data-testid":`offer-card-skeleton-btn-qty-${i}`,className:"w-8 h-8 rounded-md bg-default-200"}),t.jsx(p.Skeleton,{"data-testid":`offer-card-skeleton-btn-inc-${i}`,className:"w-8 h-8 rounded-md bg-default-300"})]})]})})]})})]},i))})};ii.displayName="OfferCardSkeleton";const li={hidden:{opacity:0},show:{opacity:1,transition:{staggerChildren:.15,delayChildren:.1}}},oi={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"}}},Od={1:"gap-1",2:"gap-2",3:"gap-3",4:"gap-4",5:"gap-5",6:"gap-6"},ci=({offers:e=[],mapOffer:a,selection:s,defaultSelection:n={},onSelectionChange:r,onQuantityChange:i,currency:c="USD",locale:l="en-US",labels:d,slots:u,isDisabled:x=!1,buttonVariant:m="bordered",buttonColor:b="default",showCard:f=!0,animated:g=!0,gap:j=2,compact:y=!1,classNames:v={}})=>{const[C,S]=h.useState(n),k=s!==void 0?s:C,$=h.useCallback((E,D)=>{const I={...k,[E]:Math.max(0,D)};s===void 0&&S(I),r?.(I),i?.(E,I[E])},[k,s,r,i]),_=[...e].sort((E,D)=>(E.position??0)-(D.position??0)),w=E=>{const D=a?a(E):E,I=(k??{})[D.id]||0;return{offer:D,quantity:I,onQuantityChange:$,currency:c,locale:l,labels:d,slots:u,isDisabled:x,buttonVariant:m,buttonColor:b,showCard:f,compact:y}},F=Od[j],A=o.cn("grid mx-auto pt-2",F,v.base),M=E=>{const D=w(E);return t.jsx(ha,{offer:D.offer,quantity:D.quantity,onQuantityChange:D.onQuantityChange,currency:D.currency,locale:D.locale,labels:D.labels,slots:D.slots,isDisabled:D.isDisabled,buttonVariant:D.buttonVariant,buttonColor:D.buttonColor,showCard:D.showCard,compact:D.compact,classNames:v.card},D.offer.id)};return g?t.jsx(ze.motion.div,{"data-testid":"offer-card-list",className:A,variants:li,initial:"hidden",animate:"show",children:t.jsx(ze.AnimatePresence,{children:_.map(E=>{const D=w(E);return t.jsx(ze.motion.div,{"data-testid":`offer-card-list-item-${D.offer.id}`,className:v.cardWrapper,variants:oi,exit:{opacity:0,y:-20},transition:{duration:.3},children:t.jsx(ha,{offer:D.offer,quantity:D.quantity,onQuantityChange:$,currency:c,locale:l,labels:d,slots:u,isDisabled:x,buttonVariant:m,buttonColor:b,showCard:f,compact:y||D.offer.compact,classNames:v.card})},D.offer.id)})})}):t.jsx("div",{"data-testid":"offer-card-list",className:A,children:_.map(M)})};ci.displayName="OfferCardList";var Jt=e=>e.type==="checkbox",vt=e=>e instanceof Date,He=e=>e==null;const di=e=>typeof e=="object";var Se=e=>!He(e)&&!Array.isArray(e)&&di(e)&&!vt(e),ui=e=>Se(e)&&e.target?Jt(e.target)?e.target.checked:e.target.value:e,zd=e=>e.substring(0,e.search(/\.\d+(\.|$)/))||e,mi=(e,a)=>e.has(zd(a)),Vd=e=>{const a=e.constructor&&e.constructor.prototype;return Se(a)&&a.hasOwnProperty("isPrototypeOf")},Ss=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function Ne(e){if(e instanceof Date)return new Date(e);const a=typeof FileList<"u"&&e instanceof FileList;if(Ss&&(e instanceof Blob||a))return e;const s=Array.isArray(e);if(!s&&!(Se(e)&&Vd(e)))return e;const n=s?[]:Object.create(Object.getPrototypeOf(e));for(const r in e)Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=Ne(e[r]));return n}var Aa=e=>/^\w*$/.test(e),he=e=>e===void 0,$s=e=>Array.isArray(e)?e.filter(Boolean):[],As=e=>$s(e.replace(/["|']|\]/g,"").split(/\.|\[/)),G=(e,a,s)=>{if(!a||!Se(e))return s;const n=(Aa(a)?[a]:As(a)).reduce((r,i)=>He(r)?r:r[i],e);return he(n)||n===e?he(e[a])?s:e[a]:n},Ge=e=>typeof e=="boolean",Oe=e=>typeof e=="function",xe=(e,a,s)=>{let n=-1;const r=Aa(a)?[a]:As(a),i=r.length,c=i-1;for(;++n<i;){const l=r[n];let d=s;if(n!==c){const u=e[l];d=Se(u)||Array.isArray(u)?u:isNaN(+r[n+1])?{}:[]}if(l==="__proto__"||l==="constructor"||l==="prototype")return;e[l]=d,e=e[l]}};const ba={BLUR:"blur",FOCUS_OUT:"focusout",CHANGE:"change"},et={onBlur:"onBlur",onChange:"onChange",onSubmit:"onSubmit",onTouched:"onTouched",all:"all"},nt={max:"max",min:"min",maxLength:"maxLength",minLength:"minLength",pattern:"pattern",required:"required",validate:"validate"},fi=h.createContext(null);fi.displayName="HookFormControlContext";const Ds=()=>h.useContext(fi);var xi=(e,a,s,n=!0)=>{const r={defaultValues:a._defaultValues};for(const i in e)Object.defineProperty(r,i,{get:()=>{const c=i;return a._proxyFormState[c]!==et.all&&(a._proxyFormState[c]=!n||et.all),s&&(s[c]=!0),e[c]}});return r};const Es=typeof window<"u"?h.useLayoutEffect:h.useEffect;function Ud(e){const a=Ds(),{control:s=a,disabled:n,name:r,exact:i}=e||{},[c,l]=h.useState(s._formState),d=h.useRef({isDirty:!1,isLoading:!1,dirtyFields:!1,touchedFields:!1,validatingFields:!1,isValidating:!1,isValid:!1,errors:!1});return Es(()=>s._subscribe({name:r,formState:d.current,exact:i,callback:u=>{!n&&l({...s._formState,...u})}}),[r,n,i]),h.useEffect(()=>{d.current.isValid&&s._setValid(!0)},[s]),h.useMemo(()=>xi(c,s,d.current,!1),[c,s])}var Ye=e=>typeof e=="string",cs=(e,a,s,n,r)=>Ye(e)?(n&&a.watch.add(e),G(s,e,r)):Array.isArray(e)?e.map(i=>(n&&a.watch.add(i),G(s,i))):(n&&(a.watchAll=!0),s),ds=e=>He(e)||!di(e);function tt(e,a,s=new WeakSet){if(ds(e)||ds(a))return Object.is(e,a);if(vt(e)&&vt(a))return Object.is(e.getTime(),a.getTime());const n=Object.keys(e),r=Object.keys(a);if(n.length!==r.length)return!1;if(s.has(e)||s.has(a))return!0;s.add(e),s.add(a);for(const i of n){const c=e[i];if(!r.includes(i))return!1;if(i!=="ref"){const l=a[i];if(vt(c)&&vt(l)||Se(c)&&Se(l)||Array.isArray(c)&&Array.isArray(l)?!tt(c,l,s):!Object.is(c,l))return!1}}return!0}function Hd(e){const a=Ds(),{control:s=a,name:n,defaultValue:r,disabled:i,exact:c,compute:l}=e||{},d=h.useRef(r),u=h.useRef(l),x=h.useRef(void 0),m=h.useRef(s),b=h.useRef(n);u.current=l;const[f,g]=h.useState(()=>{const k=s._getWatch(n,d.current);return u.current?u.current(k):k}),j=h.useCallback(k=>{const $=cs(n,s._names,k||s._formValues,!1,d.current);return u.current?u.current($):$},[s._formValues,s._names,n]),y=h.useCallback(k=>{if(!i){const $=cs(n,s._names,k||s._formValues,!1,d.current);if(u.current){const _=u.current($);tt(_,x.current)||(g(_),x.current=_)}else g($)}},[s._formValues,s._names,i,n]);Es(()=>((m.current!==s||!tt(b.current,n))&&(m.current=s,b.current=n,y()),s._subscribe({name:n,formState:{values:!0},exact:c,callback:k=>{y(k.values)}})),[s,c,n,y]),h.useEffect(()=>s._removeUnmounted());const v=m.current!==s,C=b.current,S=h.useMemo(()=>{if(i)return null;const k=!v&&!tt(C,n);return v||k?j():null},[i,v,n,C,j]);return S!==null?S:f}function Wd(e){const a=Ds(),{name:s,disabled:n,control:r=a,shouldUnregister:i,defaultValue:c,exact:l=!0}=e,d=mi(r._names.array,s),u=h.useMemo(()=>G(r._formValues,s,G(r._defaultValues,s,c)),[r,s,c]),x=Hd({control:r,name:s,defaultValue:u,exact:l}),m=Ud({control:r,name:s,exact:l}),b=h.useRef(e),f=h.useRef(void 0),g=h.useRef(r.register(s,{...e.rules,value:x,...Ge(e.disabled)?{disabled:e.disabled}:{}}));b.current=e;const j=h.useMemo(()=>Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!G(m.errors,s)},isDirty:{enumerable:!0,get:()=>!!G(m.dirtyFields,s)},isTouched:{enumerable:!0,get:()=>!!G(m.touchedFields,s)},isValidating:{enumerable:!0,get:()=>!!G(m.validatingFields,s)},error:{enumerable:!0,get:()=>G(m.errors,s)}}),[m,s]),y=h.useCallback(k=>g.current.onChange({target:{value:ui(k),name:s},type:ba.CHANGE}),[s]),v=h.useCallback(()=>g.current.onBlur({target:{value:G(r._formValues,s),name:s},type:ba.BLUR}),[s,r._formValues]),C=h.useCallback(k=>{const $=G(r._fields,s);$&&$._f&&k&&($._f.ref={focus:()=>Oe(k.focus)&&k.focus(),select:()=>Oe(k.select)&&k.select(),setCustomValidity:_=>Oe(k.setCustomValidity)&&k.setCustomValidity(_),reportValidity:()=>Oe(k.reportValidity)&&k.reportValidity()})},[r._fields,s]),S=h.useMemo(()=>({name:s,value:x,...Ge(n)||m.disabled?{disabled:m.disabled||n}:{},onChange:y,onBlur:v,ref:C}),[s,n,m.disabled,y,v,C,x]);return h.useEffect(()=>{const k=r._options.shouldUnregister||i,$=f.current;$&&$!==s&&!d&&r.unregister($),r.register(s,{...b.current.rules,...Ge(b.current.disabled)?{disabled:b.current.disabled}:{}});const _=(w,F)=>{const A=G(r._fields,w);A&&A._f&&(A._f.mount=F)};if(_(s,!0),k){const w=Ne(G(r._options.defaultValues,s,b.current.defaultValue));xe(r._defaultValues,s,w),he(G(r._formValues,s))&&xe(r._formValues,s,w)}return!d&&r.register(s),f.current=s,()=>{(d?k&&!r._state.action:k)?r.unregister(s):_(s,!1)}},[s,r,d,i]),h.useEffect(()=>{r._setDisabledField({disabled:n,name:s})},[n,s,r]),h.useMemo(()=>({field:S,formState:m,fieldState:j}),[S,m,j])}const qd=h.createContext(null);qd.displayName="HookFormContext";var Gd=(e,a,s,n,r)=>a?{...s[e],types:{...s[e]&&s[e].types?s[e].types:{},[n]:r||!0}}:{},Gt=e=>Array.isArray(e)?e:[e],$n=()=>{let e=[];return{get observers(){return e},next:r=>{for(const i of e)i.next&&i.next(r)},subscribe:r=>(e.push(r),{unsubscribe:()=>{e=e.filter(i=>i!==r)}}),unsubscribe:()=>{e=[]}}};function pi(e,a){const s={};for(const n in e)if(e.hasOwnProperty(n)){const r=e[n],i=a[n];if(r&&Se(r)&&i){const c=pi(r,i);Se(c)&&(s[n]=c)}else e[n]&&(s[n]=i)}return s}var Te=e=>Se(e)&&!Object.keys(e).length,Ls=e=>e.type==="file",ga=e=>{if(!Ss)return!1;const a=e?e.ownerDocument:0;return e instanceof(a&&a.defaultView?a.defaultView.HTMLElement:HTMLElement)},hi=e=>e.type==="select-multiple",Fs=e=>e.type==="radio",Kd=e=>Fs(e)||Jt(e),Ua=e=>ga(e)&&e.isConnected;function Yd(e,a){const s=a.slice(0,-1).length;let n=0;for(;n<s;)e=he(e)?n++:e[a[n++]];return e}function Zd(e){for(const a in e)if(e.hasOwnProperty(a)&&!he(e[a]))return!1;return!0}function Ce(e,a){const s=Array.isArray(a)?a:Aa(a)?[a]:As(a),n=s.length===1?e:Yd(e,s),r=s.length-1,i=s[r];return n&&delete n[i],r!==0&&(Se(n)&&Te(n)||Array.isArray(n)&&Zd(n))&&Ce(e,s.slice(0,-1)),e}var Qd=e=>{for(const a in e)if(Oe(e[a]))return!0;return!1};function bi(e){return Array.isArray(e)||Se(e)&&!Qd(e)}function us(e,a={}){for(const s in e){const n=e[s];bi(n)?(a[s]=Array.isArray(n)?[]:{},us(n,a[s])):he(n)||(a[s]=!0)}return a}function Lt(e,a,s){s||(s=us(a));for(const n in e){const r=e[n];if(bi(r))he(a)||ds(s[n])?s[n]=us(r,Array.isArray(r)?[]:{}):Lt(r,He(a)?{}:a[n],s[n]);else{const i=a[n];s[n]=!tt(r,i)}}return s}const An={value:!1,isValid:!1},Dn={value:!0,isValid:!0};var gi=e=>{if(Array.isArray(e)){if(e.length>1){const a=e.filter(s=>s&&s.checked&&!s.disabled).map(s=>s.value);return{value:a,isValid:!!a.length}}return e[0].checked&&!e[0].disabled?e[0].attributes&&!he(e[0].attributes.value)?he(e[0].value)||e[0].value===""?Dn:{value:e[0].value,isValid:!0}:Dn:An}return An},yi=(e,{valueAsNumber:a,valueAsDate:s,setValueAs:n})=>he(e)?e:a?e===""?NaN:e&&+e:s&&Ye(e)?new Date(e):n?n(e):e;const En={isValid:!1,value:null};var vi=e=>Array.isArray(e)?e.reduce((a,s)=>s&&s.checked&&!s.disabled?{isValid:!0,value:s.value}:a,En):En;function Ln(e){const a=e.ref;return Ls(a)?a.files:Fs(a)?vi(e.refs).value:hi(a)?[...a.selectedOptions].map(({value:s})=>s):Jt(a)?gi(e.refs).value:yi(he(a.value)?e.ref.value:a.value,e)}var Xd=(e,a,s,n)=>{const r={};for(const i of e){const c=G(a,i);c&&xe(r,i,c._f)}return{criteriaMode:s,names:[...e],fields:r,shouldUseNativeValidation:n}},ya=e=>e instanceof RegExp,Tt=e=>he(e)?e:ya(e)?e.source:Se(e)?ya(e.value)?e.value.source:e.value:e,Fn=e=>({isOnSubmit:!e||e===et.onSubmit,isOnBlur:e===et.onBlur,isOnChange:e===et.onChange,isOnAll:e===et.all,isOnTouch:e===et.onTouched});const _n="AsyncFunction";var Jd=e=>!!e&&!!e.validate&&!!(Oe(e.validate)&&e.validate.constructor.name===_n||Se(e.validate)&&Object.values(e.validate).find(a=>a.constructor.name===_n)),eu=e=>e.mount&&(e.required||e.min||e.max||e.maxLength||e.minLength||e.pattern||e.validate),Rn=(e,a,s)=>!s&&(a.watchAll||a.watch.has(e)||[...a.watch].some(n=>e.startsWith(n)&&/^\.\w+/.test(e.slice(n.length))));const Kt=(e,a,s,n)=>{for(const r of s||Object.keys(e)){const i=G(e,r);if(i){const{_f:c,...l}=i;if(c){if(c.refs&&c.refs[0]&&a(c.refs[0],r)&&!n)return!0;if(c.ref&&a(c.ref,c.name)&&!n)return!0;if(Kt(l,a))break}else if(Se(l)&&Kt(l,a))break}}};function In(e,a,s){const n=G(e,s);if(n||Aa(s))return{error:n,name:s};const r=s.split(".");for(;r.length;){const i=r.join("."),c=G(a,i),l=G(e,i);if(c&&!Array.isArray(c)&&s!==i)return{name:s};if(l&&l.type)return{name:i,error:l};if(l&&l.root&&l.root.type)return{name:`${i}.root`,error:l.root};r.pop()}return{name:s}}var tu=(e,a,s,n)=>{s(e);const{name:r,...i}=e;return Te(i)||Object.keys(i).length>=Object.keys(a).length||Object.keys(i).find(c=>a[c]===(!n||et.all))},au=(e,a,s)=>!e||!a||e===a||Gt(e).some(n=>n&&(s?n===a:n.startsWith(a)||a.startsWith(n))),su=(e,a,s,n,r)=>r.isOnAll?!1:!s&&r.isOnTouch?!(a||e):(s?n.isOnBlur:r.isOnBlur)?!e:(s?n.isOnChange:r.isOnChange)?e:!0,nu=(e,a)=>!$s(G(e,a)).length&&Ce(e,a),ru=(e,a,s)=>{const n=Gt(G(e,s));return xe(n,"root",a[s]),xe(e,s,n),e};function Mn(e,a,s="validate"){if(Ye(e)||Array.isArray(e)&&e.every(Ye)||Ge(e)&&!e)return{type:s,message:Ye(e)?e:"",ref:a}}var $t=e=>Se(e)&&!ya(e)?e:{value:e,message:""},Bn=async(e,a,s,n,r,i)=>{const{ref:c,refs:l,required:d,maxLength:u,minLength:x,min:m,max:b,pattern:f,validate:g,name:j,valueAsNumber:y,mount:v}=e._f,C=G(s,j);if(!v||a.has(j))return{};const S=l?l[0]:c,k=D=>{r&&S.reportValidity&&(S.setCustomValidity(Ge(D)?"":D||""),S.reportValidity())},$={},_=Fs(c),w=Jt(c),F=_||w,A=(y||Ls(c))&&he(c.value)&&he(C)||ga(c)&&c.value===""||C===""||Array.isArray(C)&&!C.length,M=Gd.bind(null,j,n,$),E=(D,I,B,z=nt.maxLength,q=nt.minLength)=>{const P=D?I:B;$[j]={type:D?z:q,message:P,ref:c,...M(D?z:q,P)}};if(i?!Array.isArray(C)||!C.length:d&&(!F&&(A||He(C))||Ge(C)&&!C||w&&!gi(l).isValid||_&&!vi(l).isValid)){const{value:D,message:I}=Ye(d)?{value:!!d,message:d}:$t(d);if(D&&($[j]={type:nt.required,message:I,ref:S,...M(nt.required,I)},!n))return k(I),$}if(!A&&(!He(m)||!He(b))){let D,I;const B=$t(b),z=$t(m);if(!He(C)&&!isNaN(C)){const q=c.valueAsNumber||C&&+C;He(B.value)||(D=q>B.value),He(z.value)||(I=q<z.value)}else{const q=c.valueAsDate||new Date(C),P=Y=>new Date(new Date().toDateString()+" "+Y),ee=c.type=="time",W=c.type=="week";Ye(B.value)&&C&&(D=ee?P(C)>P(B.value):W?C>B.value:q>new Date(B.value)),Ye(z.value)&&C&&(I=ee?P(C)<P(z.value):W?C<z.value:q<new Date(z.value))}if((D||I)&&(E(!!D,B.message,z.message,nt.max,nt.min),!n))return k($[j].message),$}if((u||x)&&!A&&(Ye(C)||i&&Array.isArray(C))){const D=$t(u),I=$t(x),B=!He(D.value)&&C.length>+D.value,z=!He(I.value)&&C.length<+I.value;if((B||z)&&(E(B,D.message,I.message),!n))return k($[j].message),$}if(f&&!A&&Ye(C)){const{value:D,message:I}=$t(f);if(ya(D)&&!C.match(D)&&($[j]={type:nt.pattern,message:I,ref:c,...M(nt.pattern,I)},!n))return k(I),$}if(g){if(Oe(g)){const D=await g(C,s),I=Mn(D,S);if(I&&($[j]={...I,...M(nt.validate,I.message)},!n))return k(I.message),$}else if(Se(g)){let D={};for(const I in g){if(!Te(D)&&!n)break;const B=Mn(await g[I](C,s),S,I);B&&(D={...B,...M(I,B.message)},k(B.message),n&&($[j]=D))}if(!Te(D)&&($[j]={ref:S,...D},!n))return $}}return k(!0),$};const iu={mode:et.onSubmit,reValidateMode:et.onChange,shouldFocusError:!0};function lu(e={}){let a={...iu,...e},s={submitCount:0,isDirty:!1,isReady:!1,isLoading:Oe(a.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{},errors:a.errors||{},disabled:a.disabled||!1},n={},r=Se(a.defaultValues)||Se(a.values)?Ne(a.defaultValues||a.values)||{}:{},i=a.shouldUnregister?{}:Ne(r),c={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 x={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1},m={...x};let b={...m};const f={array:$n(),state:$n()},g=a.criteriaMode===et.all,j=N=>L=>{clearTimeout(u),u=setTimeout(N,L)},y=async N=>{if(!c.keepIsValid&&!a.disabled&&(m.isValid||b.isValid||N)){let L;a.resolver?(L=Te((await F()).errors),v()):L=await M(n,!0),L!==s.isValid&&f.state.next({isValid:L})}},v=(N,L)=>{!a.disabled&&(m.isValidating||m.validatingFields||b.isValidating||b.validatingFields)&&((N||Array.from(l.mount)).forEach(R=>{R&&(L?xe(s.validatingFields,R,L):Ce(s.validatingFields,R))}),f.state.next({validatingFields:s.validatingFields,isValidating:!Te(s.validatingFields)}))},C=(N,L=[],R,H,U=!0,T=!0)=>{if(H&&R&&!a.disabled){if(c.action=!0,T&&Array.isArray(G(n,N))){const X=R(G(n,N),H.argA,H.argB);U&&xe(n,N,X)}if(T&&Array.isArray(G(s.errors,N))){const X=R(G(s.errors,N),H.argA,H.argB);U&&xe(s.errors,N,X),nu(s.errors,N)}if((m.touchedFields||b.touchedFields)&&T&&Array.isArray(G(s.touchedFields,N))){const X=R(G(s.touchedFields,N),H.argA,H.argB);U&&xe(s.touchedFields,N,X)}(m.dirtyFields||b.dirtyFields)&&(s.dirtyFields=Lt(r,i)),f.state.next({name:N,isDirty:D(N,L),dirtyFields:s.dirtyFields,errors:s.errors,isValid:s.isValid})}else xe(i,N,L)},S=(N,L)=>{xe(s.errors,N,L),f.state.next({errors:s.errors})},k=N=>{s.errors=N,f.state.next({errors:s.errors,isValid:!1})},$=(N,L,R,H)=>{const U=G(n,N);if(U){const T=G(i,N,he(R)?G(r,N):R);he(T)||H&&H.defaultChecked||L?xe(i,N,L?T:Ln(U._f)):z(N,T),c.mount&&!c.action&&y()}},_=(N,L,R,H,U)=>{let T=!1,X=!1;const ue={name:N};if(!a.disabled){if(!R||H){(m.isDirty||b.isDirty)&&(X=s.isDirty,s.isDirty=ue.isDirty=D(),T=X!==ue.isDirty);const me=tt(G(r,N),L);X=!!G(s.dirtyFields,N),me?Ce(s.dirtyFields,N):xe(s.dirtyFields,N,!0),ue.dirtyFields=s.dirtyFields,T=T||(m.dirtyFields||b.dirtyFields)&&X!==!me}if(R){const me=G(s.touchedFields,N);me||(xe(s.touchedFields,N,R),ue.touchedFields=s.touchedFields,T=T||(m.touchedFields||b.touchedFields)&&me!==R)}T&&U&&f.state.next(ue)}return T?ue:{}},w=(N,L,R,H)=>{const U=G(s.errors,N),T=(m.isValid||b.isValid)&&Ge(L)&&s.isValid!==L;if(a.delayError&&R?(d=j(()=>S(N,R)),d(a.delayError)):(clearTimeout(u),d=null,R?xe(s.errors,N,R):Ce(s.errors,N)),(R?!tt(U,R):U)||!Te(H)||T){const X={...H,...T&&Ge(L)?{isValid:L}:{},errors:s.errors,name:N};s={...s,...X},f.state.next(X)}},F=async N=>(v(N,!0),await a.resolver(i,a.context,Xd(N||l.mount,n,a.criteriaMode,a.shouldUseNativeValidation))),A=async N=>{const{errors:L}=await F(N);if(v(N),N)for(const R of N){const H=G(L,R);H?xe(s.errors,R,H):Ce(s.errors,R)}else s.errors=L;return L},M=async(N,L,R={valid:!0})=>{for(const H in N){const U=N[H];if(U){const{_f:T,...X}=U;if(T){const ue=l.array.has(T.name),me=U._f&&Jd(U._f);me&&m.validatingFields&&v([T.name],!0);const Be=await Bn(U,l.disabled,i,g,a.shouldUseNativeValidation&&!L,ue);if(me&&m.validatingFields&&v([T.name]),Be[T.name]&&(R.valid=!1,L||e.shouldUseNativeValidation))break;!L&&(G(Be,T.name)?ue?ru(s.errors,Be,T.name):xe(s.errors,T.name,Be[T.name]):Ce(s.errors,T.name))}!Te(X)&&await M(X,L,R)}}return R.valid},E=()=>{for(const N of l.unMount){const L=G(n,N);L&&(L._f.refs?L._f.refs.every(R=>!Ua(R)):!Ua(L._f.ref))&&Z(N)}l.unMount=new Set},D=(N,L)=>!a.disabled&&(N&&L&&xe(i,N,L),!tt(K(),r)),I=(N,L,R)=>cs(N,l,{...c.mount?i:he(L)?r:Ye(N)?{[N]:L}:L},R,L),B=N=>$s(G(c.mount?i:r,N,a.shouldUnregister?G(r,N,[]):[])),z=(N,L,R={})=>{const H=G(n,N);let U=L;if(H){const T=H._f;T&&(!T.disabled&&xe(i,N,yi(L,T)),U=ga(T.ref)&&He(L)?"":L,hi(T.ref)?[...T.ref.options].forEach(X=>X.selected=U.includes(X.value)):T.refs?Jt(T.ref)?T.refs.forEach(X=>{(!X.defaultChecked||!X.disabled)&&(Array.isArray(U)?X.checked=!!U.find(ue=>ue===X.value):X.checked=U===X.value||!!U)}):T.refs.forEach(X=>X.checked=X.value===U):Ls(T.ref)?T.ref.value="":(T.ref.value=U,T.ref.type||f.state.next({name:N,values:Ne(i)})))}(R.shouldDirty||R.shouldTouch)&&_(N,U,R.shouldTouch,R.shouldDirty,!0),R.shouldValidate&&Y(N)},q=(N,L,R)=>{for(const H in L){if(!L.hasOwnProperty(H))return;const U=L[H],T=N+"."+H,X=G(n,T);(l.array.has(N)||Se(U)||X&&!X._f)&&!vt(U)?q(T,U,R):z(T,U,R)}},P=(N,L,R={})=>{const H=G(n,N),U=l.array.has(N),T=Ne(L);xe(i,N,T),U?(f.array.next({name:N,values:Ne(i)}),(m.isDirty||m.dirtyFields||b.isDirty||b.dirtyFields)&&R.shouldDirty&&f.state.next({name:N,dirtyFields:Lt(r,i),isDirty:D(N,T)})):H&&!H._f&&!He(T)?q(N,T,R):z(N,T,R),Rn(N,l)?f.state.next({...s,name:N,values:Ne(i)}):f.state.next({name:c.mount?N:void 0,values:Ne(i)})},ee=async N=>{c.mount=!0;const L=N.target;let R=L.name,H=!0;const U=G(n,R),T=me=>{H=Number.isNaN(me)||vt(me)&&isNaN(me.getTime())||tt(me,G(i,R,me))},X=Fn(a.mode),ue=Fn(a.reValidateMode);if(U){let me,Be;const pt=L.type?Ln(U._f):ui(N),ct=N.type===ba.BLUR||N.type===ba.FOCUS_OUT,Ro=!eu(U._f)&&!a.resolver&&!G(s.errors,R)&&!U._f.deps||su(ct,G(s.touchedFields,R),s.isSubmitted,ue,X),Ra=Rn(R,l,ct);xe(i,R,pt),ct?(!L||!L.readOnly)&&(U._f.onBlur&&U._f.onBlur(N),d&&d(0)):U._f.onChange&&U._f.onChange(N);const Ia=_(R,pt,ct),Io=!Te(Ia)||Ra;if(!ct&&f.state.next({name:R,type:N.type,values:Ne(i)}),Ro)return(m.isValid||b.isValid)&&(a.mode==="onBlur"?ct&&y():ct||y()),Io&&f.state.next({name:R,...Ra?{}:Ia});if(!ct&&Ra&&f.state.next({...s}),a.resolver){const{errors:on}=await F([R]);if(v([R]),T(pt),H){const Mo=In(s.errors,n,R),cn=In(on,n,Mo.name||R);me=cn.error,R=cn.name,Be=Te(on)}}else v([R],!0),me=(await Bn(U,l.disabled,i,g,a.shouldUseNativeValidation))[R],v([R]),T(pt),H&&(me?Be=!1:(m.isValid||b.isValid)&&(Be=await M(n,!0)));H&&(U._f.deps&&(!Array.isArray(U._f.deps)||U._f.deps.length>0)&&Y(U._f.deps),w(R,Be,me,Ia))}},W=(N,L)=>{if(G(s.errors,L)&&N.focus)return N.focus(),1},Y=async(N,L={})=>{let R,H;const U=Gt(N);if(a.resolver){const T=await A(he(N)?N:U);R=Te(T),H=N?!U.some(X=>G(T,X)):R}else N?(H=(await Promise.all(U.map(async T=>{const X=G(n,T);return await M(X&&X._f?{[T]:X}:X)}))).every(Boolean),!(!H&&!s.isValid)&&y()):H=R=await M(n);return f.state.next({...!Ye(N)||(m.isValid||b.isValid)&&R!==s.isValid?{}:{name:N},...a.resolver||!N?{isValid:R}:{},errors:s.errors}),L.shouldFocus&&!H&&Kt(n,W,N?U:l.mount),H},K=(N,L)=>{let R={...c.mount?i:r};return L&&(R=pi(L.dirtyFields?s.dirtyFields:s.touchedFields,R)),he(N)?R:Ye(N)?G(R,N):N.map(H=>G(R,H))},ie=(N,L)=>({invalid:!!G((L||s).errors,N),isDirty:!!G((L||s).dirtyFields,N),error:G((L||s).errors,N),isValidating:!!G(s.validatingFields,N),isTouched:!!G((L||s).touchedFields,N)}),te=N=>{N&&Gt(N).forEach(L=>Ce(s.errors,L)),f.state.next({errors:N?s.errors:{}})},Q=(N,L,R)=>{const H=(G(n,N,{_f:{}})._f||{}).ref,U=G(s.errors,N)||{},{ref:T,message:X,type:ue,...me}=U;xe(s.errors,N,{...me,...L,ref:H}),f.state.next({name:N,errors:s.errors,isValid:!1}),R&&R.shouldFocus&&H&&H.focus&&H.focus()},ne=(N,L)=>Oe(N)?f.state.subscribe({next:R=>"values"in R&&N(I(void 0,L),R)}):I(N,L,!0),V=N=>f.state.subscribe({next:L=>{au(N.name,L.name,N.exact)&&tu(L,N.formState||m,oe,N.reRenderRoot)&&N.callback({values:{...i},...s,...L,defaultValues:r})}}).unsubscribe,O=N=>(c.mount=!0,b={...b,...N.formState},V({...N,formState:{...x,...N.formState}})),Z=(N,L={})=>{for(const R of N?Gt(N):l.mount)l.mount.delete(R),l.array.delete(R),L.keepValue||(Ce(n,R),Ce(i,R)),!L.keepError&&Ce(s.errors,R),!L.keepDirty&&Ce(s.dirtyFields,R),!L.keepTouched&&Ce(s.touchedFields,R),!L.keepIsValidating&&Ce(s.validatingFields,R),!a.shouldUnregister&&!L.keepDefaultValue&&Ce(r,R);f.state.next({values:Ne(i)}),f.state.next({...s,...L.keepDirty?{isDirty:D()}:{}}),!L.keepIsValid&&y()},Re=({disabled:N,name:L})=>{if(Ge(N)&&c.mount||N||l.disabled.has(L)){const U=l.disabled.has(L)!==!!N;N?l.disabled.add(L):l.disabled.delete(L),U&&c.mount&&!c.action&&y()}},De=(N,L={})=>{let R=G(n,N);const H=Ge(L.disabled)||Ge(a.disabled);return xe(n,N,{...R||{},_f:{...R&&R._f?R._f:{ref:{name:N}},name:N,mount:!0,...L}}),l.mount.add(N),R?Re({disabled:Ge(L.disabled)?L.disabled:a.disabled,name:N}):$(N,!0,L.value),{...H?{disabled:L.disabled||a.disabled}:{},...a.progressive?{required:!!L.required,min:Tt(L.min),max:Tt(L.max),minLength:Tt(L.minLength),maxLength:Tt(L.maxLength),pattern:Tt(L.pattern)}:{},name:N,onChange:ee,onBlur:ee,ref:U=>{if(U){De(N,L),R=G(n,N);const T=he(U.value)&&U.querySelectorAll&&U.querySelectorAll("input,select,textarea")[0]||U,X=Kd(T),ue=R._f.refs||[];if(X?ue.find(me=>me===T):T===R._f.ref)return;xe(n,N,{_f:{...R._f,...X?{refs:[...ue.filter(Ua),T,...Array.isArray(G(r,N))?[{}]:[]],ref:{type:T.type,name:N}}:{ref:T}}}),$(N,!1,void 0,T)}else R=G(n,N,{}),R._f&&(R._f.mount=!1),(a.shouldUnregister||L.shouldUnregister)&&!(mi(l.array,N)&&c.action)&&l.unMount.add(N)}}},Ee=()=>a.shouldFocusError&&Kt(n,W,l.mount),ae=N=>{Ge(N)&&(f.state.next({disabled:N}),Kt(n,(L,R)=>{const H=G(n,R);H&&(L.disabled=H._f.disabled||N,Array.isArray(H._f.refs)&&H._f.refs.forEach(U=>{U.disabled=H._f.disabled||N}))},0,!1))},be=(N,L)=>async R=>{let H;R&&(R.preventDefault&&R.preventDefault(),R.persist&&R.persist());let U=Ne(i);if(f.state.next({isSubmitting:!0}),a.resolver){const{errors:T,values:X}=await F();v(),s.errors=T,U=Ne(X)}else await M(n);if(l.disabled.size)for(const T of l.disabled)Ce(U,T);if(Ce(s.errors,"root"),Te(s.errors)){f.state.next({errors:{}});try{await N(U,R)}catch(T){H=T}}else L&&await L({...s.errors},R),Ee(),setTimeout(Ee);if(f.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:Te(s.errors)&&!H,submitCount:s.submitCount+1,errors:s.errors}),H)throw H},$e=(N,L={})=>{G(n,N)&&(he(L.defaultValue)?P(N,Ne(G(r,N))):(P(N,L.defaultValue),xe(r,N,Ne(L.defaultValue))),L.keepTouched||Ce(s.touchedFields,N),L.keepDirty||(Ce(s.dirtyFields,N),s.isDirty=L.defaultValue?D(N,Ne(G(r,N))):D()),L.keepError||(Ce(s.errors,N),m.isValid&&y()),f.state.next({...s}))},ge=(N,L={})=>{const R=N?Ne(N):r,H=Ne(R),U=Te(N),T=U?r:H;if(L.keepDefaultValues||(r=R),!L.keepValues){if(L.keepDirtyValues){const X=new Set([...l.mount,...Object.keys(Lt(r,i))]);for(const ue of Array.from(X)){const me=G(s.dirtyFields,ue),Be=G(i,ue),pt=G(T,ue);me&&!he(Be)?xe(T,ue,Be):!me&&!he(pt)&&P(ue,pt)}}else{if(Ss&&he(N))for(const X of l.mount){const ue=G(n,X);if(ue&&ue._f){const me=Array.isArray(ue._f.refs)?ue._f.refs[0]:ue._f.ref;if(ga(me)){const Be=me.closest("form");if(Be){Be.reset();break}}}}if(L.keepFieldsRef)for(const X of l.mount)P(X,G(T,X));else n={}}i=a.shouldUnregister?L.keepDefaultValues?Ne(r):{}:Ne(T),f.array.next({values:{...T}}),f.state.next({values:{...T}})}l={mount:L.keepDirtyValues?l.mount:new Set,unMount:new Set,array:new Set,disabled:new Set,watch:new Set,watchAll:!1,focus:""},c.mount=!m.isValid||!!L.keepIsValid||!!L.keepDirtyValues||!a.shouldUnregister&&!Te(T),c.watch=!!a.shouldUnregister,c.keepIsValid=!!L.keepIsValid,c.action=!1,L.keepErrors||(s.errors={}),f.state.next({submitCount:L.keepSubmitCount?s.submitCount:0,isDirty:U?!1:L.keepDirty?s.isDirty:!!(L.keepDefaultValues&&!tt(N,r)),isSubmitted:L.keepIsSubmitted?s.isSubmitted:!1,dirtyFields:U?{}:L.keepDirtyValues?L.keepDefaultValues&&i?Lt(r,i):s.dirtyFields:L.keepDefaultValues&&N?Lt(r,N):L.keepDirty?s.dirtyFields:{},touchedFields:L.keepTouched?s.touchedFields:{},errors:L.keepErrors?s.errors:{},isSubmitSuccessful:L.keepIsSubmitSuccessful?s.isSubmitSuccessful:!1,isSubmitting:!1,defaultValues:r})},We=(N,L)=>ge(Oe(N)?N(i):N,{...a.resetOptions,...L}),Le=(N,L={})=>{const R=G(n,N),H=R&&R._f;if(H){const U=H.refs?H.refs[0]:H.ref;U.focus&&setTimeout(()=>{U.focus(),L.shouldSelect&&Oe(U.select)&&U.select()})}},oe=N=>{s={...s,...N}},se={control:{register:De,unregister:Z,getFieldState:ie,handleSubmit:be,setError:Q,_subscribe:V,_runSchema:F,_updateIsValidating:v,_focusError:Ee,_getWatch:I,_getDirty:D,_setValid:y,_setFieldArray:C,_setDisabledField:Re,_setErrors:k,_getFieldArray:B,_reset:ge,_resetDefaultValues:()=>Oe(a.defaultValues)&&a.defaultValues().then(N=>{We(N,a.resetOptions),f.state.next({isLoading:!1})}),_removeUnmounted:E,_disableForm:ae,_subjects:f,_proxyFormState:m,get _fields(){return n},get _formValues(){return i},get _state(){return c},set _state(N){c=N},get _defaultValues(){return r},get _names(){return l},set _names(N){l=N},get _formState(){return s},get _options(){return a},set _options(N){a={...a,...N}}},subscribe:O,trigger:Y,register:De,handleSubmit:be,watch:ne,setValue:P,getValues:K,reset:We,resetField:$e,clearErrors:te,unregister:Z,setError:Q,setFocus:Le,getFieldState:ie};return{...se,formControl:se}}function ou(e={}){const a=h.useRef(void 0),s=h.useRef(void 0),[n,r]=h.useState({isDirty:!1,isValidating:!1,isLoading:Oe(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:Oe(e.defaultValues)?void 0:e.defaultValues});if(!a.current)if(e.formControl)a.current={...e.formControl,formState:n},e.defaultValues&&!Oe(e.defaultValues)&&e.formControl.reset(e.defaultValues,e.resetOptions);else{const{formControl:c,...l}=lu(e);a.current={...l,formState:n}}const i=a.current.control;return i._options=e,Es(()=>{const c=i._subscribe({formState:i._proxyFormState,callback:()=>r({...i._formState}),reRenderRoot:!0});return r(l=>({...l,isReady:!0})),i._formState.isReady=!0,c},[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 c=i._getDirty();c!==n.isDirty&&i._subjects.state.next({isDirty:c})}},[i,n.isDirty]),h.useEffect(()=>{var c;e.values&&!tt(e.values,s.current)?(i._reset(e.values,{keepFieldsRef:!0,...i._options.resetOptions}),!((c=i._options.resetOptions)===null||c===void 0)&&c.keepIsValid||i._setValid(),s.current=e.values,r(l=>({...l}))):i._resetDefaultValues()},[i,e.values]),h.useEffect(()=>{i._state.mount||(i._setValid(),i._state.mount=!0),i._state.watch&&(i._state.watch=!1,i._subjects.state.next({...i._formState})),i._removeUnmounted()}),a.current.formState=h.useMemo(()=>xi(n,i),[i,n]),a.current}function cu(e,a=3){return e%1===0?e.toString():e.toFixed(a).replace(/\.?0+$/,"")}function du(e,a="en-US",s="USD"){try{return new Intl.NumberFormat(a,{style:"currency",currency:s,minimumFractionDigits:2,maximumFractionDigits:2}).format(e)}catch(n){return console.warn(`Invalid currency formatting: ${n}`),`${s} ${e.toFixed(2)}`}}function uu(e="USD",a="en-US"){try{return new Intl.NumberFormat(a,{style:"currency",currency:e}).formatToParts(0).find(i=>i.type==="currency")?.value??"$"}catch{return"$"}}function mu(e){const a=e.replace(/[^\d.,-]/g,""),s=a.match(/,\d{1,2}$/);let n;s?n=a.replace(/\./g,"").replace(",","."):n=a.replace(/,/g,"");const r=parseFloat(n);return isNaN(r)?null:r}function fu(e,a,s=.001){const n=e-a,r=Math.abs(n)<=s;return{difference:n,isBalanced:r,isUnderAllocated:!r&&n>0,isOverAllocated:!r&&n<0}}function _s(){return`dist-${Date.now()}-${Math.random().toString(36).substr(2,9)}`}_s();const xu={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:"$"},Ha=()=>({id:_s(),amount:0,glAccount:null,isTaxDeductible:!1}),ji=({distribution:e,defaultDistribution:a,glAccounts:s=[],isLoadingGlAccounts:n=!1,onSearchGlAccounts:r,onDistributionChange:i,onAmountChange:c,onGlAccountChange:l,onTaxDeductibleChange:d,onDelete:u,canDelete:x=!0,canEditTaxDeductible:m=!0,isDisabled:b=!1,labels:f,classNames:g={},"data-testid":j,control:y,name:v,rules:C})=>{const S={...xu,...f},k=y!==void 0&&v!==void 0,$=ou({defaultValues:{_internal:a||Ha()}}),_=Wd({control:k?y:$.control,name:k?v:"_internal",rules:k?C:void 0}),[w,F]=h.useState(a||Ha()),A=k?_.field.value??Ha():e??w,M=k&&!!_.fieldState?.error,E=k&&(_.fieldState?.isTouched??!1),D=M||E,I=D&&(!A.amount||A.amount<=0),B=D&&!A.glAccount,[z,q]=h.useState(A.glAccount?.name||""),P=h.useCallback(Q=>{const ne={...A,...Q};k&&_.field.onChange(ne),!k&&e===void 0&&F(ne),i?.(ne)},[A,e,i,k,_]),ee=h.useCallback(Q=>{const ne=Q||0;P({amount:ne}),c?.(ne)},[P,c]),W=h.useCallback(Q=>{q(Q),r?.(Q)},[r]),Y=h.useCallback(Q=>{if(Q===null){P({glAccount:null}),l?.(null);return}const V=s.find(O=>String(O.id)===String(Q))||null;P({glAccount:V}),l?.(V)},[s,P,l]),K=h.useCallback(()=>{q(""),P({glAccount:null}),l?.(null)},[P,l]),ie=h.useCallback(Q=>{P({isTaxDeductible:Q}),d?.(Q)},[P,d]),te=h.useCallback(()=>{u?.()},[u]);return t.jsx(o.Card,{radius:"md",shadow:"sm","data-testid":j||"revenue-distribution-card",className:o.cn(g.base),children:t.jsxs(o.CardBody,{className:o.cn("flex flex-row flex-nowrap items-start gap-4",g.body),children:[t.jsx("div",{className:o.cn("shrink-0",g.amountContainer),children:t.jsx(o.NumberInput,{"data-testid":`${j||"revenue-distribution-card"}-amount-input`,label:t.jsxs("span",{className:"flex items-center gap-1",children:[S.amount,t.jsx(o.Tooltip,{content:S.amountTooltip,children:t.jsx(p.Icon,{icon:"solar:info-circle-linear",className:"text-default-400 cursor-help",width:16})})]}),value:A.amount||void 0,onValueChange:ee,labelPlacement:"outside",placeholder:S.amountPlaceholder,isWheelDisabled:!0,hideStepper:!0,variant:"bordered",isDisabled:b,isInvalid:I,errorMessage:I?"Amount is required":void 0,minValue:0,step:.01,className:g.amountInput,startContent:t.jsx("div",{className:"pointer-events-none flex items-center",children:t.jsx("span",{className:"text-default-400 text-small",children:S.currencySymbol})})})}),t.jsx("div",{className:o.cn("grow",g.glAccountContainer),children:t.jsx(o.Autocomplete,{"data-testid":`${j||"revenue-distribution-card"}-gl-account-input`,label:t.jsxs("span",{className:"flex items-center gap-1",children:[S.glAccount,t.jsx(o.Tooltip,{content:S.glAccountTooltip,children:t.jsx(p.Icon,{icon:"solar:info-circle-linear",className:"text-default-400 cursor-help",width:16})})]}),isLoading:n,isClearable:!0,labelPlacement:"outside",variant:"bordered",items:s,menuTrigger:"input",inputValue:A.glAccount?.name??z,selectedKey:A.glAccount?.id??null,isDisabled:b,isInvalid:B,errorMessage:B?"GL Account is required":void 0,listboxProps:{emptyContent:n?S.searching:S.noGlAccountsFound},placeholder:S.glAccountPlaceholder,onInputChange:W,onSelectionChange:Y,onClear:K,className:g.glAccountInput,children:Q=>t.jsx(o.AutocompleteItem,{textValue:Q.name,children:t.jsxs("div",{className:"flex flex-col",children:[t.jsx("span",{children:Q.name}),Q.code&&t.jsx("span",{className:"text-xs text-default-400",children:Q.code})]})},Q.id)})}),t.jsx("div",{className:o.cn("shrink-0 pt-6 flex items-center",g.taxDeductibleContainer),children:t.jsx(o.Checkbox,{radius:"full","data-testid":`${j||"revenue-distribution-card"}-tax-deductible`,isSelected:A.isTaxDeductible,onValueChange:ie,isDisabled:b||!m,className:g.taxDeductibleCheckbox,children:S.taxDeductible})}),t.jsx("div",{className:o.cn("shrink-0 pt-6",g.deleteContainer),children:t.jsx(p.Button,{"data-testid":`${j||"revenue-distribution-card"}-delete-button`,size:"sm",color:"danger",variant:"flat",isDisabled:b||!x,onPress:te,startContent:t.jsx(p.Icon,{icon:"solar:trash-bin-trash-linear",width:16}),className:o.cn("text-danger",g.deleteButton),children:S.deleteButton})})]})})};ji.displayName="RevenueDistributionCard";const wi=({message:e="No distributions configured",icon:a="solar:document-text-outline",iconSize:s=48,showCard:n=!0,classNames:r={},renderEmpty:i})=>{if(i)return t.jsx(t.Fragment,{children:i()});const c=t.jsxs("div",{className:o.cn("flex flex-col items-center justify-center py-8",r.content),children:[t.jsx(p.Icon,{icon:a,width:s,className:o.cn("text-default-300 mb-4",r.icon)}),t.jsx("p",{className:o.cn("text-default-500 text-sm text-center",r.message),children:e})]});return n?t.jsx(o.Card,{radius:"sm",shadow:"sm","data-testid":"revenue-distribution-empty",className:o.cn("w-full",r.base),children:t.jsx(o.CardBody,{children:c})}):t.jsx("div",{"data-testid":"revenue-distribution-empty",className:o.cn("w-full",r.base),children:c})};wi.displayName="RevenueDistributionEmpty";const pu={title:"Error Loading Distributions",description:"An error occurred while loading the distribution configuration. Please try again."},Ni=({error:e,labels:a,showCard:s=!0,color:n="danger",classNames:r={}})=>{const i={...pu,...a},c=t.jsx(o.Alert,{"data-testid":"revenue-distribution-error-alert",color:n,title:i.title,description:e||i.description,className:r.alert});return s?t.jsx(o.Card,{radius:"sm",shadow:"sm","data-testid":"revenue-distribution-error",className:o.cn("w-full",r.base),children:t.jsx(o.CardBody,{children:c})}):t.jsx("div",{"data-testid":"revenue-distribution-error",className:o.cn("w-full",r.base),children:c})};Ni.displayName="RevenueDistributionError";const Ci=({rows:e=1,showCard:a=!0,classNames:s={}})=>{const n=Array.from({length:e},(i,c)=>c),r=i=>t.jsxs("div",{className:o.cn("flex flex-row flex-nowrap items-end gap-4",s.row),children:[t.jsxs("div",{className:"shrink-0 flex flex-col gap-1",children:[t.jsxs("div",{className:"flex items-center gap-1",children:[t.jsx(p.Skeleton,{className:"h-4 w-14 rounded-md"}),t.jsx(p.Skeleton,{className:"h-4 w-4 rounded-full"})]}),t.jsx(p.Skeleton,{className:"h-10 w-32 rounded-lg"})]}),t.jsxs("div",{className:"grow flex flex-col gap-1",children:[t.jsxs("div",{className:"flex items-center gap-1",children:[t.jsx(p.Skeleton,{className:"h-4 w-20 rounded-md"}),t.jsx(p.Skeleton,{className:"h-4 w-4 rounded-full"})]}),t.jsx(p.Skeleton,{className:"h-10 w-full rounded-lg"})]}),t.jsxs("div",{className:"shrink-0 pb-2 flex items-center gap-2",children:[t.jsx(p.Skeleton,{className:"h-5 w-5 rounded-full"}),t.jsx(p.Skeleton,{className:"h-4 w-24 rounded-md"})]}),t.jsx("div",{className:"shrink-0 pb-2",children:t.jsx(p.Skeleton,{className:"h-8 w-20 rounded-lg"})})]},i);return a?t.jsx("div",{className:o.cn("flex flex-col gap-3",s.base),children:n.map(i=>t.jsx(o.Card,{radius:"md",shadow:"sm","data-testid":`revenue-distribution-skeleton-${i}`,children:t.jsx(o.CardBody,{children:r(i)})},i))}):t.jsx("div",{"data-testid":"revenue-distribution-skeleton",className:o.cn("flex flex-col gap-3",s.base),children:n.map(i=>r(i))})};Ci.displayName="RevenueDistributionSkeleton";function Rs({isOpen:e,labels:a,icon:s,isConfirming:n=!1,confirmColor:r="danger",iconTone:i="danger",portalContainer:c,shouldBlockScroll:l,classNames:d,onClose:u,onConfirm:x}){return t.jsx(p.Modal,{isOpen:e,size:"md",placement:"center",portalContainer:c,shouldBlockScroll:l,classNames:{...d,base:o.cn("max-w-[440px] rounded-3xl",d?.base),closeButton:o.cn("right-5 top-5 text-zinc-500",d?.closeButton)},onOpenChange:m=>!m&&u(),children:t.jsxs(o.ModalContent,{children:[t.jsxs(o.ModalHeader,{className:"flex flex-col items-start gap-4 px-7 pb-0 pt-7",children:[s&&t.jsx("span",{className:o.cn("flex h-12 w-12 shrink-0 items-center justify-center rounded-full",i==="warning"?"bg-brand/15 text-brand":"bg-danger-100 text-danger-600"),children:s}),t.jsx("span",{className:"text-lg font-semibold leading-6 text-zinc-950",children:a.title})]}),t.jsx(o.ModalBody,{className:"px-7 pb-3 pt-4",children:t.jsx("div",{className:"text-sm leading-6 text-zinc-500",children:a.description})}),t.jsxs(o.ModalFooter,{className:"grid grid-cols-2 gap-3 px-7 pb-7 pt-3",children:[t.jsx(p.Button,{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:a.cancel}),t.jsx(p.Button,{type:"button",size:"md",color:r,radius:"full",className:o.cn("h-10 text-sm font-normal text-white",r==="danger"?"bg-danger-600":"bg-brand"),isLoading:n,onPress:x,children:a.confirm})]})]})})}const hu=()=>({id:crypto.randomUUID(),fund:null,percentage:0});function Pn(e){return!e.fund&&Number(e.percentage||0)<=0}function bu({mode:e,assignments:a}){const s=a.filter(i=>i.fund),n=s.reduce((i,c)=>i+Number(c.percentage||0),0),r=a.some(i=>!i.fund||Number(i.percentage||0)<=0);return s.length>=1&&!r&&Math.round(n*100)/100===100}const gu={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"},ki={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"},Ot={...ki,base:"min-h-11 rounded-2xl px-4 py-2 shadow-none",title:"text-sm font-medium"},yu={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"},vu={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 ju(){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 wu=e=>Number.isFinite(e)?Math.max(0,Math.min(100,Math.round(e*100)/100)):0,Nu=e=>e.fund!==null;function Cu({assignments:e,funds:a,labels:s,classNames:n,isSaving:r=!1,hasSavedAssignments:i=!1,showSavedIndicator:c=!1,isCollapsed:l,isFundPickerOpen:d=!1,activeAssignmentId:u=null,modalPortalContainer:x,footer:m,onAssignmentsChange:b,onOpenFundPicker:f,onCloseFundPicker:g,onCollapseChange:j,onSave:y}){const[v,C]=h.useState(null),S=x??v??void 0,k={...gu,...s},$=e.filter(V=>!Pn(V)),w=$.filter(Nu).length>0,F=h.useMemo(()=>e.filter(V=>!Pn(V)).reduce((V,O)=>V+Number(O.percentage||0),0),[e]),A=Math.round(F*100)/100,M=$.some(V=>!V.fund||Number(V.percentage||0)<=0),E=w&&(A!==100||M),D=`${k.totalError} (${k.total} ${Number(F.toFixed(2))}%)`,I=bu({mode:"split",assignments:e}),B=w&&A>=100,[z,q]=h.useState(!1),[P,ee]=h.useState(!1),W=t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(ju,{}),t.jsx("span",{className:"text-base font-medium leading-6 text-zinc-950",children:k.title}),c?t.jsx(o.Chip,{size:"sm",radius:"full",color:"success",variant:"flat",children:k.saved}):null]}),Y=(V,O)=>{b(e.map(Z=>Z.id===V?{...Z,...O}:Z))},K=()=>{B||b([...e,hu()])},ie=V=>{e.length<=1||b(e.filter(O=>O.id!==V))},te=()=>{if(!r){if(!I){ee(!0);return}if(!i){y();return}q(!0)}},Q=()=>{q(!1),y()},ne=V=>{const O=u??e.find(Z=>!Z.fund)?.id??e[0]?.id;O&&(b(e.map(Z=>Z.id===O?{...Z,fund:V}:Z)),g())};return t.jsxs("div",{ref:C,className:o.cn("vvt-pa relative min-w-0 w-full font-sans text-zinc-900 [container-type:inline-size]",d&&!x&&"min-h-[560px]",n?.root),children:[t.jsx(o.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:o.cn("w-full gap-0 px-0",n?.panel),itemClasses:{base:"w-full rounded-2xl border border-zinc-200 bg-white p-0 shadow-sm",trigger:o.cn("px-4 py-4",n?.header),title:"w-full",content:"w-full px-4 pb-4 pt-0",indicator:"text-zinc-500 [&>svg]:size-4"},onSelectionChange:V=>j?.(!(V==="all"||Array.from(V).length>0)),children:t.jsx(o.AccordionItem,{"aria-label":k.title,title:W,children:t.jsxs("div",{className:o.cn("flex w-full flex-col gap-4",n?.content),children:[t.jsxs("div",{className:"flex w-full flex-col gap-4",children:[!w&&t.jsx(o.Alert,{icon:t.jsx(p.Icon,{icon:"solar:info-circle-outline",className:"size-4"}),hideIconWrapper:!0,isClosable:!1,classNames:ki,color:"default",variant:"flat",title:k.emptySplit}),w&&t.jsx(ku,{assignments:e,labels:k,total:F,hasTotalError:P&&!I||E,validationMessage:D,onSelectFund:V=>f(V),onRemoveFund:ie,onPercentageChange:(V,O)=>Y(V,{percentage:wu(O)})}),t.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[t.jsx(p.Button,{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:B,onPress:()=>w?K():f(),children:k.assignSpecificFund}),t.jsx(p.Button,{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,{icon:"solar:cloud-upload-outline",className:"size-4"}),isLoading:r,isDisabled:!I||r,onPress:te,children:k.saveAssignment})]})]}),m]})},"installment-fund-assignment")}),d&&t.jsx(Su,{funds:a,labels:k,selectedFundIds:e.map(V=>V.fund?.id).filter(Boolean),portalContainer:S,onSelect:ne,onClose:g}),t.jsx(Rs,{isOpen:z,labels:{title:k.modifyAssignedFundsTitle,description:t.jsxs(t.Fragment,{children:[t.jsx("p",{children:k.modifyAssignedFundsDescription}),t.jsx("p",{className:"mt-3",children:k.modifyAssignedFundsWarning})]}),cancel:k.modifyAssignedFundsCancel,confirm:k.modifyAssignedFundsConfirm},icon:t.jsx(p.Icon,{icon:"solar:info-circle-outline",className:"size-7"}),iconTone:"warning",confirmColor:"primary",portalContainer:S,shouldBlockScroll:!1,classNames:vu,onClose:()=>q(!1),onConfirm:Q})]})}function ku({assignments:e,labels:a,total:s,hasTotalError:n,validationMessage:r,onSelectFund:i,onRemoveFund:c,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:o.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(p.Button,{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(p.Button,{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:a.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(o.Input,{variant:"bordered",type:"number",min:0,max:100,step:.01,value:String(d.percentage||""),onChange:x=>l(d.id,Number(x.target.value)),endContent:t.jsx("span",{className:"text-sm text-zinc-500",children:"%"}),classNames:yu})}),e.length>1&&t.jsx(p.Button,{type:"button",isIconOnly:!0,variant:"flat",radius:"full",className:o.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:()=>c(d.id),"aria-label":a.removeFund,children:t.jsx(p.Icon,{icon:"solar:trash-bin-minimalistic-outline",className:"size-5"})})]},d.id)),t.jsx(o.Alert,{icon:t.jsx(p.Icon,{icon:n?"solar:info-circle-outline":"solar:check-circle-outline",className:"size-4"}),hideIconWrapper:!0,isClosable:!1,color:n?"warning":"success",variant:"flat",classNames:{...Ot,base:o.cn(Ot.base,n?"bg-warning-50 text-warning-700":"bg-success-50 text-success-700"),iconWrapper:o.cn(Ot.iconWrapper,n?"text-warning-700":"text-success-700"),alertIcon:o.cn(Ot.alertIcon,n?"text-warning-700":"text-success-700"),title:o.cn(Ot.title,n?"text-warning-700":"text-success-700")},title:n?r:`${a.total} ${Number(s.toFixed(2))}%`})]})}function Su({funds:e,labels:a,selectedFundIds:s,portalContainer:n,onSelect:r,onClose:i}){const[c,l]=h.useState(""),d=e.filter(u=>{if(s.includes(u.id))return!1;const x=c.trim().toLowerCase();return x?`${u.glCode} ${u.accountName} ${u.type}`.toLowerCase().includes(x):!0});return t.jsx(p.Modal,{isOpen:!0,size:"3xl",placement:"center",scrollBehavior:"inside",shouldBlockScroll:!1,portalContainer:n,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(o.ModalContent,{className:"max-h-full",children:[t.jsx(o.ModalHeader,{className:"px-6 pr-12 pt-6 text-xl font-semibold leading-7 text-zinc-950",children:a.modalTitle}),t.jsxs(o.ModalBody,{className:"flex min-h-0 flex-1 flex-col px-6 pb-6",children:[t.jsx(o.Input,{variant:"bordered","aria-label":a.searchPlaceholder,value:c,placeholder:a.searchPlaceholder,onChange:u=>l(u.target.value),startContent:t.jsx(p.Icon,{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:a.glCode}),t.jsx("span",{children:a.accountName}),t.jsx("span",{children:a.actions})]}),d.length===0&&t.jsx("div",{className:"p-4 text-sm text-zinc-500",children:a.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(p.Button,{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:a.select})]},u.id))]})]})]})})}function $u(){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(p.Skeleton,{className:"h-7 w-56 rounded-lg"}),t.jsx(p.Skeleton,{className:"size-8 rounded-full"})]}),t.jsxs("div",{className:"flex items-center justify-between gap-3",children:[t.jsx(p.Skeleton,{className:"h-10 w-72 rounded-full"}),t.jsx(p.Skeleton,{className:"h-10 w-40 rounded-full"})]}),t.jsxs("div",{className:"grid grid-cols-[minmax(0,1fr)_160px] items-center gap-4 rounded-2xl border border-zinc-100 p-3",children:[t.jsx(p.Skeleton,{className:"h-8 w-full max-w-xs rounded-full"}),t.jsx(p.Skeleton,{className:"h-8 w-full rounded-xl"})]}),t.jsx(p.Skeleton,{className:"h-11 w-40 rounded-full"})]})}const Au={totalAmount:"Total Amount:",remainingBalance:"Remaining Balance",amountReceived:"Amount Received:"};function Du({totalAmount:e,remainingBalance:a,amountReceived:s,currency:n="USD",locale:r="en-US",labels:i,className:c}){const l={...Au,...i},d=new Intl.NumberFormat(r,{style:"currency",currency:n});return t.jsx("div",{className:o.cn("w-full rounded-2xl border border-zinc-200 bg-white px-4 py-2.5 font-sans text-base leading-6",c),children:t.jsxs("div",{className:"flex w-full flex-wrap items-center gap-x-5 gap-y-2",children:[t.jsx(Wa,{label:l.totalAmount,value:d.format(e)}),t.jsx(Wa,{label:l.remainingBalance,value:d.format(a)}),t.jsx(Wa,{label:l.amountReceived,value:d.format(s)})]})})}function Wa({label:e,value:a}){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:a})]})}const Eu={monthly:1,quarterly:3,annual:12},Si=e=>{const[a,s,n]=e.split("-").map(Number);return{year:a,month:s,day:n}},Lu=(e,a)=>new Date(e,a+1,0).getDate(),Fu=e=>{const a=e.getFullYear(),s=String(e.getMonth()+1).padStart(2,"0"),n=String(e.getDate()).padStart(2,"0");return`${a}-${s}-${n}`},_u=(e,a)=>{const{year:s,month:n,day:r}=Si(e),i=n-1+a,c=s+Math.floor(i/12),l=(i%12+12)%12,d=Math.min(r,Lu(c,l));return new Date(c,l,d)},Ru=(e,a)=>{const{year:s,month:n,day:r}=Si(e),i=new Date(s,n-1,r);return i.setDate(i.getDate()+a),i};function $i(e,a){const s=Math.max(1,Math.floor(a.numberOfInstallments||1)),n=Math.round(e*100),r=Math.floor(n/s),i=n-r*s,c=Eu[a.frequency];return Array.from({length:s},(l,d)=>{const u=a.frequency==="weekly"?Ru(a.firstInstallmentDate,d*7):_u(a.firstInstallmentDate,d*(c??1));return{id:crypto.randomUUID(),dueDate:Fu(u),amount:(r+(d===0?i:0))/100}})}function Iu(e){return new Set(e.map((a,s)=>{const n=e[s+1]?.dueDate;return a.dueDate&&n&&a.dueDate>n?a.id:null}).filter(a=>!!a))}function Mu(e){return{missingDateRows:new Set(e.filter(a=>!a.dueDate).map(a=>a.id)),invalidDateRows:Iu(e),invalidAmountRows:new Set(e.filter(a=>Number(a.amount||0)<=0).map(a=>a.id))}}function Bu(e){return e.missingDateRows.size>0||e.invalidDateRows.size>0||e.invalidAmountRows.size>0}function Pu(e,a){const s=e[0];return!s||!a||s.dueDate===a?e:[{...s,dueDate:a},...e.slice(1)]}const Tu=new Set(["paid","partially_refunded","refunded"]);function jt(e){return e!==void 0&&Tu.has(e)}const Ou={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."},zu=["weekly","monthly","quarterly","annual"],Vu=Array.from({length:31},(e,a)=>a+1),Uu=["numberOfInstallments","frequency","firstInstallmentDate"],Tn=()=>({id:crypto.randomUUID(),dueDate:new Date().toISOString().slice(0,10),amount:0}),va=e=>Math.round(e*100)/100,Hu=(e,a)=>{const s=new Date(`${e}T00:00:00`);return Number.isNaN(s.getTime())?e:new Intl.DateTimeFormat(a,{month:"short",day:"numeric",year:"numeric"}).format(s)},Da=e=>{if(!e)return null;try{return Ac(e)}catch{return null}},Wu=e=>Da(e)?.day??1,qu=(e,a)=>new Date(e,a,0).getDate(),Gu=(e,a)=>{const s=Da(e);if(!s)return e;const n=Math.min(a,qu(s.year,s.month));return s.set({day:n}).toString()},On=e=>{const a=e%100>=11&&e%100<=13?"th":e%10===1?"st":e%10===2?"nd":e%10===3?"rd":"th";return`${e}${a}`};function Ku({mode:e,donationAmount:a,currency:s="USD",locale:n="en-US",installments:r,automaticSettings:i,defaultTab:c="automatic",showTitle:l=!0,showCard:d=!0,showSavePayment:u=!0,showTabs:x=!0,inputs:m=Uu,startDate:b,firstInstallmentDateOverride:f,labels:g,classNames:j,isSaving:y=!1,showSavedIndicator:v=!1,isModeSwitchDisabled:C=!1,onModeChange:S,onAutomaticSettingsChange:k,onInstallmentsChange:$,onSave:_,onCancel:w}){const[F,A]=h.useState(c),M={...Ou,...g},E=e??F,D=h.useMemo(()=>new Intl.NumberFormat(n,{style:"currency",currency:s}),[s,n]),I=h.useMemo(()=>({...i,firstInstallmentDate:m.includes("firstInstallmentDate")?i.firstInstallmentDate:m.includes("dayOfMonth")?i.firstInstallmentDate||b||"":b||i.firstInstallmentDate}),[i,m,b]),B=E==="automatic"?Pu($i(a,I),m.includes("firstInstallmentDate")?void 0:f):r,z=h.useMemo(()=>va(B.reduce((Z,Re)=>Z+Number(Re.amount||0),0)),[B]),q=Math.abs(z-a)>.009,P=va(a-z)<=0,ee=h.useMemo(()=>Mu(r),[r]),W=E==="manual"&&Bu(ee),Y=q||W,K=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}),v?t.jsx(o.Chip,{size:"sm",radius:"full",color:"success",variant:"flat",children:M.saved}):null]}):void 0,ie=Z=>{Z!==E&&(e||A(Z),S?.(Z),Z==="manual"&&r.length===0&&$([Tn()]))},te=(Z,Re)=>{const De=r.find(Ee=>Ee.id===Z);jt(De?.status)||$(r.map(Ee=>Ee.id===Z?{...Ee,...Re}:Ee))},Q=()=>{$([...r,Tn()])},ne=Z=>{const Re=r.find(De=>De.id===Z);jt(Re?.status)||$(r.filter(De=>De.id!==Z))},V=()=>{y||Y||_?.()},O=t.jsxs("div",{className:o.cn("flex w-full flex-col gap-4",j?.content),children:[x||u||w?t.jsxs("div",{className:"flex w-full items-center justify-between gap-6",children:[x?t.jsx(Yu,{mode:E,labels:M,onModeChange:ie,isDisabled:C,className:j?.tabs}):null,t.jsxs("div",{className:"ml-auto flex items-center gap-3",children:[w?t.jsx(p.Button,{type:"button","data-testid":"installment-schedule-cancel-button",size:"md",variant:"bordered",radius:"full",className:"min-w-28",isDisabled:y,onPress:w,children:M.cancelEdit}):null,u?t.jsx(p.Button,{type:"button","data-testid":"installment-schedule-save-button",size:"md",color:"primary",radius:"full",className:"min-w-36",startContent:y?void 0:t.jsx(p.Icon,{icon:"solar:cloud-upload-outline",className:"size-4"}),isLoading:y,isDisabled:y||Y,onPress:V,children:M.saveInstallments}):null]})]}):null,t.jsxs("div",{className:o.cn("flex w-full flex-col gap-4",j?.preview),children:[E==="automatic"&&t.jsx(Zu,{settings:I,inputs:m,labels:M,className:j?.controls,onSettingsChange:k}),B.length===0&&t.jsx(o.Alert,{isClosable:!1,color:"default",variant:"flat",radius:"full",title:E==="automatic"?M.emptyAutomatic:M.emptyManual}),B.length>0&&t.jsx(Qu,{mode:E,installments:B,rowErrors:ee,labels:M,formatter:D,locale:n,onUpdateInstallment:te,onRemoveInstallment:ne}),E==="manual"&&t.jsx("div",{className:"flex flex-wrap gap-3",children:t.jsx(p.Button,{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:P,onPress:Q,children:M.addInstallment})}),t.jsx(tm,{total:z,donationAmount:a,hasTotalMismatch:q,mode:E,installments:B,formatter:D,labels:M,className:j?.summary})]})]});return t.jsx("div",{className:o.cn("vvt-ps relative font-sans text-zinc-900",j?.root),children:d?t.jsx(o.Accordion,{variant:"splitted",defaultSelectedKeys:["installment-schedule"],className:o.cn("w-full gap-0 px-0",j?.panel),itemClasses:{base:"w-full rounded-2xl border border-zinc-200 bg-white p-0 shadow-sm",trigger:o.cn("px-4 py-4",j?.header),title:"w-full",content:"w-full px-4 pb-4 pt-0",indicator:"text-zinc-500 [&>svg]:size-4"},children:t.jsx(o.AccordionItem,{"aria-label":M.title,title:K,children:O},"installment-schedule")}):O})}function Yu({mode:e,labels:a,className:s,isDisabled:n=!1,onModeChange:r}){return t.jsxs(o.Tabs,{"aria-label":a.title,selectedKey:e,isDisabled:n,color:"primary",size:"lg",radius:"full",className:o.cn("w-fit",s),onSelectionChange:i=>r(i),children:[t.jsx(o.Tab,{title:a.automaticMode},"automatic"),t.jsx(o.Tab,{title:a.manualMode},"manual")]})}function Zu({settings:e,inputs:a,labels:s,className:n,onSettingsChange:r}){const i=c=>{if(c==="numberOfInstallments")return t.jsx("div",{className:"min-w-0",children:t.jsx(o.Input,{variant:"bordered",label:s.numberOfInstallments,labelPlacement:"outside",type:"number",min:1,step:1,value:e.numberOfInstallments>0?String(e.numberOfInstallments):"",onWheel:l=>l.currentTarget.blur(),onChange:l=>{const d=l.target.value;r({...e,numberOfInstallments:d===""?0:Math.max(1,Number(d))})}})},c);if(c==="frequency")return t.jsx("div",{className:"min-w-0",children:t.jsx(p.Select,{variant:"bordered",label:s.frequency,labelPlacement:"outside",selectedKeys:[e.frequency],onSelectionChange:l=>{const d=Array.from(l)[0];typeof d=="string"&&r({...e,frequency:d})},children:zu.map(l=>t.jsx(o.SelectItem,{textValue:s[l],children:s[l]},l))})},c);if(c==="dayOfMonth"){const l=String(Wu(e.firstInstallmentDate));return t.jsx("div",{className:"min-w-0",children:t.jsx(p.Select,{variant:"bordered",label:s.dayOfMonth,labelPlacement:"outside",selectedKeys:[l],onSelectionChange:d=>{const u=Number(Array.from(d)[0]);Number.isFinite(u)&&r({...e,firstInstallmentDate:Gu(e.firstInstallmentDate,u)})},children:Vu.map(d=>t.jsx(o.SelectItem,{textValue:On(d),children:On(d)},String(d)))})},c)}return t.jsx("div",{className:"min-w-0",children:t.jsx(Cs,{variant:"bordered",label:s.firstInstallmentDate,labelPlacement:"outside",value:Da(e.firstInstallmentDate),onChange:l=>r({...e,firstInstallmentDate:l?l.toString():""}),startContent:t.jsx(p.Icon,{icon:"solar:calendar-outline",className:"size-4 text-zinc-500"})})},c)};return a.length===0?null:t.jsx("div",{className:o.cn("grid gap-4",n),style:{gridTemplateColumns:"repeat(auto-fit, minmax(min(100%, 14rem), 1fr))"},children:a.map(i)})}function Qu({mode:e,installments:a,rowErrors:s,labels:n,formatter:r,locale:i,onUpdateInstallment:c,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:o.cn("flex flex-col gap-3",a.length>5&&"max-h-[264px] overflow-y-auto pr-2"),children:a.map((d,u)=>t.jsxs("div",{className:o.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:Hu(d.dueDate,i)}),u===0&&a.length>1&&t.jsx(o.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:a.map((d,u)=>{const x=s.missingDateRows.has(d.id),m=s.invalidDateRows.has(d.id),b=s.invalidAmountRows.has(d.id);return t.jsx("div",{className:"flex w-full flex-col gap-1",children:t.jsxs("div",{className:"grid w-full grid-cols-[2rem_minmax(0,1fr)_minmax(0,1fr)_2.25rem] items-start gap-4",children:[t.jsx("span",{className:"pt-2 text-sm font-medium text-zinc-500",children:u+1}),t.jsx("div",{className:"min-w-0 flex-1",children:t.jsx(Cs,{variant:"bordered","aria-label":`${n.dueDate} ${u+1}`,isDisabled:jt(d.status),isInvalid:x||m,errorMessage:x?n.dueDateRequiredError:m?n.dateOrderError:void 0,value:Da(d.dueDate),onChange:f=>c(d.id,{dueDate:f?f.toString():""})})}),t.jsx("div",{className:"min-w-0 flex-1",children:t.jsx(Ju,{amount:d.amount,ariaLabel:`${n.amount} ${u+1}`,isDisabled:jt(d.status),isInvalid:b,errorMessage:n.amountGreaterThanZeroError,onAmountChange:f=>c(d.id,{amount:f})})}),t.jsx(em,{isDisabled:a.length<=1,isPaid:jt(d.status),label:n.deleteInstallment,onRemove:()=>l(d.id)})]})},d.id)})})}const Xu=/^\d*(?:[.,]\d{0,2})?$/;function Ju({amount:e,ariaLabel:a,isDisabled:s,isInvalid:n,errorMessage:r,onAmountChange:i}){const[c,l]=h.useState(null);return t.jsx(o.Input,{variant:"bordered","aria-label":a,type:"text",inputMode:"decimal",autoComplete:"off",isDisabled:s,isInvalid:n,errorMessage:n?r:void 0,value:c??(e?String(e):""),onChange:d=>{const u=d.target.value.trim();if(!Xu.test(u))return;l(u);const x=Number(u.replace(",","."));i(va(Number.isFinite(x)?x:0))},onBlur:()=>l(null),startContent:t.jsx("span",{className:"text-zinc-900",children:"$"})})}function em({isDisabled:e,isPaid:a,label:s,onRemove:n}){const r=t.jsx(p.Button,{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||a,onPress:n,"aria-label":s,children:t.jsx(p.Icon,{icon:"solar:trash-bin-minimalistic-outline",className:"size-5"})});return a?t.jsx(o.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 tm({total:e,donationAmount:a,hasTotalMismatch:s,mode:n,installments:r,formatter:i,labels:c,className:l}){const d=r.length,u=r[0]?.amount??0,x=r[1]?.amount??u,m=d>1&&Math.round(u*100)!==Math.round(x*100),b=va(a-e),f=Math.max(b,0),g=Math.max(-b,0),j=s?t.jsxs("span",{children:[c.totalError,". Total scheduled: ",t.jsx("strong",{children:i.format(e)})," /"," ",t.jsx("strong",{children:i.format(a)}),"."]}):n==="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(x)})," 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(a)}),"."]}),y=n==="automatic"?`Total: ${i.format(e)}`:g>0?`Exceeds by: ${i.format(g)}`:`${c.remaining}: ${i.format(f)}`;return t.jsx(o.Alert,{isClosable:!1,color:s?"danger":"default",variant:"flat",radius:"full",className:l,endContent:t.jsx("span",{className:"whitespace-nowrap",children:y}),title:j})}function am(){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(p.Skeleton,{className:"h-7 w-56 rounded-lg"}),t.jsx(p.Skeleton,{className:"size-8 rounded-full"})]}),t.jsxs("div",{className:"flex items-center justify-between gap-3",children:[t.jsx(p.Skeleton,{className:"h-10 w-72 rounded-full"}),t.jsx(p.Skeleton,{className:"h-10 w-40 rounded-full"})]}),t.jsxs("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-end sm:justify-between",children:[t.jsxs("div",{className:"flex w-full max-w-[280px] flex-col gap-2",children:[t.jsx(p.Skeleton,{className:"h-4 w-36 rounded-md"}),t.jsx(p.Skeleton,{className:"h-9 w-full rounded-xl"})]}),t.jsx(p.Skeleton,{className:"h-9 w-36 rounded-full"})]}),t.jsx("div",{className:"flex flex-col gap-3",children:Array.from({length:4}).map((e,a)=>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(p.Skeleton,{className:"h-8 w-full max-w-xs rounded-full"}),t.jsx(p.Skeleton,{className:"h-8 w-full rounded-xl"})]},a))})]})}const zn={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"},Ai={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"},sm={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:Ai.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."},nm={wrapper:"!absolute !inset-0 !z-50 !items-center !justify-center !p-4",backdrop:"!absolute !inset-0 !z-40 rounded-2xl"},rm=[];function im({installments:e,currency:a,locale:s="en-US",showTitle:n=!0,showCard:r=!0,showEditPayment:i=!0,showDelete:c=!0,payNowHiddenStatuses:l=rm,showSavedIndicator:d=!1,labels:u,isSaving:x=!1,onEditInstallments:m,onPayInstallment:b,onDeleteInstallment:f}){const[g,j]=h.useState(null),y={...sm,...u},[v,C]=h.useState(""),S=new Intl.NumberFormat(s,{style:"currency",currency:a}),k=e.some(A=>Di(A)!==null),$=e.some(A=>A.status==="partially_refunded"),_=n?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:y.title}),d?t.jsx(o.Chip,{size:"sm",radius:"full",color:"success",variant:"flat",children:y.saved}):null]}):void 0,w=h.useMemo(()=>{const A=v.trim().toLowerCase();if(!A)return e;const M=new Intl.NumberFormat(s,{style:"currency",currency:a});return e.filter(E=>{const D=E.status??"scheduled";return[qa(E),E.id,E.amount,E.dueDate,fa(E.dueDate,s),Ga(E,y.paidOn,s),Ka(E,y.refundedAmount,M),D,Ya(D,y.partiallyRefunded)].join(" ").toLowerCase().includes(A)})},[s,a,e,v,y.paidOn,y.refundedAmount,y.partiallyRefunded]),F=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:y.searchLabel}),t.jsx(o.Input,{variant:"bordered",size:"md",value:v,placeholder:y.searchPlaceholder,onChange:A=>C(A.target.value),startContent:t.jsx(p.Icon,{icon:"solar:magnifer-outline",className:"size-4 text-zinc-500"})})]}),i?t.jsx(p.Button,{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,{icon:"solar:pen-outline",className:"size-4"}),isLoading:x,onPress:m,children:y.editInstallments}):null]}),t.jsx("div",{className:o.cn("hidden [@container(max-width:767px)]:block",w.length>3&&"max-h-[560px] overflow-y-auto pr-1"),children:t.jsxs("div",{className:"flex flex-col gap-2",children:[w.map((A,M)=>{const E=A.status??"scheduled",D=qa(A),I=Ga(A,y.paidOn,s),B=Ka(A,y.refundedAmount,S);return t.jsx(o.Card,{radius:"lg",shadow:"none",className:"border border-default-200",children:t.jsxs(o.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:D||`PMT-${M+1}`})]}),t.jsx(Vn,{status:E,label:Ya(E,y.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:y.amount}),t.jsx("p",{className:"font-medium text-foreground",children:S.format(A.amount)}),B?t.jsx("p",{className:"text-xs text-default-500",children:B}):null]}),t.jsxs("div",{className:"text-right",children:[t.jsx("p",{className:"text-xs text-default-500",children:y.scheduledDate}),t.jsx("p",{className:"font-medium text-foreground",children:fa(A.dueDate,s)}),I?t.jsx("p",{className:"text-xs text-default-500",children:I}):null]})]}),t.jsx(Un,{status:E,installment:A,labels:y,portalContainer:g??void 0,showDelete:c,payNowHiddenStatuses:l,onPayInstallment:b,onDeleteInstallment:f})]})},A.id)}),w.length===0&&t.jsx("div",{className:"rounded-lg border border-default-200 px-4 py-6 text-center text-sm text-default-500",children:y.noInstallmentsFound})]})}),t.jsx("div",{className:o.cn("w-full overflow-x-hidden [@container(max-width:767px)]:hidden",w.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:k?"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:y.installmentId}),t.jsx("th",{className:"px-2 py-3 font-medium",children:y.amount}),t.jsx("th",{className:"px-2 py-3 font-medium",children:y.scheduledDate}),t.jsx("th",{className:"whitespace-nowrap px-2 py-3 font-medium",children:y.status}),t.jsx("th",{className:"whitespace-nowrap py-3 pl-4 pr-2 font-medium",children:y.actions})]})}),t.jsxs("tbody",{children:[w.map((A,M)=>{const E=A.status??"scheduled",D=qa(A),I=Ga(A,y.paidOn,s),B=Ka(A,y.refundedAmount,S);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:D||`PMT-${M+1}`})}),t.jsxs("td",{className:"px-2 py-3",children:[S.format(A.amount),B?t.jsx("span",{className:"block text-xs",children:B}):null]}),t.jsxs("td",{className:"px-2 py-3",children:[fa(A.dueDate,s),I?t.jsx("span",{className:"block text-xs",children:I}):null]}),t.jsx("td",{className:"whitespace-nowrap px-2 py-3",children:t.jsx(Vn,{status:E,label:Ya(E,y.partiallyRefunded)})}),t.jsx("td",{className:"whitespace-nowrap py-3 pl-4 pr-2",children:t.jsx(Un,{status:E,installment:A,labels:y,portalContainer:g??void 0,showDelete:c,payNowHiddenStatuses:l,onPayInstallment:b,onDeleteInstallment:f})})]},A.id)}),w.length===0&&t.jsx("tr",{children:t.jsx("td",{colSpan:6,className:"px-2 py-6 text-center text-zinc-500",children:y.noInstallmentsFound})})]})]})})]});return t.jsx("div",{ref:j,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(o.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(o.AccordionItem,{"aria-label":y.title,title:_,children:F},"installment-table")}):F})}function qa(e){return e.name?.trim()||e.id}function Ga(e,a,s){return!jt(e.status)||!e.fulfilledAt?null:`${a} ${fa(e.fulfilledAt,s)}`}function Di(e){const{refundedAmount:a}=e;return e.status!=="partially_refunded"||typeof a!="number"||!Number.isFinite(a)||a<=0?null:a}function Ka(e,a,s){const n=Di(e);return n===null?null:`${a} ${s.format(n)}`}function Ya(e,a){return e==="partially_refunded"?a:Ai[e]??e}function Vn({status:e,label:a}){return t.jsx(o.Chip,{size:"md",radius:"lg",className:o.cn("justify-center px-4",zn[e]??zn.scheduled),startContent:t.jsx(om,{status:e}),children:a})}function Un({status:e,installment:a,labels:s,portalContainer:n,showDelete:r,payNowHiddenStatuses:i,onPayInstallment:c,onDeleteInstallment:l}){const d=!i.includes(e),u=jt(e);return t.jsxs("div",{className:"flex min-w-36 items-center justify-start gap-2",children:[d?t.jsx(p.Button,{type:"button",size:"md",color:"primary",variant:"solid",radius:"full",className:"min-w-[104px] shrink-0",isDisabled:u,startContent:t.jsx(p.Icon,{icon:"solar:dollar-minimalistic-outline",className:"size-4"}),onPress:()=>c?.(a),children:s.payNow}):null,t.jsx(lm,{isFulfilled:u,showDelete:r,labels:s,portalContainer:n,onDelete:()=>l(a.id)})]})}function lm({isFulfilled:e,showDelete:a,labels:s,portalContainer:n,onDelete:r}){const[i,c]=h.useState(!1);return t.jsxs(t.Fragment,{children:[t.jsxs(o.Dropdown,{placement:"bottom-end",radius:"lg",children:[t.jsx(o.DropdownTrigger,{children:t.jsx(p.Button,{type:"button",isIconOnly:!0,size:"sm",variant:"light",className:"text-zinc-900","aria-label":"More actions",children:t.jsx(p.Icon,{icon:"solar:menu-dots-bold",className:"size-4"})})}),t.jsxs(o.DropdownMenu,{"aria-label":"Installment actions",disabledKeys:e?["send-link","delete"]:[],className:"w-72 p-2",onAction:l=>{l==="delete"&&a&&!e&&c(!0)},children:[t.jsx(o.DropdownSection,{title:"Actions",showDivider:a,children:t.jsx(o.DropdownItem,{textValue:s.sendLink,description:s.sendLinkDescription,startContent:t.jsx(p.Icon,{icon:"solar:link-outline",className:"size-5 text-zinc-500"}),children:s.sendLink},"send-link")}),a?t.jsx(o.DropdownSection,{title:s.dangerZone,children:t.jsx(o.DropdownItem,{textValue:s.deleteInstallment,className:"text-danger-600",color:"danger",description:s.deleteInstallmentDescription,startContent:t.jsx(p.Icon,{icon:"solar:trash-bin-minimalistic-outline",className:"size-5"}),children:s.deleteInstallment},"delete")}):null]})]}),a?t.jsx(Rs,{isOpen:i,labels:{title:s.deleteInstallmentConfirmationTitle,description:s.deleteInstallmentConfirmationDescription,cancel:s.deleteInstallmentConfirmationCancel,confirm:s.deleteInstallmentConfirmationConfirm},icon:t.jsx(p.Icon,{icon:"solar:danger-triangle-outline",className:"size-7"}),confirmColor:"danger",portalContainer:n,shouldBlockScroll:!1,classNames:nm,onClose:()=>c(!1),onConfirm:()=>{c(!1),r()}}):null]})}function om({status:e}){return e==="paid"?t.jsx(p.Icon,{icon:"solar:check-circle-bold",className:"size-3"}):e==="failed"?t.jsx(p.Icon,{icon:"solar:close-circle-bold",className:"size-3"}):e==="partially_refunded"?t.jsx(p.Icon,{icon:"solar:undo-left-round-bold",className:"size-3"}):e==="processing"?t.jsx(p.Icon,{icon:"solar:refresh-circle-bold",className:"size-3"}):e==="pending_confirmation"?t.jsx(p.Icon,{icon:"solar:clock-circle-bold",className:"size-3"}):t.jsx(p.Icon,{icon:"solar:calendar-outline",className:"size-3"})}const cm=/^\d{4}-\d{2}-\d{2}$/;function fa(e,a){const s=cm.test(e)?new Date(`${e}T00:00:00`):new Date(e);return Number.isNaN(s.getTime())?e:new Intl.DateTimeFormat(a,{month:"short",day:"numeric",year:"numeric"}).format(s)}const dm={title:"Select Membership",renewalTitle:"Automatic Renewal",renewalDescription:"Membership will automatically renew at the end of each period"},um=({cards:e,locale:a,currency:s,listHeightClassName:n="",labels:r,showRenewal:i=!0,defaultRenewalValue:c=!1,initialSelectedMembershipId:l=null,allowReselect:d=!0,onRenewalChange:u,onCardSelect:x,className:m=""})=>{const b=Array.isArray(e)?e:[],[f,g]=h.useState(l),[j,y]=h.useState(c),v={...dm,...r};h.useEffect(()=>{g(l)},[l]);const C=k=>{if(k===f){d&&x?.(k);return}g(k),x?.(k)},S=k=>{y(k),u?.(k)};return t.jsxs("div",{className:o.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:v.title}),i&&t.jsx(Ii,{title:v.renewalTitle,description:v.renewalDescription,value:j,onValueChange:S}),t.jsx("div",{className:o.cn("w-full min-h-0 flex flex-col gap-4 overflow-y-auto",n===""?"flex-1":o.cn("shrink-0",n)),"data-testid":"membership-select-cards-list",children:b.map(k=>t.jsx(Ei,{itemKey:k.id,name:k.name,type:k.type,price:k.price,locale:a,currency:s,isSelected:f===k.id,onSelect:C},k.id))})]})},Ei=({itemKey:e,name:a,type:s,price:n,locale:r="en-US",currency:i="USD",showPrice:c=!0,isSelected:l=!1,onSelect:d,compact:u=!1,isDisabled:x=!1,disabledReason:m,statusLabel:b,statusTone:f="default",className:g=""})=>{const j=new Intl.NumberFormat(r,{style:"currency",currency:i,minimumFractionDigits:0,maximumFractionDigits:2}).format(n),y=!!d&&!x,v=m||b,C=()=>{y&&d?.(e)};return t.jsx(o.Card,{shadow:"none",isPressable:!!d,onPress:C,className:o.cn("w-full min-h-fit border rounded-3xl",l?"border-primary bg-primary/5":"border-default",x?"opacity-60":"",u?"rounded-2xl":"",g),"data-testid":"item-card","data-selected":l,isDisabled:x,children:t.jsxs("div",{className:o.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:o.cn("font-semibold text-left",u?"text-sm":"text-xl"),"data-testid":"item-card-name",children:a}),s&&t.jsx("div",{"data-testid":"item-card-type",className:"w-fit bg-default-300 px-4 py-2 text-sm rounded-xl",children:t.jsx("p",{className:"text-center",children:s})}),v&&t.jsx(o.Chip,{"data-testid":"item-card-status",color:f,size:"sm",variant:"flat",className:"px-2",children:v})]}),c&&t.jsx("p",{className:o.cn("font-semibold text-right",u?"text-lg":"text-2xl"),"data-testid":"item-card-price",children:j})]})})},Hn="w-full bg-gray-100",Wn={variant:"light",color:"default"},Li=({id:e,title:a,media:s,imageUrl:n,imageAlt:r,imageClassName:i="",imageAspect:c="aspect-[4/3]",meta:l=[],price:d,action:u,footer:x,onPress:m,isPressable:b=!1,isDisabled:f=!1,compact:g=!1,className:j="",bodyClassName:y="",footerClassName:v="",dataTestId:C})=>{const S=!!(d&&d.value),k=!!u?.label,$=b&&!!m&&!k,_=!$,w=k?{variant:u?.variant??Wn.variant,color:u?.color??Wn.color,size:u?.size??"sm",isDisabled:f||u?.isDisabled,startContent:u?.icon?t.jsx(p.Icon,{icon:u.icon,width:16}):void 0}:null,F=s??(n?t.jsx("div",{className:o.cn("relative overflow-hidden rounded-xl",c,Hn,i),children:t.jsx(o.Image,{removeWrapper:!0,src:n,alt:r||a,className:"size-full object-cover",classNames:{wrapper:"absolute inset-0"}})}):t.jsx("div",{className:o.cn("relative overflow-hidden rounded-xl",c,Hn,"grid place-items-center",i),"data-testid":`catalog-item-card-${e??"media"}-fallback`,children:t.jsx(p.Icon,{icon:"solar:ticket-outline",width:48,className:"text-default-400"})}));return t.jsxs(o.Card,{"data-testid":C||`catalog-item-card-${e??"item"}`,className:o.cn("w-full overflow-hidden",j),isPressable:$,onPress:m,isDisabled:f,shadow:"sm",radius:"lg",children:[t.jsx("div",{children:F}),t.jsxs(o.CardBody,{className:o.cn("gap-3",g?"p-3":"p-4",y),children:[t.jsx("h3",{"data-testid":`catalog-item-card-title-${e??""}`,className:o.cn("line-clamp-2 text-base font-semibold text-gray-900",g?"text-sm":""),children:a}),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((A,M)=>t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(p.Icon,{icon:A.icon,className:"size-4 text-gray-400",width:16}),t.jsx("span",{children:A.label})]},`${A.label}-${M}`))}):null,(S||k)&&t.jsxs("div",{className:o.cn("flex items-center justify-end gap-2 pt-1 text-sm",g?"pt-0.5":"",v),children:[S?t.jsxs("span",{className:o.cn("mr-auto text-gray-500",g?"text-xs":""),"data-testid":`catalog-item-card-price-${e??""}`,children:[d?.label&&t.jsxs("span",{children:[d.label," "]}),t.jsx("span",{className:"font-semibold text-brand",children:d?.value})]}):t.jsx("span",{className:"ml-auto","aria-hidden":!0}),k&&_?t.jsx(p.Button,{className:o.cn("rounded-full",u?.className),onPress:u?.onPress,variant:w?.variant,color:w?.color,size:w?.size,startContent:w?.startContent,isDisabled:w?.isDisabled,"aria-label":u?.ariaLabel||u?.label,children:u?.label}):null]}),x?t.jsx("div",{className:"pt-1",children:x}):null]})]})};Li.displayName="CatalogItemCard";const mm={open:"Open","selling-fast":"Selling fast","sold-out":"Sold out"};function Fi({title:e,subtitle:a,price:s,imageUrl:n,status:r,isDisabled:i=!1,onPress:c,className:l}){return t.jsx(o.Card,{isPressable:!!c,isDisabled:i,onPress:c,shadow:"none",radius:"lg",className:o.cn("w-full border border-pos-hair",l),children:t.jsxs(o.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:n?t.jsx(o.Image,{removeWrapper:!0,src:n,alt:"",className:"size-full object-cover"}):t.jsx(p.Icon,{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:a})]}),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:mm[r]}):null,s?t.jsxs("strong",{className:"ml-5 whitespace-nowrap text-xl",children:["from ",s]}):null]})})}Fi.displayName="ProgramListItem";const fm={card:"gap-3 rounded-xl border border-dashed px-6 py-12",panel:"px-6 py-[72px]"},xm={card:"size-12 rounded-2xl",panel:"size-[76px] rounded-[20px] border mb-[18px]"},pm={card:"text-base font-medium text-default-900",panel:"text-[17px] font-semibold text-acct-ink"},hm={card:"max-w-sm text-sm text-default-600",panel:"max-w-[380px] text-sm text-acct-sub mt-1.5"},bm={card:"text-xs text-default-500",panel:"text-xs text-acct-sub mt-2"},gm={card:"mt-1",panel:"mt-[22px]"},ym="bg-acct-page border-acct-border text-acct-muted",vm={empty:"solar:inbox-line-duotone",error:"solar:danger-triangle-outline",success:"solar:check-circle-bold"},jm={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"},wm={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"},Nm={empty:"status",error:"alert",success:"status",loading:"status"},Cm={empty:"polite",error:"assertive",success:"polite",loading:"polite"};function km(e,a,s,n){if(a===!1)return null;if(e==="loading"&&a===void 0)return t.jsx(o.Spinner,{size:"lg",color:"primary",className:n.spinner});if(h.isValidElement(a))return t.jsx(t.Fragment,{children:a});const r=typeof a=="string"?a:vm[e];return r?t.jsx(p.Icon,{icon:r,width:s,height:s,"aria-hidden":"true",className:n.icon}):null}function _i({variant:e="empty",surface:a="card",title:s,titleAs:n="p",description:r,icon:i,actions:c,role:l=Nm[e],ariaLive:d=Cm[e],iconSize:u=24,className:x,classNames:m={},"data-testid":b="feedback-state",referenceCode:f,referenceCodeLabel:g="Reference code:"}){const j=km(e,i,u,m);return t.jsxs("div",{role:l,"aria-live":d,"data-variant":e,"data-testid":b,"data-surface":a,className:o.cn("flex flex-col items-center justify-center text-center",fm[a],a==="card"?jm[e]:"bg-transparent",x,m.base),children:[j?t.jsx("span",{"aria-hidden":"true","data-testid":`${b}-icon`,className:o.cn("inline-flex items-center justify-center",xm[a],e==="success"&&a==="card"&&"rounded-full",a==="panel"?ym:wm[e],m.iconWrapper),children:j}):null,t.jsxs("div",{className:o.cn("flex flex-col items-center",a==="card"&&"gap-1"),children:[t.jsx(n,{"data-testid":`${b}-title`,className:o.cn(pm[a],m.title),children:s}),r?t.jsx("p",{"data-testid":`${b}-description`,className:o.cn(hm[a],m.description),children:r}):null,f?t.jsxs("p",{"data-testid":`${b}-reference-code`,className:o.cn(bm[a],m.referenceCode),children:[g," ",t.jsx("span",{className:"select-all font-mono",children:f})]}):null]}),c?t.jsx("div",{"data-testid":`${b}-actions`,className:o.cn("flex flex-wrap items-center justify-center gap-2",gm[a],m.actions),children:c}):null]})}function ea(e){return t.jsx(_i,{...e})}function Is(e){return t.jsx(ea,{...e,variant:"empty"})}function Ms(e){return t.jsx(_i,{...e,variant:"error"})}function Bs(e){return t.jsx(ea,{...e,variant:"loading"})}function Ri(e){return t.jsx(ea,{...e,variant:"success"})}ea.displayName="FeedbackState";Is.displayName="EmptyState";Ms.displayName="ErrorState";Bs.displayName="LoadingState";Ri.displayName="SuccessState";const Ii=({title:e,value:a,description:s,onValueChange:n,className:r=""})=>{const i=h.useId();return t.jsxs("div",{className:o.cn("w-full flex flex-row items-center",e||s?"justify-between gap-6":"justify-start",r),"data-testid":"toggle",children:[t.jsxs("div",{className:"flex flex-col items-start",children:[e&&t.jsx("label",{htmlFor:i,className:"font-medium text-left","data-testid":"toggle-title",children:e}),s&&t.jsx("p",{className:"text-left text-gray-500","data-testid":"toggle-description",children:s})]}),t.jsx(o.Switch,{id:i,isSelected:a,onValueChange:n,"data-testid":"toggle-switch"})]})},Sm={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"},$m=(e,a)=>new Intl.NumberFormat(e,{style:"currency",currency:a}),Mi=e=>Object.values(e).reduce((a,s)=>a+Object.values(s).reduce((n,r)=>n+Object.values(r).reduce((i,c)=>i+c.selectedQuantity,0),0),0),Am=e=>e.reduce((a,s)=>a+s.dates.reduce((n,r)=>n+r.tickets.reduce((i,c)=>i+c.max,0),0),0),Ps=e=>e.flatMap(a=>a.dates.flatMap(s=>s.tickets.map(n=>({exhibition:a,dateGroup:s,ticket:n})))),qn=(e,a,s)=>{const n={};let r=s?a??Am(e):0;for(const{exhibition:i,dateGroup:c,ticket:l}of Ps(e)){n[i.id]??={},n[i.id][c.id]??={};const d=s?Math.min(l.max,r):0;n[i.id][c.id][l.id]={id:l.id,selectedQuantity:d,originalPrice:l.originalPrice,discountedPrice:l.price},r-=d}return n},Gn=(e,a,s)=>`${e}::${a}::${s}`,Dm=(e,a,s)=>{const n=Mi(a);for(const{exhibition:r,dateGroup:i,ticket:c}of Ps(e)){const l=a[r.id]?.[i.id]?.[c.id]?.selectedQuantity??0,d=s===void 0?c.max:Math.min(c.max,s-(n-l));if(d>0&&l<d)return!1}return!0},Em=({initialQuantity:e=1,minQuantity:a=1,maxQuantity:s=10,onChange:n,disabled:r=!1})=>{const i=Math.max(a,Math.min(s,e)),[c,l]=h.useState(()=>String(i)),[d,u]=h.useState(!1),x=d?c:String(i),m=()=>{r||i>=s||n?.(i+1)},b=()=>{r||i<=a||n?.(i-1)},f=k=>{if(r)return;l(k.target.value);const $=parseInt(k.target.value,10);isNaN($)||n?.(Math.max(a,Math.min(s,$)))},g=k=>{const $=parseInt(k.target.value,10);if(u(!1),isNaN($)){n?.(a);return}const _=Math.max(a,Math.min(s,$));_!==$?n?.(_):l(String(_))},j=i<=a,y=i>=s,v="w-10 h-10 flex items-center justify-center border-0 rounded-full cursor-pointer transition-colors duration-150 text-white text-2xl font-regular",C="bg-primary hover:bg-primary/80",S="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:b,disabled:r||j,className:o.cn(v,r||j?S:C),"aria-label":"Decrement quantity","data-testid":"quantity-decrement",children:"-"}),t.jsx("input",{type:"number",value:x,onChange:f,onFocus:()=>u(!0),onBlur:g,disabled:r,min:a,max:s,step:"1",className:"w-12 h-10 rounded-md border-0 bg-zinc-100 text-center text-2xl font-medium text-zinc-900 [appearance:textfield] [&::-webkit-inner-spin-button]:appearance-none [&::-webkit-outer-spin-button]:appearance-none","aria-label":`Selected quantity: ${i}`,"data-testid":"quantity-input"}),t.jsx("button",{type:"button",onClick:m,disabled:r||y,className:o.cn(v,r||y?S:C),"aria-label":"Increment quantity","data-testid":"quantity-increment",children:"+"})]})},Lm=({label:e,checked:a=!1,onChange:s,disabled:n=!1})=>{const r=()=>{n||s?.(!a)};return t.jsxs("button",{type:"button",onClick:r,disabled:n,role:"checkbox","aria-checked":a,"data-testid":"checkbox-button","data-checked":a,className:o.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",n&&"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:a,onChange:()=>{},disabled:n,className:"absolute opacity-0 w-0 h-0 pointer-events-none",tabIndex:-1,readOnly:!0}),t.jsx("span",{className:o.cn("block w-3.5 h-3.5 rounded-sm relative",a?"bg-primary":"bg-white ring-1 ring-zinc-300"),children:a&&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})]})},Fm=({item:e,quantity:a,onChange:s,getTotalSelectedTickets:n,userMaxLimit:r,settings:i,labels:c})=>{const l=()=>{if(!n||r===void 0)return e.max;const m=n();return Math.min(e.max,r-(m-a))},d=i?.locale??"en-US",u=i?.currency??"USD",x=$m(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:x.format(e.originalPrice)}),t.jsx("h3",{className:"text-base font-semibold text-zinc-900 m-0","data-testid":"ticket-discounted-price",children:x.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:[c.ticketsAllowedToRedeem," ",e.max]})})]}),t.jsx(Em,{initialQuantity:a,minQuantity:0,maxQuantity:l(),onChange:s})]}),e.membershipAlert?t.jsx(o.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]})},_m=({exhibitionId:e,dateGroup:a,isLast:s=!1,onQuantityChange:n,getTicketQuantity:r,getTotalSelectedTickets:i,userMaxLimit:c,settings:l,labels:d})=>t.jsxs("div",{className:o.cn("flex flex-col gap-2 pb-3",!s&&"border-b border-zinc-200"),"data-testid":"upgrade-ticket-date-group",children:[t.jsx("p",{className:"m-0 text-sm text-left text-zinc-500","data-testid":"upgrade-ticket-date",children:a.date}),a.tickets.map((u,x)=>t.jsxs("div",{children:[t.jsx(Fm,{item:u,quantity:r(e,a.id,u.id),onChange:m=>n(e,a.id,u.id,m),getTotalSelectedTickets:i,userMaxLimit:c,settings:l,labels:d}),x<a.tickets.length-1?t.jsx(o.Divider,{className:"bg-zinc-200","data-testid":"upgrade-ticket-divider"}):null]},u.id))]}),Rm=({title:e,exhibition:a,onQuantityChange:s,getTicketQuantity:n,getTotalSelectedTickets:r,userMaxLimit:i,settings:c,labels:l,initialExpanded:d=!1})=>{const[u,x]=h.useState(d),m=a.dates.reduce((f,g)=>f+g.tickets.reduce((j,y)=>j+n(a.id,g.id,y.id),0),0),b=a.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:()=>x(!u),"aria-expanded":u,"aria-controls":`upgrade-items-${a.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:o.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,{icon:"mdi:chevron-down"})})]})]})}),t.jsx("div",{id:`upgrade-items-${a.id}`,className:o.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:b?a.dates.map((f,g)=>t.jsx(_m,{exhibitionId:a.id,dateGroup:f,isLast:g===a.dates.length-1,onQuantityChange:s,getTicketQuantity:n,getTotalSelectedTickets:r,userMaxLimit:i,settings:c,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})})})})]})},Im=({initialExpanded:e=!1,userMaxLimit:a,labels:s,settings:n,ticketSelectionData:r,className:i="",onSelectionChange:c})=>{const l=h.useMemo(()=>r??[],[r]),d={...Sm,...s},[u,x]=h.useState(()=>qn(l,a,!0)),m=h.useRef(!1),b=h.useMemo(()=>{const C=Ps(l).map(({exhibition:S,dateGroup:k,ticket:$})=>[Gn(S.id,k.id,$.id),$]);return new Map(C)},[l]),f=Dm(l,u,a),g=(C,S,k)=>u[C]?.[S]?.[k]?.selectedQuantity??0,j=()=>Mi(u),y=(C,S,k,$)=>{const _=g(C,S,k),w=j()-_;if(a!==void 0&&w+$>a)return;const F=b.get(Gn(C,S,k));if(!F)return;const A={...u,[C]:{...u[C],[S]:{...u[C]?.[S],[k]:{id:k,selectedQuantity:$,originalPrice:F.originalPrice,discountedPrice:F.price}}}};x(A),c?.(A)},v=C=>{const S=qn(l,a,C);x(S),c?.(S)};return h.useEffect(()=>{!m.current&&f&&(c?.(u),m.current=!0)},[f,u,c]),t.jsxs("div",{className:o.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(Lm,{label:d.selectAllButtonLabel,checked:f,onChange:v})]}),l.map(C=>t.jsx(Rm,{title:C.exhibitionName,exhibition:C,onQuantityChange:y,getTicketQuantity:g,getTotalSelectedTickets:j,userMaxLimit:a,settings:n,labels:d,initialExpanded:e},C.id))]})},Za={confirm:"Confirm",clear:"Clear",noLabel:"Filters"},Qa=e=>{const a={};for(const s of e)s.type==="checkbox"?a[s.id]=[...s.selectedValues]:a[s.id]=s.selectedValue?[s.selectedValue]:[];return a},Mm=(e,a)=>{const s={};for(const n of a){if(n.type==="checkbox"){s[n.id]=e[n.id]??[...n.selectedValues];continue}const r=e[n.id]??[];s[n.id]=r.length>0?r[0]:null}return s},Bm=e=>e.type==="checkbox"?e.selectedValues.length>0:e.selectedValue!==null,Bi=({triggerLabel:e,triggerAriaLabel:a,triggerIcon:s="solar:tuning-square-outline",triggerVariant:n="bordered",triggerColor:r="default",triggerSize:i="sm",triggerClassName:c,popoverClassName:l,className:d,sections:u,onConfirm:x,onClear:m,appliedCount:b,countAriaLabel:f,countDisplay:g="badge",confirmLabel:j=Za.confirm,clearLabel:y=Za.clear,isOpen:v,defaultOpen:C=!1,onOpenChange:S,isDisabled:k=!1,closeOnConfirm:$=!0,keepOpenAfterClear:_=!1})=>{const[w,F]=h.useState(C),[A,M]=h.useState(()=>Qa(u)),E=v??w,D=b??u.filter(K=>Bm(K)).length,I=K=>{K&&M(Qa(u)),v||F(K),S?.(K)},B=(K,ie)=>{M(te=>({...te,[K.id]:ie}))},z=(K,ie)=>{M(te=>({...te,[K.id]:ie?[ie]:[]}))},q=async()=>{M(Qa(u.map(K=>K.type==="checkbox"?{...K,selectedValues:[]}:{...K,selectedValue:null}))),await m(),_||I(!1)},P=async()=>{const K=Mm(A,u);await x(K),$&&I(!1)},ee=K=>{if(K.type==="checkbox")return t.jsx(o.CheckboxGroup,{label:K.label,value:A[K.id]??[],onValueChange:te=>B(K,te),children:K.options.map(te=>t.jsx(o.Checkbox,{value:te.value,isDisabled:te.isDisabled,children:te.label},te.value))},K.id);const ie=A[K.id]?.[0]??"";return t.jsx(o.RadioGroup,{label:K.label,value:ie,onValueChange:te=>z(K,te||null),children:K.options.map(te=>t.jsx(o.Radio,{value:te.value,isDisabled:te.isDisabled,children:te.label},te.value))},K.id)},W=h.useMemo(()=>D>0?f?.(D)||`${D} filters applied`:void 0,[f,D]),Y=h.useMemo(()=>D===0?e||Za.noLabel:f?f(D):`${e} (${D})`,[D,e,f]);return t.jsx("div",{className:d,children:t.jsxs(o.Popover,{isOpen:E,onOpenChange:I,placement:"bottom-end",children:[t.jsx(o.PopoverTrigger,{children:t.jsxs(p.Button,{isDisabled:k,variant:n,color:r,size:i,className:c,"aria-label":a,"aria-haspopup":"dialog","aria-expanded":E,children:[t.jsx(p.Icon,{icon:s,width:16}),t.jsx("span",{children:e}),g==="badge"&&D>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":W,children:D}):g==="summary"&&Y!==e?t.jsx("span",{className:"text-xs",children:Y}):null]})}),t.jsx(o.PopoverContent,{className:l,children:t.jsxs("div",{className:"flex w-full flex-col gap-5 px-4 py-4",children:[u.map(K=>ee(K)),t.jsxs("div",{className:"flex items-center justify-end gap-2 border-t border-gray-200 pt-3",children:[t.jsx(p.Button,{variant:"light",color:"default",size:"sm",onPress:q,children:y}),t.jsx(p.Button,{color:"primary",size:"sm",onPress:P,children:j})]})]})})]})})};Bi.displayName="FilterPopover";const Pm="No sessions available for this date",Tm=e=>e==="sold-out"||e==="closed"?"danger":"success",Om=e=>{const a=e.seatsRemaining;return e.status==="sold-out"||e.status==="closed"?"Sold out":e.status==="limited"?typeof a=="number"?`${a} left`:"Limited":typeof a=="number"?`${a} seats available`:"Available"},Kn=e=>e.isDisabled?!0:e.status==="sold-out"||e.status==="closed",zm=(e,a)=>a&&e.some(s=>s.date===a)?a:e[0]?.date??null,Pi=({heading:e,subheading:a,days:s,selectedDate:n,onDateSelect:r,quickDates:i,selectedSessionId:c=null,onSessionSelect:l,emptyStateMessage:d=Pm,statusLabel:u,statusTone:x,sessionAriaLabel:m,dayButtonClassName:b,calendarSlot:f,dayGroupAriaLabel:g,sessionGridAriaLabel:j,className:y,headingClassName:v,subheadingClassName:C})=>{const S=zm(s,n),k=s.find(A=>A.date===S),$=i??s.map(A=>({date:A.date,label:A.label})),_=k?.sessions??[],w=A=>A===S?"solid":"bordered",F=A=>{if(!Kn(A)){if(A.id===c){l(null);return}l(A.id)}};return t.jsxs("section",{className:o.cn("flex flex-col gap-4 rounded-xl bg-white p-3 sm:p-4",y),"data-testid":"session-timeline-root",children:[t.jsxs("header",{className:"flex flex-col gap-1",children:[t.jsx("h2",{className:o.cn("text-base font-semibold text-gray-900",v),children:e}),a?t.jsx("p",{className:o.cn("text-sm text-gray-700",C),children:a}):null]}),t.jsxs("div",{className:"flex flex-wrap items-center gap-2",role:"group","aria-label":g||"Session days",children:[$.map(A=>t.jsx(p.Button,{size:"sm",variant:w(A.date),color:"default",className:o.cn("rounded-full",b),isDisabled:A.isDisabled,onPress:()=>{r(A.date)},children:t.jsx("span",{children:A.label})},A.date)),f?t.jsx("div",{children:f}):null]}),t.jsxs("ul",{className:"grid grid-cols-1 gap-2 sm:grid-cols-3","aria-label":j||"Sessions",children:[_.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,_.map(A=>{const M=Kn(A),E=A.id===c;return t.jsx("li",{className:"rounded-xl",children:t.jsx(o.Card,{shadow:"sm",radius:"lg",isPressable:!M,onPress:()=>{F(A)},"aria-disabled":M,"aria-pressed":M?void 0:E,className:o.cn("w-full",M?"bg-gray-100 opacity-70":"",E?"w-full ring-2 ring-gray-900":""),"aria-label":m?m(A,{isSelected:E,isUnavailable:M}):M?`${A.startTime} ${A.endTime} sold out`:`${A.startTime} ${A.endTime} available`,children:t.jsxs(o.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:[A.startTime," – ",A.endTime]}),t.jsx(o.Chip,{size:"sm",color:x?x(A):Tm(A.status),variant:"flat",children:u?u(A):Om(A)})]})})},A.id)})]})]})};Pi.displayName="SessionTimeline";const ms=16,lt=e=>`${e/ms}rem`;function Vm(){if(typeof document>"u"||typeof getComputedStyle!="function")return ms;const e=parseFloat(getComputedStyle(document.documentElement).fontSize);return Number.isFinite(e)&&e>0?e:ms}const ta=(e,a)=>e>=a*Vm(),Um=1120;function It(){const e=h.useRef(null),[a,s]=h.useState(0),[,n]=h.useState("");return h.useLayoutEffect(()=>{const r=e.current;if(!r||typeof ResizeObserver>"u")return;const i=new ResizeObserver(c=>{const l=c[c.length-1];l&&s(l.borderBoxSize?.[0]?.inlineSize??l.contentRect.width)});return s(r.getBoundingClientRect().width),i.observe(r),()=>i.disconnect()},[]),h.useEffect(()=>{if(typeof MutationObserver>"u")return;const r=document.documentElement,i=new MutationObserver(()=>n(getComputedStyle(r).fontSize));return i.observe(r,{attributes:!0,attributeFilter:["style","class"]}),()=>i.disconnect()},[]),{ref:e,width:a}}const Hm=48,Qe={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"},Wm=(e,a)=>typeof e=="string"?t.jsx(p.Icon,{icon:e,className:"size-5","aria-hidden":"true"}):e||a||null,Ti=({title:e,subtitle:a,eyebrow:s,icon:n,initials:r,actions:i,titleAs:c="h1",className:l,classNames:d={},"data-testid":u="page-header",list:x,narrow:m,headerRef:b})=>{const f=Wm(n,r);return t.jsxs("header",{ref:b,"data-testid":u,"data-variant":x?"list":void 0,"data-size":x?m?"narrow":"wide":void 0,className:o.cn(x?o.cn(Qe.base,m?Qe.baseNarrow:Qe.baseWide):"flex flex-wrap items-start justify-between gap-4",l,d.base),children:[t.jsxs("div",{className:x?Qe.identity:"flex items-center gap-4",children:[f?t.jsx("div",{"aria-hidden":"true","data-testid":`${u}-icon`,className:o.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:x?Qe.text:void 0,children:[s?t.jsx("p",{"data-testid":`${u}-eyebrow`,className:o.cn("text-brand text-sm font-medium uppercase tracking-wide",d.eyebrow),children:s}):null,t.jsx(c,{"data-testid":`${u}-title`,className:o.cn(x?m?Qe.titleNarrow:Qe.titleWide:"text-3xl font-semibold text-gray-950",d.title),children:e}),a?t.jsx("p",{"data-testid":`${u}-subtitle`,className:o.cn(x?m?Qe.subtitleNarrow:Qe.subtitleWide:"mt-1 text-sm text-gray-600",d.subtitle),children:a}):null]})]}),i?t.jsx("div",{"data-testid":`${u}-actions`,className:o.cn(x?m?Qe.actionsNarrow:Qe.actionsWide:"flex flex-wrap items-center gap-2",d.actions),children:i}):null]})},qm=e=>{const{ref:a,width:s}=It(),n=s>0&&!ta(s,Hm);return t.jsx(Ti,{...e,list:!0,narrow:n,headerRef:a})},Oi=e=>e.variant==="list"?t.jsx(qm,{...e}):t.jsx(Ti,{...e,list:!1,narrow:!1});Oi.displayName="PageHeader";const Ze={ok:{fg:le.ok,bg:le["ok-fill"]},warn:{fg:le.warn,bg:le["warn-fill"]},danger:{fg:le.danger,bg:le["danger-fill"]},info:{fg:le.info,bg:le["info-fill"]},violet:{fg:le.violet,bg:le["violet-fill"]},neutral:{fg:le.neutral,bg:le["neutral-fill"]}};function aa(e){if(e==="positive")return{color:le.ok};if(e==="negative")return{color:le.danger}}const Gm={active:"success",success:"success",draft:"warning",pending:"warning",warning:"warning",danger:"danger",archived:"default",inactive:"default",neutral:"default",info:"default",violet:"default"},fs={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:Ze.info,violet:Ze.violet},Km={active:"ok",success:"ok",draft:"warn",pending:"warn",warning:"warn",danger:"danger",archived:"neutral",inactive:"neutral",neutral:"neutral",info:"info",violet:"violet"},Ym={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]"},Zm={info:fs.info,violet:fs.violet},zi=({status:e,label:a,variant:s="flat",size:n="sm",color:r,startContent:i,className:c,"data-testid":l="status-chip"})=>{if(s==="plain"){const u=Ze[Km[e]];return t.jsxs("span",{"data-testid":l,"data-status":e,"data-variant":"plain",className:o.cn("inline-flex items-center gap-1.5 whitespace-nowrap rounded-full font-normal",Ym[n],"leading-[1.35]",c),style:{color:u.fg,backgroundColor:u.bg},children:[i,a]})}if(s==="dot"){const u=fs[e];return t.jsxs("span",{"data-testid":l,"data-status":e,className:o.cn("inline-flex items-center gap-1.5 whitespace-nowrap rounded-full px-2.5 py-[3px] text-[12px] font-semibold leading-[1.4]",c),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"}}),a]})}const d=r?void 0:Zm[e];return t.jsx(o.Chip,{color:r??Gm[e],variant:s,size:n,startContent:i,"data-testid":l,"data-status":e,className:o.cn("font-medium",c),style:d?{color:d.fg,backgroundColor:d.bg}:void 0,children:a})};zi.displayName="StatusChip";const Qm={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"},la={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"},Ea=({label:e,value:a,size:s="sm",variant:n="default",className:r,"data-testid":i="key-value-chip"})=>n==="record"?t.jsxs("span",{"data-testid":i,"data-variant":"record",className:o.cn(la.base,la[s],r),children:[t.jsx("span",{className:la.label,children:e}),t.jsx("span",{className:la.value,children:a})]}):t.jsxs("span",{"data-testid":i,className:o.cn("inline-flex items-baseline whitespace-nowrap border border-default-200 bg-default-100",Qm[s],r),children:[t.jsx("span",{className:"font-medium text-default-400",children:e}),t.jsx("span",{className:"font-semibold text-default-700",children:a})]});Ea.displayName="KeyValueChip";const Vi=({columns:e,rows:a=6,label:s="Loading",barHeight:n=12,alignLastRight:r=!1,appearance:i="pulse",className:c,classNames:l={},"data-testid":d="table-skeleton"})=>t.jsxs("div",{role:"status","aria-busy":"true","data-testid":d,className:o.cn("w-full",c,l.base),children:[t.jsx("span",{className:"sr-only",children:s}),t.jsx("div",{"aria-hidden":"true",children:Array.from({length:a}).map((u,x)=>i==="shimmer"?t.jsx("div",{"data-testid":`${d}-row`,className:o.cn("flex items-center border-b border-pos-hair",l.row),children:e.map((m,b)=>{const f=b===e.length-1;return t.jsx("div",{className:o.cn("min-w-0 flex-1 px-4 py-5",r&&f&&"flex justify-end"),children:t.jsx("div",{className:o.cn(p.shimmerClass,l.bar),style:{height:lt(n),width:m==="fill"?"60%":lt(m),maxWidth:"100%"}})},b)})},x):t.jsx("div",{"data-testid":`${d}-row`,className:o.cn("flex items-center gap-3 border-t border-default-100 px-5 py-4",l.row),children:e.map((m,b)=>{const f=b===e.length-1;return t.jsx("div",{className:o.cn(m==="fill"?"flex-1":"shrink-0",r&&f&&"flex justify-end"),style:m==="fill"?void 0:{width:m},children:t.jsx("div",{className:o.cn("animate-pulse rounded bg-default-200",p.stillAnimationClass,l.bar),style:{height:n,width:m==="fill"?"60%":m}})},b)})},x))})]});Vi.displayName="TableSkeleton";const Ts="text-left text-[11px] font-semibold uppercase tracking-[.04em] text-acct-sub px-4 pt-4 pb-3 whitespace-nowrap bg-transparent",Os="px-4 text-[13.5px] text-acct-ink2 align-middle",zs="border-t border-acct-hair transition-colors duration-150 hover:bg-acct-page data-[hover=true]:bg-acct-page",Vs="w-full",Ui="border-t border-acct-border px-5 py-3.5",oa={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 ${p.stillTransitionClass}`,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"},Hi=({columns:e,children:a,emptyContent:s,footer:n,ariaLabel:r,variant:i="default",className:c,classNames:l={},"data-testid":d="admin-table"})=>{const u=i==="framed";return t.jsxs("div",{className:o.cn(u&&oa.base,c,l.base),"data-testid":d,"data-variant":u?"framed":void 0,children:[t.jsxs(p.Table,{"aria-label":r,removeWrapper:!0,classNames:{table:o.cn(Vs,l.table),th:o.cn(u?oa.th:Ts,l.th),tr:o.cn(u?oa.tr:zs,l.tr),td:o.cn(u?oa.td:Os,l.td)},children:[t.jsx(o.TableHeader,{columns:e,children:x=>t.jsx(o.TableColumn,{align:x.align==="right"?"end":"start",width:x.width,children:x.label},x.key)}),t.jsx(o.TableBody,{emptyContent:s,children:a})]}),n?t.jsx("div",{"data-testid":`${d}-footer`,className:o.cn(!u&&Ui,l.footer),children:n}):null]})};Hi.displayName="AdminTable";const Xm={sm:"size-6 min-w-6",md:"size-[30px] min-w-[30px]"},Us=({actions:e,size:a="md",className:s,"data-testid":n="row-actions"})=>t.jsx("div",{role:"presentation","data-testid":n,className:o.cn("inline-flex gap-0.5",s),onClick:r=>r.stopPropagation(),children:e.map(r=>t.jsx(p.Button,{isIconOnly:!0,variant:"light",radius:"sm",size:"sm",onPress:r.onPress,isDisabled:r.disabled,"aria-label":r.label,title:r.label,"data-testid":`${n}-${r.key}`,className:o.cn("text-acct-sub data-[hover=true]:bg-acct-hair",Xm[a]),children:r.icon},r.key))});Us.displayName="RowActions";const Jm=Ae.palettes.warning[50],ef="solar:alt-arrow-down-outline",tf="solar:pen-2-outline",af={sm:"hidden sm:table-cell",md:"hidden md:table-cell",lg:"hidden lg:table-cell"},ve={root:"w-full overflow-x-auto rounded-2xl border border-acct-border bg-acct-surface",table:Vs,th:Ts,alignRight:"text-right",thActions:"w-px",row:zs,rowOpen:"bg-acct-page hover:bg-acct-page",td:o.cn(Os,"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 ${p.stillTransitionClass}`,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"},sf=new Set(["text","search","email","tel","url","number","password"]);function nf(e){return e instanceof HTMLInputElement&&sf.has(e.type)&&e.getAttribute("aria-expanded")!=="true"}function Yn(e){return o.cn(e.align==="right"&&ve.alignRight,e.hideBelow&&af[e.hideBelow])}function Wi({ariaLabel:e,columns:a,rows:s,getRowKey:n,getRowLabel:r,renderCell:i,renderExpanded:c,renderExpandedActions:l,getRowActions:d,rowNeedsFix:u,expandedKeys:x,defaultExpandedKeys:m,onExpandedChange:b,labels:f,emptyContent:g,className:j,"data-testid":y="expandable-table"}){const v=h.useId(),C=x!==void 0,[S,k]=h.useState(()=>new Set(m??[])),$=h.useMemo(()=>C?new Set(x):S,[C,x,S]),_=h.useRef(new Map),w=h.useRef(null),F=(E,D,I)=>{if($.has(E)===D)return;const B=new Set($);D?B.add(E):B.delete(E),C||k(B),b?.(B,{key:E,expanded:D,reason:I})};h.useLayoutEffect(()=>{const E=w.current;if(E===null||$.has(E))return;w.current=null;const D=document.activeElement;(D===null||D===document.body)&&_.current.get(E)?.focus()});const A=E=>D=>{if(D.defaultPrevented||D.nativeEvent.isComposing)return;const I=D.key==="Escape"?"escape":D.key==="Enter"&&nf(D.target)?"enter":null;I!==null&&(D.preventDefault(),D.stopPropagation(),F(E,!1,I))},M=a.length+1;return t.jsx("div",{"data-testid":y,className:o.cn(ve.root,j),children:t.jsxs("table",{"aria-label":e,className:ve.table,children:[t.jsx("thead",{children:t.jsxs("tr",{children:[a.map(E=>t.jsx("th",{scope:"col",className:o.cn(ve.th,Yn(E)),style:E.width===void 0?void 0:{width:E.width},children:E.label},E.key)),t.jsx("th",{scope:"col",className:o.cn(ve.th,ve.thActions),children:t.jsx("span",{className:"sr-only",children:f.actions})})]})}),s.length===0&&p.hasContent(g)?t.jsx("tbody",{children:t.jsx("tr",{children:t.jsx("td",{colSpan:M,className:ve.empty,"data-testid":`${y}-empty`,children:g})})}):null,s.map((E,D)=>{const I=n(E),B=$.has(I),z=u?.(E)??!1,q=f.toggleRow(r(E)),P=`${v}-panel-${D}`,ee=d?.(E,D)??[],W={rowIndex:D,close:()=>F(I,!1,"done")};return t.jsxs("tbody",{"data-testid":`${y}-row-${I}`,"data-expanded":B?"true":"false","data-needs-fix":z?"true":void 0,children:[t.jsxs("tr",{className:o.cn(ve.row,B&&ve.rowOpen),style:z&&!B?{backgroundColor:Jm}:void 0,children:[a.map(Y=>t.jsx("td",{className:o.cn(ve.td,Yn(Y)),children:i(E,Y.key,D)},Y.key)),t.jsx("td",{className:ve.tdActions,children:t.jsxs("div",{className:ve.actions,children:[t.jsx(p.Button,{ref:Y=>{Y?_.current.set(I,Y):_.current.delete(I)},variant:"light",color:"default",size:"sm",testId:`${y}-toggle-${I}`,"aria-label":q,"aria-expanded":B,"aria-controls":B?P:void 0,className:o.cn(ve.toggle,B&&ve.toggleOpen),endContent:t.jsx(p.Icon,{"aria-hidden":!0,icon:ef,className:o.cn(ve.chevron,B&&ve.chevronOpen)}),onPress:()=>F(I,!B,"toggle"),children:f.toggle}),ee.length>0?t.jsx(Us,{actions:ee,"data-testid":`${y}-actions-${I}`}):null]})})]}),B?t.jsx("tr",{className:ve.panelRow,children:t.jsx("td",{colSpan:M,className:ve.panelCell,children:t.jsxs("div",{role:"region",id:P,"aria-label":q,"data-testid":`${y}-panel-${I}`,className:ve.panel,onKeyDown:A(I),onFocus:()=>{w.current=I},onBlur:Y=>{const K=Y.relatedTarget;K&&!Y.currentTarget.contains(K)&&(w.current=null)},children:[p.hasContent(f.panelTitle)?t.jsxs("p",{className:ve.panelTitle,children:[t.jsx(p.Icon,{"aria-hidden":!0,icon:tf,className:ve.panelTitleIcon}),f.panelTitle]}):null,c(E,W),t.jsxs("div",{className:ve.panelFooter,children:[l?.(E,W),t.jsx(p.Button,{variant:"bordered",color:"default",size:"sm",testId:`${y}-done-${I}`,className:ve.done,onPress:W.close,children:f.done})]})]})})}):null]},I)})]})})}Wi.displayName="ExpandableTable";const rf=Xt["--warn"],Zn={root:"inline-flex shrink-0 items-center",dot:"block size-1.5 shrink-0 rounded-full"};function Hs({label:e,className:a,"data-testid":s="needs-fix-dot"}){return t.jsxs("span",{"data-testid":s,className:o.cn(Zn.root,a),children:[t.jsx("span",{"aria-hidden":"true","data-testid":`${s}-mark`,className:Zn.dot,style:{backgroundColor:rf}}),t.jsx("span",{className:"sr-only",children:e})]})}Hs.displayName="NeedsFixDot";function lf(e,a){return e.find(s=>s.needsFix&&!s.isDisabled)?.key??a}const zt={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"},of={md:"w-[280px]",lg:"w-[360px]",fill:"min-w-[12.5rem] flex-1"},cf=48,at={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"},Qn={md:"w-[15.625rem]",lg:"w-[22.5rem]",fill:"w-full"},ja={inputWrapper:"h-12 min-h-12 !h-12",input:"text-base",icon:"[&_svg]:size-5"},Xn={button:"shrink-0 text-default-500",input:"[&::-webkit-search-cancel-button]:appearance-none"},Jn={md:{button:"size-8 min-w-8",icon:"size-4"},lg:{button:"size-11 min-w-11",icon:"size-5"}},qi=({searchValue:e,onSearchChange:a,searchLabel:s,searchPlaceholder:n,searchClearable:r,clearLabel:i,size:c,dataTestId:l,startContent:d,classNames:u})=>{const x=h.useRef(null),m=c==="lg",b=r&&e!==""?t.jsx(p.Button,{isIconOnly:!0,size:"sm",variant:"light",color:"default",radius:"full","aria-label":i,onPress:()=>{a(""),x.current?.focus()},className:o.cn(Xn.button,Jn[c].button),testId:`${l}-search-clear`,children:t.jsx(p.Icon,{icon:"lucide:x","aria-hidden":"true",className:Jn[c].icon})}):void 0;return t.jsx(o.Input,{ref:x,type:"search","aria-label":s,placeholder:n??s,value:e,onValueChange:a,startContent:d,endContent:b,"data-testid":`${l}-search`,variant:"bordered",radius:"none",classNames:{base:u.base,inputWrapper:o.cn(u.inputWrapper,m&&ja.inputWrapper),innerWrapper:u.innerWrapper,input:o.cn(u.input,m&&ja.input,r&&Xn.input)}})},df=({searchValue:e,onSearchChange:a,searchLabel:s,searchPlaceholder:n,searchIcon:r,searchClearable:i=!1,clearLabel:c,children:l,trailing:d,searchWidth:u="md",size:x,className:m,"data-testid":b="admin-toolbar"})=>{const{ref:f,width:g}=It(),j=g>0&&!ta(g,cf),y=u==="fill";return t.jsxs("div",{ref:f,role:"search","data-testid":b,"data-variant":"framed","data-size":j?"narrow":"wide",className:o.cn(at.base,j&&at.narrow,m),children:[l,t.jsx("div",{"data-testid":`${b}-search-slot`,className:y?at.searchFill:j?at.searchNarrow:at.searchWide,children:t.jsx(qi,{searchValue:e,onSearchChange:a,searchLabel:s,searchPlaceholder:n,searchClearable:i,clearLabel:c,size:x,dataTestId:b,startContent:t.jsx("span",{"aria-hidden":"true","data-testid":`${b}-search-icon`,className:o.cn(at.icon,x==="lg"&&ja.icon),children:r??t.jsx(p.Icon,{icon:"lucide:search"})}),classNames:{base:y?Qn.fill:j?at.inputBaseNarrow:Qn[u],inputWrapper:at.inputWrapper,innerWrapper:at.innerWrapper,input:at.input}})}),d]})},Gi=({searchValue:e,onSearchChange:a,searchLabel:s,searchPlaceholder:n,searchIcon:r,searchClearable:i=!1,clearLabel:c="Clear search",children:l,trailing:d,searchWidth:u="md",size:x="md",variant:m="default",className:b,"data-testid":f="admin-toolbar"})=>m==="framed"?t.jsx(df,{searchValue:e,onSearchChange:a,searchLabel:s,searchPlaceholder:n,searchIcon:r,searchClearable:i,clearLabel:c,trailing:d,searchWidth:u,size:x,className:b,"data-testid":f,children:l}):t.jsxs("div",{role:"search","data-testid":f,className:o.cn(zt.base,b),children:[t.jsx(qi,{searchValue:e,onSearchChange:a,searchLabel:s,searchPlaceholder:n,searchClearable:i,clearLabel:c,size:x,dataTestId:f,startContent:r?t.jsx("span",{"aria-hidden":"true",className:o.cn(zt.icon,x==="lg"&&ja.icon),children:r}):void 0,classNames:{base:of[u],inputWrapper:zt.inputWrapper,input:zt.input}}),l,d?t.jsx("div",{className:zt.trailing,children:d}):null]});Gi.displayName="AdminToolbar";const uf="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",mf="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",ff="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",Ki=h.forwardRef(function({icon:a,children:s,count:n,appearance:r="pill",className:i,testId:c,...l},d){return r==="outline"?t.jsxs(p.Button,{ref:d,"data-testid":c,"data-appearance":"outline",color:"default",variant:"bordered",radius:"md",size:"md",className:o.cn("rounded-[0.75rem] font-normal",i),...l,children:[t.jsx(p.Icon,{icon:a,className:"size-4","aria-hidden":!0}),t.jsx("span",{children:s}),n!==void 0&&n>0&&t.jsx("span",{className:mf,children:n})]}):t.jsxs(p.Button,{ref:d,"data-testid":c,variant:"light",size:"sm",className:o.cn(ff,i),...l,children:[t.jsx(p.Icon,{icon:a,className:"size-4 text-gray-500","aria-hidden":!0}),t.jsx("span",{children:s}),n!==void 0&&n>0&&t.jsx("span",{className:uf,children:n})]})});Ki.displayName="ToolbarButton";const Xa="w-full mb-4 border-b border-pos-line",Ja=["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",p.stillTransitionClass].join(" "),xf={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 ${p.stillTransitionClass}`,tabContent:`text-[0.9375rem] font-medium text-acct-sub group-data-[selected=true]:font-semibold group-data-[selected=true]:text-acct-rust ${p.stillTransitionClass}`},lg:{base:Xa,tabList:"w-full -mb-px gap-2 rounded-none p-0",cursor:"hidden",tab:`${Ja} min-h-11 px-5 py-0`,tabContent:`text-[0.9375rem] leading-5 font-semibold text-pos-neutral group-data-[selected=true]:text-primary ${p.stillTransitionClass}`},"sm-primary":{base:Xa,tabList:"w-full -mb-px gap-6 rounded-none px-0.5 py-0",cursor:"hidden",tab:`${Ja} px-0.5 py-2.5`,tabContent:`text-[0.84375rem] leading-4 font-medium text-pos-muted group-data-[selected=true]:text-pos-ink ${p.stillTransitionClass}`},"sm-secondary":{base:Xa,tabList:"w-full -mb-px gap-0 rounded-none p-0",cursor:"hidden",tab:`${Ja} px-[1.125rem] py-[0.5625rem]`,tabContent:`text-[0.8125rem] leading-4 font-semibold text-pos-muted group-data-[selected=true]:text-primary ${p.stillTransitionClass}`}},er={base:"mb-0 border-b-0",tabList:"mb-0 border-b-0"},pf="inline-flex items-center gap-1.5",hf="data-[animated=true]:transition-none";function Yi({items:e,value:a,onChange:s,ariaLabel:n,size:r="md",level:i="primary",showDivider:c=!0,needsFixLabel:l,className:d,"data-testid":u="underline-tabs"}){const x=p.useReducedMotion(),m=xf[r==="sm"?`sm-${i}`:r],b=r!=="md",f=e.filter(g=>g.isDisabled).map(g=>g.key);return t.jsx(o.Tabs,{"aria-label":n,variant:"underlined",selectedKey:a,onSelectionChange:g=>s(String(g)),disabledKeys:f,disableCursorAnimation:b,"data-testid":u,"data-size":r,classNames:{...m,base:o.cn(m.base,!c&&er.base,d),tabList:o.cn(m.tabList,!c&&er.tabList),cursor:o.cn(m.cursor,x&&hf),panel:"p-0"},children:e.map(g=>{const j=`${u}-${g.key}`;return t.jsx(o.Tab,{title:g.needsFix?t.jsxs("span",{className:pf,children:[g.label," ",t.jsx(Hs,{label:l??"","data-testid":`${j}-needs-fix`})]}):g.label,titleValue:g.hint,"data-testid":j,"data-needs-fix":g.needsFix?"true":void 0,children:g.content},g.key)})})}Yi.displayName="UnderlineTabs";const Ws="text-[11px] font-semibold uppercase tracking-[.04em] text-acct-muted mb-1.5",Zi="font-normal normal-case tracking-normal",Qi="ms-0.5 text-acct-danger",Xi="mb-0 min-h-[calc(var(--heroui-font-size-small)_+_10px)] text-foreground",Ji="after:content-none",el="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",tl="size-4",al="max-w-xs rounded-xl px-3 py-2 text-xs leading-normal text-acct-ink2",sl=["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(" "),nl="text-[13.5px] text-acct-ink",rl="bg-acct-page text-acct-muted cursor-default",il="mt-[5px] text-xs text-acct-sub",ll="mt-[5px] text-xs text-acct-danger";function bf({label:e}){return t.jsxs(t.Fragment,{children:[t.jsx("span",{"aria-hidden":"true",className:Qi,children:"*"}),e?t.jsxs(t.Fragment,{children:[" ",t.jsx("span",{className:"sr-only",children:e})]}):null]})}function gf({help:e,label:a,labelledBy:s,testId:n}){const r=a?{"aria-label":a}:{"aria-labelledby":s};return t.jsxs(o.Popover,{placement:"top",showArrow:!0,children:[t.jsx(o.PopoverTrigger,{children:t.jsx(p.Button,{isIconOnly:!0,size:"sm",variant:"light",color:"default",radius:"full",...r,testId:n,className:el,children:t.jsx(p.Icon,{"aria-hidden":!0,icon:"solar:info-circle-outline",className:tl})})}),t.jsx(o.PopoverContent,{...r,"data-testid":`${n}-content`,className:al,children:e})]})}function ol(e,a,s,n){return t.jsxs(t.Fragment,{children:[e,a?t.jsxs("span",{className:Zi,children:[" ",a]}):null,s?t.jsx(bf,{label:n}):null]})}const qs=({children:e,suffix:a,htmlFor:s,id:n,isRequired:r,requiredLabel:i,help:c,helpLabel:l,className:d,"data-testid":u="admin-field-label"})=>{const x=h.useId(),m=ol(e,a,r,i),b=p.hasContent(c),f=n??(b?x:void 0);return t.jsxs("div",{"data-testid":u,className:o.cn(Ws,d),children:[s?t.jsx("label",{id:f,htmlFor:s,children:m}):f?t.jsx("span",{id:f,children:m}):m,b&&f?t.jsx(gf,{help:c,label:l,labelledBy:f,testId:`${u}-help`}):null]})};qs.displayName="AdminFieldLabel";const cl=({label:e,labelSuffix:a,value:s,onChange:n,placeholder:r,disabled:i=!1,readOnly:c=!1,mono:l=!1,autoFocus:d=!1,hint:u,invalid:x=!1,isRequired:m=!1,requiredLabel:b,help:f,helpLabel:g,className:j,"data-testid":y="admin-text-field"})=>{const v=h.useId(),C=h.useId(),S=p.hasContent(e),k=S&&p.hasContent(f),$=t.jsx(o.Input,{labelPlacement:S&&!k?"outside":void 0,label:S&&!k?ol(e,a,m,b):void 0,id:k?v:void 0,"aria-labelledby":k?C:void 0,value:s,placeholder:r,isDisabled:i,isReadOnly:c,autoFocus:d,isInvalid:x,isRequired:S&&m,validationBehavior:"aria",description:!x&&u?u:void 0,errorMessage:x?u:void 0,onValueChange:n,"data-testid":y,variant:"bordered",radius:"none",classNames:{base:o.cn("w-full",!k&&j),label:o.cn(Ws,Ji),inputWrapper:sl,input:o.cn(nl,(l||c)&&"font-mono",c&&rl),description:il,errorMessage:ll}});return k?t.jsxs("div",{className:o.cn("w-full",j),children:[t.jsx(qs,{id:C,htmlFor:v,suffix:a,isRequired:m,requiredLabel:b,help:f,helpLabel:g,className:Xi,"data-testid":`${y}-label`,children:e}),$]}):$};cl.displayName="AdminTextField";const yf=1440,xt=e=>String(e).padStart(2,"0"),dl=e=>e.toLowerCase().replace(/[\s.]/g,"");function wa(e){const[a=0,s=0]=e.split(":").map(Number);return a*60+s}function vf(e){return`${xt(Math.floor(e/60))}:${xt(e%60)}`}function xs(e){const a=/^(\d{1,2}):?(\d{2})?(?:(a|p)m?)?$/.exec(dl(e));if(!a)return null;let s=Number(a[1]);const n=Number(a[2]??0),r=a[3];if(n>59)return null;if(r){if(s<1||s>12)return null;s=s%12+(r==="p"?12:0)}else{if(s>23)return null;s>=1&&s<=6&&(s+=12)}return`${xt(s)}:${xt(n)}`}function jf(e,a,s){const n=Math.floor(s);if(!(n>=1))return[];const r=[],i=Math.min(wa(a),yf-1);for(let c=wa(e);c<=i;c+=n)r.push(vf(c));return r}function tr(e,a){return a.includes(":")?e.startsWith(a):e.replace(":","").startsWith(a)}function wf(e,a){const s=/^([\d:]*)(?:(a|p)m?)?$/.exec(dl(a));if(!s)return!1;const[,n="",r]=s,[i=0,c=0]=e.split(":").map(Number),l=`${i%12||12}:${xt(c)}`;return r?r==="p"!=i>=12?!1:tr(l,n):[l,`${xt(i)}:${xt(c)}`,`${i}:${xt(c)}`].some(d=>tr(d,n))}const ar=new Map;function sr(e,a){let s=ar.get(a);s||(s=new Intl.DateTimeFormat(a,{hour:"numeric",minute:"2-digit"}),ar.set(a,s));const[n=0,r=0]=e.split(":").map(Number);return s.format(new Date(2e3,0,1,n,r)).replace(/[\u00a0\u202f]/g," ")}const Vt=(e,a)=>a===void 0||wa(e)>=wa(a);function ul({value:e,defaultValue:a=null,onChange:s,label:n,"aria-label":r,placeholder:i,emptyContent:c,invalidMessage:l,minTime:d,minTimeMessage:u,listStart:x="07:00",listEnd:m="21:00",listStep:b=30,locale:f="en-US",isRequired:g=!1,isDisabled:j=!1,isInvalid:y=!1,errorMessage:v,isClearable:C=!1,clearLabel:S,onBlur:k,size:$,variant:_="bordered",labelPlacement:w="outside-top",className:F,inputProps:A,popoverProps:M,"data-testid":E="time-field"}){const[D,I]=_t(e,a,s),B=se=>se?sr(se,f):"",z=B(D),[q,P]=h.useState(z),[ee,W]=h.useState(null),[Y,K]=h.useState(!1),[ie,te]=h.useState(z);z!==ie&&(te(z),P(z),W(null));const Q=q.trim()!==""&&q!==z,ne=Q?xs(q):null,V=Q?"typed":q.trim()===""&&!Y?"none":"all",O=Q?q:"",Z=h.useMemo(()=>jf(x,m,b),[x,m,b]),Re=h.useMemo(()=>{const se=Z.filter(L=>Vt(L,d));let N;if(V==="typed"){const L=se.filter(H=>wf(H,O)),R=xs(O);N=R!==null&&Vt(R,d)?[R,...L.filter(H=>H!==R)]:L}else V==="none"?N=[]:D!==null&&Vt(D,d)&&!se.includes(D)?N=[...se,D].sort():N=se;return N.map(L=>({key:L,label:sr(L,f)}))},[Z,d,V,O,D,f]),De=h.useCallback(se=>t.jsx(o.AutocompleteItem,{textValue:se.label,"data-testid":`${E}-option-${se.key}`,children:se.label},se.key),[E]),Ee=!Q&&D!==null&&Re.some(se=>se.key===D)?D:null,ae=se=>{W(null),I(se),P(B(se))},be=()=>{if(q.trim()===""){C?ae(null):(P(z),W(null));return}Q&&(ne===null?W("invalid"):Vt(ne,d)?ae(ne):W("min"))},$e=h.useRef(!1),ge=se=>{se!==null&&($e.current=!0,queueMicrotask(()=>{$e.current=!1}),ae(String(se)))},We=D!==null&&!Vt(D,d),Le=ee??(We?"min":null),oe=Le!==null||y,de=Le==="invalid"?l:Le==="min"?u??l:v;return t.jsx(o.Autocomplete,{label:n,"aria-label":r,labelPlacement:w,placeholder:i,size:$,variant:_,className:F,"data-testid":E,allowsCustomValue:!0,isClearable:C,onClear:C?()=>ae(null):void 0,clearButtonProps:C&&S?{"aria-label":S}:void 0,isRequired:g,isDisabled:j,isInvalid:oe,errorMessage:oe?de:void 0,validationBehavior:"aria",items:Re,inputValue:q,onInputChange:se=>{P(se),K(!1),ee&&W(null)},selectedKey:Ee,onSelectionChange:ge,onOpenChange:(se,N)=>K(se&&(N==="focus"||N==="manual")),onBlur:se=>{be(),k?.(se)},onKeyDown:se=>{se.key==="Enter"&&!$e.current&&be(),(se.key==="ArrowDown"||se.key==="ArrowUp")&&K(!0),"continuePropagation"in se&&se.continuePropagation()},inputProps:A,popoverProps:M,listboxProps:{emptyContent:c},children:De})}ul.displayName="TimeField";const ml=({children:e,placeholder:a="Select…",onOpen:s,onClear:n,ariaLabel:r,icon:i,trailingIcon:c,clearIcon:l,disabled:d=!1,className:u,"data-testid":x="picker-row"})=>{const m=e!=null;return t.jsxs("div",{"data-testid":x,className:o.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(p.Button,{variant:"light",radius:"none",disableAnimation:!0,onPress:s,isDisabled:d,"aria-haspopup":"dialog","aria-label":r,"data-testid":`${x}-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:a}),c?t.jsx("span",{className:"ml-auto flex shrink-0 text-acct-muted",children:c}):null]}),m&&n?t.jsx(p.Button,{isIconOnly:!0,variant:"light",radius:"sm",size:"sm",onPress:n,isDisabled:d,"aria-label":`Clear ${r}`,title:"Clear","data-testid":`${x}-clear`,className:"ml-1.5 size-6 min-w-6 shrink-0 text-acct-muted data-[hover=true]:bg-acct-hair",children:l}):null]})};ml.displayName="PickerRow";const Fe={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"},Nf={default:void 0,primary:"text-primary-800",success:void 0,warning:"text-warning-800",danger:void 0},Cf={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"}},fl={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"}},kf={md:void 0,lg:"min-h-12 text-base"},Sf={none:"",sm:"gap-1",md:"gap-2"},xl="m-0 flex list-none flex-col p-0",At={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"]},pl=h.createContext(!1),$f=()=>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"})}),Af=()=>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 Df(e){const a=e.trim().split(/\s+/).filter(Boolean);if(a.length===0)return"—";const s=a[0]?.charAt(0)??"",n=a.length>1?a[a.length-1]?.charAt(0)??"":"";return`${s}${n}`.toUpperCase()}const hl=({title:e,subtitle:a,leading:s,tags:n,onPress:r,href:i,linkAs:c,"aria-haspopup":l,trailing:d,showChevron:u=!1,chevronIcon:x,actions:m,actionsLabel:b,actionsIcon:f,size:g,variant:j="plain",isDisabled:y=!1,as:v,className:C,"data-testid":S="entity-row"})=>{const k=h.useContext(pl),$=ka(),_=g??($==="touch"?"lg":"md"),w=fl[_],F=Cf[j],A=v??(k?"li":"div"),M=h.useId(),E=h.useId(),D=h.useId(),I=h.useId(),B=i!==void 0||r!==void 0,z=n!==void 0&&n.length>0,q=p.hasContent(a),P=m!==void 0&&m.length>0,ee=typeof e=="string"?e:void 0,W=P&&m.some(O=>p.hasContent(O.description)),Y=P?m.filter(O=>O.isDisabled===!0&&p.hasContent(O.description)).map(O=>`${O.label}: ${O.description}`).join(" "):"",K=s?t.jsx(o.Avatar,{"aria-hidden":"true",size:w.avatar,radius:s.shape==="square"?"lg":"full",src:s.src,icon:s.icon,name:s.icon!==void 0?void 0:s.initials??s.name??ee,getInitials:s.initials!==void 0?O=>O:Df,showFallback:s.src!==void 0,classNames:{base:Fe.avatar},"data-testid":`${S}-leading`}):null,ie=t.jsxs(t.Fragment,{children:[K,t.jsxs("span",{className:Fe.text,children:[t.jsxs("span",{className:Fe.titleLine,children:[t.jsx("span",{id:M,className:o.cn(Fe.title,w.title),title:ee,children:e}),z&&t.jsx("span",{id:E,className:Fe.tags,children:n.map(O=>t.jsx(o.Chip,{size:"sm",variant:"flat",color:O.tone??"default",className:Nf[O.tone??"default"],"data-testid":`${S}-tag-${O.key}`,children:O.label},O.key))})]}),q&&t.jsx("span",{id:D,className:o.cn(Fe.subtitle,w.subtitle),children:a})]})]}),te=[z?E:null,q?D:null].filter(Boolean).join(" "),Q={"aria-labelledby":M,"aria-describedby":te===""?void 0:te,isDisabled:y,className:o.cn(Fe.pressTarget,F.overlay,w.content)},ne=`${S}-trigger`;let V;return i!==void 0?V=t.jsx(o.Link,{...Q,"data-testid":ne,as:c,href:i,color:"foreground",underline:"none",onPress:r,children:ie}):r!==void 0?V=t.jsx(p.Button,{...Q,testId:ne,variant:"light",color:"default",radius:"none",disableAnimation:!0,disableRipple:!0,"aria-haspopup":l,onPress:r,children:ie}):V=t.jsx("div",{className:o.cn(Fe.content,w.content),children:ie}),t.jsxs(A,{"data-testid":S,"data-size":_,"data-disabled":y||void 0,className:o.cn(Fe.base,F.row,w.row,B&&!y&&F.hover,C),children:[V,(p.hasContent(d)||P)&&t.jsxs("div",{className:Fe.side,children:[d,P&&t.jsxs(o.Dropdown,{placement:"bottom-end",children:[t.jsx(o.DropdownTrigger,{children:t.jsx(p.Button,{isIconOnly:!0,size:w.control,variant:"light",color:"default",radius:"full",isDisabled:y,"aria-label":b,"aria-describedby":Y===""?void 0:I,testId:`${S}-menu-trigger`,className:Fe.menuTrigger,children:f??t.jsx(Af,{})})}),t.jsx(o.DropdownMenu,{"aria-label":b,"data-testid":`${S}-menu`,className:W?Fe.menuWithDescriptions:void 0,disabledKeys:m.filter(O=>O.isDisabled).map(O=>O.key),onAction:O=>{m.find(Z=>Z.key===O)?.onAction()},items:m,children:O=>{const Z=O.isDisabled===!0&&p.hasContent(O.description);return t.jsx(o.DropdownItem,{textValue:O.label,description:O.description,color:O.tone==="danger"?"danger":"default",className:o.cn(O.tone==="danger"&&Fe.dangerItem,kf[_],Z&&Fe.menuItemDisabledWithDescription),classNames:{title:Z?Fe.menuItemDimmed:void 0,description:o.cn(Fe.menuItemDescription,w.subtitle)},startContent:Z&&O.icon!==void 0?t.jsx("span",{className:Fe.menuItemDimmedIcon,children:O.icon}):O.icon,"data-testid":O["data-testid"]??`${S}-menu-${O.key}`,children:O.label},O.key)}})]}),Y!==""&&t.jsx("span",{id:I,hidden:!0,"data-testid":`${S}-menu-trigger-description`,children:Y})]}),u&&t.jsx("span",{"aria-hidden":"true",className:Fe.chevron,"data-testid":`${S}-chevron`,children:x??t.jsx($f,{})})]})};hl.displayName="EntityRow";const bl=({children:e,"aria-label":a,"aria-labelledby":s,gap:n="none",className:r,"data-testid":i="entity-list"})=>t.jsx("ul",{"aria-label":a,"aria-labelledby":s,"data-testid":i,className:o.cn(xl,Sf[n],r),children:t.jsx(pl.Provider,{value:!0,children:e})});bl.displayName="EntityList";const gl=({label:e,rows:a=6,size:s,className:n,"data-testid":r="entity-list-skeleton"})=>{const i=ka(),c=s??(i==="touch"?"lg":"md"),{titleWidths:l}=At;return t.jsxs("div",{"aria-busy":"true","data-testid":r,className:n,children:[t.jsx("span",{role:"status",className:"sr-only",children:e}),t.jsx("ul",{"aria-hidden":"true",className:xl,children:Array.from({length:a},(d,u)=>t.jsxs("li",{"data-testid":`${r}-row`,className:o.cn(At.row,fl[c].row),children:[t.jsx(p.Skeleton,{className:At.avatar[c]}),t.jsxs("span",{className:At.lines,children:[t.jsx(p.Skeleton,{className:o.cn(At.title,l[u%l.length])}),t.jsx(p.Skeleton,{className:At.subtitle})]})]},u))})]})};gl.displayName="EntityListSkeleton";function yl(e,a,s){if(s<=0||a<=0||e<=0)return{from:0,to:0};const n=(e-1)*a+1;return n>s?{from:0,to:0}:{from:n,to:Math.min(s,e*a)}}const vl=({page:e,pageSize:a,total:s,unit:n,announce:r=!0,format:i,className:c,classNames:l={},"data-testid":d="pagination-summary"})=>{const{from:u,to:x}=yl(e,a,s),m=o.cn("font-semibold text-default-700",l.emphasis);return t.jsx("p",{"data-testid":d,"aria-live":r?"polite":void 0,className:o.cn("text-sm text-default-500",c,l.base),children:i?i({from:u,to:x,total:s}):t.jsxs(t.Fragment,{children:["Showing"," ",t.jsx("span",{"data-testid":`${d}-range`,className:m,children:u===0?0:`${u}–${x}`})," ","of"," ",t.jsx("span",{"data-testid":`${d}-total`,className:m,children:s}),n?t.jsxs(t.Fragment,{children:[" ",n]}):null]})})};vl.displayName="PaginationSummary";const La="shadow-[0_1px_4px_rgba(0,0,0,.06),0_4px_12px_rgba(0,0,0,.06)]",rt={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"},Ef={card:La,flat:""},Lf={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]"},Ff={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:""}},jl=({isLoading:e=!1,isError:a=!1,isEmpty:s=!1,loadingTitle:n="Loading…",loadingContent:r,errorTitle:i="Something went wrong",errorDescription:c,retryLabel:l="Retry",onRetry:d,errorActions:u,errorContent:x,emptyTitle:m="Nothing here yet",emptyDescription:b,emptyIcon:f,emptyActions:g,emptyContent:j,children:y,toolbar:v,variant:C="default",className:S,classNames:k={},"data-testid":$="list-panel"})=>{const _=C==="framed",w={base:o.cn("border-0 bg-transparent py-12",k.state)},F=_?{base:o.cn("px-6 py-[3.625rem]",k.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"}:w;let A;return e?A=r??t.jsx(Bs,{title:n,classNames:w,"data-testid":`${$}-loading`}):a?A=x??t.jsx(Ms,{title:i,description:c,classNames:w,"data-testid":`${$}-error`,actions:u??(d?t.jsx(p.Button,{color:"primary",variant:"flat",onPress:d,children:l}):void 0)}):s?A=j??t.jsx(Is,{surface:_?"panel":void 0,title:m,description:b,icon:f,actions:g,classNames:F,"data-testid":`${$}-empty`}):A=y,t.jsxs("section",{"data-testid":$,"data-variant":_?"framed":void 0,className:o.cn(_?`overflow-hidden rounded-2xl border border-pos-line bg-white ${La}`:"rounded-xl bg-white p-2 shadow-sm",S,k.base),children:[v,A]})};jl.displayName="ListPanel";const Gs=(e,a)=>a<=0?/^\d*$/.test(e):new RegExp(`^\\d*(?:[.,]\\d{0,${a}})?$`).test(e),Qt=e=>{const a=Number.parseFloat(e.replace(",","."));return Number.isFinite(a)?a:null},wl=(e,a)=>{const[s,n]=h.useState(()=>a(e)),r=(Qt(s)??0)===(e??0)?s:a(e),i=h.useCallback(()=>{n(c=>{const l=Qt(c);return l===null?"":String(l)})},[]);return{draft:r,setDraft:n,normalize:i}},_f=/^[\d.,]+$/,Nl=(e,a=Object.is)=>{const s=h.useRef(e),n=h.useRef(null);h.useLayoutEffect(()=>{s.current=e},[e]);const r=h.useCallback(()=>{const l=n.current,d=s.current;return l===null||!(a(d,l.source)||a(d,l.emitted))},[a]),i=h.useCallback(l=>{n.current={source:s.current,emitted:l}},[]),c=h.useCallback(()=>{n.current=null},[]);return h.useMemo(()=>({isUntouched:r,markEdited:i,markUntouched:c}),[r,i,c])},Cl=(e,a)=>{const s=h.useRef(null),n=h.useRef(a);return h.useLayoutEffect(()=>{n.current=a},[a]),h.useEffect(()=>{const r=s.current;if(!r)return;const i=l=>{e()&&(l.inputType==="insertText"&&l.data&&_f.test(l.data)?(l.preventDefault(),n.current(l.data)):l.inputType.startsWith("delete")&&(l.preventDefault(),n.current("")))},c=()=>{requestAnimationFrame(()=>{r.isConnected&&e()&&r.select()})};return r.addEventListener("beforeinput",i),r.addEventListener("pointerup",c),()=>{r.removeEventListener("beforeinput",i),r.removeEventListener("pointerup",c)}},[e]),s},Rf=350,If={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}"},Mf=7,Bf=e=>[...new Set((e??[]).filter(a=>Number.isFinite(a)&&a>0))].sort((a,s)=>a-s).slice(0,Mf),Pf=(e,a,s)=>{if(!Number.isInteger(e))return fe(e,a,s);try{return new Intl.NumberFormat(a,{style:"currency",currency:s,minimumFractionDigits:0}).format(e)}catch{return fe(e,a,s)}},Tf=(e,a)=>(e??0)===(a??0),Ut=(e,a)=>Object.entries(a).reduce((s,[n,r])=>s.replace(`{${n}}`,r),e),Of=({dueAmount:e,received:a,defaultReceived:s=null,onChange:n,locale:r="en-US",labels:i,isDisabled:c=!1,maxAmount:l,quickAmounts:d,showExactAmount:u=!0,autoFocus:x=!1,className:m,"data-testid":b="cash-tender-form"})=>{const f={...If,...i},g=Rt(e.currency,r),j=a!==void 0,[y,v]=h.useState(s??null),C=j?a:y,{draft:S,setDraft:k,normalize:$}=wl(C,V=>V==null?"":String(V)),{isUntouched:_,markEdited:w,markUntouched:F}=Nl(C,Tf),A=h.useMemo(()=>{const V=typeof C=="number"&&Number.isFinite(C)?C:0,O=is(V,e.value,e.currency,r);return{received:V,change:O>0?O:0,isValid:V>=e.value&&V>0}},[C,e.value,e.currency,r]),M=h.useCallback(V=>{const O=V.currentTarget;requestAnimationFrame(()=>{O.isConnected&&O.select()})},[]),E=h.useCallback(V=>{j||v(V);const O=typeof V=="number"&&Number.isFinite(V)?V:0,Z=is(O,e.value,e.currency,r);n?.({received:O,change:Z>0?Z:0,isValid:O>=e.value&&O>0})},[j,e.value,e.currency,r,n]),D=h.useCallback(V=>{if(c)return;const O=V.replace(/[^\d.,]/g,"");if(!Gs(O,g))return;const Z=Qt(O);Z!==null&&l!==void 0&&Z>l||(k(O),w(Z),E(Z))},[c,l,k,w,g,E]),I=Cl(_,D),B=h.useMemo(()=>Bf(d),[d]),z=V=>l!==void 0&&V>l,q=()=>{c||z(e.value)||(k(String(e.value)),F(),E(e.value))},P=V=>{if(c)return;const O=_()||typeof C!="number"||!Number.isFinite(C)?0:C,Z=ks(O+V,e.currency,r);z(Z)||(k(String(Z)),w(Z),E(Z))},ee=A.isValid&&A.change>0,W=!A.isValid&&A.received>0,Y=fe(A.change,r,e.currency),K=fe(e.value,r,e.currency),[ie,te]=h.useState(""),Q=h.useRef(null);h.useEffect(()=>{Q.current&&clearTimeout(Q.current);const V=ee?Ut(f.changeMessageTemplate,{change:Y}):"",O=ee?Rf:0;return Q.current=setTimeout(()=>te(V),O),()=>{Q.current&&clearTimeout(Q.current)}},[ee,Y,f.changeMessageTemplate]);const ne=`${b}-received`;return t.jsxs("div",{className:o.cn("flex flex-col gap-3",m),"data-testid":b,children:[t.jsx(o.Input,{ref:I,id:ne,label:f.receivedLabel,labelPlacement:"outside",type:"text",inputMode:g===0?"numeric":"decimal",pattern:g===0?"[0-9]*":"[0-9]*[.,]?[0-9]*",value:S,onChange:V=>D(V.target.value),onFocus:M,onBlur:$,placeholder:f.receivedPlaceholder,isDisabled:c,isInvalid:W,errorMessage:W?Ut(f.insufficientMessageTemplate,{due:K}):void 0,variant:"bordered",radius:"lg",autoFocus:x,"data-testid":`${b}-received-input`}),B.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":`${b}-quick-amounts`,children:[u&&t.jsxs(p.Button,{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:c,"aria-label":Ut(f.exactAmountAriaTemplate,{amount:K}),onPress:q,"data-testid":`${b}-quick-amount-exact`,children:[f.exactAmountLabel," ",K]}),B.map(V=>{const O=Pf(V,r,e.currency);return t.jsx(p.Button,{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:c,"aria-label":Ut(f.quickAmountAriaTemplate,{amount:O}),onPress:()=>P(V),"data-testid":`${b}-quick-amount-${V}`,children:O},V)})]})}),ee&&t.jsx(o.Alert,{"data-testid":`${b}-change-alert`,color:"primary",variant:"flat",radius:"lg",title:f.changeLabel,description:Ut(f.changeMessageTemplate,{change:Y}),icon:t.jsx(p.Icon,{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:ie})]})},zf={checkNumberLabel:"Check Number",checkNumberPlaceholder:"e.g. 11234",bankNameLabel:"Bank Name",bankNamePlaceholder:"e.g. Chase Bank",dateLabel:"Date",checkNumberRequiredMessage:"Check number is required"},nr=()=>{const e=new Date,a=s=>String(s).padStart(2,"0");return`${e.getFullYear()}-${a(e.getMonth()+1)}-${a(e.getDate())}`},kl=({dueAmount:e,value:a,defaultValue:s,onChange:n,labels:r,hideDate:i=!1,hideBankName:c=!1,isDisabled:l=!1,checkNumberMaxLength:d=34,bankNameMaxLength:u=100,autoFocus:x=!1,className:m,"data-testid":b="check-tender-form"})=>{const f={...zf,...r},g=a!==void 0,[j,y]=h.useState({checkNumber:s?.checkNumber??"",bankName:s?.bankName??"",date:s?.date??nr()}),[v,C]=h.useState(!!s?.checkNumber),S=h.useMemo(()=>g?{checkNumber:a?.checkNumber??"",bankName:a?.bankName??"",date:a?.date??nr()}:j,[g,a,j]),k=h.useCallback(E=>{g||y(E);const D=E.checkNumber.trim(),I={amount:e.value,checkNumber:D,bankName:E.bankName.trim()||void 0,date:i?void 0:E.date,isValid:D.length>0&&e.value>0};n?.(I)},[g,e.value,i,n]),$=h.useCallback(E=>D=>{l||(E==="checkNumber"&&D.length>0&&C(!0),k({...S,[E]:D}))},[S,k,l]),_=h.useCallback(()=>{l||C(!0)},[l]),w=v&&S.checkNumber.trim()==="",F=`${b}-check-number`,A=`${b}-bank-name`,M=`${b}-date`;return t.jsxs("div",{className:o.cn("grid grid-cols-1 sm:grid-cols-2 gap-4",m),"data-testid":b,children:[t.jsx(o.Input,{id:F,label:f.checkNumberLabel,labelPlacement:"outside",type:"text",value:S.checkNumber,onChange:E=>$("checkNumber")(E.target.value),onBlur:_,placeholder:f.checkNumberPlaceholder,maxLength:d,isRequired:!0,isInvalid:w,errorMessage:w?f.checkNumberRequiredMessage:void 0,isDisabled:l,variant:"bordered",radius:"lg",autoFocus:x,"data-testid":`${b}-check-number-input`}),!c&&t.jsx(o.Input,{id:A,label:f.bankNameLabel,labelPlacement:"outside",type:"text",value:S.bankName,onChange:E=>$("bankName")(E.target.value),placeholder:f.bankNamePlaceholder,maxLength:u,isDisabled:l,variant:"bordered",radius:"lg","data-testid":`${b}-bank-name-input`}),!i&&t.jsx(o.Input,{id:M,label:f.dateLabel,labelPlacement:"outside",type:"date",value:S.date,onChange:E=>$("date")(E.target.value),isDisabled:l,variant:"bordered",radius:"lg","data-testid":`${b}-date-input`,className:"sm:col-span-2"})]})};kl.displayName="CheckTenderForm";const Vf={methodLabel:"Method",methodPlaceholder:"Select a payment method",referenceLabel:"Reference",referencePlaceholder:"e.g. Voucher #1234",methodRequiredMessage:"Method is required"},Uf=[{value:"ach",label:"ACH"},{value:"wire",label:"Wire"},{value:"gift_card",label:"Gift Card"},{value:"voucher",label:"Voucher"},{value:"other",label:"Other"}],Sl=({dueAmount:e,methodOptions:a=Uf,value:s,defaultValue:n,onChange:r,labels:i,showReference:c=!1,isDisabled:l=!1,className:d,"data-testid":u="other-tender-form"})=>{const x={...Vf,...i},m=s!==void 0,[b,f]=h.useState({method:n?.method??"",reference:n?.reference??""}),g=h.useMemo(()=>m?{method:s?.method??"",reference:s?.reference??""}:b,[m,s,b]),j=h.useCallback($=>a.find(_=>_.value===$)?.label??"",[a]),y=h.useCallback($=>{m||f($);const _=j($.method),w={amount:e.value,method:$.method,description:_,reference:$.reference.trim()||void 0,isValid:$.method!==""};r?.(w)},[m,e.value,r,j]),v=h.useCallback($=>{if(l)return;const _=typeof $=="string"?$:Array.from($)[0]?.toString()??"";y({...g,method:_})},[g,y,l]),C=h.useCallback($=>{l||y({...g,reference:$})},[g,y,l]),S=`${u}-method`,k=`${u}-reference`;return t.jsxs("div",{className:o.cn("flex flex-col gap-3",d),"data-testid":u,children:[t.jsx(p.Select,{id:S,label:x.methodLabel,labelPlacement:"outside",placeholder:x.methodPlaceholder,selectedKeys:g.method?[g.method]:[],onSelectionChange:v,isDisabled:l,isRequired:!0,variant:"bordered",radius:"lg","data-testid":`${u}-method-select`,popoverProps:{placement:"bottom-start",classNames:{content:"bg-white border border-default-200 shadow-lg rounded-xl p-1"}},listboxProps:{classNames:{list:"max-h-[var(--popover-available-height,40vh)] overflow-y-auto"},itemClasses:{base:["rounded-lg","px-3 py-2","text-default-800","data-[hover=true]:bg-default-100","data-[selectable=true]:focus:bg-default-100","data-[selected=true]:bg-primary-50","data-[selected=true]:text-primary","data-[selected=true]:font-medium"]}},children:a.map($=>t.jsx(o.SelectItem,{"data-testid":`${u}-method-option-${$.value}`,children:$.label},$.value))}),c&&t.jsx(o.Input,{id:k,label:x.referenceLabel,labelPlacement:"outside",type:"text",value:g.reference,onChange:$=>C($.target.value),placeholder:x.referencePlaceholder,isDisabled:l,variant:"bordered",radius:"lg","data-testid":`${u}-reference-input`})]})};Sl.displayName="OtherTenderForm";const Hf={collectedHeading:"Collected",remainingLabel:"Remaining:",completeLabel:"Complete",removeAriaLabel:"Remove this tender",removeTooltipForRecorded:"Already recorded",statusPending:"Pending",statusRecorded:"Approved",statusFailed:"Failed"},Wf={card:"lucide:credit-card",cash:"lucide:dollar-sign",check:"lucide:edit-3",other:"lucide:more-horizontal"},qf={pending:"warning",recorded:"success",failed:"danger"},Gf=e=>e==="pending"||e==="recorded",Kf=e=>`#${e+1}`,$l=({total:e,tenders:a,onRemove:s,locale:n="en-US",labels:r,hideCollectedList:i=!1,variant:c="banner",className:l,"data-testid":d="split-payment-summary"})=>{const u={...Hf,...r},{collected:x,remaining:m,isComplete:b}=h.useMemo(()=>{const g=a.reduce((y,v)=>Gf(v.status)?y+v.amount:y,0),j=Math.max(e.value-g,0);return{collected:g,remaining:j,isComplete:g>=e.value&&e.value>0}},[a,e.value]),f=g=>g==="pending"?u.statusPending:g==="recorded"?u.statusRecorded:u.statusFailed;return t.jsxs("div",{className:o.cn("flex flex-col gap-4",l),"data-testid":d,children:[c==="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:b?u.completeLabel:u.remainingLabel}),t.jsx("span",{className:"text-base font-semibold tracking-tight","data-testid":`${d}-remaining-amount`,children:fe(b?x:m,n,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:b?u.completeLabel:u.remainingLabel}),t.jsx("div",{className:"mt-1 text-4xl font-bold tracking-tight","data-testid":`${d}-remaining-amount`,children:fe(b?x:m,n,e.currency)})]}),!i&&a.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}),a.map((g,j)=>t.jsx(Yf,{index:j,tender:g,locale:n,currency:e.currency,removable:!!s&&g.status!=="recorded",onRemove:s?()=>s(g.id):void 0,statusLabel:f(g.status),removeAriaLabel:u.removeAriaLabel,recordedTooltip:u.removeTooltipForRecorded,dataTestId:`${d}-row-${j}`},g.id))]})]})};$l.displayName="SplitPaymentSummary";const Yf=({index:e,tender:a,locale:s,currency:n,removable:r,onRemove:i,statusLabel:c,removeAriaLabel:l,recordedTooltip:d,dataTestId:u})=>{const x=i?t.jsx(p.Button,{isIconOnly:!0,variant:"light",radius:"full",size:"sm",onPress:i,isDisabled:!r,"aria-label":l,"data-testid":`${u}-remove`,className:o.cn(r?"text-default-700 hover:bg-default-200":"text-default-300"),children:t.jsx(p.Icon,{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:Kf(e)}),t.jsx(p.Icon,{icon:Wf[a.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:a.label}),t.jsx("span",{className:"font-semibold tabular-nums","data-testid":`${u}-amount`,children:fe(a.amount,s,n)}),t.jsx(o.Chip,{size:"sm",radius:"full",variant:"flat",color:qf[a.status],startContent:a.status==="recorded"?t.jsx(p.Icon,{icon:"lucide:check-circle",width:14,height:14,"aria-hidden":"true"}):a.status==="failed"?t.jsx(p.Icon,{icon:"lucide:alert-circle",width:14,height:14,"aria-hidden":"true"}):void 0,"data-testid":`${u}-status`,children:c}),x&&(r?x:t.jsx(o.Tooltip,{content:d,placement:"left",children:t.jsx("span",{tabIndex:0,"aria-label":d,children:x})}))]})},Zf=`
|
|
15
|
+
${f?"cursor-default":"cursor-pointer hover:text-primary"}
|
|
16
|
+
`,"aria-label":`Zoom level ${e}%`,children:[e,"%"]})}),t.jsx(o.Tooltip,{content:"Zoom in",placement:"top",offset:10,children:t.jsx(p.Button,{size:"sm",radius:"sm",color:"default",variant:"bordered",isIconOnly:!0,isDisabled:u,onPress:c,"aria-label":"Zoom in",children:t.jsx(J.ZoomIn,{size:16})})})]})}function bd({editor:e,isDisabled:a=!1}){const[s,n]=h.useState(!1),[r,i]=h.useState(""),[c,l]=h.useState(""),[d,u]=h.useState(!1),f=e.isActive("link"),m=x=>{if(x){const{from:g,to:j}=e.state.selection,y=e.isActive("link");let v="";if(y){const S=e.schema.marks.link,k=e.state.doc.resolve(g),$=un.getMarkRange(k,S);$&&(v=e.state.doc.textBetween($.from,$.to,""))}else v=e.state.doc.textBetween(g,j,"");const C=e.getAttributes("link").href||"";i(v),l(C),u(y)}n(x)},b=()=>{if(c.trim()){const{from:x,to:g}=e.state.selection,j=e.schema.marks.link,y=e.state.doc.resolve(x),v=un.getMarkRange(y,j),C=v?.from??x,S=v?.to??g,k=e.state.doc.textBetween(C,S,"");r.trim()&&r!==k?e.chain().focus().setTextSelection({from:C,to:S}).deleteSelection().insertContent(`<a href="${c.trim()}">${r.trim()}</a>`).run():e.chain().focus().extendMarkRange("link").updateAttributes("link",{href:c.trim()}).run()}n(!1)};return t.jsxs(o.Popover,{isOpen:s,onOpenChange:m,placement:"bottom",children:[t.jsx(o.PopoverTrigger,{children:t.jsx(p.Button,{size:"sm",radius:"sm",variant:f?"solid":"bordered",color:f?"primary":"default",isIconOnly:!0,isDisabled:a,"aria-label":"Link",children:t.jsx(J.Link,{size:16})})}),t.jsx(o.PopoverContent,{children:t.jsxs("div",{className:"flex flex-col gap-3 p-3 w-72",children:[t.jsx(o.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(o.Input,{size:"sm",variant:"bordered",label:"Link",labelPlacement:"outside",placeholder:"https://example.com",value:c,onChange:x=>l(x.target.value),onKeyDown:x=>x.key==="Enter"&&b(),classNames:{inputWrapper:"focus-within:border-default-400"}}),t.jsx(p.Button,{size:"sm",color:"primary",onPress:b,isDisabled:!c.trim(),children:d?"Update":"Apply"})]})})]})}function gd({children:e,id:a,label:s,className:n,useButtonGroup:r=!0}){return r?t.jsx(o.ButtonGroup,{size:"sm",id:a,"aria-label":s,className:n,children:e}):t.jsx("div",{id:a,role:"group","aria-label":s,className:`flex items-center gap-2 ${n||""}`,children:e})}function Jr(e,a){const s=h.useMemo(()=>{if(!e)return{};const i={};return Array.from(new Set(a.map(l=>Qt(l)))).forEach(l=>{const d=ot[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,a]),[n,r]=h.useState(s);return h.useEffect(()=>{if(!e)return;const i=()=>{const c={};Array.from(new Set(a.map(d=>Qt(d)))).forEach(d=>{const u=ot[d];if(u)try{const f=u.canExecute?.(e)??!0,m=u.isActive?.(e)??!1;c[d]={isActive:m,isDisabled:!f,canExecute:f}}catch(f){console.warn(`Extension not available for modifier: ${d}`,f),c[d]={isActive:!1,isDisabled:!0,canExecute:!1}}}),r(c)};return e.on("selectionUpdate",i),e.on("transaction",i),()=>{e.off("selectionUpdate",i),e.off("transaction",i)}},[e,a,s]),n}function ei(e,a){const s=h.useCallback((c,l)=>{if(!e)return;const d=ot[c];if(d)try{d.execute({editor:e,config:l}),a?.({type:"toggle",modifier:c})}catch(u){console.warn(`Failed to execute command for modifier: ${c}`,u)}},[e,a]),n=h.useCallback(c=>{s(c)},[s]),r=h.useCallback((c,l)=>{if(!e)return!1;const d=ot[c];try{return d?.canExecute?.(e,l)??!1}catch(u){return console.warn(`Failed to check canExecute for modifier: ${c}`,u),!1}},[e]),i=h.useCallback((c,l)=>{if(!e)return!1;const d=ot[c];try{return d?.isActive?.(e,l)??!1}catch(u){return console.warn(`Failed to check isActive for modifier: ${c}`,u),!1}},[e]);return{executeCommand:s,toggleModifier:n,canExecute:r,isActive:i}}function yd(e=Me.default){const[a,s]=h.useState(e),n=h.useCallback((l=Me.step)=>{s(d=>Math.min(Me.max,d+l))},[]),r=h.useCallback((l=Me.step)=>{s(d=>Math.max(Me.min,d-l))},[]),i=h.useCallback(()=>{s(Me.default)},[]),c=h.useCallback(l=>{const d=Math.max(Me.min,Math.min(Me.max,l));s(d)},[]);return{zoom:a,setZoom:c,zoomIn:n,zoomOut:r,resetZoom:i,isMinZoom:a<=Me.min,isMaxZoom:a>=Me.max,isDefaultZoom:a===Me.default}}const vd=["bold","italic","strike","underline","code"];function jd({editor:e,modifiers:a,onToolbarAction:s}){const n=Jr(e,a),{toggleModifier:r}=ei(e,s);if(!e)return null;const i=a.map(c=>Qt(c)).filter(c=>vd.includes(c));return i.length===0?null:t.jsx(gd,{id:"text-formatting",label:"Text formatting",children:i.map(c=>{const l=n[c],d=Lt(c);return t.jsx(yt,{icon:d,label:c.charAt(0).toUpperCase()+c.slice(1),isActive:l?.isActive,isDisabled:l?.isDisabled,onClick:()=>r(c)},c)})})}function wd({editor:e,modifiers:a,zoom:s=100,onZoomChange:n,sticky:r=!0,className:i,onToolbarAction:c}){const l=Jr(e,a),{toggleModifier:d,executeCommand:u}=ei(e,c);if(!e)return null;const f=a.map(w=>Qt(w)),m=f.some(w=>["bold","italic","strike","underline","code"].includes(w)),b=f.some(w=>["textColor","highlight"].includes(w)),x=f.includes("heading"),g=f.includes("textAlign"),j=f.some(w=>["bulletList","orderedList","taskList"].includes(w)),y=f.includes("blockquote"),v=f.includes("codeBlock"),C=f.includes("link"),S=f.includes("horizontalRule"),k=f.some(w=>["undo","redo"].includes(w)),$=s!==void 0&&n!==void 0,_=r?"sticky top-0 z-10":"";return t.jsx("div",{className:`w-full p-2 bg-background border-b border-divider ${_} ${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(jd,{editor:e,modifiers:a,onToolbarAction:c}),(b||x||g||j||y||v||C||S||k||$)&&t.jsx(ht,{})]}),b&&t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"flex items-center gap-1",children:[f.includes("textColor")&&t.jsx(Nn,{editor:e,type:"textColor",label:"Text color",isDisabled:l.textColor?.isDisabled}),f.includes("highlight")&&t.jsx(Nn,{editor:e,type:"highlight",label:"Highlight",isDisabled:l.highlight?.isDisabled})]}),(x||g||j||y||v||C||S||k||$)&&t.jsx(ht,{})]}),x&&t.jsxs(t.Fragment,{children:[t.jsx(od,{editor:e}),(g||j||y||v||C||S||k||$)&&t.jsx(ht,{})]}),g&&t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"flex items-center gap-1",children:["left","center","right","justify"].map(w=>{const F=xd[w],A=e.isActive({textAlign:w});return t.jsx(yt,{icon:F,label:`Align ${w}`,isActive:A,onClick:()=>u("textAlign",{type:"textAlign",alignment:w})},w)})}),(j||y||v||C||S||k||$)&&t.jsx(ht,{})]}),j&&t.jsxs(t.Fragment,{children:[t.jsx(cd,{editor:e,types:f.filter(w=>["bulletList","orderedList","taskList"].includes(w))}),(y||v||C||S||k||$)&&t.jsx(ht,{})]}),(y||v||C||S)&&t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"flex items-center gap-1",children:[y&&t.jsx(yt,{icon:Lt("blockquote"),label:"Blockquote",isActive:l.blockquote?.isActive,isDisabled:l.blockquote?.isDisabled,onClick:()=>d("blockquote")}),v&&t.jsx(yt,{icon:Lt("codeBlock"),label:"Code block",isActive:l.codeBlock?.isActive,isDisabled:l.codeBlock?.isDisabled,onClick:()=>d("codeBlock")}),C&&t.jsx(bd,{editor:e,isDisabled:l.link?.isDisabled}),S&&t.jsx(yt,{icon:Lt("horizontalRule"),label:"Horizontal rule",onClick:()=>d("horizontalRule")})]}),(k||$)&&t.jsx(ht,{})]}),k&&t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"flex items-center gap-1",children:[f.includes("undo")&&t.jsx(yt,{icon:Lt("undo"),label:"Undo",isDisabled:l.undo?.isDisabled,onClick:()=>d("undo")}),f.includes("redo")&&t.jsx(yt,{icon:Lt("redo"),label:"Redo",isDisabled:l.redo?.isDisabled,onClick:()=>d("redo")})]}),$&&t.jsx(ht,{})]}),$&&t.jsx(hd,{zoom:s,onZoomChange:w=>{n?.(w),c?.({type:"zoom",modifier:`${w}%`})}})]})})}const Tt={bold:{category:"mark",extension:To.Bold,priority:100},italic:{category:"mark",extension:Oo.Italic,priority:100},strike:{category:"mark",extension:zo.Strike,priority:100},underline:{category:"mark",extension:Vo.Underline,priority:100},code:{category:"mark",extension:Uo.Code,priority:100},textColor:{category:"mark",extension:Ho.Color,defaultOptions:{types:["textStyle","heading","paragraph","listItem","taskItem","blockquote"]},priority:90},highlight:{category:"mark",extension:Wo.Highlight,defaultOptions:{multicolor:!0},priority:90},link:{category:"mark",extension:qo.Link,defaultOptions:{autolink:!0,linkOnPaste:!0,openOnClick:!1,HTMLAttributes:{class:"text-primary underline cursor-pointer"}},priority:100},heading:{category:"node",extension:Ko.Heading,defaultOptions:{levels:[1,2,3,4,5,6]},priority:100},bulletList:{category:"node",extension:Zo.BulletList,defaultOptions:{HTMLAttributes:{class:"list-disc"}},priority:90},orderedList:{category:"node",extension:Qo.OrderedList,defaultOptions:{HTMLAttributes:{class:"list-decimal"}},priority:90},taskList:{category:"node",extension:Xo.TaskList,defaultOptions:{HTMLAttributes:{class:"task-list"}},priority:90},codeBlock:{category:"node",extension:tc.CodeBlock,priority:100},blockquote:{category:"node",extension:ac.Blockquote,priority:100},horizontalRule:{category:"node",extension:sc.HorizontalRule,priority:100},hardBreak:{category:"node",extension:nc.HardBreak,priority:100},undo:{category:"extension",extension:mn.History,priority:50},redo:{category:"extension",extension:mn.History,priority:50},textAlign:{category:"extension",extension:rc.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}},Nd=[ic.Document,lc.Text,Yo.Paragraph,Go.TextStyle.configure({HTMLAttributes:{}}),ec.ListItem.configure({HTMLAttributes:{}}),Jo.TaskItem.configure({nested:!0}),oc.Dropcursor,cc.Gapcursor];function Cd(e){const a=[],s=new Set,n=new Set;Nd.forEach(l=>{l&&(a.push(l),n.add(l.name))});const r=e.map(l=>Qt(l)),i=new Set;return r.forEach(l=>{const d=Tt[l];d?.requiredExtensions&&d.requiredExtensions.forEach(u=>{i.add(u)})}),i.forEach(l=>{if(s.has(l))return;const d=Tt[l];if(!d||d.extension===null)return;const u=d.extension.name;if(n.has(u)){s.add(l);return}const f=d.defaultOptions?d.extension.configure(d.defaultOptions):d.extension;a.push(f),s.add(l),n.add(u)}),r.forEach(l=>{if(s.has(l))return;const d=Tt[l];if(!d){console.warn(`Extension config not found for modifier: ${l}`);return}if(d.extension===null){s.add(l);return}const u=d.extension.name;if(n.has(u)){s.add(l);return}const f=d.defaultOptions?d.extension.configure(d.defaultOptions):d.extension;a.push(f),s.add(l),n.add(u)}),a.sort((l,d)=>{const u=Object.values(Tt).find(x=>x?.extension?.name===l.name),f=Object.values(Tt).find(x=>x?.extension?.name===d.name),m=u?.priority??100;return(f?.priority??100)-m})}const ti={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"]},kd={h1:`font-size: ${ye.fontSize["4xl"]}; font-weight: ${ye.fontWeight.semibold}; line-height: ${ye.lineHeight.tight}; margin: ${pe.md} 0 ${pe.sm} 0;`,h2:`font-size: ${ye.fontSize["2xl"]}; font-weight: ${ye.fontWeight.semibold}; line-height: ${ye.lineHeight.tight}; margin: ${pe.md} 0 ${pe.sm} 0;`,h3:`font-size: ${ye.fontSize.xl}; font-weight: ${ye.fontWeight.semibold}; line-height: ${ye.lineHeight.tight}; margin: ${pe.md} 0 ${pe.sm} 0;`,h4:`font-size: ${ye.fontSize.lg}; font-weight: ${ye.fontWeight.semibold}; line-height: ${ye.lineHeight.tight}; margin: ${pe.md} 0 ${pe.sm} 0;`,h5:`font-size: ${ye.fontSize.base}; font-weight: ${ye.fontWeight.semibold}; line-height: ${ye.lineHeight.tight}; margin: ${pe.md} 0 ${pe.sm} 0;`,h6:`font-size: ${ye.fontSize.sm}; font-weight: ${ye.fontWeight.semibold}; line-height: ${ye.lineHeight.tight}; margin: ${pe.md} 0 ${pe.sm} 0;`,p:`min-height: ${ye.lineHeight.normal}em; margin: 0;`,ul:`list-style-type: disc; list-style-position: outside; padding-left: ${pe.xl}; margin: ${pe.md} 0;`,ol:`list-style-type: decimal; list-style-position: outside; padding-left: ${pe.xl}; margin: ${pe.md} 0;`,li:`display: list-item; margin: ${pe.xs} 0;`,strong:`font-weight: ${ye.fontWeight.bold};`,em:"font-style: italic;",s:"text-decoration: line-through;",u:"text-decoration: underline;",code:`background-color: ${Ae.neutral.gray[100]}; border-radius: 0.4rem; font-size: ${ye.fontSize.sm}; padding: 0.25em 0.3em; font-family: ${ye.fontFamily.mono};`,pre:`background: ${Ae.neutral.gray[800]}; border-radius: ${pe.sm}; color: ${Ae.neutral.gray[100]}; font-family: ${ye.fontFamily.mono}; margin: ${pe.lg} 0; padding: 0.75rem ${pe.md}; overflow-x: auto;`,blockquote:`border-left: 3px solid ${Ae.neutral.gray[300]}; margin: ${pe.lg} 0; padding-left: ${pe.md}; color: ${Ae.neutral.gray[500]};`,hr:`border: none; border-top: 1px solid ${Ae.neutral.gray[200]}; margin: ${pe.xl} 0;`,a:`color: ${Ae.brand.primary.DEFAULT}; text-decoration: underline; cursor: pointer;`,mark:`background-color: ${Ae.palettes.warning[200]}; border-radius: ${pe.xs}; padding: 0 0.125rem;`,label:`display: flex; align-items: center; gap: ${pe.sm}; cursor: pointer;`,input:"cursor: pointer; margin: 0;"},Sd={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 $d(e){if(!e)return e;let a=e;for(const[s,n]of Object.entries(Sd)){const r=new RegExp(`(<(?:ul|li)[^>]*data-type="${s}"[^>]*)>`,"gi");a=a.replace(r,(i,c)=>i.includes('style="')?i.replace(/style="([^"]*)"/,`style="$1 ${n}"`):`${c} style="${n}">`)}for(const[s,n]of Object.entries(kd)){const r=new RegExp(`<${s}(\\s[^>]*)?>`,"gi");a=a.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 ${n}"`);if(i.includes("style='"))return i.replace(/style='([^']*)'/,`style='$1 ${n}'`);{const c=i.indexOf(">");return`${i.slice(0,c)} style="${n}"${i.slice(c)}`}})}return a}const Ad=({modifiers:e,zoom:a,onZoomChange:s,onToolbarAction:n})=>{const{editor:r}=ys.useCurrentEditor();return t.jsx(wd,{editor:r,modifiers:e,zoom:a,onZoomChange:s,onToolbarAction:n})},Dd=({showCharacterCount:e,showWordCount:a})=>{const{editor:s}=ys.useCurrentEditor();if(!s||!e&&!a)return null;const n=s.getText(),r=n.length,i=n.split(/\s+/).filter(c=>c.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"]}),a&&t.jsxs("span",{children:[i," words"]})]})},os=h.forwardRef((e,a)=>{const{minRows:s=10,maxRows:n=30,disableAutosize:r=!1,showCharacterCount:i=!1,showWordCount:c=!1,showToolbar:l=!0,modifiers:d=ti.full,variant:u="bordered",initialContent:f,content:m,onContentChange:b,onUpdate:x,onToolbarAction:g,isReadOnly:j=!1,isDisabled:y=!1,includeInlineStyles:v=!0,...C}=e,{zoom:S,setZoom:k}=yd(),$=wn.lineHeight,_=s*$,w=r?void 0:n*$,F=h.useMemo(()=>Cd(d),[d]),{Component:A,label:M,shouldLabelBeOutside:E,getBaseProps:D,getLabelProps:I,getInputWrapperProps:B}=o.useInput({...C,variant:u,ref:a,isMultiline:!0}),z=M?t.jsx("label",{...I(),children:M}):null,q=h.useCallback(({editor:P})=>{const ee=P.getHTML(),W=v?$d(ee):ee,Y=P.getJSON(),K=P.getText(),ie=K.length,te=K.split(/\s+/).filter(ne=>ne.length>0).length,Q={html:W,json:Y,text:K,characters:ie,words:te};if(b?.(Q),x?.(Q),"onChange"in C&&typeof C.onChange=="function"){const ne={target:{value:W},currentTarget:{value:W}};C.onChange(ne)}},[b,x,C,v]);return t.jsxs(A,{...D(),children:[E?z:null,t.jsx("div",{...B(),className:o.cn(B().className,"flex flex-col w-full p-0 gap-0 rich-text-editor"),style:{maxHeight:w?`${w+wn.toolbarHeight}px`:void 0,overflow:w?"auto":void 0},children:t.jsx(ys.EditorProvider,{editable:!j&&!y,slotBefore:l?t.jsx(Ad,{modifiers:d,zoom:S,onZoomChange:k,onToolbarAction:g}):void 0,slotAfter:t.jsx(Dd,{showCharacterCount:i,showWordCount:c}),editorContainerProps:{className:"w-full flex-1 outline-none",style:{minHeight:`${_}px`,fontSize:`${S}%`,display:"flex",flexDirection:"column"}},editorProps:{attributes:{class:"focus:outline-none w-full h-full"}},extensions:F,content:m||f||e.defaultValue||"",onUpdate:q})})]})});os.displayName="TipTapEditor";const ai=h.forwardRef((e,a)=>{const{adapter:s="tiptap",variant:n="bordered",...r}=e;return s==="tiptap"?t.jsx(os,{...r,variant:n,ref:a}):(console.warn(`Adapter "${s}" is not supported. Using TipTap.`),t.jsx(os,{...r,variant:n,ref:a}))});ai.displayName="RichTextArea";function Cn(e,a="en-US",s="USD",n=!0){try{return new Intl.NumberFormat(a,n?{style:"currency",currency:s,minimumFractionDigits:0,maximumFractionDigits:2}:{style:"currency",currency:s}).format(e)}catch(r){return console.warn(`Invalid currency formatting: ${r}`),`${s} ${e.toFixed(2)}`}}function Ed(e="en-US",a="USD"){try{const s=new Intl.NumberFormat(e,{style:"currency",currency:a,currencyDisplay:"symbol"}),n=s.formatToParts(1),r=n.findIndex(d=>d.type==="currency"),i=n.findIndex(d=>d.type==="integer"),{minimumFractionDigits:c,maximumFractionDigits:l}=s.resolvedOptions();return{symbol:n[r]?.value??a,position:r>i?"end":"start",formatOptions:{style:"decimal",minimumFractionDigits:c,maximumFractionDigits:l}}}catch(s){return console.warn(`Invalid currency formatting: ${s}`),{symbol:a,position:"start",formatOptions:{style:"decimal",minimumFractionDigits:2,maximumFractionDigits:2}}}}const kn=`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 ${p.stillTransitionClass} motion-reduce:data-[pressed=true]:scale-100 [html[data-pos-reduce-motion=true]_&]:data-[pressed=true]:scale-100`,Sn=`border bg-white shadow-none ${p.stillTransitionClass}`,Ld={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:`${kn} 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:`${Sn} 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:`${kn} 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:`${Sn} 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"}},kt={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"},Fd={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"}}},$n=[{id:"100",amount:100},{id:"250",amount:250},{id:"500",amount:500},{id:"1000",amount:1e3},{id:"2000",amount:2e3}],_d={title:"Donation Amount",customAmountPlaceholder:"Custom donation amount",customAmountAriaLabel:"Custom donation amount",addDonationButton:"Add Donation",presetsAriaLabel:"Suggested amounts"},si=({presetAmounts:e=$n,selectedDonation:a,defaultSelectedDonation:s=null,onChange:n,onAddDonation:r,currency:i="USD",locale:c="en-US",showCustomAmount:l=!0,minCustomAmount:d=.5,maxCustomAmount:u=1e6,labels:f,mobileColumns:m=2,desktopColumns:b=3,isDisabled:x=!1,buttonVariant:g="bordered",buttonColor:j="default",inputVariant:y="bordered",size:v="md",className:C="",showCard:S=!0,variant:k="pill",customAmountPlacement:$="below",isRequired:_=!1})=>{const w={..._d,...f},F=h.useId(),A=`${F}-title`,M=`${F}-custom`,E=Array.isArray(e)?e:$n,D={2:"grid-cols-2",3:"grid-cols-3"},I={3:"sm:grid-cols-3",4:"sm:grid-cols-4",5:"sm:grid-cols-5",6:"sm:grid-cols-6"},B=`${D[m]} ${I[b]}`,[z,q]=Rt(a,s,n),[P,ee]=h.useState(()=>!r&&z?.isCustom?String(z.amount):""),[W,Y]=h.useState(!1),[K,ie]=h.useState(0),te=h.useCallback(ae=>{if(x)return;const be={amount:ae.amount,isCustom:!1,presetId:ae.id};q(be),ee(""),Y(!1),ie($e=>$e+1),r?.(be)},[x,q,r]),Q=h.useCallback(ae=>{if(x)return;if(ee(ae!==void 0?String(ae):""),r){q(null);return}if(Y(!1),ae===void 0||isNaN(ae)){q(null);return}q({amount:ae,isCustom:!0})},[x,q,r]),ne=h.useCallback(()=>{if(x)return;const ae=P!==""?parseFloat(P):void 0;ae===void 0||isNaN(ae)||r?.({amount:ae,isCustom:!0})},[x,P,r]),V=h.useMemo(()=>({style:"currency",currency:i,currencyDisplay:"symbol"}),[i]),O=h.useMemo(()=>Ed(c,i),[c,i]),Z=ae=>z!==null&&!z.isCustom&&z.presetId===ae.id,Re=(ae,be)=>{const $e=!r&&W,ge=k==="tile"&&$==="inline",We=ge?t.jsx("span",{className:kt.affix,"data-testid":"donation-amounts-custom-symbol",children:O.symbol}):void 0,Le=t.jsxs("div",{className:o.cn("flex items-start gap-3",ge&&kt.field),"data-testid":"donation-amounts-custom-field",children:[t.jsx(o.NumberInput,{id:M,placeholder:w.customAmountPlaceholder,"aria-label":ge?w.customAmountLabel??w.customAmountAriaLabel:w.customAmountLabel?void 0:w.customAmountAriaLabel,onInput:r?()=>{q(null),Y(!0)}:()=>Y(!0),onBlur:r?void 0:()=>Y(!1),variant:"bordered",minValue:d,maxValue:u,step:.01,formatOptions:ge?O.formatOptions:V,startContent:O.position==="start"?We:void 0,endContent:O.position==="end"?We:void 0,value:P!==""?parseFloat(P):void 0,onValueChange:Q,isDisabled:x,className:"flex-1",classNames:{inputWrapper:o.cn(ae.inputWrapper,be.wrapper,ge&&kt.inputWrapper,$e&&ae.inputWrapperActive),input:o.cn(ae.input,be.input,ge&&kt.input)},"data-testid":"donation-amounts-custom-input",hideStepper:!0},r?`custom-${K}`:z?.isCustom===!1?z.presetId:"custom"),r&&t.jsx(p.Button,{color:"primary",variant:"solid",size:v,className:"shrink-0",onPress:ne,isDisabled:x||!W,"data-testid":"donation-amounts-add-button",children:w.addDonationButton})]}),oe=l&&(ge?Le:t.jsxs("div",{className:o.cn("flex flex-col",ae.inputBase),children:[w.customAmountLabel&&t.jsx("label",{htmlFor:M,className:ae.customLabel,"data-testid":"donation-amounts-custom-label",children:w.customAmountLabel}),Le]}));return t.jsxs("div",{className:ae.root,"data-testid":"donation-amounts-root","data-variant":k,"data-custom-placement":ge?"inline":void 0,children:[w.eyebrow&&t.jsx("p",{className:ae.eyebrow,"data-testid":"donation-amounts-eyebrow",children:w.eyebrow}),w.title&&t.jsxs("p",{id:A,className:ae.title,"data-testid":"donation-amounts-title",children:[w.title,_&&t.jsx("span",{"aria-hidden":"true",className:"ml-0.5 text-pos-danger",children:"*"})]}),w.caption&&t.jsx("p",{className:ae.caption,"data-testid":"donation-amounts-caption",children:w.caption}),(E.length>0||ge&&oe)&&t.jsxs("div",{role:"group","aria-labelledby":w.title?A:void 0,"aria-label":w.title?void 0:w.presetsAriaLabel,className:ge?kt.row:o.cn(ae.grid,k==="tile"&&B),"data-testid":"donation-amounts-presets",children:[E.map(de=>{const se=Z(de)&&!$e;return t.jsxs(p.Button,{color:"default",variant:"bordered",disableRipple:!0,"aria-pressed":se,className:o.cn(ae.preset,ge&&kt.preset,se?ae.presetSelected:ae.presetIdle),onPress:()=>te(de),isDisabled:x,"data-selected":se||void 0,"data-testid":`donation-amounts-preset-${de.id}`,children:[t.jsx("span",{className:o.cn(ae.amount,se&&ae.amountSelected),children:de.label||Cn(de.amount,c,i,k!=="pos")}),de.sublabel&&" ",de.sublabel&&t.jsx("span",{className:ae.sublabel,"data-testid":`donation-amounts-preset-${de.id}-sublabel`,children:de.sublabel})]},de.id)}),ge&&oe]}),!ge&&oe]})},De=t.jsxs("div",{className:"space-y-4","data-testid":"donation-amounts-root",children:[w.title&&t.jsx("h2",{id:A,className:"text-base font-semibold","data-testid":"donation-amounts-title",children:w.title}),E.length>0&&t.jsx("div",{role:"group","aria-labelledby":w.title?A:void 0,"aria-label":w.title?void 0:w.presetsAriaLabel,className:o.cn("grid gap-3",B),"data-testid":"donation-amounts-presets",children:E.map(ae=>{const be=z!==null&&!z.isCustom&&z.presetId===ae.id;return t.jsx(p.Button,{color:be?"primary":j,variant:be?"solid":g,className:"w-full","aria-pressed":be,onPress:()=>te(ae),isDisabled:x,"data-testid":`donation-amounts-preset-${ae.id}`,children:ae.label||Cn(ae.amount,c,i)},ae.id)})}),l&&t.jsxs("div",{className:"flex gap-3 items-start",children:[t.jsx(o.NumberInput,{placeholder:w.customAmountPlaceholder,"aria-label":w.customAmountAriaLabel,onInput:r?()=>{q(null),Y(!0)}:void 0,variant:y,radius:"full",size:v,minValue:d,maxValue:u,step:.01,formatOptions:V,value:P!==""?parseFloat(P):void 0,onValueChange:Q,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-${K}`:z?.isCustom===!1?z.presetId:"custom"),r&&t.jsx(p.Button,{color:"primary",variant:"solid",radius:"full",size:v,className:"shrink-0",onPress:ne,isDisabled:x||!W,"data-testid":"donation-amounts-add-button",children:w.addDonationButton})]})]}),Ee=k==="pill"?De:Re(Ld[k],Fd[k][v]);return S?t.jsx(o.Card,{className:o.cn("w-full",C),"data-testid":"donation-amounts-card",children:t.jsx(o.CardBody,{children:Ee})}):t.jsx("div",{className:o.cn("w-full",C),"data-testid":"donation-amounts-plain",children:Ee})};si.displayName="DonationAmounts";const Rd=e=>{const a=Math.max(0,e),s=Math.floor(a/60).toString().padStart(2,"0"),n=(a%60).toString().padStart(2,"0");return`${s}:${n} minutes`},Id=e=>{switch(e){case"warning":return J.Clock;case"error":return J.AlertCircle;case"success":return J.CheckCircle;default:return J.Clock}},Md=e=>{switch(e){case"primary":return"bg-primary-500";case"secondary":return"bg-gray-700";case"success":return"bg-green-600";case"warning":return"bg-amber-500";case"danger":return"bg-red-600";default:return"bg-primary-500"}},ni=h.forwardRef(({timeLeft:e,defaultTimeLeft:a=1200,onTimeChange:s,onExpire:n,variant:r="info",color:i="primary",message:c="Your cart expires in:",showIcon:l=!0,icon:d,position:u="fixed",autoStart:f=!0,formatTime:m=Rd,className:b,...x},g)=>{const[j,y]=Rt(e!==void 0?Math.max(0,e):void 0,Math.max(0,a),s),v=h.useRef(null),C=h.useRef(!1);h.useEffect(()=>()=>{v.current&&clearInterval(v.current)},[]),h.useEffect(()=>{if(!f||j<=0){v.current&&(clearInterval(v.current),v.current=null);return}return v.current=setInterval(()=>{y(_=>_<=1?(v.current&&(clearInterval(v.current),v.current=null),C.current||(C.current=!0,n?.()),0):_-1)},1e3),()=>{v.current&&(clearInterval(v.current),v.current=null)}},[f,j,y,n]),h.useEffect(()=>{j>0&&(C.current=!1)},[j]);const S=d||Id(r),k=Md(i),$={fixed:"fixed top-0 left-0",sticky:"sticky top-0",static:"static"};return t.jsx("div",{ref:g,role:"banner","aria-live":"polite","aria-label":`${c} ${m(j)}`,"data-testid":"expire-cart-timer",className:o.cn("w-full text-white z-50",k,$[u],b),...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(S,{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:c})]}),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(j)}`,"data-testid":"expire-cart-timer-value",children:m(j)})})]})})})});ni.displayName="ExpireCartTimer";const St=({icon:e,children:a,testId:s})=>t.jsxs("div",{className:"flex items-center gap-2 text-sm text-gray-600","data-testid":s,children:[t.jsx(p.Icon,{icon:e,width:20,className:"text-default-500"}),t.jsx("span",{children:a})]}),Bd=({classes:e="",name:a,imageUrl:s,eventDate:n,eventTime:r,location:i,description:c,showImage:l=!1,compact:d=!1,layout:u="stacked",imageLoading:f="eager",showMoreButtonClassName:m,labels:b})=>{const[x,g]=h.useState(!1),[j,y]=h.useState(!1),v=h.useRef(null);return h.useEffect(()=>{const C=()=>{if(v.current){const S=v.current.scrollHeight>v.current.clientHeight;y(S)}};return C(),window.addEventListener("resize",C),()=>window.removeEventListener("resize",C)},[c]),u==="horizontal"?t.jsx(o.Card,{className:o.cn("border-0 shadow-none",e),"data-testid":"event-details-root",children:t.jsx(o.CardBody,{className:"p-0","data-testid":"event-details-horizontal-layout",children:t.jsxs("div",{className:"flex flex-col items-start gap-5 sm:flex-row sm:gap-8",children:[l&&s&&t.jsx("div",{className:"w-full shrink-0 overflow-hidden rounded-xl aspect-[3/2] sm:w-[360px]","data-testid":"event-details-image-wrapper",children:t.jsx(o.Image,{removeWrapper:!0,loading:f,alt:`Event image for ${a}`,className:"w-full h-full object-cover object-center",src:s,"data-testid":"event-details-image"})}),t.jsxs("div",{className:"min-w-0 flex-1 space-y-3",children:[t.jsx("h2",{className:"font-semibold text-2xl text-gray-800","data-testid":"event-details-title",children:a}),t.jsx("h3",{className:"font-semibold text-base text-gray-700","data-testid":"event-details-info-label",children:b.eventInformation}),t.jsxs("div",{className:"flex flex-wrap gap-4","data-testid":"event-details-info",children:[n&&t.jsx(St,{icon:"solar:calendar-minimalistic-linear",testId:"event-details-date",children:n}),r&&t.jsx(St,{icon:"solar:clock-circle-linear",testId:"event-details-time",children:r}),i&&t.jsx(St,{icon:"solar:map-point-linear",testId:"event-details-location",children:i})]}),c&&t.jsxs("div",{className:"relative","data-testid":"event-details-description-wrapper",children:[t.jsxs("div",{className:"relative",children:[t.jsx("div",{ref:v,className:o.cn("text-sm text-gray-700 leading-relaxed transition-all",!x&&"line-clamp-3"),"data-testid":"event-details-description",dangerouslySetInnerHTML:{__html:c}}),!x&&j&&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"})]}),(j||x)&&t.jsx("div",{className:"flex justify-end mt-1",children:t.jsx(p.Button,{onPress:()=>g(!x),variant:"light",className:o.cn("text-primary",m),size:"md",startContent:t.jsx(p.Icon,{icon:x?"solar:eye-closed-linear":"solar:eye-linear",width:20}),"data-testid":"event-details-toggle-description",children:x?b.showLess||"Hide":b.showMore||"Show"})})]})]})]})})}):t.jsxs(o.Card,{className:o.cn("border-0 shadow-none",e),"data-testid":"event-details-root",children:[t.jsxs(o.CardHeader,{className:o.cn("pt-2 pb-0 flex-col items-start",d?"space-y-1":"space-y-2"),"data-testid":"event-details-header",children:[l&&s&&t.jsx("div",{className:o.cn("w-full overflow-hidden rounded-xl","aspect-[3/1]"),"data-testid":"event-details-image-wrapper",children:t.jsx(o.Image,{removeWrapper:!0,loading:f,alt:`Event image for ${a}`,className:"w-full h-full object-cover object-center",src:s,"data-testid":"event-details-image"})}),t.jsx("h2",{className:o.cn("font-semibold text-gray-800",d?"text-base":"text-xl"),"data-testid":"event-details-title",children:a})]}),t.jsxs(o.CardBody,{className:o.cn("space-y-3",d?"py-1 space-y-2":"py-3"),"data-testid":"event-details-body",children:[t.jsx("h3",{className:o.cn("font-semibold text-base text-gray-700",d?"text-sm":""),"data-testid":"event-details-info-label",children:b.eventInformation}),t.jsxs("div",{className:"flex flex-wrap gap-4","data-testid":"event-details-info",children:[n&&t.jsx(St,{icon:"solar:calendar-minimalistic-linear",testId:"event-details-date",children:n}),r&&t.jsx(St,{icon:"solar:clock-circle-linear",testId:"event-details-time",children:r}),i&&t.jsx(St,{icon:"solar:map-point-linear",testId:"event-details-location",children:i})]}),c&&t.jsxs("div",{className:"relative","data-testid":"event-details-description-wrapper",children:[t.jsxs("div",{className:"relative",children:[t.jsx("div",{ref:v,className:o.cn("text-sm text-gray-700 leading-relaxed transition-all",d?"text-xs":"",!x&&"line-clamp-3"),"data-testid":"event-details-description",dangerouslySetInnerHTML:{__html:c}}),!x&&j&&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"})]}),(j||x)&&t.jsx("div",{className:"flex justify-end mt-1",children:t.jsx(p.Button,{onPress:()=>g(!x),variant:"light",className:o.cn("text-primary",m),size:d?"sm":"md",startContent:t.jsx(p.Icon,{icon:x?"solar:eye-closed-linear":"solar:eye-linear",width:d?16:20}),"data-testid":"event-details-toggle-description",children:x?b.showLess||"Hide":b.showMore||"Show"})})]})]})]})};function cs(e,a="en-US",s="USD"){try{return new Intl.NumberFormat(a,{style:"currency",currency:s,minimumFractionDigits:2,maximumFractionDigits:2}).format(e)}catch(n){return console.warn(`Invalid currency formatting: ${n}`),`${s} ${e.toFixed(2)}`}}function Pd(e){const a=e.replace(/[^\d.,-]/g,""),s=a.match(/,\d{1,2}$/);let n;s?n=a.replace(/\./g,"").replace(",","."):n=a.replace(/,/g,"");const r=parseFloat(n);return isNaN(r)?null:r}const Td={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"},$t=e=>typeof e=="number"&&!isNaN(e),ba=({offer:e,quantity:a,defaultQuantity:s=0,onQuantityChange:n,currency:r="USD",locale:i="en-US",labels:c,slots:l,isDisabled:d=!1,buttonVariant:u="bordered",buttonColor:f="default",showCard:m=!0,showDescription:b=!0,showPeopleCount:x=!0,showPrice:g=!0,priceDisplay:j,classNames:y={},"data-testid":v,selectedColor:C="default",selectionMode:S="stepper",compact:k=!1,isSoldOut:$,isMaxReached:_,isRuleBlocked:w,statusTone:F="default",statusLabel:A,disabledReason:M,disabled:E})=>{const D=h.useMemo(()=>({...Td,...c}),[c]),[I,B]=h.useState(s),z=a!==void 0?a:I,q=!!(d||E),P=k||!!e.compact,ee=S==="press-to-add",W=h.useMemo(()=>typeof $=="boolean"?$:typeof e.isSoldOut=="boolean"?e.isSoldOut:!$t(e.totalTicketsSold)||!$t(e.ticketsAllowed)?!1:e.totalTicketsSold>=e.ticketsAllowed,[$,e.isSoldOut,e.totalTicketsSold,e.ticketsAllowed]),Y=h.useMemo(()=>typeof _=="boolean"?_:typeof e.isMaxReached=="boolean"?e.isMaxReached:W||!$t(e.ticketsAllowed)?!1:z>=e.ticketsAllowed-(e.totalTicketsSold??0),[_,e.isMaxReached,W,e.ticketsAllowed,e.totalTicketsSold,z]),K=h.useMemo(()=>typeof w=="boolean"?w:typeof e.isRuleBlocked=="boolean"?e.isRuleBlocked:!1,[w,e.isRuleBlocked]),ie=M||e.disabledReason,te=q||W||K,Q=oe=>{if(te||oe>0&&Y)return;const de=Math.max(0,z+oe);a===void 0&&B(de),n?.(e.id,de)},ne=h.useMemo(()=>{if(W)return"soldOut";if(K)return"ruleBlocked";if(q)return"disabled"},[W,K,q]),V=h.useMemo(()=>F||(W||K?"danger":Y?"warning":"default"),[F,W,K,Y]),O=h.useMemo(()=>{if(ne)return ne==="ruleBlocked"?A||ie||D.ruleBlocked:ne==="soldOut"?A||ie||D.soldOut:ne==="disabled"?A||ie||D.disabled:A||D.maxReached},[ne,A,ie,D]),Z={soldOut:"danger",ruleBlocked:V,disabled:"default",maxReached:"warning"},Re={soldOut:"offer-card-sold-out-chip",maxReached:"offer-card-max-reached-chip",ruleBlocked:"offer-card-ruleBlocked-chip",disabled:"offer-card-disabled-chip"},De=()=>l?.renderName?l.renderName(e.name,e):t.jsx("h2",{"data-testid":"offer-card-name",className:o.cn("text-base font-medium",P&&"text-sm",y.name),children:e.name}),Ee=()=>{if(!g)return null;const oe=j?.price??e.price,de=j?.originalPrice,se=cs(oe,i,r);if(l?.renderPrice)return l.renderPrice(oe,se,e);if($t(de)&&$t(oe)&&de>oe){const L=cs(de,i,r);return t.jsxs("div",{"data-testid":"offer-card-price",className:o.cn("flex items-center gap-2 mt-1",P&&"mt-0.5",y.price),children:[t.jsxs("span",{className:"sr-only",children:["Original price ",L,", discounted price ",se]}),t.jsx("span",{"aria-hidden":"true","data-testid":"offer-card-original-price",className:o.cn("text-gray-400 line-through text-sm",P&&"text-xs",y.originalPrice),children:L}),t.jsx("span",{"aria-hidden":"true","data-testid":"offer-card-discounted-price",className:o.cn("text-primary text-base font-semibold",P&&"text-sm",y.discountedPrice),children:se})]})}return t.jsx("p",{"data-testid":"offer-card-price",className:o.cn("text-primary text-base mt-1",P&&"text-sm mt-0.5",y.price),children:se})},ae=()=>!b||!e.description?null:l?.renderDescription?l.renderDescription(e.description,e):t.jsx("p",{"data-testid":"offer-card-description",className:o.cn("mb-4 text-sm text-gray-700 leading-relaxed",P&&"mb-2 text-xs text-gray-600",y.description),children:e.description}),be=()=>{if(!x||!$t(e.numberOfPeople)||e.numberOfPeople<=0)return null;const oe=e.numberOfPeople===1?D.person:D.people;return l?.renderPeopleCount?l.renderPeopleCount(e.numberOfPeople,oe,e):t.jsxs("p",{"data-testid":"offer-card-people-count",className:o.cn("text-sm text-gray-600 flex items-center mt-2",P&&"mt-1 text-xs",y.peopleCount),children:[t.jsx(p.Icon,{icon:e.numberOfPeople<=1?"solar:user-rounded-outline":"solar:users-group-rounded-outline",width:20,className:"mr-1"}),e.numberOfPeople," ",oe]})},$e=()=>{const oe=z===0||te,de=Y||te;return l?.renderQuantitySelector?l.renderQuantitySelector({quantity:z,onIncrement:()=>Q(1),onDecrement:()=>Q(-1),isDecrementDisabled:oe,isIncrementDisabled:de,isDisabled:te}):t.jsxs("div",{className:o.cn("flex items-center gap-2",y.quantitySelector),children:[t.jsx(p.Button,{"data-testid":"offer-card-decrement-button",onPress:()=>Q(-1),isDisabled:oe,variant:u,color:z>0?C:f,radius:"full",isIconOnly:!0,size:P?"md":"sm","aria-label":"Decrease quantity",children:t.jsx(p.Icon,{icon:"gravity-ui:minus",width:16})}),t.jsx("span",{"data-testid":"offer-card-quantity",className:o.cn("min-w-[2rem] text-center font-medium",P&&"text-sm"),children:z}),t.jsx(p.Button,{"data-testid":"offer-card-increment-button",onPress:()=>Q(1),isDisabled:de,variant:u,color:z>0?C:f,radius:"full",isIconOnly:!0,size:P?"md":"sm","aria-label":"Increase quantity",children:t.jsx(p.Icon,{icon:"gravity-ui:plus",width:16})})]})},ge=(oe,de)=>l?.renderDisabledState?l.renderDisabledState(oe,de):oe==="soldOut"&&l?.renderSoldOut?l.renderSoldOut(de):oe==="maxReached"&&l?.renderMaxReachedAlert?l.renderMaxReachedAlert(de):t.jsx(o.Chip,{"data-testid":Re[oe],color:Z[oe],variant:oe==="maxReached"?"flat":"solid",className:o.cn("gap-2 px-4",oe==="maxReached"?"h-8":"h-10",oe==="soldOut"&&y.soldOut,oe==="maxReached"&&y.maxReachedAlert,P&&"h-8"),startContent:t.jsx(p.Icon,{icon:"gravity-ui:triangle-exclamation-fill",width:14}),children:t.jsx("span",{className:"font-medium text-sm",children:de})}),We=t.jsxs("div",{className:o.cn("grid grid-cols-1 md:grid-cols-1 xl:grid-cols-3 lg:grid-cols-3 items-start",P?"gap-1":"gap-2"),children:[t.jsxs("div",{className:o.cn("h-full col-span-2",te||Y?"opacity-50 pointer-events-none select-none":""),children:[De(),Ee(),t.jsxs("div",{className:o.cn("md:col-span-1 xl:col-span-2 lg:col-span-1",P?"mb-1":"mb-2"),children:[be(),ae()]})]}),!ee&&t.jsx("div",{className:o.cn("space-x-2 pt-0 pb-2 md:p-2 h-full flex items-center justify-start md:justify-start lg:justify-end",P&&"space-x-1 pb-1 md:p-1",y.compactFooter),children:ne&&O?ge(ne,O):$e()})]}),Le=Y&&!W&&!K&&!q?t.jsx(ze.motion.div,{className:o.cn("w-full sm:max-w-[60%] md:max-w-[60%] lg:max-w-[60%]",y.compactFooter),initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:10},transition:{duration:.3},children:ge("maxReached",O||D.maxReached)}):null;return m?t.jsxs(o.Card,{className:o.cn("w-full",ee&&!te&&!Y&&"cursor-pointer",P&&y.compact,y.base),"data-testid":v||`offer-card-${e.id}`,isPressable:ee&&!te&&!Y,onPress:ee&&!te&&!Y?()=>Q(1):void 0,children:[t.jsx(o.CardBody,{className:o.cn("pt-1 pb-0",P?"pb-0.5":"",y.body),children:We}),t.jsx(ze.AnimatePresence,{children:Le&&t.jsx(o.CardFooter,{className:o.cn("w-full mt-0 pt-0",P?"pt-1":"",y.footer),children:Le})})]}):t.jsxs("div",{className:o.cn("w-full",P&&y.compact,y.base),"data-testid":v||`offer-card-${e.id}`,children:[t.jsx("div",{className:o.cn("pt-1 pb-0",P?"pb-0.5":"",y.body),children:We}),t.jsx(ze.AnimatePresence,{children:Le&&t.jsx("div",{className:o.cn("w-full mt-0 pt-0",P?"pt-1":"",y.footer),children:Le})})]})};ba.displayName="OfferCard";const ri=({message:e="No offers available.",icon:a="solar:ticket-sale-outline",iconSize:s=48,showCard:n=!0,classNames:r={},renderEmpty:i})=>{if(i){const l=i();return n?t.jsx(o.Card,{"data-testid":"offer-card-empty",className:o.cn("w-full",r.base),children:t.jsx(o.CardBody,{"data-testid":"offer-card-empty-body",children:l})}):t.jsx("div",{"data-testid":"offer-card-empty",className:o.cn("w-full",r.base),children:l})}const c=t.jsxs("div",{"data-testid":"offer-card-empty-content",className:o.cn("flex flex-col items-center justify-center p-8 text-center text-gray-500",r.content),children:[t.jsx(p.Icon,{"data-testid":"offer-card-empty-icon",icon:a,width:s,className:o.cn("mb-4",r.icon)}),t.jsx("h3",{"data-testid":"offer-card-empty-message",className:o.cn("text-lg",r.message),children:e})]});return n?t.jsx(o.Card,{"data-testid":"offer-card-empty",className:o.cn("w-full",r.base),children:t.jsx(o.CardBody,{"data-testid":"offer-card-empty-body",children:c})}):t.jsx("div",{"data-testid":"offer-card-empty",className:o.cn("w-full",r.base),children:c})};ri.displayName="OfferCardEmpty";const Od={title:"Error Fetching Offers",description:"An error occurred while fetching offers."},ii=({error:e,labels:a,showCard:s=!0,color:n="danger",classNames:r={}})=>{const i={...Od,...a},c=t.jsx(o.Alert,{"data-testid":"offer-card-error-alert",color:n,title:i.title,description:e||i.description,className:r.alert});return s?t.jsx(o.Card,{"data-testid":"offer-card-error",className:o.cn("w-full",r.base),children:t.jsx(o.CardBody,{"data-testid":"offer-card-error-body",children:c})}):t.jsx("div",{"data-testid":"offer-card-error",className:o.cn("w-full",r.base),children:c})};ii.displayName="OfferCardError";const zd={1:"space-y-1",2:"space-y-2",3:"space-y-3",4:"space-y-4",5:"space-y-5",6:"space-y-6"},li=({quantity:e=2,gap:a=4,classNames:s={}})=>{const n=zd[a];return t.jsx("div",{"data-testid":"offer-card-skeleton-container",className:o.cn(n,s.base),children:Array.from({length:e}).map((r,i)=>t.jsxs(o.Card,{"data-testid":`offer-card-skeleton-${i}`,className:o.cn("w-full",s.card),children:[t.jsx(o.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(p.Skeleton,{"data-testid":`offer-card-skeleton-title-${i}`,className:"w-1/3 rounded-lg",children:t.jsx("div",{className:"h-4 bg-default-200 rounded-lg"})}),t.jsx(p.Skeleton,{"data-testid":`offer-card-skeleton-subtitle-${i}`,className:"w-1/4 rounded-lg",children:t.jsx("div",{className:"h-3 bg-default-300 rounded-lg"})})]})}),t.jsx(o.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(p.Skeleton,{"data-testid":`offer-card-skeleton-people-${i}`,className:"w-1/4 rounded-lg",children:t.jsx("div",{className:"h-4 bg-default-300 rounded-lg"})}),t.jsx(p.Skeleton,{"data-testid":`offer-card-skeleton-description-${i}`,className:"w-3/4 rounded-lg",children:t.jsx("div",{className:"h-4 bg-default-200 rounded-lg"})})]}),t.jsx("div",{className:"flex items-start justify-end",children:t.jsxs("div",{"data-testid":`offer-card-skeleton-controls-${i}`,className:"flex items-center justify-end gap-2 w-full px-4 py-2",children:[t.jsx(p.Skeleton,{"data-testid":`offer-card-skeleton-label-${i}`,className:"w-24 h-4 rounded-md bg-default-200"}),t.jsxs("div",{className:"flex gap-2",children:[t.jsx(p.Skeleton,{"data-testid":`offer-card-skeleton-btn-dec-${i}`,className:"w-8 h-8 rounded-md bg-default-300"}),t.jsx(p.Skeleton,{"data-testid":`offer-card-skeleton-btn-qty-${i}`,className:"w-8 h-8 rounded-md bg-default-200"}),t.jsx(p.Skeleton,{"data-testid":`offer-card-skeleton-btn-inc-${i}`,className:"w-8 h-8 rounded-md bg-default-300"})]})]})})]})})]},i))})};li.displayName="OfferCardSkeleton";const oi={hidden:{opacity:0},show:{opacity:1,transition:{staggerChildren:.15,delayChildren:.1}}},ci={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"}}},Vd={1:"gap-1",2:"gap-2",3:"gap-3",4:"gap-4",5:"gap-5",6:"gap-6"},di=({offers:e=[],mapOffer:a,selection:s,defaultSelection:n={},onSelectionChange:r,onQuantityChange:i,currency:c="USD",locale:l="en-US",labels:d,slots:u,isDisabled:f=!1,buttonVariant:m="bordered",buttonColor:b="default",showCard:x=!0,animated:g=!0,gap:j=2,compact:y=!1,classNames:v={}})=>{const[C,S]=h.useState(n),k=s!==void 0?s:C,$=h.useCallback((E,D)=>{const I={...k,[E]:Math.max(0,D)};s===void 0&&S(I),r?.(I),i?.(E,I[E])},[k,s,r,i]),_=[...e].sort((E,D)=>(E.position??0)-(D.position??0)),w=E=>{const D=a?a(E):E,I=(k??{})[D.id]||0;return{offer:D,quantity:I,onQuantityChange:$,currency:c,locale:l,labels:d,slots:u,isDisabled:f,buttonVariant:m,buttonColor:b,showCard:x,compact:y}},F=Vd[j],A=o.cn("grid mx-auto pt-2",F,v.base),M=E=>{const D=w(E);return t.jsx(ba,{offer:D.offer,quantity:D.quantity,onQuantityChange:D.onQuantityChange,currency:D.currency,locale:D.locale,labels:D.labels,slots:D.slots,isDisabled:D.isDisabled,buttonVariant:D.buttonVariant,buttonColor:D.buttonColor,showCard:D.showCard,compact:D.compact,classNames:v.card},D.offer.id)};return g?t.jsx(ze.motion.div,{"data-testid":"offer-card-list",className:A,variants:oi,initial:"hidden",animate:"show",children:t.jsx(ze.AnimatePresence,{children:_.map(E=>{const D=w(E);return t.jsx(ze.motion.div,{"data-testid":`offer-card-list-item-${D.offer.id}`,className:v.cardWrapper,variants:ci,exit:{opacity:0,y:-20},transition:{duration:.3},children:t.jsx(ba,{offer:D.offer,quantity:D.quantity,onQuantityChange:$,currency:c,locale:l,labels:d,slots:u,isDisabled:f,buttonVariant:m,buttonColor:b,showCard:x,compact:y||D.offer.compact,classNames:v.card})},D.offer.id)})})}):t.jsx("div",{"data-testid":"offer-card-list",className:A,children:_.map(M)})};di.displayName="OfferCardList";var ea=e=>e.type==="checkbox",jt=e=>e instanceof Date,He=e=>e==null;const ui=e=>typeof e=="object";var Se=e=>!He(e)&&!Array.isArray(e)&&ui(e)&&!jt(e),mi=e=>Se(e)&&e.target?ea(e.target)?e.target.checked:e.target.value:e,Ud=e=>e.substring(0,e.search(/\.\d+(\.|$)/))||e,fi=(e,a)=>e.has(Ud(a)),Hd=e=>{const a=e.constructor&&e.constructor.prototype;return Se(a)&&a.hasOwnProperty("isPrototypeOf")},$s=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function Ne(e){if(e instanceof Date)return new Date(e);const a=typeof FileList<"u"&&e instanceof FileList;if($s&&(e instanceof Blob||a))return e;const s=Array.isArray(e);if(!s&&!(Se(e)&&Hd(e)))return e;const n=s?[]:Object.create(Object.getPrototypeOf(e));for(const r in e)Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=Ne(e[r]));return n}var Da=e=>/^\w*$/.test(e),he=e=>e===void 0,As=e=>Array.isArray(e)?e.filter(Boolean):[],Ds=e=>As(e.replace(/["|']|\]/g,"").split(/\.|\[/)),G=(e,a,s)=>{if(!a||!Se(e))return s;const n=(Da(a)?[a]:Ds(a)).reduce((r,i)=>He(r)?r:r[i],e);return he(n)||n===e?he(e[a])?s:e[a]:n},Ge=e=>typeof e=="boolean",Oe=e=>typeof e=="function",xe=(e,a,s)=>{let n=-1;const r=Da(a)?[a]:Ds(a),i=r.length,c=i-1;for(;++n<i;){const l=r[n];let d=s;if(n!==c){const u=e[l];d=Se(u)||Array.isArray(u)?u:isNaN(+r[n+1])?{}:[]}if(l==="__proto__"||l==="constructor"||l==="prototype")return;e[l]=d,e=e[l]}};const ga={BLUR:"blur",FOCUS_OUT:"focusout",CHANGE:"change"},et={onBlur:"onBlur",onChange:"onChange",onSubmit:"onSubmit",onTouched:"onTouched",all:"all"},nt={max:"max",min:"min",maxLength:"maxLength",minLength:"minLength",pattern:"pattern",required:"required",validate:"validate"},xi=h.createContext(null);xi.displayName="HookFormControlContext";const Es=()=>h.useContext(xi);var pi=(e,a,s,n=!0)=>{const r={defaultValues:a._defaultValues};for(const i in e)Object.defineProperty(r,i,{get:()=>{const c=i;return a._proxyFormState[c]!==et.all&&(a._proxyFormState[c]=!n||et.all),s&&(s[c]=!0),e[c]}});return r};const Ls=typeof window<"u"?h.useLayoutEffect:h.useEffect;function Wd(e){const a=Es(),{control:s=a,disabled:n,name:r,exact:i}=e||{},[c,l]=h.useState(s._formState),d=h.useRef({isDirty:!1,isLoading:!1,dirtyFields:!1,touchedFields:!1,validatingFields:!1,isValidating:!1,isValid:!1,errors:!1});return Ls(()=>s._subscribe({name:r,formState:d.current,exact:i,callback:u=>{!n&&l({...s._formState,...u})}}),[r,n,i]),h.useEffect(()=>{d.current.isValid&&s._setValid(!0)},[s]),h.useMemo(()=>pi(c,s,d.current,!1),[c,s])}var Ye=e=>typeof e=="string",ds=(e,a,s,n,r)=>Ye(e)?(n&&a.watch.add(e),G(s,e,r)):Array.isArray(e)?e.map(i=>(n&&a.watch.add(i),G(s,i))):(n&&(a.watchAll=!0),s),us=e=>He(e)||!ui(e);function tt(e,a,s=new WeakSet){if(us(e)||us(a))return Object.is(e,a);if(jt(e)&&jt(a))return Object.is(e.getTime(),a.getTime());const n=Object.keys(e),r=Object.keys(a);if(n.length!==r.length)return!1;if(s.has(e)||s.has(a))return!0;s.add(e),s.add(a);for(const i of n){const c=e[i];if(!r.includes(i))return!1;if(i!=="ref"){const l=a[i];if(jt(c)&&jt(l)||Se(c)&&Se(l)||Array.isArray(c)&&Array.isArray(l)?!tt(c,l,s):!Object.is(c,l))return!1}}return!0}function qd(e){const a=Es(),{control:s=a,name:n,defaultValue:r,disabled:i,exact:c,compute:l}=e||{},d=h.useRef(r),u=h.useRef(l),f=h.useRef(void 0),m=h.useRef(s),b=h.useRef(n);u.current=l;const[x,g]=h.useState(()=>{const k=s._getWatch(n,d.current);return u.current?u.current(k):k}),j=h.useCallback(k=>{const $=ds(n,s._names,k||s._formValues,!1,d.current);return u.current?u.current($):$},[s._formValues,s._names,n]),y=h.useCallback(k=>{if(!i){const $=ds(n,s._names,k||s._formValues,!1,d.current);if(u.current){const _=u.current($);tt(_,f.current)||(g(_),f.current=_)}else g($)}},[s._formValues,s._names,i,n]);Ls(()=>((m.current!==s||!tt(b.current,n))&&(m.current=s,b.current=n,y()),s._subscribe({name:n,formState:{values:!0},exact:c,callback:k=>{y(k.values)}})),[s,c,n,y]),h.useEffect(()=>s._removeUnmounted());const v=m.current!==s,C=b.current,S=h.useMemo(()=>{if(i)return null;const k=!v&&!tt(C,n);return v||k?j():null},[i,v,n,C,j]);return S!==null?S:x}function Gd(e){const a=Es(),{name:s,disabled:n,control:r=a,shouldUnregister:i,defaultValue:c,exact:l=!0}=e,d=fi(r._names.array,s),u=h.useMemo(()=>G(r._formValues,s,G(r._defaultValues,s,c)),[r,s,c]),f=qd({control:r,name:s,defaultValue:u,exact:l}),m=Wd({control:r,name:s,exact:l}),b=h.useRef(e),x=h.useRef(void 0),g=h.useRef(r.register(s,{...e.rules,value:f,...Ge(e.disabled)?{disabled:e.disabled}:{}}));b.current=e;const j=h.useMemo(()=>Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!G(m.errors,s)},isDirty:{enumerable:!0,get:()=>!!G(m.dirtyFields,s)},isTouched:{enumerable:!0,get:()=>!!G(m.touchedFields,s)},isValidating:{enumerable:!0,get:()=>!!G(m.validatingFields,s)},error:{enumerable:!0,get:()=>G(m.errors,s)}}),[m,s]),y=h.useCallback(k=>g.current.onChange({target:{value:mi(k),name:s},type:ga.CHANGE}),[s]),v=h.useCallback(()=>g.current.onBlur({target:{value:G(r._formValues,s),name:s},type:ga.BLUR}),[s,r._formValues]),C=h.useCallback(k=>{const $=G(r._fields,s);$&&$._f&&k&&($._f.ref={focus:()=>Oe(k.focus)&&k.focus(),select:()=>Oe(k.select)&&k.select(),setCustomValidity:_=>Oe(k.setCustomValidity)&&k.setCustomValidity(_),reportValidity:()=>Oe(k.reportValidity)&&k.reportValidity()})},[r._fields,s]),S=h.useMemo(()=>({name:s,value:f,...Ge(n)||m.disabled?{disabled:m.disabled||n}:{},onChange:y,onBlur:v,ref:C}),[s,n,m.disabled,y,v,C,f]);return h.useEffect(()=>{const k=r._options.shouldUnregister||i,$=x.current;$&&$!==s&&!d&&r.unregister($),r.register(s,{...b.current.rules,...Ge(b.current.disabled)?{disabled:b.current.disabled}:{}});const _=(w,F)=>{const A=G(r._fields,w);A&&A._f&&(A._f.mount=F)};if(_(s,!0),k){const w=Ne(G(r._options.defaultValues,s,b.current.defaultValue));xe(r._defaultValues,s,w),he(G(r._formValues,s))&&xe(r._formValues,s,w)}return!d&&r.register(s),x.current=s,()=>{(d?k&&!r._state.action:k)?r.unregister(s):_(s,!1)}},[s,r,d,i]),h.useEffect(()=>{r._setDisabledField({disabled:n,name:s})},[n,s,r]),h.useMemo(()=>({field:S,formState:m,fieldState:j}),[S,m,j])}const Kd=h.createContext(null);Kd.displayName="HookFormContext";var Yd=(e,a,s,n,r)=>a?{...s[e],types:{...s[e]&&s[e].types?s[e].types:{},[n]:r||!0}}:{},Kt=e=>Array.isArray(e)?e:[e],An=()=>{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 hi(e,a){const s={};for(const n in e)if(e.hasOwnProperty(n)){const r=e[n],i=a[n];if(r&&Se(r)&&i){const c=hi(r,i);Se(c)&&(s[n]=c)}else e[n]&&(s[n]=i)}return s}var Te=e=>Se(e)&&!Object.keys(e).length,Fs=e=>e.type==="file",ya=e=>{if(!$s)return!1;const a=e?e.ownerDocument:0;return e instanceof(a&&a.defaultView?a.defaultView.HTMLElement:HTMLElement)},bi=e=>e.type==="select-multiple",_s=e=>e.type==="radio",Zd=e=>_s(e)||ea(e),Ha=e=>ya(e)&&e.isConnected;function Qd(e,a){const s=a.slice(0,-1).length;let n=0;for(;n<s;)e=he(e)?n++:e[a[n++]];return e}function Xd(e){for(const a in e)if(e.hasOwnProperty(a)&&!he(e[a]))return!1;return!0}function Ce(e,a){const s=Array.isArray(a)?a:Da(a)?[a]:Ds(a),n=s.length===1?e:Qd(e,s),r=s.length-1,i=s[r];return n&&delete n[i],r!==0&&(Se(n)&&Te(n)||Array.isArray(n)&&Xd(n))&&Ce(e,s.slice(0,-1)),e}var Jd=e=>{for(const a in e)if(Oe(e[a]))return!0;return!1};function gi(e){return Array.isArray(e)||Se(e)&&!Jd(e)}function ms(e,a={}){for(const s in e){const n=e[s];gi(n)?(a[s]=Array.isArray(n)?[]:{},ms(n,a[s])):he(n)||(a[s]=!0)}return a}function Ft(e,a,s){s||(s=ms(a));for(const n in e){const r=e[n];if(gi(r))he(a)||us(s[n])?s[n]=ms(r,Array.isArray(r)?[]:{}):Ft(r,He(a)?{}:a[n],s[n]);else{const i=a[n];s[n]=!tt(r,i)}}return s}const Dn={value:!1,isValid:!1},En={value:!0,isValid:!0};var yi=e=>{if(Array.isArray(e)){if(e.length>1){const a=e.filter(s=>s&&s.checked&&!s.disabled).map(s=>s.value);return{value:a,isValid:!!a.length}}return e[0].checked&&!e[0].disabled?e[0].attributes&&!he(e[0].attributes.value)?he(e[0].value)||e[0].value===""?En:{value:e[0].value,isValid:!0}:En:Dn}return Dn},vi=(e,{valueAsNumber:a,valueAsDate:s,setValueAs:n})=>he(e)?e:a?e===""?NaN:e&&+e:s&&Ye(e)?new Date(e):n?n(e):e;const Ln={isValid:!1,value:null};var ji=e=>Array.isArray(e)?e.reduce((a,s)=>s&&s.checked&&!s.disabled?{isValid:!0,value:s.value}:a,Ln):Ln;function Fn(e){const a=e.ref;return Fs(a)?a.files:_s(a)?ji(e.refs).value:bi(a)?[...a.selectedOptions].map(({value:s})=>s):ea(a)?yi(e.refs).value:vi(he(a.value)?e.ref.value:a.value,e)}var eu=(e,a,s,n)=>{const r={};for(const i of e){const c=G(a,i);c&&xe(r,i,c._f)}return{criteriaMode:s,names:[...e],fields:r,shouldUseNativeValidation:n}},va=e=>e instanceof RegExp,Ot=e=>he(e)?e:va(e)?e.source:Se(e)?va(e.value)?e.value.source:e.value:e,_n=e=>({isOnSubmit:!e||e===et.onSubmit,isOnBlur:e===et.onBlur,isOnChange:e===et.onChange,isOnAll:e===et.all,isOnTouch:e===et.onTouched});const Rn="AsyncFunction";var tu=e=>!!e&&!!e.validate&&!!(Oe(e.validate)&&e.validate.constructor.name===Rn||Se(e.validate)&&Object.values(e.validate).find(a=>a.constructor.name===Rn)),au=e=>e.mount&&(e.required||e.min||e.max||e.maxLength||e.minLength||e.pattern||e.validate),In=(e,a,s)=>!s&&(a.watchAll||a.watch.has(e)||[...a.watch].some(n=>e.startsWith(n)&&/^\.\w+/.test(e.slice(n.length))));const Yt=(e,a,s,n)=>{for(const r of s||Object.keys(e)){const i=G(e,r);if(i){const{_f:c,...l}=i;if(c){if(c.refs&&c.refs[0]&&a(c.refs[0],r)&&!n)return!0;if(c.ref&&a(c.ref,c.name)&&!n)return!0;if(Yt(l,a))break}else if(Se(l)&&Yt(l,a))break}}};function Mn(e,a,s){const n=G(e,s);if(n||Da(s))return{error:n,name:s};const r=s.split(".");for(;r.length;){const i=r.join("."),c=G(a,i),l=G(e,i);if(c&&!Array.isArray(c)&&s!==i)return{name:s};if(l&&l.type)return{name:i,error:l};if(l&&l.root&&l.root.type)return{name:`${i}.root`,error:l.root};r.pop()}return{name:s}}var su=(e,a,s,n)=>{s(e);const{name:r,...i}=e;return Te(i)||Object.keys(i).length>=Object.keys(a).length||Object.keys(i).find(c=>a[c]===(!n||et.all))},nu=(e,a,s)=>!e||!a||e===a||Kt(e).some(n=>n&&(s?n===a:n.startsWith(a)||a.startsWith(n))),ru=(e,a,s,n,r)=>r.isOnAll?!1:!s&&r.isOnTouch?!(a||e):(s?n.isOnBlur:r.isOnBlur)?!e:(s?n.isOnChange:r.isOnChange)?e:!0,iu=(e,a)=>!As(G(e,a)).length&&Ce(e,a),lu=(e,a,s)=>{const n=Kt(G(e,s));return xe(n,"root",a[s]),xe(e,s,n),e};function Bn(e,a,s="validate"){if(Ye(e)||Array.isArray(e)&&e.every(Ye)||Ge(e)&&!e)return{type:s,message:Ye(e)?e:"",ref:a}}var At=e=>Se(e)&&!va(e)?e:{value:e,message:""},Pn=async(e,a,s,n,r,i)=>{const{ref:c,refs:l,required:d,maxLength:u,minLength:f,min:m,max:b,pattern:x,validate:g,name:j,valueAsNumber:y,mount:v}=e._f,C=G(s,j);if(!v||a.has(j))return{};const S=l?l[0]:c,k=D=>{r&&S.reportValidity&&(S.setCustomValidity(Ge(D)?"":D||""),S.reportValidity())},$={},_=_s(c),w=ea(c),F=_||w,A=(y||Fs(c))&&he(c.value)&&he(C)||ya(c)&&c.value===""||C===""||Array.isArray(C)&&!C.length,M=Yd.bind(null,j,n,$),E=(D,I,B,z=nt.maxLength,q=nt.minLength)=>{const P=D?I:B;$[j]={type:D?z:q,message:P,ref:c,...M(D?z:q,P)}};if(i?!Array.isArray(C)||!C.length:d&&(!F&&(A||He(C))||Ge(C)&&!C||w&&!yi(l).isValid||_&&!ji(l).isValid)){const{value:D,message:I}=Ye(d)?{value:!!d,message:d}:At(d);if(D&&($[j]={type:nt.required,message:I,ref:S,...M(nt.required,I)},!n))return k(I),$}if(!A&&(!He(m)||!He(b))){let D,I;const B=At(b),z=At(m);if(!He(C)&&!isNaN(C)){const q=c.valueAsNumber||C&&+C;He(B.value)||(D=q>B.value),He(z.value)||(I=q<z.value)}else{const q=c.valueAsDate||new Date(C),P=Y=>new Date(new Date().toDateString()+" "+Y),ee=c.type=="time",W=c.type=="week";Ye(B.value)&&C&&(D=ee?P(C)>P(B.value):W?C>B.value:q>new Date(B.value)),Ye(z.value)&&C&&(I=ee?P(C)<P(z.value):W?C<z.value:q<new Date(z.value))}if((D||I)&&(E(!!D,B.message,z.message,nt.max,nt.min),!n))return k($[j].message),$}if((u||f)&&!A&&(Ye(C)||i&&Array.isArray(C))){const D=At(u),I=At(f),B=!He(D.value)&&C.length>+D.value,z=!He(I.value)&&C.length<+I.value;if((B||z)&&(E(B,D.message,I.message),!n))return k($[j].message),$}if(x&&!A&&Ye(C)){const{value:D,message:I}=At(x);if(va(D)&&!C.match(D)&&($[j]={type:nt.pattern,message:I,ref:c,...M(nt.pattern,I)},!n))return k(I),$}if(g){if(Oe(g)){const D=await g(C,s),I=Bn(D,S);if(I&&($[j]={...I,...M(nt.validate,I.message)},!n))return k(I.message),$}else if(Se(g)){let D={};for(const I in g){if(!Te(D)&&!n)break;const B=Bn(await g[I](C,s),S,I);B&&(D={...B,...M(I,B.message)},k(B.message),n&&($[j]=D))}if(!Te(D)&&($[j]={ref:S,...D},!n))return $}}return k(!0),$};const ou={mode:et.onSubmit,reValidateMode:et.onChange,shouldFocusError:!0};function cu(e={}){let a={...ou,...e},s={submitCount:0,isDirty:!1,isReady:!1,isLoading:Oe(a.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{},errors:a.errors||{},disabled:a.disabled||!1},n={},r=Se(a.defaultValues)||Se(a.values)?Ne(a.defaultValues||a.values)||{}:{},i=a.shouldUnregister?{}:Ne(r),c={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 b={...m};const x={array:An(),state:An()},g=a.criteriaMode===et.all,j=N=>L=>{clearTimeout(u),u=setTimeout(N,L)},y=async N=>{if(!c.keepIsValid&&!a.disabled&&(m.isValid||b.isValid||N)){let L;a.resolver?(L=Te((await F()).errors),v()):L=await M(n,!0),L!==s.isValid&&x.state.next({isValid:L})}},v=(N,L)=>{!a.disabled&&(m.isValidating||m.validatingFields||b.isValidating||b.validatingFields)&&((N||Array.from(l.mount)).forEach(R=>{R&&(L?xe(s.validatingFields,R,L):Ce(s.validatingFields,R))}),x.state.next({validatingFields:s.validatingFields,isValidating:!Te(s.validatingFields)}))},C=(N,L=[],R,H,U=!0,T=!0)=>{if(H&&R&&!a.disabled){if(c.action=!0,T&&Array.isArray(G(n,N))){const X=R(G(n,N),H.argA,H.argB);U&&xe(n,N,X)}if(T&&Array.isArray(G(s.errors,N))){const X=R(G(s.errors,N),H.argA,H.argB);U&&xe(s.errors,N,X),iu(s.errors,N)}if((m.touchedFields||b.touchedFields)&&T&&Array.isArray(G(s.touchedFields,N))){const X=R(G(s.touchedFields,N),H.argA,H.argB);U&&xe(s.touchedFields,N,X)}(m.dirtyFields||b.dirtyFields)&&(s.dirtyFields=Ft(r,i)),x.state.next({name:N,isDirty:D(N,L),dirtyFields:s.dirtyFields,errors:s.errors,isValid:s.isValid})}else xe(i,N,L)},S=(N,L)=>{xe(s.errors,N,L),x.state.next({errors:s.errors})},k=N=>{s.errors=N,x.state.next({errors:s.errors,isValid:!1})},$=(N,L,R,H)=>{const U=G(n,N);if(U){const T=G(i,N,he(R)?G(r,N):R);he(T)||H&&H.defaultChecked||L?xe(i,N,L?T:Fn(U._f)):z(N,T),c.mount&&!c.action&&y()}},_=(N,L,R,H,U)=>{let T=!1,X=!1;const ue={name:N};if(!a.disabled){if(!R||H){(m.isDirty||b.isDirty)&&(X=s.isDirty,s.isDirty=ue.isDirty=D(),T=X!==ue.isDirty);const me=tt(G(r,N),L);X=!!G(s.dirtyFields,N),me?Ce(s.dirtyFields,N):xe(s.dirtyFields,N,!0),ue.dirtyFields=s.dirtyFields,T=T||(m.dirtyFields||b.dirtyFields)&&X!==!me}if(R){const me=G(s.touchedFields,N);me||(xe(s.touchedFields,N,R),ue.touchedFields=s.touchedFields,T=T||(m.touchedFields||b.touchedFields)&&me!==R)}T&&U&&x.state.next(ue)}return T?ue:{}},w=(N,L,R,H)=>{const U=G(s.errors,N),T=(m.isValid||b.isValid)&&Ge(L)&&s.isValid!==L;if(a.delayError&&R?(d=j(()=>S(N,R)),d(a.delayError)):(clearTimeout(u),d=null,R?xe(s.errors,N,R):Ce(s.errors,N)),(R?!tt(U,R):U)||!Te(H)||T){const X={...H,...T&&Ge(L)?{isValid:L}:{},errors:s.errors,name:N};s={...s,...X},x.state.next(X)}},F=async N=>(v(N,!0),await a.resolver(i,a.context,eu(N||l.mount,n,a.criteriaMode,a.shouldUseNativeValidation))),A=async N=>{const{errors:L}=await F(N);if(v(N),N)for(const R of N){const H=G(L,R);H?xe(s.errors,R,H):Ce(s.errors,R)}else s.errors=L;return L},M=async(N,L,R={valid:!0})=>{for(const H in N){const U=N[H];if(U){const{_f:T,...X}=U;if(T){const ue=l.array.has(T.name),me=U._f&&tu(U._f);me&&m.validatingFields&&v([T.name],!0);const Be=await Pn(U,l.disabled,i,g,a.shouldUseNativeValidation&&!L,ue);if(me&&m.validatingFields&&v([T.name]),Be[T.name]&&(R.valid=!1,L||e.shouldUseNativeValidation))break;!L&&(G(Be,T.name)?ue?lu(s.errors,Be,T.name):xe(s.errors,T.name,Be[T.name]):Ce(s.errors,T.name))}!Te(X)&&await M(X,L,R)}}return R.valid},E=()=>{for(const N of l.unMount){const L=G(n,N);L&&(L._f.refs?L._f.refs.every(R=>!Ha(R)):!Ha(L._f.ref))&&Z(N)}l.unMount=new Set},D=(N,L)=>!a.disabled&&(N&&L&&xe(i,N,L),!tt(K(),r)),I=(N,L,R)=>ds(N,l,{...c.mount?i:he(L)?r:Ye(N)?{[N]:L}:L},R,L),B=N=>As(G(c.mount?i:r,N,a.shouldUnregister?G(r,N,[]):[])),z=(N,L,R={})=>{const H=G(n,N);let U=L;if(H){const T=H._f;T&&(!T.disabled&&xe(i,N,vi(L,T)),U=ya(T.ref)&&He(L)?"":L,bi(T.ref)?[...T.ref.options].forEach(X=>X.selected=U.includes(X.value)):T.refs?ea(T.ref)?T.refs.forEach(X=>{(!X.defaultChecked||!X.disabled)&&(Array.isArray(U)?X.checked=!!U.find(ue=>ue===X.value):X.checked=U===X.value||!!U)}):T.refs.forEach(X=>X.checked=X.value===U):Fs(T.ref)?T.ref.value="":(T.ref.value=U,T.ref.type||x.state.next({name:N,values:Ne(i)})))}(R.shouldDirty||R.shouldTouch)&&_(N,U,R.shouldTouch,R.shouldDirty,!0),R.shouldValidate&&Y(N)},q=(N,L,R)=>{for(const H in L){if(!L.hasOwnProperty(H))return;const U=L[H],T=N+"."+H,X=G(n,T);(l.array.has(N)||Se(U)||X&&!X._f)&&!jt(U)?q(T,U,R):z(T,U,R)}},P=(N,L,R={})=>{const H=G(n,N),U=l.array.has(N),T=Ne(L);xe(i,N,T),U?(x.array.next({name:N,values:Ne(i)}),(m.isDirty||m.dirtyFields||b.isDirty||b.dirtyFields)&&R.shouldDirty&&x.state.next({name:N,dirtyFields:Ft(r,i),isDirty:D(N,T)})):H&&!H._f&&!He(T)?q(N,T,R):z(N,T,R),In(N,l)?x.state.next({...s,name:N,values:Ne(i)}):x.state.next({name:c.mount?N:void 0,values:Ne(i)})},ee=async N=>{c.mount=!0;const L=N.target;let R=L.name,H=!0;const U=G(n,R),T=me=>{H=Number.isNaN(me)||jt(me)&&isNaN(me.getTime())||tt(me,G(i,R,me))},X=_n(a.mode),ue=_n(a.reValidateMode);if(U){let me,Be;const pt=L.type?Fn(U._f):mi(N),ct=N.type===ga.BLUR||N.type===ga.FOCUS_OUT,Mo=!au(U._f)&&!a.resolver&&!G(s.errors,R)&&!U._f.deps||ru(ct,G(s.touchedFields,R),s.isSubmitted,ue,X),Ia=In(R,l,ct);xe(i,R,pt),ct?(!L||!L.readOnly)&&(U._f.onBlur&&U._f.onBlur(N),d&&d(0)):U._f.onChange&&U._f.onChange(N);const Ma=_(R,pt,ct),Bo=!Te(Ma)||Ia;if(!ct&&x.state.next({name:R,type:N.type,values:Ne(i)}),Mo)return(m.isValid||b.isValid)&&(a.mode==="onBlur"?ct&&y():ct||y()),Bo&&x.state.next({name:R,...Ia?{}:Ma});if(!ct&&Ia&&x.state.next({...s}),a.resolver){const{errors:cn}=await F([R]);if(v([R]),T(pt),H){const Po=Mn(s.errors,n,R),dn=Mn(cn,n,Po.name||R);me=dn.error,R=dn.name,Be=Te(cn)}}else v([R],!0),me=(await Pn(U,l.disabled,i,g,a.shouldUseNativeValidation))[R],v([R]),T(pt),H&&(me?Be=!1:(m.isValid||b.isValid)&&(Be=await M(n,!0)));H&&(U._f.deps&&(!Array.isArray(U._f.deps)||U._f.deps.length>0)&&Y(U._f.deps),w(R,Be,me,Ma))}},W=(N,L)=>{if(G(s.errors,L)&&N.focus)return N.focus(),1},Y=async(N,L={})=>{let R,H;const U=Kt(N);if(a.resolver){const T=await A(he(N)?N:U);R=Te(T),H=N?!U.some(X=>G(T,X)):R}else N?(H=(await Promise.all(U.map(async T=>{const X=G(n,T);return await M(X&&X._f?{[T]:X}:X)}))).every(Boolean),!(!H&&!s.isValid)&&y()):H=R=await M(n);return x.state.next({...!Ye(N)||(m.isValid||b.isValid)&&R!==s.isValid?{}:{name:N},...a.resolver||!N?{isValid:R}:{},errors:s.errors}),L.shouldFocus&&!H&&Yt(n,W,N?U:l.mount),H},K=(N,L)=>{let R={...c.mount?i:r};return L&&(R=hi(L.dirtyFields?s.dirtyFields:s.touchedFields,R)),he(N)?R:Ye(N)?G(R,N):N.map(H=>G(R,H))},ie=(N,L)=>({invalid:!!G((L||s).errors,N),isDirty:!!G((L||s).dirtyFields,N),error:G((L||s).errors,N),isValidating:!!G(s.validatingFields,N),isTouched:!!G((L||s).touchedFields,N)}),te=N=>{N&&Kt(N).forEach(L=>Ce(s.errors,L)),x.state.next({errors:N?s.errors:{}})},Q=(N,L,R)=>{const H=(G(n,N,{_f:{}})._f||{}).ref,U=G(s.errors,N)||{},{ref:T,message:X,type:ue,...me}=U;xe(s.errors,N,{...me,...L,ref:H}),x.state.next({name:N,errors:s.errors,isValid:!1}),R&&R.shouldFocus&&H&&H.focus&&H.focus()},ne=(N,L)=>Oe(N)?x.state.subscribe({next:R=>"values"in R&&N(I(void 0,L),R)}):I(N,L,!0),V=N=>x.state.subscribe({next:L=>{nu(N.name,L.name,N.exact)&&su(L,N.formState||m,oe,N.reRenderRoot)&&N.callback({values:{...i},...s,...L,defaultValues:r})}}).unsubscribe,O=N=>(c.mount=!0,b={...b,...N.formState},V({...N,formState:{...f,...N.formState}})),Z=(N,L={})=>{for(const R of N?Kt(N):l.mount)l.mount.delete(R),l.array.delete(R),L.keepValue||(Ce(n,R),Ce(i,R)),!L.keepError&&Ce(s.errors,R),!L.keepDirty&&Ce(s.dirtyFields,R),!L.keepTouched&&Ce(s.touchedFields,R),!L.keepIsValidating&&Ce(s.validatingFields,R),!a.shouldUnregister&&!L.keepDefaultValue&&Ce(r,R);x.state.next({values:Ne(i)}),x.state.next({...s,...L.keepDirty?{isDirty:D()}:{}}),!L.keepIsValid&&y()},Re=({disabled:N,name:L})=>{if(Ge(N)&&c.mount||N||l.disabled.has(L)){const U=l.disabled.has(L)!==!!N;N?l.disabled.add(L):l.disabled.delete(L),U&&c.mount&&!c.action&&y()}},De=(N,L={})=>{let R=G(n,N);const H=Ge(L.disabled)||Ge(a.disabled);return xe(n,N,{...R||{},_f:{...R&&R._f?R._f:{ref:{name:N}},name:N,mount:!0,...L}}),l.mount.add(N),R?Re({disabled:Ge(L.disabled)?L.disabled:a.disabled,name:N}):$(N,!0,L.value),{...H?{disabled:L.disabled||a.disabled}:{},...a.progressive?{required:!!L.required,min:Ot(L.min),max:Ot(L.max),minLength:Ot(L.minLength),maxLength:Ot(L.maxLength),pattern:Ot(L.pattern)}:{},name:N,onChange:ee,onBlur:ee,ref:U=>{if(U){De(N,L),R=G(n,N);const T=he(U.value)&&U.querySelectorAll&&U.querySelectorAll("input,select,textarea")[0]||U,X=Zd(T),ue=R._f.refs||[];if(X?ue.find(me=>me===T):T===R._f.ref)return;xe(n,N,{_f:{...R._f,...X?{refs:[...ue.filter(Ha),T,...Array.isArray(G(r,N))?[{}]:[]],ref:{type:T.type,name:N}}:{ref:T}}}),$(N,!1,void 0,T)}else R=G(n,N,{}),R._f&&(R._f.mount=!1),(a.shouldUnregister||L.shouldUnregister)&&!(fi(l.array,N)&&c.action)&&l.unMount.add(N)}}},Ee=()=>a.shouldFocusError&&Yt(n,W,l.mount),ae=N=>{Ge(N)&&(x.state.next({disabled:N}),Yt(n,(L,R)=>{const H=G(n,R);H&&(L.disabled=H._f.disabled||N,Array.isArray(H._f.refs)&&H._f.refs.forEach(U=>{U.disabled=H._f.disabled||N}))},0,!1))},be=(N,L)=>async R=>{let H;R&&(R.preventDefault&&R.preventDefault(),R.persist&&R.persist());let U=Ne(i);if(x.state.next({isSubmitting:!0}),a.resolver){const{errors:T,values:X}=await F();v(),s.errors=T,U=Ne(X)}else await M(n);if(l.disabled.size)for(const T of l.disabled)Ce(U,T);if(Ce(s.errors,"root"),Te(s.errors)){x.state.next({errors:{}});try{await N(U,R)}catch(T){H=T}}else L&&await L({...s.errors},R),Ee(),setTimeout(Ee);if(x.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:Te(s.errors)&&!H,submitCount:s.submitCount+1,errors:s.errors}),H)throw H},$e=(N,L={})=>{G(n,N)&&(he(L.defaultValue)?P(N,Ne(G(r,N))):(P(N,L.defaultValue),xe(r,N,Ne(L.defaultValue))),L.keepTouched||Ce(s.touchedFields,N),L.keepDirty||(Ce(s.dirtyFields,N),s.isDirty=L.defaultValue?D(N,Ne(G(r,N))):D()),L.keepError||(Ce(s.errors,N),m.isValid&&y()),x.state.next({...s}))},ge=(N,L={})=>{const R=N?Ne(N):r,H=Ne(R),U=Te(N),T=U?r:H;if(L.keepDefaultValues||(r=R),!L.keepValues){if(L.keepDirtyValues){const X=new Set([...l.mount,...Object.keys(Ft(r,i))]);for(const ue of Array.from(X)){const me=G(s.dirtyFields,ue),Be=G(i,ue),pt=G(T,ue);me&&!he(Be)?xe(T,ue,Be):!me&&!he(pt)&&P(ue,pt)}}else{if($s&&he(N))for(const X of l.mount){const ue=G(n,X);if(ue&&ue._f){const me=Array.isArray(ue._f.refs)?ue._f.refs[0]:ue._f.ref;if(ya(me)){const Be=me.closest("form");if(Be){Be.reset();break}}}}if(L.keepFieldsRef)for(const X of l.mount)P(X,G(T,X));else n={}}i=a.shouldUnregister?L.keepDefaultValues?Ne(r):{}:Ne(T),x.array.next({values:{...T}}),x.state.next({values:{...T}})}l={mount:L.keepDirtyValues?l.mount:new Set,unMount:new Set,array:new Set,disabled:new Set,watch:new Set,watchAll:!1,focus:""},c.mount=!m.isValid||!!L.keepIsValid||!!L.keepDirtyValues||!a.shouldUnregister&&!Te(T),c.watch=!!a.shouldUnregister,c.keepIsValid=!!L.keepIsValid,c.action=!1,L.keepErrors||(s.errors={}),x.state.next({submitCount:L.keepSubmitCount?s.submitCount:0,isDirty:U?!1:L.keepDirty?s.isDirty:!!(L.keepDefaultValues&&!tt(N,r)),isSubmitted:L.keepIsSubmitted?s.isSubmitted:!1,dirtyFields:U?{}:L.keepDirtyValues?L.keepDefaultValues&&i?Ft(r,i):s.dirtyFields:L.keepDefaultValues&&N?Ft(r,N):L.keepDirty?s.dirtyFields:{},touchedFields:L.keepTouched?s.touchedFields:{},errors:L.keepErrors?s.errors:{},isSubmitSuccessful:L.keepIsSubmitSuccessful?s.isSubmitSuccessful:!1,isSubmitting:!1,defaultValues:r})},We=(N,L)=>ge(Oe(N)?N(i):N,{...a.resetOptions,...L}),Le=(N,L={})=>{const R=G(n,N),H=R&&R._f;if(H){const U=H.refs?H.refs[0]:H.ref;U.focus&&setTimeout(()=>{U.focus(),L.shouldSelect&&Oe(U.select)&&U.select()})}},oe=N=>{s={...s,...N}},se={control:{register:De,unregister:Z,getFieldState:ie,handleSubmit:be,setError:Q,_subscribe:V,_runSchema:F,_updateIsValidating:v,_focusError:Ee,_getWatch:I,_getDirty:D,_setValid:y,_setFieldArray:C,_setDisabledField:Re,_setErrors:k,_getFieldArray:B,_reset:ge,_resetDefaultValues:()=>Oe(a.defaultValues)&&a.defaultValues().then(N=>{We(N,a.resetOptions),x.state.next({isLoading:!1})}),_removeUnmounted:E,_disableForm:ae,_subjects:x,_proxyFormState:m,get _fields(){return n},get _formValues(){return i},get _state(){return c},set _state(N){c=N},get _defaultValues(){return r},get _names(){return l},set _names(N){l=N},get _formState(){return s},get _options(){return a},set _options(N){a={...a,...N}}},subscribe:O,trigger:Y,register:De,handleSubmit:be,watch:ne,setValue:P,getValues:K,reset:We,resetField:$e,clearErrors:te,unregister:Z,setError:Q,setFocus:Le,getFieldState:ie};return{...se,formControl:se}}function du(e={}){const a=h.useRef(void 0),s=h.useRef(void 0),[n,r]=h.useState({isDirty:!1,isValidating:!1,isLoading:Oe(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:Oe(e.defaultValues)?void 0:e.defaultValues});if(!a.current)if(e.formControl)a.current={...e.formControl,formState:n},e.defaultValues&&!Oe(e.defaultValues)&&e.formControl.reset(e.defaultValues,e.resetOptions);else{const{formControl:c,...l}=cu(e);a.current={...l,formState:n}}const i=a.current.control;return i._options=e,Ls(()=>{const c=i._subscribe({formState:i._proxyFormState,callback:()=>r({...i._formState}),reRenderRoot:!0});return r(l=>({...l,isReady:!0})),i._formState.isReady=!0,c},[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 c=i._getDirty();c!==n.isDirty&&i._subjects.state.next({isDirty:c})}},[i,n.isDirty]),h.useEffect(()=>{var c;e.values&&!tt(e.values,s.current)?(i._reset(e.values,{keepFieldsRef:!0,...i._options.resetOptions}),!((c=i._options.resetOptions)===null||c===void 0)&&c.keepIsValid||i._setValid(),s.current=e.values,r(l=>({...l}))):i._resetDefaultValues()},[i,e.values]),h.useEffect(()=>{i._state.mount||(i._setValid(),i._state.mount=!0),i._state.watch&&(i._state.watch=!1,i._subjects.state.next({...i._formState})),i._removeUnmounted()}),a.current.formState=h.useMemo(()=>pi(n,i),[i,n]),a.current}function uu(e,a=3){return e%1===0?e.toString():e.toFixed(a).replace(/\.?0+$/,"")}function mu(e,a="en-US",s="USD"){try{return new Intl.NumberFormat(a,{style:"currency",currency:s,minimumFractionDigits:2,maximumFractionDigits:2}).format(e)}catch(n){return console.warn(`Invalid currency formatting: ${n}`),`${s} ${e.toFixed(2)}`}}function fu(e="USD",a="en-US"){try{return new Intl.NumberFormat(a,{style:"currency",currency:e}).formatToParts(0).find(i=>i.type==="currency")?.value??"$"}catch{return"$"}}function xu(e){const a=e.replace(/[^\d.,-]/g,""),s=a.match(/,\d{1,2}$/);let n;s?n=a.replace(/\./g,"").replace(",","."):n=a.replace(/,/g,"");const r=parseFloat(n);return isNaN(r)?null:r}function pu(e,a,s=.001){const n=e-a,r=Math.abs(n)<=s;return{difference:n,isBalanced:r,isUnderAllocated:!r&&n>0,isOverAllocated:!r&&n<0}}function Rs(){return`dist-${Date.now()}-${Math.random().toString(36).substr(2,9)}`}Rs();const hu={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:"$"},Wa=()=>({id:Rs(),amount:0,glAccount:null,isTaxDeductible:!1}),wi=({distribution:e,defaultDistribution:a,glAccounts:s=[],isLoadingGlAccounts:n=!1,onSearchGlAccounts:r,onDistributionChange:i,onAmountChange:c,onGlAccountChange:l,onTaxDeductibleChange:d,onDelete:u,canDelete:f=!0,canEditTaxDeductible:m=!0,isDisabled:b=!1,labels:x,classNames:g={},"data-testid":j,control:y,name:v,rules:C})=>{const S={...hu,...x},k=y!==void 0&&v!==void 0,$=du({defaultValues:{_internal:a||Wa()}}),_=Gd({control:k?y:$.control,name:k?v:"_internal",rules:k?C:void 0}),[w,F]=h.useState(a||Wa()),A=k?_.field.value??Wa():e??w,M=k&&!!_.fieldState?.error,E=k&&(_.fieldState?.isTouched??!1),D=M||E,I=D&&(!A.amount||A.amount<=0),B=D&&!A.glAccount,[z,q]=h.useState(A.glAccount?.name||""),P=h.useCallback(Q=>{const ne={...A,...Q};k&&_.field.onChange(ne),!k&&e===void 0&&F(ne),i?.(ne)},[A,e,i,k,_]),ee=h.useCallback(Q=>{const ne=Q||0;P({amount:ne}),c?.(ne)},[P,c]),W=h.useCallback(Q=>{q(Q),r?.(Q)},[r]),Y=h.useCallback(Q=>{if(Q===null){P({glAccount:null}),l?.(null);return}const V=s.find(O=>String(O.id)===String(Q))||null;P({glAccount:V}),l?.(V)},[s,P,l]),K=h.useCallback(()=>{q(""),P({glAccount:null}),l?.(null)},[P,l]),ie=h.useCallback(Q=>{P({isTaxDeductible:Q}),d?.(Q)},[P,d]),te=h.useCallback(()=>{u?.()},[u]);return t.jsx(o.Card,{radius:"md",shadow:"sm","data-testid":j||"revenue-distribution-card",className:o.cn(g.base),children:t.jsxs(o.CardBody,{className:o.cn("flex flex-row flex-nowrap items-start gap-4",g.body),children:[t.jsx("div",{className:o.cn("shrink-0",g.amountContainer),children:t.jsx(o.NumberInput,{"data-testid":`${j||"revenue-distribution-card"}-amount-input`,label:t.jsxs("span",{className:"flex items-center gap-1",children:[S.amount,t.jsx(o.Tooltip,{content:S.amountTooltip,children:t.jsx(p.Icon,{icon:"solar:info-circle-linear",className:"text-default-400 cursor-help",width:16})})]}),value:A.amount||void 0,onValueChange:ee,labelPlacement:"outside",placeholder:S.amountPlaceholder,isWheelDisabled:!0,hideStepper:!0,variant:"bordered",isDisabled:b,isInvalid:I,errorMessage:I?"Amount is required":void 0,minValue:0,step:.01,className:g.amountInput,startContent:t.jsx("div",{className:"pointer-events-none flex items-center",children:t.jsx("span",{className:"text-default-400 text-small",children:S.currencySymbol})})})}),t.jsx("div",{className:o.cn("grow",g.glAccountContainer),children:t.jsx(o.Autocomplete,{"data-testid":`${j||"revenue-distribution-card"}-gl-account-input`,label:t.jsxs("span",{className:"flex items-center gap-1",children:[S.glAccount,t.jsx(o.Tooltip,{content:S.glAccountTooltip,children:t.jsx(p.Icon,{icon:"solar:info-circle-linear",className:"text-default-400 cursor-help",width:16})})]}),isLoading:n,isClearable:!0,labelPlacement:"outside",variant:"bordered",items:s,menuTrigger:"input",inputValue:A.glAccount?.name??z,selectedKey:A.glAccount?.id??null,isDisabled:b,isInvalid:B,errorMessage:B?"GL Account is required":void 0,listboxProps:{emptyContent:n?S.searching:S.noGlAccountsFound},placeholder:S.glAccountPlaceholder,onInputChange:W,onSelectionChange:Y,onClear:K,className:g.glAccountInput,children:Q=>t.jsx(o.AutocompleteItem,{textValue:Q.name,children:t.jsxs("div",{className:"flex flex-col",children:[t.jsx("span",{children:Q.name}),Q.code&&t.jsx("span",{className:"text-xs text-default-400",children:Q.code})]})},Q.id)})}),t.jsx("div",{className:o.cn("shrink-0 pt-6 flex items-center",g.taxDeductibleContainer),children:t.jsx(o.Checkbox,{radius:"full","data-testid":`${j||"revenue-distribution-card"}-tax-deductible`,isSelected:A.isTaxDeductible,onValueChange:ie,isDisabled:b||!m,className:g.taxDeductibleCheckbox,children:S.taxDeductible})}),t.jsx("div",{className:o.cn("shrink-0 pt-6",g.deleteContainer),children:t.jsx(p.Button,{"data-testid":`${j||"revenue-distribution-card"}-delete-button`,size:"sm",color:"danger",variant:"flat",isDisabled:b||!f,onPress:te,startContent:t.jsx(p.Icon,{icon:"solar:trash-bin-trash-linear",width:16}),className:o.cn("text-danger",g.deleteButton),children:S.deleteButton})})]})})};wi.displayName="RevenueDistributionCard";const Ni=({message:e="No distributions configured",icon:a="solar:document-text-outline",iconSize:s=48,showCard:n=!0,classNames:r={},renderEmpty:i})=>{if(i)return t.jsx(t.Fragment,{children:i()});const c=t.jsxs("div",{className:o.cn("flex flex-col items-center justify-center py-8",r.content),children:[t.jsx(p.Icon,{icon:a,width:s,className:o.cn("text-default-300 mb-4",r.icon)}),t.jsx("p",{className:o.cn("text-default-500 text-sm text-center",r.message),children:e})]});return n?t.jsx(o.Card,{radius:"sm",shadow:"sm","data-testid":"revenue-distribution-empty",className:o.cn("w-full",r.base),children:t.jsx(o.CardBody,{children:c})}):t.jsx("div",{"data-testid":"revenue-distribution-empty",className:o.cn("w-full",r.base),children:c})};Ni.displayName="RevenueDistributionEmpty";const bu={title:"Error Loading Distributions",description:"An error occurred while loading the distribution configuration. Please try again."},Ci=({error:e,labels:a,showCard:s=!0,color:n="danger",classNames:r={}})=>{const i={...bu,...a},c=t.jsx(o.Alert,{"data-testid":"revenue-distribution-error-alert",color:n,title:i.title,description:e||i.description,className:r.alert});return s?t.jsx(o.Card,{radius:"sm",shadow:"sm","data-testid":"revenue-distribution-error",className:o.cn("w-full",r.base),children:t.jsx(o.CardBody,{children:c})}):t.jsx("div",{"data-testid":"revenue-distribution-error",className:o.cn("w-full",r.base),children:c})};Ci.displayName="RevenueDistributionError";const ki=({rows:e=1,showCard:a=!0,classNames:s={}})=>{const n=Array.from({length:e},(i,c)=>c),r=i=>t.jsxs("div",{className:o.cn("flex flex-row flex-nowrap items-end gap-4",s.row),children:[t.jsxs("div",{className:"shrink-0 flex flex-col gap-1",children:[t.jsxs("div",{className:"flex items-center gap-1",children:[t.jsx(p.Skeleton,{className:"h-4 w-14 rounded-md"}),t.jsx(p.Skeleton,{className:"h-4 w-4 rounded-full"})]}),t.jsx(p.Skeleton,{className:"h-10 w-32 rounded-lg"})]}),t.jsxs("div",{className:"grow flex flex-col gap-1",children:[t.jsxs("div",{className:"flex items-center gap-1",children:[t.jsx(p.Skeleton,{className:"h-4 w-20 rounded-md"}),t.jsx(p.Skeleton,{className:"h-4 w-4 rounded-full"})]}),t.jsx(p.Skeleton,{className:"h-10 w-full rounded-lg"})]}),t.jsxs("div",{className:"shrink-0 pb-2 flex items-center gap-2",children:[t.jsx(p.Skeleton,{className:"h-5 w-5 rounded-full"}),t.jsx(p.Skeleton,{className:"h-4 w-24 rounded-md"})]}),t.jsx("div",{className:"shrink-0 pb-2",children:t.jsx(p.Skeleton,{className:"h-8 w-20 rounded-lg"})})]},i);return a?t.jsx("div",{className:o.cn("flex flex-col gap-3",s.base),children:n.map(i=>t.jsx(o.Card,{radius:"md",shadow:"sm","data-testid":`revenue-distribution-skeleton-${i}`,children:t.jsx(o.CardBody,{children:r(i)})},i))}):t.jsx("div",{"data-testid":"revenue-distribution-skeleton",className:o.cn("flex flex-col gap-3",s.base),children:n.map(i=>r(i))})};ki.displayName="RevenueDistributionSkeleton";function Is({isOpen:e,labels:a,icon:s,isConfirming:n=!1,confirmColor:r="danger",iconTone:i="danger",portalContainer:c,shouldBlockScroll:l,classNames:d,onClose:u,onConfirm:f}){return t.jsx(p.Modal,{isOpen:e,size:"md",placement:"center",portalContainer:c,shouldBlockScroll:l,classNames:{...d,base:o.cn("max-w-[440px] rounded-3xl",d?.base),closeButton:o.cn("right-5 top-5 text-zinc-500",d?.closeButton)},onOpenChange:m=>!m&&u(),children:t.jsxs(o.ModalContent,{children:[t.jsxs(o.ModalHeader,{className:"flex flex-col items-start gap-4 px-7 pb-0 pt-7",children:[s&&t.jsx("span",{className:o.cn("flex h-12 w-12 shrink-0 items-center justify-center rounded-full",i==="warning"?"bg-brand/15 text-brand":"bg-danger-100 text-danger-600"),children:s}),t.jsx("span",{className:"text-lg font-semibold leading-6 text-zinc-950",children:a.title})]}),t.jsx(o.ModalBody,{className:"px-7 pb-3 pt-4",children:t.jsx("div",{className:"text-sm leading-6 text-zinc-500",children:a.description})}),t.jsxs(o.ModalFooter,{className:"grid grid-cols-2 gap-3 px-7 pb-7 pt-3",children:[t.jsx(p.Button,{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:a.cancel}),t.jsx(p.Button,{type:"button",size:"md",color:r,radius:"full",className:o.cn("h-10 text-sm font-normal text-white",r==="danger"?"bg-danger-600":"bg-brand"),isLoading:n,onPress:f,children:a.confirm})]})]})})}const gu=()=>({id:crypto.randomUUID(),fund:null,percentage:0});function Tn(e){return!e.fund&&Number(e.percentage||0)<=0}function yu({mode:e,assignments:a}){const s=a.filter(i=>i.fund),n=s.reduce((i,c)=>i+Number(c.percentage||0),0),r=a.some(i=>!i.fund||Number(i.percentage||0)<=0);return s.length>=1&&!r&&Math.round(n*100)/100===100}const vu={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"},Si={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"},zt={...Si,base:"min-h-11 rounded-2xl px-4 py-2 shadow-none",title:"text-sm font-medium"},ju={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"},wu={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 Nu(){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 Cu=e=>Number.isFinite(e)?Math.max(0,Math.min(100,Math.round(e*100)/100)):0,ku=e=>e.fund!==null;function Su({assignments:e,funds:a,labels:s,classNames:n,isSaving:r=!1,hasSavedAssignments:i=!1,showSavedIndicator:c=!1,isCollapsed:l,isFundPickerOpen:d=!1,activeAssignmentId:u=null,modalPortalContainer:f,footer:m,onAssignmentsChange:b,onOpenFundPicker:x,onCloseFundPicker:g,onCollapseChange:j,onSave:y}){const[v,C]=h.useState(null),S=f??v??void 0,k={...vu,...s},$=e.filter(V=>!Tn(V)),w=$.filter(ku).length>0,F=h.useMemo(()=>e.filter(V=>!Tn(V)).reduce((V,O)=>V+Number(O.percentage||0),0),[e]),A=Math.round(F*100)/100,M=$.some(V=>!V.fund||Number(V.percentage||0)<=0),E=w&&(A!==100||M),D=`${k.totalError} (${k.total} ${Number(F.toFixed(2))}%)`,I=yu({mode:"split",assignments:e}),B=w&&A>=100,[z,q]=h.useState(!1),[P,ee]=h.useState(!1),W=t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(Nu,{}),t.jsx("span",{className:"text-base font-medium leading-6 text-zinc-950",children:k.title}),c?t.jsx(o.Chip,{size:"sm",radius:"full",color:"success",variant:"flat",children:k.saved}):null]}),Y=(V,O)=>{b(e.map(Z=>Z.id===V?{...Z,...O}:Z))},K=()=>{B||b([...e,gu()])},ie=V=>{e.length<=1||b(e.filter(O=>O.id!==V))},te=()=>{if(!r){if(!I){ee(!0);return}if(!i){y();return}q(!0)}},Q=()=>{q(!1),y()},ne=V=>{const O=u??e.find(Z=>!Z.fund)?.id??e[0]?.id;O&&(b(e.map(Z=>Z.id===O?{...Z,fund:V}:Z)),g())};return t.jsxs("div",{ref:C,className:o.cn("vvt-pa relative min-w-0 w-full font-sans text-zinc-900 [container-type:inline-size]",d&&!f&&"min-h-[560px]",n?.root),children:[t.jsx(o.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:o.cn("w-full gap-0 px-0",n?.panel),itemClasses:{base:"w-full rounded-2xl border border-zinc-200 bg-white p-0 shadow-sm",trigger:o.cn("px-4 py-4",n?.header),title:"w-full",content:"w-full px-4 pb-4 pt-0",indicator:"text-zinc-500 [&>svg]:size-4"},onSelectionChange:V=>j?.(!(V==="all"||Array.from(V).length>0)),children:t.jsx(o.AccordionItem,{"aria-label":k.title,title:W,children:t.jsxs("div",{className:o.cn("flex w-full flex-col gap-4",n?.content),children:[t.jsxs("div",{className:"flex w-full flex-col gap-4",children:[!w&&t.jsx(o.Alert,{icon:t.jsx(p.Icon,{icon:"solar:info-circle-outline",className:"size-4"}),hideIconWrapper:!0,isClosable:!1,classNames:Si,color:"default",variant:"flat",title:k.emptySplit}),w&&t.jsx($u,{assignments:e,labels:k,total:F,hasTotalError:P&&!I||E,validationMessage:D,onSelectFund:V=>x(V),onRemoveFund:ie,onPercentageChange:(V,O)=>Y(V,{percentage:Cu(O)})}),t.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[t.jsx(p.Button,{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:B,onPress:()=>w?K():x(),children:k.assignSpecificFund}),t.jsx(p.Button,{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,{icon:"solar:cloud-upload-outline",className:"size-4"}),isLoading:r,isDisabled:!I||r,onPress:te,children:k.saveAssignment})]})]}),m]})},"installment-fund-assignment")}),d&&t.jsx(Au,{funds:a,labels:k,selectedFundIds:e.map(V=>V.fund?.id).filter(Boolean),portalContainer:S,onSelect:ne,onClose:g}),t.jsx(Is,{isOpen:z,labels:{title:k.modifyAssignedFundsTitle,description:t.jsxs(t.Fragment,{children:[t.jsx("p",{children:k.modifyAssignedFundsDescription}),t.jsx("p",{className:"mt-3",children:k.modifyAssignedFundsWarning})]}),cancel:k.modifyAssignedFundsCancel,confirm:k.modifyAssignedFundsConfirm},icon:t.jsx(p.Icon,{icon:"solar:info-circle-outline",className:"size-7"}),iconTone:"warning",confirmColor:"primary",portalContainer:S,shouldBlockScroll:!1,classNames:wu,onClose:()=>q(!1),onConfirm:Q})]})}function $u({assignments:e,labels:a,total:s,hasTotalError:n,validationMessage:r,onSelectFund:i,onRemoveFund:c,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:o.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(p.Button,{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(p.Button,{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:a.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(o.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:ju})}),e.length>1&&t.jsx(p.Button,{type:"button",isIconOnly:!0,variant:"flat",radius:"full",className:o.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:()=>c(d.id),"aria-label":a.removeFund,children:t.jsx(p.Icon,{icon:"solar:trash-bin-minimalistic-outline",className:"size-5"})})]},d.id)),t.jsx(o.Alert,{icon:t.jsx(p.Icon,{icon:n?"solar:info-circle-outline":"solar:check-circle-outline",className:"size-4"}),hideIconWrapper:!0,isClosable:!1,color:n?"warning":"success",variant:"flat",classNames:{...zt,base:o.cn(zt.base,n?"bg-warning-50 text-warning-700":"bg-success-50 text-success-700"),iconWrapper:o.cn(zt.iconWrapper,n?"text-warning-700":"text-success-700"),alertIcon:o.cn(zt.alertIcon,n?"text-warning-700":"text-success-700"),title:o.cn(zt.title,n?"text-warning-700":"text-success-700")},title:n?r:`${a.total} ${Number(s.toFixed(2))}%`})]})}function Au({funds:e,labels:a,selectedFundIds:s,portalContainer:n,onSelect:r,onClose:i}){const[c,l]=h.useState(""),d=e.filter(u=>{if(s.includes(u.id))return!1;const f=c.trim().toLowerCase();return f?`${u.glCode} ${u.accountName} ${u.type}`.toLowerCase().includes(f):!0});return t.jsx(p.Modal,{isOpen:!0,size:"3xl",placement:"center",scrollBehavior:"inside",shouldBlockScroll:!1,portalContainer:n,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(o.ModalContent,{className:"max-h-full",children:[t.jsx(o.ModalHeader,{className:"px-6 pr-12 pt-6 text-xl font-semibold leading-7 text-zinc-950",children:a.modalTitle}),t.jsxs(o.ModalBody,{className:"flex min-h-0 flex-1 flex-col px-6 pb-6",children:[t.jsx(o.Input,{variant:"bordered","aria-label":a.searchPlaceholder,value:c,placeholder:a.searchPlaceholder,onChange:u=>l(u.target.value),startContent:t.jsx(p.Icon,{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:a.glCode}),t.jsx("span",{children:a.accountName}),t.jsx("span",{children:a.actions})]}),d.length===0&&t.jsx("div",{className:"p-4 text-sm text-zinc-500",children:a.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(p.Button,{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:a.select})]},u.id))]})]})]})})}function Du(){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(p.Skeleton,{className:"h-7 w-56 rounded-lg"}),t.jsx(p.Skeleton,{className:"size-8 rounded-full"})]}),t.jsxs("div",{className:"flex items-center justify-between gap-3",children:[t.jsx(p.Skeleton,{className:"h-10 w-72 rounded-full"}),t.jsx(p.Skeleton,{className:"h-10 w-40 rounded-full"})]}),t.jsxs("div",{className:"grid grid-cols-[minmax(0,1fr)_160px] items-center gap-4 rounded-2xl border border-zinc-100 p-3",children:[t.jsx(p.Skeleton,{className:"h-8 w-full max-w-xs rounded-full"}),t.jsx(p.Skeleton,{className:"h-8 w-full rounded-xl"})]}),t.jsx(p.Skeleton,{className:"h-11 w-40 rounded-full"})]})}const Eu={totalAmount:"Total Amount:",remainingBalance:"Remaining Balance",amountReceived:"Amount Received:"};function Lu({totalAmount:e,remainingBalance:a,amountReceived:s,currency:n="USD",locale:r="en-US",labels:i,className:c}){const l={...Eu,...i},d=new Intl.NumberFormat(r,{style:"currency",currency:n});return t.jsx("div",{className:o.cn("w-full rounded-2xl border border-zinc-200 bg-white px-4 py-2.5 font-sans text-base leading-6",c),children:t.jsxs("div",{className:"flex w-full flex-wrap items-center gap-x-5 gap-y-2",children:[t.jsx(qa,{label:l.totalAmount,value:d.format(e)}),t.jsx(qa,{label:l.remainingBalance,value:d.format(a)}),t.jsx(qa,{label:l.amountReceived,value:d.format(s)})]})})}function qa({label:e,value:a}){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:a})]})}const Fu={monthly:1,quarterly:3,annual:12},$i=e=>{const[a,s,n]=e.split("-").map(Number);return{year:a,month:s,day:n}},_u=(e,a)=>new Date(e,a+1,0).getDate(),Ru=e=>{const a=e.getFullYear(),s=String(e.getMonth()+1).padStart(2,"0"),n=String(e.getDate()).padStart(2,"0");return`${a}-${s}-${n}`},Iu=(e,a)=>{const{year:s,month:n,day:r}=$i(e),i=n-1+a,c=s+Math.floor(i/12),l=(i%12+12)%12,d=Math.min(r,_u(c,l));return new Date(c,l,d)},Mu=(e,a)=>{const{year:s,month:n,day:r}=$i(e),i=new Date(s,n-1,r);return i.setDate(i.getDate()+a),i};function Ai(e,a){const s=Math.max(1,Math.floor(a.numberOfInstallments||1)),n=Math.round(e*100),r=Math.floor(n/s),i=n-r*s,c=Fu[a.frequency];return Array.from({length:s},(l,d)=>{const u=a.frequency==="weekly"?Mu(a.firstInstallmentDate,d*7):Iu(a.firstInstallmentDate,d*(c??1));return{id:crypto.randomUUID(),dueDate:Ru(u),amount:(r+(d===0?i:0))/100}})}function Bu(e){return new Set(e.map((a,s)=>{const n=e[s+1]?.dueDate;return a.dueDate&&n&&a.dueDate>n?a.id:null}).filter(a=>!!a))}function Pu(e){return{missingDateRows:new Set(e.filter(a=>!a.dueDate).map(a=>a.id)),invalidDateRows:Bu(e),invalidAmountRows:new Set(e.filter(a=>Number(a.amount||0)<=0).map(a=>a.id))}}function Tu(e){return e.missingDateRows.size>0||e.invalidDateRows.size>0||e.invalidAmountRows.size>0}function Ou(e,a){const s=e[0];return!s||!a||s.dueDate===a?e:[{...s,dueDate:a},...e.slice(1)]}const zu=new Set(["paid","partially_refunded","refunded"]);function wt(e){return e!==void 0&&zu.has(e)}const Vu={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."},Uu=["weekly","monthly","quarterly","annual"],Hu=Array.from({length:31},(e,a)=>a+1),Wu=["numberOfInstallments","frequency","firstInstallmentDate"],On=()=>({id:crypto.randomUUID(),dueDate:new Date().toISOString().slice(0,10),amount:0}),ja=e=>Math.round(e*100)/100,qu=(e,a)=>{const s=new Date(`${e}T00:00:00`);return Number.isNaN(s.getTime())?e:new Intl.DateTimeFormat(a,{month:"short",day:"numeric",year:"numeric"}).format(s)},Ea=e=>{if(!e)return null;try{return Ec(e)}catch{return null}},Gu=e=>Ea(e)?.day??1,Ku=(e,a)=>new Date(e,a,0).getDate(),Yu=(e,a)=>{const s=Ea(e);if(!s)return e;const n=Math.min(a,Ku(s.year,s.month));return s.set({day:n}).toString()},zn=e=>{const a=e%100>=11&&e%100<=13?"th":e%10===1?"st":e%10===2?"nd":e%10===3?"rd":"th";return`${e}${a}`};function Zu({mode:e,donationAmount:a,currency:s="USD",locale:n="en-US",installments:r,automaticSettings:i,defaultTab:c="automatic",showTitle:l=!0,showCard:d=!0,showSavePayment:u=!0,showTabs:f=!0,inputs:m=Wu,startDate:b,firstInstallmentDateOverride:x,labels:g,classNames:j,isSaving:y=!1,showSavedIndicator:v=!1,isModeSwitchDisabled:C=!1,onModeChange:S,onAutomaticSettingsChange:k,onInstallmentsChange:$,onSave:_,onCancel:w}){const[F,A]=h.useState(c),M={...Vu,...g},E=e??F,D=h.useMemo(()=>new Intl.NumberFormat(n,{style:"currency",currency:s}),[s,n]),I=h.useMemo(()=>({...i,firstInstallmentDate:m.includes("firstInstallmentDate")?i.firstInstallmentDate:m.includes("dayOfMonth")?i.firstInstallmentDate||b||"":b||i.firstInstallmentDate}),[i,m,b]),B=E==="automatic"?Ou(Ai(a,I),m.includes("firstInstallmentDate")?void 0:x):r,z=h.useMemo(()=>ja(B.reduce((Z,Re)=>Z+Number(Re.amount||0),0)),[B]),q=Math.abs(z-a)>.009,P=ja(a-z)<=0,ee=h.useMemo(()=>Pu(r),[r]),W=E==="manual"&&Tu(ee),Y=q||W,K=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}),v?t.jsx(o.Chip,{size:"sm",radius:"full",color:"success",variant:"flat",children:M.saved}):null]}):void 0,ie=Z=>{Z!==E&&(e||A(Z),S?.(Z),Z==="manual"&&r.length===0&&$([On()]))},te=(Z,Re)=>{const De=r.find(Ee=>Ee.id===Z);wt(De?.status)||$(r.map(Ee=>Ee.id===Z?{...Ee,...Re}:Ee))},Q=()=>{$([...r,On()])},ne=Z=>{const Re=r.find(De=>De.id===Z);wt(Re?.status)||$(r.filter(De=>De.id!==Z))},V=()=>{y||Y||_?.()},O=t.jsxs("div",{className:o.cn("flex w-full flex-col gap-4",j?.content),children:[f||u||w?t.jsxs("div",{className:"flex w-full items-center justify-between gap-6",children:[f?t.jsx(Qu,{mode:E,labels:M,onModeChange:ie,isDisabled:C,className:j?.tabs}):null,t.jsxs("div",{className:"ml-auto flex items-center gap-3",children:[w?t.jsx(p.Button,{type:"button","data-testid":"installment-schedule-cancel-button",size:"md",variant:"bordered",radius:"full",className:"min-w-28",isDisabled:y,onPress:w,children:M.cancelEdit}):null,u?t.jsx(p.Button,{type:"button","data-testid":"installment-schedule-save-button",size:"md",color:"primary",radius:"full",className:"min-w-36",startContent:y?void 0:t.jsx(p.Icon,{icon:"solar:cloud-upload-outline",className:"size-4"}),isLoading:y,isDisabled:y||Y,onPress:V,children:M.saveInstallments}):null]})]}):null,t.jsxs("div",{className:o.cn("flex w-full flex-col gap-4",j?.preview),children:[E==="automatic"&&t.jsx(Xu,{settings:I,inputs:m,labels:M,className:j?.controls,onSettingsChange:k}),B.length===0&&t.jsx(o.Alert,{isClosable:!1,color:"default",variant:"flat",radius:"full",title:E==="automatic"?M.emptyAutomatic:M.emptyManual}),B.length>0&&t.jsx(Ju,{mode:E,installments:B,rowErrors:ee,labels:M,formatter:D,locale:n,onUpdateInstallment:te,onRemoveInstallment:ne}),E==="manual"&&t.jsx("div",{className:"flex flex-wrap gap-3",children:t.jsx(p.Button,{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:P,onPress:Q,children:M.addInstallment})}),t.jsx(sm,{total:z,donationAmount:a,hasTotalMismatch:q,mode:E,installments:B,formatter:D,labels:M,className:j?.summary})]})]});return t.jsx("div",{className:o.cn("vvt-ps relative font-sans text-zinc-900",j?.root),children:d?t.jsx(o.Accordion,{variant:"splitted",defaultSelectedKeys:["installment-schedule"],className:o.cn("w-full gap-0 px-0",j?.panel),itemClasses:{base:"w-full rounded-2xl border border-zinc-200 bg-white p-0 shadow-sm",trigger:o.cn("px-4 py-4",j?.header),title:"w-full",content:"w-full px-4 pb-4 pt-0",indicator:"text-zinc-500 [&>svg]:size-4"},children:t.jsx(o.AccordionItem,{"aria-label":M.title,title:K,children:O},"installment-schedule")}):O})}function Qu({mode:e,labels:a,className:s,isDisabled:n=!1,onModeChange:r}){return t.jsxs(o.Tabs,{"aria-label":a.title,selectedKey:e,isDisabled:n,color:"primary",size:"lg",radius:"full",className:o.cn("w-fit",s),onSelectionChange:i=>r(i),children:[t.jsx(o.Tab,{title:a.automaticMode},"automatic"),t.jsx(o.Tab,{title:a.manualMode},"manual")]})}function Xu({settings:e,inputs:a,labels:s,className:n,onSettingsChange:r}){const i=c=>{if(c==="numberOfInstallments")return t.jsx("div",{className:"min-w-0",children:t.jsx(o.Input,{variant:"bordered",label:s.numberOfInstallments,labelPlacement:"outside",type:"number",min:1,step:1,value:e.numberOfInstallments>0?String(e.numberOfInstallments):"",onWheel:l=>l.currentTarget.blur(),onChange:l=>{const d=l.target.value;r({...e,numberOfInstallments:d===""?0:Math.max(1,Number(d))})}})},c);if(c==="frequency")return t.jsx("div",{className:"min-w-0",children:t.jsx(p.Select,{variant:"bordered",label:s.frequency,labelPlacement:"outside",selectedKeys:[e.frequency],onSelectionChange:l=>{const d=Array.from(l)[0];typeof d=="string"&&r({...e,frequency:d})},children:Uu.map(l=>t.jsx(o.SelectItem,{textValue:s[l],children:s[l]},l))})},c);if(c==="dayOfMonth"){const l=String(Gu(e.firstInstallmentDate));return t.jsx("div",{className:"min-w-0",children:t.jsx(p.Select,{variant:"bordered",label:s.dayOfMonth,labelPlacement:"outside",selectedKeys:[l],onSelectionChange:d=>{const u=Number(Array.from(d)[0]);Number.isFinite(u)&&r({...e,firstInstallmentDate:Yu(e.firstInstallmentDate,u)})},children:Hu.map(d=>t.jsx(o.SelectItem,{textValue:zn(d),children:zn(d)},String(d)))})},c)}return t.jsx("div",{className:"min-w-0",children:t.jsx(ks,{variant:"bordered",label:s.firstInstallmentDate,labelPlacement:"outside",value:Ea(e.firstInstallmentDate),onChange:l=>r({...e,firstInstallmentDate:l?l.toString():""}),startContent:t.jsx(p.Icon,{icon:"solar:calendar-outline",className:"size-4 text-zinc-500"})})},c)};return a.length===0?null:t.jsx("div",{className:o.cn("grid gap-4",n),style:{gridTemplateColumns:"repeat(auto-fit, minmax(min(100%, 14rem), 1fr))"},children:a.map(i)})}function Ju({mode:e,installments:a,rowErrors:s,labels:n,formatter:r,locale:i,onUpdateInstallment:c,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:o.cn("flex flex-col gap-3",a.length>5&&"max-h-[264px] overflow-y-auto pr-2"),children:a.map((d,u)=>t.jsxs("div",{className:o.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:qu(d.dueDate,i)}),u===0&&a.length>1&&t.jsx(o.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:a.map((d,u)=>{const f=s.missingDateRows.has(d.id),m=s.invalidDateRows.has(d.id),b=s.invalidAmountRows.has(d.id);return t.jsx("div",{className:"flex w-full flex-col gap-1",children:t.jsxs("div",{className:"grid w-full grid-cols-[2rem_minmax(0,1fr)_minmax(0,1fr)_2.25rem] items-start gap-4",children:[t.jsx("span",{className:"pt-2 text-sm font-medium text-zinc-500",children:u+1}),t.jsx("div",{className:"min-w-0 flex-1",children:t.jsx(ks,{variant:"bordered","aria-label":`${n.dueDate} ${u+1}`,isDisabled:wt(d.status),isInvalid:f||m,errorMessage:f?n.dueDateRequiredError:m?n.dateOrderError:void 0,value:Ea(d.dueDate),onChange:x=>c(d.id,{dueDate:x?x.toString():""})})}),t.jsx("div",{className:"min-w-0 flex-1",children:t.jsx(tm,{amount:d.amount,ariaLabel:`${n.amount} ${u+1}`,isDisabled:wt(d.status),isInvalid:b,errorMessage:n.amountGreaterThanZeroError,onAmountChange:x=>c(d.id,{amount:x})})}),t.jsx(am,{isDisabled:a.length<=1,isPaid:wt(d.status),label:n.deleteInstallment,onRemove:()=>l(d.id)})]})},d.id)})})}const em=/^\d*(?:[.,]\d{0,2})?$/;function tm({amount:e,ariaLabel:a,isDisabled:s,isInvalid:n,errorMessage:r,onAmountChange:i}){const[c,l]=h.useState(null);return t.jsx(o.Input,{variant:"bordered","aria-label":a,type:"text",inputMode:"decimal",autoComplete:"off",isDisabled:s,isInvalid:n,errorMessage:n?r:void 0,value:c??(e?String(e):""),onChange:d=>{const u=d.target.value.trim();if(!em.test(u))return;l(u);const f=Number(u.replace(",","."));i(ja(Number.isFinite(f)?f:0))},onBlur:()=>l(null),startContent:t.jsx("span",{className:"text-zinc-900",children:"$"})})}function am({isDisabled:e,isPaid:a,label:s,onRemove:n}){const r=t.jsx(p.Button,{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||a,onPress:n,"aria-label":s,children:t.jsx(p.Icon,{icon:"solar:trash-bin-minimalistic-outline",className:"size-5"})});return a?t.jsx(o.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 sm({total:e,donationAmount:a,hasTotalMismatch:s,mode:n,installments:r,formatter:i,labels:c,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),b=ja(a-e),x=Math.max(b,0),g=Math.max(-b,0),j=s?t.jsxs("span",{children:[c.totalError,". Total scheduled: ",t.jsx("strong",{children:i.format(e)})," /"," ",t.jsx("strong",{children:i.format(a)}),"."]}):n==="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(a)}),"."]}),y=n==="automatic"?`Total: ${i.format(e)}`:g>0?`Exceeds by: ${i.format(g)}`:`${c.remaining}: ${i.format(x)}`;return t.jsx(o.Alert,{isClosable:!1,color:s?"danger":"default",variant:"flat",radius:"full",className:l,endContent:t.jsx("span",{className:"whitespace-nowrap",children:y}),title:j})}function nm(){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(p.Skeleton,{className:"h-7 w-56 rounded-lg"}),t.jsx(p.Skeleton,{className:"size-8 rounded-full"})]}),t.jsxs("div",{className:"flex items-center justify-between gap-3",children:[t.jsx(p.Skeleton,{className:"h-10 w-72 rounded-full"}),t.jsx(p.Skeleton,{className:"h-10 w-40 rounded-full"})]}),t.jsxs("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-end sm:justify-between",children:[t.jsxs("div",{className:"flex w-full max-w-[280px] flex-col gap-2",children:[t.jsx(p.Skeleton,{className:"h-4 w-36 rounded-md"}),t.jsx(p.Skeleton,{className:"h-9 w-full rounded-xl"})]}),t.jsx(p.Skeleton,{className:"h-9 w-36 rounded-full"})]}),t.jsx("div",{className:"flex flex-col gap-3",children:Array.from({length:4}).map((e,a)=>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(p.Skeleton,{className:"h-8 w-full max-w-xs rounded-full"}),t.jsx(p.Skeleton,{className:"h-8 w-full rounded-xl"})]},a))})]})}const Vn={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"},Di={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"},rm={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:Di.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."},im={wrapper:"!absolute !inset-0 !z-50 !items-center !justify-center !p-4",backdrop:"!absolute !inset-0 !z-40 rounded-2xl"},lm=[];function om({installments:e,currency:a,locale:s="en-US",showTitle:n=!0,showCard:r=!0,showEditPayment:i=!0,showDelete:c=!0,payNowHiddenStatuses:l=lm,showSavedIndicator:d=!1,labels:u,isSaving:f=!1,onEditInstallments:m,onPayInstallment:b,onDeleteInstallment:x}){const[g,j]=h.useState(null),y={...rm,...u},[v,C]=h.useState(""),S=new Intl.NumberFormat(s,{style:"currency",currency:a}),k=e.some(A=>Ei(A)!==null),$=e.some(A=>A.status==="partially_refunded"),_=n?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:y.title}),d?t.jsx(o.Chip,{size:"sm",radius:"full",color:"success",variant:"flat",children:y.saved}):null]}):void 0,w=h.useMemo(()=>{const A=v.trim().toLowerCase();if(!A)return e;const M=new Intl.NumberFormat(s,{style:"currency",currency:a});return e.filter(E=>{const D=E.status??"scheduled";return[Ga(E),E.id,E.amount,E.dueDate,xa(E.dueDate,s),Ka(E,y.paidOn,s),Ya(E,y.refundedAmount,M),D,Za(D,y.partiallyRefunded)].join(" ").toLowerCase().includes(A)})},[s,a,e,v,y.paidOn,y.refundedAmount,y.partiallyRefunded]),F=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:y.searchLabel}),t.jsx(o.Input,{variant:"bordered",size:"md",value:v,placeholder:y.searchPlaceholder,onChange:A=>C(A.target.value),startContent:t.jsx(p.Icon,{icon:"solar:magnifer-outline",className:"size-4 text-zinc-500"})})]}),i?t.jsx(p.Button,{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,{icon:"solar:pen-outline",className:"size-4"}),isLoading:f,onPress:m,children:y.editInstallments}):null]}),t.jsx("div",{className:o.cn("hidden [@container(max-width:767px)]:block",w.length>3&&"max-h-[560px] overflow-y-auto pr-1"),children:t.jsxs("div",{className:"flex flex-col gap-2",children:[w.map((A,M)=>{const E=A.status??"scheduled",D=Ga(A),I=Ka(A,y.paidOn,s),B=Ya(A,y.refundedAmount,S);return t.jsx(o.Card,{radius:"lg",shadow:"none",className:"border border-default-200",children:t.jsxs(o.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:D||`PMT-${M+1}`})]}),t.jsx(Un,{status:E,label:Za(E,y.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:y.amount}),t.jsx("p",{className:"font-medium text-foreground",children:S.format(A.amount)}),B?t.jsx("p",{className:"text-xs text-default-500",children:B}):null]}),t.jsxs("div",{className:"text-right",children:[t.jsx("p",{className:"text-xs text-default-500",children:y.scheduledDate}),t.jsx("p",{className:"font-medium text-foreground",children:xa(A.dueDate,s)}),I?t.jsx("p",{className:"text-xs text-default-500",children:I}):null]})]}),t.jsx(Hn,{status:E,installment:A,labels:y,portalContainer:g??void 0,showDelete:c,payNowHiddenStatuses:l,onPayInstallment:b,onDeleteInstallment:x})]})},A.id)}),w.length===0&&t.jsx("div",{className:"rounded-lg border border-default-200 px-4 py-6 text-center text-sm text-default-500",children:y.noInstallmentsFound})]})}),t.jsx("div",{className:o.cn("w-full overflow-x-hidden [@container(max-width:767px)]:hidden",w.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:k?"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:y.installmentId}),t.jsx("th",{className:"px-2 py-3 font-medium",children:y.amount}),t.jsx("th",{className:"px-2 py-3 font-medium",children:y.scheduledDate}),t.jsx("th",{className:"whitespace-nowrap px-2 py-3 font-medium",children:y.status}),t.jsx("th",{className:"whitespace-nowrap py-3 pl-4 pr-2 font-medium",children:y.actions})]})}),t.jsxs("tbody",{children:[w.map((A,M)=>{const E=A.status??"scheduled",D=Ga(A),I=Ka(A,y.paidOn,s),B=Ya(A,y.refundedAmount,S);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:D||`PMT-${M+1}`})}),t.jsxs("td",{className:"px-2 py-3",children:[S.format(A.amount),B?t.jsx("span",{className:"block text-xs",children:B}):null]}),t.jsxs("td",{className:"px-2 py-3",children:[xa(A.dueDate,s),I?t.jsx("span",{className:"block text-xs",children:I}):null]}),t.jsx("td",{className:"whitespace-nowrap px-2 py-3",children:t.jsx(Un,{status:E,label:Za(E,y.partiallyRefunded)})}),t.jsx("td",{className:"whitespace-nowrap py-3 pl-4 pr-2",children:t.jsx(Hn,{status:E,installment:A,labels:y,portalContainer:g??void 0,showDelete:c,payNowHiddenStatuses:l,onPayInstallment:b,onDeleteInstallment:x})})]},A.id)}),w.length===0&&t.jsx("tr",{children:t.jsx("td",{colSpan:6,className:"px-2 py-6 text-center text-zinc-500",children:y.noInstallmentsFound})})]})]})})]});return t.jsx("div",{ref:j,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(o.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(o.AccordionItem,{"aria-label":y.title,title:_,children:F},"installment-table")}):F})}function Ga(e){return e.name?.trim()||e.id}function Ka(e,a,s){return!wt(e.status)||!e.fulfilledAt?null:`${a} ${xa(e.fulfilledAt,s)}`}function Ei(e){const{refundedAmount:a}=e;return e.status!=="partially_refunded"||typeof a!="number"||!Number.isFinite(a)||a<=0?null:a}function Ya(e,a,s){const n=Ei(e);return n===null?null:`${a} ${s.format(n)}`}function Za(e,a){return e==="partially_refunded"?a:Di[e]??e}function Un({status:e,label:a}){return t.jsx(o.Chip,{size:"md",radius:"lg",className:o.cn("justify-center px-4",Vn[e]??Vn.scheduled),startContent:t.jsx(dm,{status:e}),children:a})}function Hn({status:e,installment:a,labels:s,portalContainer:n,showDelete:r,payNowHiddenStatuses:i,onPayInstallment:c,onDeleteInstallment:l}){const d=!i.includes(e),u=wt(e);return t.jsxs("div",{className:"flex min-w-36 items-center justify-start gap-2",children:[d?t.jsx(p.Button,{type:"button",size:"md",color:"primary",variant:"solid",radius:"full",className:"min-w-[104px] shrink-0",isDisabled:u,startContent:t.jsx(p.Icon,{icon:"solar:dollar-minimalistic-outline",className:"size-4"}),onPress:()=>c?.(a),children:s.payNow}):null,t.jsx(cm,{isFulfilled:u,showDelete:r,labels:s,portalContainer:n,onDelete:()=>l(a.id)})]})}function cm({isFulfilled:e,showDelete:a,labels:s,portalContainer:n,onDelete:r}){const[i,c]=h.useState(!1);return t.jsxs(t.Fragment,{children:[t.jsxs(o.Dropdown,{placement:"bottom-end",radius:"lg",children:[t.jsx(o.DropdownTrigger,{children:t.jsx(p.Button,{type:"button",isIconOnly:!0,size:"sm",variant:"light",className:"text-zinc-900","aria-label":"More actions",children:t.jsx(p.Icon,{icon:"solar:menu-dots-bold",className:"size-4"})})}),t.jsxs(o.DropdownMenu,{"aria-label":"Installment actions",disabledKeys:e?["send-link","delete"]:[],className:"w-72 p-2",onAction:l=>{l==="delete"&&a&&!e&&c(!0)},children:[t.jsx(o.DropdownSection,{title:"Actions",showDivider:a,children:t.jsx(o.DropdownItem,{textValue:s.sendLink,description:s.sendLinkDescription,startContent:t.jsx(p.Icon,{icon:"solar:link-outline",className:"size-5 text-zinc-500"}),children:s.sendLink},"send-link")}),a?t.jsx(o.DropdownSection,{title:s.dangerZone,children:t.jsx(o.DropdownItem,{textValue:s.deleteInstallment,className:"text-danger-600",color:"danger",description:s.deleteInstallmentDescription,startContent:t.jsx(p.Icon,{icon:"solar:trash-bin-minimalistic-outline",className:"size-5"}),children:s.deleteInstallment},"delete")}):null]})]}),a?t.jsx(Is,{isOpen:i,labels:{title:s.deleteInstallmentConfirmationTitle,description:s.deleteInstallmentConfirmationDescription,cancel:s.deleteInstallmentConfirmationCancel,confirm:s.deleteInstallmentConfirmationConfirm},icon:t.jsx(p.Icon,{icon:"solar:danger-triangle-outline",className:"size-7"}),confirmColor:"danger",portalContainer:n,shouldBlockScroll:!1,classNames:im,onClose:()=>c(!1),onConfirm:()=>{c(!1),r()}}):null]})}function dm({status:e}){return e==="paid"?t.jsx(p.Icon,{icon:"solar:check-circle-bold",className:"size-3"}):e==="failed"?t.jsx(p.Icon,{icon:"solar:close-circle-bold",className:"size-3"}):e==="partially_refunded"?t.jsx(p.Icon,{icon:"solar:undo-left-round-bold",className:"size-3"}):e==="processing"?t.jsx(p.Icon,{icon:"solar:refresh-circle-bold",className:"size-3"}):e==="pending_confirmation"?t.jsx(p.Icon,{icon:"solar:clock-circle-bold",className:"size-3"}):t.jsx(p.Icon,{icon:"solar:calendar-outline",className:"size-3"})}const um=/^\d{4}-\d{2}-\d{2}$/;function xa(e,a){const s=um.test(e)?new Date(`${e}T00:00:00`):new Date(e);return Number.isNaN(s.getTime())?e:new Intl.DateTimeFormat(a,{month:"short",day:"numeric",year:"numeric"}).format(s)}const mm={title:"Select Membership",renewalTitle:"Automatic Renewal",renewalDescription:"Membership will automatically renew at the end of each period"},fm=({cards:e,locale:a,currency:s,listHeightClassName:n="",labels:r,showRenewal:i=!0,defaultRenewalValue:c=!1,initialSelectedMembershipId:l=null,allowReselect:d=!0,onRenewalChange:u,onCardSelect:f,className:m=""})=>{const b=Array.isArray(e)?e:[],[x,g]=h.useState(l),[j,y]=h.useState(c),v={...mm,...r};h.useEffect(()=>{g(l)},[l]);const C=k=>{if(k===x){d&&f?.(k);return}g(k),f?.(k)},S=k=>{y(k),u?.(k)};return t.jsxs("div",{className:o.cn("w-full flex flex-col gap-4 items-start p-4 h-svh",m),"data-testid":"membership-select-cards",children:[t.jsx("span",{className:"hidden","data-testid":"membership-select-cards-selected-id",children:x??""}),t.jsx("p",{className:"text-2xl font-semibold text-left","data-testid":"membership-select-cards-title",children:v.title}),i&&t.jsx(Mi,{title:v.renewalTitle,description:v.renewalDescription,value:j,onValueChange:S}),t.jsx("div",{className:o.cn("w-full min-h-0 flex flex-col gap-4 overflow-y-auto",n===""?"flex-1":o.cn("shrink-0",n)),"data-testid":"membership-select-cards-list",children:b.map(k=>t.jsx(Li,{itemKey:k.id,name:k.name,type:k.type,price:k.price,locale:a,currency:s,isSelected:x===k.id,onSelect:C},k.id))})]})},Li=({itemKey:e,name:a,type:s,price:n,locale:r="en-US",currency:i="USD",showPrice:c=!0,isSelected:l=!1,onSelect:d,compact:u=!1,isDisabled:f=!1,disabledReason:m,statusLabel:b,statusTone:x="default",className:g=""})=>{const j=new Intl.NumberFormat(r,{style:"currency",currency:i,minimumFractionDigits:0,maximumFractionDigits:2}).format(n),y=!!d&&!f,v=m||b,C=()=>{y&&d?.(e)};return t.jsx(o.Card,{shadow:"none",isPressable:!!d,onPress:C,className:o.cn("w-full min-h-fit border rounded-3xl",l?"border-primary bg-primary/5":"border-default",f?"opacity-60":"",u?"rounded-2xl":"",g),"data-testid":"item-card","data-selected":l,isDisabled:f,children:t.jsxs("div",{className:o.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:o.cn("font-semibold text-left",u?"text-sm":"text-xl"),"data-testid":"item-card-name",children:a}),s&&t.jsx("div",{"data-testid":"item-card-type",className:"w-fit bg-default-300 px-4 py-2 text-sm rounded-xl",children:t.jsx("p",{className:"text-center",children:s})}),v&&t.jsx(o.Chip,{"data-testid":"item-card-status",color:x,size:"sm",variant:"flat",className:"px-2",children:v})]}),c&&t.jsx("p",{className:o.cn("font-semibold text-right",u?"text-lg":"text-2xl"),"data-testid":"item-card-price",children:j})]})})},Wn="w-full bg-gray-100",qn={variant:"light",color:"default"},Fi=({id:e,title:a,media:s,imageUrl:n,imageAlt:r,imageClassName:i="",imageAspect:c="aspect-[4/3]",meta:l=[],price:d,action:u,footer:f,onPress:m,isPressable:b=!1,isDisabled:x=!1,compact:g=!1,className:j="",bodyClassName:y="",footerClassName:v="",dataTestId:C})=>{const S=!!(d&&d.value),k=!!u?.label,$=b&&!!m&&!k,_=!$,w=k?{variant:u?.variant??qn.variant,color:u?.color??qn.color,size:u?.size??"sm",isDisabled:x||u?.isDisabled,startContent:u?.icon?t.jsx(p.Icon,{icon:u.icon,width:16}):void 0}:null,F=s??(n?t.jsx("div",{className:o.cn("relative overflow-hidden rounded-xl",c,Wn,i),children:t.jsx(o.Image,{removeWrapper:!0,src:n,alt:r||a,className:"size-full object-cover",classNames:{wrapper:"absolute inset-0"}})}):t.jsx("div",{className:o.cn("relative overflow-hidden rounded-xl",c,Wn,"grid place-items-center",i),"data-testid":`catalog-item-card-${e??"media"}-fallback`,children:t.jsx(p.Icon,{icon:"solar:ticket-outline",width:48,className:"text-default-400"})}));return t.jsxs(o.Card,{"data-testid":C||`catalog-item-card-${e??"item"}`,className:o.cn("w-full overflow-hidden",j),isPressable:$,onPress:m,isDisabled:x,shadow:"sm",radius:"lg",children:[t.jsx("div",{children:F}),t.jsxs(o.CardBody,{className:o.cn("gap-3",g?"p-3":"p-4",y),children:[t.jsx("h3",{"data-testid":`catalog-item-card-title-${e??""}`,className:o.cn("line-clamp-2 text-base font-semibold text-gray-900",g?"text-sm":""),children:a}),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((A,M)=>t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(p.Icon,{icon:A.icon,className:"size-4 text-gray-400",width:16}),t.jsx("span",{children:A.label})]},`${A.label}-${M}`))}):null,(S||k)&&t.jsxs("div",{className:o.cn("flex items-center justify-end gap-2 pt-1 text-sm",g?"pt-0.5":"",v),children:[S?t.jsxs("span",{className:o.cn("mr-auto text-gray-500",g?"text-xs":""),"data-testid":`catalog-item-card-price-${e??""}`,children:[d?.label&&t.jsxs("span",{children:[d.label," "]}),t.jsx("span",{className:"font-semibold text-brand",children:d?.value})]}):t.jsx("span",{className:"ml-auto","aria-hidden":!0}),k&&_?t.jsx(p.Button,{className:o.cn("rounded-full",u?.className),onPress:u?.onPress,variant:w?.variant,color:w?.color,size:w?.size,startContent:w?.startContent,isDisabled:w?.isDisabled,"aria-label":u?.ariaLabel||u?.label,children:u?.label}):null]}),f?t.jsx("div",{className:"pt-1",children:f}):null]})]})};Fi.displayName="CatalogItemCard";const xm={open:"Open","selling-fast":"Selling fast","sold-out":"Sold out"};function _i({title:e,subtitle:a,price:s,imageUrl:n,status:r,isDisabled:i=!1,onPress:c,className:l}){return t.jsx(o.Card,{isPressable:!!c,isDisabled:i,onPress:c,shadow:"none",radius:"lg",className:o.cn("w-full border border-pos-hair",l),children:t.jsxs(o.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:n?t.jsx(o.Image,{removeWrapper:!0,src:n,alt:"",className:"size-full object-cover"}):t.jsx(p.Icon,{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:a})]}),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:xm[r]}):null,s?t.jsxs("strong",{className:"ml-5 whitespace-nowrap text-xl",children:["from ",s]}):null]})})}_i.displayName="ProgramListItem";const pm={card:"gap-3 rounded-xl border border-dashed px-6 py-12",panel:"px-6 py-[72px]"},hm={card:"size-12 rounded-2xl",panel:"size-[76px] rounded-[20px] border mb-[18px]"},bm={card:"text-base font-medium text-default-900",panel:"text-[17px] font-semibold text-acct-ink"},gm={card:"max-w-sm text-sm text-default-600",panel:"max-w-[380px] text-sm text-acct-sub mt-1.5"},ym={card:"text-xs text-default-500",panel:"text-xs text-acct-sub mt-2"},vm={card:"mt-1",panel:"mt-[22px]"},jm="bg-acct-page border-acct-border text-acct-muted",wm={empty:"solar:inbox-line-duotone",error:"solar:danger-triangle-outline",success:"solar:check-circle-bold"},Nm={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"},Cm={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"},km={empty:"status",error:"alert",success:"status",loading:"status"},Sm={empty:"polite",error:"assertive",success:"polite",loading:"polite"};function $m(e,a,s,n){if(a===!1)return null;if(e==="loading"&&a===void 0)return t.jsx(o.Spinner,{size:"lg",color:"primary",className:n.spinner});if(h.isValidElement(a))return t.jsx(t.Fragment,{children:a});const r=typeof a=="string"?a:wm[e];return r?t.jsx(p.Icon,{icon:r,width:s,height:s,"aria-hidden":"true",className:n.icon}):null}function Ri({variant:e="empty",surface:a="card",title:s,titleAs:n="p",description:r,icon:i,actions:c,role:l=km[e],ariaLive:d=Sm[e],iconSize:u=24,className:f,classNames:m={},"data-testid":b="feedback-state",referenceCode:x,referenceCodeLabel:g="Reference code:"}){const j=$m(e,i,u,m);return t.jsxs("div",{role:l,"aria-live":d,"data-variant":e,"data-testid":b,"data-surface":a,className:o.cn("flex flex-col items-center justify-center text-center",pm[a],a==="card"?Nm[e]:"bg-transparent",f,m.base),children:[j?t.jsx("span",{"aria-hidden":"true","data-testid":`${b}-icon`,className:o.cn("inline-flex items-center justify-center",hm[a],e==="success"&&a==="card"&&"rounded-full",a==="panel"?jm:Cm[e],m.iconWrapper),children:j}):null,t.jsxs("div",{className:o.cn("flex flex-col items-center",a==="card"&&"gap-1"),children:[t.jsx(n,{"data-testid":`${b}-title`,className:o.cn(bm[a],m.title),children:s}),r?t.jsx("p",{"data-testid":`${b}-description`,className:o.cn(gm[a],m.description),children:r}):null,x?t.jsxs("p",{"data-testid":`${b}-reference-code`,className:o.cn(ym[a],m.referenceCode),children:[g," ",t.jsx("span",{className:"select-all font-mono",children:x})]}):null]}),c?t.jsx("div",{"data-testid":`${b}-actions`,className:o.cn("flex flex-wrap items-center justify-center gap-2",vm[a],m.actions),children:c}):null]})}function ta(e){return t.jsx(Ri,{...e})}function Ms(e){return t.jsx(ta,{...e,variant:"empty"})}function Bs(e){return t.jsx(Ri,{...e,variant:"error"})}function Ps(e){return t.jsx(ta,{...e,variant:"loading"})}function Ii(e){return t.jsx(ta,{...e,variant:"success"})}ta.displayName="FeedbackState";Ms.displayName="EmptyState";Bs.displayName="ErrorState";Ps.displayName="LoadingState";Ii.displayName="SuccessState";const Mi=({title:e,value:a,description:s,onValueChange:n,className:r=""})=>{const i=h.useId();return t.jsxs("div",{className:o.cn("w-full flex flex-row items-center",e||s?"justify-between gap-6":"justify-start",r),"data-testid":"toggle",children:[t.jsxs("div",{className:"flex flex-col items-start",children:[e&&t.jsx("label",{htmlFor:i,className:"font-medium text-left","data-testid":"toggle-title",children:e}),s&&t.jsx("p",{className:"text-left text-gray-500","data-testid":"toggle-description",children:s})]}),t.jsx(o.Switch,{id:i,isSelected:a,onValueChange:n,"data-testid":"toggle-switch"})]})},Am={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"},Dm=(e,a)=>new Intl.NumberFormat(e,{style:"currency",currency:a}),Bi=e=>Object.values(e).reduce((a,s)=>a+Object.values(s).reduce((n,r)=>n+Object.values(r).reduce((i,c)=>i+c.selectedQuantity,0),0),0),Em=e=>e.reduce((a,s)=>a+s.dates.reduce((n,r)=>n+r.tickets.reduce((i,c)=>i+c.max,0),0),0),Ts=e=>e.flatMap(a=>a.dates.flatMap(s=>s.tickets.map(n=>({exhibition:a,dateGroup:s,ticket:n})))),Gn=(e,a,s)=>{const n={};let r=s?a??Em(e):0;for(const{exhibition:i,dateGroup:c,ticket:l}of Ts(e)){n[i.id]??={},n[i.id][c.id]??={};const d=s?Math.min(l.max,r):0;n[i.id][c.id][l.id]={id:l.id,selectedQuantity:d,originalPrice:l.originalPrice,discountedPrice:l.price},r-=d}return n},Kn=(e,a,s)=>`${e}::${a}::${s}`,Lm=(e,a,s)=>{const n=Bi(a);for(const{exhibition:r,dateGroup:i,ticket:c}of Ts(e)){const l=a[r.id]?.[i.id]?.[c.id]?.selectedQuantity??0,d=s===void 0?c.max:Math.min(c.max,s-(n-l));if(d>0&&l<d)return!1}return!0},Fm=({initialQuantity:e=1,minQuantity:a=1,maxQuantity:s=10,onChange:n,disabled:r=!1})=>{const i=Math.max(a,Math.min(s,e)),[c,l]=h.useState(()=>String(i)),[d,u]=h.useState(!1),f=d?c:String(i),m=()=>{r||i>=s||n?.(i+1)},b=()=>{r||i<=a||n?.(i-1)},x=k=>{if(r)return;l(k.target.value);const $=parseInt(k.target.value,10);isNaN($)||n?.(Math.max(a,Math.min(s,$)))},g=k=>{const $=parseInt(k.target.value,10);if(u(!1),isNaN($)){n?.(a);return}const _=Math.max(a,Math.min(s,$));_!==$?n?.(_):l(String(_))},j=i<=a,y=i>=s,v="w-10 h-10 flex items-center justify-center border-0 rounded-full cursor-pointer transition-colors duration-150 text-white text-2xl font-regular",C="bg-primary hover:bg-primary/80",S="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:b,disabled:r||j,className:o.cn(v,r||j?S:C),"aria-label":"Decrement quantity","data-testid":"quantity-decrement",children:"-"}),t.jsx("input",{type:"number",value:f,onChange:x,onFocus:()=>u(!0),onBlur:g,disabled:r,min:a,max:s,step:"1",className:"w-12 h-10 rounded-md border-0 bg-zinc-100 text-center text-2xl font-medium text-zinc-900 [appearance:textfield] [&::-webkit-inner-spin-button]:appearance-none [&::-webkit-outer-spin-button]:appearance-none","aria-label":`Selected quantity: ${i}`,"data-testid":"quantity-input"}),t.jsx("button",{type:"button",onClick:m,disabled:r||y,className:o.cn(v,r||y?S:C),"aria-label":"Increment quantity","data-testid":"quantity-increment",children:"+"})]})},_m=({label:e,checked:a=!1,onChange:s,disabled:n=!1})=>{const r=()=>{n||s?.(!a)};return t.jsxs("button",{type:"button",onClick:r,disabled:n,role:"checkbox","aria-checked":a,"data-testid":"checkbox-button","data-checked":a,className:o.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",n&&"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:a,onChange:()=>{},disabled:n,className:"absolute opacity-0 w-0 h-0 pointer-events-none",tabIndex:-1,readOnly:!0}),t.jsx("span",{className:o.cn("block w-3.5 h-3.5 rounded-sm relative",a?"bg-primary":"bg-white ring-1 ring-zinc-300"),children:a&&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})]})},Rm=({item:e,quantity:a,onChange:s,getTotalSelectedTickets:n,userMaxLimit:r,settings:i,labels:c})=>{const l=()=>{if(!n||r===void 0)return e.max;const m=n();return Math.min(e.max,r-(m-a))},d=i?.locale??"en-US",u=i?.currency??"USD",f=Dm(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:[c.ticketsAllowedToRedeem," ",e.max]})})]}),t.jsx(Fm,{initialQuantity:a,minQuantity:0,maxQuantity:l(),onChange:s})]}),e.membershipAlert?t.jsx(o.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]})},Im=({exhibitionId:e,dateGroup:a,isLast:s=!1,onQuantityChange:n,getTicketQuantity:r,getTotalSelectedTickets:i,userMaxLimit:c,settings:l,labels:d})=>t.jsxs("div",{className:o.cn("flex flex-col gap-2 pb-3",!s&&"border-b border-zinc-200"),"data-testid":"upgrade-ticket-date-group",children:[t.jsx("p",{className:"m-0 text-sm text-left text-zinc-500","data-testid":"upgrade-ticket-date",children:a.date}),a.tickets.map((u,f)=>t.jsxs("div",{children:[t.jsx(Rm,{item:u,quantity:r(e,a.id,u.id),onChange:m=>n(e,a.id,u.id,m),getTotalSelectedTickets:i,userMaxLimit:c,settings:l,labels:d}),f<a.tickets.length-1?t.jsx(o.Divider,{className:"bg-zinc-200","data-testid":"upgrade-ticket-divider"}):null]},u.id))]}),Mm=({title:e,exhibition:a,onQuantityChange:s,getTicketQuantity:n,getTotalSelectedTickets:r,userMaxLimit:i,settings:c,labels:l,initialExpanded:d=!1})=>{const[u,f]=h.useState(d),m=a.dates.reduce((x,g)=>x+g.tickets.reduce((j,y)=>j+n(a.id,g.id,y.id),0),0),b=a.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-${a.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:o.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,{icon:"mdi:chevron-down"})})]})]})}),t.jsx("div",{id:`upgrade-items-${a.id}`,className:o.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:b?a.dates.map((x,g)=>t.jsx(Im,{exhibitionId:a.id,dateGroup:x,isLast:g===a.dates.length-1,onQuantityChange:s,getTicketQuantity:n,getTotalSelectedTickets:r,userMaxLimit:i,settings:c,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})})})})]})},Bm=({initialExpanded:e=!1,userMaxLimit:a,labels:s,settings:n,ticketSelectionData:r,className:i="",onSelectionChange:c})=>{const l=h.useMemo(()=>r??[],[r]),d={...Am,...s},[u,f]=h.useState(()=>Gn(l,a,!0)),m=h.useRef(!1),b=h.useMemo(()=>{const C=Ts(l).map(({exhibition:S,dateGroup:k,ticket:$})=>[Kn(S.id,k.id,$.id),$]);return new Map(C)},[l]),x=Lm(l,u,a),g=(C,S,k)=>u[C]?.[S]?.[k]?.selectedQuantity??0,j=()=>Bi(u),y=(C,S,k,$)=>{const _=g(C,S,k),w=j()-_;if(a!==void 0&&w+$>a)return;const F=b.get(Kn(C,S,k));if(!F)return;const A={...u,[C]:{...u[C],[S]:{...u[C]?.[S],[k]:{id:k,selectedQuantity:$,originalPrice:F.originalPrice,discountedPrice:F.price}}}};f(A),c?.(A)},v=C=>{const S=Gn(l,a,C);f(S),c?.(S)};return h.useEffect(()=>{!m.current&&x&&(c?.(u),m.current=!0)},[x,u,c]),t.jsxs("div",{className:o.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(_m,{label:d.selectAllButtonLabel,checked:x,onChange:v})]}),l.map(C=>t.jsx(Mm,{title:C.exhibitionName,exhibition:C,onQuantityChange:y,getTicketQuantity:g,getTotalSelectedTickets:j,userMaxLimit:a,settings:n,labels:d,initialExpanded:e},C.id))]})},Qa={confirm:"Confirm",clear:"Clear",noLabel:"Filters"},Xa=e=>{const a={};for(const s of e)s.type==="checkbox"?a[s.id]=[...s.selectedValues]:a[s.id]=s.selectedValue?[s.selectedValue]:[];return a},Pm=(e,a)=>{const s={};for(const n of a){if(n.type==="checkbox"){s[n.id]=e[n.id]??[...n.selectedValues];continue}const r=e[n.id]??[];s[n.id]=r.length>0?r[0]:null}return s},Tm=e=>e.type==="checkbox"?e.selectedValues.length>0:e.selectedValue!==null,Pi=({triggerLabel:e,triggerAriaLabel:a,triggerIcon:s="solar:tuning-square-outline",triggerVariant:n="bordered",triggerColor:r="default",triggerSize:i="sm",triggerClassName:c,popoverClassName:l,className:d,sections:u,onConfirm:f,onClear:m,appliedCount:b,countAriaLabel:x,countDisplay:g="badge",confirmLabel:j=Qa.confirm,clearLabel:y=Qa.clear,isOpen:v,defaultOpen:C=!1,onOpenChange:S,isDisabled:k=!1,closeOnConfirm:$=!0,keepOpenAfterClear:_=!1})=>{const[w,F]=h.useState(C),[A,M]=h.useState(()=>Xa(u)),E=v??w,D=b??u.filter(K=>Tm(K)).length,I=K=>{K&&M(Xa(u)),v||F(K),S?.(K)},B=(K,ie)=>{M(te=>({...te,[K.id]:ie}))},z=(K,ie)=>{M(te=>({...te,[K.id]:ie?[ie]:[]}))},q=async()=>{M(Xa(u.map(K=>K.type==="checkbox"?{...K,selectedValues:[]}:{...K,selectedValue:null}))),await m(),_||I(!1)},P=async()=>{const K=Pm(A,u);await f(K),$&&I(!1)},ee=K=>{if(K.type==="checkbox")return t.jsx(o.CheckboxGroup,{label:K.label,value:A[K.id]??[],onValueChange:te=>B(K,te),children:K.options.map(te=>t.jsx(o.Checkbox,{value:te.value,isDisabled:te.isDisabled,children:te.label},te.value))},K.id);const ie=A[K.id]?.[0]??"";return t.jsx(o.RadioGroup,{label:K.label,value:ie,onValueChange:te=>z(K,te||null),children:K.options.map(te=>t.jsx(o.Radio,{value:te.value,isDisabled:te.isDisabled,children:te.label},te.value))},K.id)},W=h.useMemo(()=>D>0?x?.(D)||`${D} filters applied`:void 0,[x,D]),Y=h.useMemo(()=>D===0?e||Qa.noLabel:x?x(D):`${e} (${D})`,[D,e,x]);return t.jsx("div",{className:d,children:t.jsxs(o.Popover,{isOpen:E,onOpenChange:I,placement:"bottom-end",children:[t.jsx(o.PopoverTrigger,{children:t.jsxs(p.Button,{isDisabled:k,variant:n,color:r,size:i,className:c,"aria-label":a,"aria-haspopup":"dialog","aria-expanded":E,children:[t.jsx(p.Icon,{icon:s,width:16}),t.jsx("span",{children:e}),g==="badge"&&D>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":W,children:D}):g==="summary"&&Y!==e?t.jsx("span",{className:"text-xs",children:Y}):null]})}),t.jsx(o.PopoverContent,{className:l,children:t.jsxs("div",{className:"flex w-full flex-col gap-5 px-4 py-4",children:[u.map(K=>ee(K)),t.jsxs("div",{className:"flex items-center justify-end gap-2 border-t border-gray-200 pt-3",children:[t.jsx(p.Button,{variant:"light",color:"default",size:"sm",onPress:q,children:y}),t.jsx(p.Button,{color:"primary",size:"sm",onPress:P,children:j})]})]})})]})})};Pi.displayName="FilterPopover";const Om="No sessions available for this date",zm=e=>e==="sold-out"||e==="closed"?"danger":"success",Vm=e=>{const a=e.seatsRemaining;return e.status==="sold-out"||e.status==="closed"?"Sold out":e.status==="limited"?typeof a=="number"?`${a} left`:"Limited":typeof a=="number"?`${a} seats available`:"Available"},Yn=e=>e.isDisabled?!0:e.status==="sold-out"||e.status==="closed",Um=(e,a)=>a&&e.some(s=>s.date===a)?a:e[0]?.date??null,Ti=({heading:e,subheading:a,days:s,selectedDate:n,onDateSelect:r,quickDates:i,selectedSessionId:c=null,onSessionSelect:l,emptyStateMessage:d=Om,statusLabel:u,statusTone:f,sessionAriaLabel:m,dayButtonClassName:b,calendarSlot:x,dayGroupAriaLabel:g,sessionGridAriaLabel:j,className:y,headingClassName:v,subheadingClassName:C})=>{const S=Um(s,n),k=s.find(A=>A.date===S),$=i??s.map(A=>({date:A.date,label:A.label})),_=k?.sessions??[],w=A=>A===S?"solid":"bordered",F=A=>{if(!Yn(A)){if(A.id===c){l(null);return}l(A.id)}};return t.jsxs("section",{className:o.cn("flex flex-col gap-4 rounded-xl bg-white p-3 sm:p-4",y),"data-testid":"session-timeline-root",children:[t.jsxs("header",{className:"flex flex-col gap-1",children:[t.jsx("h2",{className:o.cn("text-base font-semibold text-gray-900",v),children:e}),a?t.jsx("p",{className:o.cn("text-sm text-gray-700",C),children:a}):null]}),t.jsxs("div",{className:"flex flex-wrap items-center gap-2",role:"group","aria-label":g||"Session days",children:[$.map(A=>t.jsx(p.Button,{size:"sm",variant:w(A.date),color:"default",className:o.cn("rounded-full",b),isDisabled:A.isDisabled,onPress:()=>{r(A.date)},children:t.jsx("span",{children:A.label})},A.date)),x?t.jsx("div",{children:x}):null]}),t.jsxs("ul",{className:"grid grid-cols-1 gap-2 sm:grid-cols-3","aria-label":j||"Sessions",children:[_.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,_.map(A=>{const M=Yn(A),E=A.id===c;return t.jsx("li",{className:"rounded-xl",children:t.jsx(o.Card,{shadow:"sm",radius:"lg",isPressable:!M,onPress:()=>{F(A)},"aria-disabled":M,"aria-pressed":M?void 0:E,className:o.cn("w-full",M?"bg-gray-100 opacity-70":"",E?"w-full ring-2 ring-gray-900":""),"aria-label":m?m(A,{isSelected:E,isUnavailable:M}):M?`${A.startTime} ${A.endTime} sold out`:`${A.startTime} ${A.endTime} available`,children:t.jsxs(o.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:[A.startTime," – ",A.endTime]}),t.jsx(o.Chip,{size:"sm",color:f?f(A):zm(A.status),variant:"flat",children:u?u(A):Vm(A)})]})})},A.id)})]})]})};Ti.displayName="SessionTimeline";const fs=16,lt=e=>`${e/fs}rem`;function Hm(){if(typeof document>"u"||typeof getComputedStyle!="function")return fs;const e=parseFloat(getComputedStyle(document.documentElement).fontSize);return Number.isFinite(e)&&e>0?e:fs}const aa=(e,a)=>e>=a*Hm(),Wm=1120;function Mt(){const e=h.useRef(null),[a,s]=h.useState(0),[,n]=h.useState("");return h.useLayoutEffect(()=>{const r=e.current;if(!r||typeof ResizeObserver>"u")return;const i=new ResizeObserver(c=>{const l=c[c.length-1];l&&s(l.borderBoxSize?.[0]?.inlineSize??l.contentRect.width)});return s(r.getBoundingClientRect().width),i.observe(r),()=>i.disconnect()},[]),h.useEffect(()=>{if(typeof MutationObserver>"u")return;const r=document.documentElement,i=new MutationObserver(()=>n(getComputedStyle(r).fontSize));return i.observe(r,{attributes:!0,attributeFilter:["style","class"]}),()=>i.disconnect()},[]),{ref:e,width:a}}const qm=48,Qe={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"},Gm=(e,a)=>typeof e=="string"?t.jsx(p.Icon,{icon:e,className:"size-5","aria-hidden":"true"}):e||a||null,Oi=({title:e,subtitle:a,eyebrow:s,icon:n,initials:r,actions:i,titleAs:c="h1",className:l,classNames:d={},"data-testid":u="page-header",list:f,narrow:m,headerRef:b})=>{const x=Gm(n,r);return t.jsxs("header",{ref:b,"data-testid":u,"data-variant":f?"list":void 0,"data-size":f?m?"narrow":"wide":void 0,className:o.cn(f?o.cn(Qe.base,m?Qe.baseNarrow:Qe.baseWide):"flex flex-wrap items-start justify-between gap-4",l,d.base),children:[t.jsxs("div",{className:f?Qe.identity:"flex items-center gap-4",children:[x?t.jsx("div",{"aria-hidden":"true","data-testid":`${u}-icon`,className:o.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?Qe.text:void 0,children:[s?t.jsx("p",{"data-testid":`${u}-eyebrow`,className:o.cn("text-brand text-sm font-medium uppercase tracking-wide",d.eyebrow),children:s}):null,t.jsx(c,{"data-testid":`${u}-title`,className:o.cn(f?m?Qe.titleNarrow:Qe.titleWide:"text-3xl font-semibold text-gray-950",d.title),children:e}),a?t.jsx("p",{"data-testid":`${u}-subtitle`,className:o.cn(f?m?Qe.subtitleNarrow:Qe.subtitleWide:"mt-1 text-sm text-gray-600",d.subtitle),children:a}):null]})]}),i?t.jsx("div",{"data-testid":`${u}-actions`,className:o.cn(f?m?Qe.actionsNarrow:Qe.actionsWide:"flex flex-wrap items-center gap-2",d.actions),children:i}):null]})},Km=e=>{const{ref:a,width:s}=Mt(),n=s>0&&!aa(s,qm);return t.jsx(Oi,{...e,list:!0,narrow:n,headerRef:a})},zi=e=>e.variant==="list"?t.jsx(Km,{...e}):t.jsx(Oi,{...e,list:!1,narrow:!1});zi.displayName="PageHeader";const Ze={ok:{fg:le.ok,bg:le["ok-fill"]},warn:{fg:le.warn,bg:le["warn-fill"]},danger:{fg:le.danger,bg:le["danger-fill"]},info:{fg:le.info,bg:le["info-fill"]},violet:{fg:le.violet,bg:le["violet-fill"]},neutral:{fg:le.neutral,bg:le["neutral-fill"]}};function sa(e){if(e==="positive")return{color:le.ok};if(e==="negative")return{color:le.danger}}const Ym={active:"success",success:"success",draft:"warning",pending:"warning",warning:"warning",danger:"danger",archived:"default",inactive:"default",neutral:"default",info:"default",violet:"default"},xs={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:Ze.info,violet:Ze.violet},Zm={active:"ok",success:"ok",draft:"warn",pending:"warn",warning:"warn",danger:"danger",archived:"neutral",inactive:"neutral",neutral:"neutral",info:"info",violet:"violet"},Qm={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]"},Xm={info:xs.info,violet:xs.violet},Vi=({status:e,label:a,variant:s="flat",size:n="sm",color:r,startContent:i,className:c,"data-testid":l="status-chip"})=>{if(s==="plain"){const u=Ze[Zm[e]];return t.jsxs("span",{"data-testid":l,"data-status":e,"data-variant":"plain",className:o.cn("inline-flex items-center gap-1.5 whitespace-nowrap rounded-full font-normal",Qm[n],"leading-[1.35]",c),style:{color:u.fg,backgroundColor:u.bg},children:[i,a]})}if(s==="dot"){const u=xs[e];return t.jsxs("span",{"data-testid":l,"data-status":e,className:o.cn("inline-flex items-center gap-1.5 whitespace-nowrap rounded-full px-2.5 py-[3px] text-[12px] font-semibold leading-[1.4]",c),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"}}),a]})}const d=r?void 0:Xm[e];return t.jsx(o.Chip,{color:r??Ym[e],variant:s,size:n,startContent:i,"data-testid":l,"data-status":e,className:o.cn("font-medium",c),style:d?{color:d.fg,backgroundColor:d.bg}:void 0,children:a})};Vi.displayName="StatusChip";const Jm={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"},oa={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"},La=({label:e,value:a,size:s="sm",variant:n="default",className:r,"data-testid":i="key-value-chip"})=>n==="record"?t.jsxs("span",{"data-testid":i,"data-variant":"record",className:o.cn(oa.base,oa[s],r),children:[t.jsx("span",{className:oa.label,children:e}),t.jsx("span",{className:oa.value,children:a})]}):t.jsxs("span",{"data-testid":i,className:o.cn("inline-flex items-baseline whitespace-nowrap border border-default-200 bg-default-100",Jm[s],r),children:[t.jsx("span",{className:"font-medium text-default-400",children:e}),t.jsx("span",{className:"font-semibold text-default-700",children:a})]});La.displayName="KeyValueChip";const Ui=({columns:e,rows:a=6,label:s="Loading",barHeight:n=12,alignLastRight:r=!1,appearance:i="pulse",className:c,classNames:l={},"data-testid":d="table-skeleton"})=>t.jsxs("div",{role:"status","aria-busy":"true","data-testid":d,className:o.cn("w-full",c,l.base),children:[t.jsx("span",{className:"sr-only",children:s}),t.jsx("div",{"aria-hidden":"true",children:Array.from({length:a}).map((u,f)=>i==="shimmer"?t.jsx("div",{"data-testid":`${d}-row`,className:o.cn("flex items-center border-b border-pos-hair",l.row),children:e.map((m,b)=>{const x=b===e.length-1;return t.jsx("div",{className:o.cn("min-w-0 flex-1 px-4 py-5",r&&x&&"flex justify-end"),children:t.jsx("div",{className:o.cn(p.shimmerClass,l.bar),style:{height:lt(n),width:m==="fill"?"60%":lt(m),maxWidth:"100%"}})},b)})},f):t.jsx("div",{"data-testid":`${d}-row`,className:o.cn("flex items-center gap-3 border-t border-default-100 px-5 py-4",l.row),children:e.map((m,b)=>{const x=b===e.length-1;return t.jsx("div",{className:o.cn(m==="fill"?"flex-1":"shrink-0",r&&x&&"flex justify-end"),style:m==="fill"?void 0:{width:m},children:t.jsx("div",{className:o.cn("animate-pulse rounded bg-default-200",p.stillAnimationClass,l.bar),style:{height:n,width:m==="fill"?"60%":m}})},b)})},f))})]});Ui.displayName="TableSkeleton";const Os="text-left text-[11px] font-semibold uppercase tracking-[.04em] text-acct-sub px-4 pt-4 pb-3 whitespace-nowrap bg-transparent",zs="px-4 text-[13.5px] text-acct-ink2 align-middle",Vs="border-t border-acct-hair transition-colors duration-150 hover:bg-acct-page data-[hover=true]:bg-acct-page",Us="w-full",Hi="border-t border-acct-border px-5 py-3.5",ca={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 ${p.stillTransitionClass}`,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"},Wi=({columns:e,children:a,emptyContent:s,footer:n,ariaLabel:r,variant:i="default",className:c,classNames:l={},"data-testid":d="admin-table"})=>{const u=i==="framed";return t.jsxs("div",{className:o.cn(u&&ca.base,c,l.base),"data-testid":d,"data-variant":u?"framed":void 0,children:[t.jsxs(p.Table,{"aria-label":r,removeWrapper:!0,classNames:{table:o.cn(Us,l.table),th:o.cn(u?ca.th:Os,l.th),tr:o.cn(u?ca.tr:Vs,l.tr),td:o.cn(u?ca.td:zs,l.td)},children:[t.jsx(o.TableHeader,{columns:e,children:f=>t.jsx(o.TableColumn,{align:f.align==="right"?"end":"start",width:f.width,children:f.label},f.key)}),t.jsx(o.TableBody,{emptyContent:s,children:a})]}),n?t.jsx("div",{"data-testid":`${d}-footer`,className:o.cn(!u&&Hi,l.footer),children:n}):null]})};Wi.displayName="AdminTable";const ef={sm:"size-6 min-w-6",md:"size-[30px] min-w-[30px]"},Hs=({actions:e,size:a="md",className:s,"data-testid":n="row-actions"})=>t.jsx("div",{role:"presentation","data-testid":n,className:o.cn("inline-flex gap-0.5",s),onClick:r=>r.stopPropagation(),children:e.map(r=>t.jsx(p.Button,{isIconOnly:!0,variant:"light",radius:"sm",size:"sm",onPress:r.onPress,isDisabled:r.disabled,"aria-label":r.label,title:r.label,"data-testid":`${n}-${r.key}`,className:o.cn("text-acct-sub data-[hover=true]:bg-acct-hair",ef[a]),children:r.icon},r.key))});Hs.displayName="RowActions";const tf=Ae.palettes.warning[50],af="solar:alt-arrow-down-outline",sf="solar:pen-2-outline",nf={sm:"hidden sm:table-cell",md:"hidden md:table-cell",lg:"hidden lg:table-cell"},ve={root:"w-full overflow-x-auto rounded-2xl border border-acct-border bg-acct-surface",table:Us,th:Os,alignRight:"text-right",thActions:"w-px",row:Vs,rowOpen:"bg-acct-page hover:bg-acct-page",td:o.cn(zs,"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 ${p.stillTransitionClass}`,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"},rf=new Set(["text","search","email","tel","url","number","password"]);function lf(e){return e instanceof HTMLInputElement&&rf.has(e.type)&&e.getAttribute("aria-expanded")!=="true"}function Zn(e){return o.cn(e.align==="right"&&ve.alignRight,e.hideBelow&&nf[e.hideBelow])}function qi({ariaLabel:e,columns:a,rows:s,getRowKey:n,getRowLabel:r,renderCell:i,renderExpanded:c,renderExpandedActions:l,getRowActions:d,rowNeedsFix:u,expandedKeys:f,defaultExpandedKeys:m,onExpandedChange:b,labels:x,emptyContent:g,className:j,"data-testid":y="expandable-table"}){const v=h.useId(),C=f!==void 0,[S,k]=h.useState(()=>new Set(m??[])),$=h.useMemo(()=>C?new Set(f):S,[C,f,S]),_=h.useRef(new Map),w=h.useRef(null),F=(E,D,I)=>{if($.has(E)===D)return;const B=new Set($);D?B.add(E):B.delete(E),C||k(B),b?.(B,{key:E,expanded:D,reason:I})};h.useLayoutEffect(()=>{const E=w.current;if(E===null||$.has(E))return;w.current=null;const D=document.activeElement;(D===null||D===document.body)&&_.current.get(E)?.focus()});const A=E=>D=>{if(D.defaultPrevented||D.nativeEvent.isComposing)return;const I=D.key==="Escape"?"escape":D.key==="Enter"&&lf(D.target)?"enter":null;I!==null&&(D.preventDefault(),D.stopPropagation(),F(E,!1,I))},M=a.length+1;return t.jsx("div",{"data-testid":y,className:o.cn(ve.root,j),children:t.jsxs("table",{"aria-label":e,className:ve.table,children:[t.jsx("thead",{children:t.jsxs("tr",{children:[a.map(E=>t.jsx("th",{scope:"col",className:o.cn(ve.th,Zn(E)),style:E.width===void 0?void 0:{width:E.width},children:E.label},E.key)),t.jsx("th",{scope:"col",className:o.cn(ve.th,ve.thActions),children:t.jsx("span",{className:"sr-only",children:x.actions})})]})}),s.length===0&&p.hasContent(g)?t.jsx("tbody",{children:t.jsx("tr",{children:t.jsx("td",{colSpan:M,className:ve.empty,"data-testid":`${y}-empty`,children:g})})}):null,s.map((E,D)=>{const I=n(E),B=$.has(I),z=u?.(E)??!1,q=x.toggleRow(r(E)),P=`${v}-panel-${D}`,ee=d?.(E,D)??[],W={rowIndex:D,close:()=>F(I,!1,"done")};return t.jsxs("tbody",{"data-testid":`${y}-row-${I}`,"data-expanded":B?"true":"false","data-needs-fix":z?"true":void 0,children:[t.jsxs("tr",{className:o.cn(ve.row,B&&ve.rowOpen),style:z&&!B?{backgroundColor:tf}:void 0,children:[a.map(Y=>t.jsx("td",{className:o.cn(ve.td,Zn(Y)),children:i(E,Y.key,D)},Y.key)),t.jsx("td",{className:ve.tdActions,children:t.jsxs("div",{className:ve.actions,children:[t.jsx(p.Button,{ref:Y=>{Y?_.current.set(I,Y):_.current.delete(I)},variant:"light",color:"default",size:"sm",testId:`${y}-toggle-${I}`,"aria-label":q,"aria-expanded":B,"aria-controls":B?P:void 0,className:o.cn(ve.toggle,B&&ve.toggleOpen),endContent:t.jsx(p.Icon,{"aria-hidden":!0,icon:af,className:o.cn(ve.chevron,B&&ve.chevronOpen)}),onPress:()=>F(I,!B,"toggle"),children:x.toggle}),ee.length>0?t.jsx(Hs,{actions:ee,"data-testid":`${y}-actions-${I}`}):null]})})]}),B?t.jsx("tr",{className:ve.panelRow,children:t.jsx("td",{colSpan:M,className:ve.panelCell,children:t.jsxs("div",{role:"region",id:P,"aria-label":q,"data-testid":`${y}-panel-${I}`,className:ve.panel,onKeyDown:A(I),onFocus:()=>{w.current=I},onBlur:Y=>{const K=Y.relatedTarget;K&&!Y.currentTarget.contains(K)&&(w.current=null)},children:[p.hasContent(x.panelTitle)?t.jsxs("p",{className:ve.panelTitle,children:[t.jsx(p.Icon,{"aria-hidden":!0,icon:sf,className:ve.panelTitleIcon}),x.panelTitle]}):null,c(E,W),t.jsxs("div",{className:ve.panelFooter,children:[l?.(E,W),t.jsx(p.Button,{variant:"bordered",color:"default",size:"sm",testId:`${y}-done-${I}`,className:ve.done,onPress:W.close,children:x.done})]})]})})}):null]},I)})]})})}qi.displayName="ExpandableTable";const of=Jt["--warn"],Qn={root:"inline-flex shrink-0 items-center",dot:"block size-1.5 shrink-0 rounded-full"};function Ws({label:e,className:a,"data-testid":s="needs-fix-dot"}){return t.jsxs("span",{"data-testid":s,className:o.cn(Qn.root,a),children:[t.jsx("span",{"aria-hidden":"true","data-testid":`${s}-mark`,className:Qn.dot,style:{backgroundColor:of}}),t.jsx("span",{className:"sr-only",children:e})]})}Ws.displayName="NeedsFixDot";function cf(e,a){return e.find(s=>s.needsFix&&!s.isDisabled)?.key??a}const Vt={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"},df={md:"w-[280px]",lg:"w-[360px]",fill:"min-w-[12.5rem] flex-1"},uf=48,at={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"},Xn={md:"w-[15.625rem]",lg:"w-[22.5rem]",fill:"w-full"},wa={inputWrapper:"h-12 min-h-12 !h-12",input:"text-base",icon:"[&_svg]:size-5"},Jn={button:"shrink-0 text-default-500",input:"[&::-webkit-search-cancel-button]:appearance-none"},er={md:{button:"size-8 min-w-8",icon:"size-4"},lg:{button:"size-11 min-w-11",icon:"size-5"}},Gi=({searchValue:e,onSearchChange:a,searchLabel:s,searchPlaceholder:n,searchClearable:r,clearLabel:i,size:c,dataTestId:l,startContent:d,classNames:u})=>{const f=h.useRef(null),m=c==="lg",b=r&&e!==""?t.jsx(p.Button,{isIconOnly:!0,size:"sm",variant:"light",color:"default",radius:"full","aria-label":i,onPress:()=>{a(""),f.current?.focus()},className:o.cn(Jn.button,er[c].button),testId:`${l}-search-clear`,children:t.jsx(p.Icon,{icon:"lucide:x","aria-hidden":"true",className:er[c].icon})}):void 0;return t.jsx(o.Input,{ref:f,type:"search","aria-label":s,placeholder:n??s,value:e,onValueChange:a,startContent:d,endContent:b,"data-testid":`${l}-search`,variant:"bordered",radius:"none",classNames:{base:u.base,inputWrapper:o.cn(u.inputWrapper,m&&wa.inputWrapper),innerWrapper:u.innerWrapper,input:o.cn(u.input,m&&wa.input,r&&Jn.input)}})},mf=({searchValue:e,onSearchChange:a,searchLabel:s,searchPlaceholder:n,searchIcon:r,searchClearable:i=!1,clearLabel:c,children:l,trailing:d,searchWidth:u="md",size:f,className:m,"data-testid":b="admin-toolbar"})=>{const{ref:x,width:g}=Mt(),j=g>0&&!aa(g,uf),y=u==="fill";return t.jsxs("div",{ref:x,role:"search","data-testid":b,"data-variant":"framed","data-size":j?"narrow":"wide",className:o.cn(at.base,j&&at.narrow,m),children:[l,t.jsx("div",{"data-testid":`${b}-search-slot`,className:y?at.searchFill:j?at.searchNarrow:at.searchWide,children:t.jsx(Gi,{searchValue:e,onSearchChange:a,searchLabel:s,searchPlaceholder:n,searchClearable:i,clearLabel:c,size:f,dataTestId:b,startContent:t.jsx("span",{"aria-hidden":"true","data-testid":`${b}-search-icon`,className:o.cn(at.icon,f==="lg"&&wa.icon),children:r??t.jsx(p.Icon,{icon:"lucide:search"})}),classNames:{base:y?Xn.fill:j?at.inputBaseNarrow:Xn[u],inputWrapper:at.inputWrapper,innerWrapper:at.innerWrapper,input:at.input}})}),d]})},Ki=({searchValue:e,onSearchChange:a,searchLabel:s,searchPlaceholder:n,searchIcon:r,searchClearable:i=!1,clearLabel:c="Clear search",children:l,trailing:d,searchWidth:u="md",size:f="md",variant:m="default",className:b,"data-testid":x="admin-toolbar"})=>m==="framed"?t.jsx(mf,{searchValue:e,onSearchChange:a,searchLabel:s,searchPlaceholder:n,searchIcon:r,searchClearable:i,clearLabel:c,trailing:d,searchWidth:u,size:f,className:b,"data-testid":x,children:l}):t.jsxs("div",{role:"search","data-testid":x,className:o.cn(Vt.base,b),children:[t.jsx(Gi,{searchValue:e,onSearchChange:a,searchLabel:s,searchPlaceholder:n,searchClearable:i,clearLabel:c,size:f,dataTestId:x,startContent:r?t.jsx("span",{"aria-hidden":"true",className:o.cn(Vt.icon,f==="lg"&&wa.icon),children:r}):void 0,classNames:{base:df[u],inputWrapper:Vt.inputWrapper,input:Vt.input}}),l,d?t.jsx("div",{className:Vt.trailing,children:d}):null]});Ki.displayName="AdminToolbar";const ff="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",xf="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",pf="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",Yi=h.forwardRef(function({icon:a,children:s,count:n,appearance:r="pill",className:i,testId:c,...l},d){return r==="outline"?t.jsxs(p.Button,{ref:d,"data-testid":c,"data-appearance":"outline",color:"default",variant:"bordered",radius:"md",size:"md",className:o.cn("rounded-[0.75rem] font-normal",i),...l,children:[t.jsx(p.Icon,{icon:a,className:"size-4","aria-hidden":!0}),t.jsx("span",{children:s}),n!==void 0&&n>0&&t.jsx("span",{className:xf,children:n})]}):t.jsxs(p.Button,{ref:d,"data-testid":c,variant:"light",size:"sm",className:o.cn(pf,i),...l,children:[t.jsx(p.Icon,{icon:a,className:"size-4 text-gray-500","aria-hidden":!0}),t.jsx("span",{children:s}),n!==void 0&&n>0&&t.jsx("span",{className:ff,children:n})]})});Yi.displayName="ToolbarButton";const Ja="w-full mb-4 border-b border-pos-line",es=["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",p.stillTransitionClass].join(" "),hf={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 ${p.stillTransitionClass}`,tabContent:`text-[0.9375rem] font-medium text-acct-sub group-data-[selected=true]:font-semibold group-data-[selected=true]:text-acct-rust ${p.stillTransitionClass}`},lg:{base:Ja,tabList:"w-full -mb-px gap-2 rounded-none p-0",cursor:"hidden",tab:`${es} min-h-11 px-5 py-0`,tabContent:`text-[0.9375rem] leading-5 font-semibold text-pos-neutral group-data-[selected=true]:text-primary ${p.stillTransitionClass}`},"sm-primary":{base:Ja,tabList:"w-full -mb-px gap-6 rounded-none px-0.5 py-0",cursor:"hidden",tab:`${es} px-0.5 py-2.5`,tabContent:`text-[0.84375rem] leading-4 font-medium text-pos-muted group-data-[selected=true]:text-pos-ink ${p.stillTransitionClass}`},"sm-secondary":{base:Ja,tabList:"w-full -mb-px gap-0 rounded-none p-0",cursor:"hidden",tab:`${es} px-[1.125rem] py-[0.5625rem]`,tabContent:`text-[0.8125rem] leading-4 font-semibold text-pos-muted group-data-[selected=true]:text-primary ${p.stillTransitionClass}`}},tr={base:"mb-0 border-b-0",tabList:"mb-0 border-b-0"},bf="inline-flex items-center gap-1.5",gf="data-[animated=true]:transition-none";function Zi({items:e,value:a,onChange:s,ariaLabel:n,size:r="md",level:i="primary",showDivider:c=!0,needsFixLabel:l,className:d,"data-testid":u="underline-tabs"}){const f=p.useReducedMotion(),m=hf[r==="sm"?`sm-${i}`:r],b=r!=="md",x=e.filter(g=>g.isDisabled).map(g=>g.key);return t.jsx(o.Tabs,{"aria-label":n,variant:"underlined",selectedKey:a,onSelectionChange:g=>s(String(g)),disabledKeys:x,disableCursorAnimation:b,"data-testid":u,"data-size":r,classNames:{...m,base:o.cn(m.base,!c&&tr.base,d),tabList:o.cn(m.tabList,!c&&tr.tabList),cursor:o.cn(m.cursor,f&&gf),panel:"p-0"},children:e.map(g=>{const j=`${u}-${g.key}`;return t.jsx(o.Tab,{title:g.needsFix?t.jsxs("span",{className:bf,children:[g.label," ",t.jsx(Ws,{label:l??"","data-testid":`${j}-needs-fix`})]}):g.label,titleValue:g.hint,"data-testid":j,"data-needs-fix":g.needsFix?"true":void 0,children:g.content},g.key)})})}Zi.displayName="UnderlineTabs";const qs="text-[11px] font-semibold uppercase tracking-[.04em] text-acct-muted mb-1.5",Qi="font-normal normal-case tracking-normal",Xi="ms-0.5 text-acct-danger",Ji="mb-0 min-h-[calc(var(--heroui-font-size-small)_+_10px)] text-foreground",el="after:content-none",tl="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",al="size-4",sl="max-w-xs rounded-xl px-3 py-2 text-xs leading-normal text-acct-ink2",nl=["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(" "),rl="text-[13.5px] text-acct-ink",il="bg-acct-page text-acct-muted cursor-default",ll="mt-[5px] text-xs text-acct-sub",ol="mt-[5px] text-xs text-acct-danger";function yf({label:e}){return t.jsxs(t.Fragment,{children:[t.jsx("span",{"aria-hidden":"true",className:Xi,children:"*"}),e?t.jsxs(t.Fragment,{children:[" ",t.jsx("span",{className:"sr-only",children:e})]}):null]})}function vf({help:e,label:a,labelledBy:s,testId:n}){const r=a?{"aria-label":a}:{"aria-labelledby":s};return t.jsxs(o.Popover,{placement:"top",showArrow:!0,children:[t.jsx(o.PopoverTrigger,{children:t.jsx(p.Button,{isIconOnly:!0,size:"sm",variant:"light",color:"default",radius:"full",...r,testId:n,className:tl,children:t.jsx(p.Icon,{"aria-hidden":!0,icon:"solar:info-circle-outline",className:al})})}),t.jsx(o.PopoverContent,{...r,"data-testid":`${n}-content`,className:sl,children:e})]})}function cl(e,a,s,n){return t.jsxs(t.Fragment,{children:[e,a?t.jsxs("span",{className:Qi,children:[" ",a]}):null,s?t.jsx(yf,{label:n}):null]})}const Gs=({children:e,suffix:a,htmlFor:s,id:n,isRequired:r,requiredLabel:i,help:c,helpLabel:l,className:d,"data-testid":u="admin-field-label"})=>{const f=h.useId(),m=cl(e,a,r,i),b=p.hasContent(c),x=n??(b?f:void 0);return t.jsxs("div",{"data-testid":u,className:o.cn(qs,d),children:[s?t.jsx("label",{id:x,htmlFor:s,children:m}):x?t.jsx("span",{id:x,children:m}):m,b&&x?t.jsx(vf,{help:c,label:l,labelledBy:x,testId:`${u}-help`}):null]})};Gs.displayName="AdminFieldLabel";const dl=({label:e,labelSuffix:a,value:s,onChange:n,placeholder:r,disabled:i=!1,readOnly:c=!1,mono:l=!1,autoFocus:d=!1,hint:u,invalid:f=!1,isRequired:m=!1,requiredLabel:b,help:x,helpLabel:g,className:j,"data-testid":y="admin-text-field"})=>{const v=h.useId(),C=h.useId(),S=p.hasContent(e),k=S&&p.hasContent(x),$=t.jsx(o.Input,{labelPlacement:S&&!k?"outside":void 0,label:S&&!k?cl(e,a,m,b):void 0,id:k?v:void 0,"aria-labelledby":k?C:void 0,value:s,placeholder:r,isDisabled:i,isReadOnly:c,autoFocus:d,isInvalid:f,isRequired:S&&m,validationBehavior:"aria",description:!f&&u?u:void 0,errorMessage:f?u:void 0,onValueChange:n,"data-testid":y,variant:"bordered",radius:"none",classNames:{base:o.cn("w-full",!k&&j),label:o.cn(qs,el),inputWrapper:nl,input:o.cn(rl,(l||c)&&"font-mono",c&&il),description:ll,errorMessage:ol}});return k?t.jsxs("div",{className:o.cn("w-full",j),children:[t.jsx(Gs,{id:C,htmlFor:v,suffix:a,isRequired:m,requiredLabel:b,help:x,helpLabel:g,className:Ji,"data-testid":`${y}-label`,children:e}),$]}):$};dl.displayName="AdminTextField";const jf=1440,xt=e=>String(e).padStart(2,"0"),ul=e=>e.toLowerCase().replace(/[\s.]/g,"");function Na(e){const[a=0,s=0]=e.split(":").map(Number);return a*60+s}function wf(e){return`${xt(Math.floor(e/60))}:${xt(e%60)}`}function ps(e){const a=/^(\d{1,2}):?(\d{2})?(?:(a|p)m?)?$/.exec(ul(e));if(!a)return null;let s=Number(a[1]);const n=Number(a[2]??0),r=a[3];if(n>59)return null;if(r){if(s<1||s>12)return null;s=s%12+(r==="p"?12:0)}else{if(s>23)return null;s>=1&&s<=6&&(s+=12)}return`${xt(s)}:${xt(n)}`}function Nf(e,a,s){const n=Math.floor(s);if(!(n>=1))return[];const r=[],i=Math.min(Na(a),jf-1);for(let c=Na(e);c<=i;c+=n)r.push(wf(c));return r}function ar(e,a){return a.includes(":")?e.startsWith(a):e.replace(":","").startsWith(a)}function Cf(e,a){const s=/^([\d:]*)(?:(a|p)m?)?$/.exec(ul(a));if(!s)return!1;const[,n="",r]=s,[i=0,c=0]=e.split(":").map(Number),l=`${i%12||12}:${xt(c)}`;return r?r==="p"!=i>=12?!1:ar(l,n):[l,`${xt(i)}:${xt(c)}`,`${i}:${xt(c)}`].some(d=>ar(d,n))}const sr=new Map;function nr(e,a){let s=sr.get(a);s||(s=new Intl.DateTimeFormat(a,{hour:"numeric",minute:"2-digit"}),sr.set(a,s));const[n=0,r=0]=e.split(":").map(Number);return s.format(new Date(2e3,0,1,n,r)).replace(/[\u00a0\u202f]/g," ")}const Ut=(e,a)=>a===void 0||Na(e)>=Na(a);function ml({value:e,defaultValue:a=null,onChange:s,label:n,"aria-label":r,placeholder:i,emptyContent:c,invalidMessage:l,minTime:d,minTimeMessage:u,listStart:f="07:00",listEnd:m="21:00",listStep:b=30,locale:x="en-US",isRequired:g=!1,isDisabled:j=!1,isInvalid:y=!1,errorMessage:v,isClearable:C=!1,clearLabel:S,onBlur:k,size:$,variant:_="bordered",labelPlacement:w="outside-top",className:F,inputProps:A,popoverProps:M,"data-testid":E="time-field"}){const[D,I]=Rt(e,a,s),B=se=>se?nr(se,x):"",z=B(D),[q,P]=h.useState(z),[ee,W]=h.useState(null),[Y,K]=h.useState(!1),[ie,te]=h.useState(z);z!==ie&&(te(z),P(z),W(null));const Q=q.trim()!==""&&q!==z,ne=Q?ps(q):null,V=Q?"typed":q.trim()===""&&!Y?"none":"all",O=Q?q:"",Z=h.useMemo(()=>Nf(f,m,b),[f,m,b]),Re=h.useMemo(()=>{const se=Z.filter(L=>Ut(L,d));let N;if(V==="typed"){const L=se.filter(H=>Cf(H,O)),R=ps(O);N=R!==null&&Ut(R,d)?[R,...L.filter(H=>H!==R)]:L}else V==="none"?N=[]:D!==null&&Ut(D,d)&&!se.includes(D)?N=[...se,D].sort():N=se;return N.map(L=>({key:L,label:nr(L,x)}))},[Z,d,V,O,D,x]),De=h.useCallback(se=>t.jsx(o.AutocompleteItem,{textValue:se.label,"data-testid":`${E}-option-${se.key}`,children:se.label},se.key),[E]),Ee=!Q&&D!==null&&Re.some(se=>se.key===D)?D:null,ae=se=>{W(null),I(se),P(B(se))},be=()=>{if(q.trim()===""){C?ae(null):(P(z),W(null));return}Q&&(ne===null?W("invalid"):Ut(ne,d)?ae(ne):W("min"))},$e=h.useRef(!1),ge=se=>{se!==null&&($e.current=!0,queueMicrotask(()=>{$e.current=!1}),ae(String(se)))},We=D!==null&&!Ut(D,d),Le=ee??(We?"min":null),oe=Le!==null||y,de=Le==="invalid"?l:Le==="min"?u??l:v;return t.jsx(o.Autocomplete,{label:n,"aria-label":r,labelPlacement:w,placeholder:i,size:$,variant:_,className:F,"data-testid":E,allowsCustomValue:!0,isClearable:C,onClear:C?()=>ae(null):void 0,clearButtonProps:C&&S?{"aria-label":S}:void 0,isRequired:g,isDisabled:j,isInvalid:oe,errorMessage:oe?de:void 0,validationBehavior:"aria",items:Re,inputValue:q,onInputChange:se=>{P(se),K(!1),ee&&W(null)},selectedKey:Ee,onSelectionChange:ge,onOpenChange:(se,N)=>K(se&&(N==="focus"||N==="manual")),onBlur:se=>{be(),k?.(se)},onKeyDown:se=>{se.key==="Enter"&&!$e.current&&be(),(se.key==="ArrowDown"||se.key==="ArrowUp")&&K(!0),"continuePropagation"in se&&se.continuePropagation()},inputProps:A,popoverProps:M,listboxProps:{emptyContent:c},children:De})}ml.displayName="TimeField";const fl=({children:e,placeholder:a="Select…",onOpen:s,onClear:n,ariaLabel:r,icon:i,trailingIcon:c,clearIcon:l,disabled:d=!1,className:u,"data-testid":f="picker-row"})=>{const m=e!=null;return t.jsxs("div",{"data-testid":f,className:o.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(p.Button,{variant:"light",radius:"none",disableAnimation:!0,onPress:s,isDisabled:d,"aria-haspopup":"dialog","aria-label":r,"data-testid":`${f}-trigger`,className:"flex h-auto min-h-0 min-w-0 flex-1 items-center justify-start gap-2.5 bg-transparent px-0 py-2 text-left text-inherit data-[hover=true]:bg-transparent",children:[i?t.jsx("span",{className:"flex shrink-0 text-acct-muted",children:i}):null,m?t.jsx("span",{className:"flex min-w-0 items-center gap-2",children:e}):t.jsx("span",{className:"text-[13.5px] font-semibold text-acct-sub",children:a}),c?t.jsx("span",{className:"ml-auto flex shrink-0 text-acct-muted",children:c}):null]}),m&&n?t.jsx(p.Button,{isIconOnly:!0,variant:"light",radius:"sm",size:"sm",onPress:n,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]})};fl.displayName="PickerRow";const Fe={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"},kf={default:void 0,primary:"text-primary-800",success:void 0,warning:"text-warning-800",danger:void 0},Sf={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"}},xl={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"}},$f={md:void 0,lg:"min-h-12 text-base"},Af={none:"",sm:"gap-1",md:"gap-2"},pl="m-0 flex list-none flex-col p-0",Dt={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"]},hl=h.createContext(!1),Df=()=>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"})}),Ef=()=>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 Lf(e){const a=e.trim().split(/\s+/).filter(Boolean);if(a.length===0)return"—";const s=a[0]?.charAt(0)??"",n=a.length>1?a[a.length-1]?.charAt(0)??"":"";return`${s}${n}`.toUpperCase()}const bl=({title:e,subtitle:a,leading:s,tags:n,onPress:r,href:i,linkAs:c,"aria-haspopup":l,trailing:d,showChevron:u=!1,chevronIcon:f,actions:m,actionsLabel:b,actionsIcon:x,size:g,variant:j="plain",isDisabled:y=!1,as:v,className:C,"data-testid":S="entity-row"})=>{const k=h.useContext(hl),$=Sa(),_=g??($==="touch"?"lg":"md"),w=xl[_],F=Sf[j],A=v??(k?"li":"div"),M=h.useId(),E=h.useId(),D=h.useId(),I=h.useId(),B=i!==void 0||r!==void 0,z=n!==void 0&&n.length>0,q=p.hasContent(a),P=m!==void 0&&m.length>0,ee=typeof e=="string"?e:void 0,W=P&&m.some(O=>p.hasContent(O.description)),Y=P?m.filter(O=>O.isDisabled===!0&&p.hasContent(O.description)).map(O=>`${O.label}: ${O.description}`).join(" "):"",K=s?t.jsx(o.Avatar,{"aria-hidden":"true",size:w.avatar,radius:s.shape==="square"?"lg":"full",src:s.src,icon:s.icon,name:s.icon!==void 0?void 0:s.initials??s.name??ee,getInitials:s.initials!==void 0?O=>O:Lf,showFallback:s.src!==void 0,classNames:{base:Fe.avatar},"data-testid":`${S}-leading`}):null,ie=t.jsxs(t.Fragment,{children:[K,t.jsxs("span",{className:Fe.text,children:[t.jsxs("span",{className:Fe.titleLine,children:[t.jsx("span",{id:M,className:o.cn(Fe.title,w.title),title:ee,children:e}),z&&t.jsx("span",{id:E,className:Fe.tags,children:n.map(O=>t.jsx(o.Chip,{size:"sm",variant:"flat",color:O.tone??"default",className:kf[O.tone??"default"],"data-testid":`${S}-tag-${O.key}`,children:O.label},O.key))})]}),q&&t.jsx("span",{id:D,className:o.cn(Fe.subtitle,w.subtitle),children:a})]})]}),te=[z?E:null,q?D:null].filter(Boolean).join(" "),Q={"aria-labelledby":M,"aria-describedby":te===""?void 0:te,isDisabled:y,className:o.cn(Fe.pressTarget,F.overlay,w.content)},ne=`${S}-trigger`;let V;return i!==void 0?V=t.jsx(o.Link,{...Q,"data-testid":ne,as:c,href:i,color:"foreground",underline:"none",onPress:r,children:ie}):r!==void 0?V=t.jsx(p.Button,{...Q,testId:ne,variant:"light",color:"default",radius:"none",disableAnimation:!0,disableRipple:!0,"aria-haspopup":l,onPress:r,children:ie}):V=t.jsx("div",{className:o.cn(Fe.content,w.content),children:ie}),t.jsxs(A,{"data-testid":S,"data-size":_,"data-disabled":y||void 0,className:o.cn(Fe.base,F.row,w.row,B&&!y&&F.hover,C),children:[V,(p.hasContent(d)||P)&&t.jsxs("div",{className:Fe.side,children:[d,P&&t.jsxs(o.Dropdown,{placement:"bottom-end",children:[t.jsx(o.DropdownTrigger,{children:t.jsx(p.Button,{isIconOnly:!0,size:w.control,variant:"light",color:"default",radius:"full",isDisabled:y,"aria-label":b,"aria-describedby":Y===""?void 0:I,testId:`${S}-menu-trigger`,className:Fe.menuTrigger,children:x??t.jsx(Ef,{})})}),t.jsx(o.DropdownMenu,{"aria-label":b,"data-testid":`${S}-menu`,className:W?Fe.menuWithDescriptions:void 0,disabledKeys:m.filter(O=>O.isDisabled).map(O=>O.key),onAction:O=>{m.find(Z=>Z.key===O)?.onAction()},items:m,children:O=>{const Z=O.isDisabled===!0&&p.hasContent(O.description);return t.jsx(o.DropdownItem,{textValue:O.label,description:O.description,color:O.tone==="danger"?"danger":"default",className:o.cn(O.tone==="danger"&&Fe.dangerItem,$f[_],Z&&Fe.menuItemDisabledWithDescription),classNames:{title:Z?Fe.menuItemDimmed:void 0,description:o.cn(Fe.menuItemDescription,w.subtitle)},startContent:Z&&O.icon!==void 0?t.jsx("span",{className:Fe.menuItemDimmedIcon,children:O.icon}):O.icon,"data-testid":O["data-testid"]??`${S}-menu-${O.key}`,children:O.label},O.key)}})]}),Y!==""&&t.jsx("span",{id:I,hidden:!0,"data-testid":`${S}-menu-trigger-description`,children:Y})]}),u&&t.jsx("span",{"aria-hidden":"true",className:Fe.chevron,"data-testid":`${S}-chevron`,children:f??t.jsx(Df,{})})]})};bl.displayName="EntityRow";const gl=({children:e,"aria-label":a,"aria-labelledby":s,gap:n="none",className:r,"data-testid":i="entity-list"})=>t.jsx("ul",{"aria-label":a,"aria-labelledby":s,"data-testid":i,className:o.cn(pl,Af[n],r),children:t.jsx(hl.Provider,{value:!0,children:e})});gl.displayName="EntityList";const yl=({label:e,rows:a=6,size:s,className:n,"data-testid":r="entity-list-skeleton"})=>{const i=Sa(),c=s??(i==="touch"?"lg":"md"),{titleWidths:l}=Dt;return t.jsxs("div",{"aria-busy":"true","data-testid":r,className:n,children:[t.jsx("span",{role:"status",className:"sr-only",children:e}),t.jsx("ul",{"aria-hidden":"true",className:pl,children:Array.from({length:a},(d,u)=>t.jsxs("li",{"data-testid":`${r}-row`,className:o.cn(Dt.row,xl[c].row),children:[t.jsx(p.Skeleton,{className:Dt.avatar[c]}),t.jsxs("span",{className:Dt.lines,children:[t.jsx(p.Skeleton,{className:o.cn(Dt.title,l[u%l.length])}),t.jsx(p.Skeleton,{className:Dt.subtitle})]})]},u))})]})};yl.displayName="EntityListSkeleton";function vl(e,a,s){if(s<=0||a<=0||e<=0)return{from:0,to:0};const n=(e-1)*a+1;return n>s?{from:0,to:0}:{from:n,to:Math.min(s,e*a)}}const jl=({page:e,pageSize:a,total:s,unit:n,announce:r=!0,format:i,className:c,classNames:l={},"data-testid":d="pagination-summary"})=>{const{from:u,to:f}=vl(e,a,s),m=o.cn("font-semibold text-default-700",l.emphasis);return t.jsx("p",{"data-testid":d,"aria-live":r?"polite":void 0,className:o.cn("text-sm text-default-500",c,l.base),children:i?i({from:u,to:f,total:s}):t.jsxs(t.Fragment,{children:["Showing"," ",t.jsx("span",{"data-testid":`${d}-range`,className:m,children:u===0?0:`${u}–${f}`})," ","of"," ",t.jsx("span",{"data-testid":`${d}-total`,className:m,children:s}),n?t.jsxs(t.Fragment,{children:[" ",n]}):null]})})};jl.displayName="PaginationSummary";const Fa="shadow-[0_1px_4px_rgba(0,0,0,.06),0_4px_12px_rgba(0,0,0,.06)]",rt={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"},Ff={card:Fa,flat:""},_f={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]"},Rf={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:""}},wl=({isLoading:e=!1,isError:a=!1,isEmpty:s=!1,loadingTitle:n="Loading…",loadingContent:r,errorTitle:i="Something went wrong",errorDescription:c,retryLabel:l="Retry",onRetry:d,errorActions:u,errorContent:f,emptyTitle:m="Nothing here yet",emptyDescription:b,emptyIcon:x,emptyActions:g,emptyContent:j,children:y,toolbar:v,variant:C="default",className:S,classNames:k={},"data-testid":$="list-panel"})=>{const _=C==="framed",w={base:o.cn("border-0 bg-transparent py-12",k.state)},F=_?{base:o.cn("px-6 py-[3.625rem]",k.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"}:w;let A;return e?A=r??t.jsx(Ps,{title:n,classNames:w,"data-testid":`${$}-loading`}):a?A=f??t.jsx(Bs,{title:i,description:c,classNames:w,"data-testid":`${$}-error`,actions:u??(d?t.jsx(p.Button,{color:"primary",variant:"flat",onPress:d,children:l}):void 0)}):s?A=j??t.jsx(Ms,{surface:_?"panel":void 0,title:m,description:b,icon:x,actions:g,classNames:F,"data-testid":`${$}-empty`}):A=y,t.jsxs("section",{"data-testid":$,"data-variant":_?"framed":void 0,className:o.cn(_?`overflow-hidden rounded-2xl border border-pos-line bg-white ${Fa}`:"rounded-xl bg-white p-2 shadow-sm",S,k.base),children:[v,A]})};wl.displayName="ListPanel";const Ks=(e,a)=>a<=0?/^\d*$/.test(e):new RegExp(`^\\d*(?:[.,]\\d{0,${a}})?$`).test(e),Xt=e=>{const a=Number.parseFloat(e.replace(",","."));return Number.isFinite(a)?a:null},Nl=(e,a)=>{const[s,n]=h.useState(()=>a(e)),r=(Xt(s)??0)===(e??0)?s:a(e),i=h.useCallback(()=>{n(c=>{const l=Xt(c);return l===null?"":String(l)})},[]);return{draft:r,setDraft:n,normalize:i}},If=/^[\d.,]+$/,Cl=(e,a=Object.is)=>{const s=h.useRef(e),n=h.useRef(null);h.useLayoutEffect(()=>{s.current=e},[e]);const r=h.useCallback(()=>{const l=n.current,d=s.current;return l===null||!(a(d,l.source)||a(d,l.emitted))},[a]),i=h.useCallback(l=>{n.current={source:s.current,emitted:l}},[]),c=h.useCallback(()=>{n.current=null},[]);return h.useMemo(()=>({isUntouched:r,markEdited:i,markUntouched:c}),[r,i,c])},kl=(e,a)=>{const s=h.useRef(null),n=h.useRef(a);return h.useLayoutEffect(()=>{n.current=a},[a]),h.useEffect(()=>{const r=s.current;if(!r)return;const i=l=>{e()&&(l.inputType==="insertText"&&l.data&&If.test(l.data)?(l.preventDefault(),n.current(l.data)):l.inputType.startsWith("delete")&&(l.preventDefault(),n.current("")))},c=()=>{requestAnimationFrame(()=>{r.isConnected&&e()&&r.select()})};return r.addEventListener("beforeinput",i),r.addEventListener("pointerup",c),()=>{r.removeEventListener("beforeinput",i),r.removeEventListener("pointerup",c)}},[e]),s},Mf=350,Bf={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}"},Pf=7,Tf=e=>[...new Set((e??[]).filter(a=>Number.isFinite(a)&&a>0))].sort((a,s)=>a-s).slice(0,Pf),Of=(e,a,s)=>{if(!Number.isInteger(e))return fe(e,a,s);try{return new Intl.NumberFormat(a,{style:"currency",currency:s,minimumFractionDigits:0}).format(e)}catch{return fe(e,a,s)}},zf=(e,a)=>(e??0)===(a??0),Ht=(e,a)=>Object.entries(a).reduce((s,[n,r])=>s.replace(`{${n}}`,r),e),Vf=({dueAmount:e,received:a,defaultReceived:s=null,onChange:n,locale:r="en-US",labels:i,isDisabled:c=!1,maxAmount:l,quickAmounts:d,showExactAmount:u=!0,autoFocus:f=!1,className:m,"data-testid":b="cash-tender-form"})=>{const x={...Bf,...i},g=It(e.currency,r),j=a!==void 0,[y,v]=h.useState(s??null),C=j?a:y,{draft:S,setDraft:k,normalize:$}=Nl(C,V=>V==null?"":String(V)),{isUntouched:_,markEdited:w,markUntouched:F}=Cl(C,zf),A=h.useMemo(()=>{const V=typeof C=="number"&&Number.isFinite(C)?C:0,O=ls(V,e.value,e.currency,r);return{received:V,change:O>0?O:0,isValid:V>=e.value&&V>0}},[C,e.value,e.currency,r]),M=h.useCallback(V=>{const O=V.currentTarget;requestAnimationFrame(()=>{O.isConnected&&O.select()})},[]),E=h.useCallback(V=>{j||v(V);const O=typeof V=="number"&&Number.isFinite(V)?V:0,Z=ls(O,e.value,e.currency,r);n?.({received:O,change:Z>0?Z:0,isValid:O>=e.value&&O>0})},[j,e.value,e.currency,r,n]),D=h.useCallback(V=>{if(c)return;const O=V.replace(/[^\d.,]/g,"");if(!Ks(O,g))return;const Z=Xt(O);Z!==null&&l!==void 0&&Z>l||(k(O),w(Z),E(Z))},[c,l,k,w,g,E]),I=kl(_,D),B=h.useMemo(()=>Tf(d),[d]),z=V=>l!==void 0&&V>l,q=()=>{c||z(e.value)||(k(String(e.value)),F(),E(e.value))},P=V=>{if(c)return;const O=_()||typeof C!="number"||!Number.isFinite(C)?0:C,Z=Ss(O+V,e.currency,r);z(Z)||(k(String(Z)),w(Z),E(Z))},ee=A.isValid&&A.change>0,W=!A.isValid&&A.received>0,Y=fe(A.change,r,e.currency),K=fe(e.value,r,e.currency),[ie,te]=h.useState(""),Q=h.useRef(null);h.useEffect(()=>{Q.current&&clearTimeout(Q.current);const V=ee?Ht(x.changeMessageTemplate,{change:Y}):"",O=ee?Mf:0;return Q.current=setTimeout(()=>te(V),O),()=>{Q.current&&clearTimeout(Q.current)}},[ee,Y,x.changeMessageTemplate]);const ne=`${b}-received`;return t.jsxs("div",{className:o.cn("flex flex-col gap-3",m),"data-testid":b,children:[t.jsx(o.Input,{ref:I,id:ne,label:x.receivedLabel,labelPlacement:"outside",type:"text",inputMode:g===0?"numeric":"decimal",pattern:g===0?"[0-9]*":"[0-9]*[.,]?[0-9]*",value:S,onChange:V=>D(V.target.value),onFocus:M,onBlur:$,placeholder:x.receivedPlaceholder,isDisabled:c,isInvalid:W,errorMessage:W?Ht(x.insufficientMessageTemplate,{due:K}):void 0,variant:"bordered",radius:"lg",autoFocus:f,"data-testid":`${b}-received-input`}),B.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":`${b}-quick-amounts`,children:[u&&t.jsxs(p.Button,{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:c,"aria-label":Ht(x.exactAmountAriaTemplate,{amount:K}),onPress:q,"data-testid":`${b}-quick-amount-exact`,children:[x.exactAmountLabel," ",K]}),B.map(V=>{const O=Of(V,r,e.currency);return t.jsx(p.Button,{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:c,"aria-label":Ht(x.quickAmountAriaTemplate,{amount:O}),onPress:()=>P(V),"data-testid":`${b}-quick-amount-${V}`,children:O},V)})]})}),ee&&t.jsx(o.Alert,{"data-testid":`${b}-change-alert`,color:"primary",variant:"flat",radius:"lg",title:x.changeLabel,description:Ht(x.changeMessageTemplate,{change:Y}),icon:t.jsx(p.Icon,{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:ie})]})},Uf={checkNumberLabel:"Check Number",checkNumberPlaceholder:"e.g. 11234",bankNameLabel:"Bank Name",bankNamePlaceholder:"e.g. Chase Bank",dateLabel:"Date",checkNumberRequiredMessage:"Check number is required"},rr=()=>{const e=new Date,a=s=>String(s).padStart(2,"0");return`${e.getFullYear()}-${a(e.getMonth()+1)}-${a(e.getDate())}`},Sl=({dueAmount:e,value:a,defaultValue:s,onChange:n,labels:r,hideDate:i=!1,hideBankName:c=!1,isDisabled:l=!1,checkNumberMaxLength:d=34,bankNameMaxLength:u=100,autoFocus:f=!1,className:m,"data-testid":b="check-tender-form"})=>{const x={...Uf,...r},g=a!==void 0,[j,y]=h.useState({checkNumber:s?.checkNumber??"",bankName:s?.bankName??"",date:s?.date??rr()}),[v,C]=h.useState(!!s?.checkNumber),S=h.useMemo(()=>g?{checkNumber:a?.checkNumber??"",bankName:a?.bankName??"",date:a?.date??rr()}:j,[g,a,j]),k=h.useCallback(E=>{g||y(E);const D=E.checkNumber.trim(),I={amount:e.value,checkNumber:D,bankName:E.bankName.trim()||void 0,date:i?void 0:E.date,isValid:D.length>0&&e.value>0};n?.(I)},[g,e.value,i,n]),$=h.useCallback(E=>D=>{l||(E==="checkNumber"&&D.length>0&&C(!0),k({...S,[E]:D}))},[S,k,l]),_=h.useCallback(()=>{l||C(!0)},[l]),w=v&&S.checkNumber.trim()==="",F=`${b}-check-number`,A=`${b}-bank-name`,M=`${b}-date`;return t.jsxs("div",{className:o.cn("grid grid-cols-1 sm:grid-cols-2 gap-4",m),"data-testid":b,children:[t.jsx(o.Input,{id:F,label:x.checkNumberLabel,labelPlacement:"outside",type:"text",value:S.checkNumber,onChange:E=>$("checkNumber")(E.target.value),onBlur:_,placeholder:x.checkNumberPlaceholder,maxLength:d,isRequired:!0,isInvalid:w,errorMessage:w?x.checkNumberRequiredMessage:void 0,isDisabled:l,variant:"bordered",radius:"lg",autoFocus:f,"data-testid":`${b}-check-number-input`}),!c&&t.jsx(o.Input,{id:A,label:x.bankNameLabel,labelPlacement:"outside",type:"text",value:S.bankName,onChange:E=>$("bankName")(E.target.value),placeholder:x.bankNamePlaceholder,maxLength:u,isDisabled:l,variant:"bordered",radius:"lg","data-testid":`${b}-bank-name-input`}),!i&&t.jsx(o.Input,{id:M,label:x.dateLabel,labelPlacement:"outside",type:"date",value:S.date,onChange:E=>$("date")(E.target.value),isDisabled:l,variant:"bordered",radius:"lg","data-testid":`${b}-date-input`,className:"sm:col-span-2"})]})};Sl.displayName="CheckTenderForm";const Hf={methodLabel:"Method",methodPlaceholder:"Select a payment method",referenceLabel:"Reference",referencePlaceholder:"e.g. Voucher #1234",methodRequiredMessage:"Method is required"},Wf=[{value:"ach",label:"ACH"},{value:"wire",label:"Wire"},{value:"gift_card",label:"Gift Card"},{value:"voucher",label:"Voucher"},{value:"other",label:"Other"}],$l=({dueAmount:e,methodOptions:a=Wf,value:s,defaultValue:n,onChange:r,labels:i,showReference:c=!1,isDisabled:l=!1,className:d,"data-testid":u="other-tender-form"})=>{const f={...Hf,...i},m=s!==void 0,[b,x]=h.useState({method:n?.method??"",reference:n?.reference??""}),g=h.useMemo(()=>m?{method:s?.method??"",reference:s?.reference??""}:b,[m,s,b]),j=h.useCallback($=>a.find(_=>_.value===$)?.label??"",[a]),y=h.useCallback($=>{m||x($);const _=j($.method),w={amount:e.value,method:$.method,description:_,reference:$.reference.trim()||void 0,isValid:$.method!==""};r?.(w)},[m,e.value,r,j]),v=h.useCallback($=>{if(l)return;const _=typeof $=="string"?$:Array.from($)[0]?.toString()??"";y({...g,method:_})},[g,y,l]),C=h.useCallback($=>{l||y({...g,reference:$})},[g,y,l]),S=`${u}-method`,k=`${u}-reference`;return t.jsxs("div",{className:o.cn("flex flex-col gap-3",d),"data-testid":u,children:[t.jsx(p.Select,{id:S,label:f.methodLabel,labelPlacement:"outside",placeholder:f.methodPlaceholder,selectedKeys:g.method?[g.method]:[],onSelectionChange:v,isDisabled:l,isRequired:!0,variant:"bordered",radius:"lg","data-testid":`${u}-method-select`,popoverProps:{placement:"bottom-start",classNames:{content:"bg-white border border-default-200 shadow-lg rounded-xl p-1"}},listboxProps:{classNames:{list:"max-h-[var(--popover-available-height,40vh)] overflow-y-auto"},itemClasses:{base:["rounded-lg","px-3 py-2","text-default-800","data-[hover=true]:bg-default-100","data-[selectable=true]:focus:bg-default-100","data-[selected=true]:bg-primary-50","data-[selected=true]:text-primary","data-[selected=true]:font-medium"]}},children:a.map($=>t.jsx(o.SelectItem,{"data-testid":`${u}-method-option-${$.value}`,children:$.label},$.value))}),c&&t.jsx(o.Input,{id:k,label:f.referenceLabel,labelPlacement:"outside",type:"text",value:g.reference,onChange:$=>C($.target.value),placeholder:f.referencePlaceholder,isDisabled:l,variant:"bordered",radius:"lg","data-testid":`${u}-reference-input`})]})};$l.displayName="OtherTenderForm";const qf={collectedHeading:"Collected",remainingLabel:"Remaining:",completeLabel:"Complete",removeAriaLabel:"Remove this tender",removeTooltipForRecorded:"Already recorded",statusPending:"Pending",statusRecorded:"Approved",statusFailed:"Failed"},Gf={card:"lucide:credit-card",cash:"lucide:dollar-sign",check:"lucide:edit-3",other:"lucide:more-horizontal"},Kf={pending:"warning",recorded:"success",failed:"danger"},Yf=e=>e==="pending"||e==="recorded",Zf=e=>`#${e+1}`,Al=({total:e,tenders:a,onRemove:s,locale:n="en-US",labels:r,hideCollectedList:i=!1,variant:c="banner",className:l,"data-testid":d="split-payment-summary"})=>{const u={...qf,...r},{collected:f,remaining:m,isComplete:b}=h.useMemo(()=>{const g=a.reduce((y,v)=>Yf(v.status)?y+v.amount:y,0),j=Math.max(e.value-g,0);return{collected:g,remaining:j,isComplete:g>=e.value&&e.value>0}},[a,e.value]),x=g=>g==="pending"?u.statusPending:g==="recorded"?u.statusRecorded:u.statusFailed;return t.jsxs("div",{className:o.cn("flex flex-col gap-4",l),"data-testid":d,children:[c==="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:b?u.completeLabel:u.remainingLabel}),t.jsx("span",{className:"text-base font-semibold tracking-tight","data-testid":`${d}-remaining-amount`,children:fe(b?f:m,n,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:b?u.completeLabel:u.remainingLabel}),t.jsx("div",{className:"mt-1 text-4xl font-bold tracking-tight","data-testid":`${d}-remaining-amount`,children:fe(b?f:m,n,e.currency)})]}),!i&&a.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}),a.map((g,j)=>t.jsx(Qf,{index:j,tender:g,locale:n,currency:e.currency,removable:!!s&&g.status!=="recorded",onRemove:s?()=>s(g.id):void 0,statusLabel:x(g.status),removeAriaLabel:u.removeAriaLabel,recordedTooltip:u.removeTooltipForRecorded,dataTestId:`${d}-row-${j}`},g.id))]})]})};Al.displayName="SplitPaymentSummary";const Qf=({index:e,tender:a,locale:s,currency:n,removable:r,onRemove:i,statusLabel:c,removeAriaLabel:l,recordedTooltip:d,dataTestId:u})=>{const f=i?t.jsx(p.Button,{isIconOnly:!0,variant:"light",radius:"full",size:"sm",onPress:i,isDisabled:!r,"aria-label":l,"data-testid":`${u}-remove`,className:o.cn(r?"text-default-700 hover:bg-default-200":"text-default-300"),children:t.jsx(p.Icon,{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:Zf(e)}),t.jsx(p.Icon,{icon:Gf[a.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:a.label}),t.jsx("span",{className:"font-semibold tabular-nums","data-testid":`${u}-amount`,children:fe(a.amount,s,n)}),t.jsx(o.Chip,{size:"sm",radius:"full",variant:"flat",color:Kf[a.status],startContent:a.status==="recorded"?t.jsx(p.Icon,{icon:"lucide:check-circle",width:14,height:14,"aria-hidden":"true"}):a.status==="failed"?t.jsx(p.Icon,{icon:"lucide:alert-circle",width:14,height:14,"aria-hidden":"true"}):void 0,"data-testid":`${u}-status`,children:c}),f&&(r?f:t.jsx(o.Tooltip,{content:d,placement:"left",children:t.jsx("span",{tabIndex:0,"aria-label":d,children:f})}))]})},Xf=`
|
|
17
17
|
@keyframes pp-modal-in {
|
|
18
18
|
from { opacity: 0; transform: scale(0.96); }
|
|
19
19
|
to { opacity: 1; transform: scale(1); }
|
|
@@ -38,5 +38,5 @@ ${s}${n}
|
|
|
38
38
|
from { opacity: 0; transform: translateY(-6px); }
|
|
39
39
|
to { opacity: 1; transform: translateY(0); }
|
|
40
40
|
}
|
|
41
|
-
`,Al=h.forwardRef(({children:e,relativeOverlayRoot:a=!0,className:s,style:n,"data-testid":r="modal-shell"},i)=>t.jsxs(t.Fragment,{children:[t.jsx("style",{children:Zf}),t.jsx("div",{ref:i,"data-testid":r,style:n,className:o.cn("flex flex-col gap-4 p-4 rounded-3xl bg-white shadow-xl","md:gap-5 md:p-6",a&&"relative","motion-safe:animate-[pp-modal-in_220ms_ease-out]","motion-safe:transition-[min-height] motion-safe:duration-[420ms] motion-safe:ease-in-out",s),children:e})]}));Al.displayName="ModalShell";const Dl=({title:e,subtitle:a,leading:s,titleClassName:n,onClose:r,closeLabel:i="Close",actions:c,className:l,"data-testid":d="modal-shell-header"})=>t.jsxs("header",{className:o.cn("flex items-center justify-between gap-3",l),"data-testid":d,children:[t.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[s,t.jsxs("div",{className:"min-w-0",children:[t.jsx("h2",{className:o.cn("text-xl font-semibold",n),"data-testid":`${d}-title`,children:e}),a&&t.jsx("div",{className:"text-xs font-semibold text-default-500","data-testid":`${d}-subtitle`,children:a})]})]}),t.jsxs("div",{className:"flex items-center gap-2",children:[c,r&&t.jsx(p.Button,{isIconOnly:!0,variant:"light",radius:"full",size:"sm",onPress:r,"aria-label":i,"data-testid":`${d}-close`,children:t.jsx(p.Icon,{icon:"lucide:x",width:20,height:20,"aria-hidden":"true"})})]})]});Dl.displayName="ModalShellHeader";const El=({children:e,columns:a=2,className:s,"data-testid":n="modal-shell-footer"})=>t.jsx("footer",{className:o.cn("mt-2 gap-3",a===2?"flex flex-col md:grid md:grid-cols-2 [&>*]:w-full [&>*:first-child]:md:order-2 [&>*:nth-child(2)]:md:order-1":"grid grid-cols-1",s),"data-testid":n,children:e});El.displayName="ModalShellFooter";const Qf={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"},Xf={1:"grid-cols-1",2:"grid-cols-2"},yt={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 ${p.stillTransitionClass} 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"},Ve={tile:`flex flex-col items-center justify-center gap-2 h-auto min-h-20 px-4 py-4 border bg-transparent transition-colors ${p.stillTransitionClass}`,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"},ca=e=>typeof e=="string"?t.jsx(p.Icon,{icon:e,width:20,height:20,"aria-hidden":"true"}):e,Jf=(e,a,s)=>{const n=`${e}-${a.key}`;return{badge:s&&a.badge!==void 0?`${n}-badge`:void 0,reason:`${n}-reason`,description:s&&a.description!==void 0?`${n}-description`:void 0}},ex=e=>t.jsx("span",{"aria-hidden":"true",className:yt.icon,children:typeof e=="string"?t.jsx(p.Icon,{icon:e,width:"100%",height:"100%","aria-hidden":"true"}):e}),da=`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 ${p.stillTransitionClass}`,tx="pointer-events-none absolute -left-[9999px] top-0 flex flex-row gap-1 p-1 opacity-0",rr="flex-none",ax=typeof window<"u"?h.useLayoutEffect:h.useEffect,ir=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",Ll=({options:e,selectedKey:a,onSelect:s,heading:n,ariaLabel:r="Select an option",variant:i="tiles",maxVisible:c,moreLabel:l="More",columnsDesktop:d=3,columnsMobile:u=2,size:x="md",className:m,"data-testid":b="tile-select"})=>{const f=x==="sm",g=e.find(v=>v.key===a),j=e.some(v=>v.badge!==void 0||v.isLocked===!0),y=!f&&j;return i==="compact"?t.jsx(sx,{options:e,selectedKey:a,onSelect:s,ariaLabel:r,moreLabel:l,dataTestId:b,...n!==void 0?{heading:n}:{},...c!==void 0?{maxVisible:c}:{},...m!==void 0?{className:m}:{}}):t.jsxs("div",{className:o.cn("flex flex-col gap-3",m),"data-testid":b,children:[n&&t.jsx("h3",{className:"text-sm font-medium text-default-700",id:`${b}-heading`,children:n}),t.jsx("div",{className:"md:hidden",children:t.jsx(p.Select,{"aria-label":n?void 0:r,"aria-labelledby":n?`${b}-heading`:void 0,selectedKeys:a?[a]:[],onSelectionChange:v=>{const S=Array.from(v)[0];typeof S=="string"&&s(S)},placeholder:r,variant:"bordered",radius:"lg","data-testid":`${b}-mobile-select`,startContent:g?t.jsx("span",{"aria-hidden":"true",className:"shrink-0",children:ca(g.icon)}):void 0,popoverProps:{placement:"bottom-start",classNames:{content:"bg-white border border-default-200 shadow-lg rounded-xl p-1"}},listboxProps:{classNames:{list:"max-h-[var(--popover-available-height,40vh)] overflow-y-auto"},itemClasses:{base:["rounded-lg","px-3 py-2","text-default-800","data-[hover=true]:bg-default-100","data-[selectable=true]:focus:bg-default-100","data-[selected=true]:bg-primary-50","data-[selected=true]:text-primary","data-[selected=true]:font-medium"]}},children:e.map(v=>t.jsx(o.SelectItem,{isDisabled:v.isDisabled||v.isLocked,...j&&v.description!==void 0?{description:v.description}:{},endContent:v.badge!==void 0?t.jsx("span",{className:Ve.badge,children:v.badge}):void 0,startContent:t.jsx("span",{"aria-hidden":"true",className:"shrink-0",children:ca(v.icon)}),"data-testid":v["data-testid"]??`${b}-${v.key}-mobile`,children:v.label},v.key))})}),t.jsx("div",{role:"group","aria-labelledby":n?`${b}-heading`:void 0,"aria-label":n?void 0:r,className:o.cn("hidden md:grid",f?yt.grid:"gap-3",Xf[u],Qf[d]),"data-size":x,children:e.map(v=>{const C=a===v.key,S=v.isLocked===!0&&v.isDisabled!==!0,k=v.lockedReason??v.badge,$=Jf(b,v,y),_=[$.badge,S&&k!==void 0&&(f||k!==v.badge)?$.reason:void 0,$.description].filter(Boolean).join(" ");return t.jsxs(p.Button,{variant:"bordered",radius:"lg","aria-pressed":C,"aria-label":v.label,"aria-disabled":S||void 0,"aria-describedby":_||void 0,isDisabled:v.isDisabled,onPress:()=>{S||s(v.key)},"data-testid":v["data-testid"]??`${b}-${v.key}`,"data-locked":S||void 0,className:f?o.cn(yt.tile,S?yt.locked:C?yt.active:yt.idle):o.cn(Ve.tile,y&&Ve.detailed,S?Ve.locked:C?Ve.active:Ve.idle),"data-size":x,children:[f?t.jsxs(t.Fragment,{children:[ex(v.icon),t.jsx("span",{className:yt.label,children:v.label})]}):y?t.jsxs(t.Fragment,{children:[t.jsxs("span",{className:Ve.header,children:[t.jsx("span",{"aria-hidden":"true",className:S?Ve.lockedIcon:void 0,children:ca(v.icon)}),v.badge!==void 0?t.jsx("span",{id:$.badge,className:Ve.badge,children:v.badge}):null]}),t.jsx("span",{className:Ve.label,children:v.label}),v.description!==void 0?t.jsx("span",{id:$.description,className:o.cn(Ve.description,S&&Ve.lockedDescription),children:v.description}):null]}):t.jsxs(t.Fragment,{children:[t.jsx("span",{"aria-hidden":"true",className:S?Ve.lockedIcon:void 0,children:ca(v.icon)}),t.jsx("span",{className:Ve.label,children:v.label})]}),S&&k!==void 0&&(f||k!==v.badge)?t.jsx("span",{id:$.reason,className:"sr-only",children:k}):null]},v.key)})})]})};Ll.displayName="TileSelect";function sx({options:e,selectedKey:a,onSelect:s,heading:n,ariaLabel:r,maxVisible:i,moreLabel:c,className:l,dataTestId:d}){const u=h.useRef(null),x=h.useRef(null),m=h.useMemo(()=>e.map((F,A)=>({option:F,index:A})).filter(({option:F})=>F.alwaysInMenu!==!0).map(({index:F})=>F),[e]),b=m.length<e.length,f=h.useCallback(F=>{const A=m.map(E=>({index:E,priority:e[E]?.priority??0})).sort((E,D)=>E.priority-D.priority||D.index-E.index),M=new Set(A.slice(0,m.length-F).map(E=>E.index));return m.filter(E=>!M.has(E))},[e,m]),[g,j]=h.useState(e.length);ax(()=>{const F=u.current,A=x.current;if(!F||!A)return;const M=()=>{const D=Array.from(A.children),I=D.slice(0,e.length).map(W=>W.getBoundingClientRect().width),B=D[e.length]?.getBoundingClientRect().width??0,z=window.getComputedStyle(F),q=Number.parseFloat(z.columnGap)||0,P=F.clientWidth-(Number.parseFloat(z.paddingLeft)||0)-(Number.parseFloat(z.paddingRight)||0);if(P<=0||I.some(W=>W===0)){j(m.length);return}const ee=W=>{const Y=b||W<m.length,K=W+(Y?1:0);return f(W).reduce((te,Q)=>te+(I[Q]??0),0)+(Y?B:0)+q*(K-1)<=P};for(let W=m.length;W>=1;W-=1)if(ee(W)){j(W);return}j(1)};M();const E=new ResizeObserver(M);return E.observe(F),()=>E.disconnect()},[e,c,f,m,b]);const y=Math.max(1,Math.min(g,i??m.length,m.length)),C=!b&&y===m.length-1&&g===m.length?m.length:y,S=b||C<m.length,k=new Set(f(C)),$=e.filter((F,A)=>k.has(A)),_=S?e.filter((F,A)=>!k.has(A)):[],w=_.find(F=>F.key===a);return t.jsxs("div",{className:o.cn("relative flex flex-col gap-3",l),"data-testid":d,children:[n&&t.jsx("h3",{className:"text-sm font-medium text-default-700",id:`${d}-heading`,children:n}),t.jsxs("div",{ref:u,role:"group","aria-labelledby":n?`${d}-heading`:void 0,"aria-label":n?void 0:r,className:"flex flex-row gap-1 rounded-full bg-default-100 p-1",children:[$.map(F=>t.jsx(p.Button,{variant:"light",radius:"full","aria-pressed":a===F.key,isDisabled:F.isDisabled||F.isLocked,onPress:()=>s(F.key),"data-testid":F["data-testid"]??`${d}-${F.key}`,className:o.cn(da,ir(a===F.key)),children:F.label},F.key)),_.length>0&&t.jsxs(o.Dropdown,{placement:"bottom-end",radius:"lg",children:[t.jsx(o.DropdownTrigger,{children:t.jsxs(p.Button,{variant:"light",radius:"full","aria-pressed":w!==void 0,"data-testid":`${d}-more`,className:o.cn(da,"gap-1",w!==void 0?"min-w-0":"min-w-fit",ir(w!==void 0)),children:[t.jsx("span",{className:"min-w-0 truncate",children:w?.label??c}),t.jsx(p.Icon,{icon:"lucide:chevron-down",width:14,height:14,"aria-hidden":"true"})]})}),t.jsx(o.DropdownMenu,{"aria-label":c,className:"w-64 p-2",selectionMode:"single",selectedKeys:w?[w.key]:[],disabledKeys:_.filter(F=>F.isDisabled||F.isLocked).map(F=>F.key),onAction:F=>s(String(F)),children:_.map(F=>t.jsx(o.DropdownItem,{textValue:F.label,...F.description!==void 0?{description:F.description}:{},"data-testid":F["data-testid"]??`${d}-${F.key}`,children:F.label},F.key))})]})]}),t.jsxs("div",{ref:x,"aria-hidden":"true",className:tx,children:[e.map(F=>t.jsx(p.Button,{variant:"light",radius:"full",tabIndex:-1,className:o.cn(da,rr),children:F.label},F.key)),t.jsxs(p.Button,{variant:"light",radius:"full",tabIndex:-1,className:o.cn(da,rr,"gap-1"),children:[c,t.jsx(p.Icon,{icon:"lucide:chevron-down",width:14,height:14})]})]})]})}const nx={subtle:{wrapper:"bg-default-100",amount:"text-default-900"},success:{wrapper:"bg-success-50 text-success-700",amount:"text-success-700"}},Fl=({total:e,label:a,locale:s="en-US",variant:n="subtle",className:r,"data-testid":i="payment-total-banner"})=>{const c=nx[n];return t.jsxs("div",{"data-testid":i,className:o.cn("rounded-2xl px-6 py-5 text-center",c.wrapper,r),children:[t.jsx("div",{className:"text-sm text-default-600",children:a}),t.jsx("div",{className:o.cn("mt-1 text-4xl font-bold tracking-tight",c.amount),"data-testid":`${i}-amount`,children:fe(e.value,s,e.currency)})]})};Fl.displayName="PaymentTotalBanner";const rx={white:"bg-white/70 backdrop-blur-sm",transparent:"bg-transparent"},_l=({title:e,subtitle:a,backdrop:s="white",exiting:n=!1,className:r,"data-testid":i="loading-overlay"})=>t.jsxs("div",{role:"status","aria-live":n?"off":"polite","aria-hidden":n||void 0,"data-testid":i,"data-state":n?"exiting":"visible",className:o.cn("absolute inset-0 z-10 flex flex-col items-center justify-center gap-4 rounded-3xl",rx[s],n?"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}),a&&t.jsx("div",{className:"mt-1 text-sm text-default-600",children:a})]})]});_l.displayName="LoadingOverlay";const Ks=({cashChange:e,label:a="Cash to return",secondaryLine:s,locale:n="en-US",onDismiss:r,dismissAriaLabel:i="Dismiss",align:c="left",className:l,"data-testid":d="payment-cash-change-banner"})=>{if(!e||e.value<=0)return null;const u=c==="center";return t.jsxs("div",{role:"status","aria-live":"polite","data-testid":d,className:o.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,{icon:"lucide:info",width:28,height:28,className:"shrink-0 text-info-700","aria-hidden":"true"}),t.jsxs("div",{className:o.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:a}),t.jsx("span",{className:"text-2xl font-bold text-info-700","data-testid":`${d}-amount`,children:fe(e.value,n,e.currency)}),s&&t.jsx("span",{className:"mt-0.5 text-xs text-info-700/80",children:s})]}),r&&t.jsx(p.Button,{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,{icon:"lucide:x",width:18,height:18,"aria-hidden":"true"})})]})};Ks.displayName="PaymentCashChangeBanner";const Rl=({title:e,subtitle:a,emailLine:s,confirmationEmail:n,cashChange:r,cashChangeLabel:i="Cash to return",locale:c="en-US",closeLabel:l="Close",onClose:d,className:u,"data-testid":x="payment-success-view"})=>{const m=!!(r&&r.value>0);return t.jsxs("div",{"data-testid":x,className:o.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,{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":`${x}-title`,children:e}),t.jsx("p",{className:"text-default-700",children:a}),s&&n&&t.jsxs("p",{className:"text-default-700",children:[s,t.jsx("br",{}),t.jsx("strong",{className:"font-semibold",children:n})]})]}),m&&r&&t.jsx(Ks,{cashChange:r,label:i,locale:c,align:"center",className:"max-w-[400px]","data-testid":`${x}-cash-change`}),d&&t.jsx(p.Button,{color:"default",variant:"bordered",radius:"full",size:"lg",onPress:d,"data-testid":`${x}-close`,className:"mt-4 w-full",children:l})]})};Rl.displayName="PaymentSuccessView";const Ys=({heading:e,amountLabel:a,value:s,defaultValue:n,onChange:r,onBlur:i,placeholder:c,isDisabled:l,isInvalid:d,errorMessage:u,autoFocus:x,maxAmount:m,hideHeading:b=!1,className:f,"data-testid":g="payment-sub-amount-input"})=>{const j=`${g}-input`,y=s!==void 0,[v,C]=h.useState(n??""),S=y?s:v,{isUntouched:k,markEdited:$}=Nl(S),_=h.useCallback(A=>{if(m!==void 0){const M=Number.parseFloat(A.replace(",","."));if(Number.isFinite(M)&&M>m)return}$(A),y||C(A),r?.(A)},[m,r,$,y]),w=Cl(k,_),F=h.useCallback(A=>{const M=A.currentTarget;requestAnimationFrame(()=>{M.isConnected&&M.select()})},[]);return t.jsxs("div",{className:o.cn("flex flex-col gap-3 border-t border-default-100 pt-5",f),"data-testid":g,children:[t.jsx("h3",{className:o.cn("text-lg font-semibold",b&&"sr-only"),"data-testid":`${g}-heading`,children:e}),t.jsx(o.Input,{ref:w,id:j,label:a,labelPlacement:"outside",classNames:b?{label:"sr-only"}:void 0,type:"text",inputMode:"decimal",pattern:"[0-9]*[.,]?[0-9]*",value:S,onChange:A=>_(A.target.value),onFocus:F,onBlur:i,placeholder:c,isDisabled:l,isInvalid:d,errorMessage:d?u:void 0,variant:"bordered",radius:"lg","aria-invalid":d||void 0,autoFocus:x,"data-testid":`${g}-field`})]})};Ys.displayName="PaymentSubAmountInput";const ix={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"}},lx=e=>typeof e=="string"?t.jsx(p.Icon,{icon:e,className:"size-5","aria-hidden":"true"}):e,Zs=({isOpen:e,title:a,confirmLabel:s,onConfirm:n,onOpenChange:r,children:i,description:c,cancelLabel:l="Cancel",variant:d="danger",isPending:u=!1,isDismissable:x,isKeyboardDismissDisabled:m=!1,hideIcon:b=!1,icon:f,"data-testid":g="confirm-dialog"})=>{const j=i??c??null,y=ix[d],v=b?null:lx(f??y.icon);return t.jsx(p.Modal,{isOpen:e,onOpenChange:C=>r?.(C),placement:"center",size:"md",isDismissable:(x??!0)&&!u,isKeyboardDismissDisabled:m||u,hideCloseButton:u,className:"gap-4 p-6",classNames:{base:"rounded-3xl"},"data-testid":g,children:t.jsxs(o.ModalContent,{role:"alertdialog",children:[t.jsxs(o.ModalHeader,{className:"flex flex-col items-center gap-3 p-0 text-center",children:[v?t.jsx("div",{"aria-hidden":"true","data-testid":`${g}-icon`,className:o.cn("flex size-10 items-center justify-center rounded-full",y.tile),children:v}):null,t.jsx("span",{"data-testid":`${g}-title`,className:"text-lg font-semibold text-zinc-950",children:a})]}),j!==null?t.jsx(o.ModalBody,{"data-testid":`${g}-body`,className:"gap-0 p-0",children:typeof j=="string"?t.jsx("p",{className:"mx-auto max-w-sm text-center text-sm text-gray-600",children:j}):j}):null,t.jsxs(o.ModalFooter,{className:"flex flex-col-reverse gap-2 p-0 sm:flex-row sm:gap-3",children:[t.jsx(p.Button,{variant:"bordered",color:"default",radius:"full",onPress:()=>r?.(!1),isDisabled:u,"data-testid":`${g}-dismiss`,className:"w-full sm:flex-1",children:l}),t.jsx(p.Button,{color:y.confirmColor,variant:"solid",radius:"full",onPress:n,isLoading:u,"data-testid":`${g}-confirm`,className:"w-full sm:flex-1",children:s})]})]})})};Zs.displayName="ConfirmDialog";const bt={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"},ox={danger:"bg-danger-50",warning:"bg-warning-50"},Il=({message:e,description:a,confirmLabel:s,cancelLabel:n="Cancel",onConfirm:r,onCancel:i,variant:c="danger",isPending:l=!1,initialFocus:d="cancel",containEscape:u=!0,size:x="sm",as:m="div",className:b,"data-testid":f="inline-confirm"})=>{const g=h.useId(),j=h.useId(),y=h.useRef(null),v=h.useRef(null),C=h.useRef(null),S=a!=null,k=h.useRef({isPending:l,containEscape:u,onCancel:i});k.current={isPending:l,containEscape:u,onCancel:i},h.useEffect(()=>{(d==="confirm"?v:C).current?.focus()},[]),h.useEffect(()=>{const w=y.current;if(w===null)return;const F=A=>{A.key==="Escape"&&(k.current.containEscape&&A.stopPropagation(),!k.current.isPending&&k.current.onCancel())};return w.addEventListener("keydown",F),()=>w.removeEventListener("keydown",F)},[]);const $=h.useRef(!1);h.useLayoutEffect(()=>{const w=y.current;if(w===null)return;const F=document.activeElement;if(l){const A=F===null||F===document.body||!w.contains(F),M=F instanceof HTMLButtonElement&&F.disabled;$.current&&(A||M)&&w.focus({preventScroll:!0});return}F===w&&(d==="confirm"?v:C).current?.focus()},[l,d]);const _=t.jsx(o.Card,{ref:y,role:"alertdialog","aria-modal":"false","aria-labelledby":g,"aria-describedby":S?j:void 0,"aria-busy":l||void 0,tabIndex:-1,shadow:"none",radius:"lg",onFocus:()=>{$.current=!0},onBlur:w=>{const F=w.relatedTarget;$.current=F instanceof Node&&w.currentTarget.contains(F)},className:o.cn(bt.box,ox[c],m==="div"&&b),"data-testid":f,children:t.jsxs(o.CardBody,{className:bt.body,children:[t.jsxs("div",{className:bt.text,children:[t.jsx("p",{id:g,className:bt.message,children:e}),S?t.jsx("p",{id:j,className:bt.description,children:a}):null]}),t.jsxs("div",{className:bt.actions,children:[t.jsx(p.Button,{ref:v,size:x,color:c,variant:"solid",onPress:r,isLoading:l,"data-testid":`${f}-confirm`,children:s}),t.jsx(p.Button,{ref:C,size:x,color:"default",variant:"light",onPress:i,isDisabled:l,"data-testid":`${f}-cancel`,children:n})]})]})});return m==="li"?t.jsx("li",{className:o.cn(bt.item,b),children:_}):_};Il.displayName="InlineConfirm";const cx={guardScope:(e,a)=>a(),bypass:e=>e(),report:()=>{},unreport:()=>{}},Fa=h.createContext(cx),Qs=h.createContext(null);function dx(e){const{report:a,unreport:s}=h.useContext(Fa),n=h.useContext(Qs),r=h.useId();h.useEffect(()=>{a(r,{scope:n,isDirty:e})},[a,r,n,e]),h.useEffect(()=>()=>s(r),[s,r])}function ux(){const{guardScope:e,bypass:a}=h.useContext(Fa);return h.useMemo(()=>({guard:s=>e(null,s),bypass:a}),[e,a])}function Ml(){const{guardScope:e}=h.useContext(Fa),a=h.useContext(Qs);return h.useCallback(s=>e(a,s),[e,a])}const mx=({scope:e,children:a})=>t.jsx(Qs.Provider,{value:e,children:a}),Bl=({guard:e,children:a,title:s="Discard changes?",description:n="What you entered will be lost.",confirmLabel:r="Discard",keepEditingLabel:i="Keep editing","data-testid":c="discard-guard"})=>{const{pending:l,confirmKey:d,confirm:u,keepEditing:x,report:m,unreport:b,guardScope:f}=e.internals,g=h.useMemo(()=>({guardScope:f,bypass:e.bypass,report:m,unreport:b}),[f,e.bypass,m,b]);return t.jsxs(Fa.Provider,{value:g,children:[a,t.jsx(Zs,{isOpen:l!==null,onOpenChange:j=>{j||x()},onConfirm:u,variant:"warning",title:s,description:n,confirmLabel:r,cancelLabel:i,"data-testid":c},d)]})};Bl.displayName="DiscardGuard";const Xs=h.createContext(null);function fx(){const e=h.useContext(Xs),a=Ml(),s=e?.back,n=h.useCallback(()=>{s&&a(s)},[a,s]);return{isActive:e?.isActive??!0,canGoBack:e?.canGoBack??!1,back:n}}const xx=["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 px(e){for(const a of e.querySelectorAll(xx))if(!a.closest('[hidden], [inert], [aria-hidden="true"]'))return a;return null}function lr(e,a){return!e||!e.isConnected||!a.contains(e)||e.matches(":disabled")?!1:!e.closest("[hidden], [inert]")}const hx=new Set(["menu","listbox","dialog","grid","tree"]);function bx(e){for(const a of e.querySelectorAll('[aria-expanded="true"][aria-controls]')){const s=a.ownerDocument.getElementById(a.getAttribute("aria-controls")??"");if(!s?.isConnected)continue;if((a.getAttribute("aria-haspopup")??"false")!=="false"||hx.has(s.getAttribute("role")??""))return s}return null}const or="react-aria-focus-scope-restore";class gx{panels=new Map;active=null;setContainer(a,s){s?this.panels.set(a,{entry:null,last:null,...this.panels.get(a),container:s}):this.panels.delete(a)}setEntry(a,s){const n=this.panels.get(a);n?n.entry=s:s&&this.panels.set(a,{container:null,entry:s,last:null})}remember(a,s){const n=this.panels.get(a);n&&(n.last=s)}setActive(a,s){this.active={key:a,isReturn:s}}focusActive(){if(!this.active)return;const a=this.panels.get(this.active.key),s=a?.container;if(!a||!s||s.contains(document.activeElement))return;((this.active.isReturn&&lr(a.last,s)?a.last:null)??(lr(a.entry,s)?a.entry:null)??px(s))?.focus()}recoverFocus(){const a=this.active?this.panels.get(this.active.key)?.container:null,s=a?bx(a):null;s?.focus(),s?.contains(document.activeElement)||this.focusActive()}}const yx="flex flex-initial items-center gap-2 py-4 pl-4 pr-12 text-large font-semibold",vx="min-w-0 flex-1 truncate text-large font-semibold",jx="flex shrink-0 items-center gap-2",wx="size-5";function Nx({panels:e,children:a}){const[s]=h.useState(()=>new gx),{entries:n,back:r}=e,i=n[n.length-1].key,c=h.useRef(null);return h.useLayoutEffect(()=>{const l=c.current;c.current={activeKey:i,keys:new Set(n.map(d=>d.key))},!(!l||l.activeKey===i)&&(s.setActive(i,l.keys.has(i)),s.focusActive())},[i,n,s]),t.jsx(t.Fragment,{children:n.map((l,d)=>t.jsx(Cx,{entryKey:l.key,isActive:d===n.length-1,canGoBack:d>0,back:r,memory:s,children:a(l.panel,l)},l.key))})}const Cx=({entryKey:e,isActive:a,canGoBack:s,back:n,memory:r,children:i})=>{const c=h.useRef(null),l=h.useCallback(u=>r.setEntry(e,u),[r,e]);h.useLayoutEffect(()=>{const u=c.current;if(r.setContainer(e,u),!u)return;const x=m=>{u.hidden&&(m.preventDefault(),r.recoverFocus())};return u.addEventListener(or,x),()=>{u.removeEventListener(or,x),r.setContainer(e,null)}},[r,e]);const d=h.useMemo(()=>({isActive:a,canGoBack:s,back:n,setEntryFocus:l}),[a,s,n,l]);return t.jsx(Xs.Provider,{value:d,children:t.jsx(mx,{scope:e,children:t.jsx("div",{ref:c,hidden:!a,style:{display:a?"contents":"none"},onFocus:u=>{u.currentTarget.contains(u.target)&&r.remember(e,u.target)},children:i})})})},Pl=({title:e,onBack:a,backLabel:s="Back",isBackDisabled:n,size:r="md",actions:i,className:c,"data-testid":l="modal-panel-header"})=>{const d=h.useContext(Xs),u=Ml(),x=h.useId(),m=a??(d?.canGoBack?d.back:void 0);return t.jsxs("header",{className:o.cn(yx,c),"data-testid":l,children:[m?t.jsx(p.Button,{ref:d?.setEntryFocus,isIconOnly:!0,variant:"light",color:"default",size:r,"aria-label":s,"aria-describedby":x,isDisabled:n,onPress:()=>u(m),"data-testid":`${l}-back`,children:t.jsx(p.Icon,{icon:"solar:arrow-left-outline",className:wx,"aria-hidden":"true"})}):null,t.jsx("h2",{id:x,className:vx,"data-testid":`${l}-title`,children:e}),i?t.jsx("div",{className:jx,children:i}):null]})};Pl.displayName="ModalPanelHeader";function kx(e){const a=h.useRef(1),[s]=h.useState(e),[n,r]=h.useState(()=>[{key:"panel-0",panel:e}]),i=h.useCallback(x=>{const m=`panel-${a.current}`;return a.current+=1,{key:m,panel:x}},[]),c=h.useCallback(x=>{const m=i(x);r(b=>[...b,m])},[i]),l=h.useCallback(()=>{r(x=>x.length>1?x.slice(0,-1):x)},[]),d=h.useCallback(x=>{const m=i(x);r(b=>[...b.slice(0,-1),m])},[i]),u=h.useCallback(x=>{r([i(x===void 0?s:x)])},[i,s]);return h.useMemo(()=>({current:n[n.length-1].panel,entries:n,canGoBack:n.length>1,push:c,back:l,replace:d,reset:u}),[n,c,l,d,u])}function Sx(){const e=h.useRef(new Map),[a,s]=h.useState(0),[n,r]=h.useState(null),[i,c]=h.useState(0),l=h.useCallback(()=>{let y=0;for(const v of e.current.values())v.isDirty&&(y+=1);s(y)},[]),d=h.useCallback((y,v)=>{e.current.set(y,v),l()},[l]),u=h.useCallback(y=>{e.current.delete(y),l()},[l]),x=h.useCallback((y,v)=>{let C=!1;for(const S of e.current.values())S.isDirty&&(y===null||S.scope===y)&&(C=!0);C?r({leave:v}):v()},[]),m=h.useCallback(y=>x(null,y),[x]),b=h.useCallback(y=>{for(const v of e.current.values())v.isDirty=!1;l(),r(null),y()},[l]),f=h.useCallback(y=>v=>{v?y(!0):m(()=>y(!1))},[m]),g=h.useCallback(()=>{const y=n?.leave;r(null),c(v=>v+1),y?.()},[n]),j=h.useCallback(()=>r(null),[]);return h.useMemo(()=>({isDirty:a>0,guard:m,bypass:b,guardOpenChange:f,internals:{pending:n,confirmKey:i,confirm:g,keepEditing:j,report:d,unreport:u,guardScope:x}}),[a,m,b,f,n,i,g,j,d,u,x])}const $x=60,Ax=(e,a,s=$x)=>a?e>s:e<-s,Tl=(e,a)=>Math.max(0,Math.min(e,a)),Dx=160,Ex=(e,a,s=Dx)=>Math.min(e,Math.max(0,a-s)),Lx=(e,a,s)=>Tl(e-a,s),Fx=(e,a,s)=>e!==null?Tl(e,s):a?s:0,_x=e=>e?"":"transition-[height] duration-300 ease-out",Rx=e=>({onDrag:(a,s)=>{const n=e.open?e.fullHeight:0;e.setDragHeight(Lx(n,s?.offset?.y??0,e.fullHeight))},onDragEnd:(a,s)=>{Ax(s?.offset?.y??0,e.open)&&e.onToggleOpen?.(),e.setDragHeight(null)}}),wt=(e,a)=>fe(e.value,a,e.currency),cr=`opacity-60 transition-opacity ${p.stillTransitionClass}`,Js=({item:e,locale:a,onRemove:s,removeAriaLabel:n,showRemoveButton:r=!0,compact:i=!1})=>{const c=!!e.children&&e.children.length>0,l=!!s&&r&&e.removable!==!1,d=e.tone?"text-default-600":"text-default-500";return t.jsxs("div",{"data-testid":`summary-item-${e.id}`,className:o.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:Ze[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":o.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:o.cn("mr-2 whitespace-nowrap text-[0.8125rem] text-default-600 line-through",e.pending&&cr),children:e.originalAmount}),e.amount&&t.jsx("span",{"data-testid":`summary-item-amount-${e.id}`,"data-pending":e.pending?"true":void 0,className:o.cn(i?"whitespace-nowrap text-sm font-semibold text-foreground":"whitespace-nowrap text-base text-foreground",e.pending&&cr),children:wt(e.amount,a)}),l&&t.jsx(p.Button,{isIconOnly:!0,size:"sm",variant:"light",radius:"full",className:o.cn("ml-1 size-8 min-w-8 p-2 text-danger",i&&"-my-1.5"),"aria-label":n,"data-testid":`summary-remove-${e.id}`,onPress:()=>s(e.id),children:t.jsx(p.Icon,{icon:"lucide:trash-2",width:16,height:16,className:"text-danger"})})]})]}),p.hasContent(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:o.cn("flex items-center gap-2 text-sm",d),children:[t.jsx(p.Icon,{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:o.cn("flex items-center gap-2 text-sm",d),children:[t.jsx(p.Icon,{icon:"lucide:calendar",width:16,height:16,className:"shrink-0"}),t.jsx("span",{children:e.dateRange.from}),t.jsx(p.Icon,{icon:"lucide:arrow-right",width:16,height:16,className:"shrink-0"}),t.jsx("span",{children:e.dateRange.to})]}),e.details?.map((u,x)=>t.jsxs("div",{"data-testid":`summary-item-detail-${e.id}-${u.key??x}`,className:o.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:o.cn("whitespace-nowrap",u.valueTone==="primary"&&o.cn("font-medium",e.tone?"text-primary-600":"text-primary")),children:u.value}),u.tooltip!=null&&t.jsx(o.Tooltip,{content:u.tooltip,children:t.jsx("span",{"data-testid":`summary-item-detail-tooltip-${e.id}-${u.key??x}`,className:"flex shrink-0 items-center",children:t.jsx(p.Icon,{icon:"lucide:info",width:16,height:16,className:o.cn(u.valueTone==="primary"?"text-primary":"text-default-400")})})})]})]},u.key??x)),c&&t.jsx("div",{"data-testid":`summary-children-${e.id}`,className:"flex flex-col gap-2 pl-6",children:e.children.map(u=>t.jsx(Js,{item:u,locale:a,onRemove:s,removeAriaLabel:n,showRemoveButton:r,compact:i},u.id))})]})};Js.displayName="SummaryItemRow";const Ol=({fee:e,locale:a,className:s})=>t.jsxs("div",{"data-testid":"summary-service-fee",className:o.cn("flex items-center justify-between gap-2",s),children:[t.jsxs("button",{type:"button",role:"switch","aria-checked":!!e.isSelected,"aria-label":typeof e.label=="string"?e.label:"Pay Service fee","data-testid":"summary-service-fee-toggle",onClick:e.onToggle,className:"flex min-w-0 items-center gap-2 text-left",children:[t.jsx("span",{"aria-hidden":"true",className:o.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:wt(e.amount,a)})]});Ol.displayName="SummaryServiceFeeRow";const en=({row:e,locale:a,emphasized:s,onRemove:n,removeAriaLabel:r,showRemoveButton:i=!0,compact:c=!1})=>{const l=!!n&&i&&!!e.id,d=t.jsx("span",{"data-testid":`summary-row-label-${e.key}`,className:c?void 0:o.cn(s?"text-xl font-semibold leading-7":"text-base"),children:e.label});return t.jsxs("div",{"data-testid":`summary-row-${e.key}`,className:c?"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(p.Button,{isIconOnly:!0,size:"sm",variant:"light",radius:"full",className:o.cn("ml-1 size-8 min-w-8 shrink-0 p-2 text-danger",c&&"-my-1.5"),"aria-label":r,"data-testid":`summary-remove-row-${e.id}`,onPress:()=>n(e.id),children:t.jsx(p.Icon,{icon:"lucide:trash-2",width:16,height:16,className:"text-danger"})})]}):d,t.jsx("span",{"data-testid":`summary-row-amount-${e.key}`,className:o.cn("whitespace-nowrap",!c&&"text-base",e.amountTone==="success"&&"text-success"),children:wt(e.amount,a)})]})};en.displayName="SummaryTotalsLineRow";const zl=({pricesInLabel:e,currency:a,items:s,serviceFee:n,rows:r,locale:i,onRemoveItem:c,removeAriaLabel:l,onRemoveTotalRow:d,removeTotalRowAriaLabel:u,showRemoveButton:x,emptyState:m,compact:b=!1,classNames:f})=>{const g=(s?.length??0)>0;return t.jsxs(t.Fragment,{children:[!b&&t.jsxs("div",{"data-testid":"summary-prices",className:o.cn("flex items-center justify-between text-xs text-default-500",f.prices),children:[t.jsx("span",{children:e}),a!=null&&t.jsx("span",{children:a})]}),g?t.jsx("div",{className:o.cn(b?"flex flex-col divide-y divide-default-100":"flex flex-col gap-4",f.items),children:s.map(j=>t.jsx(Js,{item:j,locale:i,onRemove:c,removeAriaLabel:l,showRemoveButton:x,compact:b},j.id))}):t.jsx("div",{"data-testid":"summary-empty",children:m}),n&&t.jsxs(t.Fragment,{children:[t.jsx(o.Divider,{className:"bg-default-100"}),t.jsx(Ol,{fee:n,locale:i,className:f.serviceFee})]}),r&&r.length>0&&t.jsx("div",{className:o.cn(b?o.cn("flex flex-col gap-1 pt-3",!n&&"border-t border-default-100"):"flex flex-col gap-4",f.totalsRows),children:r.map((j,y)=>t.jsx(en,{row:j,locale:i,emphasized:!b&&y===0,onRemove:d,removeAriaLabel:u,showRemoveButton:x,compact:b},j.key))})]})};zl.displayName="SummaryBody";const Vl=({total:e,locale:a,compact:s=!1,className:n})=>{const r=s?"text-lg":"text-xl";return t.jsxs("div",{"data-testid":"summary-total",className:o.cn(`flex items-center justify-between ${r} font-semibold leading-7 text-foreground`,n),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:wt(e.amount,a)})]})};Vl.displayName="SummaryGrandTotalRow";const Ul=({secondaryTotal:e,locale:a,className:s})=>t.jsxs("div",{"data-testid":"summary-secondary-total",className:o.cn("flex items-center justify-between text-lg font-semibold leading-7 text-primary",s),children:[t.jsx("span",{children:e.label}),t.jsx("span",{"data-testid":"summary-secondary-total-amount",className:"whitespace-nowrap text-lg font-semibold leading-7",children:wt(e.amount,a)})]});Ul.displayName="SummarySecondaryTotalRow";const Na=({action:e,disabledByLoading:a,className:s,testId:n="summary-cta"})=>t.jsx(p.Button,{color:"primary",radius:"full",className:o.cn("px-[18px] py-[14px] font-medium",s),"data-testid":n,isLoading:e.isLoading,isDisabled:e.isDisabled||a,onPress:e.onPress,endContent:t.jsx(p.Icon,{icon:"lucide:arrow-right",width:16,height:16}),children:e.label});Na.displayName="SummaryPrimaryCta";const Hl=({title:e,total:a,secondaryTotal:s,locale:n,open:r,progress:i,dragging:c,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:o.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:o.cn("col-start-1 row-start-1 flex items-center justify-between",!c&&"transition-opacity duration-300"),children:[t.jsx("span",{"data-testid":"summary-title",className:o.cn("text-xl font-semibold leading-7 text-foreground",u.title),children:e}),t.jsx("span",{"data-testid":"summary-close","aria-hidden":"true",className:o.cn("shrink-0 text-foreground",u.closeButton),children:t.jsx(p.Icon,{icon:"lucide:x",width:20,height:20})})]}),t.jsxs("span",{"aria-hidden":r,style:{opacity:1-i},className:o.cn("col-start-1 row-start-1 flex flex-col gap-2",!c&&"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:a.label??"Total"}),t.jsx("span",{className:"whitespace-nowrap",children:wt(a.amount,n)})]}),s&&t.jsxs("span",{className:"flex items-center justify-between text-lg font-semibold leading-7 text-primary",children:[t.jsx("span",{children:s.label}),t.jsx("span",{className:"whitespace-nowrap",children:wt(s.amount,n)})]})]})]})});Hl.displayName="SummaryCollapseHeader";const Wl=({cart:e,ariaLabel:a,onPress:s,className:n})=>t.jsxs("button",{type:"button","data-testid":"summary-cart","aria-label":a,onClick:s,className:o.cn("relative flex size-[52px] shrink-0 items-center justify-center rounded-full border border-default-200 bg-content1",n),children:[t.jsx(p.Icon,{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})]});Wl.displayName="SummaryCartButton";const ql=({open:e,progress:a,dragging:s,primaryAction:n,isLoading:r,cart:i,cartAriaLabel:c,ctaCaption:l,ctaError:d,onToggleOpen:u,classNames:x})=>t.jsxs("div",{"data-testid":"summary-mobile-bar",className:o.cn("flex flex-col gap-4",x.mobileBar),children:[t.jsx(o.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-a},className:o.cn("col-start-1 row-start-1 flex items-stretch gap-2.5",e&&"pointer-events-none",!s&&"transition-opacity duration-300"),children:[i&&t.jsx(Wl,{cart:i,ariaLabel:c,className:x.cart,onPress:()=>{u?.(),i.onPress?.()}}),n&&t.jsx(Na,{action:n,disabledByLoading:r,className:o.cn("h-[52px] flex-1",x.cta),testId:"summary-cta-compact"})]}),n&&t.jsx("div",{"aria-hidden":!e,style:{opacity:a},className:o.cn("col-start-1 row-start-1 flex",!e&&"pointer-events-none",!s&&"transition-opacity duration-300"),children:t.jsx(Na,{action:n,disabledByLoading:r,className:o.cn("h-[52px] w-full",x.cta)})})]}),l&&t.jsx("div",{children:l})]});ql.displayName="SummaryActionBar";const Ix="(max-width: 767px)",Mx=e=>typeof window<"u"&&typeof window.matchMedia=="function"?window.matchMedia(e).matches:!1,Bx=(e=Ix)=>{const[a,s]=h.useState(()=>Mx(e));return h.useEffect(()=>{if(typeof window>"u"||typeof window.matchMedia!="function")return;const n=window.matchMedia(e),r=()=>s(n.matches);return r(),n.addEventListener("change",r),()=>n.removeEventListener("change",r)},[e]),a},Gl=({title:e="Summary",pricesInLabel:a="Prices are in",currency:s,locale:n="en-US",items:r,serviceFee:i,rows:c,total:l,postTotalRows:d,onRemoveTotalRow:u,onRemovePostTotalRow:x,secondaryTotal:m,collapsible:b,isOpen:f,onToggleOpen:g,defaultOpen:j=!1,primaryAction:y,isLoading:v=!1,onRemoveItem:C,showRemoveButton:S,ctaCaption:k,ctaError:$,variant:_,cart:w,emptyState:F,labels:A,classNames:M={},density:E="default","data-testid":D="summary",className:I})=>{const B=A?.removeAriaLabel??"Remove item",z=A?.removeTotalRowAriaLabel??"Remove discount",q=A?.removePostTotalRowAriaLabel??"Remove applied code",P=A?.toggleAriaLabel??"Toggle summary",ee=A?.cartAriaLabel??"View cart",W=E==="compact",Y=Bx(),ie=b??(_??(Y?"mobile":"main"))==="mobile",[te,Q]=h.useState(j),ne=f!==void 0,V=!ie||(ne?f:te),O=h.useCallback(()=>{ne||Q(T=>!T),g?.()},[ne,g]),[Z,Re]=h.useState(0),[De,Ee]=h.useState(null),ae=h.useRef(null),be=h.useRef(null),$e=h.useCallback(()=>{const T=ae.current;T&&Re(Ex(T.scrollHeight,window.innerHeight))},[]),ge=h.useCallback(T=>{be.current?.disconnect(),be.current=null,ae.current=T,T&&($e(),typeof ResizeObserver<"u"&&(be.current=new ResizeObserver($e),be.current.observe(T)))},[$e]);h.useEffect(()=>(window.addEventListener("resize",$e),()=>window.removeEventListener("resize",$e)),[$e]);const We=Rx({open:V,fullHeight:Z,setDragHeight:Ee,onToggleOpen:O}),Le=De!==null,oe=Fx(De,V,Z),de=Z>0?Math.min(1,Math.max(0,oe/Z)):V?1:0,se=t.jsx(Vl,{total:l,locale:n,compact:W,className:M.total}),N=d&&d.length>0&&t.jsx("div",{"data-testid":"summary-post-total-rows",className:"flex flex-col gap-4",children:d.map(T=>t.jsx(en,{row:T,locale:n,emphasized:!1,onRemove:x,removeAriaLabel:q,showRemoveButton:S,compact:W},T.key))}),L=m&&t.jsx(Ul,{secondaryTotal:m,locale:n,className:M.secondaryTotal}),R=k!=null&&t.jsx("p",{"data-testid":"summary-cta-caption",className:o.cn("text-center text-sm text-default-500",M.ctaCaption),children:k}),H=$!=null&&t.jsx("p",{role:"alert","data-testid":"summary-cta-error",className:o.cn("text-center text-sm text-danger",M.ctaError),children:$}),U=t.jsx(zl,{pricesInLabel:a,currency:s,items:r,serviceFee:i,rows:c,locale:n,onRemoveItem:C,removeAriaLabel:B,onRemoveTotalRow:u,removeTotalRowAriaLabel:z,showRemoveButton:S,emptyState:F,compact:W,classNames:M});return ie?t.jsxs(ze.motion.section,{"data-testid":D,drag:"y",dragConstraints:{top:0,bottom:0},dragElastic:.12,dragSnapToOrigin:!0,onDrag:We.onDrag,onDragEnd:We.onDragEnd,className:o.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)]",I,M.base),children:[t.jsx(Hl,{title:e,total:l,secondaryTotal:m,locale:n,open:V,progress:de,dragging:Le,toggleAriaLabel:P,onToggleOpen:O,classNames:M}),t.jsx("div",{"data-testid":"summary-reveal","aria-hidden":!V,style:{height:oe},className:o.cn("min-h-0",V&&!Le?"overflow-y-auto overscroll-contain [scrollbar-width:none] [&::-webkit-scrollbar]:hidden":"overflow-hidden",!V&&"pointer-events-none",_x(Le)),children:t.jsxs("div",{ref:ge,className:W?"flex flex-col gap-3 pb-4":"flex flex-col gap-4 pb-4",children:[U,!W&&t.jsx(o.Divider,{className:"bg-default-200"}),se,N,L]})}),t.jsx(ql,{open:V,progress:de,dragging:Le,primaryAction:y,isLoading:v,cart:w,cartAriaLabel:ee,ctaCaption:R,ctaError:H,onToggleOpen:O,classNames:M})]}):t.jsxs("section",{"data-testid":D,className:o.cn(W?"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",I,M.base),children:[!W&&t.jsx("div",{className:o.cn("flex items-center justify-between",M.header),children:t.jsx("h2",{"data-testid":"summary-title",className:o.cn("text-xl font-semibold leading-7 text-foreground",M.title),children:e})}),U,!W&&t.jsx(o.Divider,{className:"bg-default-200"}),se,N,L,m&&y&&t.jsx(o.Divider,{className:"bg-default-200"}),y&&t.jsx(Na,{action:y,disabledByLoading:v,className:o.cn("w-full",M.cta)}),H,R]})};Gl.displayName="Summary";const st={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"},dr={done:"bg-pos-ok",active:"bg-primary",upcoming:"bg-pos-line"},Px={done:"text-pos-ok",active:"text-pos-ink",upcoming:"text-pos-muted"},Tx={ariaLabel:"Progress",completed:"completed"},tn=({steps:e,activeStepId:a,showLabels:s=!0,onStepPress:n,isStepReachable:r,labels:i,className:c,"data-testid":l="step-progress"})=>{const d={...Tx,...i},u=e.filter(b=>b.state!=="skipped"),x=Math.max(0,u.findIndex(b=>b.id===a)),m=b=>b<x?"done":b===x?"active":"upcoming";return s?t.jsx("ol",{"aria-label":d.ariaLabel,className:o.cn(st.list,c),"data-testid":l,children:u.map((b,f)=>{const g=m(f),j=t.jsxs(t.Fragment,{children:[t.jsx("span",{"aria-hidden":"true",className:o.cn(st.segment,"w-full",dr[g]),"data-testid":`${l}-segment-${b.id}`}),t.jsxs("span",{className:o.cn(st.name,Px[g]),"data-testid":`${l}-name-${b.id}`,children:[g==="done"&&t.jsx("span",{"aria-hidden":"true",className:st.check,"data-testid":`${l}-check-${b.id}`,children:t.jsx(p.Icon,{icon:"solar:check-circle-bold",width:"100%",height:"100%"})}),t.jsx("span",{className:"truncate",children:b.label}),g==="done"&&t.jsxs("span",{className:"sr-only",children:[", ",d.completed]})]})]}),y=r?r(b.id,f):f<x,v=g==="active"?"step":void 0;return t.jsx("li",{className:st.item,"aria-current":n?void 0:v,"data-state":g,"data-testid":`${l}-step-${b.id}`,children:n?t.jsx("button",{type:"button",className:o.cn(st.step,st.button),disabled:!y,"aria-current":v,onClick:()=>n(b.id),"data-testid":`${l}-button-${b.id}`,children:j}):t.jsx("div",{className:st.step,children:j})},b.id)})}):t.jsx("div",{"aria-hidden":"true",className:o.cn(st.bare,c),"data-testid":l,children:u.map((b,f)=>t.jsx("span",{className:o.cn(st.segment,"flex-1",dr[m(f)]),"data-state":m(f)},b.id))})};tn.displayName="StepProgress";const Ox={back:"Back",close:"Close",cancel:"Cancel",partialBadge:"Partial refund",owesBadge:"Customer owes",ofSeparator:"of"},zx={backgroundColor:le.destructive,color:"#fff"},Vx={warn:{backgroundColor:le["warn-fill"],color:le.warn},ok:{backgroundColor:le["ok-fill"],color:le.ok},neutral:{backgroundColor:"hsl(var(--heroui-default-100))",color:"hsl(var(--heroui-default-600))",border:`1px solid ${le.line}`}},es="inline-flex h-[22px] items-center gap-[5px] whitespace-nowrap rounded-full px-[9px] text-xs font-medium leading-none",ts="absolute top-0 h-5 w-5 opacity-0",Kl=({onClose:e,steps:a,activeStepId:s,subtitle:n,onBack:r,primaryAction:i,totalRow:c,secondaryAction:l,hideChrome:d,footerSummary:u,labels:x,className:m,"data-testid":b="wizard-shell",children:f})=>{const g={...Ox,...x},j=a.find(C=>C.id===s),y=r??e,v=r?g.back:g.cancel;return t.jsxs("div",{className:o.cn("flex h-full min-h-0 w-full flex-col bg-white text-default-900",m),"data-testid":b,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":`${b}-header`,children:[y&&t.jsx(p.Button,{variant:"light",className:"h-10 min-w-0 gap-2 rounded-xl px-4 text-sm font-semibold text-default-600",onPress:y,"data-testid":`${b}-header-back`,startContent:t.jsx(p.Icon,{icon:"lucide:circle-chevron-left",width:18,height:18,"aria-hidden":"true"}),children:v}),t.jsxs("div",{className:"min-w-0",children:[t.jsx("h2",{className:"text-lg font-semibold","data-testid":`${b}-header-title`,children:j?.label??""}),n&&t.jsx("div",{className:"mt-0.5 text-[12.5px] text-default-500","data-testid":`${b}-header-subtitle`,children:n})]}),t.jsxs("div",{className:"relative flex-1","data-testid":`${b}-footer`,children:[e&&t.jsx("button",{type:"button","aria-label":g.close,onClick:e,className:o.cn(ts,"left-0"),"data-testid":`${b}-header-close`}),r&&t.jsx("button",{type:"button","aria-label":g.back,onClick:r,className:o.cn(ts,"left-6"),"data-testid":`${b}-back`}),l&&t.jsx("button",{type:"button","aria-label":l.label,disabled:l.disabled,onClick:l.onClick,className:o.cn(ts,"left-12"),"data-testid":`${b}-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:[c&&t.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-[12.5px] font-semibold text-default-600","data-testid":`${b}-total`,children:[t.jsx("span",{children:c.label}),c.amount&&t.jsx("span",{className:"tabular-nums text-default-900",children:fe(c.amount.value,void 0,c.amount.currency)}),c.of&&t.jsxs(t.Fragment,{children:[t.jsx("span",{children:g.ofSeparator}),t.jsx("span",{className:"tabular-nums text-default-900","data-testid":`${b}-total-of`,children:fe(c.of.value,void 0,c.of.currency)})]}),c.badge==="partial"&&t.jsx("span",{className:o.cn(es,"bg-pos-warn-fill text-pos-warn"),"data-testid":`${b}-total-partial`,children:g.partialBadge}),c.badge==="owes"&&t.jsx("span",{className:o.cn(es,"border border-pos-line bg-default-100 text-default-600"),"data-testid":`${b}-total-owes`,children:g.owesBadge}),typeof c.badge=="object"&&t.jsx("span",{className:es,style:Vx[c.badge.tone],"data-tone":c.badge.tone,"data-testid":`${b}-total-badge`,children:c.badge.label})]}),t.jsx(p.Button,{color:"primary",className:o.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"?zx:void 0,isLoading:i.loading,isDisabled:i.disabled,onPress:i.onClick,"data-testid":`${b}-primary`,children:i.label})]})]}),t.jsx(tn,{steps:a,activeStepId:s,showLabels:!1,className:"shrink-0 px-6 py-2.5","data-testid":`${b}-stepper`}),t.jsx("div",{className:"min-h-0 flex-1 overflow-auto px-6 py-[22px]","data-testid":`${b}-body`,children:f}),u]})};Kl.displayName="WizardShell";const Ux=(e,a,s)=>Math.min(Math.max(e,a),s);function ps(e,a,s){const n=Math.max(1,Math.trunc(a)),r=Ux(Math.trunc(s),0,n);if(r===n)return{...e};if(r===0)return{value:0,currency:e.currency};const i=Math.pow(10,Rt(e.currency)),c=Math.round(e.value*i),l=Math.floor(c/n),d=c-l*n;return{value:(l*r+Math.min(r,d))/i,currency:e.currency}}function Hx(e,a){return ps(e,a,1)}const Wx=e=>Number.isFinite(e)?e.toFixed(2):"",hs=({value:e,expected:a,max:s,onChange:n,ariaLabel:r,isDisabled:i,className:c,"data-testid":l,inputTestId:d})=>{const[u,x]=h.useState(null),m=h.useRef(null),b=Math.abs(e-a)>.004;return t.jsxs("span",{className:o.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",b?"border-primary bg-primary-50":"border-pos-line bg-white",c),"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??Wx(e),onChange:f=>{const g=f.target.value,j=Number.parseFloat(g.replace(",","."));s!==void 0&&Number.isFinite(j)&&j>s+.004||(x(g),Number.isFinite(j)&&j>=0?n(j):g.trim()===""&&n(0))},onFocus:f=>f.currentTarget.select(),onBlur:()=>x(null),"data-testid":d})]})};hs.displayName="AmountCell";const qx={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"},Gx="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",ur="flex h-11 flex-1 items-center justify-center bg-white text-lg text-default-900 outline-none transition-colors hover:bg-default-100 disabled:opacity-50 focus-visible:outline focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-primary",as="absolute h-5 w-5 opacity-0",Kx=e=>{const a=fe(e.paidAmount.value,void 0,e.paidAmount.currency);if(e.quantity<=1)return a;const s=Hx(e.paidAmount,e.quantity);return`${e.quantity} × ${fe(s.value,void 0,s.currency)} · ${a}`},Yl=({items:e,selections:a,onSelectionChange:s,onRestockToggle:n,onDispositionChange:r,amountOnly:i,labels:c,className:l,"data-testid":d="line-item-list"})=>{const u={...qx,...c},x=[{key:"stock",label:u.dispositionStock},{key:"norestock",label:u.dispositionNoRestock},{key:"damaged",label:u.dispositionDamaged}];return t.jsxs("div",{className:o.cn("flex flex-col text-default-900",l),"data-testid":d,children:[e.map(m=>{const b=a[m.id],f=m.state==="already_refunded"||m.state==="non_refundable",g=`${d}-row-${m.id}`,j=Math.max(1,Math.trunc(m.quantity)),y=b?.quantity,v=b?.selected?Math.min(y??j,j):y??0,C=ps(m.paidAmount,j,v).value,S=b?.amount??(b?.selected?C:0),k=v===0&&S>.004,$=w=>s(m.id,{selected:w.quantity>0||w.amount>.004,mode:"full",...w}),_=w=>{const F=Math.min(Math.max(w,0),j);$({quantity:F,amount:ps(m.paidAmount,j,F).value})};return t.jsxs("div",{className:o.cn("relative flex items-start gap-3 border-b border-pos-line-2 py-3 last:border-b-0",f&&"opacity-60"),"data-testid":g,children:[t.jsx("div",{className:"flex h-10 w-10 shrink-0 items-center justify-center rounded-[10px] bg-default-100 text-default-600","data-testid":`${g}-icon`,children:t.jsx(p.Icon,{icon:m.icon??"lucide:package",width:19,height:19,"aria-hidden":"true"})}),t.jsxs("div",{className:"min-w-0 flex-1",children:[t.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[t.jsxs("div",{className:"min-w-0",children:[t.jsx("p",{className:"truncate text-sm font-semibold",children:m.name}),t.jsx("p",{className:"text-[12.5px] text-default-500","data-testid":`${g}-detail`,children:m.detail??Kx(m)}),k&&t.jsx("p",{className:"mt-[3px] text-[12.5px] italic text-default-500","data-testid":`${g}-adjustment-note`,children:u.adjustmentNote})]}),t.jsxs("div",{className:"flex w-full flex-wrap items-center gap-2.5 sm:w-auto sm:flex-nowrap","data-testid":`${g}-partial`,children:[f?t.jsx("span",{className:"text-sm font-semibold tabular-nums",children:fe(m.paidAmount.value,void 0,m.paidAmount.currency)}):t.jsx(hs,{value:S,expected:C,max:m.paidAmount.value,onChange:w=>$({quantity:v,amount:w}),ariaLabel:u.amount.replace("{name}",m.name),className:"w-[120px]","data-testid":`${g}-amount`,inputTestId:`${g}-partial-input-field`}),f?t.jsx("span",{className:Gx,"data-testid":`${g}-blocked`,children:m.state==="already_refunded"?u.refunded:u.ineligible}):t.jsxs("div",{role:"group","aria-label":m.name,className:"flex w-[160px] shrink-0 items-center gap-0.5 overflow-hidden rounded-[10px] border border-pos-line","data-testid":`${g}-qty`,children:[t.jsx("button",{type:"button",className:ur,"aria-label":u.decrease.replace("{name}",m.name),disabled:v===0,onClick:()=>_(v-1),"data-testid":`${g}-qty-decrease`,children:"−"}),t.jsx("span",{"aria-live":"polite",className:"min-w-8 flex-1 text-center text-[15px] font-semibold tabular-nums","data-testid":`${g}-qty-value`,children:v}),t.jsx("button",{type:"button",className:ur,"aria-label":u.increase.replace("{name}",m.name),disabled:v===j,onClick:()=>_(v+1),"data-testid":`${g}-qty-increase`,children:"+"})]})]})]}),v>=j&&t.jsx("p",{className:"mt-2 text-xs text-default-500","data-testid":`${g}-max-note`,children:u.maxNote.replace("{count}",String(j))}),b?.selected&&!m.restock.available&&m.restock.unavailableHint&&t.jsx("p",{className:"mt-2 text-xs text-default-500",children:m.restock.unavailableHint}),m.warning&&t.jsxs("div",{className:"mt-2.5 flex items-start gap-2 rounded-[10px] bg-pos-warn-fill px-2.5 py-2 text-[12.5px] text-pos-warn","data-testid":`${g}-warning`,children:[t.jsx(p.Icon,{icon:"gravity-ui:triangle-exclamation-fill",width:15,height:15,className:"mt-0.5 shrink-0","aria-hidden":"true"}),t.jsx("span",{children:m.warning})]}),v>0&&m.restock.available&&t.jsxs("div",{className:"mt-2.5 flex flex-wrap items-center gap-2",children:[t.jsx("span",{className:"mr-0.5 text-[11px] font-semibold uppercase tracking-[.04em] text-default-500",children:u.disposition}),t.jsx(p.Select,{"aria-label":u.disposition,className:"w-[220px]",selectedKeys:[m.restock.disposition??(m.restock.on?"stock":"norestock")],onSelectionChange:w=>{if(w==="all")return;const F=[...w][0];F&&(r?.(m.id,F),n(m.id,F==="stock"))},"data-testid":`${g}-restock`,children:x.map(w=>t.jsx(o.SelectItem,{children:w.label},w.key))})]})]}),!f&&t.jsxs(t.Fragment,{children:[t.jsx(o.Checkbox,{className:o.cn(as,"right-0 top-0 m-0 p-0"),isSelected:!!b?.selected,onValueChange:w=>s(m.id,{selected:w,mode:"full"}),"aria-label":m.name,"data-testid":`${g}-checkbox`}),t.jsx("button",{type:"button","aria-label":u.partialLink,onClick:()=>document.querySelector(`[data-testid="${g}-partial-input-field"]`)?.focus(),className:o.cn(as,"left-0 top-0"),"data-testid":`${g}-partial-link`}),t.jsx("button",{type:"button","aria-label":u.partialCancel,onClick:()=>$({quantity:v,amount:C}),className:o.cn(as,"left-5 top-0"),"data-testid":`${g}-partial-cancel`})]})]},m.id)}),i&&(i.value===null?t.jsxs("button",{type:"button",onClick:i.onAdd,className:"mt-1 inline-flex items-center gap-1.5 self-start rounded pt-3 text-[12.5px] font-semibold text-primary outline-none hover:text-primary-600 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary","data-testid":`${d}-amount-only-add`,children:[t.jsx(p.Icon,{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,{icon:"lucide:circle-dollar-sign",width:19,height:19,"aria-hidden":"true"})}),t.jsx("div",{className:"min-w-0 flex-1",children:t.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[t.jsxs("div",{className:"min-w-0",children:[t.jsx("p",{className:"text-sm font-semibold",children:u.amountOnlyTitle}),t.jsx("p",{className:"text-[12.5px] text-default-500",children:u.amountOnlyDetail.replace("{amount}",fe(i.max.value,void 0,i.max.currency))})]}),t.jsxs("div",{className:"flex w-full flex-wrap items-center gap-2.5 sm:w-[290px] sm:flex-nowrap",children:[t.jsx(hs,{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,{icon:"lucide:trash-2",width:17,height:17,"aria-hidden":"true"})})]})]})})]}))]})};Yl.displayName="LineItemList";const Yx={color:le.danger},Zl=({children:e,className:a,"data-testid":s="meta-card"})=>t.jsx("div",{className:o.cn("mx-auto mt-[18px] flex max-w-[1040px] flex-col gap-3",a),"data-testid":s,children:t.jsx("div",{className:"rounded-[14px] border border-pos-line bg-white px-4 py-3.5 text-default-900",children:e})});Zl.displayName="MetaCard";const Ql=({label:e,htmlFor:a,required:s,children:n,className:r,"data-testid":i="meta-card-row"})=>t.jsxs("div",{className:o.cn("flex flex-wrap items-center justify-between gap-4",r),"data-testid":i,children:[t.jsxs("label",{htmlFor:a,className:"text-[13px] font-medium text-default-600",children:[e,s&&t.jsx("span",{"aria-hidden":"true",className:"ms-0.5 text-danger",style:Yx,"data-testid":`${i}-required`,children:"*"})]}),t.jsx("div",{className:"w-full sm:w-[290px] sm:shrink-0",children:n})]});Ql.displayName="MetaCard.Row";const Xl=({label:e,children:a,className:s,"data-testid":n="meta-card-section"})=>t.jsxs("div",{className:o.cn("mt-3.5 flex flex-col gap-2.5 border-t border-pos-line pt-3",s),"data-testid":n,children:[e&&t.jsx("p",{className:"text-[13px] font-medium text-default-600",children:e}),a]});Xl.displayName="MetaCard.Section";const Zx=Object.assign(Zl,{Row:Ql,Section:Xl}),Jl=({heading:e,icon:a="lucide:rotate-ccw",action:s,children:n,className:r,"data-testid":i="section-panel"})=>t.jsxs("section",{className:o.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,{icon:a,width:16,height:16,"aria-hidden":"true"}),t.jsx("h3",{"data-testid":`${i}-heading`,children:e}),t.jsx("div",{className:"flex-1"}),s&&t.jsxs("button",{type:"button",disabled:s.disabled,onClick:s.onClick,className:o.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,{icon:s.icon??"lucide:plus",width:14,height:14,"aria-hidden":"true"}),s.label]})]}),n]});Jl.displayName="SectionPanel";const eo=({name:e,detail:a,icon:s="lucide:users",labels:n,className:r,"data-testid":i="customer-card"})=>t.jsxs("div",{className:o.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,{icon:s,width:18,height:18,"aria-hidden":"true"})}),t.jsxs("div",{className:"min-w-0 flex-1",children:[t.jsx("p",{className:"mb-0.5 text-[11px] font-semibold uppercase tracking-[.08em] text-default-500",children:n?.heading??"Customer"}),t.jsx("p",{className:"text-sm font-semibold","data-testid":`${i}-name`,children:e}),a&&t.jsx("p",{className:"text-[12.5px] text-default-500",children:a})]})]});eo.displayName="CustomerCard";const Qx={label:"Reason for the return",placeholder:"Select a reason…"},to=({options:e,value:a,onChange:s,error:n,isRequired:r,labels:i,className:c,"data-testid":l="reason-select"})=>{const d={...Qx,...i};return t.jsx(p.Select,{label:d.label,labelPlacement:"outside",placeholder:d.placeholder,selectedKeys:a?[a]:[],isRequired:r,isInvalid:!!n,errorMessage:n,className:o.cn(c),"data-testid":l,onSelectionChange:u=>{if(u==="all")return;const x=[...u][0];x&&s(String(x))},children:e.map(u=>t.jsx(o.SelectItem,{children:u.label},u.id))})};to.displayName="ReasonSelect";const Xx={toggle:"Add a note",optionalTag:"(optional)",heading:"Additional note",placeholder:"Add a note (optional)"},ao=({value:e,onChange:a,maxLength:s,alwaysExpanded:n=!1,hideLabel:r=!1,labels:i,className:c,"data-testid":l="notes-field"})=>{const d={...Xx,...i},[u,x]=h.useState(e!=="");return n?t.jsxs("div",{className:o.cn("flex flex-col gap-2",c),"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=>a(m.target.value),maxLength:s,placeholder:d.placeholder,className:o.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:o.cn(c),"data-testid":l,children:u?t.jsx(o.Textarea,{value:e,onChange:m=>a(m.target.value),maxLength:s,placeholder:d.toggle,"aria-label":d.toggle,variant:"bordered",radius:"lg","data-testid":`${l}-textarea`}):t.jsxs(p.Button,{variant:"light",className:"h-auto min-w-0 px-1 py-0.5 text-xs font-semibold text-primary",onPress:()=>x(!0),"data-testid":`${l}-toggle`,children:[d.toggle,t.jsx("span",{className:"ml-1 font-normal text-default-400",children:d.optionalTag})]})})};ao.displayName="NotesField";const Jx={info:"solar:info-circle-bold",success:"solar:check-circle-bold",warning:"solar:danger-triangle-bold",danger:"solar:danger-circle-bold"},ep="solar:close-circle-linear",tp={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"}},ap={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"}},sp={info:"status",success:"status",warning:"alert",danger:"alert"};function an({tone:e="info",variant:a="callout",title:s,description:n,actions:r,onDismiss:i,dismissLabel:c="Dismiss",role:l=sp[e],className:d,"data-testid":u="notice"}){const x=p.useReducedMotion(),m=tp[a],b=ap[e],f=a==="banner",g=p.hasContent(s),j=p.hasContent(n),y=g?f?t.jsx("p",{"data-testid":`${u}-title`,className:o.cn(m.title,b.title),children:s}):t.jsx("span",{"data-testid":`${u}-title`,className:m.title,children:s}):null,v=j?f?t.jsx("p",{"data-testid":`${u}-description`,className:o.cn(m.description,g&&"mt-0.5"),children:n}):t.jsx("span",{"data-testid":`${u}-description`,className:m.description,children:n}):null;return t.jsxs("div",{role:l,"aria-live":l==="alert"?"assertive":"polite","data-tone":e,"data-variant":a,"data-testid":u,className:o.cn(m.root,f?b.banner:b.callout,d),children:[t.jsx("span",{"aria-hidden":"true","data-testid":`${u}-icon`,className:o.cn(m.iconWrapper,f&&b.disc),children:t.jsx(p.Icon,{icon:Jx[e],width:m.iconSize,height:m.iconSize})}),t.jsxs("div",{className:m.text,children:[f?t.jsxs(t.Fragment,{children:[y,v]}):t.jsxs("p",{children:[y,g&&j?" ":null,v]}),r?t.jsx("div",{"data-testid":`${u}-actions`,className:m.actions,children:r}):null]}),i?t.jsx(p.Button,{isIconOnly:!0,color:"default",size:"sm",radius:"full",variant:"light","aria-label":c,onPress:i,disableAnimation:x,className:o.cn(m.dismiss,p.stillTransitionClass),"data-testid":`${u}-dismiss`,children:t.jsx(p.Icon,{icon:ep,width:"1.125rem",height:"1.125rem"})}):null]})}an.displayName="Notice";const mr="h-8 min-w-0 rounded-[0.625rem] px-3 text-[0.8125rem] font-semibold",_a=({tone:e,title:a,body:s,onRetry:n,retryLabel:r,onChooseDifferent:i,chooseDifferentLabel:c,className:l,"data-testid":d,retryTestId:u,chooseDifferentTestId:x})=>t.jsx(an,{variant:"banner",tone:e,title:a,description:s,className:l,"data-testid":d,actions:t.jsxs(t.Fragment,{children:[n&&t.jsx(p.Button,{color:"primary",className:mr,onPress:n,"data-testid":u,children:r}),t.jsx(p.Button,{variant:"bordered",className:o.cn(mr,"border-1 border-pos-line bg-white text-default-900"),onPress:i,"data-testid":x,children:c})]})});_a.displayName="TenderBanner";const np={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"},rp={card:"lucide:credit-card",cash:"lucide:dollar-sign",check:"lucide:edit-3",other:"lucide:more-horizontal"},so=({tenders:e,selectedTenderId:a,onSelect:s,onSplit:n,error:r,labels:i,className:c,"data-testid":l="tender-methods"})=>{const d={...np,...i},u=r?.kind==="processor_declined";return t.jsxs("div",{className:o.cn("flex flex-col text-default-900",c),"data-testid":l,children:[r&&t.jsx(_a,{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(x=>{const m=x.tenderId===a;return t.jsxs("button",{type:"button",role:"radio","aria-checked":m,onClick:()=>s(x.tenderId),className:o.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-${x.tenderId}`,children:[t.jsx("span",{className:o.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,{icon:rp[x.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:x.label}),t.jsx("span",{className:"block text-xs text-default-500",children:fe(x.maxRefundable.value,void 0,x.maxRefundable.currency)})]})]},x.tenderId)}),t.jsxs("button",{type:"button",onClick:n,className:o.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,{icon:"lucide:split",width:18,height:18,"aria-hidden":"true"})}),t.jsx("span",{className:"min-w-0 text-sm font-semibold",children:d.split})]})]})]})};so.displayName="TenderMethods";const ip=e=>e.refunded!==null,lp={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"},op="mb-2 text-[11px] font-semibold uppercase tracking-[.08em] text-default-500",cp="inline-flex h-[22px] shrink-0 items-center gap-[5px] whitespace-nowrap rounded-full px-[9px] text-xs font-medium leading-none",no=({parts:e,refundedSoFar:a,remaining:s,current:n,methods:r,onRefundPart:i,partError:c,onBack:l,busy:d,hideActions:u,labels:x,className:m,"data-testid":b="split-tender-panel"})=>{const f={...lp,...x},g=e.filter(ip),j=e.find(w=>w.tenderId===n.tenderId)?.label,y=!!(r?.length&&n.onTenderChange),v=Rt(s.currency),{draft:C,setDraft:S,normalize:k}=wl(n.amount,String),$=h.useCallback(w=>{Gs(w,v)&&(S(w),n.onAmountChange(Qt(w)??0))},[n,S,v]),_=c?.kind==="processor_declined";return t.jsxs("div",{className:o.cn("flex flex-col text-default-900",m),"data-testid":b,children:[t.jsx("h3",{className:"sr-only","data-testid":`${b}-title`,children:f.title}),c&&t.jsx(_a,{tone:_?"danger":"warning",title:_?f.declinedTitle:f.networkTitle,body:_?f.partDeclinedBody:f.partNetworkBody,onRetry:c.onRetry,retryLabel:f.retry,onChooseDifferent:c.onChooseDifferent,chooseDifferentLabel:f.chooseDifferent,className:"mb-[18px]","data-testid":`${b}-part-error`,retryTestId:`${b}-retry`,chooseDifferentTestId:`${b}-choose-different`}),t.jsxs("div",{"data-testid":`${b}-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:fe(s.value,void 0,s.currency)}),t.jsxs("span",{className:"sr-only",children:[f.refundedSoFar,": ",fe(a.value,void 0,a.currency)]})]}),g.length>0&&t.jsxs("div",{children:[t.jsx("p",{className:op,children:f.refundedSoFar}),g.map((w,F)=>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":`${b}-part-${w.tenderId}-done`,children:[t.jsxs("span",{className:"w-[22px] shrink-0 font-bold text-default-600",children:["#",F+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,{icon:w.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:w.label}),w.feeNote&&t.jsx("span",{className:"block text-[11.5px] text-default-500",children:w.feeNote})]}),t.jsx("span",{className:"font-semibold tabular-nums",children:fe(w.refunded.value,void 0,w.refunded.currency)}),t.jsx("span",{className:o.cn(cp,w.status==="pending"?"bg-pos-warn-fill text-pos-warn":"bg-pos-ok-fill text-pos-ok"),children:w.status==="pending"?f.pending:f.succeeded})]},w.tenderId))]})]}),t.jsxs("div",{className:"mt-3.5","data-testid":`${b}-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(g.length+1))}),j&&t.jsx("span",{className:"text-xs text-default-500",children:j})]}),t.jsx("p",{"aria-hidden":"true",className:"mb-1.5 text-[13px] font-semibold","data-testid":`${b}-amount-label`,children:f.amountForPart}),t.jsx(Ys,{heading:f.amountForPart,amountLabel:f.amountForPart,hideHeading:!0,placeholder:"$0.00",value:C,onChange:$,onBlur:k,maxAmount:s.value,isDisabled:d,className:"gap-0 border-t-0 pt-0","data-testid":`${b}-amount`}),y&&t.jsx("div",{className:"mt-2.5 flex gap-2","data-testid":`${b}-methods`,children:r?.map(w=>{const F=w.tenderId===n.tenderId;return t.jsxs("button",{type:"button","aria-pressed":F,disabled:w.disabled||d,onClick:()=>n.onTenderChange?.(w.tenderId),className:o.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",F?"border-primary bg-primary/5 text-primary":"border-pos-line text-default-600"),"data-testid":`${b}-method-${w.tenderId}`,children:[w.icon&&t.jsx(p.Icon,{icon:w.icon,width:15,height:15,"aria-hidden":"true"}),w.label]},w.tenderId)})})]}),!u&&t.jsxs("div",{className:"mt-4 flex items-center gap-3",children:[t.jsx(p.Button,{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":`${b}-back`,children:f.back}),t.jsx(p.Button,{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":`${b}-submit`,children:f.submit})]})]})};no.displayName="SplitTenderPanel";const ro="hsl(var(--heroui-primary))",dp="hsl(var(--heroui-primary) / 0.05)",io="hsl(var(--heroui-default-100))",lo="hsl(var(--heroui-default-600))",sn={card:"lucide:credit-card",cash:"lucide:dollar-sign",check:"lucide:edit-3",store_credit:"lucide:gift",reader:"lucide:nfc",other:"lucide:more-horizontal"},ce={root:"flex flex-col text-default-900",banner:"mb-[18px]",eyebrowRow:"mb-3 flex min-h-6 items-center justify-between gap-3",eyebrow:"text-[11px] font-semibold uppercase tracking-[.08em] text-default-500",grid:"grid grid-cols-3 gap-2.5",card:"relative flex min-h-[132px] flex-col rounded-[14px] border-[1.5px] bg-white transition-colors",focusRing:"outline-none focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary",toggle:"flex w-full items-center gap-[11px] rounded-[12px] px-[15px] pt-[13px] text-left disabled:cursor-not-allowed",toggleUnselected:"flex-1 flex-col items-stretch gap-3 pb-[13px]",toggleHeader:"flex w-full items-center gap-[11px]",toggleRemovable:"pr-12",iconBox:"flex h-[38px] w-[38px] shrink-0 items-center justify-center rounded-[10px]",text:"min-w-0 flex-1",label:"block truncate text-[15px] font-semibold leading-5",subtitle:"block truncate text-xs text-default-500",status:"block truncate text-xs font-semibold",lowerSlot:"mt-auto flex h-11 w-full items-center rounded-[10px] px-3 text-[13px] font-medium tabular-nums",amountSlot:"mt-auto px-[15px] pb-[13px] pt-3",amountWrapper:"h-11 min-h-11 rounded-[10px] bg-white shadow-none",amountInput:"text-[15px] font-semibold tabular-nums",remove:"absolute right-1 top-1 flex h-11 w-11 items-center justify-center rounded-[10px] text-default-500 hover:text-default-900 disabled:cursor-not-allowed",badge:"inline-flex h-[22px] shrink-0 items-center whitespace-nowrap rounded-full px-[9px] text-xs font-medium leading-none",another:"flex min-h-[132px] w-full flex-col items-start justify-center gap-3 rounded-[14px] border-[1.5px] border-dashed bg-white px-[15px] py-[13px] text-left transition-colors disabled:cursor-not-allowed",anotherOpen:"aria-expanded:scale-100",menuItem:"py-2"},up={idle:{borderColor:le.line,backgroundColor:"#fff"},selected:{borderColor:ro,backgroundColor:dp},declined:{borderColor:le.danger,backgroundColor:le["danger-fill"]}},Ca={idle:{backgroundColor:io,color:lo},selected:{backgroundColor:ro,color:"#fff"}},mp={backgroundColor:io,color:lo},fp={borderColor:le.line},fr={declined:{color:le.danger},pending:{color:le.warn,backgroundColor:le["warn-fill"]},done:{color:le.ok,backgroundColor:le["ok-fill"]}},xp={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"},pp=e=>{try{return new Intl.NumberFormat("en-US",{style:"currency",currency:e}).formatToParts(0).find(a=>a.type==="currency")?.value??e}catch{return e}},hp=({method:e,currency:a,busy:s,labels:n,onToggle:r,onAmountChange:i,onAmountBlur:c,onRemove:l,testId:d})=>{const u=e.status??"idle",x=u==="pending"||u==="done",m=s||x,b=!!(e.removable&&l),f=e.cap?.currency??a,g=Rt(f),j=`${d}-amount`,y=n.amountFor.replace("{method}",e.label),v=h.useCallback(_=>{if(!Gs(_,g))return;const w=Qt(_);e.cap&&w!==null&&w>e.cap.value||i(e.id,_)},[g,e.cap,e.id,i]),C=h.useCallback(_=>{const w=_.currentTarget;requestAnimationFrame(()=>{w.isConnected&&w.select()})},[]),S=u==="declined"?"declined":e.selected?"selected":"idle",k=e.statusLabel??(u==="idle"?void 0:n[u]),$=t.jsxs("span",{className:ce.toggleHeader,children:[t.jsx("span",{className:ce.iconBox,style:e.selected?Ca.selected:Ca.idle,"data-testid":`${d}-icon`,children:t.jsx(p.Icon,{icon:sn[e.kind],width:18,height:18,"aria-hidden":"true"})}),t.jsxs("span",{className:ce.text,children:[t.jsx("span",{className:ce.label,children:e.label}),u==="declined"&&k?t.jsx("span",{className:ce.status,style:fr.declined,"data-testid":`${d}-status`,children:k}):e.subtitle&&t.jsx("span",{className:ce.subtitle,children:e.subtitle})]}),x&&k&&t.jsx("span",{className:ce.badge,style:fr[u],"data-testid":`${d}-status`,children:k})]});return t.jsxs("div",{className:ce.card,style:up[S],"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:o.cn(ce.toggle,ce.focusRing,b&&ce.toggleRemovable),"data-testid":`${d}-toggle`,children:$}),t.jsxs("div",{className:ce.amountSlot,children:[t.jsx("label",{htmlFor:j,className:"sr-only",children:y}),t.jsx(o.Input,{id:j,"aria-label":y,type:"text",inputMode:"decimal",placeholder:"0.00",value:e.amount??"",onChange:_=>v(_.target.value),onFocus:C,onBlur:()=>c?.(e.id),isDisabled:m,variant:"bordered",startContent:t.jsx("span",{className:"text-[15px] font-semibold text-default-500","aria-hidden":"true",children:pp(f)}),classNames:{inputWrapper:ce.amountWrapper,input:ce.amountInput},"data-testid":`${d}-amount`})]})]}):t.jsxs("button",{type:"button","aria-pressed":!1,disabled:m,onClick:()=>r(e.id),className:o.cn(ce.toggle,ce.toggleUnselected,ce.focusRing,b&&ce.toggleRemovable),"data-testid":`${d}-toggle`,children:[$,t.jsx("span",{className:ce.lowerSlot,style:mp,"data-testid":`${d}-cap`,children:e.cap?n.upTo.replace("{amount}",fe(e.cap.value,void 0,e.cap.currency)):n.noCap})]}),b&&t.jsx("button",{type:"button","aria-label":n.remove.replace("{method}",e.label),disabled:s,onClick:()=>l?.(e.id),className:o.cn(ce.remove,ce.focusRing),"data-testid":`${d}-remove`,children:t.jsx(p.Icon,{icon:"lucide:x",width:16,height:16,"aria-hidden":"true"})})]})},oo=({methods:e,onToggle:a,onAmountChange:s,onAmountBlur:n,onRemove:r,currency:i="USD",paidWith:c,anotherMethod:l,error:d,busy:u=!1,labels:x,className:m,"data-testid":b="refund-method-cards"})=>{const f={...xp,...x};return t.jsxs("div",{className:o.cn(ce.root,m),"data-testid":b,children:[d&&t.jsx(_a,{tone:d.tone,title:d.title,body:d.body,onRetry:d.onRetry,retryLabel:f.retry,onChooseDifferent:d.onChooseDifferent,chooseDifferentLabel:f.chooseDifferent,className:ce.banner,"data-testid":`${b}-error`,retryTestId:`${b}-retry`,chooseDifferentTestId:`${b}-choose-different`}),t.jsxs("div",{className:ce.eyebrowRow,children:[t.jsx("p",{className:ce.eyebrow,children:f.heading}),c&&t.jsx(Ea,{variant:"record",label:c.label,value:c.value,"data-testid":`${b}-paid-with`})]}),t.jsxs("div",{role:"group","aria-label":f.heading,className:ce.grid,"data-testid":`${b}-grid`,children:[e.map(g=>t.jsx(hp,{method:g,currency:i,busy:u,labels:f,onToggle:a,onAmountChange:s,onAmountBlur:n,onRemove:r,testId:`${b}-method-${g.id}`},g.id)),l&&t.jsxs(o.Dropdown,{placement:"bottom-start",isDisabled:u,classNames:{trigger:ce.anotherOpen},children:[t.jsx(o.DropdownTrigger,{children:t.jsxs("button",{type:"button",className:o.cn(ce.another,ce.focusRing),style:fp,"data-testid":`${b}-another`,children:[t.jsx("span",{className:ce.iconBox,style:Ca.idle,children:t.jsx(p.Icon,{icon:"lucide:plus",width:18,height:18,"aria-hidden":"true"})}),t.jsxs("span",{className:"min-w-0",children:[t.jsx("span",{className:ce.label,children:l.label}),t.jsx("span",{className:ce.subtitle,children:l.subtitle})]})]})}),t.jsx(o.DropdownMenu,{"aria-label":l.label,items:l.options,onAction:g=>l.onPick(String(g)),"data-testid":`${b}-another-menu`,children:g=>t.jsx(o.DropdownItem,{textValue:g.label,description:g.description,className:ce.menuItem,startContent:t.jsx("span",{className:ce.iconBox,style:Ca.idle,children:t.jsx(p.Icon,{icon:sn[g.kind],width:18,height:18,"aria-hidden":"true"})}),"data-testid":`${b}-another-option-${g.id}`,children:g.label},g.id)})]})]})]})};oo.displayName="RefundMethodCards";const Ue={root:"flex flex-col text-default-900",eyebrow:"mb-3 text-[11px] font-semibold uppercase tracking-[.08em] text-default-500",list:"flex flex-col gap-2.5",row:"flex flex-col gap-3 rounded-[14px] border-[1.5px] px-[15px] py-[13px] transition-colors",main:"flex items-center gap-[11px]",iconBox:"flex h-[38px] w-[38px] shrink-0 items-center justify-center rounded-[10px]",text:"min-w-0 flex-1",label:"block truncate text-[15px] font-semibold leading-5",note:"block truncate text-xs text-default-500",amount:"shrink-0 text-[15px] font-semibold tabular-nums",badge:"inline-flex h-[22px] shrink-0 items-center gap-[5px] whitespace-nowrap rounded-full px-[9px] text-xs font-medium leading-none",prompt:"flex flex-wrap items-center gap-3 rounded-[10px] px-3 py-2",promptText:"min-w-0 flex-1 text-[13px] font-medium",action:"h-11 min-w-0 rounded-[12px] px-4 text-[14px] font-semibold"},co="hsl(var(--heroui-primary))",bp={idle:{borderColor:le.line,backgroundColor:"#fff"},active:{borderColor:co,backgroundColor:"hsl(var(--heroui-primary) / 0.05)"},failed:{borderColor:le.danger,backgroundColor:le["danger-fill"]}},xr={idle:{backgroundColor:"hsl(var(--heroui-default-100))",color:"hsl(var(--heroui-default-600))"},active:{backgroundColor:co,color:"#fff"}},gp={backgroundColor:"#fff",color:le.neutral},Dt=e=>({color:Ze[e].fg,backgroundColor:Ze[e].bg}),yp={queued:Dt("neutral"),processing:Dt("info"),waiting_reader:Dt("warn"),waiting_cash:Dt("warn"),done:Dt("ok"),failed:Dt("danger")},vp={heading:"Refunding",queued:"Queued",processing:"Processing",waitingReader:"Waiting for reader",waitingCash:"Waiting for cash",done:"Refunded",failed:"Failed"},jp={queued:"queued",processing:"processing",waiting_reader:"waitingReader",waiting_cash:"waitingCash",done:"done",failed:"failed"},pr={waiting_reader:"lucide:nfc",waiting_cash:"lucide:banknote"},wp=e=>e.status==="processing"||e.status==="waiting_reader"||e.status==="waiting_cash",uo=({parts:e,activeId:a,labels:s,className:n,"data-testid":r="refund-progress-list"})=>{const i={...vp,...s},c=a??e.find(wp)?.id;return t.jsxs("div",{className:o.cn(Ue.root,n),"data-testid":r,children:[t.jsx("p",{className:Ue.eyebrow,children:i.heading}),t.jsx("ol",{"aria-label":i.heading,className:Ue.list,children:e.map(l=>{const d=l.id===c,u=`${r}-part-${l.id}`,x=d?"active":l.status==="failed"?"failed":"idle";return t.jsxs("li",{"aria-current":d?"step":void 0,className:Ue.row,style:bp[x],"data-status":l.status,"data-active":d||void 0,"data-testid":u,children:[t.jsxs("div",{className:Ue.main,children:[t.jsx("span",{className:Ue.iconBox,style:d?xr.active:xr.idle,children:t.jsx(p.Icon,{icon:sn[l.kind],width:18,height:18,"aria-hidden":"true"})}),t.jsxs("span",{className:Ue.text,children:[t.jsx("span",{className:Ue.label,children:l.label}),l.note&&t.jsx("span",{className:Ue.note,children:l.note})]}),t.jsx("span",{className:Ue.amount,children:fe(l.amount.value,void 0,l.amount.currency)}),t.jsxs("span",{className:Ue.badge,style:yp[l.status],"data-testid":`${u}-status`,children:[l.status==="processing"&&t.jsx(p.Icon,{icon:"lucide:loader-circle",width:12,height:12,className:"animate-spin","aria-hidden":"true"}),i[jp[l.status]]]})]}),(l.prompt||l.action)&&t.jsxs("div",{role:"status",className:Ue.prompt,style:gp,"data-testid":`${u}-prompt`,children:[pr[l.status]&&t.jsx(p.Icon,{icon:pr[l.status],width:18,height:18,"aria-hidden":"true"}),l.prompt&&t.jsx("span",{className:Ue.promptText,children:l.prompt}),l.action&&t.jsx(p.Button,{color:"primary",className:Ue.action,onPress:l.action.onPress,isLoading:l.action.loading,isDisabled:l.action.disabled,"data-testid":`${u}-action`,children:l.action.label})]})]},l.id)})})]})};uo.displayName="RefundProgressList";const Np={label:"Supervisor authorization",placeholder:"••••"},mo=({pin:e,onChange:a,hint:s,error:n,labels:r,className:i,"data-testid":c="pin-field"})=>{const l={...Np,...r};return t.jsxs("div",{className:o.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":c,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,{icon:"lucide:lock",width:26,height:26,"aria-hidden":"true"})}),t.jsx("p",{className:"text-[17px] font-semibold",children:l.label}),s&&t.jsx("p",{className:"mt-1.5 text-[13px] text-default-500",children:s}),t.jsx(o.Input,{type:"password",inputMode:"numeric","aria-label":l.label,placeholder:l.placeholder,value:e,onChange:d=>a(d.target.value.replace(/\D/g,"").slice(0,6)),isInvalid:!!n,errorMessage:n,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":`${c}-input`})]})};mo.displayName="PinField";const Cp={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"},kp={refund:{},payment:{title:"Payment complete",done:"New sale",authorizedBy:"Handled by {name}"}},Sp={succeeded:"bg-pos-ok-fill text-pos-ok",pending:"bg-pos-warn-fill text-pos-warn"},$p="inline-flex h-[1.375rem] items-center gap-[0.3125rem] whitespace-nowrap rounded-full px-[0.5625rem] text-xs font-medium leading-none",Ht="mb-1.5 text-[0.6875rem] font-semibold uppercase tracking-[.05em] text-pos-muted",Ap="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)]",Dp=["email","print"],xa=`${p.stillTransitionClass} motion-reduce:data-[pressed=true]:scale-100 [html[data-pos-reduce-motion=true]_&]:data-[pressed=true]:scale-100`,we={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 ${xa}`,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] ${xa}`,send:`h-10 w-full rounded-xl px-4 text-sm font-semibold ${xa}`,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"},fo=({state:e,kind:a="refund",total:s,destinations:n,subtitle:r,reason:i,paidWith:c,outcomeGroups:l,changeDue:d,authorizedBy:u,selectedReceipts:x,onSendReceipt:m,receiptActions:b,emailReceipt:f,onDone:g,frameless:j=!1,labels:y,className:v,"data-testid":C="outcome-view"})=>{const S={...Cp,...kp[a],...y},k=h.useId(),$=s?fe(s.value,void 0,s.currency):null;return e==="processing"?t.jsx("div",{className:o.cn("flex flex-col items-center justify-center text-center text-pos-ink",v),"aria-live":"polite","data-testid":C,children:t.jsxs("div",{className:"flex flex-col items-center px-5 py-[3.75rem]","data-testid":`${C}-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 ${p.stillAnimationClass}`,role:"presentation"}),t.jsx("p",{className:"text-[1.0625rem] font-semibold",children:S.processing}),$&&t.jsx("p",{className:"mt-2 text-[0.9375rem] font-semibold tabular-nums","data-testid":`${C}-processing-total`,children:$})]})}):t.jsxs("div",{className:o.cn("flex flex-col text-pos-ink",!j&&Ap,v),"aria-live":"polite","data-testid":C,children:[t.jsxs("div",{className:o.cn("text-center",a==="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,{icon:"solar:check-circle-bold",width:"100%",height:"100%"})})}),d?t.jsxs(t.Fragment,{children:[t.jsx("p",{className:we.changeTitle,"data-testid":`${C}-title`,children:S.title}),t.jsx("p",{className:we.changeLabel,children:S.changeDue}),t.jsx("p",{className:we.changeAmount,"data-testid":`${C}-change`,children:fe(d.amount.value,void 0,d.amount.currency)}),d.caption&&t.jsx("p",{className:we.changeCaption,"data-testid":`${C}-change-caption`,children:d.caption})]}):t.jsxs(t.Fragment,{children:[t.jsx("p",{className:"text-[1.375rem] font-semibold","data-testid":`${C}-title`,children:S.title}),$&&t.jsx("p",{className:"my-1 text-[1.875rem] font-semibold tabular-nums","data-testid":`${C}-total`,children:$}),r&&t.jsx("p",{className:"text-[0.8125rem] text-pos-muted","data-testid":`${C}-subtitle`,children:r})]}),i&&t.jsx("p",{className:"text-[0.8125rem] text-pos-muted","data-testid":`${C}-reason`,children:S.reason.replace("{reason}",i)})]}),c&&c.length>0&&t.jsxs("div",{className:"mt-5 text-left","data-testid":`${C}-paid-with`,children:[t.jsx("p",{className:Ht,children:S.paidWithTitle}),c.map((_,w)=>t.jsxs("div",{className:we.paidRow,"data-testid":`${C}-paid-with-${w}`,children:[_.icon&&t.jsx("span",{className:we.paidIcon,"aria-hidden":"true",children:t.jsx("span",{className:"flex h-4 w-4",children:t.jsx(p.Icon,{icon:_.icon,width:"100%",height:"100%"})})}),t.jsx("span",{className:we.paidLabel,children:_.label}),t.jsx("span",{className:we.paidAmount,children:fe(_.amount.value,void 0,_.amount.currency)}),_.status&&t.jsx("span",{className:we.paidStatus,children:_.status})]},`${_.label}-${w}`))]}),l&&l.length>0&&t.jsxs("div",{className:"mt-5 text-left","data-testid":`${C}-outcome`,children:[t.jsx("p",{className:Ht,children:S.outcomeTitle}),t.jsx("div",{className:we.groups,children:l.map((_,w)=>t.jsxs("div",{"data-testid":`${C}-outcome-${w}`,children:[t.jsx("p",{className:we.groupLabel,children:_.label}),t.jsx("ul",{className:we.groupItems,"aria-label":_.label,children:_.items.map((F,A)=>t.jsx("li",{className:we.groupItem,children:F},`${F}-${A}`))})]},`${_.label}-${w}`))})]}),n&&t.jsxs("div",{className:"mt-5 text-left",children:[t.jsx("p",{className:Ht,children:S.destinationsTitle}),n.map((_,w)=>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":`${C}-destination-${w}-${_.status}`,children:[t.jsx("span",{className:"font-semibold",children:_.label}),t.jsxs("div",{className:"flex items-center gap-2.5",children:[t.jsx("span",{className:"tabular-nums text-pos-neutral",children:fe(_.amount.value,void 0,_.amount.currency)}),t.jsx("span",{className:o.cn($p,Sp[_.status]),children:_.status==="succeeded"?S.succeeded:S.pending})]})]},`${_.label}-${w}`))]}),b&&b.length>0?t.jsxs("div",{className:"mt-5 flex flex-col text-left","data-testid":`${C}-receipt-actions`,children:[t.jsx("p",{className:Ht,children:S.sendReceipt}),t.jsx("div",{className:we.receiptRow,children:b.map(_=>t.jsx(Ep,{action:_,controls:_.expanded?k:void 0,"data-testid":`${C}-receipt-action-${_.key}`},_.key))}),f&&t.jsx(Lp,{id:k,email:f,labels:S,"data-testid":`${C}-email`})]}):m&&t.jsxs("div",{className:"mt-5 text-left",children:[t.jsx("p",{className:Ht,children:S.sendReceipt}),t.jsx("div",{className:"flex flex-col gap-2",children:Dp.map(_=>{const w=x?.includes(_)??!1;return t.jsxs("button",{type:"button",role:"checkbox","aria-checked":w,onClick:()=>m(_),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 ${p.stillTransitionClass}`,"data-testid":`${C}-receipt-${_}`,children:[t.jsx("span",{"aria-hidden":"true",className:"pointer-events-none flex",children:t.jsx(o.Checkbox,{isSelected:w,isReadOnly:!0,tabIndex:-1})}),t.jsx("span",{children:S[_]})]},_)})})]}),u&&t.jsx("p",{className:"mt-4 text-[0.78125rem] text-pos-muted","data-testid":`${C}-authorized-by`,children:S.authorizedBy.replace("{name}",u)}),t.jsx("div",{className:"mt-auto pt-5",children:t.jsx(p.Button,{color:"primary",className:`h-12 w-full rounded-[0.875rem] px-5 text-[0.9375rem] font-semibold ${xa}`,onPress:g,"data-testid":`${C}-done`,children:S.done})})]})};fo.displayName="OutcomeView";function Ep({action:e,controls:a,"data-testid":s}){return t.jsx(p.Button,{variant:"bordered",color:"default",disableRipple:!0,className:o.cn(we.receiptAction,e.expanded&&we.receiptActionExpanded),"aria-expanded":e.expanded,"aria-controls":a,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,{icon:e.icon,width:"100%",height:"100%"})}):void 0,"data-testid":s,children:e.label})}function Lp({id:e,email:a,labels:s,"data-testid":n}){const r=a.isSendDisabled??a.emails.length===0;return t.jsxs("div",{id:e,className:we.emailBox,"data-testid":n,children:[t.jsxs("div",{className:o.cn(we.chipWrap,a.isInvalid?"border-pos-danger":"border-pos-line"),"data-invalid":a.isInvalid||void 0,"data-testid":`${n}-recipients`,children:[a.emails.map(i=>t.jsxs("span",{className:we.chip,"data-testid":`${n}-chip`,children:[i,t.jsx(p.Button,{isIconOnly:!0,variant:"light",color:"default",disableRipple:!0,className:we.chipRemove,"aria-label":s.removeEmail.replace("{email}",i),onPress:()=>a.onRemoveEmail(i),"data-testid":`${n}-remove`,children:t.jsx("span",{"aria-hidden":"true",className:"flex h-[0.9375rem] w-[0.9375rem]",children:t.jsx(p.Icon,{icon:"lucide:x",width:"100%",height:"100%"})})})]},i)),t.jsx(o.Input,{"aria-label":s.emailAriaLabel,placeholder:s.emailPlaceholder,type:"email",value:a.draft,onValueChange:a.onDraftChange,onKeyDown:i=>{i.key==="Enter"&&a.draft.trim()!==""&&(i.preventDefault(),a.onAddEmail(a.draft.trim()))},isInvalid:a.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 ${p.stillTransitionClass}`,input:"text-[0.8125rem] text-pos-ink placeholder:text-pos-muted group-data-[invalid=true]:text-pos-ink"},"data-testid":`${n}-input`})]}),t.jsx(p.Button,{color:"secondary",className:we.send,isDisabled:r,isLoading:a.isSending,onPress:a.onSend,"data-testid":`${n}-send`,children:s.sendEmail})]})}const Pe={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"},Fp="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",_p="calc(100vw - 1.5rem)",xo=({label:e,value:a,options:s,onChange:n,clearLabel:r,minWidth:i,"data-testid":c="filter-select"})=>{const l=a!==null,d=l?s.find(f=>f.value===a)?.label:void 0,u=h.useRef(null),x=h.useRef(null),[m,b]=h.useState();return t.jsxs("div",{ref:u,"data-testid":c,"data-slot":"filter-select","data-active":l?"true":void 0,title:d,className:o.cn(Pe.base,l&&Pe.baseActive),style:i===void 0?void 0:{"--filter-select-min":lt(i)},children:[t.jsx(p.Select,{"aria-label":e,placeholder:e,size:"sm",variant:"bordered",radius:"md",selectedKeys:a===null?[]:[a],onSelectionChange:f=>{if(f==="all")return;const g=[...f][0];n(g===void 0?null:String(g))},onOpenChange:f=>{f&&b(u.current?.getBoundingClientRect().width)},popoverProps:{ref:x,placement:"bottom-start",style:{minWidth:m,maxWidth:_p}},"data-testid":`${c}-trigger`,classNames:{base:o.cn(Pe.select,Pe.cell),trigger:o.cn(Pe.trigger,l&&Pe.triggerActive),value:o.cn(Pe.value,l&&Pe.valueActive),selectorIcon:o.cn(l&&Pe.iconActive)},children:s.map(f=>t.jsx(o.SelectItem,{classNames:{title:Pe.optionTitle},children:f.label},f.value))}),t.jsx("span",{"aria-hidden":"true","data-testid":`${c}-sizer`,className:o.cn(Pe.sizer,l&&Pe.sizerActive,Pe.cell),children:d??e}),l&&t.jsx("button",{type:"button","aria-label":r,onClick:()=>{n(null),u.current?.querySelector('[data-slot="trigger"]')?.focus()},"data-testid":`${c}-clear`,className:Pe.clear,children:t.jsx(p.Icon,{icon:"lucide:x",className:Pe.clearIcon,"aria-hidden":"true"})})]})};xo.displayName="FilterSelect";const po=({children:e,className:a,"data-testid":s="filter-select-group"})=>t.jsx("div",{"data-testid":s,"data-slot":"filter-select-group",className:o.cn(Fp,a),style:{"--filter-select-count":h.Children.toArray(e).length},children:e});po.displayName="FilterSelectGroup";const mt={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"},ho=({status:e,onLoadMore:a,loadingLabel:s,errorLabel:n,retryLabel:r,endLabel:i,"data-testid":c="load-more-footer"})=>{const l=h.useRef(null),d=h.useRef(a),u=h.useRef(!1);return h.useEffect(()=>{d.current=a},[a]),h.useEffect(()=>{if(e!=="idle"){u.current=!1;return}const x=l.current;if(!x||typeof IntersectionObserver>"u")return;const m=new IntersectionObserver(b=>{u.current||!b.some(f=>f.isIntersecting)||(u.current=!0,d.current())},{rootMargin:"0px 0px 200px 0px"});return m.observe(x),()=>m.disconnect()},[e]),e==="idle"?t.jsx("div",{"data-testid":c,"data-status":"idle",className:mt.idle,children:t.jsx("div",{ref:l,"aria-hidden":"true","data-testid":`${c}-sentinel`,className:mt.sentinel})}):e==="loading"?t.jsxs("div",{"data-testid":c,"data-status":"loading",role:"status","aria-live":"polite",className:mt.base,children:[t.jsx("span",{"aria-hidden":"true",className:mt.spinner,children:t.jsx(o.Spinner,{size:"sm",color:"default"})}),t.jsx("span",{"data-testid":`${c}-loading`,children:s})]}):e==="error"?t.jsxs("div",{"data-testid":c,"data-status":"error",className:mt.base,children:[t.jsx("span",{role:"alert","data-testid":`${c}-error`,className:mt.error,children:n}),t.jsx(p.Button,{size:"sm",color:"default",variant:"bordered",radius:"md",onPress:a,testId:`${c}-retry`,children:r})]}):t.jsx("div",{"data-testid":c,"data-status":"end",className:i?mt.base:mt.idle,children:i&&t.jsx("span",{"data-testid":`${c}-end`,children:i})})};ho.displayName="LoadMoreFooter";const ke={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 ${p.stillTransitionClass}`,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"},hr=({item:e,withActions:a})=>t.jsxs(t.Fragment,{children:[t.jsxs("span",{className:o.cn(ke.headline,a&&ke.headlineWithActions),children:[t.jsx("span",{className:ke.title,children:e.title}),p.hasContent(e.amount)&&!a&&t.jsx("span",{className:ke.amount,children:e.amount})]}),a?(p.hasContent(e.chips)||p.hasContent(e.amount))&&t.jsxs("span",{className:ke.chipsLine,children:[p.hasContent(e.chips)&&t.jsx("span",{className:ke.chipsInline,children:e.chips}),p.hasContent(e.amount)&&t.jsx("span",{className:ke.amount,children:e.amount})]}):p.hasContent(e.chips)&&t.jsx("span",{className:ke.chips,children:e.chips}),e.rows&&e.rows.length>0&&t.jsx("span",{className:ke.rows,children:e.rows.map((s,n)=>t.jsxs("span",{className:ke.row,children:[t.jsx("span",{className:ke.rowLabel,children:s.label}),t.jsx("span",{className:ke.rowValue,children:s.value})]},n))})]}),bo=({items:e,ariaLabel:a,onSelect:s,loading:n=!1,skeletonCount:r=6,"data-testid":i="card-list"})=>t.jsx("div",{"data-testid":i,className:ke.base,children:n?t.jsx("div",{role:"status","aria-busy":"true","aria-label":a,"data-testid":`${i}-skeleton`,children:t.jsx("div",{"aria-hidden":"true",children:Array.from({length:r},(c,l)=>t.jsxs("div",{"data-testid":`${i}-skeleton-row`,className:ke.skeletonRow,children:[t.jsx("div",{className:p.shimmerClass,style:{height:lt(13),width:lt(130)}}),t.jsx("div",{className:p.shimmerClass,style:{height:lt(11),width:"70%",marginTop:lt(10)}}),t.jsx("div",{className:p.shimmerClass,style:{height:lt(11),width:"45%",marginTop:lt(8)}})]},l))})}):t.jsx("ul",{"aria-label":a,className:ke.list,children:e.map(c=>{const l=p.hasContent(c.actions);return t.jsxs("li",{"data-testid":`${i}-item-${c.id}`,className:ke.item,children:[s?t.jsx("button",{type:"button",onClick:()=>s(c.id),className:o.cn(ke.card,ke.cardInteractive),children:t.jsx(hr,{item:c,withActions:l})}):t.jsx("div",{className:ke.card,children:t.jsx(hr,{item:c,withActions:l})}),l&&t.jsx("div",{"data-testid":`${i}-item-${c.id}-actions`,className:ke.actions,children:c.actions})]},c.id)})})});bo.displayName="CardList";const Rp=48,re={base:`mb-4 overflow-hidden rounded-2xl border border-pos-line bg-white ${La}`,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 ${p.stillTransitionClass}`,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"},go=h.forwardRef((e,a)=>t.jsx("li",{ref:a,...Object.fromEntries(Object.entries(e).filter(([s])=>s!=="data-testid"))}));go.displayName="CrumbBase";const yo=({breadcrumb:e=[],onBack:a,backLabel:s,title:n,meta:r,amountLabel:i,amount:c,amountCaption:l,recordId:d,chips:u,statItems:x,stats:m,banner:b,"data-testid":f="record-header"})=>{const{ref:g,width:j}=It(),y=!ta(j,Rp),v=e.length>0||!!a,C=!!(x&&x.length>0),S=!!i||p.hasContent(c)||p.hasContent(l)||p.hasContent(d)||p.hasContent(u)||C;return t.jsxs("div",{ref:g,"data-testid":f,"data-size":y?"narrow":"wide",className:re.base,children:[v&&t.jsxs("div",{"data-testid":`${f}-band`,className:re.band,children:[a&&t.jsx("button",{type:"button",onClick:a,"aria-label":s,"data-testid":`${f}-back`,className:re.back,children:t.jsx(p.Icon,{icon:"lucide:chevron-left",className:re.backIcon,"aria-hidden":"true"})}),t.jsx(o.Breadcrumbs,{separator:"/","data-testid":`${f}-breadcrumb`,classNames:{base:re.breadcrumb,list:re.breadcrumbList},itemClasses:{base:re.crumbBase,item:re.crumb,separator:re.crumbSeparator},children:e.map((k,$)=>t.jsx(o.BreadcrumbItem,{as:go,"data-testid":`${f}-crumb-${$}`,isDisabled:!k.onClick&&$<e.length-1,onPress:k.onClick?()=>k.onClick?.():void 0,children:k.label},$))})]}),t.jsxs("div",{className:o.cn(re.body,y?re.bodyNarrow:re.bodyWide),children:[t.jsxs("div",{className:re.identity,children:[t.jsx("h1",{"data-testid":`${f}-title`,className:o.cn(re.title,y?re.titleNarrow:re.titleWide),children:n}),r&&r.length>0&&t.jsx("ul",{"data-testid":`${f}-meta`,className:re.meta,children:r.map((k,$)=>t.jsxs("li",{className:re.metaLine,children:[k.icon!=null&&t.jsx("span",{"aria-hidden":"true",className:re.metaIcon,children:k.icon}),t.jsx("span",{className:re.metaText,children:k.text})]},$))})]}),S&&t.jsxs("div",{"data-testid":`${f}-money`,className:o.cn(re.money,y?re.moneyNarrow:re.moneyWide),children:[i&&t.jsx("div",{className:re.amountLabel,children:i}),p.hasContent(c)&&t.jsx("div",{"data-testid":`${f}-amount`,className:o.cn(re.amount,y?re.amountNarrow:re.amountWide),children:c}),p.hasContent(l)&&t.jsx("div",{className:re.amountCaption,children:l}),p.hasContent(d)&&t.jsx("div",{"data-testid":`${f}-record-id`,className:re.recordId,children:d}),p.hasContent(u)&&t.jsx("div",{"data-testid":`${f}-chips`,className:o.cn(re.chips,y?re.chipsNarrow:re.chipsWide),children:u}),C&&t.jsx("dl",{"data-testid":`${f}-stat-items`,className:re.statItems,children:x?.map((k,$)=>t.jsxs("div",{"data-testid":`${f}-stat-${$}`,className:o.cn(re.stat,y?re.statNarrow:re.statWide),children:[t.jsx("dt",{"data-testid":`${f}-stat-${$}-label`,className:re.statLabel,children:k.label}),t.jsx("dd",{"data-testid":`${f}-stat-${$}-value`,className:re.statValue,style:k.tone?{color:Ze[k.tone].fg}:void 0,children:k.value})]},k.id??$))})]})]}),p.hasContent(m)&&t.jsx("div",{"data-testid":`${f}-stats`,className:y?re.statsNarrow:re.statsWide,children:m}),p.hasContent(b)&&t.jsx("div",{"data-testid":`${f}-banner`,children:b})]})};yo.displayName="RecordHeader";const Ip=50,Wt={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]"},vo=({children:e,aside:a,"data-testid":s="record-layout"})=>{const{ref:n,width:r}=It(),i=p.hasContent(a),c=i&&r>0&&ta(r,Ip),l=t.jsx("div",{"data-testid":`${s}-main`,className:Wt.column,children:e},"main"),d=i?t.jsx("div",{"data-testid":`${s}-aside`,className:Wt.aside,children:a},"aside"):null;return t.jsx("div",{ref:n,"data-testid":s,"data-layout":c?"split":"stacked",className:o.cn(Wt.base,c?Wt.split:Wt.stacked),children:c?[l,d]:[d,l]})};vo.displayName="RecordLayout";const Mp=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"},jo=({items:e,"data-testid":a="stat-tiles"})=>{const{ref:s,width:n}=It(),r=n>=Um?Math.max(e.length,1):n>=Mp?2:1;return t.jsx("div",{ref:s,"data-testid":a,"data-columns":r,className:qt.base,style:{gridTemplateColumns:`repeat(${r}, minmax(0, 1fr))`},children:e.map((i,c)=>t.jsxs("div",{"data-testid":`${a}-item-${c}`,className:qt.tile,children:[t.jsx("div",{"data-testid":`${a}-item-${c}-value`,className:qt.value,style:i.tone?{color:Ze[i.tone].fg}:void 0,children:i.value}),t.jsx("div",{"data-testid":`${a}-item-${c}-label`,className:qt.label,children:i.label}),p.hasContent(i.caption)&&t.jsx("div",{"data-testid":`${a}-item-${c}-caption`,className:qt.caption,children:i.caption})]},c))})};jo.displayName="StatTiles";const it={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"},Bp={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]"}},nn="pill-tabs",rn=(e,a=nn)=>`${a}-tab-${e}`,ln=(e,a=nn)=>`${a}-panel-${e}`,Pp=(e,a=nn)=>({role:"tabpanel",id:ln(e,a),"aria-labelledby":rn(e,a),tabIndex:0}),wo=({items:e,value:a,onChange:s,ariaLabel:n,idPrefix:r,size:i="md","data-testid":c="pill-tabs"})=>{const l=p.useReducedMotion(),d=!!o.useProviderContext()?.disableAnimation,u=r??c,x=Bp[i];return t.jsx(o.Tabs,{"aria-label":n,variant:"solid",radius:"full",fullWidth:!0,disableAnimation:l||void 0,selectedKey:a,onSelectionChange:m=>s(String(m)),"data-testid":c,"data-size":i,classNames:{base:it.base,tabList:it.tabList,cursor:it.cursor,tab:o.cn(it.tab,x.tab,(l||d)&&it.tabStill),tabContent:o.cn(x.tabContent,it.tabContent)},children:e.map(m=>{const b=m["data-testid"]??`${c}-${m.key}`;return t.jsx(o.Tab,{id:rn(m.key,u),"aria-controls":ln(m.key,u),"data-testid":b,title:t.jsxs("span",{className:o.cn(it.title,x.title),children:[p.hasContent(m.icon)&&t.jsx("span",{"aria-hidden":"true","data-testid":`${b}-icon`,className:o.cn(it.icon,x.icon),children:m.icon}),m.label,m.count!==void 0&&t.jsx("span",{"data-testid":`${b}-count`,className:o.cn(x.count,it.count),children:m.count})]})},m.key)})})};wo.displayName="PillTabs";const je={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 ${p.stillTransitionClass}`,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"},br=({row:e,testId:a})=>t.jsxs(t.Fragment,{children:[t.jsx("span",{"aria-hidden":"true",className:je.dot,style:{backgroundColor:Ze[e.tone].fg}}),t.jsxs("span",{className:je.body,children:[t.jsx("span",{className:je.title,children:e.title}),(e.reference!=null||e.timestamp!=null)&&t.jsxs("span",{className:je.meta,children:[e.reference!=null&&t.jsx("span",{className:je.reference,children:e.reference}),e.reference!=null&&e.timestamp!=null&&t.jsx("span",{"aria-hidden":"true",className:je.separator,children:"·"}),e.timestamp!=null&&t.jsx("span",{className:je.timestamp,children:e.timestamp})]}),e.detail!=null&&t.jsx("span",{className:je.detail,children:e.detail})]}),t.jsx("span",{className:je.trailing,children:e.amount!=null?t.jsx("span",{"data-testid":`${a}-amount`,className:je.amount,style:aa(e.amountTone),children:e.amount}):e.note!=null?t.jsx("span",{"data-testid":`${a}-note`,className:je.note,style:e.noteTone==="warn"?{color:Ze.warn.fg}:void 0,children:e.note}):null})]}),No=({rows:e,footer:a,emptyContent:s,onSelect:n,"data-testid":r="amount-list"})=>e.length===0?t.jsx("div",{"data-testid":r,className:je.base,children:s!=null&&t.jsx("div",{"data-testid":`${r}-empty`,className:je.empty,children:s})}):t.jsxs("div",{"data-testid":r,className:je.base,children:[t.jsx("ul",{className:je.list,children:e.map(i=>{const c=`${r}-row-${i.id}`;return t.jsx("li",{"data-testid":c,className:je.item,children:n?t.jsx("button",{type:"button",onClick:()=>n(i.id),className:o.cn(je.row,je.rowInteractive),children:t.jsx(br,{row:i,testId:c})}):t.jsx("div",{className:je.row,children:t.jsx(br,{row:i,testId:c})})},i.id)})}),a&&t.jsxs(t.Fragment,{children:[t.jsxs("div",{"data-testid":`${r}-footer`,className:je.footer,children:[t.jsx("span",{className:je.footerLabel,children:a.label}),t.jsx("span",{"data-testid":`${r}-footer-amount`,className:je.footerAmount,style:aa(a.amountTone),children:a.amount})]}),a.note!=null&&t.jsx("div",{"data-testid":`${r}-footer-note`,className:je.footerNote,children:a.note})]})]});No.displayName="AmountList";const qe={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"},Co=({events:e,emptyContent:a,"data-testid":s="activity-timeline"})=>e.length===0?t.jsx("div",{"data-testid":s,children:a!=null&&t.jsx("div",{"data-testid":`${s}-empty`,className:qe.empty,children:a})}):t.jsx("ol",{"data-testid":s,className:qe.list,children:e.map((n,r)=>{const i=r===e.length-1,c=`${s}-event-${n.id}`;return t.jsxs("li",{"data-testid":c,className:o.cn(qe.event,!i&&qe.eventSpaced),children:[t.jsxs("span",{"aria-hidden":"true",className:qe.rail,children:[t.jsx("span",{className:qe.dot,style:{backgroundColor:Ze[n.tone].fg}}),!i&&t.jsx("span",{"data-testid":`${c}-connector`,className:qe.connector})]}),t.jsxs("div",{className:qe.body,children:[t.jsxs("div",{className:qe.head,children:[t.jsx("span",{className:qe.title,children:n.title}),t.jsx("span",{className:qe.timestamp,children:n.timestamp})]}),p.hasContent(n.detail)&&t.jsx("div",{className:qe.detail,children:n.detail}),p.hasContent(n.actor)&&t.jsx("div",{"data-testid":`${c}-actor`,className:qe.actor,children:n.actor})]})]},n.id)})});Co.displayName="ActivityTimeline";const _e={base:`overflow-hidden rounded-2xl border border-pos-line bg-white ${La}`,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 ${p.stillTransitionClass}`,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"},gr=({row:e,testId:a})=>t.jsxs(t.Fragment,{children:[t.jsxs("span",{className:_e.rowBody,children:[t.jsxs("span",{className:_e.rowHead,children:[t.jsx("span",{className:e.onSelect?_e.primaryLinked:_e.primaryPlain,children:e.primary}),e.chip]}),!!e.secondary&&t.jsx("span",{className:_e.secondary,children:e.secondary})]}),!!e.amount&&t.jsx("span",{"data-testid":`${a}-amount`,className:_e.amount,style:aa(e.amountTone),children:e.amount})]}),ko=({title:e,count:a,rows:s,emptyContent:n,"data-testid":r="related-record-list"})=>{const i=h.useId(),c=!!e;return t.jsxs("section",{"data-testid":r,role:c?"group":void 0,"aria-labelledby":c?i:void 0,className:_e.base,children:[c&&t.jsxs("div",{className:_e.header,children:[t.jsx("h3",{id:i,className:_e.title,children:e}),a!==void 0&&t.jsx("span",{"data-testid":`${r}-count`,className:_e.count,children:a})]}),s.length===0?!!n&&t.jsx("div",{"data-testid":`${r}-empty`,className:o.cn(_e.empty,!c&&_e.emptyHeadless),children:n}):t.jsx("ul",{className:_e.list,children:s.map((l,d)=>{const u=`${r}-row-${l.id}`;return t.jsx("li",{"data-testid":u,className:o.cn(_e.item,d===0&&!c&&_e.itemFirstHeadless),children:l.onSelect?t.jsx("button",{type:"button",onClick:l.onSelect,className:o.cn(_e.row,_e.rowInteractive),children:t.jsx(gr,{row:l,testId:u})}):t.jsx("div",{className:_e.row,children:t.jsx(gr,{row:l,testId:u})})},l.id)})})]})};ko.displayName="RelatedRecordList";const So=({title:e,titleAs:a="h2",icon:s,count:n,badge:r,action:i,description:c,footer:l,variant:d="section",body:u="padded",surface:x="card",className:m,children:b,"data-testid":f="record-card"})=>{const g=h.useId(),j=p.hasContent(e);return t.jsxs("section",{"data-testid":f,"data-variant":d,"data-surface":x,role:j?"group":void 0,"aria-labelledby":j?g:void 0,className:o.cn(rt.base,Ef[x],m),children:[j&&t.jsxs("div",{"data-testid":`${f}-header`,className:Lf[d],children:[p.hasContent(s)&&t.jsx("span",{"aria-hidden":"true",className:rt.icon,children:s}),t.jsx(a,{id:g,className:rt.title,children:e}),p.hasContent(n)&&t.jsx("span",{"data-testid":`${f}-count`,className:rt.count,children:n}),r,p.hasContent(i)&&t.jsx("span",{"data-testid":`${f}-action`,className:rt.action,children:i})]}),t.jsxs("div",{"data-testid":`${f}-body`,className:Ff[d][u],children:[p.hasContent(c)&&t.jsx("p",{"data-testid":`${f}-description`,className:rt.description,children:c}),b,p.hasContent(l)&&t.jsx("div",{"data-testid":`${f}-footer`,className:o.cn(rt.footer,p.hasContent(b)?rt.footerAfterContent:rt.footerAfterDescription),children:l})]})]})};So.displayName="RecordCard";const Tp={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]"},$o=({layout:e="stack",className:a,children:s,"data-testid":n="card-stack",...r})=>t.jsx("div",{...r,"data-testid":n,"data-layout":e,className:o.cn(Tp[e],a),children:s});$o.displayName="CardStack";const ua={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]"},Op={regular:"py-[0.5625rem]",compact:"py-2"},Ao=({rows:e,density:a="regular","data-testid":s="key-value-rows"})=>t.jsx("dl",{"data-testid":s,className:ua.list,children:e.map((n,r)=>t.jsxs("div",{"data-testid":`${s}-row-${n.id??r}`,className:o.cn(ua.row,Op[a]),children:[t.jsx("dt",{className:ua.label,children:n.label}),t.jsx("dd",{className:ua.value,children:n.value})]},n.id??r))});Ao.displayName="KeyValueRows";const Xe={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"},Do=({items:e,ariaLabel:a,originalAmountLabel:s,"data-testid":n="line-item-rows"})=>t.jsx("ul",{"aria-label":a,"data-testid":n,className:Xe.list,children:e.map(r=>{const i=`${n}-item-${r.id}`,c=p.hasContent(r.originalAmount);return t.jsxs("li",{"data-testid":i,className:Xe.row,style:r.tone?{backgroundColor:Ze[r.tone].bg}:void 0,children:[t.jsxs("div",{className:Xe.body,children:[t.jsx("div",{className:Xe.name,children:r.name}),r.details&&r.details.length>0&&t.jsx("div",{"data-testid":`${i}-details`,className:Xe.details,children:r.details.map((l,d)=>t.jsxs(h.Fragment,{children:[d>0&&t.jsx("span",{"aria-hidden":"true",className:Xe.separator,children:"·"}),t.jsx("span",{className:Xe.detail,children:l})]},d))})]}),t.jsxs("div",{className:Xe.trailing,children:[t.jsxs("span",{className:Xe.amounts,children:[c&&t.jsxs("s",{"data-testid":`${i}-original`,className:Xe.original,children:[s&&t.jsxs("span",{className:"sr-only",children:[s," "]}),r.originalAmount]}),t.jsx("span",{"data-testid":`${i}-amount`,className:Xe.amount,style:c?{color:Ze.ok.fg}:void 0,children:r.amount})]}),r.chip]})]},r.id)})});Do.displayName="LineItemRows";const zp=37.5,Ie={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"},Eo=({rows:e,total:a,memo:s,"data-testid":n="record-totals"})=>{const{ref:r,width:i}=It(),c=i>0&&!ta(i,zp),l=c?Ie.rowNarrow:Ie.rowWide,d=c?Ie.labelNarrow:Ie.labelWide,u=c?Ie.noteNarrow:Ie.noteWide;return t.jsxs("div",{ref:r,"data-testid":n,"data-size":c?"narrow":"wide",className:Ie.base,children:[e.map(x=>{const m=`${n}-row-${x.id}`;return t.jsxs("div",{"data-testid":m,className:o.cn(l,Ie.row),children:[t.jsx("span",{"data-testid":`${m}-label`,className:o.cn(d,Ie.label),children:x.label}),t.jsx("span",{"data-testid":`${m}-note`,className:o.cn(u,Ie.note),children:x.note}),t.jsx("span",{"data-testid":`${m}-value`,className:Ie.value,style:aa(x.tone),children:x.value})]},x.id)}),t.jsx("div",{className:Ie.totalRule,children:t.jsxs("div",{"data-testid":`${n}-total`,className:o.cn(l,Ie.totalRow),children:[t.jsx("span",{className:o.cn(d,Ie.totalLabel),children:a.label}),t.jsx("span",{"data-testid":`${n}-total-value`,className:Ie.totalValue,children:a.value})]})}),p.hasContent(s)&&t.jsx("div",{"data-testid":`${n}-memo`,className:Ie.memo,children:s})]})};Eo.displayName="RecordTotals";const bs={base:"whitespace-nowrap text-[0.875rem]",secondary:"text-default-500",chipStack:"inline-flex flex-col items-start gap-[0.3125rem]"},Vp={text:"text-default-900",reference:"font-normal text-primary",amount:"font-semibold tabular-nums text-default-900"},Lo=({variant:e="text",tone:a,secondary:s,children:n,"data-testid":r="cell-text"})=>t.jsxs("span",{"data-testid":r,className:o.cn(bs.base,Vp[e]),style:aa(a),children:[n,p.hasContent(s)&&t.jsxs("span",{"data-testid":`${r}-secondary`,className:bs.secondary,children:[t.jsx("span",{"aria-hidden":"true",children:" · "}),s]})]});Lo.displayName="CellText";const Fo=({children:e,"data-testid":a="chip-stack"})=>t.jsx("span",{"data-testid":a,className:bs.chipStack,children:e});Fo.displayName="ChipStack";function _o({testId:e,title:a,description:s}){return t.jsx(o.Card,{shadow:"sm",className:"min-h-52 rounded-2xl shadow-none","data-testid":e,children:t.jsxs(o.CardBody,{className:"flex flex-col gap-2 p-4 text-sm",role:"alert",children:[t.jsx("span",{className:"font-semibold text-gray-900",children:a}),t.jsx("p",{className:"text-default-600 leading-snug",children:s})]})})}_o.displayName="SessionExpiredCard";exports.Button=p.Button;exports.Drawer=p.Drawer;exports.Modal=p.Modal;exports.Select=p.Select;exports.Skeleton=p.Skeleton;exports.Table=p.Table;exports.ActivityTimeline=Co;exports.AdminFieldLabel=qs;exports.AdminTable=Hi;exports.AdminTextField=cl;exports.AdminToolbar=Gi;exports.AmountList=No;exports.AppliedCodeCard=Nr;exports.CardList=bo;exports.CardStack=$o;exports.CashTenderForm=Of;exports.CatalogItemCard=Li;exports.CellText=Lo;exports.CheckTenderForm=kl;exports.ChipStack=Fo;exports.CommitmentDetails=Du;exports.ConfirmDialog=Zs;exports.ConfirmationModal=Rs;exports.ConfirmationPageTemplate=qc;exports.CustomerCard=eo;exports.DATE_PICKER_DAY_DEFAULTS=Rc;exports.DatePicker=Cs;exports.DensityProvider=hc;exports.DimensionChip=Ea;exports.DiscardGuard=Bl;exports.DonationAmounts=ai;exports.EmptyState=Is;exports.EntityList=bl;exports.EntityListSkeleton=gl;exports.EntityRow=hl;exports.ErrorState=Ms;exports.EventDetails=Id;exports.EventDetailsTemplate=Kc;exports.ExpandableTable=Wi;exports.ExpireCartTimer=si;exports.FeedbackState=ea;exports.FilterPopover=Bi;exports.FilterSelect=xo;exports.FilterSelectGroup=po;exports.Footer=ad;exports.HeroUIProvider=uc;exports.HorizontalSteps=Gr;exports.InlineConfirm=Il;exports.InstallmentFundAssignment=Cu;exports.InstallmentFundAssignmentSkeleton=$u;exports.InstallmentSchedule=Ku;exports.InstallmentScheduleSkeleton=am;exports.InstallmentTable=im;exports.ItemCard=Ei;exports.KeyValueChip=Ea;exports.KeyValueRows=Ao;exports.LineItemList=Yl;exports.LineItemRows=Do;exports.ListPanel=jl;exports.LoadMoreFooter=ho;exports.LoadingOverlay=_l;exports.LoadingState=Bs;exports.MembershipSelectCards=um;exports.MetaCard=Zx;exports.ModalPanelHeader=Pl;exports.ModalPanels=Nx;exports.ModalShell=Al;exports.ModalShellFooter=El;exports.ModalShellHeader=Dl;exports.Multiselect=sd;exports.Navbar=Wc;exports.NeedsFixDot=Hs;exports.NotesField=ao;exports.Notice=an;exports.OfferCard=ha;exports.OfferCardEmpty=ni;exports.OfferCardError=ri;exports.OfferCardList=ci;exports.OfferCardSkeleton=ii;exports.OtherTenderForm=Sl;exports.OutcomeView=fo;exports.PageHeader=Oi;exports.PaginationSummary=vl;exports.PaymentCashChangeBanner=Ks;exports.PaymentSubAmountInput=Ys;exports.PaymentSuccessView=Rl;exports.PaymentTotalBanner=Fl;exports.PickerRow=ml;exports.PillTabs=wo;exports.PinField=mo;exports.ProgramListItem=Fi;exports.RICH_TEXT_PRESETS=ei;exports.ReasonSelect=to;exports.RecordCard=So;exports.RecordHeader=yo;exports.RecordLayout=vo;exports.RecordTotals=Eo;exports.RedeemCodeInput=zc;exports.RefundMethodCards=oo;exports.RefundProgressList=uo;exports.RelatedRecordList=ko;exports.RevenueDistributionCard=ji;exports.RevenueDistributionEmpty=wi;exports.RevenueDistributionError=Ni;exports.RevenueDistributionSkeleton=Ci;exports.RichTextArea=ti;exports.RowActions=Us;exports.SectionPanel=Jl;exports.SessionExpiredCard=_o;exports.SessionTimeline=Pi;exports.SplitPaymentSummary=$l;exports.SplitTenderPanel=no;exports.StatTiles=jo;exports.StatusChip=zi;exports.StepPager=Qr;exports.StepProgress=tn;exports.Stepper=qr;exports.StepsReadiness=Zr;exports.SuccessState=Ri;exports.Summary=Gl;exports.TableSkeleton=Vi;exports.TenderMethods=so;exports.TicketSelection=Im;exports.TileSelect=Ll;exports.TimeField=ul;exports.ToastProvider=xc;exports.Toggle=Ii;exports.ToolbarButton=Ki;exports.UnderlineTabs=Yi;exports.VerticalSteps=Yr;exports.WizardShell=Kl;exports.adminFieldErrorClass=ll;exports.adminFieldHelpButtonClass=el;exports.adminFieldHelpContentClass=al;exports.adminFieldHelpIconClass=tl;exports.adminFieldHintClass=il;exports.adminFieldLabelClass=Ws;exports.adminFieldLabelNoAutoMarkClass=Ji;exports.adminFieldLabelRowClass=Xi;exports.adminFieldLabelSuffixClass=Zi;exports.adminFieldRequiredClass=Qi;exports.adminInputClass=nl;exports.adminInputReadOnlyClass=rl;exports.adminInputWrapperClass=sl;exports.adminRowClass=zs;exports.adminSurfaceCss=dc;exports.adminSurfaceTokens=Xt;exports.adminTableClass=Vs;exports.adminTableFooterClass=Ui;exports.adminTdClass=Os;exports.adminThClass=Ts;exports.assistantSurfaceTokens=ys;exports.calculateAllocationDifference=fu;exports.computeChange=is;exports.currencyFractionDigits=Rt;exports.firstNeedsFixKey=lf;exports.formatMoney=fe;exports.formatOfferCurrency=os;exports.formatRevenueAmount=cu;exports.formatRevenueCurrency=du;exports.generateAutomaticInstallments=$i;exports.generateDistributionId=_s;exports.getCurrencySymbol=uu;exports.offerCardVariants=oi;exports.offerListVariants=li;exports.pageRange=yl;exports.parseOfferCurrency=Md;exports.parseRevenueCurrency=mu;exports.parseTimeInput=xs;exports.pillTabId=rn;exports.pillTabPanelId=ln;exports.pillTabPanelProps=Pp;exports.posSurfaceTokens=le;exports.roundToCurrency=ks;exports.useControlSize=pc;exports.useDensity=ka;exports.useDiscardGuard=Sx;exports.useDiscardGuardActions=ux;exports.useModalPanel=fx;exports.useModalPanels=kx;exports.useReportUnsavedChanges=dx;Object.keys(o).forEach(e=>{e!=="default"&&!Object.prototype.hasOwnProperty.call(exports,e)&&Object.defineProperty(exports,e,{enumerable:!0,get:()=>o[e]})});
|
|
41
|
+
`,Dl=h.forwardRef(({children:e,relativeOverlayRoot:a=!0,className:s,style:n,"data-testid":r="modal-shell"},i)=>t.jsxs(t.Fragment,{children:[t.jsx("style",{children:Xf}),t.jsx("div",{ref:i,"data-testid":r,style:n,className:o.cn("flex flex-col gap-4 p-4 rounded-3xl bg-white shadow-xl","md:gap-5 md:p-6",a&&"relative","motion-safe:animate-[pp-modal-in_220ms_ease-out]","motion-safe:transition-[min-height] motion-safe:duration-[420ms] motion-safe:ease-in-out",s),children:e})]}));Dl.displayName="ModalShell";const El=({title:e,subtitle:a,leading:s,titleClassName:n,onClose:r,closeLabel:i="Close",actions:c,className:l,"data-testid":d="modal-shell-header"})=>t.jsxs("header",{className:o.cn("flex items-center justify-between gap-3",l),"data-testid":d,children:[t.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[s,t.jsxs("div",{className:"min-w-0",children:[t.jsx("h2",{className:o.cn("text-xl font-semibold",n),"data-testid":`${d}-title`,children:e}),a&&t.jsx("div",{className:"text-xs font-semibold text-default-500","data-testid":`${d}-subtitle`,children:a})]})]}),t.jsxs("div",{className:"flex items-center gap-2",children:[c,r&&t.jsx(p.Button,{isIconOnly:!0,variant:"light",radius:"full",size:"sm",onPress:r,"aria-label":i,"data-testid":`${d}-close`,children:t.jsx(p.Icon,{icon:"lucide:x",width:20,height:20,"aria-hidden":"true"})})]})]});El.displayName="ModalShellHeader";const Ll=({children:e,columns:a=2,className:s,"data-testid":n="modal-shell-footer"})=>t.jsx("footer",{className:o.cn("mt-2 gap-3",a===2?"flex flex-col md:grid md:grid-cols-2 [&>*]:w-full [&>*:first-child]:md:order-2 [&>*:nth-child(2)]:md:order-1":"grid grid-cols-1",s),"data-testid":n,children:e});Ll.displayName="ModalShellFooter";const Jf={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"},ex={1:"grid-cols-1",2:"grid-cols-2"},vt={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 ${p.stillTransitionClass} 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"},Ve={tile:`flex flex-col items-center justify-center gap-2 h-auto min-h-20 px-4 py-4 border bg-transparent transition-colors ${p.stillTransitionClass}`,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"},da=e=>typeof e=="string"?t.jsx(p.Icon,{icon:e,width:20,height:20,"aria-hidden":"true"}):e,tx=(e,a,s)=>{const n=`${e}-${a.key}`;return{badge:s&&a.badge!==void 0?`${n}-badge`:void 0,reason:`${n}-reason`,description:s&&a.description!==void 0?`${n}-description`:void 0}},ax=e=>t.jsx("span",{"aria-hidden":"true",className:vt.icon,children:typeof e=="string"?t.jsx(p.Icon,{icon:e,width:"100%",height:"100%","aria-hidden":"true"}):e}),ua=`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 ${p.stillTransitionClass}`,sx="pointer-events-none absolute -left-[9999px] top-0 flex flex-row gap-1 p-1 opacity-0",ir="flex-none",nx=typeof window<"u"?h.useLayoutEffect:h.useEffect,lr=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",Fl=({options:e,selectedKey:a,onSelect:s,heading:n,ariaLabel:r="Select an option",variant:i="tiles",maxVisible:c,moreLabel:l="More",columnsDesktop:d=3,columnsMobile:u=2,size:f="md",className:m,"data-testid":b="tile-select"})=>{const x=f==="sm",g=e.find(v=>v.key===a),j=e.some(v=>v.badge!==void 0||v.isLocked===!0),y=!x&&j;return i==="compact"?t.jsx(rx,{options:e,selectedKey:a,onSelect:s,ariaLabel:r,moreLabel:l,dataTestId:b,...n!==void 0?{heading:n}:{},...c!==void 0?{maxVisible:c}:{},...m!==void 0?{className:m}:{}}):t.jsxs("div",{className:o.cn("flex flex-col gap-3",m),"data-testid":b,children:[n&&t.jsx("h3",{className:"text-sm font-medium text-default-700",id:`${b}-heading`,children:n}),t.jsx("div",{className:"md:hidden",children:t.jsx(p.Select,{"aria-label":n?void 0:r,"aria-labelledby":n?`${b}-heading`:void 0,selectedKeys:a?[a]:[],onSelectionChange:v=>{const S=Array.from(v)[0];typeof S=="string"&&s(S)},placeholder:r,variant:"bordered",radius:"lg","data-testid":`${b}-mobile-select`,startContent:g?t.jsx("span",{"aria-hidden":"true",className:"shrink-0",children:da(g.icon)}):void 0,popoverProps:{placement:"bottom-start",classNames:{content:"bg-white border border-default-200 shadow-lg rounded-xl p-1"}},listboxProps:{classNames:{list:"max-h-[var(--popover-available-height,40vh)] overflow-y-auto"},itemClasses:{base:["rounded-lg","px-3 py-2","text-default-800","data-[hover=true]:bg-default-100","data-[selectable=true]:focus:bg-default-100","data-[selected=true]:bg-primary-50","data-[selected=true]:text-primary","data-[selected=true]:font-medium"]}},children:e.map(v=>t.jsx(o.SelectItem,{isDisabled:v.isDisabled||v.isLocked,...j&&v.description!==void 0?{description:v.description}:{},endContent:v.badge!==void 0?t.jsx("span",{className:Ve.badge,children:v.badge}):void 0,startContent:t.jsx("span",{"aria-hidden":"true",className:"shrink-0",children:da(v.icon)}),"data-testid":v["data-testid"]??`${b}-${v.key}-mobile`,children:v.label},v.key))})}),t.jsx("div",{role:"group","aria-labelledby":n?`${b}-heading`:void 0,"aria-label":n?void 0:r,className:o.cn("hidden md:grid",x?vt.grid:"gap-3",ex[u],Jf[d]),"data-size":f,children:e.map(v=>{const C=a===v.key,S=v.isLocked===!0&&v.isDisabled!==!0,k=v.lockedReason??v.badge,$=tx(b,v,y),_=[$.badge,S&&k!==void 0&&(x||k!==v.badge)?$.reason:void 0,$.description].filter(Boolean).join(" ");return t.jsxs(p.Button,{variant:"bordered",radius:"lg","aria-pressed":C,"aria-label":v.label,"aria-disabled":S||void 0,"aria-describedby":_||void 0,isDisabled:v.isDisabled,onPress:()=>{S||s(v.key)},"data-testid":v["data-testid"]??`${b}-${v.key}`,"data-locked":S||void 0,className:x?o.cn(vt.tile,S?vt.locked:C?vt.active:vt.idle):o.cn(Ve.tile,y&&Ve.detailed,S?Ve.locked:C?Ve.active:Ve.idle),"data-size":f,children:[x?t.jsxs(t.Fragment,{children:[ax(v.icon),t.jsx("span",{className:vt.label,children:v.label})]}):y?t.jsxs(t.Fragment,{children:[t.jsxs("span",{className:Ve.header,children:[t.jsx("span",{"aria-hidden":"true",className:S?Ve.lockedIcon:void 0,children:da(v.icon)}),v.badge!==void 0?t.jsx("span",{id:$.badge,className:Ve.badge,children:v.badge}):null]}),t.jsx("span",{className:Ve.label,children:v.label}),v.description!==void 0?t.jsx("span",{id:$.description,className:o.cn(Ve.description,S&&Ve.lockedDescription),children:v.description}):null]}):t.jsxs(t.Fragment,{children:[t.jsx("span",{"aria-hidden":"true",className:S?Ve.lockedIcon:void 0,children:da(v.icon)}),t.jsx("span",{className:Ve.label,children:v.label})]}),S&&k!==void 0&&(x||k!==v.badge)?t.jsx("span",{id:$.reason,className:"sr-only",children:k}):null]},v.key)})})]})};Fl.displayName="TileSelect";function rx({options:e,selectedKey:a,onSelect:s,heading:n,ariaLabel:r,maxVisible:i,moreLabel:c,className:l,dataTestId:d}){const u=h.useRef(null),f=h.useRef(null),m=h.useMemo(()=>e.map((F,A)=>({option:F,index:A})).filter(({option:F})=>F.alwaysInMenu!==!0).map(({index:F})=>F),[e]),b=m.length<e.length,x=h.useCallback(F=>{const A=m.map(E=>({index:E,priority:e[E]?.priority??0})).sort((E,D)=>E.priority-D.priority||D.index-E.index),M=new Set(A.slice(0,m.length-F).map(E=>E.index));return m.filter(E=>!M.has(E))},[e,m]),[g,j]=h.useState(e.length);nx(()=>{const F=u.current,A=f.current;if(!F||!A)return;const M=()=>{const D=Array.from(A.children),I=D.slice(0,e.length).map(W=>W.getBoundingClientRect().width),B=D[e.length]?.getBoundingClientRect().width??0,z=window.getComputedStyle(F),q=Number.parseFloat(z.columnGap)||0,P=F.clientWidth-(Number.parseFloat(z.paddingLeft)||0)-(Number.parseFloat(z.paddingRight)||0);if(P<=0||I.some(W=>W===0)){j(m.length);return}const ee=W=>{const Y=b||W<m.length,K=W+(Y?1:0);return x(W).reduce((te,Q)=>te+(I[Q]??0),0)+(Y?B:0)+q*(K-1)<=P};for(let W=m.length;W>=1;W-=1)if(ee(W)){j(W);return}j(1)};M();const E=new ResizeObserver(M);return E.observe(F),()=>E.disconnect()},[e,c,x,m,b]);const y=Math.max(1,Math.min(g,i??m.length,m.length)),C=!b&&y===m.length-1&&g===m.length?m.length:y,S=b||C<m.length,k=new Set(x(C)),$=e.filter((F,A)=>k.has(A)),_=S?e.filter((F,A)=>!k.has(A)):[],w=_.find(F=>F.key===a);return t.jsxs("div",{className:o.cn("relative flex flex-col gap-3",l),"data-testid":d,children:[n&&t.jsx("h3",{className:"text-sm font-medium text-default-700",id:`${d}-heading`,children:n}),t.jsxs("div",{ref:u,role:"group","aria-labelledby":n?`${d}-heading`:void 0,"aria-label":n?void 0:r,className:"flex flex-row gap-1 rounded-full bg-default-100 p-1",children:[$.map(F=>t.jsx(p.Button,{variant:"light",radius:"full","aria-pressed":a===F.key,isDisabled:F.isDisabled||F.isLocked,onPress:()=>s(F.key),"data-testid":F["data-testid"]??`${d}-${F.key}`,className:o.cn(ua,lr(a===F.key)),children:F.label},F.key)),_.length>0&&t.jsxs(o.Dropdown,{placement:"bottom-end",radius:"lg",children:[t.jsx(o.DropdownTrigger,{children:t.jsxs(p.Button,{variant:"light",radius:"full","aria-pressed":w!==void 0,"data-testid":`${d}-more`,className:o.cn(ua,"gap-1",w!==void 0?"min-w-0":"min-w-fit",lr(w!==void 0)),children:[t.jsx("span",{className:"min-w-0 truncate",children:w?.label??c}),t.jsx(p.Icon,{icon:"lucide:chevron-down",width:14,height:14,"aria-hidden":"true"})]})}),t.jsx(o.DropdownMenu,{"aria-label":c,className:"w-64 p-2",selectionMode:"single",selectedKeys:w?[w.key]:[],disabledKeys:_.filter(F=>F.isDisabled||F.isLocked).map(F=>F.key),onAction:F=>s(String(F)),children:_.map(F=>t.jsx(o.DropdownItem,{textValue:F.label,...F.description!==void 0?{description:F.description}:{},"data-testid":F["data-testid"]??`${d}-${F.key}`,children:F.label},F.key))})]})]}),t.jsxs("div",{ref:f,"aria-hidden":"true",className:sx,children:[e.map(F=>t.jsx(p.Button,{variant:"light",radius:"full",tabIndex:-1,className:o.cn(ua,ir),children:F.label},F.key)),t.jsxs(p.Button,{variant:"light",radius:"full",tabIndex:-1,className:o.cn(ua,ir,"gap-1"),children:[c,t.jsx(p.Icon,{icon:"lucide:chevron-down",width:14,height:14})]})]})]})}const ix={subtle:{wrapper:"bg-default-100",amount:"text-default-900"},success:{wrapper:"bg-success-50 text-success-700",amount:"text-success-700"}},_l=({total:e,label:a,locale:s="en-US",variant:n="subtle",className:r,"data-testid":i="payment-total-banner"})=>{const c=ix[n];return t.jsxs("div",{"data-testid":i,className:o.cn("rounded-2xl px-6 py-5 text-center",c.wrapper,r),children:[t.jsx("div",{className:"text-sm text-default-600",children:a}),t.jsx("div",{className:o.cn("mt-1 text-4xl font-bold tracking-tight",c.amount),"data-testid":`${i}-amount`,children:fe(e.value,s,e.currency)})]})};_l.displayName="PaymentTotalBanner";const lx={white:"bg-white/70 backdrop-blur-sm",transparent:"bg-transparent"},Rl=({title:e,subtitle:a,backdrop:s="white",exiting:n=!1,className:r,"data-testid":i="loading-overlay"})=>t.jsxs("div",{role:"status","aria-live":n?"off":"polite","aria-hidden":n||void 0,"data-testid":i,"data-state":n?"exiting":"visible",className:o.cn("absolute inset-0 z-10 flex flex-col items-center justify-center gap-4 rounded-3xl",lx[s],n?"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}),a&&t.jsx("div",{className:"mt-1 text-sm text-default-600",children:a})]})]});Rl.displayName="LoadingOverlay";const Ys=({cashChange:e,label:a="Cash to return",secondaryLine:s,locale:n="en-US",onDismiss:r,dismissAriaLabel:i="Dismiss",align:c="left",className:l,"data-testid":d="payment-cash-change-banner"})=>{if(!e||e.value<=0)return null;const u=c==="center";return t.jsxs("div",{role:"status","aria-live":"polite","data-testid":d,className:o.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,{icon:"lucide:info",width:28,height:28,className:"shrink-0 text-info-700","aria-hidden":"true"}),t.jsxs("div",{className:o.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:a}),t.jsx("span",{className:"text-2xl font-bold text-info-700","data-testid":`${d}-amount`,children:fe(e.value,n,e.currency)}),s&&t.jsx("span",{className:"mt-0.5 text-xs text-info-700/80",children:s})]}),r&&t.jsx(p.Button,{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,{icon:"lucide:x",width:18,height:18,"aria-hidden":"true"})})]})};Ys.displayName="PaymentCashChangeBanner";const Il=({title:e,subtitle:a,emailLine:s,confirmationEmail:n,cashChange:r,cashChangeLabel:i="Cash to return",locale:c="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:o.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,{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:a}),s&&n&&t.jsxs("p",{className:"text-default-700",children:[s,t.jsx("br",{}),t.jsx("strong",{className:"font-semibold",children:n})]})]}),m&&r&&t.jsx(Ys,{cashChange:r,label:i,locale:c,align:"center",className:"max-w-[400px]","data-testid":`${f}-cash-change`}),d&&t.jsx(p.Button,{color:"default",variant:"bordered",radius:"full",size:"lg",onPress:d,"data-testid":`${f}-close`,className:"mt-4 w-full",children:l})]})};Il.displayName="PaymentSuccessView";const Zs=({heading:e,amountLabel:a,value:s,defaultValue:n,onChange:r,onBlur:i,placeholder:c,isDisabled:l,isInvalid:d,errorMessage:u,autoFocus:f,maxAmount:m,hideHeading:b=!1,className:x,"data-testid":g="payment-sub-amount-input"})=>{const j=`${g}-input`,y=s!==void 0,[v,C]=h.useState(n??""),S=y?s:v,{isUntouched:k,markEdited:$}=Cl(S),_=h.useCallback(A=>{if(m!==void 0){const M=Number.parseFloat(A.replace(",","."));if(Number.isFinite(M)&&M>m)return}$(A),y||C(A),r?.(A)},[m,r,$,y]),w=kl(k,_),F=h.useCallback(A=>{const M=A.currentTarget;requestAnimationFrame(()=>{M.isConnected&&M.select()})},[]);return t.jsxs("div",{className:o.cn("flex flex-col gap-3 border-t border-default-100 pt-5",x),"data-testid":g,children:[t.jsx("h3",{className:o.cn("text-lg font-semibold",b&&"sr-only"),"data-testid":`${g}-heading`,children:e}),t.jsx(o.Input,{ref:w,id:j,label:a,labelPlacement:"outside",classNames:b?{label:"sr-only"}:void 0,type:"text",inputMode:"decimal",pattern:"[0-9]*[.,]?[0-9]*",value:S,onChange:A=>_(A.target.value),onFocus:F,onBlur:i,placeholder:c,isDisabled:l,isInvalid:d,errorMessage:d?u:void 0,variant:"bordered",radius:"lg","aria-invalid":d||void 0,autoFocus:f,"data-testid":`${g}-field`})]})};Zs.displayName="PaymentSubAmountInput";const ox={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"}},cx=e=>typeof e=="string"?t.jsx(p.Icon,{icon:e,className:"size-5","aria-hidden":"true"}):e,Qs=({isOpen:e,title:a,confirmLabel:s,onConfirm:n,onOpenChange:r,children:i,description:c,cancelLabel:l="Cancel",variant:d="danger",isPending:u=!1,isDismissable:f,isKeyboardDismissDisabled:m=!1,hideIcon:b=!1,icon:x,"data-testid":g="confirm-dialog"})=>{const j=i??c??null,y=ox[d],v=b?null:cx(x??y.icon);return t.jsx(p.Modal,{isOpen:e,onOpenChange:C=>r?.(C),placement:"center",size:"md",isDismissable:(f??!0)&&!u,isKeyboardDismissDisabled:m||u,hideCloseButton:u,className:"gap-4 p-6",classNames:{base:"rounded-3xl"},"data-testid":g,children:t.jsxs(o.ModalContent,{role:"alertdialog",children:[t.jsxs(o.ModalHeader,{className:"flex flex-col items-center gap-3 p-0 text-center",children:[v?t.jsx("div",{"aria-hidden":"true","data-testid":`${g}-icon`,className:o.cn("flex size-10 items-center justify-center rounded-full",y.tile),children:v}):null,t.jsx("span",{"data-testid":`${g}-title`,className:"text-lg font-semibold text-zinc-950",children:a})]}),j!==null?t.jsx(o.ModalBody,{"data-testid":`${g}-body`,className:"gap-0 p-0",children:typeof j=="string"?t.jsx("p",{className:"mx-auto max-w-sm text-center text-sm text-gray-600",children:j}):j}):null,t.jsxs(o.ModalFooter,{className:"flex flex-col-reverse gap-2 p-0 sm:flex-row sm:gap-3",children:[t.jsx(p.Button,{variant:"bordered",color:"default",radius:"full",onPress:()=>r?.(!1),isDisabled:u,"data-testid":`${g}-dismiss`,className:"w-full sm:flex-1",children:l}),t.jsx(p.Button,{color:y.confirmColor,variant:"solid",radius:"full",onPress:n,isLoading:u,"data-testid":`${g}-confirm`,className:"w-full sm:flex-1",children:s})]})]})})};Qs.displayName="ConfirmDialog";const bt={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"},dx={danger:"bg-danger-50",warning:"bg-warning-50"},Ml=({message:e,description:a,confirmLabel:s,cancelLabel:n="Cancel",onConfirm:r,onCancel:i,variant:c="danger",isPending:l=!1,initialFocus:d="cancel",containEscape:u=!0,size:f="sm",as:m="div",className:b,"data-testid":x="inline-confirm"})=>{const g=h.useId(),j=h.useId(),y=h.useRef(null),v=h.useRef(null),C=h.useRef(null),S=a!=null,k=h.useRef({isPending:l,containEscape:u,onCancel:i});k.current={isPending:l,containEscape:u,onCancel:i},h.useEffect(()=>{(d==="confirm"?v:C).current?.focus()},[]),h.useEffect(()=>{const w=y.current;if(w===null)return;const F=A=>{A.key==="Escape"&&(k.current.containEscape&&A.stopPropagation(),!k.current.isPending&&k.current.onCancel())};return w.addEventListener("keydown",F),()=>w.removeEventListener("keydown",F)},[]);const $=h.useRef(!1);h.useLayoutEffect(()=>{const w=y.current;if(w===null)return;const F=document.activeElement;if(l){const A=F===null||F===document.body||!w.contains(F),M=F instanceof HTMLButtonElement&&F.disabled;$.current&&(A||M)&&w.focus({preventScroll:!0});return}F===w&&(d==="confirm"?v:C).current?.focus()},[l,d]);const _=t.jsx(o.Card,{ref:y,role:"alertdialog","aria-modal":"false","aria-labelledby":g,"aria-describedby":S?j:void 0,"aria-busy":l||void 0,tabIndex:-1,shadow:"none",radius:"lg",onFocus:()=>{$.current=!0},onBlur:w=>{const F=w.relatedTarget;$.current=F instanceof Node&&w.currentTarget.contains(F)},className:o.cn(bt.box,dx[c],m==="div"&&b),"data-testid":x,children:t.jsxs(o.CardBody,{className:bt.body,children:[t.jsxs("div",{className:bt.text,children:[t.jsx("p",{id:g,className:bt.message,children:e}),S?t.jsx("p",{id:j,className:bt.description,children:a}):null]}),t.jsxs("div",{className:bt.actions,children:[t.jsx(p.Button,{ref:v,size:f,color:c,variant:"solid",onPress:r,isLoading:l,"data-testid":`${x}-confirm`,children:s}),t.jsx(p.Button,{ref:C,size:f,color:"default",variant:"light",onPress:i,isDisabled:l,"data-testid":`${x}-cancel`,children:n})]})]})});return m==="li"?t.jsx("li",{className:o.cn(bt.item,b),children:_}):_};Ml.displayName="InlineConfirm";const ux={guardScope:(e,a)=>a(),bypass:e=>e(),report:()=>{},unreport:()=>{}},_a=h.createContext(ux),Xs=h.createContext(null);function mx(e){const{report:a,unreport:s}=h.useContext(_a),n=h.useContext(Xs),r=h.useId();h.useEffect(()=>{a(r,{scope:n,isDirty:e})},[a,r,n,e]),h.useEffect(()=>()=>s(r),[s,r])}function fx(){const{guardScope:e,bypass:a}=h.useContext(_a);return h.useMemo(()=>({guard:s=>e(null,s),bypass:a}),[e,a])}function Bl(){const{guardScope:e}=h.useContext(_a),a=h.useContext(Xs);return h.useCallback(s=>e(a,s),[e,a])}const xx=({scope:e,children:a})=>t.jsx(Xs.Provider,{value:e,children:a}),Pl=({guard:e,children:a,title:s="Discard changes?",description:n="What you entered will be lost.",confirmLabel:r="Discard",keepEditingLabel:i="Keep editing","data-testid":c="discard-guard"})=>{const{pending:l,confirmKey:d,confirm:u,keepEditing:f,report:m,unreport:b,guardScope:x}=e.internals,g=h.useMemo(()=>({guardScope:x,bypass:e.bypass,report:m,unreport:b}),[x,e.bypass,m,b]);return t.jsxs(_a.Provider,{value:g,children:[a,t.jsx(Qs,{isOpen:l!==null,onOpenChange:j=>{j||f()},onConfirm:u,variant:"warning",title:s,description:n,confirmLabel:r,cancelLabel:i,"data-testid":c},d)]})};Pl.displayName="DiscardGuard";const Js=h.createContext(null);function px(){const e=h.useContext(Js),a=Bl(),s=e?.back,n=h.useCallback(()=>{s&&a(s)},[a,s]);return{isActive:e?.isActive??!0,canGoBack:e?.canGoBack??!1,back:n}}const hx=["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 bx(e){for(const a of e.querySelectorAll(hx))if(!a.closest('[hidden], [inert], [aria-hidden="true"]'))return a;return null}function or(e,a){return!e||!e.isConnected||!a.contains(e)||e.matches(":disabled")?!1:!e.closest("[hidden], [inert]")}const gx=new Set(["menu","listbox","dialog","grid","tree"]);function yx(e){for(const a of e.querySelectorAll('[aria-expanded="true"][aria-controls]')){const s=a.ownerDocument.getElementById(a.getAttribute("aria-controls")??"");if(!s?.isConnected)continue;if((a.getAttribute("aria-haspopup")??"false")!=="false"||gx.has(s.getAttribute("role")??""))return s}return null}const cr="react-aria-focus-scope-restore";class vx{panels=new Map;active=null;setContainer(a,s){s?this.panels.set(a,{entry:null,last:null,...this.panels.get(a),container:s}):this.panels.delete(a)}setEntry(a,s){const n=this.panels.get(a);n?n.entry=s:s&&this.panels.set(a,{container:null,entry:s,last:null})}remember(a,s){const n=this.panels.get(a);n&&(n.last=s)}setActive(a,s){this.active={key:a,isReturn:s}}focusActive(){if(!this.active)return;const a=this.panels.get(this.active.key),s=a?.container;if(!a||!s||s.contains(document.activeElement))return;((this.active.isReturn&&or(a.last,s)?a.last:null)??(or(a.entry,s)?a.entry:null)??bx(s))?.focus()}recoverFocus(){const a=this.active?this.panels.get(this.active.key)?.container:null,s=a?yx(a):null;s?.focus(),s?.contains(document.activeElement)||this.focusActive()}}const jx="flex flex-initial items-center gap-2 py-4 pl-4 pr-12 text-large font-semibold",wx="min-w-0 flex-1 truncate text-large font-semibold",Nx="flex shrink-0 items-center gap-2",Cx="size-5";function kx({panels:e,children:a}){const[s]=h.useState(()=>new vx),{entries:n,back:r}=e,i=n[n.length-1].key,c=h.useRef(null);return h.useLayoutEffect(()=>{const l=c.current;c.current={activeKey:i,keys:new Set(n.map(d=>d.key))},!(!l||l.activeKey===i)&&(s.setActive(i,l.keys.has(i)),s.focusActive())},[i,n,s]),t.jsx(t.Fragment,{children:n.map((l,d)=>t.jsx(Sx,{entryKey:l.key,isActive:d===n.length-1,canGoBack:d>0,back:r,memory:s,children:a(l.panel,l)},l.key))})}const Sx=({entryKey:e,isActive:a,canGoBack:s,back:n,memory:r,children:i})=>{const c=h.useRef(null),l=h.useCallback(u=>r.setEntry(e,u),[r,e]);h.useLayoutEffect(()=>{const u=c.current;if(r.setContainer(e,u),!u)return;const f=m=>{u.hidden&&(m.preventDefault(),r.recoverFocus())};return u.addEventListener(cr,f),()=>{u.removeEventListener(cr,f),r.setContainer(e,null)}},[r,e]);const d=h.useMemo(()=>({isActive:a,canGoBack:s,back:n,setEntryFocus:l}),[a,s,n,l]);return t.jsx(Js.Provider,{value:d,children:t.jsx(xx,{scope:e,children:t.jsx("div",{ref:c,hidden:!a,style:{display:a?"contents":"none"},onFocus:u=>{u.currentTarget.contains(u.target)&&r.remember(e,u.target)},children:i})})})},Tl=({title:e,onBack:a,backLabel:s="Back",isBackDisabled:n,size:r="md",actions:i,className:c,"data-testid":l="modal-panel-header"})=>{const d=h.useContext(Js),u=Bl(),f=h.useId(),m=a??(d?.canGoBack?d.back:void 0);return t.jsxs("header",{className:o.cn(jx,c),"data-testid":l,children:[m?t.jsx(p.Button,{ref:d?.setEntryFocus,isIconOnly:!0,variant:"light",color:"default",size:r,"aria-label":s,"aria-describedby":f,isDisabled:n,onPress:()=>u(m),"data-testid":`${l}-back`,children:t.jsx(p.Icon,{icon:"solar:arrow-left-outline",className:Cx,"aria-hidden":"true"})}):null,t.jsx("h2",{id:f,className:wx,"data-testid":`${l}-title`,children:e}),i?t.jsx("div",{className:Nx,children:i}):null]})};Tl.displayName="ModalPanelHeader";function $x(e){const a=h.useRef(1),[s]=h.useState(e),[n,r]=h.useState(()=>[{key:"panel-0",panel:e}]),i=h.useCallback(f=>{const m=`panel-${a.current}`;return a.current+=1,{key:m,panel:f}},[]),c=h.useCallback(f=>{const m=i(f);r(b=>[...b,m])},[i]),l=h.useCallback(()=>{r(f=>f.length>1?f.slice(0,-1):f)},[]),d=h.useCallback(f=>{const m=i(f);r(b=>[...b.slice(0,-1),m])},[i]),u=h.useCallback(f=>{r([i(f===void 0?s:f)])},[i,s]);return h.useMemo(()=>({current:n[n.length-1].panel,entries:n,canGoBack:n.length>1,push:c,back:l,replace:d,reset:u}),[n,c,l,d,u])}function Ax(){const e=h.useRef(new Map),[a,s]=h.useState(0),[n,r]=h.useState(null),[i,c]=h.useState(0),l=h.useCallback(()=>{let y=0;for(const v of e.current.values())v.isDirty&&(y+=1);s(y)},[]),d=h.useCallback((y,v)=>{e.current.set(y,v),l()},[l]),u=h.useCallback(y=>{e.current.delete(y),l()},[l]),f=h.useCallback((y,v)=>{let C=!1;for(const S of e.current.values())S.isDirty&&(y===null||S.scope===y)&&(C=!0);C?r({leave:v}):v()},[]),m=h.useCallback(y=>f(null,y),[f]),b=h.useCallback(y=>{for(const v of e.current.values())v.isDirty=!1;l(),r(null),y()},[l]),x=h.useCallback(y=>v=>{v?y(!0):m(()=>y(!1))},[m]),g=h.useCallback(()=>{const y=n?.leave;r(null),c(v=>v+1),y?.()},[n]),j=h.useCallback(()=>r(null),[]);return h.useMemo(()=>({isDirty:a>0,guard:m,bypass:b,guardOpenChange:x,internals:{pending:n,confirmKey:i,confirm:g,keepEditing:j,report:d,unreport:u,guardScope:f}}),[a,m,b,x,n,i,g,j,d,u,f])}const Dx=60,Ex=(e,a,s=Dx)=>a?e>s:e<-s,Ol=(e,a)=>Math.max(0,Math.min(e,a)),Lx=160,Fx=(e,a,s=Lx)=>Math.min(e,Math.max(0,a-s)),_x=(e,a,s)=>Ol(e-a,s),Rx=(e,a,s)=>e!==null?Ol(e,s):a?s:0,Ix=e=>e?"":"transition-[height] duration-300 ease-out",Mx=e=>({onDrag:(a,s)=>{const n=e.open?e.fullHeight:0;e.setDragHeight(_x(n,s?.offset?.y??0,e.fullHeight))},onDragEnd:(a,s)=>{Ex(s?.offset?.y??0,e.open)&&e.onToggleOpen?.(),e.setDragHeight(null)}}),Nt=(e,a)=>fe(e.value,a,e.currency),dr=`opacity-60 transition-opacity ${p.stillTransitionClass}`,en=({item:e,locale:a,onRemove:s,removeAriaLabel:n,showRemoveButton:r=!0,compact:i=!1})=>{const c=!!e.children&&e.children.length>0,l=!!s&&r&&e.removable!==!1,d=e.tone?"text-default-600":"text-default-500";return t.jsxs("div",{"data-testid":`summary-item-${e.id}`,className:o.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:Ze[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":o.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:o.cn("mr-2 whitespace-nowrap text-[0.8125rem] text-default-600 line-through",e.pending&&dr),children:e.originalAmount}),e.amount&&t.jsx("span",{"data-testid":`summary-item-amount-${e.id}`,"data-pending":e.pending?"true":void 0,className:o.cn(i?"whitespace-nowrap text-sm font-semibold text-foreground":"whitespace-nowrap text-base text-foreground",e.pending&&dr),children:Nt(e.amount,a)}),l&&t.jsx(p.Button,{isIconOnly:!0,size:"sm",variant:"light",radius:"full",className:o.cn("ml-1 size-8 min-w-8 p-2 text-danger",i&&"-my-1.5"),"aria-label":n,"data-testid":`summary-remove-${e.id}`,onPress:()=>s(e.id),children:t.jsx(p.Icon,{icon:"lucide:trash-2",width:16,height:16,className:"text-danger"})})]})]}),p.hasContent(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:o.cn("flex items-center gap-2 text-sm",d),children:[t.jsx(p.Icon,{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:o.cn("flex items-center gap-2 text-sm",d),children:[t.jsx(p.Icon,{icon:"lucide:calendar",width:16,height:16,className:"shrink-0"}),t.jsx("span",{children:e.dateRange.from}),t.jsx(p.Icon,{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:o.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:o.cn("whitespace-nowrap",u.valueTone==="primary"&&o.cn("font-medium",e.tone?"text-primary-600":"text-primary")),children:u.value}),u.tooltip!=null&&t.jsx(o.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,{icon:"lucide:info",width:16,height:16,className:o.cn(u.valueTone==="primary"?"text-primary":"text-default-400")})})})]})]},u.key??f)),c&&t.jsx("div",{"data-testid":`summary-children-${e.id}`,className:"flex flex-col gap-2 pl-6",children:e.children.map(u=>t.jsx(en,{item:u,locale:a,onRemove:s,removeAriaLabel:n,showRemoveButton:r,compact:i},u.id))})]})};en.displayName="SummaryItemRow";const zl=({fee:e,locale:a,className:s})=>t.jsxs("div",{"data-testid":"summary-service-fee",className:o.cn("flex items-center justify-between gap-2",s),children:[t.jsxs("button",{type:"button",role:"switch","aria-checked":!!e.isSelected,"aria-label":typeof e.label=="string"?e.label:"Pay Service fee","data-testid":"summary-service-fee-toggle",onClick:e.onToggle,className:"flex min-w-0 items-center gap-2 text-left",children:[t.jsx("span",{"aria-hidden":"true",className:o.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:Nt(e.amount,a)})]});zl.displayName="SummaryServiceFeeRow";const tn=({row:e,locale:a,emphasized:s,onRemove:n,removeAriaLabel:r,showRemoveButton:i=!0,compact:c=!1})=>{const l=!!n&&i&&!!e.id,d=t.jsx("span",{"data-testid":`summary-row-label-${e.key}`,className:c?void 0:o.cn(s?"text-xl font-semibold leading-7":"text-base"),children:e.label});return t.jsxs("div",{"data-testid":`summary-row-${e.key}`,className:c?"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(p.Button,{isIconOnly:!0,size:"sm",variant:"light",radius:"full",className:o.cn("ml-1 size-8 min-w-8 shrink-0 p-2 text-danger",c&&"-my-1.5"),"aria-label":r,"data-testid":`summary-remove-row-${e.id}`,onPress:()=>n(e.id),children:t.jsx(p.Icon,{icon:"lucide:trash-2",width:16,height:16,className:"text-danger"})})]}):d,t.jsx("span",{"data-testid":`summary-row-amount-${e.key}`,className:o.cn("whitespace-nowrap",!c&&"text-base",e.amountTone==="success"&&"text-success"),children:Nt(e.amount,a)})]})};tn.displayName="SummaryTotalsLineRow";const Vl=({pricesInLabel:e,currency:a,items:s,serviceFee:n,rows:r,locale:i,onRemoveItem:c,removeAriaLabel:l,onRemoveTotalRow:d,removeTotalRowAriaLabel:u,showRemoveButton:f,emptyState:m,compact:b=!1,classNames:x})=>{const g=(s?.length??0)>0;return t.jsxs(t.Fragment,{children:[!b&&t.jsxs("div",{"data-testid":"summary-prices",className:o.cn("flex items-center justify-between text-xs text-default-500",x.prices),children:[t.jsx("span",{children:e}),a!=null&&t.jsx("span",{children:a})]}),g?t.jsx("div",{className:o.cn(b?"flex flex-col divide-y divide-default-100":"flex flex-col gap-4",x.items),children:s.map(j=>t.jsx(en,{item:j,locale:i,onRemove:c,removeAriaLabel:l,showRemoveButton:f,compact:b},j.id))}):t.jsx("div",{"data-testid":"summary-empty",children:m}),n&&t.jsxs(t.Fragment,{children:[t.jsx(o.Divider,{className:"bg-default-100"}),t.jsx(zl,{fee:n,locale:i,className:x.serviceFee})]}),r&&r.length>0&&t.jsx("div",{className:o.cn(b?o.cn("flex flex-col gap-1 pt-3",!n&&"border-t border-default-100"):"flex flex-col gap-4",x.totalsRows),children:r.map((j,y)=>t.jsx(tn,{row:j,locale:i,emphasized:!b&&y===0,onRemove:d,removeAriaLabel:u,showRemoveButton:f,compact:b},j.key))})]})};Vl.displayName="SummaryBody";const Ul=({total:e,locale:a,compact:s=!1,className:n})=>{const r=s?"text-lg":"text-xl";return t.jsxs("div",{"data-testid":"summary-total",className:o.cn(`flex items-center justify-between ${r} font-semibold leading-7 text-foreground`,n),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:Nt(e.amount,a)})]})};Ul.displayName="SummaryGrandTotalRow";const Hl=({secondaryTotal:e,locale:a,className:s})=>t.jsxs("div",{"data-testid":"summary-secondary-total",className:o.cn("flex items-center justify-between text-lg font-semibold leading-7 text-primary",s),children:[t.jsx("span",{children:e.label}),t.jsx("span",{"data-testid":"summary-secondary-total-amount",className:"whitespace-nowrap text-lg font-semibold leading-7",children:Nt(e.amount,a)})]});Hl.displayName="SummarySecondaryTotalRow";const Ca=({action:e,disabledByLoading:a,className:s,testId:n="summary-cta"})=>t.jsx(p.Button,{color:"primary",radius:"full",className:o.cn("px-[18px] py-[14px] font-medium",s),"data-testid":n,isLoading:e.isLoading,isDisabled:e.isDisabled||a,onPress:e.onPress,endContent:t.jsx(p.Icon,{icon:"lucide:arrow-right",width:16,height:16}),children:e.label});Ca.displayName="SummaryPrimaryCta";const Wl=({title:e,total:a,secondaryTotal:s,locale:n,open:r,progress:i,dragging:c,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:o.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:o.cn("col-start-1 row-start-1 flex items-center justify-between",!c&&"transition-opacity duration-300"),children:[t.jsx("span",{"data-testid":"summary-title",className:o.cn("text-xl font-semibold leading-7 text-foreground",u.title),children:e}),t.jsx("span",{"data-testid":"summary-close","aria-hidden":"true",className:o.cn("shrink-0 text-foreground",u.closeButton),children:t.jsx(p.Icon,{icon:"lucide:x",width:20,height:20})})]}),t.jsxs("span",{"aria-hidden":r,style:{opacity:1-i},className:o.cn("col-start-1 row-start-1 flex flex-col gap-2",!c&&"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:a.label??"Total"}),t.jsx("span",{className:"whitespace-nowrap",children:Nt(a.amount,n)})]}),s&&t.jsxs("span",{className:"flex items-center justify-between text-lg font-semibold leading-7 text-primary",children:[t.jsx("span",{children:s.label}),t.jsx("span",{className:"whitespace-nowrap",children:Nt(s.amount,n)})]})]})]})});Wl.displayName="SummaryCollapseHeader";const ql=({cart:e,ariaLabel:a,onPress:s,className:n})=>t.jsxs("button",{type:"button","data-testid":"summary-cart","aria-label":a,onClick:s,className:o.cn("relative flex size-[52px] shrink-0 items-center justify-center rounded-full border border-default-200 bg-content1",n),children:[t.jsx(p.Icon,{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})]});ql.displayName="SummaryCartButton";const Gl=({open:e,progress:a,dragging:s,primaryAction:n,isLoading:r,cart:i,cartAriaLabel:c,ctaCaption:l,ctaError:d,onToggleOpen:u,classNames:f})=>t.jsxs("div",{"data-testid":"summary-mobile-bar",className:o.cn("flex flex-col gap-4",f.mobileBar),children:[t.jsx(o.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-a},className:o.cn("col-start-1 row-start-1 flex items-stretch gap-2.5",e&&"pointer-events-none",!s&&"transition-opacity duration-300"),children:[i&&t.jsx(ql,{cart:i,ariaLabel:c,className:f.cart,onPress:()=>{u?.(),i.onPress?.()}}),n&&t.jsx(Ca,{action:n,disabledByLoading:r,className:o.cn("h-[52px] flex-1",f.cta),testId:"summary-cta-compact"})]}),n&&t.jsx("div",{"aria-hidden":!e,style:{opacity:a},className:o.cn("col-start-1 row-start-1 flex",!e&&"pointer-events-none",!s&&"transition-opacity duration-300"),children:t.jsx(Ca,{action:n,disabledByLoading:r,className:o.cn("h-[52px] w-full",f.cta)})})]}),l&&t.jsx("div",{children:l})]});Gl.displayName="SummaryActionBar";const Bx="(max-width: 767px)",Px=e=>typeof window<"u"&&typeof window.matchMedia=="function"?window.matchMedia(e).matches:!1,Tx=(e=Bx)=>{const[a,s]=h.useState(()=>Px(e));return h.useEffect(()=>{if(typeof window>"u"||typeof window.matchMedia!="function")return;const n=window.matchMedia(e),r=()=>s(n.matches);return r(),n.addEventListener("change",r),()=>n.removeEventListener("change",r)},[e]),a},Kl=({title:e="Summary",pricesInLabel:a="Prices are in",currency:s,locale:n="en-US",items:r,serviceFee:i,rows:c,total:l,postTotalRows:d,onRemoveTotalRow:u,onRemovePostTotalRow:f,secondaryTotal:m,collapsible:b,isOpen:x,onToggleOpen:g,defaultOpen:j=!1,primaryAction:y,isLoading:v=!1,onRemoveItem:C,showRemoveButton:S,ctaCaption:k,ctaError:$,variant:_,cart:w,emptyState:F,labels:A,classNames:M={},density:E="default","data-testid":D="summary",className:I})=>{const B=A?.removeAriaLabel??"Remove item",z=A?.removeTotalRowAriaLabel??"Remove discount",q=A?.removePostTotalRowAriaLabel??"Remove applied code",P=A?.toggleAriaLabel??"Toggle summary",ee=A?.cartAriaLabel??"View cart",W=E==="compact",Y=Tx(),ie=b??(_??(Y?"mobile":"main"))==="mobile",[te,Q]=h.useState(j),ne=x!==void 0,V=!ie||(ne?x:te),O=h.useCallback(()=>{ne||Q(T=>!T),g?.()},[ne,g]),[Z,Re]=h.useState(0),[De,Ee]=h.useState(null),ae=h.useRef(null),be=h.useRef(null),$e=h.useCallback(()=>{const T=ae.current;T&&Re(Fx(T.scrollHeight,window.innerHeight))},[]),ge=h.useCallback(T=>{be.current?.disconnect(),be.current=null,ae.current=T,T&&($e(),typeof ResizeObserver<"u"&&(be.current=new ResizeObserver($e),be.current.observe(T)))},[$e]);h.useEffect(()=>(window.addEventListener("resize",$e),()=>window.removeEventListener("resize",$e)),[$e]);const We=Mx({open:V,fullHeight:Z,setDragHeight:Ee,onToggleOpen:O}),Le=De!==null,oe=Rx(De,V,Z),de=Z>0?Math.min(1,Math.max(0,oe/Z)):V?1:0,se=t.jsx(Ul,{total:l,locale:n,compact:W,className:M.total}),N=d&&d.length>0&&t.jsx("div",{"data-testid":"summary-post-total-rows",className:"flex flex-col gap-4",children:d.map(T=>t.jsx(tn,{row:T,locale:n,emphasized:!1,onRemove:f,removeAriaLabel:q,showRemoveButton:S,compact:W},T.key))}),L=m&&t.jsx(Hl,{secondaryTotal:m,locale:n,className:M.secondaryTotal}),R=k!=null&&t.jsx("p",{"data-testid":"summary-cta-caption",className:o.cn("text-center text-sm text-default-500",M.ctaCaption),children:k}),H=$!=null&&t.jsx("p",{role:"alert","data-testid":"summary-cta-error",className:o.cn("text-center text-sm text-danger",M.ctaError),children:$}),U=t.jsx(Vl,{pricesInLabel:a,currency:s,items:r,serviceFee:i,rows:c,locale:n,onRemoveItem:C,removeAriaLabel:B,onRemoveTotalRow:u,removeTotalRowAriaLabel:z,showRemoveButton:S,emptyState:F,compact:W,classNames:M});return ie?t.jsxs(ze.motion.section,{"data-testid":D,drag:"y",dragConstraints:{top:0,bottom:0},dragElastic:.12,dragSnapToOrigin:!0,onDrag:We.onDrag,onDragEnd:We.onDragEnd,className:o.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)]",I,M.base),children:[t.jsx(Wl,{title:e,total:l,secondaryTotal:m,locale:n,open:V,progress:de,dragging:Le,toggleAriaLabel:P,onToggleOpen:O,classNames:M}),t.jsx("div",{"data-testid":"summary-reveal","aria-hidden":!V,style:{height:oe},className:o.cn("min-h-0",V&&!Le?"overflow-y-auto overscroll-contain [scrollbar-width:none] [&::-webkit-scrollbar]:hidden":"overflow-hidden",!V&&"pointer-events-none",Ix(Le)),children:t.jsxs("div",{ref:ge,className:W?"flex flex-col gap-3 pb-4":"flex flex-col gap-4 pb-4",children:[U,!W&&t.jsx(o.Divider,{className:"bg-default-200"}),se,N,L]})}),t.jsx(Gl,{open:V,progress:de,dragging:Le,primaryAction:y,isLoading:v,cart:w,cartAriaLabel:ee,ctaCaption:R,ctaError:H,onToggleOpen:O,classNames:M})]}):t.jsxs("section",{"data-testid":D,className:o.cn(W?"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",I,M.base),children:[!W&&t.jsx("div",{className:o.cn("flex items-center justify-between",M.header),children:t.jsx("h2",{"data-testid":"summary-title",className:o.cn("text-xl font-semibold leading-7 text-foreground",M.title),children:e})}),U,!W&&t.jsx(o.Divider,{className:"bg-default-200"}),se,N,L,m&&y&&t.jsx(o.Divider,{className:"bg-default-200"}),y&&t.jsx(Ca,{action:y,disabledByLoading:v,className:o.cn("w-full",M.cta)}),H,R]})};Kl.displayName="Summary";const st={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"},ur={done:"bg-pos-ok",active:"bg-primary",upcoming:"bg-pos-line"},Ox={done:"text-pos-ok",active:"text-pos-ink",upcoming:"text-pos-muted"},zx={ariaLabel:"Progress",completed:"completed"},an=({steps:e,activeStepId:a,showLabels:s=!0,onStepPress:n,isStepReachable:r,labels:i,className:c,"data-testid":l="step-progress"})=>{const d={...zx,...i},u=e.filter(b=>b.state!=="skipped"),f=Math.max(0,u.findIndex(b=>b.id===a)),m=b=>b<f?"done":b===f?"active":"upcoming";return s?t.jsx("ol",{"aria-label":d.ariaLabel,className:o.cn(st.list,c),"data-testid":l,children:u.map((b,x)=>{const g=m(x),j=t.jsxs(t.Fragment,{children:[t.jsx("span",{"aria-hidden":"true",className:o.cn(st.segment,"w-full",ur[g]),"data-testid":`${l}-segment-${b.id}`}),t.jsxs("span",{className:o.cn(st.name,Ox[g]),"data-testid":`${l}-name-${b.id}`,children:[g==="done"&&t.jsx("span",{"aria-hidden":"true",className:st.check,"data-testid":`${l}-check-${b.id}`,children:t.jsx(p.Icon,{icon:"solar:check-circle-bold",width:"100%",height:"100%"})}),t.jsx("span",{className:"truncate",children:b.label}),g==="done"&&t.jsxs("span",{className:"sr-only",children:[", ",d.completed]})]})]}),y=r?r(b.id,x):x<f,v=g==="active"?"step":void 0;return t.jsx("li",{className:st.item,"aria-current":n?void 0:v,"data-state":g,"data-testid":`${l}-step-${b.id}`,children:n?t.jsx("button",{type:"button",className:o.cn(st.step,st.button),disabled:!y,"aria-current":v,onClick:()=>n(b.id),"data-testid":`${l}-button-${b.id}`,children:j}):t.jsx("div",{className:st.step,children:j})},b.id)})}):t.jsx("div",{"aria-hidden":"true",className:o.cn(st.bare,c),"data-testid":l,children:u.map((b,x)=>t.jsx("span",{className:o.cn(st.segment,"flex-1",ur[m(x)]),"data-state":m(x)},b.id))})};an.displayName="StepProgress";const Vx={back:"Back",close:"Close",cancel:"Cancel",partialBadge:"Partial refund",owesBadge:"Customer owes",ofSeparator:"of"},Ux={backgroundColor:le.destructive,color:"#fff"},Hx={warn:{backgroundColor:le["warn-fill"],color:le.warn},ok:{backgroundColor:le["ok-fill"],color:le.ok},neutral:{backgroundColor:"hsl(var(--heroui-default-100))",color:"hsl(var(--heroui-default-600))",border:`1px solid ${le.line}`}},ts="inline-flex h-[22px] items-center gap-[5px] whitespace-nowrap rounded-full px-[9px] text-xs font-medium leading-none",as="absolute top-0 h-5 w-5 opacity-0",Yl=({onClose:e,steps:a,activeStepId:s,subtitle:n,onBack:r,primaryAction:i,totalRow:c,secondaryAction:l,hideChrome:d,footerSummary:u,labels:f,className:m,"data-testid":b="wizard-shell",children:x})=>{const g={...Vx,...f},j=a.find(C=>C.id===s),y=r??e,v=r?g.back:g.cancel;return t.jsxs("div",{className:o.cn("flex h-full min-h-0 w-full flex-col bg-white text-default-900",m),"data-testid":b,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":`${b}-header`,children:[y&&t.jsx(p.Button,{variant:"light",className:"h-10 min-w-0 gap-2 rounded-xl px-4 text-sm font-semibold text-default-600",onPress:y,"data-testid":`${b}-header-back`,startContent:t.jsx(p.Icon,{icon:"lucide:circle-chevron-left",width:18,height:18,"aria-hidden":"true"}),children:v}),t.jsxs("div",{className:"min-w-0",children:[t.jsx("h2",{className:"text-lg font-semibold","data-testid":`${b}-header-title`,children:j?.label??""}),n&&t.jsx("div",{className:"mt-0.5 text-[12.5px] text-default-500","data-testid":`${b}-header-subtitle`,children:n})]}),t.jsxs("div",{className:"relative flex-1","data-testid":`${b}-footer`,children:[e&&t.jsx("button",{type:"button","aria-label":g.close,onClick:e,className:o.cn(as,"left-0"),"data-testid":`${b}-header-close`}),r&&t.jsx("button",{type:"button","aria-label":g.back,onClick:r,className:o.cn(as,"left-6"),"data-testid":`${b}-back`}),l&&t.jsx("button",{type:"button","aria-label":l.label,disabled:l.disabled,onClick:l.onClick,className:o.cn(as,"left-12"),"data-testid":`${b}-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:[c&&t.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-[12.5px] font-semibold text-default-600","data-testid":`${b}-total`,children:[t.jsx("span",{children:c.label}),c.amount&&t.jsx("span",{className:"tabular-nums text-default-900",children:fe(c.amount.value,void 0,c.amount.currency)}),c.of&&t.jsxs(t.Fragment,{children:[t.jsx("span",{children:g.ofSeparator}),t.jsx("span",{className:"tabular-nums text-default-900","data-testid":`${b}-total-of`,children:fe(c.of.value,void 0,c.of.currency)})]}),c.badge==="partial"&&t.jsx("span",{className:o.cn(ts,"bg-pos-warn-fill text-pos-warn"),"data-testid":`${b}-total-partial`,children:g.partialBadge}),c.badge==="owes"&&t.jsx("span",{className:o.cn(ts,"border border-pos-line bg-default-100 text-default-600"),"data-testid":`${b}-total-owes`,children:g.owesBadge}),typeof c.badge=="object"&&t.jsx("span",{className:ts,style:Hx[c.badge.tone],"data-tone":c.badge.tone,"data-testid":`${b}-total-badge`,children:c.badge.label})]}),t.jsx(p.Button,{color:"primary",className:o.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"?Ux:void 0,isLoading:i.loading,isDisabled:i.disabled,onPress:i.onClick,"data-testid":`${b}-primary`,children:i.label})]})]}),t.jsx(an,{steps:a,activeStepId:s,showLabels:!1,className:"shrink-0 px-6 py-2.5","data-testid":`${b}-stepper`}),t.jsx("div",{className:"min-h-0 flex-1 overflow-auto px-6 py-[22px]","data-testid":`${b}-body`,children:x}),u]})};Yl.displayName="WizardShell";const Wx=(e,a,s)=>Math.min(Math.max(e,a),s);function hs(e,a,s){const n=Math.max(1,Math.trunc(a)),r=Wx(Math.trunc(s),0,n);if(r===n)return{...e};if(r===0)return{value:0,currency:e.currency};const i=Math.pow(10,It(e.currency)),c=Math.round(e.value*i),l=Math.floor(c/n),d=c-l*n;return{value:(l*r+Math.min(r,d))/i,currency:e.currency}}function qx(e,a){return hs(e,a,1)}const Gx=e=>Number.isFinite(e)?e.toFixed(2):"",bs=({value:e,expected:a,max:s,onChange:n,ariaLabel:r,isDisabled:i,className:c,"data-testid":l,inputTestId:d})=>{const[u,f]=h.useState(null),m=h.useRef(null),b=Math.abs(e-a)>.004;return t.jsxs("span",{className:o.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",b?"border-primary bg-primary-50":"border-pos-line bg-white",c),"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??Gx(e),onChange:x=>{const g=x.target.value,j=Number.parseFloat(g.replace(",","."));s!==void 0&&Number.isFinite(j)&&j>s+.004||(f(g),Number.isFinite(j)&&j>=0?n(j):g.trim()===""&&n(0))},onFocus:x=>x.currentTarget.select(),onBlur:()=>f(null),"data-testid":d})]})};bs.displayName="AmountCell";const Kx={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"},Yx="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",mr="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",ss="absolute h-5 w-5 opacity-0",Zx=e=>{const a=fe(e.paidAmount.value,void 0,e.paidAmount.currency);if(e.quantity<=1)return a;const s=qx(e.paidAmount,e.quantity);return`${e.quantity} × ${fe(s.value,void 0,s.currency)} · ${a}`},Zl=({items:e,selections:a,onSelectionChange:s,onRestockToggle:n,onDispositionChange:r,amountOnly:i,labels:c,className:l,"data-testid":d="line-item-list"})=>{const u={...Kx,...c},f=[{key:"stock",label:u.dispositionStock},{key:"norestock",label:u.dispositionNoRestock},{key:"damaged",label:u.dispositionDamaged}];return t.jsxs("div",{className:o.cn("flex flex-col text-default-900",l),"data-testid":d,children:[e.map(m=>{const b=a[m.id],x=m.state==="already_refunded"||m.state==="non_refundable",g=`${d}-row-${m.id}`,j=Math.max(1,Math.trunc(m.quantity)),y=b?.quantity,v=b?.selected?Math.min(y??j,j):y??0,C=hs(m.paidAmount,j,v).value,S=b?.amount??(b?.selected?C:0),k=v===0&&S>.004,$=w=>s(m.id,{selected:w.quantity>0||w.amount>.004,mode:"full",...w}),_=w=>{const F=Math.min(Math.max(w,0),j);$({quantity:F,amount:hs(m.paidAmount,j,F).value})};return t.jsxs("div",{className:o.cn("relative flex items-start gap-3 border-b border-pos-line-2 py-3 last:border-b-0",x&&"opacity-60"),"data-testid":g,children:[t.jsx("div",{className:"flex h-10 w-10 shrink-0 items-center justify-center rounded-[10px] bg-default-100 text-default-600","data-testid":`${g}-icon`,children:t.jsx(p.Icon,{icon:m.icon??"lucide:package",width:19,height:19,"aria-hidden":"true"})}),t.jsxs("div",{className:"min-w-0 flex-1",children:[t.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[t.jsxs("div",{className:"min-w-0",children:[t.jsx("p",{className:"truncate text-sm font-semibold",children:m.name}),t.jsx("p",{className:"text-[12.5px] text-default-500","data-testid":`${g}-detail`,children:m.detail??Zx(m)}),k&&t.jsx("p",{className:"mt-[3px] text-[12.5px] italic text-default-500","data-testid":`${g}-adjustment-note`,children:u.adjustmentNote})]}),t.jsxs("div",{className:"flex w-full flex-wrap items-center gap-2.5 sm:w-auto sm:flex-nowrap","data-testid":`${g}-partial`,children:[x?t.jsx("span",{className:"text-sm font-semibold tabular-nums",children:fe(m.paidAmount.value,void 0,m.paidAmount.currency)}):t.jsx(bs,{value:S,expected:C,max:m.paidAmount.value,onChange:w=>$({quantity:v,amount:w}),ariaLabel:u.amount.replace("{name}",m.name),className:"w-[120px]","data-testid":`${g}-amount`,inputTestId:`${g}-partial-input-field`}),x?t.jsx("span",{className:Yx,"data-testid":`${g}-blocked`,children:m.state==="already_refunded"?u.refunded:u.ineligible}):t.jsxs("div",{role:"group","aria-label":m.name,className:"flex w-[160px] shrink-0 items-center gap-0.5 overflow-hidden rounded-[10px] border border-pos-line","data-testid":`${g}-qty`,children:[t.jsx("button",{type:"button",className:mr,"aria-label":u.decrease.replace("{name}",m.name),disabled:v===0,onClick:()=>_(v-1),"data-testid":`${g}-qty-decrease`,children:"−"}),t.jsx("span",{"aria-live":"polite",className:"min-w-8 flex-1 text-center text-[15px] font-semibold tabular-nums","data-testid":`${g}-qty-value`,children:v}),t.jsx("button",{type:"button",className:mr,"aria-label":u.increase.replace("{name}",m.name),disabled:v===j,onClick:()=>_(v+1),"data-testid":`${g}-qty-increase`,children:"+"})]})]})]}),v>=j&&t.jsx("p",{className:"mt-2 text-xs text-default-500","data-testid":`${g}-max-note`,children:u.maxNote.replace("{count}",String(j))}),b?.selected&&!m.restock.available&&m.restock.unavailableHint&&t.jsx("p",{className:"mt-2 text-xs text-default-500",children:m.restock.unavailableHint}),m.warning&&t.jsxs("div",{className:"mt-2.5 flex items-start gap-2 rounded-[10px] bg-pos-warn-fill px-2.5 py-2 text-[12.5px] text-pos-warn","data-testid":`${g}-warning`,children:[t.jsx(p.Icon,{icon:"gravity-ui:triangle-exclamation-fill",width:15,height:15,className:"mt-0.5 shrink-0","aria-hidden":"true"}),t.jsx("span",{children:m.warning})]}),v>0&&m.restock.available&&t.jsxs("div",{className:"mt-2.5 flex flex-wrap items-center gap-2",children:[t.jsx("span",{className:"mr-0.5 text-[11px] font-semibold uppercase tracking-[.04em] text-default-500",children:u.disposition}),t.jsx(p.Select,{"aria-label":u.disposition,className:"w-[220px]",selectedKeys:[m.restock.disposition??(m.restock.on?"stock":"norestock")],onSelectionChange:w=>{if(w==="all")return;const F=[...w][0];F&&(r?.(m.id,F),n(m.id,F==="stock"))},"data-testid":`${g}-restock`,children:f.map(w=>t.jsx(o.SelectItem,{children:w.label},w.key))})]})]}),!x&&t.jsxs(t.Fragment,{children:[t.jsx(o.Checkbox,{className:o.cn(ss,"right-0 top-0 m-0 p-0"),isSelected:!!b?.selected,onValueChange:w=>s(m.id,{selected:w,mode:"full"}),"aria-label":m.name,"data-testid":`${g}-checkbox`}),t.jsx("button",{type:"button","aria-label":u.partialLink,onClick:()=>document.querySelector(`[data-testid="${g}-partial-input-field"]`)?.focus(),className:o.cn(ss,"left-0 top-0"),"data-testid":`${g}-partial-link`}),t.jsx("button",{type:"button","aria-label":u.partialCancel,onClick:()=>$({quantity:v,amount:C}),className:o.cn(ss,"left-5 top-0"),"data-testid":`${g}-partial-cancel`})]})]},m.id)}),i&&(i.value===null?t.jsxs("button",{type:"button",onClick:i.onAdd,className:"mt-1 inline-flex items-center gap-1.5 self-start rounded pt-3 text-[12.5px] font-semibold text-primary outline-none hover:text-primary-600 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary","data-testid":`${d}-amount-only-add`,children:[t.jsx(p.Icon,{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,{icon:"lucide:circle-dollar-sign",width:19,height:19,"aria-hidden":"true"})}),t.jsx("div",{className:"min-w-0 flex-1",children:t.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[t.jsxs("div",{className:"min-w-0",children:[t.jsx("p",{className:"text-sm font-semibold",children:u.amountOnlyTitle}),t.jsx("p",{className:"text-[12.5px] text-default-500",children:u.amountOnlyDetail.replace("{amount}",fe(i.max.value,void 0,i.max.currency))})]}),t.jsxs("div",{className:"flex w-full flex-wrap items-center gap-2.5 sm:w-[290px] sm:flex-nowrap",children:[t.jsx(bs,{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,{icon:"lucide:trash-2",width:17,height:17,"aria-hidden":"true"})})]})]})})]}))]})};Zl.displayName="LineItemList";const Qx={color:le.danger},Ql=({children:e,className:a,"data-testid":s="meta-card"})=>t.jsx("div",{className:o.cn("mx-auto mt-[18px] flex max-w-[1040px] flex-col gap-3",a),"data-testid":s,children:t.jsx("div",{className:"rounded-[14px] border border-pos-line bg-white px-4 py-3.5 text-default-900",children:e})});Ql.displayName="MetaCard";const Xl=({label:e,htmlFor:a,required:s,children:n,className:r,"data-testid":i="meta-card-row"})=>t.jsxs("div",{className:o.cn("flex flex-wrap items-center justify-between gap-4",r),"data-testid":i,children:[t.jsxs("label",{htmlFor:a,className:"text-[13px] font-medium text-default-600",children:[e,s&&t.jsx("span",{"aria-hidden":"true",className:"ms-0.5 text-danger",style:Qx,"data-testid":`${i}-required`,children:"*"})]}),t.jsx("div",{className:"w-full sm:w-[290px] sm:shrink-0",children:n})]});Xl.displayName="MetaCard.Row";const Jl=({label:e,children:a,className:s,"data-testid":n="meta-card-section"})=>t.jsxs("div",{className:o.cn("mt-3.5 flex flex-col gap-2.5 border-t border-pos-line pt-3",s),"data-testid":n,children:[e&&t.jsx("p",{className:"text-[13px] font-medium text-default-600",children:e}),a]});Jl.displayName="MetaCard.Section";const Xx=Object.assign(Ql,{Row:Xl,Section:Jl}),eo=({heading:e,icon:a="lucide:rotate-ccw",action:s,children:n,className:r,"data-testid":i="section-panel"})=>t.jsxs("section",{className:o.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,{icon:a,width:16,height:16,"aria-hidden":"true"}),t.jsx("h3",{"data-testid":`${i}-heading`,children:e}),t.jsx("div",{className:"flex-1"}),s&&t.jsxs("button",{type:"button",disabled:s.disabled,onClick:s.onClick,className:o.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,{icon:s.icon??"lucide:plus",width:14,height:14,"aria-hidden":"true"}),s.label]})]}),n]});eo.displayName="SectionPanel";const to=({name:e,detail:a,icon:s="lucide:users",labels:n,className:r,"data-testid":i="customer-card"})=>t.jsxs("div",{className:o.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,{icon:s,width:18,height:18,"aria-hidden":"true"})}),t.jsxs("div",{className:"min-w-0 flex-1",children:[t.jsx("p",{className:"mb-0.5 text-[11px] font-semibold uppercase tracking-[.08em] text-default-500",children:n?.heading??"Customer"}),t.jsx("p",{className:"text-sm font-semibold","data-testid":`${i}-name`,children:e}),a&&t.jsx("p",{className:"text-[12.5px] text-default-500",children:a})]})]});to.displayName="CustomerCard";const Jx={label:"Reason for the return",placeholder:"Select a reason…"},ao=({options:e,value:a,onChange:s,error:n,isRequired:r,labels:i,className:c,"data-testid":l="reason-select"})=>{const d={...Jx,...i};return t.jsx(p.Select,{label:d.label,labelPlacement:"outside",placeholder:d.placeholder,selectedKeys:a?[a]:[],isRequired:r,isInvalid:!!n,errorMessage:n,className:o.cn(c),"data-testid":l,onSelectionChange:u=>{if(u==="all")return;const f=[...u][0];f&&s(String(f))},children:e.map(u=>t.jsx(o.SelectItem,{children:u.label},u.id))})};ao.displayName="ReasonSelect";const ep={toggle:"Add a note",optionalTag:"(optional)",heading:"Additional note",placeholder:"Add a note (optional)"},so=({value:e,onChange:a,maxLength:s,alwaysExpanded:n=!1,hideLabel:r=!1,labels:i,className:c,"data-testid":l="notes-field"})=>{const d={...ep,...i},[u,f]=h.useState(e!=="");return n?t.jsxs("div",{className:o.cn("flex flex-col gap-2",c),"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=>a(m.target.value),maxLength:s,placeholder:d.placeholder,className:o.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:o.cn(c),"data-testid":l,children:u?t.jsx(o.Textarea,{value:e,onChange:m=>a(m.target.value),maxLength:s,placeholder:d.toggle,"aria-label":d.toggle,variant:"bordered",radius:"lg","data-testid":`${l}-textarea`}):t.jsxs(p.Button,{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})]})})};so.displayName="NotesField";const tp={info:"solar:info-circle-bold",success:"solar:check-circle-bold",warning:"solar:danger-triangle-bold",danger:"solar:danger-circle-bold"},ap="solar:close-circle-linear",sp={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"}},np={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"}},rp={info:"status",success:"status",warning:"alert",danger:"alert"};function sn({tone:e="info",variant:a="callout",title:s,description:n,actions:r,onDismiss:i,dismissLabel:c="Dismiss",role:l=rp[e],className:d,"data-testid":u="notice"}){const f=p.useReducedMotion(),m=sp[a],b=np[e],x=a==="banner",g=p.hasContent(s),j=p.hasContent(n),y=g?x?t.jsx("p",{"data-testid":`${u}-title`,className:o.cn(m.title,b.title),children:s}):t.jsx("span",{"data-testid":`${u}-title`,className:m.title,children:s}):null,v=j?x?t.jsx("p",{"data-testid":`${u}-description`,className:o.cn(m.description,g&&"mt-0.5"),children:n}):t.jsx("span",{"data-testid":`${u}-description`,className:m.description,children:n}):null;return t.jsxs("div",{role:l,"aria-live":l==="alert"?"assertive":"polite","data-tone":e,"data-variant":a,"data-testid":u,className:o.cn(m.root,x?b.banner:b.callout,d),children:[t.jsx("span",{"aria-hidden":"true","data-testid":`${u}-icon`,className:o.cn(m.iconWrapper,x&&b.disc),children:t.jsx(p.Icon,{icon:tp[e],width:m.iconSize,height:m.iconSize})}),t.jsxs("div",{className:m.text,children:[x?t.jsxs(t.Fragment,{children:[y,v]}):t.jsxs("p",{children:[y,g&&j?" ":null,v]}),r?t.jsx("div",{"data-testid":`${u}-actions`,className:m.actions,children:r}):null]}),i?t.jsx(p.Button,{isIconOnly:!0,color:"default",size:"sm",radius:"full",variant:"light","aria-label":c,onPress:i,disableAnimation:f,className:o.cn(m.dismiss,p.stillTransitionClass),"data-testid":`${u}-dismiss`,children:t.jsx(p.Icon,{icon:ap,width:"1.125rem",height:"1.125rem"})}):null]})}sn.displayName="Notice";const fr="h-8 min-w-0 rounded-[0.625rem] px-3 text-[0.8125rem] font-semibold",Ra=({tone:e,title:a,body:s,onRetry:n,retryLabel:r,onChooseDifferent:i,chooseDifferentLabel:c,className:l,"data-testid":d,retryTestId:u,chooseDifferentTestId:f})=>t.jsx(sn,{variant:"banner",tone:e,title:a,description:s,className:l,"data-testid":d,actions:t.jsxs(t.Fragment,{children:[n&&t.jsx(p.Button,{color:"primary",className:fr,onPress:n,"data-testid":u,children:r}),t.jsx(p.Button,{variant:"bordered",className:o.cn(fr,"border-1 border-pos-line bg-white text-default-900"),onPress:i,"data-testid":f,children:c})]})});Ra.displayName="TenderBanner";const ip={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"},lp={card:"lucide:credit-card",cash:"lucide:dollar-sign",check:"lucide:edit-3",other:"lucide:more-horizontal"},no=({tenders:e,selectedTenderId:a,onSelect:s,onSplit:n,error:r,labels:i,className:c,"data-testid":l="tender-methods"})=>{const d={...ip,...i},u=r?.kind==="processor_declined";return t.jsxs("div",{className:o.cn("flex flex-col text-default-900",c),"data-testid":l,children:[r&&t.jsx(Ra,{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===a;return t.jsxs("button",{type:"button",role:"radio","aria-checked":m,onClick:()=>s(f.tenderId),className:o.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:o.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,{icon:lp[f.kind],width:18,height:18,"aria-hidden":"true"})}),t.jsxs("span",{className:"min-w-0",children:[t.jsx("span",{className:"block text-sm font-semibold",children:f.label}),t.jsx("span",{className:"block text-xs text-default-500",children:fe(f.maxRefundable.value,void 0,f.maxRefundable.currency)})]})]},f.tenderId)}),t.jsxs("button",{type:"button",onClick:n,className:o.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,{icon:"lucide:split",width:18,height:18,"aria-hidden":"true"})}),t.jsx("span",{className:"min-w-0 text-sm font-semibold",children:d.split})]})]})]})};no.displayName="TenderMethods";const op=e=>e.refunded!==null,cp={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"},dp="mb-2 text-[11px] font-semibold uppercase tracking-[.08em] text-default-500",up="inline-flex h-[22px] shrink-0 items-center gap-[5px] whitespace-nowrap rounded-full px-[9px] text-xs font-medium leading-none",ro=({parts:e,refundedSoFar:a,remaining:s,current:n,methods:r,onRefundPart:i,partError:c,onBack:l,busy:d,hideActions:u,labels:f,className:m,"data-testid":b="split-tender-panel"})=>{const x={...cp,...f},g=e.filter(op),j=e.find(w=>w.tenderId===n.tenderId)?.label,y=!!(r?.length&&n.onTenderChange),v=It(s.currency),{draft:C,setDraft:S,normalize:k}=Nl(n.amount,String),$=h.useCallback(w=>{Ks(w,v)&&(S(w),n.onAmountChange(Xt(w)??0))},[n,S,v]),_=c?.kind==="processor_declined";return t.jsxs("div",{className:o.cn("flex flex-col text-default-900",m),"data-testid":b,children:[t.jsx("h3",{className:"sr-only","data-testid":`${b}-title`,children:x.title}),c&&t.jsx(Ra,{tone:_?"danger":"warning",title:_?x.declinedTitle:x.networkTitle,body:_?x.partDeclinedBody:x.partNetworkBody,onRetry:c.onRetry,retryLabel:x.retry,onChooseDifferent:c.onChooseDifferent,chooseDifferentLabel:x.chooseDifferent,className:"mb-[18px]","data-testid":`${b}-part-error`,retryTestId:`${b}-retry`,chooseDifferentTestId:`${b}-choose-different`}),t.jsxs("div",{"data-testid":`${b}-totals`,children:[t.jsxs("div",{className:"mb-4 flex items-center justify-between gap-2.5 rounded-xl bg-default-100 px-4 py-3.5",children:[t.jsx("span",{className:"text-[13px] font-semibold text-default-500",children:x.remaining}),t.jsx("span",{className:"text-[22px] font-semibold tabular-nums",children:fe(s.value,void 0,s.currency)}),t.jsxs("span",{className:"sr-only",children:[x.refundedSoFar,": ",fe(a.value,void 0,a.currency)]})]}),g.length>0&&t.jsxs("div",{children:[t.jsx("p",{className:dp,children:x.refundedSoFar}),g.map((w,F)=>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":`${b}-part-${w.tenderId}-done`,children:[t.jsxs("span",{className:"w-[22px] shrink-0 font-bold text-default-600",children:["#",F+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,{icon:w.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:w.label}),w.feeNote&&t.jsx("span",{className:"block text-[11.5px] text-default-500",children:w.feeNote})]}),t.jsx("span",{className:"font-semibold tabular-nums",children:fe(w.refunded.value,void 0,w.refunded.currency)}),t.jsx("span",{className:o.cn(up,w.status==="pending"?"bg-pos-warn-fill text-pos-warn":"bg-pos-ok-fill text-pos-ok"),children:w.status==="pending"?x.pending:x.succeeded})]},w.tenderId))]})]}),t.jsxs("div",{className:"mt-3.5","data-testid":`${b}-current`,children:[t.jsxs("div",{className:"mb-2 flex items-center justify-between gap-2",children:[t.jsx("span",{className:"text-sm font-semibold",children:x.partHeading.replace("{n}",String(g.length+1))}),j&&t.jsx("span",{className:"text-xs text-default-500",children:j})]}),t.jsx("p",{"aria-hidden":"true",className:"mb-1.5 text-[13px] font-semibold","data-testid":`${b}-amount-label`,children:x.amountForPart}),t.jsx(Zs,{heading:x.amountForPart,amountLabel:x.amountForPart,hideHeading:!0,placeholder:"$0.00",value:C,onChange:$,onBlur:k,maxAmount:s.value,isDisabled:d,className:"gap-0 border-t-0 pt-0","data-testid":`${b}-amount`}),y&&t.jsx("div",{className:"mt-2.5 flex gap-2","data-testid":`${b}-methods`,children:r?.map(w=>{const F=w.tenderId===n.tenderId;return t.jsxs("button",{type:"button","aria-pressed":F,disabled:w.disabled||d,onClick:()=>n.onTenderChange?.(w.tenderId),className:o.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",F?"border-primary bg-primary/5 text-primary":"border-pos-line text-default-600"),"data-testid":`${b}-method-${w.tenderId}`,children:[w.icon&&t.jsx(p.Icon,{icon:w.icon,width:15,height:15,"aria-hidden":"true"}),w.label]},w.tenderId)})})]}),!u&&t.jsxs("div",{className:"mt-4 flex items-center gap-3",children:[t.jsx(p.Button,{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":`${b}-back`,children:x.back}),t.jsx(p.Button,{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":`${b}-submit`,children:x.submit})]})]})};ro.displayName="SplitTenderPanel";const io="hsl(var(--heroui-primary))",mp="hsl(var(--heroui-primary) / 0.05)",lo="hsl(var(--heroui-default-100))",oo="hsl(var(--heroui-default-600))",nn={card:"lucide:credit-card",cash:"lucide:dollar-sign",check:"lucide:edit-3",store_credit:"lucide:gift",reader:"lucide:nfc",other:"lucide:more-horizontal"},ce={root:"flex flex-col text-default-900",banner:"mb-[18px]",eyebrowRow:"mb-3 flex min-h-6 items-center justify-between gap-3",eyebrow:"text-[11px] font-semibold uppercase tracking-[.08em] text-default-500",grid:"grid grid-cols-3 gap-2.5",card:"relative flex min-h-[132px] flex-col rounded-[14px] border-[1.5px] bg-white transition-colors",focusRing:"outline-none focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary",toggle:"flex w-full items-center gap-[11px] rounded-[12px] px-[15px] pt-[13px] text-left disabled:cursor-not-allowed",toggleUnselected:"flex-1 flex-col items-stretch gap-3 pb-[13px]",toggleHeader:"flex w-full items-center gap-[11px]",toggleRemovable:"pr-12",iconBox:"flex h-[38px] w-[38px] shrink-0 items-center justify-center rounded-[10px]",text:"min-w-0 flex-1",label:"block truncate text-[15px] font-semibold leading-5",subtitle:"block truncate text-xs text-default-500",status:"block truncate text-xs font-semibold",lowerSlot:"mt-auto flex h-11 w-full items-center rounded-[10px] px-3 text-[13px] font-medium tabular-nums",amountSlot:"mt-auto px-[15px] pb-[13px] pt-3",amountWrapper:"h-11 min-h-11 rounded-[10px] bg-white shadow-none",amountInput:"text-[15px] font-semibold tabular-nums",remove:"absolute right-1 top-1 flex h-11 w-11 items-center justify-center rounded-[10px] text-default-500 hover:text-default-900 disabled:cursor-not-allowed",badge:"inline-flex h-[22px] shrink-0 items-center whitespace-nowrap rounded-full px-[9px] text-xs font-medium leading-none",another:"flex min-h-[132px] w-full flex-col items-start justify-center gap-3 rounded-[14px] border-[1.5px] border-dashed bg-white px-[15px] py-[13px] text-left transition-colors disabled:cursor-not-allowed",anotherOpen:"aria-expanded:scale-100",menuItem:"py-2"},fp={idle:{borderColor:le.line,backgroundColor:"#fff"},selected:{borderColor:io,backgroundColor:mp},declined:{borderColor:le.danger,backgroundColor:le["danger-fill"]}},ka={idle:{backgroundColor:lo,color:oo},selected:{backgroundColor:io,color:"#fff"}},xp={backgroundColor:lo,color:oo},pp={borderColor:le.line},xr={declined:{color:le.danger},pending:{color:le.warn,backgroundColor:le["warn-fill"]},done:{color:le.ok,backgroundColor:le["ok-fill"]}},hp={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"},bp=e=>{try{return new Intl.NumberFormat("en-US",{style:"currency",currency:e}).formatToParts(0).find(a=>a.type==="currency")?.value??e}catch{return e}},gp=({method:e,currency:a,busy:s,labels:n,onToggle:r,onAmountChange:i,onAmountBlur:c,onRemove:l,testId:d})=>{const u=e.status??"idle",f=u==="pending"||u==="done",m=s||f,b=!!(e.removable&&l),x=e.cap?.currency??a,g=It(x),j=`${d}-amount`,y=n.amountFor.replace("{method}",e.label),v=h.useCallback(_=>{if(!Ks(_,g))return;const w=Xt(_);e.cap&&w!==null&&w>e.cap.value||i(e.id,_)},[g,e.cap,e.id,i]),C=h.useCallback(_=>{const w=_.currentTarget;requestAnimationFrame(()=>{w.isConnected&&w.select()})},[]),S=u==="declined"?"declined":e.selected?"selected":"idle",k=e.statusLabel??(u==="idle"?void 0:n[u]),$=t.jsxs("span",{className:ce.toggleHeader,children:[t.jsx("span",{className:ce.iconBox,style:e.selected?ka.selected:ka.idle,"data-testid":`${d}-icon`,children:t.jsx(p.Icon,{icon:nn[e.kind],width:18,height:18,"aria-hidden":"true"})}),t.jsxs("span",{className:ce.text,children:[t.jsx("span",{className:ce.label,children:e.label}),u==="declined"&&k?t.jsx("span",{className:ce.status,style:xr.declined,"data-testid":`${d}-status`,children:k}):e.subtitle&&t.jsx("span",{className:ce.subtitle,children:e.subtitle})]}),f&&k&&t.jsx("span",{className:ce.badge,style:xr[u],"data-testid":`${d}-status`,children:k})]});return t.jsxs("div",{className:ce.card,style:fp[S],"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:o.cn(ce.toggle,ce.focusRing,b&&ce.toggleRemovable),"data-testid":`${d}-toggle`,children:$}),t.jsxs("div",{className:ce.amountSlot,children:[t.jsx("label",{htmlFor:j,className:"sr-only",children:y}),t.jsx(o.Input,{id:j,"aria-label":y,type:"text",inputMode:"decimal",placeholder:"0.00",value:e.amount??"",onChange:_=>v(_.target.value),onFocus:C,onBlur:()=>c?.(e.id),isDisabled:m,variant:"bordered",startContent:t.jsx("span",{className:"text-[15px] font-semibold text-default-500","aria-hidden":"true",children:bp(x)}),classNames:{inputWrapper:ce.amountWrapper,input:ce.amountInput},"data-testid":`${d}-amount`})]})]}):t.jsxs("button",{type:"button","aria-pressed":!1,disabled:m,onClick:()=>r(e.id),className:o.cn(ce.toggle,ce.toggleUnselected,ce.focusRing,b&&ce.toggleRemovable),"data-testid":`${d}-toggle`,children:[$,t.jsx("span",{className:ce.lowerSlot,style:xp,"data-testid":`${d}-cap`,children:e.cap?n.upTo.replace("{amount}",fe(e.cap.value,void 0,e.cap.currency)):n.noCap})]}),b&&t.jsx("button",{type:"button","aria-label":n.remove.replace("{method}",e.label),disabled:s,onClick:()=>l?.(e.id),className:o.cn(ce.remove,ce.focusRing),"data-testid":`${d}-remove`,children:t.jsx(p.Icon,{icon:"lucide:x",width:16,height:16,"aria-hidden":"true"})})]})},co=({methods:e,onToggle:a,onAmountChange:s,onAmountBlur:n,onRemove:r,currency:i="USD",paidWith:c,anotherMethod:l,error:d,busy:u=!1,labels:f,className:m,"data-testid":b="refund-method-cards"})=>{const x={...hp,...f};return t.jsxs("div",{className:o.cn(ce.root,m),"data-testid":b,children:[d&&t.jsx(Ra,{tone:d.tone,title:d.title,body:d.body,onRetry:d.onRetry,retryLabel:x.retry,onChooseDifferent:d.onChooseDifferent,chooseDifferentLabel:x.chooseDifferent,className:ce.banner,"data-testid":`${b}-error`,retryTestId:`${b}-retry`,chooseDifferentTestId:`${b}-choose-different`}),t.jsxs("div",{className:ce.eyebrowRow,children:[t.jsx("p",{className:ce.eyebrow,children:x.heading}),c&&t.jsx(La,{variant:"record",label:c.label,value:c.value,"data-testid":`${b}-paid-with`})]}),t.jsxs("div",{role:"group","aria-label":x.heading,className:ce.grid,"data-testid":`${b}-grid`,children:[e.map(g=>t.jsx(gp,{method:g,currency:i,busy:u,labels:x,onToggle:a,onAmountChange:s,onAmountBlur:n,onRemove:r,testId:`${b}-method-${g.id}`},g.id)),l&&t.jsxs(o.Dropdown,{placement:"bottom-start",isDisabled:u,classNames:{trigger:ce.anotherOpen},children:[t.jsx(o.DropdownTrigger,{children:t.jsxs("button",{type:"button",className:o.cn(ce.another,ce.focusRing),style:pp,"data-testid":`${b}-another`,children:[t.jsx("span",{className:ce.iconBox,style:ka.idle,children:t.jsx(p.Icon,{icon:"lucide:plus",width:18,height:18,"aria-hidden":"true"})}),t.jsxs("span",{className:"min-w-0",children:[t.jsx("span",{className:ce.label,children:l.label}),t.jsx("span",{className:ce.subtitle,children:l.subtitle})]})]})}),t.jsx(o.DropdownMenu,{"aria-label":l.label,items:l.options,onAction:g=>l.onPick(String(g)),"data-testid":`${b}-another-menu`,children:g=>t.jsx(o.DropdownItem,{textValue:g.label,description:g.description,className:ce.menuItem,startContent:t.jsx("span",{className:ce.iconBox,style:ka.idle,children:t.jsx(p.Icon,{icon:nn[g.kind],width:18,height:18,"aria-hidden":"true"})}),"data-testid":`${b}-another-option-${g.id}`,children:g.label},g.id)})]})]})]})};co.displayName="RefundMethodCards";const Ue={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"},uo="hsl(var(--heroui-primary))",yp={idle:{borderColor:le.line,backgroundColor:"#fff"},active:{borderColor:uo,backgroundColor:"hsl(var(--heroui-primary) / 0.05)"},failed:{borderColor:le.danger,backgroundColor:le["danger-fill"]}},pr={idle:{backgroundColor:"hsl(var(--heroui-default-100))",color:"hsl(var(--heroui-default-600))"},active:{backgroundColor:uo,color:"#fff"}},vp={backgroundColor:"#fff",color:le.neutral},Et=e=>({color:Ze[e].fg,backgroundColor:Ze[e].bg}),jp={queued:Et("neutral"),processing:Et("info"),waiting_reader:Et("warn"),waiting_cash:Et("warn"),done:Et("ok"),failed:Et("danger")},wp={heading:"Refunding",queued:"Queued",processing:"Processing",waitingReader:"Waiting for reader",waitingCash:"Waiting for cash",done:"Refunded",failed:"Failed"},Np={queued:"queued",processing:"processing",waiting_reader:"waitingReader",waiting_cash:"waitingCash",done:"done",failed:"failed"},hr={waiting_reader:"lucide:nfc",waiting_cash:"lucide:banknote"},Cp=e=>e.status==="processing"||e.status==="waiting_reader"||e.status==="waiting_cash",mo=({parts:e,activeId:a,labels:s,className:n,"data-testid":r="refund-progress-list"})=>{const i={...wp,...s},c=a??e.find(Cp)?.id;return t.jsxs("div",{className:o.cn(Ue.root,n),"data-testid":r,children:[t.jsx("p",{className:Ue.eyebrow,children:i.heading}),t.jsx("ol",{"aria-label":i.heading,className:Ue.list,children:e.map(l=>{const d=l.id===c,u=`${r}-part-${l.id}`,f=d?"active":l.status==="failed"?"failed":"idle";return t.jsxs("li",{"aria-current":d?"step":void 0,className:Ue.row,style:yp[f],"data-status":l.status,"data-active":d||void 0,"data-testid":u,children:[t.jsxs("div",{className:Ue.main,children:[t.jsx("span",{className:Ue.iconBox,style:d?pr.active:pr.idle,children:t.jsx(p.Icon,{icon:nn[l.kind],width:18,height:18,"aria-hidden":"true"})}),t.jsxs("span",{className:Ue.text,children:[t.jsx("span",{className:Ue.label,children:l.label}),l.note&&t.jsx("span",{className:Ue.note,children:l.note})]}),t.jsx("span",{className:Ue.amount,children:fe(l.amount.value,void 0,l.amount.currency)}),t.jsxs("span",{className:Ue.badge,style:jp[l.status],"data-testid":`${u}-status`,children:[l.status==="processing"&&t.jsx(p.Icon,{icon:"lucide:loader-circle",width:12,height:12,className:"animate-spin","aria-hidden":"true"}),i[Np[l.status]]]})]}),(l.prompt||l.action)&&t.jsxs("div",{role:"status",className:Ue.prompt,style:vp,"data-testid":`${u}-prompt`,children:[hr[l.status]&&t.jsx(p.Icon,{icon:hr[l.status],width:18,height:18,"aria-hidden":"true"}),l.prompt&&t.jsx("span",{className:Ue.promptText,children:l.prompt}),l.action&&t.jsx(p.Button,{color:"primary",className:Ue.action,onPress:l.action.onPress,isLoading:l.action.loading,isDisabled:l.action.disabled,"data-testid":`${u}-action`,children:l.action.label})]})]},l.id)})})]})};mo.displayName="RefundProgressList";const kp={label:"Supervisor authorization",placeholder:"••••"},fo=({pin:e,onChange:a,hint:s,error:n,labels:r,className:i,"data-testid":c="pin-field"})=>{const l={...kp,...r};return t.jsxs("div",{className:o.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":c,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,{icon:"lucide:lock",width:26,height:26,"aria-hidden":"true"})}),t.jsx("p",{className:"text-[17px] font-semibold",children:l.label}),s&&t.jsx("p",{className:"mt-1.5 text-[13px] text-default-500",children:s}),t.jsx(o.Input,{type:"password",inputMode:"numeric","aria-label":l.label,placeholder:l.placeholder,value:e,onChange:d=>a(d.target.value.replace(/\D/g,"").slice(0,6)),isInvalid:!!n,errorMessage:n,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":`${c}-input`})]})};fo.displayName="PinField";const Sp={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"},$p={refund:{},payment:{title:"Payment complete",done:"New sale",authorizedBy:"Handled by {name}"}},Ap={succeeded:"bg-pos-ok-fill text-pos-ok",pending:"bg-pos-warn-fill text-pos-warn"},Dp="inline-flex h-[1.375rem] items-center gap-[0.3125rem] whitespace-nowrap rounded-full px-[0.5625rem] text-xs font-medium leading-none",Wt="mb-1.5 text-[0.6875rem] font-semibold uppercase tracking-[.05em] text-pos-muted",Ep="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)]",Lp=["email","print"],pa=`${p.stillTransitionClass} motion-reduce:data-[pressed=true]:scale-100 [html[data-pos-reduce-motion=true]_&]:data-[pressed=true]:scale-100`,we={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 ${pa}`,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] ${pa}`,send:`h-10 w-full rounded-xl px-4 text-sm font-semibold ${pa}`,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"},xo=({state:e,kind:a="refund",total:s,destinations:n,subtitle:r,reason:i,paidWith:c,outcomeGroups:l,changeDue:d,authorizedBy:u,selectedReceipts:f,onSendReceipt:m,receiptActions:b,emailReceipt:x,onDone:g,frameless:j=!1,labels:y,className:v,"data-testid":C="outcome-view"})=>{const S={...Sp,...$p[a],...y},k=h.useId(),$=s?fe(s.value,void 0,s.currency):null;return e==="processing"?t.jsx("div",{className:o.cn("flex flex-col items-center justify-center text-center text-pos-ink",v),"aria-live":"polite","data-testid":C,children:t.jsxs("div",{className:"flex flex-col items-center px-5 py-[3.75rem]","data-testid":`${C}-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 ${p.stillAnimationClass}`,role:"presentation"}),t.jsx("p",{className:"text-[1.0625rem] font-semibold",children:S.processing}),$&&t.jsx("p",{className:"mt-2 text-[0.9375rem] font-semibold tabular-nums","data-testid":`${C}-processing-total`,children:$})]})}):t.jsxs("div",{className:o.cn("flex flex-col text-pos-ink",!j&&Ep,v),"aria-live":"polite","data-testid":C,children:[t.jsxs("div",{className:o.cn("text-center",a==="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,{icon:"solar:check-circle-bold",width:"100%",height:"100%"})})}),d?t.jsxs(t.Fragment,{children:[t.jsx("p",{className:we.changeTitle,"data-testid":`${C}-title`,children:S.title}),t.jsx("p",{className:we.changeLabel,children:S.changeDue}),t.jsx("p",{className:we.changeAmount,"data-testid":`${C}-change`,children:fe(d.amount.value,void 0,d.amount.currency)}),d.caption&&t.jsx("p",{className:we.changeCaption,"data-testid":`${C}-change-caption`,children:d.caption})]}):t.jsxs(t.Fragment,{children:[t.jsx("p",{className:"text-[1.375rem] font-semibold","data-testid":`${C}-title`,children:S.title}),$&&t.jsx("p",{className:"my-1 text-[1.875rem] font-semibold tabular-nums","data-testid":`${C}-total`,children:$}),r&&t.jsx("p",{className:"text-[0.8125rem] text-pos-muted","data-testid":`${C}-subtitle`,children:r})]}),i&&t.jsx("p",{className:"text-[0.8125rem] text-pos-muted","data-testid":`${C}-reason`,children:S.reason.replace("{reason}",i)})]}),c&&c.length>0&&t.jsxs("div",{className:"mt-5 text-left","data-testid":`${C}-paid-with`,children:[t.jsx("p",{className:Wt,children:S.paidWithTitle}),c.map((_,w)=>t.jsxs("div",{className:we.paidRow,"data-testid":`${C}-paid-with-${w}`,children:[_.icon&&t.jsx("span",{className:we.paidIcon,"aria-hidden":"true",children:t.jsx("span",{className:"flex h-4 w-4",children:t.jsx(p.Icon,{icon:_.icon,width:"100%",height:"100%"})})}),t.jsx("span",{className:we.paidLabel,children:_.label}),t.jsx("span",{className:we.paidAmount,children:fe(_.amount.value,void 0,_.amount.currency)}),_.status&&t.jsx("span",{className:we.paidStatus,children:_.status})]},`${_.label}-${w}`))]}),l&&l.length>0&&t.jsxs("div",{className:"mt-5 text-left","data-testid":`${C}-outcome`,children:[t.jsx("p",{className:Wt,children:S.outcomeTitle}),t.jsx("div",{className:we.groups,children:l.map((_,w)=>t.jsxs("div",{"data-testid":`${C}-outcome-${w}`,children:[t.jsx("p",{className:we.groupLabel,children:_.label}),t.jsx("ul",{className:we.groupItems,"aria-label":_.label,children:_.items.map((F,A)=>t.jsx("li",{className:we.groupItem,children:F},`${F}-${A}`))})]},`${_.label}-${w}`))})]}),n&&t.jsxs("div",{className:"mt-5 text-left",children:[t.jsx("p",{className:Wt,children:S.destinationsTitle}),n.map((_,w)=>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":`${C}-destination-${w}-${_.status}`,children:[t.jsx("span",{className:"font-semibold",children:_.label}),t.jsxs("div",{className:"flex items-center gap-2.5",children:[t.jsx("span",{className:"tabular-nums text-pos-neutral",children:fe(_.amount.value,void 0,_.amount.currency)}),t.jsx("span",{className:o.cn(Dp,Ap[_.status]),children:_.status==="succeeded"?S.succeeded:S.pending})]})]},`${_.label}-${w}`))]}),b&&b.length>0?t.jsxs("div",{className:"mt-5 flex flex-col text-left","data-testid":`${C}-receipt-actions`,children:[t.jsx("p",{className:Wt,children:S.sendReceipt}),t.jsx("div",{className:we.receiptRow,children:b.map(_=>t.jsx(Fp,{action:_,controls:_.expanded?k:void 0,"data-testid":`${C}-receipt-action-${_.key}`},_.key))}),x&&t.jsx(_p,{id:k,email:x,labels:S,"data-testid":`${C}-email`})]}):m&&t.jsxs("div",{className:"mt-5 text-left",children:[t.jsx("p",{className:Wt,children:S.sendReceipt}),t.jsx("div",{className:"flex flex-col gap-2",children:Lp.map(_=>{const w=f?.includes(_)??!1;return t.jsxs("button",{type:"button",role:"checkbox","aria-checked":w,onClick:()=>m(_),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 ${p.stillTransitionClass}`,"data-testid":`${C}-receipt-${_}`,children:[t.jsx("span",{"aria-hidden":"true",className:"pointer-events-none flex",children:t.jsx(o.Checkbox,{isSelected:w,isReadOnly:!0,tabIndex:-1})}),t.jsx("span",{children:S[_]})]},_)})})]}),u&&t.jsx("p",{className:"mt-4 text-[0.78125rem] text-pos-muted","data-testid":`${C}-authorized-by`,children:S.authorizedBy.replace("{name}",u)}),t.jsx("div",{className:"mt-auto pt-5",children:t.jsx(p.Button,{color:"primary",className:`h-12 w-full rounded-[0.875rem] px-5 text-[0.9375rem] font-semibold ${pa}`,onPress:g,"data-testid":`${C}-done`,children:S.done})})]})};xo.displayName="OutcomeView";function Fp({action:e,controls:a,"data-testid":s}){return t.jsx(p.Button,{variant:"bordered",color:"default",disableRipple:!0,className:o.cn(we.receiptAction,e.expanded&&we.receiptActionExpanded),"aria-expanded":e.expanded,"aria-controls":a,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,{icon:e.icon,width:"100%",height:"100%"})}):void 0,"data-testid":s,children:e.label})}function _p({id:e,email:a,labels:s,"data-testid":n}){const r=a.isSendDisabled??a.emails.length===0;return t.jsxs("div",{id:e,className:we.emailBox,"data-testid":n,children:[t.jsxs("div",{className:o.cn(we.chipWrap,a.isInvalid?"border-pos-danger":"border-pos-line"),"data-invalid":a.isInvalid||void 0,"data-testid":`${n}-recipients`,children:[a.emails.map(i=>t.jsxs("span",{className:we.chip,"data-testid":`${n}-chip`,children:[i,t.jsx(p.Button,{isIconOnly:!0,variant:"light",color:"default",disableRipple:!0,className:we.chipRemove,"aria-label":s.removeEmail.replace("{email}",i),onPress:()=>a.onRemoveEmail(i),"data-testid":`${n}-remove`,children:t.jsx("span",{"aria-hidden":"true",className:"flex h-[0.9375rem] w-[0.9375rem]",children:t.jsx(p.Icon,{icon:"lucide:x",width:"100%",height:"100%"})})})]},i)),t.jsx(o.Input,{"aria-label":s.emailAriaLabel,placeholder:s.emailPlaceholder,type:"email",value:a.draft,onValueChange:a.onDraftChange,onKeyDown:i=>{i.key==="Enter"&&a.draft.trim()!==""&&(i.preventDefault(),a.onAddEmail(a.draft.trim()))},isInvalid:a.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 ${p.stillTransitionClass}`,input:"text-[0.8125rem] text-pos-ink placeholder:text-pos-muted group-data-[invalid=true]:text-pos-ink"},"data-testid":`${n}-input`})]}),t.jsx(p.Button,{color:"secondary",className:we.send,isDisabled:r,isLoading:a.isSending,onPress:a.onSend,"data-testid":`${n}-send`,children:s.sendEmail})]})}const Pe={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"},Rp="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",Ip="calc(100vw - 1.5rem)",po=({label:e,value:a,options:s,onChange:n,clearLabel:r,minWidth:i,"data-testid":c="filter-select"})=>{const l=a!==null,d=l?s.find(x=>x.value===a)?.label:void 0,u=h.useRef(null),f=h.useRef(null),[m,b]=h.useState();return t.jsxs("div",{ref:u,"data-testid":c,"data-slot":"filter-select","data-active":l?"true":void 0,title:d,className:o.cn(Pe.base,l&&Pe.baseActive),style:i===void 0?void 0:{"--filter-select-min":lt(i)},children:[t.jsx(p.Select,{"aria-label":e,placeholder:e,size:"sm",variant:"bordered",radius:"md",selectedKeys:a===null?[]:[a],onSelectionChange:x=>{if(x==="all")return;const g=[...x][0];n(g===void 0?null:String(g))},onOpenChange:x=>{x&&b(u.current?.getBoundingClientRect().width)},popoverProps:{ref:f,placement:"bottom-start",style:{minWidth:m,maxWidth:Ip}},"data-testid":`${c}-trigger`,classNames:{base:o.cn(Pe.select,Pe.cell),trigger:o.cn(Pe.trigger,l&&Pe.triggerActive),value:o.cn(Pe.value,l&&Pe.valueActive),selectorIcon:o.cn(l&&Pe.iconActive)},children:s.map(x=>t.jsx(o.SelectItem,{classNames:{title:Pe.optionTitle},children:x.label},x.value))}),t.jsx("span",{"aria-hidden":"true","data-testid":`${c}-sizer`,className:o.cn(Pe.sizer,l&&Pe.sizerActive,Pe.cell),children:d??e}),l&&t.jsx("button",{type:"button","aria-label":r,onClick:()=>{n(null),u.current?.querySelector('[data-slot="trigger"]')?.focus()},"data-testid":`${c}-clear`,className:Pe.clear,children:t.jsx(p.Icon,{icon:"lucide:x",className:Pe.clearIcon,"aria-hidden":"true"})})]})};po.displayName="FilterSelect";const ho=({children:e,className:a,"data-testid":s="filter-select-group"})=>t.jsx("div",{"data-testid":s,"data-slot":"filter-select-group",className:o.cn(Rp,a),style:{"--filter-select-count":h.Children.toArray(e).length},children:e});ho.displayName="FilterSelectGroup";const mt={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"},bo=({status:e,onLoadMore:a,loadingLabel:s,errorLabel:n,retryLabel:r,endLabel:i,"data-testid":c="load-more-footer"})=>{const l=h.useRef(null),d=h.useRef(a),u=h.useRef(!1);return h.useEffect(()=>{d.current=a},[a]),h.useEffect(()=>{if(e!=="idle"){u.current=!1;return}const f=l.current;if(!f||typeof IntersectionObserver>"u")return;const m=new IntersectionObserver(b=>{u.current||!b.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":c,"data-status":"idle",className:mt.idle,children:t.jsx("div",{ref:l,"aria-hidden":"true","data-testid":`${c}-sentinel`,className:mt.sentinel})}):e==="loading"?t.jsxs("div",{"data-testid":c,"data-status":"loading",role:"status","aria-live":"polite",className:mt.base,children:[t.jsx("span",{"aria-hidden":"true",className:mt.spinner,children:t.jsx(o.Spinner,{size:"sm",color:"default"})}),t.jsx("span",{"data-testid":`${c}-loading`,children:s})]}):e==="error"?t.jsxs("div",{"data-testid":c,"data-status":"error",className:mt.base,children:[t.jsx("span",{role:"alert","data-testid":`${c}-error`,className:mt.error,children:n}),t.jsx(p.Button,{size:"sm",color:"default",variant:"bordered",radius:"md",onPress:a,testId:`${c}-retry`,children:r})]}):t.jsx("div",{"data-testid":c,"data-status":"end",className:i?mt.base:mt.idle,children:i&&t.jsx("span",{"data-testid":`${c}-end`,children:i})})};bo.displayName="LoadMoreFooter";const ke={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 ${p.stillTransitionClass}`,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"},br=({item:e,withActions:a})=>t.jsxs(t.Fragment,{children:[t.jsxs("span",{className:o.cn(ke.headline,a&&ke.headlineWithActions),children:[t.jsx("span",{className:ke.title,children:e.title}),p.hasContent(e.amount)&&!a&&t.jsx("span",{className:ke.amount,children:e.amount})]}),a?(p.hasContent(e.chips)||p.hasContent(e.amount))&&t.jsxs("span",{className:ke.chipsLine,children:[p.hasContent(e.chips)&&t.jsx("span",{className:ke.chipsInline,children:e.chips}),p.hasContent(e.amount)&&t.jsx("span",{className:ke.amount,children:e.amount})]}):p.hasContent(e.chips)&&t.jsx("span",{className:ke.chips,children:e.chips}),e.rows&&e.rows.length>0&&t.jsx("span",{className:ke.rows,children:e.rows.map((s,n)=>t.jsxs("span",{className:ke.row,children:[t.jsx("span",{className:ke.rowLabel,children:s.label}),t.jsx("span",{className:ke.rowValue,children:s.value})]},n))})]}),go=({items:e,ariaLabel:a,onSelect:s,loading:n=!1,skeletonCount:r=6,"data-testid":i="card-list"})=>t.jsx("div",{"data-testid":i,className:ke.base,children:n?t.jsx("div",{role:"status","aria-busy":"true","aria-label":a,"data-testid":`${i}-skeleton`,children:t.jsx("div",{"aria-hidden":"true",children:Array.from({length:r},(c,l)=>t.jsxs("div",{"data-testid":`${i}-skeleton-row`,className:ke.skeletonRow,children:[t.jsx("div",{className:p.shimmerClass,style:{height:lt(13),width:lt(130)}}),t.jsx("div",{className:p.shimmerClass,style:{height:lt(11),width:"70%",marginTop:lt(10)}}),t.jsx("div",{className:p.shimmerClass,style:{height:lt(11),width:"45%",marginTop:lt(8)}})]},l))})}):t.jsx("ul",{"aria-label":a,className:ke.list,children:e.map(c=>{const l=p.hasContent(c.actions);return t.jsxs("li",{"data-testid":`${i}-item-${c.id}`,className:ke.item,children:[s?t.jsx("button",{type:"button",onClick:()=>s(c.id),className:o.cn(ke.card,ke.cardInteractive),children:t.jsx(br,{item:c,withActions:l})}):t.jsx("div",{className:ke.card,children:t.jsx(br,{item:c,withActions:l})}),l&&t.jsx("div",{"data-testid":`${i}-item-${c.id}-actions`,className:ke.actions,children:c.actions})]},c.id)})})});go.displayName="CardList";const Mp=48,re={base:`mb-4 overflow-hidden rounded-2xl border border-pos-line bg-white ${Fa}`,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 ${p.stillTransitionClass}`,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"},yo=h.forwardRef((e,a)=>t.jsx("li",{ref:a,...Object.fromEntries(Object.entries(e).filter(([s])=>s!=="data-testid"))}));yo.displayName="CrumbBase";const vo=({breadcrumb:e=[],onBack:a,backLabel:s,title:n,meta:r,amountLabel:i,amount:c,amountCaption:l,recordId:d,chips:u,statItems:f,stats:m,banner:b,"data-testid":x="record-header"})=>{const{ref:g,width:j}=Mt(),y=!aa(j,Mp),v=e.length>0||!!a,C=!!(f&&f.length>0),S=!!i||p.hasContent(c)||p.hasContent(l)||p.hasContent(d)||p.hasContent(u)||C;return t.jsxs("div",{ref:g,"data-testid":x,"data-size":y?"narrow":"wide",className:re.base,children:[v&&t.jsxs("div",{"data-testid":`${x}-band`,className:re.band,children:[a&&t.jsx("button",{type:"button",onClick:a,"aria-label":s,"data-testid":`${x}-back`,className:re.back,children:t.jsx(p.Icon,{icon:"lucide:chevron-left",className:re.backIcon,"aria-hidden":"true"})}),t.jsx(o.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((k,$)=>t.jsx(o.BreadcrumbItem,{as:yo,"data-testid":`${x}-crumb-${$}`,isDisabled:!k.onClick&&$<e.length-1,onPress:k.onClick?()=>k.onClick?.():void 0,children:k.label},$))})]}),t.jsxs("div",{className:o.cn(re.body,y?re.bodyNarrow:re.bodyWide),children:[t.jsxs("div",{className:re.identity,children:[t.jsx("h1",{"data-testid":`${x}-title`,className:o.cn(re.title,y?re.titleNarrow:re.titleWide),children:n}),r&&r.length>0&&t.jsx("ul",{"data-testid":`${x}-meta`,className:re.meta,children:r.map((k,$)=>t.jsxs("li",{className:re.metaLine,children:[k.icon!=null&&t.jsx("span",{"aria-hidden":"true",className:re.metaIcon,children:k.icon}),t.jsx("span",{className:re.metaText,children:k.text})]},$))})]}),S&&t.jsxs("div",{"data-testid":`${x}-money`,className:o.cn(re.money,y?re.moneyNarrow:re.moneyWide),children:[i&&t.jsx("div",{className:re.amountLabel,children:i}),p.hasContent(c)&&t.jsx("div",{"data-testid":`${x}-amount`,className:o.cn(re.amount,y?re.amountNarrow:re.amountWide),children:c}),p.hasContent(l)&&t.jsx("div",{className:re.amountCaption,children:l}),p.hasContent(d)&&t.jsx("div",{"data-testid":`${x}-record-id`,className:re.recordId,children:d}),p.hasContent(u)&&t.jsx("div",{"data-testid":`${x}-chips`,className:o.cn(re.chips,y?re.chipsNarrow:re.chipsWide),children:u}),C&&t.jsx("dl",{"data-testid":`${x}-stat-items`,className:re.statItems,children:f?.map((k,$)=>t.jsxs("div",{"data-testid":`${x}-stat-${$}`,className:o.cn(re.stat,y?re.statNarrow:re.statWide),children:[t.jsx("dt",{"data-testid":`${x}-stat-${$}-label`,className:re.statLabel,children:k.label}),t.jsx("dd",{"data-testid":`${x}-stat-${$}-value`,className:re.statValue,style:k.tone?{color:Ze[k.tone].fg}:void 0,children:k.value})]},k.id??$))})]})]}),p.hasContent(m)&&t.jsx("div",{"data-testid":`${x}-stats`,className:y?re.statsNarrow:re.statsWide,children:m}),p.hasContent(b)&&t.jsx("div",{"data-testid":`${x}-banner`,children:b})]})};vo.displayName="RecordHeader";const Bp=50,qt={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]"},jo=({children:e,aside:a,"data-testid":s="record-layout"})=>{const{ref:n,width:r}=Mt(),i=p.hasContent(a),c=i&&r>0&&aa(r,Bp),l=t.jsx("div",{"data-testid":`${s}-main`,className:qt.column,children:e},"main"),d=i?t.jsx("div",{"data-testid":`${s}-aside`,className:qt.aside,children:a},"aside"):null;return t.jsx("div",{ref:n,"data-testid":s,"data-layout":c?"split":"stacked",className:o.cn(qt.base,c?qt.split:qt.stacked),children:c?[l,d]:[d,l]})};jo.displayName="RecordLayout";const Pp=560,Gt={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"},wo=({items:e,"data-testid":a="stat-tiles"})=>{const{ref:s,width:n}=Mt(),r=n>=Wm?Math.max(e.length,1):n>=Pp?2:1;return t.jsx("div",{ref:s,"data-testid":a,"data-columns":r,className:Gt.base,style:{gridTemplateColumns:`repeat(${r}, minmax(0, 1fr))`},children:e.map((i,c)=>t.jsxs("div",{"data-testid":`${a}-item-${c}`,className:Gt.tile,children:[t.jsx("div",{"data-testid":`${a}-item-${c}-value`,className:Gt.value,style:i.tone?{color:Ze[i.tone].fg}:void 0,children:i.value}),t.jsx("div",{"data-testid":`${a}-item-${c}-label`,className:Gt.label,children:i.label}),p.hasContent(i.caption)&&t.jsx("div",{"data-testid":`${a}-item-${c}-caption`,className:Gt.caption,children:i.caption})]},c))})};wo.displayName="StatTiles";const it={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"},Tp={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]"}},rn="pill-tabs",ln=(e,a=rn)=>`${a}-tab-${e}`,on=(e,a=rn)=>`${a}-panel-${e}`,Op=(e,a=rn)=>({role:"tabpanel",id:on(e,a),"aria-labelledby":ln(e,a),tabIndex:0}),No=({items:e,value:a,onChange:s,ariaLabel:n,idPrefix:r,size:i="md","data-testid":c="pill-tabs"})=>{const l=p.useReducedMotion(),d=!!o.useProviderContext()?.disableAnimation,u=r??c,f=Tp[i];return t.jsx(o.Tabs,{"aria-label":n,variant:"solid",radius:"full",fullWidth:!0,disableAnimation:l||void 0,selectedKey:a,onSelectionChange:m=>s(String(m)),"data-testid":c,"data-size":i,classNames:{base:it.base,tabList:it.tabList,cursor:it.cursor,tab:o.cn(it.tab,f.tab,(l||d)&&it.tabStill),tabContent:o.cn(f.tabContent,it.tabContent)},children:e.map(m=>{const b=m["data-testid"]??`${c}-${m.key}`;return t.jsx(o.Tab,{id:ln(m.key,u),"aria-controls":on(m.key,u),"data-testid":b,title:t.jsxs("span",{className:o.cn(it.title,f.title),children:[p.hasContent(m.icon)&&t.jsx("span",{"aria-hidden":"true","data-testid":`${b}-icon`,className:o.cn(it.icon,f.icon),children:m.icon}),m.label,m.count!==void 0&&t.jsx("span",{"data-testid":`${b}-count`,className:o.cn(f.count,it.count),children:m.count})]})},m.key)})})};No.displayName="PillTabs";const je={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 ${p.stillTransitionClass}`,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"},gr=({row:e,testId:a})=>t.jsxs(t.Fragment,{children:[t.jsx("span",{"aria-hidden":"true",className:je.dot,style:{backgroundColor:Ze[e.tone].fg}}),t.jsxs("span",{className:je.body,children:[t.jsx("span",{className:je.title,children:e.title}),(e.reference!=null||e.timestamp!=null)&&t.jsxs("span",{className:je.meta,children:[e.reference!=null&&t.jsx("span",{className:je.reference,children:e.reference}),e.reference!=null&&e.timestamp!=null&&t.jsx("span",{"aria-hidden":"true",className:je.separator,children:"·"}),e.timestamp!=null&&t.jsx("span",{className:je.timestamp,children:e.timestamp})]}),e.detail!=null&&t.jsx("span",{className:je.detail,children:e.detail})]}),t.jsx("span",{className:je.trailing,children:e.amount!=null?t.jsx("span",{"data-testid":`${a}-amount`,className:je.amount,style:sa(e.amountTone),children:e.amount}):e.note!=null?t.jsx("span",{"data-testid":`${a}-note`,className:je.note,style:e.noteTone==="warn"?{color:Ze.warn.fg}:void 0,children:e.note}):null})]}),Co=({rows:e,footer:a,emptyContent:s,onSelect:n,"data-testid":r="amount-list"})=>e.length===0?t.jsx("div",{"data-testid":r,className:je.base,children:s!=null&&t.jsx("div",{"data-testid":`${r}-empty`,className:je.empty,children:s})}):t.jsxs("div",{"data-testid":r,className:je.base,children:[t.jsx("ul",{className:je.list,children:e.map(i=>{const c=`${r}-row-${i.id}`;return t.jsx("li",{"data-testid":c,className:je.item,children:n?t.jsx("button",{type:"button",onClick:()=>n(i.id),className:o.cn(je.row,je.rowInteractive),children:t.jsx(gr,{row:i,testId:c})}):t.jsx("div",{className:je.row,children:t.jsx(gr,{row:i,testId:c})})},i.id)})}),a&&t.jsxs(t.Fragment,{children:[t.jsxs("div",{"data-testid":`${r}-footer`,className:je.footer,children:[t.jsx("span",{className:je.footerLabel,children:a.label}),t.jsx("span",{"data-testid":`${r}-footer-amount`,className:je.footerAmount,style:sa(a.amountTone),children:a.amount})]}),a.note!=null&&t.jsx("div",{"data-testid":`${r}-footer-note`,className:je.footerNote,children:a.note})]})]});Co.displayName="AmountList";const qe={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"},ko=({events:e,emptyContent:a,"data-testid":s="activity-timeline"})=>e.length===0?t.jsx("div",{"data-testid":s,children:a!=null&&t.jsx("div",{"data-testid":`${s}-empty`,className:qe.empty,children:a})}):t.jsx("ol",{"data-testid":s,className:qe.list,children:e.map((n,r)=>{const i=r===e.length-1,c=`${s}-event-${n.id}`;return t.jsxs("li",{"data-testid":c,className:o.cn(qe.event,!i&&qe.eventSpaced),children:[t.jsxs("span",{"aria-hidden":"true",className:qe.rail,children:[t.jsx("span",{className:qe.dot,style:{backgroundColor:Ze[n.tone].fg}}),!i&&t.jsx("span",{"data-testid":`${c}-connector`,className:qe.connector})]}),t.jsxs("div",{className:qe.body,children:[t.jsxs("div",{className:qe.head,children:[t.jsx("span",{className:qe.title,children:n.title}),t.jsx("span",{className:qe.timestamp,children:n.timestamp})]}),p.hasContent(n.detail)&&t.jsx("div",{className:qe.detail,children:n.detail}),p.hasContent(n.actor)&&t.jsx("div",{"data-testid":`${c}-actor`,className:qe.actor,children:n.actor})]})]},n.id)})});ko.displayName="ActivityTimeline";const _e={base:`overflow-hidden rounded-2xl border border-pos-line bg-white ${Fa}`,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 ${p.stillTransitionClass}`,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"},yr=({row:e,testId:a})=>t.jsxs(t.Fragment,{children:[t.jsxs("span",{className:_e.rowBody,children:[t.jsxs("span",{className:_e.rowHead,children:[t.jsx("span",{className:e.onSelect?_e.primaryLinked:_e.primaryPlain,children:e.primary}),e.chip]}),!!e.secondary&&t.jsx("span",{className:_e.secondary,children:e.secondary})]}),!!e.amount&&t.jsx("span",{"data-testid":`${a}-amount`,className:_e.amount,style:sa(e.amountTone),children:e.amount})]}),So=({title:e,count:a,rows:s,emptyContent:n,"data-testid":r="related-record-list"})=>{const i=h.useId(),c=!!e;return t.jsxs("section",{"data-testid":r,role:c?"group":void 0,"aria-labelledby":c?i:void 0,className:_e.base,children:[c&&t.jsxs("div",{className:_e.header,children:[t.jsx("h3",{id:i,className:_e.title,children:e}),a!==void 0&&t.jsx("span",{"data-testid":`${r}-count`,className:_e.count,children:a})]}),s.length===0?!!n&&t.jsx("div",{"data-testid":`${r}-empty`,className:o.cn(_e.empty,!c&&_e.emptyHeadless),children:n}):t.jsx("ul",{className:_e.list,children:s.map((l,d)=>{const u=`${r}-row-${l.id}`;return t.jsx("li",{"data-testid":u,className:o.cn(_e.item,d===0&&!c&&_e.itemFirstHeadless),children:l.onSelect?t.jsx("button",{type:"button",onClick:l.onSelect,className:o.cn(_e.row,_e.rowInteractive),children:t.jsx(yr,{row:l,testId:u})}):t.jsx("div",{className:_e.row,children:t.jsx(yr,{row:l,testId:u})})},l.id)})})]})};So.displayName="RelatedRecordList";const $o=({title:e,titleAs:a="h2",icon:s,count:n,badge:r,action:i,description:c,footer:l,variant:d="section",body:u="padded",surface:f="card",className:m,children:b,"data-testid":x="record-card"})=>{const g=h.useId(),j=p.hasContent(e);return t.jsxs("section",{"data-testid":x,"data-variant":d,"data-surface":f,role:j?"group":void 0,"aria-labelledby":j?g:void 0,className:o.cn(rt.base,Ff[f],m),children:[j&&t.jsxs("div",{"data-testid":`${x}-header`,className:_f[d],children:[p.hasContent(s)&&t.jsx("span",{"aria-hidden":"true",className:rt.icon,children:s}),t.jsx(a,{id:g,className:rt.title,children:e}),p.hasContent(n)&&t.jsx("span",{"data-testid":`${x}-count`,className:rt.count,children:n}),r,p.hasContent(i)&&t.jsx("span",{"data-testid":`${x}-action`,className:rt.action,children:i})]}),t.jsxs("div",{"data-testid":`${x}-body`,className:Rf[d][u],children:[p.hasContent(c)&&t.jsx("p",{"data-testid":`${x}-description`,className:rt.description,children:c}),b,p.hasContent(l)&&t.jsx("div",{"data-testid":`${x}-footer`,className:o.cn(rt.footer,p.hasContent(b)?rt.footerAfterContent:rt.footerAfterDescription),children:l})]})]})};$o.displayName="RecordCard";const zp={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]"},Ao=({layout:e="stack",className:a,children:s,"data-testid":n="card-stack",...r})=>t.jsx("div",{...r,"data-testid":n,"data-layout":e,className:o.cn(zp[e],a),children:s});Ao.displayName="CardStack";const ma={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]"},Vp={regular:"py-[0.5625rem]",compact:"py-2"},Do=({rows:e,density:a="regular","data-testid":s="key-value-rows"})=>t.jsx("dl",{"data-testid":s,className:ma.list,children:e.map((n,r)=>t.jsxs("div",{"data-testid":`${s}-row-${n.id??r}`,className:o.cn(ma.row,Vp[a]),children:[t.jsx("dt",{className:ma.label,children:n.label}),t.jsx("dd",{className:ma.value,children:n.value})]},n.id??r))});Do.displayName="KeyValueRows";const Xe={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"},Eo=({items:e,ariaLabel:a,originalAmountLabel:s,"data-testid":n="line-item-rows"})=>t.jsx("ul",{"aria-label":a,"data-testid":n,className:Xe.list,children:e.map(r=>{const i=`${n}-item-${r.id}`,c=p.hasContent(r.originalAmount);return t.jsxs("li",{"data-testid":i,className:Xe.row,style:r.tone?{backgroundColor:Ze[r.tone].bg}:void 0,children:[t.jsxs("div",{className:Xe.body,children:[t.jsx("div",{className:Xe.name,children:r.name}),r.details&&r.details.length>0&&t.jsx("div",{"data-testid":`${i}-details`,className:Xe.details,children:r.details.map((l,d)=>t.jsxs(h.Fragment,{children:[d>0&&t.jsx("span",{"aria-hidden":"true",className:Xe.separator,children:"·"}),t.jsx("span",{className:Xe.detail,children:l})]},d))})]}),t.jsxs("div",{className:Xe.trailing,children:[t.jsxs("span",{className:Xe.amounts,children:[c&&t.jsxs("s",{"data-testid":`${i}-original`,className:Xe.original,children:[s&&t.jsxs("span",{className:"sr-only",children:[s," "]}),r.originalAmount]}),t.jsx("span",{"data-testid":`${i}-amount`,className:Xe.amount,style:c?{color:Ze.ok.fg}:void 0,children:r.amount})]}),r.chip]})]},r.id)})});Eo.displayName="LineItemRows";const Up=37.5,Ie={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"},Lo=({rows:e,total:a,memo:s,"data-testid":n="record-totals"})=>{const{ref:r,width:i}=Mt(),c=i>0&&!aa(i,Up),l=c?Ie.rowNarrow:Ie.rowWide,d=c?Ie.labelNarrow:Ie.labelWide,u=c?Ie.noteNarrow:Ie.noteWide;return t.jsxs("div",{ref:r,"data-testid":n,"data-size":c?"narrow":"wide",className:Ie.base,children:[e.map(f=>{const m=`${n}-row-${f.id}`;return t.jsxs("div",{"data-testid":m,className:o.cn(l,Ie.row),children:[t.jsx("span",{"data-testid":`${m}-label`,className:o.cn(d,Ie.label),children:f.label}),t.jsx("span",{"data-testid":`${m}-note`,className:o.cn(u,Ie.note),children:f.note}),t.jsx("span",{"data-testid":`${m}-value`,className:Ie.value,style:sa(f.tone),children:f.value})]},f.id)}),t.jsx("div",{className:Ie.totalRule,children:t.jsxs("div",{"data-testid":`${n}-total`,className:o.cn(l,Ie.totalRow),children:[t.jsx("span",{className:o.cn(d,Ie.totalLabel),children:a.label}),t.jsx("span",{"data-testid":`${n}-total-value`,className:Ie.totalValue,children:a.value})]})}),p.hasContent(s)&&t.jsx("div",{"data-testid":`${n}-memo`,className:Ie.memo,children:s})]})};Lo.displayName="RecordTotals";const gs={base:"whitespace-nowrap text-[0.875rem]",secondary:"text-default-500",chipStack:"inline-flex flex-col items-start gap-[0.3125rem]"},Hp={text:"text-default-900",reference:"font-normal text-primary",amount:"font-semibold tabular-nums text-default-900"},Fo=({variant:e="text",tone:a,secondary:s,children:n,"data-testid":r="cell-text"})=>t.jsxs("span",{"data-testid":r,className:o.cn(gs.base,Hp[e]),style:sa(a),children:[n,p.hasContent(s)&&t.jsxs("span",{"data-testid":`${r}-secondary`,className:gs.secondary,children:[t.jsx("span",{"aria-hidden":"true",children:" · "}),s]})]});Fo.displayName="CellText";const _o=({children:e,"data-testid":a="chip-stack"})=>t.jsx("span",{"data-testid":a,className:gs.chipStack,children:e});_o.displayName="ChipStack";function Ro({testId:e,title:a,description:s}){return t.jsx(o.Card,{shadow:"sm",className:"min-h-52 rounded-2xl shadow-none","data-testid":e,children:t.jsxs(o.CardBody,{className:"flex flex-col gap-2 p-4 text-sm",role:"alert",children:[t.jsx("span",{className:"font-semibold text-gray-900",children:a}),t.jsx("p",{className:"text-default-600 leading-snug",children:s})]})})}Ro.displayName="SessionExpiredCard";const Wp={sm:"size-6 min-w-6",md:"size-[30px] min-w-[30px]"},gt={trigger:"text-default-600",menuWithDescriptions:"max-w-xs",itemDescription:"whitespace-normal text-default-600",itemDisabledWithDescription:"opacity-100",itemDimmed:"opacity-disabled",itemDimmedIcon:"flex shrink-0 opacity-disabled",dangerItem:"text-danger"},qp=()=>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"})]}),Io=({actions:e,label:a,icon:s,size:n="md",isDisabled:r=!1,className:i,"data-testid":c="actions-menu"})=>{const l=h.useId(),d=e.some(f=>p.hasContent(f.description)),u=e.filter(f=>f.isDisabled===!0&&p.hasContent(f.description)).map(f=>`${f.label}: ${f.description}`).join(" ");return e.length===0?null:t.jsxs(t.Fragment,{children:[t.jsxs(o.Dropdown,{placement:"bottom-end",children:[t.jsx(o.DropdownTrigger,{children:t.jsx(p.Button,{isIconOnly:!0,size:n,variant:"light",color:"default",radius:"full",isDisabled:r,"aria-label":a,"aria-describedby":u===""?void 0:l,testId:`${c}-trigger`,className:o.cn(gt.trigger,Wp[n],i),children:s??t.jsx(qp,{})})}),t.jsx(o.DropdownMenu,{"aria-label":a,"data-testid":c,className:d?gt.menuWithDescriptions:void 0,disabledKeys:e.filter(f=>f.isDisabled).map(f=>f.key),onAction:f=>{e.find(m=>m.key===f)?.onAction()},items:e,children:f=>{const m=f.isDisabled===!0&&p.hasContent(f.description);return t.jsx(o.DropdownItem,{textValue:f.label,description:f.description,color:f.tone==="danger"?"danger":"default",className:o.cn(f.tone==="danger"&>.dangerItem,m&>.itemDisabledWithDescription),classNames:{title:m?gt.itemDimmed:void 0,description:gt.itemDescription},startContent:m&&f.icon!==void 0?t.jsx("span",{className:gt.itemDimmedIcon,children:f.icon}):f.icon,"data-testid":f["data-testid"]??`${c}-${f.key}`,children:f.label},f.key)}})]}),u!==""&&t.jsx("span",{id:l,hidden:!0,"data-testid":`${c}-trigger-description`,children:u})]})};Io.displayName="ActionsMenu";exports.Button=p.Button;exports.Drawer=p.Drawer;exports.Modal=p.Modal;exports.Select=p.Select;exports.Skeleton=p.Skeleton;exports.Table=p.Table;exports.ActionsMenu=Io;exports.ActivityTimeline=ko;exports.AdminFieldLabel=Gs;exports.AdminTable=Wi;exports.AdminTextField=dl;exports.AdminToolbar=Ki;exports.AmountList=Co;exports.AppliedCodeCard=Cr;exports.CardList=go;exports.CardStack=Ao;exports.CashTenderForm=Vf;exports.CatalogItemCard=Fi;exports.CellText=Fo;exports.CheckTenderForm=Sl;exports.ChipStack=_o;exports.CommitmentDetails=Lu;exports.ConfirmDialog=Qs;exports.ConfirmationModal=Is;exports.ConfirmationPageTemplate=Kc;exports.CustomerCard=to;exports.DATE_PICKER_DAY_DEFAULTS=Mc;exports.DatePicker=ks;exports.DensityProvider=gc;exports.DimensionChip=La;exports.DiscardGuard=Pl;exports.DonationAmounts=si;exports.EmptyState=Ms;exports.EntityList=gl;exports.EntityListSkeleton=yl;exports.EntityRow=bl;exports.ErrorState=Bs;exports.EventDetails=Bd;exports.EventDetailsTemplate=Zc;exports.ExpandableTable=qi;exports.ExpireCartTimer=ni;exports.FeedbackState=ta;exports.FilterPopover=Pi;exports.FilterSelect=po;exports.FilterSelectGroup=ho;exports.Footer=nd;exports.HeroUIProvider=fc;exports.HorizontalSteps=Kr;exports.InlineConfirm=Ml;exports.InstallmentFundAssignment=Su;exports.InstallmentFundAssignmentSkeleton=Du;exports.InstallmentSchedule=Zu;exports.InstallmentScheduleSkeleton=nm;exports.InstallmentTable=om;exports.ItemCard=Li;exports.KeyValueChip=La;exports.KeyValueRows=Do;exports.LineItemList=Zl;exports.LineItemRows=Eo;exports.ListPanel=wl;exports.LoadMoreFooter=bo;exports.LoadingOverlay=Rl;exports.LoadingState=Ps;exports.MembershipSelectCards=fm;exports.MetaCard=Xx;exports.ModalPanelHeader=Tl;exports.ModalPanels=kx;exports.ModalShell=Dl;exports.ModalShellFooter=Ll;exports.ModalShellHeader=El;exports.Multiselect=rd;exports.Navbar=Gc;exports.NeedsFixDot=Ws;exports.NotesField=so;exports.Notice=sn;exports.OfferCard=ba;exports.OfferCardEmpty=ri;exports.OfferCardError=ii;exports.OfferCardList=di;exports.OfferCardSkeleton=li;exports.OtherTenderForm=$l;exports.OutcomeView=xo;exports.PageHeader=zi;exports.PaginationSummary=jl;exports.PaymentCashChangeBanner=Ys;exports.PaymentSubAmountInput=Zs;exports.PaymentSuccessView=Il;exports.PaymentTotalBanner=_l;exports.PickerRow=fl;exports.PillTabs=No;exports.PinField=fo;exports.ProgramListItem=_i;exports.RICH_TEXT_PRESETS=ti;exports.ReasonSelect=ao;exports.RecordCard=$o;exports.RecordHeader=vo;exports.RecordLayout=jo;exports.RecordTotals=Lo;exports.RedeemCodeInput=Uc;exports.RefundMethodCards=co;exports.RefundProgressList=mo;exports.RelatedRecordList=So;exports.RevenueDistributionCard=wi;exports.RevenueDistributionEmpty=Ni;exports.RevenueDistributionError=Ci;exports.RevenueDistributionSkeleton=ki;exports.RichTextArea=ai;exports.RowActions=Hs;exports.SectionPanel=eo;exports.SessionExpiredCard=Ro;exports.SessionTimeline=Ti;exports.SplitPaymentSummary=Al;exports.SplitTenderPanel=ro;exports.StatTiles=wo;exports.StatusChip=Vi;exports.StepPager=Xr;exports.StepProgress=an;exports.Stepper=Gr;exports.StepsReadiness=Qr;exports.SuccessState=Ii;exports.Summary=Kl;exports.TableSkeleton=Ui;exports.TenderMethods=no;exports.TicketSelection=Bm;exports.TileSelect=Fl;exports.TimeField=ml;exports.ToastProvider=hc;exports.Toggle=Mi;exports.ToolbarButton=Yi;exports.UnderlineTabs=Zi;exports.VerticalSteps=Zr;exports.WizardShell=Yl;exports.adminFieldErrorClass=ol;exports.adminFieldHelpButtonClass=tl;exports.adminFieldHelpContentClass=sl;exports.adminFieldHelpIconClass=al;exports.adminFieldHintClass=ll;exports.adminFieldLabelClass=qs;exports.adminFieldLabelNoAutoMarkClass=el;exports.adminFieldLabelRowClass=Ji;exports.adminFieldLabelSuffixClass=Qi;exports.adminFieldRequiredClass=Xi;exports.adminInputClass=rl;exports.adminInputReadOnlyClass=il;exports.adminInputWrapperClass=nl;exports.adminRowClass=Vs;exports.adminSurfaceCss=mc;exports.adminSurfaceTokens=Jt;exports.adminTableClass=Us;exports.adminTableFooterClass=Hi;exports.adminTdClass=zs;exports.adminThClass=Os;exports.assistantSurfaceTokens=vs;exports.calculateAllocationDifference=pu;exports.computeChange=ls;exports.currencyFractionDigits=It;exports.firstNeedsFixKey=cf;exports.formatMoney=fe;exports.formatOfferCurrency=cs;exports.formatRevenueAmount=uu;exports.formatRevenueCurrency=mu;exports.generateAutomaticInstallments=Ai;exports.generateDistributionId=Rs;exports.getCurrencySymbol=fu;exports.offerCardVariants=ci;exports.offerListVariants=oi;exports.pageRange=vl;exports.parseOfferCurrency=Pd;exports.parseRevenueCurrency=xu;exports.parseTimeInput=ps;exports.pillTabId=ln;exports.pillTabPanelId=on;exports.pillTabPanelProps=Op;exports.posSurfaceTokens=le;exports.roundToCurrency=Ss;exports.useControlSize=bc;exports.useDensity=Sa;exports.useDiscardGuard=Ax;exports.useDiscardGuardActions=fx;exports.useModalPanel=px;exports.useModalPanels=$x;exports.useReportUnsavedChanges=mx;Object.keys(o).forEach(e=>{e!=="default"&&!Object.prototype.hasOwnProperty.call(exports,e)&&Object.defineProperty(exports,e,{enumerable:!0,get:()=>o[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)}})();
|