@veevarts/design-system 2.9.0 → 2.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +3 -3
- package/dist/index.js +461 -461
- package/dist/patterns/RecordHeader/types.d.ts +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
color: var(--ink);`:"";return`${e} {
|
|
5
5
|
${a}${n}
|
|
6
6
|
}
|
|
7
|
-
`}const je={line:"#E7E7E9","line-2":"#F1F1F3",hair:"#F0F0F1",page:"#FBFBFB",field:"#E5E5E5","ok-fill":"#EAF3DE",ok:"#3B6D11","warn-fill":"#FAEEDA",warn:"#854F0B","warn-icon":"#EFD9B2","danger-fill":"#FCEBEB",danger:we.semantic.danger,"danger-icon":"#F3D3CF","info-fill":"#EAF1FC",info:"#1D4FA8","violet-fill":"#F1ECFB",violet:"#6D28D9","neutral-fill":"#F4F4F5",neutral:"#52525B",destructive:"#A32D2D"};({...je});function ho({children:e}){return t.jsx(c.HeroUIProvider,{children:e})}function po(e,s){const a=e.icons,n=e.aliases||Object.create(null),r=Object.create(null);function i(l){if(a[l])return r[l]=[];if(!(l in r)){r[l]=null;const o=n[l]&&n[l].parent,d=o&&i(o);d&&(r[l]=[o].concat(d))}return r[l]}return Object.keys(a).concat(Object.keys(n)).forEach(i),r}const zn=Object.freeze({left:0,top:0,width:16,height:16}),Xt=Object.freeze({rotate:0,vFlip:!1,hFlip:!1}),aa=Object.freeze({...zn,...Xt}),Ps=Object.freeze({...aa,body:"",hidden:!1});function go(e,s){const a={};!e.hFlip!=!s.hFlip&&(a.hFlip=!0),!e.vFlip!=!s.vFlip&&(a.vFlip=!0);const n=((e.rotate||0)+(s.rotate||0))%4;return n&&(a.rotate=n),a}function za(e,s){const a=go(e,s);for(const n in Ps)n in Xt?n in e&&!(n in a)&&(a[n]=Xt[n]):n in s?a[n]=s[n]:n in e&&(a[n]=e[n]);return a}function bo(e,s,a){const n=e.icons,r=e.aliases||Object.create(null);let i={};function l(o){i=za(n[o]||r[o],i)}return l(s),a.forEach(l),za(e,i)}function Bn(e,s){const a=[];if(typeof e!="object"||typeof e.icons!="object")return a;e.not_found instanceof Array&&e.not_found.forEach(r=>{s(r,null),a.push(r)});const n=po(e);for(const r in n){const i=n[r];i&&(s(r,bo(e,r,i)),a.push(r))}return a}const yo={provider:"",aliases:{},not_found:{},...zn};function ps(e,s){for(const a in s)if(a in e&&typeof e[a]!=typeof s[a])return!1;return!0}function Vn(e){if(typeof e!="object"||e===null)return null;const s=e;if(typeof s.prefix!="string"||!e.icons||typeof e.icons!="object"||!ps(e,yo))return null;const a=s.icons;for(const r in a){const i=a[r];if(!r||typeof i.body!="string"||!ps(i,Ps))return null}const n=s.aliases||Object.create(null);for(const r in n){const i=n[r],l=i.parent;if(!r||typeof l!="string"||!a[l]&&!n[l]||!ps(i,Ps))return null}return s}const Ba=Object.create(null);function vo(e,s){return{provider:e,prefix:s,icons:Object.create(null),missing:new Set}}function bt(e,s){const a=Ba[e]||(Ba[e]=Object.create(null));return a[s]||(a[s]=vo(e,s))}function Un(e,s){return Vn(s)?Bn(s,(a,n)=>{n?e.icons[a]=n:e.missing.add(a)}):[]}function jo(e,s,a){try{if(typeof a.body=="string")return e.icons[s]={...a},!0}catch{}return!1}const Hn=/^[a-z0-9]+(-[a-z0-9]+)*$/,ls=(e,s,a,n="")=>{const r=e.split(":");if(e.slice(0,1)==="@"){if(r.length<2||r.length>3)return null;n=r.shift().slice(1)}if(r.length>3||!r.length)return null;if(r.length>1){const o=r.pop(),d=r.pop(),u={provider:r.length>0?r[0]:n,prefix:d,name:o};return s&&!Yt(u)?null:u}const i=r[0],l=i.split("-");if(l.length>1){const o={provider:n,prefix:l.shift(),name:l.join("-")};return s&&!Yt(o)?null:o}if(a&&n===""){const o={provider:n,prefix:"",name:i};return s&&!Yt(o,a)?null:o}return null},Yt=(e,s)=>e?!!((s&&e.prefix===""||e.prefix)&&e.name):!1;let Lt=!1;function qn(e){return typeof e=="boolean"&&(Lt=e),Lt}function Va(e){const s=typeof e=="string"?ls(e,!0,Lt):e;if(s){const a=bt(s.provider,s.prefix),n=s.name;return a.icons[n]||(a.missing.has(n)?null:void 0)}}function wo(e,s){const a=ls(e,!0,Lt);if(!a)return!1;const n=bt(a.provider,a.prefix);return s?jo(n,a.name,s):(n.missing.add(a.name),!0)}function No(e,s){if(typeof e!="object")return!1;if(typeof s!="string"&&(s=e.provider||""),Lt&&!s&&!e.prefix){let r=!1;return Vn(e)&&(e.prefix="",Bn(e,(i,l)=>{wo(i,l)&&(r=!0)})),r}const a=e.prefix;if(!Yt({prefix:a,name:"a"}))return!1;const n=bt(s,a);return!!Un(n,e)}const Wn=Object.freeze({width:null,height:null}),Yn=Object.freeze({...Wn,...Xt}),Co=/(-?[0-9.]*[0-9]+[0-9.]*)/g,ko=/^-?[0-9.]*[0-9]+[0-9.]*$/g;function Ua(e,s,a){if(s===1)return e;if(a=a||100,typeof e=="number")return Math.ceil(e*s*a)/a;if(typeof e!="string")return e;const n=e.split(Co);if(n===null||!n.length)return e;const r=[];let i=n.shift(),l=ko.test(i);for(;;){if(l){const o=parseFloat(i);isNaN(o)?r.push(i):r.push(Math.ceil(o*s*a)/a)}else r.push(i);if(i=n.shift(),i===void 0)return r.join("");l=!l}}function So(e,s="defs"){let a="";const n=e.indexOf("<"+s);for(;n>=0;){const r=e.indexOf(">",n),i=e.indexOf("</"+s);if(r===-1||i===-1)break;const l=e.indexOf(">",i);if(l===-1)break;a+=e.slice(r+1,i).trim(),e=e.slice(0,n).trim()+e.slice(l+1)}return{defs:a,content:e}}function $o(e,s){return e?"<defs>"+e+"</defs>"+s:s}function Ao(e,s,a){const n=So(e);return $o(n.defs,s+n.content+a)}const Do=e=>e==="unset"||e==="undefined"||e==="none";function Eo(e,s){const a={...aa,...e},n={...Yn,...s},r={left:a.left,top:a.top,width:a.width,height:a.height};let i=a.body;[a,n].forEach(j=>{const b=[],w=j.hFlip,N=j.vFlip;let $=j.rotate;w?N?$+=2:(b.push("translate("+(r.width+r.left).toString()+" "+(0-r.top).toString()+")"),b.push("scale(-1 1)"),r.top=r.left=0):N&&(b.push("translate("+(0-r.left).toString()+" "+(r.height+r.top).toString()+")"),b.push("scale(1 -1)"),r.top=r.left=0);let v;switch($<0&&($-=Math.floor($/4)*4),$=$%4,$){case 1:v=r.height/2+r.top,b.unshift("rotate(90 "+v.toString()+" "+v.toString()+")");break;case 2:b.unshift("rotate(180 "+(r.width/2+r.left).toString()+" "+(r.height/2+r.top).toString()+")");break;case 3:v=r.width/2+r.left,b.unshift("rotate(-90 "+v.toString()+" "+v.toString()+")");break}$%2===1&&(r.left!==r.top&&(v=r.left,r.left=r.top,r.top=v),r.width!==r.height&&(v=r.width,r.width=r.height,r.height=v)),b.length&&(i=Ao(i,'<g transform="'+b.join(" ")+'">',"</g>"))});const l=n.width,o=n.height,d=r.width,u=r.height;let f,m;l===null?(m=o===null?"1em":o==="auto"?u:o,f=Ua(m,d/u)):(f=l==="auto"?d:l,m=o===null?Ua(f,u/d):o==="auto"?u:o);const h={},x=(j,b)=>{Do(b)||(h[j]=b.toString())};x("width",f),x("height",m);const g=[r.left,r.top,d,u];return h.viewBox=g.join(" "),{attributes:h,viewBox:g,body:i}}const Fo=/\sid="(\S+)"/g,Lo="IconifyId"+Date.now().toString(16)+(Math.random()*16777216|0).toString(16);let Mo=0;function _o(e,s=Lo){const a=[];let n;for(;n=Fo.exec(e);)a.push(n[1]);if(!a.length)return e;const r="suffix"+(Math.random()*16777216|Date.now()).toString(16);return a.forEach(i=>{const l=typeof s=="function"?s(i):s+(Mo++).toString(),o=i.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");e=e.replace(new RegExp('([#;"])('+o+')([")]|\\.[a-z])',"g"),"$1"+l+r+"$3")}),e=e.replace(new RegExp(r,"g"),""),e}const Os=Object.create(null);function Ro(e,s){Os[e]=s}function zs(e){return Os[e]||Os[""]}function na(e){let s;if(typeof e.resources=="string")s=[e.resources];else if(s=e.resources,!(s instanceof Array)||!s.length)return null;return{resources:s,path:e.path||"/",maxURL:e.maxURL||500,rotate:e.rotate||750,timeout:e.timeout||5e3,random:e.random===!0,index:e.index||0,dataAfterTimeout:e.dataAfterTimeout!==!1}}const ra=Object.create(null),wt=["https://api.simplesvg.com","https://api.unisvg.com"],Gt=[];for(;wt.length>0;)wt.length===1||Math.random()>.5?Gt.push(wt.shift()):Gt.push(wt.pop());ra[""]=na({resources:["https://api.iconify.design"].concat(Gt)});function To(e,s){const a=na(s);return a===null?!1:(ra[e]=a,!0)}function ia(e){return ra[e]}const Io=()=>{let e;try{if(e=fetch,typeof e=="function")return e}catch{}};let Ha=Io();function Po(e,s){const a=ia(e);if(!a)return 0;let n;if(!a.maxURL)n=0;else{let r=0;a.resources.forEach(l=>{r=Math.max(r,l.length)});const i=s+".json?icons=";n=a.maxURL-r-a.path.length-i.length}return n}function Oo(e){return e===404}const zo=(e,s,a)=>{const n=[],r=Po(e,s),i="icons";let l={type:i,provider:e,prefix:s,icons:[]},o=0;return a.forEach((d,u)=>{o+=d.length+1,o>=r&&u>0&&(n.push(l),l={type:i,provider:e,prefix:s,icons:[]},o=d.length),l.icons.push(d)}),n.push(l),n};function Bo(e){if(typeof e=="string"){const s=ia(e);if(s)return s.path}return"/"}const Vo=(e,s,a)=>{if(!Ha){a("abort",424);return}let n=Bo(s.provider);switch(s.type){case"icons":{const i=s.prefix,o=s.icons.join(","),d=new URLSearchParams({icons:o});n+=i+".json?"+d.toString();break}case"custom":{const i=s.uri;n+=i.slice(0,1)==="/"?i.slice(1):i;break}default:a("abort",400);return}let r=503;Ha(e+n).then(i=>{const l=i.status;if(l!==200){setTimeout(()=>{a(Oo(l)?"abort":"next",l)});return}return r=501,i.json()}).then(i=>{if(typeof i!="object"||i===null){setTimeout(()=>{i===404?a("abort",i):a("next",r)});return}setTimeout(()=>{a("success",i)})}).catch(()=>{a("next",r)})},Uo={prepare:zo,send:Vo};function Gn(e,s){e.forEach(a=>{const n=a.loaderCallbacks;n&&(a.loaderCallbacks=n.filter(r=>r.id!==s))})}function Ho(e){e.pendingCallbacksFlag||(e.pendingCallbacksFlag=!0,setTimeout(()=>{e.pendingCallbacksFlag=!1;const s=e.loaderCallbacks?e.loaderCallbacks.slice(0):[];if(!s.length)return;let a=!1;const n=e.provider,r=e.prefix;s.forEach(i=>{const l=i.icons,o=l.pending.length;l.pending=l.pending.filter(d=>{if(d.prefix!==r)return!0;const u=d.name;if(e.icons[u])l.loaded.push({provider:n,prefix:r,name:u});else if(e.missing.has(u))l.missing.push({provider:n,prefix:r,name:u});else return a=!0,!0;return!1}),l.pending.length!==o&&(a||Gn([e],i.id),i.callback(l.loaded.slice(0),l.missing.slice(0),l.pending.slice(0),i.abort))})}))}let qo=0;function Wo(e,s,a){const n=qo++,r=Gn.bind(null,a,n);if(!s.pending.length)return r;const i={id:n,icons:s,callback:e,abort:r};return a.forEach(l=>{(l.loaderCallbacks||(l.loaderCallbacks=[])).push(i)}),r}function Yo(e){const s={loaded:[],missing:[],pending:[]},a=Object.create(null);e.sort((r,i)=>r.provider!==i.provider?r.provider.localeCompare(i.provider):r.prefix!==i.prefix?r.prefix.localeCompare(i.prefix):r.name.localeCompare(i.name));let n={provider:"",prefix:"",name:""};return e.forEach(r=>{if(n.name===r.name&&n.prefix===r.prefix&&n.provider===r.provider)return;n=r;const i=r.provider,l=r.prefix,o=r.name,d=a[i]||(a[i]=Object.create(null)),u=d[l]||(d[l]=bt(i,l));let f;o in u.icons?f=s.loaded:l===""||u.missing.has(o)?f=s.missing:f=s.pending;const m={provider:i,prefix:l,name:o};f.push(m)}),s}function Go(e,s=!0,a=!1){const n=[];return e.forEach(r=>{const i=typeof r=="string"?ls(r,s,a):r;i&&n.push(i)}),n}const Ko={resources:[],index:0,timeout:2e3,rotate:750,random:!1,dataAfterTimeout:!1};function Qo(e,s,a,n){const r=e.resources.length,i=e.random?Math.floor(Math.random()*r):e.index;let l;if(e.random){let M=e.resources.slice(0);for(l=[];M.length>1;){const k=Math.floor(Math.random()*M.length);l.push(M[k]),M=M.slice(0,k).concat(M.slice(k+1))}l=l.concat(M)}else l=e.resources.slice(i).concat(e.resources.slice(0,i));const o=Date.now();let d="pending",u=0,f,m=null,h=[],x=[];typeof n=="function"&&x.push(n);function g(){m&&(clearTimeout(m),m=null)}function j(){d==="pending"&&(d="aborted"),g(),h.forEach(M=>{M.status==="pending"&&(M.status="aborted")}),h=[]}function b(M,k){k&&(x=[]),typeof M=="function"&&x.push(M)}function w(){return{startTime:o,payload:s,status:d,queriesSent:u,queriesPending:h.length,subscribe:b,abort:j}}function N(){d="failed",x.forEach(M=>{M(void 0,f)})}function $(){h.forEach(M=>{M.status==="pending"&&(M.status="aborted")}),h=[]}function v(M,k,F){const C=k!=="success";switch(h=h.filter(_=>_!==M),d){case"pending":break;case"failed":if(C||!e.dataAfterTimeout)return;break;default:return}if(k==="abort"){f=F,N();return}if(C){f=F,h.length||(l.length?A():N());return}if(g(),$(),!e.random){const _=e.resources.indexOf(M.resource);_!==-1&&_!==e.index&&(e.index=_)}d="completed",x.forEach(_=>{_(F)})}function A(){if(d!=="pending")return;g();const M=l.shift();if(M===void 0){if(h.length){m=setTimeout(()=>{g(),d==="pending"&&($(),N())},e.timeout);return}N();return}const k={status:"pending",resource:M,callback:(F,C)=>{v(k,F,C)}};h.push(k),u++,m=setTimeout(A,e.rotate),a(M,s,k.callback)}return setTimeout(A),w}function Kn(e){const s={...Ko,...e};let a=[];function n(){a=a.filter(o=>o().status==="pending")}function r(o,d,u){const f=Qo(s,o,d,(m,h)=>{n(),u&&u(m,h)});return a.push(f),f}function i(o){return a.find(d=>o(d))||null}return{query:r,find:i,setIndex:o=>{s.index=o},getIndex:()=>s.index,cleanup:n}}function qa(){}const gs=Object.create(null);function Zo(e){if(!gs[e]){const s=ia(e);if(!s)return;const a=Kn(s),n={config:s,redundancy:a};gs[e]=n}return gs[e]}function Xo(e,s,a){let n,r;if(typeof e=="string"){const i=zs(e);if(!i)return a(void 0,424),qa;r=i.send;const l=Zo(e);l&&(n=l.redundancy)}else{const i=na(e);if(i){n=Kn(i);const l=e.resources?e.resources[0]:"",o=zs(l);o&&(r=o.send)}}return!n||!r?(a(void 0,424),qa):n.query(s,r,a)().abort}function Wa(){}function Jo(e){e.iconsLoaderFlag||(e.iconsLoaderFlag=!0,setTimeout(()=>{e.iconsLoaderFlag=!1,Ho(e)}))}function ec(e){const s=[],a=[];return e.forEach(n=>{(n.match(Hn)?s:a).push(n)}),{valid:s,invalid:a}}function Nt(e,s,a){function n(){const r=e.pendingIcons;s.forEach(i=>{r&&r.delete(i),e.icons[i]||e.missing.add(i)})}if(a&&typeof a=="object")try{if(!Un(e,a).length){n();return}}catch(r){console.error(r)}n(),Jo(e)}function Ya(e,s){e instanceof Promise?e.then(a=>{s(a)}).catch(()=>{s(null)}):s(e)}function tc(e,s){e.iconsToLoad?e.iconsToLoad=e.iconsToLoad.concat(s).sort():e.iconsToLoad=s,e.iconsQueueFlag||(e.iconsQueueFlag=!0,setTimeout(()=>{e.iconsQueueFlag=!1;const{provider:a,prefix:n}=e,r=e.iconsToLoad;if(delete e.iconsToLoad,!r||!r.length)return;const i=e.loadIcon;if(e.loadIcons&&(r.length>1||!i)){Ya(e.loadIcons(r,n,a),f=>{Nt(e,r,f)});return}if(i){r.forEach(f=>{const m=i(f,n,a);Ya(m,h=>{const x=h?{prefix:n,icons:{[f]:h}}:null;Nt(e,[f],x)})});return}const{valid:l,invalid:o}=ec(r);if(o.length&&Nt(e,o,null),!l.length)return;const d=n.match(Hn)?zs(a):null;if(!d){Nt(e,l,null);return}d.prepare(a,n,l).forEach(f=>{Xo(a,f,m=>{Nt(e,f.icons,m)})})}))}const sc=(e,s)=>{const a=Go(e,!0,qn()),n=Yo(a);if(!n.pending.length){let d=!0;return s&&setTimeout(()=>{d&&s(n.loaded,n.missing,n.pending,Wa)}),()=>{d=!1}}const r=Object.create(null),i=[];let l,o;return n.pending.forEach(d=>{const{provider:u,prefix:f}=d;if(f===o&&u===l)return;l=u,o=f,i.push(bt(u,f));const m=r[u]||(r[u]=Object.create(null));m[f]||(m[f]=[])}),n.pending.forEach(d=>{const{provider:u,prefix:f,name:m}=d,h=bt(u,f),x=h.pendingIcons||(h.pendingIcons=new Set);x.has(m)||(x.add(m),r[u][f].push(m))}),i.forEach(d=>{const u=r[d.provider][d.prefix];u.length&&tc(d,u)}),s?Wo(s,n,i):Wa};function ac(e,s){const a={...e};for(const n in s){const r=s[n],i=typeof r;n in Wn?(r===null||r&&(i==="string"||i==="number"))&&(a[n]=r):i===typeof a[n]&&(a[n]=n==="rotate"?r%4:r)}return a}const nc=/[\s,]+/;function rc(e,s){s.split(nc).forEach(a=>{switch(a.trim()){case"horizontal":e.hFlip=!0;break;case"vertical":e.vFlip=!0;break}})}function ic(e,s=0){const a=e.replace(/^-?[0-9.]*/,"");function n(r){for(;r<0;)r+=4;return r%4}if(a===""){const r=parseInt(e);return isNaN(r)?0:n(r)}else if(a!==e){let r=0;switch(a){case"%":r=25;break;case"deg":r=90}if(r){let i=parseFloat(e.slice(0,e.length-a.length));return isNaN(i)?0:(i=i/r,i%1===0?n(i):0)}}return s}function lc(e,s){let a=e.indexOf("xlink:")===-1?"":' xmlns:xlink="http://www.w3.org/1999/xlink"';for(const n in s)a+=" "+n+'="'+s[n]+'"';return'<svg xmlns="http://www.w3.org/2000/svg"'+a+">"+e+"</svg>"}function oc(e){return e.replace(/"/g,"'").replace(/%/g,"%25").replace(/#/g,"%23").replace(/</g,"%3C").replace(/>/g,"%3E").replace(/\s+/g," ")}function cc(e){return"data:image/svg+xml,"+oc(e)}function dc(e){return'url("'+cc(e)+'")'}let Dt;function uc(){try{Dt=window.trustedTypes.createPolicy("iconify",{createHTML:e=>e})}catch{Dt=null}}function mc(e){return Dt===void 0&&uc(),Dt?Dt.createHTML(e):e}const Qn={...Yn,inline:!1},fc={xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink","aria-hidden":!0,role:"img"},xc={display:"inline-block"},Bs={backgroundColor:"currentColor"},Zn={backgroundColor:"transparent"},Ga={Image:"var(--svg)",Repeat:"no-repeat",Size:"100% 100%"},Ka={WebkitMask:Bs,mask:Bs,background:Zn};for(const e in Ka){const s=Ka[e];for(const a in Ga)s[e+a]=Ga[a]}const hc={...Qn,inline:!0};function Qa(e){return e+(e.match(/^[-0-9.]+$/)?"px":"")}const pc=(e,s,a)=>{const n=s.inline?hc:Qn,r=ac(n,s),i=s.mode||"svg",l={},o=s.style||{},d={...i==="svg"?fc:{}};if(a){const b=ls(a,!1,!0);if(b){const w=["iconify"],N=["provider","prefix"];for(const $ of N)b[$]&&w.push("iconify--"+b[$]);d.className=w.join(" ")}}for(let b in s){const w=s[b];if(w!==void 0)switch(b){case"icon":case"style":case"children":case"onLoad":case"mode":case"ssr":case"fallback":break;case"_ref":d.ref=w;break;case"className":d[b]=(d[b]?d[b]+" ":"")+w;break;case"inline":case"hFlip":case"vFlip":r[b]=w===!0||w==="true"||w===1;break;case"flip":typeof w=="string"&&rc(r,w);break;case"color":l.color=w;break;case"rotate":typeof w=="string"?r[b]=ic(w):typeof w=="number"&&(r[b]=w);break;case"ariaHidden":case"aria-hidden":w!==!0&&w!=="true"&&delete d["aria-hidden"];break;default:n[b]===void 0&&(d[b]=w)}}const u=Eo(e,r),f=u.attributes;if(r.inline&&(l.verticalAlign="-0.125em"),i==="svg"){d.style={...l,...o},Object.assign(d,f);let b=0,w=s.id;return typeof w=="string"&&(w=w.replace(/-/g,"_")),d.dangerouslySetInnerHTML={__html:mc(_o(u.body,w?()=>w+"ID"+b++:"iconifyReact"))},p.createElement("svg",d)}const{body:m,width:h,height:x}=e,g=i==="mask"||(i==="bg"?!1:m.indexOf("currentColor")!==-1),j=lc(m,{...f,width:h+"",height:x+""});return d.style={...l,"--svg":dc(j),width:Qa(f.width),height:Qa(f.height),...xc,...g?Bs:Zn,...o},p.createElement("span",d)};qn(!0);Ro("",Uo);if(typeof document<"u"&&typeof window<"u"){const e=window;if(e.IconifyPreload!==void 0){const s=e.IconifyPreload,a="Invalid IconifyPreload syntax.";typeof s=="object"&&s!==null&&(s instanceof Array?s:[s]).forEach(n=>{try{(typeof n!="object"||n===null||n instanceof Array||typeof n.icons!="object"||typeof n.prefix!="string"||!No(n))&&console.error(a)}catch{console.error(a)}})}if(e.IconifyProviders!==void 0){const s=e.IconifyProviders;if(typeof s=="object"&&s!==null)for(let a in s){const n="IconifyProviders["+a+"] is invalid.";try{const r=s[a];if(typeof r!="object"||!r||r.resources===void 0)continue;To(a,r)||console.error(n)}catch{console.error(n)}}}}function Xn(e){const[s,a]=p.useState(!!e.ssr),[n,r]=p.useState({});function i(x){if(x){const g=e.icon;if(typeof g=="object")return{name:"",data:g};const j=Va(g);if(j)return{name:g,data:j}}return{name:""}}const[l,o]=p.useState(i(!!e.ssr));function d(){const x=n.callback;x&&(x(),r({}))}function u(x){if(JSON.stringify(l)!==JSON.stringify(x))return d(),o(x),!0}function f(){var x;const g=e.icon;if(typeof g=="object"){u({name:"",data:g});return}const j=Va(g);if(u({name:g,data:j}))if(j===void 0){const b=sc([g],f);r({callback:b})}else j&&((x=e.onLoad)===null||x===void 0||x.call(e,g))}p.useEffect(()=>(a(!0),d),[]),p.useEffect(()=>{s&&f()},[e.icon,s]);const{name:m,data:h}=l;return h?pc({...aa,...h},e,m):e.children?e.children:e.fallback?e.fallback:p.createElement("span",{})}const P=p.forwardRef((e,s)=>Xn({...e,_ref:s}));p.forwardRef((e,s)=>Xn({inline:!0,...e,_ref:s}));const B=p.forwardRef(({color:e="primary",radius:s="full",testId:a="veevart-button",...n},r)=>t.jsx(c.Button,{ref:r,color:e,radius:s,"data-testid":a,...n}));B.displayName="Button";function Jn({code:e,amount:s,onRemove:a,label:n="Gift Card",removeAriaLabel:r="Remove gift card",testId:i="veevart-applied-code-card"}){return t.jsx(c.Card,{"data-testid":i,shadow:"sm",className:"w-full",children:t.jsxs(c.CardBody,{className:"flex flex-row items-start justify-between gap-2 p-4",children:[t.jsxs("div",{className:"flex min-w-0 flex-col gap-1",children:[t.jsx("span",{className:"text-xs text-default-500",children: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:s})]}),t.jsx(B,{testId:`${i}-remove`,isIconOnly:!0,size:"sm",variant:"light","aria-label":r,onPress:a,children:t.jsx(P,{icon:"solar:close-circle-linear",className:"size-4","aria-hidden":"true"})})]})})}function bs(e,s){return e-s*Math.floor(e/s)}const er=1721426;function Bt(e,s,a,n){s=la(e,s);let r=s-1,i=-2;return a<=2?i=0:Kt(s)&&(i=-1),er-1+365*r+Math.floor(r/4)-Math.floor(r/100)+Math.floor(r/400)+Math.floor((367*a-362)/12+i+n)}function Kt(e){return e%4===0&&(e%100!==0||e%400===0)}function la(e,s){return e==="BC"?1-s:s}function gc(e){let s="AD";return e<=0&&(s="BC",e=1-e),[s,e]}const bc={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 os{fromJulianDay(s){let a=s,n=a-er,r=Math.floor(n/146097),i=bs(n,146097),l=Math.floor(i/36524),o=bs(i,36524),d=Math.floor(o/1461),u=bs(o,1461),f=Math.floor(u/365),m=r*400+l*100+d*4+f+(l!==4&&f!==4?1:0),[h,x]=gc(m),g=a-Bt(h,x,1,1),j=2;a<Bt(h,x,3,1)?j=0:Kt(x)&&(j=1);let b=Math.floor(((g+j)*12+373)/367),w=a-Bt(h,x,b,1)+1;return new Mt(h,x,b,w)}toJulianDay(s){return Bt(s.era,s.year,s.month,s.day)}getDaysInMonth(s){return bc[Kt(s.year)?"leapyear":"standard"][s.month-1]}getMonthsInYear(s){return 12}getDaysInYear(s){return Kt(s.year)?366:365}getMaximumMonthsInYear(){return 12}getMaximumDaysInMonth(){return 31}getYearsInEra(s){return 9999}getEras(){return["BC","AD"]}isInverseEra(s){return s.era==="BC"}balanceDate(s){s.year<=0&&(s.era=s.era==="BC"?"AD":"BC",s.year=1-s.year)}constructor(){this.identifier="gregory"}}function yc(e,s){var a,n,r,i;return(i=(r=(a=e.isEqual)===null||a===void 0?void 0:a.call(e,s))!==null&&r!==void 0?r:(n=s.isEqual)===null||n===void 0?void 0:n.call(s,e))!==null&&i!==void 0?i:e.identifier===s.identifier}function tr(e,s){return e.calendar.toJulianDay(e)-s.calendar.toJulianDay(s)}function sr(e,s){return Za(e)-Za(s)}function Za(e){return e.hour*36e5+e.minute*6e4+e.second*1e3+e.millisecond}let ys=null;function ar(){return ys==null&&(ys=new Intl.DateTimeFormat().resolvedOptions().timeZone),ys}function Xa(e){e=oa(e,new os);let s=la(e.era,e.year);return nr(s,e.month,e.day,e.hour,e.minute,e.second,e.millisecond)}function nr(e,s,a,n,r,i,l){let o=new Date;return o.setUTCHours(n,r,i,l),o.setUTCFullYear(e,s-1,a),o.getTime()}function Ja(e,s){if(s==="UTC")return 0;if(e>0&&s===ar())return new Date(e).getTimezoneOffset()*-6e4;let{year:a,month:n,day:r,hour:i,minute:l,second:o}=rr(e,s);return nr(a,n,r,i,l,o,0)-Math.floor(e/1e3)*1e3}const en=new Map;function rr(e,s){let a=en.get(s);a||(a=new Intl.DateTimeFormat("en-US",{timeZone:s,hour12:!1,era:"short",year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric"}),en.set(s,a));let n=a.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 tn=864e5;function vc(e,s,a,n){return(a===n?[a]:[a,n]).filter(i=>jc(e,s,i))}function jc(e,s,a){let n=rr(a,s);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,s,a="compatible"){let n=lr(e);if(s==="UTC")return Xa(n);if(s===ar()&&a==="compatible"){n=oa(n,new os);let d=new Date,u=la(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=Xa(n),i=Ja(r-tn,s),l=Ja(r+tn,s),o=vc(n,s,r-i,r-l);if(o.length===1)return o[0];if(o.length>1)switch(a){case"compatible":case"earlier":return o[0];case"later":return o[o.length-1];case"reject":throw new RangeError("Multiple possible absolute times found")}switch(a){case"earlier":return Math.min(r-i,r-l);case"compatible":case"later":return Math.max(r-i,r-l);case"reject":throw new RangeError("No such absolute time found")}}function ir(e,s,a="compatible"){return new Date(wc(e,s,a))}function lr(e,s){let a=0,n=0,r=0,i=0;if("timeZone"in e)({hour:a,minute:n,second:r,millisecond:i}=e);else if("hour"in e&&!s)return e;return s&&({hour:a,minute:n,second:r,millisecond:i}=s),new Jt(e.calendar,e.era,e.year,e.month,e.day,a,n,r,i)}function oa(e,s){if(yc(e.calendar,s))return e;let a=s.fromJulianDay(e.calendar.toJulianDay(e)),n=e.copy();return n.calendar=s,n.era=a.era,n.year=a.year,n.month=a.month,n.day=a.day,yt(n),n}function ca(e,s){let a=e.copy(),n="hour"in a?xr(a,s):0;Vs(a,s.years||0),a.calendar.balanceYearMonth&&a.calendar.balanceYearMonth(a,e),a.month+=s.months||0,Us(a),or(a),a.day+=(s.weeks||0)*7,a.day+=s.days||0,a.day+=n,Nc(a),a.calendar.balanceDate&&a.calendar.balanceDate(a),a.year<1&&(a.year=1,a.month=1,a.day=1);let r=a.calendar.getYearsInEra(a);if(a.year>r){var i,l;let d=(i=(l=a.calendar).isInverseEra)===null||i===void 0?void 0:i.call(l,a);a.year=r,a.month=d?1:a.calendar.getMonthsInYear(a),a.day=d?1:a.calendar.getDaysInMonth(a)}a.month<1&&(a.month=1,a.day=1);let o=a.calendar.getMonthsInYear(a);return a.month>o&&(a.month=o,a.day=a.calendar.getDaysInMonth(a)),a.day=Math.max(1,Math.min(a.calendar.getDaysInMonth(a),a.day)),a}function Vs(e,s){var a,n;!((a=(n=e.calendar).isInverseEra)===null||a===void 0)&&a.call(n,e)&&(s=-s),e.year+=s}function Us(e){for(;e.month<1;)Vs(e,-1),e.month+=e.calendar.getMonthsInYear(e);let s=0;for(;e.month>(s=e.calendar.getMonthsInYear(e));)e.month-=s,Vs(e,1)}function Nc(e){for(;e.day<1;)e.month--,Us(e),e.day+=e.calendar.getDaysInMonth(e);for(;e.day>e.calendar.getDaysInMonth(e);)e.day-=e.calendar.getDaysInMonth(e),e.month++,Us(e)}function or(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 yt(e){e.calendar.constrainDate&&e.calendar.constrainDate(e),e.year=Math.max(1,Math.min(e.calendar.getYearsInEra(e),e.year)),or(e)}function cr(e){let s={};for(let a in e)typeof e[a]=="number"&&(s[a]=-e[a]);return s}function dr(e,s){return ca(e,cr(s))}function ur(e,s){let a=e.copy();return s.era!=null&&(a.era=s.era),s.year!=null&&(a.year=s.year),s.month!=null&&(a.month=s.month),s.day!=null&&(a.day=s.day),yt(a),a}function mr(e,s){let a=e.copy();return s.hour!=null&&(a.hour=s.hour),s.minute!=null&&(a.minute=s.minute),s.second!=null&&(a.second=s.second),s.millisecond!=null&&(a.millisecond=s.millisecond),fr(a),a}function Cc(e){e.second+=Math.floor(e.millisecond/1e3),e.millisecond=Vt(e.millisecond,1e3),e.minute+=Math.floor(e.second/60),e.second=Vt(e.second,60),e.hour+=Math.floor(e.minute/60),e.minute=Vt(e.minute,60);let s=Math.floor(e.hour/24);return e.hour=Vt(e.hour,24),s}function fr(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 Vt(e,s){let a=e%s;return a<0&&(a+=s),a}function xr(e,s){return e.hour+=s.hours||0,e.minute+=s.minutes||0,e.second+=s.seconds||0,e.millisecond+=s.milliseconds||0,Cc(e)}function hr(e,s){let a=e.copy();return xr(a,s),a}function kc(e,s){return hr(e,cr(s))}function pr(e,s,a,n){let r=e.copy();switch(s){case"era":{let o=e.calendar.getEras(),d=o.indexOf(e.era);if(d<0)throw new Error("Invalid era: "+e.era);d=nt(d,a,0,o.length-1,n?.round),r.era=o[d],yt(r);break}case"year":var i,l;!((i=(l=r.calendar).isInverseEra)===null||i===void 0)&&i.call(l,r)&&(a=-a),r.year=nt(e.year,a,-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=nt(e.month,a,1,e.calendar.getMonthsInYear(e),n?.round);break;case"day":r.day=nt(e.day,a,1,e.calendar.getDaysInMonth(e),n?.round);break;default:throw new Error("Unsupported field "+s)}return e.calendar.balanceDate&&e.calendar.balanceDate(r),yt(r),r}function gr(e,s,a,n){let r=e.copy();switch(s){case"hour":{let i=e.hour,l=0,o=23;if(n?.hourCycle===12){let d=i>=12;l=d?12:0,o=d?23:11}r.hour=nt(i,a,l,o,n?.round);break}case"minute":r.minute=nt(e.minute,a,0,59,n?.round);break;case"second":r.second=nt(e.second,a,0,59,n?.round);break;case"millisecond":r.millisecond=nt(e.millisecond,a,0,999,n?.round);break;default:throw new Error("Unsupported field "+s)}return r}function nt(e,s,a,n,r=!1){if(r){e+=Math.sign(s),e<a&&(e=n);let i=Math.abs(s);s>0?e=Math.ceil(e/i)*i:e=Math.floor(e/i)*i,e>n&&(e=a)}else e+=s,e<a?e=n-(a-e-1):e>n&&(e=a+(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 s=e.match(Sc);if(!s)throw $c.test(e)?new Error(`Invalid ISO 8601 date string: ${e}. Use parseAbsolute() instead.`):new Error("Invalid ISO 8601 date string: "+e);let a=new Mt(vs(s[1],0,9999),vs(s[2],1,12),1);return a.day=vs(s[3],1,a.calendar.getDaysInMonth(a)),a}function vs(e,s,a){let n=Number(e);if(n<s||n>a)throw new RangeError(`Value out of range: ${s} <= ${n} <= ${a}`);return n}function br(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 yr(e){let s=oa(e,new os),a;return s.era==="BC"?a=s.year===1?"0000":"-"+String(Math.abs(1-s.year)).padStart(6,"00"):a=String(s.year).padStart(4,"0"),`${a}-${String(s.month).padStart(2,"0")}-${String(s.day).padStart(2,"0")}`}function Dc(e){return`${yr(e)}T${br(e)}`}function Ec(e,s){if(s.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function da(e,s,a){Ec(e,s),s.set(e,a)}function vr(e){let s=typeof e[0]=="object"?e.shift():new os,a;if(typeof e[0]=="string")a=e.shift();else{let l=s.getEras();a=l[l.length-1]}let n=e.shift(),r=e.shift(),i=e.shift();return[s,a,n,r,i]}var Fc=new WeakMap;class Mt{copy(){return this.era?new Mt(this.calendar,this.era,this.year,this.month,this.day):new Mt(this.calendar,this.year,this.month,this.day)}add(s){return ca(this,s)}subtract(s){return dr(this,s)}set(s){return ur(this,s)}cycle(s,a,n){return pr(this,s,a,n)}toDate(s){return ir(this,s)}toString(){return yr(this)}compare(s){return tr(this,s)}constructor(...s){da(this,Fc,{writable:!0,value:void 0});let[a,n,r,i,l]=vr(s);this.calendar=a,this.era=n,this.year=r,this.month=i,this.day=l,yt(this)}}var Lc=new WeakMap;class cs{copy(){return new cs(this.hour,this.minute,this.second,this.millisecond)}add(s){return hr(this,s)}subtract(s){return kc(this,s)}set(s){return mr(this,s)}cycle(s,a,n){return gr(this,s,a,n)}toString(){return br(this)}compare(s){return sr(this,s)}constructor(s=0,a=0,n=0,r=0){da(this,Lc,{writable:!0,value:void 0}),this.hour=s,this.minute=a,this.second=n,this.millisecond=r,fr(this)}}var Mc=new WeakMap;class Jt{copy(){return this.era?new Jt(this.calendar,this.era,this.year,this.month,this.day,this.hour,this.minute,this.second,this.millisecond):new Jt(this.calendar,this.year,this.month,this.day,this.hour,this.minute,this.second,this.millisecond)}add(s){return ca(this,s)}subtract(s){return dr(this,s)}set(s){return ur(mr(this,s),s)}cycle(s,a,n){switch(s){case"era":case"year":case"month":case"day":return pr(this,s,a,n);default:return gr(this,s,a,n)}}toDate(s,a){return ir(this,s,a)}toString(){return Dc(this)}compare(s){let a=tr(this,s);return a===0?sr(this,lr(s)):a}constructor(...s){da(this,Mc,{writable:!0,value:void 0});let[a,n,r,i,l]=vr(s);this.calendar=a,this.era=n,this.year=r,this.month=i,this.day=l,this.hour=s.shift()||0,this.minute=s.shift()||0,this.second=s.shift()||0,this.millisecond=s.shift()||0,yt(this)}}const _c="Open time options",Rc=320;function sn(e,s){return typeof s=="string"&&s.length>0?`${e} ${s}`:e}function js(e){if(!e)return null;const s="hour"in e&&typeof e.hour=="number"?e.hour:0,a="minute"in e&&typeof e.minute=="number"?e.minute:0,n="second"in e&&typeof e.second=="number"?e.second:0;return new cs(s,a,n)}function Tc(e,s){const a=new Date(2e3,0,1,e.hour,e.minute,e.second);return new Intl.DateTimeFormat("en-US",{hour:"numeric",minute:"2-digit",hour12:s===12}).format(a)}function Ic(e){const s=[];for(let a=0;a<24;a+=1)for(let n=0;n<60;n+=e)s.push(new cs(a,n));return s}function Pc(e){const{minuteStep:s=15,timeListClassName:a,timeListLabel:n=_c,selectorButtonProps:r,endContent:i,onChange:l,value:o,defaultValue:d,hourCycle:u=12,...f}=e,m=o!==void 0,[h,x]=p.useState(()=>js(d)),g=m?js(o):h,j=p.useMemo(()=>Ic(s),[s]),b=N=>{m||x(N),l?.(N)},w=t.jsxs(c.Popover,{placement:"bottom-end",children:[t.jsx(c.PopoverTrigger,{children:t.jsx(c.Button,{isIconOnly:!0,variant:"light","aria-label":n,...r,onPress:void 0,children:t.jsx(K.Clock3,{className:"size-4",strokeWidth:1.75})})}),t.jsx(c.PopoverContent,{className:"min-w-[8.5rem] p-0",children:t.jsx(c.ScrollShadow,{className:a??"max-h-64 py-1",children:t.jsx("div",{className:"flex flex-col p-1",children:j.map(N=>{const $=g?.hour===N.hour&&g?.minute===N.minute;return t.jsx(c.Button,{variant:$?"flat":"light",color:$?"primary":"default",className:"h-9 min-w-0 justify-start px-3",onPress:()=>b(N),children:Tc(N,u)},`${N.hour}:${N.minute}`)})})})})]});return t.jsx(c.TimeInput,{...f,value:m?g:void 0,defaultValue:m?void 0:d,hourCycle:u,endContent:t.jsxs("div",{className:"flex items-center gap-1",children:[i,w]}),onChange:N=>b(js(N))})}function ua(e){if(e.mode==="time")return t.jsx(Pc,{...e});if(e.mode==="datetime"){const{mode:r,granularity:i="minute",hideTimeZone:l=!0,calendarWidth:o=Rc,disableAnimation:d=!0,classNames:u,...f}=e;return t.jsx(c.DatePicker,{...f,calendarWidth:o,classNames:{...u,popoverContent:sn("min-w-[20rem]",u?.popoverContent),calendarContent:sn("min-h-[18rem]",u?.calendarContent)},disableAnimation:d,granularity:i,hideTimeZone:l})}const{mode:s,granularity:a="day",...n}=e;return t.jsx(c.DatePicker,{...n,granularity:a})}function Oc(e){const s=e?.closest('[role="dialog"]');return s?.parentElement??s??void 0}const He=p.forwardRef(({popoverProps:e,...s},a)=>{const n=p.useRef(null),[r,i]=p.useState(void 0),l={...e,disableDialogFocus:e?.disableDialogFocus??(r?!0:void 0),portalContainer:e?.portalContainer??r};return p.useEffect(()=>{i(Oc(n.current))},[]),t.jsx("span",{ref:n,className:"contents",children:t.jsx(c.Select,{ref:a,...s,popoverProps:l})})});He.displayName="Select";function zc({state:e,onSubmit:s,onRemove:a,appliedCredit:n,errorMessage:r,label:i="Gift Card",placeholder:l="GC-XXXX-XXXX-XXXX",applyLabel:o="Apply",removeAriaLabel:d="Remove gift card",testId:u="veevart-redeem-code-input"}){const[f,m]=p.useState(""),h=p.useId(),[x,g]=p.useState(e);e!==x&&(g(e),e==="applied"&&m(""));const j=()=>{const N=f.trim();N&&s(N)},b=N=>{N.key==="Enter"&&(N.preventDefault(),j())};if(e==="applied"&&n)return t.jsx("div",{"data-testid":u,children:t.jsx(Jn,{code:n.code,amount:n.amount,onRemove:a,removeAriaLabel:d,testId:`${u}-card`})});const w=e==="error"&&r!=null;return t.jsxs("div",{"data-testid":u,className:"flex flex-col gap-1",children:[t.jsxs("div",{className:"flex items-end gap-2",children:[t.jsx(c.Input,{"data-testid":`${u}-input`,label:i,labelPlacement:"outside",variant:"bordered",radius:"lg",classNames:{label:"text-xs text-default-500 group-data-[filled-within=true]:text-default-500 group-data-[filled-within=true]:-translate-y-[calc(100%_+_var(--heroui-font-size-small)/2_+_16px)]",inputWrapper:"border-small"},placeholder:l,value:f,onValueChange:m,onKeyDown:b,isDisabled:e==="loading",isInvalid:e==="error","aria-describedby":w?h:void 0}),t.jsx(B,{testId:`${u}-button`,isLoading:e==="loading",isDisabled:!f.trim(),onPress:j,children:o})]}),w&&t.jsx("p",{id:h,"data-testid":`${u}-error`,className:"text-tiny text-danger",children:r})]})}const Bc={login:"Login",logout:"Logout",selectLanguage:"Select your language"};function Vc({languages:e,selectedLanguage:s,onLanguageChange:a,label:n}){const r=e.find(i=>i.code===s);return t.jsx("div",{className:"flex items-center",children:t.jsxs("div",{className:"relative flex items-center",children:[t.jsx(He,{"data-testid":"language-select-desktop",variant:"bordered","aria-label":n,selectedKeys:s?[s]:[],onSelectionChange:i=>{const l=Array.from(i)[0]||s;a?.(l)},className:"min-w-36 hidden md:inline-flex",isDisabled:e.length===0,placeholder:n,startContent:t.jsx(K.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(c.SelectItem,{textValue:i.label,"data-testid":`language-select-option-${i.code}`,children:i.label},i.code))}),t.jsx(He,{"aria-label":n,"data-testid":"language-select-mobile",variant:"bordered",selectedKeys:s?[s]:[],onSelectionChange:i=>{const l=Array.from(i)[0]||s;a?.(l)},className:"w-24 inline-flex md:hidden",isDisabled:e.length===0,placeholder:"",startContent:t.jsx(K.Globe,{className:"w-6 h-6 text-black"}),renderValue:()=>t.jsx("span",{children:r?.code.toUpperCase()||""}),size:"md",radius:"full",children:e.map(i=>t.jsx(c.SelectItem,{textValue:i.code.toUpperCase(),"data-testid":`language-select-option-mobile-${i.code}`,children:i.code.toUpperCase()},i.code))})]})})}function Uc({isLoggedIn:e,onLogin:s,onLogout:a,labels:n}){return e?t.jsxs(B,{"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:a,size:"md",children:[t.jsx(K.User,{className:"inline w-5 h-5"}),t.jsx("span",{className:"hidden md:inline",children:n.logout})]}):t.jsxs(B,{"data-testid":"navbar-auth-button",className:"px-2 py-1 min-w-12 md:min-w-24 rounded-full bg-black text-white text-sm flex items-center",onPress:s,size:"md",children:[t.jsx(K.User,{className:"inline w-5 h-5"}),t.jsx("span",{className:"hidden md:inline",children:n.login})]})}function Hc({logo:e,languages:s=[],selectedLanguage:a,onLanguageChange:n,isLoggedIn:r,onLogin:i,onLogout:l,hasLanguages:o,hasAuth:d,labels:u={},className:f}){const m={...Bc,...u};return t.jsxs("nav",{"data-testid":"navbar",className:c.cn("w-full px-4 md:px-8 py-3 bg-white border-b border-zinc-100 flex items-center justify-between",f),children:[t.jsx("div",{className:"flex items-center min-w-10",children:e&&t.jsx("a",{href:"/",className:"block",children:t.jsx("img",{"data-testid":"navbar-logo",src:e,alt:"Logo",className:"h-8 w-auto max-w-28 md:max-w-40 object-contain"})})}),t.jsxs("div",{className:"flex items-center gap-2 md:gap-4",children:[(o||s.length>0)&&t.jsx(Vc,{languages:s,selectedLanguage:a,onLanguageChange:n,label:m.selectLanguage}),d&&t.jsx(Uc,{isLoggedIn:r,onLogin:i,onLogout:l,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(c.Alert,{description:"This template combines Navbar, Footer, and a confirmation Card. Include title, message, confirmation number, details list, icon, and action buttons. Use Card for the confirmation content.",title:"TODO: Implement ConfirmationPageTemplate",variant:"faded",className:"max-w-2xl"})})})}var ws;const Wc=typeof document<"u"?(ws=p.useInsertionEffect)!==null&&ws!==void 0?ws:p.useLayoutEffect:()=>{};function ds(e,s,a){let[n,r]=p.useState(e||s),i=p.useRef(n),l=p.useRef(e!==void 0),o=e!==void 0;p.useEffect(()=>{let m=l.current;m!==o&&process.env.NODE_ENV!=="production"&&console.warn(`WARN: A component changed from ${m?"controlled":"uncontrolled"} to ${o?"controlled":"uncontrolled"}.`),l.current=o},[o]);let d=o?e:n;Wc(()=>{i.current=d});let[,u]=p.useReducer(()=>({}),{}),f=p.useCallback((m,...h)=>{let x=typeof m=="function"?m(i.current):m;Object.is(i.current,x)||(i.current=x,r(x),u(),a?.(x,...h))},[a]);return[d,f]}function jr(e){return t.jsx("svg",{...e,fill:"none",stroke:"currentColor",strokeWidth:2,viewBox:"0 0 24 24",children:t.jsx(De.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 wr=p.forwardRef(({color:e="primary",variant:s="default",stepsCount:a=3,defaultStep:n=0,label:r,stepLabels:i,showStepLabelTooltip:l=!1,stepLabelTooltipPlacement:o="top",showStepCounter:d=!1,stepCounterPosition:u="right",layout:f="compact",stepCounterFormat:m,onStepChange:h,currentStep:x,hideProgressBars:g=!1,stepClassName:j,className:b,isDisabled:w=!1,...N},$)=>{const[v,A]=ds(x,n,h),M=p.useMemo(()=>{let k,F;const C=["[--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":k="[--step-color:var(--heroui-primary)]",F="[--step-fg-color:var(--heroui-primary-foreground)]";break;case"secondary":k="[--step-color:var(--heroui-secondary)]",F="[--step-fg-color:var(--heroui-secondary-foreground)]";break;case"success":k="[--step-color:var(--heroui-success)]",F="[--step-fg-color:var(--heroui-success-foreground)]";break;case"warning":k="[--step-color:var(--heroui-warning)]",F="[--step-fg-color:var(--heroui-warning-foreground)]";break;case"danger":k="[--step-color:var(--heroui-danger)]",F="[--step-fg-color:var(--heroui-danger-foreground)]";break;case"default":k="[--step-color:var(--heroui-default)]",F="[--step-fg-color:var(--heroui-default-foreground)]";break;default:k="[--step-color:var(--heroui-primary)]",F="[--step-fg-color:var(--heroui-primary-foreground)]";break}return C.unshift(F),C.unshift(k),C},[e]);return t.jsxs("nav",{ref:$,"aria-label":"Progress",className:c.cn("flex items-center overflow-x-auto",f==="spread"?"w-full justify-between gap-6":"max-w-fit gap-3",b),"data-testid":"stepper-root",...N,children:[d&&u==="left"?t.jsx("span",{className:"text-default-500 text-2xl whitespace-nowrap","data-testid":"stepper-counter",children:m?m(v+1,a):`Step ${v+1} of ${a}`}):null,r&&t.jsx("label",{className:"text-small text-default-foreground lg:text-medium font-light whitespace-nowrap me-3","data-testid":"stepper-label",children:r}),t.jsx("ol",{className:c.cn("flex flex-row flex-nowrap gap-x-3",M,b),"data-testid":"stepper-list",children:Array.from({length:a})?.map((k,F)=>{const C=v===F?"active":v<F?"inactive":"complete",_=s==="activeLabel"&&C==="active"&&!!i?.[F],E=l&&C!=="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(c.Tooltip,{content:E?i?.[F]:void 0,isDisabled:!E,offset:12,placement:o,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":C==="active"?"step":void 0,className:c.cn("group rounded-large flex w-full cursor-pointer flex-row items-center justify-center gap-x-3 py-2.5",{"rounded-full border border-(--active-border-color)/20 bg-(--active-border-color)/10 pl-2 pr-4 py-1.5":_},{"cursor-not-allowed opacity-50":w},j),onClick:()=>!w&&A(F),disabled:w,"data-testid":`stepper-step-btn-${F}`,children:[t.jsx("div",{className:"h-full relative flex items-center",children:t.jsx(De.LazyMotion,{features:De.domAnimation,children:t.jsx(De.m.div,{animate:C,className:"relative z-10",children:t.jsx(De.m.div,{animate:C,className:c.cn("border-medium text-large text-default-foreground relative z-10 flex h-[26px] w-[26px] shrink-0 items-center justify-center rounded-full font-semibold bg-white",{"border-(--complete-border-color) bg-(--complete-background-color) text-(--active-fg-color)":_,"bg-(--complete-background-color)":C==="complete","shadow-lg":C==="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:C==="complete"&&s==="default"?t.jsx(jr,{className:"h-5 w-5 text-(--active-fg-color)","data-testid":`stepper-step-check-${F}`}):t.jsx("span",{children:F+1})})})})})}),_?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<a-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:c.cn("bg-default-200 relative h-0.5 w-full transition-colors duration-300","after:absolute after:block after:h-full after:w-0 after:bg-(--active-border-color) after:transition-[width] after:duration-300 after:content-['']",{"after:w-full":F<v})})})]},F)})}),d&&u==="right"?t.jsx("span",{className:"text-default-500 text-2xl whitespace-nowrap","data-testid":"stepper-counter",children:m?m(v+1,a):`Step ${v+1} of ${a}`}):null]})});wr.displayName="Stepper";function Yc(e){return t.jsx("div",{className:"min-h-screen flex flex-col",children:t.jsx("div",{className:"flex-1 flex items-center justify-center p-12",children:t.jsx(c.Alert,{description:"This template combines Navbar, Stepper, Footer, and an event details Card. Include event image, category/spots chips, tags, details grid, and action buttons. Use Card, CardHeader, CardBody for content structure.",title:"TODO: Implement EventDetailsTemplate",variant:"faded",className:"max-w-2xl"})})})}function ge(e,s="en-US",a="USD"){try{return new Intl.NumberFormat(s,{style:"currency",currency:a}).format(e)}catch{return`${a} ${e.toFixed(2)}`}}function Rt(e,s="en-US"){try{const a=new Intl.NumberFormat(s,{style:"currency",currency:e}).resolvedOptions();return typeof a.maximumFractionDigits=="number"?a.maximumFractionDigits:2}catch{return 2}}function Nr(e,s,a="en-US"){const n=Rt(s,a),r=Math.pow(10,n);return Math.round(e*r)/r}function Hs(e,s,a,n){return Nr(e-s,a,n)}const an={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))"}},Gc="rgb(156 163 175)",Kc="rgb(107 114 128)",Cr=p.forwardRef(function({color:s="primary",steps:a=[],defaultStep:n=0,onStepChange:r,currentStep:i,hideProgressBars:l=!1,activeColor:o,activeForegroundColor:d,inactiveColor:u=Gc,inactiveLabelColor:f=Kc,activeStepVariant:m="bordered",stepClassName:h,circleClassName:x,progressBarClassName:g,labelsClassName:j,labelSlotClassName:b,activeLabelClassName:w,inactiveLabelClassName:N,className:$,ariaLabel:v="Progress",invalidLabelSuffix:A=", has errors",testId:M,isStepReachable:k,...F},C){const[_,E]=ds(i,n,r),D=an[s]??an.primary,R=o??D.active,O=d??D.fg,V=(q,I)=>{const W=q.ariaLabel??(typeof q.title=="string"?q.title:null)??`${I+1}`;return q.invalid?`${W}${A}`:W};return t.jsxs("nav",{...F,"aria-label":v,...M?{"data-testid":M}:{},children:[t.jsx("div",{className:c.cn("flex items-center",$),children:a?.map((q,I)=>{const J=I===_?"active":I<_?"complete":"inactive",W=k?k(I):!0;return t.jsxs(p.Fragment,{children:[t.jsx(B,{ref:C,isIconOnly:!0,disableAnimation:!0,radius:"full",variant:"light",testId:`${M??"horizontal-steps"}-step-${I}`,"aria-current":J==="active"?"step":void 0,"aria-describedby":q.describedBy,"aria-label":V(q,I),"data-invalid":q.invalid?"true":void 0,isDisabled:!W,className:c.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,h),onPress:()=>{if(i===void 0){E(I);return}r?.(I)},children:t.jsx(De.LazyMotion,{features:De.domAnimation,children:t.jsx(De.m.div,{animate:J,className:c.cn("relative flex size-8 items-center justify-center rounded-full text-[13px] font-medium",x),initial:!1,transition:{duration:.2},variants:{inactive:{backgroundColor:"transparent",borderColor:u,borderWidth:"1.5px",color:u},active:{backgroundColor:m==="solid"?R:"transparent",borderColor:R,borderWidth:"1.5px",color:m==="solid"?O:R},complete:{backgroundColor:R,borderColor:R,borderWidth:"1.5px",color:R}},children:J==="complete"?t.jsx(jr,{className:"size-4",style:{color:O}}):t.jsx("span",{children:I+1})})})}),I<a.length-1&&!l&&t.jsx("div",{"aria-hidden":!0,className:c.cn("mx-1 h-px w-6 shrink-0 transition-colors duration-300 sm:mx-1.5 sm:w-14 md:w-20",g),style:{backgroundColor:I<_?R:u}})]},I)})}),t.jsx("div",{className:c.cn("mt-2.5 hidden md:flex",j),children:a?.map((q,I)=>{const J=I<=_;return t.jsxs(p.Fragment,{children:[t.jsx("div",{className:c.cn("relative flex w-8 shrink-0 justify-center overflow-visible",b),children:t.jsx("span",{className:c.cn("absolute left-1/2 top-0 -translate-x-1/2 whitespace-nowrap text-center text-[12px] font-medium transition-colors duration-200",J?w:N),style:{color:J?R:f},children:q.title})}),I<a.length-1&&!l&&t.jsx("div",{className:c.cn("mx-1 w-6 shrink-0 sm:mx-1.5 sm:w-14 md:w-20",g)})]},I)})})]})});Cr.displayName="HorizontalSteps";function Qc(){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 Zc=e=>{const s=p.useMemo(()=>JSON.stringify({allItems:e.allItems,selected:e.selected}),[e.allItems,e.selected]);return t.jsx(Xc,{...e},s)},Xc=({allItems:e,selected:s,onSelectedChange:a,titleLeft:n,titleRight:r})=>{const[i,l]=p.useState([]),[o,d]=p.useState([]),[u,f]=p.useState(null),[m,h]=p.useState(null),x=p.useMemo(()=>new Set(s),[s]),g=p.useMemo(()=>new Set(e),[e]),j=p.useMemo(()=>e.filter(E=>!x.has(E)),[e,x]),b=E=>{if(E.length===0)return;const D=Array.from(new Set([...s,...E]));a(D)},w=E=>{if(E.length===0)return;const D=new Set(E);a(s.filter(R=>!D.has(R)))},N=()=>{i.length!==0&&(b(i),l([]))},$=()=>{o.length!==0&&(w(o),d([]))},v=()=>{j.length!==0&&(b(j),l([]))},A=()=>{s.length!==0&&(a([]),d([]))},M=(E,D,R)=>{const O=Math.min(D,R),V=Math.max(D,R);return E.slice(O,V+1)},k=(E,D,R)=>{if(R&&u!==null){l(M(j,u,D)),d([]),f(D);return}const O=i.includes(E);l(O?i.filter(V=>V!==E):[...i,E]),d([]),f(D)},F=(E,D,R)=>{if(R&&m!==null){d(M(s,m,D)),l([]),h(D);return}const O=o.includes(E);d(O?o.filter(V=>V!==E):[...o,E]),l([]),h(D)},C=(E,D,R)=>{const O=R==="available"?i.includes(D)?i:[D]:o.includes(D)?o:[D];E.dataTransfer.setData("text/plain",JSON.stringify({source:R,items:O})),E.dataTransfer.effectAllowed="move"},_=(E,D)=>{E.preventDefault();const R=E.dataTransfer.getData("text/plain");if(R)try{const O=JSON.parse(R),V=(O.items||[]).filter(q=>g.has(q));if(V.length===0||O.source===D)return;D==="selected"?(b(V),l([])):(w(V),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(c.Card,{className:"w-full border border-gray-200 shadow-none",children:t.jsx(c.CardBody,{className:"h-60 gap-2 overflow-y-auto",onDragOver:E=>E.preventDefault(),onDrop:E=>_(E,"available"),children:j.map((E,D)=>{const R=i.includes(E);return t.jsx("button",{type:"button",onClick:O=>{k(E,D,O.shiftKey)},onMouseDown:O=>{O.shiftKey&&O.preventDefault()},draggable:!0,onDragStart:O=>C(O,E,"available"),className:`rounded-md px-3 py-2 text-left text-sm transition ${R?"bg-[#E4571E]/10 text-[#E4571E]":"text-gray-700 hover:bg-gray-100"}`,children:E},E)})})})]}),t.jsxs("div",{className:"flex flex-row items-center justify-center gap-3 md:flex-col md:pt-6",children:[t.jsx(B,{variant:"light",className:"h-10 w-10 min-w-0 text-2xl font-semibold text-[#E4571E] hover:bg-[#E4571E]/10",isIconOnly:!0,"data-testid":"move-selected-to-available",onPress:N,isDisabled:i.length===0,"aria-label":"Move selected to right",children:"›"}),t.jsx(B,{variant:"light",className:"h-10 w-10 min-w-0 text-2xl font-semibold text-[#E4571E] hover:bg-[#E4571E]/10",isIconOnly:!0,"data-testid":"move-selected-to-available",onPress:$,isDisabled:o.length===0,"aria-label":"Move selected to left",children:"‹"}),t.jsx(B,{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:v,isDisabled:j.length===0,"aria-label":"Move all to right",children:"»"}),t.jsx(B,{variant:"light",className:"h-10 w-10 min-w-0 text-2xl font-semibold text-[#E4571E] hover:bg-[#E4571E]/10",isIconOnly:!0,onPress:A,"data-testid":"move-all-to-available",isDisabled:s.length===0,"aria-label":"Move all to left",children:"«"})]}),t.jsxs("div",{className:"flex w-full flex-col gap-3 md:w-2/5",children:[t.jsx("h2",{className:"text-sm font-medium text-gray-700",children:r}),t.jsx(c.Card,{className:"w-full border border-gray-200 shadow-none",children:t.jsx(c.CardBody,{className:"h-60 gap-2 overflow-y-auto",onDragOver:E=>E.preventDefault(),onDrop:E=>_(E,"selected"),children:s.map((E,D)=>{const R=o.includes(E);return t.jsx("button",{type:"button",onClick:O=>{F(E,D,O.shiftKey)},onMouseDown:O=>{O.shiftKey&&O.preventDefault()},draggable:!0,onDragStart:O=>C(O,E,"selected"),className:`rounded-md px-3 py-2 text-left text-sm transition ${R?"bg-[#E4571E]/10 text-[#E4571E]":"text-gray-700 hover:bg-gray-100"}`,children:E},E)})})})]})]})};function _t(e){return typeof e=="string"?e:e.type}function lt({className:e}){return t.jsx("div",{className:`flex items-center h-6 ${e||""}`,children:t.jsx(c.Divider,{orientation:"vertical"})})}function ot({icon:e,label:s,isActive:a=!1,isDisabled:n=!1,onClick:r,shortcut:i,iconSize:l=16,className:o}){const d=i?`${s} (${i})`:s;return t.jsx(c.Tooltip,{content:d,placement:"top",offset:10,children:t.jsx(B,{size:"sm",radius:"sm",color:a?"primary":"default",variant:a?"solid":"bordered",isIconOnly:!0,isDisabled:n,onPress:r,"aria-label":s,className:o,children:t.jsx(e,{size:l})})})}const Xe={bold:{execute:({editor:e})=>e.chain().focus().toggleBold().run(),canExecute:e=>e.can().chain().focus().toggleBold().run(),isActive:e=>e.isActive("bold"),shortcut:"Mod-b",label:"Bold"},italic:{execute:({editor:e})=>e.chain().focus().toggleItalic().run(),canExecute:e=>e.can().chain().focus().toggleItalic().run(),isActive:e=>e.isActive("italic"),shortcut:"Mod-i",label:"Italic"},strike:{execute:({editor:e})=>e.chain().focus().toggleStrike().run(),canExecute:e=>e.can().chain().focus().toggleStrike().run(),isActive:e=>e.isActive("strike"),shortcut:"Mod-Shift-x",label:"Strikethrough"},underline:{execute:({editor:e})=>e.chain().focus().toggleUnderline().run(),canExecute:e=>e.can().chain().focus().toggleUnderline().run(),isActive:e=>e.isActive("underline"),shortcut:"Mod-u",label:"Underline"},code:{execute:({editor:e})=>e.chain().focus().toggleCode().run(),canExecute:e=>e.can().chain().focus().toggleCode().run(),isActive:e=>e.isActive("code"),shortcut:"Mod-e",label:"Inline code"},textColor:{execute:({editor:e,config:s})=>{const a=s?.type==="textColor"?s.color:"";a?e.chain().focus().setColor(a).run():e.chain().focus().unsetColor().run()},canExecute:()=>!0,isActive:e=>e.isActive("textStyle"),label:"Text color"},highlight:{execute:({editor:e,config:s})=>{const a=s?.type==="highlight"?s.color:"";a?e.chain().focus().setHighlight({color:a}).run():e.chain().focus().unsetHighlight().run()},canExecute:()=>!0,isActive:e=>e.isActive("highlight"),label:"Highlight"},link:{execute:({editor:e,config:s})=>{const a=s?.type==="link"?s.href:"";if(a){const n=s?.type==="link"?s.target:void 0,r=s?.type==="link"?s.rel:void 0;e.chain().focus().setLink({href:a,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:s})=>{const a=s?.type==="heading"?s.level:1;e.chain().focus().toggleHeading({level:a}).run()},canExecute:(e,s)=>{const a=s?.type==="heading"?s.level:1;return e.can().chain().focus().toggleHeading({level:a}).run()},isActive:(e,s)=>s?.type==="heading"?e.isActive("heading",{level:s.level}):e.isActive("heading"),label:"Heading"},bulletList:{execute:({editor:e})=>e.chain().focus().toggleBulletList().run(),canExecute:e=>e.can().chain().focus().toggleBulletList().run(),isActive:e=>e.isActive("bulletList"),shortcut:"Mod-Shift-8",label:"Bullet list"},orderedList:{execute:({editor:e})=>e.chain().focus().toggleOrderedList().run(),canExecute:e=>e.can().chain().focus().toggleOrderedList().run(),isActive:e=>e.isActive("orderedList"),shortcut:"Mod-Shift-7",label:"Numbered list"},taskList:{execute:({editor:e})=>e.chain().focus().toggleTaskList().run(),canExecute:e=>e.can().chain().focus().toggleTaskList().run(),isActive:e=>e.isActive("taskList"),label:"Task list"},codeBlock:{execute:({editor:e})=>e.chain().focus().toggleCodeBlock().run(),canExecute:e=>e.can().chain().focus().toggleCodeBlock().run(),isActive:e=>e.isActive("codeBlock"),shortcut:"Mod-Alt-c",label:"Code block"},blockquote:{execute:({editor:e})=>e.chain().focus().toggleBlockquote().run(),canExecute:e=>e.can().chain().focus().toggleBlockquote().run(),isActive:e=>e.isActive("blockquote"),shortcut:"Mod-Shift-b",label:"Blockquote"},horizontalRule:{execute:({editor:e})=>e.chain().focus().setHorizontalRule().run(),canExecute:e=>e.can().chain().focus().setHorizontalRule().run(),isActive:()=>!1,label:"Horizontal rule"},hardBreak:{execute:({editor:e})=>e.chain().focus().setHardBreak().run(),canExecute:e=>e.can().chain().focus().setHardBreak().run(),isActive:()=>!1,shortcut:"Mod-Enter",label:"Line break"},textAlign:{execute:({editor:e,config:s})=>{const a=s?.type==="textAlign"?s.alignment:"left";e.chain().focus().setTextAlign(a).run()},canExecute:()=>!0,isActive:(e,s)=>s?.type==="textAlign"?e.isActive({textAlign:s.alignment}):!1,label:"Text alignment"},clearMarks:{execute:({editor:e})=>e.chain().focus().unsetAllMarks().run(),canExecute:e=>e.can().chain().focus().unsetAllMarks().run(),isActive:()=>!1,label:"Clear formatting"},clearNodes:{execute:({editor:e})=>e.chain().focus().clearNodes().run(),canExecute:e=>e.can().chain().focus().clearNodes().run(),isActive:()=>!1,label:"Clear nodes"},undo:{execute:({editor:e})=>e.chain().focus().undo().run(),canExecute:e=>e.can().chain().focus().undo().run(),isActive:()=>!1,shortcut:"Mod-z",label:"Undo"},redo:{execute:({editor:e})=>e.chain().focus().redo().run(),canExecute:e=>e.can().chain().focus().redo().run(),isActive:()=>!1,shortcut:"Mod-Shift-z",label:"Redo"}},Jc={1:"Heading 1",2:"Heading 2",3:"Heading 3",4:"Heading 4",5:"Heading 5",6:"Heading 6"};function ed({editor:e,levels:s=[1,2,3,4,5,6],isDisabled:a=!1}){const[,n]=p.useState(0);p.useEffect(()=>{const l=()=>n(o=>o+1);return e.on("selectionUpdate",l),e.on("transaction",l),()=>{e.off("selectionUpdate",l),e.off("transaction",l)}},[e]);const r=s.find(l=>e.isActive("heading",{level:l})),i=l=>{const o=Number(l),d=Xe.heading;d&&d.execute({editor:e,config:{type:"heading",level:o}})};return t.jsxs(c.Dropdown,{placement:"top-start",offset:10,children:[t.jsx(c.DropdownTrigger,{children:t.jsx(B,{size:"sm",radius:"sm",variant:r?"solid":"bordered",color:r?"primary":"default",isDisabled:a,startContent:t.jsx(K.Heading,{size:16}),"aria-label":"Select heading level",children:r?`H${r}`:"H"})}),t.jsx(c.DropdownMenu,{"aria-label":"Heading levels",selectionMode:"single",selectedKeys:r?new Set([String(r)]):new Set,onAction:i,children:s.map(l=>t.jsx(c.DropdownItem,{startContent:e.isActive("heading",{level:l})?t.jsx(K.Check,{size:16}):t.jsx("div",{className:"w-4"}),children:Jc[l]},l))})]})}const Ns={bulletList:{label:"Bullet List",icon:K.List},orderedList:{label:"Numbered List",icon:K.ListOrdered},taskList:{label:"Task List",icon:K.ListTodo}};function td({editor:e,types:s=["bulletList","orderedList","taskList"],isDisabled:a=!1}){const[,n]=p.useState(0);p.useEffect(()=>{const o=()=>n(d=>d+1);return e.on("selectionUpdate",o),e.on("transaction",o),()=>{e.off("selectionUpdate",o),e.off("transaction",o)}},[e]);const r=s.find(o=>e.isActive(o)),i=r?Ns[r].icon:K.List,l=o=>{const u=Xe[o];u&&u.execute({editor:e})};return t.jsxs(c.Dropdown,{placement:"top-start",offset:10,children:[t.jsx(c.DropdownTrigger,{children:t.jsx(B,{size:"sm",radius:"sm",variant:r?"solid":"bordered",color:r?"primary":"default",isDisabled:a,isIconOnly:!0,"aria-label":"Select list type",children:t.jsx(i,{size:16})})}),t.jsx(c.DropdownMenu,{"aria-label":"List types",selectionMode:"single",selectedKeys:r?new Set([r]):new Set,onAction:l,children:s.map(o=>{const d=Ns[o].icon;return t.jsx(c.DropdownItem,{startContent:t.jsx(d,{size:16}),children:Ns[o].label},o)})})]})}function sd({colors:e,selectedColor:s,onColorSelect:a,columns:n=4}){return t.jsx("div",{className:"grid gap-2",style:{gridTemplateColumns:`repeat(${n}, minmax(0, 1fr))`},children:e.map(r=>{const i=s===r;return t.jsx("button",{type:"button",onClick:()=>a(r),className:`
|
|
7
|
+
`}const je={line:"#E7E7E9","line-2":"#F1F1F3",hair:"#F0F0F1",page:"#FBFBFB",field:"#E5E5E5","ok-fill":"#EAF3DE",ok:"#3B6D11","warn-fill":"#FAEEDA",warn:"#854F0B","warn-icon":"#EFD9B2","danger-fill":"#FCEBEB",danger:we.semantic.danger,"danger-icon":"#F3D3CF","info-fill":"#EAF1FC",info:"#1D4FA8","violet-fill":"#F1ECFB",violet:"#6D28D9","neutral-fill":"#F4F4F5",neutral:"#52525B",destructive:"#A32D2D"};({...je});function ho({children:e}){return t.jsx(c.HeroUIProvider,{children:e})}function po(e,s){const a=e.icons,n=e.aliases||Object.create(null),r=Object.create(null);function i(l){if(a[l])return r[l]=[];if(!(l in r)){r[l]=null;const o=n[l]&&n[l].parent,d=o&&i(o);d&&(r[l]=[o].concat(d))}return r[l]}return Object.keys(a).concat(Object.keys(n)).forEach(i),r}const zn=Object.freeze({left:0,top:0,width:16,height:16}),Xt=Object.freeze({rotate:0,vFlip:!1,hFlip:!1}),aa=Object.freeze({...zn,...Xt}),Ps=Object.freeze({...aa,body:"",hidden:!1});function go(e,s){const a={};!e.hFlip!=!s.hFlip&&(a.hFlip=!0),!e.vFlip!=!s.vFlip&&(a.vFlip=!0);const n=((e.rotate||0)+(s.rotate||0))%4;return n&&(a.rotate=n),a}function za(e,s){const a=go(e,s);for(const n in Ps)n in Xt?n in e&&!(n in a)&&(a[n]=Xt[n]):n in s?a[n]=s[n]:n in e&&(a[n]=e[n]);return a}function bo(e,s,a){const n=e.icons,r=e.aliases||Object.create(null);let i={};function l(o){i=za(n[o]||r[o],i)}return l(s),a.forEach(l),za(e,i)}function Bn(e,s){const a=[];if(typeof e!="object"||typeof e.icons!="object")return a;e.not_found instanceof Array&&e.not_found.forEach(r=>{s(r,null),a.push(r)});const n=po(e);for(const r in n){const i=n[r];i&&(s(r,bo(e,r,i)),a.push(r))}return a}const yo={provider:"",aliases:{},not_found:{},...zn};function ps(e,s){for(const a in s)if(a in e&&typeof e[a]!=typeof s[a])return!1;return!0}function Vn(e){if(typeof e!="object"||e===null)return null;const s=e;if(typeof s.prefix!="string"||!e.icons||typeof e.icons!="object"||!ps(e,yo))return null;const a=s.icons;for(const r in a){const i=a[r];if(!r||typeof i.body!="string"||!ps(i,Ps))return null}const n=s.aliases||Object.create(null);for(const r in n){const i=n[r],l=i.parent;if(!r||typeof l!="string"||!a[l]&&!n[l]||!ps(i,Ps))return null}return s}const Ba=Object.create(null);function vo(e,s){return{provider:e,prefix:s,icons:Object.create(null),missing:new Set}}function bt(e,s){const a=Ba[e]||(Ba[e]=Object.create(null));return a[s]||(a[s]=vo(e,s))}function Un(e,s){return Vn(s)?Bn(s,(a,n)=>{n?e.icons[a]=n:e.missing.add(a)}):[]}function jo(e,s,a){try{if(typeof a.body=="string")return e.icons[s]={...a},!0}catch{}return!1}const Hn=/^[a-z0-9]+(-[a-z0-9]+)*$/,ls=(e,s,a,n="")=>{const r=e.split(":");if(e.slice(0,1)==="@"){if(r.length<2||r.length>3)return null;n=r.shift().slice(1)}if(r.length>3||!r.length)return null;if(r.length>1){const o=r.pop(),d=r.pop(),u={provider:r.length>0?r[0]:n,prefix:d,name:o};return s&&!Yt(u)?null:u}const i=r[0],l=i.split("-");if(l.length>1){const o={provider:n,prefix:l.shift(),name:l.join("-")};return s&&!Yt(o)?null:o}if(a&&n===""){const o={provider:n,prefix:"",name:i};return s&&!Yt(o,a)?null:o}return null},Yt=(e,s)=>e?!!((s&&e.prefix===""||e.prefix)&&e.name):!1;let Lt=!1;function qn(e){return typeof e=="boolean"&&(Lt=e),Lt}function Va(e){const s=typeof e=="string"?ls(e,!0,Lt):e;if(s){const a=bt(s.provider,s.prefix),n=s.name;return a.icons[n]||(a.missing.has(n)?null:void 0)}}function wo(e,s){const a=ls(e,!0,Lt);if(!a)return!1;const n=bt(a.provider,a.prefix);return s?jo(n,a.name,s):(n.missing.add(a.name),!0)}function No(e,s){if(typeof e!="object")return!1;if(typeof s!="string"&&(s=e.provider||""),Lt&&!s&&!e.prefix){let r=!1;return Vn(e)&&(e.prefix="",Bn(e,(i,l)=>{wo(i,l)&&(r=!0)})),r}const a=e.prefix;if(!Yt({prefix:a,name:"a"}))return!1;const n=bt(s,a);return!!Un(n,e)}const Wn=Object.freeze({width:null,height:null}),Yn=Object.freeze({...Wn,...Xt}),Co=/(-?[0-9.]*[0-9]+[0-9.]*)/g,ko=/^-?[0-9.]*[0-9]+[0-9.]*$/g;function Ua(e,s,a){if(s===1)return e;if(a=a||100,typeof e=="number")return Math.ceil(e*s*a)/a;if(typeof e!="string")return e;const n=e.split(Co);if(n===null||!n.length)return e;const r=[];let i=n.shift(),l=ko.test(i);for(;;){if(l){const o=parseFloat(i);isNaN(o)?r.push(i):r.push(Math.ceil(o*s*a)/a)}else r.push(i);if(i=n.shift(),i===void 0)return r.join("");l=!l}}function So(e,s="defs"){let a="";const n=e.indexOf("<"+s);for(;n>=0;){const r=e.indexOf(">",n),i=e.indexOf("</"+s);if(r===-1||i===-1)break;const l=e.indexOf(">",i);if(l===-1)break;a+=e.slice(r+1,i).trim(),e=e.slice(0,n).trim()+e.slice(l+1)}return{defs:a,content:e}}function $o(e,s){return e?"<defs>"+e+"</defs>"+s:s}function Ao(e,s,a){const n=So(e);return $o(n.defs,s+n.content+a)}const Do=e=>e==="unset"||e==="undefined"||e==="none";function Eo(e,s){const a={...aa,...e},n={...Yn,...s},r={left:a.left,top:a.top,width:a.width,height:a.height};let i=a.body;[a,n].forEach(j=>{const b=[],w=j.hFlip,N=j.vFlip;let D=j.rotate;w?N?D+=2:(b.push("translate("+(r.width+r.left).toString()+" "+(0-r.top).toString()+")"),b.push("scale(-1 1)"),r.top=r.left=0):N&&(b.push("translate("+(0-r.left).toString()+" "+(r.height+r.top).toString()+")"),b.push("scale(1 -1)"),r.top=r.left=0);let v;switch(D<0&&(D-=Math.floor(D/4)*4),D=D%4,D){case 1:v=r.height/2+r.top,b.unshift("rotate(90 "+v.toString()+" "+v.toString()+")");break;case 2:b.unshift("rotate(180 "+(r.width/2+r.left).toString()+" "+(r.height/2+r.top).toString()+")");break;case 3:v=r.width/2+r.left,b.unshift("rotate(-90 "+v.toString()+" "+v.toString()+")");break}D%2===1&&(r.left!==r.top&&(v=r.left,r.left=r.top,r.top=v),r.width!==r.height&&(v=r.width,r.width=r.height,r.height=v)),b.length&&(i=Ao(i,'<g transform="'+b.join(" ")+'">',"</g>"))});const l=n.width,o=n.height,d=r.width,u=r.height;let f,m;l===null?(m=o===null?"1em":o==="auto"?u:o,f=Ua(m,d/u)):(f=l==="auto"?d:l,m=o===null?Ua(f,u/d):o==="auto"?u:o);const h={},x=(j,b)=>{Do(b)||(h[j]=b.toString())};x("width",f),x("height",m);const g=[r.left,r.top,d,u];return h.viewBox=g.join(" "),{attributes:h,viewBox:g,body:i}}const Fo=/\sid="(\S+)"/g,Lo="IconifyId"+Date.now().toString(16)+(Math.random()*16777216|0).toString(16);let Mo=0;function _o(e,s=Lo){const a=[];let n;for(;n=Fo.exec(e);)a.push(n[1]);if(!a.length)return e;const r="suffix"+(Math.random()*16777216|Date.now()).toString(16);return a.forEach(i=>{const l=typeof s=="function"?s(i):s+(Mo++).toString(),o=i.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");e=e.replace(new RegExp('([#;"])('+o+')([")]|\\.[a-z])',"g"),"$1"+l+r+"$3")}),e=e.replace(new RegExp(r,"g"),""),e}const Os=Object.create(null);function Ro(e,s){Os[e]=s}function zs(e){return Os[e]||Os[""]}function na(e){let s;if(typeof e.resources=="string")s=[e.resources];else if(s=e.resources,!(s instanceof Array)||!s.length)return null;return{resources:s,path:e.path||"/",maxURL:e.maxURL||500,rotate:e.rotate||750,timeout:e.timeout||5e3,random:e.random===!0,index:e.index||0,dataAfterTimeout:e.dataAfterTimeout!==!1}}const ra=Object.create(null),wt=["https://api.simplesvg.com","https://api.unisvg.com"],Gt=[];for(;wt.length>0;)wt.length===1||Math.random()>.5?Gt.push(wt.shift()):Gt.push(wt.pop());ra[""]=na({resources:["https://api.iconify.design"].concat(Gt)});function To(e,s){const a=na(s);return a===null?!1:(ra[e]=a,!0)}function ia(e){return ra[e]}const Io=()=>{let e;try{if(e=fetch,typeof e=="function")return e}catch{}};let Ha=Io();function Po(e,s){const a=ia(e);if(!a)return 0;let n;if(!a.maxURL)n=0;else{let r=0;a.resources.forEach(l=>{r=Math.max(r,l.length)});const i=s+".json?icons=";n=a.maxURL-r-a.path.length-i.length}return n}function Oo(e){return e===404}const zo=(e,s,a)=>{const n=[],r=Po(e,s),i="icons";let l={type:i,provider:e,prefix:s,icons:[]},o=0;return a.forEach((d,u)=>{o+=d.length+1,o>=r&&u>0&&(n.push(l),l={type:i,provider:e,prefix:s,icons:[]},o=d.length),l.icons.push(d)}),n.push(l),n};function Bo(e){if(typeof e=="string"){const s=ia(e);if(s)return s.path}return"/"}const Vo=(e,s,a)=>{if(!Ha){a("abort",424);return}let n=Bo(s.provider);switch(s.type){case"icons":{const i=s.prefix,o=s.icons.join(","),d=new URLSearchParams({icons:o});n+=i+".json?"+d.toString();break}case"custom":{const i=s.uri;n+=i.slice(0,1)==="/"?i.slice(1):i;break}default:a("abort",400);return}let r=503;Ha(e+n).then(i=>{const l=i.status;if(l!==200){setTimeout(()=>{a(Oo(l)?"abort":"next",l)});return}return r=501,i.json()}).then(i=>{if(typeof i!="object"||i===null){setTimeout(()=>{i===404?a("abort",i):a("next",r)});return}setTimeout(()=>{a("success",i)})}).catch(()=>{a("next",r)})},Uo={prepare:zo,send:Vo};function Gn(e,s){e.forEach(a=>{const n=a.loaderCallbacks;n&&(a.loaderCallbacks=n.filter(r=>r.id!==s))})}function Ho(e){e.pendingCallbacksFlag||(e.pendingCallbacksFlag=!0,setTimeout(()=>{e.pendingCallbacksFlag=!1;const s=e.loaderCallbacks?e.loaderCallbacks.slice(0):[];if(!s.length)return;let a=!1;const n=e.provider,r=e.prefix;s.forEach(i=>{const l=i.icons,o=l.pending.length;l.pending=l.pending.filter(d=>{if(d.prefix!==r)return!0;const u=d.name;if(e.icons[u])l.loaded.push({provider:n,prefix:r,name:u});else if(e.missing.has(u))l.missing.push({provider:n,prefix:r,name:u});else return a=!0,!0;return!1}),l.pending.length!==o&&(a||Gn([e],i.id),i.callback(l.loaded.slice(0),l.missing.slice(0),l.pending.slice(0),i.abort))})}))}let qo=0;function Wo(e,s,a){const n=qo++,r=Gn.bind(null,a,n);if(!s.pending.length)return r;const i={id:n,icons:s,callback:e,abort:r};return a.forEach(l=>{(l.loaderCallbacks||(l.loaderCallbacks=[])).push(i)}),r}function Yo(e){const s={loaded:[],missing:[],pending:[]},a=Object.create(null);e.sort((r,i)=>r.provider!==i.provider?r.provider.localeCompare(i.provider):r.prefix!==i.prefix?r.prefix.localeCompare(i.prefix):r.name.localeCompare(i.name));let n={provider:"",prefix:"",name:""};return e.forEach(r=>{if(n.name===r.name&&n.prefix===r.prefix&&n.provider===r.provider)return;n=r;const i=r.provider,l=r.prefix,o=r.name,d=a[i]||(a[i]=Object.create(null)),u=d[l]||(d[l]=bt(i,l));let f;o in u.icons?f=s.loaded:l===""||u.missing.has(o)?f=s.missing:f=s.pending;const m={provider:i,prefix:l,name:o};f.push(m)}),s}function Go(e,s=!0,a=!1){const n=[];return e.forEach(r=>{const i=typeof r=="string"?ls(r,s,a):r;i&&n.push(i)}),n}const Ko={resources:[],index:0,timeout:2e3,rotate:750,random:!1,dataAfterTimeout:!1};function Qo(e,s,a,n){const r=e.resources.length,i=e.random?Math.floor(Math.random()*r):e.index;let l;if(e.random){let M=e.resources.slice(0);for(l=[];M.length>1;){const k=Math.floor(Math.random()*M.length);l.push(M[k]),M=M.slice(0,k).concat(M.slice(k+1))}l=l.concat(M)}else l=e.resources.slice(i).concat(e.resources.slice(0,i));const o=Date.now();let d="pending",u=0,f,m=null,h=[],x=[];typeof n=="function"&&x.push(n);function g(){m&&(clearTimeout(m),m=null)}function j(){d==="pending"&&(d="aborted"),g(),h.forEach(M=>{M.status==="pending"&&(M.status="aborted")}),h=[]}function b(M,k){k&&(x=[]),typeof M=="function"&&x.push(M)}function w(){return{startTime:o,payload:s,status:d,queriesSent:u,queriesPending:h.length,subscribe:b,abort:j}}function N(){d="failed",x.forEach(M=>{M(void 0,f)})}function D(){h.forEach(M=>{M.status==="pending"&&(M.status="aborted")}),h=[]}function v(M,k,F){const C=k!=="success";switch(h=h.filter(_=>_!==M),d){case"pending":break;case"failed":if(C||!e.dataAfterTimeout)return;break;default:return}if(k==="abort"){f=F,N();return}if(C){f=F,h.length||(l.length?S():N());return}if(g(),D(),!e.random){const _=e.resources.indexOf(M.resource);_!==-1&&_!==e.index&&(e.index=_)}d="completed",x.forEach(_=>{_(F)})}function S(){if(d!=="pending")return;g();const M=l.shift();if(M===void 0){if(h.length){m=setTimeout(()=>{g(),d==="pending"&&(D(),N())},e.timeout);return}N();return}const k={status:"pending",resource:M,callback:(F,C)=>{v(k,F,C)}};h.push(k),u++,m=setTimeout(S,e.rotate),a(M,s,k.callback)}return setTimeout(S),w}function Kn(e){const s={...Ko,...e};let a=[];function n(){a=a.filter(o=>o().status==="pending")}function r(o,d,u){const f=Qo(s,o,d,(m,h)=>{n(),u&&u(m,h)});return a.push(f),f}function i(o){return a.find(d=>o(d))||null}return{query:r,find:i,setIndex:o=>{s.index=o},getIndex:()=>s.index,cleanup:n}}function qa(){}const gs=Object.create(null);function Zo(e){if(!gs[e]){const s=ia(e);if(!s)return;const a=Kn(s),n={config:s,redundancy:a};gs[e]=n}return gs[e]}function Xo(e,s,a){let n,r;if(typeof e=="string"){const i=zs(e);if(!i)return a(void 0,424),qa;r=i.send;const l=Zo(e);l&&(n=l.redundancy)}else{const i=na(e);if(i){n=Kn(i);const l=e.resources?e.resources[0]:"",o=zs(l);o&&(r=o.send)}}return!n||!r?(a(void 0,424),qa):n.query(s,r,a)().abort}function Wa(){}function Jo(e){e.iconsLoaderFlag||(e.iconsLoaderFlag=!0,setTimeout(()=>{e.iconsLoaderFlag=!1,Ho(e)}))}function ec(e){const s=[],a=[];return e.forEach(n=>{(n.match(Hn)?s:a).push(n)}),{valid:s,invalid:a}}function Nt(e,s,a){function n(){const r=e.pendingIcons;s.forEach(i=>{r&&r.delete(i),e.icons[i]||e.missing.add(i)})}if(a&&typeof a=="object")try{if(!Un(e,a).length){n();return}}catch(r){console.error(r)}n(),Jo(e)}function Ya(e,s){e instanceof Promise?e.then(a=>{s(a)}).catch(()=>{s(null)}):s(e)}function tc(e,s){e.iconsToLoad?e.iconsToLoad=e.iconsToLoad.concat(s).sort():e.iconsToLoad=s,e.iconsQueueFlag||(e.iconsQueueFlag=!0,setTimeout(()=>{e.iconsQueueFlag=!1;const{provider:a,prefix:n}=e,r=e.iconsToLoad;if(delete e.iconsToLoad,!r||!r.length)return;const i=e.loadIcon;if(e.loadIcons&&(r.length>1||!i)){Ya(e.loadIcons(r,n,a),f=>{Nt(e,r,f)});return}if(i){r.forEach(f=>{const m=i(f,n,a);Ya(m,h=>{const x=h?{prefix:n,icons:{[f]:h}}:null;Nt(e,[f],x)})});return}const{valid:l,invalid:o}=ec(r);if(o.length&&Nt(e,o,null),!l.length)return;const d=n.match(Hn)?zs(a):null;if(!d){Nt(e,l,null);return}d.prepare(a,n,l).forEach(f=>{Xo(a,f,m=>{Nt(e,f.icons,m)})})}))}const sc=(e,s)=>{const a=Go(e,!0,qn()),n=Yo(a);if(!n.pending.length){let d=!0;return s&&setTimeout(()=>{d&&s(n.loaded,n.missing,n.pending,Wa)}),()=>{d=!1}}const r=Object.create(null),i=[];let l,o;return n.pending.forEach(d=>{const{provider:u,prefix:f}=d;if(f===o&&u===l)return;l=u,o=f,i.push(bt(u,f));const m=r[u]||(r[u]=Object.create(null));m[f]||(m[f]=[])}),n.pending.forEach(d=>{const{provider:u,prefix:f,name:m}=d,h=bt(u,f),x=h.pendingIcons||(h.pendingIcons=new Set);x.has(m)||(x.add(m),r[u][f].push(m))}),i.forEach(d=>{const u=r[d.provider][d.prefix];u.length&&tc(d,u)}),s?Wo(s,n,i):Wa};function ac(e,s){const a={...e};for(const n in s){const r=s[n],i=typeof r;n in Wn?(r===null||r&&(i==="string"||i==="number"))&&(a[n]=r):i===typeof a[n]&&(a[n]=n==="rotate"?r%4:r)}return a}const nc=/[\s,]+/;function rc(e,s){s.split(nc).forEach(a=>{switch(a.trim()){case"horizontal":e.hFlip=!0;break;case"vertical":e.vFlip=!0;break}})}function ic(e,s=0){const a=e.replace(/^-?[0-9.]*/,"");function n(r){for(;r<0;)r+=4;return r%4}if(a===""){const r=parseInt(e);return isNaN(r)?0:n(r)}else if(a!==e){let r=0;switch(a){case"%":r=25;break;case"deg":r=90}if(r){let i=parseFloat(e.slice(0,e.length-a.length));return isNaN(i)?0:(i=i/r,i%1===0?n(i):0)}}return s}function lc(e,s){let a=e.indexOf("xlink:")===-1?"":' xmlns:xlink="http://www.w3.org/1999/xlink"';for(const n in s)a+=" "+n+'="'+s[n]+'"';return'<svg xmlns="http://www.w3.org/2000/svg"'+a+">"+e+"</svg>"}function oc(e){return e.replace(/"/g,"'").replace(/%/g,"%25").replace(/#/g,"%23").replace(/</g,"%3C").replace(/>/g,"%3E").replace(/\s+/g," ")}function cc(e){return"data:image/svg+xml,"+oc(e)}function dc(e){return'url("'+cc(e)+'")'}let Dt;function uc(){try{Dt=window.trustedTypes.createPolicy("iconify",{createHTML:e=>e})}catch{Dt=null}}function mc(e){return Dt===void 0&&uc(),Dt?Dt.createHTML(e):e}const Qn={...Yn,inline:!1},fc={xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink","aria-hidden":!0,role:"img"},xc={display:"inline-block"},Bs={backgroundColor:"currentColor"},Zn={backgroundColor:"transparent"},Ga={Image:"var(--svg)",Repeat:"no-repeat",Size:"100% 100%"},Ka={WebkitMask:Bs,mask:Bs,background:Zn};for(const e in Ka){const s=Ka[e];for(const a in Ga)s[e+a]=Ga[a]}const hc={...Qn,inline:!0};function Qa(e){return e+(e.match(/^[-0-9.]+$/)?"px":"")}const pc=(e,s,a)=>{const n=s.inline?hc:Qn,r=ac(n,s),i=s.mode||"svg",l={},o=s.style||{},d={...i==="svg"?fc:{}};if(a){const b=ls(a,!1,!0);if(b){const w=["iconify"],N=["provider","prefix"];for(const D of N)b[D]&&w.push("iconify--"+b[D]);d.className=w.join(" ")}}for(let b in s){const w=s[b];if(w!==void 0)switch(b){case"icon":case"style":case"children":case"onLoad":case"mode":case"ssr":case"fallback":break;case"_ref":d.ref=w;break;case"className":d[b]=(d[b]?d[b]+" ":"")+w;break;case"inline":case"hFlip":case"vFlip":r[b]=w===!0||w==="true"||w===1;break;case"flip":typeof w=="string"&&rc(r,w);break;case"color":l.color=w;break;case"rotate":typeof w=="string"?r[b]=ic(w):typeof w=="number"&&(r[b]=w);break;case"ariaHidden":case"aria-hidden":w!==!0&&w!=="true"&&delete d["aria-hidden"];break;default:n[b]===void 0&&(d[b]=w)}}const u=Eo(e,r),f=u.attributes;if(r.inline&&(l.verticalAlign="-0.125em"),i==="svg"){d.style={...l,...o},Object.assign(d,f);let b=0,w=s.id;return typeof w=="string"&&(w=w.replace(/-/g,"_")),d.dangerouslySetInnerHTML={__html:mc(_o(u.body,w?()=>w+"ID"+b++:"iconifyReact"))},p.createElement("svg",d)}const{body:m,width:h,height:x}=e,g=i==="mask"||(i==="bg"?!1:m.indexOf("currentColor")!==-1),j=lc(m,{...f,width:h+"",height:x+""});return d.style={...l,"--svg":dc(j),width:Qa(f.width),height:Qa(f.height),...xc,...g?Bs:Zn,...o},p.createElement("span",d)};qn(!0);Ro("",Uo);if(typeof document<"u"&&typeof window<"u"){const e=window;if(e.IconifyPreload!==void 0){const s=e.IconifyPreload,a="Invalid IconifyPreload syntax.";typeof s=="object"&&s!==null&&(s instanceof Array?s:[s]).forEach(n=>{try{(typeof n!="object"||n===null||n instanceof Array||typeof n.icons!="object"||typeof n.prefix!="string"||!No(n))&&console.error(a)}catch{console.error(a)}})}if(e.IconifyProviders!==void 0){const s=e.IconifyProviders;if(typeof s=="object"&&s!==null)for(let a in s){const n="IconifyProviders["+a+"] is invalid.";try{const r=s[a];if(typeof r!="object"||!r||r.resources===void 0)continue;To(a,r)||console.error(n)}catch{console.error(n)}}}}function Xn(e){const[s,a]=p.useState(!!e.ssr),[n,r]=p.useState({});function i(x){if(x){const g=e.icon;if(typeof g=="object")return{name:"",data:g};const j=Va(g);if(j)return{name:g,data:j}}return{name:""}}const[l,o]=p.useState(i(!!e.ssr));function d(){const x=n.callback;x&&(x(),r({}))}function u(x){if(JSON.stringify(l)!==JSON.stringify(x))return d(),o(x),!0}function f(){var x;const g=e.icon;if(typeof g=="object"){u({name:"",data:g});return}const j=Va(g);if(u({name:g,data:j}))if(j===void 0){const b=sc([g],f);r({callback:b})}else j&&((x=e.onLoad)===null||x===void 0||x.call(e,g))}p.useEffect(()=>(a(!0),d),[]),p.useEffect(()=>{s&&f()},[e.icon,s]);const{name:m,data:h}=l;return h?pc({...aa,...h},e,m):e.children?e.children:e.fallback?e.fallback:p.createElement("span",{})}const P=p.forwardRef((e,s)=>Xn({...e,_ref:s}));p.forwardRef((e,s)=>Xn({inline:!0,...e,_ref:s}));const B=p.forwardRef(({color:e="primary",radius:s="full",testId:a="veevart-button",...n},r)=>t.jsx(c.Button,{ref:r,color:e,radius:s,"data-testid":a,...n}));B.displayName="Button";function Jn({code:e,amount:s,onRemove:a,label:n="Gift Card",removeAriaLabel:r="Remove gift card",testId:i="veevart-applied-code-card"}){return t.jsx(c.Card,{"data-testid":i,shadow:"sm",className:"w-full",children:t.jsxs(c.CardBody,{className:"flex flex-row items-start justify-between gap-2 p-4",children:[t.jsxs("div",{className:"flex min-w-0 flex-col gap-1",children:[t.jsx("span",{className:"text-xs text-default-500",children: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:s})]}),t.jsx(B,{testId:`${i}-remove`,isIconOnly:!0,size:"sm",variant:"light","aria-label":r,onPress:a,children:t.jsx(P,{icon:"solar:close-circle-linear",className:"size-4","aria-hidden":"true"})})]})})}function bs(e,s){return e-s*Math.floor(e/s)}const er=1721426;function Bt(e,s,a,n){s=la(e,s);let r=s-1,i=-2;return a<=2?i=0:Kt(s)&&(i=-1),er-1+365*r+Math.floor(r/4)-Math.floor(r/100)+Math.floor(r/400)+Math.floor((367*a-362)/12+i+n)}function Kt(e){return e%4===0&&(e%100!==0||e%400===0)}function la(e,s){return e==="BC"?1-s:s}function gc(e){let s="AD";return e<=0&&(s="BC",e=1-e),[s,e]}const bc={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 os{fromJulianDay(s){let a=s,n=a-er,r=Math.floor(n/146097),i=bs(n,146097),l=Math.floor(i/36524),o=bs(i,36524),d=Math.floor(o/1461),u=bs(o,1461),f=Math.floor(u/365),m=r*400+l*100+d*4+f+(l!==4&&f!==4?1:0),[h,x]=gc(m),g=a-Bt(h,x,1,1),j=2;a<Bt(h,x,3,1)?j=0:Kt(x)&&(j=1);let b=Math.floor(((g+j)*12+373)/367),w=a-Bt(h,x,b,1)+1;return new Mt(h,x,b,w)}toJulianDay(s){return Bt(s.era,s.year,s.month,s.day)}getDaysInMonth(s){return bc[Kt(s.year)?"leapyear":"standard"][s.month-1]}getMonthsInYear(s){return 12}getDaysInYear(s){return Kt(s.year)?366:365}getMaximumMonthsInYear(){return 12}getMaximumDaysInMonth(){return 31}getYearsInEra(s){return 9999}getEras(){return["BC","AD"]}isInverseEra(s){return s.era==="BC"}balanceDate(s){s.year<=0&&(s.era=s.era==="BC"?"AD":"BC",s.year=1-s.year)}constructor(){this.identifier="gregory"}}function yc(e,s){var a,n,r,i;return(i=(r=(a=e.isEqual)===null||a===void 0?void 0:a.call(e,s))!==null&&r!==void 0?r:(n=s.isEqual)===null||n===void 0?void 0:n.call(s,e))!==null&&i!==void 0?i:e.identifier===s.identifier}function tr(e,s){return e.calendar.toJulianDay(e)-s.calendar.toJulianDay(s)}function sr(e,s){return Za(e)-Za(s)}function Za(e){return e.hour*36e5+e.minute*6e4+e.second*1e3+e.millisecond}let ys=null;function ar(){return ys==null&&(ys=new Intl.DateTimeFormat().resolvedOptions().timeZone),ys}function Xa(e){e=oa(e,new os);let s=la(e.era,e.year);return nr(s,e.month,e.day,e.hour,e.minute,e.second,e.millisecond)}function nr(e,s,a,n,r,i,l){let o=new Date;return o.setUTCHours(n,r,i,l),o.setUTCFullYear(e,s-1,a),o.getTime()}function Ja(e,s){if(s==="UTC")return 0;if(e>0&&s===ar())return new Date(e).getTimezoneOffset()*-6e4;let{year:a,month:n,day:r,hour:i,minute:l,second:o}=rr(e,s);return nr(a,n,r,i,l,o,0)-Math.floor(e/1e3)*1e3}const en=new Map;function rr(e,s){let a=en.get(s);a||(a=new Intl.DateTimeFormat("en-US",{timeZone:s,hour12:!1,era:"short",year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric"}),en.set(s,a));let n=a.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 tn=864e5;function vc(e,s,a,n){return(a===n?[a]:[a,n]).filter(i=>jc(e,s,i))}function jc(e,s,a){let n=rr(a,s);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,s,a="compatible"){let n=lr(e);if(s==="UTC")return Xa(n);if(s===ar()&&a==="compatible"){n=oa(n,new os);let d=new Date,u=la(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=Xa(n),i=Ja(r-tn,s),l=Ja(r+tn,s),o=vc(n,s,r-i,r-l);if(o.length===1)return o[0];if(o.length>1)switch(a){case"compatible":case"earlier":return o[0];case"later":return o[o.length-1];case"reject":throw new RangeError("Multiple possible absolute times found")}switch(a){case"earlier":return Math.min(r-i,r-l);case"compatible":case"later":return Math.max(r-i,r-l);case"reject":throw new RangeError("No such absolute time found")}}function ir(e,s,a="compatible"){return new Date(wc(e,s,a))}function lr(e,s){let a=0,n=0,r=0,i=0;if("timeZone"in e)({hour:a,minute:n,second:r,millisecond:i}=e);else if("hour"in e&&!s)return e;return s&&({hour:a,minute:n,second:r,millisecond:i}=s),new Jt(e.calendar,e.era,e.year,e.month,e.day,a,n,r,i)}function oa(e,s){if(yc(e.calendar,s))return e;let a=s.fromJulianDay(e.calendar.toJulianDay(e)),n=e.copy();return n.calendar=s,n.era=a.era,n.year=a.year,n.month=a.month,n.day=a.day,yt(n),n}function ca(e,s){let a=e.copy(),n="hour"in a?xr(a,s):0;Vs(a,s.years||0),a.calendar.balanceYearMonth&&a.calendar.balanceYearMonth(a,e),a.month+=s.months||0,Us(a),or(a),a.day+=(s.weeks||0)*7,a.day+=s.days||0,a.day+=n,Nc(a),a.calendar.balanceDate&&a.calendar.balanceDate(a),a.year<1&&(a.year=1,a.month=1,a.day=1);let r=a.calendar.getYearsInEra(a);if(a.year>r){var i,l;let d=(i=(l=a.calendar).isInverseEra)===null||i===void 0?void 0:i.call(l,a);a.year=r,a.month=d?1:a.calendar.getMonthsInYear(a),a.day=d?1:a.calendar.getDaysInMonth(a)}a.month<1&&(a.month=1,a.day=1);let o=a.calendar.getMonthsInYear(a);return a.month>o&&(a.month=o,a.day=a.calendar.getDaysInMonth(a)),a.day=Math.max(1,Math.min(a.calendar.getDaysInMonth(a),a.day)),a}function Vs(e,s){var a,n;!((a=(n=e.calendar).isInverseEra)===null||a===void 0)&&a.call(n,e)&&(s=-s),e.year+=s}function Us(e){for(;e.month<1;)Vs(e,-1),e.month+=e.calendar.getMonthsInYear(e);let s=0;for(;e.month>(s=e.calendar.getMonthsInYear(e));)e.month-=s,Vs(e,1)}function Nc(e){for(;e.day<1;)e.month--,Us(e),e.day+=e.calendar.getDaysInMonth(e);for(;e.day>e.calendar.getDaysInMonth(e);)e.day-=e.calendar.getDaysInMonth(e),e.month++,Us(e)}function or(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 yt(e){e.calendar.constrainDate&&e.calendar.constrainDate(e),e.year=Math.max(1,Math.min(e.calendar.getYearsInEra(e),e.year)),or(e)}function cr(e){let s={};for(let a in e)typeof e[a]=="number"&&(s[a]=-e[a]);return s}function dr(e,s){return ca(e,cr(s))}function ur(e,s){let a=e.copy();return s.era!=null&&(a.era=s.era),s.year!=null&&(a.year=s.year),s.month!=null&&(a.month=s.month),s.day!=null&&(a.day=s.day),yt(a),a}function mr(e,s){let a=e.copy();return s.hour!=null&&(a.hour=s.hour),s.minute!=null&&(a.minute=s.minute),s.second!=null&&(a.second=s.second),s.millisecond!=null&&(a.millisecond=s.millisecond),fr(a),a}function Cc(e){e.second+=Math.floor(e.millisecond/1e3),e.millisecond=Vt(e.millisecond,1e3),e.minute+=Math.floor(e.second/60),e.second=Vt(e.second,60),e.hour+=Math.floor(e.minute/60),e.minute=Vt(e.minute,60);let s=Math.floor(e.hour/24);return e.hour=Vt(e.hour,24),s}function fr(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 Vt(e,s){let a=e%s;return a<0&&(a+=s),a}function xr(e,s){return e.hour+=s.hours||0,e.minute+=s.minutes||0,e.second+=s.seconds||0,e.millisecond+=s.milliseconds||0,Cc(e)}function hr(e,s){let a=e.copy();return xr(a,s),a}function kc(e,s){return hr(e,cr(s))}function pr(e,s,a,n){let r=e.copy();switch(s){case"era":{let o=e.calendar.getEras(),d=o.indexOf(e.era);if(d<0)throw new Error("Invalid era: "+e.era);d=nt(d,a,0,o.length-1,n?.round),r.era=o[d],yt(r);break}case"year":var i,l;!((i=(l=r.calendar).isInverseEra)===null||i===void 0)&&i.call(l,r)&&(a=-a),r.year=nt(e.year,a,-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=nt(e.month,a,1,e.calendar.getMonthsInYear(e),n?.round);break;case"day":r.day=nt(e.day,a,1,e.calendar.getDaysInMonth(e),n?.round);break;default:throw new Error("Unsupported field "+s)}return e.calendar.balanceDate&&e.calendar.balanceDate(r),yt(r),r}function gr(e,s,a,n){let r=e.copy();switch(s){case"hour":{let i=e.hour,l=0,o=23;if(n?.hourCycle===12){let d=i>=12;l=d?12:0,o=d?23:11}r.hour=nt(i,a,l,o,n?.round);break}case"minute":r.minute=nt(e.minute,a,0,59,n?.round);break;case"second":r.second=nt(e.second,a,0,59,n?.round);break;case"millisecond":r.millisecond=nt(e.millisecond,a,0,999,n?.round);break;default:throw new Error("Unsupported field "+s)}return r}function nt(e,s,a,n,r=!1){if(r){e+=Math.sign(s),e<a&&(e=n);let i=Math.abs(s);s>0?e=Math.ceil(e/i)*i:e=Math.floor(e/i)*i,e>n&&(e=a)}else e+=s,e<a?e=n-(a-e-1):e>n&&(e=a+(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 s=e.match(Sc);if(!s)throw $c.test(e)?new Error(`Invalid ISO 8601 date string: ${e}. Use parseAbsolute() instead.`):new Error("Invalid ISO 8601 date string: "+e);let a=new Mt(vs(s[1],0,9999),vs(s[2],1,12),1);return a.day=vs(s[3],1,a.calendar.getDaysInMonth(a)),a}function vs(e,s,a){let n=Number(e);if(n<s||n>a)throw new RangeError(`Value out of range: ${s} <= ${n} <= ${a}`);return n}function br(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 yr(e){let s=oa(e,new os),a;return s.era==="BC"?a=s.year===1?"0000":"-"+String(Math.abs(1-s.year)).padStart(6,"00"):a=String(s.year).padStart(4,"0"),`${a}-${String(s.month).padStart(2,"0")}-${String(s.day).padStart(2,"0")}`}function Dc(e){return`${yr(e)}T${br(e)}`}function Ec(e,s){if(s.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function da(e,s,a){Ec(e,s),s.set(e,a)}function vr(e){let s=typeof e[0]=="object"?e.shift():new os,a;if(typeof e[0]=="string")a=e.shift();else{let l=s.getEras();a=l[l.length-1]}let n=e.shift(),r=e.shift(),i=e.shift();return[s,a,n,r,i]}var Fc=new WeakMap;class Mt{copy(){return this.era?new Mt(this.calendar,this.era,this.year,this.month,this.day):new Mt(this.calendar,this.year,this.month,this.day)}add(s){return ca(this,s)}subtract(s){return dr(this,s)}set(s){return ur(this,s)}cycle(s,a,n){return pr(this,s,a,n)}toDate(s){return ir(this,s)}toString(){return yr(this)}compare(s){return tr(this,s)}constructor(...s){da(this,Fc,{writable:!0,value:void 0});let[a,n,r,i,l]=vr(s);this.calendar=a,this.era=n,this.year=r,this.month=i,this.day=l,yt(this)}}var Lc=new WeakMap;class cs{copy(){return new cs(this.hour,this.minute,this.second,this.millisecond)}add(s){return hr(this,s)}subtract(s){return kc(this,s)}set(s){return mr(this,s)}cycle(s,a,n){return gr(this,s,a,n)}toString(){return br(this)}compare(s){return sr(this,s)}constructor(s=0,a=0,n=0,r=0){da(this,Lc,{writable:!0,value:void 0}),this.hour=s,this.minute=a,this.second=n,this.millisecond=r,fr(this)}}var Mc=new WeakMap;class Jt{copy(){return this.era?new Jt(this.calendar,this.era,this.year,this.month,this.day,this.hour,this.minute,this.second,this.millisecond):new Jt(this.calendar,this.year,this.month,this.day,this.hour,this.minute,this.second,this.millisecond)}add(s){return ca(this,s)}subtract(s){return dr(this,s)}set(s){return ur(mr(this,s),s)}cycle(s,a,n){switch(s){case"era":case"year":case"month":case"day":return pr(this,s,a,n);default:return gr(this,s,a,n)}}toDate(s,a){return ir(this,s,a)}toString(){return Dc(this)}compare(s){let a=tr(this,s);return a===0?sr(this,lr(s)):a}constructor(...s){da(this,Mc,{writable:!0,value:void 0});let[a,n,r,i,l]=vr(s);this.calendar=a,this.era=n,this.year=r,this.month=i,this.day=l,this.hour=s.shift()||0,this.minute=s.shift()||0,this.second=s.shift()||0,this.millisecond=s.shift()||0,yt(this)}}const _c="Open time options",Rc=320;function sn(e,s){return typeof s=="string"&&s.length>0?`${e} ${s}`:e}function js(e){if(!e)return null;const s="hour"in e&&typeof e.hour=="number"?e.hour:0,a="minute"in e&&typeof e.minute=="number"?e.minute:0,n="second"in e&&typeof e.second=="number"?e.second:0;return new cs(s,a,n)}function Tc(e,s){const a=new Date(2e3,0,1,e.hour,e.minute,e.second);return new Intl.DateTimeFormat("en-US",{hour:"numeric",minute:"2-digit",hour12:s===12}).format(a)}function Ic(e){const s=[];for(let a=0;a<24;a+=1)for(let n=0;n<60;n+=e)s.push(new cs(a,n));return s}function Pc(e){const{minuteStep:s=15,timeListClassName:a,timeListLabel:n=_c,selectorButtonProps:r,endContent:i,onChange:l,value:o,defaultValue:d,hourCycle:u=12,...f}=e,m=o!==void 0,[h,x]=p.useState(()=>js(d)),g=m?js(o):h,j=p.useMemo(()=>Ic(s),[s]),b=N=>{m||x(N),l?.(N)},w=t.jsxs(c.Popover,{placement:"bottom-end",children:[t.jsx(c.PopoverTrigger,{children:t.jsx(c.Button,{isIconOnly:!0,variant:"light","aria-label":n,...r,onPress:void 0,children:t.jsx(K.Clock3,{className:"size-4",strokeWidth:1.75})})}),t.jsx(c.PopoverContent,{className:"min-w-[8.5rem] p-0",children:t.jsx(c.ScrollShadow,{className:a??"max-h-64 py-1",children:t.jsx("div",{className:"flex flex-col p-1",children:j.map(N=>{const D=g?.hour===N.hour&&g?.minute===N.minute;return t.jsx(c.Button,{variant:D?"flat":"light",color:D?"primary":"default",className:"h-9 min-w-0 justify-start px-3",onPress:()=>b(N),children:Tc(N,u)},`${N.hour}:${N.minute}`)})})})})]});return t.jsx(c.TimeInput,{...f,value:m?g:void 0,defaultValue:m?void 0:d,hourCycle:u,endContent:t.jsxs("div",{className:"flex items-center gap-1",children:[i,w]}),onChange:N=>b(js(N))})}function ua(e){if(e.mode==="time")return t.jsx(Pc,{...e});if(e.mode==="datetime"){const{mode:r,granularity:i="minute",hideTimeZone:l=!0,calendarWidth:o=Rc,disableAnimation:d=!0,classNames:u,...f}=e;return t.jsx(c.DatePicker,{...f,calendarWidth:o,classNames:{...u,popoverContent:sn("min-w-[20rem]",u?.popoverContent),calendarContent:sn("min-h-[18rem]",u?.calendarContent)},disableAnimation:d,granularity:i,hideTimeZone:l})}const{mode:s,granularity:a="day",...n}=e;return t.jsx(c.DatePicker,{...n,granularity:a})}function Oc(e){const s=e?.closest('[role="dialog"]');return s?.parentElement??s??void 0}const He=p.forwardRef(({popoverProps:e,...s},a)=>{const n=p.useRef(null),[r,i]=p.useState(void 0),l={...e,disableDialogFocus:e?.disableDialogFocus??(r?!0:void 0),portalContainer:e?.portalContainer??r};return p.useEffect(()=>{i(Oc(n.current))},[]),t.jsx("span",{ref:n,className:"contents",children:t.jsx(c.Select,{ref:a,...s,popoverProps:l})})});He.displayName="Select";function zc({state:e,onSubmit:s,onRemove:a,appliedCredit:n,errorMessage:r,label:i="Gift Card",placeholder:l="GC-XXXX-XXXX-XXXX",applyLabel:o="Apply",removeAriaLabel:d="Remove gift card",testId:u="veevart-redeem-code-input"}){const[f,m]=p.useState(""),h=p.useId(),[x,g]=p.useState(e);e!==x&&(g(e),e==="applied"&&m(""));const j=()=>{const N=f.trim();N&&s(N)},b=N=>{N.key==="Enter"&&(N.preventDefault(),j())};if(e==="applied"&&n)return t.jsx("div",{"data-testid":u,children:t.jsx(Jn,{code:n.code,amount:n.amount,onRemove:a,removeAriaLabel:d,testId:`${u}-card`})});const w=e==="error"&&r!=null;return t.jsxs("div",{"data-testid":u,className:"flex flex-col gap-1",children:[t.jsxs("div",{className:"flex items-end gap-2",children:[t.jsx(c.Input,{"data-testid":`${u}-input`,label:i,labelPlacement:"outside",variant:"bordered",radius:"lg",classNames:{label:"text-xs text-default-500 group-data-[filled-within=true]:text-default-500 group-data-[filled-within=true]:-translate-y-[calc(100%_+_var(--heroui-font-size-small)/2_+_16px)]",inputWrapper:"border-small"},placeholder:l,value:f,onValueChange:m,onKeyDown:b,isDisabled:e==="loading",isInvalid:e==="error","aria-describedby":w?h:void 0}),t.jsx(B,{testId:`${u}-button`,isLoading:e==="loading",isDisabled:!f.trim(),onPress:j,children:o})]}),w&&t.jsx("p",{id:h,"data-testid":`${u}-error`,className:"text-tiny text-danger",children:r})]})}const Bc={login:"Login",logout:"Logout",selectLanguage:"Select your language"};function Vc({languages:e,selectedLanguage:s,onLanguageChange:a,label:n}){const r=e.find(i=>i.code===s);return t.jsx("div",{className:"flex items-center",children:t.jsxs("div",{className:"relative flex items-center",children:[t.jsx(He,{"data-testid":"language-select-desktop",variant:"bordered","aria-label":n,selectedKeys:s?[s]:[],onSelectionChange:i=>{const l=Array.from(i)[0]||s;a?.(l)},className:"min-w-36 hidden md:inline-flex",isDisabled:e.length===0,placeholder:n,startContent:t.jsx(K.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(c.SelectItem,{textValue:i.label,"data-testid":`language-select-option-${i.code}`,children:i.label},i.code))}),t.jsx(He,{"aria-label":n,"data-testid":"language-select-mobile",variant:"bordered",selectedKeys:s?[s]:[],onSelectionChange:i=>{const l=Array.from(i)[0]||s;a?.(l)},className:"w-24 inline-flex md:hidden",isDisabled:e.length===0,placeholder:"",startContent:t.jsx(K.Globe,{className:"w-6 h-6 text-black"}),renderValue:()=>t.jsx("span",{children:r?.code.toUpperCase()||""}),size:"md",radius:"full",children:e.map(i=>t.jsx(c.SelectItem,{textValue:i.code.toUpperCase(),"data-testid":`language-select-option-mobile-${i.code}`,children:i.code.toUpperCase()},i.code))})]})})}function Uc({isLoggedIn:e,onLogin:s,onLogout:a,labels:n}){return e?t.jsxs(B,{"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:a,size:"md",children:[t.jsx(K.User,{className:"inline w-5 h-5"}),t.jsx("span",{className:"hidden md:inline",children:n.logout})]}):t.jsxs(B,{"data-testid":"navbar-auth-button",className:"px-2 py-1 min-w-12 md:min-w-24 rounded-full bg-black text-white text-sm flex items-center",onPress:s,size:"md",children:[t.jsx(K.User,{className:"inline w-5 h-5"}),t.jsx("span",{className:"hidden md:inline",children:n.login})]})}function Hc({logo:e,languages:s=[],selectedLanguage:a,onLanguageChange:n,isLoggedIn:r,onLogin:i,onLogout:l,hasLanguages:o,hasAuth:d,labels:u={},className:f}){const m={...Bc,...u};return t.jsxs("nav",{"data-testid":"navbar",className:c.cn("w-full px-4 md:px-8 py-3 bg-white border-b border-zinc-100 flex items-center justify-between",f),children:[t.jsx("div",{className:"flex items-center min-w-10",children:e&&t.jsx("a",{href:"/",className:"block",children:t.jsx("img",{"data-testid":"navbar-logo",src:e,alt:"Logo",className:"h-8 w-auto max-w-28 md:max-w-40 object-contain"})})}),t.jsxs("div",{className:"flex items-center gap-2 md:gap-4",children:[(o||s.length>0)&&t.jsx(Vc,{languages:s,selectedLanguage:a,onLanguageChange:n,label:m.selectLanguage}),d&&t.jsx(Uc,{isLoggedIn:r,onLogin:i,onLogout:l,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(c.Alert,{description:"This template combines Navbar, Footer, and a confirmation Card. Include title, message, confirmation number, details list, icon, and action buttons. Use Card for the confirmation content.",title:"TODO: Implement ConfirmationPageTemplate",variant:"faded",className:"max-w-2xl"})})})}var ws;const Wc=typeof document<"u"?(ws=p.useInsertionEffect)!==null&&ws!==void 0?ws:p.useLayoutEffect:()=>{};function ds(e,s,a){let[n,r]=p.useState(e||s),i=p.useRef(n),l=p.useRef(e!==void 0),o=e!==void 0;p.useEffect(()=>{let m=l.current;m!==o&&process.env.NODE_ENV!=="production"&&console.warn(`WARN: A component changed from ${m?"controlled":"uncontrolled"} to ${o?"controlled":"uncontrolled"}.`),l.current=o},[o]);let d=o?e:n;Wc(()=>{i.current=d});let[,u]=p.useReducer(()=>({}),{}),f=p.useCallback((m,...h)=>{let x=typeof m=="function"?m(i.current):m;Object.is(i.current,x)||(i.current=x,r(x),u(),a?.(x,...h))},[a]);return[d,f]}function jr(e){return t.jsx("svg",{...e,fill:"none",stroke:"currentColor",strokeWidth:2,viewBox:"0 0 24 24",children:t.jsx(De.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 wr=p.forwardRef(({color:e="primary",variant:s="default",stepsCount:a=3,defaultStep:n=0,label:r,stepLabels:i,showStepLabelTooltip:l=!1,stepLabelTooltipPlacement:o="top",showStepCounter:d=!1,stepCounterPosition:u="right",layout:f="compact",stepCounterFormat:m,onStepChange:h,currentStep:x,hideProgressBars:g=!1,stepClassName:j,className:b,isDisabled:w=!1,...N},D)=>{const[v,S]=ds(x,n,h),M=p.useMemo(()=>{let k,F;const C=["[--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":k="[--step-color:var(--heroui-primary)]",F="[--step-fg-color:var(--heroui-primary-foreground)]";break;case"secondary":k="[--step-color:var(--heroui-secondary)]",F="[--step-fg-color:var(--heroui-secondary-foreground)]";break;case"success":k="[--step-color:var(--heroui-success)]",F="[--step-fg-color:var(--heroui-success-foreground)]";break;case"warning":k="[--step-color:var(--heroui-warning)]",F="[--step-fg-color:var(--heroui-warning-foreground)]";break;case"danger":k="[--step-color:var(--heroui-danger)]",F="[--step-fg-color:var(--heroui-danger-foreground)]";break;case"default":k="[--step-color:var(--heroui-default)]",F="[--step-fg-color:var(--heroui-default-foreground)]";break;default:k="[--step-color:var(--heroui-primary)]",F="[--step-fg-color:var(--heroui-primary-foreground)]";break}return C.unshift(F),C.unshift(k),C},[e]);return t.jsxs("nav",{ref:D,"aria-label":"Progress",className:c.cn("flex items-center overflow-x-auto",f==="spread"?"w-full justify-between gap-6":"max-w-fit gap-3",b),"data-testid":"stepper-root",...N,children:[d&&u==="left"?t.jsx("span",{className:"text-default-500 text-2xl whitespace-nowrap","data-testid":"stepper-counter",children:m?m(v+1,a):`Step ${v+1} of ${a}`}):null,r&&t.jsx("label",{className:"text-small text-default-foreground lg:text-medium font-light whitespace-nowrap me-3","data-testid":"stepper-label",children:r}),t.jsx("ol",{className:c.cn("flex flex-row flex-nowrap gap-x-3",M,b),"data-testid":"stepper-list",children:Array.from({length:a})?.map((k,F)=>{const C=v===F?"active":v<F?"inactive":"complete",_=s==="activeLabel"&&C==="active"&&!!i?.[F],E=l&&C!=="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(c.Tooltip,{content:E?i?.[F]:void 0,isDisabled:!E,offset:12,placement:o,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":C==="active"?"step":void 0,className:c.cn("group rounded-large flex w-full cursor-pointer flex-row items-center justify-center gap-x-3 py-2.5",{"rounded-full border border-(--active-border-color)/20 bg-(--active-border-color)/10 pl-2 pr-4 py-1.5":_},{"cursor-not-allowed opacity-50":w},j),onClick:()=>!w&&S(F),disabled:w,"data-testid":`stepper-step-btn-${F}`,children:[t.jsx("div",{className:"h-full relative flex items-center",children:t.jsx(De.LazyMotion,{features:De.domAnimation,children:t.jsx(De.m.div,{animate:C,className:"relative z-10",children:t.jsx(De.m.div,{animate:C,className:c.cn("border-medium text-large text-default-foreground relative z-10 flex h-[26px] w-[26px] shrink-0 items-center justify-center rounded-full font-semibold bg-white",{"border-(--complete-border-color) bg-(--complete-background-color) text-(--active-fg-color)":_,"bg-(--complete-background-color)":C==="complete","shadow-lg":C==="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:C==="complete"&&s==="default"?t.jsx(jr,{className:"h-5 w-5 text-(--active-fg-color)","data-testid":`stepper-step-check-${F}`}):t.jsx("span",{children:F+1})})})})})}),_?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<a-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:c.cn("bg-default-200 relative h-0.5 w-full transition-colors duration-300","after:absolute after:block after:h-full after:w-0 after:bg-(--active-border-color) after:transition-[width] after:duration-300 after:content-['']",{"after:w-full":F<v})})})]},F)})}),d&&u==="right"?t.jsx("span",{className:"text-default-500 text-2xl whitespace-nowrap","data-testid":"stepper-counter",children:m?m(v+1,a):`Step ${v+1} of ${a}`}):null]})});wr.displayName="Stepper";function Yc(e){return t.jsx("div",{className:"min-h-screen flex flex-col",children:t.jsx("div",{className:"flex-1 flex items-center justify-center p-12",children:t.jsx(c.Alert,{description:"This template combines Navbar, Stepper, Footer, and an event details Card. Include event image, category/spots chips, tags, details grid, and action buttons. Use Card, CardHeader, CardBody for content structure.",title:"TODO: Implement EventDetailsTemplate",variant:"faded",className:"max-w-2xl"})})})}function ge(e,s="en-US",a="USD"){try{return new Intl.NumberFormat(s,{style:"currency",currency:a}).format(e)}catch{return`${a} ${e.toFixed(2)}`}}function Rt(e,s="en-US"){try{const a=new Intl.NumberFormat(s,{style:"currency",currency:e}).resolvedOptions();return typeof a.maximumFractionDigits=="number"?a.maximumFractionDigits:2}catch{return 2}}function Nr(e,s,a="en-US"){const n=Rt(s,a),r=Math.pow(10,n);return Math.round(e*r)/r}function Hs(e,s,a,n){return Nr(e-s,a,n)}const an={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))"}},Gc="rgb(156 163 175)",Kc="rgb(107 114 128)",Cr=p.forwardRef(function({color:s="primary",steps:a=[],defaultStep:n=0,onStepChange:r,currentStep:i,hideProgressBars:l=!1,activeColor:o,activeForegroundColor:d,inactiveColor:u=Gc,inactiveLabelColor:f=Kc,activeStepVariant:m="bordered",stepClassName:h,circleClassName:x,progressBarClassName:g,labelsClassName:j,labelSlotClassName:b,activeLabelClassName:w,inactiveLabelClassName:N,className:D,ariaLabel:v="Progress",invalidLabelSuffix:S=", has errors",testId:M,isStepReachable:k,...F},C){const[_,E]=ds(i,n,r),A=an[s]??an.primary,R=o??A.active,O=d??A.fg,V=(q,I)=>{const W=q.ariaLabel??(typeof q.title=="string"?q.title:null)??`${I+1}`;return q.invalid?`${W}${S}`:W};return t.jsxs("nav",{...F,"aria-label":v,...M?{"data-testid":M}:{},children:[t.jsx("div",{className:c.cn("flex items-center",D),children:a?.map((q,I)=>{const J=I===_?"active":I<_?"complete":"inactive",W=k?k(I):!0;return t.jsxs(p.Fragment,{children:[t.jsx(B,{ref:C,isIconOnly:!0,disableAnimation:!0,radius:"full",variant:"light",testId:`${M??"horizontal-steps"}-step-${I}`,"aria-current":J==="active"?"step":void 0,"aria-describedby":q.describedBy,"aria-label":V(q,I),"data-invalid":q.invalid?"true":void 0,isDisabled:!W,className:c.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,h),onPress:()=>{if(i===void 0){E(I);return}r?.(I)},children:t.jsx(De.LazyMotion,{features:De.domAnimation,children:t.jsx(De.m.div,{animate:J,className:c.cn("relative flex size-8 items-center justify-center rounded-full text-[13px] font-medium",x),initial:!1,transition:{duration:.2},variants:{inactive:{backgroundColor:"transparent",borderColor:u,borderWidth:"1.5px",color:u},active:{backgroundColor:m==="solid"?R:"transparent",borderColor:R,borderWidth:"1.5px",color:m==="solid"?O:R},complete:{backgroundColor:R,borderColor:R,borderWidth:"1.5px",color:R}},children:J==="complete"?t.jsx(jr,{className:"size-4",style:{color:O}}):t.jsx("span",{children:I+1})})})}),I<a.length-1&&!l&&t.jsx("div",{"aria-hidden":!0,className:c.cn("mx-1 h-px w-6 shrink-0 transition-colors duration-300 sm:mx-1.5 sm:w-14 md:w-20",g),style:{backgroundColor:I<_?R:u}})]},I)})}),t.jsx("div",{className:c.cn("mt-2.5 hidden md:flex",j),children:a?.map((q,I)=>{const J=I<=_;return t.jsxs(p.Fragment,{children:[t.jsx("div",{className:c.cn("relative flex w-8 shrink-0 justify-center overflow-visible",b),children:t.jsx("span",{className:c.cn("absolute left-1/2 top-0 -translate-x-1/2 whitespace-nowrap text-center text-[12px] font-medium transition-colors duration-200",J?w:N),style:{color:J?R:f},children:q.title})}),I<a.length-1&&!l&&t.jsx("div",{className:c.cn("mx-1 w-6 shrink-0 sm:mx-1.5 sm:w-14 md:w-20",g)})]},I)})})]})});Cr.displayName="HorizontalSteps";function Qc(){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 Zc=e=>{const s=p.useMemo(()=>JSON.stringify({allItems:e.allItems,selected:e.selected}),[e.allItems,e.selected]);return t.jsx(Xc,{...e},s)},Xc=({allItems:e,selected:s,onSelectedChange:a,titleLeft:n,titleRight:r})=>{const[i,l]=p.useState([]),[o,d]=p.useState([]),[u,f]=p.useState(null),[m,h]=p.useState(null),x=p.useMemo(()=>new Set(s),[s]),g=p.useMemo(()=>new Set(e),[e]),j=p.useMemo(()=>e.filter(E=>!x.has(E)),[e,x]),b=E=>{if(E.length===0)return;const A=Array.from(new Set([...s,...E]));a(A)},w=E=>{if(E.length===0)return;const A=new Set(E);a(s.filter(R=>!A.has(R)))},N=()=>{i.length!==0&&(b(i),l([]))},D=()=>{o.length!==0&&(w(o),d([]))},v=()=>{j.length!==0&&(b(j),l([]))},S=()=>{s.length!==0&&(a([]),d([]))},M=(E,A,R)=>{const O=Math.min(A,R),V=Math.max(A,R);return E.slice(O,V+1)},k=(E,A,R)=>{if(R&&u!==null){l(M(j,u,A)),d([]),f(A);return}const O=i.includes(E);l(O?i.filter(V=>V!==E):[...i,E]),d([]),f(A)},F=(E,A,R)=>{if(R&&m!==null){d(M(s,m,A)),l([]),h(A);return}const O=o.includes(E);d(O?o.filter(V=>V!==E):[...o,E]),l([]),h(A)},C=(E,A,R)=>{const O=R==="available"?i.includes(A)?i:[A]:o.includes(A)?o:[A];E.dataTransfer.setData("text/plain",JSON.stringify({source:R,items:O})),E.dataTransfer.effectAllowed="move"},_=(E,A)=>{E.preventDefault();const R=E.dataTransfer.getData("text/plain");if(R)try{const O=JSON.parse(R),V=(O.items||[]).filter(q=>g.has(q));if(V.length===0||O.source===A)return;A==="selected"?(b(V),l([])):(w(V),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(c.Card,{className:"w-full border border-gray-200 shadow-none",children:t.jsx(c.CardBody,{className:"h-60 gap-2 overflow-y-auto",onDragOver:E=>E.preventDefault(),onDrop:E=>_(E,"available"),children:j.map((E,A)=>{const R=i.includes(E);return t.jsx("button",{type:"button",onClick:O=>{k(E,A,O.shiftKey)},onMouseDown:O=>{O.shiftKey&&O.preventDefault()},draggable:!0,onDragStart:O=>C(O,E,"available"),className:`rounded-md px-3 py-2 text-left text-sm transition ${R?"bg-[#E4571E]/10 text-[#E4571E]":"text-gray-700 hover:bg-gray-100"}`,children:E},E)})})})]}),t.jsxs("div",{className:"flex flex-row items-center justify-center gap-3 md:flex-col md:pt-6",children:[t.jsx(B,{variant:"light",className:"h-10 w-10 min-w-0 text-2xl font-semibold text-[#E4571E] hover:bg-[#E4571E]/10",isIconOnly:!0,"data-testid":"move-selected-to-available",onPress:N,isDisabled:i.length===0,"aria-label":"Move selected to right",children:"›"}),t.jsx(B,{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:D,isDisabled:o.length===0,"aria-label":"Move selected to left",children:"‹"}),t.jsx(B,{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:v,isDisabled:j.length===0,"aria-label":"Move all to right",children:"»"}),t.jsx(B,{variant:"light",className:"h-10 w-10 min-w-0 text-2xl font-semibold text-[#E4571E] hover:bg-[#E4571E]/10",isIconOnly:!0,onPress:S,"data-testid":"move-all-to-available",isDisabled:s.length===0,"aria-label":"Move all to left",children:"«"})]}),t.jsxs("div",{className:"flex w-full flex-col gap-3 md:w-2/5",children:[t.jsx("h2",{className:"text-sm font-medium text-gray-700",children:r}),t.jsx(c.Card,{className:"w-full border border-gray-200 shadow-none",children:t.jsx(c.CardBody,{className:"h-60 gap-2 overflow-y-auto",onDragOver:E=>E.preventDefault(),onDrop:E=>_(E,"selected"),children:s.map((E,A)=>{const R=o.includes(E);return t.jsx("button",{type:"button",onClick:O=>{F(E,A,O.shiftKey)},onMouseDown:O=>{O.shiftKey&&O.preventDefault()},draggable:!0,onDragStart:O=>C(O,E,"selected"),className:`rounded-md px-3 py-2 text-left text-sm transition ${R?"bg-[#E4571E]/10 text-[#E4571E]":"text-gray-700 hover:bg-gray-100"}`,children:E},E)})})})]})]})};function _t(e){return typeof e=="string"?e:e.type}function lt({className:e}){return t.jsx("div",{className:`flex items-center h-6 ${e||""}`,children:t.jsx(c.Divider,{orientation:"vertical"})})}function ot({icon:e,label:s,isActive:a=!1,isDisabled:n=!1,onClick:r,shortcut:i,iconSize:l=16,className:o}){const d=i?`${s} (${i})`:s;return t.jsx(c.Tooltip,{content:d,placement:"top",offset:10,children:t.jsx(B,{size:"sm",radius:"sm",color:a?"primary":"default",variant:a?"solid":"bordered",isIconOnly:!0,isDisabled:n,onPress:r,"aria-label":s,className:o,children:t.jsx(e,{size:l})})})}const Xe={bold:{execute:({editor:e})=>e.chain().focus().toggleBold().run(),canExecute:e=>e.can().chain().focus().toggleBold().run(),isActive:e=>e.isActive("bold"),shortcut:"Mod-b",label:"Bold"},italic:{execute:({editor:e})=>e.chain().focus().toggleItalic().run(),canExecute:e=>e.can().chain().focus().toggleItalic().run(),isActive:e=>e.isActive("italic"),shortcut:"Mod-i",label:"Italic"},strike:{execute:({editor:e})=>e.chain().focus().toggleStrike().run(),canExecute:e=>e.can().chain().focus().toggleStrike().run(),isActive:e=>e.isActive("strike"),shortcut:"Mod-Shift-x",label:"Strikethrough"},underline:{execute:({editor:e})=>e.chain().focus().toggleUnderline().run(),canExecute:e=>e.can().chain().focus().toggleUnderline().run(),isActive:e=>e.isActive("underline"),shortcut:"Mod-u",label:"Underline"},code:{execute:({editor:e})=>e.chain().focus().toggleCode().run(),canExecute:e=>e.can().chain().focus().toggleCode().run(),isActive:e=>e.isActive("code"),shortcut:"Mod-e",label:"Inline code"},textColor:{execute:({editor:e,config:s})=>{const a=s?.type==="textColor"?s.color:"";a?e.chain().focus().setColor(a).run():e.chain().focus().unsetColor().run()},canExecute:()=>!0,isActive:e=>e.isActive("textStyle"),label:"Text color"},highlight:{execute:({editor:e,config:s})=>{const a=s?.type==="highlight"?s.color:"";a?e.chain().focus().setHighlight({color:a}).run():e.chain().focus().unsetHighlight().run()},canExecute:()=>!0,isActive:e=>e.isActive("highlight"),label:"Highlight"},link:{execute:({editor:e,config:s})=>{const a=s?.type==="link"?s.href:"";if(a){const n=s?.type==="link"?s.target:void 0,r=s?.type==="link"?s.rel:void 0;e.chain().focus().setLink({href:a,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:s})=>{const a=s?.type==="heading"?s.level:1;e.chain().focus().toggleHeading({level:a}).run()},canExecute:(e,s)=>{const a=s?.type==="heading"?s.level:1;return e.can().chain().focus().toggleHeading({level:a}).run()},isActive:(e,s)=>s?.type==="heading"?e.isActive("heading",{level:s.level}):e.isActive("heading"),label:"Heading"},bulletList:{execute:({editor:e})=>e.chain().focus().toggleBulletList().run(),canExecute:e=>e.can().chain().focus().toggleBulletList().run(),isActive:e=>e.isActive("bulletList"),shortcut:"Mod-Shift-8",label:"Bullet list"},orderedList:{execute:({editor:e})=>e.chain().focus().toggleOrderedList().run(),canExecute:e=>e.can().chain().focus().toggleOrderedList().run(),isActive:e=>e.isActive("orderedList"),shortcut:"Mod-Shift-7",label:"Numbered list"},taskList:{execute:({editor:e})=>e.chain().focus().toggleTaskList().run(),canExecute:e=>e.can().chain().focus().toggleTaskList().run(),isActive:e=>e.isActive("taskList"),label:"Task list"},codeBlock:{execute:({editor:e})=>e.chain().focus().toggleCodeBlock().run(),canExecute:e=>e.can().chain().focus().toggleCodeBlock().run(),isActive:e=>e.isActive("codeBlock"),shortcut:"Mod-Alt-c",label:"Code block"},blockquote:{execute:({editor:e})=>e.chain().focus().toggleBlockquote().run(),canExecute:e=>e.can().chain().focus().toggleBlockquote().run(),isActive:e=>e.isActive("blockquote"),shortcut:"Mod-Shift-b",label:"Blockquote"},horizontalRule:{execute:({editor:e})=>e.chain().focus().setHorizontalRule().run(),canExecute:e=>e.can().chain().focus().setHorizontalRule().run(),isActive:()=>!1,label:"Horizontal rule"},hardBreak:{execute:({editor:e})=>e.chain().focus().setHardBreak().run(),canExecute:e=>e.can().chain().focus().setHardBreak().run(),isActive:()=>!1,shortcut:"Mod-Enter",label:"Line break"},textAlign:{execute:({editor:e,config:s})=>{const a=s?.type==="textAlign"?s.alignment:"left";e.chain().focus().setTextAlign(a).run()},canExecute:()=>!0,isActive:(e,s)=>s?.type==="textAlign"?e.isActive({textAlign:s.alignment}):!1,label:"Text alignment"},clearMarks:{execute:({editor:e})=>e.chain().focus().unsetAllMarks().run(),canExecute:e=>e.can().chain().focus().unsetAllMarks().run(),isActive:()=>!1,label:"Clear formatting"},clearNodes:{execute:({editor:e})=>e.chain().focus().clearNodes().run(),canExecute:e=>e.can().chain().focus().clearNodes().run(),isActive:()=>!1,label:"Clear nodes"},undo:{execute:({editor:e})=>e.chain().focus().undo().run(),canExecute:e=>e.can().chain().focus().undo().run(),isActive:()=>!1,shortcut:"Mod-z",label:"Undo"},redo:{execute:({editor:e})=>e.chain().focus().redo().run(),canExecute:e=>e.can().chain().focus().redo().run(),isActive:()=>!1,shortcut:"Mod-Shift-z",label:"Redo"}},Jc={1:"Heading 1",2:"Heading 2",3:"Heading 3",4:"Heading 4",5:"Heading 5",6:"Heading 6"};function ed({editor:e,levels:s=[1,2,3,4,5,6],isDisabled:a=!1}){const[,n]=p.useState(0);p.useEffect(()=>{const l=()=>n(o=>o+1);return e.on("selectionUpdate",l),e.on("transaction",l),()=>{e.off("selectionUpdate",l),e.off("transaction",l)}},[e]);const r=s.find(l=>e.isActive("heading",{level:l})),i=l=>{const o=Number(l),d=Xe.heading;d&&d.execute({editor:e,config:{type:"heading",level:o}})};return t.jsxs(c.Dropdown,{placement:"top-start",offset:10,children:[t.jsx(c.DropdownTrigger,{children:t.jsx(B,{size:"sm",radius:"sm",variant:r?"solid":"bordered",color:r?"primary":"default",isDisabled:a,startContent:t.jsx(K.Heading,{size:16}),"aria-label":"Select heading level",children:r?`H${r}`:"H"})}),t.jsx(c.DropdownMenu,{"aria-label":"Heading levels",selectionMode:"single",selectedKeys:r?new Set([String(r)]):new Set,onAction:i,children:s.map(l=>t.jsx(c.DropdownItem,{startContent:e.isActive("heading",{level:l})?t.jsx(K.Check,{size:16}):t.jsx("div",{className:"w-4"}),children:Jc[l]},l))})]})}const Ns={bulletList:{label:"Bullet List",icon:K.List},orderedList:{label:"Numbered List",icon:K.ListOrdered},taskList:{label:"Task List",icon:K.ListTodo}};function td({editor:e,types:s=["bulletList","orderedList","taskList"],isDisabled:a=!1}){const[,n]=p.useState(0);p.useEffect(()=>{const o=()=>n(d=>d+1);return e.on("selectionUpdate",o),e.on("transaction",o),()=>{e.off("selectionUpdate",o),e.off("transaction",o)}},[e]);const r=s.find(o=>e.isActive(o)),i=r?Ns[r].icon:K.List,l=o=>{const u=Xe[o];u&&u.execute({editor:e})};return t.jsxs(c.Dropdown,{placement:"top-start",offset:10,children:[t.jsx(c.DropdownTrigger,{children:t.jsx(B,{size:"sm",radius:"sm",variant:r?"solid":"bordered",color:r?"primary":"default",isDisabled:a,isIconOnly:!0,"aria-label":"Select list type",children:t.jsx(i,{size:16})})}),t.jsx(c.DropdownMenu,{"aria-label":"List types",selectionMode:"single",selectedKeys:r?new Set([r]):new Set,onAction:l,children:s.map(o=>{const d=Ns[o].icon;return t.jsx(c.DropdownItem,{startContent:t.jsx(d,{size:16}),children:Ns[o].label},o)})})]})}function sd({colors:e,selectedColor:s,onColorSelect:a,columns:n=4}){return t.jsx("div",{className:"grid gap-2",style:{gridTemplateColumns:`repeat(${n}, minmax(0, 1fr))`},children:e.map(r=>{const i=s===r;return t.jsx("button",{type:"button",onClick:()=>a(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
|
|
@@ -13,7 +13,7 @@ ${a}${n}
|
|
|
13
13
|
`,style:{backgroundColor:r},"aria-label":`Select color ${r}`,title:r},r)})})}const ad=["#000000","#374151","#6B7280","#EF4444","#F59E0B","#10B981","#3B82F6","#8B5CF6","#EC4899","#14B8A6","#F97316","#A855F7"],nd=["#FEF3C7","#DBEAFE","#D1FAE5","#FCE7F3","#E0E7FF","#FED7AA","#F3E8FF","#CCFBF1","#FEE2E2","#E5E7EB","#FAE8FF","#BFDBFE"];function Cs(e){return/^#([0-9A-F]{3}){1,2}$/i.test(e)}const Ce={min:50,max:200,step:10,default:100},nn={lineHeight:24,toolbarHeight:60},rd={bold:K.Bold,italic:K.Italic,strike:K.Strikethrough,underline:K.Underline,code:K.Code,textColor:K.Palette,highlight:K.Highlighter,link:K.Link2,paragraph:K.FileText,heading:K.Heading,bulletList:K.List,orderedList:K.ListOrdered,taskList:K.ListTodo,codeBlock:K.CodeSquare,blockquote:K.Quote,horizontalRule:K.Minus,clearMarks:K.Eraser,clearNodes:K.Eraser,undo:K.Undo2,redo:K.Redo2,hardBreak:K.CornerDownLeft,textAlign:K.AlignLeft},id={left:K.AlignLeft,center:K.AlignCenter,right:K.AlignRight,justify:K.AlignJustify};function pt(e){return rd[e]}function ld({value:e,onChange:s,onApply:a,placeholder:n="#000000"}){const[r,i]=p.useState(""),l=u=>{const f=u.target.value;s(f),r&&i("")},o=()=>{if(!e){i("Please enter a color");return}if(!Cs(e)){i("Invalid hex color (e.g., #FF0000)");return}i(""),a(e)},d=u=>{u.key==="Enter"&&(u.preventDefault(),o())};return t.jsxs("div",{className:"space-y-2",children:[t.jsxs("div",{className:"flex gap-2",children:[t.jsx(c.Input,{type:"text",value:e,onChange:l,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:Cs(e)?e:"transparent"}})}),t.jsx(B,{size:"sm",color:"primary",variant:"flat",isIconOnly:!0,onPress:o,"aria-label":"Apply custom color",isDisabled:!e||!Cs(e),children:t.jsx(K.Check,{size:16})})]}),t.jsx("p",{className:"text-xs text-default-500",children:"Enter a hex color code (e.g., #FF0000)"})]})}function rn({editor:e,type:s,allowCustomColor:a=!0,label:n,isDisabled:r=!1}){const[i,l]=p.useState(!1),[o,d]=p.useState(""),u=s==="textColor"?ad:nd,f=j=>{const b=Xe[s];b&&b.execute({editor:e,config:{type:s,color:j}}),l(!1),d("")},m=j=>{f(j)},h=()=>{const j=Xe[s];j&&j.execute({editor:e,config:{type:s,color:""}}),l(!1)},x=s==="textColor"?e.isActive("textStyle"):e.isActive("highlight"),g=s==="textColor"?K.Palette:K.Highlighter;return t.jsxs(c.Popover,{isOpen:i,onOpenChange:l,placement:"top",offset:10,showArrow:!0,children:[t.jsx(c.PopoverTrigger,{children:t.jsx(B,{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(c.PopoverContent,{className:"w-64",children:t.jsxs("div",{className:"px-2 py-3 space-y-3",children:[t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsx("span",{className:"text-sm font-semibold",children:n}),t.jsx(B,{size:"sm",variant:"light",isIconOnly:!0,onPress:h,"aria-label":"Clear color",children:t.jsx(K.X,{size:16})})]}),t.jsx(sd,{colors:u,onColorSelect:f}),a&&t.jsxs(t.Fragment,{children:[t.jsx(c.Divider,{}),t.jsxs("div",{children:[t.jsx("p",{className:"text-xs font-semibold mb-2 text-default-700",children:"Custom Color"}),t.jsx(ld,{value:o,onChange:d,onApply:m})]})]})]})})]})}function od({zoom:e,onZoomChange:s,min:a=Ce.min,max:n=Ce.max,step:r=Ce.step}){const i=()=>{const m=Math.max(a,e-r);s(m)},l=()=>{const m=Math.min(n,e+r);s(m)},o=()=>{s(Ce.default)},d=e<=a,u=e>=n,f=e===Ce.default;return t.jsxs("div",{className:"flex items-center gap-1",children:[t.jsx(c.Tooltip,{content:"Zoom out",placement:"top",offset:10,children:t.jsx(B,{size:"sm",radius:"sm",color:"default",variant:"bordered",isIconOnly:!0,isDisabled:d,onPress:i,"aria-label":"Zoom out",children:t.jsx(K.ZoomOut,{size:16})})}),t.jsx(c.Tooltip,{content:f?"Zoom percentage":"Click to reset zoom",placement:"top",offset:10,children:t.jsxs("button",{type:"button",onClick:o,disabled:f,className:`
|
|
14
14
|
text-xs text-default-500 min-w-[3ch] text-center px-2
|
|
15
15
|
${f?"cursor-default":"cursor-pointer hover:text-primary"}
|
|
16
|
-
`,"aria-label":`Zoom level ${e}%`,children:[e,"%"]})}),t.jsx(c.Tooltip,{content:"Zoom in",placement:"top",offset:10,children:t.jsx(B,{size:"sm",radius:"sm",color:"default",variant:"bordered",isIconOnly:!0,isDisabled:u,onPress:l,"aria-label":"Zoom in",children:t.jsx(K.ZoomIn,{size:16})})})]})}function cd({editor:e,isDisabled:s=!1}){const[a,n]=p.useState(!1),[r,i]=p.useState(""),[l,o]=p.useState(""),[d,u]=p.useState(!1),f=e.isActive("link"),m=x=>{if(x){const{from:g,to:j}=e.state.selection,b=e.isActive("link");let w="";if(b){const $=e.schema.marks.link,v=e.state.doc.resolve(g),A=Pa.getMarkRange(v,$);A&&(w=e.state.doc.textBetween(A.from,A.to,""))}else w=e.state.doc.textBetween(g,j,"");const N=e.getAttributes("link").href||"";i(w),o(N),u(b)}n(x)},h=()=>{if(l.trim()){const{from:x,to:g}=e.state.selection,j=e.schema.marks.link,b=e.state.doc.resolve(x),w=Pa.getMarkRange(b,j),N=w?.from??x,$=w?.to??g,v=e.state.doc.textBetween(N,$,"");r.trim()&&r!==v?e.chain().focus().setTextSelection({from:N,to:$}).deleteSelection().insertContent(`<a href="${l.trim()}">${r.trim()}</a>`).run():e.chain().focus().extendMarkRange("link").updateAttributes("link",{href:l.trim()}).run()}n(!1)};return t.jsxs(c.Popover,{isOpen:a,onOpenChange:m,placement:"bottom",children:[t.jsx(c.PopoverTrigger,{children:t.jsx(B,{size:"sm",radius:"sm",variant:f?"solid":"bordered",color:f?"primary":"default",isIconOnly:!0,isDisabled:s,"aria-label":"Link",children:t.jsx(K.Link,{size:16})})}),t.jsx(c.PopoverContent,{children:t.jsxs("div",{className:"flex flex-col gap-3 p-3 w-72",children:[t.jsx(c.Input,{size:"sm",variant:"bordered",label:"Name",labelPlacement:"outside",placeholder:"Link text",value:r,onChange:x=>i(x.target.value),classNames:{inputWrapper:"focus-within:border-default-400"}}),t.jsx(c.Input,{size:"sm",variant:"bordered",label:"Link",labelPlacement:"outside",placeholder:"https://example.com",value:l,onChange:x=>o(x.target.value),onKeyDown:x=>x.key==="Enter"&&h(),classNames:{inputWrapper:"focus-within:border-default-400"}}),t.jsx(B,{size:"sm",color:"primary",onPress:h,isDisabled:!l.trim(),children:d?"Update":"Apply"})]})})]})}function dd({children:e,id:s,label:a,className:n,useButtonGroup:r=!0}){return r?t.jsx(c.ButtonGroup,{size:"sm",id:s,"aria-label":a,className:n,children:e}):t.jsx("div",{id:s,role:"group","aria-label":a,className:`flex items-center gap-2 ${n||""}`,children:e})}function kr(e,s){const a=p.useMemo(()=>{if(!e)return{};const i={};return Array.from(new Set(s.map(o=>_t(o)))).forEach(o=>{const d=Xe[o];if(d)try{const u=d.canExecute?.(e)??!0,f=d.isActive?.(e)??!1;i[o]={isActive:f,isDisabled:!u,canExecute:u}}catch(u){console.warn(`Extension not available for modifier: ${o}`,u),i[o]={isActive:!1,isDisabled:!0,canExecute:!1}}}),i},[e,s]),[n,r]=p.useState(a);return p.useEffect(()=>{if(!e)return;const i=()=>{const l={};Array.from(new Set(s.map(d=>_t(d)))).forEach(d=>{const u=Xe[d];if(u)try{const f=u.canExecute?.(e)??!0,m=u.isActive?.(e)??!1;l[d]={isActive:m,isDisabled:!f,canExecute:f}}catch(f){console.warn(`Extension not available for modifier: ${d}`,f),l[d]={isActive:!1,isDisabled:!0,canExecute:!1}}}),r(l)};return e.on("selectionUpdate",i),e.on("transaction",i),()=>{e.off("selectionUpdate",i),e.off("transaction",i)}},[e,s,a]),n}function Sr(e,s){const a=p.useCallback((l,o)=>{if(!e)return;const d=Xe[l];if(d)try{d.execute({editor:e,config:o}),s?.({type:"toggle",modifier:l})}catch(u){console.warn(`Failed to execute command for modifier: ${l}`,u)}},[e,s]),n=p.useCallback(l=>{a(l)},[a]),r=p.useCallback((l,o)=>{if(!e)return!1;const d=Xe[l];try{return d?.canExecute?.(e,o)??!1}catch(u){return console.warn(`Failed to check canExecute for modifier: ${l}`,u),!1}},[e]),i=p.useCallback((l,o)=>{if(!e)return!1;const d=Xe[l];try{return d?.isActive?.(e,o)??!1}catch(u){return console.warn(`Failed to check isActive for modifier: ${l}`,u),!1}},[e]);return{executeCommand:a,toggleModifier:n,canExecute:r,isActive:i}}function ud(e=Ce.default){const[s,a]=p.useState(e),n=p.useCallback((o=Ce.step)=>{a(d=>Math.min(Ce.max,d+o))},[]),r=p.useCallback((o=Ce.step)=>{a(d=>Math.max(Ce.min,d-o))},[]),i=p.useCallback(()=>{a(Ce.default)},[]),l=p.useCallback(o=>{const d=Math.max(Ce.min,Math.min(Ce.max,o));a(d)},[]);return{zoom:s,setZoom:l,zoomIn:n,zoomOut:r,resetZoom:i,isMinZoom:s<=Ce.min,isMaxZoom:s>=Ce.max,isDefaultZoom:s===Ce.default}}const md=["bold","italic","strike","underline","code"];function fd({editor:e,modifiers:s,onToolbarAction:a}){const n=kr(e,s),{toggleModifier:r}=Sr(e,a);if(!e)return null;const i=s.map(l=>_t(l)).filter(l=>md.includes(l));return i.length===0?null:t.jsx(dd,{id:"text-formatting",label:"Text formatting",children:i.map(l=>{const o=n[l],d=pt(l);return t.jsx(ot,{icon:d,label:l.charAt(0).toUpperCase()+l.slice(1),isActive:o?.isActive,isDisabled:o?.isDisabled,onClick:()=>r(l)},l)})})}function xd({editor:e,modifiers:s,zoom:a=100,onZoomChange:n,sticky:r=!0,className:i,onToolbarAction:l}){const o=kr(e,s),{toggleModifier:d,executeCommand:u}=Sr(e,l);if(!e)return null;const f=s.map(k=>_t(k)),m=f.some(k=>["bold","italic","strike","underline","code"].includes(k)),h=f.some(k=>["textColor","highlight"].includes(k)),x=f.includes("heading"),g=f.includes("textAlign"),j=f.some(k=>["bulletList","orderedList","taskList"].includes(k)),b=f.includes("blockquote"),w=f.includes("codeBlock"),N=f.includes("link"),$=f.includes("horizontalRule"),v=f.some(k=>["undo","redo"].includes(k)),A=a!==void 0&&n!==void 0,M=r?"sticky top-0 z-10":"";return t.jsx("div",{className:`w-full p-2 bg-background border-b border-divider ${M} ${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(fd,{editor:e,modifiers:s,onToolbarAction:l}),(h||x||g||j||b||w||N||$||v||A)&&t.jsx(lt,{})]}),h&&t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"flex items-center gap-1",children:[f.includes("textColor")&&t.jsx(rn,{editor:e,type:"textColor",label:"Text color",isDisabled:o.textColor?.isDisabled}),f.includes("highlight")&&t.jsx(rn,{editor:e,type:"highlight",label:"Highlight",isDisabled:o.highlight?.isDisabled})]}),(x||g||j||b||w||N||$||v||A)&&t.jsx(lt,{})]}),x&&t.jsxs(t.Fragment,{children:[t.jsx(ed,{editor:e}),(g||j||b||w||N||$||v||A)&&t.jsx(lt,{})]}),g&&t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"flex items-center gap-1",children:["left","center","right","justify"].map(k=>{const F=id[k],C=e.isActive({textAlign:k});return t.jsx(ot,{icon:F,label:`Align ${k}`,isActive:C,onClick:()=>u("textAlign",{type:"textAlign",alignment:k})},k)})}),(j||b||w||N||$||v||A)&&t.jsx(lt,{})]}),j&&t.jsxs(t.Fragment,{children:[t.jsx(td,{editor:e,types:f.filter(k=>["bulletList","orderedList","taskList"].includes(k))}),(b||w||N||$||v||A)&&t.jsx(lt,{})]}),(b||w||N||$)&&t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"flex items-center gap-1",children:[b&&t.jsx(ot,{icon:pt("blockquote"),label:"Blockquote",isActive:o.blockquote?.isActive,isDisabled:o.blockquote?.isDisabled,onClick:()=>d("blockquote")}),w&&t.jsx(ot,{icon:pt("codeBlock"),label:"Code block",isActive:o.codeBlock?.isActive,isDisabled:o.codeBlock?.isDisabled,onClick:()=>d("codeBlock")}),N&&t.jsx(cd,{editor:e,isDisabled:o.link?.isDisabled}),$&&t.jsx(ot,{icon:pt("horizontalRule"),label:"Horizontal rule",onClick:()=>d("horizontalRule")})]}),(v||A)&&t.jsx(lt,{})]}),v&&t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"flex items-center gap-1",children:[f.includes("undo")&&t.jsx(ot,{icon:pt("undo"),label:"Undo",isDisabled:o.undo?.isDisabled,onClick:()=>d("undo")}),f.includes("redo")&&t.jsx(ot,{icon:pt("redo"),label:"Redo",isDisabled:o.redo?.isDisabled,onClick:()=>d("redo")})]}),A&&t.jsx(lt,{})]}),A&&t.jsx(od,{zoom:a,onZoomChange:k=>{n?.(k),l?.({type:"zoom",modifier:`${k}%`})}})]})})}const Ct={bold:{category:"mark",extension:zl.Bold,priority:100},italic:{category:"mark",extension:Bl.Italic,priority:100},strike:{category:"mark",extension:Vl.Strike,priority:100},underline:{category:"mark",extension:Ul.Underline,priority:100},code:{category:"mark",extension:Hl.Code,priority:100},textColor:{category:"mark",extension:ql.Color,defaultOptions:{types:["textStyle","heading","paragraph","listItem","taskItem","blockquote"]},priority:90},highlight:{category:"mark",extension:Wl.Highlight,defaultOptions:{multicolor:!0},priority:90},link:{category:"mark",extension:Yl.Link,defaultOptions:{autolink:!0,linkOnPaste:!0,openOnClick:!1,HTMLAttributes:{class:"text-primary underline cursor-pointer"}},priority:100},heading:{category:"node",extension:Kl.Heading,defaultOptions:{levels:[1,2,3,4,5,6]},priority:100},bulletList:{category:"node",extension:Zl.BulletList,defaultOptions:{HTMLAttributes:{class:"list-disc"}},priority:90},orderedList:{category:"node",extension:Xl.OrderedList,defaultOptions:{HTMLAttributes:{class:"list-decimal"}},priority:90},taskList:{category:"node",extension:Jl.TaskList,defaultOptions:{HTMLAttributes:{class:"task-list"}},priority:90},codeBlock:{category:"node",extension:so.CodeBlock,priority:100},blockquote:{category:"node",extension:ao.Blockquote,priority:100},horizontalRule:{category:"node",extension:no.HorizontalRule,priority:100},hardBreak:{category:"node",extension:ro.HardBreak,priority:100},undo:{category:"extension",extension:Oa.History,priority:50},redo:{category:"extension",extension:Oa.History,priority:50},textAlign:{category:"extension",extension:io.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}},hd=[lo.Document,oo.Text,Ql.Paragraph,Gl.TextStyle.configure({HTMLAttributes:{}}),to.ListItem.configure({HTMLAttributes:{}}),eo.TaskItem.configure({nested:!0}),co.Dropcursor,uo.Gapcursor];function pd(e){const s=[],a=new Set,n=new Set;hd.forEach(o=>{o&&(s.push(o),n.add(o.name))});const r=e.map(o=>_t(o)),i=new Set;return r.forEach(o=>{const d=Ct[o];d?.requiredExtensions&&d.requiredExtensions.forEach(u=>{i.add(u)})}),i.forEach(o=>{if(a.has(o))return;const d=Ct[o];if(!d||d.extension===null)return;const u=d.extension.name;if(n.has(u)){a.add(o);return}const f=d.defaultOptions?d.extension.configure(d.defaultOptions):d.extension;s.push(f),a.add(o),n.add(u)}),r.forEach(o=>{if(a.has(o))return;const d=Ct[o];if(!d){console.warn(`Extension config not found for modifier: ${o}`);return}if(d.extension===null){a.add(o);return}const u=d.extension.name;if(n.has(u)){a.add(o);return}const f=d.defaultOptions?d.extension.configure(d.defaultOptions):d.extension;s.push(f),a.add(o),n.add(u)}),s.sort((o,d)=>{const u=Object.values(Ct).find(x=>x?.extension?.name===o.name),f=Object.values(Ct).find(x=>x?.extension?.name===d.name),m=u?.priority??100;return(f?.priority??100)-m})}const $r={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"]},gd={h1:`font-size: ${fe.fontSize["4xl"]}; font-weight: ${fe.fontWeight.semibold}; line-height: ${fe.lineHeight.tight}; margin: ${ue.md} 0 ${ue.sm} 0;`,h2:`font-size: ${fe.fontSize["2xl"]}; font-weight: ${fe.fontWeight.semibold}; line-height: ${fe.lineHeight.tight}; margin: ${ue.md} 0 ${ue.sm} 0;`,h3:`font-size: ${fe.fontSize.xl}; font-weight: ${fe.fontWeight.semibold}; line-height: ${fe.lineHeight.tight}; margin: ${ue.md} 0 ${ue.sm} 0;`,h4:`font-size: ${fe.fontSize.lg}; font-weight: ${fe.fontWeight.semibold}; line-height: ${fe.lineHeight.tight}; margin: ${ue.md} 0 ${ue.sm} 0;`,h5:`font-size: ${fe.fontSize.base}; font-weight: ${fe.fontWeight.semibold}; line-height: ${fe.lineHeight.tight}; margin: ${ue.md} 0 ${ue.sm} 0;`,h6:`font-size: ${fe.fontSize.sm}; font-weight: ${fe.fontWeight.semibold}; line-height: ${fe.lineHeight.tight}; margin: ${ue.md} 0 ${ue.sm} 0;`,p:`min-height: ${fe.lineHeight.normal}em; margin: 0;`,ul:`list-style-type: disc; list-style-position: outside; padding-left: ${ue.xl}; margin: ${ue.md} 0;`,ol:`list-style-type: decimal; list-style-position: outside; padding-left: ${ue.xl}; margin: ${ue.md} 0;`,li:`display: list-item; margin: ${ue.xs} 0;`,strong:`font-weight: ${fe.fontWeight.bold};`,em:"font-style: italic;",s:"text-decoration: line-through;",u:"text-decoration: underline;",code:`background-color: ${we.neutral.gray[100]}; border-radius: 0.4rem; font-size: ${fe.fontSize.sm}; padding: 0.25em 0.3em; font-family: ${fe.fontFamily.mono};`,pre:`background: ${we.neutral.gray[800]}; border-radius: ${ue.sm}; color: ${we.neutral.gray[100]}; font-family: ${fe.fontFamily.mono}; margin: ${ue.lg} 0; padding: 0.75rem ${ue.md}; overflow-x: auto;`,blockquote:`border-left: 3px solid ${we.neutral.gray[300]}; margin: ${ue.lg} 0; padding-left: ${ue.md}; color: ${we.neutral.gray[500]};`,hr:`border: none; border-top: 1px solid ${we.neutral.gray[200]}; margin: ${ue.xl} 0;`,a:`color: ${we.brand.primary.DEFAULT}; text-decoration: underline; cursor: pointer;`,mark:`background-color: ${we.palettes.warning[200]}; border-radius: ${ue.xs}; padding: 0 0.125rem;`,label:`display: flex; align-items: center; gap: ${ue.sm}; cursor: pointer;`,input:"cursor: pointer; margin: 0;"},bd={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 yd(e){if(!e)return e;let s=e;for(const[a,n]of Object.entries(bd)){const r=new RegExp(`(<(?:ul|li)[^>]*data-type="${a}"[^>]*)>`,"gi");s=s.replace(r,(i,l)=>i.includes('style="')?i.replace(/style="([^"]*)"/,`style="$1 ${n}"`):`${l} style="${n}">`)}for(const[a,n]of Object.entries(gd)){const r=new RegExp(`<${a}(\\s[^>]*)?>`,"gi");s=s.replace(r,i=>{if(i.includes('data-type="taskList"')||i.includes('data-type="taskItem"'))return i;if(i.includes('style="'))return i.replace(/style="([^"]*)"/,`style="$1 ${n}"`);if(i.includes("style='"))return i.replace(/style='([^']*)'/,`style='$1 ${n}'`);{const l=i.indexOf(">");return`${i.slice(0,l)} style="${n}"${i.slice(l)}`}})}return s}const vd=({modifiers:e,zoom:s,onZoomChange:a,onToolbarAction:n})=>{const{editor:r}=ta.useCurrentEditor();return t.jsx(xd,{editor:r,modifiers:e,zoom:s,onZoomChange:a,onToolbarAction:n})},jd=({showCharacterCount:e,showWordCount:s})=>{const{editor:a}=ta.useCurrentEditor();if(!a||!e&&!s)return null;const n=a.getText(),r=n.length,i=n.split(/\s+/).filter(l=>l.length>0).length;return t.jsxs("div",{className:"flex gap-4 text-xs text-default-500 px-2 pb-1",children:[e&&t.jsxs("span",{children:[r," characters"]}),s&&t.jsxs("span",{children:[i," words"]})]})},qs=p.forwardRef((e,s)=>{const{minRows:a=10,maxRows:n=30,disableAutosize:r=!1,showCharacterCount:i=!1,showWordCount:l=!1,showToolbar:o=!0,modifiers:d=$r.full,variant:u="bordered",initialContent:f,content:m,onContentChange:h,onUpdate:x,onToolbarAction:g,isReadOnly:j=!1,isDisabled:b=!1,includeInlineStyles:w=!0,...N}=e,{zoom:$,setZoom:v}=ud(),A=nn.lineHeight,M=a*A,k=r?void 0:n*A,F=p.useMemo(()=>pd(d),[d]),{Component:C,label:_,shouldLabelBeOutside:E,getBaseProps:D,getLabelProps:R,getInputWrapperProps:O}=c.useInput({...N,variant:u,ref:s,isMultiline:!0}),V=_?t.jsx("label",{...R(),children:_}):null,q=p.useCallback(({editor:I})=>{const J=I.getHTML(),W=w?yd(J):J,se=I.getJSON(),Y=I.getText(),Z=Y.length,Q=Y.split(/\s+/).filter(ne=>ne.length>0).length,ee={html:W,json:se,text:Y,characters:Z,words:Q};if(h?.(ee),x?.(ee),"onChange"in N&&typeof N.onChange=="function"){const ne={target:{value:W},currentTarget:{value:W}};N.onChange(ne)}},[h,x,N,w]);return t.jsxs(C,{...D(),children:[E?V:null,t.jsx("div",{...O(),className:c.cn(O().className,"flex flex-col w-full p-0 gap-0 rich-text-editor"),style:{maxHeight:k?`${k+nn.toolbarHeight}px`:void 0,overflow:k?"auto":void 0},children:t.jsx(ta.EditorProvider,{editable:!j&&!b,slotBefore:o?t.jsx(vd,{modifiers:d,zoom:$,onZoomChange:v,onToolbarAction:g}):void 0,slotAfter:t.jsx(jd,{showCharacterCount:i,showWordCount:l}),editorContainerProps:{className:"w-full flex-1 outline-none",style:{minHeight:`${M}px`,fontSize:`${$}%`,display:"flex",flexDirection:"column"}},editorProps:{attributes:{class:"focus:outline-none w-full h-full"}},extensions:F,content:m||f||e.defaultValue||"",onUpdate:q})})]})});qs.displayName="TipTapEditor";const Ar=p.forwardRef((e,s)=>{const{adapter:a="tiptap",variant:n="bordered",...r}=e;return a==="tiptap"?t.jsx(qs,{...r,variant:n,ref:s}):(console.warn(`Adapter "${a}" is not supported. Using TipTap.`),t.jsx(qs,{...r,variant:n,ref:s}))});Ar.displayName="RichTextArea";function wd(e,s="en-US",a="USD"){try{return new Intl.NumberFormat(s,{style:"currency",currency:a,minimumFractionDigits:0,maximumFractionDigits:2}).format(e)}catch(n){return console.warn(`Invalid currency formatting: ${n}`),`${a} ${e.toFixed(2)}`}}const ln=[{id:"100",amount:100},{id:"250",amount:250},{id:"500",amount:500},{id:"1000",amount:1e3},{id:"2000",amount:2e3}],Nd={title:"Donation Amount",customAmountPlaceholder:"Custom donation amount",customAmountAriaLabel:"Custom donation amount",addDonationButton:"Add Donation"},Dr=({presetAmounts:e=ln,selectedDonation:s,defaultSelectedDonation:a=null,onChange:n,onAddDonation:r,currency:i="USD",locale:l="en-US",showCustomAmount:o=!0,minCustomAmount:d=.5,maxCustomAmount:u=1e6,labels:f,mobileColumns:m=2,desktopColumns:h=3,isDisabled:x=!1,buttonVariant:g="bordered",buttonColor:j="default",inputVariant:b="bordered",size:w="md",className:N="",showCard:$=!0})=>{const v={...Nd,...f},A=Array.isArray(e)?e:ln,M={2:"grid-cols-2",3:"grid-cols-3"},k={3:"sm:grid-cols-3",4:"sm:grid-cols-4",5:"sm:grid-cols-5",6:"sm:grid-cols-6"},F=`${M[m]} ${k[h]}`,[C,_]=ds(s,a,n),[E,D]=p.useState(""),[R,O]=p.useState(!1),[V,q]=p.useState(0),I=p.useCallback(Z=>{if(x)return;const Q={amount:Z.amount,isCustom:!1,presetId:Z.id};_(Q),D(""),O(!1),q(ee=>ee+1),r?.(Q)},[x,_,r]),J=p.useCallback(Z=>{if(x)return;if(D(Z!==void 0?String(Z):""),r){_(null);return}if(Z===void 0||isNaN(Z)){_(null);return}_({amount:Z,isCustom:!0})},[x,_,r]),W=p.useCallback(()=>{if(x)return;const Z=E!==""?parseFloat(E):void 0;Z===void 0||isNaN(Z)||r?.({amount:Z,isCustom:!0})},[x,E,r]),se=p.useMemo(()=>({style:"currency",currency:i,currencyDisplay:"symbol"}),[i]),Y=t.jsxs("div",{className:"space-y-4","data-testid":"donation-amounts-root",children:[v.title&&t.jsx("h2",{className:"text-base font-semibold","data-testid":"donation-amounts-title",children:v.title}),A.length>0&&t.jsx("div",{className:c.cn("grid gap-3",F),"data-testid":"donation-amounts-presets",children:A.map(Z=>{const Q=C!==null&&!C.isCustom&&C.presetId===Z.id;return t.jsx(B,{color:Q?"primary":j,variant:Q?"solid":g,className:"w-full",onPress:()=>I(Z),isDisabled:x,"data-testid":`donation-amounts-preset-${Z.id}`,children:Z.label||wd(Z.amount,l,i)},Z.id)})}),o&&t.jsxs("div",{className:"flex gap-3 items-start",children:[t.jsx(c.NumberInput,{placeholder:v.customAmountPlaceholder,"aria-label":v.customAmountAriaLabel,onInput:r?()=>{_(null),O(!0)}:void 0,variant:b,radius:"full",size:w,minValue:d,maxValue:u,step:.01,formatOptions:se,value:E!==""?parseFloat(E):void 0,onValueChange:J,isDisabled:x,className:"flex-1 [&_[data-slot=input-wrapper]]:!h-10 [&_[data-slot=input-wrapper]]:!min-h-10","data-testid":"donation-amounts-custom-input",hideStepper:!0},r?`custom-${V}`:C?.isCustom===!1?C.presetId:"custom"),r&&t.jsx(B,{color:"primary",variant:"solid",radius:"full",size:w,className:"shrink-0",onPress:W,isDisabled:x||!R,"data-testid":"donation-amounts-add-button",children:v.addDonationButton})]})]});return $?t.jsx(c.Card,{className:c.cn("w-full",N),"data-testid":"donation-amounts-card",children:t.jsx(c.CardBody,{children:Y})}):t.jsx("div",{className:c.cn("w-full",N),"data-testid":"donation-amounts-plain",children:Y})};Dr.displayName="DonationAmounts";const Cd=e=>{const s=Math.max(0,e),a=Math.floor(s/60).toString().padStart(2,"0"),n=(s%60).toString().padStart(2,"0");return`${a}:${n} minutes`},kd=e=>{switch(e){case"warning":return K.Clock;case"error":return K.AlertCircle;case"success":return K.CheckCircle;default:return K.Clock}},Sd=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"}},Er=p.forwardRef(({timeLeft:e,defaultTimeLeft:s=1200,onTimeChange:a,onExpire:n,variant:r="info",color:i="primary",message:l="Your cart expires in:",showIcon:o=!0,icon:d,position:u="fixed",autoStart:f=!0,formatTime:m=Cd,className:h,...x},g)=>{const[j,b]=ds(e!==void 0?Math.max(0,e):void 0,Math.max(0,s),a),w=p.useRef(null),N=p.useRef(!1);p.useEffect(()=>()=>{w.current&&clearInterval(w.current)},[]),p.useEffect(()=>{if(!f||j<=0){w.current&&(clearInterval(w.current),w.current=null);return}return w.current=setInterval(()=>{b(M=>M<=1?(w.current&&(clearInterval(w.current),w.current=null),N.current||(N.current=!0,n?.()),0):M-1)},1e3),()=>{w.current&&(clearInterval(w.current),w.current=null)}},[f,j,b,n]),p.useEffect(()=>{j>0&&(N.current=!1)},[j]);const $=d||kd(r),v=Sd(i),A={fixed:"fixed top-0 left-0",sticky:"sticky top-0",static:"static"};return t.jsx("div",{ref:g,role:"banner","aria-live":"polite","aria-label":`${l} ${m(j)}`,"data-testid":"expire-cart-timer",className:c.cn("w-full text-white z-50",v,A[u],h),...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:[o&&t.jsx("div",{className:"flex-shrink-0 w-[0.875rem] h-[0.875rem] sm:w-4 sm:h-4 rounded-full bg-white flex items-center justify-center overflow-hidden","data-testid":"expire-cart-timer-icon-wrapper",children:t.jsx($,{className:"text-primary-500 sm:text-primary-600","aria-hidden":"true",size:14,"data-testid":"expire-cart-timer-icon"})}),t.jsx("p",{className:"text-sm sm:text-base font-medium text-white","data-testid":"expire-cart-timer-message",children:l})]}),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)})})]})})})});Er.displayName="ExpireCartTimer";const ft=({icon:e,children:s,testId:a})=>t.jsxs("div",{className:"flex items-center gap-2 text-sm text-gray-600","data-testid":a,children:[t.jsx(P,{icon:e,width:20,className:"text-default-500"}),t.jsx("span",{children:s})]}),$d=({classes:e="",name:s,imageUrl:a,eventDate:n,eventTime:r,location:i,description:l,showImage:o=!1,compact:d=!1,layout:u="stacked",imageLoading:f="eager",showMoreButtonClassName:m,labels:h})=>{const[x,g]=p.useState(!1),[j,b]=p.useState(!1),w=p.useRef(null);return p.useEffect(()=>{const N=()=>{if(w.current){const $=w.current.scrollHeight>w.current.clientHeight;b($)}};return N(),window.addEventListener("resize",N),()=>window.removeEventListener("resize",N)},[l]),u==="horizontal"?t.jsx(c.Card,{className:c.cn("border-0 shadow-none",e),"data-testid":"event-details-root",children:t.jsx(c.CardBody,{className:"p-0","data-testid":"event-details-horizontal-layout",children:t.jsxs("div",{className:"flex flex-col items-start gap-5 sm:flex-row sm:gap-8",children:[o&&a&&t.jsx("div",{className:"w-full shrink-0 overflow-hidden rounded-xl aspect-[3/2] sm:w-[360px]","data-testid":"event-details-image-wrapper",children:t.jsx(c.Image,{removeWrapper:!0,loading:f,alt:`Event image for ${s}`,className:"w-full h-full object-cover object-center",src:a,"data-testid":"event-details-image"})}),t.jsxs("div",{className:"min-w-0 flex-1 space-y-3",children:[t.jsx("h2",{className:"font-semibold text-2xl text-gray-800","data-testid":"event-details-title",children:s}),t.jsx("h3",{className:"font-semibold text-base text-gray-700","data-testid":"event-details-info-label",children:h.eventInformation}),t.jsxs("div",{className:"flex flex-wrap gap-4","data-testid":"event-details-info",children:[n&&t.jsx(ft,{icon:"solar:calendar-minimalistic-linear",testId:"event-details-date",children:n}),r&&t.jsx(ft,{icon:"solar:clock-circle-linear",testId:"event-details-time",children:r}),i&&t.jsx(ft,{icon:"solar:map-point-linear",testId:"event-details-location",children:i})]}),l&&t.jsxs("div",{className:"relative","data-testid":"event-details-description-wrapper",children:[t.jsxs("div",{className:"relative",children:[t.jsx("div",{ref:w,className:c.cn("text-sm text-gray-700 leading-relaxed transition-all",!x&&"line-clamp-3"),"data-testid":"event-details-description",dangerouslySetInnerHTML:{__html:l}}),!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(B,{onPress:()=>g(!x),variant:"light",className:c.cn("text-primary",m),size:"md",startContent:t.jsx(P,{icon:x?"solar:eye-closed-linear":"solar:eye-linear",width:20}),"data-testid":"event-details-toggle-description",children:x?h.showLess||"Hide":h.showMore||"Show"})})]})]})]})})}):t.jsxs(c.Card,{className:c.cn("border-0 shadow-none",e),"data-testid":"event-details-root",children:[t.jsxs(c.CardHeader,{className:c.cn("pt-2 pb-0 flex-col items-start",d?"space-y-1":"space-y-2"),"data-testid":"event-details-header",children:[o&&a&&t.jsx("div",{className:c.cn("w-full overflow-hidden rounded-xl","aspect-[3/1]"),"data-testid":"event-details-image-wrapper",children:t.jsx(c.Image,{removeWrapper:!0,loading:f,alt:`Event image for ${s}`,className:"w-full h-full object-cover object-center",src:a,"data-testid":"event-details-image"})}),t.jsx("h2",{className:c.cn("font-semibold text-gray-800",d?"text-base":"text-xl"),"data-testid":"event-details-title",children:s})]}),t.jsxs(c.CardBody,{className:c.cn("space-y-3",d?"py-1 space-y-2":"py-3"),"data-testid":"event-details-body",children:[t.jsx("h3",{className:c.cn("font-semibold text-base text-gray-700",d?"text-sm":""),"data-testid":"event-details-info-label",children:h.eventInformation}),t.jsxs("div",{className:"flex flex-wrap gap-4","data-testid":"event-details-info",children:[n&&t.jsx(ft,{icon:"solar:calendar-minimalistic-linear",testId:"event-details-date",children:n}),r&&t.jsx(ft,{icon:"solar:clock-circle-linear",testId:"event-details-time",children:r}),i&&t.jsx(ft,{icon:"solar:map-point-linear",testId:"event-details-location",children:i})]}),l&&t.jsxs("div",{className:"relative","data-testid":"event-details-description-wrapper",children:[t.jsxs("div",{className:"relative",children:[t.jsx("div",{ref:w,className:c.cn("text-sm text-gray-700 leading-relaxed transition-all",d?"text-xs":"",!x&&"line-clamp-3"),"data-testid":"event-details-description",dangerouslySetInnerHTML:{__html:l}}),!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(B,{onPress:()=>g(!x),variant:"light",className:c.cn("text-primary",m),size:d?"sm":"md",startContent:t.jsx(P,{icon:x?"solar:eye-closed-linear":"solar:eye-linear",width:d?16:20}),"data-testid":"event-details-toggle-description",children:x?h.showLess||"Hide":h.showMore||"Show"})})]})]})]})};function Ws(e,s="en-US",a="USD"){try{return new Intl.NumberFormat(s,{style:"currency",currency:a,minimumFractionDigits:2,maximumFractionDigits:2}).format(e)}catch(n){return console.warn(`Invalid currency formatting: ${n}`),`${a} ${e.toFixed(2)}`}}function Ad(e){const s=e.replace(/[^\d.,-]/g,""),a=s.match(/,\d{1,2}$/);let n;a?n=s.replace(/\./g,"").replace(",","."):n=s.replace(/,/g,"");const r=parseFloat(n);return isNaN(r)?null:r}const Dd={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"},xt=e=>typeof e=="number"&&!isNaN(e),es=({offer:e,quantity:s,defaultQuantity:a=0,onQuantityChange:n,currency:r="USD",locale:i="en-US",labels:l,slots:o,isDisabled:d=!1,buttonVariant:u="bordered",buttonColor:f="default",showCard:m=!0,showDescription:h=!0,showPeopleCount:x=!0,showPrice:g=!0,priceDisplay:j,classNames:b={},"data-testid":w,selectedColor:N="default",selectionMode:$="stepper",compact:v=!1,isSoldOut:A,isMaxReached:M,isRuleBlocked:k,statusTone:F="default",statusLabel:C,disabledReason:_,disabled:E})=>{const D=p.useMemo(()=>({...Dd,...l}),[l]),[R,O]=p.useState(a),V=s!==void 0?s:R,q=!!(d||E),I=v||!!e.compact,J=$==="press-to-add",W=p.useMemo(()=>typeof A=="boolean"?A:typeof e.isSoldOut=="boolean"?e.isSoldOut:!xt(e.totalTicketsSold)||!xt(e.ticketsAllowed)?!1:e.totalTicketsSold>=e.ticketsAllowed,[A,e.isSoldOut,e.totalTicketsSold,e.ticketsAllowed]),se=p.useMemo(()=>typeof M=="boolean"?M:typeof e.isMaxReached=="boolean"?e.isMaxReached:W||!xt(e.ticketsAllowed)?!1:V>=e.ticketsAllowed-(e.totalTicketsSold??0),[M,e.isMaxReached,W,e.ticketsAllowed,e.totalTicketsSold,V]),Y=p.useMemo(()=>typeof k=="boolean"?k:typeof e.isRuleBlocked=="boolean"?e.isRuleBlocked:!1,[k,e.isRuleBlocked]),Z=_||e.disabledReason,Q=q||W||Y,ee=le=>{if(Q||le>0&&se)return;const ye=Math.max(0,V+le);s===void 0&&O(ye),n?.(e.id,ye)},ne=p.useMemo(()=>{if(W)return"soldOut";if(Y)return"ruleBlocked";if(q)return"disabled"},[W,Y,q]),X=p.useMemo(()=>F||(W||Y?"danger":se?"warning":"default"),[F,W,Y,se]),de=p.useMemo(()=>{if(ne)return ne==="ruleBlocked"?C||Z||D.ruleBlocked:ne==="soldOut"?C||Z||D.soldOut:ne==="disabled"?C||Z||D.disabled:C||D.maxReached},[ne,C,Z,D]),ae={soldOut:"danger",ruleBlocked:X,disabled:"default",maxReached:"warning"},Ie={soldOut:"offer-card-sold-out-chip",maxReached:"offer-card-max-reached-chip",ruleBlocked:"offer-card-ruleBlocked-chip",disabled:"offer-card-disabled-chip"},Ee=()=>o?.renderName?o.renderName(e.name,e):t.jsx("h2",{"data-testid":"offer-card-name",className:c.cn("text-base font-medium",I&&"text-sm",b.name),children:e.name}),Le=()=>{if(!g)return null;const le=j?.price??e.price,ye=j?.originalPrice,Ye=Ws(le,i,r);if(o?.renderPrice)return o.renderPrice(le,Ye,e);if(xt(ye)&&xt(le)&&ye>le){const S=Ws(ye,i,r);return t.jsxs("div",{"data-testid":"offer-card-price",className:c.cn("flex items-center gap-2 mt-1",I&&"mt-0.5",b.price),children:[t.jsxs("span",{className:"sr-only",children:["Original price ",S,", discounted price ",Ye]}),t.jsx("span",{"aria-hidden":"true","data-testid":"offer-card-original-price",className:c.cn("text-gray-400 line-through text-sm",I&&"text-xs",b.originalPrice),children:S}),t.jsx("span",{"aria-hidden":"true","data-testid":"offer-card-discounted-price",className:c.cn("text-primary text-base font-semibold",I&&"text-sm",b.discountedPrice),children:Ye})]})}return t.jsx("p",{"data-testid":"offer-card-price",className:c.cn("text-primary text-base mt-1",I&&"text-sm mt-0.5",b.price),children:Ye})},mt=()=>!h||!e.description?null:o?.renderDescription?o.renderDescription(e.description,e):t.jsx("p",{"data-testid":"offer-card-description",className:c.cn("mb-4 text-sm text-gray-700 leading-relaxed",I&&"mb-2 text-xs text-gray-600",b.description),children:e.description}),Ge=()=>{if(!x||!xt(e.numberOfPeople)||e.numberOfPeople<=0)return null;const le=e.numberOfPeople===1?D.person:D.people;return o?.renderPeopleCount?o.renderPeopleCount(e.numberOfPeople,le,e):t.jsxs("p",{"data-testid":"offer-card-people-count",className:c.cn("text-sm text-gray-600 flex items-center mt-2",I&&"mt-1 text-xs",b.peopleCount),children:[t.jsx(P,{icon:e.numberOfPeople<=1?"solar:user-rounded-outline":"solar:users-group-rounded-outline",width:20,className:"mr-1"}),e.numberOfPeople," ",le]})},We=()=>{const le=V===0||Q,ye=se||Q;return o?.renderQuantitySelector?o.renderQuantitySelector({quantity:V,onIncrement:()=>ee(1),onDecrement:()=>ee(-1),isDecrementDisabled:le,isIncrementDisabled:ye,isDisabled:Q}):t.jsxs("div",{className:c.cn("flex items-center gap-2",b.quantitySelector),children:[t.jsx(B,{"data-testid":"offer-card-decrement-button",onPress:()=>ee(-1),isDisabled:le,variant:u,color:V>0?N:f,radius:"full",isIconOnly:!0,size:I?"md":"sm","aria-label":"Decrease quantity",children:t.jsx(P,{icon:"gravity-ui:minus",width:16})}),t.jsx("span",{"data-testid":"offer-card-quantity",className:c.cn("min-w-[2rem] text-center font-medium",I&&"text-sm"),children:V}),t.jsx(B,{"data-testid":"offer-card-increment-button",onPress:()=>ee(1),isDisabled:ye,variant:u,color:V>0?N:f,radius:"full",isIconOnly:!0,size:I?"md":"sm","aria-label":"Increase quantity",children:t.jsx(P,{icon:"gravity-ui:plus",width:16})})]})},rt=(le,ye)=>o?.renderDisabledState?o.renderDisabledState(le,ye):le==="soldOut"&&o?.renderSoldOut?o.renderSoldOut(ye):le==="maxReached"&&o?.renderMaxReachedAlert?o.renderMaxReachedAlert(ye):t.jsx(c.Chip,{"data-testid":Ie[le],color:ae[le],variant:le==="maxReached"?"flat":"solid",className:c.cn("gap-2 px-4",le==="maxReached"?"h-8":"h-10",le==="soldOut"&&b.soldOut,le==="maxReached"&&b.maxReachedAlert,I&&"h-8"),startContent:t.jsx(P,{icon:"gravity-ui:triangle-exclamation-fill",width:14}),children:t.jsx("span",{className:"font-medium text-sm",children:ye})}),Je=t.jsxs("div",{className:c.cn("grid grid-cols-1 md:grid-cols-1 xl:grid-cols-3 lg:grid-cols-3 items-start",I?"gap-1":"gap-2"),children:[t.jsxs("div",{className:c.cn("h-full col-span-2",Q||se?"opacity-50 pointer-events-none select-none":""),children:[Ee(),Le(),t.jsxs("div",{className:c.cn("md:col-span-1 xl:col-span-2 lg:col-span-1",I?"mb-1":"mb-2"),children:[Ge(),mt()]})]}),!J&&t.jsx("div",{className:c.cn("space-x-2 pt-0 pb-2 md:p-2 h-full flex items-center justify-start md:justify-start lg:justify-end",I&&"space-x-1 pb-1 md:p-1",b.compactFooter),children:ne&&de?rt(ne,de):We()})]}),Pe=se&&!W&&!Y&&!q?t.jsx(De.motion.div,{className:c.cn("w-full sm:max-w-[60%] md:max-w-[60%] lg:max-w-[60%]",b.compactFooter),initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:10},transition:{duration:.3},children:rt("maxReached",de||D.maxReached)}):null;return m?t.jsxs(c.Card,{className:c.cn("w-full",J&&!Q&&!se&&"cursor-pointer",I&&b.compact,b.base),"data-testid":w||`offer-card-${e.id}`,isPressable:J&&!Q&&!se,onPress:J&&!Q&&!se?()=>ee(1):void 0,children:[t.jsx(c.CardBody,{className:c.cn("pt-1 pb-0",I?"pb-0.5":"",b.body),children:Je}),t.jsx(De.AnimatePresence,{children:Pe&&t.jsx(c.CardFooter,{className:c.cn("w-full mt-0 pt-0",I?"pt-1":"",b.footer),children:Pe})})]}):t.jsxs("div",{className:c.cn("w-full",I&&b.compact,b.base),"data-testid":w||`offer-card-${e.id}`,children:[t.jsx("div",{className:c.cn("pt-1 pb-0",I?"pb-0.5":"",b.body),children:Je}),t.jsx(De.AnimatePresence,{children:Pe&&t.jsx("div",{className:c.cn("w-full mt-0 pt-0",I?"pt-1":"",b.footer),children:Pe})})]})};es.displayName="OfferCard";const Fr=({message:e="No offers available.",icon:s="solar:ticket-sale-outline",iconSize:a=48,showCard:n=!0,classNames:r={},renderEmpty:i})=>{if(i){const o=i();return n?t.jsx(c.Card,{"data-testid":"offer-card-empty",className:c.cn("w-full",r.base),children:t.jsx(c.CardBody,{"data-testid":"offer-card-empty-body",children:o})}):t.jsx("div",{"data-testid":"offer-card-empty",className:c.cn("w-full",r.base),children:o})}const l=t.jsxs("div",{"data-testid":"offer-card-empty-content",className:c.cn("flex flex-col items-center justify-center p-8 text-center text-gray-500",r.content),children:[t.jsx(P,{"data-testid":"offer-card-empty-icon",icon:s,width:a,className:c.cn("mb-4",r.icon)}),t.jsx("h3",{"data-testid":"offer-card-empty-message",className:c.cn("text-lg",r.message),children:e})]});return n?t.jsx(c.Card,{"data-testid":"offer-card-empty",className:c.cn("w-full",r.base),children:t.jsx(c.CardBody,{"data-testid":"offer-card-empty-body",children:l})}):t.jsx("div",{"data-testid":"offer-card-empty",className:c.cn("w-full",r.base),children:l})};Fr.displayName="OfferCardEmpty";const Ed={title:"Error Fetching Offers",description:"An error occurred while fetching offers."},Lr=({error:e,labels:s,showCard:a=!0,color:n="danger",classNames:r={}})=>{const i={...Ed,...s},l=t.jsx(c.Alert,{"data-testid":"offer-card-error-alert",color:n,title:i.title,description:e||i.description,className:r.alert});return a?t.jsx(c.Card,{"data-testid":"offer-card-error",className:c.cn("w-full",r.base),children:t.jsx(c.CardBody,{"data-testid":"offer-card-error-body",children:l})}):t.jsx("div",{"data-testid":"offer-card-error",className:c.cn("w-full",r.base),children:l})};Lr.displayName="OfferCardError";const Fd={1:"space-y-1",2:"space-y-2",3:"space-y-3",4:"space-y-4",5:"space-y-5",6:"space-y-6"},Mr=({quantity:e=2,gap:s=4,classNames:a={}})=>{const n=Fd[s];return t.jsx("div",{"data-testid":"offer-card-skeleton-container",className:c.cn(n,a.base),children:Array.from({length:e}).map((r,i)=>t.jsxs(c.Card,{"data-testid":`offer-card-skeleton-${i}`,className:c.cn("w-full",a.card),children:[t.jsx(c.CardHeader,{"data-testid":`offer-card-skeleton-header-${i}`,className:"flex justify-between items-start pb-0",children:t.jsxs("div",{className:"space-y-2 w-full",children:[t.jsx(c.Skeleton,{"data-testid":`offer-card-skeleton-title-${i}`,className:"w-1/3 rounded-lg",children:t.jsx("div",{className:"h-4 bg-default-200 rounded-lg"})}),t.jsx(c.Skeleton,{"data-testid":`offer-card-skeleton-subtitle-${i}`,className:"w-1/4 rounded-lg",children:t.jsx("div",{className:"h-3 bg-default-300 rounded-lg"})})]})}),t.jsx(c.CardBody,{"data-testid":`offer-card-skeleton-body-${i}`,className:"pt-2 pb-0",children:t.jsxs("div",{className:"grid grid-cols-1 xl:grid-cols-3 gap-2 items-start",children:[t.jsxs("div",{className:"xl:col-span-2 space-y-2",children:[t.jsx(c.Skeleton,{"data-testid":`offer-card-skeleton-people-${i}`,className:"w-1/4 rounded-lg",children:t.jsx("div",{className:"h-4 bg-default-300 rounded-lg"})}),t.jsx(c.Skeleton,{"data-testid":`offer-card-skeleton-description-${i}`,className:"w-3/4 rounded-lg",children:t.jsx("div",{className:"h-4 bg-default-200 rounded-lg"})})]}),t.jsx("div",{className:"flex items-start justify-end",children:t.jsxs("div",{"data-testid":`offer-card-skeleton-controls-${i}`,className:"flex items-center justify-end gap-2 w-full px-4 py-2",children:[t.jsx(c.Skeleton,{"data-testid":`offer-card-skeleton-label-${i}`,className:"w-24 h-4 rounded-md bg-default-200"}),t.jsxs("div",{className:"flex gap-2",children:[t.jsx(c.Skeleton,{"data-testid":`offer-card-skeleton-btn-dec-${i}`,className:"w-8 h-8 rounded-md bg-default-300"}),t.jsx(c.Skeleton,{"data-testid":`offer-card-skeleton-btn-qty-${i}`,className:"w-8 h-8 rounded-md bg-default-200"}),t.jsx(c.Skeleton,{"data-testid":`offer-card-skeleton-btn-inc-${i}`,className:"w-8 h-8 rounded-md bg-default-300"})]})]})})]})})]},i))})};Mr.displayName="OfferCardSkeleton";const _r={hidden:{opacity:0},show:{opacity:1,transition:{staggerChildren:.15,delayChildren:.1}}},Rr={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"}}},Ld={1:"gap-1",2:"gap-2",3:"gap-3",4:"gap-4",5:"gap-5",6:"gap-6"},Tr=({offers:e=[],mapOffer:s,selection:a,defaultSelection:n={},onSelectionChange:r,onQuantityChange:i,currency:l="USD",locale:o="en-US",labels:d,slots:u,isDisabled:f=!1,buttonVariant:m="bordered",buttonColor:h="default",showCard:x=!0,animated:g=!0,gap:j=2,compact:b=!1,classNames:w={}})=>{const[N,$]=p.useState(n),v=a!==void 0?a:N,A=p.useCallback((E,D)=>{const R={...v,[E]:Math.max(0,D)};a===void 0&&$(R),r?.(R),i?.(E,R[E])},[v,a,r,i]),M=[...e].sort((E,D)=>(E.position??0)-(D.position??0)),k=E=>{const D=s?s(E):E,R=(v??{})[D.id]||0;return{offer:D,quantity:R,onQuantityChange:A,currency:l,locale:o,labels:d,slots:u,isDisabled:f,buttonVariant:m,buttonColor:h,showCard:x,compact:b}},F=Ld[j],C=c.cn("grid mx-auto pt-2",F,w.base),_=E=>{const D=k(E);return t.jsx(es,{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:w.card},D.offer.id)};return g?t.jsx(De.motion.div,{"data-testid":"offer-card-list",className:C,variants:_r,initial:"hidden",animate:"show",children:t.jsx(De.AnimatePresence,{children:M.map(E=>{const D=k(E);return t.jsx(De.motion.div,{"data-testid":`offer-card-list-item-${D.offer.id}`,className:w.cardWrapper,variants:Rr,exit:{opacity:0,y:-20},transition:{duration:.3},children:t.jsx(es,{offer:D.offer,quantity:D.quantity,onQuantityChange:A,currency:l,locale:o,labels:d,slots:u,isDisabled:f,buttonVariant:m,buttonColor:h,showCard:x,compact:b||D.offer.compact,classNames:w.card})},D.offer.id)})})}):t.jsx("div",{"data-testid":"offer-card-list",className:C,children:M.map(_)})};Tr.displayName="OfferCardList";var Tt=e=>e.type==="checkbox",ct=e=>e instanceof Date,Fe=e=>e==null;const Ir=e=>typeof e=="object";var be=e=>!Fe(e)&&!Array.isArray(e)&&Ir(e)&&!ct(e),Pr=e=>be(e)&&e.target?Tt(e.target)?e.target.checked:e.target.value:e,Md=e=>e.substring(0,e.search(/\.\d+(\.|$)/))||e,Or=(e,s)=>e.has(Md(s)),_d=e=>{const s=e.constructor&&e.constructor.prototype;return be(s)&&s.hasOwnProperty("isPrototypeOf")},ma=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function he(e){if(e instanceof Date)return new Date(e);const s=typeof FileList<"u"&&e instanceof FileList;if(ma&&(e instanceof Blob||s))return e;const a=Array.isArray(e);if(!a&&!(be(e)&&_d(e)))return e;const n=a?[]:Object.create(Object.getPrototypeOf(e));for(const r in e)Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=he(e[r]));return n}var us=e=>/^\w*$/.test(e),me=e=>e===void 0,fa=e=>Array.isArray(e)?e.filter(Boolean):[],xa=e=>fa(e.replace(/["|']|\]/g,"").split(/\.|\[/)),H=(e,s,a)=>{if(!s||!be(e))return a;const n=(us(s)?[s]:xa(s)).reduce((r,i)=>Fe(r)?r:r[i],e);return me(n)||n===e?me(e[s])?a:e[s]:n},Re=e=>typeof e=="boolean",Ae=e=>typeof e=="function",ce=(e,s,a)=>{let n=-1;const r=us(s)?[s]:xa(s),i=r.length,l=i-1;for(;++n<i;){const o=r[n];let d=a;if(n!==l){const u=e[o];d=be(u)||Array.isArray(u)?u:isNaN(+r[n+1])?{}:[]}if(o==="__proto__"||o==="constructor"||o==="prototype")return;e[o]=d,e=e[o]}};const ts={BLUR:"blur",FOCUS_OUT:"focusout",CHANGE:"change"},Ve={onBlur:"onBlur",onChange:"onChange",onSubmit:"onSubmit",onTouched:"onTouched",all:"all"},Ke={max:"max",min:"min",maxLength:"maxLength",minLength:"minLength",pattern:"pattern",required:"required",validate:"validate"},zr=p.createContext(null);zr.displayName="HookFormControlContext";const ha=()=>p.useContext(zr);var Br=(e,s,a,n=!0)=>{const r={defaultValues:s._defaultValues};for(const i in e)Object.defineProperty(r,i,{get:()=>{const l=i;return s._proxyFormState[l]!==Ve.all&&(s._proxyFormState[l]=!n||Ve.all),a&&(a[l]=!0),e[l]}});return r};const pa=typeof window<"u"?p.useLayoutEffect:p.useEffect;function Rd(e){const s=ha(),{control:a=s,disabled:n,name:r,exact:i}=e||{},[l,o]=p.useState(a._formState),d=p.useRef({isDirty:!1,isLoading:!1,dirtyFields:!1,touchedFields:!1,validatingFields:!1,isValidating:!1,isValid:!1,errors:!1});return pa(()=>a._subscribe({name:r,formState:d.current,exact:i,callback:u=>{!n&&o({...a._formState,...u})}}),[r,n,i]),p.useEffect(()=>{d.current.isValid&&a._setValid(!0)},[a]),p.useMemo(()=>Br(l,a,d.current,!1),[l,a])}var Te=e=>typeof e=="string",Ys=(e,s,a,n,r)=>Te(e)?(n&&s.watch.add(e),H(a,e,r)):Array.isArray(e)?e.map(i=>(n&&s.watch.add(i),H(a,i))):(n&&(s.watchAll=!0),a),Gs=e=>Fe(e)||!Ir(e);function Ue(e,s,a=new WeakSet){if(Gs(e)||Gs(s))return Object.is(e,s);if(ct(e)&&ct(s))return Object.is(e.getTime(),s.getTime());const n=Object.keys(e),r=Object.keys(s);if(n.length!==r.length)return!1;if(a.has(e)||a.has(s))return!0;a.add(e),a.add(s);for(const i of n){const l=e[i];if(!r.includes(i))return!1;if(i!=="ref"){const o=s[i];if(ct(l)&&ct(o)||be(l)&&be(o)||Array.isArray(l)&&Array.isArray(o)?!Ue(l,o,a):!Object.is(l,o))return!1}}return!0}function Td(e){const s=ha(),{control:a=s,name:n,defaultValue:r,disabled:i,exact:l,compute:o}=e||{},d=p.useRef(r),u=p.useRef(o),f=p.useRef(void 0),m=p.useRef(a),h=p.useRef(n);u.current=o;const[x,g]=p.useState(()=>{const v=a._getWatch(n,d.current);return u.current?u.current(v):v}),j=p.useCallback(v=>{const A=Ys(n,a._names,v||a._formValues,!1,d.current);return u.current?u.current(A):A},[a._formValues,a._names,n]),b=p.useCallback(v=>{if(!i){const A=Ys(n,a._names,v||a._formValues,!1,d.current);if(u.current){const M=u.current(A);Ue(M,f.current)||(g(M),f.current=M)}else g(A)}},[a._formValues,a._names,i,n]);pa(()=>((m.current!==a||!Ue(h.current,n))&&(m.current=a,h.current=n,b()),a._subscribe({name:n,formState:{values:!0},exact:l,callback:v=>{b(v.values)}})),[a,l,n,b]),p.useEffect(()=>a._removeUnmounted());const w=m.current!==a,N=h.current,$=p.useMemo(()=>{if(i)return null;const v=!w&&!Ue(N,n);return w||v?j():null},[i,w,n,N,j]);return $!==null?$:x}function Id(e){const s=ha(),{name:a,disabled:n,control:r=s,shouldUnregister:i,defaultValue:l,exact:o=!0}=e,d=Or(r._names.array,a),u=p.useMemo(()=>H(r._formValues,a,H(r._defaultValues,a,l)),[r,a,l]),f=Td({control:r,name:a,defaultValue:u,exact:o}),m=Rd({control:r,name:a,exact:o}),h=p.useRef(e),x=p.useRef(void 0),g=p.useRef(r.register(a,{...e.rules,value:f,...Re(e.disabled)?{disabled:e.disabled}:{}}));h.current=e;const j=p.useMemo(()=>Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!H(m.errors,a)},isDirty:{enumerable:!0,get:()=>!!H(m.dirtyFields,a)},isTouched:{enumerable:!0,get:()=>!!H(m.touchedFields,a)},isValidating:{enumerable:!0,get:()=>!!H(m.validatingFields,a)},error:{enumerable:!0,get:()=>H(m.errors,a)}}),[m,a]),b=p.useCallback(v=>g.current.onChange({target:{value:Pr(v),name:a},type:ts.CHANGE}),[a]),w=p.useCallback(()=>g.current.onBlur({target:{value:H(r._formValues,a),name:a},type:ts.BLUR}),[a,r._formValues]),N=p.useCallback(v=>{const A=H(r._fields,a);A&&A._f&&v&&(A._f.ref={focus:()=>Ae(v.focus)&&v.focus(),select:()=>Ae(v.select)&&v.select(),setCustomValidity:M=>Ae(v.setCustomValidity)&&v.setCustomValidity(M),reportValidity:()=>Ae(v.reportValidity)&&v.reportValidity()})},[r._fields,a]),$=p.useMemo(()=>({name:a,value:f,...Re(n)||m.disabled?{disabled:m.disabled||n}:{},onChange:b,onBlur:w,ref:N}),[a,n,m.disabled,b,w,N,f]);return p.useEffect(()=>{const v=r._options.shouldUnregister||i,A=x.current;A&&A!==a&&!d&&r.unregister(A),r.register(a,{...h.current.rules,...Re(h.current.disabled)?{disabled:h.current.disabled}:{}});const M=(k,F)=>{const C=H(r._fields,k);C&&C._f&&(C._f.mount=F)};if(M(a,!0),v){const k=he(H(r._options.defaultValues,a,h.current.defaultValue));ce(r._defaultValues,a,k),me(H(r._formValues,a))&&ce(r._formValues,a,k)}return!d&&r.register(a),x.current=a,()=>{(d?v&&!r._state.action:v)?r.unregister(a):M(a,!1)}},[a,r,d,i]),p.useEffect(()=>{r._setDisabledField({disabled:n,name:a})},[n,a,r]),p.useMemo(()=>({field:$,formState:m,fieldState:j}),[$,m,j])}const Pd=p.createContext(null);Pd.displayName="HookFormContext";var Od=(e,s,a,n,r)=>s?{...a[e],types:{...a[e]&&a[e].types?a[e].types:{},[n]:r||!0}}:{},Et=e=>Array.isArray(e)?e:[e],on=()=>{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 Vr(e,s){const a={};for(const n in e)if(e.hasOwnProperty(n)){const r=e[n],i=s[n];if(r&&be(r)&&i){const l=Vr(r,i);be(l)&&(a[n]=l)}else e[n]&&(a[n]=i)}return a}var Se=e=>be(e)&&!Object.keys(e).length,ga=e=>e.type==="file",ss=e=>{if(!ma)return!1;const s=e?e.ownerDocument:0;return e instanceof(s&&s.defaultView?s.defaultView.HTMLElement:HTMLElement)},Ur=e=>e.type==="select-multiple",ba=e=>e.type==="radio",zd=e=>ba(e)||Tt(e),ks=e=>ss(e)&&e.isConnected;function Bd(e,s){const a=s.slice(0,-1).length;let n=0;for(;n<a;)e=me(e)?n++:e[s[n++]];return e}function Vd(e){for(const s in e)if(e.hasOwnProperty(s)&&!me(e[s]))return!1;return!0}function pe(e,s){const a=Array.isArray(s)?s:us(s)?[s]:xa(s),n=a.length===1?e:Bd(e,a),r=a.length-1,i=a[r];return n&&delete n[i],r!==0&&(be(n)&&Se(n)||Array.isArray(n)&&Vd(n))&&pe(e,a.slice(0,-1)),e}var Ud=e=>{for(const s in e)if(Ae(e[s]))return!0;return!1};function Hr(e){return Array.isArray(e)||be(e)&&!Ud(e)}function Ks(e,s={}){for(const a in e){const n=e[a];Hr(n)?(s[a]=Array.isArray(n)?[]:{},Ks(n,s[a])):me(n)||(s[a]=!0)}return s}function gt(e,s,a){a||(a=Ks(s));for(const n in e){const r=e[n];if(Hr(r))me(s)||Gs(a[n])?a[n]=Ks(r,Array.isArray(r)?[]:{}):gt(r,Fe(s)?{}:s[n],a[n]);else{const i=s[n];a[n]=!Ue(r,i)}}return a}const cn={value:!1,isValid:!1},dn={value:!0,isValid:!0};var qr=e=>{if(Array.isArray(e)){if(e.length>1){const s=e.filter(a=>a&&a.checked&&!a.disabled).map(a=>a.value);return{value:s,isValid:!!s.length}}return e[0].checked&&!e[0].disabled?e[0].attributes&&!me(e[0].attributes.value)?me(e[0].value)||e[0].value===""?dn:{value:e[0].value,isValid:!0}:dn:cn}return cn},Wr=(e,{valueAsNumber:s,valueAsDate:a,setValueAs:n})=>me(e)?e:s?e===""?NaN:e&&+e:a&&Te(e)?new Date(e):n?n(e):e;const un={isValid:!1,value:null};var Yr=e=>Array.isArray(e)?e.reduce((s,a)=>a&&a.checked&&!a.disabled?{isValid:!0,value:a.value}:s,un):un;function mn(e){const s=e.ref;return ga(s)?s.files:ba(s)?Yr(e.refs).value:Ur(s)?[...s.selectedOptions].map(({value:a})=>a):Tt(s)?qr(e.refs).value:Wr(me(s.value)?e.ref.value:s.value,e)}var Hd=(e,s,a,n)=>{const r={};for(const i of e){const l=H(s,i);l&&ce(r,i,l._f)}return{criteriaMode:a,names:[...e],fields:r,shouldUseNativeValidation:n}},as=e=>e instanceof RegExp,kt=e=>me(e)?e:as(e)?e.source:be(e)?as(e.value)?e.value.source:e.value:e,fn=e=>({isOnSubmit:!e||e===Ve.onSubmit,isOnBlur:e===Ve.onBlur,isOnChange:e===Ve.onChange,isOnAll:e===Ve.all,isOnTouch:e===Ve.onTouched});const xn="AsyncFunction";var qd=e=>!!e&&!!e.validate&&!!(Ae(e.validate)&&e.validate.constructor.name===xn||be(e.validate)&&Object.values(e.validate).find(s=>s.constructor.name===xn)),Wd=e=>e.mount&&(e.required||e.min||e.max||e.maxLength||e.minLength||e.pattern||e.validate),hn=(e,s,a)=>!a&&(s.watchAll||s.watch.has(e)||[...s.watch].some(n=>e.startsWith(n)&&/^\.\w+/.test(e.slice(n.length))));const Ft=(e,s,a,n)=>{for(const r of a||Object.keys(e)){const i=H(e,r);if(i){const{_f:l,...o}=i;if(l){if(l.refs&&l.refs[0]&&s(l.refs[0],r)&&!n)return!0;if(l.ref&&s(l.ref,l.name)&&!n)return!0;if(Ft(o,s))break}else if(be(o)&&Ft(o,s))break}}};function pn(e,s,a){const n=H(e,a);if(n||us(a))return{error:n,name:a};const r=a.split(".");for(;r.length;){const i=r.join("."),l=H(s,i),o=H(e,i);if(l&&!Array.isArray(l)&&a!==i)return{name:a};if(o&&o.type)return{name:i,error:o};if(o&&o.root&&o.root.type)return{name:`${i}.root`,error:o.root};r.pop()}return{name:a}}var Yd=(e,s,a,n)=>{a(e);const{name:r,...i}=e;return Se(i)||Object.keys(i).length>=Object.keys(s).length||Object.keys(i).find(l=>s[l]===(!n||Ve.all))},Gd=(e,s,a)=>!e||!s||e===s||Et(e).some(n=>n&&(a?n===s:n.startsWith(s)||s.startsWith(n))),Kd=(e,s,a,n,r)=>r.isOnAll?!1:!a&&r.isOnTouch?!(s||e):(a?n.isOnBlur:r.isOnBlur)?!e:(a?n.isOnChange:r.isOnChange)?e:!0,Qd=(e,s)=>!fa(H(e,s)).length&&pe(e,s),Zd=(e,s,a)=>{const n=Et(H(e,a));return ce(n,"root",s[a]),ce(e,a,n),e};function gn(e,s,a="validate"){if(Te(e)||Array.isArray(e)&&e.every(Te)||Re(e)&&!e)return{type:a,message:Te(e)?e:"",ref:s}}var ht=e=>be(e)&&!as(e)?e:{value:e,message:""},bn=async(e,s,a,n,r,i)=>{const{ref:l,refs:o,required:d,maxLength:u,minLength:f,min:m,max:h,pattern:x,validate:g,name:j,valueAsNumber:b,mount:w}=e._f,N=H(a,j);if(!w||s.has(j))return{};const $=o?o[0]:l,v=D=>{r&&$.reportValidity&&($.setCustomValidity(Re(D)?"":D||""),$.reportValidity())},A={},M=ba(l),k=Tt(l),F=M||k,C=(b||ga(l))&&me(l.value)&&me(N)||ss(l)&&l.value===""||N===""||Array.isArray(N)&&!N.length,_=Od.bind(null,j,n,A),E=(D,R,O,V=Ke.maxLength,q=Ke.minLength)=>{const I=D?R:O;A[j]={type:D?V:q,message:I,ref:l,..._(D?V:q,I)}};if(i?!Array.isArray(N)||!N.length:d&&(!F&&(C||Fe(N))||Re(N)&&!N||k&&!qr(o).isValid||M&&!Yr(o).isValid)){const{value:D,message:R}=Te(d)?{value:!!d,message:d}:ht(d);if(D&&(A[j]={type:Ke.required,message:R,ref:$,..._(Ke.required,R)},!n))return v(R),A}if(!C&&(!Fe(m)||!Fe(h))){let D,R;const O=ht(h),V=ht(m);if(!Fe(N)&&!isNaN(N)){const q=l.valueAsNumber||N&&+N;Fe(O.value)||(D=q>O.value),Fe(V.value)||(R=q<V.value)}else{const q=l.valueAsDate||new Date(N),I=se=>new Date(new Date().toDateString()+" "+se),J=l.type=="time",W=l.type=="week";Te(O.value)&&N&&(D=J?I(N)>I(O.value):W?N>O.value:q>new Date(O.value)),Te(V.value)&&N&&(R=J?I(N)<I(V.value):W?N<V.value:q<new Date(V.value))}if((D||R)&&(E(!!D,O.message,V.message,Ke.max,Ke.min),!n))return v(A[j].message),A}if((u||f)&&!C&&(Te(N)||i&&Array.isArray(N))){const D=ht(u),R=ht(f),O=!Fe(D.value)&&N.length>+D.value,V=!Fe(R.value)&&N.length<+R.value;if((O||V)&&(E(O,D.message,R.message),!n))return v(A[j].message),A}if(x&&!C&&Te(N)){const{value:D,message:R}=ht(x);if(as(D)&&!N.match(D)&&(A[j]={type:Ke.pattern,message:R,ref:l,..._(Ke.pattern,R)},!n))return v(R),A}if(g){if(Ae(g)){const D=await g(N,a),R=gn(D,$);if(R&&(A[j]={...R,..._(Ke.validate,R.message)},!n))return v(R.message),A}else if(be(g)){let D={};for(const R in g){if(!Se(D)&&!n)break;const O=gn(await g[R](N,a),$,R);O&&(D={...O,..._(R,O.message)},v(O.message),n&&(A[j]=D))}if(!Se(D)&&(A[j]={ref:$,...D},!n))return A}}return v(!0),A};const Xd={mode:Ve.onSubmit,reValidateMode:Ve.onChange,shouldFocusError:!0};function Jd(e={}){let s={...Xd,...e},a={submitCount:0,isDirty:!1,isReady:!1,isLoading:Ae(s.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{},errors:s.errors||{},disabled:s.disabled||!1},n={},r=be(s.defaultValues)||be(s.values)?he(s.defaultValues||s.values)||{}:{},i=s.shouldUnregister?{}:he(r),l={action:!1,mount:!1,watch:!1,keepIsValid:!1},o={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 h={...m};const x={array:on(),state:on()},g=s.criteriaMode===Ve.all,j=y=>S=>{clearTimeout(u),u=setTimeout(y,S)},b=async y=>{if(!l.keepIsValid&&!s.disabled&&(m.isValid||h.isValid||y)){let S;s.resolver?(S=Se((await F()).errors),w()):S=await _(n,!0),S!==a.isValid&&x.state.next({isValid:S})}},w=(y,S)=>{!s.disabled&&(m.isValidating||m.validatingFields||h.isValidating||h.validatingFields)&&((y||Array.from(o.mount)).forEach(L=>{L&&(S?ce(a.validatingFields,L,S):pe(a.validatingFields,L))}),x.state.next({validatingFields:a.validatingFields,isValidating:!Se(a.validatingFields)}))},N=(y,S=[],L,U,z=!0,T=!0)=>{if(U&&L&&!s.disabled){if(l.action=!0,T&&Array.isArray(H(n,y))){const G=L(H(n,y),U.argA,U.argB);z&&ce(n,y,G)}if(T&&Array.isArray(H(a.errors,y))){const G=L(H(a.errors,y),U.argA,U.argB);z&&ce(a.errors,y,G),Qd(a.errors,y)}if((m.touchedFields||h.touchedFields)&&T&&Array.isArray(H(a.touchedFields,y))){const G=L(H(a.touchedFields,y),U.argA,U.argB);z&&ce(a.touchedFields,y,G)}(m.dirtyFields||h.dirtyFields)&&(a.dirtyFields=gt(r,i)),x.state.next({name:y,isDirty:D(y,S),dirtyFields:a.dirtyFields,errors:a.errors,isValid:a.isValid})}else ce(i,y,S)},$=(y,S)=>{ce(a.errors,y,S),x.state.next({errors:a.errors})},v=y=>{a.errors=y,x.state.next({errors:a.errors,isValid:!1})},A=(y,S,L,U)=>{const z=H(n,y);if(z){const T=H(i,y,me(L)?H(r,y):L);me(T)||U&&U.defaultChecked||S?ce(i,y,S?T:mn(z._f)):V(y,T),l.mount&&!l.action&&b()}},M=(y,S,L,U,z)=>{let T=!1,G=!1;const re={name:y};if(!s.disabled){if(!L||U){(m.isDirty||h.isDirty)&&(G=a.isDirty,a.isDirty=re.isDirty=D(),T=G!==re.isDirty);const ie=Ue(H(r,y),S);G=!!H(a.dirtyFields,y),ie?pe(a.dirtyFields,y):ce(a.dirtyFields,y,!0),re.dirtyFields=a.dirtyFields,T=T||(m.dirtyFields||h.dirtyFields)&&G!==!ie}if(L){const ie=H(a.touchedFields,y);ie||(ce(a.touchedFields,y,L),re.touchedFields=a.touchedFields,T=T||(m.touchedFields||h.touchedFields)&&ie!==L)}T&&z&&x.state.next(re)}return T?re:{}},k=(y,S,L,U)=>{const z=H(a.errors,y),T=(m.isValid||h.isValid)&&Re(S)&&a.isValid!==S;if(s.delayError&&L?(d=j(()=>$(y,L)),d(s.delayError)):(clearTimeout(u),d=null,L?ce(a.errors,y,L):pe(a.errors,y)),(L?!Ue(z,L):z)||!Se(U)||T){const G={...U,...T&&Re(S)?{isValid:S}:{},errors:a.errors,name:y};a={...a,...G},x.state.next(G)}},F=async y=>(w(y,!0),await s.resolver(i,s.context,Hd(y||o.mount,n,s.criteriaMode,s.shouldUseNativeValidation))),C=async y=>{const{errors:S}=await F(y);if(w(y),y)for(const L of y){const U=H(S,L);U?ce(a.errors,L,U):pe(a.errors,L)}else a.errors=S;return S},_=async(y,S,L={valid:!0})=>{for(const U in y){const z=y[U];if(z){const{_f:T,...G}=z;if(T){const re=o.array.has(T.name),ie=z._f&&qd(z._f);ie&&m.validatingFields&&w([T.name],!0);const ke=await bn(z,o.disabled,i,g,s.shouldUseNativeValidation&&!S,re);if(ie&&m.validatingFields&&w([T.name]),ke[T.name]&&(L.valid=!1,S||e.shouldUseNativeValidation))break;!S&&(H(ke,T.name)?re?Zd(a.errors,ke,T.name):ce(a.errors,T.name,ke[T.name]):pe(a.errors,T.name))}!Se(G)&&await _(G,S,L)}}return L.valid},E=()=>{for(const y of o.unMount){const S=H(n,y);S&&(S._f.refs?S._f.refs.every(L=>!ks(L)):!ks(S._f.ref))&&ae(y)}o.unMount=new Set},D=(y,S)=>!s.disabled&&(y&&S&&ce(i,y,S),!Ue(Y(),r)),R=(y,S,L)=>Ys(y,o,{...l.mount?i:me(S)?r:Te(y)?{[y]:S}:S},L,S),O=y=>fa(H(l.mount?i:r,y,s.shouldUnregister?H(r,y,[]):[])),V=(y,S,L={})=>{const U=H(n,y);let z=S;if(U){const T=U._f;T&&(!T.disabled&&ce(i,y,Wr(S,T)),z=ss(T.ref)&&Fe(S)?"":S,Ur(T.ref)?[...T.ref.options].forEach(G=>G.selected=z.includes(G.value)):T.refs?Tt(T.ref)?T.refs.forEach(G=>{(!G.defaultChecked||!G.disabled)&&(Array.isArray(z)?G.checked=!!z.find(re=>re===G.value):G.checked=z===G.value||!!z)}):T.refs.forEach(G=>G.checked=G.value===z):ga(T.ref)?T.ref.value="":(T.ref.value=z,T.ref.type||x.state.next({name:y,values:he(i)})))}(L.shouldDirty||L.shouldTouch)&&M(y,z,L.shouldTouch,L.shouldDirty,!0),L.shouldValidate&&se(y)},q=(y,S,L)=>{for(const U in S){if(!S.hasOwnProperty(U))return;const z=S[U],T=y+"."+U,G=H(n,T);(o.array.has(y)||be(z)||G&&!G._f)&&!ct(z)?q(T,z,L):V(T,z,L)}},I=(y,S,L={})=>{const U=H(n,y),z=o.array.has(y),T=he(S);ce(i,y,T),z?(x.array.next({name:y,values:he(i)}),(m.isDirty||m.dirtyFields||h.isDirty||h.dirtyFields)&&L.shouldDirty&&x.state.next({name:y,dirtyFields:gt(r,i),isDirty:D(y,T)})):U&&!U._f&&!Fe(T)?q(y,T,L):V(y,T,L),hn(y,o)?x.state.next({...a,name:y,values:he(i)}):x.state.next({name:l.mount?y:void 0,values:he(i)})},J=async y=>{l.mount=!0;const S=y.target;let L=S.name,U=!0;const z=H(n,L),T=ie=>{U=Number.isNaN(ie)||ct(ie)&&isNaN(ie.getTime())||Ue(ie,H(i,L,ie))},G=fn(s.mode),re=fn(s.reValidateMode);if(z){let ie,ke;const it=S.type?mn(z._f):Pr(y),et=y.type===ts.BLUR||y.type===ts.FOCUS_OUT,Il=!Wd(z._f)&&!s.resolver&&!H(a.errors,L)&&!z._f.deps||Kd(et,H(a.touchedFields,L),a.isSubmitted,re,G),xs=hn(L,o,et);ce(i,L,it),et?(!S||!S.readOnly)&&(z._f.onBlur&&z._f.onBlur(y),d&&d(0)):z._f.onChange&&z._f.onChange(y);const hs=M(L,it,et),Pl=!Se(hs)||xs;if(!et&&x.state.next({name:L,type:y.type,values:he(i)}),Il)return(m.isValid||h.isValid)&&(s.mode==="onBlur"?et&&b():et||b()),Pl&&x.state.next({name:L,...xs?{}:hs});if(!et&&xs&&x.state.next({...a}),s.resolver){const{errors:Ta}=await F([L]);if(w([L]),T(it),U){const Ol=pn(a.errors,n,L),Ia=pn(Ta,n,Ol.name||L);ie=Ia.error,L=Ia.name,ke=Se(Ta)}}else w([L],!0),ie=(await bn(z,o.disabled,i,g,s.shouldUseNativeValidation))[L],w([L]),T(it),U&&(ie?ke=!1:(m.isValid||h.isValid)&&(ke=await _(n,!0)));U&&(z._f.deps&&(!Array.isArray(z._f.deps)||z._f.deps.length>0)&&se(z._f.deps),k(L,ke,ie,hs))}},W=(y,S)=>{if(H(a.errors,S)&&y.focus)return y.focus(),1},se=async(y,S={})=>{let L,U;const z=Et(y);if(s.resolver){const T=await C(me(y)?y:z);L=Se(T),U=y?!z.some(G=>H(T,G)):L}else y?(U=(await Promise.all(z.map(async T=>{const G=H(n,T);return await _(G&&G._f?{[T]:G}:G)}))).every(Boolean),!(!U&&!a.isValid)&&b()):U=L=await _(n);return x.state.next({...!Te(y)||(m.isValid||h.isValid)&&L!==a.isValid?{}:{name:y},...s.resolver||!y?{isValid:L}:{},errors:a.errors}),S.shouldFocus&&!U&&Ft(n,W,y?z:o.mount),U},Y=(y,S)=>{let L={...l.mount?i:r};return S&&(L=Vr(S.dirtyFields?a.dirtyFields:a.touchedFields,L)),me(y)?L:Te(y)?H(L,y):y.map(U=>H(L,U))},Z=(y,S)=>({invalid:!!H((S||a).errors,y),isDirty:!!H((S||a).dirtyFields,y),error:H((S||a).errors,y),isValidating:!!H(a.validatingFields,y),isTouched:!!H((S||a).touchedFields,y)}),Q=y=>{y&&Et(y).forEach(S=>pe(a.errors,S)),x.state.next({errors:y?a.errors:{}})},ee=(y,S,L)=>{const U=(H(n,y,{_f:{}})._f||{}).ref,z=H(a.errors,y)||{},{ref:T,message:G,type:re,...ie}=z;ce(a.errors,y,{...ie,...S,ref:U}),x.state.next({name:y,errors:a.errors,isValid:!1}),L&&L.shouldFocus&&U&&U.focus&&U.focus()},ne=(y,S)=>Ae(y)?x.state.subscribe({next:L=>"values"in L&&y(R(void 0,S),L)}):R(y,S,!0),X=y=>x.state.subscribe({next:S=>{Gd(y.name,S.name,y.exact)&&Yd(S,y.formState||m,le,y.reRenderRoot)&&y.callback({values:{...i},...a,...S,defaultValues:r})}}).unsubscribe,de=y=>(l.mount=!0,h={...h,...y.formState},X({...y,formState:{...f,...y.formState}})),ae=(y,S={})=>{for(const L of y?Et(y):o.mount)o.mount.delete(L),o.array.delete(L),S.keepValue||(pe(n,L),pe(i,L)),!S.keepError&&pe(a.errors,L),!S.keepDirty&&pe(a.dirtyFields,L),!S.keepTouched&&pe(a.touchedFields,L),!S.keepIsValidating&&pe(a.validatingFields,L),!s.shouldUnregister&&!S.keepDefaultValue&&pe(r,L);x.state.next({values:he(i)}),x.state.next({...a,...S.keepDirty?{isDirty:D()}:{}}),!S.keepIsValid&&b()},Ie=({disabled:y,name:S})=>{if(Re(y)&&l.mount||y||o.disabled.has(S)){const z=o.disabled.has(S)!==!!y;y?o.disabled.add(S):o.disabled.delete(S),z&&l.mount&&!l.action&&b()}},Ee=(y,S={})=>{let L=H(n,y);const U=Re(S.disabled)||Re(s.disabled);return ce(n,y,{...L||{},_f:{...L&&L._f?L._f:{ref:{name:y}},name:y,mount:!0,...S}}),o.mount.add(y),L?Ie({disabled:Re(S.disabled)?S.disabled:s.disabled,name:y}):A(y,!0,S.value),{...U?{disabled:S.disabled||s.disabled}:{},...s.progressive?{required:!!S.required,min:kt(S.min),max:kt(S.max),minLength:kt(S.minLength),maxLength:kt(S.maxLength),pattern:kt(S.pattern)}:{},name:y,onChange:J,onBlur:J,ref:z=>{if(z){Ee(y,S),L=H(n,y);const T=me(z.value)&&z.querySelectorAll&&z.querySelectorAll("input,select,textarea")[0]||z,G=zd(T),re=L._f.refs||[];if(G?re.find(ie=>ie===T):T===L._f.ref)return;ce(n,y,{_f:{...L._f,...G?{refs:[...re.filter(ks),T,...Array.isArray(H(r,y))?[{}]:[]],ref:{type:T.type,name:y}}:{ref:T}}}),A(y,!1,void 0,T)}else L=H(n,y,{}),L._f&&(L._f.mount=!1),(s.shouldUnregister||S.shouldUnregister)&&!(Or(o.array,y)&&l.action)&&o.unMount.add(y)}}},Le=()=>s.shouldFocusError&&Ft(n,W,o.mount),mt=y=>{Re(y)&&(x.state.next({disabled:y}),Ft(n,(S,L)=>{const U=H(n,L);U&&(S.disabled=U._f.disabled||y,Array.isArray(U._f.refs)&&U._f.refs.forEach(z=>{z.disabled=U._f.disabled||y}))},0,!1))},Ge=(y,S)=>async L=>{let U;L&&(L.preventDefault&&L.preventDefault(),L.persist&&L.persist());let z=he(i);if(x.state.next({isSubmitting:!0}),s.resolver){const{errors:T,values:G}=await F();w(),a.errors=T,z=he(G)}else await _(n);if(o.disabled.size)for(const T of o.disabled)pe(z,T);if(pe(a.errors,"root"),Se(a.errors)){x.state.next({errors:{}});try{await y(z,L)}catch(T){U=T}}else S&&await S({...a.errors},L),Le(),setTimeout(Le);if(x.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:Se(a.errors)&&!U,submitCount:a.submitCount+1,errors:a.errors}),U)throw U},We=(y,S={})=>{H(n,y)&&(me(S.defaultValue)?I(y,he(H(r,y))):(I(y,S.defaultValue),ce(r,y,he(S.defaultValue))),S.keepTouched||pe(a.touchedFields,y),S.keepDirty||(pe(a.dirtyFields,y),a.isDirty=S.defaultValue?D(y,he(H(r,y))):D()),S.keepError||(pe(a.errors,y),m.isValid&&b()),x.state.next({...a}))},rt=(y,S={})=>{const L=y?he(y):r,U=he(L),z=Se(y),T=z?r:U;if(S.keepDefaultValues||(r=L),!S.keepValues){if(S.keepDirtyValues){const G=new Set([...o.mount,...Object.keys(gt(r,i))]);for(const re of Array.from(G)){const ie=H(a.dirtyFields,re),ke=H(i,re),it=H(T,re);ie&&!me(ke)?ce(T,re,ke):!ie&&!me(it)&&I(re,it)}}else{if(ma&&me(y))for(const G of o.mount){const re=H(n,G);if(re&&re._f){const ie=Array.isArray(re._f.refs)?re._f.refs[0]:re._f.ref;if(ss(ie)){const ke=ie.closest("form");if(ke){ke.reset();break}}}}if(S.keepFieldsRef)for(const G of o.mount)I(G,H(T,G));else n={}}i=s.shouldUnregister?S.keepDefaultValues?he(r):{}:he(T),x.array.next({values:{...T}}),x.state.next({values:{...T}})}o={mount:S.keepDirtyValues?o.mount:new Set,unMount:new Set,array:new Set,disabled:new Set,watch:new Set,watchAll:!1,focus:""},l.mount=!m.isValid||!!S.keepIsValid||!!S.keepDirtyValues||!s.shouldUnregister&&!Se(T),l.watch=!!s.shouldUnregister,l.keepIsValid=!!S.keepIsValid,l.action=!1,S.keepErrors||(a.errors={}),x.state.next({submitCount:S.keepSubmitCount?a.submitCount:0,isDirty:z?!1:S.keepDirty?a.isDirty:!!(S.keepDefaultValues&&!Ue(y,r)),isSubmitted:S.keepIsSubmitted?a.isSubmitted:!1,dirtyFields:z?{}:S.keepDirtyValues?S.keepDefaultValues&&i?gt(r,i):a.dirtyFields:S.keepDefaultValues&&y?gt(r,y):S.keepDirty?a.dirtyFields:{},touchedFields:S.keepTouched?a.touchedFields:{},errors:S.keepErrors?a.errors:{},isSubmitSuccessful:S.keepIsSubmitSuccessful?a.isSubmitSuccessful:!1,isSubmitting:!1,defaultValues:r})},Je=(y,S)=>rt(Ae(y)?y(i):y,{...s.resetOptions,...S}),Pe=(y,S={})=>{const L=H(n,y),U=L&&L._f;if(U){const z=U.refs?U.refs[0]:U.ref;z.focus&&setTimeout(()=>{z.focus(),S.shouldSelect&&Ae(z.select)&&z.select()})}},le=y=>{a={...a,...y}},Ye={control:{register:Ee,unregister:ae,getFieldState:Z,handleSubmit:Ge,setError:ee,_subscribe:X,_runSchema:F,_updateIsValidating:w,_focusError:Le,_getWatch:R,_getDirty:D,_setValid:b,_setFieldArray:N,_setDisabledField:Ie,_setErrors:v,_getFieldArray:O,_reset:rt,_resetDefaultValues:()=>Ae(s.defaultValues)&&s.defaultValues().then(y=>{Je(y,s.resetOptions),x.state.next({isLoading:!1})}),_removeUnmounted:E,_disableForm:mt,_subjects:x,_proxyFormState:m,get _fields(){return n},get _formValues(){return i},get _state(){return l},set _state(y){l=y},get _defaultValues(){return r},get _names(){return o},set _names(y){o=y},get _formState(){return a},get _options(){return s},set _options(y){s={...s,...y}}},subscribe:de,trigger:se,register:Ee,handleSubmit:Ge,watch:ne,setValue:I,getValues:Y,reset:Je,resetField:We,clearErrors:Q,unregister:ae,setError:ee,setFocus:Pe,getFieldState:Z};return{...Ye,formControl:Ye}}function eu(e={}){const s=p.useRef(void 0),a=p.useRef(void 0),[n,r]=p.useState({isDirty:!1,isValidating:!1,isLoading:Ae(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:Ae(e.defaultValues)?void 0:e.defaultValues});if(!s.current)if(e.formControl)s.current={...e.formControl,formState:n},e.defaultValues&&!Ae(e.defaultValues)&&e.formControl.reset(e.defaultValues,e.resetOptions);else{const{formControl:l,...o}=Jd(e);s.current={...o,formState:n}}const i=s.current.control;return i._options=e,pa(()=>{const l=i._subscribe({formState:i._proxyFormState,callback:()=>r({...i._formState}),reRenderRoot:!0});return r(o=>({...o,isReady:!0})),i._formState.isReady=!0,l},[i]),p.useEffect(()=>i._disableForm(e.disabled),[i,e.disabled]),p.useEffect(()=>{e.mode&&(i._options.mode=e.mode),e.reValidateMode&&(i._options.reValidateMode=e.reValidateMode)},[i,e.mode,e.reValidateMode]),p.useEffect(()=>{e.errors&&(i._setErrors(e.errors),i._focusError())},[i,e.errors]),p.useEffect(()=>{e.shouldUnregister&&i._subjects.state.next({values:i._getWatch()})},[i,e.shouldUnregister]),p.useEffect(()=>{if(i._proxyFormState.isDirty){const l=i._getDirty();l!==n.isDirty&&i._subjects.state.next({isDirty:l})}},[i,n.isDirty]),p.useEffect(()=>{var l;e.values&&!Ue(e.values,a.current)?(i._reset(e.values,{keepFieldsRef:!0,...i._options.resetOptions}),!((l=i._options.resetOptions)===null||l===void 0)&&l.keepIsValid||i._setValid(),a.current=e.values,r(o=>({...o}))):i._resetDefaultValues()},[i,e.values]),p.useEffect(()=>{i._state.mount||(i._setValid(),i._state.mount=!0),i._state.watch&&(i._state.watch=!1,i._subjects.state.next({...i._formState})),i._removeUnmounted()}),s.current.formState=p.useMemo(()=>Br(n,i),[i,n]),s.current}function tu(e,s=3){return e%1===0?e.toString():e.toFixed(s).replace(/\.?0+$/,"")}function su(e,s="en-US",a="USD"){try{return new Intl.NumberFormat(s,{style:"currency",currency:a,minimumFractionDigits:2,maximumFractionDigits:2}).format(e)}catch(n){return console.warn(`Invalid currency formatting: ${n}`),`${a} ${e.toFixed(2)}`}}function au(e="USD",s="en-US"){try{return new Intl.NumberFormat(s,{style:"currency",currency:e}).formatToParts(0).find(i=>i.type==="currency")?.value??"$"}catch{return"$"}}function nu(e){const s=e.replace(/[^\d.,-]/g,""),a=s.match(/,\d{1,2}$/);let n;a?n=s.replace(/\./g,"").replace(",","."):n=s.replace(/,/g,"");const r=parseFloat(n);return isNaN(r)?null:r}function ru(e,s,a=.001){const n=e-s,r=Math.abs(n)<=a;return{difference:n,isBalanced:r,isUnderAllocated:!r&&n>0,isOverAllocated:!r&&n<0}}function ya(){return`dist-${Date.now()}-${Math.random().toString(36).substr(2,9)}`}ya();const iu={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:"$"},Ss=()=>({id:ya(),amount:0,glAccount:null,isTaxDeductible:!1}),Gr=({distribution:e,defaultDistribution:s,glAccounts:a=[],isLoadingGlAccounts:n=!1,onSearchGlAccounts:r,onDistributionChange:i,onAmountChange:l,onGlAccountChange:o,onTaxDeductibleChange:d,onDelete:u,canDelete:f=!0,canEditTaxDeductible:m=!0,isDisabled:h=!1,labels:x,classNames:g={},"data-testid":j,control:b,name:w,rules:N})=>{const $={...iu,...x},v=b!==void 0&&w!==void 0,A=eu({defaultValues:{_internal:s||Ss()}}),M=Id({control:v?b:A.control,name:v?w:"_internal",rules:v?N:void 0}),[k,F]=p.useState(s||Ss()),C=v?M.field.value??Ss():e??k,_=v&&!!M.fieldState?.error,E=v&&(M.fieldState?.isTouched??!1),D=_||E,R=D&&(!C.amount||C.amount<=0),O=D&&!C.glAccount,[V,q]=p.useState(C.glAccount?.name||""),I=p.useCallback(ee=>{const ne={...C,...ee};v&&M.field.onChange(ne),!v&&e===void 0&&F(ne),i?.(ne)},[C,e,i,v,M]),J=p.useCallback(ee=>{const ne=ee||0;I({amount:ne}),l?.(ne)},[I,l]),W=p.useCallback(ee=>{q(ee),r?.(ee)},[r]),se=p.useCallback(ee=>{if(ee===null){I({glAccount:null}),o?.(null);return}const X=a.find(de=>String(de.id)===String(ee))||null;I({glAccount:X}),o?.(X)},[a,I,o]),Y=p.useCallback(()=>{q(""),I({glAccount:null}),o?.(null)},[I,o]),Z=p.useCallback(ee=>{I({isTaxDeductible:ee}),d?.(ee)},[I,d]),Q=p.useCallback(()=>{u?.()},[u]);return t.jsx(c.Card,{radius:"md",shadow:"sm","data-testid":j||"revenue-distribution-card",className:c.cn(g.base),children:t.jsxs(c.CardBody,{className:c.cn("flex flex-row flex-nowrap items-start gap-4",g.body),children:[t.jsx("div",{className:c.cn("shrink-0",g.amountContainer),children:t.jsx(c.NumberInput,{"data-testid":`${j||"revenue-distribution-card"}-amount-input`,label:t.jsxs("span",{className:"flex items-center gap-1",children:[$.amount,t.jsx(c.Tooltip,{content:$.amountTooltip,children:t.jsx(P,{icon:"solar:info-circle-linear",className:"text-default-400 cursor-help",width:16})})]}),value:C.amount||void 0,onValueChange:J,labelPlacement:"outside",placeholder:$.amountPlaceholder,isWheelDisabled:!0,hideStepper:!0,variant:"bordered",isDisabled:h,isInvalid:R,errorMessage:R?"Amount is required":void 0,minValue:0,step:.01,className:g.amountInput,startContent:t.jsx("div",{className:"pointer-events-none flex items-center",children:t.jsx("span",{className:"text-default-400 text-small",children:$.currencySymbol})})})}),t.jsx("div",{className:c.cn("grow",g.glAccountContainer),children:t.jsx(c.Autocomplete,{"data-testid":`${j||"revenue-distribution-card"}-gl-account-input`,label:t.jsxs("span",{className:"flex items-center gap-1",children:[$.glAccount,t.jsx(c.Tooltip,{content:$.glAccountTooltip,children:t.jsx(P,{icon:"solar:info-circle-linear",className:"text-default-400 cursor-help",width:16})})]}),isLoading:n,isClearable:!0,labelPlacement:"outside",variant:"bordered",items:a,menuTrigger:"input",inputValue:C.glAccount?.name??V,selectedKey:C.glAccount?.id??null,isDisabled:h,isInvalid:O,errorMessage:O?"GL Account is required":void 0,listboxProps:{emptyContent:n?$.searching:$.noGlAccountsFound},placeholder:$.glAccountPlaceholder,onInputChange:W,onSelectionChange:se,onClear:Y,className:g.glAccountInput,children:ee=>t.jsx(c.AutocompleteItem,{textValue:ee.name,children:t.jsxs("div",{className:"flex flex-col",children:[t.jsx("span",{children:ee.name}),ee.code&&t.jsx("span",{className:"text-xs text-default-400",children:ee.code})]})},ee.id)})}),t.jsx("div",{className:c.cn("shrink-0 pt-6 flex items-center",g.taxDeductibleContainer),children:t.jsx(c.Checkbox,{radius:"full","data-testid":`${j||"revenue-distribution-card"}-tax-deductible`,isSelected:C.isTaxDeductible,onValueChange:Z,isDisabled:h||!m,className:g.taxDeductibleCheckbox,children:$.taxDeductible})}),t.jsx("div",{className:c.cn("shrink-0 pt-6",g.deleteContainer),children:t.jsx(B,{"data-testid":`${j||"revenue-distribution-card"}-delete-button`,size:"sm",color:"danger",variant:"flat",isDisabled:h||!f,onPress:Q,startContent:t.jsx(P,{icon:"solar:trash-bin-trash-linear",width:16}),className:c.cn("text-danger",g.deleteButton),children:$.deleteButton})})]})})};Gr.displayName="RevenueDistributionCard";const Kr=({message:e="No distributions configured",icon:s="solar:document-text-outline",iconSize:a=48,showCard:n=!0,classNames:r={},renderEmpty:i})=>{if(i)return t.jsx(t.Fragment,{children:i()});const l=t.jsxs("div",{className:c.cn("flex flex-col items-center justify-center py-8",r.content),children:[t.jsx(P,{icon:s,width:a,className:c.cn("text-default-300 mb-4",r.icon)}),t.jsx("p",{className:c.cn("text-default-500 text-sm text-center",r.message),children:e})]});return n?t.jsx(c.Card,{radius:"sm",shadow:"sm","data-testid":"revenue-distribution-empty",className:c.cn("w-full",r.base),children:t.jsx(c.CardBody,{children:l})}):t.jsx("div",{"data-testid":"revenue-distribution-empty",className:c.cn("w-full",r.base),children:l})};Kr.displayName="RevenueDistributionEmpty";const lu={title:"Error Loading Distributions",description:"An error occurred while loading the distribution configuration. Please try again."},Qr=({error:e,labels:s,showCard:a=!0,color:n="danger",classNames:r={}})=>{const i={...lu,...s},l=t.jsx(c.Alert,{"data-testid":"revenue-distribution-error-alert",color:n,title:i.title,description:e||i.description,className:r.alert});return a?t.jsx(c.Card,{radius:"sm",shadow:"sm","data-testid":"revenue-distribution-error",className:c.cn("w-full",r.base),children:t.jsx(c.CardBody,{children:l})}):t.jsx("div",{"data-testid":"revenue-distribution-error",className:c.cn("w-full",r.base),children:l})};Qr.displayName="RevenueDistributionError";const Zr=({rows:e=1,showCard:s=!0,classNames:a={}})=>{const n=Array.from({length:e},(i,l)=>l),r=i=>t.jsxs("div",{className:c.cn("flex flex-row flex-nowrap items-end gap-4",a.row),children:[t.jsxs("div",{className:"shrink-0 flex flex-col gap-1",children:[t.jsxs("div",{className:"flex items-center gap-1",children:[t.jsx(c.Skeleton,{className:"h-4 w-14 rounded-md"}),t.jsx(c.Skeleton,{className:"h-4 w-4 rounded-full"})]}),t.jsx(c.Skeleton,{className:"h-10 w-32 rounded-lg"})]}),t.jsxs("div",{className:"grow flex flex-col gap-1",children:[t.jsxs("div",{className:"flex items-center gap-1",children:[t.jsx(c.Skeleton,{className:"h-4 w-20 rounded-md"}),t.jsx(c.Skeleton,{className:"h-4 w-4 rounded-full"})]}),t.jsx(c.Skeleton,{className:"h-10 w-full rounded-lg"})]}),t.jsxs("div",{className:"shrink-0 pb-2 flex items-center gap-2",children:[t.jsx(c.Skeleton,{className:"h-5 w-5 rounded-full"}),t.jsx(c.Skeleton,{className:"h-4 w-24 rounded-md"})]}),t.jsx("div",{className:"shrink-0 pb-2",children:t.jsx(c.Skeleton,{className:"h-8 w-20 rounded-lg"})})]},i);return s?t.jsx("div",{className:c.cn("flex flex-col gap-3",a.base),children:n.map(i=>t.jsx(c.Card,{radius:"md",shadow:"sm","data-testid":`revenue-distribution-skeleton-${i}`,children:t.jsx(c.CardBody,{children:r(i)})},i))}):t.jsx("div",{"data-testid":"revenue-distribution-skeleton",className:c.cn("flex flex-col gap-3",a.base),children:n.map(i=>r(i))})};Zr.displayName="RevenueDistributionSkeleton";function va({isOpen:e,labels:s,icon:a,isConfirming:n=!1,confirmColor:r="danger",iconTone:i="danger",portalContainer:l,shouldBlockScroll:o,classNames:d,onClose:u,onConfirm:f}){return t.jsx(c.Modal,{isOpen:e,size:"md",placement:"center",portalContainer:l,shouldBlockScroll:o,classNames:{...d,base:c.cn("max-w-[440px] rounded-3xl",d?.base),closeButton:c.cn("right-5 top-5 text-zinc-500",d?.closeButton)},onOpenChange:m=>!m&&u(),children:t.jsxs(c.ModalContent,{children:[t.jsxs(c.ModalHeader,{className:"flex flex-col items-start gap-4 px-7 pb-0 pt-7",children:[a&&t.jsx("span",{className:c.cn("flex h-12 w-12 shrink-0 items-center justify-center rounded-full",i==="warning"?"bg-brand/15 text-brand":"bg-danger-100 text-danger-600"),children:a}),t.jsx("span",{className:"text-lg font-semibold leading-6 text-zinc-950",children:s.title})]}),t.jsx(c.ModalBody,{className:"px-7 pb-3 pt-4",children:t.jsx("div",{className:"text-sm leading-6 text-zinc-500",children:s.description})}),t.jsxs(c.ModalFooter,{className:"grid grid-cols-2 gap-3 px-7 pb-7 pt-3",children:[t.jsx(B,{type:"button",size:"md",variant:"bordered",radius:"full",className:"h-10 border-zinc-200 bg-white text-sm font-normal text-zinc-900",onPress:u,children:s.cancel}),t.jsx(B,{type:"button",size:"md",color:r,radius:"full",className:c.cn("h-10 text-sm font-normal text-white",r==="danger"?"bg-danger-600":"bg-brand"),isLoading:n,onPress:f,children:s.confirm})]})]})})}const ou=()=>({id:crypto.randomUUID(),fund:null,percentage:0});function yn(e){return!e.fund&&Number(e.percentage||0)<=0}function cu({mode:e,assignments:s}){const a=s.filter(i=>i.fund),n=a.reduce((i,l)=>i+Number(l.percentage||0),0),r=s.some(i=>!i.fund||Number(i.percentage||0)<=0);return a.length>=1&&!r&&Math.round(n*100)/100===100}const du={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"},Xr={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"},St={...Xr,base:"min-h-11 rounded-2xl px-4 py-2 shadow-none",title:"text-sm font-medium"},uu={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"},mu={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 fu(){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 xu=e=>Number.isFinite(e)?Math.max(0,Math.min(100,Math.round(e*100)/100)):0,hu=e=>e.fund!==null;function pu({assignments:e,funds:s,labels:a,classNames:n,isSaving:r=!1,hasSavedAssignments:i=!1,showSavedIndicator:l=!1,isCollapsed:o,isFundPickerOpen:d=!1,activeAssignmentId:u=null,modalPortalContainer:f,footer:m,onAssignmentsChange:h,onOpenFundPicker:x,onCloseFundPicker:g,onCollapseChange:j,onSave:b}){const[w,N]=p.useState(null),$=f??w??void 0,v={...du,...a},A=e.filter(X=>!yn(X)),k=A.filter(hu).length>0,F=p.useMemo(()=>e.filter(X=>!yn(X)).reduce((X,de)=>X+Number(de.percentage||0),0),[e]),C=Math.round(F*100)/100,_=A.some(X=>!X.fund||Number(X.percentage||0)<=0),E=k&&(C!==100||_),D=`${v.totalError} (${v.total} ${Number(F.toFixed(2))}%)`,R=cu({mode:"split",assignments:e}),O=k&&C>=100,[V,q]=p.useState(!1),[I,J]=p.useState(!1),W=t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(fu,{}),t.jsx("span",{className:"text-base font-medium leading-6 text-zinc-950",children:v.title}),l?t.jsx(c.Chip,{size:"sm",radius:"full",color:"success",variant:"flat",children:v.saved}):null]}),se=(X,de)=>{h(e.map(ae=>ae.id===X?{...ae,...de}:ae))},Y=()=>{O||h([...e,ou()])},Z=X=>{e.length<=1||h(e.filter(de=>de.id!==X))},Q=()=>{if(!r){if(!R){J(!0);return}if(!i){b();return}q(!0)}},ee=()=>{q(!1),b()},ne=X=>{const de=u??e.find(ae=>!ae.fund)?.id??e[0]?.id;de&&(h(e.map(ae=>ae.id===de?{...ae,fund:X}:ae)),g())};return t.jsxs("div",{ref:N,className:c.cn("vvt-pa relative min-w-0 w-full font-sans text-zinc-900 [container-type:inline-size]",d&&!f&&"min-h-[560px]",n?.root),children:[t.jsx(c.Accordion,{variant:"splitted",defaultSelectedKeys:o===void 0?["installment-fund-assignment"]:void 0,selectedKeys:o===void 0?void 0:new Set(o?[]:["installment-fund-assignment"]),className:c.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:c.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:X=>j?.(!(X==="all"||Array.from(X).length>0)),children:t.jsx(c.AccordionItem,{"aria-label":v.title,title:W,children:t.jsxs("div",{className:c.cn("flex w-full flex-col gap-4",n?.content),children:[t.jsxs("div",{className:"flex w-full flex-col gap-4",children:[!k&&t.jsx(c.Alert,{icon:t.jsx(P,{icon:"solar:info-circle-outline",className:"size-4"}),hideIconWrapper:!0,isClosable:!1,classNames:Xr,color:"default",variant:"flat",title:v.emptySplit}),k&&t.jsx(gu,{assignments:e,labels:v,total:F,hasTotalError:I&&!R||E,validationMessage:D,onSelectFund:X=>x(X),onRemoveFund:Z,onPercentageChange:(X,de)=>se(X,{percentage:xu(de)})}),t.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[t.jsx(B,{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(K.Plus,{className:"size-5",strokeWidth:2}),isDisabled:O,onPress:()=>k?Y():x(),children:v.assignSpecificFund}),t.jsx(B,{type:"button","data-testid":"installment-fund-assignment-save-button",size:"md",color:"primary",radius:"full",className:"ml-auto h-10 min-w-40 px-4 text-sm font-medium [@container(max-width:479px)]:w-full",startContent:r?void 0:t.jsx(P,{icon:"solar:cloud-upload-outline",className:"size-4"}),isLoading:r,isDisabled:!R||r,onPress:Q,children:v.saveAssignment})]})]}),m]})},"installment-fund-assignment")}),d&&t.jsx(bu,{funds:s,labels:v,selectedFundIds:e.map(X=>X.fund?.id).filter(Boolean),portalContainer:$,onSelect:ne,onClose:g}),t.jsx(va,{isOpen:V,labels:{title:v.modifyAssignedFundsTitle,description:t.jsxs(t.Fragment,{children:[t.jsx("p",{children:v.modifyAssignedFundsDescription}),t.jsx("p",{className:"mt-3",children:v.modifyAssignedFundsWarning})]}),cancel:v.modifyAssignedFundsCancel,confirm:v.modifyAssignedFundsConfirm},icon:t.jsx(P,{icon:"solar:info-circle-outline",className:"size-7"}),iconTone:"warning",confirmColor:"primary",portalContainer:$,shouldBlockScroll:!1,classNames:mu,onClose:()=>q(!1),onConfirm:ee})]})}function gu({assignments:e,labels:s,total:a,hasTotalError:n,validationMessage:r,onSelectFund:i,onRemoveFund:l,onPercentageChange:o}){return t.jsxs("div",{className:"flex flex-col gap-3",children:[e.map((d,u)=>t.jsxs("div",{"data-testid":"installment-fund-assignment-row",className:"flex min-h-15 w-full flex-wrap items-center gap-3 rounded-2xl border border-zinc-200 bg-white px-3 py-2",children:[t.jsx("div",{className:c.cn("flex min-h-11 min-w-0 basis-full items-center gap-2","[@container(min-width:560px)]:basis-0 [@container(min-width:560px)]:flex-1 [@container(min-width:560px)]:gap-4"),children:d.fund?t.jsxs(t.Fragment,{children:[t.jsxs("span",{className:"min-w-0 break-words rounded-2xl bg-zinc-100 px-4 py-1.5 text-sm text-zinc-950",children:[d.fund.glCode," - ",d.fund.accountName]}),t.jsx(B,{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(B,{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(K.Plus,{className:"size-5",strokeWidth:2}),onPress:()=>i(d.id),children:s.assignSpecificFund})}),t.jsx("label",{className:"flex min-w-0 flex-1 items-center [@container(min-width:560px)]:w-48 [@container(min-width:560px)]:flex-none",children:t.jsx(c.Input,{variant:"bordered",type:"number",min:0,max:100,step:.01,value:String(d.percentage||""),onChange:f=>o(d.id,Number(f.target.value)),endContent:t.jsx("span",{className:"text-sm text-zinc-500",children:"%"}),classNames:uu})}),e.length>1&&t.jsx(B,{type:"button",isIconOnly:!0,variant:"flat",radius:"full",className:c.cn("h-10 w-10 flex-none p-0",u===0?"bg-danger-100 text-danger-500 opacity-60":"bg-danger-600 text-white"),style:{height:40,minWidth:40,width:40},isDisabled:u===0,onPress:()=>l(d.id),"aria-label":s.removeFund,children:t.jsx(P,{icon:"solar:trash-bin-minimalistic-outline",className:"size-5"})})]},d.id)),t.jsx(c.Alert,{icon:t.jsx(P,{icon:n?"solar:info-circle-outline":"solar:check-circle-outline",className:"size-4"}),hideIconWrapper:!0,isClosable:!1,color:n?"warning":"success",variant:"flat",classNames:{...St,base:c.cn(St.base,n?"bg-warning-50 text-warning-700":"bg-success-50 text-success-700"),iconWrapper:c.cn(St.iconWrapper,n?"text-warning-700":"text-success-700"),alertIcon:c.cn(St.alertIcon,n?"text-warning-700":"text-success-700"),title:c.cn(St.title,n?"text-warning-700":"text-success-700")},title:n?r:`${s.total} ${Number(a.toFixed(2))}%`})]})}function bu({funds:e,labels:s,selectedFundIds:a,portalContainer:n,onSelect:r,onClose:i}){const[l,o]=p.useState(""),d=e.filter(u=>{if(a.includes(u.id))return!1;const f=l.trim().toLowerCase();return f?`${u.glCode} ${u.accountName} ${u.type}`.toLowerCase().includes(f):!0});return t.jsx(c.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(c.ModalContent,{className:"max-h-full",children:[t.jsx(c.ModalHeader,{className:"px-6 pr-12 pt-6 text-xl font-semibold leading-7 text-zinc-950",children:s.modalTitle}),t.jsxs(c.ModalBody,{className:"flex min-h-0 flex-1 flex-col px-6 pb-6",children:[t.jsx(c.Input,{variant:"bordered","aria-label":s.searchPlaceholder,value:l,placeholder:s.searchPlaceholder,onChange:u=>o(u.target.value),startContent:t.jsx(P,{icon:"solar:magnifer-outline",className:"size-5 text-zinc-500"}),classNames:{input:"text-sm placeholder:text-zinc-500",inputWrapper:"h-10 rounded-2xl border border-zinc-200 bg-white px-4 shadow-none hover:border-zinc-300 data-[hover=true]:border-zinc-300 group-data-[focus=true]:border-zinc-400 group-data-[focus-visible=true]:ring-0"}}),t.jsxs("div",{className:"mt-4 min-h-0 flex-1 overflow-auto [container-type:inline-size]",children:[t.jsxs("div",{className:"hidden grid-cols-[1fr_1.3fr_0.6fr] gap-5 border-b border-zinc-200 px-3 pb-3 text-sm font-medium leading-5 text-zinc-900 [@container(min-width:520px)]:grid",children:[t.jsx("span",{children:s.glCode}),t.jsx("span",{children:s.accountName}),t.jsx("span",{children:s.actions})]}),d.length===0&&t.jsx("div",{className:"p-4 text-sm text-zinc-500",children:s.noFunds}),d.map(u=>t.jsxs("div",{"data-testid":"installment-fund-picker-row",className:"grid grid-cols-[minmax(0,1fr)_auto] items-center gap-x-3 border-b border-zinc-100 px-3 py-2.5 text-sm leading-5 text-zinc-900 last:border-b-0 [@container(min-width:520px)]:grid-cols-[1fr_1.3fr_0.6fr] [@container(min-width:520px)]:gap-5 [@container(min-width:520px)]:border-b-0",children:[t.jsx("span",{className:"col-start-1 row-start-1 font-medium [@container(min-width:520px)]:font-normal",children:u.glCode}),t.jsx("span",{className:"col-start-1 row-start-2 min-w-0 break-words text-zinc-600 [@container(min-width:520px)]:col-start-2 [@container(min-width:520px)]:row-start-1 [@container(min-width:520px)]:text-zinc-900",children:u.accountName}),t.jsx(B,{type:"button",size:"sm",variant:"bordered",radius:"full",className:"col-start-2 row-span-2 row-start-1 h-9 min-w-20 border-zinc-200 bg-white text-sm font-medium text-zinc-900 [@container(min-width:520px)]:col-start-3 [@container(min-width:520px)]:row-span-1 [@container(min-width:520px)]:min-w-24",onPress:()=>r(u),children:s.select})]},u.id))]})]})]})})}function yu(){return t.jsxs("section",{className:"flex w-full flex-col gap-4 rounded-2xl border border-zinc-200 bg-white p-4 shadow-sm","aria-busy":"true",children:[t.jsxs("div",{className:"flex items-start justify-between gap-3",children:[t.jsx(c.Skeleton,{className:"h-7 w-56 rounded-lg"}),t.jsx(c.Skeleton,{className:"size-8 rounded-full"})]}),t.jsxs("div",{className:"flex items-center justify-between gap-3",children:[t.jsx(c.Skeleton,{className:"h-10 w-72 rounded-full"}),t.jsx(c.Skeleton,{className:"h-10 w-40 rounded-full"})]}),t.jsxs("div",{className:"grid grid-cols-[minmax(0,1fr)_160px] items-center gap-4 rounded-2xl border border-zinc-100 p-3",children:[t.jsx(c.Skeleton,{className:"h-8 w-full max-w-xs rounded-full"}),t.jsx(c.Skeleton,{className:"h-8 w-full rounded-xl"})]}),t.jsx(c.Skeleton,{className:"h-11 w-40 rounded-full"})]})}const vu={totalAmount:"Total Amount:",remainingBalance:"Remaining Balance",amountReceived:"Amount Received:"};function ju({totalAmount:e,remainingBalance:s,amountReceived:a,currency:n="USD",locale:r="en-US",labels:i,className:l}){const o={...vu,...i},d=new Intl.NumberFormat(r,{style:"currency",currency:n});return t.jsx("div",{className:c.cn("w-full rounded-2xl border border-zinc-200 bg-white px-4 py-2.5 font-sans text-base leading-6",l),children:t.jsxs("div",{className:"flex w-full flex-wrap items-center gap-x-5 gap-y-2",children:[t.jsx($s,{label:o.totalAmount,value:d.format(e)}),t.jsx($s,{label:o.remainingBalance,value:d.format(s)}),t.jsx($s,{label:o.amountReceived,value:d.format(a)})]})})}function $s({label:e,value:s}){return t.jsxs("div",{className:"flex items-center gap-3 whitespace-nowrap",children:[t.jsx("span",{className:"font-medium text-zinc-700",children:e}),t.jsx("span",{className:"font-normal text-zinc-950",children:s})]})}const wu={monthly:1,quarterly:3,annual:12},Jr=e=>{const[s,a,n]=e.split("-").map(Number);return{year:s,month:a,day:n}},Nu=(e,s)=>new Date(e,s+1,0).getDate(),Cu=e=>{const s=e.getFullYear(),a=String(e.getMonth()+1).padStart(2,"0"),n=String(e.getDate()).padStart(2,"0");return`${s}-${a}-${n}`},ku=(e,s)=>{const{year:a,month:n,day:r}=Jr(e),i=n-1+s,l=a+Math.floor(i/12),o=(i%12+12)%12,d=Math.min(r,Nu(l,o));return new Date(l,o,d)},Su=(e,s)=>{const{year:a,month:n,day:r}=Jr(e),i=new Date(a,n-1,r);return i.setDate(i.getDate()+s),i};function ei(e,s){const a=Math.max(1,Math.floor(s.numberOfInstallments||1)),n=Math.round(e*100),r=Math.floor(n/a),i=n-r*a,l=wu[s.frequency];return Array.from({length:a},(o,d)=>{const u=s.frequency==="weekly"?Su(s.firstInstallmentDate,d*7):ku(s.firstInstallmentDate,d*(l??1));return{id:crypto.randomUUID(),dueDate:Cu(u),amount:(r+(d===0?i:0))/100}})}function $u(e){return new Set(e.map((s,a)=>{const n=e[a+1]?.dueDate;return s.dueDate&&n&&s.dueDate>n?s.id:null}).filter(s=>!!s))}function Au(e){return{missingDateRows:new Set(e.filter(s=>!s.dueDate).map(s=>s.id)),invalidDateRows:$u(e),invalidAmountRows:new Set(e.filter(s=>Number(s.amount||0)<=0).map(s=>s.id))}}function Du(e){return e.missingDateRows.size>0||e.invalidDateRows.size>0||e.invalidAmountRows.size>0}function Eu(e,s){const a=e[0];return!a||!s||a.dueDate===s?e:[{...a,dueDate:s},...e.slice(1)]}const Fu=new Set(["paid","partially_refunded","refunded"]);function dt(e){return e!==void 0&&Fu.has(e)}const Lu={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."},Mu=["weekly","monthly","quarterly","annual"],_u=Array.from({length:31},(e,s)=>s+1),Ru=["numberOfInstallments","frequency","firstInstallmentDate"],vn=()=>({id:crypto.randomUUID(),dueDate:new Date().toISOString().slice(0,10),amount:0}),ns=e=>Math.round(e*100)/100,Tu=(e,s)=>{const a=new Date(`${e}T00:00:00`);return Number.isNaN(a.getTime())?e:new Intl.DateTimeFormat(s,{month:"short",day:"numeric",year:"numeric"}).format(a)},ms=e=>{if(!e)return null;try{return Ac(e)}catch{return null}},Iu=e=>ms(e)?.day??1,Pu=(e,s)=>new Date(e,s,0).getDate(),Ou=(e,s)=>{const a=ms(e);if(!a)return e;const n=Math.min(s,Pu(a.year,a.month));return a.set({day:n}).toString()},jn=e=>{const s=e%100>=11&&e%100<=13?"th":e%10===1?"st":e%10===2?"nd":e%10===3?"rd":"th";return`${e}${s}`};function zu({mode:e,donationAmount:s,currency:a="USD",locale:n="en-US",installments:r,automaticSettings:i,defaultTab:l="automatic",showTitle:o=!0,showCard:d=!0,showSavePayment:u=!0,showTabs:f=!0,inputs:m=Ru,startDate:h,firstInstallmentDateOverride:x,labels:g,classNames:j,isSaving:b=!1,showSavedIndicator:w=!1,isModeSwitchDisabled:N=!1,onModeChange:$,onAutomaticSettingsChange:v,onInstallmentsChange:A,onSave:M,onCancel:k}){const[F,C]=p.useState(l),_={...Lu,...g},E=e??F,D=p.useMemo(()=>new Intl.NumberFormat(n,{style:"currency",currency:a}),[a,n]),R=p.useMemo(()=>({...i,firstInstallmentDate:m.includes("firstInstallmentDate")?i.firstInstallmentDate:m.includes("dayOfMonth")?i.firstInstallmentDate||h||"":h||i.firstInstallmentDate}),[i,m,h]),O=E==="automatic"?Eu(ei(s,R),m.includes("firstInstallmentDate")?void 0:x):r,V=p.useMemo(()=>ns(O.reduce((ae,Ie)=>ae+Number(Ie.amount||0),0)),[O]),q=Math.abs(V-s)>.009,I=ns(s-V)<=0,J=p.useMemo(()=>Au(r),[r]),W=E==="manual"&&Du(J),se=q||W,Y=o?t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(K.CircleDollarSign,{className:"size-4 text-zinc-500",strokeWidth:1.75}),t.jsx("span",{className:"text-base font-medium leading-6 text-zinc-950",children:_.title}),w?t.jsx(c.Chip,{size:"sm",radius:"full",color:"success",variant:"flat",children:_.saved}):null]}):void 0,Z=ae=>{ae!==E&&(e||C(ae),$?.(ae),ae==="manual"&&r.length===0&&A([vn()]))},Q=(ae,Ie)=>{const Ee=r.find(Le=>Le.id===ae);dt(Ee?.status)||A(r.map(Le=>Le.id===ae?{...Le,...Ie}:Le))},ee=()=>{A([...r,vn()])},ne=ae=>{const Ie=r.find(Ee=>Ee.id===ae);dt(Ie?.status)||A(r.filter(Ee=>Ee.id!==ae))},X=()=>{b||se||M?.()},de=t.jsxs("div",{className:c.cn("flex w-full flex-col gap-4",j?.content),children:[f||u||k?t.jsxs("div",{className:"flex w-full items-center justify-between gap-6",children:[f?t.jsx(Bu,{mode:E,labels:_,onModeChange:Z,isDisabled:N,className:j?.tabs}):null,t.jsxs("div",{className:"ml-auto flex items-center gap-3",children:[k?t.jsx(B,{type:"button","data-testid":"installment-schedule-cancel-button",size:"md",variant:"bordered",radius:"full",className:"min-w-28",isDisabled:b,onPress:k,children:_.cancelEdit}):null,u?t.jsx(B,{type:"button","data-testid":"installment-schedule-save-button",size:"md",color:"primary",radius:"full",className:"min-w-36",startContent:b?void 0:t.jsx(P,{icon:"solar:cloud-upload-outline",className:"size-4"}),isLoading:b,isDisabled:b||se,onPress:X,children:_.saveInstallments}):null]})]}):null,t.jsxs("div",{className:c.cn("flex w-full flex-col gap-4",j?.preview),children:[E==="automatic"&&t.jsx(Vu,{settings:R,inputs:m,labels:_,className:j?.controls,onSettingsChange:v}),O.length===0&&t.jsx(c.Alert,{isClosable:!1,color:"default",variant:"flat",radius:"full",title:E==="automatic"?_.emptyAutomatic:_.emptyManual}),O.length>0&&t.jsx(Uu,{mode:E,installments:O,rowErrors:J,labels:_,formatter:D,locale:n,onUpdateInstallment:Q,onRemoveInstallment:ne}),E==="manual"&&t.jsx("div",{className:"flex flex-wrap gap-3",children:t.jsx(B,{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(K.Plus,{className:"size-5",strokeWidth:2}),isDisabled:I,onPress:ee,children:_.addInstallment})}),t.jsx(Yu,{total:V,donationAmount:s,hasTotalMismatch:q,mode:E,installments:O,formatter:D,labels:_,className:j?.summary})]})]});return t.jsx("div",{className:c.cn("vvt-ps relative font-sans text-zinc-900",j?.root),children:d?t.jsx(c.Accordion,{variant:"splitted",defaultSelectedKeys:["installment-schedule"],className:c.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:c.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(c.AccordionItem,{"aria-label":_.title,title:Y,children:de},"installment-schedule")}):de})}function Bu({mode:e,labels:s,className:a,isDisabled:n=!1,onModeChange:r}){return t.jsxs(c.Tabs,{"aria-label":s.title,selectedKey:e,isDisabled:n,color:"primary",size:"lg",radius:"full",className:c.cn("w-fit",a),onSelectionChange:i=>r(i),children:[t.jsx(c.Tab,{title:s.automaticMode},"automatic"),t.jsx(c.Tab,{title:s.manualMode},"manual")]})}function Vu({settings:e,inputs:s,labels:a,className:n,onSettingsChange:r}){const i=l=>{if(l==="numberOfInstallments")return t.jsx("div",{className:"min-w-0",children:t.jsx(c.Input,{variant:"bordered",label:a.numberOfInstallments,labelPlacement:"outside",type:"number",min:1,step:1,value:e.numberOfInstallments>0?String(e.numberOfInstallments):"",onWheel:o=>o.currentTarget.blur(),onChange:o=>{const d=o.target.value;r({...e,numberOfInstallments:d===""?0:Math.max(1,Number(d))})}})},l);if(l==="frequency")return t.jsx("div",{className:"min-w-0",children:t.jsx(He,{variant:"bordered",label:a.frequency,labelPlacement:"outside",selectedKeys:[e.frequency],onSelectionChange:o=>{const d=Array.from(o)[0];typeof d=="string"&&r({...e,frequency:d})},children:Mu.map(o=>t.jsx(c.SelectItem,{textValue:a[o],children:a[o]},o))})},l);if(l==="dayOfMonth"){const o=String(Iu(e.firstInstallmentDate));return t.jsx("div",{className:"min-w-0",children:t.jsx(He,{variant:"bordered",label:a.dayOfMonth,labelPlacement:"outside",selectedKeys:[o],onSelectionChange:d=>{const u=Number(Array.from(d)[0]);Number.isFinite(u)&&r({...e,firstInstallmentDate:Ou(e.firstInstallmentDate,u)})},children:_u.map(d=>t.jsx(c.SelectItem,{textValue:jn(d),children:jn(d)},String(d)))})},l)}return t.jsx("div",{className:"min-w-0",children:t.jsx(ua,{variant:"bordered",label:a.firstInstallmentDate,labelPlacement:"outside",value:ms(e.firstInstallmentDate),onChange:o=>r({...e,firstInstallmentDate:o?o.toString():""}),startContent:t.jsx(P,{icon:"solar:calendar-outline",className:"size-4 text-zinc-500"})})},l)};return s.length===0?null:t.jsx("div",{className:c.cn("grid gap-4",n),style:{gridTemplateColumns:"repeat(auto-fit, minmax(min(100%, 14rem), 1fr))"},children:s.map(i)})}function Uu({mode:e,installments:s,rowErrors:a,labels:n,formatter:r,locale:i,onUpdateInstallment:l,onRemoveInstallment:o}){return e==="automatic"?t.jsx("div",{className:"rounded-2xl border border-zinc-200 bg-zinc-50 p-4",children:t.jsx("div",{className:c.cn("flex flex-col gap-3",s.length>5&&"max-h-[264px] overflow-y-auto pr-2"),children:s.map((d,u)=>t.jsxs("div",{className:c.cn("flex min-h-10 items-center justify-between rounded-xl px-4 py-2 text-base",u===0&&"border border-primary/25 bg-primary/5 text-primary"),children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsxs("span",{children:["#",u+1]}),t.jsx("span",{children:"▪"}),t.jsx("span",{children:Tu(d.dueDate,i)}),u===0&&s.length>1&&t.jsx(c.Chip,{size:"sm",color:"primary",variant:"solid",radius:"full",children:"First charge"})]}),t.jsx("span",{className:"text-zinc-950",children:r.format(d.amount)})]},d.id))})}):t.jsx("div",{className:"flex flex-col gap-2",children:s.map((d,u)=>{const f=a.missingDateRows.has(d.id),m=a.invalidDateRows.has(d.id),h=a.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(ua,{variant:"bordered","aria-label":`${n.dueDate} ${u+1}`,isDisabled:dt(d.status),isInvalid:f||m,errorMessage:f?n.dueDateRequiredError:m?n.dateOrderError:void 0,value:ms(d.dueDate),onChange:x=>l(d.id,{dueDate:x?x.toString():""})})}),t.jsx("div",{className:"min-w-0 flex-1",children:t.jsx(qu,{amount:d.amount,ariaLabel:`${n.amount} ${u+1}`,isDisabled:dt(d.status),isInvalid:h,errorMessage:n.amountGreaterThanZeroError,onAmountChange:x=>l(d.id,{amount:x})})}),t.jsx(Wu,{isDisabled:s.length<=1,isPaid:dt(d.status),label:n.deleteInstallment,onRemove:()=>o(d.id)})]})},d.id)})})}const Hu=/^\d*(?:[.,]\d{0,2})?$/;function qu({amount:e,ariaLabel:s,isDisabled:a,isInvalid:n,errorMessage:r,onAmountChange:i}){const[l,o]=p.useState(null);return t.jsx(c.Input,{variant:"bordered","aria-label":s,type:"text",inputMode:"decimal",autoComplete:"off",isDisabled:a,isInvalid:n,errorMessage:n?r:void 0,value:l??(e?String(e):""),onChange:d=>{const u=d.target.value.trim();if(!Hu.test(u))return;o(u);const f=Number(u.replace(",","."));i(ns(Number.isFinite(f)?f:0))},onBlur:()=>o(null),startContent:t.jsx("span",{className:"text-zinc-900",children:"$"})})}function Wu({isDisabled:e,isPaid:s,label:a,onRemove:n}){const r=t.jsx(B,{type:"button",isIconOnly:!0,variant:"flat",radius:"full",className:"h-9 w-9 flex-none bg-danger-100 p-0 text-danger-600",style:{height:36,minWidth:36,width:36},isDisabled:e||s,onPress:n,"aria-label":a,children:t.jsx(P,{icon:"solar:trash-bin-minimalistic-outline",className:"size-5"})});return s?t.jsx(c.Tooltip,{content:"This payment cannot be edited or deleted because it has already been paid.",placement:"top",children:t.jsx("span",{className:"inline-flex",children:r})}):r}function Yu({total:e,donationAmount:s,hasTotalMismatch:a,mode:n,installments:r,formatter:i,labels:l,className:o}){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),h=ns(s-e),x=Math.max(h,0),g=Math.max(-h,0),j=a?t.jsxs("span",{children:[l.totalError,". Total scheduled: ",t.jsx("strong",{children:i.format(e)})," /"," ",t.jsx("strong",{children:i.format(s)}),"."]}):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(s)}),"."]}),b=n==="automatic"?`Total: ${i.format(e)}`:g>0?`Exceeds by: ${i.format(g)}`:`${l.remaining}: ${i.format(x)}`;return t.jsx(c.Alert,{isClosable:!1,color:a?"danger":"default",variant:"flat",radius:"full",className:o,endContent:t.jsx("span",{className:"whitespace-nowrap",children:b}),title:j})}function Gu(){return t.jsxs("section",{className:"flex w-full flex-col gap-4 rounded-2xl border border-zinc-200 bg-white p-4 shadow-sm","aria-busy":"true",children:[t.jsxs("div",{className:"flex items-start justify-between gap-3",children:[t.jsx(c.Skeleton,{className:"h-7 w-56 rounded-lg"}),t.jsx(c.Skeleton,{className:"size-8 rounded-full"})]}),t.jsxs("div",{className:"flex items-center justify-between gap-3",children:[t.jsx(c.Skeleton,{className:"h-10 w-72 rounded-full"}),t.jsx(c.Skeleton,{className:"h-10 w-40 rounded-full"})]}),t.jsxs("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-end sm:justify-between",children:[t.jsxs("div",{className:"flex w-full max-w-[280px] flex-col gap-2",children:[t.jsx(c.Skeleton,{className:"h-4 w-36 rounded-md"}),t.jsx(c.Skeleton,{className:"h-9 w-full rounded-xl"})]}),t.jsx(c.Skeleton,{className:"h-9 w-36 rounded-full"})]}),t.jsx("div",{className:"flex flex-col gap-3",children:Array.from({length:4}).map((e,s)=>t.jsxs("div",{className:"grid grid-cols-[minmax(0,1fr)_160px] items-center gap-4 rounded-2xl border border-zinc-100 p-3",children:[t.jsx(c.Skeleton,{className:"h-8 w-full max-w-xs rounded-full"}),t.jsx(c.Skeleton,{className:"h-8 w-full rounded-xl"})]},s))})]})}const wn={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"},ti={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"},Ku={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:ti.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."},Qu={wrapper:"!absolute !inset-0 !z-50 !items-center !justify-center !p-4",backdrop:"!absolute !inset-0 !z-40 rounded-2xl"},Zu=[];function Xu({installments:e,currency:s,locale:a="en-US",showTitle:n=!0,showCard:r=!0,showEditPayment:i=!0,showDelete:l=!0,payNowHiddenStatuses:o=Zu,showSavedIndicator:d=!1,labels:u,isSaving:f=!1,onEditInstallments:m,onPayInstallment:h,onDeleteInstallment:x}){const[g,j]=p.useState(null),b={...Ku,...u},[w,N]=p.useState(""),$=new Intl.NumberFormat(a,{style:"currency",currency:s}),v=e.some(C=>si(C)!==null),A=e.some(C=>C.status==="partially_refunded"),M=n?t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(K.CircleDollarSign,{className:"size-4 text-zinc-500",strokeWidth:1.75}),t.jsx("span",{className:"text-base font-medium leading-6 text-zinc-950",children:b.title}),d?t.jsx(c.Chip,{size:"sm",radius:"full",color:"success",variant:"flat",children:b.saved}):null]}):void 0,k=p.useMemo(()=>{const C=w.trim().toLowerCase();if(!C)return e;const _=new Intl.NumberFormat(a,{style:"currency",currency:s});return e.filter(E=>{const D=E.status??"scheduled";return[As(E),E.id,E.amount,E.dueDate,Qt(E.dueDate,a),Ds(E,b.paidOn,a),Es(E,b.refundedAmount,_),D,Fs(D,b.partiallyRefunded)].join(" ").toLowerCase().includes(C)})},[a,s,e,w,b.paidOn,b.refundedAmount,b.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:b.searchLabel}),t.jsx(c.Input,{variant:"bordered",size:"md",value:w,placeholder:b.searchPlaceholder,onChange:C=>N(C.target.value),startContent:t.jsx(P,{icon:"solar:magnifer-outline",className:"size-4 text-zinc-500"})})]}),i?t.jsx(B,{type:"button",variant:"bordered",radius:"full",size:"md",className:"h-10 border-zinc-200 bg-white px-4 text-sm font-normal text-zinc-900",startContent:t.jsx(P,{icon:"solar:pen-outline",className:"size-4"}),isLoading:f,onPress:m,children:b.editInstallments}):null]}),t.jsx("div",{className:c.cn("hidden [@container(max-width:767px)]:block",k.length>3&&"max-h-[560px] overflow-y-auto pr-1"),children:t.jsxs("div",{className:"flex flex-col gap-2",children:[k.map((C,_)=>{const E=C.status??"scheduled",D=As(C),R=Ds(C,b.paidOn,a),O=Es(C,b.refundedAmount,$);return t.jsx(c.Card,{radius:"lg",shadow:"none",className:"border border-default-200",children:t.jsxs(c.CardBody,{className:"gap-3 p-3",children:[t.jsxs("div",{className:"flex items-start justify-between gap-2",children:[t.jsxs("div",{className:"min-w-0",children:[t.jsxs("p",{className:"text-xs text-default-500",children:["#",_+1]}),t.jsx("p",{className:"truncate text-sm font-medium text-foreground",children:D||`PMT-${_+1}`})]}),t.jsx(Nn,{status:E,label:Fs(E,b.partiallyRefunded)})]}),t.jsxs("div",{className:"grid grid-cols-2 gap-2 text-sm",children:[t.jsxs("div",{children:[t.jsx("p",{className:"text-xs text-default-500",children:b.amount}),t.jsx("p",{className:"font-medium text-foreground",children:$.format(C.amount)}),O?t.jsx("p",{className:"text-xs text-default-500",children:O}):null]}),t.jsxs("div",{className:"text-right",children:[t.jsx("p",{className:"text-xs text-default-500",children:b.scheduledDate}),t.jsx("p",{className:"font-medium text-foreground",children:Qt(C.dueDate,a)}),R?t.jsx("p",{className:"text-xs text-default-500",children:R}):null]})]}),t.jsx(Cn,{status:E,installment:C,labels:b,portalContainer:g??void 0,showDelete:l,payNowHiddenStatuses:o,onPayInstallment:h,onDeleteInstallment:x})]})},C.id)}),k.length===0&&t.jsx("div",{className:"rounded-lg border border-default-200 px-4 py-6 text-center text-sm text-default-500",children:b.noInstallmentsFound})]})}),t.jsx("div",{className:c.cn("w-full overflow-x-hidden [@container(max-width:767px)]:hidden",k.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:v?"w-32":"w-24"}),t.jsx("col",{className:"w-36"}),t.jsx("col",{className:A?"w-44":"w-36"}),t.jsx("col",{className:"w-44"})]}),t.jsx("thead",{children:t.jsxs("tr",{className:"sticky top-0 z-10 border-b border-zinc-200 bg-white text-zinc-900",children:[t.jsx("th",{className:"px-2 py-3 font-medium",children:"#"}),t.jsx("th",{className:"px-2 py-3 font-medium",children:b.installmentId}),t.jsx("th",{className:"px-2 py-3 font-medium",children:b.amount}),t.jsx("th",{className:"px-2 py-3 font-medium",children:b.scheduledDate}),t.jsx("th",{className:"whitespace-nowrap px-2 py-3 font-medium",children:b.status}),t.jsx("th",{className:"whitespace-nowrap py-3 pl-4 pr-2 font-medium",children:b.actions})]})}),t.jsxs("tbody",{children:[k.map((C,_)=>{const E=C.status??"scheduled",D=As(C),R=Ds(C,b.paidOn,a),O=Es(C,b.refundedAmount,$);return t.jsxs("tr",{className:"text-zinc-500",children:[t.jsx("td",{className:"px-2 py-3",children:_+1}),t.jsx("td",{className:"overflow-hidden px-2 py-3",children:t.jsx("span",{className:"block w-full truncate",children:D||`PMT-${_+1}`})}),t.jsxs("td",{className:"px-2 py-3",children:[$.format(C.amount),O?t.jsx("span",{className:"block text-xs",children:O}):null]}),t.jsxs("td",{className:"px-2 py-3",children:[Qt(C.dueDate,a),R?t.jsx("span",{className:"block text-xs",children:R}):null]}),t.jsx("td",{className:"whitespace-nowrap px-2 py-3",children:t.jsx(Nn,{status:E,label:Fs(E,b.partiallyRefunded)})}),t.jsx("td",{className:"whitespace-nowrap py-3 pl-4 pr-2",children:t.jsx(Cn,{status:E,installment:C,labels:b,portalContainer:g??void 0,showDelete:l,payNowHiddenStatuses:o,onPayInstallment:h,onDeleteInstallment:x})})]},C.id)}),k.length===0&&t.jsx("tr",{children:t.jsx("td",{colSpan:6,className:"px-2 py-6 text-center text-zinc-500",children:b.noInstallmentsFound})})]})]})})]});return t.jsx("div",{ref: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(c.Accordion,{variant:"splitted",defaultSelectedKeys:["installment-table"],className:"min-w-0 w-full gap-0 px-0",itemClasses:{base:"min-w-0 w-full overflow-x-hidden rounded-2xl border border-zinc-200 bg-white p-0 shadow-sm",trigger:"px-4 py-4",title:"w-full",content:"min-w-0 w-full overflow-x-hidden px-4 pb-4 pt-0",indicator:"text-zinc-500 [&>svg]:size-4"},children:t.jsx(c.AccordionItem,{"aria-label":b.title,title:M,children:F},"installment-table")}):F})}function As(e){return e.name?.trim()||e.id}function Ds(e,s,a){return!dt(e.status)||!e.fulfilledAt?null:`${s} ${Qt(e.fulfilledAt,a)}`}function si(e){const{refundedAmount:s}=e;return e.status!=="partially_refunded"||typeof s!="number"||!Number.isFinite(s)||s<=0?null:s}function Es(e,s,a){const n=si(e);return n===null?null:`${s} ${a.format(n)}`}function Fs(e,s){return e==="partially_refunded"?s:ti[e]??e}function Nn({status:e,label:s}){return t.jsx(c.Chip,{size:"md",radius:"lg",className:c.cn("justify-center px-4",wn[e]??wn.scheduled),startContent:t.jsx(em,{status:e}),children:s})}function Cn({status:e,installment:s,labels:a,portalContainer:n,showDelete:r,payNowHiddenStatuses:i,onPayInstallment:l,onDeleteInstallment:o}){const d=!i.includes(e),u=dt(e);return t.jsxs("div",{className:"flex min-w-36 items-center justify-start gap-2",children:[d?t.jsx(B,{type:"button",size:"md",color:"primary",variant:"solid",radius:"full",className:"min-w-[104px] shrink-0",isDisabled:u,startContent:t.jsx(P,{icon:"solar:dollar-minimalistic-outline",className:"size-4"}),onPress:()=>l?.(s),children:a.payNow}):null,t.jsx(Ju,{isFulfilled:u,showDelete:r,labels:a,portalContainer:n,onDelete:()=>o(s.id)})]})}function Ju({isFulfilled:e,showDelete:s,labels:a,portalContainer:n,onDelete:r}){const[i,l]=p.useState(!1);return t.jsxs(t.Fragment,{children:[t.jsxs(c.Dropdown,{placement:"bottom-end",radius:"lg",children:[t.jsx(c.DropdownTrigger,{children:t.jsx(B,{type:"button",isIconOnly:!0,size:"sm",variant:"light",className:"text-zinc-900","aria-label":"More actions",children:t.jsx(P,{icon:"solar:menu-dots-bold",className:"size-4"})})}),t.jsxs(c.DropdownMenu,{"aria-label":"Installment actions",disabledKeys:e?["send-link","delete"]:[],className:"w-72 p-2",onAction:o=>{o==="delete"&&s&&!e&&l(!0)},children:[t.jsx(c.DropdownSection,{title:"Actions",showDivider:s,children:t.jsx(c.DropdownItem,{textValue:a.sendLink,description:a.sendLinkDescription,startContent:t.jsx(P,{icon:"solar:link-outline",className:"size-5 text-zinc-500"}),children:a.sendLink},"send-link")}),s?t.jsx(c.DropdownSection,{title:a.dangerZone,children:t.jsx(c.DropdownItem,{textValue:a.deleteInstallment,className:"text-danger-600",color:"danger",description:a.deleteInstallmentDescription,startContent:t.jsx(P,{icon:"solar:trash-bin-minimalistic-outline",className:"size-5"}),children:a.deleteInstallment},"delete")}):null]})]}),s?t.jsx(va,{isOpen:i,labels:{title:a.deleteInstallmentConfirmationTitle,description:a.deleteInstallmentConfirmationDescription,cancel:a.deleteInstallmentConfirmationCancel,confirm:a.deleteInstallmentConfirmationConfirm},icon:t.jsx(P,{icon:"solar:danger-triangle-outline",className:"size-7"}),confirmColor:"danger",portalContainer:n,shouldBlockScroll:!1,classNames:Qu,onClose:()=>l(!1),onConfirm:()=>{l(!1),r()}}):null]})}function em({status:e}){return e==="paid"?t.jsx(P,{icon:"solar:check-circle-bold",className:"size-3"}):e==="failed"?t.jsx(P,{icon:"solar:close-circle-bold",className:"size-3"}):e==="partially_refunded"?t.jsx(P,{icon:"solar:undo-left-round-bold",className:"size-3"}):e==="processing"?t.jsx(P,{icon:"solar:refresh-circle-bold",className:"size-3"}):e==="pending_confirmation"?t.jsx(P,{icon:"solar:clock-circle-bold",className:"size-3"}):t.jsx(P,{icon:"solar:calendar-outline",className:"size-3"})}const tm=/^\d{4}-\d{2}-\d{2}$/;function Qt(e,s){const a=tm.test(e)?new Date(`${e}T00:00:00`):new Date(e);return Number.isNaN(a.getTime())?e:new Intl.DateTimeFormat(s,{month:"short",day:"numeric",year:"numeric"}).format(a)}const sm={title:"Select Membership",renewalTitle:"Automatic Renewal",renewalDescription:"Membership will automatically renew at the end of each period"},am=({cards:e,locale:s,currency:a,listHeightClassName:n="",labels:r,showRenewal:i=!0,defaultRenewalValue:l=!1,initialSelectedMembershipId:o=null,allowReselect:d=!0,onRenewalChange:u,onCardSelect:f,className:m=""})=>{const h=Array.isArray(e)?e:[],[x,g]=p.useState(o),[j,b]=p.useState(l),w={...sm,...r};p.useEffect(()=>{g(o)},[o]);const N=v=>{if(v===x){d&&f?.(v);return}g(v),f?.(v)},$=v=>{b(v),u?.(v)};return t.jsxs("div",{className:c.cn("w-full flex flex-col gap-4 items-start p-4 h-svh",m),"data-testid":"membership-select-cards",children:[t.jsx("span",{className:"hidden","data-testid":"membership-select-cards-selected-id",children:x??""}),t.jsx("p",{className:"text-2xl font-semibold text-left","data-testid":"membership-select-cards-title",children:w.title}),i&&t.jsx(li,{title:w.renewalTitle,description:w.renewalDescription,value:j,onValueChange:$}),t.jsx("div",{className:c.cn("w-full min-h-0 flex flex-col gap-4 overflow-y-auto",n===""?"flex-1":c.cn("shrink-0",n)),"data-testid":"membership-select-cards-list",children:h.map(v=>t.jsx(ai,{itemKey:v.id,name:v.name,type:v.type,price:v.price,locale:s,currency:a,isSelected:x===v.id,onSelect:N},v.id))})]})},ai=({itemKey:e,name:s,type:a,price:n,locale:r="en-US",currency:i="USD",showPrice:l=!0,isSelected:o=!1,onSelect:d,compact:u=!1,isDisabled:f=!1,disabledReason:m,statusLabel:h,statusTone:x="default",className:g=""})=>{const j=new Intl.NumberFormat(r,{style:"currency",currency:i,minimumFractionDigits:0,maximumFractionDigits:2}).format(n),b=!!d&&!f,w=m||h,N=()=>{b&&d?.(e)};return t.jsx(c.Card,{shadow:"none",isPressable:!!d,onPress:N,className:c.cn("w-full min-h-fit border rounded-3xl",o?"border-primary bg-primary/5":"border-default",f?"opacity-60":"",u?"rounded-2xl":"",g),"data-testid":"item-card","data-selected":o,isDisabled:f,children:t.jsxs("div",{className:c.cn("px-4 py-8 flex gap-6 items-center justify-between",u&&"px-3 py-3 gap-4"),children:[t.jsxs("div",{className:"w-max flex flex-col gap-1 items-start",children:[t.jsx("p",{className:c.cn("font-semibold text-left",u?"text-sm":"text-xl"),"data-testid":"item-card-name",children:s}),a&&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:a})}),w&&t.jsx(c.Chip,{"data-testid":"item-card-status",color:x,size:"sm",variant:"flat",className:"px-2",children:w})]}),l&&t.jsx("p",{className:c.cn("font-semibold text-right",u?"text-lg":"text-2xl"),"data-testid":"item-card-price",children:j})]})})},kn="w-full bg-gray-100",Sn={variant:"light",color:"default"},ni=({id:e,title:s,media:a,imageUrl:n,imageAlt:r,imageClassName:i="",imageAspect:l="aspect-[4/3]",meta:o=[],price:d,action:u,footer:f,onPress:m,isPressable:h=!1,isDisabled:x=!1,compact:g=!1,className:j="",bodyClassName:b="",footerClassName:w="",dataTestId:N})=>{const $=!!(d&&d.value),v=!!u?.label,A=h&&!!m&&!v,M=!A,k=v?{variant:u?.variant??Sn.variant,color:u?.color??Sn.color,size:u?.size??"sm",isDisabled:x||u?.isDisabled,startContent:u?.icon?t.jsx(P,{icon:u.icon,width:16}):void 0}:null,F=a??(n?t.jsx("div",{className:c.cn("relative overflow-hidden rounded-xl",l,kn,i),children:t.jsx(c.Image,{removeWrapper:!0,src:n,alt:r||s,className:"size-full object-cover",classNames:{wrapper:"absolute inset-0"}})}):t.jsx("div",{className:c.cn("relative overflow-hidden rounded-xl",l,kn,"grid place-items-center",i),"data-testid":`catalog-item-card-${e??"media"}-fallback`,children:t.jsx(P,{icon:"solar:ticket-outline",width:48,className:"text-default-400"})}));return t.jsxs(c.Card,{"data-testid":N||`catalog-item-card-${e??"item"}`,className:c.cn("w-full overflow-hidden",j),isPressable:A,onPress:m,isDisabled:x,shadow:"sm",radius:"lg",children:[t.jsx("div",{children:F}),t.jsxs(c.CardBody,{className:c.cn("gap-3",g?"p-3":"p-4",b),children:[t.jsx("h3",{"data-testid":`catalog-item-card-title-${e??""}`,className:c.cn("line-clamp-2 text-base font-semibold text-gray-900",g?"text-sm":""),children:s}),o.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:o.map((C,_)=>t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(P,{icon:C.icon,className:"size-4 text-gray-400",width:16}),t.jsx("span",{children:C.label})]},`${C.label}-${_}`))}):null,($||v)&&t.jsxs("div",{className:c.cn("flex items-center justify-end gap-2 pt-1 text-sm",g?"pt-0.5":"",w),children:[$?t.jsxs("span",{className:c.cn("mr-auto text-gray-500",g?"text-xs":""),"data-testid":`catalog-item-card-price-${e??""}`,children:[d?.label&&t.jsxs("span",{children:[d.label," "]}),t.jsx("span",{className:"font-semibold text-brand",children:d?.value})]}):t.jsx("span",{className:"ml-auto","aria-hidden":!0}),v&&M?t.jsx(B,{className:c.cn("rounded-full",u?.className),onPress:u?.onPress,variant:k?.variant,color:k?.color,size:k?.size,startContent:k?.startContent,isDisabled:k?.isDisabled,"aria-label":u?.ariaLabel||u?.label,children:u?.label}):null]}),f?t.jsx("div",{className:"pt-1",children:f}):null]})]})};ni.displayName="CatalogItemCard";const nm={open:"Open","selling-fast":"Selling fast","sold-out":"Sold out"};function ri({title:e,subtitle:s,price:a,imageUrl:n,status:r,isDisabled:i=!1,onPress:l,className:o}){return t.jsx(c.Card,{isPressable:!!l,isDisabled:i,onPress:l,shadow:"none",radius:"lg",className:c.cn("w-full border border-pos-hair",o),children:t.jsxs(c.CardBody,{className:"flex-row items-center gap-5 p-4",children:[t.jsx("div",{className:"grid size-[4.875rem] shrink-0 place-items-center overflow-hidden rounded-xl bg-default-100 text-default-500",children:n?t.jsx(c.Image,{removeWrapper:!0,src:n,alt:"",className:"size-full object-cover"}):t.jsx(P,{icon:"solar:ticket-outline",width:28})}),t.jsxs("div",{className:"min-w-0 flex-1",children:[t.jsx("h3",{className:"truncate text-lg font-semibold text-foreground",children:e}),t.jsx("p",{className:"mt-1 text-base text-default-500",children:s})]}),r?t.jsx("span",{"data-status":r,className:"rounded-full bg-default-100 px-3 py-1 text-sm font-medium text-default-600",children:nm[r]}):null,a?t.jsxs("strong",{className:"ml-5 whitespace-nowrap text-xl",children:["from ",a]}):null]})})}ri.displayName="ProgramListItem";const rm={card:"gap-3 rounded-xl border border-dashed px-6 py-12",panel:"px-6 py-[72px]"},im={card:"size-12 rounded-2xl",panel:"size-[76px] rounded-[20px] border mb-[18px]"},lm={card:"text-base font-medium text-default-900",panel:"text-[17px] font-semibold text-acct-ink"},om={card:"max-w-sm text-sm text-default-600",panel:"max-w-[380px] text-sm text-acct-sub mt-1.5"},cm={card:"mt-1",panel:"mt-[22px]"},dm="bg-acct-page border-acct-border text-acct-muted",um={empty:"solar:inbox-line-duotone",error:"solar:danger-triangle-outline",success:"solar:check-circle-bold"},mm={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"},fm={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"},xm={empty:"status",error:"alert",success:"status",loading:"status"},hm={empty:"polite",error:"assertive",success:"polite",loading:"polite"};function pm(e,s,a,n){if(s===!1)return null;if(e==="loading"&&s===void 0)return t.jsx(c.Spinner,{size:"lg",color:"primary",className:n.spinner});if(p.isValidElement(s))return t.jsx(t.Fragment,{children:s});const r=typeof s=="string"?s:um[e];return r?t.jsx(P,{icon:r,width:a,height:a,"aria-hidden":"true",className:n.icon}):null}function vt({variant:e="empty",surface:s="card",title:a,titleAs:n="p",description:r,icon:i,actions:l,role:o=xm[e],ariaLive:d=hm[e],iconSize:u=24,className:f,classNames:m={},"data-testid":h="feedback-state"}){const x=pm(e,i,u,m);return t.jsxs("div",{role:o,"aria-live":d,"data-variant":e,"data-testid":h,"data-surface":s,className:c.cn("flex flex-col items-center justify-center text-center",rm[s],s==="card"?mm[e]:"bg-transparent",f,m.base),children:[x?t.jsx("span",{"aria-hidden":"true","data-testid":`${h}-icon`,className:c.cn("inline-flex items-center justify-center",im[s],e==="success"&&s==="card"&&"rounded-full",s==="panel"?dm:fm[e],m.iconWrapper),children:x}):null,t.jsxs("div",{className:c.cn("flex flex-col items-center",s==="card"&&"gap-1"),children:[t.jsx(n,{"data-testid":`${h}-title`,className:c.cn(lm[s],m.title),children:a}),r?t.jsx("p",{"data-testid":`${h}-description`,className:c.cn(om[s],m.description),children:r}):null]}),l?t.jsx("div",{"data-testid":`${h}-actions`,className:c.cn("flex flex-wrap items-center justify-center gap-2",cm[s],m.actions),children:l}):null]})}function ja(e){return t.jsx(vt,{...e,variant:"empty"})}function wa(e){return t.jsx(vt,{...e,variant:"error"})}function Na(e){return t.jsx(vt,{...e,variant:"loading"})}function ii(e){return t.jsx(vt,{...e,variant:"success"})}vt.displayName="FeedbackState";ja.displayName="EmptyState";wa.displayName="ErrorState";Na.displayName="LoadingState";ii.displayName="SuccessState";const li=({title:e,value:s,description:a,onValueChange:n,className:r=""})=>{const i=p.useId();return t.jsxs("div",{className:c.cn("w-full flex flex-row items-center",e||a?"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}),a&&t.jsx("p",{className:"text-left text-gray-500","data-testid":"toggle-description",children:a})]}),t.jsx(c.Switch,{id:i,isSelected:s,onValueChange:n,"data-testid":"toggle-switch"})]})},gm={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"},bm=(e,s)=>new Intl.NumberFormat(e,{style:"currency",currency:s}),oi=e=>Object.values(e).reduce((s,a)=>s+Object.values(a).reduce((n,r)=>n+Object.values(r).reduce((i,l)=>i+l.selectedQuantity,0),0),0),ym=e=>e.reduce((s,a)=>s+a.dates.reduce((n,r)=>n+r.tickets.reduce((i,l)=>i+l.max,0),0),0),Ca=e=>e.flatMap(s=>s.dates.flatMap(a=>a.tickets.map(n=>({exhibition:s,dateGroup:a,ticket:n})))),$n=(e,s,a)=>{const n={};let r=a?s??ym(e):0;for(const{exhibition:i,dateGroup:l,ticket:o}of Ca(e)){n[i.id]??={},n[i.id][l.id]??={};const d=a?Math.min(o.max,r):0;n[i.id][l.id][o.id]={id:o.id,selectedQuantity:d,originalPrice:o.originalPrice,discountedPrice:o.price},r-=d}return n},An=(e,s,a)=>`${e}::${s}::${a}`,vm=(e,s,a)=>{const n=oi(s);for(const{exhibition:r,dateGroup:i,ticket:l}of Ca(e)){const o=s[r.id]?.[i.id]?.[l.id]?.selectedQuantity??0,d=a===void 0?l.max:Math.min(l.max,a-(n-o));if(d>0&&o<d)return!1}return!0},jm=({initialQuantity:e=1,minQuantity:s=1,maxQuantity:a=10,onChange:n,disabled:r=!1})=>{const i=Math.max(s,Math.min(a,e)),[l,o]=p.useState(()=>String(i)),[d,u]=p.useState(!1),f=d?l:String(i),m=()=>{r||i>=a||n?.(i+1)},h=()=>{r||i<=s||n?.(i-1)},x=v=>{if(r)return;o(v.target.value);const A=parseInt(v.target.value,10);isNaN(A)||n?.(Math.max(s,Math.min(a,A)))},g=v=>{const A=parseInt(v.target.value,10);if(u(!1),isNaN(A)){n?.(s);return}const M=Math.max(s,Math.min(a,A));M!==A?n?.(M):o(String(M))},j=i<=s,b=i>=a,w="w-10 h-10 flex items-center justify-center border-0 rounded-full cursor-pointer transition-colors duration-150 text-white text-2xl font-regular",N="bg-primary hover:bg-primary/80",$="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:h,disabled:r||j,className:c.cn(w,r||j?$:N),"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:s,max:a,step:"1",className:"w-12 h-10 rounded-md border-0 bg-zinc-100 text-center text-2xl font-medium text-zinc-900 [appearance:textfield] [&::-webkit-inner-spin-button]:appearance-none [&::-webkit-outer-spin-button]:appearance-none","aria-label":`Selected quantity: ${i}`,"data-testid":"quantity-input"}),t.jsx("button",{type:"button",onClick:m,disabled:r||b,className:c.cn(w,r||b?$:N),"aria-label":"Increment quantity","data-testid":"quantity-increment",children:"+"})]})},wm=({label:e,checked:s=!1,onChange:a,disabled:n=!1})=>{const r=()=>{n||a?.(!s)};return t.jsxs("button",{type:"button",onClick:r,disabled:n,role:"checkbox","aria-checked":s,"data-testid":"checkbox-button","data-checked":s,className:c.cn("flex items-center gap-1.5 px-4 py-3 border-0 rounded-full cursor-pointer text-sm min-h-[30px]","outline-none select-none transition-colors bg-zinc-100 hover:bg-zinc-200 text-primary",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:s,onChange:()=>{},disabled:n,className:"absolute opacity-0 w-0 h-0 pointer-events-none",tabIndex:-1,readOnly:!0}),t.jsx("span",{className:c.cn("block w-3.5 h-3.5 rounded-sm relative",s?"bg-primary":"bg-white ring-1 ring-zinc-300"),children:s&&t.jsx("span",{className:"absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-[60%] rotate-45 w-[3px] h-[5px] border border-white border-t-0 border-l-0","aria-hidden":"true"})})]}),t.jsx("p",{className:"flex-1 m-0 text-left leading-snug",children:e})]})},Nm=({item:e,quantity:s,onChange:a,getTotalSelectedTickets:n,userMaxLimit:r,settings:i,labels:l})=>{const o=()=>{if(!n||r===void 0)return e.max;const m=n();return Math.min(e.max,r-(m-s))},d=i?.locale??"en-US",u=i?.currency??"USD",f=bm(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:[l.ticketsAllowedToRedeem," ",e.max]})})]}),t.jsx(jm,{initialQuantity:s,minQuantity:0,maxQuantity:o(),onChange:a})]}),e.membershipAlert?t.jsx(c.Alert,{"data-testid":"ticket-membership-alert",color:"warning",variant:"flat",radius:"full",className:"ticket-selection-membership-alert mb-2 w-full max-w-full py-0 shadow-none",classNames:{base:"ticket-selection-membership-alert-base !min-h-8 !items-center !bg-[#F5CB24]/15 !text-[#5B2C0F] shadow-none",mainWrapper:"ticket-selection-membership-alert-main-wrapper m-0 min-h-8 !py-0 !px-0",alertIcon:"ticket-selection-membership-alert-icon w-4 h-4 !text-[#5B2C0F]",iconWrapper:"ticket-selection-membership-alert-icon-wrapper !min-w-0 !bg-transparent !border-none !shadow-none !rounded-none !p-0 !m-0 !w-4 !h-4",description:"ticket-selection-membership-alert-description !ms-2 !my-2 !text-[#5B2C0F]"},description:t.jsx("span",{className:"ticket-selection-membership-alert-description-text block w-full whitespace-normal break-words text-sm leading-4 text-[#5B2C0F]",children:e.membershipAlert})}):null]})},Cm=({exhibitionId:e,dateGroup:s,isLast:a=!1,onQuantityChange:n,getTicketQuantity:r,getTotalSelectedTickets:i,userMaxLimit:l,settings:o,labels:d})=>t.jsxs("div",{className:c.cn("flex flex-col gap-2 pb-3",!a&&"border-b border-zinc-200"),"data-testid":"upgrade-ticket-date-group",children:[t.jsx("p",{className:"m-0 text-sm text-left text-zinc-500","data-testid":"upgrade-ticket-date",children:s.date}),s.tickets.map((u,f)=>t.jsxs("div",{children:[t.jsx(Nm,{item:u,quantity:r(e,s.id,u.id),onChange:m=>n(e,s.id,u.id,m),getTotalSelectedTickets:i,userMaxLimit:l,settings:o,labels:d}),f<s.tickets.length-1?t.jsx(c.Divider,{className:"bg-zinc-200","data-testid":"upgrade-ticket-divider"}):null]},u.id))]}),km=({title:e,exhibition:s,onQuantityChange:a,getTicketQuantity:n,getTotalSelectedTickets:r,userMaxLimit:i,settings:l,labels:o,initialExpanded:d=!1})=>{const[u,f]=p.useState(d),m=s.dates.reduce((x,g)=>x+g.tickets.reduce((j,b)=>j+n(s.id,g.id,b.id),0),0),h=s.dates.some(x=>x.tickets.length>0);return t.jsxs("div",{className:"w-full overflow-hidden border-b border-zinc-200","data-testid":"upgrade-ticket-header",children:[t.jsx("button",{type:"button",className:"flex items-center w-full px-5 py-4 border-0 cursor-pointer transition-all bg-white hover:bg-zinc-100",onClick:()=>f(!u),"aria-expanded":u,"aria-controls":`upgrade-items-${s.id}`,"data-testid":"upgrade-ticket-header-button",children:t.jsxs("div",{className:"flex justify-between items-center w-full gap-6",children:[t.jsx("h4",{className:"m-0 text-base font-semibold text-left text-zinc-900","data-testid":"upgrade-ticket-header-title",children:e}),t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsxs("p",{className:"m-0 text-sm text-right text-zinc-500","data-testid":"upgrade-ticket-header-count",children:[m," ",o.ticketsSelectedToRedeem]}),t.jsx("span",{className:c.cn("inline-flex items-center justify-center text-zinc-500 text-xl transition-transform duration-200",u&&"rotate-180"),"aria-hidden":"true",children:t.jsx(P,{icon:"mdi:chevron-down"})})]})]})}),t.jsx("div",{id:`upgrade-items-${s.id}`,className:c.cn("transition-all duration-300 overflow-hidden",u?"max-h-[1000px] opacity-100":"max-h-0 opacity-0"),"aria-hidden":!u,children:u&&t.jsx("div",{className:"px-5 flex flex-col gap-6","data-testid":"upgrade-ticket-items",children:h?s.dates.map((x,g)=>t.jsx(Cm,{exhibitionId:s.id,dateGroup:x,isLast:g===s.dates.length-1,onQuantityChange:a,getTicketQuantity:n,getTotalSelectedTickets:r,userMaxLimit:i,settings:l,labels:o},x.id)):t.jsx("div",{className:"px-5 py-10 text-center",children:t.jsx("p",{className:"m-0 text-zinc-500 italic",children:o.noUpgradeTicketsAvailable})})})})]})},Sm=({initialExpanded:e=!1,userMaxLimit:s,labels:a,settings:n,ticketSelectionData:r,className:i="",onSelectionChange:l})=>{const o=p.useMemo(()=>r??[],[r]),d={...gm,...a},[u,f]=p.useState(()=>$n(o,s,!0)),m=p.useRef(!1),h=p.useMemo(()=>{const N=Ca(o).map(({exhibition:$,dateGroup:v,ticket:A})=>[An($.id,v.id,A.id),A]);return new Map(N)},[o]),x=vm(o,u,s),g=(N,$,v)=>u[N]?.[$]?.[v]?.selectedQuantity??0,j=()=>oi(u),b=(N,$,v,A)=>{const M=g(N,$,v),k=j()-M;if(s!==void 0&&k+A>s)return;const F=h.get(An(N,$,v));if(!F)return;const C={...u,[N]:{...u[N],[$]:{...u[N]?.[$],[v]:{id:v,selectedQuantity:A,originalPrice:F.originalPrice,discountedPrice:F.price}}}};f(C),l?.(C)},w=N=>{const $=$n(o,s,N);f($),l?.($)};return p.useEffect(()=>{!m.current&&x&&(l?.(u),m.current=!0)},[x,u,l]),t.jsxs("div",{className:c.cn("flex flex-col w-full font-sans",i),"data-testid":"ticket-selection",children:[t.jsxs("div",{className:"flex items-center justify-between py-2 gap-4","data-testid":"ticket-selection-header",children:[t.jsx("h3",{className:"text-xl font-semibold m-0","data-testid":"ticket-selection-title",children:d.ticketSelectionTitle}),t.jsx(wm,{label:d.selectAllButtonLabel,checked:x,onChange:w})]}),o.map(N=>t.jsx(km,{title:N.exhibitionName,exhibition:N,onQuantityChange:b,getTicketQuantity:g,getTotalSelectedTickets:j,userMaxLimit:s,settings:n,labels:d,initialExpanded:e},N.id))]})},Ls={confirm:"Confirm",clear:"Clear",noLabel:"Filters"},Ms=e=>{const s={};for(const a of e)a.type==="checkbox"?s[a.id]=[...a.selectedValues]:s[a.id]=a.selectedValue?[a.selectedValue]:[];return s},$m=(e,s)=>{const a={};for(const n of s){if(n.type==="checkbox"){a[n.id]=e[n.id]??[...n.selectedValues];continue}const r=e[n.id]??[];a[n.id]=r.length>0?r[0]:null}return a},Am=e=>e.type==="checkbox"?e.selectedValues.length>0:e.selectedValue!==null,ci=({triggerLabel:e,triggerAriaLabel:s,triggerIcon:a="solar:tuning-square-outline",triggerVariant:n="bordered",triggerColor:r="default",triggerSize:i="sm",triggerClassName:l,popoverClassName:o,className:d,sections:u,onConfirm:f,onClear:m,appliedCount:h,countAriaLabel:x,countDisplay:g="badge",confirmLabel:j=Ls.confirm,clearLabel:b=Ls.clear,isOpen:w,defaultOpen:N=!1,onOpenChange:$,isDisabled:v=!1,closeOnConfirm:A=!0,keepOpenAfterClear:M=!1})=>{const[k,F]=p.useState(N),[C,_]=p.useState(()=>Ms(u)),E=w??k,D=h??u.filter(Y=>Am(Y)).length,R=Y=>{Y&&_(Ms(u)),w||F(Y),$?.(Y)},O=(Y,Z)=>{_(Q=>({...Q,[Y.id]:Z}))},V=(Y,Z)=>{_(Q=>({...Q,[Y.id]:Z?[Z]:[]}))},q=async()=>{_(Ms(u.map(Y=>Y.type==="checkbox"?{...Y,selectedValues:[]}:{...Y,selectedValue:null}))),await m(),M||R(!1)},I=async()=>{const Y=$m(C,u);await f(Y),A&&R(!1)},J=Y=>{if(Y.type==="checkbox")return t.jsx(c.CheckboxGroup,{label:Y.label,value:C[Y.id]??[],onValueChange:Q=>O(Y,Q),children:Y.options.map(Q=>t.jsx(c.Checkbox,{value:Q.value,isDisabled:Q.isDisabled,children:Q.label},Q.value))},Y.id);const Z=C[Y.id]?.[0]??"";return t.jsx(c.RadioGroup,{label:Y.label,value:Z,onValueChange:Q=>V(Y,Q||null),children:Y.options.map(Q=>t.jsx(c.Radio,{value:Q.value,isDisabled:Q.isDisabled,children:Q.label},Q.value))},Y.id)},W=p.useMemo(()=>D>0?x?.(D)||`${D} filters applied`:void 0,[x,D]),se=p.useMemo(()=>D===0?e||Ls.noLabel:x?x(D):`${e} (${D})`,[D,e,x]);return t.jsx("div",{className:d,children:t.jsxs(c.Popover,{isOpen:E,onOpenChange:R,placement:"bottom-end",children:[t.jsx(c.PopoverTrigger,{children:t.jsxs(B,{isDisabled:v,variant:n,color:r,size:i,className:l,"aria-label":s,"aria-haspopup":"dialog","aria-expanded":E,children:[t.jsx(P,{icon:a,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"&&se!==e?t.jsx("span",{className:"text-xs",children:se}):null]})}),t.jsx(c.PopoverContent,{className:o,children:t.jsxs("div",{className:"flex w-full flex-col gap-5 px-4 py-4",children:[u.map(Y=>J(Y)),t.jsxs("div",{className:"flex items-center justify-end gap-2 border-t border-gray-200 pt-3",children:[t.jsx(B,{variant:"light",color:"default",size:"sm",onPress:q,children:b}),t.jsx(B,{color:"primary",size:"sm",onPress:I,children:j})]})]})})]})})};ci.displayName="FilterPopover";const Dm="No sessions available for this date",Em=e=>e==="sold-out"||e==="closed"?"danger":"success",Fm=e=>{const s=e.seatsRemaining;return e.status==="sold-out"||e.status==="closed"?"Sold out":e.status==="limited"?typeof s=="number"?`${s} left`:"Limited":typeof s=="number"?`${s} seats available`:"Available"},Dn=e=>e.isDisabled?!0:e.status==="sold-out"||e.status==="closed",Lm=(e,s)=>s&&e.some(a=>a.date===s)?s:e[0]?.date??null,di=({heading:e,subheading:s,days:a,selectedDate:n,onDateSelect:r,quickDates:i,selectedSessionId:l=null,onSessionSelect:o,emptyStateMessage:d=Dm,statusLabel:u,statusTone:f,sessionAriaLabel:m,dayButtonClassName:h,calendarSlot:x,dayGroupAriaLabel:g,sessionGridAriaLabel:j,className:b,headingClassName:w,subheadingClassName:N})=>{const $=Lm(a,n),v=a.find(C=>C.date===$),A=i??a.map(C=>({date:C.date,label:C.label})),M=v?.sessions??[],k=C=>C===$?"solid":"bordered",F=C=>{if(!Dn(C)){if(C.id===l){o(null);return}o(C.id)}};return t.jsxs("section",{className:c.cn("flex flex-col gap-4 rounded-xl bg-white p-3 sm:p-4",b),"data-testid":"session-timeline-root",children:[t.jsxs("header",{className:"flex flex-col gap-1",children:[t.jsx("h2",{className:c.cn("text-base font-semibold text-gray-900",w),children:e}),s?t.jsx("p",{className:c.cn("text-sm text-gray-700",N),children:s}):null]}),t.jsxs("div",{className:"flex flex-wrap items-center gap-2",role:"group","aria-label":g||"Session days",children:[A.map(C=>t.jsx(B,{size:"sm",variant:k(C.date),color:"default",className:c.cn("rounded-full",h),isDisabled:C.isDisabled,onPress:()=>{r(C.date)},children:t.jsx("span",{children:C.label})},C.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:[M.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,M.map(C=>{const _=Dn(C),E=C.id===l;return t.jsx("li",{className:"rounded-xl",children:t.jsx(c.Card,{shadow:"sm",radius:"lg",isPressable:!_,onPress:()=>{F(C)},"aria-disabled":_,"aria-pressed":_?void 0:E,className:c.cn("w-full",_?"bg-gray-100 opacity-70":"",E?"w-full ring-2 ring-gray-900":""),"aria-label":m?m(C,{isSelected:E,isUnavailable:_}):_?`${C.startTime} ${C.endTime} sold out`:`${C.startTime} ${C.endTime} available`,children:t.jsxs(c.CardBody,{className:"flex flex-col items-center gap-3 p-4 text-center",children:[t.jsxs("span",{className:"text-sm font-semibold text-gray-900",children:[C.startTime," – ",C.endTime]}),t.jsx(c.Chip,{size:"sm",color:f?f(C):Em(C.status),variant:"flat",children:u?u(C):Fm(C)})]})})},C.id)})]})]})};di.displayName="SessionTimeline";const Qs=16,Ze=e=>`${e/Qs}rem`;function Mm(){if(typeof document>"u"||typeof getComputedStyle!="function")return Qs;const e=parseFloat(getComputedStyle(document.documentElement).fontSize);return Number.isFinite(e)&&e>0?e:Qs}const It=(e,s)=>e>=s*Mm(),_m=1120;function jt(){const e=p.useRef(null),[s,a]=p.useState(0),[,n]=p.useState("");return p.useLayoutEffect(()=>{const r=e.current;if(!r||typeof ResizeObserver>"u")return;const i=new ResizeObserver(l=>{const o=l[l.length-1];o&&a(o.borderBoxSize?.[0]?.inlineSize??o.contentRect.width)});return a(r.getBoundingClientRect().width),i.observe(r),()=>i.disconnect()},[]),p.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:s}}const Rm=48,Oe={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"},Tm=(e,s)=>typeof e=="string"?t.jsx(P,{icon:e,className:"size-5","aria-hidden":"true"}):e||s||null,ui=({title:e,subtitle:s,eyebrow:a,icon:n,initials:r,actions:i,titleAs:l="h1",className:o,classNames:d={},"data-testid":u="page-header",list:f,narrow:m,headerRef:h})=>{const x=Tm(n,r);return t.jsxs("header",{ref:h,"data-testid":u,"data-variant":f?"list":void 0,"data-size":f?m?"narrow":"wide":void 0,className:c.cn(f?c.cn(Oe.base,m?Oe.baseNarrow:Oe.baseWide):"flex flex-wrap items-start justify-between gap-4",o,d.base),children:[t.jsxs("div",{className:f?Oe.identity:"flex items-center gap-4",children:[x?t.jsx("div",{"aria-hidden":"true","data-testid":`${u}-icon`,className:c.cn("flex size-12 shrink-0 items-center justify-center rounded-xl bg-gray-900 text-sm font-semibold text-white",d.iconWrapper),children:x}):null,t.jsxs("div",{className:f?Oe.text:void 0,children:[a?t.jsx("p",{"data-testid":`${u}-eyebrow`,className:c.cn("text-brand text-sm font-medium uppercase tracking-wide",d.eyebrow),children:a}):null,t.jsx(l,{"data-testid":`${u}-title`,className:c.cn(f?m?Oe.titleNarrow:Oe.titleWide:"text-3xl font-semibold text-gray-950",d.title),children:e}),s?t.jsx("p",{"data-testid":`${u}-subtitle`,className:c.cn(f?m?Oe.subtitleNarrow:Oe.subtitleWide:"mt-1 text-sm text-gray-600",d.subtitle),children:s}):null]})]}),i?t.jsx("div",{"data-testid":`${u}-actions`,className:c.cn(f?m?Oe.actionsNarrow:Oe.actionsWide:"flex flex-wrap items-center gap-2",d.actions),children:i}):null]})},Im=e=>{const{ref:s,width:a}=jt(),n=a>0&&!It(a,Rm);return t.jsx(ui,{...e,list:!0,narrow:n,headerRef:s})},mi=e=>e.variant==="list"?t.jsx(Im,{...e}):t.jsx(ui,{...e,list:!1,narrow:!1});mi.displayName="PageHeader";const qe={ok:{fg:je.ok,bg:je["ok-fill"]},warn:{fg:je.warn,bg:je["warn-fill"]},danger:{fg:je.danger,bg:je["danger-fill"]},info:{fg:je.info,bg:je["info-fill"]},violet:{fg:je.violet,bg:je["violet-fill"]},neutral:{fg:je.neutral,bg:je["neutral-fill"]}};function Pt(e){if(e==="positive")return{color:je.ok};if(e==="negative")return{color:je.danger}}const Pm={active:"success",success:"success",draft:"warning",pending:"warning",warning:"warning",danger:"danger",archived:"default",inactive:"default",neutral:"default",info:"default",violet:"default"},Zs={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:qe.info,violet:qe.violet},Om={active:"ok",success:"ok",draft:"warn",pending:"warn",warning:"warn",danger:"danger",archived:"neutral",inactive:"neutral",neutral:"neutral",info:"info",violet:"violet"},zm={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]"},Bm={info:Zs.info,violet:Zs.violet},fi=({status:e,label:s,variant:a="flat",size:n="sm",color:r,startContent:i,className:l,"data-testid":o="status-chip"})=>{if(a==="plain"){const u=qe[Om[e]];return t.jsxs("span",{"data-testid":o,"data-status":e,"data-variant":"plain",className:c.cn("inline-flex items-center gap-1.5 whitespace-nowrap rounded-full font-normal",zm[n],"leading-[1.35]",l),style:{color:u.fg,backgroundColor:u.bg},children:[i,s]})}if(a==="dot"){const u=Zs[e];return t.jsxs("span",{"data-testid":o,"data-status":e,className:c.cn("inline-flex items-center gap-1.5 whitespace-nowrap rounded-full px-2.5 py-[3px] text-[12px] font-semibold leading-[1.4]",l),style:{color:u.fg,backgroundColor:u.bg},children:[t.jsx("span",{"aria-hidden":"true",className:"size-1.5 shrink-0 rounded-full",style:{backgroundColor:"currentColor"}}),s]})}const d=r?void 0:Bm[e];return t.jsx(c.Chip,{color:r??Pm[e],variant:a,size:n,startContent:i,"data-testid":o,"data-status":e,className:c.cn("font-medium",l),style:d?{color:d.fg,backgroundColor:d.bg}:void 0,children:s})};fi.displayName="StatusChip";const Vm={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"},Ut={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"},ka=({label:e,value:s,size:a="sm",variant:n="default",className:r,"data-testid":i="key-value-chip"})=>n==="record"?t.jsxs("span",{"data-testid":i,"data-variant":"record",className:c.cn(Ut.base,Ut[a],r),children:[t.jsx("span",{className:Ut.label,children:e}),t.jsx("span",{className:Ut.value,children:s})]}):t.jsxs("span",{"data-testid":i,className:c.cn("inline-flex items-baseline whitespace-nowrap border border-default-200 bg-default-100",Vm[a],r),children:[t.jsx("span",{className:"font-medium text-default-400",children:e}),t.jsx("span",{className:"font-semibold text-default-700",children:s})]});ka.displayName="KeyValueChip";const xi="(prefers-reduced-motion: reduce)",hi="data-pos-reduce-motion",Ot="motion-reduce:transition-none [html[data-pos-reduce-motion=true]_&]:transition-none",Um="motion-reduce:animate-none [html[data-pos-reduce-motion=true]_&]:animate-none",Zt=`rounded-[0.375rem] bg-[linear-gradient(90deg,#F0F0F1_0,#F9F9FA_12.5rem,#F0F0F1_25rem)] bg-[length:50rem_100%] animate-record-shimmer ${Um}`;function Hm(){return typeof document>"u"?!1:document.documentElement.getAttribute(hi)==="true"?!0:typeof window.matchMedia=="function"&&window.matchMedia(xi).matches}function qm(){const[e,s]=p.useState(!1);return p.useEffect(()=>{const a=()=>s(Hm()),n=typeof window.matchMedia=="function"?window.matchMedia(xi):null;n?.addEventListener?.("change",a);const r=typeof MutationObserver>"u"?null:new MutationObserver(a);return r?.observe(document.documentElement,{attributes:!0,attributeFilter:[hi]}),a(),()=>{n?.removeEventListener?.("change",a),r?.disconnect()}},[]),e}const pi=({columns:e,rows:s=6,label:a="Loading",barHeight:n=12,alignLastRight:r=!1,appearance:i="pulse",className:l,classNames:o={},"data-testid":d="table-skeleton"})=>t.jsxs("div",{role:"status","aria-busy":"true","data-testid":d,className:c.cn("w-full",l,o.base),children:[t.jsx("span",{className:"sr-only",children:a}),t.jsx("div",{"aria-hidden":"true",children:Array.from({length:s}).map((u,f)=>i==="shimmer"?t.jsx("div",{"data-testid":`${d}-row`,className:c.cn("flex items-center border-b border-pos-hair",o.row),children:e.map((m,h)=>{const x=h===e.length-1;return t.jsx("div",{className:c.cn("min-w-0 flex-1 px-4 py-5",r&&x&&"flex justify-end"),children:t.jsx("div",{className:c.cn(Zt,o.bar),style:{height:Ze(n),width:m==="fill"?"60%":Ze(m),maxWidth:"100%"}})},h)})},f):t.jsx("div",{"data-testid":`${d}-row`,className:c.cn("flex items-center gap-3 border-t border-default-100 px-5 py-4",o.row),children:e.map((m,h)=>{const x=h===e.length-1;return t.jsx("div",{className:c.cn(m==="fill"?"flex-1":"shrink-0",r&&x&&"flex justify-end"),style:m==="fill"?void 0:{width:m},children:t.jsx("div",{className:c.cn("animate-pulse rounded bg-default-200",o.bar),style:{height:n,width:m==="fill"?"60%":m}})},h)})},f))})]});pi.displayName="TableSkeleton";const gi="text-left text-[11px] font-semibold uppercase tracking-[.04em] text-acct-sub px-4 pt-4 pb-3 whitespace-nowrap bg-transparent",bi="px-4 text-[13.5px] text-acct-ink2 align-middle",yi="border-t border-acct-hair transition-colors duration-150 hover:bg-acct-page data-[hover=true]:bg-acct-page",vi="w-full",ji="border-t border-acct-border px-5 py-3.5",Ht={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 ${Ot}`,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:s,emptyContent:a,footer:n,ariaLabel:r,variant:i="default",className:l,classNames:o={},"data-testid":d="admin-table"})=>{const u=i==="framed";return t.jsxs("div",{className:c.cn(u&&Ht.base,l,o.base),"data-testid":d,"data-variant":u?"framed":void 0,children:[t.jsxs(c.Table,{"aria-label":r,removeWrapper:!0,classNames:{table:c.cn(vi,o.table),th:c.cn(u?Ht.th:gi,o.th),tr:c.cn(u?Ht.tr:yi,o.tr),td:c.cn(u?Ht.td:bi,o.td)},children:[t.jsx(c.TableHeader,{columns:e,children:f=>t.jsx(c.TableColumn,{align:f.align==="right"?"end":"start",width:f.width,children:f.label},f.key)}),t.jsx(c.TableBody,{emptyContent:a,children:s})]}),n?t.jsx("div",{"data-testid":`${d}-footer`,className:c.cn(!u&&ji,o.footer),children:n}):null]})};wi.displayName="AdminTable";const Wm={md:"w-[280px]",lg:"w-[360px]"},Ym=48,ze={base:"flex flex-wrap items-center gap-2.5 border-b border-pos-hair px-4 py-[0.875rem]",narrow:"[&_[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",searchNarrow:"basis-full",inputBaseMd:"w-[15.625rem]",inputBaseLg:"w-[22.5rem]",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.4375rem]",input:"text-ellipsis text-[0.875rem] text-default-900 data-[has-start-content=true]:ps-0",icon:"flex text-default-400 [&_svg]:size-4"},Gm=({searchValue:e,onSearchChange:s,searchLabel:a,searchPlaceholder:n,searchIcon:r,children:i,trailing:l,searchWidth:o="md",className:d,"data-testid":u="admin-toolbar"})=>{const{ref:f,width:m}=jt(),h=m>0&&!It(m,Ym);return t.jsxs("div",{ref:f,role:"search","data-testid":u,"data-variant":"framed","data-size":h?"narrow":"wide",className:c.cn(ze.base,h&&ze.narrow,d),children:[i,t.jsx("div",{"data-testid":`${u}-search-slot`,className:h?ze.searchNarrow:ze.searchWide,children:t.jsx(c.Input,{type:"search","aria-label":a,placeholder:n??a,value:e,onValueChange:s,startContent:t.jsx("span",{"aria-hidden":"true","data-testid":`${u}-search-icon`,className:ze.icon,children:r??t.jsx(P,{icon:"lucide:search"})}),"data-testid":`${u}-search`,variant:"bordered",radius:"none",classNames:{base:h?ze.inputBaseNarrow:o==="lg"?ze.inputBaseLg:ze.inputBaseMd,inputWrapper:ze.inputWrapper,innerWrapper:ze.innerWrapper,input:ze.input}})}),l]})},Ni=({searchValue:e,onSearchChange:s,searchLabel:a,searchPlaceholder:n,searchIcon:r,children:i,trailing:l,searchWidth:o="md",variant:d="default",className:u,"data-testid":f="admin-toolbar"})=>d==="framed"?t.jsx(Gm,{searchValue:e,onSearchChange:s,searchLabel:a,searchPlaceholder:n,searchIcon:r,trailing:l,searchWidth:o,className:u,"data-testid":f,children:i}):t.jsxs("div",{role:"search","data-testid":f,className:c.cn("flex flex-wrap items-center gap-3 mb-4",u),children:[t.jsx(c.Input,{type:"search","aria-label":a,placeholder:n??a,value:e,onValueChange:s,startContent:r?t.jsx("span",{"aria-hidden":"true",className:"flex text-acct-muted",children:r}):void 0,"data-testid":`${f}-search`,variant:"bordered",radius:"none",classNames:{base:Wm[o],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"}}),i,l?t.jsx("div",{className:"ml-auto",children:l}):null]});Ni.displayName="AdminToolbar";const Km="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",Qm="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",Zm="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",Ci=p.forwardRef(function({icon:s,children:a,count:n,appearance:r="pill",className:i,testId:l,...o},d){return r==="outline"?t.jsxs(B,{ref:d,"data-testid":l,"data-appearance":"outline",color:"default",variant:"bordered",radius:"md",size:"md",className:c.cn("rounded-[0.75rem] font-normal",i),...o,children:[t.jsx(P,{icon:s,className:"size-4","aria-hidden":!0}),t.jsx("span",{children:a}),n!==void 0&&n>0&&t.jsx("span",{className:Qm,children:n})]}):t.jsxs(B,{ref:d,"data-testid":l,variant:"light",size:"sm",className:c.cn(Zm,i),...o,children:[t.jsx(P,{icon:s,className:"size-4 text-gray-500","aria-hidden":!0}),t.jsx("span",{children:a}),n!==void 0&&n>0&&t.jsx("span",{className:Km,children:n})]})});Ci.displayName="ToolbarButton";function ki({items:e,value:s,onChange:a,ariaLabel:n,className:r,"data-testid":i="underline-tabs"}){return t.jsx(c.Tabs,{"aria-label":n,variant:"underlined",selectedKey:s,onSelectionChange:l=>a(String(l)),"data-testid":i,classNames:{base:c.cn("w-full mb-6",r),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",tabContent:"text-[15px] font-medium text-acct-sub group-data-[selected=true]:font-semibold group-data-[selected=true]:text-acct-rust",panel:"p-0"},children:e.map(l=>t.jsx(c.Tab,{title:l.label,"data-testid":`${i}-${l.key}`,children:l.content},l.key))})}ki.displayName="UnderlineTabs";const Sa="text-[11px] font-semibold uppercase tracking-[.04em] text-acct-muted mb-1.5",$a="font-normal normal-case tracking-normal",Si=["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(" "),$i="text-[13.5px] text-acct-ink",Ai="bg-acct-page text-acct-muted cursor-default",Di="mt-[5px] text-xs text-acct-sub",Ei="mt-[5px] text-xs text-acct-danger",Fi=({children:e,suffix:s,className:a,"data-testid":n="admin-field-label"})=>t.jsxs("div",{"data-testid":n,className:c.cn(Sa,a),children:[e,s?t.jsxs("span",{className:$a,children:[" ",s]}):null]});Fi.displayName="AdminFieldLabel";const Li=({label:e,labelSuffix:s,value:a,onChange:n,placeholder:r,disabled:i=!1,readOnly:l=!1,mono:o=!1,autoFocus:d=!1,hint:u,invalid:f=!1,className:m,"data-testid":h="admin-text-field"})=>t.jsx(c.Input,{labelPlacement:e?"outside":void 0,label:e&&s?t.jsxs(t.Fragment,{children:[e,t.jsxs("span",{className:$a,children:[" ",s]})]}):e,value:a,placeholder:r,isDisabled:i,isReadOnly:l,autoFocus:d,isInvalid:f,description:!f&&u?u:void 0,errorMessage:f?u:void 0,onValueChange:n,"data-testid":h,variant:"bordered",radius:"none",classNames:{base:c.cn("w-full",m),label:Sa,inputWrapper:Si,input:c.cn($i,(o||l)&&"font-mono",l&&Ai),description:Di,errorMessage:Ei}});Li.displayName="AdminTextField";const Xm={sm:"size-6 min-w-6",md:"size-[30px] min-w-[30px]"},Mi=({actions:e,size:s="md",className:a,"data-testid":n="row-actions"})=>t.jsx("div",{role:"presentation","data-testid":n,className:c.cn("inline-flex gap-0.5",a),onClick:r=>r.stopPropagation(),children:e.map(r=>t.jsx(B,{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:c.cn("text-acct-sub data-[hover=true]:bg-acct-hair",Xm[s]),children:r.icon},r.key))});Mi.displayName="RowActions";const _i=({children:e,placeholder:s="Select…",onOpen:a,onClear:n,ariaLabel:r,icon:i,trailingIcon:l,clearIcon:o,disabled:d=!1,className:u,"data-testid":f="picker-row"})=>{const m=e!=null;return t.jsxs("div",{"data-testid":f,className:c.cn("flex w-full min-h-10 items-center rounded-[10px] border border-acct-border bg-acct-surface px-[11px] transition-colors duration-150",d?"opacity-60":"hover:border-acct-rust-border",u),children:[t.jsxs(B,{variant:"light",radius:"none",disableAnimation:!0,onPress:a,isDisabled:d,"aria-haspopup":"dialog","aria-label":r,"data-testid":`${f}-trigger`,className:"flex h-auto min-h-0 min-w-0 flex-1 items-center justify-start gap-2.5 bg-transparent px-0 py-2 text-left text-inherit data-[hover=true]:bg-transparent",children:[i?t.jsx("span",{className:"flex shrink-0 text-acct-muted",children:i}):null,m?t.jsx("span",{className:"flex min-w-0 items-center gap-2",children:e}):t.jsx("span",{className:"text-[13.5px] font-semibold text-acct-sub",children:s}),l?t.jsx("span",{className:"ml-auto flex shrink-0 text-acct-muted",children:l}):null]}),m&&n?t.jsx(B,{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:o}):null]})};_i.displayName="PickerRow";function Ri(e,s,a){if(a<=0||s<=0||e<=0)return{from:0,to:0};const n=(e-1)*s+1;return n>a?{from:0,to:0}:{from:n,to:Math.min(a,e*s)}}const Ti=({page:e,pageSize:s,total:a,unit:n,announce:r=!0,className:i,classNames:l={},"data-testid":o="pagination-summary"})=>{const{from:d,to:u}=Ri(e,s,a),f=c.cn("font-semibold text-default-700",l.emphasis);return t.jsxs("p",{"data-testid":o,"aria-live":r?"polite":void 0,className:c.cn("text-sm text-default-500",i,l.base),children:["Showing"," ",t.jsx("span",{"data-testid":`${o}-range`,className:f,children:d===0?0:`${d}–${u}`})," ","of"," ",t.jsx("span",{"data-testid":`${o}-total`,className:f,children:a}),n?t.jsxs(t.Fragment,{children:[" ",n]}):null]})};Ti.displayName="PaginationSummary";const fs="shadow-[0_1px_4px_rgba(0,0,0,.06),0_4px_12px_rgba(0,0,0,.06)]",Qe={base:`overflow-hidden rounded-2xl border border-pos-line bg-white ${fs}`,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"},Jm={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]"},ef={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:""}},Ii=({isLoading:e=!1,isError:s=!1,isEmpty:a=!1,loadingTitle:n="Loading…",loadingContent:r,errorTitle:i="Something went wrong",errorDescription:l,retryLabel:o="Retry",onRetry:d,errorActions:u,errorContent:f,emptyTitle:m="Nothing here yet",emptyDescription:h,emptyIcon:x,emptyActions:g,emptyContent:j,children:b,toolbar:w,variant:N="default",className:$,classNames:v={},"data-testid":A="list-panel"})=>{const M=N==="framed",k={base:c.cn("border-0 bg-transparent py-12",v.state)},F=M?{base:c.cn("px-6 py-[3.625rem]",v.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"}:k;let C;return e?C=r??t.jsx(Na,{title:n,classNames:k,"data-testid":`${A}-loading`}):s?C=f??t.jsx(wa,{title:i,description:l,classNames:k,"data-testid":`${A}-error`,actions:u??(d?t.jsx(B,{color:"primary",variant:"flat",onPress:d,children:o}):void 0)}):a?C=j??t.jsx(ja,{surface:M?"panel":void 0,title:m,description:h,icon:x,actions:g,classNames:F,"data-testid":`${A}-empty`}):C=b,t.jsxs("section",{"data-testid":A,"data-variant":M?"framed":void 0,className:c.cn(M?`overflow-hidden rounded-2xl border border-pos-line bg-white ${fs}`:"rounded-xl bg-white p-2 shadow-sm",$,v.base),children:[w,C]})};Ii.displayName="ListPanel";const Pi=(e,s)=>s<=0?/^\d*$/.test(e):new RegExp(`^\\d*(?:[.,]\\d{0,${s}})?$`).test(e),rs=e=>{const s=Number.parseFloat(e.replace(",","."));return Number.isFinite(s)?s:null},Oi=(e,s)=>{const[a,n]=p.useState(()=>s(e)),r=(rs(a)??0)===(e??0)?a:s(e),i=p.useCallback(()=>{n(l=>{const o=rs(l);return o===null?"":String(o)})},[]);return{draft:r,setDraft:n,normalize:i}},tf=350,sf={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}"},_s=(e,s)=>Object.entries(s).reduce((a,[n,r])=>a.replace(`{${n}}`,r),e),af=({dueAmount:e,received:s,defaultReceived:a=null,onChange:n,locale:r="en-US",labels:i,isDisabled:l=!1,maxAmount:o,autoFocus:d=!1,className:u,"data-testid":f="cash-tender-form"})=>{const m={...sf,...i},h=Rt(e.currency,r),x=s!==void 0,[g,j]=p.useState(a??null),b=x?s:g,{draft:w,setDraft:N,normalize:$}=Oi(b,V=>V==null?"":String(V)),v=p.useMemo(()=>{const V=typeof b=="number"&&Number.isFinite(b)?b:0,q=Hs(V,e.value,e.currency,r);return{received:V,change:q>0?q:0,isValid:V>=e.value&&V>0}},[b,e.value,e.currency,r]),A=p.useCallback(V=>{const q=V.currentTarget;requestAnimationFrame(()=>{q.isConnected&&q.select()})},[]),M=p.useCallback(V=>{if(l)return;const q=V.replace(/[^\d.,]/g,"");if(!Pi(q,h))return;const I=rs(q);if(I!==null&&o!==void 0&&I>o)return;N(q),x||j(I);const J=typeof I=="number"&&Number.isFinite(I)?I:0,W=Hs(J,e.value,e.currency,r);n?.({received:J,change:W>0?W:0,isValid:J>=e.value&&J>0})},[x,l,e.value,e.currency,r,n,o,N,h]),k=v.isValid&&v.change>0,F=!v.isValid&&v.received>0,C=ge(v.change,r,e.currency),_=ge(e.value,r,e.currency),[E,D]=p.useState(""),R=p.useRef(null);p.useEffect(()=>{R.current&&clearTimeout(R.current);const V=k?_s(m.changeMessageTemplate,{change:C}):"",q=k?tf:0;return R.current=setTimeout(()=>D(V),q),()=>{R.current&&clearTimeout(R.current)}},[k,C,m.changeMessageTemplate]);const O=`${f}-received`;return t.jsxs("div",{className:c.cn("flex flex-col gap-3",u),"data-testid":f,children:[t.jsx(c.Input,{id:O,label:m.receivedLabel,labelPlacement:"outside",type:"text",inputMode:h===0?"numeric":"decimal",pattern:h===0?"[0-9]*":"[0-9]*[.,]?[0-9]*",value:w,onChange:V=>M(V.target.value),onFocus:A,onBlur:$,placeholder:m.receivedPlaceholder,isDisabled:l,isInvalid:F,errorMessage:F?_s(m.insufficientMessageTemplate,{due:_}):void 0,variant:"bordered",radius:"lg",autoFocus:d,"data-testid":`${f}-received-input`}),k&&t.jsx(c.Alert,{"data-testid":`${f}-change-alert`,color:"primary",variant:"flat",radius:"lg",title:m.changeLabel,description:_s(m.changeMessageTemplate,{change:C}),icon:t.jsx(P,{icon:"lucide:info",width:20,height:20,"aria-hidden":"true"}),"aria-live":"off",classNames:{base:"bg-info-50 text-info-700",title:"font-semibold",description:"text-sm leading-relaxed",iconWrapper:"bg-transparent shadow-none border-0"}}),t.jsx("span",{role:"status","aria-live":"polite",className:"sr-only",children:E})]})},nf={checkNumberLabel:"Check Number",checkNumberPlaceholder:"e.g. 11234",bankNameLabel:"Bank Name",bankNamePlaceholder:"e.g. Chase Bank",dateLabel:"Date",checkNumberRequiredMessage:"Check number is required"},En=()=>{const e=new Date,s=a=>String(a).padStart(2,"0");return`${e.getFullYear()}-${s(e.getMonth()+1)}-${s(e.getDate())}`},zi=({dueAmount:e,value:s,defaultValue:a,onChange:n,labels:r,hideDate:i=!1,hideBankName:l=!1,isDisabled:o=!1,checkNumberMaxLength:d=34,bankNameMaxLength:u=100,autoFocus:f=!1,className:m,"data-testid":h="check-tender-form"})=>{const x={...nf,...r},g=s!==void 0,[j,b]=p.useState({checkNumber:a?.checkNumber??"",bankName:a?.bankName??"",date:a?.date??En()}),[w,N]=p.useState(!!a?.checkNumber),$=p.useMemo(()=>g?{checkNumber:s?.checkNumber??"",bankName:s?.bankName??"",date:s?.date??En()}:j,[g,s,j]),v=p.useCallback(E=>{g||b(E);const D=E.checkNumber.trim(),R={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?.(R)},[g,e.value,i,n]),A=p.useCallback(E=>D=>{o||(E==="checkNumber"&&D.length>0&&N(!0),v({...$,[E]:D}))},[$,v,o]),M=p.useCallback(()=>{o||N(!0)},[o]),k=w&&$.checkNumber.trim()==="",F=`${h}-check-number`,C=`${h}-bank-name`,_=`${h}-date`;return t.jsxs("div",{className:c.cn("grid grid-cols-1 sm:grid-cols-2 gap-4",m),"data-testid":h,children:[t.jsx(c.Input,{id:F,label:x.checkNumberLabel,labelPlacement:"outside",type:"text",value:$.checkNumber,onChange:E=>A("checkNumber")(E.target.value),onBlur:M,placeholder:x.checkNumberPlaceholder,maxLength:d,isRequired:!0,isInvalid:k,errorMessage:k?x.checkNumberRequiredMessage:void 0,isDisabled:o,variant:"bordered",radius:"lg",autoFocus:f,"data-testid":`${h}-check-number-input`}),!l&&t.jsx(c.Input,{id:C,label:x.bankNameLabel,labelPlacement:"outside",type:"text",value:$.bankName,onChange:E=>A("bankName")(E.target.value),placeholder:x.bankNamePlaceholder,maxLength:u,isDisabled:o,variant:"bordered",radius:"lg","data-testid":`${h}-bank-name-input`}),!i&&t.jsx(c.Input,{id:_,label:x.dateLabel,labelPlacement:"outside",type:"date",value:$.date,onChange:E=>A("date")(E.target.value),isDisabled:o,variant:"bordered",radius:"lg","data-testid":`${h}-date-input`,className:"sm:col-span-2"})]})};zi.displayName="CheckTenderForm";const rf={methodLabel:"Method",methodPlaceholder:"Select a payment method",referenceLabel:"Reference",referencePlaceholder:"e.g. Voucher #1234",methodRequiredMessage:"Method is required"},lf=[{value:"ach",label:"ACH"},{value:"wire",label:"Wire"},{value:"gift_card",label:"Gift Card"},{value:"voucher",label:"Voucher"},{value:"other",label:"Other"}],Bi=({dueAmount:e,methodOptions:s=lf,value:a,defaultValue:n,onChange:r,labels:i,showReference:l=!1,isDisabled:o=!1,className:d,"data-testid":u="other-tender-form"})=>{const f={...rf,...i},m=a!==void 0,[h,x]=p.useState({method:n?.method??"",reference:n?.reference??""}),g=p.useMemo(()=>m?{method:a?.method??"",reference:a?.reference??""}:h,[m,a,h]),j=p.useCallback(A=>s.find(M=>M.value===A)?.label??"",[s]),b=p.useCallback(A=>{m||x(A);const M=j(A.method),k={amount:e.value,method:A.method,description:M,reference:A.reference.trim()||void 0,isValid:A.method!==""};r?.(k)},[m,e.value,r,j]),w=p.useCallback(A=>{if(o)return;const M=typeof A=="string"?A:Array.from(A)[0]?.toString()??"";b({...g,method:M})},[g,b,o]),N=p.useCallback(A=>{o||b({...g,reference:A})},[g,b,o]),$=`${u}-method`,v=`${u}-reference`;return t.jsxs("div",{className:c.cn("flex flex-col gap-3",d),"data-testid":u,children:[t.jsx(He,{id:$,label:f.methodLabel,labelPlacement:"outside",placeholder:f.methodPlaceholder,selectedKeys:g.method?[g.method]:[],onSelectionChange:w,isDisabled:o,isRequired:!0,variant:"bordered",radius:"lg","data-testid":`${u}-method-select`,popoverProps:{placement:"bottom-start",classNames:{content:"bg-white border border-default-200 shadow-lg rounded-xl p-1"}},listboxProps:{classNames:{list:"max-h-[var(--popover-available-height,40vh)] overflow-y-auto"},itemClasses:{base:["rounded-lg","px-3 py-2","text-default-800","data-[hover=true]:bg-default-100","data-[selectable=true]:focus:bg-default-100","data-[selected=true]:bg-primary-50","data-[selected=true]:text-primary","data-[selected=true]:font-medium"]}},children:s.map(A=>t.jsx(c.SelectItem,{"data-testid":`${u}-method-option-${A.value}`,children:A.label},A.value))}),l&&t.jsx(c.Input,{id:v,label:f.referenceLabel,labelPlacement:"outside",type:"text",value:g.reference,onChange:A=>N(A.target.value),placeholder:f.referencePlaceholder,isDisabled:o,variant:"bordered",radius:"lg","data-testid":`${u}-reference-input`})]})};Bi.displayName="OtherTenderForm";const of={collectedHeading:"Collected",remainingLabel:"Remaining:",completeLabel:"Complete",removeAriaLabel:"Remove this tender",removeTooltipForRecorded:"Already recorded",statusPending:"Pending",statusRecorded:"Approved",statusFailed:"Failed"},cf={card:"lucide:credit-card",cash:"lucide:dollar-sign",check:"lucide:edit-3",other:"lucide:more-horizontal"},df={pending:"warning",recorded:"success",failed:"danger"},uf=e=>e==="pending"||e==="recorded",mf=e=>`#${e+1}`,Vi=({total:e,tenders:s,onRemove:a,locale:n="en-US",labels:r,hideCollectedList:i=!1,variant:l="banner",className:o,"data-testid":d="split-payment-summary"})=>{const u={...of,...r},{collected:f,remaining:m,isComplete:h}=p.useMemo(()=>{const g=s.reduce((b,w)=>uf(w.status)?b+w.amount:b,0),j=Math.max(e.value-g,0);return{collected:g,remaining:j,isComplete:g>=e.value&&e.value>0}},[s,e.value]),x=g=>g==="pending"?u.statusPending:g==="recorded"?u.statusRecorded:u.statusFailed;return t.jsxs("div",{className:c.cn("flex flex-col gap-4",o),"data-testid":d,children:[l==="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:h?u.completeLabel:u.remainingLabel}),t.jsx("span",{className:"text-base font-semibold tracking-tight","data-testid":`${d}-remaining-amount`,children:ge(h?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:h?u.completeLabel:u.remainingLabel}),t.jsx("div",{className:"mt-1 text-4xl font-bold tracking-tight","data-testid":`${d}-remaining-amount`,children:ge(h?f:m,n,e.currency)})]}),!i&&s.length>0&&t.jsxs("div",{className:"flex flex-col gap-2","data-testid":`${d}-collected-list`,children:[t.jsx("h3",{className:"text-base font-semibold",children:u.collectedHeading}),s.map((g,j)=>t.jsx(ff,{index:j,tender:g,locale:n,currency:e.currency,removable:!!a&&g.status!=="recorded",onRemove:a?()=>a(g.id):void 0,statusLabel:x(g.status),removeAriaLabel:u.removeAriaLabel,recordedTooltip:u.removeTooltipForRecorded,dataTestId:`${d}-row-${j}`},g.id))]})]})};Vi.displayName="SplitPaymentSummary";const ff=({index:e,tender:s,locale:a,currency:n,removable:r,onRemove:i,statusLabel:l,removeAriaLabel:o,recordedTooltip:d,dataTestId:u})=>{const f=i?t.jsx(B,{isIconOnly:!0,variant:"light",radius:"full",size:"sm",onPress:i,isDisabled:!r,"aria-label":o,"data-testid":`${u}-remove`,className:c.cn(r?"text-default-700 hover:bg-default-200":"text-default-300"),children:t.jsx(P,{icon:"lucide:x",width:18,height:18,"aria-hidden":"true"})}):null;return t.jsxs("div",{className:"flex items-center gap-3 rounded-xl bg-default-50 px-4 py-3 motion-safe:animate-[pp-row-in_200ms_ease-out]","data-testid":u,children:[t.jsx("span",{className:"text-sm font-medium text-default-500 w-6 shrink-0",children:mf(e)}),t.jsx(P,{icon:cf[s.type],width:20,height:20,className:"text-default-700 shrink-0","aria-hidden":"true"}),t.jsx("span",{className:"flex-1 truncate","data-testid":`${u}-label`,children:s.label}),t.jsx("span",{className:"font-semibold tabular-nums","data-testid":`${u}-amount`,children:ge(s.amount,a,n)}),t.jsx(c.Chip,{size:"sm",radius:"full",variant:"flat",color:df[s.status],startContent:s.status==="recorded"?t.jsx(P,{icon:"lucide:check-circle",width:14,height:14,"aria-hidden":"true"}):s.status==="failed"?t.jsx(P,{icon:"lucide:alert-circle",width:14,height:14,"aria-hidden":"true"}):void 0,"data-testid":`${u}-status`,children:l}),f&&(r?f:t.jsx(c.Tooltip,{content:d,placement:"left",children:t.jsx("span",{tabIndex:0,"aria-label":d,children:f})}))]})},xf=`
|
|
16
|
+
`,"aria-label":`Zoom level ${e}%`,children:[e,"%"]})}),t.jsx(c.Tooltip,{content:"Zoom in",placement:"top",offset:10,children:t.jsx(B,{size:"sm",radius:"sm",color:"default",variant:"bordered",isIconOnly:!0,isDisabled:u,onPress:l,"aria-label":"Zoom in",children:t.jsx(K.ZoomIn,{size:16})})})]})}function cd({editor:e,isDisabled:s=!1}){const[a,n]=p.useState(!1),[r,i]=p.useState(""),[l,o]=p.useState(""),[d,u]=p.useState(!1),f=e.isActive("link"),m=x=>{if(x){const{from:g,to:j}=e.state.selection,b=e.isActive("link");let w="";if(b){const D=e.schema.marks.link,v=e.state.doc.resolve(g),S=Pa.getMarkRange(v,D);S&&(w=e.state.doc.textBetween(S.from,S.to,""))}else w=e.state.doc.textBetween(g,j,"");const N=e.getAttributes("link").href||"";i(w),o(N),u(b)}n(x)},h=()=>{if(l.trim()){const{from:x,to:g}=e.state.selection,j=e.schema.marks.link,b=e.state.doc.resolve(x),w=Pa.getMarkRange(b,j),N=w?.from??x,D=w?.to??g,v=e.state.doc.textBetween(N,D,"");r.trim()&&r!==v?e.chain().focus().setTextSelection({from:N,to:D}).deleteSelection().insertContent(`<a href="${l.trim()}">${r.trim()}</a>`).run():e.chain().focus().extendMarkRange("link").updateAttributes("link",{href:l.trim()}).run()}n(!1)};return t.jsxs(c.Popover,{isOpen:a,onOpenChange:m,placement:"bottom",children:[t.jsx(c.PopoverTrigger,{children:t.jsx(B,{size:"sm",radius:"sm",variant:f?"solid":"bordered",color:f?"primary":"default",isIconOnly:!0,isDisabled:s,"aria-label":"Link",children:t.jsx(K.Link,{size:16})})}),t.jsx(c.PopoverContent,{children:t.jsxs("div",{className:"flex flex-col gap-3 p-3 w-72",children:[t.jsx(c.Input,{size:"sm",variant:"bordered",label:"Name",labelPlacement:"outside",placeholder:"Link text",value:r,onChange:x=>i(x.target.value),classNames:{inputWrapper:"focus-within:border-default-400"}}),t.jsx(c.Input,{size:"sm",variant:"bordered",label:"Link",labelPlacement:"outside",placeholder:"https://example.com",value:l,onChange:x=>o(x.target.value),onKeyDown:x=>x.key==="Enter"&&h(),classNames:{inputWrapper:"focus-within:border-default-400"}}),t.jsx(B,{size:"sm",color:"primary",onPress:h,isDisabled:!l.trim(),children:d?"Update":"Apply"})]})})]})}function dd({children:e,id:s,label:a,className:n,useButtonGroup:r=!0}){return r?t.jsx(c.ButtonGroup,{size:"sm",id:s,"aria-label":a,className:n,children:e}):t.jsx("div",{id:s,role:"group","aria-label":a,className:`flex items-center gap-2 ${n||""}`,children:e})}function kr(e,s){const a=p.useMemo(()=>{if(!e)return{};const i={};return Array.from(new Set(s.map(o=>_t(o)))).forEach(o=>{const d=Xe[o];if(d)try{const u=d.canExecute?.(e)??!0,f=d.isActive?.(e)??!1;i[o]={isActive:f,isDisabled:!u,canExecute:u}}catch(u){console.warn(`Extension not available for modifier: ${o}`,u),i[o]={isActive:!1,isDisabled:!0,canExecute:!1}}}),i},[e,s]),[n,r]=p.useState(a);return p.useEffect(()=>{if(!e)return;const i=()=>{const l={};Array.from(new Set(s.map(d=>_t(d)))).forEach(d=>{const u=Xe[d];if(u)try{const f=u.canExecute?.(e)??!0,m=u.isActive?.(e)??!1;l[d]={isActive:m,isDisabled:!f,canExecute:f}}catch(f){console.warn(`Extension not available for modifier: ${d}`,f),l[d]={isActive:!1,isDisabled:!0,canExecute:!1}}}),r(l)};return e.on("selectionUpdate",i),e.on("transaction",i),()=>{e.off("selectionUpdate",i),e.off("transaction",i)}},[e,s,a]),n}function Sr(e,s){const a=p.useCallback((l,o)=>{if(!e)return;const d=Xe[l];if(d)try{d.execute({editor:e,config:o}),s?.({type:"toggle",modifier:l})}catch(u){console.warn(`Failed to execute command for modifier: ${l}`,u)}},[e,s]),n=p.useCallback(l=>{a(l)},[a]),r=p.useCallback((l,o)=>{if(!e)return!1;const d=Xe[l];try{return d?.canExecute?.(e,o)??!1}catch(u){return console.warn(`Failed to check canExecute for modifier: ${l}`,u),!1}},[e]),i=p.useCallback((l,o)=>{if(!e)return!1;const d=Xe[l];try{return d?.isActive?.(e,o)??!1}catch(u){return console.warn(`Failed to check isActive for modifier: ${l}`,u),!1}},[e]);return{executeCommand:a,toggleModifier:n,canExecute:r,isActive:i}}function ud(e=Ce.default){const[s,a]=p.useState(e),n=p.useCallback((o=Ce.step)=>{a(d=>Math.min(Ce.max,d+o))},[]),r=p.useCallback((o=Ce.step)=>{a(d=>Math.max(Ce.min,d-o))},[]),i=p.useCallback(()=>{a(Ce.default)},[]),l=p.useCallback(o=>{const d=Math.max(Ce.min,Math.min(Ce.max,o));a(d)},[]);return{zoom:s,setZoom:l,zoomIn:n,zoomOut:r,resetZoom:i,isMinZoom:s<=Ce.min,isMaxZoom:s>=Ce.max,isDefaultZoom:s===Ce.default}}const md=["bold","italic","strike","underline","code"];function fd({editor:e,modifiers:s,onToolbarAction:a}){const n=kr(e,s),{toggleModifier:r}=Sr(e,a);if(!e)return null;const i=s.map(l=>_t(l)).filter(l=>md.includes(l));return i.length===0?null:t.jsx(dd,{id:"text-formatting",label:"Text formatting",children:i.map(l=>{const o=n[l],d=pt(l);return t.jsx(ot,{icon:d,label:l.charAt(0).toUpperCase()+l.slice(1),isActive:o?.isActive,isDisabled:o?.isDisabled,onClick:()=>r(l)},l)})})}function xd({editor:e,modifiers:s,zoom:a=100,onZoomChange:n,sticky:r=!0,className:i,onToolbarAction:l}){const o=kr(e,s),{toggleModifier:d,executeCommand:u}=Sr(e,l);if(!e)return null;const f=s.map(k=>_t(k)),m=f.some(k=>["bold","italic","strike","underline","code"].includes(k)),h=f.some(k=>["textColor","highlight"].includes(k)),x=f.includes("heading"),g=f.includes("textAlign"),j=f.some(k=>["bulletList","orderedList","taskList"].includes(k)),b=f.includes("blockquote"),w=f.includes("codeBlock"),N=f.includes("link"),D=f.includes("horizontalRule"),v=f.some(k=>["undo","redo"].includes(k)),S=a!==void 0&&n!==void 0,M=r?"sticky top-0 z-10":"";return t.jsx("div",{className:`w-full p-2 bg-background border-b border-divider ${M} ${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(fd,{editor:e,modifiers:s,onToolbarAction:l}),(h||x||g||j||b||w||N||D||v||S)&&t.jsx(lt,{})]}),h&&t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"flex items-center gap-1",children:[f.includes("textColor")&&t.jsx(rn,{editor:e,type:"textColor",label:"Text color",isDisabled:o.textColor?.isDisabled}),f.includes("highlight")&&t.jsx(rn,{editor:e,type:"highlight",label:"Highlight",isDisabled:o.highlight?.isDisabled})]}),(x||g||j||b||w||N||D||v||S)&&t.jsx(lt,{})]}),x&&t.jsxs(t.Fragment,{children:[t.jsx(ed,{editor:e}),(g||j||b||w||N||D||v||S)&&t.jsx(lt,{})]}),g&&t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"flex items-center gap-1",children:["left","center","right","justify"].map(k=>{const F=id[k],C=e.isActive({textAlign:k});return t.jsx(ot,{icon:F,label:`Align ${k}`,isActive:C,onClick:()=>u("textAlign",{type:"textAlign",alignment:k})},k)})}),(j||b||w||N||D||v||S)&&t.jsx(lt,{})]}),j&&t.jsxs(t.Fragment,{children:[t.jsx(td,{editor:e,types:f.filter(k=>["bulletList","orderedList","taskList"].includes(k))}),(b||w||N||D||v||S)&&t.jsx(lt,{})]}),(b||w||N||D)&&t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"flex items-center gap-1",children:[b&&t.jsx(ot,{icon:pt("blockquote"),label:"Blockquote",isActive:o.blockquote?.isActive,isDisabled:o.blockquote?.isDisabled,onClick:()=>d("blockquote")}),w&&t.jsx(ot,{icon:pt("codeBlock"),label:"Code block",isActive:o.codeBlock?.isActive,isDisabled:o.codeBlock?.isDisabled,onClick:()=>d("codeBlock")}),N&&t.jsx(cd,{editor:e,isDisabled:o.link?.isDisabled}),D&&t.jsx(ot,{icon:pt("horizontalRule"),label:"Horizontal rule",onClick:()=>d("horizontalRule")})]}),(v||S)&&t.jsx(lt,{})]}),v&&t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"flex items-center gap-1",children:[f.includes("undo")&&t.jsx(ot,{icon:pt("undo"),label:"Undo",isDisabled:o.undo?.isDisabled,onClick:()=>d("undo")}),f.includes("redo")&&t.jsx(ot,{icon:pt("redo"),label:"Redo",isDisabled:o.redo?.isDisabled,onClick:()=>d("redo")})]}),S&&t.jsx(lt,{})]}),S&&t.jsx(od,{zoom:a,onZoomChange:k=>{n?.(k),l?.({type:"zoom",modifier:`${k}%`})}})]})})}const Ct={bold:{category:"mark",extension:zl.Bold,priority:100},italic:{category:"mark",extension:Bl.Italic,priority:100},strike:{category:"mark",extension:Vl.Strike,priority:100},underline:{category:"mark",extension:Ul.Underline,priority:100},code:{category:"mark",extension:Hl.Code,priority:100},textColor:{category:"mark",extension:ql.Color,defaultOptions:{types:["textStyle","heading","paragraph","listItem","taskItem","blockquote"]},priority:90},highlight:{category:"mark",extension:Wl.Highlight,defaultOptions:{multicolor:!0},priority:90},link:{category:"mark",extension:Yl.Link,defaultOptions:{autolink:!0,linkOnPaste:!0,openOnClick:!1,HTMLAttributes:{class:"text-primary underline cursor-pointer"}},priority:100},heading:{category:"node",extension:Kl.Heading,defaultOptions:{levels:[1,2,3,4,5,6]},priority:100},bulletList:{category:"node",extension:Zl.BulletList,defaultOptions:{HTMLAttributes:{class:"list-disc"}},priority:90},orderedList:{category:"node",extension:Xl.OrderedList,defaultOptions:{HTMLAttributes:{class:"list-decimal"}},priority:90},taskList:{category:"node",extension:Jl.TaskList,defaultOptions:{HTMLAttributes:{class:"task-list"}},priority:90},codeBlock:{category:"node",extension:so.CodeBlock,priority:100},blockquote:{category:"node",extension:ao.Blockquote,priority:100},horizontalRule:{category:"node",extension:no.HorizontalRule,priority:100},hardBreak:{category:"node",extension:ro.HardBreak,priority:100},undo:{category:"extension",extension:Oa.History,priority:50},redo:{category:"extension",extension:Oa.History,priority:50},textAlign:{category:"extension",extension:io.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}},hd=[lo.Document,oo.Text,Ql.Paragraph,Gl.TextStyle.configure({HTMLAttributes:{}}),to.ListItem.configure({HTMLAttributes:{}}),eo.TaskItem.configure({nested:!0}),co.Dropcursor,uo.Gapcursor];function pd(e){const s=[],a=new Set,n=new Set;hd.forEach(o=>{o&&(s.push(o),n.add(o.name))});const r=e.map(o=>_t(o)),i=new Set;return r.forEach(o=>{const d=Ct[o];d?.requiredExtensions&&d.requiredExtensions.forEach(u=>{i.add(u)})}),i.forEach(o=>{if(a.has(o))return;const d=Ct[o];if(!d||d.extension===null)return;const u=d.extension.name;if(n.has(u)){a.add(o);return}const f=d.defaultOptions?d.extension.configure(d.defaultOptions):d.extension;s.push(f),a.add(o),n.add(u)}),r.forEach(o=>{if(a.has(o))return;const d=Ct[o];if(!d){console.warn(`Extension config not found for modifier: ${o}`);return}if(d.extension===null){a.add(o);return}const u=d.extension.name;if(n.has(u)){a.add(o);return}const f=d.defaultOptions?d.extension.configure(d.defaultOptions):d.extension;s.push(f),a.add(o),n.add(u)}),s.sort((o,d)=>{const u=Object.values(Ct).find(x=>x?.extension?.name===o.name),f=Object.values(Ct).find(x=>x?.extension?.name===d.name),m=u?.priority??100;return(f?.priority??100)-m})}const $r={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"]},gd={h1:`font-size: ${fe.fontSize["4xl"]}; font-weight: ${fe.fontWeight.semibold}; line-height: ${fe.lineHeight.tight}; margin: ${ue.md} 0 ${ue.sm} 0;`,h2:`font-size: ${fe.fontSize["2xl"]}; font-weight: ${fe.fontWeight.semibold}; line-height: ${fe.lineHeight.tight}; margin: ${ue.md} 0 ${ue.sm} 0;`,h3:`font-size: ${fe.fontSize.xl}; font-weight: ${fe.fontWeight.semibold}; line-height: ${fe.lineHeight.tight}; margin: ${ue.md} 0 ${ue.sm} 0;`,h4:`font-size: ${fe.fontSize.lg}; font-weight: ${fe.fontWeight.semibold}; line-height: ${fe.lineHeight.tight}; margin: ${ue.md} 0 ${ue.sm} 0;`,h5:`font-size: ${fe.fontSize.base}; font-weight: ${fe.fontWeight.semibold}; line-height: ${fe.lineHeight.tight}; margin: ${ue.md} 0 ${ue.sm} 0;`,h6:`font-size: ${fe.fontSize.sm}; font-weight: ${fe.fontWeight.semibold}; line-height: ${fe.lineHeight.tight}; margin: ${ue.md} 0 ${ue.sm} 0;`,p:`min-height: ${fe.lineHeight.normal}em; margin: 0;`,ul:`list-style-type: disc; list-style-position: outside; padding-left: ${ue.xl}; margin: ${ue.md} 0;`,ol:`list-style-type: decimal; list-style-position: outside; padding-left: ${ue.xl}; margin: ${ue.md} 0;`,li:`display: list-item; margin: ${ue.xs} 0;`,strong:`font-weight: ${fe.fontWeight.bold};`,em:"font-style: italic;",s:"text-decoration: line-through;",u:"text-decoration: underline;",code:`background-color: ${we.neutral.gray[100]}; border-radius: 0.4rem; font-size: ${fe.fontSize.sm}; padding: 0.25em 0.3em; font-family: ${fe.fontFamily.mono};`,pre:`background: ${we.neutral.gray[800]}; border-radius: ${ue.sm}; color: ${we.neutral.gray[100]}; font-family: ${fe.fontFamily.mono}; margin: ${ue.lg} 0; padding: 0.75rem ${ue.md}; overflow-x: auto;`,blockquote:`border-left: 3px solid ${we.neutral.gray[300]}; margin: ${ue.lg} 0; padding-left: ${ue.md}; color: ${we.neutral.gray[500]};`,hr:`border: none; border-top: 1px solid ${we.neutral.gray[200]}; margin: ${ue.xl} 0;`,a:`color: ${we.brand.primary.DEFAULT}; text-decoration: underline; cursor: pointer;`,mark:`background-color: ${we.palettes.warning[200]}; border-radius: ${ue.xs}; padding: 0 0.125rem;`,label:`display: flex; align-items: center; gap: ${ue.sm}; cursor: pointer;`,input:"cursor: pointer; margin: 0;"},bd={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 yd(e){if(!e)return e;let s=e;for(const[a,n]of Object.entries(bd)){const r=new RegExp(`(<(?:ul|li)[^>]*data-type="${a}"[^>]*)>`,"gi");s=s.replace(r,(i,l)=>i.includes('style="')?i.replace(/style="([^"]*)"/,`style="$1 ${n}"`):`${l} style="${n}">`)}for(const[a,n]of Object.entries(gd)){const r=new RegExp(`<${a}(\\s[^>]*)?>`,"gi");s=s.replace(r,i=>{if(i.includes('data-type="taskList"')||i.includes('data-type="taskItem"'))return i;if(i.includes('style="'))return i.replace(/style="([^"]*)"/,`style="$1 ${n}"`);if(i.includes("style='"))return i.replace(/style='([^']*)'/,`style='$1 ${n}'`);{const l=i.indexOf(">");return`${i.slice(0,l)} style="${n}"${i.slice(l)}`}})}return s}const vd=({modifiers:e,zoom:s,onZoomChange:a,onToolbarAction:n})=>{const{editor:r}=ta.useCurrentEditor();return t.jsx(xd,{editor:r,modifiers:e,zoom:s,onZoomChange:a,onToolbarAction:n})},jd=({showCharacterCount:e,showWordCount:s})=>{const{editor:a}=ta.useCurrentEditor();if(!a||!e&&!s)return null;const n=a.getText(),r=n.length,i=n.split(/\s+/).filter(l=>l.length>0).length;return t.jsxs("div",{className:"flex gap-4 text-xs text-default-500 px-2 pb-1",children:[e&&t.jsxs("span",{children:[r," characters"]}),s&&t.jsxs("span",{children:[i," words"]})]})},qs=p.forwardRef((e,s)=>{const{minRows:a=10,maxRows:n=30,disableAutosize:r=!1,showCharacterCount:i=!1,showWordCount:l=!1,showToolbar:o=!0,modifiers:d=$r.full,variant:u="bordered",initialContent:f,content:m,onContentChange:h,onUpdate:x,onToolbarAction:g,isReadOnly:j=!1,isDisabled:b=!1,includeInlineStyles:w=!0,...N}=e,{zoom:D,setZoom:v}=ud(),S=nn.lineHeight,M=a*S,k=r?void 0:n*S,F=p.useMemo(()=>pd(d),[d]),{Component:C,label:_,shouldLabelBeOutside:E,getBaseProps:A,getLabelProps:R,getInputWrapperProps:O}=c.useInput({...N,variant:u,ref:s,isMultiline:!0}),V=_?t.jsx("label",{...R(),children:_}):null,q=p.useCallback(({editor:I})=>{const J=I.getHTML(),W=w?yd(J):J,se=I.getJSON(),Y=I.getText(),Z=Y.length,Q=Y.split(/\s+/).filter(ne=>ne.length>0).length,ee={html:W,json:se,text:Y,characters:Z,words:Q};if(h?.(ee),x?.(ee),"onChange"in N&&typeof N.onChange=="function"){const ne={target:{value:W},currentTarget:{value:W}};N.onChange(ne)}},[h,x,N,w]);return t.jsxs(C,{...A(),children:[E?V:null,t.jsx("div",{...O(),className:c.cn(O().className,"flex flex-col w-full p-0 gap-0 rich-text-editor"),style:{maxHeight:k?`${k+nn.toolbarHeight}px`:void 0,overflow:k?"auto":void 0},children:t.jsx(ta.EditorProvider,{editable:!j&&!b,slotBefore:o?t.jsx(vd,{modifiers:d,zoom:D,onZoomChange:v,onToolbarAction:g}):void 0,slotAfter:t.jsx(jd,{showCharacterCount:i,showWordCount:l}),editorContainerProps:{className:"w-full flex-1 outline-none",style:{minHeight:`${M}px`,fontSize:`${D}%`,display:"flex",flexDirection:"column"}},editorProps:{attributes:{class:"focus:outline-none w-full h-full"}},extensions:F,content:m||f||e.defaultValue||"",onUpdate:q})})]})});qs.displayName="TipTapEditor";const Ar=p.forwardRef((e,s)=>{const{adapter:a="tiptap",variant:n="bordered",...r}=e;return a==="tiptap"?t.jsx(qs,{...r,variant:n,ref:s}):(console.warn(`Adapter "${a}" is not supported. Using TipTap.`),t.jsx(qs,{...r,variant:n,ref:s}))});Ar.displayName="RichTextArea";function wd(e,s="en-US",a="USD"){try{return new Intl.NumberFormat(s,{style:"currency",currency:a,minimumFractionDigits:0,maximumFractionDigits:2}).format(e)}catch(n){return console.warn(`Invalid currency formatting: ${n}`),`${a} ${e.toFixed(2)}`}}const ln=[{id:"100",amount:100},{id:"250",amount:250},{id:"500",amount:500},{id:"1000",amount:1e3},{id:"2000",amount:2e3}],Nd={title:"Donation Amount",customAmountPlaceholder:"Custom donation amount",customAmountAriaLabel:"Custom donation amount",addDonationButton:"Add Donation"},Dr=({presetAmounts:e=ln,selectedDonation:s,defaultSelectedDonation:a=null,onChange:n,onAddDonation:r,currency:i="USD",locale:l="en-US",showCustomAmount:o=!0,minCustomAmount:d=.5,maxCustomAmount:u=1e6,labels:f,mobileColumns:m=2,desktopColumns:h=3,isDisabled:x=!1,buttonVariant:g="bordered",buttonColor:j="default",inputVariant:b="bordered",size:w="md",className:N="",showCard:D=!0})=>{const v={...Nd,...f},S=Array.isArray(e)?e:ln,M={2:"grid-cols-2",3:"grid-cols-3"},k={3:"sm:grid-cols-3",4:"sm:grid-cols-4",5:"sm:grid-cols-5",6:"sm:grid-cols-6"},F=`${M[m]} ${k[h]}`,[C,_]=ds(s,a,n),[E,A]=p.useState(""),[R,O]=p.useState(!1),[V,q]=p.useState(0),I=p.useCallback(Z=>{if(x)return;const Q={amount:Z.amount,isCustom:!1,presetId:Z.id};_(Q),A(""),O(!1),q(ee=>ee+1),r?.(Q)},[x,_,r]),J=p.useCallback(Z=>{if(x)return;if(A(Z!==void 0?String(Z):""),r){_(null);return}if(Z===void 0||isNaN(Z)){_(null);return}_({amount:Z,isCustom:!0})},[x,_,r]),W=p.useCallback(()=>{if(x)return;const Z=E!==""?parseFloat(E):void 0;Z===void 0||isNaN(Z)||r?.({amount:Z,isCustom:!0})},[x,E,r]),se=p.useMemo(()=>({style:"currency",currency:i,currencyDisplay:"symbol"}),[i]),Y=t.jsxs("div",{className:"space-y-4","data-testid":"donation-amounts-root",children:[v.title&&t.jsx("h2",{className:"text-base font-semibold","data-testid":"donation-amounts-title",children:v.title}),S.length>0&&t.jsx("div",{className:c.cn("grid gap-3",F),"data-testid":"donation-amounts-presets",children:S.map(Z=>{const Q=C!==null&&!C.isCustom&&C.presetId===Z.id;return t.jsx(B,{color:Q?"primary":j,variant:Q?"solid":g,className:"w-full",onPress:()=>I(Z),isDisabled:x,"data-testid":`donation-amounts-preset-${Z.id}`,children:Z.label||wd(Z.amount,l,i)},Z.id)})}),o&&t.jsxs("div",{className:"flex gap-3 items-start",children:[t.jsx(c.NumberInput,{placeholder:v.customAmountPlaceholder,"aria-label":v.customAmountAriaLabel,onInput:r?()=>{_(null),O(!0)}:void 0,variant:b,radius:"full",size:w,minValue:d,maxValue:u,step:.01,formatOptions:se,value:E!==""?parseFloat(E):void 0,onValueChange:J,isDisabled:x,className:"flex-1 [&_[data-slot=input-wrapper]]:!h-10 [&_[data-slot=input-wrapper]]:!min-h-10","data-testid":"donation-amounts-custom-input",hideStepper:!0},r?`custom-${V}`:C?.isCustom===!1?C.presetId:"custom"),r&&t.jsx(B,{color:"primary",variant:"solid",radius:"full",size:w,className:"shrink-0",onPress:W,isDisabled:x||!R,"data-testid":"donation-amounts-add-button",children:v.addDonationButton})]})]});return D?t.jsx(c.Card,{className:c.cn("w-full",N),"data-testid":"donation-amounts-card",children:t.jsx(c.CardBody,{children:Y})}):t.jsx("div",{className:c.cn("w-full",N),"data-testid":"donation-amounts-plain",children:Y})};Dr.displayName="DonationAmounts";const Cd=e=>{const s=Math.max(0,e),a=Math.floor(s/60).toString().padStart(2,"0"),n=(s%60).toString().padStart(2,"0");return`${a}:${n} minutes`},kd=e=>{switch(e){case"warning":return K.Clock;case"error":return K.AlertCircle;case"success":return K.CheckCircle;default:return K.Clock}},Sd=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"}},Er=p.forwardRef(({timeLeft:e,defaultTimeLeft:s=1200,onTimeChange:a,onExpire:n,variant:r="info",color:i="primary",message:l="Your cart expires in:",showIcon:o=!0,icon:d,position:u="fixed",autoStart:f=!0,formatTime:m=Cd,className:h,...x},g)=>{const[j,b]=ds(e!==void 0?Math.max(0,e):void 0,Math.max(0,s),a),w=p.useRef(null),N=p.useRef(!1);p.useEffect(()=>()=>{w.current&&clearInterval(w.current)},[]),p.useEffect(()=>{if(!f||j<=0){w.current&&(clearInterval(w.current),w.current=null);return}return w.current=setInterval(()=>{b(M=>M<=1?(w.current&&(clearInterval(w.current),w.current=null),N.current||(N.current=!0,n?.()),0):M-1)},1e3),()=>{w.current&&(clearInterval(w.current),w.current=null)}},[f,j,b,n]),p.useEffect(()=>{j>0&&(N.current=!1)},[j]);const D=d||kd(r),v=Sd(i),S={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":`${l} ${m(j)}`,"data-testid":"expire-cart-timer",className:c.cn("w-full text-white z-50",v,S[u],h),...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:[o&&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(D,{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:l})]}),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)})})]})})})});Er.displayName="ExpireCartTimer";const ft=({icon:e,children:s,testId:a})=>t.jsxs("div",{className:"flex items-center gap-2 text-sm text-gray-600","data-testid":a,children:[t.jsx(P,{icon:e,width:20,className:"text-default-500"}),t.jsx("span",{children:s})]}),$d=({classes:e="",name:s,imageUrl:a,eventDate:n,eventTime:r,location:i,description:l,showImage:o=!1,compact:d=!1,layout:u="stacked",imageLoading:f="eager",showMoreButtonClassName:m,labels:h})=>{const[x,g]=p.useState(!1),[j,b]=p.useState(!1),w=p.useRef(null);return p.useEffect(()=>{const N=()=>{if(w.current){const D=w.current.scrollHeight>w.current.clientHeight;b(D)}};return N(),window.addEventListener("resize",N),()=>window.removeEventListener("resize",N)},[l]),u==="horizontal"?t.jsx(c.Card,{className:c.cn("border-0 shadow-none",e),"data-testid":"event-details-root",children:t.jsx(c.CardBody,{className:"p-0","data-testid":"event-details-horizontal-layout",children:t.jsxs("div",{className:"flex flex-col items-start gap-5 sm:flex-row sm:gap-8",children:[o&&a&&t.jsx("div",{className:"w-full shrink-0 overflow-hidden rounded-xl aspect-[3/2] sm:w-[360px]","data-testid":"event-details-image-wrapper",children:t.jsx(c.Image,{removeWrapper:!0,loading:f,alt:`Event image for ${s}`,className:"w-full h-full object-cover object-center",src:a,"data-testid":"event-details-image"})}),t.jsxs("div",{className:"min-w-0 flex-1 space-y-3",children:[t.jsx("h2",{className:"font-semibold text-2xl text-gray-800","data-testid":"event-details-title",children:s}),t.jsx("h3",{className:"font-semibold text-base text-gray-700","data-testid":"event-details-info-label",children:h.eventInformation}),t.jsxs("div",{className:"flex flex-wrap gap-4","data-testid":"event-details-info",children:[n&&t.jsx(ft,{icon:"solar:calendar-minimalistic-linear",testId:"event-details-date",children:n}),r&&t.jsx(ft,{icon:"solar:clock-circle-linear",testId:"event-details-time",children:r}),i&&t.jsx(ft,{icon:"solar:map-point-linear",testId:"event-details-location",children:i})]}),l&&t.jsxs("div",{className:"relative","data-testid":"event-details-description-wrapper",children:[t.jsxs("div",{className:"relative",children:[t.jsx("div",{ref:w,className:c.cn("text-sm text-gray-700 leading-relaxed transition-all",!x&&"line-clamp-3"),"data-testid":"event-details-description",dangerouslySetInnerHTML:{__html:l}}),!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(B,{onPress:()=>g(!x),variant:"light",className:c.cn("text-primary",m),size:"md",startContent:t.jsx(P,{icon:x?"solar:eye-closed-linear":"solar:eye-linear",width:20}),"data-testid":"event-details-toggle-description",children:x?h.showLess||"Hide":h.showMore||"Show"})})]})]})]})})}):t.jsxs(c.Card,{className:c.cn("border-0 shadow-none",e),"data-testid":"event-details-root",children:[t.jsxs(c.CardHeader,{className:c.cn("pt-2 pb-0 flex-col items-start",d?"space-y-1":"space-y-2"),"data-testid":"event-details-header",children:[o&&a&&t.jsx("div",{className:c.cn("w-full overflow-hidden rounded-xl","aspect-[3/1]"),"data-testid":"event-details-image-wrapper",children:t.jsx(c.Image,{removeWrapper:!0,loading:f,alt:`Event image for ${s}`,className:"w-full h-full object-cover object-center",src:a,"data-testid":"event-details-image"})}),t.jsx("h2",{className:c.cn("font-semibold text-gray-800",d?"text-base":"text-xl"),"data-testid":"event-details-title",children:s})]}),t.jsxs(c.CardBody,{className:c.cn("space-y-3",d?"py-1 space-y-2":"py-3"),"data-testid":"event-details-body",children:[t.jsx("h3",{className:c.cn("font-semibold text-base text-gray-700",d?"text-sm":""),"data-testid":"event-details-info-label",children:h.eventInformation}),t.jsxs("div",{className:"flex flex-wrap gap-4","data-testid":"event-details-info",children:[n&&t.jsx(ft,{icon:"solar:calendar-minimalistic-linear",testId:"event-details-date",children:n}),r&&t.jsx(ft,{icon:"solar:clock-circle-linear",testId:"event-details-time",children:r}),i&&t.jsx(ft,{icon:"solar:map-point-linear",testId:"event-details-location",children:i})]}),l&&t.jsxs("div",{className:"relative","data-testid":"event-details-description-wrapper",children:[t.jsxs("div",{className:"relative",children:[t.jsx("div",{ref:w,className:c.cn("text-sm text-gray-700 leading-relaxed transition-all",d?"text-xs":"",!x&&"line-clamp-3"),"data-testid":"event-details-description",dangerouslySetInnerHTML:{__html:l}}),!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(B,{onPress:()=>g(!x),variant:"light",className:c.cn("text-primary",m),size:d?"sm":"md",startContent:t.jsx(P,{icon:x?"solar:eye-closed-linear":"solar:eye-linear",width:d?16:20}),"data-testid":"event-details-toggle-description",children:x?h.showLess||"Hide":h.showMore||"Show"})})]})]})]})};function Ws(e,s="en-US",a="USD"){try{return new Intl.NumberFormat(s,{style:"currency",currency:a,minimumFractionDigits:2,maximumFractionDigits:2}).format(e)}catch(n){return console.warn(`Invalid currency formatting: ${n}`),`${a} ${e.toFixed(2)}`}}function Ad(e){const s=e.replace(/[^\d.,-]/g,""),a=s.match(/,\d{1,2}$/);let n;a?n=s.replace(/\./g,"").replace(",","."):n=s.replace(/,/g,"");const r=parseFloat(n);return isNaN(r)?null:r}const Dd={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"},xt=e=>typeof e=="number"&&!isNaN(e),es=({offer:e,quantity:s,defaultQuantity:a=0,onQuantityChange:n,currency:r="USD",locale:i="en-US",labels:l,slots:o,isDisabled:d=!1,buttonVariant:u="bordered",buttonColor:f="default",showCard:m=!0,showDescription:h=!0,showPeopleCount:x=!0,showPrice:g=!0,priceDisplay:j,classNames:b={},"data-testid":w,selectedColor:N="default",selectionMode:D="stepper",compact:v=!1,isSoldOut:S,isMaxReached:M,isRuleBlocked:k,statusTone:F="default",statusLabel:C,disabledReason:_,disabled:E})=>{const A=p.useMemo(()=>({...Dd,...l}),[l]),[R,O]=p.useState(a),V=s!==void 0?s:R,q=!!(d||E),I=v||!!e.compact,J=D==="press-to-add",W=p.useMemo(()=>typeof S=="boolean"?S:typeof e.isSoldOut=="boolean"?e.isSoldOut:!xt(e.totalTicketsSold)||!xt(e.ticketsAllowed)?!1:e.totalTicketsSold>=e.ticketsAllowed,[S,e.isSoldOut,e.totalTicketsSold,e.ticketsAllowed]),se=p.useMemo(()=>typeof M=="boolean"?M:typeof e.isMaxReached=="boolean"?e.isMaxReached:W||!xt(e.ticketsAllowed)?!1:V>=e.ticketsAllowed-(e.totalTicketsSold??0),[M,e.isMaxReached,W,e.ticketsAllowed,e.totalTicketsSold,V]),Y=p.useMemo(()=>typeof k=="boolean"?k:typeof e.isRuleBlocked=="boolean"?e.isRuleBlocked:!1,[k,e.isRuleBlocked]),Z=_||e.disabledReason,Q=q||W||Y,ee=le=>{if(Q||le>0&&se)return;const ye=Math.max(0,V+le);s===void 0&&O(ye),n?.(e.id,ye)},ne=p.useMemo(()=>{if(W)return"soldOut";if(Y)return"ruleBlocked";if(q)return"disabled"},[W,Y,q]),X=p.useMemo(()=>F||(W||Y?"danger":se?"warning":"default"),[F,W,Y,se]),de=p.useMemo(()=>{if(ne)return ne==="ruleBlocked"?C||Z||A.ruleBlocked:ne==="soldOut"?C||Z||A.soldOut:ne==="disabled"?C||Z||A.disabled:C||A.maxReached},[ne,C,Z,A]),ae={soldOut:"danger",ruleBlocked:X,disabled:"default",maxReached:"warning"},Ie={soldOut:"offer-card-sold-out-chip",maxReached:"offer-card-max-reached-chip",ruleBlocked:"offer-card-ruleBlocked-chip",disabled:"offer-card-disabled-chip"},Ee=()=>o?.renderName?o.renderName(e.name,e):t.jsx("h2",{"data-testid":"offer-card-name",className:c.cn("text-base font-medium",I&&"text-sm",b.name),children:e.name}),Le=()=>{if(!g)return null;const le=j?.price??e.price,ye=j?.originalPrice,Ye=Ws(le,i,r);if(o?.renderPrice)return o.renderPrice(le,Ye,e);if(xt(ye)&&xt(le)&&ye>le){const $=Ws(ye,i,r);return t.jsxs("div",{"data-testid":"offer-card-price",className:c.cn("flex items-center gap-2 mt-1",I&&"mt-0.5",b.price),children:[t.jsxs("span",{className:"sr-only",children:["Original price ",$,", discounted price ",Ye]}),t.jsx("span",{"aria-hidden":"true","data-testid":"offer-card-original-price",className:c.cn("text-gray-400 line-through text-sm",I&&"text-xs",b.originalPrice),children:$}),t.jsx("span",{"aria-hidden":"true","data-testid":"offer-card-discounted-price",className:c.cn("text-primary text-base font-semibold",I&&"text-sm",b.discountedPrice),children:Ye})]})}return t.jsx("p",{"data-testid":"offer-card-price",className:c.cn("text-primary text-base mt-1",I&&"text-sm mt-0.5",b.price),children:Ye})},mt=()=>!h||!e.description?null:o?.renderDescription?o.renderDescription(e.description,e):t.jsx("p",{"data-testid":"offer-card-description",className:c.cn("mb-4 text-sm text-gray-700 leading-relaxed",I&&"mb-2 text-xs text-gray-600",b.description),children:e.description}),Ge=()=>{if(!x||!xt(e.numberOfPeople)||e.numberOfPeople<=0)return null;const le=e.numberOfPeople===1?A.person:A.people;return o?.renderPeopleCount?o.renderPeopleCount(e.numberOfPeople,le,e):t.jsxs("p",{"data-testid":"offer-card-people-count",className:c.cn("text-sm text-gray-600 flex items-center mt-2",I&&"mt-1 text-xs",b.peopleCount),children:[t.jsx(P,{icon:e.numberOfPeople<=1?"solar:user-rounded-outline":"solar:users-group-rounded-outline",width:20,className:"mr-1"}),e.numberOfPeople," ",le]})},We=()=>{const le=V===0||Q,ye=se||Q;return o?.renderQuantitySelector?o.renderQuantitySelector({quantity:V,onIncrement:()=>ee(1),onDecrement:()=>ee(-1),isDecrementDisabled:le,isIncrementDisabled:ye,isDisabled:Q}):t.jsxs("div",{className:c.cn("flex items-center gap-2",b.quantitySelector),children:[t.jsx(B,{"data-testid":"offer-card-decrement-button",onPress:()=>ee(-1),isDisabled:le,variant:u,color:V>0?N:f,radius:"full",isIconOnly:!0,size:I?"md":"sm","aria-label":"Decrease quantity",children:t.jsx(P,{icon:"gravity-ui:minus",width:16})}),t.jsx("span",{"data-testid":"offer-card-quantity",className:c.cn("min-w-[2rem] text-center font-medium",I&&"text-sm"),children:V}),t.jsx(B,{"data-testid":"offer-card-increment-button",onPress:()=>ee(1),isDisabled:ye,variant:u,color:V>0?N:f,radius:"full",isIconOnly:!0,size:I?"md":"sm","aria-label":"Increase quantity",children:t.jsx(P,{icon:"gravity-ui:plus",width:16})})]})},rt=(le,ye)=>o?.renderDisabledState?o.renderDisabledState(le,ye):le==="soldOut"&&o?.renderSoldOut?o.renderSoldOut(ye):le==="maxReached"&&o?.renderMaxReachedAlert?o.renderMaxReachedAlert(ye):t.jsx(c.Chip,{"data-testid":Ie[le],color:ae[le],variant:le==="maxReached"?"flat":"solid",className:c.cn("gap-2 px-4",le==="maxReached"?"h-8":"h-10",le==="soldOut"&&b.soldOut,le==="maxReached"&&b.maxReachedAlert,I&&"h-8"),startContent:t.jsx(P,{icon:"gravity-ui:triangle-exclamation-fill",width:14}),children:t.jsx("span",{className:"font-medium text-sm",children:ye})}),Je=t.jsxs("div",{className:c.cn("grid grid-cols-1 md:grid-cols-1 xl:grid-cols-3 lg:grid-cols-3 items-start",I?"gap-1":"gap-2"),children:[t.jsxs("div",{className:c.cn("h-full col-span-2",Q||se?"opacity-50 pointer-events-none select-none":""),children:[Ee(),Le(),t.jsxs("div",{className:c.cn("md:col-span-1 xl:col-span-2 lg:col-span-1",I?"mb-1":"mb-2"),children:[Ge(),mt()]})]}),!J&&t.jsx("div",{className:c.cn("space-x-2 pt-0 pb-2 md:p-2 h-full flex items-center justify-start md:justify-start lg:justify-end",I&&"space-x-1 pb-1 md:p-1",b.compactFooter),children:ne&&de?rt(ne,de):We()})]}),Pe=se&&!W&&!Y&&!q?t.jsx(De.motion.div,{className:c.cn("w-full sm:max-w-[60%] md:max-w-[60%] lg:max-w-[60%]",b.compactFooter),initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:10},transition:{duration:.3},children:rt("maxReached",de||A.maxReached)}):null;return m?t.jsxs(c.Card,{className:c.cn("w-full",J&&!Q&&!se&&"cursor-pointer",I&&b.compact,b.base),"data-testid":w||`offer-card-${e.id}`,isPressable:J&&!Q&&!se,onPress:J&&!Q&&!se?()=>ee(1):void 0,children:[t.jsx(c.CardBody,{className:c.cn("pt-1 pb-0",I?"pb-0.5":"",b.body),children:Je}),t.jsx(De.AnimatePresence,{children:Pe&&t.jsx(c.CardFooter,{className:c.cn("w-full mt-0 pt-0",I?"pt-1":"",b.footer),children:Pe})})]}):t.jsxs("div",{className:c.cn("w-full",I&&b.compact,b.base),"data-testid":w||`offer-card-${e.id}`,children:[t.jsx("div",{className:c.cn("pt-1 pb-0",I?"pb-0.5":"",b.body),children:Je}),t.jsx(De.AnimatePresence,{children:Pe&&t.jsx("div",{className:c.cn("w-full mt-0 pt-0",I?"pt-1":"",b.footer),children:Pe})})]})};es.displayName="OfferCard";const Fr=({message:e="No offers available.",icon:s="solar:ticket-sale-outline",iconSize:a=48,showCard:n=!0,classNames:r={},renderEmpty:i})=>{if(i){const o=i();return n?t.jsx(c.Card,{"data-testid":"offer-card-empty",className:c.cn("w-full",r.base),children:t.jsx(c.CardBody,{"data-testid":"offer-card-empty-body",children:o})}):t.jsx("div",{"data-testid":"offer-card-empty",className:c.cn("w-full",r.base),children:o})}const l=t.jsxs("div",{"data-testid":"offer-card-empty-content",className:c.cn("flex flex-col items-center justify-center p-8 text-center text-gray-500",r.content),children:[t.jsx(P,{"data-testid":"offer-card-empty-icon",icon:s,width:a,className:c.cn("mb-4",r.icon)}),t.jsx("h3",{"data-testid":"offer-card-empty-message",className:c.cn("text-lg",r.message),children:e})]});return n?t.jsx(c.Card,{"data-testid":"offer-card-empty",className:c.cn("w-full",r.base),children:t.jsx(c.CardBody,{"data-testid":"offer-card-empty-body",children:l})}):t.jsx("div",{"data-testid":"offer-card-empty",className:c.cn("w-full",r.base),children:l})};Fr.displayName="OfferCardEmpty";const Ed={title:"Error Fetching Offers",description:"An error occurred while fetching offers."},Lr=({error:e,labels:s,showCard:a=!0,color:n="danger",classNames:r={}})=>{const i={...Ed,...s},l=t.jsx(c.Alert,{"data-testid":"offer-card-error-alert",color:n,title:i.title,description:e||i.description,className:r.alert});return a?t.jsx(c.Card,{"data-testid":"offer-card-error",className:c.cn("w-full",r.base),children:t.jsx(c.CardBody,{"data-testid":"offer-card-error-body",children:l})}):t.jsx("div",{"data-testid":"offer-card-error",className:c.cn("w-full",r.base),children:l})};Lr.displayName="OfferCardError";const Fd={1:"space-y-1",2:"space-y-2",3:"space-y-3",4:"space-y-4",5:"space-y-5",6:"space-y-6"},Mr=({quantity:e=2,gap:s=4,classNames:a={}})=>{const n=Fd[s];return t.jsx("div",{"data-testid":"offer-card-skeleton-container",className:c.cn(n,a.base),children:Array.from({length:e}).map((r,i)=>t.jsxs(c.Card,{"data-testid":`offer-card-skeleton-${i}`,className:c.cn("w-full",a.card),children:[t.jsx(c.CardHeader,{"data-testid":`offer-card-skeleton-header-${i}`,className:"flex justify-between items-start pb-0",children:t.jsxs("div",{className:"space-y-2 w-full",children:[t.jsx(c.Skeleton,{"data-testid":`offer-card-skeleton-title-${i}`,className:"w-1/3 rounded-lg",children:t.jsx("div",{className:"h-4 bg-default-200 rounded-lg"})}),t.jsx(c.Skeleton,{"data-testid":`offer-card-skeleton-subtitle-${i}`,className:"w-1/4 rounded-lg",children:t.jsx("div",{className:"h-3 bg-default-300 rounded-lg"})})]})}),t.jsx(c.CardBody,{"data-testid":`offer-card-skeleton-body-${i}`,className:"pt-2 pb-0",children:t.jsxs("div",{className:"grid grid-cols-1 xl:grid-cols-3 gap-2 items-start",children:[t.jsxs("div",{className:"xl:col-span-2 space-y-2",children:[t.jsx(c.Skeleton,{"data-testid":`offer-card-skeleton-people-${i}`,className:"w-1/4 rounded-lg",children:t.jsx("div",{className:"h-4 bg-default-300 rounded-lg"})}),t.jsx(c.Skeleton,{"data-testid":`offer-card-skeleton-description-${i}`,className:"w-3/4 rounded-lg",children:t.jsx("div",{className:"h-4 bg-default-200 rounded-lg"})})]}),t.jsx("div",{className:"flex items-start justify-end",children:t.jsxs("div",{"data-testid":`offer-card-skeleton-controls-${i}`,className:"flex items-center justify-end gap-2 w-full px-4 py-2",children:[t.jsx(c.Skeleton,{"data-testid":`offer-card-skeleton-label-${i}`,className:"w-24 h-4 rounded-md bg-default-200"}),t.jsxs("div",{className:"flex gap-2",children:[t.jsx(c.Skeleton,{"data-testid":`offer-card-skeleton-btn-dec-${i}`,className:"w-8 h-8 rounded-md bg-default-300"}),t.jsx(c.Skeleton,{"data-testid":`offer-card-skeleton-btn-qty-${i}`,className:"w-8 h-8 rounded-md bg-default-200"}),t.jsx(c.Skeleton,{"data-testid":`offer-card-skeleton-btn-inc-${i}`,className:"w-8 h-8 rounded-md bg-default-300"})]})]})})]})})]},i))})};Mr.displayName="OfferCardSkeleton";const _r={hidden:{opacity:0},show:{opacity:1,transition:{staggerChildren:.15,delayChildren:.1}}},Rr={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"}}},Ld={1:"gap-1",2:"gap-2",3:"gap-3",4:"gap-4",5:"gap-5",6:"gap-6"},Tr=({offers:e=[],mapOffer:s,selection:a,defaultSelection:n={},onSelectionChange:r,onQuantityChange:i,currency:l="USD",locale:o="en-US",labels:d,slots:u,isDisabled:f=!1,buttonVariant:m="bordered",buttonColor:h="default",showCard:x=!0,animated:g=!0,gap:j=2,compact:b=!1,classNames:w={}})=>{const[N,D]=p.useState(n),v=a!==void 0?a:N,S=p.useCallback((E,A)=>{const R={...v,[E]:Math.max(0,A)};a===void 0&&D(R),r?.(R),i?.(E,R[E])},[v,a,r,i]),M=[...e].sort((E,A)=>(E.position??0)-(A.position??0)),k=E=>{const A=s?s(E):E,R=(v??{})[A.id]||0;return{offer:A,quantity:R,onQuantityChange:S,currency:l,locale:o,labels:d,slots:u,isDisabled:f,buttonVariant:m,buttonColor:h,showCard:x,compact:b}},F=Ld[j],C=c.cn("grid mx-auto pt-2",F,w.base),_=E=>{const A=k(E);return t.jsx(es,{offer:A.offer,quantity:A.quantity,onQuantityChange:A.onQuantityChange,currency:A.currency,locale:A.locale,labels:A.labels,slots:A.slots,isDisabled:A.isDisabled,buttonVariant:A.buttonVariant,buttonColor:A.buttonColor,showCard:A.showCard,compact:A.compact,classNames:w.card},A.offer.id)};return g?t.jsx(De.motion.div,{"data-testid":"offer-card-list",className:C,variants:_r,initial:"hidden",animate:"show",children:t.jsx(De.AnimatePresence,{children:M.map(E=>{const A=k(E);return t.jsx(De.motion.div,{"data-testid":`offer-card-list-item-${A.offer.id}`,className:w.cardWrapper,variants:Rr,exit:{opacity:0,y:-20},transition:{duration:.3},children:t.jsx(es,{offer:A.offer,quantity:A.quantity,onQuantityChange:S,currency:l,locale:o,labels:d,slots:u,isDisabled:f,buttonVariant:m,buttonColor:h,showCard:x,compact:b||A.offer.compact,classNames:w.card})},A.offer.id)})})}):t.jsx("div",{"data-testid":"offer-card-list",className:C,children:M.map(_)})};Tr.displayName="OfferCardList";var Tt=e=>e.type==="checkbox",ct=e=>e instanceof Date,Fe=e=>e==null;const Ir=e=>typeof e=="object";var be=e=>!Fe(e)&&!Array.isArray(e)&&Ir(e)&&!ct(e),Pr=e=>be(e)&&e.target?Tt(e.target)?e.target.checked:e.target.value:e,Md=e=>e.substring(0,e.search(/\.\d+(\.|$)/))||e,Or=(e,s)=>e.has(Md(s)),_d=e=>{const s=e.constructor&&e.constructor.prototype;return be(s)&&s.hasOwnProperty("isPrototypeOf")},ma=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function he(e){if(e instanceof Date)return new Date(e);const s=typeof FileList<"u"&&e instanceof FileList;if(ma&&(e instanceof Blob||s))return e;const a=Array.isArray(e);if(!a&&!(be(e)&&_d(e)))return e;const n=a?[]:Object.create(Object.getPrototypeOf(e));for(const r in e)Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=he(e[r]));return n}var us=e=>/^\w*$/.test(e),me=e=>e===void 0,fa=e=>Array.isArray(e)?e.filter(Boolean):[],xa=e=>fa(e.replace(/["|']|\]/g,"").split(/\.|\[/)),H=(e,s,a)=>{if(!s||!be(e))return a;const n=(us(s)?[s]:xa(s)).reduce((r,i)=>Fe(r)?r:r[i],e);return me(n)||n===e?me(e[s])?a:e[s]:n},Re=e=>typeof e=="boolean",Ae=e=>typeof e=="function",ce=(e,s,a)=>{let n=-1;const r=us(s)?[s]:xa(s),i=r.length,l=i-1;for(;++n<i;){const o=r[n];let d=a;if(n!==l){const u=e[o];d=be(u)||Array.isArray(u)?u:isNaN(+r[n+1])?{}:[]}if(o==="__proto__"||o==="constructor"||o==="prototype")return;e[o]=d,e=e[o]}};const ts={BLUR:"blur",FOCUS_OUT:"focusout",CHANGE:"change"},Ve={onBlur:"onBlur",onChange:"onChange",onSubmit:"onSubmit",onTouched:"onTouched",all:"all"},Ke={max:"max",min:"min",maxLength:"maxLength",minLength:"minLength",pattern:"pattern",required:"required",validate:"validate"},zr=p.createContext(null);zr.displayName="HookFormControlContext";const ha=()=>p.useContext(zr);var Br=(e,s,a,n=!0)=>{const r={defaultValues:s._defaultValues};for(const i in e)Object.defineProperty(r,i,{get:()=>{const l=i;return s._proxyFormState[l]!==Ve.all&&(s._proxyFormState[l]=!n||Ve.all),a&&(a[l]=!0),e[l]}});return r};const pa=typeof window<"u"?p.useLayoutEffect:p.useEffect;function Rd(e){const s=ha(),{control:a=s,disabled:n,name:r,exact:i}=e||{},[l,o]=p.useState(a._formState),d=p.useRef({isDirty:!1,isLoading:!1,dirtyFields:!1,touchedFields:!1,validatingFields:!1,isValidating:!1,isValid:!1,errors:!1});return pa(()=>a._subscribe({name:r,formState:d.current,exact:i,callback:u=>{!n&&o({...a._formState,...u})}}),[r,n,i]),p.useEffect(()=>{d.current.isValid&&a._setValid(!0)},[a]),p.useMemo(()=>Br(l,a,d.current,!1),[l,a])}var Te=e=>typeof e=="string",Ys=(e,s,a,n,r)=>Te(e)?(n&&s.watch.add(e),H(a,e,r)):Array.isArray(e)?e.map(i=>(n&&s.watch.add(i),H(a,i))):(n&&(s.watchAll=!0),a),Gs=e=>Fe(e)||!Ir(e);function Ue(e,s,a=new WeakSet){if(Gs(e)||Gs(s))return Object.is(e,s);if(ct(e)&&ct(s))return Object.is(e.getTime(),s.getTime());const n=Object.keys(e),r=Object.keys(s);if(n.length!==r.length)return!1;if(a.has(e)||a.has(s))return!0;a.add(e),a.add(s);for(const i of n){const l=e[i];if(!r.includes(i))return!1;if(i!=="ref"){const o=s[i];if(ct(l)&&ct(o)||be(l)&&be(o)||Array.isArray(l)&&Array.isArray(o)?!Ue(l,o,a):!Object.is(l,o))return!1}}return!0}function Td(e){const s=ha(),{control:a=s,name:n,defaultValue:r,disabled:i,exact:l,compute:o}=e||{},d=p.useRef(r),u=p.useRef(o),f=p.useRef(void 0),m=p.useRef(a),h=p.useRef(n);u.current=o;const[x,g]=p.useState(()=>{const v=a._getWatch(n,d.current);return u.current?u.current(v):v}),j=p.useCallback(v=>{const S=Ys(n,a._names,v||a._formValues,!1,d.current);return u.current?u.current(S):S},[a._formValues,a._names,n]),b=p.useCallback(v=>{if(!i){const S=Ys(n,a._names,v||a._formValues,!1,d.current);if(u.current){const M=u.current(S);Ue(M,f.current)||(g(M),f.current=M)}else g(S)}},[a._formValues,a._names,i,n]);pa(()=>((m.current!==a||!Ue(h.current,n))&&(m.current=a,h.current=n,b()),a._subscribe({name:n,formState:{values:!0},exact:l,callback:v=>{b(v.values)}})),[a,l,n,b]),p.useEffect(()=>a._removeUnmounted());const w=m.current!==a,N=h.current,D=p.useMemo(()=>{if(i)return null;const v=!w&&!Ue(N,n);return w||v?j():null},[i,w,n,N,j]);return D!==null?D:x}function Id(e){const s=ha(),{name:a,disabled:n,control:r=s,shouldUnregister:i,defaultValue:l,exact:o=!0}=e,d=Or(r._names.array,a),u=p.useMemo(()=>H(r._formValues,a,H(r._defaultValues,a,l)),[r,a,l]),f=Td({control:r,name:a,defaultValue:u,exact:o}),m=Rd({control:r,name:a,exact:o}),h=p.useRef(e),x=p.useRef(void 0),g=p.useRef(r.register(a,{...e.rules,value:f,...Re(e.disabled)?{disabled:e.disabled}:{}}));h.current=e;const j=p.useMemo(()=>Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!H(m.errors,a)},isDirty:{enumerable:!0,get:()=>!!H(m.dirtyFields,a)},isTouched:{enumerable:!0,get:()=>!!H(m.touchedFields,a)},isValidating:{enumerable:!0,get:()=>!!H(m.validatingFields,a)},error:{enumerable:!0,get:()=>H(m.errors,a)}}),[m,a]),b=p.useCallback(v=>g.current.onChange({target:{value:Pr(v),name:a},type:ts.CHANGE}),[a]),w=p.useCallback(()=>g.current.onBlur({target:{value:H(r._formValues,a),name:a},type:ts.BLUR}),[a,r._formValues]),N=p.useCallback(v=>{const S=H(r._fields,a);S&&S._f&&v&&(S._f.ref={focus:()=>Ae(v.focus)&&v.focus(),select:()=>Ae(v.select)&&v.select(),setCustomValidity:M=>Ae(v.setCustomValidity)&&v.setCustomValidity(M),reportValidity:()=>Ae(v.reportValidity)&&v.reportValidity()})},[r._fields,a]),D=p.useMemo(()=>({name:a,value:f,...Re(n)||m.disabled?{disabled:m.disabled||n}:{},onChange:b,onBlur:w,ref:N}),[a,n,m.disabled,b,w,N,f]);return p.useEffect(()=>{const v=r._options.shouldUnregister||i,S=x.current;S&&S!==a&&!d&&r.unregister(S),r.register(a,{...h.current.rules,...Re(h.current.disabled)?{disabled:h.current.disabled}:{}});const M=(k,F)=>{const C=H(r._fields,k);C&&C._f&&(C._f.mount=F)};if(M(a,!0),v){const k=he(H(r._options.defaultValues,a,h.current.defaultValue));ce(r._defaultValues,a,k),me(H(r._formValues,a))&&ce(r._formValues,a,k)}return!d&&r.register(a),x.current=a,()=>{(d?v&&!r._state.action:v)?r.unregister(a):M(a,!1)}},[a,r,d,i]),p.useEffect(()=>{r._setDisabledField({disabled:n,name:a})},[n,a,r]),p.useMemo(()=>({field:D,formState:m,fieldState:j}),[D,m,j])}const Pd=p.createContext(null);Pd.displayName="HookFormContext";var Od=(e,s,a,n,r)=>s?{...a[e],types:{...a[e]&&a[e].types?a[e].types:{},[n]:r||!0}}:{},Et=e=>Array.isArray(e)?e:[e],on=()=>{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 Vr(e,s){const a={};for(const n in e)if(e.hasOwnProperty(n)){const r=e[n],i=s[n];if(r&&be(r)&&i){const l=Vr(r,i);be(l)&&(a[n]=l)}else e[n]&&(a[n]=i)}return a}var Se=e=>be(e)&&!Object.keys(e).length,ga=e=>e.type==="file",ss=e=>{if(!ma)return!1;const s=e?e.ownerDocument:0;return e instanceof(s&&s.defaultView?s.defaultView.HTMLElement:HTMLElement)},Ur=e=>e.type==="select-multiple",ba=e=>e.type==="radio",zd=e=>ba(e)||Tt(e),ks=e=>ss(e)&&e.isConnected;function Bd(e,s){const a=s.slice(0,-1).length;let n=0;for(;n<a;)e=me(e)?n++:e[s[n++]];return e}function Vd(e){for(const s in e)if(e.hasOwnProperty(s)&&!me(e[s]))return!1;return!0}function pe(e,s){const a=Array.isArray(s)?s:us(s)?[s]:xa(s),n=a.length===1?e:Bd(e,a),r=a.length-1,i=a[r];return n&&delete n[i],r!==0&&(be(n)&&Se(n)||Array.isArray(n)&&Vd(n))&&pe(e,a.slice(0,-1)),e}var Ud=e=>{for(const s in e)if(Ae(e[s]))return!0;return!1};function Hr(e){return Array.isArray(e)||be(e)&&!Ud(e)}function Ks(e,s={}){for(const a in e){const n=e[a];Hr(n)?(s[a]=Array.isArray(n)?[]:{},Ks(n,s[a])):me(n)||(s[a]=!0)}return s}function gt(e,s,a){a||(a=Ks(s));for(const n in e){const r=e[n];if(Hr(r))me(s)||Gs(a[n])?a[n]=Ks(r,Array.isArray(r)?[]:{}):gt(r,Fe(s)?{}:s[n],a[n]);else{const i=s[n];a[n]=!Ue(r,i)}}return a}const cn={value:!1,isValid:!1},dn={value:!0,isValid:!0};var qr=e=>{if(Array.isArray(e)){if(e.length>1){const s=e.filter(a=>a&&a.checked&&!a.disabled).map(a=>a.value);return{value:s,isValid:!!s.length}}return e[0].checked&&!e[0].disabled?e[0].attributes&&!me(e[0].attributes.value)?me(e[0].value)||e[0].value===""?dn:{value:e[0].value,isValid:!0}:dn:cn}return cn},Wr=(e,{valueAsNumber:s,valueAsDate:a,setValueAs:n})=>me(e)?e:s?e===""?NaN:e&&+e:a&&Te(e)?new Date(e):n?n(e):e;const un={isValid:!1,value:null};var Yr=e=>Array.isArray(e)?e.reduce((s,a)=>a&&a.checked&&!a.disabled?{isValid:!0,value:a.value}:s,un):un;function mn(e){const s=e.ref;return ga(s)?s.files:ba(s)?Yr(e.refs).value:Ur(s)?[...s.selectedOptions].map(({value:a})=>a):Tt(s)?qr(e.refs).value:Wr(me(s.value)?e.ref.value:s.value,e)}var Hd=(e,s,a,n)=>{const r={};for(const i of e){const l=H(s,i);l&&ce(r,i,l._f)}return{criteriaMode:a,names:[...e],fields:r,shouldUseNativeValidation:n}},as=e=>e instanceof RegExp,kt=e=>me(e)?e:as(e)?e.source:be(e)?as(e.value)?e.value.source:e.value:e,fn=e=>({isOnSubmit:!e||e===Ve.onSubmit,isOnBlur:e===Ve.onBlur,isOnChange:e===Ve.onChange,isOnAll:e===Ve.all,isOnTouch:e===Ve.onTouched});const xn="AsyncFunction";var qd=e=>!!e&&!!e.validate&&!!(Ae(e.validate)&&e.validate.constructor.name===xn||be(e.validate)&&Object.values(e.validate).find(s=>s.constructor.name===xn)),Wd=e=>e.mount&&(e.required||e.min||e.max||e.maxLength||e.minLength||e.pattern||e.validate),hn=(e,s,a)=>!a&&(s.watchAll||s.watch.has(e)||[...s.watch].some(n=>e.startsWith(n)&&/^\.\w+/.test(e.slice(n.length))));const Ft=(e,s,a,n)=>{for(const r of a||Object.keys(e)){const i=H(e,r);if(i){const{_f:l,...o}=i;if(l){if(l.refs&&l.refs[0]&&s(l.refs[0],r)&&!n)return!0;if(l.ref&&s(l.ref,l.name)&&!n)return!0;if(Ft(o,s))break}else if(be(o)&&Ft(o,s))break}}};function pn(e,s,a){const n=H(e,a);if(n||us(a))return{error:n,name:a};const r=a.split(".");for(;r.length;){const i=r.join("."),l=H(s,i),o=H(e,i);if(l&&!Array.isArray(l)&&a!==i)return{name:a};if(o&&o.type)return{name:i,error:o};if(o&&o.root&&o.root.type)return{name:`${i}.root`,error:o.root};r.pop()}return{name:a}}var Yd=(e,s,a,n)=>{a(e);const{name:r,...i}=e;return Se(i)||Object.keys(i).length>=Object.keys(s).length||Object.keys(i).find(l=>s[l]===(!n||Ve.all))},Gd=(e,s,a)=>!e||!s||e===s||Et(e).some(n=>n&&(a?n===s:n.startsWith(s)||s.startsWith(n))),Kd=(e,s,a,n,r)=>r.isOnAll?!1:!a&&r.isOnTouch?!(s||e):(a?n.isOnBlur:r.isOnBlur)?!e:(a?n.isOnChange:r.isOnChange)?e:!0,Qd=(e,s)=>!fa(H(e,s)).length&&pe(e,s),Zd=(e,s,a)=>{const n=Et(H(e,a));return ce(n,"root",s[a]),ce(e,a,n),e};function gn(e,s,a="validate"){if(Te(e)||Array.isArray(e)&&e.every(Te)||Re(e)&&!e)return{type:a,message:Te(e)?e:"",ref:s}}var ht=e=>be(e)&&!as(e)?e:{value:e,message:""},bn=async(e,s,a,n,r,i)=>{const{ref:l,refs:o,required:d,maxLength:u,minLength:f,min:m,max:h,pattern:x,validate:g,name:j,valueAsNumber:b,mount:w}=e._f,N=H(a,j);if(!w||s.has(j))return{};const D=o?o[0]:l,v=A=>{r&&D.reportValidity&&(D.setCustomValidity(Re(A)?"":A||""),D.reportValidity())},S={},M=ba(l),k=Tt(l),F=M||k,C=(b||ga(l))&&me(l.value)&&me(N)||ss(l)&&l.value===""||N===""||Array.isArray(N)&&!N.length,_=Od.bind(null,j,n,S),E=(A,R,O,V=Ke.maxLength,q=Ke.minLength)=>{const I=A?R:O;S[j]={type:A?V:q,message:I,ref:l,..._(A?V:q,I)}};if(i?!Array.isArray(N)||!N.length:d&&(!F&&(C||Fe(N))||Re(N)&&!N||k&&!qr(o).isValid||M&&!Yr(o).isValid)){const{value:A,message:R}=Te(d)?{value:!!d,message:d}:ht(d);if(A&&(S[j]={type:Ke.required,message:R,ref:D,..._(Ke.required,R)},!n))return v(R),S}if(!C&&(!Fe(m)||!Fe(h))){let A,R;const O=ht(h),V=ht(m);if(!Fe(N)&&!isNaN(N)){const q=l.valueAsNumber||N&&+N;Fe(O.value)||(A=q>O.value),Fe(V.value)||(R=q<V.value)}else{const q=l.valueAsDate||new Date(N),I=se=>new Date(new Date().toDateString()+" "+se),J=l.type=="time",W=l.type=="week";Te(O.value)&&N&&(A=J?I(N)>I(O.value):W?N>O.value:q>new Date(O.value)),Te(V.value)&&N&&(R=J?I(N)<I(V.value):W?N<V.value:q<new Date(V.value))}if((A||R)&&(E(!!A,O.message,V.message,Ke.max,Ke.min),!n))return v(S[j].message),S}if((u||f)&&!C&&(Te(N)||i&&Array.isArray(N))){const A=ht(u),R=ht(f),O=!Fe(A.value)&&N.length>+A.value,V=!Fe(R.value)&&N.length<+R.value;if((O||V)&&(E(O,A.message,R.message),!n))return v(S[j].message),S}if(x&&!C&&Te(N)){const{value:A,message:R}=ht(x);if(as(A)&&!N.match(A)&&(S[j]={type:Ke.pattern,message:R,ref:l,..._(Ke.pattern,R)},!n))return v(R),S}if(g){if(Ae(g)){const A=await g(N,a),R=gn(A,D);if(R&&(S[j]={...R,..._(Ke.validate,R.message)},!n))return v(R.message),S}else if(be(g)){let A={};for(const R in g){if(!Se(A)&&!n)break;const O=gn(await g[R](N,a),D,R);O&&(A={...O,..._(R,O.message)},v(O.message),n&&(S[j]=A))}if(!Se(A)&&(S[j]={ref:D,...A},!n))return S}}return v(!0),S};const Xd={mode:Ve.onSubmit,reValidateMode:Ve.onChange,shouldFocusError:!0};function Jd(e={}){let s={...Xd,...e},a={submitCount:0,isDirty:!1,isReady:!1,isLoading:Ae(s.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{},errors:s.errors||{},disabled:s.disabled||!1},n={},r=be(s.defaultValues)||be(s.values)?he(s.defaultValues||s.values)||{}:{},i=s.shouldUnregister?{}:he(r),l={action:!1,mount:!1,watch:!1,keepIsValid:!1},o={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 h={...m};const x={array:on(),state:on()},g=s.criteriaMode===Ve.all,j=y=>$=>{clearTimeout(u),u=setTimeout(y,$)},b=async y=>{if(!l.keepIsValid&&!s.disabled&&(m.isValid||h.isValid||y)){let $;s.resolver?($=Se((await F()).errors),w()):$=await _(n,!0),$!==a.isValid&&x.state.next({isValid:$})}},w=(y,$)=>{!s.disabled&&(m.isValidating||m.validatingFields||h.isValidating||h.validatingFields)&&((y||Array.from(o.mount)).forEach(L=>{L&&($?ce(a.validatingFields,L,$):pe(a.validatingFields,L))}),x.state.next({validatingFields:a.validatingFields,isValidating:!Se(a.validatingFields)}))},N=(y,$=[],L,U,z=!0,T=!0)=>{if(U&&L&&!s.disabled){if(l.action=!0,T&&Array.isArray(H(n,y))){const G=L(H(n,y),U.argA,U.argB);z&&ce(n,y,G)}if(T&&Array.isArray(H(a.errors,y))){const G=L(H(a.errors,y),U.argA,U.argB);z&&ce(a.errors,y,G),Qd(a.errors,y)}if((m.touchedFields||h.touchedFields)&&T&&Array.isArray(H(a.touchedFields,y))){const G=L(H(a.touchedFields,y),U.argA,U.argB);z&&ce(a.touchedFields,y,G)}(m.dirtyFields||h.dirtyFields)&&(a.dirtyFields=gt(r,i)),x.state.next({name:y,isDirty:A(y,$),dirtyFields:a.dirtyFields,errors:a.errors,isValid:a.isValid})}else ce(i,y,$)},D=(y,$)=>{ce(a.errors,y,$),x.state.next({errors:a.errors})},v=y=>{a.errors=y,x.state.next({errors:a.errors,isValid:!1})},S=(y,$,L,U)=>{const z=H(n,y);if(z){const T=H(i,y,me(L)?H(r,y):L);me(T)||U&&U.defaultChecked||$?ce(i,y,$?T:mn(z._f)):V(y,T),l.mount&&!l.action&&b()}},M=(y,$,L,U,z)=>{let T=!1,G=!1;const re={name:y};if(!s.disabled){if(!L||U){(m.isDirty||h.isDirty)&&(G=a.isDirty,a.isDirty=re.isDirty=A(),T=G!==re.isDirty);const ie=Ue(H(r,y),$);G=!!H(a.dirtyFields,y),ie?pe(a.dirtyFields,y):ce(a.dirtyFields,y,!0),re.dirtyFields=a.dirtyFields,T=T||(m.dirtyFields||h.dirtyFields)&&G!==!ie}if(L){const ie=H(a.touchedFields,y);ie||(ce(a.touchedFields,y,L),re.touchedFields=a.touchedFields,T=T||(m.touchedFields||h.touchedFields)&&ie!==L)}T&&z&&x.state.next(re)}return T?re:{}},k=(y,$,L,U)=>{const z=H(a.errors,y),T=(m.isValid||h.isValid)&&Re($)&&a.isValid!==$;if(s.delayError&&L?(d=j(()=>D(y,L)),d(s.delayError)):(clearTimeout(u),d=null,L?ce(a.errors,y,L):pe(a.errors,y)),(L?!Ue(z,L):z)||!Se(U)||T){const G={...U,...T&&Re($)?{isValid:$}:{},errors:a.errors,name:y};a={...a,...G},x.state.next(G)}},F=async y=>(w(y,!0),await s.resolver(i,s.context,Hd(y||o.mount,n,s.criteriaMode,s.shouldUseNativeValidation))),C=async y=>{const{errors:$}=await F(y);if(w(y),y)for(const L of y){const U=H($,L);U?ce(a.errors,L,U):pe(a.errors,L)}else a.errors=$;return $},_=async(y,$,L={valid:!0})=>{for(const U in y){const z=y[U];if(z){const{_f:T,...G}=z;if(T){const re=o.array.has(T.name),ie=z._f&&qd(z._f);ie&&m.validatingFields&&w([T.name],!0);const ke=await bn(z,o.disabled,i,g,s.shouldUseNativeValidation&&!$,re);if(ie&&m.validatingFields&&w([T.name]),ke[T.name]&&(L.valid=!1,$||e.shouldUseNativeValidation))break;!$&&(H(ke,T.name)?re?Zd(a.errors,ke,T.name):ce(a.errors,T.name,ke[T.name]):pe(a.errors,T.name))}!Se(G)&&await _(G,$,L)}}return L.valid},E=()=>{for(const y of o.unMount){const $=H(n,y);$&&($._f.refs?$._f.refs.every(L=>!ks(L)):!ks($._f.ref))&&ae(y)}o.unMount=new Set},A=(y,$)=>!s.disabled&&(y&&$&&ce(i,y,$),!Ue(Y(),r)),R=(y,$,L)=>Ys(y,o,{...l.mount?i:me($)?r:Te(y)?{[y]:$}:$},L,$),O=y=>fa(H(l.mount?i:r,y,s.shouldUnregister?H(r,y,[]):[])),V=(y,$,L={})=>{const U=H(n,y);let z=$;if(U){const T=U._f;T&&(!T.disabled&&ce(i,y,Wr($,T)),z=ss(T.ref)&&Fe($)?"":$,Ur(T.ref)?[...T.ref.options].forEach(G=>G.selected=z.includes(G.value)):T.refs?Tt(T.ref)?T.refs.forEach(G=>{(!G.defaultChecked||!G.disabled)&&(Array.isArray(z)?G.checked=!!z.find(re=>re===G.value):G.checked=z===G.value||!!z)}):T.refs.forEach(G=>G.checked=G.value===z):ga(T.ref)?T.ref.value="":(T.ref.value=z,T.ref.type||x.state.next({name:y,values:he(i)})))}(L.shouldDirty||L.shouldTouch)&&M(y,z,L.shouldTouch,L.shouldDirty,!0),L.shouldValidate&&se(y)},q=(y,$,L)=>{for(const U in $){if(!$.hasOwnProperty(U))return;const z=$[U],T=y+"."+U,G=H(n,T);(o.array.has(y)||be(z)||G&&!G._f)&&!ct(z)?q(T,z,L):V(T,z,L)}},I=(y,$,L={})=>{const U=H(n,y),z=o.array.has(y),T=he($);ce(i,y,T),z?(x.array.next({name:y,values:he(i)}),(m.isDirty||m.dirtyFields||h.isDirty||h.dirtyFields)&&L.shouldDirty&&x.state.next({name:y,dirtyFields:gt(r,i),isDirty:A(y,T)})):U&&!U._f&&!Fe(T)?q(y,T,L):V(y,T,L),hn(y,o)?x.state.next({...a,name:y,values:he(i)}):x.state.next({name:l.mount?y:void 0,values:he(i)})},J=async y=>{l.mount=!0;const $=y.target;let L=$.name,U=!0;const z=H(n,L),T=ie=>{U=Number.isNaN(ie)||ct(ie)&&isNaN(ie.getTime())||Ue(ie,H(i,L,ie))},G=fn(s.mode),re=fn(s.reValidateMode);if(z){let ie,ke;const it=$.type?mn(z._f):Pr(y),et=y.type===ts.BLUR||y.type===ts.FOCUS_OUT,Il=!Wd(z._f)&&!s.resolver&&!H(a.errors,L)&&!z._f.deps||Kd(et,H(a.touchedFields,L),a.isSubmitted,re,G),xs=hn(L,o,et);ce(i,L,it),et?(!$||!$.readOnly)&&(z._f.onBlur&&z._f.onBlur(y),d&&d(0)):z._f.onChange&&z._f.onChange(y);const hs=M(L,it,et),Pl=!Se(hs)||xs;if(!et&&x.state.next({name:L,type:y.type,values:he(i)}),Il)return(m.isValid||h.isValid)&&(s.mode==="onBlur"?et&&b():et||b()),Pl&&x.state.next({name:L,...xs?{}:hs});if(!et&&xs&&x.state.next({...a}),s.resolver){const{errors:Ta}=await F([L]);if(w([L]),T(it),U){const Ol=pn(a.errors,n,L),Ia=pn(Ta,n,Ol.name||L);ie=Ia.error,L=Ia.name,ke=Se(Ta)}}else w([L],!0),ie=(await bn(z,o.disabled,i,g,s.shouldUseNativeValidation))[L],w([L]),T(it),U&&(ie?ke=!1:(m.isValid||h.isValid)&&(ke=await _(n,!0)));U&&(z._f.deps&&(!Array.isArray(z._f.deps)||z._f.deps.length>0)&&se(z._f.deps),k(L,ke,ie,hs))}},W=(y,$)=>{if(H(a.errors,$)&&y.focus)return y.focus(),1},se=async(y,$={})=>{let L,U;const z=Et(y);if(s.resolver){const T=await C(me(y)?y:z);L=Se(T),U=y?!z.some(G=>H(T,G)):L}else y?(U=(await Promise.all(z.map(async T=>{const G=H(n,T);return await _(G&&G._f?{[T]:G}:G)}))).every(Boolean),!(!U&&!a.isValid)&&b()):U=L=await _(n);return x.state.next({...!Te(y)||(m.isValid||h.isValid)&&L!==a.isValid?{}:{name:y},...s.resolver||!y?{isValid:L}:{},errors:a.errors}),$.shouldFocus&&!U&&Ft(n,W,y?z:o.mount),U},Y=(y,$)=>{let L={...l.mount?i:r};return $&&(L=Vr($.dirtyFields?a.dirtyFields:a.touchedFields,L)),me(y)?L:Te(y)?H(L,y):y.map(U=>H(L,U))},Z=(y,$)=>({invalid:!!H(($||a).errors,y),isDirty:!!H(($||a).dirtyFields,y),error:H(($||a).errors,y),isValidating:!!H(a.validatingFields,y),isTouched:!!H(($||a).touchedFields,y)}),Q=y=>{y&&Et(y).forEach($=>pe(a.errors,$)),x.state.next({errors:y?a.errors:{}})},ee=(y,$,L)=>{const U=(H(n,y,{_f:{}})._f||{}).ref,z=H(a.errors,y)||{},{ref:T,message:G,type:re,...ie}=z;ce(a.errors,y,{...ie,...$,ref:U}),x.state.next({name:y,errors:a.errors,isValid:!1}),L&&L.shouldFocus&&U&&U.focus&&U.focus()},ne=(y,$)=>Ae(y)?x.state.subscribe({next:L=>"values"in L&&y(R(void 0,$),L)}):R(y,$,!0),X=y=>x.state.subscribe({next:$=>{Gd(y.name,$.name,y.exact)&&Yd($,y.formState||m,le,y.reRenderRoot)&&y.callback({values:{...i},...a,...$,defaultValues:r})}}).unsubscribe,de=y=>(l.mount=!0,h={...h,...y.formState},X({...y,formState:{...f,...y.formState}})),ae=(y,$={})=>{for(const L of y?Et(y):o.mount)o.mount.delete(L),o.array.delete(L),$.keepValue||(pe(n,L),pe(i,L)),!$.keepError&&pe(a.errors,L),!$.keepDirty&&pe(a.dirtyFields,L),!$.keepTouched&&pe(a.touchedFields,L),!$.keepIsValidating&&pe(a.validatingFields,L),!s.shouldUnregister&&!$.keepDefaultValue&&pe(r,L);x.state.next({values:he(i)}),x.state.next({...a,...$.keepDirty?{isDirty:A()}:{}}),!$.keepIsValid&&b()},Ie=({disabled:y,name:$})=>{if(Re(y)&&l.mount||y||o.disabled.has($)){const z=o.disabled.has($)!==!!y;y?o.disabled.add($):o.disabled.delete($),z&&l.mount&&!l.action&&b()}},Ee=(y,$={})=>{let L=H(n,y);const U=Re($.disabled)||Re(s.disabled);return ce(n,y,{...L||{},_f:{...L&&L._f?L._f:{ref:{name:y}},name:y,mount:!0,...$}}),o.mount.add(y),L?Ie({disabled:Re($.disabled)?$.disabled:s.disabled,name:y}):S(y,!0,$.value),{...U?{disabled:$.disabled||s.disabled}:{},...s.progressive?{required:!!$.required,min:kt($.min),max:kt($.max),minLength:kt($.minLength),maxLength:kt($.maxLength),pattern:kt($.pattern)}:{},name:y,onChange:J,onBlur:J,ref:z=>{if(z){Ee(y,$),L=H(n,y);const T=me(z.value)&&z.querySelectorAll&&z.querySelectorAll("input,select,textarea")[0]||z,G=zd(T),re=L._f.refs||[];if(G?re.find(ie=>ie===T):T===L._f.ref)return;ce(n,y,{_f:{...L._f,...G?{refs:[...re.filter(ks),T,...Array.isArray(H(r,y))?[{}]:[]],ref:{type:T.type,name:y}}:{ref:T}}}),S(y,!1,void 0,T)}else L=H(n,y,{}),L._f&&(L._f.mount=!1),(s.shouldUnregister||$.shouldUnregister)&&!(Or(o.array,y)&&l.action)&&o.unMount.add(y)}}},Le=()=>s.shouldFocusError&&Ft(n,W,o.mount),mt=y=>{Re(y)&&(x.state.next({disabled:y}),Ft(n,($,L)=>{const U=H(n,L);U&&($.disabled=U._f.disabled||y,Array.isArray(U._f.refs)&&U._f.refs.forEach(z=>{z.disabled=U._f.disabled||y}))},0,!1))},Ge=(y,$)=>async L=>{let U;L&&(L.preventDefault&&L.preventDefault(),L.persist&&L.persist());let z=he(i);if(x.state.next({isSubmitting:!0}),s.resolver){const{errors:T,values:G}=await F();w(),a.errors=T,z=he(G)}else await _(n);if(o.disabled.size)for(const T of o.disabled)pe(z,T);if(pe(a.errors,"root"),Se(a.errors)){x.state.next({errors:{}});try{await y(z,L)}catch(T){U=T}}else $&&await $({...a.errors},L),Le(),setTimeout(Le);if(x.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:Se(a.errors)&&!U,submitCount:a.submitCount+1,errors:a.errors}),U)throw U},We=(y,$={})=>{H(n,y)&&(me($.defaultValue)?I(y,he(H(r,y))):(I(y,$.defaultValue),ce(r,y,he($.defaultValue))),$.keepTouched||pe(a.touchedFields,y),$.keepDirty||(pe(a.dirtyFields,y),a.isDirty=$.defaultValue?A(y,he(H(r,y))):A()),$.keepError||(pe(a.errors,y),m.isValid&&b()),x.state.next({...a}))},rt=(y,$={})=>{const L=y?he(y):r,U=he(L),z=Se(y),T=z?r:U;if($.keepDefaultValues||(r=L),!$.keepValues){if($.keepDirtyValues){const G=new Set([...o.mount,...Object.keys(gt(r,i))]);for(const re of Array.from(G)){const ie=H(a.dirtyFields,re),ke=H(i,re),it=H(T,re);ie&&!me(ke)?ce(T,re,ke):!ie&&!me(it)&&I(re,it)}}else{if(ma&&me(y))for(const G of o.mount){const re=H(n,G);if(re&&re._f){const ie=Array.isArray(re._f.refs)?re._f.refs[0]:re._f.ref;if(ss(ie)){const ke=ie.closest("form");if(ke){ke.reset();break}}}}if($.keepFieldsRef)for(const G of o.mount)I(G,H(T,G));else n={}}i=s.shouldUnregister?$.keepDefaultValues?he(r):{}:he(T),x.array.next({values:{...T}}),x.state.next({values:{...T}})}o={mount:$.keepDirtyValues?o.mount:new Set,unMount:new Set,array:new Set,disabled:new Set,watch:new Set,watchAll:!1,focus:""},l.mount=!m.isValid||!!$.keepIsValid||!!$.keepDirtyValues||!s.shouldUnregister&&!Se(T),l.watch=!!s.shouldUnregister,l.keepIsValid=!!$.keepIsValid,l.action=!1,$.keepErrors||(a.errors={}),x.state.next({submitCount:$.keepSubmitCount?a.submitCount:0,isDirty:z?!1:$.keepDirty?a.isDirty:!!($.keepDefaultValues&&!Ue(y,r)),isSubmitted:$.keepIsSubmitted?a.isSubmitted:!1,dirtyFields:z?{}:$.keepDirtyValues?$.keepDefaultValues&&i?gt(r,i):a.dirtyFields:$.keepDefaultValues&&y?gt(r,y):$.keepDirty?a.dirtyFields:{},touchedFields:$.keepTouched?a.touchedFields:{},errors:$.keepErrors?a.errors:{},isSubmitSuccessful:$.keepIsSubmitSuccessful?a.isSubmitSuccessful:!1,isSubmitting:!1,defaultValues:r})},Je=(y,$)=>rt(Ae(y)?y(i):y,{...s.resetOptions,...$}),Pe=(y,$={})=>{const L=H(n,y),U=L&&L._f;if(U){const z=U.refs?U.refs[0]:U.ref;z.focus&&setTimeout(()=>{z.focus(),$.shouldSelect&&Ae(z.select)&&z.select()})}},le=y=>{a={...a,...y}},Ye={control:{register:Ee,unregister:ae,getFieldState:Z,handleSubmit:Ge,setError:ee,_subscribe:X,_runSchema:F,_updateIsValidating:w,_focusError:Le,_getWatch:R,_getDirty:A,_setValid:b,_setFieldArray:N,_setDisabledField:Ie,_setErrors:v,_getFieldArray:O,_reset:rt,_resetDefaultValues:()=>Ae(s.defaultValues)&&s.defaultValues().then(y=>{Je(y,s.resetOptions),x.state.next({isLoading:!1})}),_removeUnmounted:E,_disableForm:mt,_subjects:x,_proxyFormState:m,get _fields(){return n},get _formValues(){return i},get _state(){return l},set _state(y){l=y},get _defaultValues(){return r},get _names(){return o},set _names(y){o=y},get _formState(){return a},get _options(){return s},set _options(y){s={...s,...y}}},subscribe:de,trigger:se,register:Ee,handleSubmit:Ge,watch:ne,setValue:I,getValues:Y,reset:Je,resetField:We,clearErrors:Q,unregister:ae,setError:ee,setFocus:Pe,getFieldState:Z};return{...Ye,formControl:Ye}}function eu(e={}){const s=p.useRef(void 0),a=p.useRef(void 0),[n,r]=p.useState({isDirty:!1,isValidating:!1,isLoading:Ae(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:Ae(e.defaultValues)?void 0:e.defaultValues});if(!s.current)if(e.formControl)s.current={...e.formControl,formState:n},e.defaultValues&&!Ae(e.defaultValues)&&e.formControl.reset(e.defaultValues,e.resetOptions);else{const{formControl:l,...o}=Jd(e);s.current={...o,formState:n}}const i=s.current.control;return i._options=e,pa(()=>{const l=i._subscribe({formState:i._proxyFormState,callback:()=>r({...i._formState}),reRenderRoot:!0});return r(o=>({...o,isReady:!0})),i._formState.isReady=!0,l},[i]),p.useEffect(()=>i._disableForm(e.disabled),[i,e.disabled]),p.useEffect(()=>{e.mode&&(i._options.mode=e.mode),e.reValidateMode&&(i._options.reValidateMode=e.reValidateMode)},[i,e.mode,e.reValidateMode]),p.useEffect(()=>{e.errors&&(i._setErrors(e.errors),i._focusError())},[i,e.errors]),p.useEffect(()=>{e.shouldUnregister&&i._subjects.state.next({values:i._getWatch()})},[i,e.shouldUnregister]),p.useEffect(()=>{if(i._proxyFormState.isDirty){const l=i._getDirty();l!==n.isDirty&&i._subjects.state.next({isDirty:l})}},[i,n.isDirty]),p.useEffect(()=>{var l;e.values&&!Ue(e.values,a.current)?(i._reset(e.values,{keepFieldsRef:!0,...i._options.resetOptions}),!((l=i._options.resetOptions)===null||l===void 0)&&l.keepIsValid||i._setValid(),a.current=e.values,r(o=>({...o}))):i._resetDefaultValues()},[i,e.values]),p.useEffect(()=>{i._state.mount||(i._setValid(),i._state.mount=!0),i._state.watch&&(i._state.watch=!1,i._subjects.state.next({...i._formState})),i._removeUnmounted()}),s.current.formState=p.useMemo(()=>Br(n,i),[i,n]),s.current}function tu(e,s=3){return e%1===0?e.toString():e.toFixed(s).replace(/\.?0+$/,"")}function su(e,s="en-US",a="USD"){try{return new Intl.NumberFormat(s,{style:"currency",currency:a,minimumFractionDigits:2,maximumFractionDigits:2}).format(e)}catch(n){return console.warn(`Invalid currency formatting: ${n}`),`${a} ${e.toFixed(2)}`}}function au(e="USD",s="en-US"){try{return new Intl.NumberFormat(s,{style:"currency",currency:e}).formatToParts(0).find(i=>i.type==="currency")?.value??"$"}catch{return"$"}}function nu(e){const s=e.replace(/[^\d.,-]/g,""),a=s.match(/,\d{1,2}$/);let n;a?n=s.replace(/\./g,"").replace(",","."):n=s.replace(/,/g,"");const r=parseFloat(n);return isNaN(r)?null:r}function ru(e,s,a=.001){const n=e-s,r=Math.abs(n)<=a;return{difference:n,isBalanced:r,isUnderAllocated:!r&&n>0,isOverAllocated:!r&&n<0}}function ya(){return`dist-${Date.now()}-${Math.random().toString(36).substr(2,9)}`}ya();const iu={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:"$"},Ss=()=>({id:ya(),amount:0,glAccount:null,isTaxDeductible:!1}),Gr=({distribution:e,defaultDistribution:s,glAccounts:a=[],isLoadingGlAccounts:n=!1,onSearchGlAccounts:r,onDistributionChange:i,onAmountChange:l,onGlAccountChange:o,onTaxDeductibleChange:d,onDelete:u,canDelete:f=!0,canEditTaxDeductible:m=!0,isDisabled:h=!1,labels:x,classNames:g={},"data-testid":j,control:b,name:w,rules:N})=>{const D={...iu,...x},v=b!==void 0&&w!==void 0,S=eu({defaultValues:{_internal:s||Ss()}}),M=Id({control:v?b:S.control,name:v?w:"_internal",rules:v?N:void 0}),[k,F]=p.useState(s||Ss()),C=v?M.field.value??Ss():e??k,_=v&&!!M.fieldState?.error,E=v&&(M.fieldState?.isTouched??!1),A=_||E,R=A&&(!C.amount||C.amount<=0),O=A&&!C.glAccount,[V,q]=p.useState(C.glAccount?.name||""),I=p.useCallback(ee=>{const ne={...C,...ee};v&&M.field.onChange(ne),!v&&e===void 0&&F(ne),i?.(ne)},[C,e,i,v,M]),J=p.useCallback(ee=>{const ne=ee||0;I({amount:ne}),l?.(ne)},[I,l]),W=p.useCallback(ee=>{q(ee),r?.(ee)},[r]),se=p.useCallback(ee=>{if(ee===null){I({glAccount:null}),o?.(null);return}const X=a.find(de=>String(de.id)===String(ee))||null;I({glAccount:X}),o?.(X)},[a,I,o]),Y=p.useCallback(()=>{q(""),I({glAccount:null}),o?.(null)},[I,o]),Z=p.useCallback(ee=>{I({isTaxDeductible:ee}),d?.(ee)},[I,d]),Q=p.useCallback(()=>{u?.()},[u]);return t.jsx(c.Card,{radius:"md",shadow:"sm","data-testid":j||"revenue-distribution-card",className:c.cn(g.base),children:t.jsxs(c.CardBody,{className:c.cn("flex flex-row flex-nowrap items-start gap-4",g.body),children:[t.jsx("div",{className:c.cn("shrink-0",g.amountContainer),children:t.jsx(c.NumberInput,{"data-testid":`${j||"revenue-distribution-card"}-amount-input`,label:t.jsxs("span",{className:"flex items-center gap-1",children:[D.amount,t.jsx(c.Tooltip,{content:D.amountTooltip,children:t.jsx(P,{icon:"solar:info-circle-linear",className:"text-default-400 cursor-help",width:16})})]}),value:C.amount||void 0,onValueChange:J,labelPlacement:"outside",placeholder:D.amountPlaceholder,isWheelDisabled:!0,hideStepper:!0,variant:"bordered",isDisabled:h,isInvalid:R,errorMessage:R?"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:D.currencySymbol})})})}),t.jsx("div",{className:c.cn("grow",g.glAccountContainer),children:t.jsx(c.Autocomplete,{"data-testid":`${j||"revenue-distribution-card"}-gl-account-input`,label:t.jsxs("span",{className:"flex items-center gap-1",children:[D.glAccount,t.jsx(c.Tooltip,{content:D.glAccountTooltip,children:t.jsx(P,{icon:"solar:info-circle-linear",className:"text-default-400 cursor-help",width:16})})]}),isLoading:n,isClearable:!0,labelPlacement:"outside",variant:"bordered",items:a,menuTrigger:"input",inputValue:C.glAccount?.name??V,selectedKey:C.glAccount?.id??null,isDisabled:h,isInvalid:O,errorMessage:O?"GL Account is required":void 0,listboxProps:{emptyContent:n?D.searching:D.noGlAccountsFound},placeholder:D.glAccountPlaceholder,onInputChange:W,onSelectionChange:se,onClear:Y,className:g.glAccountInput,children:ee=>t.jsx(c.AutocompleteItem,{textValue:ee.name,children:t.jsxs("div",{className:"flex flex-col",children:[t.jsx("span",{children:ee.name}),ee.code&&t.jsx("span",{className:"text-xs text-default-400",children:ee.code})]})},ee.id)})}),t.jsx("div",{className:c.cn("shrink-0 pt-6 flex items-center",g.taxDeductibleContainer),children:t.jsx(c.Checkbox,{radius:"full","data-testid":`${j||"revenue-distribution-card"}-tax-deductible`,isSelected:C.isTaxDeductible,onValueChange:Z,isDisabled:h||!m,className:g.taxDeductibleCheckbox,children:D.taxDeductible})}),t.jsx("div",{className:c.cn("shrink-0 pt-6",g.deleteContainer),children:t.jsx(B,{"data-testid":`${j||"revenue-distribution-card"}-delete-button`,size:"sm",color:"danger",variant:"flat",isDisabled:h||!f,onPress:Q,startContent:t.jsx(P,{icon:"solar:trash-bin-trash-linear",width:16}),className:c.cn("text-danger",g.deleteButton),children:D.deleteButton})})]})})};Gr.displayName="RevenueDistributionCard";const Kr=({message:e="No distributions configured",icon:s="solar:document-text-outline",iconSize:a=48,showCard:n=!0,classNames:r={},renderEmpty:i})=>{if(i)return t.jsx(t.Fragment,{children:i()});const l=t.jsxs("div",{className:c.cn("flex flex-col items-center justify-center py-8",r.content),children:[t.jsx(P,{icon:s,width:a,className:c.cn("text-default-300 mb-4",r.icon)}),t.jsx("p",{className:c.cn("text-default-500 text-sm text-center",r.message),children:e})]});return n?t.jsx(c.Card,{radius:"sm",shadow:"sm","data-testid":"revenue-distribution-empty",className:c.cn("w-full",r.base),children:t.jsx(c.CardBody,{children:l})}):t.jsx("div",{"data-testid":"revenue-distribution-empty",className:c.cn("w-full",r.base),children:l})};Kr.displayName="RevenueDistributionEmpty";const lu={title:"Error Loading Distributions",description:"An error occurred while loading the distribution configuration. Please try again."},Qr=({error:e,labels:s,showCard:a=!0,color:n="danger",classNames:r={}})=>{const i={...lu,...s},l=t.jsx(c.Alert,{"data-testid":"revenue-distribution-error-alert",color:n,title:i.title,description:e||i.description,className:r.alert});return a?t.jsx(c.Card,{radius:"sm",shadow:"sm","data-testid":"revenue-distribution-error",className:c.cn("w-full",r.base),children:t.jsx(c.CardBody,{children:l})}):t.jsx("div",{"data-testid":"revenue-distribution-error",className:c.cn("w-full",r.base),children:l})};Qr.displayName="RevenueDistributionError";const Zr=({rows:e=1,showCard:s=!0,classNames:a={}})=>{const n=Array.from({length:e},(i,l)=>l),r=i=>t.jsxs("div",{className:c.cn("flex flex-row flex-nowrap items-end gap-4",a.row),children:[t.jsxs("div",{className:"shrink-0 flex flex-col gap-1",children:[t.jsxs("div",{className:"flex items-center gap-1",children:[t.jsx(c.Skeleton,{className:"h-4 w-14 rounded-md"}),t.jsx(c.Skeleton,{className:"h-4 w-4 rounded-full"})]}),t.jsx(c.Skeleton,{className:"h-10 w-32 rounded-lg"})]}),t.jsxs("div",{className:"grow flex flex-col gap-1",children:[t.jsxs("div",{className:"flex items-center gap-1",children:[t.jsx(c.Skeleton,{className:"h-4 w-20 rounded-md"}),t.jsx(c.Skeleton,{className:"h-4 w-4 rounded-full"})]}),t.jsx(c.Skeleton,{className:"h-10 w-full rounded-lg"})]}),t.jsxs("div",{className:"shrink-0 pb-2 flex items-center gap-2",children:[t.jsx(c.Skeleton,{className:"h-5 w-5 rounded-full"}),t.jsx(c.Skeleton,{className:"h-4 w-24 rounded-md"})]}),t.jsx("div",{className:"shrink-0 pb-2",children:t.jsx(c.Skeleton,{className:"h-8 w-20 rounded-lg"})})]},i);return s?t.jsx("div",{className:c.cn("flex flex-col gap-3",a.base),children:n.map(i=>t.jsx(c.Card,{radius:"md",shadow:"sm","data-testid":`revenue-distribution-skeleton-${i}`,children:t.jsx(c.CardBody,{children:r(i)})},i))}):t.jsx("div",{"data-testid":"revenue-distribution-skeleton",className:c.cn("flex flex-col gap-3",a.base),children:n.map(i=>r(i))})};Zr.displayName="RevenueDistributionSkeleton";function va({isOpen:e,labels:s,icon:a,isConfirming:n=!1,confirmColor:r="danger",iconTone:i="danger",portalContainer:l,shouldBlockScroll:o,classNames:d,onClose:u,onConfirm:f}){return t.jsx(c.Modal,{isOpen:e,size:"md",placement:"center",portalContainer:l,shouldBlockScroll:o,classNames:{...d,base:c.cn("max-w-[440px] rounded-3xl",d?.base),closeButton:c.cn("right-5 top-5 text-zinc-500",d?.closeButton)},onOpenChange:m=>!m&&u(),children:t.jsxs(c.ModalContent,{children:[t.jsxs(c.ModalHeader,{className:"flex flex-col items-start gap-4 px-7 pb-0 pt-7",children:[a&&t.jsx("span",{className:c.cn("flex h-12 w-12 shrink-0 items-center justify-center rounded-full",i==="warning"?"bg-brand/15 text-brand":"bg-danger-100 text-danger-600"),children:a}),t.jsx("span",{className:"text-lg font-semibold leading-6 text-zinc-950",children:s.title})]}),t.jsx(c.ModalBody,{className:"px-7 pb-3 pt-4",children:t.jsx("div",{className:"text-sm leading-6 text-zinc-500",children:s.description})}),t.jsxs(c.ModalFooter,{className:"grid grid-cols-2 gap-3 px-7 pb-7 pt-3",children:[t.jsx(B,{type:"button",size:"md",variant:"bordered",radius:"full",className:"h-10 border-zinc-200 bg-white text-sm font-normal text-zinc-900",onPress:u,children:s.cancel}),t.jsx(B,{type:"button",size:"md",color:r,radius:"full",className:c.cn("h-10 text-sm font-normal text-white",r==="danger"?"bg-danger-600":"bg-brand"),isLoading:n,onPress:f,children:s.confirm})]})]})})}const ou=()=>({id:crypto.randomUUID(),fund:null,percentage:0});function yn(e){return!e.fund&&Number(e.percentage||0)<=0}function cu({mode:e,assignments:s}){const a=s.filter(i=>i.fund),n=a.reduce((i,l)=>i+Number(l.percentage||0),0),r=s.some(i=>!i.fund||Number(i.percentage||0)<=0);return a.length>=1&&!r&&Math.round(n*100)/100===100}const du={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"},Xr={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"},St={...Xr,base:"min-h-11 rounded-2xl px-4 py-2 shadow-none",title:"text-sm font-medium"},uu={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"},mu={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 fu(){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 xu=e=>Number.isFinite(e)?Math.max(0,Math.min(100,Math.round(e*100)/100)):0,hu=e=>e.fund!==null;function pu({assignments:e,funds:s,labels:a,classNames:n,isSaving:r=!1,hasSavedAssignments:i=!1,showSavedIndicator:l=!1,isCollapsed:o,isFundPickerOpen:d=!1,activeAssignmentId:u=null,modalPortalContainer:f,footer:m,onAssignmentsChange:h,onOpenFundPicker:x,onCloseFundPicker:g,onCollapseChange:j,onSave:b}){const[w,N]=p.useState(null),D=f??w??void 0,v={...du,...a},S=e.filter(X=>!yn(X)),k=S.filter(hu).length>0,F=p.useMemo(()=>e.filter(X=>!yn(X)).reduce((X,de)=>X+Number(de.percentage||0),0),[e]),C=Math.round(F*100)/100,_=S.some(X=>!X.fund||Number(X.percentage||0)<=0),E=k&&(C!==100||_),A=`${v.totalError} (${v.total} ${Number(F.toFixed(2))}%)`,R=cu({mode:"split",assignments:e}),O=k&&C>=100,[V,q]=p.useState(!1),[I,J]=p.useState(!1),W=t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(fu,{}),t.jsx("span",{className:"text-base font-medium leading-6 text-zinc-950",children:v.title}),l?t.jsx(c.Chip,{size:"sm",radius:"full",color:"success",variant:"flat",children:v.saved}):null]}),se=(X,de)=>{h(e.map(ae=>ae.id===X?{...ae,...de}:ae))},Y=()=>{O||h([...e,ou()])},Z=X=>{e.length<=1||h(e.filter(de=>de.id!==X))},Q=()=>{if(!r){if(!R){J(!0);return}if(!i){b();return}q(!0)}},ee=()=>{q(!1),b()},ne=X=>{const de=u??e.find(ae=>!ae.fund)?.id??e[0]?.id;de&&(h(e.map(ae=>ae.id===de?{...ae,fund:X}:ae)),g())};return t.jsxs("div",{ref:N,className:c.cn("vvt-pa relative min-w-0 w-full font-sans text-zinc-900 [container-type:inline-size]",d&&!f&&"min-h-[560px]",n?.root),children:[t.jsx(c.Accordion,{variant:"splitted",defaultSelectedKeys:o===void 0?["installment-fund-assignment"]:void 0,selectedKeys:o===void 0?void 0:new Set(o?[]:["installment-fund-assignment"]),className:c.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:c.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:X=>j?.(!(X==="all"||Array.from(X).length>0)),children:t.jsx(c.AccordionItem,{"aria-label":v.title,title:W,children:t.jsxs("div",{className:c.cn("flex w-full flex-col gap-4",n?.content),children:[t.jsxs("div",{className:"flex w-full flex-col gap-4",children:[!k&&t.jsx(c.Alert,{icon:t.jsx(P,{icon:"solar:info-circle-outline",className:"size-4"}),hideIconWrapper:!0,isClosable:!1,classNames:Xr,color:"default",variant:"flat",title:v.emptySplit}),k&&t.jsx(gu,{assignments:e,labels:v,total:F,hasTotalError:I&&!R||E,validationMessage:A,onSelectFund:X=>x(X),onRemoveFund:Z,onPercentageChange:(X,de)=>se(X,{percentage:xu(de)})}),t.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[t.jsx(B,{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(K.Plus,{className:"size-5",strokeWidth:2}),isDisabled:O,onPress:()=>k?Y():x(),children:v.assignSpecificFund}),t.jsx(B,{type:"button","data-testid":"installment-fund-assignment-save-button",size:"md",color:"primary",radius:"full",className:"ml-auto h-10 min-w-40 px-4 text-sm font-medium [@container(max-width:479px)]:w-full",startContent:r?void 0:t.jsx(P,{icon:"solar:cloud-upload-outline",className:"size-4"}),isLoading:r,isDisabled:!R||r,onPress:Q,children:v.saveAssignment})]})]}),m]})},"installment-fund-assignment")}),d&&t.jsx(bu,{funds:s,labels:v,selectedFundIds:e.map(X=>X.fund?.id).filter(Boolean),portalContainer:D,onSelect:ne,onClose:g}),t.jsx(va,{isOpen:V,labels:{title:v.modifyAssignedFundsTitle,description:t.jsxs(t.Fragment,{children:[t.jsx("p",{children:v.modifyAssignedFundsDescription}),t.jsx("p",{className:"mt-3",children:v.modifyAssignedFundsWarning})]}),cancel:v.modifyAssignedFundsCancel,confirm:v.modifyAssignedFundsConfirm},icon:t.jsx(P,{icon:"solar:info-circle-outline",className:"size-7"}),iconTone:"warning",confirmColor:"primary",portalContainer:D,shouldBlockScroll:!1,classNames:mu,onClose:()=>q(!1),onConfirm:ee})]})}function gu({assignments:e,labels:s,total:a,hasTotalError:n,validationMessage:r,onSelectFund:i,onRemoveFund:l,onPercentageChange:o}){return t.jsxs("div",{className:"flex flex-col gap-3",children:[e.map((d,u)=>t.jsxs("div",{"data-testid":"installment-fund-assignment-row",className:"flex min-h-15 w-full flex-wrap items-center gap-3 rounded-2xl border border-zinc-200 bg-white px-3 py-2",children:[t.jsx("div",{className:c.cn("flex min-h-11 min-w-0 basis-full items-center gap-2","[@container(min-width:560px)]:basis-0 [@container(min-width:560px)]:flex-1 [@container(min-width:560px)]:gap-4"),children:d.fund?t.jsxs(t.Fragment,{children:[t.jsxs("span",{className:"min-w-0 break-words rounded-2xl bg-zinc-100 px-4 py-1.5 text-sm text-zinc-950",children:[d.fund.glCode," - ",d.fund.accountName]}),t.jsx(B,{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(B,{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(K.Plus,{className:"size-5",strokeWidth:2}),onPress:()=>i(d.id),children:s.assignSpecificFund})}),t.jsx("label",{className:"flex min-w-0 flex-1 items-center [@container(min-width:560px)]:w-48 [@container(min-width:560px)]:flex-none",children:t.jsx(c.Input,{variant:"bordered",type:"number",min:0,max:100,step:.01,value:String(d.percentage||""),onChange:f=>o(d.id,Number(f.target.value)),endContent:t.jsx("span",{className:"text-sm text-zinc-500",children:"%"}),classNames:uu})}),e.length>1&&t.jsx(B,{type:"button",isIconOnly:!0,variant:"flat",radius:"full",className:c.cn("h-10 w-10 flex-none p-0",u===0?"bg-danger-100 text-danger-500 opacity-60":"bg-danger-600 text-white"),style:{height:40,minWidth:40,width:40},isDisabled:u===0,onPress:()=>l(d.id),"aria-label":s.removeFund,children:t.jsx(P,{icon:"solar:trash-bin-minimalistic-outline",className:"size-5"})})]},d.id)),t.jsx(c.Alert,{icon:t.jsx(P,{icon:n?"solar:info-circle-outline":"solar:check-circle-outline",className:"size-4"}),hideIconWrapper:!0,isClosable:!1,color:n?"warning":"success",variant:"flat",classNames:{...St,base:c.cn(St.base,n?"bg-warning-50 text-warning-700":"bg-success-50 text-success-700"),iconWrapper:c.cn(St.iconWrapper,n?"text-warning-700":"text-success-700"),alertIcon:c.cn(St.alertIcon,n?"text-warning-700":"text-success-700"),title:c.cn(St.title,n?"text-warning-700":"text-success-700")},title:n?r:`${s.total} ${Number(a.toFixed(2))}%`})]})}function bu({funds:e,labels:s,selectedFundIds:a,portalContainer:n,onSelect:r,onClose:i}){const[l,o]=p.useState(""),d=e.filter(u=>{if(a.includes(u.id))return!1;const f=l.trim().toLowerCase();return f?`${u.glCode} ${u.accountName} ${u.type}`.toLowerCase().includes(f):!0});return t.jsx(c.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(c.ModalContent,{className:"max-h-full",children:[t.jsx(c.ModalHeader,{className:"px-6 pr-12 pt-6 text-xl font-semibold leading-7 text-zinc-950",children:s.modalTitle}),t.jsxs(c.ModalBody,{className:"flex min-h-0 flex-1 flex-col px-6 pb-6",children:[t.jsx(c.Input,{variant:"bordered","aria-label":s.searchPlaceholder,value:l,placeholder:s.searchPlaceholder,onChange:u=>o(u.target.value),startContent:t.jsx(P,{icon:"solar:magnifer-outline",className:"size-5 text-zinc-500"}),classNames:{input:"text-sm placeholder:text-zinc-500",inputWrapper:"h-10 rounded-2xl border border-zinc-200 bg-white px-4 shadow-none hover:border-zinc-300 data-[hover=true]:border-zinc-300 group-data-[focus=true]:border-zinc-400 group-data-[focus-visible=true]:ring-0"}}),t.jsxs("div",{className:"mt-4 min-h-0 flex-1 overflow-auto [container-type:inline-size]",children:[t.jsxs("div",{className:"hidden grid-cols-[1fr_1.3fr_0.6fr] gap-5 border-b border-zinc-200 px-3 pb-3 text-sm font-medium leading-5 text-zinc-900 [@container(min-width:520px)]:grid",children:[t.jsx("span",{children:s.glCode}),t.jsx("span",{children:s.accountName}),t.jsx("span",{children:s.actions})]}),d.length===0&&t.jsx("div",{className:"p-4 text-sm text-zinc-500",children:s.noFunds}),d.map(u=>t.jsxs("div",{"data-testid":"installment-fund-picker-row",className:"grid grid-cols-[minmax(0,1fr)_auto] items-center gap-x-3 border-b border-zinc-100 px-3 py-2.5 text-sm leading-5 text-zinc-900 last:border-b-0 [@container(min-width:520px)]:grid-cols-[1fr_1.3fr_0.6fr] [@container(min-width:520px)]:gap-5 [@container(min-width:520px)]:border-b-0",children:[t.jsx("span",{className:"col-start-1 row-start-1 font-medium [@container(min-width:520px)]:font-normal",children:u.glCode}),t.jsx("span",{className:"col-start-1 row-start-2 min-w-0 break-words text-zinc-600 [@container(min-width:520px)]:col-start-2 [@container(min-width:520px)]:row-start-1 [@container(min-width:520px)]:text-zinc-900",children:u.accountName}),t.jsx(B,{type:"button",size:"sm",variant:"bordered",radius:"full",className:"col-start-2 row-span-2 row-start-1 h-9 min-w-20 border-zinc-200 bg-white text-sm font-medium text-zinc-900 [@container(min-width:520px)]:col-start-3 [@container(min-width:520px)]:row-span-1 [@container(min-width:520px)]:min-w-24",onPress:()=>r(u),children:s.select})]},u.id))]})]})]})})}function yu(){return t.jsxs("section",{className:"flex w-full flex-col gap-4 rounded-2xl border border-zinc-200 bg-white p-4 shadow-sm","aria-busy":"true",children:[t.jsxs("div",{className:"flex items-start justify-between gap-3",children:[t.jsx(c.Skeleton,{className:"h-7 w-56 rounded-lg"}),t.jsx(c.Skeleton,{className:"size-8 rounded-full"})]}),t.jsxs("div",{className:"flex items-center justify-between gap-3",children:[t.jsx(c.Skeleton,{className:"h-10 w-72 rounded-full"}),t.jsx(c.Skeleton,{className:"h-10 w-40 rounded-full"})]}),t.jsxs("div",{className:"grid grid-cols-[minmax(0,1fr)_160px] items-center gap-4 rounded-2xl border border-zinc-100 p-3",children:[t.jsx(c.Skeleton,{className:"h-8 w-full max-w-xs rounded-full"}),t.jsx(c.Skeleton,{className:"h-8 w-full rounded-xl"})]}),t.jsx(c.Skeleton,{className:"h-11 w-40 rounded-full"})]})}const vu={totalAmount:"Total Amount:",remainingBalance:"Remaining Balance",amountReceived:"Amount Received:"};function ju({totalAmount:e,remainingBalance:s,amountReceived:a,currency:n="USD",locale:r="en-US",labels:i,className:l}){const o={...vu,...i},d=new Intl.NumberFormat(r,{style:"currency",currency:n});return t.jsx("div",{className:c.cn("w-full rounded-2xl border border-zinc-200 bg-white px-4 py-2.5 font-sans text-base leading-6",l),children:t.jsxs("div",{className:"flex w-full flex-wrap items-center gap-x-5 gap-y-2",children:[t.jsx($s,{label:o.totalAmount,value:d.format(e)}),t.jsx($s,{label:o.remainingBalance,value:d.format(s)}),t.jsx($s,{label:o.amountReceived,value:d.format(a)})]})})}function $s({label:e,value:s}){return t.jsxs("div",{className:"flex items-center gap-3 whitespace-nowrap",children:[t.jsx("span",{className:"font-medium text-zinc-700",children:e}),t.jsx("span",{className:"font-normal text-zinc-950",children:s})]})}const wu={monthly:1,quarterly:3,annual:12},Jr=e=>{const[s,a,n]=e.split("-").map(Number);return{year:s,month:a,day:n}},Nu=(e,s)=>new Date(e,s+1,0).getDate(),Cu=e=>{const s=e.getFullYear(),a=String(e.getMonth()+1).padStart(2,"0"),n=String(e.getDate()).padStart(2,"0");return`${s}-${a}-${n}`},ku=(e,s)=>{const{year:a,month:n,day:r}=Jr(e),i=n-1+s,l=a+Math.floor(i/12),o=(i%12+12)%12,d=Math.min(r,Nu(l,o));return new Date(l,o,d)},Su=(e,s)=>{const{year:a,month:n,day:r}=Jr(e),i=new Date(a,n-1,r);return i.setDate(i.getDate()+s),i};function ei(e,s){const a=Math.max(1,Math.floor(s.numberOfInstallments||1)),n=Math.round(e*100),r=Math.floor(n/a),i=n-r*a,l=wu[s.frequency];return Array.from({length:a},(o,d)=>{const u=s.frequency==="weekly"?Su(s.firstInstallmentDate,d*7):ku(s.firstInstallmentDate,d*(l??1));return{id:crypto.randomUUID(),dueDate:Cu(u),amount:(r+(d===0?i:0))/100}})}function $u(e){return new Set(e.map((s,a)=>{const n=e[a+1]?.dueDate;return s.dueDate&&n&&s.dueDate>n?s.id:null}).filter(s=>!!s))}function Au(e){return{missingDateRows:new Set(e.filter(s=>!s.dueDate).map(s=>s.id)),invalidDateRows:$u(e),invalidAmountRows:new Set(e.filter(s=>Number(s.amount||0)<=0).map(s=>s.id))}}function Du(e){return e.missingDateRows.size>0||e.invalidDateRows.size>0||e.invalidAmountRows.size>0}function Eu(e,s){const a=e[0];return!a||!s||a.dueDate===s?e:[{...a,dueDate:s},...e.slice(1)]}const Fu=new Set(["paid","partially_refunded","refunded"]);function dt(e){return e!==void 0&&Fu.has(e)}const Lu={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."},Mu=["weekly","monthly","quarterly","annual"],_u=Array.from({length:31},(e,s)=>s+1),Ru=["numberOfInstallments","frequency","firstInstallmentDate"],vn=()=>({id:crypto.randomUUID(),dueDate:new Date().toISOString().slice(0,10),amount:0}),ns=e=>Math.round(e*100)/100,Tu=(e,s)=>{const a=new Date(`${e}T00:00:00`);return Number.isNaN(a.getTime())?e:new Intl.DateTimeFormat(s,{month:"short",day:"numeric",year:"numeric"}).format(a)},ms=e=>{if(!e)return null;try{return Ac(e)}catch{return null}},Iu=e=>ms(e)?.day??1,Pu=(e,s)=>new Date(e,s,0).getDate(),Ou=(e,s)=>{const a=ms(e);if(!a)return e;const n=Math.min(s,Pu(a.year,a.month));return a.set({day:n}).toString()},jn=e=>{const s=e%100>=11&&e%100<=13?"th":e%10===1?"st":e%10===2?"nd":e%10===3?"rd":"th";return`${e}${s}`};function zu({mode:e,donationAmount:s,currency:a="USD",locale:n="en-US",installments:r,automaticSettings:i,defaultTab:l="automatic",showTitle:o=!0,showCard:d=!0,showSavePayment:u=!0,showTabs:f=!0,inputs:m=Ru,startDate:h,firstInstallmentDateOverride:x,labels:g,classNames:j,isSaving:b=!1,showSavedIndicator:w=!1,isModeSwitchDisabled:N=!1,onModeChange:D,onAutomaticSettingsChange:v,onInstallmentsChange:S,onSave:M,onCancel:k}){const[F,C]=p.useState(l),_={...Lu,...g},E=e??F,A=p.useMemo(()=>new Intl.NumberFormat(n,{style:"currency",currency:a}),[a,n]),R=p.useMemo(()=>({...i,firstInstallmentDate:m.includes("firstInstallmentDate")?i.firstInstallmentDate:m.includes("dayOfMonth")?i.firstInstallmentDate||h||"":h||i.firstInstallmentDate}),[i,m,h]),O=E==="automatic"?Eu(ei(s,R),m.includes("firstInstallmentDate")?void 0:x):r,V=p.useMemo(()=>ns(O.reduce((ae,Ie)=>ae+Number(Ie.amount||0),0)),[O]),q=Math.abs(V-s)>.009,I=ns(s-V)<=0,J=p.useMemo(()=>Au(r),[r]),W=E==="manual"&&Du(J),se=q||W,Y=o?t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(K.CircleDollarSign,{className:"size-4 text-zinc-500",strokeWidth:1.75}),t.jsx("span",{className:"text-base font-medium leading-6 text-zinc-950",children:_.title}),w?t.jsx(c.Chip,{size:"sm",radius:"full",color:"success",variant:"flat",children:_.saved}):null]}):void 0,Z=ae=>{ae!==E&&(e||C(ae),D?.(ae),ae==="manual"&&r.length===0&&S([vn()]))},Q=(ae,Ie)=>{const Ee=r.find(Le=>Le.id===ae);dt(Ee?.status)||S(r.map(Le=>Le.id===ae?{...Le,...Ie}:Le))},ee=()=>{S([...r,vn()])},ne=ae=>{const Ie=r.find(Ee=>Ee.id===ae);dt(Ie?.status)||S(r.filter(Ee=>Ee.id!==ae))},X=()=>{b||se||M?.()},de=t.jsxs("div",{className:c.cn("flex w-full flex-col gap-4",j?.content),children:[f||u||k?t.jsxs("div",{className:"flex w-full items-center justify-between gap-6",children:[f?t.jsx(Bu,{mode:E,labels:_,onModeChange:Z,isDisabled:N,className:j?.tabs}):null,t.jsxs("div",{className:"ml-auto flex items-center gap-3",children:[k?t.jsx(B,{type:"button","data-testid":"installment-schedule-cancel-button",size:"md",variant:"bordered",radius:"full",className:"min-w-28",isDisabled:b,onPress:k,children:_.cancelEdit}):null,u?t.jsx(B,{type:"button","data-testid":"installment-schedule-save-button",size:"md",color:"primary",radius:"full",className:"min-w-36",startContent:b?void 0:t.jsx(P,{icon:"solar:cloud-upload-outline",className:"size-4"}),isLoading:b,isDisabled:b||se,onPress:X,children:_.saveInstallments}):null]})]}):null,t.jsxs("div",{className:c.cn("flex w-full flex-col gap-4",j?.preview),children:[E==="automatic"&&t.jsx(Vu,{settings:R,inputs:m,labels:_,className:j?.controls,onSettingsChange:v}),O.length===0&&t.jsx(c.Alert,{isClosable:!1,color:"default",variant:"flat",radius:"full",title:E==="automatic"?_.emptyAutomatic:_.emptyManual}),O.length>0&&t.jsx(Uu,{mode:E,installments:O,rowErrors:J,labels:_,formatter:A,locale:n,onUpdateInstallment:Q,onRemoveInstallment:ne}),E==="manual"&&t.jsx("div",{className:"flex flex-wrap gap-3",children:t.jsx(B,{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(K.Plus,{className:"size-5",strokeWidth:2}),isDisabled:I,onPress:ee,children:_.addInstallment})}),t.jsx(Yu,{total:V,donationAmount:s,hasTotalMismatch:q,mode:E,installments:O,formatter:A,labels:_,className:j?.summary})]})]});return t.jsx("div",{className:c.cn("vvt-ps relative font-sans text-zinc-900",j?.root),children:d?t.jsx(c.Accordion,{variant:"splitted",defaultSelectedKeys:["installment-schedule"],className:c.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:c.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(c.AccordionItem,{"aria-label":_.title,title:Y,children:de},"installment-schedule")}):de})}function Bu({mode:e,labels:s,className:a,isDisabled:n=!1,onModeChange:r}){return t.jsxs(c.Tabs,{"aria-label":s.title,selectedKey:e,isDisabled:n,color:"primary",size:"lg",radius:"full",className:c.cn("w-fit",a),onSelectionChange:i=>r(i),children:[t.jsx(c.Tab,{title:s.automaticMode},"automatic"),t.jsx(c.Tab,{title:s.manualMode},"manual")]})}function Vu({settings:e,inputs:s,labels:a,className:n,onSettingsChange:r}){const i=l=>{if(l==="numberOfInstallments")return t.jsx("div",{className:"min-w-0",children:t.jsx(c.Input,{variant:"bordered",label:a.numberOfInstallments,labelPlacement:"outside",type:"number",min:1,step:1,value:e.numberOfInstallments>0?String(e.numberOfInstallments):"",onWheel:o=>o.currentTarget.blur(),onChange:o=>{const d=o.target.value;r({...e,numberOfInstallments:d===""?0:Math.max(1,Number(d))})}})},l);if(l==="frequency")return t.jsx("div",{className:"min-w-0",children:t.jsx(He,{variant:"bordered",label:a.frequency,labelPlacement:"outside",selectedKeys:[e.frequency],onSelectionChange:o=>{const d=Array.from(o)[0];typeof d=="string"&&r({...e,frequency:d})},children:Mu.map(o=>t.jsx(c.SelectItem,{textValue:a[o],children:a[o]},o))})},l);if(l==="dayOfMonth"){const o=String(Iu(e.firstInstallmentDate));return t.jsx("div",{className:"min-w-0",children:t.jsx(He,{variant:"bordered",label:a.dayOfMonth,labelPlacement:"outside",selectedKeys:[o],onSelectionChange:d=>{const u=Number(Array.from(d)[0]);Number.isFinite(u)&&r({...e,firstInstallmentDate:Ou(e.firstInstallmentDate,u)})},children:_u.map(d=>t.jsx(c.SelectItem,{textValue:jn(d),children:jn(d)},String(d)))})},l)}return t.jsx("div",{className:"min-w-0",children:t.jsx(ua,{variant:"bordered",label:a.firstInstallmentDate,labelPlacement:"outside",value:ms(e.firstInstallmentDate),onChange:o=>r({...e,firstInstallmentDate:o?o.toString():""}),startContent:t.jsx(P,{icon:"solar:calendar-outline",className:"size-4 text-zinc-500"})})},l)};return s.length===0?null:t.jsx("div",{className:c.cn("grid gap-4",n),style:{gridTemplateColumns:"repeat(auto-fit, minmax(min(100%, 14rem), 1fr))"},children:s.map(i)})}function Uu({mode:e,installments:s,rowErrors:a,labels:n,formatter:r,locale:i,onUpdateInstallment:l,onRemoveInstallment:o}){return e==="automatic"?t.jsx("div",{className:"rounded-2xl border border-zinc-200 bg-zinc-50 p-4",children:t.jsx("div",{className:c.cn("flex flex-col gap-3",s.length>5&&"max-h-[264px] overflow-y-auto pr-2"),children:s.map((d,u)=>t.jsxs("div",{className:c.cn("flex min-h-10 items-center justify-between rounded-xl px-4 py-2 text-base",u===0&&"border border-primary/25 bg-primary/5 text-primary"),children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsxs("span",{children:["#",u+1]}),t.jsx("span",{children:"▪"}),t.jsx("span",{children:Tu(d.dueDate,i)}),u===0&&s.length>1&&t.jsx(c.Chip,{size:"sm",color:"primary",variant:"solid",radius:"full",children:"First charge"})]}),t.jsx("span",{className:"text-zinc-950",children:r.format(d.amount)})]},d.id))})}):t.jsx("div",{className:"flex flex-col gap-2",children:s.map((d,u)=>{const f=a.missingDateRows.has(d.id),m=a.invalidDateRows.has(d.id),h=a.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(ua,{variant:"bordered","aria-label":`${n.dueDate} ${u+1}`,isDisabled:dt(d.status),isInvalid:f||m,errorMessage:f?n.dueDateRequiredError:m?n.dateOrderError:void 0,value:ms(d.dueDate),onChange:x=>l(d.id,{dueDate:x?x.toString():""})})}),t.jsx("div",{className:"min-w-0 flex-1",children:t.jsx(qu,{amount:d.amount,ariaLabel:`${n.amount} ${u+1}`,isDisabled:dt(d.status),isInvalid:h,errorMessage:n.amountGreaterThanZeroError,onAmountChange:x=>l(d.id,{amount:x})})}),t.jsx(Wu,{isDisabled:s.length<=1,isPaid:dt(d.status),label:n.deleteInstallment,onRemove:()=>o(d.id)})]})},d.id)})})}const Hu=/^\d*(?:[.,]\d{0,2})?$/;function qu({amount:e,ariaLabel:s,isDisabled:a,isInvalid:n,errorMessage:r,onAmountChange:i}){const[l,o]=p.useState(null);return t.jsx(c.Input,{variant:"bordered","aria-label":s,type:"text",inputMode:"decimal",autoComplete:"off",isDisabled:a,isInvalid:n,errorMessage:n?r:void 0,value:l??(e?String(e):""),onChange:d=>{const u=d.target.value.trim();if(!Hu.test(u))return;o(u);const f=Number(u.replace(",","."));i(ns(Number.isFinite(f)?f:0))},onBlur:()=>o(null),startContent:t.jsx("span",{className:"text-zinc-900",children:"$"})})}function Wu({isDisabled:e,isPaid:s,label:a,onRemove:n}){const r=t.jsx(B,{type:"button",isIconOnly:!0,variant:"flat",radius:"full",className:"h-9 w-9 flex-none bg-danger-100 p-0 text-danger-600",style:{height:36,minWidth:36,width:36},isDisabled:e||s,onPress:n,"aria-label":a,children:t.jsx(P,{icon:"solar:trash-bin-minimalistic-outline",className:"size-5"})});return s?t.jsx(c.Tooltip,{content:"This payment cannot be edited or deleted because it has already been paid.",placement:"top",children:t.jsx("span",{className:"inline-flex",children:r})}):r}function Yu({total:e,donationAmount:s,hasTotalMismatch:a,mode:n,installments:r,formatter:i,labels:l,className:o}){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),h=ns(s-e),x=Math.max(h,0),g=Math.max(-h,0),j=a?t.jsxs("span",{children:[l.totalError,". Total scheduled: ",t.jsx("strong",{children:i.format(e)})," /"," ",t.jsx("strong",{children:i.format(s)}),"."]}):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(s)}),"."]}),b=n==="automatic"?`Total: ${i.format(e)}`:g>0?`Exceeds by: ${i.format(g)}`:`${l.remaining}: ${i.format(x)}`;return t.jsx(c.Alert,{isClosable:!1,color:a?"danger":"default",variant:"flat",radius:"full",className:o,endContent:t.jsx("span",{className:"whitespace-nowrap",children:b}),title:j})}function Gu(){return t.jsxs("section",{className:"flex w-full flex-col gap-4 rounded-2xl border border-zinc-200 bg-white p-4 shadow-sm","aria-busy":"true",children:[t.jsxs("div",{className:"flex items-start justify-between gap-3",children:[t.jsx(c.Skeleton,{className:"h-7 w-56 rounded-lg"}),t.jsx(c.Skeleton,{className:"size-8 rounded-full"})]}),t.jsxs("div",{className:"flex items-center justify-between gap-3",children:[t.jsx(c.Skeleton,{className:"h-10 w-72 rounded-full"}),t.jsx(c.Skeleton,{className:"h-10 w-40 rounded-full"})]}),t.jsxs("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-end sm:justify-between",children:[t.jsxs("div",{className:"flex w-full max-w-[280px] flex-col gap-2",children:[t.jsx(c.Skeleton,{className:"h-4 w-36 rounded-md"}),t.jsx(c.Skeleton,{className:"h-9 w-full rounded-xl"})]}),t.jsx(c.Skeleton,{className:"h-9 w-36 rounded-full"})]}),t.jsx("div",{className:"flex flex-col gap-3",children:Array.from({length:4}).map((e,s)=>t.jsxs("div",{className:"grid grid-cols-[minmax(0,1fr)_160px] items-center gap-4 rounded-2xl border border-zinc-100 p-3",children:[t.jsx(c.Skeleton,{className:"h-8 w-full max-w-xs rounded-full"}),t.jsx(c.Skeleton,{className:"h-8 w-full rounded-xl"})]},s))})]})}const wn={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"},ti={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"},Ku={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:ti.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."},Qu={wrapper:"!absolute !inset-0 !z-50 !items-center !justify-center !p-4",backdrop:"!absolute !inset-0 !z-40 rounded-2xl"},Zu=[];function Xu({installments:e,currency:s,locale:a="en-US",showTitle:n=!0,showCard:r=!0,showEditPayment:i=!0,showDelete:l=!0,payNowHiddenStatuses:o=Zu,showSavedIndicator:d=!1,labels:u,isSaving:f=!1,onEditInstallments:m,onPayInstallment:h,onDeleteInstallment:x}){const[g,j]=p.useState(null),b={...Ku,...u},[w,N]=p.useState(""),D=new Intl.NumberFormat(a,{style:"currency",currency:s}),v=e.some(C=>si(C)!==null),S=e.some(C=>C.status==="partially_refunded"),M=n?t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(K.CircleDollarSign,{className:"size-4 text-zinc-500",strokeWidth:1.75}),t.jsx("span",{className:"text-base font-medium leading-6 text-zinc-950",children:b.title}),d?t.jsx(c.Chip,{size:"sm",radius:"full",color:"success",variant:"flat",children:b.saved}):null]}):void 0,k=p.useMemo(()=>{const C=w.trim().toLowerCase();if(!C)return e;const _=new Intl.NumberFormat(a,{style:"currency",currency:s});return e.filter(E=>{const A=E.status??"scheduled";return[As(E),E.id,E.amount,E.dueDate,Qt(E.dueDate,a),Ds(E,b.paidOn,a),Es(E,b.refundedAmount,_),A,Fs(A,b.partiallyRefunded)].join(" ").toLowerCase().includes(C)})},[a,s,e,w,b.paidOn,b.refundedAmount,b.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:b.searchLabel}),t.jsx(c.Input,{variant:"bordered",size:"md",value:w,placeholder:b.searchPlaceholder,onChange:C=>N(C.target.value),startContent:t.jsx(P,{icon:"solar:magnifer-outline",className:"size-4 text-zinc-500"})})]}),i?t.jsx(B,{type:"button",variant:"bordered",radius:"full",size:"md",className:"h-10 border-zinc-200 bg-white px-4 text-sm font-normal text-zinc-900",startContent:t.jsx(P,{icon:"solar:pen-outline",className:"size-4"}),isLoading:f,onPress:m,children:b.editInstallments}):null]}),t.jsx("div",{className:c.cn("hidden [@container(max-width:767px)]:block",k.length>3&&"max-h-[560px] overflow-y-auto pr-1"),children:t.jsxs("div",{className:"flex flex-col gap-2",children:[k.map((C,_)=>{const E=C.status??"scheduled",A=As(C),R=Ds(C,b.paidOn,a),O=Es(C,b.refundedAmount,D);return t.jsx(c.Card,{radius:"lg",shadow:"none",className:"border border-default-200",children:t.jsxs(c.CardBody,{className:"gap-3 p-3",children:[t.jsxs("div",{className:"flex items-start justify-between gap-2",children:[t.jsxs("div",{className:"min-w-0",children:[t.jsxs("p",{className:"text-xs text-default-500",children:["#",_+1]}),t.jsx("p",{className:"truncate text-sm font-medium text-foreground",children:A||`PMT-${_+1}`})]}),t.jsx(Nn,{status:E,label:Fs(E,b.partiallyRefunded)})]}),t.jsxs("div",{className:"grid grid-cols-2 gap-2 text-sm",children:[t.jsxs("div",{children:[t.jsx("p",{className:"text-xs text-default-500",children:b.amount}),t.jsx("p",{className:"font-medium text-foreground",children:D.format(C.amount)}),O?t.jsx("p",{className:"text-xs text-default-500",children:O}):null]}),t.jsxs("div",{className:"text-right",children:[t.jsx("p",{className:"text-xs text-default-500",children:b.scheduledDate}),t.jsx("p",{className:"font-medium text-foreground",children:Qt(C.dueDate,a)}),R?t.jsx("p",{className:"text-xs text-default-500",children:R}):null]})]}),t.jsx(Cn,{status:E,installment:C,labels:b,portalContainer:g??void 0,showDelete:l,payNowHiddenStatuses:o,onPayInstallment:h,onDeleteInstallment:x})]})},C.id)}),k.length===0&&t.jsx("div",{className:"rounded-lg border border-default-200 px-4 py-6 text-center text-sm text-default-500",children:b.noInstallmentsFound})]})}),t.jsx("div",{className:c.cn("w-full overflow-x-hidden [@container(max-width:767px)]:hidden",k.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:v?"w-32":"w-24"}),t.jsx("col",{className:"w-36"}),t.jsx("col",{className:S?"w-44":"w-36"}),t.jsx("col",{className:"w-44"})]}),t.jsx("thead",{children:t.jsxs("tr",{className:"sticky top-0 z-10 border-b border-zinc-200 bg-white text-zinc-900",children:[t.jsx("th",{className:"px-2 py-3 font-medium",children:"#"}),t.jsx("th",{className:"px-2 py-3 font-medium",children:b.installmentId}),t.jsx("th",{className:"px-2 py-3 font-medium",children:b.amount}),t.jsx("th",{className:"px-2 py-3 font-medium",children:b.scheduledDate}),t.jsx("th",{className:"whitespace-nowrap px-2 py-3 font-medium",children:b.status}),t.jsx("th",{className:"whitespace-nowrap py-3 pl-4 pr-2 font-medium",children:b.actions})]})}),t.jsxs("tbody",{children:[k.map((C,_)=>{const E=C.status??"scheduled",A=As(C),R=Ds(C,b.paidOn,a),O=Es(C,b.refundedAmount,D);return t.jsxs("tr",{className:"text-zinc-500",children:[t.jsx("td",{className:"px-2 py-3",children:_+1}),t.jsx("td",{className:"overflow-hidden px-2 py-3",children:t.jsx("span",{className:"block w-full truncate",children:A||`PMT-${_+1}`})}),t.jsxs("td",{className:"px-2 py-3",children:[D.format(C.amount),O?t.jsx("span",{className:"block text-xs",children:O}):null]}),t.jsxs("td",{className:"px-2 py-3",children:[Qt(C.dueDate,a),R?t.jsx("span",{className:"block text-xs",children:R}):null]}),t.jsx("td",{className:"whitespace-nowrap px-2 py-3",children:t.jsx(Nn,{status:E,label:Fs(E,b.partiallyRefunded)})}),t.jsx("td",{className:"whitespace-nowrap py-3 pl-4 pr-2",children:t.jsx(Cn,{status:E,installment:C,labels:b,portalContainer:g??void 0,showDelete:l,payNowHiddenStatuses:o,onPayInstallment:h,onDeleteInstallment:x})})]},C.id)}),k.length===0&&t.jsx("tr",{children:t.jsx("td",{colSpan:6,className:"px-2 py-6 text-center text-zinc-500",children:b.noInstallmentsFound})})]})]})})]});return t.jsx("div",{ref: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(c.Accordion,{variant:"splitted",defaultSelectedKeys:["installment-table"],className:"min-w-0 w-full gap-0 px-0",itemClasses:{base:"min-w-0 w-full overflow-x-hidden rounded-2xl border border-zinc-200 bg-white p-0 shadow-sm",trigger:"px-4 py-4",title:"w-full",content:"min-w-0 w-full overflow-x-hidden px-4 pb-4 pt-0",indicator:"text-zinc-500 [&>svg]:size-4"},children:t.jsx(c.AccordionItem,{"aria-label":b.title,title:M,children:F},"installment-table")}):F})}function As(e){return e.name?.trim()||e.id}function Ds(e,s,a){return!dt(e.status)||!e.fulfilledAt?null:`${s} ${Qt(e.fulfilledAt,a)}`}function si(e){const{refundedAmount:s}=e;return e.status!=="partially_refunded"||typeof s!="number"||!Number.isFinite(s)||s<=0?null:s}function Es(e,s,a){const n=si(e);return n===null?null:`${s} ${a.format(n)}`}function Fs(e,s){return e==="partially_refunded"?s:ti[e]??e}function Nn({status:e,label:s}){return t.jsx(c.Chip,{size:"md",radius:"lg",className:c.cn("justify-center px-4",wn[e]??wn.scheduled),startContent:t.jsx(em,{status:e}),children:s})}function Cn({status:e,installment:s,labels:a,portalContainer:n,showDelete:r,payNowHiddenStatuses:i,onPayInstallment:l,onDeleteInstallment:o}){const d=!i.includes(e),u=dt(e);return t.jsxs("div",{className:"flex min-w-36 items-center justify-start gap-2",children:[d?t.jsx(B,{type:"button",size:"md",color:"primary",variant:"solid",radius:"full",className:"min-w-[104px] shrink-0",isDisabled:u,startContent:t.jsx(P,{icon:"solar:dollar-minimalistic-outline",className:"size-4"}),onPress:()=>l?.(s),children:a.payNow}):null,t.jsx(Ju,{isFulfilled:u,showDelete:r,labels:a,portalContainer:n,onDelete:()=>o(s.id)})]})}function Ju({isFulfilled:e,showDelete:s,labels:a,portalContainer:n,onDelete:r}){const[i,l]=p.useState(!1);return t.jsxs(t.Fragment,{children:[t.jsxs(c.Dropdown,{placement:"bottom-end",radius:"lg",children:[t.jsx(c.DropdownTrigger,{children:t.jsx(B,{type:"button",isIconOnly:!0,size:"sm",variant:"light",className:"text-zinc-900","aria-label":"More actions",children:t.jsx(P,{icon:"solar:menu-dots-bold",className:"size-4"})})}),t.jsxs(c.DropdownMenu,{"aria-label":"Installment actions",disabledKeys:e?["send-link","delete"]:[],className:"w-72 p-2",onAction:o=>{o==="delete"&&s&&!e&&l(!0)},children:[t.jsx(c.DropdownSection,{title:"Actions",showDivider:s,children:t.jsx(c.DropdownItem,{textValue:a.sendLink,description:a.sendLinkDescription,startContent:t.jsx(P,{icon:"solar:link-outline",className:"size-5 text-zinc-500"}),children:a.sendLink},"send-link")}),s?t.jsx(c.DropdownSection,{title:a.dangerZone,children:t.jsx(c.DropdownItem,{textValue:a.deleteInstallment,className:"text-danger-600",color:"danger",description:a.deleteInstallmentDescription,startContent:t.jsx(P,{icon:"solar:trash-bin-minimalistic-outline",className:"size-5"}),children:a.deleteInstallment},"delete")}):null]})]}),s?t.jsx(va,{isOpen:i,labels:{title:a.deleteInstallmentConfirmationTitle,description:a.deleteInstallmentConfirmationDescription,cancel:a.deleteInstallmentConfirmationCancel,confirm:a.deleteInstallmentConfirmationConfirm},icon:t.jsx(P,{icon:"solar:danger-triangle-outline",className:"size-7"}),confirmColor:"danger",portalContainer:n,shouldBlockScroll:!1,classNames:Qu,onClose:()=>l(!1),onConfirm:()=>{l(!1),r()}}):null]})}function em({status:e}){return e==="paid"?t.jsx(P,{icon:"solar:check-circle-bold",className:"size-3"}):e==="failed"?t.jsx(P,{icon:"solar:close-circle-bold",className:"size-3"}):e==="partially_refunded"?t.jsx(P,{icon:"solar:undo-left-round-bold",className:"size-3"}):e==="processing"?t.jsx(P,{icon:"solar:refresh-circle-bold",className:"size-3"}):e==="pending_confirmation"?t.jsx(P,{icon:"solar:clock-circle-bold",className:"size-3"}):t.jsx(P,{icon:"solar:calendar-outline",className:"size-3"})}const tm=/^\d{4}-\d{2}-\d{2}$/;function Qt(e,s){const a=tm.test(e)?new Date(`${e}T00:00:00`):new Date(e);return Number.isNaN(a.getTime())?e:new Intl.DateTimeFormat(s,{month:"short",day:"numeric",year:"numeric"}).format(a)}const sm={title:"Select Membership",renewalTitle:"Automatic Renewal",renewalDescription:"Membership will automatically renew at the end of each period"},am=({cards:e,locale:s,currency:a,listHeightClassName:n="",labels:r,showRenewal:i=!0,defaultRenewalValue:l=!1,initialSelectedMembershipId:o=null,allowReselect:d=!0,onRenewalChange:u,onCardSelect:f,className:m=""})=>{const h=Array.isArray(e)?e:[],[x,g]=p.useState(o),[j,b]=p.useState(l),w={...sm,...r};p.useEffect(()=>{g(o)},[o]);const N=v=>{if(v===x){d&&f?.(v);return}g(v),f?.(v)},D=v=>{b(v),u?.(v)};return t.jsxs("div",{className:c.cn("w-full flex flex-col gap-4 items-start p-4 h-svh",m),"data-testid":"membership-select-cards",children:[t.jsx("span",{className:"hidden","data-testid":"membership-select-cards-selected-id",children:x??""}),t.jsx("p",{className:"text-2xl font-semibold text-left","data-testid":"membership-select-cards-title",children:w.title}),i&&t.jsx(li,{title:w.renewalTitle,description:w.renewalDescription,value:j,onValueChange:D}),t.jsx("div",{className:c.cn("w-full min-h-0 flex flex-col gap-4 overflow-y-auto",n===""?"flex-1":c.cn("shrink-0",n)),"data-testid":"membership-select-cards-list",children:h.map(v=>t.jsx(ai,{itemKey:v.id,name:v.name,type:v.type,price:v.price,locale:s,currency:a,isSelected:x===v.id,onSelect:N},v.id))})]})},ai=({itemKey:e,name:s,type:a,price:n,locale:r="en-US",currency:i="USD",showPrice:l=!0,isSelected:o=!1,onSelect:d,compact:u=!1,isDisabled:f=!1,disabledReason:m,statusLabel:h,statusTone:x="default",className:g=""})=>{const j=new Intl.NumberFormat(r,{style:"currency",currency:i,minimumFractionDigits:0,maximumFractionDigits:2}).format(n),b=!!d&&!f,w=m||h,N=()=>{b&&d?.(e)};return t.jsx(c.Card,{shadow:"none",isPressable:!!d,onPress:N,className:c.cn("w-full min-h-fit border rounded-3xl",o?"border-primary bg-primary/5":"border-default",f?"opacity-60":"",u?"rounded-2xl":"",g),"data-testid":"item-card","data-selected":o,isDisabled:f,children:t.jsxs("div",{className:c.cn("px-4 py-8 flex gap-6 items-center justify-between",u&&"px-3 py-3 gap-4"),children:[t.jsxs("div",{className:"w-max flex flex-col gap-1 items-start",children:[t.jsx("p",{className:c.cn("font-semibold text-left",u?"text-sm":"text-xl"),"data-testid":"item-card-name",children:s}),a&&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:a})}),w&&t.jsx(c.Chip,{"data-testid":"item-card-status",color:x,size:"sm",variant:"flat",className:"px-2",children:w})]}),l&&t.jsx("p",{className:c.cn("font-semibold text-right",u?"text-lg":"text-2xl"),"data-testid":"item-card-price",children:j})]})})},kn="w-full bg-gray-100",Sn={variant:"light",color:"default"},ni=({id:e,title:s,media:a,imageUrl:n,imageAlt:r,imageClassName:i="",imageAspect:l="aspect-[4/3]",meta:o=[],price:d,action:u,footer:f,onPress:m,isPressable:h=!1,isDisabled:x=!1,compact:g=!1,className:j="",bodyClassName:b="",footerClassName:w="",dataTestId:N})=>{const D=!!(d&&d.value),v=!!u?.label,S=h&&!!m&&!v,M=!S,k=v?{variant:u?.variant??Sn.variant,color:u?.color??Sn.color,size:u?.size??"sm",isDisabled:x||u?.isDisabled,startContent:u?.icon?t.jsx(P,{icon:u.icon,width:16}):void 0}:null,F=a??(n?t.jsx("div",{className:c.cn("relative overflow-hidden rounded-xl",l,kn,i),children:t.jsx(c.Image,{removeWrapper:!0,src:n,alt:r||s,className:"size-full object-cover",classNames:{wrapper:"absolute inset-0"}})}):t.jsx("div",{className:c.cn("relative overflow-hidden rounded-xl",l,kn,"grid place-items-center",i),"data-testid":`catalog-item-card-${e??"media"}-fallback`,children:t.jsx(P,{icon:"solar:ticket-outline",width:48,className:"text-default-400"})}));return t.jsxs(c.Card,{"data-testid":N||`catalog-item-card-${e??"item"}`,className:c.cn("w-full overflow-hidden",j),isPressable:S,onPress:m,isDisabled:x,shadow:"sm",radius:"lg",children:[t.jsx("div",{children:F}),t.jsxs(c.CardBody,{className:c.cn("gap-3",g?"p-3":"p-4",b),children:[t.jsx("h3",{"data-testid":`catalog-item-card-title-${e??""}`,className:c.cn("line-clamp-2 text-base font-semibold text-gray-900",g?"text-sm":""),children:s}),o.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:o.map((C,_)=>t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(P,{icon:C.icon,className:"size-4 text-gray-400",width:16}),t.jsx("span",{children:C.label})]},`${C.label}-${_}`))}):null,(D||v)&&t.jsxs("div",{className:c.cn("flex items-center justify-end gap-2 pt-1 text-sm",g?"pt-0.5":"",w),children:[D?t.jsxs("span",{className:c.cn("mr-auto text-gray-500",g?"text-xs":""),"data-testid":`catalog-item-card-price-${e??""}`,children:[d?.label&&t.jsxs("span",{children:[d.label," "]}),t.jsx("span",{className:"font-semibold text-brand",children:d?.value})]}):t.jsx("span",{className:"ml-auto","aria-hidden":!0}),v&&M?t.jsx(B,{className:c.cn("rounded-full",u?.className),onPress:u?.onPress,variant:k?.variant,color:k?.color,size:k?.size,startContent:k?.startContent,isDisabled:k?.isDisabled,"aria-label":u?.ariaLabel||u?.label,children:u?.label}):null]}),f?t.jsx("div",{className:"pt-1",children:f}):null]})]})};ni.displayName="CatalogItemCard";const nm={open:"Open","selling-fast":"Selling fast","sold-out":"Sold out"};function ri({title:e,subtitle:s,price:a,imageUrl:n,status:r,isDisabled:i=!1,onPress:l,className:o}){return t.jsx(c.Card,{isPressable:!!l,isDisabled:i,onPress:l,shadow:"none",radius:"lg",className:c.cn("w-full border border-pos-hair",o),children:t.jsxs(c.CardBody,{className:"flex-row items-center gap-5 p-4",children:[t.jsx("div",{className:"grid size-[4.875rem] shrink-0 place-items-center overflow-hidden rounded-xl bg-default-100 text-default-500",children:n?t.jsx(c.Image,{removeWrapper:!0,src:n,alt:"",className:"size-full object-cover"}):t.jsx(P,{icon:"solar:ticket-outline",width:28})}),t.jsxs("div",{className:"min-w-0 flex-1",children:[t.jsx("h3",{className:"truncate text-lg font-semibold text-foreground",children:e}),t.jsx("p",{className:"mt-1 text-base text-default-500",children:s})]}),r?t.jsx("span",{"data-status":r,className:"rounded-full bg-default-100 px-3 py-1 text-sm font-medium text-default-600",children:nm[r]}):null,a?t.jsxs("strong",{className:"ml-5 whitespace-nowrap text-xl",children:["from ",a]}):null]})})}ri.displayName="ProgramListItem";const rm={card:"gap-3 rounded-xl border border-dashed px-6 py-12",panel:"px-6 py-[72px]"},im={card:"size-12 rounded-2xl",panel:"size-[76px] rounded-[20px] border mb-[18px]"},lm={card:"text-base font-medium text-default-900",panel:"text-[17px] font-semibold text-acct-ink"},om={card:"max-w-sm text-sm text-default-600",panel:"max-w-[380px] text-sm text-acct-sub mt-1.5"},cm={card:"mt-1",panel:"mt-[22px]"},dm="bg-acct-page border-acct-border text-acct-muted",um={empty:"solar:inbox-line-duotone",error:"solar:danger-triangle-outline",success:"solar:check-circle-bold"},mm={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"},fm={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"},xm={empty:"status",error:"alert",success:"status",loading:"status"},hm={empty:"polite",error:"assertive",success:"polite",loading:"polite"};function pm(e,s,a,n){if(s===!1)return null;if(e==="loading"&&s===void 0)return t.jsx(c.Spinner,{size:"lg",color:"primary",className:n.spinner});if(p.isValidElement(s))return t.jsx(t.Fragment,{children:s});const r=typeof s=="string"?s:um[e];return r?t.jsx(P,{icon:r,width:a,height:a,"aria-hidden":"true",className:n.icon}):null}function vt({variant:e="empty",surface:s="card",title:a,titleAs:n="p",description:r,icon:i,actions:l,role:o=xm[e],ariaLive:d=hm[e],iconSize:u=24,className:f,classNames:m={},"data-testid":h="feedback-state"}){const x=pm(e,i,u,m);return t.jsxs("div",{role:o,"aria-live":d,"data-variant":e,"data-testid":h,"data-surface":s,className:c.cn("flex flex-col items-center justify-center text-center",rm[s],s==="card"?mm[e]:"bg-transparent",f,m.base),children:[x?t.jsx("span",{"aria-hidden":"true","data-testid":`${h}-icon`,className:c.cn("inline-flex items-center justify-center",im[s],e==="success"&&s==="card"&&"rounded-full",s==="panel"?dm:fm[e],m.iconWrapper),children:x}):null,t.jsxs("div",{className:c.cn("flex flex-col items-center",s==="card"&&"gap-1"),children:[t.jsx(n,{"data-testid":`${h}-title`,className:c.cn(lm[s],m.title),children:a}),r?t.jsx("p",{"data-testid":`${h}-description`,className:c.cn(om[s],m.description),children:r}):null]}),l?t.jsx("div",{"data-testid":`${h}-actions`,className:c.cn("flex flex-wrap items-center justify-center gap-2",cm[s],m.actions),children:l}):null]})}function ja(e){return t.jsx(vt,{...e,variant:"empty"})}function wa(e){return t.jsx(vt,{...e,variant:"error"})}function Na(e){return t.jsx(vt,{...e,variant:"loading"})}function ii(e){return t.jsx(vt,{...e,variant:"success"})}vt.displayName="FeedbackState";ja.displayName="EmptyState";wa.displayName="ErrorState";Na.displayName="LoadingState";ii.displayName="SuccessState";const li=({title:e,value:s,description:a,onValueChange:n,className:r=""})=>{const i=p.useId();return t.jsxs("div",{className:c.cn("w-full flex flex-row items-center",e||a?"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}),a&&t.jsx("p",{className:"text-left text-gray-500","data-testid":"toggle-description",children:a})]}),t.jsx(c.Switch,{id:i,isSelected:s,onValueChange:n,"data-testid":"toggle-switch"})]})},gm={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"},bm=(e,s)=>new Intl.NumberFormat(e,{style:"currency",currency:s}),oi=e=>Object.values(e).reduce((s,a)=>s+Object.values(a).reduce((n,r)=>n+Object.values(r).reduce((i,l)=>i+l.selectedQuantity,0),0),0),ym=e=>e.reduce((s,a)=>s+a.dates.reduce((n,r)=>n+r.tickets.reduce((i,l)=>i+l.max,0),0),0),Ca=e=>e.flatMap(s=>s.dates.flatMap(a=>a.tickets.map(n=>({exhibition:s,dateGroup:a,ticket:n})))),$n=(e,s,a)=>{const n={};let r=a?s??ym(e):0;for(const{exhibition:i,dateGroup:l,ticket:o}of Ca(e)){n[i.id]??={},n[i.id][l.id]??={};const d=a?Math.min(o.max,r):0;n[i.id][l.id][o.id]={id:o.id,selectedQuantity:d,originalPrice:o.originalPrice,discountedPrice:o.price},r-=d}return n},An=(e,s,a)=>`${e}::${s}::${a}`,vm=(e,s,a)=>{const n=oi(s);for(const{exhibition:r,dateGroup:i,ticket:l}of Ca(e)){const o=s[r.id]?.[i.id]?.[l.id]?.selectedQuantity??0,d=a===void 0?l.max:Math.min(l.max,a-(n-o));if(d>0&&o<d)return!1}return!0},jm=({initialQuantity:e=1,minQuantity:s=1,maxQuantity:a=10,onChange:n,disabled:r=!1})=>{const i=Math.max(s,Math.min(a,e)),[l,o]=p.useState(()=>String(i)),[d,u]=p.useState(!1),f=d?l:String(i),m=()=>{r||i>=a||n?.(i+1)},h=()=>{r||i<=s||n?.(i-1)},x=v=>{if(r)return;o(v.target.value);const S=parseInt(v.target.value,10);isNaN(S)||n?.(Math.max(s,Math.min(a,S)))},g=v=>{const S=parseInt(v.target.value,10);if(u(!1),isNaN(S)){n?.(s);return}const M=Math.max(s,Math.min(a,S));M!==S?n?.(M):o(String(M))},j=i<=s,b=i>=a,w="w-10 h-10 flex items-center justify-center border-0 rounded-full cursor-pointer transition-colors duration-150 text-white text-2xl font-regular",N="bg-primary hover:bg-primary/80",D="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:h,disabled:r||j,className:c.cn(w,r||j?D:N),"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:s,max:a,step:"1",className:"w-12 h-10 rounded-md border-0 bg-zinc-100 text-center text-2xl font-medium text-zinc-900 [appearance:textfield] [&::-webkit-inner-spin-button]:appearance-none [&::-webkit-outer-spin-button]:appearance-none","aria-label":`Selected quantity: ${i}`,"data-testid":"quantity-input"}),t.jsx("button",{type:"button",onClick:m,disabled:r||b,className:c.cn(w,r||b?D:N),"aria-label":"Increment quantity","data-testid":"quantity-increment",children:"+"})]})},wm=({label:e,checked:s=!1,onChange:a,disabled:n=!1})=>{const r=()=>{n||a?.(!s)};return t.jsxs("button",{type:"button",onClick:r,disabled:n,role:"checkbox","aria-checked":s,"data-testid":"checkbox-button","data-checked":s,className:c.cn("flex items-center gap-1.5 px-4 py-3 border-0 rounded-full cursor-pointer text-sm min-h-[30px]","outline-none select-none transition-colors bg-zinc-100 hover:bg-zinc-200 text-primary",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:s,onChange:()=>{},disabled:n,className:"absolute opacity-0 w-0 h-0 pointer-events-none",tabIndex:-1,readOnly:!0}),t.jsx("span",{className:c.cn("block w-3.5 h-3.5 rounded-sm relative",s?"bg-primary":"bg-white ring-1 ring-zinc-300"),children:s&&t.jsx("span",{className:"absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-[60%] rotate-45 w-[3px] h-[5px] border border-white border-t-0 border-l-0","aria-hidden":"true"})})]}),t.jsx("p",{className:"flex-1 m-0 text-left leading-snug",children:e})]})},Nm=({item:e,quantity:s,onChange:a,getTotalSelectedTickets:n,userMaxLimit:r,settings:i,labels:l})=>{const o=()=>{if(!n||r===void 0)return e.max;const m=n();return Math.min(e.max,r-(m-s))},d=i?.locale??"en-US",u=i?.currency??"USD",f=bm(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:[l.ticketsAllowedToRedeem," ",e.max]})})]}),t.jsx(jm,{initialQuantity:s,minQuantity:0,maxQuantity:o(),onChange:a})]}),e.membershipAlert?t.jsx(c.Alert,{"data-testid":"ticket-membership-alert",color:"warning",variant:"flat",radius:"full",className:"ticket-selection-membership-alert mb-2 w-full max-w-full py-0 shadow-none",classNames:{base:"ticket-selection-membership-alert-base !min-h-8 !items-center !bg-[#F5CB24]/15 !text-[#5B2C0F] shadow-none",mainWrapper:"ticket-selection-membership-alert-main-wrapper m-0 min-h-8 !py-0 !px-0",alertIcon:"ticket-selection-membership-alert-icon w-4 h-4 !text-[#5B2C0F]",iconWrapper:"ticket-selection-membership-alert-icon-wrapper !min-w-0 !bg-transparent !border-none !shadow-none !rounded-none !p-0 !m-0 !w-4 !h-4",description:"ticket-selection-membership-alert-description !ms-2 !my-2 !text-[#5B2C0F]"},description:t.jsx("span",{className:"ticket-selection-membership-alert-description-text block w-full whitespace-normal break-words text-sm leading-4 text-[#5B2C0F]",children:e.membershipAlert})}):null]})},Cm=({exhibitionId:e,dateGroup:s,isLast:a=!1,onQuantityChange:n,getTicketQuantity:r,getTotalSelectedTickets:i,userMaxLimit:l,settings:o,labels:d})=>t.jsxs("div",{className:c.cn("flex flex-col gap-2 pb-3",!a&&"border-b border-zinc-200"),"data-testid":"upgrade-ticket-date-group",children:[t.jsx("p",{className:"m-0 text-sm text-left text-zinc-500","data-testid":"upgrade-ticket-date",children:s.date}),s.tickets.map((u,f)=>t.jsxs("div",{children:[t.jsx(Nm,{item:u,quantity:r(e,s.id,u.id),onChange:m=>n(e,s.id,u.id,m),getTotalSelectedTickets:i,userMaxLimit:l,settings:o,labels:d}),f<s.tickets.length-1?t.jsx(c.Divider,{className:"bg-zinc-200","data-testid":"upgrade-ticket-divider"}):null]},u.id))]}),km=({title:e,exhibition:s,onQuantityChange:a,getTicketQuantity:n,getTotalSelectedTickets:r,userMaxLimit:i,settings:l,labels:o,initialExpanded:d=!1})=>{const[u,f]=p.useState(d),m=s.dates.reduce((x,g)=>x+g.tickets.reduce((j,b)=>j+n(s.id,g.id,b.id),0),0),h=s.dates.some(x=>x.tickets.length>0);return t.jsxs("div",{className:"w-full overflow-hidden border-b border-zinc-200","data-testid":"upgrade-ticket-header",children:[t.jsx("button",{type:"button",className:"flex items-center w-full px-5 py-4 border-0 cursor-pointer transition-all bg-white hover:bg-zinc-100",onClick:()=>f(!u),"aria-expanded":u,"aria-controls":`upgrade-items-${s.id}`,"data-testid":"upgrade-ticket-header-button",children:t.jsxs("div",{className:"flex justify-between items-center w-full gap-6",children:[t.jsx("h4",{className:"m-0 text-base font-semibold text-left text-zinc-900","data-testid":"upgrade-ticket-header-title",children:e}),t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsxs("p",{className:"m-0 text-sm text-right text-zinc-500","data-testid":"upgrade-ticket-header-count",children:[m," ",o.ticketsSelectedToRedeem]}),t.jsx("span",{className:c.cn("inline-flex items-center justify-center text-zinc-500 text-xl transition-transform duration-200",u&&"rotate-180"),"aria-hidden":"true",children:t.jsx(P,{icon:"mdi:chevron-down"})})]})]})}),t.jsx("div",{id:`upgrade-items-${s.id}`,className:c.cn("transition-all duration-300 overflow-hidden",u?"max-h-[1000px] opacity-100":"max-h-0 opacity-0"),"aria-hidden":!u,children:u&&t.jsx("div",{className:"px-5 flex flex-col gap-6","data-testid":"upgrade-ticket-items",children:h?s.dates.map((x,g)=>t.jsx(Cm,{exhibitionId:s.id,dateGroup:x,isLast:g===s.dates.length-1,onQuantityChange:a,getTicketQuantity:n,getTotalSelectedTickets:r,userMaxLimit:i,settings:l,labels:o},x.id)):t.jsx("div",{className:"px-5 py-10 text-center",children:t.jsx("p",{className:"m-0 text-zinc-500 italic",children:o.noUpgradeTicketsAvailable})})})})]})},Sm=({initialExpanded:e=!1,userMaxLimit:s,labels:a,settings:n,ticketSelectionData:r,className:i="",onSelectionChange:l})=>{const o=p.useMemo(()=>r??[],[r]),d={...gm,...a},[u,f]=p.useState(()=>$n(o,s,!0)),m=p.useRef(!1),h=p.useMemo(()=>{const N=Ca(o).map(({exhibition:D,dateGroup:v,ticket:S})=>[An(D.id,v.id,S.id),S]);return new Map(N)},[o]),x=vm(o,u,s),g=(N,D,v)=>u[N]?.[D]?.[v]?.selectedQuantity??0,j=()=>oi(u),b=(N,D,v,S)=>{const M=g(N,D,v),k=j()-M;if(s!==void 0&&k+S>s)return;const F=h.get(An(N,D,v));if(!F)return;const C={...u,[N]:{...u[N],[D]:{...u[N]?.[D],[v]:{id:v,selectedQuantity:S,originalPrice:F.originalPrice,discountedPrice:F.price}}}};f(C),l?.(C)},w=N=>{const D=$n(o,s,N);f(D),l?.(D)};return p.useEffect(()=>{!m.current&&x&&(l?.(u),m.current=!0)},[x,u,l]),t.jsxs("div",{className:c.cn("flex flex-col w-full font-sans",i),"data-testid":"ticket-selection",children:[t.jsxs("div",{className:"flex items-center justify-between py-2 gap-4","data-testid":"ticket-selection-header",children:[t.jsx("h3",{className:"text-xl font-semibold m-0","data-testid":"ticket-selection-title",children:d.ticketSelectionTitle}),t.jsx(wm,{label:d.selectAllButtonLabel,checked:x,onChange:w})]}),o.map(N=>t.jsx(km,{title:N.exhibitionName,exhibition:N,onQuantityChange:b,getTicketQuantity:g,getTotalSelectedTickets:j,userMaxLimit:s,settings:n,labels:d,initialExpanded:e},N.id))]})},Ls={confirm:"Confirm",clear:"Clear",noLabel:"Filters"},Ms=e=>{const s={};for(const a of e)a.type==="checkbox"?s[a.id]=[...a.selectedValues]:s[a.id]=a.selectedValue?[a.selectedValue]:[];return s},$m=(e,s)=>{const a={};for(const n of s){if(n.type==="checkbox"){a[n.id]=e[n.id]??[...n.selectedValues];continue}const r=e[n.id]??[];a[n.id]=r.length>0?r[0]:null}return a},Am=e=>e.type==="checkbox"?e.selectedValues.length>0:e.selectedValue!==null,ci=({triggerLabel:e,triggerAriaLabel:s,triggerIcon:a="solar:tuning-square-outline",triggerVariant:n="bordered",triggerColor:r="default",triggerSize:i="sm",triggerClassName:l,popoverClassName:o,className:d,sections:u,onConfirm:f,onClear:m,appliedCount:h,countAriaLabel:x,countDisplay:g="badge",confirmLabel:j=Ls.confirm,clearLabel:b=Ls.clear,isOpen:w,defaultOpen:N=!1,onOpenChange:D,isDisabled:v=!1,closeOnConfirm:S=!0,keepOpenAfterClear:M=!1})=>{const[k,F]=p.useState(N),[C,_]=p.useState(()=>Ms(u)),E=w??k,A=h??u.filter(Y=>Am(Y)).length,R=Y=>{Y&&_(Ms(u)),w||F(Y),D?.(Y)},O=(Y,Z)=>{_(Q=>({...Q,[Y.id]:Z}))},V=(Y,Z)=>{_(Q=>({...Q,[Y.id]:Z?[Z]:[]}))},q=async()=>{_(Ms(u.map(Y=>Y.type==="checkbox"?{...Y,selectedValues:[]}:{...Y,selectedValue:null}))),await m(),M||R(!1)},I=async()=>{const Y=$m(C,u);await f(Y),S&&R(!1)},J=Y=>{if(Y.type==="checkbox")return t.jsx(c.CheckboxGroup,{label:Y.label,value:C[Y.id]??[],onValueChange:Q=>O(Y,Q),children:Y.options.map(Q=>t.jsx(c.Checkbox,{value:Q.value,isDisabled:Q.isDisabled,children:Q.label},Q.value))},Y.id);const Z=C[Y.id]?.[0]??"";return t.jsx(c.RadioGroup,{label:Y.label,value:Z,onValueChange:Q=>V(Y,Q||null),children:Y.options.map(Q=>t.jsx(c.Radio,{value:Q.value,isDisabled:Q.isDisabled,children:Q.label},Q.value))},Y.id)},W=p.useMemo(()=>A>0?x?.(A)||`${A} filters applied`:void 0,[x,A]),se=p.useMemo(()=>A===0?e||Ls.noLabel:x?x(A):`${e} (${A})`,[A,e,x]);return t.jsx("div",{className:d,children:t.jsxs(c.Popover,{isOpen:E,onOpenChange:R,placement:"bottom-end",children:[t.jsx(c.PopoverTrigger,{children:t.jsxs(B,{isDisabled:v,variant:n,color:r,size:i,className:l,"aria-label":s,"aria-haspopup":"dialog","aria-expanded":E,children:[t.jsx(P,{icon:a,width:16}),t.jsx("span",{children:e}),g==="badge"&&A>0?t.jsx("span",{className:"ml-1 inline-flex h-5 min-w-5 items-center justify-center rounded-full bg-gray-900 px-1.5 text-xs font-medium text-white","aria-label":W,children:A}):g==="summary"&&se!==e?t.jsx("span",{className:"text-xs",children:se}):null]})}),t.jsx(c.PopoverContent,{className:o,children:t.jsxs("div",{className:"flex w-full flex-col gap-5 px-4 py-4",children:[u.map(Y=>J(Y)),t.jsxs("div",{className:"flex items-center justify-end gap-2 border-t border-gray-200 pt-3",children:[t.jsx(B,{variant:"light",color:"default",size:"sm",onPress:q,children:b}),t.jsx(B,{color:"primary",size:"sm",onPress:I,children:j})]})]})})]})})};ci.displayName="FilterPopover";const Dm="No sessions available for this date",Em=e=>e==="sold-out"||e==="closed"?"danger":"success",Fm=e=>{const s=e.seatsRemaining;return e.status==="sold-out"||e.status==="closed"?"Sold out":e.status==="limited"?typeof s=="number"?`${s} left`:"Limited":typeof s=="number"?`${s} seats available`:"Available"},Dn=e=>e.isDisabled?!0:e.status==="sold-out"||e.status==="closed",Lm=(e,s)=>s&&e.some(a=>a.date===s)?s:e[0]?.date??null,di=({heading:e,subheading:s,days:a,selectedDate:n,onDateSelect:r,quickDates:i,selectedSessionId:l=null,onSessionSelect:o,emptyStateMessage:d=Dm,statusLabel:u,statusTone:f,sessionAriaLabel:m,dayButtonClassName:h,calendarSlot:x,dayGroupAriaLabel:g,sessionGridAriaLabel:j,className:b,headingClassName:w,subheadingClassName:N})=>{const D=Lm(a,n),v=a.find(C=>C.date===D),S=i??a.map(C=>({date:C.date,label:C.label})),M=v?.sessions??[],k=C=>C===D?"solid":"bordered",F=C=>{if(!Dn(C)){if(C.id===l){o(null);return}o(C.id)}};return t.jsxs("section",{className:c.cn("flex flex-col gap-4 rounded-xl bg-white p-3 sm:p-4",b),"data-testid":"session-timeline-root",children:[t.jsxs("header",{className:"flex flex-col gap-1",children:[t.jsx("h2",{className:c.cn("text-base font-semibold text-gray-900",w),children:e}),s?t.jsx("p",{className:c.cn("text-sm text-gray-700",N),children:s}):null]}),t.jsxs("div",{className:"flex flex-wrap items-center gap-2",role:"group","aria-label":g||"Session days",children:[S.map(C=>t.jsx(B,{size:"sm",variant:k(C.date),color:"default",className:c.cn("rounded-full",h),isDisabled:C.isDisabled,onPress:()=>{r(C.date)},children:t.jsx("span",{children:C.label})},C.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:[M.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,M.map(C=>{const _=Dn(C),E=C.id===l;return t.jsx("li",{className:"rounded-xl",children:t.jsx(c.Card,{shadow:"sm",radius:"lg",isPressable:!_,onPress:()=>{F(C)},"aria-disabled":_,"aria-pressed":_?void 0:E,className:c.cn("w-full",_?"bg-gray-100 opacity-70":"",E?"w-full ring-2 ring-gray-900":""),"aria-label":m?m(C,{isSelected:E,isUnavailable:_}):_?`${C.startTime} ${C.endTime} sold out`:`${C.startTime} ${C.endTime} available`,children:t.jsxs(c.CardBody,{className:"flex flex-col items-center gap-3 p-4 text-center",children:[t.jsxs("span",{className:"text-sm font-semibold text-gray-900",children:[C.startTime," – ",C.endTime]}),t.jsx(c.Chip,{size:"sm",color:f?f(C):Em(C.status),variant:"flat",children:u?u(C):Fm(C)})]})})},C.id)})]})]})};di.displayName="SessionTimeline";const Qs=16,Ze=e=>`${e/Qs}rem`;function Mm(){if(typeof document>"u"||typeof getComputedStyle!="function")return Qs;const e=parseFloat(getComputedStyle(document.documentElement).fontSize);return Number.isFinite(e)&&e>0?e:Qs}const It=(e,s)=>e>=s*Mm(),_m=1120;function jt(){const e=p.useRef(null),[s,a]=p.useState(0),[,n]=p.useState("");return p.useLayoutEffect(()=>{const r=e.current;if(!r||typeof ResizeObserver>"u")return;const i=new ResizeObserver(l=>{const o=l[l.length-1];o&&a(o.borderBoxSize?.[0]?.inlineSize??o.contentRect.width)});return a(r.getBoundingClientRect().width),i.observe(r),()=>i.disconnect()},[]),p.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:s}}const Rm=48,Oe={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"},Tm=(e,s)=>typeof e=="string"?t.jsx(P,{icon:e,className:"size-5","aria-hidden":"true"}):e||s||null,ui=({title:e,subtitle:s,eyebrow:a,icon:n,initials:r,actions:i,titleAs:l="h1",className:o,classNames:d={},"data-testid":u="page-header",list:f,narrow:m,headerRef:h})=>{const x=Tm(n,r);return t.jsxs("header",{ref:h,"data-testid":u,"data-variant":f?"list":void 0,"data-size":f?m?"narrow":"wide":void 0,className:c.cn(f?c.cn(Oe.base,m?Oe.baseNarrow:Oe.baseWide):"flex flex-wrap items-start justify-between gap-4",o,d.base),children:[t.jsxs("div",{className:f?Oe.identity:"flex items-center gap-4",children:[x?t.jsx("div",{"aria-hidden":"true","data-testid":`${u}-icon`,className:c.cn("flex size-12 shrink-0 items-center justify-center rounded-xl bg-gray-900 text-sm font-semibold text-white",d.iconWrapper),children:x}):null,t.jsxs("div",{className:f?Oe.text:void 0,children:[a?t.jsx("p",{"data-testid":`${u}-eyebrow`,className:c.cn("text-brand text-sm font-medium uppercase tracking-wide",d.eyebrow),children:a}):null,t.jsx(l,{"data-testid":`${u}-title`,className:c.cn(f?m?Oe.titleNarrow:Oe.titleWide:"text-3xl font-semibold text-gray-950",d.title),children:e}),s?t.jsx("p",{"data-testid":`${u}-subtitle`,className:c.cn(f?m?Oe.subtitleNarrow:Oe.subtitleWide:"mt-1 text-sm text-gray-600",d.subtitle),children:s}):null]})]}),i?t.jsx("div",{"data-testid":`${u}-actions`,className:c.cn(f?m?Oe.actionsNarrow:Oe.actionsWide:"flex flex-wrap items-center gap-2",d.actions),children:i}):null]})},Im=e=>{const{ref:s,width:a}=jt(),n=a>0&&!It(a,Rm);return t.jsx(ui,{...e,list:!0,narrow:n,headerRef:s})},mi=e=>e.variant==="list"?t.jsx(Im,{...e}):t.jsx(ui,{...e,list:!1,narrow:!1});mi.displayName="PageHeader";const qe={ok:{fg:je.ok,bg:je["ok-fill"]},warn:{fg:je.warn,bg:je["warn-fill"]},danger:{fg:je.danger,bg:je["danger-fill"]},info:{fg:je.info,bg:je["info-fill"]},violet:{fg:je.violet,bg:je["violet-fill"]},neutral:{fg:je.neutral,bg:je["neutral-fill"]}};function Pt(e){if(e==="positive")return{color:je.ok};if(e==="negative")return{color:je.danger}}const Pm={active:"success",success:"success",draft:"warning",pending:"warning",warning:"warning",danger:"danger",archived:"default",inactive:"default",neutral:"default",info:"default",violet:"default"},Zs={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:qe.info,violet:qe.violet},Om={active:"ok",success:"ok",draft:"warn",pending:"warn",warning:"warn",danger:"danger",archived:"neutral",inactive:"neutral",neutral:"neutral",info:"info",violet:"violet"},zm={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]"},Bm={info:Zs.info,violet:Zs.violet},fi=({status:e,label:s,variant:a="flat",size:n="sm",color:r,startContent:i,className:l,"data-testid":o="status-chip"})=>{if(a==="plain"){const u=qe[Om[e]];return t.jsxs("span",{"data-testid":o,"data-status":e,"data-variant":"plain",className:c.cn("inline-flex items-center gap-1.5 whitespace-nowrap rounded-full font-normal",zm[n],"leading-[1.35]",l),style:{color:u.fg,backgroundColor:u.bg},children:[i,s]})}if(a==="dot"){const u=Zs[e];return t.jsxs("span",{"data-testid":o,"data-status":e,className:c.cn("inline-flex items-center gap-1.5 whitespace-nowrap rounded-full px-2.5 py-[3px] text-[12px] font-semibold leading-[1.4]",l),style:{color:u.fg,backgroundColor:u.bg},children:[t.jsx("span",{"aria-hidden":"true",className:"size-1.5 shrink-0 rounded-full",style:{backgroundColor:"currentColor"}}),s]})}const d=r?void 0:Bm[e];return t.jsx(c.Chip,{color:r??Pm[e],variant:a,size:n,startContent:i,"data-testid":o,"data-status":e,className:c.cn("font-medium",l),style:d?{color:d.fg,backgroundColor:d.bg}:void 0,children:s})};fi.displayName="StatusChip";const Vm={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"},Ut={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"},ka=({label:e,value:s,size:a="sm",variant:n="default",className:r,"data-testid":i="key-value-chip"})=>n==="record"?t.jsxs("span",{"data-testid":i,"data-variant":"record",className:c.cn(Ut.base,Ut[a],r),children:[t.jsx("span",{className:Ut.label,children:e}),t.jsx("span",{className:Ut.value,children:s})]}):t.jsxs("span",{"data-testid":i,className:c.cn("inline-flex items-baseline whitespace-nowrap border border-default-200 bg-default-100",Vm[a],r),children:[t.jsx("span",{className:"font-medium text-default-400",children:e}),t.jsx("span",{className:"font-semibold text-default-700",children:s})]});ka.displayName="KeyValueChip";const xi="(prefers-reduced-motion: reduce)",hi="data-pos-reduce-motion",Ot="motion-reduce:transition-none [html[data-pos-reduce-motion=true]_&]:transition-none",Um="motion-reduce:animate-none [html[data-pos-reduce-motion=true]_&]:animate-none",Zt=`rounded-[0.375rem] bg-[linear-gradient(90deg,#F0F0F1_0,#F9F9FA_12.5rem,#F0F0F1_25rem)] bg-[length:50rem_100%] animate-record-shimmer ${Um}`;function Hm(){return typeof document>"u"?!1:document.documentElement.getAttribute(hi)==="true"?!0:typeof window.matchMedia=="function"&&window.matchMedia(xi).matches}function qm(){const[e,s]=p.useState(!1);return p.useEffect(()=>{const a=()=>s(Hm()),n=typeof window.matchMedia=="function"?window.matchMedia(xi):null;n?.addEventListener?.("change",a);const r=typeof MutationObserver>"u"?null:new MutationObserver(a);return r?.observe(document.documentElement,{attributes:!0,attributeFilter:[hi]}),a(),()=>{n?.removeEventListener?.("change",a),r?.disconnect()}},[]),e}const pi=({columns:e,rows:s=6,label:a="Loading",barHeight:n=12,alignLastRight:r=!1,appearance:i="pulse",className:l,classNames:o={},"data-testid":d="table-skeleton"})=>t.jsxs("div",{role:"status","aria-busy":"true","data-testid":d,className:c.cn("w-full",l,o.base),children:[t.jsx("span",{className:"sr-only",children:a}),t.jsx("div",{"aria-hidden":"true",children:Array.from({length:s}).map((u,f)=>i==="shimmer"?t.jsx("div",{"data-testid":`${d}-row`,className:c.cn("flex items-center border-b border-pos-hair",o.row),children:e.map((m,h)=>{const x=h===e.length-1;return t.jsx("div",{className:c.cn("min-w-0 flex-1 px-4 py-5",r&&x&&"flex justify-end"),children:t.jsx("div",{className:c.cn(Zt,o.bar),style:{height:Ze(n),width:m==="fill"?"60%":Ze(m),maxWidth:"100%"}})},h)})},f):t.jsx("div",{"data-testid":`${d}-row`,className:c.cn("flex items-center gap-3 border-t border-default-100 px-5 py-4",o.row),children:e.map((m,h)=>{const x=h===e.length-1;return t.jsx("div",{className:c.cn(m==="fill"?"flex-1":"shrink-0",r&&x&&"flex justify-end"),style:m==="fill"?void 0:{width:m},children:t.jsx("div",{className:c.cn("animate-pulse rounded bg-default-200",o.bar),style:{height:n,width:m==="fill"?"60%":m}})},h)})},f))})]});pi.displayName="TableSkeleton";const gi="text-left text-[11px] font-semibold uppercase tracking-[.04em] text-acct-sub px-4 pt-4 pb-3 whitespace-nowrap bg-transparent",bi="px-4 text-[13.5px] text-acct-ink2 align-middle",yi="border-t border-acct-hair transition-colors duration-150 hover:bg-acct-page data-[hover=true]:bg-acct-page",vi="w-full",ji="border-t border-acct-border px-5 py-3.5",Ht={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 ${Ot}`,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:s,emptyContent:a,footer:n,ariaLabel:r,variant:i="default",className:l,classNames:o={},"data-testid":d="admin-table"})=>{const u=i==="framed";return t.jsxs("div",{className:c.cn(u&&Ht.base,l,o.base),"data-testid":d,"data-variant":u?"framed":void 0,children:[t.jsxs(c.Table,{"aria-label":r,removeWrapper:!0,classNames:{table:c.cn(vi,o.table),th:c.cn(u?Ht.th:gi,o.th),tr:c.cn(u?Ht.tr:yi,o.tr),td:c.cn(u?Ht.td:bi,o.td)},children:[t.jsx(c.TableHeader,{columns:e,children:f=>t.jsx(c.TableColumn,{align:f.align==="right"?"end":"start",width:f.width,children:f.label},f.key)}),t.jsx(c.TableBody,{emptyContent:a,children:s})]}),n?t.jsx("div",{"data-testid":`${d}-footer`,className:c.cn(!u&&ji,o.footer),children:n}):null]})};wi.displayName="AdminTable";const Wm={md:"w-[280px]",lg:"w-[360px]"},Ym=48,ze={base:"flex flex-wrap items-center gap-2.5 border-b border-pos-hair px-4 py-[0.875rem]",narrow:"[&_[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",searchNarrow:"basis-full",inputBaseMd:"w-[15.625rem]",inputBaseLg:"w-[22.5rem]",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.4375rem]",input:"text-ellipsis text-[0.875rem] text-default-900 data-[has-start-content=true]:ps-0",icon:"flex text-default-400 [&_svg]:size-4"},Gm=({searchValue:e,onSearchChange:s,searchLabel:a,searchPlaceholder:n,searchIcon:r,children:i,trailing:l,searchWidth:o="md",className:d,"data-testid":u="admin-toolbar"})=>{const{ref:f,width:m}=jt(),h=m>0&&!It(m,Ym);return t.jsxs("div",{ref:f,role:"search","data-testid":u,"data-variant":"framed","data-size":h?"narrow":"wide",className:c.cn(ze.base,h&&ze.narrow,d),children:[i,t.jsx("div",{"data-testid":`${u}-search-slot`,className:h?ze.searchNarrow:ze.searchWide,children:t.jsx(c.Input,{type:"search","aria-label":a,placeholder:n??a,value:e,onValueChange:s,startContent:t.jsx("span",{"aria-hidden":"true","data-testid":`${u}-search-icon`,className:ze.icon,children:r??t.jsx(P,{icon:"lucide:search"})}),"data-testid":`${u}-search`,variant:"bordered",radius:"none",classNames:{base:h?ze.inputBaseNarrow:o==="lg"?ze.inputBaseLg:ze.inputBaseMd,inputWrapper:ze.inputWrapper,innerWrapper:ze.innerWrapper,input:ze.input}})}),l]})},Ni=({searchValue:e,onSearchChange:s,searchLabel:a,searchPlaceholder:n,searchIcon:r,children:i,trailing:l,searchWidth:o="md",variant:d="default",className:u,"data-testid":f="admin-toolbar"})=>d==="framed"?t.jsx(Gm,{searchValue:e,onSearchChange:s,searchLabel:a,searchPlaceholder:n,searchIcon:r,trailing:l,searchWidth:o,className:u,"data-testid":f,children:i}):t.jsxs("div",{role:"search","data-testid":f,className:c.cn("flex flex-wrap items-center gap-3 mb-4",u),children:[t.jsx(c.Input,{type:"search","aria-label":a,placeholder:n??a,value:e,onValueChange:s,startContent:r?t.jsx("span",{"aria-hidden":"true",className:"flex text-acct-muted",children:r}):void 0,"data-testid":`${f}-search`,variant:"bordered",radius:"none",classNames:{base:Wm[o],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"}}),i,l?t.jsx("div",{className:"ml-auto",children:l}):null]});Ni.displayName="AdminToolbar";const Km="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",Qm="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",Zm="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",Ci=p.forwardRef(function({icon:s,children:a,count:n,appearance:r="pill",className:i,testId:l,...o},d){return r==="outline"?t.jsxs(B,{ref:d,"data-testid":l,"data-appearance":"outline",color:"default",variant:"bordered",radius:"md",size:"md",className:c.cn("rounded-[0.75rem] font-normal",i),...o,children:[t.jsx(P,{icon:s,className:"size-4","aria-hidden":!0}),t.jsx("span",{children:a}),n!==void 0&&n>0&&t.jsx("span",{className:Qm,children:n})]}):t.jsxs(B,{ref:d,"data-testid":l,variant:"light",size:"sm",className:c.cn(Zm,i),...o,children:[t.jsx(P,{icon:s,className:"size-4 text-gray-500","aria-hidden":!0}),t.jsx("span",{children:a}),n!==void 0&&n>0&&t.jsx("span",{className:Km,children:n})]})});Ci.displayName="ToolbarButton";function ki({items:e,value:s,onChange:a,ariaLabel:n,className:r,"data-testid":i="underline-tabs"}){return t.jsx(c.Tabs,{"aria-label":n,variant:"underlined",selectedKey:s,onSelectionChange:l=>a(String(l)),"data-testid":i,classNames:{base:c.cn("w-full mb-6",r),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",tabContent:"text-[15px] font-medium text-acct-sub group-data-[selected=true]:font-semibold group-data-[selected=true]:text-acct-rust",panel:"p-0"},children:e.map(l=>t.jsx(c.Tab,{title:l.label,"data-testid":`${i}-${l.key}`,children:l.content},l.key))})}ki.displayName="UnderlineTabs";const Sa="text-[11px] font-semibold uppercase tracking-[.04em] text-acct-muted mb-1.5",$a="font-normal normal-case tracking-normal",Si=["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(" "),$i="text-[13.5px] text-acct-ink",Ai="bg-acct-page text-acct-muted cursor-default",Di="mt-[5px] text-xs text-acct-sub",Ei="mt-[5px] text-xs text-acct-danger",Fi=({children:e,suffix:s,className:a,"data-testid":n="admin-field-label"})=>t.jsxs("div",{"data-testid":n,className:c.cn(Sa,a),children:[e,s?t.jsxs("span",{className:$a,children:[" ",s]}):null]});Fi.displayName="AdminFieldLabel";const Li=({label:e,labelSuffix:s,value:a,onChange:n,placeholder:r,disabled:i=!1,readOnly:l=!1,mono:o=!1,autoFocus:d=!1,hint:u,invalid:f=!1,className:m,"data-testid":h="admin-text-field"})=>t.jsx(c.Input,{labelPlacement:e?"outside":void 0,label:e&&s?t.jsxs(t.Fragment,{children:[e,t.jsxs("span",{className:$a,children:[" ",s]})]}):e,value:a,placeholder:r,isDisabled:i,isReadOnly:l,autoFocus:d,isInvalid:f,description:!f&&u?u:void 0,errorMessage:f?u:void 0,onValueChange:n,"data-testid":h,variant:"bordered",radius:"none",classNames:{base:c.cn("w-full",m),label:Sa,inputWrapper:Si,input:c.cn($i,(o||l)&&"font-mono",l&&Ai),description:Di,errorMessage:Ei}});Li.displayName="AdminTextField";const Xm={sm:"size-6 min-w-6",md:"size-[30px] min-w-[30px]"},Mi=({actions:e,size:s="md",className:a,"data-testid":n="row-actions"})=>t.jsx("div",{role:"presentation","data-testid":n,className:c.cn("inline-flex gap-0.5",a),onClick:r=>r.stopPropagation(),children:e.map(r=>t.jsx(B,{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:c.cn("text-acct-sub data-[hover=true]:bg-acct-hair",Xm[s]),children:r.icon},r.key))});Mi.displayName="RowActions";const _i=({children:e,placeholder:s="Select…",onOpen:a,onClear:n,ariaLabel:r,icon:i,trailingIcon:l,clearIcon:o,disabled:d=!1,className:u,"data-testid":f="picker-row"})=>{const m=e!=null;return t.jsxs("div",{"data-testid":f,className:c.cn("flex w-full min-h-10 items-center rounded-[10px] border border-acct-border bg-acct-surface px-[11px] transition-colors duration-150",d?"opacity-60":"hover:border-acct-rust-border",u),children:[t.jsxs(B,{variant:"light",radius:"none",disableAnimation:!0,onPress:a,isDisabled:d,"aria-haspopup":"dialog","aria-label":r,"data-testid":`${f}-trigger`,className:"flex h-auto min-h-0 min-w-0 flex-1 items-center justify-start gap-2.5 bg-transparent px-0 py-2 text-left text-inherit data-[hover=true]:bg-transparent",children:[i?t.jsx("span",{className:"flex shrink-0 text-acct-muted",children:i}):null,m?t.jsx("span",{className:"flex min-w-0 items-center gap-2",children:e}):t.jsx("span",{className:"text-[13.5px] font-semibold text-acct-sub",children:s}),l?t.jsx("span",{className:"ml-auto flex shrink-0 text-acct-muted",children:l}):null]}),m&&n?t.jsx(B,{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:o}):null]})};_i.displayName="PickerRow";function Ri(e,s,a){if(a<=0||s<=0||e<=0)return{from:0,to:0};const n=(e-1)*s+1;return n>a?{from:0,to:0}:{from:n,to:Math.min(a,e*s)}}const Ti=({page:e,pageSize:s,total:a,unit:n,announce:r=!0,className:i,classNames:l={},"data-testid":o="pagination-summary"})=>{const{from:d,to:u}=Ri(e,s,a),f=c.cn("font-semibold text-default-700",l.emphasis);return t.jsxs("p",{"data-testid":o,"aria-live":r?"polite":void 0,className:c.cn("text-sm text-default-500",i,l.base),children:["Showing"," ",t.jsx("span",{"data-testid":`${o}-range`,className:f,children:d===0?0:`${d}–${u}`})," ","of"," ",t.jsx("span",{"data-testid":`${o}-total`,className:f,children:a}),n?t.jsxs(t.Fragment,{children:[" ",n]}):null]})};Ti.displayName="PaginationSummary";const fs="shadow-[0_1px_4px_rgba(0,0,0,.06),0_4px_12px_rgba(0,0,0,.06)]",Qe={base:`overflow-hidden rounded-2xl border border-pos-line bg-white ${fs}`,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"},Jm={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]"},ef={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:""}},Ii=({isLoading:e=!1,isError:s=!1,isEmpty:a=!1,loadingTitle:n="Loading…",loadingContent:r,errorTitle:i="Something went wrong",errorDescription:l,retryLabel:o="Retry",onRetry:d,errorActions:u,errorContent:f,emptyTitle:m="Nothing here yet",emptyDescription:h,emptyIcon:x,emptyActions:g,emptyContent:j,children:b,toolbar:w,variant:N="default",className:D,classNames:v={},"data-testid":S="list-panel"})=>{const M=N==="framed",k={base:c.cn("border-0 bg-transparent py-12",v.state)},F=M?{base:c.cn("px-6 py-[3.625rem]",v.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"}:k;let C;return e?C=r??t.jsx(Na,{title:n,classNames:k,"data-testid":`${S}-loading`}):s?C=f??t.jsx(wa,{title:i,description:l,classNames:k,"data-testid":`${S}-error`,actions:u??(d?t.jsx(B,{color:"primary",variant:"flat",onPress:d,children:o}):void 0)}):a?C=j??t.jsx(ja,{surface:M?"panel":void 0,title:m,description:h,icon:x,actions:g,classNames:F,"data-testid":`${S}-empty`}):C=b,t.jsxs("section",{"data-testid":S,"data-variant":M?"framed":void 0,className:c.cn(M?`overflow-hidden rounded-2xl border border-pos-line bg-white ${fs}`:"rounded-xl bg-white p-2 shadow-sm",D,v.base),children:[w,C]})};Ii.displayName="ListPanel";const Pi=(e,s)=>s<=0?/^\d*$/.test(e):new RegExp(`^\\d*(?:[.,]\\d{0,${s}})?$`).test(e),rs=e=>{const s=Number.parseFloat(e.replace(",","."));return Number.isFinite(s)?s:null},Oi=(e,s)=>{const[a,n]=p.useState(()=>s(e)),r=(rs(a)??0)===(e??0)?a:s(e),i=p.useCallback(()=>{n(l=>{const o=rs(l);return o===null?"":String(o)})},[]);return{draft:r,setDraft:n,normalize:i}},tf=350,sf={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}"},_s=(e,s)=>Object.entries(s).reduce((a,[n,r])=>a.replace(`{${n}}`,r),e),af=({dueAmount:e,received:s,defaultReceived:a=null,onChange:n,locale:r="en-US",labels:i,isDisabled:l=!1,maxAmount:o,autoFocus:d=!1,className:u,"data-testid":f="cash-tender-form"})=>{const m={...sf,...i},h=Rt(e.currency,r),x=s!==void 0,[g,j]=p.useState(a??null),b=x?s:g,{draft:w,setDraft:N,normalize:D}=Oi(b,V=>V==null?"":String(V)),v=p.useMemo(()=>{const V=typeof b=="number"&&Number.isFinite(b)?b:0,q=Hs(V,e.value,e.currency,r);return{received:V,change:q>0?q:0,isValid:V>=e.value&&V>0}},[b,e.value,e.currency,r]),S=p.useCallback(V=>{const q=V.currentTarget;requestAnimationFrame(()=>{q.isConnected&&q.select()})},[]),M=p.useCallback(V=>{if(l)return;const q=V.replace(/[^\d.,]/g,"");if(!Pi(q,h))return;const I=rs(q);if(I!==null&&o!==void 0&&I>o)return;N(q),x||j(I);const J=typeof I=="number"&&Number.isFinite(I)?I:0,W=Hs(J,e.value,e.currency,r);n?.({received:J,change:W>0?W:0,isValid:J>=e.value&&J>0})},[x,l,e.value,e.currency,r,n,o,N,h]),k=v.isValid&&v.change>0,F=!v.isValid&&v.received>0,C=ge(v.change,r,e.currency),_=ge(e.value,r,e.currency),[E,A]=p.useState(""),R=p.useRef(null);p.useEffect(()=>{R.current&&clearTimeout(R.current);const V=k?_s(m.changeMessageTemplate,{change:C}):"",q=k?tf:0;return R.current=setTimeout(()=>A(V),q),()=>{R.current&&clearTimeout(R.current)}},[k,C,m.changeMessageTemplate]);const O=`${f}-received`;return t.jsxs("div",{className:c.cn("flex flex-col gap-3",u),"data-testid":f,children:[t.jsx(c.Input,{id:O,label:m.receivedLabel,labelPlacement:"outside",type:"text",inputMode:h===0?"numeric":"decimal",pattern:h===0?"[0-9]*":"[0-9]*[.,]?[0-9]*",value:w,onChange:V=>M(V.target.value),onFocus:S,onBlur:D,placeholder:m.receivedPlaceholder,isDisabled:l,isInvalid:F,errorMessage:F?_s(m.insufficientMessageTemplate,{due:_}):void 0,variant:"bordered",radius:"lg",autoFocus:d,"data-testid":`${f}-received-input`}),k&&t.jsx(c.Alert,{"data-testid":`${f}-change-alert`,color:"primary",variant:"flat",radius:"lg",title:m.changeLabel,description:_s(m.changeMessageTemplate,{change:C}),icon:t.jsx(P,{icon:"lucide:info",width:20,height:20,"aria-hidden":"true"}),"aria-live":"off",classNames:{base:"bg-info-50 text-info-700",title:"font-semibold",description:"text-sm leading-relaxed",iconWrapper:"bg-transparent shadow-none border-0"}}),t.jsx("span",{role:"status","aria-live":"polite",className:"sr-only",children:E})]})},nf={checkNumberLabel:"Check Number",checkNumberPlaceholder:"e.g. 11234",bankNameLabel:"Bank Name",bankNamePlaceholder:"e.g. Chase Bank",dateLabel:"Date",checkNumberRequiredMessage:"Check number is required"},En=()=>{const e=new Date,s=a=>String(a).padStart(2,"0");return`${e.getFullYear()}-${s(e.getMonth()+1)}-${s(e.getDate())}`},zi=({dueAmount:e,value:s,defaultValue:a,onChange:n,labels:r,hideDate:i=!1,hideBankName:l=!1,isDisabled:o=!1,checkNumberMaxLength:d=34,bankNameMaxLength:u=100,autoFocus:f=!1,className:m,"data-testid":h="check-tender-form"})=>{const x={...nf,...r},g=s!==void 0,[j,b]=p.useState({checkNumber:a?.checkNumber??"",bankName:a?.bankName??"",date:a?.date??En()}),[w,N]=p.useState(!!a?.checkNumber),D=p.useMemo(()=>g?{checkNumber:s?.checkNumber??"",bankName:s?.bankName??"",date:s?.date??En()}:j,[g,s,j]),v=p.useCallback(E=>{g||b(E);const A=E.checkNumber.trim(),R={amount:e.value,checkNumber:A,bankName:E.bankName.trim()||void 0,date:i?void 0:E.date,isValid:A.length>0&&e.value>0};n?.(R)},[g,e.value,i,n]),S=p.useCallback(E=>A=>{o||(E==="checkNumber"&&A.length>0&&N(!0),v({...D,[E]:A}))},[D,v,o]),M=p.useCallback(()=>{o||N(!0)},[o]),k=w&&D.checkNumber.trim()==="",F=`${h}-check-number`,C=`${h}-bank-name`,_=`${h}-date`;return t.jsxs("div",{className:c.cn("grid grid-cols-1 sm:grid-cols-2 gap-4",m),"data-testid":h,children:[t.jsx(c.Input,{id:F,label:x.checkNumberLabel,labelPlacement:"outside",type:"text",value:D.checkNumber,onChange:E=>S("checkNumber")(E.target.value),onBlur:M,placeholder:x.checkNumberPlaceholder,maxLength:d,isRequired:!0,isInvalid:k,errorMessage:k?x.checkNumberRequiredMessage:void 0,isDisabled:o,variant:"bordered",radius:"lg",autoFocus:f,"data-testid":`${h}-check-number-input`}),!l&&t.jsx(c.Input,{id:C,label:x.bankNameLabel,labelPlacement:"outside",type:"text",value:D.bankName,onChange:E=>S("bankName")(E.target.value),placeholder:x.bankNamePlaceholder,maxLength:u,isDisabled:o,variant:"bordered",radius:"lg","data-testid":`${h}-bank-name-input`}),!i&&t.jsx(c.Input,{id:_,label:x.dateLabel,labelPlacement:"outside",type:"date",value:D.date,onChange:E=>S("date")(E.target.value),isDisabled:o,variant:"bordered",radius:"lg","data-testid":`${h}-date-input`,className:"sm:col-span-2"})]})};zi.displayName="CheckTenderForm";const rf={methodLabel:"Method",methodPlaceholder:"Select a payment method",referenceLabel:"Reference",referencePlaceholder:"e.g. Voucher #1234",methodRequiredMessage:"Method is required"},lf=[{value:"ach",label:"ACH"},{value:"wire",label:"Wire"},{value:"gift_card",label:"Gift Card"},{value:"voucher",label:"Voucher"},{value:"other",label:"Other"}],Bi=({dueAmount:e,methodOptions:s=lf,value:a,defaultValue:n,onChange:r,labels:i,showReference:l=!1,isDisabled:o=!1,className:d,"data-testid":u="other-tender-form"})=>{const f={...rf,...i},m=a!==void 0,[h,x]=p.useState({method:n?.method??"",reference:n?.reference??""}),g=p.useMemo(()=>m?{method:a?.method??"",reference:a?.reference??""}:h,[m,a,h]),j=p.useCallback(S=>s.find(M=>M.value===S)?.label??"",[s]),b=p.useCallback(S=>{m||x(S);const M=j(S.method),k={amount:e.value,method:S.method,description:M,reference:S.reference.trim()||void 0,isValid:S.method!==""};r?.(k)},[m,e.value,r,j]),w=p.useCallback(S=>{if(o)return;const M=typeof S=="string"?S:Array.from(S)[0]?.toString()??"";b({...g,method:M})},[g,b,o]),N=p.useCallback(S=>{o||b({...g,reference:S})},[g,b,o]),D=`${u}-method`,v=`${u}-reference`;return t.jsxs("div",{className:c.cn("flex flex-col gap-3",d),"data-testid":u,children:[t.jsx(He,{id:D,label:f.methodLabel,labelPlacement:"outside",placeholder:f.methodPlaceholder,selectedKeys:g.method?[g.method]:[],onSelectionChange:w,isDisabled:o,isRequired:!0,variant:"bordered",radius:"lg","data-testid":`${u}-method-select`,popoverProps:{placement:"bottom-start",classNames:{content:"bg-white border border-default-200 shadow-lg rounded-xl p-1"}},listboxProps:{classNames:{list:"max-h-[var(--popover-available-height,40vh)] overflow-y-auto"},itemClasses:{base:["rounded-lg","px-3 py-2","text-default-800","data-[hover=true]:bg-default-100","data-[selectable=true]:focus:bg-default-100","data-[selected=true]:bg-primary-50","data-[selected=true]:text-primary","data-[selected=true]:font-medium"]}},children:s.map(S=>t.jsx(c.SelectItem,{"data-testid":`${u}-method-option-${S.value}`,children:S.label},S.value))}),l&&t.jsx(c.Input,{id:v,label:f.referenceLabel,labelPlacement:"outside",type:"text",value:g.reference,onChange:S=>N(S.target.value),placeholder:f.referencePlaceholder,isDisabled:o,variant:"bordered",radius:"lg","data-testid":`${u}-reference-input`})]})};Bi.displayName="OtherTenderForm";const of={collectedHeading:"Collected",remainingLabel:"Remaining:",completeLabel:"Complete",removeAriaLabel:"Remove this tender",removeTooltipForRecorded:"Already recorded",statusPending:"Pending",statusRecorded:"Approved",statusFailed:"Failed"},cf={card:"lucide:credit-card",cash:"lucide:dollar-sign",check:"lucide:edit-3",other:"lucide:more-horizontal"},df={pending:"warning",recorded:"success",failed:"danger"},uf=e=>e==="pending"||e==="recorded",mf=e=>`#${e+1}`,Vi=({total:e,tenders:s,onRemove:a,locale:n="en-US",labels:r,hideCollectedList:i=!1,variant:l="banner",className:o,"data-testid":d="split-payment-summary"})=>{const u={...of,...r},{collected:f,remaining:m,isComplete:h}=p.useMemo(()=>{const g=s.reduce((b,w)=>uf(w.status)?b+w.amount:b,0),j=Math.max(e.value-g,0);return{collected:g,remaining:j,isComplete:g>=e.value&&e.value>0}},[s,e.value]),x=g=>g==="pending"?u.statusPending:g==="recorded"?u.statusRecorded:u.statusFailed;return t.jsxs("div",{className:c.cn("flex flex-col gap-4",o),"data-testid":d,children:[l==="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:h?u.completeLabel:u.remainingLabel}),t.jsx("span",{className:"text-base font-semibold tracking-tight","data-testid":`${d}-remaining-amount`,children:ge(h?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:h?u.completeLabel:u.remainingLabel}),t.jsx("div",{className:"mt-1 text-4xl font-bold tracking-tight","data-testid":`${d}-remaining-amount`,children:ge(h?f:m,n,e.currency)})]}),!i&&s.length>0&&t.jsxs("div",{className:"flex flex-col gap-2","data-testid":`${d}-collected-list`,children:[t.jsx("h3",{className:"text-base font-semibold",children:u.collectedHeading}),s.map((g,j)=>t.jsx(ff,{index:j,tender:g,locale:n,currency:e.currency,removable:!!a&&g.status!=="recorded",onRemove:a?()=>a(g.id):void 0,statusLabel:x(g.status),removeAriaLabel:u.removeAriaLabel,recordedTooltip:u.removeTooltipForRecorded,dataTestId:`${d}-row-${j}`},g.id))]})]})};Vi.displayName="SplitPaymentSummary";const ff=({index:e,tender:s,locale:a,currency:n,removable:r,onRemove:i,statusLabel:l,removeAriaLabel:o,recordedTooltip:d,dataTestId:u})=>{const f=i?t.jsx(B,{isIconOnly:!0,variant:"light",radius:"full",size:"sm",onPress:i,isDisabled:!r,"aria-label":o,"data-testid":`${u}-remove`,className:c.cn(r?"text-default-700 hover:bg-default-200":"text-default-300"),children:t.jsx(P,{icon:"lucide:x",width:18,height:18,"aria-hidden":"true"})}):null;return t.jsxs("div",{className:"flex items-center gap-3 rounded-xl bg-default-50 px-4 py-3 motion-safe:animate-[pp-row-in_200ms_ease-out]","data-testid":u,children:[t.jsx("span",{className:"text-sm font-medium text-default-500 w-6 shrink-0",children:mf(e)}),t.jsx(P,{icon:cf[s.type],width:20,height:20,className:"text-default-700 shrink-0","aria-hidden":"true"}),t.jsx("span",{className:"flex-1 truncate","data-testid":`${u}-label`,children:s.label}),t.jsx("span",{className:"font-semibold tabular-nums","data-testid":`${u}-amount`,children:ge(s.amount,a,n)}),t.jsx(c.Chip,{size:"sm",radius:"full",variant:"flat",color:df[s.status],startContent:s.status==="recorded"?t.jsx(P,{icon:"lucide:check-circle",width:14,height:14,"aria-hidden":"true"}):s.status==="failed"?t.jsx(P,{icon:"lucide:alert-circle",width:14,height:14,"aria-hidden":"true"}):void 0,"data-testid":`${u}-status`,children:l}),f&&(r?f:t.jsx(c.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 @@ ${a}${n}
|
|
|
38
38
|
from { opacity: 0; transform: translateY(-6px); }
|
|
39
39
|
to { opacity: 1; transform: translateY(0); }
|
|
40
40
|
}
|
|
41
|
-
`,Ui=p.forwardRef(({children:e,relativeOverlayRoot:s=!0,className:a,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:c.cn("flex flex-col gap-4 p-4 rounded-3xl bg-white shadow-xl","md:gap-5 md:p-6",s&&"relative","motion-safe:animate-[pp-modal-in_220ms_ease-out]","motion-safe:transition-[min-height] motion-safe:duration-[420ms] motion-safe:ease-in-out",a),children:e})]}));Ui.displayName="ModalShell";const Hi=({title:e,subtitle:s,leading:a,titleClassName:n,onClose:r,closeLabel:i="Close",actions:l,className:o,"data-testid":d="modal-shell-header"})=>t.jsxs("header",{className:c.cn("flex items-center justify-between gap-3",o),"data-testid":d,children:[t.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[a,t.jsxs("div",{className:"min-w-0",children:[t.jsx("h2",{className:c.cn("text-xl font-semibold",n),"data-testid":`${d}-title`,children:e}),s&&t.jsx("div",{className:"text-xs font-semibold text-default-500","data-testid":`${d}-subtitle`,children:s})]})]}),t.jsxs("div",{className:"flex items-center gap-2",children:[l,r&&t.jsx(B,{isIconOnly:!0,variant:"light",radius:"full",size:"sm",onPress:r,"aria-label":i,"data-testid":`${d}-close`,children:t.jsx(P,{icon:"lucide:x",width:20,height:20,"aria-hidden":"true"})})]})]});Hi.displayName="ModalShellHeader";const qi=({children:e,columns:s=2,className:a,"data-testid":n="modal-shell-footer"})=>t.jsx("footer",{className:c.cn("mt-2 gap-3",s===2?"flex flex-col md:grid md:grid-cols-2 [&>*]:w-full [&>*:first-child]:md:order-2 [&>*:nth-child(2)]:md:order-1":"grid grid-cols-1",a),"data-testid":n,children:e});qi.displayName="ModalShellFooter";const hf={2:"sm:grid-cols-2",3:"sm:grid-cols-3",4:"sm:grid-cols-4"},pf={1:"grid-cols-1",2:"grid-cols-2"},Rs=e=>typeof e=="string"?t.jsx(P,{icon:e,width:20,height:20,"aria-hidden":"true"}):e,qt="h-[34px] min-h-0 min-w-fit flex-1 whitespace-nowrap rounded-full px-[10px] text-[13px] font-medium transition-colors",gf="pointer-events-none absolute -left-[9999px] top-0 flex flex-row gap-1 p-1 opacity-0",Fn="flex-none",bf=typeof window<"u"?p.useLayoutEffect:p.useEffect,Ln=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",Wi=({options:e,selectedKey:s,onSelect:a,heading:n,ariaLabel:r="Select an option",variant:i="tiles",maxVisible:l,moreLabel:o="More",columnsDesktop:d=3,columnsMobile:u=2,className:f,"data-testid":m="tile-select"})=>{const h=e.find(x=>x.key===s);return i==="compact"?t.jsx(yf,{options:e,selectedKey:s,onSelect:a,ariaLabel:r,moreLabel:o,dataTestId:m,...n!==void 0?{heading:n}:{},...l!==void 0?{maxVisible:l}:{},...f!==void 0?{className:f}:{}}):t.jsxs("div",{className:c.cn("flex flex-col gap-3",f),"data-testid":m,children:[n&&t.jsx("h3",{className:"text-sm font-medium text-default-700",id:`${m}-heading`,children:n}),t.jsx("div",{className:"md:hidden",children:t.jsx(He,{"aria-label":n?void 0:r,"aria-labelledby":n?`${m}-heading`:void 0,selectedKeys:s?[s]:[],onSelectionChange:x=>{const j=Array.from(x)[0];typeof j=="string"&&a(j)},placeholder:r,variant:"bordered",radius:"lg","data-testid":`${m}-mobile-select`,startContent:h?t.jsx("span",{"aria-hidden":"true",className:"shrink-0",children:Rs(h.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(x=>t.jsx(c.SelectItem,{isDisabled:x.isDisabled,startContent:t.jsx("span",{"aria-hidden":"true",className:"shrink-0",children:Rs(x.icon)}),"data-testid":x["data-testid"]??`${m}-${x.key}-mobile`,children:x.label},x.key))})}),t.jsx("div",{role:"group","aria-labelledby":n?`${m}-heading`:void 0,"aria-label":n?void 0:r,className:c.cn("hidden md:grid gap-3",pf[u],hf[d]),children:e.map(x=>{const g=s===x.key;return t.jsxs(B,{variant:"bordered",radius:"lg","aria-pressed":g,"aria-label":x.label,isDisabled:x.isDisabled,onPress:()=>a(x.key),"data-testid":x["data-testid"]??`${m}-${x.key}`,className:c.cn("flex flex-col items-center justify-center gap-2 h-auto min-h-[80px] px-4 py-4","border bg-transparent transition-colors",g?"border-primary bg-primary-50 text-primary":"border-default-200 text-default-800 hover:bg-default-50"),children:[t.jsx("span",{"aria-hidden":"true",children:Rs(x.icon)}),t.jsx("span",{className:"text-sm font-medium",children:x.label})]},x.key)})})]})};Wi.displayName="TileSelect";function yf({options:e,selectedKey:s,onSelect:a,heading:n,ariaLabel:r,maxVisible:i,moreLabel:l,className:o,dataTestId:d}){const u=p.useRef(null),f=p.useRef(null),m=p.useMemo(()=>e.map((F,C)=>({option:F,index:C})).filter(({option:F})=>F.alwaysInMenu!==!0).map(({index:F})=>F),[e]),h=m.length<e.length,x=p.useCallback(F=>{const C=m.map(E=>({index:E,priority:e[E]?.priority??0})).sort((E,D)=>E.priority-D.priority||D.index-E.index),_=new Set(C.slice(0,m.length-F).map(E=>E.index));return m.filter(E=>!_.has(E))},[e,m]),[g,j]=p.useState(e.length);bf(()=>{const F=u.current,C=f.current;if(!F||!C)return;const _=()=>{const D=Array.from(C.children),R=D.slice(0,e.length).map(W=>W.getBoundingClientRect().width),O=D[e.length]?.getBoundingClientRect().width??0,V=window.getComputedStyle(F),q=Number.parseFloat(V.columnGap)||0,I=F.clientWidth-(Number.parseFloat(V.paddingLeft)||0)-(Number.parseFloat(V.paddingRight)||0);if(I<=0||R.some(W=>W===0)){j(m.length);return}const J=W=>{const se=h||W<m.length,Y=W+(se?1:0);return x(W).reduce((Q,ee)=>Q+(R[ee]??0),0)+(se?O:0)+q*(Y-1)<=I};for(let W=m.length;W>=1;W-=1)if(J(W)){j(W);return}j(1)};_();const E=new ResizeObserver(_);return E.observe(F),()=>E.disconnect()},[e,l,x,m,h]);const b=Math.max(1,Math.min(g,i??m.length,m.length)),N=!h&&b===m.length-1&&g===m.length?m.length:b,$=h||N<m.length,v=new Set(x(N)),A=e.filter((F,C)=>v.has(C)),M=$?e.filter((F,C)=>!v.has(C)):[],k=M.find(F=>F.key===s);return t.jsxs("div",{className:c.cn("relative flex flex-col gap-3",o),"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:[A.map(F=>t.jsx(B,{variant:"light",radius:"full","aria-pressed":s===F.key,isDisabled:F.isDisabled,onPress:()=>a(F.key),"data-testid":F["data-testid"]??`${d}-${F.key}`,className:c.cn(qt,Ln(s===F.key)),children:F.label},F.key)),M.length>0&&t.jsxs(c.Dropdown,{placement:"bottom-end",radius:"lg",children:[t.jsx(c.DropdownTrigger,{children:t.jsxs(B,{variant:"light",radius:"full","aria-pressed":k!==void 0,"data-testid":`${d}-more`,className:c.cn(qt,"gap-1",k!==void 0?"min-w-0":"min-w-fit",Ln(k!==void 0)),children:[t.jsx("span",{className:"min-w-0 truncate",children:k?.label??l}),t.jsx(P,{icon:"lucide:chevron-down",width:14,height:14,"aria-hidden":"true"})]})}),t.jsx(c.DropdownMenu,{"aria-label":l,className:"w-64 p-2",selectionMode:"single",selectedKeys:k?[k.key]:[],disabledKeys:M.filter(F=>F.isDisabled).map(F=>F.key),onAction:F=>a(String(F)),children:M.map(F=>t.jsx(c.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:gf,children:[e.map(F=>t.jsx(B,{variant:"light",radius:"full",tabIndex:-1,className:c.cn(qt,Fn),children:F.label},F.key)),t.jsxs(B,{variant:"light",radius:"full",tabIndex:-1,className:c.cn(qt,Fn,"gap-1"),children:[l,t.jsx(P,{icon:"lucide:chevron-down",width:14,height:14})]})]})]})}const vf={subtle:{wrapper:"bg-default-100",amount:"text-default-900"},success:{wrapper:"bg-success-50 text-success-700",amount:"text-success-700"}},Yi=({total:e,label:s,locale:a="en-US",variant:n="subtle",className:r,"data-testid":i="payment-total-banner"})=>{const l=vf[n];return t.jsxs("div",{"data-testid":i,className:c.cn("rounded-2xl px-6 py-5 text-center",l.wrapper,r),children:[t.jsx("div",{className:"text-sm text-default-600",children:s}),t.jsx("div",{className:c.cn("mt-1 text-4xl font-bold tracking-tight",l.amount),"data-testid":`${i}-amount`,children:ge(e.value,a,e.currency)})]})};Yi.displayName="PaymentTotalBanner";const jf={white:"bg-white/70 backdrop-blur-sm",transparent:"bg-transparent"},Gi=({title:e,subtitle:s,backdrop:a="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:c.cn("absolute inset-0 z-10 flex flex-col items-center justify-center gap-4 rounded-3xl",jf[a],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}),s&&t.jsx("div",{className:"mt-1 text-sm text-default-600",children:s})]})]});Gi.displayName="LoadingOverlay";const Aa=({cashChange:e,label:s="Cash to return",secondaryLine:a,locale:n="en-US",onDismiss:r,dismissAriaLabel:i="Dismiss",align:l="left",className:o,"data-testid":d="payment-cash-change-banner"})=>{if(!e||e.value<=0)return null;const u=l==="center";return t.jsxs("div",{role:"status","aria-live":"polite","data-testid":d,className:c.cn("flex w-full items-center gap-3 rounded-2xl border border-info-200 bg-info-50 px-5 py-4",u?"justify-center text-center":"text-left","motion-safe:animate-[pp-slide-down_200ms_ease-out]",o),children:[t.jsx(P,{icon:"lucide:info",width:28,height:28,className:"shrink-0 text-info-700","aria-hidden":"true"}),t.jsxs("div",{className:c.cn("flex flex-col",u?"items-center":"flex-1"),children:[t.jsx("span",{className:"text-xs font-medium uppercase tracking-wider text-info-700",children:s}),t.jsx("span",{className:"text-2xl font-bold text-info-700","data-testid":`${d}-amount`,children:ge(e.value,n,e.currency)}),a&&t.jsx("span",{className:"mt-0.5 text-xs text-info-700/80",children:a})]}),r&&t.jsx(B,{isIconOnly:!0,variant:"light",radius:"full",size:"sm",onPress:r,"aria-label":i,"data-testid":`${d}-dismiss`,className:"shrink-0 text-info-700 hover:bg-info-100",children:t.jsx(P,{icon:"lucide:x",width:18,height:18,"aria-hidden":"true"})})]})};Aa.displayName="PaymentCashChangeBanner";const Ki=({title:e,subtitle:s,emailLine:a,confirmationEmail:n,cashChange:r,cashChangeLabel:i="Cash to return",locale:l="en-US",closeLabel:o="Close",onClose:d,className:u,"data-testid":f="payment-success-view"})=>{const m=!!(r&&r.value>0);return t.jsxs("div",{"data-testid":f,className:c.cn("flex flex-col items-center gap-6 py-8 px-4 text-center","motion-safe:animate-[pp-fade-in_250ms_ease-out]",u),children:[t.jsx("div",{"aria-hidden":"true",className:"flex items-center justify-center rounded-full bg-[#A2D9C6] p-[10px]",children:t.jsx(P,{icon:"gravity-ui:circle-check-fill",width:76,height:76,className:"text-[#10B981]","aria-hidden":"true"})}),t.jsxs("div",{className:"space-y-3",children:[t.jsx("h2",{className:"text-2xl font-bold","data-testid":`${f}-title`,children:e}),t.jsx("p",{className:"text-default-700",children:s}),a&&n&&t.jsxs("p",{className:"text-default-700",children:[a,t.jsx("br",{}),t.jsx("strong",{className:"font-semibold",children:n})]})]}),m&&r&&t.jsx(Aa,{cashChange:r,label:i,locale:l,align:"center",className:"max-w-[400px]","data-testid":`${f}-cash-change`}),d&&t.jsx(B,{color:"default",variant:"bordered",radius:"full",size:"lg",onPress:d,"data-testid":`${f}-close`,className:"mt-4 w-full",children:o})]})};Ki.displayName="PaymentSuccessView";const Da=({heading:e,amountLabel:s,value:a,defaultValue:n,onChange:r,onBlur:i,placeholder:l,isDisabled:o,isInvalid:d,errorMessage:u,autoFocus:f,maxAmount:m,hideHeading:h=!1,className:x,"data-testid":g="payment-sub-amount-input"})=>{const j=`${g}-input`,b=p.useCallback(N=>{if(m!==void 0){const $=Number.parseFloat(N.replace(",","."));if(Number.isFinite($)&&$>m)return}r?.(N)},[m,r]),w=p.useCallback(N=>{const $=N.currentTarget;requestAnimationFrame(()=>{$.isConnected&&$.select()})},[]);return t.jsxs("div",{className:c.cn("flex flex-col gap-3 border-t border-default-100 pt-5",x),"data-testid":g,children:[t.jsx("h3",{className:c.cn("text-lg font-semibold",h&&"sr-only"),"data-testid":`${g}-heading`,children:e}),t.jsx(c.Input,{id:j,label:s,labelPlacement:"outside",classNames:h?{label:"sr-only"}:void 0,type:"text",inputMode:"decimal",pattern:"[0-9]*[.,]?[0-9]*",value:a,defaultValue:n,onChange:N=>b(N.target.value),onFocus:w,onBlur:i,placeholder:l,isDisabled:o,isInvalid:d,errorMessage:d?u:void 0,variant:"bordered",radius:"lg","aria-invalid":d||void 0,autoFocus:f,"data-testid":`${g}-field`})]})};Da.displayName="PaymentSubAmountInput";const wf={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"}},Nf=e=>typeof e=="string"?t.jsx(P,{icon:e,className:"size-5","aria-hidden":"true"}):e,Qi=({isOpen:e,title:s,confirmLabel:a,onConfirm:n,onOpenChange:r,children:i,description:l,cancelLabel:o="Cancel",variant:d="danger",isPending:u=!1,isDismissable:f,isKeyboardDismissDisabled:m=!1,hideIcon:h=!1,icon:x,"data-testid":g="confirm-dialog"})=>{const j=i??l??null,b=wf[d],w=h?null:Nf(x??b.icon);return t.jsx(c.Modal,{isOpen:e,onOpenChange:N=>r?.(N),placement:"center",size:"md",isDismissable:(f??!0)&&!u,isKeyboardDismissDisabled:m||u,hideCloseButton:u,className:"gap-4 p-6",classNames:{base:"rounded-3xl"},"data-testid":g,children:t.jsxs(c.ModalContent,{role:"alertdialog",children:[t.jsxs(c.ModalHeader,{className:"flex flex-col items-center gap-3 p-0 text-center",children:[w?t.jsx("div",{"aria-hidden":"true","data-testid":`${g}-icon`,className:c.cn("flex size-10 items-center justify-center rounded-full",b.tile),children:w}):null,t.jsx("span",{"data-testid":`${g}-title`,className:"text-lg font-semibold text-zinc-950",children:s})]}),j!==null?t.jsx(c.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(c.ModalFooter,{className:"flex flex-col-reverse gap-2 p-0 sm:flex-row sm:gap-3",children:[t.jsx(B,{variant:"bordered",color:"default",radius:"full",onPress:()=>r?.(!1),isDisabled:u,"data-testid":`${g}-dismiss`,className:"w-full sm:flex-1",children:o}),t.jsx(B,{color:b.confirmColor,variant:"solid",radius:"full",onPress:n,isLoading:u,"data-testid":`${g}-confirm`,className:"w-full sm:flex-1",children:a})]})]})})};Qi.displayName="ConfirmDialog";const Cf=60,kf=(e,s,a=Cf)=>s?e>a:e<-a,Zi=(e,s)=>Math.max(0,Math.min(e,s)),Sf=160,$f=(e,s,a=Sf)=>Math.min(e,Math.max(0,s-a)),Af=(e,s,a)=>Zi(e-s,a),Df=(e,s,a)=>e!==null?Zi(e,a):s?a:0,Ef=e=>e?"":"transition-[height] duration-300 ease-out",Ff=e=>({onDrag:(s,a)=>{const n=e.open?e.fullHeight:0;e.setDragHeight(Af(n,a?.offset?.y??0,e.fullHeight))},onDragEnd:(s,a)=>{kf(a?.offset?.y??0,e.open)&&e.onToggleOpen?.(),e.setDragHeight(null)}}),ut=(e,s)=>ge(e.value,s,e.currency);function oe(e){return e!=null&&e!==!1&&e!==""}const Ea=({item:e,locale:s,onRemove:a,removeAriaLabel:n,showRemoveButton:r=!0,compact:i=!1})=>{const l=!!e.children&&e.children.length>0,o=!!a&&r,d=e.tone?"text-default-600":"text-default-500";return t.jsxs("div",{"data-testid":`summary-item-${e.id}`,className:c.cn(i?"flex flex-col gap-1 py-3 first:pt-0":"flex flex-col gap-2",e.tone&&"-mx-2 rounded-lg px-2 py-1.5"),style:e.tone?{backgroundColor:qe[e.tone].bg}:void 0,children:[t.jsxs("div",{className:i?"flex items-start justify-between gap-2":"flex min-h-9 items-center justify-between gap-2",children:[t.jsxs("div",{className:"flex min-w-0 items-center gap-2 text-base text-foreground",children:[!i&&typeof e.quantity=="number"&&t.jsxs("span",{"data-testid":`summary-item-qty-${e.id}`,className:"shrink-0",children:[e.quantity," x"]}),e.leadingIcon,t.jsx("span",{"data-testid":`summary-item-name-${e.id}`,className:i?"line-clamp-2 text-sm font-semibold":c.cn("truncate",e.emphasis&&"font-medium"),children:e.name})]}),t.jsxs("div",{className:"flex shrink-0 items-center",children:[e.originalAmount&&t.jsx("span",{"data-testid":`summary-item-original-${e.id}`,className:"mr-2 whitespace-nowrap text-[13px] text-default-600 line-through",children:e.originalAmount}),e.amount&&t.jsx("span",{"data-testid":`summary-item-amount-${e.id}`,className:i?"whitespace-nowrap text-sm font-semibold text-foreground":"whitespace-nowrap text-base text-foreground",children:ut(e.amount,s)}),o&&t.jsx(B,{isIconOnly:!0,size:"sm",variant:"light",radius:"full",className:c.cn("ml-1 size-8 min-w-8 p-2 text-danger",i&&"-my-1.5"),"aria-label":n,"data-testid":`summary-remove-${e.id}`,onPress:()=>a(e.id),children:t.jsx(P,{icon:"lucide:trash-2",width:16,height:16,className:"text-danger"})})]})]}),oe(e.trailing)&&t.jsx("div",{"data-testid":`summary-item-trailing-${e.id}`,className:"flex justify-end",children:e.trailing}),e.dateLabel&&t.jsxs("div",{"data-testid":`summary-item-date-${e.id}`,className:c.cn("flex items-center gap-2 text-sm",d),children:[t.jsx(P,{icon:"lucide:calendar",width:16,height:16,className:"shrink-0"}),t.jsx("span",{className:"truncate",children:e.dateLabel})]}),e.dateRange&&t.jsxs("div",{"data-testid":`summary-item-daterange-${e.id}`,className:c.cn("flex items-center gap-2 text-sm",d),children:[t.jsx(P,{icon:"lucide:calendar",width:16,height:16,className:"shrink-0"}),t.jsx("span",{children:e.dateRange.from}),t.jsx(P,{icon:"lucide:arrow-right",width:16,height:16,className:"shrink-0"}),t.jsx("span",{children:e.dateRange.to})]}),e.details?.map((u,f)=>t.jsxs("div",{"data-testid":`summary-item-detail-${e.id}-${u.key??f}`,className:c.cn("flex items-center justify-between gap-2",i?"text-xs":"text-sm",d),children:[t.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[u.icon,t.jsx("span",{className:"truncate",children:u.label})]}),(u.value!=null||u.tooltip!=null)&&t.jsxs("div",{className:"flex shrink-0 items-center gap-1",children:[u.value!=null&&t.jsx("span",{className:c.cn("whitespace-nowrap",u.valueTone==="primary"&&c.cn("font-medium",e.tone?"text-primary-600":"text-primary")),children:u.value}),u.tooltip!=null&&t.jsx(c.Tooltip,{content:u.tooltip,children:t.jsx("span",{"data-testid":`summary-item-detail-tooltip-${e.id}-${u.key??f}`,className:"flex shrink-0 items-center",children:t.jsx(P,{icon:"lucide:info",width:16,height:16,className:c.cn(u.valueTone==="primary"?"text-primary":"text-default-400")})})})]})]},u.key??f)),l&&t.jsx("div",{"data-testid":`summary-children-${e.id}`,className:"flex flex-col gap-2 pl-6",children:e.children.map(u=>t.jsx(Ea,{item:u,locale:s,onRemove:a,removeAriaLabel:n,showRemoveButton:r,compact:i},u.id))})]})};Ea.displayName="SummaryItemRow";const Xi=({fee:e,locale:s,className:a})=>t.jsxs("div",{"data-testid":"summary-service-fee",className:c.cn("flex items-center justify-between gap-2",a),children:[t.jsxs("button",{type:"button",role:"switch","aria-checked":!!e.isSelected,"aria-label":typeof e.label=="string"?e.label:"Pay Service fee","data-testid":"summary-service-fee-toggle",onClick:e.onToggle,className:"flex min-w-0 items-center gap-2 text-left",children:[t.jsx("span",{"aria-hidden":"true",className:c.cn("flex size-4 shrink-0 items-center justify-center rounded-full border",e.isSelected?"border-primary":"border-default-200"),children:e.isSelected&&t.jsx("span",{className:"size-2 rounded-full bg-primary"})}),t.jsx("span",{className:"truncate text-sm font-medium text-foreground",children:e.label})]}),t.jsx("span",{"data-testid":"summary-service-fee-amount",className:"whitespace-nowrap text-base text-foreground",children:ut(e.amount,s)})]});Xi.displayName="SummaryServiceFeeRow";const Fa=({row:e,locale:s,emphasized:a,onRemove:n,removeAriaLabel:r,showRemoveButton:i=!0,compact:l=!1})=>{const o=!!n&&i&&!!e.id,d=t.jsx("span",{"data-testid":`summary-row-amount-${e.key}`,className:l?"whitespace-nowrap":"whitespace-nowrap text-base",children:ut(e.amount,s)});return t.jsxs("div",{"data-testid":`summary-row-${e.key}`,className:l?"flex items-center justify-between text-sm text-default-500":"flex items-center justify-between text-foreground",children:[t.jsx("span",{"data-testid":`summary-row-label-${e.key}`,className:l?void 0:c.cn(a?"text-xl font-semibold leading-7":"text-base"),children:e.label}),o?t.jsxs("div",{className:"flex shrink-0 items-center",children:[d,t.jsx(B,{isIconOnly:!0,size:"sm",variant:"light",radius:"full",className:c.cn("ml-1 size-8 min-w-8 p-2 text-danger",l&&"-my-1.5"),"aria-label":r,"data-testid":`summary-remove-row-${e.id}`,onPress:()=>n(e.id),children:t.jsx(P,{icon:"lucide:trash-2",width:16,height:16,className:"text-danger"})})]}):d]})};Fa.displayName="SummaryTotalsLineRow";const Ji=({pricesInLabel:e,currency:s,items:a,serviceFee:n,rows:r,locale:i,onRemoveItem:l,removeAriaLabel:o,onRemoveTotalRow:d,removeTotalRowAriaLabel:u,showRemoveButton:f,emptyState:m,compact:h=!1,classNames:x})=>{const g=(a?.length??0)>0;return t.jsxs(t.Fragment,{children:[!h&&t.jsxs("div",{"data-testid":"summary-prices",className:c.cn("flex items-center justify-between text-xs text-default-500",x.prices),children:[t.jsx("span",{children:e}),s!=null&&t.jsx("span",{children:s})]}),g?t.jsx("div",{className:c.cn(h?"flex flex-col divide-y divide-default-100":"flex flex-col gap-4",x.items),children:a.map(j=>t.jsx(Ea,{item:j,locale:i,onRemove:l,removeAriaLabel:o,showRemoveButton:f,compact:h},j.id))}):t.jsx("div",{"data-testid":"summary-empty",children:m}),n&&t.jsxs(t.Fragment,{children:[t.jsx(c.Divider,{className:"bg-default-200"}),t.jsx(Xi,{fee:n,locale:i,className:x.serviceFee})]}),r&&r.length>0&&t.jsx("div",{className:c.cn(h?"flex flex-col gap-1 border-t border-default-100 pt-3":"flex flex-col gap-4",x.totalsRows),children:r.map((j,b)=>t.jsx(Fa,{row:j,locale:i,emphasized:!h&&b===0,onRemove:d,removeAriaLabel:u,showRemoveButton:f,compact:h},j.key))})]})};Ji.displayName="SummaryBody";const el=({total:e,locale:s,compact:a=!1,className:n})=>{const r=a?"text-lg":"text-xl";return t.jsxs("div",{"data-testid":"summary-total",className:c.cn(`flex items-center justify-between ${r} font-semibold leading-7 text-foreground`,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:ut(e.amount,s)})]})};el.displayName="SummaryGrandTotalRow";const tl=({secondaryTotal:e,locale:s,className:a})=>t.jsxs("div",{"data-testid":"summary-secondary-total",className:c.cn("flex items-center justify-between text-lg font-semibold leading-7 text-primary",a),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:ut(e.amount,s)})]});tl.displayName="SummarySecondaryTotalRow";const is=({action:e,disabledByLoading:s,className:a,testId:n="summary-cta"})=>t.jsx(B,{color:"primary",radius:"full",className:c.cn("px-[18px] py-[14px] font-medium",a),"data-testid":n,isLoading:e.isLoading,isDisabled:e.isDisabled||s,onPress:e.onPress,endContent:t.jsx(P,{icon:"lucide:arrow-right",width:16,height:16}),children:e.label});is.displayName="SummaryPrimaryCta";const sl=({title:e,total:s,secondaryTotal:a,locale:n,open:r,progress:i,dragging:l,toggleAriaLabel:o,onToggleOpen:d,classNames:u})=>t.jsx("h2",{children:t.jsxs("button",{type:"button","data-testid":"summary-collapse-toggle","aria-expanded":r,"aria-label":o,onClick:d,className:c.cn("-mx-4 -mt-4 grid w-[calc(100%_+_32px)] grid-cols-1 px-4 pb-4 pt-4 text-left",u.header),children:[t.jsxs("span",{"aria-hidden":!r,style:{opacity:i},className:c.cn("col-start-1 row-start-1 flex items-center justify-between",!l&&"transition-opacity duration-300"),children:[t.jsx("span",{"data-testid":"summary-title",className:c.cn("text-xl font-semibold leading-7 text-foreground",u.title),children:e}),t.jsx("span",{"data-testid":"summary-close","aria-hidden":"true",className:c.cn("shrink-0 text-foreground",u.closeButton),children:t.jsx(P,{icon:"lucide:x",width:20,height:20})})]}),t.jsxs("span",{"aria-hidden":r,style:{opacity:1-i},className:c.cn("col-start-1 row-start-1 flex flex-col gap-2",!l&&"transition-opacity duration-300"),children:[t.jsxs("span",{className:"flex items-center justify-between text-xl font-semibold leading-7 text-foreground",children:[t.jsx("span",{children:s.label??"Total"}),t.jsx("span",{className:"whitespace-nowrap",children:ut(s.amount,n)})]}),a&&t.jsxs("span",{className:"flex items-center justify-between text-lg font-semibold leading-7 text-primary",children:[t.jsx("span",{children:a.label}),t.jsx("span",{className:"whitespace-nowrap",children:ut(a.amount,n)})]})]})]})});sl.displayName="SummaryCollapseHeader";const al=({cart:e,ariaLabel:s,onPress:a,className:n})=>t.jsxs("button",{type:"button","data-testid":"summary-cart","aria-label":s,onClick:a,className:c.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:"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})]});al.displayName="SummaryCartButton";const nl=({open:e,progress:s,dragging:a,primaryAction:n,isLoading:r,cart:i,cartAriaLabel:l,ctaCaption:o,ctaError:d,onToggleOpen:u,classNames:f})=>t.jsxs("div",{"data-testid":"summary-mobile-bar",className:c.cn("flex flex-col gap-4",f.mobileBar),children:[t.jsx(c.Divider,{className:"bg-default-200"}),d&&t.jsx("div",{children:d}),t.jsxs("div",{className:"grid",children:[t.jsxs("div",{"aria-hidden":e,style:{opacity:1-s},className:c.cn("col-start-1 row-start-1 flex items-stretch gap-2.5",e&&"pointer-events-none",!a&&"transition-opacity duration-300"),children:[i&&t.jsx(al,{cart:i,ariaLabel:l,className:f.cart,onPress:()=>{u?.(),i.onPress?.()}}),n&&t.jsx(is,{action:n,disabledByLoading:r,className:c.cn("h-[52px] flex-1",f.cta),testId:"summary-cta-compact"})]}),n&&t.jsx("div",{"aria-hidden":!e,style:{opacity:s},className:c.cn("col-start-1 row-start-1 flex",!e&&"pointer-events-none",!a&&"transition-opacity duration-300"),children:t.jsx(is,{action:n,disabledByLoading:r,className:c.cn("h-[52px] w-full",f.cta)})})]}),o&&t.jsx("div",{children:o})]});nl.displayName="SummaryActionBar";const Lf="(max-width: 767px)",Mf=e=>typeof window<"u"&&typeof window.matchMedia=="function"?window.matchMedia(e).matches:!1,_f=(e=Lf)=>{const[s,a]=p.useState(()=>Mf(e));return p.useEffect(()=>{if(typeof window>"u"||typeof window.matchMedia!="function")return;const n=window.matchMedia(e),r=()=>a(n.matches);return r(),n.addEventListener("change",r),()=>n.removeEventListener("change",r)},[e]),s},rl=({title:e="Summary",pricesInLabel:s="Prices are in",currency:a,locale:n="en-US",items:r,serviceFee:i,rows:l,total:o,postTotalRows:d,onRemoveTotalRow:u,onRemovePostTotalRow:f,secondaryTotal:m,collapsible:h,isOpen:x,onToggleOpen:g,defaultOpen:j=!1,primaryAction:b,isLoading:w=!1,onRemoveItem:N,showRemoveButton:$,ctaCaption:v,ctaError:A,variant:M,cart:k,emptyState:F,labels:C,classNames:_={},density:E="default","data-testid":D="summary",className:R})=>{const O=C?.removeAriaLabel??"Remove item",V=C?.removeTotalRowAriaLabel??"Remove discount",q=C?.removePostTotalRowAriaLabel??"Remove applied code",I=C?.toggleAriaLabel??"Toggle summary",J=C?.cartAriaLabel??"View cart",W=E==="compact",se=_f(),Z=h??(M??(se?"mobile":"main"))==="mobile",[Q,ee]=p.useState(j),ne=x!==void 0,X=!Z||(ne?x:Q),de=p.useCallback(()=>{ne||ee(T=>!T),g?.()},[ne,g]),[ae,Ie]=p.useState(0),[Ee,Le]=p.useState(null),mt=p.useRef(null),Ge=p.useRef(null),We=p.useCallback(()=>{const T=mt.current;T&&Ie($f(T.scrollHeight,window.innerHeight))},[]),rt=p.useCallback(T=>{Ge.current?.disconnect(),Ge.current=null,mt.current=T,T&&(We(),typeof ResizeObserver<"u"&&(Ge.current=new ResizeObserver(We),Ge.current.observe(T)))},[We]);p.useEffect(()=>(window.addEventListener("resize",We),()=>window.removeEventListener("resize",We)),[We]);const Je=Ff({open:X,fullHeight:ae,setDragHeight:Le,onToggleOpen:de}),Pe=Ee!==null,le=Df(Ee,X,ae),ye=ae>0?Math.min(1,Math.max(0,le/ae)):X?1:0,Ye=t.jsx(el,{total:o,locale:n,compact:W,className:_.total}),y=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(Fa,{row:T,locale:n,emphasized:!1,onRemove:f,removeAriaLabel:q,showRemoveButton:$,compact:W},T.key))}),S=m&&t.jsx(tl,{secondaryTotal:m,locale:n,className:_.secondaryTotal}),L=v!=null&&t.jsx("p",{"data-testid":"summary-cta-caption",className:c.cn("text-center text-sm text-default-500",_.ctaCaption),children:v}),U=A!=null&&t.jsx("p",{role:"alert","data-testid":"summary-cta-error",className:c.cn("text-center text-sm text-danger",_.ctaError),children:A}),z=t.jsx(Ji,{pricesInLabel:s,currency:a,items:r,serviceFee:i,rows:l,locale:n,onRemoveItem:N,removeAriaLabel:O,onRemoveTotalRow:u,removeTotalRowAriaLabel:V,showRemoveButton:$,emptyState:F,compact:W,classNames:_});return Z?t.jsxs(De.motion.section,{"data-testid":D,drag:"y",dragConstraints:{top:0,bottom:0},dragElastic:.12,dragSnapToOrigin:!0,onDrag:Je.onDrag,onDragEnd:Je.onDragEnd,className:c.cn("fixed inset-x-0 bottom-0 z-50 flex max-h-full w-full flex-col rounded-t-2xl bg-content1 p-4 drop-shadow-[0_-2px_2px_rgba(0,0,0,0.1)]",R,_.base),children:[t.jsx(sl,{title:e,total:o,secondaryTotal:m,locale:n,open:X,progress:ye,dragging:Pe,toggleAriaLabel:I,onToggleOpen:de,classNames:_}),t.jsx("div",{"data-testid":"summary-reveal","aria-hidden":!X,style:{height:le},className:c.cn("min-h-0",X&&!Pe?"overflow-y-auto overscroll-contain [scrollbar-width:none] [&::-webkit-scrollbar]:hidden":"overflow-hidden",!X&&"pointer-events-none",Ef(Pe)),children:t.jsxs("div",{ref:rt,className:W?"flex flex-col gap-3 pb-4":"flex flex-col gap-4 pb-4",children:[z,!W&&t.jsx(c.Divider,{className:"bg-default-200"}),Ye,y,S]})}),t.jsx(nl,{open:X,progress:ye,dragging:Pe,primaryAction:b,isLoading:w,cart:k,cartAriaLabel:J,ctaCaption:L,ctaError:U,onToggleOpen:de,classNames:_})]}):t.jsxs("section",{"data-testid":D,className:c.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",R,_.base),children:[!W&&t.jsx("div",{className:c.cn("flex items-center justify-between",_.header),children:t.jsx("h2",{"data-testid":"summary-title",className:c.cn("text-xl font-semibold leading-7 text-foreground",_.title),children:e})}),z,!W&&t.jsx(c.Divider,{className:"bg-default-200"}),Ye,y,S,m&&b&&t.jsx(c.Divider,{className:"bg-default-200"}),b&&t.jsx(is,{action:b,disabledByLoading:w,className:c.cn("w-full",_.cta)}),U,L]})};rl.displayName="Summary";const Rf={back:"Back",close:"Close",cancel:"Cancel",partialBadge:"Partial refund",owesBadge:"Customer owes"},Tf={backgroundColor:je.destructive,color:"#fff"},Mn="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",il=({onClose:e,steps:s,activeStepId:a,subtitle:n,onBack:r,primaryAction:i,totalRow:l,secondaryAction:o,hideChrome:d,footerSummary:u,labels:f,className:m,"data-testid":h="wizard-shell",children:x})=>{const g={...Rf,...f},j=s.filter(v=>v.state!=="skipped"),b=s.find(v=>v.id===a),w=Math.max(0,j.findIndex(v=>v.id===a)),N=r??e,$=r?g.back:g.cancel;return t.jsxs("div",{className:c.cn("flex h-full min-h-0 w-full flex-col bg-white text-default-900",m),"data-testid":h,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":`${h}-header`,children:[N&&t.jsx(B,{variant:"light",className:"h-10 min-w-0 gap-2 rounded-xl px-4 text-sm font-semibold text-default-600",onPress:N,"data-testid":`${h}-header-back`,startContent:t.jsx(P,{icon:"lucide:circle-chevron-left",width:18,height:18,"aria-hidden":"true"}),children:$}),t.jsxs("div",{className:"min-w-0",children:[t.jsx("h2",{className:"text-lg font-semibold","data-testid":`${h}-header-title`,children:b?.label??""}),n&&t.jsx("div",{className:"mt-0.5 text-[12.5px] text-default-500","data-testid":`${h}-header-subtitle`,children:n})]}),t.jsxs("div",{className:"relative flex-1","data-testid":`${h}-footer`,children:[e&&t.jsx("button",{type:"button","aria-label":g.close,onClick:e,className:c.cn(Ts,"left-0"),"data-testid":`${h}-header-close`}),r&&t.jsx("button",{type:"button","aria-label":g.back,onClick:r,className:c.cn(Ts,"left-6"),"data-testid":`${h}-back`}),o&&t.jsx("button",{type:"button","aria-label":o.label,disabled:o.disabled,onClick:o.onClick,className:c.cn(Ts,"left-12"),"data-testid":`${h}-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:[l&&t.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-[12.5px] font-semibold text-default-600","data-testid":`${h}-total`,children:[t.jsx("span",{children:l.label}),l.amount&&t.jsx("span",{className:"tabular-nums text-default-900",children:ge(l.amount.value,void 0,l.amount.currency)}),l.badge==="partial"&&t.jsx("span",{className:c.cn(Mn,"bg-pos-warn-fill text-pos-warn"),"data-testid":`${h}-total-partial`,children:g.partialBadge}),l.badge==="owes"&&t.jsx("span",{className:c.cn(Mn,"border border-pos-line bg-default-100 text-default-600"),"data-testid":`${h}-total-owes`,children:g.owesBadge})]}),t.jsx(B,{color:"primary",className:c.cn("h-12 min-w-0 rounded-[14px] px-5 text-[15px] font-semibold",i.tone==="destructive"&&"bg-pos-destructive text-white"),style:i.tone==="destructive"?Tf:void 0,isLoading:i.loading,isDisabled:i.disabled,onPress:i.onClick,"data-testid":`${h}-primary`,children:i.label})]})]}),t.jsx("div",{className:"flex shrink-0 gap-1.5 px-6 py-2.5","data-testid":`${h}-stepper`,children:j.map((v,A)=>t.jsx("span",{className:c.cn("h-1 flex-1 rounded-full",A<w&&"bg-pos-ok",A===w&&"bg-primary",A>w&&"bg-pos-line")},v.id))}),t.jsx("div",{className:"min-h-0 flex-1 overflow-auto px-6 py-[22px]","data-testid":`${h}-body`,children:x}),u]})};il.displayName="WizardShell";const If=(e,s,a)=>Math.min(Math.max(e,s),a);function Xs(e,s,a){const n=Math.max(1,Math.trunc(s)),r=If(Math.trunc(a),0,n);if(r===n)return{...e};if(r===0)return{value:0,currency:e.currency};const i=Math.pow(10,Rt(e.currency)),l=Math.round(e.value*i),o=Math.floor(l/n),d=l-o*n;return{value:(o*r+Math.min(r,d))/i,currency:e.currency}}function Pf(e,s){return Xs(e,s,1)}const Of=e=>Number.isFinite(e)?e.toFixed(2):"",Js=({value:e,expected:s,max:a,onChange:n,ariaLabel:r,isDisabled:i,className:l,"data-testid":o,inputTestId:d})=>{const[u,f]=p.useState(null),m=p.useRef(null),h=Math.abs(e-s)>.004;return t.jsxs("span",{className:c.cn("inline-flex h-11 items-center gap-px rounded-[10px] border px-2.5","focus-within:border-primary focus-within:ring-[3px] focus-within:ring-primary/10",h?"border-primary bg-primary-50":"border-pos-line bg-white",l),"data-testid":o,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??Of(e),onChange:x=>{const g=x.target.value,j=Number.parseFloat(g.replace(",","."));a!==void 0&&Number.isFinite(j)&&j>a+.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})]})};Js.displayName="AmountCell";const zf={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"},Bf="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",_n="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",Is="absolute h-5 w-5 opacity-0",Vf=e=>{const s=ge(e.paidAmount.value,void 0,e.paidAmount.currency);if(e.quantity<=1)return s;const a=Pf(e.paidAmount,e.quantity);return`${e.quantity} × ${ge(a.value,void 0,a.currency)} · ${s}`},ll=({items:e,selections:s,onSelectionChange:a,onRestockToggle:n,onDispositionChange:r,amountOnly:i,labels:l,className:o,"data-testid":d="line-item-list"})=>{const u={...zf,...l},f=[{key:"stock",label:u.dispositionStock},{key:"norestock",label:u.dispositionNoRestock},{key:"damaged",label:u.dispositionDamaged}];return t.jsxs("div",{className:c.cn("flex flex-col text-default-900",o),"data-testid":d,children:[e.map(m=>{const h=s[m.id],x=m.state==="already_refunded"||m.state==="non_refundable",g=`${d}-row-${m.id}`,j=Math.max(1,Math.trunc(m.quantity)),b=h?.quantity,w=h?.selected?Math.min(b??j,j):b??0,N=Xs(m.paidAmount,j,w).value,$=h?.amount??(h?.selected?N:0),v=w===0&&$>.004,A=k=>a(m.id,{selected:k.quantity>0||k.amount>.004,mode:"full",...k}),M=k=>{const F=Math.min(Math.max(k,0),j);A({quantity:F,amount:Xs(m.paidAmount,j,F).value})};return t.jsxs("div",{className:c.cn("relative flex items-start gap-3 border-b border-pos-line-2 py-3 last:border-b-0",x&&"opacity-60"),"data-testid":g,children:[t.jsx("div",{className:"flex h-10 w-10 shrink-0 items-center justify-center rounded-[10px] bg-default-100 text-default-600","data-testid":`${g}-icon`,children:t.jsx(P,{icon:m.icon??"lucide:package",width:19,height:19,"aria-hidden":"true"})}),t.jsxs("div",{className:"min-w-0 flex-1",children:[t.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[t.jsxs("div",{className:"min-w-0",children:[t.jsx("p",{className:"truncate text-sm font-semibold",children:m.name}),t.jsx("p",{className:"text-[12.5px] text-default-500","data-testid":`${g}-detail`,children:m.detail??Vf(m)}),v&&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:ge(m.paidAmount.value,void 0,m.paidAmount.currency)}):t.jsx(Js,{value:$,expected:N,max:m.paidAmount.value,onChange:k=>A({quantity:w,amount:k}),ariaLabel:u.amount.replace("{name}",m.name),className:"w-[120px]","data-testid":`${g}-amount`,inputTestId:`${g}-partial-input-field`}),x?t.jsx("span",{className:Bf,"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:_n,"aria-label":u.decrease.replace("{name}",m.name),disabled:w===0,onClick:()=>M(w-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:w}),t.jsx("button",{type:"button",className:_n,"aria-label":u.increase.replace("{name}",m.name),disabled:w===j,onClick:()=>M(w+1),"data-testid":`${g}-qty-increase`,children:"+"})]})]})]}),w>=j&&t.jsx("p",{className:"mt-2 text-xs text-default-500","data-testid":`${g}-max-note`,children:u.maxNote.replace("{count}",String(j))}),h?.selected&&!m.restock.available&&m.restock.unavailableHint&&t.jsx("p",{className:"mt-2 text-xs text-default-500",children:m.restock.unavailableHint}),m.warning&&t.jsxs("div",{className:"mt-2.5 flex items-start gap-2 rounded-[10px] bg-pos-warn-fill px-2.5 py-2 text-[12.5px] text-pos-warn","data-testid":`${g}-warning`,children:[t.jsx(P,{icon:"gravity-ui:triangle-exclamation-fill",width:15,height:15,className:"mt-0.5 shrink-0","aria-hidden":"true"}),t.jsx("span",{children:m.warning})]}),w>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(He,{"aria-label":u.disposition,className:"w-[220px]",selectedKeys:[m.restock.disposition??(m.restock.on?"stock":"norestock")],onSelectionChange:k=>{if(k==="all")return;const F=[...k][0];F&&(r?.(m.id,F),n(m.id,F==="stock"))},"data-testid":`${g}-restock`,children:f.map(k=>t.jsx(c.SelectItem,{children:k.label},k.key))})]})]}),!x&&t.jsxs(t.Fragment,{children:[t.jsx(c.Checkbox,{className:c.cn(Is,"right-0 top-0 m-0 p-0"),isSelected:!!h?.selected,onValueChange:k=>a(m.id,{selected:k,mode:"full"}),"aria-label":m.name,"data-testid":`${g}-checkbox`}),t.jsx("button",{type:"button","aria-label":u.partialLink,onClick:()=>document.querySelector(`[data-testid="${g}-partial-input-field"]`)?.focus(),className:c.cn(Is,"left-0 top-0"),"data-testid":`${g}-partial-link`}),t.jsx("button",{type:"button","aria-label":u.partialCancel,onClick:()=>A({quantity:w,amount:N}),className:c.cn(Is,"left-5 top-0"),"data-testid":`${g}-partial-cancel`})]})]},m.id)}),i&&(i.value===null?t.jsxs("button",{type:"button",onClick:i.onAdd,className:"mt-1 inline-flex items-center gap-1.5 self-start rounded pt-3 text-[12.5px] font-semibold text-primary outline-none hover:text-primary-600 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary","data-testid":`${d}-amount-only-add`,children:[t.jsx(P,{icon:"lucide:plus",width:13,height:13,"aria-hidden":"true"}),u.amountOnlyAdd]}):t.jsxs("div",{className:"flex items-start gap-3 border-b border-pos-line-2 pb-3 pt-5 last:border-b-0","data-testid":`${d}-amount-only`,children:[t.jsx("div",{className:"flex h-10 w-10 shrink-0 items-center justify-center rounded-[10px] bg-default-100 text-default-600",children:t.jsx(P,{icon:"lucide:circle-dollar-sign",width:19,height:19,"aria-hidden":"true"})}),t.jsx("div",{className:"min-w-0 flex-1",children:t.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[t.jsxs("div",{className:"min-w-0",children:[t.jsx("p",{className:"text-sm font-semibold",children:u.amountOnlyTitle}),t.jsx("p",{className:"text-[12.5px] text-default-500",children:u.amountOnlyDetail.replace("{amount}",ge(i.max.value,void 0,i.max.currency))})]}),t.jsxs("div",{className:"flex w-full flex-wrap items-center gap-2.5 sm:w-[290px] sm:flex-nowrap",children:[t.jsx(Js,{value:i.value,expected:i.value,max:i.max.value,onChange:i.onChange,ariaLabel:u.amountOnlyTitle,className:"flex-1",inputTestId:`${d}-amount-only-input`}),t.jsx("button",{type:"button","aria-label":u.amountOnlyRemove,onClick:i.onRemove,className:"flex h-11 w-11 shrink-0 items-center justify-center rounded-full bg-pos-danger-fill text-pos-danger outline-none transition-colors hover:bg-[#F8D6D6] focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-pos-danger","data-testid":`${d}-amount-only-remove`,children:t.jsx(P,{icon:"lucide:trash-2",width:17,height:17,"aria-hidden":"true"})})]})]})})]}))]})};ll.displayName="LineItemList";const ol=({children:e,className:s,"data-testid":a="meta-card"})=>t.jsx("div",{className:c.cn("mx-auto mt-[18px] flex max-w-[1040px] flex-col gap-3",s),"data-testid":a,children:t.jsx("div",{className:"rounded-[14px] border border-pos-line bg-white px-4 py-3.5 text-default-900",children:e})});ol.displayName="MetaCard";const cl=({label:e,htmlFor:s,children:a,className:n,"data-testid":r="meta-card-row"})=>t.jsxs("div",{className:c.cn("flex flex-wrap items-center justify-between gap-4",n),"data-testid":r,children:[t.jsx("label",{htmlFor:s,className:"text-[13px] font-medium text-default-600",children:e}),t.jsx("div",{className:"w-full sm:w-[290px] sm:shrink-0",children:a})]});cl.displayName="MetaCard.Row";const dl=({label:e,children:s,className:a,"data-testid":n="meta-card-section"})=>t.jsxs("div",{className:c.cn("mt-3.5 flex flex-col gap-2.5 border-t border-pos-line pt-3",a),"data-testid":n,children:[e&&t.jsx("p",{className:"text-[13px] font-medium text-default-600",children:e}),s]});dl.displayName="MetaCard.Section";const Uf=Object.assign(ol,{Row:cl,Section:dl}),ul=({heading:e,icon:s="lucide:rotate-ccw",action:a,children:n,className:r,"data-testid":i="section-panel"})=>t.jsxs("section",{className:c.cn("mx-auto max-w-[1040px] rounded-2xl border border-pos-line bg-white px-[18px] py-4",r),"data-testid":i,children:[t.jsxs("div",{className:"mb-3 flex items-center gap-2 text-[13px] font-semibold text-default-600",children:[t.jsx(P,{icon:s,width:16,height:16,"aria-hidden":"true"}),t.jsx("h3",{"data-testid":`${i}-heading`,children:e}),t.jsx("div",{className:"flex-1"}),a&&t.jsxs("button",{type:"button",disabled:a.disabled,onClick:a.onClick,className:c.cn("inline-flex min-h-8 shrink-0 items-center gap-1.5 rounded-full border border-primary","bg-primary/5 px-3 py-[7px] text-[12.5px] font-semibold text-primary outline-none","transition-colors hover:bg-primary/10 disabled:cursor-not-allowed disabled:opacity-60","focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary"),"data-testid":`${i}-action`,children:[t.jsx(P,{icon:a.icon??"lucide:plus",width:14,height:14,"aria-hidden":"true"}),a.label]})]}),n]});ul.displayName="SectionPanel";const ml=({name:e,detail:s,icon:a="lucide:users",labels:n,className:r,"data-testid":i="customer-card"})=>t.jsxs("div",{className:c.cn("mb-3.5 flex items-center gap-3 rounded-xl bg-default-100 px-3.5 py-3",r),"data-testid":i,children:[t.jsx("div",{className:"flex h-[38px] w-[38px] shrink-0 items-center justify-center rounded-[10px] bg-default-100 text-default-600",children:t.jsx(P,{icon:a,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}),s&&t.jsx("p",{className:"text-[12.5px] text-default-500",children:s})]})]});ml.displayName="CustomerCard";const Hf={label:"Reason for the return",placeholder:"Select a reason…"},fl=({options:e,value:s,onChange:a,error:n,labels:r,className:i,"data-testid":l="reason-select"})=>{const o={...Hf,...r};return t.jsx(He,{label:o.label,labelPlacement:"outside",placeholder:o.placeholder,selectedKeys:s?[s]:[],isInvalid:!!n,errorMessage:n,className:c.cn(i),"data-testid":l,onSelectionChange:d=>{if(d==="all")return;const u=[...d][0];u&&a(String(u))},children:e.map(d=>t.jsx(c.SelectItem,{children:d.label},d.id))})};fl.displayName="ReasonSelect";const qf={toggle:"Add a note",optionalTag:"(optional)",heading:"Additional note",placeholder:"Add a note (optional)"},xl=({value:e,onChange:s,maxLength:a,alwaysExpanded:n=!1,hideLabel:r=!1,labels:i,className:l,"data-testid":o="notes-field"})=>{const d={...qf,...i},[u,f]=p.useState(e!=="");return n?t.jsxs("div",{className:c.cn("flex flex-col gap-2",l),"data-testid":o,children:[!r&&t.jsx("label",{htmlFor:`${o}-textarea`,className:"text-[13px] font-medium text-default-600",children:d.heading}),t.jsx("textarea",{id:`${o}-textarea`,"aria-label":r?d.heading:void 0,value:e,onChange:m=>s(m.target.value),maxLength:a,placeholder:d.placeholder,className:c.cn("min-h-[52px] w-full resize-y rounded-[10px] border border-pos-line bg-white px-3 py-2.5","text-[13.5px] leading-[1.45] text-default-900 outline-none","placeholder:text-default-500","focus:border-primary focus:ring-[3px] focus:ring-primary/10"),"data-testid":`${o}-textarea`})]}):t.jsx("div",{className:c.cn(l),"data-testid":o,children:u?t.jsx(c.Textarea,{value:e,onChange:m=>s(m.target.value),maxLength:a,placeholder:d.toggle,"aria-label":d.toggle,variant:"bordered",radius:"lg","data-testid":`${o}-textarea`}):t.jsxs(B,{variant:"light",className:"h-auto min-w-0 px-1 py-0.5 text-xs font-semibold text-primary",onPress:()=>f(!0),"data-testid":`${o}-toggle`,children:[d.toggle,t.jsx("span",{className:"ml-1 font-normal text-default-400",children:d.optionalTag})]})})};xl.displayName="NotesField";const Wf={danger:{surface:"bg-pos-danger-fill",disc:"bg-pos-danger-icon text-pos-danger",title:"text-pos-danger"},warning:{surface:"bg-pos-warn-fill",disc:"bg-pos-warn-icon text-pos-warn",title:"text-pos-warn"}},Yf={danger:"gravity-ui:circle-exclamation-fill",warning:"gravity-ui:triangle-exclamation-fill"},Rn="h-8 min-w-0 rounded-[10px] px-3 text-[13px] font-semibold",La=({tone:e,title:s,body:a,onRetry:n,retryLabel:r,onChooseDifferent:i,chooseDifferentLabel:l,className:o,"data-testid":d,retryTestId:u,chooseDifferentTestId:f})=>{const m=Wf[e];return t.jsxs("div",{role:"alert",className:c.cn("flex items-start gap-3.5 rounded-[14px] p-4 px-[18px]",m.surface,o),"data-testid":d,children:[t.jsx("div",{className:c.cn("flex h-10 w-10 shrink-0 items-center justify-center rounded-full",m.disc),"aria-hidden":"true",children:t.jsx(P,{icon:Yf[e],width:22,height:22})}),t.jsxs("div",{className:"min-w-0 flex-1",children:[s&&t.jsx("p",{className:c.cn("font-semibold",m.title),children:s}),t.jsx("p",{className:"mt-0.5 text-[13px] text-default-600",children:a}),t.jsxs("div",{className:"mt-3 flex gap-2.5",children:[n&&t.jsx(B,{color:"primary",className:Rn,onPress:n,"data-testid":u,children:r}),t.jsx(B,{variant:"bordered",className:c.cn(Rn,"border-1 border-pos-line bg-white text-default-900"),onPress:i,"data-testid":f,children:l})]})]})]})};La.displayName="TenderBanner";const Gf={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"},Kf={card:"lucide:credit-card",cash:"lucide:dollar-sign",check:"lucide:edit-3",other:"lucide:more-horizontal"},hl=({tenders:e,selectedTenderId:s,onSelect:a,onSplit:n,error:r,labels:i,className:l,"data-testid":o="tender-methods"})=>{const d={...Gf,...i},u=r?.kind==="processor_declined";return t.jsxs("div",{className:c.cn("flex flex-col text-default-900",l),"data-testid":o,children:[r&&t.jsx(La,{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":`${o}-error`,retryTestId:`${o}-retry`,chooseDifferentTestId:`${o}-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":`${o}-tiles`,children:[e.map(f=>{const m=f.tenderId===s;return t.jsxs("button",{type:"button",role:"radio","aria-checked":m,onClick:()=>a(f.tenderId),className:c.cn("flex items-center gap-[11px] rounded-[14px] border-[1.5px] bg-white px-[15px] py-[11px] text-left","outline-none transition-colors","focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary",m?"border-primary bg-primary/5":"border-pos-line hover:border-primary"),"data-testid":`${o}-tile-${f.tenderId}`,children:[t.jsx("span",{className:c.cn("flex h-[34px] w-[34px] shrink-0 items-center justify-center rounded-[10px]",m?"bg-primary text-white":"bg-default-100 text-default-600"),children:t.jsx(P,{icon:Kf[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:ge(f.maxRefundable.value,void 0,f.maxRefundable.currency)})]})]},f.tenderId)}),t.jsxs("button",{type:"button",onClick:n,className:c.cn("flex items-center gap-[11px] rounded-[14px] border-[1.5px] border-pos-line bg-white px-[15px] py-[11px] text-left","outline-none transition-colors hover:border-primary","focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary"),"data-testid":`${o}-split`,children:[t.jsx("span",{className:"flex h-[34px] w-[34px] shrink-0 items-center justify-center rounded-[10px] bg-default-100 text-default-600",children:t.jsx(P,{icon:"lucide:split",width:18,height:18,"aria-hidden":"true"})}),t.jsx("span",{className:"min-w-0 text-sm font-semibold",children:d.split})]})]})]})};hl.displayName="TenderMethods";const Qf=e=>e.refunded!==null,Zf={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"},Xf="mb-2 text-[11px] font-semibold uppercase tracking-[.08em] text-default-500",Jf="inline-flex h-[22px] shrink-0 items-center gap-[5px] whitespace-nowrap rounded-full px-[9px] text-xs font-medium leading-none",pl=({parts:e,refundedSoFar:s,remaining:a,current:n,methods:r,onRefundPart:i,partError:l,onBack:o,busy:d,hideActions:u,labels:f,className:m,"data-testid":h="split-tender-panel"})=>{const x={...Zf,...f},g=e.filter(Qf),j=e.find(k=>k.tenderId===n.tenderId)?.label,b=!!(r?.length&&n.onTenderChange),w=Rt(a.currency),{draft:N,setDraft:$,normalize:v}=Oi(n.amount,String),A=p.useCallback(k=>{Pi(k,w)&&($(k),n.onAmountChange(rs(k)??0))},[n,$,w]),M=l?.kind==="processor_declined";return t.jsxs("div",{className:c.cn("flex flex-col text-default-900",m),"data-testid":h,children:[t.jsx("h3",{className:"sr-only","data-testid":`${h}-title`,children:x.title}),l&&t.jsx(La,{tone:M?"danger":"warning",title:M?x.declinedTitle:x.networkTitle,body:M?x.partDeclinedBody:x.partNetworkBody,onRetry:l.onRetry,retryLabel:x.retry,onChooseDifferent:l.onChooseDifferent,chooseDifferentLabel:x.chooseDifferent,className:"mb-[18px]","data-testid":`${h}-part-error`,retryTestId:`${h}-retry`,chooseDifferentTestId:`${h}-choose-different`}),t.jsxs("div",{"data-testid":`${h}-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:ge(a.value,void 0,a.currency)}),t.jsxs("span",{className:"sr-only",children:[x.refundedSoFar,": ",ge(s.value,void 0,s.currency)]})]}),g.length>0&&t.jsxs("div",{children:[t.jsx("p",{className:Xf,children:x.refundedSoFar}),g.map((k,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":`${h}-part-${k.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:k.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:k.label}),k.feeNote&&t.jsx("span",{className:"block text-[11.5px] text-default-500",children:k.feeNote})]}),t.jsx("span",{className:"font-semibold tabular-nums",children:ge(k.refunded.value,void 0,k.refunded.currency)}),t.jsx("span",{className:c.cn(Jf,k.status==="pending"?"bg-pos-warn-fill text-pos-warn":"bg-pos-ok-fill text-pos-ok"),children:k.status==="pending"?x.pending:x.succeeded})]},k.tenderId))]})]}),t.jsxs("div",{className:"mt-3.5","data-testid":`${h}-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":`${h}-amount-label`,children:x.amountForPart}),t.jsx(Da,{heading:x.amountForPart,amountLabel:x.amountForPart,hideHeading:!0,placeholder:"$0.00",value:N,onChange:A,onBlur:v,maxAmount:a.value,isDisabled:d,className:"gap-0 border-t-0 pt-0","data-testid":`${h}-amount`}),b&&t.jsx("div",{className:"mt-2.5 flex gap-2","data-testid":`${h}-methods`,children:r?.map(k=>{const F=k.tenderId===n.tenderId;return t.jsxs("button",{type:"button","aria-pressed":F,disabled:k.disabled||d,onClick:()=>n.onTenderChange?.(k.tenderId),className:c.cn("flex h-11 flex-1 items-center justify-center gap-2 rounded-xl border-[1.5px] bg-white","text-[13px] font-semibold outline-none transition-colors","disabled:cursor-not-allowed disabled:opacity-50","focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary",F?"border-primary bg-primary/5 text-primary":"border-pos-line text-default-600"),"data-testid":`${h}-method-${k.tenderId}`,children:[k.icon&&t.jsx(P,{icon:k.icon,width:15,height:15,"aria-hidden":"true"}),k.label]},k.tenderId)})})]}),!u&&t.jsxs("div",{className:"mt-4 flex items-center gap-3",children:[t.jsx(B,{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:o,"data-testid":`${h}-back`,children:x.back}),t.jsx(B,{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":`${h}-submit`,children:x.submit})]})]})};pl.displayName="SplitTenderPanel";const ex={label:"Supervisor authorization",placeholder:"••••"},gl=({pin:e,onChange:s,hint:a,error:n,labels:r,className:i,"data-testid":l="pin-field"})=>{const o={...ex,...r};return t.jsxs("div",{className:c.cn("mx-auto max-w-[460px] rounded-[20px] border border-pos-line bg-white px-7 py-[26px]","text-center text-default-900 shadow-[0_1px_2px_rgba(0,0,0,0.05)]",i),"data-testid":l,children:[t.jsx("div",{className:"mx-auto mb-4 flex h-[70px] w-[70px] items-center justify-center rounded-full bg-pos-danger-fill text-primary",children:t.jsx(P,{icon:"lucide:lock",width:26,height:26,"aria-hidden":"true"})}),t.jsx("p",{className:"text-[17px] font-semibold",children:o.label}),a&&t.jsx("p",{className:"mt-1.5 text-[13px] text-default-500",children:a}),t.jsx(c.Input,{type:"password",inputMode:"numeric","aria-label":o.label,placeholder:o.placeholder,value:e,onChange:d=>s(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":`${l}-input`})]})};gl.displayName="PinField";const tx={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}"},sx={succeeded:"bg-pos-ok-fill text-pos-ok",pending:"bg-pos-warn-fill text-pos-warn"},ax="inline-flex h-[22px] items-center gap-[5px] whitespace-nowrap rounded-full px-[9px] text-xs font-medium leading-none",Tn="mb-1.5 text-[11px] font-semibold uppercase tracking-[.05em] text-default-500",nx="mx-auto max-w-[1040px] rounded-[20px] border border-pos-line bg-white px-7 py-[26px] shadow-[0_1px_2px_rgba(0,0,0,0.05)]",rx=["email","print"],bl=({state:e,total:s,destinations:a,reason:n,authorizedBy:r,selectedReceipts:i,onSendReceipt:l,onDone:o,frameless:d=!1,labels:u,className:f,"data-testid":m="outcome-view"})=>{const h={...tx,...u},x=s?ge(s.value,void 0,s.currency):null;return e==="processing"?t.jsx("div",{className:c.cn("flex flex-col items-center justify-center text-center text-default-900",f),"aria-live":"polite","data-testid":m,children:t.jsxs("div",{className:"flex flex-col items-center px-5 py-[60px]","data-testid":`${m}-processing`,children:[t.jsx("div",{className:"mb-4 h-[52px] w-[52px] animate-spin rounded-full border-[5px] border-default-100 border-t-primary",role:"presentation"}),t.jsx("p",{className:"text-[17px] font-semibold",children:h.processing}),x&&t.jsx("p",{className:"mt-2 text-[15px] font-semibold tabular-nums","data-testid":`${m}-processing-total`,children:x})]})}):t.jsxs("div",{className:c.cn("flex flex-col text-default-900",!d&&nx,f),"aria-live":"polite","data-testid":m,children:[t.jsxs("div",{className:"pb-0.5 pt-1 text-center",children:[t.jsx("div",{className:"mx-auto mb-3.5 flex h-[78px] w-[78px] items-center justify-center rounded-full bg-pos-ok-fill text-pos-ok",children:t.jsx(P,{icon:"solar:check-circle-bold",width:46,height:46,"aria-hidden":"true"})}),t.jsx("p",{className:"text-[22px] font-semibold","data-testid":`${m}-title`,children:h.title}),x&&t.jsx("p",{className:"my-1 text-[30px] font-semibold tabular-nums","data-testid":`${m}-total`,children:x}),n&&t.jsx("p",{className:"text-[13px] text-default-500","data-testid":`${m}-reason`,children:h.reason.replace("{reason}",n)})]}),t.jsxs("div",{className:"mt-5 text-left",children:[t.jsx("p",{className:Tn,children:h.destinationsTitle}),a.map((g,j)=>t.jsxs("div",{className:"flex items-center justify-between gap-2.5 border-b border-pos-line-2 py-[11px] text-sm last:border-b-0","data-testid":`${m}-destination-${j}-${g.status}`,children:[t.jsx("span",{className:"font-semibold",children:g.label}),t.jsxs("div",{className:"flex items-center gap-2.5",children:[t.jsx("span",{className:"tabular-nums text-default-600",children:ge(g.amount.value,void 0,g.amount.currency)}),t.jsx("span",{className:c.cn(ax,sx[g.status]),children:g.status==="succeeded"?h.succeeded:h.pending})]})]},`${g.label}-${j}`))]}),l&&t.jsxs("div",{className:"mt-5 text-left",children:[t.jsx("p",{className:Tn,children:h.sendReceipt}),t.jsx("div",{className:"flex flex-col gap-2",children:rx.map(g=>{const j=i?.includes(g)??!1;return t.jsxs("button",{type:"button",role:"checkbox","aria-checked":j,onClick:()=>l(g),className:"flex min-h-[44px] w-full items-center gap-2.5 rounded-[10px] p-2 text-left text-sm outline-none transition-colors hover:bg-default-100 focus-visible:outline focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-primary","data-testid":`${m}-receipt-${g}`,children:[t.jsx("span",{"aria-hidden":"true",className:"pointer-events-none flex",children:t.jsx(c.Checkbox,{isSelected:j,isReadOnly:!0,tabIndex:-1})}),t.jsx("span",{children:h[g]})]},g)})})]}),r&&t.jsx("p",{className:"mt-4 text-[12.5px] text-default-500","data-testid":`${m}-authorized-by`,children:h.authorizedBy.replace("{name}",r)}),t.jsx("div",{className:"mt-auto pt-5",children:t.jsx(B,{color:"primary",className:"h-12 w-full rounded-[14px] px-5 text-[15px] font-semibold",onPress:o,"data-testid":`${m}-done`,children:h.done})})]})};bl.displayName="OutcomeView";const Me={base:"relative inline-grid min-w-[10.75rem] grid-cols-[minmax(0,1fr)]",baseActive:"max-w-[20rem]",cell:"[grid-area:1/1]",sizer:"invisible h-0 overflow-hidden whitespace-nowrap border-x-2 border-transparent pl-2 pr-[4.8125rem] text-[0.875rem] font-semibold",select:"w-full",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-[3.25rem]",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]"},yl=({label:e,value:s,options:a,onChange:n,clearLabel:r,minWidth:i,"data-testid":l="filter-select"})=>{const o=s!==null,d=o?a.find(f=>f.value===s)?.label:void 0,u=p.useRef(null);return t.jsxs("div",{ref:u,"data-testid":l,"data-slot":"filter-select","data-active":o?"true":void 0,title:d,className:c.cn(Me.base,o&&Me.baseActive),style:i===void 0?void 0:{minWidth:Ze(i)},children:[t.jsx(He,{"aria-label":e,placeholder:e,size:"sm",variant:"bordered",radius:"md",selectedKeys:s===null?[]:[s],onSelectionChange:f=>{if(f==="all")return;const m=[...f][0];n(m===void 0?null:String(m))},"data-testid":`${l}-trigger`,classNames:{base:c.cn(Me.select,Me.cell),trigger:c.cn(Me.trigger,o&&Me.triggerActive),value:c.cn(Me.value,o&&Me.valueActive),selectorIcon:c.cn(o&&Me.iconActive)},children:a.map(f=>t.jsx(c.SelectItem,{children:f.label},f.value))}),d!==void 0&&t.jsx("span",{"aria-hidden":"true","data-testid":`${l}-sizer`,className:c.cn(Me.sizer,Me.cell),children:d}),o&&t.jsx("button",{type:"button","aria-label":r,onClick:()=>{n(null),u.current?.querySelector('[data-slot="trigger"]')?.focus()},"data-testid":`${l}-clear`,className:Me.clear,children:t.jsx(P,{icon:"lucide:x",className:Me.clearIcon,"aria-hidden":"true"})})]})};yl.displayName="FilterSelect";const st={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"},vl=({status:e,onLoadMore:s,loadingLabel:a,errorLabel:n,retryLabel:r,endLabel:i,"data-testid":l="load-more-footer"})=>{const o=p.useRef(null),d=p.useRef(s),u=p.useRef(!1);return p.useEffect(()=>{d.current=s},[s]),p.useEffect(()=>{if(e!=="idle"){u.current=!1;return}const f=o.current;if(!f||typeof IntersectionObserver>"u")return;const m=new IntersectionObserver(h=>{u.current||!h.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":l,"data-status":"idle",className:st.idle,children:t.jsx("div",{ref:o,"aria-hidden":"true","data-testid":`${l}-sentinel`,className:st.sentinel})}):e==="loading"?t.jsxs("div",{"data-testid":l,"data-status":"loading",role:"status","aria-live":"polite",className:st.base,children:[t.jsx("span",{"aria-hidden":"true",className:st.spinner,children:t.jsx(c.Spinner,{size:"sm",color:"default"})}),t.jsx("span",{"data-testid":`${l}-loading`,children:a})]}):e==="error"?t.jsxs("div",{"data-testid":l,"data-status":"error",className:st.base,children:[t.jsx("span",{role:"alert","data-testid":`${l}-error`,className:st.error,children:n}),t.jsx(B,{size:"sm",color:"default",variant:"bordered",radius:"md",onPress:s,testId:`${l}-retry`,children:r})]}):t.jsx("div",{"data-testid":l,"data-status":"end",className:i?st.base:st.idle,children:i&&t.jsx("span",{"data-testid":`${l}-end`,children:i})})};vl.displayName="LoadMoreFooter";const $e={base:"w-full",list:"m-0 list-none p-0",item:"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 ${Ot}`,headline:"flex items-baseline gap-2.5",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",chips:"mt-[0.5625rem] flex 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"},In=({item:e})=>t.jsxs(t.Fragment,{children:[t.jsxs("span",{className:$e.headline,children:[t.jsx("span",{className:$e.title,children:e.title}),oe(e.amount)&&t.jsx("span",{className:$e.amount,children:e.amount})]}),oe(e.chips)&&t.jsx("span",{className:$e.chips,children:e.chips}),e.rows&&e.rows.length>0&&t.jsx("span",{className:$e.rows,children:e.rows.map((s,a)=>t.jsxs("span",{className:$e.row,children:[t.jsx("span",{className:$e.rowLabel,children:s.label}),t.jsx("span",{className:$e.rowValue,children:s.value})]},a))})]}),jl=({items:e,ariaLabel:s,onSelect:a,loading:n=!1,skeletonCount:r=6,"data-testid":i="card-list"})=>t.jsx("div",{"data-testid":i,className:$e.base,children:n?t.jsx("div",{role:"status","aria-busy":"true","aria-label":s,"data-testid":`${i}-skeleton`,children:t.jsx("div",{"aria-hidden":"true",children:Array.from({length:r},(l,o)=>t.jsxs("div",{"data-testid":`${i}-skeleton-row`,className:$e.skeletonRow,children:[t.jsx("div",{className:Zt,style:{height:Ze(13),width:Ze(130)}}),t.jsx("div",{className:Zt,style:{height:Ze(11),width:"70%",marginTop:Ze(10)}}),t.jsx("div",{className:Zt,style:{height:Ze(11),width:"45%",marginTop:Ze(8)}})]},o))})}):t.jsx("ul",{"aria-label":s,className:$e.list,children:e.map(l=>t.jsx("li",{"data-testid":`${i}-item-${l.id}`,className:$e.item,children:a?t.jsx("button",{type:"button",onClick:()=>a(l.id),className:c.cn($e.card,$e.cardInteractive),children:t.jsx(In,{item:l})}):t.jsx("div",{className:$e.card,children:t.jsx(In,{item:l})})},l.id))})});jl.displayName="CardList";const ix=48,te={base:`mb-4 overflow-hidden rounded-2xl border border-pos-line bg-white ${fs}`,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 ${Ot}`,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"},wl=p.forwardRef((e,s)=>t.jsx("li",{ref:s,...Object.fromEntries(Object.entries(e).filter(([a])=>a!=="data-testid"))}));wl.displayName="CrumbBase";const Nl=({breadcrumb:e,onBack:s,backLabel:a,title:n,meta:r,amountLabel:i,amount:l,amountCaption:o,recordId:d,chips:u,statItems:f,stats:m,banner:h,"data-testid":x="record-header"})=>{const{ref:g,width:j}=jt(),b=!It(j,ix),w=!!(f&&f.length>0),N=!!i||oe(l)||oe(o)||oe(d)||oe(u)||w;return t.jsxs("div",{ref:g,"data-testid":x,"data-size":b?"narrow":"wide",className:te.base,children:[t.jsxs("div",{"data-testid":`${x}-band`,className:te.band,children:[s&&t.jsx("button",{type:"button",onClick:s,"aria-label":a,"data-testid":`${x}-back`,className:te.back,children:t.jsx(P,{icon:"lucide:chevron-left",className:te.backIcon,"aria-hidden":"true"})}),t.jsx(c.Breadcrumbs,{separator:"/","data-testid":`${x}-breadcrumb`,classNames:{base:te.breadcrumb,list:te.breadcrumbList},itemClasses:{base:te.crumbBase,item:te.crumb,separator:te.crumbSeparator},children:e.map(($,v)=>t.jsx(c.BreadcrumbItem,{as:wl,"data-testid":`${x}-crumb-${v}`,isDisabled:!$.onClick&&v<e.length-1,onPress:$.onClick?()=>$.onClick?.():void 0,children:$.label},v))})]}),t.jsxs("div",{className:c.cn(te.body,b?te.bodyNarrow:te.bodyWide),children:[t.jsxs("div",{className:te.identity,children:[t.jsx("h1",{"data-testid":`${x}-title`,className:c.cn(te.title,b?te.titleNarrow:te.titleWide),children:n}),r&&r.length>0&&t.jsx("ul",{"data-testid":`${x}-meta`,className:te.meta,children:r.map(($,v)=>t.jsxs("li",{className:te.metaLine,children:[$.icon!=null&&t.jsx("span",{"aria-hidden":"true",className:te.metaIcon,children:$.icon}),t.jsx("span",{className:te.metaText,children:$.text})]},v))})]}),N&&t.jsxs("div",{"data-testid":`${x}-money`,className:c.cn(te.money,b?te.moneyNarrow:te.moneyWide),children:[i&&t.jsx("div",{className:te.amountLabel,children:i}),oe(l)&&t.jsx("div",{"data-testid":`${x}-amount`,className:c.cn(te.amount,b?te.amountNarrow:te.amountWide),children:l}),oe(o)&&t.jsx("div",{className:te.amountCaption,children:o}),oe(d)&&t.jsx("div",{"data-testid":`${x}-record-id`,className:te.recordId,children:d}),oe(u)&&t.jsx("div",{"data-testid":`${x}-chips`,className:c.cn(te.chips,b?te.chipsNarrow:te.chipsWide),children:u}),w&&t.jsx("dl",{"data-testid":`${x}-stat-items`,className:te.statItems,children:f?.map(($,v)=>t.jsxs("div",{"data-testid":`${x}-stat-${v}`,className:c.cn(te.stat,b?te.statNarrow:te.statWide),children:[t.jsx("dt",{"data-testid":`${x}-stat-${v}-label`,className:te.statLabel,children:$.label}),t.jsx("dd",{"data-testid":`${x}-stat-${v}-value`,className:te.statValue,style:$.tone?{color:qe[$.tone].fg}:void 0,children:$.value})]},$.id??v))})]})]}),oe(m)&&t.jsx("div",{"data-testid":`${x}-stats`,className:b?te.statsNarrow:te.statsWide,children:m}),oe(h)&&t.jsx("div",{"data-testid":`${x}-banner`,children:h})]})};Nl.displayName="RecordHeader";const lx=50,$t={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]"},Cl=({children:e,aside:s,"data-testid":a="record-layout"})=>{const{ref:n,width:r}=jt(),i=oe(s),l=i&&r>0&&It(r,lx),o=t.jsx("div",{"data-testid":`${a}-main`,className:$t.column,children:e},"main"),d=i?t.jsx("div",{"data-testid":`${a}-aside`,className:$t.aside,children:s},"aside"):null;return t.jsx("div",{ref:n,"data-testid":a,"data-layout":l?"split":"stacked",className:c.cn($t.base,l?$t.split:$t.stacked),children:l?[o,d]:[d,o]})};Cl.displayName="RecordLayout";const ox=560,At={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"},kl=({items:e,"data-testid":s="stat-tiles"})=>{const{ref:a,width:n}=jt(),r=n>=_m?Math.max(e.length,1):n>=ox?2:1;return t.jsx("div",{ref:a,"data-testid":s,"data-columns":r,className:At.base,style:{gridTemplateColumns:`repeat(${r}, minmax(0, 1fr))`},children:e.map((i,l)=>t.jsxs("div",{"data-testid":`${s}-item-${l}`,className:At.tile,children:[t.jsx("div",{"data-testid":`${s}-item-${l}-value`,className:At.value,style:i.tone?{color:qe[i.tone].fg}:void 0,children:i.value}),t.jsx("div",{"data-testid":`${s}-item-${l}-label`,className:At.label,children:i.label}),oe(i.caption)&&t.jsx("div",{"data-testid":`${s}-item-${l}-caption`,className:At.caption,children:i.caption})]},l))})};kl.displayName="StatTiles";const at={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 px-[0.875rem] py-[0.5625rem] 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:"text-[0.84375rem] leading-[1.5] font-normal text-default-600 group-data-[selected=true]:font-semibold group-data-[selected=true]:text-default-900",title:"inline-flex items-center gap-[0.4375rem] whitespace-nowrap",count:"rounded-full bg-default-200 px-[0.4375rem] py-px text-[0.71875rem] leading-[1.5] font-semibold text-default-600 group-data-[selected=true]:bg-acct-rust-fill group-data-[selected=true]:text-primary-600"},Ma="pill-tabs",_a=(e,s=Ma)=>`${s}-tab-${e}`,Ra=(e,s=Ma)=>`${s}-panel-${e}`,cx=(e,s=Ma)=>({role:"tabpanel",id:Ra(e,s),"aria-labelledby":_a(e,s),tabIndex:0}),Sl=({items:e,value:s,onChange:a,ariaLabel:n,idPrefix:r,"data-testid":i="pill-tabs"})=>{const l=qm(),o=!!c.useProviderContext()?.disableAnimation,d=r??i;return t.jsx(c.Tabs,{"aria-label":n,variant:"solid",radius:"full",fullWidth:!0,disableAnimation:l||void 0,selectedKey:s,onSelectionChange:u=>a(String(u)),"data-testid":i,classNames:{base:at.base,tabList:at.tabList,cursor:at.cursor,tab:c.cn(at.tab,(l||o)&&at.tabStill),tabContent:at.tabContent},children:e.map(u=>t.jsx(c.Tab,{id:_a(u.key,d),"aria-controls":Ra(u.key,d),"data-testid":`${i}-${u.key}`,title:t.jsxs("span",{className:at.title,children:[u.label,u.count!==void 0&&t.jsx("span",{"data-testid":`${i}-${u.key}-count`,className:at.count,children:u.count})]})},u.key))})};Sl.displayName="PillTabs";const xe={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 ${Ot}`,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"},Pn=({row:e,testId:s})=>t.jsxs(t.Fragment,{children:[t.jsx("span",{"aria-hidden":"true",className:xe.dot,style:{backgroundColor:qe[e.tone].fg}}),t.jsxs("span",{className:xe.body,children:[t.jsx("span",{className:xe.title,children:e.title}),(e.reference!=null||e.timestamp!=null)&&t.jsxs("span",{className:xe.meta,children:[e.reference!=null&&t.jsx("span",{className:xe.reference,children:e.reference}),e.reference!=null&&e.timestamp!=null&&t.jsx("span",{"aria-hidden":"true",className:xe.separator,children:"·"}),e.timestamp!=null&&t.jsx("span",{className:xe.timestamp,children:e.timestamp})]}),e.detail!=null&&t.jsx("span",{className:xe.detail,children:e.detail})]}),t.jsx("span",{className:xe.trailing,children:e.amount!=null?t.jsx("span",{"data-testid":`${s}-amount`,className:xe.amount,style:Pt(e.amountTone),children:e.amount}):e.note!=null?t.jsx("span",{"data-testid":`${s}-note`,className:xe.note,style:e.noteTone==="warn"?{color:qe.warn.fg}:void 0,children:e.note}):null})]}),$l=({rows:e,footer:s,emptyContent:a,onSelect:n,"data-testid":r="amount-list"})=>e.length===0?t.jsx("div",{"data-testid":r,className:xe.base,children:a!=null&&t.jsx("div",{"data-testid":`${r}-empty`,className:xe.empty,children:a})}):t.jsxs("div",{"data-testid":r,className:xe.base,children:[t.jsx("ul",{className:xe.list,children:e.map(i=>{const l=`${r}-row-${i.id}`;return t.jsx("li",{"data-testid":l,className:xe.item,children:n?t.jsx("button",{type:"button",onClick:()=>n(i.id),className:c.cn(xe.row,xe.rowInteractive),children:t.jsx(Pn,{row:i,testId:l})}):t.jsx("div",{className:xe.row,children:t.jsx(Pn,{row:i,testId:l})})},i.id)})}),s&&t.jsxs(t.Fragment,{children:[t.jsxs("div",{"data-testid":`${r}-footer`,className:xe.footer,children:[t.jsx("span",{className:xe.footerLabel,children:s.label}),t.jsx("span",{"data-testid":`${r}-footer-amount`,className:xe.footerAmount,style:Pt(s.amountTone),children:s.amount})]}),s.note!=null&&t.jsx("div",{"data-testid":`${r}-footer-note`,className:xe.footerNote,children:s.note})]})]});$l.displayName="AmountList";const _e={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"},Al=({events:e,emptyContent:s,"data-testid":a="activity-timeline"})=>e.length===0?t.jsx("div",{"data-testid":a,children:s!=null&&t.jsx("div",{"data-testid":`${a}-empty`,className:_e.empty,children:s})}):t.jsx("ol",{"data-testid":a,className:_e.list,children:e.map((n,r)=>{const i=r===e.length-1,l=`${a}-event-${n.id}`;return t.jsxs("li",{"data-testid":l,className:c.cn(_e.event,!i&&_e.eventSpaced),children:[t.jsxs("span",{"aria-hidden":"true",className:_e.rail,children:[t.jsx("span",{className:_e.dot,style:{backgroundColor:qe[n.tone].fg}}),!i&&t.jsx("span",{"data-testid":`${l}-connector`,className:_e.connector})]}),t.jsxs("div",{className:_e.body,children:[t.jsxs("div",{className:_e.head,children:[t.jsx("span",{className:_e.title,children:n.title}),t.jsx("span",{className:_e.timestamp,children:n.timestamp})]}),oe(n.detail)&&t.jsx("div",{className:_e.detail,children:n.detail}),oe(n.actor)&&t.jsx("div",{"data-testid":`${l}-actor`,className:_e.actor,children:n.actor})]})]},n.id)})});Al.displayName="ActivityTimeline";const ve={base:`overflow-hidden rounded-2xl border border-pos-line bg-white ${fs}`,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 ${Ot}`,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"},On=({row:e,testId:s})=>t.jsxs(t.Fragment,{children:[t.jsxs("span",{className:ve.rowBody,children:[t.jsxs("span",{className:ve.rowHead,children:[t.jsx("span",{className:e.onSelect?ve.primaryLinked:ve.primaryPlain,children:e.primary}),e.chip]}),!!e.secondary&&t.jsx("span",{className:ve.secondary,children:e.secondary})]}),!!e.amount&&t.jsx("span",{"data-testid":`${s}-amount`,className:ve.amount,style:Pt(e.amountTone),children:e.amount})]}),Dl=({title:e,count:s,rows:a,emptyContent:n,"data-testid":r="related-record-list"})=>{const i=p.useId(),l=!!e;return t.jsxs("section",{"data-testid":r,role:l?"group":void 0,"aria-labelledby":l?i:void 0,className:ve.base,children:[l&&t.jsxs("div",{className:ve.header,children:[t.jsx("h3",{id:i,className:ve.title,children:e}),s!==void 0&&t.jsx("span",{"data-testid":`${r}-count`,className:ve.count,children:s})]}),a.length===0?!!n&&t.jsx("div",{"data-testid":`${r}-empty`,className:c.cn(ve.empty,!l&&ve.emptyHeadless),children:n}):t.jsx("ul",{className:ve.list,children:a.map((o,d)=>{const u=`${r}-row-${o.id}`;return t.jsx("li",{"data-testid":u,className:c.cn(ve.item,d===0&&!l&&ve.itemFirstHeadless),children:o.onSelect?t.jsx("button",{type:"button",onClick:o.onSelect,className:c.cn(ve.row,ve.rowInteractive),children:t.jsx(On,{row:o,testId:u})}):t.jsx("div",{className:ve.row,children:t.jsx(On,{row:o,testId:u})})},o.id)})})]})};Dl.displayName="RelatedRecordList";const El=({title:e,titleAs:s="h2",icon:a,count:n,badge:r,action:i,description:l,footer:o,variant:d="section",body:u="padded",children:f,"data-testid":m="record-card"})=>{const h=p.useId(),x=oe(e);return t.jsxs("section",{"data-testid":m,"data-variant":d,role:x?"group":void 0,"aria-labelledby":x?h:void 0,className:Qe.base,children:[x&&t.jsxs("div",{"data-testid":`${m}-header`,className:Jm[d],children:[oe(a)&&t.jsx("span",{"aria-hidden":"true",className:Qe.icon,children:a}),t.jsx(s,{id:h,className:Qe.title,children:e}),oe(n)&&t.jsx("span",{"data-testid":`${m}-count`,className:Qe.count,children:n}),r,oe(i)&&t.jsx("span",{"data-testid":`${m}-action`,className:Qe.action,children:i})]}),t.jsxs("div",{"data-testid":`${m}-body`,className:ef[d][u],children:[oe(l)&&t.jsx("p",{"data-testid":`${m}-description`,className:Qe.description,children:l}),f,oe(o)&&t.jsx("div",{"data-testid":`${m}-footer`,className:c.cn(Qe.footer,oe(f)?Qe.footerAfterContent:Qe.footerAfterDescription),children:o})]})]})};El.displayName="RecordCard";const dx={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]"},Fl=({layout:e="stack",className:s,children:a,"data-testid":n="card-stack",...r})=>t.jsx("div",{...r,"data-testid":n,"data-layout":e,className:c.cn(dx[e],s),children:a});Fl.displayName="CardStack";const Wt={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]"},ux={regular:"py-[0.5625rem]",compact:"py-2"},Ll=({rows:e,density:s="regular","data-testid":a="key-value-rows"})=>t.jsx("dl",{"data-testid":a,className:Wt.list,children:e.map((n,r)=>t.jsxs("div",{"data-testid":`${a}-row-${n.id??r}`,className:c.cn(Wt.row,ux[s]),children:[t.jsx("dt",{className:Wt.label,children:n.label}),t.jsx("dd",{className:Wt.value,children:n.value})]},n.id??r))});Ll.displayName="KeyValueRows";const Be={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"},Ml=({items:e,ariaLabel:s,originalAmountLabel:a,"data-testid":n="line-item-rows"})=>t.jsx("ul",{"aria-label":s,"data-testid":n,className:Be.list,children:e.map(r=>{const i=`${n}-item-${r.id}`,l=oe(r.originalAmount);return t.jsxs("li",{"data-testid":i,className:Be.row,style:r.tone?{backgroundColor:qe[r.tone].bg}:void 0,children:[t.jsxs("div",{className:Be.body,children:[t.jsx("div",{className:Be.name,children:r.name}),r.details&&r.details.length>0&&t.jsx("div",{"data-testid":`${i}-details`,className:Be.details,children:r.details.map((o,d)=>t.jsxs(p.Fragment,{children:[d>0&&t.jsx("span",{"aria-hidden":"true",className:Be.separator,children:"·"}),t.jsx("span",{className:Be.detail,children:o})]},d))})]}),t.jsxs("div",{className:Be.trailing,children:[t.jsxs("span",{className:Be.amounts,children:[l&&t.jsxs("s",{"data-testid":`${i}-original`,className:Be.original,children:[a&&t.jsxs("span",{className:"sr-only",children:[a," "]}),r.originalAmount]}),t.jsx("span",{"data-testid":`${i}-amount`,className:Be.amount,style:l?{color:qe.ok.fg}:void 0,children:r.amount})]}),r.chip]})]},r.id)})});Ml.displayName="LineItemRows";const mx=37.5,Ne={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"},_l=({rows:e,total:s,memo:a,"data-testid":n="record-totals"})=>{const{ref:r,width:i}=jt(),l=i>0&&!It(i,mx),o=l?Ne.rowNarrow:Ne.rowWide,d=l?Ne.labelNarrow:Ne.labelWide,u=l?Ne.noteNarrow:Ne.noteWide;return t.jsxs("div",{ref:r,"data-testid":n,"data-size":l?"narrow":"wide",className:Ne.base,children:[e.map(f=>{const m=`${n}-row-${f.id}`;return t.jsxs("div",{"data-testid":m,className:c.cn(o,Ne.row),children:[t.jsx("span",{"data-testid":`${m}-label`,className:c.cn(d,Ne.label),children:f.label}),t.jsx("span",{"data-testid":`${m}-note`,className:c.cn(u,Ne.note),children:f.note}),t.jsx("span",{"data-testid":`${m}-value`,className:Ne.value,style:Pt(f.tone),children:f.value})]},f.id)}),t.jsx("div",{className:Ne.totalRule,children:t.jsxs("div",{"data-testid":`${n}-total`,className:c.cn(o,Ne.totalRow),children:[t.jsx("span",{className:c.cn(d,Ne.totalLabel),children:s.label}),t.jsx("span",{"data-testid":`${n}-total-value`,className:Ne.totalValue,children:s.value})]})}),oe(a)&&t.jsx("div",{"data-testid":`${n}-memo`,className:Ne.memo,children:a})]})};_l.displayName="RecordTotals";const ea={base:"whitespace-nowrap text-[0.875rem]",secondary:"text-default-500",chipStack:"inline-flex flex-col items-start gap-[0.3125rem]"},fx={text:"text-default-900",reference:"font-normal text-primary",amount:"font-semibold tabular-nums text-default-900"},Rl=({variant:e="text",tone:s,secondary:a,children:n,"data-testid":r="cell-text"})=>t.jsxs("span",{"data-testid":r,className:c.cn(ea.base,fx[e]),style:Pt(s),children:[n,oe(a)&&t.jsxs("span",{"data-testid":`${r}-secondary`,className:ea.secondary,children:[t.jsx("span",{"aria-hidden":"true",children:" · "}),a]})]});Rl.displayName="CellText";const Tl=({children:e,"data-testid":s="chip-stack"})=>t.jsx("span",{"data-testid":s,className:ea.chipStack,children:e});Tl.displayName="ChipStack";exports.ActivityTimeline=Al;exports.AdminFieldLabel=Fi;exports.AdminTable=wi;exports.AdminTextField=Li;exports.AdminToolbar=Ni;exports.AmountList=$l;exports.AppliedCodeCard=Jn;exports.Button=B;exports.CardList=jl;exports.CardStack=Fl;exports.CashTenderForm=af;exports.CatalogItemCard=ni;exports.CellText=Rl;exports.CheckTenderForm=zi;exports.ChipStack=Tl;exports.CommitmentDetails=ju;exports.ConfirmDialog=Qi;exports.ConfirmationModal=va;exports.ConfirmationPageTemplate=qc;exports.CustomerCard=ml;exports.DatePicker=ua;exports.DimensionChip=ka;exports.DonationAmounts=Dr;exports.EmptyState=ja;exports.ErrorState=wa;exports.EventDetails=$d;exports.EventDetailsTemplate=Yc;exports.ExpireCartTimer=Er;exports.FeedbackState=vt;exports.FilterPopover=ci;exports.FilterSelect=yl;exports.Footer=Qc;exports.HeroUIProvider=ho;exports.HorizontalSteps=Cr;exports.InstallmentFundAssignment=pu;exports.InstallmentFundAssignmentSkeleton=yu;exports.InstallmentSchedule=zu;exports.InstallmentScheduleSkeleton=Gu;exports.InstallmentTable=Xu;exports.ItemCard=ai;exports.KeyValueChip=ka;exports.KeyValueRows=Ll;exports.LineItemList=ll;exports.LineItemRows=Ml;exports.ListPanel=Ii;exports.LoadMoreFooter=vl;exports.LoadingOverlay=Gi;exports.LoadingState=Na;exports.MembershipSelectCards=am;exports.MetaCard=Uf;exports.ModalShell=Ui;exports.ModalShellFooter=qi;exports.ModalShellHeader=Hi;exports.Multiselect=Zc;exports.Navbar=Hc;exports.NotesField=xl;exports.OfferCard=es;exports.OfferCardEmpty=Fr;exports.OfferCardError=Lr;exports.OfferCardList=Tr;exports.OfferCardSkeleton=Mr;exports.OtherTenderForm=Bi;exports.OutcomeView=bl;exports.PageHeader=mi;exports.PaginationSummary=Ti;exports.PaymentCashChangeBanner=Aa;exports.PaymentSubAmountInput=Da;exports.PaymentSuccessView=Ki;exports.PaymentTotalBanner=Yi;exports.PickerRow=_i;exports.PillTabs=Sl;exports.PinField=gl;exports.ProgramListItem=ri;exports.RICH_TEXT_PRESETS=$r;exports.ReasonSelect=fl;exports.RecordCard=El;exports.RecordHeader=Nl;exports.RecordLayout=Cl;exports.RecordTotals=_l;exports.RedeemCodeInput=zc;exports.RelatedRecordList=Dl;exports.RevenueDistributionCard=Gr;exports.RevenueDistributionEmpty=Kr;exports.RevenueDistributionError=Qr;exports.RevenueDistributionSkeleton=Zr;exports.RichTextArea=Ar;exports.RowActions=Mi;exports.SectionPanel=ul;exports.Select=He;exports.SessionTimeline=di;exports.SplitPaymentSummary=Vi;exports.SplitTenderPanel=pl;exports.StatTiles=kl;exports.StatusChip=fi;exports.Stepper=wr;exports.SuccessState=ii;exports.Summary=rl;exports.TableSkeleton=pi;exports.TenderMethods=hl;exports.TicketSelection=Sm;exports.TileSelect=Wi;exports.Toggle=li;exports.ToolbarButton=Ci;exports.UnderlineTabs=ki;exports.WizardShell=il;exports.adminFieldErrorClass=Ei;exports.adminFieldHintClass=Di;exports.adminFieldLabelClass=Sa;exports.adminFieldLabelSuffixClass=$a;exports.adminInputClass=$i;exports.adminInputReadOnlyClass=Ai;exports.adminInputWrapperClass=Si;exports.adminRowClass=yi;exports.adminSurfaceCss=xo;exports.adminSurfaceTokens=sa;exports.adminTableClass=vi;exports.adminTableFooterClass=ji;exports.adminTdClass=bi;exports.adminThClass=gi;exports.calculateAllocationDifference=ru;exports.computeChange=Hs;exports.currencyFractionDigits=Rt;exports.formatMoney=ge;exports.formatOfferCurrency=Ws;exports.formatRevenueAmount=tu;exports.formatRevenueCurrency=su;exports.generateAutomaticInstallments=ei;exports.generateDistributionId=ya;exports.getCurrencySymbol=au;exports.offerCardVariants=Rr;exports.offerListVariants=_r;exports.pageRange=Ri;exports.parseOfferCurrency=Ad;exports.parseRevenueCurrency=nu;exports.pillTabId=_a;exports.pillTabPanelId=Ra;exports.pillTabPanelProps=cx;exports.posSurfaceTokens=je;exports.roundToCurrency=Nr;Object.keys(c).forEach(e=>{e!=="default"&&!Object.prototype.hasOwnProperty.call(exports,e)&&Object.defineProperty(exports,e,{enumerable:!0,get:()=>c[e]})});
|
|
41
|
+
`,Ui=p.forwardRef(({children:e,relativeOverlayRoot:s=!0,className:a,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:c.cn("flex flex-col gap-4 p-4 rounded-3xl bg-white shadow-xl","md:gap-5 md:p-6",s&&"relative","motion-safe:animate-[pp-modal-in_220ms_ease-out]","motion-safe:transition-[min-height] motion-safe:duration-[420ms] motion-safe:ease-in-out",a),children:e})]}));Ui.displayName="ModalShell";const Hi=({title:e,subtitle:s,leading:a,titleClassName:n,onClose:r,closeLabel:i="Close",actions:l,className:o,"data-testid":d="modal-shell-header"})=>t.jsxs("header",{className:c.cn("flex items-center justify-between gap-3",o),"data-testid":d,children:[t.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[a,t.jsxs("div",{className:"min-w-0",children:[t.jsx("h2",{className:c.cn("text-xl font-semibold",n),"data-testid":`${d}-title`,children:e}),s&&t.jsx("div",{className:"text-xs font-semibold text-default-500","data-testid":`${d}-subtitle`,children:s})]})]}),t.jsxs("div",{className:"flex items-center gap-2",children:[l,r&&t.jsx(B,{isIconOnly:!0,variant:"light",radius:"full",size:"sm",onPress:r,"aria-label":i,"data-testid":`${d}-close`,children:t.jsx(P,{icon:"lucide:x",width:20,height:20,"aria-hidden":"true"})})]})]});Hi.displayName="ModalShellHeader";const qi=({children:e,columns:s=2,className:a,"data-testid":n="modal-shell-footer"})=>t.jsx("footer",{className:c.cn("mt-2 gap-3",s===2?"flex flex-col md:grid md:grid-cols-2 [&>*]:w-full [&>*:first-child]:md:order-2 [&>*:nth-child(2)]:md:order-1":"grid grid-cols-1",a),"data-testid":n,children:e});qi.displayName="ModalShellFooter";const hf={2:"sm:grid-cols-2",3:"sm:grid-cols-3",4:"sm:grid-cols-4"},pf={1:"grid-cols-1",2:"grid-cols-2"},Rs=e=>typeof e=="string"?t.jsx(P,{icon:e,width:20,height:20,"aria-hidden":"true"}):e,qt="h-[34px] min-h-0 min-w-fit flex-1 whitespace-nowrap rounded-full px-[10px] text-[13px] font-medium transition-colors",gf="pointer-events-none absolute -left-[9999px] top-0 flex flex-row gap-1 p-1 opacity-0",Fn="flex-none",bf=typeof window<"u"?p.useLayoutEffect:p.useEffect,Ln=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",Wi=({options:e,selectedKey:s,onSelect:a,heading:n,ariaLabel:r="Select an option",variant:i="tiles",maxVisible:l,moreLabel:o="More",columnsDesktop:d=3,columnsMobile:u=2,className:f,"data-testid":m="tile-select"})=>{const h=e.find(x=>x.key===s);return i==="compact"?t.jsx(yf,{options:e,selectedKey:s,onSelect:a,ariaLabel:r,moreLabel:o,dataTestId:m,...n!==void 0?{heading:n}:{},...l!==void 0?{maxVisible:l}:{},...f!==void 0?{className:f}:{}}):t.jsxs("div",{className:c.cn("flex flex-col gap-3",f),"data-testid":m,children:[n&&t.jsx("h3",{className:"text-sm font-medium text-default-700",id:`${m}-heading`,children:n}),t.jsx("div",{className:"md:hidden",children:t.jsx(He,{"aria-label":n?void 0:r,"aria-labelledby":n?`${m}-heading`:void 0,selectedKeys:s?[s]:[],onSelectionChange:x=>{const j=Array.from(x)[0];typeof j=="string"&&a(j)},placeholder:r,variant:"bordered",radius:"lg","data-testid":`${m}-mobile-select`,startContent:h?t.jsx("span",{"aria-hidden":"true",className:"shrink-0",children:Rs(h.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(x=>t.jsx(c.SelectItem,{isDisabled:x.isDisabled,startContent:t.jsx("span",{"aria-hidden":"true",className:"shrink-0",children:Rs(x.icon)}),"data-testid":x["data-testid"]??`${m}-${x.key}-mobile`,children:x.label},x.key))})}),t.jsx("div",{role:"group","aria-labelledby":n?`${m}-heading`:void 0,"aria-label":n?void 0:r,className:c.cn("hidden md:grid gap-3",pf[u],hf[d]),children:e.map(x=>{const g=s===x.key;return t.jsxs(B,{variant:"bordered",radius:"lg","aria-pressed":g,"aria-label":x.label,isDisabled:x.isDisabled,onPress:()=>a(x.key),"data-testid":x["data-testid"]??`${m}-${x.key}`,className:c.cn("flex flex-col items-center justify-center gap-2 h-auto min-h-[80px] px-4 py-4","border bg-transparent transition-colors",g?"border-primary bg-primary-50 text-primary":"border-default-200 text-default-800 hover:bg-default-50"),children:[t.jsx("span",{"aria-hidden":"true",children:Rs(x.icon)}),t.jsx("span",{className:"text-sm font-medium",children:x.label})]},x.key)})})]})};Wi.displayName="TileSelect";function yf({options:e,selectedKey:s,onSelect:a,heading:n,ariaLabel:r,maxVisible:i,moreLabel:l,className:o,dataTestId:d}){const u=p.useRef(null),f=p.useRef(null),m=p.useMemo(()=>e.map((F,C)=>({option:F,index:C})).filter(({option:F})=>F.alwaysInMenu!==!0).map(({index:F})=>F),[e]),h=m.length<e.length,x=p.useCallback(F=>{const C=m.map(E=>({index:E,priority:e[E]?.priority??0})).sort((E,A)=>E.priority-A.priority||A.index-E.index),_=new Set(C.slice(0,m.length-F).map(E=>E.index));return m.filter(E=>!_.has(E))},[e,m]),[g,j]=p.useState(e.length);bf(()=>{const F=u.current,C=f.current;if(!F||!C)return;const _=()=>{const A=Array.from(C.children),R=A.slice(0,e.length).map(W=>W.getBoundingClientRect().width),O=A[e.length]?.getBoundingClientRect().width??0,V=window.getComputedStyle(F),q=Number.parseFloat(V.columnGap)||0,I=F.clientWidth-(Number.parseFloat(V.paddingLeft)||0)-(Number.parseFloat(V.paddingRight)||0);if(I<=0||R.some(W=>W===0)){j(m.length);return}const J=W=>{const se=h||W<m.length,Y=W+(se?1:0);return x(W).reduce((Q,ee)=>Q+(R[ee]??0),0)+(se?O:0)+q*(Y-1)<=I};for(let W=m.length;W>=1;W-=1)if(J(W)){j(W);return}j(1)};_();const E=new ResizeObserver(_);return E.observe(F),()=>E.disconnect()},[e,l,x,m,h]);const b=Math.max(1,Math.min(g,i??m.length,m.length)),N=!h&&b===m.length-1&&g===m.length?m.length:b,D=h||N<m.length,v=new Set(x(N)),S=e.filter((F,C)=>v.has(C)),M=D?e.filter((F,C)=>!v.has(C)):[],k=M.find(F=>F.key===s);return t.jsxs("div",{className:c.cn("relative flex flex-col gap-3",o),"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:[S.map(F=>t.jsx(B,{variant:"light",radius:"full","aria-pressed":s===F.key,isDisabled:F.isDisabled,onPress:()=>a(F.key),"data-testid":F["data-testid"]??`${d}-${F.key}`,className:c.cn(qt,Ln(s===F.key)),children:F.label},F.key)),M.length>0&&t.jsxs(c.Dropdown,{placement:"bottom-end",radius:"lg",children:[t.jsx(c.DropdownTrigger,{children:t.jsxs(B,{variant:"light",radius:"full","aria-pressed":k!==void 0,"data-testid":`${d}-more`,className:c.cn(qt,"gap-1",k!==void 0?"min-w-0":"min-w-fit",Ln(k!==void 0)),children:[t.jsx("span",{className:"min-w-0 truncate",children:k?.label??l}),t.jsx(P,{icon:"lucide:chevron-down",width:14,height:14,"aria-hidden":"true"})]})}),t.jsx(c.DropdownMenu,{"aria-label":l,className:"w-64 p-2",selectionMode:"single",selectedKeys:k?[k.key]:[],disabledKeys:M.filter(F=>F.isDisabled).map(F=>F.key),onAction:F=>a(String(F)),children:M.map(F=>t.jsx(c.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:gf,children:[e.map(F=>t.jsx(B,{variant:"light",radius:"full",tabIndex:-1,className:c.cn(qt,Fn),children:F.label},F.key)),t.jsxs(B,{variant:"light",radius:"full",tabIndex:-1,className:c.cn(qt,Fn,"gap-1"),children:[l,t.jsx(P,{icon:"lucide:chevron-down",width:14,height:14})]})]})]})}const vf={subtle:{wrapper:"bg-default-100",amount:"text-default-900"},success:{wrapper:"bg-success-50 text-success-700",amount:"text-success-700"}},Yi=({total:e,label:s,locale:a="en-US",variant:n="subtle",className:r,"data-testid":i="payment-total-banner"})=>{const l=vf[n];return t.jsxs("div",{"data-testid":i,className:c.cn("rounded-2xl px-6 py-5 text-center",l.wrapper,r),children:[t.jsx("div",{className:"text-sm text-default-600",children:s}),t.jsx("div",{className:c.cn("mt-1 text-4xl font-bold tracking-tight",l.amount),"data-testid":`${i}-amount`,children:ge(e.value,a,e.currency)})]})};Yi.displayName="PaymentTotalBanner";const jf={white:"bg-white/70 backdrop-blur-sm",transparent:"bg-transparent"},Gi=({title:e,subtitle:s,backdrop:a="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:c.cn("absolute inset-0 z-10 flex flex-col items-center justify-center gap-4 rounded-3xl",jf[a],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}),s&&t.jsx("div",{className:"mt-1 text-sm text-default-600",children:s})]})]});Gi.displayName="LoadingOverlay";const Aa=({cashChange:e,label:s="Cash to return",secondaryLine:a,locale:n="en-US",onDismiss:r,dismissAriaLabel:i="Dismiss",align:l="left",className:o,"data-testid":d="payment-cash-change-banner"})=>{if(!e||e.value<=0)return null;const u=l==="center";return t.jsxs("div",{role:"status","aria-live":"polite","data-testid":d,className:c.cn("flex w-full items-center gap-3 rounded-2xl border border-info-200 bg-info-50 px-5 py-4",u?"justify-center text-center":"text-left","motion-safe:animate-[pp-slide-down_200ms_ease-out]",o),children:[t.jsx(P,{icon:"lucide:info",width:28,height:28,className:"shrink-0 text-info-700","aria-hidden":"true"}),t.jsxs("div",{className:c.cn("flex flex-col",u?"items-center":"flex-1"),children:[t.jsx("span",{className:"text-xs font-medium uppercase tracking-wider text-info-700",children:s}),t.jsx("span",{className:"text-2xl font-bold text-info-700","data-testid":`${d}-amount`,children:ge(e.value,n,e.currency)}),a&&t.jsx("span",{className:"mt-0.5 text-xs text-info-700/80",children:a})]}),r&&t.jsx(B,{isIconOnly:!0,variant:"light",radius:"full",size:"sm",onPress:r,"aria-label":i,"data-testid":`${d}-dismiss`,className:"shrink-0 text-info-700 hover:bg-info-100",children:t.jsx(P,{icon:"lucide:x",width:18,height:18,"aria-hidden":"true"})})]})};Aa.displayName="PaymentCashChangeBanner";const Ki=({title:e,subtitle:s,emailLine:a,confirmationEmail:n,cashChange:r,cashChangeLabel:i="Cash to return",locale:l="en-US",closeLabel:o="Close",onClose:d,className:u,"data-testid":f="payment-success-view"})=>{const m=!!(r&&r.value>0);return t.jsxs("div",{"data-testid":f,className:c.cn("flex flex-col items-center gap-6 py-8 px-4 text-center","motion-safe:animate-[pp-fade-in_250ms_ease-out]",u),children:[t.jsx("div",{"aria-hidden":"true",className:"flex items-center justify-center rounded-full bg-[#A2D9C6] p-[10px]",children:t.jsx(P,{icon:"gravity-ui:circle-check-fill",width:76,height:76,className:"text-[#10B981]","aria-hidden":"true"})}),t.jsxs("div",{className:"space-y-3",children:[t.jsx("h2",{className:"text-2xl font-bold","data-testid":`${f}-title`,children:e}),t.jsx("p",{className:"text-default-700",children:s}),a&&n&&t.jsxs("p",{className:"text-default-700",children:[a,t.jsx("br",{}),t.jsx("strong",{className:"font-semibold",children:n})]})]}),m&&r&&t.jsx(Aa,{cashChange:r,label:i,locale:l,align:"center",className:"max-w-[400px]","data-testid":`${f}-cash-change`}),d&&t.jsx(B,{color:"default",variant:"bordered",radius:"full",size:"lg",onPress:d,"data-testid":`${f}-close`,className:"mt-4 w-full",children:o})]})};Ki.displayName="PaymentSuccessView";const Da=({heading:e,amountLabel:s,value:a,defaultValue:n,onChange:r,onBlur:i,placeholder:l,isDisabled:o,isInvalid:d,errorMessage:u,autoFocus:f,maxAmount:m,hideHeading:h=!1,className:x,"data-testid":g="payment-sub-amount-input"})=>{const j=`${g}-input`,b=p.useCallback(N=>{if(m!==void 0){const D=Number.parseFloat(N.replace(",","."));if(Number.isFinite(D)&&D>m)return}r?.(N)},[m,r]),w=p.useCallback(N=>{const D=N.currentTarget;requestAnimationFrame(()=>{D.isConnected&&D.select()})},[]);return t.jsxs("div",{className:c.cn("flex flex-col gap-3 border-t border-default-100 pt-5",x),"data-testid":g,children:[t.jsx("h3",{className:c.cn("text-lg font-semibold",h&&"sr-only"),"data-testid":`${g}-heading`,children:e}),t.jsx(c.Input,{id:j,label:s,labelPlacement:"outside",classNames:h?{label:"sr-only"}:void 0,type:"text",inputMode:"decimal",pattern:"[0-9]*[.,]?[0-9]*",value:a,defaultValue:n,onChange:N=>b(N.target.value),onFocus:w,onBlur:i,placeholder:l,isDisabled:o,isInvalid:d,errorMessage:d?u:void 0,variant:"bordered",radius:"lg","aria-invalid":d||void 0,autoFocus:f,"data-testid":`${g}-field`})]})};Da.displayName="PaymentSubAmountInput";const wf={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"}},Nf=e=>typeof e=="string"?t.jsx(P,{icon:e,className:"size-5","aria-hidden":"true"}):e,Qi=({isOpen:e,title:s,confirmLabel:a,onConfirm:n,onOpenChange:r,children:i,description:l,cancelLabel:o="Cancel",variant:d="danger",isPending:u=!1,isDismissable:f,isKeyboardDismissDisabled:m=!1,hideIcon:h=!1,icon:x,"data-testid":g="confirm-dialog"})=>{const j=i??l??null,b=wf[d],w=h?null:Nf(x??b.icon);return t.jsx(c.Modal,{isOpen:e,onOpenChange:N=>r?.(N),placement:"center",size:"md",isDismissable:(f??!0)&&!u,isKeyboardDismissDisabled:m||u,hideCloseButton:u,className:"gap-4 p-6",classNames:{base:"rounded-3xl"},"data-testid":g,children:t.jsxs(c.ModalContent,{role:"alertdialog",children:[t.jsxs(c.ModalHeader,{className:"flex flex-col items-center gap-3 p-0 text-center",children:[w?t.jsx("div",{"aria-hidden":"true","data-testid":`${g}-icon`,className:c.cn("flex size-10 items-center justify-center rounded-full",b.tile),children:w}):null,t.jsx("span",{"data-testid":`${g}-title`,className:"text-lg font-semibold text-zinc-950",children:s})]}),j!==null?t.jsx(c.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(c.ModalFooter,{className:"flex flex-col-reverse gap-2 p-0 sm:flex-row sm:gap-3",children:[t.jsx(B,{variant:"bordered",color:"default",radius:"full",onPress:()=>r?.(!1),isDisabled:u,"data-testid":`${g}-dismiss`,className:"w-full sm:flex-1",children:o}),t.jsx(B,{color:b.confirmColor,variant:"solid",radius:"full",onPress:n,isLoading:u,"data-testid":`${g}-confirm`,className:"w-full sm:flex-1",children:a})]})]})})};Qi.displayName="ConfirmDialog";const Cf=60,kf=(e,s,a=Cf)=>s?e>a:e<-a,Zi=(e,s)=>Math.max(0,Math.min(e,s)),Sf=160,$f=(e,s,a=Sf)=>Math.min(e,Math.max(0,s-a)),Af=(e,s,a)=>Zi(e-s,a),Df=(e,s,a)=>e!==null?Zi(e,a):s?a:0,Ef=e=>e?"":"transition-[height] duration-300 ease-out",Ff=e=>({onDrag:(s,a)=>{const n=e.open?e.fullHeight:0;e.setDragHeight(Af(n,a?.offset?.y??0,e.fullHeight))},onDragEnd:(s,a)=>{kf(a?.offset?.y??0,e.open)&&e.onToggleOpen?.(),e.setDragHeight(null)}}),ut=(e,s)=>ge(e.value,s,e.currency);function oe(e){return e!=null&&e!==!1&&e!==""}const Ea=({item:e,locale:s,onRemove:a,removeAriaLabel:n,showRemoveButton:r=!0,compact:i=!1})=>{const l=!!e.children&&e.children.length>0,o=!!a&&r,d=e.tone?"text-default-600":"text-default-500";return t.jsxs("div",{"data-testid":`summary-item-${e.id}`,className:c.cn(i?"flex flex-col gap-1 py-3 first:pt-0":"flex flex-col gap-2",e.tone&&"-mx-2 rounded-lg px-2 py-1.5"),style:e.tone?{backgroundColor:qe[e.tone].bg}:void 0,children:[t.jsxs("div",{className:i?"flex items-start justify-between gap-2":"flex min-h-9 items-center justify-between gap-2",children:[t.jsxs("div",{className:"flex min-w-0 items-center gap-2 text-base text-foreground",children:[!i&&typeof e.quantity=="number"&&t.jsxs("span",{"data-testid":`summary-item-qty-${e.id}`,className:"shrink-0",children:[e.quantity," x"]}),e.leadingIcon,t.jsx("span",{"data-testid":`summary-item-name-${e.id}`,className:i?"line-clamp-2 text-sm font-semibold":c.cn("truncate",e.emphasis&&"font-medium"),children:e.name})]}),t.jsxs("div",{className:"flex shrink-0 items-center",children:[e.originalAmount&&t.jsx("span",{"data-testid":`summary-item-original-${e.id}`,className:"mr-2 whitespace-nowrap text-[13px] text-default-600 line-through",children:e.originalAmount}),e.amount&&t.jsx("span",{"data-testid":`summary-item-amount-${e.id}`,className:i?"whitespace-nowrap text-sm font-semibold text-foreground":"whitespace-nowrap text-base text-foreground",children:ut(e.amount,s)}),o&&t.jsx(B,{isIconOnly:!0,size:"sm",variant:"light",radius:"full",className:c.cn("ml-1 size-8 min-w-8 p-2 text-danger",i&&"-my-1.5"),"aria-label":n,"data-testid":`summary-remove-${e.id}`,onPress:()=>a(e.id),children:t.jsx(P,{icon:"lucide:trash-2",width:16,height:16,className:"text-danger"})})]})]}),oe(e.trailing)&&t.jsx("div",{"data-testid":`summary-item-trailing-${e.id}`,className:"flex justify-end",children:e.trailing}),e.dateLabel&&t.jsxs("div",{"data-testid":`summary-item-date-${e.id}`,className:c.cn("flex items-center gap-2 text-sm",d),children:[t.jsx(P,{icon:"lucide:calendar",width:16,height:16,className:"shrink-0"}),t.jsx("span",{className:"truncate",children:e.dateLabel})]}),e.dateRange&&t.jsxs("div",{"data-testid":`summary-item-daterange-${e.id}`,className:c.cn("flex items-center gap-2 text-sm",d),children:[t.jsx(P,{icon:"lucide:calendar",width:16,height:16,className:"shrink-0"}),t.jsx("span",{children:e.dateRange.from}),t.jsx(P,{icon:"lucide:arrow-right",width:16,height:16,className:"shrink-0"}),t.jsx("span",{children:e.dateRange.to})]}),e.details?.map((u,f)=>t.jsxs("div",{"data-testid":`summary-item-detail-${e.id}-${u.key??f}`,className:c.cn("flex items-center justify-between gap-2",i?"text-xs":"text-sm",d),children:[t.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[u.icon,t.jsx("span",{className:"truncate",children:u.label})]}),(u.value!=null||u.tooltip!=null)&&t.jsxs("div",{className:"flex shrink-0 items-center gap-1",children:[u.value!=null&&t.jsx("span",{className:c.cn("whitespace-nowrap",u.valueTone==="primary"&&c.cn("font-medium",e.tone?"text-primary-600":"text-primary")),children:u.value}),u.tooltip!=null&&t.jsx(c.Tooltip,{content:u.tooltip,children:t.jsx("span",{"data-testid":`summary-item-detail-tooltip-${e.id}-${u.key??f}`,className:"flex shrink-0 items-center",children:t.jsx(P,{icon:"lucide:info",width:16,height:16,className:c.cn(u.valueTone==="primary"?"text-primary":"text-default-400")})})})]})]},u.key??f)),l&&t.jsx("div",{"data-testid":`summary-children-${e.id}`,className:"flex flex-col gap-2 pl-6",children:e.children.map(u=>t.jsx(Ea,{item:u,locale:s,onRemove:a,removeAriaLabel:n,showRemoveButton:r,compact:i},u.id))})]})};Ea.displayName="SummaryItemRow";const Xi=({fee:e,locale:s,className:a})=>t.jsxs("div",{"data-testid":"summary-service-fee",className:c.cn("flex items-center justify-between gap-2",a),children:[t.jsxs("button",{type:"button",role:"switch","aria-checked":!!e.isSelected,"aria-label":typeof e.label=="string"?e.label:"Pay Service fee","data-testid":"summary-service-fee-toggle",onClick:e.onToggle,className:"flex min-w-0 items-center gap-2 text-left",children:[t.jsx("span",{"aria-hidden":"true",className:c.cn("flex size-4 shrink-0 items-center justify-center rounded-full border",e.isSelected?"border-primary":"border-default-200"),children:e.isSelected&&t.jsx("span",{className:"size-2 rounded-full bg-primary"})}),t.jsx("span",{className:"truncate text-sm font-medium text-foreground",children:e.label})]}),t.jsx("span",{"data-testid":"summary-service-fee-amount",className:"whitespace-nowrap text-base text-foreground",children:ut(e.amount,s)})]});Xi.displayName="SummaryServiceFeeRow";const Fa=({row:e,locale:s,emphasized:a,onRemove:n,removeAriaLabel:r,showRemoveButton:i=!0,compact:l=!1})=>{const o=!!n&&i&&!!e.id,d=t.jsx("span",{"data-testid":`summary-row-amount-${e.key}`,className:l?"whitespace-nowrap":"whitespace-nowrap text-base",children:ut(e.amount,s)});return t.jsxs("div",{"data-testid":`summary-row-${e.key}`,className:l?"flex items-center justify-between text-sm text-default-500":"flex items-center justify-between text-foreground",children:[t.jsx("span",{"data-testid":`summary-row-label-${e.key}`,className:l?void 0:c.cn(a?"text-xl font-semibold leading-7":"text-base"),children:e.label}),o?t.jsxs("div",{className:"flex shrink-0 items-center",children:[d,t.jsx(B,{isIconOnly:!0,size:"sm",variant:"light",radius:"full",className:c.cn("ml-1 size-8 min-w-8 p-2 text-danger",l&&"-my-1.5"),"aria-label":r,"data-testid":`summary-remove-row-${e.id}`,onPress:()=>n(e.id),children:t.jsx(P,{icon:"lucide:trash-2",width:16,height:16,className:"text-danger"})})]}):d]})};Fa.displayName="SummaryTotalsLineRow";const Ji=({pricesInLabel:e,currency:s,items:a,serviceFee:n,rows:r,locale:i,onRemoveItem:l,removeAriaLabel:o,onRemoveTotalRow:d,removeTotalRowAriaLabel:u,showRemoveButton:f,emptyState:m,compact:h=!1,classNames:x})=>{const g=(a?.length??0)>0;return t.jsxs(t.Fragment,{children:[!h&&t.jsxs("div",{"data-testid":"summary-prices",className:c.cn("flex items-center justify-between text-xs text-default-500",x.prices),children:[t.jsx("span",{children:e}),s!=null&&t.jsx("span",{children:s})]}),g?t.jsx("div",{className:c.cn(h?"flex flex-col divide-y divide-default-100":"flex flex-col gap-4",x.items),children:a.map(j=>t.jsx(Ea,{item:j,locale:i,onRemove:l,removeAriaLabel:o,showRemoveButton:f,compact:h},j.id))}):t.jsx("div",{"data-testid":"summary-empty",children:m}),n&&t.jsxs(t.Fragment,{children:[t.jsx(c.Divider,{className:"bg-default-200"}),t.jsx(Xi,{fee:n,locale:i,className:x.serviceFee})]}),r&&r.length>0&&t.jsx("div",{className:c.cn(h?"flex flex-col gap-1 border-t border-default-100 pt-3":"flex flex-col gap-4",x.totalsRows),children:r.map((j,b)=>t.jsx(Fa,{row:j,locale:i,emphasized:!h&&b===0,onRemove:d,removeAriaLabel:u,showRemoveButton:f,compact:h},j.key))})]})};Ji.displayName="SummaryBody";const el=({total:e,locale:s,compact:a=!1,className:n})=>{const r=a?"text-lg":"text-xl";return t.jsxs("div",{"data-testid":"summary-total",className:c.cn(`flex items-center justify-between ${r} font-semibold leading-7 text-foreground`,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:ut(e.amount,s)})]})};el.displayName="SummaryGrandTotalRow";const tl=({secondaryTotal:e,locale:s,className:a})=>t.jsxs("div",{"data-testid":"summary-secondary-total",className:c.cn("flex items-center justify-between text-lg font-semibold leading-7 text-primary",a),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:ut(e.amount,s)})]});tl.displayName="SummarySecondaryTotalRow";const is=({action:e,disabledByLoading:s,className:a,testId:n="summary-cta"})=>t.jsx(B,{color:"primary",radius:"full",className:c.cn("px-[18px] py-[14px] font-medium",a),"data-testid":n,isLoading:e.isLoading,isDisabled:e.isDisabled||s,onPress:e.onPress,endContent:t.jsx(P,{icon:"lucide:arrow-right",width:16,height:16}),children:e.label});is.displayName="SummaryPrimaryCta";const sl=({title:e,total:s,secondaryTotal:a,locale:n,open:r,progress:i,dragging:l,toggleAriaLabel:o,onToggleOpen:d,classNames:u})=>t.jsx("h2",{children:t.jsxs("button",{type:"button","data-testid":"summary-collapse-toggle","aria-expanded":r,"aria-label":o,onClick:d,className:c.cn("-mx-4 -mt-4 grid w-[calc(100%_+_32px)] grid-cols-1 px-4 pb-4 pt-4 text-left",u.header),children:[t.jsxs("span",{"aria-hidden":!r,style:{opacity:i},className:c.cn("col-start-1 row-start-1 flex items-center justify-between",!l&&"transition-opacity duration-300"),children:[t.jsx("span",{"data-testid":"summary-title",className:c.cn("text-xl font-semibold leading-7 text-foreground",u.title),children:e}),t.jsx("span",{"data-testid":"summary-close","aria-hidden":"true",className:c.cn("shrink-0 text-foreground",u.closeButton),children:t.jsx(P,{icon:"lucide:x",width:20,height:20})})]}),t.jsxs("span",{"aria-hidden":r,style:{opacity:1-i},className:c.cn("col-start-1 row-start-1 flex flex-col gap-2",!l&&"transition-opacity duration-300"),children:[t.jsxs("span",{className:"flex items-center justify-between text-xl font-semibold leading-7 text-foreground",children:[t.jsx("span",{children:s.label??"Total"}),t.jsx("span",{className:"whitespace-nowrap",children:ut(s.amount,n)})]}),a&&t.jsxs("span",{className:"flex items-center justify-between text-lg font-semibold leading-7 text-primary",children:[t.jsx("span",{children:a.label}),t.jsx("span",{className:"whitespace-nowrap",children:ut(a.amount,n)})]})]})]})});sl.displayName="SummaryCollapseHeader";const al=({cart:e,ariaLabel:s,onPress:a,className:n})=>t.jsxs("button",{type:"button","data-testid":"summary-cart","aria-label":s,onClick:a,className:c.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:"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})]});al.displayName="SummaryCartButton";const nl=({open:e,progress:s,dragging:a,primaryAction:n,isLoading:r,cart:i,cartAriaLabel:l,ctaCaption:o,ctaError:d,onToggleOpen:u,classNames:f})=>t.jsxs("div",{"data-testid":"summary-mobile-bar",className:c.cn("flex flex-col gap-4",f.mobileBar),children:[t.jsx(c.Divider,{className:"bg-default-200"}),d&&t.jsx("div",{children:d}),t.jsxs("div",{className:"grid",children:[t.jsxs("div",{"aria-hidden":e,style:{opacity:1-s},className:c.cn("col-start-1 row-start-1 flex items-stretch gap-2.5",e&&"pointer-events-none",!a&&"transition-opacity duration-300"),children:[i&&t.jsx(al,{cart:i,ariaLabel:l,className:f.cart,onPress:()=>{u?.(),i.onPress?.()}}),n&&t.jsx(is,{action:n,disabledByLoading:r,className:c.cn("h-[52px] flex-1",f.cta),testId:"summary-cta-compact"})]}),n&&t.jsx("div",{"aria-hidden":!e,style:{opacity:s},className:c.cn("col-start-1 row-start-1 flex",!e&&"pointer-events-none",!a&&"transition-opacity duration-300"),children:t.jsx(is,{action:n,disabledByLoading:r,className:c.cn("h-[52px] w-full",f.cta)})})]}),o&&t.jsx("div",{children:o})]});nl.displayName="SummaryActionBar";const Lf="(max-width: 767px)",Mf=e=>typeof window<"u"&&typeof window.matchMedia=="function"?window.matchMedia(e).matches:!1,_f=(e=Lf)=>{const[s,a]=p.useState(()=>Mf(e));return p.useEffect(()=>{if(typeof window>"u"||typeof window.matchMedia!="function")return;const n=window.matchMedia(e),r=()=>a(n.matches);return r(),n.addEventListener("change",r),()=>n.removeEventListener("change",r)},[e]),s},rl=({title:e="Summary",pricesInLabel:s="Prices are in",currency:a,locale:n="en-US",items:r,serviceFee:i,rows:l,total:o,postTotalRows:d,onRemoveTotalRow:u,onRemovePostTotalRow:f,secondaryTotal:m,collapsible:h,isOpen:x,onToggleOpen:g,defaultOpen:j=!1,primaryAction:b,isLoading:w=!1,onRemoveItem:N,showRemoveButton:D,ctaCaption:v,ctaError:S,variant:M,cart:k,emptyState:F,labels:C,classNames:_={},density:E="default","data-testid":A="summary",className:R})=>{const O=C?.removeAriaLabel??"Remove item",V=C?.removeTotalRowAriaLabel??"Remove discount",q=C?.removePostTotalRowAriaLabel??"Remove applied code",I=C?.toggleAriaLabel??"Toggle summary",J=C?.cartAriaLabel??"View cart",W=E==="compact",se=_f(),Z=h??(M??(se?"mobile":"main"))==="mobile",[Q,ee]=p.useState(j),ne=x!==void 0,X=!Z||(ne?x:Q),de=p.useCallback(()=>{ne||ee(T=>!T),g?.()},[ne,g]),[ae,Ie]=p.useState(0),[Ee,Le]=p.useState(null),mt=p.useRef(null),Ge=p.useRef(null),We=p.useCallback(()=>{const T=mt.current;T&&Ie($f(T.scrollHeight,window.innerHeight))},[]),rt=p.useCallback(T=>{Ge.current?.disconnect(),Ge.current=null,mt.current=T,T&&(We(),typeof ResizeObserver<"u"&&(Ge.current=new ResizeObserver(We),Ge.current.observe(T)))},[We]);p.useEffect(()=>(window.addEventListener("resize",We),()=>window.removeEventListener("resize",We)),[We]);const Je=Ff({open:X,fullHeight:ae,setDragHeight:Le,onToggleOpen:de}),Pe=Ee!==null,le=Df(Ee,X,ae),ye=ae>0?Math.min(1,Math.max(0,le/ae)):X?1:0,Ye=t.jsx(el,{total:o,locale:n,compact:W,className:_.total}),y=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(Fa,{row:T,locale:n,emphasized:!1,onRemove:f,removeAriaLabel:q,showRemoveButton:D,compact:W},T.key))}),$=m&&t.jsx(tl,{secondaryTotal:m,locale:n,className:_.secondaryTotal}),L=v!=null&&t.jsx("p",{"data-testid":"summary-cta-caption",className:c.cn("text-center text-sm text-default-500",_.ctaCaption),children:v}),U=S!=null&&t.jsx("p",{role:"alert","data-testid":"summary-cta-error",className:c.cn("text-center text-sm text-danger",_.ctaError),children:S}),z=t.jsx(Ji,{pricesInLabel:s,currency:a,items:r,serviceFee:i,rows:l,locale:n,onRemoveItem:N,removeAriaLabel:O,onRemoveTotalRow:u,removeTotalRowAriaLabel:V,showRemoveButton:D,emptyState:F,compact:W,classNames:_});return Z?t.jsxs(De.motion.section,{"data-testid":A,drag:"y",dragConstraints:{top:0,bottom:0},dragElastic:.12,dragSnapToOrigin:!0,onDrag:Je.onDrag,onDragEnd:Je.onDragEnd,className:c.cn("fixed inset-x-0 bottom-0 z-50 flex max-h-full w-full flex-col rounded-t-2xl bg-content1 p-4 drop-shadow-[0_-2px_2px_rgba(0,0,0,0.1)]",R,_.base),children:[t.jsx(sl,{title:e,total:o,secondaryTotal:m,locale:n,open:X,progress:ye,dragging:Pe,toggleAriaLabel:I,onToggleOpen:de,classNames:_}),t.jsx("div",{"data-testid":"summary-reveal","aria-hidden":!X,style:{height:le},className:c.cn("min-h-0",X&&!Pe?"overflow-y-auto overscroll-contain [scrollbar-width:none] [&::-webkit-scrollbar]:hidden":"overflow-hidden",!X&&"pointer-events-none",Ef(Pe)),children:t.jsxs("div",{ref:rt,className:W?"flex flex-col gap-3 pb-4":"flex flex-col gap-4 pb-4",children:[z,!W&&t.jsx(c.Divider,{className:"bg-default-200"}),Ye,y,$]})}),t.jsx(nl,{open:X,progress:ye,dragging:Pe,primaryAction:b,isLoading:w,cart:k,cartAriaLabel:J,ctaCaption:L,ctaError:U,onToggleOpen:de,classNames:_})]}):t.jsxs("section",{"data-testid":A,className:c.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",R,_.base),children:[!W&&t.jsx("div",{className:c.cn("flex items-center justify-between",_.header),children:t.jsx("h2",{"data-testid":"summary-title",className:c.cn("text-xl font-semibold leading-7 text-foreground",_.title),children:e})}),z,!W&&t.jsx(c.Divider,{className:"bg-default-200"}),Ye,y,$,m&&b&&t.jsx(c.Divider,{className:"bg-default-200"}),b&&t.jsx(is,{action:b,disabledByLoading:w,className:c.cn("w-full",_.cta)}),U,L]})};rl.displayName="Summary";const Rf={back:"Back",close:"Close",cancel:"Cancel",partialBadge:"Partial refund",owesBadge:"Customer owes"},Tf={backgroundColor:je.destructive,color:"#fff"},Mn="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",il=({onClose:e,steps:s,activeStepId:a,subtitle:n,onBack:r,primaryAction:i,totalRow:l,secondaryAction:o,hideChrome:d,footerSummary:u,labels:f,className:m,"data-testid":h="wizard-shell",children:x})=>{const g={...Rf,...f},j=s.filter(v=>v.state!=="skipped"),b=s.find(v=>v.id===a),w=Math.max(0,j.findIndex(v=>v.id===a)),N=r??e,D=r?g.back:g.cancel;return t.jsxs("div",{className:c.cn("flex h-full min-h-0 w-full flex-col bg-white text-default-900",m),"data-testid":h,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":`${h}-header`,children:[N&&t.jsx(B,{variant:"light",className:"h-10 min-w-0 gap-2 rounded-xl px-4 text-sm font-semibold text-default-600",onPress:N,"data-testid":`${h}-header-back`,startContent:t.jsx(P,{icon:"lucide:circle-chevron-left",width:18,height:18,"aria-hidden":"true"}),children:D}),t.jsxs("div",{className:"min-w-0",children:[t.jsx("h2",{className:"text-lg font-semibold","data-testid":`${h}-header-title`,children:b?.label??""}),n&&t.jsx("div",{className:"mt-0.5 text-[12.5px] text-default-500","data-testid":`${h}-header-subtitle`,children:n})]}),t.jsxs("div",{className:"relative flex-1","data-testid":`${h}-footer`,children:[e&&t.jsx("button",{type:"button","aria-label":g.close,onClick:e,className:c.cn(Ts,"left-0"),"data-testid":`${h}-header-close`}),r&&t.jsx("button",{type:"button","aria-label":g.back,onClick:r,className:c.cn(Ts,"left-6"),"data-testid":`${h}-back`}),o&&t.jsx("button",{type:"button","aria-label":o.label,disabled:o.disabled,onClick:o.onClick,className:c.cn(Ts,"left-12"),"data-testid":`${h}-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:[l&&t.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-[12.5px] font-semibold text-default-600","data-testid":`${h}-total`,children:[t.jsx("span",{children:l.label}),l.amount&&t.jsx("span",{className:"tabular-nums text-default-900",children:ge(l.amount.value,void 0,l.amount.currency)}),l.badge==="partial"&&t.jsx("span",{className:c.cn(Mn,"bg-pos-warn-fill text-pos-warn"),"data-testid":`${h}-total-partial`,children:g.partialBadge}),l.badge==="owes"&&t.jsx("span",{className:c.cn(Mn,"border border-pos-line bg-default-100 text-default-600"),"data-testid":`${h}-total-owes`,children:g.owesBadge})]}),t.jsx(B,{color:"primary",className:c.cn("h-12 min-w-0 rounded-[14px] px-5 text-[15px] font-semibold",i.tone==="destructive"&&"bg-pos-destructive text-white"),style:i.tone==="destructive"?Tf:void 0,isLoading:i.loading,isDisabled:i.disabled,onPress:i.onClick,"data-testid":`${h}-primary`,children:i.label})]})]}),t.jsx("div",{className:"flex shrink-0 gap-1.5 px-6 py-2.5","data-testid":`${h}-stepper`,children:j.map((v,S)=>t.jsx("span",{className:c.cn("h-1 flex-1 rounded-full",S<w&&"bg-pos-ok",S===w&&"bg-primary",S>w&&"bg-pos-line")},v.id))}),t.jsx("div",{className:"min-h-0 flex-1 overflow-auto px-6 py-[22px]","data-testid":`${h}-body`,children:x}),u]})};il.displayName="WizardShell";const If=(e,s,a)=>Math.min(Math.max(e,s),a);function Xs(e,s,a){const n=Math.max(1,Math.trunc(s)),r=If(Math.trunc(a),0,n);if(r===n)return{...e};if(r===0)return{value:0,currency:e.currency};const i=Math.pow(10,Rt(e.currency)),l=Math.round(e.value*i),o=Math.floor(l/n),d=l-o*n;return{value:(o*r+Math.min(r,d))/i,currency:e.currency}}function Pf(e,s){return Xs(e,s,1)}const Of=e=>Number.isFinite(e)?e.toFixed(2):"",Js=({value:e,expected:s,max:a,onChange:n,ariaLabel:r,isDisabled:i,className:l,"data-testid":o,inputTestId:d})=>{const[u,f]=p.useState(null),m=p.useRef(null),h=Math.abs(e-s)>.004;return t.jsxs("span",{className:c.cn("inline-flex h-11 items-center gap-px rounded-[10px] border px-2.5","focus-within:border-primary focus-within:ring-[3px] focus-within:ring-primary/10",h?"border-primary bg-primary-50":"border-pos-line bg-white",l),"data-testid":o,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??Of(e),onChange:x=>{const g=x.target.value,j=Number.parseFloat(g.replace(",","."));a!==void 0&&Number.isFinite(j)&&j>a+.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})]})};Js.displayName="AmountCell";const zf={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"},Bf="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",_n="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",Is="absolute h-5 w-5 opacity-0",Vf=e=>{const s=ge(e.paidAmount.value,void 0,e.paidAmount.currency);if(e.quantity<=1)return s;const a=Pf(e.paidAmount,e.quantity);return`${e.quantity} × ${ge(a.value,void 0,a.currency)} · ${s}`},ll=({items:e,selections:s,onSelectionChange:a,onRestockToggle:n,onDispositionChange:r,amountOnly:i,labels:l,className:o,"data-testid":d="line-item-list"})=>{const u={...zf,...l},f=[{key:"stock",label:u.dispositionStock},{key:"norestock",label:u.dispositionNoRestock},{key:"damaged",label:u.dispositionDamaged}];return t.jsxs("div",{className:c.cn("flex flex-col text-default-900",o),"data-testid":d,children:[e.map(m=>{const h=s[m.id],x=m.state==="already_refunded"||m.state==="non_refundable",g=`${d}-row-${m.id}`,j=Math.max(1,Math.trunc(m.quantity)),b=h?.quantity,w=h?.selected?Math.min(b??j,j):b??0,N=Xs(m.paidAmount,j,w).value,D=h?.amount??(h?.selected?N:0),v=w===0&&D>.004,S=k=>a(m.id,{selected:k.quantity>0||k.amount>.004,mode:"full",...k}),M=k=>{const F=Math.min(Math.max(k,0),j);S({quantity:F,amount:Xs(m.paidAmount,j,F).value})};return t.jsxs("div",{className:c.cn("relative flex items-start gap-3 border-b border-pos-line-2 py-3 last:border-b-0",x&&"opacity-60"),"data-testid":g,children:[t.jsx("div",{className:"flex h-10 w-10 shrink-0 items-center justify-center rounded-[10px] bg-default-100 text-default-600","data-testid":`${g}-icon`,children:t.jsx(P,{icon:m.icon??"lucide:package",width:19,height:19,"aria-hidden":"true"})}),t.jsxs("div",{className:"min-w-0 flex-1",children:[t.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[t.jsxs("div",{className:"min-w-0",children:[t.jsx("p",{className:"truncate text-sm font-semibold",children:m.name}),t.jsx("p",{className:"text-[12.5px] text-default-500","data-testid":`${g}-detail`,children:m.detail??Vf(m)}),v&&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:ge(m.paidAmount.value,void 0,m.paidAmount.currency)}):t.jsx(Js,{value:D,expected:N,max:m.paidAmount.value,onChange:k=>S({quantity:w,amount:k}),ariaLabel:u.amount.replace("{name}",m.name),className:"w-[120px]","data-testid":`${g}-amount`,inputTestId:`${g}-partial-input-field`}),x?t.jsx("span",{className:Bf,"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:_n,"aria-label":u.decrease.replace("{name}",m.name),disabled:w===0,onClick:()=>M(w-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:w}),t.jsx("button",{type:"button",className:_n,"aria-label":u.increase.replace("{name}",m.name),disabled:w===j,onClick:()=>M(w+1),"data-testid":`${g}-qty-increase`,children:"+"})]})]})]}),w>=j&&t.jsx("p",{className:"mt-2 text-xs text-default-500","data-testid":`${g}-max-note`,children:u.maxNote.replace("{count}",String(j))}),h?.selected&&!m.restock.available&&m.restock.unavailableHint&&t.jsx("p",{className:"mt-2 text-xs text-default-500",children:m.restock.unavailableHint}),m.warning&&t.jsxs("div",{className:"mt-2.5 flex items-start gap-2 rounded-[10px] bg-pos-warn-fill px-2.5 py-2 text-[12.5px] text-pos-warn","data-testid":`${g}-warning`,children:[t.jsx(P,{icon:"gravity-ui:triangle-exclamation-fill",width:15,height:15,className:"mt-0.5 shrink-0","aria-hidden":"true"}),t.jsx("span",{children:m.warning})]}),w>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(He,{"aria-label":u.disposition,className:"w-[220px]",selectedKeys:[m.restock.disposition??(m.restock.on?"stock":"norestock")],onSelectionChange:k=>{if(k==="all")return;const F=[...k][0];F&&(r?.(m.id,F),n(m.id,F==="stock"))},"data-testid":`${g}-restock`,children:f.map(k=>t.jsx(c.SelectItem,{children:k.label},k.key))})]})]}),!x&&t.jsxs(t.Fragment,{children:[t.jsx(c.Checkbox,{className:c.cn(Is,"right-0 top-0 m-0 p-0"),isSelected:!!h?.selected,onValueChange:k=>a(m.id,{selected:k,mode:"full"}),"aria-label":m.name,"data-testid":`${g}-checkbox`}),t.jsx("button",{type:"button","aria-label":u.partialLink,onClick:()=>document.querySelector(`[data-testid="${g}-partial-input-field"]`)?.focus(),className:c.cn(Is,"left-0 top-0"),"data-testid":`${g}-partial-link`}),t.jsx("button",{type:"button","aria-label":u.partialCancel,onClick:()=>S({quantity:w,amount:N}),className:c.cn(Is,"left-5 top-0"),"data-testid":`${g}-partial-cancel`})]})]},m.id)}),i&&(i.value===null?t.jsxs("button",{type:"button",onClick:i.onAdd,className:"mt-1 inline-flex items-center gap-1.5 self-start rounded pt-3 text-[12.5px] font-semibold text-primary outline-none hover:text-primary-600 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary","data-testid":`${d}-amount-only-add`,children:[t.jsx(P,{icon:"lucide:plus",width:13,height:13,"aria-hidden":"true"}),u.amountOnlyAdd]}):t.jsxs("div",{className:"flex items-start gap-3 border-b border-pos-line-2 pb-3 pt-5 last:border-b-0","data-testid":`${d}-amount-only`,children:[t.jsx("div",{className:"flex h-10 w-10 shrink-0 items-center justify-center rounded-[10px] bg-default-100 text-default-600",children:t.jsx(P,{icon:"lucide:circle-dollar-sign",width:19,height:19,"aria-hidden":"true"})}),t.jsx("div",{className:"min-w-0 flex-1",children:t.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[t.jsxs("div",{className:"min-w-0",children:[t.jsx("p",{className:"text-sm font-semibold",children:u.amountOnlyTitle}),t.jsx("p",{className:"text-[12.5px] text-default-500",children:u.amountOnlyDetail.replace("{amount}",ge(i.max.value,void 0,i.max.currency))})]}),t.jsxs("div",{className:"flex w-full flex-wrap items-center gap-2.5 sm:w-[290px] sm:flex-nowrap",children:[t.jsx(Js,{value:i.value,expected:i.value,max:i.max.value,onChange:i.onChange,ariaLabel:u.amountOnlyTitle,className:"flex-1",inputTestId:`${d}-amount-only-input`}),t.jsx("button",{type:"button","aria-label":u.amountOnlyRemove,onClick:i.onRemove,className:"flex h-11 w-11 shrink-0 items-center justify-center rounded-full bg-pos-danger-fill text-pos-danger outline-none transition-colors hover:bg-[#F8D6D6] focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-pos-danger","data-testid":`${d}-amount-only-remove`,children:t.jsx(P,{icon:"lucide:trash-2",width:17,height:17,"aria-hidden":"true"})})]})]})})]}))]})};ll.displayName="LineItemList";const ol=({children:e,className:s,"data-testid":a="meta-card"})=>t.jsx("div",{className:c.cn("mx-auto mt-[18px] flex max-w-[1040px] flex-col gap-3",s),"data-testid":a,children:t.jsx("div",{className:"rounded-[14px] border border-pos-line bg-white px-4 py-3.5 text-default-900",children:e})});ol.displayName="MetaCard";const cl=({label:e,htmlFor:s,children:a,className:n,"data-testid":r="meta-card-row"})=>t.jsxs("div",{className:c.cn("flex flex-wrap items-center justify-between gap-4",n),"data-testid":r,children:[t.jsx("label",{htmlFor:s,className:"text-[13px] font-medium text-default-600",children:e}),t.jsx("div",{className:"w-full sm:w-[290px] sm:shrink-0",children:a})]});cl.displayName="MetaCard.Row";const dl=({label:e,children:s,className:a,"data-testid":n="meta-card-section"})=>t.jsxs("div",{className:c.cn("mt-3.5 flex flex-col gap-2.5 border-t border-pos-line pt-3",a),"data-testid":n,children:[e&&t.jsx("p",{className:"text-[13px] font-medium text-default-600",children:e}),s]});dl.displayName="MetaCard.Section";const Uf=Object.assign(ol,{Row:cl,Section:dl}),ul=({heading:e,icon:s="lucide:rotate-ccw",action:a,children:n,className:r,"data-testid":i="section-panel"})=>t.jsxs("section",{className:c.cn("mx-auto max-w-[1040px] rounded-2xl border border-pos-line bg-white px-[18px] py-4",r),"data-testid":i,children:[t.jsxs("div",{className:"mb-3 flex items-center gap-2 text-[13px] font-semibold text-default-600",children:[t.jsx(P,{icon:s,width:16,height:16,"aria-hidden":"true"}),t.jsx("h3",{"data-testid":`${i}-heading`,children:e}),t.jsx("div",{className:"flex-1"}),a&&t.jsxs("button",{type:"button",disabled:a.disabled,onClick:a.onClick,className:c.cn("inline-flex min-h-8 shrink-0 items-center gap-1.5 rounded-full border border-primary","bg-primary/5 px-3 py-[7px] text-[12.5px] font-semibold text-primary outline-none","transition-colors hover:bg-primary/10 disabled:cursor-not-allowed disabled:opacity-60","focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary"),"data-testid":`${i}-action`,children:[t.jsx(P,{icon:a.icon??"lucide:plus",width:14,height:14,"aria-hidden":"true"}),a.label]})]}),n]});ul.displayName="SectionPanel";const ml=({name:e,detail:s,icon:a="lucide:users",labels:n,className:r,"data-testid":i="customer-card"})=>t.jsxs("div",{className:c.cn("mb-3.5 flex items-center gap-3 rounded-xl bg-default-100 px-3.5 py-3",r),"data-testid":i,children:[t.jsx("div",{className:"flex h-[38px] w-[38px] shrink-0 items-center justify-center rounded-[10px] bg-default-100 text-default-600",children:t.jsx(P,{icon:a,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}),s&&t.jsx("p",{className:"text-[12.5px] text-default-500",children:s})]})]});ml.displayName="CustomerCard";const Hf={label:"Reason for the return",placeholder:"Select a reason…"},fl=({options:e,value:s,onChange:a,error:n,labels:r,className:i,"data-testid":l="reason-select"})=>{const o={...Hf,...r};return t.jsx(He,{label:o.label,labelPlacement:"outside",placeholder:o.placeholder,selectedKeys:s?[s]:[],isInvalid:!!n,errorMessage:n,className:c.cn(i),"data-testid":l,onSelectionChange:d=>{if(d==="all")return;const u=[...d][0];u&&a(String(u))},children:e.map(d=>t.jsx(c.SelectItem,{children:d.label},d.id))})};fl.displayName="ReasonSelect";const qf={toggle:"Add a note",optionalTag:"(optional)",heading:"Additional note",placeholder:"Add a note (optional)"},xl=({value:e,onChange:s,maxLength:a,alwaysExpanded:n=!1,hideLabel:r=!1,labels:i,className:l,"data-testid":o="notes-field"})=>{const d={...qf,...i},[u,f]=p.useState(e!=="");return n?t.jsxs("div",{className:c.cn("flex flex-col gap-2",l),"data-testid":o,children:[!r&&t.jsx("label",{htmlFor:`${o}-textarea`,className:"text-[13px] font-medium text-default-600",children:d.heading}),t.jsx("textarea",{id:`${o}-textarea`,"aria-label":r?d.heading:void 0,value:e,onChange:m=>s(m.target.value),maxLength:a,placeholder:d.placeholder,className:c.cn("min-h-[52px] w-full resize-y rounded-[10px] border border-pos-line bg-white px-3 py-2.5","text-[13.5px] leading-[1.45] text-default-900 outline-none","placeholder:text-default-500","focus:border-primary focus:ring-[3px] focus:ring-primary/10"),"data-testid":`${o}-textarea`})]}):t.jsx("div",{className:c.cn(l),"data-testid":o,children:u?t.jsx(c.Textarea,{value:e,onChange:m=>s(m.target.value),maxLength:a,placeholder:d.toggle,"aria-label":d.toggle,variant:"bordered",radius:"lg","data-testid":`${o}-textarea`}):t.jsxs(B,{variant:"light",className:"h-auto min-w-0 px-1 py-0.5 text-xs font-semibold text-primary",onPress:()=>f(!0),"data-testid":`${o}-toggle`,children:[d.toggle,t.jsx("span",{className:"ml-1 font-normal text-default-400",children:d.optionalTag})]})})};xl.displayName="NotesField";const Wf={danger:{surface:"bg-pos-danger-fill",disc:"bg-pos-danger-icon text-pos-danger",title:"text-pos-danger"},warning:{surface:"bg-pos-warn-fill",disc:"bg-pos-warn-icon text-pos-warn",title:"text-pos-warn"}},Yf={danger:"gravity-ui:circle-exclamation-fill",warning:"gravity-ui:triangle-exclamation-fill"},Rn="h-8 min-w-0 rounded-[10px] px-3 text-[13px] font-semibold",La=({tone:e,title:s,body:a,onRetry:n,retryLabel:r,onChooseDifferent:i,chooseDifferentLabel:l,className:o,"data-testid":d,retryTestId:u,chooseDifferentTestId:f})=>{const m=Wf[e];return t.jsxs("div",{role:"alert",className:c.cn("flex items-start gap-3.5 rounded-[14px] p-4 px-[18px]",m.surface,o),"data-testid":d,children:[t.jsx("div",{className:c.cn("flex h-10 w-10 shrink-0 items-center justify-center rounded-full",m.disc),"aria-hidden":"true",children:t.jsx(P,{icon:Yf[e],width:22,height:22})}),t.jsxs("div",{className:"min-w-0 flex-1",children:[s&&t.jsx("p",{className:c.cn("font-semibold",m.title),children:s}),t.jsx("p",{className:"mt-0.5 text-[13px] text-default-600",children:a}),t.jsxs("div",{className:"mt-3 flex gap-2.5",children:[n&&t.jsx(B,{color:"primary",className:Rn,onPress:n,"data-testid":u,children:r}),t.jsx(B,{variant:"bordered",className:c.cn(Rn,"border-1 border-pos-line bg-white text-default-900"),onPress:i,"data-testid":f,children:l})]})]})]})};La.displayName="TenderBanner";const Gf={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"},Kf={card:"lucide:credit-card",cash:"lucide:dollar-sign",check:"lucide:edit-3",other:"lucide:more-horizontal"},hl=({tenders:e,selectedTenderId:s,onSelect:a,onSplit:n,error:r,labels:i,className:l,"data-testid":o="tender-methods"})=>{const d={...Gf,...i},u=r?.kind==="processor_declined";return t.jsxs("div",{className:c.cn("flex flex-col text-default-900",l),"data-testid":o,children:[r&&t.jsx(La,{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":`${o}-error`,retryTestId:`${o}-retry`,chooseDifferentTestId:`${o}-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":`${o}-tiles`,children:[e.map(f=>{const m=f.tenderId===s;return t.jsxs("button",{type:"button",role:"radio","aria-checked":m,onClick:()=>a(f.tenderId),className:c.cn("flex items-center gap-[11px] rounded-[14px] border-[1.5px] bg-white px-[15px] py-[11px] text-left","outline-none transition-colors","focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary",m?"border-primary bg-primary/5":"border-pos-line hover:border-primary"),"data-testid":`${o}-tile-${f.tenderId}`,children:[t.jsx("span",{className:c.cn("flex h-[34px] w-[34px] shrink-0 items-center justify-center rounded-[10px]",m?"bg-primary text-white":"bg-default-100 text-default-600"),children:t.jsx(P,{icon:Kf[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:ge(f.maxRefundable.value,void 0,f.maxRefundable.currency)})]})]},f.tenderId)}),t.jsxs("button",{type:"button",onClick:n,className:c.cn("flex items-center gap-[11px] rounded-[14px] border-[1.5px] border-pos-line bg-white px-[15px] py-[11px] text-left","outline-none transition-colors hover:border-primary","focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary"),"data-testid":`${o}-split`,children:[t.jsx("span",{className:"flex h-[34px] w-[34px] shrink-0 items-center justify-center rounded-[10px] bg-default-100 text-default-600",children:t.jsx(P,{icon:"lucide:split",width:18,height:18,"aria-hidden":"true"})}),t.jsx("span",{className:"min-w-0 text-sm font-semibold",children:d.split})]})]})]})};hl.displayName="TenderMethods";const Qf=e=>e.refunded!==null,Zf={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"},Xf="mb-2 text-[11px] font-semibold uppercase tracking-[.08em] text-default-500",Jf="inline-flex h-[22px] shrink-0 items-center gap-[5px] whitespace-nowrap rounded-full px-[9px] text-xs font-medium leading-none",pl=({parts:e,refundedSoFar:s,remaining:a,current:n,methods:r,onRefundPart:i,partError:l,onBack:o,busy:d,hideActions:u,labels:f,className:m,"data-testid":h="split-tender-panel"})=>{const x={...Zf,...f},g=e.filter(Qf),j=e.find(k=>k.tenderId===n.tenderId)?.label,b=!!(r?.length&&n.onTenderChange),w=Rt(a.currency),{draft:N,setDraft:D,normalize:v}=Oi(n.amount,String),S=p.useCallback(k=>{Pi(k,w)&&(D(k),n.onAmountChange(rs(k)??0))},[n,D,w]),M=l?.kind==="processor_declined";return t.jsxs("div",{className:c.cn("flex flex-col text-default-900",m),"data-testid":h,children:[t.jsx("h3",{className:"sr-only","data-testid":`${h}-title`,children:x.title}),l&&t.jsx(La,{tone:M?"danger":"warning",title:M?x.declinedTitle:x.networkTitle,body:M?x.partDeclinedBody:x.partNetworkBody,onRetry:l.onRetry,retryLabel:x.retry,onChooseDifferent:l.onChooseDifferent,chooseDifferentLabel:x.chooseDifferent,className:"mb-[18px]","data-testid":`${h}-part-error`,retryTestId:`${h}-retry`,chooseDifferentTestId:`${h}-choose-different`}),t.jsxs("div",{"data-testid":`${h}-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:ge(a.value,void 0,a.currency)}),t.jsxs("span",{className:"sr-only",children:[x.refundedSoFar,": ",ge(s.value,void 0,s.currency)]})]}),g.length>0&&t.jsxs("div",{children:[t.jsx("p",{className:Xf,children:x.refundedSoFar}),g.map((k,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":`${h}-part-${k.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:k.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:k.label}),k.feeNote&&t.jsx("span",{className:"block text-[11.5px] text-default-500",children:k.feeNote})]}),t.jsx("span",{className:"font-semibold tabular-nums",children:ge(k.refunded.value,void 0,k.refunded.currency)}),t.jsx("span",{className:c.cn(Jf,k.status==="pending"?"bg-pos-warn-fill text-pos-warn":"bg-pos-ok-fill text-pos-ok"),children:k.status==="pending"?x.pending:x.succeeded})]},k.tenderId))]})]}),t.jsxs("div",{className:"mt-3.5","data-testid":`${h}-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":`${h}-amount-label`,children:x.amountForPart}),t.jsx(Da,{heading:x.amountForPart,amountLabel:x.amountForPart,hideHeading:!0,placeholder:"$0.00",value:N,onChange:S,onBlur:v,maxAmount:a.value,isDisabled:d,className:"gap-0 border-t-0 pt-0","data-testid":`${h}-amount`}),b&&t.jsx("div",{className:"mt-2.5 flex gap-2","data-testid":`${h}-methods`,children:r?.map(k=>{const F=k.tenderId===n.tenderId;return t.jsxs("button",{type:"button","aria-pressed":F,disabled:k.disabled||d,onClick:()=>n.onTenderChange?.(k.tenderId),className:c.cn("flex h-11 flex-1 items-center justify-center gap-2 rounded-xl border-[1.5px] bg-white","text-[13px] font-semibold outline-none transition-colors","disabled:cursor-not-allowed disabled:opacity-50","focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary",F?"border-primary bg-primary/5 text-primary":"border-pos-line text-default-600"),"data-testid":`${h}-method-${k.tenderId}`,children:[k.icon&&t.jsx(P,{icon:k.icon,width:15,height:15,"aria-hidden":"true"}),k.label]},k.tenderId)})})]}),!u&&t.jsxs("div",{className:"mt-4 flex items-center gap-3",children:[t.jsx(B,{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:o,"data-testid":`${h}-back`,children:x.back}),t.jsx(B,{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":`${h}-submit`,children:x.submit})]})]})};pl.displayName="SplitTenderPanel";const ex={label:"Supervisor authorization",placeholder:"••••"},gl=({pin:e,onChange:s,hint:a,error:n,labels:r,className:i,"data-testid":l="pin-field"})=>{const o={...ex,...r};return t.jsxs("div",{className:c.cn("mx-auto max-w-[460px] rounded-[20px] border border-pos-line bg-white px-7 py-[26px]","text-center text-default-900 shadow-[0_1px_2px_rgba(0,0,0,0.05)]",i),"data-testid":l,children:[t.jsx("div",{className:"mx-auto mb-4 flex h-[70px] w-[70px] items-center justify-center rounded-full bg-pos-danger-fill text-primary",children:t.jsx(P,{icon:"lucide:lock",width:26,height:26,"aria-hidden":"true"})}),t.jsx("p",{className:"text-[17px] font-semibold",children:o.label}),a&&t.jsx("p",{className:"mt-1.5 text-[13px] text-default-500",children:a}),t.jsx(c.Input,{type:"password",inputMode:"numeric","aria-label":o.label,placeholder:o.placeholder,value:e,onChange:d=>s(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":`${l}-input`})]})};gl.displayName="PinField";const tx={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}"},sx={succeeded:"bg-pos-ok-fill text-pos-ok",pending:"bg-pos-warn-fill text-pos-warn"},ax="inline-flex h-[22px] items-center gap-[5px] whitespace-nowrap rounded-full px-[9px] text-xs font-medium leading-none",Tn="mb-1.5 text-[11px] font-semibold uppercase tracking-[.05em] text-default-500",nx="mx-auto max-w-[1040px] rounded-[20px] border border-pos-line bg-white px-7 py-[26px] shadow-[0_1px_2px_rgba(0,0,0,0.05)]",rx=["email","print"],bl=({state:e,total:s,destinations:a,reason:n,authorizedBy:r,selectedReceipts:i,onSendReceipt:l,onDone:o,frameless:d=!1,labels:u,className:f,"data-testid":m="outcome-view"})=>{const h={...tx,...u},x=s?ge(s.value,void 0,s.currency):null;return e==="processing"?t.jsx("div",{className:c.cn("flex flex-col items-center justify-center text-center text-default-900",f),"aria-live":"polite","data-testid":m,children:t.jsxs("div",{className:"flex flex-col items-center px-5 py-[60px]","data-testid":`${m}-processing`,children:[t.jsx("div",{className:"mb-4 h-[52px] w-[52px] animate-spin rounded-full border-[5px] border-default-100 border-t-primary",role:"presentation"}),t.jsx("p",{className:"text-[17px] font-semibold",children:h.processing}),x&&t.jsx("p",{className:"mt-2 text-[15px] font-semibold tabular-nums","data-testid":`${m}-processing-total`,children:x})]})}):t.jsxs("div",{className:c.cn("flex flex-col text-default-900",!d&&nx,f),"aria-live":"polite","data-testid":m,children:[t.jsxs("div",{className:"pb-0.5 pt-1 text-center",children:[t.jsx("div",{className:"mx-auto mb-3.5 flex h-[78px] w-[78px] items-center justify-center rounded-full bg-pos-ok-fill text-pos-ok",children:t.jsx(P,{icon:"solar:check-circle-bold",width:46,height:46,"aria-hidden":"true"})}),t.jsx("p",{className:"text-[22px] font-semibold","data-testid":`${m}-title`,children:h.title}),x&&t.jsx("p",{className:"my-1 text-[30px] font-semibold tabular-nums","data-testid":`${m}-total`,children:x}),n&&t.jsx("p",{className:"text-[13px] text-default-500","data-testid":`${m}-reason`,children:h.reason.replace("{reason}",n)})]}),t.jsxs("div",{className:"mt-5 text-left",children:[t.jsx("p",{className:Tn,children:h.destinationsTitle}),a.map((g,j)=>t.jsxs("div",{className:"flex items-center justify-between gap-2.5 border-b border-pos-line-2 py-[11px] text-sm last:border-b-0","data-testid":`${m}-destination-${j}-${g.status}`,children:[t.jsx("span",{className:"font-semibold",children:g.label}),t.jsxs("div",{className:"flex items-center gap-2.5",children:[t.jsx("span",{className:"tabular-nums text-default-600",children:ge(g.amount.value,void 0,g.amount.currency)}),t.jsx("span",{className:c.cn(ax,sx[g.status]),children:g.status==="succeeded"?h.succeeded:h.pending})]})]},`${g.label}-${j}`))]}),l&&t.jsxs("div",{className:"mt-5 text-left",children:[t.jsx("p",{className:Tn,children:h.sendReceipt}),t.jsx("div",{className:"flex flex-col gap-2",children:rx.map(g=>{const j=i?.includes(g)??!1;return t.jsxs("button",{type:"button",role:"checkbox","aria-checked":j,onClick:()=>l(g),className:"flex min-h-[44px] w-full items-center gap-2.5 rounded-[10px] p-2 text-left text-sm outline-none transition-colors hover:bg-default-100 focus-visible:outline focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-primary","data-testid":`${m}-receipt-${g}`,children:[t.jsx("span",{"aria-hidden":"true",className:"pointer-events-none flex",children:t.jsx(c.Checkbox,{isSelected:j,isReadOnly:!0,tabIndex:-1})}),t.jsx("span",{children:h[g]})]},g)})})]}),r&&t.jsx("p",{className:"mt-4 text-[12.5px] text-default-500","data-testid":`${m}-authorized-by`,children:h.authorizedBy.replace("{name}",r)}),t.jsx("div",{className:"mt-auto pt-5",children:t.jsx(B,{color:"primary",className:"h-12 w-full rounded-[14px] px-5 text-[15px] font-semibold",onPress:o,"data-testid":`${m}-done`,children:h.done})})]})};bl.displayName="OutcomeView";const Me={base:"relative inline-grid min-w-[10.75rem] grid-cols-[minmax(0,1fr)]",baseActive:"max-w-[20rem]",cell:"[grid-area:1/1]",sizer:"invisible h-0 overflow-hidden whitespace-nowrap border-x-2 border-transparent pl-2 pr-[4.8125rem] text-[0.875rem] font-semibold",select:"w-full",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-[3.25rem]",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]"},yl=({label:e,value:s,options:a,onChange:n,clearLabel:r,minWidth:i,"data-testid":l="filter-select"})=>{const o=s!==null,d=o?a.find(f=>f.value===s)?.label:void 0,u=p.useRef(null);return t.jsxs("div",{ref:u,"data-testid":l,"data-slot":"filter-select","data-active":o?"true":void 0,title:d,className:c.cn(Me.base,o&&Me.baseActive),style:i===void 0?void 0:{minWidth:Ze(i)},children:[t.jsx(He,{"aria-label":e,placeholder:e,size:"sm",variant:"bordered",radius:"md",selectedKeys:s===null?[]:[s],onSelectionChange:f=>{if(f==="all")return;const m=[...f][0];n(m===void 0?null:String(m))},"data-testid":`${l}-trigger`,classNames:{base:c.cn(Me.select,Me.cell),trigger:c.cn(Me.trigger,o&&Me.triggerActive),value:c.cn(Me.value,o&&Me.valueActive),selectorIcon:c.cn(o&&Me.iconActive)},children:a.map(f=>t.jsx(c.SelectItem,{children:f.label},f.value))}),d!==void 0&&t.jsx("span",{"aria-hidden":"true","data-testid":`${l}-sizer`,className:c.cn(Me.sizer,Me.cell),children:d}),o&&t.jsx("button",{type:"button","aria-label":r,onClick:()=>{n(null),u.current?.querySelector('[data-slot="trigger"]')?.focus()},"data-testid":`${l}-clear`,className:Me.clear,children:t.jsx(P,{icon:"lucide:x",className:Me.clearIcon,"aria-hidden":"true"})})]})};yl.displayName="FilterSelect";const st={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"},vl=({status:e,onLoadMore:s,loadingLabel:a,errorLabel:n,retryLabel:r,endLabel:i,"data-testid":l="load-more-footer"})=>{const o=p.useRef(null),d=p.useRef(s),u=p.useRef(!1);return p.useEffect(()=>{d.current=s},[s]),p.useEffect(()=>{if(e!=="idle"){u.current=!1;return}const f=o.current;if(!f||typeof IntersectionObserver>"u")return;const m=new IntersectionObserver(h=>{u.current||!h.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":l,"data-status":"idle",className:st.idle,children:t.jsx("div",{ref:o,"aria-hidden":"true","data-testid":`${l}-sentinel`,className:st.sentinel})}):e==="loading"?t.jsxs("div",{"data-testid":l,"data-status":"loading",role:"status","aria-live":"polite",className:st.base,children:[t.jsx("span",{"aria-hidden":"true",className:st.spinner,children:t.jsx(c.Spinner,{size:"sm",color:"default"})}),t.jsx("span",{"data-testid":`${l}-loading`,children:a})]}):e==="error"?t.jsxs("div",{"data-testid":l,"data-status":"error",className:st.base,children:[t.jsx("span",{role:"alert","data-testid":`${l}-error`,className:st.error,children:n}),t.jsx(B,{size:"sm",color:"default",variant:"bordered",radius:"md",onPress:s,testId:`${l}-retry`,children:r})]}):t.jsx("div",{"data-testid":l,"data-status":"end",className:i?st.base:st.idle,children:i&&t.jsx("span",{"data-testid":`${l}-end`,children:i})})};vl.displayName="LoadMoreFooter";const $e={base:"w-full",list:"m-0 list-none p-0",item:"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 ${Ot}`,headline:"flex items-baseline gap-2.5",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",chips:"mt-[0.5625rem] flex 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"},In=({item:e})=>t.jsxs(t.Fragment,{children:[t.jsxs("span",{className:$e.headline,children:[t.jsx("span",{className:$e.title,children:e.title}),oe(e.amount)&&t.jsx("span",{className:$e.amount,children:e.amount})]}),oe(e.chips)&&t.jsx("span",{className:$e.chips,children:e.chips}),e.rows&&e.rows.length>0&&t.jsx("span",{className:$e.rows,children:e.rows.map((s,a)=>t.jsxs("span",{className:$e.row,children:[t.jsx("span",{className:$e.rowLabel,children:s.label}),t.jsx("span",{className:$e.rowValue,children:s.value})]},a))})]}),jl=({items:e,ariaLabel:s,onSelect:a,loading:n=!1,skeletonCount:r=6,"data-testid":i="card-list"})=>t.jsx("div",{"data-testid":i,className:$e.base,children:n?t.jsx("div",{role:"status","aria-busy":"true","aria-label":s,"data-testid":`${i}-skeleton`,children:t.jsx("div",{"aria-hidden":"true",children:Array.from({length:r},(l,o)=>t.jsxs("div",{"data-testid":`${i}-skeleton-row`,className:$e.skeletonRow,children:[t.jsx("div",{className:Zt,style:{height:Ze(13),width:Ze(130)}}),t.jsx("div",{className:Zt,style:{height:Ze(11),width:"70%",marginTop:Ze(10)}}),t.jsx("div",{className:Zt,style:{height:Ze(11),width:"45%",marginTop:Ze(8)}})]},o))})}):t.jsx("ul",{"aria-label":s,className:$e.list,children:e.map(l=>t.jsx("li",{"data-testid":`${i}-item-${l.id}`,className:$e.item,children:a?t.jsx("button",{type:"button",onClick:()=>a(l.id),className:c.cn($e.card,$e.cardInteractive),children:t.jsx(In,{item:l})}):t.jsx("div",{className:$e.card,children:t.jsx(In,{item:l})})},l.id))})});jl.displayName="CardList";const ix=48,te={base:`mb-4 overflow-hidden rounded-2xl border border-pos-line bg-white ${fs}`,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 ${Ot}`,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"},wl=p.forwardRef((e,s)=>t.jsx("li",{ref:s,...Object.fromEntries(Object.entries(e).filter(([a])=>a!=="data-testid"))}));wl.displayName="CrumbBase";const Nl=({breadcrumb:e=[],onBack:s,backLabel:a,title:n,meta:r,amountLabel:i,amount:l,amountCaption:o,recordId:d,chips:u,statItems:f,stats:m,banner:h,"data-testid":x="record-header"})=>{const{ref:g,width:j}=jt(),b=!It(j,ix),w=e.length>0||!!s,N=!!(f&&f.length>0),D=!!i||oe(l)||oe(o)||oe(d)||oe(u)||N;return t.jsxs("div",{ref:g,"data-testid":x,"data-size":b?"narrow":"wide",className:te.base,children:[w&&t.jsxs("div",{"data-testid":`${x}-band`,className:te.band,children:[s&&t.jsx("button",{type:"button",onClick:s,"aria-label":a,"data-testid":`${x}-back`,className:te.back,children:t.jsx(P,{icon:"lucide:chevron-left",className:te.backIcon,"aria-hidden":"true"})}),t.jsx(c.Breadcrumbs,{separator:"/","data-testid":`${x}-breadcrumb`,classNames:{base:te.breadcrumb,list:te.breadcrumbList},itemClasses:{base:te.crumbBase,item:te.crumb,separator:te.crumbSeparator},children:e.map((v,S)=>t.jsx(c.BreadcrumbItem,{as:wl,"data-testid":`${x}-crumb-${S}`,isDisabled:!v.onClick&&S<e.length-1,onPress:v.onClick?()=>v.onClick?.():void 0,children:v.label},S))})]}),t.jsxs("div",{className:c.cn(te.body,b?te.bodyNarrow:te.bodyWide),children:[t.jsxs("div",{className:te.identity,children:[t.jsx("h1",{"data-testid":`${x}-title`,className:c.cn(te.title,b?te.titleNarrow:te.titleWide),children:n}),r&&r.length>0&&t.jsx("ul",{"data-testid":`${x}-meta`,className:te.meta,children:r.map((v,S)=>t.jsxs("li",{className:te.metaLine,children:[v.icon!=null&&t.jsx("span",{"aria-hidden":"true",className:te.metaIcon,children:v.icon}),t.jsx("span",{className:te.metaText,children:v.text})]},S))})]}),D&&t.jsxs("div",{"data-testid":`${x}-money`,className:c.cn(te.money,b?te.moneyNarrow:te.moneyWide),children:[i&&t.jsx("div",{className:te.amountLabel,children:i}),oe(l)&&t.jsx("div",{"data-testid":`${x}-amount`,className:c.cn(te.amount,b?te.amountNarrow:te.amountWide),children:l}),oe(o)&&t.jsx("div",{className:te.amountCaption,children:o}),oe(d)&&t.jsx("div",{"data-testid":`${x}-record-id`,className:te.recordId,children:d}),oe(u)&&t.jsx("div",{"data-testid":`${x}-chips`,className:c.cn(te.chips,b?te.chipsNarrow:te.chipsWide),children:u}),N&&t.jsx("dl",{"data-testid":`${x}-stat-items`,className:te.statItems,children:f?.map((v,S)=>t.jsxs("div",{"data-testid":`${x}-stat-${S}`,className:c.cn(te.stat,b?te.statNarrow:te.statWide),children:[t.jsx("dt",{"data-testid":`${x}-stat-${S}-label`,className:te.statLabel,children:v.label}),t.jsx("dd",{"data-testid":`${x}-stat-${S}-value`,className:te.statValue,style:v.tone?{color:qe[v.tone].fg}:void 0,children:v.value})]},v.id??S))})]})]}),oe(m)&&t.jsx("div",{"data-testid":`${x}-stats`,className:b?te.statsNarrow:te.statsWide,children:m}),oe(h)&&t.jsx("div",{"data-testid":`${x}-banner`,children:h})]})};Nl.displayName="RecordHeader";const lx=50,$t={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]"},Cl=({children:e,aside:s,"data-testid":a="record-layout"})=>{const{ref:n,width:r}=jt(),i=oe(s),l=i&&r>0&&It(r,lx),o=t.jsx("div",{"data-testid":`${a}-main`,className:$t.column,children:e},"main"),d=i?t.jsx("div",{"data-testid":`${a}-aside`,className:$t.aside,children:s},"aside"):null;return t.jsx("div",{ref:n,"data-testid":a,"data-layout":l?"split":"stacked",className:c.cn($t.base,l?$t.split:$t.stacked),children:l?[o,d]:[d,o]})};Cl.displayName="RecordLayout";const ox=560,At={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"},kl=({items:e,"data-testid":s="stat-tiles"})=>{const{ref:a,width:n}=jt(),r=n>=_m?Math.max(e.length,1):n>=ox?2:1;return t.jsx("div",{ref:a,"data-testid":s,"data-columns":r,className:At.base,style:{gridTemplateColumns:`repeat(${r}, minmax(0, 1fr))`},children:e.map((i,l)=>t.jsxs("div",{"data-testid":`${s}-item-${l}`,className:At.tile,children:[t.jsx("div",{"data-testid":`${s}-item-${l}-value`,className:At.value,style:i.tone?{color:qe[i.tone].fg}:void 0,children:i.value}),t.jsx("div",{"data-testid":`${s}-item-${l}-label`,className:At.label,children:i.label}),oe(i.caption)&&t.jsx("div",{"data-testid":`${s}-item-${l}-caption`,className:At.caption,children:i.caption})]},l))})};kl.displayName="StatTiles";const at={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 px-[0.875rem] py-[0.5625rem] 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:"text-[0.84375rem] leading-[1.5] font-normal text-default-600 group-data-[selected=true]:font-semibold group-data-[selected=true]:text-default-900",title:"inline-flex items-center gap-[0.4375rem] whitespace-nowrap",count:"rounded-full bg-default-200 px-[0.4375rem] py-px text-[0.71875rem] leading-[1.5] font-semibold text-default-600 group-data-[selected=true]:bg-acct-rust-fill group-data-[selected=true]:text-primary-600"},Ma="pill-tabs",_a=(e,s=Ma)=>`${s}-tab-${e}`,Ra=(e,s=Ma)=>`${s}-panel-${e}`,cx=(e,s=Ma)=>({role:"tabpanel",id:Ra(e,s),"aria-labelledby":_a(e,s),tabIndex:0}),Sl=({items:e,value:s,onChange:a,ariaLabel:n,idPrefix:r,"data-testid":i="pill-tabs"})=>{const l=qm(),o=!!c.useProviderContext()?.disableAnimation,d=r??i;return t.jsx(c.Tabs,{"aria-label":n,variant:"solid",radius:"full",fullWidth:!0,disableAnimation:l||void 0,selectedKey:s,onSelectionChange:u=>a(String(u)),"data-testid":i,classNames:{base:at.base,tabList:at.tabList,cursor:at.cursor,tab:c.cn(at.tab,(l||o)&&at.tabStill),tabContent:at.tabContent},children:e.map(u=>t.jsx(c.Tab,{id:_a(u.key,d),"aria-controls":Ra(u.key,d),"data-testid":`${i}-${u.key}`,title:t.jsxs("span",{className:at.title,children:[u.label,u.count!==void 0&&t.jsx("span",{"data-testid":`${i}-${u.key}-count`,className:at.count,children:u.count})]})},u.key))})};Sl.displayName="PillTabs";const xe={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 ${Ot}`,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"},Pn=({row:e,testId:s})=>t.jsxs(t.Fragment,{children:[t.jsx("span",{"aria-hidden":"true",className:xe.dot,style:{backgroundColor:qe[e.tone].fg}}),t.jsxs("span",{className:xe.body,children:[t.jsx("span",{className:xe.title,children:e.title}),(e.reference!=null||e.timestamp!=null)&&t.jsxs("span",{className:xe.meta,children:[e.reference!=null&&t.jsx("span",{className:xe.reference,children:e.reference}),e.reference!=null&&e.timestamp!=null&&t.jsx("span",{"aria-hidden":"true",className:xe.separator,children:"·"}),e.timestamp!=null&&t.jsx("span",{className:xe.timestamp,children:e.timestamp})]}),e.detail!=null&&t.jsx("span",{className:xe.detail,children:e.detail})]}),t.jsx("span",{className:xe.trailing,children:e.amount!=null?t.jsx("span",{"data-testid":`${s}-amount`,className:xe.amount,style:Pt(e.amountTone),children:e.amount}):e.note!=null?t.jsx("span",{"data-testid":`${s}-note`,className:xe.note,style:e.noteTone==="warn"?{color:qe.warn.fg}:void 0,children:e.note}):null})]}),$l=({rows:e,footer:s,emptyContent:a,onSelect:n,"data-testid":r="amount-list"})=>e.length===0?t.jsx("div",{"data-testid":r,className:xe.base,children:a!=null&&t.jsx("div",{"data-testid":`${r}-empty`,className:xe.empty,children:a})}):t.jsxs("div",{"data-testid":r,className:xe.base,children:[t.jsx("ul",{className:xe.list,children:e.map(i=>{const l=`${r}-row-${i.id}`;return t.jsx("li",{"data-testid":l,className:xe.item,children:n?t.jsx("button",{type:"button",onClick:()=>n(i.id),className:c.cn(xe.row,xe.rowInteractive),children:t.jsx(Pn,{row:i,testId:l})}):t.jsx("div",{className:xe.row,children:t.jsx(Pn,{row:i,testId:l})})},i.id)})}),s&&t.jsxs(t.Fragment,{children:[t.jsxs("div",{"data-testid":`${r}-footer`,className:xe.footer,children:[t.jsx("span",{className:xe.footerLabel,children:s.label}),t.jsx("span",{"data-testid":`${r}-footer-amount`,className:xe.footerAmount,style:Pt(s.amountTone),children:s.amount})]}),s.note!=null&&t.jsx("div",{"data-testid":`${r}-footer-note`,className:xe.footerNote,children:s.note})]})]});$l.displayName="AmountList";const _e={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"},Al=({events:e,emptyContent:s,"data-testid":a="activity-timeline"})=>e.length===0?t.jsx("div",{"data-testid":a,children:s!=null&&t.jsx("div",{"data-testid":`${a}-empty`,className:_e.empty,children:s})}):t.jsx("ol",{"data-testid":a,className:_e.list,children:e.map((n,r)=>{const i=r===e.length-1,l=`${a}-event-${n.id}`;return t.jsxs("li",{"data-testid":l,className:c.cn(_e.event,!i&&_e.eventSpaced),children:[t.jsxs("span",{"aria-hidden":"true",className:_e.rail,children:[t.jsx("span",{className:_e.dot,style:{backgroundColor:qe[n.tone].fg}}),!i&&t.jsx("span",{"data-testid":`${l}-connector`,className:_e.connector})]}),t.jsxs("div",{className:_e.body,children:[t.jsxs("div",{className:_e.head,children:[t.jsx("span",{className:_e.title,children:n.title}),t.jsx("span",{className:_e.timestamp,children:n.timestamp})]}),oe(n.detail)&&t.jsx("div",{className:_e.detail,children:n.detail}),oe(n.actor)&&t.jsx("div",{"data-testid":`${l}-actor`,className:_e.actor,children:n.actor})]})]},n.id)})});Al.displayName="ActivityTimeline";const ve={base:`overflow-hidden rounded-2xl border border-pos-line bg-white ${fs}`,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 ${Ot}`,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"},On=({row:e,testId:s})=>t.jsxs(t.Fragment,{children:[t.jsxs("span",{className:ve.rowBody,children:[t.jsxs("span",{className:ve.rowHead,children:[t.jsx("span",{className:e.onSelect?ve.primaryLinked:ve.primaryPlain,children:e.primary}),e.chip]}),!!e.secondary&&t.jsx("span",{className:ve.secondary,children:e.secondary})]}),!!e.amount&&t.jsx("span",{"data-testid":`${s}-amount`,className:ve.amount,style:Pt(e.amountTone),children:e.amount})]}),Dl=({title:e,count:s,rows:a,emptyContent:n,"data-testid":r="related-record-list"})=>{const i=p.useId(),l=!!e;return t.jsxs("section",{"data-testid":r,role:l?"group":void 0,"aria-labelledby":l?i:void 0,className:ve.base,children:[l&&t.jsxs("div",{className:ve.header,children:[t.jsx("h3",{id:i,className:ve.title,children:e}),s!==void 0&&t.jsx("span",{"data-testid":`${r}-count`,className:ve.count,children:s})]}),a.length===0?!!n&&t.jsx("div",{"data-testid":`${r}-empty`,className:c.cn(ve.empty,!l&&ve.emptyHeadless),children:n}):t.jsx("ul",{className:ve.list,children:a.map((o,d)=>{const u=`${r}-row-${o.id}`;return t.jsx("li",{"data-testid":u,className:c.cn(ve.item,d===0&&!l&&ve.itemFirstHeadless),children:o.onSelect?t.jsx("button",{type:"button",onClick:o.onSelect,className:c.cn(ve.row,ve.rowInteractive),children:t.jsx(On,{row:o,testId:u})}):t.jsx("div",{className:ve.row,children:t.jsx(On,{row:o,testId:u})})},o.id)})})]})};Dl.displayName="RelatedRecordList";const El=({title:e,titleAs:s="h2",icon:a,count:n,badge:r,action:i,description:l,footer:o,variant:d="section",body:u="padded",children:f,"data-testid":m="record-card"})=>{const h=p.useId(),x=oe(e);return t.jsxs("section",{"data-testid":m,"data-variant":d,role:x?"group":void 0,"aria-labelledby":x?h:void 0,className:Qe.base,children:[x&&t.jsxs("div",{"data-testid":`${m}-header`,className:Jm[d],children:[oe(a)&&t.jsx("span",{"aria-hidden":"true",className:Qe.icon,children:a}),t.jsx(s,{id:h,className:Qe.title,children:e}),oe(n)&&t.jsx("span",{"data-testid":`${m}-count`,className:Qe.count,children:n}),r,oe(i)&&t.jsx("span",{"data-testid":`${m}-action`,className:Qe.action,children:i})]}),t.jsxs("div",{"data-testid":`${m}-body`,className:ef[d][u],children:[oe(l)&&t.jsx("p",{"data-testid":`${m}-description`,className:Qe.description,children:l}),f,oe(o)&&t.jsx("div",{"data-testid":`${m}-footer`,className:c.cn(Qe.footer,oe(f)?Qe.footerAfterContent:Qe.footerAfterDescription),children:o})]})]})};El.displayName="RecordCard";const dx={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]"},Fl=({layout:e="stack",className:s,children:a,"data-testid":n="card-stack",...r})=>t.jsx("div",{...r,"data-testid":n,"data-layout":e,className:c.cn(dx[e],s),children:a});Fl.displayName="CardStack";const Wt={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]"},ux={regular:"py-[0.5625rem]",compact:"py-2"},Ll=({rows:e,density:s="regular","data-testid":a="key-value-rows"})=>t.jsx("dl",{"data-testid":a,className:Wt.list,children:e.map((n,r)=>t.jsxs("div",{"data-testid":`${a}-row-${n.id??r}`,className:c.cn(Wt.row,ux[s]),children:[t.jsx("dt",{className:Wt.label,children:n.label}),t.jsx("dd",{className:Wt.value,children:n.value})]},n.id??r))});Ll.displayName="KeyValueRows";const Be={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"},Ml=({items:e,ariaLabel:s,originalAmountLabel:a,"data-testid":n="line-item-rows"})=>t.jsx("ul",{"aria-label":s,"data-testid":n,className:Be.list,children:e.map(r=>{const i=`${n}-item-${r.id}`,l=oe(r.originalAmount);return t.jsxs("li",{"data-testid":i,className:Be.row,style:r.tone?{backgroundColor:qe[r.tone].bg}:void 0,children:[t.jsxs("div",{className:Be.body,children:[t.jsx("div",{className:Be.name,children:r.name}),r.details&&r.details.length>0&&t.jsx("div",{"data-testid":`${i}-details`,className:Be.details,children:r.details.map((o,d)=>t.jsxs(p.Fragment,{children:[d>0&&t.jsx("span",{"aria-hidden":"true",className:Be.separator,children:"·"}),t.jsx("span",{className:Be.detail,children:o})]},d))})]}),t.jsxs("div",{className:Be.trailing,children:[t.jsxs("span",{className:Be.amounts,children:[l&&t.jsxs("s",{"data-testid":`${i}-original`,className:Be.original,children:[a&&t.jsxs("span",{className:"sr-only",children:[a," "]}),r.originalAmount]}),t.jsx("span",{"data-testid":`${i}-amount`,className:Be.amount,style:l?{color:qe.ok.fg}:void 0,children:r.amount})]}),r.chip]})]},r.id)})});Ml.displayName="LineItemRows";const mx=37.5,Ne={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"},_l=({rows:e,total:s,memo:a,"data-testid":n="record-totals"})=>{const{ref:r,width:i}=jt(),l=i>0&&!It(i,mx),o=l?Ne.rowNarrow:Ne.rowWide,d=l?Ne.labelNarrow:Ne.labelWide,u=l?Ne.noteNarrow:Ne.noteWide;return t.jsxs("div",{ref:r,"data-testid":n,"data-size":l?"narrow":"wide",className:Ne.base,children:[e.map(f=>{const m=`${n}-row-${f.id}`;return t.jsxs("div",{"data-testid":m,className:c.cn(o,Ne.row),children:[t.jsx("span",{"data-testid":`${m}-label`,className:c.cn(d,Ne.label),children:f.label}),t.jsx("span",{"data-testid":`${m}-note`,className:c.cn(u,Ne.note),children:f.note}),t.jsx("span",{"data-testid":`${m}-value`,className:Ne.value,style:Pt(f.tone),children:f.value})]},f.id)}),t.jsx("div",{className:Ne.totalRule,children:t.jsxs("div",{"data-testid":`${n}-total`,className:c.cn(o,Ne.totalRow),children:[t.jsx("span",{className:c.cn(d,Ne.totalLabel),children:s.label}),t.jsx("span",{"data-testid":`${n}-total-value`,className:Ne.totalValue,children:s.value})]})}),oe(a)&&t.jsx("div",{"data-testid":`${n}-memo`,className:Ne.memo,children:a})]})};_l.displayName="RecordTotals";const ea={base:"whitespace-nowrap text-[0.875rem]",secondary:"text-default-500",chipStack:"inline-flex flex-col items-start gap-[0.3125rem]"},fx={text:"text-default-900",reference:"font-normal text-primary",amount:"font-semibold tabular-nums text-default-900"},Rl=({variant:e="text",tone:s,secondary:a,children:n,"data-testid":r="cell-text"})=>t.jsxs("span",{"data-testid":r,className:c.cn(ea.base,fx[e]),style:Pt(s),children:[n,oe(a)&&t.jsxs("span",{"data-testid":`${r}-secondary`,className:ea.secondary,children:[t.jsx("span",{"aria-hidden":"true",children:" · "}),a]})]});Rl.displayName="CellText";const Tl=({children:e,"data-testid":s="chip-stack"})=>t.jsx("span",{"data-testid":s,className:ea.chipStack,children:e});Tl.displayName="ChipStack";exports.ActivityTimeline=Al;exports.AdminFieldLabel=Fi;exports.AdminTable=wi;exports.AdminTextField=Li;exports.AdminToolbar=Ni;exports.AmountList=$l;exports.AppliedCodeCard=Jn;exports.Button=B;exports.CardList=jl;exports.CardStack=Fl;exports.CashTenderForm=af;exports.CatalogItemCard=ni;exports.CellText=Rl;exports.CheckTenderForm=zi;exports.ChipStack=Tl;exports.CommitmentDetails=ju;exports.ConfirmDialog=Qi;exports.ConfirmationModal=va;exports.ConfirmationPageTemplate=qc;exports.CustomerCard=ml;exports.DatePicker=ua;exports.DimensionChip=ka;exports.DonationAmounts=Dr;exports.EmptyState=ja;exports.ErrorState=wa;exports.EventDetails=$d;exports.EventDetailsTemplate=Yc;exports.ExpireCartTimer=Er;exports.FeedbackState=vt;exports.FilterPopover=ci;exports.FilterSelect=yl;exports.Footer=Qc;exports.HeroUIProvider=ho;exports.HorizontalSteps=Cr;exports.InstallmentFundAssignment=pu;exports.InstallmentFundAssignmentSkeleton=yu;exports.InstallmentSchedule=zu;exports.InstallmentScheduleSkeleton=Gu;exports.InstallmentTable=Xu;exports.ItemCard=ai;exports.KeyValueChip=ka;exports.KeyValueRows=Ll;exports.LineItemList=ll;exports.LineItemRows=Ml;exports.ListPanel=Ii;exports.LoadMoreFooter=vl;exports.LoadingOverlay=Gi;exports.LoadingState=Na;exports.MembershipSelectCards=am;exports.MetaCard=Uf;exports.ModalShell=Ui;exports.ModalShellFooter=qi;exports.ModalShellHeader=Hi;exports.Multiselect=Zc;exports.Navbar=Hc;exports.NotesField=xl;exports.OfferCard=es;exports.OfferCardEmpty=Fr;exports.OfferCardError=Lr;exports.OfferCardList=Tr;exports.OfferCardSkeleton=Mr;exports.OtherTenderForm=Bi;exports.OutcomeView=bl;exports.PageHeader=mi;exports.PaginationSummary=Ti;exports.PaymentCashChangeBanner=Aa;exports.PaymentSubAmountInput=Da;exports.PaymentSuccessView=Ki;exports.PaymentTotalBanner=Yi;exports.PickerRow=_i;exports.PillTabs=Sl;exports.PinField=gl;exports.ProgramListItem=ri;exports.RICH_TEXT_PRESETS=$r;exports.ReasonSelect=fl;exports.RecordCard=El;exports.RecordHeader=Nl;exports.RecordLayout=Cl;exports.RecordTotals=_l;exports.RedeemCodeInput=zc;exports.RelatedRecordList=Dl;exports.RevenueDistributionCard=Gr;exports.RevenueDistributionEmpty=Kr;exports.RevenueDistributionError=Qr;exports.RevenueDistributionSkeleton=Zr;exports.RichTextArea=Ar;exports.RowActions=Mi;exports.SectionPanel=ul;exports.Select=He;exports.SessionTimeline=di;exports.SplitPaymentSummary=Vi;exports.SplitTenderPanel=pl;exports.StatTiles=kl;exports.StatusChip=fi;exports.Stepper=wr;exports.SuccessState=ii;exports.Summary=rl;exports.TableSkeleton=pi;exports.TenderMethods=hl;exports.TicketSelection=Sm;exports.TileSelect=Wi;exports.Toggle=li;exports.ToolbarButton=Ci;exports.UnderlineTabs=ki;exports.WizardShell=il;exports.adminFieldErrorClass=Ei;exports.adminFieldHintClass=Di;exports.adminFieldLabelClass=Sa;exports.adminFieldLabelSuffixClass=$a;exports.adminInputClass=$i;exports.adminInputReadOnlyClass=Ai;exports.adminInputWrapperClass=Si;exports.adminRowClass=yi;exports.adminSurfaceCss=xo;exports.adminSurfaceTokens=sa;exports.adminTableClass=vi;exports.adminTableFooterClass=ji;exports.adminTdClass=bi;exports.adminThClass=gi;exports.calculateAllocationDifference=ru;exports.computeChange=Hs;exports.currencyFractionDigits=Rt;exports.formatMoney=ge;exports.formatOfferCurrency=Ws;exports.formatRevenueAmount=tu;exports.formatRevenueCurrency=su;exports.generateAutomaticInstallments=ei;exports.generateDistributionId=ya;exports.getCurrencySymbol=au;exports.offerCardVariants=Rr;exports.offerListVariants=_r;exports.pageRange=Ri;exports.parseOfferCurrency=Ad;exports.parseRevenueCurrency=nu;exports.pillTabId=_a;exports.pillTabPanelId=Ra;exports.pillTabPanelProps=cx;exports.posSurfaceTokens=je;exports.roundToCurrency=Nr;Object.keys(c).forEach(e=>{e!=="default"&&!Object.prototype.hasOwnProperty.call(exports,e)&&Object.defineProperty(exports,e,{enumerable:!0,get:()=>c[e]})});
|
|
42
42
|
(function(){"use strict";try{if(typeof document<"u"){var r=document.createElement("style");r.appendChild(document.createTextNode('.ProseMirror{flex:1;width:100%;min-height:100%;height:100%;cursor:text;background-color:#fff;padding:1rem;overflow-y:auto;box-sizing:border-box}.ProseMirror p{min-height:1.5em}.dark .ProseMirror{background-color:rgb(var(--nextui-background))}.ProseMirror ul{list-style-type:disc!important;list-style-position:outside!important;padding-left:2rem!important;margin:1rem 0!important;display:block!important}.ProseMirror ol{list-style-type:decimal!important;list-style-position:outside!important;padding-left:2rem!important;margin:1rem 0!important;display:block!important}.ProseMirror ul li,.ProseMirror ol li{display:list-item!important;list-style:inherit!important;margin:.25rem 0!important}.ProseMirror ul li p,.ProseMirror ol li p{margin:0!important;display:inline!important}.ProseMirror ul[data-type=taskList]{list-style:none!important;padding-left:0!important;margin:1rem 0!important}.ProseMirror ul[data-type=taskList] li{display:flex!important;align-items:flex-start!important;margin:.5rem 0!important}.ProseMirror ul[data-type=taskList] li label{margin-right:.5rem;-webkit-user-select:none;-moz-user-select:none;user-select:none}.ProseMirror ul[data-type=taskList] li input[type=checkbox]{cursor:pointer;margin-top:.25rem}.ProseMirror h1,.ProseMirror h2,.ProseMirror h3,.ProseMirror h4,.ProseMirror h5,.ProseMirror h6{line-height:1.2!important;margin:1rem 0 .5rem!important;font-weight:600!important}.ProseMirror h1{font-size:2rem!important}.ProseMirror h2{font-size:1.5rem!important}.ProseMirror h3{font-size:1.25rem!important}.ProseMirror h4{font-size:1.1rem!important}.ProseMirror h5{font-size:1rem!important;font-weight:600!important}.ProseMirror h6{font-size:.9rem!important;font-weight:600!important}.ProseMirror code{background-color:rgb(var(--nextui-default-100));border-radius:.4rem;color:rgb(var(--nextui-default-800));font-size:.85rem;padding:.25em .3em}.ProseMirror pre{background:rgb(var(--nextui-default-900));border-radius:.5rem;color:rgb(var(--nextui-default-50));font-family:JetBrainsMono,monospace;margin:1.5rem 0;padding:.75rem 1rem;overflow-x:auto}.ProseMirror pre code{background:none;color:inherit;font-size:.8rem;padding:0}.ProseMirror mark{background-color:#faf594;border-radius:.4rem;-webkit-box-decoration-break:clone;box-decoration-break:clone;padding:.1rem .3rem}.ProseMirror blockquote{border-left:3px solid rgb(var(--nextui-default-300));margin:1.5rem 0;padding-left:1rem;color:rgb(var(--nextui-default-600))}.ProseMirror hr{border:none;border-top:1px solid rgb(var(--nextui-divider));margin:2rem 0}.ProseMirror a{color:rgb(var(--nextui-primary));text-decoration:underline;cursor:pointer}.ProseMirror a:hover{text-decoration:underline}.ProseMirror strong{font-weight:700!important}.ProseMirror em{font-style:italic!important}.ProseMirror s{text-decoration:line-through!important}.ProseMirror u{text-decoration:underline!important}.ProseMirror .has-text-align-left,.ProseMirror [style*="text-align: left"]{text-align:left!important}.ProseMirror .has-text-align-center,.ProseMirror [style*="text-align: center"]{text-align:center!important}.ProseMirror .has-text-align-right,.ProseMirror [style*="text-align: right"]{text-align:right!important}.ProseMirror .has-text-align-justify,.ProseMirror [style*="text-align: justify"]{text-align:justify!important}.ProseMirror ul li[style*="text-align: left"],.ProseMirror ol li[style*="text-align: left"]{text-align:left!important;list-style-position:inside!important}.ProseMirror ul li[style*="text-align: center"],.ProseMirror ol li[style*="text-align: center"]{text-align:center!important;list-style-position:inside!important}.ProseMirror ul li[style*="text-align: right"],.ProseMirror ol li[style*="text-align: right"]{text-align:right!important;list-style-position:inside!important}.ProseMirror ul li[style*="text-align: justify"],.ProseMirror ol li[style*="text-align: justify"]{text-align:justify!important;list-style-position:inside!important}.ProseMirror ul[data-type=taskList] li[style*="text-align: left"]{justify-content:flex-start!important}.ProseMirror ul[data-type=taskList] li[style*="text-align: center"]{justify-content:center!important}.ProseMirror ul[data-type=taskList] li[style*="text-align: right"]{justify-content:flex-end!important}.ProseMirror p.is-editor-empty:first-child:before{color:rgb(var(--nextui-default-400));content:attr(data-placeholder);float:left;height:0;pointer-events:none}')),document.head.appendChild(r)}}catch(t){console.error("vite-plugin-css-injected-by-js",t)}})();
|