@nice2dev/events 1.2.1 → 1.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -1 +1 @@
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={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"};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;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),z=require("@nice2dev/icons"),N=require("@nice2dev/ui"),V=require("@nice2dev/ui-core"),l=require("react");function Rt(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 t=[...i],[n]=t.splice(s,1);return t.splice(a,0,n),t}function nt(i){const{items:s,onReorder:a,disabled:t=!1}=i,[n,d]=l.useState(null),[o,u]=l.useState(null),[f,r]=l.useState(!1),c=l.useRef(null),m=l.useCallback(g=>s.findIndex(P=>P.id===g),[s]),h=l.useCallback((g,P)=>{const b=m(g),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),r(!1),c.current=null},[]),x=l.useCallback((g,P)=>({role:"button",draggable:!1,tabIndex:t?-1:0,"aria-grabbed":n===g,onPointerDown:b=>{var p,M;if(t||b.button!==0&&b.pointerType==="mouse")return;(M=(p=b.currentTarget).setPointerCapture)==null||M.call(p,b.pointerId),d(g),r(!0),c.current=s.map(_=>_.id);const A=()=>{window.removeEventListener("pointerup",A),window.removeEventListener("pointercancel",v),r(!1),d(null),u(null)},v=()=>{window.removeEventListener("pointerup",A),window.removeEventListener("pointercancel",v),c.current&&(a==null||a(c.current)),T()};window.addEventListener("pointerup",A),window.addEventListener("pointercancel",v)},onPointerEnter:()=>{t||!n||n===g||(u(g),h(n,g))},onKeyDown:b=>{if(t)return;if(b.key===" "||b.key==="Enter"){b.preventDefault(),n===g?T():(d(g),c.current=s.map(_=>_.id));return}if(b.key==="Escape"&&n===g){b.preventDefault(),c.current&&(a==null||a(c.current)),T();return}if(n!==g)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(g),M=p+v;M<0||M>=s.length||a==null||a(We([...s],p,M).map(_=>_.id))},...P?{"aria-label":P}:{}}),[n,h,t,T,m,s,a]);return{activeId:n,overId:o,getHandleProps:x,dragging:f}}const Bt=({item:i})=>{const{t:s}=V.useNiceTranslation(),[a,t]=l.useState(!1),n=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||!n?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:n,alt:i.caption??"",className:"nice-event-media__thumb",loading:"lazy",onError:()=>t(!0)})},Lt=[],$t=l.forwardRef(function(s,a){const{t}=V.useNiceTranslation(),{items:n=Lt,onUpload:d,onDelete:o,onLike:u,onItemClick:f,layout:r="grid",uploadEnabled:c=!0,typeFilter:m="all",onReorder:h,className:T,style:x}=s,[g,P]=l.useState(""),b=l.useMemo(()=>Rt(n),[n]),A=l.useMemo(()=>m==="all"?b:b.filter(R=>R.type===m),[b,m]),v=!!h&&m==="all",p=nt({items:b,onReorder:h,disabled:!v}),M=R=>{const k=R[0];!k||!d||(d(k,g.trim()||void 0),P(""))},_=r==="list";return e.jsxs("div",{ref:a,className:`nice-event-media nice-event-media--${r} ${T??""}`,style:x,children:[e.jsx("div",{className:"nice-event-media__header",children:e.jsx("h3",{children:t("eventMedia.media","Media ({filtered})").replace("{filtered}",String(A.length))})}),c&&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:g,onChange:P,placeholder:t("eventMedia.addACaption","Add a caption…")})]}),A.length===0?e.jsx("p",{className:"nice-event-media__empty",children:t("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 y=v?p.getHandleProps(R.id,t("eventMedia.moveItem","Move {name}").replace("{name}",R.caption??t("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:y==null?void 0:y.onPointerEnter,role:f?"button":void 0,tabIndex:f?0:void 0,children:[y&&e.jsx("span",{className:"nice-event-media__grip",role:y.role,tabIndex:y.tabIndex,"aria-grabbed":y["aria-grabbed"],"aria-label":y["aria-label"],draggable:y.draggable,onPointerDown:y.onPointerDown,onKeyDown:y.onKeyDown,onClick:C=>C.stopPropagation(),children:e.jsx(z.NtdMove,{size:14})}),e.jsx(Bt,{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":t("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":t("eventMedia.delete","Delete"),children:e.jsx(z.NtdTrash,{size:15})})]})]})]},R.id)})})]})}),pe=({title:i,description:s,icon:a,action:t,className:n})=>e.jsx(N.NiceEmpty,{size:"sm",title:i,description:s,icon:a,action:t,className:n}),Dt=[],Et=l.forwardRef(function(s,a){const{t}=V.useNiceTranslation(),{items:n=Dt,layout:d="grid",onReorder:o,onItemAdd:u,onItemRemove:f,onCaptionChange:r,onItemClick:c,previewMode:m=!1,transition:h="fade",defaultDurationMs:T=3e3,autoPlay:x=!0,disabled:g=!1,readOnly:P=!1,size:b="md",className:A,style:v}=s,[p,M]=l.useState(0),[_,R]=l.useState(null),[k,y]=l.useState(""),C=g||P,O=!!o&&!C,F=nt({items:n,onReorder:o,disabled:!O}),D=n.length>0?Math.min(p,n.length-1):0,$=n[D],X=($==null?void 0:$.durationMs)??T;l.useEffect(()=>{if(!m||!x||n.length<2)return;const B=window.setTimeout(()=>M(K=>(K+1)%n.length),Math.max(250,X));return()=>window.clearTimeout(B)},[m,x,n.length,D,X]);const w=l.useMemo(()=>n.reduce((B,K)=>B+(K.durationMs??T),0),[n,T]),j=B=>{r==null||r(B,k),R(null),y("")};return n.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:t("mediaCollage.nothingInTheCollageYet","Nothing in the collage yet"),description:t("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:[($==null?void 0:$.type)==="video"?e.jsx("video",{className:"nice-media-collage__slide",src:$.mediaUrl,controls:!0},$.id):e.jsx("img",{className:"nice-media-collage__slide",src:$==null?void 0:$.mediaUrl,alt:($==null?void 0:$.caption)??""},$==null?void 0:$.id),($==null?void 0:$.caption)&&e.jsx("p",{className:"nice-media-collage__slide-caption",children:$.caption})]}),e.jsxs("div",{className:"nice-media-collage__playbar",children:[e.jsx(N.NiceButton,{size:"sm",variant:"ghost",onClick:()=>M(B=>(B-1+n.length)%n.length),children:t("mediaCollage.previous","Previous")}),e.jsxs("span",{className:"nice-media-collage__counter",children:[D+1," / ",n.length]}),e.jsx(N.NiceButton,{size:"sm",variant:"ghost",onClick:()=>M(B=>(B+1)%n.length),children:t("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:t("mediaCollage.sequence","Sequence")},{value:"grid",label:t("mediaCollage.grid","Grid")},{value:"mosaic",label:t("mediaCollage.mosaic","Mosaic")}]}),e.jsx("span",{className:"nice-media-collage__duration",children:n.length===1?t("mediaCollage.itemsOne","{items} item · {totalDuration}s").replace("{items}",String(n.length)).replace("{totalDuration}",String(Math.round(w/1e3))):t("mediaCollage.itemsMany","{items} items · {totalDuration}s").replace("{items}",String(n.length)).replace("{totalDuration}",String(Math.round(w/1e3)))}),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":t("mediaCollage.collageOrder","Collage order"),"aria-busy":F.dragging,children:n.map((B,K)=>{const q=O?F.getHandleProps(B.id,t("mediaCollage.moveItem","Move {name}").replace("{name}",B.caption??t("mediaCollage.itemN","item {n}").replace("{n}",String(K+1)))):null;return e.jsxs("li",{className:`nice-media-collage__tile${F.activeId===B.id?" nice-media-collage__tile--active":""}${F.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:K+1}),e.jsx("button",{type:"button",className:"nice-media-collage__thumb-button",onClick:()=>c==null?void 0:c(B),disabled:!c,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:y,placeholder:t("mediaCollage.caption","Caption"),autoFocus:!0,size:"sm",onBlur:()=>j(B.id),onKeyDown:I=>{I.key==="Enter"&&j(B.id),I.key==="Escape"&&R(null)}}):e.jsx("button",{type:"button",className:"nice-media-collage__caption",disabled:!r||C,onClick:()=>{R(B.id),y(B.caption??"")},children:B.caption||e.jsx("em",{children:t("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:t("mediaCollage.removeItem","Remove {name}").replace("{name}",B.caption??t("mediaCollage.itemN","item {n}").replace("{n}",String(K+1))),disabled:g,onClick:()=>f(B.id),children:e.jsx(z.NtdTrash,{size:14})})]})]},B.id)})}),u&&!C&&n.length>0&&e.jsxs("p",{className:"nice-media-collage__hint",children:[e.jsx(z.NtdPlus,{size:12})," ",t("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 Ot={micro:[],compact:["details","location","budget"],normal:["details","location","schedule","participants","tasks","surveys","budget"],full:["details","location","schedule","participants","tasks","surveys","vendors","budget","documents","settings"]},Yt=l.forwardRef(function(s,a){var Ye,Ue,Ve,Fe,Xe,qe;const{t}=V.useNiceTranslation(),{event:n,participants:d=[],surveys:o=[],billing:u=[],scheduleItems:f=[],tasks:r=[],vendors:c=[],documents:m=[],displayMode:h="normal",tabs:T,activeTab:x,onTabChange:g,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:y=!0,showBudget:C=!0,showDocuments:O=!0,showSettings:F=!0,editable:D=!1,onSave:$,onPublish:X,onShare:w,onExport:j,onUpdateEvent:B,onUpdateLocation:K,onAddSurvey:q,onSurveyRespond:I,onAddBilling:U,className:W,style:Z}=s,[Y,J]=l.useState(n.title),[Q,he]=l.useState(n.description??""),[se,oe]=l.useState(n.startDate??""),[ge,we]=l.useState(n.endDate??""),[xe,le]=l.useState(((Ye=n.location)==null?void 0:Ye.name)??""),[ve,Ae]=l.useState(((Ue=n.location)==null?void 0:Ue.address)??""),[de,ae]=l.useState(((Ve=n.location)==null?void 0:Ve.virtualUrl)??""),[ne,je]=l.useState(((Fe=n.location)==null?void 0:Fe.isVirtual)??!1),[ue,be]=l.useState(""),[me,Re]=l.useState("single"),[fe,Ne]=l.useState(""),[re,ke]=l.useState(""),[_e,L]=l.useState(""),[E,G]=l.useState("PLN"),H={details:v,location:p,schedule:M,participants:_,tasks:R,surveys:k,vendors:y,budget:C,documents:O,settings:F},ce=(T??Ot[h]).filter(S=>H[S]!==!1),[Ce,ot]=l.useState(ce[0]??"details"),lt=x??Ce,dt=l.useCallback(S=>{const ie=S;x===void 0&&ot(ie),g==null||g(ie)},[x,g]),ut=l.useCallback(()=>{B==null||B({title:Y,description:Q||void 0,startDate:se||void 0,endDate:ge||void 0})},[Y,Q,se,ge,B]),mt=l.useCallback(()=>{K==null||K({name:xe,address:ve||void 0,virtualUrl:de||void 0,isVirtual:ne})},[xe,ve,de,ne,K]),pt=l.useCallback(()=>{if(!ue.trim()||!q)return;const S=fe.split(",").map(ie=>ie.trim()).filter(Boolean);q(ue.trim(),me,S.length>0?S:void 0),be(""),Ne("")},[ue,me,fe,q]),ht=l.useCallback(()=>{!re.trim()||!U||(U({label:re.trim(),amount:parseFloat(_e)||0,currency:E}),ke(""),L(""))},[re,_e,E,U]),gt=l.useMemo(()=>u.map(S=>({label:S.label,amount:S.amount})),[u]),xt=l.useMemo(()=>u.reduce((S,ie)=>S+ie.amount,0),[u]),vt=((Xe=u[0])==null?void 0:Xe.currency)??"PLN",ft=e.jsxs("div",{className:"nice-event-planning__form",children:[e.jsx(N.NiceTextInput,{label:t("eventPlanning.title","Title"),value:Y,onChange:J,readOnly:!D}),e.jsx(N.NiceTextArea,{label:t("eventPlanning.description","Description"),value:Q,onChange:he,readOnly:!D,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:t("eventPlanning.start","Start")}),e.jsx("input",{className:"nice-input",type:"datetime-local",value:se,onChange:S=>oe(S.target.value),readOnly:!D})]}),e.jsxs("label",{className:"nice-field",children:[e.jsx("span",{className:"nice-field__label",children:t("eventPlanning.end","End")}),e.jsx("input",{className:"nice-input",type:"datetime-local",value:ge,onChange:S=>we(S.target.value),readOnly:!D})]})]}),D&&e.jsx(N.NiceButton,{variant:"primary",leftIcon:e.jsx(V.NiceIcon,{name:"check",size:"sm"}),onClick:ut,children:t("eventPlanning.saveDetails","Save details")})]}),Nt=e.jsxs("div",{className:"nice-event-planning__form",children:[e.jsx(N.NiceToggle,{label:t("eventPlanning.virtualEvent","Virtual event"),checked:ne,onChange:je,disabled:!D}),e.jsx(N.NiceTextInput,{label:t("eventPlanning.venueName","Venue name"),value:xe,onChange:le,readOnly:!D}),ne?e.jsx(N.NiceTextInput,{label:t("eventPlanning.virtualUrl","Virtual URL"),value:de,onChange:ae,readOnly:!D}):e.jsx(N.NiceTextInput,{label:t("eventPlanning.address","Address"),value:ve,onChange:Ae,readOnly:!D}),D&&e.jsx(N.NiceButton,{variant:"primary",leftIcon:e.jsx(V.NiceIcon,{name:"check",size:"sm"}),onClick:mt,children:t("eventPlanning.saveLocation","Save location")})]}),_t=e.jsx("div",{className:"nice-event-planning__participants",children:d.length===0?e.jsx("p",{className:"nice-event-planning__empty",children:t("eventPlanning.noParticipantsYet","No participants yet.")}):e.jsxs(e.Fragment,{children:[e.jsx(N.NiceAvatarGroup,{max:8,children:d.map(S=>e.jsx(N.NiceAvatar,{name:S.name,src:S.avatarUrl},S.id))}),e.jsx("ul",{className:"nice-event-planning__participant-list",children:d.map(S=>e.jsxs("li",{className:"nice-event-planning__participant",children:[e.jsx(N.NiceAvatar,{name:S.name,src:S.avatarUrl,size:"sm"}),e.jsx("span",{className:"nice-event-planning__participant-name",children:S.name}),e.jsx(N.NiceBadge,{size:"xs",subtle:!0,variant:Ie(S.status),children:t(`participantList.status.${S.status}`,S.status)})]},S.id))})]})}),yt=e.jsxs("div",{className:"nice-event-planning__form",children:[o.length===0?e.jsx("p",{className:"nice-event-planning__empty",children:t("eventPlanning.noSurveysYet","No surveys yet.")}):o.map(S=>e.jsxs("div",{className:"nice-event-planning__survey",children:[e.jsx("strong",{children:S.question})," ",e.jsx(N.NiceBadge,{size:"xs",outline:!0,variant:"info",children:t(`eventPlanning.surveyType.${S.type}`,S.type)}),S.options&&e.jsx("div",{className:"nice-event-planning__survey-options",children:S.options.map((ie,At)=>e.jsx(N.NiceButton,{size:"sm",variant:"outline",onClick:()=>I==null?void 0:I(S.id,ie),children:ie},At))}),S.responses&&e.jsx("span",{className:"nice-event-planning__muted",children:t("eventPlanning.responses","{responses} responses").replace("{responses}",String(S.responses.length))})]},S.id)),D&&q&&e.jsxs("div",{className:"nice-event-planning__form",children:[e.jsx(N.NiceTextInput,{label:t("eventPlanning.newSurveyQuestion","New survey question"),value:ue,onChange:be,placeholder:t("eventPlanning.question","Question")}),e.jsx(N.NiceSelect,{label:t("eventPlanning.type","Type"),value:me,onChange:S=>Re(S),options:[{value:"single",label:t("eventPlanning.singleChoice","Single choice")},{value:"multiple",label:t("eventPlanning.multipleChoice","Multiple choice")},{value:"text",label:t("eventPlanning.freeText","Free text")},{value:"rating",label:t("eventPlanning.rating","Rating")}]}),e.jsx(N.NiceTextInput,{label:t("eventPlanning.optionsCommaSeparated","Options (comma-separated)"),value:fe,onChange:Ne,placeholder:t("eventPlanning.yesNoMaybe","Yes, No, Maybe")}),e.jsx(N.NiceButton,{variant:"primary",leftIcon:e.jsx(V.NiceIcon,{name:"plus",size:"sm"}),onClick:pt,disabled:!ue.trim(),children:t("eventPlanning.addSurvey","Add survey")})]})]}),jt=e.jsxs("div",{className:"nice-event-planning__form",children:[u.length===0?e.jsx("p",{className:"nice-event-planning__empty",children:t("eventPlanning.noBillingItemsYet","No billing items yet.")}):e.jsx(N.NiceAmountBreakdown,{lines:[...gt,{label:t("eventPlanning.total","Total"),amount:xt,isSummary:!0}],currency:vt}),D&&U&&e.jsxs("div",{className:"nice-event-planning__row",children:[e.jsx(N.NiceTextInput,{label:t("eventPlanning.item","Item"),value:re,onChange:ke,placeholder:t("eventPlanning.catering","Catering")}),e.jsx(N.NiceTextInput,{label:t("eventPlanning.amount","Amount"),value:_e,onChange:L,placeholder:"0.00"}),e.jsx(N.NiceSelect,{label:t("eventPlanning.currency","Currency"),value:E,onChange:S=>G(S),options:["PLN","EUR","USD","GBP"]}),e.jsx(N.NiceButton,{variant:"primary",leftIcon:e.jsx(V.NiceIcon,{name:"plus",size:"sm"}),onClick:ht,disabled:!re.trim(),children:t("eventPlanning.add","Add")})]})]}),bt=e.jsxs("div",{className:"nice-event-planning__form",children:[e.jsx(N.NiceToggle,{label:t("eventPlanning.publicEvent","Public event"),checked:n.isPublic??!1,disabled:!D}),e.jsx(N.NiceTextInput,{label:t("eventPlanning.maxParticipants","Max participants"),value:n.maxParticipants!=null?String(n.maxParticipants):"",onChange:()=>{},readOnly:!D}),e.jsx("div",{className:"nice-event-planning__muted",children:t("eventPlanning.hostCreated","Host: {hostName} · Created {createdAt}").replace("{hostName}",String(n.hostName)).replace("{createdAt}",String(new Date(n.createdAt).toLocaleDateString()))})]}),kt=e.jsx("div",{className:"nice-event-planning__list",children:f.length===0?e.jsx("p",{className:"nice-event-planning__empty",children:t("eventPlanning.noAgendaItemsYet","No agenda items yet.")}):e.jsx("ul",{className:"nice-event-planning__schedule",children:f.map(S=>e.jsxs("li",{className:"nice-event-planning__schedule-item",children:[e.jsxs("span",{className:"nice-event-planning__schedule-time",children:[e.jsx(V.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))})}),St=e.jsx("div",{className:"nice-event-planning__list",children:r.length===0?e.jsx("p",{className:"nice-event-planning__empty",children:t("eventPlanning.noTasksYet","No tasks yet.")}):e.jsx("ul",{className:"nice-event-planning__tasks",children:r.map(S=>e.jsxs("li",{className:"nice-event-planning__task",children:[e.jsx(N.NiceToggle,{label:S.title,checked:S.done??!1,disabled:!D}),S.assigneeName&&e.jsx(N.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))})}),wt=e.jsx("div",{className:"nice-event-planning__list",children:c.length===0?e.jsx("p",{className:"nice-event-planning__empty",children:t("eventPlanning.noVendorsYet","No vendors yet.")}):e.jsx("ul",{className:"nice-event-planning__vendors",children:c.map(S=>e.jsxs("li",{className:"nice-event-planning__vendor",children:[e.jsx(V.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(N.NiceBadge,{size:"xs",subtle:!0,variant:Ie(S.status),children:t(`eventPlanning.vendorStatus.${S.status}`,S.status)}),S.cost!=null&&e.jsxs("span",{className:"nice-event-planning__vendor-cost",children:[S.cost," ",S.currency??""]})]},S.id))})}),Ct=e.jsx("div",{className:"nice-event-planning__list",children:m.length===0?e.jsx("p",{className:"nice-event-planning__empty",children:t("eventPlanning.noDocumentsYet","No documents yet.")}):e.jsx("ul",{className:"nice-event-planning__documents",children:m.map(S=>e.jsxs("li",{className:"nice-event-planning__document",children:[e.jsx(V.NiceIcon,{name:"file",size:"sm"}),e.jsx("span",{className:"nice-event-planning__document-name",children:S.name}),S.fileType&&e.jsx(N.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))})}),It={details:ft,location:Nt,schedule:kt,participants:_t,tasks:St,surveys:yt,vendors:wt,budget:jt,documents:Ct,settings:bt},Pt={details:"file",location:"home",schedule:"clock",participants:"users",tasks:"list",surveys:"clipboard",vendors:"briefcase",budget:"dollar",documents:"folder",settings:"settings"},Tt={schedule:f.length||void 0,participants:d.length||void 0,tasks:r.length||void 0,surveys:o.length||void 0,vendors:c.length||void 0,budget:u.length||void 0,documents:m.length||void 0},zt=ce.map(S=>({id:S,label:S.charAt(0).toUpperCase()+S.slice(1),icon:e.jsx(V.NiceIcon,{name:Pt[S],size:"sm"}),badge:Tt[S],content:It[S]})),Mt=e.jsxs("div",{className:"nice-event-planning__toolbar",children:[e.jsxs("div",{className:"nice-event-planning__toolbar-title",children:[e.jsx(V.NiceIcon,{name:"calendar",size:"md"}),e.jsx("span",{className:"nice-event-planning__title",children:n.title}),e.jsx(N.NiceBadge,{size:"sm",variant:Ie(n.status),children:t(`eventPlanning.eventStatus.${n.status}`,n.status)})]}),e.jsx("span",{className:"nice-event-planning__toolbar-spacer"}),e.jsxs("div",{className:"nice-event-planning__toolbar-actions",children:[$&&e.jsx(N.NiceButton,{size:"sm",variant:"primary",leftIcon:e.jsx(V.NiceIcon,{name:"check",size:"sm"}),onClick:()=>$({title:Y,description:Q}),children:t("eventPlanning.save","Save")}),X&&e.jsx(N.NiceButton,{size:"sm",variant:"success",leftIcon:e.jsx(V.NiceIcon,{name:"upload",size:"sm"}),onClick:X,children:t("eventPlanning.publish","Publish")}),w&&e.jsx(N.NiceButton,{size:"sm",variant:"ghost",leftIcon:e.jsx(V.NiceIcon,{name:"link",size:"sm"}),onClick:w,children:t("eventPlanning.share","Share")}),j&&e.jsx(N.NiceButton,{size:"sm",variant:"ghost",leftIcon:e.jsx(V.NiceIcon,{name:"download",size:"sm"}),onClick:j,children:t("eventPlanning.export","Export")})]})]});return h==="micro"?e.jsx("div",{ref:a,className:`nice-event-planning nice-event-planning--micro ${W??""}`,style:Z,children:e.jsxs("div",{className:"nice-event-planning__micro",children:[e.jsx(V.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():t("eventPlanning.noDate","No date"),(qe=n.location)!=null&&qe.name?` · ${n.location.name}`:""]})]}),e.jsx(N.NiceBadge,{size:"sm",variant:Ie(n.status),children:t(`eventPlanning.eventStatus.${n.status}`,n.status)}),d.length>0&&e.jsx(N.NiceAvatarGroup,{max:4,size:"sm",children:d.map(S=>e.jsx(N.NiceAvatar,{name:S.name,src:S.avatarUrl,size:"sm"},S.id))})]})}):e.jsxs("div",{ref:a,className:`nice-event-planning nice-event-planning--${h} ${W??""}`,style:Z,children:[Mt,e.jsx(N.NiceTabs,{tabs:zt,activeTab:lt,onChange:dt,iconOnly:P,centered:b,countLocation:A})]})});function Ut(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:t,children:n,size:d="md",className:o})=>{const{t:u}=V.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:Ut(i.status),children:u(`participantList.status.${i.status}`,i.status)}),t&&e.jsx("span",{className:"nice-participant-row__meta",children:t}),n&&e.jsx("span",{className:"nice-participant-row__trailing",children:n})]})},Vt=/^[^\s@,;]+@[^\s@,;]+\.[^\s@,;]{2,}$/,Ge=/^.*<\s*([^<>\s]+)\s*>$/;function st(i){var d,o;const s=[],a=[],t=new Set;let n=0;if(!i)return{valid:s,invalid:a,duplicates:n};for(const u of i.split(/[,;\r\n\t]+/)){const f=u.trim();if(!f)continue;const r=((o=(d=Ge.exec(f))==null?void 0:d[1])==null?void 0:o.trim())??f,c=Ge.test(f)?[r]:r.split(/\s+/);for(const m of c){if(!m)continue;if(!Vt.test(m)){a.push(m);continue}const h=m.toLowerCase();if(t.has(h)){n+=1;continue}t.add(h),s.push(m)}}return{valid:s,invalid:a,duplicates:n}}function Ft(i,s){const a=new Set(i.map(n=>n.toLowerCase())),t=[...i];for(const n of s){const d=n.toLowerCase();a.has(d)||(a.add(d),t.push(n))}return t}function it(i={}){const{currentUserId:s,currentUserName:a,requireIdentity:t=!0}=i,[n,d]=l.useState(""),o=!s,u=a??n,f=!t||u.trim().length>0;return{isAnonymous:o,name:u,setName:d,canAct:f,actor:{userId:s,userName:u.trim()}}}const Xt=[{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}],Le=l.forwardRef(function(s,a){const{t}=V.useNiceTranslation(),{value:n,onRespond:d,allowPlusOnes:o=!1,maxPlusOnes:u=5,plusOnes:f=0,allowNote:r=!1,currentUserId:c,currentUserName:m,compact:h=!1,disabled:T=!1,readOnly:x=!1,size:g="md",className:P,style:b}=s,A=it({currentUserId:c,currentUserName:m}),[v,p]=l.useState(f),[M,_]=l.useState(""),R=!h&&A.isAnonymous&&!A.canAct,k=T||x,y=C=>{k||!d||d({answer:C,plusOnes:o&&C!=="no"?v:void 0,note:r&&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--${g}${h?" nice-rsvp-control--compact":""} ${P??""}`,style:b,children:[!h&&A.isAnonymous&&e.jsx(N.NiceTextInput,{label:t("rsvpControl.yourName","Your name"),value:A.name,onChange:A.setName,placeholder:t("rsvpControl.whoIsReplying","Who is replying?"),required:!0,disabled:k,size:g}),e.jsx("div",{className:"nice-rsvp-control__answers",role:"group","aria-label":t("rsvpControl.yourReply","Your reply"),children:Xt.map(({answer:C,label:O,variant:F,Icon:D})=>e.jsx(N.NiceButton,{size:g,variant:n===C?F:"outline",leftIcon:e.jsx(D,{size:16}),disabled:k||R,"aria-pressed":n===C,onClick:()=>y(C),children:t(`rsvpControl.answer.${C}`,O)},C))}),!h&&o&&n!=="no"&&e.jsxs("label",{className:"nice-rsvp-control__field",children:[e.jsx("span",{className:"nice-rsvp-control__field-label",children:t("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&&r&&e.jsx(N.NiceTextInput,{label:t("rsvpControl.note","Note"),value:M,onChange:_,placeholder:t("rsvpControl.anythingWeShouldKnow","Anything we should know?"),disabled:k,size:g}),R&&e.jsx("p",{className:"nice-rsvp-control__hint",children:t("rsvpControl.enterYourNameToReply","Enter your name to reply.")})]})}),qt={yes:"confirmed",maybe:"invited",no:"declined"},Ke={confirmed:"yes","checked-in":"yes",declined:"no"},Pe=["confirmed","checked-in","invited","declined","no-show"],Wt=[],Gt=l.forwardRef(function(s,a){const{t}=V.useNiceTranslation(),{participants:n=Wt,mode:d="organizer",currentUserId:o,currentUserName:u,onRsvpChange:f,onCheckIn:r,onScan:c,checkInSlot:m,onInvite:h,extraFields:T,groupBy:x="none",showSummary:g=!0,showSearch:P=!0,allowPlusOnes:b=!1,disabled:A=!1,readOnly:v=!1,size:p="md",className:M,style:_}=s,[R,k]=l.useState(""),[y,C]=l.useState("all"),[O,F]=l.useState(""),D=A||v,$=d==="guest",X=l.useMemo(()=>{const I={total:n.length};for(const U of Pe)I[U]=0;for(const U of n)I[U.status]=(I[U.status]??0)+1;return I},[n]),w=l.useMemo(()=>{if($)return n.filter(U=>U.userId===o||U.id===o);const I=R.trim().toLowerCase();return n.filter(U=>y!=="all"&&U.status!==y?!1:!I||U.name.toLowerCase().includes(I))},[n,$,o,R,y]),j=l.useMemo(()=>{if(x==="none"||$)return[{key:"all",label:"",items:w}];const I=new Map;for(const W of w){const Z=x==="status"?W.status:W.role,Y=I.get(Z);Y?Y.push(W):I.set(Z,[W])}return[...I.keys()].sort((W,Z)=>x!=="status"?W.localeCompare(Z):Pe.indexOf(W)-Pe.indexOf(Z)).map(W=>({key:W,label:W,items:I.get(W)??[]}))},[w,x,$]),B=l.useMemo(()=>st(O),[O]),K=I=>U=>{f==null||f(I,qt[U.answer],U)},q=()=>{!h||B.valid.length===0||(h(B.valid),F(""))};if($){const I=w[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(Le,{value:Ke[I.status],onRespond:K(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:t("participantList.youAreNotOnThis","You are not on this guest list"),description:t("participantList.askTheHostForAn","Ask the host for an invitation link.")})})}return e.jsxs("div",{ref:a,className:`nice-participant-list ${M??""}`,style:_,children:[g&&e.jsxs("div",{className:"nice-participant-list__summary",children:[e.jsxs("span",{className:"nice-participant-list__stat",children:[e.jsx("strong",{children:X.confirmed})," ",t("participantList.confirmed","confirmed")]}),e.jsxs("span",{className:"nice-participant-list__stat",children:[e.jsx("strong",{children:X.invited})," ",t("participantList.awaitingReply","awaiting reply")]}),e.jsxs("span",{className:"nice-participant-list__stat",children:[e.jsx("strong",{children:X.declined})," ",t("participantList.declined","declined")]}),e.jsxs("span",{className:"nice-participant-list__stat",children:[e.jsx("strong",{children:X["checked-in"]})," ",t("participantList.checkedIn","checked in")]}),e.jsxs("span",{className:"nice-participant-list__stat nice-participant-list__stat--total",children:[e.jsx("strong",{children:X.total})," ",t("participantList.total","total")]})]}),(P||m||c)&&e.jsxs("div",{className:"nice-participant-list__toolbar",children:[P&&e.jsxs(e.Fragment,{children:[e.jsx(N.NiceTextInput,{value:R,onChange:k,placeholder:t("participantList.searchGuests","Search guests…"),prefix:e.jsx(z.NtdSearch,{size:15}),size:p}),e.jsx(N.NiceSelect,{value:y,onChange:I=>C(I),size:p,options:[{value:"all",label:t("participantList.allStatuses","All statuses")},...Pe.map(I=>({value:I,label:t(`participantList.status.${I}`,I)}))]})]}),m,c&&!m&&e.jsxs("span",{className:"nice-participant-list__scan-hint",children:[e.jsx(z.NtdQrCode,{size:15})," ",t("participantList.scannerReady","Scanner ready")]})]}),w.length===0?e.jsx(pe,{title:t("participantList.noGuestsYet","No guests yet"),description:n.length>0?t("participantList.noMatch","No one matches the current filter."):t("participantList.invitePeopleHint","Invite people to see them here.")}):j.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(Le,{compact:!0,value:Ke[U.status],onRespond:K(U.id),currentUserId:U.userId,currentUserName:U.name,disabled:D,size:"sm"}),r&&U.status!=="checked-in"&&e.jsx(N.NiceButton,{size:"sm",variant:"outline",leftIcon:e.jsx(z.NtdCheck,{size:14}),disabled:D,onClick:()=>r(U.id),children:t("participantList.checkIn","Check in")})]},U.id))})]},I.key)),h&&!v&&e.jsxs("div",{className:"nice-participant-list__invite",children:[e.jsx(N.NiceTextArea,{label:t("participantList.inviteByEmail","Invite by email"),value:O,onChange:F,placeholder:t("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:t("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&&`${t("participantList.duplicatesRemoved","{count} duplicate(s) removed.").replace("{count}",String(B.duplicates))} `,B.invalid.length>0&&t("participantList.notRecognised","{count} entry(ies) not recognised.").replace("{count}",String(B.invalid.length))]})]})]})}),Kt={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 De(i){return Kt[i==null?void 0:i.toUpperCase()]??2}function Ee(i,s){return Number.isFinite(i)?Math.round(i*10**De(s)):0}function ze(i,s){const a=De(s);return a===0?i:i/10**a}function Ht(i,s,a){const t=De(s),n=ze(i,s);try{return new Intl.NumberFormat(a,{style:"currency",currency:s.toUpperCase(),minimumFractionDigits:t,maximumFractionDigits:t}).format(n)}catch{return`${n.toFixed(t)} ${s}`}}function te(i,s,a){return Ht(Ee(i,s),s,a)}const $e={minX:0,minY:0,maxX:0,maxY:0};function Qt(i,s=0){if(i.length===0)return{...$e};let a=1/0,t=1/0,n=-1/0,d=-1/0;for(const o of i)o.x<a&&(a=o.x),o.y<t&&(t=o.y),o.x>n&&(n=o.x),o.y>d&&(d=o.y);return{minX:a-s,minY:t-s,maxX:n+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 Zt(i,s,a=0){const t=i.zoom||1,n=-i.pan.x/t-a,d=-i.pan.y/t-a;return{minX:n,minY:d,maxX:n+s.width/t+a*2,maxY:d+s.height/t+a*2}}function Jt(i,s=12){const a=[],t=[],n=new Map,d=new Map;let o=null,u=0;for(const f of i.sections??[]){let r=null,c=0;(f.rows??[]).forEach((h,T)=>{const x=en(h.seats??[]);if(x.length===0)return;const g=Qt(x,s);t.push({sectionId:f.id,rowIndex:T,label:h.label,seats:x,bounds:g}),x.forEach((P,b)=>{n.set(P.id,P),d.set(P.id,{sectionId:f.id,rowIndex:T,seatIndex:b})}),c+=x.length,r=r?He(r,g):g});const m=r??{...$e};a.push({section:f,bounds:m,seatCount:c}),u+=c,c>0&&(o=o?He(o,m):m)}return{sections:a,rows:t,bounds:o??{...$e},totalSeats:u,seatById:n,locationById:d}}function en(i){return[...i].sort((s,a)=>s.number-a.number||s.x-a.x)}function tn(i,s){return i>s*4?"section":i>s?"row":"seat"}function nn(i,s,a=2500,t){const n=i.sections.filter(c=>Qe(c.bounds,s)),d=new Set(n.map(c=>c.section.id)),o=i.rows.filter(c=>d.has(c.sectionId)&&Qe(c.bounds,s));let u=0;for(const c of o)for(const m of c.seats)m.x>=s.minX&&m.x<=s.maxX&&m.y>=s.minY&&m.y<=s.maxY&&(u+=1);const f=t??tn(u,a);let r=[];if(f==="seat"){r=[];for(const c of o)for(const m of c.seats)m.x>=s.minX&&m.x<=s.maxX&&m.y>=s.minY&&m.y<=s.maxY&&r.push(m)}return{tier:f,sections:n,rows:f==="section"?[]:o,seats:r,visibleSeatCount:u}}function Oe(i){if(i.accessType)return i.accessType;if(i.status==="wheelchair"||i.status==="companion")return i.status}function ye(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 n;const t=(n=s.priceCategories)==null?void 0:n.find(d=>d.id===i.priceCategoryId);return{amount:(t==null?void 0:t.price)??a.basePrice,currency:a.currency}}function sn(i,s={},a){return!(ye(i,a)!=="available"||s.allowedCategories&&!s.allowedCategories.includes(i.priceCategoryId))}function at(i,s={},a){const t=[];let n=null;return i.forEach((d,o)=>{sn(d,s,a)?n?n.seats.push(d):n={start:o,seats:[d]}:n&&(t.push(n),n=null)}),n&&t.push(n),t}function an(i,s,a={},t){const n=a.maxSeats??8;if(i.length>n)return{ok:!1,reason:"max-seats"};for(const o of i){const u=s.seatById.get(o);if(u){if(ye(u,t)!=="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}`,r=d.get(f);r?r.push(o):d.set(f,[o])}for(const[o,u]of d){const[f,r]=o.split("::"),c=Number(r),m=s.rows.find(v=>v.sectionId===f&&v.rowIndex===c);if(!m)continue;const h=at(m.seats,a,t),T=new Set(u);let x=null;for(const v of h)if(v.seats.some(p=>T.has(p.id))){if(x)return{ok:!1,reason:"not-adjacent",seatId:u[0]};x=v}if(!x)continue;const g=x.seats.map((v,p)=>T.has(v.id)?p:-1).filter(v=>v>=0);if(g.length===0)continue;const P=g[0],b=g[g.length-1];if(b-P+1!==g.length)return{ok:!1,reason:"not-adjacent",seatId:u[0]};const A=x.seats.length;if(A>1&&(P===1||A-1-b===1))return{ok:!1,reason:"orphan-seat",seatId:u[0]}}return{ok:!0}}function rn(i,s,a,t={},n){if(i.includes(s))return{selected:i.filter(u=>u!==s)};const d=[...i,s],o=an(d,a,t,n);return o.ok?{selected:d}:{rejected:o.reason??"not-adjacent"}}function cn(i,s,a={},t={},n){if(s<=0)return[];const d=t.categoryId?{...a,allowedCategories:[t.categoryId]}:a;let o=null;for(const u of i.rows)if(!(t.sectionId&&u.sectionId!==t.sectionId))for(const f of at(u.seats,d,n)){const r=f.seats.length;if(!(r<s))for(let c=0;c+s<=r;c+=1){const m=c+s-1;if(r>s&&(c===1||r-1-m===1))continue;const h=f.seats.slice(c,m+1),T=h.reduce((x,g)=>x+(g.viewScore??50),0)/s;(!o||T>o.score)&&(o={ids:h.map(x=>x.id),score:T})}}return(o==null?void 0:o.ids)??[]}function on(i,s,a){var c,m,h,T;const t=i.locationById.get(s);if(!t)return null;const n=i.rows.findIndex(x=>x.sectionId===t.sectionId&&x.rowIndex===t.rowIndex);if(n<0)return null;const d=i.rows[n];if(a==="left")return((c=d.seats[t.seatIndex-1])==null?void 0:c.id)??null;if(a==="right")return((m=d.seats[t.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"?n-1:n+1];if(!o)return null;const u=d.seats[t.seatIndex].x;let f=null,r=1/0;for(const x of o.seats){const g=Math.abs(x.x-u);g<r&&(r=g,f=x)}return(f==null?void 0:f.id)??null}function ln(i,s,a){var f,r,c;const t=i.sections.filter(m=>m.seatCount>0);if(t.length===0)return null;const n=s?(f=i.locationById.get(s))==null?void 0:f.sectionId:void 0,d=t.findIndex(m=>m.section.id===n),o=d<0?0:a==="next"?d+1:d-1,u=t[o];return u?((c=(r=i.rows.find(m=>m.sectionId===u.section.id))==null?void 0:r.seats[0])==null?void 0:c.id)??null:null}const Se=8;function dn(i,s){return i.seats.length===0?0:i.seats.filter(t=>ye(t,s)==="available").length/i.seats.length}const un=({cull:i,selectedIds:s,cursorId:a,statusOverrides:t,sectionColorById:n,interactive:d,onSeatClick:o,onSectionClick:u,describeSeat:f})=>{const{t:r}=V.useNiceTranslation();return i.tier==="section"?e.jsx("g",{className:"nice-seating-chart__sections",children:i.sections.map(({section:c,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:n.get(c.id)},role:u?"button":"img","aria-label":r("seatingChart.sectionLabel","{name}, {count} seats").replace("{name}",c.name).replace("{count}",String(h)),tabIndex:u?0:void 0,onClick:u?()=>u(c.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:c.name})]},c.id))}):i.tier==="row"?e.jsx("g",{className:"nice-seating-chart__rows",children:i.rows.map(c=>{const m=dn(c,t);return e.jsxs("g",{children:[e.jsx("rect",{x:c.bounds.minX,y:c.bounds.minY,width:c.bounds.maxX-c.bounds.minX,height:c.bounds.maxY-c.bounds.minY,rx:8,className:"nice-seating-chart__row-shape",style:{fill:n.get(c.sectionId),fillOpacity:.25+m*.65},role:"img","aria-label":r("seatingChart.rowLabel","Row {row}, {count} seats, {free} available").replace("{row}",String(c.label)).replace("{count}",String(c.seats.length)).replace("{free}",String(Math.round(m*c.seats.length)))}),e.jsx("text",{x:c.bounds.minX-6,y:(c.bounds.minY+c.bounds.maxY)/2,className:"nice-seating-chart__row-label",textAnchor:"end",dominantBaseline:"middle","aria-hidden":"true",children:c.label})]},`${c.sectionId}-${c.rowIndex}`)})}):e.jsx("g",{className:"nice-seating-chart__seats",children:i.seats.map(c=>{const m=ye(c,t),h=Oe(c),T=s.has(c.id),x=a===c.id,g={row:c.row,number:c.number},P=["nice-seating-chart__seat",`nice-seating-chart__seat--${m}`,T?"nice-seating-chart__seat--selected":"",h?`nice-seating-chart__seat--${h}`:"",x?"nice-seating-chart__seat--cursor":""].filter(Boolean).join(" ");return e.jsxs("g",{className:P,"data-seat-id":c.id,role:"gridcell","aria-selected":T,"aria-disabled":m!=="available","aria-label":f(c),tabIndex:x?0:-1,onClick:d&&o?()=>o(c):void 0,children:[h?e.jsx("rect",{x:c.x-Se,y:c.y-Se,width:Se*2,height:Se*2,rx:3,className:"nice-seating-chart__seat-shape",fill:h==="companion"?"url(#nice-seat-companion-hatch)":void 0}):e.jsx("circle",{cx:c.x,cy:c.y,r:Se,className:"nice-seating-chart__seat-shape"}),h==="wheelchair"&&e.jsx(z.NtdWheelchair,{size:10,x:c.x-5,y:c.y-5,className:"nice-seating-chart__seat-glyph"}),e.jsx("title",{children:f(c)}),e.jsx("text",{x:c.x,y:c.y,className:"nice-seating-chart__seat-number",textAnchor:"middle",dominantBaseline:"middle","aria-hidden":"true",children:g.number})]},c.id)})})},mn=({index:i,selectedIds:s,statusOverrides:a,maxSeats:t,onSeatToggle:n,onBestAvailable:d,describeSeat:o,disabled:u=!1,defaultOpen:f=!1})=>{var v;const{t:r}=V.useNiceTranslation(),c=l.useMemo(()=>i.sections.filter(p=>p.seatCount>0),[i.sections]),[m,h]=l.useState(((v=c[0])==null?void 0:v.section.id)??""),[T,x]=l.useState(0),[g,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:r("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:r("seatListPanel.howManySeats","How many seats?")}),e.jsx(N.NiceNumericInput,{value:g,onChange:p=>P(Math.max(1,Math.min(t,p??1))),min:1,max:t,size:"xs",disabled:u})]}),e.jsx(N.NiceButton,{size:"sm",variant:"primary",disabled:u,onClick:()=>d(g,{sectionId:m||void 0}),children:r("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:r("seatListPanel.section","Section")}),e.jsx(N.NiceSelect,{size:"sm",value:m,disabled:u,onChange:p=>{h(p),x(0)},options:c.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:r("seatListPanel.row","Row")}),e.jsx(N.NiceSelect,{size:"sm",value:String((A==null?void 0:A.rowIndex)??0),disabled:u||b.length===0,onChange:p=>x(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=ye(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:()=>n(p),children:[p.number,_&&e.jsx(z.NtdWheelchair,{size:11})]})},p.id)})})]})},pn={zoom:1,pan:{x:0,y:0}};function hn(i={}){const{minZoom:s=.1,maxZoom:a=10,initial:t=pn,viewport:n,onViewportChange:d,disabled:o=!1}=i,[u,f]=l.useState(t),r=n??u,[c,m]=l.useState(!1),h=l.useRef(new Map),T=l.useRef(null),x=l.useRef(null),g=l.useCallback(y=>{n===void 0&&f(y),d==null||d(y)},[n,d]),P=l.useCallback(y=>Math.min(a,Math.max(s,y)),[s,a]),b=l.useCallback((y,C)=>{const O=P(r.zoom*y);if(O===r.zoom)return;const F=O/r.zoom;g({zoom:O,pan:{x:C.x-(C.x-r.pan.x)*F,y:C.y-(C.y-r.pan.y)*F}})},[g,P,r]),A=l.useCallback((y,C,O)=>{const F=C??(O?{x:O.width/2,y:O.height/2}:{x:0,y:0});b(y,F)},[b]),v=l.useCallback((y,C,O=24)=>{const F=Math.max(1,y.maxX-y.minX),D=Math.max(1,y.maxY-y.minY),$=P(Math.min((C.width-O*2)/F,(C.height-O*2)/D));g({zoom:$,pan:{x:(C.width-F*$)/2-y.minX*$,y:(C.height-D*$)/2-y.minY*$}})},[g,P]),p=l.useCallback(()=>g(t),[g,t]),M=l.useCallback(y=>({x:(y.x-r.pan.x)/r.zoom,y:(y.y-r.pan.y)/r.zoom}),[r]),_=l.useCallback(y=>({x:y.x*r.zoom+r.pan.x,y:y.y*r.zoom+r.pan.y}),[r]),R=y=>{const C=y.currentTarget.getBoundingClientRect();return{x:y.clientX-C.left,y:y.clientY-C.top}};return{viewport:r,setViewport:g,containerProps:o?{}:{onWheel:y=>{y.preventDefault();const C=Math.exp(-y.deltaY*.002);b(Math.min(2,Math.max(.5,C)),R(y))},onPointerDown:y=>{var O,F;const C=R(y);if(h.current.set(y.pointerId,C),(F=(O=y.currentTarget).setPointerCapture)==null||F.call(O,y.pointerId),h.current.size===2){const[D,$]=[...h.current.values()];T.current={distance:Math.hypot(D.x-$.x,D.y-$.y)||1,zoom:r.zoom}}else x.current=C,m(!0)},onPointerMove:y=>{if(!h.current.has(y.pointerId))return;const C=R(y);if(h.current.set(y.pointerId,C),h.current.size===2&&T.current){const[D,$]=[...h.current.values()],X=Math.hypot(D.x-$.x,D.y-$.y)||1,w=P(T.current.zoom*(X/T.current.distance)),j={x:(D.x+$.x)/2,y:(D.y+$.y)/2};w!==r.zoom&&b(w/r.zoom,j);return}if(!x.current)return;const O=C.x-x.current.x,F=C.y-x.current.y;x.current=C,g({zoom:r.zoom,pan:{x:r.pan.x+O,y:r.pan.y+F}})},onPointerUp:y=>{h.current.delete(y.pointerId),h.current.size<2&&(T.current=null),h.current.size===0&&(x.current=null,m(!1))},onPointerCancel:y=>{h.current.delete(y.pointerId),T.current=null,x.current=null,m(!1)}},zoomBy:A,fitTo:v,reset:p,screenToWorld:M,worldToScreen:_,panning:c}}const gn={"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."},xn={id:"empty",name:"",venueId:"",sections:[],priceCategories:[],totalSeats:0},rt=l.forwardRef(function(s,a){var re,ke,_e;const{t}=V.useNiceTranslation(),{chart:n=xn,mode:d="select",selection:o={},selectedSeatIds:u,defaultSelectedSeatIds:f=[],onSelectionChange:r,onSelectionRejected:c,seatStatusOverrides:m,onSeatClick:h,onBestAvailable:T,lod:x="auto",onLodChange:g,maxRenderedSeats:P=2500,containerSize:b,showLegend:A=!0,showList:v=!1,zoomable:p=!0,locale:M,disabled:_=!1,readOnly:R=!1,className:k,style:y}=s,C=l.useRef(null),[O,F]=l.useState({width:800,height:500}),[D,$]=l.useState(!1),[X,w]=l.useState(f),[j,B]=l.useState(null),[K,q]=l.useState(""),I=u??X,U=l.useMemo(()=>new Set(I),[I]),W=d==="select"&&!_&&!R&&o.interactive!==!1,Z=o.maxSeats??8,Y=l.useMemo(()=>Jt(n),[n]),J=b??O,Q=!!b||D;l.useEffect(()=>{if(b||!C.current||typeof ResizeObserver>"u")return;const L=C.current,E=new ResizeObserver(([G])=>{const{width:H,height:ee}=G.contentRect;H>0&&ee>0&&(F({width:H,height:ee}),$(!0))});return E.observe(L),()=>E.disconnect()},[b]);const he=hn({disabled:!p||_}),{fitTo:se,viewport:oe}=he,ge=l.useRef(!1);l.useEffect(()=>{ge.current||!Q||Y.totalSeats===0||J.width<=0||(ge.current=!0,se(Y.bounds,J))},[se,Y,J,Q]);const we=l.useMemo(()=>Zt(oe,J,40),[oe,J]),xe=x!=="auto"?x:j?"seat":void 0,le=l.useMemo(()=>nn(Y,we,P,xe),[Y,we,P,xe]),ve=l.useRef(null);l.useEffect(()=>{ve.current!==le.tier&&(ve.current=le.tier,g==null||g(le.tier))},[le.tier,g]);const Ae=l.useMemo(()=>{var L;return new Map(((L=n.sections)==null?void 0:L.map(E=>[E.id,E.color]))??[])},[n.sections]),de=l.useMemo(()=>{var L;return new Map(((L=n.sections)==null?void 0:L.map(E=>[E.id,E]))??[])},[n.sections]),ae=l.useCallback(L=>{const E=de.get(L.sectorId),G=ye(L,m),H=Oe(L),ee=[E?E.name:"",t("seatingChart.rowN","row {row}").replace("{row}",String(L.row)),t("seatingChart.seatN","seat {number}").replace("{number}",String(L.number))].filter(Boolean);if(E&&o.showPrices!==!1){const ce=Ze(L,n,E);ee.push(te(ce.amount,ce.currency,M))}return ee.push(t(`seatingChart.status.${G}`,G)),H==="wheelchair"&&ee.push(t("seatingChart.wheelchairAccessible","wheelchair accessible")),H==="companion"&&ee.push(t("seatingChart.companionSeat","companion seat")),ee.join(", ")},[n,de,m,o.showPrices,M,t]),ne=l.useCallback(L=>{u===void 0&&w(L),r==null||r(L)},[u,r]),je=l.useCallback(L=>{if(h==null||h(L),!W)return;const E=rn(I,L.id,Y,o,m);if("rejected"in E){c==null||c({reason:E.rejected,seatId:L.id}),q(t(`seatingChart.rejection.${E.rejected}`,gn[E.rejected]));return}ne(E.selected),q(t("seatingChart.seatSelected","{seat}. {count} of {max} selected.").replace("{seat}",ae(L)).replace("{count}",String(E.selected.length)).replace("{max}",String(Z)))},[t,ne,ae,Y,W,Z,h,c,m,I,o]),ue=l.useCallback((L,E)=>{if(T){T(L,E);return}const G=cn(Y,L,o,E,m);if(G.length===0){q(t("seatingChart.noBlockAvailable","No block of {count} seats together is available.").replace("{count}",String(L)));return}ne(G),B(G[0]),q(t("seatingChart.selectedTogether","Selected {count} seats together.").replace("{count}",String(G.length)))},[ne,Y,T,m,o,t]),be=l.useCallback(L=>{const E=Y.locationById.get(L);if(!E)return;const G=Y.rows.find(H=>H.sectionId===E.sectionId&&H.rowIndex===E.rowIndex);G&&se(G.bounds,J,80)},[se,Y,J]),me=l.useCallback(L=>{if(!L)return;B(L),be(L);const E=Y.seatById.get(L);E&&q(ae(E)),requestAnimationFrame(()=>{var H;const G=[...((H=C.current)==null?void 0:H.querySelectorAll("[data-seat-id]"))??[]].find(ee=>ee.getAttribute("data-seat-id")===L);G==null||G.focus({preventScroll:!0})})},[ae,Y.seatById,be]),Re=L=>{var ee,ce;const E=j??((ce=(ee=Y.rows[0])==null?void 0:ee.seats[0])==null?void 0:ce.id)??null;if(!E)return;const H={ArrowLeft:"left",ArrowRight:"right",ArrowUp:"up",ArrowDown:"down",Home:"row-start",End:"row-end"}[L.key];if(H){L.preventDefault(),me(j?on(Y,E,H):E);return}if(L.key==="PageDown"||L.key==="PageUp"){L.preventDefault(),me(ln(Y,j,L.key==="PageDown"?"next":"prev"));return}if(L.key==="Enter"||L.key===" "){L.preventDefault();const Ce=Y.seatById.get(E);Ce&&je(Ce);return}L.key==="Escape"&&I.length>0&&(L.preventDefault(),ne([]),q(t("seatingChart.selectionCleared","Selection cleared.")))};if(Y.totalSeats===0)return e.jsx("div",{ref:a,className:`nice-seating-chart ${k??""}`,style:y,children:e.jsx(pe,{title:t("seatingChart.thisChartHasNoSeats","This chart has no seats"),description:t("seatingChart.addSectionsAndRowsTo","Add sections and rows to the seating chart to see it here.")})});const fe=I.reduce((L,E)=>{const G=Y.seatById.get(E),H=G?de.get(G.sectorId):void 0;return!G||!H?L:L+Ze(G,n,H).amount},0),Ne=((ke=(re=n.sections)==null?void 0:re[0])==null?void 0:ke.currency)??"PLN";return e.jsxs("div",{ref:a,className:`nice-seating-chart nice-seating-chart--${d} ${k??""}`,style:y,children:[e.jsxs("div",{ref:C,className:"nice-seating-chart__canvas-host",role:"grid","aria-label":t("seatingChart.chartLabel","{name} seating chart").replace("{name}",n.name),"aria-rowcount":Y.rows.length,"aria-colcount":Y.totalSeats,tabIndex:j?-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(un,{cull:le,selectedIds:U,cursorId:j,statusOverrides:m,sectionColorById:Ae,interactive:W,onSeatClick:je,onSectionClick:o.sectionSelect?L=>{var G;const E=(G=Y.rows.find(H=>H.sectionId===L))==null?void 0:G.seats[0];E&&me(E.id)}:void 0,describeSeat:ae})})]}),p&&e.jsxs("div",{className:"nice-seating-chart__zoom",children:[e.jsx(N.NiceButton,{size:"sm",variant:"ghost",ariaLabel:t("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:t("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:t("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:K}),A&&e.jsxs("ul",{className:"nice-seating-chart__legend",children:[(_e=n.priceCategories)==null?void 0:_e.map(L=>e.jsxs("li",{className:"nice-seating-chart__legend-item",children:[e.jsx("span",{className:"nice-seating-chart__legend-swatch",style:{background:L.color},"aria-hidden":"true"}),L.name," · ",te(L.price,Ne,M)]},L.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"})," ",t("seatingChart.sold","Sold")]})]}),d==="select"&&I.length>0&&e.jsx("p",{className:"nice-seating-chart__total",children:I.length===1?t("seatingChart.seatsOne","{selected} seat · {amount}").replace("{selected}",String(I.length)).replace("{amount}",String(te(fe,Ne,M))):t("seatingChart.seatsMany","{selected} seats · {amount}").replace("{selected}",String(I.length)).replace("{amount}",String(te(fe,Ne,M)))}),v&&e.jsx(mn,{index:Y,selectedIds:U,statusOverrides:m,maxSeats:Z,onSeatToggle:je,onBestAvailable:ue,describeSeat:ae,disabled:!W,defaultOpen:d==="select"&&v})]})}),vn=l.forwardRef(function({showList:s=!0,className:a,...t},n){return e.jsx(rt,{ref:n,mode:"select",showList:s,className:`nice-seat-picker ${a??""}`,...t})}),ct=/\{\{\s*([\w.-]+)\s*\}\}/g,fn={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"};function Nn(i){return i.replace(/[&<>"']/g,s=>fn[s]??s)}function _n(i){const s=[],a=new Set;for(const t of i.matchAll(ct)){const n=t[1];a.has(n)||(a.add(n),s.push(n))}return s}function yn(i,s={},a={}){const{escape:t=!0,missing:n="keep"}=a;return i.replace(ct,(d,o)=>{const u=s[o];return u==null?n==="blank"?"":d:t?Nn(String(u)):String(u)})}function Je(i){return`{{${i}}}`}function jn(i,s={}){return _n(i).filter(a=>s[a]===void 0||s[a]===null)}const bn={name:"",body:""},kn=["bold","italic","underline","h1","h2","ul","ol","link","image","alignLeft","alignCenter","undo","redo"],Sn=l.forwardRef(function(s,a){const{t}=V.useNiceTranslation(),{template:n,defaultTemplate:d,onTemplateChange:o,tokens:u=[],previewData:f={},recipients:r=[],onRecipientsChange:c,onSend:m,sending:h=!1,toolbar:T=kn,disabled:x=!1,readOnly:g=!1,size:P="md",className:b,style:A}=s,[v,p]=V.useControllableState({value:n,defaultValue:d,fallbackValue:bn,onChange:o,componentName:"NiceInvitationDesigner"}),[M,_]=l.useState(""),R=x||g||h,k=l.useMemo(()=>st(M),[M]),y=l.useMemo(()=>{const j={};for(const B of u)B.sample!==void 0&&(j[B.key]=B.sample);return{...j,...f}},[u,f]),C=l.useMemo(()=>yn(v.body??"",y),[v.body,y]),O=l.useMemo(()=>jn(v.body??"",y),[v.body,y]),F=r.map(j=>j.email),D=j=>p({...v,...j}),$=j=>{D({body:`${v.body??""}${Je(j)}`})},X=()=>{!c||k.valid.length===0||(c(Ft(F,k.valid)),_(""))},w=j=>{c==null||c(F.filter(B=>B!==j))};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:t("invitationDesigner.templateName","Template name"),value:v.name,onChange:j=>D({name:j}),placeholder:t("invitationDesigner.birthdayInvitation","Birthday invitation"),disabled:R,size:P}),u.length>0&&!g&&e.jsxs("div",{className:"nice-invitation-designer__tokens",children:[e.jsx("span",{className:"nice-invitation-designer__tokens-label",children:t("invitationDesigner.insert","Insert:")}),u.map(j=>e.jsx(N.NiceButton,{size:"sm",variant:"outline",disabled:R,onClick:()=>$(j.key),children:j.label},j.key))]}),e.jsx(N.NiceHtmlEditor,{value:v.body??"",onChange:j=>D({body:j}),toolbar:T,height:280,readOnly:g||h,disabled:x})]}),e.jsxs("section",{className:"nice-invitation-designer__preview","aria-label":t("invitationDesigner.invitationPreview","Invitation preview"),children:[e.jsxs("header",{className:"nice-invitation-designer__preview-header",children:[e.jsx("h4",{children:t("invitationDesigner.preview","Preview")}),O.length>0&&e.jsx(N.NiceBadge,{size:"xs",subtle:!0,variant:"warning",children:t("invitationDesigner.unresolved","{unresolved} unresolved").replace("{unresolved}",String(O.length))})]}),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.jsx("p",{className:"nice-invitation-designer__unresolved",children:t("invitationDesigner.noPreviewValueFor","No preview value for: {unresolved}").replace("{unresolved}",String(O.map(j=>Je(j)).join(", ")))})]}),e.jsxs("section",{className:"nice-invitation-designer__recipients",children:[e.jsx("header",{className:"nice-invitation-designer__recipients-header",children:e.jsxs("h4",{children:[t("invitationDesigner.recipients","Recipients")," ",e.jsxs("span",{children:["(",r.length,")"]})]})}),c&&!g&&e.jsxs(e.Fragment,{children:[e.jsx(N.NiceTextArea,{label:t("invitationDesigner.addAddresses","Add addresses"),value:M,onChange:_,placeholder:t("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?t("invitationDesigner.addN","Add ({count})").replace("{count}",String(k.valid.length)):t("invitationDesigner.add","Add")}),(k.invalid.length>0||k.duplicates>0)&&e.jsxs("span",{className:"nice-invitation-designer__paste-hint",children:[k.duplicates>0&&`${t("invitationDesigner.duplicates","{count} duplicate(s).").replace("{count}",String(k.duplicates))} `,k.invalid.length>0&&t("invitationDesigner.notRecognised","{count} not recognised: {list}").replace("{count}",String(k.invalid.length)).replace("{list}",k.invalid.slice(0,3).join(", "))]})]})]}),r.length>0&&e.jsx("ul",{className:"nice-invitation-designer__recipient-list",children:r.map(j=>e.jsxs("li",{className:"nice-invitation-designer__recipient",children:[e.jsx("span",{children:j.name?`${j.name} <${j.email}>`:j.email}),j.status&&j.status!=="pending"&&e.jsx(N.NiceBadge,{size:"xs",subtle:!0,variant:j.status==="sent"?"success":"error",children:t(`invitationDesigner.recipientStatus.${j.status}`,j.status)}),c&&!g&&e.jsx(N.NiceButton,{size:"sm",variant:"ghost",ariaLabel:t("invitationDesigner.removeRecipient","Remove {email}").replace("{email}",j.email),disabled:R,onClick:()=>w(j.email),children:e.jsx(z.NtdTrash,{size:13})})]},j.email))}),m&&!g&&e.jsx(N.NiceButton,{variant:"primary",size:P,leftIcon:e.jsx(z.NtdSend,{size:15}),loading:h,ariaLabel:t("invitationDesigner.sendInvitations","Send invitations"),disabled:x||h||r.length===0,onClick:()=>m({templateId:v.id,emails:F}),children:h?t("invitationDesigner.sending","Sending…"):t("invitationDesigner.sendTo","Send to {count}").replace("{count}",String(r.length))})]})]})}),wn=({value:i,max:s,currency:a,locale:t,label:n,className:d})=>{const o=s>0?s:1,u=i>=s&&s>0,f=(r,c)=>a?`${te(r,a,t)} / ${te(c,a,t)}`:`${r} / ${c}`;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":n})},Cn=[];function In(i,s){if(s==="wishlist")return{value:i.isPurchased?1:0,max:1,complete:!!i.isPurchased};const a=i.quantityNeeded??1,t=i.quantityContributed??0;return{value:t,max:a,complete:a>0&&t>=a}}const Pn=l.forwardRef(function(s,a){const{t}=V.useNiceTranslation(),{items:n=Cn,kind:d="registry",mode:o="owner",currency:u="PLN",locale:f,hideContributors:r=!1,currentUserId:c,currentUserName:m,onContribute:h,onClaim:T,onUnclaim:x,onItemAdd:g,onItemDelete:P,onItemClick:b,layout:A="grid",disabled:v=!1,readOnly:p=!1,size:M="md",className:_,style:R}=s,k=it({currentUserId:c,currentUserName:m}),[y,C]=l.useState(null),[O,F]=l.useState(0),[D,$]=l.useState(""),X=o==="owner",w=v||p,j=d==="wishlist",B=l.useMemo(()=>j?[...n].sort((I,U)=>Number(I.isPurchased??!1)-Number(U.isPurchased??!1)||(U.priority??0)-(I.priority??0)):n,[n,j]),K=()=>{C(null),F(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}),K())};return n.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:j?t("giftRegistry.emptyWishlist","Nothing on the wishlist yet"):t("giftRegistry.emptyRegistry","No gifts on the registry yet"),description:X?t("giftRegistry.emptyOwnerHint","Add what you would like and share the link."):t("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:t("giftRegistry.yourName","Your name"),value:k.name,onChange:k.setName,placeholder:t("giftRegistry.soTheHostKnowsWho","So the host knows who to thank"),required:!0,disabled:w,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:Z}=In(I,d),Y=I.price,J=I.contributions??[];return e.jsxs("div",{className:`nice-gift-registry__item${Z?" 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:te(Y.amount,Y.currency||u,f)}),j&&(I.priority??0)>0&&e.jsxs(N.NiceBadge,{size:"xs",subtle:!0,variant:"warning",children:[e.jsx(z.NtdStar,{size:11})," ",I.priority]}),Z&&e.jsx(N.NiceBadge,{size:"xs",subtle:!0,variant:"success",children:j?t("giftRegistry.bought","bought"):t("giftRegistry.fullyCovered","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})," ",t("giftRegistry.shop","Shop")]})]}),!j&&e.jsx(wn,{value:U,max:W,label:t("giftRegistry.covered","{name}: {value} of {max} covered").replace("{name}",I.title).replace("{value}",String(U)).replace("{max}",String(W))}),!r&&J.length>0&&e.jsx("ul",{className:"nice-gift-registry__contributors",children:J.map(Q=>e.jsxs("li",{className:"nice-gift-registry__contributor",children:[e.jsx("strong",{children:Q.contributorName}),Q.amount!==void 0&&` — ${te(Q.amount,(Y==null?void 0:Y.currency)||u,f)}`,Q.amount===void 0&&Q.quantity?` — ${Q.quantity}×`:"",Q.message&&e.jsxs("em",{children:[" “",Q.message,"”"]})]},Q.id))}),e.jsxs("div",{className:"nice-gift-registry__actions",children:[!X&&!Z&&T&&e.jsx(N.NiceButton,{size:"sm",variant:"primary",disabled:w||!k.canAct,leftIcon:e.jsx(z.NtdCheck,{size:14}),onClick:()=>T(I.id,{...k.actor,quantity:1}),children:t("giftRegistry.illTakeThis","I'll take this")}),!X&&Z&&x&&e.jsx(N.NiceButton,{size:"sm",variant:"ghost",disabled:w,onClick:()=>x(I.id),children:t("giftRegistry.release","Release")}),!X&&!Z&&!j&&h&&e.jsx(N.NiceButton,{size:"sm",variant:"outline",disabled:w||!k.canAct,onClick:()=>C(y===I.id?null:I.id),children:t("giftRegistry.chipIn","Chip in")}),X&&P&&!p&&e.jsx(N.NiceButton,{size:"sm",variant:"ghost",ariaLabel:t("giftRegistry.deleteItem","Delete {name}").replace("{name}",I.title),disabled:v,onClick:()=>P(I.id),children:e.jsx(z.NtdTrash,{size:14})})]}),y===I.id&&e.jsxs("div",{className:"nice-gift-registry__pledge",children:[e.jsxs("label",{className:"nice-gift-registry__pledge-field",children:[e.jsx("span",{children:t("giftRegistry.amount","Amount ({currency})").replace("{currency}",String((Y==null?void 0:Y.currency)||u))}),e.jsx(N.NiceNumericInput,{value:O,onChange:Q=>F(Math.max(0,Q??0)),min:0,size:"xs",disabled:w})]}),e.jsx(N.NiceButton,{size:"sm",variant:"primary",disabled:w||!k.canAct,onClick:()=>q(I),children:t("giftRegistry.confirm","Confirm")}),e.jsx(N.NiceButton,{size:"sm",variant:"ghost",onClick:K,children:t("giftRegistry.cancel","Cancel")})]})]})]},I.id)})}),X&&g&&!p&&e.jsxs("div",{className:"nice-gift-registry__add",children:[e.jsx(N.NiceTextInput,{label:j?t("giftRegistry.addAWish","Add a wish"):t("giftRegistry.addAGift","Add a gift"),value:D,onChange:$,placeholder:t("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||!D.trim(),onClick:()=>{g({title:D.trim(),quantityNeeded:1}),$("")},children:t("giftRegistry.add","Add")})]})]})});function Tn(i){const s=new Map;for(const a of i){const t=(a.currency||"").toUpperCase(),n=s.get(t);n?n.push(a):s.set(t,[a])}return s}function zn(i,s,a){var f;const t=new Set(s.map(r=>r.id)),n=s.map(r=>r.id),d=new Map(n.map(r=>[r,0])),o=[];let u=0;if(n.length===0)return{balances:d,issues:i.map(r=>({itemId:r.id,reason:"no-participants"})),totalMinor:0};for(const r of i){const c=r.paidById;if(!c){o.push({itemId:r.id,reason:"no-payer"});continue}if(!t.has(c)){o.push({itemId:r.id,reason:"unknown-payer"});continue}let m=(f=r.splitAmong)!=null&&f.length?r.splitAmong.filter(b=>t.has(b)):n;m.length===0&&(m=n);const h=Ee(r.amount,a);u+=h;const T=m.length,x=Math.floor(h/T),g=h-x*T,P=new Map(m.map(b=>[b,x]));if(g!==0)if(P.has(c))P.set(c,(P.get(c)??0)+g);else{const b=[...m].sort(Me),A=g>0?1:-1;for(let v=0;v<Math.abs(g);v+=1){const p=b[v%b.length];P.set(p,(P.get(p)??0)+A)}}d.set(c,(d.get(c)??0)+h);for(const[b,A]of P)d.set(b,(d.get(b)??0)-A)}return{balances:d,issues:o,totalMinor:u}}function Mn(i,s,a){for(const t of s){if((t.currency||"").toUpperCase()!==a||!i.has(t.fromId)||!i.has(t.toId))continue;const n=Ee(t.amount,a);i.set(t.fromId,(i.get(t.fromId)??0)+n),i.set(t.toId,(i.get(t.toId)??0)-n)}}function An(i,s,a){const t=new Map(s.map(r=>[r.id,r.name])),n=[...i.entries()].filter(([,r])=>r>0).map(([r,c])=>({id:r,v:c})).sort((r,c)=>c.v-r.v||Me(r.id,c.id)),d=[...i.entries()].filter(([,r])=>r<0).map(([r,c])=>({id:r,v:c})).sort((r,c)=>r.v-c.v||Me(r.id,c.id)),o=[];let u=0,f=0;for(;u<d.length&&f<n.length;){const r=Math.min(-d[u].v,n[f].v);r>0&&o.push({fromId:d[u].id,fromName:t.get(d[u].id)??d[u].id,toId:n[f].id,toName:t.get(n[f].id)??n[f].id,amount:ze(r,a),currency:a}),d[u].v+=r,n[f].v-=r,d[u].v===0&&(u+=1),n[f].v===0&&(f+=1)}return o}function Rn(i,s,a=[]){const t=[],n=[],d=[...Tn(i).entries()].sort(([o],[u])=>Me(o,u));for(const[o,u]of d){const f=zn(u,s,o);n.push(...f.issues),Mn(f.balances,a,o),t.push({currency:o,total:ze(f.totalMinor,o),balances:s.map(r=>({participantId:r.id,participantName:r.name,amount:ze(f.balances.get(r.id)??0,o),currency:o})),transfers:An(f.balances,s,o)})}return{groups:t,issues:n}}function Me(i,s){return i<s?-1:i>s?1:0}const Bn=[],Ln=[],$n=l.forwardRef(function(s,a){const{t}=V.useNiceTranslation(),{items:n=Bn,participants:d=Ln,settlements:o=[],view:u,defaultView:f="expenses",onViewChange:r,onSettle:c,onItemDelete:m,onItemClick:h,onValidationChange:T,sortBy:x="date",locale:g,disabled:P=!1,readOnly:b=!1,size:A="md",className:v,style:p}=s,[M,_]=l.useState(f),R=u??M,k=P||b,y=l.useMemo(()=>d.map(w=>({id:w.id,name:w.name})),[d]),C=l.useMemo(()=>Rn(n,y,o),[n,y,o]),O=l.useMemo(()=>x==="none"?n:n.map((w,j)=>({item:w,index:j})).sort((w,j)=>{if(x==="amount")return j.item.amount-w.item.amount||w.index-j.index;const B=w.item.incurredAt,K=j.item.incurredAt;return B&&K?B.localeCompare(K)||w.index-j.index:B?-1:K?1:w.index-j.index}).map(w=>w.item),[n,x]),F=C.issues.map(w=>`${w.itemId}:${w.reason}`).join("|");l.useEffect(()=>{T==null||T(C.issues)},[F]);const D=l.useMemo(()=>new Map(d.map(w=>[w.id,w.avatarUrl])),[d]),$=l.useMemo(()=>new Map(C.issues.map(w=>[w.itemId,w.reason])),[C.issues]),X=w=>{u===void 0&&_(w),r==null||r(w)};return n.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:t("expenseSplit.noExpensesYet","No expenses yet"),description:t("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:w=>X(w),options:[{value:"expenses",label:t("expenseSplit.expenses","Expenses")},{value:"balances",label:t("expenseSplit.balances","Balances")},{value:"settlement",label:t("expenseSplit.settleUp","Settle up")}]}),R==="expenses"&&e.jsx("ul",{className:"nice-expense-split__items",children:O.map(w=>{const j=$.get(w.id);return e.jsxs("li",{className:`nice-expense-split__item${j?" nice-expense-split__item--excluded":""}`,children:[e.jsxs("button",{type:"button",className:"nice-expense-split__item-main",onClick:()=>h==null?void 0:h(w),disabled:!h,children:[e.jsx("span",{className:"nice-expense-split__item-label",children:w.label}),e.jsx("span",{className:"nice-expense-split__item-payer",children:t("expenseSplit.paidBy","{payer} paid").replace("{payer}",w.paidByName??w.paidById??t("expenseSplit.nobody","nobody"))})]}),e.jsx("span",{className:"nice-expense-split__item-amount",children:te(w.amount,w.currency,g)}),w.isPaid&&e.jsx(N.NiceBadge,{size:"xs",subtle:!0,variant:"success",children:t("expenseSplit.paid","paid")}),j&&e.jsx(N.NiceBadge,{size:"xs",subtle:!0,variant:"warning",children:j==="no-payer"?t("expenseSplit.noPayer","no payer"):t("expenseSplit.unknownPayer","unknown payer")}),m&&!b&&e.jsx(N.NiceButton,{size:"sm",variant:"ghost",ariaLabel:t("expenseSplit.deleteItem","Delete {name}").replace("{name}",w.label),disabled:P,onClick:()=>m(w.id),children:e.jsx(z.NtdTrash,{size:14})})]},w.id)})}),R==="balances"&&C.groups.map(w=>e.jsxs("section",{className:"nice-expense-split__group",children:[e.jsxs("h4",{className:"nice-expense-split__group-title",children:[w.currency,e.jsx("span",{className:"nice-expense-split__group-total",children:t("expenseSplit.total","{amount} total").replace("{amount}",String(te(w.total,w.currency,g)))})]}),e.jsx("ul",{className:"nice-participant-list__rows",children:w.balances.map(j=>e.jsx(Be,{participant:{id:j.participantId,name:j.participantName,avatarUrl:D.get(j.participantId)},showRole:!1,showStatus:!1,size:A,children:e.jsxs("span",{className:`nice-expense-split__balance nice-expense-split__balance--${j.amount>0?"owed":j.amount<0?"owes":"settled"}`,children:[j.amount===0?t("expenseSplit.settledUp","settled up"):te(Math.abs(j.amount),j.currency,g),j.amount>0&&e.jsxs("em",{children:[" ",t("expenseSplit.isOwed","is owed")]}),j.amount<0&&e.jsxs("em",{children:[" ",t("expenseSplit.owes","owes")]})]})},j.participantId))})]},w.currency)),R==="settlement"&&(C.groups.every(w=>w.transfers.length===0)?e.jsx(pe,{icon:e.jsx(z.NtdCoins,{size:28}),title:t("expenseSplit.allSettledUp","All settled up"),description:t("expenseSplit.nobodyOwesAnybodyAnything","Nobody owes anybody anything.")}):C.groups.filter(w=>w.transfers.length>0).map(w=>e.jsxs("section",{className:"nice-expense-split__group",children:[e.jsxs("h4",{className:"nice-expense-split__group-title",children:[w.currency,e.jsx("span",{className:"nice-expense-split__group-total",children:w.transfers.length===1?t("expenseSplit.transfersOne","{transfers} transfer").replace("{transfers}",String(w.transfers.length)):t("expenseSplit.transfersMany","{transfers} transfers").replace("{transfers}",String(w.transfers.length))})]}),e.jsx("ul",{className:"nice-expense-split__transfers",children:w.transfers.map(j=>e.jsxs("li",{className:"nice-expense-split__transfer",children:[e.jsx("span",{className:"nice-expense-split__transfer-from",children:j.fromName}),e.jsx(z.NtdArrowRight,{size:15}),e.jsx("span",{className:"nice-expense-split__transfer-to",children:j.toName}),e.jsx("span",{className:"nice-expense-split__transfer-amount",children:te(j.amount,j.currency,g)}),c&&!b&&e.jsx(N.NiceButton,{size:"sm",variant:"outline",disabled:k,onClick:()=>c(j),children:t("expenseSplit.markPaid","Mark paid")})]},`${j.fromId}-${j.toId}-${j.amount}`))})]},w.currency)))]})}),Dn=[],En={upcoming:z.NtdClock,active:z.NtdPlay,voting:z.NtdThumbsUp,scored:z.NtdBarChart,completed:z.NtdCheck,skipped:z.NtdSkipForward},On={upcoming:"#9ca3af",active:"#22c55e",voting:"#eab308",scored:"#3b82f6",completed:"#6b7280",skipped:"#d1d5db"},Yn=l.forwardRef(function(s,a){const{t}=V.useNiceTranslation(),{rounds:n=Dn,activeRoundId:d,onSelect:o,onStart:u,onEnd:f,onCreate:r,editable:c=!1,className:m,style:h}=s,T=[...n].sort((x,g)=>x.order-g.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.jsx("h3",{children:t("roundList.rounds","Rounds ({rounds})").replace("{rounds}",String(n.length))}),c&&r&&e.jsx("button",{onClick:r,children:t("roundList.addRound","+ Add Round")})]}),T.length===0?e.jsx("p",{className:"nice-round-list__empty",children:t("roundList.noRoundsYet","No rounds yet.")}):e.jsx("div",{className:"nice-round-list__items",children:T.map(x=>{const g=x.id===d;return e.jsxs("div",{onKeyDown:V.clickOnActivationKey,className:`nice-round-list__item ${g?"nice-round-list__item--active":""}`,onClick:()=>o==null?void 0:o(x),role:o?"button":void 0,tabIndex:o?0:void 0,children:[e.jsxs("span",{className:"nice-round-list__order",children:["#",x.order]}),e.jsx("span",{className:"nice-round-list__icon",title:t(`roundCard.status.${x.status}`,x.status),children:l.createElement(En[x.status],{size:16})}),e.jsxs("div",{className:"nice-round-list__info",children:[e.jsx("strong",{className:"nice-round-list__name",children:x.name}),x.description&&e.jsx("small",{children:x.description}),x.type&&e.jsx("span",{className:"nice-round-list__type",children:x.type})]}),e.jsx("span",{className:"nice-round-list__status",style:{color:On[x.status]},children:t(`roundCard.status.${x.status}`,x.status)}),x.durationMinutes&&e.jsxs("span",{className:"nice-round-list__duration",children:[x.durationMinutes,"m"]}),x.winnerIds&&x.winnerIds.length>0&&e.jsxs("span",{className:"nice-round-list__winners",children:[e.jsx(z.NtdTrophy,{size:14})," ",x.winnerIds.length]}),c&&e.jsxs("div",{role:"presentation",className:"nice-round-list__actions",onClick:P=>P.stopPropagation(),children:[x.status==="upcoming"&&u&&e.jsx("button",{onClick:()=>u(x.id),children:t("roundList.start","Start")}),(x.status==="active"||x.status==="voting")&&f&&e.jsx("button",{onClick:()=>f(x.id),children:t("roundList.end","End")})]})]},x.id)})})]})}),Un=["var(--nice-lb-gold, #facc15)","var(--nice-lb-silver, #cbd5e1)","var(--nice-lb-bronze, #d97706)"],Vn=l.forwardRef(function(s,a){const{t}=V.useNiceTranslation(),{round:n,timerRunning:d=!1,remainingSeconds:o,onSubmitScore:u,onStart:f,onEnd:r,onSkip:c,editable:m=!1,footerActions:h,className:T,style:x}=s,[g,P]=l.useState({}),b=l.useCallback(p=>{const M=parseFloat(g[p]??"");isNaN(M)||!u||(u(p,M),P(_=>({..._,[p]:""})))},[g,u]),A=p=>{const M=Math.floor(p/60),_=p%60;return`${M}:${_.toString().padStart(2,"0")}`},v=n.scores?[...n.scores].sort((p,M)=>M.score-p.score):[];return e.jsxs("div",{ref:a,className:`nice-round-card nice-round-card--${n.status} ${T??""}`,style:x,children:[e.jsxs("div",{className:"nice-round-card__header",children:[e.jsx("span",{className:"nice-round-card__order",children:t("roundCard.roundN","Round #{n}").replace("{n}",String(n.order))}),e.jsx("h3",{className:"nice-round-card__name",children:n.name}),e.jsx("span",{className:"nice-round-card__status",children:t(`roundCard.status.${n.status}`,n.status)})]}),n.description&&e.jsx("p",{className:"nice-round-card__description",children:n.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:t("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:t("roundCard.rank","Rank")}),e.jsx("th",{children:t("roundCard.participant","Participant")}),e.jsx("th",{children:t("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:Un[M],"aria-label":t("roundCard.placeN","Place {n}").replace("{n}",String(M+1))})]})]}),e.jsx("td",{children:p.participantName}),e.jsx("td",{children:p.score})]},p.participantId))})]})]}),u&&(n.status==="active"||n.status==="voting")&&v.length>0&&e.jsxs("div",{className:"nice-round-card__score-input",children:[e.jsx("h4",{children:t("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:g[p.participantId]??"",onChange:M=>P(_=>({..._,[p.participantId]:M.target.value})),min:0,step:1,placeholder:t("roundCard.score","Score")}),e.jsx("button",{onClick:()=>b(p.participantId),children:t("roundCard.submit","Submit")})]},p.participantId))]}),e.jsxs("div",{className:"nice-round-card__footer",children:[m&&e.jsxs("div",{className:"nice-round-card__actions",children:[n.status==="upcoming"&&f&&e.jsxs("button",{onClick:f,children:[e.jsx(z.NtdPlay,{size:14})," ",t("roundCard.startRound","Start Round")]}),(n.status==="active"||n.status==="voting")&&r&&e.jsxs("button",{onClick:r,children:[e.jsx(z.NtdStop,{size:14})," ",t("roundCard.endRound","End Round")]}),n.status==="upcoming"&&c&&e.jsxs("button",{onClick:c,children:[e.jsx(z.NtdSkipForward,{size:14})," ",t("roundCard.skip","Skip")]})]}),h]}),n.winnerIds&&n.winnerIds.length>0&&e.jsxs("div",{className:"nice-round-card__winners",children:[e.jsx(z.NtdTrophy,{size:14})," ",t("roundCard.winners","Winners: {winnerIds}").replace("{winnerIds}",String(n.winnerIds.length))]})]})}),Fn=[],Xn=i=>{if(!i)return"";const s=Math.floor(i/60),a=i%60;return`${s}:${a.toString().padStart(2,"0")}`},qn=l.forwardRef(function(s,a){const{songs:t=Fn,onAdd:n,onRemove:d,onVote:o,onSearch:u,showQueue:f=!0,readOnly:r=!1,className:c,style:m}=s,{t:h}=V.useNiceTranslation(),[T,x]=l.useState(""),g=l.useMemo(()=>{if(!T.trim())return t;const v=T.toLowerCase();return t.filter(p=>p.title.toLowerCase().includes(v)||p.artist.toLowerCase().includes(v))},[t,T]),P=l.useMemo(()=>t.filter(v=>v.isQueued),[t]),b=t.find(v=>v.isPlaying),A=v=>{x(v),u==null||u(v)};return e.jsxs("div",{ref:a,className:`nice-song-picker ${c??""}`,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:g.length===0?e.jsx("p",{className:"nice-song-picker__empty",children:h("songPicker.noMatch","No songs found.")}):g.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:Xn(v.duration)}),v.addedByName&&e.jsx("div",{className:"nice-song-picker__added-by",children:h("songPicker.addedBy","Added by {name}").replace("{name}",v.addedByName)})]}),!r&&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]}),n&&!v.isQueued&&e.jsxs(N.NiceButton,{variant:"primary",size:"sm",onClick:()=>n(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))]})]})}),Wn=[],et={easy:"Easy",medium:"Medium",hard:"Hard",expert:"Expert"},Gn={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",Kn=l.forwardRef(function(s,a){const{songs:t=Wn,queue:n=[],onEnqueue:d,onDequeue:o,onNext:u,nowPlayingId:f,readOnly:r=!1,className:c,style:m}=s,{t:h}=V.useNiceTranslation(),T=_=>_ in et?h(`karaokePicker.difficulty.${_}`,et[_]):_,[x,g]=l.useState(""),[P,b]=l.useState(Te),A=t.find(_=>_.id===f),v=l.useMemo(()=>{let _=t;if(x.trim()){const R=x.toLowerCase();_=_.filter(k=>k.title.toLowerCase().includes(R)||k.artist.toLowerCase().includes(R))}return P!==Te&&(_=_.filter(R=>R.difficulty===P)),_},[t,x,P]),p=l.useMemo(()=>new Set(n.map(_=>_.id)),[n]),M=["easy","medium","hard","expert"];return e.jsxs("div",{ref:a,className:`nice-karaoke-picker ${c??""}`,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),")"]})]}),!r&&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:x,onChange:g,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:Gn[_.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,")"]})]}),!r&&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))}),n.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(n.length))]}),n.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,")"]})]}),!r&&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))]})]})}),Hn=[],tt={game:z.NtdGamepad,music:z.NtdMusic,dance:z.NtdMusic,quiz:z.NtdHelp,karaoke:z.NtdMicrophone,photo:z.NtdCamera,custom:z.NtdSparkle},Qn={game:"Games",music:"Music",dance:"Dance",quiz:"Quiz",karaoke:"Karaoke",photo:"Photo",custom:"Custom"},Zn=l.forwardRef(function(s,a){const{t}=V.useNiceTranslation(),{attractions:n=Hn,onSelect:d,onDeselect:o,onVote:u,selectedIds:f=[],maxSelections:r,showVotes:c=!0,readOnly:m=!1,layout:h="grid",className:T,style:x}=s,[g,P]=l.useState(""),[b,A]=l.useState(""),v=l.useMemo(()=>new Set(f),[f]),p=l.useMemo(()=>{const k=new Set(n.map(y=>y.category));return Array.from(k)},[n]),M=l.useMemo(()=>{let k=n;if(g&&(k=k.filter(y=>y.category===g)),b.trim()){const y=b.toLowerCase();k=k.filter(C=>{var O;return C.name.toLowerCase().includes(y)||((O=C.description)==null?void 0:O.toLowerCase().includes(y))})}return k},[n,g,b]),_=!r||v.size<r,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:x,children:[e.jsxs("div",{className:"nice-attraction-picker__header",children:[e.jsx("h3",{className:"nice-attraction-picker__title",children:t("attractionPicker.attractions","Attractions")}),r&&e.jsx("span",{className:"nice-attraction-picker__count",children:t("attractionPicker.selected","{size}/{maxSelections} selected").replace("{size}",String(v.size)).replace("{maxSelections}",String(r))})]}),e.jsxs("div",{className:"nice-attraction-picker__filters",children:[e.jsx("input",{type:"text",value:b,onChange:k=>A(k.target.value),placeholder:t("attractionPicker.searchAttractions","Search attractions…"),className:"nice-attraction-picker__search"}),e.jsx("button",{type:"button",onClick:()=>P(""),className:`nice-attraction-picker__category${g?"":" nice-attraction-picker__category--active"}`,children:t("attractionPicker.all","All")}),p.map(k=>e.jsxs("button",{type:"button",onClick:()=>P(k===g?"":k),className:`nice-attraction-picker__category${k===g?" nice-attraction-picker__category--active":""}`,children:[l.createElement(tt[k],{size:14})," ",t(`attractionPicker.category.${k}`,Qn[k])]},k))]}),e.jsx("div",{className:`nice-attraction-picker__items nice-attraction-picker__items--${h}`,children:M.length===0?e.jsx("p",{children:t("attractionPicker.noAttractionsFound","No attractions found.")}):M.map(k=>{const y=v.has(k.id);return e.jsxs("div",{role:"button",tabIndex:0,"aria-pressed":y,onKeyDown:V.clickOnActivationKey,className:`nice-attraction-picker__card${y?" 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(tt[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:[c&&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:t("attractionPicker.vote","Vote")})]})]},k.id)})})]})}),Jn=[],es={game:z.NtdGamepad,music:z.NtdMusic,dance:z.NtdMusic,quiz:z.NtdHelp,karaoke:z.NtdMicrophone,photo:z.NtdCamera,custom:z.NtdSparkle},ts=l.forwardRef(function(s,a){const{t}=V.useNiceTranslation(),{attractions:n=Jn,onVote:d,onUnvote:o,votedIds:u=[],maxVotes:f,closed:r=!1,sortBy:c="votes",showResults:m=!0,className:h,style:T}=s,x=l.useMemo(()=>new Set(u),[u]),g=f?f-x.size:void 0,P=l.useMemo(()=>{const p=[...n];switch(c){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},[n,c]),b=l.useMemo(()=>Math.max(...n.map(p=>p.votes??0),1),[n]),A=p=>{r||(x.has(p)?o==null||o(p):(!g||g>0)&&(d==null||d(p)))},v=p=>{switch(p){case 0:return e.jsx(z.NtdTrophy,{size:18,primaryColor:"#f59e0b",title:t("attractionVoting.n1stPlace","1st place")});case 1:return e.jsx(z.NtdMedal,{size:18,primaryColor:"#94a3b8",title:t("attractionVoting.n2ndPlace","2nd place")});case 2:return e.jsx(z.NtdMedal,{size:18,primaryColor:"#b45309",title:t("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}),r?t("attractionVoting.votingResults","Voting Results"):t("attractionVoting.voteForAttractions","Vote for Attractions")]}),!r&&g!==void 0&&e.jsx("span",{style:{fontSize:14,color:g>0?"var(--nice-color-primary, #6366f1)":"var(--nice-color-error, #ef4444)"},children:g!==1?t("attractionVoting.votesRemainingMany","{votesRemaining} votes remaining").replace("{votesRemaining}",String(g)):t("attractionVoting.votesRemainingOne","{votesRemaining} vote remaining").replace("{votesRemaining}",String(g))})]}),r&&e.jsx("p",{style:{color:"var(--nice-text-secondary, #64748b)",marginBottom:12},children:t("attractionVoting.votingIsClosedFinalResults","Voting is closed. Final results:")}),e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:8},children:P.map((p,M)=>{const _=x.has(p.id),R=p.votes??0,k=m?`${Math.round(R/b*100)}%`:"0%";return e.jsxs("div",{role:"button",tabIndex:0,"aria-pressed":_,"aria-disabled":r||void 0,onKeyDown:V.clickOnActivationKey,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:r?"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}),!r&&e.jsx("button",{onClick:y=>{y.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:_?t("attractionVoting.unvote","Unvote"):t("attractionVoting.vote","Vote")})]},p.id)})}),m&&e.jsx("div",{style:{marginTop:12,textAlign:"right",fontSize:13,color:"var(--nice-text-secondary, #64748b)"},children:t("attractionVoting.totalVotes","Total votes: {votes}").replace("{votes}",String(n.reduce((p,M)=>p+(M.votes??0),0)))})]})});exports.NiceAttractionPicker=Zn;exports.NiceAttractionVoting=ts;exports.NiceEventMedia=$t;exports.NiceEventPlanning=Yt;exports.NiceExpenseSplit=$n;exports.NiceGiftRegistry=Pn;exports.NiceInvitationDesigner=Sn;exports.NiceKaraokePicker=Kn;exports.NiceMediaCollage=Et;exports.NiceParticipantList=Gt;exports.NiceRoundCard=Vn;exports.NiceRoundList=Yn;exports.NiceRsvpControl=Le;exports.NiceSeatPicker=vn;exports.NiceSeatingChart=rt;exports.NiceSongPicker=qn;