@nice2dev/events 1.2.0 → 1.2.1
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/CHANGELOG.md +103 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +5 -5
- package/dist/index.mjs +2760 -2796
- package/package.json +7 -7
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),T=require("@nice2dev/icons"),x=require("@nice2dev/ui"),d=require("react"),Q=require("@nice2dev/ui-core");function Bn(i){return i.map((s,a)=>({item:s,index:a,key:s.order??a})).sort((s,a)=>s.key-a.key||s.index-a.index).map(s=>s.item)}function We(i,s,a){if(s===a)return[...i];if(s<0||s>=i.length)return[...i];if(a<0||a>=i.length)return[...i];const n=[...i],[r]=n.splice(s,1);return n.splice(a,0,r),n}function nn(i){const{items:s,onReorder:a,disabled:n=!1}=i,[r,l]=d.useState(null),[o,m]=d.useState(null),[h,t]=d.useState(!1),u=d.useRef(null),p=d.useCallback(b=>s.findIndex(C=>C.id===b),[s]),N=d.useCallback((b,C)=>{const j=p(b),I=p(C);j<0||I<0||j===I||a==null||a(We([...s],j,I).map(c=>c.id))},[s,p,a]),v=d.useCallback(()=>{l(null),m(null),t(!1),u.current=null},[]),g=d.useCallback((b,C)=>({role:"button",draggable:!1,tabIndex:n?-1:0,"aria-grabbed":r===b,onPointerDown:j=>{var w,B;if(n||j.button!==0&&j.pointerType==="mouse")return;(B=(w=j.currentTarget).setPointerCapture)==null||B.call(w,j.pointerId),l(b),t(!0),u.current=s.map(f=>f.id);const I=()=>{window.removeEventListener("pointerup",I),window.removeEventListener("pointercancel",c),t(!1),l(null),m(null)},c=()=>{window.removeEventListener("pointerup",I),window.removeEventListener("pointercancel",c),u.current&&(a==null||a(u.current)),v()};window.addEventListener("pointerup",I),window.addEventListener("pointercancel",c)},onPointerEnter:()=>{n||!r||r===b||(m(b),N(r,b))},onKeyDown:j=>{if(n)return;if(j.key===" "||j.key==="Enter"){j.preventDefault(),r===b?v():(l(b),u.current=s.map(f=>f.id));return}if(j.key==="Escape"&&r===b){j.preventDefault(),u.current&&(a==null||a(u.current)),v();return}if(r!==b)return;const c=j.key==="ArrowLeft"||j.key==="ArrowUp"?-1:j.key==="ArrowRight"||j.key==="ArrowDown"?1:0;if(c===0)return;j.preventDefault();const w=p(b),B=w+c;B<0||B>=s.length||a==null||a(We([...s],w,B).map(f=>f.id))},...C?{"aria-label":C}:{}}),[r,N,n,v,p,s,a]);return{activeId:r,overId:o,getHandleProps:g,dragging:h}}const $n=({item:i})=>{const[s,a]=d.useState(!1),n=i.thumbnailUrl??i.url;return i.type==="video"?e.jsx("div",{className:"nice-event-media__video-thumb",children:e.jsx(T.NtdPlay,{size:26})}):s||!n?e.jsx("div",{className:"nice-event-media__broken",title:"Image unavailable",children:e.jsx(T.NtdImage,{size:24})}):e.jsx("img",{src:n,alt:i.caption??"",className:"nice-event-media__thumb",loading:"lazy",onError:()=>a(!0)})},Rn=[],En=d.forwardRef(function(s,a){const{items:n=Rn,onUpload:r,onDelete:l,onLike:o,onItemClick:m,layout:h="grid",uploadEnabled:t=!0,typeFilter:u="all",onReorder:p,className:N,style:v}=s,[g,b]=d.useState(""),C=d.useMemo(()=>Bn(n),[n]),j=d.useMemo(()=>u==="all"?C:C.filter(f=>f.type===u),[C,u]),I=!!p&&u==="all",c=nn({items:C,onReorder:p,disabled:!I}),w=f=>{const y=f[0];!y||!r||(r(y,g.trim()||void 0),b(""))},B=h==="list";return e.jsxs("div",{ref:a,className:`nice-event-media nice-event-media--${h} ${N??""}`,style:v,children:[e.jsx("div",{className:"nice-event-media__header",children:e.jsxs("h3",{children:["Media (",j.length,")"]})}),t&&r&&e.jsxs("div",{className:"nice-event-media__upload",children:[e.jsx(x.NiceUpload,{accept:"image/*,video/*",multiple:!1,imagePreview:!1,onFilesSelected:w}),e.jsx(x.NiceTextInput,{value:g,onChange:b,placeholder:"Add a caption…"})]}),j.length===0?e.jsx("p",{className:"nice-event-media__empty",children:"No media yet."}):e.jsx(x.NiceCardGroup,{columns:B?1:void 0,minColumnWidth:200,gap:12,align:"stretch",children:j.map((f,y)=>{const $=I?c.getHandleProps(f.id,`Move ${f.caption??`item ${y+1}`}`):null;return e.jsxs("div",{className:`nice-event-media__card${B?" nice-event-media__card--row":""}${c.activeId===f.id?" nice-event-media__card--dragging":""}`,onClick:()=>m==null?void 0:m(f),onPointerEnter:$==null?void 0:$.onPointerEnter,role:m?"button":void 0,tabIndex:m?0:void 0,children:[$&&e.jsx("span",{className:"nice-event-media__grip",role:$.role,tabIndex:$.tabIndex,"aria-grabbed":$["aria-grabbed"],"aria-label":$["aria-label"],draggable:$.draggable,onPointerDown:$.onPointerDown,onKeyDown:$.onKeyDown,onClick:k=>k.stopPropagation(),children:e.jsx(T.NtdMove,{size:14})}),e.jsx($n,{item:f}),e.jsxs("div",{className:"nice-event-media__body",children:[f.caption&&e.jsx("span",{className:"nice-event-media__caption",children:f.caption}),f.uploadedByName&&e.jsx("span",{className:"nice-event-media__uploader",children:f.uploadedByName}),e.jsxs("div",{className:"nice-event-media__actions",children:[o&&e.jsxs("button",{type:"button",className:"nice-event-media__action",onClick:k=>{k.stopPropagation(),o(f.id)},"aria-label":"Like",children:[e.jsx(T.NtdHeart,{size:15})," ",f.likes??0]}),l&&e.jsx("button",{type:"button",className:"nice-event-media__action nice-event-media__action--danger",onClick:k=>{k.stopPropagation(),l(f.id)},"aria-label":"Delete",children:e.jsx(T.NtdTrash,{size:15})})]})]})]},f.id)})})]})}),me=({title:i,description:s,icon:a,action:n,className:r})=>e.jsx(x.NiceEmpty,{size:"sm",title:i,description:s,icon:a,action:n,className:r}),Ln=[],Dn=d.forwardRef(function(s,a){const{items:n=Ln,layout:r="grid",onReorder:l,onItemAdd:o,onItemRemove:m,onCaptionChange:h,onItemClick:t,previewMode:u=!1,transition:p="fade",defaultDurationMs:N=3e3,autoPlay:v=!0,disabled:g=!1,readOnly:b=!1,size:C="md",className:j,style:I}=s,[c,w]=d.useState(0),[B,f]=d.useState(null),[y,$]=d.useState(""),k=g||b,R=!!l&&!k,F=nn({items:n,onReorder:l,disabled:!R}),L=n.length>0?Math.min(c,n.length-1):0,E=n[L],U=(E==null?void 0:E.durationMs)??N;d.useEffect(()=>{if(!u||!v||n.length<2)return;const P=window.setTimeout(()=>w(W=>(W+1)%n.length),Math.max(250,U));return()=>window.clearTimeout(P)},[u,v,n.length,L,U]);const z=d.useMemo(()=>n.reduce((P,W)=>P+(W.durationMs??N),0),[n,N]),_=P=>{h==null||h(P,y),f(null),$("")};return n.length===0?e.jsx("div",{ref:a,className:`nice-media-collage ${j??""}`,style:I,children:e.jsx(me,{icon:e.jsx(T.NtdImage,{size:28}),title:"Nothing in the collage yet",description:"Add photos or video to start arranging them.",action:o&&!k?e.jsx(x.NiceUpload,{accept:"image/*,video/*",multiple:!0,onFilesSelected:o}):void 0})}):u?e.jsxs("div",{ref:a,className:`nice-media-collage nice-media-collage--preview nice-media-collage--${p} ${j??""}`,style:I,children:[e.jsxs("div",{className:"nice-media-collage__stage","aria-live":"polite",children:[(E==null?void 0:E.type)==="video"?e.jsx("video",{className:"nice-media-collage__slide",src:E.mediaUrl,controls:!0},E.id):e.jsx("img",{className:"nice-media-collage__slide",src:E==null?void 0:E.mediaUrl,alt:(E==null?void 0:E.caption)??""},E==null?void 0:E.id),(E==null?void 0:E.caption)&&e.jsx("p",{className:"nice-media-collage__slide-caption",children:E.caption})]}),e.jsxs("div",{className:"nice-media-collage__playbar",children:[e.jsx(x.NiceButton,{size:"sm",variant:"ghost",onClick:()=>w(P=>(P-1+n.length)%n.length),children:"Previous"}),e.jsxs("span",{className:"nice-media-collage__counter",children:[L+1," / ",n.length]}),e.jsx(x.NiceButton,{size:"sm",variant:"ghost",onClick:()=>w(P=>(P+1)%n.length),children:"Next"})]})]}):e.jsxs("div",{ref:a,className:`nice-media-collage nice-media-collage--${r} nice-media-collage--${C} ${j??""}`,style:I,children:[e.jsxs("div",{className:"nice-media-collage__toolbar",children:[e.jsx(x.NiceSegmentedControl,{size:"sm",value:r,readOnly:!0,options:[{value:"sequence",label:"Sequence"},{value:"grid",label:"Grid"},{value:"mosaic",label:"Mosaic"}]}),e.jsxs("span",{className:"nice-media-collage__duration",children:[n.length," item",n.length===1?"":"s"," · ",Math.round(z/1e3),"s"]}),o&&!k&&e.jsx(x.NiceUpload,{accept:"image/*,video/*",multiple:!0,imagePreview:!1,onFilesSelected:o})]}),e.jsx("ol",{className:"nice-media-collage__tiles","aria-label":"Collage order","aria-busy":F.dragging,children:n.map((P,W)=>{const X=R?F.getHandleProps(P.id,`Move ${P.caption??`item ${W+1}`}`):null;return e.jsxs("li",{className:`nice-media-collage__tile${F.activeId===P.id?" nice-media-collage__tile--active":""}${F.overId===P.id?" nice-media-collage__tile--over":""}`,onPointerEnter:X==null?void 0:X.onPointerEnter,children:[e.jsx("span",{className:"nice-media-collage__index","aria-hidden":"true",children:W+1}),e.jsx("button",{type:"button",className:"nice-media-collage__thumb-button",onClick:()=>t==null?void 0:t(P),disabled:!t,children:P.type==="video"?e.jsx("span",{className:"nice-media-collage__video-thumb",children:e.jsx(T.NtdPlay,{size:22})}):e.jsx("img",{className:"nice-media-collage__thumb",src:P.mediaUrl,alt:P.caption??"",loading:"lazy"})}),B===P.id?e.jsx(x.NiceTextInput,{value:y,onChange:$,placeholder:"Caption",autoFocus:!0,size:"sm",onBlur:()=>_(P.id),onKeyDown:M=>{M.key==="Enter"&&_(P.id),M.key==="Escape"&&f(null)}}):e.jsx("button",{type:"button",className:"nice-media-collage__caption",disabled:!h||k,onClick:()=>{f(P.id),$(P.caption??"")},children:P.caption||e.jsx("em",{children:"Add a caption"})}),e.jsxs("div",{className:"nice-media-collage__tile-actions",children:[X&&e.jsx("span",{className:"nice-media-collage__grip",role:X.role,tabIndex:X.tabIndex,"aria-grabbed":X["aria-grabbed"],"aria-label":X["aria-label"],draggable:X.draggable,onPointerDown:X.onPointerDown,onKeyDown:X.onKeyDown,children:e.jsx(T.NtdMove,{size:14})}),m&&!b&&e.jsx(x.NiceButton,{size:"sm",variant:"ghost",ariaLabel:`Remove ${P.caption??`item ${W+1}`}`,disabled:g,onClick:()=>m(P.id),children:e.jsx(T.NtdTrash,{size:14})})]})]},P.id)})}),o&&!k&&n.length>0&&e.jsxs("p",{className:"nice-media-collage__hint",children:[e.jsx(T.NtdPlus,{size:12})," Drag a tile, or focus one and press Space then the arrow keys."]})]})});function Ie(i){const s=i.toLowerCase();return["active","live","published","completed","confirmed"].includes(s)?"success":["cancelled","canceled","rejected","failed"].includes(s)?"error":["scheduled","pending","planning"].includes(s)?"info":["draft","archived"].includes(s)?"secondary":"warning"}const On={micro:[],compact:["details","location","budget"],normal:["details","location","schedule","participants","tasks","surveys","budget"],full:["details","location","schedule","participants","tasks","surveys","vendors","budget","documents","settings"]},Un=d.forwardRef(function(s,a){var Oe,Ue,Ye,Fe,Xe,Ve;const{event:n,participants:r=[],surveys:l=[],billing:o=[],scheduleItems:m=[],tasks:h=[],vendors:t=[],documents:u=[],displayMode:p="normal",tabs:N,activeTab:v,onTabChange:g,tabsIconOnly:b=!0,tabsCentered:C="auto",countLocation:j="bottom",showDetails:I=!0,showLocation:c=!0,showSchedule:w=!0,showParticipants:B=!0,showTasks:f=!0,showSurveys:y=!0,showVendors:$=!0,showBudget:k=!0,showDocuments:R=!0,showSettings:F=!0,editable:L=!1,onSave:E,onPublish:U,onShare:z,onExport:_,onUpdateEvent:P,onUpdateLocation:W,onAddSurvey:X,onSurveyRespond:M,onAddBilling:Y,className:V,style:K}=s,[D,Z]=d.useState(n.title),[G,he]=d.useState(n.description??""),[se,ce]=d.useState(n.startDate??""),[pe,we]=d.useState(n.endDate??""),[xe,le]=d.useState(((Oe=n.location)==null?void 0:Oe.name)??""),[ge,Pe]=d.useState(((Ue=n.location)==null?void 0:Ue.address)??""),[oe,ie]=d.useState(((Ye=n.location)==null?void 0:Ye.virtualUrl)??""),[ne,Ne]=d.useState(((Fe=n.location)==null?void 0:Fe.isVirtual)??!1),[de,je]=d.useState(""),[ue,Ae]=d.useState("single"),[ye,_e]=d.useState(""),[ae,be]=d.useState(""),[fe,A]=d.useState(""),[O,q]=d.useState("PLN"),H={details:I,location:c,schedule:w,participants:B,tasks:f,surveys:y,vendors:$,budget:k,documents:R,settings:F},re=(N??On[p]).filter(S=>H[S]!==!1),[Se,ln]=d.useState(re[0]??"details"),on=v??Se,dn=d.useCallback(S=>{const te=S;v===void 0&&ln(te),g==null||g(te)},[v,g]),un=d.useCallback(()=>{P==null||P({title:D,description:G||void 0,startDate:se||void 0,endDate:pe||void 0})},[D,G,se,pe,P]),mn=d.useCallback(()=>{W==null||W({name:xe,address:ge||void 0,virtualUrl:oe||void 0,isVirtual:ne})},[xe,ge,oe,ne,W]),hn=d.useCallback(()=>{if(!de.trim()||!X)return;const S=ye.split(",").map(te=>te.trim()).filter(Boolean);X(de.trim(),ue,S.length>0?S:void 0),je(""),_e("")},[de,ue,ye,X]),pn=d.useCallback(()=>{!ae.trim()||!Y||(Y({label:ae.trim(),amount:parseFloat(fe)||0,currency:O}),be(""),A(""))},[ae,fe,O,Y]),xn=d.useMemo(()=>o.map(S=>({label:S.label,amount:S.amount})),[o]),gn=d.useMemo(()=>o.reduce((S,te)=>S+te.amount,0),[o]),fn=((Xe=o[0])==null?void 0:Xe.currency)??"PLN",vn=e.jsxs("div",{className:"nice-event-planning__form",children:[e.jsx(x.NiceTextInput,{label:"Title",value:D,onChange:Z,readOnly:!L}),e.jsx(x.NiceTextArea,{label:"Description",value:G,onChange:he,readOnly:!L,rows:3}),e.jsxs("div",{className:"nice-event-planning__row",children:[e.jsxs("label",{className:"nice-field",children:[e.jsx("span",{className:"nice-field__label",children:"Start"}),e.jsx("input",{className:"nice-input",type:"datetime-local",value:se,onChange:S=>ce(S.target.value),readOnly:!L})]}),e.jsxs("label",{className:"nice-field",children:[e.jsx("span",{className:"nice-field__label",children:"End"}),e.jsx("input",{className:"nice-input",type:"datetime-local",value:pe,onChange:S=>we(S.target.value),readOnly:!L})]})]}),L&&e.jsx(x.NiceButton,{variant:"primary",leftIcon:e.jsx(Q.NiceIcon,{name:"check",size:"sm"}),onClick:un,children:"Save details"})]}),Nn=e.jsxs("div",{className:"nice-event-planning__form",children:[e.jsx(x.NiceToggle,{label:"Virtual event",checked:ne,onChange:Ne,disabled:!L}),e.jsx(x.NiceTextInput,{label:"Venue name",value:xe,onChange:le,readOnly:!L}),ne?e.jsx(x.NiceTextInput,{label:"Virtual URL",value:oe,onChange:ie,readOnly:!L}):e.jsx(x.NiceTextInput,{label:"Address",value:ge,onChange:Pe,readOnly:!L}),L&&e.jsx(x.NiceButton,{variant:"primary",leftIcon:e.jsx(Q.NiceIcon,{name:"check",size:"sm"}),onClick:mn,children:"Save location"})]}),jn=e.jsx("div",{className:"nice-event-planning__participants",children:r.length===0?e.jsx("p",{className:"nice-event-planning__empty",children:"No participants yet."}):e.jsxs(e.Fragment,{children:[e.jsx(x.NiceAvatarGroup,{max:8,children:r.map(S=>e.jsx(x.NiceAvatar,{name:S.name,src:S.avatarUrl},S.id))}),e.jsx("ul",{className:"nice-event-planning__participant-list",children:r.map(S=>e.jsxs("li",{className:"nice-event-planning__participant",children:[e.jsx(x.NiceAvatar,{name:S.name,src:S.avatarUrl,size:"sm"}),e.jsx("span",{className:"nice-event-planning__participant-name",children:S.name}),e.jsx(x.NiceBadge,{size:"xs",subtle:!0,variant:Ie(S.status),children:S.status})]},S.id))})]})}),yn=e.jsxs("div",{className:"nice-event-planning__form",children:[l.length===0?e.jsx("p",{className:"nice-event-planning__empty",children:"No surveys yet."}):l.map(S=>e.jsxs("div",{className:"nice-event-planning__survey",children:[e.jsx("strong",{children:S.question})," ",e.jsx(x.NiceBadge,{size:"xs",outline:!0,variant:"info",children:S.type}),S.options&&e.jsx("div",{className:"nice-event-planning__survey-options",children:S.options.map((te,An)=>e.jsx(x.NiceButton,{size:"sm",variant:"outline",onClick:()=>M==null?void 0:M(S.id,te),children:te},An))}),S.responses&&e.jsxs("span",{className:"nice-event-planning__muted",children:[S.responses.length," responses"]})]},S.id)),L&&X&&e.jsxs("div",{className:"nice-event-planning__form",children:[e.jsx(x.NiceTextInput,{label:"New survey question",value:de,onChange:je,placeholder:"Question"}),e.jsx(x.NiceSelect,{label:"Type",value:ue,onChange:S=>Ae(S),options:[{value:"single",label:"Single choice"},{value:"multiple",label:"Multiple choice"},{value:"text",label:"Free text"},{value:"rating",label:"Rating"}]}),e.jsx(x.NiceTextInput,{label:"Options (comma-separated)",value:ye,onChange:_e,placeholder:"Yes, No, Maybe"}),e.jsx(x.NiceButton,{variant:"primary",leftIcon:e.jsx(Q.NiceIcon,{name:"plus",size:"sm"}),onClick:hn,disabled:!de.trim(),children:"Add survey"})]})]}),_n=e.jsxs("div",{className:"nice-event-planning__form",children:[o.length===0?e.jsx("p",{className:"nice-event-planning__empty",children:"No billing items yet."}):e.jsx(x.NiceAmountBreakdown,{lines:[...xn,{label:"Total",amount:gn,isSummary:!0}],currency:fn}),L&&Y&&e.jsxs("div",{className:"nice-event-planning__row",children:[e.jsx(x.NiceTextInput,{label:"Item",value:ae,onChange:be,placeholder:"Catering"}),e.jsx(x.NiceTextInput,{label:"Amount",value:fe,onChange:A,placeholder:"0.00"}),e.jsx(x.NiceSelect,{label:"Currency",value:O,onChange:S=>q(S),options:["PLN","EUR","USD","GBP"]}),e.jsx(x.NiceButton,{variant:"primary",leftIcon:e.jsx(Q.NiceIcon,{name:"plus",size:"sm"}),onClick:pn,disabled:!ae.trim(),children:"Add"})]})]}),bn=e.jsxs("div",{className:"nice-event-planning__form",children:[e.jsx(x.NiceToggle,{label:"Public event",checked:n.isPublic??!1,disabled:!L}),e.jsx(x.NiceTextInput,{label:"Max participants",value:n.maxParticipants!=null?String(n.maxParticipants):"",onChange:()=>{},readOnly:!L}),e.jsxs("div",{className:"nice-event-planning__muted",children:["Host: ",n.hostName," · Created ",new Date(n.createdAt).toLocaleDateString()]})]}),kn=e.jsx("div",{className:"nice-event-planning__list",children:m.length===0?e.jsx("p",{className:"nice-event-planning__empty",children:"No agenda items yet."}):e.jsx("ul",{className:"nice-event-planning__schedule",children:m.map(S=>e.jsxs("li",{className:"nice-event-planning__schedule-item",children:[e.jsxs("span",{className:"nice-event-planning__schedule-time",children:[e.jsx(Q.NiceIcon,{name:"clock",size:"sm"}),S.startTime??"",S.endTime?`–${S.endTime}`:""]}),e.jsx("span",{className:"nice-event-planning__schedule-title",children:S.title}),S.location&&e.jsx("span",{className:"nice-event-planning__muted",children:S.location})]},S.id))})}),wn=e.jsx("div",{className:"nice-event-planning__list",children:h.length===0?e.jsx("p",{className:"nice-event-planning__empty",children:"No tasks yet."}):e.jsx("ul",{className:"nice-event-planning__tasks",children:h.map(S=>e.jsxs("li",{className:"nice-event-planning__task",children:[e.jsx(x.NiceToggle,{label:S.title,checked:S.done??!1,disabled:!L}),S.assigneeName&&e.jsx(x.NiceBadge,{size:"xs",subtle:!0,variant:"info",children:S.assigneeName}),S.dueDate&&e.jsx("span",{className:"nice-event-planning__muted",children:S.dueDate})]},S.id))})}),Sn=e.jsx("div",{className:"nice-event-planning__list",children:t.length===0?e.jsx("p",{className:"nice-event-planning__empty",children:"No vendors yet."}):e.jsx("ul",{className:"nice-event-planning__vendors",children:t.map(S=>e.jsxs("li",{className:"nice-event-planning__vendor",children:[e.jsx(Q.NiceIcon,{name:"briefcase",size:"sm"}),e.jsx("span",{className:"nice-event-planning__vendor-name",children:S.name}),S.category&&e.jsx("span",{className:"nice-event-planning__muted",children:S.category}),S.status&&e.jsx(x.NiceBadge,{size:"xs",subtle:!0,variant:Ie(S.status),children:S.status}),S.cost!=null&&e.jsxs("span",{className:"nice-event-planning__vendor-cost",children:[S.cost," ",S.currency??""]})]},S.id))})}),In=e.jsx("div",{className:"nice-event-planning__list",children:u.length===0?e.jsx("p",{className:"nice-event-planning__empty",children:"No documents yet."}):e.jsx("ul",{className:"nice-event-planning__documents",children:u.map(S=>e.jsxs("li",{className:"nice-event-planning__document",children:[e.jsx(Q.NiceIcon,{name:"file",size:"sm"}),e.jsx("span",{className:"nice-event-planning__document-name",children:S.name}),S.fileType&&e.jsx(x.NiceBadge,{size:"xs",outline:!0,variant:"secondary",children:S.fileType}),S.sizeKb!=null&&e.jsxs("span",{className:"nice-event-planning__muted",children:[S.sizeKb," KB"]})]},S.id))})}),Cn={details:vn,location:Nn,schedule:kn,participants:jn,tasks:wn,surveys:yn,vendors:Sn,budget:_n,documents:In,settings:bn},zn={details:"file",location:"home",schedule:"clock",participants:"users",tasks:"list",surveys:"clipboard",vendors:"briefcase",budget:"dollar",documents:"folder",settings:"settings"},Mn={schedule:m.length||void 0,participants:r.length||void 0,tasks:h.length||void 0,surveys:l.length||void 0,vendors:t.length||void 0,budget:o.length||void 0,documents:u.length||void 0},Tn=re.map(S=>({id:S,label:S.charAt(0).toUpperCase()+S.slice(1),icon:e.jsx(Q.NiceIcon,{name:zn[S],size:"sm"}),badge:Mn[S],content:Cn[S]})),Pn=e.jsxs("div",{className:"nice-event-planning__toolbar",children:[e.jsxs("div",{className:"nice-event-planning__toolbar-title",children:[e.jsx(Q.NiceIcon,{name:"calendar",size:"md"}),e.jsx("span",{className:"nice-event-planning__title",children:n.title}),e.jsx(x.NiceBadge,{size:"sm",variant:Ie(n.status),children:n.status})]}),e.jsx("span",{className:"nice-event-planning__toolbar-spacer"}),e.jsxs("div",{className:"nice-event-planning__toolbar-actions",children:[E&&e.jsx(x.NiceButton,{size:"sm",variant:"primary",leftIcon:e.jsx(Q.NiceIcon,{name:"check",size:"sm"}),onClick:()=>E({title:D,description:G}),children:"Save"}),U&&e.jsx(x.NiceButton,{size:"sm",variant:"success",leftIcon:e.jsx(Q.NiceIcon,{name:"upload",size:"sm"}),onClick:U,children:"Publish"}),z&&e.jsx(x.NiceButton,{size:"sm",variant:"ghost",leftIcon:e.jsx(Q.NiceIcon,{name:"link",size:"sm"}),onClick:z,children:"Share"}),_&&e.jsx(x.NiceButton,{size:"sm",variant:"ghost",leftIcon:e.jsx(Q.NiceIcon,{name:"download",size:"sm"}),onClick:_,children:"Export"})]})]});return p==="micro"?e.jsx("div",{ref:a,className:`nice-event-planning nice-event-planning--micro ${V??""}`,style:K,children:e.jsxs("div",{className:"nice-event-planning__micro",children:[e.jsx(Q.NiceIcon,{name:"calendar",size:"md"}),e.jsxs("div",{className:"nice-event-planning__micro-body",children:[e.jsx("span",{className:"nice-event-planning__title",children:n.title}),e.jsxs("span",{className:"nice-event-planning__muted",children:[n.startDate?new Date(n.startDate).toLocaleString():"No date",(Ve=n.location)!=null&&Ve.name?` · ${n.location.name}`:""]})]}),e.jsx(x.NiceBadge,{size:"sm",variant:Ie(n.status),children:n.status}),r.length>0&&e.jsx(x.NiceAvatarGroup,{max:4,size:"sm",children:r.map(S=>e.jsx(x.NiceAvatar,{name:S.name,src:S.avatarUrl,size:"sm"},S.id))})]})}):e.jsxs("div",{ref:a,className:`nice-event-planning nice-event-planning--${p} ${V??""}`,style:K,children:[Pn,e.jsx(x.NiceTabs,{tabs:Tn,activeTab:on,onChange:dn,iconOnly:b,centered:C,countLocation:j})]})});function Yn(i){switch(i){case"confirmed":return"success";case"checked-in":return"info";case"declined":return"error";case"no-show":return"warning";default:return"secondary"}}const Be=({participant:i,showRole:s=!0,showStatus:a=!0,meta:n,children:r,size:l="md",className:o})=>e.jsxs("li",{className:`nice-participant-row nice-participant-row--${l} ${o??""}`,children:[e.jsx(x.NiceAvatar,{name:i.name,src:i.avatarUrl,size:l}),e.jsx("span",{className:"nice-participant-row__name",children:i.name}),s&&i.role&&e.jsx(x.NiceBadge,{size:"xs",outline:!0,variant:"info",children:i.role}),a&&i.status&&e.jsx(x.NiceBadge,{size:"xs",subtle:!0,variant:Yn(i.status),children:i.status}),n&&e.jsx("span",{className:"nice-participant-row__meta",children:n}),r&&e.jsx("span",{className:"nice-participant-row__trailing",children:r})]}),Fn=/^[^\s@,;]+@[^\s@,;]+\.[^\s@,;]{2,}$/,qe=/^.*<\s*([^<>\s]+)\s*>$/;function sn(i){var l,o;const s=[],a=[],n=new Set;let r=0;if(!i)return{valid:s,invalid:a,duplicates:r};for(const m of i.split(/[,;\r\n\t]+/)){const h=m.trim();if(!h)continue;const t=((o=(l=qe.exec(h))==null?void 0:l[1])==null?void 0:o.trim())??h,u=qe.test(h)?[t]:t.split(/\s+/);for(const p of u){if(!p)continue;if(!Fn.test(p)){a.push(p);continue}const N=p.toLowerCase();if(n.has(N)){r+=1;continue}n.add(N),s.push(p)}}return{valid:s,invalid:a,duplicates:r}}function Xn(i,s){const a=new Set(i.map(r=>r.toLowerCase())),n=[...i];for(const r of s){const l=r.toLowerCase();a.has(l)||(a.add(l),n.push(r))}return n}function tn(i={}){const{currentUserId:s,currentUserName:a,requireIdentity:n=!0}=i,[r,l]=d.useState(""),o=!s,m=a??r,h=!n||m.trim().length>0;return{isAnonymous:o,name:m,setName:l,canAct:h,actor:{userId:s,userName:m.trim()}}}const Vn=[{answer:"yes",label:"Yes",variant:"success",Icon:T.NtdCheck},{answer:"maybe",label:"Maybe",variant:"warning",Icon:T.NtdHelp},{answer:"no",label:"No",variant:"error",Icon:T.NtdClose}],$e=d.forwardRef(function(s,a){const{value:n,onRespond:r,allowPlusOnes:l=!1,maxPlusOnes:o=5,plusOnes:m=0,allowNote:h=!1,currentUserId:t,currentUserName:u,compact:p=!1,disabled:N=!1,readOnly:v=!1,size:g="md",className:b,style:C}=s,j=tn({currentUserId:t,currentUserName:u}),[I,c]=d.useState(m),[w,B]=d.useState(""),f=!p&&j.isAnonymous&&!j.canAct,y=N||v,$=k=>{y||!r||r({answer:k,plusOnes:l&&k!=="no"?I:void 0,note:h&&w.trim()?w.trim():void 0,userId:j.actor.userId,userName:j.actor.userName||void 0})};return e.jsxs("div",{ref:a,className:`nice-rsvp-control nice-rsvp-control--${g}${p?" nice-rsvp-control--compact":""} ${b??""}`,style:C,children:[!p&&j.isAnonymous&&e.jsx(x.NiceTextInput,{label:"Your name",value:j.name,onChange:j.setName,placeholder:"Who is replying?",required:!0,disabled:y,size:g}),e.jsx("div",{className:"nice-rsvp-control__answers",role:"group","aria-label":"Your reply",children:Vn.map(({answer:k,label:R,variant:F,Icon:L})=>e.jsx(x.NiceButton,{size:g,variant:n===k?F:"outline",leftIcon:e.jsx(L,{size:16}),disabled:y||f,"aria-pressed":n===k,onClick:()=>$(k),children:R},k))}),!p&&l&&n!=="no"&&e.jsxs("label",{className:"nice-rsvp-control__field",children:[e.jsx("span",{className:"nice-rsvp-control__field-label",children:"Additional guests"}),e.jsx(x.NiceNumericInput,{value:I,onChange:k=>c(Math.max(0,Math.min(o,k??0))),min:0,max:o,step:1,size:"xs",disabled:y})]}),!p&&h&&e.jsx(x.NiceTextInput,{label:"Note",value:w,onChange:B,placeholder:"Anything we should know?",disabled:y,size:g}),f&&e.jsx("p",{className:"nice-rsvp-control__hint",children:"Enter your name to reply."})]})}),Wn={yes:"confirmed",maybe:"invited",no:"declined"},Ge={confirmed:"yes","checked-in":"yes",declined:"no"},Ce=["confirmed","checked-in","invited","declined","no-show"],qn=[],Gn=d.forwardRef(function(s,a){const{participants:n=qn,mode:r="organizer",currentUserId:l,currentUserName:o,onRsvpChange:m,onCheckIn:h,onScan:t,checkInSlot:u,onInvite:p,extraFields:N,groupBy:v="none",showSummary:g=!0,showSearch:b=!0,allowPlusOnes:C=!1,disabled:j=!1,readOnly:I=!1,size:c="md",className:w,style:B}=s,[f,y]=d.useState(""),[$,k]=d.useState("all"),[R,F]=d.useState(""),L=j||I,E=r==="guest",U=d.useMemo(()=>{const M={total:n.length};for(const Y of Ce)M[Y]=0;for(const Y of n)M[Y.status]=(M[Y.status]??0)+1;return M},[n]),z=d.useMemo(()=>{if(E)return n.filter(Y=>Y.userId===l||Y.id===l);const M=f.trim().toLowerCase();return n.filter(Y=>$!=="all"&&Y.status!==$?!1:!M||Y.name.toLowerCase().includes(M))},[n,E,l,f,$]),_=d.useMemo(()=>{if(v==="none"||E)return[{key:"all",label:"",items:z}];const M=new Map;for(const V of z){const K=v==="status"?V.status:V.role,D=M.get(K);D?D.push(V):M.set(K,[V])}return[...M.keys()].sort((V,K)=>v!=="status"?V.localeCompare(K):Ce.indexOf(V)-Ce.indexOf(K)).map(V=>({key:V,label:V,items:M.get(V)??[]}))},[z,v,E]),P=d.useMemo(()=>sn(R),[R]),W=M=>Y=>{m==null||m(M,Wn[Y.answer],Y)},X=()=>{!p||P.valid.length===0||(p(P.valid),F(""))};if(E){const M=z[0];return M?e.jsxs("div",{ref:a,className:`nice-participant-list nice-participant-list--guest ${w??""}`,style:B,children:[e.jsx("ul",{className:"nice-participant-list__rows",children:e.jsx(Be,{participant:M,size:c})}),e.jsx($e,{value:Ge[M.status],onRespond:W(M.id),allowPlusOnes:C,currentUserId:l??M.userId,currentUserName:o??M.name,disabled:j,readOnly:I,size:c})]}):e.jsx("div",{ref:a,className:`nice-participant-list ${w??""}`,style:B,children:e.jsx(me,{title:"You are not on this guest list",description:"Ask the host for an invitation link."})})}return e.jsxs("div",{ref:a,className:`nice-participant-list ${w??""}`,style:B,children:[g&&e.jsxs("div",{className:"nice-participant-list__summary",children:[e.jsxs("span",{className:"nice-participant-list__stat",children:[e.jsx("strong",{children:U.confirmed})," confirmed"]}),e.jsxs("span",{className:"nice-participant-list__stat",children:[e.jsx("strong",{children:U.invited})," awaiting reply"]}),e.jsxs("span",{className:"nice-participant-list__stat",children:[e.jsx("strong",{children:U.declined})," declined"]}),e.jsxs("span",{className:"nice-participant-list__stat",children:[e.jsx("strong",{children:U["checked-in"]})," checked in"]}),e.jsxs("span",{className:"nice-participant-list__stat nice-participant-list__stat--total",children:[e.jsx("strong",{children:U.total})," total"]})]}),(b||u||t)&&e.jsxs("div",{className:"nice-participant-list__toolbar",children:[b&&e.jsxs(e.Fragment,{children:[e.jsx(x.NiceTextInput,{value:f,onChange:y,placeholder:"Search guests…",prefix:e.jsx(T.NtdSearch,{size:15}),size:c}),e.jsx(x.NiceSelect,{value:$,onChange:M=>k(M),size:c,options:[{value:"all",label:"All statuses"},...Ce.map(M=>({value:M,label:M}))]})]}),u,t&&!u&&e.jsxs("span",{className:"nice-participant-list__scan-hint",children:[e.jsx(T.NtdQrCode,{size:15})," Scanner ready"]})]}),z.length===0?e.jsx(me,{title:"No guests yet",description:n.length>0?"No one matches the current filter.":"Invite people to see them here."}):_.map(M=>e.jsxs("section",{className:"nice-participant-list__group",children:[M.label&&e.jsxs("h4",{className:"nice-participant-list__group-title",children:[M.label," ",e.jsxs("span",{children:["(",M.items.length,")"]})]}),e.jsx("ul",{className:"nice-participant-list__rows",children:M.items.map(Y=>e.jsxs(Be,{participant:Y,size:c,meta:N==null?void 0:N.map(V=>e.jsx("span",{className:"nice-participant-list__extra",children:V.render?V.render(Y):String(Y[V.key]??"")},V.key)),children:[m&&e.jsx($e,{compact:!0,value:Ge[Y.status],onRespond:W(Y.id),currentUserId:Y.userId,currentUserName:Y.name,disabled:L,size:"sm"}),h&&Y.status!=="checked-in"&&e.jsx(x.NiceButton,{size:"sm",variant:"outline",leftIcon:e.jsx(T.NtdCheck,{size:14}),disabled:L,onClick:()=>h(Y.id),children:"Check in"})]},Y.id))})]},M.key)),p&&!I&&e.jsxs("div",{className:"nice-participant-list__invite",children:[e.jsx(x.NiceTextArea,{label:"Invite by email",value:R,onChange:F,placeholder:"Paste addresses — commas, semicolons or new lines",rows:3,disabled:j,size:c}),e.jsxs(x.NiceButton,{variant:"primary",size:c,leftIcon:e.jsx(T.NtdMail,{size:15}),disabled:j||P.valid.length===0,onClick:X,children:["Invite ",P.valid.length>0?`(${P.valid.length})`:""]}),(P.invalid.length>0||P.duplicates>0)&&e.jsxs("p",{className:"nice-participant-list__invite-hint",children:[P.duplicates>0&&`${P.duplicates} duplicate(s) removed. `,P.invalid.length>0&&`${P.invalid.length} entry(ies) not recognised.`]})]})]})}),Kn={BIF:0,CLP:0,DJF:0,GNF:0,ISK:0,JPY:0,KMF:0,KRW:0,PYG:0,RWF:0,UGX:0,UYI:0,VND:0,VUV:0,XAF:0,XOF:0,XPF:0,BHD:3,IQD:3,JOD:3,KWD:3,LYD:3,OMR:3,TND:3};function Ee(i){return Kn[i==null?void 0:i.toUpperCase()]??2}function Le(i,s){return Number.isFinite(i)?Math.round(i*10**Ee(s)):0}function Me(i,s){const a=Ee(s);return a===0?i:i/10**a}function Hn(i,s,a){const n=Ee(s),r=Me(i,s);try{return new Intl.NumberFormat(a,{style:"currency",currency:s.toUpperCase(),minimumFractionDigits:n,maximumFractionDigits:n}).format(r)}catch{return`${r.toFixed(n)} ${s}`}}function ee(i,s,a){return Hn(Le(i,s),s,a)}const Re={minX:0,minY:0,maxX:0,maxY:0};function Qn(i,s=0){if(i.length===0)return{...Re};let a=1/0,n=1/0,r=-1/0,l=-1/0;for(const o of i)o.x<a&&(a=o.x),o.y<n&&(n=o.y),o.x>r&&(r=o.x),o.y>l&&(l=o.y);return{minX:a-s,minY:n-s,maxX:r+s,maxY:l+s}}function Ke(i,s){return{minX:Math.min(i.minX,s.minX),minY:Math.min(i.minY,s.minY),maxX:Math.max(i.maxX,s.maxX),maxY:Math.max(i.maxY,s.maxY)}}function He(i,s){return i.minX<=s.maxX&&i.maxX>=s.minX&&i.minY<=s.maxY&&i.maxY>=s.minY}function Zn(i,s,a=0){const n=i.zoom||1,r=-i.pan.x/n-a,l=-i.pan.y/n-a;return{minX:r,minY:l,maxX:r+s.width/n+a*2,maxY:l+s.height/n+a*2}}function Jn(i,s=12){const a=[],n=[],r=new Map,l=new Map;let o=null,m=0;for(const h of i.sections??[]){let t=null,u=0;(h.rows??[]).forEach((N,v)=>{const g=es(N.seats??[]);if(g.length===0)return;const b=Qn(g,s);n.push({sectionId:h.id,rowIndex:v,label:N.label,seats:g,bounds:b}),g.forEach((C,j)=>{r.set(C.id,C),l.set(C.id,{sectionId:h.id,rowIndex:v,seatIndex:j})}),u+=g.length,t=t?Ke(t,b):b});const p=t??{...Re};a.push({section:h,bounds:p,seatCount:u}),m+=u,u>0&&(o=o?Ke(o,p):p)}return{sections:a,rows:n,bounds:o??{...Re},totalSeats:m,seatById:r,locationById:l}}function es(i){return[...i].sort((s,a)=>s.number-a.number||s.x-a.x)}function ns(i,s){return i>s*4?"section":i>s?"row":"seat"}function ss(i,s,a=2500,n){const r=i.sections.filter(u=>He(u.bounds,s)),l=new Set(r.map(u=>u.section.id)),o=i.rows.filter(u=>l.has(u.sectionId)&&He(u.bounds,s));let m=0;for(const u of o)for(const p of u.seats)p.x>=s.minX&&p.x<=s.maxX&&p.y>=s.minY&&p.y<=s.maxY&&(m+=1);const h=n??ns(m,a);let t=[];if(h==="seat"){t=[];for(const u of o)for(const p of u.seats)p.x>=s.minX&&p.x<=s.maxX&&p.y>=s.minY&&p.y<=s.maxY&&t.push(p)}return{tier:h,sections:r,rows:h==="section"?[]:o,seats:t,visibleSeatCount:m}}function De(i){if(i.accessType)return i.accessType;if(i.status==="wheelchair"||i.status==="companion")return i.status}function ve(i,s){const a=(s==null?void 0:s[i.id])??i.status;return a==="wheelchair"||a==="companion"?"available":a}function Qe(i,s,a){var r;const n=(r=s.priceCategories)==null?void 0:r.find(l=>l.id===i.priceCategoryId);return{amount:(n==null?void 0:n.price)??a.basePrice,currency:a.currency}}function ts(i,s={},a){return!(ve(i,a)!=="available"||s.allowedCategories&&!s.allowedCategories.includes(i.priceCategoryId))}function an(i,s={},a){const n=[];let r=null;return i.forEach((l,o)=>{ts(l,s,a)?r?r.seats.push(l):r={start:o,seats:[l]}:r&&(n.push(r),r=null)}),r&&n.push(r),n}function is(i,s,a={},n){const r=a.maxSeats??8;if(i.length>r)return{ok:!1,reason:"max-seats"};for(const o of i){const m=s.seatById.get(o);if(m){if(ve(m,n)!=="available")return{ok:!1,reason:"unavailable",seatId:o};if(a.allowedCategories&&!a.allowedCategories.includes(m.priceCategoryId))return{ok:!1,reason:"category-not-allowed",seatId:o}}}if(!a.adjacentOnly||i.length===0)return{ok:!0};const l=new Map;for(const o of i){const m=s.locationById.get(o);if(!m)continue;const h=`${m.sectionId}::${m.rowIndex}`,t=l.get(h);t?t.push(o):l.set(h,[o])}for(const[o,m]of l){const[h,t]=o.split("::"),u=Number(t),p=s.rows.find(c=>c.sectionId===h&&c.rowIndex===u);if(!p)continue;const N=an(p.seats,a,n),v=new Set(m);let g=null;for(const c of N)if(c.seats.some(w=>v.has(w.id))){if(g)return{ok:!1,reason:"not-adjacent",seatId:m[0]};g=c}if(!g)continue;const b=g.seats.map((c,w)=>v.has(c.id)?w:-1).filter(c=>c>=0);if(b.length===0)continue;const C=b[0],j=b[b.length-1];if(j-C+1!==b.length)return{ok:!1,reason:"not-adjacent",seatId:m[0]};const I=g.seats.length;if(I>1&&(C===1||I-1-j===1))return{ok:!1,reason:"orphan-seat",seatId:m[0]}}return{ok:!0}}function as(i,s,a,n={},r){if(i.includes(s))return{selected:i.filter(m=>m!==s)};const l=[...i,s],o=is(l,a,n,r);return o.ok?{selected:l}:{rejected:o.reason??"not-adjacent"}}function rs(i,s,a={},n={},r){if(s<=0)return[];const l=n.categoryId?{...a,allowedCategories:[n.categoryId]}:a;let o=null;for(const m of i.rows)if(!(n.sectionId&&m.sectionId!==n.sectionId))for(const h of an(m.seats,l,r)){const t=h.seats.length;if(!(t<s))for(let u=0;u+s<=t;u+=1){const p=u+s-1;if(t>s&&(u===1||t-1-p===1))continue;const N=h.seats.slice(u,p+1),v=N.reduce((g,b)=>g+(b.viewScore??50),0)/s;(!o||v>o.score)&&(o={ids:N.map(g=>g.id),score:v})}}return(o==null?void 0:o.ids)??[]}function cs(i,s,a){var u,p,N,v;const n=i.locationById.get(s);if(!n)return null;const r=i.rows.findIndex(g=>g.sectionId===n.sectionId&&g.rowIndex===n.rowIndex);if(r<0)return null;const l=i.rows[r];if(a==="left")return((u=l.seats[n.seatIndex-1])==null?void 0:u.id)??null;if(a==="right")return((p=l.seats[n.seatIndex+1])==null?void 0:p.id)??null;if(a==="row-start")return((N=l.seats[0])==null?void 0:N.id)??null;if(a==="row-end")return((v=l.seats[l.seats.length-1])==null?void 0:v.id)??null;const o=i.rows[a==="up"?r-1:r+1];if(!o)return null;const m=l.seats[n.seatIndex].x;let h=null,t=1/0;for(const g of o.seats){const b=Math.abs(g.x-m);b<t&&(t=b,h=g)}return(h==null?void 0:h.id)??null}function ls(i,s,a){var h,t,u;const n=i.sections.filter(p=>p.seatCount>0);if(n.length===0)return null;const r=s?(h=i.locationById.get(s))==null?void 0:h.sectionId:void 0,l=n.findIndex(p=>p.section.id===r),o=l<0?0:a==="next"?l+1:l-1,m=n[o];return m?((u=(t=i.rows.find(p=>p.sectionId===m.section.id))==null?void 0:t.seats[0])==null?void 0:u.id)??null:null}const ke=8;function os(i,s){return i.seats.length===0?0:i.seats.filter(n=>ve(n,s)==="available").length/i.seats.length}const ds=({cull:i,selectedIds:s,cursorId:a,statusOverrides:n,sectionColorById:r,interactive:l,onSeatClick:o,onSectionClick:m,describeSeat:h})=>i.tier==="section"?e.jsx("g",{className:"nice-seating-chart__sections",children:i.sections.map(({section:t,bounds:u,seatCount:p})=>e.jsxs("g",{className:"nice-seating-chart__section",children:[e.jsx("rect",{x:u.minX,y:u.minY,width:u.maxX-u.minX,height:u.maxY-u.minY,rx:12,className:"nice-seating-chart__section-shape",style:{fill:r.get(t.id)},role:m?"button":"img","aria-label":`${t.name}, ${p} seats`,tabIndex:m?0:void 0,onClick:m?()=>m(t.id):void 0}),e.jsx("text",{x:(u.minX+u.maxX)/2,y:(u.minY+u.maxY)/2,className:"nice-seating-chart__section-label",textAnchor:"middle",dominantBaseline:"middle","aria-hidden":"true",children:t.name})]},t.id))}):i.tier==="row"?e.jsx("g",{className:"nice-seating-chart__rows",children:i.rows.map(t=>{const u=os(t,n);return e.jsxs("g",{children:[e.jsx("rect",{x:t.bounds.minX,y:t.bounds.minY,width:t.bounds.maxX-t.bounds.minX,height:t.bounds.maxY-t.bounds.minY,rx:8,className:"nice-seating-chart__row-shape",style:{fill:r.get(t.sectionId),fillOpacity:.25+u*.65},role:"img","aria-label":`Row ${t.label}, ${t.seats.length} seats, ${Math.round(u*t.seats.length)} available`}),e.jsx("text",{x:t.bounds.minX-6,y:(t.bounds.minY+t.bounds.maxY)/2,className:"nice-seating-chart__row-label",textAnchor:"end",dominantBaseline:"middle","aria-hidden":"true",children:t.label})]},`${t.sectionId}-${t.rowIndex}`)})}):e.jsx("g",{className:"nice-seating-chart__seats",children:i.seats.map(t=>{const u=ve(t,n),p=De(t),N=s.has(t.id),v=a===t.id,g={row:t.row,number:t.number},b=["nice-seating-chart__seat",`nice-seating-chart__seat--${u}`,N?"nice-seating-chart__seat--selected":"",p?`nice-seating-chart__seat--${p}`:"",v?"nice-seating-chart__seat--cursor":""].filter(Boolean).join(" ");return e.jsxs("g",{className:b,"data-seat-id":t.id,role:"gridcell","aria-selected":N,"aria-disabled":u!=="available","aria-label":h(t),tabIndex:v?0:-1,onClick:l&&o?()=>o(t):void 0,children:[p?e.jsx("rect",{x:t.x-ke,y:t.y-ke,width:ke*2,height:ke*2,rx:3,className:"nice-seating-chart__seat-shape",fill:p==="companion"?"url(#nice-seat-companion-hatch)":void 0}):e.jsx("circle",{cx:t.x,cy:t.y,r:ke,className:"nice-seating-chart__seat-shape"}),p==="wheelchair"&&e.jsx(T.NtdWheelchair,{size:10,x:t.x-5,y:t.y-5,className:"nice-seating-chart__seat-glyph"}),e.jsx("title",{children:h(t)}),e.jsx("text",{x:t.x,y:t.y,className:"nice-seating-chart__seat-number",textAnchor:"middle",dominantBaseline:"middle","aria-hidden":"true",children:g.number})]},t.id)})}),us=({index:i,selectedIds:s,statusOverrides:a,maxSeats:n,onSeatToggle:r,onBestAvailable:l,describeSeat:o,disabled:m=!1,defaultOpen:h=!1})=>{var I;const t=d.useMemo(()=>i.sections.filter(c=>c.seatCount>0),[i.sections]),[u,p]=d.useState(((I=t[0])==null?void 0:I.section.id)??""),[N,v]=d.useState(0),[g,b]=d.useState(2),C=d.useMemo(()=>i.rows.filter(c=>c.sectionId===u),[i.rows,u]),j=C.find(c=>c.rowIndex===N)??C[0];return e.jsxs(x.NiceCollapse,{trigger:"Choose seats without the map",defaultExpanded:h,className:"nice-seating-chart__list-panel",children:[l&&e.jsxs("div",{className:"nice-seating-chart__best",children:[e.jsxs("label",{className:"nice-seating-chart__field",children:[e.jsx("span",{children:"How many seats?"}),e.jsx(x.NiceNumericInput,{value:g,onChange:c=>b(Math.max(1,Math.min(n,c??1))),min:1,max:n,size:"xs",disabled:m})]}),e.jsx(x.NiceButton,{size:"sm",variant:"primary",disabled:m,onClick:()=>l(g,{sectionId:u||void 0}),children:"Best available"})]}),e.jsxs("div",{className:"nice-seating-chart__pickers",children:[e.jsxs("label",{className:"nice-seating-chart__field",children:[e.jsx("span",{children:"Section"}),e.jsx(x.NiceSelect,{size:"sm",value:u,disabled:m,onChange:c=>{p(c),v(0)},options:t.map(c=>({value:c.section.id,label:`${c.section.name} (${c.seatCount})`}))})]}),e.jsxs("label",{className:"nice-seating-chart__field",children:[e.jsx("span",{children:"Row"}),e.jsx(x.NiceSelect,{size:"sm",value:String((j==null?void 0:j.rowIndex)??0),disabled:m||C.length===0,onChange:c=>v(Number(c)),options:C.map(c=>({value:String(c.rowIndex),label:`${c.label} (${c.seats.length})`}))})]})]}),j&&e.jsx("ul",{className:"nice-seating-chart__seat-list",children:j.seats.map(c=>{const w=ve(c,a),B=De(c),f=s.has(c.id);return e.jsx("li",{children:e.jsxs(x.NiceButton,{size:"sm",variant:f?"primary":"outline",disabled:m||w!=="available",ariaLabel:o(c),"aria-pressed":f,onClick:()=>r(c),children:[c.number,B&&e.jsx(T.NtdWheelchair,{size:11})]})},c.id)})})]})},ms={zoom:1,pan:{x:0,y:0}};function hs(i={}){const{minZoom:s=.1,maxZoom:a=10,initial:n=ms,viewport:r,onViewportChange:l,disabled:o=!1}=i,[m,h]=d.useState(n),t=r??m,[u,p]=d.useState(!1),N=d.useRef(new Map),v=d.useRef(null),g=d.useRef(null),b=d.useCallback(k=>{r===void 0&&h(k),l==null||l(k)},[r,l]),C=d.useCallback(k=>Math.min(a,Math.max(s,k)),[s,a]),j=d.useCallback((k,R)=>{const F=C(t.zoom*k);if(F===t.zoom)return;const L=F/t.zoom;b({zoom:F,pan:{x:R.x-(R.x-t.pan.x)*L,y:R.y-(R.y-t.pan.y)*L}})},[b,C,t]),I=d.useCallback((k,R,F)=>{const L=R??(F?{x:F.width/2,y:F.height/2}:{x:0,y:0});j(k,L)},[j]),c=d.useCallback((k,R,F=24)=>{const L=Math.max(1,k.maxX-k.minX),E=Math.max(1,k.maxY-k.minY),U=C(Math.min((R.width-F*2)/L,(R.height-F*2)/E));b({zoom:U,pan:{x:(R.width-L*U)/2-k.minX*U,y:(R.height-E*U)/2-k.minY*U}})},[b,C]),w=d.useCallback(()=>b(n),[b,n]),B=d.useCallback(k=>({x:(k.x-t.pan.x)/t.zoom,y:(k.y-t.pan.y)/t.zoom}),[t]),f=d.useCallback(k=>({x:k.x*t.zoom+t.pan.x,y:k.y*t.zoom+t.pan.y}),[t]),y=k=>{const R=k.currentTarget.getBoundingClientRect();return{x:k.clientX-R.left,y:k.clientY-R.top}};return{viewport:t,setViewport:b,containerProps:o?{}:{onWheel:k=>{k.preventDefault();const R=Math.exp(-k.deltaY*.002);j(Math.min(2,Math.max(.5,R)),y(k))},onPointerDown:k=>{var F,L;const R=y(k);if(N.current.set(k.pointerId,R),(L=(F=k.currentTarget).setPointerCapture)==null||L.call(F,k.pointerId),N.current.size===2){const[E,U]=[...N.current.values()];v.current={distance:Math.hypot(E.x-U.x,E.y-U.y)||1,zoom:t.zoom}}else g.current=R,p(!0)},onPointerMove:k=>{if(!N.current.has(k.pointerId))return;const R=y(k);if(N.current.set(k.pointerId,R),N.current.size===2&&v.current){const[E,U]=[...N.current.values()],z=Math.hypot(E.x-U.x,E.y-U.y)||1,_=C(v.current.zoom*(z/v.current.distance)),P={x:(E.x+U.x)/2,y:(E.y+U.y)/2};_!==t.zoom&&j(_/t.zoom,P);return}if(!g.current)return;const F=R.x-g.current.x,L=R.y-g.current.y;g.current=R,b({zoom:t.zoom,pan:{x:t.pan.x+F,y:t.pan.y+L}})},onPointerUp:k=>{N.current.delete(k.pointerId),N.current.size<2&&(v.current=null),N.current.size===0&&(g.current=null,p(!1))},onPointerCancel:k=>{N.current.delete(k.pointerId),v.current=null,g.current=null,p(!1)}},zoomBy:I,fitTo:c,reset:w,screenToWorld:B,worldToScreen:f,panning:u}}const ps={"orphan-seat":"That would leave a single empty seat. Pick a different seat.","not-adjacent":"Seats must be next to each other.","max-seats":"You have selected as many seats as this order allows.","category-not-allowed":"That seat is not part of the selected ticket type.",unavailable:"That seat is not available."},xs={id:"empty",name:"",venueId:"",sections:[],priceCategories:[],totalSeats:0},rn=d.forwardRef(function(s,a){var ae,be,fe;const{chart:n=xs,mode:r="select",selection:l={},selectedSeatIds:o,defaultSelectedSeatIds:m=[],onSelectionChange:h,onSelectionRejected:t,seatStatusOverrides:u,onSeatClick:p,onBestAvailable:N,lod:v="auto",onLodChange:g,maxRenderedSeats:b=2500,containerSize:C,showLegend:j=!0,showList:I=!1,zoomable:c=!0,locale:w,disabled:B=!1,readOnly:f=!1,className:y,style:$}=s,k=d.useRef(null),[R,F]=d.useState({width:800,height:500}),[L,E]=d.useState(!1),[U,z]=d.useState(m),[_,P]=d.useState(null),[W,X]=d.useState(""),M=o??U,Y=d.useMemo(()=>new Set(M),[M]),V=r==="select"&&!B&&!f&&l.interactive!==!1,K=l.maxSeats??8,D=d.useMemo(()=>Jn(n),[n]),Z=C??R,G=!!C||L;d.useEffect(()=>{if(C||!k.current||typeof ResizeObserver>"u")return;const A=k.current,O=new ResizeObserver(([q])=>{const{width:H,height:J}=q.contentRect;H>0&&J>0&&(F({width:H,height:J}),E(!0))});return O.observe(A),()=>O.disconnect()},[C]);const he=hs({disabled:!c||B}),{fitTo:se,viewport:ce}=he,pe=d.useRef(!1);d.useEffect(()=>{pe.current||!G||D.totalSeats===0||Z.width<=0||(pe.current=!0,se(D.bounds,Z))},[se,D,Z,G]);const we=d.useMemo(()=>Zn(ce,Z,40),[ce,Z]),xe=v!=="auto"?v:_?"seat":void 0,le=d.useMemo(()=>ss(D,we,b,xe),[D,we,b,xe]),ge=d.useRef(null);d.useEffect(()=>{ge.current!==le.tier&&(ge.current=le.tier,g==null||g(le.tier))},[le.tier,g]);const Pe=d.useMemo(()=>{var A;return new Map(((A=n.sections)==null?void 0:A.map(O=>[O.id,O.color]))??[])},[n.sections]),oe=d.useMemo(()=>{var A;return new Map(((A=n.sections)==null?void 0:A.map(O=>[O.id,O]))??[])},[n.sections]),ie=d.useCallback(A=>{const O=oe.get(A.sectorId),q=ve(A,u),H=De(A),J=[O?O.name:"",`row ${A.row}`,`seat ${A.number}`].filter(Boolean);if(O&&l.showPrices!==!1){const re=Qe(A,n,O);J.push(ee(re.amount,re.currency,w))}return J.push(q),H==="wheelchair"&&J.push("wheelchair accessible"),H==="companion"&&J.push("companion seat"),J.join(", ")},[n,oe,u,l.showPrices,w]),ne=d.useCallback(A=>{o===void 0&&z(A),h==null||h(A)},[o,h]),Ne=d.useCallback(A=>{if(p==null||p(A),!V)return;const O=as(M,A.id,D,l,u);if("rejected"in O){t==null||t({reason:O.rejected,seatId:A.id}),X(ps[O.rejected]);return}ne(O.selected),X(`${ie(A)}. ${O.selected.length} of ${K} selected.`)},[ne,ie,D,V,K,p,t,u,M,l]),de=d.useCallback((A,O)=>{if(N){N(A,O);return}const q=rs(D,A,l,O,u);if(q.length===0){X(`No block of ${A} seats together is available.`);return}ne(q),P(q[0]),X(`Selected ${q.length} seats together.`)},[ne,D,N,u,l]),je=d.useCallback(A=>{const O=D.locationById.get(A);if(!O)return;const q=D.rows.find(H=>H.sectionId===O.sectionId&&H.rowIndex===O.rowIndex);q&&se(q.bounds,Z,80)},[se,D,Z]),ue=d.useCallback(A=>{if(!A)return;P(A),je(A);const O=D.seatById.get(A);O&&X(ie(O))},[ie,D.seatById,je]),Ae=A=>{var J,re;const O=_??((re=(J=D.rows[0])==null?void 0:J.seats[0])==null?void 0:re.id)??null;if(!O)return;const H={ArrowLeft:"left",ArrowRight:"right",ArrowUp:"up",ArrowDown:"down",Home:"row-start",End:"row-end"}[A.key];if(H){A.preventDefault(),ue(_?cs(D,O,H):O);return}if(A.key==="PageDown"||A.key==="PageUp"){A.preventDefault(),ue(ls(D,_,A.key==="PageDown"?"next":"prev"));return}if(A.key==="Enter"||A.key===" "){A.preventDefault();const Se=D.seatById.get(O);Se&&Ne(Se);return}A.key==="Escape"&&M.length>0&&(A.preventDefault(),ne([]),X("Selection cleared."))};if(D.totalSeats===0)return e.jsx("div",{ref:a,className:`nice-seating-chart ${y??""}`,style:$,children:e.jsx(me,{title:"This chart has no seats",description:"Add sections and rows to the seating chart to see it here."})});const ye=M.reduce((A,O)=>{const q=D.seatById.get(O),H=q?oe.get(q.sectorId):void 0;return!q||!H?A:A+Qe(q,n,H).amount},0),_e=((be=(ae=n.sections)==null?void 0:ae[0])==null?void 0:be.currency)??"PLN";return e.jsxs("div",{ref:a,className:`nice-seating-chart nice-seating-chart--${r} ${y??""}`,style:$,children:[e.jsxs("div",{ref:k,className:"nice-seating-chart__canvas-host",role:"grid","aria-label":`${n.name} seating chart`,"aria-rowcount":D.rows.length,"aria-colcount":D.totalSeats,tabIndex:_?-1:0,onKeyDown:Ae,...he.containerProps,children:[e.jsxs("svg",{className:"nice-seating-chart__canvas",width:"100%",height:"100%",role:"presentation",children:[e.jsx("defs",{children:e.jsx("pattern",{id:"nice-seat-companion-hatch",width:4,height:4,patternUnits:"userSpaceOnUse",patternTransform:"rotate(45)",children:e.jsx("line",{x1:0,y1:0,x2:0,y2:4,className:"nice-seating-chart__hatch"})})}),e.jsx("g",{transform:`translate(${ce.pan.x} ${ce.pan.y}) scale(${ce.zoom})`,children:e.jsx(ds,{cull:le,selectedIds:Y,cursorId:_,statusOverrides:u,sectionColorById:Pe,interactive:V,onSeatClick:Ne,onSectionClick:l.sectionSelect?A=>{var q;const O=(q=D.rows.find(H=>H.sectionId===A))==null?void 0:q.seats[0];O&&ue(O.id)}:void 0,describeSeat:ie})})]}),c&&e.jsxs("div",{className:"nice-seating-chart__zoom",children:[e.jsx(x.NiceButton,{size:"sm",variant:"ghost",ariaLabel:"Zoom in",onClick:()=>he.zoomBy(1.25,void 0,Z),children:"+"}),e.jsx(x.NiceButton,{size:"sm",variant:"ghost",ariaLabel:"Zoom out",onClick:()=>he.zoomBy(.8,void 0,Z),children:"−"}),e.jsx(x.NiceButton,{size:"sm",variant:"ghost",ariaLabel:"Fit to view",onClick:()=>se(D.bounds,Z),children:"Fit"})]})]}),e.jsx("p",{className:"nice-seating-chart__status",role:"status","aria-live":"polite",children:W}),j&&e.jsxs("ul",{className:"nice-seating-chart__legend",children:[(fe=n.priceCategories)==null?void 0:fe.map(A=>e.jsxs("li",{className:"nice-seating-chart__legend-item",children:[e.jsx("span",{className:"nice-seating-chart__legend-swatch",style:{background:A.color},"aria-hidden":"true"}),A.name," · ",ee(A.price,_e,w)]},A.id)),e.jsxs("li",{className:"nice-seating-chart__legend-item nice-seating-chart__legend-item--sold",children:[e.jsx("span",{className:"nice-seating-chart__legend-swatch","aria-hidden":"true"})," Sold"]})]}),r==="select"&&M.length>0&&e.jsxs("p",{className:"nice-seating-chart__total",children:[M.length," seat",M.length===1?"":"s"," ·"," ",ee(ye,_e,w)]}),I&&e.jsx(us,{index:D,selectedIds:Y,statusOverrides:u,maxSeats:K,onSeatToggle:Ne,onBestAvailable:de,describeSeat:ie,disabled:!V,defaultOpen:r==="select"&&I})]})}),gs=d.forwardRef(function({showList:s=!0,className:a,...n},r){return e.jsx(rn,{ref:r,mode:"select",showList:s,className:`nice-seat-picker ${a??""}`,...n})}),cn=/\{\{\s*([\w.-]+)\s*\}\}/g,fs={"&":"&","<":"<",">":">",'"':""","'":"'"};function vs(i){return i.replace(/[&<>"']/g,s=>fs[s]??s)}function Ns(i){const s=[],a=new Set;for(const n of i.matchAll(cn)){const r=n[1];a.has(r)||(a.add(r),s.push(r))}return s}function js(i,s={},a={}){const{escape:n=!0,missing:r="keep"}=a;return i.replace(cn,(l,o)=>{const m=s[o];return m==null?r==="blank"?"":l:n?vs(String(m)):String(m)})}function Ze(i){return`{{${i}}}`}function ys(i,s={}){return Ns(i).filter(a=>s[a]===void 0||s[a]===null)}const _s={name:"",body:""},bs=["bold","italic","underline","h1","h2","ul","ol","link","image","alignLeft","alignCenter","undo","redo"],ks=d.forwardRef(function(s,a){const{template:n,defaultTemplate:r,onTemplateChange:l,tokens:o=[],previewData:m={},recipients:h=[],onRecipientsChange:t,onSend:u,sending:p=!1,toolbar:N=bs,disabled:v=!1,readOnly:g=!1,size:b="md",className:C,style:j}=s,[I,c]=Q.useControllableState({value:n,defaultValue:r,fallbackValue:_s,onChange:l,componentName:"NiceInvitationDesigner"}),[w,B]=d.useState(""),f=v||g||p,y=d.useMemo(()=>sn(w),[w]),$=d.useMemo(()=>{const _={};for(const P of o)P.sample!==void 0&&(_[P.key]=P.sample);return{..._,...m}},[o,m]),k=d.useMemo(()=>js(I.body??"",$),[I.body,$]),R=d.useMemo(()=>ys(I.body??"",$),[I.body,$]),F=h.map(_=>_.email),L=_=>c({...I,..._}),E=_=>{L({body:`${I.body??""}${Ze(_)}`})},U=()=>{!t||y.valid.length===0||(t(Xn(F,y.valid)),B(""))},z=_=>{t==null||t(F.filter(P=>P!==_))};return e.jsxs("div",{ref:a,className:`nice-invitation-designer nice-invitation-designer--${b} ${C??""}`,style:j,children:[e.jsxs("section",{className:"nice-invitation-designer__editor",children:[e.jsx(x.NiceTextInput,{label:"Template name",value:I.name,onChange:_=>L({name:_}),placeholder:"Birthday invitation",disabled:f,size:b}),o.length>0&&!g&&e.jsxs("div",{className:"nice-invitation-designer__tokens",children:[e.jsx("span",{className:"nice-invitation-designer__tokens-label",children:"Insert:"}),o.map(_=>e.jsx(x.NiceButton,{size:"sm",variant:"outline",disabled:f,onClick:()=>E(_.key),children:_.label},_.key))]}),e.jsx(x.NiceHtmlEditor,{value:I.body??"",onChange:_=>L({body:_}),toolbar:N,height:280,readOnly:g||p,disabled:v})]}),e.jsxs("section",{className:"nice-invitation-designer__preview","aria-label":"Invitation preview",children:[e.jsxs("header",{className:"nice-invitation-designer__preview-header",children:[e.jsx("h4",{children:"Preview"}),R.length>0&&e.jsxs(x.NiceBadge,{size:"xs",subtle:!0,variant:"warning",children:[R.length," unresolved"]})]}),I.coverImageUrl&&e.jsx("img",{className:"nice-invitation-designer__cover",src:I.coverImageUrl,alt:""}),e.jsx("div",{className:"nice-invitation-designer__preview-body",dangerouslySetInnerHTML:{__html:k}}),R.length>0&&e.jsxs("p",{className:"nice-invitation-designer__unresolved",children:["No preview value for: ",R.map(_=>Ze(_)).join(", ")]})]}),e.jsxs("section",{className:"nice-invitation-designer__recipients",children:[e.jsx("header",{className:"nice-invitation-designer__recipients-header",children:e.jsxs("h4",{children:["Recipients ",e.jsxs("span",{children:["(",h.length,")"]})]})}),t&&!g&&e.jsxs(e.Fragment,{children:[e.jsx(x.NiceTextArea,{label:"Add addresses",value:w,onChange:B,placeholder:"Paste a list — commas, semicolons or new lines",rows:3,disabled:f,size:b}),e.jsxs("div",{className:"nice-invitation-designer__paste-actions",children:[e.jsxs(x.NiceButton,{size:b,variant:"outline",leftIcon:e.jsx(T.NtdMail,{size:15}),disabled:f||y.valid.length===0,onClick:U,children:["Add ",y.valid.length>0?`(${y.valid.length})`:""]}),(y.invalid.length>0||y.duplicates>0)&&e.jsxs("span",{className:"nice-invitation-designer__paste-hint",children:[y.duplicates>0&&`${y.duplicates} duplicate(s). `,y.invalid.length>0&&`${y.invalid.length} not recognised: ${y.invalid.slice(0,3).join(", ")}`]})]})]}),h.length>0&&e.jsx("ul",{className:"nice-invitation-designer__recipient-list",children:h.map(_=>e.jsxs("li",{className:"nice-invitation-designer__recipient",children:[e.jsx("span",{children:_.name?`${_.name} <${_.email}>`:_.email}),_.status&&_.status!=="pending"&&e.jsx(x.NiceBadge,{size:"xs",subtle:!0,variant:_.status==="sent"?"success":"error",children:_.status}),t&&!g&&e.jsx(x.NiceButton,{size:"sm",variant:"ghost",ariaLabel:`Remove ${_.email}`,disabled:f,onClick:()=>z(_.email),children:e.jsx(T.NtdTrash,{size:13})})]},_.email))}),u&&!g&&e.jsx(x.NiceButton,{variant:"primary",size:b,leftIcon:e.jsx(T.NtdSend,{size:15}),loading:p,ariaLabel:"Send invitations",disabled:v||p||h.length===0,onClick:()=>u({templateId:I.id,emails:F}),children:p?"Sending…":`Send to ${h.length}`})]})]})}),ws=({value:i,max:s,currency:a,locale:n,label:r,className:l})=>{const o=s>0?s:1,m=i>=s&&s>0,h=(t,u)=>a?`${ee(t,a,n)} / ${ee(u,a,n)}`:`${t} / ${u}`;return e.jsx(x.NiceProgress,{className:l,value:Math.min(i,o),max:o,variant:m?"success":"primary",size:"sm",showValue:!0,formatValue:()=>h(i,s),"aria-label":r})},Ss=[];function Is(i,s){if(s==="wishlist")return{value:i.isPurchased?1:0,max:1,complete:!!i.isPurchased};const a=i.quantityNeeded??1,n=i.quantityContributed??0;return{value:n,max:a,complete:a>0&&n>=a}}const Cs=d.forwardRef(function(s,a){const{items:n=Ss,kind:r="registry",mode:l="owner",currency:o="PLN",locale:m,hideContributors:h=!1,currentUserId:t,currentUserName:u,onContribute:p,onClaim:N,onUnclaim:v,onItemAdd:g,onItemDelete:b,onItemClick:C,layout:j="grid",disabled:I=!1,readOnly:c=!1,size:w="md",className:B,style:f}=s,y=tn({currentUserId:t,currentUserName:u}),[$,k]=d.useState(null),[R,F]=d.useState(0),[L,E]=d.useState(""),U=l==="owner",z=I||c,_=r==="wishlist",P=d.useMemo(()=>_?[...n].sort((M,Y)=>Number(M.isPurchased??!1)-Number(Y.isPurchased??!1)||(Y.priority??0)-(M.priority??0)):n,[n,_]),W=()=>{k(null),F(0)},X=M=>{!p||!y.canAct||(p(M.id,{amount:R>0?R:void 0,quantity:R>0?void 0:1,userName:y.actor.userName,userId:y.actor.userId}),W())};return n.length===0?e.jsx("div",{ref:a,className:`nice-gift-registry ${B??""}`,style:f,children:e.jsx(me,{icon:e.jsx(T.NtdGiftCard,{size:28}),title:_?"Nothing on the wishlist yet":"No gifts on the registry yet",description:U?"Add what you would like and share the link.":"The host has not added anything yet."})}):e.jsxs("div",{ref:a,className:`nice-gift-registry nice-gift-registry--${r} nice-gift-registry--${j} nice-gift-registry--${w} ${B??""}`,style:f,children:[!U&&y.isAnonymous&&(p||N)&&e.jsx(x.NiceTextInput,{label:"Your name",value:y.name,onChange:y.setName,placeholder:"So the host knows who to thank",required:!0,disabled:z,size:w}),e.jsx(x.NiceCardGroup,{columns:j==="list"?1:void 0,minColumnWidth:240,gap:12,children:P.map(M=>{const{value:Y,max:V,complete:K}=Is(M,r),D=M.price,Z=M.contributions??[];return e.jsxs("div",{className:`nice-gift-registry__item${K?" nice-gift-registry__item--complete":""}`,children:[M.imageUrl&&e.jsx("img",{src:M.imageUrl,alt:"",className:"nice-gift-registry__image",loading:"lazy"}),e.jsxs("div",{className:"nice-gift-registry__body",children:[e.jsx("button",{type:"button",className:"nice-gift-registry__title",onClick:()=>C==null?void 0:C(M),disabled:!C,children:M.title}),M.description&&e.jsx("p",{className:"nice-gift-registry__description",children:M.description}),e.jsxs("div",{className:"nice-gift-registry__facts",children:[D&&e.jsx("span",{className:"nice-gift-registry__price",children:ee(D.amount,D.currency||o,m)}),_&&(M.priority??0)>0&&e.jsxs(x.NiceBadge,{size:"xs",subtle:!0,variant:"warning",children:[e.jsx(T.NtdStar,{size:11})," ",M.priority]}),K&&e.jsx(x.NiceBadge,{size:"xs",subtle:!0,variant:"success",children:_?"bought":"fully covered"}),M.url&&e.jsxs("a",{className:"nice-gift-registry__link",href:M.url,target:"_blank",rel:"noopener noreferrer",children:[e.jsx(T.NtdLink,{size:13})," Shop"]})]}),!_&&e.jsx(ws,{value:Y,max:V,label:`${M.title}: ${Y} of ${V} covered`}),!h&&Z.length>0&&e.jsx("ul",{className:"nice-gift-registry__contributors",children:Z.map(G=>e.jsxs("li",{className:"nice-gift-registry__contributor",children:[e.jsx("strong",{children:G.contributorName}),G.amount!==void 0&&` — ${ee(G.amount,(D==null?void 0:D.currency)||o,m)}`,G.amount===void 0&&G.quantity?` — ${G.quantity}×`:"",G.message&&e.jsxs("em",{children:[" “",G.message,"”"]})]},G.id))}),e.jsxs("div",{className:"nice-gift-registry__actions",children:[!U&&!K&&N&&e.jsx(x.NiceButton,{size:"sm",variant:"primary",disabled:z||!y.canAct,leftIcon:e.jsx(T.NtdCheck,{size:14}),onClick:()=>N(M.id,{...y.actor,quantity:1}),children:"I'll take this"}),!U&&K&&v&&e.jsx(x.NiceButton,{size:"sm",variant:"ghost",disabled:z,onClick:()=>v(M.id),children:"Release"}),!U&&!K&&!_&&p&&e.jsx(x.NiceButton,{size:"sm",variant:"outline",disabled:z||!y.canAct,onClick:()=>k($===M.id?null:M.id),children:"Chip in"}),U&&b&&!c&&e.jsx(x.NiceButton,{size:"sm",variant:"ghost",ariaLabel:`Delete ${M.title}`,disabled:I,onClick:()=>b(M.id),children:e.jsx(T.NtdTrash,{size:14})})]}),$===M.id&&e.jsxs("div",{className:"nice-gift-registry__pledge",children:[e.jsxs("label",{className:"nice-gift-registry__pledge-field",children:[e.jsxs("span",{children:["Amount (",(D==null?void 0:D.currency)||o,")"]}),e.jsx(x.NiceNumericInput,{value:R,onChange:G=>F(Math.max(0,G??0)),min:0,size:"xs",disabled:z})]}),e.jsx(x.NiceButton,{size:"sm",variant:"primary",disabled:z||!y.canAct,onClick:()=>X(M),children:"Confirm"}),e.jsx(x.NiceButton,{size:"sm",variant:"ghost",onClick:W,children:"Cancel"})]})]})]},M.id)})}),U&&g&&!c&&e.jsxs("div",{className:"nice-gift-registry__add",children:[e.jsx(x.NiceTextInput,{label:_?"Add a wish":"Add a gift",value:L,onChange:E,placeholder:"What would you like?",disabled:I,size:w}),e.jsx(x.NiceButton,{variant:"primary",size:w,leftIcon:e.jsx(T.NtdPlus,{size:15}),disabled:I||!L.trim(),onClick:()=>{g({title:L.trim(),quantityNeeded:1}),E("")},children:"Add"})]})]})});function zs(i){const s=new Map;for(const a of i){const n=(a.currency||"").toUpperCase(),r=s.get(n);r?r.push(a):s.set(n,[a])}return s}function Ms(i,s,a){var h;const n=new Set(s.map(t=>t.id)),r=s.map(t=>t.id),l=new Map(r.map(t=>[t,0])),o=[];let m=0;if(r.length===0)return{balances:l,issues:i.map(t=>({itemId:t.id,reason:"no-participants"})),totalMinor:0};for(const t of i){const u=t.paidById;if(!u){o.push({itemId:t.id,reason:"no-payer"});continue}if(!n.has(u)){o.push({itemId:t.id,reason:"unknown-payer"});continue}let p=(h=t.splitAmong)!=null&&h.length?t.splitAmong.filter(j=>n.has(j)):r;p.length===0&&(p=r);const N=Le(t.amount,a);m+=N;const v=p.length,g=Math.floor(N/v),b=N-g*v,C=new Map(p.map(j=>[j,g]));if(b!==0)if(C.has(u))C.set(u,(C.get(u)??0)+b);else{const j=[...p].sort(Te),I=b>0?1:-1;for(let c=0;c<Math.abs(b);c+=1){const w=j[c%j.length];C.set(w,(C.get(w)??0)+I)}}l.set(u,(l.get(u)??0)+N);for(const[j,I]of C)l.set(j,(l.get(j)??0)-I)}return{balances:l,issues:o,totalMinor:m}}function Ts(i,s,a){for(const n of s){if((n.currency||"").toUpperCase()!==a||!i.has(n.fromId)||!i.has(n.toId))continue;const r=Le(n.amount,a);i.set(n.fromId,(i.get(n.fromId)??0)+r),i.set(n.toId,(i.get(n.toId)??0)-r)}}function Ps(i,s,a){const n=new Map(s.map(t=>[t.id,t.name])),r=[...i.entries()].filter(([,t])=>t>0).map(([t,u])=>({id:t,v:u})).sort((t,u)=>u.v-t.v||Te(t.id,u.id)),l=[...i.entries()].filter(([,t])=>t<0).map(([t,u])=>({id:t,v:u})).sort((t,u)=>t.v-u.v||Te(t.id,u.id)),o=[];let m=0,h=0;for(;m<l.length&&h<r.length;){const t=Math.min(-l[m].v,r[h].v);t>0&&o.push({fromId:l[m].id,fromName:n.get(l[m].id)??l[m].id,toId:r[h].id,toName:n.get(r[h].id)??r[h].id,amount:Me(t,a),currency:a}),l[m].v+=t,r[h].v-=t,l[m].v===0&&(m+=1),r[h].v===0&&(h+=1)}return o}function As(i,s,a=[]){const n=[],r=[],l=[...zs(i).entries()].sort(([o],[m])=>Te(o,m));for(const[o,m]of l){const h=Ms(m,s,o);r.push(...h.issues),Ts(h.balances,a,o),n.push({currency:o,total:Me(h.totalMinor,o),balances:s.map(t=>({participantId:t.id,participantName:t.name,amount:Me(h.balances.get(t.id)??0,o),currency:o})),transfers:Ps(h.balances,s,o)})}return{groups:n,issues:r}}function Te(i,s){return i<s?-1:i>s?1:0}const Bs=[],$s=[],Rs=d.forwardRef(function(s,a){const{items:n=Bs,participants:r=$s,settlements:l=[],view:o,defaultView:m="expenses",onViewChange:h,onSettle:t,onItemDelete:u,onItemClick:p,onValidationChange:N,sortBy:v="date",locale:g,disabled:b=!1,readOnly:C=!1,size:j="md",className:I,style:c}=s,[w,B]=d.useState(m),f=o??w,y=b||C,$=d.useMemo(()=>r.map(z=>({id:z.id,name:z.name})),[r]),k=d.useMemo(()=>As(n,$,l),[n,$,l]),R=d.useMemo(()=>v==="none"?n:n.map((z,_)=>({item:z,index:_})).sort((z,_)=>{if(v==="amount")return _.item.amount-z.item.amount||z.index-_.index;const P=z.item.incurredAt,W=_.item.incurredAt;return P&&W?P.localeCompare(W)||z.index-_.index:P?-1:W?1:z.index-_.index}).map(z=>z.item),[n,v]),F=k.issues.map(z=>`${z.itemId}:${z.reason}`).join("|");d.useEffect(()=>{N==null||N(k.issues)},[F]);const L=d.useMemo(()=>new Map(r.map(z=>[z.id,z.avatarUrl])),[r]),E=d.useMemo(()=>new Map(k.issues.map(z=>[z.itemId,z.reason])),[k.issues]),U=z=>{o===void 0&&B(z),h==null||h(z)};return n.length===0?e.jsx("div",{ref:a,className:`nice-expense-split ${I??""}`,style:c,children:e.jsx(me,{icon:e.jsx(T.NtdReceipt,{size:28}),title:"No expenses yet",description:"Add what people paid for and this will work out who owes whom."})}):e.jsxs("div",{ref:a,className:`nice-expense-split nice-expense-split--${j} ${I??""}`,style:c,children:[e.jsx(x.NiceSegmentedControl,{size:j,value:f,onChange:z=>U(z),options:[{value:"expenses",label:"Expenses"},{value:"balances",label:"Balances"},{value:"settlement",label:"Settle up"}]}),f==="expenses"&&e.jsx("ul",{className:"nice-expense-split__items",children:R.map(z=>{const _=E.get(z.id);return e.jsxs("li",{className:`nice-expense-split__item${_?" nice-expense-split__item--excluded":""}`,children:[e.jsxs("button",{type:"button",className:"nice-expense-split__item-main",onClick:()=>p==null?void 0:p(z),disabled:!p,children:[e.jsx("span",{className:"nice-expense-split__item-label",children:z.label}),e.jsxs("span",{className:"nice-expense-split__item-payer",children:[z.paidByName??z.paidById??"nobody"," paid"]})]}),e.jsx("span",{className:"nice-expense-split__item-amount",children:ee(z.amount,z.currency,g)}),z.isPaid&&e.jsx(x.NiceBadge,{size:"xs",subtle:!0,variant:"success",children:"paid"}),_&&e.jsx(x.NiceBadge,{size:"xs",subtle:!0,variant:"warning",children:_==="no-payer"?"no payer":"unknown payer"}),u&&!C&&e.jsx(x.NiceButton,{size:"sm",variant:"ghost",ariaLabel:`Delete ${z.label}`,disabled:b,onClick:()=>u(z.id),children:e.jsx(T.NtdTrash,{size:14})})]},z.id)})}),f==="balances"&&k.groups.map(z=>e.jsxs("section",{className:"nice-expense-split__group",children:[e.jsxs("h4",{className:"nice-expense-split__group-title",children:[z.currency,e.jsxs("span",{className:"nice-expense-split__group-total",children:[ee(z.total,z.currency,g)," total"]})]}),e.jsx("ul",{className:"nice-participant-list__rows",children:z.balances.map(_=>e.jsx(Be,{participant:{id:_.participantId,name:_.participantName,avatarUrl:L.get(_.participantId)},showRole:!1,showStatus:!1,size:j,children:e.jsxs("span",{className:`nice-expense-split__balance nice-expense-split__balance--${_.amount>0?"owed":_.amount<0?"owes":"settled"}`,children:[_.amount===0?"settled up":ee(Math.abs(_.amount),_.currency,g),_.amount>0&&e.jsx("em",{children:" is owed"}),_.amount<0&&e.jsx("em",{children:" owes"})]})},_.participantId))})]},z.currency)),f==="settlement"&&(k.groups.every(z=>z.transfers.length===0)?e.jsx(me,{icon:e.jsx(T.NtdCoins,{size:28}),title:"All settled up",description:"Nobody owes anybody anything."}):k.groups.filter(z=>z.transfers.length>0).map(z=>e.jsxs("section",{className:"nice-expense-split__group",children:[e.jsxs("h4",{className:"nice-expense-split__group-title",children:[z.currency,e.jsxs("span",{className:"nice-expense-split__group-total",children:[z.transfers.length," transfer",z.transfers.length===1?"":"s"]})]}),e.jsx("ul",{className:"nice-expense-split__transfers",children:z.transfers.map(_=>e.jsxs("li",{className:"nice-expense-split__transfer",children:[e.jsx("span",{className:"nice-expense-split__transfer-from",children:_.fromName}),e.jsx(T.NtdArrowRight,{size:15}),e.jsx("span",{className:"nice-expense-split__transfer-to",children:_.toName}),e.jsx("span",{className:"nice-expense-split__transfer-amount",children:ee(_.amount,_.currency,g)}),t&&!C&&e.jsx(x.NiceButton,{size:"sm",variant:"outline",disabled:y,onClick:()=>t(_),children:"Mark paid"})]},`${_.fromId}-${_.toId}-${_.amount}`))})]},z.currency)))]})}),Es={upcoming:T.NtdClock,active:T.NtdPlay,voting:T.NtdThumbsUp,scored:T.NtdBarChart,completed:T.NtdCheck,skipped:T.NtdSkipForward},Ls={upcoming:"#9ca3af",active:"#22c55e",voting:"#eab308",scored:"#3b82f6",completed:"#6b7280",skipped:"#d1d5db"},Ds=d.forwardRef(function(s,a){const{rounds:n,activeRoundId:r,onSelect:l,onStart:o,onEnd:m,onCreate:h,editable:t=!1,className:u,style:p}=s,N=[...n].sort((v,g)=>v.order-g.order);return e.jsxs("div",{ref:a,className:`nice-round-list ${u??""}`,style:p,children:[e.jsxs("div",{className:"nice-round-list__header",children:[e.jsxs("h3",{children:["Rounds (",n.length,")"]}),t&&h&&e.jsx("button",{onClick:h,children:"+ Add Round"})]}),N.length===0?e.jsx("p",{className:"nice-round-list__empty",children:"No rounds yet."}):e.jsx("div",{className:"nice-round-list__items",children:N.map(v=>{const g=v.id===r;return e.jsxs("div",{className:`nice-round-list__item ${g?"nice-round-list__item--active":""}`,onClick:()=>l==null?void 0:l(v),role:l?"button":void 0,tabIndex:l?0:void 0,children:[e.jsxs("span",{className:"nice-round-list__order",children:["#",v.order]}),e.jsx("span",{className:"nice-round-list__icon",title:v.status,children:d.createElement(Es[v.status],{size:16})}),e.jsxs("div",{className:"nice-round-list__info",children:[e.jsx("strong",{className:"nice-round-list__name",children:v.name}),v.description&&e.jsx("small",{children:v.description}),v.type&&e.jsx("span",{className:"nice-round-list__type",children:v.type})]}),e.jsx("span",{className:"nice-round-list__status",style:{color:Ls[v.status]},children:v.status}),v.durationMinutes&&e.jsxs("span",{className:"nice-round-list__duration",children:[v.durationMinutes,"m"]}),v.winnerIds&&v.winnerIds.length>0&&e.jsxs("span",{className:"nice-round-list__winners",children:[e.jsx(T.NtdTrophy,{size:14})," ",v.winnerIds.length]}),t&&e.jsxs("div",{className:"nice-round-list__actions",onClick:b=>b.stopPropagation(),children:[v.status==="upcoming"&&o&&e.jsx("button",{onClick:()=>o(v.id),children:"Start"}),(v.status==="active"||v.status==="voting")&&m&&e.jsx("button",{onClick:()=>m(v.id),children:"End"})]})]},v.id)})})]})}),Os=["var(--nice-lb-gold, #facc15)","var(--nice-lb-silver, #cbd5e1)","var(--nice-lb-bronze, #d97706)"],Us=d.forwardRef(function(s,a){const{round:n,timerRunning:r=!1,remainingSeconds:l,onSubmitScore:o,onStart:m,onEnd:h,onSkip:t,editable:u=!1,footerActions:p,className:N,style:v}=s,[g,b]=d.useState({}),C=d.useCallback(c=>{const w=parseFloat(g[c]??"");isNaN(w)||!o||(o(c,w),b(B=>({...B,[c]:""})))},[g,o]),j=c=>{const w=Math.floor(c/60),B=c%60;return`${w}:${B.toString().padStart(2,"0")}`},I=n.scores?[...n.scores].sort((c,w)=>w.score-c.score):[];return e.jsxs("div",{ref:a,className:`nice-round-card nice-round-card--${n.status} ${N??""}`,style:v,children:[e.jsxs("div",{className:"nice-round-card__header",children:[e.jsxs("span",{className:"nice-round-card__order",children:["Round #",n.order]}),e.jsx("h3",{className:"nice-round-card__name",children:n.name}),e.jsx("span",{className:"nice-round-card__status",children:n.status})]}),n.description&&e.jsx("p",{className:"nice-round-card__description",children:n.description}),(r||l!=null)&&e.jsxs("div",{className:`nice-round-card__timer ${r?"nice-round-card__timer--running":""}`,children:[e.jsx(T.NtdClock,{size:14})," ",l!=null?j(l):"—"]}),I.length>0&&e.jsxs("div",{className:"nice-round-card__scoreboard",children:[e.jsx("h4",{children:"Scoreboard"}),e.jsxs("table",{className:"nice-round-card__scores-table",children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{children:"Rank"}),e.jsx("th",{children:"Participant"}),e.jsx("th",{children:"Score"})]})}),e.jsx("tbody",{children:I.map((c,w)=>e.jsxs("tr",{className:w<3?`nice-round-card__top-${w+1}`:"",children:[e.jsxs("td",{children:[c.rank??w+1,w<3&&e.jsxs(e.Fragment,{children:[" ",e.jsx(T.NtdMedal,{size:14,primaryColor:Os[w],"aria-label":`Place ${w+1}`})]})]}),e.jsx("td",{children:c.participantName}),e.jsx("td",{children:c.score})]},c.participantId))})]})]}),o&&(n.status==="active"||n.status==="voting")&&I.length>0&&e.jsxs("div",{className:"nice-round-card__score-input",children:[e.jsx("h4",{children:"Submit Scores"}),I.map(c=>e.jsxs("div",{className:"nice-round-card__score-row",children:[e.jsx("span",{children:c.participantName}),e.jsx("input",{type:"number",value:g[c.participantId]??"",onChange:w=>b(B=>({...B,[c.participantId]:w.target.value})),min:0,step:1,placeholder:"Score"}),e.jsx("button",{onClick:()=>C(c.participantId),children:"Submit"})]},c.participantId))]}),e.jsxs("div",{className:"nice-round-card__footer",children:[u&&e.jsxs("div",{className:"nice-round-card__actions",children:[n.status==="upcoming"&&m&&e.jsxs("button",{onClick:m,children:[e.jsx(T.NtdPlay,{size:14})," Start Round"]}),(n.status==="active"||n.status==="voting")&&h&&e.jsxs("button",{onClick:h,children:[e.jsx(T.NtdStop,{size:14})," End Round"]}),n.status==="upcoming"&&t&&e.jsxs("button",{onClick:t,children:[e.jsx(T.NtdSkipForward,{size:14})," Skip"]})]}),p]}),n.winnerIds&&n.winnerIds.length>0&&e.jsxs("div",{className:"nice-round-card__winners",children:[e.jsx(T.NtdTrophy,{size:14})," Winners: ",n.winnerIds.length]})]})}),Ys=i=>{if(!i)return"";const s=Math.floor(i/60),a=i%60;return`${s}:${a.toString().padStart(2,"0")}`},Fs=d.forwardRef(function(s,a){const{songs:n,onAdd:r,onRemove:l,onVote:o,onSearch:m,showQueue:h=!0,readOnly:t=!1,className:u,style:p}=s,{t:N}=Q.useNiceTranslation(),[v,g]=d.useState(""),b=d.useMemo(()=>{if(!v.trim())return n;const c=v.toLowerCase();return n.filter(w=>w.title.toLowerCase().includes(c)||w.artist.toLowerCase().includes(c))},[n,v]),C=d.useMemo(()=>n.filter(c=>c.isQueued),[n]),j=n.find(c=>c.isPlaying),I=c=>{g(c),m==null||m(c)};return e.jsxs("div",{ref:a,className:`nice-song-picker ${u??""}`,style:p,children:[j&&e.jsxs("div",{className:"nice-song-picker__now-playing",style:{display:"flex",alignItems:"center",gap:10,borderLeft:"4px solid var(--nice-color-primary, #3b82f6)",padding:12,marginBottom:12,background:"color-mix(in srgb, var(--nice-color-primary, #3b82f6) 10%, var(--nice-bg-primary, #ffffff))"},children:[j.albumArt&&e.jsx("img",{src:j.albumArt,alt:"",className:"nice-song-picker__album-art",style:{width:40,height:40,borderRadius:6,objectFit:"cover"}}),e.jsxs("div",{children:[e.jsxs("div",{className:"nice-song-picker__np-label",style:{fontWeight:600},children:[e.jsx(T.NtdMusic,{size:14})," ",N("songPicker.nowPlaying","Now playing")]}),e.jsx("strong",{children:j.title})," — ",e.jsx("span",{children:j.artist})]})]}),e.jsx("div",{className:"nice-song-picker__search",style:{marginBottom:12},children:e.jsx(x.NiceTextInput,{size:"sm",controlWidth:"100%",value:v,onChange:I,placeholder:N("songPicker.search","Search songs or artists…"),"aria-label":N("songPicker.search","Search songs or artists…")})}),e.jsx("div",{className:"nice-song-picker__list",children:b.length===0?e.jsx("p",{className:"nice-song-picker__empty",children:N("songPicker.noMatch","No songs found.")}):b.map(c=>e.jsxs("div",{className:`nice-song-picker__item ${c.isPlaying?"nice-song-picker__item--playing":""}`,style:{display:"flex",alignItems:"center",gap:10,padding:"8px 0",borderBottom:"1px solid var(--nice-border-color, #e5e7eb)"},children:[c.albumArt&&e.jsx("img",{src:c.albumArt,alt:"",className:"nice-song-picker__thumb",style:{width:36,height:36,borderRadius:4,objectFit:"cover"}}),e.jsxs("div",{className:"nice-song-picker__info",style:{flex:1,minWidth:0},children:[e.jsx("strong",{children:c.title})," — ",e.jsx("span",{children:c.artist}),c.duration&&e.jsx("span",{className:"nice-song-picker__duration",style:{marginLeft:8,fontSize:12,color:"var(--nice-text-muted)"},children:Ys(c.duration)}),c.addedByName&&e.jsx("div",{style:{fontSize:12,color:"var(--nice-text-secondary)"},children:N("songPicker.addedBy","Added by {name}").replace("{name}",c.addedByName)})]}),!t&&e.jsxs("div",{className:"nice-song-picker__actions",style:{display:"flex",gap:6},children:[o&&e.jsxs(x.NiceButton,{variant:"ghost",size:"sm",onClick:()=>o(c.id),"aria-label":N("songPicker.vote","Vote for {title}").replace("{title}",c.title),children:[e.jsx(T.NtdThumbsUp,{size:14})," ",c.votes??0]}),r&&!c.isQueued&&e.jsxs(x.NiceButton,{variant:"primary",size:"sm",onClick:()=>r(c.id),children:[e.jsx(T.NtdPlus,{size:14})," ",N("songPicker.addToQueue","Queue")]}),l&&c.isQueued&&e.jsx(x.NiceButton,{variant:"outline",size:"sm",onClick:()=>l(c.id),children:N("remove","Remove")})]})]},c.id))}),h&&C.length>0&&e.jsxs("div",{className:"nice-song-picker__queue",style:{marginTop:16},children:[e.jsx("h4",{children:N("songPicker.queue","Queue ({count})").replace("{count}",String(C.length))}),C.map((c,w)=>e.jsxs("div",{className:"nice-song-picker__queue-item",style:{display:"flex",gap:6,padding:"4px 0"},children:[e.jsxs("span",{className:"nice-song-picker__queue-pos",style:{fontWeight:600},children:[w+1,"."]}),e.jsxs("span",{children:[c.title," — ",c.artist]})]},c.id))]})]})}),Je={easy:"Easy",medium:"Medium",hard:"Hard",expert:"Expert"},Xs={easy:"var(--nice-color-success, #16a34a)",medium:"var(--nice-color-warning, #d97706)",hard:"var(--nice-color-error, #dc2626)",expert:"var(--nice-color-accent, #7c3aed)"},ze="all",Vs=d.forwardRef(function(s,a){const{songs:n,queue:r=[],onEnqueue:l,onDequeue:o,onNext:m,nowPlayingId:h,readOnly:t=!1,className:u,style:p}=s,{t:N}=Q.useNiceTranslation(),v=f=>f in Je?N(`karaokePicker.difficulty.${f}`,Je[f]):f,[g,b]=d.useState(""),[C,j]=d.useState(ze),I=n.find(f=>f.id===h),c=d.useMemo(()=>{let f=n;if(g.trim()){const y=g.toLowerCase();f=f.filter($=>$.title.toLowerCase().includes(y)||$.artist.toLowerCase().includes(y))}return C!==ze&&(f=f.filter(y=>y.difficulty===C)),f},[n,g,C]),w=d.useMemo(()=>new Set(r.map(f=>f.id)),[r]),B=["easy","medium","hard","expert"];return e.jsxs("div",{ref:a,className:`nice-karaoke-picker ${u??""}`,style:p,children:[I&&e.jsxs("div",{className:"nice-karaoke-picker__now-singing",style:{borderLeft:"4px solid var(--nice-color-primary, #3b82f6)",padding:"12px",marginBottom:12,background:"color-mix(in srgb, var(--nice-color-primary, #3b82f6) 10%, var(--nice-bg-primary, #ffffff))"},children:[e.jsxs("span",{style:{fontWeight:600},children:[e.jsx(T.NtdMicrophone,{size:14})," ",N("karaokePicker.nowSinging","Now Singing")]}),e.jsxs("div",{children:[e.jsx("strong",{children:I.title})," — ",I.artist,I.performerName&&e.jsxs("span",{children:[" ","(",N("karaokePicker.by","by {name}").replace("{name}",I.performerName),")"]})]}),!t&&m&&e.jsx("div",{style:{marginTop:8},children:e.jsxs(x.NiceButton,{variant:"secondary",size:"sm",onClick:m,children:[N("karaokePicker.next","Skip / Next")," ",e.jsx(T.NtdSkipForward,{size:14})]})})]}),e.jsxs("div",{className:"nice-karaoke-picker__filters",style:{display:"flex",gap:8,marginBottom:12,alignItems:"flex-end"},children:[e.jsx("div",{style:{flex:1},children:e.jsx(x.NiceTextInput,{size:"sm",controlWidth:"100%",value:g,onChange:b,placeholder:N("karaokePicker.search","Search songs or artists…"),"aria-label":N("karaokePicker.search","Search songs or artists…")})}),e.jsx("div",{style:{width:180},children:e.jsx(x.NiceSelect,{size:"sm","aria-label":N("karaokePicker.allDifficulties","All Difficulties"),value:C,onChange:f=>j((Array.isArray(f)?f[0]:f)||ze),options:[{value:ze,label:N("karaokePicker.allDifficulties","All Difficulties")},...B.map(f=>({value:f,label:v(f)}))]})})]}),e.jsx("div",{className:"nice-karaoke-picker__catalog",children:c.length===0?e.jsx("p",{children:N("karaokePicker.noMatch","No songs match your search.")}):c.map(f=>e.jsxs("div",{className:"nice-karaoke-picker__song",style:{display:"flex",justifyContent:"space-between",alignItems:"center",padding:"8px 0",borderBottom:"1px solid var(--nice-border-color, #e5e7eb)"},children:[e.jsxs("div",{children:[e.jsx("strong",{children:f.title})," — ",f.artist,f.difficulty&&e.jsxs("span",{style:{marginLeft:8,fontSize:12,color:Xs[f.difficulty]??"var(--nice-text-muted, #94a3b8)",fontWeight:600},children:["[",v(f.difficulty),"]"]}),f.hasLyrics&&e.jsx("span",{style:{marginLeft:6,fontSize:12},title:N("karaokePicker.lyrics","Lyrics available"),"aria-label":N("karaokePicker.lyrics","Lyrics available"),children:e.jsx(T.NtdFileText,{size:12})}),f.language&&e.jsxs("span",{style:{marginLeft:6,fontSize:12,color:"var(--nice-text-secondary, #475569)"},children:["(",f.language,")"]})]}),!t&&e.jsx("div",{children:w.has(f.id)?e.jsx(x.NiceButton,{variant:"outline",size:"sm",onClick:()=>o==null?void 0:o(f.id),children:N("remove","Remove")}):e.jsxs(x.NiceButton,{variant:"primary",size:"sm",onClick:()=>l==null?void 0:l(f.id),children:[e.jsx(T.NtdMicrophone,{size:14})," ",N("karaokePicker.sing","Sing")]})})]},f.id))}),r.length>0&&e.jsxs("div",{className:"nice-karaoke-picker__queue",style:{marginTop:16},children:[e.jsxs("h4",{children:[e.jsx(T.NtdMusic,{size:14})," ",N("karaokePicker.queue","Queue ({count})").replace("{count}",String(r.length))]}),r.map((f,y)=>e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",padding:"4px 0"},children:[e.jsxs("span",{children:[e.jsxs("strong",{children:[y+1,"."]})," ",f.title," — ",f.artist,f.performerName&&e.jsxs("em",{children:[" (",f.performerName,")"]})]}),!t&&o&&e.jsx(x.NiceButton,{variant:"ghost",size:"xs",onClick:()=>o(f.id),"aria-label":`${N("remove","Remove")} ${f.title}`,children:e.jsx(T.NtdClose,{size:12})})]},f.id))]})]})}),en={game:T.NtdGamepad,music:T.NtdMusic,dance:T.NtdMusic,quiz:T.NtdHelp,karaoke:T.NtdMicrophone,photo:T.NtdCamera,custom:T.NtdSparkle},Ws={game:"Games",music:"Music",dance:"Dance",quiz:"Quiz",karaoke:"Karaoke",photo:"Photo",custom:"Custom"},qs=d.forwardRef(function(s,a){const{attractions:n,onSelect:r,onDeselect:l,onVote:o,selectedIds:m=[],maxSelections:h,showVotes:t=!0,readOnly:u=!1,layout:p="grid",className:N,style:v}=s,[g,b]=d.useState(""),[C,j]=d.useState(""),I=d.useMemo(()=>new Set(m),[m]),c=d.useMemo(()=>{const y=new Set(n.map($=>$.category));return Array.from(y)},[n]),w=d.useMemo(()=>{let y=n;if(g&&(y=y.filter($=>$.category===g)),C.trim()){const $=C.toLowerCase();y=y.filter(k=>{var R;return k.name.toLowerCase().includes($)||((R=k.description)==null?void 0:R.toLowerCase().includes($))})}return y},[n,g,C]),B=!h||I.size<h,f=y=>{u||(I.has(y)?l==null||l(y):B&&(r==null||r(y)))};return e.jsxs("div",{ref:a,className:`nice-attraction-picker ${N??""}`,style:{color:"var(--nice-text-primary)",...v},children:[e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:12},children:[e.jsx("h3",{style:{margin:0},children:"Attractions"}),h&&e.jsxs("span",{style:{color:"var(--nice-text-secondary, #64748b)",fontSize:14},children:[I.size,"/",h," selected"]})]}),e.jsxs("div",{style:{display:"flex",gap:8,marginBottom:12,flexWrap:"wrap"},children:[e.jsx("input",{type:"text",value:C,onChange:y=>j(y.target.value),placeholder:"Search attractions…",style:{flex:1,minWidth:150}}),e.jsx("button",{onClick:()=>b(""),style:{fontWeight:g?400:700},children:"All"}),c.map(y=>e.jsxs("button",{onClick:()=>b(y===g?"":y),style:{fontWeight:y===g?700:400,display:"inline-flex",alignItems:"center",gap:4},children:[d.createElement(en[y],{size:14})," ",Ws[y]]},y))]}),e.jsx("div",{style:{display:p==="grid"?"grid":"flex",gridTemplateColumns:p==="grid"?"repeat(auto-fill, minmax(200px, 1fr))":void 0,gap:12,flexDirection:p==="list"?"column":void 0},children:w.length===0?e.jsx("p",{children:"No attractions found."}):w.map(y=>{const $=I.has(y.id);return e.jsxs("div",{className:"nice-attraction-picker__card",style:{border:$?"2px solid var(--nice-color-primary, #6366f1)":"1px solid var(--nice-border-color, #cbd5e1)",borderRadius:8,padding:12,cursor:u?"default":"pointer",background:$?"color-mix(in srgb, var(--nice-color-primary) 12%, transparent)":"var(--nice-bg-elevated, var(--nice-bg-primary))",transition:"all 0.2s"},onClick:()=>f(y.id),children:[y.imageUrl&&e.jsx("img",{src:y.imageUrl,alt:y.name,style:{width:"100%",borderRadius:6,marginBottom:8,objectFit:"cover",maxHeight:120}}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6},children:[e.jsx("span",{style:{display:"inline-flex"},children:d.createElement(en[y.category],{size:16})}),e.jsx("strong",{children:y.name})]}),y.description&&e.jsx("p",{style:{fontSize:13,color:"var(--nice-text-secondary, #64748b)",margin:"6px 0"},children:y.description}),e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginTop:8},children:[t&&e.jsxs("span",{style:{fontSize:13,display:"inline-flex",alignItems:"center",gap:4},children:[e.jsx(T.NtdThumbsUp,{size:14})," ",y.votes??0]}),!u&&o&&e.jsx("button",{onClick:k=>{k.stopPropagation(),o(y.id)},style:{fontSize:12},children:"Vote"})]})]},y.id)})})]})}),Gs={game:T.NtdGamepad,music:T.NtdMusic,dance:T.NtdMusic,quiz:T.NtdHelp,karaoke:T.NtdMicrophone,photo:T.NtdCamera,custom:T.NtdSparkle},Ks=d.forwardRef(function(s,a){const{attractions:n,onVote:r,onUnvote:l,votedIds:o=[],maxVotes:m,closed:h=!1,sortBy:t="votes",showResults:u=!0,className:p,style:N}=s,v=d.useMemo(()=>new Set(o),[o]),g=m?m-v.size:void 0,b=d.useMemo(()=>{const c=[...n];switch(t){case"votes":c.sort((w,B)=>(B.votes??0)-(w.votes??0));break;case"name":c.sort((w,B)=>w.name.localeCompare(B.name));break;case"category":c.sort((w,B)=>w.category.localeCompare(B.category));break}return c},[n,t]),C=d.useMemo(()=>Math.max(...n.map(c=>c.votes??0),1),[n]),j=c=>{h||(v.has(c)?l==null||l(c):(!g||g>0)&&(r==null||r(c)))},I=c=>{switch(c){case 0:return e.jsx(T.NtdTrophy,{size:18,primaryColor:"#f59e0b",title:"1st place"});case 1:return e.jsx(T.NtdMedal,{size:18,primaryColor:"#94a3b8",title:"2nd place"});case 2:return e.jsx(T.NtdMedal,{size:18,primaryColor:"#b45309",title:"3rd place"});default:return`${c+1}.`}};return e.jsxs("div",{ref:a,className:`nice-attraction-voting ${p??""}`,style:{color:"var(--nice-text-primary)",...N},children:[e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:16},children:[e.jsxs("h3",{style:{margin:0,display:"inline-flex",alignItems:"center",gap:8},children:[e.jsx(T.NtdClipboardCheck,{size:20}),h?"Voting Results":"Vote for Attractions"]}),!h&&g!==void 0&&e.jsxs("span",{style:{fontSize:14,color:g>0?"var(--nice-color-primary, #6366f1)":"var(--nice-color-error, #ef4444)"},children:[g," vote",g!==1?"s":""," remaining"]})]}),h&&e.jsx("p",{style:{color:"var(--nice-text-secondary, #64748b)",marginBottom:12},children:"Voting is closed. Final results:"}),e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:8},children:b.map((c,w)=>{const B=v.has(c.id),f=c.votes??0,y=u?`${Math.round(f/C*100)}%`:"0%";return e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12,padding:"10px 14px",borderRadius:8,border:B?"2px solid var(--nice-color-primary, #6366f1)":"1px solid var(--nice-border-color, #cbd5e1)",background:B?"color-mix(in srgb, var(--nice-color-primary) 12%, transparent)":"var(--nice-bg-elevated, var(--nice-bg-primary))",cursor:h?"default":"pointer",transition:"all 0.2s"},onClick:()=>j(c.id),children:[u&&e.jsx("span",{style:{fontSize:18,minWidth:32,textAlign:"center"},children:I(w)}),e.jsx("span",{style:{display:"inline-flex",fontSize:20},children:d.createElement(Gs[c.category],{size:20})}),e.jsxs("div",{style:{flex:1,minWidth:0},children:[e.jsx("div",{style:{fontWeight:600},children:c.name}),c.description&&e.jsx("div",{style:{fontSize:13,color:"var(--nice-text-secondary, #64748b)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:c.description}),u&&e.jsx("div",{style:{marginTop:4,height:6,borderRadius:3,background:"var(--nice-bg-tertiary, #e2e8f0)",overflow:"hidden"},children:e.jsx("div",{style:{height:"100%",width:y,background:"var(--nice-color-primary, #6366f1)",borderRadius:3,transition:"width 0.3s"}})})]}),u&&e.jsx("span",{style:{fontWeight:600,fontSize:16,minWidth:40,textAlign:"right"},children:f}),!h&&e.jsx("button",{onClick:$=>{$.stopPropagation(),j(c.id)},style:{padding:"4px 12px",borderRadius:4,border:"none",background:B?"var(--nice-color-error, #ef4444)":"var(--nice-color-primary, #6366f1)",color:"#fff",cursor:"pointer",fontSize:13},children:B?"Unvote":"Vote"})]},c.id)})}),u&&e.jsxs("div",{style:{marginTop:12,textAlign:"right",fontSize:13,color:"var(--nice-text-secondary, #64748b)"},children:["Total votes: ",n.reduce((c,w)=>c+(w.votes??0),0)]})]})});exports.NiceAttractionPicker=qs;exports.NiceAttractionVoting=Ks;exports.NiceEventMedia=En;exports.NiceEventPlanning=Un;exports.NiceExpenseSplit=Rs;exports.NiceGiftRegistry=Cs;exports.NiceInvitationDesigner=ks;exports.NiceKaraokePicker=Vs;exports.NiceMediaCollage=Dn;exports.NiceParticipantList=Gn;exports.NiceRoundCard=Us;exports.NiceRoundList=Ds;exports.NiceRsvpControl=$e;exports.NiceSeatPicker=gs;exports.NiceSeatingChart=rn;exports.NiceSongPicker=Fs;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),z=require("@nice2dev/icons"),N=require("@nice2dev/ui"),F=require("@nice2dev/ui-core"),l=require("react");function Bn(i){return i.map((s,a)=>({item:s,index:a,key:s.order??a})).sort((s,a)=>s.key-a.key||s.index-a.index).map(s=>s.item)}function We(i,s,a){if(s===a)return[...i];if(s<0||s>=i.length)return[...i];if(a<0||a>=i.length)return[...i];const n=[...i],[t]=n.splice(s,1);return n.splice(a,0,t),n}function tn(i){const{items:s,onReorder:a,disabled:n=!1}=i,[t,d]=l.useState(null),[o,u]=l.useState(null),[f,c]=l.useState(!1),r=l.useRef(null),m=l.useCallback(x=>s.findIndex(P=>P.id===x),[s]),h=l.useCallback((x,P)=>{const b=m(x),A=m(P);b<0||A<0||b===A||a==null||a(We([...s],b,A).map(v=>v.id))},[s,m,a]),T=l.useCallback(()=>{d(null),u(null),c(!1),r.current=null},[]),g=l.useCallback((x,P)=>({role:"button",draggable:!1,tabIndex:n?-1:0,"aria-grabbed":t===x,onPointerDown:b=>{var p,M;if(n||b.button!==0&&b.pointerType==="mouse")return;(M=(p=b.currentTarget).setPointerCapture)==null||M.call(p,b.pointerId),d(x),c(!0),r.current=s.map(_=>_.id);const A=()=>{window.removeEventListener("pointerup",A),window.removeEventListener("pointercancel",v),c(!1),d(null),u(null)},v=()=>{window.removeEventListener("pointerup",A),window.removeEventListener("pointercancel",v),r.current&&(a==null||a(r.current)),T()};window.addEventListener("pointerup",A),window.addEventListener("pointercancel",v)},onPointerEnter:()=>{n||!t||t===x||(u(x),h(t,x))},onKeyDown:b=>{if(n)return;if(b.key===" "||b.key==="Enter"){b.preventDefault(),t===x?T():(d(x),r.current=s.map(_=>_.id));return}if(b.key==="Escape"&&t===x){b.preventDefault(),r.current&&(a==null||a(r.current)),T();return}if(t!==x)return;const v=b.key==="ArrowLeft"||b.key==="ArrowUp"?-1:b.key==="ArrowRight"||b.key==="ArrowDown"?1:0;if(v===0)return;b.preventDefault();const p=m(x),M=p+v;M<0||M>=s.length||a==null||a(We([...s],p,M).map(_=>_.id))},...P?{"aria-label":P}:{}}),[t,h,n,T,m,s,a]);return{activeId:t,overId:o,getHandleProps:g,dragging:f}}const $n=({item:i})=>{const{t:s}=F.useNiceTranslation(),[a,n]=l.useState(!1),t=i.thumbnailUrl??i.url;return i.type==="video"?e.jsx("div",{className:"nice-event-media__video-thumb",children:e.jsx(z.NtdPlay,{size:26})}):a||!t?e.jsx("div",{className:"nice-event-media__broken",title:s("eventMedia.imageUnavailable","Image unavailable"),children:e.jsx(z.NtdImage,{size:24})}):e.jsx("img",{src:t,alt:i.caption??"",className:"nice-event-media__thumb",loading:"lazy",onError:()=>n(!0)})},Ln=[],En=l.forwardRef(function(s,a){const{t:n}=F.useNiceTranslation(),{items:t=Ln,onUpload:d,onDelete:o,onLike:u,onItemClick:f,layout:c="grid",uploadEnabled:r=!0,typeFilter:m="all",onReorder:h,className:T,style:g}=s,[x,P]=l.useState(""),b=l.useMemo(()=>Bn(t),[t]),A=l.useMemo(()=>m==="all"?b:b.filter(R=>R.type===m),[b,m]),v=!!h&&m==="all",p=tn({items:b,onReorder:h,disabled:!v}),M=R=>{const k=R[0];!k||!d||(d(k,x.trim()||void 0),P(""))},_=c==="list";return e.jsxs("div",{ref:a,className:`nice-event-media nice-event-media--${c} ${T??""}`,style:g,children:[e.jsx("div",{className:"nice-event-media__header",children:e.jsxs("h3",{children:["Media (",A.length,")"]})}),r&&d&&e.jsxs("div",{className:"nice-event-media__upload",children:[e.jsx(N.NiceUpload,{accept:"image/*,video/*",multiple:!1,imagePreview:!1,onFilesSelected:M}),e.jsx(N.NiceTextInput,{value:x,onChange:P,placeholder:n("eventMedia.addACaption","Add a caption…")})]}),A.length===0?e.jsx("p",{className:"nice-event-media__empty",children:n("eventMedia.noMediaYet","No media yet.")}):e.jsx(N.NiceCardGroup,{columns:_?1:void 0,minColumnWidth:200,gap:12,align:"stretch",children:A.map((R,k)=>{const j=v?p.getHandleProps(R.id,n("eventMedia.moveItem","Move {name}").replace("{name}",R.caption??n("eventMedia.itemN","item {n}").replace("{n}",String(k+1)))):null;return e.jsxs("div",{className:`nice-event-media__card${_?" nice-event-media__card--row":""}${p.activeId===R.id?" nice-event-media__card--dragging":""}`,onClick:()=>f==null?void 0:f(R),onKeyDown:C=>{f&&C.target===C.currentTarget&&(C.key==="Enter"||C.key===" ")&&(C.preventDefault(),f(R))},onPointerEnter:j==null?void 0:j.onPointerEnter,role:f?"button":void 0,tabIndex:f?0:void 0,children:[j&&e.jsx("span",{className:"nice-event-media__grip",role:j.role,tabIndex:j.tabIndex,"aria-grabbed":j["aria-grabbed"],"aria-label":j["aria-label"],draggable:j.draggable,onPointerDown:j.onPointerDown,onKeyDown:j.onKeyDown,onClick:C=>C.stopPropagation(),children:e.jsx(z.NtdMove,{size:14})}),e.jsx($n,{item:R}),e.jsxs("div",{className:"nice-event-media__body",children:[R.caption&&e.jsx("span",{className:"nice-event-media__caption",children:R.caption}),R.uploadedByName&&e.jsx("span",{className:"nice-event-media__uploader",children:R.uploadedByName}),e.jsxs("div",{className:"nice-event-media__actions",children:[u&&e.jsxs("button",{type:"button",className:"nice-event-media__action",onClick:C=>{C.stopPropagation(),u(R.id)},"aria-label":n("eventMedia.like","Like"),children:[e.jsx(z.NtdHeart,{size:15})," ",R.likes??0]}),o&&e.jsx("button",{type:"button",className:"nice-event-media__action nice-event-media__action--danger",onClick:C=>{C.stopPropagation(),o(R.id)},"aria-label":n("eventMedia.delete","Delete"),children:e.jsx(z.NtdTrash,{size:15})})]})]})]},R.id)})})]})}),pe=({title:i,description:s,icon:a,action:n,className:t})=>e.jsx(N.NiceEmpty,{size:"sm",title:i,description:s,icon:a,action:n,className:t}),Dn=[],On=l.forwardRef(function(s,a){const{t:n}=F.useNiceTranslation(),{items:t=Dn,layout:d="grid",onReorder:o,onItemAdd:u,onItemRemove:f,onCaptionChange:c,onItemClick:r,previewMode:m=!1,transition:h="fade",defaultDurationMs:T=3e3,autoPlay:g=!0,disabled:x=!1,readOnly:P=!1,size:b="md",className:A,style:v}=s,[p,M]=l.useState(0),[_,R]=l.useState(null),[k,j]=l.useState(""),C=x||P,O=!!o&&!C,V=tn({items:t,onReorder:o,disabled:!O}),E=t.length>0?Math.min(p,t.length-1):0,L=t[E],X=(L==null?void 0:L.durationMs)??T;l.useEffect(()=>{if(!m||!g||t.length<2)return;const B=window.setTimeout(()=>M(G=>(G+1)%t.length),Math.max(250,X));return()=>window.clearTimeout(B)},[m,g,t.length,E,X]);const S=l.useMemo(()=>t.reduce((B,G)=>B+(G.durationMs??T),0),[t,T]),y=B=>{c==null||c(B,k),R(null),j("")};return t.length===0?e.jsx("div",{ref:a,className:`nice-media-collage ${A??""}`,style:v,children:e.jsx(pe,{icon:e.jsx(z.NtdImage,{size:28}),title:n("mediaCollage.nothingInTheCollageYet","Nothing in the collage yet"),description:n("mediaCollage.addPhotosOrVideoTo","Add photos or video to start arranging them."),action:u&&!C?e.jsx(N.NiceUpload,{accept:"image/*,video/*",multiple:!0,onFilesSelected:u}):void 0})}):m?e.jsxs("div",{ref:a,className:`nice-media-collage nice-media-collage--preview nice-media-collage--${h} ${A??""}`,style:v,children:[e.jsxs("div",{className:"nice-media-collage__stage","aria-live":"polite",children:[(L==null?void 0:L.type)==="video"?e.jsx("video",{className:"nice-media-collage__slide",src:L.mediaUrl,controls:!0},L.id):e.jsx("img",{className:"nice-media-collage__slide",src:L==null?void 0:L.mediaUrl,alt:(L==null?void 0:L.caption)??""},L==null?void 0:L.id),(L==null?void 0:L.caption)&&e.jsx("p",{className:"nice-media-collage__slide-caption",children:L.caption})]}),e.jsxs("div",{className:"nice-media-collage__playbar",children:[e.jsx(N.NiceButton,{size:"sm",variant:"ghost",onClick:()=>M(B=>(B-1+t.length)%t.length),children:n("mediaCollage.previous","Previous")}),e.jsxs("span",{className:"nice-media-collage__counter",children:[E+1," / ",t.length]}),e.jsx(N.NiceButton,{size:"sm",variant:"ghost",onClick:()=>M(B=>(B+1)%t.length),children:n("mediaCollage.next","Next")})]})]}):e.jsxs("div",{ref:a,className:`nice-media-collage nice-media-collage--${d} nice-media-collage--${b} ${A??""}`,style:v,children:[e.jsxs("div",{className:"nice-media-collage__toolbar",children:[e.jsx(N.NiceSegmentedControl,{size:"sm",value:d,readOnly:!0,options:[{value:"sequence",label:n("mediaCollage.sequence","Sequence")},{value:"grid",label:n("mediaCollage.grid","Grid")},{value:"mosaic",label:n("mediaCollage.mosaic","Mosaic")}]}),e.jsxs("span",{className:"nice-media-collage__duration",children:[t.length," item",t.length===1?"":"s"," · ",Math.round(S/1e3),"s"]}),u&&!C&&e.jsx(N.NiceUpload,{accept:"image/*,video/*",multiple:!0,imagePreview:!1,onFilesSelected:u})]}),e.jsx("ol",{className:"nice-media-collage__tiles","aria-label":n("mediaCollage.collageOrder","Collage order"),"aria-busy":V.dragging,children:t.map((B,G)=>{const q=O?V.getHandleProps(B.id,n("mediaCollage.moveItem","Move {name}").replace("{name}",B.caption??n("mediaCollage.itemN","item {n}").replace("{n}",String(G+1)))):null;return e.jsxs("li",{className:`nice-media-collage__tile${V.activeId===B.id?" nice-media-collage__tile--active":""}${V.overId===B.id?" nice-media-collage__tile--over":""}`,onPointerEnter:q==null?void 0:q.onPointerEnter,children:[e.jsx("span",{className:"nice-media-collage__index","aria-hidden":"true",children:G+1}),e.jsx("button",{type:"button",className:"nice-media-collage__thumb-button",onClick:()=>r==null?void 0:r(B),disabled:!r,children:B.type==="video"?e.jsx("span",{className:"nice-media-collage__video-thumb",children:e.jsx(z.NtdPlay,{size:22})}):e.jsx("img",{className:"nice-media-collage__thumb",src:B.mediaUrl,alt:B.caption??"",loading:"lazy"})}),_===B.id?e.jsx(N.NiceTextInput,{value:k,onChange:j,placeholder:n("mediaCollage.caption","Caption"),autoFocus:!0,size:"sm",onBlur:()=>y(B.id),onKeyDown:I=>{I.key==="Enter"&&y(B.id),I.key==="Escape"&&R(null)}}):e.jsx("button",{type:"button",className:"nice-media-collage__caption",disabled:!c||C,onClick:()=>{R(B.id),j(B.caption??"")},children:B.caption||e.jsx("em",{children:n("mediaCollage.addACaption","Add a caption")})}),e.jsxs("div",{className:"nice-media-collage__tile-actions",children:[q&&e.jsx("span",{className:"nice-media-collage__grip",role:q.role,tabIndex:q.tabIndex,"aria-grabbed":q["aria-grabbed"],"aria-label":q["aria-label"],draggable:q.draggable,onPointerDown:q.onPointerDown,onKeyDown:q.onKeyDown,children:e.jsx(z.NtdMove,{size:14})}),f&&!P&&e.jsx(N.NiceButton,{size:"sm",variant:"ghost",ariaLabel:n("mediaCollage.removeItem","Remove {name}").replace("{name}",B.caption??n("mediaCollage.itemN","item {n}").replace("{n}",String(G+1))),disabled:x,onClick:()=>f(B.id),children:e.jsx(z.NtdTrash,{size:14})})]})]},B.id)})}),u&&!C&&t.length>0&&e.jsxs("p",{className:"nice-media-collage__hint",children:[e.jsx(z.NtdPlus,{size:12})," ",n("mediaCollage.dragATileOrFocus","Drag a tile, or focus one and press Space then the arrow keys.")]})]})});function Ie(i){const s=i.toLowerCase();return["active","live","published","completed","confirmed"].includes(s)?"success":["cancelled","canceled","rejected","failed"].includes(s)?"error":["scheduled","pending","planning"].includes(s)?"info":["draft","archived"].includes(s)?"secondary":"warning"}const Yn={micro:[],compact:["details","location","budget"],normal:["details","location","schedule","participants","tasks","surveys","budget"],full:["details","location","schedule","participants","tasks","surveys","vendors","budget","documents","settings"]},Un=l.forwardRef(function(s,a){var Ye,Ue,Ve,Fe,Xe,qe;const{t:n}=F.useNiceTranslation(),{event:t,participants:d=[],surveys:o=[],billing:u=[],scheduleItems:f=[],tasks:c=[],vendors:r=[],documents:m=[],displayMode:h="normal",tabs:T,activeTab:g,onTabChange:x,tabsIconOnly:P=!0,tabsCentered:b="auto",countLocation:A="bottom",showDetails:v=!0,showLocation:p=!0,showSchedule:M=!0,showParticipants:_=!0,showTasks:R=!0,showSurveys:k=!0,showVendors:j=!0,showBudget:C=!0,showDocuments:O=!0,showSettings:V=!0,editable:E=!1,onSave:L,onPublish:X,onShare:S,onExport:y,onUpdateEvent:B,onUpdateLocation:G,onAddSurvey:q,onSurveyRespond:I,onAddBilling:U,className:W,style:Q}=s,[Y,J]=l.useState(t.title),[H,he]=l.useState(t.description??""),[se,oe]=l.useState(t.startDate??""),[ge,Ce]=l.useState(t.endDate??""),[xe,le]=l.useState(((Ye=t.location)==null?void 0:Ye.name)??""),[ve,Ae]=l.useState(((Ue=t.location)==null?void 0:Ue.address)??""),[de,ae]=l.useState(((Ve=t.location)==null?void 0:Ve.virtualUrl)??""),[te,_e]=l.useState(((Fe=t.location)==null?void 0:Fe.isVirtual)??!1),[ue,je]=l.useState(""),[me,Re]=l.useState("single"),[ye,be]=l.useState(""),[ce,ke]=l.useState(""),[fe,$]=l.useState(""),[D,K]=l.useState("PLN"),Z={details:v,location:p,schedule:M,participants:_,tasks:R,surveys:k,vendors:j,budget:C,documents:O,settings:V},re=(T??Yn[h]).filter(w=>Z[w]!==!1),[Se,ln]=l.useState(re[0]??"details"),dn=g??Se,un=l.useCallback(w=>{const ie=w;g===void 0&&ln(ie),x==null||x(ie)},[g,x]),mn=l.useCallback(()=>{B==null||B({title:Y,description:H||void 0,startDate:se||void 0,endDate:ge||void 0})},[Y,H,se,ge,B]),pn=l.useCallback(()=>{G==null||G({name:xe,address:ve||void 0,virtualUrl:de||void 0,isVirtual:te})},[xe,ve,de,te,G]),hn=l.useCallback(()=>{if(!ue.trim()||!q)return;const w=ye.split(",").map(ie=>ie.trim()).filter(Boolean);q(ue.trim(),me,w.length>0?w:void 0),je(""),be("")},[ue,me,ye,q]),gn=l.useCallback(()=>{!ce.trim()||!U||(U({label:ce.trim(),amount:parseFloat(fe)||0,currency:D}),ke(""),$(""))},[ce,fe,D,U]),xn=l.useMemo(()=>u.map(w=>({label:w.label,amount:w.amount})),[u]),vn=l.useMemo(()=>u.reduce((w,ie)=>w+ie.amount,0),[u]),fn=((Xe=u[0])==null?void 0:Xe.currency)??"PLN",Nn=e.jsxs("div",{className:"nice-event-planning__form",children:[e.jsx(N.NiceTextInput,{label:n("eventPlanning.title","Title"),value:Y,onChange:J,readOnly:!E}),e.jsx(N.NiceTextArea,{label:n("eventPlanning.description","Description"),value:H,onChange:he,readOnly:!E,rows:3}),e.jsxs("div",{className:"nice-event-planning__row",children:[e.jsxs("label",{className:"nice-field",children:[e.jsx("span",{className:"nice-field__label",children:n("eventPlanning.start","Start")}),e.jsx("input",{className:"nice-input",type:"datetime-local",value:se,onChange:w=>oe(w.target.value),readOnly:!E})]}),e.jsxs("label",{className:"nice-field",children:[e.jsx("span",{className:"nice-field__label",children:"End"}),e.jsx("input",{className:"nice-input",type:"datetime-local",value:ge,onChange:w=>Ce(w.target.value),readOnly:!E})]})]}),E&&e.jsx(N.NiceButton,{variant:"primary",leftIcon:e.jsx(F.NiceIcon,{name:"check",size:"sm"}),onClick:mn,children:n("eventPlanning.saveDetails","Save details")})]}),_n=e.jsxs("div",{className:"nice-event-planning__form",children:[e.jsx(N.NiceToggle,{label:n("eventPlanning.virtualEvent","Virtual event"),checked:te,onChange:_e,disabled:!E}),e.jsx(N.NiceTextInput,{label:n("eventPlanning.venueName","Venue name"),value:xe,onChange:le,readOnly:!E}),te?e.jsx(N.NiceTextInput,{label:n("eventPlanning.virtualUrl","Virtual URL"),value:de,onChange:ae,readOnly:!E}):e.jsx(N.NiceTextInput,{label:n("eventPlanning.address","Address"),value:ve,onChange:Ae,readOnly:!E}),E&&e.jsx(N.NiceButton,{variant:"primary",leftIcon:e.jsx(F.NiceIcon,{name:"check",size:"sm"}),onClick:pn,children:n("eventPlanning.saveLocation","Save location")})]}),jn=e.jsx("div",{className:"nice-event-planning__participants",children:d.length===0?e.jsx("p",{className:"nice-event-planning__empty",children:n("eventPlanning.noParticipantsYet","No participants yet.")}):e.jsxs(e.Fragment,{children:[e.jsx(N.NiceAvatarGroup,{max:8,children:d.map(w=>e.jsx(N.NiceAvatar,{name:w.name,src:w.avatarUrl},w.id))}),e.jsx("ul",{className:"nice-event-planning__participant-list",children:d.map(w=>e.jsxs("li",{className:"nice-event-planning__participant",children:[e.jsx(N.NiceAvatar,{name:w.name,src:w.avatarUrl,size:"sm"}),e.jsx("span",{className:"nice-event-planning__participant-name",children:w.name}),e.jsx(N.NiceBadge,{size:"xs",subtle:!0,variant:Ie(w.status),children:n(`participantList.status.${w.status}`,w.status)})]},w.id))})]})}),yn=e.jsxs("div",{className:"nice-event-planning__form",children:[o.length===0?e.jsx("p",{className:"nice-event-planning__empty",children:n("eventPlanning.noSurveysYet","No surveys yet.")}):o.map(w=>e.jsxs("div",{className:"nice-event-planning__survey",children:[e.jsx("strong",{children:w.question})," ",e.jsx(N.NiceBadge,{size:"xs",outline:!0,variant:"info",children:n(`eventPlanning.surveyType.${w.type}`,w.type)}),w.options&&e.jsx("div",{className:"nice-event-planning__survey-options",children:w.options.map((ie,Rn)=>e.jsx(N.NiceButton,{size:"sm",variant:"outline",onClick:()=>I==null?void 0:I(w.id,ie),children:ie},Rn))}),w.responses&&e.jsxs("span",{className:"nice-event-planning__muted",children:[w.responses.length," responses"]})]},w.id)),E&&q&&e.jsxs("div",{className:"nice-event-planning__form",children:[e.jsx(N.NiceTextInput,{label:n("eventPlanning.newSurveyQuestion","New survey question"),value:ue,onChange:je,placeholder:n("eventPlanning.question","Question")}),e.jsx(N.NiceSelect,{label:n("eventPlanning.type","Type"),value:me,onChange:w=>Re(w),options:[{value:"single",label:n("eventPlanning.singleChoice","Single choice")},{value:"multiple",label:n("eventPlanning.multipleChoice","Multiple choice")},{value:"text",label:n("eventPlanning.freeText","Free text")},{value:"rating",label:n("eventPlanning.rating","Rating")}]}),e.jsx(N.NiceTextInput,{label:n("eventPlanning.optionsCommaSeparated","Options (comma-separated)"),value:ye,onChange:be,placeholder:n("eventPlanning.yesNoMaybe","Yes, No, Maybe")}),e.jsx(N.NiceButton,{variant:"primary",leftIcon:e.jsx(F.NiceIcon,{name:"plus",size:"sm"}),onClick:hn,disabled:!ue.trim(),children:n("eventPlanning.addSurvey","Add survey")})]})]}),bn=e.jsxs("div",{className:"nice-event-planning__form",children:[u.length===0?e.jsx("p",{className:"nice-event-planning__empty",children:n("eventPlanning.noBillingItemsYet","No billing items yet.")}):e.jsx(N.NiceAmountBreakdown,{lines:[...xn,{label:n("eventPlanning.total","Total"),amount:vn,isSummary:!0}],currency:fn}),E&&U&&e.jsxs("div",{className:"nice-event-planning__row",children:[e.jsx(N.NiceTextInput,{label:n("eventPlanning.item","Item"),value:ce,onChange:ke,placeholder:n("eventPlanning.catering","Catering")}),e.jsx(N.NiceTextInput,{label:n("eventPlanning.amount","Amount"),value:fe,onChange:$,placeholder:"0.00"}),e.jsx(N.NiceSelect,{label:n("eventPlanning.currency","Currency"),value:D,onChange:w=>K(w),options:["PLN","EUR","USD","GBP"]}),e.jsx(N.NiceButton,{variant:"primary",leftIcon:e.jsx(F.NiceIcon,{name:"plus",size:"sm"}),onClick:gn,disabled:!ce.trim(),children:"Add"})]})]}),kn=e.jsxs("div",{className:"nice-event-planning__form",children:[e.jsx(N.NiceToggle,{label:n("eventPlanning.publicEvent","Public event"),checked:t.isPublic??!1,disabled:!E}),e.jsx(N.NiceTextInput,{label:n("eventPlanning.maxParticipants","Max participants"),value:t.maxParticipants!=null?String(t.maxParticipants):"",onChange:()=>{},readOnly:!E}),e.jsxs("div",{className:"nice-event-planning__muted",children:["Host: ",t.hostName," · Created ",new Date(t.createdAt).toLocaleDateString()]})]}),wn=e.jsx("div",{className:"nice-event-planning__list",children:f.length===0?e.jsx("p",{className:"nice-event-planning__empty",children:n("eventPlanning.noAgendaItemsYet","No agenda items yet.")}):e.jsx("ul",{className:"nice-event-planning__schedule",children:f.map(w=>e.jsxs("li",{className:"nice-event-planning__schedule-item",children:[e.jsxs("span",{className:"nice-event-planning__schedule-time",children:[e.jsx(F.NiceIcon,{name:"clock",size:"sm"}),w.startTime??"",w.endTime?`–${w.endTime}`:""]}),e.jsx("span",{className:"nice-event-planning__schedule-title",children:w.title}),w.location&&e.jsx("span",{className:"nice-event-planning__muted",children:w.location})]},w.id))})}),Cn=e.jsx("div",{className:"nice-event-planning__list",children:c.length===0?e.jsx("p",{className:"nice-event-planning__empty",children:n("eventPlanning.noTasksYet","No tasks yet.")}):e.jsx("ul",{className:"nice-event-planning__tasks",children:c.map(w=>e.jsxs("li",{className:"nice-event-planning__task",children:[e.jsx(N.NiceToggle,{label:w.title,checked:w.done??!1,disabled:!E}),w.assigneeName&&e.jsx(N.NiceBadge,{size:"xs",subtle:!0,variant:"info",children:w.assigneeName}),w.dueDate&&e.jsx("span",{className:"nice-event-planning__muted",children:w.dueDate})]},w.id))})}),Sn=e.jsx("div",{className:"nice-event-planning__list",children:r.length===0?e.jsx("p",{className:"nice-event-planning__empty",children:n("eventPlanning.noVendorsYet","No vendors yet.")}):e.jsx("ul",{className:"nice-event-planning__vendors",children:r.map(w=>e.jsxs("li",{className:"nice-event-planning__vendor",children:[e.jsx(F.NiceIcon,{name:"briefcase",size:"sm"}),e.jsx("span",{className:"nice-event-planning__vendor-name",children:w.name}),w.category&&e.jsx("span",{className:"nice-event-planning__muted",children:w.category}),w.status&&e.jsx(N.NiceBadge,{size:"xs",subtle:!0,variant:Ie(w.status),children:n(`eventPlanning.vendorStatus.${w.status}`,w.status)}),w.cost!=null&&e.jsxs("span",{className:"nice-event-planning__vendor-cost",children:[w.cost," ",w.currency??""]})]},w.id))})}),In=e.jsx("div",{className:"nice-event-planning__list",children:m.length===0?e.jsx("p",{className:"nice-event-planning__empty",children:n("eventPlanning.noDocumentsYet","No documents yet.")}):e.jsx("ul",{className:"nice-event-planning__documents",children:m.map(w=>e.jsxs("li",{className:"nice-event-planning__document",children:[e.jsx(F.NiceIcon,{name:"file",size:"sm"}),e.jsx("span",{className:"nice-event-planning__document-name",children:w.name}),w.fileType&&e.jsx(N.NiceBadge,{size:"xs",outline:!0,variant:"secondary",children:w.fileType}),w.sizeKb!=null&&e.jsxs("span",{className:"nice-event-planning__muted",children:[w.sizeKb," KB"]})]},w.id))})}),Pn={details:Nn,location:_n,schedule:wn,participants:jn,tasks:Cn,surveys:yn,vendors:Sn,budget:bn,documents:In,settings:kn},Tn={details:"file",location:"home",schedule:"clock",participants:"users",tasks:"list",surveys:"clipboard",vendors:"briefcase",budget:"dollar",documents:"folder",settings:"settings"},zn={schedule:f.length||void 0,participants:d.length||void 0,tasks:c.length||void 0,surveys:o.length||void 0,vendors:r.length||void 0,budget:u.length||void 0,documents:m.length||void 0},Mn=re.map(w=>({id:w,label:w.charAt(0).toUpperCase()+w.slice(1),icon:e.jsx(F.NiceIcon,{name:Tn[w],size:"sm"}),badge:zn[w],content:Pn[w]})),An=e.jsxs("div",{className:"nice-event-planning__toolbar",children:[e.jsxs("div",{className:"nice-event-planning__toolbar-title",children:[e.jsx(F.NiceIcon,{name:"calendar",size:"md"}),e.jsx("span",{className:"nice-event-planning__title",children:t.title}),e.jsx(N.NiceBadge,{size:"sm",variant:Ie(t.status),children:n(`eventPlanning.eventStatus.${t.status}`,t.status)})]}),e.jsx("span",{className:"nice-event-planning__toolbar-spacer"}),e.jsxs("div",{className:"nice-event-planning__toolbar-actions",children:[L&&e.jsx(N.NiceButton,{size:"sm",variant:"primary",leftIcon:e.jsx(F.NiceIcon,{name:"check",size:"sm"}),onClick:()=>L({title:Y,description:H}),children:n("eventPlanning.save","Save")}),X&&e.jsx(N.NiceButton,{size:"sm",variant:"success",leftIcon:e.jsx(F.NiceIcon,{name:"upload",size:"sm"}),onClick:X,children:n("eventPlanning.publish","Publish")}),S&&e.jsx(N.NiceButton,{size:"sm",variant:"ghost",leftIcon:e.jsx(F.NiceIcon,{name:"link",size:"sm"}),onClick:S,children:n("eventPlanning.share","Share")}),y&&e.jsx(N.NiceButton,{size:"sm",variant:"ghost",leftIcon:e.jsx(F.NiceIcon,{name:"download",size:"sm"}),onClick:y,children:n("eventPlanning.export","Export")})]})]});return h==="micro"?e.jsx("div",{ref:a,className:`nice-event-planning nice-event-planning--micro ${W??""}`,style:Q,children:e.jsxs("div",{className:"nice-event-planning__micro",children:[e.jsx(F.NiceIcon,{name:"calendar",size:"md"}),e.jsxs("div",{className:"nice-event-planning__micro-body",children:[e.jsx("span",{className:"nice-event-planning__title",children:t.title}),e.jsxs("span",{className:"nice-event-planning__muted",children:[t.startDate?new Date(t.startDate).toLocaleString():n("eventPlanning.noDate","No date"),(qe=t.location)!=null&&qe.name?` · ${t.location.name}`:""]})]}),e.jsx(N.NiceBadge,{size:"sm",variant:Ie(t.status),children:n(`eventPlanning.eventStatus.${t.status}`,t.status)}),d.length>0&&e.jsx(N.NiceAvatarGroup,{max:4,size:"sm",children:d.map(w=>e.jsx(N.NiceAvatar,{name:w.name,src:w.avatarUrl,size:"sm"},w.id))})]})}):e.jsxs("div",{ref:a,className:`nice-event-planning nice-event-planning--${h} ${W??""}`,style:Q,children:[An,e.jsx(N.NiceTabs,{tabs:Mn,activeTab:dn,onChange:un,iconOnly:P,centered:b,countLocation:A})]})});function Vn(i){switch(i){case"confirmed":return"success";case"checked-in":return"info";case"declined":return"error";case"no-show":return"warning";default:return"secondary"}}const Be=({participant:i,showRole:s=!0,showStatus:a=!0,meta:n,children:t,size:d="md",className:o})=>{const{t:u}=F.useNiceTranslation();return e.jsxs("li",{className:`nice-participant-row nice-participant-row--${d} ${o??""}`,children:[e.jsx(N.NiceAvatar,{name:i.name,src:i.avatarUrl,size:d}),e.jsx("span",{className:"nice-participant-row__name",children:i.name}),s&&i.role&&e.jsx(N.NiceBadge,{size:"xs",outline:!0,variant:"info",children:u(`participantList.role.${i.role}`,i.role)}),a&&i.status&&e.jsx(N.NiceBadge,{size:"xs",subtle:!0,variant:Vn(i.status),children:u(`participantList.status.${i.status}`,i.status)}),n&&e.jsx("span",{className:"nice-participant-row__meta",children:n}),t&&e.jsx("span",{className:"nice-participant-row__trailing",children:t})]})},Fn=/^[^\s@,;]+@[^\s@,;]+\.[^\s@,;]{2,}$/,Ge=/^.*<\s*([^<>\s]+)\s*>$/;function sn(i){var d,o;const s=[],a=[],n=new Set;let t=0;if(!i)return{valid:s,invalid:a,duplicates:t};for(const u of i.split(/[,;\r\n\t]+/)){const f=u.trim();if(!f)continue;const c=((o=(d=Ge.exec(f))==null?void 0:d[1])==null?void 0:o.trim())??f,r=Ge.test(f)?[c]:c.split(/\s+/);for(const m of r){if(!m)continue;if(!Fn.test(m)){a.push(m);continue}const h=m.toLowerCase();if(n.has(h)){t+=1;continue}n.add(h),s.push(m)}}return{valid:s,invalid:a,duplicates:t}}function Xn(i,s){const a=new Set(i.map(t=>t.toLowerCase())),n=[...i];for(const t of s){const d=t.toLowerCase();a.has(d)||(a.add(d),n.push(t))}return n}function an(i={}){const{currentUserId:s,currentUserName:a,requireIdentity:n=!0}=i,[t,d]=l.useState(""),o=!s,u=a??t,f=!n||u.trim().length>0;return{isAnonymous:o,name:u,setName:d,canAct:f,actor:{userId:s,userName:u.trim()}}}const qn=[{answer:"yes",label:"Yes",variant:"success",Icon:z.NtdCheck},{answer:"maybe",label:"Maybe",variant:"warning",Icon:z.NtdHelp},{answer:"no",label:"No",variant:"error",Icon:z.NtdClose}],$e=l.forwardRef(function(s,a){const{t:n}=F.useNiceTranslation(),{value:t,onRespond:d,allowPlusOnes:o=!1,maxPlusOnes:u=5,plusOnes:f=0,allowNote:c=!1,currentUserId:r,currentUserName:m,compact:h=!1,disabled:T=!1,readOnly:g=!1,size:x="md",className:P,style:b}=s,A=an({currentUserId:r,currentUserName:m}),[v,p]=l.useState(f),[M,_]=l.useState(""),R=!h&&A.isAnonymous&&!A.canAct,k=T||g,j=C=>{k||!d||d({answer:C,plusOnes:o&&C!=="no"?v:void 0,note:c&&M.trim()?M.trim():void 0,userId:A.actor.userId,userName:A.actor.userName||void 0})};return e.jsxs("div",{ref:a,className:`nice-rsvp-control nice-rsvp-control--${x}${h?" nice-rsvp-control--compact":""} ${P??""}`,style:b,children:[!h&&A.isAnonymous&&e.jsx(N.NiceTextInput,{label:n("rsvpControl.yourName","Your name"),value:A.name,onChange:A.setName,placeholder:n("rsvpControl.whoIsReplying","Who is replying?"),required:!0,disabled:k,size:x}),e.jsx("div",{className:"nice-rsvp-control__answers",role:"group","aria-label":n("rsvpControl.yourReply","Your reply"),children:qn.map(({answer:C,label:O,variant:V,Icon:E})=>e.jsx(N.NiceButton,{size:x,variant:t===C?V:"outline",leftIcon:e.jsx(E,{size:16}),disabled:k||R,"aria-pressed":t===C,onClick:()=>j(C),children:n(`rsvpControl.answer.${C}`,O)},C))}),!h&&o&&t!=="no"&&e.jsxs("label",{className:"nice-rsvp-control__field",children:[e.jsx("span",{className:"nice-rsvp-control__field-label",children:n("rsvpControl.additionalGuests","Additional guests")}),e.jsx(N.NiceNumericInput,{value:v,onChange:C=>p(Math.max(0,Math.min(u,C??0))),min:0,max:u,step:1,size:"xs",disabled:k})]}),!h&&c&&e.jsx(N.NiceTextInput,{label:n("rsvpControl.note","Note"),value:M,onChange:_,placeholder:n("rsvpControl.anythingWeShouldKnow","Anything we should know?"),disabled:k,size:x}),R&&e.jsx("p",{className:"nice-rsvp-control__hint",children:n("rsvpControl.enterYourNameToReply","Enter your name to reply.")})]})}),Wn={yes:"confirmed",maybe:"invited",no:"declined"},Ke={confirmed:"yes","checked-in":"yes",declined:"no"},Pe=["confirmed","checked-in","invited","declined","no-show"],Gn=[],Kn=l.forwardRef(function(s,a){const{t:n}=F.useNiceTranslation(),{participants:t=Gn,mode:d="organizer",currentUserId:o,currentUserName:u,onRsvpChange:f,onCheckIn:c,onScan:r,checkInSlot:m,onInvite:h,extraFields:T,groupBy:g="none",showSummary:x=!0,showSearch:P=!0,allowPlusOnes:b=!1,disabled:A=!1,readOnly:v=!1,size:p="md",className:M,style:_}=s,[R,k]=l.useState(""),[j,C]=l.useState("all"),[O,V]=l.useState(""),E=A||v,L=d==="guest",X=l.useMemo(()=>{const I={total:t.length};for(const U of Pe)I[U]=0;for(const U of t)I[U.status]=(I[U.status]??0)+1;return I},[t]),S=l.useMemo(()=>{if(L)return t.filter(U=>U.userId===o||U.id===o);const I=R.trim().toLowerCase();return t.filter(U=>j!=="all"&&U.status!==j?!1:!I||U.name.toLowerCase().includes(I))},[t,L,o,R,j]),y=l.useMemo(()=>{if(g==="none"||L)return[{key:"all",label:"",items:S}];const I=new Map;for(const W of S){const Q=g==="status"?W.status:W.role,Y=I.get(Q);Y?Y.push(W):I.set(Q,[W])}return[...I.keys()].sort((W,Q)=>g!=="status"?W.localeCompare(Q):Pe.indexOf(W)-Pe.indexOf(Q)).map(W=>({key:W,label:W,items:I.get(W)??[]}))},[S,g,L]),B=l.useMemo(()=>sn(O),[O]),G=I=>U=>{f==null||f(I,Wn[U.answer],U)},q=()=>{!h||B.valid.length===0||(h(B.valid),V(""))};if(L){const I=S[0];return I?e.jsxs("div",{ref:a,className:`nice-participant-list nice-participant-list--guest ${M??""}`,style:_,children:[e.jsx("ul",{className:"nice-participant-list__rows",children:e.jsx(Be,{participant:I,size:p})}),e.jsx($e,{value:Ke[I.status],onRespond:G(I.id),allowPlusOnes:b,currentUserId:o??I.userId,currentUserName:u??I.name,disabled:A,readOnly:v,size:p})]}):e.jsx("div",{ref:a,className:`nice-participant-list ${M??""}`,style:_,children:e.jsx(pe,{title:n("participantList.youAreNotOnThis","You are not on this guest list"),description:n("participantList.askTheHostForAn","Ask the host for an invitation link.")})})}return e.jsxs("div",{ref:a,className:`nice-participant-list ${M??""}`,style:_,children:[x&&e.jsxs("div",{className:"nice-participant-list__summary",children:[e.jsxs("span",{className:"nice-participant-list__stat",children:[e.jsx("strong",{children:X.confirmed})," confirmed"]}),e.jsxs("span",{className:"nice-participant-list__stat",children:[e.jsx("strong",{children:X.invited})," awaiting reply"]}),e.jsxs("span",{className:"nice-participant-list__stat",children:[e.jsx("strong",{children:X.declined})," declined"]}),e.jsxs("span",{className:"nice-participant-list__stat",children:[e.jsx("strong",{children:X["checked-in"]})," checked in"]}),e.jsxs("span",{className:"nice-participant-list__stat nice-participant-list__stat--total",children:[e.jsx("strong",{children:X.total})," total"]})]}),(P||m||r)&&e.jsxs("div",{className:"nice-participant-list__toolbar",children:[P&&e.jsxs(e.Fragment,{children:[e.jsx(N.NiceTextInput,{value:R,onChange:k,placeholder:n("participantList.searchGuests","Search guests…"),prefix:e.jsx(z.NtdSearch,{size:15}),size:p}),e.jsx(N.NiceSelect,{value:j,onChange:I=>C(I),size:p,options:[{value:"all",label:n("participantList.allStatuses","All statuses")},...Pe.map(I=>({value:I,label:n(`participantList.status.${I}`,I)}))]})]}),m,r&&!m&&e.jsxs("span",{className:"nice-participant-list__scan-hint",children:[e.jsx(z.NtdQrCode,{size:15})," ",n("participantList.scannerReady","Scanner ready")]})]}),S.length===0?e.jsx(pe,{title:n("participantList.noGuestsYet","No guests yet"),description:t.length>0?n("participantList.noMatch","No one matches the current filter."):n("participantList.invitePeopleHint","Invite people to see them here.")}):y.map(I=>e.jsxs("section",{className:"nice-participant-list__group",children:[I.label&&e.jsxs("h4",{className:"nice-participant-list__group-title",children:[I.label," ",e.jsxs("span",{children:["(",I.items.length,")"]})]}),e.jsx("ul",{className:"nice-participant-list__rows",children:I.items.map(U=>e.jsxs(Be,{participant:U,size:p,meta:T==null?void 0:T.map(W=>e.jsx("span",{className:"nice-participant-list__extra",children:W.render?W.render(U):String(U[W.key]??"")},W.key)),children:[f&&e.jsx($e,{compact:!0,value:Ke[U.status],onRespond:G(U.id),currentUserId:U.userId,currentUserName:U.name,disabled:E,size:"sm"}),c&&U.status!=="checked-in"&&e.jsx(N.NiceButton,{size:"sm",variant:"outline",leftIcon:e.jsx(z.NtdCheck,{size:14}),disabled:E,onClick:()=>c(U.id),children:n("participantList.checkIn","Check in")})]},U.id))})]},I.key)),h&&!v&&e.jsxs("div",{className:"nice-participant-list__invite",children:[e.jsx(N.NiceTextArea,{label:n("participantList.inviteByEmail","Invite by email"),value:O,onChange:V,placeholder:n("participantList.pasteAddressesCommasSemicolonsOr","Paste addresses — commas, semicolons or new lines"),rows:3,disabled:A,size:p}),e.jsx(N.NiceButton,{variant:"primary",size:p,leftIcon:e.jsx(z.NtdMail,{size:15}),disabled:A||B.valid.length===0,onClick:q,children:n("participantList.invite","Invite {valid}").replace("{valid}",B.valid.length>0?`(${B.valid.length})`:"")}),(B.invalid.length>0||B.duplicates>0)&&e.jsxs("p",{className:"nice-participant-list__invite-hint",children:[B.duplicates>0&&`${n("participantList.duplicatesRemoved","{count} duplicate(s) removed.").replace("{count}",String(B.duplicates))} `,B.invalid.length>0&&n("participantList.notRecognised","{count} entry(ies) not recognised.").replace("{count}",String(B.invalid.length))]})]})]})}),Hn={BIF:0,CLP:0,DJF:0,GNF:0,ISK:0,JPY:0,KMF:0,KRW:0,PYG:0,RWF:0,UGX:0,UYI:0,VND:0,VUV:0,XAF:0,XOF:0,XPF:0,BHD:3,IQD:3,JOD:3,KWD:3,LYD:3,OMR:3,TND:3};function Ee(i){return Hn[i==null?void 0:i.toUpperCase()]??2}function De(i,s){return Number.isFinite(i)?Math.round(i*10**Ee(s)):0}function ze(i,s){const a=Ee(s);return a===0?i:i/10**a}function Qn(i,s,a){const n=Ee(s),t=ze(i,s);try{return new Intl.NumberFormat(a,{style:"currency",currency:s.toUpperCase(),minimumFractionDigits:n,maximumFractionDigits:n}).format(t)}catch{return`${t.toFixed(n)} ${s}`}}function ne(i,s,a){return Qn(De(i,s),s,a)}const Le={minX:0,minY:0,maxX:0,maxY:0};function Zn(i,s=0){if(i.length===0)return{...Le};let a=1/0,n=1/0,t=-1/0,d=-1/0;for(const o of i)o.x<a&&(a=o.x),o.y<n&&(n=o.y),o.x>t&&(t=o.x),o.y>d&&(d=o.y);return{minX:a-s,minY:n-s,maxX:t+s,maxY:d+s}}function He(i,s){return{minX:Math.min(i.minX,s.minX),minY:Math.min(i.minY,s.minY),maxX:Math.max(i.maxX,s.maxX),maxY:Math.max(i.maxY,s.maxY)}}function Qe(i,s){return i.minX<=s.maxX&&i.maxX>=s.minX&&i.minY<=s.maxY&&i.maxY>=s.minY}function Jn(i,s,a=0){const n=i.zoom||1,t=-i.pan.x/n-a,d=-i.pan.y/n-a;return{minX:t,minY:d,maxX:t+s.width/n+a*2,maxY:d+s.height/n+a*2}}function et(i,s=12){const a=[],n=[],t=new Map,d=new Map;let o=null,u=0;for(const f of i.sections??[]){let c=null,r=0;(f.rows??[]).forEach((h,T)=>{const g=nt(h.seats??[]);if(g.length===0)return;const x=Zn(g,s);n.push({sectionId:f.id,rowIndex:T,label:h.label,seats:g,bounds:x}),g.forEach((P,b)=>{t.set(P.id,P),d.set(P.id,{sectionId:f.id,rowIndex:T,seatIndex:b})}),r+=g.length,c=c?He(c,x):x});const m=c??{...Le};a.push({section:f,bounds:m,seatCount:r}),u+=r,r>0&&(o=o?He(o,m):m)}return{sections:a,rows:n,bounds:o??{...Le},totalSeats:u,seatById:t,locationById:d}}function nt(i){return[...i].sort((s,a)=>s.number-a.number||s.x-a.x)}function tt(i,s){return i>s*4?"section":i>s?"row":"seat"}function st(i,s,a=2500,n){const t=i.sections.filter(r=>Qe(r.bounds,s)),d=new Set(t.map(r=>r.section.id)),o=i.rows.filter(r=>d.has(r.sectionId)&&Qe(r.bounds,s));let u=0;for(const r of o)for(const m of r.seats)m.x>=s.minX&&m.x<=s.maxX&&m.y>=s.minY&&m.y<=s.maxY&&(u+=1);const f=n??tt(u,a);let c=[];if(f==="seat"){c=[];for(const r of o)for(const m of r.seats)m.x>=s.minX&&m.x<=s.maxX&&m.y>=s.minY&&m.y<=s.maxY&&c.push(m)}return{tier:f,sections:t,rows:f==="section"?[]:o,seats:c,visibleSeatCount:u}}function Oe(i){if(i.accessType)return i.accessType;if(i.status==="wheelchair"||i.status==="companion")return i.status}function Ne(i,s){const a=(s==null?void 0:s[i.id])??i.status;return a==="wheelchair"||a==="companion"?"available":a}function Ze(i,s,a){var t;const n=(t=s.priceCategories)==null?void 0:t.find(d=>d.id===i.priceCategoryId);return{amount:(n==null?void 0:n.price)??a.basePrice,currency:a.currency}}function it(i,s={},a){return!(Ne(i,a)!=="available"||s.allowedCategories&&!s.allowedCategories.includes(i.priceCategoryId))}function cn(i,s={},a){const n=[];let t=null;return i.forEach((d,o)=>{it(d,s,a)?t?t.seats.push(d):t={start:o,seats:[d]}:t&&(n.push(t),t=null)}),t&&n.push(t),n}function at(i,s,a={},n){const t=a.maxSeats??8;if(i.length>t)return{ok:!1,reason:"max-seats"};for(const o of i){const u=s.seatById.get(o);if(u){if(Ne(u,n)!=="available")return{ok:!1,reason:"unavailable",seatId:o};if(a.allowedCategories&&!a.allowedCategories.includes(u.priceCategoryId))return{ok:!1,reason:"category-not-allowed",seatId:o}}}if(!a.adjacentOnly||i.length===0)return{ok:!0};const d=new Map;for(const o of i){const u=s.locationById.get(o);if(!u)continue;const f=`${u.sectionId}::${u.rowIndex}`,c=d.get(f);c?c.push(o):d.set(f,[o])}for(const[o,u]of d){const[f,c]=o.split("::"),r=Number(c),m=s.rows.find(v=>v.sectionId===f&&v.rowIndex===r);if(!m)continue;const h=cn(m.seats,a,n),T=new Set(u);let g=null;for(const v of h)if(v.seats.some(p=>T.has(p.id))){if(g)return{ok:!1,reason:"not-adjacent",seatId:u[0]};g=v}if(!g)continue;const x=g.seats.map((v,p)=>T.has(v.id)?p:-1).filter(v=>v>=0);if(x.length===0)continue;const P=x[0],b=x[x.length-1];if(b-P+1!==x.length)return{ok:!1,reason:"not-adjacent",seatId:u[0]};const A=g.seats.length;if(A>1&&(P===1||A-1-b===1))return{ok:!1,reason:"orphan-seat",seatId:u[0]}}return{ok:!0}}function ct(i,s,a,n={},t){if(i.includes(s))return{selected:i.filter(u=>u!==s)};const d=[...i,s],o=at(d,a,n,t);return o.ok?{selected:d}:{rejected:o.reason??"not-adjacent"}}function rt(i,s,a={},n={},t){if(s<=0)return[];const d=n.categoryId?{...a,allowedCategories:[n.categoryId]}:a;let o=null;for(const u of i.rows)if(!(n.sectionId&&u.sectionId!==n.sectionId))for(const f of cn(u.seats,d,t)){const c=f.seats.length;if(!(c<s))for(let r=0;r+s<=c;r+=1){const m=r+s-1;if(c>s&&(r===1||c-1-m===1))continue;const h=f.seats.slice(r,m+1),T=h.reduce((g,x)=>g+(x.viewScore??50),0)/s;(!o||T>o.score)&&(o={ids:h.map(g=>g.id),score:T})}}return(o==null?void 0:o.ids)??[]}function ot(i,s,a){var r,m,h,T;const n=i.locationById.get(s);if(!n)return null;const t=i.rows.findIndex(g=>g.sectionId===n.sectionId&&g.rowIndex===n.rowIndex);if(t<0)return null;const d=i.rows[t];if(a==="left")return((r=d.seats[n.seatIndex-1])==null?void 0:r.id)??null;if(a==="right")return((m=d.seats[n.seatIndex+1])==null?void 0:m.id)??null;if(a==="row-start")return((h=d.seats[0])==null?void 0:h.id)??null;if(a==="row-end")return((T=d.seats[d.seats.length-1])==null?void 0:T.id)??null;const o=i.rows[a==="up"?t-1:t+1];if(!o)return null;const u=d.seats[n.seatIndex].x;let f=null,c=1/0;for(const g of o.seats){const x=Math.abs(g.x-u);x<c&&(c=x,f=g)}return(f==null?void 0:f.id)??null}function lt(i,s,a){var f,c,r;const n=i.sections.filter(m=>m.seatCount>0);if(n.length===0)return null;const t=s?(f=i.locationById.get(s))==null?void 0:f.sectionId:void 0,d=n.findIndex(m=>m.section.id===t),o=d<0?0:a==="next"?d+1:d-1,u=n[o];return u?((r=(c=i.rows.find(m=>m.sectionId===u.section.id))==null?void 0:c.seats[0])==null?void 0:r.id)??null:null}const we=8;function dt(i,s){return i.seats.length===0?0:i.seats.filter(n=>Ne(n,s)==="available").length/i.seats.length}const ut=({cull:i,selectedIds:s,cursorId:a,statusOverrides:n,sectionColorById:t,interactive:d,onSeatClick:o,onSectionClick:u,describeSeat:f})=>{const{t:c}=F.useNiceTranslation();return i.tier==="section"?e.jsx("g",{className:"nice-seating-chart__sections",children:i.sections.map(({section:r,bounds:m,seatCount:h})=>e.jsxs("g",{className:"nice-seating-chart__section",children:[e.jsx("rect",{x:m.minX,y:m.minY,width:m.maxX-m.minX,height:m.maxY-m.minY,rx:12,className:"nice-seating-chart__section-shape",style:{fill:t.get(r.id)},role:u?"button":"img","aria-label":c("seatingChart.sectionLabel","{name}, {count} seats").replace("{name}",r.name).replace("{count}",String(h)),tabIndex:u?0:void 0,onClick:u?()=>u(r.id):void 0}),e.jsx("text",{x:(m.minX+m.maxX)/2,y:(m.minY+m.maxY)/2,className:"nice-seating-chart__section-label",textAnchor:"middle",dominantBaseline:"middle","aria-hidden":"true",children:r.name})]},r.id))}):i.tier==="row"?e.jsx("g",{className:"nice-seating-chart__rows",children:i.rows.map(r=>{const m=dt(r,n);return e.jsxs("g",{children:[e.jsx("rect",{x:r.bounds.minX,y:r.bounds.minY,width:r.bounds.maxX-r.bounds.minX,height:r.bounds.maxY-r.bounds.minY,rx:8,className:"nice-seating-chart__row-shape",style:{fill:t.get(r.sectionId),fillOpacity:.25+m*.65},role:"img","aria-label":c("seatingChart.rowLabel","Row {row}, {count} seats, {free} available").replace("{row}",String(r.label)).replace("{count}",String(r.seats.length)).replace("{free}",String(Math.round(m*r.seats.length)))}),e.jsx("text",{x:r.bounds.minX-6,y:(r.bounds.minY+r.bounds.maxY)/2,className:"nice-seating-chart__row-label",textAnchor:"end",dominantBaseline:"middle","aria-hidden":"true",children:r.label})]},`${r.sectionId}-${r.rowIndex}`)})}):e.jsx("g",{className:"nice-seating-chart__seats",children:i.seats.map(r=>{const m=Ne(r,n),h=Oe(r),T=s.has(r.id),g=a===r.id,x={row:r.row,number:r.number},P=["nice-seating-chart__seat",`nice-seating-chart__seat--${m}`,T?"nice-seating-chart__seat--selected":"",h?`nice-seating-chart__seat--${h}`:"",g?"nice-seating-chart__seat--cursor":""].filter(Boolean).join(" ");return e.jsxs("g",{className:P,"data-seat-id":r.id,role:"gridcell","aria-selected":T,"aria-disabled":m!=="available","aria-label":f(r),tabIndex:g?0:-1,onClick:d&&o?()=>o(r):void 0,children:[h?e.jsx("rect",{x:r.x-we,y:r.y-we,width:we*2,height:we*2,rx:3,className:"nice-seating-chart__seat-shape",fill:h==="companion"?"url(#nice-seat-companion-hatch)":void 0}):e.jsx("circle",{cx:r.x,cy:r.y,r:we,className:"nice-seating-chart__seat-shape"}),h==="wheelchair"&&e.jsx(z.NtdWheelchair,{size:10,x:r.x-5,y:r.y-5,className:"nice-seating-chart__seat-glyph"}),e.jsx("title",{children:f(r)}),e.jsx("text",{x:r.x,y:r.y,className:"nice-seating-chart__seat-number",textAnchor:"middle",dominantBaseline:"middle","aria-hidden":"true",children:x.number})]},r.id)})})},mt=({index:i,selectedIds:s,statusOverrides:a,maxSeats:n,onSeatToggle:t,onBestAvailable:d,describeSeat:o,disabled:u=!1,defaultOpen:f=!1})=>{var v;const{t:c}=F.useNiceTranslation(),r=l.useMemo(()=>i.sections.filter(p=>p.seatCount>0),[i.sections]),[m,h]=l.useState(((v=r[0])==null?void 0:v.section.id)??""),[T,g]=l.useState(0),[x,P]=l.useState(2),b=l.useMemo(()=>i.rows.filter(p=>p.sectionId===m),[i.rows,m]),A=b.find(p=>p.rowIndex===T)??b[0];return e.jsxs(N.NiceCollapse,{trigger:c("seatListPanel.chooseWithoutMap","Choose seats without the map"),defaultExpanded:f,className:"nice-seating-chart__list-panel",children:[d&&e.jsxs("div",{className:"nice-seating-chart__best",children:[e.jsxs("label",{className:"nice-seating-chart__field",children:[e.jsx("span",{children:c("seatListPanel.howManySeats","How many seats?")}),e.jsx(N.NiceNumericInput,{value:x,onChange:p=>P(Math.max(1,Math.min(n,p??1))),min:1,max:n,size:"xs",disabled:u})]}),e.jsx(N.NiceButton,{size:"sm",variant:"primary",disabled:u,onClick:()=>d(x,{sectionId:m||void 0}),children:c("seatListPanel.bestAvailable","Best available")})]}),e.jsxs("div",{className:"nice-seating-chart__pickers",children:[e.jsxs("label",{className:"nice-seating-chart__field",children:[e.jsx("span",{children:c("seatListPanel.section","Section")}),e.jsx(N.NiceSelect,{size:"sm",value:m,disabled:u,onChange:p=>{h(p),g(0)},options:r.map(p=>({value:p.section.id,label:`${p.section.name} (${p.seatCount})`}))})]}),e.jsxs("label",{className:"nice-seating-chart__field",children:[e.jsx("span",{children:"Row"}),e.jsx(N.NiceSelect,{size:"sm",value:String((A==null?void 0:A.rowIndex)??0),disabled:u||b.length===0,onChange:p=>g(Number(p)),options:b.map(p=>({value:String(p.rowIndex),label:`${p.label} (${p.seats.length})`}))})]})]}),A&&e.jsx("ul",{className:"nice-seating-chart__seat-list",children:A.seats.map(p=>{const M=Ne(p,a),_=Oe(p),R=s.has(p.id);return e.jsx("li",{children:e.jsxs(N.NiceButton,{size:"sm",variant:R?"primary":"outline",disabled:u||M!=="available",ariaLabel:o(p),"aria-pressed":R,onClick:()=>t(p),children:[p.number,_&&e.jsx(z.NtdWheelchair,{size:11})]})},p.id)})})]})},pt={zoom:1,pan:{x:0,y:0}};function ht(i={}){const{minZoom:s=.1,maxZoom:a=10,initial:n=pt,viewport:t,onViewportChange:d,disabled:o=!1}=i,[u,f]=l.useState(n),c=t??u,[r,m]=l.useState(!1),h=l.useRef(new Map),T=l.useRef(null),g=l.useRef(null),x=l.useCallback(j=>{t===void 0&&f(j),d==null||d(j)},[t,d]),P=l.useCallback(j=>Math.min(a,Math.max(s,j)),[s,a]),b=l.useCallback((j,C)=>{const O=P(c.zoom*j);if(O===c.zoom)return;const V=O/c.zoom;x({zoom:O,pan:{x:C.x-(C.x-c.pan.x)*V,y:C.y-(C.y-c.pan.y)*V}})},[x,P,c]),A=l.useCallback((j,C,O)=>{const V=C??(O?{x:O.width/2,y:O.height/2}:{x:0,y:0});b(j,V)},[b]),v=l.useCallback((j,C,O=24)=>{const V=Math.max(1,j.maxX-j.minX),E=Math.max(1,j.maxY-j.minY),L=P(Math.min((C.width-O*2)/V,(C.height-O*2)/E));x({zoom:L,pan:{x:(C.width-V*L)/2-j.minX*L,y:(C.height-E*L)/2-j.minY*L}})},[x,P]),p=l.useCallback(()=>x(n),[x,n]),M=l.useCallback(j=>({x:(j.x-c.pan.x)/c.zoom,y:(j.y-c.pan.y)/c.zoom}),[c]),_=l.useCallback(j=>({x:j.x*c.zoom+c.pan.x,y:j.y*c.zoom+c.pan.y}),[c]),R=j=>{const C=j.currentTarget.getBoundingClientRect();return{x:j.clientX-C.left,y:j.clientY-C.top}};return{viewport:c,setViewport:x,containerProps:o?{}:{onWheel:j=>{j.preventDefault();const C=Math.exp(-j.deltaY*.002);b(Math.min(2,Math.max(.5,C)),R(j))},onPointerDown:j=>{var O,V;const C=R(j);if(h.current.set(j.pointerId,C),(V=(O=j.currentTarget).setPointerCapture)==null||V.call(O,j.pointerId),h.current.size===2){const[E,L]=[...h.current.values()];T.current={distance:Math.hypot(E.x-L.x,E.y-L.y)||1,zoom:c.zoom}}else g.current=C,m(!0)},onPointerMove:j=>{if(!h.current.has(j.pointerId))return;const C=R(j);if(h.current.set(j.pointerId,C),h.current.size===2&&T.current){const[E,L]=[...h.current.values()],X=Math.hypot(E.x-L.x,E.y-L.y)||1,S=P(T.current.zoom*(X/T.current.distance)),y={x:(E.x+L.x)/2,y:(E.y+L.y)/2};S!==c.zoom&&b(S/c.zoom,y);return}if(!g.current)return;const O=C.x-g.current.x,V=C.y-g.current.y;g.current=C,x({zoom:c.zoom,pan:{x:c.pan.x+O,y:c.pan.y+V}})},onPointerUp:j=>{h.current.delete(j.pointerId),h.current.size<2&&(T.current=null),h.current.size===0&&(g.current=null,m(!1))},onPointerCancel:j=>{h.current.delete(j.pointerId),T.current=null,g.current=null,m(!1)}},zoomBy:A,fitTo:v,reset:p,screenToWorld:M,worldToScreen:_,panning:r}}const gt={"orphan-seat":"That would leave a single empty seat. Pick a different seat.","not-adjacent":"Seats must be next to each other.","max-seats":"You have selected as many seats as this order allows.","category-not-allowed":"That seat is not part of the selected ticket type.",unavailable:"That seat is not available."},xt={id:"empty",name:"",venueId:"",sections:[],priceCategories:[],totalSeats:0},rn=l.forwardRef(function(s,a){var ce,ke,fe;const{t:n}=F.useNiceTranslation(),{chart:t=xt,mode:d="select",selection:o={},selectedSeatIds:u,defaultSelectedSeatIds:f=[],onSelectionChange:c,onSelectionRejected:r,seatStatusOverrides:m,onSeatClick:h,onBestAvailable:T,lod:g="auto",onLodChange:x,maxRenderedSeats:P=2500,containerSize:b,showLegend:A=!0,showList:v=!1,zoomable:p=!0,locale:M,disabled:_=!1,readOnly:R=!1,className:k,style:j}=s,C=l.useRef(null),[O,V]=l.useState({width:800,height:500}),[E,L]=l.useState(!1),[X,S]=l.useState(f),[y,B]=l.useState(null),[G,q]=l.useState(""),I=u??X,U=l.useMemo(()=>new Set(I),[I]),W=d==="select"&&!_&&!R&&o.interactive!==!1,Q=o.maxSeats??8,Y=l.useMemo(()=>et(t),[t]),J=b??O,H=!!b||E;l.useEffect(()=>{if(b||!C.current||typeof ResizeObserver>"u")return;const $=C.current,D=new ResizeObserver(([K])=>{const{width:Z,height:ee}=K.contentRect;Z>0&&ee>0&&(V({width:Z,height:ee}),L(!0))});return D.observe($),()=>D.disconnect()},[b]);const he=ht({disabled:!p||_}),{fitTo:se,viewport:oe}=he,ge=l.useRef(!1);l.useEffect(()=>{ge.current||!H||Y.totalSeats===0||J.width<=0||(ge.current=!0,se(Y.bounds,J))},[se,Y,J,H]);const Ce=l.useMemo(()=>Jn(oe,J,40),[oe,J]),xe=g!=="auto"?g:y?"seat":void 0,le=l.useMemo(()=>st(Y,Ce,P,xe),[Y,Ce,P,xe]),ve=l.useRef(null);l.useEffect(()=>{ve.current!==le.tier&&(ve.current=le.tier,x==null||x(le.tier))},[le.tier,x]);const Ae=l.useMemo(()=>{var $;return new Map((($=t.sections)==null?void 0:$.map(D=>[D.id,D.color]))??[])},[t.sections]),de=l.useMemo(()=>{var $;return new Map((($=t.sections)==null?void 0:$.map(D=>[D.id,D]))??[])},[t.sections]),ae=l.useCallback($=>{const D=de.get($.sectorId),K=Ne($,m),Z=Oe($),ee=[D?D.name:"",n("seatingChart.rowN","row {row}").replace("{row}",String($.row)),n("seatingChart.seatN","seat {number}").replace("{number}",String($.number))].filter(Boolean);if(D&&o.showPrices!==!1){const re=Ze($,t,D);ee.push(ne(re.amount,re.currency,M))}return ee.push(n(`seatingChart.status.${K}`,K)),Z==="wheelchair"&&ee.push(n("seatingChart.wheelchairAccessible","wheelchair accessible")),Z==="companion"&&ee.push(n("seatingChart.companionSeat","companion seat")),ee.join(", ")},[t,de,m,o.showPrices,M,n]),te=l.useCallback($=>{u===void 0&&S($),c==null||c($)},[u,c]),_e=l.useCallback($=>{if(h==null||h($),!W)return;const D=ct(I,$.id,Y,o,m);if("rejected"in D){r==null||r({reason:D.rejected,seatId:$.id}),q(n(`seatingChart.rejection.${D.rejected}`,gt[D.rejected]));return}te(D.selected),q(n("seatingChart.seatSelected","{seat}. {count} of {max} selected.").replace("{seat}",ae($)).replace("{count}",String(D.selected.length)).replace("{max}",String(Q)))},[n,te,ae,Y,W,Q,h,r,m,I,o]),ue=l.useCallback(($,D)=>{if(T){T($,D);return}const K=rt(Y,$,o,D,m);if(K.length===0){q(n("seatingChart.noBlockAvailable","No block of {count} seats together is available.").replace("{count}",String($)));return}te(K),B(K[0]),q(n("seatingChart.selectedTogether","Selected {count} seats together.").replace("{count}",String(K.length)))},[te,Y,T,m,o,n]),je=l.useCallback($=>{const D=Y.locationById.get($);if(!D)return;const K=Y.rows.find(Z=>Z.sectionId===D.sectionId&&Z.rowIndex===D.rowIndex);K&&se(K.bounds,J,80)},[se,Y,J]),me=l.useCallback($=>{if(!$)return;B($),je($);const D=Y.seatById.get($);D&&q(ae(D))},[ae,Y.seatById,je]),Re=$=>{var ee,re;const D=y??((re=(ee=Y.rows[0])==null?void 0:ee.seats[0])==null?void 0:re.id)??null;if(!D)return;const Z={ArrowLeft:"left",ArrowRight:"right",ArrowUp:"up",ArrowDown:"down",Home:"row-start",End:"row-end"}[$.key];if(Z){$.preventDefault(),me(y?ot(Y,D,Z):D);return}if($.key==="PageDown"||$.key==="PageUp"){$.preventDefault(),me(lt(Y,y,$.key==="PageDown"?"next":"prev"));return}if($.key==="Enter"||$.key===" "){$.preventDefault();const Se=Y.seatById.get(D);Se&&_e(Se);return}$.key==="Escape"&&I.length>0&&($.preventDefault(),te([]),q(n("seatingChart.selectionCleared","Selection cleared.")))};if(Y.totalSeats===0)return e.jsx("div",{ref:a,className:`nice-seating-chart ${k??""}`,style:j,children:e.jsx(pe,{title:n("seatingChart.thisChartHasNoSeats","This chart has no seats"),description:n("seatingChart.addSectionsAndRowsTo","Add sections and rows to the seating chart to see it here.")})});const ye=I.reduce(($,D)=>{const K=Y.seatById.get(D),Z=K?de.get(K.sectorId):void 0;return!K||!Z?$:$+Ze(K,t,Z).amount},0),be=((ke=(ce=t.sections)==null?void 0:ce[0])==null?void 0:ke.currency)??"PLN";return e.jsxs("div",{ref:a,className:`nice-seating-chart nice-seating-chart--${d} ${k??""}`,style:j,children:[e.jsxs("div",{ref:C,className:"nice-seating-chart__canvas-host",role:"grid","aria-label":n("seatingChart.chartLabel","{name} seating chart").replace("{name}",t.name),"aria-rowcount":Y.rows.length,"aria-colcount":Y.totalSeats,tabIndex:y?-1:0,onKeyDown:Re,...he.containerProps,children:[e.jsxs("svg",{className:"nice-seating-chart__canvas",width:"100%",height:"100%",role:"presentation",children:[e.jsx("defs",{children:e.jsx("pattern",{id:"nice-seat-companion-hatch",width:4,height:4,patternUnits:"userSpaceOnUse",patternTransform:"rotate(45)",children:e.jsx("line",{x1:0,y1:0,x2:0,y2:4,className:"nice-seating-chart__hatch"})})}),e.jsx("g",{transform:`translate(${oe.pan.x} ${oe.pan.y}) scale(${oe.zoom})`,children:e.jsx(ut,{cull:le,selectedIds:U,cursorId:y,statusOverrides:m,sectionColorById:Ae,interactive:W,onSeatClick:_e,onSectionClick:o.sectionSelect?$=>{var K;const D=(K=Y.rows.find(Z=>Z.sectionId===$))==null?void 0:K.seats[0];D&&me(D.id)}:void 0,describeSeat:ae})})]}),p&&e.jsxs("div",{className:"nice-seating-chart__zoom",children:[e.jsx(N.NiceButton,{size:"sm",variant:"ghost",ariaLabel:n("seatingChart.zoomIn","Zoom in"),onClick:()=>he.zoomBy(1.25,void 0,J),children:e.jsx(z.NtdZoomIn,{size:16})}),e.jsx(N.NiceButton,{size:"sm",variant:"ghost",ariaLabel:n("seatingChart.zoomOut","Zoom out"),onClick:()=>he.zoomBy(.8,void 0,J),children:e.jsx(z.NtdZoomOut,{size:16})}),e.jsx(N.NiceButton,{size:"sm",variant:"ghost",ariaLabel:n("seatingChart.fitToView","Fit to view"),onClick:()=>se(Y.bounds,J),children:e.jsx(z.NtdMaximize,{size:16})})]})]}),e.jsx("p",{className:"nice-seating-chart__status",role:"status","aria-live":"polite",children:G}),A&&e.jsxs("ul",{className:"nice-seating-chart__legend",children:[(fe=t.priceCategories)==null?void 0:fe.map($=>e.jsxs("li",{className:"nice-seating-chart__legend-item",children:[e.jsx("span",{className:"nice-seating-chart__legend-swatch",style:{background:$.color},"aria-hidden":"true"}),$.name," · ",ne($.price,be,M)]},$.id)),e.jsxs("li",{className:"nice-seating-chart__legend-item nice-seating-chart__legend-item--sold",children:[e.jsx("span",{className:"nice-seating-chart__legend-swatch","aria-hidden":"true"})," ",n("seatingChart.sold","Sold")]})]}),d==="select"&&I.length>0&&e.jsxs("p",{className:"nice-seating-chart__total",children:[I.length," seat",I.length===1?"":"s"," ·"," ",ne(ye,be,M)]}),v&&e.jsx(mt,{index:Y,selectedIds:U,statusOverrides:m,maxSeats:Q,onSeatToggle:_e,onBestAvailable:ue,describeSeat:ae,disabled:!W,defaultOpen:d==="select"&&v})]})}),vt=l.forwardRef(function({showList:s=!0,className:a,...n},t){return e.jsx(rn,{ref:t,mode:"select",showList:s,className:`nice-seat-picker ${a??""}`,...n})}),on=/\{\{\s*([\w.-]+)\s*\}\}/g,ft={"&":"&","<":"<",">":">",'"':""","'":"'"};function Nt(i){return i.replace(/[&<>"']/g,s=>ft[s]??s)}function _t(i){const s=[],a=new Set;for(const n of i.matchAll(on)){const t=n[1];a.has(t)||(a.add(t),s.push(t))}return s}function jt(i,s={},a={}){const{escape:n=!0,missing:t="keep"}=a;return i.replace(on,(d,o)=>{const u=s[o];return u==null?t==="blank"?"":d:n?Nt(String(u)):String(u)})}function Je(i){return`{{${i}}}`}function yt(i,s={}){return _t(i).filter(a=>s[a]===void 0||s[a]===null)}const bt={name:"",body:""},kt=["bold","italic","underline","h1","h2","ul","ol","link","image","alignLeft","alignCenter","undo","redo"],wt=l.forwardRef(function(s,a){const{t:n}=F.useNiceTranslation(),{template:t,defaultTemplate:d,onTemplateChange:o,tokens:u=[],previewData:f={},recipients:c=[],onRecipientsChange:r,onSend:m,sending:h=!1,toolbar:T=kt,disabled:g=!1,readOnly:x=!1,size:P="md",className:b,style:A}=s,[v,p]=F.useControllableState({value:t,defaultValue:d,fallbackValue:bt,onChange:o,componentName:"NiceInvitationDesigner"}),[M,_]=l.useState(""),R=g||x||h,k=l.useMemo(()=>sn(M),[M]),j=l.useMemo(()=>{const y={};for(const B of u)B.sample!==void 0&&(y[B.key]=B.sample);return{...y,...f}},[u,f]),C=l.useMemo(()=>jt(v.body??"",j),[v.body,j]),O=l.useMemo(()=>yt(v.body??"",j),[v.body,j]),V=c.map(y=>y.email),E=y=>p({...v,...y}),L=y=>{E({body:`${v.body??""}${Je(y)}`})},X=()=>{!r||k.valid.length===0||(r(Xn(V,k.valid)),_(""))},S=y=>{r==null||r(V.filter(B=>B!==y))};return e.jsxs("div",{ref:a,className:`nice-invitation-designer nice-invitation-designer--${P} ${b??""}`,style:A,children:[e.jsxs("section",{className:"nice-invitation-designer__editor",children:[e.jsx(N.NiceTextInput,{label:n("invitationDesigner.templateName","Template name"),value:v.name,onChange:y=>E({name:y}),placeholder:n("invitationDesigner.birthdayInvitation","Birthday invitation"),disabled:R,size:P}),u.length>0&&!x&&e.jsxs("div",{className:"nice-invitation-designer__tokens",children:[e.jsx("span",{className:"nice-invitation-designer__tokens-label",children:"Insert:"}),u.map(y=>e.jsx(N.NiceButton,{size:"sm",variant:"outline",disabled:R,onClick:()=>L(y.key),children:y.label},y.key))]}),e.jsx(N.NiceHtmlEditor,{value:v.body??"",onChange:y=>E({body:y}),toolbar:T,height:280,readOnly:x||h,disabled:g})]}),e.jsxs("section",{className:"nice-invitation-designer__preview","aria-label":n("invitationDesigner.invitationPreview","Invitation preview"),children:[e.jsxs("header",{className:"nice-invitation-designer__preview-header",children:[e.jsx("h4",{children:n("invitationDesigner.preview","Preview")}),O.length>0&&e.jsxs(N.NiceBadge,{size:"xs",subtle:!0,variant:"warning",children:[O.length," unresolved"]})]}),v.coverImageUrl&&e.jsx("img",{className:"nice-invitation-designer__cover",src:v.coverImageUrl,alt:""}),e.jsx("div",{className:"nice-invitation-designer__preview-body",dangerouslySetInnerHTML:{__html:C}}),O.length>0&&e.jsxs("p",{className:"nice-invitation-designer__unresolved",children:["No preview value for: ",O.map(y=>Je(y)).join(", ")]})]}),e.jsxs("section",{className:"nice-invitation-designer__recipients",children:[e.jsx("header",{className:"nice-invitation-designer__recipients-header",children:e.jsxs("h4",{children:[n("invitationDesigner.recipients","Recipients")," ",e.jsxs("span",{children:["(",c.length,")"]})]})}),r&&!x&&e.jsxs(e.Fragment,{children:[e.jsx(N.NiceTextArea,{label:n("invitationDesigner.addAddresses","Add addresses"),value:M,onChange:_,placeholder:n("invitationDesigner.pasteAListCommasSemicolons","Paste a list — commas, semicolons or new lines"),rows:3,disabled:R,size:P}),e.jsxs("div",{className:"nice-invitation-designer__paste-actions",children:[e.jsx(N.NiceButton,{size:P,variant:"outline",leftIcon:e.jsx(z.NtdMail,{size:15}),disabled:R||k.valid.length===0,onClick:X,children:k.valid.length>0?n("invitationDesigner.addN","Add ({count})").replace("{count}",String(k.valid.length)):n("invitationDesigner.add","Add")}),(k.invalid.length>0||k.duplicates>0)&&e.jsxs("span",{className:"nice-invitation-designer__paste-hint",children:[k.duplicates>0&&`${n("invitationDesigner.duplicates","{count} duplicate(s).").replace("{count}",String(k.duplicates))} `,k.invalid.length>0&&n("invitationDesigner.notRecognised","{count} not recognised: {list}").replace("{count}",String(k.invalid.length)).replace("{list}",k.invalid.slice(0,3).join(", "))]})]})]}),c.length>0&&e.jsx("ul",{className:"nice-invitation-designer__recipient-list",children:c.map(y=>e.jsxs("li",{className:"nice-invitation-designer__recipient",children:[e.jsx("span",{children:y.name?`${y.name} <${y.email}>`:y.email}),y.status&&y.status!=="pending"&&e.jsx(N.NiceBadge,{size:"xs",subtle:!0,variant:y.status==="sent"?"success":"error",children:n(`invitationDesigner.recipientStatus.${y.status}`,y.status)}),r&&!x&&e.jsx(N.NiceButton,{size:"sm",variant:"ghost",ariaLabel:n("invitationDesigner.removeRecipient","Remove {email}").replace("{email}",y.email),disabled:R,onClick:()=>S(y.email),children:e.jsx(z.NtdTrash,{size:13})})]},y.email))}),m&&!x&&e.jsx(N.NiceButton,{variant:"primary",size:P,leftIcon:e.jsx(z.NtdSend,{size:15}),loading:h,ariaLabel:n("invitationDesigner.sendInvitations","Send invitations"),disabled:g||h||c.length===0,onClick:()=>m({templateId:v.id,emails:V}),children:h?n("invitationDesigner.sending","Sending…"):n("invitationDesigner.sendTo","Send to {count}").replace("{count}",String(c.length))})]})]})}),Ct=({value:i,max:s,currency:a,locale:n,label:t,className:d})=>{const o=s>0?s:1,u=i>=s&&s>0,f=(c,r)=>a?`${ne(c,a,n)} / ${ne(r,a,n)}`:`${c} / ${r}`;return e.jsx(N.NiceProgress,{className:d,value:Math.min(i,o),max:o,variant:u?"success":"primary",size:"sm",showValue:!0,formatValue:()=>f(i,s),"aria-label":t})},St=[];function It(i,s){if(s==="wishlist")return{value:i.isPurchased?1:0,max:1,complete:!!i.isPurchased};const a=i.quantityNeeded??1,n=i.quantityContributed??0;return{value:n,max:a,complete:a>0&&n>=a}}const Pt=l.forwardRef(function(s,a){const{t:n}=F.useNiceTranslation(),{items:t=St,kind:d="registry",mode:o="owner",currency:u="PLN",locale:f,hideContributors:c=!1,currentUserId:r,currentUserName:m,onContribute:h,onClaim:T,onUnclaim:g,onItemAdd:x,onItemDelete:P,onItemClick:b,layout:A="grid",disabled:v=!1,readOnly:p=!1,size:M="md",className:_,style:R}=s,k=an({currentUserId:r,currentUserName:m}),[j,C]=l.useState(null),[O,V]=l.useState(0),[E,L]=l.useState(""),X=o==="owner",S=v||p,y=d==="wishlist",B=l.useMemo(()=>y?[...t].sort((I,U)=>Number(I.isPurchased??!1)-Number(U.isPurchased??!1)||(U.priority??0)-(I.priority??0)):t,[t,y]),G=()=>{C(null),V(0)},q=I=>{!h||!k.canAct||(h(I.id,{amount:O>0?O:void 0,quantity:O>0?void 0:1,userName:k.actor.userName,userId:k.actor.userId}),G())};return t.length===0?e.jsx("div",{ref:a,className:`nice-gift-registry ${_??""}`,style:R,children:e.jsx(pe,{icon:e.jsx(z.NtdGiftCard,{size:28}),title:y?n("giftRegistry.emptyWishlist","Nothing on the wishlist yet"):n("giftRegistry.emptyRegistry","No gifts on the registry yet"),description:X?n("giftRegistry.emptyOwnerHint","Add what you would like and share the link."):n("giftRegistry.emptyGuestHint","The host has not added anything yet.")})}):e.jsxs("div",{ref:a,className:`nice-gift-registry nice-gift-registry--${d} nice-gift-registry--${A} nice-gift-registry--${M} ${_??""}`,style:R,children:[!X&&k.isAnonymous&&(h||T)&&e.jsx(N.NiceTextInput,{label:n("giftRegistry.yourName","Your name"),value:k.name,onChange:k.setName,placeholder:n("giftRegistry.soTheHostKnowsWho","So the host knows who to thank"),required:!0,disabled:S,size:M}),e.jsx(N.NiceCardGroup,{columns:A==="list"?1:void 0,minColumnWidth:240,gap:12,children:B.map(I=>{const{value:U,max:W,complete:Q}=It(I,d),Y=I.price,J=I.contributions??[];return e.jsxs("div",{className:`nice-gift-registry__item${Q?" nice-gift-registry__item--complete":""}`,children:[I.imageUrl&&e.jsx("img",{src:I.imageUrl,alt:"",className:"nice-gift-registry__image",loading:"lazy"}),e.jsxs("div",{className:"nice-gift-registry__body",children:[e.jsx("button",{type:"button",className:"nice-gift-registry__title",onClick:()=>b==null?void 0:b(I),disabled:!b,children:I.title}),I.description&&e.jsx("p",{className:"nice-gift-registry__description",children:I.description}),e.jsxs("div",{className:"nice-gift-registry__facts",children:[Y&&e.jsx("span",{className:"nice-gift-registry__price",children:ne(Y.amount,Y.currency||u,f)}),y&&(I.priority??0)>0&&e.jsxs(N.NiceBadge,{size:"xs",subtle:!0,variant:"warning",children:[e.jsx(z.NtdStar,{size:11})," ",I.priority]}),Q&&e.jsx(N.NiceBadge,{size:"xs",subtle:!0,variant:"success",children:y?"bought":"fully covered"}),I.url&&e.jsxs("a",{className:"nice-gift-registry__link",href:I.url,target:"_blank",rel:"noopener noreferrer",children:[e.jsx(z.NtdLink,{size:13})," ",n("giftRegistry.shop","Shop")]})]}),!y&&e.jsx(Ct,{value:U,max:W,label:n("giftRegistry.covered","{name}: {value} of {max} covered").replace("{name}",I.title).replace("{value}",String(U)).replace("{max}",String(W))}),!c&&J.length>0&&e.jsx("ul",{className:"nice-gift-registry__contributors",children:J.map(H=>e.jsxs("li",{className:"nice-gift-registry__contributor",children:[e.jsx("strong",{children:H.contributorName}),H.amount!==void 0&&` — ${ne(H.amount,(Y==null?void 0:Y.currency)||u,f)}`,H.amount===void 0&&H.quantity?` — ${H.quantity}×`:"",H.message&&e.jsxs("em",{children:[" “",H.message,"”"]})]},H.id))}),e.jsxs("div",{className:"nice-gift-registry__actions",children:[!X&&!Q&&T&&e.jsx(N.NiceButton,{size:"sm",variant:"primary",disabled:S||!k.canAct,leftIcon:e.jsx(z.NtdCheck,{size:14}),onClick:()=>T(I.id,{...k.actor,quantity:1}),children:"I'll take this"}),!X&&Q&&g&&e.jsx(N.NiceButton,{size:"sm",variant:"ghost",disabled:S,onClick:()=>g(I.id),children:n("giftRegistry.release","Release")}),!X&&!Q&&!y&&h&&e.jsx(N.NiceButton,{size:"sm",variant:"outline",disabled:S||!k.canAct,onClick:()=>C(j===I.id?null:I.id),children:n("giftRegistry.chipIn","Chip in")}),X&&P&&!p&&e.jsx(N.NiceButton,{size:"sm",variant:"ghost",ariaLabel:n("giftRegistry.deleteItem","Delete {name}").replace("{name}",I.title),disabled:v,onClick:()=>P(I.id),children:e.jsx(z.NtdTrash,{size:14})})]}),j===I.id&&e.jsxs("div",{className:"nice-gift-registry__pledge",children:[e.jsxs("label",{className:"nice-gift-registry__pledge-field",children:[e.jsxs("span",{children:["Amount (",(Y==null?void 0:Y.currency)||u,")"]}),e.jsx(N.NiceNumericInput,{value:O,onChange:H=>V(Math.max(0,H??0)),min:0,size:"xs",disabled:S})]}),e.jsx(N.NiceButton,{size:"sm",variant:"primary",disabled:S||!k.canAct,onClick:()=>q(I),children:n("giftRegistry.confirm","Confirm")}),e.jsx(N.NiceButton,{size:"sm",variant:"ghost",onClick:G,children:n("giftRegistry.cancel","Cancel")})]})]})]},I.id)})}),X&&x&&!p&&e.jsxs("div",{className:"nice-gift-registry__add",children:[e.jsx(N.NiceTextInput,{label:y?n("giftRegistry.addAWish","Add a wish"):n("giftRegistry.addAGift","Add a gift"),value:E,onChange:L,placeholder:n("giftRegistry.whatWouldYouLike","What would you like?"),disabled:v,size:M}),e.jsx(N.NiceButton,{variant:"primary",size:M,leftIcon:e.jsx(z.NtdPlus,{size:15}),disabled:v||!E.trim(),onClick:()=>{x({title:E.trim(),quantityNeeded:1}),L("")},children:"Add"})]})]})});function Tt(i){const s=new Map;for(const a of i){const n=(a.currency||"").toUpperCase(),t=s.get(n);t?t.push(a):s.set(n,[a])}return s}function zt(i,s,a){var f;const n=new Set(s.map(c=>c.id)),t=s.map(c=>c.id),d=new Map(t.map(c=>[c,0])),o=[];let u=0;if(t.length===0)return{balances:d,issues:i.map(c=>({itemId:c.id,reason:"no-participants"})),totalMinor:0};for(const c of i){const r=c.paidById;if(!r){o.push({itemId:c.id,reason:"no-payer"});continue}if(!n.has(r)){o.push({itemId:c.id,reason:"unknown-payer"});continue}let m=(f=c.splitAmong)!=null&&f.length?c.splitAmong.filter(b=>n.has(b)):t;m.length===0&&(m=t);const h=De(c.amount,a);u+=h;const T=m.length,g=Math.floor(h/T),x=h-g*T,P=new Map(m.map(b=>[b,g]));if(x!==0)if(P.has(r))P.set(r,(P.get(r)??0)+x);else{const b=[...m].sort(Me),A=x>0?1:-1;for(let v=0;v<Math.abs(x);v+=1){const p=b[v%b.length];P.set(p,(P.get(p)??0)+A)}}d.set(r,(d.get(r)??0)+h);for(const[b,A]of P)d.set(b,(d.get(b)??0)-A)}return{balances:d,issues:o,totalMinor:u}}function Mt(i,s,a){for(const n of s){if((n.currency||"").toUpperCase()!==a||!i.has(n.fromId)||!i.has(n.toId))continue;const t=De(n.amount,a);i.set(n.fromId,(i.get(n.fromId)??0)+t),i.set(n.toId,(i.get(n.toId)??0)-t)}}function At(i,s,a){const n=new Map(s.map(c=>[c.id,c.name])),t=[...i.entries()].filter(([,c])=>c>0).map(([c,r])=>({id:c,v:r})).sort((c,r)=>r.v-c.v||Me(c.id,r.id)),d=[...i.entries()].filter(([,c])=>c<0).map(([c,r])=>({id:c,v:r})).sort((c,r)=>c.v-r.v||Me(c.id,r.id)),o=[];let u=0,f=0;for(;u<d.length&&f<t.length;){const c=Math.min(-d[u].v,t[f].v);c>0&&o.push({fromId:d[u].id,fromName:n.get(d[u].id)??d[u].id,toId:t[f].id,toName:n.get(t[f].id)??t[f].id,amount:ze(c,a),currency:a}),d[u].v+=c,t[f].v-=c,d[u].v===0&&(u+=1),t[f].v===0&&(f+=1)}return o}function Rt(i,s,a=[]){const n=[],t=[],d=[...Tt(i).entries()].sort(([o],[u])=>Me(o,u));for(const[o,u]of d){const f=zt(u,s,o);t.push(...f.issues),Mt(f.balances,a,o),n.push({currency:o,total:ze(f.totalMinor,o),balances:s.map(c=>({participantId:c.id,participantName:c.name,amount:ze(f.balances.get(c.id)??0,o),currency:o})),transfers:At(f.balances,s,o)})}return{groups:n,issues:t}}function Me(i,s){return i<s?-1:i>s?1:0}const Bt=[],$t=[],Lt=l.forwardRef(function(s,a){const{t:n}=F.useNiceTranslation(),{items:t=Bt,participants:d=$t,settlements:o=[],view:u,defaultView:f="expenses",onViewChange:c,onSettle:r,onItemDelete:m,onItemClick:h,onValidationChange:T,sortBy:g="date",locale:x,disabled:P=!1,readOnly:b=!1,size:A="md",className:v,style:p}=s,[M,_]=l.useState(f),R=u??M,k=P||b,j=l.useMemo(()=>d.map(S=>({id:S.id,name:S.name})),[d]),C=l.useMemo(()=>Rt(t,j,o),[t,j,o]),O=l.useMemo(()=>g==="none"?t:t.map((S,y)=>({item:S,index:y})).sort((S,y)=>{if(g==="amount")return y.item.amount-S.item.amount||S.index-y.index;const B=S.item.incurredAt,G=y.item.incurredAt;return B&&G?B.localeCompare(G)||S.index-y.index:B?-1:G?1:S.index-y.index}).map(S=>S.item),[t,g]),V=C.issues.map(S=>`${S.itemId}:${S.reason}`).join("|");l.useEffect(()=>{T==null||T(C.issues)},[V]);const E=l.useMemo(()=>new Map(d.map(S=>[S.id,S.avatarUrl])),[d]),L=l.useMemo(()=>new Map(C.issues.map(S=>[S.itemId,S.reason])),[C.issues]),X=S=>{u===void 0&&_(S),c==null||c(S)};return t.length===0?e.jsx("div",{ref:a,className:`nice-expense-split ${v??""}`,style:p,children:e.jsx(pe,{icon:e.jsx(z.NtdReceipt,{size:28}),title:n("expenseSplit.noExpensesYet","No expenses yet"),description:n("expenseSplit.addWhatPeoplePaidFor","Add what people paid for and this will work out who owes whom.")})}):e.jsxs("div",{ref:a,className:`nice-expense-split nice-expense-split--${A} ${v??""}`,style:p,children:[e.jsx(N.NiceSegmentedControl,{size:A,value:R,onChange:S=>X(S),options:[{value:"expenses",label:n("expenseSplit.expenses","Expenses")},{value:"balances",label:n("expenseSplit.balances","Balances")},{value:"settlement",label:n("expenseSplit.settleUp","Settle up")}]}),R==="expenses"&&e.jsx("ul",{className:"nice-expense-split__items",children:O.map(S=>{const y=L.get(S.id);return e.jsxs("li",{className:`nice-expense-split__item${y?" nice-expense-split__item--excluded":""}`,children:[e.jsxs("button",{type:"button",className:"nice-expense-split__item-main",onClick:()=>h==null?void 0:h(S),disabled:!h,children:[e.jsx("span",{className:"nice-expense-split__item-label",children:S.label}),e.jsxs("span",{className:"nice-expense-split__item-payer",children:[S.paidByName??S.paidById??"nobody"," paid"]})]}),e.jsx("span",{className:"nice-expense-split__item-amount",children:ne(S.amount,S.currency,x)}),S.isPaid&&e.jsx(N.NiceBadge,{size:"xs",subtle:!0,variant:"success",children:"paid"}),y&&e.jsx(N.NiceBadge,{size:"xs",subtle:!0,variant:"warning",children:y==="no-payer"?"no payer":"unknown payer"}),m&&!b&&e.jsx(N.NiceButton,{size:"sm",variant:"ghost",ariaLabel:n("expenseSplit.deleteItem","Delete {name}").replace("{name}",S.label),disabled:P,onClick:()=>m(S.id),children:e.jsx(z.NtdTrash,{size:14})})]},S.id)})}),R==="balances"&&C.groups.map(S=>e.jsxs("section",{className:"nice-expense-split__group",children:[e.jsxs("h4",{className:"nice-expense-split__group-title",children:[S.currency,e.jsxs("span",{className:"nice-expense-split__group-total",children:[ne(S.total,S.currency,x)," total"]})]}),e.jsx("ul",{className:"nice-participant-list__rows",children:S.balances.map(y=>e.jsx(Be,{participant:{id:y.participantId,name:y.participantName,avatarUrl:E.get(y.participantId)},showRole:!1,showStatus:!1,size:A,children:e.jsxs("span",{className:`nice-expense-split__balance nice-expense-split__balance--${y.amount>0?"owed":y.amount<0?"owes":"settled"}`,children:[y.amount===0?"settled up":ne(Math.abs(y.amount),y.currency,x),y.amount>0&&e.jsx("em",{children:" is owed"}),y.amount<0&&e.jsx("em",{children:" owes"})]})},y.participantId))})]},S.currency)),R==="settlement"&&(C.groups.every(S=>S.transfers.length===0)?e.jsx(pe,{icon:e.jsx(z.NtdCoins,{size:28}),title:n("expenseSplit.allSettledUp","All settled up"),description:n("expenseSplit.nobodyOwesAnybodyAnything","Nobody owes anybody anything.")}):C.groups.filter(S=>S.transfers.length>0).map(S=>e.jsxs("section",{className:"nice-expense-split__group",children:[e.jsxs("h4",{className:"nice-expense-split__group-title",children:[S.currency,e.jsxs("span",{className:"nice-expense-split__group-total",children:[S.transfers.length," transfer",S.transfers.length===1?"":"s"]})]}),e.jsx("ul",{className:"nice-expense-split__transfers",children:S.transfers.map(y=>e.jsxs("li",{className:"nice-expense-split__transfer",children:[e.jsx("span",{className:"nice-expense-split__transfer-from",children:y.fromName}),e.jsx(z.NtdArrowRight,{size:15}),e.jsx("span",{className:"nice-expense-split__transfer-to",children:y.toName}),e.jsx("span",{className:"nice-expense-split__transfer-amount",children:ne(y.amount,y.currency,x)}),r&&!b&&e.jsx(N.NiceButton,{size:"sm",variant:"outline",disabled:k,onClick:()=>r(y),children:n("expenseSplit.markPaid","Mark paid")})]},`${y.fromId}-${y.toId}-${y.amount}`))})]},S.currency)))]})}),Et=[],Dt={upcoming:z.NtdClock,active:z.NtdPlay,voting:z.NtdThumbsUp,scored:z.NtdBarChart,completed:z.NtdCheck,skipped:z.NtdSkipForward},Ot={upcoming:"#9ca3af",active:"#22c55e",voting:"#eab308",scored:"#3b82f6",completed:"#6b7280",skipped:"#d1d5db"},Yt=l.forwardRef(function(s,a){const{t:n}=F.useNiceTranslation(),{rounds:t=Et,activeRoundId:d,onSelect:o,onStart:u,onEnd:f,onCreate:c,editable:r=!1,className:m,style:h}=s,T=[...t].sort((g,x)=>g.order-x.order);return e.jsxs("div",{ref:a,className:`nice-round-list ${m??""}`,style:h,children:[e.jsxs("div",{className:"nice-round-list__header",children:[e.jsxs("h3",{children:["Rounds (",t.length,")"]}),r&&c&&e.jsx("button",{onClick:c,children:n("roundList.addRound","+ Add Round")})]}),T.length===0?e.jsx("p",{className:"nice-round-list__empty",children:n("roundList.noRoundsYet","No rounds yet.")}):e.jsx("div",{className:"nice-round-list__items",children:T.map(g=>{const x=g.id===d;return e.jsxs("div",{className:`nice-round-list__item ${x?"nice-round-list__item--active":""}`,onClick:()=>o==null?void 0:o(g),role:o?"button":void 0,tabIndex:o?0:void 0,children:[e.jsxs("span",{className:"nice-round-list__order",children:["#",g.order]}),e.jsx("span",{className:"nice-round-list__icon",title:n(`roundCard.status.${g.status}`,g.status),children:l.createElement(Dt[g.status],{size:16})}),e.jsxs("div",{className:"nice-round-list__info",children:[e.jsx("strong",{className:"nice-round-list__name",children:g.name}),g.description&&e.jsx("small",{children:g.description}),g.type&&e.jsx("span",{className:"nice-round-list__type",children:g.type})]}),e.jsx("span",{className:"nice-round-list__status",style:{color:Ot[g.status]},children:n(`roundCard.status.${g.status}`,g.status)}),g.durationMinutes&&e.jsxs("span",{className:"nice-round-list__duration",children:[g.durationMinutes,"m"]}),g.winnerIds&&g.winnerIds.length>0&&e.jsxs("span",{className:"nice-round-list__winners",children:[e.jsx(z.NtdTrophy,{size:14})," ",g.winnerIds.length]}),r&&e.jsxs("div",{className:"nice-round-list__actions",onClick:P=>P.stopPropagation(),children:[g.status==="upcoming"&&u&&e.jsx("button",{onClick:()=>u(g.id),children:n("roundList.start","Start")}),(g.status==="active"||g.status==="voting")&&f&&e.jsx("button",{onClick:()=>f(g.id),children:"End"})]})]},g.id)})})]})}),Ut=["var(--nice-lb-gold, #facc15)","var(--nice-lb-silver, #cbd5e1)","var(--nice-lb-bronze, #d97706)"],Vt=l.forwardRef(function(s,a){const{t:n}=F.useNiceTranslation(),{round:t,timerRunning:d=!1,remainingSeconds:o,onSubmitScore:u,onStart:f,onEnd:c,onSkip:r,editable:m=!1,footerActions:h,className:T,style:g}=s,[x,P]=l.useState({}),b=l.useCallback(p=>{const M=parseFloat(x[p]??"");isNaN(M)||!u||(u(p,M),P(_=>({..._,[p]:""})))},[x,u]),A=p=>{const M=Math.floor(p/60),_=p%60;return`${M}:${_.toString().padStart(2,"0")}`},v=t.scores?[...t.scores].sort((p,M)=>M.score-p.score):[];return e.jsxs("div",{ref:a,className:`nice-round-card nice-round-card--${t.status} ${T??""}`,style:g,children:[e.jsxs("div",{className:"nice-round-card__header",children:[e.jsx("span",{className:"nice-round-card__order",children:n("roundCard.roundN","Round #{n}").replace("{n}",String(t.order))}),e.jsx("h3",{className:"nice-round-card__name",children:t.name}),e.jsx("span",{className:"nice-round-card__status",children:n(`roundCard.status.${t.status}`,t.status)})]}),t.description&&e.jsx("p",{className:"nice-round-card__description",children:t.description}),(d||o!=null)&&e.jsxs("div",{className:`nice-round-card__timer ${d?"nice-round-card__timer--running":""}`,children:[e.jsx(z.NtdClock,{size:14})," ",o!=null?A(o):"—"]}),v.length>0&&e.jsxs("div",{className:"nice-round-card__scoreboard",children:[e.jsx("h4",{children:n("roundCard.scoreboard","Scoreboard")}),e.jsxs("table",{className:"nice-round-card__scores-table",children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{children:n("roundCard.rank","Rank")}),e.jsx("th",{children:n("roundCard.participant","Participant")}),e.jsx("th",{children:n("roundCard.score","Score")})]})}),e.jsx("tbody",{children:v.map((p,M)=>e.jsxs("tr",{className:M<3?`nice-round-card__top-${M+1}`:"",children:[e.jsxs("td",{children:[p.rank??M+1,M<3&&e.jsxs(e.Fragment,{children:[" ",e.jsx(z.NtdMedal,{size:14,primaryColor:Ut[M],"aria-label":n("roundCard.placeN","Place {n}").replace("{n}",String(M+1))})]})]}),e.jsx("td",{children:p.participantName}),e.jsx("td",{children:p.score})]},p.participantId))})]})]}),u&&(t.status==="active"||t.status==="voting")&&v.length>0&&e.jsxs("div",{className:"nice-round-card__score-input",children:[e.jsx("h4",{children:n("roundCard.submitScores","Submit Scores")}),v.map(p=>e.jsxs("div",{className:"nice-round-card__score-row",children:[e.jsx("span",{children:p.participantName}),e.jsx("input",{type:"number",value:x[p.participantId]??"",onChange:M=>P(_=>({..._,[p.participantId]:M.target.value})),min:0,step:1,placeholder:n("roundCard.score","Score")}),e.jsx("button",{onClick:()=>b(p.participantId),children:n("roundCard.submit","Submit")})]},p.participantId))]}),e.jsxs("div",{className:"nice-round-card__footer",children:[m&&e.jsxs("div",{className:"nice-round-card__actions",children:[t.status==="upcoming"&&f&&e.jsxs("button",{onClick:f,children:[e.jsx(z.NtdPlay,{size:14})," ",n("roundCard.startRound","Start Round")]}),(t.status==="active"||t.status==="voting")&&c&&e.jsxs("button",{onClick:c,children:[e.jsx(z.NtdStop,{size:14})," ",n("roundCard.endRound","End Round")]}),t.status==="upcoming"&&r&&e.jsxs("button",{onClick:r,children:[e.jsx(z.NtdSkipForward,{size:14})," ",n("roundCard.skip","Skip")]})]}),h]}),t.winnerIds&&t.winnerIds.length>0&&e.jsxs("div",{className:"nice-round-card__winners",children:[e.jsx(z.NtdTrophy,{size:14})," Winners: ",t.winnerIds.length]})]})}),Ft=[],Xt=i=>{if(!i)return"";const s=Math.floor(i/60),a=i%60;return`${s}:${a.toString().padStart(2,"0")}`},qt=l.forwardRef(function(s,a){const{songs:n=Ft,onAdd:t,onRemove:d,onVote:o,onSearch:u,showQueue:f=!0,readOnly:c=!1,className:r,style:m}=s,{t:h}=F.useNiceTranslation(),[T,g]=l.useState(""),x=l.useMemo(()=>{if(!T.trim())return n;const v=T.toLowerCase();return n.filter(p=>p.title.toLowerCase().includes(v)||p.artist.toLowerCase().includes(v))},[n,T]),P=l.useMemo(()=>n.filter(v=>v.isQueued),[n]),b=n.find(v=>v.isPlaying),A=v=>{g(v),u==null||u(v)};return e.jsxs("div",{ref:a,className:`nice-song-picker ${r??""}`,style:m,children:[b&&e.jsxs("div",{className:"nice-song-picker__now-playing",children:[b.albumArt&&e.jsx("img",{src:b.albumArt,alt:"",className:"nice-song-picker__album-art"}),e.jsxs("div",{children:[e.jsxs("div",{className:"nice-song-picker__np-label",children:[e.jsx(z.NtdMusic,{size:14})," ",h("songPicker.nowPlaying","Now playing")]}),e.jsx("strong",{children:b.title})," — ",e.jsx("span",{children:b.artist})]})]}),e.jsx("div",{className:"nice-song-picker__search",children:e.jsx(N.NiceTextInput,{size:"sm",controlWidth:"100%",value:T,onChange:A,placeholder:h("songPicker.search","Search songs or artists…"),"aria-label":h("songPicker.search","Search songs or artists…")})}),e.jsx("div",{className:"nice-song-picker__list",children:x.length===0?e.jsx("p",{className:"nice-song-picker__empty",children:h("songPicker.noMatch","No songs found.")}):x.map(v=>e.jsxs("div",{className:`nice-song-picker__item ${v.isPlaying?"nice-song-picker__item--playing":""}`,children:[v.albumArt&&e.jsx("img",{src:v.albumArt,alt:"",className:"nice-song-picker__thumb"}),e.jsxs("div",{className:"nice-song-picker__info",children:[e.jsx("strong",{children:v.title})," — ",e.jsx("span",{children:v.artist}),v.duration&&e.jsx("span",{className:"nice-song-picker__duration",children:Xt(v.duration)}),v.addedByName&&e.jsx("div",{className:"nice-song-picker__added-by",children:h("songPicker.addedBy","Added by {name}").replace("{name}",v.addedByName)})]}),!c&&e.jsxs("div",{className:"nice-song-picker__actions",children:[o&&e.jsxs(N.NiceButton,{variant:"ghost",size:"sm",onClick:()=>o(v.id),"aria-label":h("songPicker.vote","Vote for {title}").replace("{title}",v.title),children:[e.jsx(z.NtdThumbsUp,{size:14})," ",v.votes??0]}),t&&!v.isQueued&&e.jsxs(N.NiceButton,{variant:"primary",size:"sm",onClick:()=>t(v.id),children:[e.jsx(z.NtdPlus,{size:14})," ",h("songPicker.addToQueue","Queue")]}),d&&v.isQueued&&e.jsx(N.NiceButton,{variant:"outline",size:"sm",onClick:()=>d(v.id),children:h("remove","Remove")})]})]},v.id))}),f&&P.length>0&&e.jsxs("div",{className:"nice-song-picker__queue",children:[e.jsx("h4",{children:h("songPicker.queue","Queue ({count})").replace("{count}",String(P.length))}),P.map((v,p)=>e.jsxs("div",{className:"nice-song-picker__queue-item",children:[e.jsxs("span",{className:"nice-song-picker__queue-pos",children:[p+1,"."]}),e.jsxs("span",{children:[v.title," — ",v.artist]})]},v.id))]})]})}),Wt=[],en={easy:"Easy",medium:"Medium",hard:"Hard",expert:"Expert"},Gt={easy:"var(--nice-color-success, #16a34a)",medium:"var(--nice-color-warning, #d97706)",hard:"var(--nice-color-error, #dc2626)",expert:"var(--nice-color-accent, #7c3aed)"},Te="all",Kt=l.forwardRef(function(s,a){const{songs:n=Wt,queue:t=[],onEnqueue:d,onDequeue:o,onNext:u,nowPlayingId:f,readOnly:c=!1,className:r,style:m}=s,{t:h}=F.useNiceTranslation(),T=_=>_ in en?h(`karaokePicker.difficulty.${_}`,en[_]):_,[g,x]=l.useState(""),[P,b]=l.useState(Te),A=n.find(_=>_.id===f),v=l.useMemo(()=>{let _=n;if(g.trim()){const R=g.toLowerCase();_=_.filter(k=>k.title.toLowerCase().includes(R)||k.artist.toLowerCase().includes(R))}return P!==Te&&(_=_.filter(R=>R.difficulty===P)),_},[n,g,P]),p=l.useMemo(()=>new Set(t.map(_=>_.id)),[t]),M=["easy","medium","hard","expert"];return e.jsxs("div",{ref:a,className:`nice-karaoke-picker ${r??""}`,style:m,children:[A&&e.jsxs("div",{className:"nice-karaoke-picker__now-singing",children:[e.jsxs("span",{className:"nice-karaoke-picker__label",children:[e.jsx(z.NtdMicrophone,{size:14})," ",h("karaokePicker.nowSinging","Now Singing")]}),e.jsxs("div",{children:[e.jsx("strong",{children:A.title})," — ",A.artist,A.performerName&&e.jsxs("span",{children:[" ","(",h("karaokePicker.by","by {name}").replace("{name}",A.performerName),")"]})]}),!c&&u&&e.jsx("div",{className:"nice-karaoke-picker__next",children:e.jsxs(N.NiceButton,{variant:"secondary",size:"sm",onClick:u,children:[h("karaokePicker.next","Skip / Next")," ",e.jsx(z.NtdSkipForward,{size:14})]})})]}),e.jsxs("div",{className:"nice-karaoke-picker__filters",children:[e.jsx("div",{className:"nice-karaoke-picker__search",children:e.jsx(N.NiceTextInput,{size:"sm",controlWidth:"100%",value:g,onChange:x,placeholder:h("karaokePicker.search","Search songs or artists…"),"aria-label":h("karaokePicker.search","Search songs or artists…")})}),e.jsx("div",{className:"nice-karaoke-picker__difficulty-filter",children:e.jsx(N.NiceSelect,{size:"sm","aria-label":h("karaokePicker.allDifficulties","All Difficulties"),value:P,onChange:_=>b((Array.isArray(_)?_[0]:_)||Te),options:[{value:Te,label:h("karaokePicker.allDifficulties","All Difficulties")},...M.map(_=>({value:_,label:T(_)}))]})})]}),e.jsx("div",{className:"nice-karaoke-picker__catalog",children:v.length===0?e.jsx("p",{children:h("karaokePicker.noMatch","No songs match your search.")}):v.map(_=>e.jsxs("div",{className:"nice-karaoke-picker__song",children:[e.jsxs("div",{children:[e.jsx("strong",{children:_.title})," — ",_.artist,_.difficulty&&e.jsxs("span",{className:"nice-karaoke-picker__difficulty",style:{color:Gt[_.difficulty]??"var(--nice-text-muted, #94a3b8)"},children:["[",T(_.difficulty),"]"]}),_.hasLyrics&&e.jsx("span",{className:"nice-karaoke-picker__lyrics",title:h("karaokePicker.lyrics","Lyrics available"),"aria-label":h("karaokePicker.lyrics","Lyrics available"),children:e.jsx(z.NtdFileText,{size:12})}),_.language&&e.jsxs("span",{className:"nice-karaoke-picker__language",children:["(",_.language,")"]})]}),!c&&e.jsx("div",{children:p.has(_.id)?e.jsx(N.NiceButton,{variant:"outline",size:"sm",onClick:()=>o==null?void 0:o(_.id),children:h("remove","Remove")}):e.jsxs(N.NiceButton,{variant:"primary",size:"sm",onClick:()=>d==null?void 0:d(_.id),children:[e.jsx(z.NtdMicrophone,{size:14})," ",h("karaokePicker.sing","Sing")]})})]},_.id))}),t.length>0&&e.jsxs("div",{className:"nice-karaoke-picker__queue",children:[e.jsxs("h4",{children:[e.jsx(z.NtdMusic,{size:14})," ",h("karaokePicker.queue","Queue ({count})").replace("{count}",String(t.length))]}),t.map((_,R)=>e.jsxs("div",{className:"nice-karaoke-picker__queue-item",children:[e.jsxs("span",{children:[e.jsxs("strong",{children:[R+1,"."]})," ",_.title," — ",_.artist,_.performerName&&e.jsxs("em",{children:[" (",_.performerName,")"]})]}),!c&&o&&e.jsx(N.NiceButton,{variant:"ghost",size:"xs",onClick:()=>o(_.id),"aria-label":`${h("remove","Remove")} ${_.title}`,children:e.jsx(z.NtdClose,{size:12})})]},_.id))]})]})}),Ht=[],nn={game:z.NtdGamepad,music:z.NtdMusic,dance:z.NtdMusic,quiz:z.NtdHelp,karaoke:z.NtdMicrophone,photo:z.NtdCamera,custom:z.NtdSparkle},Qt={game:"Games",music:"Music",dance:"Dance",quiz:"Quiz",karaoke:"Karaoke",photo:"Photo",custom:"Custom"},Zt=l.forwardRef(function(s,a){const{t:n}=F.useNiceTranslation(),{attractions:t=Ht,onSelect:d,onDeselect:o,onVote:u,selectedIds:f=[],maxSelections:c,showVotes:r=!0,readOnly:m=!1,layout:h="grid",className:T,style:g}=s,[x,P]=l.useState(""),[b,A]=l.useState(""),v=l.useMemo(()=>new Set(f),[f]),p=l.useMemo(()=>{const k=new Set(t.map(j=>j.category));return Array.from(k)},[t]),M=l.useMemo(()=>{let k=t;if(x&&(k=k.filter(j=>j.category===x)),b.trim()){const j=b.toLowerCase();k=k.filter(C=>{var O;return C.name.toLowerCase().includes(j)||((O=C.description)==null?void 0:O.toLowerCase().includes(j))})}return k},[t,x,b]),_=!c||v.size<c,R=k=>{m||(v.has(k)?o==null||o(k):_&&(d==null||d(k)))};return e.jsxs("div",{ref:a,className:`nice-attraction-picker ${T??""}`,style:g,children:[e.jsxs("div",{className:"nice-attraction-picker__header",children:[e.jsx("h3",{className:"nice-attraction-picker__title",children:n("attractionPicker.attractions","Attractions")}),c&&e.jsxs("span",{className:"nice-attraction-picker__count",children:[v.size,"/",c," selected"]})]}),e.jsxs("div",{className:"nice-attraction-picker__filters",children:[e.jsx("input",{type:"text",value:b,onChange:k=>A(k.target.value),placeholder:n("attractionPicker.searchAttractions","Search attractions…"),className:"nice-attraction-picker__search"}),e.jsx("button",{type:"button",onClick:()=>P(""),className:`nice-attraction-picker__category${x?"":" nice-attraction-picker__category--active"}`,children:"All"}),p.map(k=>e.jsxs("button",{type:"button",onClick:()=>P(k===x?"":k),className:`nice-attraction-picker__category${k===x?" nice-attraction-picker__category--active":""}`,children:[l.createElement(nn[k],{size:14})," ",n(`attractionPicker.category.${k}`,Qt[k])]},k))]}),e.jsx("div",{className:`nice-attraction-picker__items nice-attraction-picker__items--${h}`,children:M.length===0?e.jsx("p",{children:n("attractionPicker.noAttractionsFound","No attractions found.")}):M.map(k=>{const j=v.has(k.id);return e.jsxs("div",{className:`nice-attraction-picker__card${j?" nice-attraction-picker__card--selected":""}${m?" nice-attraction-picker__card--readonly":""}`,onClick:()=>R(k.id),children:[k.imageUrl&&e.jsx("img",{src:k.imageUrl,alt:k.name,className:"nice-attraction-picker__image"}),e.jsxs("div",{className:"nice-attraction-picker__name",children:[e.jsx("span",{className:"nice-attraction-picker__icon",children:l.createElement(nn[k.category],{size:16})}),e.jsx("strong",{children:k.name})]}),k.description&&e.jsx("p",{className:"nice-attraction-picker__description",children:k.description}),e.jsxs("div",{className:"nice-attraction-picker__card-footer",children:[r&&e.jsxs("span",{className:"nice-attraction-picker__votes",children:[e.jsx(z.NtdThumbsUp,{size:14})," ",k.votes??0]}),!m&&u&&e.jsx("button",{type:"button",className:"nice-attraction-picker__vote",onClick:C=>{C.stopPropagation(),u(k.id)},children:n("attractionPicker.vote","Vote")})]})]},k.id)})})]})}),Jt=[],es={game:z.NtdGamepad,music:z.NtdMusic,dance:z.NtdMusic,quiz:z.NtdHelp,karaoke:z.NtdMicrophone,photo:z.NtdCamera,custom:z.NtdSparkle},ns=l.forwardRef(function(s,a){const{t:n}=F.useNiceTranslation(),{attractions:t=Jt,onVote:d,onUnvote:o,votedIds:u=[],maxVotes:f,closed:c=!1,sortBy:r="votes",showResults:m=!0,className:h,style:T}=s,g=l.useMemo(()=>new Set(u),[u]),x=f?f-g.size:void 0,P=l.useMemo(()=>{const p=[...t];switch(r){case"votes":p.sort((M,_)=>(_.votes??0)-(M.votes??0));break;case"name":p.sort((M,_)=>M.name.localeCompare(_.name));break;case"category":p.sort((M,_)=>M.category.localeCompare(_.category));break}return p},[t,r]),b=l.useMemo(()=>Math.max(...t.map(p=>p.votes??0),1),[t]),A=p=>{c||(g.has(p)?o==null||o(p):(!x||x>0)&&(d==null||d(p)))},v=p=>{switch(p){case 0:return e.jsx(z.NtdTrophy,{size:18,primaryColor:"#f59e0b",title:n("attractionVoting.n1stPlace","1st place")});case 1:return e.jsx(z.NtdMedal,{size:18,primaryColor:"#94a3b8",title:n("attractionVoting.n2ndPlace","2nd place")});case 2:return e.jsx(z.NtdMedal,{size:18,primaryColor:"#b45309",title:n("attractionVoting.n3rdPlace","3rd place")});default:return`${p+1}.`}};return e.jsxs("div",{ref:a,className:`nice-attraction-voting ${h??""}`,style:{color:"var(--nice-text-primary)",...T},children:[e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:16},children:[e.jsxs("h3",{style:{margin:0,display:"inline-flex",alignItems:"center",gap:8},children:[e.jsx(z.NtdClipboardCheck,{size:20}),c?n("attractionVoting.votingResults","Voting Results"):n("attractionVoting.voteForAttractions","Vote for Attractions")]}),!c&&x!==void 0&&e.jsxs("span",{style:{fontSize:14,color:x>0?"var(--nice-color-primary, #6366f1)":"var(--nice-color-error, #ef4444)"},children:[x," vote",x!==1?"s":""," remaining"]})]}),c&&e.jsx("p",{style:{color:"var(--nice-text-secondary, #64748b)",marginBottom:12},children:"Voting is closed. Final results:"}),e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:8},children:P.map((p,M)=>{const _=g.has(p.id),R=p.votes??0,k=m?`${Math.round(R/b*100)}%`:"0%";return e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12,padding:"10px 14px",borderRadius:8,border:_?"2px solid var(--nice-color-primary, #6366f1)":"1px solid var(--nice-border-color, #cbd5e1)",background:_?"color-mix(in srgb, var(--nice-color-primary) 12%, transparent)":"var(--nice-bg-elevated, var(--nice-bg-primary))",cursor:c?"default":"pointer",transition:"all 0.2s"},onClick:()=>A(p.id),children:[m&&e.jsx("span",{style:{fontSize:18,minWidth:32,textAlign:"center"},children:v(M)}),e.jsx("span",{style:{display:"inline-flex",fontSize:20},children:l.createElement(es[p.category],{size:20})}),e.jsxs("div",{style:{flex:1,minWidth:0},children:[e.jsx("div",{style:{fontWeight:600},children:p.name}),p.description&&e.jsx("div",{style:{fontSize:13,color:"var(--nice-text-secondary, #64748b)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:p.description}),m&&e.jsx("div",{style:{marginTop:4,height:6,borderRadius:3,background:"var(--nice-bg-tertiary, #e2e8f0)",overflow:"hidden"},children:e.jsx("div",{style:{height:"100%",width:k,background:"var(--nice-color-primary, #6366f1)",borderRadius:3,transition:"width 0.3s"}})})]}),m&&e.jsx("span",{style:{fontWeight:600,fontSize:16,minWidth:40,textAlign:"right"},children:R}),!c&&e.jsx("button",{onClick:j=>{j.stopPropagation(),A(p.id)},style:{padding:"4px 12px",borderRadius:4,border:"none",background:_?"var(--nice-color-error, #ef4444)":"var(--nice-color-primary, #6366f1)",color:"#fff",cursor:"pointer",fontSize:13},children:_?n("attractionVoting.unvote","Unvote"):n("attractionVoting.vote","Vote")})]},p.id)})}),m&&e.jsxs("div",{style:{marginTop:12,textAlign:"right",fontSize:13,color:"var(--nice-text-secondary, #64748b)"},children:["Total votes: ",t.reduce((p,M)=>p+(M.votes??0),0)]})]})});exports.NiceAttractionPicker=Zt;exports.NiceAttractionVoting=ns;exports.NiceEventMedia=En;exports.NiceEventPlanning=Un;exports.NiceExpenseSplit=Lt;exports.NiceGiftRegistry=Pt;exports.NiceInvitationDesigner=wt;exports.NiceKaraokePicker=Kt;exports.NiceMediaCollage=On;exports.NiceParticipantList=Kn;exports.NiceRoundCard=Vt;exports.NiceRoundList=Yt;exports.NiceRsvpControl=$e;exports.NiceSeatPicker=vt;exports.NiceSeatingChart=rn;exports.NiceSongPicker=qt;
|
package/dist/index.d.ts
CHANGED
|
@@ -351,7 +351,7 @@ export declare const NiceAttractionPicker: default_2.ForwardRefExoticComponent<N
|
|
|
351
351
|
/** Props for {@link NiceAttractionPicker}. */
|
|
352
352
|
export declare interface NiceAttractionPickerProps {
|
|
353
353
|
/** Available attractions. */
|
|
354
|
-
attractions
|
|
354
|
+
attractions?: EventAttraction[];
|
|
355
355
|
/** Called when selecting an attraction. */
|
|
356
356
|
onSelect?: (attractionId: string) => void;
|
|
357
357
|
/** Called when deselecting. */
|
|
@@ -380,7 +380,7 @@ export declare const NiceAttractionVoting: default_2.ForwardRefExoticComponent<N
|
|
|
380
380
|
/** Props for {@link NiceAttractionVoting}. */
|
|
381
381
|
export declare interface NiceAttractionVotingProps {
|
|
382
382
|
/** Attractions available for voting. */
|
|
383
|
-
attractions
|
|
383
|
+
attractions?: EventAttraction[];
|
|
384
384
|
/** Called when voting for an attraction. */
|
|
385
385
|
onVote?: (attractionId: string) => void;
|
|
386
386
|
/** Called when retracting a vote. */
|
|
@@ -768,7 +768,7 @@ export declare const NiceKaraokePicker: default_2.ForwardRefExoticComponent<Nice
|
|
|
768
768
|
/** Props for {@link NiceKaraokePicker}. */
|
|
769
769
|
export declare interface NiceKaraokePickerProps {
|
|
770
770
|
/** Available karaoke songs. */
|
|
771
|
-
songs
|
|
771
|
+
songs?: KaraokeSong[];
|
|
772
772
|
/** Current karaoke queue (ordered). */
|
|
773
773
|
queue?: KaraokeSong[];
|
|
774
774
|
/** Called when a song is added to the queue. */
|
|
@@ -923,7 +923,7 @@ export declare const NiceRoundList: default_2.ForwardRefExoticComponent<NiceRoun
|
|
|
923
923
|
/** Props for {@link NiceRoundList}. */
|
|
924
924
|
export declare interface NiceRoundListProps {
|
|
925
925
|
/** Rounds to display. */
|
|
926
|
-
rounds
|
|
926
|
+
rounds?: EventRound[];
|
|
927
927
|
/** Currently active round ID. */
|
|
928
928
|
activeRoundId?: string;
|
|
929
929
|
/** Called when selecting a round. */
|
|
@@ -1084,7 +1084,7 @@ export declare const NiceSongPicker: default_2.ForwardRefExoticComponent<NiceSon
|
|
|
1084
1084
|
/** Props for {@link NiceSongPicker}. */
|
|
1085
1085
|
export declare interface NiceSongPickerProps {
|
|
1086
1086
|
/** Available songs. */
|
|
1087
|
-
songs
|
|
1087
|
+
songs?: SongEntry[];
|
|
1088
1088
|
/** Called when adding a song to the queue/playlist. */
|
|
1089
1089
|
onAdd?: (songId: string) => void;
|
|
1090
1090
|
/** Called when removing a song. */
|