@nice2dev/ui 1.0.18 → 1.0.20
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 +64 -0
- package/dist/NiceErrorBoundary-Bzx-bOeb.cjs +1 -0
- package/dist/NiceErrorBoundary-DBCCmeyl.js +770 -0
- package/dist/NiceErrorBoundary-DvA00DOz.cjs +1 -0
- package/dist/NiceErrorBoundary-V6wkSSLP.cjs +1 -0
- package/dist/NiceErrorBoundary-eTwBEuSH.js +770 -0
- package/dist/NiceErrorBoundary-qp4IJ18o.js +770 -0
- package/dist/NiceForm-B1Okz7SW.cjs +382 -0
- package/dist/NiceForm-BXHPoTcH.cjs +382 -0
- package/dist/NiceForm-DL7Kxsi2.js +5383 -0
- package/dist/NiceForm-DLADlHAQ.js +5383 -0
- package/dist/NiceForm-DUkduLqG.cjs +382 -0
- package/dist/NiceForm-D_XZxq3a.js +5383 -0
- package/dist/NiceForm.css +1 -1
- package/dist/NiceModal-0Sg2HxIb.cjs +1 -0
- package/dist/NiceModal-BRih_XEH.js +95 -0
- package/dist/NiceModal-C4HIsjrn.js +95 -0
- package/dist/NiceModal-CUdeVj-j.js +95 -0
- package/dist/NiceModal-Cc8R-DpX.cjs +1 -0
- package/dist/NiceModal-DieswZtd.cjs +1 -0
- package/dist/NiceModuleLifecyclePanel-4UEsYB5r.js +6553 -0
- package/dist/NiceModuleLifecyclePanel-C6agdtTI.cjs +1 -0
- package/dist/NiceModuleLifecyclePanel-CEfeJxw_.cjs +1 -0
- package/dist/NiceModuleLifecyclePanel-D4xWUswk.js +6777 -0
- package/dist/NiceModuleLifecyclePanel-jDzEfvDM.js +6553 -0
- package/dist/NiceModuleLifecyclePanel-sBJLlhJp.cjs +1 -0
- package/dist/NiceModuleLifecyclePanel.css +1 -1
- package/dist/NicePagination-B2TC6MTL.cjs +1 -0
- package/dist/NicePagination-BAywVGwT.js +171 -0
- package/dist/NicePagination-Cqr3Pe_F.js +171 -0
- package/dist/NicePagination-DnnypBiE.js +171 -0
- package/dist/NicePagination-DyWWdtb3.cjs +1 -0
- package/dist/NicePagination-F8NyMfgc.cjs +1 -0
- package/dist/NicePinCodeInput-Bo8Ahkae.js +12240 -0
- package/dist/NicePinCodeInput-C6zJxUVf.cjs +419 -0
- package/dist/NicePinCodeInput-CpPtHZsK.js +12240 -0
- package/dist/NicePinCodeInput-Cpa01Yfg.cjs +419 -0
- package/dist/NicePinCodeInput-JvYd_LB_.cjs +419 -0
- package/dist/NicePinCodeInput-ltwzQf4r.js +12240 -0
- package/dist/NicePinCodeInput.css +1 -1
- package/dist/NiceSavedQueryPanel-BIXW0y1X.js +6455 -0
- package/dist/NiceSavedQueryPanel-BOBULytX.js +6455 -0
- package/dist/NiceSavedQueryPanel-CFHwMDIx.cjs +596 -0
- package/dist/NiceSavedQueryPanel-CTfC-qwV.cjs +596 -0
- package/dist/NiceSavedQueryPanel-DuonbEem.js +6584 -0
- package/dist/NiceSavedQueryPanel-MdKdGYNg.cjs +596 -0
- package/dist/NiceSavedQueryPanel.css +1 -1
- package/dist/NiceTabs-B9zxj6qd.js +1657 -0
- package/dist/NiceTabs-BjBtazRn.cjs +1 -0
- package/dist/NiceTabs-C-VQXNIa.cjs +1 -0
- package/dist/NiceTabs-CJ8G2t0-.js +1657 -0
- package/dist/NiceTabs-CNauJ4fu.cjs +1 -0
- package/dist/NiceTabs-v7HfeXIw.js +1657 -0
- package/dist/NiceWindow-BMiF-so6.cjs +1 -0
- package/dist/NiceWindow-Bo_yCa1o.js +1418 -0
- package/dist/NiceWindow-CysIgnn3.js +1418 -0
- package/dist/NiceWindow-D6SjpDc4.cjs +1 -0
- package/dist/NiceWindow-DPzJxOfx.cjs +1 -0
- package/dist/NiceWindow-DUTRQOaP.js +1418 -0
- package/dist/charts-C60va95_.js +4657 -0
- package/dist/charts-CJlMAHJG.cjs +761 -0
- package/dist/charts-CX4jiyVh.cjs +761 -0
- package/dist/charts-CYpqDxHd.js +4657 -0
- package/dist/charts-D_I1iwel.cjs +761 -0
- package/dist/charts-P6qura0j.js +4657 -0
- package/dist/charts.cjs +1 -1
- package/dist/charts.css +1 -1
- package/dist/charts.mjs +1 -1
- package/dist/core-Bcc4sz15.cjs +96 -0
- package/dist/core-BfeyB9A8.cjs +96 -0
- package/dist/core-BgGSTko-.js +22401 -0
- package/dist/core-DDJKu5LZ.cjs +96 -0
- package/dist/core-Da1dGJN3.js +22401 -0
- package/dist/core-XsWxyBHD.js +22767 -0
- package/dist/data.cjs +1 -1
- package/dist/data.d.ts +5 -0
- package/dist/data.mjs +1 -1
- package/dist/editors.cjs +1 -1
- package/dist/editors.d.ts +44 -1
- package/dist/editors.mjs +3 -3
- package/dist/feedback.cjs +1 -1
- package/dist/feedback.mjs +2 -2
- package/dist/index-CQIDqjZp.cjs +5194 -0
- package/dist/index-CXVXf_HY.cjs +5194 -0
- package/dist/index-CtikFbFa.js +64337 -0
- package/dist/index-DCDfWfAt.js +64336 -0
- package/dist/index-DpiCo0_e.cjs +5194 -0
- package/dist/index-xVJiF843.js +65040 -0
- package/dist/index.cjs +1 -1
- package/dist/index.css +1 -1
- package/dist/index.d.ts +450 -6
- package/dist/index.mjs +874 -860
- package/dist/lazy.cjs +1 -1
- package/dist/lazy.mjs +3 -3
- package/dist/navigation.cjs +1 -1
- package/dist/navigation.d.ts +50 -3
- package/dist/navigation.mjs +30 -30
- package/dist/overlays.cjs +1 -1
- package/dist/overlays.mjs +53 -53
- package/dist/style.css +6 -6
- package/package.json +3 -3
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const e=require("react/jsx-runtime"),O=require("./core-BfeyB9A8.cjs"),i=require("react"),Ke=require("react-dom"),J=require("./NiceTabs-BjBtazRn.cjs");function Wn(n,s){switch(s){case"bottom":return{left:n.left+n.width/2,top:n.bottom+6,transform:"translateX(-50%)"};case"left":return{left:n.left-6,top:n.top+n.height/2,transform:"translate(-100%, -50%)"};case"right":return{left:n.right+6,top:n.top+n.height/2,transform:"translateY(-50%)"};case"top":default:return{left:n.left+n.width/2,top:n.top-6,transform:"translate(-50%, -100%)"}}}const ce=({content:n,position:s="top",size:a="md",followCursor:l,children:t})=>{const[o,r]=i.useState(!1),[h,d]=i.useState({x:0,y:0}),[c,m]=i.useState(null),v=i.useId(),p=i.useRef(null),j=i.useCallback($=>{l&&d({x:$.clientX,y:$.clientY})},[l]);i.useLayoutEffect(()=>{if(!o||l)return;const $=()=>{const I=p.current;if(!I)return;const w=I.firstElementChild??I;m(w.getBoundingClientRect())};return $(),window.addEventListener("scroll",$,!0),window.addEventListener("resize",$),()=>{window.removeEventListener("scroll",$,!0),window.removeEventListener("resize",$)}},[o,l]);const C=i.cloneElement(t,{"aria-describedby":o?v:void 0}),g=o?(()=>{let $;if(l)$={position:"fixed",left:h.x+12,top:h.y+12};else if(c){const I=Wn(c,s);$={position:"fixed",left:I.left,top:I.top,transform:I.transform}}else $={position:"fixed",left:-9999,top:-9999};return e.jsx("span",{id:v,className:`nice-tooltip nice-tooltip--${s} nice-tooltip--${a} nice-tooltip--portaled`,role:"tooltip",style:$,children:n})})():null,f=typeof document<"u"?document.body:null;return e.jsxs("span",{ref:p,className:"nice-tooltip-wrapper",onMouseEnter:()=>r(!0),onMouseLeave:()=>r(!1),onMouseMove:j,onFocus:()=>r(!0),onBlur:()=>r(!1),children:[C,g!=null&&f!=null?Ke.createPortal(g,f):g]})};ce.displayName="NiceTooltip";const Pn=({items:n,multiple:s=!1,defaultOpen:a=[],size:l="md",width:t,maxWidth:o,animationDuration:r=220,className:h,style:d,displayStyle:c})=>{O.Ss("card",c);const[m,v]=i.useState(new Set(a)),p=i.useId(),j=i.useCallback(g=>{v(f=>{const $=new Set(f);return $.has(g)?$.delete(g):(s||$.clear(),$.add(g)),$})},[s]),C={...d,...t!==void 0?{width:typeof t=="number"?`${t}px`:t}:{},...o!==void 0?{maxWidth:typeof o=="number"?`${o}px`:o}:{},"--nice-accordion-anim":`${Math.max(0,r)}ms`};return e.jsx("div",{className:`nice-accordion nice-accordion--${l} ${h||""}`,style:C,children:n.map((g,f)=>{const $=m.has(g.id),I=`${p}-trigger-${f}`,w=`${p}-panel-${f}`;return e.jsxs("div",{className:"nice-accordion__item",children:[e.jsxs("button",{id:I,className:"nice-accordion__trigger",onClick:()=>!g.disabled&&j(g.id),"aria-expanded":$,"aria-controls":w,"aria-disabled":g.disabled,disabled:g.disabled,children:[e.jsx("span",{children:g.title}),e.jsx("svg",{className:`nice-accordion__chevron ${$?"nice-accordion__chevron--open":""}`,viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true",children:e.jsx("path",{fillRule:"evenodd",d:"M5.23 7.21a.75.75 0 011.06.02L10 11.168l3.71-3.938a.75.75 0 111.08 1.04l-4.25 4.5a.75.75 0 01-1.08 0l-4.25-4.5a.75.75 0 01.02-1.06z",clipRule:"evenodd"})})]}),$&&e.jsx("div",{id:w,className:"nice-accordion__content",role:"region","aria-labelledby":I,children:g.content})]},g.id)})})},Yn=({items:n,separator:s="/",size:a="md",className:l,style:t})=>e.jsx("nav",{className:`nice-breadcrumb nice-breadcrumb--${a} ${l||""}`,style:t,"aria-label":"Breadcrumb",children:n.map((o,r)=>e.jsxs(i.Fragment,{children:[r>0&&e.jsx("span",{className:"nice-breadcrumb__separator",children:s}),r===n.length-1?e.jsx("span",{className:"nice-breadcrumb__current","aria-current":"page",children:o.label}):e.jsx("span",{className:"nice-breadcrumb__item",children:e.jsx("a",{className:"nice-breadcrumb__link",href:o.href,onClick:h=>{o.onClick&&(h.preventDefault(),o.onClick())},children:o.label})})]},r))}),qe=({children:n,title:s,headerExtra:a,footer:l,hoverable:t,bordered:o=!0,onClick:r,size:h="md",className:d,style:c,displayStyle:m})=>{const v=O.vs("card",m),p=O.Ss("card",m);return e.jsxs("div",{className:`nice-card nice-card--${h} nice-card--ds-${p} ${o?"nice-card--bordered":"nice-card--frameless"} ${t?"nice-card--hoverable":""} ${r?"nice-card--clickable":""} ${d||""}`,style:{...v,...c},onClick:r,role:r?"button":void 0,tabIndex:r?0:void 0,children:[(s||a)&&e.jsxs("div",{className:"nice-card__header",children:[s&&e.jsx("h3",{className:"nice-card__title",children:s}),a]}),e.jsx("div",{className:"nice-card__body",children:n}),l&&e.jsx("div",{className:"nice-card__footer",children:l})]})},Un=Object.freeze(Object.defineProperty({__proto__:null,NiceCard:qe},Symbol.toStringTag,{value:"Module"}));function Me(n){return(n.id??n.key??"")+""}function Qe(n){return n.label??n.text??""}function De(n){return n.children??n.items}function Re(n){const s=De(n);return!s||s.length===0}function Ae(n,s){if(!s)return!1;if(Me(n)===s)return!0;const a=De(n);return a?a.some(l=>Ae(l,s)):!1}const Xe=({items:n,orientation:s="horizontal",variant:a="ghost",density:l="normal",size:t="md",fullWidth:o=!1,showDividers:r=!1,panelAlign:h="start",panelMinWidth:d=200,panelMaxWidth:c=360,itemGap:m,paddingX:v,paddingY:p,portal:j=!0,panelZIndex:C=1100,arrowIcon:g="▾",flyoutArrowIcon:f="▸",closeOnSelect:$=!0,openTrigger:I="click",openDelay:w=120,closeDelay:x=180,onOpenChange:k,activeId:L,activeKey:M,onItemClick:E,ariaLabel:D="Menu",renderTriggerLabel:N,renderEntryLabel:R,maxDepth:b=3,className:u,style:_,id:T,accessMode:Y,displayStyle:B})=>{const H=O.Ss("menu",B),S=O.vs("menu",B),F=i.useContext(O.lr)?.portalTarget??(typeof document<"u"?document.body:null),U=O.Zs(Y,T),ae=U==="hidden",V=U==="disabled"||U==="readOnly",K=i.useId(),le=L??M,_e=Math.min(10,Math.max(1,b)),[se,W]=i.useState(null),[ue,ie]=i.useState([]),z=i.useRef(null),P=i.useRef(null);i.useEffect(()=>{k?.(se)},[se,k]);const ne=i.useCallback(()=>{z.current!=null&&(window.clearTimeout(z.current),z.current=null),P.current!=null&&(window.clearTimeout(P.current),P.current=null)},[]);i.useEffect(()=>()=>ne(),[ne]);const te=i.useCallback(A=>{ne(),se!==A&&(z.current=window.setTimeout(()=>{W(A),ie([])},Math.max(0,w)))},[ne,se,w]),pe=i.useCallback(()=>{ne(),P.current=window.setTimeout(()=>{W(null),ie([])},Math.max(0,x))},[ne,x]),[Ne,re]=i.useState(-1),[ge,de]=i.useState(-1),[fe,ye]=i.useState(null),ke=i.useRef(null),Ce=i.useRef(null),xe=i.useRef(new Map),je=i.useCallback(()=>{if(!se){ye(null);return}const A=xe.current.get(se);if(!A)return;const X=A.getBoundingClientRect();ye(s==="vertical"?{left:X.right,top:X.top,width:X.width}:{left:X.left,top:X.bottom,width:X.width})},[se,s]);i.useLayoutEffect(()=>{j&&je()},[j,je]),i.useEffect(()=>{if(!j||!se)return;const A=()=>je();return window.addEventListener("scroll",A,!0),window.addEventListener("resize",A),()=>{window.removeEventListener("scroll",A,!0),window.removeEventListener("resize",A)}},[j,se,je]);const me=i.useMemo(()=>n.filter(A=>Me(A).length>0),[n]),ve=i.useCallback(()=>{W(null),ie([]),de(-1)},[]);i.useEffect(()=>{if(!se)return;const A=ee=>{const Q=ee.target;ke.current&&ke.current.contains(Q)||Ce.current&&Ce.current.contains(Q)||ve()},X=ee=>{ee.key==="Escape"&&ve()};return document.addEventListener("mousedown",A),document.addEventListener("keydown",X),()=>{document.removeEventListener("mousedown",A),document.removeEventListener("keydown",X)}},[se,ve]);const $e=(A,X)=>{if(A.disabled||V)return;const ee=Me(A);if(Re(A)){A.onClick?.(X),E?.(A,X),$&&ve();return}ie([]),W(se===ee?null:ee),de(-1)},Ie=i.useCallback((A,X)=>{ie(ee=>{const Q=A-2;if(Q<0)return ee;if(ee[Q]===X)return ee.slice(0,Q);const he=ee.slice(0,Q);return he[Q]=X,he})},[]),Le=(A,X)=>{A.disabled||(A.onClick?.(X),E?.(A,X),$&&ve())},y=A=>{if(V)return;const X=s==="horizontal",ee=X?"ArrowLeft":"ArrowUp",Q=X?"ArrowRight":"ArrowDown";if(A.key===ee)A.preventDefault(),re(be=>be<=0?me.length-1:be-1);else if(A.key===Q)A.preventDefault(),re(be=>be>=me.length-1?0:be+1);else if(A.key==="Home")A.preventDefault(),re(0);else if(A.key==="End")A.preventDefault(),re(me.length-1);else if(A.key==="Enter"||A.key===" "){A.preventDefault();const be=me[Ne];be&&$e(be,A)}else A.key==="Escape"&&ve()};if(ae)return null;const G=["nice-menu",`nice-menu--orientation-${s}`,`nice-menu--variant-${a}`,`nice-menu--density-${l}`,`nice-menu--size-${t}`,o?"nice-menu--full-width":"",r?"nice-menu--show-dividers":"",H??"",u??""].filter(Boolean).join(" "),q={...S,..._,"--nice-menu-panel-min-w":`${d}px`,"--nice-menu-panel-max-w":`${c}px`};return m!==void 0&&(q["--nice-menu-gap"]=typeof m=="number"?`${m}px`:m),v!==void 0&&(q["--nice-menu-padding-x"]=typeof v=="number"?`${v}px`:v),p!==void 0&&(q["--nice-menu-padding-y"]=typeof p=="number"?`${p}px`:p),e.jsx("nav",{id:T,ref:ke,className:G,style:q,"aria-label":D,children:e.jsx("ul",{className:"nice-menu__list",role:"menubar",onKeyDown:y,tabIndex:0,children:me.map((A,X)=>{const ee=Me(A),Q=se===ee,be=!!le&&Ae(A,le),he=!Re(A),Bn=["nice-menu__item",Q?"nice-menu__item--open":"",be?"nice-menu__item--active":"",A.disabled?"nice-menu__item--disabled":"",A.danger?"nice-menu__item--danger":"",he?"nice-menu__item--has-children":"",Ne===X?"nice-menu__item--focused":""].filter(Boolean).join(" "),Fn=N?N(A):Qe(A),Pe=e.jsxs(e.Fragment,{children:[A.icon?e.jsx("span",{className:"nice-menu__icon",children:A.icon}):null,e.jsx("span",{className:"nice-menu__label",children:Fn}),A.badge!=null?e.jsx("span",{className:"nice-menu__badge",children:A.badge}):null,he?e.jsx("span",{className:"nice-menu__arrow","aria-hidden":!0,children:g}):null]});return e.jsxs("li",{className:Bn,role:"none","data-nice-menu-id":ee,"data-nice-depth":1,onMouseEnter:he&&(I==="hover"||I==="both")?()=>te(ee):void 0,onMouseLeave:he&&(I==="hover"||I==="both")?()=>pe():void 0,children:[A.href&&!he?e.jsx("a",{ref:oe=>{oe?xe.current.set(ee,oe):xe.current.delete(ee)},className:"nice-menu__btn",href:A.href,target:A.target,rel:A.rel,role:"menuitem","aria-disabled":A.disabled||void 0,"aria-label":A.ariaLabel,tabIndex:Ne===X?0:-1,onClick:oe=>$e(A,oe),onFocus:()=>re(X),children:Pe}):e.jsx("button",{ref:oe=>{oe?xe.current.set(ee,oe):xe.current.delete(ee)},type:"button",className:"nice-menu__btn",disabled:A.disabled||V,role:"menuitem","aria-haspopup":he||void 0,"aria-expanded":he?Q:void 0,"aria-controls":he?`${K}-panel-${ee}`:void 0,"aria-label":A.ariaLabel,tabIndex:Ne===X?0:-1,onClick:oe=>$e(A,oe),onFocus:()=>re(X),children:Pe}),he&&Q?(()=>{const oe=j&&typeof document<"u"&&!!fe&&!!F,Hn=oe?{position:"fixed",left:fe.left,top:fe.top,minWidth:Math.max(d,fe.width),maxWidth:c,zIndex:C}:{zIndex:C},Ye=e.jsx(Je,{items:De(A)??[],depth:2,maxDepth:_e,openPath:ue,onToggleBranch:Ie,onLeafClick:Le,effectiveActiveId:le,renderEntryLabel:R,flyoutArrowIcon:f,openTrigger:I,onPanelEnter:()=>ne(),onPanelLeave:()=>pe(),panelClassName:["nice-menu__panel",`nice-menu__panel--align-${h}`,oe?"nice-menu__panel--portal":""].filter(Boolean).join(" "),panelStyle:Hn,panelId:`${K}-panel-${ee}`,panelRef:oe?Ce:void 0,focusedEntryIdx:ge,setFocusedEntryIdx:de});return oe?Ke.createPortal(Ye,F):Ye})():null]},ee)})})})};Xe.displayName="NiceMenu";function Je({items:n,depth:s,maxDepth:a,openPath:l,onToggleBranch:t,onLeafClick:o,effectiveActiveId:r,renderEntryLabel:h,flyoutArrowIcon:d,openTrigger:c,onPanelEnter:m,onPanelLeave:v,panelClassName:p,panelStyle:j,panelId:C,panelRef:g,focusedEntryIdx:f,setFocusedEntryIdx:$}){const I=Math.min(Math.max(s,1),10),w=s===2,x=p??(w?"nice-menu__panel":"nice-menu__subpanel"),L={...{"--nice-row-bg":`var(--nice-menu-level-${I}-bg, var(--bg-elevated, var(--bg-primary)))`,"--nice-row-text":`var(--nice-menu-level-${I}-text, var(--text-primary))`,"--nice-row-border":`var(--nice-menu-level-${I}-border, var(--border-color))`,"--nice-row-hover-bg":`var(--nice-menu-level-${I}-hover-bg, var(--hover-bg))`,"--nice-row-active-bg":`var(--nice-menu-level-${I}-active-bg, var(--selected-bg))`},...j??{}},M=c==="hover"||c==="both"?{onMouseEnter:m,onMouseLeave:v}:{};return e.jsx("div",{ref:g,id:C,className:x,style:L,role:"menu","data-nice-depth":s,...M,children:n.map((E,D)=>{if(E.divider)return e.jsx("hr",{className:"nice-menu__divider"},`d-${D}`);const N=Me(E),b=!Re(E)&&s<a,u=l[s-2]===N,_=!!r&&Ae(E,r),T=["nice-menu__entry",E.disabled?"nice-menu__entry--disabled":"",E.danger?"nice-menu__entry--danger":"",_?"nice-menu__entry--active":"",w&&f===D?"nice-menu__entry--focused":""].filter(Boolean).join(" "),Y=e.jsxs(e.Fragment,{children:[E.icon?e.jsx("span",{className:"nice-menu__icon",children:E.icon}):null,e.jsxs("span",{className:"nice-menu__entry-content",children:[e.jsxs("span",{className:"nice-menu__entry-label",children:[h?h(E):Qe(E),E.badge!=null?e.jsx("span",{className:"nice-menu__badge",children:E.badge}):null]}),E.description?e.jsx("span",{className:"nice-menu__entry-desc",children:E.description}):null]}),b?e.jsx("span",{className:"nice-menu__entry-arrow","aria-hidden":!0,children:d}):null]}),B=S=>{b?t(s,N):o(E,S)},H=w?()=>$?.(D):void 0;return e.jsxs("div",{style:{position:"relative"},onMouseEnter:b?()=>t(s,N):void 0,children:[E.href&&!b?e.jsx("a",{className:T,href:E.href,target:E.target,rel:E.rel,role:"menuitem","aria-disabled":E.disabled||void 0,"aria-label":E.ariaLabel,onClick:B,onFocus:H,children:Y}):e.jsx("button",{type:"button",className:T,disabled:E.disabled,role:"menuitem","aria-haspopup":b||void 0,"aria-expanded":b?u:void 0,"aria-label":E.ariaLabel,onClick:B,onFocus:H,children:Y}),b&&u?e.jsx(Je,{items:De(E)??[],depth:s+1,maxDepth:a,openPath:l,onToggleBranch:t,onLeafClick:o,effectiveActiveId:r,renderEntryLabel:h,flyoutArrowIcon:d,openTrigger:c}):null]},N||`c-${D}`)})})}const Be=({items:n,target:s,onItemClick:a,size:l="md",className:t,style:o})=>{const[r,h]=i.useState(null),d=i.useRef(null);return O.$s(d,()=>h(null)),i.useEffect(()=>{const c=s.current;if(!c)return;const m=v=>{v.preventDefault(),h({x:v.clientX,y:v.clientY})};return c.addEventListener("contextmenu",m),()=>c.removeEventListener("contextmenu",m)},[s]),r?e.jsx("div",{ref:d,className:`nice-contextmenu nice-contextmenu--${l} ${t||""}`,style:{position:"fixed",left:r.x,top:r.y,zIndex:1e4,...o},children:e.jsx("ul",{className:"nice-contextmenu__list",role:"menu",children:n.map((c,m)=>e.jsx("li",{className:`nice-contextmenu__item ${c.disabled?"nice-contextmenu__item--disabled":""}`,role:"none",children:e.jsxs("button",{type:"button",className:"nice-contextmenu__btn",disabled:c.disabled,"aria-disabled":c.disabled,role:"menuitem",onClick:v=>{c.onClick?.(v),a?.(c),h(null)},children:[c.icon&&e.jsx("span",{className:"nice-contextmenu__icon","aria-hidden":"true",children:c.icon}),e.jsx("span",{children:c.label??c.text??""})]})},c.id??c.key??m))})}):null},Vn=({items:n,selectedIndex:s,onSelectedIndexChange:a,animationEnabled:l=!0,nav:t="tabs",showArrows:o,autoPlay:r=0,size:h="md",className:d,style:c,accessMode:m,id:v})=>{const j=O.Zs(m,v)==="hidden",[C,g]=i.useState(0),f=s??C,[$,I]=i.useState("right"),w=i.useRef(null),x=i.useCallback(b=>{I(b>f?"right":"left"),a?a(b):g(b)},[f,a]),k=i.useCallback(()=>x((f+1)%n.length),[x,f,n.length]),L=i.useCallback(()=>x((f-1+n.length)%n.length),[x,f,n.length]);i.useEffect(()=>{if(r>0&&n.length>1)return w.current=setInterval(k,r),()=>{w.current&&clearInterval(w.current)}},[r,k,n.length]);const M=i.useCallback(b=>{b.key==="ArrowRight"||b.key==="ArrowDown"?(b.preventDefault(),k()):(b.key==="ArrowLeft"||b.key==="ArrowUp")&&(b.preventDefault(),L())},[k,L]),E=n[f];if(!E)return null;const D=o??(t==="dots"||t==="arrows"||t==="none"),N=t==="tabs",R=t==="dots";return j?null:e.jsxs("div",{className:["nice-multiview",`nice-multiview--${h}`,l?"nice-multiview--animated":"",d].filter(Boolean).join(" "),style:c,onKeyDown:M,tabIndex:0,role:"region","aria-roledescription":"carousel","aria-label":"Multi-view",children:[N&&e.jsx("div",{className:"nice-multiview__tabs",role:"tablist",children:n.map((b,u)=>e.jsxs("button",{role:"tab","aria-selected":u===f,className:["nice-multiview__tab",u===f?"nice-multiview__tab--active":""].filter(Boolean).join(" "),onClick:()=>x(u),children:[b.icon&&e.jsx("span",{className:"nice-multiview__tab-icon",children:b.icon}),b.label&&e.jsx("span",{className:"nice-multiview__tab-label",children:b.label}),!b.label&&!b.icon&&e.jsx("span",{className:"nice-multiview__tab-label",children:b.key})]},b.key))}),e.jsxs("div",{className:"nice-multiview__viewport",children:[D&&n.length>1&&e.jsx("button",{className:"nice-multiview__arrow nice-multiview__arrow--prev",onClick:L,"aria-label":"Previous",children:"‹"}),e.jsx("div",{className:["nice-multiview__content",l?`nice-multiview__content--slide-${$}`:""].filter(Boolean).join(" "),role:"tabpanel",children:E.render()},E.key),D&&n.length>1&&e.jsx("button",{className:"nice-multiview__arrow nice-multiview__arrow--next",onClick:k,"aria-label":"Next",children:"›"})]}),R&&n.length>1&&e.jsx("div",{className:"nice-multiview__dots",children:n.map((b,u)=>e.jsx("button",{className:["nice-multiview__dot",u===f?"nice-multiview__dot--active":""].filter(Boolean).join(" "),onClick:()=>x(u),"aria-label":`View ${u+1}`},b.key))}),t==="arrows"&&n.length>1&&e.jsxs("div",{className:"nice-multiview__counter",children:[f+1," / ",n.length]})]})},Zn=({items:n,selectedKey:s,onSelectedKeyChange:a,tabPosition:l="top",size:t="md",className:o,style:r,displayStyle:h})=>{O.Ss("tab",h);const[d,c]=i.useState(n[0]?.key??""),m=s??d,v=g=>{a?a(g):c(g)},p=n.find(g=>g.key===m),j=l==="left"||l==="right",C=e.jsx("div",{className:"nice-tabpanel__tabs",role:"tablist",style:{display:"flex",flexDirection:j?"column":"row"},children:n.map(g=>e.jsxs("button",{type:"button",role:"tab",className:`nice-tabpanel__tab ${g.key===m?"nice-tabpanel__tab--active":""}`,disabled:g.disabled,onClick:()=>!g.disabled&&v(g.key),"aria-selected":g.key===m,children:[g.icon&&e.jsx("span",{className:"nice-tabpanel__tab-icon",children:g.icon}),e.jsx("span",{children:g.title}),g.badge&&e.jsx("span",{className:"nice-tabpanel__tab-badge",children:g.badge})]},g.key))});return e.jsxs("div",{className:`nice-tabpanel nice-tabpanel--${l} ${o||""}`,style:{display:"flex",flexDirection:j?"row":"column",...r},children:[(l==="top"||l==="left")&&C,e.jsx("div",{className:"nice-tabpanel__content",role:"tabpanel",children:p?.render()}),(l==="bottom"||l==="right")&&C]})},Kn=({panes:n,orientation:s="horizontal",gutterSize:a=6,onResize:l,className:t,style:o,accessMode:r,id:h})=>{const c=O.Zs(r,h)==="hidden",m=i.useRef(null),[v,p]=i.useState(()=>n.map(()=>100/n.length)),j=i.useCallback((g,f)=>{f.preventDefault();const $=m.current;if(!$)return;const I=s==="horizontal",w=I?$.offsetWidth:$.offsetHeight,x=I?f.clientX:f.clientY,k=[...v],L=E=>{const D=((I?E.clientX:E.clientY)-x)/w*100,N=[...k],R=n[g].minSize?n[g].minSize/w*100:5,b=n[g+1].minSize?n[g+1].minSize/w*100:5;let u=k[g]+D,_=k[g+1]-D;u<R&&(u=R,_=k[g]+k[g+1]-R),_<b&&(_=b,u=k[g]+k[g+1]-b),N[g]=u,N[g+1]=_,p(N),l?.(N)},M=()=>{document.removeEventListener("pointermove",L),document.removeEventListener("pointerup",M)};document.addEventListener("pointermove",L),document.addEventListener("pointerup",M)},[v,s,n,l]),C=s==="horizontal";return c?null:e.jsx("div",{ref:m,className:`nice-splitter nice-splitter--${s} ${t||""}`,style:{display:"flex",flexDirection:C?"row":"column",height:"100%",...o},children:n.map((g,f)=>e.jsxs(i.Fragment,{children:[e.jsx("div",{className:"nice-splitter__pane",style:{[C?"width":"height"]:`calc(${v[f]}% - ${a*(n.length-1)/n.length}px)`,overflow:"auto"},children:g.render()}),f<n.length-1&&e.jsx("div",{className:`nice-splitter__gutter nice-splitter__gutter--${s}`,style:{[C?"width":"height"]:a,cursor:C?"col-resize":"row-resize",flexShrink:0},onPointerDown:$=>j(f,$)})]},g.key))})},qn=({items:n,size:s="md",className:a,style:l,accessMode:t,id:o})=>{const h=O.Zs(t,o)==="hidden",d=n.filter(p=>!p.location||p.location==="before"),c=n.filter(p=>p.location==="center"),m=n.filter(p=>p.location==="after"),v=p=>p.widget==="separator"?e.jsx("div",{className:"nice-toolbar__separator"},p.key):p.widget==="spacer"?e.jsx("div",{className:"nice-toolbar__spacer",style:{flex:1}},p.key):p.render?e.jsx("div",{className:"nice-toolbar__custom",children:p.render()},p.key):e.jsxs("button",{type:"button",className:`nice-toolbar__btn nice-btn nice-btn--ghost nice-btn--${s}`,disabled:p.disabled,onClick:p.onClick,children:[p.icon&&e.jsx("span",{className:"nice-toolbar__icon",children:p.icon}),p.text&&e.jsx("span",{children:p.text})]},p.key);return h?null:e.jsxs("div",{className:`nice-toolbar ${a||""}`,style:{display:"flex",alignItems:"center",gap:4,...l},children:[e.jsx("div",{className:"nice-toolbar__section nice-toolbar__section--before",style:{display:"flex",alignItems:"center",gap:4},children:d.map(v)}),c.length>0&&e.jsx("div",{className:"nice-toolbar__section nice-toolbar__section--center",style:{display:"flex",alignItems:"center",gap:4,flex:1,justifyContent:"center"},children:c.map(v)}),e.jsx("div",{className:"nice-toolbar__section nice-toolbar__section--after",style:{display:"flex",alignItems:"center",gap:4,marginLeft:c.length===0?"auto":void 0},children:m.map(v)})]})},Ge=({steps:n,activeStep:s,orientation:a="horizontal",onStepClick:l,allowStepClick:t=!1,showStepNumbers:o=!0,className:r,style:h})=>{const{t:d}=O.$o();return e.jsxs("div",{className:`nice-stepper nice-stepper--${a} ${r||""}`,style:h,children:[e.jsx("div",{className:"nice-stepper__header",children:n.map((c,m)=>{const v=m<s,j=v?"nice-stepper__step--completed":m===s?"nice-stepper__step--active":"";return e.jsxs(i.Fragment,{children:[m>0&&e.jsx("div",{className:`nice-stepper__connector ${v?"nice-stepper__connector--completed":""}`}),e.jsxs("div",{className:`nice-stepper__step ${j}`,onClick:()=>t&&l?.(m),style:{cursor:t?"pointer":void 0},children:[e.jsx("div",{className:"nice-stepper__indicator",children:c.icon?c.icon:v?"✓":o?m+1:""}),e.jsxs("div",{className:"nice-stepper__labels",children:[e.jsx("div",{className:"nice-stepper__title",children:c.title}),c.subtitle&&e.jsx("div",{className:"nice-stepper__subtitle",children:c.subtitle}),c.optional&&e.jsx("div",{className:"nice-stepper__optional",children:d("optional","Optional")})]})]})]},m)})}),n[s]?.content&&e.jsx("div",{className:"nice-stepper__content",children:n[s].content})]})},en=i.forwardRef(({panels:n,columns:s=12,rowHeight:a=80,gap:l=8,draggable:t=!0,resizable:o=!0,onLayoutChange:r,className:h,style:d,id:c},m)=>{const v=O.Hs(c),[p,j]=i.useState(null),C=i.useRef(null),g=i.useCallback((k,L)=>{t&&(j(L),k.dataTransfer.effectAllowed="move")},[t]),f=i.useCallback((k,L)=>{if(k.preventDefault(),!p||p===L)return;const M=n.find(N=>N.key===p),E=n.find(N=>N.key===L);if(!M||!E)return;const D=n.map(N=>N.key===p?{...N,col:E.col,row:E.row}:N.key===L?{...N,col:M.col,row:M.row}:N);r?.(D),j(null)},[p,n,r]),$=i.useCallback(k=>{k.preventDefault()},[]),I=i.useRef(null);i.useEffect(()=>{if(!o)return;const k=M=>{if(!I.current||!C.current)return;const{key:E,startX:D,startY:N,cs:R,rs:b}=I.current,u=M.clientX-D,_=M.clientY-N,T=C.current.clientWidth/s,Y=Math.max(1,R+Math.round(u/T)),B=Math.max(1,b+Math.round(_/a)),H=n.map(S=>S.key===E?{...S,colSpan:Y,rowSpan:B}:S);r?.(H)},L=()=>{I.current=null};return document.addEventListener("mousemove",k),document.addEventListener("mouseup",L),()=>{document.removeEventListener("mousemove",k),document.removeEventListener("mouseup",L)}},[o,n,s,a,r]);const w=i.useCallback((k,L,M,E)=>{k.stopPropagation(),I.current={key:L,startX:k.clientX,startY:k.clientY,cs:M,rs:E}},[]),x=Math.max(...n.map(k=>k.row+(k.rowSpan??1)),1);return e.jsx("div",{ref:m,id:v,className:`nice-dashboard ${h||""}`,style:d,children:e.jsx("div",{ref:C,className:"nice-dashboard__grid",style:{display:"grid",gridTemplateColumns:`repeat(${s}, 1fr)`,gridTemplateRows:`repeat(${x}, ${a}px)`,gap:l},children:n.map(k=>e.jsxs("div",{className:`nice-dashboard__panel${p===k.key?" nice-dashboard__panel--dragging":""}`,style:{gridColumn:`${k.col+1} / span ${k.colSpan??1}`,gridRow:`${k.row+1} / span ${k.rowSpan??1}`},draggable:t,onDragStart:L=>g(L,k.key),onDragOver:$,onDrop:L=>f(L,k.key),children:[e.jsx("div",{className:"nice-dashboard__panel-content",children:k.render()}),o&&e.jsx("div",{className:"nice-dashboard__resize-handle",onMouseDown:L=>w(L,k.key,k.colSpan??1,k.rowSpan??1)})]},k.key))})})});en.displayName="NiceDashboardLayout";const nn=i.forwardRef(({header:n,sidebar:s,sidebarWidth:a=260,sidebarCollapsed:l,onToggleSidebar:t,children:o,footer:r,className:h,style:d,id:c},m)=>{const v=O.Hs(c),[p,j]=i.useState(!1),C=l??p,g=i.useCallback(()=>{const f=!C;j(f),t?.(f)},[C,t]);return e.jsxs("div",{ref:m,id:v,className:`nice-app-layout${C?" nice-app-layout--collapsed":""} ${h||""}`,style:d,children:[n&&e.jsx("header",{className:"nice-app-layout__header",children:n}),e.jsxs("div",{className:"nice-app-layout__body",children:[s&&e.jsx("aside",{className:"nice-app-layout__sidebar",style:{width:C?0:a,overflow:"hidden",transition:"width 0.2s"},children:!C&&s}),s&&e.jsx("button",{type:"button",className:"nice-app-layout__sidebar-toggle",onClick:g,"aria-label":C?"Open sidebar":"Close sidebar",children:C?"☰":"✕"}),e.jsx("main",{className:"nice-app-layout__content",children:o})]}),r&&e.jsx("footer",{className:"nice-app-layout__footer",children:r})]})});nn.displayName="NiceAppLayout";const sn=i.forwardRef(({items:n,activeKey:s,onChange:a,size:l="md",showLabels:t=!0,className:o,style:r,id:h},d)=>{const c=O.Hs(h);return e.jsx("nav",{ref:d,id:c,className:`nice-bottom-nav nice-bottom-nav--${l} ${o||""}`,style:r,role:"navigation",children:n.map(m=>e.jsxs("button",{type:"button",className:`nice-bottom-nav__item${s===m.key?" nice-bottom-nav__item--active":""}${m.disabled?" nice-bottom-nav__item--disabled":""}`,onClick:()=>!m.disabled&&a?.(m.key),disabled:m.disabled,"aria-current":s===m.key?"page":void 0,children:[m.icon&&e.jsx("span",{className:"nice-bottom-nav__icon",children:m.icon}),t&&e.jsx("span",{className:"nice-bottom-nav__label",children:m.label})]},m.key))})});sn.displayName="NiceBottomNavigation";const an=i.forwardRef(({items:n,position:s="bottom",size:a="md",magnify:l=!0,magnifyScale:t=1.5,activeKey:o,onItemClick:r,contained:h=!1,className:d,style:c,id:m,...v},p)=>{const j=O.Hs(m),{t:C}=O.$o(),[g,f]=i.useState(null),$=i.useCallback(w=>{if(!l||g===null)return 1;const x=Math.abs(w-g);return x===0?t:x===1?1+(t-1)*.5:x===2?1+(t-1)*.2:1},[l,g,t]),I=s==="left"||s==="right";return e.jsx("div",{ref:p,id:j,className:`nice-dock nice-dock--${s} nice-dock--${a}${h?" nice-dock--contained":""} ${d??""}`,style:c,role:"toolbar","aria-label":C("dock.label","Dock"),...v,children:e.jsx("div",{className:"nice-dock__bar",style:{flexDirection:I?"column":"row"},children:n.map((w,x)=>{const k=$(x);return e.jsxs("button",{type:"button",className:`nice-dock__item ${o===w.key?"nice-dock__item--active":""} ${w.disabled?"nice-dock__item--disabled":""}`,style:{transform:`scale(${k})`,transition:"transform 0.15s ease-out"},disabled:w.disabled,onClick:()=>r?.(w.key),onMouseEnter:()=>f(x),onMouseLeave:()=>f(null),"aria-label":w.label,title:w.label,children:[e.jsx("span",{className:"nice-dock__icon",children:w.icon}),w.badge!==void 0&&e.jsx("span",{className:"nice-dock__badge",children:w.badge})]},w.key)})})})});an.displayName="NiceDock";const ln=({items:n,label:s,icon:a,position:l,onItemClick:t})=>{const{t:o}=O.$o(),[r,h]=i.useState(!1),[d,c]=i.useState(null),m=i.useRef(null);i.useEffect(()=>{if(!r)return;const j=C=>{m.current&&!m.current.contains(C.target)&&(h(!1),c(null))};return document.addEventListener("mousedown",j),()=>document.removeEventListener("mousedown",j)},[r]),i.useEffect(()=>{if(!r)return;const j=C=>{C.key==="Escape"&&(h(!1),c(null))};return document.addEventListener("keydown",j),()=>document.removeEventListener("keydown",j)},[r]);const v=l==="bottom"?"bottom-start":l==="top"?"top-start":l==="left"?"left-start":"right-start",p=i.useCallback(j=>{if(j.children&&j.children.length>0){c(d===j.key?null:j.key);return}j.onClick?.(),t?.(j.key),h(!1),c(null)},[t,d]);return e.jsxs("div",{className:"nice-desktop__start",ref:m,children:[e.jsxs("button",{type:"button",className:`nice-desktop__start-btn ${r?"nice-desktop__start-btn--active":""}`,onClick:()=>h(!r),"aria-expanded":r,"aria-haspopup":"menu","aria-label":o("desktop.start","Start"),children:[a&&e.jsx("span",{className:"nice-desktop__start-icon",children:a}),s&&e.jsx("span",{className:"nice-desktop__start-label",children:s}),!a&&!s&&e.jsx("span",{className:"nice-desktop__start-label",children:o("desktop.start","Start")})]}),r&&e.jsx("div",{className:`nice-desktop__start-menu nice-desktop__start-menu--${v}`,role:"menu",children:n.map(j=>e.jsxs(i.Fragment,{children:[j.divider&&e.jsx("div",{className:"nice-desktop__start-divider"}),e.jsxs("div",{className:"nice-desktop__start-item-wrap",children:[e.jsxs("button",{type:"button",className:`nice-desktop__start-item ${d===j.key?"nice-desktop__start-item--open":""}`,disabled:j.disabled,onClick:()=>p(j),role:"menuitem",children:[j.icon&&e.jsx("span",{className:"nice-desktop__start-item-icon",children:j.icon}),e.jsx("span",{className:"nice-desktop__start-item-label",children:j.label}),j.children&&j.children.length>0&&e.jsx("span",{className:"nice-desktop__start-item-arrow",children:"▸"})]}),j.children&&d===j.key&&e.jsx("div",{className:"nice-desktop__start-submenu",role:"menu",children:j.children.map(C=>e.jsxs("button",{type:"button",className:"nice-desktop__start-item",disabled:C.disabled,onClick:()=>p(C),role:"menuitem",children:[C.icon&&e.jsx("span",{className:"nice-desktop__start-item-icon",children:C.icon}),e.jsx("span",{className:"nice-desktop__start-item-label",children:C.label})]},C.key))})]})]},j.key))})]})},Oe=({items:n,position:s,size:a,startMenu:l,systemTray:t,onItemClick:o})=>{const h=s==="left"||s==="right"?{width:a,height:"100%"}:{height:a,width:"100%"};return e.jsxs("div",{className:`nice-desktop__taskbar nice-desktop__taskbar--${s}`,style:h,role:"toolbar","aria-label":"Taskbar",children:[l,e.jsx("div",{className:"nice-desktop__taskbar-items",children:n.map(d=>e.jsxs("button",{type:"button",className:`nice-desktop__taskbar-btn ${d.active?"nice-desktop__taskbar-btn--active":""} ${d.minimized?"nice-desktop__taskbar-btn--minimized":""}`,onClick:()=>o?.(d.key),title:d.label,children:[d.icon&&e.jsx("span",{className:"nice-desktop__taskbar-btn-icon",children:d.icon}),e.jsx("span",{className:"nice-desktop__taskbar-btn-label",children:d.label}),d.badge!==void 0&&e.jsx("span",{className:"nice-desktop__taskbar-btn-badge",children:d.badge})]},d.key))}),t]})},tn=({items:n,showClock:s=!0,onItemClick:a})=>{const[l,t]=i.useState(()=>new Date);return i.useEffect(()=>{if(!s)return;const o=setInterval(()=>t(new Date),3e4);return()=>clearInterval(o)},[s]),e.jsxs("div",{className:"nice-desktop__tray",children:[n.map(o=>e.jsx("button",{type:"button",className:"nice-desktop__tray-item",title:o.tooltip,onClick:()=>{o.onClick?.(),a?.(o.key)},children:o.icon},o.key)),s&&e.jsx("span",{className:"nice-desktop__tray-clock",children:l.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})})]})},cn=({icons:n,gridColumns:s,iconSize:a,onIconClick:l,onIconDoubleClick:t})=>{const[o,r]=i.useState(null),h=i.useCallback(c=>{r(c),l?.(c)},[l]),d=i.useCallback(c=>{t?.(c)},[t]);return e.jsx("div",{className:`nice-desktop__grid nice-desktop__grid--${a}`,style:{gridTemplateColumns:`repeat(${s}, 1fr)`},children:n.map(c=>e.jsxs("div",{className:`nice-desktop__icon ${o===c.key?"nice-desktop__icon--selected":""} ${c.disabled?"nice-desktop__icon--disabled":""}`,style:c.gridCol!=null||c.gridRow!=null?{gridColumn:c.gridCol,gridRow:c.gridRow}:void 0,onClick:()=>!c.disabled&&h(c.key),onDoubleClick:()=>!c.disabled&&d(c.key),role:"button",tabIndex:c.disabled?-1:0,"aria-label":c.label,onKeyDown:m=>{c.disabled||(m.key==="Enter"&&d(c.key),m.key===" "&&(m.preventDefault(),h(c.key)))},children:[e.jsx("div",{className:"nice-desktop__icon-img",children:c.icon}),e.jsx("span",{className:"nice-desktop__icon-label",children:c.label})]},c.key))})},rn=({items:n,x:s,y:a,onItemClick:l,onClose:t})=>{const o=i.useRef(null);return i.useEffect(()=>{const r=h=>{o.current&&!o.current.contains(h.target)&&t()};return document.addEventListener("mousedown",r),()=>document.removeEventListener("mousedown",r)},[t]),i.useEffect(()=>{const r=h=>{h.key==="Escape"&&t()};return document.addEventListener("keydown",r),()=>document.removeEventListener("keydown",r)},[t]),e.jsx("div",{ref:o,className:"nice-desktop__context-menu",style:{position:"fixed",left:s,top:a},role:"menu",children:n.map(r=>e.jsxs(i.Fragment,{children:[r.divider&&e.jsx("div",{className:"nice-desktop__context-divider"}),e.jsxs("button",{type:"button",className:"nice-desktop__context-item",disabled:r.disabled,onClick:()=>{r.onClick?.(),l?.(r.key),t()},role:"menuitem",children:[r.icon&&e.jsx("span",{className:"nice-desktop__context-icon",children:r.icon}),e.jsx("span",{children:r.label})]})]},r.key))})},on=i.forwardRef(({icons:n=[],taskbarPosition:s="bottom",taskbarSize:a=40,startMenuItems:l=[],startMenuLabel:t,startMenuIcon:o,taskbarItems:r=[],systemTrayItems:h=[],showClock:d=!0,wallpaper:c,gridColumns:m=8,iconSize:v="md",onIconClick:p,onIconDoubleClick:j,onTaskbarItemClick:C,onStartMenuItemClick:g,onSystemTrayItemClick:f,contextMenuItems:$,onContextMenuItemClick:I,children:w,className:x,style:k,id:L,accessMode:M,...E},D)=>{const N=O.Hs(L),b=O.Zs(M,L)==="hidden",[u,_]=i.useState(null),T=i.useCallback(S=>{!$||$.length===0||(S.preventDefault(),_({x:S.clientX,y:S.clientY}))},[$]),Y=l.length>0?e.jsx(ln,{items:l,label:t,icon:o,position:s,onItemClick:g}):null,B=e.jsx(tn,{items:h,showClock:d,onItemClick:f}),H={...k,...c?{background:c}:{}};return b?null:e.jsxs("div",{ref:D,id:N,className:`nice-desktop nice-desktop--taskbar-${s} ${x??""}`,style:H,...E,children:[(s==="top"||s==="left")&&e.jsx(Oe,{items:r,position:s,size:a,startMenu:Y,systemTray:B,onItemClick:C}),e.jsxs("div",{className:"nice-desktop__area",onContextMenu:T,children:[n.length>0&&e.jsx(cn,{icons:n,gridColumns:m,iconSize:v,onIconClick:p,onIconDoubleClick:j}),w,u&&$&&e.jsx(rn,{items:$,x:u.x,y:u.y,onItemClick:I,onClose:()=>_(null)})]}),(s==="bottom"||s==="right")&&e.jsx(Oe,{items:r,position:s,size:a,startMenu:Y,systemTray:B,onItemClick:C})]})});on.displayName="NiceDesktop";const Qn=({commands:n,onSelect:s,onClose:a})=>{const[l,t]=i.useState(""),o=i.useRef(null),{t:r}=O.$o();i.useEffect(()=>{o.current?.focus()},[]),i.useEffect(()=>{const d=c=>{c.key==="Escape"&&a()};return document.addEventListener("keydown",d),()=>document.removeEventListener("keydown",d)},[a]);const h=l?n.filter(d=>d.label.toLowerCase().includes(l.toLowerCase())):n;return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"nice-console__palette-overlay",onClick:a}),e.jsxs("div",{className:"nice-console__palette",role:"dialog","aria-label":r("console.commandPalette","Command Palette"),children:[e.jsx("input",{ref:o,className:"nice-console__palette-input",placeholder:r("console.searchCommands","Search commands..."),value:l,onChange:d=>t(d.target.value),onKeyDown:d=>{d.key==="Enter"&&h.length>0&&(s(h[0].key),a())}}),e.jsxs("div",{className:"nice-console__palette-list",children:[h.map(d=>e.jsxs("button",{type:"button",className:"nice-console__palette-item",disabled:d.disabled,onClick:()=>{s(d.key),a()},children:[d.icon&&e.jsx("span",{className:"nice-console__palette-icon",children:d.icon}),e.jsx("span",{className:"nice-console__palette-label",children:d.label}),d.description&&e.jsx("span",{className:"nice-console__palette-desc",children:d.description}),d.shortcut&&e.jsx("span",{className:"nice-console__palette-shortcut",children:d.shortcut})]},d.key)),h.length===0&&e.jsx("div",{className:"nice-console__palette-empty",children:r("console.noCommands","No matching commands")})]})]})]})},dn=i.forwardRef(({tabs:n=[],activeTabKey:s,onTabChange:a,onTabClose:l,commandPalette:t=[],onCommand:o,statusItems:r=[],toolbar:h,sidePanel:d,sidePanelWidth:c=220,sidePanelCollapsed:m,onToggleSidePanel:v,bottomPanel:p,bottomPanelHeight:j=200,bottomPanelCollapsed:C,onToggleBottomPanel:g,children:f,size:$="md",theme:I="dark",className:w,style:x,id:k,accessMode:L,...M},E)=>{const D=O.Hs(k),N=O.Zs(L,k),{t:R}=O.$o();if(N==="hidden")return null;const[b,u]=i.useState(n[0]?.key??""),[_,T]=i.useState(!1),[Y,B]=i.useState(!1),[H,S]=i.useState(!1),Z=s??b,F=m??_,U=C??Y,ae=i.useCallback(W=>{a?a(W):u(W)},[a]),V=i.useCallback(()=>{const W=!F;v?v(W):T(W)},[F,v]),K=i.useCallback(()=>{const W=!U;g?g(W):B(W)},[U,g]);i.useEffect(()=>{if(t.length===0)return;const W=ue=>{ue.ctrlKey&&ue.shiftKey&&ue.key==="P"&&(ue.preventDefault(),S(ie=>!ie))};return document.addEventListener("keydown",W),()=>document.removeEventListener("keydown",W)},[t.length]);const le=n.find(W=>W.key===Z),_e=r.filter(W=>!W.position||W.position==="left"),se=r.filter(W=>W.position==="right");return e.jsxs("div",{ref:E,id:D,className:`nice-console nice-console--${$} nice-console--${I} ${w??""}`,style:x,...M,children:[h&&e.jsx("div",{className:"nice-console__toolbar",children:h}),n.length>0&&e.jsx("div",{className:"nice-console__tabs",role:"tablist",children:n.map(W=>e.jsxs("div",{className:`nice-console__tab ${W.key===Z?"nice-console__tab--active":""}`,role:"tab","aria-selected":W.key===Z,children:[e.jsxs("button",{type:"button",className:"nice-console__tab-btn",onClick:()=>ae(W.key),children:[W.icon&&e.jsx("span",{className:"nice-console__tab-icon",children:W.icon}),e.jsx("span",{children:W.label})]}),(W.closable??!0)&&l&&e.jsx("button",{type:"button",className:"nice-console__tab-close",onClick:()=>l(W.key),"aria-label":R("console.closeTab","Close tab"),children:"✕"})]},W.key))}),e.jsxs("div",{className:"nice-console__main",children:[d&&!F&&e.jsxs("aside",{className:"nice-console__side",style:{width:c,flexShrink:0},children:[e.jsx("div",{className:"nice-console__side-header",children:e.jsx("button",{type:"button",className:"nice-console__side-toggle",onClick:V,"aria-label":R("console.closeSidePanel","Close side panel"),children:"✕"})}),e.jsx("div",{className:"nice-console__side-content",children:d})]}),e.jsxs("div",{className:"nice-console__center",children:[e.jsx("div",{className:"nice-console__content",role:"tabpanel",children:le?le.render?le.render():le.content:f}),p&&!U&&e.jsxs("div",{className:"nice-console__bottom",style:{height:j,flexShrink:0},children:[e.jsx("div",{className:"nice-console__bottom-header",children:e.jsx("button",{type:"button",className:"nice-console__bottom-toggle",onClick:K,"aria-label":R("console.closeBottomPanel","Close bottom panel"),children:"✕"})}),e.jsx("div",{className:"nice-console__bottom-content",children:p})]})]})]}),r.length>0&&e.jsxs("div",{className:"nice-console__statusbar",children:[e.jsxs("div",{className:"nice-console__statusbar-left",children:[d&&F&&e.jsx("button",{type:"button",className:"nice-console__statusbar-btn",onClick:V,title:R("console.openSidePanel","Open side panel"),children:"☰"}),p&&U&&e.jsx("button",{type:"button",className:"nice-console__statusbar-btn",onClick:K,title:R("console.openBottomPanel","Open bottom panel"),children:"▁"}),_e.map(W=>e.jsx("span",{className:"nice-console__status-item",onClick:W.onClick,role:W.onClick?"button":void 0,tabIndex:W.onClick?0:void 0,children:W.content??W.label},W.key))]}),e.jsx("div",{className:"nice-console__statusbar-right",children:se.map(W=>e.jsx("span",{className:"nice-console__status-item",onClick:W.onClick,role:W.onClick?"button":void 0,tabIndex:W.onClick?0:void 0,children:W.content??W.label},W.key))})]}),H&&t.length>0&&e.jsx(Qn,{commands:t,onSelect:W=>o?.(W),onClose:()=>S(!1)})]})});dn.displayName="NiceConsole";const un=i.forwardRef(({steps:n,activeStep:s,onStepChange:a,onComplete:l,onCancel:t,allowStepClick:o=!1,variant:r="horizontal",nextLabel:h,prevLabel:d,finishLabel:c,cancelLabel:m,showProgress:v=!0,className:p,style:j,size:C="md",accessMode:g,id:f},$)=>{const w=O.Zs(g,f)==="hidden",{t:x}=O.$o(),k=O.Hs(f),[L,M]=i.useState(0),[E,D]=i.useState({}),[N,R]=i.useState(new Set([0])),b=s??L,u=n[b],_=b===0,T=b===n.length-1,Y=i.useCallback(V=>{const K=Math.max(0,Math.min(n.length-1,V));M(K),R(le=>new Set(le).add(K)),a?.(K)},[n.length,a]),B=i.useCallback(()=>{if(!u?.validate)return!0;const V=u.validate();return V===!0||V===void 0?(D(K=>{const le={...K};return delete le[u.id],le}),!0):(D(K=>({...K,[u.id]:V})),!1)},[u]),H=i.useCallback(()=>{B()&&(T?l?.():Y(b+1))},[b,T,B,Y,l]),S=i.useCallback(()=>{_||Y(b-1)},[b,_,Y]),Z=i.useCallback(V=>{const K=n.findIndex(le=>le.id===V);K>=0&&Y(K)},[n,Y]),F=i.useMemo(()=>({stepIndex:b,totalSteps:n.length,goNext:H,goPrev:S,goTo:Z,isFirst:_,isLast:T}),[b,n.length,H,S,Z,_,T]),U=(b+1)/n.length*100;if(w)return null;const ae=n.map(V=>({title:V.title,subtitle:V.description,icon:V.icon,optional:V.optional}));return e.jsxs("div",{ref:$,id:k,className:`nice-wizard nice-wizard--${r} nice-size-${C}${p?` ${p}`:""}`,style:j,children:[e.jsx(Ge,{steps:ae,activeStep:b,orientation:r,allowStepClick:o,onStepClick:V=>{V<=b&&Y(V)}}),v&&e.jsx("div",{className:"nice-wizard__progress",children:e.jsx("div",{className:"nice-wizard__progress-bar",style:{width:`${U}%`}})}),e.jsx("div",{className:"nice-wizard__content",role:"tabpanel",children:u&&e.jsxs(e.Fragment,{children:[typeof u.content=="function"?u.content(F):u.content,E[u.id]&&e.jsx("div",{className:"nice-wizard__error nice-error-text",children:E[u.id]})]})}),e.jsxs("div",{className:"nice-wizard__actions",children:[t&&e.jsx("button",{type:"button",className:"nice-btn nice-btn--text",onClick:t,children:m??x("cancel","Cancel")}),e.jsxs("div",{className:"nice-wizard__actions-right",children:[!_&&e.jsx("button",{type:"button",className:"nice-btn nice-btn--outlined",onClick:S,children:d??x("previous","← Previous")}),e.jsx("button",{type:"button",className:"nice-btn nice-btn--primary",onClick:H,children:T?c??x("finish","Finish ✓"):h??x("next","Next →")})]})]})]})});un.displayName="NiceWizard";const mn=i.createContext(null);function Xn(){const n=i.useContext(mn);if(!n)throw new Error("useSetupWizard must be used within NiceSetupWizard");return n}const hn=i.forwardRef(({steps:n,initialValues:s={},activeStep:a,layout:l="horizontal",size:t="md",defaultQuickMode:o=!1,allowQuickModeToggle:r=!0,showStepNumbers:h=!0,showProgress:d=!0,showEstimatedTime:c=!1,allowStepClick:m=!0,showReviewStep:v=!1,persistKey:p,animation:j="slide",branding:C,header:g,footer:f,onStepChange:$,onValuesChange:I,onComplete:w,onCancel:x,labels:k={},accessMode:L,id:M,className:E,style:D},N)=>{const R=O.Zs(L,M),b=R==="hidden",{t:u}=O.$o(),_=O.Hs(M),[T,Y]=i.useState(o),B=i.useMemo(()=>T?n.filter(y=>!y.quickModeSkip):n,[n,T]),H=i.useMemo(()=>{if(!v)return B;const y={id:"__review__",title:k.review??u("wizard.review","Review"),icon:"📋",content:G=>e.jsxs("div",{className:"nice-setup-wizard__review",children:[e.jsx("h3",{children:u("wizard.reviewTitle","Review Your Setup")}),B.filter(q=>q.summary).map(q=>e.jsxs("div",{className:"nice-setup-wizard__review-section",children:[e.jsx("h4",{children:q.title}),q.summary?.(G.values)]},q.id))]})};return[...B,y]},[B,v,k.review,u]),[S,Z]=i.useState(()=>{if(p)try{const y=localStorage.getItem(p);if(y)return{...s,...JSON.parse(y)}}catch{}return s}),[F,U]=i.useState(()=>{if(a)return a;if(p)try{const y=localStorage.getItem(`${p}_step`);if(y&&H.some(G=>G.id===y))return y}catch{}return H[0]?.id??""}),[ae,V]=i.useState(()=>new Set([F])),[K,le]=i.useState({}),[_e,se]=i.useState(!1),[W,ue]=i.useState("next"),ie=H.findIndex(y=>y.id===F),z=H[ie],P=ie===0,ne=ie===H.length-1,te=(ie+1)/H.length*100;i.useEffect(()=>{p&&(localStorage.setItem(p,JSON.stringify(S)),localStorage.setItem(`${p}_step`,F))},[S,F,p]);const pe=i.useCallback((y,G)=>{Z(q=>{const A={...q,[y]:G};return I?.(A),A})},[I]),Ne=i.useCallback(y=>{Z(G=>{const q={...G,...y};return I?.(q),q})},[I]),re=i.useCallback((y,G)=>{le(q=>({...q,[y]:G}))},[]),ge=i.useCallback(y=>{le(G=>{const q={...G};return delete q[y],q})},[]),de=i.useCallback(y=>{const G=H.findIndex(q=>q.id===y);G>=0&&(ue(G>ie?"next":"prev"),U(y),V(q=>new Set(q).add(y)),$?.(y,G))},[H,ie,$]),fe=i.useCallback(async()=>{if(z){if(z.validate){se(!0);try{const y=await z.validate(S);if(y){re(z.id,y),se(!1);return}ge(z.id)}catch(y){re(z.id,String(y)),se(!1);return}se(!1)}if(z.fields){for(const y of z.fields){if(y.required&&!S[y.id]){re(z.id,`${y.label} ${u("wizard.isRequired","is required")}`);return}if(y.validation?.custom){const G=y.validation.custom(S[y.id]);if(G){re(z.id,G);return}}}ge(z.id)}if(ne)await w?.(S),p&&(localStorage.removeItem(p),localStorage.removeItem(`${p}_step`));else{let y;z.nextStep?y=typeof z.nextStep=="function"?z.nextStep(S):z.nextStep:y=H[ie+1]?.id??"",y&&de(y)}}},[z,S,ne,ie,H,w,p,u,re,ge,de]),ye=i.useCallback(()=>{if(P)return;const y=z?.prevStep??H[ie-1]?.id;y&&(ue("prev"),de(y))},[P,z,ie,H,de]),ke=i.useCallback(()=>{if(z?.optional&&!ne){const y=H[ie+1]?.id;y&&de(y)}},[z,ne,ie,H,de]),Ce=i.useCallback(()=>{w?.(S)},[w,S]),xe=i.useCallback(()=>{x?.()},[x]),je=i.useCallback(()=>{Y(y=>!y)},[]),me=i.useMemo(()=>({values:S,setValue:pe,setValues:Ne,currentStep:z,currentIndex:ie,totalSteps:H.length,visitedSteps:ae,errors:K,setError:re,clearError:ge,goNext:fe,goPrev:ye,goTo:de,skip:ke,complete:Ce,cancel:xe,isFirst:P,isLast:ne,isQuickMode:T,toggleQuickMode:je,progress:te,t:u}),[S,pe,Ne,z,ie,H.length,ae,K,re,ge,fe,ye,de,ke,Ce,xe,P,ne,T,je,te,u]),ve=i.useMemo(()=>{if(!c)return null;const G=H.map(q=>q.estimatedTime).filter(Boolean).map(q=>{const A=q.match(/(\d+)\s*(min|sec|s|m)/i);if(!A)return 0;const X=parseInt(A[1],10);return A[2].toLowerCase().startsWith("m")?X:X/60}).reduce((q,A)=>q+A,0);return G>0?`~${Math.ceil(G)} min`:null},[H,c]);if(!z)return null;const $e=(y,G)=>{const q=y.id===F,A=ae.has(y.id)&&!q&&G<ie,X=!q&&!A,ee=!!K[y.id],Q=m&&(A||G<=ie);return e.jsxs("button",{type:"button",role:"tab","aria-selected":q,"aria-current":q?"step":void 0,className:["nice-setup-wizard__step-indicator",q&&"nice-setup-wizard__step-indicator--active",A&&"nice-setup-wizard__step-indicator--completed",X&&"nice-setup-wizard__step-indicator--pending",ee&&"nice-setup-wizard__step-indicator--error"].filter(Boolean).join(" "),onClick:()=>Q&&de(y.id),disabled:!Q,children:[e.jsx("span",{className:"nice-setup-wizard__step-marker",children:A?"✓":ee?"!":h?G+1:y.icon||"○"}),e.jsxs("span",{className:"nice-setup-wizard__step-info",children:[e.jsx("span",{className:"nice-setup-wizard__step-title",children:y.title}),y.subtitle&&e.jsx("span",{className:"nice-setup-wizard__step-subtitle",children:y.subtitle}),y.optional&&e.jsxs("span",{className:"nice-setup-wizard__step-optional",children:["(",k.optional??u("wizard.optional","optional"),")"]})]}),y.badge&&e.jsx("span",{className:"nice-setup-wizard__step-badge",children:y.badge})]},y.id)},Ie=y=>{if(y.showWhen&&!y.showWhen(S))return null;const G=S[y.id]??y.defaultValue??"",q=Q=>pe(y.id,Q);if(y.render)return e.jsx("div",{className:`nice-setup-wizard__field${y.fullWidth?" nice-setup-wizard__field--full":""}`,children:y.render({value:G,onChange:q,field:y})},y.id);const A=`${_}-${y.id}`,X={id:A,disabled:y.disabled||R==="disabled"||R==="readOnly",placeholder:y.placeholder,required:y.required};let ee;switch(y.type){case"textarea":ee=e.jsx("textarea",{...X,className:"nice-setup-wizard__input nice-setup-wizard__textarea",value:String(G),onChange:Q=>q(Q.target.value),rows:4});break;case"select":ee=e.jsxs("select",{...X,className:"nice-setup-wizard__input nice-setup-wizard__select",value:String(G),onChange:Q=>q(Q.target.value),children:[e.jsx("option",{value:"",children:y.placeholder||u("wizard.select","Select...")}),y.options?.map(Q=>e.jsx("option",{value:Q.value,children:Q.label},Q.value))]});break;case"radio":ee=e.jsx("div",{className:"nice-setup-wizard__radio-group",children:y.options?.map(Q=>e.jsxs("label",{className:"nice-setup-wizard__radio-label",children:[e.jsx("input",{type:"radio",name:A,value:Q.value,checked:G===Q.value,onChange:()=>q(Q.value),disabled:X.disabled}),Q.icon&&e.jsx("span",{className:"nice-setup-wizard__radio-icon",children:Q.icon}),e.jsx("span",{children:Q.label})]},Q.value))});break;case"checkbox":ee=e.jsxs("label",{className:"nice-setup-wizard__checkbox-label",children:[e.jsx("input",{type:"checkbox",checked:!!G,onChange:Q=>q(Q.target.checked),disabled:X.disabled}),e.jsx("span",{children:y.label})]});break;case"switch":ee=e.jsxs("label",{className:"nice-setup-wizard__switch-label",children:[e.jsx("span",{className:"nice-setup-wizard__switch-text",children:y.label}),e.jsxs("span",{className:`nice-setup-wizard__switch${G?" nice-setup-wizard__switch--on":""}`,children:[e.jsx("input",{type:"checkbox",checked:!!G,onChange:Q=>q(Q.target.checked),disabled:X.disabled}),e.jsx("span",{className:"nice-setup-wizard__switch-track"}),e.jsx("span",{className:"nice-setup-wizard__switch-thumb"})]})]});break;case"slider":ee=e.jsxs("div",{className:"nice-setup-wizard__slider-wrapper",children:[e.jsx("input",{type:"range",...X,className:"nice-setup-wizard__slider",value:Number(G)||y.validation?.min||0,min:y.validation?.min,max:y.validation?.max,onChange:Q=>q(Number(Q.target.value))}),e.jsx("span",{className:"nice-setup-wizard__slider-value",children:String(G??"")})]});break;default:ee=e.jsx("input",{type:y.type==="custom"?"text":y.type,...X,className:"nice-setup-wizard__input",value:String(G),onChange:Q=>q(Q.target.value),minLength:y.validation?.minLength,maxLength:y.validation?.maxLength,min:y.validation?.min,max:y.validation?.max,pattern:y.validation?.pattern?.source})}return e.jsxs("div",{className:`nice-setup-wizard__field${y.fullWidth?" nice-setup-wizard__field--full":""}`,children:[y.type!=="checkbox"&&y.type!=="switch"&&e.jsxs("label",{htmlFor:A,className:"nice-setup-wizard__label",children:[y.label,y.required&&e.jsx("span",{className:"nice-setup-wizard__required",children:"*"})]}),ee,y.description&&e.jsx("span",{className:"nice-setup-wizard__field-desc",children:y.description})]},y.id)},Le=()=>z.fields?e.jsx("div",{className:"nice-setup-wizard__fields",children:z.fields.map(Ie)}):z.content?typeof z.content=="function"?z.content(me):z.content:null;return b?null:e.jsx(mn.Provider,{value:me,children:e.jsxs("div",{ref:N,id:_,className:["nice-setup-wizard",`nice-setup-wizard--${l}`,`nice-size-${t}`,j!=="none"&&`nice-setup-wizard--anim-${j}`,E].filter(Boolean).join(" "),style:D,children:[(C||g||r)&&e.jsxs("header",{className:"nice-setup-wizard__header",children:[C&&e.jsx("div",{className:"nice-setup-wizard__branding",children:C}),g,r&&e.jsxs("label",{className:"nice-setup-wizard__quick-toggle",children:[e.jsx("input",{type:"checkbox",checked:T,onChange:je}),e.jsx("span",{children:k.quickMode??u("wizard.quickMode","Quick Setup")})]}),ve&&e.jsx("span",{className:"nice-setup-wizard__time",children:ve})]}),l!=="minimal"&&e.jsx("nav",{className:"nice-setup-wizard__nav",role:"tablist",children:H.map($e)}),d&&e.jsx("div",{className:"nice-setup-wizard__progress",children:e.jsx("div",{className:"nice-setup-wizard__progress-bar",style:{width:`${te}%`},role:"progressbar","aria-valuenow":te,"aria-valuemin":0,"aria-valuemax":100})}),e.jsxs("div",{className:["nice-setup-wizard__content",W==="next"&&"nice-setup-wizard__content--slide-next",W==="prev"&&"nice-setup-wizard__content--slide-prev"].filter(Boolean).join(" "),role:"tabpanel",children:[z.description&&e.jsx("p",{className:"nice-setup-wizard__step-description",children:z.description}),Le(),K[z.id]&&e.jsx("div",{className:"nice-setup-wizard__error",role:"alert",children:K[z.id]})]},F),e.jsxs("footer",{className:"nice-setup-wizard__footer",children:[e.jsxs("div",{className:"nice-setup-wizard__actions-left",children:[x&&e.jsx("button",{type:"button",className:"nice-btn nice-btn--text",onClick:xe,children:k.cancel??u("wizard.cancel","Cancel")}),z.optional&&!ne&&e.jsx("button",{type:"button",className:"nice-btn nice-btn--text",onClick:ke,children:k.skip??u("wizard.skip","Skip")}),z.actions?.filter(y=>y.position==="left").map(y=>e.jsxs("button",{type:"button",className:`nice-btn nice-btn--${y.variant||"outlined"}`,onClick:()=>y.onClick(me),disabled:y.disabled?.(me),children:[y.icon," ",y.label]},y.id))]}),e.jsxs("div",{className:"nice-setup-wizard__actions-right",children:[z.actions?.filter(y=>y.position!=="left").map(y=>e.jsxs("button",{type:"button",className:`nice-btn nice-btn--${y.variant||"outlined"}`,onClick:()=>y.onClick(me),disabled:y.disabled?.(me),children:[y.icon," ",y.label]},y.id)),!P&&e.jsx(J.NiceButton,{variant:"outline",size:t,onClick:ye,children:k.prev??u("wizard.prev","← Back")}),e.jsx(J.NiceButton,{variant:"primary",size:t,onClick:fe,disabled:_e,loading:_e,children:ne?k.finish??u("wizard.finish","Finish ✓"):k.next??u("wizard.next","Continue →")})]})]}),f&&e.jsx("div",{className:"nice-setup-wizard__custom-footer",children:f}),l==="minimal"&&e.jsx("div",{className:"nice-setup-wizard__minimal-indicator",children:k.stepOf?k.stepOf.replace("{current}",String(ie+1)).replace("{total}",String(H.length)):`${ie+1} / ${H.length}`})]})})});hn.displayName="NiceSetupWizard";const _n=i.forwardRef(({label:n,helperText:s,disabled:a,size:l="md",id:t,className:o,style:r,accessMode:h,logo:d,brandName:c,breadcrumbs:m,centerContent:v,rightContent:p,leftContent:j,sticky:C=!0,variant:g="light",height:f="md",onBrandClick:$,displayStyle:I},w)=>{const x=O.Zs(h,t),k=x==="hidden";x==="disabled"&&(a=!0);const{t:L}=O.$o(),M=O.Hs(t),E=O.vs("menu",I),D=O.Ss("menu",I);return k?null:e.jsxs("nav",{ref:w,id:M,className:`nice-navbar nice-navbar--${g} nice-navbar--h-${f}${C?" nice-navbar--sticky":""} nice-navbar--ds-${D}${o?` ${o}`:""}${a?" nice-disabled":""}`,style:{...E,...r},role:"navigation","aria-label":n??L("mainNavigation","Main navigation"),children:[e.jsxs("div",{className:"nice-navbar__left",children:[j,(d||c)&&e.jsxs("div",{className:"nice-navbar__brand",onClick:$,role:$?"button":void 0,tabIndex:$?0:void 0,children:[d&&e.jsx("span",{className:"nice-navbar__logo",children:d}),c&&e.jsx("span",{className:"nice-navbar__brand-name",children:c})]}),m&&m.length>0&&e.jsx("ol",{className:"nice-navbar__breadcrumbs","aria-label":L("breadcrumbs","Breadcrumbs"),children:m.map((N,R)=>e.jsxs("li",{className:"nice-navbar__breadcrumb",children:[R>0&&e.jsx("span",{className:"nice-navbar__breadcrumb-sep",children:"/"}),N.href||N.onClick?e.jsx("a",{href:N.href??"#",onClick:b=>{N.onClick&&(b.preventDefault(),N.onClick())},children:N.label}):e.jsx("span",{"aria-current":R===m.length-1?"page":void 0,children:N.label})]},R))})]}),v&&e.jsx("div",{className:"nice-navbar__center",children:v}),p&&e.jsx("div",{className:"nice-navbar__right",children:p})]})});_n.displayName="NiceNavbar";const bn=i.forwardRef(({label:n,helperText:s,disabled:a,readOnly:l,size:t="md",id:o,className:r,style:h,accessMode:d,tenants:c,currentTenantId:m,onSwitch:v,onManage:p,onCreate:j,variant:C="dropdown",searchable:g=!1},f)=>{const $=O.Zs(d,o),I=$==="hidden";$==="disabled"&&(a=!0),$==="readOnly"&&(l=!0);const{t:w}=O.$o(),x=O.Hs(o),[k,L]=i.useState(!1),[M,E]=i.useState(""),D=i.useMemo(()=>c.find(b=>b.id===m),[c,m]),N=i.useMemo(()=>{if(!M)return c;const b=M.toLowerCase();return c.filter(u=>u.name.toLowerCase().includes(b))},[c,M]),R=i.useCallback(b=>{v?.(b),L(!1),E("")},[v]);return C==="inline"?e.jsxs("div",{ref:f,id:x,className:`nice-tenant-switcher nice-tenant-switcher--inline nice-size-${t}${r?` ${r}`:""}${a?" nice-disabled":""}`,style:h,children:[n&&e.jsx("span",{className:"nice-tenant-switcher__label",children:n}),e.jsx("div",{className:"nice-tenant-switcher__list",children:c.map(b=>e.jsxs("button",{type:"button",className:`nice-tenant-switcher__option${b.id===m?" nice-tenant-switcher__option--active":""}`,onClick:()=>R(b.id),disabled:a||l,children:[b.logoUrl&&e.jsx("img",{src:b.logoUrl,alt:"",className:"nice-tenant-switcher__option-logo"}),e.jsx("span",{children:b.name})]},b.id))})]}):I?null:e.jsxs("div",{ref:f,id:x,className:`nice-tenant-switcher nice-size-${t}${r?` ${r}`:""}${a?" nice-disabled":""}`,style:h,children:[e.jsxs("button",{type:"button",className:"nice-tenant-switcher__trigger",onClick:()=>!a&&!l&&L(!k),onBlur:()=>setTimeout(()=>L(!1),200),disabled:a,"aria-haspopup":"listbox","aria-expanded":k,children:[D?.logoUrl&&e.jsx("img",{src:D.logoUrl,alt:"",className:"nice-tenant-switcher__trigger-logo"}),e.jsx("span",{className:"nice-tenant-switcher__trigger-name",children:D?.name??w("selectTenant","Select organization")}),e.jsx("span",{className:"nice-tenant-switcher__trigger-arrow",children:k?"▲":"▼"})]}),k&&e.jsxs("div",{className:"nice-tenant-switcher__dropdown",role:"listbox",children:[g&&e.jsx("input",{type:"text",className:"nice-input nice-tenant-switcher__search",value:M,onChange:b=>E(b.target.value),placeholder:w("searchOrganizations","Search…"),autoFocus:!0}),e.jsxs("div",{className:"nice-tenant-switcher__options",children:[N.map(b=>e.jsxs("div",{className:`nice-tenant-switcher__option${b.id===m?" nice-tenant-switcher__option--active":""}`,role:"option","aria-selected":b.id===m,onClick:()=>R(b.id),children:[b.logoUrl&&e.jsx("img",{src:b.logoUrl,alt:"",className:"nice-tenant-switcher__option-logo"}),e.jsxs("div",{className:"nice-tenant-switcher__option-info",children:[e.jsx("span",{className:"nice-tenant-switcher__option-name",children:b.name}),b.subtitle&&e.jsx("span",{className:"nice-tenant-switcher__option-subtitle",children:b.subtitle})]}),b.id===m&&e.jsx("span",{className:"nice-tenant-switcher__check",children:"✓"})]},b.id)),N.length===0&&e.jsx("div",{className:"nice-tenant-switcher__empty",children:w("noResults","No results")})]}),(p||j)&&e.jsxs("div",{className:"nice-tenant-switcher__footer",children:[p&&e.jsx("button",{type:"button",onClick:p,children:w("manageTenants","Manage organizations")}),j&&e.jsx("button",{type:"button",onClick:j,children:w("createTenant","Create organization")})]})]})]})});bn.displayName="NiceTenantSwitcher";const Jn={online:"var(--nice-color-success, #5cb85c)",away:"var(--nice-color-warning, #f0ad4e)",busy:"var(--nice-color-error, #d9534f)",offline:"var(--nice-color-muted, #999)"},Fe=i.forwardRef(({label:n,disabled:s,size:a="md",id:l,className:t,style:o,accessMode:r,userName:h,userEmail:d,userRole:c,avatarUrl:m,items:v=[],open:p,onOpenChange:j,onProfile:C,onLogout:g,avatarSize:f=36,status:$},I)=>{const w=O.Zs(r,l),x=w==="hidden";w==="disabled"&&(s=!0);const{t:k}=O.$o(),L=O.Hs(l),[M,E]=i.useState(!1),D=p??M,N=i.useCallback(()=>{const _=!D;E(_),j?.(_)},[D,j]),R=h.split(" ").map(_=>_.charAt(0)).join("").toUpperCase().slice(0,2),b=[];C&&b.push({id:"__profile",label:k("profile","Profile"),onClick:C}),g&&b.push({id:"__divider",label:"",isDivider:!0},{id:"__logout",label:k("logout","Logout"),onClick:g,danger:!0});const u=v.length>0?v:b;return x?null:e.jsxs("div",{ref:I,id:L,className:`nice-user-menu nice-size-${a}${t?` ${t}`:""}${s?" nice-disabled":""}`,style:o,children:[e.jsx("button",{type:"button",className:"nice-user-menu__trigger",onClick:N,onBlur:()=>setTimeout(()=>{E(!1),j?.(!1)},200),disabled:s,"aria-haspopup":"menu","aria-expanded":D,"aria-label":n??h,children:e.jsxs("span",{className:"nice-user-menu__avatar",style:{width:f,height:f},children:[m?e.jsx("img",{src:m,alt:h}):e.jsx("span",{className:"nice-user-menu__initials",children:R}),$&&e.jsx("span",{className:"nice-user-menu__status",style:{backgroundColor:Jn[$]},title:$})]})}),D&&e.jsxs("div",{className:"nice-user-menu__dropdown",role:"menu",children:[e.jsxs("div",{className:"nice-user-menu__info",children:[e.jsx("span",{className:"nice-user-menu__name",children:h}),d&&e.jsx("span",{className:"nice-user-menu__email",children:d}),c&&e.jsx("span",{className:"nice-user-menu__role",children:c})]}),u.length>0&&e.jsx("div",{className:"nice-user-menu__items",children:u.map(_=>_.isDivider?e.jsx("hr",{className:"nice-user-menu__divider"},_.id):e.jsxs("button",{type:"button",role:"menuitem",className:`nice-user-menu__item${_.danger?" nice-user-menu__item--danger":""}`,onClick:()=>{_.onClick?.(),E(!1),j?.(!1)},disabled:_.disabled||s,children:[_.icon&&e.jsx("span",{className:"nice-user-menu__item-icon",children:_.icon}),e.jsx("span",{children:_.label})]},_.id))})]})]})});Fe.displayName="NiceUserMenu";function Gn(n,s){if(!s)return n;const a=s.toLowerCase();return n.map(l=>{const t=l.entities.filter(r=>r.label.toLowerCase().includes(a)||r.name.toLowerCase().includes(a));return l.label.toLowerCase().includes(a)||l.name.toLowerCase().includes(a)?l:t.length>0?{...l,entities:t}:null}).filter(Boolean)}const es=({value:n,onChange:s,placeholder:a})=>e.jsxs("div",{className:"nice-dynamic-sidebar__search",children:[e.jsx("span",{className:"nice-dynamic-sidebar__search-icon","aria-hidden":!0,children:"🔍"}),e.jsx("input",{type:"text",className:"nice-dynamic-sidebar__search-input",value:n,onChange:l=>s(l.target.value),placeholder:a,"aria-label":a}),n&&e.jsx("button",{className:"nice-dynamic-sidebar__search-clear",onClick:()=>s(""),"aria-label":"Clear",type:"button",children:"×"})]}),ns=({module:n,activeRoute:s,collapsed:a,expandedModules:l,onToggleModule:t,onNavigate:o})=>{const r=l.has(n.id);return a?e.jsx("div",{className:"nice-dynamic-sidebar__module nice-dynamic-sidebar__module--collapsed",title:n.label,children:e.jsx("button",{className:`nice-dynamic-sidebar__module-icon ${n.isAvailable?"":"nice-dynamic-sidebar__module-icon--disabled"}`,onClick:()=>n.isAvailable&&n.entities.length>0&&o(n.entities[0].route,n.entities[0]),disabled:!n.isAvailable,type:"button",children:e.jsx("span",{children:n.icon||n.label[0]})})}):e.jsxs("div",{className:`nice-dynamic-sidebar__module ${n.isAvailable?"":"nice-dynamic-sidebar__module--disabled"}`,children:[e.jsxs("button",{className:`nice-dynamic-sidebar__module-header ${r?"nice-dynamic-sidebar__module-header--expanded":""}`,onClick:()=>n.isAvailable&&t(n.id),disabled:!n.isAvailable,type:"button","aria-expanded":r,children:[n.icon&&e.jsx("span",{className:"nice-dynamic-sidebar__module-icon",children:n.icon}),e.jsx("span",{className:"nice-dynamic-sidebar__module-label",children:n.label}),e.jsx("span",{className:`nice-dynamic-sidebar__module-chevron ${r?"nice-dynamic-sidebar__module-chevron--open":""}`,children:"▸"})]}),r&&e.jsx("ul",{className:"nice-dynamic-sidebar__entities",role:"list",children:n.entities.map(h=>e.jsx("li",{className:`nice-dynamic-sidebar__entity ${s===h.route?"nice-dynamic-sidebar__entity--active":""}`,children:e.jsxs("button",{className:"nice-dynamic-sidebar__entity-btn",onClick:()=>o(h.route,h),type:"button",children:[h.icon&&e.jsx("span",{className:"nice-dynamic-sidebar__entity-icon",children:h.icon}),e.jsx("span",{children:h.label})]})},h.id))})]})},ss=({favorites:n,activeRoute:s,onNavigate:a,label:l})=>n.length===0?null:e.jsxs("div",{className:"nice-dynamic-sidebar__favorites",children:[e.jsx("div",{className:"nice-dynamic-sidebar__section-title",children:l}),e.jsx("ul",{role:"list",children:n.map(t=>e.jsx("li",{className:`nice-dynamic-sidebar__favorite ${s===t.route?"nice-dynamic-sidebar__favorite--active":""}`,children:e.jsxs("button",{className:"nice-dynamic-sidebar__favorite-btn",onClick:()=>a(t.route),type:"button",children:[t.icon&&e.jsx("span",{children:t.icon}),e.jsx("span",{children:t.label})]})},t.id))})]}),pn=i.forwardRef(({menu:n,activeRoute:s,collapsed:a,width:l=260,collapsedWidth:t=56,searchable:o=!0,showFavorites:r=!0,showQuickActions:h=!0,collapsible:d=!0,onNavigate:c,onCollapseChange:m,onToggleFavorite:v,header:p,footer:j,className:C,style:g,id:f,accessMode:$,...I},w)=>{const x=O.Hs(f),k=O.Zs($,f),{t:L}=O.$o(),[M,E]=i.useState(a??!1),D=a??M,[N,R]=i.useState(""),[b,u]=i.useState(()=>{if(s){const S=n.modules.find(Z=>Z.entities.some(F=>F.route===s));return S?new Set([S.id]):new Set}return new Set}),_=i.useCallback(()=>{const S=!D;E(S),m?.(S)},[D,m]),T=i.useCallback(S=>{u(Z=>{const F=new Set(Z);return F.has(S)?F.delete(S):F.add(S),F})},[]),Y=i.useCallback((S,Z)=>{c?.(S,Z)},[c]),B=i.useMemo(()=>Gn(n.modules.filter(S=>S.isAvailable).sort((S,Z)=>S.order-Z.order),N),[n.modules,N]),H=D?t:l;return k==="hidden"?null:e.jsxs("nav",{ref:w,id:x,className:`nice-dynamic-sidebar ${D?"nice-dynamic-sidebar--collapsed":""} ${C??""}`,style:{...g,width:H,minWidth:H},"aria-label":L("nav.sidebar","Sidebar"),...I,children:[p&&e.jsx("div",{className:"nice-dynamic-sidebar__header",children:p}),d&&e.jsx("button",{className:"nice-dynamic-sidebar__toggle",onClick:_,"aria-label":D?L("expand","Expand"):L("collapse","Collapse"),type:"button",children:D?"▸":"◂"}),o&&!D&&e.jsx(es,{value:N,onChange:R,placeholder:L("nav.search","Search")}),r&&!D&&e.jsx(ss,{favorites:n.favorites,activeRoute:s,onNavigate:Y,label:L("nav.favorites","Favorites")}),h&&!D&&n.quickActions.length>0&&e.jsx("div",{className:"nice-dynamic-sidebar__quick-actions",children:n.quickActions.map(S=>e.jsxs("button",{className:"nice-dynamic-sidebar__quick-action",onClick:()=>Y(S.route),title:S.shortcut?`${S.label} (${S.shortcut})`:S.label,type:"button",children:[S.icon&&e.jsx("span",{children:S.icon}),e.jsx("span",{children:S.label})]},S.id))}),e.jsxs("div",{className:"nice-dynamic-sidebar__modules",role:"navigation",children:[B.map(S=>e.jsx(ns,{module:S,activeRoute:s,collapsed:D,expandedModules:b,onToggleModule:T,onNavigate:Y},S.id)),B.length===0&&!D&&e.jsx("div",{className:"nice-dynamic-sidebar__empty",children:L("noData","No data")})]}),j&&e.jsx("div",{className:"nice-dynamic-sidebar__footer",children:j})]})});pn.displayName="NiceDynamicSidebar";const is=e.jsxs("svg",{width:16,height:16,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.8,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[e.jsx("circle",{cx:"12",cy:"12",r:"3"}),e.jsx("path",{d:"M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 1 1-2.83 2.83l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 1 1-4 0v-.09a1.65 1.65 0 0 0-1.08-1.51 1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 1 1-2.83-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 1 1 0-4h.09a1.65 1.65 0 0 0 1.51-1.08 1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 1 1 2.83-2.83l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 1 1 4 0v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 1 1 2.83 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 1 1 0 4h-.09a1.65 1.65 0 0 0-1.51 1z"})]}),as=e.jsxs("svg",{width:16,height:16,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.8,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[e.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2"}),e.jsx("line",{x1:"3",y1:"9",x2:"21",y2:"9"}),e.jsx("line",{x1:"9",y1:"21",x2:"9",y2:"9"})]}),ls=e.jsxs("svg",{width:16,height:16,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.8,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[e.jsx("line",{x1:"8",y1:"6",x2:"21",y2:"6"}),e.jsx("line",{x1:"8",y1:"12",x2:"21",y2:"12"}),e.jsx("line",{x1:"8",y1:"18",x2:"21",y2:"18"}),e.jsx("line",{x1:"3",y1:"6",x2:"3.01",y2:"6"}),e.jsx("line",{x1:"3",y1:"12",x2:"3.01",y2:"12"}),e.jsx("line",{x1:"3",y1:"18",x2:"3.01",y2:"18"})]}),ts=e.jsxs("svg",{width:16,height:16,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.8,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[e.jsx("path",{d:"M17.94 17.94A10.07 10.07 0 0 1 12 20c-7 0-11-8-11-8a18.45 18.45 0 0 1 5.06-5.94M9.9 4.24A9.12 9.12 0 0 1 12 4c7 0 11 8 11 8a18.5 18.5 0 0 1-2.16 3.19m-6.72-1.07a3 3 0 1 1-4.24-4.24"}),e.jsx("line",{x1:"1",y1:"1",x2:"23",y2:"23"})]}),cs=e.jsxs("svg",{width:16,height:16,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.8,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[e.jsx("polyline",{points:"23 4 23 10 17 10"}),e.jsx("polyline",{points:"1 20 1 14 7 14"}),e.jsx("path",{d:"M3.51 9a9 9 0 0 1 14.85-3.36L23 10M1 14l4.64 4.36A9 9 0 0 0 20.49 15"})]}),He=[{id:"prefs-general",route:"preferences/general",labelKey:"sidebar.prefs.general",labelDefault:"General",icon:is},{id:"prefs-display",route:"preferences/display",labelKey:"sidebar.prefs.display",labelDefault:"Display",icon:as},{id:"prefs-order",route:"preferences/order",labelKey:"sidebar.prefs.order",labelDefault:"Order",icon:ls},{id:"prefs-hidden",route:"preferences/hidden",labelKey:"sidebar.prefs.hidden",labelDefault:"Hidden items",icon:ts},{id:"prefs-reset",route:"preferences/reset",labelKey:"sidebar.prefs.reset",labelDefault:"Reset",icon:cs}];function rs(n){return He.map(s=>({id:s.id,label:n(s.labelKey,s.labelDefault),icon:s.icon,route:s.route}))}const Se=n=>i.createElement("svg",{width:18,height:18,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.8,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0},n),os=Se([i.createElement("line",{key:"l1",x1:4,y1:7,x2:20,y2:7}),i.createElement("line",{key:"l2",x1:4,y1:12,x2:20,y2:12}),i.createElement("line",{key:"l3",x1:4,y1:17,x2:20,y2:17})]),ds=Se([i.createElement("circle",{key:"h",cx:12,cy:8,r:4}),i.createElement("path",{key:"b",d:"M4 21c0-4 4-7 8-7s8 3 8 7"})]),us=Se([i.createElement("rect",{key:"r",x:4,y:3,width:16,height:18,rx:1}),i.createElement("line",{key:"l1",x1:9,y1:7,x2:9,y2:7.01}),i.createElement("line",{key:"l2",x1:15,y1:7,x2:15,y2:7.01}),i.createElement("line",{key:"l3",x1:9,y1:12,x2:9,y2:12.01}),i.createElement("line",{key:"l4",x1:15,y1:12,x2:15,y2:12.01}),i.createElement("rect",{key:"d",x:10,y:16,width:4,height:5})]),ms=Se(i.createElement("path",{d:"M12 17.27 18.18 21l-1.64-7.03L22 9.24l-7.19-.61L12 2 9.19 8.63 2 9.24l5.46 4.73L5.82 21z",fill:"currentColor"})),hs=Se([i.createElement("circle",{key:"c",cx:11,cy:11,r:7}),i.createElement("line",{key:"l",x1:21,y1:21,x2:16.65,y2:16.65})]),_s=Se([i.createElement("circle",{key:"c",cx:12,cy:12,r:3}),i.createElement("path",{key:"g",d:"M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 1 1-2.83 2.83l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 1 1-4 0v-.09a1.65 1.65 0 0 0-1.08-1.51 1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 1 1-2.83-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 1 1 0-4h.09a1.65 1.65 0 0 0 1.51-1.08 1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 1 1 2.83-2.83l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 1 1 4 0v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 1 1 2.83 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 1 1 0 4h-.09a1.65 1.65 0 0 0-1.51 1z"})]),ze={all:{icon:os,label:"Wszystko"},"by-role":{icon:ds,label:"Według roli"},"by-unit":{icon:us,label:"Według jednostki"},favorites:{icon:ms,label:"Ulubione"},search:{icon:hs,label:"Wyszukaj"},preferences:{icon:_s,label:"Preferencje"}},We={enableModeIcons:!1,enabledModes:["all","by-role","by-unit","favorites","search","preferences"],activeMode:"all",pinnedSources:{},hiddenItems:[],favorites:[],maxDepth:{},collapsedIds:[],autoExpand:!0,leftClickBehavior:"focus-existing",itemOrder:{}};function Ee(n){return typeof n=="string"?e.jsx(O.Pr,{name:n}):n}function xn(n){return`nice_sidebar_nav_${n??"_default"}`}const Te="nice-sidebar-prefs-change";function Ue(n,s){const a={...We,userId:n??"_default"};if(s&&Object.assign(a,s),s&&typeof s.activeMode<"u")return a;try{const l=localStorage.getItem(xn(n));if(l){const t=JSON.parse(l);return Array.isArray(t.favorites)&&(t.favorites=t.favorites.map(o=>o&&typeof o=="object"?{...o,icon:typeof o.icon=="string"||i.isValidElement(o.icon)?o.icon:void 0}:o)),{...a,...t,userId:n??"_default"}}}catch{}return a}function vn(n,s,a,l){const[t,o]=i.useState(()=>{const d=Ue(n,a);return s!==void 0&&(d.enableModeIcons=s),d});i.useEffect(()=>{a&&o(d=>({...d,...a}))},[a]);const r=i.useCallback(d=>{o(c=>{const m=d(c);if(!a?.activeMode)try{const v={...m,favorites:m.favorites.map(p=>({...p,icon:void 0}))};localStorage.setItem(xn(n),JSON.stringify(v)),typeof window<"u"&&window.dispatchEvent(new CustomEvent(Te,{detail:{userId:n??"_default"}}))}catch{}return l?.(m),m})},[n,a,l]);i.useEffect(()=>{if(typeof window>"u")return;const d=c=>{c.detail?.userId===(n??"_default")&&o(v=>{const p=Ue(n,a);return s!==void 0&&(p.enableModeIcons=s),JSON.stringify(v)===JSON.stringify(p)?v:p})};return window.addEventListener(Te,d),()=>window.removeEventListener(Te,d)},[n,a,s]);const h=i.useMemo(()=>({setMode:d=>r(c=>({...c,activeMode:d})),setEnableModeIcons:d=>r(c=>({...c,enableModeIcons:d})),toggleMode:d=>r(c=>{if(d==="preferences")return c;const m=c.enabledModes.includes(d);return{...c,enabledModes:m?c.enabledModes.filter(v=>v!==d):[...c.enabledModes,d],activeMode:!m||c.activeMode!==d?c.activeMode:"all"}}),pinSource:(d,c)=>r(m=>({...m,pinnedSources:{...m.pinnedSources,[d]:[...m.pinnedSources[d]??[],c]}})),unpinSource:(d,c)=>r(m=>({...m,pinnedSources:{...m.pinnedSources,[d]:(m.pinnedSources[d]??[]).filter(v=>v!==c)}})),hideItem:d=>r(c=>({...c,hiddenItems:c.hiddenItems.some(m=>m.id===d.id)?c.hiddenItems:[...c.hiddenItems,d]})),restoreItem:d=>r(c=>({...c,hiddenItems:c.hiddenItems.filter(m=>m.id!==d)})),addFavorite:d=>r(c=>({...c,favorites:c.favorites.some(m=>m.id===d.id)?c.favorites:[...c.favorites,{...d,addedAt:Date.now()}]})),removeFavorite:d=>r(c=>({...c,favorites:c.favorites.filter(m=>m.id!==d)})),setMaxDepth:(d,c)=>r(m=>({...m,maxDepth:{...m.maxDepth,[d]:Math.min(10,Math.max(1,c))}})),toggleCollapse:d=>r(c=>({...c,collapsedIds:c.collapsedIds.includes(d)?c.collapsedIds.filter(m=>m!==d):[...c.collapsedIds,d]})),setAutoExpand:d=>r(c=>({...c,autoExpand:d})),setLeftClickBehavior:d=>r(c=>({...c,leftClickBehavior:d})),reorderItems:(d,c)=>r(m=>{const v={...m.itemOrder};return c==null?delete v[d]:v[d]=c,{...m,itemOrder:v}}),resetAll:()=>r(()=>({...We,userId:n??"_default"}))}),[r,n]);return[t,h]}function bs({enabledModes:n,activeMode:s,onSelect:a,collapsed:l=!1}){const t=[...n.filter(o=>o!=="preferences"),"preferences"];if(l){const o=Math.max(0,t.indexOf(s)),r=t[(o-1+t.length)%t.length],h=t[(o+1)%t.length],d=ze[s];return e.jsxs("div",{className:"nice-sidebar-nav__mode-bar nice-sidebar-nav__mode-bar--carousel",role:"tablist","aria-label":"Tryb nawigacji",children:[e.jsx(ce,{content:`Poprzedni tryb: ${ze[r].label}`,position:"bottom",size:"sm",children:e.jsx("button",{type:"button",className:"nice-sidebar-nav__mode-arrow","aria-label":"Poprzedni tryb",onClick:()=>a(r),children:e.jsx("span",{"aria-hidden":"true",children:"‹"})})}),e.jsx(ce,{content:d.label,position:"bottom",size:"sm",children:e.jsx("button",{type:"button",role:"tab","aria-selected":!0,"aria-label":d.label,className:"nice-sidebar-nav__mode-pill nice-sidebar-nav__mode-pill--active nice-sidebar-nav__mode-pill--carousel",onClick:()=>a(s),children:e.jsx("span",{className:"nice-sidebar-nav__mode-pill-icon","aria-hidden":"true",children:d.icon})})}),e.jsx(ce,{content:`Następny tryb: ${ze[h].label}`,position:"bottom",size:"sm",children:e.jsx("button",{type:"button",className:"nice-sidebar-nav__mode-arrow","aria-label":"Następny tryb",onClick:()=>a(h),children:e.jsx("span",{"aria-hidden":"true",children:"›"})})})]})}return e.jsx("div",{className:"nice-sidebar-nav__mode-bar",role:"tablist","aria-label":"Tryb nawigacji",children:t.map(o=>{const r=ze[o],h=s===o;return e.jsx(ce,{content:r.label,position:"bottom",size:"sm",children:e.jsxs("button",{role:"tab","aria-selected":h,"aria-label":r.label,className:["nice-sidebar-nav__mode-pill",h?"nice-sidebar-nav__mode-pill--active":""].filter(Boolean).join(" "),onClick:()=>a(o),children:[e.jsx("span",{className:"nice-sidebar-nav__mode-pill-icon","aria-hidden":"true",children:r.icon}),e.jsx("span",{className:"nice-sidebar-nav__mode-pill-label",children:r.label})]})},o)})})}function fn({open:n,size:s=16}){return e.jsx("svg",{width:s,height:s,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",style:{transition:"transform 160ms ease",transform:n?"rotate(0deg)":"rotate(-90deg)"},children:e.jsx("polyline",{points:"6 9 12 15 18 9"})})}function ps({size:n=14}){return e.jsx("svg",{width:n,height:n,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:e.jsx("polygon",{points:"12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2"})})}function xs({size:n=14}){return e.jsx("svg",{width:n,height:n,viewBox:"0 0 24 24",fill:"currentColor",stroke:"currentColor",strokeWidth:1,strokeLinejoin:"round","aria-hidden":"true",children:e.jsx("polygon",{points:"12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2"})})}function jn({size:n=14}){return e.jsxs("svg",{width:n,height:n,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[e.jsx("path",{d:"M17.94 17.94A10.07 10.07 0 0 1 12 20c-7 0-11-8-11-8a18.45 18.45 0 0 1 5.06-5.94M9.9 4.24A9.12 9.12 0 0 1 12 4c7 0 11 8 11 8a18.5 18.5 0 0 1-2.16 3.19m-6.72-1.07a3 3 0 1 1-4.24-4.24"}),e.jsx("line",{x1:"1",y1:"1",x2:"23",y2:"23"})]})}function vs({size:n=14,filled:s=!1}){return e.jsxs("svg",{width:n,height:n,viewBox:"0 0 24 24",fill:s?"currentColor":"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[e.jsx("line",{x1:"12",y1:"17",x2:"12",y2:"22"}),e.jsx("path",{d:"M5 17h14l-1.5-3V8a2 2 0 0 0-2-2h-7a2 2 0 0 0-2 2v6L5 17z"})]})}function Nn({size:n=12}){return e.jsxs("svg",{width:n,height:n,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2.5,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[e.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),e.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})}function gn({item:n,depth:s,maxDepth:a,activeRoute:l,collapsedIds:t,hiddenIds:o,autoExpand:r,sidebarCollapsed:h=!1,expandableWhenCollapsed:d=!1,onNavigate:c,onHide:m,onToggleCollapse:v,onAddFavorite:p,onRemoveFavorite:j,isFavorite:C,leftClickBehavior:g="focus-existing",routeToUrl:f,contextMenu:$=!0}){const{t:I}=O.$o(),w=i.useRef(null),x=(n.children?.length??0)>0&&s<a,k=t.includes(n.id),L=r?!k:k,M=!!(n.route&&l&&n.route===l),E=!!n.route,D=E&&C(n.id),N=i.useMemo(()=>{if(!$||!E||!n.route)return[];const b=n.route,u=[{id:"open",label:I("sidebar.menu.open","Open"),onClick:()=>c?.(b,n,{forceNew:!1})},{id:"openNewTab",label:I("sidebar.menu.openNewTab","Open in new tab"),onClick:()=>c?.(b,n,{forceNew:!0})}];return f&&u.push({id:"openBrowserTab",label:I("sidebar.menu.openBrowserTab","Open in new browser tab"),onClick:()=>{typeof window<"u"&&window.open(f(b),"_blank","noopener,noreferrer")}}),u.push({id:"sep-1",divider:!0}),D?u.push({id:"unpinFavorite",label:I("sidebar.menu.unpinFavorite","Remove from favorites"),onClick:()=>j(n.id)}):u.push({id:"pinFavorite",label:I("sidebar.menu.pinFavorite","Add to favorites"),onClick:()=>p({id:n.id,label:n.label,icon:n.icon,route:n.route,sourceId:n.sourceId,moduleId:n.moduleId,addedAt:Date.now()})}),u.push({id:"hide",label:I("sidebar.menu.hide","Hide"),onClick:()=>m({id:n.id,kind:n.kind,label:n.label})}),f&&(u.push({id:"sep-2",divider:!0}),u.push({id:"copyLink",label:I("sidebar.menu.copyLink","Copy link"),onClick:()=>{typeof navigator<"u"&&navigator.clipboard&&navigator.clipboard.writeText(f(b))}})),u},[$,E,n,D,f,c,p,j,m,I]);if(o.has(n.id))return null;function R(){if(E&&n.route){const b=g==="open-new";c?.(n.route,n,{forceNew:b})}else x&&v(n.id)}return e.jsxs("li",{className:["nice-sidebar-nav__node",`nice-sidebar-nav__node--depth-${s}`,M?"nice-sidebar-nav__node--active":"",x?"nice-sidebar-nav__node--branch":"nice-sidebar-nav__node--leaf"].filter(Boolean).join(" "),"data-nice-depth":s,style:(()=>{const b=Math.min(Math.max(s,1),10);return{"--nice-row-bg":`var(--nice-sidebar-level-${b}-bg, transparent)`,"--nice-row-text":`var(--nice-sidebar-level-${b}-text, inherit)`,"--nice-row-border":`var(--nice-sidebar-level-${b}-border, transparent)`,"--nice-row-hover-bg":`var(--nice-sidebar-level-${b}-hover-bg, var(--hover-bg))`,"--nice-row-active-bg":`var(--nice-sidebar-level-${b}-active-bg, var(--selected-bg))`}})(),children:[e.jsxs("div",{className:"nice-sidebar-nav__node-row",ref:w,children:[x&&e.jsx(ce,{content:L?"Zwiń":"Rozwiń",position:"right",size:"sm",children:e.jsx("button",{className:"nice-sidebar-nav__collapse-btn","aria-label":L?"Zwiń":"Rozwiń","aria-expanded":L,onClick:()=>v(n.id),children:e.jsx(fn,{open:L,size:20})})}),!x&&e.jsx("span",{className:"nice-sidebar-nav__collapse-spacer"}),e.jsx(ce,{content:n.label,position:"right",size:"sm",children:e.jsxs("span",{role:E?"link":void 0,tabIndex:E?0:void 0,className:["nice-sidebar-nav__node-content",E?"nice-sidebar-nav__node-content--link":"",!E&&x?"nice-sidebar-nav__node-content--toggle":""].filter(Boolean).join(" "),onClick:R,onKeyDown:b=>(b.key==="Enter"||b.key===" ")&&R(),children:[n.icon&&e.jsx("span",{className:"nice-sidebar-nav__node-icon","aria-hidden":"true",children:Ee(n.icon)}),e.jsx("span",{className:"nice-sidebar-nav__node-label",children:n.label}),n.badge!==void 0&&e.jsx("span",{className:"nice-sidebar-nav__node-badge","aria-label":`${n.badge} powiadomień`,children:n.badge})]})}),e.jsxs("div",{className:"nice-sidebar-nav__node-actions",children:[E&&!C(n.id)&&e.jsx(ce,{content:"Dodaj do ulubionych",position:"top",size:"sm",children:e.jsx("button",{className:"nice-sidebar-nav__action-btn nice-sidebar-nav__action-btn--fav","aria-label":"Dodaj do ulubionych",onClick:b=>{b.stopPropagation(),p({id:n.id,label:n.label,icon:n.icon,route:n.route,sourceId:n.sourceId,moduleId:n.moduleId,addedAt:Date.now()})},children:e.jsx(ps,{size:14})})}),C(n.id)&&e.jsx(ce,{content:"W ulubionych",position:"top",size:"sm",children:e.jsx("span",{className:"nice-sidebar-nav__action-btn nice-sidebar-nav__action-btn--fav-active","aria-label":"W ulubionych",children:e.jsx(xs,{size:14})})}),e.jsx(ce,{content:"Ukryj element",position:"top",size:"sm",children:e.jsx("button",{className:"nice-sidebar-nav__action-btn nice-sidebar-nav__action-btn--hide","aria-label":"Ukryj element",onClick:b=>{b.stopPropagation(),m({id:n.id,kind:n.kind,label:n.label})},children:e.jsx(jn,{size:14})})})]})]}),N.length>0&&e.jsx(Be,{target:w,items:N,size:"sm"}),x&&L&&e.jsx("ul",{className:"nice-sidebar-nav__children",children:n.children.map(b=>e.jsx(gn,{item:b,depth:s+1,maxDepth:a,activeRoute:l,collapsedIds:t,hiddenIds:o,autoExpand:r,sidebarCollapsed:h,expandableWhenCollapsed:d,onNavigate:c,onHide:m,onToggleCollapse:v,onAddFavorite:p,onRemoveFavorite:j,isFavorite:C,leftClickBehavior:g,routeToUrl:f,contextMenu:$},b.id))})]})}function fs(n,s){if(!s||s.length===0)return n;const a=new Map(s.map((t,o)=>[t,o])),l=s.length;return[...n].sort((t,o)=>{const r=a.has(t.id)?a.get(t.id):l+n.indexOf(t),h=a.has(o.id)?a.get(o.id):l+n.indexOf(o);return r-h})}function js(n,s){return n.map(a=>({id:a.id,label:a.label,icon:a.icon,kind:"module",sourceId:s,children:a.views.map(l=>({id:l.id,label:l.label,icon:l.icon,route:l.route,badge:l.badge,kind:"view",sourceId:s,moduleId:a.id,children:[]}))}))}function Ns(n,s){return n.map(a=>({id:a.id,label:a.label,icon:a.icon,kind:"role",sourceId:s,children:a.modules.map(l=>({id:`${a.id}:${l.id}`,label:l.label,icon:l.icon,kind:"module",sourceId:s,children:l.views.map(t=>({id:t.id,label:t.label,icon:t.icon,route:t.route,badge:t.badge,kind:"view",sourceId:s,moduleId:l.id,children:[]}))}))}))}function gs(n,s){return n.map(a=>({id:a.id,label:a.label,icon:a.icon,kind:"unit",sourceId:s,children:a.modules.map(l=>({id:`${a.id}:${l.id}`,label:l.label,icon:l.icon,kind:"module",sourceId:s,children:l.views.map(t=>({id:t.id,label:t.label,icon:t.icon,route:t.route,badge:t.badge,kind:"view",sourceId:s,moduleId:l.id,children:[]}))}))}))}function ys({node:n,mode:s,maxDepth:a,isPinned:l,prefs:t,helpers:o,activeRoute:r,onNavigate:h,sidebarCollapsed:d=!1,expandableWhenCollapsed:c=!1,routeToUrl:m,contextMenu:v=!0}){const{t:p}=O.$o(),j=i.useRef(null),C=i.useMemo(()=>new Set(t.hiddenItems.map(x=>x.id)),[t.hiddenItems]),g=i.useMemo(()=>{let x;return s==="all"?x=js(n.modules,n.source.id):s==="by-role"?x=Ns(n.roles,n.source.id):x=gs(n.units,n.source.id),fs(x,t.itemOrder[s])},[s,n,t.itemOrder]),f=i.useCallback(x=>t.favorites.some(k=>k.id===x),[t.favorites]),$=i.useMemo(()=>v?[{id:l?"unpinSource":"pinSource",label:l?p("sidebar.menu.unpinSource","Unpin source"):p("sidebar.menu.pinSource","Pin source"),onClick:()=>l?o.unpinSource(s,n.source.id):o.pinSource(s,n.source.id)},{id:"hideSource",label:p("sidebar.menu.hideSource","Hide source"),onClick:()=>o.hideItem({id:n.source.id,kind:"source",label:n.source.label})}]:[],[v,l,o,s,n.source,p]);if(C.has(n.source.id))return null;const I=t.collapsedIds.includes(n.source.id),w=t.autoExpand?!I:I;return e.jsxs("section",{className:"nice-sidebar-nav__source-section",children:[e.jsx(ce,{content:n.source.label,position:"right",size:"sm",children:e.jsxs("div",{ref:j,className:"nice-sidebar-nav__source-header",onClick:x=>{x.target.closest(".nice-sidebar-nav__source-actions")||o.toggleCollapse(n.source.id)},role:"button",tabIndex:0,"aria-expanded":w,onKeyDown:x=>{(x.key==="Enter"||x.key===" ")&&(x.preventDefault(),o.toggleCollapse(n.source.id))},children:[e.jsx("span",{className:"nice-sidebar-nav__source-chevron","aria-hidden":"true",children:e.jsx(fn,{open:w,size:16})}),n.source.icon&&e.jsx("span",{className:"nice-sidebar-nav__source-icon","aria-hidden":"true",children:Ee(n.source.icon)}),e.jsx("span",{className:"nice-sidebar-nav__source-label",children:n.source.label}),e.jsxs("div",{className:"nice-sidebar-nav__source-actions",onClick:x=>x.stopPropagation(),children:[e.jsx(ce,{content:l?"Odepnij źródło":"Przypnij źródło",position:"top",size:"sm",children:e.jsx("button",{className:["nice-sidebar-nav__action-btn nice-sidebar-nav__action-btn--pin",l?"nice-sidebar-nav__action-btn--pin-active":""].filter(Boolean).join(" "),"aria-label":l?"Odepnij źródło":"Przypnij źródło",onClick:()=>l?o.unpinSource(s,n.source.id):o.pinSource(s,n.source.id),children:e.jsx(vs,{size:14,filled:l})})}),e.jsx(ce,{content:"Ukryj źródło",position:"top",size:"sm",children:e.jsx("button",{className:"nice-sidebar-nav__action-btn nice-sidebar-nav__action-btn--hide","aria-label":"Ukryj źródło",onClick:()=>o.hideItem({id:n.source.id,kind:"source",label:n.source.label}),children:e.jsx(jn,{size:14})})})]})]})}),$.length>0&&e.jsx(Be,{target:j,items:$,size:"sm"}),a>1&&w&&e.jsx("ul",{className:"nice-sidebar-nav__tree",children:g.map(x=>e.jsx(gn,{item:x,depth:2,maxDepth:a,activeRoute:r,collapsedIds:t.collapsedIds,hiddenIds:C,autoExpand:t.autoExpand,sidebarCollapsed:d,expandableWhenCollapsed:c,onNavigate:h,onHide:o.hideItem,onToggleCollapse:o.toggleCollapse,onAddFavorite:o.addFavorite,onRemoveFavorite:o.removeFavorite,isFavorite:f,leftClickBehavior:t.leftClickBehavior,routeToUrl:m,contextMenu:v},x.id))})]})}function ks({favorites:n,activeRoute:s,onNavigate:a,onRemove:l,collapsed:t=!1,leftClickBehavior:o="focus-existing"}){const r=o==="open-new";return n.length===0?e.jsx("p",{className:"nice-sidebar-nav__empty",children:"Brak ulubionych. Najedź na element i kliknij ikonę gwiazdki, aby dodać."}):e.jsx("ul",{className:"nice-sidebar-nav__favorites-list",children:n.map(h=>{const d=!!(h.route&&h.route===s);return e.jsxs("li",{className:["nice-sidebar-nav__fav-item",d?"nice-sidebar-nav__fav-item--active":""].filter(Boolean).join(" "),children:[e.jsx(ce,{content:h.label,position:"right",size:"sm",children:e.jsxs("span",{role:"link",tabIndex:0,className:"nice-sidebar-nav__fav-content",onClick:()=>{h.route&&a?.(h.route,h,{forceNew:r})},onKeyDown:c=>{(c.key==="Enter"||c.key===" ")&&h.route&&a?.(h.route,h,{forceNew:r})},children:[(typeof h.icon=="string"||i.isValidElement(h.icon))&&e.jsx("span",{className:"nice-sidebar-nav__fav-icon","aria-hidden":"true",children:Ee(h.icon)}),e.jsx("span",{className:"nice-sidebar-nav__fav-label",children:h.label})]})}),!t&&e.jsx(ce,{content:"Usuń z ulubionych",position:"top",size:"sm",children:e.jsx("button",{className:"nice-sidebar-nav__action-btn nice-sidebar-nav__action-btn--remove","aria-label":"Usuń z ulubionych",onClick:()=>l(h.id),children:e.jsx(Nn,{size:12})})})]},h.id)})})}function ws(n){const s=[],a=new Set;for(const l of n){const t=l.source;for(const o of l.modules)for(const r of o.views){const h=`${t.id}::${r.id}`;a.has(h)||(a.add(h),s.push({view:r,breadcrumb:[{id:t.id,label:t.label,icon:t.icon},{id:o.id,label:o.label,icon:o.icon}]}))}for(const o of l.roles)for(const r of o.modules)for(const h of r.views){const d=`${t.id}::${h.id}`;a.has(d)||(a.add(d),s.push({view:h,breadcrumb:[{id:t.id,label:t.label,icon:t.icon},{id:o.id,label:o.label,icon:o.icon},{id:r.id,label:r.label,icon:r.icon}]}))}for(const o of l.units)for(const r of o.modules)for(const h of r.views){const d=`${t.id}::${h.id}`;a.has(d)||(a.add(d),s.push({view:h,breadcrumb:[{id:t.id,label:t.label,icon:t.icon},{id:o.id,label:o.label,icon:o.icon},{id:r.id,label:r.label,icon:r.icon}]}))}}return s}function Cs({data:n,activeRoute:s,onNavigate:a,hiddenIds:l,leftClickBehavior:t="focus-existing"}){const{t:o}=O.$o(),[r,h]=i.useState(""),d=t==="open-new",c=i.useMemo(()=>ws(n),[n]),m=i.useMemo(()=>{const v=r.trim().toLowerCase();return v?c.filter(p=>l.has(p.view.id)?!1:p.view.label.toLowerCase().includes(v)?!0:p.breadcrumb.some(j=>j.label.toLowerCase().includes(v))):[]},[c,r,l]);return e.jsxs("div",{className:"nice-sidebar-nav__search",children:[e.jsxs("div",{className:"nice-sidebar-nav__search-inputWrap",children:[e.jsx("span",{className:"nice-sidebar-nav__search-icon","aria-hidden":"true",children:e.jsxs("svg",{width:14,height:14,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("circle",{cx:"11",cy:"11",r:"7"}),e.jsx("line",{x1:"21",y1:"21",x2:"16.65",y2:"16.65"})]})}),e.jsx("input",{type:"text",className:"nice-sidebar-nav__search-input",placeholder:o("sidebarNav.search.placeholder","Szukaj widoków…"),value:r,onChange:v=>h(v.target.value),autoFocus:!0,"aria-label":o("sidebarNav.search.label","Szukaj widoków")}),r&&e.jsx("button",{type:"button",className:"nice-sidebar-nav__search-clear","aria-label":o("common.clear","Wyczyść"),onClick:()=>h(""),children:e.jsx(Nn,{size:12})})]}),!r.trim()&&e.jsx("p",{className:"nice-sidebar-nav__empty",children:"Wpisz tekst, aby przeszukać wszystkie widoki dostępne w panelu."}),r.trim()&&m.length===0&&e.jsxs("p",{className:"nice-sidebar-nav__empty",children:["Brak wyników dla „",r,'".']}),m.length>0&&e.jsx("ul",{className:"nice-sidebar-nav__search-results",children:m.map((v,p)=>{const j=!!(v.view.route&&v.view.route===s),C=!!v.view.route;return e.jsx("li",{className:["nice-sidebar-nav__search-result",j?"nice-sidebar-nav__search-result--active":""].filter(Boolean).join(" "),children:e.jsxs("button",{type:"button",className:"nice-sidebar-nav__search-result-btn",disabled:!C,onClick:()=>{C&&v.view.route&&a?.(v.view.route,v.view,{forceNew:d})},children:[e.jsx("span",{className:"nice-sidebar-nav__search-result-breadcrumb",children:v.breadcrumb.map((g,f)=>e.jsxs("span",{className:"nice-sidebar-nav__search-crumb",children:[g.icon&&e.jsx("span",{className:"nice-sidebar-nav__search-crumb-icon","aria-hidden":"true",children:Ee(g.icon)}),e.jsx("span",{className:"nice-sidebar-nav__search-crumb-label",children:g.label}),e.jsx("span",{className:"nice-sidebar-nav__search-crumb-sep","aria-hidden":"true",children:"›"})]},`${g.id}-${f}`))}),e.jsxs("span",{className:"nice-sidebar-nav__search-result-view",children:[v.view.icon&&e.jsx("span",{className:"nice-sidebar-nav__node-icon","aria-hidden":"true",children:Ee(v.view.icon)}),e.jsx("span",{className:"nice-sidebar-nav__node-label",children:v.view.label}),v.view.badge!==void 0&&e.jsx("span",{className:"nice-sidebar-nav__node-badge",children:v.view.badge})]})]})},`${v.view.id}-${p}`)})})]})}function Ss({activeRoute:n,onNavigate:s,leftClickBehavior:a="focus-existing"}){const{t:l}=O.$o(),t=a==="open-new";return e.jsx("ul",{className:"nice-sidebar-nav__prefs-categories",role:"list",children:He.map(o=>{const r=l(o.labelKey,o.labelDefault),h=n===o.route,d={id:o.id,label:r,icon:o.icon,route:o.route};return e.jsx("li",{className:["nice-sidebar-nav__node nice-sidebar-nav__node--leaf",h?"nice-sidebar-nav__node--active":""].filter(Boolean).join(" "),children:e.jsxs("div",{className:"nice-sidebar-nav__node-row",children:[e.jsx("span",{className:"nice-sidebar-nav__collapse-spacer"}),e.jsx(ce,{content:r,position:"right",size:"sm",children:e.jsxs("span",{role:"link",tabIndex:0,className:"nice-sidebar-nav__node-content nice-sidebar-nav__node-content--link",onClick:()=>s?.(o.route,d,{forceNew:t}),onKeyDown:c=>{(c.key==="Enter"||c.key===" ")&&(c.preventDefault(),s?.(o.route,d,{forceNew:t}))},children:[e.jsx("span",{className:"nice-sidebar-nav__node-icon","aria-hidden":"true",children:o.icon}),e.jsx("span",{className:"nice-sidebar-nav__node-label",children:r})]})})]})},o.id)})})}const $s=i.forwardRef(function({data:s,userId:a,activeRoute:l,onNavigate:t,enableModeIcons:o,preferences:r,onPreferencesChange:h,width:d=264,collapsedWidth:c=56,position:m="left",minimal:v=!1,embedded:p=!1,header:j,footerExtra:C,collapsed:g,onCollapsedChange:f,expandableWhenCollapsed:$=!1,size:I="md",className:w,routeToUrl:x,contextMenu:k=!0,"data-testid":L},M){const[E,D]=i.useState(!1),N=p?!1:g??E,R=i.useCallback(()=>{const S=!N;f?f(S):D(S)},[N,f]),[b,u]=vn(a,o,r,h),_=i.useMemo(()=>{const S=b.activeMode;if(S==="favorites"||S==="preferences"||S==="search")return s;const Z=b.pinnedSources[S];return!Z||Z.length===0?s:s.filter(F=>Z.includes(F.source.id))},[s,b.activeMode,b.pinnedSources]),T=b.maxDepth[b.activeMode]??4;function Y(){const S=b.activeMode;if(!v&&S==="favorites")return e.jsx(ks,{favorites:b.favorites,activeRoute:l,onNavigate:t,onRemove:u.removeFavorite,collapsed:N,leftClickBehavior:b.leftClickBehavior});if(!v&&S==="preferences")return e.jsx(Ss,{activeRoute:l,onNavigate:t,leftClickBehavior:b.leftClickBehavior});if(!v&&S==="search"){const Z=new Set(b.hiddenItems.map(F=>F.id));return e.jsx(Cs,{data:s,activeRoute:l,onNavigate:t,hiddenIds:Z,leftClickBehavior:b.leftClickBehavior})}return _.length===0?e.jsx("p",{className:"nice-sidebar-nav__empty",children:"Brak widocznych źródeł danych dla tego trybu."}):_.map(Z=>{const F=(b.pinnedSources[S]??[]).includes(Z.source.id);return e.jsx(ys,{node:Z,mode:S,maxDepth:T,isPinned:F,prefs:b,helpers:u,activeRoute:l,onNavigate:t,sidebarCollapsed:N,expandableWhenCollapsed:$,routeToUrl:x,contextMenu:k},Z.source.id)})}const B=["nice-sidebar-nav",`nice-sidebar-nav--${I}`,`nice-sidebar-nav--${m}`,v?"nice-sidebar-nav--minimal":"",p?"nice-sidebar-nav--embedded":"",b.enableModeIcons&&!v?"nice-sidebar-nav--with-strip":"",N?"nice-sidebar-nav--collapsed":"",N&&$?"nice-sidebar-nav--expandable-collapsed":"",w].filter(Boolean).join(" "),H=p?{width:"100%"}:{"--nice-sidebar-w":`${d}px`,"--nice-sidebar-w-collapsed":`${c}px`,width:N?c:d};return e.jsxs("div",{ref:M,className:B,style:H,"data-testid":L,"data-mode":b.activeMode,children:[j!=null&&e.jsx("div",{className:"nice-sidebar-nav__header",children:j}),b.enableModeIcons&&!v&&e.jsx(bs,{enabledModes:b.enabledModes,activeMode:b.activeMode,onSelect:u.setMode,collapsed:N}),e.jsx("div",{className:"nice-sidebar-nav__content",children:e.jsx("div",{className:"nice-sidebar-nav__body",children:Y()})}),!p&&e.jsxs("div",{className:"nice-sidebar-nav__footer",children:[e.jsxs("button",{type:"button",className:"nice-sidebar-nav__footer-toggle",onClick:R,"aria-label":N?"Rozwiń sidebar":"Zwiń do ikon",title:N?"Rozwiń sidebar":"Zwiń do ikon",children:[e.jsx("span",{className:"nice-sidebar-nav__footer-toggle-icon","aria-hidden":"true",children:e.jsx("svg",{width:18,height:18,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",style:{transition:"transform 160ms ease",transform:(m==="right"?!N:N)?"rotate(180deg)":"rotate(0deg)"},children:e.jsx("polyline",{points:"15 18 9 12 15 6"})})}),e.jsx("span",{className:"nice-sidebar-nav__footer-toggle-label",children:N?"Rozwiń":"Zwiń do ikon"})]}),C!=null&&e.jsx("div",{className:"nice-sidebar-nav__footer-extra",children:C})]}),p&&C!=null&&e.jsx("div",{className:"nice-sidebar-nav__footer nice-sidebar-nav__footer--embedded",children:e.jsx("div",{className:"nice-sidebar-nav__footer-extra",children:C})})]})}),yn=i.forwardRef(({user:n,userMenuItems:s,onProfile:a,onLogout:l,showLogin:t=!0,loginLabel:o,onLoginClick:r,showRegister:h,registerLabel:d,onRegisterClick:c,size:m="md",compact:v=!1,className:p,style:j,id:C,"data-testid":g="nice-auth-buttons"},f)=>{const{t:$}=O.$o(),I=["nice-auth-buttons",`nice-auth-buttons--${m}`,v?"nice-auth-buttons--compact":"",p??""].filter(Boolean).join(" ");if(n)return e.jsx("div",{ref:f,id:C,className:I,style:j,"data-testid":g,children:e.jsx(Fe,{userName:n.name,userEmail:n.email,userRole:n.role,avatarUrl:n.avatarUrl,status:n.status,items:s,onProfile:a,onLogout:l,size:m})});const w=h??!!c;return e.jsxs("div",{ref:f,id:C,className:I,style:j,"data-testid":g,children:[t&&r&&e.jsx(J.NiceButton,{variant:"ghost",size:m,onClick:r,className:"nice-auth-buttons__login",children:o??$("auth.signIn","Sign in")}),w&&c&&e.jsx(J.NiceButton,{variant:"primary",size:m,onClick:c,className:"nice-auth-buttons__register",children:d??$("auth.register","Register")})]})});yn.displayName="NiceAuthButtons";function Ve(n){return!n.children||n.children.length===0}function kn(n,s){return s?n.id===s?!0:(n.children??[]).some(a=>kn(a,s)):!1}const wn=i.forwardRef(({items:n,activeId:s,size:a="md",align:l="start",ariaLabel:t,stretch:o=!1,trigger:r="click",hoverCloseDelay:h=150,className:d,style:c,id:m,"data-testid":v="nice-nav-menu"},p)=>{const{t:j}=O.$o(),C=i.useId(),[g,f]=i.useState(null),$=i.useRef(null),I=i.useRef(null),w=i.useCallback(()=>{I.current&&(clearTimeout(I.current),I.current=null)},[]),x=i.useCallback(()=>{w(),I.current=setTimeout(()=>{f(null),I.current=null},h)},[w,h]);i.useEffect(()=>()=>w(),[w]);const k=r==="hover",L=_=>!!(_.megaPanel||_.megaColumns&&_.megaColumns.length>0),M=i.useCallback(_=>{$.current=_,typeof p=="function"?p(_):p&&(p.current=_)},[p]);i.useEffect(()=>{if(!g)return;const _=T=>{$.current?.contains(T.target)||f(null)};return document.addEventListener("mousedown",_),()=>document.removeEventListener("mousedown",_)},[g]),i.useEffect(()=>{const _=T=>{T.key==="Escape"&&g&&f(null)};return document.addEventListener("keydown",_),()=>document.removeEventListener("keydown",_)},[g]);const E=i.useMemo(()=>n.filter(_=>!_.divider),[n]),D=(_,T)=>{const Y=!Ve(_),B=L(_),H=Y||B,S=g?.itemId===_.id,F=["nice-nav-menu__item",kn(_,s)?"nice-nav-menu__item--active":"",S?"nice-nav-menu__item--open":"",_.disabled?"nice-nav-menu__item--disabled":"",B?"nice-nav-menu__item--mega":""].filter(Boolean).join(" "),U=V=>{if(V.key==="ArrowRight"){V.preventDefault();const K=E[(T+1)%E.length];$.current?.querySelector(`[data-nice-nav-id="${K.id}"]`)?.focus()}else if(V.key==="ArrowLeft"){V.preventDefault();const K=E[(T-1+E.length)%E.length];$.current?.querySelector(`[data-nice-nav-id="${K.id}"]`)?.focus()}else(V.key==="ArrowDown"||V.key==="Enter"||V.key===" ")&&H&&(V.preventDefault(),f({itemId:_.id,submenuId:null}))},ae=e.jsxs(e.Fragment,{children:[_.icon!=null&&e.jsx("span",{className:"nice-nav-menu__item-icon","aria-hidden":"true",children:_.icon}),e.jsx("span",{className:"nice-nav-menu__item-label",children:_.label}),_.badge!=null&&e.jsx("span",{className:"nice-nav-menu__item-badge",children:_.badge}),H&&e.jsx("span",{className:"nice-nav-menu__item-chevron","aria-hidden":"true",children:"▾"})]});return H?e.jsxs("li",{className:`nice-nav-menu__li${B?" nice-nav-menu__li--mega":""}`,onMouseEnter:k?()=>{w(),f({itemId:_.id,submenuId:null})}:void 0,onMouseLeave:k?x:void 0,children:[e.jsx("button",{type:"button",className:F,"data-nice-nav-id":_.id,"aria-haspopup":B?"true":"menu","aria-expanded":S,"aria-controls":`${C}-panel-${_.id}`,disabled:_.disabled,onClick:()=>{f(k?V=>V?.itemId===_.id?null:{itemId:_.id,submenuId:null}:V=>V?.itemId===_.id?null:{itemId:_.id,submenuId:null})},onKeyDown:U,children:ae}),S&&(B?N(_):R(_))]},_.id):_.href&&!_.disabled?e.jsx("li",{className:"nice-nav-menu__li",children:e.jsx("a",{href:_.href,target:_.target,rel:_.rel,className:F,"data-nice-nav-id":_.id,onKeyDown:U,onClick:V=>{_.onClick?.(V),f(null)},children:ae})},_.id):e.jsx("li",{className:"nice-nav-menu__li",children:e.jsx("button",{type:"button",className:F,"data-nice-nav-id":_.id,disabled:_.disabled,onClick:V=>{_.onClick?.(V),f(null)},onKeyDown:U,children:ae})},_.id)},N=_=>{const T=`${C}-panel-${_.id}`,Y=typeof _.megaPanel=="function"?_.megaPanel():_.megaPanel;return e.jsx("div",{id:T,role:"menu","aria-label":typeof _.label=="string"?_.label:void 0,className:"nice-nav-menu__mega",onMouseEnter:k?w:void 0,onMouseLeave:k?x:void 0,children:e.jsxs("div",{className:"nice-nav-menu__mega-inner",children:[Y??e.jsx("div",{className:"nice-nav-menu__mega-grid",children:(_.megaColumns??[]).map((B,H)=>e.jsxs("div",{className:"nice-nav-menu__mega-col",children:[B.title!=null&&e.jsx("div",{className:"nice-nav-menu__mega-col-title",children:B.title}),e.jsx("ul",{className:"nice-nav-menu__mega-col-list",children:B.items.map(S=>e.jsx("li",{className:"nice-nav-menu__mega-col-li",children:S.href?e.jsxs("a",{role:"menuitem",className:"nice-nav-menu__mega-col-item",href:S.href,target:S.target,rel:S.rel,onClick:Z=>{S.onClick?.(Z),f(null)},children:[S.icon!=null&&e.jsx("span",{className:"nice-nav-menu__mega-col-item-icon","aria-hidden":"true",children:S.icon}),e.jsxs("span",{className:"nice-nav-menu__mega-col-item-text",children:[e.jsx("span",{className:"nice-nav-menu__mega-col-item-label",children:S.label}),S.description&&e.jsx("span",{className:"nice-nav-menu__mega-col-item-desc",children:S.description})]})]}):e.jsxs("button",{type:"button",role:"menuitem",className:"nice-nav-menu__mega-col-item",disabled:S.disabled,onClick:Z=>{S.onClick?.(Z),f(null)},children:[S.icon!=null&&e.jsx("span",{className:"nice-nav-menu__mega-col-item-icon","aria-hidden":"true",children:S.icon}),e.jsxs("span",{className:"nice-nav-menu__mega-col-item-text",children:[e.jsx("span",{className:"nice-nav-menu__mega-col-item-label",children:S.label}),S.description&&e.jsx("span",{className:"nice-nav-menu__mega-col-item-desc",children:S.description})]})]})},S.id))}),B.footer!=null&&e.jsx("div",{className:"nice-nav-menu__mega-col-footer",children:B.footer})]},H))}),_.megaFooter!=null&&e.jsx("div",{className:"nice-nav-menu__mega-footer",children:_.megaFooter})]})})},R=_=>{const T=_.children??[],Y=`${C}-panel-${_.id}`,B=l==="end"?"nice-nav-menu__panel--end":"nice-nav-menu__panel--start";return e.jsx("div",{id:Y,role:"menu","aria-label":typeof _.label=="string"?_.label:void 0,className:`nice-nav-menu__panel ${B}`,children:e.jsx("ul",{className:"nice-nav-menu__panel-list",children:T.map((H,S)=>b(_.id,H,S,T))})})},b=(_,T,Y,B)=>{if(T.divider)return e.jsx("li",{className:"nice-nav-menu__panel-divider",role:"separator"},`div-${Y}`);const H=!Ve(T),S=g?.itemId===_&&g.submenuId===T.id,Z=["nice-nav-menu__panel-item",T.disabled?"nice-nav-menu__panel-item--disabled":"",T.danger?"nice-nav-menu__panel-item--danger":"",S?"nice-nav-menu__panel-item--open":"",T.id===s?"nice-nav-menu__panel-item--active":""].filter(Boolean).join(" "),F=K=>{const le=B.filter(W=>!W.divider&&!W.disabled),_e=le.findIndex(W=>W.id===T.id);if(_e===-1)return;const se=le[(_e+K+le.length)%le.length];$.current?.querySelector(`[data-nice-panel-id="${_}-${se.id}"]`)?.focus()},U=K=>{K.key==="ArrowDown"?(K.preventDefault(),F(1)):K.key==="ArrowUp"?(K.preventDefault(),F(-1)):K.key==="ArrowRight"&&H?(K.preventDefault(),f({itemId:_,submenuId:T.id})):K.key==="ArrowLeft"&&(K.preventDefault(),g?.submenuId?f({itemId:_,submenuId:null}):(f(null),$.current?.querySelector(`[data-nice-nav-id="${_}"]`)?.focus()))},ae=e.jsxs(e.Fragment,{children:[T.icon!=null&&e.jsx("span",{className:"nice-nav-menu__panel-item-icon","aria-hidden":"true",children:T.icon}),e.jsxs("span",{className:"nice-nav-menu__panel-item-text",children:[e.jsx("span",{className:"nice-nav-menu__panel-item-label",children:T.label}),T.description&&e.jsx("span",{className:"nice-nav-menu__panel-item-desc",children:T.description})]}),T.badge!=null&&e.jsx("span",{className:"nice-nav-menu__panel-item-badge",children:T.badge}),H&&e.jsx("span",{className:"nice-nav-menu__panel-item-chevron","aria-hidden":"true",children:"▸"})]}),V=H?e.jsx("button",{type:"button",role:"menuitem",className:Z,"data-nice-panel-id":`${_}-${T.id}`,"aria-haspopup":"menu","aria-expanded":S,disabled:T.disabled,onClick:()=>f(K=>K?.itemId===_&&K.submenuId===T.id?{itemId:_,submenuId:null}:{itemId:_,submenuId:T.id}),onMouseEnter:()=>f({itemId:_,submenuId:T.id}),onKeyDown:U,children:ae}):T.href&&!T.disabled?e.jsx("a",{role:"menuitem",className:Z,"data-nice-panel-id":`${_}-${T.id}`,href:T.href,target:T.target,rel:T.rel,onMouseEnter:()=>f({itemId:_,submenuId:null}),onClick:K=>{T.onClick?.(K),f(null)},onKeyDown:U,children:ae}):e.jsx("button",{type:"button",role:"menuitem",className:Z,"data-nice-panel-id":`${_}-${T.id}`,disabled:T.disabled,onMouseEnter:()=>f({itemId:_,submenuId:null}),onClick:K=>{T.onClick?.(K),f(null)},onKeyDown:U,children:ae});return e.jsxs("li",{className:"nice-nav-menu__panel-li",children:[V,H&&S&&u(_,T)]},T.id)},u=(_,T)=>{const Y=T.children??[];return e.jsxs("div",{role:"menu","aria-label":typeof T.label=="string"?T.label:void 0,className:"nice-nav-menu__subpanel",children:[e.jsx("ul",{className:"nice-nav-menu__panel-list",children:Y.map((B,H)=>{if(B.divider)return e.jsx("li",{className:"nice-nav-menu__panel-divider",role:"separator"},`subdiv-${H}`);const S=["nice-nav-menu__panel-item",B.disabled?"nice-nav-menu__panel-item--disabled":"",B.danger?"nice-nav-menu__panel-item--danger":"",B.id===s?"nice-nav-menu__panel-item--active":""].filter(Boolean).join(" "),Z=e.jsxs(e.Fragment,{children:[B.icon!=null&&e.jsx("span",{className:"nice-nav-menu__panel-item-icon","aria-hidden":"true",children:B.icon}),e.jsxs("span",{className:"nice-nav-menu__panel-item-text",children:[e.jsx("span",{className:"nice-nav-menu__panel-item-label",children:B.label}),B.description&&e.jsx("span",{className:"nice-nav-menu__panel-item-desc",children:B.description})]}),B.badge!=null&&e.jsx("span",{className:"nice-nav-menu__panel-item-badge",children:B.badge})]});return e.jsx("li",{className:"nice-nav-menu__panel-li",children:B.href&&!B.disabled?e.jsx("a",{role:"menuitem",className:S,href:B.href,target:B.target,rel:B.rel,onClick:F=>{B.onClick?.(F),f(null)},children:Z}):e.jsx("button",{type:"button",role:"menuitem",className:S,disabled:B.disabled,onClick:F=>{B.onClick?.(F),f(null)},children:Z})},B.id)})}),e.jsx("span",{hidden:!0,"data-parent-id":_})]})};return e.jsx("nav",{ref:M,id:m,className:["nice-nav-menu",`nice-nav-menu--${a}`,o?"nice-nav-menu--stretch":"",d??""].filter(Boolean).join(" "),style:c,"aria-label":t??j("nav.primary","Primary navigation"),"data-testid":v,children:e.jsx("ul",{className:"nice-nav-menu__list",children:E.map(D)})})});wn.displayName="NiceNavMenu";const Cn=i.forwardRef(({tabs:n,activeIndex:s,renderTab:a,onActiveChange:l,onCloseTab:t,onReorderTabs:o,onSaveState:r,enableShortcuts:h=!0,maxTabs:d=0,showDirtyIndicator:c=!0,tabBarPosition:m="top",draggable:v=!0,showAddButton:p=!1,onAddTab:j,keepAlive:C=!0,warnOnUnsavedClose:g=!0,maxClosedTabs:f=10,onUndoCloseTab:$,getTabState:I,unsavedWarningMessage:w,className:x,style:k,id:L,accessMode:M,...E},D)=>{const N=O.Hs(L),R=O.Zs(M,L),{t:b}=O.$o(),u=i.useRef(null),[_,T]=i.useState(null),[Y,B]=i.useState(null),[H,S]=i.useState([]),[Z,F]=i.useState(null),U=i.useCallback((z,P,ne=!1)=>{if(!ne&&g&&z.isDirty){F({tab:z,index:P});return}const te={tab:{...z},originalIndex:P,closedAt:Date.now(),state:I?.(z)};S(pe=>[te,...pe].slice(0,f)),t?.(z,P)},[g,f,I,t]),ae=i.useCallback(()=>{if(H.length===0)return;const[z,...P]=H;S(P),$?.(z)},[H,$]);i.useEffect(()=>{if(!h)return;const z=P=>{const ne=P.ctrlKey||P.metaKey;if(ne&&P.key==="w"){P.preventDefault();const te=n[s];te&&te.closable!==!1&&U(te,s)}else if(ne&&P.key==="Tab"){P.preventDefault();const te=P.shiftKey?-1:1,pe=(s+te+n.length)%n.length;l?.(pe)}else ne&&P.shiftKey&&(P.key==="t"||P.key==="T")&&(P.preventDefault(),ae())};return window.addEventListener("keydown",z),()=>window.removeEventListener("keydown",z)},[h,n,s,U,ae,l]),i.useEffect(()=>{if(!r)return;const z=setTimeout(()=>{r({tabs:n,activeTabIndex:s})},500);return()=>clearTimeout(z)},[n,s,r]);const V=i.useCallback(z=>{v&&B(z)},[v]),K=i.useCallback((z,P)=>{z.preventDefault()},[Y]),le=i.useCallback(z=>{if(Y===null||Y===z)return;const P=[...n],[ne]=P.splice(Y,1);P.splice(z,0,ne),o?.(P),B(null);let te=s;s===Y?te=z:Y<s&&z>=s?te--:Y>s&&z<=s&&te++,te!==s&&l?.(te)},[Y,n,s,o,l]),_e=i.useCallback((z,P)=>{z.preventDefault(),T({tabIndex:P,x:z.clientX,y:z.clientY})},[]),se=i.useCallback(()=>T(null),[]),W=i.useMemo(()=>{if(!_)return[];const z=n[_.tabIndex];return[{label:b("wm.close","Close"),action:()=>{U(z,_.tabIndex),se()},disabled:z.closable===!1},{label:b("wm.closeAll","Close all"),action:()=>{n.forEach((P,ne)=>P.closable!==!1&&U(P,ne)),se()}},{label:b("wm.closeOthers","Close others"),action:()=>{n.forEach((P,ne)=>ne!==_.tabIndex&&P.closable!==!1&&U(P,ne)),se()}},{label:b("controls.pin","Pin"),action:()=>se()},{type:"divider"},{label:b("wm.reopenClosed","Reopen closed tab"),action:()=>{ae(),se()},disabled:H.length===0,shortcut:"Ctrl+Shift+T"}]},[_,n,b,U,ae,H.length,se]);if(i.useEffect(()=>{if(!_)return;const z=()=>se();return window.addEventListener("click",z),()=>window.removeEventListener("click",z)},[_,se]),R==="hidden")return null;const ue=e.jsxs("div",{className:`nice-mdi__tab-bar nice-mdi__tab-bar--${m}`,role:"tablist",children:[n.map((z,P)=>e.jsxs("div",{className:`nice-mdi__tab ${P===s?"nice-mdi__tab--active":""} ${z.isPinned?"nice-mdi__tab--pinned":""}`,role:"tab","aria-selected":P===s,onClick:()=>l?.(P),onContextMenu:ne=>_e(ne,P),draggable:v,onDragStart:()=>V(P),onDragOver:ne=>K(ne,P),onDrop:()=>le(P),children:[z.icon&&e.jsx("span",{className:"nice-mdi__tab-icon",children:z.icon}),e.jsx("span",{className:"nice-mdi__tab-title",children:z.title}),c&&z.isDirty&&e.jsx("span",{className:"nice-mdi__tab-dirty",title:b("wm.unsaved","Unsaved changes"),children:"●"}),z.closable!==!1&&!z.isPinned&&e.jsx("button",{className:"nice-mdi__tab-close",onClick:ne=>{ne.stopPropagation(),U(z,P)},"aria-label":b("wm.close","Close"),type:"button",children:"×"})]},z.id)),p&&e.jsx("button",{className:"nice-mdi__tab-add",onClick:j,"aria-label":b("controls.new","New"),type:"button",children:"+"})]}),ie=C?e.jsx("div",{className:"nice-mdi__content",children:n.map((z,P)=>e.jsx("div",{className:"nice-mdi__panel",role:"tabpanel",style:{display:P===s?"block":"none"},children:a(z,P)},z.id))}):e.jsx("div",{className:"nice-mdi__content",children:n[s]&&e.jsx("div",{className:"nice-mdi__panel",role:"tabpanel",children:a(n[s],s)})});return e.jsxs("div",{ref:z=>{u.current=z,typeof D=="function"?D(z):D&&(D.current=z)},id:N,className:`nice-mdi ${x??""}`,style:k,...E,children:[m==="top"&&ue,ie,m==="bottom"&&ue,_&&e.jsx("div",{className:"nice-mdi__ctx-menu",style:{position:"fixed",left:_.x,top:_.y,zIndex:9999},children:W.map((z,P)=>"type"in z&&z.type==="divider"?e.jsx("div",{className:"nice-mdi__ctx-divider"},P):e.jsxs("button",{className:"nice-mdi__ctx-item",onClick:z.action,disabled:z.disabled,type:"button",children:[e.jsx("span",{className:"nice-mdi__ctx-label",children:z.label}),"shortcut"in z&&z.shortcut&&e.jsx("span",{className:"nice-mdi__ctx-shortcut",children:z.shortcut})]},P))}),Z&&e.jsx("div",{className:"nice-mdi__modal-backdrop",onClick:()=>F(null),children:e.jsxs("div",{className:"nice-mdi__modal",onClick:z=>z.stopPropagation(),children:[e.jsx("div",{className:"nice-mdi__modal-icon",children:"⚠️"}),e.jsx("h3",{className:"nice-mdi__modal-title",children:b("wm.unsavedTitle","Unsaved Changes")}),e.jsx("p",{className:"nice-mdi__modal-message",children:w??b("wm.unsavedMessage",`"${Z.tab.title}" has unsaved changes. Do you want to close it anyway?`)}),e.jsxs("div",{className:"nice-mdi__modal-actions",children:[e.jsx("button",{type:"button",className:"nice-mdi__modal-btn nice-mdi__modal-btn--secondary",onClick:()=>F(null),children:b("controls.cancel","Cancel")}),e.jsx("button",{type:"button",className:"nice-mdi__modal-btn nice-mdi__modal-btn--danger",onClick:()=>{U(Z.tab,Z.index,!0),F(null)},children:b("wm.closeAnyway","Close Anyway")})]})]})})]})});Cn.displayName="NiceMdiWorkspace";const Sn=i.forwardRef(({menu:n,activeRoute:s,toolbar:a,statusBar:l,sidebarHeader:t,sidebarFooter:o,onNavigate:r,children:h,className:d,style:c,id:m,accessMode:v,...p},j)=>{const C=O.Hs(m),g=O.Zs(v,m),{t:f}=O.$o(),[$,I]=i.useState(!1);return g==="hidden"?null:e.jsxs("div",{ref:j,id:C,className:`nice-shell nice-shell--classic ${$?"nice-shell--sidebar-collapsed":""} ${d??""}`,style:c,...p,children:[e.jsxs("aside",{className:"nice-shell__sidebar",children:[t&&e.jsx("div",{className:"nice-shell__sidebar-header",children:t}),e.jsx("button",{className:"nice-shell__sidebar-toggle",onClick:()=>I(w=>!w),type:"button","aria-label":$?f("expand","Expand"):f("collapse","Collapse"),children:$?"▸":"◂"}),n&&!$&&e.jsx("nav",{className:"nice-shell__nav",role:"navigation",children:n.modules.filter(w=>w.isAvailable).sort((w,x)=>w.order-x.order).map(w=>e.jsxs("div",{className:"nice-shell__nav-group",children:[e.jsxs("div",{className:"nice-shell__nav-group-label",children:[w.icon&&e.jsx("span",{children:w.icon}),e.jsx("span",{children:w.label})]}),e.jsx("ul",{children:w.entities.map(x=>e.jsx("li",{children:e.jsx("button",{className:`nice-shell__nav-item ${s===x.route?"nice-shell__nav-item--active":""}`,onClick:()=>r?.(x.route),type:"button",children:x.label})},x.id))})]},w.id))}),o&&e.jsx("div",{className:"nice-shell__sidebar-footer",children:o})]}),e.jsxs("div",{className:"nice-shell__main",children:[a&&e.jsx("header",{className:"nice-shell__toolbar",children:a}),e.jsx("main",{className:"nice-shell__content",children:h}),l&&e.jsx("footer",{className:"nice-shell__status-bar",children:l})]})]})});Sn.displayName="NiceClassicShell";const $n=i.forwardRef(({topBar:n,sidePanel:s,sidePanelPosition:a="left",sidePanelWidth:l=280,children:t,className:o,style:r,id:h,accessMode:d,...c},m)=>{const v=O.Hs(h);return O.Zs(d,h)==="hidden"?null:e.jsxs("div",{ref:m,id:v,className:`nice-shell nice-shell--dashboard ${o??""}`,style:r,...c,children:[n&&e.jsx("header",{className:"nice-shell__top-bar",children:n}),e.jsxs("div",{className:`nice-shell__dashboard-body nice-shell__dashboard-body--panel-${a}`,children:[s&&e.jsx("aside",{className:"nice-shell__side-panel",style:{width:l},children:s}),e.jsx("main",{className:"nice-shell__dashboard-content",children:t})]})]})});$n.displayName="NiceDashboardShell";const zn=i.forwardRef(({topBar:n,bottomNav:s,children:a,className:l,style:t,id:o,accessMode:r,...h},d)=>{const c=O.Hs(o);return O.Zs(r,o)==="hidden"?null:e.jsxs("div",{ref:d,id:c,className:`nice-shell nice-shell--compact ${l??""}`,style:t,...h,children:[n&&e.jsx("header",{className:"nice-shell__compact-top",children:n}),e.jsx("main",{className:"nice-shell__compact-content",children:a}),s&&e.jsx("footer",{className:"nice-shell__compact-bottom",children:s})]})});zn.displayName="NiceCompactShell";const Mn=i.forwardRef(({overlay:n,lockScreen:s,locked:a=!1,children:l,className:t,style:o,id:r,accessMode:h,...d},c)=>{const m=O.Hs(r);return O.Zs(h,r)==="hidden"?null:e.jsx("div",{ref:c,id:m,className:`nice-shell nice-shell--kiosk ${t??""}`,style:{...o,position:"fixed",inset:0},...d,children:a&&s?e.jsx("div",{className:"nice-shell__kiosk-lock",children:s}):e.jsxs(e.Fragment,{children:[e.jsx("main",{className:"nice-shell__kiosk-content",children:l}),n&&e.jsx("div",{className:"nice-shell__kiosk-overlay",children:n})]})})});Mn.displayName="NiceKioskShell";const En=i.forwardRef(({menu:n,activeRoute:s,tenant:a,topBarActions:l,globalSearch:t,footer:o,onNavigate:r,children:h,className:d,style:c,id:m,accessMode:v,...p},j)=>{const C=O.Hs(m);return O.Zs(v,m)==="hidden"?null:e.jsxs("div",{ref:j,id:C,className:`nice-shell nice-shell--modern ${d??""}`,style:c,...p,children:[e.jsx("aside",{className:"nice-shell__modern-rail",role:"navigation",children:n?.modules.filter(f=>f.isAvailable).sort((f,$)=>f.order-$.order).map(f=>e.jsx("button",{type:"button",title:f.label,className:"nice-shell__modern-rail-item",onClick:()=>f.entities[0]&&r?.(f.entities[0].route),children:e.jsx("span",{"aria-hidden":!0,children:f.icon??"◦"})},f.id))}),e.jsxs("div",{className:"nice-shell__modern-main",children:[e.jsxs("header",{className:"nice-shell__modern-topbar",children:[a&&e.jsxs("div",{className:"nice-shell__modern-tenant",style:a.primaryColor?{borderColor:a.primaryColor}:void 0,children:[a.logoUrl&&e.jsx("img",{src:a.logoUrl,alt:""}),e.jsx("span",{children:a.shortName??a.name}),a.plan&&e.jsx("small",{children:a.plan})]}),t&&e.jsx("div",{className:"nice-shell__modern-search",children:t}),l&&e.jsx("div",{className:"nice-shell__modern-actions",children:l})]}),e.jsx("main",{className:"nice-shell__modern-content","data-active-route":s,children:h}),o&&e.jsx("footer",{className:"nice-shell__modern-footer",children:o})]})]})});En.displayName="NiceModernShell";const Dn=i.forwardRef(({header:n,tenant:s,maxWidth:a=960,centered:l=!0,children:t,className:o,style:r,id:h,accessMode:d,...c},m)=>{const v=O.Hs(h);return O.Zs(d,h)==="hidden"?null:e.jsxs("div",{ref:m,id:v,className:`nice-shell nice-shell--minimal ${l?"nice-shell--minimal-centered":""} ${o??""}`,style:r,...c,children:[(n||s)&&e.jsxs("header",{className:"nice-shell__minimal-header",children:[s&&e.jsxs("div",{className:"nice-shell__minimal-tenant",children:[s.logoUrl&&e.jsx("img",{src:s.logoUrl,alt:""}),e.jsx("span",{children:s.name})]}),n]}),e.jsx("main",{className:"nice-shell__minimal-content",style:{maxWidth:a,marginInline:l?"auto":void 0},children:t})]})});Dn.displayName="NiceMinimalShell";const In=i.forwardRef(({menu:n,activeRoute:s,tenant:a,toolbar:l,inspector:t,inspectorOpen:o=!0,statusBar:r,onNavigate:h,children:d,className:c,style:m,id:v,accessMode:p,...j},C)=>{const g=O.Hs(v),f=O.Zs(p,v),[$,I]=i.useState(o);return f==="hidden"?null:e.jsxs("div",{ref:C,id:g,className:`nice-shell nice-shell--hybrid ${c??""}`,style:m,...j,children:[e.jsxs("header",{className:"nice-shell__hybrid-topbar",children:[a&&e.jsxs("div",{className:"nice-shell__hybrid-tenant",children:[a.logoUrl&&e.jsx("img",{src:a.logoUrl,alt:""}),e.jsx("span",{children:a.name})]}),l,t&&e.jsx("button",{type:"button",className:"nice-shell__hybrid-inspector-toggle",onClick:()=>I(w=>!w),"aria-pressed":$,children:"⚙"})]}),e.jsxs("div",{className:"nice-shell__hybrid-body",children:[e.jsx("aside",{className:"nice-shell__hybrid-sidebar",role:"navigation",children:n?.modules.filter(w=>w.isAvailable).sort((w,x)=>w.order-x.order).map(w=>e.jsxs("div",{className:"nice-shell__hybrid-nav-group",children:[e.jsx("div",{className:"nice-shell__hybrid-nav-group-label",children:w.label}),e.jsx("ul",{children:w.entities.map(x=>e.jsx("li",{children:e.jsx("button",{type:"button",className:`nice-shell__hybrid-nav-item ${s===x.route?"nice-shell__hybrid-nav-item--active":""}`,onClick:()=>h?.(x.route),children:x.label})},x.id))})]},w.id))}),e.jsx("main",{className:"nice-shell__hybrid-content",children:d}),t&&$&&e.jsx("aside",{className:"nice-shell__hybrid-inspector",children:t})]}),r&&e.jsx("footer",{className:"nice-shell__hybrid-status",children:r})]})});In.displayName="NiceHybridShell";const Ln=i.forwardRef(({appTitle:n,tenant:s,topBarActions:a,tabs:l=[],activeTabId:t,onTabChange:o,fab:r,children:h,className:d,style:c,id:m,accessMode:v,...p},j)=>{const C=O.Hs(m);return O.Zs(v,m)==="hidden"?null:e.jsxs("div",{ref:j,id:C,className:`nice-shell nice-shell--pwa ${d??""}`,style:c,...p,children:[e.jsxs("header",{className:"nice-shell__pwa-topbar",children:[e.jsxs("div",{className:"nice-shell__pwa-title",children:[s?.logoUrl&&e.jsx("img",{src:s.logoUrl,alt:""}),e.jsx("span",{children:s?.name??n??""})]}),a&&e.jsx("div",{className:"nice-shell__pwa-actions",children:a})]}),e.jsx("main",{className:"nice-shell__pwa-content",children:h}),r&&e.jsx("div",{className:"nice-shell__pwa-fab",children:r}),l.length>0&&e.jsx("nav",{className:"nice-shell__pwa-tabs",role:"tablist",children:l.map(f=>e.jsxs("button",{type:"button",role:"tab","aria-selected":t===f.id,className:`nice-shell__pwa-tab ${t===f.id?"nice-shell__pwa-tab--active":""}`,onClick:()=>o?.(f.id,f.route),children:[f.icon&&e.jsx("span",{"aria-hidden":!0,children:f.icon}),e.jsx("span",{children:f.label})]},f.id))})]})});Ln.displayName="NicePwaShell";const Tn=i.forwardRef(({modes:n,activeMode:s,onModeChange:a,variant:l="dropdown",gridColumns:t=3,showDescription:o=!0,showColorIndicator:r=!0,compact:h=!1,size:d="md",className:c,style:m,id:v,accessMode:p,...j},C)=>{const g=O.Hs(v),f=O.Zs(p,v),{t:$}=O.$o(),[I,w]=i.useState(!1),x=i.useRef(null),k=n.find(M=>M.key===s);i.useEffect(()=>{if(!I)return;const M=E=>{x.current&&!x.current.contains(E.target)&&w(!1)};return document.addEventListener("mousedown",M),()=>document.removeEventListener("mousedown",M)},[I]);const L=i.useCallback(M=>{a?.(M),w(!1)},[a]);return f==="hidden"?null:l==="dropdown"?e.jsxs("div",{ref:M=>{x.current=M,typeof C=="function"?C(M):C&&(C.current=M)},id:g,className:`nice-mode-selector nice-mode-selector--dropdown nice-mode-selector--${d} ${c??""}`,style:m,...j,children:[e.jsxs("button",{className:"nice-mode-selector__trigger",onClick:()=>w(M=>!M),"aria-expanded":I,"aria-haspopup":"listbox",type:"button",children:[r&&k?.color&&e.jsx("span",{className:"nice-mode-selector__color",style:{backgroundColor:k.color}}),k?.icon&&e.jsx("span",{className:"nice-mode-selector__icon",children:k.icon}),e.jsx("span",{className:"nice-mode-selector__label",children:k?.displayName??s}),e.jsx("span",{className:"nice-mode-selector__chevron",children:I?"▴":"▾"})]}),I&&e.jsx("ul",{className:"nice-mode-selector__menu",role:"listbox",children:n.map(M=>e.jsxs("li",{className:`nice-mode-selector__option ${M.key===s?"nice-mode-selector__option--active":""}`,role:"option","aria-selected":M.key===s,onClick:()=>L(M),children:[r&&M.color&&e.jsx("span",{className:"nice-mode-selector__color",style:{backgroundColor:M.color}}),M.icon&&e.jsx("span",{className:"nice-mode-selector__icon",children:M.icon}),e.jsxs("div",{children:[e.jsx("div",{className:"nice-mode-selector__name",children:M.displayName}),o&&M.description&&e.jsx("div",{className:"nice-mode-selector__desc",children:M.description})]})]},M.key))})]}):l==="pills"?e.jsx("div",{ref:C,id:g,className:`nice-mode-selector nice-mode-selector--pills ${c??""}`,style:m,role:"radiogroup",...j,children:n.map(M=>e.jsxs("button",{className:`nice-mode-selector__pill ${M.key===s?"nice-mode-selector__pill--active":""}`,style:r&&M.color?{borderColor:M.color}:void 0,onClick:()=>L(M),role:"radio","aria-checked":M.key===s,type:"button",children:[M.icon&&e.jsx("span",{children:M.icon}),e.jsx("span",{children:M.displayName})]},M.key))}):e.jsx("div",{ref:C,id:g,className:`nice-mode-selector nice-mode-selector--card-grid ${c??""}`,style:{...m,gridTemplateColumns:`repeat(${t}, 1fr)`},role:"radiogroup",...j,children:n.map(M=>e.jsxs("button",{className:`nice-mode-selector__card ${M.key===s?"nice-mode-selector__card--active":""} ${h?"nice-mode-selector__card--compact":""}`,onClick:()=>L(M),role:"radio","aria-checked":M.key===s,type:"button",children:[r&&M.color&&e.jsx("div",{className:"nice-mode-selector__card-stripe",style:{backgroundColor:M.color}}),M.icon&&e.jsx("div",{className:"nice-mode-selector__card-icon",children:M.icon}),e.jsx("div",{className:"nice-mode-selector__card-name",children:M.displayName}),o&&M.description&&!h&&e.jsx("div",{className:"nice-mode-selector__card-desc",children:M.description}),M.sourcePackage&&!h&&e.jsx("div",{className:"nice-mode-selector__card-pkg",children:M.sourcePackage})]},M.key))})});Tn.displayName="NiceModeSelector";function zs(n){const s=new Map;for(const a of n.sort((l,t)=>l.orderIndex-t.orderIndex))s.has(a.category)||s.set(a.category,[]),s.get(a.category).push(a);return Array.from(s,([a,l])=>({category:a,items:l}))}const Ms=({question:n,value:s,onChange:a})=>{switch(n.questionType){case"boolean":return e.jsxs("div",{className:"nice-onboarding__field nice-onboarding__field--boolean",children:[e.jsxs("label",{className:"nice-onboarding__label",children:[n.question,n.isRequired&&e.jsx("span",{className:"nice-onboarding__required",children:"*"})]}),n.helpText&&e.jsx("p",{className:"nice-onboarding__help",children:n.helpText}),e.jsxs("div",{className:"nice-onboarding__boolean-group",children:[e.jsx("button",{className:`nice-onboarding__bool-btn ${s==="true"?"nice-onboarding__bool-btn--active":""}`,onClick:()=>a("true"),type:"button",children:"✓"}),e.jsx("button",{className:`nice-onboarding__bool-btn ${s==="false"?"nice-onboarding__bool-btn--active":""}`,onClick:()=>a("false"),type:"button",children:"✗"})]})]});case"select":return e.jsxs("div",{className:"nice-onboarding__field nice-onboarding__field--select",children:[e.jsxs("label",{className:"nice-onboarding__label",children:[n.question,n.isRequired&&e.jsx("span",{className:"nice-onboarding__required",children:"*"})]}),n.helpText&&e.jsx("p",{className:"nice-onboarding__help",children:n.helpText}),e.jsx("div",{className:"nice-onboarding__options",children:n.options?.map(l=>e.jsx("button",{className:`nice-onboarding__option ${s===l?"nice-onboarding__option--selected":""}`,onClick:()=>a(l),type:"button",children:l},l))})]});case"multiSelect":return e.jsxs("div",{className:"nice-onboarding__field nice-onboarding__field--multi",children:[e.jsxs("label",{className:"nice-onboarding__label",children:[n.question,n.isRequired&&e.jsx("span",{className:"nice-onboarding__required",children:"*"})]}),n.helpText&&e.jsx("p",{className:"nice-onboarding__help",children:n.helpText}),e.jsx("div",{className:"nice-onboarding__options",children:n.options?.map(l=>{const t=s.split(",").filter(Boolean),o=t.includes(l);return e.jsx("button",{className:`nice-onboarding__option ${o?"nice-onboarding__option--selected":""}`,onClick:()=>{const r=o?t.filter(h=>h!==l):[...t,l];a(r.join(","))},type:"button",children:l},l)})})]});case"number":return e.jsxs("div",{className:"nice-onboarding__field nice-onboarding__field--number",children:[e.jsxs("label",{className:"nice-onboarding__label",children:[n.question,n.isRequired&&e.jsx("span",{className:"nice-onboarding__required",children:"*"})]}),n.helpText&&e.jsx("p",{className:"nice-onboarding__help",children:n.helpText}),e.jsx("input",{type:"number",className:"nice-onboarding__input",value:s,onChange:l=>a(l.target.value)})]});case"date":return e.jsxs("div",{className:"nice-onboarding__field nice-onboarding__field--date",children:[e.jsxs("label",{className:"nice-onboarding__label",children:[n.question,n.isRequired&&e.jsx("span",{className:"nice-onboarding__required",children:"*"})]}),n.helpText&&e.jsx("p",{className:"nice-onboarding__help",children:n.helpText}),e.jsx("input",{type:"date",className:"nice-onboarding__input",value:s,onChange:l=>a(l.target.value)})]});default:return e.jsxs("div",{className:"nice-onboarding__field nice-onboarding__field--text",children:[e.jsxs("label",{className:"nice-onboarding__label",children:[n.question,n.isRequired&&e.jsx("span",{className:"nice-onboarding__required",children:"*"})]}),n.helpText&&e.jsx("p",{className:"nice-onboarding__help",children:n.helpText}),e.jsx("input",{type:"text",className:"nice-onboarding__input",value:s,onChange:l=>a(l.target.value),placeholder:n.defaultValue})]})}},Rn=i.forwardRef(({questions:n,initialAnswers:s=[],stepLabels:a,onComplete:l,onCancel:t,onStepChange:o,welcomeContent:r,completionContent:h,showProgress:d=!0,allowBack:c=!0,logo:m,size:v="md",className:p,style:j,id:C,accessMode:g,...f},$)=>{const I=O.Hs(C),w=O.Zs(g,C),{t:x}=O.$o(),k=i.useMemo(()=>zs(n),[n]),L=!!r,M=!!h,E=L?-1:0,D=M?k.length:k.length-1,[N,R]=i.useState(E),[b,u]=i.useState(()=>{const F=new Map;for(const U of s)F.set(U.questionId,U.answer);for(const U of n)!F.has(U.id)&&U.defaultValue&&F.set(U.id,U.defaultValue);return F}),_=i.useCallback((F,U)=>{u(ae=>{const V=new Map(ae);return V.set(F,U),V})},[]),T=i.useMemo(()=>N<0||N>=k.length?!0:k[N].items.every(U=>!U.isRequired||(b.get(U.id)??"").trim().length>0),[N,k,b]),Y=i.useCallback(()=>{if(N>=D){const U=[];b.forEach((ae,V)=>U.push({questionId:V,answer:ae})),l?.(U);return}const F=N+1;R(F),o?.(F)},[N,D,b,l,o]),B=i.useCallback(()=>{if(N<=E)return;const F=N-1;R(F),o?.(F)},[N,E,o]),H=k.length+(L?1:0)+(M?1:0),S=N-E,Z=Math.round(S/Math.max(H-1,1)*100);return w==="hidden"?null:e.jsxs("div",{ref:$,id:I,className:`nice-onboarding nice-onboarding--${v} ${p??""}`,style:j,...f,children:[e.jsxs("div",{className:"nice-onboarding__header",children:[m&&e.jsx("div",{className:"nice-onboarding__logo",children:m}),d&&e.jsx("div",{className:"nice-onboarding__progress",children:e.jsx("div",{className:"nice-onboarding__progress-bar",style:{width:`${Z}%`}})}),e.jsx("div",{className:"nice-onboarding__steps",children:k.map((F,U)=>e.jsxs("div",{className:`nice-onboarding__step-dot ${U===N?"nice-onboarding__step-dot--active":""} ${U<N?"nice-onboarding__step-dot--done":""}`,children:[e.jsx("span",{children:U+1}),e.jsx("span",{className:"nice-onboarding__step-label",children:a?.[U]??F.category})]},U))})]}),e.jsxs("div",{className:"nice-onboarding__body",children:[N===-1&&r,N>=0&&N<k.length&&e.jsxs("div",{className:"nice-onboarding__questions",children:[e.jsx("h2",{className:"nice-onboarding__category",children:k[N].category}),k[N].items.map(F=>e.jsx(Ms,{question:F,value:b.get(F.id)??"",onChange:U=>_(F.id,U)},F.id))]}),N===k.length&&h]}),e.jsxs("div",{className:"nice-onboarding__footer",children:[t&&e.jsx("button",{className:"nice-onboarding__btn nice-onboarding__btn--cancel",onClick:t,type:"button",children:x("cancel","Cancel")}),e.jsxs("div",{className:"nice-onboarding__footer-right",children:[c&&N>E&&e.jsx("button",{className:"nice-onboarding__btn nice-onboarding__btn--back",onClick:B,type:"button",children:x("back","Back")}),e.jsx("button",{className:"nice-onboarding__btn nice-onboarding__btn--next",onClick:Y,disabled:!T,type:"button",children:N>=D?x("finish","Finish"):x("next","Next")})]})]})]})});Rn.displayName="NiceOnboardingWizard";const Es=[{key:"Mon",label:"Monday"},{key:"Tue",label:"Tuesday"},{key:"Wed",label:"Wednesday"},{key:"Thu",label:"Thursday"},{key:"Fri",label:"Friday"},{key:"Sat",label:"Saturday"},{key:"Sun",label:"Sunday"}],Ds=[{value:"YYYY-MM-DD",label:"YYYY-MM-DD"},{value:"DD/MM/YYYY",label:"DD/MM/YYYY"},{value:"MM/DD/YYYY",label:"MM/DD/YYYY"},{value:"DD.MM.YYYY",label:"DD.MM.YYYY"}],Ze=["basic","contact","address","branding","localization","fiscal","preferences"],we=({title:n,expanded:s,onToggle:a})=>e.jsxs("button",{className:`nice-org-form__section-header ${s?"nice-org-form__section-header--expanded":""}`,onClick:a,type:"button","aria-expanded":s,children:[e.jsx("span",{className:"nice-org-form__section-title",children:n}),e.jsx("span",{className:"nice-org-form__section-chevron",children:s?"▾":"▸"})]}),On=i.forwardRef(({profile:n,onChange:s,onSave:a,onCancel:l,sections:t,expandedSections:o,showActions:r=!0,countryOptions:h,languageOptions:d,currencyOptions:c,timezoneOptions:m,saving:v=!1,className:p,style:j,id:C,accessMode:g,...f},$)=>{const I=O.Hs(C),w=O.Zs(g,C),{t:x}=O.$o(),k=i.useMemo(()=>t&&t.length>0?t:Ze,[t]),[L,M]=i.useState(()=>new Set(o??Ze)),E=i.useCallback(u=>{M(_=>{const T=new Set(_);return T.has(u)?T.delete(u):T.add(u),T})},[]),D=w==="readOnly",N=w==="disabled",R=i.useCallback((u,_)=>{s?.({...n,[u]:_})},[n,s]),b=i.useCallback(()=>{a?.(n)},[n,a]);return w==="hidden"?null:e.jsxs("div",{ref:$,id:I,className:`nice-org-form ${p??""}`,style:j,...f,children:[k.includes("basic")&&e.jsxs("div",{className:"nice-org-form__section",children:[e.jsx(we,{title:x("org.basic","Company Information"),expanded:L.has("basic"),onToggle:()=>E("basic")}),L.has("basic")&&e.jsxs("div",{className:"nice-org-form__fields",children:[e.jsx(J.NiceTextInput,{label:x("org.name","Company Name"),value:n.name,onChange:u=>R("name",u),required:!0,disabled:N,readOnly:D}),e.jsx(J.NiceTextInput,{label:x("org.legalName","Legal Name"),value:n.legalName??"",onChange:u=>R("legalName",u),disabled:N,readOnly:D}),e.jsx(J.NiceTextInput,{label:x("org.taxId","Tax ID"),value:n.taxId??"",onChange:u=>R("taxId",u),disabled:N,readOnly:D}),e.jsx(J.NiceTextInput,{label:x("org.regNumber","Registration Number"),value:n.registrationNumber??"",onChange:u=>R("registrationNumber",u),disabled:N,readOnly:D}),e.jsx(J.NiceTextInput,{label:x("org.industry","Industry"),value:n.industry??"",onChange:u=>R("industry",u),disabled:N,readOnly:D}),e.jsx(J.NiceNumberInput,{label:x("org.employees","Number of Employees"),value:n.employeeCount??null,onChange:u=>R("employeeCount",u??void 0),min:1,disabled:N,readOnly:D})]})]}),k.includes("contact")&&e.jsxs("div",{className:"nice-org-form__section",children:[e.jsx(we,{title:x("org.contact","Contact Details"),expanded:L.has("contact"),onToggle:()=>E("contact")}),L.has("contact")&&e.jsxs("div",{className:"nice-org-form__fields",children:[e.jsx(J.NiceTextInput,{label:x("org.email","Email"),value:n.email??"",onChange:u=>R("email",u),type:"email",disabled:N,readOnly:D}),e.jsx(J.NiceTextInput,{label:x("org.phone","Phone"),value:n.phone??"",onChange:u=>R("phone",u),type:"tel",disabled:N,readOnly:D}),e.jsx(J.NiceTextInput,{label:x("org.website","Website"),value:n.website??"",onChange:u=>R("website",u),type:"url",disabled:N,readOnly:D}),e.jsx(J.NiceTextInput,{label:x("org.fax","Fax"),value:n.fax??"",onChange:u=>R("fax",u),type:"tel",disabled:N,readOnly:D})]})]}),k.includes("address")&&e.jsxs("div",{className:"nice-org-form__section",children:[e.jsx(we,{title:x("org.address","Address"),expanded:L.has("address"),onToggle:()=>E("address")}),L.has("address")&&e.jsxs("div",{className:"nice-org-form__fields",children:[e.jsx(J.NiceTextInput,{label:x("org.street","Street"),value:n.street??"",onChange:u=>R("street",u),disabled:N,readOnly:D}),e.jsx(J.NiceTextInput,{label:x("org.city","City"),value:n.city??"",onChange:u=>R("city",u),disabled:N,readOnly:D}),e.jsx(J.NiceTextInput,{label:x("org.state","State / Province"),value:n.state??"",onChange:u=>R("state",u),disabled:N,readOnly:D}),e.jsx(J.NiceTextInput,{label:x("org.postalCode","Postal Code"),value:n.postalCode??"",onChange:u=>R("postalCode",u),disabled:N,readOnly:D}),h?e.jsx(J.NiceSelect,{label:x("org.country","Country"),value:n.country??"",onChange:u=>R("country",u),options:h,searchable:!0,disabled:N,readOnly:D}):e.jsx(J.NiceTextInput,{label:x("org.country","Country"),value:n.country??"",onChange:u=>R("country",u),disabled:N,readOnly:D})]})]}),k.includes("branding")&&e.jsxs("div",{className:"nice-org-form__section",children:[e.jsx(we,{title:x("org.branding","Branding"),expanded:L.has("branding"),onToggle:()=>E("branding")}),L.has("branding")&&e.jsxs("div",{className:"nice-org-form__fields",children:[e.jsx(J.NiceTextInput,{label:x("org.logoUrl","Logo URL"),value:n.logoUrl??"",onChange:u=>R("logoUrl",u),type:"url",disabled:N,readOnly:D}),e.jsx(J.NiceColorPicker,{label:x("org.primaryColor","Primary Color"),value:n.primaryColor??"var(--color-primary, #3b82f6)",onChange:u=>R("primaryColor",u),disabled:N,readOnly:D}),e.jsx(J.NiceColorPicker,{label:x("org.secondaryColor","Secondary Color"),value:n.secondaryColor??"var(--color-accent, #8b5cf6)",onChange:u=>R("secondaryColor",u),disabled:N,readOnly:D})]})]}),k.includes("localization")&&e.jsxs("div",{className:"nice-org-form__section",children:[e.jsx(we,{title:x("org.localization","Localization"),expanded:L.has("localization"),onToggle:()=>E("localization")}),L.has("localization")&&e.jsxs("div",{className:"nice-org-form__fields",children:[d?e.jsx(J.NiceSelect,{label:x("org.language","Default Language"),value:n.defaultLanguage??"",onChange:u=>R("defaultLanguage",u),options:d,searchable:!0,disabled:N,readOnly:D}):e.jsx(J.NiceTextInput,{label:x("org.language","Default Language"),value:n.defaultLanguage??"",onChange:u=>R("defaultLanguage",u),disabled:N,readOnly:D}),c?e.jsx(J.NiceSelect,{label:x("org.currency","Default Currency"),value:n.defaultCurrency??"",onChange:u=>R("defaultCurrency",u),options:c,searchable:!0,disabled:N,readOnly:D}):e.jsx(J.NiceTextInput,{label:x("org.currency","Default Currency"),value:n.defaultCurrency??"",onChange:u=>R("defaultCurrency",u),disabled:N,readOnly:D}),m?e.jsx(J.NiceSelect,{label:x("org.timezone","Default Timezone"),value:n.defaultTimezone??"",onChange:u=>R("defaultTimezone",u),options:m,searchable:!0,disabled:N,readOnly:D}):e.jsx(J.NiceTextInput,{label:x("org.timezone","Default Timezone"),value:n.defaultTimezone??"",onChange:u=>R("defaultTimezone",u),disabled:N,readOnly:D}),e.jsx(J.NiceSelect,{label:x("org.dateFormat","Date Format"),value:n.dateFormat??"YYYY-MM-DD",onChange:u=>R("dateFormat",u),options:Ds,disabled:N,readOnly:D})]})]}),k.includes("fiscal")&&e.jsxs("div",{className:"nice-org-form__section",children:[e.jsx(we,{title:x("org.fiscal","Fiscal Settings"),expanded:L.has("fiscal"),onToggle:()=>E("fiscal")}),L.has("fiscal")&&e.jsxs("div",{className:"nice-org-form__fields",children:[e.jsx(J.NiceTextInput,{label:x("org.fiscalYearStart","Fiscal Year Start"),value:n.fiscalYearStart??"",onChange:u=>R("fiscalYearStart",u),placeholder:"MM-DD",disabled:N,readOnly:D}),e.jsx(J.NiceToggle,{label:x("org.vatEnabled","VAT Enabled"),checked:n.vatEnabled??!1,onChange:u=>R("vatEnabled",u),disabled:N||D}),n.vatEnabled&&e.jsx(J.NiceNumberInput,{label:x("org.defaultVatRate","Default VAT Rate (%)"),value:n.defaultVatRate??null,onChange:u=>R("defaultVatRate",u??void 0),min:0,max:100,step:.5,disabled:N,readOnly:D})]})]}),k.includes("preferences")&&e.jsxs("div",{className:"nice-org-form__section",children:[e.jsx(we,{title:x("org.preferences","Work Preferences"),expanded:L.has("preferences"),onToggle:()=>E("preferences")}),L.has("preferences")&&e.jsxs("div",{className:"nice-org-form__fields",children:[e.jsxs("div",{className:"nice-org-form__field-group",children:[e.jsx("label",{className:"nice-org-form__group-label",children:x("org.workingDays","Working Days")}),e.jsx("div",{className:"nice-org-form__checkboxes",children:Es.map(u=>e.jsx(J.NiceCheckbox,{label:u.label,checked:(n.workingDays??["Mon","Tue","Wed","Thu","Fri"]).includes(u.key),onChange:_=>{const T=n.workingDays??["Mon","Tue","Wed","Thu","Fri"],Y=_?[...T,u.key]:T.filter(B=>B!==u.key);R("workingDays",Y)},disabled:N||D},u.key))})]}),e.jsx(J.NiceTextInput,{label:x("org.workStart","Working Hours Start"),value:n.workingHoursStart??"09:00",onChange:u=>R("workingHoursStart",u),placeholder:"HH:MM",disabled:N,readOnly:D}),e.jsx(J.NiceTextInput,{label:x("org.workEnd","Working Hours End"),value:n.workingHoursEnd??"17:00",onChange:u=>R("workingHoursEnd",u),placeholder:"HH:MM",disabled:N,readOnly:D})]})]}),r&&e.jsxs("div",{className:"nice-org-form__actions",children:[l&&e.jsx(J.NiceButton,{variant:"secondary",onClick:l,disabled:v,children:x("cancel","Cancel")}),a&&e.jsx(J.NiceButton,{variant:"primary",onClick:b,loading:v,disabled:D||N,children:x("save","Save")})]})]})});On.displayName="NiceOrganizationProfileForm";const Is={available:{color:"var(--text-muted, #6b7280)",icon:"○"},installed:{color:"var(--color-primary, #3b82f6)",icon:"◉"},active:{color:"var(--color-success, #10b981)",icon:"●"},disabled:{color:"var(--color-warning, #f59e0b)",icon:"◌"},error:{color:"var(--color-error, #ef4444)",icon:"⊘"},updating:{color:"var(--color-accent, #8b5cf6)",icon:"↻"}};function Ls(n,s){switch(n){case"available":return["install"];case"installed":return["activate",...s?[]:["uninstall"]];case"active":return["deactivate"];case"disabled":return["activate",...s?[]:["uninstall"]];case"error":return["activate",...s?[]:["uninstall"]];case"updating":return[];default:return[]}}const Ts=({module:n,onAction:s,onClick:a,showDependencies:l,showAuthor:t,showVersion:o,processing:r,disabled:h,readOnly:d,t:c,layout:m})=>{const v=Is[n.status],p=Ls(n.status,n.isCore);return e.jsxs("div",{className:`nice-module-card nice-module-card--${m} nice-module-card--${n.status}`,onClick:a,role:a?"button":void 0,tabIndex:a?0:void 0,onKeyDown:a?j=>{(j.key==="Enter"||j.key===" ")&&(j.preventDefault(),a())}:void 0,children:[e.jsxs("div",{className:"nice-module-card__header",children:[e.jsx("span",{className:"nice-module-card__icon",children:n.icon??"📦"}),e.jsxs("div",{className:"nice-module-card__info",children:[e.jsx("div",{className:"nice-module-card__name",children:n.label}),o&&e.jsxs("span",{className:"nice-module-card__version",children:["v",n.version]})]}),e.jsxs("span",{className:"nice-module-card__status",style:{color:v.color},title:n.status,children:[r?"⟳":v.icon," ",n.status]})]}),e.jsx("div",{className:"nice-module-card__desc",children:n.description}),e.jsxs("div",{className:"nice-module-card__meta",children:[t&&n.author&&e.jsx("span",{className:"nice-module-card__author",children:n.author}),n.isCore&&e.jsx("span",{className:"nice-module-card__badge nice-module-card__badge--core",children:c("module.core","Core")})]}),l&&n.dependencies&&n.dependencies.length>0&&e.jsxs("div",{className:"nice-module-card__deps",children:[e.jsxs("span",{className:"nice-module-card__deps-label",children:[c("module.deps","Dependencies"),":"]}),n.dependencies.map(j=>e.jsx("span",{className:"nice-module-card__dep-tag",children:j},j))]}),!d&&p.length>0&&e.jsx("div",{className:"nice-module-card__actions",children:p.map(j=>e.jsx(J.NiceButton,{size:"sm",variant:j==="uninstall"?"error":j==="activate"?"primary":"secondary",onClick:C=>{C.stopPropagation(),s(j)},disabled:h||r,loading:r,children:c(`module.${j}`,j.charAt(0).toUpperCase()+j.slice(1))},j))})]})},An=i.forwardRef(({modules:n,onAction:s,statusFilter:a,searchable:l=!0,showDependencies:t=!0,showAuthor:o=!0,showVersion:r=!0,processingModules:h,layout:d="list",gridColumns:c=3,onModuleClick:m,className:v,style:p,id:j,accessMode:C,...g},f)=>{const $=O.Hs(j),I=O.Zs(C,j),{t:w}=O.$o(),[x,k]=i.useState(""),[L,M]=i.useState("all"),E=I==="readOnly",D=I==="disabled",N=i.useMemo(()=>{let u=n;if(a&&a.length>0&&(u=u.filter(_=>a.includes(_.status))),L!=="all"&&(u=u.filter(_=>_.status===L)),x){const _=x.toLowerCase();u=u.filter(T=>T.label.toLowerCase().includes(_)||T.name.toLowerCase().includes(_)||T.description.toLowerCase().includes(_))}return u},[n,a,L,x]),R=i.useMemo(()=>{const u={all:n.length};for(const _ of n)u[_.status]=(u[_.status]??0)+1;return u},[n]),b=i.useCallback((u,_)=>{s?.(u,_)},[s]);return I==="hidden"?null:e.jsxs("div",{ref:f,id:$,className:`nice-module-panel ${v??""}`,style:p,...g,children:[e.jsxs("div",{className:"nice-module-panel__toolbar",children:[l&&e.jsx(J.NiceTextInput,{value:x,onChange:k,placeholder:w("module.search","Search modules…"),type:"search",clearable:!0,className:"nice-module-panel__search"}),e.jsx("div",{className:"nice-module-panel__filters",role:"tablist",children:["all","active","installed","disabled","available","error"].map(u=>e.jsxs("button",{className:`nice-module-panel__filter ${L===u?"nice-module-panel__filter--active":""}`,onClick:()=>M(u),role:"tab","aria-selected":L===u,type:"button",children:[w(`module.status.${u}`,u==="all"?"All":u.charAt(0).toUpperCase()+u.slice(1)),e.jsx("span",{className:"nice-module-panel__filter-count",children:R[u]??0})]},u))})]}),e.jsx("div",{className:`nice-module-panel__grid nice-module-panel__grid--${d}`,style:d==="grid"?{gridTemplateColumns:`repeat(${c}, 1fr)`}:void 0,children:N.length===0?e.jsx("div",{className:"nice-module-panel__empty",children:w("module.empty","No modules found")}):N.map(u=>e.jsx(Ts,{module:u,onAction:_=>b(u.id,_),onClick:m?()=>m(u):void 0,showDependencies:t,showAuthor:o,showVersion:r,processing:h?.has(u.id)??!1,disabled:D,readOnly:E,t:w,layout:d},u.id))}),e.jsxs("div",{className:"nice-module-panel__summary",children:[w("module.total","Total"),": ",n.length," ·",w("module.status.active","Active"),":"," ",R.active??0," ·",w("module.status.disabled","Disabled"),":"," ",R.disabled??0," ·",w("module.status.error","Error"),":"," ",R.error??0]})]})});An.displayName="NiceModuleLifecyclePanel";exports.DEFAULT_SIDEBAR_PREFS=We;exports.DesktopContextMenu=rn;exports.DesktopGrid=cn;exports.DesktopStartMenu=ln;exports.DesktopSystemTray=tn;exports.DesktopTaskbar=Oe;exports.NiceAccordion=Pn;exports.NiceAppLayout=nn;exports.NiceAuthButtons=yn;exports.NiceBottomNavigation=sn;exports.NiceBreadcrumb=Yn;exports.NiceCard=qe;exports.NiceCard$1=Un;exports.NiceClassicShell=Sn;exports.NiceCompactShell=zn;exports.NiceConsole=dn;exports.NiceContextMenu=Be;exports.NiceDashboardLayout=en;exports.NiceDashboardShell=$n;exports.NiceDesktop=on;exports.NiceDock=an;exports.NiceDynamicSidebar=pn;exports.NiceHybridShell=In;exports.NiceKioskShell=Mn;exports.NiceMdiWorkspace=Cn;exports.NiceMenu=Xe;exports.NiceMinimalShell=Dn;exports.NiceModeSelector=Tn;exports.NiceModernShell=En;exports.NiceModuleLifecyclePanel=An;exports.NiceMultiView=Vn;exports.NiceNavMenu=wn;exports.NiceNavbar=_n;exports.NiceOnboardingWizard=Rn;exports.NiceOrganizationProfileForm=On;exports.NicePwaShell=Ln;exports.NiceSetupWizard=hn;exports.NiceSidebarNav=$s;exports.NiceSplitter=Kn;exports.NiceStepper=Ge;exports.NiceTabPanel=Zn;exports.NiceTenantSwitcher=bn;exports.NiceToolbar=qn;exports.NiceTooltip=ce;exports.NiceUserMenu=Fe;exports.NiceWizard=un;exports.PREFS_CATEGORIES=He;exports.SIDEBAR_MODE_META=ze;exports.buildPrefsCategoryViews=rs;exports.useSetupWizard=Xn;exports.useSidebarNavPrefs=vn;
|