@nice2dev/ui 1.1.9 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +150 -0
- package/README.md +27 -34
- package/dist/NiceButton-5tWvfXKl.cjs +1 -0
- package/dist/NiceButton-DHSgQT1_.js +112 -0
- package/dist/NiceCodeEditor-B8At55f5.js +1179 -0
- package/dist/NiceCodeEditor-BJSEzhcY.cjs +260 -0
- package/dist/NiceCodeEditor-BfkH1bsZ.cjs +260 -0
- package/dist/NiceCodeEditor-CduGYggj.js +1179 -0
- package/dist/NiceColorPicker-CdUnhM-A.cjs +1 -0
- package/dist/NiceColorPicker-DCgmE-3H.cjs +1 -0
- package/dist/NiceColorPicker-DK30kJgy.js +486 -0
- package/dist/NiceColorPicker-DpXwnDwL.js +598 -0
- package/dist/NiceColorPicker-DtPFxDKM.cjs +1 -0
- package/dist/NiceColorPicker-bNJBAU_c.js +598 -0
- package/dist/NiceConfirmDialog-B7aNRL2K.cjs +1 -0
- package/dist/NiceConfirmDialog-BdhWenrO.js +81 -0
- package/dist/NiceDataGrid-BOCJr6XF.js +2217 -0
- package/dist/NiceDataGrid-BV5Oh-gy.cjs +10 -0
- package/dist/NiceDataGrid-CVYEo_nv.cjs +10 -0
- package/dist/NiceDataGrid-D-rm4lu8.js +2217 -0
- package/dist/NiceDataGrid-Dd7SI-M6.cjs +10 -0
- package/dist/NiceDataGrid-DjZchXYG.js +2217 -0
- package/dist/NiceDocumentViewer-BgcgLWJ3.cjs +180 -0
- package/dist/NiceDocumentViewer-sukmGhRx.js +672 -0
- package/dist/NiceForm-BCEXovJR.cjs +1 -0
- package/dist/NiceForm-D7oyWHXg.js +4820 -0
- package/dist/NiceForm-DUhxXArr.js +4817 -0
- package/dist/NiceForm-DVc0Xoly.js +4819 -0
- package/dist/NiceForm-qD_RKPYz.cjs +1 -0
- package/dist/NiceForm-uCeVmTrD.cjs +1 -0
- package/dist/NiceGantt-4UBd4uJ8.cjs +1 -0
- package/dist/NiceGantt-B_1lwEsp.js +328 -0
- package/dist/NiceHtmlEditor-BYk1roA4.cjs +10 -0
- package/dist/NiceHtmlEditor-Bce9Vwe1.cjs +10 -0
- package/dist/NiceHtmlEditor-C5kLeF9H.cjs +10 -0
- package/dist/NiceHtmlEditor-CFVMIC5L.js +848 -0
- package/dist/NiceHtmlEditor-CGRgcu2h.js +848 -0
- package/dist/NiceHtmlEditor-mWebBmy1.js +849 -0
- package/dist/NiceLoginForm-BHyDY7br.cjs +1 -0
- package/dist/NiceLoginForm-BTuQ0eKk.cjs +1 -0
- package/dist/NiceLoginForm-BuxFY2Rk.js +750 -0
- package/dist/NiceLoginForm-o1A-TBcp.js +736 -0
- package/dist/NiceLoginForm.css +1 -0
- package/dist/NiceMention-CA7CL5BI.js +11263 -0
- package/dist/NiceMention-CHcKRl-L.cjs +430 -0
- package/dist/NiceMention-DJD0BLcp.js +11269 -0
- package/dist/NiceMention-DcaUEMSg.cjs +430 -0
- package/dist/NiceMention-Dds9GQzk.cjs +430 -0
- package/dist/NiceMention-DlLXWddO.js +11268 -0
- package/dist/NiceMention.css +1 -1
- package/dist/NiceModal-C4p8a82e.cjs +1 -0
- package/dist/NiceModal-Dr1e3nQZ.cjs +1 -0
- package/dist/NiceModal-TNlkaL_i.js +85 -0
- package/dist/NiceModal-sihGCfDy.js +95 -0
- package/dist/NiceModuleLifecyclePanel-BWbKdVC_.js +7054 -0
- package/dist/NiceModuleLifecyclePanel-CZHIzvkE.cjs +1 -0
- package/dist/NiceModuleLifecyclePanel-Du7G3-RG.js +7053 -0
- package/dist/NiceModuleLifecyclePanel-OC9YK2kG.js +7052 -0
- package/dist/NiceModuleLifecyclePanel-_OcfDmtC.cjs +1 -0
- package/dist/NiceModuleLifecyclePanel-js1p7LIY.cjs +1 -0
- package/dist/NicePagination-8XsBbMNx.js +165 -0
- package/dist/NicePagination-CkOoXf0f.js +165 -0
- package/dist/NicePagination-D44waj9o.cjs +1 -0
- package/dist/NicePagination-D7lek1G7.cjs +1 -0
- package/dist/NicePagination-DdxH8KMG.js +179 -0
- package/dist/NicePagination-OjTEfZJE.cjs +1 -0
- package/dist/NicePivotGrid-B2YHP3Z6.js +1183 -0
- package/dist/NicePivotGrid-BJRSciWl.js +1183 -0
- package/dist/NicePivotGrid-BtVUWiud.cjs +152 -0
- package/dist/NicePivotGrid-CS1dPmNI.cjs +152 -0
- package/dist/NicePivotGrid-D2AxqDzJ.js +1183 -0
- package/dist/NicePivotGrid-DxQ6Py9D.cjs +152 -0
- package/dist/NiceSavedQueryPanel-B5HhqlAI.cjs +586 -0
- package/dist/NiceSavedQueryPanel-C0A-eoYN.js +5142 -0
- package/dist/NiceSavedQueryPanel-CMStDOKe.js +5125 -0
- package/dist/NiceSavedQueryPanel-D2i34e_b.cjs +586 -0
- package/dist/NiceSavedQueryPanel-ZrilZRtf.cjs +586 -0
- package/dist/NiceSavedQueryPanel-mPO2THs7.js +5142 -0
- package/dist/NiceSavedQueryPanel.css +1 -1
- package/dist/NiceScheduler-7gP7vcLy.cjs +5 -0
- package/dist/NiceScheduler-Cy7F9tgH.js +1693 -0
- package/dist/NiceScheduler-DquRUZxD.cjs +5 -0
- package/dist/NiceScheduler-KSzaUQxC.js +1693 -0
- package/dist/NiceScheduler-O3AwmdGG.cjs +5 -0
- package/dist/NiceScheduler-l8N4yCWd.js +1716 -0
- package/dist/NiceSelect-BCbWtu1v.js +433 -0
- package/dist/NiceSelect-BqtiQbfD.cjs +1 -0
- package/dist/NiceSelect-DZB1Rs9x.js +435 -0
- package/dist/NiceSelect-tMz9QQUs.cjs +1 -0
- package/dist/NiceStreamDashboard.doc-74KUXya1.cjs +8 -0
- package/dist/NiceStreamDashboard.doc-k8PQfCM0.js +32 -0
- package/dist/NiceWindow-BEov3s9F.js +2094 -0
- package/dist/NiceWindow-BU1Ce7gS.js +1623 -0
- package/dist/NiceWindow-CDt6PCEg.cjs +1 -0
- package/dist/NiceWindow-jjdE6vGy.cjs +1 -0
- package/dist/NiceWindow.css +1 -1
- package/dist/charts-C047IMVn.cjs +768 -0
- package/dist/charts-C44vJber.cjs +768 -0
- package/dist/charts-CCXSb3xk.js +4752 -0
- package/dist/charts-CqETcUhH.js +4752 -0
- package/dist/charts-DouiiHOT.cjs +768 -0
- package/dist/charts-XVlDwU0y.js +4732 -0
- package/dist/charts.cjs +1 -1
- package/dist/charts.mjs +8 -8
- package/dist/core-BL-KmGYC.js +795 -0
- package/dist/core-BxiH7vkV.cjs +1 -0
- package/dist/core-Chg-oYCr.cjs +1 -0
- package/dist/core-CxBnKAhs.cjs +1 -0
- package/dist/core-DMV6_SEE.js +795 -0
- package/dist/core-D_LRh59n.js +795 -0
- package/dist/data-branching-Km4lc8P_.cjs +1 -0
- package/dist/data-branching-YQtJJEtn.js +6273 -0
- package/dist/data-branching-oEH04O3i.js +6273 -0
- package/dist/data-branching-wmsbLNfa.cjs +1 -0
- package/dist/data-branching.cjs +1 -1
- package/dist/data-branching.mjs +1 -1
- package/dist/data.cjs +1 -1
- package/dist/data.d.ts +2 -53
- package/dist/data.mjs +3 -3
- package/dist/devops-Bt6EsfPa.cjs +17 -0
- package/dist/devops-CnZQ1rU5.js +8312 -0
- package/dist/devops-D5yIDM3e.js +8312 -0
- package/dist/devops-rVpB0ZAX.cjs +17 -0
- package/dist/devops.cjs +1 -1
- package/dist/devops.mjs +1 -1
- package/dist/editors.cjs +1 -1
- package/dist/editors.d.ts +8 -26
- package/dist/editors.mjs +55 -54
- package/dist/feedback.cjs +1 -1
- package/dist/feedback.d.ts +5 -0
- package/dist/feedback.mjs +3 -3
- package/dist/index.cjs +290 -290
- package/dist/index.css +1 -1
- package/dist/index.d.ts +239 -234
- package/dist/index.mjs +20262 -19440
- package/dist/lazy.cjs +1 -1
- package/dist/lazy.mjs +29 -29
- package/dist/navigation.cjs +1 -1
- package/dist/navigation.d.ts +4 -4
- package/dist/navigation.mjs +69 -69
- package/dist/no-code-4GtIBr6f.js +7503 -0
- package/dist/no-code-6WyYb3hL.cjs +331 -0
- package/dist/no-code-BH5oVFC6.js +8186 -0
- package/dist/no-code-Bdwh1vyS.cjs +332 -0
- package/dist/no-code-CnHG5_Vn.js +8186 -0
- package/dist/no-code-DMKlg1Zl.cjs +331 -0
- package/dist/no-code.cjs +1 -1
- package/dist/no-code.css +1 -1
- package/dist/no-code.d.ts +25 -18
- package/dist/no-code.mjs +3 -3
- package/dist/overlays.cjs +1 -1
- package/dist/overlays.d.ts +24 -24
- package/dist/overlays.mjs +24 -490
- package/dist/pickerCommons-0vyK1Knv.js +547 -0
- package/dist/pickerCommons-31hyz1gs.js +1122 -0
- package/dist/pickerCommons-BFbItm8o.cjs +1 -0
- package/dist/pickerCommons-BHirHJyn.js +548 -0
- package/dist/pickerCommons-BifIkPdk.cjs +1 -0
- package/dist/pickerCommons-Bt8JIaTN.cjs +1 -0
- package/dist/pickerCommons.css +1 -1
- package/dist/style.css +10 -7
- package/package.json +5 -7
- package/css/legacy-bg-text-aliases.css +0 -87
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const e=require("react/jsx-runtime"),j=require("@nice2dev/ui-core"),s=require("react"),en=require("react-dom"),Ae=require("./NiceColorPicker-CdUnhM-A.cjs"),re=require("./pickerCommons-BifIkPdk.cjs"),ns=require("./NiceConfirmDialog-B7aNRL2K.cjs"),Fe=require("./NiceSelect-BqtiQbfD.cjs"),_n=[{code:"en",nativeName:"English",englishName:"English",flagCountryCode:"GB"},{code:"en-US",nativeName:"English (US)",englishName:"English (US)",flagCountryCode:"US"},{code:"en-GB",nativeName:"English (UK)",englishName:"English (UK)",flagCountryCode:"GB"},{code:"pl",nativeName:"Polski",englishName:"Polish",flagCountryCode:"PL"},{code:"de",nativeName:"Deutsch",englishName:"German",flagCountryCode:"DE"},{code:"de-AT",nativeName:"Deutsch (Österreich)",englishName:"German (Austria)",flagCountryCode:"AT"},{code:"de-CH",nativeName:"Deutsch (Schweiz)",englishName:"German (Switzerland)",flagCountryCode:"CH"},{code:"fr",nativeName:"Français",englishName:"French",flagCountryCode:"FR"},{code:"fr-CA",nativeName:"Français (Canada)",englishName:"French (Canada)",flagCountryCode:"CA"},{code:"es",nativeName:"Español",englishName:"Spanish",flagCountryCode:"ES"},{code:"es-MX",nativeName:"Español (México)",englishName:"Spanish (Mexico)",flagCountryCode:"MX"},{code:"es-AR",nativeName:"Español (Argentina)",englishName:"Spanish (Argentina)",flagCountryCode:"AR"},{code:"it",nativeName:"Italiano",englishName:"Italian",flagCountryCode:"IT"},{code:"pt",nativeName:"Português",englishName:"Portuguese",flagCountryCode:"PT"},{code:"pt-BR",nativeName:"Português (Brasil)",englishName:"Portuguese (Brazil)",flagCountryCode:"BR"},{code:"nl",nativeName:"Nederlands",englishName:"Dutch",flagCountryCode:"NL"},{code:"sv",nativeName:"Svenska",englishName:"Swedish",flagCountryCode:"SE"},{code:"no",nativeName:"Norsk",englishName:"Norwegian",flagCountryCode:"NO"},{code:"da",nativeName:"Dansk",englishName:"Danish",flagCountryCode:"DK"},{code:"fi",nativeName:"Suomi",englishName:"Finnish",flagCountryCode:"FI"},{code:"cs",nativeName:"Čeština",englishName:"Czech",flagCountryCode:"CZ"},{code:"sk",nativeName:"Slovenčina",englishName:"Slovak",flagCountryCode:"SK"},{code:"hu",nativeName:"Magyar",englishName:"Hungarian",flagCountryCode:"HU"},{code:"ro",nativeName:"Română",englishName:"Romanian",flagCountryCode:"RO"},{code:"bg",nativeName:"Български",englishName:"Bulgarian",flagCountryCode:"BG"},{code:"el",nativeName:"Ελληνικά",englishName:"Greek",flagCountryCode:"GR"},{code:"tr",nativeName:"Türkçe",englishName:"Turkish",flagCountryCode:"TR"},{code:"ru",nativeName:"Русский",englishName:"Russian",flagCountryCode:"RU"},{code:"uk",nativeName:"Українська",englishName:"Ukrainian",flagCountryCode:"UA"},{code:"ar",nativeName:"العربية",englishName:"Arabic",flagCountryCode:"SA"},{code:"he",nativeName:"עברית",englishName:"Hebrew",flagCountryCode:"IL"},{code:"fa",nativeName:"فارسی",englishName:"Persian",flagCountryCode:"IR"},{code:"hi",nativeName:"हिन्दी",englishName:"Hindi",flagCountryCode:"IN"},{code:"zh",nativeName:"中文",englishName:"Chinese",flagCountryCode:"CN"},{code:"zh-TW",nativeName:"繁體中文",englishName:"Chinese (Traditional)",flagCountryCode:"TW"},{code:"ja",nativeName:"日本語",englishName:"Japanese",flagCountryCode:"JP"},{code:"ko",nativeName:"한국어",englishName:"Korean",flagCountryCode:"KR"},{code:"th",nativeName:"ไทย",englishName:"Thai",flagCountryCode:"TH"},{code:"vi",nativeName:"Tiếng Việt",englishName:"Vietnamese",flagCountryCode:"VN"},{code:"id",nativeName:"Bahasa Indonesia",englishName:"Indonesian",flagCountryCode:"ID"}],nn=({value:n,defaultValue:i,onChange:a,placeholder:u,showSearch:r=!0,searchThreshold:d=8,searchPlaceholder:o,isOpen:p,onOpenChange:c,showFlagInValue:t=!0,showFlagInMenu:h=!0,showTextInValue:f,showTextInMenu:_=!0,showCodeInValue:v,showCodeInMenu:w=!0,displayName:L="native",compact:b=!1,variant:R="default",dropdownAlign:T,disabled:y=!1,languages:x,allowedCodes:k,priorityCodes:I=["en","pl","de","fr","es"],allowClear:E=!1,size:C="md",className:N="",style:M,label:z,helperText:D,error:l,required:m,readOnly:S,loading:K,labelPlacement:B,errorPlacement:O,labelWidth:$,controlWidth:J,id:Y,"data-testid":Z="nice-language-picker"})=>{const{t:Q}=j.useNiceTranslation(),F=s.useRef(null),q=s.useRef(null),U=s.useRef(null),[ie,xe]=s.useState(i),[P,Ne]=s.useState(!1),ce=p??P,ae=s.useCallback(G=>{const W=typeof G=="function"?G(ce):G;p===void 0&&Ne(W),c?.(W)},[ce,p,c]),[le,ne]=s.useState(""),[A,V]=s.useState(0),oe=f??(!b&&R!=="ghost"),_e=v??!1,ye=b?320:280,Re=re.useDropdownAlignment(ce,q,T??(b?"auto":"left"),ye),Me=n!==void 0?n:ie,ue=x??_n,X=s.useMemo(()=>{if(!k||k.length===0)return ue;const G=k.map(H=>H.toLowerCase()),W=new Set(G),he=new Set(G.map(H=>H.split("-")[0])),je=ue.filter(H=>{const se=H.code.toLowerCase();return!!(W.has(se)||!se.includes("-")&&he.has(se))});return process.env.NODE_ENV!=="production"&&je.length===0&&console.warn(`[Nice2Dev] <NiceLanguagePicker> received \`allowedCodes\` but none matched any entry in the language list. Picker will render empty. Got codes: ${JSON.stringify(k)}. Tip: pass canonical BCP-47 primary tags (e.g. \`pl\`, not \`pl-PL\`).`),je},[ue,k]),fe=s.useMemo(()=>{if(!I?.length)return X;const G=new Set(I),W=X.filter(je=>G.has(je.code)),he=X.filter(je=>!G.has(je.code));return[...W,...he]},[X,I]),pe=s.useMemo(()=>{if(!le)return fe;const G=le.toLowerCase();return fe.filter(W=>W.nativeName.toLowerCase().includes(G)||W.englishName.toLowerCase().includes(G)||W.code.toLowerCase().includes(G))},[fe,le]),ve=s.useMemo(()=>Me?X.find(G=>G.code===Me)??null:null,[Me,X]),$e=r&&X.length>=d;s.useEffect(()=>{if(!ce)return;const G=W=>{F.current&&!F.current.contains(W.target)&&(ae(!1),ne(""))};return document.addEventListener("mousedown",G),()=>document.removeEventListener("mousedown",G)},[ce,ae]),s.useEffect(()=>{ce&&$e&&U.current&&U.current.focus()},[ce,$e]),s.useEffect(()=>{V(0)},[le]);const Ee=s.useCallback(G=>{n===void 0&&xe(G.code),a?.(G),ae(!1),ne("")},[n,a,ae]),ge=s.useCallback(G=>{G.stopPropagation(),n===void 0&&xe(void 0),a?.(null)},[n,a]),Ie=s.useCallback(G=>{if(!ce){(G.key==="Enter"||G.key===" "||G.key==="ArrowDown")&&(G.preventDefault(),ae(!0));return}switch(G.key){case"ArrowDown":G.preventDefault(),V(W=>Math.min(W+1,pe.length-1));break;case"ArrowUp":G.preventDefault(),V(W=>Math.max(W-1,0));break;case"Enter":G.preventDefault(),pe[A]&&Ee(pe[A]);break;case"Escape":G.preventDefault(),ae(!1),ne("");break}},[ce,pe,A,Ee,ae]),ke=G=>L==="english"?G.englishName:G.nativeName;return e.jsxs("div",{ref:F,className:`nice-field nice-field--${C} nice-field--language-picker ${B==="left"?"nice-field--label-left":""} ${O==="right"?"nice-field--error-right":""} ${l?"nice-field--error":""} ${K?"nice-field--loading":""} nice-country-picker nice-language-picker nice-country-picker--${C} ${b?"nice-country-picker--compact":""} ${R==="ghost"?"nice-country-picker--ghost":""} ${ce?"nice-country-picker--open":""} ${y?"nice-country-picker--disabled":""} ${N}`,style:{...M,...$!=null&&{"--nice-field-label-width":typeof $=="number"?`${$}px`:$},...J!=null&&{"--nice-field-control-width":typeof J=="number"?`${J}px`:J}},"data-testid":Z,"aria-busy":K||void 0,children:[z&&e.jsxs("label",{className:"nice-field__label",htmlFor:Y,children:[z,m&&e.jsx("span",{className:"nice-field__required",children:"*"})]}),e.jsxs("div",{className:"nice-field__control",children:[e.jsxs("button",{ref:q,type:"button",className:"nice-country-picker__trigger",onClick:G=>{y||S||(G.stopPropagation(),ae(!ce))},onKeyDown:Ie,disabled:y,id:Y,"aria-haspopup":"listbox","aria-expanded":ce,"aria-invalid":l?!0:void 0,"data-testid":`${Z}-trigger`,children:[ve?e.jsxs("span",{className:"nice-country-picker__value",children:[t&&e.jsx("span",{className:"nice-country-picker__flag","aria-hidden":"true",children:e.jsx(re.FlagIcon,{code:ve.flagCountryCode})}),oe&&e.jsx("span",{className:"nice-country-picker__name",children:ke(ve)}),_e&&e.jsxs("span",{className:"nice-country-picker__dial-code",children:["(",ve.code,")"]})]}):e.jsx("span",{className:"nice-country-picker__placeholder",children:b?"":u??Q("controls.select","Select language")}),e.jsxs("span",{className:"nice-country-picker__icons",children:[E&&ve&&!y&&!S&&e.jsx("span",{className:"nice-country-picker__clear",onClick:ge,"aria-label":Q("clear","Clear"),children:e.jsx(j.NiceIcon,{name:"close",size:14})}),R!=="ghost"&&e.jsx("span",{className:"nice-country-picker__arrow",children:e.jsx(j.NiceIcon,{name:ce?"chevron-up":"chevron-down",size:16})})]})]}),ce&&e.jsxs("div",{className:`nice-country-picker__dropdown nice-country-picker__dropdown--align-${Re}`,style:b?{minWidth:`${ye}px`,maxWidth:"calc(100vw - 16px)"}:void 0,role:"listbox","data-testid":`${Z}-dropdown`,children:[$e&&e.jsx("div",{className:"nice-country-picker__search",children:e.jsx("input",{ref:U,type:"text",value:le,onChange:G=>ne(G.target.value),onKeyDown:Ie,placeholder:o??Q("languagePicker.filter","Filter languages…"),className:"nice-country-picker__search-input","data-testid":`${Z}-search`})}),e.jsx("div",{className:"nice-country-picker__list",children:pe.length===0?e.jsx("div",{className:"nice-country-picker__empty",children:Q("noData","No languages found")}):pe.map((G,W)=>e.jsxs("div",{className:`nice-country-picker__option ${G.code===Me?"nice-country-picker__option--selected":""} ${W===A?"nice-country-picker__option--highlighted":""}`,onClick:()=>Ee(G),onMouseEnter:()=>V(W),role:"option","aria-selected":G.code===Me,"data-testid":`${Z}-option-${G.code}`,children:[h&&e.jsx("span",{className:"nice-country-picker__flag","aria-hidden":"true",children:e.jsx(re.FlagIcon,{code:G.flagCountryCode})}),_&&e.jsx("span",{className:"nice-country-picker__name",children:ke(G)}),w&&e.jsx("span",{className:"nice-country-picker__dial-code",children:G.code})]},G.code))})]}),K&&e.jsx("span",{className:"nice-field__spinner",children:e.jsx("span",{className:"nice-spinner nice-spinner--sm"})}),O==="right"&&l&&e.jsx("div",{className:"nice-field__error",role:"alert",children:l}),O==="right"&&!l&&D&&e.jsx("div",{className:"nice-field__helper",children:D})]}),O!=="right"&&l&&e.jsx("div",{className:"nice-field__error",role:"alert",children:l}),O!=="right"&&!l&&D&&e.jsx("div",{className:"nice-field__helper",children:D})]})};nn.displayName="NiceLanguagePicker";function bn(n){return{id:n.name,name:n.name,preview:{background:n.backgrounds.primary,backgroundSecondary:n.backgrounds.secondary,primary:n.colors.primary,textColor:n.text.primary,border:n.borders.color},readOnly:!0}}const Je=j.NICE_THEME_PRESETS.map(bn),ss=(n,i)=>{const a=encodeURIComponent(i.returnUrl);if(i.themeId){const r=n.includes("?")?"&":"?";return`${n}${r}themeId=${encodeURIComponent(i.themeId)}&returnUrl=${a}`}return`${n.replace(/\/+$/,"")}/new?returnUrl=${a}`},is=n=>{typeof window<"u"&&(window.location.href=n)},un=n=>n.nativeName??n.name,sn=({value:n,defaultValue:i,onChange:a,themes:u,placeholder:r,showSearch:d=!0,searchThreshold:o=8,searchPlaceholder:p,isOpen:c,onOpenChange:t,showPreviewInValue:h=!0,showPreviewInMenu:f=!0,showTextInValue:_,showTextInMenu:v=!0,showIdInValue:w=!1,showIdInMenu:L=!1,compact:b=!1,variant:R="default",dropdownAlign:T,previewSize:y,previewShape:x="page",edit:k,disabled:I=!1,allowClear:E=!1,size:C="md",className:N="",style:M,label:z,helperText:D,error:l,required:m,readOnly:S,loading:K,labelPlacement:B,errorPlacement:O,labelWidth:$,controlWidth:J,id:Y,"data-testid":Z="nice-theme-picker"})=>{const{t:Q}=j.useNiceTranslation(),F=s.useMemo(()=>!u||u.length===0?(process.env.NODE_ENV!=="production"&&Array.isArray(u)&&console.warn(`[Nice2Dev] <NiceThemePicker> received \`themes={[]}\` (empty array). Falling back to ${Je.length} built-in presets. Omit the \`themes\` prop to silence this warning, or pass at least one descriptor.`),Je):u,[u]),q=s.useRef(null),U=s.useRef(null),ie=s.useRef(null),[xe,P]=s.useState(i),[Ne,ce]=s.useState(!1),ae=c??Ne,le=s.useCallback(W=>{const he=typeof W=="function"?W(ae):W;c===void 0&&ce(he),t?.(he)},[ae,c,t]),[ne,A]=s.useState(""),[V,oe]=s.useState(0),_e=_??(!b&&R!=="ghost"),ye=y??(b?24:28),Re=y??32,Me=b?320:280,ue=re.useDropdownAlignment(ae,U,T??(b?"auto":"left"),Me),X=n!==void 0?n:xe,fe=s.useMemo(()=>{if(!ne)return F;const W=ne.toLowerCase();return F.filter(he=>he.id.toLowerCase().includes(W)||he.name.toLowerCase().includes(W)||(he.nativeName?.toLowerCase().includes(W)??!1))},[F,ne]),pe=s.useMemo(()=>X?F.find(W=>W.id===X)??null:null,[X,F]),ve=d&&F.length>=o;s.useEffect(()=>{if(!ae)return;const W=he=>{q.current&&!q.current.contains(he.target)&&(le(!1),A(""))};return document.addEventListener("mousedown",W),()=>document.removeEventListener("mousedown",W)},[ae,le]),s.useEffect(()=>{ae&&ve&&ie.current&&ie.current.focus()},[ae,ve]),s.useEffect(()=>{oe(0)},[ne]);const $e=s.useRef(!1);s.useEffect(()=>{process.env.NODE_ENV!=="production"&&F.length===0&&!$e.current&&($e.current=!0,console.warn("[@nice2dev/ui] <NiceThemePicker> received an empty `themes` array. Omit the prop to use NICE_THEME_PICKER_PRESETS, or pass your own NiceThemeDescriptor[] (use `toThemeDescriptor(theme)` to adapt a NiceTheme)."))},[F]);const Ee=s.useCallback(W=>{n===void 0&&P(W.id),a?.(W),le(!1),A("")},[n,a,le]),ge=s.useCallback(W=>{W.stopPropagation(),n===void 0&&P(void 0),a?.(null)},[n,a]),Ie=s.useCallback(W=>{if(!k?.enabled&&!k?.addNew?.enabled)return;const he=k.returnUrl??(typeof window<"u"?window.location.href:"/"),je=(k.buildUrl??(H=>ss(k.editorRoute,H)))({themeId:W,returnUrl:he});(k.navigate??is)(je),le(!1)},[k,le]),ke=s.useCallback(W=>{if(!ae){(W.key==="Enter"||W.key===" "||W.key==="ArrowDown")&&(W.preventDefault(),le(!0));return}switch(W.key){case"ArrowDown":W.preventDefault(),oe(he=>Math.min(he+1,fe.length-1));break;case"ArrowUp":W.preventDefault(),oe(he=>Math.max(he-1,0));break;case"Enter":W.preventDefault(),fe[V]&&Ee(fe[V]);break;case"Escape":W.preventDefault(),le(!1),A("");break}},[ae,fe,V,Ee,le]),G=W=>!!(k?.enabled&&(!W.readOnly||k?.allowEditBuiltIn));return e.jsxs("div",{ref:q,className:`nice-field nice-field--${C} nice-field--theme-switcher ${B==="left"?"nice-field--label-left":""} ${O==="right"?"nice-field--error-right":""} ${l?"nice-field--error":""} ${K?"nice-field--loading":""} nice-country-picker nice-theme-picker nice-country-picker--${C} ${b?"nice-country-picker--compact":""} ${R==="ghost"?"nice-country-picker--ghost":""} ${ae?"nice-country-picker--open":""} ${I?"nice-country-picker--disabled":""} ${N}`,style:{...M,...$!=null&&{"--nice-field-label-width":typeof $=="number"?`${$}px`:$},...J!=null&&{"--nice-field-control-width":typeof J=="number"?`${J}px`:J}},"data-testid":Z,"aria-busy":K||void 0,children:[z&&e.jsxs("label",{className:"nice-field__label",htmlFor:Y,children:[z,m&&e.jsx("span",{className:"nice-field__required",children:"*"})]}),e.jsxs("div",{className:"nice-field__control",children:[e.jsxs("button",{ref:U,type:"button",className:"nice-country-picker__trigger",onClick:W=>{I||S||(W.stopPropagation(),le(!ae))},onKeyDown:ke,disabled:I,id:Y,"aria-haspopup":"listbox","aria-expanded":ae,"aria-invalid":l?!0:void 0,"data-testid":`${Z}-trigger`,children:[pe?e.jsxs("span",{className:"nice-country-picker__value",children:[h&&e.jsx("span",{className:"nice-country-picker__flag","aria-hidden":"true",children:e.jsx(re.ThemePreviewSwatch,{colors:pe.preview,size:ye,shape:x})}),_e&&e.jsx("span",{className:"nice-country-picker__name",children:un(pe)}),w&&e.jsxs("span",{className:"nice-country-picker__dial-code",children:["(",pe.id,")"]})]}):e.jsx("span",{className:"nice-country-picker__placeholder",children:b?"":r??Q("controls.select","Select theme")}),e.jsxs("span",{className:"nice-country-picker__icons",children:[E&&pe&&!I&&!S&&e.jsx("span",{className:"nice-country-picker__clear",onClick:ge,"aria-label":Q("clear","Clear"),children:e.jsx(j.NiceIcon,{name:"close",size:14})}),R!=="ghost"&&e.jsx("span",{className:"nice-country-picker__arrow",children:e.jsx(j.NiceIcon,{name:ae?"chevron-up":"chevron-down",size:16})})]})]}),ae&&e.jsxs("div",{className:`nice-country-picker__dropdown nice-country-picker__dropdown--align-${ue}`,style:b?{minWidth:`${Me}px`,maxWidth:"calc(100vw - 16px)"}:void 0,role:"listbox","data-testid":`${Z}-dropdown`,children:[ve&&e.jsx("div",{className:"nice-country-picker__search",children:e.jsx("input",{ref:ie,type:"text",value:ne,onChange:W=>A(W.target.value),onKeyDown:ke,placeholder:p??Q("themePicker.filter","Filter themes…"),className:"nice-country-picker__search-input","data-testid":`${Z}-search`})}),k?.addNew?.enabled&&e.jsxs("button",{type:"button",className:"nice-theme-picker__add-btn nice-theme-picker__add-btn--top",onClick:()=>Ie(void 0),"data-testid":`${Z}-add`,children:[e.jsx(j.NiceIcon,{name:"plus",size:14})," ",k.addNew.label??k.addLabel??Q("themePicker.addTheme","Add theme")]}),e.jsx("div",{className:"nice-country-picker__list",children:fe.length===0?e.jsx("div",{className:"nice-country-picker__empty",children:Q("noData","No themes found")}):fe.map((W,he)=>e.jsxs("div",{className:`nice-country-picker__option nice-theme-picker__option ${W.id===X?"nice-country-picker__option--selected":""} ${he===V?"nice-country-picker__option--highlighted":""}`,onClick:()=>Ee(W),onMouseEnter:()=>oe(he),role:"option","aria-selected":W.id===X,"data-testid":`${Z}-option-${W.id}`,children:[f&&e.jsx("span",{className:"nice-country-picker__flag","aria-hidden":"true",children:e.jsx(re.ThemePreviewSwatch,{colors:W.preview,size:Re,shape:x})}),v&&e.jsx("span",{className:"nice-country-picker__name",children:un(W)}),L&&e.jsx("span",{className:"nice-country-picker__dial-code",children:W.id}),G(W)&&e.jsx("button",{type:"button",className:"nice-theme-picker__edit-btn",onClick:je=>{je.stopPropagation(),Ie(W.id)},"aria-label":k?.editLabel??Q("themePicker.editTheme","Edit theme"),"data-testid":`${Z}-edit-${W.id}`,children:e.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[e.jsx("path",{d:"M8.5 1.5l2 2L4 10H2v-2L8.5 1.5z"}),e.jsx("path",{d:"M7 3l2 2"})]})})]},W.id))}),k?.enabled&&!k.addNew?.enabled&&e.jsxs("button",{type:"button",className:"nice-theme-picker__add-btn",onClick:()=>Ie(void 0),"data-testid":`${Z}-add`,children:[e.jsx(j.NiceIcon,{name:"plus",size:14})," ",k.addLabel??Q("themePicker.addTheme","Add theme")]})]}),K&&e.jsx("span",{className:"nice-field__spinner",children:e.jsx("span",{className:"nice-spinner nice-spinner--sm"})}),O==="right"&&l&&e.jsx("div",{className:"nice-field__error",role:"alert",children:l}),O==="right"&&!l&&D&&e.jsx("div",{className:"nice-field__helper",children:D})]}),O!=="right"&&l&&e.jsx("div",{className:"nice-field__error",role:"alert",children:l}),O!=="right"&&!l&&D&&e.jsx("div",{className:"nice-field__helper",children:D})]})};sn.displayName="NiceThemePicker";const an=s.createContext(null),tn=s.createContext(null),fn=({children:n,title:i,headerExtra:a,footer:u,hoverable:r,bordered:d=!0,onClick:o,selectable:p,selected:c,value:t,onSelect:h,name:f,disabled:_,readOnly:v,loading:w,error:L,size:b,className:R,style:T,displayStyle:y})=>{const x=j.useComponentDisplayStyle("card",y),k=j.useComponentDisplayClass("card",y),I=s.useContext(an),E=s.useContext(tn),C=b??E??"md",N=s.useMemo(()=>{if(y)return x;const{background:F,border:q,boxShadow:U,backdropFilter:ie,WebkitBackdropFilter:xe,...P}=x;return P},[x,y]),M=I!=null&&t!=null,z=p||M||h!=null,D=f??(M?I.name:void 0),l=z&&c===void 0&&!M,[m,S]=s.useState(!1),K=M?I.value===t:l?m:!!c,B=()=>{t!=null&&(h?.(t),M&&I.onChange(t))},O=_||w,$=()=>{O||(z&&!v&&(B(),l&&S(F=>!F)),o?.())},J=F=>{!O&&z&&!v&&(F.key===" "||F.key==="Enter")&&(F.preventDefault(),$())},Y=z||o!=null,Z=z?"radio":o?"button":void 0,Q=typeof L=="string"?L.length>0:!!L;return e.jsxs("div",{className:"nice-card-field",children:[e.jsxs("div",{className:`nice-card nice-card--${C} nice-card--ds-${k} ${d?"nice-card--bordered":"nice-card--frameless"} ${r?"nice-card--hoverable":""} ${o?"nice-card--clickable":""} ${z?"nice-card--selectable":""} ${K?"nice-card--selected":""} ${_?"nice-card--disabled":""} ${v?"nice-card--readonly":""} ${w?"nice-card--loading":""} ${Q?"nice-card--error":""} ${R||""}`,style:{...N,...T},onClick:Y?$:void 0,onKeyDown:Y?J:void 0,role:Z,"aria-checked":z?K:void 0,"aria-disabled":_||void 0,"aria-busy":w||void 0,"data-value":t!=null?String(t):void 0,"data-name":D,tabIndex:Y&&!_?0:void 0,children:[(i||a)&&e.jsxs("div",{className:"nice-card__header",children:[i&&e.jsx("h3",{className:"nice-card__title",children:i}),a]}),e.jsx("div",{className:"nice-card__body",children:n}),u&&e.jsx("div",{className:"nice-card__footer",children:u}),w&&e.jsx("span",{className:"nice-card__spinner","aria-hidden":"true",children:e.jsx("span",{className:"nice-spinner nice-spinner--sm"})})]}),typeof L=="string"&&L&&e.jsx("div",{className:"nice-card__error",role:"alert",children:L})]})},as=Object.freeze(Object.defineProperty({__proto__:null,NiceCard:fn,NiceCardGroupSizeContext:tn,NiceCardRadioContext:an},Symbol.toStringTag,{value:"Module"}));function ts(n,i,a){const r=window.innerWidth,d=window.innerHeight,o={top:n.top,bottom:d-n.bottom,left:n.left,right:r-n.right},p={top:a+6,bottom:a+6,left:i+6,right:i+6},c=["top","bottom","right","left"],t=c.filter(f=>o[f]>=p[f]),h=t.length?t:c;return h.reduce((f,_)=>o[_]>o[f]?_:f,h[0])}function cs(n,i){switch(i){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 Se=({content:n,position:i="auto",size:a="md",followCursor:u,children:r})=>{const[d,o]=s.useState(!1),[p,c]=s.useState({x:0,y:0}),[t,h]=s.useState(null),[f,_]=s.useState("top"),v=s.useId(),w=s.useRef(null),L=s.useRef(null),b=i==="auto"?f:i,R=s.useCallback(k=>{u&&c({x:k.clientX,y:k.clientY})},[u]);s.useLayoutEffect(()=>{if(!d||u)return;const k=()=>{const I=w.current;if(!I)return;const E=I.firstElementChild??I;h(E.getBoundingClientRect())};return k(),window.addEventListener("scroll",k,!0),window.addEventListener("resize",k),()=>{window.removeEventListener("scroll",k,!0),window.removeEventListener("resize",k)}},[d,u]),s.useLayoutEffect(()=>{if(i!=="auto"||!d||u||!t||!L.current)return;const k=L.current.getBoundingClientRect(),I=ts(t,k.width,k.height);_(E=>E===I?E:I)},[i,d,u,t,n,a]);const T=s.cloneElement(r,{"aria-describedby":d?v:void 0}),y=d?(()=>{let k;if(u)k={position:"fixed",left:p.x+12,top:p.y+12};else if(t){const I=cs(t,b);k={position:"fixed",left:I.left,top:I.top,transform:I.transform}}else k={position:"fixed",left:-9999,top:-9999};return e.jsx("span",{ref:L,id:v,className:`nice-tooltip nice-tooltip--${b} nice-tooltip--${a} nice-tooltip--portaled`,role:"tooltip",style:k,children:n})})():null,x=typeof document<"u"?document.body:null;return e.jsxs("span",{ref:w,className:"nice-tooltip-wrapper",onMouseEnter:()=>o(!0),onMouseLeave:()=>o(!1),onMouseMove:R,onFocus:()=>o(!0),onBlur:()=>o(!1),children:[T,y!=null&&x!=null?en.createPortal(y,x):y]})};Se.displayName="NiceTooltip";const ls=[],rs=({items:n=ls,multiple:i=!1,defaultOpen:a=[],size:u="md",width:r,maxWidth:d,animationDuration:o=220,className:p,style:c,displayStyle:t})=>{j.useComponentDisplayClass("card",t);const h=j.normalizeSize(u,"NiceAccordion"),[f,_]=s.useState(new Set(a)),v=s.useId(),w=s.useCallback(b=>{_(R=>{const T=new Set(R);return T.has(b)?T.delete(b):(i||T.clear(),T.add(b)),T})},[i]),L={...c,...r!==void 0?{width:typeof r=="number"?`${r}px`:r}:{},...d!==void 0?{maxWidth:typeof d=="number"?`${d}px`:d}:{},"--nice-accordion-anim":`${Math.max(0,o)}ms`};return e.jsx("div",{className:`nice-accordion nice-accordion--${h} ${p||""}`,style:L,children:n.map((b,R)=>{const T=f.has(b.id),y=`${v}-trigger-${R}`,x=`${v}-panel-${R}`;return e.jsxs("div",{className:"nice-accordion__item",children:[e.jsxs("button",{id:y,className:"nice-accordion__trigger",onClick:()=>!b.disabled&&w(b.id),"aria-expanded":T,"aria-controls":x,"aria-disabled":b.disabled,disabled:b.disabled,children:[e.jsx("span",{children:b.title}),e.jsx("svg",{className:`nice-accordion__chevron ${T?"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"})})]}),T&&e.jsx("div",{id:x,className:"nice-accordion__content",role:"region","aria-labelledby":y,children:b.content})]},b.id)})})},os=({items:n,separator:i="/",size:a="md",className:u,style:r})=>e.jsx("nav",{className:`nice-breadcrumb nice-breadcrumb--${a} ${u||""}`,style:r,"aria-label":"Breadcrumb",children:n.map((d,o)=>e.jsxs(s.Fragment,{children:[o>0&&e.jsx("span",{className:"nice-breadcrumb__separator",children:i}),o===n.length-1?e.jsx("span",{className:"nice-breadcrumb__current","aria-current":"page",children:d.label}):e.jsx("span",{className:"nice-breadcrumb__item",children:e.jsx("a",{className:"nice-breadcrumb__link",href:d.href,onClick:p=>{d.onClick&&(p.preventDefault(),d.onClick())},children:d.label})})]},o))});function Ue(n){return(n.id??n.key??"")+""}function vn(n){return n.label??n.text??""}function Ve(n){return n.children??n.items}function Qe(n){const i=Ve(n);return!i||i.length===0}function cn(n,i){if(!i)return!1;if(Ue(n)===i)return!0;const a=Ve(n);return a?a.some(u=>cn(u,i)):!1}const xn=({items:n,orientation:i="horizontal",variant:a="ghost",density:u="normal",size:r="md",loading:d=!1,fullWidth:o=!1,showDividers:p=!1,panelAlign:c="start",panelMinWidth:t=200,panelMaxWidth:h=360,itemGap:f,paddingX:_,paddingY:v,portal:w=!0,panelZIndex:L=1100,arrowIcon:b=e.jsx(j.NiceIcon,{name:"chevron-down",size:14}),flyoutArrowIcon:R=e.jsx(j.NiceIcon,{name:"chevron-right",size:14}),closeOnSelect:T=!0,openTrigger:y="click",openDelay:x=120,closeDelay:k=180,onOpenChange:I,activeId:E,activeKey:C,onItemClick:N,ariaLabel:M="Menu",renderTriggerLabel:z,renderEntryLabel:D,maxDepth:l=3,className:m,style:S,id:K,accessMode:B,displayStyle:O})=>{const $=j.useComponentDisplayClass("menu",O),J=j.useComponentDisplayStyle("menu",O),Z=s.useContext(j.NiceThemeContext)?.portalTarget??(typeof document<"u"?document.body:null),Q=j.useNiceAccessMode(B,K),F=Q==="hidden",q=Q==="disabled"||Q==="readOnly"||d,U=s.useId(),ie=E??C,xe=Math.min(10,Math.max(1,l)),[P,Ne]=s.useState(null),[ce,ae]=s.useState([]),le=s.useRef(null),ne=s.useRef(null);s.useEffect(()=>{I?.(P)},[P,I]);const A=s.useCallback(()=>{le.current!=null&&(window.clearTimeout(le.current),le.current=null),ne.current!=null&&(window.clearTimeout(ne.current),ne.current=null)},[]);s.useEffect(()=>()=>A(),[A]);const V=s.useCallback(H=>{A(),P!==H&&(le.current=window.setTimeout(()=>{Ne(H),ae([])},Math.max(0,x)))},[A,P,x]),oe=s.useCallback(()=>{A(),ne.current=window.setTimeout(()=>{Ne(null),ae([])},Math.max(0,k))},[A,k]),[_e,ye]=s.useState(-1),[Re,Me]=s.useState(-1),[ue,X]=s.useState(null),fe=s.useRef(null),pe=s.useRef(null),ve=s.useRef(new Map),$e=s.useCallback(()=>{if(!P){X(null);return}const H=ve.current.get(P);if(!H)return;const se=H.getBoundingClientRect();if(i==="vertical")X({left:se.right,top:se.top,width:se.width});else{const de=pe.current?.offsetWidth??Math.max(t,se.width);let be=se.left;c==="end"?be=se.right-de:c==="center"&&(be=se.left+se.width/2-de/2),X({left:be,top:se.bottom,width:se.width})}},[P,i,c,t]);s.useLayoutEffect(()=>{if(w&&($e(),P&&(c==="end"||c==="center"))){const H=requestAnimationFrame($e);return()=>cancelAnimationFrame(H)}},[w,$e,P,c]),s.useEffect(()=>{if(!w||!P)return;const H=()=>$e();return window.addEventListener("scroll",H,!0),window.addEventListener("resize",H),()=>{window.removeEventListener("scroll",H,!0),window.removeEventListener("resize",H)}},[w,P,$e]);const Ee=s.useMemo(()=>n.filter(H=>Ue(H).length>0),[n]),ge=s.useCallback(()=>{Ne(null),ae([]),Me(-1)},[]);s.useEffect(()=>{if(!P)return;const H=de=>{const be=de.target;fe.current&&fe.current.contains(be)||pe.current&&pe.current.contains(be)||ge()},se=de=>{de.key==="Escape"&&ge()};return document.addEventListener("mousedown",H),document.addEventListener("keydown",se),()=>{document.removeEventListener("mousedown",H),document.removeEventListener("keydown",se)}},[P,ge]);const Ie=(H,se)=>{if(H.disabled||q)return;const de=Ue(H);if(Qe(H)){H.onClick?.(se),N?.(H,se),T&&ge();return}ae([]),Ne(P===de?null:de),Me(-1)},ke=s.useCallback((H,se)=>{ae(de=>{const be=H-2;if(be<0)return de;if(de[be]===se)return de.slice(0,be);const De=de.slice(0,be);return De[be]=se,De})},[]),G=(H,se)=>{H.disabled||(H.onClick?.(se),N?.(H,se),T&&ge())},W=H=>{if(q)return;const se=i==="horizontal",de=se?"ArrowLeft":"ArrowUp",be=se?"ArrowRight":"ArrowDown";if(H.key===de)H.preventDefault(),ye(ze=>ze<=0?Ee.length-1:ze-1);else if(H.key===be)H.preventDefault(),ye(ze=>ze>=Ee.length-1?0:ze+1);else if(H.key==="Home")H.preventDefault(),ye(0);else if(H.key==="End")H.preventDefault(),ye(Ee.length-1);else if(H.key==="Enter"||H.key===" "){H.preventDefault();const ze=Ee[_e];ze&&Ie(ze,H)}else H.key==="Escape"&&ge()};if(F)return null;const he=["nice-menu",`nice-menu--orientation-${i}`,`nice-menu--variant-${a}`,`nice-menu--density-${u}`,`nice-menu--size-${r}`,o?"nice-menu--full-width":"",p?"nice-menu--show-dividers":"",d?"nice-menu--loading":"",$??"",m??""].filter(Boolean).join(" "),je={...J,...S,"--nice-menu-panel-min-w":`${t}px`,"--nice-menu-panel-max-w":`${h}px`};return f!==void 0&&(je["--nice-menu-gap"]=typeof f=="number"?`${f}px`:f),_!==void 0&&(je["--nice-menu-padding-x"]=typeof _=="number"?`${_}px`:_),v!==void 0&&(je["--nice-menu-padding-y"]=typeof v=="number"?`${v}px`:v),e.jsxs("nav",{id:K,ref:fe,className:he,style:je,"aria-label":M,"aria-busy":d||void 0,children:[d&&e.jsx("span",{className:"nice-menu__spinner","aria-hidden":"true",children:e.jsx("span",{className:"nice-spinner nice-spinner--sm"})}),e.jsx("ul",{className:"nice-menu__list",role:"menubar",onKeyDown:W,tabIndex:0,children:Ee.map((H,se)=>{const de=Ue(H),be=P===de,ze=!!ie&&cn(H,ie),De=!Qe(H),qe=["nice-menu__item",be?"nice-menu__item--open":"",ze?"nice-menu__item--active":"",H.disabled?"nice-menu__item--disabled":"",H.danger?"nice-menu__item--danger":"",De?"nice-menu__item--has-children":"",_e===se?"nice-menu__item--focused":""].filter(Boolean).join(" "),Ge=z?z(H):vn(H),Pe=e.jsxs(e.Fragment,{children:[H.icon?e.jsx("span",{className:"nice-menu__icon",children:H.icon}):null,e.jsx("span",{className:"nice-menu__label",children:Ge}),H.badge!=null?e.jsx("span",{className:"nice-menu__badge",children:H.badge}):null,De?e.jsx("span",{className:"nice-menu__arrow","aria-hidden":!0,children:b}):null]});return e.jsxs("li",{className:qe,role:"none","data-nice-menu-id":de,"data-nice-depth":1,onMouseEnter:De&&(y==="hover"||y==="both")?()=>V(de):void 0,onMouseLeave:De&&(y==="hover"||y==="both")?()=>oe():void 0,children:[H.href&&!De?e.jsx("a",{ref:Ce=>{Ce?ve.current.set(de,Ce):ve.current.delete(de)},className:"nice-menu__btn",href:H.href,target:H.target,rel:H.rel,role:"menuitem","aria-disabled":H.disabled||void 0,"aria-label":H.ariaLabel,tabIndex:_e===se?0:-1,onClick:Ce=>Ie(H,Ce),onFocus:()=>ye(se),children:Pe}):e.jsx("button",{ref:Ce=>{Ce?ve.current.set(de,Ce):ve.current.delete(de)},type:"button",className:"nice-menu__btn",disabled:H.disabled||q,role:"menuitem","aria-haspopup":De||void 0,"aria-expanded":De?be:void 0,"aria-controls":De?`${U}-panel-${de}`:void 0,"aria-label":H.ariaLabel,tabIndex:_e===se?0:-1,onClick:Ce=>Ie(H,Ce),onFocus:()=>ye(se),children:Pe}),De&&be?(()=>{const Ce=w&&typeof document<"u"&&!!ue&&!!Z,Ye=Ce?{position:"fixed",left:ue.left,top:ue.top,minWidth:Math.max(t,ue.width),maxWidth:h,zIndex:L}:{zIndex:L},g=e.jsx(Nn,{items:Ve(H)??[],depth:2,maxDepth:xe,openPath:ce,onToggleBranch:ke,onLeafClick:G,effectiveActiveId:ie,renderEntryLabel:D,flyoutArrowIcon:R,openTrigger:y,onPanelEnter:()=>A(),onPanelLeave:()=>oe(),panelClassName:["nice-menu__panel",`nice-menu__panel--align-${c}`,Ce?"nice-menu__panel--portal":""].filter(Boolean).join(" "),panelStyle:Ye,panelId:`${U}-panel-${de}`,panelRef:Ce?pe:void 0,focusedEntryIdx:Re,setFocusedEntryIdx:Me});return Ce?en.createPortal(g,Z):g})():null]},de)})})]})};xn.displayName="NiceMenu";function Nn({items:n,depth:i,maxDepth:a,openPath:u,onToggleBranch:r,onLeafClick:d,effectiveActiveId:o,renderEntryLabel:p,flyoutArrowIcon:c,openTrigger:t,onPanelEnter:h,onPanelLeave:f,panelClassName:_,panelStyle:v,panelId:w,panelRef:L,focusedEntryIdx:b,setFocusedEntryIdx:R}){const T=Math.min(Math.max(i,1),10),y=i===2,x=_??(y?"nice-menu__panel":"nice-menu__subpanel"),I={...{"--nice-row-bg":`var(--nice-menu-level-${T}-bg, var(--nice-bg-elevated, var(--nice-bg-primary)))`,"--nice-row-text":`var(--nice-menu-level-${T}-text, var(--nice-text-primary))`,"--nice-row-border":`var(--nice-menu-level-${T}-border, var(--nice-border-color))`,"--nice-row-hover-bg":`var(--nice-menu-level-${T}-hover-bg, var(--nice-hover-bg))`,"--nice-row-active-bg":`var(--nice-menu-level-${T}-active-bg, var(--nice-selected-bg))`},...v??{}},E=t==="hover"||t==="both"?{onMouseEnter:h,onMouseLeave:f}:{};return e.jsx("div",{ref:L,id:w,className:x,style:I,role:"menu","data-nice-depth":i,...E,children:n.map((C,N)=>{if(C.divider)return e.jsx("hr",{className:"nice-menu__divider"},`d-${N}`);const M=Ue(C),D=!Qe(C)&&i<a,l=u[i-2]===M,m=!!o&&cn(C,o),S=["nice-menu__entry",C.disabled?"nice-menu__entry--disabled":"",C.danger?"nice-menu__entry--danger":"",m?"nice-menu__entry--active":"",y&&b===N?"nice-menu__entry--focused":""].filter(Boolean).join(" "),K=e.jsxs(e.Fragment,{children:[C.icon?e.jsx("span",{className:"nice-menu__icon",children:C.icon}):null,e.jsxs("span",{className:"nice-menu__entry-content",children:[e.jsxs("span",{className:"nice-menu__entry-label",children:[p?p(C):vn(C),C.badge!=null?e.jsx("span",{className:"nice-menu__badge",children:C.badge}):null]}),C.description?e.jsx("span",{className:"nice-menu__entry-desc",children:C.description}):null]}),D?e.jsx("span",{className:"nice-menu__entry-arrow","aria-hidden":!0,children:c}):null]}),B=$=>{D?r(i,M):d(C,$)},O=y?()=>R?.(N):void 0;return e.jsxs("div",{style:{position:"relative"},onMouseEnter:D?()=>r(i,M):void 0,children:[C.href&&!D?e.jsx("a",{className:S,href:C.href,target:C.target,rel:C.rel,role:"menuitem","aria-disabled":C.disabled||void 0,"aria-label":C.ariaLabel,onClick:B,onFocus:O,children:K}):e.jsx("button",{type:"button",className:S,disabled:C.disabled,role:"menuitem","aria-haspopup":D||void 0,"aria-expanded":D?l:void 0,"aria-label":C.ariaLabel,onClick:B,onFocus:O,children:K}),D&&l?e.jsx(Nn,{items:Ve(C)??[],depth:i+1,maxDepth:a,openPath:u,onToggleBranch:r,onLeafClick:d,effectiveActiveId:o,renderEntryLabel:p,flyoutArrowIcon:c,openTrigger:t}):null]},M||`c-${N}`)})})}const ln=({items:n,target:i,onItemClick:a,size:u="md",className:r,style:d})=>{const[o,p]=s.useState(null),c=s.useRef(null);return j.useClickOutside(c,()=>p(null)),s.useEffect(()=>{const t=i.current;if(!t)return;const h=f=>{f.preventDefault(),p({x:f.clientX,y:f.clientY})};return t.addEventListener("contextmenu",h),()=>t.removeEventListener("contextmenu",h)},[i]),o?e.jsx("div",{ref:c,className:`nice-contextmenu nice-contextmenu--${u} ${r||""}`,style:{position:"fixed",left:o.x,top:o.y,zIndex:1e4,...d},children:e.jsx("ul",{className:"nice-contextmenu__list",role:"menu",children:n.map((t,h)=>e.jsx("li",{className:`nice-contextmenu__item ${t.disabled?"nice-contextmenu__item--disabled":""}`,role:"none",children:e.jsxs("button",{type:"button",className:"nice-contextmenu__btn",disabled:t.disabled,"aria-disabled":t.disabled,role:"menuitem",onClick:f=>{t.onClick?.(f),a?.(t),p(null)},children:[t.icon&&e.jsx("span",{className:"nice-contextmenu__icon","aria-hidden":"true",children:t.icon}),e.jsx("span",{children:t.label??t.text??""})]})},t.id??t.key??h))})}):null};function ds(n,i){if(n==null)return null;if(typeof n=="number")return n/i*100;const a=n.trim();if(a.endsWith("%"))return parseFloat(a);const u=parseFloat(a);return Number.isFinite(u)?u/i*100:null}function us(n,i){const a=n.length||1;let u=n.map(_=>ds(_.size,i));const r=u.reduce((_,v)=>_+(v??0),0),d=u.filter(_=>_==null).length,o=Math.max(0,100-r);u=u.map(_=>_??(d?o/d:100/a));let p=n.map(_=>_.collapsible?0:_.minSize?_.minSize/i*100:0);const c=p.reduce((_,v)=>_+v,0);if(c>100){const _=100/c;p=p.map(v=>v*_)}const t=n.map(_=>_.maxSize?_.maxSize/i*100:100),h=u.map((_,v)=>Math.min(t[v],Math.max(p[v],_??0))),f=h.reduce((_,v)=>_+v,0)||1;return h.map(_=>_/f*100)}const ms=({panes:n,orientation:i="horizontal",gutterSize:a=6,onResize:u,className:r,style:d,accessMode:o,id:p})=>{const t=j.useNiceAccessMode(o,p)==="hidden",h=s.useRef(null),[f,_]=s.useState(()=>n.map(()=>100/n.length)),v=s.useRef("");s.useLayoutEffect(()=>{const b=h.current;if(!b)return;const R=i==="horizontal"?b.offsetWidth:b.offsetHeight;if(!R)return;const T=`${i}:${n.map(y=>y.key).join("|")}`;v.current!==T&&(v.current=T,_(us(n,R)))},[n,i]);const w=s.useCallback((b,R)=>{R.preventDefault();const T=h.current;if(!T)return;const y=R.currentTarget;try{y.setPointerCapture?.(R.pointerId)}catch{}const x=i==="horizontal",k=x?T.offsetWidth:T.offsetHeight,I=x?R.clientX:R.clientY,E=[...f],C=document.body.style.userSelect;document.body.style.userSelect="none";const N=n.map(S=>S.collapsible?0:S.minSize?S.minSize/k*100:5),M=N.reduce((S,K)=>S+K,0),z=M>100?100/M:1,D=n.map(S=>S.maxSize?S.maxSize/k*100:100),l=S=>{const K=((x?S.clientX:S.clientY)-I)/k*100,B=[...E],O=E[b]+E[b+1],$=N[b]*z,J=N[b+1]*z,Y=D[b],Z=D[b+1];let Q=E[b]+K,F=E[b+1]-K;Q<$&&(Q=$,F=O-$),F<J&&(F=J,Q=O-J),Q>Y&&(Q=Y,F=O-Y),F>Z&&(F=Z,Q=O-Z),B[b]=Q,B[b+1]=F,_(B),u?.(B)},m=()=>{try{y.releasePointerCapture?.(R.pointerId)}catch{}document.removeEventListener("pointermove",l),document.removeEventListener("pointerup",m),document.removeEventListener("pointercancel",m),document.body.style.userSelect=C};document.addEventListener("pointermove",l),document.addEventListener("pointerup",m),document.addEventListener("pointercancel",m)},[f,i,n,u]),L=i==="horizontal";return t?null:e.jsx("div",{ref:h,className:`nice-splitter nice-splitter--${i} ${r||""}`,style:{display:"flex",flexDirection:L?"row":"column",height:"100%",...d},children:n.map((b,R)=>{const T=`calc(${f[R]}% - ${a*(n.length-1)/n.length}px)`;return e.jsxs(s.Fragment,{children:[e.jsx("div",{className:"nice-splitter__pane",style:{"--nice-splitter-pane-size":T,[L?"width":"height"]:T,overflow:"auto"},children:b.render()}),R<n.length-1&&e.jsx("div",{className:`nice-splitter__gutter nice-splitter__gutter--${i}`,role:"separator","aria-orientation":L?"vertical":"horizontal",style:{[L?"width":"height"]:a,cursor:L?"col-resize":"row-resize",flexShrink:0,touchAction:"none"},onPointerDown:y=>w(R,y),children:e.jsx("span",{className:"nice-splitter__grip","aria-hidden":"true"})})]},b.key)})})},gn=({steps:n,activeStep:i,orientation:a="horizontal",onStepClick:u,allowStepClick:r=!1,showStepNumbers:d=!0,className:o,style:p})=>{const{t:c}=j.useNiceTranslation();return e.jsxs("div",{className:`nice-stepper nice-stepper--${a} ${o||""}`,style:p,children:[e.jsx("div",{className:"nice-stepper__header",children:n.map((t,h)=>{const f=h<i,v=f?"nice-stepper__step--completed":h===i?"nice-stepper__step--active":"";return e.jsxs(s.Fragment,{children:[h>0&&e.jsx("div",{className:`nice-stepper__connector ${f?"nice-stepper__connector--completed":""}`}),e.jsxs("div",{className:`nice-stepper__step ${v}`,onClick:()=>r&&u?.(h),style:{cursor:r?"pointer":void 0},children:[e.jsx("div",{className:"nice-stepper__indicator",children:t.icon?t.icon:f?e.jsx(j.NiceIcon,{name:"check",size:14}):d?h+1:""}),e.jsxs("div",{className:"nice-stepper__labels",children:[e.jsx("div",{className:"nice-stepper__title",children:t.title}),t.subtitle&&e.jsx("div",{className:"nice-stepper__subtitle",children:t.subtitle}),t.optional&&e.jsx("div",{className:"nice-stepper__optional",children:c("optional","Optional")})]})]})]},h)})}),n[i]?.content&&e.jsx("div",{className:"nice-stepper__content",children:n[i].content})]})},jn=s.forwardRef(({panels:n,columns:i=12,rowHeight:a=80,gap:u=8,draggable:r=!0,resizable:d=!0,onLayoutChange:o,className:p,style:c,id:t},h)=>{const f=j.useControlId(t),[_,v]=s.useState(null),[w,L]=s.useState(null),b=s.useRef(null),R=s.useCallback((C,N)=>{r&&(v(N),C.dataTransfer.effectAllowed="move")},[r]),T=s.useCallback((C,N)=>{if(C.preventDefault(),L(null),!_||_===N)return;const M=n.find(l=>l.key===_),z=n.find(l=>l.key===N);if(!M||!z)return;const D=n.map(l=>l.key===_?{...l,col:z.col,row:z.row}:l.key===N?{...l,col:M.col,row:M.row}:l);o?.(D),v(null)},[_,n,o]),y=s.useCallback((C,N)=>{C.preventDefault(),r&&_&&_!==N&&L(N)},[r,_]),x=s.useCallback(()=>{v(null),L(null)},[]),k=s.useRef(null);s.useEffect(()=>{if(!d)return;const C=M=>{if(!k.current||!b.current)return;const{key:z,startX:D,startY:l,cs:m,rs:S}=k.current,K=M.clientX-D,B=M.clientY-l,O=b.current.clientWidth/i,$=Math.max(1,m+Math.round(K/O)),J=Math.max(1,S+Math.round(B/a)),Y=n.map(Z=>Z.key===z?{...Z,colSpan:$,rowSpan:J}:Z);o?.(Y)},N=()=>{k.current=null};return document.addEventListener("mousemove",C),document.addEventListener("mouseup",N),()=>{document.removeEventListener("mousemove",C),document.removeEventListener("mouseup",N)}},[d,n,i,a,o]);const I=s.useCallback((C,N,M,z)=>{C.stopPropagation(),k.current={key:N,startX:C.clientX,startY:C.clientY,cs:M,rs:z}},[]),E=Math.max(...n.map(C=>C.row+(C.rowSpan??1)),1);return e.jsx("div",{ref:h,id:f,className:`nice-dashboard ${p||""}`,style:c,children:e.jsx("div",{ref:b,className:"nice-dashboard__grid",style:{display:"grid",gridTemplateColumns:`repeat(${i}, 1fr)`,gridTemplateRows:`repeat(${E}, ${a}px)`,gap:u},children:n.map(C=>e.jsxs("div",{className:`nice-dashboard__panel${r?" nice-dashboard__panel--draggable":""}${_===C.key?" nice-dashboard__panel--dragging":""}${w===C.key?" nice-dashboard__panel--dragover":""}`,style:{gridColumn:`${C.col+1} / span ${C.colSpan??1}`,gridRow:`${C.row+1} / span ${C.rowSpan??1}`},draggable:r,onDragStart:N=>R(N,C.key),onDragOver:N=>y(N,C.key),onDragLeave:()=>L(N=>N===C.key?null:N),onDragEnd:x,onDrop:N=>T(N,C.key),children:[e.jsx("div",{className:"nice-dashboard__panel-content",children:C.render()}),d&&e.jsx("div",{className:"nice-dashboard__resize-handle",draggable:!1,onMouseDown:N=>I(N,C.key,C.colSpan??1,C.rowSpan??1)})]},C.key))})})});jn.displayName="NiceDashboardLayout";const yn=s.forwardRef(({header:n,sidebar:i,sidebarWidth:a=260,sidebarCollapsed:u,onToggleSidebar:r,children:d,footer:o,className:p,style:c,id:t},h)=>{const f=j.useControlId(t),[_,v]=s.useState(!1),w=u??_,L=s.useCallback(()=>{const b=!w;v(b),r?.(b)},[w,r]);return e.jsxs("div",{ref:h,id:f,className:`nice-app-layout${w?" nice-app-layout--collapsed":""} ${p||""}`,style:c,children:[n&&e.jsx("header",{className:"nice-app-layout__header",children:n}),e.jsxs("div",{className:"nice-app-layout__body",children:[i&&e.jsx("aside",{className:"nice-app-layout__sidebar",style:{width:w?0:a,overflow:"hidden",transition:"width 0.2s"},children:!w&&i}),i&&e.jsx("button",{type:"button",className:"nice-app-layout__sidebar-toggle",onClick:L,"aria-label":w?"Open sidebar":"Close sidebar",children:e.jsx(j.NiceIcon,{name:w?"menu":"close",size:16})}),e.jsx("main",{className:"nice-app-layout__content",children:d})]}),o&&e.jsx("footer",{className:"nice-app-layout__footer",children:o})]})});yn.displayName="NiceAppLayout";const kn=s.forwardRef(({items:n,position:i="bottom",size:a="md",magnify:u=!0,magnifyScale:r=1.5,activeKey:d,onItemClick:o,contained:p=!1,className:c,style:t,id:h,...f},_)=>{const v=j.useControlId(h),{t:w}=j.useNiceTranslation(),[L,b]=s.useState(null),R=s.useCallback(x=>{if(!u||L===null)return 1;const k=Math.abs(x-L);return k===0?r:k===1?1+(r-1)*.5:k===2?1+(r-1)*.2:1},[u,L,r]),T=i==="left"||i==="right",y=i==="left"?"left center":i==="right"?"right center":"bottom center";return e.jsx("div",{ref:_,id:v,className:`nice-dock nice-dock--${i} nice-dock--${a}${p?" nice-dock--contained":""} ${c??""}`,style:t,role:"toolbar","aria-label":w("dock.label","Dock"),...f,children:e.jsx("div",{className:"nice-dock__bar",style:{flexDirection:T?"column":"row"},children:n.map((x,k)=>{const I=R(k);return e.jsxs("button",{type:"button",className:`nice-dock__item ${d===x.key?"nice-dock__item--active":""} ${x.disabled?"nice-dock__item--disabled":""}`,style:{transform:`scale(${I})`,transformOrigin:y,transition:"transform 0.15s ease-out"},disabled:x.disabled,onClick:()=>o?.(x.key),onMouseEnter:()=>b(k),onMouseLeave:()=>b(null),"aria-label":x.label,title:x.label,children:[e.jsx("span",{className:"nice-dock__icon",children:x.icon}),x.badge!==void 0&&e.jsx("span",{className:"nice-dock__badge",children:x.badge})]},x.key)})})})});kn.displayName="NiceDock";const Cn=({items:n,label:i,icon:a,position:u,onItemClick:r})=>{const{t:d}=j.useNiceTranslation(),[o,p]=s.useState(!1),[c,t]=s.useState(null),h=s.useRef(null);s.useEffect(()=>{if(!o)return;const v=w=>{h.current&&!h.current.contains(w.target)&&(p(!1),t(null))};return document.addEventListener("mousedown",v),()=>document.removeEventListener("mousedown",v)},[o]),s.useEffect(()=>{if(!o)return;const v=w=>{w.key==="Escape"&&(p(!1),t(null))};return document.addEventListener("keydown",v),()=>document.removeEventListener("keydown",v)},[o]);const f=u==="bottom"?"bottom-start":u==="top"?"top-start":u==="left"?"left-start":"right-start",_=s.useCallback(v=>{if(v.children&&v.children.length>0){t(c===v.key?null:v.key);return}v.onClick?.(),r?.(v.key),p(!1),t(null)},[r,c]);return e.jsxs("div",{className:"nice-desktop__start",ref:h,children:[e.jsxs("button",{type:"button",className:`nice-desktop__start-btn ${o?"nice-desktop__start-btn--active":""}`,onClick:()=>p(!o),"aria-expanded":o,"aria-haspopup":"menu","aria-label":d("desktop.start","Start"),children:[a&&e.jsx("span",{className:"nice-desktop__start-icon",children:a}),i&&e.jsx("span",{className:"nice-desktop__start-label",children:i}),!a&&!i&&e.jsx("span",{className:"nice-desktop__start-label",children:d("desktop.start","Start")})]}),o&&e.jsx("div",{className:`nice-desktop__start-menu nice-desktop__start-menu--${f}`,role:"menu",children:n.map(v=>e.jsxs(s.Fragment,{children:[v.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 ${c===v.key?"nice-desktop__start-item--open":""}`,disabled:v.disabled,onClick:()=>_(v),role:"menuitem",children:[v.icon&&e.jsx("span",{className:"nice-desktop__start-item-icon",children:v.icon}),e.jsx("span",{className:"nice-desktop__start-item-label",children:v.label}),v.children&&v.children.length>0&&e.jsx("span",{className:"nice-desktop__start-item-arrow",children:e.jsx(j.NiceIcon,{name:"chevron-right",size:14})})]}),v.children&&c===v.key&&e.jsx("div",{className:"nice-desktop__start-submenu",role:"menu",children:v.children.map(w=>e.jsxs("button",{type:"button",className:"nice-desktop__start-item",disabled:w.disabled,onClick:()=>_(w),role:"menuitem",children:[w.icon&&e.jsx("span",{className:"nice-desktop__start-item-icon",children:w.icon}),e.jsx("span",{className:"nice-desktop__start-item-label",children:w.label})]},w.key))})]})]},v.key))})]})},Ze=({items:n,position:i,size:a,startMenu:u,systemTray:r,onItemClick:d})=>{const p=i==="left"||i==="right"?{width:a,height:"100%"}:{height:a,width:"100%"};return e.jsxs("div",{className:`nice-desktop__taskbar nice-desktop__taskbar--${i}`,style:p,role:"toolbar","aria-label":"Taskbar",children:[u,e.jsx("div",{className:"nice-desktop__taskbar-items",children:n.map(c=>e.jsxs("button",{type:"button",className:`nice-desktop__taskbar-btn ${c.active?"nice-desktop__taskbar-btn--active":""} ${c.minimized?"nice-desktop__taskbar-btn--minimized":""}`,onClick:()=>d?.(c.key),title:c.label,children:[c.icon&&e.jsx("span",{className:"nice-desktop__taskbar-btn-icon",children:c.icon}),e.jsx("span",{className:"nice-desktop__taskbar-btn-label",children:c.label}),c.badge!==void 0&&e.jsx("span",{className:"nice-desktop__taskbar-btn-badge",children:c.badge})]},c.key))}),r]})},wn=({items:n,showClock:i=!0,onItemClick:a})=>{const[u,r]=s.useState(()=>new Date);return s.useEffect(()=>{if(!i)return;const d=setInterval(()=>r(new Date),3e4);return()=>clearInterval(d)},[i]),e.jsxs("div",{className:"nice-desktop__tray",children:[n.map(d=>e.jsx("button",{type:"button",className:"nice-desktop__tray-item",title:d.tooltip,onClick:()=>{d.onClick?.(),a?.(d.key)},children:d.icon},d.key)),i&&e.jsx("span",{className:"nice-desktop__tray-clock",children:u.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})})]})},Sn=({icons:n,gridColumns:i,iconSize:a,onIconClick:u,onIconDoubleClick:r})=>{const[d,o]=s.useState(null),p=s.useCallback(t=>{o(t),u?.(t)},[u]),c=s.useCallback(t=>{r?.(t)},[r]);return e.jsx("div",{className:`nice-desktop__grid nice-desktop__grid--${a}`,style:{gridTemplateColumns:`repeat(${i}, 1fr)`},children:n.map(t=>e.jsxs("div",{className:`nice-desktop__icon ${d===t.key?"nice-desktop__icon--selected":""} ${t.disabled?"nice-desktop__icon--disabled":""}`,style:t.gridCol!=null||t.gridRow!=null?{gridColumn:t.gridCol,gridRow:t.gridRow}:void 0,onClick:()=>!t.disabled&&p(t.key),onDoubleClick:()=>!t.disabled&&c(t.key),role:"button",tabIndex:t.disabled?-1:0,"aria-label":t.label,onKeyDown:h=>{t.disabled||(h.key==="Enter"&&c(t.key),h.key===" "&&(h.preventDefault(),p(t.key)))},children:[e.jsx("div",{className:"nice-desktop__icon-img",children:t.icon}),e.jsx("span",{className:"nice-desktop__icon-label",children:t.label})]},t.key))})},$n=({items:n,x:i,y:a,onItemClick:u,onClose:r})=>{const d=s.useRef(null);return s.useEffect(()=>{const o=p=>{d.current&&!d.current.contains(p.target)&&r()};return document.addEventListener("mousedown",o),()=>document.removeEventListener("mousedown",o)},[r]),s.useEffect(()=>{const o=p=>{p.key==="Escape"&&r()};return document.addEventListener("keydown",o),()=>document.removeEventListener("keydown",o)},[r]),e.jsx("div",{ref:d,className:"nice-desktop__context-menu",style:{position:"fixed",left:i,top:a},role:"menu",children:n.map(o=>e.jsxs(s.Fragment,{children:[o.divider&&e.jsx("div",{className:"nice-desktop__context-divider"}),e.jsxs("button",{type:"button",className:"nice-desktop__context-item",disabled:o.disabled,onClick:()=>{o.onClick?.(),u?.(o.key),r()},role:"menuitem",children:[o.icon&&e.jsx("span",{className:"nice-desktop__context-icon",children:o.icon}),e.jsx("span",{children:o.label})]})]},o.key))})},En=s.forwardRef(({icons:n=[],taskbarPosition:i="bottom",taskbarSize:a=40,startMenuItems:u=[],startMenuLabel:r,startMenuIcon:d,taskbarItems:o=[],systemTrayItems:p=[],showClock:c=!0,wallpaper:t,gridColumns:h=8,iconSize:f="md",onIconClick:_,onIconDoubleClick:v,onTaskbarItemClick:w,onStartMenuItemClick:L,onSystemTrayItemClick:b,contextMenuItems:R,onContextMenuItemClick:T,children:y,className:x,style:k,id:I,accessMode:E,...C},N)=>{const M=j.useControlId(I),D=j.useNiceAccessMode(E,I)==="hidden",[l,m]=s.useState(null),S=s.useCallback($=>{!R||R.length===0||($.preventDefault(),m({x:$.clientX,y:$.clientY}))},[R]),K=u.length>0?e.jsx(Cn,{items:u,label:r,icon:d,position:i,onItemClick:L}):null,B=e.jsx(wn,{items:p,showClock:c,onItemClick:b}),O={...k,...t?{background:t}:{}};return D?null:e.jsxs("div",{ref:N,id:M,className:`nice-desktop nice-desktop--taskbar-${i} ${x??""}`,style:O,...C,children:[(i==="top"||i==="left")&&e.jsx(Ze,{items:o,position:i,size:a,startMenu:K,systemTray:B,onItemClick:w}),e.jsxs("div",{className:"nice-desktop__area",onContextMenu:S,children:[n.length>0&&e.jsx(Sn,{icons:n,gridColumns:h,iconSize:f,onIconClick:_,onIconDoubleClick:v}),y,l&&R&&e.jsx($n,{items:R,x:l.x,y:l.y,onItemClick:T,onClose:()=>m(null)})]}),(i==="bottom"||i==="right")&&e.jsx(Ze,{items:o,position:i,size:a,startMenu:K,systemTray:B,onItemClick:w})]})});En.displayName="NiceDesktop";const hs=({commands:n,onSelect:i,onClose:a})=>{const[u,r]=s.useState(""),d=s.useRef(null),{t:o}=j.useNiceTranslation();s.useEffect(()=>{d.current?.focus()},[]),s.useEffect(()=>{const c=t=>{t.key==="Escape"&&a()};return document.addEventListener("keydown",c),()=>document.removeEventListener("keydown",c)},[a]);const p=u?n.filter(c=>c.label.toLowerCase().includes(u.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":o("console.commandPalette","Command Palette"),children:[e.jsx("input",{ref:d,className:"nice-console__palette-input",placeholder:o("console.searchCommands","Search commands..."),value:u,onChange:c=>r(c.target.value),onKeyDown:c=>{c.key==="Enter"&&p.length>0&&(i(p[0].key),a())}}),e.jsxs("div",{className:"nice-console__palette-list",children:[p.map(c=>e.jsxs("button",{type:"button",className:"nice-console__palette-item",disabled:c.disabled,onClick:()=>{i(c.key),a()},children:[c.icon&&e.jsx("span",{className:"nice-console__palette-icon",children:c.icon}),e.jsx("span",{className:"nice-console__palette-label",children:c.label}),c.description&&e.jsx("span",{className:"nice-console__palette-desc",children:c.description}),c.shortcut&&e.jsx("span",{className:"nice-console__palette-shortcut",children:c.shortcut})]},c.key)),p.length===0&&e.jsx("div",{className:"nice-console__palette-empty",children:o("console.noCommands","No matching commands")})]})]})]})},In=s.forwardRef(({tabs:n=[],activeTabKey:i,onTabChange:a,onTabClose:u,commandPalette:r=[],onCommand:d,statusItems:o=[],toolbar:p,sidePanel:c,sidePanelWidth:t=220,sidePanelCollapsed:h,onToggleSidePanel:f,bottomPanel:_,bottomPanelHeight:v=200,bottomPanelCollapsed:w,onToggleBottomPanel:L,children:b,size:R="md",theme:T="dark",className:y,style:x,id:k,accessMode:I,...E},C)=>{const N=j.useControlId(k),M=j.useNiceAccessMode(I,k),{t:z}=j.useNiceTranslation();if(M==="hidden")return null;const[D,l]=s.useState(n[0]?.key??""),[m,S]=s.useState(!1),[K,B]=s.useState(!1),[O,$]=s.useState(!1),J=i??D,Y=h??m,Z=w??K,Q=s.useCallback(P=>{a?a(P):l(P)},[a]),F=s.useCallback(()=>{const P=!Y;f?f(P):S(P)},[Y,f]),q=s.useCallback(()=>{const P=!Z;L?L(P):B(P)},[Z,L]);s.useEffect(()=>{if(r.length===0)return;const P=Ne=>{Ne.ctrlKey&&Ne.shiftKey&&Ne.key==="P"&&(Ne.preventDefault(),$(ce=>!ce))};return document.addEventListener("keydown",P),()=>document.removeEventListener("keydown",P)},[r.length]);const U=n.find(P=>P.key===J),ie=o.filter(P=>!P.position||P.position==="left"),xe=o.filter(P=>P.position==="right");return e.jsxs("div",{ref:C,id:N,className:`nice-console nice-console--${R} nice-console--${T} ${y??""}`,style:x,...E,children:[p&&e.jsx("div",{className:"nice-console__toolbar",children:p}),n.length>0&&e.jsx("div",{className:"nice-console__tabs",role:"tablist",children:n.map(P=>e.jsxs("div",{className:`nice-console__tab ${P.key===J?"nice-console__tab--active":""}`,role:"tab","aria-selected":P.key===J,children:[e.jsxs("button",{type:"button",className:"nice-console__tab-btn",onClick:()=>Q(P.key),children:[P.icon&&e.jsx("span",{className:"nice-console__tab-icon",children:P.icon}),e.jsx("span",{children:P.label})]}),(P.closable??!0)&&u&&e.jsx("button",{type:"button",className:"nice-console__tab-close",onClick:()=>u(P.key),"aria-label":z("console.closeTab","Close tab"),children:e.jsx(j.NiceIcon,{name:"close",size:14})})]},P.key))}),e.jsxs("div",{className:"nice-console__main",children:[c&&!Y&&e.jsxs("aside",{className:"nice-console__side",style:{width:t,flexShrink:0},children:[e.jsx("div",{className:"nice-console__side-header",children:e.jsx("button",{type:"button",className:"nice-console__side-toggle",onClick:F,"aria-label":z("console.closeSidePanel","Close side panel"),children:e.jsx(j.NiceIcon,{name:"close",size:14})})}),e.jsx("div",{className:"nice-console__side-content",children:c})]}),e.jsxs("div",{className:"nice-console__center",children:[e.jsx("div",{className:"nice-console__content",role:"tabpanel",children:U?U.render?U.render():U.content:b}),_&&!Z&&e.jsxs("div",{className:"nice-console__bottom",style:{height:v,flexShrink:0},children:[e.jsx("div",{className:"nice-console__bottom-header",children:e.jsx("button",{type:"button",className:"nice-console__bottom-toggle",onClick:q,"aria-label":z("console.closeBottomPanel","Close bottom panel"),children:e.jsx(j.NiceIcon,{name:"close",size:14})})}),e.jsx("div",{className:"nice-console__bottom-content",children:_})]})]})]}),o.length>0&&e.jsxs("div",{className:"nice-console__statusbar",children:[e.jsxs("div",{className:"nice-console__statusbar-left",children:[c&&Y&&e.jsx("button",{type:"button",className:"nice-console__statusbar-btn",onClick:F,title:z("console.openSidePanel","Open side panel"),children:e.jsx(j.NiceIcon,{name:"menu",size:14})}),_&&Z&&e.jsx("button",{type:"button",className:"nice-console__statusbar-btn",onClick:q,title:z("console.openBottomPanel","Open bottom panel"),children:e.jsx(j.NiceIcon,{name:"chevron-up",size:14})}),ie.map(P=>e.jsx("span",{className:"nice-console__status-item",onClick:P.onClick,role:P.onClick?"button":void 0,tabIndex:P.onClick?0:void 0,children:P.content??P.label},P.key))]}),e.jsx("div",{className:"nice-console__statusbar-right",children:xe.map(P=>e.jsx("span",{className:"nice-console__status-item",onClick:P.onClick,role:P.onClick?"button":void 0,tabIndex:P.onClick?0:void 0,children:P.content??P.label},P.key))})]}),O&&r.length>0&&e.jsx(hs,{commands:r,onSelect:P=>d?.(P),onClose:()=>$(!1)})]})});In.displayName="NiceConsole";const ps=[],Mn=s.forwardRef(({steps:n=ps,activeStep:i,onStepChange:a,onComplete:u,onCancel:r,allowStepClick:d=!1,variant:o="horizontal",nextLabel:p,prevLabel:c,finishLabel:t,cancelLabel:h,showProgress:f=!0,className:_,style:v,size:w="md",accessMode:L,id:b},R)=>{const y=j.useNiceAccessMode(L,b)==="hidden",{t:x}=j.useNiceTranslation(),k=j.useControlId(b),[I,E]=s.useState(0),[C,N]=s.useState({}),[M,z]=s.useState(new Set([0])),D=i??I,l=n[D],m=D===0,S=D===n.length-1,K=s.useCallback(F=>{const q=Math.max(0,Math.min(n.length-1,F));E(q),z(U=>new Set(U).add(q)),a?.(q)},[n.length,a]),B=s.useCallback(()=>{if(!l?.validate)return!0;const F=l.validate();return F===!0||F===void 0?(N(q=>{const U={...q};return delete U[l.id],U}),!0):(N(q=>({...q,[l.id]:F})),!1)},[l]),O=s.useCallback(()=>{B()&&(S?u?.():K(D+1))},[D,S,B,K,u]),$=s.useCallback(()=>{m||K(D-1)},[D,m,K]),J=s.useCallback(F=>{const q=n.findIndex(U=>U.id===F);q>=0&&K(q)},[n,K]),Y=s.useMemo(()=>({stepIndex:D,totalSteps:n.length,goNext:O,goPrev:$,goTo:J,isFirst:m,isLast:S}),[D,n.length,O,$,J,m,S]),Z=n.length>0?(D+1)/n.length*100:0;if(y)return null;const Q=n.map(F=>({title:F.title,subtitle:F.description,icon:F.icon,optional:F.optional}));return e.jsxs("div",{ref:R,id:k,className:`nice-wizard nice-wizard--${o} nice-size-${w}${_?` ${_}`:""}`,style:v,children:[e.jsx(gn,{steps:Q,activeStep:D,orientation:o,allowStepClick:d,onStepClick:F=>{F<=D&&K(F)}}),f&&e.jsx("div",{className:"nice-wizard__progress",children:e.jsx("div",{className:"nice-wizard__progress-bar",style:{width:`${Z}%`}})}),e.jsx("div",{className:"nice-wizard__content",role:"tabpanel",children:l&&e.jsxs(e.Fragment,{children:[typeof l.content=="function"?l.content(Y):l.content,C[l.id]&&e.jsx("div",{className:"nice-wizard__error nice-error-text",children:C[l.id]})]})}),e.jsxs("div",{className:"nice-wizard__actions",children:[r&&e.jsx("button",{type:"button",className:"nice-btn nice-btn--text",onClick:r,children:h??x("cancel","Cancel")}),e.jsxs("div",{className:"nice-wizard__actions-right",children:[!m&&e.jsx("button",{type:"button",className:"nice-btn nice-btn--outlined",onClick:$,children:c??e.jsxs(e.Fragment,{children:[e.jsx(j.NiceIcon,{name:"arrow-left",size:14})," ",x("previous","Previous")]})}),e.jsx("button",{type:"button",className:"nice-btn nice-btn--primary",onClick:O,children:S?t??e.jsxs(e.Fragment,{children:[x("finish","Finish")," ",e.jsx(j.NiceIcon,{name:"check",size:14})]}):p??e.jsxs(e.Fragment,{children:[x("next","Next")," ",e.jsx(j.NiceIcon,{name:"arrow-right",size:14})]})})]})]})]})});Mn.displayName="NiceWizard";const _s=[],zn=s.createContext(null);function bs(){const n=s.useContext(zn);if(!n)throw new Error("useSetupWizard must be used within NiceSetupWizard");return n}const fs=e.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",focusable:"false",children:[e.jsx("path",{d:"M21 12a9 9 0 1 1-2.64-6.36"}),e.jsx("path",{d:"M21 3v6h-6"})]}),Dn=s.forwardRef(({steps:n=_s,initialValues:i={},activeStep:a,layout:u="horizontal",size:r="md",defaultQuickMode:d=!1,allowQuickModeToggle:o=!0,showStepNumbers:p=!0,showProgress:c=!0,showEstimatedTime:t=!1,allowStepClick:h=!0,showReviewStep:f=!1,persistKey:_,animation:v="slide",theme:w,branding:L,showLanguagePicker:b=!1,languagePickerProps:R,showThemePicker:T=!1,themePickerProps:y,showRestart:x=!1,onRestart:k,restart:I={},header:E,footer:C,onStepChange:N,onValuesChange:M,onComplete:z,onCancel:D,labels:l={},accessMode:m,id:S,className:K,style:B},O)=>{const $=j.useNiceAccessMode(m,S),J=$==="hidden",{t:Y}=j.useNiceTranslation(),Z=j.useControlId(S),[Q,F]=s.useState(d),q=s.useMemo(()=>Q?n.filter(g=>!g.quickModeSkip):n,[n,Q]),U=s.useMemo(()=>{if(!f)return q;const g={id:"__review__",title:l.review??Y("wizard.review","Review"),icon:e.jsx(j.NiceIcon,{name:"clipboard",size:16}),content:te=>e.jsxs("div",{className:"nice-setup-wizard__review",children:[e.jsx("h3",{children:Y("wizard.reviewTitle","Review Your Setup")}),q.filter(ee=>ee.summary).map(ee=>e.jsxs("div",{className:"nice-setup-wizard__review-section",children:[e.jsx("h4",{children:ee.title}),ee.summary?.(te.values)]},ee.id))]})};return[...q,g]},[q,f,l.review,Y]),[ie,xe]=s.useState(()=>{if(_)try{const g=localStorage.getItem(_);if(g)return{...i,...JSON.parse(g)}}catch{}return i}),[P,Ne]=s.useState(()=>{if(a)return a;if(_)try{const g=localStorage.getItem(`${_}_step`);if(g&&U.some(te=>te.id===g))return g}catch{}return U[0]?.id??""}),[ce,ae]=s.useState(()=>new Set([P])),[le,ne]=s.useState({}),[A,V]=s.useState(!1),[oe,_e]=s.useState("next"),[ye,Re]=s.useState(!1),Me=U.findIndex(g=>g.id===P),ue=Me>=0?Me:U.length>0?0:-1,X=U[ue],fe=ue===0,pe=ue===U.length-1,ve=U.length>0?(ue+1)/U.length*100:0;s.useEffect(()=>{_&&(localStorage.setItem(_,JSON.stringify(ie)),localStorage.setItem(`${_}_step`,P))},[ie,P,_]);const $e=s.useCallback((g,te)=>{xe(ee=>{const we={...ee,[g]:te};return M?.(we),we})},[M]),Ee=s.useCallback(g=>{xe(te=>{const ee={...te,...g};return M?.(ee),ee})},[M]),ge=s.useCallback((g,te)=>{ne(ee=>({...ee,[g]:te}))},[]),Ie=s.useCallback(g=>{ne(te=>{const ee={...te};return delete ee[g],ee})},[]),ke=s.useCallback(g=>{const te=U.findIndex(ee=>ee.id===g);te>=0&&(_e(te>ue?"next":"prev"),Ne(g),ae(ee=>new Set(ee).add(g)),N?.(g,te))},[U,ue,N]),G=s.useCallback(async()=>{if(X){if(X.validate){V(!0);try{const g=await X.validate(ie);if(g){ge(X.id,g),V(!1);return}Ie(X.id)}catch(g){ge(X.id,String(g)),V(!1);return}V(!1)}if(X.fields){for(const g of X.fields){if(g.required&&!ie[g.id]){ge(X.id,`${g.label} ${Y("wizard.isRequired","is required")}`);return}if(g.validation?.custom){const te=g.validation.custom(ie[g.id]);if(te){ge(X.id,te);return}}}Ie(X.id)}if(pe)await z?.(ie),_&&(localStorage.removeItem(_),localStorage.removeItem(`${_}_step`));else{let g;X.nextStep?g=typeof X.nextStep=="function"?X.nextStep(ie):X.nextStep:g=U[ue+1]?.id??"",g&&ke(g)}}},[X,ie,pe,ue,U,z,_,Y,ge,Ie,ke]),W=s.useCallback(()=>{if(fe)return;const g=X?.prevStep??U[ue-1]?.id;g&&(_e("prev"),ke(g))},[fe,X,ue,U,ke]),he=s.useCallback(()=>{if(X?.optional&&!pe){const g=U[ue+1]?.id;g&&ke(g)}},[X,pe,ue,U,ke]),je=s.useCallback(()=>{z?.(ie)},[z,ie]),H=s.useCallback(()=>{D?.()},[D]),se=s.useCallback(()=>{I.skipConfirm?k?.():Re(!0)},[I.skipConfirm,k]),de=s.useCallback(()=>{F(g=>!g)},[]),be=s.useMemo(()=>({values:ie,setValue:$e,setValues:Ee,currentStep:X,currentIndex:ue,totalSteps:U.length,visitedSteps:ce,errors:le,setError:ge,clearError:Ie,goNext:G,goPrev:W,goTo:ke,skip:he,complete:je,cancel:H,isFirst:fe,isLast:pe,isQuickMode:Q,toggleQuickMode:de,progress:ve,t:Y}),[ie,$e,Ee,X,ue,U.length,ce,le,ge,Ie,G,W,ke,he,je,H,fe,pe,Q,de,ve,Y]),ze=s.useMemo(()=>{if(!t)return null;const te=U.map(ee=>ee.estimatedTime).filter(Boolean).map(ee=>{const we=ee.match(/(\d+)\s*(min|sec|s|m)/i);if(!we)return 0;const Le=parseInt(we[1],10);return we[2].toLowerCase().startsWith("m")?Le:Le/60}).reduce((ee,we)=>ee+we,0);return te>0?`~${Math.ceil(te)} min`:null},[U,t]);if(!X)return null;const De=(g,te)=>{const ee=g.id===P,we=ce.has(g.id)&&!ee&&te<ue,Le=!ee&&!we,Te=!!le[g.id],me=h&&(we||te<=ue);return e.jsxs("button",{type:"button",role:"tab","aria-selected":ee,"aria-current":ee?"step":void 0,className:["nice-setup-wizard__step-indicator",ee&&"nice-setup-wizard__step-indicator--active",we&&"nice-setup-wizard__step-indicator--completed",Le&&"nice-setup-wizard__step-indicator--pending",Te&&"nice-setup-wizard__step-indicator--error"].filter(Boolean).join(" "),onClick:()=>me&&ke(g.id),disabled:!me,children:[e.jsx("span",{className:"nice-setup-wizard__step-marker",children:we?e.jsx(j.NiceIcon,{name:"check",size:14}):Te?"!":p?te+1:g.icon||e.jsx(j.NiceIcon,{name:"circle",size:12})}),e.jsxs("span",{className:"nice-setup-wizard__step-info",children:[e.jsx("span",{className:"nice-setup-wizard__step-title",children:g.title}),g.subtitle&&e.jsx("span",{className:"nice-setup-wizard__step-subtitle",children:g.subtitle}),g.optional&&e.jsxs("span",{className:"nice-setup-wizard__step-optional",children:["(",l.optional??Y("wizard.optional","optional"),")"]})]}),g.badge&&e.jsx("span",{className:"nice-setup-wizard__step-badge",children:g.badge})]},g.id)},qe=g=>{if(g.showWhen&&!g.showWhen(ie))return null;const te=ie[g.id]??g.defaultValue??"",ee=me=>$e(g.id,me);if(g.render)return e.jsx("div",{className:`nice-setup-wizard__field${g.fullWidth?" nice-setup-wizard__field--full":""}`,children:g.render({value:te,onChange:ee,field:g})},g.id);const we=`${Z}-${g.id}`,Le={id:we,disabled:g.disabled||$==="disabled"||$==="readOnly",placeholder:g.placeholder,required:g.required};let Te;switch(g.type){case"textarea":Te=e.jsx("textarea",{...Le,className:"nice-setup-wizard__input nice-setup-wizard__textarea",value:String(te),onChange:me=>ee(me.target.value),rows:4});break;case"select":Te=e.jsxs("select",{...Le,className:"nice-setup-wizard__input nice-setup-wizard__select",value:String(te),onChange:me=>ee(me.target.value),children:[e.jsx("option",{value:"",children:g.placeholder||Y("wizard.select","Select...")}),g.options?.map(me=>e.jsx("option",{value:me.value,children:me.label},me.value))]});break;case"radio":Te=e.jsx("div",{className:"nice-setup-wizard__radio-group",children:g.options?.map(me=>e.jsxs("label",{className:"nice-setup-wizard__radio-label",children:[e.jsx("input",{type:"radio",name:we,value:me.value,checked:te===me.value,onChange:()=>ee(me.value),disabled:Le.disabled}),me.icon&&e.jsx("span",{className:"nice-setup-wizard__radio-icon",children:me.icon}),e.jsx("span",{children:me.label})]},me.value))});break;case"checkbox":Te=e.jsxs("label",{className:"nice-setup-wizard__checkbox-label",children:[e.jsx("input",{type:"checkbox",checked:!!te,onChange:me=>ee(me.target.checked),disabled:Le.disabled}),e.jsx("span",{children:g.label})]});break;case"switch":Te=e.jsxs("label",{className:"nice-setup-wizard__switch-label",children:[e.jsx("span",{className:"nice-setup-wizard__switch-text",children:g.label}),e.jsxs("span",{className:`nice-setup-wizard__switch${te?" nice-setup-wizard__switch--on":""}`,children:[e.jsx("input",{type:"checkbox",checked:!!te,onChange:me=>ee(me.target.checked),disabled:Le.disabled}),e.jsx("span",{className:"nice-setup-wizard__switch-track"}),e.jsx("span",{className:"nice-setup-wizard__switch-thumb"})]})]});break;case"slider":Te=e.jsxs("div",{className:"nice-setup-wizard__slider-wrapper",children:[e.jsx("input",{type:"range",...Le,className:"nice-setup-wizard__slider",value:Number(te)||g.validation?.min||0,min:g.validation?.min,max:g.validation?.max,onChange:me=>ee(Number(me.target.value))}),e.jsx("span",{className:"nice-setup-wizard__slider-value",children:String(te??"")})]});break;default:Te=e.jsx("input",{type:g.type==="custom"?"text":g.type,...Le,className:"nice-setup-wizard__input",value:String(te),onChange:me=>ee(me.target.value),minLength:g.validation?.minLength,maxLength:g.validation?.maxLength,min:g.validation?.min,max:g.validation?.max,pattern:g.validation?.pattern?.source})}return e.jsxs("div",{className:`nice-setup-wizard__field${g.fullWidth?" nice-setup-wizard__field--full":""}`,children:[g.type!=="checkbox"&&g.type!=="switch"&&e.jsxs("label",{htmlFor:we,className:"nice-setup-wizard__label",children:[g.label,g.required&&e.jsx("span",{className:"nice-setup-wizard__required",children:"*"})]}),Te,g.description&&e.jsx("span",{className:"nice-setup-wizard__field-desc",children:g.description})]},g.id)},Ge=()=>X.fields?e.jsx("div",{className:"nice-setup-wizard__fields",children:X.fields.map(qe)}):X.content?typeof X.content=="function"?X.content(be):X.content:null;if(J)return null;const Pe=b||T||x,Ce=I.label??Y("wizard.restart","Start over"),Ye=e.jsx(zn.Provider,{value:be,children:e.jsxs("div",{ref:O,id:Z,className:["nice-setup-wizard",`nice-setup-wizard--${u}`,`nice-size-${r}`,v!=="none"&&`nice-setup-wizard--anim-${v}`,K].filter(Boolean).join(" "),style:B,children:[(L||E||o||Pe)&&e.jsxs("header",{className:"nice-setup-wizard__header",children:[L&&e.jsx("div",{className:"nice-setup-wizard__branding",children:L}),Pe&&e.jsxs("div",{className:"nice-setup-wizard__header-controls",children:[b&&e.jsx(nn,{compact:!0,variant:"ghost",...R}),T&&e.jsx(sn,{compact:!0,variant:"ghost",...y}),x&&e.jsx("button",{type:"button",className:"nice-setup-wizard__icon-btn nice-setup-wizard__restart",onClick:se,title:Ce,"aria-label":Ce,children:I.icon??fs})]}),E,o&&e.jsxs("label",{className:"nice-setup-wizard__quick-toggle",children:[e.jsx("input",{type:"checkbox",checked:Q,onChange:de}),e.jsx("span",{children:l.quickMode??Y("wizard.quickMode","Quick Setup")})]}),ze&&e.jsx("span",{className:"nice-setup-wizard__time",children:ze})]}),u!=="minimal"&&e.jsx("nav",{className:"nice-setup-wizard__nav",role:"tablist",children:U.map(De)}),c&&e.jsx("div",{className:"nice-setup-wizard__progress",children:e.jsx("div",{className:"nice-setup-wizard__progress-bar",style:{width:`${ve}%`},role:"progressbar","aria-valuenow":ve,"aria-valuemin":0,"aria-valuemax":100})}),e.jsxs("div",{className:["nice-setup-wizard__content",oe==="next"&&"nice-setup-wizard__content--slide-next",oe==="prev"&&"nice-setup-wizard__content--slide-prev"].filter(Boolean).join(" "),role:"tabpanel",children:[X.description&&e.jsx("p",{className:"nice-setup-wizard__step-description",children:X.description}),Ge(),le[X.id]&&e.jsx("div",{className:"nice-setup-wizard__error",role:"alert",children:le[X.id]})]},P),e.jsxs("footer",{className:"nice-setup-wizard__footer",children:[e.jsxs("div",{className:"nice-setup-wizard__actions-left",children:[D&&e.jsx("button",{type:"button",className:"nice-btn nice-btn--text",onClick:H,children:l.cancel??Y("wizard.cancel","Cancel")}),X.optional&&!pe&&e.jsx("button",{type:"button",className:"nice-btn nice-btn--text",onClick:he,children:l.skip??Y("wizard.skip","Skip")}),X.actions?.filter(g=>g.position==="left").map(g=>e.jsxs("button",{type:"button",className:`nice-btn nice-btn--${g.variant||"outlined"}`,onClick:()=>g.onClick(be),disabled:g.disabled?.(be),children:[g.icon," ",g.label]},g.id))]}),e.jsxs("div",{className:"nice-setup-wizard__actions-right",children:[X.actions?.filter(g=>g.position!=="left").map(g=>e.jsxs("button",{type:"button",className:`nice-btn nice-btn--${g.variant||"outlined"}`,onClick:()=>g.onClick(be),disabled:g.disabled?.(be),children:[g.icon," ",g.label]},g.id)),!fe&&e.jsx(Ae.NiceButton,{variant:"outline",size:r,onClick:W,children:l.prev??e.jsxs(e.Fragment,{children:[e.jsx(j.NiceIcon,{name:"arrow-left",size:14})," ",Y("wizard.prev","Back")]})}),e.jsx(Ae.NiceButton,{variant:"primary",size:r,onClick:G,disabled:A,loading:A,children:pe?l.finish??e.jsxs(e.Fragment,{children:[Y("wizard.finish","Finish")," ",e.jsx(j.NiceIcon,{name:"check",size:14})]}):l.next??e.jsxs(e.Fragment,{children:[Y("wizard.next","Continue")," ",e.jsx(j.NiceIcon,{name:"arrow-right",size:14})]})})]})]}),C&&e.jsx("div",{className:"nice-setup-wizard__custom-footer",children:C}),u==="minimal"&&e.jsx("div",{className:"nice-setup-wizard__minimal-indicator",children:l.stepOf?l.stepOf.replace("{current}",String(ue+1)).replace("{total}",String(U.length)):`${ue+1} / ${U.length}`}),x&&!I.skipConfirm&&e.jsx(ns.NiceConfirmDialog,{visible:ye,variant:"warning",size:r,header:I.confirmTitle??Y("wizard.restartConfirmTitle","Start setup over?"),message:I.confirmMessage??Y("wizard.restartConfirmMessage","This will discard your progress and restart the setup from the beginning."),acceptLabel:I.confirmLabel??Y("wizard.restartConfirmAccept","Yes, start over"),rejectLabel:I.cancelLabel??Y("wizard.restartConfirmReject","Cancel"),onAccept:()=>{Re(!1),k?.()},onReject:()=>Re(!1)})]})});return w!=null?e.jsx(j.NiceThemeProvider,{theme:w,children:Ye}):Ye});Dn.displayName="NiceSetupWizard";const Ln=s.forwardRef(({label:n,helperText:i,disabled:a,size:u="md",id:r,className:d,style:o,accessMode:p,logo:c,brandName:t,breadcrumbs:h,centerContent:f,rightContent:_,leftContent:v,sticky:w=!0,variant:L="light",height:b="md",onBrandClick:R,displayStyle:T},y)=>{const x=j.useNiceAccessMode(p,r),k=x==="hidden";x==="disabled"&&(a=!0);const{t:I}=j.useNiceTranslation(),E=j.useControlId(r),C=j.useComponentDisplayStyle("menu",T),N=j.useComponentDisplayClass("menu",T);return k?null:e.jsxs("nav",{ref:y,id:E,className:`nice-navbar nice-navbar--${L} nice-navbar--h-${b}${w?" nice-navbar--sticky":""} nice-navbar--ds-${N}${d?` ${d}`:""}${a?" nice-disabled":""}`,style:{...C,...o},role:"navigation","aria-label":n??I("mainNavigation","Main navigation"),children:[e.jsxs("div",{className:"nice-navbar__left",children:[v,(c||t)&&e.jsxs("div",{className:"nice-navbar__brand",onClick:R,role:R?"button":void 0,tabIndex:R?0:void 0,children:[c&&e.jsx("span",{className:"nice-navbar__logo",children:c}),t&&e.jsx("span",{className:"nice-navbar__brand-name",children:t})]}),h&&h.length>0&&e.jsx("ol",{className:"nice-navbar__breadcrumbs","aria-label":I("breadcrumbs","Breadcrumbs"),children:h.map((M,z)=>e.jsxs("li",{className:"nice-navbar__breadcrumb",children:[z>0&&e.jsx("span",{className:"nice-navbar__breadcrumb-sep",children:"/"}),M.href||M.onClick?e.jsx("a",{href:M.href??"#",onClick:D=>{M.onClick&&(D.preventDefault(),M.onClick())},children:M.label}):e.jsx("span",{"aria-current":z===h.length-1?"page":void 0,children:M.label})]},z))})]}),f&&e.jsx("div",{className:"nice-navbar__center",children:f}),_&&e.jsx("div",{className:"nice-navbar__right",children:_})]})});Ln.displayName="NiceNavbar";const vs={online:"var(--nice-color-success, #5cb85c)",away:"var(--nice-color-warning, #f0ad4e)",busy:"var(--nice-color-error, #d9534f)",offline:"var(--nice-text-muted, #999)"},rn=s.forwardRef(({label:n,disabled:i,size:a="md",id:u,className:r,style:d,accessMode:o,userName:p,userEmail:c,userRole:t,avatarUrl:h,items:f=[],open:_,onOpenChange:v,onProfile:w,onLogout:L,avatarSize:b=36,status:R},T)=>{const y=j.useNiceAccessMode(o,u),x=y==="hidden";y==="disabled"&&(i=!0);const{t:k}=j.useNiceTranslation(),I=j.useControlId(u),[E,C]=s.useState(!1),N=_??E,M=s.useCallback(()=>{const O=!N;C(O),v?.(O)},[N,v]),z=s.useRef(null),[D,l]=s.useState(null),m=s.useCallback(()=>{const O=z.current?.getBoundingClientRect();O&&l({top:O.bottom+6,right:window.innerWidth-O.right})},[]);s.useLayoutEffect(()=>{N&&m()},[N,m]),s.useEffect(()=>{if(!N)return;const O=()=>m();return window.addEventListener("scroll",O,!0),window.addEventListener("resize",O),()=>{window.removeEventListener("scroll",O,!0),window.removeEventListener("resize",O)}},[N,m]);const S=p.split(" ").map(O=>O.charAt(0)).join("").toUpperCase().slice(0,2),K=[];w&&K.push({id:"__profile",label:k("profile","Profile"),onClick:w}),L&&K.push({id:"__divider",label:"",isDivider:!0},{id:"__logout",label:k("logout","Logout"),onClick:L,danger:!0});const B=f.length>0?f:K;return x?null:e.jsxs("div",{ref:T,id:I,className:`nice-user-menu nice-size-${a}${r?` ${r}`:""}${i?" nice-disabled":""}`,style:d,children:[e.jsxs("button",{ref:z,type:"button",className:"nice-user-menu__trigger",onClick:M,onBlur:()=>setTimeout(()=>{C(!1),v?.(!1)},200),disabled:i,"aria-haspopup":"menu","aria-expanded":N,"aria-label":n??p,children:[e.jsx("span",{className:"nice-user-menu__avatar",style:{width:b,height:b},children:h?e.jsx("img",{src:h,alt:p}):e.jsx("span",{className:"nice-user-menu__initials",children:S})}),R&&e.jsx("span",{className:"nice-user-menu__status",style:{backgroundColor:vs[R]},title:R})]}),N&&D&&typeof document<"u"&&en.createPortal(e.jsxs("div",{className:`nice-user-menu__dropdown nice-user-menu__dropdown--portal ${Fe.scopeThemeClass(z.current)}`,role:"menu",style:{position:"fixed",top:D.top,right:D.right,zIndex:1e3},onMouseDown:O=>O.preventDefault(),children:[e.jsxs("div",{className:"nice-user-menu__info",children:[e.jsx("span",{className:"nice-user-menu__name",children:p}),c&&e.jsx("span",{className:"nice-user-menu__email",children:c}),t&&e.jsx("span",{className:"nice-user-menu__role",children:t})]}),B.length>0&&e.jsx("div",{className:"nice-user-menu__items",children:B.map(O=>O.isDivider?e.jsx("hr",{className:"nice-user-menu__divider"},O.id):e.jsxs("button",{type:"button",role:"menuitem",className:`nice-user-menu__item${O.danger?" nice-user-menu__item--danger":""}`,onClick:()=>{O.onClick?.(),C(!1),v?.(!1)},disabled:O.disabled||i,children:[O.icon&&e.jsx("span",{className:"nice-user-menu__item-icon",children:O.icon}),e.jsx("span",{children:O.label})]},O.id))})]}),document.body)]})});rn.displayName="NiceUserMenu";function xs(n,i){if(!i)return n;const a=i.toLowerCase();return n.map(u=>{const r=u.entities.filter(o=>o.label.toLowerCase().includes(a)||o.name.toLowerCase().includes(a));return u.label.toLowerCase().includes(a)||u.name.toLowerCase().includes(a)?u:r.length>0?{...u,entities:r}:null}).filter(Boolean)}const Ns=({value:n,onChange:i,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(j.NiceIcon,{name:"search",size:16})}),e.jsx("input",{type:"text",className:"nice-dynamic-sidebar__search-input",value:n,onChange:u=>i(u.target.value),placeholder:a,"aria-label":a}),n&&e.jsx("button",{className:"nice-dynamic-sidebar__search-clear",onClick:()=>i(""),"aria-label":"Clear",type:"button",children:e.jsx(j.NiceIcon,{name:"close",size:14})})]}),gs=({module:n,activeRoute:i,collapsed:a,expandedModules:u,onToggleModule:r,onNavigate:d})=>{const o=u.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&&d(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 ${o?"nice-dynamic-sidebar__module-header--expanded":""}`,onClick:()=>n.isAvailable&&r(n.id),disabled:!n.isAvailable,type:"button","aria-expanded":o,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 ${o?"nice-dynamic-sidebar__module-chevron--open":""}`,children:e.jsx(j.NiceIcon,{name:"chevron-right",size:14})})]}),o&&e.jsx("ul",{className:"nice-dynamic-sidebar__entities",role:"list",children:n.entities.map(p=>e.jsx("li",{className:`nice-dynamic-sidebar__entity ${i===p.route?"nice-dynamic-sidebar__entity--active":""}`,children:e.jsxs("button",{className:"nice-dynamic-sidebar__entity-btn",onClick:()=>d(p.route,p),type:"button",children:[p.icon&&e.jsx("span",{className:"nice-dynamic-sidebar__entity-icon",children:p.icon}),e.jsx("span",{children:p.label})]})},p.id))})]})},js=({favorites:n,activeRoute:i,onNavigate:a,label:u})=>n.length===0?null:e.jsxs("div",{className:"nice-dynamic-sidebar__favorites",children:[e.jsx("div",{className:"nice-dynamic-sidebar__section-title",children:u}),e.jsx("ul",{role:"list",children:n.map(r=>e.jsx("li",{className:`nice-dynamic-sidebar__favorite ${i===r.route?"nice-dynamic-sidebar__favorite--active":""}`,children:e.jsxs("button",{className:"nice-dynamic-sidebar__favorite-btn",onClick:()=>a(r.route),type:"button",children:[r.icon&&e.jsx("span",{children:r.icon}),e.jsx("span",{children:r.label})]})},r.id))})]}),Tn=s.forwardRef(({menu:n,activeRoute:i,collapsed:a,width:u=260,collapsedWidth:r=56,searchable:d=!0,showFavorites:o=!0,showQuickActions:p=!0,collapsible:c=!0,onNavigate:t,onCollapseChange:h,onToggleFavorite:f,header:_,footer:v,className:w,style:L,id:b,accessMode:R,...T},y)=>{const x=j.useControlId(b),k=j.useNiceAccessMode(R,b),{t:I}=j.useNiceTranslation(),[E,C]=s.useState(a??!1),N=a??E,[M,z]=s.useState(""),[D,l]=s.useState(()=>{if(i){const $=n.modules.find(J=>J.entities.some(Y=>Y.route===i));return $?new Set([$.id]):new Set}return new Set}),m=s.useCallback(()=>{const $=!N;C($),h?.($)},[N,h]),S=s.useCallback($=>{l(J=>{const Y=new Set(J);return Y.has($)?Y.delete($):Y.add($),Y})},[]),K=s.useCallback(($,J)=>{t?.($,J)},[t]),B=s.useMemo(()=>xs(n.modules.filter($=>$.isAvailable).sort(($,J)=>$.order-J.order),M),[n.modules,M]),O=N?r:u;return k==="hidden"?null:e.jsxs("nav",{ref:y,id:x,className:`nice-dynamic-sidebar ${N?"nice-dynamic-sidebar--collapsed":""} ${w??""}`,style:{...L,width:O,minWidth:O},"aria-label":I("nav.sidebar","Sidebar"),...T,children:[_&&e.jsx("div",{className:"nice-dynamic-sidebar__header",children:_}),c&&e.jsx("button",{className:"nice-dynamic-sidebar__toggle",onClick:m,"aria-label":N?I("expand","Expand"):I("collapse","Collapse"),type:"button",children:e.jsx(j.NiceIcon,{name:N?"chevron-right":"chevron-left",size:14})}),d&&!N&&e.jsx(Ns,{value:M,onChange:z,placeholder:I("nav.search","Search")}),o&&!N&&e.jsx(js,{favorites:n.favorites,activeRoute:i,onNavigate:K,label:I("nav.favorites","Favorites")}),p&&!N&&n.quickActions.length>0&&e.jsx("div",{className:"nice-dynamic-sidebar__quick-actions",children:n.quickActions.map($=>e.jsxs("button",{className:"nice-dynamic-sidebar__quick-action",onClick:()=>K($.route),title:$.shortcut?`${$.label} (${$.shortcut})`:$.label,type:"button",children:[$.icon&&e.jsx("span",{children:$.icon}),e.jsx("span",{children:$.label})]},$.id))}),e.jsxs("div",{className:"nice-dynamic-sidebar__modules",role:"navigation",children:[B.map($=>e.jsx(gs,{module:$,activeRoute:i,collapsed:N,expandedModules:D,onToggleModule:S,onNavigate:K},$.id)),B.length===0&&!N&&e.jsx("div",{className:"nice-dynamic-sidebar__empty",children:I("noData","No data")})]}),v&&e.jsx("div",{className:"nice-dynamic-sidebar__footer",children:v})]})});Tn.displayName="NiceDynamicSidebar";const ys=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"})]}),ks=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"})]}),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("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"})]}),ws=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"})]}),Ss=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"})]}),on=[{id:"prefs-general",route:"preferences/general",labelKey:"sidebar.prefs.general",labelDefault:"General",icon:ys},{id:"prefs-display",route:"preferences/display",labelKey:"sidebar.prefs.display",labelDefault:"Display",icon:ks},{id:"prefs-order",route:"preferences/order",labelKey:"sidebar.prefs.order",labelDefault:"Order",icon:Cs},{id:"prefs-hidden",route:"preferences/hidden",labelKey:"sidebar.prefs.hidden",labelDefault:"Hidden items",icon:ws},{id:"prefs-reset",route:"preferences/reset",labelKey:"sidebar.prefs.reset",labelDefault:"Reset",icon:Ss}];function $s(n){return on.map(i=>({id:i.id,label:n(i.labelKey,i.labelDefault),icon:i.icon,route:i.route}))}const Be=n=>s.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),Es=Be([s.createElement("line",{key:"l1",x1:4,y1:7,x2:20,y2:7}),s.createElement("line",{key:"l2",x1:4,y1:12,x2:20,y2:12}),s.createElement("line",{key:"l3",x1:4,y1:17,x2:20,y2:17})]),Is=Be([s.createElement("circle",{key:"h",cx:12,cy:8,r:4}),s.createElement("path",{key:"b",d:"M4 21c0-4 4-7 8-7s8 3 8 7"})]),Ms=Be([s.createElement("rect",{key:"r",x:4,y:3,width:16,height:18,rx:1}),s.createElement("line",{key:"l1",x1:9,y1:7,x2:9,y2:7.01}),s.createElement("line",{key:"l2",x1:15,y1:7,x2:15,y2:7.01}),s.createElement("line",{key:"l3",x1:9,y1:12,x2:9,y2:12.01}),s.createElement("line",{key:"l4",x1:15,y1:12,x2:15,y2:12.01}),s.createElement("rect",{key:"d",x:10,y:16,width:4,height:5})]),zs=Be(s.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"})),Ds=Be([s.createElement("circle",{key:"c",cx:11,cy:11,r:7}),s.createElement("line",{key:"l",x1:21,y1:21,x2:16.65,y2:16.65})]),Ls=Be([s.createElement("circle",{key:"c",cx:12,cy:12,r:3}),s.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"})]),Ke={all:{icon:Es,label:"Everything"},"by-role":{icon:Is,label:"By role"},"by-unit":{icon:Ms,label:"By unit"},favorites:{icon:zs,label:"Favorites"},search:{icon:Ds,label:"Search"},preferences:{icon:Ls,label:"Preferences"}},Ts={all:"all","by-role":"byRole","by-unit":"byUnit",favorites:"favorites",search:"search",preferences:"preferences"};function He(n,i){const a=Ke[i];return a?n(`sidebarNav.mode.${Ts[i]}`,a.label):i}const dn={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 We(n){return typeof n=="string"?e.jsx(j.NiceIcon,{name:n}):n}function Rn(n){return`nice_sidebar_nav_${n??"_default"}`}const Xe="nice-sidebar-prefs-change";function mn(n,i){const a={...dn,userId:n??"_default"};if(i&&Object.assign(a,i),i&&typeof i.activeMode<"u")return a;try{const u=localStorage.getItem(Rn(n));if(u){const r=JSON.parse(u);return Array.isArray(r.favorites)&&(r.favorites=r.favorites.map(d=>d&&typeof d=="object"?{...d,icon:typeof d.icon=="string"||s.isValidElement(d.icon)?d.icon:void 0}:d)),{...a,...r,userId:n??"_default"}}}catch{}return a}function An(n,i,a,u){const[r,d]=s.useState(()=>{const c=mn(n,a);return i!==void 0&&(c.enableModeIcons=i),c});s.useEffect(()=>{a&&d(c=>({...c,...a}))},[a]);const o=s.useCallback(c=>{d(t=>{const h=c(t);if(!a?.activeMode)try{const f={...h,favorites:h.favorites.map(_=>({..._,icon:void 0}))};localStorage.setItem(Rn(n),JSON.stringify(f)),typeof window<"u"&&window.dispatchEvent(new CustomEvent(Xe,{detail:{userId:n??"_default"}}))}catch{}return u?.(h),h})},[n,a,u]);s.useEffect(()=>{if(typeof window>"u")return;const c=t=>{t.detail?.userId===(n??"_default")&&d(f=>{const _=mn(n,a);return i!==void 0&&(_.enableModeIcons=i),JSON.stringify(f)===JSON.stringify(_)?f:_})};return window.addEventListener(Xe,c),()=>window.removeEventListener(Xe,c)},[n,a,i]);const p=s.useMemo(()=>({setMode:c=>o(t=>({...t,activeMode:c})),setEnableModeIcons:c=>o(t=>({...t,enableModeIcons:c})),toggleMode:c=>o(t=>{if(c==="preferences")return t;const h=t.enabledModes.includes(c);return{...t,enabledModes:h?t.enabledModes.filter(f=>f!==c):[...t.enabledModes,c],activeMode:!h||t.activeMode!==c?t.activeMode:"all"}}),pinSource:(c,t)=>o(h=>({...h,pinnedSources:{...h.pinnedSources,[c]:[...h.pinnedSources[c]??[],t]}})),unpinSource:(c,t)=>o(h=>({...h,pinnedSources:{...h.pinnedSources,[c]:(h.pinnedSources[c]??[]).filter(f=>f!==t)}})),hideItem:c=>o(t=>({...t,hiddenItems:t.hiddenItems.some(h=>h.id===c.id)?t.hiddenItems:[...t.hiddenItems,c]})),restoreItem:c=>o(t=>({...t,hiddenItems:t.hiddenItems.filter(h=>h.id!==c)})),addFavorite:c=>o(t=>({...t,favorites:t.favorites.some(h=>h.id===c.id)?t.favorites:[...t.favorites,{...c,addedAt:Date.now()}]})),removeFavorite:c=>o(t=>({...t,favorites:t.favorites.filter(h=>h.id!==c)})),setMaxDepth:(c,t)=>o(h=>({...h,maxDepth:{...h.maxDepth,[c]:Math.min(10,Math.max(1,t))}})),toggleCollapse:c=>o(t=>({...t,collapsedIds:t.collapsedIds.includes(c)?t.collapsedIds.filter(h=>h!==c):[...t.collapsedIds,c]})),setCollapsed:(c,t)=>o(h=>({...h,collapsedIds:t?Array.from(new Set([...h.collapsedIds,...c])):h.collapsedIds.filter(f=>!c.includes(f))})),setAutoExpand:c=>o(t=>({...t,autoExpand:c})),setLeftClickBehavior:c=>o(t=>({...t,leftClickBehavior:c})),reorderItems:(c,t)=>o(h=>{const f={...h.itemOrder};return t==null?delete f[c]:f[c]=t,{...h,itemOrder:f}}),resetAll:()=>o(()=>({...dn,userId:n??"_default"}))}),[o,n]);return[r,p]}function Rs({enabledModes:n,activeMode:i,onSelect:a,collapsed:u=!1}){const{t:r}=j.useNiceTranslation(),d=[...n.filter(p=>p!=="preferences"),"preferences"],o=r("sidebarNav.modeBar.label","Navigation mode");if(u){const p=Math.max(0,d.indexOf(i)),c=d[(p-1+d.length)%d.length],t=d[(p+1)%d.length],h=Ke[i],f=He(r,i);return e.jsxs("div",{className:"nice-sidebar-nav__mode-bar nice-sidebar-nav__mode-bar--carousel",role:"tablist","aria-label":o,children:[e.jsx(Se,{content:`${r("sidebarNav.modeBar.previous","Previous mode")}: ${He(r,c)}`,position:"bottom",size:"sm",children:e.jsx("button",{type:"button",className:"nice-sidebar-nav__mode-arrow","aria-label":r("sidebarNav.modeBar.previous","Previous mode"),onClick:()=>a(c),children:e.jsx("span",{"aria-hidden":"true",children:"‹"})})}),e.jsx(Se,{content:f,position:"bottom",size:"sm",children:e.jsx("button",{type:"button",role:"tab","aria-selected":!0,"aria-label":f,className:"nice-sidebar-nav__mode-pill nice-sidebar-nav__mode-pill--active nice-sidebar-nav__mode-pill--carousel",onClick:()=>a(i),children:e.jsx("span",{className:"nice-sidebar-nav__mode-pill-icon","aria-hidden":"true",children:h.icon})})}),e.jsx(Se,{content:`${r("sidebarNav.modeBar.next","Next mode")}: ${He(r,t)}`,position:"bottom",size:"sm",children:e.jsx("button",{type:"button",className:"nice-sidebar-nav__mode-arrow","aria-label":r("sidebarNav.modeBar.next","Next mode"),onClick:()=>a(t),children:e.jsx("span",{"aria-hidden":"true",children:"›"})})})]})}return e.jsx("div",{className:"nice-sidebar-nav__mode-bar",role:"tablist","aria-label":o,children:d.map(p=>{const c=Ke[p],t=He(r,p),h=i===p;return e.jsx(Se,{content:t,position:"bottom",size:"sm",children:e.jsxs("button",{role:"tab","aria-selected":h,"aria-label":t,className:["nice-sidebar-nav__mode-pill",h?"nice-sidebar-nav__mode-pill--active":""].filter(Boolean).join(" "),onClick:()=>a(p),children:[e.jsx("span",{className:"nice-sidebar-nav__mode-pill-icon","aria-hidden":"true",children:c.icon}),e.jsx("span",{className:"nice-sidebar-nav__mode-pill-label",children:t})]})},p)})})}function On({open:n,size:i=16}){return e.jsx("svg",{width:i,height:i,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 As({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 Os({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 Fn({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 Fs({size:n=14,filled:i=!1}){return e.jsxs("svg",{width:n,height:n,viewBox:"0 0 24 24",fill:i?"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 Bn({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 Pn({item:n,depth:i,maxDepth:a,activeRoute:u,collapsedIds:r,hiddenIds:d,autoExpand:o,sidebarCollapsed:p=!1,expandableWhenCollapsed:c=!1,onNavigate:t,onHide:h,onToggleCollapse:f,onAddFavorite:_,onRemoveFavorite:v,isFavorite:w,leftClickBehavior:L="focus-existing",routeToUrl:b,contextMenu:R=!0,disabledActions:T}){const{t:y}=j.useNiceTranslation(),x=s.useRef(null),k=(n.children?.length??0)>0&&i<a,I=r.includes(n.id),E=o?!I:I,C=!!(n.route&&u&&n.route===u),N=!!n.route,M=N&&w(n.id),z=s.useMemo(()=>{if(!R||!N||!n.route)return[];const l=n.route,m=[{id:"open",label:y("sidebar.menu.open","Open"),onClick:()=>t?.(l,n,{forceNew:!1})},{id:"openNewTab",label:y("sidebar.menu.openNewTab","Open in new tab"),onClick:()=>t?.(l,n,{forceNew:!0})}];return b&&m.push({id:"openBrowserTab",label:y("sidebar.menu.openBrowserTab","Open in new browser tab"),onClick:()=>{typeof window<"u"&&window.open(b(l),"_blank","noopener,noreferrer")}}),m.push({id:"sep-1",divider:!0}),M?m.push({id:"unpinFavorite",label:y("sidebar.menu.unpinFavorite","Remove from favorites"),onClick:()=>v(n.id)}):m.push({id:"pinFavorite",label:y("sidebar.menu.pinFavorite","Add to favorites"),onClick:()=>_({id:n.id,label:n.label,icon:n.icon,route:n.route,sourceId:n.sourceId,moduleId:n.moduleId,addedAt:Date.now()})}),m.push({id:"hide",label:y("sidebar.menu.hide","Hide"),disabled:!!T?.has("hide"),onClick:()=>h({id:n.id,kind:n.kind,label:n.label})}),b&&(m.push({id:"sep-2",divider:!0}),m.push({id:"copyLink",label:y("sidebar.menu.copyLink","Copy link"),onClick:()=>{typeof navigator<"u"&&navigator.clipboard&&navigator.clipboard.writeText(b(l))}})),m},[R,T,N,n,M,b,t,_,v,h,y]);if(d.has(n.id))return null;function D(){if(k){T?.has("collapseToggle")||f(n.id);return}if(N&&n.route){const l=L==="open-new";t?.(n.route,n,{forceNew:l})}}return e.jsxs("li",{className:["nice-sidebar-nav__node",`nice-sidebar-nav__node--depth-${i}`,C?"nice-sidebar-nav__node--active":"",k?"nice-sidebar-nav__node--branch":"nice-sidebar-nav__node--leaf"].filter(Boolean).join(" "),"data-nice-depth":i,style:(()=>{const l=Math.min(Math.max(i,1),10);return{"--nice-row-bg":`var(--nice-sidebar-level-${l}-bg, transparent)`,"--nice-row-text":`var(--nice-sidebar-level-${l}-text, inherit)`,"--nice-row-border":`var(--nice-sidebar-level-${l}-border, transparent)`,"--nice-row-hover-bg":`var(--nice-sidebar-level-${l}-hover-bg, var(--nice-hover-bg))`,"--nice-row-active-bg":`var(--nice-sidebar-level-${l}-active-bg, var(--nice-selected-bg))`}})(),children:[e.jsxs("div",{className:"nice-sidebar-nav__node-row",ref:x,children:[k&&e.jsx(Se,{content:E?y("sidebarNav.collapse","Collapse"):y("sidebarNav.expand","Expand"),position:"right",size:"sm",children:e.jsx("button",{className:"nice-sidebar-nav__collapse-btn","aria-label":E?y("sidebarNav.collapse","Collapse"):y("sidebarNav.expand","Expand"),"aria-expanded":E,disabled:T?.has("collapseToggle"),onClick:()=>f(n.id),children:e.jsx(On,{open:E,size:20})})}),!k&&e.jsx("span",{className:"nice-sidebar-nav__collapse-spacer"}),e.jsx(Se,{content:n.tooltip??n.label,position:"right",size:"sm",children:e.jsxs("span",{role:N?"link":void 0,tabIndex:N?0:void 0,className:["nice-sidebar-nav__node-content",N?"nice-sidebar-nav__node-content--link":"",!N&&k?"nice-sidebar-nav__node-content--toggle":""].filter(Boolean).join(" "),onClick:D,onKeyDown:l=>(l.key==="Enter"||l.key===" ")&&D(),children:[n.icon&&e.jsx("span",{className:"nice-sidebar-nav__node-icon","aria-hidden":"true",children:We(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} ${y("sidebarNav.notifications","notifications")}`,children:n.badge})]})}),e.jsxs("div",{className:"nice-sidebar-nav__node-actions",children:[N&&!w(n.id)&&e.jsx(Se,{content:y("sidebarNav.addFavorite","Add to favorites"),position:"top",size:"sm",children:e.jsx("button",{className:"nice-sidebar-nav__action-btn nice-sidebar-nav__action-btn--fav","aria-label":y("sidebarNav.addFavorite","Add to favorites"),onClick:l=>{l.stopPropagation(),_({id:n.id,label:n.label,icon:n.icon,route:n.route,sourceId:n.sourceId,moduleId:n.moduleId,addedAt:Date.now()})},children:e.jsx(As,{size:14})})}),w(n.id)&&e.jsx(Se,{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(Os,{size:14})})}),e.jsx(Se,{content:y("sidebarNav.hideItem","Hide item"),position:"top",size:"sm",children:e.jsx("button",{className:"nice-sidebar-nav__action-btn nice-sidebar-nav__action-btn--hide","aria-label":y("sidebarNav.hideItem","Hide item"),onClick:l=>{l.stopPropagation(),h({id:n.id,kind:n.kind,label:n.label})},children:e.jsx(Fn,{size:14})})})]})]}),z.length>0&&e.jsx(ln,{target:x,items:z,size:"sm"}),k&&E&&e.jsx("ul",{className:"nice-sidebar-nav__children",children:n.children.map(l=>e.jsx(Pn,{item:l,depth:i+1,maxDepth:a,activeRoute:u,collapsedIds:r,hiddenIds:d,autoExpand:o,sidebarCollapsed:p,expandableWhenCollapsed:c,onNavigate:t,onHide:h,onToggleCollapse:f,onAddFavorite:_,onRemoveFavorite:v,isFavorite:w,leftClickBehavior:L,routeToUrl:b,contextMenu:R,disabledActions:T},l.id))})]})}function Bs(n,i){if(!i||i.length===0)return n;const a=new Map(i.map((r,d)=>[r,d])),u=i.length;return[...n].sort((r,d)=>{const o=a.has(r.id)?a.get(r.id):u+n.indexOf(r),p=a.has(d.id)?a.get(d.id):u+n.indexOf(d);return o-p})}function Ps(n,i){return n.map(a=>({id:a.id,label:a.label,tooltip:a.tooltip,icon:a.icon,kind:"module",sourceId:i,children:a.views.map(u=>({id:u.id,label:u.label,tooltip:u.tooltip,icon:u.icon,route:u.route,badge:u.badge,kind:"view",sourceId:i,moduleId:a.id,children:[]}))}))}function Hs(n,i){return n.map(a=>({id:a.id,label:a.label,tooltip:a.tooltip,icon:a.icon,kind:"role",sourceId:i,children:a.modules.map(u=>({id:`${a.id}:${u.id}`,label:u.label,tooltip:u.tooltip,icon:u.icon,kind:"module",sourceId:i,children:u.views.map(r=>({id:r.id,label:r.label,tooltip:r.tooltip,icon:r.icon,route:r.route,badge:r.badge,kind:"view",sourceId:i,moduleId:u.id,children:[]}))}))}))}function Us(n,i){return n.map(a=>({id:a.id,label:a.label,tooltip:a.tooltip,icon:a.icon,kind:"unit",sourceId:i,children:a.modules.map(u=>({id:`${a.id}:${u.id}`,label:u.label,tooltip:u.tooltip,icon:u.icon,kind:"module",sourceId:i,children:u.views.map(r=>({id:r.id,label:r.label,tooltip:r.tooltip,icon:r.icon,route:r.route,badge:r.badge,kind:"view",sourceId:i,moduleId:u.id,children:[]}))}))}))}function Ws({node:n,mode:i,maxDepth:a,isPinned:u,prefs:r,helpers:d,activeRoute:o,onNavigate:p,sidebarCollapsed:c=!1,expandableWhenCollapsed:t=!1,routeToUrl:h,contextMenu:f=!0,disabledActions:_,showHeader:v=!0}){const{t:w}=j.useNiceTranslation(),L=s.useRef(null),b=s.useMemo(()=>new Set(r.hiddenItems.map(D=>D.id)),[r.hiddenItems]),R=s.useMemo(()=>{let D;return i==="all"?D=Ps(n.modules,n.source.id):i==="by-role"?D=Hs(n.roles,n.source.id):D=Us(n.units,n.source.id),Bs(D,r.itemOrder[i])},[i,n,r.itemOrder]),T=s.useCallback(D=>r.favorites.some(l=>l.id===D),[r.favorites]),y=s.useMemo(()=>f?[{id:u?"unpinSource":"pinSource",label:u?w("sidebar.menu.unpinSource","Unpin source"):w("sidebar.menu.pinSource","Pin source"),onClick:()=>u?d.unpinSource(i,n.source.id):d.pinSource(i,n.source.id)},{id:"hideSource",label:w("sidebar.menu.hideSource","Hide source"),disabled:!!_?.has("hide"),onClick:()=>d.hideItem({id:n.source.id,kind:"source",label:n.source.label})}]:[],[f,_,u,d,i,n.source,w]);if(b.has(n.source.id))return null;const x=r.collapsedIds.includes(n.source.id),k=r.autoExpand?!x:x,I=R.filter(D=>(D.children?.length??0)>0).map(D=>D.id),E=I.length>0,C=E&&I.every(D=>r.collapsedIds.includes(D)),N=E?!C:k,M=!v||E?!0:k,z=()=>{_?.has("collapseToggle")||(E?d.setCollapsed(I,!C):d.toggleCollapse(n.source.id))};return e.jsxs("section",{className:"nice-sidebar-nav__source-section",children:[v&&e.jsx(Se,{content:n.source.tooltip??n.source.label,position:"right",size:"sm",children:e.jsxs("div",{ref:L,className:"nice-sidebar-nav__source-header",onClick:D=>{D.target.closest(".nice-sidebar-nav__source-actions")||z()},role:"button",tabIndex:0,"aria-expanded":N,onKeyDown:D=>{(D.key==="Enter"||D.key===" ")&&(D.preventDefault(),z())},children:[e.jsx("span",{className:"nice-sidebar-nav__source-chevron","aria-hidden":"true",children:e.jsx(On,{open:N,size:16})}),n.source.icon&&e.jsx("span",{className:"nice-sidebar-nav__source-icon","aria-hidden":"true",children:We(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:D=>D.stopPropagation(),children:[e.jsx(Se,{content:u?w("sidebarNav.unpinSource","Unpin source"):w("sidebarNav.pinSource","Pin source"),position:"top",size:"sm",children:e.jsx("button",{className:["nice-sidebar-nav__action-btn nice-sidebar-nav__action-btn--pin",u?"nice-sidebar-nav__action-btn--pin-active":""].filter(Boolean).join(" "),"aria-label":u?w("sidebarNav.unpinSource","Unpin source"):w("sidebarNav.pinSource","Pin source"),onClick:()=>u?d.unpinSource(i,n.source.id):d.pinSource(i,n.source.id),children:e.jsx(Fs,{size:14,filled:u})})}),e.jsx(Se,{content:w("sidebarNav.hideSource","Hide source"),position:"top",size:"sm",children:e.jsx("button",{className:"nice-sidebar-nav__action-btn nice-sidebar-nav__action-btn--hide","aria-label":w("sidebarNav.hideSource","Hide source"),onClick:()=>d.hideItem({id:n.source.id,kind:"source",label:n.source.label}),children:e.jsx(Fn,{size:14})})})]})]})}),v&&y.length>0&&e.jsx(ln,{target:L,items:y,size:"sm"}),a>1&&M&&e.jsx("ul",{className:"nice-sidebar-nav__tree",children:R.map(D=>e.jsx(Pn,{item:D,depth:2,maxDepth:a,activeRoute:o,collapsedIds:r.collapsedIds,hiddenIds:b,autoExpand:r.autoExpand,sidebarCollapsed:c,expandableWhenCollapsed:t,onNavigate:p,onHide:d.hideItem,onToggleCollapse:d.toggleCollapse,onAddFavorite:d.addFavorite,onRemoveFavorite:d.removeFavorite,isFavorite:T,leftClickBehavior:r.leftClickBehavior,routeToUrl:h,contextMenu:f,disabledActions:_},D.id))})]})}function Ys({favorites:n,activeRoute:i,onNavigate:a,onRemove:u,collapsed:r=!1,leftClickBehavior:d="focus-existing"}){const{t:o}=j.useNiceTranslation(),p=d==="open-new";return n.length===0?e.jsx("p",{className:"nice-sidebar-nav__empty",children:o("sidebarNav.noFavourites","No favourites yet. Hover an item and click the star to add it.")}):e.jsx("ul",{className:"nice-sidebar-nav__favorites-list",children:n.map(c=>{const t=!!(c.route&&c.route===i);return e.jsxs("li",{className:["nice-sidebar-nav__fav-item",t?"nice-sidebar-nav__fav-item--active":""].filter(Boolean).join(" "),children:[e.jsx(Se,{content:c.tooltip??c.label,position:"right",size:"sm",children:e.jsxs("span",{role:"link",tabIndex:0,className:"nice-sidebar-nav__fav-content",onClick:()=>{c.route&&a?.(c.route,c,{forceNew:p})},onKeyDown:h=>{(h.key==="Enter"||h.key===" ")&&c.route&&a?.(c.route,c,{forceNew:p})},children:[(typeof c.icon=="string"||s.isValidElement(c.icon))&&e.jsx("span",{className:"nice-sidebar-nav__fav-icon","aria-hidden":"true",children:We(c.icon)}),e.jsx("span",{className:"nice-sidebar-nav__fav-label",children:c.label})]})}),!r&&e.jsx(Se,{content:o("sidebarNav.removeFavourite","Remove from favourites"),position:"top",size:"sm",children:e.jsx("button",{className:"nice-sidebar-nav__action-btn nice-sidebar-nav__action-btn--remove","aria-label":o("sidebarNav.removeFavourite","Remove from favourites"),onClick:()=>u(c.id),children:e.jsx(Bn,{size:12})})})]},c.id)})})}function Ks(n){const i=[],a=new Set;for(const u of n){const r=u.source;for(const d of u.modules)for(const o of d.views){const p=`${r.id}::${o.id}`;a.has(p)||(a.add(p),i.push({view:o,breadcrumb:[{id:r.id,label:r.label,icon:r.icon},{id:d.id,label:d.label,icon:d.icon}]}))}for(const d of u.roles)for(const o of d.modules)for(const p of o.views){const c=`${r.id}::${p.id}`;a.has(c)||(a.add(c),i.push({view:p,breadcrumb:[{id:r.id,label:r.label,icon:r.icon},{id:d.id,label:d.label,icon:d.icon},{id:o.id,label:o.label,icon:o.icon}]}))}for(const d of u.units)for(const o of d.modules)for(const p of o.views){const c=`${r.id}::${p.id}`;a.has(c)||(a.add(c),i.push({view:p,breadcrumb:[{id:r.id,label:r.label,icon:r.icon},{id:d.id,label:d.label,icon:d.icon},{id:o.id,label:o.label,icon:o.icon}]}))}}return i}function Vs({data:n,activeRoute:i,onNavigate:a,hiddenIds:u,leftClickBehavior:r="focus-existing"}){const{t:d}=j.useNiceTranslation(),[o,p]=s.useState(""),c=r==="open-new",t=s.useMemo(()=>Ks(n),[n]),h=s.useMemo(()=>{const f=o.trim().toLowerCase();return f?t.filter(_=>u.has(_.view.id)?!1:_.view.label.toLowerCase().includes(f)?!0:_.breadcrumb.some(v=>v.label.toLowerCase().includes(f))):[]},[t,o,u]);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:d("sidebarNav.search.placeholder","Search views…"),value:o,onChange:f=>p(f.target.value),autoFocus:!0,"aria-label":d("sidebarNav.search.label","Search views")}),o&&e.jsx("button",{type:"button",className:"nice-sidebar-nav__search-clear","aria-label":d("common.clear","Clear"),onClick:()=>p(""),children:e.jsx(Bn,{size:12})})]}),!o.trim()&&e.jsx("p",{className:"nice-sidebar-nav__empty",children:d("sidebarNav.searchHint","Type to search every view available in the panel.")}),o.trim()&&h.length===0&&e.jsxs("p",{className:"nice-sidebar-nav__empty",children:[d("sidebarNav.noResults","No results for")," “",o,"”."]}),h.length>0&&e.jsx("ul",{className:"nice-sidebar-nav__search-results",children:h.map((f,_)=>{const v=!!(f.view.route&&f.view.route===i),w=!!f.view.route;return e.jsx("li",{className:["nice-sidebar-nav__search-result",v?"nice-sidebar-nav__search-result--active":""].filter(Boolean).join(" "),children:e.jsxs("button",{type:"button",className:"nice-sidebar-nav__search-result-btn",disabled:!w,onClick:()=>{w&&f.view.route&&a?.(f.view.route,f.view,{forceNew:c})},children:[e.jsx("span",{className:"nice-sidebar-nav__search-result-breadcrumb",children:f.breadcrumb.map((L,b)=>e.jsxs("span",{className:"nice-sidebar-nav__search-crumb",children:[L.icon&&e.jsx("span",{className:"nice-sidebar-nav__search-crumb-icon","aria-hidden":"true",children:We(L.icon)}),e.jsx("span",{className:"nice-sidebar-nav__search-crumb-label",children:L.label}),e.jsx("span",{className:"nice-sidebar-nav__search-crumb-sep","aria-hidden":"true",children:"›"})]},`${L.id}-${b}`))}),e.jsxs("span",{className:"nice-sidebar-nav__search-result-view",children:[f.view.icon&&e.jsx("span",{className:"nice-sidebar-nav__node-icon","aria-hidden":"true",children:We(f.view.icon)}),e.jsx("span",{className:"nice-sidebar-nav__node-label",children:f.view.label}),f.view.badge!==void 0&&e.jsx("span",{className:"nice-sidebar-nav__node-badge",children:f.view.badge})]})]})},`${f.view.id}-${_}`)})})]})}function qs({activeRoute:n,onNavigate:i,leftClickBehavior:a="focus-existing"}){const{t:u}=j.useNiceTranslation(),r=a==="open-new";return e.jsx("ul",{className:"nice-sidebar-nav__prefs-categories",role:"list",children:on.map(d=>{const o=u(d.labelKey,d.labelDefault),p=n===d.route,c={id:d.id,label:o,icon:d.icon,route:d.route};return e.jsx("li",{className:["nice-sidebar-nav__node nice-sidebar-nav__node--leaf",p?"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(Se,{content:o,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:()=>i?.(d.route,c,{forceNew:r}),onKeyDown:t=>{(t.key==="Enter"||t.key===" ")&&(t.preventDefault(),i?.(d.route,c,{forceNew:r}))},children:[e.jsx("span",{className:"nice-sidebar-nav__node-icon","aria-hidden":"true",children:d.icon}),e.jsx("span",{className:"nice-sidebar-nav__node-label",children:o})]})})]})},d.id)})})}const Gs=s.forwardRef(function({data:i,userId:a,activeRoute:u,onNavigate:r,enableModeIcons:d,preferences:o,onPreferencesChange:p,width:c=264,collapsedWidth:t=56,position:h="left",minimal:f=!1,showModeStrip:_,showSources:v,showFavorites:w,showFooterPreferences:L,sticky:b=!0,surfaceOpacity:R,embedded:T=!1,header:y,footerExtra:x,collapsed:k,onCollapsedChange:I,expandableWhenCollapsed:E=!1,size:C="md",className:N,routeToUrl:M,contextMenu:z=!0,disabledContextMenuActions:D,readonly:l=!1,"data-testid":m},S){const{t:K}=j.useNiceTranslation(),B=s.useMemo(()=>{const ne=new Set(D??[]);return l&&["hide","reorder","rename","newGroup"].forEach(A=>ne.add(A)),ne},[D,l]),O=_??!f,$=v??!f,J=w??!f,Y=L??!f,[Z,Q]=s.useState(!1),F=T?!1:k??Z,q=s.useCallback(()=>{const ne=!F;I?I(ne):Q(ne)},[F,I]),[U,ie]=An(a,d,o,p),xe=s.useMemo(()=>{const ne=U.activeMode;if(ne==="favorites"||ne==="preferences"||ne==="search")return i;const A=U.pinnedSources[ne];return!A||A.length===0?i:i.filter(V=>A.includes(V.source.id))},[i,U.activeMode,U.pinnedSources]),P=U.maxDepth[U.activeMode]??4;function Ne(){const ne=U.activeMode;if(J&&ne==="favorites")return e.jsx(Ys,{favorites:U.favorites,activeRoute:u,onNavigate:r,onRemove:ie.removeFavorite,collapsed:F,leftClickBehavior:U.leftClickBehavior});if(Y&&ne==="preferences")return e.jsx(qs,{activeRoute:u,onNavigate:r,leftClickBehavior:U.leftClickBehavior});if(O&&ne==="search"){const A=new Set(U.hiddenItems.map(V=>V.id));return e.jsx(Vs,{data:i,activeRoute:u,onNavigate:r,hiddenIds:A,leftClickBehavior:U.leftClickBehavior})}return xe.length===0?e.jsx("p",{className:"nice-sidebar-nav__empty",children:K("sidebarNav.noSources","No data sources are visible in this mode.")}):xe.map(A=>{const V=(U.pinnedSources[ne]??[]).includes(A.source.id);return e.jsx(Ws,{node:A,mode:ne,maxDepth:P,isPinned:V,prefs:U,helpers:ie,activeRoute:u,onNavigate:r,sidebarCollapsed:F,expandableWhenCollapsed:E,routeToUrl:M,contextMenu:z,disabledActions:B,showHeader:$},A.source.id)})}const ce=["nice-sidebar-nav",`nice-sidebar-nav--${C}`,`nice-sidebar-nav--${h}`,f?"nice-sidebar-nav--minimal":"",T?"nice-sidebar-nav--embedded":"",b&&!T?"nice-sidebar-nav--sticky":"",U.enableModeIcons&&O?"nice-sidebar-nav--with-strip":"",F?"nice-sidebar-nav--collapsed":"",F&&E?"nice-sidebar-nav--expandable-collapsed":"",N].filter(Boolean).join(" "),ae=R!=null?{"--nice-sidebar-surface-alpha":String(R)}:{},le=T?{width:"100%",...ae}:{"--nice-sidebar-w":`${c}px`,"--nice-sidebar-w-collapsed":`${t}px`,width:F?t:c,...ae};return e.jsxs("div",{ref:S,className:ce,style:le,"data-testid":m,"data-mode":U.activeMode,children:[y!=null&&e.jsx("div",{className:"nice-sidebar-nav__header",children:y}),U.enableModeIcons&&O&&e.jsx(Rs,{enabledModes:U.enabledModes,activeMode:U.activeMode,onSelect:ie.setMode,collapsed:F}),e.jsx("div",{className:"nice-sidebar-nav__content",children:e.jsx("div",{className:"nice-sidebar-nav__body",children:Ne()})}),!T&&e.jsxs("div",{className:"nice-sidebar-nav__footer",children:[e.jsxs("button",{type:"button",className:"nice-sidebar-nav__footer-toggle",onClick:q,"aria-label":F?K("sidebarNav.expand","Expand the sidebar"):K("sidebarNav.collapseToIcons","Collapse to icons"),title:F?K("sidebarNav.expand","Expand the sidebar"):K("sidebarNav.collapseToIcons","Collapse to icons"),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:(h==="right"?!F:F)?"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:F?K("sidebarNav.expandShort","Expand"):K("sidebarNav.collapseToIcons","Collapse to icons")})]}),x!=null&&e.jsx("div",{className:"nice-sidebar-nav__footer-extra",children:x})]}),T&&x!=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:x})})]})}),Hn=s.forwardRef(({user:n,userMenuItems:i,onProfile:a,onLogout:u,showLogin:r=!0,loginLabel:d,onLoginClick:o,showRegister:p,registerLabel:c,onRegisterClick:t,size:h="md",compact:f=!1,className:_,style:v,id:w,"data-testid":L="nice-auth-buttons"},b)=>{const{t:R}=j.useNiceTranslation(),T=["nice-auth-buttons",`nice-auth-buttons--${h}`,f?"nice-auth-buttons--compact":"",_??""].filter(Boolean).join(" ");if(n)return e.jsx("div",{ref:b,id:w,className:T,style:v,"data-testid":L,children:e.jsx(rn,{userName:n.name,userEmail:n.email,userRole:n.role,avatarUrl:n.avatarUrl,status:n.status,items:i,onProfile:a,onLogout:u,size:h})});const y=p??!!t;return e.jsxs("div",{ref:b,id:w,className:T,style:v,"data-testid":L,children:[r&&o&&e.jsx(Ae.NiceButton,{variant:"ghost",size:h,onClick:o,className:"nice-auth-buttons__login",children:d??R("auth.signIn","Sign in")}),y&&t&&e.jsx(Ae.NiceButton,{variant:"primary",size:h,onClick:t,className:"nice-auth-buttons__register",children:c??R("auth.register","Register")})]})});Hn.displayName="NiceAuthButtons";function hn(n){return!n.children||n.children.length===0}function Un(n,i){return i?n.id===i?!0:(n.children??[]).some(a=>Un(a,i)):!1}const Wn=s.forwardRef(({items:n,activeId:i,size:a="md",align:u="start",ariaLabel:r,stretch:d=!1,trigger:o="click",hoverCloseDelay:p=150,className:c,style:t,id:h,"data-testid":f="nice-nav-menu"},_)=>{const{t:v}=j.useNiceTranslation(),w=s.useId(),[L,b]=s.useState(null),R=s.useRef(null),T=s.useRef(null),y=s.useCallback(()=>{T.current&&(clearTimeout(T.current),T.current=null)},[]),x=s.useCallback(()=>{y(),T.current=setTimeout(()=>{b(null),T.current=null},p)},[y,p]);s.useEffect(()=>()=>y(),[y]);const k=o==="hover",I=m=>!!(m.megaPanel||m.megaColumns&&m.megaColumns.length>0),E=s.useCallback(m=>{R.current=m,typeof _=="function"?_(m):_&&(_.current=m)},[_]);s.useEffect(()=>{if(!L)return;const m=S=>{R.current?.contains(S.target)||b(null)};return document.addEventListener("mousedown",m),()=>document.removeEventListener("mousedown",m)},[L]),s.useEffect(()=>{const m=S=>{S.key==="Escape"&&L&&b(null)};return document.addEventListener("keydown",m),()=>document.removeEventListener("keydown",m)},[L]);const C=s.useMemo(()=>n.filter(m=>!m.divider),[n]),N=(m,S)=>{const K=!hn(m),B=I(m),O=K||B,$=L?.itemId===m.id,Y=["nice-nav-menu__item",Un(m,i)?"nice-nav-menu__item--active":"",$?"nice-nav-menu__item--open":"",m.disabled?"nice-nav-menu__item--disabled":"",B?"nice-nav-menu__item--mega":""].filter(Boolean).join(" "),Z=F=>{if(F.key==="ArrowRight"){F.preventDefault();const q=C[(S+1)%C.length];R.current?.querySelector(`[data-nice-nav-id="${q.id}"]`)?.focus()}else if(F.key==="ArrowLeft"){F.preventDefault();const q=C[(S-1+C.length)%C.length];R.current?.querySelector(`[data-nice-nav-id="${q.id}"]`)?.focus()}else(F.key==="ArrowDown"||F.key==="Enter"||F.key===" ")&&O&&(F.preventDefault(),b({itemId:m.id,submenuId:null}))},Q=e.jsxs(e.Fragment,{children:[m.icon!=null&&e.jsx("span",{className:"nice-nav-menu__item-icon","aria-hidden":"true",children:m.icon}),e.jsx("span",{className:"nice-nav-menu__item-label",children:m.label}),m.badge!=null&&e.jsx("span",{className:"nice-nav-menu__item-badge",children:m.badge}),O&&e.jsx("span",{className:"nice-nav-menu__item-chevron","aria-hidden":"true",children:e.jsx(j.NiceIcon,{name:"chevron-down",size:14})})]});return O?e.jsxs("li",{className:`nice-nav-menu__li${B?" nice-nav-menu__li--mega":""}`,onMouseEnter:k?()=>{y(),b({itemId:m.id,submenuId:null})}:void 0,onMouseLeave:k?x:void 0,children:[e.jsx("button",{type:"button",className:Y,"data-nice-nav-id":m.id,"aria-haspopup":B?"true":"menu","aria-expanded":$,"aria-controls":`${w}-panel-${m.id}`,disabled:m.disabled,onClick:()=>{b(k?F=>F?.itemId===m.id?null:{itemId:m.id,submenuId:null}:F=>F?.itemId===m.id?null:{itemId:m.id,submenuId:null})},onKeyDown:Z,children:Q}),$&&(B?M(m):z(m))]},m.id):m.href&&!m.disabled?e.jsx("li",{className:"nice-nav-menu__li",children:e.jsx("a",{href:m.href,target:m.target,rel:m.rel,className:Y,"data-nice-nav-id":m.id,onKeyDown:Z,onClick:F=>{m.onClick?.(F),b(null)},children:Q})},m.id):e.jsx("li",{className:"nice-nav-menu__li",children:e.jsx("button",{type:"button",className:Y,"data-nice-nav-id":m.id,disabled:m.disabled,onClick:F=>{m.onClick?.(F),b(null)},onKeyDown:Z,children:Q})},m.id)},M=m=>{const S=`${w}-panel-${m.id}`,K=typeof m.megaPanel=="function"?m.megaPanel():m.megaPanel;return e.jsx("div",{id:S,role:"menu","aria-label":typeof m.label=="string"?m.label:void 0,className:"nice-nav-menu__mega",onMouseEnter:k?y:void 0,onMouseLeave:k?x:void 0,children:e.jsxs("div",{className:"nice-nav-menu__mega-inner",children:[K??e.jsx("div",{className:"nice-nav-menu__mega-grid",children:(m.megaColumns??[]).map((B,O)=>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($=>e.jsx("li",{className:"nice-nav-menu__mega-col-li",children:$.href?e.jsxs("a",{role:"menuitem",className:"nice-nav-menu__mega-col-item",href:$.href,target:$.target,rel:$.rel,onClick:J=>{$.onClick?.(J),b(null)},children:[$.icon!=null&&e.jsx("span",{className:"nice-nav-menu__mega-col-item-icon","aria-hidden":"true",children:$.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:$.label}),$.description&&e.jsx("span",{className:"nice-nav-menu__mega-col-item-desc",children:$.description})]})]}):e.jsxs("button",{type:"button",role:"menuitem",className:"nice-nav-menu__mega-col-item",disabled:$.disabled,onClick:J=>{$.onClick?.(J),b(null)},children:[$.icon!=null&&e.jsx("span",{className:"nice-nav-menu__mega-col-item-icon","aria-hidden":"true",children:$.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:$.label}),$.description&&e.jsx("span",{className:"nice-nav-menu__mega-col-item-desc",children:$.description})]})]})},$.id))}),B.footer!=null&&e.jsx("div",{className:"nice-nav-menu__mega-col-footer",children:B.footer})]},O))}),m.megaFooter!=null&&e.jsx("div",{className:"nice-nav-menu__mega-footer",children:m.megaFooter})]})})},z=m=>{const S=m.children??[],K=`${w}-panel-${m.id}`,B=u==="end"?"nice-nav-menu__panel--end":"nice-nav-menu__panel--start";return e.jsx("div",{id:K,role:"menu","aria-label":typeof m.label=="string"?m.label:void 0,className:`nice-nav-menu__panel ${B}`,children:e.jsx("ul",{className:"nice-nav-menu__panel-list",children:S.map((O,$)=>D(m.id,O,$,S))})})},D=(m,S,K,B)=>{if(S.divider)return e.jsx("li",{className:"nice-nav-menu__panel-divider",role:"separator"},`div-${K}`);const O=!hn(S),$=L?.itemId===m&&L.submenuId===S.id,J=["nice-nav-menu__panel-item",S.disabled?"nice-nav-menu__panel-item--disabled":"",S.danger?"nice-nav-menu__panel-item--danger":"",$?"nice-nav-menu__panel-item--open":"",S.id===i?"nice-nav-menu__panel-item--active":""].filter(Boolean).join(" "),Y=q=>{const U=B.filter(P=>!P.divider&&!P.disabled),ie=U.findIndex(P=>P.id===S.id);if(ie===-1)return;const xe=U[(ie+q+U.length)%U.length];R.current?.querySelector(`[data-nice-panel-id="${m}-${xe.id}"]`)?.focus()},Z=q=>{q.key==="ArrowDown"?(q.preventDefault(),Y(1)):q.key==="ArrowUp"?(q.preventDefault(),Y(-1)):q.key==="ArrowRight"&&O?(q.preventDefault(),b({itemId:m,submenuId:S.id})):q.key==="ArrowLeft"&&(q.preventDefault(),L?.submenuId?b({itemId:m,submenuId:null}):(b(null),R.current?.querySelector(`[data-nice-nav-id="${m}"]`)?.focus()))},Q=e.jsxs(e.Fragment,{children:[S.icon!=null&&e.jsx("span",{className:"nice-nav-menu__panel-item-icon","aria-hidden":"true",children:S.icon}),e.jsxs("span",{className:"nice-nav-menu__panel-item-text",children:[e.jsx("span",{className:"nice-nav-menu__panel-item-label",children:S.label}),S.description&&e.jsx("span",{className:"nice-nav-menu__panel-item-desc",children:S.description})]}),S.badge!=null&&e.jsx("span",{className:"nice-nav-menu__panel-item-badge",children:S.badge}),O&&e.jsx("span",{className:"nice-nav-menu__panel-item-chevron","aria-hidden":"true",children:e.jsx(j.NiceIcon,{name:"chevron-right",size:14})})]}),F=O?e.jsx("button",{type:"button",role:"menuitem",className:J,"data-nice-panel-id":`${m}-${S.id}`,"aria-haspopup":"menu","aria-expanded":$,disabled:S.disabled,onClick:()=>b(q=>q?.itemId===m&&q.submenuId===S.id?{itemId:m,submenuId:null}:{itemId:m,submenuId:S.id}),onMouseEnter:()=>b({itemId:m,submenuId:S.id}),onKeyDown:Z,children:Q}):S.href&&!S.disabled?e.jsx("a",{role:"menuitem",className:J,"data-nice-panel-id":`${m}-${S.id}`,href:S.href,target:S.target,rel:S.rel,onMouseEnter:()=>b({itemId:m,submenuId:null}),onClick:q=>{S.onClick?.(q),b(null)},onKeyDown:Z,children:Q}):e.jsx("button",{type:"button",role:"menuitem",className:J,"data-nice-panel-id":`${m}-${S.id}`,disabled:S.disabled,onMouseEnter:()=>b({itemId:m,submenuId:null}),onClick:q=>{S.onClick?.(q),b(null)},onKeyDown:Z,children:Q});return e.jsxs("li",{className:"nice-nav-menu__panel-li",children:[F,O&&$&&l(m,S)]},S.id)},l=(m,S)=>{const K=S.children??[];return e.jsxs("div",{role:"menu","aria-label":typeof S.label=="string"?S.label:void 0,className:"nice-nav-menu__subpanel",children:[e.jsx("ul",{className:"nice-nav-menu__panel-list",children:K.map((B,O)=>{if(B.divider)return e.jsx("li",{className:"nice-nav-menu__panel-divider",role:"separator"},`subdiv-${O}`);const $=["nice-nav-menu__panel-item",B.disabled?"nice-nav-menu__panel-item--disabled":"",B.danger?"nice-nav-menu__panel-item--danger":"",B.id===i?"nice-nav-menu__panel-item--active":""].filter(Boolean).join(" "),J=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:$,href:B.href,target:B.target,rel:B.rel,onClick:Y=>{B.onClick?.(Y),b(null)},children:J}):e.jsx("button",{type:"button",role:"menuitem",className:$,disabled:B.disabled,onClick:Y=>{B.onClick?.(Y),b(null)},children:J})},B.id)})}),e.jsx("span",{hidden:!0,"data-parent-id":m})]})};return e.jsx("nav",{ref:E,id:h,className:["nice-nav-menu",`nice-nav-menu--${a}`,d?"nice-nav-menu--stretch":"",c??""].filter(Boolean).join(" "),style:t,"aria-label":r??v("nav.primary","Primary navigation"),"data-testid":f,children:e.jsx("ul",{className:"nice-nav-menu__list",children:C.map(N)})})});Wn.displayName="NiceNavMenu";const Yn=s.forwardRef(({tabs:n,activeIndex:i,defaultActiveIndex:a,renderTab:u,onActiveChange:r,onCloseTab:d,onReorderTabs:o,onSaveState:p,enableShortcuts:c=!0,maxTabs:t=0,showDirtyIndicator:h=!0,tabBarPosition:f="top",draggable:_=!0,showAddButton:v=!1,onAddTab:w,keepAlive:L=!0,warnOnUnsavedClose:b=!0,maxClosedTabs:R=10,onUndoCloseTab:T,getTabState:y,unsavedWarningMessage:x,className:k,style:I,id:E,accessMode:C,...N},M)=>{const z=j.useControlId(E),D=j.useNiceAccessMode(C,E),{t:l}=j.useNiceTranslation(),[m,S]=j.useControllableState({value:i,defaultValue:a,fallbackValue:0,onChange:r,componentName:"NiceMdiWorkspace"}),K=s.useRef(null),[B,O]=s.useState(null),[$,J]=s.useState(null),[Y,Z]=s.useState([]),[Q,F]=s.useState(null),q=s.useCallback((A,V,oe=!1)=>{if(!oe&&b&&A.isDirty){F({tab:A,index:V});return}const _e={tab:{...A},originalIndex:V,closedAt:Date.now(),state:y?.(A)};Z(ye=>[_e,...ye].slice(0,R)),d?.(A,V)},[b,R,y,d]),U=s.useCallback(()=>{if(Y.length===0)return;const[A,...V]=Y;Z(V),T?.(A)},[Y,T]);s.useEffect(()=>{if(!c)return;const A=V=>{const oe=V.ctrlKey||V.metaKey;if(oe&&V.key==="w"){V.preventDefault();const _e=n[m];_e&&_e.closable!==!1&&q(_e,m)}else if(oe&&V.key==="Tab"){V.preventDefault();const _e=V.shiftKey?-1:1,ye=(m+_e+n.length)%n.length;S(ye)}else oe&&V.shiftKey&&(V.key==="t"||V.key==="T")&&(V.preventDefault(),U())};return window.addEventListener("keydown",A),()=>window.removeEventListener("keydown",A)},[c,n,m,q,U,S]),s.useEffect(()=>{if(!p)return;const A=setTimeout(()=>{p({tabs:n,activeTabIndex:m})},500);return()=>clearTimeout(A)},[n,m,p]);const ie=s.useCallback(A=>{_&&J(A)},[_]),xe=s.useCallback((A,V)=>{A.preventDefault()},[$]),P=s.useCallback(A=>{if($===null||$===A)return;const V=[...n],[oe]=V.splice($,1);V.splice(A,0,oe),o?.(V),J(null);let _e=m;m===$?_e=A:$<m&&A>=m?_e--:$>m&&A<=m&&_e++,_e!==m&&S(_e)},[$,n,m,o,S]),Ne=s.useCallback((A,V)=>{A.preventDefault(),O({tabIndex:V,x:A.clientX,y:A.clientY})},[]),ce=s.useCallback(()=>O(null),[]),ae=s.useMemo(()=>{if(!B)return[];const A=n[B.tabIndex];return[{label:l("wm.close","Close"),action:()=>{q(A,B.tabIndex),ce()},disabled:A.closable===!1},{label:l("wm.closeAll","Close all"),action:()=>{n.forEach((V,oe)=>V.closable!==!1&&q(V,oe)),ce()}},{label:l("wm.closeOthers","Close others"),action:()=>{n.forEach((V,oe)=>oe!==B.tabIndex&&V.closable!==!1&&q(V,oe)),ce()}},{label:l("controls.pin","Pin"),action:()=>ce()},{type:"divider"},{label:l("wm.reopenClosed","Reopen closed tab"),action:()=>{U(),ce()},disabled:Y.length===0,shortcut:"Ctrl+Shift+T"}]},[B,n,l,q,U,Y.length,ce]);if(s.useEffect(()=>{if(!B)return;const A=()=>ce();return window.addEventListener("click",A),()=>window.removeEventListener("click",A)},[B,ce]),D==="hidden")return null;const le=e.jsxs("div",{className:`nice-mdi__tab-bar nice-mdi__tab-bar--${f}`,role:"tablist",children:[n.map((A,V)=>e.jsxs("div",{className:`nice-mdi__tab ${V===m?"nice-mdi__tab--active":""} ${A.isPinned?"nice-mdi__tab--pinned":""}`,role:"tab","aria-selected":V===m,onClick:()=>S(V),onContextMenu:oe=>Ne(oe,V),draggable:_,onDragStart:()=>ie(V),onDragOver:oe=>xe(oe,V),onDrop:()=>P(V),children:[A.icon&&e.jsx("span",{className:"nice-mdi__tab-icon",children:A.icon}),e.jsx("span",{className:"nice-mdi__tab-title",children:A.title}),h&&A.isDirty&&e.jsx("span",{className:"nice-mdi__tab-dirty",title:l("wm.unsaved","Unsaved changes"),children:e.jsx(j.NiceIcon,{name:"circle",size:10})}),A.closable!==!1&&!A.isPinned&&e.jsx("button",{className:"nice-mdi__tab-close",onClick:oe=>{oe.stopPropagation(),q(A,V)},"aria-label":l("wm.close","Close"),type:"button",children:e.jsx(j.NiceIcon,{name:"close",size:14})})]},A.id)),v&&e.jsx("button",{className:"nice-mdi__tab-add",onClick:w,"aria-label":l("controls.new","New"),type:"button",children:e.jsx(j.NiceIcon,{name:"plus",size:14})})]}),ne=L?e.jsx("div",{className:"nice-mdi__content",children:n.map((A,V)=>e.jsx("div",{className:"nice-mdi__panel",role:"tabpanel",style:{display:V===m?"block":"none"},children:u(A,V)},A.id))}):e.jsx("div",{className:"nice-mdi__content",children:n[m]&&e.jsx("div",{className:"nice-mdi__panel",role:"tabpanel",children:u(n[m],m)})});return e.jsxs("div",{ref:A=>{K.current=A,typeof M=="function"?M(A):M&&(M.current=A)},id:z,className:`nice-mdi ${k??""}`,style:I,...N,children:[f==="top"&&le,ne,f==="bottom"&&le,B&&e.jsx("div",{className:"nice-mdi__ctx-menu",style:{position:"fixed",left:B.x,top:B.y,zIndex:9999},children:ae.map((A,V)=>"type"in A&&A.type==="divider"?e.jsx("div",{className:"nice-mdi__ctx-divider"},V):e.jsxs("button",{className:"nice-mdi__ctx-item",onClick:A.action,disabled:A.disabled,type:"button",children:[e.jsx("span",{className:"nice-mdi__ctx-label",children:A.label}),"shortcut"in A&&A.shortcut&&e.jsx("span",{className:"nice-mdi__ctx-shortcut",children:A.shortcut})]},V))}),Q&&e.jsx("div",{className:"nice-mdi__modal-backdrop",onClick:()=>F(null),children:e.jsxs("div",{className:"nice-mdi__modal",onClick:A=>A.stopPropagation(),children:[e.jsx("div",{className:"nice-mdi__modal-icon",children:e.jsx(j.NiceIcon,{name:"warning",size:32})}),e.jsx("h3",{className:"nice-mdi__modal-title",children:l("wm.unsavedTitle","Unsaved Changes")}),e.jsx("p",{className:"nice-mdi__modal-message",children:x??l("wm.unsavedMessage",`"${Q.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:l("controls.cancel","Cancel")}),e.jsx("button",{type:"button",className:"nice-mdi__modal-btn nice-mdi__modal-btn--danger",onClick:()=>{q(Q.tab,Q.index,!0),F(null)},children:l("wm.closeAnyway","Close Anyway")})]})]})})]})});Yn.displayName="NiceMdiWorkspace";const Kn=s.forwardRef(({topBar:n,sidePanel:i,sidePanelPosition:a="left",sidePanelWidth:u=280,children:r,className:d,style:o,id:p,accessMode:c,...t},h)=>{const f=j.useControlId(p);return j.useNiceAccessMode(c,p)==="hidden"?null:e.jsxs("div",{ref:h,id:f,className:`nice-shell nice-shell--dashboard ${d??""}`,style:o,...t,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:[i&&e.jsx("aside",{className:"nice-shell__side-panel",style:{width:u},children:i}),e.jsx("main",{className:"nice-shell__dashboard-content",children:r})]})]})});Kn.displayName="NiceDashboardShell";const Vn=s.forwardRef(({overlay:n,lockScreen:i,locked:a=!1,children:u,className:r,style:d,id:o,accessMode:p,...c},t)=>{const h=j.useControlId(o);return j.useNiceAccessMode(p,o)==="hidden"?null:e.jsx("div",{ref:t,id:h,className:`nice-shell nice-shell--kiosk ${r??""}`,style:{position:"fixed",inset:0,...d},...c,children:a&&i?e.jsx("div",{className:"nice-shell__kiosk-lock",children:i}):e.jsxs(e.Fragment,{children:[e.jsx("main",{className:"nice-shell__kiosk-content",children:u}),n&&e.jsx("div",{className:"nice-shell__kiosk-overlay",children:n})]})})});Vn.displayName="NiceKioskShell";const qn=s.forwardRef(({menu:n,activeRoute:i,tenant:a,topBarActions:u,globalSearch:r,footer:d,onNavigate:o,children:p,className:c,style:t,id:h,accessMode:f,..._},v)=>{const w=j.useControlId(h);return j.useNiceAccessMode(f,h)==="hidden"?null:e.jsxs("div",{ref:v,id:w,className:`nice-shell nice-shell--modern ${c??""}`,style:t,..._,children:[e.jsx("aside",{className:"nice-shell__modern-rail",role:"navigation",children:n?.modules.filter(b=>b.isAvailable).sort((b,R)=>b.order-R.order).map(b=>e.jsx("button",{type:"button",title:b.label,className:"nice-shell__modern-rail-item",onClick:()=>b.entities[0]&&o?.(b.entities[0].route),children:e.jsx("span",{"aria-hidden":!0,children:b.icon??e.jsx(j.NiceIcon,{name:"circle",size:16})})},b.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})]}),r&&e.jsx("div",{className:"nice-shell__modern-search",children:r}),u&&e.jsx("div",{className:"nice-shell__modern-actions",children:u})]}),e.jsx("main",{className:"nice-shell__modern-content","data-active-route":i,children:p}),d&&e.jsx("footer",{className:"nice-shell__modern-footer",children:d})]})]})});qn.displayName="NiceModernShell";const Gn=s.forwardRef(({header:n,tenant:i,maxWidth:a=960,centered:u=!0,children:r,className:d,style:o,id:p,accessMode:c,...t},h)=>{const f=j.useControlId(p);return j.useNiceAccessMode(c,p)==="hidden"?null:e.jsxs("div",{ref:h,id:f,className:`nice-shell nice-shell--minimal ${u?"nice-shell--minimal-centered":""} ${d??""}`,style:o,...t,children:[(n||i)&&e.jsxs("header",{className:"nice-shell__minimal-header",children:[i&&e.jsxs("div",{className:"nice-shell__minimal-tenant",children:[i.logoUrl&&e.jsx("img",{src:i.logoUrl,alt:""}),e.jsx("span",{children:i.name})]}),n]}),e.jsx("main",{className:"nice-shell__minimal-content",style:{maxWidth:a,marginInline:u?"auto":void 0},children:r})]})});Gn.displayName="NiceMinimalShell";const Xn=s.forwardRef(({menu:n,activeRoute:i,tenant:a,toolbar:u,inspector:r,inspectorOpen:d=!0,statusBar:o,onNavigate:p,children:c,className:t,style:h,id:f,accessMode:_,...v},w)=>{const L=j.useControlId(f),b=j.useNiceAccessMode(_,f),[R,T]=s.useState(d);return b==="hidden"?null:e.jsxs("div",{ref:w,id:L,className:`nice-shell nice-shell--hybrid ${t??""}`,style:h,...v,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})]}),u,r&&e.jsx("button",{type:"button",className:"nice-shell__hybrid-inspector-toggle",onClick:()=>T(y=>!y),"aria-pressed":R,"aria-label":"Toggle inspector",children:e.jsx(j.NiceIcon,{name:"settings",size:16})})]}),e.jsxs("div",{className:"nice-shell__hybrid-body",children:[e.jsx("aside",{className:"nice-shell__hybrid-sidebar",role:"navigation",children:n?.modules.filter(y=>y.isAvailable).sort((y,x)=>y.order-x.order).map(y=>e.jsxs("div",{className:"nice-shell__hybrid-nav-group",children:[e.jsx("div",{className:"nice-shell__hybrid-nav-group-label",children:y.label}),e.jsx("ul",{children:y.entities.map(x=>e.jsx("li",{children:e.jsx("button",{type:"button",className:`nice-shell__hybrid-nav-item ${i===x.route?"nice-shell__hybrid-nav-item--active":""}`,onClick:()=>p?.(x.route),children:x.label})},x.id))})]},y.id))}),e.jsx("main",{className:"nice-shell__hybrid-content",children:c}),r&&R&&e.jsx("aside",{className:"nice-shell__hybrid-inspector",children:r})]}),o&&e.jsx("footer",{className:"nice-shell__hybrid-status",children:o})]})});Xn.displayName="NiceHybridShell";const Jn=s.forwardRef(({appTitle:n,tenant:i,topBarActions:a,tabs:u=[],activeTabId:r,onTabChange:d,fab:o,children:p,className:c,style:t,id:h,accessMode:f,..._},v)=>{const w=j.useControlId(h);return j.useNiceAccessMode(f,h)==="hidden"?null:e.jsxs("div",{ref:v,id:w,className:`nice-shell nice-shell--pwa ${c??""}`,style:t,..._,children:[e.jsxs("header",{className:"nice-shell__pwa-topbar",children:[e.jsxs("div",{className:"nice-shell__pwa-title",children:[i?.logoUrl&&e.jsx("img",{src:i.logoUrl,alt:""}),e.jsx("span",{children:i?.name??n??""})]}),a&&e.jsx("div",{className:"nice-shell__pwa-actions",children:a})]}),e.jsx("main",{className:"nice-shell__pwa-content",children:p}),o&&e.jsx("div",{className:"nice-shell__pwa-fab",children:o}),u.length>0&&e.jsx("nav",{className:"nice-shell__pwa-tabs",role:"tablist",children:u.map(b=>e.jsxs("button",{type:"button",role:"tab","aria-selected":r===b.id,className:`nice-shell__pwa-tab ${r===b.id?"nice-shell__pwa-tab--active":""}`,onClick:()=>d?.(b.id,b.route),children:[b.icon&&e.jsx("span",{"aria-hidden":!0,children:b.icon}),e.jsx("span",{children:b.label})]},b.id))})]})});Jn.displayName="NicePwaShell";const Xs=[],Qn=s.forwardRef(({modes:n=Xs,activeMode:i,onModeChange:a,variant:u="dropdown",gridColumns:r=3,showDescription:d=!0,showColorIndicator:o=!0,compact:p=!1,size:c="md",className:t,style:h,id:f,accessMode:_,...v},w)=>{const L=j.useControlId(f),b=j.useNiceAccessMode(_,f),{t:R}=j.useNiceTranslation(),[T,y]=s.useState(!1),x=s.useRef(null),k=n.find(E=>E.key===i);s.useEffect(()=>{if(!T)return;const E=C=>{x.current&&!x.current.contains(C.target)&&y(!1)};return document.addEventListener("mousedown",E),()=>document.removeEventListener("mousedown",E)},[T]);const I=s.useCallback(E=>{a?.(E),y(!1)},[a]);return b==="hidden"?null:u==="dropdown"?e.jsxs("div",{ref:E=>{x.current=E,typeof w=="function"?w(E):w&&(w.current=E)},id:L,className:`nice-mode-selector nice-mode-selector--dropdown nice-mode-selector--${c}${p?" nice-mode-selector--compact":""} ${t??""}`,style:h,...v,children:[e.jsxs("button",{className:"nice-mode-selector__trigger",onClick:()=>y(E=>!E),"aria-expanded":T,"aria-haspopup":"listbox","aria-label":p?k?.displayName??i:void 0,title:p?k?.displayName??i:void 0,type:"button",children:[o&&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}),!p&&e.jsx("span",{className:"nice-mode-selector__label",children:k?.displayName??i}),e.jsx("span",{className:"nice-mode-selector__chevron",children:e.jsx(j.NiceIcon,{name:T?"chevron-up":"chevron-down",size:"xs"})})]}),T&&e.jsx("ul",{className:"nice-mode-selector__menu",role:"listbox",children:n.map(E=>e.jsxs("li",{className:`nice-mode-selector__option ${E.key===i?"nice-mode-selector__option--active":""}`,role:"option","aria-selected":E.key===i,onClick:()=>I(E),children:[o&&E.color&&e.jsx("span",{className:"nice-mode-selector__color",style:{backgroundColor:E.color}}),E.icon&&e.jsx("span",{className:"nice-mode-selector__icon",children:E.icon}),e.jsxs("div",{children:[e.jsx("div",{className:"nice-mode-selector__name",children:E.displayName}),d&&E.description&&e.jsx("div",{className:"nice-mode-selector__desc",children:E.description})]})]},E.key))})]}):u==="pills"?e.jsx("div",{ref:w,id:L,className:`nice-mode-selector nice-mode-selector--pills ${t??""}`,style:h,role:"radiogroup",...v,children:n.map(E=>e.jsxs("button",{className:`nice-mode-selector__pill ${E.key===i?"nice-mode-selector__pill--active":""}`,style:o&&E.color?{borderColor:E.color}:void 0,onClick:()=>I(E),role:"radio","aria-checked":E.key===i,type:"button",children:[E.icon&&e.jsx("span",{children:E.icon}),e.jsx("span",{children:E.displayName})]},E.key))}):e.jsx("div",{ref:w,id:L,className:`nice-mode-selector nice-mode-selector--card-grid ${t??""}`,style:{...h,gridTemplateColumns:`repeat(${r}, 1fr)`},role:"radiogroup",...v,children:n.map(E=>e.jsxs("button",{className:`nice-mode-selector__card ${E.key===i?"nice-mode-selector__card--active":""} ${p?"nice-mode-selector__card--compact":""}`,onClick:()=>I(E),role:"radio","aria-checked":E.key===i,type:"button",children:[o&&E.color&&e.jsx("div",{className:"nice-mode-selector__card-stripe",style:{backgroundColor:E.color}}),E.icon&&e.jsx("div",{className:"nice-mode-selector__card-icon",children:E.icon}),e.jsx("div",{className:"nice-mode-selector__card-name",children:E.displayName}),d&&E.description&&!p&&e.jsx("div",{className:"nice-mode-selector__card-desc",children:E.description}),E.sourcePackage&&!p&&e.jsx("div",{className:"nice-mode-selector__card-pkg",children:E.sourcePackage})]},E.key))})});Qn.displayName="NiceModeSelector";const Js=[{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"}],Qs=[{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"}],pn=["basic","contact","address","branding","localization","fiscal","preferences"],Oe=({title:n,expanded:i,onToggle:a})=>e.jsxs("button",{className:`nice-org-form__section-header ${i?"nice-org-form__section-header--expanded":""}`,onClick:a,type:"button","aria-expanded":i,children:[e.jsx("span",{className:"nice-org-form__section-title",children:n}),e.jsx("span",{className:"nice-org-form__section-chevron",children:e.jsx(j.NiceIcon,{name:i?"chevron-down":"chevron-right",size:14})})]}),Zn=s.forwardRef(({profile:n,onChange:i,onSave:a,onCancel:u,sections:r,expandedSections:d,showActions:o=!0,countryOptions:p,languageOptions:c,currencyOptions:t,timezoneOptions:h,saving:f=!1,className:_,style:v,id:w,accessMode:L,...b},R)=>{const T=j.useControlId(w),y=j.useNiceAccessMode(L,w),{t:x}=j.useNiceTranslation(),k=s.useMemo(()=>r&&r.length>0?r:pn,[r]),[I,E]=s.useState(()=>new Set(d??pn)),C=s.useCallback(l=>{E(m=>{const S=new Set(m);return S.has(l)?S.delete(l):S.add(l),S})},[]),N=y==="readOnly",M=y==="disabled",z=s.useCallback((l,m)=>{i?.({...n,[l]:m})},[n,i]),D=s.useCallback(()=>{a?.(n)},[n,a]);return y==="hidden"?null:e.jsxs("div",{ref:R,id:T,className:`nice-org-form ${_??""}`,style:v,...b,children:[k.includes("basic")&&e.jsxs("div",{className:"nice-org-form__section",children:[e.jsx(Oe,{title:x("org.basic","Company Information"),expanded:I.has("basic"),onToggle:()=>C("basic")}),I.has("basic")&&e.jsxs("div",{className:"nice-org-form__fields",children:[e.jsx(re.NiceTextInput,{label:x("org.name","Company Name"),value:n.name,onChange:l=>z("name",l),required:!0,disabled:M,readOnly:N}),e.jsx(re.NiceTextInput,{label:x("org.legalName","Legal Name"),value:n.legalName??"",onChange:l=>z("legalName",l),disabled:M,readOnly:N}),e.jsx(re.NiceTextInput,{label:x("org.taxId","Tax ID"),value:n.taxId??"",onChange:l=>z("taxId",l),disabled:M,readOnly:N}),e.jsx(re.NiceTextInput,{label:x("org.regNumber","Registration Number"),value:n.registrationNumber??"",onChange:l=>z("registrationNumber",l),disabled:M,readOnly:N}),e.jsx(re.NiceTextInput,{label:x("org.industry","Industry"),value:n.industry??"",onChange:l=>z("industry",l),disabled:M,readOnly:N}),e.jsx(re.NiceNumberInput,{label:x("org.employees","Number of Employees"),value:n.employeeCount??null,onChange:l=>z("employeeCount",l??void 0),min:1,disabled:M,readOnly:N})]})]}),k.includes("contact")&&e.jsxs("div",{className:"nice-org-form__section",children:[e.jsx(Oe,{title:x("org.contact","Contact Details"),expanded:I.has("contact"),onToggle:()=>C("contact")}),I.has("contact")&&e.jsxs("div",{className:"nice-org-form__fields",children:[e.jsx(re.NiceTextInput,{label:x("org.email","Email"),value:n.email??"",onChange:l=>z("email",l),type:"email",disabled:M,readOnly:N}),e.jsx(re.NiceTextInput,{label:x("org.phone","Phone"),value:n.phone??"",onChange:l=>z("phone",l),type:"tel",disabled:M,readOnly:N}),e.jsx(re.NiceTextInput,{label:x("org.website","Website"),value:n.website??"",onChange:l=>z("website",l),type:"url",disabled:M,readOnly:N}),e.jsx(re.NiceTextInput,{label:x("org.fax","Fax"),value:n.fax??"",onChange:l=>z("fax",l),type:"tel",disabled:M,readOnly:N})]})]}),k.includes("address")&&e.jsxs("div",{className:"nice-org-form__section",children:[e.jsx(Oe,{title:x("org.address","Address"),expanded:I.has("address"),onToggle:()=>C("address")}),I.has("address")&&e.jsxs("div",{className:"nice-org-form__fields",children:[e.jsx(re.NiceTextInput,{label:x("org.street","Street"),value:n.street??"",onChange:l=>z("street",l),disabled:M,readOnly:N}),e.jsx(re.NiceTextInput,{label:x("org.city","City"),value:n.city??"",onChange:l=>z("city",l),disabled:M,readOnly:N}),e.jsx(re.NiceTextInput,{label:x("org.state","State / Province"),value:n.state??"",onChange:l=>z("state",l),disabled:M,readOnly:N}),e.jsx(re.NiceTextInput,{label:x("org.postalCode","Postal Code"),value:n.postalCode??"",onChange:l=>z("postalCode",l),disabled:M,readOnly:N}),p?e.jsx(Fe.NiceSelect,{label:x("org.country","Country"),value:n.country??"",onChange:l=>z("country",l),options:p,searchable:!0,disabled:M,readOnly:N}):e.jsx(re.NiceTextInput,{label:x("org.country","Country"),value:n.country??"",onChange:l=>z("country",l),disabled:M,readOnly:N})]})]}),k.includes("branding")&&e.jsxs("div",{className:"nice-org-form__section",children:[e.jsx(Oe,{title:x("org.branding","Branding"),expanded:I.has("branding"),onToggle:()=>C("branding")}),I.has("branding")&&e.jsxs("div",{className:"nice-org-form__fields",children:[e.jsx(re.NiceTextInput,{label:x("org.logoUrl","Logo URL"),value:n.logoUrl??"",onChange:l=>z("logoUrl",l),type:"url",disabled:M,readOnly:N}),e.jsx(Ae.NiceColorPicker,{label:x("org.primaryColor","Primary Color"),value:n.primaryColor??"var(--nice-color-primary, #3b82f6)",onChange:l=>z("primaryColor",l),disabled:M,readOnly:N}),e.jsx(Ae.NiceColorPicker,{label:x("org.secondaryColor","Secondary Color"),value:n.secondaryColor??"var(--nice-color-accent, #8b5cf6)",onChange:l=>z("secondaryColor",l),disabled:M,readOnly:N})]})]}),k.includes("localization")&&e.jsxs("div",{className:"nice-org-form__section",children:[e.jsx(Oe,{title:x("org.localization","Localization"),expanded:I.has("localization"),onToggle:()=>C("localization")}),I.has("localization")&&e.jsxs("div",{className:"nice-org-form__fields",children:[c?e.jsx(Fe.NiceSelect,{label:x("org.language","Default Language"),value:n.defaultLanguage??"",onChange:l=>z("defaultLanguage",l),options:c,searchable:!0,disabled:M,readOnly:N}):e.jsx(re.NiceTextInput,{label:x("org.language","Default Language"),value:n.defaultLanguage??"",onChange:l=>z("defaultLanguage",l),disabled:M,readOnly:N}),t?e.jsx(Fe.NiceSelect,{label:x("org.currency","Default Currency"),value:n.defaultCurrency??"",onChange:l=>z("defaultCurrency",l),options:t,searchable:!0,disabled:M,readOnly:N}):e.jsx(re.NiceTextInput,{label:x("org.currency","Default Currency"),value:n.defaultCurrency??"",onChange:l=>z("defaultCurrency",l),disabled:M,readOnly:N}),h?e.jsx(Fe.NiceSelect,{label:x("org.timezone","Default Timezone"),value:n.defaultTimezone??"",onChange:l=>z("defaultTimezone",l),options:h,searchable:!0,disabled:M,readOnly:N}):e.jsx(re.NiceTextInput,{label:x("org.timezone","Default Timezone"),value:n.defaultTimezone??"",onChange:l=>z("defaultTimezone",l),disabled:M,readOnly:N}),e.jsx(Fe.NiceSelect,{label:x("org.dateFormat","Date Format"),value:n.dateFormat??"YYYY-MM-DD",onChange:l=>z("dateFormat",l),options:Qs,disabled:M,readOnly:N})]})]}),k.includes("fiscal")&&e.jsxs("div",{className:"nice-org-form__section",children:[e.jsx(Oe,{title:x("org.fiscal","Fiscal Settings"),expanded:I.has("fiscal"),onToggle:()=>C("fiscal")}),I.has("fiscal")&&e.jsxs("div",{className:"nice-org-form__fields",children:[e.jsx(re.NiceTextInput,{label:x("org.fiscalYearStart","Fiscal Year Start"),value:n.fiscalYearStart??"",onChange:l=>z("fiscalYearStart",l),placeholder:"MM-DD",disabled:M,readOnly:N}),e.jsx(re.NiceToggle,{label:x("org.vatEnabled","VAT Enabled"),checked:n.vatEnabled??!1,onChange:l=>z("vatEnabled",l),disabled:M||N}),n.vatEnabled&&e.jsx(re.NiceNumberInput,{label:x("org.defaultVatRate","Default VAT Rate (%)"),value:n.defaultVatRate??null,onChange:l=>z("defaultVatRate",l??void 0),min:0,max:100,step:.5,disabled:M,readOnly:N})]})]}),k.includes("preferences")&&e.jsxs("div",{className:"nice-org-form__section",children:[e.jsx(Oe,{title:x("org.preferences","Work Preferences"),expanded:I.has("preferences"),onToggle:()=>C("preferences")}),I.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:Js.map(l=>e.jsx(re.NiceCheckbox,{label:l.label,checked:(n.workingDays??["Mon","Tue","Wed","Thu","Fri"]).includes(l.key),onChange:m=>{const S=n.workingDays??["Mon","Tue","Wed","Thu","Fri"],K=m?[...S,l.key]:S.filter(B=>B!==l.key);z("workingDays",K)},disabled:M||N},l.key))})]}),e.jsx(re.NiceTextInput,{label:x("org.workStart","Working Hours Start"),value:n.workingHoursStart??"09:00",onChange:l=>z("workingHoursStart",l),placeholder:"HH:MM",disabled:M,readOnly:N}),e.jsx(re.NiceTextInput,{label:x("org.workEnd","Working Hours End"),value:n.workingHoursEnd??"17:00",onChange:l=>z("workingHoursEnd",l),placeholder:"HH:MM",disabled:M,readOnly:N})]})]}),o&&e.jsxs("div",{className:"nice-org-form__actions",children:[u&&e.jsx(Ae.NiceButton,{variant:"secondary",onClick:u,disabled:f,children:x("cancel","Cancel")}),a&&e.jsx(Ae.NiceButton,{variant:"primary",onClick:D,loading:f,disabled:N||M,children:x("save","Save")})]})]})});Zn.displayName="NiceOrganizationProfileForm";const Zs={available:{color:"var(--nice-text-muted, #6b7280)",icon:"circle"},installed:{color:"var(--nice-color-primary, #3b82f6)",icon:"circle"},active:{color:"var(--nice-color-success, #10b981)",icon:"success"},disabled:{color:"var(--nice-color-warning, #f59e0b)",icon:"minus"},error:{color:"var(--nice-color-error, #ef4444)",icon:"error"},updating:{color:"var(--nice-color-accent, #8b5cf6)",icon:"refresh"}};function ei(n,i){switch(n){case"available":return["install"];case"installed":return["activate",...i?[]:["uninstall"]];case"active":return["deactivate"];case"disabled":return["activate",...i?[]:["uninstall"]];case"error":return["activate",...i?[]:["uninstall"]];case"updating":return[];default:return[]}}const ni=({module:n,onAction:i,onClick:a,showDependencies:u,showAuthor:r,showVersion:d,processing:o,disabled:p,readOnly:c,t,layout:h})=>{const f=Zs[n.status],_=ei(n.status,n.isCore);return e.jsxs("div",{className:`nice-module-card nice-module-card--${h} nice-module-card--${n.status}`,onClick:a,role:a?"button":void 0,tabIndex:a?0:void 0,onKeyDown:a?v=>{(v.key==="Enter"||v.key===" ")&&(v.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.jsx(j.NiceIcon,{name:"box",size:20})}),e.jsxs("div",{className:"nice-module-card__info",children:[e.jsx("div",{className:"nice-module-card__name",children:n.label}),d&&e.jsxs("span",{className:"nice-module-card__version",children:["v",n.version]})]}),e.jsxs("span",{className:"nice-module-card__status",style:{color:f.color},title:n.status,children:[e.jsx(j.NiceIcon,{name:o?"refresh":f.icon,size:14})," ",n.status]})]}),e.jsx("div",{className:"nice-module-card__desc",children:n.description}),e.jsxs("div",{className:"nice-module-card__meta",children:[r&&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:t("module.core","Core")})]}),u&&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:[t("module.deps","Dependencies"),":"]}),n.dependencies.map(v=>e.jsx("span",{className:"nice-module-card__dep-tag",children:v},v))]}),!c&&_.length>0&&e.jsx("div",{className:"nice-module-card__actions",children:_.map(v=>e.jsx(Ae.NiceButton,{size:"sm",variant:v==="uninstall"?"error":v==="activate"?"primary":"secondary",onClick:w=>{w.stopPropagation(),i(v)},disabled:p||o,loading:o,children:t(`module.${v}`,v.charAt(0).toUpperCase()+v.slice(1))},v))})]})},es=s.forwardRef(({modules:n,onAction:i,statusFilter:a,searchable:u=!0,showDependencies:r=!0,showAuthor:d=!0,showVersion:o=!0,processingModules:p,layout:c="list",gridColumns:t=3,onModuleClick:h,className:f,style:_,id:v,accessMode:w,...L},b)=>{const R=j.useControlId(v),T=j.useNiceAccessMode(w,v),{t:y}=j.useNiceTranslation(),[x,k]=s.useState(""),[I,E]=s.useState("all"),C=T==="readOnly",N=T==="disabled",M=s.useMemo(()=>{let l=n;if(a&&a.length>0&&(l=l.filter(m=>a.includes(m.status))),I!=="all"&&(l=l.filter(m=>m.status===I)),x){const m=x.toLowerCase();l=l.filter(S=>S.label.toLowerCase().includes(m)||S.name.toLowerCase().includes(m)||S.description.toLowerCase().includes(m))}return l},[n,a,I,x]),z=s.useMemo(()=>{const l={all:n.length};for(const m of n)l[m.status]=(l[m.status]??0)+1;return l},[n]),D=s.useCallback((l,m)=>{i?.(l,m)},[i]);return T==="hidden"?null:e.jsxs("div",{ref:b,id:R,className:`nice-module-panel ${f??""}`,style:_,...L,children:[e.jsxs("div",{className:"nice-module-panel__toolbar",children:[u&&e.jsx(re.NiceTextInput,{value:x,onChange:k,placeholder:y("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(l=>e.jsxs("button",{className:`nice-module-panel__filter ${I===l?"nice-module-panel__filter--active":""}`,onClick:()=>E(l),role:"tab","aria-selected":I===l,type:"button",children:[y(`module.status.${l}`,l==="all"?"All":l.charAt(0).toUpperCase()+l.slice(1)),e.jsx("span",{className:"nice-module-panel__filter-count",children:z[l]??0})]},l))})]}),e.jsx("div",{className:`nice-module-panel__grid nice-module-panel__grid--${c}`,style:c==="grid"?{gridTemplateColumns:`repeat(${t}, 1fr)`}:void 0,children:M.length===0?e.jsx("div",{className:"nice-module-panel__empty",children:y("module.empty","No modules found")}):M.map(l=>e.jsx(ni,{module:l,onAction:m=>D(l.id,m),onClick:h?()=>h(l):void 0,showDependencies:r,showAuthor:d,showVersion:o,processing:p?.has(l.id)??!1,disabled:N,readOnly:C,t:y,layout:c},l.id))}),e.jsxs("div",{className:"nice-module-panel__summary",children:[y("module.total","Total"),": ",n.length," ·",y("module.status.active","Active"),":"," ",z.active??0," ·",y("module.status.disabled","Disabled"),":"," ",z.disabled??0," ·",y("module.status.error","Error"),":"," ",z.error??0]})]})});es.displayName="NiceModuleLifecyclePanel";exports.DEFAULT_SIDEBAR_PREFS=dn;exports.DesktopContextMenu=$n;exports.DesktopGrid=Sn;exports.DesktopStartMenu=Cn;exports.DesktopSystemTray=wn;exports.DesktopTaskbar=Ze;exports.LANGUAGES=_n;exports.NICE_THEME_PICKER_PRESETS=Je;exports.NiceAccordion=rs;exports.NiceAppLayout=yn;exports.NiceAuthButtons=Hn;exports.NiceBreadcrumb=os;exports.NiceCard=fn;exports.NiceCard$1=as;exports.NiceCardGroupSizeContext=tn;exports.NiceCardRadioContext=an;exports.NiceConsole=In;exports.NiceContextMenu=ln;exports.NiceDashboardLayout=jn;exports.NiceDashboardShell=Kn;exports.NiceDesktop=En;exports.NiceDock=kn;exports.NiceDynamicSidebar=Tn;exports.NiceHybridShell=Xn;exports.NiceKioskShell=Vn;exports.NiceLanguagePicker=nn;exports.NiceMdiWorkspace=Yn;exports.NiceMenu=xn;exports.NiceMinimalShell=Gn;exports.NiceModeSelector=Qn;exports.NiceModernShell=qn;exports.NiceModuleLifecyclePanel=es;exports.NiceNavMenu=Wn;exports.NiceNavbar=Ln;exports.NiceOrganizationProfileForm=Zn;exports.NicePwaShell=Jn;exports.NiceSetupWizard=Dn;exports.NiceSidebarNav=Gs;exports.NiceSplitter=ms;exports.NiceStepper=gn;exports.NiceThemePicker=sn;exports.NiceTooltip=Se;exports.NiceUserMenu=rn;exports.NiceWizard=Mn;exports.PREFS_CATEGORIES=on;exports.SIDEBAR_MODE_META=Ke;exports.buildPrefsCategoryViews=$s;exports.sidebarModeLabel=He;exports.toThemeDescriptor=bn;exports.useSetupWizard=bs;exports.useSidebarNavPrefs=An;
|