@nice2dev/events 1.1.7 → 1.1.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +53 -0
- package/README.md +3 -2
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +20 -13
- package/dist/index.mjs +1159 -1089
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,58 @@
|
|
|
1
1
|
# @nice2dev/events — Changelog
|
|
2
2
|
|
|
3
|
+
## 1.1.9
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 1.1.9 — themes reach the controls again, every control has a rendered demo, no breaking changes.
|
|
8
|
+
|
|
9
|
+
**Theming.** `NiceThemeProvider`, `applyTheme` and `NiceThemePreview` write the `--nice-*` tokens
|
|
10
|
+
again, so a theme recolours the controls and not only the app's own CSS — since 1.1.7 only
|
|
11
|
+
light/dark switched. The provider's scope wins over values set on `:root`, as it did before 1.1.7:
|
|
12
|
+
put a brand colour into the theme rather than on `<html>`. Alias tokens are computed in the theme
|
|
13
|
+
scope, not only on `:root`. About 1,600 places that used a text token as a background or border, or
|
|
14
|
+
a surface token as text colour, now use the token of the right role. `--nice-warning-light` and
|
|
15
|
+
`--nice-danger-light` are the light shade of the status colour, like `--nice-success-light`
|
|
16
|
+
(new: `--nice-color-warning-light`, `--nice-color-error-light`); backgrounds use `--nice-*-bg`.
|
|
17
|
+
|
|
18
|
+
**Styles that never shipped.** Six stylesheets in `@nice2dev/ui` were unreachable from its entry
|
|
19
|
+
point, so `NiceLiveDataGrid`, `NiceTaskInbox`, `NiceBPMNDesigner`, `NiceInstanceMonitor`,
|
|
20
|
+
`NiceIntegrationHub`, `NiceRulesEngine` and `NiceVideoEditor` rendered unstyled; eleven more
|
|
21
|
+
components had no stylesheet at all; `workflow.css` read its spacing scale as pixels; and
|
|
22
|
+
`NiceModuleGrid` was styled for a `<table>` it does not render.
|
|
23
|
+
|
|
24
|
+
**Language.** `useNiceTranslation()` returns `{ t, lang }` and dates are formatted in the interface
|
|
25
|
+
language rather than the browser's (`ui-presentations` adds `useNiceLang()`). `NiceInvoiceLineEditor`
|
|
26
|
+
takes its currency and units from the active language unless you pass them. `NiceAuditLog`,
|
|
27
|
+
`NiceRecordingPanel`, the four game-engine editors and `NiceTemplateEditor` are translated, the
|
|
28
|
+
game-engine dictionary is actually registered, and 136 ui-audio strings have English defaults
|
|
29
|
+
instead of rendering raw keys.
|
|
30
|
+
|
|
31
|
+
**Canvas and document colours.** Canvas never resolves `var()`: the QR and barcode generators drew a
|
|
32
|
+
black rectangle, the whiteboard lost its colours and light presets parsed to `NaN`. Data colours are
|
|
33
|
+
resolved first now. Colours stored in documents — slide templates, theme presets, brand kits,
|
|
34
|
+
exports — are literals, so a saved document looks the same in every theme.
|
|
35
|
+
|
|
36
|
+
**Fixes found by the new demos.** All 895 controls now have a rendered showcase demo, and roughly
|
|
37
|
+
every third new demo exposed a bug. `ui-platform`: the service worker re-registered on every
|
|
38
|
+
render, a screen permission prompt appeared on mount, reconnects and start-up tasks ran twice,
|
|
39
|
+
valid EAN-13 codes were rejected. `ui-ai`: `createProviderFromConfig` dropped the endpoint path —
|
|
40
|
+
OpenAI, Anthropic and Groq were called without `/v1` and Azure always threw — and the theme
|
|
41
|
+
generator failed on every request. `ui-communication`: the local participant appeared twice in a
|
|
42
|
+
conference and `activeConversationId` was ignored. `ui-buildings`: automation days were saved as
|
|
43
|
+
indices (both forms are read now), the row toggle changed the selected rule instead of the clicked
|
|
44
|
+
one, and floor-plan devices were drawn in the corner. `ui-mobile`: `NiceTouchTable` rendered invalid
|
|
45
|
+
table markup. `ui-diagrams`: arrowheads grew with the stroke width and transition clicks never fired.
|
|
46
|
+
`ui-3d`: opening a code editor before the 3D view broke the whole app. `ui-presentations`: the editor
|
|
47
|
+
clipped slides in columns narrower than 800 px.
|
|
48
|
+
|
|
49
|
+
**Additive API only.** `@nice2dev/ui-platform` now exports its hooks, provider aliases and Props / Ref
|
|
50
|
+
types. Nothing was renamed or removed.
|
|
51
|
+
|
|
52
|
+
## 1.1.8
|
|
53
|
+
|
|
54
|
+
No changes in this release.
|
|
55
|
+
|
|
3
56
|
## 1.1.7
|
|
4
57
|
|
|
5
58
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -66,8 +66,9 @@ npm install @nice2dev/events
|
|
|
66
66
|
- `SeatingChart`, `SeatingSection`, `Seat`, `SeatStatus`, `SeatSelectionConfig` — venue seating
|
|
67
67
|
(re-exported from `venue/venue-spatial`)
|
|
68
68
|
|
|
69
|
-
> ⚠ `
|
|
70
|
-
>
|
|
69
|
+
> ⚠ Use `VenueZoneOccupancy` for the venue capacity reading. The old name `ZoneOccupancy` is a
|
|
70
|
+
> deprecated alias until 1.2.0: `@nice2dev/ui-buildings` exports a different `ZoneOccupancy`
|
|
71
|
+
> (now `BuildingZoneOccupancy`), so the two collided when both packages were imported.
|
|
71
72
|
|
|
72
73
|
## Usage
|
|
73
74
|
|
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),B=require("@nice2dev/icons"),f=require("@nice2dev/ui"),o=require("react"),Z=require("@nice2dev/ui-core");function An(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 Ve(i,s,a){if(s===a)return[...i];if(s<0||s>=i.length)return[...i];if(a<0||a>=i.length)return[...i];const n=[...i],[r]=n.splice(s,1);return n.splice(a,0,r),n}function Je(i){const{items:s,onReorder:a,disabled:n=!1}=i,[r,l]=o.useState(null),[d,m]=o.useState(null),[h,t]=o.useState(!1),u=o.useRef(null),p=o.useCallback(b=>s.findIndex(k=>k.id===b),[s]),_=o.useCallback((b,k)=>{const j=p(b),M=p(k);j<0||M<0||j===M||a==null||a(Ve([...s],j,M).map(c=>c.id))},[s,p,a]),g=o.useCallback(()=>{l(null),m(null),t(!1),u.current=null},[]),x=o.useCallback((b,k)=>({role:"button",draggable:!1,tabIndex:n?-1:0,"aria-grabbed":r===b,onPointerDown:j=>{var N,v;if(n||j.button!==0&&j.pointerType==="mouse")return;(v=(N=j.currentTarget).setPointerCapture)==null||v.call(N,j.pointerId),l(b),t(!0),u.current=s.map(T=>T.id);const M=()=>{window.removeEventListener("pointerup",M),window.removeEventListener("pointercancel",c),t(!1),l(null),m(null)},c=()=>{window.removeEventListener("pointerup",M),window.removeEventListener("pointercancel",c),u.current&&(a==null||a(u.current)),g()};window.addEventListener("pointerup",M),window.addEventListener("pointercancel",c)},onPointerEnter:()=>{n||!r||r===b||(m(b),_(r,b))},onKeyDown:j=>{if(n)return;if(j.key===" "||j.key==="Enter"){j.preventDefault(),r===b?g():(l(b),u.current=s.map(T=>T.id));return}if(j.key==="Escape"&&r===b){j.preventDefault(),u.current&&(a==null||a(u.current)),g();return}if(r!==b)return;const c=j.key==="ArrowLeft"||j.key==="ArrowUp"?-1:j.key==="ArrowRight"||j.key==="ArrowDown"?1:0;if(c===0)return;j.preventDefault();const N=p(b),v=N+c;v<0||v>=s.length||a==null||a(Ve([...s],N,v).map(T=>T.id))},...k?{"aria-label":k}:{}}),[r,_,n,g,p,s,a]);return{activeId:r,overId:d,getHandleProps:x,dragging:h}}const $n=({item:i})=>{const[s,a]=o.useState(!1),n=i.thumbnailUrl??i.url;return i.type==="video"?e.jsx("div",{className:"nice-event-media__video-thumb",children:e.jsx(B.NtdPlay,{size:26})}):s||!n?e.jsx("div",{className:"nice-event-media__broken",title:"Image unavailable",children:e.jsx(B.NtdImage,{size:24})}):e.jsx("img",{src:n,alt:i.caption??"",className:"nice-event-media__thumb",loading:"lazy",onError:()=>a(!0)})},Pn=o.forwardRef(function(s,a){const{items:n,onUpload:r,onDelete:l,onLike:d,onItemClick:m,layout:h="grid",uploadEnabled:t=!0,typeFilter:u="all",onReorder:p,className:_,style:g}=s,[x,b]=o.useState(""),k=o.useMemo(()=>An(n),[n]),j=o.useMemo(()=>u==="all"?k:k.filter(T=>T.type===u),[k,u]),M=!!p&&u==="all",c=Je({items:k,onReorder:p,disabled:!M}),N=T=>{const S=T[0];!S||!r||(r(S,x.trim()||void 0),b(""))},v=h==="list";return e.jsxs("div",{ref:a,className:`nice-event-media nice-event-media--${h} ${_??""}`,style:g,children:[e.jsx("div",{className:"nice-event-media__header",children:e.jsxs("h3",{children:["Media (",j.length,")"]})}),t&&r&&e.jsxs("div",{className:"nice-event-media__upload",children:[e.jsx(f.NiceUpload,{accept:"image/*,video/*",multiple:!1,imagePreview:!1,onFilesSelected:N}),e.jsx(f.NiceTextInput,{value:x,onChange:b,placeholder:"Add a caption…"})]}),j.length===0?e.jsx("p",{className:"nice-event-media__empty",children:"No media yet."}):e.jsx(f.NiceCardGroup,{columns:v?1:void 0,minColumnWidth:200,gap:12,align:"stretch",children:j.map((T,S)=>{const R=M?c.getHandleProps(T.id,`Move ${T.caption??`item ${S+1}`}`):null;return e.jsxs("div",{className:`nice-event-media__card${v?" nice-event-media__card--row":""}${c.activeId===T.id?" nice-event-media__card--dragging":""}`,onClick:()=>m==null?void 0:m(T),onPointerEnter:R==null?void 0:R.onPointerEnter,role:m?"button":void 0,tabIndex:m?0:void 0,children:[R&&e.jsx("span",{className:"nice-event-media__grip",role:R.role,tabIndex:R.tabIndex,"aria-grabbed":R["aria-grabbed"],"aria-label":R["aria-label"],draggable:R.draggable,onPointerDown:R.onPointerDown,onKeyDown:R.onKeyDown,onClick:y=>y.stopPropagation(),children:e.jsx(B.NtdMove,{size:14})}),e.jsx($n,{item:T}),e.jsxs("div",{className:"nice-event-media__body",children:[T.caption&&e.jsx("span",{className:"nice-event-media__caption",children:T.caption}),T.uploadedByName&&e.jsx("span",{className:"nice-event-media__uploader",children:T.uploadedByName}),e.jsxs("div",{className:"nice-event-media__actions",children:[d&&e.jsxs("button",{type:"button",className:"nice-event-media__action",onClick:y=>{y.stopPropagation(),d(T.id)},"aria-label":"Like",children:[e.jsx(B.NtdHeart,{size:15})," ",T.likes??0]}),l&&e.jsx("button",{type:"button",className:"nice-event-media__action nice-event-media__action--danger",onClick:y=>{y.stopPropagation(),l(T.id)},"aria-label":"Delete",children:e.jsx(B.NtdTrash,{size:15})})]})]})]},T.id)})})]})}),me=({title:i,description:s,icon:a,action:n,className:r})=>e.jsx(f.NiceEmpty,{size:"sm",title:i,description:s,icon:a,action:n,className:r}),Bn=o.forwardRef(function(s,a){const{items:n,layout:r="grid",onReorder:l,onItemAdd:d,onItemRemove:m,onCaptionChange:h,onItemClick:t,previewMode:u=!1,transition:p="fade",defaultDurationMs:_=3e3,autoPlay:g=!0,disabled:x=!1,readOnly:b=!1,size:k="md",className:j,style:M}=s,[c,N]=o.useState(0),[v,T]=o.useState(null),[S,R]=o.useState(""),y=x||b,E=!!l&&!y,X=Je({items:n,onReorder:l,disabled:!E}),D=n.length>0?Math.min(c,n.length-1):0,I=n[D],L=(I==null?void 0:I.durationMs)??_;o.useEffect(()=>{if(!u||!g||n.length<2)return;const P=window.setTimeout(()=>N(q=>(q+1)%n.length),Math.max(250,L));return()=>window.clearTimeout(P)},[u,g,n.length,D,L]);const z=o.useMemo(()=>n.reduce((P,q)=>P+(q.durationMs??_),0),[n,_]),A=P=>{h==null||h(P,S),T(null),R("")};return n.length===0?e.jsx("div",{ref:a,className:`nice-media-collage ${j??""}`,style:M,children:e.jsx(me,{icon:e.jsx(B.NtdImage,{size:28}),title:"Nothing in the collage yet",description:"Add photos or video to start arranging them.",action:d&&!y?e.jsx(f.NiceUpload,{accept:"image/*,video/*",multiple:!0,onFilesSelected:d}):void 0})}):u?e.jsxs("div",{ref:a,className:`nice-media-collage nice-media-collage--preview nice-media-collage--${p} ${j??""}`,style:M,children:[e.jsxs("div",{className:"nice-media-collage__stage","aria-live":"polite",children:[(I==null?void 0:I.type)==="video"?e.jsx("video",{className:"nice-media-collage__slide",src:I.mediaUrl,controls:!0},I.id):e.jsx("img",{className:"nice-media-collage__slide",src:I==null?void 0:I.mediaUrl,alt:(I==null?void 0:I.caption)??""},I==null?void 0:I.id),(I==null?void 0:I.caption)&&e.jsx("p",{className:"nice-media-collage__slide-caption",children:I.caption})]}),e.jsxs("div",{className:"nice-media-collage__playbar",children:[e.jsx(f.NiceButton,{size:"sm",variant:"ghost",onClick:()=>N(P=>(P-1+n.length)%n.length),children:"Previous"}),e.jsxs("span",{className:"nice-media-collage__counter",children:[D+1," / ",n.length]}),e.jsx(f.NiceButton,{size:"sm",variant:"ghost",onClick:()=>N(P=>(P+1)%n.length),children:"Next"})]})]}):e.jsxs("div",{ref:a,className:`nice-media-collage nice-media-collage--${r} nice-media-collage--${k} ${j??""}`,style:M,children:[e.jsxs("div",{className:"nice-media-collage__toolbar",children:[e.jsx(f.NiceSegmentedControl,{size:"sm",value:r,readOnly:!0,options:[{value:"sequence",label:"Sequence"},{value:"grid",label:"Grid"},{value:"mosaic",label:"Mosaic"}]}),e.jsxs("span",{className:"nice-media-collage__duration",children:[n.length," item",n.length===1?"":"s"," · ",Math.round(z/1e3),"s"]}),d&&!y&&e.jsx(f.NiceUpload,{accept:"image/*,video/*",multiple:!0,imagePreview:!1,onFilesSelected:d})]}),e.jsx("ol",{className:"nice-media-collage__tiles","aria-label":"Collage order","aria-busy":X.dragging,children:n.map((P,q)=>{const F=E?X.getHandleProps(P.id,`Move ${P.caption??`item ${q+1}`}`):null;return e.jsxs("li",{className:`nice-media-collage__tile${X.activeId===P.id?" nice-media-collage__tile--active":""}${X.overId===P.id?" nice-media-collage__tile--over":""}`,onPointerEnter:F==null?void 0:F.onPointerEnter,children:[e.jsx("span",{className:"nice-media-collage__index","aria-hidden":"true",children:q+1}),e.jsx("button",{type:"button",className:"nice-media-collage__thumb-button",onClick:()=>t==null?void 0:t(P),disabled:!t,children:P.type==="video"?e.jsx("span",{className:"nice-media-collage__video-thumb",children:e.jsx(B.NtdPlay,{size:22})}):e.jsx("img",{className:"nice-media-collage__thumb",src:P.mediaUrl,alt:P.caption??"",loading:"lazy"})}),v===P.id?e.jsx(f.NiceTextInput,{value:S,onChange:R,placeholder:"Caption",autoFocus:!0,size:"sm",onBlur:()=>A(P.id),onKeyDown:C=>{C.key==="Enter"&&A(P.id),C.key==="Escape"&&T(null)}}):e.jsx("button",{type:"button",className:"nice-media-collage__caption",disabled:!h||y,onClick:()=>{T(P.id),R(P.caption??"")},children:P.caption||e.jsx("em",{children:"Add a caption"})}),e.jsxs("div",{className:"nice-media-collage__tile-actions",children:[F&&e.jsx("span",{className:"nice-media-collage__grip",role:F.role,tabIndex:F.tabIndex,"aria-grabbed":F["aria-grabbed"],"aria-label":F["aria-label"],draggable:F.draggable,onPointerDown:F.onPointerDown,onKeyDown:F.onKeyDown,children:e.jsx(B.NtdMove,{size:14})}),m&&!b&&e.jsx(f.NiceButton,{size:"sm",variant:"ghost",ariaLabel:`Remove ${P.caption??`item ${q+1}`}`,disabled:x,onClick:()=>m(P.id),children:e.jsx(B.NtdTrash,{size:14})})]})]},P.id)})}),d&&!y&&n.length>0&&e.jsxs("p",{className:"nice-media-collage__hint",children:[e.jsx(B.NtdPlus,{size:12})," Drag a tile, or focus one and press Space then the arrow keys."]})]})});function Ie(i){const s=i.toLowerCase();return["active","live","published","completed","confirmed"].includes(s)?"success":["cancelled","canceled","rejected","failed"].includes(s)?"error":["scheduled","pending","planning"].includes(s)?"info":["draft","archived"].includes(s)?"secondary":"warning"}const Rn={micro:[],compact:["details","location","budget"],normal:["details","location","schedule","participants","tasks","surveys","budget"],full:["details","location","schedule","participants","tasks","surveys","vendors","budget","documents","settings"]},En=o.forwardRef(function(s,a){var Le,Oe,Ue,Ye,Xe,Fe;const{event:n,participants:r=[],surveys:l=[],billing:d=[],scheduleItems:m=[],tasks:h=[],vendors:t=[],documents:u=[],displayMode:p="normal",tabs:_,activeTab:g,onTabChange:x,tabsIconOnly:b=!0,tabsCentered:k="auto",countLocation:j="bottom",showDetails:M=!0,showLocation:c=!0,showSchedule:N=!0,showParticipants:v=!0,showTasks:T=!0,showSurveys:S=!0,showVendors:R=!0,showBudget:y=!0,showDocuments:E=!0,showSettings:X=!0,editable:D=!1,onSave:I,onPublish:L,onShare:z,onExport:A,onUpdateEvent:P,onUpdateLocation:q,onAddSurvey:F,onSurveyRespond:C,onAddBilling:Y,className:V,style:K}=s,[O,Q]=o.useState(n.title),[G,he]=o.useState(n.description??""),[se,re]=o.useState(n.startDate??""),[pe,ke]=o.useState(n.endDate??""),[xe,le]=o.useState(((Le=n.location)==null?void 0:Le.name)??""),[ge,Te]=o.useState(((Oe=n.location)==null?void 0:Oe.address)??""),[oe,ie]=o.useState(((Ue=n.location)==null?void 0:Ue.virtualUrl)??""),[ne,Ne]=o.useState(((Ye=n.location)==null?void 0:Ye.isVirtual)??!1),[de,je]=o.useState(""),[ue,Ae]=o.useState("single"),[ye,_e]=o.useState(""),[ae,be]=o.useState(""),[fe,$]=o.useState(""),[U,W]=o.useState("PLN"),H={details:M,location:c,schedule:N,participants:v,tasks:T,surveys:S,vendors:R,budget:y,documents:E,settings:X},ce=(_??Rn[p]).filter(w=>H[w]!==!1),[Se,cn]=o.useState(ce[0]??"details"),rn=g??Se,ln=o.useCallback(w=>{const te=w;g===void 0&&cn(te),x==null||x(te)},[g,x]),on=o.useCallback(()=>{P==null||P({title:O,description:G||void 0,startDate:se||void 0,endDate:pe||void 0})},[O,G,se,pe,P]),dn=o.useCallback(()=>{q==null||q({name:xe,address:ge||void 0,virtualUrl:oe||void 0,isVirtual:ne})},[xe,ge,oe,ne,q]),un=o.useCallback(()=>{if(!de.trim()||!F)return;const w=ye.split(",").map(te=>te.trim()).filter(Boolean);F(de.trim(),ue,w.length>0?w:void 0),je(""),_e("")},[de,ue,ye,F]),mn=o.useCallback(()=>{!ae.trim()||!Y||(Y({label:ae.trim(),amount:parseFloat(fe)||0,currency:U}),be(""),$(""))},[ae,fe,U,Y]),hn=o.useMemo(()=>d.map(w=>({label:w.label,amount:w.amount})),[d]),pn=o.useMemo(()=>d.reduce((w,te)=>w+te.amount,0),[d]),xn=((Xe=d[0])==null?void 0:Xe.currency)??"PLN",gn=e.jsxs("div",{className:"nice-event-planning__form",children:[e.jsx(f.NiceTextInput,{label:"Title",value:O,onChange:Q,readOnly:!D}),e.jsx(f.NiceTextArea,{label:"Description",value:G,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:"Start"}),e.jsx("input",{className:"nice-input",type:"datetime-local",value:se,onChange:w=>re(w.target.value),readOnly:!D})]}),e.jsxs("label",{className:"nice-field",children:[e.jsx("span",{className:"nice-field__label",children:"End"}),e.jsx("input",{className:"nice-input",type:"datetime-local",value:pe,onChange:w=>ke(w.target.value),readOnly:!D})]})]}),D&&e.jsx(f.NiceButton,{variant:"primary",leftIcon:e.jsx(Z.NiceIcon,{name:"check",size:"sm"}),onClick:on,children:"Save details"})]}),fn=e.jsxs("div",{className:"nice-event-planning__form",children:[e.jsx(f.NiceToggle,{label:"Virtual event",checked:ne,onChange:Ne,disabled:!D}),e.jsx(f.NiceTextInput,{label:"Venue name",value:xe,onChange:le,readOnly:!D}),ne?e.jsx(f.NiceTextInput,{label:"Virtual URL",value:oe,onChange:ie,readOnly:!D}):e.jsx(f.NiceTextInput,{label:"Address",value:ge,onChange:Te,readOnly:!D}),D&&e.jsx(f.NiceButton,{variant:"primary",leftIcon:e.jsx(Z.NiceIcon,{name:"check",size:"sm"}),onClick:dn,children:"Save location"})]}),vn=e.jsx("div",{className:"nice-event-planning__participants",children:r.length===0?e.jsx("p",{className:"nice-event-planning__empty",children:"No participants yet."}):e.jsxs(e.Fragment,{children:[e.jsx(f.NiceAvatarGroup,{max:8,children:r.map(w=>e.jsx(f.NiceAvatar,{name:w.name,src:w.avatarUrl},w.id))}),e.jsx("ul",{className:"nice-event-planning__participant-list",children:r.map(w=>e.jsxs("li",{className:"nice-event-planning__participant",children:[e.jsx(f.NiceAvatar,{name:w.name,src:w.avatarUrl,size:"sm"}),e.jsx("span",{className:"nice-event-planning__participant-name",children:w.name}),e.jsx(f.NiceBadge,{size:"xs",subtle:!0,variant:Ie(w.status),children:w.status})]},w.id))})]})}),Nn=e.jsxs("div",{className:"nice-event-planning__form",children:[l.length===0?e.jsx("p",{className:"nice-event-planning__empty",children:"No surveys yet."}):l.map(w=>e.jsxs("div",{className:"nice-event-planning__survey",children:[e.jsx("strong",{children:w.question})," ",e.jsx(f.NiceBadge,{size:"xs",outline:!0,variant:"info",children:w.type}),w.options&&e.jsx("div",{className:"nice-event-planning__survey-options",children:w.options.map((te,Tn)=>e.jsx(f.NiceButton,{size:"sm",variant:"outline",onClick:()=>C==null?void 0:C(w.id,te),children:te},Tn))}),w.responses&&e.jsxs("span",{className:"nice-event-planning__muted",children:[w.responses.length," responses"]})]},w.id)),D&&F&&e.jsxs("div",{className:"nice-event-planning__form",children:[e.jsx(f.NiceTextInput,{label:"New survey question",value:de,onChange:je,placeholder:"Question"}),e.jsx(f.NiceSelect,{label:"Type",value:ue,onChange:w=>Ae(w),options:[{value:"single",label:"Single choice"},{value:"multiple",label:"Multiple choice"},{value:"text",label:"Free text"},{value:"rating",label:"Rating"}]}),e.jsx(f.NiceTextInput,{label:"Options (comma-separated)",value:ye,onChange:_e,placeholder:"Yes, No, Maybe"}),e.jsx(f.NiceButton,{variant:"primary",leftIcon:e.jsx(Z.NiceIcon,{name:"plus",size:"sm"}),onClick:un,disabled:!de.trim(),children:"Add survey"})]})]}),jn=e.jsxs("div",{className:"nice-event-planning__form",children:[d.length===0?e.jsx("p",{className:"nice-event-planning__empty",children:"No billing items yet."}):e.jsx(f.NiceAmountBreakdown,{lines:[...hn,{label:"Total",amount:pn,isSummary:!0}],currency:xn}),D&&Y&&e.jsxs("div",{className:"nice-event-planning__row",children:[e.jsx(f.NiceTextInput,{label:"Item",value:ae,onChange:be,placeholder:"Catering"}),e.jsx(f.NiceTextInput,{label:"Amount",value:fe,onChange:$,placeholder:"0.00"}),e.jsx(f.NiceSelect,{label:"Currency",value:U,onChange:w=>W(w),options:["PLN","EUR","USD","GBP"]}),e.jsx(f.NiceButton,{variant:"primary",leftIcon:e.jsx(Z.NiceIcon,{name:"plus",size:"sm"}),onClick:mn,disabled:!ae.trim(),children:"Add"})]})]}),yn=e.jsxs("div",{className:"nice-event-planning__form",children:[e.jsx(f.NiceToggle,{label:"Public event",checked:n.isPublic??!1,disabled:!D}),e.jsx(f.NiceTextInput,{label:"Max participants",value:n.maxParticipants!=null?String(n.maxParticipants):"",onChange:()=>{},readOnly:!D}),e.jsxs("div",{className:"nice-event-planning__muted",children:["Host: ",n.hostName," · Created ",new Date(n.createdAt).toLocaleDateString()]})]}),_n=e.jsx("div",{className:"nice-event-planning__list",children:m.length===0?e.jsx("p",{className:"nice-event-planning__empty",children:"No agenda items yet."}):e.jsx("ul",{className:"nice-event-planning__schedule",children:m.map(w=>e.jsxs("li",{className:"nice-event-planning__schedule-item",children:[e.jsxs("span",{className:"nice-event-planning__schedule-time",children:[e.jsx(Z.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))})}),bn=e.jsx("div",{className:"nice-event-planning__list",children:h.length===0?e.jsx("p",{className:"nice-event-planning__empty",children:"No tasks yet."}):e.jsx("ul",{className:"nice-event-planning__tasks",children:h.map(w=>e.jsxs("li",{className:"nice-event-planning__task",children:[e.jsx(f.NiceToggle,{label:w.title,checked:w.done??!1,disabled:!D}),w.assigneeName&&e.jsx(f.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))})}),wn=e.jsx("div",{className:"nice-event-planning__list",children:t.length===0?e.jsx("p",{className:"nice-event-planning__empty",children:"No vendors yet."}):e.jsx("ul",{className:"nice-event-planning__vendors",children:t.map(w=>e.jsxs("li",{className:"nice-event-planning__vendor",children:[e.jsx(Z.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(f.NiceBadge,{size:"xs",subtle:!0,variant:Ie(w.status),children:w.status}),w.cost!=null&&e.jsxs("span",{className:"nice-event-planning__vendor-cost",children:[w.cost," ",w.currency??""]})]},w.id))})}),kn=e.jsx("div",{className:"nice-event-planning__list",children:u.length===0?e.jsx("p",{className:"nice-event-planning__empty",children:"No documents yet."}):e.jsx("ul",{className:"nice-event-planning__documents",children:u.map(w=>e.jsxs("li",{className:"nice-event-planning__document",children:[e.jsx(Z.NiceIcon,{name:"file",size:"sm"}),e.jsx("span",{className:"nice-event-planning__document-name",children:w.name}),w.fileType&&e.jsx(f.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))})}),Sn={details:gn,location:fn,schedule:_n,participants:vn,tasks:bn,surveys:Nn,vendors:wn,budget:jn,documents:kn,settings:yn},In={details:"file",location:"home",schedule:"clock",participants:"users",tasks:"list",surveys:"clipboard",vendors:"briefcase",budget:"dollar",documents:"folder",settings:"settings"},Cn={schedule:m.length||void 0,participants:r.length||void 0,tasks:h.length||void 0,surveys:l.length||void 0,vendors:t.length||void 0,budget:d.length||void 0,documents:u.length||void 0},zn=ce.map(w=>({id:w,label:w.charAt(0).toUpperCase()+w.slice(1),icon:e.jsx(Z.NiceIcon,{name:In[w],size:"sm"}),badge:Cn[w],content:Sn[w]})),Mn=e.jsxs("div",{className:"nice-event-planning__toolbar",children:[e.jsxs("div",{className:"nice-event-planning__toolbar-title",children:[e.jsx(Z.NiceIcon,{name:"calendar",size:"md"}),e.jsx("span",{className:"nice-event-planning__title",children:n.title}),e.jsx(f.NiceBadge,{size:"sm",variant:Ie(n.status),children:n.status})]}),e.jsx("span",{className:"nice-event-planning__toolbar-spacer"}),e.jsxs("div",{className:"nice-event-planning__toolbar-actions",children:[I&&e.jsx(f.NiceButton,{size:"sm",variant:"primary",leftIcon:e.jsx(Z.NiceIcon,{name:"check",size:"sm"}),onClick:()=>I({title:O,description:G}),children:"Save"}),L&&e.jsx(f.NiceButton,{size:"sm",variant:"success",leftIcon:e.jsx(Z.NiceIcon,{name:"upload",size:"sm"}),onClick:L,children:"Publish"}),z&&e.jsx(f.NiceButton,{size:"sm",variant:"ghost",leftIcon:e.jsx(Z.NiceIcon,{name:"link",size:"sm"}),onClick:z,children:"Share"}),A&&e.jsx(f.NiceButton,{size:"sm",variant:"ghost",leftIcon:e.jsx(Z.NiceIcon,{name:"download",size:"sm"}),onClick:A,children:"Export"})]})]});return p==="micro"?e.jsx("div",{ref:a,className:`nice-event-planning nice-event-planning--micro ${V??""}`,style:K,children:e.jsxs("div",{className:"nice-event-planning__micro",children:[e.jsx(Z.NiceIcon,{name:"calendar",size:"md"}),e.jsxs("div",{className:"nice-event-planning__micro-body",children:[e.jsx("span",{className:"nice-event-planning__title",children:n.title}),e.jsxs("span",{className:"nice-event-planning__muted",children:[n.startDate?new Date(n.startDate).toLocaleString():"No date",(Fe=n.location)!=null&&Fe.name?` · ${n.location.name}`:""]})]}),e.jsx(f.NiceBadge,{size:"sm",variant:Ie(n.status),children:n.status}),r.length>0&&e.jsx(f.NiceAvatarGroup,{max:4,size:"sm",children:r.map(w=>e.jsx(f.NiceAvatar,{name:w.name,src:w.avatarUrl,size:"sm"},w.id))})]})}):e.jsxs("div",{ref:a,className:`nice-event-planning nice-event-planning--${p} ${V??""}`,style:K,children:[Mn,e.jsx(f.NiceTabs,{tabs:zn,activeTab:rn,onChange:ln,iconOnly:b,centered:k,countLocation:j})]})});function Dn(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 $e=({participant:i,showRole:s=!0,showStatus:a=!0,meta:n,children:r,size:l="md",className:d})=>e.jsxs("li",{className:`nice-participant-row nice-participant-row--${l} ${d??""}`,children:[e.jsx(f.NiceAvatar,{name:i.name,src:i.avatarUrl,size:l}),e.jsx("span",{className:"nice-participant-row__name",children:i.name}),s&&i.role&&e.jsx(f.NiceBadge,{size:"xs",outline:!0,variant:"info",children:i.role}),a&&i.status&&e.jsx(f.NiceBadge,{size:"xs",subtle:!0,variant:Dn(i.status),children:i.status}),n&&e.jsx("span",{className:"nice-participant-row__meta",children:n}),r&&e.jsx("span",{className:"nice-participant-row__trailing",children:r})]}),Ln=/^[^\s@,;]+@[^\s@,;]+\.[^\s@,;]{2,}$/,qe=/^.*<\s*([^<>\s]+)\s*>$/;function en(i){var l,d;const s=[],a=[],n=new Set;let r=0;if(!i)return{valid:s,invalid:a,duplicates:r};for(const m of i.split(/[,;\r\n\t]+/)){const h=m.trim();if(!h)continue;const t=((d=(l=qe.exec(h))==null?void 0:l[1])==null?void 0:d.trim())??h,u=qe.test(h)?[t]:t.split(/\s+/);for(const p of u){if(!p)continue;if(!Ln.test(p)){a.push(p);continue}const _=p.toLowerCase();if(n.has(_)){r+=1;continue}n.add(_),s.push(p)}}return{valid:s,invalid:a,duplicates:r}}function On(i,s){const a=new Set(i.map(r=>r.toLowerCase())),n=[...i];for(const r of s){const l=r.toLowerCase();a.has(l)||(a.add(l),n.push(r))}return n}function nn(i={}){const{currentUserId:s,currentUserName:a,requireIdentity:n=!0}=i,[r,l]=o.useState(""),d=!s,m=a??r,h=!n||m.trim().length>0;return{isAnonymous:d,name:m,setName:l,canAct:h,actor:{userId:s,userName:m.trim()}}}const Un=[{answer:"yes",label:"Yes",variant:"success",Icon:B.NtdCheck},{answer:"maybe",label:"Maybe",variant:"warning",Icon:B.NtdHelp},{answer:"no",label:"No",variant:"error",Icon:B.NtdClose}],Pe=o.forwardRef(function(s,a){const{value:n,onRespond:r,allowPlusOnes:l=!1,maxPlusOnes:d=5,plusOnes:m=0,allowNote:h=!1,currentUserId:t,currentUserName:u,compact:p=!1,disabled:_=!1,readOnly:g=!1,size:x="md",className:b,style:k}=s,j=nn({currentUserId:t,currentUserName:u}),[M,c]=o.useState(m),[N,v]=o.useState(""),T=!p&&j.isAnonymous&&!j.canAct,S=_||g,R=y=>{S||!r||r({answer:y,plusOnes:l&&y!=="no"?M:void 0,note:h&&N.trim()?N.trim():void 0,userId:j.actor.userId,userName:j.actor.userName||void 0})};return e.jsxs("div",{ref:a,className:`nice-rsvp-control nice-rsvp-control--${x}${p?" nice-rsvp-control--compact":""} ${b??""}`,style:k,children:[!p&&j.isAnonymous&&e.jsx(f.NiceTextInput,{label:"Your name",value:j.name,onChange:j.setName,placeholder:"Who is replying?",required:!0,disabled:S,size:x}),e.jsx("div",{className:"nice-rsvp-control__answers",role:"group","aria-label":"Your reply",children:Un.map(({answer:y,label:E,variant:X,Icon:D})=>e.jsx(f.NiceButton,{size:x,variant:n===y?X:"outline",leftIcon:e.jsx(D,{size:16}),disabled:S||T,"aria-pressed":n===y,onClick:()=>R(y),children:E},y))}),!p&&l&&n!=="no"&&e.jsxs("label",{className:"nice-rsvp-control__field",children:[e.jsx("span",{className:"nice-rsvp-control__field-label",children:"Additional guests"}),e.jsx(f.NiceNumericInput,{value:M,onChange:y=>c(Math.max(0,Math.min(d,y??0))),min:0,max:d,step:1,size:"xs",disabled:S})]}),!p&&h&&e.jsx(f.NiceTextInput,{label:"Note",value:N,onChange:v,placeholder:"Anything we should know?",disabled:S,size:x}),T&&e.jsx("p",{className:"nice-rsvp-control__hint",children:"Enter your name to reply."})]})}),Yn={yes:"confirmed",maybe:"invited",no:"declined"},We={confirmed:"yes","checked-in":"yes",declined:"no"},Ce=["confirmed","checked-in","invited","declined","no-show"],Xn=o.forwardRef(function(s,a){const{participants:n,mode:r="organizer",currentUserId:l,currentUserName:d,onRsvpChange:m,onCheckIn:h,onScan:t,checkInSlot:u,onInvite:p,extraFields:_,groupBy:g="none",showSummary:x=!0,showSearch:b=!0,allowPlusOnes:k=!1,disabled:j=!1,readOnly:M=!1,size:c="md",className:N,style:v}=s,[T,S]=o.useState(""),[R,y]=o.useState("all"),[E,X]=o.useState(""),D=j||M,I=r==="guest",L=o.useMemo(()=>{const C={total:n.length};for(const Y of Ce)C[Y]=0;for(const Y of n)C[Y.status]=(C[Y.status]??0)+1;return C},[n]),z=o.useMemo(()=>{if(I)return n.filter(Y=>Y.userId===l||Y.id===l);const C=T.trim().toLowerCase();return n.filter(Y=>R!=="all"&&Y.status!==R?!1:!C||Y.name.toLowerCase().includes(C))},[n,I,l,T,R]),A=o.useMemo(()=>{if(g==="none"||I)return[{key:"all",label:"",items:z}];const C=new Map;for(const V of z){const K=g==="status"?V.status:V.role,O=C.get(K);O?O.push(V):C.set(K,[V])}return[...C.keys()].sort((V,K)=>g!=="status"?V.localeCompare(K):Ce.indexOf(V)-Ce.indexOf(K)).map(V=>({key:V,label:V,items:C.get(V)??[]}))},[z,g,I]),P=o.useMemo(()=>en(E),[E]),q=C=>Y=>{m==null||m(C,Yn[Y.answer],Y)},F=()=>{!p||P.valid.length===0||(p(P.valid),X(""))};if(I){const C=z[0];return C?e.jsxs("div",{ref:a,className:`nice-participant-list nice-participant-list--guest ${N??""}`,style:v,children:[e.jsx("ul",{className:"nice-participant-list__rows",children:e.jsx($e,{participant:C,size:c})}),e.jsx(Pe,{value:We[C.status],onRespond:q(C.id),allowPlusOnes:k,currentUserId:l??C.userId,currentUserName:d??C.name,disabled:j,readOnly:M,size:c})]}):e.jsx("div",{ref:a,className:`nice-participant-list ${N??""}`,style:v,children:e.jsx(me,{title:"You are not on this guest list",description:"Ask the host for an invitation link."})})}return e.jsxs("div",{ref:a,className:`nice-participant-list ${N??""}`,style:v,children:[x&&e.jsxs("div",{className:"nice-participant-list__summary",children:[e.jsxs("span",{className:"nice-participant-list__stat",children:[e.jsx("strong",{children:L.confirmed})," confirmed"]}),e.jsxs("span",{className:"nice-participant-list__stat",children:[e.jsx("strong",{children:L.invited})," awaiting reply"]}),e.jsxs("span",{className:"nice-participant-list__stat",children:[e.jsx("strong",{children:L.declined})," declined"]}),e.jsxs("span",{className:"nice-participant-list__stat",children:[e.jsx("strong",{children:L["checked-in"]})," checked in"]}),e.jsxs("span",{className:"nice-participant-list__stat nice-participant-list__stat--total",children:[e.jsx("strong",{children:L.total})," total"]})]}),(b||u||t)&&e.jsxs("div",{className:"nice-participant-list__toolbar",children:[b&&e.jsxs(e.Fragment,{children:[e.jsx(f.NiceTextInput,{value:T,onChange:S,placeholder:"Search guests…",prefix:e.jsx(B.NtdSearch,{size:15}),size:c}),e.jsx(f.NiceSelect,{value:R,onChange:C=>y(C),size:c,options:[{value:"all",label:"All statuses"},...Ce.map(C=>({value:C,label:C}))]})]}),u,t&&!u&&e.jsxs("span",{className:"nice-participant-list__scan-hint",children:[e.jsx(B.NtdQrCode,{size:15})," Scanner ready"]})]}),z.length===0?e.jsx(me,{title:"No guests yet",description:n.length>0?"No one matches the current filter.":"Invite people to see them here."}):A.map(C=>e.jsxs("section",{className:"nice-participant-list__group",children:[C.label&&e.jsxs("h4",{className:"nice-participant-list__group-title",children:[C.label," ",e.jsxs("span",{children:["(",C.items.length,")"]})]}),e.jsx("ul",{className:"nice-participant-list__rows",children:C.items.map(Y=>e.jsxs($e,{participant:Y,size:c,meta:_==null?void 0:_.map(V=>e.jsx("span",{className:"nice-participant-list__extra",children:V.render?V.render(Y):String(Y[V.key]??"")},V.key)),children:[m&&e.jsx(Pe,{compact:!0,value:We[Y.status],onRespond:q(Y.id),currentUserId:Y.userId,currentUserName:Y.name,disabled:D,size:"sm"}),h&&Y.status!=="checked-in"&&e.jsx(f.NiceButton,{size:"sm",variant:"outline",leftIcon:e.jsx(B.NtdCheck,{size:14}),disabled:D,onClick:()=>h(Y.id),children:"Check in"})]},Y.id))})]},C.key)),p&&!M&&e.jsxs("div",{className:"nice-participant-list__invite",children:[e.jsx(f.NiceTextArea,{label:"Invite by email",value:E,onChange:X,placeholder:"Paste addresses — commas, semicolons or new lines",rows:3,disabled:j,size:c}),e.jsxs(f.NiceButton,{variant:"primary",size:c,leftIcon:e.jsx(B.NtdMail,{size:15}),disabled:j||P.valid.length===0,onClick:F,children:["Invite ",P.valid.length>0?`(${P.valid.length})`:""]}),(P.invalid.length>0||P.duplicates>0)&&e.jsxs("p",{className:"nice-participant-list__invite-hint",children:[P.duplicates>0&&`${P.duplicates} duplicate(s) removed. `,P.invalid.length>0&&`${P.invalid.length} entry(ies) not recognised.`]})]})]})}),Fn={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 Re(i){return Fn[i==null?void 0:i.toUpperCase()]??2}function Ee(i,s){return Number.isFinite(i)?Math.round(i*10**Re(s)):0}function ze(i,s){const a=Re(s);return a===0?i:i/10**a}function Vn(i,s,a){const n=Re(s),r=ze(i,s);try{return new Intl.NumberFormat(a,{style:"currency",currency:s.toUpperCase(),minimumFractionDigits:n,maximumFractionDigits:n}).format(r)}catch{return`${r.toFixed(n)} ${s}`}}function ee(i,s,a){return Vn(Ee(i,s),s,a)}const Be={minX:0,minY:0,maxX:0,maxY:0};function qn(i,s=0){if(i.length===0)return{...Be};let a=1/0,n=1/0,r=-1/0,l=-1/0;for(const d of i)d.x<a&&(a=d.x),d.y<n&&(n=d.y),d.x>r&&(r=d.x),d.y>l&&(l=d.y);return{minX:a-s,minY:n-s,maxX:r+s,maxY:l+s}}function Ge(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 Ke(i,s){return i.minX<=s.maxX&&i.maxX>=s.minX&&i.minY<=s.maxY&&i.maxY>=s.minY}function Wn(i,s,a=0){const n=i.zoom||1,r=-i.pan.x/n-a,l=-i.pan.y/n-a;return{minX:r,minY:l,maxX:r+s.width/n+a*2,maxY:l+s.height/n+a*2}}function Gn(i,s=12){const a=[],n=[],r=new Map,l=new Map;let d=null,m=0;for(const h of i.sections??[]){let t=null,u=0;(h.rows??[]).forEach((_,g)=>{const x=Kn(_.seats??[]);if(x.length===0)return;const b=qn(x,s);n.push({sectionId:h.id,rowIndex:g,label:_.label,seats:x,bounds:b}),x.forEach((k,j)=>{r.set(k.id,k),l.set(k.id,{sectionId:h.id,rowIndex:g,seatIndex:j})}),u+=x.length,t=t?Ge(t,b):b});const p=t??{...Be};a.push({section:h,bounds:p,seatCount:u}),m+=u,u>0&&(d=d?Ge(d,p):p)}return{sections:a,rows:n,bounds:d??{...Be},totalSeats:m,seatById:r,locationById:l}}function Kn(i){return[...i].sort((s,a)=>s.number-a.number||s.x-a.x)}function Hn(i,s){return i>s*4?"section":i>s?"row":"seat"}function Qn(i,s,a=2500,n){const r=i.sections.filter(u=>Ke(u.bounds,s)),l=new Set(r.map(u=>u.section.id)),d=i.rows.filter(u=>l.has(u.sectionId)&&Ke(u.bounds,s));let m=0;for(const u of d)for(const p of u.seats)p.x>=s.minX&&p.x<=s.maxX&&p.y>=s.minY&&p.y<=s.maxY&&(m+=1);const h=n??Hn(m,a);let t=[];if(h==="seat"){t=[];for(const u of d)for(const p of u.seats)p.x>=s.minX&&p.x<=s.maxX&&p.y>=s.minY&&p.y<=s.maxY&&t.push(p)}return{tier:h,sections:r,rows:h==="section"?[]:d,seats:t,visibleSeatCount:m}}function De(i){if(i.accessType)return i.accessType;if(i.status==="wheelchair"||i.status==="companion")return i.status}function ve(i,s){const a=(s==null?void 0:s[i.id])??i.status;return a==="wheelchair"||a==="companion"?"available":a}function He(i,s,a){var r;const n=(r=s.priceCategories)==null?void 0:r.find(l=>l.id===i.priceCategoryId);return{amount:(n==null?void 0:n.price)??a.basePrice,currency:a.currency}}function Zn(i,s={},a){return!(ve(i,a)!=="available"||s.allowedCategories&&!s.allowedCategories.includes(i.priceCategoryId))}function sn(i,s={},a){const n=[];let r=null;return i.forEach((l,d)=>{Zn(l,s,a)?r?r.seats.push(l):r={start:d,seats:[l]}:r&&(n.push(r),r=null)}),r&&n.push(r),n}function Jn(i,s,a={},n){const r=a.maxSeats??8;if(i.length>r)return{ok:!1,reason:"max-seats"};for(const d of i){const m=s.seatById.get(d);if(m){if(ve(m,n)!=="available")return{ok:!1,reason:"unavailable",seatId:d};if(a.allowedCategories&&!a.allowedCategories.includes(m.priceCategoryId))return{ok:!1,reason:"category-not-allowed",seatId:d}}}if(!a.adjacentOnly||i.length===0)return{ok:!0};const l=new Map;for(const d of i){const m=s.locationById.get(d);if(!m)continue;const h=`${m.sectionId}::${m.rowIndex}`,t=l.get(h);t?t.push(d):l.set(h,[d])}for(const[d,m]of l){const[h,t]=d.split("::"),u=Number(t),p=s.rows.find(c=>c.sectionId===h&&c.rowIndex===u);if(!p)continue;const _=sn(p.seats,a,n),g=new Set(m);let x=null;for(const c of _)if(c.seats.some(N=>g.has(N.id))){if(x)return{ok:!1,reason:"not-adjacent",seatId:m[0]};x=c}if(!x)continue;const b=x.seats.map((c,N)=>g.has(c.id)?N:-1).filter(c=>c>=0);if(b.length===0)continue;const k=b[0],j=b[b.length-1];if(j-k+1!==b.length)return{ok:!1,reason:"not-adjacent",seatId:m[0]};const M=x.seats.length;if(M>1&&(k===1||M-1-j===1))return{ok:!1,reason:"orphan-seat",seatId:m[0]}}return{ok:!0}}function es(i,s,a,n={},r){if(i.includes(s))return{selected:i.filter(m=>m!==s)};const l=[...i,s],d=Jn(l,a,n,r);return d.ok?{selected:l}:{rejected:d.reason??"not-adjacent"}}function ns(i,s,a={},n={},r){if(s<=0)return[];const l=n.categoryId?{...a,allowedCategories:[n.categoryId]}:a;let d=null;for(const m of i.rows)if(!(n.sectionId&&m.sectionId!==n.sectionId))for(const h of sn(m.seats,l,r)){const t=h.seats.length;if(!(t<s))for(let u=0;u+s<=t;u+=1){const p=u+s-1;if(t>s&&(u===1||t-1-p===1))continue;const _=h.seats.slice(u,p+1),g=_.reduce((x,b)=>x+(b.viewScore??50),0)/s;(!d||g>d.score)&&(d={ids:_.map(x=>x.id),score:g})}}return(d==null?void 0:d.ids)??[]}function ss(i,s,a){var u,p,_,g;const n=i.locationById.get(s);if(!n)return null;const r=i.rows.findIndex(x=>x.sectionId===n.sectionId&&x.rowIndex===n.rowIndex);if(r<0)return null;const l=i.rows[r];if(a==="left")return((u=l.seats[n.seatIndex-1])==null?void 0:u.id)??null;if(a==="right")return((p=l.seats[n.seatIndex+1])==null?void 0:p.id)??null;if(a==="row-start")return((_=l.seats[0])==null?void 0:_.id)??null;if(a==="row-end")return((g=l.seats[l.seats.length-1])==null?void 0:g.id)??null;const d=i.rows[a==="up"?r-1:r+1];if(!d)return null;const m=l.seats[n.seatIndex].x;let h=null,t=1/0;for(const x of d.seats){const b=Math.abs(x.x-m);b<t&&(t=b,h=x)}return(h==null?void 0:h.id)??null}function ts(i,s,a){var h,t,u;const n=i.sections.filter(p=>p.seatCount>0);if(n.length===0)return null;const r=s?(h=i.locationById.get(s))==null?void 0:h.sectionId:void 0,l=n.findIndex(p=>p.section.id===r),d=l<0?0:a==="next"?l+1:l-1,m=n[d];return m?((u=(t=i.rows.find(p=>p.sectionId===m.section.id))==null?void 0:t.seats[0])==null?void 0:u.id)??null:null}const we=8;function is(i,s){return i.seats.length===0?0:i.seats.filter(n=>ve(n,s)==="available").length/i.seats.length}const as=({cull:i,selectedIds:s,cursorId:a,statusOverrides:n,sectionColorById:r,interactive:l,onSeatClick:d,onSectionClick:m,describeSeat:h})=>i.tier==="section"?e.jsx("g",{className:"nice-seating-chart__sections",children:i.sections.map(({section:t,bounds:u,seatCount:p})=>e.jsxs("g",{className:"nice-seating-chart__section",children:[e.jsx("rect",{x:u.minX,y:u.minY,width:u.maxX-u.minX,height:u.maxY-u.minY,rx:12,className:"nice-seating-chart__section-shape",style:{fill:r.get(t.id)},role:m?"button":"img","aria-label":`${t.name}, ${p} seats`,tabIndex:m?0:void 0,onClick:m?()=>m(t.id):void 0}),e.jsx("text",{x:(u.minX+u.maxX)/2,y:(u.minY+u.maxY)/2,className:"nice-seating-chart__section-label",textAnchor:"middle",dominantBaseline:"middle","aria-hidden":"true",children:t.name})]},t.id))}):i.tier==="row"?e.jsx("g",{className:"nice-seating-chart__rows",children:i.rows.map(t=>{const u=is(t,n);return e.jsxs("g",{children:[e.jsx("rect",{x:t.bounds.minX,y:t.bounds.minY,width:t.bounds.maxX-t.bounds.minX,height:t.bounds.maxY-t.bounds.minY,rx:8,className:"nice-seating-chart__row-shape",style:{fill:r.get(t.sectionId),fillOpacity:.25+u*.65},role:"img","aria-label":`Row ${t.label}, ${t.seats.length} seats, ${Math.round(u*t.seats.length)} available`}),e.jsx("text",{x:t.bounds.minX-6,y:(t.bounds.minY+t.bounds.maxY)/2,className:"nice-seating-chart__row-label",textAnchor:"end",dominantBaseline:"middle","aria-hidden":"true",children:t.label})]},`${t.sectionId}-${t.rowIndex}`)})}):e.jsx("g",{className:"nice-seating-chart__seats",children:i.seats.map(t=>{const u=ve(t,n),p=De(t),_=s.has(t.id),g=a===t.id,x={row:t.row,number:t.number},b=["nice-seating-chart__seat",`nice-seating-chart__seat--${u}`,_?"nice-seating-chart__seat--selected":"",p?`nice-seating-chart__seat--${p}`:"",g?"nice-seating-chart__seat--cursor":""].filter(Boolean).join(" ");return e.jsxs("g",{className:b,"data-seat-id":t.id,role:"gridcell","aria-selected":_,"aria-disabled":u!=="available","aria-label":h(t),tabIndex:g?0:-1,onClick:l&&d?()=>d(t):void 0,children:[p?e.jsx("rect",{x:t.x-we,y:t.y-we,width:we*2,height:we*2,rx:3,className:"nice-seating-chart__seat-shape",fill:p==="companion"?"url(#nice-seat-companion-hatch)":void 0}):e.jsx("circle",{cx:t.x,cy:t.y,r:we,className:"nice-seating-chart__seat-shape"}),p==="wheelchair"&&e.jsx(B.NtdWheelchair,{size:10,x:t.x-5,y:t.y-5,className:"nice-seating-chart__seat-glyph"}),e.jsx("title",{children:h(t)}),e.jsx("text",{x:t.x,y:t.y,className:"nice-seating-chart__seat-number",textAnchor:"middle",dominantBaseline:"middle","aria-hidden":"true",children:x.number})]},t.id)})}),cs=({index:i,selectedIds:s,statusOverrides:a,maxSeats:n,onSeatToggle:r,onBestAvailable:l,describeSeat:d,disabled:m=!1,defaultOpen:h=!1})=>{var M;const t=o.useMemo(()=>i.sections.filter(c=>c.seatCount>0),[i.sections]),[u,p]=o.useState(((M=t[0])==null?void 0:M.section.id)??""),[_,g]=o.useState(0),[x,b]=o.useState(2),k=o.useMemo(()=>i.rows.filter(c=>c.sectionId===u),[i.rows,u]),j=k.find(c=>c.rowIndex===_)??k[0];return e.jsxs(f.NiceCollapse,{trigger:"Choose seats without the map",defaultExpanded:h,className:"nice-seating-chart__list-panel",children:[l&&e.jsxs("div",{className:"nice-seating-chart__best",children:[e.jsxs("label",{className:"nice-seating-chart__field",children:[e.jsx("span",{children:"How many seats?"}),e.jsx(f.NiceNumericInput,{value:x,onChange:c=>b(Math.max(1,Math.min(n,c??1))),min:1,max:n,size:"xs",disabled:m})]}),e.jsx(f.NiceButton,{size:"sm",variant:"primary",disabled:m,onClick:()=>l(x,{sectionId:u||void 0}),children:"Best available"})]}),e.jsxs("div",{className:"nice-seating-chart__pickers",children:[e.jsxs("label",{className:"nice-seating-chart__field",children:[e.jsx("span",{children:"Section"}),e.jsx(f.NiceSelect,{size:"sm",value:u,disabled:m,onChange:c=>{p(c),g(0)},options:t.map(c=>({value:c.section.id,label:`${c.section.name} (${c.seatCount})`}))})]}),e.jsxs("label",{className:"nice-seating-chart__field",children:[e.jsx("span",{children:"Row"}),e.jsx(f.NiceSelect,{size:"sm",value:String((j==null?void 0:j.rowIndex)??0),disabled:m||k.length===0,onChange:c=>g(Number(c)),options:k.map(c=>({value:String(c.rowIndex),label:`${c.label} (${c.seats.length})`}))})]})]}),j&&e.jsx("ul",{className:"nice-seating-chart__seat-list",children:j.seats.map(c=>{const N=ve(c,a),v=De(c),T=s.has(c.id);return e.jsx("li",{children:e.jsxs(f.NiceButton,{size:"sm",variant:T?"primary":"outline",disabled:m||N!=="available",ariaLabel:d(c),"aria-pressed":T,onClick:()=>r(c),children:[c.number,v&&e.jsx(B.NtdWheelchair,{size:11})]})},c.id)})})]})},rs={zoom:1,pan:{x:0,y:0}};function ls(i={}){const{minZoom:s=.1,maxZoom:a=10,initial:n=rs,viewport:r,onViewportChange:l,disabled:d=!1}=i,[m,h]=o.useState(n),t=r??m,[u,p]=o.useState(!1),_=o.useRef(new Map),g=o.useRef(null),x=o.useRef(null),b=o.useCallback(y=>{r===void 0&&h(y),l==null||l(y)},[r,l]),k=o.useCallback(y=>Math.min(a,Math.max(s,y)),[s,a]),j=o.useCallback((y,E)=>{const X=k(t.zoom*y);if(X===t.zoom)return;const D=X/t.zoom;b({zoom:X,pan:{x:E.x-(E.x-t.pan.x)*D,y:E.y-(E.y-t.pan.y)*D}})},[b,k,t]),M=o.useCallback((y,E,X)=>{const D=E??(X?{x:X.width/2,y:X.height/2}:{x:0,y:0});j(y,D)},[j]),c=o.useCallback((y,E,X=24)=>{const D=Math.max(1,y.maxX-y.minX),I=Math.max(1,y.maxY-y.minY),L=k(Math.min((E.width-X*2)/D,(E.height-X*2)/I));b({zoom:L,pan:{x:(E.width-D*L)/2-y.minX*L,y:(E.height-I*L)/2-y.minY*L}})},[b,k]),N=o.useCallback(()=>b(n),[b,n]),v=o.useCallback(y=>({x:(y.x-t.pan.x)/t.zoom,y:(y.y-t.pan.y)/t.zoom}),[t]),T=o.useCallback(y=>({x:y.x*t.zoom+t.pan.x,y:y.y*t.zoom+t.pan.y}),[t]),S=y=>{const E=y.currentTarget.getBoundingClientRect();return{x:y.clientX-E.left,y:y.clientY-E.top}};return{viewport:t,setViewport:b,containerProps:d?{}:{onWheel:y=>{y.preventDefault();const E=Math.exp(-y.deltaY*.002);j(Math.min(2,Math.max(.5,E)),S(y))},onPointerDown:y=>{var X,D;const E=S(y);if(_.current.set(y.pointerId,E),(D=(X=y.currentTarget).setPointerCapture)==null||D.call(X,y.pointerId),_.current.size===2){const[I,L]=[..._.current.values()];g.current={distance:Math.hypot(I.x-L.x,I.y-L.y)||1,zoom:t.zoom}}else x.current=E,p(!0)},onPointerMove:y=>{if(!_.current.has(y.pointerId))return;const E=S(y);if(_.current.set(y.pointerId,E),_.current.size===2&&g.current){const[I,L]=[..._.current.values()],z=Math.hypot(I.x-L.x,I.y-L.y)||1,A=k(g.current.zoom*(z/g.current.distance)),P={x:(I.x+L.x)/2,y:(I.y+L.y)/2};A!==t.zoom&&j(A/t.zoom,P);return}if(!x.current)return;const X=E.x-x.current.x,D=E.y-x.current.y;x.current=E,b({zoom:t.zoom,pan:{x:t.pan.x+X,y:t.pan.y+D}})},onPointerUp:y=>{_.current.delete(y.pointerId),_.current.size<2&&(g.current=null),_.current.size===0&&(x.current=null,p(!1))},onPointerCancel:y=>{_.current.delete(y.pointerId),g.current=null,x.current=null,p(!1)}},zoomBy:M,fitTo:c,reset:N,screenToWorld:v,worldToScreen:T,panning:u}}const os={"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."},tn=o.forwardRef(function(s,a){var ae,be,fe;const{chart:n,mode:r="select",selection:l={},selectedSeatIds:d,defaultSelectedSeatIds:m=[],onSelectionChange:h,onSelectionRejected:t,seatStatusOverrides:u,onSeatClick:p,onBestAvailable:_,lod:g="auto",onLodChange:x,maxRenderedSeats:b=2500,containerSize:k,showLegend:j=!0,showList:M=!1,zoomable:c=!0,locale:N,disabled:v=!1,readOnly:T=!1,className:S,style:R}=s,y=o.useRef(null),[E,X]=o.useState({width:800,height:500}),[D,I]=o.useState(!1),[L,z]=o.useState(m),[A,P]=o.useState(null),[q,F]=o.useState(""),C=d??L,Y=o.useMemo(()=>new Set(C),[C]),V=r==="select"&&!v&&!T&&l.interactive!==!1,K=l.maxSeats??8,O=o.useMemo(()=>Gn(n),[n]),Q=k??E,G=!!k||D;o.useEffect(()=>{if(k||!y.current||typeof ResizeObserver>"u")return;const $=y.current,U=new ResizeObserver(([W])=>{const{width:H,height:J}=W.contentRect;H>0&&J>0&&(X({width:H,height:J}),I(!0))});return U.observe($),()=>U.disconnect()},[k]);const he=ls({disabled:!c||v}),{fitTo:se,viewport:re}=he,pe=o.useRef(!1);o.useEffect(()=>{pe.current||!G||O.totalSeats===0||Q.width<=0||(pe.current=!0,se(O.bounds,Q))},[se,O,Q,G]);const ke=o.useMemo(()=>Wn(re,Q,40),[re,Q]),xe=g!=="auto"?g:A?"seat":void 0,le=o.useMemo(()=>Qn(O,ke,b,xe),[O,ke,b,xe]),ge=o.useRef(null);o.useEffect(()=>{ge.current!==le.tier&&(ge.current=le.tier,x==null||x(le.tier))},[le.tier,x]);const Te=o.useMemo(()=>{var $;return new Map((($=n.sections)==null?void 0:$.map(U=>[U.id,U.color]))??[])},[n.sections]),oe=o.useMemo(()=>{var $;return new Map((($=n.sections)==null?void 0:$.map(U=>[U.id,U]))??[])},[n.sections]),ie=o.useCallback($=>{const U=oe.get($.sectorId),W=ve($,u),H=De($),J=[U?U.name:"",`row ${$.row}`,`seat ${$.number}`].filter(Boolean);if(U&&l.showPrices!==!1){const ce=He($,n,U);J.push(ee(ce.amount,ce.currency,N))}return J.push(W),H==="wheelchair"&&J.push("wheelchair accessible"),H==="companion"&&J.push("companion seat"),J.join(", ")},[n,oe,u,l.showPrices,N]),ne=o.useCallback($=>{d===void 0&&z($),h==null||h($)},[d,h]),Ne=o.useCallback($=>{if(p==null||p($),!V)return;const U=es(C,$.id,O,l,u);if("rejected"in U){t==null||t({reason:U.rejected,seatId:$.id}),F(os[U.rejected]);return}ne(U.selected),F(`${ie($)}. ${U.selected.length} of ${K} selected.`)},[ne,ie,O,V,K,p,t,u,C,l]),de=o.useCallback(($,U)=>{if(_){_($,U);return}const W=ns(O,$,l,U,u);if(W.length===0){F(`No block of ${$} seats together is available.`);return}ne(W),P(W[0]),F(`Selected ${W.length} seats together.`)},[ne,O,_,u,l]),je=o.useCallback($=>{const U=O.locationById.get($);if(!U)return;const W=O.rows.find(H=>H.sectionId===U.sectionId&&H.rowIndex===U.rowIndex);W&&se(W.bounds,Q,80)},[se,O,Q]),ue=o.useCallback($=>{if(!$)return;P($),je($);const U=O.seatById.get($);U&&F(ie(U))},[ie,O.seatById,je]),Ae=$=>{var J,ce;const U=A??((ce=(J=O.rows[0])==null?void 0:J.seats[0])==null?void 0:ce.id)??null;if(!U)return;const H={ArrowLeft:"left",ArrowRight:"right",ArrowUp:"up",ArrowDown:"down",Home:"row-start",End:"row-end"}[$.key];if(H){$.preventDefault(),ue(A?ss(O,U,H):U);return}if($.key==="PageDown"||$.key==="PageUp"){$.preventDefault(),ue(ts(O,A,$.key==="PageDown"?"next":"prev"));return}if($.key==="Enter"||$.key===" "){$.preventDefault();const Se=O.seatById.get(U);Se&&Ne(Se);return}$.key==="Escape"&&C.length>0&&($.preventDefault(),ne([]),F("Selection cleared."))};if(O.totalSeats===0)return e.jsx("div",{ref:a,className:`nice-seating-chart ${S??""}`,style:R,children:e.jsx(me,{title:"This chart has no seats",description:"Add sections and rows to the seating chart to see it here."})});const ye=C.reduce(($,U)=>{const W=O.seatById.get(U),H=W?oe.get(W.sectorId):void 0;return!W||!H?$:$+He(W,n,H).amount},0),_e=((be=(ae=n.sections)==null?void 0:ae[0])==null?void 0:be.currency)??"PLN";return e.jsxs("div",{ref:a,className:`nice-seating-chart nice-seating-chart--${r} ${S??""}`,style:R,children:[e.jsxs("div",{ref:y,className:"nice-seating-chart__canvas-host",role:"grid","aria-label":`${n.name} seating chart`,"aria-rowcount":O.rows.length,"aria-colcount":O.totalSeats,tabIndex:A?-1:0,onKeyDown:Ae,...he.containerProps,children:[e.jsxs("svg",{className:"nice-seating-chart__canvas",width:"100%",height:"100%",role:"presentation",children:[e.jsx("defs",{children:e.jsx("pattern",{id:"nice-seat-companion-hatch",width:4,height:4,patternUnits:"userSpaceOnUse",patternTransform:"rotate(45)",children:e.jsx("line",{x1:0,y1:0,x2:0,y2:4,className:"nice-seating-chart__hatch"})})}),e.jsx("g",{transform:`translate(${re.pan.x} ${re.pan.y}) scale(${re.zoom})`,children:e.jsx(as,{cull:le,selectedIds:Y,cursorId:A,statusOverrides:u,sectionColorById:Te,interactive:V,onSeatClick:Ne,onSectionClick:l.sectionSelect?$=>{var W;const U=(W=O.rows.find(H=>H.sectionId===$))==null?void 0:W.seats[0];U&&ue(U.id)}:void 0,describeSeat:ie})})]}),c&&e.jsxs("div",{className:"nice-seating-chart__zoom",children:[e.jsx(f.NiceButton,{size:"sm",variant:"ghost",ariaLabel:"Zoom in",onClick:()=>he.zoomBy(1.25,void 0,Q),children:"+"}),e.jsx(f.NiceButton,{size:"sm",variant:"ghost",ariaLabel:"Zoom out",onClick:()=>he.zoomBy(.8,void 0,Q),children:"−"}),e.jsx(f.NiceButton,{size:"sm",variant:"ghost",ariaLabel:"Fit to view",onClick:()=>se(O.bounds,Q),children:"Fit"})]})]}),e.jsx("p",{className:"nice-seating-chart__status",role:"status","aria-live":"polite",children:q}),j&&e.jsxs("ul",{className:"nice-seating-chart__legend",children:[(fe=n.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," · ",ee($.price,_e,N)]},$.id)),e.jsxs("li",{className:"nice-seating-chart__legend-item nice-seating-chart__legend-item--sold",children:[e.jsx("span",{className:"nice-seating-chart__legend-swatch","aria-hidden":"true"})," Sold"]})]}),r==="select"&&C.length>0&&e.jsxs("p",{className:"nice-seating-chart__total",children:[C.length," seat",C.length===1?"":"s"," ·"," ",ee(ye,_e,N)]}),M&&e.jsx(cs,{index:O,selectedIds:Y,statusOverrides:u,maxSeats:K,onSeatToggle:Ne,onBestAvailable:de,describeSeat:ie,disabled:!V,defaultOpen:r==="select"&&M})]})}),ds=o.forwardRef(function({showList:s=!0,className:a,...n},r){return e.jsx(tn,{ref:r,mode:"select",showList:s,className:`nice-seat-picker ${a??""}`,...n})}),an=/\{\{\s*([\w.-]+)\s*\}\}/g,us={"&":"&","<":"<",">":">",'"':""","'":"'"};function ms(i){return i.replace(/[&<>"']/g,s=>us[s]??s)}function hs(i){const s=[],a=new Set;for(const n of i.matchAll(an)){const r=n[1];a.has(r)||(a.add(r),s.push(r))}return s}function ps(i,s={},a={}){const{escape:n=!0,missing:r="keep"}=a;return i.replace(an,(l,d)=>{const m=s[d];return m==null?r==="blank"?"":l:n?ms(String(m)):String(m)})}function Qe(i){return`{{${i}}}`}function xs(i,s={}){return hs(i).filter(a=>s[a]===void 0||s[a]===null)}const gs=["bold","italic","underline","h1","h2","ul","ol","link","image","alignLeft","alignCenter","undo","redo"],fs=o.forwardRef(function(s,a){const{template:n,onTemplateChange:r,tokens:l=[],previewData:d={},recipients:m=[],onRecipientsChange:h,onSend:t,sending:u=!1,toolbar:p=gs,disabled:_=!1,readOnly:g=!1,size:x="md",className:b,style:k}=s,[j,M]=o.useState(""),c=_||g||u,N=o.useMemo(()=>en(j),[j]),v=o.useMemo(()=>{const I={};for(const L of l)L.sample!==void 0&&(I[L.key]=L.sample);return{...I,...d}},[l,d]),T=o.useMemo(()=>ps(n.body??"",v),[n.body,v]),S=o.useMemo(()=>xs(n.body??"",v),[n.body,v]),R=m.map(I=>I.email),y=I=>r==null?void 0:r({...n,...I}),E=I=>{y({body:`${n.body??""}${Qe(I)}`})},X=()=>{!h||N.valid.length===0||(h(On(R,N.valid)),M(""))},D=I=>{h==null||h(R.filter(L=>L!==I))};return e.jsxs("div",{ref:a,className:`nice-invitation-designer nice-invitation-designer--${x} ${b??""}`,style:k,children:[e.jsxs("section",{className:"nice-invitation-designer__editor",children:[e.jsx(f.NiceTextInput,{label:"Template name",value:n.name,onChange:I=>y({name:I}),placeholder:"Birthday invitation",disabled:c,size:x}),l.length>0&&!g&&e.jsxs("div",{className:"nice-invitation-designer__tokens",children:[e.jsx("span",{className:"nice-invitation-designer__tokens-label",children:"Insert:"}),l.map(I=>e.jsx(f.NiceButton,{size:"sm",variant:"outline",disabled:c,onClick:()=>E(I.key),children:I.label},I.key))]}),e.jsx(f.NiceHtmlEditor,{value:n.body??"",onChange:I=>y({body:I}),toolbar:p,height:280,readOnly:g||u,disabled:_})]}),e.jsxs("section",{className:"nice-invitation-designer__preview","aria-label":"Invitation preview",children:[e.jsxs("header",{className:"nice-invitation-designer__preview-header",children:[e.jsx("h4",{children:"Preview"}),S.length>0&&e.jsxs(f.NiceBadge,{size:"xs",subtle:!0,variant:"warning",children:[S.length," unresolved"]})]}),n.coverImageUrl&&e.jsx("img",{className:"nice-invitation-designer__cover",src:n.coverImageUrl,alt:""}),e.jsx("div",{className:"nice-invitation-designer__preview-body",dangerouslySetInnerHTML:{__html:T}}),S.length>0&&e.jsxs("p",{className:"nice-invitation-designer__unresolved",children:["No preview value for: ",S.map(I=>Qe(I)).join(", ")]})]}),e.jsxs("section",{className:"nice-invitation-designer__recipients",children:[e.jsx("header",{className:"nice-invitation-designer__recipients-header",children:e.jsxs("h4",{children:["Recipients ",e.jsxs("span",{children:["(",m.length,")"]})]})}),h&&!g&&e.jsxs(e.Fragment,{children:[e.jsx(f.NiceTextArea,{label:"Add addresses",value:j,onChange:M,placeholder:"Paste a list — commas, semicolons or new lines",rows:3,disabled:c,size:x}),e.jsxs("div",{className:"nice-invitation-designer__paste-actions",children:[e.jsxs(f.NiceButton,{size:x,variant:"outline",leftIcon:e.jsx(B.NtdMail,{size:15}),disabled:c||N.valid.length===0,onClick:X,children:["Add ",N.valid.length>0?`(${N.valid.length})`:""]}),(N.invalid.length>0||N.duplicates>0)&&e.jsxs("span",{className:"nice-invitation-designer__paste-hint",children:[N.duplicates>0&&`${N.duplicates} duplicate(s). `,N.invalid.length>0&&`${N.invalid.length} not recognised: ${N.invalid.slice(0,3).join(", ")}`]})]})]}),m.length>0&&e.jsx("ul",{className:"nice-invitation-designer__recipient-list",children:m.map(I=>e.jsxs("li",{className:"nice-invitation-designer__recipient",children:[e.jsx("span",{children:I.name?`${I.name} <${I.email}>`:I.email}),I.status&&I.status!=="pending"&&e.jsx(f.NiceBadge,{size:"xs",subtle:!0,variant:I.status==="sent"?"success":"error",children:I.status}),h&&!g&&e.jsx(f.NiceButton,{size:"sm",variant:"ghost",ariaLabel:`Remove ${I.email}`,disabled:c,onClick:()=>D(I.email),children:e.jsx(B.NtdTrash,{size:13})})]},I.email))}),t&&!g&&e.jsx(f.NiceButton,{variant:"primary",size:x,leftIcon:e.jsx(B.NtdSend,{size:15}),loading:u,ariaLabel:"Send invitations",disabled:_||u||m.length===0,onClick:()=>t({templateId:n.id,emails:R}),children:u?"Sending…":`Send to ${m.length}`})]})]})}),vs=({value:i,max:s,currency:a,locale:n,label:r,className:l})=>{const d=s>0?s:1,m=i>=s&&s>0,h=(t,u)=>a?`${ee(t,a,n)} / ${ee(u,a,n)}`:`${t} / ${u}`;return e.jsx(f.NiceProgress,{className:l,value:Math.min(i,d),max:d,variant:m?"success":"primary",size:"sm",showValue:!0,formatValue:()=>h(i,s),"aria-label":r})};function Ns(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 js=o.forwardRef(function(s,a){const{items:n,kind:r="registry",mode:l="owner",currency:d="PLN",locale:m,hideContributors:h=!1,currentUserId:t,currentUserName:u,onContribute:p,onClaim:_,onUnclaim:g,onItemAdd:x,onItemDelete:b,onItemClick:k,layout:j="grid",disabled:M=!1,readOnly:c=!1,size:N="md",className:v,style:T}=s,S=nn({currentUserId:t,currentUserName:u}),[R,y]=o.useState(null),[E,X]=o.useState(0),[D,I]=o.useState(""),L=l==="owner",z=M||c,A=r==="wishlist",P=o.useMemo(()=>A?[...n].sort((C,Y)=>Number(C.isPurchased??!1)-Number(Y.isPurchased??!1)||(Y.priority??0)-(C.priority??0)):n,[n,A]),q=()=>{y(null),X(0)},F=C=>{!p||!S.canAct||(p(C.id,{amount:E>0?E:void 0,quantity:E>0?void 0:1,userName:S.actor.userName,userId:S.actor.userId}),q())};return n.length===0?e.jsx("div",{ref:a,className:`nice-gift-registry ${v??""}`,style:T,children:e.jsx(me,{icon:e.jsx(B.NtdGiftCard,{size:28}),title:A?"Nothing on the wishlist yet":"No gifts on the registry yet",description:L?"Add what you would like and share the link.":"The host has not added anything yet."})}):e.jsxs("div",{ref:a,className:`nice-gift-registry nice-gift-registry--${r} nice-gift-registry--${j} nice-gift-registry--${N} ${v??""}`,style:T,children:[!L&&S.isAnonymous&&(p||_)&&e.jsx(f.NiceTextInput,{label:"Your name",value:S.name,onChange:S.setName,placeholder:"So the host knows who to thank",required:!0,disabled:z,size:N}),e.jsx(f.NiceCardGroup,{columns:j==="list"?1:void 0,minColumnWidth:240,gap:12,children:P.map(C=>{const{value:Y,max:V,complete:K}=Ns(C,r),O=C.price,Q=C.contributions??[];return e.jsxs("div",{className:`nice-gift-registry__item${K?" nice-gift-registry__item--complete":""}`,children:[C.imageUrl&&e.jsx("img",{src:C.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:()=>k==null?void 0:k(C),disabled:!k,children:C.title}),C.description&&e.jsx("p",{className:"nice-gift-registry__description",children:C.description}),e.jsxs("div",{className:"nice-gift-registry__facts",children:[O&&e.jsx("span",{className:"nice-gift-registry__price",children:ee(O.amount,O.currency||d,m)}),A&&(C.priority??0)>0&&e.jsxs(f.NiceBadge,{size:"xs",subtle:!0,variant:"warning",children:[e.jsx(B.NtdStar,{size:11})," ",C.priority]}),K&&e.jsx(f.NiceBadge,{size:"xs",subtle:!0,variant:"success",children:A?"bought":"fully covered"}),C.url&&e.jsxs("a",{className:"nice-gift-registry__link",href:C.url,target:"_blank",rel:"noopener noreferrer",children:[e.jsx(B.NtdLink,{size:13})," Shop"]})]}),!A&&e.jsx(vs,{value:Y,max:V,label:`${C.title}: ${Y} of ${V} covered`}),!h&&Q.length>0&&e.jsx("ul",{className:"nice-gift-registry__contributors",children:Q.map(G=>e.jsxs("li",{className:"nice-gift-registry__contributor",children:[e.jsx("strong",{children:G.contributorName}),G.amount!==void 0&&` — ${ee(G.amount,(O==null?void 0:O.currency)||d,m)}`,G.amount===void 0&&G.quantity?` — ${G.quantity}×`:"",G.message&&e.jsxs("em",{children:[" “",G.message,"”"]})]},G.id))}),e.jsxs("div",{className:"nice-gift-registry__actions",children:[!L&&!K&&_&&e.jsx(f.NiceButton,{size:"sm",variant:"primary",disabled:z||!S.canAct,leftIcon:e.jsx(B.NtdCheck,{size:14}),onClick:()=>_(C.id,{...S.actor,quantity:1}),children:"I'll take this"}),!L&&K&&g&&e.jsx(f.NiceButton,{size:"sm",variant:"ghost",disabled:z,onClick:()=>g(C.id),children:"Release"}),!L&&!K&&!A&&p&&e.jsx(f.NiceButton,{size:"sm",variant:"outline",disabled:z||!S.canAct,onClick:()=>y(R===C.id?null:C.id),children:"Chip in"}),L&&b&&!c&&e.jsx(f.NiceButton,{size:"sm",variant:"ghost",ariaLabel:`Delete ${C.title}`,disabled:M,onClick:()=>b(C.id),children:e.jsx(B.NtdTrash,{size:14})})]}),R===C.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 (",(O==null?void 0:O.currency)||d,")"]}),e.jsx(f.NiceNumericInput,{value:E,onChange:G=>X(Math.max(0,G??0)),min:0,size:"xs",disabled:z})]}),e.jsx(f.NiceButton,{size:"sm",variant:"primary",disabled:z||!S.canAct,onClick:()=>F(C),children:"Confirm"}),e.jsx(f.NiceButton,{size:"sm",variant:"ghost",onClick:q,children:"Cancel"})]})]})]},C.id)})}),L&&x&&!c&&e.jsxs("div",{className:"nice-gift-registry__add",children:[e.jsx(f.NiceTextInput,{label:A?"Add a wish":"Add a gift",value:D,onChange:I,placeholder:"What would you like?",disabled:M,size:N}),e.jsx(f.NiceButton,{variant:"primary",size:N,leftIcon:e.jsx(B.NtdPlus,{size:15}),disabled:M||!D.trim(),onClick:()=>{x({title:D.trim(),quantityNeeded:1}),I("")},children:"Add"})]})]})});function ys(i){const s=new Map;for(const a of i){const n=(a.currency||"").toUpperCase(),r=s.get(n);r?r.push(a):s.set(n,[a])}return s}function _s(i,s,a){var h;const n=new Set(s.map(t=>t.id)),r=s.map(t=>t.id),l=new Map(r.map(t=>[t,0])),d=[];let m=0;if(r.length===0)return{balances:l,issues:i.map(t=>({itemId:t.id,reason:"no-participants"})),totalMinor:0};for(const t of i){const u=t.paidById;if(!u){d.push({itemId:t.id,reason:"no-payer"});continue}if(!n.has(u)){d.push({itemId:t.id,reason:"unknown-payer"});continue}let p=(h=t.splitAmong)!=null&&h.length?t.splitAmong.filter(j=>n.has(j)):r;p.length===0&&(p=r);const _=Ee(t.amount,a);m+=_;const g=p.length,x=Math.floor(_/g),b=_-x*g,k=new Map(p.map(j=>[j,x]));if(b!==0)if(k.has(u))k.set(u,(k.get(u)??0)+b);else{const j=[...p].sort(Me),M=b>0?1:-1;for(let c=0;c<Math.abs(b);c+=1){const N=j[c%j.length];k.set(N,(k.get(N)??0)+M)}}l.set(u,(l.get(u)??0)+_);for(const[j,M]of k)l.set(j,(l.get(j)??0)-M)}return{balances:l,issues:d,totalMinor:m}}function bs(i,s,a){for(const n of s){if((n.currency||"").toUpperCase()!==a||!i.has(n.fromId)||!i.has(n.toId))continue;const r=Ee(n.amount,a);i.set(n.fromId,(i.get(n.fromId)??0)+r),i.set(n.toId,(i.get(n.toId)??0)-r)}}function ws(i,s,a){const n=new Map(s.map(t=>[t.id,t.name])),r=[...i.entries()].filter(([,t])=>t>0).map(([t,u])=>({id:t,v:u})).sort((t,u)=>u.v-t.v||Me(t.id,u.id)),l=[...i.entries()].filter(([,t])=>t<0).map(([t,u])=>({id:t,v:u})).sort((t,u)=>t.v-u.v||Me(t.id,u.id)),d=[];let m=0,h=0;for(;m<l.length&&h<r.length;){const t=Math.min(-l[m].v,r[h].v);t>0&&d.push({fromId:l[m].id,fromName:n.get(l[m].id)??l[m].id,toId:r[h].id,toName:n.get(r[h].id)??r[h].id,amount:ze(t,a),currency:a}),l[m].v+=t,r[h].v-=t,l[m].v===0&&(m+=1),r[h].v===0&&(h+=1)}return d}function ks(i,s,a=[]){const n=[],r=[],l=[...ys(i).entries()].sort(([d],[m])=>Me(d,m));for(const[d,m]of l){const h=_s(m,s,d);r.push(...h.issues),bs(h.balances,a,d),n.push({currency:d,total:ze(h.totalMinor,d),balances:s.map(t=>({participantId:t.id,participantName:t.name,amount:ze(h.balances.get(t.id)??0,d),currency:d})),transfers:ws(h.balances,s,d)})}return{groups:n,issues:r}}function Me(i,s){return i<s?-1:i>s?1:0}const Ss=o.forwardRef(function(s,a){const{items:n,participants:r,settlements:l=[],view:d,defaultView:m="expenses",onViewChange:h,onSettle:t,onItemDelete:u,onItemClick:p,onValidationChange:_,sortBy:g="date",locale:x,disabled:b=!1,readOnly:k=!1,size:j="md",className:M,style:c}=s,[N,v]=o.useState(m),T=d??N,S=b||k,R=o.useMemo(()=>r.map(z=>({id:z.id,name:z.name})),[r]),y=o.useMemo(()=>ks(n,R,l),[n,R,l]),E=o.useMemo(()=>g==="none"?n:n.map((z,A)=>({item:z,index:A})).sort((z,A)=>{if(g==="amount")return A.item.amount-z.item.amount||z.index-A.index;const P=z.item.incurredAt,q=A.item.incurredAt;return P&&q?P.localeCompare(q)||z.index-A.index:P?-1:q?1:z.index-A.index}).map(z=>z.item),[n,g]),X=y.issues.map(z=>`${z.itemId}:${z.reason}`).join("|");o.useEffect(()=>{_==null||_(y.issues)},[X]);const D=o.useMemo(()=>new Map(r.map(z=>[z.id,z.avatarUrl])),[r]),I=o.useMemo(()=>new Map(y.issues.map(z=>[z.itemId,z.reason])),[y.issues]),L=z=>{d===void 0&&v(z),h==null||h(z)};return n.length===0?e.jsx("div",{ref:a,className:`nice-expense-split ${M??""}`,style:c,children:e.jsx(me,{icon:e.jsx(B.NtdReceipt,{size:28}),title:"No expenses yet",description:"Add what people paid for and this will work out who owes whom."})}):e.jsxs("div",{ref:a,className:`nice-expense-split nice-expense-split--${j} ${M??""}`,style:c,children:[e.jsx(f.NiceSegmentedControl,{size:j,value:T,onChange:z=>L(z),options:[{value:"expenses",label:"Expenses"},{value:"balances",label:"Balances"},{value:"settlement",label:"Settle up"}]}),T==="expenses"&&e.jsx("ul",{className:"nice-expense-split__items",children:E.map(z=>{const A=I.get(z.id);return e.jsxs("li",{className:`nice-expense-split__item${A?" nice-expense-split__item--excluded":""}`,children:[e.jsxs("button",{type:"button",className:"nice-expense-split__item-main",onClick:()=>p==null?void 0:p(z),disabled:!p,children:[e.jsx("span",{className:"nice-expense-split__item-label",children:z.label}),e.jsxs("span",{className:"nice-expense-split__item-payer",children:[z.paidByName??z.paidById??"nobody"," paid"]})]}),e.jsx("span",{className:"nice-expense-split__item-amount",children:ee(z.amount,z.currency,x)}),z.isPaid&&e.jsx(f.NiceBadge,{size:"xs",subtle:!0,variant:"success",children:"paid"}),A&&e.jsx(f.NiceBadge,{size:"xs",subtle:!0,variant:"warning",children:A==="no-payer"?"no payer":"unknown payer"}),u&&!k&&e.jsx(f.NiceButton,{size:"sm",variant:"ghost",ariaLabel:`Delete ${z.label}`,disabled:b,onClick:()=>u(z.id),children:e.jsx(B.NtdTrash,{size:14})})]},z.id)})}),T==="balances"&&y.groups.map(z=>e.jsxs("section",{className:"nice-expense-split__group",children:[e.jsxs("h4",{className:"nice-expense-split__group-title",children:[z.currency,e.jsxs("span",{className:"nice-expense-split__group-total",children:[ee(z.total,z.currency,x)," total"]})]}),e.jsx("ul",{className:"nice-participant-list__rows",children:z.balances.map(A=>e.jsx($e,{participant:{id:A.participantId,name:A.participantName,avatarUrl:D.get(A.participantId)},showRole:!1,showStatus:!1,size:j,children:e.jsxs("span",{className:`nice-expense-split__balance nice-expense-split__balance--${A.amount>0?"owed":A.amount<0?"owes":"settled"}`,children:[A.amount===0?"settled up":ee(Math.abs(A.amount),A.currency,x),A.amount>0&&e.jsx("em",{children:" is owed"}),A.amount<0&&e.jsx("em",{children:" owes"})]})},A.participantId))})]},z.currency)),T==="settlement"&&(y.groups.every(z=>z.transfers.length===0)?e.jsx(me,{icon:e.jsx(B.NtdCoins,{size:28}),title:"All settled up",description:"Nobody owes anybody anything."}):y.groups.filter(z=>z.transfers.length>0).map(z=>e.jsxs("section",{className:"nice-expense-split__group",children:[e.jsxs("h4",{className:"nice-expense-split__group-title",children:[z.currency,e.jsxs("span",{className:"nice-expense-split__group-total",children:[z.transfers.length," transfer",z.transfers.length===1?"":"s"]})]}),e.jsx("ul",{className:"nice-expense-split__transfers",children:z.transfers.map(A=>e.jsxs("li",{className:"nice-expense-split__transfer",children:[e.jsx("span",{className:"nice-expense-split__transfer-from",children:A.fromName}),e.jsx(B.NtdArrowRight,{size:15}),e.jsx("span",{className:"nice-expense-split__transfer-to",children:A.toName}),e.jsx("span",{className:"nice-expense-split__transfer-amount",children:ee(A.amount,A.currency,x)}),t&&!k&&e.jsx(f.NiceButton,{size:"sm",variant:"outline",disabled:S,onClick:()=>t(A),children:"Mark paid"})]},`${A.fromId}-${A.toId}-${A.amount}`))})]},z.currency)))]})}),Is={upcoming:"⏳",active:"▶️",voting:"🗳️",scored:"📊",completed:"✅",skipped:"⏭️"},Cs={upcoming:"#9ca3af",active:"#22c55e",voting:"#eab308",scored:"#3b82f6",completed:"#6b7280",skipped:"#d1d5db"},zs=o.forwardRef(function(s,a){const{rounds:n,activeRoundId:r,onSelect:l,onStart:d,onEnd:m,onCreate:h,editable:t=!1,className:u,style:p}=s,_=[...n].sort((g,x)=>g.order-x.order);return e.jsxs("div",{ref:a,className:`nice-round-list ${u??""}`,style:p,children:[e.jsxs("div",{className:"nice-round-list__header",children:[e.jsxs("h3",{children:["Rounds (",n.length,")"]}),t&&h&&e.jsx("button",{onClick:h,children:"+ Add Round"})]}),_.length===0?e.jsx("p",{className:"nice-round-list__empty",children:"No rounds yet."}):e.jsx("div",{className:"nice-round-list__items",children:_.map(g=>{const x=g.id===r;return e.jsxs("div",{className:`nice-round-list__item ${x?"nice-round-list__item--active":""}`,onClick:()=>l==null?void 0:l(g),role:l?"button":void 0,tabIndex:l?0:void 0,children:[e.jsxs("span",{className:"nice-round-list__order",children:["#",g.order]}),e.jsx("span",{className:"nice-round-list__icon",children:Is[g.status]}),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:Cs[g.status]},children: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:["🏆 ",g.winnerIds.length]}),t&&e.jsxs("div",{className:"nice-round-list__actions",onClick:b=>b.stopPropagation(),children:[g.status==="upcoming"&&d&&e.jsx("button",{onClick:()=>d(g.id),children:"Start"}),(g.status==="active"||g.status==="voting")&&m&&e.jsx("button",{onClick:()=>m(g.id),children:"End"})]})]},g.id)})})]})}),Ms=o.forwardRef(function(s,a){const{round:n,timerRunning:r=!1,remainingSeconds:l,onSubmitScore:d,onStart:m,onEnd:h,onSkip:t,editable:u=!1,footerActions:p,className:_,style:g}=s,[x,b]=o.useState({}),k=o.useCallback(c=>{const N=parseFloat(x[c]??"");isNaN(N)||!d||(d(c,N),b(v=>({...v,[c]:""})))},[x,d]),j=c=>{const N=Math.floor(c/60),v=c%60;return`${N}:${v.toString().padStart(2,"0")}`},M=n.scores?[...n.scores].sort((c,N)=>N.score-c.score):[];return e.jsxs("div",{ref:a,className:`nice-round-card nice-round-card--${n.status} ${_??""}`,style:g,children:[e.jsxs("div",{className:"nice-round-card__header",children:[e.jsxs("span",{className:"nice-round-card__order",children:["Round #",n.order]}),e.jsx("h3",{className:"nice-round-card__name",children:n.name}),e.jsx("span",{className:"nice-round-card__status",children:n.status})]}),n.description&&e.jsx("p",{className:"nice-round-card__description",children:n.description}),(r||l!=null)&&e.jsxs("div",{className:`nice-round-card__timer ${r?"nice-round-card__timer--running":""}`,children:["⏱️ ",l!=null?j(l):"—"]}),M.length>0&&e.jsxs("div",{className:"nice-round-card__scoreboard",children:[e.jsx("h4",{children:"Scoreboard"}),e.jsxs("table",{className:"nice-round-card__scores-table",children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{children:"Rank"}),e.jsx("th",{children:"Participant"}),e.jsx("th",{children:"Score"})]})}),e.jsx("tbody",{children:M.map((c,N)=>e.jsxs("tr",{className:N<3?`nice-round-card__top-${N+1}`:"",children:[e.jsxs("td",{children:[c.rank??N+1,N===0?" 🥇":N===1?" 🥈":N===2?" 🥉":""]}),e.jsx("td",{children:c.participantName}),e.jsx("td",{children:c.score})]},c.participantId))})]})]}),d&&(n.status==="active"||n.status==="voting")&&M.length>0&&e.jsxs("div",{className:"nice-round-card__score-input",children:[e.jsx("h4",{children:"Submit Scores"}),M.map(c=>e.jsxs("div",{className:"nice-round-card__score-row",children:[e.jsx("span",{children:c.participantName}),e.jsx("input",{type:"number",value:x[c.participantId]??"",onChange:N=>b(v=>({...v,[c.participantId]:N.target.value})),min:0,step:1,placeholder:"Score"}),e.jsx("button",{onClick:()=>k(c.participantId),children:"Submit"})]},c.participantId))]}),e.jsxs("div",{className:"nice-round-card__footer",children:[u&&e.jsxs("div",{className:"nice-round-card__actions",children:[n.status==="upcoming"&&m&&e.jsx("button",{onClick:m,children:"▶ Start Round"}),(n.status==="active"||n.status==="voting")&&h&&e.jsx("button",{onClick:h,children:"⏹ End Round"}),n.status==="upcoming"&&t&&e.jsx("button",{onClick:t,children:"⏭ Skip"})]}),p]}),n.winnerIds&&n.winnerIds.length>0&&e.jsxs("div",{className:"nice-round-card__winners",children:["🏆 Winners: ",n.winnerIds.length]})]})}),Ts=o.forwardRef(function(s,a){const{songs:n,onAdd:r,onRemove:l,onVote:d,onSearch:m,showQueue:h=!0,readOnly:t=!1,className:u,style:p}=s,[_,g]=o.useState(""),x=o.useMemo(()=>{if(!_.trim())return n;const c=_.toLowerCase();return n.filter(N=>N.title.toLowerCase().includes(c)||N.artist.toLowerCase().includes(c))},[n,_]),b=o.useMemo(()=>n.filter(c=>c.isQueued),[n]),k=n.find(c=>c.isPlaying),j=c=>{g(c),m==null||m(c)},M=c=>{if(!c)return"";const N=Math.floor(c/60),v=c%60;return`${N}:${v.toString().padStart(2,"0")}`};return e.jsxs("div",{ref:a,className:`nice-song-picker ${u??""}`,style:p,children:[k&&e.jsxs("div",{className:"nice-song-picker__now-playing",children:[e.jsx("span",{className:"nice-song-picker__np-label",children:"🎵 Now Playing"}),k.albumArt&&e.jsx("img",{src:k.albumArt,alt:"",className:"nice-song-picker__album-art"}),e.jsx("strong",{children:k.title}),e.jsx("span",{children:k.artist})]}),e.jsx("input",{type:"text",value:_,onChange:c=>j(c.target.value),placeholder:"Search songs…",className:"nice-song-picker__search"}),e.jsx("div",{className:"nice-song-picker__list",children:x.length===0?e.jsx("p",{className:"nice-song-picker__empty",children:"No songs found."}):x.map(c=>e.jsxs("div",{className:`nice-song-picker__item ${c.isPlaying?"nice-song-picker__item--playing":""}`,children:[c.albumArt&&e.jsx("img",{src:c.albumArt,alt:"",className:"nice-song-picker__thumb"}),e.jsxs("div",{className:"nice-song-picker__info",children:[e.jsx("strong",{children:c.title}),e.jsx("span",{children:c.artist}),c.duration&&e.jsx("span",{className:"nice-song-picker__duration",children:M(c.duration)}),c.addedByName&&e.jsxs("small",{children:["Added by ",c.addedByName]})]}),!t&&e.jsxs("div",{className:"nice-song-picker__actions",children:[d&&e.jsxs("button",{onClick:()=>d(c.id),children:["👍 ",c.votes??0]}),r&&!c.isQueued&&e.jsx("button",{onClick:()=>r(c.id),children:"+ Queue"}),l&&c.isQueued&&e.jsx("button",{onClick:()=>l(c.id),children:"Remove"})]})]},c.id))}),h&&b.length>0&&e.jsxs("div",{className:"nice-song-picker__queue",children:[e.jsxs("h4",{children:["Queue (",b.length,")"]}),b.map((c,N)=>e.jsxs("div",{className:"nice-song-picker__queue-item",children:[e.jsxs("span",{className:"nice-song-picker__queue-pos",children:[N+1,"."]}),e.jsxs("span",{children:[c.title," — ",c.artist]})]},c.id))]})]})}),As=o.forwardRef(function(s,a){const{songs:n,queue:r=[],onEnqueue:l,onDequeue:d,onNext:m,nowPlayingId:h,readOnly:t=!1,className:u,style:p}=s,[_,g]=o.useState(""),[x,b]=o.useState(""),k=n.find(v=>v.id===h),j=o.useMemo(()=>{let v=n;if(_.trim()){const T=_.toLowerCase();v=v.filter(S=>S.title.toLowerCase().includes(T)||S.artist.toLowerCase().includes(T))}return x&&(v=v.filter(T=>T.difficulty===x)),v},[n,_,x]),M=o.useMemo(()=>new Set(r.map(v=>v.id)),[r]),c=["easy","medium","hard","expert"],N=v=>{switch(v){case"easy":return"#4caf50";case"medium":return"#ff9800";case"hard":return"#f44336";case"expert":return"#9c27b0";default:return"#999"}};return e.jsxs("div",{ref:a,className:`nice-karaoke-picker ${u??""}`,style:p,children:[k&&e.jsxs("div",{className:"nice-karaoke-picker__now-singing",style:{borderLeft:"4px solid #e91e63",padding:"12px",marginBottom:12,background:"#fce4ec"},children:[e.jsx("span",{style:{fontWeight:600},children:"🎤 Now Singing"}),e.jsxs("div",{children:[e.jsx("strong",{children:k.title})," — ",k.artist,k.performerName&&e.jsxs("span",{children:[" (by ",k.performerName,")"]})]}),!t&&m&&e.jsx("button",{onClick:m,style:{marginTop:8},children:"Skip / Next ⏭"})]}),e.jsxs("div",{className:"nice-karaoke-picker__filters",style:{display:"flex",gap:8,marginBottom:12},children:[e.jsx("input",{type:"text",value:_,onChange:v=>g(v.target.value),placeholder:"Search songs or artists…",style:{flex:1}}),e.jsxs("select",{value:x,onChange:v=>b(v.target.value),children:[e.jsx("option",{value:"",children:"All Difficulties"}),c.map(v=>e.jsx("option",{value:v,children:v},v))]})]}),e.jsx("div",{className:"nice-karaoke-picker__catalog",children:j.length===0?e.jsx("p",{children:"No songs match your search."}):j.map(v=>e.jsxs("div",{className:"nice-karaoke-picker__song",style:{display:"flex",justifyContent:"space-between",alignItems:"center",padding:"8px 0",borderBottom:"1px solid #eee"},children:[e.jsxs("div",{children:[e.jsx("strong",{children:v.title})," — ",v.artist,v.difficulty&&e.jsxs("span",{style:{marginLeft:8,fontSize:12,color:N(v.difficulty),fontWeight:600},children:["[",v.difficulty,"]"]}),v.hasLyrics&&e.jsx("span",{style:{marginLeft:6,fontSize:12},title:"Lyrics available",children:"📝"}),v.language&&e.jsxs("span",{style:{marginLeft:6,fontSize:12,color:"#666"},children:["(",v.language,")"]})]}),!t&&e.jsx("div",{children:M.has(v.id)?e.jsx("button",{onClick:()=>d==null?void 0:d(v.id),style:{color:"#f44336"},children:"Remove"}):e.jsx("button",{onClick:()=>l==null?void 0:l(v.id),children:"🎤 Sing"})})]},v.id))}),r.length>0&&e.jsxs("div",{className:"nice-karaoke-picker__queue",style:{marginTop:16},children:[e.jsxs("h4",{children:["🎶 Queue (",r.length,")"]}),r.map((v,T)=>e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",padding:"4px 0"},children:[e.jsxs("span",{children:[e.jsxs("strong",{children:[T+1,"."]})," ",v.title," — ",v.artist,v.performerName&&e.jsxs("em",{children:[" (",v.performerName,")"]})]}),!t&&d&&e.jsx("button",{onClick:()=>d(v.id),style:{fontSize:12},children:"✕"})]},v.id))]})]})}),Ze={game:B.NtdGamepad,music:B.NtdMusic,dance:B.NtdMusic,quiz:B.NtdHelp,karaoke:B.NtdMicrophone,photo:B.NtdCamera,custom:B.NtdSparkle},$s={game:"Games",music:"Music",dance:"Dance",quiz:"Quiz",karaoke:"Karaoke",photo:"Photo",custom:"Custom"},Ps=o.forwardRef(function(s,a){const{attractions:n,onSelect:r,onDeselect:l,onVote:d,selectedIds:m=[],maxSelections:h,showVotes:t=!0,readOnly:u=!1,layout:p="grid",className:_,style:g}=s,[x,b]=o.useState(""),[k,j]=o.useState(""),M=o.useMemo(()=>new Set(m),[m]),c=o.useMemo(()=>{const S=new Set(n.map(R=>R.category));return Array.from(S)},[n]),N=o.useMemo(()=>{let S=n;if(x&&(S=S.filter(R=>R.category===x)),k.trim()){const R=k.toLowerCase();S=S.filter(y=>{var E;return y.name.toLowerCase().includes(R)||((E=y.description)==null?void 0:E.toLowerCase().includes(R))})}return S},[n,x,k]),v=!h||M.size<h,T=S=>{u||(M.has(S)?l==null||l(S):v&&(r==null||r(S)))};return e.jsxs("div",{ref:a,className:`nice-attraction-picker ${_??""}`,style:{color:"var(--nice-text-primary)",...g},children:[e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:12},children:[e.jsx("h3",{style:{margin:0},children:"Attractions"}),h&&e.jsxs("span",{style:{color:"var(--nice-text-secondary, #64748b)",fontSize:14},children:[M.size,"/",h," selected"]})]}),e.jsxs("div",{style:{display:"flex",gap:8,marginBottom:12,flexWrap:"wrap"},children:[e.jsx("input",{type:"text",value:k,onChange:S=>j(S.target.value),placeholder:"Search attractions…",style:{flex:1,minWidth:150}}),e.jsx("button",{onClick:()=>b(""),style:{fontWeight:x?400:700},children:"All"}),c.map(S=>e.jsxs("button",{onClick:()=>b(S===x?"":S),style:{fontWeight:S===x?700:400,display:"inline-flex",alignItems:"center",gap:4},children:[o.createElement(Ze[S],{size:14})," ",$s[S]]},S))]}),e.jsx("div",{style:{display:p==="grid"?"grid":"flex",gridTemplateColumns:p==="grid"?"repeat(auto-fill, minmax(200px, 1fr))":void 0,gap:12,flexDirection:p==="list"?"column":void 0},children:N.length===0?e.jsx("p",{children:"No attractions found."}):N.map(S=>{const R=M.has(S.id);return e.jsxs("div",{className:"nice-attraction-picker__card",style:{border:R?"2px solid var(--nice-color-primary, #6366f1)":"1px solid var(--nice-border-color, #cbd5e1)",borderRadius:8,padding:12,cursor:u?"default":"pointer",background:R?"color-mix(in srgb, var(--nice-color-primary) 12%, transparent)":"var(--nice-bg-elevated, var(--nice-bg-primary))",transition:"all 0.2s"},onClick:()=>T(S.id),children:[S.imageUrl&&e.jsx("img",{src:S.imageUrl,alt:S.name,style:{width:"100%",borderRadius:6,marginBottom:8,objectFit:"cover",maxHeight:120}}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6},children:[e.jsx("span",{style:{display:"inline-flex"},children:o.createElement(Ze[S.category],{size:16})}),e.jsx("strong",{children:S.name})]}),S.description&&e.jsx("p",{style:{fontSize:13,color:"var(--nice-text-secondary, #64748b)",margin:"6px 0"},children:S.description}),e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginTop:8},children:[t&&e.jsxs("span",{style:{fontSize:13,display:"inline-flex",alignItems:"center",gap:4},children:[e.jsx(B.NtdThumbsUp,{size:14})," ",S.votes??0]}),!u&&d&&e.jsx("button",{onClick:y=>{y.stopPropagation(),d(S.id)},style:{fontSize:12},children:"Vote"})]})]},S.id)})})]})}),Bs={game:B.NtdGamepad,music:B.NtdMusic,dance:B.NtdMusic,quiz:B.NtdHelp,karaoke:B.NtdMicrophone,photo:B.NtdCamera,custom:B.NtdSparkle},Rs=o.forwardRef(function(s,a){const{attractions:n,onVote:r,onUnvote:l,votedIds:d=[],maxVotes:m,closed:h=!1,sortBy:t="votes",showResults:u=!0,className:p,style:_}=s,g=o.useMemo(()=>new Set(d),[d]),x=m?m-g.size:void 0,b=o.useMemo(()=>{const c=[...n];switch(t){case"votes":c.sort((N,v)=>(v.votes??0)-(N.votes??0));break;case"name":c.sort((N,v)=>N.name.localeCompare(v.name));break;case"category":c.sort((N,v)=>N.category.localeCompare(v.category));break}return c},[n,t]),k=o.useMemo(()=>Math.max(...n.map(c=>c.votes??0),1),[n]),j=c=>{h||(g.has(c)?l==null||l(c):(!x||x>0)&&(r==null||r(c)))},M=c=>{switch(c){case 0:return e.jsx(B.NtdTrophy,{size:18,primaryColor:"#f59e0b",title:"1st place"});case 1:return e.jsx(B.NtdMedal,{size:18,primaryColor:"#94a3b8",title:"2nd place"});case 2:return e.jsx(B.NtdMedal,{size:18,primaryColor:"#b45309",title:"3rd place"});default:return`${c+1}.`}};return e.jsxs("div",{ref:a,className:`nice-attraction-voting ${p??""}`,style:{color:"var(--nice-text-primary)",..._},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(B.NtdClipboardCheck,{size:20}),h?"Voting Results":"Vote for Attractions"]}),!h&&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"]})]}),h&&e.jsx("p",{style:{color:"var(--nice-text-secondary, #64748b)",marginBottom:12},children:"Voting is closed. Final results:"}),e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:8},children:b.map((c,N)=>{const v=g.has(c.id),T=c.votes??0,S=u?`${Math.round(T/k*100)}%`:"0%";return e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12,padding:"10px 14px",borderRadius:8,border:v?"2px solid var(--nice-color-primary, #6366f1)":"1px solid var(--nice-border-color, #cbd5e1)",background:v?"color-mix(in srgb, var(--nice-color-primary) 12%, transparent)":"var(--nice-bg-elevated, var(--nice-bg-primary))",cursor:h?"default":"pointer",transition:"all 0.2s"},onClick:()=>j(c.id),children:[u&&e.jsx("span",{style:{fontSize:18,minWidth:32,textAlign:"center"},children:M(N)}),e.jsx("span",{style:{display:"inline-flex",fontSize:20},children:o.createElement(Bs[c.category],{size:20})}),e.jsxs("div",{style:{flex:1,minWidth:0},children:[e.jsx("div",{style:{fontWeight:600},children:c.name}),c.description&&e.jsx("div",{style:{fontSize:13,color:"var(--nice-text-secondary, #64748b)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:c.description}),u&&e.jsx("div",{style:{marginTop:4,height:6,borderRadius:3,background:"var(--nice-bg-tertiary, #e2e8f0)",overflow:"hidden"},children:e.jsx("div",{style:{height:"100%",width:S,background:"var(--nice-color-primary, #6366f1)",borderRadius:3,transition:"width 0.3s"}})})]}),u&&e.jsx("span",{style:{fontWeight:600,fontSize:16,minWidth:40,textAlign:"right"},children:T}),!h&&e.jsx("button",{onClick:R=>{R.stopPropagation(),j(c.id)},style:{padding:"4px 12px",borderRadius:4,border:"none",background:v?"var(--nice-color-error, #ef4444)":"var(--nice-color-primary, #6366f1)",color:"#fff",cursor:"pointer",fontSize:13},children:v?"Unvote":"Vote"})]},c.id)})}),u&&e.jsxs("div",{style:{marginTop:12,textAlign:"right",fontSize:13,color:"var(--nice-text-secondary, #64748b)"},children:["Total votes: ",n.reduce((c,N)=>c+(N.votes??0),0)]})]})});exports.NiceAttractionPicker=Ps;exports.NiceAttractionVoting=Rs;exports.NiceEventMedia=Pn;exports.NiceEventPlanning=En;exports.NiceExpenseSplit=Ss;exports.NiceGiftRegistry=js;exports.NiceInvitationDesigner=fs;exports.NiceKaraokePicker=As;exports.NiceMediaCollage=Bn;exports.NiceParticipantList=Xn;exports.NiceRoundCard=Ms;exports.NiceRoundList=zs;exports.NiceRsvpControl=Pe;exports.NiceSeatPicker=ds;exports.NiceSeatingChart=tn;exports.NiceSongPicker=Ts;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),M=require("@nice2dev/icons"),v=require("@nice2dev/ui"),o=require("react"),Z=require("@nice2dev/ui-core");function $n(i){return i.map((s,c)=>({item:s,index:c,key:s.order??c})).sort((s,c)=>s.key-c.key||s.index-c.index).map(s=>s.item)}function Ve(i,s,c){if(s===c)return[...i];if(s<0||s>=i.length)return[...i];if(c<0||c>=i.length)return[...i];const n=[...i],[r]=n.splice(s,1);return n.splice(c,0,r),n}function Je(i){const{items:s,onReorder:c,disabled:n=!1}=i,[r,l]=o.useState(null),[d,m]=o.useState(null),[h,t]=o.useState(!1),u=o.useRef(null),p=o.useCallback(b=>s.findIndex(k=>k.id===b),[s]),_=o.useCallback((b,k)=>{const j=p(b),T=p(k);j<0||T<0||j===T||c==null||c(Ve([...s],j,T).map(a=>a.id))},[s,p,c]),g=o.useCallback(()=>{l(null),m(null),t(!1),u.current=null},[]),x=o.useCallback((b,k)=>({role:"button",draggable:!1,tabIndex:n?-1:0,"aria-grabbed":r===b,onPointerDown:j=>{var N,f;if(n||j.button!==0&&j.pointerType==="mouse")return;(f=(N=j.currentTarget).setPointerCapture)==null||f.call(N,j.pointerId),l(b),t(!0),u.current=s.map($=>$.id);const T=()=>{window.removeEventListener("pointerup",T),window.removeEventListener("pointercancel",a),t(!1),l(null),m(null)},a=()=>{window.removeEventListener("pointerup",T),window.removeEventListener("pointercancel",a),u.current&&(c==null||c(u.current)),g()};window.addEventListener("pointerup",T),window.addEventListener("pointercancel",a)},onPointerEnter:()=>{n||!r||r===b||(m(b),_(r,b))},onKeyDown:j=>{if(n)return;if(j.key===" "||j.key==="Enter"){j.preventDefault(),r===b?g():(l(b),u.current=s.map($=>$.id));return}if(j.key==="Escape"&&r===b){j.preventDefault(),u.current&&(c==null||c(u.current)),g();return}if(r!==b)return;const a=j.key==="ArrowLeft"||j.key==="ArrowUp"?-1:j.key==="ArrowRight"||j.key==="ArrowDown"?1:0;if(a===0)return;j.preventDefault();const N=p(b),f=N+a;f<0||f>=s.length||c==null||c(Ve([...s],N,f).map($=>$.id))},...k?{"aria-label":k}:{}}),[r,_,n,g,p,s,c]);return{activeId:r,overId:d,getHandleProps:x,dragging:h}}const An=({item:i})=>{const[s,c]=o.useState(!1),n=i.thumbnailUrl??i.url;return i.type==="video"?e.jsx("div",{className:"nice-event-media__video-thumb",children:e.jsx(M.NtdPlay,{size:26})}):s||!n?e.jsx("div",{className:"nice-event-media__broken",title:"Image unavailable",children:e.jsx(M.NtdImage,{size:24})}):e.jsx("img",{src:n,alt:i.caption??"",className:"nice-event-media__thumb",loading:"lazy",onError:()=>c(!0)})},Pn=o.forwardRef(function(s,c){const{items:n,onUpload:r,onDelete:l,onLike:d,onItemClick:m,layout:h="grid",uploadEnabled:t=!0,typeFilter:u="all",onReorder:p,className:_,style:g}=s,[x,b]=o.useState(""),k=o.useMemo(()=>$n(n),[n]),j=o.useMemo(()=>u==="all"?k:k.filter($=>$.type===u),[k,u]),T=!!p&&u==="all",a=Je({items:k,onReorder:p,disabled:!T}),N=$=>{const S=$[0];!S||!r||(r(S,x.trim()||void 0),b(""))},f=h==="list";return e.jsxs("div",{ref:c,className:`nice-event-media nice-event-media--${h} ${_??""}`,style:g,children:[e.jsx("div",{className:"nice-event-media__header",children:e.jsxs("h3",{children:["Media (",j.length,")"]})}),t&&r&&e.jsxs("div",{className:"nice-event-media__upload",children:[e.jsx(v.NiceUpload,{accept:"image/*,video/*",multiple:!1,imagePreview:!1,onFilesSelected:N}),e.jsx(v.NiceTextInput,{value:x,onChange:b,placeholder:"Add a caption…"})]}),j.length===0?e.jsx("p",{className:"nice-event-media__empty",children:"No media yet."}):e.jsx(v.NiceCardGroup,{columns:f?1:void 0,minColumnWidth:200,gap:12,align:"stretch",children:j.map(($,S)=>{const R=T?a.getHandleProps($.id,`Move ${$.caption??`item ${S+1}`}`):null;return e.jsxs("div",{className:`nice-event-media__card${f?" nice-event-media__card--row":""}${a.activeId===$.id?" nice-event-media__card--dragging":""}`,onClick:()=>m==null?void 0:m($),onPointerEnter:R==null?void 0:R.onPointerEnter,role:m?"button":void 0,tabIndex:m?0:void 0,children:[R&&e.jsx("span",{className:"nice-event-media__grip",role:R.role,tabIndex:R.tabIndex,"aria-grabbed":R["aria-grabbed"],"aria-label":R["aria-label"],draggable:R.draggable,onPointerDown:R.onPointerDown,onKeyDown:R.onKeyDown,onClick:y=>y.stopPropagation(),children:e.jsx(M.NtdMove,{size:14})}),e.jsx(An,{item:$}),e.jsxs("div",{className:"nice-event-media__body",children:[$.caption&&e.jsx("span",{className:"nice-event-media__caption",children:$.caption}),$.uploadedByName&&e.jsx("span",{className:"nice-event-media__uploader",children:$.uploadedByName}),e.jsxs("div",{className:"nice-event-media__actions",children:[d&&e.jsxs("button",{type:"button",className:"nice-event-media__action",onClick:y=>{y.stopPropagation(),d($.id)},"aria-label":"Like",children:[e.jsx(M.NtdHeart,{size:15})," ",$.likes??0]}),l&&e.jsx("button",{type:"button",className:"nice-event-media__action nice-event-media__action--danger",onClick:y=>{y.stopPropagation(),l($.id)},"aria-label":"Delete",children:e.jsx(M.NtdTrash,{size:15})})]})]})]},$.id)})})]})}),me=({title:i,description:s,icon:c,action:n,className:r})=>e.jsx(v.NiceEmpty,{size:"sm",title:i,description:s,icon:c,action:n,className:r}),Bn=o.forwardRef(function(s,c){const{items:n,layout:r="grid",onReorder:l,onItemAdd:d,onItemRemove:m,onCaptionChange:h,onItemClick:t,previewMode:u=!1,transition:p="fade",defaultDurationMs:_=3e3,autoPlay:g=!0,disabled:x=!1,readOnly:b=!1,size:k="md",className:j,style:T}=s,[a,N]=o.useState(0),[f,$]=o.useState(null),[S,R]=o.useState(""),y=x||b,E=!!l&&!y,F=Je({items:n,onReorder:l,disabled:!E}),D=n.length>0?Math.min(a,n.length-1):0,C=n[D],L=(C==null?void 0:C.durationMs)??_;o.useEffect(()=>{if(!u||!g||n.length<2)return;const B=window.setTimeout(()=>N(q=>(q+1)%n.length),Math.max(250,L));return()=>window.clearTimeout(B)},[u,g,n.length,D,L]);const z=o.useMemo(()=>n.reduce((B,q)=>B+(q.durationMs??_),0),[n,_]),A=B=>{h==null||h(B,S),$(null),R("")};return n.length===0?e.jsx("div",{ref:c,className:`nice-media-collage ${j??""}`,style:T,children:e.jsx(me,{icon:e.jsx(M.NtdImage,{size:28}),title:"Nothing in the collage yet",description:"Add photos or video to start arranging them.",action:d&&!y?e.jsx(v.NiceUpload,{accept:"image/*,video/*",multiple:!0,onFilesSelected:d}):void 0})}):u?e.jsxs("div",{ref:c,className:`nice-media-collage nice-media-collage--preview nice-media-collage--${p} ${j??""}`,style:T,children:[e.jsxs("div",{className:"nice-media-collage__stage","aria-live":"polite",children:[(C==null?void 0:C.type)==="video"?e.jsx("video",{className:"nice-media-collage__slide",src:C.mediaUrl,controls:!0},C.id):e.jsx("img",{className:"nice-media-collage__slide",src:C==null?void 0:C.mediaUrl,alt:(C==null?void 0:C.caption)??""},C==null?void 0:C.id),(C==null?void 0:C.caption)&&e.jsx("p",{className:"nice-media-collage__slide-caption",children:C.caption})]}),e.jsxs("div",{className:"nice-media-collage__playbar",children:[e.jsx(v.NiceButton,{size:"sm",variant:"ghost",onClick:()=>N(B=>(B-1+n.length)%n.length),children:"Previous"}),e.jsxs("span",{className:"nice-media-collage__counter",children:[D+1," / ",n.length]}),e.jsx(v.NiceButton,{size:"sm",variant:"ghost",onClick:()=>N(B=>(B+1)%n.length),children:"Next"})]})]}):e.jsxs("div",{ref:c,className:`nice-media-collage nice-media-collage--${r} nice-media-collage--${k} ${j??""}`,style:T,children:[e.jsxs("div",{className:"nice-media-collage__toolbar",children:[e.jsx(v.NiceSegmentedControl,{size:"sm",value:r,readOnly:!0,options:[{value:"sequence",label:"Sequence"},{value:"grid",label:"Grid"},{value:"mosaic",label:"Mosaic"}]}),e.jsxs("span",{className:"nice-media-collage__duration",children:[n.length," item",n.length===1?"":"s"," · ",Math.round(z/1e3),"s"]}),d&&!y&&e.jsx(v.NiceUpload,{accept:"image/*,video/*",multiple:!0,imagePreview:!1,onFilesSelected:d})]}),e.jsx("ol",{className:"nice-media-collage__tiles","aria-label":"Collage order","aria-busy":F.dragging,children:n.map((B,q)=>{const X=E?F.getHandleProps(B.id,`Move ${B.caption??`item ${q+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:X==null?void 0:X.onPointerEnter,children:[e.jsx("span",{className:"nice-media-collage__index","aria-hidden":"true",children:q+1}),e.jsx("button",{type:"button",className:"nice-media-collage__thumb-button",onClick:()=>t==null?void 0:t(B),disabled:!t,children:B.type==="video"?e.jsx("span",{className:"nice-media-collage__video-thumb",children:e.jsx(M.NtdPlay,{size:22})}):e.jsx("img",{className:"nice-media-collage__thumb",src:B.mediaUrl,alt:B.caption??"",loading:"lazy"})}),f===B.id?e.jsx(v.NiceTextInput,{value:S,onChange:R,placeholder:"Caption",autoFocus:!0,size:"sm",onBlur:()=>A(B.id),onKeyDown:I=>{I.key==="Enter"&&A(B.id),I.key==="Escape"&&$(null)}}):e.jsx("button",{type:"button",className:"nice-media-collage__caption",disabled:!h||y,onClick:()=>{$(B.id),R(B.caption??"")},children:B.caption||e.jsx("em",{children:"Add a caption"})}),e.jsxs("div",{className:"nice-media-collage__tile-actions",children:[X&&e.jsx("span",{className:"nice-media-collage__grip",role:X.role,tabIndex:X.tabIndex,"aria-grabbed":X["aria-grabbed"],"aria-label":X["aria-label"],draggable:X.draggable,onPointerDown:X.onPointerDown,onKeyDown:X.onKeyDown,children:e.jsx(M.NtdMove,{size:14})}),m&&!b&&e.jsx(v.NiceButton,{size:"sm",variant:"ghost",ariaLabel:`Remove ${B.caption??`item ${q+1}`}`,disabled:x,onClick:()=>m(B.id),children:e.jsx(M.NtdTrash,{size:14})})]})]},B.id)})}),d&&!y&&n.length>0&&e.jsxs("p",{className:"nice-media-collage__hint",children:[e.jsx(M.NtdPlus,{size:12})," Drag a tile, or focus one and press Space then the arrow keys."]})]})});function Ce(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 Rn={micro:[],compact:["details","location","budget"],normal:["details","location","schedule","participants","tasks","surveys","budget"],full:["details","location","schedule","participants","tasks","surveys","vendors","budget","documents","settings"]},En=o.forwardRef(function(s,c){var Le,Oe,Ue,Ye,Fe,Xe;const{event:n,participants:r=[],surveys:l=[],billing:d=[],scheduleItems:m=[],tasks:h=[],vendors:t=[],documents:u=[],displayMode:p="normal",tabs:_,activeTab:g,onTabChange:x,tabsIconOnly:b=!0,tabsCentered:k="auto",countLocation:j="bottom",showDetails:T=!0,showLocation:a=!0,showSchedule:N=!0,showParticipants:f=!0,showTasks:$=!0,showSurveys:S=!0,showVendors:R=!0,showBudget:y=!0,showDocuments:E=!0,showSettings:F=!0,editable:D=!1,onSave:C,onPublish:L,onShare:z,onExport:A,onUpdateEvent:B,onUpdateLocation:q,onAddSurvey:X,onSurveyRespond:I,onAddBilling:Y,className:V,style:K}=s,[O,Q]=o.useState(n.title),[G,he]=o.useState(n.description??""),[se,re]=o.useState(n.startDate??""),[pe,ke]=o.useState(n.endDate??""),[xe,le]=o.useState(((Le=n.location)==null?void 0:Le.name)??""),[ge,Te]=o.useState(((Oe=n.location)==null?void 0:Oe.address)??""),[oe,ie]=o.useState(((Ue=n.location)==null?void 0:Ue.virtualUrl)??""),[ne,Ne]=o.useState(((Ye=n.location)==null?void 0:Ye.isVirtual)??!1),[de,je]=o.useState(""),[ue,$e]=o.useState("single"),[ye,_e]=o.useState(""),[ae,be]=o.useState(""),[fe,P]=o.useState(""),[U,W]=o.useState("PLN"),H={details:T,location:a,schedule:N,participants:f,tasks:$,surveys:S,vendors:R,budget:y,documents:E,settings:F},ce=(_??Rn[p]).filter(w=>H[w]!==!1),[Se,cn]=o.useState(ce[0]??"details"),rn=g??Se,ln=o.useCallback(w=>{const te=w;g===void 0&&cn(te),x==null||x(te)},[g,x]),on=o.useCallback(()=>{B==null||B({title:O,description:G||void 0,startDate:se||void 0,endDate:pe||void 0})},[O,G,se,pe,B]),dn=o.useCallback(()=>{q==null||q({name:xe,address:ge||void 0,virtualUrl:oe||void 0,isVirtual:ne})},[xe,ge,oe,ne,q]),un=o.useCallback(()=>{if(!de.trim()||!X)return;const w=ye.split(",").map(te=>te.trim()).filter(Boolean);X(de.trim(),ue,w.length>0?w:void 0),je(""),_e("")},[de,ue,ye,X]),mn=o.useCallback(()=>{!ae.trim()||!Y||(Y({label:ae.trim(),amount:parseFloat(fe)||0,currency:U}),be(""),P(""))},[ae,fe,U,Y]),hn=o.useMemo(()=>d.map(w=>({label:w.label,amount:w.amount})),[d]),pn=o.useMemo(()=>d.reduce((w,te)=>w+te.amount,0),[d]),xn=((Fe=d[0])==null?void 0:Fe.currency)??"PLN",gn=e.jsxs("div",{className:"nice-event-planning__form",children:[e.jsx(v.NiceTextInput,{label:"Title",value:O,onChange:Q,readOnly:!D}),e.jsx(v.NiceTextArea,{label:"Description",value:G,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:"Start"}),e.jsx("input",{className:"nice-input",type:"datetime-local",value:se,onChange:w=>re(w.target.value),readOnly:!D})]}),e.jsxs("label",{className:"nice-field",children:[e.jsx("span",{className:"nice-field__label",children:"End"}),e.jsx("input",{className:"nice-input",type:"datetime-local",value:pe,onChange:w=>ke(w.target.value),readOnly:!D})]})]}),D&&e.jsx(v.NiceButton,{variant:"primary",leftIcon:e.jsx(Z.NiceIcon,{name:"check",size:"sm"}),onClick:on,children:"Save details"})]}),fn=e.jsxs("div",{className:"nice-event-planning__form",children:[e.jsx(v.NiceToggle,{label:"Virtual event",checked:ne,onChange:Ne,disabled:!D}),e.jsx(v.NiceTextInput,{label:"Venue name",value:xe,onChange:le,readOnly:!D}),ne?e.jsx(v.NiceTextInput,{label:"Virtual URL",value:oe,onChange:ie,readOnly:!D}):e.jsx(v.NiceTextInput,{label:"Address",value:ge,onChange:Te,readOnly:!D}),D&&e.jsx(v.NiceButton,{variant:"primary",leftIcon:e.jsx(Z.NiceIcon,{name:"check",size:"sm"}),onClick:dn,children:"Save location"})]}),vn=e.jsx("div",{className:"nice-event-planning__participants",children:r.length===0?e.jsx("p",{className:"nice-event-planning__empty",children:"No participants yet."}):e.jsxs(e.Fragment,{children:[e.jsx(v.NiceAvatarGroup,{max:8,children:r.map(w=>e.jsx(v.NiceAvatar,{name:w.name,src:w.avatarUrl},w.id))}),e.jsx("ul",{className:"nice-event-planning__participant-list",children:r.map(w=>e.jsxs("li",{className:"nice-event-planning__participant",children:[e.jsx(v.NiceAvatar,{name:w.name,src:w.avatarUrl,size:"sm"}),e.jsx("span",{className:"nice-event-planning__participant-name",children:w.name}),e.jsx(v.NiceBadge,{size:"xs",subtle:!0,variant:Ce(w.status),children:w.status})]},w.id))})]})}),Nn=e.jsxs("div",{className:"nice-event-planning__form",children:[l.length===0?e.jsx("p",{className:"nice-event-planning__empty",children:"No surveys yet."}):l.map(w=>e.jsxs("div",{className:"nice-event-planning__survey",children:[e.jsx("strong",{children:w.question})," ",e.jsx(v.NiceBadge,{size:"xs",outline:!0,variant:"info",children:w.type}),w.options&&e.jsx("div",{className:"nice-event-planning__survey-options",children:w.options.map((te,Tn)=>e.jsx(v.NiceButton,{size:"sm",variant:"outline",onClick:()=>I==null?void 0:I(w.id,te),children:te},Tn))}),w.responses&&e.jsxs("span",{className:"nice-event-planning__muted",children:[w.responses.length," responses"]})]},w.id)),D&&X&&e.jsxs("div",{className:"nice-event-planning__form",children:[e.jsx(v.NiceTextInput,{label:"New survey question",value:de,onChange:je,placeholder:"Question"}),e.jsx(v.NiceSelect,{label:"Type",value:ue,onChange:w=>$e(w),options:[{value:"single",label:"Single choice"},{value:"multiple",label:"Multiple choice"},{value:"text",label:"Free text"},{value:"rating",label:"Rating"}]}),e.jsx(v.NiceTextInput,{label:"Options (comma-separated)",value:ye,onChange:_e,placeholder:"Yes, No, Maybe"}),e.jsx(v.NiceButton,{variant:"primary",leftIcon:e.jsx(Z.NiceIcon,{name:"plus",size:"sm"}),onClick:un,disabled:!de.trim(),children:"Add survey"})]})]}),jn=e.jsxs("div",{className:"nice-event-planning__form",children:[d.length===0?e.jsx("p",{className:"nice-event-planning__empty",children:"No billing items yet."}):e.jsx(v.NiceAmountBreakdown,{lines:[...hn,{label:"Total",amount:pn,isSummary:!0}],currency:xn}),D&&Y&&e.jsxs("div",{className:"nice-event-planning__row",children:[e.jsx(v.NiceTextInput,{label:"Item",value:ae,onChange:be,placeholder:"Catering"}),e.jsx(v.NiceTextInput,{label:"Amount",value:fe,onChange:P,placeholder:"0.00"}),e.jsx(v.NiceSelect,{label:"Currency",value:U,onChange:w=>W(w),options:["PLN","EUR","USD","GBP"]}),e.jsx(v.NiceButton,{variant:"primary",leftIcon:e.jsx(Z.NiceIcon,{name:"plus",size:"sm"}),onClick:mn,disabled:!ae.trim(),children:"Add"})]})]}),yn=e.jsxs("div",{className:"nice-event-planning__form",children:[e.jsx(v.NiceToggle,{label:"Public event",checked:n.isPublic??!1,disabled:!D}),e.jsx(v.NiceTextInput,{label:"Max participants",value:n.maxParticipants!=null?String(n.maxParticipants):"",onChange:()=>{},readOnly:!D}),e.jsxs("div",{className:"nice-event-planning__muted",children:["Host: ",n.hostName," · Created ",new Date(n.createdAt).toLocaleDateString()]})]}),_n=e.jsx("div",{className:"nice-event-planning__list",children:m.length===0?e.jsx("p",{className:"nice-event-planning__empty",children:"No agenda items yet."}):e.jsx("ul",{className:"nice-event-planning__schedule",children:m.map(w=>e.jsxs("li",{className:"nice-event-planning__schedule-item",children:[e.jsxs("span",{className:"nice-event-planning__schedule-time",children:[e.jsx(Z.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))})}),bn=e.jsx("div",{className:"nice-event-planning__list",children:h.length===0?e.jsx("p",{className:"nice-event-planning__empty",children:"No tasks yet."}):e.jsx("ul",{className:"nice-event-planning__tasks",children:h.map(w=>e.jsxs("li",{className:"nice-event-planning__task",children:[e.jsx(v.NiceToggle,{label:w.title,checked:w.done??!1,disabled:!D}),w.assigneeName&&e.jsx(v.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))})}),wn=e.jsx("div",{className:"nice-event-planning__list",children:t.length===0?e.jsx("p",{className:"nice-event-planning__empty",children:"No vendors yet."}):e.jsx("ul",{className:"nice-event-planning__vendors",children:t.map(w=>e.jsxs("li",{className:"nice-event-planning__vendor",children:[e.jsx(Z.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(v.NiceBadge,{size:"xs",subtle:!0,variant:Ce(w.status),children:w.status}),w.cost!=null&&e.jsxs("span",{className:"nice-event-planning__vendor-cost",children:[w.cost," ",w.currency??""]})]},w.id))})}),kn=e.jsx("div",{className:"nice-event-planning__list",children:u.length===0?e.jsx("p",{className:"nice-event-planning__empty",children:"No documents yet."}):e.jsx("ul",{className:"nice-event-planning__documents",children:u.map(w=>e.jsxs("li",{className:"nice-event-planning__document",children:[e.jsx(Z.NiceIcon,{name:"file",size:"sm"}),e.jsx("span",{className:"nice-event-planning__document-name",children:w.name}),w.fileType&&e.jsx(v.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))})}),Sn={details:gn,location:fn,schedule:_n,participants:vn,tasks:bn,surveys:Nn,vendors:wn,budget:jn,documents:kn,settings:yn},Cn={details:"file",location:"home",schedule:"clock",participants:"users",tasks:"list",surveys:"clipboard",vendors:"briefcase",budget:"dollar",documents:"folder",settings:"settings"},In={schedule:m.length||void 0,participants:r.length||void 0,tasks:h.length||void 0,surveys:l.length||void 0,vendors:t.length||void 0,budget:d.length||void 0,documents:u.length||void 0},zn=ce.map(w=>({id:w,label:w.charAt(0).toUpperCase()+w.slice(1),icon:e.jsx(Z.NiceIcon,{name:Cn[w],size:"sm"}),badge:In[w],content:Sn[w]})),Mn=e.jsxs("div",{className:"nice-event-planning__toolbar",children:[e.jsxs("div",{className:"nice-event-planning__toolbar-title",children:[e.jsx(Z.NiceIcon,{name:"calendar",size:"md"}),e.jsx("span",{className:"nice-event-planning__title",children:n.title}),e.jsx(v.NiceBadge,{size:"sm",variant:Ce(n.status),children:n.status})]}),e.jsx("span",{className:"nice-event-planning__toolbar-spacer"}),e.jsxs("div",{className:"nice-event-planning__toolbar-actions",children:[C&&e.jsx(v.NiceButton,{size:"sm",variant:"primary",leftIcon:e.jsx(Z.NiceIcon,{name:"check",size:"sm"}),onClick:()=>C({title:O,description:G}),children:"Save"}),L&&e.jsx(v.NiceButton,{size:"sm",variant:"success",leftIcon:e.jsx(Z.NiceIcon,{name:"upload",size:"sm"}),onClick:L,children:"Publish"}),z&&e.jsx(v.NiceButton,{size:"sm",variant:"ghost",leftIcon:e.jsx(Z.NiceIcon,{name:"link",size:"sm"}),onClick:z,children:"Share"}),A&&e.jsx(v.NiceButton,{size:"sm",variant:"ghost",leftIcon:e.jsx(Z.NiceIcon,{name:"download",size:"sm"}),onClick:A,children:"Export"})]})]});return p==="micro"?e.jsx("div",{ref:c,className:`nice-event-planning nice-event-planning--micro ${V??""}`,style:K,children:e.jsxs("div",{className:"nice-event-planning__micro",children:[e.jsx(Z.NiceIcon,{name:"calendar",size:"md"}),e.jsxs("div",{className:"nice-event-planning__micro-body",children:[e.jsx("span",{className:"nice-event-planning__title",children:n.title}),e.jsxs("span",{className:"nice-event-planning__muted",children:[n.startDate?new Date(n.startDate).toLocaleString():"No date",(Xe=n.location)!=null&&Xe.name?` · ${n.location.name}`:""]})]}),e.jsx(v.NiceBadge,{size:"sm",variant:Ce(n.status),children:n.status}),r.length>0&&e.jsx(v.NiceAvatarGroup,{max:4,size:"sm",children:r.map(w=>e.jsx(v.NiceAvatar,{name:w.name,src:w.avatarUrl,size:"sm"},w.id))})]})}):e.jsxs("div",{ref:c,className:`nice-event-planning nice-event-planning--${p} ${V??""}`,style:K,children:[Mn,e.jsx(v.NiceTabs,{tabs:zn,activeTab:rn,onChange:ln,iconOnly:b,centered:k,countLocation:j})]})});function Dn(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 Ae=({participant:i,showRole:s=!0,showStatus:c=!0,meta:n,children:r,size:l="md",className:d})=>e.jsxs("li",{className:`nice-participant-row nice-participant-row--${l} ${d??""}`,children:[e.jsx(v.NiceAvatar,{name:i.name,src:i.avatarUrl,size:l}),e.jsx("span",{className:"nice-participant-row__name",children:i.name}),s&&i.role&&e.jsx(v.NiceBadge,{size:"xs",outline:!0,variant:"info",children:i.role}),c&&i.status&&e.jsx(v.NiceBadge,{size:"xs",subtle:!0,variant:Dn(i.status),children:i.status}),n&&e.jsx("span",{className:"nice-participant-row__meta",children:n}),r&&e.jsx("span",{className:"nice-participant-row__trailing",children:r})]}),Ln=/^[^\s@,;]+@[^\s@,;]+\.[^\s@,;]{2,}$/,qe=/^.*<\s*([^<>\s]+)\s*>$/;function en(i){var l,d;const s=[],c=[],n=new Set;let r=0;if(!i)return{valid:s,invalid:c,duplicates:r};for(const m of i.split(/[,;\r\n\t]+/)){const h=m.trim();if(!h)continue;const t=((d=(l=qe.exec(h))==null?void 0:l[1])==null?void 0:d.trim())??h,u=qe.test(h)?[t]:t.split(/\s+/);for(const p of u){if(!p)continue;if(!Ln.test(p)){c.push(p);continue}const _=p.toLowerCase();if(n.has(_)){r+=1;continue}n.add(_),s.push(p)}}return{valid:s,invalid:c,duplicates:r}}function On(i,s){const c=new Set(i.map(r=>r.toLowerCase())),n=[...i];for(const r of s){const l=r.toLowerCase();c.has(l)||(c.add(l),n.push(r))}return n}function nn(i={}){const{currentUserId:s,currentUserName:c,requireIdentity:n=!0}=i,[r,l]=o.useState(""),d=!s,m=c??r,h=!n||m.trim().length>0;return{isAnonymous:d,name:m,setName:l,canAct:h,actor:{userId:s,userName:m.trim()}}}const Un=[{answer:"yes",label:"Yes",variant:"success",Icon:M.NtdCheck},{answer:"maybe",label:"Maybe",variant:"warning",Icon:M.NtdHelp},{answer:"no",label:"No",variant:"error",Icon:M.NtdClose}],Pe=o.forwardRef(function(s,c){const{value:n,onRespond:r,allowPlusOnes:l=!1,maxPlusOnes:d=5,plusOnes:m=0,allowNote:h=!1,currentUserId:t,currentUserName:u,compact:p=!1,disabled:_=!1,readOnly:g=!1,size:x="md",className:b,style:k}=s,j=nn({currentUserId:t,currentUserName:u}),[T,a]=o.useState(m),[N,f]=o.useState(""),$=!p&&j.isAnonymous&&!j.canAct,S=_||g,R=y=>{S||!r||r({answer:y,plusOnes:l&&y!=="no"?T:void 0,note:h&&N.trim()?N.trim():void 0,userId:j.actor.userId,userName:j.actor.userName||void 0})};return e.jsxs("div",{ref:c,className:`nice-rsvp-control nice-rsvp-control--${x}${p?" nice-rsvp-control--compact":""} ${b??""}`,style:k,children:[!p&&j.isAnonymous&&e.jsx(v.NiceTextInput,{label:"Your name",value:j.name,onChange:j.setName,placeholder:"Who is replying?",required:!0,disabled:S,size:x}),e.jsx("div",{className:"nice-rsvp-control__answers",role:"group","aria-label":"Your reply",children:Un.map(({answer:y,label:E,variant:F,Icon:D})=>e.jsx(v.NiceButton,{size:x,variant:n===y?F:"outline",leftIcon:e.jsx(D,{size:16}),disabled:S||$,"aria-pressed":n===y,onClick:()=>R(y),children:E},y))}),!p&&l&&n!=="no"&&e.jsxs("label",{className:"nice-rsvp-control__field",children:[e.jsx("span",{className:"nice-rsvp-control__field-label",children:"Additional guests"}),e.jsx(v.NiceNumericInput,{value:T,onChange:y=>a(Math.max(0,Math.min(d,y??0))),min:0,max:d,step:1,size:"xs",disabled:S})]}),!p&&h&&e.jsx(v.NiceTextInput,{label:"Note",value:N,onChange:f,placeholder:"Anything we should know?",disabled:S,size:x}),$&&e.jsx("p",{className:"nice-rsvp-control__hint",children:"Enter your name to reply."})]})}),Yn={yes:"confirmed",maybe:"invited",no:"declined"},We={confirmed:"yes","checked-in":"yes",declined:"no"},Ie=["confirmed","checked-in","invited","declined","no-show"],Fn=o.forwardRef(function(s,c){const{participants:n,mode:r="organizer",currentUserId:l,currentUserName:d,onRsvpChange:m,onCheckIn:h,onScan:t,checkInSlot:u,onInvite:p,extraFields:_,groupBy:g="none",showSummary:x=!0,showSearch:b=!0,allowPlusOnes:k=!1,disabled:j=!1,readOnly:T=!1,size:a="md",className:N,style:f}=s,[$,S]=o.useState(""),[R,y]=o.useState("all"),[E,F]=o.useState(""),D=j||T,C=r==="guest",L=o.useMemo(()=>{const I={total:n.length};for(const Y of Ie)I[Y]=0;for(const Y of n)I[Y.status]=(I[Y.status]??0)+1;return I},[n]),z=o.useMemo(()=>{if(C)return n.filter(Y=>Y.userId===l||Y.id===l);const I=$.trim().toLowerCase();return n.filter(Y=>R!=="all"&&Y.status!==R?!1:!I||Y.name.toLowerCase().includes(I))},[n,C,l,$,R]),A=o.useMemo(()=>{if(g==="none"||C)return[{key:"all",label:"",items:z}];const I=new Map;for(const V of z){const K=g==="status"?V.status:V.role,O=I.get(K);O?O.push(V):I.set(K,[V])}return[...I.keys()].sort((V,K)=>g!=="status"?V.localeCompare(K):Ie.indexOf(V)-Ie.indexOf(K)).map(V=>({key:V,label:V,items:I.get(V)??[]}))},[z,g,C]),B=o.useMemo(()=>en(E),[E]),q=I=>Y=>{m==null||m(I,Yn[Y.answer],Y)},X=()=>{!p||B.valid.length===0||(p(B.valid),F(""))};if(C){const I=z[0];return I?e.jsxs("div",{ref:c,className:`nice-participant-list nice-participant-list--guest ${N??""}`,style:f,children:[e.jsx("ul",{className:"nice-participant-list__rows",children:e.jsx(Ae,{participant:I,size:a})}),e.jsx(Pe,{value:We[I.status],onRespond:q(I.id),allowPlusOnes:k,currentUserId:l??I.userId,currentUserName:d??I.name,disabled:j,readOnly:T,size:a})]}):e.jsx("div",{ref:c,className:`nice-participant-list ${N??""}`,style:f,children:e.jsx(me,{title:"You are not on this guest list",description:"Ask the host for an invitation link."})})}return e.jsxs("div",{ref:c,className:`nice-participant-list ${N??""}`,style:f,children:[x&&e.jsxs("div",{className:"nice-participant-list__summary",children:[e.jsxs("span",{className:"nice-participant-list__stat",children:[e.jsx("strong",{children:L.confirmed})," confirmed"]}),e.jsxs("span",{className:"nice-participant-list__stat",children:[e.jsx("strong",{children:L.invited})," awaiting reply"]}),e.jsxs("span",{className:"nice-participant-list__stat",children:[e.jsx("strong",{children:L.declined})," declined"]}),e.jsxs("span",{className:"nice-participant-list__stat",children:[e.jsx("strong",{children:L["checked-in"]})," checked in"]}),e.jsxs("span",{className:"nice-participant-list__stat nice-participant-list__stat--total",children:[e.jsx("strong",{children:L.total})," total"]})]}),(b||u||t)&&e.jsxs("div",{className:"nice-participant-list__toolbar",children:[b&&e.jsxs(e.Fragment,{children:[e.jsx(v.NiceTextInput,{value:$,onChange:S,placeholder:"Search guests…",prefix:e.jsx(M.NtdSearch,{size:15}),size:a}),e.jsx(v.NiceSelect,{value:R,onChange:I=>y(I),size:a,options:[{value:"all",label:"All statuses"},...Ie.map(I=>({value:I,label:I}))]})]}),u,t&&!u&&e.jsxs("span",{className:"nice-participant-list__scan-hint",children:[e.jsx(M.NtdQrCode,{size:15})," Scanner ready"]})]}),z.length===0?e.jsx(me,{title:"No guests yet",description:n.length>0?"No one matches the current filter.":"Invite people to see them here."}):A.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(Y=>e.jsxs(Ae,{participant:Y,size:a,meta:_==null?void 0:_.map(V=>e.jsx("span",{className:"nice-participant-list__extra",children:V.render?V.render(Y):String(Y[V.key]??"")},V.key)),children:[m&&e.jsx(Pe,{compact:!0,value:We[Y.status],onRespond:q(Y.id),currentUserId:Y.userId,currentUserName:Y.name,disabled:D,size:"sm"}),h&&Y.status!=="checked-in"&&e.jsx(v.NiceButton,{size:"sm",variant:"outline",leftIcon:e.jsx(M.NtdCheck,{size:14}),disabled:D,onClick:()=>h(Y.id),children:"Check in"})]},Y.id))})]},I.key)),p&&!T&&e.jsxs("div",{className:"nice-participant-list__invite",children:[e.jsx(v.NiceTextArea,{label:"Invite by email",value:E,onChange:F,placeholder:"Paste addresses — commas, semicolons or new lines",rows:3,disabled:j,size:a}),e.jsxs(v.NiceButton,{variant:"primary",size:a,leftIcon:e.jsx(M.NtdMail,{size:15}),disabled:j||B.valid.length===0,onClick:X,children:["Invite ",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&&`${B.duplicates} duplicate(s) removed. `,B.invalid.length>0&&`${B.invalid.length} entry(ies) not recognised.`]})]})]})}),Xn={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 Re(i){return Xn[i==null?void 0:i.toUpperCase()]??2}function Ee(i,s){return Number.isFinite(i)?Math.round(i*10**Re(s)):0}function ze(i,s){const c=Re(s);return c===0?i:i/10**c}function Vn(i,s,c){const n=Re(s),r=ze(i,s);try{return new Intl.NumberFormat(c,{style:"currency",currency:s.toUpperCase(),minimumFractionDigits:n,maximumFractionDigits:n}).format(r)}catch{return`${r.toFixed(n)} ${s}`}}function ee(i,s,c){return Vn(Ee(i,s),s,c)}const Be={minX:0,minY:0,maxX:0,maxY:0};function qn(i,s=0){if(i.length===0)return{...Be};let c=1/0,n=1/0,r=-1/0,l=-1/0;for(const d of i)d.x<c&&(c=d.x),d.y<n&&(n=d.y),d.x>r&&(r=d.x),d.y>l&&(l=d.y);return{minX:c-s,minY:n-s,maxX:r+s,maxY:l+s}}function Ge(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 Ke(i,s){return i.minX<=s.maxX&&i.maxX>=s.minX&&i.minY<=s.maxY&&i.maxY>=s.minY}function Wn(i,s,c=0){const n=i.zoom||1,r=-i.pan.x/n-c,l=-i.pan.y/n-c;return{minX:r,minY:l,maxX:r+s.width/n+c*2,maxY:l+s.height/n+c*2}}function Gn(i,s=12){const c=[],n=[],r=new Map,l=new Map;let d=null,m=0;for(const h of i.sections??[]){let t=null,u=0;(h.rows??[]).forEach((_,g)=>{const x=Kn(_.seats??[]);if(x.length===0)return;const b=qn(x,s);n.push({sectionId:h.id,rowIndex:g,label:_.label,seats:x,bounds:b}),x.forEach((k,j)=>{r.set(k.id,k),l.set(k.id,{sectionId:h.id,rowIndex:g,seatIndex:j})}),u+=x.length,t=t?Ge(t,b):b});const p=t??{...Be};c.push({section:h,bounds:p,seatCount:u}),m+=u,u>0&&(d=d?Ge(d,p):p)}return{sections:c,rows:n,bounds:d??{...Be},totalSeats:m,seatById:r,locationById:l}}function Kn(i){return[...i].sort((s,c)=>s.number-c.number||s.x-c.x)}function Hn(i,s){return i>s*4?"section":i>s?"row":"seat"}function Qn(i,s,c=2500,n){const r=i.sections.filter(u=>Ke(u.bounds,s)),l=new Set(r.map(u=>u.section.id)),d=i.rows.filter(u=>l.has(u.sectionId)&&Ke(u.bounds,s));let m=0;for(const u of d)for(const p of u.seats)p.x>=s.minX&&p.x<=s.maxX&&p.y>=s.minY&&p.y<=s.maxY&&(m+=1);const h=n??Hn(m,c);let t=[];if(h==="seat"){t=[];for(const u of d)for(const p of u.seats)p.x>=s.minX&&p.x<=s.maxX&&p.y>=s.minY&&p.y<=s.maxY&&t.push(p)}return{tier:h,sections:r,rows:h==="section"?[]:d,seats:t,visibleSeatCount:m}}function De(i){if(i.accessType)return i.accessType;if(i.status==="wheelchair"||i.status==="companion")return i.status}function ve(i,s){const c=(s==null?void 0:s[i.id])??i.status;return c==="wheelchair"||c==="companion"?"available":c}function He(i,s,c){var r;const n=(r=s.priceCategories)==null?void 0:r.find(l=>l.id===i.priceCategoryId);return{amount:(n==null?void 0:n.price)??c.basePrice,currency:c.currency}}function Zn(i,s={},c){return!(ve(i,c)!=="available"||s.allowedCategories&&!s.allowedCategories.includes(i.priceCategoryId))}function sn(i,s={},c){const n=[];let r=null;return i.forEach((l,d)=>{Zn(l,s,c)?r?r.seats.push(l):r={start:d,seats:[l]}:r&&(n.push(r),r=null)}),r&&n.push(r),n}function Jn(i,s,c={},n){const r=c.maxSeats??8;if(i.length>r)return{ok:!1,reason:"max-seats"};for(const d of i){const m=s.seatById.get(d);if(m){if(ve(m,n)!=="available")return{ok:!1,reason:"unavailable",seatId:d};if(c.allowedCategories&&!c.allowedCategories.includes(m.priceCategoryId))return{ok:!1,reason:"category-not-allowed",seatId:d}}}if(!c.adjacentOnly||i.length===0)return{ok:!0};const l=new Map;for(const d of i){const m=s.locationById.get(d);if(!m)continue;const h=`${m.sectionId}::${m.rowIndex}`,t=l.get(h);t?t.push(d):l.set(h,[d])}for(const[d,m]of l){const[h,t]=d.split("::"),u=Number(t),p=s.rows.find(a=>a.sectionId===h&&a.rowIndex===u);if(!p)continue;const _=sn(p.seats,c,n),g=new Set(m);let x=null;for(const a of _)if(a.seats.some(N=>g.has(N.id))){if(x)return{ok:!1,reason:"not-adjacent",seatId:m[0]};x=a}if(!x)continue;const b=x.seats.map((a,N)=>g.has(a.id)?N:-1).filter(a=>a>=0);if(b.length===0)continue;const k=b[0],j=b[b.length-1];if(j-k+1!==b.length)return{ok:!1,reason:"not-adjacent",seatId:m[0]};const T=x.seats.length;if(T>1&&(k===1||T-1-j===1))return{ok:!1,reason:"orphan-seat",seatId:m[0]}}return{ok:!0}}function es(i,s,c,n={},r){if(i.includes(s))return{selected:i.filter(m=>m!==s)};const l=[...i,s],d=Jn(l,c,n,r);return d.ok?{selected:l}:{rejected:d.reason??"not-adjacent"}}function ns(i,s,c={},n={},r){if(s<=0)return[];const l=n.categoryId?{...c,allowedCategories:[n.categoryId]}:c;let d=null;for(const m of i.rows)if(!(n.sectionId&&m.sectionId!==n.sectionId))for(const h of sn(m.seats,l,r)){const t=h.seats.length;if(!(t<s))for(let u=0;u+s<=t;u+=1){const p=u+s-1;if(t>s&&(u===1||t-1-p===1))continue;const _=h.seats.slice(u,p+1),g=_.reduce((x,b)=>x+(b.viewScore??50),0)/s;(!d||g>d.score)&&(d={ids:_.map(x=>x.id),score:g})}}return(d==null?void 0:d.ids)??[]}function ss(i,s,c){var u,p,_,g;const n=i.locationById.get(s);if(!n)return null;const r=i.rows.findIndex(x=>x.sectionId===n.sectionId&&x.rowIndex===n.rowIndex);if(r<0)return null;const l=i.rows[r];if(c==="left")return((u=l.seats[n.seatIndex-1])==null?void 0:u.id)??null;if(c==="right")return((p=l.seats[n.seatIndex+1])==null?void 0:p.id)??null;if(c==="row-start")return((_=l.seats[0])==null?void 0:_.id)??null;if(c==="row-end")return((g=l.seats[l.seats.length-1])==null?void 0:g.id)??null;const d=i.rows[c==="up"?r-1:r+1];if(!d)return null;const m=l.seats[n.seatIndex].x;let h=null,t=1/0;for(const x of d.seats){const b=Math.abs(x.x-m);b<t&&(t=b,h=x)}return(h==null?void 0:h.id)??null}function ts(i,s,c){var h,t,u;const n=i.sections.filter(p=>p.seatCount>0);if(n.length===0)return null;const r=s?(h=i.locationById.get(s))==null?void 0:h.sectionId:void 0,l=n.findIndex(p=>p.section.id===r),d=l<0?0:c==="next"?l+1:l-1,m=n[d];return m?((u=(t=i.rows.find(p=>p.sectionId===m.section.id))==null?void 0:t.seats[0])==null?void 0:u.id)??null:null}const we=8;function is(i,s){return i.seats.length===0?0:i.seats.filter(n=>ve(n,s)==="available").length/i.seats.length}const as=({cull:i,selectedIds:s,cursorId:c,statusOverrides:n,sectionColorById:r,interactive:l,onSeatClick:d,onSectionClick:m,describeSeat:h})=>i.tier==="section"?e.jsx("g",{className:"nice-seating-chart__sections",children:i.sections.map(({section:t,bounds:u,seatCount:p})=>e.jsxs("g",{className:"nice-seating-chart__section",children:[e.jsx("rect",{x:u.minX,y:u.minY,width:u.maxX-u.minX,height:u.maxY-u.minY,rx:12,className:"nice-seating-chart__section-shape",style:{fill:r.get(t.id)},role:m?"button":"img","aria-label":`${t.name}, ${p} seats`,tabIndex:m?0:void 0,onClick:m?()=>m(t.id):void 0}),e.jsx("text",{x:(u.minX+u.maxX)/2,y:(u.minY+u.maxY)/2,className:"nice-seating-chart__section-label",textAnchor:"middle",dominantBaseline:"middle","aria-hidden":"true",children:t.name})]},t.id))}):i.tier==="row"?e.jsx("g",{className:"nice-seating-chart__rows",children:i.rows.map(t=>{const u=is(t,n);return e.jsxs("g",{children:[e.jsx("rect",{x:t.bounds.minX,y:t.bounds.minY,width:t.bounds.maxX-t.bounds.minX,height:t.bounds.maxY-t.bounds.minY,rx:8,className:"nice-seating-chart__row-shape",style:{fill:r.get(t.sectionId),fillOpacity:.25+u*.65},role:"img","aria-label":`Row ${t.label}, ${t.seats.length} seats, ${Math.round(u*t.seats.length)} available`}),e.jsx("text",{x:t.bounds.minX-6,y:(t.bounds.minY+t.bounds.maxY)/2,className:"nice-seating-chart__row-label",textAnchor:"end",dominantBaseline:"middle","aria-hidden":"true",children:t.label})]},`${t.sectionId}-${t.rowIndex}`)})}):e.jsx("g",{className:"nice-seating-chart__seats",children:i.seats.map(t=>{const u=ve(t,n),p=De(t),_=s.has(t.id),g=c===t.id,x={row:t.row,number:t.number},b=["nice-seating-chart__seat",`nice-seating-chart__seat--${u}`,_?"nice-seating-chart__seat--selected":"",p?`nice-seating-chart__seat--${p}`:"",g?"nice-seating-chart__seat--cursor":""].filter(Boolean).join(" ");return e.jsxs("g",{className:b,"data-seat-id":t.id,role:"gridcell","aria-selected":_,"aria-disabled":u!=="available","aria-label":h(t),tabIndex:g?0:-1,onClick:l&&d?()=>d(t):void 0,children:[p?e.jsx("rect",{x:t.x-we,y:t.y-we,width:we*2,height:we*2,rx:3,className:"nice-seating-chart__seat-shape",fill:p==="companion"?"url(#nice-seat-companion-hatch)":void 0}):e.jsx("circle",{cx:t.x,cy:t.y,r:we,className:"nice-seating-chart__seat-shape"}),p==="wheelchair"&&e.jsx(M.NtdWheelchair,{size:10,x:t.x-5,y:t.y-5,className:"nice-seating-chart__seat-glyph"}),e.jsx("title",{children:h(t)}),e.jsx("text",{x:t.x,y:t.y,className:"nice-seating-chart__seat-number",textAnchor:"middle",dominantBaseline:"middle","aria-hidden":"true",children:x.number})]},t.id)})}),cs=({index:i,selectedIds:s,statusOverrides:c,maxSeats:n,onSeatToggle:r,onBestAvailable:l,describeSeat:d,disabled:m=!1,defaultOpen:h=!1})=>{var T;const t=o.useMemo(()=>i.sections.filter(a=>a.seatCount>0),[i.sections]),[u,p]=o.useState(((T=t[0])==null?void 0:T.section.id)??""),[_,g]=o.useState(0),[x,b]=o.useState(2),k=o.useMemo(()=>i.rows.filter(a=>a.sectionId===u),[i.rows,u]),j=k.find(a=>a.rowIndex===_)??k[0];return e.jsxs(v.NiceCollapse,{trigger:"Choose seats without the map",defaultExpanded:h,className:"nice-seating-chart__list-panel",children:[l&&e.jsxs("div",{className:"nice-seating-chart__best",children:[e.jsxs("label",{className:"nice-seating-chart__field",children:[e.jsx("span",{children:"How many seats?"}),e.jsx(v.NiceNumericInput,{value:x,onChange:a=>b(Math.max(1,Math.min(n,a??1))),min:1,max:n,size:"xs",disabled:m})]}),e.jsx(v.NiceButton,{size:"sm",variant:"primary",disabled:m,onClick:()=>l(x,{sectionId:u||void 0}),children:"Best available"})]}),e.jsxs("div",{className:"nice-seating-chart__pickers",children:[e.jsxs("label",{className:"nice-seating-chart__field",children:[e.jsx("span",{children:"Section"}),e.jsx(v.NiceSelect,{size:"sm",value:u,disabled:m,onChange:a=>{p(a),g(0)},options:t.map(a=>({value:a.section.id,label:`${a.section.name} (${a.seatCount})`}))})]}),e.jsxs("label",{className:"nice-seating-chart__field",children:[e.jsx("span",{children:"Row"}),e.jsx(v.NiceSelect,{size:"sm",value:String((j==null?void 0:j.rowIndex)??0),disabled:m||k.length===0,onChange:a=>g(Number(a)),options:k.map(a=>({value:String(a.rowIndex),label:`${a.label} (${a.seats.length})`}))})]})]}),j&&e.jsx("ul",{className:"nice-seating-chart__seat-list",children:j.seats.map(a=>{const N=ve(a,c),f=De(a),$=s.has(a.id);return e.jsx("li",{children:e.jsxs(v.NiceButton,{size:"sm",variant:$?"primary":"outline",disabled:m||N!=="available",ariaLabel:d(a),"aria-pressed":$,onClick:()=>r(a),children:[a.number,f&&e.jsx(M.NtdWheelchair,{size:11})]})},a.id)})})]})},rs={zoom:1,pan:{x:0,y:0}};function ls(i={}){const{minZoom:s=.1,maxZoom:c=10,initial:n=rs,viewport:r,onViewportChange:l,disabled:d=!1}=i,[m,h]=o.useState(n),t=r??m,[u,p]=o.useState(!1),_=o.useRef(new Map),g=o.useRef(null),x=o.useRef(null),b=o.useCallback(y=>{r===void 0&&h(y),l==null||l(y)},[r,l]),k=o.useCallback(y=>Math.min(c,Math.max(s,y)),[s,c]),j=o.useCallback((y,E)=>{const F=k(t.zoom*y);if(F===t.zoom)return;const D=F/t.zoom;b({zoom:F,pan:{x:E.x-(E.x-t.pan.x)*D,y:E.y-(E.y-t.pan.y)*D}})},[b,k,t]),T=o.useCallback((y,E,F)=>{const D=E??(F?{x:F.width/2,y:F.height/2}:{x:0,y:0});j(y,D)},[j]),a=o.useCallback((y,E,F=24)=>{const D=Math.max(1,y.maxX-y.minX),C=Math.max(1,y.maxY-y.minY),L=k(Math.min((E.width-F*2)/D,(E.height-F*2)/C));b({zoom:L,pan:{x:(E.width-D*L)/2-y.minX*L,y:(E.height-C*L)/2-y.minY*L}})},[b,k]),N=o.useCallback(()=>b(n),[b,n]),f=o.useCallback(y=>({x:(y.x-t.pan.x)/t.zoom,y:(y.y-t.pan.y)/t.zoom}),[t]),$=o.useCallback(y=>({x:y.x*t.zoom+t.pan.x,y:y.y*t.zoom+t.pan.y}),[t]),S=y=>{const E=y.currentTarget.getBoundingClientRect();return{x:y.clientX-E.left,y:y.clientY-E.top}};return{viewport:t,setViewport:b,containerProps:d?{}:{onWheel:y=>{y.preventDefault();const E=Math.exp(-y.deltaY*.002);j(Math.min(2,Math.max(.5,E)),S(y))},onPointerDown:y=>{var F,D;const E=S(y);if(_.current.set(y.pointerId,E),(D=(F=y.currentTarget).setPointerCapture)==null||D.call(F,y.pointerId),_.current.size===2){const[C,L]=[..._.current.values()];g.current={distance:Math.hypot(C.x-L.x,C.y-L.y)||1,zoom:t.zoom}}else x.current=E,p(!0)},onPointerMove:y=>{if(!_.current.has(y.pointerId))return;const E=S(y);if(_.current.set(y.pointerId,E),_.current.size===2&&g.current){const[C,L]=[..._.current.values()],z=Math.hypot(C.x-L.x,C.y-L.y)||1,A=k(g.current.zoom*(z/g.current.distance)),B={x:(C.x+L.x)/2,y:(C.y+L.y)/2};A!==t.zoom&&j(A/t.zoom,B);return}if(!x.current)return;const F=E.x-x.current.x,D=E.y-x.current.y;x.current=E,b({zoom:t.zoom,pan:{x:t.pan.x+F,y:t.pan.y+D}})},onPointerUp:y=>{_.current.delete(y.pointerId),_.current.size<2&&(g.current=null),_.current.size===0&&(x.current=null,p(!1))},onPointerCancel:y=>{_.current.delete(y.pointerId),g.current=null,x.current=null,p(!1)}},zoomBy:T,fitTo:a,reset:N,screenToWorld:f,worldToScreen:$,panning:u}}const os={"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."},tn=o.forwardRef(function(s,c){var ae,be,fe;const{chart:n,mode:r="select",selection:l={},selectedSeatIds:d,defaultSelectedSeatIds:m=[],onSelectionChange:h,onSelectionRejected:t,seatStatusOverrides:u,onSeatClick:p,onBestAvailable:_,lod:g="auto",onLodChange:x,maxRenderedSeats:b=2500,containerSize:k,showLegend:j=!0,showList:T=!1,zoomable:a=!0,locale:N,disabled:f=!1,readOnly:$=!1,className:S,style:R}=s,y=o.useRef(null),[E,F]=o.useState({width:800,height:500}),[D,C]=o.useState(!1),[L,z]=o.useState(m),[A,B]=o.useState(null),[q,X]=o.useState(""),I=d??L,Y=o.useMemo(()=>new Set(I),[I]),V=r==="select"&&!f&&!$&&l.interactive!==!1,K=l.maxSeats??8,O=o.useMemo(()=>Gn(n),[n]),Q=k??E,G=!!k||D;o.useEffect(()=>{if(k||!y.current||typeof ResizeObserver>"u")return;const P=y.current,U=new ResizeObserver(([W])=>{const{width:H,height:J}=W.contentRect;H>0&&J>0&&(F({width:H,height:J}),C(!0))});return U.observe(P),()=>U.disconnect()},[k]);const he=ls({disabled:!a||f}),{fitTo:se,viewport:re}=he,pe=o.useRef(!1);o.useEffect(()=>{pe.current||!G||O.totalSeats===0||Q.width<=0||(pe.current=!0,se(O.bounds,Q))},[se,O,Q,G]);const ke=o.useMemo(()=>Wn(re,Q,40),[re,Q]),xe=g!=="auto"?g:A?"seat":void 0,le=o.useMemo(()=>Qn(O,ke,b,xe),[O,ke,b,xe]),ge=o.useRef(null);o.useEffect(()=>{ge.current!==le.tier&&(ge.current=le.tier,x==null||x(le.tier))},[le.tier,x]);const Te=o.useMemo(()=>{var P;return new Map(((P=n.sections)==null?void 0:P.map(U=>[U.id,U.color]))??[])},[n.sections]),oe=o.useMemo(()=>{var P;return new Map(((P=n.sections)==null?void 0:P.map(U=>[U.id,U]))??[])},[n.sections]),ie=o.useCallback(P=>{const U=oe.get(P.sectorId),W=ve(P,u),H=De(P),J=[U?U.name:"",`row ${P.row}`,`seat ${P.number}`].filter(Boolean);if(U&&l.showPrices!==!1){const ce=He(P,n,U);J.push(ee(ce.amount,ce.currency,N))}return J.push(W),H==="wheelchair"&&J.push("wheelchair accessible"),H==="companion"&&J.push("companion seat"),J.join(", ")},[n,oe,u,l.showPrices,N]),ne=o.useCallback(P=>{d===void 0&&z(P),h==null||h(P)},[d,h]),Ne=o.useCallback(P=>{if(p==null||p(P),!V)return;const U=es(I,P.id,O,l,u);if("rejected"in U){t==null||t({reason:U.rejected,seatId:P.id}),X(os[U.rejected]);return}ne(U.selected),X(`${ie(P)}. ${U.selected.length} of ${K} selected.`)},[ne,ie,O,V,K,p,t,u,I,l]),de=o.useCallback((P,U)=>{if(_){_(P,U);return}const W=ns(O,P,l,U,u);if(W.length===0){X(`No block of ${P} seats together is available.`);return}ne(W),B(W[0]),X(`Selected ${W.length} seats together.`)},[ne,O,_,u,l]),je=o.useCallback(P=>{const U=O.locationById.get(P);if(!U)return;const W=O.rows.find(H=>H.sectionId===U.sectionId&&H.rowIndex===U.rowIndex);W&&se(W.bounds,Q,80)},[se,O,Q]),ue=o.useCallback(P=>{if(!P)return;B(P),je(P);const U=O.seatById.get(P);U&&X(ie(U))},[ie,O.seatById,je]),$e=P=>{var J,ce;const U=A??((ce=(J=O.rows[0])==null?void 0:J.seats[0])==null?void 0:ce.id)??null;if(!U)return;const H={ArrowLeft:"left",ArrowRight:"right",ArrowUp:"up",ArrowDown:"down",Home:"row-start",End:"row-end"}[P.key];if(H){P.preventDefault(),ue(A?ss(O,U,H):U);return}if(P.key==="PageDown"||P.key==="PageUp"){P.preventDefault(),ue(ts(O,A,P.key==="PageDown"?"next":"prev"));return}if(P.key==="Enter"||P.key===" "){P.preventDefault();const Se=O.seatById.get(U);Se&&Ne(Se);return}P.key==="Escape"&&I.length>0&&(P.preventDefault(),ne([]),X("Selection cleared."))};if(O.totalSeats===0)return e.jsx("div",{ref:c,className:`nice-seating-chart ${S??""}`,style:R,children:e.jsx(me,{title:"This chart has no seats",description:"Add sections and rows to the seating chart to see it here."})});const ye=I.reduce((P,U)=>{const W=O.seatById.get(U),H=W?oe.get(W.sectorId):void 0;return!W||!H?P:P+He(W,n,H).amount},0),_e=((be=(ae=n.sections)==null?void 0:ae[0])==null?void 0:be.currency)??"PLN";return e.jsxs("div",{ref:c,className:`nice-seating-chart nice-seating-chart--${r} ${S??""}`,style:R,children:[e.jsxs("div",{ref:y,className:"nice-seating-chart__canvas-host",role:"grid","aria-label":`${n.name} seating chart`,"aria-rowcount":O.rows.length,"aria-colcount":O.totalSeats,tabIndex:A?-1:0,onKeyDown:$e,...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(${re.pan.x} ${re.pan.y}) scale(${re.zoom})`,children:e.jsx(as,{cull:le,selectedIds:Y,cursorId:A,statusOverrides:u,sectionColorById:Te,interactive:V,onSeatClick:Ne,onSectionClick:l.sectionSelect?P=>{var W;const U=(W=O.rows.find(H=>H.sectionId===P))==null?void 0:W.seats[0];U&&ue(U.id)}:void 0,describeSeat:ie})})]}),a&&e.jsxs("div",{className:"nice-seating-chart__zoom",children:[e.jsx(v.NiceButton,{size:"sm",variant:"ghost",ariaLabel:"Zoom in",onClick:()=>he.zoomBy(1.25,void 0,Q),children:"+"}),e.jsx(v.NiceButton,{size:"sm",variant:"ghost",ariaLabel:"Zoom out",onClick:()=>he.zoomBy(.8,void 0,Q),children:"−"}),e.jsx(v.NiceButton,{size:"sm",variant:"ghost",ariaLabel:"Fit to view",onClick:()=>se(O.bounds,Q),children:"Fit"})]})]}),e.jsx("p",{className:"nice-seating-chart__status",role:"status","aria-live":"polite",children:q}),j&&e.jsxs("ul",{className:"nice-seating-chart__legend",children:[(fe=n.priceCategories)==null?void 0:fe.map(P=>e.jsxs("li",{className:"nice-seating-chart__legend-item",children:[e.jsx("span",{className:"nice-seating-chart__legend-swatch",style:{background:P.color},"aria-hidden":"true"}),P.name," · ",ee(P.price,_e,N)]},P.id)),e.jsxs("li",{className:"nice-seating-chart__legend-item nice-seating-chart__legend-item--sold",children:[e.jsx("span",{className:"nice-seating-chart__legend-swatch","aria-hidden":"true"})," Sold"]})]}),r==="select"&&I.length>0&&e.jsxs("p",{className:"nice-seating-chart__total",children:[I.length," seat",I.length===1?"":"s"," ·"," ",ee(ye,_e,N)]}),T&&e.jsx(cs,{index:O,selectedIds:Y,statusOverrides:u,maxSeats:K,onSeatToggle:Ne,onBestAvailable:de,describeSeat:ie,disabled:!V,defaultOpen:r==="select"&&T})]})}),ds=o.forwardRef(function({showList:s=!0,className:c,...n},r){return e.jsx(tn,{ref:r,mode:"select",showList:s,className:`nice-seat-picker ${c??""}`,...n})}),an=/\{\{\s*([\w.-]+)\s*\}\}/g,us={"&":"&","<":"<",">":">",'"':""","'":"'"};function ms(i){return i.replace(/[&<>"']/g,s=>us[s]??s)}function hs(i){const s=[],c=new Set;for(const n of i.matchAll(an)){const r=n[1];c.has(r)||(c.add(r),s.push(r))}return s}function ps(i,s={},c={}){const{escape:n=!0,missing:r="keep"}=c;return i.replace(an,(l,d)=>{const m=s[d];return m==null?r==="blank"?"":l:n?ms(String(m)):String(m)})}function Qe(i){return`{{${i}}}`}function xs(i,s={}){return hs(i).filter(c=>s[c]===void 0||s[c]===null)}const gs=["bold","italic","underline","h1","h2","ul","ol","link","image","alignLeft","alignCenter","undo","redo"],fs=o.forwardRef(function(s,c){const{template:n,onTemplateChange:r,tokens:l=[],previewData:d={},recipients:m=[],onRecipientsChange:h,onSend:t,sending:u=!1,toolbar:p=gs,disabled:_=!1,readOnly:g=!1,size:x="md",className:b,style:k}=s,[j,T]=o.useState(""),a=_||g||u,N=o.useMemo(()=>en(j),[j]),f=o.useMemo(()=>{const C={};for(const L of l)L.sample!==void 0&&(C[L.key]=L.sample);return{...C,...d}},[l,d]),$=o.useMemo(()=>ps(n.body??"",f),[n.body,f]),S=o.useMemo(()=>xs(n.body??"",f),[n.body,f]),R=m.map(C=>C.email),y=C=>r==null?void 0:r({...n,...C}),E=C=>{y({body:`${n.body??""}${Qe(C)}`})},F=()=>{!h||N.valid.length===0||(h(On(R,N.valid)),T(""))},D=C=>{h==null||h(R.filter(L=>L!==C))};return e.jsxs("div",{ref:c,className:`nice-invitation-designer nice-invitation-designer--${x} ${b??""}`,style:k,children:[e.jsxs("section",{className:"nice-invitation-designer__editor",children:[e.jsx(v.NiceTextInput,{label:"Template name",value:n.name,onChange:C=>y({name:C}),placeholder:"Birthday invitation",disabled:a,size:x}),l.length>0&&!g&&e.jsxs("div",{className:"nice-invitation-designer__tokens",children:[e.jsx("span",{className:"nice-invitation-designer__tokens-label",children:"Insert:"}),l.map(C=>e.jsx(v.NiceButton,{size:"sm",variant:"outline",disabled:a,onClick:()=>E(C.key),children:C.label},C.key))]}),e.jsx(v.NiceHtmlEditor,{value:n.body??"",onChange:C=>y({body:C}),toolbar:p,height:280,readOnly:g||u,disabled:_})]}),e.jsxs("section",{className:"nice-invitation-designer__preview","aria-label":"Invitation preview",children:[e.jsxs("header",{className:"nice-invitation-designer__preview-header",children:[e.jsx("h4",{children:"Preview"}),S.length>0&&e.jsxs(v.NiceBadge,{size:"xs",subtle:!0,variant:"warning",children:[S.length," unresolved"]})]}),n.coverImageUrl&&e.jsx("img",{className:"nice-invitation-designer__cover",src:n.coverImageUrl,alt:""}),e.jsx("div",{className:"nice-invitation-designer__preview-body",dangerouslySetInnerHTML:{__html:$}}),S.length>0&&e.jsxs("p",{className:"nice-invitation-designer__unresolved",children:["No preview value for: ",S.map(C=>Qe(C)).join(", ")]})]}),e.jsxs("section",{className:"nice-invitation-designer__recipients",children:[e.jsx("header",{className:"nice-invitation-designer__recipients-header",children:e.jsxs("h4",{children:["Recipients ",e.jsxs("span",{children:["(",m.length,")"]})]})}),h&&!g&&e.jsxs(e.Fragment,{children:[e.jsx(v.NiceTextArea,{label:"Add addresses",value:j,onChange:T,placeholder:"Paste a list — commas, semicolons or new lines",rows:3,disabled:a,size:x}),e.jsxs("div",{className:"nice-invitation-designer__paste-actions",children:[e.jsxs(v.NiceButton,{size:x,variant:"outline",leftIcon:e.jsx(M.NtdMail,{size:15}),disabled:a||N.valid.length===0,onClick:F,children:["Add ",N.valid.length>0?`(${N.valid.length})`:""]}),(N.invalid.length>0||N.duplicates>0)&&e.jsxs("span",{className:"nice-invitation-designer__paste-hint",children:[N.duplicates>0&&`${N.duplicates} duplicate(s). `,N.invalid.length>0&&`${N.invalid.length} not recognised: ${N.invalid.slice(0,3).join(", ")}`]})]})]}),m.length>0&&e.jsx("ul",{className:"nice-invitation-designer__recipient-list",children:m.map(C=>e.jsxs("li",{className:"nice-invitation-designer__recipient",children:[e.jsx("span",{children:C.name?`${C.name} <${C.email}>`:C.email}),C.status&&C.status!=="pending"&&e.jsx(v.NiceBadge,{size:"xs",subtle:!0,variant:C.status==="sent"?"success":"error",children:C.status}),h&&!g&&e.jsx(v.NiceButton,{size:"sm",variant:"ghost",ariaLabel:`Remove ${C.email}`,disabled:a,onClick:()=>D(C.email),children:e.jsx(M.NtdTrash,{size:13})})]},C.email))}),t&&!g&&e.jsx(v.NiceButton,{variant:"primary",size:x,leftIcon:e.jsx(M.NtdSend,{size:15}),loading:u,ariaLabel:"Send invitations",disabled:_||u||m.length===0,onClick:()=>t({templateId:n.id,emails:R}),children:u?"Sending…":`Send to ${m.length}`})]})]})}),vs=({value:i,max:s,currency:c,locale:n,label:r,className:l})=>{const d=s>0?s:1,m=i>=s&&s>0,h=(t,u)=>c?`${ee(t,c,n)} / ${ee(u,c,n)}`:`${t} / ${u}`;return e.jsx(v.NiceProgress,{className:l,value:Math.min(i,d),max:d,variant:m?"success":"primary",size:"sm",showValue:!0,formatValue:()=>h(i,s),"aria-label":r})};function Ns(i,s){if(s==="wishlist")return{value:i.isPurchased?1:0,max:1,complete:!!i.isPurchased};const c=i.quantityNeeded??1,n=i.quantityContributed??0;return{value:n,max:c,complete:c>0&&n>=c}}const js=o.forwardRef(function(s,c){const{items:n,kind:r="registry",mode:l="owner",currency:d="PLN",locale:m,hideContributors:h=!1,currentUserId:t,currentUserName:u,onContribute:p,onClaim:_,onUnclaim:g,onItemAdd:x,onItemDelete:b,onItemClick:k,layout:j="grid",disabled:T=!1,readOnly:a=!1,size:N="md",className:f,style:$}=s,S=nn({currentUserId:t,currentUserName:u}),[R,y]=o.useState(null),[E,F]=o.useState(0),[D,C]=o.useState(""),L=l==="owner",z=T||a,A=r==="wishlist",B=o.useMemo(()=>A?[...n].sort((I,Y)=>Number(I.isPurchased??!1)-Number(Y.isPurchased??!1)||(Y.priority??0)-(I.priority??0)):n,[n,A]),q=()=>{y(null),F(0)},X=I=>{!p||!S.canAct||(p(I.id,{amount:E>0?E:void 0,quantity:E>0?void 0:1,userName:S.actor.userName,userId:S.actor.userId}),q())};return n.length===0?e.jsx("div",{ref:c,className:`nice-gift-registry ${f??""}`,style:$,children:e.jsx(me,{icon:e.jsx(M.NtdGiftCard,{size:28}),title:A?"Nothing on the wishlist yet":"No gifts on the registry yet",description:L?"Add what you would like and share the link.":"The host has not added anything yet."})}):e.jsxs("div",{ref:c,className:`nice-gift-registry nice-gift-registry--${r} nice-gift-registry--${j} nice-gift-registry--${N} ${f??""}`,style:$,children:[!L&&S.isAnonymous&&(p||_)&&e.jsx(v.NiceTextInput,{label:"Your name",value:S.name,onChange:S.setName,placeholder:"So the host knows who to thank",required:!0,disabled:z,size:N}),e.jsx(v.NiceCardGroup,{columns:j==="list"?1:void 0,minColumnWidth:240,gap:12,children:B.map(I=>{const{value:Y,max:V,complete:K}=Ns(I,r),O=I.price,Q=I.contributions??[];return e.jsxs("div",{className:`nice-gift-registry__item${K?" 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:()=>k==null?void 0:k(I),disabled:!k,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:[O&&e.jsx("span",{className:"nice-gift-registry__price",children:ee(O.amount,O.currency||d,m)}),A&&(I.priority??0)>0&&e.jsxs(v.NiceBadge,{size:"xs",subtle:!0,variant:"warning",children:[e.jsx(M.NtdStar,{size:11})," ",I.priority]}),K&&e.jsx(v.NiceBadge,{size:"xs",subtle:!0,variant:"success",children:A?"bought":"fully covered"}),I.url&&e.jsxs("a",{className:"nice-gift-registry__link",href:I.url,target:"_blank",rel:"noopener noreferrer",children:[e.jsx(M.NtdLink,{size:13})," Shop"]})]}),!A&&e.jsx(vs,{value:Y,max:V,label:`${I.title}: ${Y} of ${V} covered`}),!h&&Q.length>0&&e.jsx("ul",{className:"nice-gift-registry__contributors",children:Q.map(G=>e.jsxs("li",{className:"nice-gift-registry__contributor",children:[e.jsx("strong",{children:G.contributorName}),G.amount!==void 0&&` — ${ee(G.amount,(O==null?void 0:O.currency)||d,m)}`,G.amount===void 0&&G.quantity?` — ${G.quantity}×`:"",G.message&&e.jsxs("em",{children:[" “",G.message,"”"]})]},G.id))}),e.jsxs("div",{className:"nice-gift-registry__actions",children:[!L&&!K&&_&&e.jsx(v.NiceButton,{size:"sm",variant:"primary",disabled:z||!S.canAct,leftIcon:e.jsx(M.NtdCheck,{size:14}),onClick:()=>_(I.id,{...S.actor,quantity:1}),children:"I'll take this"}),!L&&K&&g&&e.jsx(v.NiceButton,{size:"sm",variant:"ghost",disabled:z,onClick:()=>g(I.id),children:"Release"}),!L&&!K&&!A&&p&&e.jsx(v.NiceButton,{size:"sm",variant:"outline",disabled:z||!S.canAct,onClick:()=>y(R===I.id?null:I.id),children:"Chip in"}),L&&b&&!a&&e.jsx(v.NiceButton,{size:"sm",variant:"ghost",ariaLabel:`Delete ${I.title}`,disabled:T,onClick:()=>b(I.id),children:e.jsx(M.NtdTrash,{size:14})})]}),R===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 (",(O==null?void 0:O.currency)||d,")"]}),e.jsx(v.NiceNumericInput,{value:E,onChange:G=>F(Math.max(0,G??0)),min:0,size:"xs",disabled:z})]}),e.jsx(v.NiceButton,{size:"sm",variant:"primary",disabled:z||!S.canAct,onClick:()=>X(I),children:"Confirm"}),e.jsx(v.NiceButton,{size:"sm",variant:"ghost",onClick:q,children:"Cancel"})]})]})]},I.id)})}),L&&x&&!a&&e.jsxs("div",{className:"nice-gift-registry__add",children:[e.jsx(v.NiceTextInput,{label:A?"Add a wish":"Add a gift",value:D,onChange:C,placeholder:"What would you like?",disabled:T,size:N}),e.jsx(v.NiceButton,{variant:"primary",size:N,leftIcon:e.jsx(M.NtdPlus,{size:15}),disabled:T||!D.trim(),onClick:()=>{x({title:D.trim(),quantityNeeded:1}),C("")},children:"Add"})]})]})});function ys(i){const s=new Map;for(const c of i){const n=(c.currency||"").toUpperCase(),r=s.get(n);r?r.push(c):s.set(n,[c])}return s}function _s(i,s,c){var h;const n=new Set(s.map(t=>t.id)),r=s.map(t=>t.id),l=new Map(r.map(t=>[t,0])),d=[];let m=0;if(r.length===0)return{balances:l,issues:i.map(t=>({itemId:t.id,reason:"no-participants"})),totalMinor:0};for(const t of i){const u=t.paidById;if(!u){d.push({itemId:t.id,reason:"no-payer"});continue}if(!n.has(u)){d.push({itemId:t.id,reason:"unknown-payer"});continue}let p=(h=t.splitAmong)!=null&&h.length?t.splitAmong.filter(j=>n.has(j)):r;p.length===0&&(p=r);const _=Ee(t.amount,c);m+=_;const g=p.length,x=Math.floor(_/g),b=_-x*g,k=new Map(p.map(j=>[j,x]));if(b!==0)if(k.has(u))k.set(u,(k.get(u)??0)+b);else{const j=[...p].sort(Me),T=b>0?1:-1;for(let a=0;a<Math.abs(b);a+=1){const N=j[a%j.length];k.set(N,(k.get(N)??0)+T)}}l.set(u,(l.get(u)??0)+_);for(const[j,T]of k)l.set(j,(l.get(j)??0)-T)}return{balances:l,issues:d,totalMinor:m}}function bs(i,s,c){for(const n of s){if((n.currency||"").toUpperCase()!==c||!i.has(n.fromId)||!i.has(n.toId))continue;const r=Ee(n.amount,c);i.set(n.fromId,(i.get(n.fromId)??0)+r),i.set(n.toId,(i.get(n.toId)??0)-r)}}function ws(i,s,c){const n=new Map(s.map(t=>[t.id,t.name])),r=[...i.entries()].filter(([,t])=>t>0).map(([t,u])=>({id:t,v:u})).sort((t,u)=>u.v-t.v||Me(t.id,u.id)),l=[...i.entries()].filter(([,t])=>t<0).map(([t,u])=>({id:t,v:u})).sort((t,u)=>t.v-u.v||Me(t.id,u.id)),d=[];let m=0,h=0;for(;m<l.length&&h<r.length;){const t=Math.min(-l[m].v,r[h].v);t>0&&d.push({fromId:l[m].id,fromName:n.get(l[m].id)??l[m].id,toId:r[h].id,toName:n.get(r[h].id)??r[h].id,amount:ze(t,c),currency:c}),l[m].v+=t,r[h].v-=t,l[m].v===0&&(m+=1),r[h].v===0&&(h+=1)}return d}function ks(i,s,c=[]){const n=[],r=[],l=[...ys(i).entries()].sort(([d],[m])=>Me(d,m));for(const[d,m]of l){const h=_s(m,s,d);r.push(...h.issues),bs(h.balances,c,d),n.push({currency:d,total:ze(h.totalMinor,d),balances:s.map(t=>({participantId:t.id,participantName:t.name,amount:ze(h.balances.get(t.id)??0,d),currency:d})),transfers:ws(h.balances,s,d)})}return{groups:n,issues:r}}function Me(i,s){return i<s?-1:i>s?1:0}const Ss=o.forwardRef(function(s,c){const{items:n,participants:r,settlements:l=[],view:d,defaultView:m="expenses",onViewChange:h,onSettle:t,onItemDelete:u,onItemClick:p,onValidationChange:_,sortBy:g="date",locale:x,disabled:b=!1,readOnly:k=!1,size:j="md",className:T,style:a}=s,[N,f]=o.useState(m),$=d??N,S=b||k,R=o.useMemo(()=>r.map(z=>({id:z.id,name:z.name})),[r]),y=o.useMemo(()=>ks(n,R,l),[n,R,l]),E=o.useMemo(()=>g==="none"?n:n.map((z,A)=>({item:z,index:A})).sort((z,A)=>{if(g==="amount")return A.item.amount-z.item.amount||z.index-A.index;const B=z.item.incurredAt,q=A.item.incurredAt;return B&&q?B.localeCompare(q)||z.index-A.index:B?-1:q?1:z.index-A.index}).map(z=>z.item),[n,g]),F=y.issues.map(z=>`${z.itemId}:${z.reason}`).join("|");o.useEffect(()=>{_==null||_(y.issues)},[F]);const D=o.useMemo(()=>new Map(r.map(z=>[z.id,z.avatarUrl])),[r]),C=o.useMemo(()=>new Map(y.issues.map(z=>[z.itemId,z.reason])),[y.issues]),L=z=>{d===void 0&&f(z),h==null||h(z)};return n.length===0?e.jsx("div",{ref:c,className:`nice-expense-split ${T??""}`,style:a,children:e.jsx(me,{icon:e.jsx(M.NtdReceipt,{size:28}),title:"No expenses yet",description:"Add what people paid for and this will work out who owes whom."})}):e.jsxs("div",{ref:c,className:`nice-expense-split nice-expense-split--${j} ${T??""}`,style:a,children:[e.jsx(v.NiceSegmentedControl,{size:j,value:$,onChange:z=>L(z),options:[{value:"expenses",label:"Expenses"},{value:"balances",label:"Balances"},{value:"settlement",label:"Settle up"}]}),$==="expenses"&&e.jsx("ul",{className:"nice-expense-split__items",children:E.map(z=>{const A=C.get(z.id);return e.jsxs("li",{className:`nice-expense-split__item${A?" nice-expense-split__item--excluded":""}`,children:[e.jsxs("button",{type:"button",className:"nice-expense-split__item-main",onClick:()=>p==null?void 0:p(z),disabled:!p,children:[e.jsx("span",{className:"nice-expense-split__item-label",children:z.label}),e.jsxs("span",{className:"nice-expense-split__item-payer",children:[z.paidByName??z.paidById??"nobody"," paid"]})]}),e.jsx("span",{className:"nice-expense-split__item-amount",children:ee(z.amount,z.currency,x)}),z.isPaid&&e.jsx(v.NiceBadge,{size:"xs",subtle:!0,variant:"success",children:"paid"}),A&&e.jsx(v.NiceBadge,{size:"xs",subtle:!0,variant:"warning",children:A==="no-payer"?"no payer":"unknown payer"}),u&&!k&&e.jsx(v.NiceButton,{size:"sm",variant:"ghost",ariaLabel:`Delete ${z.label}`,disabled:b,onClick:()=>u(z.id),children:e.jsx(M.NtdTrash,{size:14})})]},z.id)})}),$==="balances"&&y.groups.map(z=>e.jsxs("section",{className:"nice-expense-split__group",children:[e.jsxs("h4",{className:"nice-expense-split__group-title",children:[z.currency,e.jsxs("span",{className:"nice-expense-split__group-total",children:[ee(z.total,z.currency,x)," total"]})]}),e.jsx("ul",{className:"nice-participant-list__rows",children:z.balances.map(A=>e.jsx(Ae,{participant:{id:A.participantId,name:A.participantName,avatarUrl:D.get(A.participantId)},showRole:!1,showStatus:!1,size:j,children:e.jsxs("span",{className:`nice-expense-split__balance nice-expense-split__balance--${A.amount>0?"owed":A.amount<0?"owes":"settled"}`,children:[A.amount===0?"settled up":ee(Math.abs(A.amount),A.currency,x),A.amount>0&&e.jsx("em",{children:" is owed"}),A.amount<0&&e.jsx("em",{children:" owes"})]})},A.participantId))})]},z.currency)),$==="settlement"&&(y.groups.every(z=>z.transfers.length===0)?e.jsx(me,{icon:e.jsx(M.NtdCoins,{size:28}),title:"All settled up",description:"Nobody owes anybody anything."}):y.groups.filter(z=>z.transfers.length>0).map(z=>e.jsxs("section",{className:"nice-expense-split__group",children:[e.jsxs("h4",{className:"nice-expense-split__group-title",children:[z.currency,e.jsxs("span",{className:"nice-expense-split__group-total",children:[z.transfers.length," transfer",z.transfers.length===1?"":"s"]})]}),e.jsx("ul",{className:"nice-expense-split__transfers",children:z.transfers.map(A=>e.jsxs("li",{className:"nice-expense-split__transfer",children:[e.jsx("span",{className:"nice-expense-split__transfer-from",children:A.fromName}),e.jsx(M.NtdArrowRight,{size:15}),e.jsx("span",{className:"nice-expense-split__transfer-to",children:A.toName}),e.jsx("span",{className:"nice-expense-split__transfer-amount",children:ee(A.amount,A.currency,x)}),t&&!k&&e.jsx(v.NiceButton,{size:"sm",variant:"outline",disabled:S,onClick:()=>t(A),children:"Mark paid"})]},`${A.fromId}-${A.toId}-${A.amount}`))})]},z.currency)))]})}),Cs={upcoming:M.NtdClock,active:M.NtdPlay,voting:M.NtdThumbsUp,scored:M.NtdBarChart,completed:M.NtdCheck,skipped:M.NtdSkipForward},Is={upcoming:"#9ca3af",active:"#22c55e",voting:"#eab308",scored:"#3b82f6",completed:"#6b7280",skipped:"#d1d5db"},zs=o.forwardRef(function(s,c){const{rounds:n,activeRoundId:r,onSelect:l,onStart:d,onEnd:m,onCreate:h,editable:t=!1,className:u,style:p}=s,_=[...n].sort((g,x)=>g.order-x.order);return e.jsxs("div",{ref:c,className:`nice-round-list ${u??""}`,style:p,children:[e.jsxs("div",{className:"nice-round-list__header",children:[e.jsxs("h3",{children:["Rounds (",n.length,")"]}),t&&h&&e.jsx("button",{onClick:h,children:"+ Add Round"})]}),_.length===0?e.jsx("p",{className:"nice-round-list__empty",children:"No rounds yet."}):e.jsx("div",{className:"nice-round-list__items",children:_.map(g=>{const x=g.id===r;return e.jsxs("div",{className:`nice-round-list__item ${x?"nice-round-list__item--active":""}`,onClick:()=>l==null?void 0:l(g),role:l?"button":void 0,tabIndex:l?0:void 0,children:[e.jsxs("span",{className:"nice-round-list__order",children:["#",g.order]}),e.jsx("span",{className:"nice-round-list__icon",title:g.status,children:o.createElement(Cs[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:Is[g.status]},children: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(M.NtdTrophy,{size:14})," ",g.winnerIds.length]}),t&&e.jsxs("div",{className:"nice-round-list__actions",onClick:b=>b.stopPropagation(),children:[g.status==="upcoming"&&d&&e.jsx("button",{onClick:()=>d(g.id),children:"Start"}),(g.status==="active"||g.status==="voting")&&m&&e.jsx("button",{onClick:()=>m(g.id),children:"End"})]})]},g.id)})})]})}),Ms=["var(--nice-lb-gold, #facc15)","var(--nice-lb-silver, #cbd5e1)","var(--nice-lb-bronze, #d97706)"],Ts=o.forwardRef(function(s,c){const{round:n,timerRunning:r=!1,remainingSeconds:l,onSubmitScore:d,onStart:m,onEnd:h,onSkip:t,editable:u=!1,footerActions:p,className:_,style:g}=s,[x,b]=o.useState({}),k=o.useCallback(a=>{const N=parseFloat(x[a]??"");isNaN(N)||!d||(d(a,N),b(f=>({...f,[a]:""})))},[x,d]),j=a=>{const N=Math.floor(a/60),f=a%60;return`${N}:${f.toString().padStart(2,"0")}`},T=n.scores?[...n.scores].sort((a,N)=>N.score-a.score):[];return e.jsxs("div",{ref:c,className:`nice-round-card nice-round-card--${n.status} ${_??""}`,style:g,children:[e.jsxs("div",{className:"nice-round-card__header",children:[e.jsxs("span",{className:"nice-round-card__order",children:["Round #",n.order]}),e.jsx("h3",{className:"nice-round-card__name",children:n.name}),e.jsx("span",{className:"nice-round-card__status",children:n.status})]}),n.description&&e.jsx("p",{className:"nice-round-card__description",children:n.description}),(r||l!=null)&&e.jsxs("div",{className:`nice-round-card__timer ${r?"nice-round-card__timer--running":""}`,children:[e.jsx(M.NtdClock,{size:14})," ",l!=null?j(l):"—"]}),T.length>0&&e.jsxs("div",{className:"nice-round-card__scoreboard",children:[e.jsx("h4",{children:"Scoreboard"}),e.jsxs("table",{className:"nice-round-card__scores-table",children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{children:"Rank"}),e.jsx("th",{children:"Participant"}),e.jsx("th",{children:"Score"})]})}),e.jsx("tbody",{children:T.map((a,N)=>e.jsxs("tr",{className:N<3?`nice-round-card__top-${N+1}`:"",children:[e.jsxs("td",{children:[a.rank??N+1,N<3&&e.jsxs(e.Fragment,{children:[" ",e.jsx(M.NtdMedal,{size:14,primaryColor:Ms[N],"aria-label":`Place ${N+1}`})]})]}),e.jsx("td",{children:a.participantName}),e.jsx("td",{children:a.score})]},a.participantId))})]})]}),d&&(n.status==="active"||n.status==="voting")&&T.length>0&&e.jsxs("div",{className:"nice-round-card__score-input",children:[e.jsx("h4",{children:"Submit Scores"}),T.map(a=>e.jsxs("div",{className:"nice-round-card__score-row",children:[e.jsx("span",{children:a.participantName}),e.jsx("input",{type:"number",value:x[a.participantId]??"",onChange:N=>b(f=>({...f,[a.participantId]:N.target.value})),min:0,step:1,placeholder:"Score"}),e.jsx("button",{onClick:()=>k(a.participantId),children:"Submit"})]},a.participantId))]}),e.jsxs("div",{className:"nice-round-card__footer",children:[u&&e.jsxs("div",{className:"nice-round-card__actions",children:[n.status==="upcoming"&&m&&e.jsxs("button",{onClick:m,children:[e.jsx(M.NtdPlay,{size:14})," Start Round"]}),(n.status==="active"||n.status==="voting")&&h&&e.jsxs("button",{onClick:h,children:[e.jsx(M.NtdStop,{size:14})," End Round"]}),n.status==="upcoming"&&t&&e.jsxs("button",{onClick:t,children:[e.jsx(M.NtdSkipForward,{size:14})," Skip"]})]}),p]}),n.winnerIds&&n.winnerIds.length>0&&e.jsxs("div",{className:"nice-round-card__winners",children:[e.jsx(M.NtdTrophy,{size:14})," Winners: ",n.winnerIds.length]})]})}),$s=o.forwardRef(function(s,c){const{songs:n,onAdd:r,onRemove:l,onVote:d,onSearch:m,showQueue:h=!0,readOnly:t=!1,className:u,style:p}=s,[_,g]=o.useState(""),x=o.useMemo(()=>{if(!_.trim())return n;const a=_.toLowerCase();return n.filter(N=>N.title.toLowerCase().includes(a)||N.artist.toLowerCase().includes(a))},[n,_]),b=o.useMemo(()=>n.filter(a=>a.isQueued),[n]),k=n.find(a=>a.isPlaying),j=a=>{g(a),m==null||m(a)},T=a=>{if(!a)return"";const N=Math.floor(a/60),f=a%60;return`${N}:${f.toString().padStart(2,"0")}`};return e.jsxs("div",{ref:c,className:`nice-song-picker ${u??""}`,style:p,children:[k&&e.jsxs("div",{className:"nice-song-picker__now-playing",children:[e.jsxs("span",{className:"nice-song-picker__np-label",children:[e.jsx(M.NtdMusic,{size:14})," Now Playing"]}),k.albumArt&&e.jsx("img",{src:k.albumArt,alt:"",className:"nice-song-picker__album-art"}),e.jsx("strong",{children:k.title}),e.jsx("span",{children:k.artist})]}),e.jsx("input",{type:"text",value:_,onChange:a=>j(a.target.value),placeholder:"Search songs…",className:"nice-song-picker__search"}),e.jsx("div",{className:"nice-song-picker__list",children:x.length===0?e.jsx("p",{className:"nice-song-picker__empty",children:"No songs found."}):x.map(a=>e.jsxs("div",{className:`nice-song-picker__item ${a.isPlaying?"nice-song-picker__item--playing":""}`,children:[a.albumArt&&e.jsx("img",{src:a.albumArt,alt:"",className:"nice-song-picker__thumb"}),e.jsxs("div",{className:"nice-song-picker__info",children:[e.jsx("strong",{children:a.title}),e.jsx("span",{children:a.artist}),a.duration&&e.jsx("span",{className:"nice-song-picker__duration",children:T(a.duration)}),a.addedByName&&e.jsxs("small",{children:["Added by ",a.addedByName]})]}),!t&&e.jsxs("div",{className:"nice-song-picker__actions",children:[d&&e.jsxs("button",{onClick:()=>d(a.id),"aria-label":`Vote for ${a.title}`,children:[e.jsx(M.NtdThumbsUp,{size:14})," ",a.votes??0]}),r&&!a.isQueued&&e.jsx("button",{onClick:()=>r(a.id),children:"+ Queue"}),l&&a.isQueued&&e.jsx("button",{onClick:()=>l(a.id),children:"Remove"})]})]},a.id))}),h&&b.length>0&&e.jsxs("div",{className:"nice-song-picker__queue",children:[e.jsxs("h4",{children:["Queue (",b.length,")"]}),b.map((a,N)=>e.jsxs("div",{className:"nice-song-picker__queue-item",children:[e.jsxs("span",{className:"nice-song-picker__queue-pos",children:[N+1,"."]}),e.jsxs("span",{children:[a.title," — ",a.artist]})]},a.id))]})]})}),As=o.forwardRef(function(s,c){const{songs:n,queue:r=[],onEnqueue:l,onDequeue:d,onNext:m,nowPlayingId:h,readOnly:t=!1,className:u,style:p}=s,[_,g]=o.useState(""),[x,b]=o.useState(""),k=n.find(f=>f.id===h),j=o.useMemo(()=>{let f=n;if(_.trim()){const $=_.toLowerCase();f=f.filter(S=>S.title.toLowerCase().includes($)||S.artist.toLowerCase().includes($))}return x&&(f=f.filter($=>$.difficulty===x)),f},[n,_,x]),T=o.useMemo(()=>new Set(r.map(f=>f.id)),[r]),a=["easy","medium","hard","expert"],N=f=>{switch(f){case"easy":return"#4caf50";case"medium":return"#ff9800";case"hard":return"#f44336";case"expert":return"#9c27b0";default:return"#999"}};return e.jsxs("div",{ref:c,className:`nice-karaoke-picker ${u??""}`,style:p,children:[k&&e.jsxs("div",{className:"nice-karaoke-picker__now-singing",style:{borderLeft:"4px solid #e91e63",padding:"12px",marginBottom:12,background:"color-mix(in srgb, #e91e63 12%, var(--nice-bg-primary, #ffffff))"},children:[e.jsxs("span",{style:{fontWeight:600},children:[e.jsx(M.NtdMicrophone,{size:14})," Now Singing"]}),e.jsxs("div",{children:[e.jsx("strong",{children:k.title})," — ",k.artist,k.performerName&&e.jsxs("span",{children:[" (by ",k.performerName,")"]})]}),!t&&m&&e.jsxs("button",{onClick:m,style:{marginTop:8},children:["Skip / Next ",e.jsx(M.NtdSkipForward,{size:14})]})]}),e.jsxs("div",{className:"nice-karaoke-picker__filters",style:{display:"flex",gap:8,marginBottom:12},children:[e.jsx("input",{type:"text",value:_,onChange:f=>g(f.target.value),placeholder:"Search songs or artists…",style:{flex:1}}),e.jsxs("select",{value:x,onChange:f=>b(f.target.value),children:[e.jsx("option",{value:"",children:"All Difficulties"}),a.map(f=>e.jsx("option",{value:f,children:f},f))]})]}),e.jsx("div",{className:"nice-karaoke-picker__catalog",children:j.length===0?e.jsx("p",{children:"No songs match your search."}):j.map(f=>e.jsxs("div",{className:"nice-karaoke-picker__song",style:{display:"flex",justifyContent:"space-between",alignItems:"center",padding:"8px 0",borderBottom:"1px solid #eee"},children:[e.jsxs("div",{children:[e.jsx("strong",{children:f.title})," — ",f.artist,f.difficulty&&e.jsxs("span",{style:{marginLeft:8,fontSize:12,color:N(f.difficulty),fontWeight:600},children:["[",f.difficulty,"]"]}),f.hasLyrics&&e.jsx("span",{style:{marginLeft:6,fontSize:12},title:"Lyrics available","aria-label":"Lyrics available",children:e.jsx(M.NtdFileText,{size:12})}),f.language&&e.jsxs("span",{style:{marginLeft:6,fontSize:12,color:"#666"},children:["(",f.language,")"]})]}),!t&&e.jsx("div",{children:T.has(f.id)?e.jsx("button",{onClick:()=>d==null?void 0:d(f.id),style:{color:"#f44336",background:"transparent",border:"1px solid currentColor",borderRadius:4},children:"Remove"}):e.jsxs("button",{onClick:()=>l==null?void 0:l(f.id),children:[e.jsx(M.NtdMicrophone,{size:14})," Sing"]})})]},f.id))}),r.length>0&&e.jsxs("div",{className:"nice-karaoke-picker__queue",style:{marginTop:16},children:[e.jsxs("h4",{children:[e.jsx(M.NtdMusic,{size:14})," Queue (",r.length,")"]}),r.map((f,$)=>e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",padding:"4px 0"},children:[e.jsxs("span",{children:[e.jsxs("strong",{children:[$+1,"."]})," ",f.title," — ",f.artist,f.performerName&&e.jsxs("em",{children:[" (",f.performerName,")"]})]}),!t&&d&&e.jsx("button",{onClick:()=>d(f.id),style:{fontSize:12},"aria-label":`Remove ${f.title}`,children:e.jsx(M.NtdClose,{size:12})})]},f.id))]})]})}),Ze={game:M.NtdGamepad,music:M.NtdMusic,dance:M.NtdMusic,quiz:M.NtdHelp,karaoke:M.NtdMicrophone,photo:M.NtdCamera,custom:M.NtdSparkle},Ps={game:"Games",music:"Music",dance:"Dance",quiz:"Quiz",karaoke:"Karaoke",photo:"Photo",custom:"Custom"},Bs=o.forwardRef(function(s,c){const{attractions:n,onSelect:r,onDeselect:l,onVote:d,selectedIds:m=[],maxSelections:h,showVotes:t=!0,readOnly:u=!1,layout:p="grid",className:_,style:g}=s,[x,b]=o.useState(""),[k,j]=o.useState(""),T=o.useMemo(()=>new Set(m),[m]),a=o.useMemo(()=>{const S=new Set(n.map(R=>R.category));return Array.from(S)},[n]),N=o.useMemo(()=>{let S=n;if(x&&(S=S.filter(R=>R.category===x)),k.trim()){const R=k.toLowerCase();S=S.filter(y=>{var E;return y.name.toLowerCase().includes(R)||((E=y.description)==null?void 0:E.toLowerCase().includes(R))})}return S},[n,x,k]),f=!h||T.size<h,$=S=>{u||(T.has(S)?l==null||l(S):f&&(r==null||r(S)))};return e.jsxs("div",{ref:c,className:`nice-attraction-picker ${_??""}`,style:{color:"var(--nice-text-primary)",...g},children:[e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:12},children:[e.jsx("h3",{style:{margin:0},children:"Attractions"}),h&&e.jsxs("span",{style:{color:"var(--nice-text-secondary, #64748b)",fontSize:14},children:[T.size,"/",h," selected"]})]}),e.jsxs("div",{style:{display:"flex",gap:8,marginBottom:12,flexWrap:"wrap"},children:[e.jsx("input",{type:"text",value:k,onChange:S=>j(S.target.value),placeholder:"Search attractions…",style:{flex:1,minWidth:150}}),e.jsx("button",{onClick:()=>b(""),style:{fontWeight:x?400:700},children:"All"}),a.map(S=>e.jsxs("button",{onClick:()=>b(S===x?"":S),style:{fontWeight:S===x?700:400,display:"inline-flex",alignItems:"center",gap:4},children:[o.createElement(Ze[S],{size:14})," ",Ps[S]]},S))]}),e.jsx("div",{style:{display:p==="grid"?"grid":"flex",gridTemplateColumns:p==="grid"?"repeat(auto-fill, minmax(200px, 1fr))":void 0,gap:12,flexDirection:p==="list"?"column":void 0},children:N.length===0?e.jsx("p",{children:"No attractions found."}):N.map(S=>{const R=T.has(S.id);return e.jsxs("div",{className:"nice-attraction-picker__card",style:{border:R?"2px solid var(--nice-color-primary, #6366f1)":"1px solid var(--nice-border-color, #cbd5e1)",borderRadius:8,padding:12,cursor:u?"default":"pointer",background:R?"color-mix(in srgb, var(--nice-color-primary) 12%, transparent)":"var(--nice-bg-elevated, var(--nice-bg-primary))",transition:"all 0.2s"},onClick:()=>$(S.id),children:[S.imageUrl&&e.jsx("img",{src:S.imageUrl,alt:S.name,style:{width:"100%",borderRadius:6,marginBottom:8,objectFit:"cover",maxHeight:120}}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6},children:[e.jsx("span",{style:{display:"inline-flex"},children:o.createElement(Ze[S.category],{size:16})}),e.jsx("strong",{children:S.name})]}),S.description&&e.jsx("p",{style:{fontSize:13,color:"var(--nice-text-secondary, #64748b)",margin:"6px 0"},children:S.description}),e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginTop:8},children:[t&&e.jsxs("span",{style:{fontSize:13,display:"inline-flex",alignItems:"center",gap:4},children:[e.jsx(M.NtdThumbsUp,{size:14})," ",S.votes??0]}),!u&&d&&e.jsx("button",{onClick:y=>{y.stopPropagation(),d(S.id)},style:{fontSize:12},children:"Vote"})]})]},S.id)})})]})}),Rs={game:M.NtdGamepad,music:M.NtdMusic,dance:M.NtdMusic,quiz:M.NtdHelp,karaoke:M.NtdMicrophone,photo:M.NtdCamera,custom:M.NtdSparkle},Es=o.forwardRef(function(s,c){const{attractions:n,onVote:r,onUnvote:l,votedIds:d=[],maxVotes:m,closed:h=!1,sortBy:t="votes",showResults:u=!0,className:p,style:_}=s,g=o.useMemo(()=>new Set(d),[d]),x=m?m-g.size:void 0,b=o.useMemo(()=>{const a=[...n];switch(t){case"votes":a.sort((N,f)=>(f.votes??0)-(N.votes??0));break;case"name":a.sort((N,f)=>N.name.localeCompare(f.name));break;case"category":a.sort((N,f)=>N.category.localeCompare(f.category));break}return a},[n,t]),k=o.useMemo(()=>Math.max(...n.map(a=>a.votes??0),1),[n]),j=a=>{h||(g.has(a)?l==null||l(a):(!x||x>0)&&(r==null||r(a)))},T=a=>{switch(a){case 0:return e.jsx(M.NtdTrophy,{size:18,primaryColor:"#f59e0b",title:"1st place"});case 1:return e.jsx(M.NtdMedal,{size:18,primaryColor:"#94a3b8",title:"2nd place"});case 2:return e.jsx(M.NtdMedal,{size:18,primaryColor:"#b45309",title:"3rd place"});default:return`${a+1}.`}};return e.jsxs("div",{ref:c,className:`nice-attraction-voting ${p??""}`,style:{color:"var(--nice-text-primary)",..._},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(M.NtdClipboardCheck,{size:20}),h?"Voting Results":"Vote for Attractions"]}),!h&&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"]})]}),h&&e.jsx("p",{style:{color:"var(--nice-text-secondary, #64748b)",marginBottom:12},children:"Voting is closed. Final results:"}),e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:8},children:b.map((a,N)=>{const f=g.has(a.id),$=a.votes??0,S=u?`${Math.round($/k*100)}%`:"0%";return e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12,padding:"10px 14px",borderRadius:8,border:f?"2px solid var(--nice-color-primary, #6366f1)":"1px solid var(--nice-border-color, #cbd5e1)",background:f?"color-mix(in srgb, var(--nice-color-primary) 12%, transparent)":"var(--nice-bg-elevated, var(--nice-bg-primary))",cursor:h?"default":"pointer",transition:"all 0.2s"},onClick:()=>j(a.id),children:[u&&e.jsx("span",{style:{fontSize:18,minWidth:32,textAlign:"center"},children:T(N)}),e.jsx("span",{style:{display:"inline-flex",fontSize:20},children:o.createElement(Rs[a.category],{size:20})}),e.jsxs("div",{style:{flex:1,minWidth:0},children:[e.jsx("div",{style:{fontWeight:600},children:a.name}),a.description&&e.jsx("div",{style:{fontSize:13,color:"var(--nice-text-secondary, #64748b)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:a.description}),u&&e.jsx("div",{style:{marginTop:4,height:6,borderRadius:3,background:"var(--nice-bg-tertiary, #e2e8f0)",overflow:"hidden"},children:e.jsx("div",{style:{height:"100%",width:S,background:"var(--nice-color-primary, #6366f1)",borderRadius:3,transition:"width 0.3s"}})})]}),u&&e.jsx("span",{style:{fontWeight:600,fontSize:16,minWidth:40,textAlign:"right"},children:$}),!h&&e.jsx("button",{onClick:R=>{R.stopPropagation(),j(a.id)},style:{padding:"4px 12px",borderRadius:4,border:"none",background:f?"var(--nice-color-error, #ef4444)":"var(--nice-color-primary, #6366f1)",color:"#fff",cursor:"pointer",fontSize:13},children:f?"Unvote":"Vote"})]},a.id)})}),u&&e.jsxs("div",{style:{marginTop:12,textAlign:"right",fontSize:13,color:"var(--nice-text-secondary, #64748b)"},children:["Total votes: ",n.reduce((a,N)=>a+(N.votes??0),0)]})]})});exports.NiceAttractionPicker=Bs;exports.NiceAttractionVoting=Es;exports.NiceEventMedia=Pn;exports.NiceEventPlanning=En;exports.NiceExpenseSplit=Ss;exports.NiceGiftRegistry=js;exports.NiceInvitationDesigner=fs;exports.NiceKaraokePicker=As;exports.NiceMediaCollage=Bn;exports.NiceParticipantList=Fn;exports.NiceRoundCard=Ts;exports.NiceRoundList=zs;exports.NiceRsvpControl=Pe;exports.NiceSeatPicker=ds;exports.NiceSeatingChart=tn;exports.NiceSongPicker=$s;
|
package/dist/index.d.ts
CHANGED
|
@@ -1434,6 +1434,20 @@ export declare interface VenueZone {
|
|
|
1434
1434
|
metadata?: Record<string, unknown>;
|
|
1435
1435
|
}
|
|
1436
1436
|
|
|
1437
|
+
export declare interface VenueZoneOccupancy {
|
|
1438
|
+
zoneId: string;
|
|
1439
|
+
/** Current count */
|
|
1440
|
+
current: number;
|
|
1441
|
+
/** Capacity */
|
|
1442
|
+
capacity: number;
|
|
1443
|
+
/** Level */
|
|
1444
|
+
level: OccupancyLevel;
|
|
1445
|
+
/** Percentage */
|
|
1446
|
+
percentage: number;
|
|
1447
|
+
/** Last updated */
|
|
1448
|
+
updatedAt: string;
|
|
1449
|
+
}
|
|
1450
|
+
|
|
1437
1451
|
/**
|
|
1438
1452
|
* Events & Venue Spatial Integration (EVT-001) —
|
|
1439
1453
|
* NiceVenueDesigner, NiceSeatingChartBuilder/Viewer,
|
|
@@ -1447,18 +1461,11 @@ export declare interface VenueZone {
|
|
|
1447
1461
|
*/
|
|
1448
1462
|
export declare type VenueZoneType = 'stage' | 'vip' | 'general' | 'standing' | 'seated' | 'bar' | 'food-court' | 'backstage' | 'entrance' | 'exit' | 'emergency-exit' | 'restroom' | 'parking' | 'press' | 'tech-booth' | 'medical' | 'security' | 'custom';
|
|
1449
1463
|
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
/** Level */
|
|
1457
|
-
level: OccupancyLevel;
|
|
1458
|
-
/** Percentage */
|
|
1459
|
-
percentage: number;
|
|
1460
|
-
/** Last updated */
|
|
1461
|
-
updatedAt: string;
|
|
1462
|
-
}
|
|
1464
|
+
/**
|
|
1465
|
+
* @deprecated Use `VenueZoneOccupancy`. `@nice2dev/ui-buildings` exports a different
|
|
1466
|
+
* `ZoneOccupancy` (a building sensor reading), so importing both packages collided;
|
|
1467
|
+
* this alias is removed in 1.2.0.
|
|
1468
|
+
*/
|
|
1469
|
+
export declare type ZoneOccupancy = VenueZoneOccupancy;
|
|
1463
1470
|
|
|
1464
1471
|
export { }
|