@veevarts/design-system 1.17.0-alpha.6 → 1.17.0-alpha.8
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 +5 -5
- package/dist/index.js +1170 -1151
- package/dist/patterns/index.d.ts +1 -1
- package/dist/patterns/refund-shared/types.d.ts +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react/jsx-runtime"),d=require("@heroui/react"),x=require("react"),K=require("lucide-react"),Ae=require("framer-motion"),hn=require("@tiptap/react"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react/jsx-runtime"),d=require("@heroui/react"),x=require("react"),K=require("lucide-react"),Ae=require("framer-motion"),hn=require("@tiptap/react"),Jn=require("@tiptap/core"),ci=require("@tiptap/extension-bold"),di=require("@tiptap/extension-italic"),ui=require("@tiptap/extension-strike"),fi=require("@tiptap/extension-underline"),mi=require("@tiptap/extension-code"),hi=require("@tiptap/extension-color"),xi=require("@tiptap/extension-highlight"),pi=require("@tiptap/extension-link"),gi=require("@tiptap/extension-text-style"),bi=require("@tiptap/extension-heading"),yi=require("@tiptap/extension-paragraph"),vi=require("@tiptap/extension-bullet-list"),ji=require("@tiptap/extension-ordered-list"),wi=require("@tiptap/extension-task-list"),Ni=require("@tiptap/extension-task-item"),Ci=require("@tiptap/extension-list-item"),Si=require("@tiptap/extension-code-block"),ki=require("@tiptap/extension-blockquote"),Ai=require("@tiptap/extension-horizontal-rule"),$i=require("@tiptap/extension-hard-break"),es=require("@tiptap/extension-history"),Di=require("@tiptap/extension-text-align"),Ei=require("@tiptap/extension-document"),Fi=require("@tiptap/extension-text"),Li=require("@tiptap/extension-dropcursor"),Mi=require("@tiptap/extension-gapcursor"),ge={brand:{primary:{500:"#C14615",DEFAULT:"#C14615"}},semantic:{success:"#057A54",danger:"#B62214",info:"#2563EB"},neutral:{white:"#FFFFFF",gray:{100:"#F3F4F6",200:"#E5E7EB",300:"#D1D5DB",400:"#9CA3AF",500:"#6B7280",700:"#374151",800:"#1F2937",900:"#111827"}},palettes:{warning:{100:"#fef3c7",200:"#fde68a",700:"#b45309"}}},le={xs:"0.25rem",sm:"0.5rem",md:"1rem",lg:"1.5rem",xl:"2rem"},ce={fontFamily:{mono:'"JetBrains Mono", Consolas, monospace'},fontSize:{sm:"0.875rem",base:"1rem",lg:"1.125rem",xl:"1.25rem","2xl":"1.5rem","4xl":"2.25rem"},fontWeight:{semibold:"600",bold:"700"},lineHeight:{tight:"1.25",normal:"1.5"}},{gray:xt}=ge.neutral,Ii=ge.palettes.warning[700],Ti=ge.palettes.warning[100],Re={rustFill:"#FBEBE4",rustBorder:"#EBC3B1",page:"#F6F7F8",border:"#E7E9EC",hair:"#EEF0F2",okFill:"#E6F4EF",dangerFill:"#FBEAE8",infoFill:"#E8EEFC"},xn={"--rust":ge.brand.primary[500],"--rust-fill":Re.rustFill,"--rust-border":Re.rustBorder,"--page":Re.page,"--surface":ge.neutral.white,"--border":Re.border,"--hair":Re.hair,"--ink":xt[900],"--ink2":xt[700],"--sub":xt[500],"--muted":xt[400],"--ok":ge.semantic.success,"--ok-fill":Re.okFill,"--warn":Ii,"--warn-fill":Ti,"--danger":ge.semantic.danger,"--danger-fill":Re.dangerFill,"--info":ge.semantic.info,"--info-fill":Re.infoFill};Object.fromEntries(Object.entries(xn).map(([e,t])=>[e.replace(/^--/,""),t]));function Pi({scope:e=".acct",fontFamily:t="'NeueMontreal', system-ui, sans-serif"}={}){const s=Object.entries(xn).map(([r,i])=>` ${r}: ${i};`).join(`
|
|
2
2
|
`),a=t?`
|
|
3
3
|
font-family: ${t};
|
|
4
4
|
color: var(--ink);`:"";return`${e} {
|
|
5
5
|
${s}${a}
|
|
6
6
|
}
|
|
7
|
-
`}function Ti({children:e}){return n.jsx(d.HeroUIProvider,{children:e})}function Pi(e,t){const s=e.icons,a=e.aliases||Object.create(null),r=Object.create(null);function i(o){if(s[o])return r[o]=[];if(!(o in r)){r[o]=null;const l=a[o]&&a[o].parent,c=l&&i(l);c&&(r[o]=[l].concat(c))}return r[o]}return Object.keys(s).concat(Object.keys(a)).forEach(i),r}const Vs=Object.freeze({left:0,top:0,width:16,height:16}),jt=Object.freeze({rotate:0,vFlip:!1,hFlip:!1}),pn=Object.freeze({...Vs,...jt}),en=Object.freeze({...pn,body:"",hidden:!1});function _i(e,t){const s={};!e.hFlip!=!t.hFlip&&(s.hFlip=!0),!e.vFlip!=!t.vFlip&&(s.vFlip=!0);const a=((e.rotate||0)+(t.rotate||0))%4;return a&&(s.rotate=a),s}function Jn(e,t){const s=_i(e,t);for(const a in en)a in jt?a in e&&!(a in s)&&(s[a]=jt[a]):a in t?s[a]=t[a]:a in e&&(s[a]=e[a]);return s}function Oi(e,t,s){const a=e.icons,r=e.aliases||Object.create(null);let i={};function o(l){i=Jn(a[l]||r[l],i)}return o(t),s.forEach(o),Jn(e,i)}function Us(e,t){const s=[];if(typeof e!="object"||typeof e.icons!="object")return s;e.not_found instanceof Array&&e.not_found.forEach(r=>{t(r,null),s.push(r)});const a=Pi(e);for(const r in a){const i=a[r];i&&(t(r,Oi(e,r,i)),s.push(r))}return s}const Ri={provider:"",aliases:{},not_found:{},...Vs};function Pt(e,t){for(const s in t)if(s in e&&typeof e[s]!=typeof t[s])return!1;return!0}function Hs(e){if(typeof e!="object"||e===null)return null;const t=e;if(typeof t.prefix!="string"||!e.icons||typeof e.icons!="object"||!Pt(e,Ri))return null;const s=t.icons;for(const r in s){const i=s[r];if(!r||typeof i.body!="string"||!Pt(i,en))return null}const a=t.aliases||Object.create(null);for(const r in a){const i=a[r],o=i.parent;if(!r||typeof o!="string"||!s[o]&&!a[o]||!Pt(i,en))return null}return t}const es=Object.create(null);function zi(e,t){return{provider:e,prefix:t,icons:Object.create(null),missing:new Set}}function Xe(e,t){const s=es[e]||(es[e]=Object.create(null));return s[t]||(s[t]=zi(e,t))}function qs(e,t){return Hs(t)?Us(t,(s,a)=>{a?e.icons[s]=a:e.missing.add(s)}):[]}function Bi(e,t,s){try{if(typeof s.body=="string")return e.icons[t]={...s},!0}catch{}return!1}const Ws=/^[a-z0-9]+(-[a-z0-9]+)*$/,$t=(e,t,s,a="")=>{const r=e.split(":");if(e.slice(0,1)==="@"){if(r.length<2||r.length>3)return null;a=r.shift().slice(1)}if(r.length>3||!r.length)return null;if(r.length>1){const l=r.pop(),c=r.pop(),u={provider:r.length>0?r[0]:a,prefix:c,name:l};return t&&!bt(u)?null:u}const i=r[0],o=i.split("-");if(o.length>1){const l={provider:a,prefix:o.shift(),name:o.join("-")};return t&&!bt(l)?null:l}if(s&&a===""){const l={provider:a,prefix:"",name:i};return t&&!bt(l,s)?null:l}return null},bt=(e,t)=>e?!!((t&&e.prefix===""||e.prefix)&&e.name):!1;let ct=!1;function Ys(e){return typeof e=="boolean"&&(ct=e),ct}function ts(e){const t=typeof e=="string"?$t(e,!0,ct):e;if(t){const s=Xe(t.provider,t.prefix),a=t.name;return s.icons[a]||(s.missing.has(a)?null:void 0)}}function Vi(e,t){const s=$t(e,!0,ct);if(!s)return!1;const a=Xe(s.provider,s.prefix);return t?Bi(a,s.name,t):(a.missing.add(s.name),!0)}function Ui(e,t){if(typeof e!="object")return!1;if(typeof t!="string"&&(t=e.provider||""),ct&&!t&&!e.prefix){let r=!1;return Hs(e)&&(e.prefix="",Us(e,(i,o)=>{Vi(i,o)&&(r=!0)})),r}const s=e.prefix;if(!bt({prefix:s,name:"a"}))return!1;const a=Xe(t,s);return!!qs(a,e)}const Ks=Object.freeze({width:null,height:null}),Gs=Object.freeze({...Ks,...jt}),Hi=/(-?[0-9.]*[0-9]+[0-9.]*)/g,qi=/^-?[0-9.]*[0-9]+[0-9.]*$/g;function ns(e,t,s){if(t===1)return e;if(s=s||100,typeof e=="number")return Math.ceil(e*t*s)/s;if(typeof e!="string")return e;const a=e.split(Hi);if(a===null||!a.length)return e;const r=[];let i=a.shift(),o=qi.test(i);for(;;){if(o){const l=parseFloat(i);isNaN(l)?r.push(i):r.push(Math.ceil(l*t*s)/s)}else r.push(i);if(i=a.shift(),i===void 0)return r.join("");o=!o}}function Wi(e,t="defs"){let s="";const a=e.indexOf("<"+t);for(;a>=0;){const r=e.indexOf(">",a),i=e.indexOf("</"+t);if(r===-1||i===-1)break;const o=e.indexOf(">",i);if(o===-1)break;s+=e.slice(r+1,i).trim(),e=e.slice(0,a).trim()+e.slice(o+1)}return{defs:s,content:e}}function Yi(e,t){return e?"<defs>"+e+"</defs>"+t:t}function Ki(e,t,s){const a=Wi(e);return Yi(a.defs,t+a.content+s)}const Gi=e=>e==="unset"||e==="undefined"||e==="none";function Qi(e,t){const s={...pn,...e},a={...Gs,...t},r={left:s.left,top:s.top,width:s.width,height:s.height};let i=s.body;[s,a].forEach(j=>{const b=[],w=j.hFlip,y=j.vFlip;let k=j.rotate;w?y?k+=2:(b.push("translate("+(r.width+r.left).toString()+" "+(0-r.top).toString()+")"),b.push("scale(-1 1)"),r.top=r.left=0):y&&(b.push("translate("+(0-r.left).toString()+" "+(r.height+r.top).toString()+")"),b.push("scale(1 -1)"),r.top=r.left=0);let N;switch(k<0&&(k-=Math.floor(k/4)*4),k=k%4,k){case 1:N=r.height/2+r.top,b.unshift("rotate(90 "+N.toString()+" "+N.toString()+")");break;case 2:b.unshift("rotate(180 "+(r.width/2+r.left).toString()+" "+(r.height/2+r.top).toString()+")");break;case 3:N=r.width/2+r.left,b.unshift("rotate(-90 "+N.toString()+" "+N.toString()+")");break}k%2===1&&(r.left!==r.top&&(N=r.left,r.left=r.top,r.top=N),r.width!==r.height&&(N=r.width,r.width=r.height,r.height=N)),b.length&&(i=Ki(i,'<g transform="'+b.join(" ")+'">',"</g>"))});const o=a.width,l=a.height,c=r.width,u=r.height;let f,h;o===null?(h=l===null?"1em":l==="auto"?u:l,f=ns(h,c/u)):(f=o==="auto"?c:o,h=l===null?ns(f,u/c):l==="auto"?u:l);const g={},m=(j,b)=>{Gi(b)||(g[j]=b.toString())};m("width",f),m("height",h);const v=[r.left,r.top,c,u];return g.viewBox=v.join(" "),{attributes:g,viewBox:v,body:i}}const Zi=/\sid="(\S+)"/g,Xi="IconifyId"+Date.now().toString(16)+(Math.random()*16777216|0).toString(16);let Ji=0;function el(e,t=Xi){const s=[];let a;for(;a=Zi.exec(e);)s.push(a[1]);if(!s.length)return e;const r="suffix"+(Math.random()*16777216|Date.now()).toString(16);return s.forEach(i=>{const o=typeof t=="function"?t(i):t+(Ji++).toString(),l=i.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");e=e.replace(new RegExp('([#;"])('+l+')([")]|\\.[a-z])',"g"),"$1"+o+r+"$3")}),e=e.replace(new RegExp(r,"g"),""),e}const tn=Object.create(null);function tl(e,t){tn[e]=t}function nn(e){return tn[e]||tn[""]}function gn(e){let t;if(typeof e.resources=="string")t=[e.resources];else if(t=e.resources,!(t instanceof Array)||!t.length)return null;return{resources:t,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 bn=Object.create(null),tt=["https://api.simplesvg.com","https://api.unisvg.com"],yt=[];for(;tt.length>0;)tt.length===1||Math.random()>.5?yt.push(tt.shift()):yt.push(tt.pop());bn[""]=gn({resources:["https://api.iconify.design"].concat(yt)});function nl(e,t){const s=gn(t);return s===null?!1:(bn[e]=s,!0)}function yn(e){return bn[e]}const sl=()=>{let e;try{if(e=fetch,typeof e=="function")return e}catch{}};let ss=sl();function al(e,t){const s=yn(e);if(!s)return 0;let a;if(!s.maxURL)a=0;else{let r=0;s.resources.forEach(o=>{r=Math.max(r,o.length)});const i=t+".json?icons=";a=s.maxURL-r-s.path.length-i.length}return a}function rl(e){return e===404}const il=(e,t,s)=>{const a=[],r=al(e,t),i="icons";let o={type:i,provider:e,prefix:t,icons:[]},l=0;return s.forEach((c,u)=>{l+=c.length+1,l>=r&&u>0&&(a.push(o),o={type:i,provider:e,prefix:t,icons:[]},l=c.length),o.icons.push(c)}),a.push(o),a};function ll(e){if(typeof e=="string"){const t=yn(e);if(t)return t.path}return"/"}const ol=(e,t,s)=>{if(!ss){s("abort",424);return}let a=ll(t.provider);switch(t.type){case"icons":{const i=t.prefix,l=t.icons.join(","),c=new URLSearchParams({icons:l});a+=i+".json?"+c.toString();break}case"custom":{const i=t.uri;a+=i.slice(0,1)==="/"?i.slice(1):i;break}default:s("abort",400);return}let r=503;ss(e+a).then(i=>{const o=i.status;if(o!==200){setTimeout(()=>{s(rl(o)?"abort":"next",o)});return}return r=501,i.json()}).then(i=>{if(typeof i!="object"||i===null){setTimeout(()=>{i===404?s("abort",i):s("next",r)});return}setTimeout(()=>{s("success",i)})}).catch(()=>{s("next",r)})},cl={prepare:il,send:ol};function Qs(e,t){e.forEach(s=>{const a=s.loaderCallbacks;a&&(s.loaderCallbacks=a.filter(r=>r.id!==t))})}function dl(e){e.pendingCallbacksFlag||(e.pendingCallbacksFlag=!0,setTimeout(()=>{e.pendingCallbacksFlag=!1;const t=e.loaderCallbacks?e.loaderCallbacks.slice(0):[];if(!t.length)return;let s=!1;const a=e.provider,r=e.prefix;t.forEach(i=>{const o=i.icons,l=o.pending.length;o.pending=o.pending.filter(c=>{if(c.prefix!==r)return!0;const u=c.name;if(e.icons[u])o.loaded.push({provider:a,prefix:r,name:u});else if(e.missing.has(u))o.missing.push({provider:a,prefix:r,name:u});else return s=!0,!0;return!1}),o.pending.length!==l&&(s||Qs([e],i.id),i.callback(o.loaded.slice(0),o.missing.slice(0),o.pending.slice(0),i.abort))})}))}let ul=0;function fl(e,t,s){const a=ul++,r=Qs.bind(null,s,a);if(!t.pending.length)return r;const i={id:a,icons:t,callback:e,abort:r};return s.forEach(o=>{(o.loaderCallbacks||(o.loaderCallbacks=[])).push(i)}),r}function ml(e){const t={loaded:[],missing:[],pending:[]},s=Object.create(null);e.sort((r,i)=>r.provider!==i.provider?r.provider.localeCompare(i.provider):r.prefix!==i.prefix?r.prefix.localeCompare(i.prefix):r.name.localeCompare(i.name));let a={provider:"",prefix:"",name:""};return e.forEach(r=>{if(a.name===r.name&&a.prefix===r.prefix&&a.provider===r.provider)return;a=r;const i=r.provider,o=r.prefix,l=r.name,c=s[i]||(s[i]=Object.create(null)),u=c[o]||(c[o]=Xe(i,o));let f;l in u.icons?f=t.loaded:o===""||u.missing.has(l)?f=t.missing:f=t.pending;const h={provider:i,prefix:o,name:l};f.push(h)}),t}function hl(e,t=!0,s=!1){const a=[];return e.forEach(r=>{const i=typeof r=="string"?$t(r,t,s):r;i&&a.push(i)}),a}const xl={resources:[],index:0,timeout:2e3,rotate:750,random:!1,dataAfterTimeout:!1};function pl(e,t,s,a){const r=e.resources.length,i=e.random?Math.floor(Math.random()*r):e.index;let o;if(e.random){let E=e.resources.slice(0);for(o=[];E.length>1;){const L=Math.floor(Math.random()*E.length);o.push(E[L]),E=E.slice(0,L).concat(E.slice(L+1))}o=o.concat(E)}else o=e.resources.slice(i).concat(e.resources.slice(0,i));const l=Date.now();let c="pending",u=0,f,h=null,g=[],m=[];typeof a=="function"&&m.push(a);function v(){h&&(clearTimeout(h),h=null)}function j(){c==="pending"&&(c="aborted"),v(),g.forEach(E=>{E.status==="pending"&&(E.status="aborted")}),g=[]}function b(E,L){L&&(m=[]),typeof E=="function"&&m.push(E)}function w(){return{startTime:l,payload:t,status:c,queriesSent:u,queriesPending:g.length,subscribe:b,abort:j}}function y(){c="failed",m.forEach(E=>{E(void 0,f)})}function k(){g.forEach(E=>{E.status==="pending"&&(E.status="aborted")}),g=[]}function N(E,L,M){const $=L!=="success";switch(g=g.filter(O=>O!==E),c){case"pending":break;case"failed":if($||!e.dataAfterTimeout)return;break;default:return}if(L==="abort"){f=M,y();return}if($){f=M,g.length||(o.length?S():y());return}if(v(),k(),!e.random){const O=e.resources.indexOf(E.resource);O!==-1&&O!==e.index&&(e.index=O)}c="completed",m.forEach(O=>{O(M)})}function S(){if(c!=="pending")return;v();const E=o.shift();if(E===void 0){if(g.length){h=setTimeout(()=>{v(),c==="pending"&&(k(),y())},e.timeout);return}y();return}const L={status:"pending",resource:E,callback:(M,$)=>{N(L,M,$)}};g.push(L),u++,h=setTimeout(S,e.rotate),s(E,t,L.callback)}return setTimeout(S),w}function Zs(e){const t={...xl,...e};let s=[];function a(){s=s.filter(l=>l().status==="pending")}function r(l,c,u){const f=pl(t,l,c,(h,g)=>{a(),u&&u(h,g)});return s.push(f),f}function i(l){return s.find(c=>l(c))||null}return{query:r,find:i,setIndex:l=>{t.index=l},getIndex:()=>t.index,cleanup:a}}function as(){}const _t=Object.create(null);function gl(e){if(!_t[e]){const t=yn(e);if(!t)return;const s=Zs(t),a={config:t,redundancy:s};_t[e]=a}return _t[e]}function bl(e,t,s){let a,r;if(typeof e=="string"){const i=nn(e);if(!i)return s(void 0,424),as;r=i.send;const o=gl(e);o&&(a=o.redundancy)}else{const i=gn(e);if(i){a=Zs(i);const o=e.resources?e.resources[0]:"",l=nn(o);l&&(r=l.send)}}return!a||!r?(s(void 0,424),as):a.query(t,r,s)().abort}function rs(){}function yl(e){e.iconsLoaderFlag||(e.iconsLoaderFlag=!0,setTimeout(()=>{e.iconsLoaderFlag=!1,dl(e)}))}function vl(e){const t=[],s=[];return e.forEach(a=>{(a.match(Ws)?t:s).push(a)}),{valid:t,invalid:s}}function nt(e,t,s){function a(){const r=e.pendingIcons;t.forEach(i=>{r&&r.delete(i),e.icons[i]||e.missing.add(i)})}if(s&&typeof s=="object")try{if(!qs(e,s).length){a();return}}catch(r){console.error(r)}a(),yl(e)}function is(e,t){e instanceof Promise?e.then(s=>{t(s)}).catch(()=>{t(null)}):t(e)}function jl(e,t){e.iconsToLoad?e.iconsToLoad=e.iconsToLoad.concat(t).sort():e.iconsToLoad=t,e.iconsQueueFlag||(e.iconsQueueFlag=!0,setTimeout(()=>{e.iconsQueueFlag=!1;const{provider:s,prefix:a}=e,r=e.iconsToLoad;if(delete e.iconsToLoad,!r||!r.length)return;const i=e.loadIcon;if(e.loadIcons&&(r.length>1||!i)){is(e.loadIcons(r,a,s),f=>{nt(e,r,f)});return}if(i){r.forEach(f=>{const h=i(f,a,s);is(h,g=>{const m=g?{prefix:a,icons:{[f]:g}}:null;nt(e,[f],m)})});return}const{valid:o,invalid:l}=vl(r);if(l.length&&nt(e,l,null),!o.length)return;const c=a.match(Ws)?nn(s):null;if(!c){nt(e,o,null);return}c.prepare(s,a,o).forEach(f=>{bl(s,f,h=>{nt(e,f.icons,h)})})}))}const wl=(e,t)=>{const s=hl(e,!0,Ys()),a=ml(s);if(!a.pending.length){let c=!0;return t&&setTimeout(()=>{c&&t(a.loaded,a.missing,a.pending,rs)}),()=>{c=!1}}const r=Object.create(null),i=[];let o,l;return a.pending.forEach(c=>{const{provider:u,prefix:f}=c;if(f===l&&u===o)return;o=u,l=f,i.push(Xe(u,f));const h=r[u]||(r[u]=Object.create(null));h[f]||(h[f]=[])}),a.pending.forEach(c=>{const{provider:u,prefix:f,name:h}=c,g=Xe(u,f),m=g.pendingIcons||(g.pendingIcons=new Set);m.has(h)||(m.add(h),r[u][f].push(h))}),i.forEach(c=>{const u=r[c.provider][c.prefix];u.length&&jl(c,u)}),t?fl(t,a,i):rs};function Nl(e,t){const s={...e};for(const a in t){const r=t[a],i=typeof r;a in Ks?(r===null||r&&(i==="string"||i==="number"))&&(s[a]=r):i===typeof s[a]&&(s[a]=a==="rotate"?r%4:r)}return s}const Cl=/[\s,]+/;function Sl(e,t){t.split(Cl).forEach(s=>{switch(s.trim()){case"horizontal":e.hFlip=!0;break;case"vertical":e.vFlip=!0;break}})}function kl(e,t=0){const s=e.replace(/^-?[0-9.]*/,"");function a(r){for(;r<0;)r+=4;return r%4}if(s===""){const r=parseInt(e);return isNaN(r)?0:a(r)}else if(s!==e){let r=0;switch(s){case"%":r=25;break;case"deg":r=90}if(r){let i=parseFloat(e.slice(0,e.length-s.length));return isNaN(i)?0:(i=i/r,i%1===0?a(i):0)}}return t}function Al(e,t){let s=e.indexOf("xlink:")===-1?"":' xmlns:xlink="http://www.w3.org/1999/xlink"';for(const a in t)s+=" "+a+'="'+t[a]+'"';return'<svg xmlns="http://www.w3.org/2000/svg"'+s+">"+e+"</svg>"}function $l(e){return e.replace(/"/g,"'").replace(/%/g,"%25").replace(/#/g,"%23").replace(/</g,"%3C").replace(/>/g,"%3E").replace(/\s+/g," ")}function Dl(e){return"data:image/svg+xml,"+$l(e)}function El(e){return'url("'+Dl(e)+'")'}let it;function Fl(){try{it=window.trustedTypes.createPolicy("iconify",{createHTML:e=>e})}catch{it=null}}function Ll(e){return it===void 0&&Fl(),it?it.createHTML(e):e}const Xs={...Gs,inline:!1},Ml={xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink","aria-hidden":!0,role:"img"},Il={display:"inline-block"},sn={backgroundColor:"currentColor"},Js={backgroundColor:"transparent"},ls={Image:"var(--svg)",Repeat:"no-repeat",Size:"100% 100%"},os={WebkitMask:sn,mask:sn,background:Js};for(const e in os){const t=os[e];for(const s in ls)t[e+s]=ls[s]}const Tl={...Xs,inline:!0};function cs(e){return e+(e.match(/^[-0-9.]+$/)?"px":"")}const Pl=(e,t,s)=>{const a=t.inline?Tl:Xs,r=Nl(a,t),i=t.mode||"svg",o={},l=t.style||{},c={...i==="svg"?Ml:{}};if(s){const b=$t(s,!1,!0);if(b){const w=["iconify"],y=["provider","prefix"];for(const k of y)b[k]&&w.push("iconify--"+b[k]);c.className=w.join(" ")}}for(let b in t){const w=t[b];if(w!==void 0)switch(b){case"icon":case"style":case"children":case"onLoad":case"mode":case"ssr":case"fallback":break;case"_ref":c.ref=w;break;case"className":c[b]=(c[b]?c[b]+" ":"")+w;break;case"inline":case"hFlip":case"vFlip":r[b]=w===!0||w==="true"||w===1;break;case"flip":typeof w=="string"&&Sl(r,w);break;case"color":o.color=w;break;case"rotate":typeof w=="string"?r[b]=kl(w):typeof w=="number"&&(r[b]=w);break;case"ariaHidden":case"aria-hidden":w!==!0&&w!=="true"&&delete c["aria-hidden"];break;default:a[b]===void 0&&(c[b]=w)}}const u=Qi(e,r),f=u.attributes;if(r.inline&&(o.verticalAlign="-0.125em"),i==="svg"){c.style={...o,...l},Object.assign(c,f);let b=0,w=t.id;return typeof w=="string"&&(w=w.replace(/-/g,"_")),c.dangerouslySetInnerHTML={__html:Ll(el(u.body,w?()=>w+"ID"+b++:"iconifyReact"))},x.createElement("svg",c)}const{body:h,width:g,height:m}=e,v=i==="mask"||(i==="bg"?!1:h.indexOf("currentColor")!==-1),j=Al(h,{...f,width:g+"",height:m+""});return c.style={...o,"--svg":El(j),width:cs(f.width),height:cs(f.height),...Il,...v?sn:Js,...l},x.createElement("span",c)};Ys(!0);tl("",cl);if(typeof document<"u"&&typeof window<"u"){const e=window;if(e.IconifyPreload!==void 0){const t=e.IconifyPreload,s="Invalid IconifyPreload syntax.";typeof t=="object"&&t!==null&&(t instanceof Array?t:[t]).forEach(a=>{try{(typeof a!="object"||a===null||a instanceof Array||typeof a.icons!="object"||typeof a.prefix!="string"||!Ui(a))&&console.error(s)}catch{console.error(s)}})}if(e.IconifyProviders!==void 0){const t=e.IconifyProviders;if(typeof t=="object"&&t!==null)for(let s in t){const a="IconifyProviders["+s+"] is invalid.";try{const r=t[s];if(typeof r!="object"||!r||r.resources===void 0)continue;nl(s,r)||console.error(a)}catch{console.error(a)}}}}function ea(e){const[t,s]=x.useState(!!e.ssr),[a,r]=x.useState({});function i(m){if(m){const v=e.icon;if(typeof v=="object")return{name:"",data:v};const j=ts(v);if(j)return{name:v,data:j}}return{name:""}}const[o,l]=x.useState(i(!!e.ssr));function c(){const m=a.callback;m&&(m(),r({}))}function u(m){if(JSON.stringify(o)!==JSON.stringify(m))return c(),l(m),!0}function f(){var m;const v=e.icon;if(typeof v=="object"){u({name:"",data:v});return}const j=ts(v);if(u({name:v,data:j}))if(j===void 0){const b=wl([v],f);r({callback:b})}else j&&((m=e.onLoad)===null||m===void 0||m.call(e,v))}x.useEffect(()=>(s(!0),c),[]),x.useEffect(()=>{t&&f()},[e.icon,t]);const{name:h,data:g}=o;return g?Pl({...pn,...g},e,h):e.children?e.children:e.fallback?e.fallback:x.createElement("span",{})}const V=x.forwardRef((e,t)=>ea({...e,_ref:t}));x.forwardRef((e,t)=>ea({inline:!0,...e,_ref:t}));const R=x.forwardRef(({color:e="primary",radius:t="full",testId:s="veevart-button",...a},r)=>n.jsx(d.Button,{ref:r,color:e,radius:t,"data-testid":s,...a}));R.displayName="Button";function ta({code:e,amount:t,onRemove:s,label:a="Gift Card",removeAriaLabel:r="Remove gift card",testId:i="veevart-applied-code-card"}){return n.jsx(d.Card,{"data-testid":i,shadow:"sm",className:"w-full",children:n.jsxs(d.CardBody,{className:"flex flex-row items-start justify-between gap-2 p-4",children:[n.jsxs("div",{className:"flex min-w-0 flex-col gap-1",children:[n.jsx("span",{className:"text-xs text-default-500",children:a}),n.jsx("span",{"data-testid":`${i}-code`,className:"truncate font-medium text-foreground",children:e}),n.jsx("span",{"data-testid":`${i}-amount`,className:"text-lg font-semibold text-primary",children:t})]}),n.jsx(R,{testId:`${i}-remove`,isIconOnly:!0,size:"sm",variant:"light","aria-label":r,onPress:s,children:n.jsx(V,{icon:"solar:close-circle-linear",className:"size-4","aria-hidden":"true"})})]})})}function Ot(e,t){return e-t*Math.floor(e/t)}const na=1721426;function pt(e,t,s,a){t=vn(e,t);let r=t-1,i=-2;return s<=2?i=0:vt(t)&&(i=-1),na-1+365*r+Math.floor(r/4)-Math.floor(r/100)+Math.floor(r/400)+Math.floor((367*s-362)/12+i+a)}function vt(e){return e%4===0&&(e%100!==0||e%400===0)}function vn(e,t){return e==="BC"?1-t:t}function _l(e){let t="AD";return e<=0&&(t="BC",e=1-e),[t,e]}const Ol={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 Dt{fromJulianDay(t){let s=t,a=s-na,r=Math.floor(a/146097),i=Ot(a,146097),o=Math.floor(i/36524),l=Ot(i,36524),c=Math.floor(l/1461),u=Ot(l,1461),f=Math.floor(u/365),h=r*400+o*100+c*4+f+(o!==4&&f!==4?1:0),[g,m]=_l(h),v=s-pt(g,m,1,1),j=2;s<pt(g,m,3,1)?j=0:vt(m)&&(j=1);let b=Math.floor(((v+j)*12+373)/367),w=s-pt(g,m,b,1)+1;return new dt(g,m,b,w)}toJulianDay(t){return pt(t.era,t.year,t.month,t.day)}getDaysInMonth(t){return Ol[vt(t.year)?"leapyear":"standard"][t.month-1]}getMonthsInYear(t){return 12}getDaysInYear(t){return vt(t.year)?366:365}getMaximumMonthsInYear(){return 12}getMaximumDaysInMonth(){return 31}getYearsInEra(t){return 9999}getEras(){return["BC","AD"]}isInverseEra(t){return t.era==="BC"}balanceDate(t){t.year<=0&&(t.era=t.era==="BC"?"AD":"BC",t.year=1-t.year)}constructor(){this.identifier="gregory"}}function Rl(e,t){var s,a,r,i;return(i=(r=(s=e.isEqual)===null||s===void 0?void 0:s.call(e,t))!==null&&r!==void 0?r:(a=t.isEqual)===null||a===void 0?void 0:a.call(t,e))!==null&&i!==void 0?i:e.identifier===t.identifier}function sa(e,t){return e.calendar.toJulianDay(e)-t.calendar.toJulianDay(t)}function aa(e,t){return ds(e)-ds(t)}function ds(e){return e.hour*36e5+e.minute*6e4+e.second*1e3+e.millisecond}let Rt=null;function ra(){return Rt==null&&(Rt=new Intl.DateTimeFormat().resolvedOptions().timeZone),Rt}function us(e){e=jn(e,new Dt);let t=vn(e.era,e.year);return ia(t,e.month,e.day,e.hour,e.minute,e.second,e.millisecond)}function ia(e,t,s,a,r,i,o){let l=new Date;return l.setUTCHours(a,r,i,o),l.setUTCFullYear(e,t-1,s),l.getTime()}function fs(e,t){if(t==="UTC")return 0;if(e>0&&t===ra())return new Date(e).getTimezoneOffset()*-6e4;let{year:s,month:a,day:r,hour:i,minute:o,second:l}=la(e,t);return ia(s,a,r,i,o,l,0)-Math.floor(e/1e3)*1e3}const ms=new Map;function la(e,t){let s=ms.get(t);s||(s=new Intl.DateTimeFormat("en-US",{timeZone:t,hour12:!1,era:"short",year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric"}),ms.set(t,s));let a=s.formatToParts(new Date(e)),r={};for(let i of a)i.type!=="literal"&&(r[i.type]=i.value);return{year:r.era==="BC"||r.era==="B"?-r.year+1:+r.year,month:+r.month,day:+r.day,hour:r.hour==="24"?0:+r.hour,minute:+r.minute,second:+r.second}}const hs=864e5;function zl(e,t,s,a){return(s===a?[s]:[s,a]).filter(i=>Bl(e,t,i))}function Bl(e,t,s){let a=la(s,t);return e.year===a.year&&e.month===a.month&&e.day===a.day&&e.hour===a.hour&&e.minute===a.minute&&e.second===a.second}function Vl(e,t,s="compatible"){let a=ca(e);if(t==="UTC")return us(a);if(t===ra()&&s==="compatible"){a=jn(a,new Dt);let c=new Date,u=vn(a.era,a.year);return c.setFullYear(u,a.month-1,a.day),c.setHours(a.hour,a.minute,a.second,a.millisecond),c.getTime()}let r=us(a),i=fs(r-hs,t),o=fs(r+hs,t),l=zl(a,t,r-i,r-o);if(l.length===1)return l[0];if(l.length>1)switch(s){case"compatible":case"earlier":return l[0];case"later":return l[l.length-1];case"reject":throw new RangeError("Multiple possible absolute times found")}switch(s){case"earlier":return Math.min(r-i,r-o);case"compatible":case"later":return Math.max(r-i,r-o);case"reject":throw new RangeError("No such absolute time found")}}function oa(e,t,s="compatible"){return new Date(Vl(e,t,s))}function ca(e,t){let s=0,a=0,r=0,i=0;if("timeZone"in e)({hour:s,minute:a,second:r,millisecond:i}=e);else if("hour"in e&&!t)return e;return t&&({hour:s,minute:a,second:r,millisecond:i}=t),new wt(e.calendar,e.era,e.year,e.month,e.day,s,a,r,i)}function jn(e,t){if(Rl(e.calendar,t))return e;let s=t.fromJulianDay(e.calendar.toJulianDay(e)),a=e.copy();return a.calendar=t,a.era=s.era,a.year=s.year,a.month=s.month,a.day=s.day,Je(a),a}function wn(e,t){let s=e.copy(),a="hour"in s?pa(s,t):0;an(s,t.years||0),s.calendar.balanceYearMonth&&s.calendar.balanceYearMonth(s,e),s.month+=t.months||0,rn(s),da(s),s.day+=(t.weeks||0)*7,s.day+=t.days||0,s.day+=a,Ul(s),s.calendar.balanceDate&&s.calendar.balanceDate(s),s.year<1&&(s.year=1,s.month=1,s.day=1);let r=s.calendar.getYearsInEra(s);if(s.year>r){var i,o;let c=(i=(o=s.calendar).isInverseEra)===null||i===void 0?void 0:i.call(o,s);s.year=r,s.month=c?1:s.calendar.getMonthsInYear(s),s.day=c?1:s.calendar.getDaysInMonth(s)}s.month<1&&(s.month=1,s.day=1);let l=s.calendar.getMonthsInYear(s);return s.month>l&&(s.month=l,s.day=s.calendar.getDaysInMonth(s)),s.day=Math.max(1,Math.min(s.calendar.getDaysInMonth(s),s.day)),s}function an(e,t){var s,a;!((s=(a=e.calendar).isInverseEra)===null||s===void 0)&&s.call(a,e)&&(t=-t),e.year+=t}function rn(e){for(;e.month<1;)an(e,-1),e.month+=e.calendar.getMonthsInYear(e);let t=0;for(;e.month>(t=e.calendar.getMonthsInYear(e));)e.month-=t,an(e,1)}function Ul(e){for(;e.day<1;)e.month--,rn(e),e.day+=e.calendar.getDaysInMonth(e);for(;e.day>e.calendar.getDaysInMonth(e);)e.day-=e.calendar.getDaysInMonth(e),e.month++,rn(e)}function da(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 Je(e){e.calendar.constrainDate&&e.calendar.constrainDate(e),e.year=Math.max(1,Math.min(e.calendar.getYearsInEra(e),e.year)),da(e)}function ua(e){let t={};for(let s in e)typeof e[s]=="number"&&(t[s]=-e[s]);return t}function fa(e,t){return wn(e,ua(t))}function ma(e,t){let s=e.copy();return t.era!=null&&(s.era=t.era),t.year!=null&&(s.year=t.year),t.month!=null&&(s.month=t.month),t.day!=null&&(s.day=t.day),Je(s),s}function ha(e,t){let s=e.copy();return t.hour!=null&&(s.hour=t.hour),t.minute!=null&&(s.minute=t.minute),t.second!=null&&(s.second=t.second),t.millisecond!=null&&(s.millisecond=t.millisecond),xa(s),s}function Hl(e){e.second+=Math.floor(e.millisecond/1e3),e.millisecond=gt(e.millisecond,1e3),e.minute+=Math.floor(e.second/60),e.second=gt(e.second,60),e.hour+=Math.floor(e.minute/60),e.minute=gt(e.minute,60);let t=Math.floor(e.hour/24);return e.hour=gt(e.hour,24),t}function xa(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 gt(e,t){let s=e%t;return s<0&&(s+=t),s}function pa(e,t){return e.hour+=t.hours||0,e.minute+=t.minutes||0,e.second+=t.seconds||0,e.millisecond+=t.milliseconds||0,Hl(e)}function ga(e,t){let s=e.copy();return pa(s,t),s}function ql(e,t){return ga(e,ua(t))}function ba(e,t,s,a){let r=e.copy();switch(t){case"era":{let l=e.calendar.getEras(),c=l.indexOf(e.era);if(c<0)throw new Error("Invalid era: "+e.era);c=ze(c,s,0,l.length-1,a?.round),r.era=l[c],Je(r);break}case"year":var i,o;!((i=(o=r.calendar).isInverseEra)===null||i===void 0)&&i.call(o,r)&&(s=-s),r.year=ze(e.year,s,-1/0,9999,a?.round),r.year===-1/0&&(r.year=1),r.calendar.balanceYearMonth&&r.calendar.balanceYearMonth(r,e);break;case"month":r.month=ze(e.month,s,1,e.calendar.getMonthsInYear(e),a?.round);break;case"day":r.day=ze(e.day,s,1,e.calendar.getDaysInMonth(e),a?.round);break;default:throw new Error("Unsupported field "+t)}return e.calendar.balanceDate&&e.calendar.balanceDate(r),Je(r),r}function ya(e,t,s,a){let r=e.copy();switch(t){case"hour":{let i=e.hour,o=0,l=23;if(a?.hourCycle===12){let c=i>=12;o=c?12:0,l=c?23:11}r.hour=ze(i,s,o,l,a?.round);break}case"minute":r.minute=ze(e.minute,s,0,59,a?.round);break;case"second":r.second=ze(e.second,s,0,59,a?.round);break;case"millisecond":r.millisecond=ze(e.millisecond,s,0,999,a?.round);break;default:throw new Error("Unsupported field "+t)}return r}function ze(e,t,s,a,r=!1){if(r){e+=Math.sign(t),e<s&&(e=a);let i=Math.abs(t);t>0?e=Math.ceil(e/i)*i:e=Math.floor(e/i)*i,e>a&&(e=s)}else e+=t,e<s?e=a-(s-e-1):e>a&&(e=s+(e-a-1));return e}const Wl=/^([+-]\d{6}|\d{4})-(\d{2})-(\d{2})$/,Yl=/^([+-]\d{6}|\d{4})-(\d{2})-(\d{2})(?:T(\d{2}))?(?::(\d{2}))?(?::(\d{2}))?(\.\d+)?(?:(?:([+-]\d{2})(?::?(\d{2}))?)|Z)$/;function Kl(e){let t=e.match(Wl);if(!t)throw Yl.test(e)?new Error(`Invalid ISO 8601 date string: ${e}. Use parseAbsolute() instead.`):new Error("Invalid ISO 8601 date string: "+e);let s=new dt(zt(t[1],0,9999),zt(t[2],1,12),1);return s.day=zt(t[3],1,s.calendar.getDaysInMonth(s)),s}function zt(e,t,s){let a=Number(e);if(a<t||a>s)throw new RangeError(`Value out of range: ${t} <= ${a} <= ${s}`);return a}function va(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 ja(e){let t=jn(e,new Dt),s;return t.era==="BC"?s=t.year===1?"0000":"-"+String(Math.abs(1-t.year)).padStart(6,"00"):s=String(t.year).padStart(4,"0"),`${s}-${String(t.month).padStart(2,"0")}-${String(t.day).padStart(2,"0")}`}function Gl(e){return`${ja(e)}T${va(e)}`}function Ql(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function Nn(e,t,s){Ql(e,t),t.set(e,s)}function wa(e){let t=typeof e[0]=="object"?e.shift():new Dt,s;if(typeof e[0]=="string")s=e.shift();else{let o=t.getEras();s=o[o.length-1]}let a=e.shift(),r=e.shift(),i=e.shift();return[t,s,a,r,i]}var Zl=new WeakMap;class dt{copy(){return this.era?new dt(this.calendar,this.era,this.year,this.month,this.day):new dt(this.calendar,this.year,this.month,this.day)}add(t){return wn(this,t)}subtract(t){return fa(this,t)}set(t){return ma(this,t)}cycle(t,s,a){return ba(this,t,s,a)}toDate(t){return oa(this,t)}toString(){return ja(this)}compare(t){return sa(this,t)}constructor(...t){Nn(this,Zl,{writable:!0,value:void 0});let[s,a,r,i,o]=wa(t);this.calendar=s,this.era=a,this.year=r,this.month=i,this.day=o,Je(this)}}var Xl=new WeakMap;class Et{copy(){return new Et(this.hour,this.minute,this.second,this.millisecond)}add(t){return ga(this,t)}subtract(t){return ql(this,t)}set(t){return ha(this,t)}cycle(t,s,a){return ya(this,t,s,a)}toString(){return va(this)}compare(t){return aa(this,t)}constructor(t=0,s=0,a=0,r=0){Nn(this,Xl,{writable:!0,value:void 0}),this.hour=t,this.minute=s,this.second=a,this.millisecond=r,xa(this)}}var Jl=new WeakMap;class wt{copy(){return this.era?new wt(this.calendar,this.era,this.year,this.month,this.day,this.hour,this.minute,this.second,this.millisecond):new wt(this.calendar,this.year,this.month,this.day,this.hour,this.minute,this.second,this.millisecond)}add(t){return wn(this,t)}subtract(t){return fa(this,t)}set(t){return ma(ha(this,t),t)}cycle(t,s,a){switch(t){case"era":case"year":case"month":case"day":return ba(this,t,s,a);default:return ya(this,t,s,a)}}toDate(t,s){return oa(this,t,s)}toString(){return Gl(this)}compare(t){let s=sa(this,t);return s===0?aa(this,ca(t)):s}constructor(...t){Nn(this,Jl,{writable:!0,value:void 0});let[s,a,r,i,o]=wa(t);this.calendar=s,this.era=a,this.year=r,this.month=i,this.day=o,this.hour=t.shift()||0,this.minute=t.shift()||0,this.second=t.shift()||0,this.millisecond=t.shift()||0,Je(this)}}const eo="Open time options",to=320;function xs(e,t){return typeof t=="string"&&t.length>0?`${e} ${t}`:e}function Bt(e){if(!e)return null;const t="hour"in e&&typeof e.hour=="number"?e.hour:0,s="minute"in e&&typeof e.minute=="number"?e.minute:0,a="second"in e&&typeof e.second=="number"?e.second:0;return new Et(t,s,a)}function no(e,t){const s=new Date(2e3,0,1,e.hour,e.minute,e.second);return new Intl.DateTimeFormat("en-US",{hour:"numeric",minute:"2-digit",hour12:t===12}).format(s)}function so(e){const t=[];for(let s=0;s<24;s+=1)for(let a=0;a<60;a+=e)t.push(new Et(s,a));return t}function ao(e){const{minuteStep:t=15,timeListClassName:s,timeListLabel:a=eo,selectorButtonProps:r,endContent:i,onChange:o,value:l,defaultValue:c,hourCycle:u=12,...f}=e,h=l!==void 0,[g,m]=x.useState(()=>Bt(c)),v=h?Bt(l):g,j=x.useMemo(()=>so(t),[t]),b=y=>{h||m(y),o?.(y)},w=n.jsxs(d.Popover,{placement:"bottom-end",children:[n.jsx(d.PopoverTrigger,{children:n.jsx(d.Button,{isIconOnly:!0,variant:"light","aria-label":a,...r,onPress:void 0,children:n.jsx(K.Clock3,{className:"size-4",strokeWidth:1.75})})}),n.jsx(d.PopoverContent,{className:"min-w-[8.5rem] p-0",children:n.jsx(d.ScrollShadow,{className:s??"max-h-64 py-1",children:n.jsx("div",{className:"flex flex-col p-1",children:j.map(y=>{const k=v?.hour===y.hour&&v?.minute===y.minute;return n.jsx(d.Button,{variant:k?"flat":"light",color:k?"primary":"default",className:"h-9 min-w-0 justify-start px-3",onPress:()=>b(y),children:no(y,u)},`${y.hour}:${y.minute}`)})})})})]});return n.jsx(d.TimeInput,{...f,value:h?v:void 0,defaultValue:h?void 0:c,hourCycle:u,endContent:n.jsxs("div",{className:"flex items-center gap-1",children:[i,w]}),onChange:y=>b(Bt(y))})}function Cn(e){if(e.mode==="time")return n.jsx(ao,{...e});if(e.mode==="datetime"){const{mode:r,granularity:i="minute",hideTimeZone:o=!0,calendarWidth:l=to,disableAnimation:c=!0,classNames:u,...f}=e;return n.jsx(d.DatePicker,{...f,calendarWidth:l,classNames:{...u,popoverContent:xs("min-w-[20rem]",u?.popoverContent),calendarContent:xs("min-h-[18rem]",u?.calendarContent)},disableAnimation:c,granularity:i,hideTimeZone:o})}const{mode:t,granularity:s="day",...a}=e;return n.jsx(d.DatePicker,{...a,granularity:s})}function ro(e){const t=e?.closest('[role="dialog"]');return t?.parentElement??t??void 0}const Ie=x.forwardRef(({popoverProps:e,...t},s)=>{const a=x.useRef(null),[r,i]=x.useState(void 0),o={...e,disableDialogFocus:e?.disableDialogFocus??(r?!0:void 0),portalContainer:e?.portalContainer??r};return x.useEffect(()=>{i(ro(a.current))},[]),n.jsx("span",{ref:a,className:"contents",children:n.jsx(d.Select,{ref:s,...t,popoverProps:o})})});Ie.displayName="Select";function io({state:e,onSubmit:t,onRemove:s,appliedCredit:a,errorMessage:r,label:i="Gift Card",placeholder:o="GC-XXXX-XXXX-XXXX",applyLabel:l="Apply",removeAriaLabel:c="Remove gift card",testId:u="veevart-redeem-code-input"}){const[f,h]=x.useState(""),g=x.useId(),[m,v]=x.useState(e);e!==m&&(v(e),e==="applied"&&h(""));const j=()=>{const y=f.trim();y&&t(y)},b=y=>{y.key==="Enter"&&(y.preventDefault(),j())};if(e==="applied"&&a)return n.jsx("div",{"data-testid":u,children:n.jsx(ta,{code:a.code,amount:a.amount,onRemove:s,removeAriaLabel:c,testId:`${u}-card`})});const w=e==="error"&&r!=null;return n.jsxs("div",{"data-testid":u,className:"flex flex-col gap-1",children:[n.jsxs("div",{className:"flex items-end gap-2",children:[n.jsx(d.Input,{"data-testid":`${u}-input`,label:i,labelPlacement:"outside",variant:"bordered",radius:"lg",classNames:{label:"text-xs text-default-500 group-data-[filled-within=true]:text-default-500 group-data-[filled-within=true]:-translate-y-[calc(100%_+_var(--heroui-font-size-small)/2_+_16px)]",inputWrapper:"border-small"},placeholder:o,value:f,onValueChange:h,onKeyDown:b,isDisabled:e==="loading",isInvalid:e==="error","aria-describedby":w?g:void 0}),n.jsx(R,{testId:`${u}-button`,isLoading:e==="loading",isDisabled:!f.trim(),onPress:j,children:l})]}),w&&n.jsx("p",{id:g,"data-testid":`${u}-error`,className:"text-tiny text-danger",children:r})]})}const lo={login:"Login",logout:"Logout",selectLanguage:"Select your language"};function oo({languages:e,selectedLanguage:t,onLanguageChange:s,label:a}){const r=e.find(i=>i.code===t);return n.jsx("div",{className:"flex items-center",children:n.jsxs("div",{className:"relative flex items-center",children:[n.jsx(Ie,{"data-testid":"language-select-desktop",variant:"bordered","aria-label":a,selectedKeys:t?[t]:[],onSelectionChange:i=>{const o=Array.from(i)[0]||t;s?.(o)},className:"min-w-36 hidden md:inline-flex",isDisabled:e.length===0,placeholder:a,startContent:n.jsx(K.Globe,{className:"w-5 h-5 text-black"}),renderValue:()=>n.jsx("span",{children:r?.label||a}),size:"md",radius:"full",children:e.map(i=>n.jsx(d.SelectItem,{textValue:i.label,"data-testid":`language-select-option-${i.code}`,children:i.label},i.code))}),n.jsx(Ie,{"aria-label":a,"data-testid":"language-select-mobile",variant:"bordered",selectedKeys:t?[t]:[],onSelectionChange:i=>{const o=Array.from(i)[0]||t;s?.(o)},className:"w-24 inline-flex md:hidden",isDisabled:e.length===0,placeholder:"",startContent:n.jsx(K.Globe,{className:"w-6 h-6 text-black"}),renderValue:()=>n.jsx("span",{children:r?.code.toUpperCase()||""}),size:"md",radius:"full",children:e.map(i=>n.jsx(d.SelectItem,{textValue:i.code.toUpperCase(),"data-testid":`language-select-option-mobile-${i.code}`,children:i.code.toUpperCase()},i.code))})]})})}function co({isLoggedIn:e,onLogin:t,onLogout:s,labels:a}){return e?n.jsxs(R,{"data-testid":"navbar-auth-button",className:"px-2 py-1 w-1 min-w-12 md:min-w-24 rounded-full bg-black text-white text-sm flex items-center",onPress:s,size:"md",children:[n.jsx(K.User,{className:"inline w-5 h-5"}),n.jsx("span",{className:"hidden md:inline",children:a.logout})]}):n.jsxs(R,{"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:t,size:"md",children:[n.jsx(K.User,{className:"inline w-5 h-5"}),n.jsx("span",{className:"hidden md:inline",children:a.login})]})}function uo({logo:e,languages:t=[],selectedLanguage:s,onLanguageChange:a,isLoggedIn:r,onLogin:i,onLogout:o,hasLanguages:l,hasAuth:c,labels:u={},className:f}){const h={...lo,...u};return n.jsxs("nav",{"data-testid":"navbar",className:d.cn("w-full px-4 md:px-8 py-3 bg-white border-b border-zinc-100 flex items-center justify-between",f),children:[n.jsx("div",{className:"flex items-center min-w-10",children:e&&n.jsx("a",{href:"/",className:"block",children:n.jsx("img",{"data-testid":"navbar-logo",src:e,alt:"Logo",className:"h-8 w-auto max-w-28 md:max-w-40 object-contain"})})}),n.jsxs("div",{className:"flex items-center gap-2 md:gap-4",children:[(l||t.length>0)&&n.jsx(oo,{languages:t,selectedLanguage:s,onLanguageChange:a,label:h.selectLanguage}),c&&n.jsx(co,{isLoggedIn:r,onLogin:i,onLogout:o,labels:h})]})]})}function fo(e){return n.jsx("div",{className:"min-h-screen flex flex-col",children:n.jsx("div",{className:"flex-1 flex items-center justify-center p-12",children:n.jsx(d.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 Vt;const mo=typeof document<"u"?(Vt=x.useInsertionEffect)!==null&&Vt!==void 0?Vt:x.useLayoutEffect:()=>{};function Sn(e,t,s){let[a,r]=x.useState(e||t),i=x.useRef(a),o=x.useRef(e!==void 0),l=e!==void 0;x.useEffect(()=>{let h=o.current;h!==l&&process.env.NODE_ENV!=="production"&&console.warn(`WARN: A component changed from ${h?"controlled":"uncontrolled"} to ${l?"controlled":"uncontrolled"}.`),o.current=l},[l]);let c=l?e:a;mo(()=>{i.current=c});let[,u]=x.useReducer(()=>({}),{}),f=x.useCallback((h,...g)=>{let m=typeof h=="function"?h(i.current):h;Object.is(i.current,m)||(i.current=m,r(m),u(),s?.(m,...g))},[s]);return[c,f]}function ho(e){return n.jsx("svg",{...e,fill:"none",stroke:"currentColor",strokeWidth:2,viewBox:"0 0 24 24",children:n.jsx(Ae.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 kn=x.forwardRef(({color:e="primary",variant:t="default",stepsCount:s=3,defaultStep:a=0,label:r,stepLabels:i,showStepLabelTooltip:o=!1,stepLabelTooltipPlacement:l="top",showStepCounter:c=!1,stepCounterPosition:u="right",layout:f="compact",stepCounterFormat:h,onStepChange:g,currentStep:m,hideProgressBars:v=!1,stepClassName:j,className:b,isDisabled:w=!1,...y},k)=>{const[N,S]=Sn(m,a,g),E=x.useMemo(()=>{let L,M;const $=["[--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":L="[--step-color:var(--heroui-primary)]",M="[--step-fg-color:var(--heroui-primary-foreground)]";break;case"secondary":L="[--step-color:var(--heroui-secondary)]",M="[--step-fg-color:var(--heroui-secondary-foreground)]";break;case"success":L="[--step-color:var(--heroui-success)]",M="[--step-fg-color:var(--heroui-success-foreground)]";break;case"warning":L="[--step-color:var(--heroui-warning)]",M="[--step-fg-color:var(--heroui-warning-foreground)]";break;case"danger":L="[--step-color:var(--heroui-danger)]",M="[--step-fg-color:var(--heroui-danger-foreground)]";break;case"default":L="[--step-color:var(--heroui-default)]",M="[--step-fg-color:var(--heroui-default-foreground)]";break;default:L="[--step-color:var(--heroui-primary)]",M="[--step-fg-color:var(--heroui-primary-foreground)]";break}return $.unshift(M),$.unshift(L),$},[e]);return n.jsxs("nav",{ref:k,"aria-label":"Progress",className:d.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",...y,children:[c&&u==="left"?n.jsx("span",{className:"text-default-500 text-2xl whitespace-nowrap","data-testid":"stepper-counter",children:h?h(N+1,s):`Step ${N+1} of ${s}`}):null,r&&n.jsx("label",{className:"text-small text-default-foreground lg:text-medium font-light whitespace-nowrap me-3","data-testid":"stepper-label",children:r}),n.jsx("ol",{className:d.cn("flex flex-row flex-nowrap gap-x-3",E,b),"data-testid":"stepper-list",children:Array.from({length:s})?.map((L,M)=>{const $=N===M?"active":N<M?"inactive":"complete",O=t==="activeLabel"&&$==="active"&&!!i?.[M],F=o&&$!=="active"&&!!i?.[M];return n.jsxs("li",{className:"relative flex shrink-0 items-center gap-x-3","data-testid":`stepper-step-${M}`,children:[n.jsx(d.Tooltip,{content:F?i?.[M]:void 0,isDisabled:!F,offset:12,placement:l,classNames:{base:"px-0 py-0",content:"rounded-full border border-default-200 bg-white px-4 py-2 text-small font-medium text-default-700 shadow-sm"},children:n.jsxs("button",{"aria-current":$==="active"?"step":void 0,className:d.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":O},{"cursor-not-allowed opacity-50":w},j),onClick:()=>!w&&S(M),disabled:w,"data-testid":`stepper-step-btn-${M}`,children:[n.jsx("div",{className:"h-full relative flex items-center",children:n.jsx(Ae.LazyMotion,{features:Ae.domAnimation,children:n.jsx(Ae.m.div,{animate:$,className:"relative z-10",children:n.jsx(Ae.m.div,{animate:$,className:d.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)":O,"bg-(--complete-background-color)":$==="complete","shadow-lg":$==="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:n.jsx("div",{className:"flex items-center justify-center",children:$==="complete"&&t==="default"?n.jsx(ho,{className:"h-5 w-5 text-(--active-fg-color)","data-testid":`stepper-step-check-${M}`}):n.jsx("span",{children:M+1})})})})})}),O?n.jsx("span",{className:"pr-2 text-2xl leading-none font-medium whitespace-nowrap text-(--active-color)","data-testid":`stepper-step-label-${M}`,children:i[M]}):null]},M)}),M<s-1&&!v&&n.jsx("div",{"aria-hidden":"true",className:"pointer-events-none z-0 w-12 flex-none items-center",style:{"--idx":M},children:n.jsx("div",{className:d.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":M<N})})})]},M)})}),c&&u==="right"?n.jsx("span",{className:"text-default-500 text-2xl whitespace-nowrap","data-testid":"stepper-counter",children:h?h(N+1,s):`Step ${N+1} of ${s}`}):null]})});kn.displayName="Stepper";function xo(e){return n.jsx("div",{className:"min-h-screen flex flex-col",children:n.jsx("div",{className:"flex-1 flex items-center justify-center p-12",children:n.jsx(d.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 we(e,t="en-US",s="USD"){try{return new Intl.NumberFormat(t,{style:"currency",currency:s}).format(e)}catch{return`${s} ${e.toFixed(2)}`}}function An(e,t="en-US"){try{const s=new Intl.NumberFormat(t,{style:"currency",currency:e}).resolvedOptions();return typeof s.maximumFractionDigits=="number"?s.maximumFractionDigits:2}catch{return 2}}function Na(e,t,s="en-US"){const a=An(t,s),r=Math.pow(10,a);return Math.round(e*r)/r}function ln(e,t,s,a){return Na(e-t,s,a)}function po(){return n.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 go=e=>{const t=x.useMemo(()=>JSON.stringify({allItems:e.allItems,selected:e.selected}),[e.allItems,e.selected]);return n.jsx(bo,{...e},t)},bo=({allItems:e,selected:t,onSelectedChange:s,titleLeft:a,titleRight:r})=>{const[i,o]=x.useState([]),[l,c]=x.useState([]),[u,f]=x.useState(null),[h,g]=x.useState(null),m=x.useMemo(()=>new Set(t),[t]),v=x.useMemo(()=>new Set(e),[e]),j=x.useMemo(()=>e.filter(F=>!m.has(F)),[e,m]),b=F=>{if(F.length===0)return;const A=Array.from(new Set([...t,...F]));s(A)},w=F=>{if(F.length===0)return;const A=new Set(F);s(t.filter(I=>!A.has(I)))},y=()=>{i.length!==0&&(b(i),o([]))},k=()=>{l.length!==0&&(w(l),c([]))},N=()=>{j.length!==0&&(b(j),o([]))},S=()=>{t.length!==0&&(s([]),c([]))},E=(F,A,I)=>{const P=Math.min(A,I),G=Math.max(A,I);return F.slice(P,G+1)},L=(F,A,I)=>{if(I&&u!==null){o(E(j,u,A)),c([]),f(A);return}const P=i.includes(F);o(P?i.filter(G=>G!==F):[...i,F]),c([]),f(A)},M=(F,A,I)=>{if(I&&h!==null){c(E(t,h,A)),o([]),g(A);return}const P=l.includes(F);c(P?l.filter(G=>G!==F):[...l,F]),o([]),g(A)},$=(F,A,I)=>{const P=I==="available"?i.includes(A)?i:[A]:l.includes(A)?l:[A];F.dataTransfer.setData("text/plain",JSON.stringify({source:I,items:P})),F.dataTransfer.effectAllowed="move"},O=(F,A)=>{F.preventDefault();const I=F.dataTransfer.getData("text/plain");if(I)try{const P=JSON.parse(I),G=(P.items||[]).filter(q=>v.has(q));if(G.length===0||P.source===A)return;A==="selected"?(b(G),o([])):(w(G),c([]))}catch{return}};return n.jsxs("div",{className:"flex flex-col gap-6 md:flex-row md:items-start md:justify-between",children:[n.jsxs("div",{className:"flex w-full flex-col gap-3 md:w-2/5",children:[n.jsx("h2",{className:"text-sm font-medium text-gray-700",children:a}),n.jsx(d.Card,{className:"w-full border border-gray-200 shadow-none",children:n.jsx(d.CardBody,{className:"h-60 gap-2 overflow-y-auto",onDragOver:F=>F.preventDefault(),onDrop:F=>O(F,"available"),children:j.map((F,A)=>{const I=i.includes(F);return n.jsx("button",{type:"button",onClick:P=>{L(F,A,P.shiftKey)},onMouseDown:P=>{P.shiftKey&&P.preventDefault()},draggable:!0,onDragStart:P=>$(P,F,"available"),className:`rounded-md px-3 py-2 text-left text-sm transition ${I?"bg-[#E4571E]/10 text-[#E4571E]":"text-gray-700 hover:bg-gray-100"}`,children:F},F)})})})]}),n.jsxs("div",{className:"flex flex-row items-center justify-center gap-3 md:flex-col md:pt-6",children:[n.jsx(R,{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:y,isDisabled:i.length===0,"aria-label":"Move selected to right",children:"›"}),n.jsx(R,{variant:"light",className:"h-10 w-10 min-w-0 text-2xl font-semibold text-[#E4571E] hover:bg-[#E4571E]/10",isIconOnly:!0,"data-testid":"move-selected-to-available",onPress:k,isDisabled:l.length===0,"aria-label":"Move selected to left",children:"‹"}),n.jsx(R,{variant:"light",className:"h-10 w-10 min-w-0 text-2xl font-semibold text-[#E4571E] hover:bg-[#E4571E]/10",isIconOnly:!0,"data-testid":"move-all-to-selected",onPress:N,isDisabled:j.length===0,"aria-label":"Move all to right",children:"»"}),n.jsx(R,{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:t.length===0,"aria-label":"Move all to left",children:"«"})]}),n.jsxs("div",{className:"flex w-full flex-col gap-3 md:w-2/5",children:[n.jsx("h2",{className:"text-sm font-medium text-gray-700",children:r}),n.jsx(d.Card,{className:"w-full border border-gray-200 shadow-none",children:n.jsx(d.CardBody,{className:"h-60 gap-2 overflow-y-auto",onDragOver:F=>F.preventDefault(),onDrop:F=>O(F,"selected"),children:t.map((F,A)=>{const I=l.includes(F);return n.jsx("button",{type:"button",onClick:P=>{M(F,A,P.shiftKey)},onMouseDown:P=>{P.shiftKey&&P.preventDefault()},draggable:!0,onDragStart:P=>$(P,F,"selected"),className:`rounded-md px-3 py-2 text-left text-sm transition ${I?"bg-[#E4571E]/10 text-[#E4571E]":"text-gray-700 hover:bg-gray-100"}`,children:F},F)})})})]})]})};function ut(e){return typeof e=="string"?e:e.type}function He({className:e}){return n.jsx("div",{className:`flex items-center h-6 ${e||""}`,children:n.jsx(d.Divider,{orientation:"vertical"})})}function qe({icon:e,label:t,isActive:s=!1,isDisabled:a=!1,onClick:r,shortcut:i,iconSize:o=16,className:l}){const c=i?`${t} (${i})`:t;return n.jsx(d.Tooltip,{content:c,placement:"top",offset:10,children:n.jsx(R,{size:"sm",radius:"sm",color:s?"primary":"default",variant:s?"solid":"bordered",isIconOnly:!0,isDisabled:a,onPress:r,"aria-label":t,className:l,children:n.jsx(e,{size:o})})})}const Me={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:t})=>{const s=t?.type==="textColor"?t.color:"";s?e.chain().focus().setColor(s).run():e.chain().focus().unsetColor().run()},canExecute:()=>!0,isActive:e=>e.isActive("textStyle"),label:"Text color"},highlight:{execute:({editor:e,config:t})=>{const s=t?.type==="highlight"?t.color:"";s?e.chain().focus().setHighlight({color:s}).run():e.chain().focus().unsetHighlight().run()},canExecute:()=>!0,isActive:e=>e.isActive("highlight"),label:"Highlight"},link:{execute:({editor:e,config:t})=>{const s=t?.type==="link"?t.href:"";if(s){const a=t?.type==="link"?t.target:void 0,r=t?.type==="link"?t.rel:void 0;e.chain().focus().setLink({href:s,target:a,rel:r}).run()}else e.chain().focus().unsetLink().run()},canExecute:()=>!0,isActive:e=>e.isActive("link"),shortcut:"Mod-k",label:"Link"},paragraph:{execute:({editor:e})=>e.chain().focus().setParagraph().run(),canExecute:e=>e.can().chain().focus().setParagraph().run(),isActive:e=>e.isActive("paragraph"),shortcut:"Mod-Alt-0",label:"Paragraph"},heading:{execute:({editor:e,config:t})=>{const s=t?.type==="heading"?t.level:1;e.chain().focus().toggleHeading({level:s}).run()},canExecute:(e,t)=>{const s=t?.type==="heading"?t.level:1;return e.can().chain().focus().toggleHeading({level:s}).run()},isActive:(e,t)=>t?.type==="heading"?e.isActive("heading",{level:t.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:t})=>{const s=t?.type==="textAlign"?t.alignment:"left";e.chain().focus().setTextAlign(s).run()},canExecute:()=>!0,isActive:(e,t)=>t?.type==="textAlign"?e.isActive({textAlign:t.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"}},yo={1:"Heading 1",2:"Heading 2",3:"Heading 3",4:"Heading 4",5:"Heading 5",6:"Heading 6"};function vo({editor:e,levels:t=[1,2,3,4,5,6],isDisabled:s=!1}){const[,a]=x.useState(0);x.useEffect(()=>{const o=()=>a(l=>l+1);return e.on("selectionUpdate",o),e.on("transaction",o),()=>{e.off("selectionUpdate",o),e.off("transaction",o)}},[e]);const r=t.find(o=>e.isActive("heading",{level:o})),i=o=>{const l=Number(o),c=Me.heading;c&&c.execute({editor:e,config:{type:"heading",level:l}})};return n.jsxs(d.Dropdown,{placement:"top-start",offset:10,children:[n.jsx(d.DropdownTrigger,{children:n.jsx(R,{size:"sm",radius:"sm",variant:r?"solid":"bordered",color:r?"primary":"default",isDisabled:s,startContent:n.jsx(K.Heading,{size:16}),"aria-label":"Select heading level",children:r?`H${r}`:"H"})}),n.jsx(d.DropdownMenu,{"aria-label":"Heading levels",selectionMode:"single",selectedKeys:r?new Set([String(r)]):new Set,onAction:i,children:t.map(o=>n.jsx(d.DropdownItem,{startContent:e.isActive("heading",{level:o})?n.jsx(K.Check,{size:16}):n.jsx("div",{className:"w-4"}),children:yo[o]},o))})]})}const Ut={bulletList:{label:"Bullet List",icon:K.List},orderedList:{label:"Numbered List",icon:K.ListOrdered},taskList:{label:"Task List",icon:K.ListTodo}};function jo({editor:e,types:t=["bulletList","orderedList","taskList"],isDisabled:s=!1}){const[,a]=x.useState(0);x.useEffect(()=>{const l=()=>a(c=>c+1);return e.on("selectionUpdate",l),e.on("transaction",l),()=>{e.off("selectionUpdate",l),e.off("transaction",l)}},[e]);const r=t.find(l=>e.isActive(l)),i=r?Ut[r].icon:K.List,o=l=>{const u=Me[l];u&&u.execute({editor:e})};return n.jsxs(d.Dropdown,{placement:"top-start",offset:10,children:[n.jsx(d.DropdownTrigger,{children:n.jsx(R,{size:"sm",radius:"sm",variant:r?"solid":"bordered",color:r?"primary":"default",isDisabled:s,isIconOnly:!0,"aria-label":"Select list type",children:n.jsx(i,{size:16})})}),n.jsx(d.DropdownMenu,{"aria-label":"List types",selectionMode:"single",selectedKeys:r?new Set([r]):new Set,onAction:o,children:t.map(l=>{const c=Ut[l].icon;return n.jsx(d.DropdownItem,{startContent:n.jsx(c,{size:16}),children:Ut[l].label},l)})})]})}function wo({colors:e,selectedColor:t,onColorSelect:s,columns:a=4}){return n.jsx("div",{className:"grid gap-2",style:{gridTemplateColumns:`repeat(${a}, minmax(0, 1fr))`},children:e.map(r=>{const i=t===r;return n.jsx("button",{type:"button",onClick:()=>s(r),className:`
|
|
7
|
+
`}function _i({children:e}){return n.jsx(d.HeroUIProvider,{children:e})}function Oi(e,t){const s=e.icons,a=e.aliases||Object.create(null),r=Object.create(null);function i(o){if(s[o])return r[o]=[];if(!(o in r)){r[o]=null;const l=a[o]&&a[o].parent,c=l&&i(l);c&&(r[o]=[l].concat(c))}return r[o]}return Object.keys(s).concat(Object.keys(a)).forEach(i),r}const Hs=Object.freeze({left:0,top:0,width:16,height:16}),jt=Object.freeze({rotate:0,vFlip:!1,hFlip:!1}),pn=Object.freeze({...Hs,...jt}),en=Object.freeze({...pn,body:"",hidden:!1});function Ri(e,t){const s={};!e.hFlip!=!t.hFlip&&(s.hFlip=!0),!e.vFlip!=!t.vFlip&&(s.vFlip=!0);const a=((e.rotate||0)+(t.rotate||0))%4;return a&&(s.rotate=a),s}function ts(e,t){const s=Ri(e,t);for(const a in en)a in jt?a in e&&!(a in s)&&(s[a]=jt[a]):a in t?s[a]=t[a]:a in e&&(s[a]=e[a]);return s}function zi(e,t,s){const a=e.icons,r=e.aliases||Object.create(null);let i={};function o(l){i=ts(a[l]||r[l],i)}return o(t),s.forEach(o),ts(e,i)}function qs(e,t){const s=[];if(typeof e!="object"||typeof e.icons!="object")return s;e.not_found instanceof Array&&e.not_found.forEach(r=>{t(r,null),s.push(r)});const a=Oi(e);for(const r in a){const i=a[r];i&&(t(r,zi(e,r,i)),s.push(r))}return s}const Bi={provider:"",aliases:{},not_found:{},...Hs};function Pt(e,t){for(const s in t)if(s in e&&typeof e[s]!=typeof t[s])return!1;return!0}function Ws(e){if(typeof e!="object"||e===null)return null;const t=e;if(typeof t.prefix!="string"||!e.icons||typeof e.icons!="object"||!Pt(e,Bi))return null;const s=t.icons;for(const r in s){const i=s[r];if(!r||typeof i.body!="string"||!Pt(i,en))return null}const a=t.aliases||Object.create(null);for(const r in a){const i=a[r],o=i.parent;if(!r||typeof o!="string"||!s[o]&&!a[o]||!Pt(i,en))return null}return t}const ns=Object.create(null);function Vi(e,t){return{provider:e,prefix:t,icons:Object.create(null),missing:new Set}}function Xe(e,t){const s=ns[e]||(ns[e]=Object.create(null));return s[t]||(s[t]=Vi(e,t))}function Ys(e,t){return Ws(t)?qs(t,(s,a)=>{a?e.icons[s]=a:e.missing.add(s)}):[]}function Ui(e,t,s){try{if(typeof s.body=="string")return e.icons[t]={...s},!0}catch{}return!1}const Ks=/^[a-z0-9]+(-[a-z0-9]+)*$/,$t=(e,t,s,a="")=>{const r=e.split(":");if(e.slice(0,1)==="@"){if(r.length<2||r.length>3)return null;a=r.shift().slice(1)}if(r.length>3||!r.length)return null;if(r.length>1){const l=r.pop(),c=r.pop(),u={provider:r.length>0?r[0]:a,prefix:c,name:l};return t&&!bt(u)?null:u}const i=r[0],o=i.split("-");if(o.length>1){const l={provider:a,prefix:o.shift(),name:o.join("-")};return t&&!bt(l)?null:l}if(s&&a===""){const l={provider:a,prefix:"",name:i};return t&&!bt(l,s)?null:l}return null},bt=(e,t)=>e?!!((t&&e.prefix===""||e.prefix)&&e.name):!1;let ct=!1;function Gs(e){return typeof e=="boolean"&&(ct=e),ct}function ss(e){const t=typeof e=="string"?$t(e,!0,ct):e;if(t){const s=Xe(t.provider,t.prefix),a=t.name;return s.icons[a]||(s.missing.has(a)?null:void 0)}}function Hi(e,t){const s=$t(e,!0,ct);if(!s)return!1;const a=Xe(s.provider,s.prefix);return t?Ui(a,s.name,t):(a.missing.add(s.name),!0)}function qi(e,t){if(typeof e!="object")return!1;if(typeof t!="string"&&(t=e.provider||""),ct&&!t&&!e.prefix){let r=!1;return Ws(e)&&(e.prefix="",qs(e,(i,o)=>{Hi(i,o)&&(r=!0)})),r}const s=e.prefix;if(!bt({prefix:s,name:"a"}))return!1;const a=Xe(t,s);return!!Ys(a,e)}const Qs=Object.freeze({width:null,height:null}),Zs=Object.freeze({...Qs,...jt}),Wi=/(-?[0-9.]*[0-9]+[0-9.]*)/g,Yi=/^-?[0-9.]*[0-9]+[0-9.]*$/g;function as(e,t,s){if(t===1)return e;if(s=s||100,typeof e=="number")return Math.ceil(e*t*s)/s;if(typeof e!="string")return e;const a=e.split(Wi);if(a===null||!a.length)return e;const r=[];let i=a.shift(),o=Yi.test(i);for(;;){if(o){const l=parseFloat(i);isNaN(l)?r.push(i):r.push(Math.ceil(l*t*s)/s)}else r.push(i);if(i=a.shift(),i===void 0)return r.join("");o=!o}}function Ki(e,t="defs"){let s="";const a=e.indexOf("<"+t);for(;a>=0;){const r=e.indexOf(">",a),i=e.indexOf("</"+t);if(r===-1||i===-1)break;const o=e.indexOf(">",i);if(o===-1)break;s+=e.slice(r+1,i).trim(),e=e.slice(0,a).trim()+e.slice(o+1)}return{defs:s,content:e}}function Gi(e,t){return e?"<defs>"+e+"</defs>"+t:t}function Qi(e,t,s){const a=Ki(e);return Gi(a.defs,t+a.content+s)}const Zi=e=>e==="unset"||e==="undefined"||e==="none";function Xi(e,t){const s={...pn,...e},a={...Zs,...t},r={left:s.left,top:s.top,width:s.width,height:s.height};let i=s.body;[s,a].forEach(j=>{const b=[],w=j.hFlip,y=j.vFlip;let k=j.rotate;w?y?k+=2:(b.push("translate("+(r.width+r.left).toString()+" "+(0-r.top).toString()+")"),b.push("scale(-1 1)"),r.top=r.left=0):y&&(b.push("translate("+(0-r.left).toString()+" "+(r.height+r.top).toString()+")"),b.push("scale(1 -1)"),r.top=r.left=0);let N;switch(k<0&&(k-=Math.floor(k/4)*4),k=k%4,k){case 1:N=r.height/2+r.top,b.unshift("rotate(90 "+N.toString()+" "+N.toString()+")");break;case 2:b.unshift("rotate(180 "+(r.width/2+r.left).toString()+" "+(r.height/2+r.top).toString()+")");break;case 3:N=r.width/2+r.left,b.unshift("rotate(-90 "+N.toString()+" "+N.toString()+")");break}k%2===1&&(r.left!==r.top&&(N=r.left,r.left=r.top,r.top=N),r.width!==r.height&&(N=r.width,r.width=r.height,r.height=N)),b.length&&(i=Qi(i,'<g transform="'+b.join(" ")+'">',"</g>"))});const o=a.width,l=a.height,c=r.width,u=r.height;let f,h;o===null?(h=l===null?"1em":l==="auto"?u:l,f=as(h,c/u)):(f=o==="auto"?c:o,h=l===null?as(f,u/c):l==="auto"?u:l);const g={},m=(j,b)=>{Zi(b)||(g[j]=b.toString())};m("width",f),m("height",h);const v=[r.left,r.top,c,u];return g.viewBox=v.join(" "),{attributes:g,viewBox:v,body:i}}const Ji=/\sid="(\S+)"/g,el="IconifyId"+Date.now().toString(16)+(Math.random()*16777216|0).toString(16);let tl=0;function nl(e,t=el){const s=[];let a;for(;a=Ji.exec(e);)s.push(a[1]);if(!s.length)return e;const r="suffix"+(Math.random()*16777216|Date.now()).toString(16);return s.forEach(i=>{const o=typeof t=="function"?t(i):t+(tl++).toString(),l=i.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");e=e.replace(new RegExp('([#;"])('+l+')([")]|\\.[a-z])',"g"),"$1"+o+r+"$3")}),e=e.replace(new RegExp(r,"g"),""),e}const tn=Object.create(null);function sl(e,t){tn[e]=t}function nn(e){return tn[e]||tn[""]}function gn(e){let t;if(typeof e.resources=="string")t=[e.resources];else if(t=e.resources,!(t instanceof Array)||!t.length)return null;return{resources:t,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 bn=Object.create(null),tt=["https://api.simplesvg.com","https://api.unisvg.com"],yt=[];for(;tt.length>0;)tt.length===1||Math.random()>.5?yt.push(tt.shift()):yt.push(tt.pop());bn[""]=gn({resources:["https://api.iconify.design"].concat(yt)});function al(e,t){const s=gn(t);return s===null?!1:(bn[e]=s,!0)}function yn(e){return bn[e]}const rl=()=>{let e;try{if(e=fetch,typeof e=="function")return e}catch{}};let rs=rl();function il(e,t){const s=yn(e);if(!s)return 0;let a;if(!s.maxURL)a=0;else{let r=0;s.resources.forEach(o=>{r=Math.max(r,o.length)});const i=t+".json?icons=";a=s.maxURL-r-s.path.length-i.length}return a}function ll(e){return e===404}const ol=(e,t,s)=>{const a=[],r=il(e,t),i="icons";let o={type:i,provider:e,prefix:t,icons:[]},l=0;return s.forEach((c,u)=>{l+=c.length+1,l>=r&&u>0&&(a.push(o),o={type:i,provider:e,prefix:t,icons:[]},l=c.length),o.icons.push(c)}),a.push(o),a};function cl(e){if(typeof e=="string"){const t=yn(e);if(t)return t.path}return"/"}const dl=(e,t,s)=>{if(!rs){s("abort",424);return}let a=cl(t.provider);switch(t.type){case"icons":{const i=t.prefix,l=t.icons.join(","),c=new URLSearchParams({icons:l});a+=i+".json?"+c.toString();break}case"custom":{const i=t.uri;a+=i.slice(0,1)==="/"?i.slice(1):i;break}default:s("abort",400);return}let r=503;rs(e+a).then(i=>{const o=i.status;if(o!==200){setTimeout(()=>{s(ll(o)?"abort":"next",o)});return}return r=501,i.json()}).then(i=>{if(typeof i!="object"||i===null){setTimeout(()=>{i===404?s("abort",i):s("next",r)});return}setTimeout(()=>{s("success",i)})}).catch(()=>{s("next",r)})},ul={prepare:ol,send:dl};function Xs(e,t){e.forEach(s=>{const a=s.loaderCallbacks;a&&(s.loaderCallbacks=a.filter(r=>r.id!==t))})}function fl(e){e.pendingCallbacksFlag||(e.pendingCallbacksFlag=!0,setTimeout(()=>{e.pendingCallbacksFlag=!1;const t=e.loaderCallbacks?e.loaderCallbacks.slice(0):[];if(!t.length)return;let s=!1;const a=e.provider,r=e.prefix;t.forEach(i=>{const o=i.icons,l=o.pending.length;o.pending=o.pending.filter(c=>{if(c.prefix!==r)return!0;const u=c.name;if(e.icons[u])o.loaded.push({provider:a,prefix:r,name:u});else if(e.missing.has(u))o.missing.push({provider:a,prefix:r,name:u});else return s=!0,!0;return!1}),o.pending.length!==l&&(s||Xs([e],i.id),i.callback(o.loaded.slice(0),o.missing.slice(0),o.pending.slice(0),i.abort))})}))}let ml=0;function hl(e,t,s){const a=ml++,r=Xs.bind(null,s,a);if(!t.pending.length)return r;const i={id:a,icons:t,callback:e,abort:r};return s.forEach(o=>{(o.loaderCallbacks||(o.loaderCallbacks=[])).push(i)}),r}function xl(e){const t={loaded:[],missing:[],pending:[]},s=Object.create(null);e.sort((r,i)=>r.provider!==i.provider?r.provider.localeCompare(i.provider):r.prefix!==i.prefix?r.prefix.localeCompare(i.prefix):r.name.localeCompare(i.name));let a={provider:"",prefix:"",name:""};return e.forEach(r=>{if(a.name===r.name&&a.prefix===r.prefix&&a.provider===r.provider)return;a=r;const i=r.provider,o=r.prefix,l=r.name,c=s[i]||(s[i]=Object.create(null)),u=c[o]||(c[o]=Xe(i,o));let f;l in u.icons?f=t.loaded:o===""||u.missing.has(l)?f=t.missing:f=t.pending;const h={provider:i,prefix:o,name:l};f.push(h)}),t}function pl(e,t=!0,s=!1){const a=[];return e.forEach(r=>{const i=typeof r=="string"?$t(r,t,s):r;i&&a.push(i)}),a}const gl={resources:[],index:0,timeout:2e3,rotate:750,random:!1,dataAfterTimeout:!1};function bl(e,t,s,a){const r=e.resources.length,i=e.random?Math.floor(Math.random()*r):e.index;let o;if(e.random){let E=e.resources.slice(0);for(o=[];E.length>1;){const L=Math.floor(Math.random()*E.length);o.push(E[L]),E=E.slice(0,L).concat(E.slice(L+1))}o=o.concat(E)}else o=e.resources.slice(i).concat(e.resources.slice(0,i));const l=Date.now();let c="pending",u=0,f,h=null,g=[],m=[];typeof a=="function"&&m.push(a);function v(){h&&(clearTimeout(h),h=null)}function j(){c==="pending"&&(c="aborted"),v(),g.forEach(E=>{E.status==="pending"&&(E.status="aborted")}),g=[]}function b(E,L){L&&(m=[]),typeof E=="function"&&m.push(E)}function w(){return{startTime:l,payload:t,status:c,queriesSent:u,queriesPending:g.length,subscribe:b,abort:j}}function y(){c="failed",m.forEach(E=>{E(void 0,f)})}function k(){g.forEach(E=>{E.status==="pending"&&(E.status="aborted")}),g=[]}function N(E,L,M){const $=L!=="success";switch(g=g.filter(O=>O!==E),c){case"pending":break;case"failed":if($||!e.dataAfterTimeout)return;break;default:return}if(L==="abort"){f=M,y();return}if($){f=M,g.length||(o.length?S():y());return}if(v(),k(),!e.random){const O=e.resources.indexOf(E.resource);O!==-1&&O!==e.index&&(e.index=O)}c="completed",m.forEach(O=>{O(M)})}function S(){if(c!=="pending")return;v();const E=o.shift();if(E===void 0){if(g.length){h=setTimeout(()=>{v(),c==="pending"&&(k(),y())},e.timeout);return}y();return}const L={status:"pending",resource:E,callback:(M,$)=>{N(L,M,$)}};g.push(L),u++,h=setTimeout(S,e.rotate),s(E,t,L.callback)}return setTimeout(S),w}function Js(e){const t={...gl,...e};let s=[];function a(){s=s.filter(l=>l().status==="pending")}function r(l,c,u){const f=bl(t,l,c,(h,g)=>{a(),u&&u(h,g)});return s.push(f),f}function i(l){return s.find(c=>l(c))||null}return{query:r,find:i,setIndex:l=>{t.index=l},getIndex:()=>t.index,cleanup:a}}function is(){}const _t=Object.create(null);function yl(e){if(!_t[e]){const t=yn(e);if(!t)return;const s=Js(t),a={config:t,redundancy:s};_t[e]=a}return _t[e]}function vl(e,t,s){let a,r;if(typeof e=="string"){const i=nn(e);if(!i)return s(void 0,424),is;r=i.send;const o=yl(e);o&&(a=o.redundancy)}else{const i=gn(e);if(i){a=Js(i);const o=e.resources?e.resources[0]:"",l=nn(o);l&&(r=l.send)}}return!a||!r?(s(void 0,424),is):a.query(t,r,s)().abort}function ls(){}function jl(e){e.iconsLoaderFlag||(e.iconsLoaderFlag=!0,setTimeout(()=>{e.iconsLoaderFlag=!1,fl(e)}))}function wl(e){const t=[],s=[];return e.forEach(a=>{(a.match(Ks)?t:s).push(a)}),{valid:t,invalid:s}}function nt(e,t,s){function a(){const r=e.pendingIcons;t.forEach(i=>{r&&r.delete(i),e.icons[i]||e.missing.add(i)})}if(s&&typeof s=="object")try{if(!Ys(e,s).length){a();return}}catch(r){console.error(r)}a(),jl(e)}function os(e,t){e instanceof Promise?e.then(s=>{t(s)}).catch(()=>{t(null)}):t(e)}function Nl(e,t){e.iconsToLoad?e.iconsToLoad=e.iconsToLoad.concat(t).sort():e.iconsToLoad=t,e.iconsQueueFlag||(e.iconsQueueFlag=!0,setTimeout(()=>{e.iconsQueueFlag=!1;const{provider:s,prefix:a}=e,r=e.iconsToLoad;if(delete e.iconsToLoad,!r||!r.length)return;const i=e.loadIcon;if(e.loadIcons&&(r.length>1||!i)){os(e.loadIcons(r,a,s),f=>{nt(e,r,f)});return}if(i){r.forEach(f=>{const h=i(f,a,s);os(h,g=>{const m=g?{prefix:a,icons:{[f]:g}}:null;nt(e,[f],m)})});return}const{valid:o,invalid:l}=wl(r);if(l.length&&nt(e,l,null),!o.length)return;const c=a.match(Ks)?nn(s):null;if(!c){nt(e,o,null);return}c.prepare(s,a,o).forEach(f=>{vl(s,f,h=>{nt(e,f.icons,h)})})}))}const Cl=(e,t)=>{const s=pl(e,!0,Gs()),a=xl(s);if(!a.pending.length){let c=!0;return t&&setTimeout(()=>{c&&t(a.loaded,a.missing,a.pending,ls)}),()=>{c=!1}}const r=Object.create(null),i=[];let o,l;return a.pending.forEach(c=>{const{provider:u,prefix:f}=c;if(f===l&&u===o)return;o=u,l=f,i.push(Xe(u,f));const h=r[u]||(r[u]=Object.create(null));h[f]||(h[f]=[])}),a.pending.forEach(c=>{const{provider:u,prefix:f,name:h}=c,g=Xe(u,f),m=g.pendingIcons||(g.pendingIcons=new Set);m.has(h)||(m.add(h),r[u][f].push(h))}),i.forEach(c=>{const u=r[c.provider][c.prefix];u.length&&Nl(c,u)}),t?hl(t,a,i):ls};function Sl(e,t){const s={...e};for(const a in t){const r=t[a],i=typeof r;a in Qs?(r===null||r&&(i==="string"||i==="number"))&&(s[a]=r):i===typeof s[a]&&(s[a]=a==="rotate"?r%4:r)}return s}const kl=/[\s,]+/;function Al(e,t){t.split(kl).forEach(s=>{switch(s.trim()){case"horizontal":e.hFlip=!0;break;case"vertical":e.vFlip=!0;break}})}function $l(e,t=0){const s=e.replace(/^-?[0-9.]*/,"");function a(r){for(;r<0;)r+=4;return r%4}if(s===""){const r=parseInt(e);return isNaN(r)?0:a(r)}else if(s!==e){let r=0;switch(s){case"%":r=25;break;case"deg":r=90}if(r){let i=parseFloat(e.slice(0,e.length-s.length));return isNaN(i)?0:(i=i/r,i%1===0?a(i):0)}}return t}function Dl(e,t){let s=e.indexOf("xlink:")===-1?"":' xmlns:xlink="http://www.w3.org/1999/xlink"';for(const a in t)s+=" "+a+'="'+t[a]+'"';return'<svg xmlns="http://www.w3.org/2000/svg"'+s+">"+e+"</svg>"}function El(e){return e.replace(/"/g,"'").replace(/%/g,"%25").replace(/#/g,"%23").replace(/</g,"%3C").replace(/>/g,"%3E").replace(/\s+/g," ")}function Fl(e){return"data:image/svg+xml,"+El(e)}function Ll(e){return'url("'+Fl(e)+'")'}let it;function Ml(){try{it=window.trustedTypes.createPolicy("iconify",{createHTML:e=>e})}catch{it=null}}function Il(e){return it===void 0&&Ml(),it?it.createHTML(e):e}const ea={...Zs,inline:!1},Tl={xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink","aria-hidden":!0,role:"img"},Pl={display:"inline-block"},sn={backgroundColor:"currentColor"},ta={backgroundColor:"transparent"},cs={Image:"var(--svg)",Repeat:"no-repeat",Size:"100% 100%"},ds={WebkitMask:sn,mask:sn,background:ta};for(const e in ds){const t=ds[e];for(const s in cs)t[e+s]=cs[s]}const _l={...ea,inline:!0};function us(e){return e+(e.match(/^[-0-9.]+$/)?"px":"")}const Ol=(e,t,s)=>{const a=t.inline?_l:ea,r=Sl(a,t),i=t.mode||"svg",o={},l=t.style||{},c={...i==="svg"?Tl:{}};if(s){const b=$t(s,!1,!0);if(b){const w=["iconify"],y=["provider","prefix"];for(const k of y)b[k]&&w.push("iconify--"+b[k]);c.className=w.join(" ")}}for(let b in t){const w=t[b];if(w!==void 0)switch(b){case"icon":case"style":case"children":case"onLoad":case"mode":case"ssr":case"fallback":break;case"_ref":c.ref=w;break;case"className":c[b]=(c[b]?c[b]+" ":"")+w;break;case"inline":case"hFlip":case"vFlip":r[b]=w===!0||w==="true"||w===1;break;case"flip":typeof w=="string"&&Al(r,w);break;case"color":o.color=w;break;case"rotate":typeof w=="string"?r[b]=$l(w):typeof w=="number"&&(r[b]=w);break;case"ariaHidden":case"aria-hidden":w!==!0&&w!=="true"&&delete c["aria-hidden"];break;default:a[b]===void 0&&(c[b]=w)}}const u=Xi(e,r),f=u.attributes;if(r.inline&&(o.verticalAlign="-0.125em"),i==="svg"){c.style={...o,...l},Object.assign(c,f);let b=0,w=t.id;return typeof w=="string"&&(w=w.replace(/-/g,"_")),c.dangerouslySetInnerHTML={__html:Il(nl(u.body,w?()=>w+"ID"+b++:"iconifyReact"))},x.createElement("svg",c)}const{body:h,width:g,height:m}=e,v=i==="mask"||(i==="bg"?!1:h.indexOf("currentColor")!==-1),j=Dl(h,{...f,width:g+"",height:m+""});return c.style={...o,"--svg":Ll(j),width:us(f.width),height:us(f.height),...Pl,...v?sn:ta,...l},x.createElement("span",c)};Gs(!0);sl("",ul);if(typeof document<"u"&&typeof window<"u"){const e=window;if(e.IconifyPreload!==void 0){const t=e.IconifyPreload,s="Invalid IconifyPreload syntax.";typeof t=="object"&&t!==null&&(t instanceof Array?t:[t]).forEach(a=>{try{(typeof a!="object"||a===null||a instanceof Array||typeof a.icons!="object"||typeof a.prefix!="string"||!qi(a))&&console.error(s)}catch{console.error(s)}})}if(e.IconifyProviders!==void 0){const t=e.IconifyProviders;if(typeof t=="object"&&t!==null)for(let s in t){const a="IconifyProviders["+s+"] is invalid.";try{const r=t[s];if(typeof r!="object"||!r||r.resources===void 0)continue;al(s,r)||console.error(a)}catch{console.error(a)}}}}function na(e){const[t,s]=x.useState(!!e.ssr),[a,r]=x.useState({});function i(m){if(m){const v=e.icon;if(typeof v=="object")return{name:"",data:v};const j=ss(v);if(j)return{name:v,data:j}}return{name:""}}const[o,l]=x.useState(i(!!e.ssr));function c(){const m=a.callback;m&&(m(),r({}))}function u(m){if(JSON.stringify(o)!==JSON.stringify(m))return c(),l(m),!0}function f(){var m;const v=e.icon;if(typeof v=="object"){u({name:"",data:v});return}const j=ss(v);if(u({name:v,data:j}))if(j===void 0){const b=Cl([v],f);r({callback:b})}else j&&((m=e.onLoad)===null||m===void 0||m.call(e,v))}x.useEffect(()=>(s(!0),c),[]),x.useEffect(()=>{t&&f()},[e.icon,t]);const{name:h,data:g}=o;return g?Ol({...pn,...g},e,h):e.children?e.children:e.fallback?e.fallback:x.createElement("span",{})}const V=x.forwardRef((e,t)=>na({...e,_ref:t}));x.forwardRef((e,t)=>na({inline:!0,...e,_ref:t}));const R=x.forwardRef(({color:e="primary",radius:t="full",testId:s="veevart-button",...a},r)=>n.jsx(d.Button,{ref:r,color:e,radius:t,"data-testid":s,...a}));R.displayName="Button";function sa({code:e,amount:t,onRemove:s,label:a="Gift Card",removeAriaLabel:r="Remove gift card",testId:i="veevart-applied-code-card"}){return n.jsx(d.Card,{"data-testid":i,shadow:"sm",className:"w-full",children:n.jsxs(d.CardBody,{className:"flex flex-row items-start justify-between gap-2 p-4",children:[n.jsxs("div",{className:"flex min-w-0 flex-col gap-1",children:[n.jsx("span",{className:"text-xs text-default-500",children:a}),n.jsx("span",{"data-testid":`${i}-code`,className:"truncate font-medium text-foreground",children:e}),n.jsx("span",{"data-testid":`${i}-amount`,className:"text-lg font-semibold text-primary",children:t})]}),n.jsx(R,{testId:`${i}-remove`,isIconOnly:!0,size:"sm",variant:"light","aria-label":r,onPress:s,children:n.jsx(V,{icon:"solar:close-circle-linear",className:"size-4","aria-hidden":"true"})})]})})}function Ot(e,t){return e-t*Math.floor(e/t)}const aa=1721426;function pt(e,t,s,a){t=vn(e,t);let r=t-1,i=-2;return s<=2?i=0:vt(t)&&(i=-1),aa-1+365*r+Math.floor(r/4)-Math.floor(r/100)+Math.floor(r/400)+Math.floor((367*s-362)/12+i+a)}function vt(e){return e%4===0&&(e%100!==0||e%400===0)}function vn(e,t){return e==="BC"?1-t:t}function Rl(e){let t="AD";return e<=0&&(t="BC",e=1-e),[t,e]}const zl={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 Dt{fromJulianDay(t){let s=t,a=s-aa,r=Math.floor(a/146097),i=Ot(a,146097),o=Math.floor(i/36524),l=Ot(i,36524),c=Math.floor(l/1461),u=Ot(l,1461),f=Math.floor(u/365),h=r*400+o*100+c*4+f+(o!==4&&f!==4?1:0),[g,m]=Rl(h),v=s-pt(g,m,1,1),j=2;s<pt(g,m,3,1)?j=0:vt(m)&&(j=1);let b=Math.floor(((v+j)*12+373)/367),w=s-pt(g,m,b,1)+1;return new dt(g,m,b,w)}toJulianDay(t){return pt(t.era,t.year,t.month,t.day)}getDaysInMonth(t){return zl[vt(t.year)?"leapyear":"standard"][t.month-1]}getMonthsInYear(t){return 12}getDaysInYear(t){return vt(t.year)?366:365}getMaximumMonthsInYear(){return 12}getMaximumDaysInMonth(){return 31}getYearsInEra(t){return 9999}getEras(){return["BC","AD"]}isInverseEra(t){return t.era==="BC"}balanceDate(t){t.year<=0&&(t.era=t.era==="BC"?"AD":"BC",t.year=1-t.year)}constructor(){this.identifier="gregory"}}function Bl(e,t){var s,a,r,i;return(i=(r=(s=e.isEqual)===null||s===void 0?void 0:s.call(e,t))!==null&&r!==void 0?r:(a=t.isEqual)===null||a===void 0?void 0:a.call(t,e))!==null&&i!==void 0?i:e.identifier===t.identifier}function ra(e,t){return e.calendar.toJulianDay(e)-t.calendar.toJulianDay(t)}function ia(e,t){return fs(e)-fs(t)}function fs(e){return e.hour*36e5+e.minute*6e4+e.second*1e3+e.millisecond}let Rt=null;function la(){return Rt==null&&(Rt=new Intl.DateTimeFormat().resolvedOptions().timeZone),Rt}function ms(e){e=jn(e,new Dt);let t=vn(e.era,e.year);return oa(t,e.month,e.day,e.hour,e.minute,e.second,e.millisecond)}function oa(e,t,s,a,r,i,o){let l=new Date;return l.setUTCHours(a,r,i,o),l.setUTCFullYear(e,t-1,s),l.getTime()}function hs(e,t){if(t==="UTC")return 0;if(e>0&&t===la())return new Date(e).getTimezoneOffset()*-6e4;let{year:s,month:a,day:r,hour:i,minute:o,second:l}=ca(e,t);return oa(s,a,r,i,o,l,0)-Math.floor(e/1e3)*1e3}const xs=new Map;function ca(e,t){let s=xs.get(t);s||(s=new Intl.DateTimeFormat("en-US",{timeZone:t,hour12:!1,era:"short",year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric"}),xs.set(t,s));let a=s.formatToParts(new Date(e)),r={};for(let i of a)i.type!=="literal"&&(r[i.type]=i.value);return{year:r.era==="BC"||r.era==="B"?-r.year+1:+r.year,month:+r.month,day:+r.day,hour:r.hour==="24"?0:+r.hour,minute:+r.minute,second:+r.second}}const ps=864e5;function Vl(e,t,s,a){return(s===a?[s]:[s,a]).filter(i=>Ul(e,t,i))}function Ul(e,t,s){let a=ca(s,t);return e.year===a.year&&e.month===a.month&&e.day===a.day&&e.hour===a.hour&&e.minute===a.minute&&e.second===a.second}function Hl(e,t,s="compatible"){let a=ua(e);if(t==="UTC")return ms(a);if(t===la()&&s==="compatible"){a=jn(a,new Dt);let c=new Date,u=vn(a.era,a.year);return c.setFullYear(u,a.month-1,a.day),c.setHours(a.hour,a.minute,a.second,a.millisecond),c.getTime()}let r=ms(a),i=hs(r-ps,t),o=hs(r+ps,t),l=Vl(a,t,r-i,r-o);if(l.length===1)return l[0];if(l.length>1)switch(s){case"compatible":case"earlier":return l[0];case"later":return l[l.length-1];case"reject":throw new RangeError("Multiple possible absolute times found")}switch(s){case"earlier":return Math.min(r-i,r-o);case"compatible":case"later":return Math.max(r-i,r-o);case"reject":throw new RangeError("No such absolute time found")}}function da(e,t,s="compatible"){return new Date(Hl(e,t,s))}function ua(e,t){let s=0,a=0,r=0,i=0;if("timeZone"in e)({hour:s,minute:a,second:r,millisecond:i}=e);else if("hour"in e&&!t)return e;return t&&({hour:s,minute:a,second:r,millisecond:i}=t),new wt(e.calendar,e.era,e.year,e.month,e.day,s,a,r,i)}function jn(e,t){if(Bl(e.calendar,t))return e;let s=t.fromJulianDay(e.calendar.toJulianDay(e)),a=e.copy();return a.calendar=t,a.era=s.era,a.year=s.year,a.month=s.month,a.day=s.day,Je(a),a}function wn(e,t){let s=e.copy(),a="hour"in s?ba(s,t):0;an(s,t.years||0),s.calendar.balanceYearMonth&&s.calendar.balanceYearMonth(s,e),s.month+=t.months||0,rn(s),fa(s),s.day+=(t.weeks||0)*7,s.day+=t.days||0,s.day+=a,ql(s),s.calendar.balanceDate&&s.calendar.balanceDate(s),s.year<1&&(s.year=1,s.month=1,s.day=1);let r=s.calendar.getYearsInEra(s);if(s.year>r){var i,o;let c=(i=(o=s.calendar).isInverseEra)===null||i===void 0?void 0:i.call(o,s);s.year=r,s.month=c?1:s.calendar.getMonthsInYear(s),s.day=c?1:s.calendar.getDaysInMonth(s)}s.month<1&&(s.month=1,s.day=1);let l=s.calendar.getMonthsInYear(s);return s.month>l&&(s.month=l,s.day=s.calendar.getDaysInMonth(s)),s.day=Math.max(1,Math.min(s.calendar.getDaysInMonth(s),s.day)),s}function an(e,t){var s,a;!((s=(a=e.calendar).isInverseEra)===null||s===void 0)&&s.call(a,e)&&(t=-t),e.year+=t}function rn(e){for(;e.month<1;)an(e,-1),e.month+=e.calendar.getMonthsInYear(e);let t=0;for(;e.month>(t=e.calendar.getMonthsInYear(e));)e.month-=t,an(e,1)}function ql(e){for(;e.day<1;)e.month--,rn(e),e.day+=e.calendar.getDaysInMonth(e);for(;e.day>e.calendar.getDaysInMonth(e);)e.day-=e.calendar.getDaysInMonth(e),e.month++,rn(e)}function fa(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 Je(e){e.calendar.constrainDate&&e.calendar.constrainDate(e),e.year=Math.max(1,Math.min(e.calendar.getYearsInEra(e),e.year)),fa(e)}function ma(e){let t={};for(let s in e)typeof e[s]=="number"&&(t[s]=-e[s]);return t}function ha(e,t){return wn(e,ma(t))}function xa(e,t){let s=e.copy();return t.era!=null&&(s.era=t.era),t.year!=null&&(s.year=t.year),t.month!=null&&(s.month=t.month),t.day!=null&&(s.day=t.day),Je(s),s}function pa(e,t){let s=e.copy();return t.hour!=null&&(s.hour=t.hour),t.minute!=null&&(s.minute=t.minute),t.second!=null&&(s.second=t.second),t.millisecond!=null&&(s.millisecond=t.millisecond),ga(s),s}function Wl(e){e.second+=Math.floor(e.millisecond/1e3),e.millisecond=gt(e.millisecond,1e3),e.minute+=Math.floor(e.second/60),e.second=gt(e.second,60),e.hour+=Math.floor(e.minute/60),e.minute=gt(e.minute,60);let t=Math.floor(e.hour/24);return e.hour=gt(e.hour,24),t}function ga(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 gt(e,t){let s=e%t;return s<0&&(s+=t),s}function ba(e,t){return e.hour+=t.hours||0,e.minute+=t.minutes||0,e.second+=t.seconds||0,e.millisecond+=t.milliseconds||0,Wl(e)}function ya(e,t){let s=e.copy();return ba(s,t),s}function Yl(e,t){return ya(e,ma(t))}function va(e,t,s,a){let r=e.copy();switch(t){case"era":{let l=e.calendar.getEras(),c=l.indexOf(e.era);if(c<0)throw new Error("Invalid era: "+e.era);c=ze(c,s,0,l.length-1,a?.round),r.era=l[c],Je(r);break}case"year":var i,o;!((i=(o=r.calendar).isInverseEra)===null||i===void 0)&&i.call(o,r)&&(s=-s),r.year=ze(e.year,s,-1/0,9999,a?.round),r.year===-1/0&&(r.year=1),r.calendar.balanceYearMonth&&r.calendar.balanceYearMonth(r,e);break;case"month":r.month=ze(e.month,s,1,e.calendar.getMonthsInYear(e),a?.round);break;case"day":r.day=ze(e.day,s,1,e.calendar.getDaysInMonth(e),a?.round);break;default:throw new Error("Unsupported field "+t)}return e.calendar.balanceDate&&e.calendar.balanceDate(r),Je(r),r}function ja(e,t,s,a){let r=e.copy();switch(t){case"hour":{let i=e.hour,o=0,l=23;if(a?.hourCycle===12){let c=i>=12;o=c?12:0,l=c?23:11}r.hour=ze(i,s,o,l,a?.round);break}case"minute":r.minute=ze(e.minute,s,0,59,a?.round);break;case"second":r.second=ze(e.second,s,0,59,a?.round);break;case"millisecond":r.millisecond=ze(e.millisecond,s,0,999,a?.round);break;default:throw new Error("Unsupported field "+t)}return r}function ze(e,t,s,a,r=!1){if(r){e+=Math.sign(t),e<s&&(e=a);let i=Math.abs(t);t>0?e=Math.ceil(e/i)*i:e=Math.floor(e/i)*i,e>a&&(e=s)}else e+=t,e<s?e=a-(s-e-1):e>a&&(e=s+(e-a-1));return e}const Kl=/^([+-]\d{6}|\d{4})-(\d{2})-(\d{2})$/,Gl=/^([+-]\d{6}|\d{4})-(\d{2})-(\d{2})(?:T(\d{2}))?(?::(\d{2}))?(?::(\d{2}))?(\.\d+)?(?:(?:([+-]\d{2})(?::?(\d{2}))?)|Z)$/;function Ql(e){let t=e.match(Kl);if(!t)throw Gl.test(e)?new Error(`Invalid ISO 8601 date string: ${e}. Use parseAbsolute() instead.`):new Error("Invalid ISO 8601 date string: "+e);let s=new dt(zt(t[1],0,9999),zt(t[2],1,12),1);return s.day=zt(t[3],1,s.calendar.getDaysInMonth(s)),s}function zt(e,t,s){let a=Number(e);if(a<t||a>s)throw new RangeError(`Value out of range: ${t} <= ${a} <= ${s}`);return a}function wa(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 Na(e){let t=jn(e,new Dt),s;return t.era==="BC"?s=t.year===1?"0000":"-"+String(Math.abs(1-t.year)).padStart(6,"00"):s=String(t.year).padStart(4,"0"),`${s}-${String(t.month).padStart(2,"0")}-${String(t.day).padStart(2,"0")}`}function Zl(e){return`${Na(e)}T${wa(e)}`}function Xl(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function Nn(e,t,s){Xl(e,t),t.set(e,s)}function Ca(e){let t=typeof e[0]=="object"?e.shift():new Dt,s;if(typeof e[0]=="string")s=e.shift();else{let o=t.getEras();s=o[o.length-1]}let a=e.shift(),r=e.shift(),i=e.shift();return[t,s,a,r,i]}var Jl=new WeakMap;class dt{copy(){return this.era?new dt(this.calendar,this.era,this.year,this.month,this.day):new dt(this.calendar,this.year,this.month,this.day)}add(t){return wn(this,t)}subtract(t){return ha(this,t)}set(t){return xa(this,t)}cycle(t,s,a){return va(this,t,s,a)}toDate(t){return da(this,t)}toString(){return Na(this)}compare(t){return ra(this,t)}constructor(...t){Nn(this,Jl,{writable:!0,value:void 0});let[s,a,r,i,o]=Ca(t);this.calendar=s,this.era=a,this.year=r,this.month=i,this.day=o,Je(this)}}var eo=new WeakMap;class Et{copy(){return new Et(this.hour,this.minute,this.second,this.millisecond)}add(t){return ya(this,t)}subtract(t){return Yl(this,t)}set(t){return pa(this,t)}cycle(t,s,a){return ja(this,t,s,a)}toString(){return wa(this)}compare(t){return ia(this,t)}constructor(t=0,s=0,a=0,r=0){Nn(this,eo,{writable:!0,value:void 0}),this.hour=t,this.minute=s,this.second=a,this.millisecond=r,ga(this)}}var to=new WeakMap;class wt{copy(){return this.era?new wt(this.calendar,this.era,this.year,this.month,this.day,this.hour,this.minute,this.second,this.millisecond):new wt(this.calendar,this.year,this.month,this.day,this.hour,this.minute,this.second,this.millisecond)}add(t){return wn(this,t)}subtract(t){return ha(this,t)}set(t){return xa(pa(this,t),t)}cycle(t,s,a){switch(t){case"era":case"year":case"month":case"day":return va(this,t,s,a);default:return ja(this,t,s,a)}}toDate(t,s){return da(this,t,s)}toString(){return Zl(this)}compare(t){let s=ra(this,t);return s===0?ia(this,ua(t)):s}constructor(...t){Nn(this,to,{writable:!0,value:void 0});let[s,a,r,i,o]=Ca(t);this.calendar=s,this.era=a,this.year=r,this.month=i,this.day=o,this.hour=t.shift()||0,this.minute=t.shift()||0,this.second=t.shift()||0,this.millisecond=t.shift()||0,Je(this)}}const no="Open time options",so=320;function gs(e,t){return typeof t=="string"&&t.length>0?`${e} ${t}`:e}function Bt(e){if(!e)return null;const t="hour"in e&&typeof e.hour=="number"?e.hour:0,s="minute"in e&&typeof e.minute=="number"?e.minute:0,a="second"in e&&typeof e.second=="number"?e.second:0;return new Et(t,s,a)}function ao(e,t){const s=new Date(2e3,0,1,e.hour,e.minute,e.second);return new Intl.DateTimeFormat("en-US",{hour:"numeric",minute:"2-digit",hour12:t===12}).format(s)}function ro(e){const t=[];for(let s=0;s<24;s+=1)for(let a=0;a<60;a+=e)t.push(new Et(s,a));return t}function io(e){const{minuteStep:t=15,timeListClassName:s,timeListLabel:a=no,selectorButtonProps:r,endContent:i,onChange:o,value:l,defaultValue:c,hourCycle:u=12,...f}=e,h=l!==void 0,[g,m]=x.useState(()=>Bt(c)),v=h?Bt(l):g,j=x.useMemo(()=>ro(t),[t]),b=y=>{h||m(y),o?.(y)},w=n.jsxs(d.Popover,{placement:"bottom-end",children:[n.jsx(d.PopoverTrigger,{children:n.jsx(d.Button,{isIconOnly:!0,variant:"light","aria-label":a,...r,onPress:void 0,children:n.jsx(K.Clock3,{className:"size-4",strokeWidth:1.75})})}),n.jsx(d.PopoverContent,{className:"min-w-[8.5rem] p-0",children:n.jsx(d.ScrollShadow,{className:s??"max-h-64 py-1",children:n.jsx("div",{className:"flex flex-col p-1",children:j.map(y=>{const k=v?.hour===y.hour&&v?.minute===y.minute;return n.jsx(d.Button,{variant:k?"flat":"light",color:k?"primary":"default",className:"h-9 min-w-0 justify-start px-3",onPress:()=>b(y),children:ao(y,u)},`${y.hour}:${y.minute}`)})})})})]});return n.jsx(d.TimeInput,{...f,value:h?v:void 0,defaultValue:h?void 0:c,hourCycle:u,endContent:n.jsxs("div",{className:"flex items-center gap-1",children:[i,w]}),onChange:y=>b(Bt(y))})}function Cn(e){if(e.mode==="time")return n.jsx(io,{...e});if(e.mode==="datetime"){const{mode:r,granularity:i="minute",hideTimeZone:o=!0,calendarWidth:l=so,disableAnimation:c=!0,classNames:u,...f}=e;return n.jsx(d.DatePicker,{...f,calendarWidth:l,classNames:{...u,popoverContent:gs("min-w-[20rem]",u?.popoverContent),calendarContent:gs("min-h-[18rem]",u?.calendarContent)},disableAnimation:c,granularity:i,hideTimeZone:o})}const{mode:t,granularity:s="day",...a}=e;return n.jsx(d.DatePicker,{...a,granularity:s})}function lo(e){const t=e?.closest('[role="dialog"]');return t?.parentElement??t??void 0}const Ie=x.forwardRef(({popoverProps:e,...t},s)=>{const a=x.useRef(null),[r,i]=x.useState(void 0),o={...e,disableDialogFocus:e?.disableDialogFocus??(r?!0:void 0),portalContainer:e?.portalContainer??r};return x.useEffect(()=>{i(lo(a.current))},[]),n.jsx("span",{ref:a,className:"contents",children:n.jsx(d.Select,{ref:s,...t,popoverProps:o})})});Ie.displayName="Select";function oo({state:e,onSubmit:t,onRemove:s,appliedCredit:a,errorMessage:r,label:i="Gift Card",placeholder:o="GC-XXXX-XXXX-XXXX",applyLabel:l="Apply",removeAriaLabel:c="Remove gift card",testId:u="veevart-redeem-code-input"}){const[f,h]=x.useState(""),g=x.useId(),[m,v]=x.useState(e);e!==m&&(v(e),e==="applied"&&h(""));const j=()=>{const y=f.trim();y&&t(y)},b=y=>{y.key==="Enter"&&(y.preventDefault(),j())};if(e==="applied"&&a)return n.jsx("div",{"data-testid":u,children:n.jsx(sa,{code:a.code,amount:a.amount,onRemove:s,removeAriaLabel:c,testId:`${u}-card`})});const w=e==="error"&&r!=null;return n.jsxs("div",{"data-testid":u,className:"flex flex-col gap-1",children:[n.jsxs("div",{className:"flex items-end gap-2",children:[n.jsx(d.Input,{"data-testid":`${u}-input`,label:i,labelPlacement:"outside",variant:"bordered",radius:"lg",classNames:{label:"text-xs text-default-500 group-data-[filled-within=true]:text-default-500 group-data-[filled-within=true]:-translate-y-[calc(100%_+_var(--heroui-font-size-small)/2_+_16px)]",inputWrapper:"border-small"},placeholder:o,value:f,onValueChange:h,onKeyDown:b,isDisabled:e==="loading",isInvalid:e==="error","aria-describedby":w?g:void 0}),n.jsx(R,{testId:`${u}-button`,isLoading:e==="loading",isDisabled:!f.trim(),onPress:j,children:l})]}),w&&n.jsx("p",{id:g,"data-testid":`${u}-error`,className:"text-tiny text-danger",children:r})]})}const co={login:"Login",logout:"Logout",selectLanguage:"Select your language"};function uo({languages:e,selectedLanguage:t,onLanguageChange:s,label:a}){const r=e.find(i=>i.code===t);return n.jsx("div",{className:"flex items-center",children:n.jsxs("div",{className:"relative flex items-center",children:[n.jsx(Ie,{"data-testid":"language-select-desktop",variant:"bordered","aria-label":a,selectedKeys:t?[t]:[],onSelectionChange:i=>{const o=Array.from(i)[0]||t;s?.(o)},className:"min-w-36 hidden md:inline-flex",isDisabled:e.length===0,placeholder:a,startContent:n.jsx(K.Globe,{className:"w-5 h-5 text-black"}),renderValue:()=>n.jsx("span",{children:r?.label||a}),size:"md",radius:"full",children:e.map(i=>n.jsx(d.SelectItem,{textValue:i.label,"data-testid":`language-select-option-${i.code}`,children:i.label},i.code))}),n.jsx(Ie,{"aria-label":a,"data-testid":"language-select-mobile",variant:"bordered",selectedKeys:t?[t]:[],onSelectionChange:i=>{const o=Array.from(i)[0]||t;s?.(o)},className:"w-24 inline-flex md:hidden",isDisabled:e.length===0,placeholder:"",startContent:n.jsx(K.Globe,{className:"w-6 h-6 text-black"}),renderValue:()=>n.jsx("span",{children:r?.code.toUpperCase()||""}),size:"md",radius:"full",children:e.map(i=>n.jsx(d.SelectItem,{textValue:i.code.toUpperCase(),"data-testid":`language-select-option-mobile-${i.code}`,children:i.code.toUpperCase()},i.code))})]})})}function fo({isLoggedIn:e,onLogin:t,onLogout:s,labels:a}){return e?n.jsxs(R,{"data-testid":"navbar-auth-button",className:"px-2 py-1 w-1 min-w-12 md:min-w-24 rounded-full bg-black text-white text-sm flex items-center",onPress:s,size:"md",children:[n.jsx(K.User,{className:"inline w-5 h-5"}),n.jsx("span",{className:"hidden md:inline",children:a.logout})]}):n.jsxs(R,{"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:t,size:"md",children:[n.jsx(K.User,{className:"inline w-5 h-5"}),n.jsx("span",{className:"hidden md:inline",children:a.login})]})}function mo({logo:e,languages:t=[],selectedLanguage:s,onLanguageChange:a,isLoggedIn:r,onLogin:i,onLogout:o,hasLanguages:l,hasAuth:c,labels:u={},className:f}){const h={...co,...u};return n.jsxs("nav",{"data-testid":"navbar",className:d.cn("w-full px-4 md:px-8 py-3 bg-white border-b border-zinc-100 flex items-center justify-between",f),children:[n.jsx("div",{className:"flex items-center min-w-10",children:e&&n.jsx("a",{href:"/",className:"block",children:n.jsx("img",{"data-testid":"navbar-logo",src:e,alt:"Logo",className:"h-8 w-auto max-w-28 md:max-w-40 object-contain"})})}),n.jsxs("div",{className:"flex items-center gap-2 md:gap-4",children:[(l||t.length>0)&&n.jsx(uo,{languages:t,selectedLanguage:s,onLanguageChange:a,label:h.selectLanguage}),c&&n.jsx(fo,{isLoggedIn:r,onLogin:i,onLogout:o,labels:h})]})]})}function ho(e){return n.jsx("div",{className:"min-h-screen flex flex-col",children:n.jsx("div",{className:"flex-1 flex items-center justify-center p-12",children:n.jsx(d.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 Vt;const xo=typeof document<"u"?(Vt=x.useInsertionEffect)!==null&&Vt!==void 0?Vt:x.useLayoutEffect:()=>{};function Sn(e,t,s){let[a,r]=x.useState(e||t),i=x.useRef(a),o=x.useRef(e!==void 0),l=e!==void 0;x.useEffect(()=>{let h=o.current;h!==l&&process.env.NODE_ENV!=="production"&&console.warn(`WARN: A component changed from ${h?"controlled":"uncontrolled"} to ${l?"controlled":"uncontrolled"}.`),o.current=l},[l]);let c=l?e:a;xo(()=>{i.current=c});let[,u]=x.useReducer(()=>({}),{}),f=x.useCallback((h,...g)=>{let m=typeof h=="function"?h(i.current):h;Object.is(i.current,m)||(i.current=m,r(m),u(),s?.(m,...g))},[s]);return[c,f]}function po(e){return n.jsx("svg",{...e,fill:"none",stroke:"currentColor",strokeWidth:2,viewBox:"0 0 24 24",children:n.jsx(Ae.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 kn=x.forwardRef(({color:e="primary",variant:t="default",stepsCount:s=3,defaultStep:a=0,label:r,stepLabels:i,showStepLabelTooltip:o=!1,stepLabelTooltipPlacement:l="top",showStepCounter:c=!1,stepCounterPosition:u="right",layout:f="compact",stepCounterFormat:h,onStepChange:g,currentStep:m,hideProgressBars:v=!1,stepClassName:j,className:b,isDisabled:w=!1,...y},k)=>{const[N,S]=Sn(m,a,g),E=x.useMemo(()=>{let L,M;const $=["[--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":L="[--step-color:var(--heroui-primary)]",M="[--step-fg-color:var(--heroui-primary-foreground)]";break;case"secondary":L="[--step-color:var(--heroui-secondary)]",M="[--step-fg-color:var(--heroui-secondary-foreground)]";break;case"success":L="[--step-color:var(--heroui-success)]",M="[--step-fg-color:var(--heroui-success-foreground)]";break;case"warning":L="[--step-color:var(--heroui-warning)]",M="[--step-fg-color:var(--heroui-warning-foreground)]";break;case"danger":L="[--step-color:var(--heroui-danger)]",M="[--step-fg-color:var(--heroui-danger-foreground)]";break;case"default":L="[--step-color:var(--heroui-default)]",M="[--step-fg-color:var(--heroui-default-foreground)]";break;default:L="[--step-color:var(--heroui-primary)]",M="[--step-fg-color:var(--heroui-primary-foreground)]";break}return $.unshift(M),$.unshift(L),$},[e]);return n.jsxs("nav",{ref:k,"aria-label":"Progress",className:d.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",...y,children:[c&&u==="left"?n.jsx("span",{className:"text-default-500 text-2xl whitespace-nowrap","data-testid":"stepper-counter",children:h?h(N+1,s):`Step ${N+1} of ${s}`}):null,r&&n.jsx("label",{className:"text-small text-default-foreground lg:text-medium font-light whitespace-nowrap me-3","data-testid":"stepper-label",children:r}),n.jsx("ol",{className:d.cn("flex flex-row flex-nowrap gap-x-3",E,b),"data-testid":"stepper-list",children:Array.from({length:s})?.map((L,M)=>{const $=N===M?"active":N<M?"inactive":"complete",O=t==="activeLabel"&&$==="active"&&!!i?.[M],F=o&&$!=="active"&&!!i?.[M];return n.jsxs("li",{className:"relative flex shrink-0 items-center gap-x-3","data-testid":`stepper-step-${M}`,children:[n.jsx(d.Tooltip,{content:F?i?.[M]:void 0,isDisabled:!F,offset:12,placement:l,classNames:{base:"px-0 py-0",content:"rounded-full border border-default-200 bg-white px-4 py-2 text-small font-medium text-default-700 shadow-sm"},children:n.jsxs("button",{"aria-current":$==="active"?"step":void 0,className:d.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":O},{"cursor-not-allowed opacity-50":w},j),onClick:()=>!w&&S(M),disabled:w,"data-testid":`stepper-step-btn-${M}`,children:[n.jsx("div",{className:"h-full relative flex items-center",children:n.jsx(Ae.LazyMotion,{features:Ae.domAnimation,children:n.jsx(Ae.m.div,{animate:$,className:"relative z-10",children:n.jsx(Ae.m.div,{animate:$,className:d.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)":O,"bg-(--complete-background-color)":$==="complete","shadow-lg":$==="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:n.jsx("div",{className:"flex items-center justify-center",children:$==="complete"&&t==="default"?n.jsx(po,{className:"h-5 w-5 text-(--active-fg-color)","data-testid":`stepper-step-check-${M}`}):n.jsx("span",{children:M+1})})})})})}),O?n.jsx("span",{className:"pr-2 text-2xl leading-none font-medium whitespace-nowrap text-(--active-color)","data-testid":`stepper-step-label-${M}`,children:i[M]}):null]},M)}),M<s-1&&!v&&n.jsx("div",{"aria-hidden":"true",className:"pointer-events-none z-0 w-12 flex-none items-center",style:{"--idx":M},children:n.jsx("div",{className:d.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":M<N})})})]},M)})}),c&&u==="right"?n.jsx("span",{className:"text-default-500 text-2xl whitespace-nowrap","data-testid":"stepper-counter",children:h?h(N+1,s):`Step ${N+1} of ${s}`}):null]})});kn.displayName="Stepper";function go(e){return n.jsx("div",{className:"min-h-screen flex flex-col",children:n.jsx("div",{className:"flex-1 flex items-center justify-center p-12",children:n.jsx(d.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 we(e,t="en-US",s="USD"){try{return new Intl.NumberFormat(t,{style:"currency",currency:s}).format(e)}catch{return`${s} ${e.toFixed(2)}`}}function An(e,t="en-US"){try{const s=new Intl.NumberFormat(t,{style:"currency",currency:e}).resolvedOptions();return typeof s.maximumFractionDigits=="number"?s.maximumFractionDigits:2}catch{return 2}}function Sa(e,t,s="en-US"){const a=An(t,s),r=Math.pow(10,a);return Math.round(e*r)/r}function ln(e,t,s,a){return Sa(e-t,s,a)}function bo(){return n.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 yo=e=>{const t=x.useMemo(()=>JSON.stringify({allItems:e.allItems,selected:e.selected}),[e.allItems,e.selected]);return n.jsx(vo,{...e},t)},vo=({allItems:e,selected:t,onSelectedChange:s,titleLeft:a,titleRight:r})=>{const[i,o]=x.useState([]),[l,c]=x.useState([]),[u,f]=x.useState(null),[h,g]=x.useState(null),m=x.useMemo(()=>new Set(t),[t]),v=x.useMemo(()=>new Set(e),[e]),j=x.useMemo(()=>e.filter(F=>!m.has(F)),[e,m]),b=F=>{if(F.length===0)return;const A=Array.from(new Set([...t,...F]));s(A)},w=F=>{if(F.length===0)return;const A=new Set(F);s(t.filter(I=>!A.has(I)))},y=()=>{i.length!==0&&(b(i),o([]))},k=()=>{l.length!==0&&(w(l),c([]))},N=()=>{j.length!==0&&(b(j),o([]))},S=()=>{t.length!==0&&(s([]),c([]))},E=(F,A,I)=>{const P=Math.min(A,I),G=Math.max(A,I);return F.slice(P,G+1)},L=(F,A,I)=>{if(I&&u!==null){o(E(j,u,A)),c([]),f(A);return}const P=i.includes(F);o(P?i.filter(G=>G!==F):[...i,F]),c([]),f(A)},M=(F,A,I)=>{if(I&&h!==null){c(E(t,h,A)),o([]),g(A);return}const P=l.includes(F);c(P?l.filter(G=>G!==F):[...l,F]),o([]),g(A)},$=(F,A,I)=>{const P=I==="available"?i.includes(A)?i:[A]:l.includes(A)?l:[A];F.dataTransfer.setData("text/plain",JSON.stringify({source:I,items:P})),F.dataTransfer.effectAllowed="move"},O=(F,A)=>{F.preventDefault();const I=F.dataTransfer.getData("text/plain");if(I)try{const P=JSON.parse(I),G=(P.items||[]).filter(q=>v.has(q));if(G.length===0||P.source===A)return;A==="selected"?(b(G),o([])):(w(G),c([]))}catch{return}};return n.jsxs("div",{className:"flex flex-col gap-6 md:flex-row md:items-start md:justify-between",children:[n.jsxs("div",{className:"flex w-full flex-col gap-3 md:w-2/5",children:[n.jsx("h2",{className:"text-sm font-medium text-gray-700",children:a}),n.jsx(d.Card,{className:"w-full border border-gray-200 shadow-none",children:n.jsx(d.CardBody,{className:"h-60 gap-2 overflow-y-auto",onDragOver:F=>F.preventDefault(),onDrop:F=>O(F,"available"),children:j.map((F,A)=>{const I=i.includes(F);return n.jsx("button",{type:"button",onClick:P=>{L(F,A,P.shiftKey)},onMouseDown:P=>{P.shiftKey&&P.preventDefault()},draggable:!0,onDragStart:P=>$(P,F,"available"),className:`rounded-md px-3 py-2 text-left text-sm transition ${I?"bg-[#E4571E]/10 text-[#E4571E]":"text-gray-700 hover:bg-gray-100"}`,children:F},F)})})})]}),n.jsxs("div",{className:"flex flex-row items-center justify-center gap-3 md:flex-col md:pt-6",children:[n.jsx(R,{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:y,isDisabled:i.length===0,"aria-label":"Move selected to right",children:"›"}),n.jsx(R,{variant:"light",className:"h-10 w-10 min-w-0 text-2xl font-semibold text-[#E4571E] hover:bg-[#E4571E]/10",isIconOnly:!0,"data-testid":"move-selected-to-available",onPress:k,isDisabled:l.length===0,"aria-label":"Move selected to left",children:"‹"}),n.jsx(R,{variant:"light",className:"h-10 w-10 min-w-0 text-2xl font-semibold text-[#E4571E] hover:bg-[#E4571E]/10",isIconOnly:!0,"data-testid":"move-all-to-selected",onPress:N,isDisabled:j.length===0,"aria-label":"Move all to right",children:"»"}),n.jsx(R,{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:t.length===0,"aria-label":"Move all to left",children:"«"})]}),n.jsxs("div",{className:"flex w-full flex-col gap-3 md:w-2/5",children:[n.jsx("h2",{className:"text-sm font-medium text-gray-700",children:r}),n.jsx(d.Card,{className:"w-full border border-gray-200 shadow-none",children:n.jsx(d.CardBody,{className:"h-60 gap-2 overflow-y-auto",onDragOver:F=>F.preventDefault(),onDrop:F=>O(F,"selected"),children:t.map((F,A)=>{const I=l.includes(F);return n.jsx("button",{type:"button",onClick:P=>{M(F,A,P.shiftKey)},onMouseDown:P=>{P.shiftKey&&P.preventDefault()},draggable:!0,onDragStart:P=>$(P,F,"selected"),className:`rounded-md px-3 py-2 text-left text-sm transition ${I?"bg-[#E4571E]/10 text-[#E4571E]":"text-gray-700 hover:bg-gray-100"}`,children:F},F)})})})]})]})};function ut(e){return typeof e=="string"?e:e.type}function He({className:e}){return n.jsx("div",{className:`flex items-center h-6 ${e||""}`,children:n.jsx(d.Divider,{orientation:"vertical"})})}function qe({icon:e,label:t,isActive:s=!1,isDisabled:a=!1,onClick:r,shortcut:i,iconSize:o=16,className:l}){const c=i?`${t} (${i})`:t;return n.jsx(d.Tooltip,{content:c,placement:"top",offset:10,children:n.jsx(R,{size:"sm",radius:"sm",color:s?"primary":"default",variant:s?"solid":"bordered",isIconOnly:!0,isDisabled:a,onPress:r,"aria-label":t,className:l,children:n.jsx(e,{size:o})})})}const Me={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:t})=>{const s=t?.type==="textColor"?t.color:"";s?e.chain().focus().setColor(s).run():e.chain().focus().unsetColor().run()},canExecute:()=>!0,isActive:e=>e.isActive("textStyle"),label:"Text color"},highlight:{execute:({editor:e,config:t})=>{const s=t?.type==="highlight"?t.color:"";s?e.chain().focus().setHighlight({color:s}).run():e.chain().focus().unsetHighlight().run()},canExecute:()=>!0,isActive:e=>e.isActive("highlight"),label:"Highlight"},link:{execute:({editor:e,config:t})=>{const s=t?.type==="link"?t.href:"";if(s){const a=t?.type==="link"?t.target:void 0,r=t?.type==="link"?t.rel:void 0;e.chain().focus().setLink({href:s,target:a,rel:r}).run()}else e.chain().focus().unsetLink().run()},canExecute:()=>!0,isActive:e=>e.isActive("link"),shortcut:"Mod-k",label:"Link"},paragraph:{execute:({editor:e})=>e.chain().focus().setParagraph().run(),canExecute:e=>e.can().chain().focus().setParagraph().run(),isActive:e=>e.isActive("paragraph"),shortcut:"Mod-Alt-0",label:"Paragraph"},heading:{execute:({editor:e,config:t})=>{const s=t?.type==="heading"?t.level:1;e.chain().focus().toggleHeading({level:s}).run()},canExecute:(e,t)=>{const s=t?.type==="heading"?t.level:1;return e.can().chain().focus().toggleHeading({level:s}).run()},isActive:(e,t)=>t?.type==="heading"?e.isActive("heading",{level:t.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:t})=>{const s=t?.type==="textAlign"?t.alignment:"left";e.chain().focus().setTextAlign(s).run()},canExecute:()=>!0,isActive:(e,t)=>t?.type==="textAlign"?e.isActive({textAlign:t.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"}},jo={1:"Heading 1",2:"Heading 2",3:"Heading 3",4:"Heading 4",5:"Heading 5",6:"Heading 6"};function wo({editor:e,levels:t=[1,2,3,4,5,6],isDisabled:s=!1}){const[,a]=x.useState(0);x.useEffect(()=>{const o=()=>a(l=>l+1);return e.on("selectionUpdate",o),e.on("transaction",o),()=>{e.off("selectionUpdate",o),e.off("transaction",o)}},[e]);const r=t.find(o=>e.isActive("heading",{level:o})),i=o=>{const l=Number(o),c=Me.heading;c&&c.execute({editor:e,config:{type:"heading",level:l}})};return n.jsxs(d.Dropdown,{placement:"top-start",offset:10,children:[n.jsx(d.DropdownTrigger,{children:n.jsx(R,{size:"sm",radius:"sm",variant:r?"solid":"bordered",color:r?"primary":"default",isDisabled:s,startContent:n.jsx(K.Heading,{size:16}),"aria-label":"Select heading level",children:r?`H${r}`:"H"})}),n.jsx(d.DropdownMenu,{"aria-label":"Heading levels",selectionMode:"single",selectedKeys:r?new Set([String(r)]):new Set,onAction:i,children:t.map(o=>n.jsx(d.DropdownItem,{startContent:e.isActive("heading",{level:o})?n.jsx(K.Check,{size:16}):n.jsx("div",{className:"w-4"}),children:jo[o]},o))})]})}const Ut={bulletList:{label:"Bullet List",icon:K.List},orderedList:{label:"Numbered List",icon:K.ListOrdered},taskList:{label:"Task List",icon:K.ListTodo}};function No({editor:e,types:t=["bulletList","orderedList","taskList"],isDisabled:s=!1}){const[,a]=x.useState(0);x.useEffect(()=>{const l=()=>a(c=>c+1);return e.on("selectionUpdate",l),e.on("transaction",l),()=>{e.off("selectionUpdate",l),e.off("transaction",l)}},[e]);const r=t.find(l=>e.isActive(l)),i=r?Ut[r].icon:K.List,o=l=>{const u=Me[l];u&&u.execute({editor:e})};return n.jsxs(d.Dropdown,{placement:"top-start",offset:10,children:[n.jsx(d.DropdownTrigger,{children:n.jsx(R,{size:"sm",radius:"sm",variant:r?"solid":"bordered",color:r?"primary":"default",isDisabled:s,isIconOnly:!0,"aria-label":"Select list type",children:n.jsx(i,{size:16})})}),n.jsx(d.DropdownMenu,{"aria-label":"List types",selectionMode:"single",selectedKeys:r?new Set([r]):new Set,onAction:o,children:t.map(l=>{const c=Ut[l].icon;return n.jsx(d.DropdownItem,{startContent:n.jsx(c,{size:16}),children:Ut[l].label},l)})})]})}function Co({colors:e,selectedColor:t,onColorSelect:s,columns:a=4}){return n.jsx("div",{className:"grid gap-2",style:{gridTemplateColumns:`repeat(${a}, minmax(0, 1fr))`},children:e.map(r=>{const i=t===r;return n.jsx("button",{type:"button",onClick:()=>s(r),className:`
|
|
8
8
|
w-8 h-8 rounded-full border-2 cursor-pointer
|
|
9
9
|
transition-all duration-200
|
|
10
10
|
hover:scale-110 hover:shadow-md
|
|
11
11
|
focus:outline-none focus:ring-2 focus:ring-primary focus:ring-offset-2
|
|
12
12
|
${i?"border-primary ring-2 ring-primary ring-offset-2 scale-110":"border-divider"}
|
|
13
|
-
`,style:{backgroundColor:r},"aria-label":`Select color ${r}`,title:r},r)})})}const
|
|
13
|
+
`,style:{backgroundColor:r},"aria-label":`Select color ${r}`,title:r},r)})})}const So=["#000000","#374151","#6B7280","#EF4444","#F59E0B","#10B981","#3B82F6","#8B5CF6","#EC4899","#14B8A6","#F97316","#A855F7"],ko=["#FEF3C7","#DBEAFE","#D1FAE5","#FCE7F3","#E0E7FF","#FED7AA","#F3E8FF","#CCFBF1","#FEE2E2","#E5E7EB","#FAE8FF","#BFDBFE"];function Ht(e){return/^#([0-9A-F]{3}){1,2}$/i.test(e)}const pe={min:50,max:200,step:10,default:100},bs={lineHeight:24,toolbarHeight:60},Ao={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},$o={left:K.AlignLeft,center:K.AlignCenter,right:K.AlignRight,justify:K.AlignJustify};function Qe(e){return Ao[e]}function Do({value:e,onChange:t,onApply:s,placeholder:a="#000000"}){const[r,i]=x.useState(""),o=u=>{const f=u.target.value;t(f),r&&i("")},l=()=>{if(!e){i("Please enter a color");return}if(!Ht(e)){i("Invalid hex color (e.g., #FF0000)");return}i(""),s(e)},c=u=>{u.key==="Enter"&&(u.preventDefault(),l())};return n.jsxs("div",{className:"space-y-2",children:[n.jsxs("div",{className:"flex gap-2",children:[n.jsx(d.Input,{type:"text",value:e,onChange:o,onKeyDown:c,placeholder:a,size:"sm",variant:"bordered","aria-label":"Custom color hex code",isInvalid:!!r,errorMessage:r,startContent:n.jsx("div",{className:"w-4 h-4 rounded border border-divider",style:{backgroundColor:Ht(e)?e:"transparent"}})}),n.jsx(R,{size:"sm",color:"primary",variant:"flat",isIconOnly:!0,onPress:l,"aria-label":"Apply custom color",isDisabled:!e||!Ht(e),children:n.jsx(K.Check,{size:16})})]}),n.jsx("p",{className:"text-xs text-default-500",children:"Enter a hex color code (e.g., #FF0000)"})]})}function ys({editor:e,type:t,allowCustomColor:s=!0,label:a,isDisabled:r=!1}){const[i,o]=x.useState(!1),[l,c]=x.useState(""),u=t==="textColor"?So:ko,f=j=>{const b=Me[t];b&&b.execute({editor:e,config:{type:t,color:j}}),o(!1),c("")},h=j=>{f(j)},g=()=>{const j=Me[t];j&&j.execute({editor:e,config:{type:t,color:""}}),o(!1)},m=t==="textColor"?e.isActive("textStyle"):e.isActive("highlight"),v=t==="textColor"?K.Palette:K.Highlighter;return n.jsxs(d.Popover,{isOpen:i,onOpenChange:o,placement:"top",offset:10,showArrow:!0,children:[n.jsx(d.PopoverTrigger,{children:n.jsx(R,{size:"sm",radius:"sm",variant:m?"solid":"bordered",color:m?"primary":"default",isIconOnly:!0,isDisabled:r,"aria-label":a,children:n.jsx(v,{size:16})})}),n.jsx(d.PopoverContent,{className:"w-64",children:n.jsxs("div",{className:"px-2 py-3 space-y-3",children:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsx("span",{className:"text-sm font-semibold",children:a}),n.jsx(R,{size:"sm",variant:"light",isIconOnly:!0,onPress:g,"aria-label":"Clear color",children:n.jsx(K.X,{size:16})})]}),n.jsx(Co,{colors:u,onColorSelect:f}),s&&n.jsxs(n.Fragment,{children:[n.jsx(d.Divider,{}),n.jsxs("div",{children:[n.jsx("p",{className:"text-xs font-semibold mb-2 text-default-700",children:"Custom Color"}),n.jsx(Do,{value:l,onChange:c,onApply:h})]})]})]})})]})}function Eo({zoom:e,onZoomChange:t,min:s=pe.min,max:a=pe.max,step:r=pe.step}){const i=()=>{const h=Math.max(s,e-r);t(h)},o=()=>{const h=Math.min(a,e+r);t(h)},l=()=>{t(pe.default)},c=e<=s,u=e>=a,f=e===pe.default;return n.jsxs("div",{className:"flex items-center gap-1",children:[n.jsx(d.Tooltip,{content:"Zoom out",placement:"top",offset:10,children:n.jsx(R,{size:"sm",radius:"sm",color:"default",variant:"bordered",isIconOnly:!0,isDisabled:c,onPress:i,"aria-label":"Zoom out",children:n.jsx(K.ZoomOut,{size:16})})}),n.jsx(d.Tooltip,{content:f?"Zoom percentage":"Click to reset zoom",placement:"top",offset:10,children:n.jsxs("button",{type:"button",onClick:l,disabled:f,className:`
|
|
14
14
|
text-xs text-default-500 min-w-[3ch] text-center px-2
|
|
15
15
|
${f?"cursor-default":"cursor-pointer hover:text-primary"}
|
|
16
|
-
`,"aria-label":`Zoom level ${e}%`,children:[e,"%"]})}),n.jsx(d.Tooltip,{content:"Zoom in",placement:"top",offset:10,children:n.jsx(R,{size:"sm",radius:"sm",color:"default",variant:"bordered",isIconOnly:!0,isDisabled:u,onPress:o,"aria-label":"Zoom in",children:n.jsx(K.ZoomIn,{size:16})})})]})}function Do({editor:e,isDisabled:t=!1}){const[s,a]=x.useState(!1),[r,i]=x.useState(""),[o,l]=x.useState(""),[c,u]=x.useState(!1),f=e.isActive("link"),h=m=>{if(m){const{from:v,to:j}=e.state.selection,b=e.isActive("link");let w="";if(b){const k=e.schema.marks.link,N=e.state.doc.resolve(v),S=Zn.getMarkRange(N,k);S&&(w=e.state.doc.textBetween(S.from,S.to,""))}else w=e.state.doc.textBetween(v,j,"");const y=e.getAttributes("link").href||"";i(w),l(y),u(b)}a(m)},g=()=>{if(o.trim()){const{from:m,to:v}=e.state.selection,j=e.schema.marks.link,b=e.state.doc.resolve(m),w=Zn.getMarkRange(b,j),y=w?.from??m,k=w?.to??v,N=e.state.doc.textBetween(y,k,"");r.trim()&&r!==N?e.chain().focus().setTextSelection({from:y,to:k}).deleteSelection().insertContent(`<a href="${o.trim()}">${r.trim()}</a>`).run():e.chain().focus().extendMarkRange("link").updateAttributes("link",{href:o.trim()}).run()}a(!1)};return n.jsxs(d.Popover,{isOpen:s,onOpenChange:h,placement:"bottom",children:[n.jsx(d.PopoverTrigger,{children:n.jsx(R,{size:"sm",radius:"sm",variant:f?"solid":"bordered",color:f?"primary":"default",isIconOnly:!0,isDisabled:t,"aria-label":"Link",children:n.jsx(K.Link,{size:16})})}),n.jsx(d.PopoverContent,{children:n.jsxs("div",{className:"flex flex-col gap-3 p-3 w-72",children:[n.jsx(d.Input,{size:"sm",variant:"bordered",label:"Name",labelPlacement:"outside",placeholder:"Link text",value:r,onChange:m=>i(m.target.value),classNames:{inputWrapper:"focus-within:border-default-400"}}),n.jsx(d.Input,{size:"sm",variant:"bordered",label:"Link",labelPlacement:"outside",placeholder:"https://example.com",value:o,onChange:m=>l(m.target.value),onKeyDown:m=>m.key==="Enter"&&g(),classNames:{inputWrapper:"focus-within:border-default-400"}}),n.jsx(R,{size:"sm",color:"primary",onPress:g,isDisabled:!o.trim(),children:c?"Update":"Apply"})]})})]})}function Eo({children:e,id:t,label:s,className:a,useButtonGroup:r=!0}){return r?n.jsx(d.ButtonGroup,{size:"sm",id:t,"aria-label":s,className:a,children:e}):n.jsx("div",{id:t,role:"group","aria-label":s,className:`flex items-center gap-2 ${a||""}`,children:e})}function Ca(e,t){const s=x.useMemo(()=>{if(!e)return{};const i={};return Array.from(new Set(t.map(l=>ut(l)))).forEach(l=>{const c=Me[l];if(c)try{const u=c.canExecute?.(e)??!0,f=c.isActive?.(e)??!1;i[l]={isActive:f,isDisabled:!u,canExecute:u}}catch(u){console.warn(`Extension not available for modifier: ${l}`,u),i[l]={isActive:!1,isDisabled:!0,canExecute:!1}}}),i},[e,t]),[a,r]=x.useState(s);return x.useEffect(()=>{if(!e)return;const i=()=>{const o={};Array.from(new Set(t.map(c=>ut(c)))).forEach(c=>{const u=Me[c];if(u)try{const f=u.canExecute?.(e)??!0,h=u.isActive?.(e)??!1;o[c]={isActive:h,isDisabled:!f,canExecute:f}}catch(f){console.warn(`Extension not available for modifier: ${c}`,f),o[c]={isActive:!1,isDisabled:!0,canExecute:!1}}}),r(o)};return e.on("selectionUpdate",i),e.on("transaction",i),()=>{e.off("selectionUpdate",i),e.off("transaction",i)}},[e,t,s]),a}function Sa(e,t){const s=x.useCallback((o,l)=>{if(!e)return;const c=Me[o];if(c)try{c.execute({editor:e,config:l}),t?.({type:"toggle",modifier:o})}catch(u){console.warn(`Failed to execute command for modifier: ${o}`,u)}},[e,t]),a=x.useCallback(o=>{s(o)},[s]),r=x.useCallback((o,l)=>{if(!e)return!1;const c=Me[o];try{return c?.canExecute?.(e,l)??!1}catch(u){return console.warn(`Failed to check canExecute for modifier: ${o}`,u),!1}},[e]),i=x.useCallback((o,l)=>{if(!e)return!1;const c=Me[o];try{return c?.isActive?.(e,l)??!1}catch(u){return console.warn(`Failed to check isActive for modifier: ${o}`,u),!1}},[e]);return{executeCommand:s,toggleModifier:a,canExecute:r,isActive:i}}function Fo(e=pe.default){const[t,s]=x.useState(e),a=x.useCallback((l=pe.step)=>{s(c=>Math.min(pe.max,c+l))},[]),r=x.useCallback((l=pe.step)=>{s(c=>Math.max(pe.min,c-l))},[]),i=x.useCallback(()=>{s(pe.default)},[]),o=x.useCallback(l=>{const c=Math.max(pe.min,Math.min(pe.max,l));s(c)},[]);return{zoom:t,setZoom:o,zoomIn:a,zoomOut:r,resetZoom:i,isMinZoom:t<=pe.min,isMaxZoom:t>=pe.max,isDefaultZoom:t===pe.default}}const Lo=["bold","italic","strike","underline","code"];function Mo({editor:e,modifiers:t,onToolbarAction:s}){const a=Ca(e,t),{toggleModifier:r}=Sa(e,s);if(!e)return null;const i=t.map(o=>ut(o)).filter(o=>Lo.includes(o));return i.length===0?null:n.jsx(Eo,{id:"text-formatting",label:"Text formatting",children:i.map(o=>{const l=a[o],c=Qe(o);return n.jsx(qe,{icon:c,label:o.charAt(0).toUpperCase()+o.slice(1),isActive:l?.isActive,isDisabled:l?.isDisabled,onClick:()=>r(o)},o)})})}function Io({editor:e,modifiers:t,zoom:s=100,onZoomChange:a,sticky:r=!0,className:i,onToolbarAction:o}){const l=Ca(e,t),{toggleModifier:c,executeCommand:u}=Sa(e,o);if(!e)return null;const f=t.map(L=>ut(L)),h=f.some(L=>["bold","italic","strike","underline","code"].includes(L)),g=f.some(L=>["textColor","highlight"].includes(L)),m=f.includes("heading"),v=f.includes("textAlign"),j=f.some(L=>["bulletList","orderedList","taskList"].includes(L)),b=f.includes("blockquote"),w=f.includes("codeBlock"),y=f.includes("link"),k=f.includes("horizontalRule"),N=f.some(L=>["undo","redo"].includes(L)),S=s!==void 0&&a!==void 0,E=r?"sticky top-0 z-10":"";return n.jsx("div",{className:`w-full p-2 bg-background border-b border-divider ${E} ${i||""}`,children:n.jsxs("div",{className:"flex flex-row flex-wrap gap-2 w-full items-center",children:[h&&n.jsxs(n.Fragment,{children:[n.jsx(Mo,{editor:e,modifiers:t,onToolbarAction:o}),(g||m||v||j||b||w||y||k||N||S)&&n.jsx(He,{})]}),g&&n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"flex items-center gap-1",children:[f.includes("textColor")&&n.jsx(gs,{editor:e,type:"textColor",label:"Text color",isDisabled:l.textColor?.isDisabled}),f.includes("highlight")&&n.jsx(gs,{editor:e,type:"highlight",label:"Highlight",isDisabled:l.highlight?.isDisabled})]}),(m||v||j||b||w||y||k||N||S)&&n.jsx(He,{})]}),m&&n.jsxs(n.Fragment,{children:[n.jsx(vo,{editor:e}),(v||j||b||w||y||k||N||S)&&n.jsx(He,{})]}),v&&n.jsxs(n.Fragment,{children:[n.jsx("div",{className:"flex items-center gap-1",children:["left","center","right","justify"].map(L=>{const M=ko[L],$=e.isActive({textAlign:L});return n.jsx(qe,{icon:M,label:`Align ${L}`,isActive:$,onClick:()=>u("textAlign",{type:"textAlign",alignment:L})},L)})}),(j||b||w||y||k||N||S)&&n.jsx(He,{})]}),j&&n.jsxs(n.Fragment,{children:[n.jsx(jo,{editor:e,types:f.filter(L=>["bulletList","orderedList","taskList"].includes(L))}),(b||w||y||k||N||S)&&n.jsx(He,{})]}),(b||w||y||k)&&n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"flex items-center gap-1",children:[b&&n.jsx(qe,{icon:Qe("blockquote"),label:"Blockquote",isActive:l.blockquote?.isActive,isDisabled:l.blockquote?.isDisabled,onClick:()=>c("blockquote")}),w&&n.jsx(qe,{icon:Qe("codeBlock"),label:"Code block",isActive:l.codeBlock?.isActive,isDisabled:l.codeBlock?.isDisabled,onClick:()=>c("codeBlock")}),y&&n.jsx(Do,{editor:e,isDisabled:l.link?.isDisabled}),k&&n.jsx(qe,{icon:Qe("horizontalRule"),label:"Horizontal rule",onClick:()=>c("horizontalRule")})]}),(N||S)&&n.jsx(He,{})]}),N&&n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"flex items-center gap-1",children:[f.includes("undo")&&n.jsx(qe,{icon:Qe("undo"),label:"Undo",isDisabled:l.undo?.isDisabled,onClick:()=>c("undo")}),f.includes("redo")&&n.jsx(qe,{icon:Qe("redo"),label:"Redo",isDisabled:l.redo?.isDisabled,onClick:()=>c("redo")})]}),S&&n.jsx(He,{})]}),S&&n.jsx($o,{zoom:s,onZoomChange:L=>{a?.(L),o?.({type:"zoom",modifier:`${L}%`})}})]})})}const st={bold:{category:"mark",extension:li.Bold,priority:100},italic:{category:"mark",extension:oi.Italic,priority:100},strike:{category:"mark",extension:ci.Strike,priority:100},underline:{category:"mark",extension:di.Underline,priority:100},code:{category:"mark",extension:ui.Code,priority:100},textColor:{category:"mark",extension:fi.Color,defaultOptions:{types:["textStyle","heading","paragraph","listItem","taskItem","blockquote"]},priority:90},highlight:{category:"mark",extension:mi.Highlight,defaultOptions:{multicolor:!0},priority:90},link:{category:"mark",extension:hi.Link,defaultOptions:{autolink:!0,linkOnPaste:!0,openOnClick:!1,HTMLAttributes:{class:"text-primary underline cursor-pointer"}},priority:100},heading:{category:"node",extension:pi.Heading,defaultOptions:{levels:[1,2,3,4,5,6]},priority:100},bulletList:{category:"node",extension:bi.BulletList,defaultOptions:{HTMLAttributes:{class:"list-disc"}},priority:90},orderedList:{category:"node",extension:yi.OrderedList,defaultOptions:{HTMLAttributes:{class:"list-decimal"}},priority:90},taskList:{category:"node",extension:vi.TaskList,defaultOptions:{HTMLAttributes:{class:"task-list"}},priority:90},codeBlock:{category:"node",extension:Ni.CodeBlock,priority:100},blockquote:{category:"node",extension:Ci.Blockquote,priority:100},horizontalRule:{category:"node",extension:Si.HorizontalRule,priority:100},hardBreak:{category:"node",extension:ki.HardBreak,priority:100},undo:{category:"extension",extension:Xn.History,priority:50},redo:{category:"extension",extension:Xn.History,priority:50},textAlign:{category:"extension",extension:Ai.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}},To=[$i.Document,Di.Text,gi.Paragraph,xi.TextStyle.configure({HTMLAttributes:{}}),wi.ListItem.configure({HTMLAttributes:{}}),ji.TaskItem.configure({nested:!0}),Ei.Dropcursor,Fi.Gapcursor];function Po(e){const t=[],s=new Set,a=new Set;To.forEach(l=>{l&&(t.push(l),a.add(l.name))});const r=e.map(l=>ut(l)),i=new Set;return r.forEach(l=>{const c=st[l];c?.requiredExtensions&&c.requiredExtensions.forEach(u=>{i.add(u)})}),i.forEach(l=>{if(s.has(l))return;const c=st[l];if(!c||c.extension===null)return;const u=c.extension.name;if(a.has(u)){s.add(l);return}const f=c.defaultOptions?c.extension.configure(c.defaultOptions):c.extension;t.push(f),s.add(l),a.add(u)}),r.forEach(l=>{if(s.has(l))return;const c=st[l];if(!c){console.warn(`Extension config not found for modifier: ${l}`);return}if(c.extension===null){s.add(l);return}const u=c.extension.name;if(a.has(u)){s.add(l);return}const f=c.defaultOptions?c.extension.configure(c.defaultOptions):c.extension;t.push(f),s.add(l),a.add(u)}),t.sort((l,c)=>{const u=Object.values(st).find(m=>m?.extension?.name===l.name),f=Object.values(st).find(m=>m?.extension?.name===c.name),h=u?.priority??100;return(f?.priority??100)-h})}const ka={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"]},_o={h1:`font-size: ${ce.fontSize["4xl"]}; font-weight: ${ce.fontWeight.semibold}; line-height: ${ce.lineHeight.tight}; margin: ${le.md} 0 ${le.sm} 0;`,h2:`font-size: ${ce.fontSize["2xl"]}; font-weight: ${ce.fontWeight.semibold}; line-height: ${ce.lineHeight.tight}; margin: ${le.md} 0 ${le.sm} 0;`,h3:`font-size: ${ce.fontSize.xl}; font-weight: ${ce.fontWeight.semibold}; line-height: ${ce.lineHeight.tight}; margin: ${le.md} 0 ${le.sm} 0;`,h4:`font-size: ${ce.fontSize.lg}; font-weight: ${ce.fontWeight.semibold}; line-height: ${ce.lineHeight.tight}; margin: ${le.md} 0 ${le.sm} 0;`,h5:`font-size: ${ce.fontSize.base}; font-weight: ${ce.fontWeight.semibold}; line-height: ${ce.lineHeight.tight}; margin: ${le.md} 0 ${le.sm} 0;`,h6:`font-size: ${ce.fontSize.sm}; font-weight: ${ce.fontWeight.semibold}; line-height: ${ce.lineHeight.tight}; margin: ${le.md} 0 ${le.sm} 0;`,p:`min-height: ${ce.lineHeight.normal}em; margin: 0;`,ul:`list-style-type: disc; list-style-position: outside; padding-left: ${le.xl}; margin: ${le.md} 0;`,ol:`list-style-type: decimal; list-style-position: outside; padding-left: ${le.xl}; margin: ${le.md} 0;`,li:`display: list-item; margin: ${le.xs} 0;`,strong:`font-weight: ${ce.fontWeight.bold};`,em:"font-style: italic;",s:"text-decoration: line-through;",u:"text-decoration: underline;",code:`background-color: ${ge.neutral.gray[100]}; border-radius: 0.4rem; font-size: ${ce.fontSize.sm}; padding: 0.25em 0.3em; font-family: ${ce.fontFamily.mono};`,pre:`background: ${ge.neutral.gray[800]}; border-radius: ${le.sm}; color: ${ge.neutral.gray[100]}; font-family: ${ce.fontFamily.mono}; margin: ${le.lg} 0; padding: 0.75rem ${le.md}; overflow-x: auto;`,blockquote:`border-left: 3px solid ${ge.neutral.gray[300]}; margin: ${le.lg} 0; padding-left: ${le.md}; color: ${ge.neutral.gray[500]};`,hr:`border: none; border-top: 1px solid ${ge.neutral.gray[200]}; margin: ${le.xl} 0;`,a:`color: ${ge.brand.primary.DEFAULT}; text-decoration: underline; cursor: pointer;`,mark:`background-color: ${ge.palettes.warning[200]}; border-radius: ${le.xs}; padding: 0 0.125rem;`,label:`display: flex; align-items: center; gap: ${le.sm}; cursor: pointer;`,input:"cursor: pointer; margin: 0;"},Oo={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 Ro(e){if(!e)return e;let t=e;for(const[s,a]of Object.entries(Oo)){const r=new RegExp(`(<(?:ul|li)[^>]*data-type="${s}"[^>]*)>`,"gi");t=t.replace(r,(i,o)=>i.includes('style="')?i.replace(/style="([^"]*)"/,`style="$1 ${a}"`):`${o} style="${a}">`)}for(const[s,a]of Object.entries(_o)){const r=new RegExp(`<${s}(\\s[^>]*)?>`,"gi");t=t.replace(r,i=>{if(i.includes('data-type="taskList"')||i.includes('data-type="taskItem"'))return i;if(i.includes('style="'))return i.replace(/style="([^"]*)"/,`style="$1 ${a}"`);if(i.includes("style='"))return i.replace(/style='([^']*)'/,`style='$1 ${a}'`);{const o=i.indexOf(">");return`${i.slice(0,o)} style="${a}"${i.slice(o)}`}})}return t}const zo=({modifiers:e,zoom:t,onZoomChange:s,onToolbarAction:a})=>{const{editor:r}=hn.useCurrentEditor();return n.jsx(Io,{editor:r,modifiers:e,zoom:t,onZoomChange:s,onToolbarAction:a})},Bo=({showCharacterCount:e,showWordCount:t})=>{const{editor:s}=hn.useCurrentEditor();if(!s||!e&&!t)return null;const a=s.getText(),r=a.length,i=a.split(/\s+/).filter(o=>o.length>0).length;return n.jsxs("div",{className:"flex gap-4 text-xs text-default-500 px-2 pb-1",children:[e&&n.jsxs("span",{children:[r," characters"]}),t&&n.jsxs("span",{children:[i," words"]})]})},on=x.forwardRef((e,t)=>{const{minRows:s=10,maxRows:a=30,disableAutosize:r=!1,showCharacterCount:i=!1,showWordCount:o=!1,showToolbar:l=!0,modifiers:c=ka.full,variant:u="bordered",initialContent:f,content:h,onContentChange:g,onUpdate:m,onToolbarAction:v,isReadOnly:j=!1,isDisabled:b=!1,includeInlineStyles:w=!0,...y}=e,{zoom:k,setZoom:N}=Fo(),S=ps.lineHeight,E=s*S,L=r?void 0:a*S,M=x.useMemo(()=>Po(c),[c]),{Component:$,label:O,shouldLabelBeOutside:F,getBaseProps:A,getLabelProps:I,getInputWrapperProps:P}=d.useInput({...y,variant:u,ref:t,isMultiline:!0}),G=O?n.jsx("label",{...I(),children:O}):null,q=x.useCallback(({editor:W})=>{const ee=W.getHTML(),ae=w?Ro(ee):ee,re=W.getJSON(),U=W.getText(),Z=U.length,Q=U.split(/\s+/).filter(X=>X.length>0).length,H={html:ae,json:re,text:U,characters:Z,words:Q};if(g?.(H),m?.(H),"onChange"in y&&typeof y.onChange=="function"){const X={target:{value:ae},currentTarget:{value:ae}};y.onChange(X)}},[g,m,y,w]);return n.jsxs($,{...A(),children:[F?G:null,n.jsx("div",{...P(),className:d.cn(P().className,"flex flex-col w-full p-0 gap-0 rich-text-editor"),style:{maxHeight:L?`${L+ps.toolbarHeight}px`:void 0,overflow:L?"auto":void 0},children:n.jsx(hn.EditorProvider,{editable:!j&&!b,slotBefore:l?n.jsx(zo,{modifiers:c,zoom:k,onZoomChange:N,onToolbarAction:v}):void 0,slotAfter:n.jsx(Bo,{showCharacterCount:i,showWordCount:o}),editorContainerProps:{className:"w-full flex-1 outline-none",style:{minHeight:`${E}px`,fontSize:`${k}%`,display:"flex",flexDirection:"column"}},editorProps:{attributes:{class:"focus:outline-none w-full h-full"}},extensions:M,content:h||f||e.defaultValue||"",onUpdate:q})})]})});on.displayName="TipTapEditor";const Aa=x.forwardRef((e,t)=>{const{adapter:s="tiptap",variant:a="bordered",...r}=e;return s==="tiptap"?n.jsx(on,{...r,variant:a,ref:t}):(console.warn(`Adapter "${s}" is not supported. Using TipTap.`),n.jsx(on,{...r,variant:a,ref:t}))});Aa.displayName="RichTextArea";function Vo(e,t="en-US",s="USD"){try{return new Intl.NumberFormat(t,{style:"currency",currency:s,minimumFractionDigits:0,maximumFractionDigits:2}).format(e)}catch(a){return console.warn(`Invalid currency formatting: ${a}`),`${s} ${e.toFixed(2)}`}}const bs=[{id:"100",amount:100},{id:"250",amount:250},{id:"500",amount:500},{id:"1000",amount:1e3},{id:"2000",amount:2e3}],Uo={title:"Donation Amount",customAmountPlaceholder:"Custom donation amount",customAmountAriaLabel:"Custom donation amount",addDonationButton:"Add Donation"},$a=({presetAmounts:e=bs,selectedDonation:t,defaultSelectedDonation:s=null,onChange:a,onAddDonation:r,currency:i="USD",locale:o="en-US",showCustomAmount:l=!0,minCustomAmount:c=.5,maxCustomAmount:u=1e6,labels:f,mobileColumns:h=2,desktopColumns:g=3,isDisabled:m=!1,buttonVariant:v="bordered",buttonColor:j="default",inputVariant:b="bordered",size:w="md",className:y="",showCard:k=!0})=>{const N={...Uo,...f},S=Array.isArray(e)?e:bs,E={2:"grid-cols-2",3:"grid-cols-3"},L={3:"sm:grid-cols-3",4:"sm:grid-cols-4",5:"sm:grid-cols-5",6:"sm:grid-cols-6"},M=`${E[h]} ${L[g]}`,[$,O]=Sn(t,s,a),[F,A]=x.useState(""),[I,P]=x.useState(!1),[G,q]=x.useState(0),W=x.useCallback(Z=>{if(m)return;const Q={amount:Z.amount,isCustom:!1,presetId:Z.id};O(Q),A(""),P(!1),q(H=>H+1),r?.(Q)},[m,O,r]),ee=x.useCallback(Z=>{if(m)return;if(A(Z!==void 0?String(Z):""),r){O(null);return}if(Z===void 0||isNaN(Z)){O(null);return}O({amount:Z,isCustom:!0})},[m,O,r]),ae=x.useCallback(()=>{if(m)return;const Z=F!==""?parseFloat(F):void 0;Z===void 0||isNaN(Z)||r?.({amount:Z,isCustom:!0})},[m,F,r]),re=x.useMemo(()=>({style:"currency",currency:i,currencyDisplay:"symbol"}),[i]),U=n.jsxs("div",{className:"space-y-4","data-testid":"donation-amounts-root",children:[N.title&&n.jsx("h2",{className:"text-base font-semibold","data-testid":"donation-amounts-title",children:N.title}),S.length>0&&n.jsx("div",{className:d.cn("grid gap-3",M),"data-testid":"donation-amounts-presets",children:S.map(Z=>{const Q=$!==null&&!$.isCustom&&$.presetId===Z.id;return n.jsx(R,{color:Q?"primary":j,variant:Q?"solid":v,className:"w-full",onPress:()=>W(Z),isDisabled:m,"data-testid":`donation-amounts-preset-${Z.id}`,children:Z.label||Vo(Z.amount,o,i)},Z.id)})}),l&&n.jsxs("div",{className:"flex gap-3 items-start",children:[n.jsx(d.NumberInput,{placeholder:N.customAmountPlaceholder,"aria-label":N.customAmountAriaLabel,onInput:r?()=>{O(null),P(!0)}:void 0,variant:b,radius:"full",size:w,minValue:c,maxValue:u,step:.01,formatOptions:re,value:F!==""?parseFloat(F):void 0,onValueChange:ee,isDisabled:m,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-${G}`:$?.isCustom===!1?$.presetId:"custom"),r&&n.jsx(R,{color:"primary",variant:"solid",radius:"full",size:w,className:"shrink-0",onPress:ae,isDisabled:m||!I,"data-testid":"donation-amounts-add-button",children:N.addDonationButton})]})]});return k?n.jsx(d.Card,{className:d.cn("w-full",y),"data-testid":"donation-amounts-card",children:n.jsx(d.CardBody,{children:U})}):n.jsx("div",{className:d.cn("w-full",y),"data-testid":"donation-amounts-plain",children:U})};$a.displayName="DonationAmounts";const Ho=e=>{const t=Math.max(0,e),s=Math.floor(t/60).toString().padStart(2,"0"),a=(t%60).toString().padStart(2,"0");return`${s}:${a} minutes`},qo=e=>{switch(e){case"warning":return K.Clock;case"error":return K.AlertCircle;case"success":return K.CheckCircle;default:return K.Clock}},Wo=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"}},Da=x.forwardRef(({timeLeft:e,defaultTimeLeft:t=1200,onTimeChange:s,onExpire:a,variant:r="info",color:i="primary",message:o="Your cart expires in:",showIcon:l=!0,icon:c,position:u="fixed",autoStart:f=!0,formatTime:h=Ho,className:g,...m},v)=>{const[j,b]=Sn(e!==void 0?Math.max(0,e):void 0,Math.max(0,t),s),w=x.useRef(null),y=x.useRef(!1);x.useEffect(()=>()=>{w.current&&clearInterval(w.current)},[]),x.useEffect(()=>{if(!f||j<=0){w.current&&(clearInterval(w.current),w.current=null);return}return w.current=setInterval(()=>{b(E=>E<=1?(w.current&&(clearInterval(w.current),w.current=null),y.current||(y.current=!0,a?.()),0):E-1)},1e3),()=>{w.current&&(clearInterval(w.current),w.current=null)}},[f,j,b,a]),x.useEffect(()=>{j>0&&(y.current=!1)},[j]);const k=c||qo(r),N=Wo(i),S={fixed:"fixed top-0 left-0",sticky:"sticky top-0",static:"static"};return n.jsx("div",{ref:v,role:"banner","aria-live":"polite","aria-label":`${o} ${h(j)}`,"data-testid":"expire-cart-timer",className:d.cn("w-full text-white z-50",N,S[u],g),...m,children:n.jsx("div",{className:"container mx-auto px-4 py-3 sm:py-2.5","data-testid":"expire-cart-timer-container",children:n.jsxs("div",{className:"flex items-center justify-between gap-3 sm:gap-4",children:[n.jsxs("div",{className:"flex items-center gap-3 sm:gap-2.5 flex-1 min-w-0","data-testid":"expire-cart-timer-left",children:[l&&n.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:n.jsx(k,{className:"text-primary-500 sm:text-primary-600","aria-hidden":"true",size:14,"data-testid":"expire-cart-timer-icon"})}),n.jsx("p",{className:"text-sm sm:text-base font-medium text-white","data-testid":"expire-cart-timer-message",children:o})]}),n.jsx("div",{className:"flex-shrink-0","data-testid":"expire-cart-timer-right",children:n.jsx("span",{className:"text-sm sm:text-base font-semibold text-white","aria-label":`Time remaining: ${h(j)}`,"data-testid":"expire-cart-timer-value",children:h(j)})})]})})})});Da.displayName="ExpireCartTimer";const qt=({icon:e,children:t,testId:s})=>n.jsxs("div",{className:"flex items-center gap-2 text-sm text-gray-600","data-testid":s,children:[n.jsx(V,{icon:e,width:20,className:"text-default-500"}),n.jsx("span",{children:t})]}),Yo=({classes:e="",name:t,imageUrl:s,eventDate:a,eventTime:r,location:i,description:o,showImage:l=!1,compact:c=!1,imageLoading:u="eager",showMoreButtonClassName:f,labels:h})=>{const[g,m]=x.useState(!1),[v,j]=x.useState(!1),b=x.useRef(null);return x.useEffect(()=>{const w=()=>{if(b.current){const y=b.current.scrollHeight>b.current.clientHeight;j(y)}};return w(),window.addEventListener("resize",w),()=>window.removeEventListener("resize",w)},[o]),n.jsxs(d.Card,{className:d.cn("border-0 shadow-none",e),"data-testid":"event-details-root",children:[n.jsxs(d.CardHeader,{className:d.cn("pt-2 pb-0 flex-col items-start",c?"space-y-1":"space-y-2"),"data-testid":"event-details-header",children:[l&&s&&n.jsx("div",{className:d.cn("w-full overflow-hidden rounded-xl","aspect-[3/1]"),"data-testid":"event-details-image-wrapper",children:n.jsx(d.Image,{removeWrapper:!0,loading:u,alt:`Event image for ${t}`,className:"w-full h-full object-cover object-center",src:s,"data-testid":"event-details-image"})}),n.jsx("h2",{className:d.cn("font-semibold text-gray-800",c?"text-base":"text-xl"),"data-testid":"event-details-title",children:t})]}),n.jsxs(d.CardBody,{className:d.cn("space-y-3",c?"py-1 space-y-2":"py-3"),"data-testid":"event-details-body",children:[n.jsx("h3",{className:d.cn("font-semibold text-base text-gray-700",c?"text-sm":""),"data-testid":"event-details-info-label",children:h.eventInformation}),n.jsxs("div",{className:"flex flex-wrap gap-4","data-testid":"event-details-info",children:[a&&n.jsx(qt,{icon:"solar:calendar-minimalistic-linear",testId:"event-details-date",children:a}),r&&n.jsx(qt,{icon:"solar:clock-circle-linear",testId:"event-details-time",children:r}),i&&n.jsx(qt,{icon:"solar:map-point-linear",testId:"event-details-location",children:i})]}),o&&n.jsxs("div",{className:"relative","data-testid":"event-details-description-wrapper",children:[n.jsxs("div",{className:"relative",children:[n.jsx("div",{ref:b,className:d.cn("text-sm text-gray-700 leading-relaxed transition-all",c?"text-xs":"",!g&&"line-clamp-3"),"data-testid":"event-details-description",dangerouslySetInnerHTML:{__html:o}}),!g&&v&&n.jsx("div",{className:"absolute inset-x-0 -bottom-1 h-8 bg-gradient-to-t from-white via-white/70 to-transparent pointer-events-none","data-testid":"event-details-description-fade"})]}),(v||g)&&n.jsx("div",{className:"flex justify-end mt-1",children:n.jsx(R,{onPress:()=>m(!g),variant:"light",className:d.cn("text-primary",f),size:c?"sm":"md",startContent:n.jsx(V,{icon:g?"solar:eye-closed-linear":"solar:eye-linear",width:c?16:20}),"data-testid":"event-details-toggle-description",children:g?h.showLess||"Hide":h.showMore||"Show"})})]})]})]})};function cn(e,t="en-US",s="USD"){try{return new Intl.NumberFormat(t,{style:"currency",currency:s,minimumFractionDigits:2,maximumFractionDigits:2}).format(e)}catch(a){return console.warn(`Invalid currency formatting: ${a}`),`${s} ${e.toFixed(2)}`}}function Ko(e){const t=e.replace(/[^\d.,-]/g,""),s=t.match(/,\d{1,2}$/);let a;s?a=t.replace(/\./g,"").replace(",","."):a=t.replace(/,/g,"");const r=parseFloat(a);return isNaN(r)?null:r}const Go={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"},Ke=e=>typeof e=="number"&&!isNaN(e),Nt=({offer:e,quantity:t,defaultQuantity:s=0,onQuantityChange:a,currency:r="USD",locale:i="en-US",labels:o,slots:l,isDisabled:c=!1,buttonVariant:u="bordered",buttonColor:f="default",showCard:h=!0,showDescription:g=!0,showPeopleCount:m=!0,showPrice:v=!0,priceDisplay:j,classNames:b={},"data-testid":w,selectedColor:y="default",compact:k=!1,isSoldOut:N,isMaxReached:S,isRuleBlocked:E,statusTone:L="default",statusLabel:M,disabledReason:$,disabled:O})=>{const F=x.useMemo(()=>({...Go,...o}),[o]),[A,I]=x.useState(s),P=t!==void 0?t:A,G=!!(c||O),q=k||!!e.compact,W=x.useMemo(()=>typeof N=="boolean"?N:typeof e.isSoldOut=="boolean"?e.isSoldOut:!Ke(e.totalTicketsSold)||!Ke(e.ticketsAllowed)?!1:e.totalTicketsSold>=e.ticketsAllowed,[N,e.isSoldOut,e.totalTicketsSold,e.ticketsAllowed]),ee=x.useMemo(()=>typeof S=="boolean"?S:typeof e.isMaxReached=="boolean"?e.isMaxReached:W||!Ke(e.ticketsAllowed)?!1:P>=e.ticketsAllowed-(e.totalTicketsSold??0),[S,e.isMaxReached,W,e.ticketsAllowed,e.totalTicketsSold,P]),ae=x.useMemo(()=>typeof E=="boolean"?E:typeof e.isRuleBlocked=="boolean"?e.isRuleBlocked:!1,[E,e.isRuleBlocked]),re=$||e.disabledReason,U=G||W||ae,Z=te=>{if(U||te>0&&ee)return;const me=Math.max(0,P+te);t===void 0&&I(me),a?.(e.id,me)},Q=x.useMemo(()=>{if(W)return"soldOut";if(ae)return"ruleBlocked";if(G)return"disabled"},[W,ae,G]),H=x.useMemo(()=>L||(W||ae?"danger":ee?"warning":"default"),[L,W,ae,ee]),X=x.useMemo(()=>{if(Q)return Q==="ruleBlocked"?M||re||F.ruleBlocked:Q==="soldOut"?M||re||F.soldOut:Q==="disabled"?M||re||F.disabled:M||F.maxReached},[Q,M,re,F]),J={soldOut:"danger",ruleBlocked:H,disabled:"default",maxReached:"warning"},Ce={soldOut:"offer-card-sold-out-chip",maxReached:"offer-card-max-reached-chip",ruleBlocked:"offer-card-ruleBlocked-chip",disabled:"offer-card-disabled-chip"},be=()=>l?.renderName?l.renderName(e.name,e):n.jsx("h2",{"data-testid":"offer-card-name",className:d.cn("text-base font-medium",q&&"text-sm",b.name),children:e.name}),he=()=>{if(!v)return null;const te=j?.price??e.price,me=j?.originalPrice,Fe=cn(te,i,r);if(l?.renderPrice)return l.renderPrice(te,Fe,e);if(Ke(me)&&Ke(te)&&me>te){const xe=cn(me,i,r);return n.jsxs("div",{"data-testid":"offer-card-price",className:d.cn("flex items-center gap-2 mt-1",q&&"mt-0.5",b.price),children:[n.jsxs("span",{className:"sr-only",children:["Original price ",xe,", discounted price ",Fe]}),n.jsx("span",{"aria-hidden":"true","data-testid":"offer-card-original-price",className:d.cn("text-gray-400 line-through text-sm",q&&"text-xs",b.originalPrice),children:xe}),n.jsx("span",{"aria-hidden":"true","data-testid":"offer-card-discounted-price",className:d.cn("text-primary text-base font-semibold",q&&"text-sm",b.discountedPrice),children:Fe})]})}return n.jsx("p",{"data-testid":"offer-card-price",className:d.cn("text-primary text-base mt-1",q&&"text-sm mt-0.5",b.price),children:Fe})},Be=()=>!g||!e.description?null:l?.renderDescription?l.renderDescription(e.description,e):n.jsx("p",{"data-testid":"offer-card-description",className:d.cn("mb-4 text-sm text-gray-700 leading-relaxed",q&&"mb-2 text-xs text-gray-600",b.description),children:e.description}),Te=()=>{if(!m||!Ke(e.numberOfPeople)||e.numberOfPeople<=0)return null;const te=e.numberOfPeople===1?F.person:F.people;return l?.renderPeopleCount?l.renderPeopleCount(e.numberOfPeople,te,e):n.jsxs("p",{"data-testid":"offer-card-people-count",className:d.cn("text-sm text-gray-600 flex items-center mt-2",q&&"mt-1 text-xs",b.peopleCount),children:[n.jsx(V,{icon:e.numberOfPeople<=1?"solar:user-rounded-outline":"solar:users-group-rounded-outline",width:20,className:"mr-1"}),e.numberOfPeople," ",te]})},Pe=()=>{const te=P===0||U,me=ee||U;return l?.renderQuantitySelector?l.renderQuantitySelector({quantity:P,onIncrement:()=>Z(1),onDecrement:()=>Z(-1),isDecrementDisabled:te,isIncrementDisabled:me,isDisabled:U}):n.jsxs("div",{className:d.cn("flex items-center gap-2",b.quantitySelector),children:[n.jsx(R,{"data-testid":"offer-card-decrement-button",onPress:()=>Z(-1),isDisabled:te,variant:u,color:P>0?y:f,radius:"full",isIconOnly:!0,size:q?"md":"sm","aria-label":"Decrease quantity",children:n.jsx(V,{icon:"gravity-ui:minus",width:16})}),n.jsx("span",{"data-testid":"offer-card-quantity",className:d.cn("min-w-[2rem] text-center font-medium",q&&"text-sm"),children:P}),n.jsx(R,{"data-testid":"offer-card-increment-button",onPress:()=>Z(1),isDisabled:me,variant:u,color:P>0?y:f,radius:"full",isIconOnly:!0,size:q?"md":"sm","aria-label":"Increase quantity",children:n.jsx(V,{icon:"gravity-ui:plus",width:16})})]})},_e=(te,me)=>l?.renderDisabledState?l.renderDisabledState(te,me):te==="soldOut"&&l?.renderSoldOut?l.renderSoldOut(me):te==="maxReached"&&l?.renderMaxReachedAlert?l.renderMaxReachedAlert(me):n.jsx(d.Chip,{"data-testid":Ce[te],color:J[te],variant:te==="maxReached"?"flat":"solid",className:d.cn("gap-2 px-4",te==="maxReached"?"h-8":"h-10",te==="soldOut"&&b.soldOut,te==="maxReached"&&b.maxReachedAlert,q&&"h-8"),startContent:n.jsx(V,{icon:"gravity-ui:triangle-exclamation-fill",width:14}),children:n.jsx("span",{className:"font-medium text-sm",children:me})}),Ve=n.jsxs("div",{className:d.cn("grid grid-cols-1 md:grid-cols-1 xl:grid-cols-3 lg:grid-cols-3 items-start",q?"gap-1":"gap-2"),children:[n.jsxs("div",{className:d.cn("h-full col-span-2",U||ee?"opacity-50 pointer-events-none select-none":""),children:[be(),he(),n.jsxs("div",{className:d.cn("md:col-span-1 xl:col-span-2 lg:col-span-1",q?"mb-1":"mb-2"),children:[Te(),Be()]})]}),n.jsx("div",{className:d.cn("space-x-2 pt-0 pb-2 md:p-2 h-full flex items-center justify-start md:justify-start lg:justify-end",q&&"space-x-1 pb-1 md:p-1",b.compactFooter),children:Q&&X?_e(Q,X):Pe()})]}),Ee=ee&&!W&&!ae&&!G?n.jsx(Ae.motion.div,{className:d.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:_e("maxReached",X||F.maxReached)}):null;return h?n.jsxs(d.Card,{className:d.cn("w-full",q&&b.compact,b.base),"data-testid":w||`offer-card-${e.id}`,children:[n.jsx(d.CardBody,{className:d.cn("pt-1 pb-0",q?"pb-0.5":"",b.body),children:Ve}),n.jsx(Ae.AnimatePresence,{children:Ee&&n.jsx(d.CardFooter,{className:d.cn("w-full mt-0 pt-0",q?"pt-1":"",b.footer),children:Ee})})]}):n.jsxs("div",{className:d.cn("w-full",q&&b.compact,b.base),"data-testid":w||`offer-card-${e.id}`,children:[n.jsx("div",{className:d.cn("pt-1 pb-0",q?"pb-0.5":"",b.body),children:Ve}),n.jsx(Ae.AnimatePresence,{children:Ee&&n.jsx("div",{className:d.cn("w-full mt-0 pt-0",q?"pt-1":"",b.footer),children:Ee})})]})};Nt.displayName="OfferCard";const Ea=({message:e="No offers available.",icon:t="solar:ticket-sale-outline",iconSize:s=48,showCard:a=!0,classNames:r={},renderEmpty:i})=>{if(i){const l=i();return a?n.jsx(d.Card,{"data-testid":"offer-card-empty",className:d.cn("w-full",r.base),children:n.jsx(d.CardBody,{"data-testid":"offer-card-empty-body",children:l})}):n.jsx("div",{"data-testid":"offer-card-empty",className:d.cn("w-full",r.base),children:l})}const o=n.jsxs("div",{"data-testid":"offer-card-empty-content",className:d.cn("flex flex-col items-center justify-center p-8 text-center text-gray-500",r.content),children:[n.jsx(V,{"data-testid":"offer-card-empty-icon",icon:t,width:s,className:d.cn("mb-4",r.icon)}),n.jsx("h3",{"data-testid":"offer-card-empty-message",className:d.cn("text-lg",r.message),children:e})]});return a?n.jsx(d.Card,{"data-testid":"offer-card-empty",className:d.cn("w-full",r.base),children:n.jsx(d.CardBody,{"data-testid":"offer-card-empty-body",children:o})}):n.jsx("div",{"data-testid":"offer-card-empty",className:d.cn("w-full",r.base),children:o})};Ea.displayName="OfferCardEmpty";const Qo={title:"Error Fetching Offers",description:"An error occurred while fetching offers."},Fa=({error:e,labels:t,showCard:s=!0,color:a="danger",classNames:r={}})=>{const i={...Qo,...t},o=n.jsx(d.Alert,{"data-testid":"offer-card-error-alert",color:a,title:i.title,description:e||i.description,className:r.alert});return s?n.jsx(d.Card,{"data-testid":"offer-card-error",className:d.cn("w-full",r.base),children:n.jsx(d.CardBody,{"data-testid":"offer-card-error-body",children:o})}):n.jsx("div",{"data-testid":"offer-card-error",className:d.cn("w-full",r.base),children:o})};Fa.displayName="OfferCardError";const Zo={1:"space-y-1",2:"space-y-2",3:"space-y-3",4:"space-y-4",5:"space-y-5",6:"space-y-6"},La=({quantity:e=2,gap:t=4,classNames:s={}})=>{const a=Zo[t];return n.jsx("div",{"data-testid":"offer-card-skeleton-container",className:d.cn(a,s.base),children:Array.from({length:e}).map((r,i)=>n.jsxs(d.Card,{"data-testid":`offer-card-skeleton-${i}`,className:d.cn("w-full",s.card),children:[n.jsx(d.CardHeader,{"data-testid":`offer-card-skeleton-header-${i}`,className:"flex justify-between items-start pb-0",children:n.jsxs("div",{className:"space-y-2 w-full",children:[n.jsx(d.Skeleton,{"data-testid":`offer-card-skeleton-title-${i}`,className:"w-1/3 rounded-lg",children:n.jsx("div",{className:"h-4 bg-default-200 rounded-lg"})}),n.jsx(d.Skeleton,{"data-testid":`offer-card-skeleton-subtitle-${i}`,className:"w-1/4 rounded-lg",children:n.jsx("div",{className:"h-3 bg-default-300 rounded-lg"})})]})}),n.jsx(d.CardBody,{"data-testid":`offer-card-skeleton-body-${i}`,className:"pt-2 pb-0",children:n.jsxs("div",{className:"grid grid-cols-1 xl:grid-cols-3 gap-2 items-start",children:[n.jsxs("div",{className:"xl:col-span-2 space-y-2",children:[n.jsx(d.Skeleton,{"data-testid":`offer-card-skeleton-people-${i}`,className:"w-1/4 rounded-lg",children:n.jsx("div",{className:"h-4 bg-default-300 rounded-lg"})}),n.jsx(d.Skeleton,{"data-testid":`offer-card-skeleton-description-${i}`,className:"w-3/4 rounded-lg",children:n.jsx("div",{className:"h-4 bg-default-200 rounded-lg"})})]}),n.jsx("div",{className:"flex items-start justify-end",children:n.jsxs("div",{"data-testid":`offer-card-skeleton-controls-${i}`,className:"flex items-center justify-end gap-2 w-full px-4 py-2",children:[n.jsx(d.Skeleton,{"data-testid":`offer-card-skeleton-label-${i}`,className:"w-24 h-4 rounded-md bg-default-200"}),n.jsxs("div",{className:"flex gap-2",children:[n.jsx(d.Skeleton,{"data-testid":`offer-card-skeleton-btn-dec-${i}`,className:"w-8 h-8 rounded-md bg-default-300"}),n.jsx(d.Skeleton,{"data-testid":`offer-card-skeleton-btn-qty-${i}`,className:"w-8 h-8 rounded-md bg-default-200"}),n.jsx(d.Skeleton,{"data-testid":`offer-card-skeleton-btn-inc-${i}`,className:"w-8 h-8 rounded-md bg-default-300"})]})]})})]})})]},i))})};La.displayName="OfferCardSkeleton";const Ma={hidden:{opacity:0},show:{opacity:1,transition:{staggerChildren:.15,delayChildren:.1}}},Ia={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"}}},Xo={1:"gap-1",2:"gap-2",3:"gap-3",4:"gap-4",5:"gap-5",6:"gap-6"},Ta=({offers:e=[],mapOffer:t,selection:s,defaultSelection:a={},onSelectionChange:r,onQuantityChange:i,currency:o="USD",locale:l="en-US",labels:c,slots:u,isDisabled:f=!1,buttonVariant:h="bordered",buttonColor:g="default",showCard:m=!0,animated:v=!0,gap:j=2,compact:b=!1,classNames:w={}})=>{const[y,k]=x.useState(a),N=s!==void 0?s:y,S=x.useCallback((F,A)=>{const I={...N,[F]:Math.max(0,A)};s===void 0&&k(I),r?.(I),i?.(F,I[F])},[N,s,r,i]),E=[...e].sort((F,A)=>(F.position??0)-(A.position??0)),L=F=>{const A=t?t(F):F,I=(N??{})[A.id]||0;return{offer:A,quantity:I,onQuantityChange:S,currency:o,locale:l,labels:c,slots:u,isDisabled:f,buttonVariant:h,buttonColor:g,showCard:m,compact:b}},M=Xo[j],$=d.cn("grid mx-auto pt-2",M,w.base),O=F=>{const A=L(F);return n.jsx(Nt,{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 v?n.jsx(Ae.motion.div,{"data-testid":"offer-card-list",className:$,variants:Ma,initial:"hidden",animate:"show",children:n.jsx(Ae.AnimatePresence,{children:E.map(F=>{const A=L(F);return n.jsx(Ae.motion.div,{"data-testid":`offer-card-list-item-${A.offer.id}`,className:w.cardWrapper,variants:Ia,exit:{opacity:0,y:-20},transition:{duration:.3},children:n.jsx(Nt,{offer:A.offer,quantity:A.quantity,onQuantityChange:S,currency:o,locale:l,labels:c,slots:u,isDisabled:f,buttonVariant:h,buttonColor:g,showCard:m,compact:b||A.offer.compact,classNames:w.card})},A.offer.id)})})}):n.jsx("div",{"data-testid":"offer-card-list",className:$,children:E.map(O)})};Ta.displayName="OfferCardList";var ft=e=>e.type==="checkbox",We=e=>e instanceof Date,Ne=e=>e==null;const Pa=e=>typeof e=="object";var fe=e=>!Ne(e)&&!Array.isArray(e)&&Pa(e)&&!We(e),_a=e=>fe(e)&&e.target?ft(e.target)?e.target.checked:e.target.value:e,Jo=e=>e.substring(0,e.search(/\.\d+(\.|$)/))||e,Oa=(e,t)=>e.has(Jo(t)),ec=e=>{const t=e.constructor&&e.constructor.prototype;return fe(t)&&t.hasOwnProperty("isPrototypeOf")},$n=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function de(e){if(e instanceof Date)return new Date(e);const t=typeof FileList<"u"&&e instanceof FileList;if($n&&(e instanceof Blob||t))return e;const s=Array.isArray(e);if(!s&&!(fe(e)&&ec(e)))return e;const a=s?[]:Object.create(Object.getPrototypeOf(e));for(const r in e)Object.prototype.hasOwnProperty.call(e,r)&&(a[r]=de(e[r]));return a}var Ft=e=>/^\w*$/.test(e),oe=e=>e===void 0,Dn=e=>Array.isArray(e)?e.filter(Boolean):[],En=e=>Dn(e.replace(/["|']|\]/g,"").split(/\.|\[/)),z=(e,t,s)=>{if(!t||!fe(e))return s;const a=(Ft(t)?[t]:En(t)).reduce((r,i)=>Ne(r)?r:r[i],e);return oe(a)||a===e?oe(e[t])?s:e[t]:a},Se=e=>typeof e=="boolean",je=e=>typeof e=="function",ie=(e,t,s)=>{let a=-1;const r=Ft(t)?[t]:En(t),i=r.length,o=i-1;for(;++a<i;){const l=r[a];let c=s;if(a!==o){const u=e[l];c=fe(u)||Array.isArray(u)?u:isNaN(+r[a+1])?{}:[]}if(l==="__proto__"||l==="constructor"||l==="prototype")return;e[l]=c,e=e[l]}};const Ct={BLUR:"blur",FOCUS_OUT:"focusout",CHANGE:"change"},$e={onBlur:"onBlur",onChange:"onChange",onSubmit:"onSubmit",onTouched:"onTouched",all:"all"},Le={max:"max",min:"min",maxLength:"maxLength",minLength:"minLength",pattern:"pattern",required:"required",validate:"validate"},Ra=x.createContext(null);Ra.displayName="HookFormControlContext";const Fn=()=>x.useContext(Ra);var za=(e,t,s,a=!0)=>{const r={defaultValues:t._defaultValues};for(const i in e)Object.defineProperty(r,i,{get:()=>{const o=i;return t._proxyFormState[o]!==$e.all&&(t._proxyFormState[o]=!a||$e.all),s&&(s[o]=!0),e[o]}});return r};const Ln=typeof window<"u"?x.useLayoutEffect:x.useEffect;function tc(e){const t=Fn(),{control:s=t,disabled:a,name:r,exact:i}=e||{},[o,l]=x.useState(s._formState),c=x.useRef({isDirty:!1,isLoading:!1,dirtyFields:!1,touchedFields:!1,validatingFields:!1,isValidating:!1,isValid:!1,errors:!1});return Ln(()=>s._subscribe({name:r,formState:c.current,exact:i,callback:u=>{!a&&l({...s._formState,...u})}}),[r,a,i]),x.useEffect(()=>{c.current.isValid&&s._setValid(!0)},[s]),x.useMemo(()=>za(o,s,c.current,!1),[o,s])}var ke=e=>typeof e=="string",dn=(e,t,s,a,r)=>ke(e)?(a&&t.watch.add(e),z(s,e,r)):Array.isArray(e)?e.map(i=>(a&&t.watch.add(i),z(s,i))):(a&&(t.watchAll=!0),s),un=e=>Ne(e)||!Pa(e);function De(e,t,s=new WeakSet){if(un(e)||un(t))return Object.is(e,t);if(We(e)&&We(t))return Object.is(e.getTime(),t.getTime());const a=Object.keys(e),r=Object.keys(t);if(a.length!==r.length)return!1;if(s.has(e)||s.has(t))return!0;s.add(e),s.add(t);for(const i of a){const o=e[i];if(!r.includes(i))return!1;if(i!=="ref"){const l=t[i];if(We(o)&&We(l)||fe(o)&&fe(l)||Array.isArray(o)&&Array.isArray(l)?!De(o,l,s):!Object.is(o,l))return!1}}return!0}function nc(e){const t=Fn(),{control:s=t,name:a,defaultValue:r,disabled:i,exact:o,compute:l}=e||{},c=x.useRef(r),u=x.useRef(l),f=x.useRef(void 0),h=x.useRef(s),g=x.useRef(a);u.current=l;const[m,v]=x.useState(()=>{const N=s._getWatch(a,c.current);return u.current?u.current(N):N}),j=x.useCallback(N=>{const S=dn(a,s._names,N||s._formValues,!1,c.current);return u.current?u.current(S):S},[s._formValues,s._names,a]),b=x.useCallback(N=>{if(!i){const S=dn(a,s._names,N||s._formValues,!1,c.current);if(u.current){const E=u.current(S);De(E,f.current)||(v(E),f.current=E)}else v(S)}},[s._formValues,s._names,i,a]);Ln(()=>((h.current!==s||!De(g.current,a))&&(h.current=s,g.current=a,b()),s._subscribe({name:a,formState:{values:!0},exact:o,callback:N=>{b(N.values)}})),[s,o,a,b]),x.useEffect(()=>s._removeUnmounted());const w=h.current!==s,y=g.current,k=x.useMemo(()=>{if(i)return null;const N=!w&&!De(y,a);return w||N?j():null},[i,w,a,y,j]);return k!==null?k:m}function sc(e){const t=Fn(),{name:s,disabled:a,control:r=t,shouldUnregister:i,defaultValue:o,exact:l=!0}=e,c=Oa(r._names.array,s),u=x.useMemo(()=>z(r._formValues,s,z(r._defaultValues,s,o)),[r,s,o]),f=nc({control:r,name:s,defaultValue:u,exact:l}),h=tc({control:r,name:s,exact:l}),g=x.useRef(e),m=x.useRef(void 0),v=x.useRef(r.register(s,{...e.rules,value:f,...Se(e.disabled)?{disabled:e.disabled}:{}}));g.current=e;const j=x.useMemo(()=>Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!z(h.errors,s)},isDirty:{enumerable:!0,get:()=>!!z(h.dirtyFields,s)},isTouched:{enumerable:!0,get:()=>!!z(h.touchedFields,s)},isValidating:{enumerable:!0,get:()=>!!z(h.validatingFields,s)},error:{enumerable:!0,get:()=>z(h.errors,s)}}),[h,s]),b=x.useCallback(N=>v.current.onChange({target:{value:_a(N),name:s},type:Ct.CHANGE}),[s]),w=x.useCallback(()=>v.current.onBlur({target:{value:z(r._formValues,s),name:s},type:Ct.BLUR}),[s,r._formValues]),y=x.useCallback(N=>{const S=z(r._fields,s);S&&S._f&&N&&(S._f.ref={focus:()=>je(N.focus)&&N.focus(),select:()=>je(N.select)&&N.select(),setCustomValidity:E=>je(N.setCustomValidity)&&N.setCustomValidity(E),reportValidity:()=>je(N.reportValidity)&&N.reportValidity()})},[r._fields,s]),k=x.useMemo(()=>({name:s,value:f,...Se(a)||h.disabled?{disabled:h.disabled||a}:{},onChange:b,onBlur:w,ref:y}),[s,a,h.disabled,b,w,y,f]);return x.useEffect(()=>{const N=r._options.shouldUnregister||i,S=m.current;S&&S!==s&&!c&&r.unregister(S),r.register(s,{...g.current.rules,...Se(g.current.disabled)?{disabled:g.current.disabled}:{}});const E=(L,M)=>{const $=z(r._fields,L);$&&$._f&&($._f.mount=M)};if(E(s,!0),N){const L=de(z(r._options.defaultValues,s,g.current.defaultValue));ie(r._defaultValues,s,L),oe(z(r._formValues,s))&&ie(r._formValues,s,L)}return!c&&r.register(s),m.current=s,()=>{(c?N&&!r._state.action:N)?r.unregister(s):E(s,!1)}},[s,r,c,i]),x.useEffect(()=>{r._setDisabledField({disabled:a,name:s})},[a,s,r]),x.useMemo(()=>({field:k,formState:h,fieldState:j}),[k,h,j])}const ac=x.createContext(null);ac.displayName="HookFormContext";var rc=(e,t,s,a,r)=>t?{...s[e],types:{...s[e]&&s[e].types?s[e].types:{},[a]:r||!0}}:{},lt=e=>Array.isArray(e)?e:[e],ys=()=>{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 Ba(e,t){const s={};for(const a in e)if(e.hasOwnProperty(a)){const r=e[a],i=t[a];if(r&&fe(r)&&i){const o=Ba(r,i);fe(o)&&(s[a]=o)}else e[a]&&(s[a]=i)}return s}var ve=e=>fe(e)&&!Object.keys(e).length,Mn=e=>e.type==="file",St=e=>{if(!$n)return!1;const t=e?e.ownerDocument:0;return e instanceof(t&&t.defaultView?t.defaultView.HTMLElement:HTMLElement)},Va=e=>e.type==="select-multiple",In=e=>e.type==="radio",ic=e=>In(e)||ft(e),Wt=e=>St(e)&&e.isConnected;function lc(e,t){const s=t.slice(0,-1).length;let a=0;for(;a<s;)e=oe(e)?a++:e[t[a++]];return e}function oc(e){for(const t in e)if(e.hasOwnProperty(t)&&!oe(e[t]))return!1;return!0}function ue(e,t){const s=Array.isArray(t)?t:Ft(t)?[t]:En(t),a=s.length===1?e:lc(e,s),r=s.length-1,i=s[r];return a&&delete a[i],r!==0&&(fe(a)&&ve(a)||Array.isArray(a)&&oc(a))&&ue(e,s.slice(0,-1)),e}var cc=e=>{for(const t in e)if(je(e[t]))return!0;return!1};function Ua(e){return Array.isArray(e)||fe(e)&&!cc(e)}function fn(e,t={}){for(const s in e){const a=e[s];Ua(a)?(t[s]=Array.isArray(a)?[]:{},fn(a,t[s])):oe(a)||(t[s]=!0)}return t}function Ze(e,t,s){s||(s=fn(t));for(const a in e){const r=e[a];if(Ua(r))oe(t)||un(s[a])?s[a]=fn(r,Array.isArray(r)?[]:{}):Ze(r,Ne(t)?{}:t[a],s[a]);else{const i=t[a];s[a]=!De(r,i)}}return s}const vs={value:!1,isValid:!1},js={value:!0,isValid:!0};var Ha=e=>{if(Array.isArray(e)){if(e.length>1){const t=e.filter(s=>s&&s.checked&&!s.disabled).map(s=>s.value);return{value:t,isValid:!!t.length}}return e[0].checked&&!e[0].disabled?e[0].attributes&&!oe(e[0].attributes.value)?oe(e[0].value)||e[0].value===""?js:{value:e[0].value,isValid:!0}:js:vs}return vs},qa=(e,{valueAsNumber:t,valueAsDate:s,setValueAs:a})=>oe(e)?e:t?e===""?NaN:e&&+e:s&&ke(e)?new Date(e):a?a(e):e;const ws={isValid:!1,value:null};var Wa=e=>Array.isArray(e)?e.reduce((t,s)=>s&&s.checked&&!s.disabled?{isValid:!0,value:s.value}:t,ws):ws;function Ns(e){const t=e.ref;return Mn(t)?t.files:In(t)?Wa(e.refs).value:Va(t)?[...t.selectedOptions].map(({value:s})=>s):ft(t)?Ha(e.refs).value:qa(oe(t.value)?e.ref.value:t.value,e)}var dc=(e,t,s,a)=>{const r={};for(const i of e){const o=z(t,i);o&&ie(r,i,o._f)}return{criteriaMode:s,names:[...e],fields:r,shouldUseNativeValidation:a}},kt=e=>e instanceof RegExp,at=e=>oe(e)?e:kt(e)?e.source:fe(e)?kt(e.value)?e.value.source:e.value:e,Cs=e=>({isOnSubmit:!e||e===$e.onSubmit,isOnBlur:e===$e.onBlur,isOnChange:e===$e.onChange,isOnAll:e===$e.all,isOnTouch:e===$e.onTouched});const Ss="AsyncFunction";var uc=e=>!!e&&!!e.validate&&!!(je(e.validate)&&e.validate.constructor.name===Ss||fe(e.validate)&&Object.values(e.validate).find(t=>t.constructor.name===Ss)),fc=e=>e.mount&&(e.required||e.min||e.max||e.maxLength||e.minLength||e.pattern||e.validate),ks=(e,t,s)=>!s&&(t.watchAll||t.watch.has(e)||[...t.watch].some(a=>e.startsWith(a)&&/^\.\w+/.test(e.slice(a.length))));const ot=(e,t,s,a)=>{for(const r of s||Object.keys(e)){const i=z(e,r);if(i){const{_f:o,...l}=i;if(o){if(o.refs&&o.refs[0]&&t(o.refs[0],r)&&!a)return!0;if(o.ref&&t(o.ref,o.name)&&!a)return!0;if(ot(l,t))break}else if(fe(l)&&ot(l,t))break}}};function As(e,t,s){const a=z(e,s);if(a||Ft(s))return{error:a,name:s};const r=s.split(".");for(;r.length;){const i=r.join("."),o=z(t,i),l=z(e,i);if(o&&!Array.isArray(o)&&s!==i)return{name:s};if(l&&l.type)return{name:i,error:l};if(l&&l.root&&l.root.type)return{name:`${i}.root`,error:l.root};r.pop()}return{name:s}}var mc=(e,t,s,a)=>{s(e);const{name:r,...i}=e;return ve(i)||Object.keys(i).length>=Object.keys(t).length||Object.keys(i).find(o=>t[o]===(!a||$e.all))},hc=(e,t,s)=>!e||!t||e===t||lt(e).some(a=>a&&(s?a===t:a.startsWith(t)||t.startsWith(a))),xc=(e,t,s,a,r)=>r.isOnAll?!1:!s&&r.isOnTouch?!(t||e):(s?a.isOnBlur:r.isOnBlur)?!e:(s?a.isOnChange:r.isOnChange)?e:!0,pc=(e,t)=>!Dn(z(e,t)).length&&ue(e,t),gc=(e,t,s)=>{const a=lt(z(e,s));return ie(a,"root",t[s]),ie(e,s,a),e};function $s(e,t,s="validate"){if(ke(e)||Array.isArray(e)&&e.every(ke)||Se(e)&&!e)return{type:s,message:ke(e)?e:"",ref:t}}var Ge=e=>fe(e)&&!kt(e)?e:{value:e,message:""},Ds=async(e,t,s,a,r,i)=>{const{ref:o,refs:l,required:c,maxLength:u,minLength:f,min:h,max:g,pattern:m,validate:v,name:j,valueAsNumber:b,mount:w}=e._f,y=z(s,j);if(!w||t.has(j))return{};const k=l?l[0]:o,N=A=>{r&&k.reportValidity&&(k.setCustomValidity(Se(A)?"":A||""),k.reportValidity())},S={},E=In(o),L=ft(o),M=E||L,$=(b||Mn(o))&&oe(o.value)&&oe(y)||St(o)&&o.value===""||y===""||Array.isArray(y)&&!y.length,O=rc.bind(null,j,a,S),F=(A,I,P,G=Le.maxLength,q=Le.minLength)=>{const W=A?I:P;S[j]={type:A?G:q,message:W,ref:o,...O(A?G:q,W)}};if(i?!Array.isArray(y)||!y.length:c&&(!M&&($||Ne(y))||Se(y)&&!y||L&&!Ha(l).isValid||E&&!Wa(l).isValid)){const{value:A,message:I}=ke(c)?{value:!!c,message:c}:Ge(c);if(A&&(S[j]={type:Le.required,message:I,ref:k,...O(Le.required,I)},!a))return N(I),S}if(!$&&(!Ne(h)||!Ne(g))){let A,I;const P=Ge(g),G=Ge(h);if(!Ne(y)&&!isNaN(y)){const q=o.valueAsNumber||y&&+y;Ne(P.value)||(A=q>P.value),Ne(G.value)||(I=q<G.value)}else{const q=o.valueAsDate||new Date(y),W=re=>new Date(new Date().toDateString()+" "+re),ee=o.type=="time",ae=o.type=="week";ke(P.value)&&y&&(A=ee?W(y)>W(P.value):ae?y>P.value:q>new Date(P.value)),ke(G.value)&&y&&(I=ee?W(y)<W(G.value):ae?y<G.value:q<new Date(G.value))}if((A||I)&&(F(!!A,P.message,G.message,Le.max,Le.min),!a))return N(S[j].message),S}if((u||f)&&!$&&(ke(y)||i&&Array.isArray(y))){const A=Ge(u),I=Ge(f),P=!Ne(A.value)&&y.length>+A.value,G=!Ne(I.value)&&y.length<+I.value;if((P||G)&&(F(P,A.message,I.message),!a))return N(S[j].message),S}if(m&&!$&&ke(y)){const{value:A,message:I}=Ge(m);if(kt(A)&&!y.match(A)&&(S[j]={type:Le.pattern,message:I,ref:o,...O(Le.pattern,I)},!a))return N(I),S}if(v){if(je(v)){const A=await v(y,s),I=$s(A,k);if(I&&(S[j]={...I,...O(Le.validate,I.message)},!a))return N(I.message),S}else if(fe(v)){let A={};for(const I in v){if(!ve(A)&&!a)break;const P=$s(await v[I](y,s),k,I);P&&(A={...P,...O(I,P.message)},N(P.message),a&&(S[j]=A))}if(!ve(A)&&(S[j]={ref:k,...A},!a))return S}}return N(!0),S};const bc={mode:$e.onSubmit,reValidateMode:$e.onChange,shouldFocusError:!0};function yc(e={}){let t={...bc,...e},s={submitCount:0,isDirty:!1,isReady:!1,isLoading:je(t.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{},errors:t.errors||{},disabled:t.disabled||!1},a={},r=fe(t.defaultValues)||fe(t.values)?de(t.defaultValues||t.values)||{}:{},i=t.shouldUnregister?{}:de(r),o={action:!1,mount:!1,watch:!1,keepIsValid:!1},l={mount:new Set,disabled:new Set,unMount:new Set,array:new Set,watch:new Set},c,u=0;const f={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1},h={...f};let g={...h};const m={array:ys(),state:ys()},v=t.criteriaMode===$e.all,j=p=>C=>{clearTimeout(u),u=setTimeout(p,C)},b=async p=>{if(!o.keepIsValid&&!t.disabled&&(h.isValid||g.isValid||p)){let C;t.resolver?(C=ve((await M()).errors),w()):C=await O(a,!0),C!==s.isValid&&m.state.next({isValid:C})}},w=(p,C)=>{!t.disabled&&(h.isValidating||h.validatingFields||g.isValidating||g.validatingFields)&&((p||Array.from(l.mount)).forEach(D=>{D&&(C?ie(s.validatingFields,D,C):ue(s.validatingFields,D))}),m.state.next({validatingFields:s.validatingFields,isValidating:!ve(s.validatingFields)}))},y=(p,C=[],D,B,_=!0,T=!0)=>{if(B&&D&&!t.disabled){if(o.action=!0,T&&Array.isArray(z(a,p))){const Y=D(z(a,p),B.argA,B.argB);_&&ie(a,p,Y)}if(T&&Array.isArray(z(s.errors,p))){const Y=D(z(s.errors,p),B.argA,B.argB);_&&ie(s.errors,p,Y),pc(s.errors,p)}if((h.touchedFields||g.touchedFields)&&T&&Array.isArray(z(s.touchedFields,p))){const Y=D(z(s.touchedFields,p),B.argA,B.argB);_&&ie(s.touchedFields,p,Y)}(h.dirtyFields||g.dirtyFields)&&(s.dirtyFields=Ze(r,i)),m.state.next({name:p,isDirty:A(p,C),dirtyFields:s.dirtyFields,errors:s.errors,isValid:s.isValid})}else ie(i,p,C)},k=(p,C)=>{ie(s.errors,p,C),m.state.next({errors:s.errors})},N=p=>{s.errors=p,m.state.next({errors:s.errors,isValid:!1})},S=(p,C,D,B)=>{const _=z(a,p);if(_){const T=z(i,p,oe(D)?z(r,p):D);oe(T)||B&&B.defaultChecked||C?ie(i,p,C?T:Ns(_._f)):G(p,T),o.mount&&!o.action&&b()}},E=(p,C,D,B,_)=>{let T=!1,Y=!1;const ne={name:p};if(!t.disabled){if(!D||B){(h.isDirty||g.isDirty)&&(Y=s.isDirty,s.isDirty=ne.isDirty=A(),T=Y!==ne.isDirty);const se=De(z(r,p),C);Y=!!z(s.dirtyFields,p),se?ue(s.dirtyFields,p):ie(s.dirtyFields,p,!0),ne.dirtyFields=s.dirtyFields,T=T||(h.dirtyFields||g.dirtyFields)&&Y!==!se}if(D){const se=z(s.touchedFields,p);se||(ie(s.touchedFields,p,D),ne.touchedFields=s.touchedFields,T=T||(h.touchedFields||g.touchedFields)&&se!==D)}T&&_&&m.state.next(ne)}return T?ne:{}},L=(p,C,D,B)=>{const _=z(s.errors,p),T=(h.isValid||g.isValid)&&Se(C)&&s.isValid!==C;if(t.delayError&&D?(c=j(()=>k(p,D)),c(t.delayError)):(clearTimeout(u),c=null,D?ie(s.errors,p,D):ue(s.errors,p)),(D?!De(_,D):_)||!ve(B)||T){const Y={...B,...T&&Se(C)?{isValid:C}:{},errors:s.errors,name:p};s={...s,...Y},m.state.next(Y)}},M=async p=>(w(p,!0),await t.resolver(i,t.context,dc(p||l.mount,a,t.criteriaMode,t.shouldUseNativeValidation))),$=async p=>{const{errors:C}=await M(p);if(w(p),p)for(const D of p){const B=z(C,D);B?ie(s.errors,D,B):ue(s.errors,D)}else s.errors=C;return C},O=async(p,C,D={valid:!0})=>{for(const B in p){const _=p[B];if(_){const{_f:T,...Y}=_;if(T){const ne=l.array.has(T.name),se=_._f&&uc(_._f);se&&h.validatingFields&&w([T.name],!0);const ye=await Ds(_,l.disabled,i,v,t.shouldUseNativeValidation&&!C,ne);if(se&&h.validatingFields&&w([T.name]),ye[T.name]&&(D.valid=!1,C||e.shouldUseNativeValidation))break;!C&&(z(ye,T.name)?ne?gc(s.errors,ye,T.name):ie(s.errors,T.name,ye[T.name]):ue(s.errors,T.name))}!ve(Y)&&await O(Y,C,D)}}return D.valid},F=()=>{for(const p of l.unMount){const C=z(a,p);C&&(C._f.refs?C._f.refs.every(D=>!Wt(D)):!Wt(C._f.ref))&&be(p)}l.unMount=new Set},A=(p,C)=>!t.disabled&&(p&&C&&ie(i,p,C),!De(U(),r)),I=(p,C,D)=>dn(p,l,{...o.mount?i:oe(C)?r:ke(p)?{[p]:C}:C},D,C),P=p=>Dn(z(o.mount?i:r,p,t.shouldUnregister?z(r,p,[]):[])),G=(p,C,D={})=>{const B=z(a,p);let _=C;if(B){const T=B._f;T&&(!T.disabled&&ie(i,p,qa(C,T)),_=St(T.ref)&&Ne(C)?"":C,Va(T.ref)?[...T.ref.options].forEach(Y=>Y.selected=_.includes(Y.value)):T.refs?ft(T.ref)?T.refs.forEach(Y=>{(!Y.defaultChecked||!Y.disabled)&&(Array.isArray(_)?Y.checked=!!_.find(ne=>ne===Y.value):Y.checked=_===Y.value||!!_)}):T.refs.forEach(Y=>Y.checked=Y.value===_):Mn(T.ref)?T.ref.value="":(T.ref.value=_,T.ref.type||m.state.next({name:p,values:de(i)})))}(D.shouldDirty||D.shouldTouch)&&E(p,_,D.shouldTouch,D.shouldDirty,!0),D.shouldValidate&&re(p)},q=(p,C,D)=>{for(const B in C){if(!C.hasOwnProperty(B))return;const _=C[B],T=p+"."+B,Y=z(a,T);(l.array.has(p)||fe(_)||Y&&!Y._f)&&!We(_)?q(T,_,D):G(T,_,D)}},W=(p,C,D={})=>{const B=z(a,p),_=l.array.has(p),T=de(C);ie(i,p,T),_?(m.array.next({name:p,values:de(i)}),(h.isDirty||h.dirtyFields||g.isDirty||g.dirtyFields)&&D.shouldDirty&&m.state.next({name:p,dirtyFields:Ze(r,i),isDirty:A(p,T)})):B&&!B._f&&!Ne(T)?q(p,T,D):G(p,T,D),ks(p,l)?m.state.next({...s,name:p,values:de(i)}):m.state.next({name:o.mount?p:void 0,values:de(i)})},ee=async p=>{o.mount=!0;const C=p.target;let D=C.name,B=!0;const _=z(a,D),T=se=>{B=Number.isNaN(se)||We(se)&&isNaN(se.getTime())||De(se,z(i,D,se))},Y=Cs(t.mode),ne=Cs(t.reValidateMode);if(_){let se,ye;const Ue=C.type?Ns(_._f):_a(p),Oe=p.type===Ct.BLUR||p.type===Ct.FOCUS_OUT,ai=!fc(_._f)&&!t.resolver&&!z(s.errors,D)&&!_._f.deps||xc(Oe,z(s.touchedFields,D),s.isSubmitted,ne,Y),It=ks(D,l,Oe);ie(i,D,Ue),Oe?(!C||!C.readOnly)&&(_._f.onBlur&&_._f.onBlur(p),c&&c(0)):_._f.onChange&&_._f.onChange(p);const Tt=E(D,Ue,Oe),ri=!ve(Tt)||It;if(!Oe&&m.state.next({name:D,type:p.type,values:de(i)}),ai)return(h.isValid||g.isValid)&&(t.mode==="onBlur"?Oe&&b():Oe||b()),ri&&m.state.next({name:D,...It?{}:Tt});if(!Oe&&It&&m.state.next({...s}),t.resolver){const{errors:Gn}=await M([D]);if(w([D]),T(Ue),B){const ii=As(s.errors,a,D),Qn=As(Gn,a,ii.name||D);se=Qn.error,D=Qn.name,ye=ve(Gn)}}else w([D],!0),se=(await Ds(_,l.disabled,i,v,t.shouldUseNativeValidation))[D],w([D]),T(Ue),B&&(se?ye=!1:(h.isValid||g.isValid)&&(ye=await O(a,!0)));B&&(_._f.deps&&(!Array.isArray(_._f.deps)||_._f.deps.length>0)&&re(_._f.deps),L(D,ye,se,Tt))}},ae=(p,C)=>{if(z(s.errors,C)&&p.focus)return p.focus(),1},re=async(p,C={})=>{let D,B;const _=lt(p);if(t.resolver){const T=await $(oe(p)?p:_);D=ve(T),B=p?!_.some(Y=>z(T,Y)):D}else p?(B=(await Promise.all(_.map(async T=>{const Y=z(a,T);return await O(Y&&Y._f?{[T]:Y}:Y)}))).every(Boolean),!(!B&&!s.isValid)&&b()):B=D=await O(a);return m.state.next({...!ke(p)||(h.isValid||g.isValid)&&D!==s.isValid?{}:{name:p},...t.resolver||!p?{isValid:D}:{},errors:s.errors}),C.shouldFocus&&!B&&ot(a,ae,p?_:l.mount),B},U=(p,C)=>{let D={...o.mount?i:r};return C&&(D=Ba(C.dirtyFields?s.dirtyFields:s.touchedFields,D)),oe(p)?D:ke(p)?z(D,p):p.map(B=>z(D,B))},Z=(p,C)=>({invalid:!!z((C||s).errors,p),isDirty:!!z((C||s).dirtyFields,p),error:z((C||s).errors,p),isValidating:!!z(s.validatingFields,p),isTouched:!!z((C||s).touchedFields,p)}),Q=p=>{p&<(p).forEach(C=>ue(s.errors,C)),m.state.next({errors:p?s.errors:{}})},H=(p,C,D)=>{const B=(z(a,p,{_f:{}})._f||{}).ref,_=z(s.errors,p)||{},{ref:T,message:Y,type:ne,...se}=_;ie(s.errors,p,{...se,...C,ref:B}),m.state.next({name:p,errors:s.errors,isValid:!1}),D&&D.shouldFocus&&B&&B.focus&&B.focus()},X=(p,C)=>je(p)?m.state.subscribe({next:D=>"values"in D&&p(I(void 0,C),D)}):I(p,C,!0),J=p=>m.state.subscribe({next:C=>{hc(p.name,C.name,p.exact)&&mc(C,p.formState||h,Fe,p.reRenderRoot)&&p.callback({values:{...i},...s,...C,defaultValues:r})}}).unsubscribe,Ce=p=>(o.mount=!0,g={...g,...p.formState},J({...p,formState:{...f,...p.formState}})),be=(p,C={})=>{for(const D of p?lt(p):l.mount)l.mount.delete(D),l.array.delete(D),C.keepValue||(ue(a,D),ue(i,D)),!C.keepError&&ue(s.errors,D),!C.keepDirty&&ue(s.dirtyFields,D),!C.keepTouched&&ue(s.touchedFields,D),!C.keepIsValidating&&ue(s.validatingFields,D),!t.shouldUnregister&&!C.keepDefaultValue&&ue(r,D);m.state.next({values:de(i)}),m.state.next({...s,...C.keepDirty?{isDirty:A()}:{}}),!C.keepIsValid&&b()},he=({disabled:p,name:C})=>{if(Se(p)&&o.mount||p||l.disabled.has(C)){const _=l.disabled.has(C)!==!!p;p?l.disabled.add(C):l.disabled.delete(C),_&&o.mount&&!o.action&&b()}},Be=(p,C={})=>{let D=z(a,p);const B=Se(C.disabled)||Se(t.disabled);return ie(a,p,{...D||{},_f:{...D&&D._f?D._f:{ref:{name:p}},name:p,mount:!0,...C}}),l.mount.add(p),D?he({disabled:Se(C.disabled)?C.disabled:t.disabled,name:p}):S(p,!0,C.value),{...B?{disabled:C.disabled||t.disabled}:{},...t.progressive?{required:!!C.required,min:at(C.min),max:at(C.max),minLength:at(C.minLength),maxLength:at(C.maxLength),pattern:at(C.pattern)}:{},name:p,onChange:ee,onBlur:ee,ref:_=>{if(_){Be(p,C),D=z(a,p);const T=oe(_.value)&&_.querySelectorAll&&_.querySelectorAll("input,select,textarea")[0]||_,Y=ic(T),ne=D._f.refs||[];if(Y?ne.find(se=>se===T):T===D._f.ref)return;ie(a,p,{_f:{...D._f,...Y?{refs:[...ne.filter(Wt),T,...Array.isArray(z(r,p))?[{}]:[]],ref:{type:T.type,name:p}}:{ref:T}}}),S(p,!1,void 0,T)}else D=z(a,p,{}),D._f&&(D._f.mount=!1),(t.shouldUnregister||C.shouldUnregister)&&!(Oa(l.array,p)&&o.action)&&l.unMount.add(p)}}},Te=()=>t.shouldFocusError&&ot(a,ae,l.mount),Pe=p=>{Se(p)&&(m.state.next({disabled:p}),ot(a,(C,D)=>{const B=z(a,D);B&&(C.disabled=B._f.disabled||p,Array.isArray(B._f.refs)&&B._f.refs.forEach(_=>{_.disabled=B._f.disabled||p}))},0,!1))},_e=(p,C)=>async D=>{let B;D&&(D.preventDefault&&D.preventDefault(),D.persist&&D.persist());let _=de(i);if(m.state.next({isSubmitting:!0}),t.resolver){const{errors:T,values:Y}=await M();w(),s.errors=T,_=de(Y)}else await O(a);if(l.disabled.size)for(const T of l.disabled)ue(_,T);if(ue(s.errors,"root"),ve(s.errors)){m.state.next({errors:{}});try{await p(_,D)}catch(T){B=T}}else C&&await C({...s.errors},D),Te(),setTimeout(Te);if(m.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:ve(s.errors)&&!B,submitCount:s.submitCount+1,errors:s.errors}),B)throw B},Ve=(p,C={})=>{z(a,p)&&(oe(C.defaultValue)?W(p,de(z(r,p))):(W(p,C.defaultValue),ie(r,p,de(C.defaultValue))),C.keepTouched||ue(s.touchedFields,p),C.keepDirty||(ue(s.dirtyFields,p),s.isDirty=C.defaultValue?A(p,de(z(r,p))):A()),C.keepError||(ue(s.errors,p),h.isValid&&b()),m.state.next({...s}))},Ee=(p,C={})=>{const D=p?de(p):r,B=de(D),_=ve(p),T=_?r:B;if(C.keepDefaultValues||(r=D),!C.keepValues){if(C.keepDirtyValues){const Y=new Set([...l.mount,...Object.keys(Ze(r,i))]);for(const ne of Array.from(Y)){const se=z(s.dirtyFields,ne),ye=z(i,ne),Ue=z(T,ne);se&&!oe(ye)?ie(T,ne,ye):!se&&!oe(Ue)&&W(ne,Ue)}}else{if($n&&oe(p))for(const Y of l.mount){const ne=z(a,Y);if(ne&&ne._f){const se=Array.isArray(ne._f.refs)?ne._f.refs[0]:ne._f.ref;if(St(se)){const ye=se.closest("form");if(ye){ye.reset();break}}}}if(C.keepFieldsRef)for(const Y of l.mount)W(Y,z(T,Y));else a={}}i=t.shouldUnregister?C.keepDefaultValues?de(r):{}:de(T),m.array.next({values:{...T}}),m.state.next({values:{...T}})}l={mount:C.keepDirtyValues?l.mount:new Set,unMount:new Set,array:new Set,disabled:new Set,watch:new Set,watchAll:!1,focus:""},o.mount=!h.isValid||!!C.keepIsValid||!!C.keepDirtyValues||!t.shouldUnregister&&!ve(T),o.watch=!!t.shouldUnregister,o.keepIsValid=!!C.keepIsValid,o.action=!1,C.keepErrors||(s.errors={}),m.state.next({submitCount:C.keepSubmitCount?s.submitCount:0,isDirty:_?!1:C.keepDirty?s.isDirty:!!(C.keepDefaultValues&&!De(p,r)),isSubmitted:C.keepIsSubmitted?s.isSubmitted:!1,dirtyFields:_?{}:C.keepDirtyValues?C.keepDefaultValues&&i?Ze(r,i):s.dirtyFields:C.keepDefaultValues&&p?Ze(r,p):C.keepDirty?s.dirtyFields:{},touchedFields:C.keepTouched?s.touchedFields:{},errors:C.keepErrors?s.errors:{},isSubmitSuccessful:C.keepIsSubmitSuccessful?s.isSubmitSuccessful:!1,isSubmitting:!1,defaultValues:r})},te=(p,C)=>Ee(je(p)?p(i):p,{...t.resetOptions,...C}),me=(p,C={})=>{const D=z(a,p),B=D&&D._f;if(B){const _=B.refs?B.refs[0]:B.ref;_.focus&&setTimeout(()=>{_.focus(),C.shouldSelect&&je(_.select)&&_.select()})}},Fe=p=>{s={...s,...p}},xe={control:{register:Be,unregister:be,getFieldState:Z,handleSubmit:_e,setError:H,_subscribe:J,_runSchema:M,_updateIsValidating:w,_focusError:Te,_getWatch:I,_getDirty:A,_setValid:b,_setFieldArray:y,_setDisabledField:he,_setErrors:N,_getFieldArray:P,_reset:Ee,_resetDefaultValues:()=>je(t.defaultValues)&&t.defaultValues().then(p=>{te(p,t.resetOptions),m.state.next({isLoading:!1})}),_removeUnmounted:F,_disableForm:Pe,_subjects:m,_proxyFormState:h,get _fields(){return a},get _formValues(){return i},get _state(){return o},set _state(p){o=p},get _defaultValues(){return r},get _names(){return l},set _names(p){l=p},get _formState(){return s},get _options(){return t},set _options(p){t={...t,...p}}},subscribe:Ce,trigger:re,register:Be,handleSubmit:_e,watch:X,setValue:W,getValues:U,reset:te,resetField:Ve,clearErrors:Q,unregister:be,setError:H,setFocus:me,getFieldState:Z};return{...xe,formControl:xe}}function vc(e={}){const t=x.useRef(void 0),s=x.useRef(void 0),[a,r]=x.useState({isDirty:!1,isValidating:!1,isLoading:je(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:je(e.defaultValues)?void 0:e.defaultValues});if(!t.current)if(e.formControl)t.current={...e.formControl,formState:a},e.defaultValues&&!je(e.defaultValues)&&e.formControl.reset(e.defaultValues,e.resetOptions);else{const{formControl:o,...l}=yc(e);t.current={...l,formState:a}}const i=t.current.control;return i._options=e,Ln(()=>{const o=i._subscribe({formState:i._proxyFormState,callback:()=>r({...i._formState}),reRenderRoot:!0});return r(l=>({...l,isReady:!0})),i._formState.isReady=!0,o},[i]),x.useEffect(()=>i._disableForm(e.disabled),[i,e.disabled]),x.useEffect(()=>{e.mode&&(i._options.mode=e.mode),e.reValidateMode&&(i._options.reValidateMode=e.reValidateMode)},[i,e.mode,e.reValidateMode]),x.useEffect(()=>{e.errors&&(i._setErrors(e.errors),i._focusError())},[i,e.errors]),x.useEffect(()=>{e.shouldUnregister&&i._subjects.state.next({values:i._getWatch()})},[i,e.shouldUnregister]),x.useEffect(()=>{if(i._proxyFormState.isDirty){const o=i._getDirty();o!==a.isDirty&&i._subjects.state.next({isDirty:o})}},[i,a.isDirty]),x.useEffect(()=>{var o;e.values&&!De(e.values,s.current)?(i._reset(e.values,{keepFieldsRef:!0,...i._options.resetOptions}),!((o=i._options.resetOptions)===null||o===void 0)&&o.keepIsValid||i._setValid(),s.current=e.values,r(l=>({...l}))):i._resetDefaultValues()},[i,e.values]),x.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()}),t.current.formState=x.useMemo(()=>za(a,i),[i,a]),t.current}function jc(e,t=3){return e%1===0?e.toString():e.toFixed(t).replace(/\.?0+$/,"")}function wc(e,t="en-US",s="USD"){try{return new Intl.NumberFormat(t,{style:"currency",currency:s,minimumFractionDigits:2,maximumFractionDigits:2}).format(e)}catch(a){return console.warn(`Invalid currency formatting: ${a}`),`${s} ${e.toFixed(2)}`}}function Nc(e="USD",t="en-US"){try{return new Intl.NumberFormat(t,{style:"currency",currency:e}).formatToParts(0).find(i=>i.type==="currency")?.value??"$"}catch{return"$"}}function Cc(e){const t=e.replace(/[^\d.,-]/g,""),s=t.match(/,\d{1,2}$/);let a;s?a=t.replace(/\./g,"").replace(",","."):a=t.replace(/,/g,"");const r=parseFloat(a);return isNaN(r)?null:r}function Sc(e,t,s=.001){const a=e-t,r=Math.abs(a)<=s;return{difference:a,isBalanced:r,isUnderAllocated:!r&&a>0,isOverAllocated:!r&&a<0}}function Tn(){return`dist-${Date.now()}-${Math.random().toString(36).substr(2,9)}`}Tn();const kc={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:"$"},Yt=()=>({id:Tn(),amount:0,glAccount:null,isTaxDeductible:!1}),Ya=({distribution:e,defaultDistribution:t,glAccounts:s=[],isLoadingGlAccounts:a=!1,onSearchGlAccounts:r,onDistributionChange:i,onAmountChange:o,onGlAccountChange:l,onTaxDeductibleChange:c,onDelete:u,canDelete:f=!0,canEditTaxDeductible:h=!0,isDisabled:g=!1,labels:m,classNames:v={},"data-testid":j,control:b,name:w,rules:y})=>{const k={...kc,...m},N=b!==void 0&&w!==void 0,S=vc({defaultValues:{_internal:t||Yt()}}),E=sc({control:N?b:S.control,name:N?w:"_internal",rules:N?y:void 0}),[L,M]=x.useState(t||Yt()),$=N?E.field.value??Yt():e??L,O=N&&!!E.fieldState?.error,F=N&&(E.fieldState?.isTouched??!1),A=O||F,I=A&&(!$.amount||$.amount<=0),P=A&&!$.glAccount,[G,q]=x.useState($.glAccount?.name||""),W=x.useCallback(H=>{const X={...$,...H};N&&E.field.onChange(X),!N&&e===void 0&&M(X),i?.(X)},[$,e,i,N,E]),ee=x.useCallback(H=>{const X=H||0;W({amount:X}),o?.(X)},[W,o]),ae=x.useCallback(H=>{q(H),r?.(H)},[r]),re=x.useCallback(H=>{if(H===null){W({glAccount:null}),l?.(null);return}const J=s.find(Ce=>String(Ce.id)===String(H))||null;W({glAccount:J}),l?.(J)},[s,W,l]),U=x.useCallback(()=>{q(""),W({glAccount:null}),l?.(null)},[W,l]),Z=x.useCallback(H=>{W({isTaxDeductible:H}),c?.(H)},[W,c]),Q=x.useCallback(()=>{u?.()},[u]);return n.jsx(d.Card,{radius:"md",shadow:"sm","data-testid":j||"revenue-distribution-card",className:d.cn(v.base),children:n.jsxs(d.CardBody,{className:d.cn("flex flex-row flex-nowrap items-start gap-4",v.body),children:[n.jsx("div",{className:d.cn("shrink-0",v.amountContainer),children:n.jsx(d.NumberInput,{"data-testid":`${j||"revenue-distribution-card"}-amount-input`,label:n.jsxs("span",{className:"flex items-center gap-1",children:[k.amount,n.jsx(d.Tooltip,{content:k.amountTooltip,children:n.jsx(V,{icon:"solar:info-circle-linear",className:"text-default-400 cursor-help",width:16})})]}),value:$.amount||void 0,onValueChange:ee,labelPlacement:"outside",placeholder:k.amountPlaceholder,isWheelDisabled:!0,hideStepper:!0,variant:"bordered",isDisabled:g,isInvalid:I,errorMessage:I?"Amount is required":void 0,minValue:0,step:.01,className:v.amountInput,startContent:n.jsx("div",{className:"pointer-events-none flex items-center",children:n.jsx("span",{className:"text-default-400 text-small",children:k.currencySymbol})})})}),n.jsx("div",{className:d.cn("grow",v.glAccountContainer),children:n.jsx(d.Autocomplete,{"data-testid":`${j||"revenue-distribution-card"}-gl-account-input`,label:n.jsxs("span",{className:"flex items-center gap-1",children:[k.glAccount,n.jsx(d.Tooltip,{content:k.glAccountTooltip,children:n.jsx(V,{icon:"solar:info-circle-linear",className:"text-default-400 cursor-help",width:16})})]}),isLoading:a,isClearable:!0,labelPlacement:"outside",variant:"bordered",items:s,menuTrigger:"input",inputValue:$.glAccount?.name??G,selectedKey:$.glAccount?.id??null,isDisabled:g,isInvalid:P,errorMessage:P?"GL Account is required":void 0,listboxProps:{emptyContent:a?k.searching:k.noGlAccountsFound},placeholder:k.glAccountPlaceholder,onInputChange:ae,onSelectionChange:re,onClear:U,className:v.glAccountInput,children:H=>n.jsx(d.AutocompleteItem,{textValue:H.name,children:n.jsxs("div",{className:"flex flex-col",children:[n.jsx("span",{children:H.name}),H.code&&n.jsx("span",{className:"text-xs text-default-400",children:H.code})]})},H.id)})}),n.jsx("div",{className:d.cn("shrink-0 pt-6 flex items-center",v.taxDeductibleContainer),children:n.jsx(d.Checkbox,{radius:"full","data-testid":`${j||"revenue-distribution-card"}-tax-deductible`,isSelected:$.isTaxDeductible,onValueChange:Z,isDisabled:g||!h,className:v.taxDeductibleCheckbox,children:k.taxDeductible})}),n.jsx("div",{className:d.cn("shrink-0 pt-6",v.deleteContainer),children:n.jsx(R,{"data-testid":`${j||"revenue-distribution-card"}-delete-button`,size:"sm",color:"danger",variant:"flat",isDisabled:g||!f,onPress:Q,startContent:n.jsx(V,{icon:"solar:trash-bin-trash-linear",width:16}),className:d.cn("text-danger",v.deleteButton),children:k.deleteButton})})]})})};Ya.displayName="RevenueDistributionCard";const Ka=({message:e="No distributions configured",icon:t="solar:document-text-outline",iconSize:s=48,showCard:a=!0,classNames:r={},renderEmpty:i})=>{if(i)return n.jsx(n.Fragment,{children:i()});const o=n.jsxs("div",{className:d.cn("flex flex-col items-center justify-center py-8",r.content),children:[n.jsx(V,{icon:t,width:s,className:d.cn("text-default-300 mb-4",r.icon)}),n.jsx("p",{className:d.cn("text-default-500 text-sm text-center",r.message),children:e})]});return a?n.jsx(d.Card,{radius:"sm",shadow:"sm","data-testid":"revenue-distribution-empty",className:d.cn("w-full",r.base),children:n.jsx(d.CardBody,{children:o})}):n.jsx("div",{"data-testid":"revenue-distribution-empty",className:d.cn("w-full",r.base),children:o})};Ka.displayName="RevenueDistributionEmpty";const Ac={title:"Error Loading Distributions",description:"An error occurred while loading the distribution configuration. Please try again."},Ga=({error:e,labels:t,showCard:s=!0,color:a="danger",classNames:r={}})=>{const i={...Ac,...t},o=n.jsx(d.Alert,{"data-testid":"revenue-distribution-error-alert",color:a,title:i.title,description:e||i.description,className:r.alert});return s?n.jsx(d.Card,{radius:"sm",shadow:"sm","data-testid":"revenue-distribution-error",className:d.cn("w-full",r.base),children:n.jsx(d.CardBody,{children:o})}):n.jsx("div",{"data-testid":"revenue-distribution-error",className:d.cn("w-full",r.base),children:o})};Ga.displayName="RevenueDistributionError";const Qa=({rows:e=1,showCard:t=!0,classNames:s={}})=>{const a=Array.from({length:e},(i,o)=>o),r=i=>n.jsxs("div",{className:d.cn("flex flex-row flex-nowrap items-end gap-4",s.row),children:[n.jsxs("div",{className:"shrink-0 flex flex-col gap-1",children:[n.jsxs("div",{className:"flex items-center gap-1",children:[n.jsx(d.Skeleton,{className:"h-4 w-14 rounded-md"}),n.jsx(d.Skeleton,{className:"h-4 w-4 rounded-full"})]}),n.jsx(d.Skeleton,{className:"h-10 w-32 rounded-lg"})]}),n.jsxs("div",{className:"grow flex flex-col gap-1",children:[n.jsxs("div",{className:"flex items-center gap-1",children:[n.jsx(d.Skeleton,{className:"h-4 w-20 rounded-md"}),n.jsx(d.Skeleton,{className:"h-4 w-4 rounded-full"})]}),n.jsx(d.Skeleton,{className:"h-10 w-full rounded-lg"})]}),n.jsxs("div",{className:"shrink-0 pb-2 flex items-center gap-2",children:[n.jsx(d.Skeleton,{className:"h-5 w-5 rounded-full"}),n.jsx(d.Skeleton,{className:"h-4 w-24 rounded-md"})]}),n.jsx("div",{className:"shrink-0 pb-2",children:n.jsx(d.Skeleton,{className:"h-8 w-20 rounded-lg"})})]},i);return t?n.jsx("div",{className:d.cn("flex flex-col gap-3",s.base),children:a.map(i=>n.jsx(d.Card,{radius:"md",shadow:"sm","data-testid":`revenue-distribution-skeleton-${i}`,children:n.jsx(d.CardBody,{children:r(i)})},i))}):n.jsx("div",{"data-testid":"revenue-distribution-skeleton",className:d.cn("flex flex-col gap-3",s.base),children:a.map(i=>r(i))})};Qa.displayName="RevenueDistributionSkeleton";function Lt({isOpen:e,labels:t,icon:s,isConfirming:a=!1,confirmColor:r="danger",iconTone:i="danger",portalContainer:o,shouldBlockScroll:l,classNames:c,onClose:u,onConfirm:f}){return n.jsx(d.Modal,{isOpen:e,size:"md",placement:"center",portalContainer:o,shouldBlockScroll:l,classNames:{...c,base:d.cn("max-w-[440px] rounded-3xl",c?.base),closeButton:d.cn("right-5 top-5 text-zinc-500",c?.closeButton)},onOpenChange:h=>!h&&u(),children:n.jsxs(d.ModalContent,{children:[n.jsxs(d.ModalHeader,{className:"flex flex-col items-start gap-4 px-7 pb-0 pt-7",children:[s&&n.jsx("span",{className:d.cn("flex h-12 w-12 shrink-0 items-center justify-center rounded-full",i==="warning"?"bg-brand/15 text-brand":"bg-danger-100 text-danger-600"),children:s}),n.jsx("span",{className:"text-lg font-semibold leading-6 text-zinc-950",children:t.title})]}),n.jsx(d.ModalBody,{className:"px-7 pb-3 pt-4",children:n.jsx("div",{className:"text-sm leading-6 text-zinc-500",children:t.description})}),n.jsxs(d.ModalFooter,{className:"grid grid-cols-2 gap-3 px-7 pb-7 pt-3",children:[n.jsx(R,{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:t.cancel}),n.jsx(R,{type:"button",size:"md",color:r,radius:"full",className:d.cn("h-10 text-sm font-normal text-white",r==="danger"?"bg-danger-600":"bg-brand"),isLoading:a,onPress:f,children:t.confirm})]})]})})}const $c=()=>({id:crypto.randomUUID(),fund:null,percentage:0});function mn(e){return!e.fund&&Number(e.percentage||0)<=0}function Dc({mode:e,assignments:t}){const s=t.filter(o=>!mn(o)),a=s.filter(o=>o.fund),r=a.reduce((o,l)=>o+Number(l.percentage||0),0),i=s.some(o=>!o.fund||Number(o.percentage||0)<=0);return a.length>=1&&!i&&Math.round(r*100)/100===100}const Ec={title:"Payment assignment",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"},Za={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"},rt={...Za,base:"min-h-11 rounded-2xl px-4 py-2 shadow-none",title:"text-sm font-medium"},Fc={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"},Lc={wrapper:"!absolute !inset-0 !z-50 !items-center !justify-center !p-4",backdrop:"!absolute !inset-0 !z-40 rounded-2xl"};function Mc(){return n.jsxs("svg",{"aria-hidden":"true",className:"size-4 text-zinc-500",fill:"none",viewBox:"0 0 16 16",children:[n.jsx("rect",{x:"3",y:"3",width:"4",height:"4",rx:"1",stroke:"currentColor",strokeWidth:"1.4"}),n.jsx("rect",{x:"9",y:"3",width:"4",height:"4",rx:"1",stroke:"currentColor",strokeWidth:"1.4"}),n.jsx("rect",{x:"3",y:"9",width:"4",height:"4",rx:"1",stroke:"currentColor",strokeWidth:"1.4"}),n.jsx("rect",{x:"9",y:"9",width:"4",height:"4",rx:"1",stroke:"currentColor",strokeWidth:"1.4"})]})}const Ic=e=>Number.isFinite(e)?Math.max(0,Math.min(100,Math.round(e*100)/100)):0,Tc=e=>e.fund!==null;function Pc({assignments:e,funds:t,labels:s,classNames:a,isSaving:r=!1,hasSavedAssignments:i=!1,isFundPickerOpen:o=!1,activeAssignmentId:l=null,modalPortalContainer:c,footer:u,onAssignmentsChange:f,onOpenFundPicker:h,onCloseFundPicker:g,onCollapseChange:m,onSave:v}){const[j,b]=x.useState(null),w=c??j??void 0,y={...Ec,...s},k=e.filter(H=>!mn(H)),S=k.filter(Tc).length>0,E=x.useMemo(()=>e.filter(H=>!mn(H)).reduce((H,X)=>H+Number(X.percentage||0),0),[e]),L=Math.round(E*100)/100,M=k.some(H=>!H.fund||Number(H.percentage||0)<=0),$=S&&(L!==100||M),O=`${y.totalError} (${y.total} ${Number(E.toFixed(2))}%)`,F=Dc({mode:"split",assignments:e}),A=S&&L>=100,[I,P]=x.useState(!1),[G,q]=x.useState(!1),W=n.jsxs("span",{className:"flex items-center gap-2",children:[n.jsx(Mc,{}),n.jsx("span",{className:"text-base font-medium leading-6 text-zinc-950",children:y.title})]}),ee=(H,X)=>{f(e.map(J=>J.id===H?{...J,...X}:J))},ae=()=>{A||f([...e,$c()])},re=H=>{e.length<=1||f(e.filter(X=>X.id!==H))},U=()=>{if(!r){if(!F){q(!0);return}if(!i){v();return}P(!0)}},Z=()=>{P(!1),v()},Q=H=>{const X=l??e.find(J=>!J.fund)?.id??e[0]?.id;X&&(f(e.map(J=>J.id===X?{...J,fund:H}:J)),g())};return n.jsxs("div",{ref:b,className:d.cn("vvt-pa relative font-sans text-zinc-900",o&&!c&&"min-h-[560px]",a?.root),children:[n.jsx(d.Accordion,{variant:"splitted",defaultSelectedKeys:["installment-fund-assignment"],className:d.cn("w-full gap-0 px-0",a?.panel),itemClasses:{base:"w-full rounded-2xl border border-zinc-200 bg-white p-0 shadow-sm",trigger:d.cn("px-4 py-4",a?.header),title:"w-full",content:"w-full px-4 pb-4 pt-0",indicator:"text-zinc-500 [&>svg]:size-4"},onSelectionChange:H=>m?.(!(H==="all"||Array.from(H).length>0)),children:n.jsx(d.AccordionItem,{"aria-label":y.title,title:W,children:n.jsxs("div",{className:d.cn("flex w-full flex-col gap-4",a?.content),children:[n.jsxs("div",{className:"flex w-full flex-col gap-4",children:[!S&&n.jsx(d.Alert,{icon:n.jsx(V,{icon:"solar:info-circle-outline",className:"size-4"}),hideIconWrapper:!0,isClosable:!1,classNames:Za,color:"default",variant:"flat",title:y.emptySplit}),S&&n.jsx(_c,{assignments:e,labels:y,total:E,hasTotalError:G&&!F||$,validationMessage:O,onSelectFund:H=>h(H),onRemoveFund:re,onPercentageChange:(H,X)=>ee(H,{percentage:Ic(X)})}),n.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[n.jsx(R,{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",startContent:n.jsx(K.Plus,{className:"size-5",strokeWidth:2}),isDisabled:A,onPress:()=>S?ae():h(),children:y.assignSpecificFund}),n.jsx(R,{type:"button",size:"md",color:"primary",radius:"full",className:"ml-auto h-10 min-w-40 bg-brand px-4 text-sm font-medium text-white",startContent:r?void 0:n.jsx(V,{icon:"solar:cloud-upload-outline",className:"size-4"}),isLoading:r,onPress:U,children:y.saveAssignment})]})]}),u]})},"installment-fund-assignment")}),o&&n.jsx(Oc,{funds:t,labels:y,selectedFundIds:e.map(H=>H.fund?.id).filter(Boolean),portalContainer:w,onSelect:Q,onClose:g}),n.jsx(Lt,{isOpen:I,labels:{title:y.modifyAssignedFundsTitle,description:n.jsxs(n.Fragment,{children:[n.jsx("p",{children:y.modifyAssignedFundsDescription}),n.jsx("p",{className:"mt-3",children:y.modifyAssignedFundsWarning})]}),cancel:y.modifyAssignedFundsCancel,confirm:y.modifyAssignedFundsConfirm},icon:n.jsx(V,{icon:"solar:info-circle-outline",className:"size-7"}),iconTone:"warning",confirmColor:"primary",portalContainer:w,shouldBlockScroll:!1,classNames:Lc,onClose:()=>P(!1),onConfirm:Z})]})}function _c({assignments:e,labels:t,total:s,hasTotalError:a,validationMessage:r,onSelectFund:i,onRemoveFund:o,onPercentageChange:l}){return n.jsxs("div",{className:"flex flex-col gap-3",children:[e.map((c,u)=>n.jsxs("div",{className:"flex min-h-15 w-full items-center gap-3 rounded-2xl border border-zinc-200 bg-white px-3 py-2",children:[n.jsx("div",{className:d.cn("flex min-h-11 min-w-0 flex-1 items-center","gap-4"),children:c.fund?n.jsxs(n.Fragment,{children:[n.jsxs("span",{className:"rounded-full bg-zinc-100 px-4 py-1.5 text-sm text-zinc-950",children:[c.fund.glCode," - ",c.fund.accountName]}),n.jsx(R,{type:"button",variant:"light",radius:"full",className:"px-2 text-sm font-normal text-brand",onPress:()=>i(c.id),children:"Replace"})]}):n.jsx(R,{type:"button",size:"lg",variant:"light",radius:"full",className:"justify-start px-4 text-lg font-normal text-zinc-900",startContent:n.jsx(K.Plus,{className:"size-5",strokeWidth:2}),onPress:()=>i(c.id),children:t.assignSpecificFund})}),n.jsx("label",{className:"flex w-48 flex-none items-center",children:n.jsx(d.Input,{variant:"bordered",type:"number",min:0,max:100,step:.01,value:String(c.percentage||""),onChange:f=>l(c.id,Number(f.target.value)),endContent:n.jsx("span",{className:"text-sm text-zinc-500",children:"%"}),classNames:Fc})}),e.length>1&&n.jsx(R,{type:"button",isIconOnly:!0,variant:"flat",radius:"full",className:d.cn("h-10 w-10 flex-none p-0",u===0?"bg-danger-100 text-danger-500 opacity-60":"bg-danger-600 text-white"),style:{height:40,minWidth:40,width:40},isDisabled:u===0,onPress:()=>o(c.id),"aria-label":t.removeFund,children:n.jsx(V,{icon:"solar:trash-bin-minimalistic-outline",className:"size-5"})})]},c.id)),n.jsx(d.Alert,{icon:n.jsx(V,{icon:a?"solar:info-circle-outline":"solar:check-circle-outline",className:"size-4"}),hideIconWrapper:!0,isClosable:!1,color:a?"warning":"success",variant:"flat",classNames:{...rt,base:d.cn(rt.base,a?"bg-warning-50 text-warning-700":"bg-success-50 text-success-700"),iconWrapper:d.cn(rt.iconWrapper,a?"text-warning-700":"text-success-700"),alertIcon:d.cn(rt.alertIcon,a?"text-warning-700":"text-success-700"),title:d.cn(rt.title,a?"text-warning-700":"text-success-700")},title:a?r:`${t.total} ${Number(s.toFixed(2))}%`})]})}function Oc({funds:e,labels:t,selectedFundIds:s,portalContainer:a,onSelect:r,onClose:i}){const[o,l]=x.useState(""),c=e.filter(u=>{if(s.includes(u.id))return!1;const f=o.trim().toLowerCase();return f?`${u.glCode} ${u.accountName} ${u.type}`.toLowerCase().includes(f):!0});return n.jsx(d.Modal,{isOpen:!0,size:"3xl",placement:"center",scrollBehavior:"inside",shouldBlockScroll:!1,portalContainer:a,classNames:{wrapper:"!absolute !inset-0 !z-50 !items-center !justify-center !p-4",backdrop:"!absolute !inset-0 !z-40 rounded-2xl",base:"max-h-[calc(100%-2rem)] max-w-3xl rounded-3xl",closeButton:"right-6 top-6 text-zinc-500"},onOpenChange:u=>!u&&i(),children:n.jsxs(d.ModalContent,{className:"max-h-full",children:[n.jsx(d.ModalHeader,{className:"px-6 pt-6 text-xl font-semibold leading-7 text-zinc-950",children:t.modalTitle}),n.jsxs(d.ModalBody,{className:"flex min-h-0 flex-1 flex-col px-6 pb-6",children:[n.jsx(d.Input,{variant:"bordered","aria-label":t.searchPlaceholder,value:o,placeholder:t.searchPlaceholder,onChange:u=>l(u.target.value),startContent:n.jsx(V,{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"}}),n.jsxs("div",{className:"mt-4 min-h-0 flex-1 overflow-auto",children:[n.jsxs("div",{className:"grid 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",children:[n.jsx("span",{children:t.glCode}),n.jsx("span",{children:t.accountName}),n.jsx("span",{children:t.actions})]}),c.length===0&&n.jsx("div",{className:"p-4 text-sm text-zinc-500",children:t.noFunds}),c.map(u=>n.jsxs("div",{className:"grid grid-cols-[1fr_1.3fr_0.6fr] items-center gap-5 px-3 py-2.5 text-sm leading-5 text-zinc-900",children:[n.jsx("span",{children:u.glCode}),n.jsx("span",{children:u.accountName}),n.jsx(R,{type:"button",size:"sm",variant:"bordered",radius:"full",className:"h-9 min-w-24 border-zinc-200 bg-white text-sm font-medium text-zinc-900",onPress:()=>r(u),children:t.select})]},u.id))]})]})]})})}function Rc(){return n.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:[n.jsxs("div",{className:"flex items-start justify-between gap-3",children:[n.jsx(d.Skeleton,{className:"h-7 w-56 rounded-lg"}),n.jsx(d.Skeleton,{className:"size-8 rounded-full"})]}),n.jsxs("div",{className:"flex items-center justify-between gap-3",children:[n.jsx(d.Skeleton,{className:"h-10 w-72 rounded-full"}),n.jsx(d.Skeleton,{className:"h-10 w-40 rounded-full"})]}),n.jsxs("div",{className:"grid grid-cols-[minmax(0,1fr)_160px] items-center gap-4 rounded-2xl border border-zinc-100 p-3",children:[n.jsx(d.Skeleton,{className:"h-8 w-full max-w-xs rounded-full"}),n.jsx(d.Skeleton,{className:"h-8 w-full rounded-xl"})]}),n.jsx(d.Skeleton,{className:"h-11 w-40 rounded-full"})]})}const zc={totalAmount:"Total Amount:",remainingBalance:"Remaining Balance",amountReceived:"Amount Received:"};function Bc({totalAmount:e,remainingBalance:t,amountReceived:s,currency:a="USD",locale:r="en-US",labels:i,className:o}){const l={...zc,...i},c=new Intl.NumberFormat(r,{style:"currency",currency:a});return n.jsx("div",{className:d.cn("w-full rounded-2xl border border-zinc-200 bg-white px-4 py-2.5 font-sans text-base leading-6",o),children:n.jsxs("div",{className:"flex w-full flex-wrap items-center gap-x-5 gap-y-2",children:[n.jsx(Kt,{label:l.totalAmount,value:c.format(e)}),n.jsx(Kt,{label:l.remainingBalance,value:c.format(t)}),n.jsx(Kt,{label:l.amountReceived,value:c.format(s)})]})})}function Kt({label:e,value:t}){return n.jsxs("div",{className:"flex items-center gap-3 whitespace-nowrap",children:[n.jsx("span",{className:"font-medium text-zinc-700",children:e}),n.jsx("span",{className:"font-normal text-zinc-950",children:t})]})}const Vc={monthly:1,quarterly:3,annual:12},Xa=e=>{const[t,s,a]=e.split("-").map(Number);return{year:t,month:s,day:a}},Uc=(e,t)=>new Date(e,t+1,0).getDate(),Hc=e=>{const t=e.getFullYear(),s=String(e.getMonth()+1).padStart(2,"0"),a=String(e.getDate()).padStart(2,"0");return`${t}-${s}-${a}`},qc=(e,t)=>{const{year:s,month:a,day:r}=Xa(e),i=a-1+t,o=s+Math.floor(i/12),l=(i%12+12)%12,c=Math.min(r,Uc(o,l));return new Date(o,l,c)},Wc=(e,t)=>{const{year:s,month:a,day:r}=Xa(e),i=new Date(s,a-1,r);return i.setDate(i.getDate()+t),i};function Ja(e,t){const s=Math.max(1,Math.floor(t.numberOfInstallments||1)),a=Math.round(e*100),r=Math.floor(a/s),i=a-r*s,o=Vc[t.frequency];return Array.from({length:s},(l,c)=>{const u=t.frequency==="weekly"?Wc(t.firstInstallmentDate,c*7):qc(t.firstInstallmentDate,c*(o??1));return{id:crypto.randomUUID(),dueDate:Hc(u),amount:(r+(c===0?i:0))/100}})}function Yc(e){return new Set(e.map((t,s)=>{const a=e[s+1]?.dueDate;return t.dueDate&&a&&t.dueDate>a?t.id:null}).filter(t=>!!t))}const Kc={title:"Payments",automaticMode:"Auto",manualMode:"Manual",createInstallments:"Create Payments",generateSchedule:"Generate Schedule",saveInstallments:"Save Payments",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 cannot exceed donation 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.",amountGreaterThanZeroError:"Payment amount must be greater than 0."},Gc=["weekly","monthly","quarterly","annual"],Qc=Array.from({length:31},(e,t)=>t+1),Zc=["numberOfInstallments","frequency","firstInstallmentDate"],Xc={wrapper:"!absolute !inset-0 !z-50 !items-center !justify-center !p-4",backdrop:"!absolute !inset-0 !z-40 rounded-2xl"},Es=()=>({id:crypto.randomUUID(),dueDate:new Date().toISOString().slice(0,10),amount:0}),er=e=>Math.round(e*100)/100,Jc=(e,t)=>{const s=new Date(`${e}T00:00:00`);return Number.isNaN(s.getTime())?e:new Intl.DateTimeFormat(t,{month:"short",day:"numeric",year:"numeric"}).format(s)},Mt=e=>{if(!e)return null;try{return Kl(e)}catch{return null}},ed=e=>Mt(e)?.day??1,td=(e,t)=>new Date(e,t,0).getDate(),nd=(e,t)=>{const s=Mt(e);if(!s)return e;const a=Math.min(t,td(s.year,s.month));return s.set({day:a}).toString()},Fs=e=>{const t=e%100>=11&&e%100<=13?"th":e%10===1?"st":e%10===2?"nd":e%10===3?"rd":"th";return`${e}${t}`};function sd({mode:e,donationAmount:t,currency:s="USD",locale:a="en-US",installments:r,automaticSettings:i,defaultTab:o="automatic",showTitle:l=!0,showCard:c=!0,showSavePayment:u=!0,showTabs:f=!0,inputs:h=Zc,startDate:g,labels:m,classNames:v,isSaving:j=!1,isModeSwitchDisabled:b=!1,onModeChange:w,onAutomaticSettingsChange:y,onInstallmentsChange:k,onSave:N}){const[S,E]=x.useState(null),[L,M]=x.useState(o),$={...Kc,...m},O=e??L,F=x.useMemo(()=>new Intl.NumberFormat(a,{style:"currency",currency:s}),[s,a]),A=x.useMemo(()=>({...i,firstInstallmentDate:h.includes("firstInstallmentDate")?i.firstInstallmentDate:h.includes("dayOfMonth")?i.firstInstallmentDate||g||"":g||i.firstInstallmentDate}),[i,h,g]),I=O==="automatic"?Ja(t,A):r,P=x.useMemo(()=>er(I.reduce((J,Ce)=>J+Number(Ce.amount||0),0)),[I]),G=O==="manual"&&P-t>.009,[q,W]=x.useState(!1),ee=l?n.jsxs("span",{className:"flex items-center gap-2",children:[n.jsx(K.CircleDollarSign,{className:"size-4 text-zinc-500",strokeWidth:1.75}),n.jsx("span",{className:"text-base font-medium leading-6 text-zinc-950",children:$.title})]}):void 0,ae=J=>{J!==O&&(e||M(J),w?.(J),J==="manual"&&r.length===0&&k([Es()]))},re=(J,Ce)=>{r.find(he=>he.id===J)?.status!=="paid"&&k(r.map(he=>he.id===J?{...he,...Ce}:he))},U=()=>{k([...r,Es()])},Z=J=>{r.find(be=>be.id===J)?.status!=="paid"&&k(r.filter(be=>be.id!==J))},Q=()=>{if(!j){if(G){W(!0);return}N?.()}},H=()=>{W(!1),N?.()},X=n.jsxs("div",{className:d.cn("flex w-full flex-col gap-4",v?.content),children:[f||u?n.jsxs("div",{className:"flex w-full items-center justify-between gap-6",children:[f?n.jsx(ad,{mode:O,labels:$,onModeChange:ae,isDisabled:b,className:v?.tabs}):null,u?n.jsx(R,{type:"button",size:"md",color:"primary",radius:"full",className:"ml-auto min-w-36",startContent:j?void 0:n.jsx(V,{icon:"solar:cloud-upload-outline",className:"size-4"}),isLoading:j,onPress:Q,children:$.saveInstallments}):null]}):null,n.jsxs("div",{className:d.cn("flex w-full flex-col gap-4",v?.preview),children:[O==="automatic"&&n.jsx(rd,{settings:A,inputs:h,labels:$,className:v?.controls,onSettingsChange:y}),I.length===0&&n.jsx(d.Alert,{isClosable:!1,color:"default",variant:"flat",radius:"full",title:O==="automatic"?$.emptyAutomatic:$.emptyManual}),I.length>0&&n.jsx(id,{mode:O,installments:I,labels:$,formatter:F,locale:a,onUpdateInstallment:re,onRemoveInstallment:Z}),O==="manual"&&n.jsx("div",{className:"flex flex-wrap gap-3",children:n.jsx(R,{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:n.jsx(K.Plus,{className:"size-5",strokeWidth:2}),onPress:U,children:$.addInstallment})}),n.jsx(od,{total:P,donationAmount:t,hasTotalIncreaseWarning:G,mode:O,installments:I,formatter:F,labels:$,className:v?.summary})]})]});return n.jsxs("div",{ref:E,className:d.cn("vvt-ps relative font-sans text-zinc-900",v?.root),children:[c?n.jsx(d.Accordion,{variant:"splitted",defaultSelectedKeys:["installment-schedule"],className:d.cn("w-full gap-0 px-0",v?.panel),itemClasses:{base:"w-full rounded-2xl border border-zinc-200 bg-white p-0 shadow-sm",trigger:d.cn("px-4 py-4",v?.header),title:"w-full",content:"w-full px-4 pb-4 pt-0",indicator:"text-zinc-500 [&>svg]:size-4"},children:n.jsx(d.AccordionItem,{"aria-label":$.title,title:ee,children:X},"installment-schedule")}):X,n.jsx(Lt,{isOpen:q,labels:{title:$.totalIncreaseConfirmationTitle,description:$.totalIncreaseConfirmationDescription,cancel:$.totalIncreaseConfirmationCancel,confirm:$.totalIncreaseConfirmationConfirm},icon:n.jsx(V,{icon:"solar:info-circle-outline",className:"size-7"}),iconTone:"warning",confirmColor:"primary",isConfirming:j,portalContainer:S??void 0,shouldBlockScroll:!1,classNames:Xc,onClose:()=>W(!1),onConfirm:H})]})}function ad({mode:e,labels:t,className:s,isDisabled:a=!1,onModeChange:r}){return n.jsxs(d.Tabs,{"aria-label":t.title,selectedKey:e,isDisabled:a,color:"primary",size:"lg",radius:"full",className:d.cn("w-fit",s),onSelectionChange:i=>r(i),children:[n.jsx(d.Tab,{title:t.automaticMode},"automatic"),n.jsx(d.Tab,{title:t.manualMode},"manual")]})}function rd({settings:e,inputs:t,labels:s,className:a,onSettingsChange:r}){const i=o=>{if(o==="numberOfInstallments")return n.jsx("div",{className:"min-w-0",children:n.jsx(d.Input,{variant:"bordered",label:s.numberOfInstallments,labelPlacement:"outside",type:"number",min:1,step:1,value:e.numberOfInstallments>0?String(e.numberOfInstallments):"",onWheel:l=>l.currentTarget.blur(),onChange:l=>{const c=l.target.value;r({...e,numberOfInstallments:c===""?0:Math.max(1,Number(c))})}})},o);if(o==="frequency")return n.jsx("div",{className:"min-w-0",children:n.jsx(Ie,{variant:"bordered",label:s.frequency,labelPlacement:"outside",selectedKeys:[e.frequency],onSelectionChange:l=>{const c=Array.from(l)[0];typeof c=="string"&&r({...e,frequency:c})},children:Gc.map(l=>n.jsx(d.SelectItem,{textValue:s[l],children:s[l]},l))})},o);if(o==="dayOfMonth"){const l=String(ed(e.firstInstallmentDate));return n.jsx("div",{className:"min-w-0",children:n.jsx(Ie,{variant:"bordered",label:s.dayOfMonth,labelPlacement:"outside",selectedKeys:[l],onSelectionChange:c=>{const u=Number(Array.from(c)[0]);Number.isFinite(u)&&r({...e,firstInstallmentDate:nd(e.firstInstallmentDate,u)})},children:Qc.map(c=>n.jsx(d.SelectItem,{textValue:Fs(c),children:Fs(c)},String(c)))})},o)}return n.jsx("div",{className:"min-w-0",children:n.jsx(Cn,{variant:"bordered",label:s.firstInstallmentDate,labelPlacement:"outside",value:Mt(e.firstInstallmentDate),onChange:l=>r({...e,firstInstallmentDate:l?l.toString():""}),startContent:n.jsx(V,{icon:"solar:calendar-outline",className:"size-4 text-zinc-500"})})},o)};return t.length===0?null:n.jsx("div",{className:d.cn("grid gap-4",a),style:{gridTemplateColumns:"repeat(auto-fit, minmax(min(100%, 14rem), 1fr))"},children:t.map(i)})}function id({mode:e,installments:t,labels:s,formatter:a,locale:r,onUpdateInstallment:i,onRemoveInstallment:o}){const l=Yc(t),c=new Set(t.map(u=>Number(u.amount||0)<=0?u.id:null).filter(u=>!!u));return e==="automatic"?n.jsx("div",{className:"rounded-2xl border border-zinc-200 bg-zinc-50 p-4",children:n.jsx("div",{className:d.cn("flex flex-col gap-3",t.length>5&&"max-h-[264px] overflow-y-auto pr-2"),children:t.map((u,f)=>n.jsxs("div",{className:d.cn("flex min-h-10 items-center justify-between rounded-xl px-4 py-2 text-base",f===0&&"border border-primary/25 bg-primary/5 text-primary"),children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsxs("span",{children:["#",f+1]}),n.jsx("span",{children:"▪"}),n.jsx("span",{children:Jc(u.dueDate,r)}),f===0&&t.length>1&&n.jsx(d.Chip,{size:"sm",color:"primary",variant:"solid",radius:"full",children:"First charge"})]}),n.jsx("span",{className:"text-zinc-950",children:a.format(u.amount)})]},u.id))})}):n.jsx("div",{className:"flex flex-col gap-2",children:t.map((u,f)=>{const h=l.has(u.id),g=c.has(u.id);return n.jsx("div",{className:"flex w-full flex-col gap-1",children:n.jsxs("div",{className:"grid w-full grid-cols-[2rem_minmax(0,1fr)_minmax(0,1fr)_2.25rem] items-start gap-4",children:[n.jsx("span",{className:"pt-2 text-sm font-medium text-zinc-500",children:f+1}),n.jsx("div",{className:"min-w-0 flex-1",children:n.jsx(Cn,{variant:"bordered","aria-label":`${s.dueDate} ${f+1}`,isDisabled:u.status==="paid",isInvalid:h,errorMessage:h?s.dateOrderError:void 0,value:Mt(u.dueDate),onChange:m=>i(u.id,{dueDate:m?m.toString():""})})}),n.jsx("div",{className:"min-w-0 flex-1",children:n.jsx(d.Input,{variant:"bordered",type:"number",min:0,step:.01,isDisabled:u.status==="paid",isInvalid:g,errorMessage:g?s.amountGreaterThanZeroError:void 0,value:String(u.amount||""),onChange:m=>i(u.id,{amount:er(Number(m.target.value||0))}),startContent:n.jsx("span",{className:"text-zinc-900",children:"$"})})}),n.jsx(ld,{isDisabled:t.length<=1,isPaid:u.status==="paid",label:s.deleteInstallment,onRemove:()=>o(u.id)})]})},u.id)})})}function ld({isDisabled:e,isPaid:t,label:s,onRemove:a}){const r=n.jsx(R,{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||t,onPress:a,"aria-label":s,children:n.jsx(V,{icon:"solar:trash-bin-minimalistic-outline",className:"size-5"})});return t?n.jsx(d.Tooltip,{content:"This payment cannot be edited or deleted because it has already been paid.",placement:"top",children:n.jsx("span",{className:"inline-flex",children:r})}):r}function od({total:e,donationAmount:t,hasTotalIncreaseWarning:s,mode:a,installments:r,formatter:i,labels:o,className:l}){const c=r.length,u=r[0]?.amount??0,f=r[1]?.amount??u,h=c>1&&Math.round(u*100)!==Math.round(f*100),g=Math.max(t-e,0),m=s?n.jsx("span",{children:o.totalIncreaseWarning}):a==="automatic"?h?n.jsxs("span",{children:["Saving will create ",n.jsx("strong",{children:c})," scheduled payment records:"," ",n.jsx("strong",{children:i.format(u)})," first charge and"," ",n.jsx("strong",{children:i.format(f)})," for each remaining charge."]}):n.jsxs("span",{children:["Saving will create ",n.jsx("strong",{children:c})," scheduled payment records of"," ",n.jsx("strong",{children:i.format(u)})," each."]}):n.jsxs("span",{children:["Total scheduled: ",n.jsx("strong",{children:i.format(e)})," /"," ",n.jsx("strong",{children:i.format(t)}),"."]}),v=a==="automatic"?`Total: ${i.format(e)}`:s?`New total: ${i.format(e)}`:`${o.remaining}: ${i.format(g)}`;return n.jsx(d.Alert,{isClosable:!1,color:s?"warning":"default",variant:"flat",radius:"full",className:l,endContent:n.jsx("span",{className:"whitespace-nowrap",children:v}),title:m})}function cd(){return n.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:[n.jsxs("div",{className:"flex items-start justify-between gap-3",children:[n.jsx(d.Skeleton,{className:"h-7 w-56 rounded-lg"}),n.jsx(d.Skeleton,{className:"size-8 rounded-full"})]}),n.jsxs("div",{className:"flex items-center justify-between gap-3",children:[n.jsx(d.Skeleton,{className:"h-10 w-72 rounded-full"}),n.jsx(d.Skeleton,{className:"h-10 w-40 rounded-full"})]}),n.jsxs("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-end sm:justify-between",children:[n.jsxs("div",{className:"flex w-full max-w-[280px] flex-col gap-2",children:[n.jsx(d.Skeleton,{className:"h-4 w-36 rounded-md"}),n.jsx(d.Skeleton,{className:"h-9 w-full rounded-xl"})]}),n.jsx(d.Skeleton,{className:"h-9 w-36 rounded-full"})]}),n.jsx("div",{className:"flex flex-col gap-3",children:Array.from({length:4}).map((e,t)=>n.jsxs("div",{className:"grid grid-cols-[minmax(0,1fr)_160px] items-center gap-4 rounded-2xl border border-zinc-100 p-3",children:[n.jsx(d.Skeleton,{className:"h-8 w-full max-w-xs rounded-full"}),n.jsx(d.Skeleton,{className:"h-8 w-full rounded-xl"})]},t))})]})}const Ls={paid:"bg-emerald-50 text-emerald-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",disputed:"bg-purple-50 text-purple-700",canceled:"bg-zinc-100 text-zinc-600"},tr={paid:"Paid",schedule:"Schedule",payment_due:"Payment Due",overdue:"Overdue",failed:"Failed",refunded:"Refunded",disputed:"Disputed",canceled:"Canceled"},dd={title:"Payments",searchLabel:"Search a payment",searchPlaceholder:"Search a payment by ID or Date...",editInstallments:"Edit Payment",installmentId:"Payment ID",amount:"Amount",scheduledDate:"Scheduled Date",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:n.jsxs(n.Fragment,{children:["Are you sure you want to delete this payment? ",n.jsx("strong",{children:"This action cannot be undone."})]}),deleteInstallmentConfirmationCancel:"Cancel",deleteInstallmentConfirmationConfirm:"Confirm",noInstallmentsFound:"No payments found."},ud={wrapper:"!absolute !inset-0 !z-50 !items-center !justify-center !p-4",backdrop:"!absolute !inset-0 !z-40 rounded-2xl"},fd=[];function md({installments:e,currency:t,locale:s="en-US",showTitle:a=!0,showCard:r=!0,showEditPayment:i=!0,showDelete:o=!0,payNowHiddenStatuses:l=fd,labels:c,isSaving:u=!1,onEditInstallments:f,onPayInstallment:h,onDeleteInstallment:g}){const[m,v]=x.useState(null),j={...dd,...c},[b,w]=x.useState(""),y=new Intl.NumberFormat(s,{style:"currency",currency:t}),k=a?n.jsxs("span",{className:"flex items-center gap-2",children:[n.jsx(K.CircleDollarSign,{className:"size-4 text-zinc-500",strokeWidth:1.75}),n.jsx("span",{className:"text-base font-medium leading-6 text-zinc-950",children:j.title})]}):void 0,N=x.useMemo(()=>{const E=b.trim().toLowerCase();return E?e.filter(L=>{const M=L.status??"schedule";return[L.id,L.amount,L.dueDate,Gt(L.dueDate,s),M,tr[M]??M].join(" ").toLowerCase().includes(E)}):e},[s,e,b]),S=n.jsxs("div",{className:"flex min-w-0 w-full flex-col gap-4 overflow-x-hidden [container-type:inline-size]",children:[n.jsxs("div",{className:"flex min-w-0 w-full flex-wrap items-end justify-between gap-4",children:[n.jsxs("div",{className:"min-w-0 w-full max-w-[280px]",children:[n.jsx("label",{className:"mb-1 block text-sm font-normal text-zinc-950",children:j.searchLabel}),n.jsx(d.Input,{variant:"bordered",size:"md",value:b,placeholder:j.searchPlaceholder,onChange:E=>w(E.target.value),startContent:n.jsx(V,{icon:"solar:magnifer-outline",className:"size-4 text-zinc-500"})})]}),i?n.jsx(R,{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:n.jsx(V,{icon:"solar:pen-outline",className:"size-4"}),isLoading:u,onPress:f,children:j.editInstallments}):null]}),n.jsx("div",{className:d.cn("hidden [@container(max-width:767px)]:block",N.length>3&&"max-h-[560px] overflow-y-auto pr-1"),children:n.jsxs("div",{className:"flex flex-col gap-2",children:[N.map((E,L)=>{const M=E.status??"schedule";return n.jsx(d.Card,{radius:"lg",shadow:"none",className:"border border-default-200",children:n.jsxs(d.CardBody,{className:"gap-3 p-3",children:[n.jsxs("div",{className:"flex items-start justify-between gap-2",children:[n.jsxs("div",{className:"min-w-0",children:[n.jsxs("p",{className:"text-xs text-default-500",children:["#",L+1]}),n.jsx("p",{className:"truncate text-sm font-medium text-foreground",children:E.id||`PMT-${L+1}`})]}),n.jsx(Ms,{status:M})]}),n.jsxs("div",{className:"grid grid-cols-2 gap-2 text-sm",children:[n.jsxs("div",{children:[n.jsx("p",{className:"text-xs text-default-500",children:j.amount}),n.jsx("p",{className:"font-medium text-foreground",children:y.format(E.amount)})]}),n.jsxs("div",{className:"text-right",children:[n.jsx("p",{className:"text-xs text-default-500",children:j.scheduledDate}),n.jsx("p",{className:"font-medium text-foreground",children:Gt(E.dueDate,s)})]})]}),n.jsx(Is,{status:M,installment:E,labels:j,portalContainer:m??void 0,showDelete:o,payNowHiddenStatuses:l,onPayInstallment:h,onDeleteInstallment:g})]})},E.id)}),N.length===0&&n.jsx("div",{className:"rounded-lg border border-default-200 px-4 py-6 text-center text-sm text-default-500",children:j.noInstallmentsFound})]})}),n.jsx("div",{className:d.cn("w-full overflow-x-hidden [@container(max-width:767px)]:hidden",N.length>5&&"max-h-[344px] overflow-y-auto pr-1"),children:n.jsxs("table",{className:"w-full table-fixed border-collapse text-left text-sm",children:[n.jsxs("colgroup",{children:[n.jsx("col",{className:"w-12"}),n.jsx("col",{}),n.jsx("col",{className:"w-24"}),n.jsx("col",{className:"w-36"}),n.jsx("col",{className:"w-36"}),n.jsx("col",{className:"w-44"})]}),n.jsx("thead",{children:n.jsxs("tr",{className:"sticky top-0 z-10 border-b border-zinc-200 bg-white text-zinc-900",children:[n.jsx("th",{className:"px-2 py-3 font-medium",children:"#"}),n.jsx("th",{className:"px-2 py-3 font-medium",children:j.installmentId}),n.jsx("th",{className:"px-2 py-3 font-medium",children:j.amount}),n.jsx("th",{className:"px-2 py-3 font-medium",children:j.scheduledDate}),n.jsx("th",{className:"whitespace-nowrap px-2 py-3 font-medium",children:j.status}),n.jsx("th",{className:"whitespace-nowrap py-3 pl-4 pr-2 font-medium",children:j.actions})]})}),n.jsxs("tbody",{children:[N.map((E,L)=>{const M=E.status??"schedule";return n.jsxs("tr",{className:"text-zinc-500",children:[n.jsx("td",{className:"px-2 py-3",children:L+1}),n.jsx("td",{className:"overflow-hidden px-2 py-3",children:n.jsx("span",{className:"block w-full truncate",children:E.id||`PMT-${L+1}`})}),n.jsx("td",{className:"px-2 py-3",children:y.format(E.amount)}),n.jsx("td",{className:"px-2 py-3",children:Gt(E.dueDate,s)}),n.jsx("td",{className:"whitespace-nowrap px-2 py-3",children:n.jsx(Ms,{status:M})}),n.jsx("td",{className:"whitespace-nowrap py-3 pl-4 pr-2",children:n.jsx(Is,{status:M,installment:E,labels:j,portalContainer:m??void 0,showDelete:o,payNowHiddenStatuses:l,onPayInstallment:h,onDeleteInstallment:g})})]},E.id)}),N.length===0&&n.jsx("tr",{children:n.jsx("td",{colSpan:6,className:"px-2 py-6 text-center text-zinc-500",children:j.noInstallmentsFound})})]})]})})]});return n.jsx("div",{ref:v,className:"vvt-ps relative min-w-0 w-full overflow-x-hidden [container-type:inline-size] font-sans text-zinc-900",children:r?n.jsx(d.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:n.jsx(d.AccordionItem,{"aria-label":j.title,title:k,children:S},"installment-table")}):S})}function Ms({status:e}){return n.jsx(d.Chip,{size:"md",radius:"lg",className:d.cn("justify-center px-4",Ls[e]??Ls.schedule),startContent:n.jsx(xd,{status:e}),children:tr[e]??e})}function Is({status:e,installment:t,labels:s,portalContainer:a,showDelete:r,payNowHiddenStatuses:i,onPayInstallment:o,onDeleteInstallment:l}){const c=!i.includes(e);return n.jsxs("div",{className:"flex min-w-36 items-center justify-start gap-2",children:[c?n.jsx(R,{type:"button",size:"md",color:"primary",variant:"solid",radius:"full",className:"min-w-[104px] shrink-0",isDisabled:e==="paid",startContent:n.jsx(V,{icon:"solar:dollar-minimalistic-outline",className:"size-4"}),onPress:()=>o?.(t),children:s.payNow}):null,n.jsx(hd,{isFulfilled:e==="paid",showDelete:r,labels:s,portalContainer:a,onDelete:()=>l(t.id)})]})}function hd({isFulfilled:e,showDelete:t,labels:s,portalContainer:a,onDelete:r}){const[i,o]=x.useState(!1);return n.jsxs(n.Fragment,{children:[n.jsxs(d.Dropdown,{placement:"bottom-end",radius:"lg",children:[n.jsx(d.DropdownTrigger,{children:n.jsx(R,{type:"button",isIconOnly:!0,size:"sm",variant:"light",className:"text-zinc-900","aria-label":"More actions",children:n.jsx(V,{icon:"solar:menu-dots-bold",className:"size-4"})})}),n.jsxs(d.DropdownMenu,{"aria-label":"Installment actions",disabledKeys:e?["send-link","delete"]:[],className:"w-72 p-2",onAction:l=>{l==="delete"&&t&&!e&&o(!0)},children:[n.jsx(d.DropdownSection,{title:"Actions",showDivider:t,children:n.jsx(d.DropdownItem,{textValue:s.sendLink,description:s.sendLinkDescription,startContent:n.jsx(V,{icon:"solar:link-outline",className:"size-5 text-zinc-500"}),children:s.sendLink},"send-link")}),t?n.jsx(d.DropdownSection,{title:s.dangerZone,children:n.jsx(d.DropdownItem,{textValue:s.deleteInstallment,className:"text-danger-600",color:"danger",description:s.deleteInstallmentDescription,startContent:n.jsx(V,{icon:"solar:trash-bin-minimalistic-outline",className:"size-5"}),children:s.deleteInstallment},"delete")}):null]})]}),t?n.jsx(Lt,{isOpen:i,labels:{title:s.deleteInstallmentConfirmationTitle,description:s.deleteInstallmentConfirmationDescription,cancel:s.deleteInstallmentConfirmationCancel,confirm:s.deleteInstallmentConfirmationConfirm},icon:n.jsx(V,{icon:"solar:danger-triangle-outline",className:"size-7"}),confirmColor:"danger",portalContainer:a,shouldBlockScroll:!1,classNames:ud,onClose:()=>o(!1),onConfirm:()=>{o(!1),r()}}):null]})}function xd({status:e}){return e==="paid"?n.jsx(V,{icon:"solar:check-circle-bold",className:"size-3"}):e==="failed"?n.jsx(V,{icon:"solar:close-circle-bold",className:"size-3"}):n.jsx(V,{icon:"solar:calendar-outline",className:"size-3"})}function Gt(e,t){const s=new Date(`${e}T00:00:00`);return Number.isNaN(s.getTime())?e:new Intl.DateTimeFormat(t,{month:"short",day:"numeric",year:"numeric"}).format(s)}const pd={title:"Select Membership",renewalTitle:"Automatic Renewal",renewalDescription:"Membership will automatically renew at the end of each period"},gd=({cards:e,locale:t,currency:s,listHeightClassName:a="",labels:r,showRenewal:i=!0,defaultRenewalValue:o=!1,initialSelectedMembershipId:l=null,allowReselect:c=!0,onRenewalChange:u,onCardSelect:f,className:h=""})=>{const g=Array.isArray(e)?e:[],[m,v]=x.useState(l),[j,b]=x.useState(o),w={...pd,...r};x.useEffect(()=>{v(l)},[l]);const y=N=>{if(N===m){c&&f?.(N);return}v(N),f?.(N)},k=N=>{b(N),u?.(N)};return n.jsxs("div",{className:d.cn("w-full flex flex-col gap-4 items-start p-4 h-svh",h),"data-testid":"membership-select-cards",children:[n.jsx("span",{className:"hidden","data-testid":"membership-select-cards-selected-id",children:m??""}),n.jsx("p",{className:"text-2xl font-semibold text-left","data-testid":"membership-select-cards-title",children:w.title}),i&&n.jsx(rr,{title:w.renewalTitle,description:w.renewalDescription,value:j,onValueChange:k}),n.jsx("div",{className:d.cn("w-full min-h-0 flex flex-col gap-4 overflow-y-auto",a===""?"flex-1":d.cn("shrink-0",a)),"data-testid":"membership-select-cards-list",children:g.map(N=>n.jsx(nr,{itemKey:N.id,name:N.name,type:N.type,price:N.price,locale:t,currency:s,isSelected:m===N.id,onSelect:y},N.id))})]})},nr=({itemKey:e,name:t,type:s,price:a,locale:r="en-US",currency:i="USD",showPrice:o=!0,isSelected:l=!1,onSelect:c,compact:u=!1,isDisabled:f=!1,disabledReason:h,statusLabel:g,statusTone:m="default",className:v=""})=>{const j=new Intl.NumberFormat(r,{style:"currency",currency:i,minimumFractionDigits:0,maximumFractionDigits:2}).format(a),b=!!c&&!f,w=h||g,y=()=>{b&&c?.(e)};return n.jsx(d.Card,{shadow:"none",isPressable:!!c,onPress:y,className:d.cn("w-full min-h-fit border rounded-3xl",l?"border-primary bg-primary/5":"border-default",f?"opacity-60":"",u?"rounded-2xl":"",v),"data-testid":"item-card","data-selected":l,isDisabled:f,children:n.jsxs("div",{className:d.cn("px-4 py-8 flex gap-6 items-center justify-between",u&&"px-3 py-3 gap-4"),children:[n.jsxs("div",{className:"w-max flex flex-col gap-1 items-start",children:[n.jsx("p",{className:d.cn("font-semibold text-left",u?"text-sm":"text-xl"),"data-testid":"item-card-name",children:t}),s&&n.jsx("div",{"data-testid":"item-card-type",className:"w-fit bg-default-300 px-4 py-2 text-sm rounded-xl",children:n.jsx("p",{className:"text-center",children:s})}),w&&n.jsx(d.Chip,{"data-testid":"item-card-status",color:m,size:"sm",variant:"flat",className:"px-2",children:w})]}),o&&n.jsx("p",{className:d.cn("font-semibold text-right",u?"text-lg":"text-2xl"),"data-testid":"item-card-price",children:j})]})})},Ts="w-full bg-gray-100",Ps={variant:"light",color:"default"},sr=({id:e,title:t,media:s,imageUrl:a,imageAlt:r,imageClassName:i="",imageAspect:o="aspect-[4/3]",meta:l=[],price:c,action:u,footer:f,onPress:h,isPressable:g=!1,isDisabled:m=!1,compact:v=!1,className:j="",bodyClassName:b="",footerClassName:w="",dataTestId:y})=>{const k=!!(c&&c.value),N=!!u?.label,S=g&&!!h&&!N,E=!S,L=N?{variant:u?.variant??Ps.variant,color:u?.color??Ps.color,size:u?.size??"sm",isDisabled:m||u?.isDisabled,startContent:u?.icon?n.jsx(V,{icon:u.icon,width:16}):void 0}:null,M=s??(a?n.jsx("div",{className:d.cn("relative overflow-hidden rounded-xl",o,Ts,i),children:n.jsx(d.Image,{removeWrapper:!0,src:a,alt:r||t,className:"size-full object-cover",classNames:{wrapper:"absolute inset-0"}})}):n.jsx("div",{className:d.cn("relative overflow-hidden rounded-xl",o,Ts,"grid place-items-center",i),"data-testid":`catalog-item-card-${e??"media"}-fallback`,children:n.jsx(V,{icon:"solar:ticket-outline",width:48,className:"text-default-400"})}));return n.jsxs(d.Card,{"data-testid":y||`catalog-item-card-${e??"item"}`,className:d.cn("w-full overflow-hidden",j),isPressable:S,onPress:h,isDisabled:m,shadow:"sm",radius:"lg",children:[n.jsx("div",{children:M}),n.jsxs(d.CardBody,{className:d.cn("gap-3",v?"p-3":"p-4",b),children:[n.jsx("h3",{"data-testid":`catalog-item-card-title-${e??""}`,className:d.cn("line-clamp-2 text-base font-semibold text-gray-900",v?"text-sm":""),children:t}),l.length>0?n.jsx("div",{className:"flex flex-col gap-1.5 text-sm text-gray-600","data-testid":`catalog-item-card-meta-${e??""}`,children:l.map(($,O)=>n.jsxs("span",{className:"flex items-center gap-2",children:[n.jsx(V,{icon:$.icon,className:"size-4 text-gray-400",width:16}),n.jsx("span",{children:$.label})]},`${$.label}-${O}`))}):null,(k||N)&&n.jsxs("div",{className:d.cn("flex items-center justify-end gap-2 pt-1 text-sm",v?"pt-0.5":"",w),children:[k?n.jsxs("span",{className:d.cn("mr-auto text-gray-500",v?"text-xs":""),"data-testid":`catalog-item-card-price-${e??""}`,children:[c?.label&&n.jsxs("span",{children:[c.label," "]}),n.jsx("span",{className:"font-semibold text-brand",children:c?.value})]}):n.jsx("span",{className:"ml-auto","aria-hidden":!0}),N&&E?n.jsx(R,{className:d.cn("rounded-full",u?.className),onPress:u?.onPress,variant:L?.variant,color:L?.color,size:L?.size,startContent:L?.startContent,isDisabled:L?.isDisabled,"aria-label":u?.ariaLabel||u?.label,children:u?.label}):null]}),f?n.jsx("div",{className:"pt-1",children:f}):null]})]})};sr.displayName="CatalogItemCard";const bd={card:"gap-3 rounded-xl border border-dashed px-6 py-12",panel:"px-6 py-[72px]"},yd={card:"size-12 rounded-2xl",panel:"size-[76px] rounded-[20px] border mb-[18px]"},vd={card:"text-base font-medium text-default-900",panel:"text-[17px] font-semibold text-acct-ink"},jd={card:"max-w-sm text-sm text-default-600",panel:"max-w-[380px] text-sm text-acct-sub mt-1.5"},wd={card:"mt-1",panel:"mt-[22px]"},Nd="bg-acct-page border-acct-border text-acct-muted",Cd={empty:"solar:inbox-line-duotone",error:"solar:danger-triangle-outline",success:"solar:check-circle-bold"},Sd={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"},kd={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"},Ad={empty:"status",error:"alert",success:"status",loading:"status"},$d={empty:"polite",error:"assertive",success:"polite",loading:"polite"};function Dd(e,t,s,a){if(t===!1)return null;if(e==="loading"&&t===void 0)return n.jsx(d.Spinner,{size:"lg",color:"primary",className:a.spinner});if(x.isValidElement(t))return n.jsx(n.Fragment,{children:t});const r=typeof t=="string"?t:Cd[e];return r?n.jsx(V,{icon:r,width:s,height:s,"aria-hidden":"true",className:a.icon}):null}function et({variant:e="empty",surface:t="card",title:s,titleAs:a="p",description:r,icon:i,actions:o,role:l=Ad[e],ariaLive:c=$d[e],iconSize:u=24,className:f,classNames:h={},"data-testid":g="feedback-state"}){const m=Dd(e,i,u,h);return n.jsxs("div",{role:l,"aria-live":c,"data-variant":e,"data-testid":g,"data-surface":t,className:d.cn("flex flex-col items-center justify-center text-center",bd[t],t==="card"?Sd[e]:"bg-transparent",f,h.base),children:[m?n.jsx("span",{"aria-hidden":"true","data-testid":`${g}-icon`,className:d.cn("inline-flex items-center justify-center",yd[t],e==="success"&&t==="card"&&"rounded-full",t==="panel"?Nd:kd[e],h.iconWrapper),children:m}):null,n.jsxs("div",{className:d.cn("flex flex-col items-center",t==="card"&&"gap-1"),children:[n.jsx(a,{"data-testid":`${g}-title`,className:d.cn(vd[t],h.title),children:s}),r?n.jsx("p",{"data-testid":`${g}-description`,className:d.cn(jd[t],h.description),children:r}):null]}),o?n.jsx("div",{"data-testid":`${g}-actions`,className:d.cn("flex flex-wrap items-center justify-center gap-2",wd[t],h.actions),children:o}):null]})}function Pn(e){return n.jsx(et,{...e,variant:"empty"})}function _n(e){return n.jsx(et,{...e,variant:"error"})}function On(e){return n.jsx(et,{...e,variant:"loading"})}function ar(e){return n.jsx(et,{...e,variant:"success"})}et.displayName="FeedbackState";Pn.displayName="EmptyState";_n.displayName="ErrorState";On.displayName="LoadingState";ar.displayName="SuccessState";const rr=({title:e,value:t,description:s,onValueChange:a,className:r=""})=>{const i=x.useId();return n.jsxs("div",{className:d.cn("w-full flex flex-row items-center",e||s?"justify-between gap-6":"justify-start",r),"data-testid":"toggle",children:[n.jsxs("div",{className:"flex flex-col items-start",children:[e&&n.jsx("label",{htmlFor:i,className:"font-medium text-left","data-testid":"toggle-title",children:e}),s&&n.jsx("p",{className:"text-left text-gray-500","data-testid":"toggle-description",children:s})]}),n.jsx(d.Switch,{id:i,isSelected:t,onValueChange:a,"data-testid":"toggle-switch"})]})},Ed={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"},Fd=(e,t)=>new Intl.NumberFormat(e,{style:"currency",currency:t}),ir=e=>Object.values(e).reduce((t,s)=>t+Object.values(s).reduce((a,r)=>a+Object.values(r).reduce((i,o)=>i+o.selectedQuantity,0),0),0),Ld=e=>e.reduce((t,s)=>t+s.dates.reduce((a,r)=>a+r.tickets.reduce((i,o)=>i+o.max,0),0),0),Rn=e=>e.flatMap(t=>t.dates.flatMap(s=>s.tickets.map(a=>({exhibition:t,dateGroup:s,ticket:a})))),_s=(e,t,s)=>{const a={};let r=s?t??Ld(e):0;for(const{exhibition:i,dateGroup:o,ticket:l}of Rn(e)){a[i.id]??={},a[i.id][o.id]??={};const c=s?Math.min(l.max,r):0;a[i.id][o.id][l.id]={id:l.id,selectedQuantity:c,originalPrice:l.originalPrice,discountedPrice:l.price},r-=c}return a},Os=(e,t,s)=>`${e}::${t}::${s}`,Md=(e,t,s)=>{const a=ir(t);for(const{exhibition:r,dateGroup:i,ticket:o}of Rn(e)){const l=t[r.id]?.[i.id]?.[o.id]?.selectedQuantity??0,c=s===void 0?o.max:Math.min(o.max,s-(a-l));if(c>0&&l<c)return!1}return!0},Id=({initialQuantity:e=1,minQuantity:t=1,maxQuantity:s=10,onChange:a,disabled:r=!1})=>{const i=Math.max(t,Math.min(s,e)),[o,l]=x.useState(()=>String(i)),[c,u]=x.useState(!1),f=c?o:String(i),h=()=>{r||i>=s||a?.(i+1)},g=()=>{r||i<=t||a?.(i-1)},m=N=>{if(r)return;l(N.target.value);const S=parseInt(N.target.value,10);isNaN(S)||a?.(Math.max(t,Math.min(s,S)))},v=N=>{const S=parseInt(N.target.value,10);if(u(!1),isNaN(S)){a?.(t);return}const E=Math.max(t,Math.min(s,S));E!==S?a?.(E):l(String(E))},j=i<=t,b=i>=s,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",y="bg-primary hover:bg-primary/80",k="bg-primary/40 cursor-not-allowed";return n.jsxs("div",{className:"flex items-center gap-4","data-testid":"quantity-selector",children:[n.jsx("button",{type:"button",onClick:g,disabled:r||j,className:d.cn(w,r||j?k:y),"aria-label":"Decrement quantity","data-testid":"quantity-decrement",children:"-"}),n.jsx("input",{type:"number",value:f,onChange:m,onFocus:()=>u(!0),onBlur:v,disabled:r,min:t,max:s,step:"1",className:"w-12 h-10 rounded-md border-0 bg-zinc-100 text-center text-2xl font-medium text-zinc-900 [appearance:textfield] [&::-webkit-inner-spin-button]:appearance-none [&::-webkit-outer-spin-button]:appearance-none","aria-label":`Selected quantity: ${i}`,"data-testid":"quantity-input"}),n.jsx("button",{type:"button",onClick:h,disabled:r||b,className:d.cn(w,r||b?k:y),"aria-label":"Increment quantity","data-testid":"quantity-increment",children:"+"})]})},Td=({label:e,checked:t=!1,onChange:s,disabled:a=!1})=>{const r=()=>{a||s?.(!t)};return n.jsxs("button",{type:"button",onClick:r,disabled:a,role:"checkbox","aria-checked":t,"data-testid":"checkbox-button","data-checked":t,className:d.cn("flex items-center gap-1.5 px-4 py-3 border-0 rounded-full cursor-pointer text-sm min-h-[30px]","outline-none select-none transition-colors bg-zinc-100 hover:bg-zinc-200 text-primary",a&&"cursor-not-allowed opacity-60"),children:[n.jsxs("span",{className:"relative flex items-center justify-center w-5 h-5 flex-shrink-0",children:[n.jsx("input",{type:"checkbox",checked:t,onChange:()=>{},disabled:a,className:"absolute opacity-0 w-0 h-0 pointer-events-none",tabIndex:-1,readOnly:!0}),n.jsx("span",{className:d.cn("block w-3.5 h-3.5 rounded-sm relative",t?"bg-primary":"bg-white ring-1 ring-zinc-300"),children:t&&n.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"})})]}),n.jsx("p",{className:"flex-1 m-0 text-left leading-snug",children:e})]})},Pd=({item:e,quantity:t,onChange:s,getTotalSelectedTickets:a,userMaxLimit:r,settings:i,labels:o})=>{const l=()=>{if(!a||r===void 0)return e.max;const h=a();return Math.min(e.max,r-(h-t))},c=i?.locale??"en-US",u=i?.currency??"USD",f=Fd(c,u);return n.jsxs("div",{children:[n.jsxs("div",{className:"flex items-center justify-between bg-white px-3 py-2.5 gap-8","data-testid":"upgrade-ticket-item",children:[n.jsxs("div",{className:"min-w-0 flex flex-1 flex-col gap-2",children:[n.jsxs("div",{className:"flex min-w-0 items-start gap-3",children:[n.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?n.jsx("span",{"data-testid":"ticket-purchased-quantity",children:` x${e.purchasedQuantity}`}):null]}),n.jsxs("div",{className:"flex shrink-0 items-center gap-1.5",children:[n.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)}),n.jsx("h3",{className:"text-base font-semibold text-zinc-900 m-0","data-testid":"ticket-discounted-price",children:f.format(e.price)})]})]}),e.membershipName?n.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:n.jsx("p",{className:"max-w-full truncate text-center",children:e.membershipName})}):null,n.jsx("div",{className:"text-sm text-zinc-500",children:n.jsxs("p",{className:"m-0","data-testid":"ticket-max",children:[o.ticketsAllowedToRedeem," ",e.max]})})]}),n.jsx(Id,{initialQuantity:t,minQuantity:0,maxQuantity:l(),onChange:s})]}),e.membershipAlert?n.jsx(d.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:n.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]})},_d=({exhibitionId:e,dateGroup:t,isLast:s=!1,onQuantityChange:a,getTicketQuantity:r,getTotalSelectedTickets:i,userMaxLimit:o,settings:l,labels:c})=>n.jsxs("div",{className:d.cn("flex flex-col gap-2 pb-3",!s&&"border-b border-zinc-200"),"data-testid":"upgrade-ticket-date-group",children:[n.jsx("p",{className:"m-0 text-sm text-left text-zinc-500","data-testid":"upgrade-ticket-date",children:t.date}),t.tickets.map((u,f)=>n.jsxs("div",{children:[n.jsx(Pd,{item:u,quantity:r(e,t.id,u.id),onChange:h=>a(e,t.id,u.id,h),getTotalSelectedTickets:i,userMaxLimit:o,settings:l,labels:c}),f<t.tickets.length-1?n.jsx(d.Divider,{className:"bg-zinc-200","data-testid":"upgrade-ticket-divider"}):null]},u.id))]}),Od=({title:e,exhibition:t,onQuantityChange:s,getTicketQuantity:a,getTotalSelectedTickets:r,userMaxLimit:i,settings:o,labels:l,initialExpanded:c=!1})=>{const[u,f]=x.useState(c),h=t.dates.reduce((m,v)=>m+v.tickets.reduce((j,b)=>j+a(t.id,v.id,b.id),0),0),g=t.dates.some(m=>m.tickets.length>0);return n.jsxs("div",{className:"w-full overflow-hidden border-b border-zinc-200","data-testid":"upgrade-ticket-header",children:[n.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-${t.id}`,"data-testid":"upgrade-ticket-header-button",children:n.jsxs("div",{className:"flex justify-between items-center w-full gap-6",children:[n.jsx("h4",{className:"m-0 text-base font-semibold text-left text-zinc-900","data-testid":"upgrade-ticket-header-title",children:e}),n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsxs("p",{className:"m-0 text-sm text-right text-zinc-500","data-testid":"upgrade-ticket-header-count",children:[h," ",l.ticketsSelectedToRedeem]}),n.jsx("span",{className:d.cn("inline-flex items-center justify-center text-zinc-500 text-xl transition-transform duration-200",u&&"rotate-180"),"aria-hidden":"true",children:n.jsx(V,{icon:"mdi:chevron-down"})})]})]})}),n.jsx("div",{id:`upgrade-items-${t.id}`,className:d.cn("transition-all duration-300 overflow-hidden",u?"max-h-[1000px] opacity-100":"max-h-0 opacity-0"),"aria-hidden":!u,children:u&&n.jsx("div",{className:"px-5 flex flex-col gap-6","data-testid":"upgrade-ticket-items",children:g?t.dates.map((m,v)=>n.jsx(_d,{exhibitionId:t.id,dateGroup:m,isLast:v===t.dates.length-1,onQuantityChange:s,getTicketQuantity:a,getTotalSelectedTickets:r,userMaxLimit:i,settings:o,labels:l},m.id)):n.jsx("div",{className:"px-5 py-10 text-center",children:n.jsx("p",{className:"m-0 text-zinc-500 italic",children:l.noUpgradeTicketsAvailable})})})})]})},Rd=({initialExpanded:e=!1,userMaxLimit:t,labels:s,settings:a,ticketSelectionData:r,className:i="",onSelectionChange:o})=>{const l=x.useMemo(()=>r??[],[r]),c={...Ed,...s},[u,f]=x.useState(()=>_s(l,t,!0)),h=x.useRef(!1),g=x.useMemo(()=>{const y=Rn(l).map(({exhibition:k,dateGroup:N,ticket:S})=>[Os(k.id,N.id,S.id),S]);return new Map(y)},[l]),m=Md(l,u,t),v=(y,k,N)=>u[y]?.[k]?.[N]?.selectedQuantity??0,j=()=>ir(u),b=(y,k,N,S)=>{const E=v(y,k,N),L=j()-E;if(t!==void 0&&L+S>t)return;const M=g.get(Os(y,k,N));if(!M)return;const $={...u,[y]:{...u[y],[k]:{...u[y]?.[k],[N]:{id:N,selectedQuantity:S,originalPrice:M.originalPrice,discountedPrice:M.price}}}};f($),o?.($)},w=y=>{const k=_s(l,t,y);f(k),o?.(k)};return x.useEffect(()=>{!h.current&&m&&(o?.(u),h.current=!0)},[m,u,o]),n.jsxs("div",{className:d.cn("flex flex-col w-full font-sans",i),"data-testid":"ticket-selection",children:[n.jsxs("div",{className:"flex items-center justify-between py-2 gap-4","data-testid":"ticket-selection-header",children:[n.jsx("h3",{className:"text-xl font-semibold m-0","data-testid":"ticket-selection-title",children:c.ticketSelectionTitle}),n.jsx(Td,{label:c.selectAllButtonLabel,checked:m,onChange:w})]}),l.map(y=>n.jsx(Od,{title:y.exhibitionName,exhibition:y,onQuantityChange:b,getTicketQuantity:v,getTotalSelectedTickets:j,userMaxLimit:t,settings:a,labels:c,initialExpanded:e},y.id))]})},Qt={confirm:"Confirm",clear:"Clear",noLabel:"Filters"},Zt=e=>{const t={};for(const s of e)s.type==="checkbox"?t[s.id]=[...s.selectedValues]:t[s.id]=s.selectedValue?[s.selectedValue]:[];return t},zd=(e,t)=>{const s={};for(const a of t){if(a.type==="checkbox"){s[a.id]=e[a.id]??[...a.selectedValues];continue}const r=e[a.id]??[];s[a.id]=r.length>0?r[0]:null}return s},Bd=e=>e.type==="checkbox"?e.selectedValues.length>0:e.selectedValue!==null,lr=({triggerLabel:e,triggerAriaLabel:t,triggerIcon:s="solar:tuning-square-outline",triggerVariant:a="bordered",triggerColor:r="default",triggerSize:i="sm",triggerClassName:o,popoverClassName:l,className:c,sections:u,onConfirm:f,onClear:h,appliedCount:g,countAriaLabel:m,countDisplay:v="badge",confirmLabel:j=Qt.confirm,clearLabel:b=Qt.clear,isOpen:w,defaultOpen:y=!1,onOpenChange:k,isDisabled:N=!1,closeOnConfirm:S=!0,keepOpenAfterClear:E=!1})=>{const[L,M]=x.useState(y),[$,O]=x.useState(()=>Zt(u)),F=w??L,A=g??u.filter(U=>Bd(U)).length,I=U=>{U&&O(Zt(u)),w||M(U),k?.(U)},P=(U,Z)=>{O(Q=>({...Q,[U.id]:Z}))},G=(U,Z)=>{O(Q=>({...Q,[U.id]:Z?[Z]:[]}))},q=async()=>{O(Zt(u.map(U=>U.type==="checkbox"?{...U,selectedValues:[]}:{...U,selectedValue:null}))),await h(),E||I(!1)},W=async()=>{const U=zd($,u);await f(U),S&&I(!1)},ee=U=>{if(U.type==="checkbox")return n.jsx(d.CheckboxGroup,{label:U.label,value:$[U.id]??[],onValueChange:Q=>P(U,Q),children:U.options.map(Q=>n.jsx(d.Checkbox,{value:Q.value,isDisabled:Q.isDisabled,children:Q.label},Q.value))},U.id);const Z=$[U.id]?.[0]??"";return n.jsx(d.RadioGroup,{label:U.label,value:Z,onValueChange:Q=>G(U,Q||null),children:U.options.map(Q=>n.jsx(d.Radio,{value:Q.value,isDisabled:Q.isDisabled,children:Q.label},Q.value))},U.id)},ae=x.useMemo(()=>A>0?m?.(A)||`${A} filters applied`:void 0,[m,A]),re=x.useMemo(()=>A===0?e||Qt.noLabel:m?m(A):`${e} (${A})`,[A,e,m]);return n.jsx("div",{className:c,children:n.jsxs(d.Popover,{isOpen:F,onOpenChange:I,placement:"bottom-end",children:[n.jsx(d.PopoverTrigger,{children:n.jsxs(R,{isDisabled:N,variant:a,color:r,size:i,className:o,"aria-label":t,"aria-haspopup":"dialog","aria-expanded":F,children:[n.jsx(V,{icon:s,width:16}),n.jsx("span",{children:e}),v==="badge"&&A>0?n.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":ae,children:A}):v==="summary"&&re!==e?n.jsx("span",{className:"text-xs",children:re}):null]})}),n.jsx(d.PopoverContent,{className:l,children:n.jsxs("div",{className:"flex w-full flex-col gap-5 px-4 py-4",children:[u.map(U=>ee(U)),n.jsxs("div",{className:"flex items-center justify-end gap-2 border-t border-gray-200 pt-3",children:[n.jsx(R,{variant:"light",color:"default",size:"sm",onPress:q,children:b}),n.jsx(R,{color:"primary",size:"sm",onPress:W,children:j})]})]})})]})})};lr.displayName="FilterPopover";const Vd="No sessions available for this date",Ud=e=>e==="sold-out"||e==="closed"?"danger":"success",Hd=e=>{const t=e.seatsRemaining;return e.status==="sold-out"||e.status==="closed"?"Sold out":e.status==="limited"?typeof t=="number"?`${t} left`:"Limited":typeof t=="number"?`${t} seats available`:"Available"},Rs=e=>e.isDisabled?!0:e.status==="sold-out"||e.status==="closed",qd=(e,t)=>t&&e.some(s=>s.date===t)?t:e[0]?.date??null,or=({heading:e,subheading:t,days:s,selectedDate:a,onDateSelect:r,quickDates:i,selectedSessionId:o=null,onSessionSelect:l,emptyStateMessage:c=Vd,statusLabel:u,statusTone:f,sessionAriaLabel:h,dayButtonClassName:g,calendarSlot:m,dayGroupAriaLabel:v,sessionGridAriaLabel:j,className:b,headingClassName:w,subheadingClassName:y})=>{const k=qd(s,a),N=s.find($=>$.date===k),S=i??s.map($=>({date:$.date,label:$.label})),E=N?.sessions??[],L=$=>$===k?"solid":"bordered",M=$=>{if(!Rs($)){if($.id===o){l(null);return}l($.id)}};return n.jsxs("section",{className:d.cn("flex flex-col gap-4 rounded-xl bg-white p-3 sm:p-4",b),"data-testid":"session-timeline-root",children:[n.jsxs("header",{className:"flex flex-col gap-1",children:[n.jsx("h2",{className:d.cn("text-base font-semibold text-gray-900",w),children:e}),t?n.jsx("p",{className:d.cn("text-sm text-gray-700",y),children:t}):null]}),n.jsxs("div",{className:"flex flex-wrap items-center gap-2",role:"group","aria-label":v||"Session days",children:[S.map($=>n.jsx(R,{size:"sm",variant:L($.date),color:"default",className:d.cn("rounded-full",g),isDisabled:$.isDisabled,onPress:()=>{r($.date)},children:n.jsx("span",{children:$.label})},$.date)),m?n.jsx("div",{children:m}):null]}),n.jsxs("ul",{className:"grid grid-cols-1 gap-2 sm:grid-cols-3","aria-label":j||"Sessions",children:[E.length===0?n.jsx("li",{className:"rounded-lg bg-white px-4 py-6 text-center text-sm text-gray-600 sm:col-span-3",children:c}):null,E.map($=>{const O=Rs($),F=$.id===o;return n.jsx("li",{className:"rounded-xl",children:n.jsx(d.Card,{shadow:"sm",radius:"lg",isPressable:!O,onPress:()=>{M($)},"aria-disabled":O,"aria-pressed":O?void 0:F,className:d.cn("w-full",O?"bg-gray-100 opacity-70":"",F?"w-full ring-2 ring-gray-900":""),"aria-label":h?h($,{isSelected:F,isUnavailable:O}):O?`${$.startTime} ${$.endTime} sold out`:`${$.startTime} ${$.endTime} available`,children:n.jsxs(d.CardBody,{className:"flex flex-col items-center gap-3 p-4 text-center",children:[n.jsxs("span",{className:"text-sm font-semibold text-gray-900",children:[$.startTime," – ",$.endTime]}),n.jsx(d.Chip,{size:"sm",color:f?f($):Ud($.status),variant:"flat",children:u?u($):Hd($)})]})})},$.id)})]})]})};or.displayName="SessionTimeline";const Wd=(e,t)=>typeof e=="string"?n.jsx(V,{icon:e,className:"size-5","aria-hidden":"true"}):e||t||null,cr=({title:e,subtitle:t,eyebrow:s,icon:a,initials:r,actions:i,titleAs:o="h1",className:l,classNames:c={},"data-testid":u="page-header"})=>{const f=Wd(a,r);return n.jsxs("header",{"data-testid":u,className:d.cn("flex flex-wrap items-start justify-between gap-4",l,c.base),children:[n.jsxs("div",{className:"flex items-center gap-4",children:[f?n.jsx("div",{"aria-hidden":"true","data-testid":`${u}-icon`,className:d.cn("flex size-12 shrink-0 items-center justify-center rounded-xl bg-gray-900 text-sm font-semibold text-white",c.iconWrapper),children:f}):null,n.jsxs("div",{children:[s?n.jsx("p",{"data-testid":`${u}-eyebrow`,className:d.cn("text-brand text-sm font-medium uppercase tracking-wide",c.eyebrow),children:s}):null,n.jsx(o,{"data-testid":`${u}-title`,className:d.cn("text-3xl font-semibold text-gray-950",c.title),children:e}),t?n.jsx("p",{"data-testid":`${u}-subtitle`,className:d.cn("mt-1 text-sm text-gray-600",c.subtitle),children:t}):null]})]}),i?n.jsx("div",{"data-testid":`${u}-actions`,className:d.cn("flex flex-wrap items-center gap-2",c.actions),children:i}):null]})};cr.displayName="PageHeader";const Yd={active:"success",success:"success",draft:"warning",pending:"warning",warning:"warning",danger:"danger",archived:"default",inactive:"default",neutral:"default"},Kd={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"}},dr=({status:e,label:t,variant:s="flat",size:a="sm",color:r,startContent:i,className:o,"data-testid":l="status-chip"})=>{if(s==="dot"){const c=Kd[e];return n.jsxs("span",{"data-testid":l,"data-status":e,className:d.cn("inline-flex items-center gap-1.5 whitespace-nowrap rounded-full px-2.5 py-[3px] text-[12px] font-semibold leading-[1.4]",o),style:{color:c.fg,backgroundColor:c.bg},children:[n.jsx("span",{"aria-hidden":"true",className:"size-1.5 shrink-0 rounded-full",style:{backgroundColor:"currentColor"}}),t]})}return n.jsx(d.Chip,{color:r??Yd[e],variant:s,size:a,startContent:i,"data-testid":l,"data-status":e,className:d.cn("font-medium",o),children:t})};dr.displayName="StatusChip";const Gd={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"},zn=({label:e,value:t,size:s="sm",className:a,"data-testid":r="key-value-chip"})=>n.jsxs("span",{"data-testid":r,className:d.cn("inline-flex items-baseline whitespace-nowrap border border-default-200 bg-default-100",Gd[s],a),children:[n.jsx("span",{className:"font-medium text-default-400",children:e}),n.jsx("span",{className:"font-semibold text-default-700",children:t})]});zn.displayName="KeyValueChip";const ur=({columns:e,rows:t=6,label:s="Loading",barHeight:a=12,alignLastRight:r=!1,className:i,classNames:o={},"data-testid":l="table-skeleton"})=>n.jsxs("div",{role:"status","aria-busy":"true","data-testid":l,className:d.cn("w-full",i,o.base),children:[n.jsx("span",{className:"sr-only",children:s}),n.jsx("div",{"aria-hidden":"true",children:Array.from({length:t}).map((c,u)=>n.jsx("div",{"data-testid":`${l}-row`,className:d.cn("flex items-center gap-3 border-t border-default-100 px-5 py-4",o.row),children:e.map((f,h)=>{const g=h===e.length-1;return n.jsx("div",{className:d.cn(f==="fill"?"flex-1":"shrink-0",r&&g&&"flex justify-end"),style:f==="fill"?void 0:{width:f},children:n.jsx("div",{className:d.cn("animate-pulse rounded bg-default-200",o.bar),style:{height:a,width:f==="fill"?"60%":f}})},h)})},u))})]});ur.displayName="TableSkeleton";const fr="text-left text-[11px] font-semibold uppercase tracking-[.04em] text-acct-sub px-4 pt-4 pb-3 whitespace-nowrap bg-transparent",mr="px-4 text-[13.5px] text-acct-ink2 align-middle",hr="border-t border-acct-hair transition-colors duration-150 hover:bg-acct-page data-[hover=true]:bg-acct-page",xr="w-full",pr="border-t border-acct-border px-5 py-3.5",gr=({columns:e,children:t,emptyContent:s,footer:a,ariaLabel:r,className:i,classNames:o={},"data-testid":l="admin-table"})=>n.jsxs("div",{className:d.cn(i,o.base),"data-testid":l,children:[n.jsxs(d.Table,{"aria-label":r,removeWrapper:!0,classNames:{table:d.cn(xr,o.table),th:d.cn(fr,o.th),tr:d.cn(hr,o.tr),td:d.cn(mr,o.td)},children:[n.jsx(d.TableHeader,{columns:e,children:c=>n.jsx(d.TableColumn,{align:c.align==="right"?"end":"start",width:c.width,children:c.label},c.key)}),n.jsx(d.TableBody,{emptyContent:s,children:t})]}),a?n.jsx("div",{"data-testid":`${l}-footer`,className:d.cn(pr,o.footer),children:a}):null]});gr.displayName="AdminTable";const Qd={md:"w-[280px]",lg:"w-[360px]"},br=({searchValue:e,onSearchChange:t,searchLabel:s,searchPlaceholder:a,searchIcon:r,children:i,trailing:o,searchWidth:l="md",className:c,"data-testid":u="admin-toolbar"})=>n.jsxs("div",{role:"search","data-testid":u,className:d.cn("flex flex-wrap items-center gap-3 mb-4",c),children:[n.jsx(d.Input,{type:"search","aria-label":s,placeholder:a??s,value:e,onValueChange:t,startContent:r?n.jsx("span",{"aria-hidden":"true",className:"flex text-acct-muted",children:r}):void 0,"data-testid":`${u}-search`,variant:"bordered",radius:"none",classNames:{base:Qd[l],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,o?n.jsx("div",{className:"ml-auto",children:o}):null]});br.displayName="AdminToolbar";function yr({items:e,value:t,onChange:s,ariaLabel:a,className:r,"data-testid":i="underline-tabs"}){return n.jsx(d.Tabs,{"aria-label":a,variant:"underlined",selectedKey:t,onSelectionChange:o=>s(String(o)),"data-testid":i,classNames:{base:d.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"},children:e.map(o=>n.jsx(d.Tab,{title:o.label,"data-testid":`${i}-${o.key}`},o.key))})}yr.displayName="UnderlineTabs";const vr="text-[11px] font-semibold uppercase tracking-[.04em] text-acct-muted mb-1.5",Zd="font-normal normal-case tracking-normal",jr=["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(" "),wr="text-[13.5px] text-acct-ink",Nr="bg-acct-page text-acct-muted cursor-default",Cr="mt-[5px] text-xs text-acct-sub",Sr="mt-[5px] text-xs text-acct-danger",kr=({label:e,labelSuffix:t,value:s,onChange:a,placeholder:r,disabled:i=!1,readOnly:o=!1,mono:l=!1,autoFocus:c=!1,hint:u,invalid:f=!1,className:h,"data-testid":g="admin-text-field"})=>n.jsx(d.Input,{labelPlacement:e?"outside":void 0,label:e&&t?n.jsxs(n.Fragment,{children:[e,n.jsxs("span",{className:Zd,children:[" ",t]})]}):e,value:s,placeholder:r,isDisabled:i,isReadOnly:o,autoFocus:c,isInvalid:f,description:!f&&u?u:void 0,errorMessage:f?u:void 0,onValueChange:a,"data-testid":g,variant:"bordered",radius:"none",classNames:{base:d.cn("w-full",h),label:vr,inputWrapper:jr,input:d.cn(wr,(l||o)&&"font-mono",o&&Nr),description:Cr,errorMessage:Sr}});kr.displayName="AdminTextField";const Xd={sm:"size-6 min-w-6",md:"size-[30px] min-w-[30px]"},Ar=({actions:e,size:t="md",className:s,"data-testid":a="row-actions"})=>n.jsx("div",{role:"presentation","data-testid":a,className:d.cn("inline-flex gap-0.5",s),onClick:r=>r.stopPropagation(),children:e.map(r=>n.jsx(R,{isIconOnly:!0,variant:"light",radius:"sm",size:"sm",onPress:r.onPress,isDisabled:r.disabled,"aria-label":r.label,title:r.label,"data-testid":`${a}-${r.key}`,className:d.cn("text-acct-sub data-[hover=true]:bg-acct-hair",Xd[t]),children:r.icon},r.key))});Ar.displayName="RowActions";const $r=({children:e,placeholder:t="Select…",onOpen:s,onClear:a,ariaLabel:r,icon:i,trailingIcon:o,clearIcon:l,disabled:c=!1,className:u,"data-testid":f="picker-row"})=>{const h=e!=null;return n.jsxs("div",{"data-testid":f,className:d.cn("flex w-full min-h-10 items-center rounded-[10px] border border-acct-border bg-acct-surface px-[11px] transition-colors duration-150",c?"opacity-60":"hover:border-acct-rust-border",u),children:[n.jsxs(R,{variant:"light",radius:"none",disableAnimation:!0,onPress:s,isDisabled:c,"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?n.jsx("span",{className:"flex shrink-0 text-acct-muted",children:i}):null,h?n.jsx("span",{className:"flex min-w-0 items-center gap-2",children:e}):n.jsx("span",{className:"text-[13.5px] font-semibold text-acct-sub",children:t}),o?n.jsx("span",{className:"ml-auto flex shrink-0 text-acct-muted",children:o}):null]}),h&&a?n.jsx(R,{isIconOnly:!0,variant:"light",radius:"sm",size:"sm",onPress:a,isDisabled:c,"aria-label":`Clear ${r}`,title:"Clear","data-testid":`${f}-clear`,className:"ml-1.5 size-6 min-w-6 shrink-0 text-acct-muted data-[hover=true]:bg-acct-hair",children:l}):null]})};$r.displayName="PickerRow";function Dr(e,t,s){if(s<=0||t<=0||e<=0)return{from:0,to:0};const a=(e-1)*t+1;return a>s?{from:0,to:0}:{from:a,to:Math.min(s,e*t)}}const Er=({page:e,pageSize:t,total:s,unit:a,announce:r=!0,className:i,classNames:o={},"data-testid":l="pagination-summary"})=>{const{from:c,to:u}=Dr(e,t,s),f=d.cn("font-semibold text-default-700",o.emphasis);return n.jsxs("p",{"data-testid":l,"aria-live":r?"polite":void 0,className:d.cn("text-sm text-default-500",i,o.base),children:["Showing"," ",n.jsx("span",{"data-testid":`${l}-range`,className:f,children:c===0?0:`${c}–${u}`})," ","of"," ",n.jsx("span",{"data-testid":`${l}-total`,className:f,children:s}),a?n.jsxs(n.Fragment,{children:[" ",a]}):null]})};Er.displayName="PaginationSummary";const Fr=({isLoading:e=!1,isError:t=!1,isEmpty:s=!1,loadingTitle:a="Loading…",loadingContent:r,errorTitle:i="Something went wrong",errorDescription:o,retryLabel:l="Retry",onRetry:c,errorActions:u,errorContent:f,emptyTitle:h="Nothing here yet",emptyDescription:g,emptyIcon:m,emptyActions:v,emptyContent:j,children:b,className:w,classNames:y={},"data-testid":k="list-panel"})=>{const N={base:d.cn("border-0 bg-transparent py-12",y.state)};let S;return e?S=r??n.jsx(On,{title:a,classNames:N,"data-testid":`${k}-loading`}):t?S=f??n.jsx(_n,{title:i,description:o,classNames:N,"data-testid":`${k}-error`,actions:u??(c?n.jsx(R,{color:"primary",variant:"flat",onPress:c,children:l}):void 0)}):s?S=j??n.jsx(Pn,{title:h,description:g,icon:m,actions:v,classNames:N,"data-testid":`${k}-empty`}):S=b,n.jsx("section",{"data-testid":k,className:d.cn("rounded-xl bg-white p-2 shadow-sm",w,y.base),children:S})};Fr.displayName="ListPanel";const Jd=350,eu={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}"},Xt=(e,t)=>Object.entries(t).reduce((s,[a,r])=>s.replace(`{${a}}`,r),e),tu=({dueAmount:e,received:t,defaultReceived:s=null,onChange:a,locale:r="en-US",labels:i,isDisabled:o=!1,maxAmount:l,autoFocus:c=!1,className:u,"data-testid":f="cash-tender-form"})=>{const h={...eu,...i},g=An(e.currency,r),m=t!==void 0,[v,j]=x.useState(s??null),b=m?t:v,w=x.useMemo(()=>{const I=typeof b=="number"&&Number.isFinite(b)?b:0,P=ln(I,e.value,e.currency,r);return{received:I,change:P>0?P:0,isValid:I>=e.value&&I>0}},[b,e.value,e.currency,r]),y=x.useCallback(I=>{const P=I.currentTarget;requestAnimationFrame(()=>{P.isConnected&&P.select()})},[]),k=x.useCallback(I=>{if(o)return;const P=I.replace(/[^\d.,]/g,"").replace(",","."),G=P===""?null:Number.parseFloat(P),q=G===null||Number.isNaN(G)?null:G;if(q!==null&&l!==void 0&&q>l)return;m||j(q);const W=typeof q=="number"&&Number.isFinite(q)?q:0,ee=ln(W,e.value,e.currency,r);a?.({received:W,change:ee>0?ee:0,isValid:W>=e.value&&W>0})},[m,o,e.value,e.currency,r,a,l]),N=b==null?"":String(b),S=w.isValid&&w.change>0,E=!w.isValid&&w.received>0,L=we(w.change,r,e.currency),M=we(e.value,r,e.currency),[$,O]=x.useState(""),F=x.useRef(null);x.useEffect(()=>{F.current&&clearTimeout(F.current);const I=S?Xt(h.changeMessageTemplate,{change:L}):"",P=S?Jd:0;return F.current=setTimeout(()=>O(I),P),()=>{F.current&&clearTimeout(F.current)}},[S,L,h.changeMessageTemplate]);const A=`${f}-received`;return n.jsxs("div",{className:d.cn("flex flex-col gap-3",u),"data-testid":f,children:[n.jsx(d.Input,{id:A,label:h.receivedLabel,labelPlacement:"outside",type:"text",inputMode:g===0?"numeric":"decimal",pattern:g===0?"[0-9]*":"[0-9]*[.,]?[0-9]*",value:N,onChange:I=>k(I.target.value),onFocus:y,placeholder:h.receivedPlaceholder,isDisabled:o,isInvalid:E,errorMessage:E?Xt(h.insufficientMessageTemplate,{due:M}):void 0,variant:"bordered",radius:"lg",autoFocus:c,"data-testid":`${f}-received-input`}),S&&n.jsx(d.Alert,{"data-testid":`${f}-change-alert`,color:"primary",variant:"flat",radius:"lg",title:h.changeLabel,description:Xt(h.changeMessageTemplate,{change:L}),icon:n.jsx(V,{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"}}),n.jsx("span",{role:"status","aria-live":"polite",className:"sr-only",children:$})]})},nu={checkNumberLabel:"Check Number",checkNumberPlaceholder:"e.g. 11234",bankNameLabel:"Bank Name",bankNamePlaceholder:"e.g. Chase Bank",dateLabel:"Date",checkNumberRequiredMessage:"Check number is required"},zs=()=>{const e=new Date,t=s=>String(s).padStart(2,"0");return`${e.getFullYear()}-${t(e.getMonth()+1)}-${t(e.getDate())}`},Lr=({dueAmount:e,value:t,defaultValue:s,onChange:a,labels:r,hideDate:i=!1,hideBankName:o=!1,isDisabled:l=!1,checkNumberMaxLength:c=34,bankNameMaxLength:u=100,autoFocus:f=!1,className:h,"data-testid":g="check-tender-form"})=>{const m={...nu,...r},v=t!==void 0,[j,b]=x.useState({checkNumber:s?.checkNumber??"",bankName:s?.bankName??"",date:s?.date??zs()}),[w,y]=x.useState(!!s?.checkNumber),k=x.useMemo(()=>v?{checkNumber:t?.checkNumber??"",bankName:t?.bankName??"",date:t?.date??zs()}:j,[v,t,j]),N=x.useCallback(F=>{v||b(F);const A=F.checkNumber.trim(),I={amount:e.value,checkNumber:A,bankName:F.bankName.trim()||void 0,date:i?void 0:F.date,isValid:A.length>0&&e.value>0};a?.(I)},[v,e.value,i,a]),S=x.useCallback(F=>A=>{l||(F==="checkNumber"&&A.length>0&&y(!0),N({...k,[F]:A}))},[k,N,l]),E=x.useCallback(()=>{l||y(!0)},[l]),L=w&&k.checkNumber.trim()==="",M=`${g}-check-number`,$=`${g}-bank-name`,O=`${g}-date`;return n.jsxs("div",{className:d.cn("grid grid-cols-1 sm:grid-cols-2 gap-4",h),"data-testid":g,children:[n.jsx(d.Input,{id:M,label:m.checkNumberLabel,labelPlacement:"outside",type:"text",value:k.checkNumber,onChange:F=>S("checkNumber")(F.target.value),onBlur:E,placeholder:m.checkNumberPlaceholder,maxLength:c,isRequired:!0,isInvalid:L,errorMessage:L?m.checkNumberRequiredMessage:void 0,isDisabled:l,variant:"bordered",radius:"lg",autoFocus:f,"data-testid":`${g}-check-number-input`}),!o&&n.jsx(d.Input,{id:$,label:m.bankNameLabel,labelPlacement:"outside",type:"text",value:k.bankName,onChange:F=>S("bankName")(F.target.value),placeholder:m.bankNamePlaceholder,maxLength:u,isDisabled:l,variant:"bordered",radius:"lg","data-testid":`${g}-bank-name-input`}),!i&&n.jsx(d.Input,{id:O,label:m.dateLabel,labelPlacement:"outside",type:"date",value:k.date,onChange:F=>S("date")(F.target.value),isDisabled:l,variant:"bordered",radius:"lg","data-testid":`${g}-date-input`,className:"sm:col-span-2"})]})};Lr.displayName="CheckTenderForm";const su={methodLabel:"Method",methodPlaceholder:"Select a payment method",referenceLabel:"Reference",referencePlaceholder:"e.g. Voucher #1234",methodRequiredMessage:"Method is required"},au=[{value:"ach",label:"ACH"},{value:"wire",label:"Wire"},{value:"gift_card",label:"Gift Card"},{value:"voucher",label:"Voucher"},{value:"other",label:"Other"}],Mr=({dueAmount:e,methodOptions:t=au,value:s,defaultValue:a,onChange:r,labels:i,showReference:o=!1,isDisabled:l=!1,className:c,"data-testid":u="other-tender-form"})=>{const f={...su,...i},h=s!==void 0,[g,m]=x.useState({method:a?.method??"",reference:a?.reference??""}),v=x.useMemo(()=>h?{method:s?.method??"",reference:s?.reference??""}:g,[h,s,g]),j=x.useCallback(S=>t.find(E=>E.value===S)?.label??"",[t]),b=x.useCallback(S=>{h||m(S);const E=j(S.method),L={amount:e.value,method:S.method,description:E,reference:S.reference.trim()||void 0,isValid:S.method!==""};r?.(L)},[h,e.value,r,j]),w=x.useCallback(S=>{if(l)return;const E=typeof S=="string"?S:Array.from(S)[0]?.toString()??"";b({...v,method:E})},[v,b,l]),y=x.useCallback(S=>{l||b({...v,reference:S})},[v,b,l]),k=`${u}-method`,N=`${u}-reference`;return n.jsxs("div",{className:d.cn("flex flex-col gap-3",c),"data-testid":u,children:[n.jsx(Ie,{id:k,label:f.methodLabel,labelPlacement:"outside",placeholder:f.methodPlaceholder,selectedKeys:v.method?[v.method]:[],onSelectionChange:w,isDisabled:l,isRequired:!0,variant:"bordered",radius:"lg","data-testid":`${u}-method-select`,popoverProps:{placement:"bottom-start",classNames:{content:"bg-white border border-default-200 shadow-lg rounded-xl p-1"}},listboxProps:{classNames:{list:"max-h-[var(--popover-available-height,40vh)] overflow-y-auto"},itemClasses:{base:["rounded-lg","px-3 py-2","text-default-800","data-[hover=true]:bg-default-100","data-[selectable=true]:focus:bg-default-100","data-[selected=true]:bg-primary-50","data-[selected=true]:text-primary","data-[selected=true]:font-medium"]}},children:t.map(S=>n.jsx(d.SelectItem,{"data-testid":`${u}-method-option-${S.value}`,children:S.label},S.value))}),o&&n.jsx(d.Input,{id:N,label:f.referenceLabel,labelPlacement:"outside",type:"text",value:v.reference,onChange:S=>y(S.target.value),placeholder:f.referencePlaceholder,isDisabled:l,variant:"bordered",radius:"lg","data-testid":`${u}-reference-input`})]})};Mr.displayName="OtherTenderForm";const ru={collectedHeading:"Collected",remainingLabel:"Remaining:",completeLabel:"Complete",removeAriaLabel:"Remove this tender",removeTooltipForRecorded:"Already recorded",statusPending:"Pending",statusRecorded:"Approved",statusFailed:"Failed"},iu={card:"lucide:credit-card",cash:"lucide:dollar-sign",check:"lucide:edit-3",other:"lucide:more-horizontal"},lu={pending:"warning",recorded:"success",failed:"danger"},ou=e=>e==="pending"||e==="recorded",cu=e=>`#${e+1}`,Ir=({total:e,tenders:t,onRemove:s,locale:a="en-US",labels:r,hideCollectedList:i=!1,className:o,"data-testid":l="split-payment-summary"})=>{const c={...ru,...r},{collected:u,remaining:f,isComplete:h}=x.useMemo(()=>{const m=t.reduce((j,b)=>ou(b.status)?j+b.amount:j,0),v=Math.max(e.value-m,0);return{collected:m,remaining:v,isComplete:m>=e.value&&e.value>0}},[t,e.value]),g=m=>m==="pending"?c.statusPending:m==="recorded"?c.statusRecorded:c.statusFailed;return n.jsxs("div",{className:d.cn("flex flex-col gap-4",o),"data-testid":l,children:[n.jsxs("div",{className:"rounded-2xl bg-default-100 px-6 py-5 text-center","data-testid":`${l}-remaining-banner`,children:[n.jsx("div",{className:"text-sm text-default-600",children:h?c.completeLabel:c.remainingLabel}),n.jsx("div",{className:"mt-1 text-4xl font-bold tracking-tight","data-testid":`${l}-remaining-amount`,children:we(h?u:f,a,e.currency)})]}),!i&&t.length>0&&n.jsxs("div",{className:"flex flex-col gap-2","data-testid":`${l}-collected-list`,children:[n.jsx("h3",{className:"text-base font-semibold",children:c.collectedHeading}),t.map((m,v)=>n.jsx(du,{index:v,tender:m,locale:a,currency:e.currency,removable:!!s&&m.status!=="recorded",onRemove:s?()=>s(m.id):void 0,statusLabel:g(m.status),removeAriaLabel:c.removeAriaLabel,recordedTooltip:c.removeTooltipForRecorded,dataTestId:`${l}-row-${v}`},m.id))]})]})};Ir.displayName="SplitPaymentSummary";const du=({index:e,tender:t,locale:s,currency:a,removable:r,onRemove:i,statusLabel:o,removeAriaLabel:l,recordedTooltip:c,dataTestId:u})=>{const f=i?n.jsx(R,{isIconOnly:!0,variant:"light",radius:"full",size:"sm",onPress:i,isDisabled:!r,"aria-label":l,"data-testid":`${u}-remove`,className:d.cn(r?"text-default-700 hover:bg-default-200":"text-default-300"),children:n.jsx(V,{icon:"lucide:x",width:18,height:18,"aria-hidden":"true"})}):null;return n.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:[n.jsx("span",{className:"text-sm font-medium text-default-500 w-6 shrink-0",children:cu(e)}),n.jsx(V,{icon:iu[t.type],width:20,height:20,className:"text-default-700 shrink-0","aria-hidden":"true"}),n.jsx("span",{className:"flex-1 truncate","data-testid":`${u}-label`,children:t.label}),n.jsx("span",{className:"font-semibold tabular-nums","data-testid":`${u}-amount`,children:we(t.amount,s,a)}),n.jsx(d.Chip,{size:"sm",radius:"full",variant:"flat",color:lu[t.status],startContent:t.status==="recorded"?n.jsx(V,{icon:"lucide:check-circle",width:14,height:14,"aria-hidden":"true"}):t.status==="failed"?n.jsx(V,{icon:"lucide:alert-circle",width:14,height:14,"aria-hidden":"true"}):void 0,"data-testid":`${u}-status`,children:o}),f&&(r?f:n.jsx(d.Tooltip,{content:c,placement:"left",children:n.jsx("span",{tabIndex:0,"aria-label":c,children:f})}))]})},uu=`
|
|
16
|
+
`,"aria-label":`Zoom level ${e}%`,children:[e,"%"]})}),n.jsx(d.Tooltip,{content:"Zoom in",placement:"top",offset:10,children:n.jsx(R,{size:"sm",radius:"sm",color:"default",variant:"bordered",isIconOnly:!0,isDisabled:u,onPress:o,"aria-label":"Zoom in",children:n.jsx(K.ZoomIn,{size:16})})})]})}function Fo({editor:e,isDisabled:t=!1}){const[s,a]=x.useState(!1),[r,i]=x.useState(""),[o,l]=x.useState(""),[c,u]=x.useState(!1),f=e.isActive("link"),h=m=>{if(m){const{from:v,to:j}=e.state.selection,b=e.isActive("link");let w="";if(b){const k=e.schema.marks.link,N=e.state.doc.resolve(v),S=Jn.getMarkRange(N,k);S&&(w=e.state.doc.textBetween(S.from,S.to,""))}else w=e.state.doc.textBetween(v,j,"");const y=e.getAttributes("link").href||"";i(w),l(y),u(b)}a(m)},g=()=>{if(o.trim()){const{from:m,to:v}=e.state.selection,j=e.schema.marks.link,b=e.state.doc.resolve(m),w=Jn.getMarkRange(b,j),y=w?.from??m,k=w?.to??v,N=e.state.doc.textBetween(y,k,"");r.trim()&&r!==N?e.chain().focus().setTextSelection({from:y,to:k}).deleteSelection().insertContent(`<a href="${o.trim()}">${r.trim()}</a>`).run():e.chain().focus().extendMarkRange("link").updateAttributes("link",{href:o.trim()}).run()}a(!1)};return n.jsxs(d.Popover,{isOpen:s,onOpenChange:h,placement:"bottom",children:[n.jsx(d.PopoverTrigger,{children:n.jsx(R,{size:"sm",radius:"sm",variant:f?"solid":"bordered",color:f?"primary":"default",isIconOnly:!0,isDisabled:t,"aria-label":"Link",children:n.jsx(K.Link,{size:16})})}),n.jsx(d.PopoverContent,{children:n.jsxs("div",{className:"flex flex-col gap-3 p-3 w-72",children:[n.jsx(d.Input,{size:"sm",variant:"bordered",label:"Name",labelPlacement:"outside",placeholder:"Link text",value:r,onChange:m=>i(m.target.value),classNames:{inputWrapper:"focus-within:border-default-400"}}),n.jsx(d.Input,{size:"sm",variant:"bordered",label:"Link",labelPlacement:"outside",placeholder:"https://example.com",value:o,onChange:m=>l(m.target.value),onKeyDown:m=>m.key==="Enter"&&g(),classNames:{inputWrapper:"focus-within:border-default-400"}}),n.jsx(R,{size:"sm",color:"primary",onPress:g,isDisabled:!o.trim(),children:c?"Update":"Apply"})]})})]})}function Lo({children:e,id:t,label:s,className:a,useButtonGroup:r=!0}){return r?n.jsx(d.ButtonGroup,{size:"sm",id:t,"aria-label":s,className:a,children:e}):n.jsx("div",{id:t,role:"group","aria-label":s,className:`flex items-center gap-2 ${a||""}`,children:e})}function ka(e,t){const s=x.useMemo(()=>{if(!e)return{};const i={};return Array.from(new Set(t.map(l=>ut(l)))).forEach(l=>{const c=Me[l];if(c)try{const u=c.canExecute?.(e)??!0,f=c.isActive?.(e)??!1;i[l]={isActive:f,isDisabled:!u,canExecute:u}}catch(u){console.warn(`Extension not available for modifier: ${l}`,u),i[l]={isActive:!1,isDisabled:!0,canExecute:!1}}}),i},[e,t]),[a,r]=x.useState(s);return x.useEffect(()=>{if(!e)return;const i=()=>{const o={};Array.from(new Set(t.map(c=>ut(c)))).forEach(c=>{const u=Me[c];if(u)try{const f=u.canExecute?.(e)??!0,h=u.isActive?.(e)??!1;o[c]={isActive:h,isDisabled:!f,canExecute:f}}catch(f){console.warn(`Extension not available for modifier: ${c}`,f),o[c]={isActive:!1,isDisabled:!0,canExecute:!1}}}),r(o)};return e.on("selectionUpdate",i),e.on("transaction",i),()=>{e.off("selectionUpdate",i),e.off("transaction",i)}},[e,t,s]),a}function Aa(e,t){const s=x.useCallback((o,l)=>{if(!e)return;const c=Me[o];if(c)try{c.execute({editor:e,config:l}),t?.({type:"toggle",modifier:o})}catch(u){console.warn(`Failed to execute command for modifier: ${o}`,u)}},[e,t]),a=x.useCallback(o=>{s(o)},[s]),r=x.useCallback((o,l)=>{if(!e)return!1;const c=Me[o];try{return c?.canExecute?.(e,l)??!1}catch(u){return console.warn(`Failed to check canExecute for modifier: ${o}`,u),!1}},[e]),i=x.useCallback((o,l)=>{if(!e)return!1;const c=Me[o];try{return c?.isActive?.(e,l)??!1}catch(u){return console.warn(`Failed to check isActive for modifier: ${o}`,u),!1}},[e]);return{executeCommand:s,toggleModifier:a,canExecute:r,isActive:i}}function Mo(e=pe.default){const[t,s]=x.useState(e),a=x.useCallback((l=pe.step)=>{s(c=>Math.min(pe.max,c+l))},[]),r=x.useCallback((l=pe.step)=>{s(c=>Math.max(pe.min,c-l))},[]),i=x.useCallback(()=>{s(pe.default)},[]),o=x.useCallback(l=>{const c=Math.max(pe.min,Math.min(pe.max,l));s(c)},[]);return{zoom:t,setZoom:o,zoomIn:a,zoomOut:r,resetZoom:i,isMinZoom:t<=pe.min,isMaxZoom:t>=pe.max,isDefaultZoom:t===pe.default}}const Io=["bold","italic","strike","underline","code"];function To({editor:e,modifiers:t,onToolbarAction:s}){const a=ka(e,t),{toggleModifier:r}=Aa(e,s);if(!e)return null;const i=t.map(o=>ut(o)).filter(o=>Io.includes(o));return i.length===0?null:n.jsx(Lo,{id:"text-formatting",label:"Text formatting",children:i.map(o=>{const l=a[o],c=Qe(o);return n.jsx(qe,{icon:c,label:o.charAt(0).toUpperCase()+o.slice(1),isActive:l?.isActive,isDisabled:l?.isDisabled,onClick:()=>r(o)},o)})})}function Po({editor:e,modifiers:t,zoom:s=100,onZoomChange:a,sticky:r=!0,className:i,onToolbarAction:o}){const l=ka(e,t),{toggleModifier:c,executeCommand:u}=Aa(e,o);if(!e)return null;const f=t.map(L=>ut(L)),h=f.some(L=>["bold","italic","strike","underline","code"].includes(L)),g=f.some(L=>["textColor","highlight"].includes(L)),m=f.includes("heading"),v=f.includes("textAlign"),j=f.some(L=>["bulletList","orderedList","taskList"].includes(L)),b=f.includes("blockquote"),w=f.includes("codeBlock"),y=f.includes("link"),k=f.includes("horizontalRule"),N=f.some(L=>["undo","redo"].includes(L)),S=s!==void 0&&a!==void 0,E=r?"sticky top-0 z-10":"";return n.jsx("div",{className:`w-full p-2 bg-background border-b border-divider ${E} ${i||""}`,children:n.jsxs("div",{className:"flex flex-row flex-wrap gap-2 w-full items-center",children:[h&&n.jsxs(n.Fragment,{children:[n.jsx(To,{editor:e,modifiers:t,onToolbarAction:o}),(g||m||v||j||b||w||y||k||N||S)&&n.jsx(He,{})]}),g&&n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"flex items-center gap-1",children:[f.includes("textColor")&&n.jsx(ys,{editor:e,type:"textColor",label:"Text color",isDisabled:l.textColor?.isDisabled}),f.includes("highlight")&&n.jsx(ys,{editor:e,type:"highlight",label:"Highlight",isDisabled:l.highlight?.isDisabled})]}),(m||v||j||b||w||y||k||N||S)&&n.jsx(He,{})]}),m&&n.jsxs(n.Fragment,{children:[n.jsx(wo,{editor:e}),(v||j||b||w||y||k||N||S)&&n.jsx(He,{})]}),v&&n.jsxs(n.Fragment,{children:[n.jsx("div",{className:"flex items-center gap-1",children:["left","center","right","justify"].map(L=>{const M=$o[L],$=e.isActive({textAlign:L});return n.jsx(qe,{icon:M,label:`Align ${L}`,isActive:$,onClick:()=>u("textAlign",{type:"textAlign",alignment:L})},L)})}),(j||b||w||y||k||N||S)&&n.jsx(He,{})]}),j&&n.jsxs(n.Fragment,{children:[n.jsx(No,{editor:e,types:f.filter(L=>["bulletList","orderedList","taskList"].includes(L))}),(b||w||y||k||N||S)&&n.jsx(He,{})]}),(b||w||y||k)&&n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"flex items-center gap-1",children:[b&&n.jsx(qe,{icon:Qe("blockquote"),label:"Blockquote",isActive:l.blockquote?.isActive,isDisabled:l.blockquote?.isDisabled,onClick:()=>c("blockquote")}),w&&n.jsx(qe,{icon:Qe("codeBlock"),label:"Code block",isActive:l.codeBlock?.isActive,isDisabled:l.codeBlock?.isDisabled,onClick:()=>c("codeBlock")}),y&&n.jsx(Fo,{editor:e,isDisabled:l.link?.isDisabled}),k&&n.jsx(qe,{icon:Qe("horizontalRule"),label:"Horizontal rule",onClick:()=>c("horizontalRule")})]}),(N||S)&&n.jsx(He,{})]}),N&&n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"flex items-center gap-1",children:[f.includes("undo")&&n.jsx(qe,{icon:Qe("undo"),label:"Undo",isDisabled:l.undo?.isDisabled,onClick:()=>c("undo")}),f.includes("redo")&&n.jsx(qe,{icon:Qe("redo"),label:"Redo",isDisabled:l.redo?.isDisabled,onClick:()=>c("redo")})]}),S&&n.jsx(He,{})]}),S&&n.jsx(Eo,{zoom:s,onZoomChange:L=>{a?.(L),o?.({type:"zoom",modifier:`${L}%`})}})]})})}const st={bold:{category:"mark",extension:ci.Bold,priority:100},italic:{category:"mark",extension:di.Italic,priority:100},strike:{category:"mark",extension:ui.Strike,priority:100},underline:{category:"mark",extension:fi.Underline,priority:100},code:{category:"mark",extension:mi.Code,priority:100},textColor:{category:"mark",extension:hi.Color,defaultOptions:{types:["textStyle","heading","paragraph","listItem","taskItem","blockquote"]},priority:90},highlight:{category:"mark",extension:xi.Highlight,defaultOptions:{multicolor:!0},priority:90},link:{category:"mark",extension:pi.Link,defaultOptions:{autolink:!0,linkOnPaste:!0,openOnClick:!1,HTMLAttributes:{class:"text-primary underline cursor-pointer"}},priority:100},heading:{category:"node",extension:bi.Heading,defaultOptions:{levels:[1,2,3,4,5,6]},priority:100},bulletList:{category:"node",extension:vi.BulletList,defaultOptions:{HTMLAttributes:{class:"list-disc"}},priority:90},orderedList:{category:"node",extension:ji.OrderedList,defaultOptions:{HTMLAttributes:{class:"list-decimal"}},priority:90},taskList:{category:"node",extension:wi.TaskList,defaultOptions:{HTMLAttributes:{class:"task-list"}},priority:90},codeBlock:{category:"node",extension:Si.CodeBlock,priority:100},blockquote:{category:"node",extension:ki.Blockquote,priority:100},horizontalRule:{category:"node",extension:Ai.HorizontalRule,priority:100},hardBreak:{category:"node",extension:$i.HardBreak,priority:100},undo:{category:"extension",extension:es.History,priority:50},redo:{category:"extension",extension:es.History,priority:50},textAlign:{category:"extension",extension:Di.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}},_o=[Ei.Document,Fi.Text,yi.Paragraph,gi.TextStyle.configure({HTMLAttributes:{}}),Ci.ListItem.configure({HTMLAttributes:{}}),Ni.TaskItem.configure({nested:!0}),Li.Dropcursor,Mi.Gapcursor];function Oo(e){const t=[],s=new Set,a=new Set;_o.forEach(l=>{l&&(t.push(l),a.add(l.name))});const r=e.map(l=>ut(l)),i=new Set;return r.forEach(l=>{const c=st[l];c?.requiredExtensions&&c.requiredExtensions.forEach(u=>{i.add(u)})}),i.forEach(l=>{if(s.has(l))return;const c=st[l];if(!c||c.extension===null)return;const u=c.extension.name;if(a.has(u)){s.add(l);return}const f=c.defaultOptions?c.extension.configure(c.defaultOptions):c.extension;t.push(f),s.add(l),a.add(u)}),r.forEach(l=>{if(s.has(l))return;const c=st[l];if(!c){console.warn(`Extension config not found for modifier: ${l}`);return}if(c.extension===null){s.add(l);return}const u=c.extension.name;if(a.has(u)){s.add(l);return}const f=c.defaultOptions?c.extension.configure(c.defaultOptions):c.extension;t.push(f),s.add(l),a.add(u)}),t.sort((l,c)=>{const u=Object.values(st).find(m=>m?.extension?.name===l.name),f=Object.values(st).find(m=>m?.extension?.name===c.name),h=u?.priority??100;return(f?.priority??100)-h})}const $a={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"]},Ro={h1:`font-size: ${ce.fontSize["4xl"]}; font-weight: ${ce.fontWeight.semibold}; line-height: ${ce.lineHeight.tight}; margin: ${le.md} 0 ${le.sm} 0;`,h2:`font-size: ${ce.fontSize["2xl"]}; font-weight: ${ce.fontWeight.semibold}; line-height: ${ce.lineHeight.tight}; margin: ${le.md} 0 ${le.sm} 0;`,h3:`font-size: ${ce.fontSize.xl}; font-weight: ${ce.fontWeight.semibold}; line-height: ${ce.lineHeight.tight}; margin: ${le.md} 0 ${le.sm} 0;`,h4:`font-size: ${ce.fontSize.lg}; font-weight: ${ce.fontWeight.semibold}; line-height: ${ce.lineHeight.tight}; margin: ${le.md} 0 ${le.sm} 0;`,h5:`font-size: ${ce.fontSize.base}; font-weight: ${ce.fontWeight.semibold}; line-height: ${ce.lineHeight.tight}; margin: ${le.md} 0 ${le.sm} 0;`,h6:`font-size: ${ce.fontSize.sm}; font-weight: ${ce.fontWeight.semibold}; line-height: ${ce.lineHeight.tight}; margin: ${le.md} 0 ${le.sm} 0;`,p:`min-height: ${ce.lineHeight.normal}em; margin: 0;`,ul:`list-style-type: disc; list-style-position: outside; padding-left: ${le.xl}; margin: ${le.md} 0;`,ol:`list-style-type: decimal; list-style-position: outside; padding-left: ${le.xl}; margin: ${le.md} 0;`,li:`display: list-item; margin: ${le.xs} 0;`,strong:`font-weight: ${ce.fontWeight.bold};`,em:"font-style: italic;",s:"text-decoration: line-through;",u:"text-decoration: underline;",code:`background-color: ${ge.neutral.gray[100]}; border-radius: 0.4rem; font-size: ${ce.fontSize.sm}; padding: 0.25em 0.3em; font-family: ${ce.fontFamily.mono};`,pre:`background: ${ge.neutral.gray[800]}; border-radius: ${le.sm}; color: ${ge.neutral.gray[100]}; font-family: ${ce.fontFamily.mono}; margin: ${le.lg} 0; padding: 0.75rem ${le.md}; overflow-x: auto;`,blockquote:`border-left: 3px solid ${ge.neutral.gray[300]}; margin: ${le.lg} 0; padding-left: ${le.md}; color: ${ge.neutral.gray[500]};`,hr:`border: none; border-top: 1px solid ${ge.neutral.gray[200]}; margin: ${le.xl} 0;`,a:`color: ${ge.brand.primary.DEFAULT}; text-decoration: underline; cursor: pointer;`,mark:`background-color: ${ge.palettes.warning[200]}; border-radius: ${le.xs}; padding: 0 0.125rem;`,label:`display: flex; align-items: center; gap: ${le.sm}; cursor: pointer;`,input:"cursor: pointer; margin: 0;"},zo={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 Bo(e){if(!e)return e;let t=e;for(const[s,a]of Object.entries(zo)){const r=new RegExp(`(<(?:ul|li)[^>]*data-type="${s}"[^>]*)>`,"gi");t=t.replace(r,(i,o)=>i.includes('style="')?i.replace(/style="([^"]*)"/,`style="$1 ${a}"`):`${o} style="${a}">`)}for(const[s,a]of Object.entries(Ro)){const r=new RegExp(`<${s}(\\s[^>]*)?>`,"gi");t=t.replace(r,i=>{if(i.includes('data-type="taskList"')||i.includes('data-type="taskItem"'))return i;if(i.includes('style="'))return i.replace(/style="([^"]*)"/,`style="$1 ${a}"`);if(i.includes("style='"))return i.replace(/style='([^']*)'/,`style='$1 ${a}'`);{const o=i.indexOf(">");return`${i.slice(0,o)} style="${a}"${i.slice(o)}`}})}return t}const Vo=({modifiers:e,zoom:t,onZoomChange:s,onToolbarAction:a})=>{const{editor:r}=hn.useCurrentEditor();return n.jsx(Po,{editor:r,modifiers:e,zoom:t,onZoomChange:s,onToolbarAction:a})},Uo=({showCharacterCount:e,showWordCount:t})=>{const{editor:s}=hn.useCurrentEditor();if(!s||!e&&!t)return null;const a=s.getText(),r=a.length,i=a.split(/\s+/).filter(o=>o.length>0).length;return n.jsxs("div",{className:"flex gap-4 text-xs text-default-500 px-2 pb-1",children:[e&&n.jsxs("span",{children:[r," characters"]}),t&&n.jsxs("span",{children:[i," words"]})]})},on=x.forwardRef((e,t)=>{const{minRows:s=10,maxRows:a=30,disableAutosize:r=!1,showCharacterCount:i=!1,showWordCount:o=!1,showToolbar:l=!0,modifiers:c=$a.full,variant:u="bordered",initialContent:f,content:h,onContentChange:g,onUpdate:m,onToolbarAction:v,isReadOnly:j=!1,isDisabled:b=!1,includeInlineStyles:w=!0,...y}=e,{zoom:k,setZoom:N}=Mo(),S=bs.lineHeight,E=s*S,L=r?void 0:a*S,M=x.useMemo(()=>Oo(c),[c]),{Component:$,label:O,shouldLabelBeOutside:F,getBaseProps:A,getLabelProps:I,getInputWrapperProps:P}=d.useInput({...y,variant:u,ref:t,isMultiline:!0}),G=O?n.jsx("label",{...I(),children:O}):null,q=x.useCallback(({editor:W})=>{const ee=W.getHTML(),ae=w?Bo(ee):ee,re=W.getJSON(),U=W.getText(),Z=U.length,Q=U.split(/\s+/).filter(X=>X.length>0).length,H={html:ae,json:re,text:U,characters:Z,words:Q};if(g?.(H),m?.(H),"onChange"in y&&typeof y.onChange=="function"){const X={target:{value:ae},currentTarget:{value:ae}};y.onChange(X)}},[g,m,y,w]);return n.jsxs($,{...A(),children:[F?G:null,n.jsx("div",{...P(),className:d.cn(P().className,"flex flex-col w-full p-0 gap-0 rich-text-editor"),style:{maxHeight:L?`${L+bs.toolbarHeight}px`:void 0,overflow:L?"auto":void 0},children:n.jsx(hn.EditorProvider,{editable:!j&&!b,slotBefore:l?n.jsx(Vo,{modifiers:c,zoom:k,onZoomChange:N,onToolbarAction:v}):void 0,slotAfter:n.jsx(Uo,{showCharacterCount:i,showWordCount:o}),editorContainerProps:{className:"w-full flex-1 outline-none",style:{minHeight:`${E}px`,fontSize:`${k}%`,display:"flex",flexDirection:"column"}},editorProps:{attributes:{class:"focus:outline-none w-full h-full"}},extensions:M,content:h||f||e.defaultValue||"",onUpdate:q})})]})});on.displayName="TipTapEditor";const Da=x.forwardRef((e,t)=>{const{adapter:s="tiptap",variant:a="bordered",...r}=e;return s==="tiptap"?n.jsx(on,{...r,variant:a,ref:t}):(console.warn(`Adapter "${s}" is not supported. Using TipTap.`),n.jsx(on,{...r,variant:a,ref:t}))});Da.displayName="RichTextArea";function Ho(e,t="en-US",s="USD"){try{return new Intl.NumberFormat(t,{style:"currency",currency:s,minimumFractionDigits:0,maximumFractionDigits:2}).format(e)}catch(a){return console.warn(`Invalid currency formatting: ${a}`),`${s} ${e.toFixed(2)}`}}const vs=[{id:"100",amount:100},{id:"250",amount:250},{id:"500",amount:500},{id:"1000",amount:1e3},{id:"2000",amount:2e3}],qo={title:"Donation Amount",customAmountPlaceholder:"Custom donation amount",customAmountAriaLabel:"Custom donation amount",addDonationButton:"Add Donation"},Ea=({presetAmounts:e=vs,selectedDonation:t,defaultSelectedDonation:s=null,onChange:a,onAddDonation:r,currency:i="USD",locale:o="en-US",showCustomAmount:l=!0,minCustomAmount:c=.5,maxCustomAmount:u=1e6,labels:f,mobileColumns:h=2,desktopColumns:g=3,isDisabled:m=!1,buttonVariant:v="bordered",buttonColor:j="default",inputVariant:b="bordered",size:w="md",className:y="",showCard:k=!0})=>{const N={...qo,...f},S=Array.isArray(e)?e:vs,E={2:"grid-cols-2",3:"grid-cols-3"},L={3:"sm:grid-cols-3",4:"sm:grid-cols-4",5:"sm:grid-cols-5",6:"sm:grid-cols-6"},M=`${E[h]} ${L[g]}`,[$,O]=Sn(t,s,a),[F,A]=x.useState(""),[I,P]=x.useState(!1),[G,q]=x.useState(0),W=x.useCallback(Z=>{if(m)return;const Q={amount:Z.amount,isCustom:!1,presetId:Z.id};O(Q),A(""),P(!1),q(H=>H+1),r?.(Q)},[m,O,r]),ee=x.useCallback(Z=>{if(m)return;if(A(Z!==void 0?String(Z):""),r){O(null);return}if(Z===void 0||isNaN(Z)){O(null);return}O({amount:Z,isCustom:!0})},[m,O,r]),ae=x.useCallback(()=>{if(m)return;const Z=F!==""?parseFloat(F):void 0;Z===void 0||isNaN(Z)||r?.({amount:Z,isCustom:!0})},[m,F,r]),re=x.useMemo(()=>({style:"currency",currency:i,currencyDisplay:"symbol"}),[i]),U=n.jsxs("div",{className:"space-y-4","data-testid":"donation-amounts-root",children:[N.title&&n.jsx("h2",{className:"text-base font-semibold","data-testid":"donation-amounts-title",children:N.title}),S.length>0&&n.jsx("div",{className:d.cn("grid gap-3",M),"data-testid":"donation-amounts-presets",children:S.map(Z=>{const Q=$!==null&&!$.isCustom&&$.presetId===Z.id;return n.jsx(R,{color:Q?"primary":j,variant:Q?"solid":v,className:"w-full",onPress:()=>W(Z),isDisabled:m,"data-testid":`donation-amounts-preset-${Z.id}`,children:Z.label||Ho(Z.amount,o,i)},Z.id)})}),l&&n.jsxs("div",{className:"flex gap-3 items-start",children:[n.jsx(d.NumberInput,{placeholder:N.customAmountPlaceholder,"aria-label":N.customAmountAriaLabel,onInput:r?()=>{O(null),P(!0)}:void 0,variant:b,radius:"full",size:w,minValue:c,maxValue:u,step:.01,formatOptions:re,value:F!==""?parseFloat(F):void 0,onValueChange:ee,isDisabled:m,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-${G}`:$?.isCustom===!1?$.presetId:"custom"),r&&n.jsx(R,{color:"primary",variant:"solid",radius:"full",size:w,className:"shrink-0",onPress:ae,isDisabled:m||!I,"data-testid":"donation-amounts-add-button",children:N.addDonationButton})]})]});return k?n.jsx(d.Card,{className:d.cn("w-full",y),"data-testid":"donation-amounts-card",children:n.jsx(d.CardBody,{children:U})}):n.jsx("div",{className:d.cn("w-full",y),"data-testid":"donation-amounts-plain",children:U})};Ea.displayName="DonationAmounts";const Wo=e=>{const t=Math.max(0,e),s=Math.floor(t/60).toString().padStart(2,"0"),a=(t%60).toString().padStart(2,"0");return`${s}:${a} minutes`},Yo=e=>{switch(e){case"warning":return K.Clock;case"error":return K.AlertCircle;case"success":return K.CheckCircle;default:return K.Clock}},Ko=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"}},Fa=x.forwardRef(({timeLeft:e,defaultTimeLeft:t=1200,onTimeChange:s,onExpire:a,variant:r="info",color:i="primary",message:o="Your cart expires in:",showIcon:l=!0,icon:c,position:u="fixed",autoStart:f=!0,formatTime:h=Wo,className:g,...m},v)=>{const[j,b]=Sn(e!==void 0?Math.max(0,e):void 0,Math.max(0,t),s),w=x.useRef(null),y=x.useRef(!1);x.useEffect(()=>()=>{w.current&&clearInterval(w.current)},[]),x.useEffect(()=>{if(!f||j<=0){w.current&&(clearInterval(w.current),w.current=null);return}return w.current=setInterval(()=>{b(E=>E<=1?(w.current&&(clearInterval(w.current),w.current=null),y.current||(y.current=!0,a?.()),0):E-1)},1e3),()=>{w.current&&(clearInterval(w.current),w.current=null)}},[f,j,b,a]),x.useEffect(()=>{j>0&&(y.current=!1)},[j]);const k=c||Yo(r),N=Ko(i),S={fixed:"fixed top-0 left-0",sticky:"sticky top-0",static:"static"};return n.jsx("div",{ref:v,role:"banner","aria-live":"polite","aria-label":`${o} ${h(j)}`,"data-testid":"expire-cart-timer",className:d.cn("w-full text-white z-50",N,S[u],g),...m,children:n.jsx("div",{className:"container mx-auto px-4 py-3 sm:py-2.5","data-testid":"expire-cart-timer-container",children:n.jsxs("div",{className:"flex items-center justify-between gap-3 sm:gap-4",children:[n.jsxs("div",{className:"flex items-center gap-3 sm:gap-2.5 flex-1 min-w-0","data-testid":"expire-cart-timer-left",children:[l&&n.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:n.jsx(k,{className:"text-primary-500 sm:text-primary-600","aria-hidden":"true",size:14,"data-testid":"expire-cart-timer-icon"})}),n.jsx("p",{className:"text-sm sm:text-base font-medium text-white","data-testid":"expire-cart-timer-message",children:o})]}),n.jsx("div",{className:"flex-shrink-0","data-testid":"expire-cart-timer-right",children:n.jsx("span",{className:"text-sm sm:text-base font-semibold text-white","aria-label":`Time remaining: ${h(j)}`,"data-testid":"expire-cart-timer-value",children:h(j)})})]})})})});Fa.displayName="ExpireCartTimer";const qt=({icon:e,children:t,testId:s})=>n.jsxs("div",{className:"flex items-center gap-2 text-sm text-gray-600","data-testid":s,children:[n.jsx(V,{icon:e,width:20,className:"text-default-500"}),n.jsx("span",{children:t})]}),Go=({classes:e="",name:t,imageUrl:s,eventDate:a,eventTime:r,location:i,description:o,showImage:l=!1,compact:c=!1,imageLoading:u="eager",showMoreButtonClassName:f,labels:h})=>{const[g,m]=x.useState(!1),[v,j]=x.useState(!1),b=x.useRef(null);return x.useEffect(()=>{const w=()=>{if(b.current){const y=b.current.scrollHeight>b.current.clientHeight;j(y)}};return w(),window.addEventListener("resize",w),()=>window.removeEventListener("resize",w)},[o]),n.jsxs(d.Card,{className:d.cn("border-0 shadow-none",e),"data-testid":"event-details-root",children:[n.jsxs(d.CardHeader,{className:d.cn("pt-2 pb-0 flex-col items-start",c?"space-y-1":"space-y-2"),"data-testid":"event-details-header",children:[l&&s&&n.jsx("div",{className:d.cn("w-full overflow-hidden rounded-xl","aspect-[3/1]"),"data-testid":"event-details-image-wrapper",children:n.jsx(d.Image,{removeWrapper:!0,loading:u,alt:`Event image for ${t}`,className:"w-full h-full object-cover object-center",src:s,"data-testid":"event-details-image"})}),n.jsx("h2",{className:d.cn("font-semibold text-gray-800",c?"text-base":"text-xl"),"data-testid":"event-details-title",children:t})]}),n.jsxs(d.CardBody,{className:d.cn("space-y-3",c?"py-1 space-y-2":"py-3"),"data-testid":"event-details-body",children:[n.jsx("h3",{className:d.cn("font-semibold text-base text-gray-700",c?"text-sm":""),"data-testid":"event-details-info-label",children:h.eventInformation}),n.jsxs("div",{className:"flex flex-wrap gap-4","data-testid":"event-details-info",children:[a&&n.jsx(qt,{icon:"solar:calendar-minimalistic-linear",testId:"event-details-date",children:a}),r&&n.jsx(qt,{icon:"solar:clock-circle-linear",testId:"event-details-time",children:r}),i&&n.jsx(qt,{icon:"solar:map-point-linear",testId:"event-details-location",children:i})]}),o&&n.jsxs("div",{className:"relative","data-testid":"event-details-description-wrapper",children:[n.jsxs("div",{className:"relative",children:[n.jsx("div",{ref:b,className:d.cn("text-sm text-gray-700 leading-relaxed transition-all",c?"text-xs":"",!g&&"line-clamp-3"),"data-testid":"event-details-description",dangerouslySetInnerHTML:{__html:o}}),!g&&v&&n.jsx("div",{className:"absolute inset-x-0 -bottom-1 h-8 bg-gradient-to-t from-white via-white/70 to-transparent pointer-events-none","data-testid":"event-details-description-fade"})]}),(v||g)&&n.jsx("div",{className:"flex justify-end mt-1",children:n.jsx(R,{onPress:()=>m(!g),variant:"light",className:d.cn("text-primary",f),size:c?"sm":"md",startContent:n.jsx(V,{icon:g?"solar:eye-closed-linear":"solar:eye-linear",width:c?16:20}),"data-testid":"event-details-toggle-description",children:g?h.showLess||"Hide":h.showMore||"Show"})})]})]})]})};function cn(e,t="en-US",s="USD"){try{return new Intl.NumberFormat(t,{style:"currency",currency:s,minimumFractionDigits:2,maximumFractionDigits:2}).format(e)}catch(a){return console.warn(`Invalid currency formatting: ${a}`),`${s} ${e.toFixed(2)}`}}function Qo(e){const t=e.replace(/[^\d.,-]/g,""),s=t.match(/,\d{1,2}$/);let a;s?a=t.replace(/\./g,"").replace(",","."):a=t.replace(/,/g,"");const r=parseFloat(a);return isNaN(r)?null:r}const Zo={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"},Ke=e=>typeof e=="number"&&!isNaN(e),Nt=({offer:e,quantity:t,defaultQuantity:s=0,onQuantityChange:a,currency:r="USD",locale:i="en-US",labels:o,slots:l,isDisabled:c=!1,buttonVariant:u="bordered",buttonColor:f="default",showCard:h=!0,showDescription:g=!0,showPeopleCount:m=!0,showPrice:v=!0,priceDisplay:j,classNames:b={},"data-testid":w,selectedColor:y="default",compact:k=!1,isSoldOut:N,isMaxReached:S,isRuleBlocked:E,statusTone:L="default",statusLabel:M,disabledReason:$,disabled:O})=>{const F=x.useMemo(()=>({...Zo,...o}),[o]),[A,I]=x.useState(s),P=t!==void 0?t:A,G=!!(c||O),q=k||!!e.compact,W=x.useMemo(()=>typeof N=="boolean"?N:typeof e.isSoldOut=="boolean"?e.isSoldOut:!Ke(e.totalTicketsSold)||!Ke(e.ticketsAllowed)?!1:e.totalTicketsSold>=e.ticketsAllowed,[N,e.isSoldOut,e.totalTicketsSold,e.ticketsAllowed]),ee=x.useMemo(()=>typeof S=="boolean"?S:typeof e.isMaxReached=="boolean"?e.isMaxReached:W||!Ke(e.ticketsAllowed)?!1:P>=e.ticketsAllowed-(e.totalTicketsSold??0),[S,e.isMaxReached,W,e.ticketsAllowed,e.totalTicketsSold,P]),ae=x.useMemo(()=>typeof E=="boolean"?E:typeof e.isRuleBlocked=="boolean"?e.isRuleBlocked:!1,[E,e.isRuleBlocked]),re=$||e.disabledReason,U=G||W||ae,Z=te=>{if(U||te>0&&ee)return;const me=Math.max(0,P+te);t===void 0&&I(me),a?.(e.id,me)},Q=x.useMemo(()=>{if(W)return"soldOut";if(ae)return"ruleBlocked";if(G)return"disabled"},[W,ae,G]),H=x.useMemo(()=>L||(W||ae?"danger":ee?"warning":"default"),[L,W,ae,ee]),X=x.useMemo(()=>{if(Q)return Q==="ruleBlocked"?M||re||F.ruleBlocked:Q==="soldOut"?M||re||F.soldOut:Q==="disabled"?M||re||F.disabled:M||F.maxReached},[Q,M,re,F]),J={soldOut:"danger",ruleBlocked:H,disabled:"default",maxReached:"warning"},Ce={soldOut:"offer-card-sold-out-chip",maxReached:"offer-card-max-reached-chip",ruleBlocked:"offer-card-ruleBlocked-chip",disabled:"offer-card-disabled-chip"},be=()=>l?.renderName?l.renderName(e.name,e):n.jsx("h2",{"data-testid":"offer-card-name",className:d.cn("text-base font-medium",q&&"text-sm",b.name),children:e.name}),he=()=>{if(!v)return null;const te=j?.price??e.price,me=j?.originalPrice,Fe=cn(te,i,r);if(l?.renderPrice)return l.renderPrice(te,Fe,e);if(Ke(me)&&Ke(te)&&me>te){const xe=cn(me,i,r);return n.jsxs("div",{"data-testid":"offer-card-price",className:d.cn("flex items-center gap-2 mt-1",q&&"mt-0.5",b.price),children:[n.jsxs("span",{className:"sr-only",children:["Original price ",xe,", discounted price ",Fe]}),n.jsx("span",{"aria-hidden":"true","data-testid":"offer-card-original-price",className:d.cn("text-gray-400 line-through text-sm",q&&"text-xs",b.originalPrice),children:xe}),n.jsx("span",{"aria-hidden":"true","data-testid":"offer-card-discounted-price",className:d.cn("text-primary text-base font-semibold",q&&"text-sm",b.discountedPrice),children:Fe})]})}return n.jsx("p",{"data-testid":"offer-card-price",className:d.cn("text-primary text-base mt-1",q&&"text-sm mt-0.5",b.price),children:Fe})},Be=()=>!g||!e.description?null:l?.renderDescription?l.renderDescription(e.description,e):n.jsx("p",{"data-testid":"offer-card-description",className:d.cn("mb-4 text-sm text-gray-700 leading-relaxed",q&&"mb-2 text-xs text-gray-600",b.description),children:e.description}),Te=()=>{if(!m||!Ke(e.numberOfPeople)||e.numberOfPeople<=0)return null;const te=e.numberOfPeople===1?F.person:F.people;return l?.renderPeopleCount?l.renderPeopleCount(e.numberOfPeople,te,e):n.jsxs("p",{"data-testid":"offer-card-people-count",className:d.cn("text-sm text-gray-600 flex items-center mt-2",q&&"mt-1 text-xs",b.peopleCount),children:[n.jsx(V,{icon:e.numberOfPeople<=1?"solar:user-rounded-outline":"solar:users-group-rounded-outline",width:20,className:"mr-1"}),e.numberOfPeople," ",te]})},Pe=()=>{const te=P===0||U,me=ee||U;return l?.renderQuantitySelector?l.renderQuantitySelector({quantity:P,onIncrement:()=>Z(1),onDecrement:()=>Z(-1),isDecrementDisabled:te,isIncrementDisabled:me,isDisabled:U}):n.jsxs("div",{className:d.cn("flex items-center gap-2",b.quantitySelector),children:[n.jsx(R,{"data-testid":"offer-card-decrement-button",onPress:()=>Z(-1),isDisabled:te,variant:u,color:P>0?y:f,radius:"full",isIconOnly:!0,size:q?"md":"sm","aria-label":"Decrease quantity",children:n.jsx(V,{icon:"gravity-ui:minus",width:16})}),n.jsx("span",{"data-testid":"offer-card-quantity",className:d.cn("min-w-[2rem] text-center font-medium",q&&"text-sm"),children:P}),n.jsx(R,{"data-testid":"offer-card-increment-button",onPress:()=>Z(1),isDisabled:me,variant:u,color:P>0?y:f,radius:"full",isIconOnly:!0,size:q?"md":"sm","aria-label":"Increase quantity",children:n.jsx(V,{icon:"gravity-ui:plus",width:16})})]})},_e=(te,me)=>l?.renderDisabledState?l.renderDisabledState(te,me):te==="soldOut"&&l?.renderSoldOut?l.renderSoldOut(me):te==="maxReached"&&l?.renderMaxReachedAlert?l.renderMaxReachedAlert(me):n.jsx(d.Chip,{"data-testid":Ce[te],color:J[te],variant:te==="maxReached"?"flat":"solid",className:d.cn("gap-2 px-4",te==="maxReached"?"h-8":"h-10",te==="soldOut"&&b.soldOut,te==="maxReached"&&b.maxReachedAlert,q&&"h-8"),startContent:n.jsx(V,{icon:"gravity-ui:triangle-exclamation-fill",width:14}),children:n.jsx("span",{className:"font-medium text-sm",children:me})}),Ve=n.jsxs("div",{className:d.cn("grid grid-cols-1 md:grid-cols-1 xl:grid-cols-3 lg:grid-cols-3 items-start",q?"gap-1":"gap-2"),children:[n.jsxs("div",{className:d.cn("h-full col-span-2",U||ee?"opacity-50 pointer-events-none select-none":""),children:[be(),he(),n.jsxs("div",{className:d.cn("md:col-span-1 xl:col-span-2 lg:col-span-1",q?"mb-1":"mb-2"),children:[Te(),Be()]})]}),n.jsx("div",{className:d.cn("space-x-2 pt-0 pb-2 md:p-2 h-full flex items-center justify-start md:justify-start lg:justify-end",q&&"space-x-1 pb-1 md:p-1",b.compactFooter),children:Q&&X?_e(Q,X):Pe()})]}),Ee=ee&&!W&&!ae&&!G?n.jsx(Ae.motion.div,{className:d.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:_e("maxReached",X||F.maxReached)}):null;return h?n.jsxs(d.Card,{className:d.cn("w-full",q&&b.compact,b.base),"data-testid":w||`offer-card-${e.id}`,children:[n.jsx(d.CardBody,{className:d.cn("pt-1 pb-0",q?"pb-0.5":"",b.body),children:Ve}),n.jsx(Ae.AnimatePresence,{children:Ee&&n.jsx(d.CardFooter,{className:d.cn("w-full mt-0 pt-0",q?"pt-1":"",b.footer),children:Ee})})]}):n.jsxs("div",{className:d.cn("w-full",q&&b.compact,b.base),"data-testid":w||`offer-card-${e.id}`,children:[n.jsx("div",{className:d.cn("pt-1 pb-0",q?"pb-0.5":"",b.body),children:Ve}),n.jsx(Ae.AnimatePresence,{children:Ee&&n.jsx("div",{className:d.cn("w-full mt-0 pt-0",q?"pt-1":"",b.footer),children:Ee})})]})};Nt.displayName="OfferCard";const La=({message:e="No offers available.",icon:t="solar:ticket-sale-outline",iconSize:s=48,showCard:a=!0,classNames:r={},renderEmpty:i})=>{if(i){const l=i();return a?n.jsx(d.Card,{"data-testid":"offer-card-empty",className:d.cn("w-full",r.base),children:n.jsx(d.CardBody,{"data-testid":"offer-card-empty-body",children:l})}):n.jsx("div",{"data-testid":"offer-card-empty",className:d.cn("w-full",r.base),children:l})}const o=n.jsxs("div",{"data-testid":"offer-card-empty-content",className:d.cn("flex flex-col items-center justify-center p-8 text-center text-gray-500",r.content),children:[n.jsx(V,{"data-testid":"offer-card-empty-icon",icon:t,width:s,className:d.cn("mb-4",r.icon)}),n.jsx("h3",{"data-testid":"offer-card-empty-message",className:d.cn("text-lg",r.message),children:e})]});return a?n.jsx(d.Card,{"data-testid":"offer-card-empty",className:d.cn("w-full",r.base),children:n.jsx(d.CardBody,{"data-testid":"offer-card-empty-body",children:o})}):n.jsx("div",{"data-testid":"offer-card-empty",className:d.cn("w-full",r.base),children:o})};La.displayName="OfferCardEmpty";const Xo={title:"Error Fetching Offers",description:"An error occurred while fetching offers."},Ma=({error:e,labels:t,showCard:s=!0,color:a="danger",classNames:r={}})=>{const i={...Xo,...t},o=n.jsx(d.Alert,{"data-testid":"offer-card-error-alert",color:a,title:i.title,description:e||i.description,className:r.alert});return s?n.jsx(d.Card,{"data-testid":"offer-card-error",className:d.cn("w-full",r.base),children:n.jsx(d.CardBody,{"data-testid":"offer-card-error-body",children:o})}):n.jsx("div",{"data-testid":"offer-card-error",className:d.cn("w-full",r.base),children:o})};Ma.displayName="OfferCardError";const Jo={1:"space-y-1",2:"space-y-2",3:"space-y-3",4:"space-y-4",5:"space-y-5",6:"space-y-6"},Ia=({quantity:e=2,gap:t=4,classNames:s={}})=>{const a=Jo[t];return n.jsx("div",{"data-testid":"offer-card-skeleton-container",className:d.cn(a,s.base),children:Array.from({length:e}).map((r,i)=>n.jsxs(d.Card,{"data-testid":`offer-card-skeleton-${i}`,className:d.cn("w-full",s.card),children:[n.jsx(d.CardHeader,{"data-testid":`offer-card-skeleton-header-${i}`,className:"flex justify-between items-start pb-0",children:n.jsxs("div",{className:"space-y-2 w-full",children:[n.jsx(d.Skeleton,{"data-testid":`offer-card-skeleton-title-${i}`,className:"w-1/3 rounded-lg",children:n.jsx("div",{className:"h-4 bg-default-200 rounded-lg"})}),n.jsx(d.Skeleton,{"data-testid":`offer-card-skeleton-subtitle-${i}`,className:"w-1/4 rounded-lg",children:n.jsx("div",{className:"h-3 bg-default-300 rounded-lg"})})]})}),n.jsx(d.CardBody,{"data-testid":`offer-card-skeleton-body-${i}`,className:"pt-2 pb-0",children:n.jsxs("div",{className:"grid grid-cols-1 xl:grid-cols-3 gap-2 items-start",children:[n.jsxs("div",{className:"xl:col-span-2 space-y-2",children:[n.jsx(d.Skeleton,{"data-testid":`offer-card-skeleton-people-${i}`,className:"w-1/4 rounded-lg",children:n.jsx("div",{className:"h-4 bg-default-300 rounded-lg"})}),n.jsx(d.Skeleton,{"data-testid":`offer-card-skeleton-description-${i}`,className:"w-3/4 rounded-lg",children:n.jsx("div",{className:"h-4 bg-default-200 rounded-lg"})})]}),n.jsx("div",{className:"flex items-start justify-end",children:n.jsxs("div",{"data-testid":`offer-card-skeleton-controls-${i}`,className:"flex items-center justify-end gap-2 w-full px-4 py-2",children:[n.jsx(d.Skeleton,{"data-testid":`offer-card-skeleton-label-${i}`,className:"w-24 h-4 rounded-md bg-default-200"}),n.jsxs("div",{className:"flex gap-2",children:[n.jsx(d.Skeleton,{"data-testid":`offer-card-skeleton-btn-dec-${i}`,className:"w-8 h-8 rounded-md bg-default-300"}),n.jsx(d.Skeleton,{"data-testid":`offer-card-skeleton-btn-qty-${i}`,className:"w-8 h-8 rounded-md bg-default-200"}),n.jsx(d.Skeleton,{"data-testid":`offer-card-skeleton-btn-inc-${i}`,className:"w-8 h-8 rounded-md bg-default-300"})]})]})})]})})]},i))})};Ia.displayName="OfferCardSkeleton";const Ta={hidden:{opacity:0},show:{opacity:1,transition:{staggerChildren:.15,delayChildren:.1}}},Pa={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"}}},ec={1:"gap-1",2:"gap-2",3:"gap-3",4:"gap-4",5:"gap-5",6:"gap-6"},_a=({offers:e=[],mapOffer:t,selection:s,defaultSelection:a={},onSelectionChange:r,onQuantityChange:i,currency:o="USD",locale:l="en-US",labels:c,slots:u,isDisabled:f=!1,buttonVariant:h="bordered",buttonColor:g="default",showCard:m=!0,animated:v=!0,gap:j=2,compact:b=!1,classNames:w={}})=>{const[y,k]=x.useState(a),N=s!==void 0?s:y,S=x.useCallback((F,A)=>{const I={...N,[F]:Math.max(0,A)};s===void 0&&k(I),r?.(I),i?.(F,I[F])},[N,s,r,i]),E=[...e].sort((F,A)=>(F.position??0)-(A.position??0)),L=F=>{const A=t?t(F):F,I=(N??{})[A.id]||0;return{offer:A,quantity:I,onQuantityChange:S,currency:o,locale:l,labels:c,slots:u,isDisabled:f,buttonVariant:h,buttonColor:g,showCard:m,compact:b}},M=ec[j],$=d.cn("grid mx-auto pt-2",M,w.base),O=F=>{const A=L(F);return n.jsx(Nt,{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 v?n.jsx(Ae.motion.div,{"data-testid":"offer-card-list",className:$,variants:Ta,initial:"hidden",animate:"show",children:n.jsx(Ae.AnimatePresence,{children:E.map(F=>{const A=L(F);return n.jsx(Ae.motion.div,{"data-testid":`offer-card-list-item-${A.offer.id}`,className:w.cardWrapper,variants:Pa,exit:{opacity:0,y:-20},transition:{duration:.3},children:n.jsx(Nt,{offer:A.offer,quantity:A.quantity,onQuantityChange:S,currency:o,locale:l,labels:c,slots:u,isDisabled:f,buttonVariant:h,buttonColor:g,showCard:m,compact:b||A.offer.compact,classNames:w.card})},A.offer.id)})})}):n.jsx("div",{"data-testid":"offer-card-list",className:$,children:E.map(O)})};_a.displayName="OfferCardList";var ft=e=>e.type==="checkbox",We=e=>e instanceof Date,Ne=e=>e==null;const Oa=e=>typeof e=="object";var fe=e=>!Ne(e)&&!Array.isArray(e)&&Oa(e)&&!We(e),Ra=e=>fe(e)&&e.target?ft(e.target)?e.target.checked:e.target.value:e,tc=e=>e.substring(0,e.search(/\.\d+(\.|$)/))||e,za=(e,t)=>e.has(tc(t)),nc=e=>{const t=e.constructor&&e.constructor.prototype;return fe(t)&&t.hasOwnProperty("isPrototypeOf")},$n=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function de(e){if(e instanceof Date)return new Date(e);const t=typeof FileList<"u"&&e instanceof FileList;if($n&&(e instanceof Blob||t))return e;const s=Array.isArray(e);if(!s&&!(fe(e)&&nc(e)))return e;const a=s?[]:Object.create(Object.getPrototypeOf(e));for(const r in e)Object.prototype.hasOwnProperty.call(e,r)&&(a[r]=de(e[r]));return a}var Ft=e=>/^\w*$/.test(e),oe=e=>e===void 0,Dn=e=>Array.isArray(e)?e.filter(Boolean):[],En=e=>Dn(e.replace(/["|']|\]/g,"").split(/\.|\[/)),z=(e,t,s)=>{if(!t||!fe(e))return s;const a=(Ft(t)?[t]:En(t)).reduce((r,i)=>Ne(r)?r:r[i],e);return oe(a)||a===e?oe(e[t])?s:e[t]:a},Se=e=>typeof e=="boolean",je=e=>typeof e=="function",ie=(e,t,s)=>{let a=-1;const r=Ft(t)?[t]:En(t),i=r.length,o=i-1;for(;++a<i;){const l=r[a];let c=s;if(a!==o){const u=e[l];c=fe(u)||Array.isArray(u)?u:isNaN(+r[a+1])?{}:[]}if(l==="__proto__"||l==="constructor"||l==="prototype")return;e[l]=c,e=e[l]}};const Ct={BLUR:"blur",FOCUS_OUT:"focusout",CHANGE:"change"},$e={onBlur:"onBlur",onChange:"onChange",onSubmit:"onSubmit",onTouched:"onTouched",all:"all"},Le={max:"max",min:"min",maxLength:"maxLength",minLength:"minLength",pattern:"pattern",required:"required",validate:"validate"},Ba=x.createContext(null);Ba.displayName="HookFormControlContext";const Fn=()=>x.useContext(Ba);var Va=(e,t,s,a=!0)=>{const r={defaultValues:t._defaultValues};for(const i in e)Object.defineProperty(r,i,{get:()=>{const o=i;return t._proxyFormState[o]!==$e.all&&(t._proxyFormState[o]=!a||$e.all),s&&(s[o]=!0),e[o]}});return r};const Ln=typeof window<"u"?x.useLayoutEffect:x.useEffect;function sc(e){const t=Fn(),{control:s=t,disabled:a,name:r,exact:i}=e||{},[o,l]=x.useState(s._formState),c=x.useRef({isDirty:!1,isLoading:!1,dirtyFields:!1,touchedFields:!1,validatingFields:!1,isValidating:!1,isValid:!1,errors:!1});return Ln(()=>s._subscribe({name:r,formState:c.current,exact:i,callback:u=>{!a&&l({...s._formState,...u})}}),[r,a,i]),x.useEffect(()=>{c.current.isValid&&s._setValid(!0)},[s]),x.useMemo(()=>Va(o,s,c.current,!1),[o,s])}var ke=e=>typeof e=="string",dn=(e,t,s,a,r)=>ke(e)?(a&&t.watch.add(e),z(s,e,r)):Array.isArray(e)?e.map(i=>(a&&t.watch.add(i),z(s,i))):(a&&(t.watchAll=!0),s),un=e=>Ne(e)||!Oa(e);function De(e,t,s=new WeakSet){if(un(e)||un(t))return Object.is(e,t);if(We(e)&&We(t))return Object.is(e.getTime(),t.getTime());const a=Object.keys(e),r=Object.keys(t);if(a.length!==r.length)return!1;if(s.has(e)||s.has(t))return!0;s.add(e),s.add(t);for(const i of a){const o=e[i];if(!r.includes(i))return!1;if(i!=="ref"){const l=t[i];if(We(o)&&We(l)||fe(o)&&fe(l)||Array.isArray(o)&&Array.isArray(l)?!De(o,l,s):!Object.is(o,l))return!1}}return!0}function ac(e){const t=Fn(),{control:s=t,name:a,defaultValue:r,disabled:i,exact:o,compute:l}=e||{},c=x.useRef(r),u=x.useRef(l),f=x.useRef(void 0),h=x.useRef(s),g=x.useRef(a);u.current=l;const[m,v]=x.useState(()=>{const N=s._getWatch(a,c.current);return u.current?u.current(N):N}),j=x.useCallback(N=>{const S=dn(a,s._names,N||s._formValues,!1,c.current);return u.current?u.current(S):S},[s._formValues,s._names,a]),b=x.useCallback(N=>{if(!i){const S=dn(a,s._names,N||s._formValues,!1,c.current);if(u.current){const E=u.current(S);De(E,f.current)||(v(E),f.current=E)}else v(S)}},[s._formValues,s._names,i,a]);Ln(()=>((h.current!==s||!De(g.current,a))&&(h.current=s,g.current=a,b()),s._subscribe({name:a,formState:{values:!0},exact:o,callback:N=>{b(N.values)}})),[s,o,a,b]),x.useEffect(()=>s._removeUnmounted());const w=h.current!==s,y=g.current,k=x.useMemo(()=>{if(i)return null;const N=!w&&!De(y,a);return w||N?j():null},[i,w,a,y,j]);return k!==null?k:m}function rc(e){const t=Fn(),{name:s,disabled:a,control:r=t,shouldUnregister:i,defaultValue:o,exact:l=!0}=e,c=za(r._names.array,s),u=x.useMemo(()=>z(r._formValues,s,z(r._defaultValues,s,o)),[r,s,o]),f=ac({control:r,name:s,defaultValue:u,exact:l}),h=sc({control:r,name:s,exact:l}),g=x.useRef(e),m=x.useRef(void 0),v=x.useRef(r.register(s,{...e.rules,value:f,...Se(e.disabled)?{disabled:e.disabled}:{}}));g.current=e;const j=x.useMemo(()=>Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!z(h.errors,s)},isDirty:{enumerable:!0,get:()=>!!z(h.dirtyFields,s)},isTouched:{enumerable:!0,get:()=>!!z(h.touchedFields,s)},isValidating:{enumerable:!0,get:()=>!!z(h.validatingFields,s)},error:{enumerable:!0,get:()=>z(h.errors,s)}}),[h,s]),b=x.useCallback(N=>v.current.onChange({target:{value:Ra(N),name:s},type:Ct.CHANGE}),[s]),w=x.useCallback(()=>v.current.onBlur({target:{value:z(r._formValues,s),name:s},type:Ct.BLUR}),[s,r._formValues]),y=x.useCallback(N=>{const S=z(r._fields,s);S&&S._f&&N&&(S._f.ref={focus:()=>je(N.focus)&&N.focus(),select:()=>je(N.select)&&N.select(),setCustomValidity:E=>je(N.setCustomValidity)&&N.setCustomValidity(E),reportValidity:()=>je(N.reportValidity)&&N.reportValidity()})},[r._fields,s]),k=x.useMemo(()=>({name:s,value:f,...Se(a)||h.disabled?{disabled:h.disabled||a}:{},onChange:b,onBlur:w,ref:y}),[s,a,h.disabled,b,w,y,f]);return x.useEffect(()=>{const N=r._options.shouldUnregister||i,S=m.current;S&&S!==s&&!c&&r.unregister(S),r.register(s,{...g.current.rules,...Se(g.current.disabled)?{disabled:g.current.disabled}:{}});const E=(L,M)=>{const $=z(r._fields,L);$&&$._f&&($._f.mount=M)};if(E(s,!0),N){const L=de(z(r._options.defaultValues,s,g.current.defaultValue));ie(r._defaultValues,s,L),oe(z(r._formValues,s))&&ie(r._formValues,s,L)}return!c&&r.register(s),m.current=s,()=>{(c?N&&!r._state.action:N)?r.unregister(s):E(s,!1)}},[s,r,c,i]),x.useEffect(()=>{r._setDisabledField({disabled:a,name:s})},[a,s,r]),x.useMemo(()=>({field:k,formState:h,fieldState:j}),[k,h,j])}const ic=x.createContext(null);ic.displayName="HookFormContext";var lc=(e,t,s,a,r)=>t?{...s[e],types:{...s[e]&&s[e].types?s[e].types:{},[a]:r||!0}}:{},lt=e=>Array.isArray(e)?e:[e],js=()=>{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 Ua(e,t){const s={};for(const a in e)if(e.hasOwnProperty(a)){const r=e[a],i=t[a];if(r&&fe(r)&&i){const o=Ua(r,i);fe(o)&&(s[a]=o)}else e[a]&&(s[a]=i)}return s}var ve=e=>fe(e)&&!Object.keys(e).length,Mn=e=>e.type==="file",St=e=>{if(!$n)return!1;const t=e?e.ownerDocument:0;return e instanceof(t&&t.defaultView?t.defaultView.HTMLElement:HTMLElement)},Ha=e=>e.type==="select-multiple",In=e=>e.type==="radio",oc=e=>In(e)||ft(e),Wt=e=>St(e)&&e.isConnected;function cc(e,t){const s=t.slice(0,-1).length;let a=0;for(;a<s;)e=oe(e)?a++:e[t[a++]];return e}function dc(e){for(const t in e)if(e.hasOwnProperty(t)&&!oe(e[t]))return!1;return!0}function ue(e,t){const s=Array.isArray(t)?t:Ft(t)?[t]:En(t),a=s.length===1?e:cc(e,s),r=s.length-1,i=s[r];return a&&delete a[i],r!==0&&(fe(a)&&ve(a)||Array.isArray(a)&&dc(a))&&ue(e,s.slice(0,-1)),e}var uc=e=>{for(const t in e)if(je(e[t]))return!0;return!1};function qa(e){return Array.isArray(e)||fe(e)&&!uc(e)}function fn(e,t={}){for(const s in e){const a=e[s];qa(a)?(t[s]=Array.isArray(a)?[]:{},fn(a,t[s])):oe(a)||(t[s]=!0)}return t}function Ze(e,t,s){s||(s=fn(t));for(const a in e){const r=e[a];if(qa(r))oe(t)||un(s[a])?s[a]=fn(r,Array.isArray(r)?[]:{}):Ze(r,Ne(t)?{}:t[a],s[a]);else{const i=t[a];s[a]=!De(r,i)}}return s}const ws={value:!1,isValid:!1},Ns={value:!0,isValid:!0};var Wa=e=>{if(Array.isArray(e)){if(e.length>1){const t=e.filter(s=>s&&s.checked&&!s.disabled).map(s=>s.value);return{value:t,isValid:!!t.length}}return e[0].checked&&!e[0].disabled?e[0].attributes&&!oe(e[0].attributes.value)?oe(e[0].value)||e[0].value===""?Ns:{value:e[0].value,isValid:!0}:Ns:ws}return ws},Ya=(e,{valueAsNumber:t,valueAsDate:s,setValueAs:a})=>oe(e)?e:t?e===""?NaN:e&&+e:s&&ke(e)?new Date(e):a?a(e):e;const Cs={isValid:!1,value:null};var Ka=e=>Array.isArray(e)?e.reduce((t,s)=>s&&s.checked&&!s.disabled?{isValid:!0,value:s.value}:t,Cs):Cs;function Ss(e){const t=e.ref;return Mn(t)?t.files:In(t)?Ka(e.refs).value:Ha(t)?[...t.selectedOptions].map(({value:s})=>s):ft(t)?Wa(e.refs).value:Ya(oe(t.value)?e.ref.value:t.value,e)}var fc=(e,t,s,a)=>{const r={};for(const i of e){const o=z(t,i);o&&ie(r,i,o._f)}return{criteriaMode:s,names:[...e],fields:r,shouldUseNativeValidation:a}},kt=e=>e instanceof RegExp,at=e=>oe(e)?e:kt(e)?e.source:fe(e)?kt(e.value)?e.value.source:e.value:e,ks=e=>({isOnSubmit:!e||e===$e.onSubmit,isOnBlur:e===$e.onBlur,isOnChange:e===$e.onChange,isOnAll:e===$e.all,isOnTouch:e===$e.onTouched});const As="AsyncFunction";var mc=e=>!!e&&!!e.validate&&!!(je(e.validate)&&e.validate.constructor.name===As||fe(e.validate)&&Object.values(e.validate).find(t=>t.constructor.name===As)),hc=e=>e.mount&&(e.required||e.min||e.max||e.maxLength||e.minLength||e.pattern||e.validate),$s=(e,t,s)=>!s&&(t.watchAll||t.watch.has(e)||[...t.watch].some(a=>e.startsWith(a)&&/^\.\w+/.test(e.slice(a.length))));const ot=(e,t,s,a)=>{for(const r of s||Object.keys(e)){const i=z(e,r);if(i){const{_f:o,...l}=i;if(o){if(o.refs&&o.refs[0]&&t(o.refs[0],r)&&!a)return!0;if(o.ref&&t(o.ref,o.name)&&!a)return!0;if(ot(l,t))break}else if(fe(l)&&ot(l,t))break}}};function Ds(e,t,s){const a=z(e,s);if(a||Ft(s))return{error:a,name:s};const r=s.split(".");for(;r.length;){const i=r.join("."),o=z(t,i),l=z(e,i);if(o&&!Array.isArray(o)&&s!==i)return{name:s};if(l&&l.type)return{name:i,error:l};if(l&&l.root&&l.root.type)return{name:`${i}.root`,error:l.root};r.pop()}return{name:s}}var xc=(e,t,s,a)=>{s(e);const{name:r,...i}=e;return ve(i)||Object.keys(i).length>=Object.keys(t).length||Object.keys(i).find(o=>t[o]===(!a||$e.all))},pc=(e,t,s)=>!e||!t||e===t||lt(e).some(a=>a&&(s?a===t:a.startsWith(t)||t.startsWith(a))),gc=(e,t,s,a,r)=>r.isOnAll?!1:!s&&r.isOnTouch?!(t||e):(s?a.isOnBlur:r.isOnBlur)?!e:(s?a.isOnChange:r.isOnChange)?e:!0,bc=(e,t)=>!Dn(z(e,t)).length&&ue(e,t),yc=(e,t,s)=>{const a=lt(z(e,s));return ie(a,"root",t[s]),ie(e,s,a),e};function Es(e,t,s="validate"){if(ke(e)||Array.isArray(e)&&e.every(ke)||Se(e)&&!e)return{type:s,message:ke(e)?e:"",ref:t}}var Ge=e=>fe(e)&&!kt(e)?e:{value:e,message:""},Fs=async(e,t,s,a,r,i)=>{const{ref:o,refs:l,required:c,maxLength:u,minLength:f,min:h,max:g,pattern:m,validate:v,name:j,valueAsNumber:b,mount:w}=e._f,y=z(s,j);if(!w||t.has(j))return{};const k=l?l[0]:o,N=A=>{r&&k.reportValidity&&(k.setCustomValidity(Se(A)?"":A||""),k.reportValidity())},S={},E=In(o),L=ft(o),M=E||L,$=(b||Mn(o))&&oe(o.value)&&oe(y)||St(o)&&o.value===""||y===""||Array.isArray(y)&&!y.length,O=lc.bind(null,j,a,S),F=(A,I,P,G=Le.maxLength,q=Le.minLength)=>{const W=A?I:P;S[j]={type:A?G:q,message:W,ref:o,...O(A?G:q,W)}};if(i?!Array.isArray(y)||!y.length:c&&(!M&&($||Ne(y))||Se(y)&&!y||L&&!Wa(l).isValid||E&&!Ka(l).isValid)){const{value:A,message:I}=ke(c)?{value:!!c,message:c}:Ge(c);if(A&&(S[j]={type:Le.required,message:I,ref:k,...O(Le.required,I)},!a))return N(I),S}if(!$&&(!Ne(h)||!Ne(g))){let A,I;const P=Ge(g),G=Ge(h);if(!Ne(y)&&!isNaN(y)){const q=o.valueAsNumber||y&&+y;Ne(P.value)||(A=q>P.value),Ne(G.value)||(I=q<G.value)}else{const q=o.valueAsDate||new Date(y),W=re=>new Date(new Date().toDateString()+" "+re),ee=o.type=="time",ae=o.type=="week";ke(P.value)&&y&&(A=ee?W(y)>W(P.value):ae?y>P.value:q>new Date(P.value)),ke(G.value)&&y&&(I=ee?W(y)<W(G.value):ae?y<G.value:q<new Date(G.value))}if((A||I)&&(F(!!A,P.message,G.message,Le.max,Le.min),!a))return N(S[j].message),S}if((u||f)&&!$&&(ke(y)||i&&Array.isArray(y))){const A=Ge(u),I=Ge(f),P=!Ne(A.value)&&y.length>+A.value,G=!Ne(I.value)&&y.length<+I.value;if((P||G)&&(F(P,A.message,I.message),!a))return N(S[j].message),S}if(m&&!$&&ke(y)){const{value:A,message:I}=Ge(m);if(kt(A)&&!y.match(A)&&(S[j]={type:Le.pattern,message:I,ref:o,...O(Le.pattern,I)},!a))return N(I),S}if(v){if(je(v)){const A=await v(y,s),I=Es(A,k);if(I&&(S[j]={...I,...O(Le.validate,I.message)},!a))return N(I.message),S}else if(fe(v)){let A={};for(const I in v){if(!ve(A)&&!a)break;const P=Es(await v[I](y,s),k,I);P&&(A={...P,...O(I,P.message)},N(P.message),a&&(S[j]=A))}if(!ve(A)&&(S[j]={ref:k,...A},!a))return S}}return N(!0),S};const vc={mode:$e.onSubmit,reValidateMode:$e.onChange,shouldFocusError:!0};function jc(e={}){let t={...vc,...e},s={submitCount:0,isDirty:!1,isReady:!1,isLoading:je(t.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{},errors:t.errors||{},disabled:t.disabled||!1},a={},r=fe(t.defaultValues)||fe(t.values)?de(t.defaultValues||t.values)||{}:{},i=t.shouldUnregister?{}:de(r),o={action:!1,mount:!1,watch:!1,keepIsValid:!1},l={mount:new Set,disabled:new Set,unMount:new Set,array:new Set,watch:new Set},c,u=0;const f={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1},h={...f};let g={...h};const m={array:js(),state:js()},v=t.criteriaMode===$e.all,j=p=>C=>{clearTimeout(u),u=setTimeout(p,C)},b=async p=>{if(!o.keepIsValid&&!t.disabled&&(h.isValid||g.isValid||p)){let C;t.resolver?(C=ve((await M()).errors),w()):C=await O(a,!0),C!==s.isValid&&m.state.next({isValid:C})}},w=(p,C)=>{!t.disabled&&(h.isValidating||h.validatingFields||g.isValidating||g.validatingFields)&&((p||Array.from(l.mount)).forEach(D=>{D&&(C?ie(s.validatingFields,D,C):ue(s.validatingFields,D))}),m.state.next({validatingFields:s.validatingFields,isValidating:!ve(s.validatingFields)}))},y=(p,C=[],D,B,_=!0,T=!0)=>{if(B&&D&&!t.disabled){if(o.action=!0,T&&Array.isArray(z(a,p))){const Y=D(z(a,p),B.argA,B.argB);_&&ie(a,p,Y)}if(T&&Array.isArray(z(s.errors,p))){const Y=D(z(s.errors,p),B.argA,B.argB);_&&ie(s.errors,p,Y),bc(s.errors,p)}if((h.touchedFields||g.touchedFields)&&T&&Array.isArray(z(s.touchedFields,p))){const Y=D(z(s.touchedFields,p),B.argA,B.argB);_&&ie(s.touchedFields,p,Y)}(h.dirtyFields||g.dirtyFields)&&(s.dirtyFields=Ze(r,i)),m.state.next({name:p,isDirty:A(p,C),dirtyFields:s.dirtyFields,errors:s.errors,isValid:s.isValid})}else ie(i,p,C)},k=(p,C)=>{ie(s.errors,p,C),m.state.next({errors:s.errors})},N=p=>{s.errors=p,m.state.next({errors:s.errors,isValid:!1})},S=(p,C,D,B)=>{const _=z(a,p);if(_){const T=z(i,p,oe(D)?z(r,p):D);oe(T)||B&&B.defaultChecked||C?ie(i,p,C?T:Ss(_._f)):G(p,T),o.mount&&!o.action&&b()}},E=(p,C,D,B,_)=>{let T=!1,Y=!1;const ne={name:p};if(!t.disabled){if(!D||B){(h.isDirty||g.isDirty)&&(Y=s.isDirty,s.isDirty=ne.isDirty=A(),T=Y!==ne.isDirty);const se=De(z(r,p),C);Y=!!z(s.dirtyFields,p),se?ue(s.dirtyFields,p):ie(s.dirtyFields,p,!0),ne.dirtyFields=s.dirtyFields,T=T||(h.dirtyFields||g.dirtyFields)&&Y!==!se}if(D){const se=z(s.touchedFields,p);se||(ie(s.touchedFields,p,D),ne.touchedFields=s.touchedFields,T=T||(h.touchedFields||g.touchedFields)&&se!==D)}T&&_&&m.state.next(ne)}return T?ne:{}},L=(p,C,D,B)=>{const _=z(s.errors,p),T=(h.isValid||g.isValid)&&Se(C)&&s.isValid!==C;if(t.delayError&&D?(c=j(()=>k(p,D)),c(t.delayError)):(clearTimeout(u),c=null,D?ie(s.errors,p,D):ue(s.errors,p)),(D?!De(_,D):_)||!ve(B)||T){const Y={...B,...T&&Se(C)?{isValid:C}:{},errors:s.errors,name:p};s={...s,...Y},m.state.next(Y)}},M=async p=>(w(p,!0),await t.resolver(i,t.context,fc(p||l.mount,a,t.criteriaMode,t.shouldUseNativeValidation))),$=async p=>{const{errors:C}=await M(p);if(w(p),p)for(const D of p){const B=z(C,D);B?ie(s.errors,D,B):ue(s.errors,D)}else s.errors=C;return C},O=async(p,C,D={valid:!0})=>{for(const B in p){const _=p[B];if(_){const{_f:T,...Y}=_;if(T){const ne=l.array.has(T.name),se=_._f&&mc(_._f);se&&h.validatingFields&&w([T.name],!0);const ye=await Fs(_,l.disabled,i,v,t.shouldUseNativeValidation&&!C,ne);if(se&&h.validatingFields&&w([T.name]),ye[T.name]&&(D.valid=!1,C||e.shouldUseNativeValidation))break;!C&&(z(ye,T.name)?ne?yc(s.errors,ye,T.name):ie(s.errors,T.name,ye[T.name]):ue(s.errors,T.name))}!ve(Y)&&await O(Y,C,D)}}return D.valid},F=()=>{for(const p of l.unMount){const C=z(a,p);C&&(C._f.refs?C._f.refs.every(D=>!Wt(D)):!Wt(C._f.ref))&&be(p)}l.unMount=new Set},A=(p,C)=>!t.disabled&&(p&&C&&ie(i,p,C),!De(U(),r)),I=(p,C,D)=>dn(p,l,{...o.mount?i:oe(C)?r:ke(p)?{[p]:C}:C},D,C),P=p=>Dn(z(o.mount?i:r,p,t.shouldUnregister?z(r,p,[]):[])),G=(p,C,D={})=>{const B=z(a,p);let _=C;if(B){const T=B._f;T&&(!T.disabled&&ie(i,p,Ya(C,T)),_=St(T.ref)&&Ne(C)?"":C,Ha(T.ref)?[...T.ref.options].forEach(Y=>Y.selected=_.includes(Y.value)):T.refs?ft(T.ref)?T.refs.forEach(Y=>{(!Y.defaultChecked||!Y.disabled)&&(Array.isArray(_)?Y.checked=!!_.find(ne=>ne===Y.value):Y.checked=_===Y.value||!!_)}):T.refs.forEach(Y=>Y.checked=Y.value===_):Mn(T.ref)?T.ref.value="":(T.ref.value=_,T.ref.type||m.state.next({name:p,values:de(i)})))}(D.shouldDirty||D.shouldTouch)&&E(p,_,D.shouldTouch,D.shouldDirty,!0),D.shouldValidate&&re(p)},q=(p,C,D)=>{for(const B in C){if(!C.hasOwnProperty(B))return;const _=C[B],T=p+"."+B,Y=z(a,T);(l.array.has(p)||fe(_)||Y&&!Y._f)&&!We(_)?q(T,_,D):G(T,_,D)}},W=(p,C,D={})=>{const B=z(a,p),_=l.array.has(p),T=de(C);ie(i,p,T),_?(m.array.next({name:p,values:de(i)}),(h.isDirty||h.dirtyFields||g.isDirty||g.dirtyFields)&&D.shouldDirty&&m.state.next({name:p,dirtyFields:Ze(r,i),isDirty:A(p,T)})):B&&!B._f&&!Ne(T)?q(p,T,D):G(p,T,D),$s(p,l)?m.state.next({...s,name:p,values:de(i)}):m.state.next({name:o.mount?p:void 0,values:de(i)})},ee=async p=>{o.mount=!0;const C=p.target;let D=C.name,B=!0;const _=z(a,D),T=se=>{B=Number.isNaN(se)||We(se)&&isNaN(se.getTime())||De(se,z(i,D,se))},Y=ks(t.mode),ne=ks(t.reValidateMode);if(_){let se,ye;const Ue=C.type?Ss(_._f):Ra(p),Oe=p.type===Ct.BLUR||p.type===Ct.FOCUS_OUT,ii=!hc(_._f)&&!t.resolver&&!z(s.errors,D)&&!_._f.deps||gc(Oe,z(s.touchedFields,D),s.isSubmitted,ne,Y),It=$s(D,l,Oe);ie(i,D,Ue),Oe?(!C||!C.readOnly)&&(_._f.onBlur&&_._f.onBlur(p),c&&c(0)):_._f.onChange&&_._f.onChange(p);const Tt=E(D,Ue,Oe),li=!ve(Tt)||It;if(!Oe&&m.state.next({name:D,type:p.type,values:de(i)}),ii)return(h.isValid||g.isValid)&&(t.mode==="onBlur"?Oe&&b():Oe||b()),li&&m.state.next({name:D,...It?{}:Tt});if(!Oe&&It&&m.state.next({...s}),t.resolver){const{errors:Zn}=await M([D]);if(w([D]),T(Ue),B){const oi=Ds(s.errors,a,D),Xn=Ds(Zn,a,oi.name||D);se=Xn.error,D=Xn.name,ye=ve(Zn)}}else w([D],!0),se=(await Fs(_,l.disabled,i,v,t.shouldUseNativeValidation))[D],w([D]),T(Ue),B&&(se?ye=!1:(h.isValid||g.isValid)&&(ye=await O(a,!0)));B&&(_._f.deps&&(!Array.isArray(_._f.deps)||_._f.deps.length>0)&&re(_._f.deps),L(D,ye,se,Tt))}},ae=(p,C)=>{if(z(s.errors,C)&&p.focus)return p.focus(),1},re=async(p,C={})=>{let D,B;const _=lt(p);if(t.resolver){const T=await $(oe(p)?p:_);D=ve(T),B=p?!_.some(Y=>z(T,Y)):D}else p?(B=(await Promise.all(_.map(async T=>{const Y=z(a,T);return await O(Y&&Y._f?{[T]:Y}:Y)}))).every(Boolean),!(!B&&!s.isValid)&&b()):B=D=await O(a);return m.state.next({...!ke(p)||(h.isValid||g.isValid)&&D!==s.isValid?{}:{name:p},...t.resolver||!p?{isValid:D}:{},errors:s.errors}),C.shouldFocus&&!B&&ot(a,ae,p?_:l.mount),B},U=(p,C)=>{let D={...o.mount?i:r};return C&&(D=Ua(C.dirtyFields?s.dirtyFields:s.touchedFields,D)),oe(p)?D:ke(p)?z(D,p):p.map(B=>z(D,B))},Z=(p,C)=>({invalid:!!z((C||s).errors,p),isDirty:!!z((C||s).dirtyFields,p),error:z((C||s).errors,p),isValidating:!!z(s.validatingFields,p),isTouched:!!z((C||s).touchedFields,p)}),Q=p=>{p&<(p).forEach(C=>ue(s.errors,C)),m.state.next({errors:p?s.errors:{}})},H=(p,C,D)=>{const B=(z(a,p,{_f:{}})._f||{}).ref,_=z(s.errors,p)||{},{ref:T,message:Y,type:ne,...se}=_;ie(s.errors,p,{...se,...C,ref:B}),m.state.next({name:p,errors:s.errors,isValid:!1}),D&&D.shouldFocus&&B&&B.focus&&B.focus()},X=(p,C)=>je(p)?m.state.subscribe({next:D=>"values"in D&&p(I(void 0,C),D)}):I(p,C,!0),J=p=>m.state.subscribe({next:C=>{pc(p.name,C.name,p.exact)&&xc(C,p.formState||h,Fe,p.reRenderRoot)&&p.callback({values:{...i},...s,...C,defaultValues:r})}}).unsubscribe,Ce=p=>(o.mount=!0,g={...g,...p.formState},J({...p,formState:{...f,...p.formState}})),be=(p,C={})=>{for(const D of p?lt(p):l.mount)l.mount.delete(D),l.array.delete(D),C.keepValue||(ue(a,D),ue(i,D)),!C.keepError&&ue(s.errors,D),!C.keepDirty&&ue(s.dirtyFields,D),!C.keepTouched&&ue(s.touchedFields,D),!C.keepIsValidating&&ue(s.validatingFields,D),!t.shouldUnregister&&!C.keepDefaultValue&&ue(r,D);m.state.next({values:de(i)}),m.state.next({...s,...C.keepDirty?{isDirty:A()}:{}}),!C.keepIsValid&&b()},he=({disabled:p,name:C})=>{if(Se(p)&&o.mount||p||l.disabled.has(C)){const _=l.disabled.has(C)!==!!p;p?l.disabled.add(C):l.disabled.delete(C),_&&o.mount&&!o.action&&b()}},Be=(p,C={})=>{let D=z(a,p);const B=Se(C.disabled)||Se(t.disabled);return ie(a,p,{...D||{},_f:{...D&&D._f?D._f:{ref:{name:p}},name:p,mount:!0,...C}}),l.mount.add(p),D?he({disabled:Se(C.disabled)?C.disabled:t.disabled,name:p}):S(p,!0,C.value),{...B?{disabled:C.disabled||t.disabled}:{},...t.progressive?{required:!!C.required,min:at(C.min),max:at(C.max),minLength:at(C.minLength),maxLength:at(C.maxLength),pattern:at(C.pattern)}:{},name:p,onChange:ee,onBlur:ee,ref:_=>{if(_){Be(p,C),D=z(a,p);const T=oe(_.value)&&_.querySelectorAll&&_.querySelectorAll("input,select,textarea")[0]||_,Y=oc(T),ne=D._f.refs||[];if(Y?ne.find(se=>se===T):T===D._f.ref)return;ie(a,p,{_f:{...D._f,...Y?{refs:[...ne.filter(Wt),T,...Array.isArray(z(r,p))?[{}]:[]],ref:{type:T.type,name:p}}:{ref:T}}}),S(p,!1,void 0,T)}else D=z(a,p,{}),D._f&&(D._f.mount=!1),(t.shouldUnregister||C.shouldUnregister)&&!(za(l.array,p)&&o.action)&&l.unMount.add(p)}}},Te=()=>t.shouldFocusError&&ot(a,ae,l.mount),Pe=p=>{Se(p)&&(m.state.next({disabled:p}),ot(a,(C,D)=>{const B=z(a,D);B&&(C.disabled=B._f.disabled||p,Array.isArray(B._f.refs)&&B._f.refs.forEach(_=>{_.disabled=B._f.disabled||p}))},0,!1))},_e=(p,C)=>async D=>{let B;D&&(D.preventDefault&&D.preventDefault(),D.persist&&D.persist());let _=de(i);if(m.state.next({isSubmitting:!0}),t.resolver){const{errors:T,values:Y}=await M();w(),s.errors=T,_=de(Y)}else await O(a);if(l.disabled.size)for(const T of l.disabled)ue(_,T);if(ue(s.errors,"root"),ve(s.errors)){m.state.next({errors:{}});try{await p(_,D)}catch(T){B=T}}else C&&await C({...s.errors},D),Te(),setTimeout(Te);if(m.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:ve(s.errors)&&!B,submitCount:s.submitCount+1,errors:s.errors}),B)throw B},Ve=(p,C={})=>{z(a,p)&&(oe(C.defaultValue)?W(p,de(z(r,p))):(W(p,C.defaultValue),ie(r,p,de(C.defaultValue))),C.keepTouched||ue(s.touchedFields,p),C.keepDirty||(ue(s.dirtyFields,p),s.isDirty=C.defaultValue?A(p,de(z(r,p))):A()),C.keepError||(ue(s.errors,p),h.isValid&&b()),m.state.next({...s}))},Ee=(p,C={})=>{const D=p?de(p):r,B=de(D),_=ve(p),T=_?r:B;if(C.keepDefaultValues||(r=D),!C.keepValues){if(C.keepDirtyValues){const Y=new Set([...l.mount,...Object.keys(Ze(r,i))]);for(const ne of Array.from(Y)){const se=z(s.dirtyFields,ne),ye=z(i,ne),Ue=z(T,ne);se&&!oe(ye)?ie(T,ne,ye):!se&&!oe(Ue)&&W(ne,Ue)}}else{if($n&&oe(p))for(const Y of l.mount){const ne=z(a,Y);if(ne&&ne._f){const se=Array.isArray(ne._f.refs)?ne._f.refs[0]:ne._f.ref;if(St(se)){const ye=se.closest("form");if(ye){ye.reset();break}}}}if(C.keepFieldsRef)for(const Y of l.mount)W(Y,z(T,Y));else a={}}i=t.shouldUnregister?C.keepDefaultValues?de(r):{}:de(T),m.array.next({values:{...T}}),m.state.next({values:{...T}})}l={mount:C.keepDirtyValues?l.mount:new Set,unMount:new Set,array:new Set,disabled:new Set,watch:new Set,watchAll:!1,focus:""},o.mount=!h.isValid||!!C.keepIsValid||!!C.keepDirtyValues||!t.shouldUnregister&&!ve(T),o.watch=!!t.shouldUnregister,o.keepIsValid=!!C.keepIsValid,o.action=!1,C.keepErrors||(s.errors={}),m.state.next({submitCount:C.keepSubmitCount?s.submitCount:0,isDirty:_?!1:C.keepDirty?s.isDirty:!!(C.keepDefaultValues&&!De(p,r)),isSubmitted:C.keepIsSubmitted?s.isSubmitted:!1,dirtyFields:_?{}:C.keepDirtyValues?C.keepDefaultValues&&i?Ze(r,i):s.dirtyFields:C.keepDefaultValues&&p?Ze(r,p):C.keepDirty?s.dirtyFields:{},touchedFields:C.keepTouched?s.touchedFields:{},errors:C.keepErrors?s.errors:{},isSubmitSuccessful:C.keepIsSubmitSuccessful?s.isSubmitSuccessful:!1,isSubmitting:!1,defaultValues:r})},te=(p,C)=>Ee(je(p)?p(i):p,{...t.resetOptions,...C}),me=(p,C={})=>{const D=z(a,p),B=D&&D._f;if(B){const _=B.refs?B.refs[0]:B.ref;_.focus&&setTimeout(()=>{_.focus(),C.shouldSelect&&je(_.select)&&_.select()})}},Fe=p=>{s={...s,...p}},xe={control:{register:Be,unregister:be,getFieldState:Z,handleSubmit:_e,setError:H,_subscribe:J,_runSchema:M,_updateIsValidating:w,_focusError:Te,_getWatch:I,_getDirty:A,_setValid:b,_setFieldArray:y,_setDisabledField:he,_setErrors:N,_getFieldArray:P,_reset:Ee,_resetDefaultValues:()=>je(t.defaultValues)&&t.defaultValues().then(p=>{te(p,t.resetOptions),m.state.next({isLoading:!1})}),_removeUnmounted:F,_disableForm:Pe,_subjects:m,_proxyFormState:h,get _fields(){return a},get _formValues(){return i},get _state(){return o},set _state(p){o=p},get _defaultValues(){return r},get _names(){return l},set _names(p){l=p},get _formState(){return s},get _options(){return t},set _options(p){t={...t,...p}}},subscribe:Ce,trigger:re,register:Be,handleSubmit:_e,watch:X,setValue:W,getValues:U,reset:te,resetField:Ve,clearErrors:Q,unregister:be,setError:H,setFocus:me,getFieldState:Z};return{...xe,formControl:xe}}function wc(e={}){const t=x.useRef(void 0),s=x.useRef(void 0),[a,r]=x.useState({isDirty:!1,isValidating:!1,isLoading:je(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:je(e.defaultValues)?void 0:e.defaultValues});if(!t.current)if(e.formControl)t.current={...e.formControl,formState:a},e.defaultValues&&!je(e.defaultValues)&&e.formControl.reset(e.defaultValues,e.resetOptions);else{const{formControl:o,...l}=jc(e);t.current={...l,formState:a}}const i=t.current.control;return i._options=e,Ln(()=>{const o=i._subscribe({formState:i._proxyFormState,callback:()=>r({...i._formState}),reRenderRoot:!0});return r(l=>({...l,isReady:!0})),i._formState.isReady=!0,o},[i]),x.useEffect(()=>i._disableForm(e.disabled),[i,e.disabled]),x.useEffect(()=>{e.mode&&(i._options.mode=e.mode),e.reValidateMode&&(i._options.reValidateMode=e.reValidateMode)},[i,e.mode,e.reValidateMode]),x.useEffect(()=>{e.errors&&(i._setErrors(e.errors),i._focusError())},[i,e.errors]),x.useEffect(()=>{e.shouldUnregister&&i._subjects.state.next({values:i._getWatch()})},[i,e.shouldUnregister]),x.useEffect(()=>{if(i._proxyFormState.isDirty){const o=i._getDirty();o!==a.isDirty&&i._subjects.state.next({isDirty:o})}},[i,a.isDirty]),x.useEffect(()=>{var o;e.values&&!De(e.values,s.current)?(i._reset(e.values,{keepFieldsRef:!0,...i._options.resetOptions}),!((o=i._options.resetOptions)===null||o===void 0)&&o.keepIsValid||i._setValid(),s.current=e.values,r(l=>({...l}))):i._resetDefaultValues()},[i,e.values]),x.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()}),t.current.formState=x.useMemo(()=>Va(a,i),[i,a]),t.current}function Nc(e,t=3){return e%1===0?e.toString():e.toFixed(t).replace(/\.?0+$/,"")}function Cc(e,t="en-US",s="USD"){try{return new Intl.NumberFormat(t,{style:"currency",currency:s,minimumFractionDigits:2,maximumFractionDigits:2}).format(e)}catch(a){return console.warn(`Invalid currency formatting: ${a}`),`${s} ${e.toFixed(2)}`}}function Sc(e="USD",t="en-US"){try{return new Intl.NumberFormat(t,{style:"currency",currency:e}).formatToParts(0).find(i=>i.type==="currency")?.value??"$"}catch{return"$"}}function kc(e){const t=e.replace(/[^\d.,-]/g,""),s=t.match(/,\d{1,2}$/);let a;s?a=t.replace(/\./g,"").replace(",","."):a=t.replace(/,/g,"");const r=parseFloat(a);return isNaN(r)?null:r}function Ac(e,t,s=.001){const a=e-t,r=Math.abs(a)<=s;return{difference:a,isBalanced:r,isUnderAllocated:!r&&a>0,isOverAllocated:!r&&a<0}}function Tn(){return`dist-${Date.now()}-${Math.random().toString(36).substr(2,9)}`}Tn();const $c={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:"$"},Yt=()=>({id:Tn(),amount:0,glAccount:null,isTaxDeductible:!1}),Ga=({distribution:e,defaultDistribution:t,glAccounts:s=[],isLoadingGlAccounts:a=!1,onSearchGlAccounts:r,onDistributionChange:i,onAmountChange:o,onGlAccountChange:l,onTaxDeductibleChange:c,onDelete:u,canDelete:f=!0,canEditTaxDeductible:h=!0,isDisabled:g=!1,labels:m,classNames:v={},"data-testid":j,control:b,name:w,rules:y})=>{const k={...$c,...m},N=b!==void 0&&w!==void 0,S=wc({defaultValues:{_internal:t||Yt()}}),E=rc({control:N?b:S.control,name:N?w:"_internal",rules:N?y:void 0}),[L,M]=x.useState(t||Yt()),$=N?E.field.value??Yt():e??L,O=N&&!!E.fieldState?.error,F=N&&(E.fieldState?.isTouched??!1),A=O||F,I=A&&(!$.amount||$.amount<=0),P=A&&!$.glAccount,[G,q]=x.useState($.glAccount?.name||""),W=x.useCallback(H=>{const X={...$,...H};N&&E.field.onChange(X),!N&&e===void 0&&M(X),i?.(X)},[$,e,i,N,E]),ee=x.useCallback(H=>{const X=H||0;W({amount:X}),o?.(X)},[W,o]),ae=x.useCallback(H=>{q(H),r?.(H)},[r]),re=x.useCallback(H=>{if(H===null){W({glAccount:null}),l?.(null);return}const J=s.find(Ce=>String(Ce.id)===String(H))||null;W({glAccount:J}),l?.(J)},[s,W,l]),U=x.useCallback(()=>{q(""),W({glAccount:null}),l?.(null)},[W,l]),Z=x.useCallback(H=>{W({isTaxDeductible:H}),c?.(H)},[W,c]),Q=x.useCallback(()=>{u?.()},[u]);return n.jsx(d.Card,{radius:"md",shadow:"sm","data-testid":j||"revenue-distribution-card",className:d.cn(v.base),children:n.jsxs(d.CardBody,{className:d.cn("flex flex-row flex-nowrap items-start gap-4",v.body),children:[n.jsx("div",{className:d.cn("shrink-0",v.amountContainer),children:n.jsx(d.NumberInput,{"data-testid":`${j||"revenue-distribution-card"}-amount-input`,label:n.jsxs("span",{className:"flex items-center gap-1",children:[k.amount,n.jsx(d.Tooltip,{content:k.amountTooltip,children:n.jsx(V,{icon:"solar:info-circle-linear",className:"text-default-400 cursor-help",width:16})})]}),value:$.amount||void 0,onValueChange:ee,labelPlacement:"outside",placeholder:k.amountPlaceholder,isWheelDisabled:!0,hideStepper:!0,variant:"bordered",isDisabled:g,isInvalid:I,errorMessage:I?"Amount is required":void 0,minValue:0,step:.01,className:v.amountInput,startContent:n.jsx("div",{className:"pointer-events-none flex items-center",children:n.jsx("span",{className:"text-default-400 text-small",children:k.currencySymbol})})})}),n.jsx("div",{className:d.cn("grow",v.glAccountContainer),children:n.jsx(d.Autocomplete,{"data-testid":`${j||"revenue-distribution-card"}-gl-account-input`,label:n.jsxs("span",{className:"flex items-center gap-1",children:[k.glAccount,n.jsx(d.Tooltip,{content:k.glAccountTooltip,children:n.jsx(V,{icon:"solar:info-circle-linear",className:"text-default-400 cursor-help",width:16})})]}),isLoading:a,isClearable:!0,labelPlacement:"outside",variant:"bordered",items:s,menuTrigger:"input",inputValue:$.glAccount?.name??G,selectedKey:$.glAccount?.id??null,isDisabled:g,isInvalid:P,errorMessage:P?"GL Account is required":void 0,listboxProps:{emptyContent:a?k.searching:k.noGlAccountsFound},placeholder:k.glAccountPlaceholder,onInputChange:ae,onSelectionChange:re,onClear:U,className:v.glAccountInput,children:H=>n.jsx(d.AutocompleteItem,{textValue:H.name,children:n.jsxs("div",{className:"flex flex-col",children:[n.jsx("span",{children:H.name}),H.code&&n.jsx("span",{className:"text-xs text-default-400",children:H.code})]})},H.id)})}),n.jsx("div",{className:d.cn("shrink-0 pt-6 flex items-center",v.taxDeductibleContainer),children:n.jsx(d.Checkbox,{radius:"full","data-testid":`${j||"revenue-distribution-card"}-tax-deductible`,isSelected:$.isTaxDeductible,onValueChange:Z,isDisabled:g||!h,className:v.taxDeductibleCheckbox,children:k.taxDeductible})}),n.jsx("div",{className:d.cn("shrink-0 pt-6",v.deleteContainer),children:n.jsx(R,{"data-testid":`${j||"revenue-distribution-card"}-delete-button`,size:"sm",color:"danger",variant:"flat",isDisabled:g||!f,onPress:Q,startContent:n.jsx(V,{icon:"solar:trash-bin-trash-linear",width:16}),className:d.cn("text-danger",v.deleteButton),children:k.deleteButton})})]})})};Ga.displayName="RevenueDistributionCard";const Qa=({message:e="No distributions configured",icon:t="solar:document-text-outline",iconSize:s=48,showCard:a=!0,classNames:r={},renderEmpty:i})=>{if(i)return n.jsx(n.Fragment,{children:i()});const o=n.jsxs("div",{className:d.cn("flex flex-col items-center justify-center py-8",r.content),children:[n.jsx(V,{icon:t,width:s,className:d.cn("text-default-300 mb-4",r.icon)}),n.jsx("p",{className:d.cn("text-default-500 text-sm text-center",r.message),children:e})]});return a?n.jsx(d.Card,{radius:"sm",shadow:"sm","data-testid":"revenue-distribution-empty",className:d.cn("w-full",r.base),children:n.jsx(d.CardBody,{children:o})}):n.jsx("div",{"data-testid":"revenue-distribution-empty",className:d.cn("w-full",r.base),children:o})};Qa.displayName="RevenueDistributionEmpty";const Dc={title:"Error Loading Distributions",description:"An error occurred while loading the distribution configuration. Please try again."},Za=({error:e,labels:t,showCard:s=!0,color:a="danger",classNames:r={}})=>{const i={...Dc,...t},o=n.jsx(d.Alert,{"data-testid":"revenue-distribution-error-alert",color:a,title:i.title,description:e||i.description,className:r.alert});return s?n.jsx(d.Card,{radius:"sm",shadow:"sm","data-testid":"revenue-distribution-error",className:d.cn("w-full",r.base),children:n.jsx(d.CardBody,{children:o})}):n.jsx("div",{"data-testid":"revenue-distribution-error",className:d.cn("w-full",r.base),children:o})};Za.displayName="RevenueDistributionError";const Xa=({rows:e=1,showCard:t=!0,classNames:s={}})=>{const a=Array.from({length:e},(i,o)=>o),r=i=>n.jsxs("div",{className:d.cn("flex flex-row flex-nowrap items-end gap-4",s.row),children:[n.jsxs("div",{className:"shrink-0 flex flex-col gap-1",children:[n.jsxs("div",{className:"flex items-center gap-1",children:[n.jsx(d.Skeleton,{className:"h-4 w-14 rounded-md"}),n.jsx(d.Skeleton,{className:"h-4 w-4 rounded-full"})]}),n.jsx(d.Skeleton,{className:"h-10 w-32 rounded-lg"})]}),n.jsxs("div",{className:"grow flex flex-col gap-1",children:[n.jsxs("div",{className:"flex items-center gap-1",children:[n.jsx(d.Skeleton,{className:"h-4 w-20 rounded-md"}),n.jsx(d.Skeleton,{className:"h-4 w-4 rounded-full"})]}),n.jsx(d.Skeleton,{className:"h-10 w-full rounded-lg"})]}),n.jsxs("div",{className:"shrink-0 pb-2 flex items-center gap-2",children:[n.jsx(d.Skeleton,{className:"h-5 w-5 rounded-full"}),n.jsx(d.Skeleton,{className:"h-4 w-24 rounded-md"})]}),n.jsx("div",{className:"shrink-0 pb-2",children:n.jsx(d.Skeleton,{className:"h-8 w-20 rounded-lg"})})]},i);return t?n.jsx("div",{className:d.cn("flex flex-col gap-3",s.base),children:a.map(i=>n.jsx(d.Card,{radius:"md",shadow:"sm","data-testid":`revenue-distribution-skeleton-${i}`,children:n.jsx(d.CardBody,{children:r(i)})},i))}):n.jsx("div",{"data-testid":"revenue-distribution-skeleton",className:d.cn("flex flex-col gap-3",s.base),children:a.map(i=>r(i))})};Xa.displayName="RevenueDistributionSkeleton";function Lt({isOpen:e,labels:t,icon:s,isConfirming:a=!1,confirmColor:r="danger",iconTone:i="danger",portalContainer:o,shouldBlockScroll:l,classNames:c,onClose:u,onConfirm:f}){return n.jsx(d.Modal,{isOpen:e,size:"md",placement:"center",portalContainer:o,shouldBlockScroll:l,classNames:{...c,base:d.cn("max-w-[440px] rounded-3xl",c?.base),closeButton:d.cn("right-5 top-5 text-zinc-500",c?.closeButton)},onOpenChange:h=>!h&&u(),children:n.jsxs(d.ModalContent,{children:[n.jsxs(d.ModalHeader,{className:"flex flex-col items-start gap-4 px-7 pb-0 pt-7",children:[s&&n.jsx("span",{className:d.cn("flex h-12 w-12 shrink-0 items-center justify-center rounded-full",i==="warning"?"bg-brand/15 text-brand":"bg-danger-100 text-danger-600"),children:s}),n.jsx("span",{className:"text-lg font-semibold leading-6 text-zinc-950",children:t.title})]}),n.jsx(d.ModalBody,{className:"px-7 pb-3 pt-4",children:n.jsx("div",{className:"text-sm leading-6 text-zinc-500",children:t.description})}),n.jsxs(d.ModalFooter,{className:"grid grid-cols-2 gap-3 px-7 pb-7 pt-3",children:[n.jsx(R,{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:t.cancel}),n.jsx(R,{type:"button",size:"md",color:r,radius:"full",className:d.cn("h-10 text-sm font-normal text-white",r==="danger"?"bg-danger-600":"bg-brand"),isLoading:a,onPress:f,children:t.confirm})]})]})})}const Ec=()=>({id:crypto.randomUUID(),fund:null,percentage:0});function mn(e){return!e.fund&&Number(e.percentage||0)<=0}function Fc({mode:e,assignments:t}){const s=t.filter(o=>!mn(o)),a=s.filter(o=>o.fund),r=a.reduce((o,l)=>o+Number(l.percentage||0),0),i=s.some(o=>!o.fund||Number(o.percentage||0)<=0);return a.length>=1&&!i&&Math.round(r*100)/100===100}const Lc={title:"Payment assignment",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"},Ja={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"},rt={...Ja,base:"min-h-11 rounded-2xl px-4 py-2 shadow-none",title:"text-sm font-medium"},Mc={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"},Ic={wrapper:"!absolute !inset-0 !z-50 !items-center !justify-center !p-4",backdrop:"!absolute !inset-0 !z-40 rounded-2xl"};function Tc(){return n.jsxs("svg",{"aria-hidden":"true",className:"size-4 text-zinc-500",fill:"none",viewBox:"0 0 16 16",children:[n.jsx("rect",{x:"3",y:"3",width:"4",height:"4",rx:"1",stroke:"currentColor",strokeWidth:"1.4"}),n.jsx("rect",{x:"9",y:"3",width:"4",height:"4",rx:"1",stroke:"currentColor",strokeWidth:"1.4"}),n.jsx("rect",{x:"3",y:"9",width:"4",height:"4",rx:"1",stroke:"currentColor",strokeWidth:"1.4"}),n.jsx("rect",{x:"9",y:"9",width:"4",height:"4",rx:"1",stroke:"currentColor",strokeWidth:"1.4"})]})}const Pc=e=>Number.isFinite(e)?Math.max(0,Math.min(100,Math.round(e*100)/100)):0,_c=e=>e.fund!==null;function Oc({assignments:e,funds:t,labels:s,classNames:a,isSaving:r=!1,hasSavedAssignments:i=!1,isFundPickerOpen:o=!1,activeAssignmentId:l=null,modalPortalContainer:c,footer:u,onAssignmentsChange:f,onOpenFundPicker:h,onCloseFundPicker:g,onCollapseChange:m,onSave:v}){const[j,b]=x.useState(null),w=c??j??void 0,y={...Lc,...s},k=e.filter(H=>!mn(H)),S=k.filter(_c).length>0,E=x.useMemo(()=>e.filter(H=>!mn(H)).reduce((H,X)=>H+Number(X.percentage||0),0),[e]),L=Math.round(E*100)/100,M=k.some(H=>!H.fund||Number(H.percentage||0)<=0),$=S&&(L!==100||M),O=`${y.totalError} (${y.total} ${Number(E.toFixed(2))}%)`,F=Fc({mode:"split",assignments:e}),A=S&&L>=100,[I,P]=x.useState(!1),[G,q]=x.useState(!1),W=n.jsxs("span",{className:"flex items-center gap-2",children:[n.jsx(Tc,{}),n.jsx("span",{className:"text-base font-medium leading-6 text-zinc-950",children:y.title})]}),ee=(H,X)=>{f(e.map(J=>J.id===H?{...J,...X}:J))},ae=()=>{A||f([...e,Ec()])},re=H=>{e.length<=1||f(e.filter(X=>X.id!==H))},U=()=>{if(!r){if(!F){q(!0);return}if(!i){v();return}P(!0)}},Z=()=>{P(!1),v()},Q=H=>{const X=l??e.find(J=>!J.fund)?.id??e[0]?.id;X&&(f(e.map(J=>J.id===X?{...J,fund:H}:J)),g())};return n.jsxs("div",{ref:b,className:d.cn("vvt-pa relative font-sans text-zinc-900",o&&!c&&"min-h-[560px]",a?.root),children:[n.jsx(d.Accordion,{variant:"splitted",defaultSelectedKeys:["installment-fund-assignment"],className:d.cn("w-full gap-0 px-0",a?.panel),itemClasses:{base:"w-full rounded-2xl border border-zinc-200 bg-white p-0 shadow-sm",trigger:d.cn("px-4 py-4",a?.header),title:"w-full",content:"w-full px-4 pb-4 pt-0",indicator:"text-zinc-500 [&>svg]:size-4"},onSelectionChange:H=>m?.(!(H==="all"||Array.from(H).length>0)),children:n.jsx(d.AccordionItem,{"aria-label":y.title,title:W,children:n.jsxs("div",{className:d.cn("flex w-full flex-col gap-4",a?.content),children:[n.jsxs("div",{className:"flex w-full flex-col gap-4",children:[!S&&n.jsx(d.Alert,{icon:n.jsx(V,{icon:"solar:info-circle-outline",className:"size-4"}),hideIconWrapper:!0,isClosable:!1,classNames:Ja,color:"default",variant:"flat",title:y.emptySplit}),S&&n.jsx(Rc,{assignments:e,labels:y,total:E,hasTotalError:G&&!F||$,validationMessage:O,onSelectFund:H=>h(H),onRemoveFund:re,onPercentageChange:(H,X)=>ee(H,{percentage:Pc(X)})}),n.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[n.jsx(R,{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",startContent:n.jsx(K.Plus,{className:"size-5",strokeWidth:2}),isDisabled:A,onPress:()=>S?ae():h(),children:y.assignSpecificFund}),n.jsx(R,{type:"button",size:"md",color:"primary",radius:"full",className:"ml-auto h-10 min-w-40 bg-brand px-4 text-sm font-medium text-white",startContent:r?void 0:n.jsx(V,{icon:"solar:cloud-upload-outline",className:"size-4"}),isLoading:r,onPress:U,children:y.saveAssignment})]})]}),u]})},"installment-fund-assignment")}),o&&n.jsx(zc,{funds:t,labels:y,selectedFundIds:e.map(H=>H.fund?.id).filter(Boolean),portalContainer:w,onSelect:Q,onClose:g}),n.jsx(Lt,{isOpen:I,labels:{title:y.modifyAssignedFundsTitle,description:n.jsxs(n.Fragment,{children:[n.jsx("p",{children:y.modifyAssignedFundsDescription}),n.jsx("p",{className:"mt-3",children:y.modifyAssignedFundsWarning})]}),cancel:y.modifyAssignedFundsCancel,confirm:y.modifyAssignedFundsConfirm},icon:n.jsx(V,{icon:"solar:info-circle-outline",className:"size-7"}),iconTone:"warning",confirmColor:"primary",portalContainer:w,shouldBlockScroll:!1,classNames:Ic,onClose:()=>P(!1),onConfirm:Z})]})}function Rc({assignments:e,labels:t,total:s,hasTotalError:a,validationMessage:r,onSelectFund:i,onRemoveFund:o,onPercentageChange:l}){return n.jsxs("div",{className:"flex flex-col gap-3",children:[e.map((c,u)=>n.jsxs("div",{className:"flex min-h-15 w-full items-center gap-3 rounded-2xl border border-zinc-200 bg-white px-3 py-2",children:[n.jsx("div",{className:d.cn("flex min-h-11 min-w-0 flex-1 items-center","gap-4"),children:c.fund?n.jsxs(n.Fragment,{children:[n.jsxs("span",{className:"rounded-full bg-zinc-100 px-4 py-1.5 text-sm text-zinc-950",children:[c.fund.glCode," - ",c.fund.accountName]}),n.jsx(R,{type:"button",variant:"light",radius:"full",className:"px-2 text-sm font-normal text-brand",onPress:()=>i(c.id),children:"Replace"})]}):n.jsx(R,{type:"button",size:"lg",variant:"light",radius:"full",className:"justify-start px-4 text-lg font-normal text-zinc-900",startContent:n.jsx(K.Plus,{className:"size-5",strokeWidth:2}),onPress:()=>i(c.id),children:t.assignSpecificFund})}),n.jsx("label",{className:"flex w-48 flex-none items-center",children:n.jsx(d.Input,{variant:"bordered",type:"number",min:0,max:100,step:.01,value:String(c.percentage||""),onChange:f=>l(c.id,Number(f.target.value)),endContent:n.jsx("span",{className:"text-sm text-zinc-500",children:"%"}),classNames:Mc})}),e.length>1&&n.jsx(R,{type:"button",isIconOnly:!0,variant:"flat",radius:"full",className:d.cn("h-10 w-10 flex-none p-0",u===0?"bg-danger-100 text-danger-500 opacity-60":"bg-danger-600 text-white"),style:{height:40,minWidth:40,width:40},isDisabled:u===0,onPress:()=>o(c.id),"aria-label":t.removeFund,children:n.jsx(V,{icon:"solar:trash-bin-minimalistic-outline",className:"size-5"})})]},c.id)),n.jsx(d.Alert,{icon:n.jsx(V,{icon:a?"solar:info-circle-outline":"solar:check-circle-outline",className:"size-4"}),hideIconWrapper:!0,isClosable:!1,color:a?"warning":"success",variant:"flat",classNames:{...rt,base:d.cn(rt.base,a?"bg-warning-50 text-warning-700":"bg-success-50 text-success-700"),iconWrapper:d.cn(rt.iconWrapper,a?"text-warning-700":"text-success-700"),alertIcon:d.cn(rt.alertIcon,a?"text-warning-700":"text-success-700"),title:d.cn(rt.title,a?"text-warning-700":"text-success-700")},title:a?r:`${t.total} ${Number(s.toFixed(2))}%`})]})}function zc({funds:e,labels:t,selectedFundIds:s,portalContainer:a,onSelect:r,onClose:i}){const[o,l]=x.useState(""),c=e.filter(u=>{if(s.includes(u.id))return!1;const f=o.trim().toLowerCase();return f?`${u.glCode} ${u.accountName} ${u.type}`.toLowerCase().includes(f):!0});return n.jsx(d.Modal,{isOpen:!0,size:"3xl",placement:"center",scrollBehavior:"inside",shouldBlockScroll:!1,portalContainer:a,classNames:{wrapper:"!absolute !inset-0 !z-50 !items-center !justify-center !p-4",backdrop:"!absolute !inset-0 !z-40 rounded-2xl",base:"max-h-[calc(100%-2rem)] max-w-3xl rounded-3xl",closeButton:"right-6 top-6 text-zinc-500"},onOpenChange:u=>!u&&i(),children:n.jsxs(d.ModalContent,{className:"max-h-full",children:[n.jsx(d.ModalHeader,{className:"px-6 pt-6 text-xl font-semibold leading-7 text-zinc-950",children:t.modalTitle}),n.jsxs(d.ModalBody,{className:"flex min-h-0 flex-1 flex-col px-6 pb-6",children:[n.jsx(d.Input,{variant:"bordered","aria-label":t.searchPlaceholder,value:o,placeholder:t.searchPlaceholder,onChange:u=>l(u.target.value),startContent:n.jsx(V,{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"}}),n.jsxs("div",{className:"mt-4 min-h-0 flex-1 overflow-auto",children:[n.jsxs("div",{className:"grid 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",children:[n.jsx("span",{children:t.glCode}),n.jsx("span",{children:t.accountName}),n.jsx("span",{children:t.actions})]}),c.length===0&&n.jsx("div",{className:"p-4 text-sm text-zinc-500",children:t.noFunds}),c.map(u=>n.jsxs("div",{className:"grid grid-cols-[1fr_1.3fr_0.6fr] items-center gap-5 px-3 py-2.5 text-sm leading-5 text-zinc-900",children:[n.jsx("span",{children:u.glCode}),n.jsx("span",{children:u.accountName}),n.jsx(R,{type:"button",size:"sm",variant:"bordered",radius:"full",className:"h-9 min-w-24 border-zinc-200 bg-white text-sm font-medium text-zinc-900",onPress:()=>r(u),children:t.select})]},u.id))]})]})]})})}function Bc(){return n.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:[n.jsxs("div",{className:"flex items-start justify-between gap-3",children:[n.jsx(d.Skeleton,{className:"h-7 w-56 rounded-lg"}),n.jsx(d.Skeleton,{className:"size-8 rounded-full"})]}),n.jsxs("div",{className:"flex items-center justify-between gap-3",children:[n.jsx(d.Skeleton,{className:"h-10 w-72 rounded-full"}),n.jsx(d.Skeleton,{className:"h-10 w-40 rounded-full"})]}),n.jsxs("div",{className:"grid grid-cols-[minmax(0,1fr)_160px] items-center gap-4 rounded-2xl border border-zinc-100 p-3",children:[n.jsx(d.Skeleton,{className:"h-8 w-full max-w-xs rounded-full"}),n.jsx(d.Skeleton,{className:"h-8 w-full rounded-xl"})]}),n.jsx(d.Skeleton,{className:"h-11 w-40 rounded-full"})]})}const Vc={totalAmount:"Total Amount:",remainingBalance:"Remaining Balance",amountReceived:"Amount Received:"};function Uc({totalAmount:e,remainingBalance:t,amountReceived:s,currency:a="USD",locale:r="en-US",labels:i,className:o}){const l={...Vc,...i},c=new Intl.NumberFormat(r,{style:"currency",currency:a});return n.jsx("div",{className:d.cn("w-full rounded-2xl border border-zinc-200 bg-white px-4 py-2.5 font-sans text-base leading-6",o),children:n.jsxs("div",{className:"flex w-full flex-wrap items-center gap-x-5 gap-y-2",children:[n.jsx(Kt,{label:l.totalAmount,value:c.format(e)}),n.jsx(Kt,{label:l.remainingBalance,value:c.format(t)}),n.jsx(Kt,{label:l.amountReceived,value:c.format(s)})]})})}function Kt({label:e,value:t}){return n.jsxs("div",{className:"flex items-center gap-3 whitespace-nowrap",children:[n.jsx("span",{className:"font-medium text-zinc-700",children:e}),n.jsx("span",{className:"font-normal text-zinc-950",children:t})]})}const Hc={monthly:1,quarterly:3,annual:12},er=e=>{const[t,s,a]=e.split("-").map(Number);return{year:t,month:s,day:a}},qc=(e,t)=>new Date(e,t+1,0).getDate(),Wc=e=>{const t=e.getFullYear(),s=String(e.getMonth()+1).padStart(2,"0"),a=String(e.getDate()).padStart(2,"0");return`${t}-${s}-${a}`},Yc=(e,t)=>{const{year:s,month:a,day:r}=er(e),i=a-1+t,o=s+Math.floor(i/12),l=(i%12+12)%12,c=Math.min(r,qc(o,l));return new Date(o,l,c)},Kc=(e,t)=>{const{year:s,month:a,day:r}=er(e),i=new Date(s,a-1,r);return i.setDate(i.getDate()+t),i};function tr(e,t){const s=Math.max(1,Math.floor(t.numberOfInstallments||1)),a=Math.round(e*100),r=Math.floor(a/s),i=a-r*s,o=Hc[t.frequency];return Array.from({length:s},(l,c)=>{const u=t.frequency==="weekly"?Kc(t.firstInstallmentDate,c*7):Yc(t.firstInstallmentDate,c*(o??1));return{id:crypto.randomUUID(),dueDate:Wc(u),amount:(r+(c===0?i:0))/100}})}function Gc(e){return new Set(e.map((t,s)=>{const a=e[s+1]?.dueDate;return t.dueDate&&a&&t.dueDate>a?t.id:null}).filter(t=>!!t))}const Qc={title:"Payments",automaticMode:"Auto",manualMode:"Manual",createInstallments:"Create Payments",generateSchedule:"Generate Schedule",saveInstallments:"Save Payments",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 cannot exceed donation 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.",amountGreaterThanZeroError:"Payment amount must be greater than 0."},Zc=["weekly","monthly","quarterly","annual"],Xc=Array.from({length:31},(e,t)=>t+1),Jc=["numberOfInstallments","frequency","firstInstallmentDate"],ed={wrapper:"!absolute !inset-0 !z-50 !items-center !justify-center !p-4",backdrop:"!absolute !inset-0 !z-40 rounded-2xl"},Ls=()=>({id:crypto.randomUUID(),dueDate:new Date().toISOString().slice(0,10),amount:0}),nr=e=>Math.round(e*100)/100,td=(e,t)=>{const s=new Date(`${e}T00:00:00`);return Number.isNaN(s.getTime())?e:new Intl.DateTimeFormat(t,{month:"short",day:"numeric",year:"numeric"}).format(s)},Mt=e=>{if(!e)return null;try{return Ql(e)}catch{return null}},nd=e=>Mt(e)?.day??1,sd=(e,t)=>new Date(e,t,0).getDate(),ad=(e,t)=>{const s=Mt(e);if(!s)return e;const a=Math.min(t,sd(s.year,s.month));return s.set({day:a}).toString()},Ms=e=>{const t=e%100>=11&&e%100<=13?"th":e%10===1?"st":e%10===2?"nd":e%10===3?"rd":"th";return`${e}${t}`};function rd({mode:e,donationAmount:t,currency:s="USD",locale:a="en-US",installments:r,automaticSettings:i,defaultTab:o="automatic",showTitle:l=!0,showCard:c=!0,showSavePayment:u=!0,showTabs:f=!0,inputs:h=Jc,startDate:g,labels:m,classNames:v,isSaving:j=!1,isModeSwitchDisabled:b=!1,onModeChange:w,onAutomaticSettingsChange:y,onInstallmentsChange:k,onSave:N}){const[S,E]=x.useState(null),[L,M]=x.useState(o),$={...Qc,...m},O=e??L,F=x.useMemo(()=>new Intl.NumberFormat(a,{style:"currency",currency:s}),[s,a]),A=x.useMemo(()=>({...i,firstInstallmentDate:h.includes("firstInstallmentDate")?i.firstInstallmentDate:h.includes("dayOfMonth")?i.firstInstallmentDate||g||"":g||i.firstInstallmentDate}),[i,h,g]),I=O==="automatic"?tr(t,A):r,P=x.useMemo(()=>nr(I.reduce((J,Ce)=>J+Number(Ce.amount||0),0)),[I]),G=O==="manual"&&P-t>.009,[q,W]=x.useState(!1),ee=l?n.jsxs("span",{className:"flex items-center gap-2",children:[n.jsx(K.CircleDollarSign,{className:"size-4 text-zinc-500",strokeWidth:1.75}),n.jsx("span",{className:"text-base font-medium leading-6 text-zinc-950",children:$.title})]}):void 0,ae=J=>{J!==O&&(e||M(J),w?.(J),J==="manual"&&r.length===0&&k([Ls()]))},re=(J,Ce)=>{r.find(he=>he.id===J)?.status!=="paid"&&k(r.map(he=>he.id===J?{...he,...Ce}:he))},U=()=>{k([...r,Ls()])},Z=J=>{r.find(be=>be.id===J)?.status!=="paid"&&k(r.filter(be=>be.id!==J))},Q=()=>{if(!j){if(G){W(!0);return}N?.()}},H=()=>{W(!1),N?.()},X=n.jsxs("div",{className:d.cn("flex w-full flex-col gap-4",v?.content),children:[f||u?n.jsxs("div",{className:"flex w-full items-center justify-between gap-6",children:[f?n.jsx(id,{mode:O,labels:$,onModeChange:ae,isDisabled:b,className:v?.tabs}):null,u?n.jsx(R,{type:"button",size:"md",color:"primary",radius:"full",className:"ml-auto min-w-36",startContent:j?void 0:n.jsx(V,{icon:"solar:cloud-upload-outline",className:"size-4"}),isLoading:j,onPress:Q,children:$.saveInstallments}):null]}):null,n.jsxs("div",{className:d.cn("flex w-full flex-col gap-4",v?.preview),children:[O==="automatic"&&n.jsx(ld,{settings:A,inputs:h,labels:$,className:v?.controls,onSettingsChange:y}),I.length===0&&n.jsx(d.Alert,{isClosable:!1,color:"default",variant:"flat",radius:"full",title:O==="automatic"?$.emptyAutomatic:$.emptyManual}),I.length>0&&n.jsx(od,{mode:O,installments:I,labels:$,formatter:F,locale:a,onUpdateInstallment:re,onRemoveInstallment:Z}),O==="manual"&&n.jsx("div",{className:"flex flex-wrap gap-3",children:n.jsx(R,{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:n.jsx(K.Plus,{className:"size-5",strokeWidth:2}),onPress:U,children:$.addInstallment})}),n.jsx(dd,{total:P,donationAmount:t,hasTotalIncreaseWarning:G,mode:O,installments:I,formatter:F,labels:$,className:v?.summary})]})]});return n.jsxs("div",{ref:E,className:d.cn("vvt-ps relative font-sans text-zinc-900",v?.root),children:[c?n.jsx(d.Accordion,{variant:"splitted",defaultSelectedKeys:["installment-schedule"],className:d.cn("w-full gap-0 px-0",v?.panel),itemClasses:{base:"w-full rounded-2xl border border-zinc-200 bg-white p-0 shadow-sm",trigger:d.cn("px-4 py-4",v?.header),title:"w-full",content:"w-full px-4 pb-4 pt-0",indicator:"text-zinc-500 [&>svg]:size-4"},children:n.jsx(d.AccordionItem,{"aria-label":$.title,title:ee,children:X},"installment-schedule")}):X,n.jsx(Lt,{isOpen:q,labels:{title:$.totalIncreaseConfirmationTitle,description:$.totalIncreaseConfirmationDescription,cancel:$.totalIncreaseConfirmationCancel,confirm:$.totalIncreaseConfirmationConfirm},icon:n.jsx(V,{icon:"solar:info-circle-outline",className:"size-7"}),iconTone:"warning",confirmColor:"primary",isConfirming:j,portalContainer:S??void 0,shouldBlockScroll:!1,classNames:ed,onClose:()=>W(!1),onConfirm:H})]})}function id({mode:e,labels:t,className:s,isDisabled:a=!1,onModeChange:r}){return n.jsxs(d.Tabs,{"aria-label":t.title,selectedKey:e,isDisabled:a,color:"primary",size:"lg",radius:"full",className:d.cn("w-fit",s),onSelectionChange:i=>r(i),children:[n.jsx(d.Tab,{title:t.automaticMode},"automatic"),n.jsx(d.Tab,{title:t.manualMode},"manual")]})}function ld({settings:e,inputs:t,labels:s,className:a,onSettingsChange:r}){const i=o=>{if(o==="numberOfInstallments")return n.jsx("div",{className:"min-w-0",children:n.jsx(d.Input,{variant:"bordered",label:s.numberOfInstallments,labelPlacement:"outside",type:"number",min:1,step:1,value:e.numberOfInstallments>0?String(e.numberOfInstallments):"",onWheel:l=>l.currentTarget.blur(),onChange:l=>{const c=l.target.value;r({...e,numberOfInstallments:c===""?0:Math.max(1,Number(c))})}})},o);if(o==="frequency")return n.jsx("div",{className:"min-w-0",children:n.jsx(Ie,{variant:"bordered",label:s.frequency,labelPlacement:"outside",selectedKeys:[e.frequency],onSelectionChange:l=>{const c=Array.from(l)[0];typeof c=="string"&&r({...e,frequency:c})},children:Zc.map(l=>n.jsx(d.SelectItem,{textValue:s[l],children:s[l]},l))})},o);if(o==="dayOfMonth"){const l=String(nd(e.firstInstallmentDate));return n.jsx("div",{className:"min-w-0",children:n.jsx(Ie,{variant:"bordered",label:s.dayOfMonth,labelPlacement:"outside",selectedKeys:[l],onSelectionChange:c=>{const u=Number(Array.from(c)[0]);Number.isFinite(u)&&r({...e,firstInstallmentDate:ad(e.firstInstallmentDate,u)})},children:Xc.map(c=>n.jsx(d.SelectItem,{textValue:Ms(c),children:Ms(c)},String(c)))})},o)}return n.jsx("div",{className:"min-w-0",children:n.jsx(Cn,{variant:"bordered",label:s.firstInstallmentDate,labelPlacement:"outside",value:Mt(e.firstInstallmentDate),onChange:l=>r({...e,firstInstallmentDate:l?l.toString():""}),startContent:n.jsx(V,{icon:"solar:calendar-outline",className:"size-4 text-zinc-500"})})},o)};return t.length===0?null:n.jsx("div",{className:d.cn("grid gap-4",a),style:{gridTemplateColumns:"repeat(auto-fit, minmax(min(100%, 14rem), 1fr))"},children:t.map(i)})}function od({mode:e,installments:t,labels:s,formatter:a,locale:r,onUpdateInstallment:i,onRemoveInstallment:o}){const l=Gc(t),c=new Set(t.map(u=>Number(u.amount||0)<=0?u.id:null).filter(u=>!!u));return e==="automatic"?n.jsx("div",{className:"rounded-2xl border border-zinc-200 bg-zinc-50 p-4",children:n.jsx("div",{className:d.cn("flex flex-col gap-3",t.length>5&&"max-h-[264px] overflow-y-auto pr-2"),children:t.map((u,f)=>n.jsxs("div",{className:d.cn("flex min-h-10 items-center justify-between rounded-xl px-4 py-2 text-base",f===0&&"border border-primary/25 bg-primary/5 text-primary"),children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsxs("span",{children:["#",f+1]}),n.jsx("span",{children:"▪"}),n.jsx("span",{children:td(u.dueDate,r)}),f===0&&t.length>1&&n.jsx(d.Chip,{size:"sm",color:"primary",variant:"solid",radius:"full",children:"First charge"})]}),n.jsx("span",{className:"text-zinc-950",children:a.format(u.amount)})]},u.id))})}):n.jsx("div",{className:"flex flex-col gap-2",children:t.map((u,f)=>{const h=l.has(u.id),g=c.has(u.id);return n.jsx("div",{className:"flex w-full flex-col gap-1",children:n.jsxs("div",{className:"grid w-full grid-cols-[2rem_minmax(0,1fr)_minmax(0,1fr)_2.25rem] items-start gap-4",children:[n.jsx("span",{className:"pt-2 text-sm font-medium text-zinc-500",children:f+1}),n.jsx("div",{className:"min-w-0 flex-1",children:n.jsx(Cn,{variant:"bordered","aria-label":`${s.dueDate} ${f+1}`,isDisabled:u.status==="paid",isInvalid:h,errorMessage:h?s.dateOrderError:void 0,value:Mt(u.dueDate),onChange:m=>i(u.id,{dueDate:m?m.toString():""})})}),n.jsx("div",{className:"min-w-0 flex-1",children:n.jsx(d.Input,{variant:"bordered",type:"number",min:0,step:.01,isDisabled:u.status==="paid",isInvalid:g,errorMessage:g?s.amountGreaterThanZeroError:void 0,value:String(u.amount||""),onChange:m=>i(u.id,{amount:nr(Number(m.target.value||0))}),startContent:n.jsx("span",{className:"text-zinc-900",children:"$"})})}),n.jsx(cd,{isDisabled:t.length<=1,isPaid:u.status==="paid",label:s.deleteInstallment,onRemove:()=>o(u.id)})]})},u.id)})})}function cd({isDisabled:e,isPaid:t,label:s,onRemove:a}){const r=n.jsx(R,{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||t,onPress:a,"aria-label":s,children:n.jsx(V,{icon:"solar:trash-bin-minimalistic-outline",className:"size-5"})});return t?n.jsx(d.Tooltip,{content:"This payment cannot be edited or deleted because it has already been paid.",placement:"top",children:n.jsx("span",{className:"inline-flex",children:r})}):r}function dd({total:e,donationAmount:t,hasTotalIncreaseWarning:s,mode:a,installments:r,formatter:i,labels:o,className:l}){const c=r.length,u=r[0]?.amount??0,f=r[1]?.amount??u,h=c>1&&Math.round(u*100)!==Math.round(f*100),g=Math.max(t-e,0),m=s?n.jsx("span",{children:o.totalIncreaseWarning}):a==="automatic"?h?n.jsxs("span",{children:["Saving will create ",n.jsx("strong",{children:c})," scheduled payment records:"," ",n.jsx("strong",{children:i.format(u)})," first charge and"," ",n.jsx("strong",{children:i.format(f)})," for each remaining charge."]}):n.jsxs("span",{children:["Saving will create ",n.jsx("strong",{children:c})," scheduled payment records of"," ",n.jsx("strong",{children:i.format(u)})," each."]}):n.jsxs("span",{children:["Total scheduled: ",n.jsx("strong",{children:i.format(e)})," /"," ",n.jsx("strong",{children:i.format(t)}),"."]}),v=a==="automatic"?`Total: ${i.format(e)}`:s?`New total: ${i.format(e)}`:`${o.remaining}: ${i.format(g)}`;return n.jsx(d.Alert,{isClosable:!1,color:s?"warning":"default",variant:"flat",radius:"full",className:l,endContent:n.jsx("span",{className:"whitespace-nowrap",children:v}),title:m})}function ud(){return n.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:[n.jsxs("div",{className:"flex items-start justify-between gap-3",children:[n.jsx(d.Skeleton,{className:"h-7 w-56 rounded-lg"}),n.jsx(d.Skeleton,{className:"size-8 rounded-full"})]}),n.jsxs("div",{className:"flex items-center justify-between gap-3",children:[n.jsx(d.Skeleton,{className:"h-10 w-72 rounded-full"}),n.jsx(d.Skeleton,{className:"h-10 w-40 rounded-full"})]}),n.jsxs("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-end sm:justify-between",children:[n.jsxs("div",{className:"flex w-full max-w-[280px] flex-col gap-2",children:[n.jsx(d.Skeleton,{className:"h-4 w-36 rounded-md"}),n.jsx(d.Skeleton,{className:"h-9 w-full rounded-xl"})]}),n.jsx(d.Skeleton,{className:"h-9 w-36 rounded-full"})]}),n.jsx("div",{className:"flex flex-col gap-3",children:Array.from({length:4}).map((e,t)=>n.jsxs("div",{className:"grid grid-cols-[minmax(0,1fr)_160px] items-center gap-4 rounded-2xl border border-zinc-100 p-3",children:[n.jsx(d.Skeleton,{className:"h-8 w-full max-w-xs rounded-full"}),n.jsx(d.Skeleton,{className:"h-8 w-full rounded-xl"})]},t))})]})}const Is={paid:"bg-emerald-50 text-emerald-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",disputed:"bg-purple-50 text-purple-700",canceled:"bg-zinc-100 text-zinc-600"},sr={paid:"Paid",schedule:"Schedule",payment_due:"Payment Due",overdue:"Overdue",failed:"Failed",refunded:"Refunded",disputed:"Disputed",canceled:"Canceled"},fd={title:"Payments",searchLabel:"Search a payment",searchPlaceholder:"Search a payment by ID or Date...",editInstallments:"Edit Payment",installmentId:"Payment ID",amount:"Amount",scheduledDate:"Scheduled Date",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:n.jsxs(n.Fragment,{children:["Are you sure you want to delete this payment? ",n.jsx("strong",{children:"This action cannot be undone."})]}),deleteInstallmentConfirmationCancel:"Cancel",deleteInstallmentConfirmationConfirm:"Confirm",noInstallmentsFound:"No payments found."},md={wrapper:"!absolute !inset-0 !z-50 !items-center !justify-center !p-4",backdrop:"!absolute !inset-0 !z-40 rounded-2xl"},hd=[];function xd({installments:e,currency:t,locale:s="en-US",showTitle:a=!0,showCard:r=!0,showEditPayment:i=!0,showDelete:o=!0,payNowHiddenStatuses:l=hd,labels:c,isSaving:u=!1,onEditInstallments:f,onPayInstallment:h,onDeleteInstallment:g}){const[m,v]=x.useState(null),j={...fd,...c},[b,w]=x.useState(""),y=new Intl.NumberFormat(s,{style:"currency",currency:t}),k=a?n.jsxs("span",{className:"flex items-center gap-2",children:[n.jsx(K.CircleDollarSign,{className:"size-4 text-zinc-500",strokeWidth:1.75}),n.jsx("span",{className:"text-base font-medium leading-6 text-zinc-950",children:j.title})]}):void 0,N=x.useMemo(()=>{const E=b.trim().toLowerCase();return E?e.filter(L=>{const M=L.status??"schedule";return[L.id,L.amount,L.dueDate,Gt(L.dueDate,s),M,sr[M]??M].join(" ").toLowerCase().includes(E)}):e},[s,e,b]),S=n.jsxs("div",{className:"flex min-w-0 w-full flex-col gap-4 overflow-x-hidden [container-type:inline-size]",children:[n.jsxs("div",{className:"flex min-w-0 w-full flex-wrap items-end justify-between gap-4",children:[n.jsxs("div",{className:"min-w-0 w-full max-w-[280px]",children:[n.jsx("label",{className:"mb-1 block text-sm font-normal text-zinc-950",children:j.searchLabel}),n.jsx(d.Input,{variant:"bordered",size:"md",value:b,placeholder:j.searchPlaceholder,onChange:E=>w(E.target.value),startContent:n.jsx(V,{icon:"solar:magnifer-outline",className:"size-4 text-zinc-500"})})]}),i?n.jsx(R,{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:n.jsx(V,{icon:"solar:pen-outline",className:"size-4"}),isLoading:u,onPress:f,children:j.editInstallments}):null]}),n.jsx("div",{className:d.cn("hidden [@container(max-width:767px)]:block",N.length>3&&"max-h-[560px] overflow-y-auto pr-1"),children:n.jsxs("div",{className:"flex flex-col gap-2",children:[N.map((E,L)=>{const M=E.status??"schedule";return n.jsx(d.Card,{radius:"lg",shadow:"none",className:"border border-default-200",children:n.jsxs(d.CardBody,{className:"gap-3 p-3",children:[n.jsxs("div",{className:"flex items-start justify-between gap-2",children:[n.jsxs("div",{className:"min-w-0",children:[n.jsxs("p",{className:"text-xs text-default-500",children:["#",L+1]}),n.jsx("p",{className:"truncate text-sm font-medium text-foreground",children:E.id||`PMT-${L+1}`})]}),n.jsx(Ts,{status:M})]}),n.jsxs("div",{className:"grid grid-cols-2 gap-2 text-sm",children:[n.jsxs("div",{children:[n.jsx("p",{className:"text-xs text-default-500",children:j.amount}),n.jsx("p",{className:"font-medium text-foreground",children:y.format(E.amount)})]}),n.jsxs("div",{className:"text-right",children:[n.jsx("p",{className:"text-xs text-default-500",children:j.scheduledDate}),n.jsx("p",{className:"font-medium text-foreground",children:Gt(E.dueDate,s)})]})]}),n.jsx(Ps,{status:M,installment:E,labels:j,portalContainer:m??void 0,showDelete:o,payNowHiddenStatuses:l,onPayInstallment:h,onDeleteInstallment:g})]})},E.id)}),N.length===0&&n.jsx("div",{className:"rounded-lg border border-default-200 px-4 py-6 text-center text-sm text-default-500",children:j.noInstallmentsFound})]})}),n.jsx("div",{className:d.cn("w-full overflow-x-hidden [@container(max-width:767px)]:hidden",N.length>5&&"max-h-[344px] overflow-y-auto pr-1"),children:n.jsxs("table",{className:"w-full table-fixed border-collapse text-left text-sm",children:[n.jsxs("colgroup",{children:[n.jsx("col",{className:"w-12"}),n.jsx("col",{}),n.jsx("col",{className:"w-24"}),n.jsx("col",{className:"w-36"}),n.jsx("col",{className:"w-36"}),n.jsx("col",{className:"w-44"})]}),n.jsx("thead",{children:n.jsxs("tr",{className:"sticky top-0 z-10 border-b border-zinc-200 bg-white text-zinc-900",children:[n.jsx("th",{className:"px-2 py-3 font-medium",children:"#"}),n.jsx("th",{className:"px-2 py-3 font-medium",children:j.installmentId}),n.jsx("th",{className:"px-2 py-3 font-medium",children:j.amount}),n.jsx("th",{className:"px-2 py-3 font-medium",children:j.scheduledDate}),n.jsx("th",{className:"whitespace-nowrap px-2 py-3 font-medium",children:j.status}),n.jsx("th",{className:"whitespace-nowrap py-3 pl-4 pr-2 font-medium",children:j.actions})]})}),n.jsxs("tbody",{children:[N.map((E,L)=>{const M=E.status??"schedule";return n.jsxs("tr",{className:"text-zinc-500",children:[n.jsx("td",{className:"px-2 py-3",children:L+1}),n.jsx("td",{className:"overflow-hidden px-2 py-3",children:n.jsx("span",{className:"block w-full truncate",children:E.id||`PMT-${L+1}`})}),n.jsx("td",{className:"px-2 py-3",children:y.format(E.amount)}),n.jsx("td",{className:"px-2 py-3",children:Gt(E.dueDate,s)}),n.jsx("td",{className:"whitespace-nowrap px-2 py-3",children:n.jsx(Ts,{status:M})}),n.jsx("td",{className:"whitespace-nowrap py-3 pl-4 pr-2",children:n.jsx(Ps,{status:M,installment:E,labels:j,portalContainer:m??void 0,showDelete:o,payNowHiddenStatuses:l,onPayInstallment:h,onDeleteInstallment:g})})]},E.id)}),N.length===0&&n.jsx("tr",{children:n.jsx("td",{colSpan:6,className:"px-2 py-6 text-center text-zinc-500",children:j.noInstallmentsFound})})]})]})})]});return n.jsx("div",{ref:v,className:"vvt-ps relative min-w-0 w-full overflow-x-hidden [container-type:inline-size] font-sans text-zinc-900",children:r?n.jsx(d.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:n.jsx(d.AccordionItem,{"aria-label":j.title,title:k,children:S},"installment-table")}):S})}function Ts({status:e}){return n.jsx(d.Chip,{size:"md",radius:"lg",className:d.cn("justify-center px-4",Is[e]??Is.schedule),startContent:n.jsx(gd,{status:e}),children:sr[e]??e})}function Ps({status:e,installment:t,labels:s,portalContainer:a,showDelete:r,payNowHiddenStatuses:i,onPayInstallment:o,onDeleteInstallment:l}){const c=!i.includes(e);return n.jsxs("div",{className:"flex min-w-36 items-center justify-start gap-2",children:[c?n.jsx(R,{type:"button",size:"md",color:"primary",variant:"solid",radius:"full",className:"min-w-[104px] shrink-0",isDisabled:e==="paid",startContent:n.jsx(V,{icon:"solar:dollar-minimalistic-outline",className:"size-4"}),onPress:()=>o?.(t),children:s.payNow}):null,n.jsx(pd,{isFulfilled:e==="paid",showDelete:r,labels:s,portalContainer:a,onDelete:()=>l(t.id)})]})}function pd({isFulfilled:e,showDelete:t,labels:s,portalContainer:a,onDelete:r}){const[i,o]=x.useState(!1);return n.jsxs(n.Fragment,{children:[n.jsxs(d.Dropdown,{placement:"bottom-end",radius:"lg",children:[n.jsx(d.DropdownTrigger,{children:n.jsx(R,{type:"button",isIconOnly:!0,size:"sm",variant:"light",className:"text-zinc-900","aria-label":"More actions",children:n.jsx(V,{icon:"solar:menu-dots-bold",className:"size-4"})})}),n.jsxs(d.DropdownMenu,{"aria-label":"Installment actions",disabledKeys:e?["send-link","delete"]:[],className:"w-72 p-2",onAction:l=>{l==="delete"&&t&&!e&&o(!0)},children:[n.jsx(d.DropdownSection,{title:"Actions",showDivider:t,children:n.jsx(d.DropdownItem,{textValue:s.sendLink,description:s.sendLinkDescription,startContent:n.jsx(V,{icon:"solar:link-outline",className:"size-5 text-zinc-500"}),children:s.sendLink},"send-link")}),t?n.jsx(d.DropdownSection,{title:s.dangerZone,children:n.jsx(d.DropdownItem,{textValue:s.deleteInstallment,className:"text-danger-600",color:"danger",description:s.deleteInstallmentDescription,startContent:n.jsx(V,{icon:"solar:trash-bin-minimalistic-outline",className:"size-5"}),children:s.deleteInstallment},"delete")}):null]})]}),t?n.jsx(Lt,{isOpen:i,labels:{title:s.deleteInstallmentConfirmationTitle,description:s.deleteInstallmentConfirmationDescription,cancel:s.deleteInstallmentConfirmationCancel,confirm:s.deleteInstallmentConfirmationConfirm},icon:n.jsx(V,{icon:"solar:danger-triangle-outline",className:"size-7"}),confirmColor:"danger",portalContainer:a,shouldBlockScroll:!1,classNames:md,onClose:()=>o(!1),onConfirm:()=>{o(!1),r()}}):null]})}function gd({status:e}){return e==="paid"?n.jsx(V,{icon:"solar:check-circle-bold",className:"size-3"}):e==="failed"?n.jsx(V,{icon:"solar:close-circle-bold",className:"size-3"}):n.jsx(V,{icon:"solar:calendar-outline",className:"size-3"})}function Gt(e,t){const s=new Date(`${e}T00:00:00`);return Number.isNaN(s.getTime())?e:new Intl.DateTimeFormat(t,{month:"short",day:"numeric",year:"numeric"}).format(s)}const bd={title:"Select Membership",renewalTitle:"Automatic Renewal",renewalDescription:"Membership will automatically renew at the end of each period"},yd=({cards:e,locale:t,currency:s,listHeightClassName:a="",labels:r,showRenewal:i=!0,defaultRenewalValue:o=!1,initialSelectedMembershipId:l=null,allowReselect:c=!0,onRenewalChange:u,onCardSelect:f,className:h=""})=>{const g=Array.isArray(e)?e:[],[m,v]=x.useState(l),[j,b]=x.useState(o),w={...bd,...r};x.useEffect(()=>{v(l)},[l]);const y=N=>{if(N===m){c&&f?.(N);return}v(N),f?.(N)},k=N=>{b(N),u?.(N)};return n.jsxs("div",{className:d.cn("w-full flex flex-col gap-4 items-start p-4 h-svh",h),"data-testid":"membership-select-cards",children:[n.jsx("span",{className:"hidden","data-testid":"membership-select-cards-selected-id",children:m??""}),n.jsx("p",{className:"text-2xl font-semibold text-left","data-testid":"membership-select-cards-title",children:w.title}),i&&n.jsx(lr,{title:w.renewalTitle,description:w.renewalDescription,value:j,onValueChange:k}),n.jsx("div",{className:d.cn("w-full min-h-0 flex flex-col gap-4 overflow-y-auto",a===""?"flex-1":d.cn("shrink-0",a)),"data-testid":"membership-select-cards-list",children:g.map(N=>n.jsx(ar,{itemKey:N.id,name:N.name,type:N.type,price:N.price,locale:t,currency:s,isSelected:m===N.id,onSelect:y},N.id))})]})},ar=({itemKey:e,name:t,type:s,price:a,locale:r="en-US",currency:i="USD",showPrice:o=!0,isSelected:l=!1,onSelect:c,compact:u=!1,isDisabled:f=!1,disabledReason:h,statusLabel:g,statusTone:m="default",className:v=""})=>{const j=new Intl.NumberFormat(r,{style:"currency",currency:i,minimumFractionDigits:0,maximumFractionDigits:2}).format(a),b=!!c&&!f,w=h||g,y=()=>{b&&c?.(e)};return n.jsx(d.Card,{shadow:"none",isPressable:!!c,onPress:y,className:d.cn("w-full min-h-fit border rounded-3xl",l?"border-primary bg-primary/5":"border-default",f?"opacity-60":"",u?"rounded-2xl":"",v),"data-testid":"item-card","data-selected":l,isDisabled:f,children:n.jsxs("div",{className:d.cn("px-4 py-8 flex gap-6 items-center justify-between",u&&"px-3 py-3 gap-4"),children:[n.jsxs("div",{className:"w-max flex flex-col gap-1 items-start",children:[n.jsx("p",{className:d.cn("font-semibold text-left",u?"text-sm":"text-xl"),"data-testid":"item-card-name",children:t}),s&&n.jsx("div",{"data-testid":"item-card-type",className:"w-fit bg-default-300 px-4 py-2 text-sm rounded-xl",children:n.jsx("p",{className:"text-center",children:s})}),w&&n.jsx(d.Chip,{"data-testid":"item-card-status",color:m,size:"sm",variant:"flat",className:"px-2",children:w})]}),o&&n.jsx("p",{className:d.cn("font-semibold text-right",u?"text-lg":"text-2xl"),"data-testid":"item-card-price",children:j})]})})},_s="w-full bg-gray-100",Os={variant:"light",color:"default"},rr=({id:e,title:t,media:s,imageUrl:a,imageAlt:r,imageClassName:i="",imageAspect:o="aspect-[4/3]",meta:l=[],price:c,action:u,footer:f,onPress:h,isPressable:g=!1,isDisabled:m=!1,compact:v=!1,className:j="",bodyClassName:b="",footerClassName:w="",dataTestId:y})=>{const k=!!(c&&c.value),N=!!u?.label,S=g&&!!h&&!N,E=!S,L=N?{variant:u?.variant??Os.variant,color:u?.color??Os.color,size:u?.size??"sm",isDisabled:m||u?.isDisabled,startContent:u?.icon?n.jsx(V,{icon:u.icon,width:16}):void 0}:null,M=s??(a?n.jsx("div",{className:d.cn("relative overflow-hidden rounded-xl",o,_s,i),children:n.jsx(d.Image,{removeWrapper:!0,src:a,alt:r||t,className:"size-full object-cover",classNames:{wrapper:"absolute inset-0"}})}):n.jsx("div",{className:d.cn("relative overflow-hidden rounded-xl",o,_s,"grid place-items-center",i),"data-testid":`catalog-item-card-${e??"media"}-fallback`,children:n.jsx(V,{icon:"solar:ticket-outline",width:48,className:"text-default-400"})}));return n.jsxs(d.Card,{"data-testid":y||`catalog-item-card-${e??"item"}`,className:d.cn("w-full overflow-hidden",j),isPressable:S,onPress:h,isDisabled:m,shadow:"sm",radius:"lg",children:[n.jsx("div",{children:M}),n.jsxs(d.CardBody,{className:d.cn("gap-3",v?"p-3":"p-4",b),children:[n.jsx("h3",{"data-testid":`catalog-item-card-title-${e??""}`,className:d.cn("line-clamp-2 text-base font-semibold text-gray-900",v?"text-sm":""),children:t}),l.length>0?n.jsx("div",{className:"flex flex-col gap-1.5 text-sm text-gray-600","data-testid":`catalog-item-card-meta-${e??""}`,children:l.map(($,O)=>n.jsxs("span",{className:"flex items-center gap-2",children:[n.jsx(V,{icon:$.icon,className:"size-4 text-gray-400",width:16}),n.jsx("span",{children:$.label})]},`${$.label}-${O}`))}):null,(k||N)&&n.jsxs("div",{className:d.cn("flex items-center justify-end gap-2 pt-1 text-sm",v?"pt-0.5":"",w),children:[k?n.jsxs("span",{className:d.cn("mr-auto text-gray-500",v?"text-xs":""),"data-testid":`catalog-item-card-price-${e??""}`,children:[c?.label&&n.jsxs("span",{children:[c.label," "]}),n.jsx("span",{className:"font-semibold text-brand",children:c?.value})]}):n.jsx("span",{className:"ml-auto","aria-hidden":!0}),N&&E?n.jsx(R,{className:d.cn("rounded-full",u?.className),onPress:u?.onPress,variant:L?.variant,color:L?.color,size:L?.size,startContent:L?.startContent,isDisabled:L?.isDisabled,"aria-label":u?.ariaLabel||u?.label,children:u?.label}):null]}),f?n.jsx("div",{className:"pt-1",children:f}):null]})]})};rr.displayName="CatalogItemCard";const vd={card:"gap-3 rounded-xl border border-dashed px-6 py-12",panel:"px-6 py-[72px]"},jd={card:"size-12 rounded-2xl",panel:"size-[76px] rounded-[20px] border mb-[18px]"},wd={card:"text-base font-medium text-default-900",panel:"text-[17px] font-semibold text-acct-ink"},Nd={card:"max-w-sm text-sm text-default-600",panel:"max-w-[380px] text-sm text-acct-sub mt-1.5"},Cd={card:"mt-1",panel:"mt-[22px]"},Sd="bg-acct-page border-acct-border text-acct-muted",kd={empty:"solar:inbox-line-duotone",error:"solar:danger-triangle-outline",success:"solar:check-circle-bold"},Ad={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"},$d={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"},Dd={empty:"status",error:"alert",success:"status",loading:"status"},Ed={empty:"polite",error:"assertive",success:"polite",loading:"polite"};function Fd(e,t,s,a){if(t===!1)return null;if(e==="loading"&&t===void 0)return n.jsx(d.Spinner,{size:"lg",color:"primary",className:a.spinner});if(x.isValidElement(t))return n.jsx(n.Fragment,{children:t});const r=typeof t=="string"?t:kd[e];return r?n.jsx(V,{icon:r,width:s,height:s,"aria-hidden":"true",className:a.icon}):null}function et({variant:e="empty",surface:t="card",title:s,titleAs:a="p",description:r,icon:i,actions:o,role:l=Dd[e],ariaLive:c=Ed[e],iconSize:u=24,className:f,classNames:h={},"data-testid":g="feedback-state"}){const m=Fd(e,i,u,h);return n.jsxs("div",{role:l,"aria-live":c,"data-variant":e,"data-testid":g,"data-surface":t,className:d.cn("flex flex-col items-center justify-center text-center",vd[t],t==="card"?Ad[e]:"bg-transparent",f,h.base),children:[m?n.jsx("span",{"aria-hidden":"true","data-testid":`${g}-icon`,className:d.cn("inline-flex items-center justify-center",jd[t],e==="success"&&t==="card"&&"rounded-full",t==="panel"?Sd:$d[e],h.iconWrapper),children:m}):null,n.jsxs("div",{className:d.cn("flex flex-col items-center",t==="card"&&"gap-1"),children:[n.jsx(a,{"data-testid":`${g}-title`,className:d.cn(wd[t],h.title),children:s}),r?n.jsx("p",{"data-testid":`${g}-description`,className:d.cn(Nd[t],h.description),children:r}):null]}),o?n.jsx("div",{"data-testid":`${g}-actions`,className:d.cn("flex flex-wrap items-center justify-center gap-2",Cd[t],h.actions),children:o}):null]})}function Pn(e){return n.jsx(et,{...e,variant:"empty"})}function _n(e){return n.jsx(et,{...e,variant:"error"})}function On(e){return n.jsx(et,{...e,variant:"loading"})}function ir(e){return n.jsx(et,{...e,variant:"success"})}et.displayName="FeedbackState";Pn.displayName="EmptyState";_n.displayName="ErrorState";On.displayName="LoadingState";ir.displayName="SuccessState";const lr=({title:e,value:t,description:s,onValueChange:a,className:r=""})=>{const i=x.useId();return n.jsxs("div",{className:d.cn("w-full flex flex-row items-center",e||s?"justify-between gap-6":"justify-start",r),"data-testid":"toggle",children:[n.jsxs("div",{className:"flex flex-col items-start",children:[e&&n.jsx("label",{htmlFor:i,className:"font-medium text-left","data-testid":"toggle-title",children:e}),s&&n.jsx("p",{className:"text-left text-gray-500","data-testid":"toggle-description",children:s})]}),n.jsx(d.Switch,{id:i,isSelected:t,onValueChange:a,"data-testid":"toggle-switch"})]})},Ld={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"},Md=(e,t)=>new Intl.NumberFormat(e,{style:"currency",currency:t}),or=e=>Object.values(e).reduce((t,s)=>t+Object.values(s).reduce((a,r)=>a+Object.values(r).reduce((i,o)=>i+o.selectedQuantity,0),0),0),Id=e=>e.reduce((t,s)=>t+s.dates.reduce((a,r)=>a+r.tickets.reduce((i,o)=>i+o.max,0),0),0),Rn=e=>e.flatMap(t=>t.dates.flatMap(s=>s.tickets.map(a=>({exhibition:t,dateGroup:s,ticket:a})))),Rs=(e,t,s)=>{const a={};let r=s?t??Id(e):0;for(const{exhibition:i,dateGroup:o,ticket:l}of Rn(e)){a[i.id]??={},a[i.id][o.id]??={};const c=s?Math.min(l.max,r):0;a[i.id][o.id][l.id]={id:l.id,selectedQuantity:c,originalPrice:l.originalPrice,discountedPrice:l.price},r-=c}return a},zs=(e,t,s)=>`${e}::${t}::${s}`,Td=(e,t,s)=>{const a=or(t);for(const{exhibition:r,dateGroup:i,ticket:o}of Rn(e)){const l=t[r.id]?.[i.id]?.[o.id]?.selectedQuantity??0,c=s===void 0?o.max:Math.min(o.max,s-(a-l));if(c>0&&l<c)return!1}return!0},Pd=({initialQuantity:e=1,minQuantity:t=1,maxQuantity:s=10,onChange:a,disabled:r=!1})=>{const i=Math.max(t,Math.min(s,e)),[o,l]=x.useState(()=>String(i)),[c,u]=x.useState(!1),f=c?o:String(i),h=()=>{r||i>=s||a?.(i+1)},g=()=>{r||i<=t||a?.(i-1)},m=N=>{if(r)return;l(N.target.value);const S=parseInt(N.target.value,10);isNaN(S)||a?.(Math.max(t,Math.min(s,S)))},v=N=>{const S=parseInt(N.target.value,10);if(u(!1),isNaN(S)){a?.(t);return}const E=Math.max(t,Math.min(s,S));E!==S?a?.(E):l(String(E))},j=i<=t,b=i>=s,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",y="bg-primary hover:bg-primary/80",k="bg-primary/40 cursor-not-allowed";return n.jsxs("div",{className:"flex items-center gap-4","data-testid":"quantity-selector",children:[n.jsx("button",{type:"button",onClick:g,disabled:r||j,className:d.cn(w,r||j?k:y),"aria-label":"Decrement quantity","data-testid":"quantity-decrement",children:"-"}),n.jsx("input",{type:"number",value:f,onChange:m,onFocus:()=>u(!0),onBlur:v,disabled:r,min:t,max:s,step:"1",className:"w-12 h-10 rounded-md border-0 bg-zinc-100 text-center text-2xl font-medium text-zinc-900 [appearance:textfield] [&::-webkit-inner-spin-button]:appearance-none [&::-webkit-outer-spin-button]:appearance-none","aria-label":`Selected quantity: ${i}`,"data-testid":"quantity-input"}),n.jsx("button",{type:"button",onClick:h,disabled:r||b,className:d.cn(w,r||b?k:y),"aria-label":"Increment quantity","data-testid":"quantity-increment",children:"+"})]})},_d=({label:e,checked:t=!1,onChange:s,disabled:a=!1})=>{const r=()=>{a||s?.(!t)};return n.jsxs("button",{type:"button",onClick:r,disabled:a,role:"checkbox","aria-checked":t,"data-testid":"checkbox-button","data-checked":t,className:d.cn("flex items-center gap-1.5 px-4 py-3 border-0 rounded-full cursor-pointer text-sm min-h-[30px]","outline-none select-none transition-colors bg-zinc-100 hover:bg-zinc-200 text-primary",a&&"cursor-not-allowed opacity-60"),children:[n.jsxs("span",{className:"relative flex items-center justify-center w-5 h-5 flex-shrink-0",children:[n.jsx("input",{type:"checkbox",checked:t,onChange:()=>{},disabled:a,className:"absolute opacity-0 w-0 h-0 pointer-events-none",tabIndex:-1,readOnly:!0}),n.jsx("span",{className:d.cn("block w-3.5 h-3.5 rounded-sm relative",t?"bg-primary":"bg-white ring-1 ring-zinc-300"),children:t&&n.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"})})]}),n.jsx("p",{className:"flex-1 m-0 text-left leading-snug",children:e})]})},Od=({item:e,quantity:t,onChange:s,getTotalSelectedTickets:a,userMaxLimit:r,settings:i,labels:o})=>{const l=()=>{if(!a||r===void 0)return e.max;const h=a();return Math.min(e.max,r-(h-t))},c=i?.locale??"en-US",u=i?.currency??"USD",f=Md(c,u);return n.jsxs("div",{children:[n.jsxs("div",{className:"flex items-center justify-between bg-white px-3 py-2.5 gap-8","data-testid":"upgrade-ticket-item",children:[n.jsxs("div",{className:"min-w-0 flex flex-1 flex-col gap-2",children:[n.jsxs("div",{className:"flex min-w-0 items-start gap-3",children:[n.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?n.jsx("span",{"data-testid":"ticket-purchased-quantity",children:` x${e.purchasedQuantity}`}):null]}),n.jsxs("div",{className:"flex shrink-0 items-center gap-1.5",children:[n.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)}),n.jsx("h3",{className:"text-base font-semibold text-zinc-900 m-0","data-testid":"ticket-discounted-price",children:f.format(e.price)})]})]}),e.membershipName?n.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:n.jsx("p",{className:"max-w-full truncate text-center",children:e.membershipName})}):null,n.jsx("div",{className:"text-sm text-zinc-500",children:n.jsxs("p",{className:"m-0","data-testid":"ticket-max",children:[o.ticketsAllowedToRedeem," ",e.max]})})]}),n.jsx(Pd,{initialQuantity:t,minQuantity:0,maxQuantity:l(),onChange:s})]}),e.membershipAlert?n.jsx(d.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:n.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]})},Rd=({exhibitionId:e,dateGroup:t,isLast:s=!1,onQuantityChange:a,getTicketQuantity:r,getTotalSelectedTickets:i,userMaxLimit:o,settings:l,labels:c})=>n.jsxs("div",{className:d.cn("flex flex-col gap-2 pb-3",!s&&"border-b border-zinc-200"),"data-testid":"upgrade-ticket-date-group",children:[n.jsx("p",{className:"m-0 text-sm text-left text-zinc-500","data-testid":"upgrade-ticket-date",children:t.date}),t.tickets.map((u,f)=>n.jsxs("div",{children:[n.jsx(Od,{item:u,quantity:r(e,t.id,u.id),onChange:h=>a(e,t.id,u.id,h),getTotalSelectedTickets:i,userMaxLimit:o,settings:l,labels:c}),f<t.tickets.length-1?n.jsx(d.Divider,{className:"bg-zinc-200","data-testid":"upgrade-ticket-divider"}):null]},u.id))]}),zd=({title:e,exhibition:t,onQuantityChange:s,getTicketQuantity:a,getTotalSelectedTickets:r,userMaxLimit:i,settings:o,labels:l,initialExpanded:c=!1})=>{const[u,f]=x.useState(c),h=t.dates.reduce((m,v)=>m+v.tickets.reduce((j,b)=>j+a(t.id,v.id,b.id),0),0),g=t.dates.some(m=>m.tickets.length>0);return n.jsxs("div",{className:"w-full overflow-hidden border-b border-zinc-200","data-testid":"upgrade-ticket-header",children:[n.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-${t.id}`,"data-testid":"upgrade-ticket-header-button",children:n.jsxs("div",{className:"flex justify-between items-center w-full gap-6",children:[n.jsx("h4",{className:"m-0 text-base font-semibold text-left text-zinc-900","data-testid":"upgrade-ticket-header-title",children:e}),n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsxs("p",{className:"m-0 text-sm text-right text-zinc-500","data-testid":"upgrade-ticket-header-count",children:[h," ",l.ticketsSelectedToRedeem]}),n.jsx("span",{className:d.cn("inline-flex items-center justify-center text-zinc-500 text-xl transition-transform duration-200",u&&"rotate-180"),"aria-hidden":"true",children:n.jsx(V,{icon:"mdi:chevron-down"})})]})]})}),n.jsx("div",{id:`upgrade-items-${t.id}`,className:d.cn("transition-all duration-300 overflow-hidden",u?"max-h-[1000px] opacity-100":"max-h-0 opacity-0"),"aria-hidden":!u,children:u&&n.jsx("div",{className:"px-5 flex flex-col gap-6","data-testid":"upgrade-ticket-items",children:g?t.dates.map((m,v)=>n.jsx(Rd,{exhibitionId:t.id,dateGroup:m,isLast:v===t.dates.length-1,onQuantityChange:s,getTicketQuantity:a,getTotalSelectedTickets:r,userMaxLimit:i,settings:o,labels:l},m.id)):n.jsx("div",{className:"px-5 py-10 text-center",children:n.jsx("p",{className:"m-0 text-zinc-500 italic",children:l.noUpgradeTicketsAvailable})})})})]})},Bd=({initialExpanded:e=!1,userMaxLimit:t,labels:s,settings:a,ticketSelectionData:r,className:i="",onSelectionChange:o})=>{const l=x.useMemo(()=>r??[],[r]),c={...Ld,...s},[u,f]=x.useState(()=>Rs(l,t,!0)),h=x.useRef(!1),g=x.useMemo(()=>{const y=Rn(l).map(({exhibition:k,dateGroup:N,ticket:S})=>[zs(k.id,N.id,S.id),S]);return new Map(y)},[l]),m=Td(l,u,t),v=(y,k,N)=>u[y]?.[k]?.[N]?.selectedQuantity??0,j=()=>or(u),b=(y,k,N,S)=>{const E=v(y,k,N),L=j()-E;if(t!==void 0&&L+S>t)return;const M=g.get(zs(y,k,N));if(!M)return;const $={...u,[y]:{...u[y],[k]:{...u[y]?.[k],[N]:{id:N,selectedQuantity:S,originalPrice:M.originalPrice,discountedPrice:M.price}}}};f($),o?.($)},w=y=>{const k=Rs(l,t,y);f(k),o?.(k)};return x.useEffect(()=>{!h.current&&m&&(o?.(u),h.current=!0)},[m,u,o]),n.jsxs("div",{className:d.cn("flex flex-col w-full font-sans",i),"data-testid":"ticket-selection",children:[n.jsxs("div",{className:"flex items-center justify-between py-2 gap-4","data-testid":"ticket-selection-header",children:[n.jsx("h3",{className:"text-xl font-semibold m-0","data-testid":"ticket-selection-title",children:c.ticketSelectionTitle}),n.jsx(_d,{label:c.selectAllButtonLabel,checked:m,onChange:w})]}),l.map(y=>n.jsx(zd,{title:y.exhibitionName,exhibition:y,onQuantityChange:b,getTicketQuantity:v,getTotalSelectedTickets:j,userMaxLimit:t,settings:a,labels:c,initialExpanded:e},y.id))]})},Qt={confirm:"Confirm",clear:"Clear",noLabel:"Filters"},Zt=e=>{const t={};for(const s of e)s.type==="checkbox"?t[s.id]=[...s.selectedValues]:t[s.id]=s.selectedValue?[s.selectedValue]:[];return t},Vd=(e,t)=>{const s={};for(const a of t){if(a.type==="checkbox"){s[a.id]=e[a.id]??[...a.selectedValues];continue}const r=e[a.id]??[];s[a.id]=r.length>0?r[0]:null}return s},Ud=e=>e.type==="checkbox"?e.selectedValues.length>0:e.selectedValue!==null,cr=({triggerLabel:e,triggerAriaLabel:t,triggerIcon:s="solar:tuning-square-outline",triggerVariant:a="bordered",triggerColor:r="default",triggerSize:i="sm",triggerClassName:o,popoverClassName:l,className:c,sections:u,onConfirm:f,onClear:h,appliedCount:g,countAriaLabel:m,countDisplay:v="badge",confirmLabel:j=Qt.confirm,clearLabel:b=Qt.clear,isOpen:w,defaultOpen:y=!1,onOpenChange:k,isDisabled:N=!1,closeOnConfirm:S=!0,keepOpenAfterClear:E=!1})=>{const[L,M]=x.useState(y),[$,O]=x.useState(()=>Zt(u)),F=w??L,A=g??u.filter(U=>Ud(U)).length,I=U=>{U&&O(Zt(u)),w||M(U),k?.(U)},P=(U,Z)=>{O(Q=>({...Q,[U.id]:Z}))},G=(U,Z)=>{O(Q=>({...Q,[U.id]:Z?[Z]:[]}))},q=async()=>{O(Zt(u.map(U=>U.type==="checkbox"?{...U,selectedValues:[]}:{...U,selectedValue:null}))),await h(),E||I(!1)},W=async()=>{const U=Vd($,u);await f(U),S&&I(!1)},ee=U=>{if(U.type==="checkbox")return n.jsx(d.CheckboxGroup,{label:U.label,value:$[U.id]??[],onValueChange:Q=>P(U,Q),children:U.options.map(Q=>n.jsx(d.Checkbox,{value:Q.value,isDisabled:Q.isDisabled,children:Q.label},Q.value))},U.id);const Z=$[U.id]?.[0]??"";return n.jsx(d.RadioGroup,{label:U.label,value:Z,onValueChange:Q=>G(U,Q||null),children:U.options.map(Q=>n.jsx(d.Radio,{value:Q.value,isDisabled:Q.isDisabled,children:Q.label},Q.value))},U.id)},ae=x.useMemo(()=>A>0?m?.(A)||`${A} filters applied`:void 0,[m,A]),re=x.useMemo(()=>A===0?e||Qt.noLabel:m?m(A):`${e} (${A})`,[A,e,m]);return n.jsx("div",{className:c,children:n.jsxs(d.Popover,{isOpen:F,onOpenChange:I,placement:"bottom-end",children:[n.jsx(d.PopoverTrigger,{children:n.jsxs(R,{isDisabled:N,variant:a,color:r,size:i,className:o,"aria-label":t,"aria-haspopup":"dialog","aria-expanded":F,children:[n.jsx(V,{icon:s,width:16}),n.jsx("span",{children:e}),v==="badge"&&A>0?n.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":ae,children:A}):v==="summary"&&re!==e?n.jsx("span",{className:"text-xs",children:re}):null]})}),n.jsx(d.PopoverContent,{className:l,children:n.jsxs("div",{className:"flex w-full flex-col gap-5 px-4 py-4",children:[u.map(U=>ee(U)),n.jsxs("div",{className:"flex items-center justify-end gap-2 border-t border-gray-200 pt-3",children:[n.jsx(R,{variant:"light",color:"default",size:"sm",onPress:q,children:b}),n.jsx(R,{color:"primary",size:"sm",onPress:W,children:j})]})]})})]})})};cr.displayName="FilterPopover";const Hd="No sessions available for this date",qd=e=>e==="sold-out"||e==="closed"?"danger":"success",Wd=e=>{const t=e.seatsRemaining;return e.status==="sold-out"||e.status==="closed"?"Sold out":e.status==="limited"?typeof t=="number"?`${t} left`:"Limited":typeof t=="number"?`${t} seats available`:"Available"},Bs=e=>e.isDisabled?!0:e.status==="sold-out"||e.status==="closed",Yd=(e,t)=>t&&e.some(s=>s.date===t)?t:e[0]?.date??null,dr=({heading:e,subheading:t,days:s,selectedDate:a,onDateSelect:r,quickDates:i,selectedSessionId:o=null,onSessionSelect:l,emptyStateMessage:c=Hd,statusLabel:u,statusTone:f,sessionAriaLabel:h,dayButtonClassName:g,calendarSlot:m,dayGroupAriaLabel:v,sessionGridAriaLabel:j,className:b,headingClassName:w,subheadingClassName:y})=>{const k=Yd(s,a),N=s.find($=>$.date===k),S=i??s.map($=>({date:$.date,label:$.label})),E=N?.sessions??[],L=$=>$===k?"solid":"bordered",M=$=>{if(!Bs($)){if($.id===o){l(null);return}l($.id)}};return n.jsxs("section",{className:d.cn("flex flex-col gap-4 rounded-xl bg-white p-3 sm:p-4",b),"data-testid":"session-timeline-root",children:[n.jsxs("header",{className:"flex flex-col gap-1",children:[n.jsx("h2",{className:d.cn("text-base font-semibold text-gray-900",w),children:e}),t?n.jsx("p",{className:d.cn("text-sm text-gray-700",y),children:t}):null]}),n.jsxs("div",{className:"flex flex-wrap items-center gap-2",role:"group","aria-label":v||"Session days",children:[S.map($=>n.jsx(R,{size:"sm",variant:L($.date),color:"default",className:d.cn("rounded-full",g),isDisabled:$.isDisabled,onPress:()=>{r($.date)},children:n.jsx("span",{children:$.label})},$.date)),m?n.jsx("div",{children:m}):null]}),n.jsxs("ul",{className:"grid grid-cols-1 gap-2 sm:grid-cols-3","aria-label":j||"Sessions",children:[E.length===0?n.jsx("li",{className:"rounded-lg bg-white px-4 py-6 text-center text-sm text-gray-600 sm:col-span-3",children:c}):null,E.map($=>{const O=Bs($),F=$.id===o;return n.jsx("li",{className:"rounded-xl",children:n.jsx(d.Card,{shadow:"sm",radius:"lg",isPressable:!O,onPress:()=>{M($)},"aria-disabled":O,"aria-pressed":O?void 0:F,className:d.cn("w-full",O?"bg-gray-100 opacity-70":"",F?"w-full ring-2 ring-gray-900":""),"aria-label":h?h($,{isSelected:F,isUnavailable:O}):O?`${$.startTime} ${$.endTime} sold out`:`${$.startTime} ${$.endTime} available`,children:n.jsxs(d.CardBody,{className:"flex flex-col items-center gap-3 p-4 text-center",children:[n.jsxs("span",{className:"text-sm font-semibold text-gray-900",children:[$.startTime," – ",$.endTime]}),n.jsx(d.Chip,{size:"sm",color:f?f($):qd($.status),variant:"flat",children:u?u($):Wd($)})]})})},$.id)})]})]})};dr.displayName="SessionTimeline";const Kd=(e,t)=>typeof e=="string"?n.jsx(V,{icon:e,className:"size-5","aria-hidden":"true"}):e||t||null,ur=({title:e,subtitle:t,eyebrow:s,icon:a,initials:r,actions:i,titleAs:o="h1",className:l,classNames:c={},"data-testid":u="page-header"})=>{const f=Kd(a,r);return n.jsxs("header",{"data-testid":u,className:d.cn("flex flex-wrap items-start justify-between gap-4",l,c.base),children:[n.jsxs("div",{className:"flex items-center gap-4",children:[f?n.jsx("div",{"aria-hidden":"true","data-testid":`${u}-icon`,className:d.cn("flex size-12 shrink-0 items-center justify-center rounded-xl bg-gray-900 text-sm font-semibold text-white",c.iconWrapper),children:f}):null,n.jsxs("div",{children:[s?n.jsx("p",{"data-testid":`${u}-eyebrow`,className:d.cn("text-brand text-sm font-medium uppercase tracking-wide",c.eyebrow),children:s}):null,n.jsx(o,{"data-testid":`${u}-title`,className:d.cn("text-3xl font-semibold text-gray-950",c.title),children:e}),t?n.jsx("p",{"data-testid":`${u}-subtitle`,className:d.cn("mt-1 text-sm text-gray-600",c.subtitle),children:t}):null]})]}),i?n.jsx("div",{"data-testid":`${u}-actions`,className:d.cn("flex flex-wrap items-center gap-2",c.actions),children:i}):null]})};ur.displayName="PageHeader";const Gd={active:"success",success:"success",draft:"warning",pending:"warning",warning:"warning",danger:"danger",archived:"default",inactive:"default",neutral:"default"},Qd={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"}},fr=({status:e,label:t,variant:s="flat",size:a="sm",color:r,startContent:i,className:o,"data-testid":l="status-chip"})=>{if(s==="dot"){const c=Qd[e];return n.jsxs("span",{"data-testid":l,"data-status":e,className:d.cn("inline-flex items-center gap-1.5 whitespace-nowrap rounded-full px-2.5 py-[3px] text-[12px] font-semibold leading-[1.4]",o),style:{color:c.fg,backgroundColor:c.bg},children:[n.jsx("span",{"aria-hidden":"true",className:"size-1.5 shrink-0 rounded-full",style:{backgroundColor:"currentColor"}}),t]})}return n.jsx(d.Chip,{color:r??Gd[e],variant:s,size:a,startContent:i,"data-testid":l,"data-status":e,className:d.cn("font-medium",o),children:t})};fr.displayName="StatusChip";const Zd={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"},zn=({label:e,value:t,size:s="sm",className:a,"data-testid":r="key-value-chip"})=>n.jsxs("span",{"data-testid":r,className:d.cn("inline-flex items-baseline whitespace-nowrap border border-default-200 bg-default-100",Zd[s],a),children:[n.jsx("span",{className:"font-medium text-default-400",children:e}),n.jsx("span",{className:"font-semibold text-default-700",children:t})]});zn.displayName="KeyValueChip";const mr=({columns:e,rows:t=6,label:s="Loading",barHeight:a=12,alignLastRight:r=!1,className:i,classNames:o={},"data-testid":l="table-skeleton"})=>n.jsxs("div",{role:"status","aria-busy":"true","data-testid":l,className:d.cn("w-full",i,o.base),children:[n.jsx("span",{className:"sr-only",children:s}),n.jsx("div",{"aria-hidden":"true",children:Array.from({length:t}).map((c,u)=>n.jsx("div",{"data-testid":`${l}-row`,className:d.cn("flex items-center gap-3 border-t border-default-100 px-5 py-4",o.row),children:e.map((f,h)=>{const g=h===e.length-1;return n.jsx("div",{className:d.cn(f==="fill"?"flex-1":"shrink-0",r&&g&&"flex justify-end"),style:f==="fill"?void 0:{width:f},children:n.jsx("div",{className:d.cn("animate-pulse rounded bg-default-200",o.bar),style:{height:a,width:f==="fill"?"60%":f}})},h)})},u))})]});mr.displayName="TableSkeleton";const hr="text-left text-[11px] font-semibold uppercase tracking-[.04em] text-acct-sub px-4 pt-4 pb-3 whitespace-nowrap bg-transparent",xr="px-4 text-[13.5px] text-acct-ink2 align-middle",pr="border-t border-acct-hair transition-colors duration-150 hover:bg-acct-page data-[hover=true]:bg-acct-page",gr="w-full",br="border-t border-acct-border px-5 py-3.5",yr=({columns:e,children:t,emptyContent:s,footer:a,ariaLabel:r,className:i,classNames:o={},"data-testid":l="admin-table"})=>n.jsxs("div",{className:d.cn(i,o.base),"data-testid":l,children:[n.jsxs(d.Table,{"aria-label":r,removeWrapper:!0,classNames:{table:d.cn(gr,o.table),th:d.cn(hr,o.th),tr:d.cn(pr,o.tr),td:d.cn(xr,o.td)},children:[n.jsx(d.TableHeader,{columns:e,children:c=>n.jsx(d.TableColumn,{align:c.align==="right"?"end":"start",width:c.width,children:c.label},c.key)}),n.jsx(d.TableBody,{emptyContent:s,children:t})]}),a?n.jsx("div",{"data-testid":`${l}-footer`,className:d.cn(br,o.footer),children:a}):null]});yr.displayName="AdminTable";const Xd={md:"w-[280px]",lg:"w-[360px]"},vr=({searchValue:e,onSearchChange:t,searchLabel:s,searchPlaceholder:a,searchIcon:r,children:i,trailing:o,searchWidth:l="md",className:c,"data-testid":u="admin-toolbar"})=>n.jsxs("div",{role:"search","data-testid":u,className:d.cn("flex flex-wrap items-center gap-3 mb-4",c),children:[n.jsx(d.Input,{type:"search","aria-label":s,placeholder:a??s,value:e,onValueChange:t,startContent:r?n.jsx("span",{"aria-hidden":"true",className:"flex text-acct-muted",children:r}):void 0,"data-testid":`${u}-search`,variant:"bordered",radius:"none",classNames:{base:Xd[l],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,o?n.jsx("div",{className:"ml-auto",children:o}):null]});vr.displayName="AdminToolbar";function jr({items:e,value:t,onChange:s,ariaLabel:a,className:r,"data-testid":i="underline-tabs"}){return n.jsx(d.Tabs,{"aria-label":a,variant:"underlined",selectedKey:t,onSelectionChange:o=>s(String(o)),"data-testid":i,classNames:{base:d.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"},children:e.map(o=>n.jsx(d.Tab,{title:o.label,"data-testid":`${i}-${o.key}`},o.key))})}jr.displayName="UnderlineTabs";const Bn="text-[11px] font-semibold uppercase tracking-[.04em] text-acct-muted mb-1.5",Vn="font-normal normal-case tracking-normal",wr=["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(" "),Nr="text-[13.5px] text-acct-ink",Cr="bg-acct-page text-acct-muted cursor-default",Sr="mt-[5px] text-xs text-acct-sub",kr="mt-[5px] text-xs text-acct-danger",Ar=({children:e,suffix:t,className:s,"data-testid":a="admin-field-label"})=>n.jsxs("div",{"data-testid":a,className:d.cn(Bn,s),children:[e,t?n.jsxs("span",{className:Vn,children:[" ",t]}):null]});Ar.displayName="AdminFieldLabel";const $r=({label:e,labelSuffix:t,value:s,onChange:a,placeholder:r,disabled:i=!1,readOnly:o=!1,mono:l=!1,autoFocus:c=!1,hint:u,invalid:f=!1,className:h,"data-testid":g="admin-text-field"})=>n.jsx(d.Input,{labelPlacement:e?"outside":void 0,label:e&&t?n.jsxs(n.Fragment,{children:[e,n.jsxs("span",{className:Vn,children:[" ",t]})]}):e,value:s,placeholder:r,isDisabled:i,isReadOnly:o,autoFocus:c,isInvalid:f,description:!f&&u?u:void 0,errorMessage:f?u:void 0,onValueChange:a,"data-testid":g,variant:"bordered",radius:"none",classNames:{base:d.cn("w-full",h),label:Bn,inputWrapper:wr,input:d.cn(Nr,(l||o)&&"font-mono",o&&Cr),description:Sr,errorMessage:kr}});$r.displayName="AdminTextField";const Jd={sm:"size-6 min-w-6",md:"size-[30px] min-w-[30px]"},Dr=({actions:e,size:t="md",className:s,"data-testid":a="row-actions"})=>n.jsx("div",{role:"presentation","data-testid":a,className:d.cn("inline-flex gap-0.5",s),onClick:r=>r.stopPropagation(),children:e.map(r=>n.jsx(R,{isIconOnly:!0,variant:"light",radius:"sm",size:"sm",onPress:r.onPress,isDisabled:r.disabled,"aria-label":r.label,title:r.label,"data-testid":`${a}-${r.key}`,className:d.cn("text-acct-sub data-[hover=true]:bg-acct-hair",Jd[t]),children:r.icon},r.key))});Dr.displayName="RowActions";const Er=({children:e,placeholder:t="Select…",onOpen:s,onClear:a,ariaLabel:r,icon:i,trailingIcon:o,clearIcon:l,disabled:c=!1,className:u,"data-testid":f="picker-row"})=>{const h=e!=null;return n.jsxs("div",{"data-testid":f,className:d.cn("flex w-full min-h-10 items-center rounded-[10px] border border-acct-border bg-acct-surface px-[11px] transition-colors duration-150",c?"opacity-60":"hover:border-acct-rust-border",u),children:[n.jsxs(R,{variant:"light",radius:"none",disableAnimation:!0,onPress:s,isDisabled:c,"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?n.jsx("span",{className:"flex shrink-0 text-acct-muted",children:i}):null,h?n.jsx("span",{className:"flex min-w-0 items-center gap-2",children:e}):n.jsx("span",{className:"text-[13.5px] font-semibold text-acct-sub",children:t}),o?n.jsx("span",{className:"ml-auto flex shrink-0 text-acct-muted",children:o}):null]}),h&&a?n.jsx(R,{isIconOnly:!0,variant:"light",radius:"sm",size:"sm",onPress:a,isDisabled:c,"aria-label":`Clear ${r}`,title:"Clear","data-testid":`${f}-clear`,className:"ml-1.5 size-6 min-w-6 shrink-0 text-acct-muted data-[hover=true]:bg-acct-hair",children:l}):null]})};Er.displayName="PickerRow";function Fr(e,t,s){if(s<=0||t<=0||e<=0)return{from:0,to:0};const a=(e-1)*t+1;return a>s?{from:0,to:0}:{from:a,to:Math.min(s,e*t)}}const Lr=({page:e,pageSize:t,total:s,unit:a,announce:r=!0,className:i,classNames:o={},"data-testid":l="pagination-summary"})=>{const{from:c,to:u}=Fr(e,t,s),f=d.cn("font-semibold text-default-700",o.emphasis);return n.jsxs("p",{"data-testid":l,"aria-live":r?"polite":void 0,className:d.cn("text-sm text-default-500",i,o.base),children:["Showing"," ",n.jsx("span",{"data-testid":`${l}-range`,className:f,children:c===0?0:`${c}–${u}`})," ","of"," ",n.jsx("span",{"data-testid":`${l}-total`,className:f,children:s}),a?n.jsxs(n.Fragment,{children:[" ",a]}):null]})};Lr.displayName="PaginationSummary";const Mr=({isLoading:e=!1,isError:t=!1,isEmpty:s=!1,loadingTitle:a="Loading…",loadingContent:r,errorTitle:i="Something went wrong",errorDescription:o,retryLabel:l="Retry",onRetry:c,errorActions:u,errorContent:f,emptyTitle:h="Nothing here yet",emptyDescription:g,emptyIcon:m,emptyActions:v,emptyContent:j,children:b,className:w,classNames:y={},"data-testid":k="list-panel"})=>{const N={base:d.cn("border-0 bg-transparent py-12",y.state)};let S;return e?S=r??n.jsx(On,{title:a,classNames:N,"data-testid":`${k}-loading`}):t?S=f??n.jsx(_n,{title:i,description:o,classNames:N,"data-testid":`${k}-error`,actions:u??(c?n.jsx(R,{color:"primary",variant:"flat",onPress:c,children:l}):void 0)}):s?S=j??n.jsx(Pn,{title:h,description:g,icon:m,actions:v,classNames:N,"data-testid":`${k}-empty`}):S=b,n.jsx("section",{"data-testid":k,className:d.cn("rounded-xl bg-white p-2 shadow-sm",w,y.base),children:S})};Mr.displayName="ListPanel";const eu=350,tu={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}"},Xt=(e,t)=>Object.entries(t).reduce((s,[a,r])=>s.replace(`{${a}}`,r),e),nu=({dueAmount:e,received:t,defaultReceived:s=null,onChange:a,locale:r="en-US",labels:i,isDisabled:o=!1,maxAmount:l,autoFocus:c=!1,className:u,"data-testid":f="cash-tender-form"})=>{const h={...tu,...i},g=An(e.currency,r),m=t!==void 0,[v,j]=x.useState(s??null),b=m?t:v,w=x.useMemo(()=>{const I=typeof b=="number"&&Number.isFinite(b)?b:0,P=ln(I,e.value,e.currency,r);return{received:I,change:P>0?P:0,isValid:I>=e.value&&I>0}},[b,e.value,e.currency,r]),y=x.useCallback(I=>{const P=I.currentTarget;requestAnimationFrame(()=>{P.isConnected&&P.select()})},[]),k=x.useCallback(I=>{if(o)return;const P=I.replace(/[^\d.,]/g,"").replace(",","."),G=P===""?null:Number.parseFloat(P),q=G===null||Number.isNaN(G)?null:G;if(q!==null&&l!==void 0&&q>l)return;m||j(q);const W=typeof q=="number"&&Number.isFinite(q)?q:0,ee=ln(W,e.value,e.currency,r);a?.({received:W,change:ee>0?ee:0,isValid:W>=e.value&&W>0})},[m,o,e.value,e.currency,r,a,l]),N=b==null?"":String(b),S=w.isValid&&w.change>0,E=!w.isValid&&w.received>0,L=we(w.change,r,e.currency),M=we(e.value,r,e.currency),[$,O]=x.useState(""),F=x.useRef(null);x.useEffect(()=>{F.current&&clearTimeout(F.current);const I=S?Xt(h.changeMessageTemplate,{change:L}):"",P=S?eu:0;return F.current=setTimeout(()=>O(I),P),()=>{F.current&&clearTimeout(F.current)}},[S,L,h.changeMessageTemplate]);const A=`${f}-received`;return n.jsxs("div",{className:d.cn("flex flex-col gap-3",u),"data-testid":f,children:[n.jsx(d.Input,{id:A,label:h.receivedLabel,labelPlacement:"outside",type:"text",inputMode:g===0?"numeric":"decimal",pattern:g===0?"[0-9]*":"[0-9]*[.,]?[0-9]*",value:N,onChange:I=>k(I.target.value),onFocus:y,placeholder:h.receivedPlaceholder,isDisabled:o,isInvalid:E,errorMessage:E?Xt(h.insufficientMessageTemplate,{due:M}):void 0,variant:"bordered",radius:"lg",autoFocus:c,"data-testid":`${f}-received-input`}),S&&n.jsx(d.Alert,{"data-testid":`${f}-change-alert`,color:"primary",variant:"flat",radius:"lg",title:h.changeLabel,description:Xt(h.changeMessageTemplate,{change:L}),icon:n.jsx(V,{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"}}),n.jsx("span",{role:"status","aria-live":"polite",className:"sr-only",children:$})]})},su={checkNumberLabel:"Check Number",checkNumberPlaceholder:"e.g. 11234",bankNameLabel:"Bank Name",bankNamePlaceholder:"e.g. Chase Bank",dateLabel:"Date",checkNumberRequiredMessage:"Check number is required"},Vs=()=>{const e=new Date,t=s=>String(s).padStart(2,"0");return`${e.getFullYear()}-${t(e.getMonth()+1)}-${t(e.getDate())}`},Ir=({dueAmount:e,value:t,defaultValue:s,onChange:a,labels:r,hideDate:i=!1,hideBankName:o=!1,isDisabled:l=!1,checkNumberMaxLength:c=34,bankNameMaxLength:u=100,autoFocus:f=!1,className:h,"data-testid":g="check-tender-form"})=>{const m={...su,...r},v=t!==void 0,[j,b]=x.useState({checkNumber:s?.checkNumber??"",bankName:s?.bankName??"",date:s?.date??Vs()}),[w,y]=x.useState(!!s?.checkNumber),k=x.useMemo(()=>v?{checkNumber:t?.checkNumber??"",bankName:t?.bankName??"",date:t?.date??Vs()}:j,[v,t,j]),N=x.useCallback(F=>{v||b(F);const A=F.checkNumber.trim(),I={amount:e.value,checkNumber:A,bankName:F.bankName.trim()||void 0,date:i?void 0:F.date,isValid:A.length>0&&e.value>0};a?.(I)},[v,e.value,i,a]),S=x.useCallback(F=>A=>{l||(F==="checkNumber"&&A.length>0&&y(!0),N({...k,[F]:A}))},[k,N,l]),E=x.useCallback(()=>{l||y(!0)},[l]),L=w&&k.checkNumber.trim()==="",M=`${g}-check-number`,$=`${g}-bank-name`,O=`${g}-date`;return n.jsxs("div",{className:d.cn("grid grid-cols-1 sm:grid-cols-2 gap-4",h),"data-testid":g,children:[n.jsx(d.Input,{id:M,label:m.checkNumberLabel,labelPlacement:"outside",type:"text",value:k.checkNumber,onChange:F=>S("checkNumber")(F.target.value),onBlur:E,placeholder:m.checkNumberPlaceholder,maxLength:c,isRequired:!0,isInvalid:L,errorMessage:L?m.checkNumberRequiredMessage:void 0,isDisabled:l,variant:"bordered",radius:"lg",autoFocus:f,"data-testid":`${g}-check-number-input`}),!o&&n.jsx(d.Input,{id:$,label:m.bankNameLabel,labelPlacement:"outside",type:"text",value:k.bankName,onChange:F=>S("bankName")(F.target.value),placeholder:m.bankNamePlaceholder,maxLength:u,isDisabled:l,variant:"bordered",radius:"lg","data-testid":`${g}-bank-name-input`}),!i&&n.jsx(d.Input,{id:O,label:m.dateLabel,labelPlacement:"outside",type:"date",value:k.date,onChange:F=>S("date")(F.target.value),isDisabled:l,variant:"bordered",radius:"lg","data-testid":`${g}-date-input`,className:"sm:col-span-2"})]})};Ir.displayName="CheckTenderForm";const au={methodLabel:"Method",methodPlaceholder:"Select a payment method",referenceLabel:"Reference",referencePlaceholder:"e.g. Voucher #1234",methodRequiredMessage:"Method is required"},ru=[{value:"ach",label:"ACH"},{value:"wire",label:"Wire"},{value:"gift_card",label:"Gift Card"},{value:"voucher",label:"Voucher"},{value:"other",label:"Other"}],Tr=({dueAmount:e,methodOptions:t=ru,value:s,defaultValue:a,onChange:r,labels:i,showReference:o=!1,isDisabled:l=!1,className:c,"data-testid":u="other-tender-form"})=>{const f={...au,...i},h=s!==void 0,[g,m]=x.useState({method:a?.method??"",reference:a?.reference??""}),v=x.useMemo(()=>h?{method:s?.method??"",reference:s?.reference??""}:g,[h,s,g]),j=x.useCallback(S=>t.find(E=>E.value===S)?.label??"",[t]),b=x.useCallback(S=>{h||m(S);const E=j(S.method),L={amount:e.value,method:S.method,description:E,reference:S.reference.trim()||void 0,isValid:S.method!==""};r?.(L)},[h,e.value,r,j]),w=x.useCallback(S=>{if(l)return;const E=typeof S=="string"?S:Array.from(S)[0]?.toString()??"";b({...v,method:E})},[v,b,l]),y=x.useCallback(S=>{l||b({...v,reference:S})},[v,b,l]),k=`${u}-method`,N=`${u}-reference`;return n.jsxs("div",{className:d.cn("flex flex-col gap-3",c),"data-testid":u,children:[n.jsx(Ie,{id:k,label:f.methodLabel,labelPlacement:"outside",placeholder:f.methodPlaceholder,selectedKeys:v.method?[v.method]:[],onSelectionChange:w,isDisabled:l,isRequired:!0,variant:"bordered",radius:"lg","data-testid":`${u}-method-select`,popoverProps:{placement:"bottom-start",classNames:{content:"bg-white border border-default-200 shadow-lg rounded-xl p-1"}},listboxProps:{classNames:{list:"max-h-[var(--popover-available-height,40vh)] overflow-y-auto"},itemClasses:{base:["rounded-lg","px-3 py-2","text-default-800","data-[hover=true]:bg-default-100","data-[selectable=true]:focus:bg-default-100","data-[selected=true]:bg-primary-50","data-[selected=true]:text-primary","data-[selected=true]:font-medium"]}},children:t.map(S=>n.jsx(d.SelectItem,{"data-testid":`${u}-method-option-${S.value}`,children:S.label},S.value))}),o&&n.jsx(d.Input,{id:N,label:f.referenceLabel,labelPlacement:"outside",type:"text",value:v.reference,onChange:S=>y(S.target.value),placeholder:f.referencePlaceholder,isDisabled:l,variant:"bordered",radius:"lg","data-testid":`${u}-reference-input`})]})};Tr.displayName="OtherTenderForm";const iu={collectedHeading:"Collected",remainingLabel:"Remaining:",completeLabel:"Complete",removeAriaLabel:"Remove this tender",removeTooltipForRecorded:"Already recorded",statusPending:"Pending",statusRecorded:"Approved",statusFailed:"Failed"},lu={card:"lucide:credit-card",cash:"lucide:dollar-sign",check:"lucide:edit-3",other:"lucide:more-horizontal"},ou={pending:"warning",recorded:"success",failed:"danger"},cu=e=>e==="pending"||e==="recorded",du=e=>`#${e+1}`,Pr=({total:e,tenders:t,onRemove:s,locale:a="en-US",labels:r,hideCollectedList:i=!1,className:o,"data-testid":l="split-payment-summary"})=>{const c={...iu,...r},{collected:u,remaining:f,isComplete:h}=x.useMemo(()=>{const m=t.reduce((j,b)=>cu(b.status)?j+b.amount:j,0),v=Math.max(e.value-m,0);return{collected:m,remaining:v,isComplete:m>=e.value&&e.value>0}},[t,e.value]),g=m=>m==="pending"?c.statusPending:m==="recorded"?c.statusRecorded:c.statusFailed;return n.jsxs("div",{className:d.cn("flex flex-col gap-4",o),"data-testid":l,children:[n.jsxs("div",{className:"rounded-2xl bg-default-100 px-6 py-5 text-center","data-testid":`${l}-remaining-banner`,children:[n.jsx("div",{className:"text-sm text-default-600",children:h?c.completeLabel:c.remainingLabel}),n.jsx("div",{className:"mt-1 text-4xl font-bold tracking-tight","data-testid":`${l}-remaining-amount`,children:we(h?u:f,a,e.currency)})]}),!i&&t.length>0&&n.jsxs("div",{className:"flex flex-col gap-2","data-testid":`${l}-collected-list`,children:[n.jsx("h3",{className:"text-base font-semibold",children:c.collectedHeading}),t.map((m,v)=>n.jsx(uu,{index:v,tender:m,locale:a,currency:e.currency,removable:!!s&&m.status!=="recorded",onRemove:s?()=>s(m.id):void 0,statusLabel:g(m.status),removeAriaLabel:c.removeAriaLabel,recordedTooltip:c.removeTooltipForRecorded,dataTestId:`${l}-row-${v}`},m.id))]})]})};Pr.displayName="SplitPaymentSummary";const uu=({index:e,tender:t,locale:s,currency:a,removable:r,onRemove:i,statusLabel:o,removeAriaLabel:l,recordedTooltip:c,dataTestId:u})=>{const f=i?n.jsx(R,{isIconOnly:!0,variant:"light",radius:"full",size:"sm",onPress:i,isDisabled:!r,"aria-label":l,"data-testid":`${u}-remove`,className:d.cn(r?"text-default-700 hover:bg-default-200":"text-default-300"),children:n.jsx(V,{icon:"lucide:x",width:18,height:18,"aria-hidden":"true"})}):null;return n.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:[n.jsx("span",{className:"text-sm font-medium text-default-500 w-6 shrink-0",children:du(e)}),n.jsx(V,{icon:lu[t.type],width:20,height:20,className:"text-default-700 shrink-0","aria-hidden":"true"}),n.jsx("span",{className:"flex-1 truncate","data-testid":`${u}-label`,children:t.label}),n.jsx("span",{className:"font-semibold tabular-nums","data-testid":`${u}-amount`,children:we(t.amount,s,a)}),n.jsx(d.Chip,{size:"sm",radius:"full",variant:"flat",color:ou[t.status],startContent:t.status==="recorded"?n.jsx(V,{icon:"lucide:check-circle",width:14,height:14,"aria-hidden":"true"}):t.status==="failed"?n.jsx(V,{icon:"lucide:alert-circle",width:14,height:14,"aria-hidden":"true"}):void 0,"data-testid":`${u}-status`,children:o}),f&&(r?f:n.jsx(d.Tooltip,{content:c,placement:"left",children:n.jsx("span",{tabIndex:0,"aria-label":c,children:f})}))]})},fu=`
|
|
17
17
|
@keyframes pp-modal-in {
|
|
18
18
|
from { opacity: 0; transform: scale(0.96); }
|
|
19
19
|
to { opacity: 1; transform: scale(1); }
|
|
@@ -38,5 +38,5 @@ ${s}${a}
|
|
|
38
38
|
from { opacity: 0; transform: translateY(-6px); }
|
|
39
39
|
to { opacity: 1; transform: translateY(0); }
|
|
40
40
|
}
|
|
41
|
-
`,Bn=x.forwardRef(({children:e,relativeOverlayRoot:t=!0,className:s,style:a,"data-testid":r="modal-shell"},i)=>n.jsxs(n.Fragment,{children:[n.jsx("style",{children:uu}),n.jsx("div",{ref:i,"data-testid":r,style:a,className:d.cn("flex flex-col gap-4 p-4 rounded-3xl bg-white shadow-xl","md:gap-5 md:p-6",t&&"relative","motion-safe:animate-[pp-modal-in_220ms_ease-out]","motion-safe:transition-[min-height] motion-safe:duration-[420ms] motion-safe:ease-in-out",s),children:e})]}));Bn.displayName="ModalShell";const Vn=({title:e,onClose:t,closeLabel:s="Close",actions:a,className:r,"data-testid":i="modal-shell-header"})=>n.jsxs("header",{className:d.cn("flex items-center justify-between",r),"data-testid":i,children:[n.jsx("h2",{className:"text-xl font-semibold","data-testid":`${i}-title`,children:e}),n.jsxs("div",{className:"flex items-center gap-2",children:[a,t&&n.jsx(R,{isIconOnly:!0,variant:"light",radius:"full",size:"sm",onPress:t,"aria-label":s,"data-testid":`${i}-close`,children:n.jsx(V,{icon:"lucide:x",width:20,height:20,"aria-hidden":"true"})})]})]});Vn.displayName="ModalShellHeader";const Un=({children:e,columns:t=2,className:s,"data-testid":a="modal-shell-footer"})=>n.jsx("footer",{className:d.cn("mt-2 gap-3",t===2?"flex flex-col md:grid md:grid-cols-2 [&>*]:w-full [&>*:first-child]:md:order-2 [&>*:nth-child(2)]:md:order-1":"grid grid-cols-1",s),"data-testid":a,children:e});Un.displayName="ModalShellFooter";const fu={2:"sm:grid-cols-2",3:"sm:grid-cols-3",4:"sm:grid-cols-4"},mu={1:"grid-cols-1",2:"grid-cols-2"},Jt=e=>typeof e=="string"?n.jsx(V,{icon:e,width:20,height:20,"aria-hidden":"true"}):e,Hn=({options:e,selectedKey:t,onSelect:s,heading:a,ariaLabel:r="Select an option",columnsDesktop:i=3,columnsMobile:o=2,className:l,"data-testid":c="tile-select"})=>{const u=e.find(f=>f.key===t);return n.jsxs("div",{className:d.cn("flex flex-col gap-3",l),"data-testid":c,children:[a&&n.jsx("h3",{className:"text-sm font-medium text-default-700",id:`${c}-heading`,children:a}),n.jsx("div",{className:"md:hidden",children:n.jsx(Ie,{"aria-label":a?void 0:r,"aria-labelledby":a?`${c}-heading`:void 0,selectedKeys:t?[t]:[],onSelectionChange:f=>{const g=Array.from(f)[0];typeof g=="string"&&s(g)},placeholder:r,variant:"bordered",radius:"lg","data-testid":`${c}-mobile-select`,startContent:u?n.jsx("span",{"aria-hidden":"true",className:"shrink-0",children:Jt(u.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(f=>n.jsx(d.SelectItem,{isDisabled:f.isDisabled,startContent:n.jsx("span",{"aria-hidden":"true",className:"shrink-0",children:Jt(f.icon)}),"data-testid":f["data-testid"]??`${c}-${f.key}-mobile`,children:f.label},f.key))})}),n.jsx("div",{role:"group","aria-labelledby":a?`${c}-heading`:void 0,"aria-label":a?void 0:r,className:d.cn("hidden md:grid gap-3",mu[o],fu[i]),children:e.map(f=>{const h=t===f.key;return n.jsxs(R,{variant:"bordered",radius:"lg","aria-pressed":h,"aria-label":f.label,isDisabled:f.isDisabled,onPress:()=>s(f.key),"data-testid":f["data-testid"]??`${c}-${f.key}`,className:d.cn("flex flex-col items-center justify-center gap-2 h-auto min-h-[80px] px-4 py-4","border bg-transparent transition-colors",h?"border-primary bg-primary-50 text-primary":"border-default-200 text-default-800 hover:bg-default-50"),children:[n.jsx("span",{"aria-hidden":"true",children:Jt(f.icon)}),n.jsx("span",{className:"text-sm font-medium",children:f.label})]},f.key)})})]})};Hn.displayName="TileSelect";const hu={subtle:{wrapper:"bg-default-100",amount:"text-default-900"},success:{wrapper:"bg-success-50 text-success-700",amount:"text-success-700"}},qn=({total:e,label:t,locale:s="en-US",variant:a="subtle",className:r,"data-testid":i="payment-total-banner"})=>{const o=hu[a];return n.jsxs("div",{"data-testid":i,className:d.cn("rounded-2xl px-6 py-5 text-center",o.wrapper,r),children:[n.jsx("div",{className:"text-sm text-default-600",children:t}),n.jsx("div",{className:d.cn("mt-1 text-4xl font-bold tracking-tight",o.amount),"data-testid":`${i}-amount`,children:we(e.value,s,e.currency)})]})};qn.displayName="PaymentTotalBanner";const xu={white:"bg-white/70 backdrop-blur-sm",transparent:"bg-transparent"},Tr=({title:e,subtitle:t,backdrop:s="white",exiting:a=!1,className:r,"data-testid":i="loading-overlay"})=>n.jsxs("div",{role:"status","aria-live":a?"off":"polite","aria-hidden":a||void 0,"data-testid":i,"data-state":a?"exiting":"visible",className:d.cn("absolute inset-0 z-10 flex flex-col items-center justify-center gap-4 rounded-3xl",xu[s],a?"pointer-events-none motion-safe:animate-[pp-fade-out_280ms_ease-in_forwards]":"motion-safe:animate-[pp-fade-in_150ms_ease-out]",r),children:[n.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]"}),n.jsxs("div",{className:"text-center",children:[n.jsx("div",{className:"text-xl font-semibold","data-testid":`${i}-title`,children:e}),t&&n.jsx("div",{className:"mt-1 text-sm text-default-600",children:t})]})]});Tr.displayName="LoadingOverlay";const Wn=({cashChange:e,label:t="Cash to return",secondaryLine:s,locale:a="en-US",onDismiss:r,dismissAriaLabel:i="Dismiss",align:o="left",className:l,"data-testid":c="payment-cash-change-banner"})=>{if(!e||e.value<=0)return null;const u=o==="center";return n.jsxs("div",{role:"status","aria-live":"polite","data-testid":c,className:d.cn("flex w-full items-center gap-3 rounded-2xl border border-info-200 bg-info-50 px-5 py-4",u?"justify-center text-center":"text-left","motion-safe:animate-[pp-slide-down_200ms_ease-out]",l),children:[n.jsx(V,{icon:"lucide:info",width:28,height:28,className:"shrink-0 text-info-700","aria-hidden":"true"}),n.jsxs("div",{className:d.cn("flex flex-col",u?"items-center":"flex-1"),children:[n.jsx("span",{className:"text-xs font-medium uppercase tracking-wider text-info-700",children:t}),n.jsx("span",{className:"text-2xl font-bold text-info-700","data-testid":`${c}-amount`,children:we(e.value,a,e.currency)}),s&&n.jsx("span",{className:"mt-0.5 text-xs text-info-700/80",children:s})]}),r&&n.jsx(R,{isIconOnly:!0,variant:"light",radius:"full",size:"sm",onPress:r,"aria-label":i,"data-testid":`${c}-dismiss`,className:"shrink-0 text-info-700 hover:bg-info-100",children:n.jsx(V,{icon:"lucide:x",width:18,height:18,"aria-hidden":"true"})})]})};Wn.displayName="PaymentCashChangeBanner";const Pr=({title:e,subtitle:t,emailLine:s,confirmationEmail:a,cashChange:r,cashChangeLabel:i="Cash to return",locale:o="en-US",closeLabel:l="Close",onClose:c,className:u,"data-testid":f="payment-success-view"})=>{const h=!!(r&&r.value>0);return n.jsxs("div",{"data-testid":f,className:d.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:[n.jsx("div",{"aria-hidden":"true",className:"flex items-center justify-center rounded-full bg-[#A2D9C6] p-[10px]",children:n.jsx(V,{icon:"gravity-ui:circle-check-fill",width:76,height:76,className:"text-[#10B981]","aria-hidden":"true"})}),n.jsxs("div",{className:"space-y-3",children:[n.jsx("h2",{className:"text-2xl font-bold","data-testid":`${f}-title`,children:e}),n.jsx("p",{className:"text-default-700",children:t}),s&&a&&n.jsxs("p",{className:"text-default-700",children:[s,n.jsx("br",{}),n.jsx("strong",{className:"font-semibold",children:a})]})]}),h&&r&&n.jsx(Wn,{cashChange:r,label:i,locale:o,align:"center",className:"max-w-[400px]","data-testid":`${f}-cash-change`}),c&&n.jsx(R,{color:"default",variant:"bordered",radius:"full",size:"lg",onPress:c,"data-testid":`${f}-close`,className:"mt-4 w-full",children:l})]})};Pr.displayName="PaymentSuccessView";const mt=({heading:e,amountLabel:t,value:s,defaultValue:a,onChange:r,placeholder:i,isDisabled:o,isInvalid:l,errorMessage:c,autoFocus:u,maxAmount:f,hideHeading:h=!1,className:g,"data-testid":m="payment-sub-amount-input"})=>{const v=`${m}-input`,j=x.useCallback(w=>{if(f!==void 0){const y=Number.parseFloat(w.replace(",","."));if(Number.isFinite(y)&&y>f)return}r?.(w)},[f,r]),b=x.useCallback(w=>{const y=w.currentTarget;requestAnimationFrame(()=>{y.isConnected&&y.select()})},[]);return n.jsxs("div",{className:d.cn("flex flex-col gap-3 border-t border-default-100 pt-5",g),"data-testid":m,children:[n.jsx("h3",{className:d.cn("text-lg font-semibold",h&&"sr-only"),"data-testid":`${m}-heading`,children:e}),n.jsx(d.Input,{id:v,label:t,labelPlacement:"outside",classNames:h?{label:"sr-only"}:void 0,type:"text",inputMode:"decimal",pattern:"[0-9]*[.,]?[0-9]*",value:s,defaultValue:a,onChange:w=>j(w.target.value),onFocus:b,placeholder:i,isDisabled:o,isInvalid:l,errorMessage:l?c:void 0,variant:"bordered",radius:"lg","aria-invalid":l||void 0,autoFocus:u,"data-testid":`${m}-field`})]})};mt.displayName="PaymentSubAmountInput";const pu={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"}},gu=e=>typeof e=="string"?n.jsx(V,{icon:e,className:"size-5","aria-hidden":"true"}):e,_r=({isOpen:e,title:t,confirmLabel:s,onConfirm:a,onOpenChange:r,children:i,description:o,cancelLabel:l="Cancel",variant:c="danger",isPending:u=!1,isDismissable:f,isKeyboardDismissDisabled:h=!1,hideIcon:g=!1,icon:m,"data-testid":v="confirm-dialog"})=>{const j=i??o??null,b=pu[c],w=g?null:gu(m??b.icon);return n.jsx(d.Modal,{isOpen:e,onOpenChange:y=>r?.(y),placement:"center",size:"md",isDismissable:(f??!0)&&!u,isKeyboardDismissDisabled:h||u,hideCloseButton:u,className:"gap-4 p-6",classNames:{base:"rounded-3xl"},"data-testid":v,children:n.jsxs(d.ModalContent,{role:"alertdialog",children:[n.jsxs(d.ModalHeader,{className:"flex flex-col items-center gap-3 p-0 text-center",children:[w?n.jsx("div",{"aria-hidden":"true","data-testid":`${v}-icon`,className:d.cn("flex size-10 items-center justify-center rounded-full",b.tile),children:w}):null,n.jsx("span",{"data-testid":`${v}-title`,className:"text-lg font-semibold text-zinc-950",children:t})]}),j!==null?n.jsx(d.ModalBody,{"data-testid":`${v}-body`,className:"gap-0 p-0",children:typeof j=="string"?n.jsx("p",{className:"mx-auto max-w-sm text-center text-sm text-gray-600",children:j}):j}):null,n.jsxs(d.ModalFooter,{className:"flex flex-col-reverse gap-2 p-0 sm:flex-row sm:gap-3",children:[n.jsx(R,{variant:"bordered",color:"default",radius:"full",onPress:()=>r?.(!1),isDisabled:u,"data-testid":`${v}-dismiss`,className:"w-full sm:flex-1",children:l}),n.jsx(R,{color:b.confirmColor,variant:"solid",radius:"full",onPress:a,isLoading:u,"data-testid":`${v}-confirm`,className:"w-full sm:flex-1",children:s})]})]})})};_r.displayName="ConfirmDialog";const bu=60,yu=(e,t,s=bu)=>t?e>s:e<-s,Or=(e,t)=>Math.max(0,Math.min(e,t)),vu=160,ju=(e,t,s=vu)=>Math.min(e,Math.max(0,t-s)),wu=(e,t,s)=>Or(e-t,s),Nu=(e,t,s)=>e!==null?Or(e,s):t?s:0,Cu=e=>e?"":"transition-[height] duration-300 ease-out",Su=e=>({onDrag:(t,s)=>{const a=e.open?e.fullHeight:0;e.setDragHeight(wu(a,s?.offset?.y??0,e.fullHeight))},onDragEnd:(t,s)=>{yu(s?.offset?.y??0,e.open)&&e.onToggleOpen?.(),e.setDragHeight(null)}}),Ye=(e,t)=>we(e.value,t,e.currency),Yn=({item:e,locale:t,onRemove:s,removeAriaLabel:a,showRemoveButton:r=!0})=>{const i=!!e.children&&e.children.length>0,o=!!s&&r;return n.jsxs("div",{"data-testid":`summary-item-${e.id}`,className:"flex flex-col gap-2",children:[n.jsxs("div",{className:"flex min-h-9 items-center justify-between gap-2",children:[n.jsxs("div",{className:"flex min-w-0 items-center gap-2 text-base text-foreground",children:[typeof e.quantity=="number"&&n.jsxs("span",{"data-testid":`summary-item-qty-${e.id}`,className:"shrink-0",children:[e.quantity," x"]}),e.leadingIcon,n.jsx("span",{"data-testid":`summary-item-name-${e.id}`,className:d.cn("truncate",e.emphasis&&"font-medium"),children:e.name})]}),n.jsxs("div",{className:"flex shrink-0 items-center",children:[e.amount&&n.jsx("span",{"data-testid":`summary-item-amount-${e.id}`,className:"whitespace-nowrap text-base text-foreground",children:Ye(e.amount,t)}),o&&n.jsx(R,{isIconOnly:!0,size:"sm",variant:"light",radius:"full",className:"ml-1 size-8 min-w-8 p-2 text-danger","aria-label":a,"data-testid":`summary-remove-${e.id}`,onPress:()=>s(e.id),children:n.jsx(V,{icon:"lucide:trash-2",width:16,height:16,className:"text-danger"})})]})]}),e.dateLabel&&n.jsxs("div",{"data-testid":`summary-item-date-${e.id}`,className:"flex items-center gap-2 text-sm text-default-500",children:[n.jsx(V,{icon:"lucide:calendar",width:16,height:16,className:"shrink-0"}),n.jsx("span",{className:"truncate",children:e.dateLabel})]}),e.dateRange&&n.jsxs("div",{"data-testid":`summary-item-daterange-${e.id}`,className:"flex items-center gap-2 text-sm text-default-500",children:[n.jsx(V,{icon:"lucide:calendar",width:16,height:16,className:"shrink-0"}),n.jsx("span",{children:e.dateRange.from}),n.jsx(V,{icon:"lucide:arrow-right",width:16,height:16,className:"shrink-0"}),n.jsx("span",{children:e.dateRange.to})]}),e.details?.map((l,c)=>n.jsxs("div",{"data-testid":`summary-item-detail-${e.id}-${l.key??c}`,className:"flex items-center justify-between gap-2 text-sm text-default-500",children:[n.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[l.icon,n.jsx("span",{className:"truncate",children:l.label})]}),(l.value!=null||l.tooltip!=null)&&n.jsxs("div",{className:"flex shrink-0 items-center gap-1",children:[l.value!=null&&n.jsx("span",{className:d.cn("whitespace-nowrap",l.valueTone==="primary"&&"font-medium text-primary"),children:l.value}),l.tooltip!=null&&n.jsx(d.Tooltip,{content:l.tooltip,children:n.jsx("span",{"data-testid":`summary-item-detail-tooltip-${e.id}-${l.key??c}`,className:"flex shrink-0 items-center",children:n.jsx(V,{icon:"lucide:info",width:16,height:16,className:d.cn(l.valueTone==="primary"?"text-primary":"text-default-400")})})})]})]},l.key??c)),i&&n.jsx("div",{"data-testid":`summary-children-${e.id}`,className:"flex flex-col gap-2 pl-6",children:e.children.map(l=>n.jsx(Yn,{item:l,locale:t,onRemove:s,removeAriaLabel:a,showRemoveButton:r},l.id))})]})};Yn.displayName="SummaryItemRow";const Rr=({fee:e,locale:t,className:s})=>n.jsxs("div",{"data-testid":"summary-service-fee",className:d.cn("flex items-center justify-between gap-2",s),children:[n.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:[n.jsx("span",{"aria-hidden":"true",className:d.cn("flex size-4 shrink-0 items-center justify-center rounded-full border",e.isSelected?"border-primary":"border-default-200"),children:e.isSelected&&n.jsx("span",{className:"size-2 rounded-full bg-primary"})}),n.jsx("span",{className:"truncate text-sm font-medium text-foreground",children:e.label})]}),n.jsx("span",{"data-testid":"summary-service-fee-amount",className:"whitespace-nowrap text-base text-foreground",children:Ye(e.amount,t)})]});Rr.displayName="SummaryServiceFeeRow";const Kn=({row:e,locale:t,emphasized:s,onRemove:a,removeAriaLabel:r,showRemoveButton:i=!0})=>{const o=!!a&&i&&!!e.id,l=n.jsx("span",{"data-testid":`summary-row-amount-${e.key}`,className:"whitespace-nowrap text-base",children:Ye(e.amount,t)});return n.jsxs("div",{"data-testid":`summary-row-${e.key}`,className:"flex items-center justify-between text-foreground",children:[n.jsx("span",{"data-testid":`summary-row-label-${e.key}`,className:d.cn(s?"text-xl font-semibold leading-7":"text-base"),children:e.label}),o?n.jsxs("div",{className:"flex shrink-0 items-center",children:[l,n.jsx(R,{isIconOnly:!0,size:"sm",variant:"light",radius:"full",className:"ml-1 size-8 min-w-8 p-2 text-danger","aria-label":r,"data-testid":`summary-remove-row-${e.id}`,onPress:()=>a(e.id),children:n.jsx(V,{icon:"lucide:trash-2",width:16,height:16,className:"text-danger"})})]}):l]})};Kn.displayName="SummaryTotalsLineRow";const zr=({pricesInLabel:e,currency:t,items:s,serviceFee:a,rows:r,locale:i,onRemoveItem:o,removeAriaLabel:l,showRemoveButton:c,emptyState:u,classNames:f})=>{const h=(s?.length??0)>0;return n.jsxs(n.Fragment,{children:[n.jsxs("div",{"data-testid":"summary-prices",className:d.cn("flex items-center justify-between text-xs text-default-500",f.prices),children:[n.jsx("span",{children:e}),t!=null&&n.jsx("span",{children:t})]}),h?n.jsx("div",{className:d.cn("flex flex-col gap-4",f.items),children:s.map(g=>n.jsx(Yn,{item:g,locale:i,onRemove:o,removeAriaLabel:l,showRemoveButton:c},g.id))}):n.jsx("div",{"data-testid":"summary-empty",children:u}),a&&n.jsxs(n.Fragment,{children:[n.jsx(d.Divider,{className:"bg-default-200"}),n.jsx(Rr,{fee:a,locale:i,className:f.serviceFee})]}),r&&r.length>0&&n.jsx("div",{className:d.cn("flex flex-col gap-4",f.totalsRows),children:r.map((g,m)=>n.jsx(Kn,{row:g,locale:i,emphasized:m===0},g.key))})]})};zr.displayName="SummaryBody";const Br=({total:e,locale:t,className:s})=>n.jsxs("div",{"data-testid":"summary-total",className:d.cn("flex items-center justify-between text-xl font-semibold leading-7 text-foreground",s),children:[n.jsx("span",{children:e.label??"Total"}),n.jsx("span",{"data-testid":"summary-total-amount",className:"whitespace-nowrap text-xl font-semibold leading-7",children:Ye(e.amount,t)})]});Br.displayName="SummaryGrandTotalRow";const Vr=({secondaryTotal:e,locale:t,className:s})=>n.jsxs("div",{"data-testid":"summary-secondary-total",className:d.cn("flex items-center justify-between text-lg font-semibold leading-7 text-primary",s),children:[n.jsx("span",{children:e.label}),n.jsx("span",{"data-testid":"summary-secondary-total-amount",className:"whitespace-nowrap text-lg font-semibold leading-7",children:Ye(e.amount,t)})]});Vr.displayName="SummarySecondaryTotalRow";const At=({action:e,disabledByLoading:t,className:s,testId:a="summary-cta"})=>n.jsx(R,{color:"primary",radius:"full",className:d.cn("px-[18px] py-[14px] font-medium",s),"data-testid":a,isLoading:e.isLoading,isDisabled:e.isDisabled||t,onPress:e.onPress,endContent:n.jsx(V,{icon:"lucide:arrow-right",width:16,height:16}),children:e.label});At.displayName="SummaryPrimaryCta";const Ur=({title:e,total:t,secondaryTotal:s,locale:a,open:r,progress:i,dragging:o,toggleAriaLabel:l,onToggleOpen:c,classNames:u})=>n.jsx("h2",{children:n.jsxs("button",{type:"button","data-testid":"summary-collapse-toggle","aria-expanded":r,"aria-label":l,onClick:c,className:d.cn("-mx-4 -mt-4 grid w-[calc(100%_+_32px)] grid-cols-1 px-4 pb-4 pt-4 text-left",u.header),children:[n.jsxs("span",{"aria-hidden":!r,style:{opacity:i},className:d.cn("col-start-1 row-start-1 flex items-center justify-between",!o&&"transition-opacity duration-300"),children:[n.jsx("span",{"data-testid":"summary-title",className:d.cn("text-xl font-semibold leading-7 text-foreground",u.title),children:e}),n.jsx("span",{"data-testid":"summary-close","aria-hidden":"true",className:d.cn("shrink-0 text-foreground",u.closeButton),children:n.jsx(V,{icon:"lucide:x",width:20,height:20})})]}),n.jsxs("span",{"aria-hidden":r,style:{opacity:1-i},className:d.cn("col-start-1 row-start-1 flex flex-col gap-2",!o&&"transition-opacity duration-300"),children:[n.jsxs("span",{className:"flex items-center justify-between text-xl font-semibold leading-7 text-foreground",children:[n.jsx("span",{children:t.label??"Total"}),n.jsx("span",{className:"whitespace-nowrap",children:Ye(t.amount,a)})]}),s&&n.jsxs("span",{className:"flex items-center justify-between text-lg font-semibold leading-7 text-primary",children:[n.jsx("span",{children:s.label}),n.jsx("span",{className:"whitespace-nowrap",children:Ye(s.amount,a)})]})]})]})});Ur.displayName="SummaryCollapseHeader";const Hr=({cart:e,ariaLabel:t,onPress:s,className:a})=>n.jsxs("button",{type:"button","data-testid":"summary-cart","aria-label":t,onClick:s,className:d.cn("relative flex size-[52px] shrink-0 items-center justify-center rounded-full border border-default-200 bg-content1",a),children:[n.jsx(V,{icon:"lucide:shopping-bag",width:24,height:24,className:"text-foreground"}),e.count!=null&&n.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})]});Hr.displayName="SummaryCartButton";const qr=({open:e,progress:t,dragging:s,primaryAction:a,isLoading:r,cart:i,cartAriaLabel:o,ctaCaption:l,onToggleOpen:c,classNames:u})=>n.jsxs("div",{"data-testid":"summary-mobile-bar",className:d.cn("flex flex-col gap-4",u.mobileBar),children:[n.jsx(d.Divider,{className:"bg-default-200"}),n.jsxs("div",{className:"grid",children:[n.jsxs("div",{"aria-hidden":e,style:{opacity:1-t},className:d.cn("col-start-1 row-start-1 flex items-stretch gap-2.5",e&&"pointer-events-none",!s&&"transition-opacity duration-300"),children:[i&&n.jsx(Hr,{cart:i,ariaLabel:o,className:u.cart,onPress:()=>{c?.(),i.onPress?.()}}),a&&n.jsx(At,{action:a,disabledByLoading:r,className:d.cn("h-[52px] flex-1",u.cta),testId:"summary-cta-compact"})]}),a&&n.jsx("div",{"aria-hidden":!e,style:{opacity:t},className:d.cn("col-start-1 row-start-1 flex",!e&&"pointer-events-none",!s&&"transition-opacity duration-300"),children:n.jsx(At,{action:a,disabledByLoading:r,className:d.cn("h-[52px] w-full",u.cta)})})]}),l&&n.jsx("div",{children:l})]});qr.displayName="SummaryActionBar";const ku="(max-width: 767px)",Au=e=>typeof window<"u"&&typeof window.matchMedia=="function"?window.matchMedia(e).matches:!1,$u=(e=ku)=>{const[t,s]=x.useState(()=>Au(e));return x.useEffect(()=>{if(typeof window>"u"||typeof window.matchMedia!="function")return;const a=window.matchMedia(e),r=()=>s(a.matches);return r(),a.addEventListener("change",r),()=>a.removeEventListener("change",r)},[e]),t},Wr=({title:e="Summary",pricesInLabel:t="Prices are in",currency:s,locale:a="en-US",items:r,serviceFee:i,rows:o,total:l,postTotalRows:c,onRemovePostTotalRow:u,secondaryTotal:f,collapsible:h,isOpen:g,onToggleOpen:m,defaultOpen:v=!1,primaryAction:j,isLoading:b=!1,onRemoveItem:w,showRemoveButton:y,ctaCaption:k,variant:N,cart:S,emptyState:E,labels:L,classNames:M={},"data-testid":$="summary",className:O})=>{const F=L?.removeAriaLabel??"Remove item",A=L?.removePostTotalRowAriaLabel??"Remove applied code",I=L?.toggleAriaLabel??"Toggle summary",P=L?.cartAriaLabel??"View cart",G=$u(),W=h??(N??(G?"mobile":"main"))==="mobile",[ee,ae]=x.useState(v),re=g!==void 0,U=!W||(re?g:ee),Z=x.useCallback(()=>{re||ae(xe=>!xe),m?.()},[re,m]),[Q,H]=x.useState(0),[X,J]=x.useState(null),Ce=x.useRef(null),be=x.useRef(null),he=x.useCallback(()=>{const xe=Ce.current;xe&&H(ju(xe.scrollHeight,window.innerHeight))},[]),Be=x.useCallback(xe=>{be.current?.disconnect(),be.current=null,Ce.current=xe,xe&&(he(),typeof ResizeObserver<"u"&&(be.current=new ResizeObserver(he),be.current.observe(xe)))},[he]);x.useEffect(()=>(window.addEventListener("resize",he),()=>window.removeEventListener("resize",he)),[he]);const Te=Su({open:U,fullHeight:Q,setDragHeight:J,onToggleOpen:Z}),Pe=X!==null,_e=Nu(X,U,Q),Ve=Q>0?Math.min(1,Math.max(0,_e/Q)):U?1:0,Ee=n.jsx(Br,{total:l,locale:a,className:M.total}),te=c&&c.length>0&&n.jsx("div",{"data-testid":"summary-post-total-rows",className:"flex flex-col gap-4",children:c.map(xe=>n.jsx(Kn,{row:xe,locale:a,emphasized:!1,onRemove:u,removeAriaLabel:A,showRemoveButton:y},xe.key))}),me=f&&n.jsx(Vr,{secondaryTotal:f,locale:a,className:M.secondaryTotal}),Fe=k!=null&&n.jsx("p",{"data-testid":"summary-cta-caption",className:d.cn("text-center text-sm text-default-500",M.ctaCaption),children:k}),ht=n.jsx(zr,{pricesInLabel:t,currency:s,items:r,serviceFee:i,rows:o,locale:a,onRemoveItem:w,removeAriaLabel:F,showRemoveButton:y,emptyState:E,classNames:M});return W?n.jsxs(Ae.motion.section,{"data-testid":$,drag:"y",dragConstraints:{top:0,bottom:0},dragElastic:.12,dragSnapToOrigin:!0,onDrag:Te.onDrag,onDragEnd:Te.onDragEnd,className:d.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)]",O,M.base),children:[n.jsx(Ur,{title:e,total:l,secondaryTotal:f,locale:a,open:U,progress:Ve,dragging:Pe,toggleAriaLabel:I,onToggleOpen:Z,classNames:M}),n.jsx("div",{"data-testid":"summary-reveal","aria-hidden":!U,style:{height:_e},className:d.cn("min-h-0",U&&!Pe?"overflow-y-auto overscroll-contain [scrollbar-width:none] [&::-webkit-scrollbar]:hidden":"overflow-hidden",!U&&"pointer-events-none",Cu(Pe)),children:n.jsxs("div",{ref:Be,className:"flex flex-col gap-4 pb-4",children:[ht,n.jsx(d.Divider,{className:"bg-default-200"}),Ee,te,me]})}),n.jsx(qr,{open:U,progress:Ve,dragging:Pe,primaryAction:j,isLoading:b,cart:S,cartAriaLabel:P,ctaCaption:Fe,onToggleOpen:Z,classNames:M})]}):n.jsxs("section",{"data-testid":$,className:d.cn("flex w-full flex-col gap-4 rounded-2xl border border-default-200 bg-content1 p-4",O,M.base),children:[n.jsx("div",{className:d.cn("flex items-center justify-between",M.header),children:n.jsx("h2",{"data-testid":"summary-title",className:d.cn("text-xl font-semibold leading-7 text-foreground",M.title),children:e})}),ht,n.jsx(d.Divider,{className:"bg-default-200"}),Ee,te,me,f&&j&&n.jsx(d.Divider,{className:"bg-default-200"}),j&&n.jsx(At,{action:j,disabledByLoading:b,className:d.cn("w-full",M.cta)}),Fe]})};Wr.displayName="Summary";const Du={back:"Back",close:"Close"},Yr=({onClose:e,steps:t,activeStepId:s,onBack:a,primaryAction:r,footerSummary:i,labels:o,className:l,"data-testid":c="wizard-shell",children:u})=>{const f={...Du,...o},h=t.filter(v=>v.state!=="skipped"),g=t.find(v=>v.id===s),m=Math.max(0,h.findIndex(v=>v.id===s));return n.jsxs(Bn,{className:l,"data-testid":c,children:[n.jsx(Vn,{title:g?.label??"",onClose:e,closeLabel:f.close,"data-testid":`${c}-header`}),n.jsx("div",{"data-testid":`${c}-stepper`,children:n.jsx(kn,{stepsCount:h.length,currentStep:m,isDisabled:!0})}),u,i,n.jsxs(Un,{columns:a?2:1,"data-testid":`${c}-footer`,children:[a&&n.jsx(R,{variant:"light",onPress:a,"data-testid":`${c}-back`,startContent:n.jsx(V,{icon:"lucide:arrow-left",width:18,height:18,"aria-hidden":"true"}),children:f.back}),n.jsx(R,{color:"primary",isLoading:r.loading,isDisabled:r.disabled,onPress:r.onClick,"data-testid":`${c}-primary`,children:r.label})]})]})};Yr.displayName="WizardShell";const Eu={refunded:"Refunded",ineligible:"Ineligible",partialLink:"Refund partial $ of this line",partialOf:"of {amount}",partialCancel:"Cancel",restockTitle:"Restock this item",restockHint:"Returns to current location."},Kr=({items:e,selections:t,onSelectionChange:s,onRestockToggle:a,labels:r,className:i,"data-testid":o="refund-item-list"})=>{const l={...Eu,...r};return n.jsx("div",{className:d.cn("flex flex-col",i),"data-testid":o,children:e.map(c=>{const u=t[c.id],f=!!u?.selected,h=u?.mode??"full",g=c.state==="already_refunded"||c.state==="non_refundable",m=`${o}-row-${c.id}`,v=we(c.paidAmount.value,void 0,c.paidAmount.currency);return n.jsx("div",{className:d.cn("mb-2 rounded-xl border border-default-200 p-3",f&&"border-primary bg-primary-50"),"data-testid":m,children:n.jsxs("div",{className:"flex items-start gap-3",children:[g?n.jsx(d.Chip,{size:"sm",radius:"full",variant:"flat",color:c.state==="already_refunded"?"default":"warning","data-testid":`${m}-blocked`,children:c.state==="already_refunded"?l.refunded:l.ineligible}):n.jsx(d.Checkbox,{isSelected:f,onValueChange:j=>s(c.id,{selected:j,mode:"full"}),"aria-label":c.name,"data-testid":`${m}-checkbox`}),n.jsxs("div",{className:"min-w-0 flex-1",children:[n.jsxs("div",{className:"flex items-center justify-between gap-2",children:[n.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[n.jsx("span",{className:"truncate text-sm font-semibold",children:c.name}),n.jsxs("span",{className:"text-sm text-default-500",children:["×",c.quantity]})]}),n.jsx("span",{className:"shrink-0 text-sm font-semibold",children:v})]}),c.warning&&n.jsx(d.Chip,{size:"sm",radius:"full",variant:"flat",color:"warning",className:"mt-2",startContent:n.jsx(V,{icon:"gravity-ui:triangle-exclamation-fill",width:14,height:14,"aria-hidden":"true"}),"data-testid":`${m}-warning`,children:c.warning}),!g&&f&&h==="full"&&n.jsx(R,{variant:"light",size:"sm",className:"mt-2 h-auto min-w-0 px-1 py-0.5 text-xs font-semibold text-primary",onPress:()=>s(c.id,{selected:!0,mode:"partial"}),"data-testid":`${m}-partial-link`,children:l.partialLink}),!g&&f&&h==="partial"&&n.jsxs("div",{className:"mt-2 flex items-center gap-2","data-testid":`${m}-partial`,children:[n.jsx(mt,{heading:c.name,amountLabel:l.partialLink,hideHeading:!0,maxAmount:c.paidAmount.value,value:u?.partialAmount!==void 0?String(u.partialAmount):void 0,onChange:j=>{const b=Number.parseFloat(j.replace(",","."));s(c.id,{selected:!0,mode:"partial",partialAmount:Number.isFinite(b)?b:void 0})},className:"max-w-[140px] border-t-0 pt-0","data-testid":`${m}-partial-input`}),n.jsx("span",{className:"text-xs text-default-500",children:l.partialOf.replace("{amount}",v)}),n.jsx(R,{variant:"light",size:"sm",className:"h-auto min-w-0 px-1 py-0.5 text-xs font-semibold text-primary",onPress:()=>s(c.id,{selected:!0,mode:"full"}),"data-testid":`${m}-partial-cancel`,children:l.partialCancel})]}),!g&&f&&c.restock.available&&n.jsxs("div",{className:"mt-2 flex items-center gap-3 border-t border-dashed border-default-200 pt-2",children:[n.jsx(V,{icon:"lucide:rotate-ccw",width:18,height:18,className:"shrink-0 text-default-500","aria-hidden":"true"}),n.jsxs("div",{className:"min-w-0 flex-1",children:[n.jsx("p",{className:"text-xs font-semibold",children:l.restockTitle}),n.jsx("p",{className:"text-xs text-default-500",children:l.restockHint})]}),n.jsx(d.Switch,{isSelected:c.restock.on,onValueChange:j=>a(c.id,j),"data-testid":`${m}-restock`})]}),!g&&f&&!c.restock.available&&c.restock.unavailableHint&&n.jsx("p",{className:"mt-2 text-xs text-default-500",children:c.restock.unavailableHint})]})]})},c.id)})})};Kr.displayName="RefundItemList";const Fu={amountLabel:"Refund amount",descriptionLabel:"Add a note",maxHint:"of {amount}"},Gr=({amount:e,description:t,max:s,error:a,onChange:r,labels:i,className:o,"data-testid":l="custom-amount-field"})=>{const c={...Fu,...i},u=c.maxHint.replace("{amount}",we(s.value,void 0,s.currency)),f=x.useCallback(g=>{const m=Number.parseFloat(g.replace(",","."));r({amount:Number.isFinite(m)?m:null,description:t})},[t,r]),h=x.useCallback(g=>{r({amount:e,description:g})},[e,r]);return n.jsxs("div",{className:d.cn("flex flex-col gap-3",o),"data-testid":l,children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(mt,{heading:c.amountLabel,amountLabel:c.amountLabel,hideHeading:!0,value:e!==null?String(e):"",placeholder:"$0.00",maxAmount:s.value,isInvalid:!!a,errorMessage:a,onChange:f,className:"max-w-[160px] border-t-0 pt-0","data-testid":`${l}-amount`}),n.jsx("span",{className:"text-xs text-default-500",children:u})]}),n.jsx(d.Input,{label:c.descriptionLabel,labelPlacement:"outside",variant:"bordered",radius:"lg",value:t,onChange:g=>h(g.target.value),"data-testid":`${l}-description`})]})};Gr.displayName="CustomAmountField";const Lu={title:"Refund total",partialBadge:"Partial refund"},Qr=({total:e,isPartial:t,labels:s,className:a,"data-testid":r="refund-total-bar"})=>{const i={...Lu,...s};return n.jsxs("div",{className:d.cn("flex flex-col items-center gap-2",a),"data-testid":r,children:[n.jsx(qn,{total:e,label:i.title,variant:"subtle",className:"w-full","data-testid":`${r}-banner`}),t&&n.jsx(d.Chip,{color:"warning",size:"sm",radius:"full",variant:"flat","data-testid":`${r}-partial`,children:i.partialBadge})]})};Qr.displayName="RefundTotalBar";const Mu={label:"Reason",placeholder:"Select a reason"},Zr=({options:e,value:t,onChange:s,error:a,labels:r,className:i,"data-testid":o="reason-select"})=>{const l={...Mu,...r};return n.jsx(Ie,{label:l.label,labelPlacement:"outside",placeholder:l.placeholder,selectedKeys:t?[t]:[],isInvalid:!!a,errorMessage:a,className:d.cn(i),"data-testid":o,onSelectionChange:c=>{if(c==="all")return;const u=[...c][0];u&&s(String(u))},children:e.map(c=>n.jsx(d.SelectItem,{children:c.label},c.id))})};Zr.displayName="ReasonSelect";const Iu={toggle:"Add a note",optionalTag:"(optional)"},Xr=({value:e,onChange:t,maxLength:s,labels:a,className:r,"data-testid":i="notes-field"})=>{const o={...Iu,...a},[l,c]=x.useState(e!=="");return n.jsx("div",{className:d.cn(r),"data-testid":i,children:l?n.jsx(d.Textarea,{value:e,onChange:u=>t(u.target.value),maxLength:s,placeholder:o.toggle,"aria-label":o.toggle,variant:"bordered",radius:"lg","data-testid":`${i}-textarea`}):n.jsxs(R,{variant:"light",className:"h-auto min-w-0 px-1 py-0.5 text-xs font-semibold text-primary",onPress:()=>c(!0),"data-testid":`${i}-toggle`,children:[o.toggle,n.jsx("span",{className:"ml-1 font-normal text-default-400",children:o.optionalTag})]})})};Xr.displayName="NotesField";const Tu={legend:"Acting as",manager:"Manager",cashier:"Cashier"},Pu=["manager","cashier"],Jr=({role:e,onChange:t,labels:s,className:a,"data-testid":r="acting-as-toggle"})=>{const i={...Tu,...s},o=`${r}-legend`;return n.jsxs("div",{className:d.cn("flex items-center gap-2",a),"data-testid":r,children:[n.jsx("span",{id:o,className:"text-xs font-semibold text-default-500",children:i.legend}),n.jsx("div",{role:"group","aria-labelledby":o,className:"inline-flex rounded-lg border border-default-200 p-0.5",children:Pu.map(l=>{const c=e===l;return n.jsx(R,{variant:"light",color:"default",radius:"md",size:"sm","aria-pressed":c,onPress:()=>t(l),className:d.cn("h-auto min-w-0 px-3 py-1 text-xs",c?"bg-default-100 font-semibold text-foreground":"text-default-500"),"data-testid":`${r}-${l}`,children:i[l]},l)})})]})};Jr.displayName="ActingAsToggle";const _u={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"},Ou={card:"lucide:credit-card",cash:"lucide:dollar-sign",check:"lucide:edit-3",other:"lucide:more-horizontal"},Bs="__split__",ei=({tenders:e,selectedTenderId:t,onSelect:s,onSplit:a,error:r,labels:i,className:o,"data-testid":l="money-back-methods"})=>{const c={..._u,...i},u=x.useMemo(()=>[...e.map(m=>({key:m.tenderId,label:`${m.label} · ${we(m.maxRefundable.value,"en-US",m.maxRefundable.currency)}`,icon:Ou[m.kind],"data-testid":`${l}-tile-${m.tenderId}`})),{key:Bs,label:c.split,icon:"lucide:split","data-testid":`${l}-split`}],[e,c.split,l]),f=m=>{if(m===Bs){a();return}s(m)},h=r?.kind==="processor_declined"?c.declinedTitle:c.networkTitle,g=r?.kind==="processor_declined"?c.declinedBody:c.networkBody;return n.jsxs("div",{className:d.cn("flex flex-col gap-4",o),"data-testid":l,children:[r&&n.jsx(d.Alert,{color:"danger",title:h,description:g,"data-testid":`${l}-error`,children:n.jsxs("div",{className:"mt-3 flex gap-2",children:[n.jsx(R,{color:"primary",size:"sm",onPress:r.onRetry,"data-testid":`${l}-retry`,children:c.retry}),n.jsx(R,{variant:"bordered",size:"sm",onPress:r.onChooseDifferent,"data-testid":`${l}-choose-different`,children:c.chooseDifferent})]})}),n.jsx(Hn,{heading:c.title,options:u,selectedKey:t,onSelect:f,"data-testid":`${l}-tiles`})]})};ei.displayName="MoneyBackMethods";const Ru=e=>e.refunded!==null,zu={title:"Split refund",refundedSoFar:"Refunded so far",remaining:"Remaining",amountForPart:"Amount for this part",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.",retry:"Try again",chooseDifferent:"Choose different method"},ti=({parts:e,refundedSoFar:t,remaining:s,current:a,onRefundPart:r,partError:i,onBack:o,busy:l,labels:c,className:u,"data-testid":f="split-refund-panel"})=>{const h={...zu,...c},g=e.filter(Ru),m=e.find(b=>b.tenderId===a.tenderId)?.label,v=x.useCallback(b=>{const w=Number.parseFloat(b.replace(",","."));a.onAmountChange(Number.isFinite(w)?w:0)},[a]),j=i?.kind==="processor_declined"?h.partDeclinedBody:h.partNetworkBody;return n.jsxs("div",{className:d.cn("flex flex-col gap-4",u),"data-testid":f,children:[n.jsx("h3",{className:"text-lg font-semibold","data-testid":`${f}-title`,children:h.title}),i&&n.jsx(d.Alert,{color:"danger",description:j,"data-testid":`${f}-part-error`,children:n.jsxs("div",{className:"mt-3 flex gap-2",children:[n.jsx(R,{color:"primary",size:"sm",onPress:i.onRetry,"data-testid":`${f}-retry`,children:h.retry}),n.jsx(R,{variant:"bordered",size:"sm",onPress:i.onChooseDifferent,"data-testid":`${f}-choose-different`,children:h.chooseDifferent})]})}),n.jsxs("div",{className:"flex items-center justify-between rounded-xl bg-default-50 p-3","data-testid":`${f}-totals`,children:[n.jsxs("div",{children:[n.jsx("p",{className:"text-xs text-default-500",children:h.refundedSoFar}),n.jsx("p",{className:"text-sm font-semibold",children:we(t.value,void 0,t.currency)})]}),n.jsxs("div",{className:"text-right",children:[n.jsx("p",{className:"text-xs text-default-500",children:h.remaining}),n.jsx("p",{className:"text-sm font-semibold",children:we(s.value,void 0,s.currency)})]})]}),g.length>0&&n.jsx("div",{className:"flex flex-col gap-2",children:g.map(b=>n.jsxs("div",{className:"flex items-center justify-between rounded-xl border border-default-200 p-3","data-testid":`${f}-part-${b.tenderId}-done`,children:[n.jsx("span",{className:"text-sm font-semibold",children:b.label}),n.jsx(d.Chip,{color:"success",size:"sm",radius:"full",variant:"flat",children:we(b.refunded.value,void 0,b.refunded.currency)})]},b.tenderId))}),n.jsxs("div",{className:"rounded-xl border border-primary bg-primary-50 p-3","data-testid":`${f}-current`,children:[n.jsxs("div",{className:"mb-2 flex items-center justify-between gap-2",children:[n.jsx("span",{className:"text-sm font-semibold","data-testid":`${f}-amount-label`,children:h.amountForPart}),m&&n.jsx("span",{className:"text-xs text-default-500",children:m})]}),n.jsx(mt,{heading:h.amountForPart,amountLabel:h.amountForPart,hideHeading:!0,placeholder:"$0.00",value:String(a.amount),onChange:v,maxAmount:s.value,isDisabled:l,className:"border-t-0 pt-0","data-testid":`${f}-amount`})]}),n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(R,{variant:"light",onPress:o,"data-testid":`${f}-back`,startContent:n.jsx(V,{icon:"lucide:arrow-left",width:18,height:18,"aria-hidden":"true"}),children:h.back}),n.jsx(R,{color:"primary",className:"flex-1",isDisabled:l,isLoading:l,onPress:r,"data-testid":`${f}-submit`,children:h.submit})]})]})};ti.displayName="SplitRefundPanel";const Bu={label:"Enter supervisor PIN",placeholder:"••••"},ni=({pin:e,onChange:t,error:s,labels:a,className:r,"data-testid":i="supervisor-pin-field"})=>{const o={...Bu,...a};return n.jsx(d.Input,{type:"password",inputMode:"numeric",label:o.label,labelPlacement:"outside",placeholder:o.placeholder,value:e,onChange:l=>t(l.target.value.replace(/\D/g,"").slice(0,6)),isInvalid:!!s,errorMessage:s,variant:"bordered",radius:"lg",className:d.cn(r),"data-testid":`${i}-input`})};ni.displayName="SupervisorPinField";const Vu={processing:"Processing refund…",title:"Refund complete",destinationsTitle:"Refund destinations",sendReceipt:"Send receipt",email:"Email",print:"Print",done:"Done",pending:"Pending",succeeded:"Refunded"},Uu={succeeded:"success",pending:"warning"},si=({state:e,destinations:t,onSendReceipt:s,onDone:a,labels:r,className:i,"data-testid":o="refund-complete-view"})=>{const l={...Vu,...r};return e==="processing"?n.jsx("div",{className:d.cn("flex flex-col items-center gap-4 text-center",i),"aria-live":"polite","data-testid":o,children:n.jsxs("div",{className:"flex flex-col items-center gap-4 py-8","data-testid":`${o}-processing`,children:[n.jsx(d.Spinner,{size:"lg",color:"primary"}),n.jsx("p",{className:"text-base font-semibold",children:l.processing})]})}):n.jsxs("div",{className:d.cn("flex flex-col items-center gap-4 text-center",i),"aria-live":"polite","data-testid":o,children:[n.jsx(V,{icon:"solar:check-circle-bold",width:46,height:46,className:"text-success","aria-hidden":"true"}),n.jsx("p",{className:"text-xl font-semibold","data-testid":`${o}-title`,children:l.title}),n.jsxs("div",{className:"w-full text-left",children:[n.jsx("p",{className:"mb-2 text-xs font-semibold uppercase text-default-500",children:l.destinationsTitle}),n.jsx("div",{className:"flex flex-col gap-2",children:t.map((c,u)=>n.jsxs("div",{className:"flex items-center justify-between rounded-xl border border-default-200 p-3","data-testid":`${o}-destination-${u}-${c.status}`,children:[n.jsx("span",{className:"text-sm font-semibold",children:c.label}),n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("span",{className:"text-sm text-default-500",children:we(c.amount.value,void 0,c.amount.currency)}),n.jsx(d.Chip,{color:Uu[c.status],size:"sm",radius:"full",variant:"flat",children:c.status==="succeeded"?l.succeeded:l.pending})]})]},`${c.label}-${u}`))})]}),s&&n.jsxs("div",{className:"w-full text-left",children:[n.jsx("p",{className:"mb-2 text-xs font-semibold uppercase text-default-500",children:l.sendReceipt}),n.jsxs("div",{className:"flex gap-2",children:[n.jsx(R,{variant:"bordered",className:"flex-1",onPress:()=>s("email"),"data-testid":`${o}-receipt-email`,children:l.email}),n.jsx(R,{variant:"bordered",className:"flex-1",onPress:()=>s("print"),"data-testid":`${o}-receipt-print`,children:l.print})]})]}),n.jsx(R,{color:"primary",className:"w-full",onPress:a,"data-testid":`${o}-done`,children:l.done})]})};si.displayName="RefundCompleteView";exports.ActingAsToggle=Jr;exports.AdminTable=gr;exports.AdminTextField=kr;exports.AdminToolbar=br;exports.AppliedCodeCard=ta;exports.Button=R;exports.CashTenderForm=tu;exports.CatalogItemCard=sr;exports.CheckTenderForm=Lr;exports.CommitmentDetails=Bc;exports.ConfirmDialog=_r;exports.ConfirmationModal=Lt;exports.ConfirmationPageTemplate=fo;exports.CustomAmountField=Gr;exports.DatePicker=Cn;exports.DimensionChip=zn;exports.DonationAmounts=$a;exports.EmptyState=Pn;exports.ErrorState=_n;exports.EventDetails=Yo;exports.EventDetailsTemplate=xo;exports.ExpireCartTimer=Da;exports.FeedbackState=et;exports.FilterPopover=lr;exports.Footer=po;exports.HeroUIProvider=Ti;exports.InstallmentFundAssignment=Pc;exports.InstallmentFundAssignmentSkeleton=Rc;exports.InstallmentSchedule=sd;exports.InstallmentScheduleSkeleton=cd;exports.InstallmentTable=md;exports.ItemCard=nr;exports.KeyValueChip=zn;exports.ListPanel=Fr;exports.LoadingOverlay=Tr;exports.LoadingState=On;exports.MembershipSelectCards=gd;exports.ModalShell=Bn;exports.ModalShellFooter=Un;exports.ModalShellHeader=Vn;exports.MoneyBackMethods=ei;exports.Multiselect=go;exports.Navbar=uo;exports.NotesField=Xr;exports.OfferCard=Nt;exports.OfferCardEmpty=Ea;exports.OfferCardError=Fa;exports.OfferCardList=Ta;exports.OfferCardSkeleton=La;exports.OtherTenderForm=Mr;exports.PageHeader=cr;exports.PaginationSummary=Er;exports.PaymentCashChangeBanner=Wn;exports.PaymentSubAmountInput=mt;exports.PaymentSuccessView=Pr;exports.PaymentTotalBanner=qn;exports.PickerRow=$r;exports.RICH_TEXT_PRESETS=ka;exports.ReasonSelect=Zr;exports.RedeemCodeInput=io;exports.RefundCompleteView=si;exports.RefundItemList=Kr;exports.RefundTotalBar=Qr;exports.RevenueDistributionCard=Ya;exports.RevenueDistributionEmpty=Ka;exports.RevenueDistributionError=Ga;exports.RevenueDistributionSkeleton=Qa;exports.RichTextArea=Aa;exports.RowActions=Ar;exports.Select=Ie;exports.SessionTimeline=or;exports.SplitPaymentSummary=Ir;exports.SplitRefundPanel=ti;exports.StatusChip=dr;exports.Stepper=kn;exports.SuccessState=ar;exports.Summary=Wr;exports.SupervisorPinField=ni;exports.TableSkeleton=ur;exports.TicketSelection=Rd;exports.TileSelect=Hn;exports.Toggle=rr;exports.UnderlineTabs=yr;exports.WizardShell=Yr;exports.adminFieldErrorClass=Sr;exports.adminFieldHintClass=Cr;exports.adminFieldLabelClass=vr;exports.adminInputClass=wr;exports.adminInputReadOnlyClass=Nr;exports.adminInputWrapperClass=jr;exports.adminRowClass=hr;exports.adminSurfaceCss=Ii;exports.adminSurfaceTokens=xn;exports.adminTableClass=xr;exports.adminTableFooterClass=pr;exports.adminTdClass=mr;exports.adminThClass=fr;exports.calculateAllocationDifference=Sc;exports.computeChange=ln;exports.currencyFractionDigits=An;exports.formatMoney=we;exports.formatOfferCurrency=cn;exports.formatRevenueAmount=jc;exports.formatRevenueCurrency=wc;exports.generateAutomaticInstallments=Ja;exports.generateDistributionId=Tn;exports.getCurrencySymbol=Nc;exports.offerCardVariants=Ia;exports.offerListVariants=Ma;exports.pageRange=Dr;exports.parseOfferCurrency=Ko;exports.parseRevenueCurrency=Cc;exports.roundToCurrency=Na;Object.keys(d).forEach(e=>{e!=="default"&&!Object.prototype.hasOwnProperty.call(exports,e)&&Object.defineProperty(exports,e,{enumerable:!0,get:()=>d[e]})});
|
|
41
|
+
`,Un=x.forwardRef(({children:e,relativeOverlayRoot:t=!0,className:s,style:a,"data-testid":r="modal-shell"},i)=>n.jsxs(n.Fragment,{children:[n.jsx("style",{children:fu}),n.jsx("div",{ref:i,"data-testid":r,style:a,className:d.cn("flex flex-col gap-4 p-4 rounded-3xl bg-white shadow-xl","md:gap-5 md:p-6",t&&"relative","motion-safe:animate-[pp-modal-in_220ms_ease-out]","motion-safe:transition-[min-height] motion-safe:duration-[420ms] motion-safe:ease-in-out",s),children:e})]}));Un.displayName="ModalShell";const Hn=({title:e,onClose:t,closeLabel:s="Close",actions:a,className:r,"data-testid":i="modal-shell-header"})=>n.jsxs("header",{className:d.cn("flex items-center justify-between",r),"data-testid":i,children:[n.jsx("h2",{className:"text-xl font-semibold","data-testid":`${i}-title`,children:e}),n.jsxs("div",{className:"flex items-center gap-2",children:[a,t&&n.jsx(R,{isIconOnly:!0,variant:"light",radius:"full",size:"sm",onPress:t,"aria-label":s,"data-testid":`${i}-close`,children:n.jsx(V,{icon:"lucide:x",width:20,height:20,"aria-hidden":"true"})})]})]});Hn.displayName="ModalShellHeader";const qn=({children:e,columns:t=2,className:s,"data-testid":a="modal-shell-footer"})=>n.jsx("footer",{className:d.cn("mt-2 gap-3",t===2?"flex flex-col md:grid md:grid-cols-2 [&>*]:w-full [&>*:first-child]:md:order-2 [&>*:nth-child(2)]:md:order-1":"grid grid-cols-1",s),"data-testid":a,children:e});qn.displayName="ModalShellFooter";const mu={2:"sm:grid-cols-2",3:"sm:grid-cols-3",4:"sm:grid-cols-4"},hu={1:"grid-cols-1",2:"grid-cols-2"},Jt=e=>typeof e=="string"?n.jsx(V,{icon:e,width:20,height:20,"aria-hidden":"true"}):e,Wn=({options:e,selectedKey:t,onSelect:s,heading:a,ariaLabel:r="Select an option",columnsDesktop:i=3,columnsMobile:o=2,className:l,"data-testid":c="tile-select"})=>{const u=e.find(f=>f.key===t);return n.jsxs("div",{className:d.cn("flex flex-col gap-3",l),"data-testid":c,children:[a&&n.jsx("h3",{className:"text-sm font-medium text-default-700",id:`${c}-heading`,children:a}),n.jsx("div",{className:"md:hidden",children:n.jsx(Ie,{"aria-label":a?void 0:r,"aria-labelledby":a?`${c}-heading`:void 0,selectedKeys:t?[t]:[],onSelectionChange:f=>{const g=Array.from(f)[0];typeof g=="string"&&s(g)},placeholder:r,variant:"bordered",radius:"lg","data-testid":`${c}-mobile-select`,startContent:u?n.jsx("span",{"aria-hidden":"true",className:"shrink-0",children:Jt(u.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(f=>n.jsx(d.SelectItem,{isDisabled:f.isDisabled,startContent:n.jsx("span",{"aria-hidden":"true",className:"shrink-0",children:Jt(f.icon)}),"data-testid":f["data-testid"]??`${c}-${f.key}-mobile`,children:f.label},f.key))})}),n.jsx("div",{role:"group","aria-labelledby":a?`${c}-heading`:void 0,"aria-label":a?void 0:r,className:d.cn("hidden md:grid gap-3",hu[o],mu[i]),children:e.map(f=>{const h=t===f.key;return n.jsxs(R,{variant:"bordered",radius:"lg","aria-pressed":h,"aria-label":f.label,isDisabled:f.isDisabled,onPress:()=>s(f.key),"data-testid":f["data-testid"]??`${c}-${f.key}`,className:d.cn("flex flex-col items-center justify-center gap-2 h-auto min-h-[80px] px-4 py-4","border bg-transparent transition-colors",h?"border-primary bg-primary-50 text-primary":"border-default-200 text-default-800 hover:bg-default-50"),children:[n.jsx("span",{"aria-hidden":"true",children:Jt(f.icon)}),n.jsx("span",{className:"text-sm font-medium",children:f.label})]},f.key)})})]})};Wn.displayName="TileSelect";const xu={subtle:{wrapper:"bg-default-100",amount:"text-default-900"},success:{wrapper:"bg-success-50 text-success-700",amount:"text-success-700"}},Yn=({total:e,label:t,locale:s="en-US",variant:a="subtle",className:r,"data-testid":i="payment-total-banner"})=>{const o=xu[a];return n.jsxs("div",{"data-testid":i,className:d.cn("rounded-2xl px-6 py-5 text-center",o.wrapper,r),children:[n.jsx("div",{className:"text-sm text-default-600",children:t}),n.jsx("div",{className:d.cn("mt-1 text-4xl font-bold tracking-tight",o.amount),"data-testid":`${i}-amount`,children:we(e.value,s,e.currency)})]})};Yn.displayName="PaymentTotalBanner";const pu={white:"bg-white/70 backdrop-blur-sm",transparent:"bg-transparent"},_r=({title:e,subtitle:t,backdrop:s="white",exiting:a=!1,className:r,"data-testid":i="loading-overlay"})=>n.jsxs("div",{role:"status","aria-live":a?"off":"polite","aria-hidden":a||void 0,"data-testid":i,"data-state":a?"exiting":"visible",className:d.cn("absolute inset-0 z-10 flex flex-col items-center justify-center gap-4 rounded-3xl",pu[s],a?"pointer-events-none motion-safe:animate-[pp-fade-out_280ms_ease-in_forwards]":"motion-safe:animate-[pp-fade-in_150ms_ease-out]",r),children:[n.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]"}),n.jsxs("div",{className:"text-center",children:[n.jsx("div",{className:"text-xl font-semibold","data-testid":`${i}-title`,children:e}),t&&n.jsx("div",{className:"mt-1 text-sm text-default-600",children:t})]})]});_r.displayName="LoadingOverlay";const Kn=({cashChange:e,label:t="Cash to return",secondaryLine:s,locale:a="en-US",onDismiss:r,dismissAriaLabel:i="Dismiss",align:o="left",className:l,"data-testid":c="payment-cash-change-banner"})=>{if(!e||e.value<=0)return null;const u=o==="center";return n.jsxs("div",{role:"status","aria-live":"polite","data-testid":c,className:d.cn("flex w-full items-center gap-3 rounded-2xl border border-info-200 bg-info-50 px-5 py-4",u?"justify-center text-center":"text-left","motion-safe:animate-[pp-slide-down_200ms_ease-out]",l),children:[n.jsx(V,{icon:"lucide:info",width:28,height:28,className:"shrink-0 text-info-700","aria-hidden":"true"}),n.jsxs("div",{className:d.cn("flex flex-col",u?"items-center":"flex-1"),children:[n.jsx("span",{className:"text-xs font-medium uppercase tracking-wider text-info-700",children:t}),n.jsx("span",{className:"text-2xl font-bold text-info-700","data-testid":`${c}-amount`,children:we(e.value,a,e.currency)}),s&&n.jsx("span",{className:"mt-0.5 text-xs text-info-700/80",children:s})]}),r&&n.jsx(R,{isIconOnly:!0,variant:"light",radius:"full",size:"sm",onPress:r,"aria-label":i,"data-testid":`${c}-dismiss`,className:"shrink-0 text-info-700 hover:bg-info-100",children:n.jsx(V,{icon:"lucide:x",width:18,height:18,"aria-hidden":"true"})})]})};Kn.displayName="PaymentCashChangeBanner";const Or=({title:e,subtitle:t,emailLine:s,confirmationEmail:a,cashChange:r,cashChangeLabel:i="Cash to return",locale:o="en-US",closeLabel:l="Close",onClose:c,className:u,"data-testid":f="payment-success-view"})=>{const h=!!(r&&r.value>0);return n.jsxs("div",{"data-testid":f,className:d.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:[n.jsx("div",{"aria-hidden":"true",className:"flex items-center justify-center rounded-full bg-[#A2D9C6] p-[10px]",children:n.jsx(V,{icon:"gravity-ui:circle-check-fill",width:76,height:76,className:"text-[#10B981]","aria-hidden":"true"})}),n.jsxs("div",{className:"space-y-3",children:[n.jsx("h2",{className:"text-2xl font-bold","data-testid":`${f}-title`,children:e}),n.jsx("p",{className:"text-default-700",children:t}),s&&a&&n.jsxs("p",{className:"text-default-700",children:[s,n.jsx("br",{}),n.jsx("strong",{className:"font-semibold",children:a})]})]}),h&&r&&n.jsx(Kn,{cashChange:r,label:i,locale:o,align:"center",className:"max-w-[400px]","data-testid":`${f}-cash-change`}),c&&n.jsx(R,{color:"default",variant:"bordered",radius:"full",size:"lg",onPress:c,"data-testid":`${f}-close`,className:"mt-4 w-full",children:l})]})};Or.displayName="PaymentSuccessView";const mt=({heading:e,amountLabel:t,value:s,defaultValue:a,onChange:r,placeholder:i,isDisabled:o,isInvalid:l,errorMessage:c,autoFocus:u,maxAmount:f,hideHeading:h=!1,className:g,"data-testid":m="payment-sub-amount-input"})=>{const v=`${m}-input`,j=x.useCallback(w=>{if(f!==void 0){const y=Number.parseFloat(w.replace(",","."));if(Number.isFinite(y)&&y>f)return}r?.(w)},[f,r]),b=x.useCallback(w=>{const y=w.currentTarget;requestAnimationFrame(()=>{y.isConnected&&y.select()})},[]);return n.jsxs("div",{className:d.cn("flex flex-col gap-3 border-t border-default-100 pt-5",g),"data-testid":m,children:[n.jsx("h3",{className:d.cn("text-lg font-semibold",h&&"sr-only"),"data-testid":`${m}-heading`,children:e}),n.jsx(d.Input,{id:v,label:t,labelPlacement:"outside",classNames:h?{label:"sr-only"}:void 0,type:"text",inputMode:"decimal",pattern:"[0-9]*[.,]?[0-9]*",value:s,defaultValue:a,onChange:w=>j(w.target.value),onFocus:b,placeholder:i,isDisabled:o,isInvalid:l,errorMessage:l?c:void 0,variant:"bordered",radius:"lg","aria-invalid":l||void 0,autoFocus:u,"data-testid":`${m}-field`})]})};mt.displayName="PaymentSubAmountInput";const gu={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"}},bu=e=>typeof e=="string"?n.jsx(V,{icon:e,className:"size-5","aria-hidden":"true"}):e,Rr=({isOpen:e,title:t,confirmLabel:s,onConfirm:a,onOpenChange:r,children:i,description:o,cancelLabel:l="Cancel",variant:c="danger",isPending:u=!1,isDismissable:f,isKeyboardDismissDisabled:h=!1,hideIcon:g=!1,icon:m,"data-testid":v="confirm-dialog"})=>{const j=i??o??null,b=gu[c],w=g?null:bu(m??b.icon);return n.jsx(d.Modal,{isOpen:e,onOpenChange:y=>r?.(y),placement:"center",size:"md",isDismissable:(f??!0)&&!u,isKeyboardDismissDisabled:h||u,hideCloseButton:u,className:"gap-4 p-6",classNames:{base:"rounded-3xl"},"data-testid":v,children:n.jsxs(d.ModalContent,{role:"alertdialog",children:[n.jsxs(d.ModalHeader,{className:"flex flex-col items-center gap-3 p-0 text-center",children:[w?n.jsx("div",{"aria-hidden":"true","data-testid":`${v}-icon`,className:d.cn("flex size-10 items-center justify-center rounded-full",b.tile),children:w}):null,n.jsx("span",{"data-testid":`${v}-title`,className:"text-lg font-semibold text-zinc-950",children:t})]}),j!==null?n.jsx(d.ModalBody,{"data-testid":`${v}-body`,className:"gap-0 p-0",children:typeof j=="string"?n.jsx("p",{className:"mx-auto max-w-sm text-center text-sm text-gray-600",children:j}):j}):null,n.jsxs(d.ModalFooter,{className:"flex flex-col-reverse gap-2 p-0 sm:flex-row sm:gap-3",children:[n.jsx(R,{variant:"bordered",color:"default",radius:"full",onPress:()=>r?.(!1),isDisabled:u,"data-testid":`${v}-dismiss`,className:"w-full sm:flex-1",children:l}),n.jsx(R,{color:b.confirmColor,variant:"solid",radius:"full",onPress:a,isLoading:u,"data-testid":`${v}-confirm`,className:"w-full sm:flex-1",children:s})]})]})})};Rr.displayName="ConfirmDialog";const yu=60,vu=(e,t,s=yu)=>t?e>s:e<-s,zr=(e,t)=>Math.max(0,Math.min(e,t)),ju=160,wu=(e,t,s=ju)=>Math.min(e,Math.max(0,t-s)),Nu=(e,t,s)=>zr(e-t,s),Cu=(e,t,s)=>e!==null?zr(e,s):t?s:0,Su=e=>e?"":"transition-[height] duration-300 ease-out",ku=e=>({onDrag:(t,s)=>{const a=e.open?e.fullHeight:0;e.setDragHeight(Nu(a,s?.offset?.y??0,e.fullHeight))},onDragEnd:(t,s)=>{vu(s?.offset?.y??0,e.open)&&e.onToggleOpen?.(),e.setDragHeight(null)}}),Ye=(e,t)=>we(e.value,t,e.currency),Gn=({item:e,locale:t,onRemove:s,removeAriaLabel:a,showRemoveButton:r=!0})=>{const i=!!e.children&&e.children.length>0,o=!!s&&r;return n.jsxs("div",{"data-testid":`summary-item-${e.id}`,className:"flex flex-col gap-2",children:[n.jsxs("div",{className:"flex min-h-9 items-center justify-between gap-2",children:[n.jsxs("div",{className:"flex min-w-0 items-center gap-2 text-base text-foreground",children:[typeof e.quantity=="number"&&n.jsxs("span",{"data-testid":`summary-item-qty-${e.id}`,className:"shrink-0",children:[e.quantity," x"]}),e.leadingIcon,n.jsx("span",{"data-testid":`summary-item-name-${e.id}`,className:d.cn("truncate",e.emphasis&&"font-medium"),children:e.name})]}),n.jsxs("div",{className:"flex shrink-0 items-center",children:[e.amount&&n.jsx("span",{"data-testid":`summary-item-amount-${e.id}`,className:"whitespace-nowrap text-base text-foreground",children:Ye(e.amount,t)}),o&&n.jsx(R,{isIconOnly:!0,size:"sm",variant:"light",radius:"full",className:"ml-1 size-8 min-w-8 p-2 text-danger","aria-label":a,"data-testid":`summary-remove-${e.id}`,onPress:()=>s(e.id),children:n.jsx(V,{icon:"lucide:trash-2",width:16,height:16,className:"text-danger"})})]})]}),e.dateLabel&&n.jsxs("div",{"data-testid":`summary-item-date-${e.id}`,className:"flex items-center gap-2 text-sm text-default-500",children:[n.jsx(V,{icon:"lucide:calendar",width:16,height:16,className:"shrink-0"}),n.jsx("span",{className:"truncate",children:e.dateLabel})]}),e.dateRange&&n.jsxs("div",{"data-testid":`summary-item-daterange-${e.id}`,className:"flex items-center gap-2 text-sm text-default-500",children:[n.jsx(V,{icon:"lucide:calendar",width:16,height:16,className:"shrink-0"}),n.jsx("span",{children:e.dateRange.from}),n.jsx(V,{icon:"lucide:arrow-right",width:16,height:16,className:"shrink-0"}),n.jsx("span",{children:e.dateRange.to})]}),e.details?.map((l,c)=>n.jsxs("div",{"data-testid":`summary-item-detail-${e.id}-${l.key??c}`,className:"flex items-center justify-between gap-2 text-sm text-default-500",children:[n.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[l.icon,n.jsx("span",{className:"truncate",children:l.label})]}),(l.value!=null||l.tooltip!=null)&&n.jsxs("div",{className:"flex shrink-0 items-center gap-1",children:[l.value!=null&&n.jsx("span",{className:d.cn("whitespace-nowrap",l.valueTone==="primary"&&"font-medium text-primary"),children:l.value}),l.tooltip!=null&&n.jsx(d.Tooltip,{content:l.tooltip,children:n.jsx("span",{"data-testid":`summary-item-detail-tooltip-${e.id}-${l.key??c}`,className:"flex shrink-0 items-center",children:n.jsx(V,{icon:"lucide:info",width:16,height:16,className:d.cn(l.valueTone==="primary"?"text-primary":"text-default-400")})})})]})]},l.key??c)),i&&n.jsx("div",{"data-testid":`summary-children-${e.id}`,className:"flex flex-col gap-2 pl-6",children:e.children.map(l=>n.jsx(Gn,{item:l,locale:t,onRemove:s,removeAriaLabel:a,showRemoveButton:r},l.id))})]})};Gn.displayName="SummaryItemRow";const Br=({fee:e,locale:t,className:s})=>n.jsxs("div",{"data-testid":"summary-service-fee",className:d.cn("flex items-center justify-between gap-2",s),children:[n.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:[n.jsx("span",{"aria-hidden":"true",className:d.cn("flex size-4 shrink-0 items-center justify-center rounded-full border",e.isSelected?"border-primary":"border-default-200"),children:e.isSelected&&n.jsx("span",{className:"size-2 rounded-full bg-primary"})}),n.jsx("span",{className:"truncate text-sm font-medium text-foreground",children:e.label})]}),n.jsx("span",{"data-testid":"summary-service-fee-amount",className:"whitespace-nowrap text-base text-foreground",children:Ye(e.amount,t)})]});Br.displayName="SummaryServiceFeeRow";const Qn=({row:e,locale:t,emphasized:s,onRemove:a,removeAriaLabel:r,showRemoveButton:i=!0})=>{const o=!!a&&i&&!!e.id,l=n.jsx("span",{"data-testid":`summary-row-amount-${e.key}`,className:"whitespace-nowrap text-base",children:Ye(e.amount,t)});return n.jsxs("div",{"data-testid":`summary-row-${e.key}`,className:"flex items-center justify-between text-foreground",children:[n.jsx("span",{"data-testid":`summary-row-label-${e.key}`,className:d.cn(s?"text-xl font-semibold leading-7":"text-base"),children:e.label}),o?n.jsxs("div",{className:"flex shrink-0 items-center",children:[l,n.jsx(R,{isIconOnly:!0,size:"sm",variant:"light",radius:"full",className:"ml-1 size-8 min-w-8 p-2 text-danger","aria-label":r,"data-testid":`summary-remove-row-${e.id}`,onPress:()=>a(e.id),children:n.jsx(V,{icon:"lucide:trash-2",width:16,height:16,className:"text-danger"})})]}):l]})};Qn.displayName="SummaryTotalsLineRow";const Vr=({pricesInLabel:e,currency:t,items:s,serviceFee:a,rows:r,locale:i,onRemoveItem:o,removeAriaLabel:l,showRemoveButton:c,emptyState:u,classNames:f})=>{const h=(s?.length??0)>0;return n.jsxs(n.Fragment,{children:[n.jsxs("div",{"data-testid":"summary-prices",className:d.cn("flex items-center justify-between text-xs text-default-500",f.prices),children:[n.jsx("span",{children:e}),t!=null&&n.jsx("span",{children:t})]}),h?n.jsx("div",{className:d.cn("flex flex-col gap-4",f.items),children:s.map(g=>n.jsx(Gn,{item:g,locale:i,onRemove:o,removeAriaLabel:l,showRemoveButton:c},g.id))}):n.jsx("div",{"data-testid":"summary-empty",children:u}),a&&n.jsxs(n.Fragment,{children:[n.jsx(d.Divider,{className:"bg-default-200"}),n.jsx(Br,{fee:a,locale:i,className:f.serviceFee})]}),r&&r.length>0&&n.jsx("div",{className:d.cn("flex flex-col gap-4",f.totalsRows),children:r.map((g,m)=>n.jsx(Qn,{row:g,locale:i,emphasized:m===0},g.key))})]})};Vr.displayName="SummaryBody";const Ur=({total:e,locale:t,className:s})=>n.jsxs("div",{"data-testid":"summary-total",className:d.cn("flex items-center justify-between text-xl font-semibold leading-7 text-foreground",s),children:[n.jsx("span",{children:e.label??"Total"}),n.jsx("span",{"data-testid":"summary-total-amount",className:"whitespace-nowrap text-xl font-semibold leading-7",children:Ye(e.amount,t)})]});Ur.displayName="SummaryGrandTotalRow";const Hr=({secondaryTotal:e,locale:t,className:s})=>n.jsxs("div",{"data-testid":"summary-secondary-total",className:d.cn("flex items-center justify-between text-lg font-semibold leading-7 text-primary",s),children:[n.jsx("span",{children:e.label}),n.jsx("span",{"data-testid":"summary-secondary-total-amount",className:"whitespace-nowrap text-lg font-semibold leading-7",children:Ye(e.amount,t)})]});Hr.displayName="SummarySecondaryTotalRow";const At=({action:e,disabledByLoading:t,className:s,testId:a="summary-cta"})=>n.jsx(R,{color:"primary",radius:"full",className:d.cn("px-[18px] py-[14px] font-medium",s),"data-testid":a,isLoading:e.isLoading,isDisabled:e.isDisabled||t,onPress:e.onPress,endContent:n.jsx(V,{icon:"lucide:arrow-right",width:16,height:16}),children:e.label});At.displayName="SummaryPrimaryCta";const qr=({title:e,total:t,secondaryTotal:s,locale:a,open:r,progress:i,dragging:o,toggleAriaLabel:l,onToggleOpen:c,classNames:u})=>n.jsx("h2",{children:n.jsxs("button",{type:"button","data-testid":"summary-collapse-toggle","aria-expanded":r,"aria-label":l,onClick:c,className:d.cn("-mx-4 -mt-4 grid w-[calc(100%_+_32px)] grid-cols-1 px-4 pb-4 pt-4 text-left",u.header),children:[n.jsxs("span",{"aria-hidden":!r,style:{opacity:i},className:d.cn("col-start-1 row-start-1 flex items-center justify-between",!o&&"transition-opacity duration-300"),children:[n.jsx("span",{"data-testid":"summary-title",className:d.cn("text-xl font-semibold leading-7 text-foreground",u.title),children:e}),n.jsx("span",{"data-testid":"summary-close","aria-hidden":"true",className:d.cn("shrink-0 text-foreground",u.closeButton),children:n.jsx(V,{icon:"lucide:x",width:20,height:20})})]}),n.jsxs("span",{"aria-hidden":r,style:{opacity:1-i},className:d.cn("col-start-1 row-start-1 flex flex-col gap-2",!o&&"transition-opacity duration-300"),children:[n.jsxs("span",{className:"flex items-center justify-between text-xl font-semibold leading-7 text-foreground",children:[n.jsx("span",{children:t.label??"Total"}),n.jsx("span",{className:"whitespace-nowrap",children:Ye(t.amount,a)})]}),s&&n.jsxs("span",{className:"flex items-center justify-between text-lg font-semibold leading-7 text-primary",children:[n.jsx("span",{children:s.label}),n.jsx("span",{className:"whitespace-nowrap",children:Ye(s.amount,a)})]})]})]})});qr.displayName="SummaryCollapseHeader";const Wr=({cart:e,ariaLabel:t,onPress:s,className:a})=>n.jsxs("button",{type:"button","data-testid":"summary-cart","aria-label":t,onClick:s,className:d.cn("relative flex size-[52px] shrink-0 items-center justify-center rounded-full border border-default-200 bg-content1",a),children:[n.jsx(V,{icon:"lucide:shopping-bag",width:24,height:24,className:"text-foreground"}),e.count!=null&&n.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})]});Wr.displayName="SummaryCartButton";const Yr=({open:e,progress:t,dragging:s,primaryAction:a,isLoading:r,cart:i,cartAriaLabel:o,ctaCaption:l,onToggleOpen:c,classNames:u})=>n.jsxs("div",{"data-testid":"summary-mobile-bar",className:d.cn("flex flex-col gap-4",u.mobileBar),children:[n.jsx(d.Divider,{className:"bg-default-200"}),n.jsxs("div",{className:"grid",children:[n.jsxs("div",{"aria-hidden":e,style:{opacity:1-t},className:d.cn("col-start-1 row-start-1 flex items-stretch gap-2.5",e&&"pointer-events-none",!s&&"transition-opacity duration-300"),children:[i&&n.jsx(Wr,{cart:i,ariaLabel:o,className:u.cart,onPress:()=>{c?.(),i.onPress?.()}}),a&&n.jsx(At,{action:a,disabledByLoading:r,className:d.cn("h-[52px] flex-1",u.cta),testId:"summary-cta-compact"})]}),a&&n.jsx("div",{"aria-hidden":!e,style:{opacity:t},className:d.cn("col-start-1 row-start-1 flex",!e&&"pointer-events-none",!s&&"transition-opacity duration-300"),children:n.jsx(At,{action:a,disabledByLoading:r,className:d.cn("h-[52px] w-full",u.cta)})})]}),l&&n.jsx("div",{children:l})]});Yr.displayName="SummaryActionBar";const Au="(max-width: 767px)",$u=e=>typeof window<"u"&&typeof window.matchMedia=="function"?window.matchMedia(e).matches:!1,Du=(e=Au)=>{const[t,s]=x.useState(()=>$u(e));return x.useEffect(()=>{if(typeof window>"u"||typeof window.matchMedia!="function")return;const a=window.matchMedia(e),r=()=>s(a.matches);return r(),a.addEventListener("change",r),()=>a.removeEventListener("change",r)},[e]),t},Kr=({title:e="Summary",pricesInLabel:t="Prices are in",currency:s,locale:a="en-US",items:r,serviceFee:i,rows:o,total:l,postTotalRows:c,onRemovePostTotalRow:u,secondaryTotal:f,collapsible:h,isOpen:g,onToggleOpen:m,defaultOpen:v=!1,primaryAction:j,isLoading:b=!1,onRemoveItem:w,showRemoveButton:y,ctaCaption:k,variant:N,cart:S,emptyState:E,labels:L,classNames:M={},"data-testid":$="summary",className:O})=>{const F=L?.removeAriaLabel??"Remove item",A=L?.removePostTotalRowAriaLabel??"Remove applied code",I=L?.toggleAriaLabel??"Toggle summary",P=L?.cartAriaLabel??"View cart",G=Du(),W=h??(N??(G?"mobile":"main"))==="mobile",[ee,ae]=x.useState(v),re=g!==void 0,U=!W||(re?g:ee),Z=x.useCallback(()=>{re||ae(xe=>!xe),m?.()},[re,m]),[Q,H]=x.useState(0),[X,J]=x.useState(null),Ce=x.useRef(null),be=x.useRef(null),he=x.useCallback(()=>{const xe=Ce.current;xe&&H(wu(xe.scrollHeight,window.innerHeight))},[]),Be=x.useCallback(xe=>{be.current?.disconnect(),be.current=null,Ce.current=xe,xe&&(he(),typeof ResizeObserver<"u"&&(be.current=new ResizeObserver(he),be.current.observe(xe)))},[he]);x.useEffect(()=>(window.addEventListener("resize",he),()=>window.removeEventListener("resize",he)),[he]);const Te=ku({open:U,fullHeight:Q,setDragHeight:J,onToggleOpen:Z}),Pe=X!==null,_e=Cu(X,U,Q),Ve=Q>0?Math.min(1,Math.max(0,_e/Q)):U?1:0,Ee=n.jsx(Ur,{total:l,locale:a,className:M.total}),te=c&&c.length>0&&n.jsx("div",{"data-testid":"summary-post-total-rows",className:"flex flex-col gap-4",children:c.map(xe=>n.jsx(Qn,{row:xe,locale:a,emphasized:!1,onRemove:u,removeAriaLabel:A,showRemoveButton:y},xe.key))}),me=f&&n.jsx(Hr,{secondaryTotal:f,locale:a,className:M.secondaryTotal}),Fe=k!=null&&n.jsx("p",{"data-testid":"summary-cta-caption",className:d.cn("text-center text-sm text-default-500",M.ctaCaption),children:k}),ht=n.jsx(Vr,{pricesInLabel:t,currency:s,items:r,serviceFee:i,rows:o,locale:a,onRemoveItem:w,removeAriaLabel:F,showRemoveButton:y,emptyState:E,classNames:M});return W?n.jsxs(Ae.motion.section,{"data-testid":$,drag:"y",dragConstraints:{top:0,bottom:0},dragElastic:.12,dragSnapToOrigin:!0,onDrag:Te.onDrag,onDragEnd:Te.onDragEnd,className:d.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)]",O,M.base),children:[n.jsx(qr,{title:e,total:l,secondaryTotal:f,locale:a,open:U,progress:Ve,dragging:Pe,toggleAriaLabel:I,onToggleOpen:Z,classNames:M}),n.jsx("div",{"data-testid":"summary-reveal","aria-hidden":!U,style:{height:_e},className:d.cn("min-h-0",U&&!Pe?"overflow-y-auto overscroll-contain [scrollbar-width:none] [&::-webkit-scrollbar]:hidden":"overflow-hidden",!U&&"pointer-events-none",Su(Pe)),children:n.jsxs("div",{ref:Be,className:"flex flex-col gap-4 pb-4",children:[ht,n.jsx(d.Divider,{className:"bg-default-200"}),Ee,te,me]})}),n.jsx(Yr,{open:U,progress:Ve,dragging:Pe,primaryAction:j,isLoading:b,cart:S,cartAriaLabel:P,ctaCaption:Fe,onToggleOpen:Z,classNames:M})]}):n.jsxs("section",{"data-testid":$,className:d.cn("flex w-full flex-col gap-4 rounded-2xl border border-default-200 bg-content1 p-4",O,M.base),children:[n.jsx("div",{className:d.cn("flex items-center justify-between",M.header),children:n.jsx("h2",{"data-testid":"summary-title",className:d.cn("text-xl font-semibold leading-7 text-foreground",M.title),children:e})}),ht,n.jsx(d.Divider,{className:"bg-default-200"}),Ee,te,me,f&&j&&n.jsx(d.Divider,{className:"bg-default-200"}),j&&n.jsx(At,{action:j,disabledByLoading:b,className:d.cn("w-full",M.cta)}),Fe]})};Kr.displayName="Summary";const Eu={back:"Back",close:"Close"},Gr=({onClose:e,steps:t,activeStepId:s,onBack:a,primaryAction:r,footerSummary:i,labels:o,className:l,"data-testid":c="wizard-shell",children:u})=>{const f={...Eu,...o},h=t.filter(v=>v.state!=="skipped"),g=t.find(v=>v.id===s),m=Math.max(0,h.findIndex(v=>v.id===s));return n.jsxs(Un,{className:l,"data-testid":c,children:[n.jsx(Hn,{title:g?.label??"",onClose:e,closeLabel:f.close,"data-testid":`${c}-header`}),n.jsx("div",{"data-testid":`${c}-stepper`,children:n.jsx(kn,{stepsCount:h.length,currentStep:m,isDisabled:!0})}),u,i,n.jsxs(qn,{columns:a?2:1,"data-testid":`${c}-footer`,children:[a&&n.jsx(R,{variant:"light",onPress:a,"data-testid":`${c}-back`,startContent:n.jsx(V,{icon:"lucide:arrow-left",width:18,height:18,"aria-hidden":"true"}),children:f.back}),n.jsx(R,{color:"primary",isLoading:r.loading,isDisabled:r.disabled,onPress:r.onClick,"data-testid":`${c}-primary`,children:r.label})]})]})};Gr.displayName="WizardShell";const Fu={refunded:"Refunded",ineligible:"Ineligible",partialLink:"Refund partial $ of this line",partialOf:"of {amount}",partialCancel:"Cancel",restockTitle:"Restock this item",restockHint:"Returns to current location."},Qr=({items:e,selections:t,onSelectionChange:s,onRestockToggle:a,labels:r,className:i,"data-testid":o="refund-item-list"})=>{const l={...Fu,...r};return n.jsx("div",{className:d.cn("flex flex-col",i),"data-testid":o,children:e.map(c=>{const u=t[c.id],f=!!u?.selected,h=u?.mode??"full",g=c.state==="already_refunded"||c.state==="non_refundable",m=`${o}-row-${c.id}`,v=we(c.paidAmount.value,void 0,c.paidAmount.currency);return n.jsx("div",{className:d.cn("mb-2 rounded-xl border border-default-200 p-3",f&&"border-primary bg-primary-50"),"data-testid":m,children:n.jsxs("div",{className:"flex items-start gap-3",children:[g?n.jsx(d.Chip,{size:"sm",radius:"full",variant:"flat",color:c.state==="already_refunded"?"default":"warning","data-testid":`${m}-blocked`,children:c.state==="already_refunded"?l.refunded:l.ineligible}):n.jsx(d.Checkbox,{isSelected:f,onValueChange:j=>s(c.id,{selected:j,mode:"full"}),"aria-label":c.name,"data-testid":`${m}-checkbox`}),n.jsxs("div",{className:"min-w-0 flex-1",children:[n.jsxs("div",{className:"flex items-center justify-between gap-2",children:[n.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[n.jsx("span",{className:"truncate text-sm font-semibold",children:c.name}),n.jsxs("span",{className:"text-sm text-default-500",children:["×",c.quantity]})]}),n.jsx("span",{className:"shrink-0 text-sm font-semibold",children:v})]}),c.warning&&n.jsx(d.Chip,{size:"sm",radius:"full",variant:"flat",color:"warning",className:"mt-2",startContent:n.jsx(V,{icon:"gravity-ui:triangle-exclamation-fill",width:14,height:14,"aria-hidden":"true"}),"data-testid":`${m}-warning`,children:c.warning}),!g&&f&&h==="full"&&n.jsx(R,{variant:"light",size:"sm",className:"mt-2 h-auto min-w-0 px-1 py-0.5 text-xs font-semibold text-primary",onPress:()=>s(c.id,{selected:!0,mode:"partial"}),"data-testid":`${m}-partial-link`,children:l.partialLink}),!g&&f&&h==="partial"&&n.jsxs("div",{className:"mt-2 flex items-center gap-2","data-testid":`${m}-partial`,children:[n.jsx(mt,{heading:c.name,amountLabel:l.partialLink,hideHeading:!0,maxAmount:c.paidAmount.value,value:u?.partialAmount!==void 0?String(u.partialAmount):void 0,onChange:j=>{const b=Number.parseFloat(j.replace(",","."));s(c.id,{selected:!0,mode:"partial",partialAmount:Number.isFinite(b)?b:void 0})},className:"max-w-[140px] border-t-0 pt-0","data-testid":`${m}-partial-input`}),n.jsx("span",{className:"text-xs text-default-500",children:l.partialOf.replace("{amount}",v)}),n.jsx(R,{variant:"light",size:"sm",className:"h-auto min-w-0 px-1 py-0.5 text-xs font-semibold text-primary",onPress:()=>s(c.id,{selected:!0,mode:"full"}),"data-testid":`${m}-partial-cancel`,children:l.partialCancel})]}),!g&&f&&c.restock.available&&n.jsxs("div",{className:"mt-2 flex items-center gap-3 border-t border-dashed border-default-200 pt-2",children:[n.jsx(V,{icon:"lucide:rotate-ccw",width:18,height:18,className:"shrink-0 text-default-500","aria-hidden":"true"}),n.jsxs("div",{className:"min-w-0 flex-1",children:[n.jsx("p",{className:"text-xs font-semibold",children:l.restockTitle}),n.jsx("p",{className:"text-xs text-default-500",children:l.restockHint})]}),n.jsx(d.Switch,{isSelected:c.restock.on,onValueChange:j=>a(c.id,j),"data-testid":`${m}-restock`})]}),!g&&f&&!c.restock.available&&c.restock.unavailableHint&&n.jsx("p",{className:"mt-2 text-xs text-default-500",children:c.restock.unavailableHint})]})]})},c.id)})})};Qr.displayName="RefundItemList";const Lu={amountLabel:"Refund amount",descriptionLabel:"Add a note",maxHint:"of {amount}"},Zr=({amount:e,description:t,max:s,error:a,onChange:r,labels:i,className:o,"data-testid":l="custom-amount-field"})=>{const c={...Lu,...i},u=c.maxHint.replace("{amount}",we(s.value,void 0,s.currency)),f=x.useCallback(g=>{const m=Number.parseFloat(g.replace(",","."));r({amount:Number.isFinite(m)?m:null,description:t})},[t,r]),h=x.useCallback(g=>{r({amount:e,description:g})},[e,r]);return n.jsxs("div",{className:d.cn("flex flex-col gap-3",o),"data-testid":l,children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(mt,{heading:c.amountLabel,amountLabel:c.amountLabel,hideHeading:!0,value:e!==null?String(e):"",placeholder:"$0.00",maxAmount:s.value,isInvalid:!!a,errorMessage:a,onChange:f,className:"max-w-[160px] border-t-0 pt-0","data-testid":`${l}-amount`}),n.jsx("span",{className:"text-xs text-default-500",children:u})]}),n.jsx(d.Input,{label:c.descriptionLabel,labelPlacement:"outside",variant:"bordered",radius:"lg",value:t,onChange:g=>h(g.target.value),"data-testid":`${l}-description`})]})};Zr.displayName="CustomAmountField";const Mu={title:"Refund total",partialBadge:"Partial refund"},Xr=({total:e,isPartial:t,labels:s,className:a,"data-testid":r="refund-total-bar"})=>{const i={...Mu,...s};return n.jsxs("div",{className:d.cn("flex flex-col items-center gap-2",a),"data-testid":r,children:[n.jsx(Yn,{total:e,label:i.title,variant:"subtle",className:"w-full","data-testid":`${r}-banner`}),t&&n.jsx(d.Chip,{color:"warning",size:"sm",radius:"full",variant:"flat","data-testid":`${r}-partial`,children:i.partialBadge})]})};Xr.displayName="RefundTotalBar";const Iu={label:"Reason",placeholder:"Select a reason"},Jr=({options:e,value:t,onChange:s,error:a,labels:r,className:i,"data-testid":o="reason-select"})=>{const l={...Iu,...r};return n.jsx(Ie,{label:l.label,labelPlacement:"outside",placeholder:l.placeholder,selectedKeys:t?[t]:[],isInvalid:!!a,errorMessage:a,className:d.cn(i),"data-testid":o,onSelectionChange:c=>{if(c==="all")return;const u=[...c][0];u&&s(String(u))},children:e.map(c=>n.jsx(d.SelectItem,{children:c.label},c.id))})};Jr.displayName="ReasonSelect";const Tu={toggle:"Add a note",optionalTag:"(optional)"},ei=({value:e,onChange:t,maxLength:s,labels:a,className:r,"data-testid":i="notes-field"})=>{const o={...Tu,...a},[l,c]=x.useState(e!=="");return n.jsx("div",{className:d.cn(r),"data-testid":i,children:l?n.jsx(d.Textarea,{value:e,onChange:u=>t(u.target.value),maxLength:s,placeholder:o.toggle,"aria-label":o.toggle,variant:"bordered",radius:"lg","data-testid":`${i}-textarea`}):n.jsxs(R,{variant:"light",className:"h-auto min-w-0 px-1 py-0.5 text-xs font-semibold text-primary",onPress:()=>c(!0),"data-testid":`${i}-toggle`,children:[o.toggle,n.jsx("span",{className:"ml-1 font-normal text-default-400",children:o.optionalTag})]})})};ei.displayName="NotesField";const Pu={legend:"Acting as",manager:"Manager",cashier:"Cashier"},_u=["manager","cashier"],ti=({role:e,onChange:t,labels:s,className:a,"data-testid":r="acting-as-toggle"})=>{const i={...Pu,...s},o=`${r}-legend`;return n.jsxs("div",{className:d.cn("flex items-center gap-2",a),"data-testid":r,children:[n.jsx("span",{id:o,className:"text-xs font-semibold text-default-500",children:i.legend}),n.jsx("div",{role:"group","aria-labelledby":o,className:"inline-flex rounded-lg border border-default-200 p-0.5",children:_u.map(l=>{const c=e===l;return n.jsx(R,{variant:"light",color:"default",radius:"md",size:"sm","aria-pressed":c,onPress:()=>t(l),className:d.cn("h-auto min-w-0 px-3 py-1 text-xs",c?"bg-default-100 font-semibold text-foreground":"text-default-500"),"data-testid":`${r}-${l}`,children:i[l]},l)})})]})};ti.displayName="ActingAsToggle";const Ou={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"},Ru={card:"lucide:credit-card",cash:"lucide:dollar-sign",check:"lucide:edit-3",other:"lucide:more-horizontal"},Us="__split__",ni=({tenders:e,selectedTenderId:t,onSelect:s,onSplit:a,error:r,labels:i,className:o,"data-testid":l="money-back-methods"})=>{const c={...Ou,...i},u=x.useMemo(()=>[...e.map(m=>({key:m.tenderId,label:`${m.label} · ${we(m.maxRefundable.value,"en-US",m.maxRefundable.currency)}`,icon:Ru[m.kind],"data-testid":`${l}-tile-${m.tenderId}`})),{key:Us,label:c.split,icon:"lucide:split","data-testid":`${l}-split`}],[e,c.split,l]),f=m=>{if(m===Us){a();return}s(m)},h=r?.kind==="processor_declined"?c.declinedTitle:c.networkTitle,g=r?.kind==="processor_declined"?c.declinedBody:c.networkBody;return n.jsxs("div",{className:d.cn("flex flex-col gap-4",o),"data-testid":l,children:[r&&n.jsx(d.Alert,{color:"danger",title:h,description:g,"data-testid":`${l}-error`,children:n.jsxs("div",{className:"mt-3 flex gap-2",children:[r.onRetry&&n.jsx(R,{color:"primary",size:"sm",onPress:r.onRetry,"data-testid":`${l}-retry`,children:c.retry}),n.jsx(R,{variant:"bordered",size:"sm",onPress:r.onChooseDifferent,"data-testid":`${l}-choose-different`,children:c.chooseDifferent})]})}),n.jsx(Wn,{heading:c.title,options:u,selectedKey:t,onSelect:f,"data-testid":`${l}-tiles`})]})};ni.displayName="MoneyBackMethods";const zu=e=>e.refunded!==null,Bu={title:"Split refund",refundedSoFar:"Refunded so far",remaining:"Remaining",amountForPart:"Amount for this part",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.",retry:"Try again",chooseDifferent:"Choose different method"},si=({parts:e,refundedSoFar:t,remaining:s,current:a,onRefundPart:r,partError:i,onBack:o,busy:l,labels:c,className:u,"data-testid":f="split-refund-panel"})=>{const h={...Bu,...c},g=e.filter(zu),m=e.find(b=>b.tenderId===a.tenderId)?.label,v=x.useCallback(b=>{const w=Number.parseFloat(b.replace(",","."));a.onAmountChange(Number.isFinite(w)?w:0)},[a]),j=i?.kind==="processor_declined"?h.partDeclinedBody:h.partNetworkBody;return n.jsxs("div",{className:d.cn("flex flex-col gap-4",u),"data-testid":f,children:[n.jsx("h3",{className:"text-lg font-semibold","data-testid":`${f}-title`,children:h.title}),i&&n.jsx(d.Alert,{color:"danger",description:j,"data-testid":`${f}-part-error`,children:n.jsxs("div",{className:"mt-3 flex gap-2",children:[i.onRetry&&n.jsx(R,{color:"primary",size:"sm",onPress:i.onRetry,"data-testid":`${f}-retry`,children:h.retry}),n.jsx(R,{variant:"bordered",size:"sm",onPress:i.onChooseDifferent,"data-testid":`${f}-choose-different`,children:h.chooseDifferent})]})}),n.jsxs("div",{className:"flex items-center justify-between rounded-xl bg-default-50 p-3","data-testid":`${f}-totals`,children:[n.jsxs("div",{children:[n.jsx("p",{className:"text-xs text-default-500",children:h.refundedSoFar}),n.jsx("p",{className:"text-sm font-semibold",children:we(t.value,void 0,t.currency)})]}),n.jsxs("div",{className:"text-right",children:[n.jsx("p",{className:"text-xs text-default-500",children:h.remaining}),n.jsx("p",{className:"text-sm font-semibold",children:we(s.value,void 0,s.currency)})]})]}),g.length>0&&n.jsx("div",{className:"flex flex-col gap-2",children:g.map(b=>n.jsxs("div",{className:"flex items-center justify-between rounded-xl border border-default-200 p-3","data-testid":`${f}-part-${b.tenderId}-done`,children:[n.jsx("span",{className:"text-sm font-semibold",children:b.label}),n.jsx(d.Chip,{color:"success",size:"sm",radius:"full",variant:"flat",children:we(b.refunded.value,void 0,b.refunded.currency)})]},b.tenderId))}),n.jsxs("div",{className:"rounded-xl border border-primary bg-primary-50 p-3","data-testid":`${f}-current`,children:[n.jsxs("div",{className:"mb-2 flex items-center justify-between gap-2",children:[n.jsx("span",{className:"text-sm font-semibold","data-testid":`${f}-amount-label`,children:h.amountForPart}),m&&n.jsx("span",{className:"text-xs text-default-500",children:m})]}),n.jsx(mt,{heading:h.amountForPart,amountLabel:h.amountForPart,hideHeading:!0,placeholder:"$0.00",value:String(a.amount),onChange:v,maxAmount:s.value,isDisabled:l,className:"border-t-0 pt-0","data-testid":`${f}-amount`})]}),n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(R,{variant:"light",onPress:o,"data-testid":`${f}-back`,startContent:n.jsx(V,{icon:"lucide:arrow-left",width:18,height:18,"aria-hidden":"true"}),children:h.back}),n.jsx(R,{color:"primary",className:"flex-1",isDisabled:l,isLoading:l,onPress:r,"data-testid":`${f}-submit`,children:h.submit})]})]})};si.displayName="SplitRefundPanel";const Vu={label:"Enter supervisor PIN",placeholder:"••••"},ai=({pin:e,onChange:t,error:s,labels:a,className:r,"data-testid":i="supervisor-pin-field"})=>{const o={...Vu,...a};return n.jsx(d.Input,{type:"password",inputMode:"numeric",label:o.label,labelPlacement:"outside",placeholder:o.placeholder,value:e,onChange:l=>t(l.target.value.replace(/\D/g,"").slice(0,6)),isInvalid:!!s,errorMessage:s,variant:"bordered",radius:"lg",className:d.cn(r),"data-testid":`${i}-input`})};ai.displayName="SupervisorPinField";const Uu={processing:"Processing refund…",title:"Refund complete",destinationsTitle:"Refund destinations",sendReceipt:"Send receipt",email:"Email",print:"Print",done:"Done",pending:"Pending",succeeded:"Refunded"},Hu={succeeded:"success",pending:"warning"},ri=({state:e,destinations:t,onSendReceipt:s,onDone:a,labels:r,className:i,"data-testid":o="refund-complete-view"})=>{const l={...Uu,...r};return e==="processing"?n.jsx("div",{className:d.cn("flex flex-col items-center gap-4 text-center",i),"aria-live":"polite","data-testid":o,children:n.jsxs("div",{className:"flex flex-col items-center gap-4 py-8","data-testid":`${o}-processing`,children:[n.jsx(d.Spinner,{size:"lg",color:"primary"}),n.jsx("p",{className:"text-base font-semibold",children:l.processing})]})}):n.jsxs("div",{className:d.cn("flex flex-col items-center gap-4 text-center",i),"aria-live":"polite","data-testid":o,children:[n.jsx(V,{icon:"solar:check-circle-bold",width:46,height:46,className:"text-success","aria-hidden":"true"}),n.jsx("p",{className:"text-xl font-semibold","data-testid":`${o}-title`,children:l.title}),n.jsxs("div",{className:"w-full text-left",children:[n.jsx("p",{className:"mb-2 text-xs font-semibold uppercase text-default-500",children:l.destinationsTitle}),n.jsx("div",{className:"flex flex-col gap-2",children:t.map((c,u)=>n.jsxs("div",{className:"flex items-center justify-between rounded-xl border border-default-200 p-3","data-testid":`${o}-destination-${u}-${c.status}`,children:[n.jsx("span",{className:"text-sm font-semibold",children:c.label}),n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("span",{className:"text-sm text-default-500",children:we(c.amount.value,void 0,c.amount.currency)}),n.jsx(d.Chip,{color:Hu[c.status],size:"sm",radius:"full",variant:"flat",children:c.status==="succeeded"?l.succeeded:l.pending})]})]},`${c.label}-${u}`))})]}),s&&n.jsxs("div",{className:"w-full text-left",children:[n.jsx("p",{className:"mb-2 text-xs font-semibold uppercase text-default-500",children:l.sendReceipt}),n.jsxs("div",{className:"flex gap-2",children:[n.jsx(R,{variant:"bordered",className:"flex-1",onPress:()=>s("email"),"data-testid":`${o}-receipt-email`,children:l.email}),n.jsx(R,{variant:"bordered",className:"flex-1",onPress:()=>s("print"),"data-testid":`${o}-receipt-print`,children:l.print})]})]}),n.jsx(R,{color:"primary",className:"w-full",onPress:a,"data-testid":`${o}-done`,children:l.done})]})};ri.displayName="RefundCompleteView";exports.ActingAsToggle=ti;exports.AdminFieldLabel=Ar;exports.AdminTable=yr;exports.AdminTextField=$r;exports.AdminToolbar=vr;exports.AppliedCodeCard=sa;exports.Button=R;exports.CashTenderForm=nu;exports.CatalogItemCard=rr;exports.CheckTenderForm=Ir;exports.CommitmentDetails=Uc;exports.ConfirmDialog=Rr;exports.ConfirmationModal=Lt;exports.ConfirmationPageTemplate=ho;exports.CustomAmountField=Zr;exports.DatePicker=Cn;exports.DimensionChip=zn;exports.DonationAmounts=Ea;exports.EmptyState=Pn;exports.ErrorState=_n;exports.EventDetails=Go;exports.EventDetailsTemplate=go;exports.ExpireCartTimer=Fa;exports.FeedbackState=et;exports.FilterPopover=cr;exports.Footer=bo;exports.HeroUIProvider=_i;exports.InstallmentFundAssignment=Oc;exports.InstallmentFundAssignmentSkeleton=Bc;exports.InstallmentSchedule=rd;exports.InstallmentScheduleSkeleton=ud;exports.InstallmentTable=xd;exports.ItemCard=ar;exports.KeyValueChip=zn;exports.ListPanel=Mr;exports.LoadingOverlay=_r;exports.LoadingState=On;exports.MembershipSelectCards=yd;exports.ModalShell=Un;exports.ModalShellFooter=qn;exports.ModalShellHeader=Hn;exports.MoneyBackMethods=ni;exports.Multiselect=yo;exports.Navbar=mo;exports.NotesField=ei;exports.OfferCard=Nt;exports.OfferCardEmpty=La;exports.OfferCardError=Ma;exports.OfferCardList=_a;exports.OfferCardSkeleton=Ia;exports.OtherTenderForm=Tr;exports.PageHeader=ur;exports.PaginationSummary=Lr;exports.PaymentCashChangeBanner=Kn;exports.PaymentSubAmountInput=mt;exports.PaymentSuccessView=Or;exports.PaymentTotalBanner=Yn;exports.PickerRow=Er;exports.RICH_TEXT_PRESETS=$a;exports.ReasonSelect=Jr;exports.RedeemCodeInput=oo;exports.RefundCompleteView=ri;exports.RefundItemList=Qr;exports.RefundTotalBar=Xr;exports.RevenueDistributionCard=Ga;exports.RevenueDistributionEmpty=Qa;exports.RevenueDistributionError=Za;exports.RevenueDistributionSkeleton=Xa;exports.RichTextArea=Da;exports.RowActions=Dr;exports.Select=Ie;exports.SessionTimeline=dr;exports.SplitPaymentSummary=Pr;exports.SplitRefundPanel=si;exports.StatusChip=fr;exports.Stepper=kn;exports.SuccessState=ir;exports.Summary=Kr;exports.SupervisorPinField=ai;exports.TableSkeleton=mr;exports.TicketSelection=Bd;exports.TileSelect=Wn;exports.Toggle=lr;exports.UnderlineTabs=jr;exports.WizardShell=Gr;exports.adminFieldErrorClass=kr;exports.adminFieldHintClass=Sr;exports.adminFieldLabelClass=Bn;exports.adminFieldLabelSuffixClass=Vn;exports.adminInputClass=Nr;exports.adminInputReadOnlyClass=Cr;exports.adminInputWrapperClass=wr;exports.adminRowClass=pr;exports.adminSurfaceCss=Pi;exports.adminSurfaceTokens=xn;exports.adminTableClass=gr;exports.adminTableFooterClass=br;exports.adminTdClass=xr;exports.adminThClass=hr;exports.calculateAllocationDifference=Ac;exports.computeChange=ln;exports.currencyFractionDigits=An;exports.formatMoney=we;exports.formatOfferCurrency=cn;exports.formatRevenueAmount=Nc;exports.formatRevenueCurrency=Cc;exports.generateAutomaticInstallments=tr;exports.generateDistributionId=Tn;exports.getCurrencySymbol=Sc;exports.offerCardVariants=Pa;exports.offerListVariants=Ta;exports.pageRange=Fr;exports.parseOfferCurrency=Qo;exports.parseRevenueCurrency=kc;exports.roundToCurrency=Sa;Object.keys(d).forEach(e=>{e!=="default"&&!Object.prototype.hasOwnProperty.call(exports,e)&&Object.defineProperty(exports,e,{enumerable:!0,get:()=>d[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)}})();
|