@kingsimba/nc-ui 0.1.10 → 0.1.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/styles.css +21 -4
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var _e=Object.defineProperty;var Ue=(e,t,n)=>t in e?_e(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var O=(e,t,n)=>Ue(e,typeof t!="symbol"?t+"":t,n);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),u=require("react"),ae=require("react-dom"),q=require("react-i18next"),W=require("./GeneratedIcons-CGjL38ny.cjs"),Xe=require("i18next"),Je=require("./clsx-C11secjj.cjs");function me({size:e="default",color:t,overlay:n=!1,className:s=""}){const o=r.jsx("svg",{className:`nc-activity-indicator nc-${e} ${s}`,viewBox:"0 0 50 50",style:t?{color:t}:void 0,children:r.jsx("circle",{className:"nc-activity-indicator-circle",cx:"25",cy:"25",r:"20",fill:"none",stroke:"currentColor",strokeWidth:"5",strokeLinecap:"round"})});return n?r.jsx("div",{className:"nc-activity-indicator-overlay",children:o}):o}function H({variant:e="default",block:t,size:n="default",className:s,disabled:o,textSelectable:i,loading:l,onClick:c,children:d,...f}){const m=["nc-button",e!=="default"?`nc-${e}`:"",t?"nc-block":"",n==="small"?"nc-small":"",n==="large"?"nc-large":"",o||l?"nc-disabled":"",i?"nc-text-selectable":"",l?"nc-loading":"",s??""].filter(Boolean).join(" "),w=a=>{if(!l){if(i){const p=window.getSelection();if(p&&p.toString().length>0)return}c==null||c(a)}};return r.jsxs("button",{className:m,disabled:o||l,onClick:w,...f,children:[l&&r.jsx(me,{size:"small",className:"nc-button-spinner",color:e!=="default"&&e!=="ghost"?"white":void 0}),d]})}function Qe({code:e,text:t,type:n,button:s,onAction:o}){return r.jsxs("div",{className:`nc-alert nc-${n}`,children:[r.jsxs("span",{className:`nc-alert-message nc-${n}`,children:[r.jsx("span",{className:"nc-alert-code",children:e}),t]}),s&&r.jsx("span",{className:"nc-alert-action",children:r.jsx(H,{size:"small",variant:s.variant??(n==="error"?"danger":"warning"),onClick:o,children:s.text})})]})}function Ze({percentage:e=.5,status:t="discharging",darkMode:n=!1,colored:s=!1}){const o=Math.max(0,Math.min(1,Number(e)||0));let i;s?o<.1?i="var(--nc-danger)":o<.2?i="var(--nc-warning)":i="var(--nc-success)":i=n?"#ffffff":"#000000";const l=n?"rgba(255, 255, 255, 0.5)":"rgba(0, 0, 0, 0.2)",c=24,d=14,f=2,m=0,w=12,a=0,p=0,g=0,v=c,h=d,y=h-a*2,j=v-a*2,R=Math.max(1,Math.min(4,h/4)),b=o===0?0:.05+o*.95,C=c+f+w,$=20,x=.65,S=Math.max(d,$*x),k=c+f+1,E=(d-$*x)/2;return r.jsxs("svg",{className:"nc-battery",width:C,height:S,viewBox:`0 0 ${C} ${S}`,role:"img","aria-label":`Battery ${o===0?"-":Math.round(o*100)+"%"} ${t}`,children:[r.jsxs("defs",{children:[r.jsx("mask",{id:`nc-battery-fill-mask-${o}`,children:r.jsx("rect",{x:"0",y:"0",width:j*b,height:y,fill:"white"})}),r.jsxs("mask",{id:`nc-battery-text-mask-${o}`,children:[r.jsx("rect",{x:"0",y:"0",width:C,height:S,fill:"white"}),r.jsx("text",{x:p+v/2,y:d-3,fontSize:11,fontWeight:"bold",fill:"black",textAnchor:"middle",children:o===0?"-":Math.round(o*100)})]})]}),r.jsxs("g",{mask:`url(#nc-battery-text-mask-${o})`,children:[r.jsx("rect",{x:p,y:g,rx:R,ry:R,width:v,height:h,fill:l}),r.jsx("rect",{x:p+a,y:g+a,width:j,height:y,fill:i,rx:R,ry:R,mask:`url(#nc-battery-fill-mask-${o})`}),r.jsx("rect",{x:c+m,y:d*.26,width:f,height:d*.48,rx:.8,ry:.8,fill:o===1?i:l}),t==="charging"?r.jsx("g",{transform:`translate(${k}, ${E}) scale(${x})`,fill:i,children:r.jsx("path",{d:"M10 0 L2 11 H8 L5 20 L14 8 H8 L10 0 Z"})}):null]})]})}function et({value:e,onChange:t,options:n,disabled:s,labels:o,size:i="default"}){return r.jsx("div",{className:`nc-button-group ${i==="small"?"nc-small":""}`,children:n.map((l,c)=>r.jsx("button",{className:`nc-button-group-item ${e===l?"nc-active":""} ${c<n.length-1?"nc-has-border":""}`,onClick:()=>!s&&t(l),disabled:s,children:o&&o[l]?o[l]:l},l))})}function tt({size:e}){return r.jsx("svg",{className:`nc-checkbox-icon ${e==="small"?"nc-small":""}`,viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:r.jsx("path",{d:"M2 6L5 9L10 3",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}function nt({checked:e,onChange:t,disabled:n,label:s,size:o="default",labelColor:i,style:l,className:c=""}){const d=o==="small";return r.jsxs("label",{className:`nc-checkbox-label ${d?"nc-small":""} ${n?"nc-disabled":""} ${c}`.trim(),style:l,onClick:f=>{n||(f.preventDefault(),t(!e))},children:[r.jsx("span",{role:"checkbox","aria-checked":e,tabIndex:0,className:`nc-checkbox-box ${d?"nc-small":""} ${e?"nc-checked":""}`,onKeyDown:f=>{n||(f.key==="Enter"||f.key===" ")&&(f.preventDefault(),t(!e))},children:e&&r.jsx(tt,{size:o})}),s&&r.jsx("span",{className:"nc-checkbox-text",style:i?{color:i}:void 0,children:s})]})}function rt({option:e,onChange:t,selected:n,highlighted:s,small:o}){const i=u.useRef(null),{t:l}=q.useTranslation();return u.useEffect(()=>{s&&i.current&&i.current.scrollIntoView({block:"nearest"})},[s]),r.jsxs("div",{ref:i,className:`nc-combo-dropdown-option ${o?"nc-small":""} ${s?"nc-highlighted":""}`,role:"option",onMouseDown:()=>t(e.value),"aria-selected":n,style:{cursor:"pointer",background:s?"rgba(59,130,246,0.18)":n?"rgba(59,130,246,0.12)":void 0},children:[e.label,e.default&&r.jsxs("span",{style:{fontSize:"0.85em",color:"var(--nc-text-weak)",marginLeft:6},children:["(",l("common.default"),")"]})]})}function st({isOpen:e,options:t,onSelect:n,selectedValue:s,placement:o="bottom",anchorRef:i,small:l,highlightedIndex:c=-1}){const[d,f]=u.useState({top:0,left:0,width:0}),[m,w]=u.useState(o),{t:a}=q.useTranslation();if(u.useEffect(()=>{if(e&&i.current){const g=i.current.getBoundingClientRect();let v=o;if(o==="bottom"){const h=window.innerHeight-g.bottom,y=g.top;h<320&&y>h&&(v="top")}w(v),f({top:v==="top"?g.top-4:g.bottom+4,left:g.left,width:g.width})}},[e,i,o]),!e)return null;const p=r.jsx("div",{className:"nc-combo-dropdown",style:{position:"fixed",top:m==="top"?void 0:d.top,bottom:m==="top"?window.innerHeight-d.top:void 0,left:d.left,width:d.width,zIndex:1e3,maxHeight:300,overflowY:"auto"},children:t.length===0?r.jsx("div",{className:`nc-combo-dropdown-option nc-no-results ${l?"nc-small":""}`,children:a("common.noResults")}):t.map((g,v)=>r.jsx(rt,{option:g,onChange:n,selected:g.value===s,highlighted:v===c,small:l},g.value))});return ae.createPortal(p,document.body)}function ot({onClick:e,small:t}){return r.jsx("button",{className:`nc-button nc-ghost nc-combo-button nc-combo-clear ${t?"nc-small":""}`,onClick:e,onMouseDown:n=>n.stopPropagation(),"aria-label":"Clear selection",children:"✕"})}function it({open:e,onClick:t,small:n}){return r.jsx("button",{className:`nc-button nc-ghost nc-combo-button nc-combo-toggle ${n?"nc-small":""} ${e?"nc-open":""}`,onClick:t,onMouseDown:s=>s.stopPropagation(),"aria-label":e?"Close":"Open",children:"▾"})}function at({value:e,onChange:t,placeholder:n="Select…",options:s,disabled:o,label:i,clearable:l=!0,allowTyping:c=!1,placement:d="bottom",size:f="default",style:m,className:w}){const[a,p]=u.useState(!1),[g,v]=u.useState(""),[h,y]=u.useState(-1),j=u.useRef(null),R=u.useRef(null),b=f==="small",{t:C}=q.useTranslation(),$=u.useMemo(()=>{const A=g.toLowerCase();return c?s.filter(M=>M.label.toLowerCase().includes(A)):s},[s,g,c]);u.useEffect(()=>{a&&y(-1)},[a,$]),u.useEffect(()=>{if(!l&&!e&&s.length>0&&t){const A=s.find(M=>M.default)||s[0];t(A.value)}},[l,e,s,t]),u.useEffect(()=>{function A(M){var T;M.target instanceof Node&&j.current&&((T=j.current.parentElement)!=null&&T.contains(M.target)||p(!1))}return document.addEventListener("mousedown",A),()=>document.removeEventListener("mousedown",A)},[]);const x=s.find(A=>A.value===e),S=x&&l,k=!o&&!S,E=!(a&&c)&&!!x,z=(A,M=!1)=>{var T;t==null||t(A),p(!1),v(""),M&&((T=j.current)==null||T.blur())},I=()=>{t==null||t(void 0),v(""),p(!1)},D=A=>{if(!a){(A.key==="ArrowDown"||A.key==="ArrowUp")&&(p(!0),A.preventDefault());return}switch(A.key){case"ArrowDown":A.preventDefault(),y(M=>{const T=M+1;return T>=$.length?0:T});break;case"ArrowUp":A.preventDefault(),y(M=>{const T=M-1;return T<0?$.length-1:T});break;case"Enter":A.preventDefault(),h>=0&&h<$.length&&z($[h].value,!0);break;case"Escape":A.preventDefault(),p(!1),v("");break}};return r.jsxs("div",{className:`nc-combo-container ${w||""}`.trim(),style:{position:"relative",...m},children:[i&&r.jsx("span",{className:`nc-label ${b?"nc-small":""}`,children:i}),r.jsxs("div",{ref:R,style:{position:"relative",display:"flex",alignItems:"center"},onMouseDown:A=>{o||c&&A.target===j.current||(p(M=>(!M&&c&&x&&v(x.label),!M)),c&&!a&&setTimeout(()=>{var M,T;(M=j.current)==null||M.focus(),(T=j.current)==null||T.select()},0))},children:[r.jsx("input",{ref:j,className:`nc-input ${b?"nc-small":""}`,placeholder:n,onFocus:()=>{var A;!o&&c&&(p(!0),x&&(v(x.label),setTimeout(()=>{var M;return(M=j.current)==null?void 0:M.select()},0))),c||(A=j.current)==null||A.blur()},onChange:A=>c&&v(A.target.value),onKeyDown:D,value:a&&c?g:(x==null?void 0:x.label)||"",readOnly:o||!c,style:{width:"100%",paddingRight:k||S?b?32:44:12,caretColor:c?void 0:"transparent",cursor:c?void 0:"pointer",userSelect:c?void 0:"none",color:E?"transparent":"var(--nc-text)"}}),E&&r.jsxs("div",{"aria-hidden":!0,style:{position:"absolute",left:b?8:12,right:k||S?b?12:24:b?8:12,top:"50%",transform:"translateY(-50%)",pointerEvents:"none",display:"flex",alignItems:"center",gap:6,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:[r.jsx("span",{className:`nc-combo-overlay-text ${b?"nc-small":""}`,children:x==null?void 0:x.label}),(x==null?void 0:x.default)&&r.jsxs("span",{className:`nc-combo-overlay-default ${b?"nc-small":""}`,children:["(",C("common.default"),")"]})]}),S&&r.jsx(ot,{onClick:I,small:b}),k&&r.jsx(it,{open:a,onClick:()=>p(A=>!A),small:b})]}),r.jsx(st,{isOpen:a,options:$,onSelect:z,selectedValue:e,placement:d,anchorRef:R,small:b,highlightedIndex:h})]})}function ct({onClick:e,loading:t=!1,disabled:n=!1,size:s="default",title:o,"aria-label":i}){const l=s==="small"?14:s==="large"?20:18,c=t?"Refreshing...":"Refresh",d=t?"Refreshing":"Refresh";return r.jsx("button",{className:"nc-icon-button",onClick:e,disabled:n||t,title:o??c,"aria-label":i??d,"data-size":s,children:r.jsx(W.RefreshIcon,{size:l,className:t?"nc-spinning":""})})}function ge({onClick:e,disabled:t=!1,size:n="default",title:s="Close","aria-label":o="Close"}){const i=n==="small"?14:n==="large"?20:18;return r.jsx("button",{className:"nc-icon-button nc-icon-button-close",onClick:e,disabled:t,title:s,"aria-label":o,"data-size":n,children:r.jsx(W.CloseIcon,{size:i})})}function lt({onClick:e,disabled:t=!1,size:n="default",title:s="Edit","aria-label":o="Edit"}){const i=n==="small"?14:n==="large"?20:18;return r.jsx("button",{className:"nc-icon-button nc-icon-button-edit",onClick:e,disabled:t,title:s,"aria-label":o,"data-size":n,children:r.jsx(W.EditIcon,{size:i})})}function dt({onClick:e,disabled:t=!1,size:n="default",title:s="Delete","aria-label":o="Delete"}){const i=n==="small"?14:n==="large"?20:18;return r.jsx("button",{className:"nc-icon-button nc-icon-button-trash",onClick:e,disabled:t,title:s,"aria-label":o,"data-size":n,children:r.jsx(W.TrashIcon,{size:i})})}function ut({onClick:e,disabled:t=!1,children:n,title:s,"aria-label":o,size:i="default"}){return r.jsx("button",{className:"nc-hyperlink",onClick:e,disabled:t,title:s,"aria-label":o,"data-size":i,children:n})}function pt({open:e,onClose:t,options:n,anchorRef:s,anchor:o,preferredDirection:i="down"}){const l=u.useRef(null),[c,d]=u.useState({top:0,left:0}),f=o||(s==null?void 0:s.current);if(u.useEffect(()=>{if(!e||!f||!l.current)return;const a=f.getBoundingClientRect(),p=l.current.getBoundingClientRect(),g=window.innerHeight,v=window.innerWidth,h=a.bottom+8,y=h+p.height<=g-8;let j=i;(!y&&i==="down"||i==="up"&&y)&&(j="up");let R;j==="down"?R=h:R=a.top-p.height-8;let b=a.left;b+p.width>v-8&&(b=a.right-p.width),d({top:Math.max(8,R),left:Math.max(8,b)})},[e,f,i]),u.useEffect(()=>{if(!e)return;const a=g=>{l.current&&!l.current.contains(g.target)&&f&&!f.contains(g.target)&&t()},p=g=>{g.key==="Escape"&&t()};return document.addEventListener("mousedown",a),document.addEventListener("keydown",p),()=>{document.removeEventListener("mousedown",a),document.removeEventListener("keydown",p)}},[e,t,f]),!e)return null;const m=a=>{a.type!=="separator"&&!a.disabled&&a.onClick&&(a.onClick(),t())},w=n.some(a=>a.icon);return ae.createPortal(r.jsx("div",{ref:l,className:"nc-context-menu",style:{position:"fixed",top:`${c.top}px`,left:`${c.left}px`,zIndex:1e4},role:"menu",children:n.map(a=>{if(a.type==="separator")return r.jsx("div",{className:"nc-context-menu-separator",role:"separator"},a.id);const p=["nc-context-menu-item",a.variant&&a.variant!=="default"?`nc-${a.variant}`:"",a.disabled?"nc-disabled":"",w&&!a.icon?"nc-indented":""].filter(Boolean).join(" ");return r.jsxs("button",{className:p,onClick:()=>m(a),disabled:a.disabled,role:"menuitem",children:[a.icon&&r.jsx("span",{className:"nc-context-menu-icon",children:a.icon}),r.jsx("span",{className:"nc-context-menu-label",children:a.label})]},a.id)})}),document.body)}const $e=u.createContext(null);function Pe(){const e=u.useContext($e);if(!e)throw new Error("useDialog must be used inside a Dialog component");return e}function U({children:e,onClick:t,...n}){const{close:s}=Pe(),{t:o}=q.useTranslation(),i=l=>{t==null||t(l),s()};return r.jsx(H,{onClick:i,...n,children:e??o("common.close")})}function ft({open:e,onClose:t,title:n,children:s,style:o,footerType:i="ok-cancel",footer:l,onOk:c,onSave:d,onDelete:f,onCancel:m,onConnect:w,closeOnOverlay:a=!0,primaryDisabled:p=!1,fullScreen:g=!1,hideTitleBar:v=!1,className:h="",onContentHeightChange:y}){const j=u.useRef(null),R=u.useRef(null),{t:b}=q.useTranslation(),C={close:t},$=k=>{a&&k.target===k.currentTarget&&t()};if(u.useEffect(()=>{e&&j.current&&j.current.focus()},[e]),u.useEffect(()=>{if(!y||!R.current)return;const k=new ResizeObserver(E=>{for(const z of E){const I=z.contentRect.height;y(I)}});return k.observe(R.current),()=>{k.disconnect()}},[y]),!e)return null;const x=()=>{switch(i){case"ok":return r.jsx("div",{className:"nc-dialog-footer",children:r.jsx(H,{variant:"primary",onClick:c??t,disabled:p,children:b("common.ok")})});case"ok-cancel":return r.jsxs("div",{className:"nc-dialog-footer",children:[r.jsx(H,{variant:"primary",onClick:c??t,disabled:p,children:b("common.ok")}),r.jsx(U,{onClick:m,children:b("common.cancel")})]});case"save-cancel":return r.jsxs("div",{className:"nc-dialog-footer",children:[r.jsx(H,{variant:"primary",onClick:d,disabled:p,children:b("common.save")}),r.jsx(U,{onClick:m,children:b("common.cancel")})]});case"delete-cancel":return r.jsxs("div",{className:"nc-dialog-footer",children:[r.jsx(H,{variant:"danger",onClick:f,disabled:p,children:b("common.delete")}),r.jsx(U,{onClick:m,children:b("common.cancel")})]});case"connect":return r.jsxs("div",{className:"nc-dialog-footer",children:[r.jsx(H,{variant:"primary",onClick:w,disabled:p,children:b("common.connect")}),r.jsx(U,{onClick:m,children:b("common.cancel")})]});case"close":return r.jsx("div",{className:"nc-dialog-footer",children:r.jsx(U,{variant:"primary"})});case"gotit":return r.jsx("div",{className:"nc-dialog-footer",children:r.jsx(U,{variant:"primary",children:b("common.gotit")})});case"custom":return r.jsx("div",{className:"nc-dialog-footer",children:l});case"none":return null;default:return null}},S=r.jsx($e.Provider,{value:C,children:r.jsx("div",{className:`nc-dialog-overlay${g?" nc-fullscreen":""}`,onClick:$,children:r.jsxs("div",{ref:j,className:`nc-dialog-container ${h}`,style:o,tabIndex:-1,role:"dialog","aria-modal":"true","aria-labelledby":v?void 0:"nc-dialog-title",children:[!v&&r.jsxs("div",{className:"nc-dialog-header",children:[r.jsx("h3",{id:"nc-dialog-title",className:"nc-dialog-title",children:n}),r.jsx(ge,{onClick:t,"aria-label":"Close dialog"})]}),r.jsx("div",{ref:R,className:"nc-dialog-content",children:s}),x()]})})});return g?ae.createPortal(S,document.body):S}function ht({onClick:e,size:t="default",rightOffset:n=4}){const s=t==="small"?28:34;return r.jsx("button",{className:"nc-button nc-ghost",onClick:e,onMouseDown:o=>{o.preventDefault(),o.stopPropagation()},tabIndex:-1,"aria-label":"Clear input",style:{position:"absolute",right:n,padding:0,minHeight:0,height:s,width:s,border:"none",display:"flex",alignItems:"center",justifyContent:"center",fontSize:t==="small"?"12px":"14px"},children:"✕"})}function mt({visible:e,onClick:t,size:n="default"}){const s=n==="small"?28:34,o=n==="small"?16:18;return r.jsx("button",{className:"nc-button nc-ghost",onClick:t,onMouseDown:i=>{i.preventDefault(),i.stopPropagation()},tabIndex:-1,"aria-label":e?"Hide password":"Show password",style:{position:"absolute",right:4,padding:0,minHeight:0,height:s,width:s,border:"none",display:"flex",alignItems:"center",justifyContent:"center"},children:e?r.jsx(W.EyeHiddenIcon,{size:o}):r.jsx(W.ViewIcon,{size:o})})}function gt({value:e,defaultValue:t="",onChange:n,onEnter:s,onClear:o,placeholder:i,disabled:l,label:c,clearable:d=!0,type:f="text",className:m="",size:w="default",style:a,showPasswordToggle:p=!1,multiline:g=!1,rows:v=3,validator:h,showErrorMessage:y=!0}){const j=u.useRef(null),R=u.useRef(null),[b,C]=u.useState(!1),[$,x]=u.useState(!1),S=e!==void 0,[k,E]=u.useState(t),z=S?e:k,I=h?h(z):null,D=!!I,A=f==="password",M=A&&p&&!l&&!g,T=d&&z&&!l&&$,Q=w==="small"?32:44;let F=12;T&&M?F=Q*2:(T||M)&&(F=Q);const _=()=>{var Z,re;S||E(""),n==null||n(""),o==null||o(),g?(Z=R.current)==null||Z.focus():(re=j.current)==null||re.focus()},ne=Z=>{Z.key==="Enter"&&!g&&(s==null||s())},B=Z=>{const re=Z.target.value;S||E(re),n==null||n(re)},ke=()=>{x(!0)},Ne=()=>{x(!1)},Se=`nc-input ${w==="small"?"nc-small ":""} ${D?"nc-error ":""}${m}`;return r.jsxs("div",{className:"nc-col",style:{position:"relative",flex:1,...a},children:[c&&r.jsx("span",{className:"nc-label",children:c}),r.jsxs("div",{style:{position:"relative",display:"flex",alignItems:g?"flex-start":"center"},children:[g?r.jsx("textarea",{ref:R,className:Se,placeholder:i,value:z,onChange:B,onKeyDown:ne,onFocus:ke,onBlur:Ne,disabled:l,rows:v,style:{width:"100%",paddingRight:F}}):r.jsx("input",{ref:j,type:A&&b?"text":f,className:Se,placeholder:i,value:z,onChange:B,onKeyDown:ne,onFocus:ke,onBlur:Ne,disabled:l,style:{width:"100%",paddingRight:F}}),T&&r.jsx(ht,{onClick:_,size:w,rightOffset:M?Q+4:4}),M&&r.jsx(mt,{visible:b,onClick:()=>C(!b),size:w})]}),D&&y&&r.jsx("span",{className:"nc-error-message",children:I})]})}function bt({children:e,onClick:t,showBorder:n=!0,selectable:s=!1,style:o}){const[i,l]=u.useState(!1),c=d=>{if(t){if(s){const f=window.getSelection();if(f&&f.toString().length>0)return}t(d)}};return r.jsx("div",{onClick:c,onMouseDown:()=>t&&l(!0),onMouseUp:()=>l(!1),onMouseLeave:()=>l(!1),style:{cursor:t?"pointer":"default",userSelect:s?"text":void 0,borderBottom:n?void 0:"none",...o},className:`nc-list-group-item ${t?"nc-list-group-item-clickable":""} ${i?"nc-list-group-item-active":""}`,children:r.jsx("div",{style:{flex:1},children:e})})}function xt({title:e,titleTools:t,children:n,style:s}){return r.jsxs("div",{className:"nc-list-group",style:s,children:[(e||t)&&r.jsxs("div",{className:"nc-list-group-title",children:[r.jsx("div",{children:e}),t&&r.jsx("div",{className:"nc-list-group-title-tools",children:t})]}),r.jsx("div",{className:"nc-list-group-content",children:n})]})}function vt({values:e,onChange:t,options:n,placeholder:s="Select…",label:o}){const[i,l]=u.useState(!1),[c,d]=u.useState(""),f=u.useRef(null),m=u.useMemo(()=>n.filter(a=>a.label.toLowerCase().includes(c.toLowerCase())),[n,c]);u.useEffect(()=>{function a(p){!(p.target instanceof Node)||!f.current||f.current.contains(p.target)||l(!1)}return document.addEventListener("mousedown",a),()=>document.removeEventListener("mousedown",a)},[]);const w=a=>{e.includes(a)?t(e.filter(p=>p!==a)):t([...e,a])};return r.jsxs("div",{ref:f,className:"nc-col",style:{position:"relative"},children:[o&&r.jsx("span",{className:"nc-label",children:o}),r.jsxs("div",{className:"nc-row",style:{flexWrap:"wrap",gap:6,minHeight:42,alignItems:"center",border:"1px solid var(--nc-button-border)",borderRadius:8,background:"var(--nc-button-bg)",padding:"4px 8px"},children:[e.length===0&&r.jsx("span",{className:"nc-label",children:s}),e.map(a=>{const p=n.find(g=>g.value===a);return p?r.jsxs("span",{style:{padding:"4px 8px",borderRadius:6,display:"inline-flex",alignItems:"center",gap:4,background:"var(--nc-button-bg)",border:"1px solid var(--nc-button-border)"},children:[p.label,r.jsx("button",{className:"nc-button nc-ghost",style:{padding:0,minHeight:0,height:20,width:20,display:"inline-flex",alignItems:"center",justifyContent:"center",border:"none"},onClick:()=>w(a),"aria-label":`Remove ${p.label}`,children:"✕"})]},a):null}),r.jsx("input",{className:"nc-input",value:c,onChange:a=>d(a.target.value),onFocus:()=>l(!0),style:{minWidth:50,border:"none",background:"transparent",padding:4,minHeight:32,flex:1}})]}),i&&r.jsxs("div",{className:"nc-combo-dropdown",style:{position:"absolute",top:"100%",left:0,right:0,zIndex:10,marginTop:4,boxShadow:"0 4px 12px var(--nc-shadow)"},children:[m.map(a=>{const p=e.includes(a.value);return r.jsxs("div",{className:"nc-section nc-row",style:{justifyContent:"space-between",cursor:"pointer",padding:12},onMouseDown:()=>w(a.value),children:[r.jsx("span",{children:a.label}),r.jsx("span",{children:p?"✔️":""})]},a.value)}),m.length===0&&r.jsx("div",{className:"nc-section nc-label",children:"No results"})]})]})}function ce(e){if(!e)return null;const t=/^\d{2}-\d{1,2}$/,n=/^\d{4}-\d{1,2}$/;if(!t.test(e)&&!n.test(e))return"Format must be YY-M(M) or YYYY-M(M)";const s=e.split("-"),o=parseInt(s[1],10);return o<1||o>12?"Month must be between 1 and 12":null}function ie(e){if(!e)return"";const t=e.split("-");if(t.length!==2)return e;let n=t[0];const s=t[1].padStart(2,"0");if(n.length===2){const o=parseInt(n,10);n=String(o<50?2e3+o:1900+o)}return`${n}-${s}`}function Ae(e){if(!e)return"";const t=ie(e);if(!/^\d{4}-\d{2}$/.test(t))return e;const[n,s]=t.split("-");return`${n}/${s}`}function Ce(){const e=new Date,t=e.getFullYear(),n=String(e.getMonth()+1).padStart(2,"0");return`${t}-${n}`}function wt({startMonth:e,endMonth:t,onChange:n,label:s,className:o="",disabled:i=!1}){const[l,c]=u.useState(!1),[d,f]=u.useState(""),[m,w]=u.useState(""),[a,p]=u.useState({top:0,left:0,width:0}),g=u.useRef(null),v=u.useRef(null);u.useEffect(()=>{if(l&&g.current){const E=g.current.getBoundingClientRect();p({top:E.bottom+4,left:E.left,width:E.width})}},[l]),u.useEffect(()=>{if(!l)return;const E=z=>{g.current&&!g.current.contains(z.target)&&v.current&&!v.current.contains(z.target)&&c(!1)};return document.addEventListener("mousedown",E),()=>document.removeEventListener("mousedown",E)},[l]);const h=()=>{f(e||Ce()),w(t||Ce()),c(!0)},y=()=>{c(!1)},j=()=>{const E=ce(d),z=ce(m);if(E||z)return;const I=ie(d),D=ie(m);I&&D&&(n==null||n(I,D)),c(!1)},R=e&&t?`${Ae(e)} - ${Ae(t)}`:"Select month range",b=ce(d),C=ce(m),$=ie(d),x=ie(m),S=$&&x&&$>x,k=l?ae.createPortal(r.jsx("div",{ref:v,className:"nc-month-range-picker-popup",style:{position:"fixed",top:a.top,left:a.left,width:Math.max(a.width,400),zIndex:1e3},children:r.jsxs("div",{className:"nc-month-range-picker-content",children:[r.jsxs("div",{className:"nc-month-range-picker-row",children:[r.jsxs("div",{className:"nc-month-range-picker-column",children:[r.jsx("label",{className:"nc-label",children:"Start Month"}),r.jsx("input",{type:"text",className:`nc-month-input ${b?"nc-error":""}`,value:d,onChange:E=>f(E.target.value),placeholder:"YY-M(M) or YYYY-M(M)"}),b&&r.jsx("div",{className:"nc-month-error-text",children:b})]}),r.jsxs("div",{className:"nc-month-range-picker-column",children:[r.jsx("label",{className:"nc-label",children:"End Month"}),r.jsx("input",{type:"text",className:`nc-month-input ${C?"nc-error":""}`,value:m,onChange:E=>w(E.target.value),placeholder:"YY-M(M) or YYYY-M(M)"}),C&&r.jsx("div",{className:"nc-month-error-text",children:C})]})]}),S&&!b&&!C&&r.jsx("div",{className:"nc-month-range-error",children:"End month must be after or equal to start month"}),r.jsxs("div",{className:"nc-month-range-picker-footer",children:[r.jsx(H,{variant:"primary",onClick:j,disabled:!d||!m||!!b||!!C||!!S,children:"Apply"}),r.jsx(H,{variant:"ghost",onClick:y,children:"Cancel"})]})]})}),document.body):null;return r.jsxs("div",{className:`nc-month-range-picker ${o}`,children:[s&&r.jsx("label",{className:"nc-label",children:s}),r.jsx("button",{ref:g,className:"nc-month-range-picker-input",onClick:h,disabled:i,children:R}),k]})}function yt({value:e,onChange:t,min:n,max:s,step:o=1,label:i,disabled:l,size:c="default"}){const d=c==="small",f=()=>{const a=e-o;n!==void 0&&a<n||t(parseFloat(a.toFixed(10)))},m=()=>{const a=e+o;s!==void 0&&a>s||t(parseFloat(a.toFixed(10)))},w=a=>{const p=parseFloat(a.target.value);isNaN(p)||n!==void 0&&p<n||s!==void 0&&p>s||t(p)};return r.jsxs("div",{className:`nc-col nc-number-input-col ${d?"nc-small":""}`,children:[i&&r.jsx("span",{className:`nc-label ${d?"nc-small":""}`,children:i}),r.jsxs("div",{className:`nc-number-input-container ${d?"nc-small":""}`,children:[r.jsx("input",{className:`nc-input nc-number-input ${d?"nc-small":""}`,type:"number",value:e,onChange:w,min:n,max:s,step:o,disabled:l}),r.jsx("button",{className:`nc-button nc-ghost nc-number-input-button ${d?"nc-small":""}`,onClick:f,disabled:l||n!==void 0&&e<=n,children:"−"}),r.jsx("button",{className:`nc-button nc-ghost nc-number-input-button ${d?"nc-small":""}`,onClick:m,disabled:l||s!==void 0&&e>=s,children:"+"})]})]})}function jt({value:e,onChange:t,min:n=0,max:s=100,step:o=1,label:i,disabled:l,showValue:c=!0,formatValue:d=m=>m.toString(),width:f=200}){const m=a=>{const p=parseFloat(a.target.value);t(p)},w=(e-n)/(s-n)*100;return r.jsxs("div",{className:"nc-col",style:{gap:6},children:[i&&r.jsx("span",{className:"nc-label",children:i}),r.jsxs("div",{style:{display:"flex",gap:12,alignItems:"center"},children:[r.jsx("input",{type:"range",className:"nc-slider",value:e,onChange:m,min:n,max:s,step:o,disabled:l,style:{width:f,"--nc-slider-percentage":`${w}%`}}),c&&r.jsx("span",{style:{color:"var(--nc-text)",fontFamily:"monospace",fontSize:14,minWidth:60,textAlign:"right"},children:d(e)})]})]})}const kt=({size:e=24,className:t,style:n})=>r.jsx("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",className:t,style:n,children:r.jsx("polyline",{points:"18 15 12 9 6 15"})});function Te({children:e,className:t="",style:n}){return r.jsx("div",{className:`nc-tab-panel ${t}`,style:n,children:e})}function Nt({active:e,children:t,keepMounted:n=!1,className:s="",style:o}){const i=u.Children.toArray(t).filter(c=>u.isValidElement(c)&&(c.type===Te||c.type.displayName==="TabPanel"));if(n)return r.jsx("div",{className:`nc-tab-panels ${s}`,style:o,children:i.map(c=>{const d=c.props.tab===e;return r.jsx("div",{className:`nc-tab-panel-wrapper ${d?"nc-active":""}`,style:{display:d?"block":"none"},"aria-hidden":!d,children:c},c.props.tab)})});const l=i.find(c=>c.props.tab===e);return r.jsx("div",{className:`nc-tab-panels ${s}`,style:o,children:l})}function St({tabs:e,active:t,onChange:n,className:s,toolbar:o,multiline:i,orientation:l="horizontal",style:c}){const d=u.useRef(null),[f,m]=u.useState(!1),[w,a]=u.useState(!1),p=l==="verticalLeft"||l==="verticalRight",g=u.useRef(!1),v=u.useRef(0),h=u.useRef(0),y=u.useRef(!1);u.useEffect(()=>{const x=()=>{if(d.current)if(p){const{scrollTop:k,scrollHeight:E,clientHeight:z}=d.current;m(k>1),a(k<E-z-1)}else{const{scrollLeft:k,scrollWidth:E,clientWidth:z}=d.current;m(k>1),a(k<E-z-1)}},S=d.current;if(S)return x(),S.addEventListener("scroll",x),window.addEventListener("resize",x),()=>{S.removeEventListener("scroll",x),window.removeEventListener("resize",x)}},[e,p]);const j=x=>{d.current&&(g.current=!0,y.current=!1,v.current=p?x.clientY:x.clientX,h.current=p?d.current.scrollTop:d.current.scrollLeft,d.current.style.cursor="grabbing",d.current.style.userSelect="none")},R=x=>{if(!g.current||!d.current)return;const S=p?x.clientY:x.clientX,k=v.current-S;Math.abs(k)>3&&(y.current=!0),p?d.current.scrollTop=h.current+k:d.current.scrollLeft=h.current+k},b=()=>{d.current&&(g.current=!1,d.current.style.cursor="",d.current.style.userSelect="")},C=()=>{b()};u.useEffect(()=>{const x=d.current;if(!x||p)return;const S=k=>{k.deltaY!==0&&(k.preventDefault(),x.scrollLeft+=k.deltaY*.3)};return x.addEventListener("wheel",S,{passive:!1}),()=>{x.removeEventListener("wheel",S)}},[p]);const $=x=>{y.current||n(x)};return r.jsxs("div",{className:`nc-tab-container ${p?`nc-vertical nc-${l}`:""} ${s||""}`,style:c,children:[r.jsxs("div",{className:"nc-tab-scroll-wrapper",children:[f&&r.jsx("div",{className:`nc-tab-scroll-indicator ${p?"nc-top":"nc-left"}`,children:p?r.jsx(kt,{size:16}):r.jsx(W.ChevronLeftIcon,{size:16})}),r.jsx("div",{ref:d,className:`nc-tab-scroll ${i?"nc-multiline":""}`,onMouseDown:j,onMouseMove:R,onMouseUp:b,onMouseLeave:C,style:{cursor:"grab"},children:e.map(x=>r.jsx("div",{className:`nc-tab-item ${t===x?"nc-active":""}`,onClick:()=>$(x),role:"button",tabIndex:0,onKeyDown:S=>{(S.key==="Enter"||S.key===" ")&&n(x)},children:p?x:x.toUpperCase()},x))}),w&&r.jsx("div",{className:`nc-tab-scroll-indicator ${p?"nc-bottom":"nc-right"}`,children:p?r.jsx(W.ChevronDownIcon,{size:16}):r.jsx(W.ChevronRightIcon,{size:16})})]}),o&&r.jsx("div",{className:"nc-tab-toolbar",children:o})]})}function At({checked:e,onChange:t,disabled:n,label:s}){return r.jsxs("label",{className:"nc-row",style:{gap:10,alignItems:"center",cursor:n?"not-allowed":"pointer"},children:[s&&r.jsx("span",{className:"nc-label",children:s}),r.jsx("span",{role:"switch","aria-checked":e,tabIndex:0,onKeyDown:o=>{n||(o.key==="Enter"||o.key===" ")&&(o.preventDefault(),t(!e))},onClick:()=>!n&&t(!e),style:{position:"relative",width:56,height:30,borderRadius:18,padding:4,display:"inline-flex",alignItems:"center",justifyContent:"flex-start",border:`2px solid ${e?"var(--nc-primary)":"var(--nc-button-border)"}`,background:e?"rgba(99,102,241,0.08)":"transparent",transition:"border-color 160ms, background 160ms"},children:r.jsx("span",{style:{width:22,height:22,borderRadius:12,background:e?"var(--nc-text)":"var(--nc-muted)",transform:`translateX(${e?24:0}px)`,transition:"transform 160ms, background 160ms",boxShadow:e?"0 2px 6px rgba(99,102,241,0.28)":"0 1px 2px rgba(0,0,0,0.08)",border:"none"}})})]})}let X={notifications:[]};const pe=new Set,Ie=new Map;function fe(){const e=X.notifications.slice();for(const t of Array.from(pe))try{t(e)}catch{}}function Ct(e){pe.add(e);try{e(X.notifications.slice())}catch{}return()=>{pe.delete(e)}}function It(e){const t=`notification-${Date.now()}-${Math.random()}`,n={id:t,dismissible:!0,lastingTime:5e3,...e};return X.notifications=[n,...X.notifications],fe(),n.lastingTime&&n.lastingTime>0&&setTimeout(()=>{ze(t)},n.lastingTime),t}function ze(e){const t=X.notifications.find(s=>s.id===e);if(!t)return;t.isRemoving=!0,fe();const n=window.setTimeout(()=>{X.notifications=X.notifications.filter(s=>s.id!==e),fe(),Ie.delete(e)},300);Ie.set(e,n)}function Be({notification:e}){const{t}=q.useTranslation(),n=()=>{if(e.title)return e.title;switch(e.type){case"success":return t("common.success");case"danger":return t("common.error");case"warning":return t("common.warning");default:return t("common.info")}},s=()=>{ze(e.id)};return r.jsx("div",{className:`nc-notification nc-notification-${e.type||"info"}`,children:r.jsxs("div",{className:"nc-notification-content",children:[r.jsxs("div",{className:"nc-notification-body",style:{paddingRight:e.dismissible?"8px":"0"},children:[r.jsx("div",{className:"nc-notification-title",children:n()}),r.jsx("div",{className:"nc-notification-message",children:e.message})]}),e.dismissible&&r.jsx("button",{className:"nc-notification-dismiss",onClick:s,children:r.jsx(W.CloseIcon,{size:16})})]})})}function Rt(){const[e,t]=u.useState([]),[n,s]=u.useState(new Map),[o,i]=u.useState(new Set),l=u.useRef(null),c=u.useRef([]);return u.useEffect(()=>Ct(f=>{const m=new Set(c.current.map(a=>a.id)),w=f.filter(a=>!m.has(a.id)).map(a=>a.id);w.length>0?(t(f),i(new Set(w)),requestAnimationFrame(()=>{requestAnimationFrame(()=>{i(new Set)})})):t(f),c.current=f}),[]),u.useEffect(()=>{if(!l.current)return;const d=new Map;let f=0;const m=l.current.children;e.forEach((w,a)=>{if(d.set(w.id,f),m[a]){const p=m[a].offsetHeight;w.isRemoving||(f+=p+12)}}),s(d)},[e]),r.jsx("div",{style:{position:"fixed",top:"16px",left:"16px",zIndex:9999,pointerEvents:"none"},children:r.jsx("div",{ref:l,style:{pointerEvents:"auto",position:"relative"},children:e.map(d=>{const f=o.has(d.id),m=d.isRemoving,w=n.get(d.id)||0;return r.jsx("div",{style:{position:"absolute",top:0,left:0,transform:f?"translateY(-120px)":`translateY(${w}px)`,transition:m?"opacity 300ms ease-out":"transform 300ms ease-out, opacity 300ms ease-out",opacity:m?0:1,width:"100%"},children:r.jsx(Be,{notification:d})},d.id)})})})}const Et={show:e=>It(e)};function Mt(e){const t=Xe.createInstance(),n={};for(const o in e)n[o]={translation:e[o]};const s=typeof document<"u"&&document.documentElement.lang||"en";return t.init({resources:n,lng:s,fallbackLng:"en",interpolation:{escapeValue:!1}}),typeof MutationObserver<"u"&&typeof document<"u"&&new MutationObserver(i=>{for(const l of i)if(l.type==="attributes"&&l.attributeName==="lang"){const c=document.documentElement.lang||"en";t.changeLanguage(c)}}).observe(document.documentElement,{attributes:!0}),t}class $t{constructor(){O(this,"apps",new Map)}register(t){this.apps.has(t.id)&&console.warn(`App "${t.id}" is already registered. Overwriting.`),this.apps.set(t.id,{...t,width:t.width??400,padding:t.padding??0})}unregister(t){this.apps.delete(t)}get(t){return this.apps.get(t)}list(){return Array.from(this.apps.values())}has(t){return this.apps.has(t)}}const J=new $t,Re="nc-ui-app-state";class Pt{constructor(){O(this,"state");O(this,"listeners",new Map);this.state=this.loadState()}loadState(){try{const t=localStorage.getItem(Re);if(t)return JSON.parse(t)}catch{}return{activeAppId:null}}saveState(){try{localStorage.setItem(Re,JSON.stringify(this.state))}catch{}}getActiveAppId(){return this.state.activeAppId}_setActiveAppId(t){this.state.activeAppId!==t&&(this.state.activeAppId=t,this.saveState(),this.notify("activeAppId",t))}subscribe(t,n){return this.listeners.has(t)||this.listeners.set(t,new Set),this.listeners.get(t).add(n),()=>{var s;(s=this.listeners.get(t))==null||s.delete(n)}}notify(t,n){var s;(s=this.listeners.get(t))==null||s.forEach(o=>o(n))}}const V=new Pt;class Tt{constructor(){O(this,"apps",[]);O(this,"activeAppId",null);O(this,"listeners",new Set);O(this,"refReadyResolvers",new Map)}async launchApp(t,n){const{launchInBackground:s=!1}=n||{};if(!J.has(t))return console.error(`Cannot launch app "${t}": not registered`),null;const o=this.apps.find(l=>l.appId===t);if(o)return s||(this.setActiveApp(t),V._setActiveAppId(t)),o.ref?o:this.waitForRef(t);const i={appId:t,launchedAt:Date.now()};return this.apps.push(i),s||(this.activeAppId=t,V._setActiveAppId(t)),this.notify(),this.waitForRef(t)}waitForRef(t){return new Promise(n=>{const s=this.refReadyResolvers.get(t)||[];s.push(n),this.refReadyResolvers.set(t,s)})}setAppRef(t,n){const s=this.apps.find(i=>i.appId===t);if(!s){console.warn(`Cannot set ref for app "${t}": not running`);return}s.ref=n;const o=this.refReadyResolvers.get(t);o&&(o.forEach(i=>i(s)),this.refReadyResolvers.delete(t))}getApp(t){return this.apps.find(n=>n.appId===t)}closeApp(t){const n=this.apps.findIndex(o=>o.appId===t);if(n===-1)return;const s=this.apps[n];if(s.ref&&(s.ref=void 0),this.apps.splice(n,1),this.activeAppId===t){const o=window.innerWidth>=768;this.activeAppId=o&&this.apps.length>0?this.apps[this.apps.length-1].appId:null,V._setActiveAppId(this.activeAppId)}this.notify()}setActiveApp(t){if(t!==null&&!this.apps.find(n=>n.appId===t)){console.warn(`Cannot activate app "${t}": not running`);return}this.activeAppId!==t&&(this.activeAppId=t,this.notify(),V._setActiveAppId(t))}toggleApp(t){this.activeAppId===t?this.setActiveApp(null):this.launchApp(t)}getActiveAppId(){return this.activeAppId}getActiveApp(){return this.activeAppId?J.get(this.activeAppId)??null:null}getRunningApps(){return[...this.apps]}isRunning(t){return this.apps.some(n=>n.appId===t)}subscribe(t){return this.listeners.add(t),()=>{this.listeners.delete(t)}}notify(){this.listeners.forEach(t=>t())}}const L=new Tt,be=u.createContext(null);function Le(){const e=u.useContext(be);if(!e)throw new Error("useApp must be used inside an App");return e}function zt({size:e=16}){return r.jsxs("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",children:[r.jsx("path",{d:"M19 12H5"}),r.jsx("path",{d:"M12 19l-7-7 7-7"})]})}function De({title:e,onClose:t,onBack:n,toolbar:s,hideBackButton:o}){const i=n&&!o;return r.jsxs("div",{className:"nc-app-title-bar",children:[r.jsxs("div",{className:"nc-app-title-bar-left",children:[i&&r.jsx("button",{className:"nc-app-title-bar-back",onClick:n,title:"Back","aria-label":"Go back",children:r.jsx(zt,{size:16})}),r.jsx("span",{className:"nc-app-title-bar-title",children:e})]}),r.jsxs("div",{className:"nc-app-title-bar-right",children:[s&&r.jsx("div",{className:"nc-app-title-bar-toolbar",children:s}),r.jsx(ge,{onClick:t,"aria-label":"Close application"})]})]})}class Bt extends u.Component{constructor(t){super(t),this.state={hasError:!1}}static getDerivedStateFromError(t){return{hasError:!0,error:t}}componentDidCatch(t,n){console.error(`Error loading app ${this.props.appId}:`,t,n)}render(){return this.state.hasError?r.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",flex:1,flexDirection:"column",gap:"16px",padding:"20px",textAlign:"center",color:"var(--text-secondary)"},children:[r.jsx("div",{children:"Failed to load app"}),this.state.error&&r.jsx("div",{style:{fontSize:"12px",opacity:.7},children:this.state.error.message})]}):this.props.children}}function xe({appId:e,isActive:t,onClose:n}){const{t:s}=q.useTranslation(),o=J.get(e),[i,l]=u.useState(""),[c,d]=u.useState(null),[f,m]=u.useState(null),[w,a]=u.useState(!1),[p,g]=u.useState(!1);u.useEffect(()=>{o!=null&&o.titleKey&&l(s(o.titleKey))},[o,s]);const v=u.useCallback(k=>{l(k)},[]),h=u.useCallback(k=>{d(()=>k)},[]),y=u.useCallback(()=>{d(null)},[]),j=u.useCallback(k=>{m(k)},[]),R=u.useCallback(()=>{m(null)},[]),b=u.useCallback(k=>{a(k)},[]),C=u.useCallback(k=>{g(k)},[]),$=u.useMemo(()=>({setTitle:v,setBackHandler:h,clearBackHandler:y,setToolbar:j,clearToolbar:R,setHideBackButton:b,setHideTitleBar:C,close:n}),[v,h,y,j,R,b,C,n]);if(!o)return null;const x=o.component,S=!o.hideTitleBar&&!p;return r.jsxs("div",{style:{display:t?"flex":"none",flexDirection:"column",flex:1,minHeight:0},children:[S&&r.jsx(De,{title:i,onClose:n,onBack:c??void 0,toolbar:f,hideBackButton:w}),r.jsx("div",{className:S?"nc-app-content-wrapper":"",style:{padding:o.padding,flex:1,minHeight:0,display:"flex",flexDirection:"column",backgroundColor:"var(--nc-bg-secondary)",position:"relative"},children:r.jsx(be.Provider,{value:$,children:r.jsx(Bt,{appId:e,children:r.jsx(u.Suspense,{fallback:r.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",flex:1},children:r.jsx(me,{})}),children:r.jsx(x,{})})})})})]})}const le=768,de=1024,He={isMobile:!1,isTablet:!1,isDesktop:!0,width:typeof window<"u"?window.innerWidth:1024,height:typeof window<"u"?window.innerHeight:768},Ve=u.createContext(He);function Lt({children:e}){const[t,n]=u.useState(()=>{if(typeof window>"u")return He;const s=window.innerWidth,o=window.innerHeight;return{isMobile:s<le,isTablet:s>=le&&s<de,isDesktop:s>=de,width:s,height:o}});return u.useEffect(()=>{const s=()=>{const o=window.innerWidth,i=window.innerHeight;n({isMobile:o<le,isTablet:o>=le&&o<de,isDesktop:o>=de,width:o,height:i})};return window.addEventListener("resize",s),()=>window.removeEventListener("resize",s)},[]),r.jsx(Ve.Provider,{value:t,children:e})}function ve(){return u.useContext(Ve)}const we="-",Dt=e=>{const t=Vt(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:s}=e;return{getClassGroupId:l=>{const c=l.split(we);return c[0]===""&&c.length!==1&&c.shift(),We(c,t)||Ht(l)},getConflictingClassGroupIds:(l,c)=>{const d=n[l]||[];return c&&s[l]?[...d,...s[l]]:d}}},We=(e,t)=>{var l;if(e.length===0)return t.classGroupId;const n=e[0],s=t.nextPart.get(n),o=s?We(e.slice(1),s):void 0;if(o)return o;if(t.validators.length===0)return;const i=e.join(we);return(l=t.validators.find(({validator:c})=>c(i)))==null?void 0:l.classGroupId},Ee=/^\[(.+)\]$/,Ht=e=>{if(Ee.test(e)){const t=Ee.exec(e)[1],n=t==null?void 0:t.substring(0,t.indexOf(":"));if(n)return"arbitrary.."+n}},Vt=e=>{const{theme:t,prefix:n}=e,s={nextPart:new Map,validators:[]};return Gt(Object.entries(e.classGroups),n).forEach(([i,l])=>{he(l,s,i,t)}),s},he=(e,t,n,s)=>{e.forEach(o=>{if(typeof o=="string"){const i=o===""?t:Me(t,o);i.classGroupId=n;return}if(typeof o=="function"){if(Wt(o)){he(o(s),t,n,s);return}t.validators.push({validator:o,classGroupId:n});return}Object.entries(o).forEach(([i,l])=>{he(l,Me(t,i),n,s)})})},Me=(e,t)=>{let n=e;return t.split(we).forEach(s=>{n.nextPart.has(s)||n.nextPart.set(s,{nextPart:new Map,validators:[]}),n=n.nextPart.get(s)}),n},Wt=e=>e.isThemeGetter,Gt=(e,t)=>t?e.map(([n,s])=>{const o=s.map(i=>typeof i=="string"?t+i:typeof i=="object"?Object.fromEntries(Object.entries(i).map(([l,c])=>[t+l,c])):i);return[n,o]}):e,Ft=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=new Map,s=new Map;const o=(i,l)=>{n.set(i,l),t++,t>e&&(t=0,s=n,n=new Map)};return{get(i){let l=n.get(i);if(l!==void 0)return l;if((l=s.get(i))!==void 0)return o(i,l),l},set(i,l){n.has(i)?n.set(i,l):o(i,l)}}},Ge="!",Ot=e=>{const{separator:t,experimentalParseClassName:n}=e,s=t.length===1,o=t[0],i=t.length,l=c=>{const d=[];let f=0,m=0,w;for(let h=0;h<c.length;h++){let y=c[h];if(f===0){if(y===o&&(s||c.slice(h,h+i)===t)){d.push(c.slice(m,h)),m=h+i;continue}if(y==="/"){w=h;continue}}y==="["?f++:y==="]"&&f--}const a=d.length===0?c:c.substring(m),p=a.startsWith(Ge),g=p?a.substring(1):a,v=w&&w>m?w-m:void 0;return{modifiers:d,hasImportantModifier:p,baseClassName:g,maybePostfixModifierPosition:v}};return n?c=>n({className:c,parseClassName:l}):l},Yt=e=>{if(e.length<=1)return e;const t=[];let n=[];return e.forEach(s=>{s[0]==="["?(t.push(...n.sort(),s),n=[]):n.push(s)}),t.push(...n.sort()),t},Kt=e=>({cache:Ft(e.cacheSize),parseClassName:Ot(e),...Dt(e)}),qt=/\s+/,_t=(e,t)=>{const{parseClassName:n,getClassGroupId:s,getConflictingClassGroupIds:o}=t,i=[],l=e.trim().split(qt);let c="";for(let d=l.length-1;d>=0;d-=1){const f=l[d],{modifiers:m,hasImportantModifier:w,baseClassName:a,maybePostfixModifierPosition:p}=n(f);let g=!!p,v=s(g?a.substring(0,p):a);if(!v){if(!g){c=f+(c.length>0?" "+c:c);continue}if(v=s(a),!v){c=f+(c.length>0?" "+c:c);continue}g=!1}const h=Yt(m).join(":"),y=w?h+Ge:h,j=y+v;if(i.includes(j))continue;i.push(j);const R=o(v,g);for(let b=0;b<R.length;++b){const C=R[b];i.push(y+C)}c=f+(c.length>0?" "+c:c)}return c};function Ut(){let e=0,t,n,s="";for(;e<arguments.length;)(t=arguments[e++])&&(n=Fe(t))&&(s&&(s+=" "),s+=n);return s}const Fe=e=>{if(typeof e=="string")return e;let t,n="";for(let s=0;s<e.length;s++)e[s]&&(t=Fe(e[s]))&&(n&&(n+=" "),n+=t);return n};function Xt(e,...t){let n,s,o,i=l;function l(d){const f=t.reduce((m,w)=>w(m),e());return n=Kt(f),s=n.cache.get,o=n.cache.set,i=c,c(d)}function c(d){const f=s(d);if(f)return f;const m=_t(d,n);return o(d,m),m}return function(){return i(Ut.apply(null,arguments))}}const P=e=>{const t=n=>n[e]||[];return t.isThemeGetter=!0,t},Oe=/^\[(?:([a-z-]+):)?(.+)\]$/i,Jt=/^\d+\/\d+$/,Qt=new Set(["px","full","screen"]),Zt=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,en=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,tn=/^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/,nn=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,rn=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,G=e=>ee(e)||Qt.has(e)||Jt.test(e),Y=e=>te(e,"length",pn),ee=e=>!!e&&!Number.isNaN(Number(e)),ue=e=>te(e,"number",ee),se=e=>!!e&&Number.isInteger(Number(e)),sn=e=>e.endsWith("%")&&ee(e.slice(0,-1)),N=e=>Oe.test(e),K=e=>Zt.test(e),on=new Set(["length","size","percentage"]),an=e=>te(e,on,Ye),cn=e=>te(e,"position",Ye),ln=new Set(["image","url"]),dn=e=>te(e,ln,hn),un=e=>te(e,"",fn),oe=()=>!0,te=(e,t,n)=>{const s=Oe.exec(e);return s?s[1]?typeof t=="string"?s[1]===t:t.has(s[1]):n(s[2]):!1},pn=e=>en.test(e)&&!tn.test(e),Ye=()=>!1,fn=e=>nn.test(e),hn=e=>rn.test(e),mn=()=>{const e=P("colors"),t=P("spacing"),n=P("blur"),s=P("brightness"),o=P("borderColor"),i=P("borderRadius"),l=P("borderSpacing"),c=P("borderWidth"),d=P("contrast"),f=P("grayscale"),m=P("hueRotate"),w=P("invert"),a=P("gap"),p=P("gradientColorStops"),g=P("gradientColorStopPositions"),v=P("inset"),h=P("margin"),y=P("opacity"),j=P("padding"),R=P("saturate"),b=P("scale"),C=P("sepia"),$=P("skew"),x=P("space"),S=P("translate"),k=()=>["auto","contain","none"],E=()=>["auto","hidden","clip","visible","scroll"],z=()=>["auto",N,t],I=()=>[N,t],D=()=>["",G,Y],A=()=>["auto",ee,N],M=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],T=()=>["solid","dashed","dotted","double","none"],Q=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],F=()=>["start","end","center","between","around","evenly","stretch"],_=()=>["","0",N],ne=()=>["auto","avoid","all","avoid-page","page","left","right","column"],B=()=>[ee,N];return{cacheSize:500,separator:":",theme:{colors:[oe],spacing:[G,Y],blur:["none","",K,N],brightness:B(),borderColor:[e],borderRadius:["none","","full",K,N],borderSpacing:I(),borderWidth:D(),contrast:B(),grayscale:_(),hueRotate:B(),invert:_(),gap:I(),gradientColorStops:[e],gradientColorStopPositions:[sn,Y],inset:z(),margin:z(),opacity:B(),padding:I(),saturate:B(),scale:B(),sepia:_(),skew:B(),space:I(),translate:I()},classGroups:{aspect:[{aspect:["auto","square","video",N]}],container:["container"],columns:[{columns:[K]}],"break-after":[{"break-after":ne()}],"break-before":[{"break-before":ne()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[...M(),N]}],overflow:[{overflow:E()}],"overflow-x":[{"overflow-x":E()}],"overflow-y":[{"overflow-y":E()}],overscroll:[{overscroll:k()}],"overscroll-x":[{"overscroll-x":k()}],"overscroll-y":[{"overscroll-y":k()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[v]}],"inset-x":[{"inset-x":[v]}],"inset-y":[{"inset-y":[v]}],start:[{start:[v]}],end:[{end:[v]}],top:[{top:[v]}],right:[{right:[v]}],bottom:[{bottom:[v]}],left:[{left:[v]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",se,N]}],basis:[{basis:z()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",N]}],grow:[{grow:_()}],shrink:[{shrink:_()}],order:[{order:["first","last","none",se,N]}],"grid-cols":[{"grid-cols":[oe]}],"col-start-end":[{col:["auto",{span:["full",se,N]},N]}],"col-start":[{"col-start":A()}],"col-end":[{"col-end":A()}],"grid-rows":[{"grid-rows":[oe]}],"row-start-end":[{row:["auto",{span:[se,N]},N]}],"row-start":[{"row-start":A()}],"row-end":[{"row-end":A()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",N]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",N]}],gap:[{gap:[a]}],"gap-x":[{"gap-x":[a]}],"gap-y":[{"gap-y":[a]}],"justify-content":[{justify:["normal",...F()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...F(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...F(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[j]}],px:[{px:[j]}],py:[{py:[j]}],ps:[{ps:[j]}],pe:[{pe:[j]}],pt:[{pt:[j]}],pr:[{pr:[j]}],pb:[{pb:[j]}],pl:[{pl:[j]}],m:[{m:[h]}],mx:[{mx:[h]}],my:[{my:[h]}],ms:[{ms:[h]}],me:[{me:[h]}],mt:[{mt:[h]}],mr:[{mr:[h]}],mb:[{mb:[h]}],ml:[{ml:[h]}],"space-x":[{"space-x":[x]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[x]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",N,t]}],"min-w":[{"min-w":[N,t,"min","max","fit"]}],"max-w":[{"max-w":[N,t,"none","full","min","max","fit","prose",{screen:[K]},K]}],h:[{h:[N,t,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[N,t,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[N,t,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[N,t,"auto","min","max","fit"]}],"font-size":[{text:["base",K,Y]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",ue]}],"font-family":[{font:[oe]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:["tighter","tight","normal","wide","wider","widest",N]}],"line-clamp":[{"line-clamp":["none",ee,ue]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",G,N]}],"list-image":[{"list-image":["none",N]}],"list-style-type":[{list:["none","disc","decimal",N]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[e]}],"placeholder-opacity":[{"placeholder-opacity":[y]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[e]}],"text-opacity":[{"text-opacity":[y]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...T(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",G,Y]}],"underline-offset":[{"underline-offset":["auto",G,N]}],"text-decoration-color":[{decoration:[e]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:I()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",N]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",N]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[y]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...M(),cn]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",an]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},dn]}],"bg-color":[{bg:[e]}],"gradient-from-pos":[{from:[g]}],"gradient-via-pos":[{via:[g]}],"gradient-to-pos":[{to:[g]}],"gradient-from":[{from:[p]}],"gradient-via":[{via:[p]}],"gradient-to":[{to:[p]}],rounded:[{rounded:[i]}],"rounded-s":[{"rounded-s":[i]}],"rounded-e":[{"rounded-e":[i]}],"rounded-t":[{"rounded-t":[i]}],"rounded-r":[{"rounded-r":[i]}],"rounded-b":[{"rounded-b":[i]}],"rounded-l":[{"rounded-l":[i]}],"rounded-ss":[{"rounded-ss":[i]}],"rounded-se":[{"rounded-se":[i]}],"rounded-ee":[{"rounded-ee":[i]}],"rounded-es":[{"rounded-es":[i]}],"rounded-tl":[{"rounded-tl":[i]}],"rounded-tr":[{"rounded-tr":[i]}],"rounded-br":[{"rounded-br":[i]}],"rounded-bl":[{"rounded-bl":[i]}],"border-w":[{border:[c]}],"border-w-x":[{"border-x":[c]}],"border-w-y":[{"border-y":[c]}],"border-w-s":[{"border-s":[c]}],"border-w-e":[{"border-e":[c]}],"border-w-t":[{"border-t":[c]}],"border-w-r":[{"border-r":[c]}],"border-w-b":[{"border-b":[c]}],"border-w-l":[{"border-l":[c]}],"border-opacity":[{"border-opacity":[y]}],"border-style":[{border:[...T(),"hidden"]}],"divide-x":[{"divide-x":[c]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[c]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[y]}],"divide-style":[{divide:T()}],"border-color":[{border:[o]}],"border-color-x":[{"border-x":[o]}],"border-color-y":[{"border-y":[o]}],"border-color-s":[{"border-s":[o]}],"border-color-e":[{"border-e":[o]}],"border-color-t":[{"border-t":[o]}],"border-color-r":[{"border-r":[o]}],"border-color-b":[{"border-b":[o]}],"border-color-l":[{"border-l":[o]}],"divide-color":[{divide:[o]}],"outline-style":[{outline:["",...T()]}],"outline-offset":[{"outline-offset":[G,N]}],"outline-w":[{outline:[G,Y]}],"outline-color":[{outline:[e]}],"ring-w":[{ring:D()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[e]}],"ring-opacity":[{"ring-opacity":[y]}],"ring-offset-w":[{"ring-offset":[G,Y]}],"ring-offset-color":[{"ring-offset":[e]}],shadow:[{shadow:["","inner","none",K,un]}],"shadow-color":[{shadow:[oe]}],opacity:[{opacity:[y]}],"mix-blend":[{"mix-blend":[...Q(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":Q()}],filter:[{filter:["","none"]}],blur:[{blur:[n]}],brightness:[{brightness:[s]}],contrast:[{contrast:[d]}],"drop-shadow":[{"drop-shadow":["","none",K,N]}],grayscale:[{grayscale:[f]}],"hue-rotate":[{"hue-rotate":[m]}],invert:[{invert:[w]}],saturate:[{saturate:[R]}],sepia:[{sepia:[C]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[n]}],"backdrop-brightness":[{"backdrop-brightness":[s]}],"backdrop-contrast":[{"backdrop-contrast":[d]}],"backdrop-grayscale":[{"backdrop-grayscale":[f]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[m]}],"backdrop-invert":[{"backdrop-invert":[w]}],"backdrop-opacity":[{"backdrop-opacity":[y]}],"backdrop-saturate":[{"backdrop-saturate":[R]}],"backdrop-sepia":[{"backdrop-sepia":[C]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[l]}],"border-spacing-x":[{"border-spacing-x":[l]}],"border-spacing-y":[{"border-spacing-y":[l]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",N]}],duration:[{duration:B()}],ease:[{ease:["linear","in","out","in-out",N]}],delay:[{delay:B()}],animate:[{animate:["none","spin","ping","pulse","bounce",N]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[b]}],"scale-x":[{"scale-x":[b]}],"scale-y":[{"scale-y":[b]}],rotate:[{rotate:[se,N]}],"translate-x":[{"translate-x":[S]}],"translate-y":[{"translate-y":[S]}],"skew-x":[{"skew-x":[$]}],"skew-y":[{"skew-y":[$]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",N]}],accent:[{accent:["auto",e]}],appearance:[{appearance:["none","auto"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",N]}],"caret-color":[{caret:[e]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":I()}],"scroll-mx":[{"scroll-mx":I()}],"scroll-my":[{"scroll-my":I()}],"scroll-ms":[{"scroll-ms":I()}],"scroll-me":[{"scroll-me":I()}],"scroll-mt":[{"scroll-mt":I()}],"scroll-mr":[{"scroll-mr":I()}],"scroll-mb":[{"scroll-mb":I()}],"scroll-ml":[{"scroll-ml":I()}],"scroll-p":[{"scroll-p":I()}],"scroll-px":[{"scroll-px":I()}],"scroll-py":[{"scroll-py":I()}],"scroll-ps":[{"scroll-ps":I()}],"scroll-pe":[{"scroll-pe":I()}],"scroll-pt":[{"scroll-pt":I()}],"scroll-pr":[{"scroll-pr":I()}],"scroll-pb":[{"scroll-pb":I()}],"scroll-pl":[{"scroll-pl":I()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",N]}],fill:[{fill:[e,"none"]}],"stroke-w":[{stroke:[G,Y,ue]}],stroke:[{stroke:[e,"none"]}],sr:["sr-only","not-sr-only"],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]}}},gn=Xt(mn);function Ke(...e){return gn(Je.clsx(e))}function bn({autoWidth:e=!0,className:t,style:n}){const[s,o]=u.useState(()=>V.getActiveAppId()),[i,l]=u.useState(()=>L.getRunningApps()),{isMobile:c}=ve();u.useEffect(()=>{const h=V.subscribe("activeAppId",y=>{o(y)});return()=>{h()}},[]),u.useEffect(()=>L.subscribe(()=>{l(L.getRunningApps())}),[]),u.useEffect(()=>{if(!new URLSearchParams(window.location.search).has("app")){const j=V.getActiveAppId();j&&!L.isRunning(j)&&L.launchApp(j)}},[]);const d=h=>{L.closeApp(h)},f=s?J.get(s):null,w=(f==null?void 0:f.width)??400,a=s!==null,v={...{overflow:"hidden",display:a?"flex":"none",flexDirection:"column",flexShrink:0,...e&&a?{width:c?"100%":w}:{}},...n};return r.jsx("div",{className:Ke("nc-app-panel",t),style:v,children:i.map(h=>r.jsx(xe,{appId:h.appId,isActive:s===h.appId,onClose:()=>d(h.appId)},h.appId))})}function xn({pinnedAppIds:e,className:t=""}){const{isMobile:n}=ve(),[s,o]=u.useState(()=>V.getActiveAppId()),[i,l]=u.useState(()=>L.getRunningApps());u.useEffect(()=>{const a=V.subscribe("activeAppId",p=>{o(p)});return()=>{a()}},[]),u.useEffect(()=>L.subscribe(()=>{l(L.getRunningApps())}),[]);const c=a=>{s===a?L.setActiveApp(null):L.launchApp(a)},d=e.map(a=>J.get(a)).filter(a=>!!a),f=i.filter(a=>!e.includes(a.appId)).map(a=>({running:a,def:J.get(a.appId)})).filter(a=>!!a.def),m=a=>i.some(p=>p.appId===a),w=n?24:28;return r.jsxs("div",{className:`nc-app-taskbar ${n?"nc-mobile":"nc-desktop"} ${t}`,children:[d.map(a=>{const p=a.icon,g=s===a.id,v=m(a.id);return r.jsxs("button",{className:`nc-app-taskbar-button ${g?"nc-active":""} ${v?"nc-running":""}`,onClick:()=>c(a.id),title:a.titleKey||a.id,children:[r.jsx(p,{size:w}),v&&r.jsx("span",{className:"nc-app-taskbar-indicator"})]},a.id)}),f.length>0&&r.jsx("div",{className:"nc-app-taskbar-separator"}),f.map(({running:a,def:p})=>{const g=p.icon,v=s===a.appId;return r.jsxs("button",{className:`nc-app-taskbar-button ${v?"nc-active":""} nc-running`,onClick:()=>c(a.appId),title:p.titleKey||p.id,children:[r.jsx(g,{size:w}),r.jsx("span",{className:"nc-app-taskbar-indicator"})]},a.appId)})]})}function vn({appId:e,open:t,onClose:n,closeOnBackdrop:s=!1,className:o="",style:i}){const l=d=>{s&&d.target===d.currentTarget&&n()};if(!t)return null;const c=r.jsx("div",{className:"nc-dialog-overlay nc-fullscreen",onClick:l,children:r.jsx("div",{className:`nc-app-dialog-container ${o}`,style:i,onClick:d=>d.stopPropagation(),children:r.jsx(xe,{appId:e,isActive:!0,onClose:n})})});return ae.createPortal(c,document.body)}const ye=u.createContext(null),qe=u.createContext(null);function wn(){const e=u.useContext(ye);if(!e)throw new Error("useNavStack must be used within a NavStackProvider");return e}function yn(){const e=u.useContext(qe);if(!e)throw new Error("useNavView must be used within NavStack");return e}const je=u.createContext(null);function jn({rootView:e,children:t}){const{t:n}=q.useTranslation(),s=Le(),[o,i]=u.useState([e]),[l,c]=u.useState([null]),d=u.useCallback((b,C)=>{c($=>{const x=[...$];return x[b]=C,x})},[]),f=u.useCallback(b=>{c(C=>{const $=[...C];return $[b]=null,$})},[]),m=u.useCallback(b=>{i(C=>[...C,b]),c(C=>[...C,null])},[]),w=u.useCallback(()=>{i(b=>b.length<=1?b:b.slice(0,-1)),c(b=>b.slice(0,-1))},[]),a=u.useCallback(()=>{i([e]),c([null])},[e]),p=o.length,g=p>1,v=o.length-1,h=o[o.length-1],y=h!=null&&h.titleKey?n(h.titleKey):(h==null?void 0:h.title)??"";u.useEffect(()=>{s.setTitle(y)},[y,s]),u.useEffect(()=>{g?s.setBackHandler(w):s.clearBackHandler()},[g,w,s]),u.useEffect(()=>{const b=l[l.length-1];b?s.setToolbar(b):s.clearToolbar()},[l,s]);const j={push:m,pop:w,reset:a,depth:p,canGoBack:g,currentTitle:y},R={stack:o,toolbarStack:l,updateToolbar:d,clearToolbarAt:f,topIndex:v};return r.jsx(ye.Provider,{value:j,children:r.jsx(je.Provider,{value:R,children:t})})}function kn({index:e,children:t}){const n=u.useContext(je);if(!n)throw new Error("NavViewProvider must be used within NavStackProvider");const{updateToolbar:s,clearToolbarAt:o,topIndex:i}=n,l=u.useCallback(f=>{e===i&&s(e,f)},[e,i,s]),c=u.useCallback(()=>{e===i&&o(e)},[e,i,o]),d={setToolbar:l,clearToolbar:c};return r.jsx(qe.Provider,{value:d,children:t})}function Nn(){const e=u.useContext(ye),t=u.useContext(je);if(!e||!t)throw new Error("NavStackContainer must be used within a NavStackProvider");const{stack:n}=t;return r.jsx("div",{className:"nav-stack-container",children:r.jsx("div",{className:"nav-stack-content",children:n.map((s,o)=>{const i=o===n.length-1;return r.jsx(kn,{index:o,children:r.jsx("div",{style:{display:i?"flex":"none",flexDirection:"column",height:"100%"},children:s.component})},s.id)})})})}exports.ActivityIndicator=me;exports.Alert=Qe;exports.AppContainer=xe;exports.AppContext=be;exports.AppDialog=vn;exports.AppPanel=bn;exports.AppTaskbar=xn;exports.AppTitleBar=De;exports.Battery=Ze;exports.Button=H;exports.ButtonGroup=et;exports.Checkbox=nt;exports.CloseButton=ge;exports.ComboBox=at;exports.ContextMenu=pt;exports.Dialog=ft;exports.DialogClose=U;exports.EditButton=lt;exports.Hyperlink=ut;exports.Input=gt;exports.ListGroup=xt;exports.ListGroupItem=bt;exports.MonthRangePicker=wt;exports.MultiSelect=vt;exports.NavStackContainer=Nn;exports.NavStackProvider=jn;exports.Notification=Be;exports.NotificationContainer=Rt;exports.NumberInput=yt;exports.RefreshButton=ct;exports.Slider=jt;exports.TabPanel=Te;exports.TabPanels=Nt;exports.Tabs=St;exports.Toggle=At;exports.TrashButton=dt;exports.ViewportProvider=Lt;exports.appRegistry=J;exports.appStateStore=V;exports.cn=Ke;exports.createAppI18nFactory=Mt;exports.notificationManager=Et;exports.runningAppsStore=L;exports.useApp=Le;exports.useDialog=Pe;exports.useNavStack=wn;exports.useNavView=yn;exports.useViewport=ve;
|
|
1
|
+
"use strict";var _e=Object.defineProperty;var Ue=(e,t,n)=>t in e?_e(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var O=(e,t,n)=>Ue(e,typeof t!="symbol"?t+"":t,n);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),u=require("react"),ae=require("react-dom"),q=require("react-i18next"),W=require("./GeneratedIcons-CGjL38ny.cjs"),Xe=require("i18next"),Je=require("./clsx-C11secjj.cjs");function me({size:e="default",color:t,overlay:n=!1,className:s=""}){const o=r.jsx("svg",{className:`nc-activity-indicator nc-${e} ${s}`,viewBox:"0 0 50 50",style:t?{color:t}:void 0,children:r.jsx("circle",{className:"nc-activity-indicator-circle",cx:"25",cy:"25",r:"20",fill:"none",stroke:"currentColor",strokeWidth:"5",strokeLinecap:"round"})});return n?r.jsx("div",{className:"nc-activity-indicator-overlay",children:o}):o}function H({variant:e="default",block:t,size:n="default",className:s,disabled:o,textSelectable:i,loading:l,onClick:c,children:d,...f}){const m=["nc-button",e!=="default"?`nc-${e}`:"",t?"nc-block":"",n==="small"?"nc-small":"",n==="large"?"nc-large":"",o||l?"nc-disabled":"",i?"nc-text-selectable":"",l?"nc-loading":"",s??""].filter(Boolean).join(" "),w=a=>{if(!l){if(i){const p=window.getSelection();if(p&&p.toString().length>0)return}c==null||c(a)}};return r.jsxs("button",{className:m,disabled:o||l,onClick:w,...f,children:[l&&r.jsx(me,{size:"small",className:"nc-button-spinner",color:e!=="default"&&e!=="ghost"?"white":void 0}),d]})}function Qe({code:e,text:t,type:n,button:s,onAction:o}){return r.jsxs("div",{className:`nc-alert nc-${n}`,children:[r.jsxs("span",{className:`nc-alert-message nc-${n}`,children:[r.jsx("span",{className:"nc-alert-code",children:e}),t]}),s&&r.jsx("span",{className:"nc-alert-action",children:r.jsx(H,{size:"small",variant:s.variant??(n==="error"?"danger":"warning"),onClick:o,children:s.text})})]})}function Ze({percentage:e=.5,status:t="discharging",darkMode:n=!1,colored:s=!1}){const o=Math.max(0,Math.min(1,Number(e)||0));let i;s?o<.1?i="var(--nc-danger)":o<.2?i="var(--nc-warning)":i="var(--nc-success)":i=n?"#ffffff":"#000000";const l=n?"rgba(255, 255, 255, 0.5)":"rgba(0, 0, 0, 0.2)",c=24,d=14,f=2,m=0,w=12,a=0,p=0,g=0,v=c,h=d,y=h-a*2,j=v-a*2,R=Math.max(1,Math.min(4,h/4)),b=o===0?0:.05+o*.95,C=c+f+w,$=20,x=.65,S=Math.max(d,$*x),k=c+f+1,E=(d-$*x)/2;return r.jsxs("svg",{className:"nc-battery",width:C,height:S,viewBox:`0 0 ${C} ${S}`,role:"img","aria-label":`Battery ${o===0?"-":Math.round(o*100)+"%"} ${t}`,children:[r.jsxs("defs",{children:[r.jsx("mask",{id:`nc-battery-fill-mask-${o}`,children:r.jsx("rect",{x:"0",y:"0",width:j*b,height:y,fill:"white"})}),r.jsxs("mask",{id:`nc-battery-text-mask-${o}`,children:[r.jsx("rect",{x:"0",y:"0",width:C,height:S,fill:"white"}),r.jsx("text",{x:p+v/2,y:d-3,fontSize:11,fontWeight:"bold",fill:"black",textAnchor:"middle",children:o===0?"-":Math.round(o*100)})]})]}),r.jsxs("g",{mask:`url(#nc-battery-text-mask-${o})`,children:[r.jsx("rect",{x:p,y:g,rx:R,ry:R,width:v,height:h,fill:l}),r.jsx("rect",{x:p+a,y:g+a,width:j,height:y,fill:i,rx:R,ry:R,mask:`url(#nc-battery-fill-mask-${o})`}),r.jsx("rect",{x:c+m,y:d*.26,width:f,height:d*.48,rx:.8,ry:.8,fill:o===1?i:l}),t==="charging"?r.jsx("g",{transform:`translate(${k}, ${E}) scale(${x})`,fill:i,children:r.jsx("path",{d:"M10 0 L2 11 H8 L5 20 L14 8 H8 L10 0 Z"})}):null]})]})}function et({value:e,onChange:t,options:n,disabled:s,labels:o,size:i="default"}){return r.jsx("div",{className:`nc-button-group ${i==="small"?"nc-small":""}`,children:n.map((l,c)=>r.jsx("button",{className:`nc-button-group-item ${e===l?"nc-active":""} ${c<n.length-1?"nc-has-border":""}`,onClick:()=>!s&&t(l),disabled:s,children:o&&o[l]?o[l]:l},l))})}function tt({size:e}){return r.jsx("svg",{className:`nc-checkbox-icon ${e==="small"?"nc-small":""}`,viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:r.jsx("path",{d:"M2 6L5 9L10 3",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}function nt({checked:e,onChange:t,disabled:n,label:s,size:o="default",labelColor:i,style:l,className:c=""}){const d=o==="small";return r.jsxs("label",{className:`nc-checkbox-label ${d?"nc-small":""} ${n?"nc-disabled":""} ${c}`.trim(),style:l,onClick:f=>{n||(f.preventDefault(),t(!e))},children:[r.jsx("span",{role:"checkbox","aria-checked":e,tabIndex:0,className:`nc-checkbox-box ${d?"nc-small":""} ${e?"nc-checked":""}`,onKeyDown:f=>{n||(f.key==="Enter"||f.key===" ")&&(f.preventDefault(),t(!e))},children:e&&r.jsx(tt,{size:o})}),s&&r.jsx("span",{className:"nc-checkbox-text",style:i?{color:i}:void 0,children:s})]})}function rt({option:e,onChange:t,selected:n,highlighted:s,small:o}){const i=u.useRef(null),{t:l}=q.useTranslation();return u.useEffect(()=>{s&&i.current&&i.current.scrollIntoView({block:"nearest"})},[s]),r.jsxs("div",{ref:i,className:`nc-combo-dropdown-option ${o?"nc-small":""} ${s?"nc-highlighted":""}`,role:"option",onMouseDown:()=>t(e.value),"aria-selected":n,style:{cursor:"pointer",background:s?"rgba(59,130,246,0.18)":n?"rgba(59,130,246,0.12)":void 0},children:[e.label,e.default&&r.jsxs("span",{style:{fontSize:"0.85em",color:"var(--nc-text-weak)",marginLeft:6},children:["(",l("common.default"),")"]})]})}function st({isOpen:e,options:t,onSelect:n,selectedValue:s,placement:o="bottom",anchorRef:i,small:l,highlightedIndex:c=-1}){const[d,f]=u.useState({top:0,left:0,width:0}),[m,w]=u.useState(o),{t:a}=q.useTranslation();if(u.useEffect(()=>{if(e&&i.current){const g=i.current.getBoundingClientRect();let v=o;if(o==="bottom"){const h=window.innerHeight-g.bottom,y=g.top;h<320&&y>h&&(v="top")}w(v),f({top:v==="top"?g.top-4:g.bottom+4,left:g.left,width:g.width})}},[e,i,o]),!e)return null;const p=r.jsx("div",{className:"nc-combo-dropdown",style:{position:"fixed",top:m==="top"?void 0:d.top,bottom:m==="top"?window.innerHeight-d.top:void 0,left:d.left,width:d.width,zIndex:1e3,maxHeight:300,overflowY:"auto"},children:t.length===0?r.jsx("div",{className:`nc-combo-dropdown-option nc-no-results ${l?"nc-small":""}`,children:a("common.noResults")}):t.map((g,v)=>r.jsx(rt,{option:g,onChange:n,selected:g.value===s,highlighted:v===c,small:l},g.value))});return ae.createPortal(p,document.body)}function ot({onClick:e,small:t}){return r.jsx("button",{className:`nc-button nc-ghost nc-combo-button nc-combo-clear ${t?"nc-small":""}`,onClick:e,onMouseDown:n=>n.stopPropagation(),"aria-label":"Clear selection",children:"✕"})}function it({open:e,onClick:t,small:n}){return r.jsx("button",{className:`nc-button nc-ghost nc-combo-button nc-combo-toggle ${n?"nc-small":""} ${e?"nc-open":""}`,onClick:t,onMouseDown:s=>s.stopPropagation(),"aria-label":e?"Close":"Open",children:"▾"})}function at({value:e,onChange:t,placeholder:n="Select…",options:s,disabled:o,label:i,clearable:l=!0,allowTyping:c=!1,placement:d="bottom",size:f="default",style:m,className:w}){const[a,p]=u.useState(!1),[g,v]=u.useState(""),[h,y]=u.useState(-1),j=u.useRef(null),R=u.useRef(null),b=f==="small",{t:C}=q.useTranslation(),$=u.useMemo(()=>{const A=g.toLowerCase();return c?s.filter(M=>M.label.toLowerCase().includes(A)):s},[s,g,c]);u.useEffect(()=>{a&&y(-1)},[a,$]),u.useEffect(()=>{if(!l&&!e&&s.length>0&&t){const A=s.find(M=>M.default)||s[0];t(A.value)}},[l,e,s,t]),u.useEffect(()=>{function A(M){var T;M.target instanceof Node&&j.current&&((T=j.current.parentElement)!=null&&T.contains(M.target)||p(!1))}return document.addEventListener("mousedown",A),()=>document.removeEventListener("mousedown",A)},[]);const x=s.find(A=>A.value===e),S=x&&l,k=!o&&!S,E=!(a&&c)&&!!x,z=(A,M=!1)=>{var T;t==null||t(A),p(!1),v(""),M&&((T=j.current)==null||T.blur())},I=()=>{t==null||t(void 0),v(""),p(!1)},D=A=>{if(!a){(A.key==="ArrowDown"||A.key==="ArrowUp")&&(p(!0),A.preventDefault());return}switch(A.key){case"ArrowDown":A.preventDefault(),y(M=>{const T=M+1;return T>=$.length?0:T});break;case"ArrowUp":A.preventDefault(),y(M=>{const T=M-1;return T<0?$.length-1:T});break;case"Enter":A.preventDefault(),h>=0&&h<$.length&&z($[h].value,!0);break;case"Escape":A.preventDefault(),p(!1),v("");break}};return r.jsxs("div",{className:`nc-combo-container ${w||""}`.trim(),style:{position:"relative",...m},children:[i&&r.jsx("span",{className:`nc-label ${b?"nc-small":""}`,children:i}),r.jsxs("div",{ref:R,style:{position:"relative",display:"flex",alignItems:"center"},onMouseDown:A=>{o||c&&A.target===j.current||(p(M=>(!M&&c&&x&&v(x.label),!M)),c&&!a&&setTimeout(()=>{var M,T;(M=j.current)==null||M.focus(),(T=j.current)==null||T.select()},0))},children:[r.jsx("input",{ref:j,className:`nc-input ${b?"nc-small":""}`,placeholder:n,onFocus:()=>{var A;!o&&c&&(p(!0),x&&(v(x.label),setTimeout(()=>{var M;return(M=j.current)==null?void 0:M.select()},0))),c||(A=j.current)==null||A.blur()},onChange:A=>c&&v(A.target.value),onKeyDown:D,value:a&&c?g:(x==null?void 0:x.label)||"",readOnly:o||!c,style:{width:"100%",paddingRight:k||S?b?32:44:12,caretColor:c?void 0:"transparent",cursor:c?void 0:"pointer",userSelect:c?void 0:"none",color:E?"transparent":"var(--nc-text)"}}),E&&r.jsxs("div",{"aria-hidden":!0,style:{position:"absolute",left:b?8:12,right:k||S?b?12:24:b?8:12,top:"50%",transform:"translateY(-50%)",pointerEvents:"none",display:"flex",alignItems:"center",gap:6,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:[r.jsx("span",{className:`nc-combo-overlay-text ${b?"nc-small":""}`,children:x==null?void 0:x.label}),(x==null?void 0:x.default)&&r.jsxs("span",{className:`nc-combo-overlay-default ${b?"nc-small":""}`,children:["(",C("common.default"),")"]})]}),S&&r.jsx(ot,{onClick:I,small:b}),k&&r.jsx(it,{open:a,onClick:()=>p(A=>!A),small:b})]}),r.jsx(st,{isOpen:a,options:$,onSelect:z,selectedValue:e,placement:d,anchorRef:R,small:b,highlightedIndex:h})]})}function ct({onClick:e,loading:t=!1,disabled:n=!1,size:s="default",title:o,"aria-label":i}){const l=s==="small"?14:s==="large"?20:18,c=t?"Refreshing...":"Refresh",d=t?"Refreshing":"Refresh";return r.jsx("button",{className:"nc-icon-button",onClick:e,disabled:n||t,title:o??c,"aria-label":i??d,"data-size":s,children:r.jsx(W.RefreshIcon,{size:l,className:t?"nc-spinning":""})})}function ge({onClick:e,disabled:t=!1,size:n="default",title:s="Close","aria-label":o="Close"}){const i=n==="small"?14:n==="large"?20:18;return r.jsx("button",{className:"nc-icon-button nc-icon-button-close",onClick:e,disabled:t,title:s,"aria-label":o,"data-size":n,children:r.jsx(W.CloseIcon,{size:i})})}function lt({onClick:e,disabled:t=!1,size:n="default",title:s="Edit","aria-label":o="Edit"}){const i=n==="small"?14:n==="large"?20:18;return r.jsx("button",{className:"nc-icon-button nc-icon-button-edit",onClick:e,disabled:t,title:s,"aria-label":o,"data-size":n,children:r.jsx(W.EditIcon,{size:i})})}function dt({onClick:e,disabled:t=!1,size:n="default",title:s="Delete","aria-label":o="Delete"}){const i=n==="small"?14:n==="large"?20:18;return r.jsx("button",{className:"nc-icon-button nc-icon-button-trash",onClick:e,disabled:t,title:s,"aria-label":o,"data-size":n,children:r.jsx(W.TrashIcon,{size:i})})}function ut({onClick:e,disabled:t=!1,children:n,title:s,"aria-label":o,size:i="default"}){return r.jsx("button",{className:"nc-hyperlink",onClick:e,disabled:t,title:s,"aria-label":o,"data-size":i,children:n})}function pt({open:e,onClose:t,options:n,anchorRef:s,anchor:o,preferredDirection:i="down"}){const l=u.useRef(null),[c,d]=u.useState({top:0,left:0}),f=o||(s==null?void 0:s.current);if(u.useEffect(()=>{if(!e||!f||!l.current)return;const a=f.getBoundingClientRect(),p=l.current.getBoundingClientRect(),g=window.innerHeight,v=window.innerWidth,h=a.bottom+8,y=h+p.height<=g-8;let j=i;(!y&&i==="down"||i==="up"&&y)&&(j="up");let R;j==="down"?R=h:R=a.top-p.height-8;let b=a.left;b+p.width>v-8&&(b=a.right-p.width),d({top:Math.max(8,R),left:Math.max(8,b)})},[e,f,i]),u.useEffect(()=>{if(!e)return;const a=g=>{l.current&&!l.current.contains(g.target)&&f&&!f.contains(g.target)&&t()},p=g=>{g.key==="Escape"&&t()};return document.addEventListener("mousedown",a),document.addEventListener("keydown",p),()=>{document.removeEventListener("mousedown",a),document.removeEventListener("keydown",p)}},[e,t,f]),!e)return null;const m=a=>{a.type!=="separator"&&!a.disabled&&a.onClick&&(a.onClick(),t())},w=n.some(a=>a.icon);return ae.createPortal(r.jsx("div",{ref:l,className:"nc-context-menu",style:{position:"fixed",top:`${c.top}px`,left:`${c.left}px`,zIndex:1e4},role:"menu",children:n.map(a=>{if(a.type==="separator")return r.jsx("div",{className:"nc-context-menu-separator",role:"separator"},a.id);const p=["nc-context-menu-item",a.variant&&a.variant!=="default"?`nc-${a.variant}`:"",a.disabled?"nc-disabled":"",w&&!a.icon?"nc-indented":""].filter(Boolean).join(" ");return r.jsxs("button",{className:p,onClick:()=>m(a),disabled:a.disabled,role:"menuitem",children:[a.icon&&r.jsx("span",{className:"nc-context-menu-icon",children:a.icon}),r.jsx("span",{className:"nc-context-menu-label",children:a.label})]},a.id)})}),document.body)}const $e=u.createContext(null);function Pe(){const e=u.useContext($e);if(!e)throw new Error("useDialog must be used inside a Dialog component");return e}function U({children:e,onClick:t,...n}){const{close:s}=Pe(),{t:o}=q.useTranslation(),i=l=>{t==null||t(l),s()};return r.jsx(H,{onClick:i,...n,children:e??o("common.close")})}function ft({open:e,onClose:t,title:n,children:s,style:o,footerType:i="ok-cancel",footer:l,onOk:c,onSave:d,onDelete:f,onCancel:m,onConnect:w,closeOnOverlay:a=!0,primaryDisabled:p=!1,fullScreen:g=!1,hideTitleBar:v=!1,className:h="",onContentHeightChange:y}){const j=u.useRef(null),R=u.useRef(null),{t:b}=q.useTranslation(),C={close:t},$=k=>{a&&k.target===k.currentTarget&&t()};if(u.useEffect(()=>{e&&j.current&&j.current.focus()},[e]),u.useEffect(()=>{if(!y||!R.current)return;const k=new ResizeObserver(E=>{for(const z of E){const I=z.contentRect.height;y(I)}});return k.observe(R.current),()=>{k.disconnect()}},[y]),!e)return null;const x=()=>{switch(i){case"ok":return r.jsx("div",{className:"nc-dialog-footer",children:r.jsx(H,{variant:"primary",onClick:c??t,disabled:p,children:b("common.ok")})});case"ok-cancel":return r.jsxs("div",{className:"nc-dialog-footer",children:[r.jsx(H,{variant:"primary",onClick:c??t,disabled:p,children:b("common.ok")}),r.jsx(U,{onClick:m,children:b("common.cancel")})]});case"save-cancel":return r.jsxs("div",{className:"nc-dialog-footer",children:[r.jsx(H,{variant:"primary",onClick:d,disabled:p,children:b("common.save")}),r.jsx(U,{onClick:m,children:b("common.cancel")})]});case"delete-cancel":return r.jsxs("div",{className:"nc-dialog-footer",children:[r.jsx(H,{variant:"danger",onClick:f,disabled:p,children:b("common.delete")}),r.jsx(U,{onClick:m,children:b("common.cancel")})]});case"connect":return r.jsxs("div",{className:"nc-dialog-footer",children:[r.jsx(H,{variant:"primary",onClick:w,disabled:p,children:b("common.connect")}),r.jsx(U,{onClick:m,children:b("common.cancel")})]});case"close":return r.jsx("div",{className:"nc-dialog-footer",children:r.jsx(U,{variant:"primary"})});case"gotit":return r.jsx("div",{className:"nc-dialog-footer",children:r.jsx(U,{variant:"primary",children:b("common.gotit")})});case"custom":return r.jsx("div",{className:"nc-dialog-footer",children:l});case"none":return null;default:return null}},S=r.jsx($e.Provider,{value:C,children:r.jsx("div",{className:`nc-dialog-overlay${g?" nc-fullscreen":""}`,onClick:$,children:r.jsxs("div",{ref:j,className:`nc-dialog-container ${h}`,style:o,tabIndex:-1,role:"dialog","aria-modal":"true","aria-labelledby":v?void 0:"nc-dialog-title",children:[!v&&r.jsxs("div",{className:"nc-dialog-header",children:[r.jsx("h3",{id:"nc-dialog-title",className:"nc-dialog-title",children:n}),r.jsx(ge,{onClick:t,"aria-label":"Close dialog"})]}),r.jsx("div",{ref:R,className:"nc-dialog-content",children:s}),x()]})})});return g?ae.createPortal(S,document.body):S}function ht({onClick:e,size:t="default",rightOffset:n=4}){const s=t==="small"?28:34;return r.jsx("button",{className:"nc-button nc-ghost",onClick:e,onMouseDown:o=>{o.preventDefault(),o.stopPropagation()},tabIndex:-1,"aria-label":"Clear input",style:{position:"absolute",right:n,padding:0,minHeight:0,height:s,width:s,border:"none",display:"flex",alignItems:"center",justifyContent:"center",fontSize:t==="small"?"12px":"14px"},children:"✕"})}function mt({visible:e,onClick:t,size:n="default"}){const s=n==="small"?28:34,o=n==="small"?16:18;return r.jsx("button",{className:"nc-button nc-ghost",onClick:t,onMouseDown:i=>{i.preventDefault(),i.stopPropagation()},tabIndex:-1,"aria-label":e?"Hide password":"Show password",style:{position:"absolute",right:4,padding:0,minHeight:0,height:s,width:s,border:"none",display:"flex",alignItems:"center",justifyContent:"center"},children:e?r.jsx(W.EyeHiddenIcon,{size:o}):r.jsx(W.ViewIcon,{size:o})})}function gt({value:e,defaultValue:t="",onChange:n,onEnter:s,onClear:o,placeholder:i,disabled:l,label:c,clearable:d=!0,type:f="text",className:m="",size:w="default",style:a,showPasswordToggle:p=!1,multiline:g=!1,rows:v=3,validator:h,showErrorMessage:y=!0}){const j=u.useRef(null),R=u.useRef(null),[b,C]=u.useState(!1),[$,x]=u.useState(!1),S=e!==void 0,[k,E]=u.useState(t),z=S?e:k,I=h?h(z):null,D=!!I,A=f==="password",M=A&&p&&!l&&!g,T=d&&z&&!l&&$,Q=w==="small"?32:44;let F=12;T&&M?F=Q*2:(T||M)&&(F=Q);const _=()=>{var Z,re;S||E(""),n==null||n(""),o==null||o(),g?(Z=R.current)==null||Z.focus():(re=j.current)==null||re.focus()},ne=Z=>{Z.key==="Enter"&&!g&&(s==null||s())},B=Z=>{const re=Z.target.value;S||E(re),n==null||n(re)},ke=()=>{x(!0)},Ne=()=>{x(!1)},Se=`nc-input ${w==="small"?"nc-small ":""} ${D?"nc-error ":""}${m}`;return r.jsxs("div",{className:"nc-col",style:{position:"relative",flex:1,...a},children:[c&&r.jsx("span",{className:"nc-label",children:c}),r.jsxs("div",{style:{position:"relative",display:"flex",alignItems:g?"flex-start":"center"},children:[g?r.jsx("textarea",{ref:R,className:Se,placeholder:i,value:z,onChange:B,onKeyDown:ne,onFocus:ke,onBlur:Ne,disabled:l,rows:v,style:{width:"100%",paddingRight:F}}):r.jsx("input",{ref:j,type:A&&b?"text":f,className:Se,placeholder:i,value:z,onChange:B,onKeyDown:ne,onFocus:ke,onBlur:Ne,disabled:l,style:{width:"100%",paddingRight:F}}),T&&r.jsx(ht,{onClick:_,size:w,rightOffset:M?Q+4:4}),M&&r.jsx(mt,{visible:b,onClick:()=>C(!b),size:w})]}),D&&y&&r.jsx("span",{className:"nc-error-message",children:I})]})}function bt({children:e,onClick:t,showBorder:n=!0,selectable:s=!1,style:o}){const[i,l]=u.useState(!1),c=d=>{if(t){if(s){const f=window.getSelection();if(f&&f.toString().length>0)return}t(d)}};return r.jsx("div",{onClick:c,onMouseDown:()=>t&&l(!0),onMouseUp:()=>l(!1),onMouseLeave:()=>l(!1),style:{cursor:t?"pointer":"default",userSelect:s?"text":void 0,borderBottom:n?void 0:"none",...o},className:`nc-list-group-item ${t?"nc-list-group-item-clickable":""} ${i?"nc-list-group-item-active":""}`,children:r.jsx("div",{style:{flex:1},children:e})})}function xt({title:e,titleTools:t,children:n,style:s}){return r.jsxs("div",{className:"nc-list-group",style:s,children:[(e||t)&&r.jsxs("div",{className:"nc-list-group-title",children:[r.jsx("div",{children:e}),t&&r.jsx("div",{className:"nc-list-group-title-tools",children:t})]}),r.jsx("div",{className:"nc-list-group-content",children:n})]})}function vt({values:e,onChange:t,options:n,placeholder:s="Select…",label:o}){const[i,l]=u.useState(!1),[c,d]=u.useState(""),f=u.useRef(null),m=u.useMemo(()=>n.filter(a=>a.label.toLowerCase().includes(c.toLowerCase())),[n,c]);u.useEffect(()=>{function a(p){!(p.target instanceof Node)||!f.current||f.current.contains(p.target)||l(!1)}return document.addEventListener("mousedown",a),()=>document.removeEventListener("mousedown",a)},[]);const w=a=>{e.includes(a)?t(e.filter(p=>p!==a)):t([...e,a])};return r.jsxs("div",{ref:f,className:"nc-col",style:{position:"relative"},children:[o&&r.jsx("span",{className:"nc-label",children:o}),r.jsxs("div",{className:"nc-row",style:{flexWrap:"wrap",gap:6,minHeight:42,alignItems:"center",border:"1px solid var(--nc-button-border)",borderRadius:8,background:"var(--nc-button-bg)",padding:"4px 8px"},children:[e.length===0&&r.jsx("span",{className:"nc-label",children:s}),e.map(a=>{const p=n.find(g=>g.value===a);return p?r.jsxs("span",{style:{padding:"4px 8px",borderRadius:6,display:"inline-flex",alignItems:"center",gap:4,background:"var(--nc-button-bg)",border:"1px solid var(--nc-button-border)"},children:[p.label,r.jsx("button",{className:"nc-button nc-ghost",style:{padding:0,minHeight:0,height:20,width:20,display:"inline-flex",alignItems:"center",justifyContent:"center",border:"none"},onClick:()=>w(a),"aria-label":`Remove ${p.label}`,children:"✕"})]},a):null}),r.jsx("input",{className:"nc-input",value:c,onChange:a=>d(a.target.value),onFocus:()=>l(!0),style:{minWidth:50,border:"none",background:"transparent",padding:4,minHeight:32,flex:1}})]}),i&&r.jsxs("div",{className:"nc-combo-dropdown",style:{position:"absolute",top:"100%",left:0,right:0,zIndex:10,marginTop:4,boxShadow:"0 4px 12px var(--nc-shadow)"},children:[m.map(a=>{const p=e.includes(a.value);return r.jsxs("div",{className:"nc-section nc-row",style:{justifyContent:"space-between",cursor:"pointer",padding:12},onMouseDown:()=>w(a.value),children:[r.jsx("span",{children:a.label}),r.jsx("span",{children:p?"✔️":""})]},a.value)}),m.length===0&&r.jsx("div",{className:"nc-section nc-label",children:"No results"})]})]})}function ce(e){if(!e)return null;const t=/^\d{2}-\d{1,2}$/,n=/^\d{4}-\d{1,2}$/;if(!t.test(e)&&!n.test(e))return"Format must be YY-M(M) or YYYY-M(M)";const s=e.split("-"),o=parseInt(s[1],10);return o<1||o>12?"Month must be between 1 and 12":null}function ie(e){if(!e)return"";const t=e.split("-");if(t.length!==2)return e;let n=t[0];const s=t[1].padStart(2,"0");if(n.length===2){const o=parseInt(n,10);n=String(o<50?2e3+o:1900+o)}return`${n}-${s}`}function Ae(e){if(!e)return"";const t=ie(e);if(!/^\d{4}-\d{2}$/.test(t))return e;const[n,s]=t.split("-");return`${n}/${s}`}function Ce(){const e=new Date,t=e.getFullYear(),n=String(e.getMonth()+1).padStart(2,"0");return`${t}-${n}`}function wt({startMonth:e,endMonth:t,onChange:n,label:s,className:o="",disabled:i=!1}){const[l,c]=u.useState(!1),[d,f]=u.useState(""),[m,w]=u.useState(""),[a,p]=u.useState({top:0,left:0,width:0}),g=u.useRef(null),v=u.useRef(null);u.useEffect(()=>{if(l&&g.current){const E=g.current.getBoundingClientRect();p({top:E.bottom+4,left:E.left,width:E.width})}},[l]),u.useEffect(()=>{if(!l)return;const E=z=>{g.current&&!g.current.contains(z.target)&&v.current&&!v.current.contains(z.target)&&c(!1)};return document.addEventListener("mousedown",E),()=>document.removeEventListener("mousedown",E)},[l]);const h=()=>{f(e||Ce()),w(t||Ce()),c(!0)},y=()=>{c(!1)},j=()=>{const E=ce(d),z=ce(m);if(E||z)return;const I=ie(d),D=ie(m);I&&D&&(n==null||n(I,D)),c(!1)},R=e&&t?`${Ae(e)} - ${Ae(t)}`:"Select month range",b=ce(d),C=ce(m),$=ie(d),x=ie(m),S=$&&x&&$>x,k=l?ae.createPortal(r.jsx("div",{ref:v,className:"nc-month-range-picker-popup",style:{position:"fixed",top:a.top,left:a.left,width:Math.max(a.width,400),zIndex:1e3},children:r.jsxs("div",{className:"nc-month-range-picker-content",children:[r.jsxs("div",{className:"nc-month-range-picker-row",children:[r.jsxs("div",{className:"nc-month-range-picker-column",children:[r.jsx("label",{className:"nc-label",children:"Start Month"}),r.jsx("input",{type:"text",className:`nc-month-input ${b?"nc-error":""}`,value:d,onChange:E=>f(E.target.value),placeholder:"YY-M(M) or YYYY-M(M)"}),b&&r.jsx("div",{className:"nc-month-error-text",children:b})]}),r.jsxs("div",{className:"nc-month-range-picker-column",children:[r.jsx("label",{className:"nc-label",children:"End Month"}),r.jsx("input",{type:"text",className:`nc-month-input ${C?"nc-error":""}`,value:m,onChange:E=>w(E.target.value),placeholder:"YY-M(M) or YYYY-M(M)"}),C&&r.jsx("div",{className:"nc-month-error-text",children:C})]})]}),S&&!b&&!C&&r.jsx("div",{className:"nc-month-range-error",children:"End month must be after or equal to start month"}),r.jsxs("div",{className:"nc-month-range-picker-footer",children:[r.jsx(H,{variant:"primary",onClick:j,disabled:!d||!m||!!b||!!C||!!S,children:"Apply"}),r.jsx(H,{variant:"ghost",onClick:y,children:"Cancel"})]})]})}),document.body):null;return r.jsxs("div",{className:`nc-month-range-picker ${o}`,children:[s&&r.jsx("label",{className:"nc-label",children:s}),r.jsx("button",{ref:g,className:"nc-month-range-picker-input",onClick:h,disabled:i,children:R}),k]})}function yt({value:e,onChange:t,min:n,max:s,step:o=1,label:i,disabled:l,size:c="default"}){const d=c==="small",f=()=>{const a=e-o;n!==void 0&&a<n||t(parseFloat(a.toFixed(10)))},m=()=>{const a=e+o;s!==void 0&&a>s||t(parseFloat(a.toFixed(10)))},w=a=>{const p=parseFloat(a.target.value);isNaN(p)||n!==void 0&&p<n||s!==void 0&&p>s||t(p)};return r.jsxs("div",{className:`nc-col nc-number-input-col ${d?"nc-small":""}`,children:[i&&r.jsx("span",{className:`nc-label ${d?"nc-small":""}`,children:i}),r.jsxs("div",{className:`nc-number-input-container ${d?"nc-small":""}`,children:[r.jsx("input",{className:`nc-input nc-number-input ${d?"nc-small":""}`,type:"number",value:e,onChange:w,min:n,max:s,step:o,disabled:l}),r.jsx("button",{className:`nc-button nc-ghost nc-number-input-button ${d?"nc-small":""}`,onClick:f,disabled:l||n!==void 0&&e<=n,children:"−"}),r.jsx("button",{className:`nc-button nc-ghost nc-number-input-button ${d?"nc-small":""}`,onClick:m,disabled:l||s!==void 0&&e>=s,children:"+"})]})]})}function jt({value:e,onChange:t,min:n=0,max:s=100,step:o=1,label:i,disabled:l,showValue:c=!0,formatValue:d=m=>m.toString(),width:f=200}){const m=a=>{const p=parseFloat(a.target.value);t(p)},w=(e-n)/(s-n)*100;return r.jsxs("div",{className:"nc-col",style:{gap:6},children:[i&&r.jsx("span",{className:"nc-label",children:i}),r.jsxs("div",{style:{display:"flex",gap:12,alignItems:"center"},children:[r.jsx("input",{type:"range",className:"nc-slider",value:e,onChange:m,min:n,max:s,step:o,disabled:l,style:{width:f,"--nc-slider-percentage":`${w}%`}}),c&&r.jsx("span",{style:{color:"var(--nc-text)",fontFamily:"monospace",fontSize:14,minWidth:60,textAlign:"right"},children:d(e)})]})]})}const kt=({size:e=24,className:t,style:n})=>r.jsx("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",className:t,style:n,children:r.jsx("polyline",{points:"18 15 12 9 6 15"})});function Te({children:e,className:t="",style:n}){return r.jsx("div",{className:`nc-tab-panel ${t}`,style:n,children:e})}function Nt({active:e,children:t,keepMounted:n=!1,className:s="",style:o}){const i=u.Children.toArray(t).filter(c=>u.isValidElement(c)&&(c.type===Te||c.type.displayName==="TabPanel"));if(n)return r.jsx("div",{className:`nc-tab-panels ${s}`,style:o,children:i.map(c=>{const d=c.props.tab===e;return r.jsx("div",{className:`nc-tab-panel-wrapper ${d?"nc-active":""}`,style:{display:d?void 0:"none"},"aria-hidden":!d,children:c},c.props.tab)})});const l=i.find(c=>c.props.tab===e);return r.jsx("div",{className:`nc-tab-panels ${s}`,style:o,children:l})}function St({tabs:e,active:t,onChange:n,className:s,toolbar:o,multiline:i,orientation:l="horizontal",style:c}){const d=u.useRef(null),[f,m]=u.useState(!1),[w,a]=u.useState(!1),p=l==="verticalLeft"||l==="verticalRight",g=u.useRef(!1),v=u.useRef(0),h=u.useRef(0),y=u.useRef(!1);u.useEffect(()=>{const x=()=>{if(d.current)if(p){const{scrollTop:k,scrollHeight:E,clientHeight:z}=d.current;m(k>1),a(k<E-z-1)}else{const{scrollLeft:k,scrollWidth:E,clientWidth:z}=d.current;m(k>1),a(k<E-z-1)}},S=d.current;if(S)return x(),S.addEventListener("scroll",x),window.addEventListener("resize",x),()=>{S.removeEventListener("scroll",x),window.removeEventListener("resize",x)}},[e,p]);const j=x=>{d.current&&(g.current=!0,y.current=!1,v.current=p?x.clientY:x.clientX,h.current=p?d.current.scrollTop:d.current.scrollLeft,d.current.style.cursor="grabbing",d.current.style.userSelect="none")},R=x=>{if(!g.current||!d.current)return;const S=p?x.clientY:x.clientX,k=v.current-S;Math.abs(k)>3&&(y.current=!0),p?d.current.scrollTop=h.current+k:d.current.scrollLeft=h.current+k},b=()=>{d.current&&(g.current=!1,d.current.style.cursor="",d.current.style.userSelect="")},C=()=>{b()};u.useEffect(()=>{const x=d.current;if(!x||p)return;const S=k=>{k.deltaY!==0&&(k.preventDefault(),x.scrollLeft+=k.deltaY*.3)};return x.addEventListener("wheel",S,{passive:!1}),()=>{x.removeEventListener("wheel",S)}},[p]);const $=x=>{y.current||n(x)};return r.jsxs("div",{className:`nc-tab-container ${p?`nc-vertical nc-${l}`:""} ${s||""}`,style:c,children:[r.jsxs("div",{className:"nc-tab-scroll-wrapper",children:[f&&r.jsx("div",{className:`nc-tab-scroll-indicator ${p?"nc-top":"nc-left"}`,children:p?r.jsx(kt,{size:16}):r.jsx(W.ChevronLeftIcon,{size:16})}),r.jsx("div",{ref:d,className:`nc-tab-scroll ${i?"nc-multiline":""}`,onMouseDown:j,onMouseMove:R,onMouseUp:b,onMouseLeave:C,style:{cursor:"grab"},children:e.map(x=>r.jsx("div",{className:`nc-tab-item ${t===x?"nc-active":""}`,onClick:()=>$(x),role:"button",tabIndex:0,onKeyDown:S=>{(S.key==="Enter"||S.key===" ")&&n(x)},children:p?x:x.toUpperCase()},x))}),w&&r.jsx("div",{className:`nc-tab-scroll-indicator ${p?"nc-bottom":"nc-right"}`,children:p?r.jsx(W.ChevronDownIcon,{size:16}):r.jsx(W.ChevronRightIcon,{size:16})})]}),o&&r.jsx("div",{className:"nc-tab-toolbar",children:o})]})}function At({checked:e,onChange:t,disabled:n,label:s}){return r.jsxs("label",{className:"nc-row",style:{gap:10,alignItems:"center",cursor:n?"not-allowed":"pointer"},children:[s&&r.jsx("span",{className:"nc-label",children:s}),r.jsx("span",{role:"switch","aria-checked":e,tabIndex:0,onKeyDown:o=>{n||(o.key==="Enter"||o.key===" ")&&(o.preventDefault(),t(!e))},onClick:()=>!n&&t(!e),style:{position:"relative",width:56,height:30,borderRadius:18,padding:4,display:"inline-flex",alignItems:"center",justifyContent:"flex-start",border:`2px solid ${e?"var(--nc-primary)":"var(--nc-button-border)"}`,background:e?"rgba(99,102,241,0.08)":"transparent",transition:"border-color 160ms, background 160ms"},children:r.jsx("span",{style:{width:22,height:22,borderRadius:12,background:e?"var(--nc-text)":"var(--nc-muted)",transform:`translateX(${e?24:0}px)`,transition:"transform 160ms, background 160ms",boxShadow:e?"0 2px 6px rgba(99,102,241,0.28)":"0 1px 2px rgba(0,0,0,0.08)",border:"none"}})})]})}let X={notifications:[]};const pe=new Set,Ie=new Map;function fe(){const e=X.notifications.slice();for(const t of Array.from(pe))try{t(e)}catch{}}function Ct(e){pe.add(e);try{e(X.notifications.slice())}catch{}return()=>{pe.delete(e)}}function It(e){const t=`notification-${Date.now()}-${Math.random()}`,n={id:t,dismissible:!0,lastingTime:5e3,...e};return X.notifications=[n,...X.notifications],fe(),n.lastingTime&&n.lastingTime>0&&setTimeout(()=>{ze(t)},n.lastingTime),t}function ze(e){const t=X.notifications.find(s=>s.id===e);if(!t)return;t.isRemoving=!0,fe();const n=window.setTimeout(()=>{X.notifications=X.notifications.filter(s=>s.id!==e),fe(),Ie.delete(e)},300);Ie.set(e,n)}function Be({notification:e}){const{t}=q.useTranslation(),n=()=>{if(e.title)return e.title;switch(e.type){case"success":return t("common.success");case"danger":return t("common.error");case"warning":return t("common.warning");default:return t("common.info")}},s=()=>{ze(e.id)};return r.jsx("div",{className:`nc-notification nc-notification-${e.type||"info"}`,children:r.jsxs("div",{className:"nc-notification-content",children:[r.jsxs("div",{className:"nc-notification-body",style:{paddingRight:e.dismissible?"8px":"0"},children:[r.jsx("div",{className:"nc-notification-title",children:n()}),r.jsx("div",{className:"nc-notification-message",children:e.message})]}),e.dismissible&&r.jsx("button",{className:"nc-notification-dismiss",onClick:s,children:r.jsx(W.CloseIcon,{size:16})})]})})}function Rt(){const[e,t]=u.useState([]),[n,s]=u.useState(new Map),[o,i]=u.useState(new Set),l=u.useRef(null),c=u.useRef([]);return u.useEffect(()=>Ct(f=>{const m=new Set(c.current.map(a=>a.id)),w=f.filter(a=>!m.has(a.id)).map(a=>a.id);w.length>0?(t(f),i(new Set(w)),requestAnimationFrame(()=>{requestAnimationFrame(()=>{i(new Set)})})):t(f),c.current=f}),[]),u.useEffect(()=>{if(!l.current)return;const d=new Map;let f=0;const m=l.current.children;e.forEach((w,a)=>{if(d.set(w.id,f),m[a]){const p=m[a].offsetHeight;w.isRemoving||(f+=p+12)}}),s(d)},[e]),r.jsx("div",{style:{position:"fixed",top:"16px",left:"16px",zIndex:9999,pointerEvents:"none"},children:r.jsx("div",{ref:l,style:{pointerEvents:"auto",position:"relative"},children:e.map(d=>{const f=o.has(d.id),m=d.isRemoving,w=n.get(d.id)||0;return r.jsx("div",{style:{position:"absolute",top:0,left:0,transform:f?"translateY(-120px)":`translateY(${w}px)`,transition:m?"opacity 300ms ease-out":"transform 300ms ease-out, opacity 300ms ease-out",opacity:m?0:1,width:"100%"},children:r.jsx(Be,{notification:d})},d.id)})})})}const Et={show:e=>It(e)};function Mt(e){const t=Xe.createInstance(),n={};for(const o in e)n[o]={translation:e[o]};const s=typeof document<"u"&&document.documentElement.lang||"en";return t.init({resources:n,lng:s,fallbackLng:"en",interpolation:{escapeValue:!1}}),typeof MutationObserver<"u"&&typeof document<"u"&&new MutationObserver(i=>{for(const l of i)if(l.type==="attributes"&&l.attributeName==="lang"){const c=document.documentElement.lang||"en";t.changeLanguage(c)}}).observe(document.documentElement,{attributes:!0}),t}class $t{constructor(){O(this,"apps",new Map)}register(t){this.apps.has(t.id)&&console.warn(`App "${t.id}" is already registered. Overwriting.`),this.apps.set(t.id,{...t,width:t.width??400,padding:t.padding??0})}unregister(t){this.apps.delete(t)}get(t){return this.apps.get(t)}list(){return Array.from(this.apps.values())}has(t){return this.apps.has(t)}}const J=new $t,Re="nc-ui-app-state";class Pt{constructor(){O(this,"state");O(this,"listeners",new Map);this.state=this.loadState()}loadState(){try{const t=localStorage.getItem(Re);if(t)return JSON.parse(t)}catch{}return{activeAppId:null}}saveState(){try{localStorage.setItem(Re,JSON.stringify(this.state))}catch{}}getActiveAppId(){return this.state.activeAppId}_setActiveAppId(t){this.state.activeAppId!==t&&(this.state.activeAppId=t,this.saveState(),this.notify("activeAppId",t))}subscribe(t,n){return this.listeners.has(t)||this.listeners.set(t,new Set),this.listeners.get(t).add(n),()=>{var s;(s=this.listeners.get(t))==null||s.delete(n)}}notify(t,n){var s;(s=this.listeners.get(t))==null||s.forEach(o=>o(n))}}const V=new Pt;class Tt{constructor(){O(this,"apps",[]);O(this,"activeAppId",null);O(this,"listeners",new Set);O(this,"refReadyResolvers",new Map)}async launchApp(t,n){const{launchInBackground:s=!1}=n||{};if(!J.has(t))return console.error(`Cannot launch app "${t}": not registered`),null;const o=this.apps.find(l=>l.appId===t);if(o)return s||(this.setActiveApp(t),V._setActiveAppId(t)),o.ref?o:this.waitForRef(t);const i={appId:t,launchedAt:Date.now()};return this.apps.push(i),s||(this.activeAppId=t,V._setActiveAppId(t)),this.notify(),this.waitForRef(t)}waitForRef(t){return new Promise(n=>{const s=this.refReadyResolvers.get(t)||[];s.push(n),this.refReadyResolvers.set(t,s)})}setAppRef(t,n){const s=this.apps.find(i=>i.appId===t);if(!s){console.warn(`Cannot set ref for app "${t}": not running`);return}s.ref=n;const o=this.refReadyResolvers.get(t);o&&(o.forEach(i=>i(s)),this.refReadyResolvers.delete(t))}getApp(t){return this.apps.find(n=>n.appId===t)}closeApp(t){const n=this.apps.findIndex(o=>o.appId===t);if(n===-1)return;const s=this.apps[n];if(s.ref&&(s.ref=void 0),this.apps.splice(n,1),this.activeAppId===t){const o=window.innerWidth>=768;this.activeAppId=o&&this.apps.length>0?this.apps[this.apps.length-1].appId:null,V._setActiveAppId(this.activeAppId)}this.notify()}setActiveApp(t){if(t!==null&&!this.apps.find(n=>n.appId===t)){console.warn(`Cannot activate app "${t}": not running`);return}this.activeAppId!==t&&(this.activeAppId=t,this.notify(),V._setActiveAppId(t))}toggleApp(t){this.activeAppId===t?this.setActiveApp(null):this.launchApp(t)}getActiveAppId(){return this.activeAppId}getActiveApp(){return this.activeAppId?J.get(this.activeAppId)??null:null}getRunningApps(){return[...this.apps]}isRunning(t){return this.apps.some(n=>n.appId===t)}subscribe(t){return this.listeners.add(t),()=>{this.listeners.delete(t)}}notify(){this.listeners.forEach(t=>t())}}const L=new Tt,be=u.createContext(null);function Le(){const e=u.useContext(be);if(!e)throw new Error("useApp must be used inside an App");return e}function zt({size:e=16}){return r.jsxs("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",children:[r.jsx("path",{d:"M19 12H5"}),r.jsx("path",{d:"M12 19l-7-7 7-7"})]})}function De({title:e,onClose:t,onBack:n,toolbar:s,hideBackButton:o}){const i=n&&!o;return r.jsxs("div",{className:"nc-app-title-bar",children:[r.jsxs("div",{className:"nc-app-title-bar-left",children:[i&&r.jsx("button",{className:"nc-app-title-bar-back",onClick:n,title:"Back","aria-label":"Go back",children:r.jsx(zt,{size:16})}),r.jsx("span",{className:"nc-app-title-bar-title",children:e})]}),r.jsxs("div",{className:"nc-app-title-bar-right",children:[s&&r.jsx("div",{className:"nc-app-title-bar-toolbar",children:s}),r.jsx(ge,{onClick:t,"aria-label":"Close application"})]})]})}class Bt extends u.Component{constructor(t){super(t),this.state={hasError:!1}}static getDerivedStateFromError(t){return{hasError:!0,error:t}}componentDidCatch(t,n){console.error(`Error loading app ${this.props.appId}:`,t,n)}render(){return this.state.hasError?r.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",flex:1,flexDirection:"column",gap:"16px",padding:"20px",textAlign:"center",color:"var(--text-secondary)"},children:[r.jsx("div",{children:"Failed to load app"}),this.state.error&&r.jsx("div",{style:{fontSize:"12px",opacity:.7},children:this.state.error.message})]}):this.props.children}}function xe({appId:e,isActive:t,onClose:n}){const{t:s}=q.useTranslation(),o=J.get(e),[i,l]=u.useState(""),[c,d]=u.useState(null),[f,m]=u.useState(null),[w,a]=u.useState(!1),[p,g]=u.useState(!1);u.useEffect(()=>{o!=null&&o.titleKey&&l(s(o.titleKey))},[o,s]);const v=u.useCallback(k=>{l(k)},[]),h=u.useCallback(k=>{d(()=>k)},[]),y=u.useCallback(()=>{d(null)},[]),j=u.useCallback(k=>{m(k)},[]),R=u.useCallback(()=>{m(null)},[]),b=u.useCallback(k=>{a(k)},[]),C=u.useCallback(k=>{g(k)},[]),$=u.useMemo(()=>({setTitle:v,setBackHandler:h,clearBackHandler:y,setToolbar:j,clearToolbar:R,setHideBackButton:b,setHideTitleBar:C,close:n}),[v,h,y,j,R,b,C,n]);if(!o)return null;const x=o.component,S=!o.hideTitleBar&&!p;return r.jsxs("div",{style:{display:t?"flex":"none",flexDirection:"column",flex:1,minHeight:0},children:[S&&r.jsx(De,{title:i,onClose:n,onBack:c??void 0,toolbar:f,hideBackButton:w}),r.jsx("div",{className:S?"nc-app-content-wrapper":"",style:{padding:o.padding,flex:1,minHeight:0,display:"flex",flexDirection:"column",backgroundColor:"var(--nc-bg-secondary)",position:"relative"},children:r.jsx(be.Provider,{value:$,children:r.jsx(Bt,{appId:e,children:r.jsx(u.Suspense,{fallback:r.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",flex:1},children:r.jsx(me,{})}),children:r.jsx(x,{})})})})})]})}const le=768,de=1024,He={isMobile:!1,isTablet:!1,isDesktop:!0,width:typeof window<"u"?window.innerWidth:1024,height:typeof window<"u"?window.innerHeight:768},Ve=u.createContext(He);function Lt({children:e}){const[t,n]=u.useState(()=>{if(typeof window>"u")return He;const s=window.innerWidth,o=window.innerHeight;return{isMobile:s<le,isTablet:s>=le&&s<de,isDesktop:s>=de,width:s,height:o}});return u.useEffect(()=>{const s=()=>{const o=window.innerWidth,i=window.innerHeight;n({isMobile:o<le,isTablet:o>=le&&o<de,isDesktop:o>=de,width:o,height:i})};return window.addEventListener("resize",s),()=>window.removeEventListener("resize",s)},[]),r.jsx(Ve.Provider,{value:t,children:e})}function ve(){return u.useContext(Ve)}const we="-",Dt=e=>{const t=Vt(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:s}=e;return{getClassGroupId:l=>{const c=l.split(we);return c[0]===""&&c.length!==1&&c.shift(),We(c,t)||Ht(l)},getConflictingClassGroupIds:(l,c)=>{const d=n[l]||[];return c&&s[l]?[...d,...s[l]]:d}}},We=(e,t)=>{var l;if(e.length===0)return t.classGroupId;const n=e[0],s=t.nextPart.get(n),o=s?We(e.slice(1),s):void 0;if(o)return o;if(t.validators.length===0)return;const i=e.join(we);return(l=t.validators.find(({validator:c})=>c(i)))==null?void 0:l.classGroupId},Ee=/^\[(.+)\]$/,Ht=e=>{if(Ee.test(e)){const t=Ee.exec(e)[1],n=t==null?void 0:t.substring(0,t.indexOf(":"));if(n)return"arbitrary.."+n}},Vt=e=>{const{theme:t,prefix:n}=e,s={nextPart:new Map,validators:[]};return Gt(Object.entries(e.classGroups),n).forEach(([i,l])=>{he(l,s,i,t)}),s},he=(e,t,n,s)=>{e.forEach(o=>{if(typeof o=="string"){const i=o===""?t:Me(t,o);i.classGroupId=n;return}if(typeof o=="function"){if(Wt(o)){he(o(s),t,n,s);return}t.validators.push({validator:o,classGroupId:n});return}Object.entries(o).forEach(([i,l])=>{he(l,Me(t,i),n,s)})})},Me=(e,t)=>{let n=e;return t.split(we).forEach(s=>{n.nextPart.has(s)||n.nextPart.set(s,{nextPart:new Map,validators:[]}),n=n.nextPart.get(s)}),n},Wt=e=>e.isThemeGetter,Gt=(e,t)=>t?e.map(([n,s])=>{const o=s.map(i=>typeof i=="string"?t+i:typeof i=="object"?Object.fromEntries(Object.entries(i).map(([l,c])=>[t+l,c])):i);return[n,o]}):e,Ft=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=new Map,s=new Map;const o=(i,l)=>{n.set(i,l),t++,t>e&&(t=0,s=n,n=new Map)};return{get(i){let l=n.get(i);if(l!==void 0)return l;if((l=s.get(i))!==void 0)return o(i,l),l},set(i,l){n.has(i)?n.set(i,l):o(i,l)}}},Ge="!",Ot=e=>{const{separator:t,experimentalParseClassName:n}=e,s=t.length===1,o=t[0],i=t.length,l=c=>{const d=[];let f=0,m=0,w;for(let h=0;h<c.length;h++){let y=c[h];if(f===0){if(y===o&&(s||c.slice(h,h+i)===t)){d.push(c.slice(m,h)),m=h+i;continue}if(y==="/"){w=h;continue}}y==="["?f++:y==="]"&&f--}const a=d.length===0?c:c.substring(m),p=a.startsWith(Ge),g=p?a.substring(1):a,v=w&&w>m?w-m:void 0;return{modifiers:d,hasImportantModifier:p,baseClassName:g,maybePostfixModifierPosition:v}};return n?c=>n({className:c,parseClassName:l}):l},Yt=e=>{if(e.length<=1)return e;const t=[];let n=[];return e.forEach(s=>{s[0]==="["?(t.push(...n.sort(),s),n=[]):n.push(s)}),t.push(...n.sort()),t},Kt=e=>({cache:Ft(e.cacheSize),parseClassName:Ot(e),...Dt(e)}),qt=/\s+/,_t=(e,t)=>{const{parseClassName:n,getClassGroupId:s,getConflictingClassGroupIds:o}=t,i=[],l=e.trim().split(qt);let c="";for(let d=l.length-1;d>=0;d-=1){const f=l[d],{modifiers:m,hasImportantModifier:w,baseClassName:a,maybePostfixModifierPosition:p}=n(f);let g=!!p,v=s(g?a.substring(0,p):a);if(!v){if(!g){c=f+(c.length>0?" "+c:c);continue}if(v=s(a),!v){c=f+(c.length>0?" "+c:c);continue}g=!1}const h=Yt(m).join(":"),y=w?h+Ge:h,j=y+v;if(i.includes(j))continue;i.push(j);const R=o(v,g);for(let b=0;b<R.length;++b){const C=R[b];i.push(y+C)}c=f+(c.length>0?" "+c:c)}return c};function Ut(){let e=0,t,n,s="";for(;e<arguments.length;)(t=arguments[e++])&&(n=Fe(t))&&(s&&(s+=" "),s+=n);return s}const Fe=e=>{if(typeof e=="string")return e;let t,n="";for(let s=0;s<e.length;s++)e[s]&&(t=Fe(e[s]))&&(n&&(n+=" "),n+=t);return n};function Xt(e,...t){let n,s,o,i=l;function l(d){const f=t.reduce((m,w)=>w(m),e());return n=Kt(f),s=n.cache.get,o=n.cache.set,i=c,c(d)}function c(d){const f=s(d);if(f)return f;const m=_t(d,n);return o(d,m),m}return function(){return i(Ut.apply(null,arguments))}}const P=e=>{const t=n=>n[e]||[];return t.isThemeGetter=!0,t},Oe=/^\[(?:([a-z-]+):)?(.+)\]$/i,Jt=/^\d+\/\d+$/,Qt=new Set(["px","full","screen"]),Zt=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,en=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,tn=/^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/,nn=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,rn=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,G=e=>ee(e)||Qt.has(e)||Jt.test(e),Y=e=>te(e,"length",pn),ee=e=>!!e&&!Number.isNaN(Number(e)),ue=e=>te(e,"number",ee),se=e=>!!e&&Number.isInteger(Number(e)),sn=e=>e.endsWith("%")&&ee(e.slice(0,-1)),N=e=>Oe.test(e),K=e=>Zt.test(e),on=new Set(["length","size","percentage"]),an=e=>te(e,on,Ye),cn=e=>te(e,"position",Ye),ln=new Set(["image","url"]),dn=e=>te(e,ln,hn),un=e=>te(e,"",fn),oe=()=>!0,te=(e,t,n)=>{const s=Oe.exec(e);return s?s[1]?typeof t=="string"?s[1]===t:t.has(s[1]):n(s[2]):!1},pn=e=>en.test(e)&&!tn.test(e),Ye=()=>!1,fn=e=>nn.test(e),hn=e=>rn.test(e),mn=()=>{const e=P("colors"),t=P("spacing"),n=P("blur"),s=P("brightness"),o=P("borderColor"),i=P("borderRadius"),l=P("borderSpacing"),c=P("borderWidth"),d=P("contrast"),f=P("grayscale"),m=P("hueRotate"),w=P("invert"),a=P("gap"),p=P("gradientColorStops"),g=P("gradientColorStopPositions"),v=P("inset"),h=P("margin"),y=P("opacity"),j=P("padding"),R=P("saturate"),b=P("scale"),C=P("sepia"),$=P("skew"),x=P("space"),S=P("translate"),k=()=>["auto","contain","none"],E=()=>["auto","hidden","clip","visible","scroll"],z=()=>["auto",N,t],I=()=>[N,t],D=()=>["",G,Y],A=()=>["auto",ee,N],M=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],T=()=>["solid","dashed","dotted","double","none"],Q=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],F=()=>["start","end","center","between","around","evenly","stretch"],_=()=>["","0",N],ne=()=>["auto","avoid","all","avoid-page","page","left","right","column"],B=()=>[ee,N];return{cacheSize:500,separator:":",theme:{colors:[oe],spacing:[G,Y],blur:["none","",K,N],brightness:B(),borderColor:[e],borderRadius:["none","","full",K,N],borderSpacing:I(),borderWidth:D(),contrast:B(),grayscale:_(),hueRotate:B(),invert:_(),gap:I(),gradientColorStops:[e],gradientColorStopPositions:[sn,Y],inset:z(),margin:z(),opacity:B(),padding:I(),saturate:B(),scale:B(),sepia:_(),skew:B(),space:I(),translate:I()},classGroups:{aspect:[{aspect:["auto","square","video",N]}],container:["container"],columns:[{columns:[K]}],"break-after":[{"break-after":ne()}],"break-before":[{"break-before":ne()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[...M(),N]}],overflow:[{overflow:E()}],"overflow-x":[{"overflow-x":E()}],"overflow-y":[{"overflow-y":E()}],overscroll:[{overscroll:k()}],"overscroll-x":[{"overscroll-x":k()}],"overscroll-y":[{"overscroll-y":k()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[v]}],"inset-x":[{"inset-x":[v]}],"inset-y":[{"inset-y":[v]}],start:[{start:[v]}],end:[{end:[v]}],top:[{top:[v]}],right:[{right:[v]}],bottom:[{bottom:[v]}],left:[{left:[v]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",se,N]}],basis:[{basis:z()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",N]}],grow:[{grow:_()}],shrink:[{shrink:_()}],order:[{order:["first","last","none",se,N]}],"grid-cols":[{"grid-cols":[oe]}],"col-start-end":[{col:["auto",{span:["full",se,N]},N]}],"col-start":[{"col-start":A()}],"col-end":[{"col-end":A()}],"grid-rows":[{"grid-rows":[oe]}],"row-start-end":[{row:["auto",{span:[se,N]},N]}],"row-start":[{"row-start":A()}],"row-end":[{"row-end":A()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",N]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",N]}],gap:[{gap:[a]}],"gap-x":[{"gap-x":[a]}],"gap-y":[{"gap-y":[a]}],"justify-content":[{justify:["normal",...F()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...F(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...F(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[j]}],px:[{px:[j]}],py:[{py:[j]}],ps:[{ps:[j]}],pe:[{pe:[j]}],pt:[{pt:[j]}],pr:[{pr:[j]}],pb:[{pb:[j]}],pl:[{pl:[j]}],m:[{m:[h]}],mx:[{mx:[h]}],my:[{my:[h]}],ms:[{ms:[h]}],me:[{me:[h]}],mt:[{mt:[h]}],mr:[{mr:[h]}],mb:[{mb:[h]}],ml:[{ml:[h]}],"space-x":[{"space-x":[x]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[x]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",N,t]}],"min-w":[{"min-w":[N,t,"min","max","fit"]}],"max-w":[{"max-w":[N,t,"none","full","min","max","fit","prose",{screen:[K]},K]}],h:[{h:[N,t,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[N,t,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[N,t,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[N,t,"auto","min","max","fit"]}],"font-size":[{text:["base",K,Y]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",ue]}],"font-family":[{font:[oe]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:["tighter","tight","normal","wide","wider","widest",N]}],"line-clamp":[{"line-clamp":["none",ee,ue]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",G,N]}],"list-image":[{"list-image":["none",N]}],"list-style-type":[{list:["none","disc","decimal",N]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[e]}],"placeholder-opacity":[{"placeholder-opacity":[y]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[e]}],"text-opacity":[{"text-opacity":[y]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...T(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",G,Y]}],"underline-offset":[{"underline-offset":["auto",G,N]}],"text-decoration-color":[{decoration:[e]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:I()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",N]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",N]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[y]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...M(),cn]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",an]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},dn]}],"bg-color":[{bg:[e]}],"gradient-from-pos":[{from:[g]}],"gradient-via-pos":[{via:[g]}],"gradient-to-pos":[{to:[g]}],"gradient-from":[{from:[p]}],"gradient-via":[{via:[p]}],"gradient-to":[{to:[p]}],rounded:[{rounded:[i]}],"rounded-s":[{"rounded-s":[i]}],"rounded-e":[{"rounded-e":[i]}],"rounded-t":[{"rounded-t":[i]}],"rounded-r":[{"rounded-r":[i]}],"rounded-b":[{"rounded-b":[i]}],"rounded-l":[{"rounded-l":[i]}],"rounded-ss":[{"rounded-ss":[i]}],"rounded-se":[{"rounded-se":[i]}],"rounded-ee":[{"rounded-ee":[i]}],"rounded-es":[{"rounded-es":[i]}],"rounded-tl":[{"rounded-tl":[i]}],"rounded-tr":[{"rounded-tr":[i]}],"rounded-br":[{"rounded-br":[i]}],"rounded-bl":[{"rounded-bl":[i]}],"border-w":[{border:[c]}],"border-w-x":[{"border-x":[c]}],"border-w-y":[{"border-y":[c]}],"border-w-s":[{"border-s":[c]}],"border-w-e":[{"border-e":[c]}],"border-w-t":[{"border-t":[c]}],"border-w-r":[{"border-r":[c]}],"border-w-b":[{"border-b":[c]}],"border-w-l":[{"border-l":[c]}],"border-opacity":[{"border-opacity":[y]}],"border-style":[{border:[...T(),"hidden"]}],"divide-x":[{"divide-x":[c]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[c]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[y]}],"divide-style":[{divide:T()}],"border-color":[{border:[o]}],"border-color-x":[{"border-x":[o]}],"border-color-y":[{"border-y":[o]}],"border-color-s":[{"border-s":[o]}],"border-color-e":[{"border-e":[o]}],"border-color-t":[{"border-t":[o]}],"border-color-r":[{"border-r":[o]}],"border-color-b":[{"border-b":[o]}],"border-color-l":[{"border-l":[o]}],"divide-color":[{divide:[o]}],"outline-style":[{outline:["",...T()]}],"outline-offset":[{"outline-offset":[G,N]}],"outline-w":[{outline:[G,Y]}],"outline-color":[{outline:[e]}],"ring-w":[{ring:D()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[e]}],"ring-opacity":[{"ring-opacity":[y]}],"ring-offset-w":[{"ring-offset":[G,Y]}],"ring-offset-color":[{"ring-offset":[e]}],shadow:[{shadow:["","inner","none",K,un]}],"shadow-color":[{shadow:[oe]}],opacity:[{opacity:[y]}],"mix-blend":[{"mix-blend":[...Q(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":Q()}],filter:[{filter:["","none"]}],blur:[{blur:[n]}],brightness:[{brightness:[s]}],contrast:[{contrast:[d]}],"drop-shadow":[{"drop-shadow":["","none",K,N]}],grayscale:[{grayscale:[f]}],"hue-rotate":[{"hue-rotate":[m]}],invert:[{invert:[w]}],saturate:[{saturate:[R]}],sepia:[{sepia:[C]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[n]}],"backdrop-brightness":[{"backdrop-brightness":[s]}],"backdrop-contrast":[{"backdrop-contrast":[d]}],"backdrop-grayscale":[{"backdrop-grayscale":[f]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[m]}],"backdrop-invert":[{"backdrop-invert":[w]}],"backdrop-opacity":[{"backdrop-opacity":[y]}],"backdrop-saturate":[{"backdrop-saturate":[R]}],"backdrop-sepia":[{"backdrop-sepia":[C]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[l]}],"border-spacing-x":[{"border-spacing-x":[l]}],"border-spacing-y":[{"border-spacing-y":[l]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",N]}],duration:[{duration:B()}],ease:[{ease:["linear","in","out","in-out",N]}],delay:[{delay:B()}],animate:[{animate:["none","spin","ping","pulse","bounce",N]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[b]}],"scale-x":[{"scale-x":[b]}],"scale-y":[{"scale-y":[b]}],rotate:[{rotate:[se,N]}],"translate-x":[{"translate-x":[S]}],"translate-y":[{"translate-y":[S]}],"skew-x":[{"skew-x":[$]}],"skew-y":[{"skew-y":[$]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",N]}],accent:[{accent:["auto",e]}],appearance:[{appearance:["none","auto"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",N]}],"caret-color":[{caret:[e]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":I()}],"scroll-mx":[{"scroll-mx":I()}],"scroll-my":[{"scroll-my":I()}],"scroll-ms":[{"scroll-ms":I()}],"scroll-me":[{"scroll-me":I()}],"scroll-mt":[{"scroll-mt":I()}],"scroll-mr":[{"scroll-mr":I()}],"scroll-mb":[{"scroll-mb":I()}],"scroll-ml":[{"scroll-ml":I()}],"scroll-p":[{"scroll-p":I()}],"scroll-px":[{"scroll-px":I()}],"scroll-py":[{"scroll-py":I()}],"scroll-ps":[{"scroll-ps":I()}],"scroll-pe":[{"scroll-pe":I()}],"scroll-pt":[{"scroll-pt":I()}],"scroll-pr":[{"scroll-pr":I()}],"scroll-pb":[{"scroll-pb":I()}],"scroll-pl":[{"scroll-pl":I()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",N]}],fill:[{fill:[e,"none"]}],"stroke-w":[{stroke:[G,Y,ue]}],stroke:[{stroke:[e,"none"]}],sr:["sr-only","not-sr-only"],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]}}},gn=Xt(mn);function Ke(...e){return gn(Je.clsx(e))}function bn({autoWidth:e=!0,className:t,style:n}){const[s,o]=u.useState(()=>V.getActiveAppId()),[i,l]=u.useState(()=>L.getRunningApps()),{isMobile:c}=ve();u.useEffect(()=>{const h=V.subscribe("activeAppId",y=>{o(y)});return()=>{h()}},[]),u.useEffect(()=>L.subscribe(()=>{l(L.getRunningApps())}),[]),u.useEffect(()=>{if(!new URLSearchParams(window.location.search).has("app")){const j=V.getActiveAppId();j&&!L.isRunning(j)&&L.launchApp(j)}},[]);const d=h=>{L.closeApp(h)},f=s?J.get(s):null,w=(f==null?void 0:f.width)??400,a=s!==null,v={...{overflow:"hidden",display:a?"flex":"none",flexDirection:"column",flexShrink:0,...e&&a?{width:c?"100%":w}:{}},...n};return r.jsx("div",{className:Ke("nc-app-panel",t),style:v,children:i.map(h=>r.jsx(xe,{appId:h.appId,isActive:s===h.appId,onClose:()=>d(h.appId)},h.appId))})}function xn({pinnedAppIds:e,className:t=""}){const{isMobile:n}=ve(),[s,o]=u.useState(()=>V.getActiveAppId()),[i,l]=u.useState(()=>L.getRunningApps());u.useEffect(()=>{const a=V.subscribe("activeAppId",p=>{o(p)});return()=>{a()}},[]),u.useEffect(()=>L.subscribe(()=>{l(L.getRunningApps())}),[]);const c=a=>{s===a?L.setActiveApp(null):L.launchApp(a)},d=e.map(a=>J.get(a)).filter(a=>!!a),f=i.filter(a=>!e.includes(a.appId)).map(a=>({running:a,def:J.get(a.appId)})).filter(a=>!!a.def),m=a=>i.some(p=>p.appId===a),w=n?24:28;return r.jsxs("div",{className:`nc-app-taskbar ${n?"nc-mobile":"nc-desktop"} ${t}`,children:[d.map(a=>{const p=a.icon,g=s===a.id,v=m(a.id);return r.jsxs("button",{className:`nc-app-taskbar-button ${g?"nc-active":""} ${v?"nc-running":""}`,onClick:()=>c(a.id),title:a.titleKey||a.id,children:[r.jsx(p,{size:w}),v&&r.jsx("span",{className:"nc-app-taskbar-indicator"})]},a.id)}),f.length>0&&r.jsx("div",{className:"nc-app-taskbar-separator"}),f.map(({running:a,def:p})=>{const g=p.icon,v=s===a.appId;return r.jsxs("button",{className:`nc-app-taskbar-button ${v?"nc-active":""} nc-running`,onClick:()=>c(a.appId),title:p.titleKey||p.id,children:[r.jsx(g,{size:w}),r.jsx("span",{className:"nc-app-taskbar-indicator"})]},a.appId)})]})}function vn({appId:e,open:t,onClose:n,closeOnBackdrop:s=!1,className:o="",style:i}){const l=d=>{s&&d.target===d.currentTarget&&n()};if(!t)return null;const c=r.jsx("div",{className:"nc-dialog-overlay nc-fullscreen",onClick:l,children:r.jsx("div",{className:`nc-app-dialog-container ${o}`,style:i,onClick:d=>d.stopPropagation(),children:r.jsx(xe,{appId:e,isActive:!0,onClose:n})})});return ae.createPortal(c,document.body)}const ye=u.createContext(null),qe=u.createContext(null);function wn(){const e=u.useContext(ye);if(!e)throw new Error("useNavStack must be used within a NavStackProvider");return e}function yn(){const e=u.useContext(qe);if(!e)throw new Error("useNavView must be used within NavStack");return e}const je=u.createContext(null);function jn({rootView:e,children:t}){const{t:n}=q.useTranslation(),s=Le(),[o,i]=u.useState([e]),[l,c]=u.useState([null]),d=u.useCallback((b,C)=>{c($=>{const x=[...$];return x[b]=C,x})},[]),f=u.useCallback(b=>{c(C=>{const $=[...C];return $[b]=null,$})},[]),m=u.useCallback(b=>{i(C=>[...C,b]),c(C=>[...C,null])},[]),w=u.useCallback(()=>{i(b=>b.length<=1?b:b.slice(0,-1)),c(b=>b.slice(0,-1))},[]),a=u.useCallback(()=>{i([e]),c([null])},[e]),p=o.length,g=p>1,v=o.length-1,h=o[o.length-1],y=h!=null&&h.titleKey?n(h.titleKey):(h==null?void 0:h.title)??"";u.useEffect(()=>{s.setTitle(y)},[y,s]),u.useEffect(()=>{g?s.setBackHandler(w):s.clearBackHandler()},[g,w,s]),u.useEffect(()=>{const b=l[l.length-1];b?s.setToolbar(b):s.clearToolbar()},[l,s]);const j={push:m,pop:w,reset:a,depth:p,canGoBack:g,currentTitle:y},R={stack:o,toolbarStack:l,updateToolbar:d,clearToolbarAt:f,topIndex:v};return r.jsx(ye.Provider,{value:j,children:r.jsx(je.Provider,{value:R,children:t})})}function kn({index:e,children:t}){const n=u.useContext(je);if(!n)throw new Error("NavViewProvider must be used within NavStackProvider");const{updateToolbar:s,clearToolbarAt:o,topIndex:i}=n,l=u.useCallback(f=>{e===i&&s(e,f)},[e,i,s]),c=u.useCallback(()=>{e===i&&o(e)},[e,i,o]),d={setToolbar:l,clearToolbar:c};return r.jsx(qe.Provider,{value:d,children:t})}function Nn(){const e=u.useContext(ye),t=u.useContext(je);if(!e||!t)throw new Error("NavStackContainer must be used within a NavStackProvider");const{stack:n}=t;return r.jsx("div",{className:"nav-stack-container",children:r.jsx("div",{className:"nav-stack-content",children:n.map((s,o)=>{const i=o===n.length-1;return r.jsx(kn,{index:o,children:r.jsx("div",{style:{display:i?"flex":"none",flexDirection:"column",height:"100%"},children:s.component})},s.id)})})})}exports.ActivityIndicator=me;exports.Alert=Qe;exports.AppContainer=xe;exports.AppContext=be;exports.AppDialog=vn;exports.AppPanel=bn;exports.AppTaskbar=xn;exports.AppTitleBar=De;exports.Battery=Ze;exports.Button=H;exports.ButtonGroup=et;exports.Checkbox=nt;exports.CloseButton=ge;exports.ComboBox=at;exports.ContextMenu=pt;exports.Dialog=ft;exports.DialogClose=U;exports.EditButton=lt;exports.Hyperlink=ut;exports.Input=gt;exports.ListGroup=xt;exports.ListGroupItem=bt;exports.MonthRangePicker=wt;exports.MultiSelect=vt;exports.NavStackContainer=Nn;exports.NavStackProvider=jn;exports.Notification=Be;exports.NotificationContainer=Rt;exports.NumberInput=yt;exports.RefreshButton=ct;exports.Slider=jt;exports.TabPanel=Te;exports.TabPanels=Nt;exports.Tabs=St;exports.Toggle=At;exports.TrashButton=dt;exports.ViewportProvider=Lt;exports.appRegistry=J;exports.appStateStore=V;exports.cn=Ke;exports.createAppI18nFactory=Mt;exports.notificationManager=Et;exports.runningAppsStore=L;exports.useApp=Le;exports.useDialog=Pe;exports.useNavStack=wn;exports.useNavView=yn;exports.useViewport=ve;
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|