@anyemp/ui-kit 1.3.1 → 1.3.2

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.
@@ -1,7 +1,7 @@
1
- (function(te,l){typeof exports=="object"&&typeof module<"u"?l(exports,require("react"),require("react-dom")):typeof define=="function"&&define.amd?define(["exports","react","react-dom"],l):(te=typeof globalThis<"u"?globalThis:te||self,l(te.UIKit={},te.React,te.ReactDOM))})(this,(function(te,l,Ct){"use strict";var Sn={exports:{}},an={};var $a;function sr(){if($a)return an;$a=1;var t=Symbol.for("react.transitional.element"),n=Symbol.for("react.fragment");function s(a,r,i){var o=null;if(i!==void 0&&(o=""+i),r.key!==void 0&&(o=""+r.key),"key"in r){i={};for(var c in r)c!=="key"&&(i[c]=r[c])}else i=r;return r=i.ref,{$$typeof:t,type:a,key:o,ref:r!==void 0?r:null,props:i}}return an.Fragment=n,an.jsx=s,an.jsxs=s,an}var sn={};var Ta;function rr(){return Ta||(Ta=1,process.env.NODE_ENV!=="production"&&(function(){function t(b){if(b==null)return null;if(typeof b=="function")return b.$$typeof===ae?null:b.displayName||b.name||null;if(typeof b=="string")return b;switch(b){case g:return"Fragment";case S:return"Profiler";case y:return"StrictMode";case H:return"Suspense";case J:return"SuspenseList";case B:return"Activity"}if(typeof b=="object")switch(typeof b.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),b.$$typeof){case v:return"Portal";case L:return b.displayName||"Context";case k:return(b._context.displayName||"Context")+".Consumer";case $:var A=b.render;return b=b.displayName,b||(b=A.displayName||A.name||"",b=b!==""?"ForwardRef("+b+")":"ForwardRef"),b;case ee:return A=b.displayName||null,A!==null?A:t(b.type)||"Memo";case D:A=b._payload,b=b._init;try{return t(b(A))}catch{}}return null}function n(b){return""+b}function s(b){try{n(b);var A=!1}catch{A=!0}if(A){A=console;var I=A.error,W=typeof Symbol=="function"&&Symbol.toStringTag&&b[Symbol.toStringTag]||b.constructor.name||"Object";return I.call(A,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",W),n(b)}}function a(b){if(b===g)return"<>";if(typeof b=="object"&&b!==null&&b.$$typeof===D)return"<...>";try{var A=t(b);return A?"<"+A+">":"<...>"}catch{return"<...>"}}function r(){var b=F.A;return b===null?null:b.getOwner()}function i(){return Error("react-stack-top-frame")}function o(b){if(ve.call(b,"key")){var A=Object.getOwnPropertyDescriptor(b,"key").get;if(A&&A.isReactWarning)return!1}return b.key!==void 0}function c(b,A){function I(){oe||(oe=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",A))}I.isReactWarning=!0,Object.defineProperty(b,"key",{get:I,configurable:!0})}function d(){var b=t(this.type);return ye[b]||(ye[b]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),b=this.props.ref,b!==void 0?b:null}function u(b,A,I,W,V,be){var w=I.ref;return b={$$typeof:x,type:b,key:A,props:I,_owner:W},(w!==void 0?w:null)!==null?Object.defineProperty(b,"ref",{enumerable:!1,get:d}):Object.defineProperty(b,"ref",{enumerable:!1,value:null}),b._store={},Object.defineProperty(b._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(b,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(b,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:V}),Object.defineProperty(b,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:be}),Object.freeze&&(Object.freeze(b.props),Object.freeze(b)),b}function p(b,A,I,W,V,be){var w=A.children;if(w!==void 0)if(W)if(me(w)){for(W=0;W<w.length;W++)f(w[W]);Object.freeze&&Object.freeze(w)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else f(w);if(ve.call(A,"key")){w=t(b);var R=Object.keys(A).filter(function(ue){return ue!=="key"});W=0<R.length?"{key: someKey, "+R.join(": ..., ")+": ...}":"{key: someKey}",G[w+W]||(R=0<R.length?"{"+R.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
1
+ (function(ee,l){typeof exports=="object"&&typeof module<"u"?l(exports,require("react"),require("react-dom")):typeof define=="function"&&define.amd?define(["exports","react","react-dom"],l):(ee=typeof globalThis<"u"?globalThis:ee||self,l(ee.UIKit={},ee.React,ee.ReactDOM))})(this,(function(ee,l,Mt){"use strict";var Sn={exports:{}},an={};var $a;function ir(){if($a)return an;$a=1;var t=Symbol.for("react.transitional.element"),n=Symbol.for("react.fragment");function s(a,r,i){var o=null;if(i!==void 0&&(o=""+i),r.key!==void 0&&(o=""+r.key),"key"in r){i={};for(var c in r)c!=="key"&&(i[c]=r[c])}else i=r;return r=i.ref,{$$typeof:t,type:a,key:o,ref:r!==void 0?r:null,props:i}}return an.Fragment=n,an.jsx=s,an.jsxs=s,an}var sn={};var Ta;function lr(){return Ta||(Ta=1,process.env.NODE_ENV!=="production"&&(function(){function t(b){if(b==null)return null;if(typeof b=="function")return b.$$typeof===ne?null:b.displayName||b.name||null;if(typeof b=="string")return b;switch(b){case g:return"Fragment";case S:return"Profiler";case y:return"StrictMode";case H:return"Suspense";case Z:return"SuspenseList";case B:return"Activity"}if(typeof b=="object")switch(typeof b.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),b.$$typeof){case v:return"Portal";case T:return b.displayName||"Context";case k:return(b._context.displayName||"Context")+".Consumer";case $:var A=b.render;return b=b.displayName,b||(b=A.displayName||A.name||"",b=b!==""?"ForwardRef("+b+")":"ForwardRef"),b;case te:return A=b.displayName||null,A!==null?A:t(b.type)||"Memo";case D:A=b._payload,b=b._init;try{return t(b(A))}catch{}}return null}function n(b){return""+b}function s(b){try{n(b);var A=!1}catch{A=!0}if(A){A=console;var I=A.error,W=typeof Symbol=="function"&&Symbol.toStringTag&&b[Symbol.toStringTag]||b.constructor.name||"Object";return I.call(A,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",W),n(b)}}function a(b){if(b===g)return"<>";if(typeof b=="object"&&b!==null&&b.$$typeof===D)return"<...>";try{var A=t(b);return A?"<"+A+">":"<...>"}catch{return"<...>"}}function r(){var b=F.A;return b===null?null:b.getOwner()}function i(){return Error("react-stack-top-frame")}function o(b){if(Ne.call(b,"key")){var A=Object.getOwnPropertyDescriptor(b,"key").get;if(A&&A.isReactWarning)return!1}return b.key!==void 0}function c(b,A){function I(){re||(re=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",A))}I.isReactWarning=!0,Object.defineProperty(b,"key",{get:I,configurable:!0})}function d(){var b=t(this.type);return je[b]||(je[b]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),b=this.props.ref,b!==void 0?b:null}function u(b,A,I,W,V,ve){var w=I.ref;return b={$$typeof:x,type:b,key:A,props:I,_owner:W},(w!==void 0?w:null)!==null?Object.defineProperty(b,"ref",{enumerable:!1,get:d}):Object.defineProperty(b,"ref",{enumerable:!1,value:null}),b._store={},Object.defineProperty(b._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(b,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(b,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:V}),Object.defineProperty(b,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:ve}),Object.freeze&&(Object.freeze(b.props),Object.freeze(b)),b}function p(b,A,I,W,V,ve){var w=A.children;if(w!==void 0)if(W)if(ue(w)){for(W=0;W<w.length;W++)f(w[W]);Object.freeze&&Object.freeze(w)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else f(w);if(Ne.call(A,"key")){w=t(b);var R=Object.keys(A).filter(function(he){return he!=="key"});W=0<R.length?"{key: someKey, "+R.join(": ..., ")+": ...}":"{key: someKey}",G[w+W]||(R=0<R.length?"{"+R.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
2
2
  let props = %s;
3
3
  <%s {...props} />
4
4
  React keys must be passed directly to JSX without using spread:
5
5
  let props = %s;
6
- <%s key={someKey} {...props} />`,W,w,R,w),G[w+W]=!0)}if(w=null,I!==void 0&&(s(I),w=""+I),o(A)&&(s(A.key),w=""+A.key),"key"in A){I={};for(var re in A)re!=="key"&&(I[re]=A[re])}else I=A;return w&&c(I,typeof b=="function"?b.displayName||b.name||"Unknown":b),u(b,w,I,r(),V,be)}function f(b){h(b)?b._store&&(b._store.validated=1):typeof b=="object"&&b!==null&&b.$$typeof===D&&(b._payload.status==="fulfilled"?h(b._payload.value)&&b._payload.value._store&&(b._payload.value._store.validated=1):b._store&&(b._store.validated=1))}function h(b){return typeof b=="object"&&b!==null&&b.$$typeof===x}var m=l,x=Symbol.for("react.transitional.element"),v=Symbol.for("react.portal"),g=Symbol.for("react.fragment"),y=Symbol.for("react.strict_mode"),S=Symbol.for("react.profiler"),k=Symbol.for("react.consumer"),L=Symbol.for("react.context"),$=Symbol.for("react.forward_ref"),H=Symbol.for("react.suspense"),J=Symbol.for("react.suspense_list"),ee=Symbol.for("react.memo"),D=Symbol.for("react.lazy"),B=Symbol.for("react.activity"),ae=Symbol.for("react.client.reference"),F=m.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ve=Object.prototype.hasOwnProperty,me=Array.isArray,Q=console.createTask?console.createTask:function(){return null};m={react_stack_bottom_frame:function(b){return b()}};var oe,ye={},ke=m.react_stack_bottom_frame.bind(m,i)(),Z=Q(a(i)),G={};sn.Fragment=g,sn.jsx=function(b,A,I){var W=1e4>F.recentlyCreatedOwnerStacks++;return p(b,A,I,!1,W?Error("react-stack-top-frame"):ke,W?Q(a(b)):Z)},sn.jsxs=function(b,A,I){var W=1e4>F.recentlyCreatedOwnerStacks++;return p(b,A,I,!0,W?Error("react-stack-top-frame"):ke,W?Q(a(b)):Z)}})()),sn}var La;function ir(){return La||(La=1,process.env.NODE_ENV==="production"?Sn.exports=sr():Sn.exports=rr()),Sn.exports}var e=ir();function Kn(t){return typeof t=="object"&&"from"in t&&"to"in t}function Un(t){return typeof t=="string"?`ui-gradient--${t}`:null}function qn(t){return t.startsWith("#")?t:`var(${t.includes("-")?`--palette-${t}`:t})`}function Gn(t){const n=t.direction||"diagonal",s={horizontal:"90deg",vertical:"180deg",diagonal:"135deg",radial:"circle"},a=qn(t.from),r=qn(t.to),i=t.via?qn(t.via):null,c=n==="radial"?"radial-gradient":"linear-gradient",d=s[n];return i?`${c}(${d}, ${a} 0%, ${i} 50%, ${r} 100%)`:`${c}(${d}, ${a} 0%, ${r} 100%)`}const Xe=({variant:t="filled",color:n="primary",gradient:s,size:a="medium",disabled:r=!1,children:i,sx:o,style:c,...d})=>{const u=!!s,p=`ui-button ui-button--${t} ui-button--${a}`,h=c?.background||c?.backgroundColor||c?.color?"":u?typeof s=="string"?Un(s):"ui-button--custom-gradient":`ui-button--${n}`,x=`${p} ${h} ${r?"ui-button--disabled":""}`.trim(),v=o?`${x} ${o}`.trim():x,y={...u&&Kn(s)&&t==="filled"?{background:Gn(s)}:void 0,...c};return e.jsx("button",{className:v,disabled:r,style:y,...d,children:i})},lr="ui-kit-portal-root";function Dn(t){const{containerId:n=lr,containerElement:s}=t||{},[a,r]=l.useState(null);return l.useEffect(()=>{if(typeof document>"u")return;if(s){r(s);return}let i=document.getElementById(n);return i||(i=document.createElement("div"),i.id=n,i.setAttribute("data-ui-kit-portal","true"),document.body.appendChild(i)),r(i),()=>{i&&i.id===n&&i.childNodes.length===0&&i.parentNode&&i.parentNode.removeChild(i)}},[n,s]),a}const Aa=150,Ia=48,or=t=>{const[n,s]=t.split("-");return{side:n,align:s??"center"}};function Pa(t){const{triggerRef:n,floatingRef:s,open:a,placement:r="bottom-start",gap:i=8,maxHeight:o=320,matchWidth:c=!1,zIndex:d}=t,{side:u,align:p}=or(r),[f,h]=l.useState({}),[m,x]=l.useState(u),[v,g]=l.useState(!1),y=l.useRef(null);return l.useLayoutEffect(()=>{if(!a){g(!1);return}const S=()=>{y.current=null;const H=n.current;if(!H)return;const J=H.getBoundingClientRect(),ee=s.current?.offsetHeight??0,D=s.current?.offsetWidth??0,B=Math.min(ee||o,o),ae=window.innerWidth,F=window.innerHeight,ve=F-J.bottom-i,me=J.top-i;let Q=u;if(u==="bottom"){const G=ve<Aa,b=B>ve&&me>ve+Ia;(G?me>ve:b)&&(Q="top")}else{const G=me<Aa,b=B>me&&ve>me+Ia;(G?ve>me:b)&&(Q="bottom")}const oe=8,ye=c?J.width:D;let ke;c||p==="start"?ke=J.left:p==="end"?ke=J.right-(ye||0):ke=J.left+J.width/2-(ye||0)/2,ye&&(ke=Math.max(oe,Math.min(ke,ae-ye-oe)));const Z={position:"fixed",left:ke,zIndex:d??"var(--z-index-dropdown, 1000)"};c&&(Z.width=ye),Q==="bottom"?(Z.top=J.bottom+i,Z.maxHeight=Math.min(o,Math.max(0,ve))):(Z.bottom=F-J.top+i,Z.maxHeight=Math.min(o,Math.max(0,me))),x(Q),h(Z),g(!0)},k=()=>{y.current===null&&(y.current=requestAnimationFrame(S))};S(),window.addEventListener("scroll",k,!0),window.addEventListener("resize",k);const L=n.current,$=typeof ResizeObserver<"u"?new ResizeObserver(k):null;return L&&$&&$.observe(L),s.current&&$&&$.observe(s.current),()=>{window.removeEventListener("scroll",k,!0),window.removeEventListener("resize",k),y.current!==null&&cancelAnimationFrame(y.current),y.current=null,$?.disconnect()}},[a,r,i,o,c,d]),{style:f,side:m,ready:v}}const Lt=l.createContext(null),rn=10,cr=20,dr=1050,za=l.createContext({variant:"menu"}),Xn=({children:t,disabled:n,selected:s,onClick:a,sx:r,style:i})=>{const{variant:o}=l.useContext(za),c=o==="menu"&&!n,d=u=>{(u.key==="Enter"||u.key===" ")&&(u.preventDefault(),a?.())};return e.jsx("div",{className:`ui-dropdown__item${n?" ui-dropdown__item--disabled":""}${s?" ui-dropdown__item--selected":""}${r?` ${r}`:""}`,style:i,role:"menuitem","aria-disabled":n,"aria-selected":s,tabIndex:c?0:-1,onClick:c?a:void 0,onKeyDown:c?d:void 0,children:t})};Xn.displayName="DropdownItem";const Jn=({trigger:t,children:n,placement:s="bottom-end",divider:a=!1,variant:r="menu",portal:i=!1,sx:o,style:c})=>{const[d,u]=l.useState(!1),p=l.useRef(null),f=l.useRef(null),h=Dn(),m=l.useContext(Lt),x=m?m.baseZ+rn:void 0,v=Pa({triggerRef:p,floatingRef:f,open:i&&d,placement:s,gap:8,zIndex:x,maxHeight:400}),g=l.useCallback(()=>{u(!1)},[]);l.useEffect(()=>{if(!d)return;const H=ee=>{const D=ee.target;!p.current?.contains(D)&&!f.current?.contains(D)&&g()};r==="menu"&&f.current?.querySelector('[role="menuitem"]:not([aria-disabled="true"])')?.focus();const J=setTimeout(()=>document.addEventListener("click",H),0);return()=>{clearTimeout(J),document.removeEventListener("click",H)}},[d,r,g]);const y=H=>{H.preventDefault(),H.stopPropagation(),u(J=>!J)},S=H=>{if(H.key==="Escape"){g();return}if(H.key==="Tab"){g();return}if(!d||r!=="menu")return;const J=f.current?.querySelectorAll('[role="menuitem"]:not([aria-disabled="true"])');if(!J?.length)return;const ee=Array.from(J),D=ee.indexOf(document.activeElement);if(H.key==="ArrowDown"){H.preventDefault();const B=D<ee.length-1?D+1:0;ee[B].focus()}else if(H.key==="ArrowUp"){H.preventDefault();const B=D>0?D-1:ee.length-1;ee[B].focus()}},k=()=>{g()},L=["ui-dropdown__menu",!a&&"ui-dropdown__menu--no-divider",r==="info"&&"ui-dropdown__menu--info",i&&"ui-dropdown__menu--portal",o?.menu].filter(Boolean).join(" "),$=e.jsx("div",{ref:f,className:L,style:i?{...v.style,...c?.menu}:c?.menu,onClick:k,onKeyDown:S,"data-placement":i?`${v.side}-${s.split("-")[1]??"center"}`:void 0,children:n});return e.jsxs(za.Provider,{value:{variant:r},children:[e.jsxs("div",{ref:p,className:`ui-dropdown ui-dropdown--${s}${d?" ui-dropdown--open":""}${i?" ui-dropdown--portal":""}${o?.root?` ${o.root}`:""}`,style:c?.root,onKeyDown:S,children:[e.jsx("span",{style:{display:"contents"},onClick:y,children:t}),!i&&$]}),i&&d&&h&&Ct.createPortal($,h)]})};Jn.displayName="Dropdown";const Ot=l.forwardRef(({label:t,helperText:n,error:s=!1,multiline:a=!1,rows:r=3,startAdornment:i,endAdornment:o,fullWidth:c=!1,size:d="normal",disabled:u=!1,placeholder:p,sx:f,id:h,...m},x)=>{const v=l.useId(),g=h||v,y=n?`${g}-helper-text`:void 0,S=(...J)=>J.filter(Boolean).join(" "),k=S("ui-textfield",c&&"ui-textfield--full-width",f?.root),L=S("ui-textfield__wrapper",`ui-textfield__wrapper--${d}`,s&&"ui-textfield__wrapper--error",u&&"ui-textfield__wrapper--disabled",!!i&&"ui-textfield__wrapper--with-start-adornment",!!o&&"ui-textfield__wrapper--with-end-adornment",f?.wrapper),$=S("ui-textfield__input",`ui-textfield__input--${d}`,a&&"ui-textfield__input--textarea",f?.input),H=a?"textarea":"input";return e.jsxs("div",{className:k,children:[t&&e.jsxs("label",{htmlFor:g,className:S("ui-textfield__label",s&&"ui-textfield__label--error",f?.label),children:[t,m.required&&e.jsx("span",{className:"ui-textfield__label-required",children:"*"})]}),e.jsxs("div",{className:L,children:[i&&e.jsx("span",{className:"ui-textfield__adornment ui-textfield__adornment--start",children:i}),e.jsx(H,{ref:x,id:g,className:$,disabled:u,rows:a?r:void 0,placeholder:p,"aria-label":t?void 0:p,"aria-invalid":s,"aria-describedby":y,...m}),o&&e.jsx("span",{className:"ui-textfield__adornment ui-textfield__adornment--end",children:o})]}),n&&e.jsx("p",{id:y,className:S("ui-textfield__helper-text",s&&"ui-textfield__helper-text--error",f?.helperText),children:n})]})});Ot.displayName="TextField";const mt=({label:t,leadingIcon:n,trailingIcon:s,variant:a="filled",color:r="neutral",size:i="medium",selected:o=!1,disabled:c=!1,onClick:d,onDelete:u,sx:p,style:f})=>{const h=!!d&&!c,m=["ui-chip",`ui-chip--${a}`,`ui-chip--${r}`,`ui-chip--${i}`,o&&"ui-chip--selected",c&&"ui-chip--disabled",h&&"ui-chip--clickable",p].filter(Boolean).join(" "),x=g=>{c||d?.(g)},v=g=>{g.stopPropagation(),!c&&u?.(g)};return e.jsxs("div",{className:m,style:f,role:h?"button":void 0,tabIndex:h?0:void 0,"aria-pressed":h&&o?!0:void 0,"aria-disabled":c?!0:void 0,onClick:x,onKeyDown:h?g=>{(g.key==="Enter"||g.key===" ")&&(g.preventDefault(),d?.(g))}:void 0,children:[n&&e.jsx("span",{className:"ui-chip__icon ui-chip__icon--leading","aria-hidden":"true",children:n}),e.jsx("span",{className:"ui-chip__label",children:t}),!u&&s&&e.jsx("span",{className:"ui-chip__icon ui-chip__icon--trailing","aria-hidden":"true",children:s}),u&&e.jsx("button",{type:"button",className:"ui-chip__delete","aria-label":`Remove ${t}`,disabled:c,onClick:v,tabIndex:c?-1:0,children:e.jsx("svg",{className:"ui-chip__delete-icon",viewBox:"0 0 24 24","aria-hidden":"true",focusable:"false",children:e.jsx("path",{d:"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"})})})]})};mt.displayName="Chip";const ln=8,En=320,ur=150,hr=48,Ha=(t,n)=>{const s=window.innerHeight-t.bottom-ln,a=t.top-ln,r=Math.min(n,En);return(s<ur?a>s:r>s&&a>s+hr)?{bottom:window.innerHeight-t.top+ln,left:t.left,width:t.width,maxHeight:Math.min(En,a)}:{top:t.bottom+ln,left:t.left,width:t.width,maxHeight:Math.min(En,s)}},Mt=(...t)=>t.filter(Boolean).join(" "),$n=l.forwardRef(({options:t,label:n,placeholder:s="Select...",multiple:a=!1,disabled:r=!1,size:i="normal",sx:o,id:c,value:d,defaultValue:u,onChange:p,error:f=!1,helperText:h,fullWidth:m=!1,clearable:x=!1,chipDisplay:v="inside",chipProps:g,required:y=!1,...S},k)=>{const L=l.useId(),$=c||L,H=n?`${$}-label`:void 0,J=`${$}-listbox`,ee=h?`${$}-helper-text`:void 0,D=l.useRef(null),B=l.useRef(null),ae=l.useRef(null),F=l.useRef(null),ve=l.useContext(Lt),me=ve?ve.baseZ+rn:void 0,[Q,oe]=l.useState(!1),[ye,ke]=l.useState(null),[Z,G]=l.useState(!1),[b,A]=l.useState(u!==void 0?a?Array.isArray(u)?u:[u]:u:a?[]:null),[I,W]=l.useState(-1),V=["small","normal","large"].includes(i)?i:"normal";process.env.NODE_ENV!=="production"&&i!==V&&console.warn(`Select: Invalid size "${i}". Using "normal" instead.`);const be=d!==void 0,w=be?d:b,R=t.length>0&&"options"in t[0],re=R?t.flatMap(j=>j.options):t,ue=re.filter(j=>!j.disabled),P=l.useCallback(()=>{oe(!1),W(-1)},[]);l.useEffect(()=>{const j=D.current;if(!j)return;if(!Q){ke(null),G(!1);return}const z=j.getBoundingClientRect();ke({top:z.bottom+ln,left:z.left,width:z.width,maxHeight:En}),G(!1);const U=we=>{!B.current?.contains(we.target)&&!ae.current?.contains(we.target)&&P()};setTimeout(()=>document.addEventListener("click",U),0);const X=()=>{!ae.current||!D.current||ke(Ha(D.current.getBoundingClientRect(),ae.current.offsetHeight))};return window.addEventListener("scroll",X,!0),window.addEventListener("resize",X),()=>{window.removeEventListener("scroll",X,!0),window.removeEventListener("resize",X),document.removeEventListener("click",U)}},[Q,P]),l.useLayoutEffect(()=>{if(!Q||Z||!ae.current||!D.current)return;const j=D.current.getBoundingClientRect();ke(Ha(j,ae.current.offsetHeight)),G(!0)},[Q,ye,Z]),l.useEffect(()=>{if(I<0||!F.current)return;F.current.querySelectorAll('[role="option"]')[I]?.scrollIntoView({block:"nearest"})},[I]);const ie=j=>{be||A(j),p?.(j),!a&&j!==null&&P()},$e=j=>{if(a){const z=Array.isArray(w)?w:[],U=z.includes(j)?z.filter(X=>X!==j):[...z,j];ie(U.length>0?U:[])}else ie(j),D.current?.focus()},Pe=(j,z)=>{j.preventDefault(),j.stopPropagation();const X=(Array.isArray(w)?w:[]).filter(we=>we!==z);ie(X.length>0?X:[])},he=j=>{j.preventDefault(),j.stopPropagation(),ie(a?[]:null),D.current?.focus()},Ce=j=>{if(ue.length===0)return;let z=-1;if(I>=0&&I<re.length){const X=re[I];z=ue.findIndex(we=>we.value===X?.value)}const U=j==="next"?(z+1)%ue.length:z<=0?ue.length-1:z-1;W(re.findIndex(X=>X.value===ue[U].value))},_e=(j,z)=>{if(!(r&&!z))switch(j.key){case"Enter":case" ":{if(j.preventDefault(),z&&I>=0&&I<re.length){const U=re[I];U.disabled||$e(U.value)}else oe(!Q),Q||W(-1);break}case"ArrowDown":{j.preventDefault(),!Q&&!z?(oe(!0),W(-1)):Ce("next");break}case"ArrowUp":{j.preventDefault(),Q&&Ce("prev");break}case"Escape":{j.preventDefault(),P(),z||D.current?.focus();break}case"Tab":{P();break}}},ze=a&&Array.isArray(w)?w:[],C=j=>j.map(z=>{const U=re.find(X=>X.value===z);return e.jsx(mt,{label:U?.label??z,variant:g?.variant??"filled",color:g?.color??"neutral",size:g?.size??"small",leadingIcon:g?.leadingIcon,sx:g?.sx,disabled:r,onDelete:r?void 0:X=>Pe(X,z)},z)}),q=()=>{if(a)return v==="outside"?ze.length?null:e.jsx("span",{className:"ui-select__placeholder",children:s}):ze.length?e.jsx(e.Fragment,{children:C(ze)}):e.jsx("span",{className:"ui-select__placeholder",children:s});if(!w||w==="")return e.jsx("span",{className:"ui-select__placeholder",children:s});const j=re.find(z=>z.value===w);return j?e.jsx("span",{className:"ui-select__value",children:j.label}):e.jsx("span",{className:"ui-select__placeholder",children:s})},ne=a?Array.isArray(w)&&w.length>0:w!==null&&w!=="";return e.jsxs("div",{ref:B,className:Mt("ui-select",a&&"ui-select--multiple",m&&"ui-select--full-width",o?.root),style:{position:"relative"},children:[n&&e.jsxs("label",{id:H,htmlFor:$,className:Mt("ui-select__label",f&&"ui-select__label--error",o?.label),children:[n,y&&e.jsx("span",{className:"ui-select__label-required",children:"*"})]}),a&&v==="outside"&&ze.length>0&&e.jsx("div",{className:"ui-select__chips-outside",children:C(ze)}),e.jsxs("button",{...S,ref:j=>{typeof k=="function"?k(j):k&&(k.current=j),D.current=j},id:$,"aria-labelledby":H,"aria-haspopup":"listbox","aria-expanded":Q,"aria-controls":J,"aria-disabled":r,"aria-invalid":f,"aria-describedby":ee,disabled:r,onClick:j=>{if(j.preventDefault(),j.stopPropagation(),!r){const z=!Q;oe(z),z&&W(-1)}},onBlur:j=>{const z=j.relatedTarget;!B.current?.contains(z)&&!ae.current?.contains(z)&&P()},onKeyDown:j=>_e(j,!1),className:Mt("ui-select__trigger",`ui-select__trigger--${V}`,a&&"ui-select__trigger--multi",a&&v==="inside"&&ze.length>0&&"ui-select__trigger--has-chips",r&&"ui-select__trigger--disabled",f&&"ui-select__trigger--error",Q&&"base--expanded",o?.trigger),"aria-label":n||s,type:"button",children:[q(),x&&ne&&e.jsx("span",{role:"button",className:"ui-select__clear",onClick:he,onKeyDown:j=>{(j.key==="Enter"||j.key===" ")&&(j.preventDefault(),he({preventDefault:()=>{},stopPropagation:()=>{}}))},"aria-label":"Clear selection",tabIndex:0,children:e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),e.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),Q&&ye&&Ct.createPortal(e.jsx("div",{ref:ae,className:Mt("ui-select__popup",o?.popup),style:{position:"fixed",top:ye.top,bottom:ye.bottom,left:ye.left,width:ye.width,visibility:Z?"visible":"hidden",...me!==void 0?{zIndex:me}:null},onClick:j=>j.stopPropagation(),children:e.jsx("ul",{ref:F,id:J,role:"listbox","aria-multiselectable":a,"aria-labelledby":H,onKeyDown:j=>_e(j,!0),className:Mt("ui-select__listbox",`ui-select__listbox--${V}`,a&&"ui-select__listbox--multiple",r&&"base--disabled",o?.listbox),style:{maxHeight:ye?.maxHeight},children:re.length===0?e.jsx("li",{className:"ui-select__empty",role:"presentation",children:"No options found"}):R?t.map(j=>e.jsxs(l.Fragment,{children:[e.jsx("li",{role:"presentation",className:"ui-select__group-label",children:j.label}),j.options.map(z=>{const U=re.findIndex(we=>we.value===z.value),X=a?Array.isArray(w)&&w.includes(z.value):w===z.value;return e.jsx("li",{role:"option","aria-selected":X,"aria-disabled":z.disabled,"aria-posinset":U+1,"aria-setsize":re.length,onClick:we=>{we.preventDefault(),we.stopPropagation(),z.disabled||$e(z.value)},onMouseDown:we=>{we.preventDefault(),we.stopPropagation()},onMouseEnter:()=>W(U),className:Mt("ui-select__option",a?"ui-select__option--multi":"ui-select__option--single",X&&"base--selected",I===U&&"base--highlighted",z.disabled&&"base--disabled",o?.option),style:{cursor:z.disabled?"not-allowed":"pointer"},children:e.jsxs("span",{className:"ui-select__option-body",children:[e.jsx("span",{className:"ui-select__option-label",children:z.label}),z.description&&e.jsx("span",{className:"ui-select__option-description",children:z.description})]})},z.value)})]},j.label)):re.map((j,z)=>{const U=a?Array.isArray(w)&&w.includes(j.value):w===j.value;return e.jsx("li",{role:"option","aria-selected":U,"aria-disabled":j.disabled,"aria-posinset":z+1,"aria-setsize":re.length,onClick:X=>{X.preventDefault(),X.stopPropagation(),j.disabled||$e(j.value)},onMouseDown:X=>{X.preventDefault(),X.stopPropagation()},onMouseEnter:()=>W(z),className:Mt("ui-select__option",a?"ui-select__option--multi":"ui-select__option--single",U&&"base--selected",I===z&&"base--highlighted",j.disabled&&"base--disabled",o?.option),style:{cursor:j.disabled?"not-allowed":"pointer"},children:e.jsxs("span",{className:"ui-select__option-body",children:[e.jsx("span",{className:"ui-select__option-label",children:j.label}),j.description&&e.jsx("span",{className:"ui-select__option-description",children:j.description})]})},j.value)})})}),document.body),h&&e.jsx("p",{id:ee,className:Mt("ui-select__helper-text",f&&"ui-select__helper-text--error",o?.helperText),children:h})]})});$n.displayName="Select";const on=8,Tn=320,pr=150,mr=48,Ba=(t,n)=>{const s=window.innerHeight-t.bottom-on,a=t.top-on,r=Math.min(n,Tn);return(s<pr?a>s:r>s&&a>s+mr)?{bottom:window.innerHeight-t.top+on,left:t.left,width:t.width,maxHeight:Math.min(Tn,a)}:{top:t.bottom+on,left:t.left,width:t.width,maxHeight:Math.min(Tn,s)}},fr=(t,n)=>{const s=n.toLowerCase();return t.filter(a=>a.label.toLowerCase().includes(s)||a.description?.toLowerCase().includes(s))},Ft=(...t)=>t.filter(Boolean).join(" "),Zn=({options:t,label:n,placeholder:s="Search...",multiple:a=!1,disabled:r=!1,size:i="normal",sx:o,id:c,value:d,defaultValue:u,onChange:p,onSearchChange:f,filterOptions:h,error:m=!1,helperText:x,fullWidth:v=!1,clearable:g=!1,noOptionsText:y="No options found",required:S=!1,chipProps:k})=>{const L=l.useId(),$=c||L,H=n?`${$}-label`:void 0,J=`${$}-listbox`,ee=x?`${$}-helper-text`:void 0,D=l.useRef(null),B=l.useRef(null),ae=l.useRef(null),F=l.useRef(null),ve=l.useContext(Lt),me=ve?ve.baseZ+rn:void 0,Q=l.useRef(null),[oe,ye]=l.useState(!1),[ke,Z]=l.useState(null),[G,b]=l.useState(!1),[A,I]=l.useState(u!==void 0?a?Array.isArray(u)?u:[u]:u:a?[]:null),[W,V]=l.useState(-1),[be,w]=l.useState(""),[R,re]=l.useState(!1),ue=d!==void 0,P=ue?d:A,ie=t.length>0&&"options"in t[0],$e=ie?t.flatMap(O=>O.options):t,Pe=h??fr,he=be.trim()?Pe($e,be):$e,Ce=he.filter(O=>!O.disabled),_e=a||!P||P===""?"":$e.find(le=>le.value===P)?.label??(typeof P=="string"?P:""),ze=a||R?be:_e,C=l.useCallback(()=>{ye(!1),V(-1),w(""),re(!1)},[]),q=l.useCallback(()=>{C()},[C]);l.useEffect(()=>{const O=B.current;if(!O)return;if(!oe){Z(null),b(!1);return}const le=O.getBoundingClientRect();Z({top:le.bottom+on,left:le.left,width:le.width,maxHeight:Tn}),b(!1);const ge=Ae=>{!D.current?.contains(Ae.target)&&!F.current?.contains(Ae.target)&&q()};setTimeout(()=>document.addEventListener("click",ge),0);const je=()=>{!F.current||!B.current||Z(Ba(B.current.getBoundingClientRect(),F.current.offsetHeight))};return window.addEventListener("scroll",je,!0),window.addEventListener("resize",je),()=>{window.removeEventListener("scroll",je,!0),window.removeEventListener("resize",je),document.removeEventListener("click",ge)}},[oe,q]),l.useLayoutEffect(()=>{if(!oe||G||!F.current||!B.current)return;const O=B.current.getBoundingClientRect();Z(Ba(O,F.current.offsetHeight)),b(!0)},[oe,ke,G]),l.useEffect(()=>{if(W<0||!Q.current)return;Q.current.querySelectorAll('[role="option"]')[W]?.scrollIntoView({block:"nearest"})},[W]);const ne=O=>{ue||I(O),p?.(O)},j=O=>{if(a){const le=Array.isArray(P)?P:[],ge=le.includes(O)?le.filter(je=>je!==O):[...le,O];ne(ge.length>0?ge:[]),w(""),f?.(""),V(-1),ae.current?.focus()}else ne(O),w(""),re(!1),ye(!1),V(-1)},z=(O,le)=>{O.preventDefault(),O.stopPropagation();const ge=Array.isArray(P)?P:[];ne(ge.filter(je=>je!==le))},U=O=>{O.preventDefault(),O.stopPropagation(),ne(a?[]:null),w(""),re(!1),ae.current?.focus()},X=O=>{if(Ce.length===0)return;let le=-1;if(W>=0&&W<he.length){const je=he[W];le=Ce.findIndex(Ae=>Ae.value===je?.value)}const ge=O==="next"?(le+1)%Ce.length:le<=0?Ce.length-1:le-1;V(he.findIndex(je=>je.value===Ce[ge].value))},we=O=>{if(!r)switch(O.key){case"ArrowDown":{O.preventDefault(),oe?X("next"):(ye(!0),V(-1));break}case"ArrowUp":{O.preventDefault(),oe&&X("prev");break}case"Enter":{if(O.preventDefault(),oe&&W>=0&&W<he.length){const le=he[W];le.disabled||j(le.value)}break}case"Escape":{O.preventDefault(),q();break}case"Backspace":{if(a&&be===""){const le=Array.isArray(P)?P:[];le.length>0&&ne(le.slice(0,-1))}break}case"Tab":{q();break}}},N=a&&Array.isArray(P)?P:[],de=a?N.length>0:P!==null&&P!==""&&P!==void 0,fe=()=>N.map(O=>{const le=$e.find(ge=>ge.value===O);return e.jsx(mt,{label:le?.label??O,variant:k?.variant??"filled",color:k?.color??"neutral",size:k?.size??"small",leadingIcon:k?.leadingIcon,sx:k?.sx,disabled:r,onDelete:r?void 0:ge=>z(ge,O)},O)}),De=()=>he.length===0?e.jsx("li",{className:"ui-ac__empty",role:"presentation",children:y}):ie&&!be.trim()?t.map(O=>{const le=O.options.filter(ge=>he.some(je=>je.value===ge.value));return le.length===0?null:e.jsxs(l.Fragment,{children:[e.jsx("li",{role:"presentation",className:"ui-ac__group-label",children:O.label}),le.map(ge=>Ne(ge,he.findIndex(je=>je.value===ge.value)))]},O.label)}):he.map((O,le)=>Ne(O,le)),Ne=(O,le)=>{const ge=a?Array.isArray(P)&&P.includes(O.value):P===O.value;return e.jsx("li",{role:"option","aria-selected":ge,"aria-disabled":O.disabled,"aria-posinset":le+1,"aria-setsize":he.length,onMouseDown:je=>{je.preventDefault(),je.stopPropagation()},onClick:je=>{je.preventDefault(),je.stopPropagation(),O.disabled||j(O.value)},onMouseEnter:()=>V(le),className:Ft("ui-ac__option",ge&&"base--selected",W===le&&"base--highlighted",O.disabled&&"base--disabled",o?.option),style:{cursor:O.disabled?"not-allowed":"pointer"},children:e.jsxs("span",{className:"ui-ac__option-body",children:[e.jsx("span",{className:"ui-ac__option-label",children:O.label}),O.description&&e.jsx("span",{className:"ui-ac__option-description",children:O.description})]})},O.value)};return e.jsxs("div",{ref:D,className:Ft("ui-ac",v&&"ui-ac--full-width",o?.root),children:[n&&e.jsxs("label",{id:H,htmlFor:`${$}-input`,className:Ft("ui-ac__label",m&&"ui-ac__label--error",o?.label),children:[n,S&&e.jsx("span",{className:"ui-ac__label-required",children:"*"})]}),e.jsxs("div",{ref:B,role:"combobox","aria-expanded":oe,"aria-haspopup":"listbox","aria-owns":J,className:Ft("ui-ac__trigger",`ui-ac__trigger--${i}`,a&&"ui-ac__trigger--multi",r&&"ui-ac__trigger--disabled",m&&"ui-ac__trigger--error",oe&&"base--expanded",o?.trigger),onClick:()=>{r||ae.current?.focus()},children:[a&&fe(),e.jsx("input",{ref:ae,id:`${$}-input`,type:"text",role:"combobox","aria-autocomplete":"list","aria-controls":J,"aria-expanded":oe,"aria-labelledby":H,"aria-describedby":ee,"aria-invalid":m,disabled:r,placeholder:a?N.length===0?s:"":s,value:ze,className:"ui-ac__input",autoComplete:"off",onFocus:()=>{r||(a||re(!0),ye(!0),V(-1))},onBlur:O=>{const le=O.relatedTarget;!D.current?.contains(le)&&!F.current?.contains(le)&&q()},onChange:O=>{const le=O.target.value;w(le),f?.(le),V(-1),oe||ye(!0)},onKeyDown:we,onPaste:O=>{if(!a||r)return;const le=O.clipboardData.getData("text");if(!/[\r\n\t]/.test(le))return;O.preventDefault();const ge=le.split(/[\r\n\t]+/).map(Ke=>Ke.trim()).filter(Boolean),je=Array.isArray(P)?P:[],Ae=[],We=[];ge.forEach(Ke=>{const ct=Ke.toLowerCase(),Qe=$e.find(gt=>!gt.disabled&&(gt.label.toLowerCase()===ct||gt.value.toLowerCase()===ct));Qe&&!je.includes(Qe.value)&&!Ae.includes(Qe.value)?Ae.push(Qe.value):Qe||We.push(Ke)}),Ae.length>0&&ne([...je,...Ae]);const ht=We.length>0?We[We.length-1]:"";w(ht),f?.(ht),V(-1),oe||ye(!0),ae.current?.focus()}}),g&&de&&!r&&e.jsx("button",{type:"button",className:"ui-ac__clear",onMouseDown:O=>{O.preventDefault(),U(O)},"aria-label":"Clear selection",tabIndex:-1,children:e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),e.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})}),e.jsx("span",{className:"ui-ac__arrow","aria-hidden":!0})]}),oe&&ke&&Ct.createPortal(e.jsx("div",{ref:F,className:"ui-ac__popup",style:{position:"fixed",top:ke.top,bottom:ke.bottom,left:ke.left,width:ke.width,visibility:G?"visible":"hidden",...me!==void 0?{zIndex:me}:null},onMouseDown:O=>O.preventDefault(),onClick:O=>O.stopPropagation(),children:e.jsx("ul",{ref:Q,id:J,role:"listbox","aria-multiselectable":a,"aria-labelledby":H,className:Ft("ui-ac__listbox",`ui-ac__listbox--${i}`,o?.listbox),style:{maxHeight:ke?.maxHeight},children:De()})}),document.body),x&&e.jsx("p",{id:ee,className:Ft("ui-ac__helper-text",m&&"ui-ac__helper-text--error",o?.helperText),children:x})]})};Zn.displayName="Autocomplete";const Oa=({tags:t,size:n="medium",sx:s})=>e.jsx("div",{className:`ui-tags ui-tags--${n} ${s||""}`.trim(),children:t.map((a,r)=>{const i=a.department?`ui-tags__tag--${a.department}`:"ui-tags__tag--custom";return e.jsx("span",{className:`ui-tags__tag ${i}`,children:a.label},r)})}),_r=({thumbnailUrl:t,title:n,author:s,description:a,tags:r,duration:i,views:o,publishedAt:c,isInPlaylist:d=!1,onClick:u,sx:p})=>{const f=`ui-video-card ${p||""}`.trim();return e.jsxs("div",{className:f,onClick:u,children:[e.jsxs("div",{className:"ui-video-card__thumbnail",children:[t?e.jsx("img",{src:t,alt:n,className:"ui-video-card__thumbnail-image"}):e.jsx("div",{className:"ui-video-card__thumbnail-placeholder",children:e.jsx("span",{children:"Video"})}),d?e.jsx("div",{className:"ui-video-card__playlist-icon",children:e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z"}),e.jsx("path",{d:"M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12"}),e.jsx("path",{d:"M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17"})]})}):i&&e.jsx("span",{className:"ui-video-card__duration",children:i})]}),e.jsxs("div",{className:"ui-video-card__content",children:[e.jsxs("div",{className:"ui-video-card__header",children:[e.jsx("div",{className:"ui-video-card__avatar","data-department":s.department||"default",children:s.initials}),e.jsxs("div",{className:"ui-video-card__title-section",children:[e.jsx("h3",{className:"ui-video-card__title",children:n}),e.jsx("p",{className:"ui-video-card__author",children:s.name})]})]}),e.jsx("p",{className:"ui-video-card__description",children:a}),e.jsx(Oa,{tags:r}),(o||c)&&e.jsxs("div",{className:"ui-video-card__meta",children:[o&&e.jsxs("span",{className:"ui-video-card__views",children:[o," views"]}),o&&c&&e.jsx("span",{className:"ui-video-card__separator",children:"•"}),c&&e.jsx("span",{className:"ui-video-card__published",children:c})]})]})]})},St=({label:t,icon:n,variant:s="filled",color:a="neutral",gradient:r,size:i="medium",sx:o,style:c})=>{const d=!!r,u=`ui-badge ui-badge--${s} ui-badge--${i}`,f=c?.background||c?.backgroundColor||c?.color?"":d?typeof r=="string"?Un(r):"ui-badge--custom-gradient":`ui-badge--${a}`,h=`${u} ${f}`.trim(),m=o?`${h} ${o}`.trim():h,v={...d&&Kn(r)&&s==="filled"?{background:Gn(r)}:void 0,...c};return e.jsxs("span",{className:m,role:"status",style:v,children:[n&&e.jsx("span",{className:"ui-badge__icon","aria-hidden":"true",children:n}),e.jsx("span",{className:"ui-badge__label",children:t})]})};St.displayName="Badge";var Fa={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},Va=l.createContext&&l.createContext(Fa),gr=["attr","size","title"];function xr(t,n){if(t==null)return{};var s=vr(t,n),a,r;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(r=0;r<i.length;r++)a=i[r],!(n.indexOf(a)>=0)&&Object.prototype.propertyIsEnumerable.call(t,a)&&(s[a]=t[a])}return s}function vr(t,n){if(t==null)return{};var s={};for(var a in t)if(Object.prototype.hasOwnProperty.call(t,a)){if(n.indexOf(a)>=0)continue;s[a]=t[a]}return s}function Ln(){return Ln=Object.assign?Object.assign.bind():function(t){for(var n=1;n<arguments.length;n++){var s=arguments[n];for(var a in s)Object.prototype.hasOwnProperty.call(s,a)&&(t[a]=s[a])}return t},Ln.apply(this,arguments)}function Ya(t,n){var s=Object.keys(t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);n&&(a=a.filter(function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable})),s.push.apply(s,a)}return s}function An(t){for(var n=1;n<arguments.length;n++){var s=arguments[n]!=null?arguments[n]:{};n%2?Ya(Object(s),!0).forEach(function(a){br(t,a,s[a])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(s)):Ya(Object(s)).forEach(function(a){Object.defineProperty(t,a,Object.getOwnPropertyDescriptor(s,a))})}return t}function br(t,n,s){return n=jr(n),n in t?Object.defineProperty(t,n,{value:s,enumerable:!0,configurable:!0,writable:!0}):t[n]=s,t}function jr(t){var n=yr(t,"string");return typeof n=="symbol"?n:n+""}function yr(t,n){if(typeof t!="object"||!t)return t;var s=t[Symbol.toPrimitive];if(s!==void 0){var a=s.call(t,n);if(typeof a!="object")return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return(n==="string"?String:Number)(t)}function Wa(t){return t&&t.map((n,s)=>l.createElement(n.tag,An({key:s},n.attr),Wa(n.child)))}function Ee(t){return n=>l.createElement(kr,Ln({attr:An({},t.attr)},n),Wa(t.child))}function kr(t){var n=s=>{var{attr:a,size:r,title:i}=t,o=xr(t,gr),c=r||s.size||"1em",d;return s.className&&(d=s.className),t.className&&(d=(d?d+" ":"")+t.className),l.createElement("svg",Ln({stroke:"currentColor",fill:"currentColor",strokeWidth:"0"},s.attr,a,o,{className:d,style:An(An({color:t.color||s.color},s.style),t.style),height:c,width:c,xmlns:"http://www.w3.org/2000/svg"}),i&&l.createElement("title",null,i),t.children)};return Va!==void 0?l.createElement(Va.Consumer,null,s=>n(s)):n(Fa)}function wr(t){return Ee({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"},child:[]},{tag:"path",attr:{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm-2 15-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z"},child:[]}]})(t)}function Nr(t){return Ee({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0V0z"},child:[]},{tag:"path",attr:{d:"M11 18c0 1.1-.9 2-2 2s-2-.9-2-2 .9-2 2-2 2 .9 2 2zm-2-8c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0-6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm6 4c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2zm0 2c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0 6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z"},child:[]}]})(t)}function Cr(t){return Ee({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"},child:[]},{tag:"path",attr:{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-6h2v6zm0-8h-2V7h2v2z"},child:[]}]})(t)}function Mr(t){return Ee({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"},child:[]},{tag:"path",attr:{d:"M11 7 9.6 8.4l2.6 2.6H2v2h10.2l-2.6 2.6L11 17l5-5-5-5zm9 12h-8v2h8c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2h-8v2h8v14z"},child:[]}]})(t)}function Sr(t){return Ee({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"},child:[]},{tag:"path",attr:{d:"m17 7-1.41 1.41L18.17 11H8v2h10.17l-2.58 2.58L17 17l5-5zM4 5h8V3H4c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h8v-2H4V5z"},child:[]}]})(t)}function Dr(t){return Ee({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"},child:[]},{tag:"path",attr:{d:"M15.5 14h-.79l-.28-.27A6.471 6.471 0 0 0 16 9.5 6.5 6.5 0 1 0 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z"},child:[]}]})(t)}function Er(t){return Ee({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"},child:[]},{tag:"path",attr:{d:"M7 18c-1.1 0-1.99.9-1.99 2S5.9 22 7 22s2-.9 2-2-.9-2-2-2zM1 2v2h2l3.6 7.59-1.35 2.45c-.16.28-.25.61-.25.96 0 1.1.9 2 2 2h12v-2H7.42c-.14 0-.25-.11-.25-.25l.03-.12.9-1.63h7.45c.75 0 1.41-.41 1.75-1.03l3.58-6.49A1.003 1.003 0 0 0 20 4H5.21l-.94-2H1zm16 16c-1.1 0-1.99.9-1.99 2s.89 2 1.99 2 2-.9 2-2-.9-2-2-2z"},child:[]}]})(t)}function $r(t){return Ee({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"},child:[]},{tag:"path",attr:{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z"},child:[]}]})(t)}function Tr(t){return Ee({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"},child:[]},{tag:"path",attr:{d:"M1 21h22L12 2 1 21zm12-3h-2v-2h2v2zm0-4h-2v-4h2v4z"},child:[]}]})(t)}function Ka(t){return Ee({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"},child:[]},{tag:"path",attr:{d:"M12 14c1.66 0 2.99-1.34 2.99-3L15 5c0-1.66-1.34-3-3-3S9 3.34 9 5v6c0 1.66 1.34 3 3 3zm5.3-3c0 3-2.54 5.1-5.3 5.1S6.7 14 6.7 11H5c0 3.41 2.72 6.23 6 6.72V21h2v-3.28c3.28-.48 6-3.3 6-6.72h-1.7z"},child:[]}]})(t)}function Lr(t){return Ee({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"},child:[]},{tag:"path",attr:{fillRule:"evenodd",d:"M16 9V4h1c.55 0 1-.45 1-1s-.45-1-1-1H7c-.55 0-1 .45-1 1s.45 1 1 1h1v5c0 1.66-1.34 3-3 3v2h5.97v7l1 1 1-1v-7H19v-2c-1.66 0-3-1.34-3-3z"},child:[]}]})(t)}function Ar(t){return Ee({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"},child:[]},{tag:"path",attr:{d:"M2.01 21 23 12 2.01 3 2 10l15 2-15 2z"},child:[]}]})(t)}function Ir(t){return Ee({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"},child:[]},{tag:"path",attr:{d:"M12 3a9 9 0 1 0 9 9c0-.46-.04-.92-.1-1.36a5.389 5.389 0 0 1-4.4 2.26 5.403 5.403 0 0 1-3.14-9.8c-.44-.06-.9-.1-1.36-.1z"},child:[]}]})(t)}function Pr(t){return Ee({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"},child:[]},{tag:"path",attr:{d:"M12 7c-2.76 0-5 2.24-5 5s2.24 5 5 5 5-2.24 5-5-2.24-5-5-5zM2 13h2c.55 0 1-.45 1-1s-.45-1-1-1H2c-.55 0-1 .45-1 1s.45 1 1 1zm18 0h2c.55 0 1-.45 1-1s-.45-1-1-1h-2c-.55 0-1 .45-1 1s.45 1 1 1zM11 2v2c0 .55.45 1 1 1s1-.45 1-1V2c0-.55-.45-1-1-1s-1 .45-1 1zm0 18v2c0 .55.45 1 1 1s1-.45 1-1v-2c0-.55-.45-1-1-1s-1 .45-1 1zM5.99 4.58a.996.996 0 0 0-1.41 0 .996.996 0 0 0 0 1.41l1.06 1.06c.39.39 1.03.39 1.41 0s.39-1.03 0-1.41L5.99 4.58zm12.37 12.37a.996.996 0 0 0-1.41 0 .996.996 0 0 0 0 1.41l1.06 1.06c.39.39 1.03.39 1.41 0a.996.996 0 0 0 0-1.41l-1.06-1.06zm1.06-10.96a.996.996 0 0 0 0-1.41.996.996 0 0 0-1.41 0l-1.06 1.06c-.39.39-.39 1.03 0 1.41s1.03.39 1.41 0l1.06-1.06zM7.05 18.36a.996.996 0 0 0 0-1.41.996.996 0 0 0-1.41 0l-1.06 1.06c-.39.39-.39 1.03 0 1.41s1.03.39 1.41 0l1.06-1.06z"},child:[]}]})(t)}function zr(t){return Ee({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0V0z"},child:[]},{tag:"path",attr:{d:"M7.41 8.59 12 13.17l4.59-4.58L18 10l-6 6-6-6 1.41-1.41z"},child:[]}]})(t)}function Hr(t){return Ee({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"},child:[]},{tag:"path",attr:{d:"M7.41 15.41 12 10.83l4.59 4.58L18 14l-6-6-6 6z"},child:[]}]})(t)}function Br(t){return Ee({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"},child:[]},{tag:"path",attr:{d:"M3 17v2h6v-2H3zM3 5v2h10V5H3zm10 16v-2h8v-2h-8v-2h-2v6h2zM7 9v2H3v2h4v2h2V9H7zm14 4v-2H11v2h10zm-6-4h2V7h4V5h-4V3h-2v6z"},child:[]}]})(t)}function Or(t){return Ee({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"},child:[]},{tag:"path",attr:{d:"M20 11H7.83l5.59-5.59L12 4l-8 8 8 8 1.41-1.41L7.83 13H20v-2z"},child:[]}]})(t)}function Fr(t){return Ee({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0V0z"},child:[]},{tag:"path",attr:{d:"m20 12-1.41-1.41L13 16.17V4h-2v12.17l-5.58-5.59L4 12l8 8 8-8z"},child:[]}]})(t)}function Vr(t){return Ee({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0V0z"},child:[]},{tag:"path",attr:{d:"m4 12 1.41 1.41L11 7.83V20h2V7.83l5.58 5.59L20 12l-8-8-8 8z"},child:[]}]})(t)}function Yr(t){return Ee({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"},child:[]},{tag:"path",attr:{d:"M9 16.17 4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z"},child:[]}]})(t)}function In(t){return Ee({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"},child:[]},{tag:"path",attr:{d:"M15.41 7.41 14 6l-6 6 6 6 1.41-1.41L10.83 12z"},child:[]}]})(t)}function Pn(t){return Ee({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"},child:[]},{tag:"path",attr:{d:"M10 6 8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z"},child:[]}]})(t)}function bt(t){return Ee({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"},child:[]},{tag:"path",attr:{d:"M19 6.41 17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"},child:[]}]})(t)}function Qn(t){return Ee({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"},child:[]},{tag:"path",attr:{d:"M16.59 8.59 12 13.17 7.41 8.59 6 10l6 6 6-6z"},child:[]}]})(t)}function Wr(t){return Ee({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{d:"M18.41 16.59 13.82 12l4.59-4.59L17 6l-6 6 6 6zM6 6h2v12H6z"},child:[]},{tag:"path",attr:{fill:"none",d:"M24 24H0V0h24v24z"},child:[]}]})(t)}function Kr(t){return Ee({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0V0z"},child:[]},{tag:"path",attr:{d:"M5.59 7.41 10.18 12l-4.59 4.59L7 18l6-6-6-6zM16 6h2v12h-2z"},child:[]}]})(t)}function Ur(t){return Ee({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"},child:[]},{tag:"path",attr:{d:"M3 18h18v-2H3v2zm0-5h18v-2H3v2zm0-7v2h18V6H3z"},child:[]}]})(t)}function Ua(t){return Ee({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"},child:[]},{tag:"path",attr:{d:"M12 8c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2zm0 2c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0 6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z"},child:[]}]})(t)}function qr(t){return Ee({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"},child:[]},{tag:"path",attr:{d:"M17.65 6.35A7.958 7.958 0 0 0 12 4c-4.42 0-7.99 3.58-7.99 8s3.57 8 7.99 8c3.73 0 6.84-2.55 7.73-6h-2.08A5.99 5.99 0 0 1 12 18c-3.31 0-6-2.69-6-6s2.69-6 6-6c1.66 0 3.14.69 4.22 1.78L13 11h7V4l-2.35 2.35z"},child:[]}]})(t)}function Gr(t){return Ee({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"},child:[]},{tag:"path",attr:{d:"M12 5.83 15.17 9l1.41-1.41L12 3 7.41 7.59 8.83 9 12 5.83zm0 12.34L8.83 15l-1.41 1.41L12 21l4.59-4.59L15.17 15 12 18.17z"},child:[]}]})(t)}function Xr(t){return Ee({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"},child:[]},{tag:"path",attr:{d:"M12 12c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm0 2c-2.67 0-8 1.34-8 4v2h16v-2c0-2.66-5.33-4-8-4z"},child:[]}]})(t)}function qa(t){return Ee({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"},child:[]},{tag:"path",attr:{d:"M18 16.08c-.76 0-1.44.3-1.96.77L8.91 12.7c.05-.23.09-.46.09-.7s-.04-.47-.09-.7l7.05-4.11c.54.5 1.25.81 2.04.81 1.66 0 3-1.34 3-3s-1.34-3-3-3-3 1.34-3 3c0 .24.04.47.09.7L8.04 9.81C7.5 9.31 6.79 9 6 9c-1.66 0-3 1.34-3 3s1.34 3 3 3c.79 0 1.5-.31 2.04-.81l7.12 4.16c-.05.21-.08.43-.08.65 0 1.61 1.31 2.92 2.92 2.92 1.61 0 2.92-1.31 2.92-2.92s-1.31-2.92-2.92-2.92z"},child:[]}]})(t)}function Jr(t){return Ee({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"},child:[]},{tag:"path",attr:{d:"M14 4v5c0 1.12.37 2.16 1 3H9c.65-.86 1-1.9 1-3V4h4m3-2H7c-.55 0-1 .45-1 1s.45 1 1 1h1v5c0 1.66-1.34 3-3 3v2h5.97v7l1 1 1-1v-7H19v-2c-1.66 0-3-1.34-3-3V4h1c.55 0 1-.45 1-1s-.45-1-1-1z"},child:[]}]})(t)}const cn=({children:t,containerId:n,containerElement:s})=>{const a=Dn({containerId:n,containerElement:s});return a?Ct.createPortal(t,a):null},Ie=({icon:t,size:n="medium",color:s="primary",variant:a="filled","aria-label":r,sx:i,style:o,disabled:c=!1,badge:d,badgeColor:u="error",...p})=>{const f=`ui-icon-button ui-icon-button--${a} ui-icon-button--${n}`,m=o?.background||o?.backgroundColor||o?.color?"":`ui-icon-button--${s}`,v=`${f} ${m} ${c?"ui-icon-button--disabled":""}`.trim(),g=i?`${v} ${i}`.trim():v,y=d!=null&&d!=="",S=typeof d=="number"&&d>99?"99+":d,k=e.jsx("button",{type:"button",className:g,style:o,disabled:c,"aria-label":r,...p,children:t});return y?e.jsxs("span",{className:"ui-icon-button-wrapper",children:[k,e.jsx("span",{className:`ui-icon-button-badge ui-icon-button-badge--${u} ui-icon-button-badge--${n}`,children:S})]}):k},Ga="ui-kit-theme";function Zr(){if(typeof window>"u")return"light";const t=localStorage.getItem(Ga);return t==="light"||t==="dark"?t:window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function Qr(){const[t,n]=l.useState(Zr);return l.useEffect(()=>{document.documentElement.dataset.theme=t,localStorage.setItem(Ga,t)},[t]),{theme:t,isDark:t==="dark",toggleTheme:()=>n(r=>r==="dark"?"light":"dark"),setTheme:r=>n(r)}}const Rr='a[href], button:not([disabled]), textarea:not([disabled]), input:not([disabled]), select:not([disabled]), [tabindex]:not([tabindex="-1"])';function Rn({enabled:t,containerRef:n,initialFocusRef:s,returnFocusOnCleanup:a=!0}){const r=l.useRef(null);l.useEffect(()=>{if(!t||!n.current)return;const i=n.current;r.current=document.activeElement;const o=()=>Array.from(i.querySelectorAll(Rr)),c=o();c.length>0&&(s?.current?s.current.focus():c[0].focus());const d=u=>{if(u.key!=="Tab")return;const p=o();if(p.length===0)return;const f=p[0],h=p[p.length-1],m=document.activeElement;u.shiftKey?(m===f||!i.contains(m))&&(u.preventDefault(),h.focus()):(m===h||!i.contains(m))&&(u.preventDefault(),f.focus())};return i.addEventListener("keydown",d),()=>{i.removeEventListener("keydown",d),a&&r.current&&r.current.focus()}},[t,n,s,a])}function At({enabled:t,onEscape:n}){l.useEffect(()=>{if(!t)return;const s=a=>{a.key==="Escape"&&n()};return document.addEventListener("keydown",s),()=>document.removeEventListener("keydown",s)},[t,n])}function zn({enabled:t,mediaQuery:n}){l.useEffect(()=>{const s=i=>{t&&i?(document.body.style.overflow="hidden",document.documentElement.style.overflow="hidden"):(document.body.style.overflow="",document.documentElement.style.overflow="")};if(!n)return s(t),()=>s(!1);const a=window.matchMedia(n);s(a.matches);const r=i=>s(i.matches);return a.addEventListener("change",r),()=>{a.removeEventListener("change",r),s(!1)}},[t,n])}const ea=({open:t,onClose:n,closeOnBackdropClick:s=!0,closeOnEscape:a=!0,showCloseButton:r=!0,size:i="medium",children:o,sx:c,style:d,backdropStyle:u,portalContainerId:p,initialFocusRef:f,returnFocusOnClose:h=!0,trapFocus:m=!0})=>{const x=l.useRef(null),v=l.useContext(Lt),g=v?v.baseZ+cr:dr,y=l.useMemo(()=>({baseZ:g}),[g]);At({enabled:t&&a&&!!n,onEscape:n||(()=>{})}),zn({enabled:t}),Rn({enabled:t&&m,containerRef:x,initialFocusRef:f,returnFocusOnCleanup:h});const S=$=>{s&&n&&$.target===$.currentTarget&&n()};if(!t)return null;const k=`ui-modal__content ui-modal__content--${i}`,L=c?`${k} ${c}`.trim():k;return e.jsx(cn,{containerId:p,children:e.jsx(Lt.Provider,{value:y,children:e.jsx("div",{className:"ui-modal",style:{zIndex:g},children:e.jsx("div",{className:"ui-modal__backdrop",onClick:S,style:u,role:"presentation",children:e.jsxs("div",{ref:x,className:L,style:d,role:"dialog","aria-modal":"true",children:[r&&n&&e.jsx(Ie,{icon:e.jsx(bt,{}),onClick:n,"aria-label":"Close modal",sx:"ui-modal__close-button",variant:"ghost",color:"neutral",size:"medium"}),o]})})})})})},Xa=({open:t,onClose:n,closeOnBackdropClick:s=!0,closeOnEscape:a=!0,showCloseButton:r=!0,anchor:i="right",width:o="320px",height:c="100%",children:d,sx:u,style:p,backdropStyle:f,hideBackdrop:h=!1,portalContainerId:m,initialFocusRef:x,returnFocusOnClose:v=!0,trapFocus:g=!0,title:y})=>{const S=l.useRef(null),[k,L]=l.useState(t),[$,H]=l.useState(!1);l.useEffect(()=>{if(t)L(!0),H(!1);else if(k){H(!0);const ve=setTimeout(()=>{L(!1),H(!1)},300);return()=>clearTimeout(ve)}},[t]),At({enabled:t&&a&&!!n,onEscape:n||(()=>{})}),zn({enabled:t}),Rn({enabled:t&&g,containerRef:S,initialFocusRef:x,returnFocusOnCleanup:v});const J=ve=>{s&&n&&ve.target===ve.currentTarget&&n()};if(!k)return null;const ee={};i==="left"||i==="right"?ee.width=o:ee.height=c;const D=["ui-drawer__content",`ui-drawer__content--${i}`,$&&`ui-drawer__content--exiting-${i}`].filter(Boolean).join(" "),B=u?`${D} ${u}`.trim():D,ae=y?"ui-drawer-title":void 0,F=r&&n&&e.jsx(Ie,{icon:e.jsx(bt,{}),onClick:n,"aria-label":"Close drawer",sx:"ui-drawer__close-button",variant:"ghost",color:"neutral",size:"medium"});return e.jsx(cn,{containerId:m,children:e.jsx("div",{className:"ui-drawer",children:e.jsx("div",{className:"ui-drawer__backdrop",onClick:J,style:h?{...f,background:"transparent"}:f,role:"presentation",children:e.jsxs("div",{ref:S,className:B,style:{...ee,...p},role:"dialog","aria-modal":"true","aria-labelledby":ae,children:[y?e.jsxs("div",{className:"ui-drawer__header",children:[e.jsx("h2",{id:ae,className:"ui-drawer__title",children:y}),F]}):F,d]})})})})},Je=({title:t,placement:n="top",arrow:s=!1,children:a,sx:r})=>{if(!t)return a;const i=["ui-tooltip",`ui-tooltip--${n}`,r].filter(Boolean).join(" ");return e.jsxs("span",{className:i,children:[a,e.jsxs("span",{className:"ui-tooltip__content",role:"tooltip",children:[t,s&&e.jsx("span",{className:"ui-tooltip__arrow","aria-hidden":"true"})]})]})};Je.displayName="Tooltip";function ei(){return e.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5","aria-hidden":"true",children:e.jsx("path",{d:"M18 6L6 18M6 6l12 12"})})}function ti(){return e.jsx("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5","aria-hidden":"true",children:e.jsx("path",{d:"M6 9l6 6 6-6"})})}function ni(){return e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2","aria-hidden":"true",children:[e.jsx("circle",{cx:"11",cy:"11",r:"8"}),e.jsx("path",{d:"M21 21l-4.35-4.35"})]})}function ai({section:t,pending:n,onToggle:s}){const[a,r]=l.useState(t.initiallyOpen??!1),[i,o]=l.useState(""),[c,d]=l.useState(!1),u=t.showMoreLimit??8,p=i?t.options.filter(x=>x.label.toLowerCase().includes(i.toLowerCase())):t.options,f=!i&&p.length>u,h=f&&!c?p.slice(0,u):p,m=p.length-u;return e.jsxs("div",{className:`fp-collapsible${a?" fp-collapsible--open":""}`,children:[e.jsxs("button",{type:"button",className:"fp-collapsible__header",onClick:()=>r(x=>!x),"aria-expanded":a,children:[e.jsxs("span",{className:"fp-collapsible__title",children:[t.icon&&e.jsx("span",{className:"fp-collapsible__icon",children:t.icon}),t.title]}),e.jsxs("span",{className:"fp-collapsible__right",children:[n.length>0&&e.jsx("span",{className:"fp-collapsible__count",children:n.length}),e.jsx("span",{className:"fp-collapsible__arrow",children:e.jsx(ti,{})})]})]}),e.jsxs("div",{className:"fp-collapsible__content",children:[t.showSearch&&e.jsx(Ot,{size:"small",fullWidth:!0,startAdornment:e.jsx(ni,{}),placeholder:`Search ${t.title.toLowerCase()}…`,value:i,onChange:x=>{const v=x.target.value;o(v),t.onSearch?.(v)},sx:{root:"fp-mini-search",wrapper:"fp-mini-search__wrapper"}}),e.jsx("div",{className:["fp-pill-grid",t.columns===3?"fp-pill-grid--cols3":"fp-pill-grid--cols2"].join(" "),children:h.map(x=>{const v=n.includes(x.value);return e.jsx(mt,{label:x.label,variant:"outlined",color:v?"primary":"neutral",size:"small",selected:v,onClick:()=>s(x.value),leadingIcon:x.icon?e.jsx("img",{src:x.icon,alt:"",className:"fp-pill__icon","aria-hidden":"true"}):void 0,sx:"fp-pill-chip"},x.value)})}),f&&e.jsx(Xe,{variant:"outlined",color:"neutral",size:"small",style:{width:"100%",marginTop:"0.35rem",border:"1px solid var(--palette-divider)"},onClick:()=>d(x=>!x),children:c?"Show less":`Show ${m} more…`})]})]})}function si({section:t,pending:n,onToggle:s}){return e.jsxs("div",{className:"fp-group",children:[e.jsx("div",{className:"fp-group__label",children:t.title}),e.jsx("div",{className:"fp-cards",children:t.options.map(a=>{const r=n.includes(a.value),i=a.color??"#94a3b8";return e.jsxs("button",{type:"button",className:`fp-card${r?" fp-card--active":""}`,style:{"--fp-card-color":i},onClick:()=>s(a.value),children:[e.jsx("span",{className:"fp-card__icon","aria-hidden":"true",children:a.icon?e.jsx("img",{src:a.icon,alt:""}):e.jsx("span",{className:"fp-card__icon-letter",children:a.label.charAt(0)})}),e.jsx("span",{className:"fp-card__label",children:a.label})]},a.value)})})]})}function ri({section:t,pending:n,onToggle:s}){return e.jsxs("div",{className:"fp-group",children:[e.jsx("div",{className:"fp-group__label",children:t.title}),e.jsx("div",{className:"fp-tiles",children:t.options.map(a=>{const r=n.includes(a.value);return e.jsxs("button",{type:"button",className:`fp-tile${r?" fp-tile--active":""}`,onClick:()=>s(a.value),children:[(a.iconNode??a.icon)&&e.jsx("span",{className:"fp-tile__icon","aria-hidden":"true",children:a.iconNode??a.icon}),e.jsx("span",{className:"fp-tile__label",children:a.label}),a.sublabel&&e.jsx("span",{className:"fp-tile__sublabel",children:a.sublabel})]},a.value)})})]})}function ii({sections:t,value:n,onChange:s,resultCount:a,isOpen:r,onClose:i,onReset:o}){zn({enabled:r,mediaQuery:"(max-width: 767px)"});const[c,d]=l.useState({});l.useEffect(()=>{if(!r)return;const g={};t.forEach(y=>{g[y.id]=[...n[y.id]??[]]}),d(g)},[r]);const u=l.useCallback((g,y)=>{d(S=>{const k=S[g]??[],L=k.includes(y)?k.filter($=>$!==y):[...k,y];return{...S,[g]:L}})},[]),p=l.useCallback((g,y)=>{d(S=>({...S,[g]:(S[g]??[]).filter(k=>k!==y)}))},[]),f=()=>{s(c),i()},h=()=>{if(o)o();else{const g={};t.forEach(y=>{g[y.id]=[]}),d(g)}},m=()=>{const g={};t.forEach(y=>{g[y.id]=[...n[y.id]??[]]}),d(g),i()},x=t.flatMap(g=>g.disabled?[]:(c[g.id]??[]).map(y=>({sectionId:g.id,value:y,label:g.options.find(S=>S.value===y)?.label??y}))),v=x.length>0;return e.jsxs("aside",{className:`fp-panel${r?" fp-panel--open":""}`,"aria-label":"Filter panel","aria-hidden":!r,children:[e.jsxs("div",{className:"fp-header",children:[e.jsxs("div",{className:"fp-header__info",children:[e.jsx("span",{className:"fp-header__title",children:"Filters"}),a!==void 0&&e.jsxs("span",{className:"fp-header__count",children:[a," employees found"]})]}),e.jsx(Ie,{variant:"ghost",color:"neutral",size:"small",icon:e.jsx(ei,{}),"aria-label":"Close filters",onClick:m})]}),v&&e.jsx("div",{className:"fp-chips",children:x.map(g=>e.jsx(mt,{label:g.label,variant:"outlined",color:"primary",size:"small",onDelete:()=>p(g.sectionId,g.value)},`${g.sectionId}-${g.value}`))}),e.jsx("div",{className:"fp-content",children:t.map(g=>g.type==="cards"?e.jsx(si,{section:g,pending:c[g.id]??[],onToggle:y=>u(g.id,y)},g.id):g.type==="tiles"?e.jsx(ri,{section:g,pending:c[g.id]??[],onToggle:y=>u(g.id,y)},g.id):e.jsx(ai,{section:g,pending:c[g.id]??[],onToggle:y=>u(g.id,y)},g.id))}),e.jsxs("div",{className:"fp-footer",children:[e.jsx(Xe,{variant:"ghost",color:"neutral",onClick:h,disabled:!v,children:"Reset all"}),e.jsx(Xe,{variant:"filled",color:"primary",style:{flex:1},onClick:f,children:"Apply"})]})]})}function ot(t){return t.hour*60+t.minute}function Vt(t){const n=Math.max(0,Math.min(1439,t));return{hour:Math.floor(n/60),minute:n%60}}function jt(){return{min:{hour:0,minute:0},max:{hour:23,minute:59}}}function Dt(t){if(t===null)return null;const n=jt(),s=t??{},a=s.min??n.min,r=s.max??n.max;return ot(a)>ot(r)?null:{min:a,max:r}}function dn(t,n,s){const a=Math.max(1,Math.floor(s));if(t>n)return null;if(a===1)return t;let r=Math.floor(t/a)*a;return r<t&&(r+=a),r>n?null:r}function Yt(t,n,s,a){const r=ot(s.min),i=ot(s.max);let o=t*60+n;o=Math.max(r,Math.min(i,o));const c=Math.max(1,Math.floor(a));if(c===1)return Vt(o);const d=dn(r,i,c);if(d===null)return Vt(r);if(o<=d)return Vt(d);const u=o-d,p=Math.ceil(u/c);let f=d+p*c;const h=Math.floor((i-d)/c),m=d+h*c;return f>i&&(f=m),Vt(Math.min(f,m))}function Ja(t,n){const s=ot(t.min),a=ot(t.max),r=dn(s,a,n);return r===null?null:Vt(r)}function Za(t,n){const s=ot(t.min),a=ot(t.max),r=Math.max(1,Math.floor(n)),i=new Set;if(r===1){for(let c=t.min.hour;c<=t.max.hour;c++)i.add(c);return[...i].sort((c,d)=>c-d)}const o=dn(s,a,r);if(o===null)return[];for(let c=o;c<=a;c+=r)i.add(Math.floor(c/60));return[...i].sort((c,d)=>c-d)}function It(t,n,s){const a=ot(n.min),r=ot(n.max),i=Math.max(1,Math.floor(s)),o=[];if(i===1){const d=t===n.min.hour?n.min.minute:0,u=t===n.max.hour?n.max.minute:59;for(let p=d;p<=u;p++)o.push(p);return o}const c=dn(a,r,i);if(c===null)return[];for(let d=c;d<=r;d+=i){const u=Vt(d);u.hour===t&&o.push(u.minute)}return o}function Hn(t,n,s,a){const r=t*60+n,i=ot(s.min),o=ot(s.max);if(r<i||r>o)return!1;const c=Math.max(1,Math.floor(a));if(c===1)return!0;const d=dn(i,o,c);return d===null||r<d?!1:(r-d)%c===0}const un=8,Qa="DD.MM.YYYY";function Ra(t,n){return!n||t.includes("HH")&&t.includes("mm")?t:`${t} HH:mm`}const ta=["January","February","March","April","May","June","July","August","September","October","November","December"],li=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],oi=["Mon","Tue","Wed","Thu","Fri","Sat","Sun"],Ge=(...t)=>t.filter(Boolean).join(" ");function Wt(t,n){return t.getFullYear()===n.getFullYear()&&t.getMonth()===n.getMonth()&&t.getDate()===n.getDate()}function ci(t,n,s){const[a,r]=n<=s?[n,s]:[s,n];return t.getTime()>a.getTime()&&t.getTime()<r.getTime()}function hn(t,n){return new Date(t.getFullYear(),t.getMonth()+n,1)}function di(t,n){const a=(new Date(t,n,1).getDay()+6)%7,r=[];for(let c=a;c>0;c--)r.push(new Date(t,n,1-c));const i=new Date(t,n+1,0).getDate();for(let c=1;c<=i;c++)r.push(new Date(t,n,c));let o=1;for(;r.length<42;)r.push(new Date(t,n+1,o++));return r}function Ze(t,n=Qa){const s=String(t.getDate()).padStart(2,"0"),a=String(t.getMonth()+1).padStart(2,"0"),r=String(t.getFullYear());return n.replace("DD",s).replace("MM",a).replace("YYYY",r)}function Bn(t,n){const s=String(t.getDate()).padStart(2,"0"),a=String(t.getMonth()+1).padStart(2,"0"),r=String(t.getFullYear()),i=String(t.getHours()).padStart(2,"0"),o=String(t.getMinutes()).padStart(2,"0");return n.replace("YYYY",r).replace("DD",s).replace("MM",a).replace("HH",i).replace("mm",o)}function na(t,n){if(t.length!==n.length)return null;const s=n.indexOf("DD"),a=n.indexOf("MM"),r=n.indexOf("YYYY");if(s<0||a<0||r<0)return null;const i=parseInt(t.slice(s,s+2),10),o=parseInt(t.slice(a,a+2),10)-1,c=parseInt(t.slice(r,r+4),10);if(isNaN(i)||isNaN(o)||isNaN(c))return null;const d=new Date(c,o,i);return d.getDate()!==i||d.getMonth()!==o||d.getFullYear()!==c?null:d}function ui(t,n){if(t.length!==n.length)return null;const s=n.indexOf("DD"),a=n.indexOf("MM"),r=n.indexOf("YYYY");if(s<0||a<0||r<0)return null;const i=parseInt(t.slice(s,s+2),10),o=parseInt(t.slice(a,a+2),10)-1,c=parseInt(t.slice(r,r+4),10);if(isNaN(i)||isNaN(o)||isNaN(c))return null;let d=0,u=0;const p=n.indexOf("HH"),f=n.indexOf("mm");if(p>=0&&f>=0&&(d=parseInt(t.slice(p,p+2),10),u=parseInt(t.slice(f,f+2),10),isNaN(d)||isNaN(u)||d<0||d>23||u<0||u>59))return null;const h=new Date(c,o,i,d,u,0,0);return h.getDate()!==i||h.getMonth()!==o||h.getFullYear()!==c?null:h}function aa(t,n){const s=t.replace(/\D/g,"").slice(0,8);if(!s.length)return"";let a="",r=0;for(let i=0;i<n.length;i++){const o=n[i];if(/[DMY]/.test(o)){if(r>=s.length)break;a+=s[r++]}else if(r<s.length)a+=o;else break}return a}function hi(t,n){const s=t.replace(/\D/g,"").slice(0,12);if(!s.length)return"";let a=0,r="",i=0;for(;i<n.length;)if(n.startsWith("YYYY",i)){for(let o=0;o<4&&a<s.length;o++)r+=s[a++];i+=4}else if(n.startsWith("DD",i)){if(a>=s.length||(r+=s[a++],a>=s.length))break;r+=s[a++],i+=2}else if(n.startsWith("MM",i)){if(a>=s.length||(r+=s[a++],a>=s.length))break;r+=s[a++],i+=2}else if(n.startsWith("HH",i)){if(a>=s.length||(r+=s[a++],a>=s.length))break;r+=s[a++],i+=2}else if(n.startsWith("mm",i)){if(a>=s.length||(r+=s[a++],a>=s.length))break;r+=s[a++],i+=2}else{if(a<s.length)r+=n[i];else break;i+=1}return r}const es=(t,n,s)=>{const a=window.innerHeight-t.bottom-un,r=t.top-un,i=s>a&&r>a;let o=t.left;return o+n>window.innerWidth-8&&(o=Math.max(8,window.innerWidth-8-n)),i?{bottom:window.innerHeight-t.top+un,left:o,maxHeight:Math.min(640,r)}:{top:t.bottom+un,left:o,maxHeight:Math.min(640,a)}};function pi(t){return t==="single"?[{label:"Today",getValue:()=>new Date},{label:"Yesterday",getValue:()=>{const n=new Date;return n.setDate(n.getDate()-1),n}}]:[{label:"Today",getValue:()=>{const n=new Date;return{start:n,end:n}}},{label:"Yesterday",getValue:()=>{const n=new Date;return n.setDate(n.getDate()-1),{start:new Date(n),end:new Date(n)}}},{label:"This week",getValue:()=>{const n=new Date,s=(n.getDay()+6)%7,a=new Date(n.getFullYear(),n.getMonth(),n.getDate()-s),r=new Date(a.getFullYear(),a.getMonth(),a.getDate()+6);return{start:a,end:r}}},{label:"Last week",getValue:()=>{const n=new Date,s=(n.getDay()+6)%7,a=new Date(n.getFullYear(),n.getMonth(),n.getDate()-s-7),r=new Date(a.getFullYear(),a.getMonth(),a.getDate()+6);return{start:a,end:r}}},{label:"This month",getValue:()=>{const n=new Date,s=new Date(n.getFullYear(),n.getMonth(),1),a=new Date(n.getFullYear(),n.getMonth()+1,0);return{start:s,end:a}}},{label:"Last month",getValue:()=>{const n=new Date,s=new Date(n.getFullYear(),n.getMonth()-1,1),a=new Date(n.getFullYear(),n.getMonth(),0);return{start:s,end:a}}}]}function ts(){return e.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",focusable:"false",children:[e.jsx("rect",{x:"3",y:"4",width:"18",height:"18",rx:"2",ry:"2"}),e.jsx("line",{x1:"16",y1:"2",x2:"16",y2:"6"}),e.jsx("line",{x1:"8",y1:"2",x2:"8",y2:"6"}),e.jsx("line",{x1:"3",y1:"10",x2:"21",y2:"10"})]})}function sa(){return e.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",focusable:"false",children:e.jsx("path",{d:"m15 18-6-6 6-6"})})}function ra(){return e.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",focusable:"false",children:e.jsx("path",{d:"m9 18 6-6-6-6"})})}const ia=l.forwardRef(({mode:t="single",value:n,onChange:s,rangeValue:a,onRangeChange:r,triggerVariant:i="input",format:o=Qa,placeholder:c,minDate:d,maxDate:u,disabledDates:p,disabledDaysOfWeek:f,isDateDisabled:h,showTime:m=!1,timeStep:x=1,getTimeBounds:v,presets:g,showPresets:y=!1,multiMonth:S,label:k,helperText:L,error:$=!1,disabled:H=!1,required:J=!1,size:ee="normal",fullWidth:D=!1,startAdornment:B,endAdornment:ae,sx:F,style:ve,id:me,onFocus:Q,onBlur:oe,...ye},ke)=>{const Z=l.useId(),G=me||`${Z}-input`,b=new Date;b.setHours(0,0,0,0);const A=S??t==="range",I=y?g??pi(t):[],W=Ra(o,!!(m&&t==="single")),V=n!==void 0,be=a!==void 0,[w,R]=l.useState(null),[re,ue]=l.useState({start:null,end:null}),P=V?n??null:w,ie=be?a??re:re,$e=P?.getTime()??null,Pe=Math.max(1,Math.floor(x)),he=l.useMemo(()=>{if(!m||t!=="single")return;if(!P)return"no-date";const M=new Date(P.getFullYear(),P.getMonth(),P.getDate());return v?Dt(v(M)):"full"},[m,t,P,v]),Ce=l.useMemo(()=>{if(he===void 0||he==="no-date")return[];const M=he==="full"?jt():he;return M?Za(M,Pe):[]},[he,Pe]),[_e,ze]=l.useState(!1),[C,q]=l.useState(null),[ne,j]=l.useState(!1),z=()=>t==="single"&&P?new Date(P.getFullYear(),P.getMonth(),1):t==="range"&&ie.start?new Date(ie.start.getFullYear(),ie.start.getMonth(),1):new Date(b.getFullYear(),b.getMonth(),1),[U,X]=l.useState(z),[we,N]=l.useState("days"),[de,fe]=l.useState(()=>b.getFullYear()-4),[De,Ne]=l.useState(null),[O,le]=l.useState(null),[ge,je]=l.useState(()=>t==="single"&&P?P.getHours():0),[Ae,We]=l.useState(()=>t==="single"&&P?P.getMinutes():0),ht=l.useMemo(()=>{if(he===void 0||he==="no-date")return[];const M=he==="full"?jt():he;return M?It(ge,M,Pe):[]},[he,Pe,ge]),Ke=l.useRef(!1),[ct,Qe]=l.useState(()=>t==="single"&&P?m?Bn(P,Ra(o,m)):Ze(P,o):""),[gt,xt]=l.useState(()=>ie.start?Ze(ie.start,o):""),[Re,tt]=l.useState(()=>ie.end?Ze(ie.end,o):""),at=l.useRef(null),Fe=l.useRef(null),et=l.useRef(null),Gt=l.useContext(Lt),nt=Gt?Gt.baseZ+rn:void 0,st=l.useRef(null),Be=l.useCallback(M=>{if(d){const T=new Date(d.getFullYear(),d.getMonth(),d.getDate());if(M<T)return!0}if(u){const T=new Date(u.getFullYear(),u.getMonth(),u.getDate());if(M>T)return!0}if(f?.includes(M.getDay())||p?.some(T=>Wt(T,M))||h?.(M))return!0;if(m&&v){const T=new Date(M.getFullYear(),M.getMonth(),M.getDate());if(Dt(v(T))===null)return!0}return!1},[d,u,f,p,h,m,v]),Ye=l.useCallback(()=>{ze(!1),Ne(null),le(null),N("days")},[]),yt=l.useCallback(()=>{H||(t==="single"&&P?X(new Date(P.getFullYear(),P.getMonth(),1)):t==="range"&&ie.start&&X(new Date(ie.start.getFullYear(),ie.start.getMonth(),1)),ze(!0))},[H,t,P,ie]);At({enabled:_e,onEscape:Ye}),l.useEffect(()=>{if(!_e){q(null),j(!1);return}const M=at.current;if(!M)return;const T=M.getBoundingClientRect();q({top:T.bottom+un,left:T.left,maxHeight:640}),j(!1);const pe=Oe=>{!at.current?.contains(Oe.target)&&!Fe.current?.contains(Oe.target)&&Ye()};setTimeout(()=>document.addEventListener("mousedown",pe),0);const ce=()=>{if(!Fe.current||!at.current)return;const Oe=at.current.getBoundingClientRect();q(es(Oe,Fe.current.offsetWidth,Fe.current.offsetHeight))};return window.addEventListener("scroll",ce,!0),window.addEventListener("resize",ce),()=>{window.removeEventListener("scroll",ce,!0),window.removeEventListener("resize",ce),document.removeEventListener("mousedown",pe)}},[_e,Ye]),l.useEffect(()=>{if(t!=="single"||!m||$e==null)return;const M=new Date($e),T=new Date(M.getFullYear(),M.getMonth(),M.getDate()),pe=v?Dt(v(T)):jt();if(!pe)return;const ce=Yt(M.getHours(),M.getMinutes(),pe,Pe);je(ce.hour),We(ce.minute)},[t,m,$e,v,Pe]),l.useLayoutEffect(()=>{if(!_e||!ne)return;const M=et.current?.querySelector(`[data-time-value="${ge}"]`),T=st.current?.querySelector(`[data-time-value="${Ae}"]`);M?.scrollIntoView({block:"nearest"}),T?.scrollIntoView({block:"nearest"})},[ge,Ae,_e,ne]),l.useLayoutEffect(()=>{if(!_e||ne||!Fe.current||!at.current)return;const M=at.current.getBoundingClientRect();q(es(M,Fe.current.offsetWidth,Fe.current.offsetHeight)),j(!0)},[_e,C,ne]),l.useEffect(()=>{Ke.current||t==="single"&&Qe(P?m?Bn(P,W):Ze(P,o):"")},[P,o,W,m,t]),l.useEffect(()=>{Ke.current||(xt(ie.start?Ze(ie.start,o):""),tt(ie.end?Ze(ie.end,o):""))},[ie.start,ie.end,o]);const gn=l.useCallback(M=>{if(!Be(M))if(Ke.current=!1,t==="single")if(m){const T=new Date(M.getFullYear(),M.getMonth(),M.getDate()),pe=v?Dt(v(T)):jt();if(!pe)return;const ce=Ja(pe,Pe);if(!ce)return;const Oe=new Date(T.getFullYear(),T.getMonth(),T.getDate(),ce.hour,ce.minute);je(ce.hour),We(ce.minute),V||R(Oe),s?.(Oe)}else{const T=new Date(M.getFullYear(),M.getMonth(),M.getDate());V||R(T),s?.(T),Ye()}else if(!De)Ne(new Date(M.getFullYear(),M.getMonth(),M.getDate()));else{const T=De,pe=new Date(M.getFullYear(),M.getMonth(),M.getDate()),ce=T<=pe?{start:T,end:pe}:{start:pe,end:T};be||ue(ce),r?.(ce),Ne(null),Ye()}},[t,m,Pe,v,De,V,be,s,r,Ye,Be]),Pt=l.useCallback(M=>{const T=M.getValue();if(T instanceof Date){let pe=T;if(m&&v){const ce=new Date(pe.getFullYear(),pe.getMonth(),pe.getDate()),Oe=Dt(v(ce));if(Oe){const dt=Yt(pe.getHours(),pe.getMinutes(),Oe,Pe);pe=new Date(ce.getFullYear(),ce.getMonth(),ce.getDate(),dt.hour,dt.minute)}}V||R(pe),s?.(pe)}else{const pe=T;be||ue(pe),r?.(pe),pe.start&&X(new Date(pe.start.getFullYear(),pe.start.getMonth(),1))}Ye()},[V,be,s,r,Ye,m,v,Pe]),Xt=l.useCallback(M=>{if(M.stopPropagation(),Ke.current=!1,t==="single")Qe(""),V||R(null),s?.(null);else{xt(""),tt("");const T={start:null,end:null};be||ue(T),r?.(T),Ne(null)}},[t,V,be,s,r]),xn=l.useCallback(M=>{const T=m?hi(M.target.value,W):aa(M.target.value,o);Qe(T);const pe=m?W.length:o.length;if(T.length===pe){const ce=m?ui(T,W):na(T,o);if(ce&&!Be(ce)){if(m){const Oe=new Date(ce.getFullYear(),ce.getMonth(),ce.getDate()),dt=v?Dt(v(Oe)):jt();if(!dt||!Hn(ce.getHours(),ce.getMinutes(),dt,Pe))return;je(ce.getHours()),We(ce.getMinutes())}V||R(ce),s?.(ce),X(new Date(ce.getFullYear(),ce.getMonth(),1))}}else T.length===0&&(V||R(null),s?.(null))},[o,W,m,Pe,v,V,s,Be]),Jt=l.useCallback(M=>{const T=aa(M.target.value,o);if(xt(T),T.length===o.length){const pe=na(T,o);if(pe&&!Be(pe)){const ce={start:pe,end:ie.end};be||ue(ce),r?.(ce),X(new Date(pe.getFullYear(),pe.getMonth(),1))}}},[o,ie.end,be,r,Be]),vn=l.useCallback(M=>{const T=aa(M.target.value,o);if(tt(T),T.length===o.length){const pe=na(T,o);if(pe&&!Be(pe)){const ce={start:ie.start,end:pe};be||ue(ce),r?.(ce)}}},[o,ie.start,be,r,Be]),pt=l.useCallback(M=>{const T=M.relatedTarget;Fe.current?.contains(T)||at.current?.contains(T)||(Ke.current=!1,Qe(P?m?Bn(P,W):Ze(P,o):""),xt(ie.start?Ze(ie.start,o):""),tt(ie.end?Ze(ie.end,o):""))},[P,ie.start,ie.end,o,m,W]),Zt=l.useCallback(()=>{if(t==="single"&&P){const M=new Date(P.getFullYear(),P.getMonth(),P.getDate()),T=v?Dt(v(M)):jt();if(!T){Ye();return}const pe=Yt(ge,Ae,T,Pe),ce=new Date(P.getFullYear(),P.getMonth(),P.getDate(),pe.hour,pe.minute);V||R(ce),s?.(ce)}Ye()},[t,P,ge,Ae,V,s,Ye,v,Pe]),bn=(()=>{if(t==="single")return P?m?Bn(P,W):Ze(P,o):"";const{start:M,end:T}=ie;return M&&T?`${Ze(M,o)} – ${Ze(T,o)}`:M?`${Ze(M,o)} – ...`:""})(),jn=t==="single"?!!P:!!(ie.start||ie.end),yn=(M,T)=>{const pe=Be(M),ce=M.getMonth()!==T,Oe=Wt(M,b);let dt=!1,qe=!1,Ht=!1,Cn=!1;if(t==="single"&&P&&(dt=Wt(M,P)),t==="range"){const _=De??ie.start,E=De?O??null:ie.end;_&&Wt(M,_)&&(qe=!0),E&&Wt(M,E)&&(Ht=!0),_&&E&&ci(M,_,E)&&(Cn=!0)}return Ge("ui-datepicker__day",ce&&"ui-datepicker__day--outside",Oe&&"ui-datepicker__day--today",pe&&"ui-datepicker__day--disabled",dt&&"ui-datepicker__day--selected",(qe||Ht)&&"ui-datepicker__day--range-cap",qe&&"ui-datepicker__day--range-start",Ht&&"ui-datepicker__day--range-end",Cn&&"ui-datepicker__day--in-range")},Ue=(M,T,pe)=>{const ce=M.getFullYear(),Oe=M.getMonth(),dt=di(ce,Oe);return e.jsxs("div",{className:"ui-datepicker__calendar",children:[e.jsxs("div",{className:"ui-datepicker__nav",children:[e.jsx("button",{type:"button",className:Ge("ui-datepicker__nav-btn",!T&&"ui-datepicker__nav-btn--hidden"),onClick:()=>{X(hn(U,-1)),N("days")},disabled:!T,"aria-label":"Previous month",children:e.jsx(sa,{})}),e.jsxs("button",{type:"button",className:"ui-datepicker__nav-title",onClick:()=>N(we==="days"?"months":"days"),"aria-label":`${ta[Oe]} ${ce}. Click to choose month`,children:[ta[Oe]," ",ce]}),e.jsx("button",{type:"button",className:Ge("ui-datepicker__nav-btn",!pe&&"ui-datepicker__nav-btn--hidden"),onClick:()=>{X(hn(U,1)),N("days")},disabled:!pe,"aria-label":"Next month",children:e.jsx(ra,{})})]}),e.jsx("div",{className:"ui-datepicker__weekdays","aria-hidden":"true",children:oi.map(qe=>e.jsx("span",{className:"ui-datepicker__weekday",children:qe},qe))}),e.jsx("div",{className:"ui-datepicker__grid",role:"grid","aria-label":`${ta[Oe]} ${ce}`,children:dt.map((qe,Ht)=>e.jsx("button",{type:"button",role:"gridcell",className:yn(qe,Oe),disabled:Be(qe),"aria-label":Ze(qe),"aria-pressed":t==="single"&&P?Wt(qe,P):void 0,onClick:()=>gn(qe),onMouseEnter:()=>{t==="range"&&De&&le(new Date(qe.getFullYear(),qe.getMonth(),qe.getDate()))},onMouseLeave:()=>{t==="range"&&De&&le(null)},tabIndex:-1,children:qe.getDate()},Ht))})]},`${ce}-${Oe}`)},kn=()=>e.jsxs("div",{className:"ui-datepicker__calendar ui-datepicker__calendar--picker",children:[e.jsxs("div",{className:"ui-datepicker__nav",children:[e.jsx("button",{type:"button",className:"ui-datepicker__nav-btn",onClick:()=>X(hn(U,-12)),"aria-label":"Previous year",children:e.jsx(sa,{})}),e.jsx("button",{type:"button",className:"ui-datepicker__nav-title",onClick:()=>N("years"),"aria-label":`${U.getFullYear()}. Click to choose year`,children:U.getFullYear()}),e.jsx("button",{type:"button",className:"ui-datepicker__nav-btn",onClick:()=>X(hn(U,12)),"aria-label":"Next year",children:e.jsx(ra,{})})]}),e.jsx("div",{className:"ui-datepicker__month-grid",children:li.map((M,T)=>e.jsx("button",{type:"button",className:Ge("ui-datepicker__month-cell",U.getMonth()===T&&"ui-datepicker__month-cell--active",b.getFullYear()===U.getFullYear()&&b.getMonth()===T&&"ui-datepicker__month-cell--today"),onClick:()=>{X(new Date(U.getFullYear(),T,1)),N("days")},children:M},T))})]}),wn=()=>{const M=Array.from({length:12},(T,pe)=>de+pe);return e.jsxs("div",{className:"ui-datepicker__calendar ui-datepicker__calendar--picker",children:[e.jsxs("div",{className:"ui-datepicker__nav",children:[e.jsx("button",{type:"button",className:"ui-datepicker__nav-btn",onClick:()=>fe(T=>T-12),"aria-label":"Previous years",children:e.jsx(sa,{})}),e.jsxs("span",{className:"ui-datepicker__nav-title ui-datepicker__nav-title--static",children:[de," – ",de+11]}),e.jsx("button",{type:"button",className:"ui-datepicker__nav-btn",onClick:()=>fe(T=>T+12),"aria-label":"Next years",children:e.jsx(ra,{})})]}),e.jsx("div",{className:"ui-datepicker__year-grid",children:M.map(T=>e.jsx("button",{type:"button",className:Ge("ui-datepicker__year-cell",U.getFullYear()===T&&"ui-datepicker__year-cell--active",b.getFullYear()===T&&"ui-datepicker__year-cell--today"),onClick:()=>{X(new Date(T,U.getMonth(),1)),fe(T-4),N("months")},children:T},T))})]})},Nn=()=>{const M=T=>{if(he===void 0||he==="no-date")return;const pe=he==="full"?jt():he;if(!pe)return;const ce=It(T,pe,Pe);je(T),We(Oe=>ce.includes(Oe)?Oe:ce[0]??0)};return he==="no-date"?e.jsxs("aside",{className:"ui-datepicker__time-sidebar","aria-label":"Time",children:[e.jsx("p",{className:"ui-datepicker__time-empty",children:"Select a date"}),e.jsx("button",{type:"button",className:"ui-datepicker__apply-btn",disabled:!0,children:"Apply"})]}):he===null||Ce.length===0?e.jsxs("aside",{className:"ui-datepicker__time-sidebar","aria-label":"Time",children:[e.jsx("p",{className:"ui-datepicker__time-empty",children:"No available times"}),e.jsx("button",{type:"button",className:"ui-datepicker__apply-btn",disabled:!0,children:"Apply"})]}):e.jsxs("aside",{className:"ui-datepicker__time-sidebar","aria-label":"Time",children:[e.jsxs("div",{className:"ui-datepicker__time-columns",children:[e.jsxs("div",{className:"ui-datepicker__time-scroll-col",children:[e.jsx("span",{className:"ui-datepicker__time-scroll-head",id:`${Z}-hour-col`,children:"Hr"}),e.jsx("div",{ref:et,className:"ui-datepicker__time-scroll-list",role:"listbox","aria-labelledby":`${Z}-hour-col`,children:Ce.map(T=>e.jsx("button",{type:"button",className:Ge("ui-datepicker__time-scroll-item",ge===T&&"ui-datepicker__time-scroll-item--selected"),"data-time-value":T,role:"option","aria-selected":ge===T,tabIndex:-1,onClick:()=>M(T),children:String(T).padStart(2,"0")},T))})]}),e.jsxs("div",{className:"ui-datepicker__time-scroll-col",children:[e.jsx("span",{className:"ui-datepicker__time-scroll-head",id:`${Z}-min-col`,children:"Min"}),e.jsx("div",{ref:st,className:"ui-datepicker__time-scroll-list",role:"listbox","aria-labelledby":`${Z}-min-col`,children:ht.map(T=>e.jsx("button",{type:"button",className:Ge("ui-datepicker__time-scroll-item",Ae===T&&"ui-datepicker__time-scroll-item--selected"),"data-time-value":T,role:"option","aria-selected":Ae===T,tabIndex:-1,onClick:()=>We(T),children:String(T).padStart(2,"0")},T))})]})]}),e.jsx("button",{type:"button",className:"ui-datepicker__apply-btn",onClick:Zt,children:"Apply"})]})},zt=hn(U,1),Qt=()=>e.jsx("div",{ref:Fe,className:Ge("ui-datepicker__popup",F?.popup),style:{position:"fixed",top:C?.top,bottom:C?.bottom,left:C?.left,maxHeight:C?.maxHeight,visibility:ne?"visible":"hidden",...nt!==void 0?{zIndex:nt}:null},onClick:M=>M.stopPropagation(),onMouseDown:M=>M.stopPropagation(),role:"dialog","aria-label":"Choose date","aria-modal":"true",children:e.jsxs("div",{className:"ui-datepicker__popup-inner",children:[I.length>0&&e.jsx("div",{className:"ui-datepicker__presets",children:I.map((M,T)=>e.jsx("button",{type:"button",className:"ui-datepicker__preset-btn",onClick:()=>Pt(M),children:M.label},T))}),e.jsxs("div",{className:Ge("ui-datepicker__body",m&&t==="single"&&we==="days"&&"ui-datepicker__body--with-time"),children:[we==="days"&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"ui-datepicker__calendars-block",children:[e.jsxs("div",{className:Ge("ui-datepicker__calendars",A&&"ui-datepicker__calendars--two"),children:[Ue(U,!0,!A),A&&Ue(zt,!1,!0)]}),t==="range"&&e.jsx("p",{className:"ui-datepicker__range-hint",children:De?"Select end date":ie.start&&ie.end?`${Ze(ie.start,o)} – ${Ze(ie.end,o)}`:"Select start date"})]}),m&&t==="single"&&Nn()]}),we==="months"&&kn(),we==="years"&&wn()]})]})}),kt=jn&&!H&&e.jsx("button",{type:"button",className:"ui-datepicker__clear-btn",onClick:Xt,onMouseDown:M=>M.preventDefault(),"aria-label":"Clear date",tabIndex:-1,children:e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round","aria-hidden":"true",focusable:"false",children:[e.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),e.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})}),Rt=e.jsx("button",{type:"button",className:Ge("ui-datepicker__input-icon-btn",_e&&"ui-datepicker__input-icon-btn--open"),tabIndex:-1,disabled:H,onMouseDown:M=>M.preventDefault(),onClick:_e?Ye:yt,"aria-label":"Open calendar",children:e.jsx(ts,{})}),en=M=>{Ke.current=!0,yt(),Q?.(M)},Y=M=>{pt(M),oe?.(M)},xe=Ge("ui-datepicker__input",`ui-datepicker__input--${ee}`,F?.input),Me=Ge("ui-datepicker__input","ui-datepicker__input--range",`ui-datepicker__input--${ee}`,F?.input),Se={disabled:H,required:J,"aria-expanded":_e,"aria-haspopup":"dialog","aria-invalid":$,onFocus:en,onBlur:Y},Te=()=>e.jsxs(e.Fragment,{children:[k&&e.jsxs("label",{htmlFor:G,className:Ge("ui-datepicker__label",$&&"ui-datepicker__label--error",F?.label),children:[k,J&&e.jsx("span",{className:"ui-datepicker__label-required",children:"*"})]}),e.jsxs("div",{className:Ge("ui-datepicker__input-wrapper",`ui-datepicker__input-wrapper--${ee}`,t==="range"&&"ui-datepicker__input-wrapper--range",$&&"ui-datepicker__input-wrapper--error",H&&"ui-datepicker__input-wrapper--disabled",_e&&"ui-datepicker__input-wrapper--open",!!B&&"ui-datepicker__input-wrapper--with-start-adornment",!!ae&&"ui-datepicker__input-wrapper--with-end-adornment",F?.wrapper),children:[B&&e.jsx("span",{className:"ui-datepicker__adornment ui-datepicker__adornment--start",children:B}),t==="single"?e.jsx("input",{...ye,ref:ke,id:G,type:"text",inputMode:"numeric",className:xe,value:ct,placeholder:c??(m?W:o),"aria-label":k??c??"Select date",onChange:xn,...Se}):e.jsxs(e.Fragment,{children:[e.jsx("input",{...ye,ref:ke,id:G,type:"text",inputMode:"numeric",className:Me,value:gt,placeholder:o,"aria-label":"Start date",onChange:Jt,...Se}),e.jsx("span",{className:"ui-datepicker__range-sep","aria-hidden":"true",children:"–"}),e.jsx("input",{type:"text",inputMode:"numeric",className:Me,value:Re,placeholder:o,"aria-label":"End date",onChange:vn,...Se})]}),ae&&e.jsx("span",{className:"ui-datepicker__adornment ui-datepicker__adornment--end",children:ae}),kt,Rt]})]}),tn=()=>e.jsx("button",{type:"button",className:Ge("ui-datepicker__icon-trigger",_e&&"ui-datepicker__icon-trigger--open",H&&"ui-datepicker__icon-trigger--disabled"),disabled:H,onClick:_e?Ye:yt,"aria-label":bn||"Select date","aria-expanded":_e,"aria-haspopup":"dialog",children:e.jsx(ts,{})});return e.jsxs("div",{ref:at,className:Ge("ui-datepicker",D&&"ui-datepicker--full-width",F?.root),style:ve,children:[i==="input"?Te():tn(),L&&i==="input"&&e.jsx("p",{className:Ge("ui-datepicker__helper-text",$&&"ui-datepicker__helper-text--error",F?.helperText),children:L}),_e&&C&&Ct.createPortal(Qt(),document.body)]})});ia.displayName="DatePicker";const pn=8,mi="HH:mm",ft=(...t)=>t.filter(Boolean).join(" ");function ut(t,n,s){const a=t??new Date;return new Date(a.getFullYear(),a.getMonth(),a.getDate(),n,s,0,0)}function it(t,n){const s=String(t.getHours()).padStart(2,"0"),a=String(t.getMinutes()).padStart(2,"0");return n.replace("HH",s).replace("mm",a)}function la(t,n){if(t.length!==n.length)return null;const s=n.indexOf("HH"),a=n.indexOf("mm");if(s<0||a<0)return null;const r=parseInt(t.slice(s,s+2),10),i=parseInt(t.slice(a,a+2),10);return isNaN(r)||isNaN(i)||r<0||r>23||i<0||i>59?null:{hour:r,minute:i}}function oa(t,n){const s=t.replace(/\D/g,"").slice(0,4);if(!s.length)return"";let a=0,r="",i=0;for(;i<n.length;)if(n.startsWith("HH",i)||n.startsWith("mm",i)){if(a>=s.length||(r+=s[a++],a>=s.length))break;r+=s[a++],i+=2}else{if(a<s.length)r+=n[i];else break;i+=1}return r}const ns=(t,n,s)=>{const a=window.innerHeight-t.bottom-pn,r=t.top-pn,i=s>a&&r>a;let o=t.left;return o+n>window.innerWidth-8&&(o=Math.max(8,window.innerWidth-8-n)),i?{bottom:window.innerHeight-t.top+pn,left:o,maxHeight:Math.min(420,r)}:{top:t.bottom+pn,left:o,maxHeight:Math.min(420,a)}};function as(){return e.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",focusable:"false",children:[e.jsx("circle",{cx:"12",cy:"12",r:"9"}),e.jsx("polyline",{points:"12 7 12 12 15.5 14"})]})}const ss=l.forwardRef(({mode:t="single",value:n,onChange:s,rangeValue:a,onRangeChange:r,triggerVariant:i="input",format:o=mi,placeholder:c,timeStep:d=1,bounds:u,label:p,helperText:f,error:h=!1,disabled:m=!1,required:x=!1,size:v="normal",fullWidth:g=!1,startAdornment:y,endAdornment:S,sx:k,style:L,id:$,onFocus:H,onBlur:J,...ee},D)=>{const B=l.useId(),ae=$||`${B}-input`,F=Math.max(1,Math.floor(d)),ve=n!==void 0,me=a!==void 0,[Q,oe]=l.useState(null),[ye,ke]=l.useState({start:null,end:null}),Z=ve?n??null:Q,G=me?a??ye:ye,b=l.useMemo(()=>Dt(u),[u]),A=u===null||b===null,I=b??jt(),W=l.useMemo(()=>A?[]:Za(I,F),[A,I,F]),[V,be]=l.useState(!1),[w,R]=l.useState(null),[re,ue]=l.useState(!1),P=Z?.getHours()??W[0]??0,ie=Z?.getMinutes()??0,[$e,Pe]=l.useState(P),[he,Ce]=l.useState(ie),_e=l.useMemo(()=>A?[]:It($e,I,F),[A,I,F,$e]),[ze,C]=l.useState(G.start?.getHours()??W[0]??0),[q,ne]=l.useState(G.start?.getMinutes()??0),[j,z]=l.useState(G.end?.getHours()??W[W.length-1]??0),[U,X]=l.useState(G.end?.getMinutes()??0),we=l.useMemo(()=>A?[]:It(ze,I,F),[A,I,F,ze]),N=l.useMemo(()=>A?[]:It(j,I,F),[A,I,F,j]),de=l.useRef(!1),[fe,De]=l.useState(()=>Z?it(Z,o):""),[Ne,O]=l.useState(()=>G.start?it(G.start,o):""),[le,ge]=l.useState(()=>G.end?it(G.end,o):""),je=l.useRef(null),Ae=l.useRef(null),We=l.useContext(Lt),ht=We?We.baseZ+rn:void 0,Ke=l.useRef(null),ct=l.useRef(null),Qe=l.useRef(null),gt=l.useRef(null),xt=l.useRef(null),Re=l.useRef(null),tt=l.useCallback(()=>{be(!1)},[]),at=l.useCallback(()=>{m||be(!0)},[m]);At({enabled:V,onEscape:tt}),l.useEffect(()=>{if(!V){R(null),ue(!1);return}const Y=je.current;if(!Y)return;const xe=Y.getBoundingClientRect();R({top:xe.bottom+pn,left:xe.left,maxHeight:420}),ue(!1);const Me=Te=>{!je.current?.contains(Te.target)&&!Ae.current?.contains(Te.target)&&tt()};setTimeout(()=>document.addEventListener("mousedown",Me),0);const Se=()=>{if(!Ae.current||!je.current)return;const Te=je.current.getBoundingClientRect();R(ns(Te,Ae.current.offsetWidth,Ae.current.offsetHeight))};return window.addEventListener("scroll",Se,!0),window.addEventListener("resize",Se),()=>{window.removeEventListener("scroll",Se,!0),window.removeEventListener("resize",Se),document.removeEventListener("mousedown",Me)}},[V,tt]),l.useLayoutEffect(()=>{if(!V||re||!Ae.current||!je.current)return;const Y=je.current.getBoundingClientRect();R(ns(Y,Ae.current.offsetWidth,Ae.current.offsetHeight)),ue(!0)},[V,w,re]),l.useLayoutEffect(()=>{if(!V||!re)return;const Y=xe=>xe?.scrollIntoView({block:"center"});t==="single"?(Y(Ke.current?.querySelector(`[data-time-value="${$e}"]`)),Y(ct.current?.querySelector(`[data-time-value="${he}"]`))):(Y(Qe.current?.querySelector(`[data-time-value="${ze}"]`)),Y(gt.current?.querySelector(`[data-time-value="${q}"]`)),Y(xt.current?.querySelector(`[data-time-value="${j}"]`)),Y(Re.current?.querySelector(`[data-time-value="${U}"]`)))},[V,re,t,$e,he,ze,q,j,U]),l.useEffect(()=>{if(t!=="single"||!Z||A)return;const Y=Yt(Z.getHours(),Z.getMinutes(),I,F);Pe(Y.hour),Ce(Y.minute)},[t,Z,A,I,F]),l.useEffect(()=>{if(t==="range"&&!A){if(G.start){const Y=Yt(G.start.getHours(),G.start.getMinutes(),I,F);C(Y.hour),ne(Y.minute)}if(G.end){const Y=Yt(G.end.getHours(),G.end.getMinutes(),I,F);z(Y.hour),X(Y.minute)}}},[t,G.start,G.end,A,I,F]),l.useEffect(()=>{de.current||t==="single"&&De(Z?it(Z,o):"")},[Z,o,t]),l.useEffect(()=>{de.current||t==="range"&&(O(G.start?it(G.start,o):""),ge(G.end?it(G.end,o):""))},[t,G.start,G.end,o]);const Fe=l.useCallback(Y=>{ve||oe(Y),s?.(Y)},[ve,s]),et=l.useCallback(Y=>{me||ke(Y),r?.(Y)},[me,r]),Gt=Y=>{if(A)return;de.current=!1;const xe=It(Y,I,F),Me=xe.includes(he)?he:xe[0]??0;Pe(Y),Ce(Me),Fe(ut(Z,Y,Me))},nt=Y=>{A||(de.current=!1,Ce(Y),Fe(ut(Z,$e,Y)))},st=(Y,xe)=>{if(A)return;de.current=!1;const Me=It(xe,I,F);if(Y==="start"){const Se=Me.includes(q)?q:Me[0]??0;C(xe),ne(Se),Ye("start",xe,Se)}else{const Se=Me.includes(U)?U:Me[0]??0;z(xe),X(Se),Ye("end",xe,Se)}},Be=(Y,xe)=>{A||(de.current=!1,Y==="start"?(ne(xe),Ye("start",ze,xe)):(X(xe),Ye("end",j,xe)))},Ye=(Y,xe,Me)=>{if(Y==="start"){const Se=ut(G.start,xe,Me);let Te=G.end;Te&&Te.getTime()<Se.getTime()&&(Te=ut(Te,xe,Me),z(xe),X(Me)),et({start:Se,end:Te})}else{const Se=G.start;let Te=ut(G.end??G.start,xe,Me);Se&&Te.getTime()<Se.getTime()&&(Te=ut(Te,Se.getHours(),Se.getMinutes()),z(Se.getHours()),X(Se.getMinutes())),et({start:Se,end:Te})}},yt=l.useCallback(Y=>{Y.stopPropagation(),de.current=!1,t==="single"?(De(""),Fe(null)):(O(""),ge(""),et({start:null,end:null}))},[t,Fe,et]),gn=l.useCallback(Y=>{const xe=oa(Y.target.value,o);if(De(xe),xe.length===o.length){const Me=la(xe,o);if(!Me||!A&&!Hn(Me.hour,Me.minute,I,F))return;Fe(ut(Z,Me.hour,Me.minute))}else xe.length===0&&Fe(null)},[o,A,I,F,Fe,Z]),Pt=l.useCallback(Y=>{const xe=oa(Y.target.value,o);if(O(xe),xe.length===o.length){const Me=la(xe,o);if(!Me||!A&&!Hn(Me.hour,Me.minute,I,F))return;const Se=ut(G.start,Me.hour,Me.minute);let Te=G.end;Te&&Te.getTime()<Se.getTime()&&(Te=ut(Te,Se.getHours(),Se.getMinutes())),et({start:Se,end:Te})}},[o,A,I,F,G.start,G.end,et]),Xt=l.useCallback(Y=>{const xe=oa(Y.target.value,o);if(ge(xe),xe.length===o.length){const Me=la(xe,o);if(!Me||!A&&!Hn(Me.hour,Me.minute,I,F))return;let Se=ut(G.end??G.start,Me.hour,Me.minute);const Te=G.start;Te&&Se.getTime()<Te.getTime()&&(Se=ut(Se,Te.getHours(),Te.getMinutes())),et({start:G.start,end:Se})}},[o,A,I,F,G.start,G.end,et]),xn=l.useCallback(Y=>{const xe=Y.relatedTarget;Ae.current?.contains(xe)||je.current?.contains(xe)||(de.current=!1,De(Z?it(Z,o):""),O(G.start?it(G.start,o):""),ge(G.end?it(G.end,o):""))},[Z,G.start,G.end,o]),Jt=(()=>{if(t==="single")return Z?it(Z,o):"";const{start:Y,end:xe}=G;return Y&&xe?`${it(Y,o)} – ${it(xe,o)}`:Y?`${it(Y,o)} – ...`:""})(),vn=t==="single"?!!Z:!!(G.start||G.end),pt=(Y,xe,Me,Se,Te,tn)=>e.jsxs("div",{className:"ui-timepicker__col",children:[e.jsx("span",{className:"ui-timepicker__col-head",id:Y,children:xe}),e.jsx("div",{ref:tn,className:"ui-timepicker__col-list",role:"listbox","aria-labelledby":Y,children:Me.map(M=>e.jsx("button",{type:"button",className:ft("ui-timepicker__col-item",Se===M&&"ui-timepicker__col-item--selected"),"data-time-value":M,role:"option","aria-selected":Se===M,tabIndex:-1,onClick:()=>Te(M),children:String(M).padStart(2,"0")},M))})]}),Zt=()=>e.jsx("div",{className:"ui-timepicker__empty",children:e.jsx("p",{children:"No available times"})}),bn=()=>A||W.length===0?Zt():e.jsx("div",{className:"ui-timepicker__body",children:e.jsx("div",{className:"ui-timepicker__group",children:e.jsxs("div",{className:"ui-timepicker__columns",children:[pt(`${B}-hr`,"Hour",W,$e,Gt,Ke),pt(`${B}-min`,"Minute",_e,he,nt,ct)]})})}),jn=()=>A||W.length===0?Zt():e.jsxs("div",{className:"ui-timepicker__body ui-timepicker__body--range",children:[e.jsxs("div",{className:"ui-timepicker__group",children:[e.jsx("span",{className:"ui-timepicker__group-label",children:"From"}),e.jsxs("div",{className:"ui-timepicker__columns",children:[pt(`${B}-shr`,"Hour",W,ze,Y=>st("start",Y),Qe),pt(`${B}-smin`,"Minute",we,q,Y=>Be("start",Y),gt)]})]}),e.jsxs("div",{className:"ui-timepicker__group",children:[e.jsx("span",{className:"ui-timepicker__group-label",children:"To"}),e.jsxs("div",{className:"ui-timepicker__columns",children:[pt(`${B}-ehr`,"Hour",W,j,Y=>st("end",Y),xt),pt(`${B}-emin`,"Minute",N,U,Y=>Be("end",Y),Re)]})]})]}),yn=()=>e.jsx("div",{ref:Ae,className:ft("ui-timepicker__popup",k?.popup),style:{position:"fixed",top:w?.top,bottom:w?.bottom,left:w?.left,maxHeight:w?.maxHeight,visibility:re?"visible":"hidden",...ht!==void 0?{zIndex:ht}:null},onClick:Y=>Y.stopPropagation(),onMouseDown:Y=>Y.stopPropagation(),role:"dialog","aria-label":"Choose time","aria-modal":"true",children:e.jsx("div",{className:"ui-timepicker__popup-inner",children:t==="single"?bn():jn()})}),Ue=vn&&!m&&e.jsx("button",{type:"button",className:"ui-timepicker__clear-btn",onClick:yt,onMouseDown:Y=>Y.preventDefault(),"aria-label":"Clear time",tabIndex:-1,children:e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round","aria-hidden":"true",focusable:"false",children:[e.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),e.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})}),kn=e.jsx("button",{type:"button",className:ft("ui-timepicker__icon-btn",V&&"ui-timepicker__icon-btn--open"),tabIndex:-1,disabled:m,onMouseDown:Y=>Y.preventDefault(),onClick:V?tt:at,"aria-label":"Open time picker",children:e.jsx(as,{})}),wn=Y=>{de.current=!0,at(),H?.(Y)},Nn=Y=>{xn(Y),J?.(Y)},zt=ft("ui-timepicker__input",`ui-timepicker__input--${v}`,k?.input),Qt=ft("ui-timepicker__input","ui-timepicker__input--range",`ui-timepicker__input--${v}`,k?.input),kt={disabled:m,required:x,"aria-expanded":V,"aria-haspopup":"dialog","aria-invalid":h,onFocus:wn,onBlur:Nn},Rt=()=>e.jsxs(e.Fragment,{children:[p&&e.jsxs("label",{htmlFor:ae,className:ft("ui-timepicker__label",h&&"ui-timepicker__label--error",k?.label),children:[p,x&&e.jsx("span",{className:"ui-timepicker__label-required",children:"*"})]}),e.jsxs("div",{className:ft("ui-timepicker__input-wrapper",`ui-timepicker__input-wrapper--${v}`,t==="range"&&"ui-timepicker__input-wrapper--range",h&&"ui-timepicker__input-wrapper--error",m&&"ui-timepicker__input-wrapper--disabled",V&&"ui-timepicker__input-wrapper--open",!!y&&"ui-timepicker__input-wrapper--with-start-adornment",!!S&&"ui-timepicker__input-wrapper--with-end-adornment",k?.wrapper),children:[y&&e.jsx("span",{className:"ui-timepicker__adornment ui-timepicker__adornment--start",children:y}),t==="single"?e.jsx("input",{...ee,ref:D,id:ae,type:"text",inputMode:"numeric",className:zt,value:fe,placeholder:c??o,"aria-label":p??c??"Select time",onChange:gn,...kt}):e.jsxs(e.Fragment,{children:[e.jsx("input",{...ee,ref:D,id:ae,type:"text",inputMode:"numeric",className:Qt,value:Ne,placeholder:o,"aria-label":"Start time",onChange:Pt,...kt}),e.jsx("span",{className:"ui-timepicker__range-sep","aria-hidden":"true",children:"–"}),e.jsx("input",{type:"text",inputMode:"numeric",className:Qt,value:le,placeholder:o,"aria-label":"End time",onChange:Xt,...kt})]}),S&&e.jsx("span",{className:"ui-timepicker__adornment ui-timepicker__adornment--end",children:S}),Ue,kn]})]}),en=()=>e.jsx("button",{type:"button",className:ft("ui-timepicker__icon-trigger",V&&"ui-timepicker__icon-trigger--open",m&&"ui-timepicker__icon-trigger--disabled"),disabled:m,onClick:V?tt:at,"aria-label":Jt||"Select time","aria-expanded":V,"aria-haspopup":"dialog",children:e.jsx(as,{})});return l.useEffect(()=>{if(!V||t!=="single"||Z||A)return;const Y=Ja(I,F);Y&&(Pe(Y.hour),Ce(Y.minute))},[V,t,Z,A,I,F]),e.jsxs("div",{ref:je,className:ft("ui-timepicker",g&&"ui-timepicker--full-width",k?.root),style:L,children:[i==="input"?Rt():en(),f&&i==="input"&&e.jsx("p",{className:ft("ui-timepicker__helper-text",h&&"ui-timepicker__helper-text--error",k?.helperText),children:f}),V&&w&&Ct.createPortal(yn(),document.body)]})});ss.displayName="TimePicker";const ca=({checked:t,defaultChecked:n,onChange:s,label:a,color:r="primary",size:i="medium",isIndeterminate:o=!1,isDisabled:c=!1,name:d,value:u,id:p,sx:f,style:h})=>{const m=l.useRef(null);l.useEffect(()=>{m.current&&(m.current.indeterminate=o)},[o]);const x=["ui-checkbox",`ui-checkbox--${r}`,`ui-checkbox--${i}`,c&&"ui-checkbox--disabled",f].filter(Boolean).join(" "),v=g=>{c||s?.(g.target.checked,g)};return e.jsxs("label",{className:x,style:h,children:[e.jsx("input",{ref:m,type:"checkbox",className:"ui-checkbox__input",checked:t,defaultChecked:n,disabled:c,name:d,value:u,id:p,onChange:v,"aria-checked":o?"mixed":t}),e.jsx("span",{className:"ui-checkbox__box","aria-hidden":"true",children:o?e.jsx("svg",{className:"ui-checkbox__mark",viewBox:"0 0 12 12",focusable:"false",children:e.jsx("line",{x1:"2",y1:"6",x2:"10",y2:"6",strokeWidth:"2",strokeLinecap:"round"})}):e.jsx("svg",{className:"ui-checkbox__mark",viewBox:"0 0 12 12",focusable:"false",children:e.jsx("polyline",{points:"1.5,6 4.5,9 10.5,3",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",fill:"none"})})}),a!=null&&e.jsx("span",{className:"ui-checkbox__label",children:a})]})};ca.displayName="Checkbox";const rs=l.createContext(null),is=l.createContext(null),ls=()=>{const t=l.useContext(rs);if(!t)throw new Error("AccordionTrigger/AccordionContent must be inside AccordionRoot");return t},os=()=>{const t=l.useContext(is);if(!t)throw new Error("AccordionTrigger/AccordionContent must be inside AccordionItem");return t},da=({children:t,variant:n="outlined",size:s="medium",allowMultiple:a=!1,defaultOpenIds:r=[],onToggle:i,divider:o=!0,sx:c,style:d})=>{const[u,p]=l.useState(new Set(r)),f=l.useCallback(m=>{p(x=>{const v=new Set(x),g=v.has(m);return g?v.delete(m):(a||v.clear(),v.add(m)),i?.(m,!g),v})},[a,i]),h=["ui-accordion",`ui-accordion--${n}`,`ui-accordion--${s}`,o&&"ui-accordion--divider",c].filter(Boolean).join(" ");return e.jsx(rs.Provider,{value:{openIds:u,toggle:f},children:e.jsx("div",{className:h,style:d,children:t})})};da.displayName="AccordionRoot";const ua=({id:t,children:n,isDisabled:s=!1,sx:a,style:r})=>{const{openIds:i}=ls(),o=i.has(t),c=["ui-accordion__item",o&&"ui-accordion__item--open",s&&"ui-accordion__item--disabled",a].filter(Boolean).join(" ");return e.jsx(is.Provider,{value:{itemId:t,isOpen:o,isDisabled:s},children:e.jsx("div",{className:c,style:r,children:n})})};ua.displayName="AccordionItem";const ha=({children:t,showChevron:n=!0,startAdornment:s,endAdornment:a,sx:r,style:i})=>{const{toggle:o}=ls(),{itemId:c,isOpen:d,isDisabled:u}=os(),p=["ui-accordion__trigger",r].filter(Boolean).join(" "),f=!!(s||a),h=n&&e.jsx("span",{className:["ui-accordion__chevron",d&&"ui-accordion__chevron--open"].filter(Boolean).join(" "),"aria-hidden":"true",children:e.jsx(Qn,{})}),m=e.jsxs("button",{className:p,type:"button","aria-expanded":d,"aria-controls":`accordion-content-${c}`,id:`accordion-header-${c}`,disabled:u,onClick:()=>o(c),style:i,children:[t,!f&&h]});if(!f)return m;const x=v=>v.stopPropagation();return e.jsxs("div",{className:"ui-accordion__header",children:[s&&e.jsx("div",{className:"ui-accordion__adornment ui-accordion__adornment--start",onClick:x,children:s}),m,a&&e.jsx("div",{className:"ui-accordion__adornment ui-accordion__adornment--end",onClick:x,children:a}),h&&e.jsx("span",{className:"ui-accordion__chevron-wrap",onClick:()=>!u&&o(c),"aria-hidden":"true",children:h})]})};ha.displayName="AccordionTrigger";const pa=({children:t,sx:n,style:s})=>{const{itemId:a}=os(),r=["ui-accordion__content-inner",n].filter(Boolean).join(" ");return e.jsx("div",{id:`accordion-content-${a}`,role:"region","aria-labelledby":`accordion-header-${a}`,className:"ui-accordion__content",children:e.jsx("div",{className:r,style:s,children:t})})};pa.displayName="AccordionContent";const cs=({items:t,...n})=>e.jsx(da,{...n,children:t.map(s=>e.jsxs(ua,{id:s.id,isDisabled:s.isDisabled,children:[e.jsxs(ha,{children:[s.icon&&e.jsx("span",{className:"ui-accordion__item-icon",children:s.icon}),e.jsx("span",{className:"ui-accordion__title",children:s.title})]}),e.jsx(pa,{children:s.content})]},s.id))});cs.displayName="Accordion";function fi(t,n){return n}function _i(t,n){const s=t[n];return s==null||s===""?"-":s}function mn(t){if(t!==void 0)return typeof t=="number"?`${t}px`:t}function gi({row:t,rowIndex:n,visibleCols:s,tdClasses:a,stickyStyles:r,onRowClick:i,onKeyDown:o}){return e.jsx("tr",{className:"ui-table__tr",tabIndex:i?0:void 0,role:i?"button":void 0,onClick:i?()=>i(t,n):void 0,onKeyDown:o?c=>o(c,t,n):void 0,children:s.map((c,d)=>e.jsx("td",{className:a[d],style:r[d],children:c.render?c.render(t,n):_i(t,c.key)},c.key))})}const xi=l.memo(gi),He=4,ds=80,vi=({x:t,anchorTop:n,anchorBottom:s,items:a,onClose:r,portalNode:i,boundsRect:o})=>{const c=l.useRef(null),[d,u]=l.useState({left:t,top:s}),[p,f]=l.useState(()=>a.findIndex(x=>!x.disabled));At({enabled:!0,onEscape:r}),l.useLayoutEffect(()=>{const x=c.current;if(!x)return;x.style.maxHeight="";const v=x.getBoundingClientRect();let g=t-v.width,y=s,S;o&&v.width<=o.width?(g+v.width>o.right-He&&(g=o.right-v.width-He),g<o.left+He&&(g=o.left+He)):(g+v.width>window.innerWidth-He&&(g=window.innerWidth-v.width-He),g<He&&(g=He));const k=window.innerHeight-s-He,L=n-He;v.height<=k?y=s:v.height<=L?y=n-v.height:k>=L?(y=s,S=Math.max(ds,k)):(S=Math.max(ds,L),y=n-S),u({left:g,top:y,maxHeight:S})},[t,n,s,o]),l.useEffect(()=>{const x=g=>{c.current&&!c.current.contains(g.target)&&r()},v=()=>r();return document.addEventListener("pointerdown",x,!0),window.addEventListener("scroll",v,!0),window.addEventListener("resize",v),()=>{document.removeEventListener("pointerdown",x,!0),window.removeEventListener("scroll",v,!0),window.removeEventListener("resize",v)}},[r]),l.useEffect(()=>{c.current?.focus()},[]);const h=x=>{if(a.length===0)return;let v=p;for(let g=0;g<a.length;g+=1)if(v=(v+x+a.length)%a.length,!a[v].disabled){f(v);return}},m=x=>{if(x.key==="ArrowDown")x.preventDefault(),h(1);else if(x.key==="ArrowUp")x.preventDefault(),h(-1);else if(x.key==="Enter"||x.key===" "){x.preventDefault();const v=a[p];v&&!v.disabled&&(v.onSelect(),r())}};return i?Ct.createPortal(e.jsx("div",{ref:c,className:"ui-table__ctxmenu",role:"menu",tabIndex:-1,style:{left:d.left,top:d.top,maxHeight:d.maxHeight,overflowY:d.maxHeight?"auto":void 0},onKeyDown:m,onContextMenu:x=>x.preventDefault(),children:a.map((x,v)=>e.jsx("div",{role:"menuitem","aria-disabled":x.disabled||void 0,className:["ui-table__ctxmenu-item",x.disabled&&"ui-table__ctxmenu-item--disabled",v===p&&!x.disabled&&"ui-table__ctxmenu-item--focused"].filter(Boolean).join(" "),onMouseEnter:()=>!x.disabled&&f(v),onClick:x.disabled?void 0:()=>{x.onSelect(),r()},children:x.label},x.key))}),i):null},us=120,hs=36,bi=8,ji=({x:t,anchorTop:n,anchorBottom:s,columns:a,pinnedKeys:r,hiddenKeys:i,visibleCount:o,canPin:c,canHide:d,canReorder:u,onTogglePin:p,onToggleHide:f,onUnpinAll:h,onShowAll:m,onReset:x,onReorder:v,hasUnpinnablePinned:g,hasHiddenColumns:y,labels:S,onClose:k,portalNode:L,boundsRect:$})=>{const H=l.useRef(null),J=l.useRef(null),[ee,D]=l.useState({left:t,top:s}),[B,ae]=l.useState(null),[F,ve]=l.useState(!1),me=l.useRef(null);At({enabled:!0,onEscape:k}),l.useLayoutEffect(()=>{const C=H.current;if(!C)return;C.style.maxHeight="";const q=C.getBoundingClientRect();let ne=t-q.width,j=s,z;$&&q.width<=$.width?(ne+q.width>$.right-He&&(ne=$.right-q.width-He),ne<$.left+He&&(ne=$.left+He)):(ne+q.width>window.innerWidth-He&&(ne=window.innerWidth-q.width-He),ne<He&&(ne=He));const U=window.innerHeight-s-He,X=n-He;q.height<=U?j=s:q.height<=X?j=n-q.height:U>=X?(j=s,z=Math.max(us,U)):(z=Math.max(us,X),j=n-z),D({left:ne,top:j,maxHeight:z})},[t,n,s,$]);const Q=l.useCallback((C,q)=>{const ne=H.current,j=ne?.offsetWidth??0,z=ne?.offsetHeight??0,U=Math.max(He,window.innerWidth-j-He),X=Math.max(He,window.innerHeight-z-He);return{left:Math.min(Math.max(He,C),U),top:Math.min(Math.max(He,q),X)}},[]);l.useEffect(()=>{const C=j=>{H.current&&!H.current.contains(j.target)&&k()},q=j=>{const z=H.current;z&&z.contains(j.target)||k()},ne=()=>{if(B){ae(j=>j&&Q(j.left,j.top));return}k()};return document.addEventListener("pointerdown",C,!0),window.addEventListener("scroll",q,!0),window.addEventListener("resize",ne),()=>{document.removeEventListener("pointerdown",C,!0),window.removeEventListener("scroll",q,!0),window.removeEventListener("resize",ne)}},[k,B,Q]);const oe=l.useCallback(C=>{if(C.button!==0||C.target.closest('button, a, input, [role="button"]'))return;const ne=H.current;if(!ne)return;const j=ne.getBoundingClientRect();me.current={pointerX:C.clientX,pointerY:C.clientY,left:j.left,top:j.top},C.currentTarget.setPointerCapture(C.pointerId),ve(!0),ae({left:j.left,top:j.top})},[]),ye=l.useCallback(C=>{const q=me.current;if(!q)return;const ne=Q(q.left+(C.clientX-q.pointerX),q.top+(C.clientY-q.pointerY));ae(j=>j&&j.left===ne.left&&j.top===ne.top?j:ne)},[Q]),ke=l.useCallback(C=>{if(me.current){me.current=null;try{C.currentTarget.releasePointerCapture(C.pointerId)}catch{}ve(!1)}},[]),Z=l.useMemo(()=>new Set(r),[r]),G=l.useMemo(()=>new Set(i),[i]),[b,A]=l.useState(null),[I,W]=l.useState(null),[V,be]=l.useState(null),w=l.useRef(0),R=l.useRef(0),re=l.useCallback(()=>{if(R.current)return;const C=()=>{const q=w.current,ne=J.current;if(!q||!ne){R.current=0;return}ne.scrollTop+=q*bi,R.current=requestAnimationFrame(C)};R.current=requestAnimationFrame(C)},[]),ue=l.useCallback(()=>{w.current=0,R.current&&(cancelAnimationFrame(R.current),R.current=0)},[]);l.useEffect(()=>()=>ue(),[ue]);const P=l.useCallback((C,q)=>Z.has(C)===Z.has(q),[Z]),ie=l.useCallback((C,q)=>{C.dataTransfer.effectAllowed="move";try{C.dataTransfer.setData("text/plain",q)}catch{}A(q)},[]),$e=l.useCallback((C,q,ne)=>{if(!b||b===q||ne.alwaysPinned)return;const j=J.current;if(j){const we=j.getBoundingClientRect();C.clientY<we.top+hs?(w.current=-1,re()):C.clientY>we.bottom-hs?(w.current=1,re()):w.current=0}if(!P(b,q)){C.preventDefault(),C.dataTransfer.dropEffect="none",W({key:q,position:"before"});return}C.preventDefault(),C.dataTransfer.dropEffect="move";const z=C.currentTarget.getBoundingClientRect(),U=z.top+z.height/2,X=C.clientY<U?"before":"after";W(we=>we&&we.key===q&&we.position===X?we:{key:q,position:X})},[b,P,re]),Pe=l.useCallback(C=>{C.preventDefault(),b&&I&&P(b,I.key)&&b!==I.key&&v(b,I.key,I.position),A(null),W(null),ue()},[b,I,P,v,ue]),he=l.useCallback(()=>{A(null),W(null),ue()},[ue]),Ce=l.useCallback((C,q)=>{if(C.key===" "||C.key==="Enter"){C.preventDefault(),be(z=>z===q?null:q);return}if(C.key==="Escape"){V===q&&(C.preventDefault(),be(null));return}if(V!==q||C.key!=="ArrowUp"&&C.key!=="ArrowDown")return;C.preventDefault();const ne=C.key==="ArrowUp"?-1:1,j=a.findIndex(z=>z.key===q);if(j!==-1)for(let z=j+ne;z>=0&&z<a.length;z+=ne){const U=a[z];if(!U.alwaysPinned&&P(q,U.key)){v(q,U.key,ne===-1?"before":"after");return}}},[a,V,P,v]);if(!L)return null;const _e=B?B.left:ee.left,ze=B?B.top:ee.top;return Ct.createPortal(e.jsxs("div",{ref:H,className:["ui-table__manage",F&&"ui-table__manage--dragging"].filter(Boolean).join(" "),role:"dialog","aria-label":S.manageTitle,style:{left:_e,top:ze,...ee.maxHeight!==void 0&&!B?{maxHeight:ee.maxHeight}:null},children:[e.jsxs("div",{className:"ui-table__manage-header",onPointerDown:oe,onPointerMove:ye,onPointerUp:ke,onPointerCancel:ke,children:[e.jsx("span",{className:"ui-table__manage-title",children:S.manageTitle}),e.jsx(Ie,{sx:"ui-table__manage-close",icon:e.jsx(bt,{}),size:"small",variant:"ghost",color:"neutral",onClick:k,"aria-label":S.close,title:S.close})]}),e.jsx("div",{ref:J,className:"ui-table__manage-list",role:"group","aria-label":S.manageTitle,onDragLeave:C=>{C.currentTarget===C.target&&W(null)},children:a.map(C=>{const q=typeof C.label=="string"?C.label:C.key,ne=G.has(C.key),j=!ne,z=Z.has(C.key),U=z?Lr:Jr,X=u&&!C.alwaysPinned,we=b===C.key,N=V===C.key,de=I?.key===C.key,fe=de&&b!==null&&!P(b,C.key),De=!c||!!C.alwaysPinned||ne,Ne=!d||!!C.alwaysVisible||j&&o<=1,O=C.alwaysPinned?S.lockedHint:ne?S.pin:z?S.unpin:S.pin,le=["ui-table__manage-item",!X&&"ui-table__manage-item--locked",we&&"ui-table__manage-item--dragging",N&&"ui-table__manage-item--lifted",de&&!fe&&I?.position==="before"&&"ui-table__manage-item--drop-before",de&&!fe&&I?.position==="after"&&"ui-table__manage-item--drop-after",de&&fe&&"ui-table__manage-item--drop-forbidden"].filter(Boolean).join(" ");return e.jsxs("div",{className:le,onDragOver:b?ge=>$e(ge,C.key,C):void 0,onDrop:b?Pe:void 0,children:[u&&e.jsx("button",{type:"button",className:"ui-table__manage-handle","aria-label":S.dragHandle,title:C.alwaysPinned?S.lockedHint:S.dragHandle,disabled:!X,"aria-pressed":N||void 0,draggable:X,onDragStart:X?ge=>ie(ge,C.key):void 0,onDragEnd:he,onKeyDown:X?ge=>Ce(ge,C.key):void 0,children:e.jsx(Nr,{"aria-hidden":"true"})}),e.jsx("div",{className:"ui-table__manage-item-main",children:e.jsx(ca,{size:"small",checked:j,isDisabled:Ne,onChange:()=>f(C.key),label:q})}),c&&e.jsx(Ie,{sx:["ui-table__manage-pin",De&&"ui-table__manage-pin--locked"].filter(Boolean).join(" "),icon:e.jsx(U,{}),size:"small",variant:"ghost",color:z?"primary":"neutral",onClick:()=>p(C.key),disabled:De,"aria-pressed":z,"aria-label":O,title:O})]},C.key)})}),e.jsxs("div",{className:"ui-table__manage-footer",children:[(g||y)&&e.jsxs("div",{className:"ui-table__manage-footer-row",children:[g&&e.jsx(Xe,{variant:"outlined",size:"small",color:"neutral",onClick:h,children:S.unpinAll}),y&&e.jsx(Xe,{variant:"outlined",size:"small",color:"neutral",onClick:m,children:S.showAll})]}),e.jsx(Xe,{variant:"text",size:"small",color:"primary",onClick:x,sx:"ui-table__manage-reset",children:S.reset})]})]}),L)},yi=120;function ps(t,n=yi){let s=null,a=0;const r=o=>{s=o,a&&window.clearTimeout(a),o?a=window.setTimeout(()=>{s=null,a=0},n):a=0},i=[];for(const o of t){const c=()=>{if(s&&s!==o)return;r(o);const d=o.scrollLeft;for(const u of t)u!==o&&u.scrollLeft!==d&&(u.scrollLeft=d)};o.addEventListener("scroll",c,{passive:!0}),i.push({src:o,handler:c})}return{lockTo:o=>r(o),dispose:()=>{a&&window.clearTimeout(a);for(const{src:o,handler:c}of i)o.removeEventListener("scroll",c)}}}function ki(t,n,s){const a=t.filter(i=>i!==n);let r=0;for(let i=0;i<a.length;i+=1)s.has(a[i])&&(r=i+1);return a.splice(r,0,n),a}function ma(t,n,s,a,r){const i=t.filter(d=>d!==n),o=s.indexOf(n);let c=i.length;for(let d=0;d<i.length;d+=1){const u=i[d];if(a.has(u)===r&&s.indexOf(u)>o){c=d;break}}return i.splice(c,0,n),i}function wi(t,n,s,a,r){if(n===s||r(n)!==r(s))return null;const i=t.indexOf(n);if(i===-1)return null;const o=t.slice();o.splice(i,1);let c=o.indexOf(s);return c===-1?null:(a==="after"&&(c+=1),o.splice(c,0,n),o)}function Ni(t){if(!t)return window;let n=t.parentElement;for(;n&&n!==document.body&&n!==document.documentElement;){const a=getComputedStyle(n).overflowY;if((a==="auto"||a==="scroll"||a==="overlay")&&n.scrollHeight>n.clientHeight)return n;n=n.parentElement}return window}function Ci(t,n){const s=t!==void 0?t:n;return s===!1||s===void 0?{enabled:!1,pin:!1,hide:!1,reorder:!1,manage:!1}:s===!0?{enabled:!0,pin:!0,hide:!0,reorder:!0,manage:!0}:{enabled:!0,pin:s.pin!==!1,hide:s.hide!==!1,reorder:s.reorder!==!1,manage:s.manage!==!1}}function ms({columns:t,data:n,isLoading:s=!1,hasBorder:a=!0,hasRowDividers:r=!0,hasColumnDividers:i=!1,isStriped:o=!1,size:c="medium",variant:d="filled",color:u="default",radius:p="md",visibleColumns:f,stickyColumns:h,columnMenu:m,enableColumnMenu:x,defaultStickyColumns:v,defaultHiddenColumns:g,columnOrder:y,defaultColumnOrder:S,onStickyColumnsChange:k,onHiddenColumnsChange:L,onColumnOrderChange:$,columnMenuLabels:H,columnMenuDefaults:J,sorting:ee,onSort:D,footer:B,onRowClick:ae,rowKey:F=fi,minWidth:ve,height:me,maxHeight:Q,stickyHeaderOffset:oe,stickyFooterOffset:ye,emptyState:ke="No data to display",loadingState:Z="Loading…",sx:G,style:b}){const A=oe!==void 0,I=ye!==void 0&&B!==void 0&&B!==null,W=A||I,V=l.useMemo(()=>Ci(m,x),[m,x]),be=h!==void 0,w=f!==void 0,R=y!==void 0,[re,ue]=l.useState(()=>v??[]),[P,ie]=l.useState(()=>new Set(g??[])),[$e,Pe]=l.useState(()=>S??[]),he=l.useMemo(()=>{if(w){const _=new Set;for(const[E,K]of Object.entries(f))K===!1&&_.add(E);return _}return P},[w,f,P]),Ce=l.useMemo(()=>{const _=new Set,E=[];for(const K of t)K.alwaysPinned&&!_.has(K.key)&&(_.add(K.key),E.push(K.key));if(be)for(const K of h){const se=t[K];se&&!_.has(se.key)&&(_.add(se.key),E.push(se.key))}else for(const K of re)_.has(K)||(_.add(K),E.push(K));return E},[be,h,t,re]),_e=l.useMemo(()=>new Set(Ce),[Ce]),ze=l.useMemo(()=>{const _=new Set;for(const E of t)E.alwaysVisible&&_.add(E.key);return _},[t]),C=l.useMemo(()=>{const _=new Set;for(const E of t)E.alwaysPinned&&_.add(E.key);return _},[t]),q=l.useMemo(()=>t.map(_=>_.key),[t]),ne=l.useCallback(_=>ze.has(_)?!1:he.has(_),[ze,he]),j=l.useMemo(()=>{const _=R?y:$e,E=[],K=new Set;for(const se of _)C.has(se)||q.includes(se)&&(K.has(se)||(K.add(se),E.push(se)));for(const se of t)se.alwaysPinned||K.has(se.key)||(K.add(se.key),E.push(se.key));return E},[R,y,$e,t,C,q]),z=l.useMemo(()=>{const _=new Map;for(const K of t)_.set(K.key,K);const E=[];for(const K of t)K.alwaysPinned&&E.push(K);for(const K of j){const se=_.get(K);se&&!se.alwaysPinned&&E.push(se)}return E},[t,j]),U=l.useMemo(()=>{const _=z.filter(se=>!ne(se.key));if(Ce.length===0)return _;const E=[],K=[];for(const se of _)_e.has(se.key)?E.push(se):K.push(se);return[...E,...K]},[z,ne,Ce,_e]),X=l.useMemo(()=>{const _=[];return U.forEach((E,K)=>{_e.has(E.key)&&_.push(K)}),_},[U,_e]),we=l.useMemo(()=>new Set(X),[X]),N=X.length>0?X[X.length-1]:-1,de=l.useRef(null),fe=l.useRef(null),De=l.useRef(null),Ne=l.useRef(null),O=l.useRef(null),le=l.useRef(null),ge=l.useRef(null),je=l.useRef([]),Ae=l.useRef(null),[We,ht]=l.useState(new Map),[Ke,ct]=l.useState(!1),[Qe,gt]=l.useState(0),xt=Dn(),[Re,tt]=l.useState(null),at=l.useCallback(()=>tt(null),[]),[Fe,et]=l.useState(null),Gt=l.useCallback(()=>et(null),[]),nt=l.useCallback(_=>{be||ue(_),k?.(_)},[be,k]),st=l.useCallback(_=>{w||ie(_),L?.(Array.from(_))},[w,L]),Be=l.useCallback(_=>{R||Pe(_),$?.(_)},[R,$]),Ye=l.useCallback(_=>{if(_e.has(_))return;const E=[...Ce,_],K=new Set(E);nt(E),Be(ki(j,_,K))},[Ce,_e,j,nt,Be]),yt=l.useCallback(_=>{if(!_e.has(_)||C.has(_))return;const E=Ce.filter(se=>se!==_),K=new Set(E);nt(E),Be(ma(j,_,q,K,!1))},[Ce,_e,C,j,q,nt,Be]),gn=l.useCallback(()=>{if(Ce.length===0)return;const _=Ce.filter(E=>C.has(E));_.length!==Ce.length&&nt(_)},[Ce,C,nt]),Pt=l.useCallback(_=>{if(ze.has(_)||he.has(_))return;let E=0;for(const se of t)if(se.key!==_&&!he.has(se.key)&&(E+=1,E>0))break;if(E===0)return;const K=new Set(he);if(K.add(_),_e.has(_)&&!C.has(_)){const se=Ce.filter(Bt=>Bt!==_),Le=new Set(se);nt(se),Be(ma(j,_,q,Le,!1))}st(K)},[t,ze,C,he,_e,Ce,j,q,nt,st,Be]),Xt=l.useCallback(_=>{if(!he.has(_))return;const E=new Set(he);E.delete(_);const K=_e.has(_);Be(ma(j,_,q,_e,K)),st(E)},[he,_e,j,q,st,Be]),xn=l.useCallback(()=>{st(new Set)},[st]),Jt=l.useMemo(()=>{const _=[];for(const E of t)ne(E.key)&&_.push(E.key);return _},[t,ne]),vn=Jt.length,pt=l.useCallback((_,E)=>{if(!V.enabled)return;_.preventDefault(),_.stopPropagation();const K=_.currentTarget.getBoundingClientRect(),se=de.current?.getBoundingClientRect()??null;et(null),tt(Le=>Le?.colKey===E.key?null:{colKey:E.key,x:K.right,anchorTop:K.top,anchorBottom:K.bottom,boundsRect:se})},[V.enabled]),Zt=l.useCallback(_=>{_e.has(_)?yt(_):Ye(_)},[_e,yt,Ye]),bn=l.useCallback(_=>{ne(_)?Xt(_):Pt(_)},[ne,Xt,Pt]),jn=l.useCallback(()=>{const _=J?.pinned??v??[],E=J?.hidden??g??[],K=J?.order??S??[];nt(_),st(new Set(E)),Be(K)},[J,v,g,S,nt,st,Be]),yn=l.useCallback((_,E,K)=>{if(C.has(_)||C.has(E))return;const se=wi(j,_,E,K,Le=>_e.has(Le)&&!C.has(Le));se&&Be(se)},[j,_e,C,Be]),Ue=l.useMemo(()=>({pin:"Pin column",unpin:"Unpin column",hide:"Hide column",manage:"Manage columns",manageTitle:"Manage columns",unpinAll:"Unpin all",showAll:"Show all columns",reset:"Reset",lockedHint:"Locked",dragHandle:"Reorder",close:"Close",...H}),[H]),kn=l.useMemo(()=>({manageTitle:Ue.manageTitle,unpinAll:Ue.unpinAll,showAll:Ue.showAll,reset:Ue.reset,lockedHint:Ue.lockedHint,pin:Ue.pin,unpin:Ue.unpin,dragHandle:Ue.dragHandle,close:Ue.close}),[Ue]),wn=l.useMemo(()=>Ce.some(_=>!C.has(_)),[Ce,C]),Nn=l.useCallback((_,E)=>{if(!V.enabled||!(_.key==="F10"&&_.shiftKey||_.key==="ContextMenu"))return;_.preventDefault();const se=_.currentTarget.getBoundingClientRect(),Le=de.current?.getBoundingClientRect()??null;et(null),tt({colKey:E.key,x:se.right,anchorTop:se.top,anchorBottom:se.bottom,boundsRect:Le})},[V.enabled]);je.current.length>U.length&&(je.current.length=U.length);const zt=l.useRef(null);l.useLayoutEffect(()=>{const _=fe.current,E=De.current,K=O.current;if(!_||!E||!K)return;const se=()=>{const Bt=E.scrollWidth,vt=_.clientWidth;gt(Bt),ct(Bt-vt>1);const wt=Ae.current;if(wt){const Ve=wt.firstElementChild;Ve&&(Ve.style.width=`${vt}px`)}const nn=K.querySelectorAll("th"),Nt=[];for(let Ve=0;Ve<nn.length;Ve+=1)Nt.push(nn[Ve].getBoundingClientRect().width);const Tt=je.current;for(let Ve=0;Ve<Nt.length;Ve+=1){const rt=Tt[Ve];rt&&(rt.style.width=`${Nt[Ve]}px`)}if(X.length===0)ht(Ve=>Ve.size===0?Ve:new Map);else{const Ve=new Map;let rt=0;for(const lt of X)Ve.set(lt,rt),rt+=Nt[lt]??0;ht(lt=>{if(lt.size!==Ve.size)return Ve;for(const[Ca,Ma]of Ve)if(lt.get(Ca)!==Ma)return Ve;return lt})}};zt.current=se,se();const Le=new ResizeObserver(se);return Le.observe(E),Le.observe(_),Le.observe(K),()=>{Le.disconnect(),zt.current=null}},[U,X,A]),l.useLayoutEffect(()=>{zt.current?.()},[s,n.length]);const Qt=l.useRef({prevDisplay:"",prevTop:NaN,prevLeft:NaN,prevWidth:NaN,wasVisible:!1}),kt=l.useRef(null);l.useEffect(()=>{if(!A&&!I)return;const _=le.current,E=fe.current;if(!E||A&&!_)return;const K=A&&_?ps([E,_]):null,se=Qt.current;let Le=0;const Bt=()=>{Le=0;const Tt=de.current,Ve=O.current;if(!Tt)return;const rt=Tt.getBoundingClientRect(),lt=kt.current,Ca=lt&&lt!==window?lt.getBoundingClientRect().top:0,Ma=lt&&lt!==window?lt.getBoundingClientRect().bottom:window.innerHeight;if(A&&_&&Ve){const Sa=E.getBoundingClientRect(),tr=Ve.offsetHeight,Mn=Ca+oe,Wn=Sa.top<=Mn&&rt.bottom>Mn+tr,Ea=Wn?"block":"none";if(Ea!==se.prevDisplay&&(_.style.display=Ea,se.prevDisplay=Ea),Mn!==se.prevTop&&(_.style.top=`${Mn}px`,se.prevTop=Mn),rt.left!==se.prevLeft&&(_.style.left=`${rt.left}px`,se.prevLeft=rt.left),rt.width!==se.prevWidth&&(_.style.width=`${rt.width}px`,se.prevWidth=rt.width),Wn&&!se.wasVisible){const ar=E.scrollLeft;_.scrollLeft!==ar&&(K?.lockTo(E),_.scrollLeft=ar)}se.wasVisible=Wn;const nr=Wn?"true":"false";Tt.dataset.headerStuck!==nr&&(Tt.dataset.headerStuck=nr)}if(I){const Sa=ye??0,Da=rt.bottom>Ma-Sa?"true":"false";Tt.dataset.footerStuck!==Da&&(Tt.dataset.footerStuck=Da)}},vt=()=>{Le||(Le=requestAnimationFrame(Bt))};kt.current=Ni(de.current);const wt=kt.current;Bt(),window.addEventListener("scroll",vt,{passive:!0}),window.addEventListener("resize",vt),wt&&wt!==window&&wt.addEventListener("scroll",vt,{passive:!0});const nn=de.current,Nt=nn?new ResizeObserver(vt):null;return Nt&&nn&&Nt.observe(nn),()=>{Le&&cancelAnimationFrame(Le),window.removeEventListener("scroll",vt),window.removeEventListener("resize",vt),wt&&wt!==window&&wt.removeEventListener("scroll",vt),K?.dispose(),Nt&&Nt.disconnect()}},[A,oe,I,ye]),l.useEffect(()=>{const _=fe.current,E=Ne.current;if(!_||!E||!Ke)return;const K=ps([_,E]);return()=>K.dispose()},[Ke]);const Rt=mn(ve),en=mn(me),Y=mn(Q),xe=["ui-table",`ui-table--${c}`,d!=="filled"&&`ui-table--variant-${d}`,u!=="default"&&`ui-table--color-${u}`,p!=="md"&&`ui-table--radius-${p}`,a&&"ui-table--bordered",!r&&"ui-table--no-row-dividers",i&&"ui-table--col-dividers",o&&"ui-table--striped",ae&&"ui-table--clickable-rows",G].filter(Boolean).join(" "),Me=l.useMemo(()=>U.map((_,E)=>{const K=we.has(E);return["ui-table__th",_.align&&`ui-table__th--align-${_.align}`,K&&"ui-table__th--sticky",K&&E===N&&"ui-table__th--sticky-last"].filter(Boolean).join(" ")}),[U,we,N]),Se=l.useMemo(()=>U.map((_,E)=>{const K=we.has(E);return["ui-table__td",_.align&&`ui-table__td--align-${_.align}`,_.wrap&&"ui-table__td--wrap",K&&"ui-table__td--sticky",K&&E===N&&"ui-table__td--sticky-last"].filter(Boolean).join(" ")}),[U,we,N]),Te=l.useMemo(()=>U.map((_,E)=>{if(we.has(E))return{left:`${We.get(E)??0}px`}}),[U,we,We]),tn=_=>{if(!_.sortable||!D)return null;const E=ee?.sort_by===_.key,K=E?ee?.sort_order==="ASC"?Vr:Fr:Gr;return e.jsx("span",{className:["ui-table__sort-icon",E&&"ui-table__sort-icon--active"].filter(Boolean).join(" "),"aria-hidden":"true",children:e.jsx(K,{})})},M=_=>{!_.sortable||!D||D(_.key)},T=(_,E)=>{(_.key==="Enter"||_.key===" ")&&(_.preventDefault(),M(E))},pe=l.useCallback((_,E,K)=>{ae&&(_.key==="Enter"||_.key===" ")&&(_.preventDefault(),ae(E,K))},[ae]),ce=U.length||1,Oe=()=>e.jsx("colgroup",{children:U.map(_=>e.jsx("col",{style:_.width!==void 0?{width:mn(_.width)}:void 0},_.key))}),dt=W?{overflowX:"auto",overflowY:"visible",maxHeight:"none",height:"auto"}:{height:en,maxHeight:en?void 0:Y},qe={...b};W&&(qe.overflow="visible");const Ht=I?{position:"sticky",bottom:ye,zIndex:5}:void 0,Cn=(_,E,K)=>!E&&!K?_:[_,E&&"ui-table__th--sortable",K&&"ui-table__th--sorted"].filter(Boolean).join(" ");return e.jsxs("div",{ref:de,className:[xe,W&&"ui-table--page-sticky"].filter(Boolean).join(" "),style:qe,children:[Ke&&e.jsx("div",{ref:Ne,className:"ui-table__top-scroll","aria-hidden":"true",children:e.jsx("div",{className:"ui-table__top-scroll-inner",style:{width:`${Qe}px`}})}),e.jsx("div",{ref:fe,className:"ui-table__viewport",style:dt,children:e.jsxs("table",{ref:De,className:"ui-table__table",style:{minWidth:Rt},role:"table",children:[Oe(),e.jsx("thead",{className:"ui-table__thead",children:e.jsx("tr",{ref:O,className:"ui-table__tr",children:U.map((_,E)=>{const K=!!_.sortable&&!!D,se=ee?.sort_by===_.key;return e.jsx("th",{scope:"col","aria-label":_.ariaLabel,"aria-sort":se?ee?.sort_order==="ASC"?"ascending":"descending":K?"none":void 0,className:Cn(Me[E],K,se),style:Te[E],tabIndex:K?0:void 0,"aria-haspopup":V.enabled?"menu":void 0,onClick:K?()=>M(_):void 0,onKeyDown:Le=>{K&&T(Le,_),V.enabled&&Nn(Le,_)},children:e.jsxs("span",{className:"ui-table__th-inner",children:[V.enabled&&_.align==="center"&&e.jsx("span",{className:"ui-table__th-menu-spacer","aria-hidden":"true"}),e.jsxs("span",{className:"ui-table__th-content",children:[e.jsx("span",{className:"ui-table__th-label",children:_.label}),tn(_)]}),V.enabled&&e.jsx(Ie,{sx:"ui-table__th-menu-btn",icon:e.jsx(Ua,{}),size:"small",variant:"ghost",color:"neutral","aria-label":"Column options","aria-haspopup":"menu","aria-expanded":Re?.colKey===_.key,onClick:Le=>pt(Le,_)})]})},_.key)})})}),e.jsx("tbody",{className:"ui-table__tbody",children:s?e.jsx("tr",{className:"ui-table__tr ui-table__tr--state",children:e.jsx("td",{ref:Ae,className:"ui-table__td ui-table__td--state",colSpan:ce,children:e.jsx("div",{className:"ui-table__state-content",children:Z})})}):n.length===0?e.jsx("tr",{className:"ui-table__tr ui-table__tr--state",children:e.jsx("td",{ref:Ae,className:"ui-table__td ui-table__td--state",colSpan:ce,children:e.jsx("div",{className:"ui-table__state-content",children:ke})})}):n.map((_,E)=>e.jsx(xi,{row:_,rowIndex:E,visibleCols:U,tdClasses:Se,stickyStyles:Te,onRowClick:ae,onKeyDown:ae?pe:void 0},F(_,E)))})]})}),B&&!s&&e.jsx("div",{className:"ui-table__footer",style:Ht,children:B}),A&&e.jsx("div",{ref:le,className:"ui-table__overlay-header","aria-hidden":"true",style:{display:"none",position:"fixed",top:oe,left:0,width:0,overflowX:Ke?"auto":"hidden",overflowY:"hidden",zIndex:40},children:e.jsxs("table",{ref:ge,className:"ui-table__table",style:{minWidth:Rt,width:Qe||void 0,tableLayout:"fixed"},role:"presentation",children:[e.jsx("colgroup",{children:U.map((_,E)=>e.jsx("col",{ref:K=>{je.current[E]=K},style:_.width!==void 0?{width:mn(_.width)}:void 0},_.key))}),e.jsx("thead",{className:"ui-table__thead",children:e.jsx("tr",{className:"ui-table__tr",children:U.map((_,E)=>{const K=!!_.sortable&&!!D,se=ee?.sort_by===_.key;return e.jsx("th",{scope:"col",className:Cn(Me[E],K,se),style:Te[E],onClick:K?()=>M(_):void 0,children:e.jsxs("span",{className:"ui-table__th-inner",children:[V.enabled&&_.align==="center"&&e.jsx("span",{className:"ui-table__th-menu-spacer","aria-hidden":"true"}),e.jsxs("span",{className:"ui-table__th-content",children:[e.jsx("span",{className:"ui-table__th-label",children:_.label}),tn(_)]}),V.enabled&&e.jsx(Ie,{sx:"ui-table__th-menu-btn",icon:e.jsx(Ua,{}),size:"small",variant:"ghost",color:"neutral","aria-label":"Column options","aria-haspopup":"menu",onClick:Le=>pt(Le,_)})]})},_.key)})})})]})}),V.enabled&&Re&&(()=>{const _=Re.colKey,E=_e.has(_),K=C.has(_),se=ze.has(_),Le=[];return V.pin&&(E?Le.push({key:"unpin",label:Ue.unpin,onSelect:()=>yt(_),disabled:K}):Le.push({key:"pin",label:Ue.pin,onSelect:()=>Ye(_)})),V.hide&&Le.push({key:"hide",label:Ue.hide,onSelect:()=>Pt(_),disabled:se||U.length<=1}),V.manage&&Le.push({key:"manage",label:Ue.manage,onSelect:()=>{tt(null),et({x:Re.x,anchorTop:Re.anchorTop,anchorBottom:Re.anchorBottom,boundsRect:Re.boundsRect})}}),Le.length===0?null:e.jsx(vi,{x:Re.x,anchorTop:Re.anchorTop,anchorBottom:Re.anchorBottom,items:Le,onClose:at,portalNode:xt,boundsRect:Re.boundsRect})})(),V.enabled&&V.manage&&Fe&&e.jsx(ji,{x:Fe.x,anchorTop:Fe.anchorTop,anchorBottom:Fe.anchorBottom,columns:z,pinnedKeys:Ce,hiddenKeys:Jt,visibleCount:U.length,canPin:V.pin,canHide:V.hide,canReorder:V.reorder,onTogglePin:Zt,onToggleHide:bn,onUnpinAll:gn,onShowAll:xn,onReset:jn,onReorder:yn,hasUnpinnablePinned:wn,hasHiddenColumns:vn>0,labels:kn,onClose:Gt,portalNode:xt,boundsRect:Fe.boundsRect})]})}ms.displayName="Table";const fa=({open:t,title:n,message:s,confirmLabel:a="Confirm",cancelLabel:r="Cancel",confirmColor:i="primary",onConfirm:o,onCancel:c,hideCancel:d=!1,closeOnBackdropClick:u=!0,closeOnEscape:p=!0,returnFocusOnClose:f=!1})=>e.jsx(ea,{open:t,onClose:c,size:"small",closeOnBackdropClick:u,closeOnEscape:p,returnFocusOnClose:f,children:e.jsxs("div",{className:"ui-confirm",children:[n&&e.jsx("h2",{className:"ui-confirm__title",children:n}),s&&e.jsx("div",{className:"ui-confirm__message",children:s}),e.jsxs("div",{className:"ui-confirm__actions",children:[!d&&e.jsx(Xe,{variant:"outlined",color:"neutral",onClick:c,children:r}),e.jsx(Xe,{variant:"filled",color:i,onClick:o,autoFocus:!0,children:a})]})]})});fa.displayName="ConfirmDialog";const fs=l.createContext(null),_s=({children:t})=>{const[n,s]=l.useState(null),a=l.useRef(null);a.current=n;const r=l.useCallback(c=>new Promise(d=>{const u=a.current;u&&u.resolve(!1),s({...c,resolve:d})}),[]),i=l.useCallback(c=>{const d=a.current;d&&(d.resolve(c),s(null))},[]),o=l.useMemo(()=>({confirm:r}),[r]);return e.jsxs(fs.Provider,{value:o,children:[t,e.jsx(fa,{open:n!==null,title:n?.title,message:n?.message,confirmLabel:n?.confirmLabel,cancelLabel:n?.cancelLabel,confirmColor:n?.confirmColor,hideCancel:n?.hideCancel,closeOnBackdropClick:n?.closeOnBackdropClick,closeOnEscape:n?.closeOnEscape,onConfirm:()=>i(!0),onCancel:()=>i(!1)})]})};_s.displayName="ConfirmProvider";const Mi=()=>{const t=l.useContext(fs);if(!t)throw new Error("useConfirm must be used within a <ConfirmProvider>");return t},gs=({checked:t,defaultChecked:n,onChange:s,label:a,labelPosition:r="end",color:i="primary",size:o="medium",isDisabled:c=!1,name:d,value:u,id:p,sx:f,style:h})=>{const m=l.useId(),x=p??m,v=["ui-toggle",`ui-toggle--${i}`,`ui-toggle--${o}`,`ui-toggle--label-${r}`,c&&"ui-toggle--disabled",f].filter(Boolean).join(" "),g=y=>{c||s?.(y.target.checked,y)};return e.jsxs("label",{className:v,style:h,htmlFor:x,children:[a!=null&&r==="start"&&e.jsx("span",{className:"ui-toggle__label",children:a}),e.jsxs("span",{className:"ui-toggle__switch",children:[e.jsx("input",{id:x,type:"checkbox",className:"ui-toggle__input",role:"switch",checked:t,defaultChecked:n,disabled:c,name:d,value:u,onChange:g}),e.jsx("span",{className:"ui-toggle__track","aria-hidden":"true",children:e.jsx("span",{className:"ui-toggle__thumb"})})]}),a!=null&&r==="end"&&e.jsx("span",{className:"ui-toggle__label",children:a})]})};gs.displayName="Toggle";const xs=l.createContext(null),_a=t=>{const n=l.useContext(xs);if(!n)throw new Error(`<${t}> must be rendered inside <Tabs>`);return n},vs=({value:t,defaultValue:n,onChange:s,variant:a="underline",size:r="medium",color:i="primary",isDisabled:o=!1,children:c,sx:d,style:u})=>{const f=`ui-tabs-${l.useId().replace(/:/g,"")}`,[h,m]=l.useState(n??""),x=t!==void 0,v=x?t:h,g=l.useRef(new Map),y=l.useCallback(H=>{x||m(H),s?.(H)},[x,s]),S=l.useCallback((H,J)=>{J&&g.current.set(H,J)},[]),k=l.useCallback(H=>{g.current.delete(H)},[]),L=l.useMemo(()=>({value:v,setValue:y,baseId:f,registerTab:S,unregisterTab:k,variant:a,size:r,color:i,isDisabled:o}),[v,y,f,S,k,a,r,i,o]),$=["ui-tabs",`ui-tabs--${a}`,`ui-tabs--${r}`,d].filter(Boolean).join(" ");return e.jsx(xs.Provider,{value:L,children:e.jsx("div",{className:$,style:u,children:c})})};vs.displayName="Tabs";const bs=({"aria-label":t,"aria-labelledby":n,children:s,sx:a,style:r})=>{const{variant:i,size:o,color:c}=_a("TabList"),d=l.useMemo(()=>{const p=[];return l.Children.forEach(s,f=>{l.isValidElement(f)&&f.type===ga&&p.push(f.props.value)}),p},[s]),u=["ui-tabs__list",`ui-tabs__list--${i}`,`ui-tabs__list--${o}`,`ui-tabs__list--${c}`,a].filter(Boolean).join(" ");return e.jsx("div",{role:"tablist","aria-label":t,"aria-labelledby":n,className:u,style:r,"data-tab-order":d.join(","),children:s})};bs.displayName="TabList";const ga=({value:t,isDisabled:n=!1,icon:s,badge:a,children:r,sx:i,style:o})=>{const c=_a("Tab"),d=l.useRef(null),u=l.useCallback(g=>{d.current=g,c.registerTab(t,g)},[c,t]);l.useEffect(()=>()=>c.unregisterTab(t),[c,t]);const p=c.value===t,f=c.isDisabled||n,h=()=>{f||c.setValue(t)},m=g=>{const y=d.current?.parentElement;if(!y)return;const S=(y.dataset.tabOrder??"").split(",").filter(Boolean);if(S.length===0)return;const k=S.filter(J=>{const ee=y.querySelector(`[data-tab-value="${J}"]`);return ee&&!ee.disabled});if(k.length===0)return;let L;const $=k.indexOf(t);switch(g){case"first":L=k[0];break;case"last":L=k[k.length-1];break;case"next":L=k[($+1)%k.length];break;case"prev":L=k[($-1+k.length)%k.length];break}y.querySelector(`[data-tab-value="${L}"]`)?.focus(),c.setValue(L)},x=g=>{if(!f)switch(g.key){case"ArrowRight":case"ArrowDown":g.preventDefault(),m("next");break;case"ArrowLeft":case"ArrowUp":g.preventDefault(),m("prev");break;case"Home":g.preventDefault(),m("first");break;case"End":g.preventDefault(),m("last");break}},v=["ui-tabs__tab",`ui-tabs__tab--${c.variant}`,`ui-tabs__tab--${c.size}`,`ui-tabs__tab--${c.color}`,p&&"ui-tabs__tab--active",f&&"ui-tabs__tab--disabled",i].filter(Boolean).join(" ");return e.jsxs("button",{ref:u,type:"button",role:"tab",id:`${c.baseId}-tab-${t}`,"aria-selected":p,"aria-controls":`${c.baseId}-panel-${t}`,"aria-disabled":f||void 0,tabIndex:p?0:-1,disabled:f,"data-tab-value":t,className:v,style:o,onClick:h,onKeyDown:x,children:[s&&e.jsx("span",{className:"ui-tabs__tab-icon","aria-hidden":"true",children:s}),e.jsx("span",{className:"ui-tabs__tab-label",children:r}),a!=null&&e.jsx("span",{className:"ui-tabs__tab-badge",children:a})]})};ga.displayName="Tab";const js=({value:t,keepMounted:n=!1,children:s,sx:a,style:r})=>{const i=_a("TabPanel"),o=i.value===t;if(!o&&!n)return null;const c=["ui-tabs__panel",a].filter(Boolean).join(" ");return e.jsx("div",{role:"tabpanel",id:`${i.baseId}-panel-${t}`,"aria-labelledby":`${i.baseId}-tab-${t}`,tabIndex:0,hidden:!o,className:c,style:r,children:s})};js.displayName="TabPanel";const Si=t=>{const n=t.trim().split(/\s+/).filter(Boolean);return n.length===0?"":n.length===1?n[0].slice(0,2).toUpperCase():(n[0][0]+n[n.length-1][0]).toUpperCase()},Kt=({name:t="",src:n,alt:s,size:a="medium",shape:r="circle",color:i="neutral",fallback:o,crossOrigin:c,referrerPolicy:d,loading:u,sx:p,style:f})=>{const[h,m]=l.useState(!1);l.useEffect(()=>{m(!1)},[n]);const x=!!n&&!h,v=Si(t),g=!!(f?.background||f?.backgroundColor),y=["ui-avatar",`ui-avatar--${a}`,`ui-avatar--${r}`,!x&&!g&&`ui-avatar--${i}`,p].filter(Boolean).join(" "),S=()=>v?e.jsx("span",{className:"ui-avatar__initials","aria-hidden":"true",children:v}):o!=null?e.jsx("span",{className:"ui-avatar__fallback","aria-hidden":"true",children:o}):e.jsx("span",{className:"ui-avatar__initials","aria-hidden":"true",children:"?"});return e.jsx("span",{className:y,style:f,role:"img","aria-label":s??t??"avatar",children:x?e.jsx("img",{className:"ui-avatar__image",src:n,alt:s??t,crossOrigin:c,referrerPolicy:d,loading:u,onError:()=>m(!0)}):S()})};Kt.displayName="Avatar";const Di={small:-4,medium:-8},xa=({children:t,max:n=5,total:s,spacing:a="medium",size:r,shape:i,surplusColor:o="neutral",renderSurplus:c,sx:d,style:u})=>{const p=l.Children.toArray(t),f=s??p.length,h=f>n,m=h?Math.max(0,n-1):Math.min(p.length,n),x=p.slice(0,m),v=h?f-m:0,g=typeof a=="number"?a:Di[a],y=["ui-avatar-group",d].filter(Boolean).join(" "),S=(k,L,$)=>{const H={marginLeft:$};if(l.isValidElement(k)&&k.type===Kt){const J={};return r&&!k.props.size&&(J.size=r),i&&!k.props.shape&&(J.shape=i),e.jsx("span",{className:"ui-avatar-group__item",style:H,children:l.cloneElement(k,J)},L)}return e.jsx("span",{className:"ui-avatar-group__item",style:H,children:k},L)};return e.jsxs("div",{className:y,style:u,children:[x.map((k,L)=>S(k,L,L===0?0:g)),v>0&&e.jsx("span",{className:"ui-avatar-group__item ui-avatar-group__item--surplus",style:{marginLeft:g},children:c?c(v):e.jsx(Kt,{size:r,shape:i,color:o,fallback:e.jsxs("span",{className:"ui-avatar-group__surplus-text",children:["+",v]})})},"surplus")]})};xa.displayName="AvatarGroup";const Ei={success:e.jsx(wr,{}),error:e.jsx($r,{}),warning:e.jsx(Tr,{}),info:e.jsx(Cr,{})},va=({type:t="info",message:n,title:s,icon:a,onClose:r,duration:i,sx:o,style:c})=>{const d=typeof i=="number"&&i>0,u=["ui-toast",`ui-toast--${t}`,o].filter(Boolean).join(" ");return e.jsxs("div",{className:u,style:c,role:t==="error"||t==="warning"?"alert":"status","aria-live":t==="error"||t==="warning"?"assertive":"polite",children:[e.jsx("span",{className:"ui-toast__icon","aria-hidden":"true",children:a??Ei[t]}),e.jsxs("div",{className:"ui-toast__body",children:[s&&e.jsx("div",{className:"ui-toast__title",children:s}),e.jsx("div",{className:"ui-toast__message",children:n})]}),r&&e.jsx(Ie,{icon:e.jsx(bt,{}),onClick:r,"aria-label":"Dismiss notification",variant:"ghost",color:"neutral",size:"small",sx:"ui-toast__close"}),d&&e.jsx("span",{className:"ui-toast__progress","aria-hidden":"true",style:{animationDuration:`${i}ms`}})]})};va.displayName="Toast";const ys=l.createContext(null),ks=({children:t,position:n="top-right",defaultDuration:s=5e3,portalContainerId:a})=>{const[r,i]=l.useState([]),o=l.useRef(new Map),c=l.useCallback(h=>{const m=o.current.get(h);m&&(clearTimeout(m),o.current.delete(h))},[]),d=l.useCallback(h=>{c(h),i(m=>m.filter(x=>x.id!==h))},[c]),u=l.useCallback(()=>{o.current.forEach(h=>clearTimeout(h)),o.current.clear(),i([])},[]),p=l.useCallback(h=>{const m=`toast-${Date.now()}-${Math.random().toString(36).slice(2,8)}`,x=h.duration??s;if(i(v=>[...v,{...h,id:m,duration:x}]),x>0){const v=setTimeout(()=>d(m),x);o.current.set(m,v)}return m},[s,d]);l.useEffect(()=>{const h=o.current;return()=>{h.forEach(m=>clearTimeout(m)),h.clear()}},[]);const f=l.useMemo(()=>({showToast:p,dismissToast:d,dismissAll:u}),[p,d,u]);return e.jsxs(ys.Provider,{value:f,children:[t,e.jsx(cn,{containerId:a,children:e.jsx("div",{className:`ui-toast-container ui-toast-container--${n}`,children:r.map(h=>e.jsx(va,{type:h.type,title:h.title,message:h.message,icon:h.icon,duration:h.duration,onClose:()=>d(h.id)},h.id))})})]})};ks.displayName="ToastProvider";const $i=()=>{const t=l.useContext(ys);if(!t)throw new Error("useToast must be used within a <ToastProvider>");return t},ws=({size:t="medium",color:n="primary",variant:s="inline",label:a="Loading",sx:r,style:i})=>{const o=["ui-spinner",`ui-spinner--${t}`,n!=="inherit"&&`ui-spinner--${n}`,r].filter(Boolean).join(" "),c=e.jsx("span",{className:o,style:i,role:"status","aria-label":a,children:e.jsx("span",{className:"ui-spinner__visually-hidden",children:a})});return s==="page"?e.jsx(cn,{children:e.jsx("div",{className:"ui-spinner-overlay",children:e.jsx("span",{className:["ui-spinner","ui-spinner--large",n!=="inherit"&&`ui-spinner--${n}`].filter(Boolean).join(" "),role:"status","aria-label":a,children:e.jsx("span",{className:"ui-spinner__visually-hidden",children:a})})})}):c};ws.displayName="Spinner";function Ti(t,n,s){if(n<=1)return n===1?[1]:[];const a=Math.max(2,t-s),r=Math.min(n-1,t+s),i=t-s>3,o=t+s<n-2,c=[1];if(i)c.push("ellipsis-left");else for(let d=2;d<a;d++)c.push(d);for(let d=a;d<=r;d++)c.push(d);if(o)c.push("ellipsis-right");else for(let d=r+1;d<n;d++)c.push(d);return c.push(n),c}const Ns=({currentPage:t,totalPages:n,totalItems:s,itemsPerPage:a,onPageChange:r,hasFirstLast:i=!0,hasGoToPage:o=!1,showResults:c="none",showOnSinglePage:d=!1,perPageOptions:u,perPage:p,onPerPageChange:f,siblingCount:h=1,size:m="medium",sx:x,style:v})=>{const g=!!u&&!!f&&p!==void 0,y=l.useMemo(()=>u?.map(B=>({value:String(B.value),label:B.label}))??[],[u]),S=c!=="none"&&s!==void 0,k=n>1;if(!k&&(!d||s===0))return null;const $=k?Ti(t,n,h):[],H=t<=1,J=t>=n,ee=B=>{B<1||B>n||B===t||r(B)},D=["ui-pagination",`ui-pagination--${m}`,x].filter(Boolean).join(" ");return e.jsxs("div",{className:D,style:v,role:"navigation","aria-label":"Pagination",children:[e.jsx("div",{className:"ui-pagination__group ui-pagination__group--start",children:S&&e.jsx(Li,{mode:c,currentPage:t,totalItems:s,itemsPerPage:a})}),e.jsxs("div",{className:"ui-pagination__group ui-pagination__group--end",children:[g&&e.jsxs("label",{className:"ui-pagination__per-page",children:[e.jsx("span",{className:"ui-pagination__per-page-label",children:"Per page"}),e.jsx($n,{size:"small",value:String(p),options:y,onChange:B=>{typeof B=="string"&&f(Number(B))},"aria-label":`Items per page: ${p}`})]}),k&&o&&e.jsx(Ai,{totalPages:n,onGo:ee}),k&&e.jsxs(e.Fragment,{children:[e.jsxs("span",{className:"ui-pagination__compact-status","aria-hidden":"true",children:["Page ",e.jsx("strong",{children:t})," of ",n]}),e.jsxs("div",{className:"ui-pagination__pages",children:[i&&e.jsx("button",{type:"button",className:"ui-pagination__btn ui-pagination__btn--icon",onClick:()=>ee(1),disabled:H,"aria-label":"First page",children:e.jsx(Wr,{})}),e.jsx("button",{type:"button",className:"ui-pagination__btn ui-pagination__btn--icon",onClick:()=>ee(t-1),disabled:H,"aria-label":"Previous page",children:e.jsx(In,{})}),$.map(B=>B==="ellipsis-left"||B==="ellipsis-right"?e.jsx("span",{className:"ui-pagination__ellipsis","aria-hidden":"true",children:"…"},B):e.jsx("button",{type:"button",className:["ui-pagination__btn","ui-pagination__btn--num",B===t&&"ui-pagination__btn--active"].filter(Boolean).join(" "),onClick:()=>ee(B),"aria-current":B===t?"page":void 0,"aria-label":`Page ${B}`,children:B},B)),e.jsx("button",{type:"button",className:"ui-pagination__btn ui-pagination__btn--icon",onClick:()=>ee(t+1),disabled:J,"aria-label":"Next page",children:e.jsx(Pn,{})}),i&&e.jsx("button",{type:"button",className:"ui-pagination__btn ui-pagination__btn--icon",onClick:()=>ee(n),disabled:J,"aria-label":"Last page",children:e.jsx(Kr,{})})]})]})]})]})};Ns.displayName="Pagination";const Li=({mode:t,currentPage:n,totalItems:s,itemsPerPage:a})=>{if(t==="none"||s===void 0)return null;if(t==="total")return e.jsxs("span",{className:"ui-pagination__summary",children:[e.jsx("strong",{children:s})," ",s===1?"result":"results"]});const r=a??s,i=s===0?0:(n-1)*r+1,o=Math.min(n*r,s);return e.jsxs("span",{className:"ui-pagination__summary",children:["Showing ",e.jsx("strong",{children:i}),"–",e.jsx("strong",{children:o})," of ",e.jsx("strong",{children:s})]})},Ai=({totalPages:t,onGo:n})=>{const[s,a]=l.useState(""),r=l.useRef(null),i=()=>{const d=Number(s);if(!Number.isFinite(d)||d<1||d>t){a("");return}n(Math.floor(d)),a(""),r.current?.blur()},o=d=>{const u=Number(s)||0,p=Math.min(t,Math.max(1,u+d));a(String(p))},c=e.jsxs("span",{className:"ui-pagination__goto-spinner","aria-hidden":"true",children:[e.jsx("button",{type:"button",tabIndex:-1,className:"ui-pagination__goto-spinner-btn",onMouseDown:d=>{d.preventDefault(),o(1)},children:e.jsx(Hr,{})}),e.jsx("button",{type:"button",tabIndex:-1,className:"ui-pagination__goto-spinner-btn",onMouseDown:d=>{d.preventDefault(),o(-1)},children:e.jsx(zr,{})})]});return e.jsxs("label",{className:"ui-pagination__goto",children:[e.jsx("span",{className:"ui-pagination__goto-label",children:"Go to"}),e.jsx(Ot,{ref:r,type:"number",size:"small",min:1,max:t,step:1,value:s,onChange:d=>a(d.target.value),onKeyDown:d=>{d.key==="Enter"&&(d.preventDefault(),i())},onBlur:i,"aria-label":`Go to page (1–${t})`,endAdornment:c,sx:{root:"ui-pagination__goto-field",input:"ui-pagination__goto-input"}})]})},On=4,Fn=3,Cs=20;function Ii(t){return t.find(s=>s.iso2==="gb"||s.iso2==="en"||s.name.toLowerCase()==="english")??t[0]??null}function Ms(t,n){return t.icon?t.icon:`https://flagcdn.com/${n}/${t.iso2}.png`}const Ss=({page:t,totalPages:n,onPrev:s,onNext:a})=>{const r=o=>c=>{c.stopPropagation(),c.preventDefault(),o()},i=o=>{o.stopPropagation(),o.preventDefault()};return e.jsxs("div",{className:"ui-employee-card__carousel-nav",onClick:i,children:[e.jsx(Ie,{icon:e.jsx(In,{size:14}),size:"small",variant:"ghost",color:"neutral",sx:"ui-employee-card__carousel-btn",onClick:r(s),disabled:t===0,"aria-label":"Previous"}),e.jsx(Ie,{icon:e.jsx(Pn,{size:14}),size:"small",variant:"ghost",color:"neutral",sx:"ui-employee-card__carousel-btn",onClick:r(a),disabled:t>=n-1,"aria-label":"Next"})]})},Ds=({employee:t,profileUrl:n,onClick:s,talkMode:a,selectedToolIds:r,onToolToggle:i,isInCart:o,onCartToggle:c,selectedTierValue:d,onTierChange:u,share:p,onShare:f,sx:h})=>{const[m,x]=l.useState(!1),[v,g]=l.useState(0),[y,S]=l.useState(0),[k,L]=l.useState(!1),$=parseFloat(t.rate?.value??"0"),H=N=>parseFloat(N)<=$,J=t.pricingTiers?.filter(N=>H(N.value)).sort((N,de)=>parseFloat(de.value)-parseFloat(N.value))[0]?.value??t.pricingTiers?.[0]?.value??null,[ee,D]=l.useState(()=>J),B=d??ee,ae=t.pricingTiers?.find(N=>N.value===B)??null,F=N=>{u?u(N):D(N)},[ve,me]=l.useState(""),Q=l.useRef(null),oe=l.useRef(null),ye=t.shortName||"Unknown",ke=t.department?.color||"#9e9e9e",Z=t.currency||"$",G=N=>{const de=parseFloat(N||"0");return de?`${Z}${de}/hour`:"—"},b=N=>t.prices_discounted?.find(de=>de.value===N)?.price,A=b(B??"")??ae?.price,I=A?G(A):"—",W=t.tools||[],V=Math.ceil(W.length/On)||1,be=v*On,w=W.slice(be,be+On),R=Math.ceil(W.length/Fn)||1,re=y*Fn,ue=W.slice(re,re+Fn),P=t.languages||[],ie=Ii(P),$e=a?a.isConnected||a.isConnecting:!1;l.useEffect(()=>{$e||me("")},[$e]),l.useEffect(()=>{oe.current&&(oe.current.scrollTop=oe.current.scrollHeight)},[a?.messages]);const Pe=["ui-employee-card",m&&"ui-employee-card--flipped",t.is_pinned&&"ui-employee-card--hot",$e&&"ui-employee-card--talk-active",h?.root].filter(Boolean).join(" "),he=`ui-employee-card__header ${h?.header||""}`.trim(),Ce=`ui-employee-card__content ${h?.content||""}`.trim(),_e={"--department-color":ke},ze=N=>{if(N.target.closest('button, input, [role="button"], .ui-icon-button-wrapper, .ui-dropdown, .ui-employee-card__content--talk')){N.preventDefault();return}s&&(N.preventDefault(),s())},C=N=>{N.stopPropagation(),N.preventDefault(),x(de=>!de)},q=(N,de)=>{N.stopPropagation(),N.preventDefault(),i?.(de)},ne=N=>{N.stopPropagation(),N.preventDefault(),c?.()},j=N=>{N.stopPropagation(),N.preventDefault(),n&&navigator.share?navigator.share({title:t.profession??t.shortName??void 0,text:`${t.shortName} — ${t.profession??"AnyEmp profile"}`,url:n}).then(()=>f?.()).catch(()=>{}):n?navigator.clipboard.writeText(n).then(()=>{L(!0),Q.current&&clearTimeout(Q.current),Q.current=setTimeout(()=>L(!1),1500),f?.()}):f?.()},z=!a?.isMicMuted,U=()=>{!ve.trim()||!a?.onSendMessage||(a.onSendMessage(ve.trim()),me(""))},X=n?"a":"article",we=n?{href:n,onClick:ze}:{onClick:ze,role:s?"button":void 0,tabIndex:s?0:void 0};return e.jsxs("div",{className:Pe,style:{"--department-color":ke},children:[e.jsxs("div",{className:"ui-employee-card__card-side",children:[e.jsxs("div",{className:"ui-employee-card__inner",children:[e.jsxs(X,{...we,className:"ui-employee-card__front",children:[e.jsx("div",{className:"ui-employee-card__header-section"}),e.jsxs("div",{className:he,style:_e,children:[e.jsxs("div",{className:"ui-employee-card__avatar-wrapper",children:[e.jsx("div",{className:"ui-employee-card__avatar-gradient"}),t.avatarUrl?e.jsx("img",{src:t.avatarUrl,alt:`${ye} avatar`,className:"ui-employee-card__avatar"}):e.jsx("div",{className:"ui-employee-card__avatar ui-employee-card__avatar--placeholder",children:e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2"}),e.jsx("circle",{cx:"12",cy:"7",r:"4"})]})})]}),e.jsx("div",{className:"ui-employee-card__header-info",children:e.jsxs("div",{className:"ui-employee-card__header-text",children:[t.profession&&e.jsx("h3",{className:"ui-employee-card__profession",children:t.profession}),e.jsx("p",{className:"ui-employee-card__name",children:ye})]})}),e.jsx("div",{className:"ui-employee-card__id-badge-wrapper",children:e.jsxs("div",{className:"ui-employee-card__id-badge",children:[e.jsx("span",{className:"ui-employee-card__id-label",children:"ID:"}),e.jsx("span",{className:"ui-employee-card__id-value",children:t.talentId})]})})]}),e.jsxs("div",{className:"ui-employee-card__body-section",children:[e.jsxs("div",{className:`${Ce} ui-employee-card__content--normal ${$e?"ui-employee-card__content--hidden":""}`,children:[t.summary&&e.jsx("div",{style:{marginBottom:"1rem"},children:e.jsx("p",{className:"ui-employee-card__summary",children:t.summary})}),W.length>0&&e.jsxs("div",{className:"ui-employee-card__skills-section",children:[e.jsxs("div",{className:"ui-employee-card__carousel-header",children:[e.jsx("h4",{className:"ui-employee-card__section-title",children:"Tools"}),W.length>On&&e.jsx(Ss,{page:v,totalPages:V,onPrev:()=>g(N=>Math.max(0,N-1)),onNext:()=>g(N=>Math.min(V-1,N+1))})]}),e.jsx("div",{className:"ui-employee-card__tools",children:w.map(N=>{const fe=["ui-employee-card__tool",(r?.includes(N.id)??!1)&&"ui-employee-card__tool--selected"].filter(Boolean).join(" ");return e.jsx(Je,{title:N.name,placement:"top",children:e.jsx("div",{className:fe,onClick:i?De=>q(De,N.id):void 0,children:N.icon?e.jsx("img",{src:N.icon,alt:N.name,className:"ui-employee-card__tool-icon"}):e.jsx("span",{className:"ui-employee-card__tool-placeholder",children:N.name.charAt(0).toUpperCase()})})},N.id)})})]}),a&&e.jsx("div",{className:"ui-employee-card__audio-section",children:e.jsxs("div",{className:"ui-employee-card__audio-controls",role:"button",tabIndex:a.isConnecting?-1:0,onClick:N=>{N.stopPropagation(),N.preventDefault(),a.isConnecting||a.onStart()},children:[e.jsx("div",{className:"ui-employee-card__audio-mic-circle",children:e.jsx(Ka,{})}),e.jsx("div",{className:"ui-employee-card__audio-wave",children:[...Array(5)].map((N,de)=>e.jsx("div",{className:"ui-employee-card__audio-wave-bar"},de))}),e.jsxs("div",{className:"ui-employee-card__audio-text",children:[e.jsx("span",{className:"ui-employee-card__audio-label",children:"Talk with AI Employee"}),t.slogan&&e.jsx("span",{className:"ui-employee-card__audio-slogan",children:t.slogan})]})]})})]}),a&&e.jsx("div",{className:`${Ce} ui-employee-card__content--talk ${$e?"":"ui-employee-card__content--hidden"}`,children:e.jsx("div",{className:"ui-employee-card__talk-view",children:t.pricingTiers&&t.pricingTiers.length>0&&t.rate?(()=>{const N=b(B??""),de=parseFloat((N??ae?.price)||"0"),fe=de&&ae?`${Z}${(de*ae.hours*Cs).toLocaleString()}/mo`:"—",De=Ne=>{const O=parseFloat(Ne);return O>=1?"var(--palette-primary-main)":O>=.5?"var(--palette-warning-main)":"var(--palette-text-primary)"};return e.jsxs("div",{className:"ui-employee-card__cpv",children:[e.jsx("span",{className:"ui-employee-card__cpv-label",children:"Pricing"}),e.jsx("div",{className:"ui-employee-card__cpv-tiers",children:t.pricingTiers.map(Ne=>{const O=b(Ne.value),le=parseFloat((O??Ne.price)||"0"),ge=O?parseFloat(Ne.price||"0"):null,je=le?`${Z}${(le*Ne.hours*Cs).toLocaleString()}/mo`:"—",Ae=le?`${Z}${le}/h`:"—",We=H(Ne.value),Ke=["ui-employee-card__cpv-tier",We&&Ne.value===B&&"ui-employee-card__cpv-tier--selected",!We&&"ui-employee-card__cpv-tier--disabled",We&&c&&"ui-employee-card__cpv-tier--clickable"].filter(Boolean).join(" ");return e.jsxs("div",{className:Ke,style:{"--tc":De(Ne.value)},onClick:We&&c?ct=>{ct.stopPropagation(),ct.preventDefault(),F(Ne.value)}:void 0,children:[e.jsxs("div",{className:"ui-employee-card__cpv-tier-left",children:[e.jsx("span",{className:"ui-employee-card__cpv-tier-label",children:Ne.name}),e.jsxs("span",{className:"ui-employee-card__cpv-tier-hours",children:[Ne.hours," h/day"]})]}),e.jsxs("div",{className:"ui-employee-card__cpv-tier-right",children:[ge&&e.jsxs("span",{className:"ui-employee-card__cpv-tier-rate ui-employee-card__cpv-tier-rate--original",children:[Z,ge,"/h"]}),e.jsx("span",{className:"ui-employee-card__cpv-tier-rate",children:Ae}),e.jsx("span",{className:"ui-employee-card__cpv-tier-monthly",children:je})]})]},Ne.value)})}),e.jsxs("div",{className:"ui-employee-card__cpv-summary",children:[e.jsx("span",{className:"ui-employee-card__cpv-summary-label",children:"In Total"}),e.jsxs("span",{className:"ui-employee-card__cpv-summary-value",children:[t.rate?.name," · ",fe]})]})]})})():null})})]}),t.pricingTiers&&t.pricingTiers.length>0&&t.rate&&e.jsx(Jn,{placement:"bottom-end",variant:"info",divider:!0,sx:{root:"ui-employee-card__price-dropdown"},trigger:e.jsxs(Xe,{variant:"outlined",color:"neutral",size:"small",sx:"ui-employee-card__price-trigger rounded-full",children:[e.jsx("span",{children:I}),t.discount&&e.jsxs("span",{className:"ui-employee-card__discount-badge",children:["-",parseFloat(t.discount).toFixed(0),"%"]}),e.jsx("svg",{className:"ui-dropdown__arrow",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("polyline",{points:"6 9 12 15 18 9"})})]}),children:t.pricingTiers.map(N=>{const de=b(N.value);return e.jsxs(Xn,{sx:"ui-employee-card__price-item",disabled:!H(N.value),children:[e.jsx("span",{className:"ui-employee-card__price-label",children:N.name}),de?e.jsxs("span",{className:"ui-employee-card__price-value-group",children:[e.jsx("span",{className:"ui-employee-card__price-value ui-employee-card__price-value--original",children:G(N.price)}),e.jsx("span",{className:"ui-employee-card__price-value ui-employee-card__price-value--discounted",children:G(de)})]}):e.jsx("span",{className:"ui-employee-card__price-value",children:G(N.price)})]},N.value)})}),e.jsxs("div",{className:"ui-employee-card__avatar-actions",children:[ie&&e.jsx(Je,{placement:"right",title:e.jsxs("span",{className:"ui-employee-card__lang-tooltip-item",children:[e.jsx("span",{children:ie.name}),e.jsx("span",{className:"ui-employee-card__lang-level",children:ie.level})]}),children:e.jsx("div",{className:"ui-employee-card__language-badge",children:e.jsx("img",{src:Ms(ie,"24x18"),alt:ie.name})})}),c&&e.jsx(Ie,{icon:o?e.jsx(Yr,{}):e.jsx(Er,{}),size:"small",variant:"outlined",color:o?"warning":"neutral",sx:"ui-employee-card__action-btn",onClick:ne,"aria-label":o?"Remove from cart":"Add to cart"}),(p||f)&&e.jsxs("div",{className:"ui-employee-card__share-wrapper",children:[e.jsx(Ie,{icon:e.jsx(qa,{}),size:"small",variant:"outlined",color:"neutral",sx:"ui-employee-card__action-btn",onClick:j,"aria-label":"Share profile"}),k&&e.jsx("div",{className:"ui-employee-card__share-copied",children:"Copied!"})]})]})]}),e.jsx("div",{className:"ui-employee-card__back",children:e.jsxs("div",{className:"ui-employee-card__back-content",children:[e.jsx("div",{className:"ui-employee-card__back-header",children:e.jsxs("div",{className:"ui-employee-card__back-header-row",children:[t.profession&&e.jsx("p",{className:"ui-employee-card__back-role",style:{color:ke},children:t.profession}),e.jsxs("span",{className:"ui-employee-card__back-id",children:["ID: ",t.talentId]})]})}),P.length>0&&e.jsx("div",{className:"ui-employee-card__back-section",children:e.jsx("div",{className:"ui-employee-card__back-languages",children:P.map(N=>e.jsx(Je,{title:N.name,placement:"top",children:e.jsxs("div",{className:"ui-employee-card__back-language-item",children:[e.jsxs("div",{className:"ui-employee-card__back-language-left",children:[e.jsx("img",{src:Ms(N,"20x15"),alt:N.name,className:"ui-employee-card__back-language-flag"}),e.jsx("span",{className:"ui-employee-card__back-language-iso",children:N.iso2.toUpperCase()})]}),e.jsx("span",{className:"ui-employee-card__back-language-level",children:N.level})]})},N.name))})}),W.length>0&&e.jsxs("div",{className:"ui-employee-card__back-section ui-employee-card__back-section--tools",children:[e.jsxs("div",{className:"ui-employee-card__carousel-header",children:[e.jsx("h4",{className:"ui-employee-card__back-section-title",children:"I Can Work With"}),W.length>Fn&&e.jsx(Ss,{page:y,totalPages:R,onPrev:()=>S(N=>Math.max(0,N-1)),onNext:()=>S(N=>Math.min(R-1,N+1))})]}),e.jsx("div",{className:"ui-employee-card__back-tools",children:ue.map(N=>e.jsxs("div",{className:"ui-employee-card__back-tool",children:[N.icon?e.jsx("img",{src:N.icon,alt:N.name,className:"ui-employee-card__back-tool-icon"}):e.jsx("span",{className:"ui-employee-card__back-tool-placeholder",children:N.name.charAt(0).toUpperCase()}),e.jsx("span",{className:"ui-employee-card__back-tool-name",children:N.name})]},N.id))})]}),t.tasks&&t.tasks.length>0&&e.jsxs("div",{className:"ui-employee-card__back-section",children:[e.jsx("h4",{className:"ui-employee-card__back-section-title",children:"Recent Tasks"}),e.jsx("div",{className:"ui-employee-card__back-tasks",children:t.tasks.map((N,de)=>e.jsx("div",{className:"ui-employee-card__back-task",children:e.jsx("span",{children:N.text})},N.id??de))})]})]})})]}),e.jsx(Ie,{icon:e.jsx(qr,{}),size:"medium",variant:"ghost",color:"primary",sx:"ui-employee-card__flip-btn",onClick:C,"aria-label":m?"Show front side":"Show back side"})]}),$e&&e.jsx("div",{className:"ui-employee-card__panel-clip",children:e.jsx("div",{className:"ui-employee-card__side-panel",children:a?.chatSlot??e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"ui-employee-card__side-panel-actions",children:[a?.onShareChat&&e.jsx(Ie,{icon:e.jsx(qa,{}),size:"small",variant:"ghost",color:"neutral",sx:"ui-employee-card__side-panel-share",onClick:()=>a.onShareChat(),"aria-label":"Share chat"}),e.jsx(Ie,{icon:e.jsx(bt,{}),size:"small",variant:"ghost",color:"neutral",sx:"ui-employee-card__side-panel-close",onClick:()=>a?.onEnd(),"aria-label":"Close"})]}),e.jsxs("div",{className:"ui-employee-card__panel-voice-bar",children:[e.jsx("div",{className:"ui-employee-card__panel-mic-col",children:e.jsx(Ie,{icon:e.jsx(Ka,{}),size:"medium",variant:"filled",color:z?"error":"primary",sx:`ui-employee-card__panel-mic-btn${z?" active-pulse":""}`,"aria-label":z?"Mute microphone":"Unmute microphone",onClick:a?.onMicToggle})}),e.jsx("div",{className:"ui-employee-card__talk-waveform",children:[...Array(7)].map((N,de)=>e.jsx("div",{className:"ui-employee-card__waveform-bar"},de))})]}),a?.faqChips&&a.faqChips.length>0&&e.jsxs("div",{className:"ui-employee-card__panel-faq",children:[e.jsx("span",{className:"ui-employee-card__panel-faq-label",children:"Quick questions"}),e.jsx("div",{className:"ui-employee-card__panel-faq-chips",children:a.faqChips.map((N,de)=>e.jsx(mt,{label:N,variant:"outlined",color:"neutral",size:"small",onClick:()=>a.onSendMessage?.(N)},de))})]}),e.jsx("div",{className:"ui-employee-card__panel-messages-scroll",ref:oe,children:e.jsx("div",{className:"ui-employee-card__panel-messages",children:(a?.messages??[]).map((N,de)=>e.jsx("div",{className:`ui-employee-card__panel-bubble ui-employee-card__panel-bubble--${N.role}`,children:e.jsx("div",{className:"ui-employee-card__panel-bubble-text",children:N.text})},de))})}),a?.onSendMessage&&e.jsx("div",{className:"ui-employee-card__panel-input-bar",children:e.jsx(Ot,{fullWidth:!0,size:"small",value:ve,onChange:N=>me(N.target.value),onKeyDown:N=>{N.key==="Enter"&&U()},placeholder:"Ask anything...",endAdornment:e.jsx(Ie,{icon:e.jsx(Ar,{}),size:"small",variant:"ghost",color:"primary","aria-label":"Send",onClick:U})})})]})})})]})};Ds.displayName="EmployeeCard";const ba=({src:t="/logo.png",alt:n="Any Employee Logo",text:s="Any Employee",onClick:a,size:r="medium",className:i=""})=>{const o=`ui-anyemp-logo ui-anyemp-logo--${r} ${i}`.trim(),c=d=>{a&&(d.key==="Enter"||d.key===" ")&&(d.preventDefault(),a())};return e.jsxs("div",{className:o,onClick:a,role:a?"button":void 0,tabIndex:a?0:void 0,onKeyDown:c,children:[e.jsx("div",{className:"ui-anyemp-logo__image-wrapper",children:e.jsx("img",{src:t,alt:n,className:"ui-anyemp-logo__image"})}),s&&e.jsx("span",{className:"ui-anyemp-logo__text",children:s})]})};ba.displayName="Logo";const Pi=[{label:"ABOUT US",href:"#about"},{label:"FAQ",href:"#faq"},{label:"REVIEWS",href:"#reviews"},{label:"CONTACT US",href:"#contact"}],Es=({navItems:t=Pi,logoText:n="Any Employee",logoSrc:s,logoAlt:a,onLogoClick:r,sx:i})=>{const o=`ui-anyemp-header ${i?.root||""}`.trim(),c=`ui-anyemp-header__nav ${i?.nav||""}`.trim(),d=`ui-anyemp-header__nav-item ${i?.navItem||""}`.trim(),u=t.slice(0,Math.ceil(t.length/2)),p=t.slice(Math.ceil(t.length/2)),f=(h,m)=>{h.onClick&&(m.preventDefault(),h.onClick())};return e.jsx("header",{className:o,children:e.jsxs("nav",{className:c,children:[e.jsx("div",{className:"ui-anyemp-header__nav-group",children:u.map((h,m)=>e.jsx("a",{href:h.href||"#",className:d,onClick:x=>f(h,x),children:h.label},`left-${m}`))}),e.jsx(ba,{src:s,alt:a,text:n,onClick:r,className:i?.logo}),e.jsx("div",{className:"ui-anyemp-header__nav-group",children:p.map((h,m)=>e.jsx("a",{href:h.href||"#",className:d,onClick:x=>f(h,x),children:h.label},`right-${m}`))})]})})};Es.displayName="Header";function zi(t,n){let s,a,r=-1;const i=o=>{for(const c of o)c.path&&(c.path===n?s=c.id:n.startsWith(c.path==="/"?"/":c.path+"/")&&c.path.length>r&&(a=c.id,r=c.path.length)),c.children&&i(c.children)};return i(t),s??a}const $s=({item:t,isCollapsed:n,isActive:s,isExpanded:a,expandedIds:r,parentItemBehavior:i,depth:o,onToggleExpand:c,onItemClick:d,activeItemId:u,onMouseEnter:p,onMouseLeave:f})=>{const h=!!t.children?.length,m=l.useRef(null),x=l.useRef(null),v=["ui-sidebar__item",s&&"ui-sidebar__item--active",h&&"ui-sidebar__item--has-children",h&&a&&"ui-sidebar__item--open"].filter(Boolean).join(" "),g=D=>{if(t.external)return;const B=D.button===0&&!D.metaKey&&!D.ctrlKey&&!D.shiftKey&&!D.altKey;if(!(t.path&&!B)){if(!h){d&&t.path&&D.preventDefault(),d?.(t);return}if(i==="accordion"){t.path&&D.preventDefault(),c(t.id);return}d&&t.path&&D.preventDefault(),d?.(t)}},y=D=>{!h||i!=="navigate"||(D.key==="ArrowRight"&&!a||D.key==="ArrowLeft"&&a)&&(D.preventDefault(),c(t.id))},S=D=>{D.preventDefault(),D.stopPropagation(),c(t.id)},k=D=>{p?.(t.id,D.currentTarget)},L=e.jsxs(e.Fragment,{children:[t.icon&&e.jsx("span",{className:"ui-sidebar__item-icon",children:t.icon}),e.jsx("span",{className:"ui-sidebar__item-label",children:t.label}),t.badge!==void 0&&e.jsx("span",{className:"ui-sidebar__item-badge",children:t.badge}),h&&(i==="accordion"?e.jsx(Qn,{className:"ui-sidebar__item-chevron","aria-hidden":"true"}):e.jsx("button",{type:"button",className:"ui-sidebar__item-toggle",onClick:S,"aria-label":a?"Collapse section":"Expand section","aria-expanded":a,tabIndex:-1,children:e.jsx(Qn,{className:"ui-sidebar__item-chevron","aria-hidden":"true"})}))]}),$={"--ui-sidebar-depth":o},H=e.jsx("a",{ref:x,href:t.path,className:v,style:$,"aria-current":s?"page":void 0,target:t.external?"_blank":void 0,rel:t.external?"noopener noreferrer":void 0,onClick:g,onKeyDown:y,onMouseEnter:k,onMouseLeave:f,children:L}),J=e.jsx("button",{ref:m,type:"button",className:v,style:$,onClick:g,onKeyDown:y,"aria-expanded":h&&i!=="navigate"?a:void 0,"aria-haspopup":h?!0:void 0,onMouseEnter:k,onMouseLeave:f,children:L}),ee=t.path&&(!h||i!=="accordion")?H:J;return e.jsxs("li",{children:[ee,h&&e.jsx("div",{className:["ui-sidebar__children",a&&"ui-sidebar__children--open"].filter(Boolean).join(" "),children:e.jsx("ul",{role:"list",style:{listStyle:"none",margin:0,padding:0},children:t.children.map(D=>e.jsx($s,{item:D,isCollapsed:n,isActive:D.id===u,isExpanded:r.includes(D.id),expandedIds:r,parentItemBehavior:i,depth:o+1,onToggleExpand:c,onItemClick:d,activeItemId:u},D.id))})})]})},Hi=({user:t,onLogout:n,onLogin:s,theme:a,onThemeToggle:r,isCollapsed:i})=>{const o=a==="dark",[c,d]=l.useState(null),u=l.useRef(null),p=()=>{u.current!==null&&(clearTimeout(u.current),u.current=null)},f=(x,v)=>{if(!i)return;p();const g=x.getBoundingClientRect();d({kind:"label",label:v,top:g.top+g.height/2})},h=x=>{if(!i)return;p();const v=x.getBoundingClientRect();d({kind:"user",top:v.top+v.height/2})},m=()=>{p(),u.current=window.setTimeout(()=>d(null),200)};return l.useEffect(()=>()=>{u.current!==null&&clearTimeout(u.current)},[]),l.useEffect(()=>{i||d(null)},[i]),e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"ui-sidebar__builtin-footer",children:[r&&e.jsxs(Xe,{variant:"ghost",color:"neutral",size:"small",onClick:r,"aria-label":o?"Switch to light mode":"Switch to dark mode",sx:"ui-sidebar__theme-btn",onMouseEnter:x=>f(x.currentTarget,o?"Light mode":"Dark mode"),onMouseLeave:m,children:[e.jsx("span",{className:"ui-sidebar__footer-icon",children:o?e.jsx(Pr,{size:20}):e.jsx(Ir,{size:20})}),e.jsx("span",{className:"ui-sidebar__footer-label",children:o?"Light mode":"Dark mode"})]}),t&&e.jsxs("div",{className:"ui-sidebar__user",onMouseEnter:x=>h(x.currentTarget),onMouseLeave:m,children:[e.jsx(Kt,{name:t.name??t.email??"",src:t.avatar,alt:t.name??"User",size:"small",fallback:e.jsx(Xr,{}),sx:"ui-sidebar__user-avatar",crossOrigin:"anonymous",referrerPolicy:"no-referrer"}),!i&&e.jsxs("div",{className:"ui-sidebar__user-info",children:[t.name&&e.jsx("span",{className:"ui-sidebar__user-name",children:t.name}),t.email&&e.jsx("span",{className:"ui-sidebar__user-email",children:t.email}),t.roles&&t.roles.length>0&&e.jsx("span",{className:"ui-sidebar__user-roles",children:t.roles.join(", ")})]})]}),n&&e.jsxs(Xe,{variant:"ghost",color:"error",size:"small",onClick:n,"aria-label":"Log out",sx:"ui-sidebar__logout-btn",onMouseEnter:x=>f(x.currentTarget,"Log out"),onMouseLeave:m,children:[e.jsx("span",{className:"ui-sidebar__footer-icon",children:e.jsx(Sr,{size:20})}),e.jsx("span",{className:"ui-sidebar__footer-label",children:"Log out"})]}),!t&&s&&e.jsxs(Xe,{variant:"ghost",color:"primary",size:"small",onClick:s,"aria-label":"Log in",sx:"ui-sidebar__login-btn",onMouseEnter:x=>f(x.currentTarget,"Log in"),onMouseLeave:m,children:[e.jsx("span",{className:"ui-sidebar__footer-icon",children:e.jsx(Mr,{size:20})}),e.jsx("span",{className:"ui-sidebar__footer-label",children:"Log in"})]})]}),i&&c&&e.jsx("div",{className:["ui-sidebar__popover",c.kind==="user"?"ui-sidebar__popover--user":"ui-sidebar__popover--label"].join(" "),style:{top:c.top,transform:"translateY(-50%)"},onMouseEnter:p,onMouseLeave:m,children:c.kind==="label"?e.jsx("span",{children:c.label}):e.jsxs(e.Fragment,{children:[t?.name&&e.jsx("span",{className:"ui-sidebar__user-name",children:t.name}),t?.email&&e.jsx("span",{className:"ui-sidebar__user-email",children:t.email}),t?.roles&&t.roles.length>0&&e.jsx("span",{className:"ui-sidebar__user-roles",children:t.roles.join(", ")})]})})]})},Bi=200,Oi=240,ja=({items:t,collapsed:n,defaultCollapsed:s=!1,onCollapsedChange:a,mobileOpen:r=!1,onMobileClose:i,logo:o,logoIcon:c,logoTitle:d,footer:u,user:p,onLogout:f,onLogin:h,theme:m,onThemeToggle:x,activeItemId:v,activePath:g,onItemClick:y,parentItemBehavior:S="accordion",sx:k,style:L})=>{const $=v??(g!==void 0?zi(t,g):void 0),H=n!==void 0,[J,ee]=l.useState(s),D=H?n:J,B=()=>{const w=!D;H||ee(w),a?.(w)},[ae,F]=l.useState(()=>{if(!$)return[];const w=[],R=re=>{for(const ue of re){if(ue.id===$)return!0;if(ue.children&&R(ue.children))return w.push(ue.id),!0}return!1};return R(t),w});l.useEffect(()=>{if(!$)return;const w=[],R=re=>{for(const ue of re){if(ue.id===$)return!0;if(ue.children&&R(ue.children))return w.push(ue.id),!0}return!1};R(t),w.length!==0&&F(re=>{const ue=new Set(re);for(const P of w)ue.add(P);return Array.from(ue)})},[$,t]);const ve=w=>{F(R=>R.includes(w)?R.filter(re=>re!==w):[...R,w])},[me,Q]=l.useState(null),oe=l.useRef(0),ye=l.useRef(0),ke=l.useRef(null),Z=l.useCallback(()=>{ke.current!==null&&(clearTimeout(ke.current),ke.current=null)},[]),G=l.useCallback((w,R)=>{if(!D)return;Z();const re=R.getBoundingClientRect();oe.current=Math.min(re.top,window.innerHeight-Oi),ye.current=re.top+re.height/2,Q(w)},[D,Z]),b=l.useCallback(()=>{D&&(Z(),ke.current=window.setTimeout(()=>Q(null),Bi))},[D,Z]),A=w=>{Z(),Q(w)};l.useEffect(()=>{if(!D||!me)return;const w=R=>{R.key==="Escape"&&Q(null)};return document.addEventListener("keydown",w),()=>document.removeEventListener("keydown",w)},[D,me]),l.useEffect(()=>()=>Z(),[Z]),l.useEffect(()=>{D||Q(null)},[D]);const I=me?t.find(w=>w.id===me):null,W=!u&&(p||f||h||x),V=["ui-sidebar",D&&"ui-sidebar--collapsed",k].filter(Boolean).join(" "),be=(w=!1)=>e.jsxs(e.Fragment,{children:[w?e.jsxs("div",{className:"ui-sidebar__mobile-header",children:[e.jsx("div",{className:"ui-sidebar__mobile-header-logo",children:o}),e.jsx(Ie,{icon:e.jsx(bt,{}),"aria-label":"Close navigation",variant:"ghost",color:"neutral",size:"medium",onClick:i})]}):(o||c||d)&&e.jsx("div",{className:"ui-sidebar__header",children:o??e.jsxs(e.Fragment,{children:[c&&e.jsx("div",{className:"ui-sidebar__logo-icon",children:c}),d&&e.jsx("span",{className:"ui-sidebar__logo-title",children:d})]})}),e.jsx("nav",{className:"ui-sidebar__nav","aria-label":"Main navigation",children:e.jsx("ul",{role:"list",style:{listStyle:"none",margin:0,padding:0},children:t.map(R=>e.jsx($s,{item:R,isCollapsed:w?!1:D,isActive:R.id===$,isExpanded:ae.includes(R.id),expandedIds:ae,parentItemBehavior:S,depth:0,onToggleExpand:ve,onItemClick:y,activeItemId:$,onMouseEnter:w?void 0:G,onMouseLeave:w?void 0:b},R.id))})}),u&&e.jsx("div",{className:"ui-sidebar__footer",children:u}),W&&e.jsx(Hi,{user:p,onLogout:f,onLogin:h,theme:m,onThemeToggle:x,isCollapsed:w?!1:D})]});return e.jsxs(e.Fragment,{children:[e.jsxs("aside",{className:V,style:L,children:[e.jsx(Ie,{icon:D?e.jsx(Pn,{}):e.jsx(In,{}),"aria-label":D?"Expand sidebar":"Collapse sidebar",size:"small",variant:"outlined",color:"neutral",onClick:B,sx:"ui-sidebar__toggle-btn"}),e.jsx("div",{className:"ui-sidebar__inner",children:be(!1)}),D&&I&&e.jsx("div",{className:["ui-sidebar__popover",!I.children?.length&&"ui-sidebar__popover--label"].filter(Boolean).join(" "),style:I.children?.length?{top:oe.current}:{top:ye.current,transform:"translateY(-50%)"},onMouseEnter:()=>A(I.id),onMouseLeave:b,role:I.children?.length?"menu":void 0,children:I.children?.length?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"ui-sidebar__popover-header",children:I.label}),I.children.map(w=>{const R=w.id===$,re=["ui-sidebar__popover-item",R&&"ui-sidebar__popover-item--active"].filter(Boolean).join(" ");return w.path?e.jsxs("a",{href:w.path,className:re,"aria-current":R?"page":void 0,role:"menuitem",onClick:ue=>{ue.button===0&&!ue.metaKey&&!ue.ctrlKey&&!ue.shiftKey&&!ue.altKey&&(y&&ue.preventDefault(),y?.(w),Q(null))},children:[w.icon&&e.jsx("span",{className:"ui-sidebar__item-icon",children:w.icon}),w.label]},w.id):e.jsxs("button",{type:"button",className:re,role:"menuitem",onClick:()=>{y?.(w),Q(null)},children:[w.icon&&e.jsx("span",{className:"ui-sidebar__item-icon",children:w.icon}),w.label]},w.id)})]}):e.jsx("span",{children:I.label})})]}),e.jsx(Xa,{open:r,onClose:i,anchor:"left",width:"100vw",showCloseButton:!1,closeOnEscape:!0,closeOnBackdropClick:!0,trapFocus:!0,sx:"ui-sidebar__mobile-drawer",hideBackdrop:!0,children:e.jsx("div",{className:"ui-sidebar__mobile-inner",children:be(!0)})})]})};ja.displayName="Sidebar";const Ts=({children:t,variant:n="sidebar",sidebar:s,header:a,sx:r,style:i})=>{const[o,c]=l.useState(s?.defaultCollapsed??!1),[d,u]=l.useState(!1),p=s?.mobileOpen??d,f=s?.onMobileClose??(()=>u(!1)),h=v=>{c(v),s?.onCollapsedChange?.(v)},m=["ui-layout",`ui-layout--${n}`,r].filter(Boolean).join(" ");if(n==="centered")return e.jsxs("div",{className:m,style:i,children:[a&&e.jsx("header",{className:"ui-layout__centered-header",children:a}),e.jsx("div",{className:"ui-layout__content",children:e.jsx("div",{className:"ui-layout__centered-card",children:t})})]});const x=s?.collapsed!==void 0?s.collapsed:o;return e.jsxs("div",{className:m,style:i,children:[e.jsx("div",{className:["ui-layout__sidebar-area",x&&"ui-layout__sidebar-area--collapsed"].filter(Boolean).join(" "),"aria-hidden":"true"}),s&&e.jsx(ja,{...s,collapsed:s.collapsed!==void 0?s.collapsed:o,onCollapsedChange:h,mobileOpen:p,onMobileClose:f}),e.jsxs("div",{className:"ui-layout__content",children:[e.jsx("div",{className:"ui-layout__mobile-header",children:e.jsx(Ie,{icon:e.jsx(Ur,{}),"aria-label":"Open navigation","aria-expanded":p,variant:"ghost",color:"neutral",size:"medium",onClick:()=>u(!0)})}),e.jsx("main",{className:"ui-layout__main",children:t})]})]})};Ts.displayName="Layout";const ya=2;function Fi(t){const n=Math.floor(t/60),s=t%60;return n>0&&s>0?`${n}h ${s}m`:n>0?`${n}h`:`${s} min`}const Vi=()=>e.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("circle",{cx:"12",cy:"12",r:"10"}),e.jsx("polyline",{points:"12 6 12 12 16 14"})]}),Ls=()=>e.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M4 19.5A2.5 2.5 0 0 1 6.5 17H20"}),e.jsx("path",{d:"M6.5 2H20v20H6.5A2.5 2.5 0 0 1 4 19.5v-15A2.5 2.5 0 0 1 6.5 2z"})]}),Yi=()=>e.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("circle",{cx:"12",cy:"12",r:"10"}),e.jsx("path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3"}),e.jsx("line",{x1:"12",y1:"17",x2:"12.01",y2:"17"})]}),Wi=()=>e.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("circle",{cx:"12",cy:"12",r:"10"}),e.jsx("polygon",{points:"10 8 16 12 10 16 10 8",fill:"currentColor",stroke:"none"})]}),Ki=()=>e.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("rect",{x:"2",y:"3",width:"20",height:"14",rx:"2"}),e.jsx("line",{x1:"8",y1:"21",x2:"16",y2:"21"}),e.jsx("line",{x1:"12",y1:"17",x2:"12",y2:"21"})]}),Ui=()=>e.jsx("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"currentColor",children:e.jsx("path",{d:"M19 21l-7-5-7 5V5a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2z"})}),qi=()=>e.jsx("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:e.jsx("path",{d:"M19 21l-7-5-7 5V5a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2z"})}),Gi=()=>e.jsx("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"currentColor",children:e.jsx("polygon",{points:"12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2"})}),Xi=({isBookmarked:t,onToggle:n})=>{const[s,a]=l.useState(0),r=i=>{i.preventDefault(),i.stopPropagation(),n&&(a(o=>o+1),n(!t))};return e.jsx("span",{className:`ui-course-card__badge--bookmark-wrap${s>0?" ui-course-card__badge--bookmark-pop":""}`,children:e.jsx(Ie,{icon:t?e.jsx(Ui,{}):e.jsx(qi,{}),"aria-label":t?"Remove bookmark":"Add bookmark",size:"small",variant:"ghost",sx:"rounded-full",style:{background:"rgba(255, 255, 255, 0.9)",color:"var(--palette-warning-main)",backdropFilter:"blur(4px)",boxShadow:"0 2px 8px rgba(0, 0, 0, 0.2)"},onClick:n?r:void 0,disabled:!n})},s)},Ji=({title:t,description:n,imageUrl:s,difficulty:a,durationMinutes:r,lessonCount:i,testCount:o,videoCount:c,presentationCount:d,professions:u,progress:p,rating:f,author:h,isCompleted:m,isDraft:x,isRecommended:v,badgeSlot:g,isBookmarked:y,onBookmarkToggle:S,href:k,target:L,onClick:$,sx:H})=>{const J=["ui-course-card",x?"ui-course-card--draft":"",H||""].filter(Boolean).join(" "),ee=u?.length||0,D=Math.max(0,ee-ya),B=a&&D>0?ya-1:ya,ae=Math.max(0,ee-B),F=ae>0?(u||[]).slice(B).map(Q=>Q.name).join(", "):void 0,ve=r!=null&&r>0||i!=null||o!=null||c!=null&&c>0||d!=null&&d>0;console.log("professions",u),console.log("maxVisible",B),console.log("hiddenCount",ae),console.log("hiddenProfessionNames",F),console.log("author",h),console.log("isCompleted",m),console.log("isDraft",x),console.log("isRecommended",v),console.log("badgeSlot",g);const me=e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"ui-course-card__image-wrap",children:[s?e.jsx("img",{className:"ui-course-card__image",src:s,alt:t}):e.jsx("div",{className:"ui-course-card__image-placeholder",children:e.jsx(Ls,{})}),n&&e.jsx("div",{className:"ui-course-card__image-overlay",children:e.jsx("p",{className:"ui-course-card__image-overlay-text",children:n})}),(x||m||v||g)&&e.jsxs("div",{className:"ui-course-card__badge-wrap ui-course-card__badge-wrap--top-left",children:[x&&e.jsx(St,{label:"Draft",color:"warning",variant:"filled",size:"small"}),m&&e.jsx(St,{label:"✓ Done",color:"success",variant:"filled",size:"small"}),v&&e.jsx(St,{label:"★ Recommended",color:"info",variant:"filled",size:"small"}),g]}),e.jsx(Xi,{isBookmarked:!!y,onToggle:S})]}),e.jsxs("div",{className:"ui-course-card__body",children:[e.jsx("h3",{className:"ui-course-card__title",children:t}),(a||u&&u.length>0)&&e.jsxs("div",{className:"ui-course-card__professions",children:[a&&e.jsxs("span",{className:"ui-course-card__difficulty-tag","data-difficulty":a,children:[e.jsxs("span",{className:"ui-course-card__level-bars","aria-hidden":"true",children:[e.jsx("span",{className:"ui-course-card__level-bar"}),e.jsx("span",{className:"ui-course-card__level-bar"}),e.jsx("span",{className:"ui-course-card__level-bar"})]}),a.charAt(0).toUpperCase()+a.slice(1)]}),(u||[]).slice(0,B).map((Q,oe)=>e.jsx("span",{className:"ui-course-card__profession-tag",style:Q.color?{"--tag-color":Q.color}:void 0,children:Q.name},oe)),ae>0&&e.jsx(Je,{title:F,placement:"top",children:e.jsxs("span",{className:"ui-course-card__profession-tag ui-course-card__profession-tag--more",children:["+",ae]})})]}),typeof p=="number"&&e.jsxs("div",{className:"ui-course-card__progress",children:[e.jsx("div",{className:"ui-course-card__progress-track",children:e.jsx("div",{className:"ui-course-card__progress-fill",style:{width:`${Math.min(100,Math.max(0,p))}%`}})}),e.jsxs("span",{className:"ui-course-card__progress-value",children:[Math.round(p),"%"]})]}),(f!=null||h||ve)&&e.jsxs("div",{className:"ui-course-card__footer",children:[e.jsxs("div",{className:"ui-course-card__footer-left",children:[f!=null&&e.jsxs("span",{className:"ui-course-card__rating",children:[e.jsx(Gi,{}),f.toFixed(1)]}),h&&e.jsxs("span",{className:"ui-course-card__author",children:[h.avatarUrl?e.jsx("img",{className:"ui-course-card__author-avatar",src:h.avatarUrl,alt:h.username}):e.jsx("span",{className:"ui-course-card__author-avatar ui-course-card__author-avatar--placeholder",children:h.username.charAt(0).toUpperCase()}),e.jsx("span",{className:"ui-course-card__author-username",children:h.username})]})]}),e.jsxs("div",{className:"ui-course-card__footer-right",children:[r!=null&&r>0&&e.jsx(Je,{title:"Duration",placement:"top",children:e.jsxs("span",{className:"ui-course-card__stat-item",children:[e.jsx(Vi,{}),Fi(r)]})}),c!=null&&c>0&&e.jsx(Je,{title:`${c} video lesson${c!==1?"s":""}`,placement:"top",children:e.jsxs("span",{className:"ui-course-card__stat-item",children:[e.jsx(Wi,{}),c]})}),d!=null&&d>0&&e.jsx(Je,{title:`${d} presentation${d!==1?"s":""}`,placement:"top",children:e.jsxs("span",{className:"ui-course-card__stat-item",children:[e.jsx(Ki,{}),d]})}),i!=null&&e.jsx(Je,{title:`${i} lesson${i!==1?"s":""}`,placement:"top",children:e.jsxs("span",{className:"ui-course-card__stat-item",children:[e.jsx(Ls,{}),i]})}),o!=null&&e.jsx(Je,{title:`${o} test${o!==1?"s":""}`,placement:"top",children:e.jsxs("span",{className:"ui-course-card__stat-item",children:[e.jsx(Yi,{}),o]})})]})]})]})]});return k?e.jsx("a",{className:J,href:k,target:L,rel:L==="_blank"?"noopener noreferrer":void 0,onClick:$,"data-difficulty":a,children:me}):e.jsx("div",{className:J,"data-difficulty":a,onClick:$,role:$?"button":void 0,tabIndex:$?0:void 0,children:me})},Ut=2;function Zi(t){const n=Math.floor(t/60),s=t%60;return n>0&&s>0?`${n}h ${s}m`:n>0?`${n}h`:`${s} min`}const Qi=()=>e.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("circle",{cx:"12",cy:"12",r:"10"}),e.jsx("polyline",{points:"12 6 12 12 16 14"})]}),Ri=()=>e.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("circle",{cx:"12",cy:"12",r:"10"}),e.jsx("path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3"}),e.jsx("line",{x1:"12",y1:"17",x2:"12.01",y2:"17"})]}),el=()=>e.jsxs("svg",{width:"36",height:"36",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M4 19.5A2.5 2.5 0 0 1 6.5 17H20"}),e.jsx("path",{d:"M6.5 2H20v20H6.5A2.5 2.5 0 0 1 4 19.5v-15A2.5 2.5 0 0 1 6.5 2z"})]}),tl=()=>e.jsx("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"currentColor",children:e.jsx("path",{d:"M19 21l-7-5-7 5V5a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2z"})}),nl=()=>e.jsx("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:e.jsx("path",{d:"M19 21l-7-5-7 5V5a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2z"})}),al=()=>e.jsx("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"currentColor",children:e.jsx("polygon",{points:"12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2"})}),sl=({isBookmarked:t,onToggle:n})=>{const[s,a]=l.useState(0),r=i=>{i.preventDefault(),i.stopPropagation(),n&&(a(o=>o+1),n(!t))};return e.jsx("span",{className:`ui-lesson-card__badge--bookmark-wrap${s>0?" ui-lesson-card__badge--bookmark-pop":""}`,children:e.jsx(Ie,{icon:t?e.jsx(tl,{}):e.jsx(nl,{}),"aria-label":t?"Remove bookmark":"Add bookmark",size:"small",variant:"ghost",sx:"rounded-full",style:{background:"rgba(255, 255, 255, 0.9)",color:"var(--palette-warning-main)",backdropFilter:"blur(4px)",boxShadow:"0 2px 8px rgba(0, 0, 0, 0.2)"},onClick:n?r:void 0,disabled:!n})},s)},rl=({title:t,description:n,imageUrl:s,type:a,contentType:r,durationMinutes:i,author:o,module:c,course:d,skills:u,professions:p,testCount:f,rating:h,isBookmarked:m,onBookmarkToggle:x,isCompleted:v,isDraft:g,isRecommended:y,badgeSlot:S,href:k,target:L,onClick:$,customButtons:H,sx:J})=>{const ee=["ui-lesson-card",g?"ui-lesson-card--draft":"",J||""].filter(Boolean).join(" "),D=(p?.length||0)-Ut,B=D>0?(p||[]).slice(Ut).map(Q=>Q.name).join(", "):void 0,ae=(u?.length||0)-Ut,F=ae>0?(u||[]).slice(Ut).join(", "):void 0,ve=i!=null&&i>0||f!=null||!!o,me=e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"ui-lesson-card__image-wrap",children:[s?e.jsx("img",{className:"ui-lesson-card__image",src:s,alt:t}):e.jsx("div",{className:"ui-lesson-card__image-placeholder",children:e.jsx(el,{})}),n&&e.jsx("div",{className:"ui-lesson-card__image-overlay",children:e.jsx("p",{className:"ui-lesson-card__image-overlay-text",children:n})}),(g||v||y||S)&&e.jsxs("div",{className:"ui-lesson-card__badge-wrap ui-lesson-card__badge-wrap--top-left",children:[g&&e.jsx(St,{label:"Draft",color:"warning",variant:"filled",size:"small"}),v&&e.jsx(St,{label:"✓ Done",color:"success",variant:"filled",size:"small"}),y&&e.jsx(St,{label:"★ Recommended",color:"info",variant:"filled",size:"small"}),S]}),e.jsx(sl,{isBookmarked:!!m,onToggle:x})]}),e.jsxs("div",{className:"ui-lesson-card__body",children:[e.jsx("h3",{className:"ui-lesson-card__title",children:t}),(a||r&&r!=="standard"||p&&p.length>0||u&&u.length>0)&&e.jsxs("div",{className:"ui-lesson-card__chips-row",children:[a&&e.jsx("span",{className:"ui-lesson-card__type-chip","data-type":a.toLowerCase(),children:a}),r&&r!=="standard"&&e.jsx("span",{className:"ui-lesson-card__type-chip ui-lesson-card__type-chip--content",children:r}),(p||[]).slice(0,Ut).map((Q,oe)=>e.jsx("span",{className:"ui-lesson-card__profession-chip",style:Q.color?{"--chip-accent":Q.color}:void 0,children:Q.name},oe)),D>0&&e.jsx(Je,{title:B,placement:"top",children:e.jsxs("span",{className:"ui-lesson-card__profession-chip ui-lesson-card__profession-chip--more",children:["+",D]})}),(u||[]).slice(0,Ut).map((Q,oe)=>e.jsx("span",{className:"ui-lesson-card__skill-chip",children:Q},oe)),ae>0&&e.jsx(Je,{title:F,placement:"top",children:e.jsxs("span",{className:"ui-lesson-card__skill-chip ui-lesson-card__skill-chip--more",children:["+",ae]})})]}),(h!=null||o||ve||H)&&e.jsxs("div",{className:"ui-lesson-card__footer",children:[e.jsxs("div",{className:"ui-lesson-card__footer-left",children:[h!=null&&e.jsxs("span",{className:"ui-lesson-card__rating",children:[e.jsx(al,{}),h.toFixed(1)]}),o&&e.jsxs("span",{className:"ui-lesson-card__author",children:[o.avatarUrl?e.jsx("img",{className:"ui-lesson-card__author-avatar",src:o.avatarUrl,alt:o.username}):e.jsx("span",{className:"ui-lesson-card__author-avatar ui-lesson-card__author-avatar--placeholder",children:o.username.charAt(0).toUpperCase()}),e.jsx("span",{className:"ui-lesson-card__author-username",children:o.username})]})]}),e.jsxs("div",{className:"ui-lesson-card__footer-right",children:[i!=null&&i>0&&e.jsx(Je,{title:"Duration",placement:"top",children:e.jsxs("span",{className:"ui-lesson-card__stat-item",children:[e.jsx(Qi,{}),Zi(i)]})}),f!=null&&e.jsx(Je,{title:`${f} test${f!==1?"s":""}`,placement:"top",children:e.jsxs("span",{className:"ui-lesson-card__stat-item",children:[e.jsx(Ri,{}),f]})}),H&&e.jsx("span",{onClick:Q=>Q.stopPropagation(),children:H})]})]}),(c||d)&&e.jsxs("div",{className:"ui-lesson-card__context",children:[c&&e.jsx(Je,{title:"Module",placement:"top",children:e.jsx("span",{className:"ui-lesson-card__context-item",children:c})}),d&&e.jsx(Je,{title:"Course",placement:"top",children:e.jsx("span",{className:"ui-lesson-card__context-item",children:d})})]})]})]});return k?e.jsx("a",{className:ee,href:k,target:L,rel:L==="_blank"?"noopener noreferrer":void 0,onClick:$,children:me}):e.jsx("div",{className:ee,onClick:$,role:$?"button":void 0,tabIndex:$?0:void 0,children:me})},il="#6366f1",ll="done",ol=t=>{const n=t instanceof Date?t:new Date(t);if(Number.isNaN(n.getTime()))return"";const s=String(n.getDate()).padStart(2,"0"),a=String(n.getMonth()+1).padStart(2,"0");return`${s}.${a}`},cl=()=>e.jsxs("svg",{width:"11",height:"11",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",focusable:"false",children:[e.jsx("circle",{cx:"12",cy:"12",r:"10"}),e.jsx("line",{x1:"12",y1:"8",x2:"12",y2:"12"}),e.jsx("line",{x1:"12",y1:"16",x2:"12.01",y2:"16"})]}),dl=()=>e.jsxs("svg",{width:"11",height:"11",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",focusable:"false",children:[e.jsx("path",{d:"M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"}),e.jsx("circle",{cx:"12",cy:"12",r:"3"})]}),ul=()=>e.jsx("svg",{width:"11",height:"11",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",focusable:"false",children:e.jsx("path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"})}),hl=()=>e.jsx("svg",{width:"11",height:"11",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",focusable:"false",children:e.jsx("path",{d:"M21.44 11.05l-9.19 9.19a6 6 0 0 1-8.49-8.49l9.19-9.19a4 4 0 0 1 5.66 5.66l-9.2 9.19a2 2 0 0 1-2.83-2.83l8.49-8.48"})}),pl=()=>e.jsxs("svg",{width:"11",height:"11",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",focusable:"false",children:[e.jsx("rect",{x:"3",y:"4",width:"18",height:"18",rx:"2",ry:"2"}),e.jsx("line",{x1:"16",y1:"2",x2:"16",y2:"6"}),e.jsx("line",{x1:"8",y1:"2",x2:"8",y2:"6"}),e.jsx("line",{x1:"3",y1:"10",x2:"21",y2:"10"})]}),ml=()=>e.jsxs("svg",{width:"11",height:"11",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",focusable:"false",children:[e.jsx("polyline",{points:"9 11 12 14 22 4"}),e.jsx("path",{d:"M21 12v7a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11"})]}),fl=()=>e.jsx("svg",{width:"11",height:"11",viewBox:"0 0 24 24",fill:"currentColor",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",focusable:"false",children:e.jsx("polygon",{points:"5 3 19 12 5 21 5 3"})}),_l=()=>e.jsxs("svg",{width:"11",height:"11",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",focusable:"false",children:[e.jsx("path",{d:"M4 15s1-1 4-1 5 2 8 2 4-1 4-1V3s-1 1-4 1-5-2-8-2-4 1-4 1z"}),e.jsx("line",{x1:"4",y1:"22",x2:"4",y2:"15"})]}),gl=t=>t.user?.fullName||t.user?.name||String(t.user_id),As=(t,{role:n,shape:s,color:a})=>e.jsx(xa,{max:4,total:t.length,size:"small",spacing:"small",shape:s,surplusColor:"primary",children:t.map(r=>{const i=gl(r);return e.jsx(Kt,{name:i,src:r.user?.avatar,alt:`${n}: ${i}`,color:a??"primary",referrerPolicy:"no-referrer"},r.user_id)})}),Is=({task:t,onClick:n,statusInfo:s,formatDate:a,isDragging:r=!1,dragHandleProps:i,sx:o})=>{const c=!!t._pending,d=t.priority||"low",u=a??ol,p=t.is_done??t.status===ll,f=(()=>{if(!t.due_date||p)return!1;const F=new Date(t.due_date);return F.setHours(23,59,59,999),F<new Date})(),h=t.labels||[],m=t.assignees||[],x=t.controllers||[],v=m.length>0||x.length>0,g=t._commentCount??0,y=t._attachmentCount??0,S=t._activeSessions??0,k=t._subtaskCount??0,L=t._completedSubtaskCount,$=k>0&&L===k,H=!!t.start_date||!!t.due_date,J=H||S>0||k>0||g>0||y>0,ee=["ui-task-card",c&&"ui-task-card--pending",r&&"ui-task-card--dragging",o].filter(Boolean).join(" "),D=()=>{c||r||n?.()},B=c?void 0:i?.attributes,ae=c?void 0:i?.listeners;return e.jsxs("div",{ref:i?.ref,role:n?"button":void 0,tabIndex:n&&!c?0:void 0,"aria-busy":c||void 0,"data-priority":d,className:ee,onClick:D,...B,...ae,children:[e.jsxs("div",{className:"ui-task-card__title-row",children:[e.jsx("p",{className:"ui-task-card__title",children:t.title}),s&&e.jsx(mt,{size:"small",label:s.label,sx:"ui-task-card__status",style:{backgroundColor:s.color||"#6B7280",color:"#fff",borderColor:"transparent"}})]}),(t.project?.name||t.milestone?.name)&&e.jsxs("div",{className:"ui-task-card__row ui-task-card__context",title:[t.project?.name,t.milestone?.name].filter(Boolean).join(" · "),children:[t.project?.name&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"ui-task-card__project-dot",style:{backgroundColor:t.project.color||"currentColor"},"aria-hidden":"true"}),e.jsx("span",{className:"ui-task-card__context-project",children:t.project.name})]}),t.project?.name&&t.milestone?.name&&e.jsx("span",{className:"ui-task-card__context-sep","aria-hidden":"true",children:"·"}),t.milestone?.name&&e.jsxs(e.Fragment,{children:[!t.project?.name&&e.jsx("span",{className:"ui-task-card__row-icon","aria-hidden":"true",children:e.jsx(_l,{})}),e.jsx("span",{className:"ui-task-card__context-milestone",children:t.milestone.name})]})]}),v&&e.jsxs("div",{className:"ui-task-card__people",children:[m.length>0&&As(m,{role:"Assignee",color:"primary"}),x.length>0&&e.jsxs("span",{className:"ui-task-card__controllers",title:"Controllers",children:[e.jsx("span",{className:"ui-task-card__row-icon",children:e.jsx(dl,{})}),As(x,{role:"Controller",shape:"square",color:"warning"})]})]}),h.length>0&&e.jsx("div",{className:"ui-task-card__labels",children:h.map(F=>e.jsx(mt,{size:"small",label:F.name,style:{backgroundColor:F.color||il,color:"#fff",borderColor:"transparent"}},F.id))}),J&&e.jsxs("div",{className:"ui-task-card__footer",children:[e.jsx("div",{className:"ui-task-card__footer-left",children:H&&e.jsxs("span",{className:f?"ui-task-card__due ui-task-card__due--overdue":"ui-task-card__due",title:[t.start_date&&`Start: ${u(t.start_date)}`,t.due_date&&`Due: ${u(t.due_date)}`].filter(Boolean).join(" · "),children:[e.jsx("span",{className:"ui-task-card__row-icon",children:f?e.jsx(cl,{}):e.jsx(pl,{})}),t.start_date&&t.due_date?e.jsxs(e.Fragment,{children:[u(t.start_date),e.jsx("span",{className:"ui-task-card__due-arrow","aria-hidden":"true",children:"→"}),u(t.due_date)]}):t.due_date?u(t.due_date):t.start_date?e.jsxs(e.Fragment,{children:[u(t.start_date),e.jsx("span",{className:"ui-task-card__due-arrow","aria-hidden":"true",children:"→"})]}):null]})}),e.jsxs("div",{className:"ui-task-card__footer-right",children:[S>0&&e.jsxs("span",{className:"ui-task-card__active",title:S===1?"1 person is working on this now":`${S} people are working on this now`,children:[e.jsx("span",{className:"ui-task-card__row-icon ui-task-card__active-icon",children:e.jsx(fl,{})}),S>1&&S]}),k>0&&e.jsxs("span",{className:$?"ui-task-card__count ui-task-card__count--done":"ui-task-card__count",title:L!==void 0?`${L} of ${k} subtasks done`:`${k} subtask${k===1?"":"s"}`,children:[e.jsx("span",{className:"ui-task-card__row-icon",children:e.jsx(ml,{})}),L!==void 0?`${L}/${k}`:k]}),g>0&&e.jsxs("span",{className:"ui-task-card__count",children:[e.jsx("span",{className:"ui-task-card__row-icon",children:e.jsx(ul,{})}),g]}),y>0&&e.jsxs("span",{className:"ui-task-card__count",children:[e.jsx("span",{className:"ui-task-card__row-icon",children:e.jsx(hl,{})}),y]})]})]})]})};Is.displayName="TaskCard";function _t(t){return!!t.endDate&&t.endDate>t.date}function Ps(t,n){const s=t.endDate&&t.endDate>t.date?t.endDate:t.date;return t.date<=n&&n<=s}const xl={label:"",short:"",icon:"📅",color:"#718096",bg:"rgba(113,128,150,0.10)"};function Et(t,n){return n[t]??{...xl,label:t,short:t}}function fn(t,n){return t.title?t.title:Et(t.category,n??{}).label||t.category}function $t(t){const n=t.getFullYear(),s=String(t.getMonth()+1).padStart(2,"0"),a=String(t.getDate()).padStart(2,"0");return`${n}-${s}-${a}`}function vl(t){const[n,s,a]=t.split("-").map(Number);return new Date(n,s-1,a)}function zs(t){const n=t.getDay(),s=n===0?-6:1-n,a=new Date(t);return a.setDate(t.getDate()+s),a.setHours(0,0,0,0),a}const Hs=["Mon","Tue","Wed","Thu","Fri","Sat","Sun"],qt=["January","February","March","April","May","June","July","August","September","October","November","December"];function Bs(t){return t.type==="daterange"?{start:null,end:null}:t.type==="select"&&!t.multiple?null:[]}function bl(t,n){if(!t.type||t.type==="pills")return Array.isArray(n)?n.length:0;if(t.type==="select")return Array.isArray(n)?n.length:n!==null&&n!==""?1:0;if(t.type==="daterange"){const s=n;return s?.start||s?.end?1:0}return 0}const Os=({isOpen:t,onClose:n,sections:s,value:a,onChange:r,onReset:i,renderBody:o})=>{function c(h,m){r({...a,[h]:m})}function d(h,m){const x=a[h]??[],v=x.includes(m)?x.filter(g=>g!==m):[...x,m];r({...a,[h]:v})}function u(){i()}const p=o?0:s.reduce((h,m)=>h+bl(m,a[m.id]??Bs(m)),0),f=`ui-calendar__filter${t?" ui-calendar__filter--open":""}`;return e.jsx("aside",{className:f,"aria-label":"Filters","aria-hidden":!t,children:e.jsxs("div",{className:"ui-cal-filter",children:[e.jsxs("div",{className:"ui-cal-filter__header",children:[e.jsxs("span",{className:"ui-cal-filter__title",children:["Filters",p>0?e.jsx("span",{className:"ui-cal-filter__count",children:p}):null]}),e.jsx(Ie,{icon:e.jsx(bt,{}),"aria-label":"Close filters",onClick:n,variant:"ghost",color:"neutral",size:"small",style:{borderRadius:"var(--radius-sm)"}})]}),e.jsx("div",{className:"ui-cal-filter__body",children:o?o():s.map(h=>e.jsxs("div",{className:"ui-cal-filter__section",children:[e.jsx("div",{className:"ui-cal-filter__section-title",children:h.title}),jl(h,a[h.id]??Bs(h),d,c)]},h.id))}),e.jsx("div",{className:"ui-cal-filter__footer",children:e.jsx(Xe,{variant:"outlined",color:"neutral",size:"small",style:{flex:1},onClick:u,children:"Reset all"})})]})})};Os.displayName="CalendarFilterPanel";function jl(t,n,s,a){if(t.type==="select")return t.searchable?e.jsx(Zn,{options:t.options,value:n,onChange:i=>a(t.id,i),multiple:t.multiple,placeholder:t.placeholder,clearable:t.clearable,fullWidth:!0}):e.jsx($n,{options:t.options,value:n,onChange:i=>a(t.id,i),multiple:t.multiple,placeholder:t.placeholder,clearable:t.clearable,fullWidth:!0});if(t.type==="daterange")return e.jsx(ia,{mode:"range",rangeValue:n,onRangeChange:i=>a(t.id,i),minDate:t.minDate,maxDate:t.maxDate,triggerVariant:"input",multiMonth:!1});const r=n??[];return e.jsx("div",{className:"ui-cal-filter__pills",children:t.options.map(i=>e.jsx(mt,{label:i.label,variant:"outlined",color:"neutral",size:"small",selected:r.includes(i.value),onClick:()=>{t.multiple===!1?a(t.id,r.includes(i.value)?[]:[i.value]):s(t.id,i.value)}},i.value))})}const yl=[{id:"month",label:"Month"},{id:"week",label:"Week"},{id:"day",label:"Day"}],Vn={borderRadius:"var(--radius-sm)"};function kl(t,n,s,a,r){if(t==="month")return`${qt[s]} ${n}`;if(t==="week"&&a){const i=new Date(a);return i.setDate(a.getDate()+6),a.getMonth()===i.getMonth()?`${qt[a.getMonth()]} ${a.getDate()}–${i.getDate()}, ${a.getFullYear()}`:`${qt[a.getMonth()]} ${a.getDate()} – ${qt[i.getMonth()]} ${i.getDate()}, ${i.getFullYear()}`}if(t==="day"&&r){const[i,o,c]=r.split("-").map(Number);return new Date(i,o-1,c).toLocaleDateString("en-US",{weekday:"long",month:"long",day:"numeric",year:"numeric"})}return`${qt[s]} ${n}`}const Fs=({view:t,year:n,month:s,weekStart:a,dayDate:r,onViewChange:i,onPrev:o,onNext:c,onToday:d,onSearch:u,onFilter:p,onAdd:f,showSearch:h,showFilters:m,showAdd:x,filterOpen:v})=>{const g=kl(t,n,s,a,r);return e.jsxs("div",{className:"ui-calendar__header",children:[e.jsxs("div",{className:"ui-calendar__nav",children:[e.jsx(Ie,{icon:e.jsx(In,{}),"aria-label":"Previous",onClick:o,variant:"outlined",color:"neutral",size:"small",style:Vn}),e.jsx("button",{className:"ui-calendar__today-btn",onClick:d,children:"Today"}),e.jsx(Ie,{icon:e.jsx(Pn,{}),"aria-label":"Next",onClick:c,variant:"outlined",color:"neutral",size:"small",style:Vn})]}),e.jsx("div",{className:"ui-calendar__title",children:g}),e.jsx("div",{className:"ui-calendar__view-switcher",role:"group","aria-label":"Calendar view",children:yl.map(({id:y,label:S})=>e.jsx("button",{className:`ui-calendar__view-btn${t===y?" ui-calendar__view-btn--active":""}`,onClick:()=>i(y),"aria-pressed":t===y,children:S},y))}),e.jsxs("div",{className:"ui-calendar__actions",children:[h&&e.jsx(Ie,{icon:e.jsx(Dr,{}),"aria-label":"Search (Ctrl+K)",onClick:u,variant:"outlined",color:"neutral",size:"small",style:Vn,title:"Search (Ctrl+K)"}),m&&e.jsx(Ie,{icon:e.jsx(Br,{}),"aria-label":"Filters",onClick:p,variant:v?"filled":"outlined",color:"neutral",size:"small",style:Vn,"aria-pressed":v}),x&&e.jsx(Xe,{variant:"filled",color:"primary",size:"small",onClick:f,"aria-label":"Add event",children:"+ New"})]})]})};Fs.displayName="CalendarHeader";const _n=({event:t,compact:n=!1,categoryMeta:s,onClick:a})=>{const r=Et(t.category,s),i=r.variant==="icon",o=fn(t,s),c={"--cal-event-color":r.color,"--cal-event-bg":r.bg},d=["ui-calendar-event",i?"ui-calendar-event--celebration":"",t.urgent?"ui-calendar-event--urgent":""].filter(Boolean).join(" ");return e.jsxs("div",{className:d,style:c,onClick:u=>{u.stopPropagation(),a(t)},role:"button",tabIndex:0,onKeyDown:u=>{(u.key==="Enter"||u.key===" ")&&(u.preventDefault(),a(t))},title:o,children:[i?e.jsx("span",{className:"ui-calendar-event__icon",children:r.icon}):e.jsx("span",{className:"ui-calendar-event__bar"}),e.jsxs("div",{className:"ui-calendar-event__content",children:[e.jsx("div",{className:"ui-calendar-event__name",children:o}),!n&&t.time&&e.jsxs("div",{className:"ui-calendar-event__meta",children:[t.time,t.duration?` · ${t.duration}m`:""]})]})]})};_n.displayName="CalendarEventCard";const Yn=({event:t,categoryMeta:n,continuesLeft:s,continuesRight:a,onClick:r})=>{const i=Et(t.category,n),o=fn(t,n),c={"--cal-event-color":i.color,"--cal-event-bg":i.bg},d=["ui-calendar-range",s?"ui-calendar-range--continues-left":"",a?"ui-calendar-range--continues-right":"",t.urgent?"ui-calendar-range--urgent":""].filter(Boolean).join(" ");return e.jsxs("div",{className:d,style:c,onClick:u=>{u.stopPropagation(),r(t)},role:"button",tabIndex:0,onKeyDown:u=>{(u.key==="Enter"||u.key===" ")&&(u.preventDefault(),r(t))},title:o,children:[s&&e.jsx("span",{className:"ui-calendar-range__chevron ui-calendar-range__chevron--left","aria-hidden":!0,children:"‹"}),e.jsx("span",{className:"ui-calendar-range__title",children:o}),a&&e.jsx("span",{className:"ui-calendar-range__chevron ui-calendar-range__chevron--right","aria-hidden":!0,children:"›"})]})};Yn.displayName="CalendarRangeBar";function Vs(t,n){if(n.length!==7)return{bars:[],laneCount:0};const s=$t(n[0]),a=$t(n[6]),i=t.filter(d=>_t(d)?d.date<=a&&d.endDate>=s:!1).slice().sort((d,u)=>{if(d.date!==u.date)return d.date<u.date?-1:1;const p=Ws(d.date,d.endDate),f=Ws(u.date,u.endDate);return p!==f?f-p:d.id<u.id?-1:d.id>u.id?1:0}),o=[],c=[];for(const d of i){const u=d.date<s?0:Ys(d.date,n),p=d.endDate>a?6:Ys(d.endDate,n);if(u<0||p<0||p<u)continue;let f=o.findIndex(h=>h.every(m=>m.endCol<u));f===-1&&(f=o.length,o.push([])),o[f].push({endCol:p}),c.push({event:d,startCol:u,endCol:p,lane:f,continuesLeft:d.date<s,continuesRight:d.endDate>a})}return{bars:c,laneCount:o.length}}function Ys(t,n){for(let s=0;s<n.length;s++)if($t(n[s])===t)return s;return-1}function Ws(t,n){const[s,a,r]=t.split("-").map(Number),[i,o,c]=n.split("-").map(Number),d=new Date(s,a-1,r).getTime(),u=new Date(i,o-1,c).getTime();return Math.round((u-d)/864e5)+1}const wl=3,ka=3,Ks=({events:t,year:n,month:s,today:a,categoryMeta:r,renderEvent:i,onEventClick:o,onDayClick:c})=>{const d=Nl(n,s),u=l.useMemo(()=>{const p={};for(const f of t)_t(f)||(p[f.date]||(p[f.date]=[]),p[f.date].push(f));return p},[t]);return e.jsxs("div",{className:"ui-calendar-month",children:[e.jsx("div",{className:"ui-calendar-month__weekdays",children:Hs.map(p=>e.jsx("div",{className:"ui-calendar-month__weekday",children:p},p))}),e.jsx("div",{className:"ui-calendar-month__grid",children:d.map((p,f)=>{const{bars:h,laneCount:m}=Vs(t,p.map(L=>L.date)),x=h.filter(L=>L.lane<ka),v=h.filter(L=>L.lane>=ka),g=Math.min(m,ka),y=g*Us,S=Math.max(1,wl-g),k=Array(7).fill(0);for(const L of v)for(let $=L.startCol;$<=L.endCol;$++)k[$]+=1;return e.jsxs("div",{className:"ui-calendar-month__row",children:[p.map((L,$)=>{const H=$t(L.date),J=H===a,ee=L.date.getDay()===0||L.date.getDay()===6,D=u[H]??[],B=k[$],F=D.length>S||B>0?Math.max(0,S-1):S,ve=D.slice(0,F),me=D.length-ve.length+B,Q=["ui-calendar-month__cell",L.outside?"ui-calendar-month__cell--outside":"",J?"ui-calendar-month__cell--today":"",ee?"ui-calendar-month__cell--weekend":""].filter(Boolean).join(" ");return e.jsxs("div",{className:Q,onClick:()=>c(H),children:[e.jsx("div",{className:"ui-calendar-month__date",children:L.date.getDate()}),e.jsx("div",{className:"ui-calendar-month__events",style:y?{marginTop:y+4}:void 0,children:ve.map(oe=>e.jsx(l.Fragment,{children:i?i(oe,!0):e.jsx(_n,{event:oe,compact:!0,categoryMeta:r,onClick:o})},oe.id))}),me>0&&e.jsxs("button",{type:"button",className:"ui-calendar-month__more",onClick:oe=>{oe.stopPropagation(),c(H)},children:["+",me]})]},H)}),x.length>0&&e.jsx("div",{className:"ui-calendar-month__ranges",style:{height:y},children:x.map(L=>{const $=L.startCol/7*100,H=(L.endCol-L.startCol+1)/7*100;return e.jsx("div",{className:"ui-calendar-month__range-slot",style:{left:`${$}%`,width:`${H}%`,top:L.lane*Us},children:e.jsx(Yn,{event:L.event,categoryMeta:r,continuesLeft:L.continuesLeft,continuesRight:L.continuesRight,onClick:o})},L.event.id)})})]},f)})})]})};Ks.displayName="MonthView";const Us=20;function Nl(t,n){const s=new Date(t,n,1),a=s.getDay(),r=a===0?6:a-1,i=new Date(s);i.setDate(1-r);const o=[];for(let c=0;c<6;c++){const d=[];for(let u=0;u<7;u++){const p=new Date(i);p.setDate(i.getDate()+c*7+u),d.push({date:p,outside:p.getMonth()!==n})}o.push(d)}return o}const qs=22,Gs=({events:t,weekStart:n,today:s,categoryMeta:a,renderEvent:r,onEventClick:i,onDayClick:o})=>{const c=Cl(n),d=l.useMemo(()=>{const f={};for(const h of t)_t(h)||(f[h.date]||(f[h.date]=[]),f[h.date].push(h));return f},[t]),{bars:u,laneCount:p}=l.useMemo(()=>Vs(t,c),[t,c]);return e.jsxs("div",{className:"ui-calendar-week",children:[e.jsx("div",{className:"ui-calendar-week__header",children:c.map((f,h)=>{const m=$t(f)===s,x=f.getDay()===0||f.getDay()===6,v=["ui-calendar-week__day-header",m?"ui-calendar-week__day-header--today":"",x?"ui-calendar-week__day-header--weekend":""].filter(Boolean).join(" ");return e.jsxs("div",{className:v,children:[e.jsx("div",{className:"ui-calendar-week__day-name",children:Hs[h]}),e.jsx("div",{className:"ui-calendar-week__day-num",children:f.getDate()})]},h)})}),u.length>0&&e.jsx("div",{className:"ui-calendar-week__allday",style:{height:p*qs+8},children:u.map(f=>{const h=f.startCol/7*100,m=(f.endCol-f.startCol+1)/7*100;return e.jsx("div",{className:"ui-calendar-week__range-slot",style:{left:`calc(${h}% + 4px)`,width:`calc(${m}% - 8px)`,top:4+f.lane*qs},children:e.jsx(Yn,{event:f.event,categoryMeta:a,continuesLeft:f.continuesLeft,continuesRight:f.continuesRight,onClick:i})},f.event.id)})}),e.jsx("div",{className:"ui-calendar-week__columns",children:c.map((f,h)=>{const m=$t(f),x=f.getDay()===0||f.getDay()===6,v=d[m]??[],g=["ui-calendar-week__col",x?"ui-calendar-week__col--weekend":""].filter(Boolean).join(" ");return e.jsx("div",{className:g,onClick:()=>o(m),children:v.map(y=>e.jsx(l.Fragment,{children:r?r(y,!1):e.jsx(_n,{event:y,categoryMeta:a,onClick:i})},y.id))},h)})})]})};Gs.displayName="WeekView";function Cl(t){return Array.from({length:7},(n,s)=>{const a=new Date(t);return a.setDate(t.getDate()+s),a})}const wa=7,Xs=Array.from({length:21-wa},(t,n)=>wa+n),Ml=60,Js=({events:t,date:n,categoryMeta:s,renderEvent:a,onEventClick:r})=>{const i=t.filter(p=>_t(p)&&Ps(p,n)),o=t.filter(p=>!_t(p)&&p.date===n),c=o.filter(p=>p.time),d=o.filter(p=>!p.time),u=i.length>0||d.length>0;return e.jsxs("div",{className:"ui-calendar-day",children:[u&&e.jsxs("div",{className:"ui-calendar-day__allday",children:[e.jsx("span",{className:"ui-calendar-day__allday-label",children:"All day"}),i.map(p=>e.jsx("div",{className:"ui-calendar-day__range-slot",children:e.jsx(Yn,{event:p,categoryMeta:s,continuesLeft:p.date<n,continuesRight:p.endDate>n,onClick:r})},p.id)),d.map(p=>e.jsx(l.Fragment,{children:a?a(p,!0):e.jsx(_n,{event:p,compact:!0,categoryMeta:s,onClick:r})},p.id))]}),e.jsxs("div",{className:"ui-calendar-day__time-grid",children:[e.jsx("div",{className:"ui-calendar-day__hours",children:Xs.map(p=>e.jsxs("div",{className:"ui-calendar-day__hour-label",children:[String(p).padStart(2,"0"),":00"]},p))}),e.jsxs("div",{className:"ui-calendar-day__slots",style:{position:"relative"},children:[Xs.map(p=>e.jsx("div",{className:"ui-calendar-day__slot"},p)),e.jsx("div",{className:"ui-calendar-day__events",children:c.map(p=>{const{top:f,height:h}=Sl(p,wa,Ml),m=Et(p.category,s);return e.jsx("div",{className:"ui-calendar-day__timed-event",style:{top:f,minHeight:Math.max(h,32),"--cal-event-color":m.color,"--cal-event-bg":m.bg},onClick:()=>r(p),children:a?a(p,!1):e.jsx(_n,{event:p,categoryMeta:s,onClick:r})},p.id)})})]})]})]})};Js.displayName="DayView";function Sl(t,n,s){const[a,r]=(t.time??"08:00").split(":").map(Number),o=((a-n)*60+r)/60*s,d=(t.duration??60)/60*s;return{top:o,height:d}}function Dl(t,n){const[s,a,r]=t.split("-").map(Number),o=new Date(s,a-1,r).toLocaleDateString("en-US",{weekday:"short",month:"short",day:"numeric"});return n?`${o} at ${n}`:o}function El(t,n){const[s,a,r]=t.split("-").map(Number),[i,o,c]=n.split("-").map(Number),d=new Date(s,a-1,r),u=new Date(i,o-1,c),p=s===i,f=d.toLocaleDateString("en-US",{month:"short",day:"numeric",year:p?void 0:"numeric"}),h=u.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"});return`${f} – ${h}`}function $l(t,n){const s=_t(t),a=_t(n);if(s!==a)return s?-1:1;if(s&&a)return t.date!==n.date?t.date<n.date?-1:1:t.endDate!==n.endDate?t.endDate>n.endDate?-1:1:t.id<n.id?-1:t.id>n.id?1:0;const r=(t.time??"").localeCompare(n.time??"");return r!==0?r:t.id<n.id?-1:t.id>n.id?1:0}function Tl(t,n){const[s,a,r]=t.split("-").map(Number),[i,o,c]=n.split("-").map(Number),d=new Date(s,a-1,r).getTime(),u=new Date(i,o-1,c).getTime();return Math.round((u-d)/864e5)+1}function Ll(t){const[n,s,a]=t.split("-").map(Number);return`${new Date(n,s-1,a).toLocaleDateString("en-US",{weekday:"long"})}, ${qt[s-1]} ${a}`}const Zs=({event:t,dayDate:n,dayEvents:s,isOpen:a,categoryMeta:r,renderSidebarDetail:i,renderSidebarItem:o,onClose:c,onBack:d,onEventClick:u,onEdit:p,onDelete:f})=>{const h=`ui-calendar__sidebar${a?" ui-calendar__sidebar--open":""}`,m=()=>t?e.jsx(Il,{event:t,categoryMeta:r,renderSidebarDetail:i,onClose:c,onBack:d,onEdit:p,onDelete:f}):n?e.jsx(Al,{dayDate:n,events:s,categoryMeta:r,renderSidebarItem:o,onClose:c,onEventClick:u}):e.jsxs("div",{className:"ui-calendar__sidebar-body",style:{alignItems:"center",justifyContent:"center",color:"var(--cal-text2)"},children:[e.jsx("span",{style:{fontSize:32},children:"📋"}),e.jsx("span",{style:{fontSize:13},children:"Select an event to see details"})]});return e.jsx("aside",{className:h,"aria-label":"Event details",children:e.jsx("div",{className:"ui-calendar__sidebar-inner",children:m()})})};Zs.displayName="CalendarSidebar";const Al=({dayDate:t,events:n,categoryMeta:s,renderSidebarItem:a,onClose:r,onEventClick:i})=>e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"ui-calendar__sidebar-header",children:[e.jsxs("div",{className:"ui-calendar__sidebar-meta",style:{flex:1},children:[e.jsx("div",{className:"ui-calendar__sidebar-title",children:Ll(t)}),e.jsx("div",{className:"ui-calendar__sidebar-subtitle",style:{color:"var(--cal-text2)"},children:n.length===0?"No events":`${n.length} event${n.length>1?"s":""}`})]}),e.jsx(Ie,{icon:e.jsx(bt,{}),"aria-label":"Close sidebar",onClick:r,variant:"ghost",color:"neutral",size:"small",style:{borderRadius:"var(--radius-sm)"}})]}),e.jsx("div",{className:"ui-calendar__sidebar-body",children:n.length===0?e.jsxs("div",{className:"ui-calendar__sidebar-empty",children:[e.jsx("span",{style:{fontSize:28},children:"📅"}),e.jsx("span",{children:"No events this day"})]}):e.jsx("div",{className:"ui-calendar__sidebar-day-list",children:n.slice().sort($l).map(o=>{const c=Et(o.category,s);return e.jsx("button",{className:"ui-calendar__sidebar-day-item",style:{"--cal-event-color":c.color,"--cal-event-bg":c.bg},onClick:()=>i(o),children:a?a(o):e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"ui-calendar__sidebar-day-item-bar"}),e.jsxs("div",{className:"ui-calendar__sidebar-day-item-body",children:[e.jsx("span",{className:"ui-calendar__sidebar-day-item-title",children:fn(o,s)}),e.jsxs("span",{className:"ui-calendar__sidebar-day-item-meta",children:[e.jsx("span",{style:{color:c.color},children:c.label}),o.time&&e.jsxs("span",{children:[" · ",o.time,o.duration?` (${o.duration} min)`:""]})]})]}),e.jsx("span",{className:"ui-calendar__sidebar-day-item-arrow",children:"›"})]})},o.id)})})})]}),Il=({event:t,categoryMeta:n,renderSidebarDetail:s,onClose:a,onBack:r,onEdit:i,onDelete:o})=>{const c=Et(t.category,n),d=c.variant==="icon",u=fn(t,n),p=c.icon??c.label[0]?.toUpperCase()??"?";return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"ui-calendar__sidebar-header",children:[e.jsx("div",{className:"ui-calendar__sidebar-avatar",style:d?{background:c.bg,fontSize:20}:{background:c.bg,color:c.color},children:p}),e.jsxs("div",{className:"ui-calendar__sidebar-meta",children:[e.jsx("div",{className:"ui-calendar__sidebar-title",title:u,children:u}),e.jsx("div",{className:"ui-calendar__sidebar-subtitle",children:e.jsx("span",{style:{color:c.color},children:c.label})})]}),e.jsxs("div",{style:{display:"flex",gap:2},children:[r&&e.jsx(Ie,{icon:e.jsx(Or,{}),"aria-label":"Back to day list",title:"Back to events",onClick:r,variant:"ghost",color:"neutral",size:"small",style:{borderRadius:"var(--radius-sm)"}}),e.jsx(Ie,{icon:e.jsx(bt,{}),"aria-label":"Close sidebar",onClick:a,variant:"ghost",color:"neutral",size:"small",style:{borderRadius:"var(--radius-sm)"}})]})]}),e.jsx("div",{className:"ui-calendar__sidebar-body",children:s?s(t):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"ui-calendar__sidebar-section",children:[e.jsx("div",{className:"ui-calendar__sidebar-section-title",children:"When & Where"}),_t(t)?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"ui-calendar__sidebar-row",children:[e.jsx("span",{className:"ui-calendar__sidebar-row-label",children:"Dates"}),e.jsx("span",{className:"ui-calendar__sidebar-row-value",children:El(t.date,t.endDate)})]}),e.jsxs("div",{className:"ui-calendar__sidebar-row",children:[e.jsx("span",{className:"ui-calendar__sidebar-row-label",children:"Length"}),e.jsxs("span",{className:"ui-calendar__sidebar-row-value",children:[Tl(t.date,t.endDate)," days"]})]})]}):e.jsxs("div",{className:"ui-calendar__sidebar-row",children:[e.jsx("span",{className:"ui-calendar__sidebar-row-label",children:"Date"}),e.jsx("span",{className:"ui-calendar__sidebar-row-value",children:Dl(t.date,t.time)})]}),!_t(t)&&t.duration&&e.jsxs("div",{className:"ui-calendar__sidebar-row",children:[e.jsx("span",{className:"ui-calendar__sidebar-row-label",children:"Duration"}),e.jsxs("span",{className:"ui-calendar__sidebar-row-value",children:[t.duration," min"]})]}),t.platform&&e.jsxs("div",{className:"ui-calendar__sidebar-row",children:[e.jsx("span",{className:"ui-calendar__sidebar-row-label",children:"Platform"}),e.jsx("span",{className:"ui-calendar__sidebar-row-value",children:t.platform})]}),t.meetLink&&e.jsx("a",{className:"ui-calendar__sidebar-link",href:t.meetLink,target:"_blank",rel:"noopener noreferrer",children:"🔗 Join meeting"})]}),t.notes&&e.jsxs("div",{className:"ui-calendar__sidebar-section",children:[e.jsx("div",{className:"ui-calendar__sidebar-section-title",children:"Notes"}),e.jsx("div",{className:"ui-calendar__sidebar-notes",children:t.notes})]})]})}),(i||o)&&e.jsxs("div",{className:"ui-calendar__sidebar-actions",children:[o&&e.jsx(Xe,{variant:"outlined",color:"error",size:"small",style:{flex:1},onClick:()=>o(t.id),children:"Delete"}),i&&e.jsx(Xe,{variant:"filled",color:"primary",size:"small",style:{flex:1},onClick:()=>i(t),children:"Edit"})]})]})};function Pl(t,n,s){const a=n.toLowerCase(),r=t.data?Object.values(t.data).map(String):[];return[t.title,t.notes,Et(t.category,s).label,...r].some(i=>i?.toLowerCase().includes(a))}function Na(t){const[n,s,a]=t.split("-").map(Number);return new Date(n,s-1,a).toLocaleDateString("en-US",{month:"short",day:"numeric"})}function zl(t){return _t(t)?`${Na(t.date)} – ${Na(t.endDate)}`:Na(t.date)}const Qs=({open:t,events:n,categoryMeta:s,onClose:a,onSelect:r})=>{const[i,o]=l.useState(""),[c,d]=l.useState(0),u=l.useRef(null);l.useEffect(()=>{t&&(o(""),d(0),setTimeout(()=>u.current?.focus(),50))},[t]);const p=l.useMemo(()=>i.trim()?n.filter(h=>Pl(h,i,s)).slice(0,20):[],[i,n,s]);l.useEffect(()=>{d(0)},[p.length]);const f=h=>{h.key==="ArrowDown"&&(h.preventDefault(),d(m=>Math.min(m+1,p.length-1))),h.key==="ArrowUp"&&(h.preventDefault(),d(m=>Math.max(m-1,0))),h.key==="Enter"&&p[c]&&(r(p[c]),a())};return e.jsx(ea,{open:t,onClose:a,closeOnBackdropClick:!0,closeOnEscape:!0,showCloseButton:!1,size:"medium",style:{padding:0,overflow:"hidden",borderRadius:12},children:e.jsxs("div",{className:"ui-calendar-search",onKeyDown:f,children:[e.jsx("div",{className:"ui-calendar-search__input-wrap",children:e.jsx(Ot,{ref:u,fullWidth:!0,placeholder:"Search events…",value:i,onChange:h=>o(h.target.value),autoComplete:"off",startAdornment:e.jsx("span",{children:"⌕"}),endAdornment:e.jsx("kbd",{className:"ui-calendar-search__kbd",children:"Esc"}),sx:{root:"ui-calendar-search__textfield"}})}),e.jsxs("div",{className:"ui-calendar-search__results",children:[i.trim()&&p.length===0&&e.jsxs("div",{className:"ui-calendar-search__empty",children:['No events found for "',i,'"']}),!i.trim()&&e.jsx("div",{className:"ui-calendar-search__empty",children:"Type to search events…"}),p.map((h,m)=>{const x=Et(h.category,s),v=fn(h,s);return e.jsxs("div",{className:`ui-calendar-search__result${m===c?" ui-calendar-search__result--active":""}`,onClick:()=>{r(h),a()},onMouseEnter:()=>d(m),children:[e.jsx("div",{className:"ui-calendar-search__result-icon",style:{background:x.bg,color:x.color},children:x.icon}),e.jsxs("div",{style:{flex:1,minWidth:0},children:[e.jsx("div",{className:"ui-calendar-search__result-name",children:v}),e.jsxs("div",{className:"ui-calendar-search__result-meta",children:[x.label,h.date?` · ${h.date}`:""]})]}),e.jsx("div",{className:"ui-calendar-search__result-date",children:zl(h)})]},h.id)})]})]})})};Qs.displayName="CalendarSearch";function Hl(t,n){if(t==="month"){const a=n.getFullYear(),r=n.getMonth(),o=(new Date(a,r,1).getDay()+6)%7,c=new Date(a,r,1-o),d=new Date(c);return d.setDate(c.getDate()+41),{start:c,end:d}}if(t==="week"){const a=zs(n),r=new Date(a);return r.setDate(a.getDate()+6),{start:a,end:r}}const s=new Date(n.getFullYear(),n.getMonth(),n.getDate());return{start:s,end:s}}const Rs=({events:t=[],defaultView:n="month",initialDate:s,categoryMeta:a,filterSections:r,filterValues:i,onFilterValuesChange:o,renderEvent:c,renderKPI:d,renderSidebarDetail:u,renderSidebarItem:p,renderFilterPanel:f,renderFilterPanelBody:h,onAddClick:m,onEditClick:x,onEventCreate:v,onEventDelete:g,onFilterChange:y,onNavigate:S,showSearch:k=!0,showFilters:L=!0,showSidebar:$=!0,pageMode:H=!1,sx:J,style:ee})=>{const D=i!==void 0,B=$t(new Date),ae=l.useMemo(()=>a??{},[a]),[F,ve]=l.useState(n),[me,Q]=l.useState(s??new Date),oe=me.getFullYear(),ye=me.getMonth(),ke=zs(me),Z=$t(me),[G,b]=l.useState(null),[A,I]=l.useState(null),[W,V]=l.useState(null),[be,w]=l.useState(!1),[R,re]=l.useState(!1),[ue,P]=l.useState(!1),ie=l.useMemo(()=>r??[],[r]),[$e,Pe]=l.useState({}),he=D?i:$e,Ce=l.useCallback(fe=>{if(D){const De=typeof fe=="function"?fe(i):fe;o?.(De)}else Pe(fe)},[D,i,o]);l.useEffect(()=>{S&&S(Hl(F,me))},[F,me,S]),l.useEffect(()=>{y?.(he)},[he,y]);const _e=l.useCallback(fe=>{Q(De=>{const Ne=new Date(De);return F==="month"&&Ne.setMonth(De.getMonth()+fe),F==="week"&&Ne.setDate(De.getDate()+fe*7),F==="day"&&Ne.setDate(De.getDate()+fe),Ne})},[F]),ze=l.useCallback(()=>Q(new Date),[]),C=l.useCallback(()=>{Ce(Object.fromEntries(ie.map(fe=>fe.type==="daterange"?[fe.id,{start:null,end:null}]:fe.type==="select"&&!fe.multiple?[fe.id,null]:[fe.id,[]])))},[ie,Ce]);l.useEffect(()=>{const fe=!!(m||v),De=Ne=>{if(!(["INPUT","TEXTAREA","SELECT"].includes(Ne.target?.tagName)&&Ne.key!=="Escape")){if((Ne.ctrlKey||Ne.metaKey)&&Ne.key==="k"&&k){Ne.preventDefault(),re(!0);return}if(Ne.key==="Escape"){if(R){re(!1);return}if(be){w(!1),b(null),I(null);return}return}if(Ne.key==="]"&&$){w(le=>!le);return}if(Ne.key==="ArrowLeft"&&!R){_e(-1);return}if(Ne.key==="ArrowRight"&&!R){_e(1);return}Ne.key==="n"&&!R&&fe&&m&&m(void 0)}};return window.addEventListener("keydown",De),()=>window.removeEventListener("keydown",De)},[R,be,_e,k,$,m,v]);const q=l.useCallback(fe=>{V(A),b(fe),I(null),$&&w(!0)},[$,A]),ne=l.useCallback(fe=>{I(fe),b(null),$&&w(!0)},[$]),j=l.useCallback(fe=>{V(null),b(fe),Q(vl(fe.date)),$&&w(!0),re(!1)},[$]),z=l.useCallback(fe=>{g?.(fe),b(null),V(null),w(!1)},[g]),U=l.useCallback(()=>{b(null),I(W),V(null)},[W]),X=l.useCallback(fe=>{x?.(fe)},[x]),we=l.useMemo(()=>A?t.filter(fe=>Ps(fe,A)):[],[t,A]),N=!!(m||v),de=["ui-calendar",H&&"ui-calendar--page",J].filter(Boolean).join(" ");return e.jsxs("div",{className:de,style:ee,children:[e.jsx(Fs,{view:F,year:oe,month:ye,weekStart:ke,dayDate:Z,onViewChange:ve,onPrev:()=>_e(-1),onNext:()=>_e(1),onToday:ze,onSearch:k?()=>re(!0):void 0,onFilter:L?()=>P(fe=>!fe):void 0,onAdd:N?()=>{m&&m(void 0)}:void 0,showSearch:k,showFilters:L,showAdd:N,filterOpen:ue}),d&&d(),e.jsxs("div",{className:"ui-calendar__body",children:[L&&(f?f({isOpen:ue,onClose:()=>P(!1)}):e.jsx(Os,{isOpen:ue,onClose:()=>P(!1),sections:ie,value:he,onChange:Ce,onReset:C,renderBody:h})),e.jsx("div",{className:"ui-calendar__main",children:e.jsxs("div",{className:"ui-calendar__grid",children:[F==="month"&&e.jsx(Ks,{events:t,year:oe,month:ye,today:B,categoryMeta:ae,renderEvent:c,onEventClick:q,onDayClick:ne}),F==="week"&&e.jsx(Gs,{events:t,weekStart:ke,today:B,categoryMeta:ae,renderEvent:c,onEventClick:q,onDayClick:ne}),F==="day"&&e.jsx(Js,{events:t,date:Z,categoryMeta:ae,renderEvent:c,onEventClick:q})]})}),$&&e.jsx(Zs,{event:G,dayDate:A,dayEvents:we,isOpen:be,categoryMeta:ae,renderSidebarDetail:u,renderSidebarItem:p,onClose:()=>{w(!1),b(null),I(null),V(null)},onBack:W?U:void 0,onEventClick:q,onEdit:x?X:void 0,onDelete:g?z:void 0})]}),k&&e.jsx(Qs,{open:R,events:t,categoryMeta:ae,onClose:()=>re(!1),onSelect:j})]})};Rs.displayName="Calendar";const Bl={primary:"var(--palette-primary-main, #4299e1)",success:"var(--palette-success-main, #38a169)",warning:"var(--palette-warning-main, #f97316)",error:"var(--palette-error-main, #d32f2f)",info:"var(--palette-info-main, #0ea5e9)"};function Ol(t){if(t)return Bl[t]??t}const er=({metrics:t})=>t.length===0?null:e.jsx("div",{className:"ui-calendar__kpi",role:"list","aria-label":"KPI metrics",children:t.map((n,s)=>{const a=Ol(n.color);return e.jsxs("div",{className:`ui-calendar__kpi-item${n.onClick?" ui-calendar__kpi-item--clickable":""}`,onClick:n.onClick,role:n.onClick?"button":"listitem",tabIndex:n.onClick?0:void 0,onKeyDown:n.onClick?r=>{r.key==="Enter"&&n.onClick()}:void 0,children:[a&&e.jsx("span",{className:"ui-calendar__kpi-dot",style:{background:a}}),e.jsx("span",{className:"ui-calendar__kpi-value",children:n.value}),e.jsx("span",{className:"ui-calendar__kpi-label",children:n.label})]},s)})});er.displayName="CalendarKPIStrip";const Fl={palette:["--palette-primary-main","--palette-primary-light","--palette-primary-dark","--palette-primary-contrast-text","--palette-secondary-main","--palette-secondary-light","--palette-secondary-dark","--palette-secondary-contrast-text","--palette-success-main","--palette-success-light","--palette-success-dark","--palette-success-contrast-text","--palette-tertiary-main","--palette-tertiary-light","--palette-tertiary-dark","--palette-tertiary-contrast-text","--palette-warning-main","--palette-warning-light","--palette-warning-dark","--palette-warning-contrast-text","--palette-error-main","--palette-error-light","--palette-error-dark","--palette-error-contrast-text","--palette-info-main","--palette-info-light","--palette-info-dark","--palette-info-contrast-text","--palette-common-white","--palette-common-black","--palette-background-default","--palette-background-paper","--palette-text-primary","--palette-text-secondary","--palette-divider","--palette-action-hover","--palette-action-selected","--palette-action-disabled","--palette-action-disabledBackground","--palette-overlay-subtle","--palette-overlay-subtle-hover","--palette-badge-bg","--palette-primary-shadow","--palette-primary-shadow-strong","--palette-primary-overlay","--palette-primary-border","--palette-overlay-on-dark"],department:["--department-all-default","--department-all-hover","--department-all-active","--department-design-default","--department-design-hover","--department-design-active","--department-development-default","--department-development-hover","--department-development-active","--department-management-default","--department-management-hover","--department-management-active","--department-marketing-default","--department-marketing-hover","--department-marketing-active","--department-video-default","--department-video-hover","--department-video-active"],layout:["--layout-columns","--layout-gutter","--layout-max-width"],spacing:["--space-xs","--space-sm","--space-md","--space-lg","--space-xl","--space-2xl","--space-3xl"],fluidSpacing:["--space-fluid-xs","--space-fluid-sm","--space-fluid-md","--space-fluid-lg","--space-fluid-xl","--space-fluid-2xl","--space-fluid-3xl"],breakpoint:["--breakpoint-mobile-min","--breakpoint-mobile-max","--breakpoint-tablet-min","--breakpoint-tablet-max","--breakpoint-desktop-min","--breakpoint-desktop-max","--breakpoint-large-desktop-min","--breakpoint-large-desktop-max","--breakpoint-extra-large-min"],typography:["--font-family-base","--font-weight-regular","--font-weight-medium","--font-weight-semibold","--h1-font-size","--h1-font-line-height","--h2-font-size","--h2-font-line-height","--h3-font-size","--h3-font-line-height","--h4-font-size","--h4-font-line-height","--h5-font-size","--h5-font-line-height","--body-regular-font-size","--body-regular-font-line-height","--body-medium-font-size","--body-medium-font-line-height","--body-small-font-size","--body-small-font-line-height","--caption-font-size","--caption-font-line-height"],zIndex:["--z-index-dropdown","--z-index-sticky","--z-index-fixed","--z-index-backdrop","--z-index-modal","--z-index-popover","--z-index-tooltip"],motion:["--motion-fast","--motion-normal","--motion-slow","--motion-easing"],shadow:["--shadow-light","--shadow-card","--shadow-card-elevated","--shadow-card-hover","--shadow-medium","--shadow-heavy","--shadow-avatar","--shadow-badge","--shadow-primary-glow","--shadow-primary-glow-strong"],radius:["--radius-xs","--radius-sm","--radius-md","--radius-lg","--radius-xl","--radius-2xl","--radius-3xl","--radius-full"],gradient:["--gradient-primary-start","--gradient-primary-end","--gradient-primary-horizontal","--gradient-primary-vertical","--gradient-primary-diagonal","--gradient-primary-radial","--gradient-secondary-start","--gradient-secondary-end","--gradient-secondary-horizontal","--gradient-secondary-vertical","--gradient-secondary-diagonal","--gradient-secondary-radial","--gradient-success-horizontal","--gradient-success-diagonal","--gradient-tertiary-horizontal","--gradient-tertiary-diagonal","--gradient-warning-horizontal","--gradient-error-horizontal","--gradient-info-horizontal","--gradient-primary-secondary-horizontal","--gradient-primary-secondary-diagonal","--gradient-primary-tertiary-horizontal","--gradient-primary-success-horizontal","--gradient-success-tertiary-horizontal"],component:["--button-padding-x","--button-padding-y","--button-border-width","--button-border-radius","--textfield-border-color","--textfield-border-radius","--textfield-padding-x","--textfield-padding-y"]};te.Accordion=cs,te.AccordionContent=pa,te.AccordionItem=ua,te.AccordionRoot=da,te.AccordionTrigger=ha,te.Autocomplete=Zn,te.Avatar=Kt,te.AvatarGroup=xa,te.Badge=St,te.Button=Xe,te.Calendar=Rs,te.CalendarKPIStrip=er,te.Checkbox=ca,te.Chip=mt,te.ConfirmDialog=fa,te.ConfirmProvider=_s,te.CourseCard=Ji,te.DatePicker=ia,te.Drawer=Xa,te.Dropdown=Jn,te.DropdownItem=Xn,te.EmployeeCard=Ds,te.FilterPanel=ii,te.Header=Es,te.IconButton=Ie,te.Layout=Ts,te.LessonCard=rl,te.Logo=ba,te.Modal=ea,te.Pagination=Ns,te.Portal=cn,te.Select=$n,te.Sidebar=ja,te.Spinner=ws,te.TOKEN_CATEGORIES=Fl,te.Tab=ga,te.TabList=bs,te.TabPanel=js,te.Table=ms,te.Tabs=vs,te.Tags=Oa,te.TaskCard=Is,te.TextField=Ot,te.TimePicker=ss,te.Toast=va,te.ToastProvider=ks,te.Toggle=gs,te.Tooltip=Je,te.VideoCard=_r,te.getGradientClassName=Un,te.getGradientStyle=Gn,te.isCustomGradient=Kn,te.useConfirm=Mi,te.useEscapeKey=At,te.useFloatingPosition=Pa,te.useFocusTrap=Rn,te.useLockScroll=zn,te.usePortal=Dn,te.useTheme=Qr,te.useToast=$i,Object.defineProperty(te,Symbol.toStringTag,{value:"Module"})}));
6
+ <%s key={someKey} {...props} />`,W,w,R,w),G[w+W]=!0)}if(w=null,I!==void 0&&(s(I),w=""+I),o(A)&&(s(A.key),w=""+A.key),"key"in A){I={};for(var ie in A)ie!=="key"&&(I[ie]=A[ie])}else I=A;return w&&c(I,typeof b=="function"?b.displayName||b.name||"Unknown":b),u(b,w,I,r(),V,ve)}function f(b){h(b)?b._store&&(b._store.validated=1):typeof b=="object"&&b!==null&&b.$$typeof===D&&(b._payload.status==="fulfilled"?h(b._payload.value)&&b._payload.value._store&&(b._payload.value._store.validated=1):b._store&&(b._store.validated=1))}function h(b){return typeof b=="object"&&b!==null&&b.$$typeof===x}var m=l,x=Symbol.for("react.transitional.element"),v=Symbol.for("react.portal"),g=Symbol.for("react.fragment"),y=Symbol.for("react.strict_mode"),S=Symbol.for("react.profiler"),k=Symbol.for("react.consumer"),T=Symbol.for("react.context"),$=Symbol.for("react.forward_ref"),H=Symbol.for("react.suspense"),Z=Symbol.for("react.suspense_list"),te=Symbol.for("react.memo"),D=Symbol.for("react.lazy"),B=Symbol.for("react.activity"),ne=Symbol.for("react.client.reference"),F=m.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Ne=Object.prototype.hasOwnProperty,ue=Array.isArray,J=console.createTask?console.createTask:function(){return null};m={react_stack_bottom_frame:function(b){return b()}};var re,je={},ye=m.react_stack_bottom_frame.bind(m,i)(),Q=J(a(i)),G={};sn.Fragment=g,sn.jsx=function(b,A,I){var W=1e4>F.recentlyCreatedOwnerStacks++;return p(b,A,I,!1,W?Error("react-stack-top-frame"):ye,W?J(a(b)):Q)},sn.jsxs=function(b,A,I){var W=1e4>F.recentlyCreatedOwnerStacks++;return p(b,A,I,!0,W?Error("react-stack-top-frame"):ye,W?J(a(b)):Q)}})()),sn}var La;function or(){return La||(La=1,process.env.NODE_ENV==="production"?Sn.exports=ir():Sn.exports=lr()),Sn.exports}var e=or();function Kn(t){return typeof t=="object"&&"from"in t&&"to"in t}function Un(t){return typeof t=="string"?`ui-gradient--${t}`:null}function qn(t){return t.startsWith("#")?t:`var(${t.includes("-")?`--palette-${t}`:t})`}function Gn(t){const n=t.direction||"diagonal",s={horizontal:"90deg",vertical:"180deg",diagonal:"135deg",radial:"circle"},a=qn(t.from),r=qn(t.to),i=t.via?qn(t.via):null,c=n==="radial"?"radial-gradient":"linear-gradient",d=s[n];return i?`${c}(${d}, ${a} 0%, ${i} 50%, ${r} 100%)`:`${c}(${d}, ${a} 0%, ${r} 100%)`}const Xe=({variant:t="filled",color:n="primary",gradient:s,size:a="medium",disabled:r=!1,children:i,sx:o,style:c,...d})=>{const u=!!s,p=`ui-button ui-button--${t} ui-button--${a}`,h=c?.background||c?.backgroundColor||c?.color?"":u?typeof s=="string"?Un(s):"ui-button--custom-gradient":`ui-button--${n}`,x=`${p} ${h} ${r?"ui-button--disabled":""}`.trim(),v=o?`${x} ${o}`.trim():x,y={...u&&Kn(s)&&t==="filled"?{background:Gn(s)}:void 0,...c};return e.jsx("button",{className:v,disabled:r,style:y,...d,children:i})},cr="ui-kit-portal-root";function Dn(t){const{containerId:n=cr,containerElement:s}=t||{},[a,r]=l.useState(null);return l.useEffect(()=>{if(typeof document>"u")return;if(s){r(s);return}let i=document.getElementById(n);return i||(i=document.createElement("div"),i.id=n,i.setAttribute("data-ui-kit-portal","true"),document.body.appendChild(i)),r(i),()=>{i&&i.id===n&&i.childNodes.length===0&&i.parentNode&&i.parentNode.removeChild(i)}},[n,s]),a}const Aa=150,Ia=48,dr=t=>{const[n,s]=t.split("-");return{side:n,align:s??"center"}};function Pa(t){const{triggerRef:n,floatingRef:s,open:a,placement:r="bottom-start",gap:i=8,maxHeight:o=320,matchWidth:c=!1,zIndex:d}=t,{side:u,align:p}=dr(r),[f,h]=l.useState({}),[m,x]=l.useState(u),[v,g]=l.useState(!1),y=l.useRef(null);return l.useLayoutEffect(()=>{if(!a){g(!1);return}const S=()=>{y.current=null;const H=n.current;if(!H)return;const Z=H.getBoundingClientRect(),te=s.current?.offsetHeight??0,D=s.current?.offsetWidth??0,B=Math.min(te||o,o),ne=window.innerWidth,F=window.innerHeight,Ne=F-Z.bottom-i,ue=Z.top-i;let J=u;if(u==="bottom"){const G=Ne<Aa,b=B>Ne&&ue>Ne+Ia;(G?ue>Ne:b)&&(J="top")}else{const G=ue<Aa,b=B>ue&&Ne>ue+Ia;(G?Ne>ue:b)&&(J="bottom")}const re=8,je=c?Z.width:D;let ye;c||p==="start"?ye=Z.left:p==="end"?ye=Z.right-(je||0):ye=Z.left+Z.width/2-(je||0)/2,je&&(ye=Math.max(re,Math.min(ye,ne-je-re)));const Q={position:"fixed",left:ye,zIndex:d??"var(--z-index-dropdown, 1000)"};c&&(Q.width=je),J==="bottom"?(Q.top=Z.bottom+i,Q.maxHeight=Math.min(o,Math.max(0,Ne))):(Q.bottom=F-Z.top+i,Q.maxHeight=Math.min(o,Math.max(0,ue))),x(J),h(Q),g(!0)},k=()=>{y.current===null&&(y.current=requestAnimationFrame(S))};S(),window.addEventListener("scroll",k,!0),window.addEventListener("resize",k);const T=n.current,$=typeof ResizeObserver<"u"?new ResizeObserver(k):null;return T&&$&&$.observe(T),s.current&&$&&$.observe(s.current),()=>{window.removeEventListener("scroll",k,!0),window.removeEventListener("resize",k),y.current!==null&&cancelAnimationFrame(y.current),y.current=null,$?.disconnect()}},[a,r,i,o,c,d]),{style:f,side:m,ready:v}}const bt=l.createContext(null),rn=10,za=20,Ha=1050,Ba=l.createContext({variant:"menu"}),Xn=({children:t,disabled:n,selected:s,onClick:a,sx:r,style:i})=>{const{variant:o}=l.useContext(Ba),c=o==="menu"&&!n,d=u=>{(u.key==="Enter"||u.key===" ")&&(u.preventDefault(),a?.())};return e.jsx("div",{className:`ui-dropdown__item${n?" ui-dropdown__item--disabled":""}${s?" ui-dropdown__item--selected":""}${r?` ${r}`:""}`,style:i,role:"menuitem","aria-disabled":n,"aria-selected":s,tabIndex:c?0:-1,onClick:c?a:void 0,onKeyDown:c?d:void 0,children:t})};Xn.displayName="DropdownItem";const Zn=({trigger:t,children:n,placement:s="bottom-end",divider:a=!1,variant:r="menu",portal:i=!1,sx:o,style:c})=>{const[d,u]=l.useState(!1),p=l.useRef(null),f=l.useRef(null),h=Dn(),m=l.useContext(bt),x=m?m.baseZ+rn:void 0,v=Pa({triggerRef:p,floatingRef:f,open:i&&d,placement:s,gap:8,zIndex:x,maxHeight:400}),g=l.useCallback(()=>{u(!1)},[]);l.useEffect(()=>{if(!d)return;const H=te=>{const D=te.target;!p.current?.contains(D)&&!f.current?.contains(D)&&g()};r==="menu"&&f.current?.querySelector('[role="menuitem"]:not([aria-disabled="true"])')?.focus();const Z=setTimeout(()=>document.addEventListener("click",H),0);return()=>{clearTimeout(Z),document.removeEventListener("click",H)}},[d,r,g]);const y=H=>{H.preventDefault(),H.stopPropagation(),u(Z=>!Z)},S=H=>{if(H.key==="Escape"){g();return}if(H.key==="Tab"){g();return}if(!d||r!=="menu")return;const Z=f.current?.querySelectorAll('[role="menuitem"]:not([aria-disabled="true"])');if(!Z?.length)return;const te=Array.from(Z),D=te.indexOf(document.activeElement);if(H.key==="ArrowDown"){H.preventDefault();const B=D<te.length-1?D+1:0;te[B].focus()}else if(H.key==="ArrowUp"){H.preventDefault();const B=D>0?D-1:te.length-1;te[B].focus()}},k=()=>{g()},T=["ui-dropdown__menu",!a&&"ui-dropdown__menu--no-divider",r==="info"&&"ui-dropdown__menu--info",i&&"ui-dropdown__menu--portal",o?.menu].filter(Boolean).join(" "),$=e.jsx("div",{ref:f,className:T,style:i?{...v.style,...c?.menu}:c?.menu,onClick:k,onKeyDown:S,"data-placement":i?`${v.side}-${s.split("-")[1]??"center"}`:void 0,children:n});return e.jsxs(Ba.Provider,{value:{variant:r},children:[e.jsxs("div",{ref:p,className:`ui-dropdown ui-dropdown--${s}${d?" ui-dropdown--open":""}${i?" ui-dropdown--portal":""}${o?.root?` ${o.root}`:""}`,style:c?.root,onKeyDown:S,children:[e.jsx("span",{style:{display:"contents"},onClick:y,children:t}),!i&&$]}),i&&d&&h&&Mt.createPortal($,h)]})};Zn.displayName="Dropdown";const Ot=l.forwardRef(({label:t,helperText:n,error:s=!1,multiline:a=!1,rows:r=3,startAdornment:i,endAdornment:o,fullWidth:c=!1,size:d="normal",disabled:u=!1,placeholder:p,sx:f,id:h,...m},x)=>{const v=l.useId(),g=h||v,y=n?`${g}-helper-text`:void 0,S=(...Z)=>Z.filter(Boolean).join(" "),k=S("ui-textfield",c&&"ui-textfield--full-width",f?.root),T=S("ui-textfield__wrapper",`ui-textfield__wrapper--${d}`,s&&"ui-textfield__wrapper--error",u&&"ui-textfield__wrapper--disabled",!!i&&"ui-textfield__wrapper--with-start-adornment",!!o&&"ui-textfield__wrapper--with-end-adornment",f?.wrapper),$=S("ui-textfield__input",`ui-textfield__input--${d}`,a&&"ui-textfield__input--textarea",f?.input),H=a?"textarea":"input";return e.jsxs("div",{className:k,children:[t&&e.jsxs("label",{htmlFor:g,className:S("ui-textfield__label",s&&"ui-textfield__label--error",f?.label),children:[t,m.required&&e.jsx("span",{className:"ui-textfield__label-required",children:"*"})]}),e.jsxs("div",{className:T,children:[i&&e.jsx("span",{className:"ui-textfield__adornment ui-textfield__adornment--start",children:i}),e.jsx(H,{ref:x,id:g,className:$,disabled:u,rows:a?r:void 0,placeholder:p,"aria-label":t?void 0:p,"aria-invalid":s,"aria-describedby":y,...m}),o&&e.jsx("span",{className:"ui-textfield__adornment ui-textfield__adornment--end",children:o})]}),n&&e.jsx("p",{id:y,className:S("ui-textfield__helper-text",s&&"ui-textfield__helper-text--error",f?.helperText),children:n})]})});Ot.displayName="TextField";const mt=({label:t,leadingIcon:n,trailingIcon:s,variant:a="filled",color:r="neutral",size:i="medium",selected:o=!1,disabled:c=!1,onClick:d,onDelete:u,sx:p,style:f})=>{const h=!!d&&!c,m=["ui-chip",`ui-chip--${a}`,`ui-chip--${r}`,`ui-chip--${i}`,o&&"ui-chip--selected",c&&"ui-chip--disabled",h&&"ui-chip--clickable",p].filter(Boolean).join(" "),x=g=>{c||d?.(g)},v=g=>{g.stopPropagation(),!c&&u?.(g)};return e.jsxs("div",{className:m,style:f,role:h?"button":void 0,tabIndex:h?0:void 0,"aria-pressed":h&&o?!0:void 0,"aria-disabled":c?!0:void 0,onClick:x,onKeyDown:h?g=>{(g.key==="Enter"||g.key===" ")&&(g.preventDefault(),d?.(g))}:void 0,children:[n&&e.jsx("span",{className:"ui-chip__icon ui-chip__icon--leading","aria-hidden":"true",children:n}),e.jsx("span",{className:"ui-chip__label",children:t}),!u&&s&&e.jsx("span",{className:"ui-chip__icon ui-chip__icon--trailing","aria-hidden":"true",children:s}),u&&e.jsx("button",{type:"button",className:"ui-chip__delete","aria-label":`Remove ${t}`,disabled:c,onClick:v,tabIndex:c?-1:0,children:e.jsx("svg",{className:"ui-chip__delete-icon",viewBox:"0 0 24 24","aria-hidden":"true",focusable:"false",children:e.jsx("path",{d:"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"})})})]})};mt.displayName="Chip";const ln=8,En=320,ur=150,hr=48,Oa=(t,n)=>{const s=window.innerHeight-t.bottom-ln,a=t.top-ln,r=Math.min(n,En);return(s<ur?a>s:r>s&&a>s+hr)?{bottom:window.innerHeight-t.top+ln,left:t.left,width:t.width,maxHeight:Math.min(En,a)}:{top:t.bottom+ln,left:t.left,width:t.width,maxHeight:Math.min(En,s)}},St=(...t)=>t.filter(Boolean).join(" "),$n=l.forwardRef(({options:t,label:n,placeholder:s="Select...",multiple:a=!1,disabled:r=!1,size:i="normal",sx:o,id:c,value:d,defaultValue:u,onChange:p,error:f=!1,helperText:h,fullWidth:m=!1,clearable:x=!1,chipDisplay:v="inside",chipProps:g,required:y=!1,...S},k)=>{const T=l.useId(),$=c||T,H=n?`${$}-label`:void 0,Z=`${$}-listbox`,te=h?`${$}-helper-text`:void 0,D=l.useRef(null),B=l.useRef(null),ne=l.useRef(null),F=l.useRef(null),Ne=l.useContext(bt),ue=Ne?Ne.baseZ+rn:void 0,[J,re]=l.useState(!1),[je,ye]=l.useState(null),[Q,G]=l.useState(!1),[b,A]=l.useState(u!==void 0?a?Array.isArray(u)?u:[u]:u:a?[]:null),[I,W]=l.useState(-1),V=["small","normal","large"].includes(i)?i:"normal";process.env.NODE_ENV!=="production"&&i!==V&&console.warn(`Select: Invalid size "${i}". Using "normal" instead.`);const ve=d!==void 0,w=ve?d:b,R=t.length>0&&"options"in t[0],ie=R?t.flatMap(j=>j.options):t,he=ie.filter(j=>!j.disabled),P=l.useCallback(()=>{re(!1),W(-1)},[]);l.useEffect(()=>{const j=D.current;if(!j)return;if(!J){ye(null),G(!1);return}const z=j.getBoundingClientRect();ye({top:z.bottom+ln,left:z.left,width:z.width,maxHeight:En}),G(!1);const U=ke=>{!B.current?.contains(ke.target)&&!ne.current?.contains(ke.target)&&P()};setTimeout(()=>document.addEventListener("click",U),0);const X=()=>{!ne.current||!D.current||ye(Oa(D.current.getBoundingClientRect(),ne.current.offsetHeight))};return window.addEventListener("scroll",X,!0),window.addEventListener("resize",X),()=>{window.removeEventListener("scroll",X,!0),window.removeEventListener("resize",X),document.removeEventListener("click",U)}},[J,P]),l.useLayoutEffect(()=>{if(!J||Q||!ne.current||!D.current)return;const j=D.current.getBoundingClientRect();ye(Oa(j,ne.current.offsetHeight)),G(!0)},[J,je,Q]),l.useEffect(()=>{if(I<0||!F.current)return;F.current.querySelectorAll('[role="option"]')[I]?.scrollIntoView({block:"nearest"})},[I]);const le=j=>{ve||A(j),p?.(j),!a&&j!==null&&P()},$e=j=>{if(a){const z=Array.isArray(w)?w:[],U=z.includes(j)?z.filter(X=>X!==j):[...z,j];le(U.length>0?U:[])}else le(j),D.current?.focus()},Pe=(j,z)=>{j.preventDefault(),j.stopPropagation();const X=(Array.isArray(w)?w:[]).filter(ke=>ke!==z);le(X.length>0?X:[])},pe=j=>{j.preventDefault(),j.stopPropagation(),le(a?[]:null),D.current?.focus()},Ce=j=>{if(he.length===0)return;let z=-1;if(I>=0&&I<ie.length){const X=ie[I];z=he.findIndex(ke=>ke.value===X?.value)}const U=j==="next"?(z+1)%he.length:z<=0?he.length-1:z-1;W(ie.findIndex(X=>X.value===he[U].value))},_e=(j,z)=>{if(!(r&&!z))switch(j.key){case"Enter":case" ":{if(j.preventDefault(),z&&I>=0&&I<ie.length){const U=ie[I];U.disabled||$e(U.value)}else re(!J),J||W(-1);break}case"ArrowDown":{j.preventDefault(),!J&&!z?(re(!0),W(-1)):Ce("next");break}case"ArrowUp":{j.preventDefault(),J&&Ce("prev");break}case"Escape":{j.preventDefault(),P(),z||D.current?.focus();break}case"Tab":{P();break}}},ze=a&&Array.isArray(w)?w:[],C=j=>j.map(z=>{const U=ie.find(X=>X.value===z);return e.jsx(mt,{label:U?.label??z,variant:g?.variant??"filled",color:g?.color??"neutral",size:g?.size??"small",leadingIcon:g?.leadingIcon,sx:g?.sx,disabled:r,onDelete:r?void 0:X=>Pe(X,z)},z)}),q=()=>{if(a)return v==="outside"?ze.length?null:e.jsx("span",{className:"ui-select__placeholder",children:s}):ze.length?e.jsx(e.Fragment,{children:C(ze)}):e.jsx("span",{className:"ui-select__placeholder",children:s});if(!w||w==="")return e.jsx("span",{className:"ui-select__placeholder",children:s});const j=ie.find(z=>z.value===w);return j?e.jsx("span",{className:"ui-select__value",children:j.label}):e.jsx("span",{className:"ui-select__placeholder",children:s})},ae=a?Array.isArray(w)&&w.length>0:w!==null&&w!=="";return e.jsxs("div",{ref:B,className:St("ui-select",a&&"ui-select--multiple",m&&"ui-select--full-width",o?.root),style:{position:"relative"},children:[n&&e.jsxs("label",{id:H,htmlFor:$,className:St("ui-select__label",f&&"ui-select__label--error",o?.label),children:[n,y&&e.jsx("span",{className:"ui-select__label-required",children:"*"})]}),a&&v==="outside"&&ze.length>0&&e.jsx("div",{className:"ui-select__chips-outside",children:C(ze)}),e.jsxs("button",{...S,ref:j=>{typeof k=="function"?k(j):k&&(k.current=j),D.current=j},id:$,"aria-labelledby":H,"aria-haspopup":"listbox","aria-expanded":J,"aria-controls":Z,"aria-disabled":r,"aria-invalid":f,"aria-describedby":te,disabled:r,onClick:j=>{if(j.preventDefault(),j.stopPropagation(),!r){const z=!J;re(z),z&&W(-1)}},onBlur:j=>{const z=j.relatedTarget;!B.current?.contains(z)&&!ne.current?.contains(z)&&P()},onKeyDown:j=>_e(j,!1),className:St("ui-select__trigger",`ui-select__trigger--${V}`,a&&"ui-select__trigger--multi",a&&v==="inside"&&ze.length>0&&"ui-select__trigger--has-chips",r&&"ui-select__trigger--disabled",f&&"ui-select__trigger--error",J&&"base--expanded",o?.trigger),"aria-label":n||s,type:"button",children:[q(),x&&ae&&e.jsx("span",{role:"button",className:"ui-select__clear",onClick:pe,onKeyDown:j=>{(j.key==="Enter"||j.key===" ")&&(j.preventDefault(),pe({preventDefault:()=>{},stopPropagation:()=>{}}))},"aria-label":"Clear selection",tabIndex:0,children:e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),e.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),J&&je&&Mt.createPortal(e.jsx("div",{ref:ne,className:St("ui-select__popup",o?.popup),style:{position:"fixed",top:je.top,bottom:je.bottom,left:je.left,width:je.width,visibility:Q?"visible":"hidden",...ue!==void 0?{zIndex:ue}:null},onClick:j=>j.stopPropagation(),children:e.jsx("ul",{ref:F,id:Z,role:"listbox","aria-multiselectable":a,"aria-labelledby":H,onKeyDown:j=>_e(j,!0),className:St("ui-select__listbox",`ui-select__listbox--${V}`,a&&"ui-select__listbox--multiple",r&&"base--disabled",o?.listbox),style:{maxHeight:je?.maxHeight},children:ie.length===0?e.jsx("li",{className:"ui-select__empty",role:"presentation",children:"No options found"}):R?t.map(j=>e.jsxs(l.Fragment,{children:[e.jsx("li",{role:"presentation",className:"ui-select__group-label",children:j.label}),j.options.map(z=>{const U=ie.findIndex(ke=>ke.value===z.value),X=a?Array.isArray(w)&&w.includes(z.value):w===z.value;return e.jsx("li",{role:"option","aria-selected":X,"aria-disabled":z.disabled,"aria-posinset":U+1,"aria-setsize":ie.length,onClick:ke=>{ke.preventDefault(),ke.stopPropagation(),z.disabled||$e(z.value)},onMouseDown:ke=>{ke.preventDefault(),ke.stopPropagation()},onMouseEnter:()=>W(U),className:St("ui-select__option",a?"ui-select__option--multi":"ui-select__option--single",X&&"base--selected",I===U&&"base--highlighted",z.disabled&&"base--disabled",o?.option),style:{cursor:z.disabled?"not-allowed":"pointer"},children:e.jsxs("span",{className:"ui-select__option-body",children:[e.jsx("span",{className:"ui-select__option-label",children:z.label}),z.description&&e.jsx("span",{className:"ui-select__option-description",children:z.description})]})},z.value)})]},j.label)):ie.map((j,z)=>{const U=a?Array.isArray(w)&&w.includes(j.value):w===j.value;return e.jsx("li",{role:"option","aria-selected":U,"aria-disabled":j.disabled,"aria-posinset":z+1,"aria-setsize":ie.length,onClick:X=>{X.preventDefault(),X.stopPropagation(),j.disabled||$e(j.value)},onMouseDown:X=>{X.preventDefault(),X.stopPropagation()},onMouseEnter:()=>W(z),className:St("ui-select__option",a?"ui-select__option--multi":"ui-select__option--single",U&&"base--selected",I===z&&"base--highlighted",j.disabled&&"base--disabled",o?.option),style:{cursor:j.disabled?"not-allowed":"pointer"},children:e.jsxs("span",{className:"ui-select__option-body",children:[e.jsx("span",{className:"ui-select__option-label",children:j.label}),j.description&&e.jsx("span",{className:"ui-select__option-description",children:j.description})]})},j.value)})})}),document.body),h&&e.jsx("p",{id:te,className:St("ui-select__helper-text",f&&"ui-select__helper-text--error",o?.helperText),children:h})]})});$n.displayName="Select";const on=8,Tn=320,pr=150,mr=48,Fa=(t,n)=>{const s=window.innerHeight-t.bottom-on,a=t.top-on,r=Math.min(n,Tn);return(s<pr?a>s:r>s&&a>s+mr)?{bottom:window.innerHeight-t.top+on,left:t.left,width:t.width,maxHeight:Math.min(Tn,a)}:{top:t.bottom+on,left:t.left,width:t.width,maxHeight:Math.min(Tn,s)}},fr=(t,n)=>{const s=n.toLowerCase();return t.filter(a=>a.label.toLowerCase().includes(s)||a.description?.toLowerCase().includes(s))},Ft=(...t)=>t.filter(Boolean).join(" "),Jn=({options:t,label:n,placeholder:s="Search...",multiple:a=!1,disabled:r=!1,size:i="normal",sx:o,id:c,value:d,defaultValue:u,onChange:p,onSearchChange:f,filterOptions:h,error:m=!1,helperText:x,fullWidth:v=!1,clearable:g=!1,noOptionsText:y="No options found",required:S=!1,chipProps:k})=>{const T=l.useId(),$=c||T,H=n?`${$}-label`:void 0,Z=`${$}-listbox`,te=x?`${$}-helper-text`:void 0,D=l.useRef(null),B=l.useRef(null),ne=l.useRef(null),F=l.useRef(null),Ne=l.useContext(bt),ue=Ne?Ne.baseZ+rn:void 0,J=l.useRef(null),[re,je]=l.useState(!1),[ye,Q]=l.useState(null),[G,b]=l.useState(!1),[A,I]=l.useState(u!==void 0?a?Array.isArray(u)?u:[u]:u:a?[]:null),[W,V]=l.useState(-1),[ve,w]=l.useState(""),[R,ie]=l.useState(!1),he=d!==void 0,P=he?d:A,le=t.length>0&&"options"in t[0],$e=le?t.flatMap(O=>O.options):t,Pe=h??fr,pe=ve.trim()?Pe($e,ve):$e,Ce=pe.filter(O=>!O.disabled),_e=a||!P||P===""?"":$e.find(oe=>oe.value===P)?.label??(typeof P=="string"?P:""),ze=a||R?ve:_e,C=l.useCallback(()=>{je(!1),V(-1),w(""),ie(!1)},[]),q=l.useCallback(()=>{C()},[C]);l.useEffect(()=>{const O=B.current;if(!O)return;if(!re){Q(null),b(!1);return}const oe=O.getBoundingClientRect();Q({top:oe.bottom+on,left:oe.left,width:oe.width,maxHeight:Tn}),b(!1);const ge=Ae=>{!D.current?.contains(Ae.target)&&!F.current?.contains(Ae.target)&&q()};setTimeout(()=>document.addEventListener("click",ge),0);const be=()=>{!F.current||!B.current||Q(Fa(B.current.getBoundingClientRect(),F.current.offsetHeight))};return window.addEventListener("scroll",be,!0),window.addEventListener("resize",be),()=>{window.removeEventListener("scroll",be,!0),window.removeEventListener("resize",be),document.removeEventListener("click",ge)}},[re,q]),l.useLayoutEffect(()=>{if(!re||G||!F.current||!B.current)return;const O=B.current.getBoundingClientRect();Q(Fa(O,F.current.offsetHeight)),b(!0)},[re,ye,G]),l.useEffect(()=>{if(W<0||!J.current)return;J.current.querySelectorAll('[role="option"]')[W]?.scrollIntoView({block:"nearest"})},[W]);const ae=O=>{he||I(O),p?.(O)},j=O=>{if(a){const oe=Array.isArray(P)?P:[],ge=oe.includes(O)?oe.filter(be=>be!==O):[...oe,O];ae(ge.length>0?ge:[]),w(""),f?.(""),V(-1),ne.current?.focus()}else ae(O),w(""),ie(!1),je(!1),V(-1)},z=(O,oe)=>{O.preventDefault(),O.stopPropagation();const ge=Array.isArray(P)?P:[];ae(ge.filter(be=>be!==oe))},U=O=>{O.preventDefault(),O.stopPropagation(),ae(a?[]:null),w(""),ie(!1),ne.current?.focus()},X=O=>{if(Ce.length===0)return;let oe=-1;if(W>=0&&W<pe.length){const be=pe[W];oe=Ce.findIndex(Ae=>Ae.value===be?.value)}const ge=O==="next"?(oe+1)%Ce.length:oe<=0?Ce.length-1:oe-1;V(pe.findIndex(be=>be.value===Ce[ge].value))},ke=O=>{if(!r)switch(O.key){case"ArrowDown":{O.preventDefault(),re?X("next"):(je(!0),V(-1));break}case"ArrowUp":{O.preventDefault(),re&&X("prev");break}case"Enter":{if(O.preventDefault(),re&&W>=0&&W<pe.length){const oe=pe[W];oe.disabled||j(oe.value)}break}case"Escape":{O.preventDefault(),q();break}case"Backspace":{if(a&&ve===""){const oe=Array.isArray(P)?P:[];oe.length>0&&ae(oe.slice(0,-1))}break}case"Tab":{q();break}}},N=a&&Array.isArray(P)?P:[],de=a?N.length>0:P!==null&&P!==""&&P!==void 0,fe=()=>N.map(O=>{const oe=$e.find(ge=>ge.value===O);return e.jsx(mt,{label:oe?.label??O,variant:k?.variant??"filled",color:k?.color??"neutral",size:k?.size??"small",leadingIcon:k?.leadingIcon,sx:k?.sx,disabled:r,onDelete:r?void 0:ge=>z(ge,O)},O)}),De=()=>pe.length===0?e.jsx("li",{className:"ui-ac__empty",role:"presentation",children:y}):le&&!ve.trim()?t.map(O=>{const oe=O.options.filter(ge=>pe.some(be=>be.value===ge.value));return oe.length===0?null:e.jsxs(l.Fragment,{children:[e.jsx("li",{role:"presentation",className:"ui-ac__group-label",children:O.label}),oe.map(ge=>we(ge,pe.findIndex(be=>be.value===ge.value)))]},O.label)}):pe.map((O,oe)=>we(O,oe)),we=(O,oe)=>{const ge=a?Array.isArray(P)&&P.includes(O.value):P===O.value;return e.jsx("li",{role:"option","aria-selected":ge,"aria-disabled":O.disabled,"aria-posinset":oe+1,"aria-setsize":pe.length,onMouseDown:be=>{be.preventDefault(),be.stopPropagation()},onClick:be=>{be.preventDefault(),be.stopPropagation(),O.disabled||j(O.value)},onMouseEnter:()=>V(oe),className:Ft("ui-ac__option",ge&&"base--selected",W===oe&&"base--highlighted",O.disabled&&"base--disabled",o?.option),style:{cursor:O.disabled?"not-allowed":"pointer"},children:e.jsxs("span",{className:"ui-ac__option-body",children:[e.jsx("span",{className:"ui-ac__option-label",children:O.label}),O.description&&e.jsx("span",{className:"ui-ac__option-description",children:O.description})]})},O.value)};return e.jsxs("div",{ref:D,className:Ft("ui-ac",v&&"ui-ac--full-width",o?.root),children:[n&&e.jsxs("label",{id:H,htmlFor:`${$}-input`,className:Ft("ui-ac__label",m&&"ui-ac__label--error",o?.label),children:[n,S&&e.jsx("span",{className:"ui-ac__label-required",children:"*"})]}),e.jsxs("div",{ref:B,role:"combobox","aria-expanded":re,"aria-haspopup":"listbox","aria-owns":Z,className:Ft("ui-ac__trigger",`ui-ac__trigger--${i}`,a&&"ui-ac__trigger--multi",r&&"ui-ac__trigger--disabled",m&&"ui-ac__trigger--error",re&&"base--expanded",o?.trigger),onClick:()=>{r||ne.current?.focus()},children:[a&&fe(),e.jsx("input",{ref:ne,id:`${$}-input`,type:"text",role:"combobox","aria-autocomplete":"list","aria-controls":Z,"aria-expanded":re,"aria-labelledby":H,"aria-describedby":te,"aria-invalid":m,disabled:r,placeholder:a?N.length===0?s:"":s,value:ze,className:"ui-ac__input",autoComplete:"off",onFocus:()=>{r||(a||ie(!0),je(!0),V(-1))},onBlur:O=>{const oe=O.relatedTarget;!D.current?.contains(oe)&&!F.current?.contains(oe)&&q()},onChange:O=>{const oe=O.target.value;w(oe),f?.(oe),V(-1),re||je(!0)},onKeyDown:ke,onPaste:O=>{if(!a||r)return;const oe=O.clipboardData.getData("text");if(!/[\r\n\t]/.test(oe))return;O.preventDefault();const ge=oe.split(/[\r\n\t]+/).map(Ke=>Ke.trim()).filter(Boolean),be=Array.isArray(P)?P:[],Ae=[],We=[];ge.forEach(Ke=>{const ct=Ke.toLowerCase(),Qe=$e.find(gt=>!gt.disabled&&(gt.label.toLowerCase()===ct||gt.value.toLowerCase()===ct));Qe&&!be.includes(Qe.value)&&!Ae.includes(Qe.value)?Ae.push(Qe.value):Qe||We.push(Ke)}),Ae.length>0&&ae([...be,...Ae]);const ht=We.length>0?We[We.length-1]:"";w(ht),f?.(ht),V(-1),re||je(!0),ne.current?.focus()}}),g&&de&&!r&&e.jsx("button",{type:"button",className:"ui-ac__clear",onMouseDown:O=>{O.preventDefault(),U(O)},"aria-label":"Clear selection",tabIndex:-1,children:e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),e.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})}),e.jsx("span",{className:"ui-ac__arrow","aria-hidden":!0})]}),re&&ye&&Mt.createPortal(e.jsx("div",{ref:F,className:"ui-ac__popup",style:{position:"fixed",top:ye.top,bottom:ye.bottom,left:ye.left,width:ye.width,visibility:G?"visible":"hidden",...ue!==void 0?{zIndex:ue}:null},onMouseDown:O=>O.preventDefault(),onClick:O=>O.stopPropagation(),children:e.jsx("ul",{ref:J,id:Z,role:"listbox","aria-multiselectable":a,"aria-labelledby":H,className:Ft("ui-ac__listbox",`ui-ac__listbox--${i}`,o?.listbox),style:{maxHeight:ye?.maxHeight},children:De()})}),document.body),x&&e.jsx("p",{id:te,className:Ft("ui-ac__helper-text",m&&"ui-ac__helper-text--error",o?.helperText),children:x})]})};Jn.displayName="Autocomplete";const Va=({tags:t,size:n="medium",sx:s})=>e.jsx("div",{className:`ui-tags ui-tags--${n} ${s||""}`.trim(),children:t.map((a,r)=>{const i=a.department?`ui-tags__tag--${a.department}`:"ui-tags__tag--custom";return e.jsx("span",{className:`ui-tags__tag ${i}`,children:a.label},r)})}),_r=({thumbnailUrl:t,title:n,author:s,description:a,tags:r,duration:i,views:o,publishedAt:c,isInPlaylist:d=!1,onClick:u,sx:p})=>{const f=`ui-video-card ${p||""}`.trim();return e.jsxs("div",{className:f,onClick:u,children:[e.jsxs("div",{className:"ui-video-card__thumbnail",children:[t?e.jsx("img",{src:t,alt:n,className:"ui-video-card__thumbnail-image"}):e.jsx("div",{className:"ui-video-card__thumbnail-placeholder",children:e.jsx("span",{children:"Video"})}),d?e.jsx("div",{className:"ui-video-card__playlist-icon",children:e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z"}),e.jsx("path",{d:"M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12"}),e.jsx("path",{d:"M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17"})]})}):i&&e.jsx("span",{className:"ui-video-card__duration",children:i})]}),e.jsxs("div",{className:"ui-video-card__content",children:[e.jsxs("div",{className:"ui-video-card__header",children:[e.jsx("div",{className:"ui-video-card__avatar","data-department":s.department||"default",children:s.initials}),e.jsxs("div",{className:"ui-video-card__title-section",children:[e.jsx("h3",{className:"ui-video-card__title",children:n}),e.jsx("p",{className:"ui-video-card__author",children:s.name})]})]}),e.jsx("p",{className:"ui-video-card__description",children:a}),e.jsx(Va,{tags:r}),(o||c)&&e.jsxs("div",{className:"ui-video-card__meta",children:[o&&e.jsxs("span",{className:"ui-video-card__views",children:[o," views"]}),o&&c&&e.jsx("span",{className:"ui-video-card__separator",children:"•"}),c&&e.jsx("span",{className:"ui-video-card__published",children:c})]})]})]})},Dt=({label:t,icon:n,variant:s="filled",color:a="neutral",gradient:r,size:i="medium",sx:o,style:c})=>{const d=!!r,u=`ui-badge ui-badge--${s} ui-badge--${i}`,f=c?.background||c?.backgroundColor||c?.color?"":d?typeof r=="string"?Un(r):"ui-badge--custom-gradient":`ui-badge--${a}`,h=`${u} ${f}`.trim(),m=o?`${h} ${o}`.trim():h,v={...d&&Kn(r)&&s==="filled"?{background:Gn(r)}:void 0,...c};return e.jsxs("span",{className:m,role:"status",style:v,children:[n&&e.jsx("span",{className:"ui-badge__icon","aria-hidden":"true",children:n}),e.jsx("span",{className:"ui-badge__label",children:t})]})};Dt.displayName="Badge";var Ya={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},Wa=l.createContext&&l.createContext(Ya),gr=["attr","size","title"];function xr(t,n){if(t==null)return{};var s=vr(t,n),a,r;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(r=0;r<i.length;r++)a=i[r],!(n.indexOf(a)>=0)&&Object.prototype.propertyIsEnumerable.call(t,a)&&(s[a]=t[a])}return s}function vr(t,n){if(t==null)return{};var s={};for(var a in t)if(Object.prototype.hasOwnProperty.call(t,a)){if(n.indexOf(a)>=0)continue;s[a]=t[a]}return s}function Ln(){return Ln=Object.assign?Object.assign.bind():function(t){for(var n=1;n<arguments.length;n++){var s=arguments[n];for(var a in s)Object.prototype.hasOwnProperty.call(s,a)&&(t[a]=s[a])}return t},Ln.apply(this,arguments)}function Ka(t,n){var s=Object.keys(t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);n&&(a=a.filter(function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable})),s.push.apply(s,a)}return s}function An(t){for(var n=1;n<arguments.length;n++){var s=arguments[n]!=null?arguments[n]:{};n%2?Ka(Object(s),!0).forEach(function(a){br(t,a,s[a])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(s)):Ka(Object(s)).forEach(function(a){Object.defineProperty(t,a,Object.getOwnPropertyDescriptor(s,a))})}return t}function br(t,n,s){return n=jr(n),n in t?Object.defineProperty(t,n,{value:s,enumerable:!0,configurable:!0,writable:!0}):t[n]=s,t}function jr(t){var n=yr(t,"string");return typeof n=="symbol"?n:n+""}function yr(t,n){if(typeof t!="object"||!t)return t;var s=t[Symbol.toPrimitive];if(s!==void 0){var a=s.call(t,n);if(typeof a!="object")return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return(n==="string"?String:Number)(t)}function Ua(t){return t&&t.map((n,s)=>l.createElement(n.tag,An({key:s},n.attr),Ua(n.child)))}function Ee(t){return n=>l.createElement(kr,Ln({attr:An({},t.attr)},n),Ua(t.child))}function kr(t){var n=s=>{var{attr:a,size:r,title:i}=t,o=xr(t,gr),c=r||s.size||"1em",d;return s.className&&(d=s.className),t.className&&(d=(d?d+" ":"")+t.className),l.createElement("svg",Ln({stroke:"currentColor",fill:"currentColor",strokeWidth:"0"},s.attr,a,o,{className:d,style:An(An({color:t.color||s.color},s.style),t.style),height:c,width:c,xmlns:"http://www.w3.org/2000/svg"}),i&&l.createElement("title",null,i),t.children)};return Wa!==void 0?l.createElement(Wa.Consumer,null,s=>n(s)):n(Ya)}function wr(t){return Ee({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"},child:[]},{tag:"path",attr:{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm-2 15-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z"},child:[]}]})(t)}function Nr(t){return Ee({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0V0z"},child:[]},{tag:"path",attr:{d:"M11 18c0 1.1-.9 2-2 2s-2-.9-2-2 .9-2 2-2 2 .9 2 2zm-2-8c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0-6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm6 4c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2zm0 2c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0 6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z"},child:[]}]})(t)}function Cr(t){return Ee({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"},child:[]},{tag:"path",attr:{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-6h2v6zm0-8h-2V7h2v2z"},child:[]}]})(t)}function Mr(t){return Ee({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"},child:[]},{tag:"path",attr:{d:"M11 7 9.6 8.4l2.6 2.6H2v2h10.2l-2.6 2.6L11 17l5-5-5-5zm9 12h-8v2h8c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2h-8v2h8v14z"},child:[]}]})(t)}function Sr(t){return Ee({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"},child:[]},{tag:"path",attr:{d:"m17 7-1.41 1.41L18.17 11H8v2h10.17l-2.58 2.58L17 17l5-5zM4 5h8V3H4c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h8v-2H4V5z"},child:[]}]})(t)}function Dr(t){return Ee({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"},child:[]},{tag:"path",attr:{d:"M15.5 14h-.79l-.28-.27A6.471 6.471 0 0 0 16 9.5 6.5 6.5 0 1 0 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z"},child:[]}]})(t)}function Er(t){return Ee({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"},child:[]},{tag:"path",attr:{d:"M7 18c-1.1 0-1.99.9-1.99 2S5.9 22 7 22s2-.9 2-2-.9-2-2-2zM1 2v2h2l3.6 7.59-1.35 2.45c-.16.28-.25.61-.25.96 0 1.1.9 2 2 2h12v-2H7.42c-.14 0-.25-.11-.25-.25l.03-.12.9-1.63h7.45c.75 0 1.41-.41 1.75-1.03l3.58-6.49A1.003 1.003 0 0 0 20 4H5.21l-.94-2H1zm16 16c-1.1 0-1.99.9-1.99 2s.89 2 1.99 2 2-.9 2-2-.9-2-2-2z"},child:[]}]})(t)}function $r(t){return Ee({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"},child:[]},{tag:"path",attr:{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z"},child:[]}]})(t)}function Tr(t){return Ee({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"},child:[]},{tag:"path",attr:{d:"M1 21h22L12 2 1 21zm12-3h-2v-2h2v2zm0-4h-2v-4h2v4z"},child:[]}]})(t)}function qa(t){return Ee({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"},child:[]},{tag:"path",attr:{d:"M12 14c1.66 0 2.99-1.34 2.99-3L15 5c0-1.66-1.34-3-3-3S9 3.34 9 5v6c0 1.66 1.34 3 3 3zm5.3-3c0 3-2.54 5.1-5.3 5.1S6.7 14 6.7 11H5c0 3.41 2.72 6.23 6 6.72V21h2v-3.28c3.28-.48 6-3.3 6-6.72h-1.7z"},child:[]}]})(t)}function Lr(t){return Ee({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"},child:[]},{tag:"path",attr:{fillRule:"evenodd",d:"M16 9V4h1c.55 0 1-.45 1-1s-.45-1-1-1H7c-.55 0-1 .45-1 1s.45 1 1 1h1v5c0 1.66-1.34 3-3 3v2h5.97v7l1 1 1-1v-7H19v-2c-1.66 0-3-1.34-3-3z"},child:[]}]})(t)}function Ar(t){return Ee({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"},child:[]},{tag:"path",attr:{d:"M2.01 21 23 12 2.01 3 2 10l15 2-15 2z"},child:[]}]})(t)}function Ir(t){return Ee({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"},child:[]},{tag:"path",attr:{d:"M12 3a9 9 0 1 0 9 9c0-.46-.04-.92-.1-1.36a5.389 5.389 0 0 1-4.4 2.26 5.403 5.403 0 0 1-3.14-9.8c-.44-.06-.9-.1-1.36-.1z"},child:[]}]})(t)}function Pr(t){return Ee({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"},child:[]},{tag:"path",attr:{d:"M12 7c-2.76 0-5 2.24-5 5s2.24 5 5 5 5-2.24 5-5-2.24-5-5-5zM2 13h2c.55 0 1-.45 1-1s-.45-1-1-1H2c-.55 0-1 .45-1 1s.45 1 1 1zm18 0h2c.55 0 1-.45 1-1s-.45-1-1-1h-2c-.55 0-1 .45-1 1s.45 1 1 1zM11 2v2c0 .55.45 1 1 1s1-.45 1-1V2c0-.55-.45-1-1-1s-1 .45-1 1zm0 18v2c0 .55.45 1 1 1s1-.45 1-1v-2c0-.55-.45-1-1-1s-1 .45-1 1zM5.99 4.58a.996.996 0 0 0-1.41 0 .996.996 0 0 0 0 1.41l1.06 1.06c.39.39 1.03.39 1.41 0s.39-1.03 0-1.41L5.99 4.58zm12.37 12.37a.996.996 0 0 0-1.41 0 .996.996 0 0 0 0 1.41l1.06 1.06c.39.39 1.03.39 1.41 0a.996.996 0 0 0 0-1.41l-1.06-1.06zm1.06-10.96a.996.996 0 0 0 0-1.41.996.996 0 0 0-1.41 0l-1.06 1.06c-.39.39-.39 1.03 0 1.41s1.03.39 1.41 0l1.06-1.06zM7.05 18.36a.996.996 0 0 0 0-1.41.996.996 0 0 0-1.41 0l-1.06 1.06c-.39.39-.39 1.03 0 1.41s1.03.39 1.41 0l1.06-1.06z"},child:[]}]})(t)}function zr(t){return Ee({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0V0z"},child:[]},{tag:"path",attr:{d:"M7.41 8.59 12 13.17l4.59-4.58L18 10l-6 6-6-6 1.41-1.41z"},child:[]}]})(t)}function Hr(t){return Ee({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"},child:[]},{tag:"path",attr:{d:"M7.41 15.41 12 10.83l4.59 4.58L18 14l-6-6-6 6z"},child:[]}]})(t)}function Br(t){return Ee({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"},child:[]},{tag:"path",attr:{d:"M3 17v2h6v-2H3zM3 5v2h10V5H3zm10 16v-2h8v-2h-8v-2h-2v6h2zM7 9v2H3v2h4v2h2V9H7zm14 4v-2H11v2h10zm-6-4h2V7h4V5h-4V3h-2v6z"},child:[]}]})(t)}function Or(t){return Ee({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"},child:[]},{tag:"path",attr:{d:"M20 11H7.83l5.59-5.59L12 4l-8 8 8 8 1.41-1.41L7.83 13H20v-2z"},child:[]}]})(t)}function Fr(t){return Ee({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0V0z"},child:[]},{tag:"path",attr:{d:"m20 12-1.41-1.41L13 16.17V4h-2v12.17l-5.58-5.59L4 12l8 8 8-8z"},child:[]}]})(t)}function Vr(t){return Ee({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0V0z"},child:[]},{tag:"path",attr:{d:"m4 12 1.41 1.41L11 7.83V20h2V7.83l5.58 5.59L20 12l-8-8-8 8z"},child:[]}]})(t)}function Yr(t){return Ee({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"},child:[]},{tag:"path",attr:{d:"M9 16.17 4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z"},child:[]}]})(t)}function In(t){return Ee({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"},child:[]},{tag:"path",attr:{d:"M15.41 7.41 14 6l-6 6 6 6 1.41-1.41L10.83 12z"},child:[]}]})(t)}function Pn(t){return Ee({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"},child:[]},{tag:"path",attr:{d:"M10 6 8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z"},child:[]}]})(t)}function jt(t){return Ee({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"},child:[]},{tag:"path",attr:{d:"M19 6.41 17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"},child:[]}]})(t)}function Qn(t){return Ee({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"},child:[]},{tag:"path",attr:{d:"M16.59 8.59 12 13.17 7.41 8.59 6 10l6 6 6-6z"},child:[]}]})(t)}function Wr(t){return Ee({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{d:"M18.41 16.59 13.82 12l4.59-4.59L17 6l-6 6 6 6zM6 6h2v12H6z"},child:[]},{tag:"path",attr:{fill:"none",d:"M24 24H0V0h24v24z"},child:[]}]})(t)}function Kr(t){return Ee({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0V0z"},child:[]},{tag:"path",attr:{d:"M5.59 7.41 10.18 12l-4.59 4.59L7 18l6-6-6-6zM16 6h2v12h-2z"},child:[]}]})(t)}function Ur(t){return Ee({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"},child:[]},{tag:"path",attr:{d:"M3 18h18v-2H3v2zm0-5h18v-2H3v2zm0-7v2h18V6H3z"},child:[]}]})(t)}function Ga(t){return Ee({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"},child:[]},{tag:"path",attr:{d:"M12 8c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2zm0 2c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0 6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z"},child:[]}]})(t)}function qr(t){return Ee({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"},child:[]},{tag:"path",attr:{d:"M17.65 6.35A7.958 7.958 0 0 0 12 4c-4.42 0-7.99 3.58-7.99 8s3.57 8 7.99 8c3.73 0 6.84-2.55 7.73-6h-2.08A5.99 5.99 0 0 1 12 18c-3.31 0-6-2.69-6-6s2.69-6 6-6c1.66 0 3.14.69 4.22 1.78L13 11h7V4l-2.35 2.35z"},child:[]}]})(t)}function Gr(t){return Ee({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"},child:[]},{tag:"path",attr:{d:"M12 5.83 15.17 9l1.41-1.41L12 3 7.41 7.59 8.83 9 12 5.83zm0 12.34L8.83 15l-1.41 1.41L12 21l4.59-4.59L15.17 15 12 18.17z"},child:[]}]})(t)}function Xr(t){return Ee({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"},child:[]},{tag:"path",attr:{d:"M12 12c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm0 2c-2.67 0-8 1.34-8 4v2h16v-2c0-2.66-5.33-4-8-4z"},child:[]}]})(t)}function Xa(t){return Ee({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"},child:[]},{tag:"path",attr:{d:"M18 16.08c-.76 0-1.44.3-1.96.77L8.91 12.7c.05-.23.09-.46.09-.7s-.04-.47-.09-.7l7.05-4.11c.54.5 1.25.81 2.04.81 1.66 0 3-1.34 3-3s-1.34-3-3-3-3 1.34-3 3c0 .24.04.47.09.7L8.04 9.81C7.5 9.31 6.79 9 6 9c-1.66 0-3 1.34-3 3s1.34 3 3 3c.79 0 1.5-.31 2.04-.81l7.12 4.16c-.05.21-.08.43-.08.65 0 1.61 1.31 2.92 2.92 2.92 1.61 0 2.92-1.31 2.92-2.92s-1.31-2.92-2.92-2.92z"},child:[]}]})(t)}function Zr(t){return Ee({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"},child:[]},{tag:"path",attr:{d:"M14 4v5c0 1.12.37 2.16 1 3H9c.65-.86 1-1.9 1-3V4h4m3-2H7c-.55 0-1 .45-1 1s.45 1 1 1h1v5c0 1.66-1.34 3-3 3v2h5.97v7l1 1 1-1v-7H19v-2c-1.66 0-3-1.34-3-3V4h1c.55 0 1-.45 1-1s-.45-1-1-1z"},child:[]}]})(t)}const cn=({children:t,containerId:n,containerElement:s})=>{const a=Dn({containerId:n,containerElement:s});return a?Mt.createPortal(t,a):null},Ie=({icon:t,size:n="medium",color:s="primary",variant:a="filled","aria-label":r,sx:i,style:o,disabled:c=!1,badge:d,badgeColor:u="error",...p})=>{const f=`ui-icon-button ui-icon-button--${a} ui-icon-button--${n}`,m=o?.background||o?.backgroundColor||o?.color?"":`ui-icon-button--${s}`,v=`${f} ${m} ${c?"ui-icon-button--disabled":""}`.trim(),g=i?`${v} ${i}`.trim():v,y=d!=null&&d!=="",S=typeof d=="number"&&d>99?"99+":d,k=e.jsx("button",{type:"button",className:g,style:o,disabled:c,"aria-label":r,...p,children:t});return y?e.jsxs("span",{className:"ui-icon-button-wrapper",children:[k,e.jsx("span",{className:`ui-icon-button-badge ui-icon-button-badge--${u} ui-icon-button-badge--${n}`,children:S})]}):k},Za="ui-kit-theme";function Jr(){if(typeof window>"u")return"light";const t=localStorage.getItem(Za);return t==="light"||t==="dark"?t:window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function Qr(){const[t,n]=l.useState(Jr);return l.useEffect(()=>{document.documentElement.dataset.theme=t,localStorage.setItem(Za,t)},[t]),{theme:t,isDark:t==="dark",toggleTheme:()=>n(r=>r==="dark"?"light":"dark"),setTheme:r=>n(r)}}const Rr='a[href], button:not([disabled]), textarea:not([disabled]), input:not([disabled]), select:not([disabled]), [tabindex]:not([tabindex="-1"])';function Rn({enabled:t,containerRef:n,initialFocusRef:s,returnFocusOnCleanup:a=!0}){const r=l.useRef(null);l.useEffect(()=>{if(!t||!n.current)return;const i=n.current;r.current=document.activeElement;const o=()=>Array.from(i.querySelectorAll(Rr)),c=o();c.length>0&&(s?.current?s.current.focus():c[0].focus());const d=u=>{if(u.key!=="Tab")return;const p=o();if(p.length===0)return;const f=p[0],h=p[p.length-1],m=document.activeElement;u.shiftKey?(m===f||!i.contains(m))&&(u.preventDefault(),h.focus()):(m===h||!i.contains(m))&&(u.preventDefault(),f.focus())};return i.addEventListener("keydown",d),()=>{i.removeEventListener("keydown",d),a&&r.current&&r.current.focus()}},[t,n,s,a])}function At({enabled:t,onEscape:n}){l.useEffect(()=>{if(!t)return;const s=a=>{a.key==="Escape"&&n()};return document.addEventListener("keydown",s),()=>document.removeEventListener("keydown",s)},[t,n])}function zn({enabled:t,mediaQuery:n}){l.useEffect(()=>{const s=i=>{t&&i?(document.body.style.overflow="hidden",document.documentElement.style.overflow="hidden"):(document.body.style.overflow="",document.documentElement.style.overflow="")};if(!n)return s(t),()=>s(!1);const a=window.matchMedia(n);s(a.matches);const r=i=>s(i.matches);return a.addEventListener("change",r),()=>{a.removeEventListener("change",r),s(!1)}},[t,n])}const ea=({open:t,onClose:n,closeOnBackdropClick:s=!0,closeOnEscape:a=!0,showCloseButton:r=!0,size:i="medium",children:o,sx:c,style:d,backdropStyle:u,portalContainerId:p,initialFocusRef:f,returnFocusOnClose:h=!0,trapFocus:m=!0})=>{const x=l.useRef(null),v=l.useContext(bt),g=v?v.baseZ+za:Ha,y=l.useMemo(()=>({baseZ:g}),[g]);At({enabled:t&&a&&!!n,onEscape:n||(()=>{})}),zn({enabled:t}),Rn({enabled:t&&m,containerRef:x,initialFocusRef:f,returnFocusOnCleanup:h});const S=$=>{s&&n&&$.target===$.currentTarget&&n()};if(!t)return null;const k=`ui-modal__content ui-modal__content--${i}`,T=c?`${k} ${c}`.trim():k;return e.jsx(cn,{containerId:p,children:e.jsx(bt.Provider,{value:y,children:e.jsx("div",{className:"ui-modal",style:{zIndex:g},children:e.jsx("div",{className:"ui-modal__backdrop",onClick:S,style:u,role:"presentation",children:e.jsxs("div",{ref:x,className:T,style:d,role:"dialog","aria-modal":"true",children:[r&&n&&e.jsx(Ie,{icon:e.jsx(jt,{}),onClick:n,"aria-label":"Close modal",sx:"ui-modal__close-button",variant:"ghost",color:"neutral",size:"medium"}),o]})})})})})},Ja=({open:t,onClose:n,closeOnBackdropClick:s=!0,closeOnEscape:a=!0,showCloseButton:r=!0,anchor:i="right",width:o="320px",height:c="100%",children:d,sx:u,style:p,backdropStyle:f,hideBackdrop:h=!1,portalContainerId:m,initialFocusRef:x,returnFocusOnClose:v=!0,trapFocus:g=!0,title:y})=>{const S=l.useRef(null),k=l.useContext(bt),T=k?k.baseZ+za:Ha,$=l.useMemo(()=>({baseZ:T}),[T]),[H,Z]=l.useState(t),[te,D]=l.useState(!1);l.useEffect(()=>{if(t)Z(!0),D(!1);else if(H){D(!0);const re=setTimeout(()=>{Z(!1),D(!1)},300);return()=>clearTimeout(re)}},[t]),At({enabled:t&&a&&!!n,onEscape:n||(()=>{})}),zn({enabled:t}),Rn({enabled:t&&g,containerRef:S,initialFocusRef:x,returnFocusOnCleanup:v});const B=re=>{s&&n&&re.target===re.currentTarget&&n()};if(!H)return null;const ne={};i==="left"||i==="right"?ne.width=o:ne.height=c;const F=["ui-drawer__content",`ui-drawer__content--${i}`,te&&`ui-drawer__content--exiting-${i}`].filter(Boolean).join(" "),Ne=u?`${F} ${u}`.trim():F,ue=y?"ui-drawer-title":void 0,J=r&&n&&e.jsx(Ie,{icon:e.jsx(jt,{}),onClick:n,"aria-label":"Close drawer",sx:"ui-drawer__close-button",variant:"ghost",color:"neutral",size:"medium"});return e.jsx(cn,{containerId:m,children:e.jsx(bt.Provider,{value:$,children:e.jsx("div",{className:"ui-drawer",style:{zIndex:T},children:e.jsx("div",{className:"ui-drawer__backdrop",onClick:B,style:h?{...f,background:"transparent"}:f,role:"presentation",children:e.jsxs("div",{ref:S,className:Ne,style:{...ne,...p},role:"dialog","aria-modal":"true","aria-labelledby":ue,children:[y?e.jsxs("div",{className:"ui-drawer__header",children:[e.jsx("h2",{id:ue,className:"ui-drawer__title",children:y}),J]}):J,d]})})})})})},Ze=({title:t,placement:n="top",arrow:s=!1,children:a,sx:r})=>{if(!t)return a;const i=["ui-tooltip",`ui-tooltip--${n}`,r].filter(Boolean).join(" ");return e.jsxs("span",{className:i,children:[a,e.jsxs("span",{className:"ui-tooltip__content",role:"tooltip",children:[t,s&&e.jsx("span",{className:"ui-tooltip__arrow","aria-hidden":"true"})]})]})};Ze.displayName="Tooltip";function ei(){return e.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5","aria-hidden":"true",children:e.jsx("path",{d:"M18 6L6 18M6 6l12 12"})})}function ti(){return e.jsx("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5","aria-hidden":"true",children:e.jsx("path",{d:"M6 9l6 6 6-6"})})}function ni(){return e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2","aria-hidden":"true",children:[e.jsx("circle",{cx:"11",cy:"11",r:"8"}),e.jsx("path",{d:"M21 21l-4.35-4.35"})]})}function ai({section:t,pending:n,onToggle:s}){const[a,r]=l.useState(t.initiallyOpen??!1),[i,o]=l.useState(""),[c,d]=l.useState(!1),u=t.showMoreLimit??8,p=i?t.options.filter(x=>x.label.toLowerCase().includes(i.toLowerCase())):t.options,f=!i&&p.length>u,h=f&&!c?p.slice(0,u):p,m=p.length-u;return e.jsxs("div",{className:`fp-collapsible${a?" fp-collapsible--open":""}`,children:[e.jsxs("button",{type:"button",className:"fp-collapsible__header",onClick:()=>r(x=>!x),"aria-expanded":a,children:[e.jsxs("span",{className:"fp-collapsible__title",children:[t.icon&&e.jsx("span",{className:"fp-collapsible__icon",children:t.icon}),t.title]}),e.jsxs("span",{className:"fp-collapsible__right",children:[n.length>0&&e.jsx("span",{className:"fp-collapsible__count",children:n.length}),e.jsx("span",{className:"fp-collapsible__arrow",children:e.jsx(ti,{})})]})]}),e.jsxs("div",{className:"fp-collapsible__content",children:[t.showSearch&&e.jsx(Ot,{size:"small",fullWidth:!0,startAdornment:e.jsx(ni,{}),placeholder:`Search ${t.title.toLowerCase()}…`,value:i,onChange:x=>{const v=x.target.value;o(v),t.onSearch?.(v)},sx:{root:"fp-mini-search",wrapper:"fp-mini-search__wrapper"}}),e.jsx("div",{className:["fp-pill-grid",t.columns===3?"fp-pill-grid--cols3":"fp-pill-grid--cols2"].join(" "),children:h.map(x=>{const v=n.includes(x.value);return e.jsx(mt,{label:x.label,variant:"outlined",color:v?"primary":"neutral",size:"small",selected:v,onClick:()=>s(x.value),leadingIcon:x.icon?e.jsx("img",{src:x.icon,alt:"",className:"fp-pill__icon","aria-hidden":"true"}):void 0,sx:"fp-pill-chip"},x.value)})}),f&&e.jsx(Xe,{variant:"outlined",color:"neutral",size:"small",style:{width:"100%",marginTop:"0.35rem",border:"1px solid var(--palette-divider)"},onClick:()=>d(x=>!x),children:c?"Show less":`Show ${m} more…`})]})]})}function si({section:t,pending:n,onToggle:s}){return e.jsxs("div",{className:"fp-group",children:[e.jsx("div",{className:"fp-group__label",children:t.title}),e.jsx("div",{className:"fp-cards",children:t.options.map(a=>{const r=n.includes(a.value),i=a.color??"#94a3b8";return e.jsxs("button",{type:"button",className:`fp-card${r?" fp-card--active":""}`,style:{"--fp-card-color":i},onClick:()=>s(a.value),children:[e.jsx("span",{className:"fp-card__icon","aria-hidden":"true",children:a.icon?e.jsx("img",{src:a.icon,alt:""}):e.jsx("span",{className:"fp-card__icon-letter",children:a.label.charAt(0)})}),e.jsx("span",{className:"fp-card__label",children:a.label})]},a.value)})})]})}function ri({section:t,pending:n,onToggle:s}){return e.jsxs("div",{className:"fp-group",children:[e.jsx("div",{className:"fp-group__label",children:t.title}),e.jsx("div",{className:"fp-tiles",children:t.options.map(a=>{const r=n.includes(a.value);return e.jsxs("button",{type:"button",className:`fp-tile${r?" fp-tile--active":""}`,onClick:()=>s(a.value),children:[(a.iconNode??a.icon)&&e.jsx("span",{className:"fp-tile__icon","aria-hidden":"true",children:a.iconNode??a.icon}),e.jsx("span",{className:"fp-tile__label",children:a.label}),a.sublabel&&e.jsx("span",{className:"fp-tile__sublabel",children:a.sublabel})]},a.value)})})]})}function ii({sections:t,value:n,onChange:s,resultCount:a,isOpen:r,onClose:i,onReset:o}){zn({enabled:r,mediaQuery:"(max-width: 767px)"});const[c,d]=l.useState({});l.useEffect(()=>{if(!r)return;const g={};t.forEach(y=>{g[y.id]=[...n[y.id]??[]]}),d(g)},[r]);const u=l.useCallback((g,y)=>{d(S=>{const k=S[g]??[],T=k.includes(y)?k.filter($=>$!==y):[...k,y];return{...S,[g]:T}})},[]),p=l.useCallback((g,y)=>{d(S=>({...S,[g]:(S[g]??[]).filter(k=>k!==y)}))},[]),f=()=>{s(c),i()},h=()=>{if(o)o();else{const g={};t.forEach(y=>{g[y.id]=[]}),d(g)}},m=()=>{const g={};t.forEach(y=>{g[y.id]=[...n[y.id]??[]]}),d(g),i()},x=t.flatMap(g=>g.disabled?[]:(c[g.id]??[]).map(y=>({sectionId:g.id,value:y,label:g.options.find(S=>S.value===y)?.label??y}))),v=x.length>0;return e.jsxs("aside",{className:`fp-panel${r?" fp-panel--open":""}`,"aria-label":"Filter panel","aria-hidden":!r,children:[e.jsxs("div",{className:"fp-header",children:[e.jsxs("div",{className:"fp-header__info",children:[e.jsx("span",{className:"fp-header__title",children:"Filters"}),a!==void 0&&e.jsxs("span",{className:"fp-header__count",children:[a," employees found"]})]}),e.jsx(Ie,{variant:"ghost",color:"neutral",size:"small",icon:e.jsx(ei,{}),"aria-label":"Close filters",onClick:m})]}),v&&e.jsx("div",{className:"fp-chips",children:x.map(g=>e.jsx(mt,{label:g.label,variant:"outlined",color:"primary",size:"small",onDelete:()=>p(g.sectionId,g.value)},`${g.sectionId}-${g.value}`))}),e.jsx("div",{className:"fp-content",children:t.map(g=>g.type==="cards"?e.jsx(si,{section:g,pending:c[g.id]??[],onToggle:y=>u(g.id,y)},g.id):g.type==="tiles"?e.jsx(ri,{section:g,pending:c[g.id]??[],onToggle:y=>u(g.id,y)},g.id):e.jsx(ai,{section:g,pending:c[g.id]??[],onToggle:y=>u(g.id,y)},g.id))}),e.jsxs("div",{className:"fp-footer",children:[e.jsx(Xe,{variant:"ghost",color:"neutral",onClick:h,disabled:!v,children:"Reset all"}),e.jsx(Xe,{variant:"filled",color:"primary",style:{flex:1},onClick:f,children:"Apply"})]})]})}function ot(t){return t.hour*60+t.minute}function Vt(t){const n=Math.max(0,Math.min(1439,t));return{hour:Math.floor(n/60),minute:n%60}}function yt(){return{min:{hour:0,minute:0},max:{hour:23,minute:59}}}function Et(t){if(t===null)return null;const n=yt(),s=t??{},a=s.min??n.min,r=s.max??n.max;return ot(a)>ot(r)?null:{min:a,max:r}}function dn(t,n,s){const a=Math.max(1,Math.floor(s));if(t>n)return null;if(a===1)return t;let r=Math.floor(t/a)*a;return r<t&&(r+=a),r>n?null:r}function Yt(t,n,s,a){const r=ot(s.min),i=ot(s.max);let o=t*60+n;o=Math.max(r,Math.min(i,o));const c=Math.max(1,Math.floor(a));if(c===1)return Vt(o);const d=dn(r,i,c);if(d===null)return Vt(r);if(o<=d)return Vt(d);const u=o-d,p=Math.ceil(u/c);let f=d+p*c;const h=Math.floor((i-d)/c),m=d+h*c;return f>i&&(f=m),Vt(Math.min(f,m))}function Qa(t,n){const s=ot(t.min),a=ot(t.max),r=dn(s,a,n);return r===null?null:Vt(r)}function Ra(t,n){const s=ot(t.min),a=ot(t.max),r=Math.max(1,Math.floor(n)),i=new Set;if(r===1){for(let c=t.min.hour;c<=t.max.hour;c++)i.add(c);return[...i].sort((c,d)=>c-d)}const o=dn(s,a,r);if(o===null)return[];for(let c=o;c<=a;c+=r)i.add(Math.floor(c/60));return[...i].sort((c,d)=>c-d)}function It(t,n,s){const a=ot(n.min),r=ot(n.max),i=Math.max(1,Math.floor(s)),o=[];if(i===1){const d=t===n.min.hour?n.min.minute:0,u=t===n.max.hour?n.max.minute:59;for(let p=d;p<=u;p++)o.push(p);return o}const c=dn(a,r,i);if(c===null)return[];for(let d=c;d<=r;d+=i){const u=Vt(d);u.hour===t&&o.push(u.minute)}return o}function Hn(t,n,s,a){const r=t*60+n,i=ot(s.min),o=ot(s.max);if(r<i||r>o)return!1;const c=Math.max(1,Math.floor(a));if(c===1)return!0;const d=dn(i,o,c);return d===null||r<d?!1:(r-d)%c===0}const un=8,es="DD.MM.YYYY";function ts(t,n){return!n||t.includes("HH")&&t.includes("mm")?t:`${t} HH:mm`}const ta=["January","February","March","April","May","June","July","August","September","October","November","December"],li=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],oi=["Mon","Tue","Wed","Thu","Fri","Sat","Sun"],Ge=(...t)=>t.filter(Boolean).join(" ");function Wt(t,n){return t.getFullYear()===n.getFullYear()&&t.getMonth()===n.getMonth()&&t.getDate()===n.getDate()}function ci(t,n,s){const[a,r]=n<=s?[n,s]:[s,n];return t.getTime()>a.getTime()&&t.getTime()<r.getTime()}function hn(t,n){return new Date(t.getFullYear(),t.getMonth()+n,1)}function di(t,n){const a=(new Date(t,n,1).getDay()+6)%7,r=[];for(let c=a;c>0;c--)r.push(new Date(t,n,1-c));const i=new Date(t,n+1,0).getDate();for(let c=1;c<=i;c++)r.push(new Date(t,n,c));let o=1;for(;r.length<42;)r.push(new Date(t,n+1,o++));return r}function Je(t,n=es){const s=String(t.getDate()).padStart(2,"0"),a=String(t.getMonth()+1).padStart(2,"0"),r=String(t.getFullYear());return n.replace("DD",s).replace("MM",a).replace("YYYY",r)}function Bn(t,n){const s=String(t.getDate()).padStart(2,"0"),a=String(t.getMonth()+1).padStart(2,"0"),r=String(t.getFullYear()),i=String(t.getHours()).padStart(2,"0"),o=String(t.getMinutes()).padStart(2,"0");return n.replace("YYYY",r).replace("DD",s).replace("MM",a).replace("HH",i).replace("mm",o)}function na(t,n){if(t.length!==n.length)return null;const s=n.indexOf("DD"),a=n.indexOf("MM"),r=n.indexOf("YYYY");if(s<0||a<0||r<0)return null;const i=parseInt(t.slice(s,s+2),10),o=parseInt(t.slice(a,a+2),10)-1,c=parseInt(t.slice(r,r+4),10);if(isNaN(i)||isNaN(o)||isNaN(c))return null;const d=new Date(c,o,i);return d.getDate()!==i||d.getMonth()!==o||d.getFullYear()!==c?null:d}function ui(t,n){if(t.length!==n.length)return null;const s=n.indexOf("DD"),a=n.indexOf("MM"),r=n.indexOf("YYYY");if(s<0||a<0||r<0)return null;const i=parseInt(t.slice(s,s+2),10),o=parseInt(t.slice(a,a+2),10)-1,c=parseInt(t.slice(r,r+4),10);if(isNaN(i)||isNaN(o)||isNaN(c))return null;let d=0,u=0;const p=n.indexOf("HH"),f=n.indexOf("mm");if(p>=0&&f>=0&&(d=parseInt(t.slice(p,p+2),10),u=parseInt(t.slice(f,f+2),10),isNaN(d)||isNaN(u)||d<0||d>23||u<0||u>59))return null;const h=new Date(c,o,i,d,u,0,0);return h.getDate()!==i||h.getMonth()!==o||h.getFullYear()!==c?null:h}function aa(t,n){const s=t.replace(/\D/g,"").slice(0,8);if(!s.length)return"";let a="",r=0;for(let i=0;i<n.length;i++){const o=n[i];if(/[DMY]/.test(o)){if(r>=s.length)break;a+=s[r++]}else if(r<s.length)a+=o;else break}return a}function hi(t,n){const s=t.replace(/\D/g,"").slice(0,12);if(!s.length)return"";let a=0,r="",i=0;for(;i<n.length;)if(n.startsWith("YYYY",i)){for(let o=0;o<4&&a<s.length;o++)r+=s[a++];i+=4}else if(n.startsWith("DD",i)){if(a>=s.length||(r+=s[a++],a>=s.length))break;r+=s[a++],i+=2}else if(n.startsWith("MM",i)){if(a>=s.length||(r+=s[a++],a>=s.length))break;r+=s[a++],i+=2}else if(n.startsWith("HH",i)){if(a>=s.length||(r+=s[a++],a>=s.length))break;r+=s[a++],i+=2}else if(n.startsWith("mm",i)){if(a>=s.length||(r+=s[a++],a>=s.length))break;r+=s[a++],i+=2}else{if(a<s.length)r+=n[i];else break;i+=1}return r}const ns=(t,n,s)=>{const a=window.innerHeight-t.bottom-un,r=t.top-un,i=s>a&&r>a;let o=t.left;return o+n>window.innerWidth-8&&(o=Math.max(8,window.innerWidth-8-n)),i?{bottom:window.innerHeight-t.top+un,left:o,maxHeight:Math.min(640,r)}:{top:t.bottom+un,left:o,maxHeight:Math.min(640,a)}};function pi(t){return t==="single"?[{label:"Today",getValue:()=>new Date},{label:"Yesterday",getValue:()=>{const n=new Date;return n.setDate(n.getDate()-1),n}}]:[{label:"Today",getValue:()=>{const n=new Date;return{start:n,end:n}}},{label:"Yesterday",getValue:()=>{const n=new Date;return n.setDate(n.getDate()-1),{start:new Date(n),end:new Date(n)}}},{label:"This week",getValue:()=>{const n=new Date,s=(n.getDay()+6)%7,a=new Date(n.getFullYear(),n.getMonth(),n.getDate()-s),r=new Date(a.getFullYear(),a.getMonth(),a.getDate()+6);return{start:a,end:r}}},{label:"Last week",getValue:()=>{const n=new Date,s=(n.getDay()+6)%7,a=new Date(n.getFullYear(),n.getMonth(),n.getDate()-s-7),r=new Date(a.getFullYear(),a.getMonth(),a.getDate()+6);return{start:a,end:r}}},{label:"This month",getValue:()=>{const n=new Date,s=new Date(n.getFullYear(),n.getMonth(),1),a=new Date(n.getFullYear(),n.getMonth()+1,0);return{start:s,end:a}}},{label:"Last month",getValue:()=>{const n=new Date,s=new Date(n.getFullYear(),n.getMonth()-1,1),a=new Date(n.getFullYear(),n.getMonth(),0);return{start:s,end:a}}}]}function as(){return e.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",focusable:"false",children:[e.jsx("rect",{x:"3",y:"4",width:"18",height:"18",rx:"2",ry:"2"}),e.jsx("line",{x1:"16",y1:"2",x2:"16",y2:"6"}),e.jsx("line",{x1:"8",y1:"2",x2:"8",y2:"6"}),e.jsx("line",{x1:"3",y1:"10",x2:"21",y2:"10"})]})}function sa(){return e.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",focusable:"false",children:e.jsx("path",{d:"m15 18-6-6 6-6"})})}function ra(){return e.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",focusable:"false",children:e.jsx("path",{d:"m9 18 6-6-6-6"})})}const ia=l.forwardRef(({mode:t="single",value:n,onChange:s,rangeValue:a,onRangeChange:r,triggerVariant:i="input",format:o=es,placeholder:c,minDate:d,maxDate:u,disabledDates:p,disabledDaysOfWeek:f,isDateDisabled:h,showTime:m=!1,timeStep:x=1,getTimeBounds:v,presets:g,showPresets:y=!1,multiMonth:S,label:k,helperText:T,error:$=!1,disabled:H=!1,required:Z=!1,size:te="normal",fullWidth:D=!1,startAdornment:B,endAdornment:ne,sx:F,style:Ne,id:ue,onFocus:J,onBlur:re,...je},ye)=>{const Q=l.useId(),G=ue||`${Q}-input`,b=new Date;b.setHours(0,0,0,0);const A=S??t==="range",I=y?g??pi(t):[],W=ts(o,!!(m&&t==="single")),V=n!==void 0,ve=a!==void 0,[w,R]=l.useState(null),[ie,he]=l.useState({start:null,end:null}),P=V?n??null:w,le=ve?a??ie:ie,$e=P?.getTime()??null,Pe=Math.max(1,Math.floor(x)),pe=l.useMemo(()=>{if(!m||t!=="single")return;if(!P)return"no-date";const M=new Date(P.getFullYear(),P.getMonth(),P.getDate());return v?Et(v(M)):"full"},[m,t,P,v]),Ce=l.useMemo(()=>{if(pe===void 0||pe==="no-date")return[];const M=pe==="full"?yt():pe;return M?Ra(M,Pe):[]},[pe,Pe]),[_e,ze]=l.useState(!1),[C,q]=l.useState(null),[ae,j]=l.useState(!1),z=()=>t==="single"&&P?new Date(P.getFullYear(),P.getMonth(),1):t==="range"&&le.start?new Date(le.start.getFullYear(),le.start.getMonth(),1):new Date(b.getFullYear(),b.getMonth(),1),[U,X]=l.useState(z),[ke,N]=l.useState("days"),[de,fe]=l.useState(()=>b.getFullYear()-4),[De,we]=l.useState(null),[O,oe]=l.useState(null),[ge,be]=l.useState(()=>t==="single"&&P?P.getHours():0),[Ae,We]=l.useState(()=>t==="single"&&P?P.getMinutes():0),ht=l.useMemo(()=>{if(pe===void 0||pe==="no-date")return[];const M=pe==="full"?yt():pe;return M?It(ge,M,Pe):[]},[pe,Pe,ge]),Ke=l.useRef(!1),[ct,Qe]=l.useState(()=>t==="single"&&P?m?Bn(P,ts(o,m)):Je(P,o):""),[gt,xt]=l.useState(()=>le.start?Je(le.start,o):""),[Re,tt]=l.useState(()=>le.end?Je(le.end,o):""),at=l.useRef(null),Fe=l.useRef(null),et=l.useRef(null),Gt=l.useContext(bt),nt=Gt?Gt.baseZ+rn:void 0,st=l.useRef(null),Be=l.useCallback(M=>{if(d){const L=new Date(d.getFullYear(),d.getMonth(),d.getDate());if(M<L)return!0}if(u){const L=new Date(u.getFullYear(),u.getMonth(),u.getDate());if(M>L)return!0}if(f?.includes(M.getDay())||p?.some(L=>Wt(L,M))||h?.(M))return!0;if(m&&v){const L=new Date(M.getFullYear(),M.getMonth(),M.getDate());if(Et(v(L))===null)return!0}return!1},[d,u,f,p,h,m,v]),Ye=l.useCallback(()=>{ze(!1),we(null),oe(null),N("days")},[]),kt=l.useCallback(()=>{H||(t==="single"&&P?X(new Date(P.getFullYear(),P.getMonth(),1)):t==="range"&&le.start&&X(new Date(le.start.getFullYear(),le.start.getMonth(),1)),ze(!0))},[H,t,P,le]);At({enabled:_e,onEscape:Ye}),l.useEffect(()=>{if(!_e){q(null),j(!1);return}const M=at.current;if(!M)return;const L=M.getBoundingClientRect();q({top:L.bottom+un,left:L.left,maxHeight:640}),j(!1);const me=Oe=>{!at.current?.contains(Oe.target)&&!Fe.current?.contains(Oe.target)&&Ye()};setTimeout(()=>document.addEventListener("mousedown",me),0);const ce=()=>{if(!Fe.current||!at.current)return;const Oe=at.current.getBoundingClientRect();q(ns(Oe,Fe.current.offsetWidth,Fe.current.offsetHeight))};return window.addEventListener("scroll",ce,!0),window.addEventListener("resize",ce),()=>{window.removeEventListener("scroll",ce,!0),window.removeEventListener("resize",ce),document.removeEventListener("mousedown",me)}},[_e,Ye]),l.useEffect(()=>{if(t!=="single"||!m||$e==null)return;const M=new Date($e),L=new Date(M.getFullYear(),M.getMonth(),M.getDate()),me=v?Et(v(L)):yt();if(!me)return;const ce=Yt(M.getHours(),M.getMinutes(),me,Pe);be(ce.hour),We(ce.minute)},[t,m,$e,v,Pe]),l.useLayoutEffect(()=>{if(!_e||!ae)return;const M=et.current?.querySelector(`[data-time-value="${ge}"]`),L=st.current?.querySelector(`[data-time-value="${Ae}"]`);M?.scrollIntoView({block:"nearest"}),L?.scrollIntoView({block:"nearest"})},[ge,Ae,_e,ae]),l.useLayoutEffect(()=>{if(!_e||ae||!Fe.current||!at.current)return;const M=at.current.getBoundingClientRect();q(ns(M,Fe.current.offsetWidth,Fe.current.offsetHeight)),j(!0)},[_e,C,ae]),l.useEffect(()=>{Ke.current||t==="single"&&Qe(P?m?Bn(P,W):Je(P,o):"")},[P,o,W,m,t]),l.useEffect(()=>{Ke.current||(xt(le.start?Je(le.start,o):""),tt(le.end?Je(le.end,o):""))},[le.start,le.end,o]);const gn=l.useCallback(M=>{if(!Be(M))if(Ke.current=!1,t==="single")if(m){const L=new Date(M.getFullYear(),M.getMonth(),M.getDate()),me=v?Et(v(L)):yt();if(!me)return;const ce=Qa(me,Pe);if(!ce)return;const Oe=new Date(L.getFullYear(),L.getMonth(),L.getDate(),ce.hour,ce.minute);be(ce.hour),We(ce.minute),V||R(Oe),s?.(Oe)}else{const L=new Date(M.getFullYear(),M.getMonth(),M.getDate());V||R(L),s?.(L),Ye()}else if(!De)we(new Date(M.getFullYear(),M.getMonth(),M.getDate()));else{const L=De,me=new Date(M.getFullYear(),M.getMonth(),M.getDate()),ce=L<=me?{start:L,end:me}:{start:me,end:L};ve||he(ce),r?.(ce),we(null),Ye()}},[t,m,Pe,v,De,V,ve,s,r,Ye,Be]),Pt=l.useCallback(M=>{const L=M.getValue();if(L instanceof Date){let me=L;if(m&&v){const ce=new Date(me.getFullYear(),me.getMonth(),me.getDate()),Oe=Et(v(ce));if(Oe){const dt=Yt(me.getHours(),me.getMinutes(),Oe,Pe);me=new Date(ce.getFullYear(),ce.getMonth(),ce.getDate(),dt.hour,dt.minute)}}V||R(me),s?.(me)}else{const me=L;ve||he(me),r?.(me),me.start&&X(new Date(me.start.getFullYear(),me.start.getMonth(),1))}Ye()},[V,ve,s,r,Ye,m,v,Pe]),Xt=l.useCallback(M=>{if(M.stopPropagation(),Ke.current=!1,t==="single")Qe(""),V||R(null),s?.(null);else{xt(""),tt("");const L={start:null,end:null};ve||he(L),r?.(L),we(null)}},[t,V,ve,s,r]),xn=l.useCallback(M=>{const L=m?hi(M.target.value,W):aa(M.target.value,o);Qe(L);const me=m?W.length:o.length;if(L.length===me){const ce=m?ui(L,W):na(L,o);if(ce&&!Be(ce)){if(m){const Oe=new Date(ce.getFullYear(),ce.getMonth(),ce.getDate()),dt=v?Et(v(Oe)):yt();if(!dt||!Hn(ce.getHours(),ce.getMinutes(),dt,Pe))return;be(ce.getHours()),We(ce.getMinutes())}V||R(ce),s?.(ce),X(new Date(ce.getFullYear(),ce.getMonth(),1))}}else L.length===0&&(V||R(null),s?.(null))},[o,W,m,Pe,v,V,s,Be]),Zt=l.useCallback(M=>{const L=aa(M.target.value,o);if(xt(L),L.length===o.length){const me=na(L,o);if(me&&!Be(me)){const ce={start:me,end:le.end};ve||he(ce),r?.(ce),X(new Date(me.getFullYear(),me.getMonth(),1))}}},[o,le.end,ve,r,Be]),vn=l.useCallback(M=>{const L=aa(M.target.value,o);if(tt(L),L.length===o.length){const me=na(L,o);if(me&&!Be(me)){const ce={start:le.start,end:me};ve||he(ce),r?.(ce)}}},[o,le.start,ve,r,Be]),pt=l.useCallback(M=>{const L=M.relatedTarget;Fe.current?.contains(L)||at.current?.contains(L)||(Ke.current=!1,Qe(P?m?Bn(P,W):Je(P,o):""),xt(le.start?Je(le.start,o):""),tt(le.end?Je(le.end,o):""))},[P,le.start,le.end,o,m,W]),Jt=l.useCallback(()=>{if(t==="single"&&P){const M=new Date(P.getFullYear(),P.getMonth(),P.getDate()),L=v?Et(v(M)):yt();if(!L){Ye();return}const me=Yt(ge,Ae,L,Pe),ce=new Date(P.getFullYear(),P.getMonth(),P.getDate(),me.hour,me.minute);V||R(ce),s?.(ce)}Ye()},[t,P,ge,Ae,V,s,Ye,v,Pe]),bn=(()=>{if(t==="single")return P?m?Bn(P,W):Je(P,o):"";const{start:M,end:L}=le;return M&&L?`${Je(M,o)} – ${Je(L,o)}`:M?`${Je(M,o)} – ...`:""})(),jn=t==="single"?!!P:!!(le.start||le.end),yn=(M,L)=>{const me=Be(M),ce=M.getMonth()!==L,Oe=Wt(M,b);let dt=!1,qe=!1,Ht=!1,Cn=!1;if(t==="single"&&P&&(dt=Wt(M,P)),t==="range"){const _=De??le.start,E=De?O??null:le.end;_&&Wt(M,_)&&(qe=!0),E&&Wt(M,E)&&(Ht=!0),_&&E&&ci(M,_,E)&&(Cn=!0)}return Ge("ui-datepicker__day",ce&&"ui-datepicker__day--outside",Oe&&"ui-datepicker__day--today",me&&"ui-datepicker__day--disabled",dt&&"ui-datepicker__day--selected",(qe||Ht)&&"ui-datepicker__day--range-cap",qe&&"ui-datepicker__day--range-start",Ht&&"ui-datepicker__day--range-end",Cn&&"ui-datepicker__day--in-range")},Ue=(M,L,me)=>{const ce=M.getFullYear(),Oe=M.getMonth(),dt=di(ce,Oe);return e.jsxs("div",{className:"ui-datepicker__calendar",children:[e.jsxs("div",{className:"ui-datepicker__nav",children:[e.jsx("button",{type:"button",className:Ge("ui-datepicker__nav-btn",!L&&"ui-datepicker__nav-btn--hidden"),onClick:()=>{X(hn(U,-1)),N("days")},disabled:!L,"aria-label":"Previous month",children:e.jsx(sa,{})}),e.jsxs("button",{type:"button",className:"ui-datepicker__nav-title",onClick:()=>N(ke==="days"?"months":"days"),"aria-label":`${ta[Oe]} ${ce}. Click to choose month`,children:[ta[Oe]," ",ce]}),e.jsx("button",{type:"button",className:Ge("ui-datepicker__nav-btn",!me&&"ui-datepicker__nav-btn--hidden"),onClick:()=>{X(hn(U,1)),N("days")},disabled:!me,"aria-label":"Next month",children:e.jsx(ra,{})})]}),e.jsx("div",{className:"ui-datepicker__weekdays","aria-hidden":"true",children:oi.map(qe=>e.jsx("span",{className:"ui-datepicker__weekday",children:qe},qe))}),e.jsx("div",{className:"ui-datepicker__grid",role:"grid","aria-label":`${ta[Oe]} ${ce}`,children:dt.map((qe,Ht)=>e.jsx("button",{type:"button",role:"gridcell",className:yn(qe,Oe),disabled:Be(qe),"aria-label":Je(qe),"aria-pressed":t==="single"&&P?Wt(qe,P):void 0,onClick:()=>gn(qe),onMouseEnter:()=>{t==="range"&&De&&oe(new Date(qe.getFullYear(),qe.getMonth(),qe.getDate()))},onMouseLeave:()=>{t==="range"&&De&&oe(null)},tabIndex:-1,children:qe.getDate()},Ht))})]},`${ce}-${Oe}`)},kn=()=>e.jsxs("div",{className:"ui-datepicker__calendar ui-datepicker__calendar--picker",children:[e.jsxs("div",{className:"ui-datepicker__nav",children:[e.jsx("button",{type:"button",className:"ui-datepicker__nav-btn",onClick:()=>X(hn(U,-12)),"aria-label":"Previous year",children:e.jsx(sa,{})}),e.jsx("button",{type:"button",className:"ui-datepicker__nav-title",onClick:()=>N("years"),"aria-label":`${U.getFullYear()}. Click to choose year`,children:U.getFullYear()}),e.jsx("button",{type:"button",className:"ui-datepicker__nav-btn",onClick:()=>X(hn(U,12)),"aria-label":"Next year",children:e.jsx(ra,{})})]}),e.jsx("div",{className:"ui-datepicker__month-grid",children:li.map((M,L)=>e.jsx("button",{type:"button",className:Ge("ui-datepicker__month-cell",U.getMonth()===L&&"ui-datepicker__month-cell--active",b.getFullYear()===U.getFullYear()&&b.getMonth()===L&&"ui-datepicker__month-cell--today"),onClick:()=>{X(new Date(U.getFullYear(),L,1)),N("days")},children:M},L))})]}),wn=()=>{const M=Array.from({length:12},(L,me)=>de+me);return e.jsxs("div",{className:"ui-datepicker__calendar ui-datepicker__calendar--picker",children:[e.jsxs("div",{className:"ui-datepicker__nav",children:[e.jsx("button",{type:"button",className:"ui-datepicker__nav-btn",onClick:()=>fe(L=>L-12),"aria-label":"Previous years",children:e.jsx(sa,{})}),e.jsxs("span",{className:"ui-datepicker__nav-title ui-datepicker__nav-title--static",children:[de," – ",de+11]}),e.jsx("button",{type:"button",className:"ui-datepicker__nav-btn",onClick:()=>fe(L=>L+12),"aria-label":"Next years",children:e.jsx(ra,{})})]}),e.jsx("div",{className:"ui-datepicker__year-grid",children:M.map(L=>e.jsx("button",{type:"button",className:Ge("ui-datepicker__year-cell",U.getFullYear()===L&&"ui-datepicker__year-cell--active",b.getFullYear()===L&&"ui-datepicker__year-cell--today"),onClick:()=>{X(new Date(L,U.getMonth(),1)),fe(L-4),N("months")},children:L},L))})]})},Nn=()=>{const M=L=>{if(pe===void 0||pe==="no-date")return;const me=pe==="full"?yt():pe;if(!me)return;const ce=It(L,me,Pe);be(L),We(Oe=>ce.includes(Oe)?Oe:ce[0]??0)};return pe==="no-date"?e.jsxs("aside",{className:"ui-datepicker__time-sidebar","aria-label":"Time",children:[e.jsx("p",{className:"ui-datepicker__time-empty",children:"Select a date"}),e.jsx("button",{type:"button",className:"ui-datepicker__apply-btn",disabled:!0,children:"Apply"})]}):pe===null||Ce.length===0?e.jsxs("aside",{className:"ui-datepicker__time-sidebar","aria-label":"Time",children:[e.jsx("p",{className:"ui-datepicker__time-empty",children:"No available times"}),e.jsx("button",{type:"button",className:"ui-datepicker__apply-btn",disabled:!0,children:"Apply"})]}):e.jsxs("aside",{className:"ui-datepicker__time-sidebar","aria-label":"Time",children:[e.jsxs("div",{className:"ui-datepicker__time-columns",children:[e.jsxs("div",{className:"ui-datepicker__time-scroll-col",children:[e.jsx("span",{className:"ui-datepicker__time-scroll-head",id:`${Q}-hour-col`,children:"Hr"}),e.jsx("div",{ref:et,className:"ui-datepicker__time-scroll-list",role:"listbox","aria-labelledby":`${Q}-hour-col`,children:Ce.map(L=>e.jsx("button",{type:"button",className:Ge("ui-datepicker__time-scroll-item",ge===L&&"ui-datepicker__time-scroll-item--selected"),"data-time-value":L,role:"option","aria-selected":ge===L,tabIndex:-1,onClick:()=>M(L),children:String(L).padStart(2,"0")},L))})]}),e.jsxs("div",{className:"ui-datepicker__time-scroll-col",children:[e.jsx("span",{className:"ui-datepicker__time-scroll-head",id:`${Q}-min-col`,children:"Min"}),e.jsx("div",{ref:st,className:"ui-datepicker__time-scroll-list",role:"listbox","aria-labelledby":`${Q}-min-col`,children:ht.map(L=>e.jsx("button",{type:"button",className:Ge("ui-datepicker__time-scroll-item",Ae===L&&"ui-datepicker__time-scroll-item--selected"),"data-time-value":L,role:"option","aria-selected":Ae===L,tabIndex:-1,onClick:()=>We(L),children:String(L).padStart(2,"0")},L))})]})]}),e.jsx("button",{type:"button",className:"ui-datepicker__apply-btn",onClick:Jt,children:"Apply"})]})},zt=hn(U,1),Qt=()=>e.jsx("div",{ref:Fe,className:Ge("ui-datepicker__popup",F?.popup),style:{position:"fixed",top:C?.top,bottom:C?.bottom,left:C?.left,maxHeight:C?.maxHeight,visibility:ae?"visible":"hidden",...nt!==void 0?{zIndex:nt}:null},onClick:M=>M.stopPropagation(),onMouseDown:M=>M.stopPropagation(),role:"dialog","aria-label":"Choose date","aria-modal":"true",children:e.jsxs("div",{className:"ui-datepicker__popup-inner",children:[I.length>0&&e.jsx("div",{className:"ui-datepicker__presets",children:I.map((M,L)=>e.jsx("button",{type:"button",className:"ui-datepicker__preset-btn",onClick:()=>Pt(M),children:M.label},L))}),e.jsxs("div",{className:Ge("ui-datepicker__body",m&&t==="single"&&ke==="days"&&"ui-datepicker__body--with-time"),children:[ke==="days"&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"ui-datepicker__calendars-block",children:[e.jsxs("div",{className:Ge("ui-datepicker__calendars",A&&"ui-datepicker__calendars--two"),children:[Ue(U,!0,!A),A&&Ue(zt,!1,!0)]}),t==="range"&&e.jsx("p",{className:"ui-datepicker__range-hint",children:De?"Select end date":le.start&&le.end?`${Je(le.start,o)} – ${Je(le.end,o)}`:"Select start date"})]}),m&&t==="single"&&Nn()]}),ke==="months"&&kn(),ke==="years"&&wn()]})]})}),wt=jn&&!H&&e.jsx("button",{type:"button",className:"ui-datepicker__clear-btn",onClick:Xt,onMouseDown:M=>M.preventDefault(),"aria-label":"Clear date",tabIndex:-1,children:e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round","aria-hidden":"true",focusable:"false",children:[e.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),e.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})}),Rt=e.jsx("button",{type:"button",className:Ge("ui-datepicker__input-icon-btn",_e&&"ui-datepicker__input-icon-btn--open"),tabIndex:-1,disabled:H,onMouseDown:M=>M.preventDefault(),onClick:_e?Ye:kt,"aria-label":"Open calendar",children:e.jsx(as,{})}),en=M=>{Ke.current=!0,kt(),J?.(M)},Y=M=>{pt(M),re?.(M)},xe=Ge("ui-datepicker__input",`ui-datepicker__input--${te}`,F?.input),Me=Ge("ui-datepicker__input","ui-datepicker__input--range",`ui-datepicker__input--${te}`,F?.input),Se={disabled:H,required:Z,"aria-expanded":_e,"aria-haspopup":"dialog","aria-invalid":$,onFocus:en,onBlur:Y},Te=()=>e.jsxs(e.Fragment,{children:[k&&e.jsxs("label",{htmlFor:G,className:Ge("ui-datepicker__label",$&&"ui-datepicker__label--error",F?.label),children:[k,Z&&e.jsx("span",{className:"ui-datepicker__label-required",children:"*"})]}),e.jsxs("div",{className:Ge("ui-datepicker__input-wrapper",`ui-datepicker__input-wrapper--${te}`,t==="range"&&"ui-datepicker__input-wrapper--range",$&&"ui-datepicker__input-wrapper--error",H&&"ui-datepicker__input-wrapper--disabled",_e&&"ui-datepicker__input-wrapper--open",!!B&&"ui-datepicker__input-wrapper--with-start-adornment",!!ne&&"ui-datepicker__input-wrapper--with-end-adornment",F?.wrapper),children:[B&&e.jsx("span",{className:"ui-datepicker__adornment ui-datepicker__adornment--start",children:B}),t==="single"?e.jsx("input",{...je,ref:ye,id:G,type:"text",inputMode:"numeric",className:xe,value:ct,placeholder:c??(m?W:o),"aria-label":k??c??"Select date",onChange:xn,...Se}):e.jsxs(e.Fragment,{children:[e.jsx("input",{...je,ref:ye,id:G,type:"text",inputMode:"numeric",className:Me,value:gt,placeholder:o,"aria-label":"Start date",onChange:Zt,...Se}),e.jsx("span",{className:"ui-datepicker__range-sep","aria-hidden":"true",children:"–"}),e.jsx("input",{type:"text",inputMode:"numeric",className:Me,value:Re,placeholder:o,"aria-label":"End date",onChange:vn,...Se})]}),ne&&e.jsx("span",{className:"ui-datepicker__adornment ui-datepicker__adornment--end",children:ne}),wt,Rt]})]}),tn=()=>e.jsx("button",{type:"button",className:Ge("ui-datepicker__icon-trigger",_e&&"ui-datepicker__icon-trigger--open",H&&"ui-datepicker__icon-trigger--disabled"),disabled:H,onClick:_e?Ye:kt,"aria-label":bn||"Select date","aria-expanded":_e,"aria-haspopup":"dialog",children:e.jsx(as,{})});return e.jsxs("div",{ref:at,className:Ge("ui-datepicker",D&&"ui-datepicker--full-width",F?.root),style:Ne,children:[i==="input"?Te():tn(),T&&i==="input"&&e.jsx("p",{className:Ge("ui-datepicker__helper-text",$&&"ui-datepicker__helper-text--error",F?.helperText),children:T}),_e&&C&&Mt.createPortal(Qt(),document.body)]})});ia.displayName="DatePicker";const pn=8,mi="HH:mm",ft=(...t)=>t.filter(Boolean).join(" ");function ut(t,n,s){const a=t??new Date;return new Date(a.getFullYear(),a.getMonth(),a.getDate(),n,s,0,0)}function it(t,n){const s=String(t.getHours()).padStart(2,"0"),a=String(t.getMinutes()).padStart(2,"0");return n.replace("HH",s).replace("mm",a)}function la(t,n){if(t.length!==n.length)return null;const s=n.indexOf("HH"),a=n.indexOf("mm");if(s<0||a<0)return null;const r=parseInt(t.slice(s,s+2),10),i=parseInt(t.slice(a,a+2),10);return isNaN(r)||isNaN(i)||r<0||r>23||i<0||i>59?null:{hour:r,minute:i}}function oa(t,n){const s=t.replace(/\D/g,"").slice(0,4);if(!s.length)return"";let a=0,r="",i=0;for(;i<n.length;)if(n.startsWith("HH",i)||n.startsWith("mm",i)){if(a>=s.length||(r+=s[a++],a>=s.length))break;r+=s[a++],i+=2}else{if(a<s.length)r+=n[i];else break;i+=1}return r}const ss=(t,n,s)=>{const a=window.innerHeight-t.bottom-pn,r=t.top-pn,i=s>a&&r>a;let o=t.left;return o+n>window.innerWidth-8&&(o=Math.max(8,window.innerWidth-8-n)),i?{bottom:window.innerHeight-t.top+pn,left:o,maxHeight:Math.min(420,r)}:{top:t.bottom+pn,left:o,maxHeight:Math.min(420,a)}};function rs(){return e.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",focusable:"false",children:[e.jsx("circle",{cx:"12",cy:"12",r:"9"}),e.jsx("polyline",{points:"12 7 12 12 15.5 14"})]})}const is=l.forwardRef(({mode:t="single",value:n,onChange:s,rangeValue:a,onRangeChange:r,triggerVariant:i="input",format:o=mi,placeholder:c,timeStep:d=1,bounds:u,label:p,helperText:f,error:h=!1,disabled:m=!1,required:x=!1,size:v="normal",fullWidth:g=!1,startAdornment:y,endAdornment:S,sx:k,style:T,id:$,onFocus:H,onBlur:Z,...te},D)=>{const B=l.useId(),ne=$||`${B}-input`,F=Math.max(1,Math.floor(d)),Ne=n!==void 0,ue=a!==void 0,[J,re]=l.useState(null),[je,ye]=l.useState({start:null,end:null}),Q=Ne?n??null:J,G=ue?a??je:je,b=l.useMemo(()=>Et(u),[u]),A=u===null||b===null,I=b??yt(),W=l.useMemo(()=>A?[]:Ra(I,F),[A,I,F]),[V,ve]=l.useState(!1),[w,R]=l.useState(null),[ie,he]=l.useState(!1),P=Q?.getHours()??W[0]??0,le=Q?.getMinutes()??0,[$e,Pe]=l.useState(P),[pe,Ce]=l.useState(le),_e=l.useMemo(()=>A?[]:It($e,I,F),[A,I,F,$e]),[ze,C]=l.useState(G.start?.getHours()??W[0]??0),[q,ae]=l.useState(G.start?.getMinutes()??0),[j,z]=l.useState(G.end?.getHours()??W[W.length-1]??0),[U,X]=l.useState(G.end?.getMinutes()??0),ke=l.useMemo(()=>A?[]:It(ze,I,F),[A,I,F,ze]),N=l.useMemo(()=>A?[]:It(j,I,F),[A,I,F,j]),de=l.useRef(!1),[fe,De]=l.useState(()=>Q?it(Q,o):""),[we,O]=l.useState(()=>G.start?it(G.start,o):""),[oe,ge]=l.useState(()=>G.end?it(G.end,o):""),be=l.useRef(null),Ae=l.useRef(null),We=l.useContext(bt),ht=We?We.baseZ+rn:void 0,Ke=l.useRef(null),ct=l.useRef(null),Qe=l.useRef(null),gt=l.useRef(null),xt=l.useRef(null),Re=l.useRef(null),tt=l.useCallback(()=>{ve(!1)},[]),at=l.useCallback(()=>{m||ve(!0)},[m]);At({enabled:V,onEscape:tt}),l.useEffect(()=>{if(!V){R(null),he(!1);return}const Y=be.current;if(!Y)return;const xe=Y.getBoundingClientRect();R({top:xe.bottom+pn,left:xe.left,maxHeight:420}),he(!1);const Me=Te=>{!be.current?.contains(Te.target)&&!Ae.current?.contains(Te.target)&&tt()};setTimeout(()=>document.addEventListener("mousedown",Me),0);const Se=()=>{if(!Ae.current||!be.current)return;const Te=be.current.getBoundingClientRect();R(ss(Te,Ae.current.offsetWidth,Ae.current.offsetHeight))};return window.addEventListener("scroll",Se,!0),window.addEventListener("resize",Se),()=>{window.removeEventListener("scroll",Se,!0),window.removeEventListener("resize",Se),document.removeEventListener("mousedown",Me)}},[V,tt]),l.useLayoutEffect(()=>{if(!V||ie||!Ae.current||!be.current)return;const Y=be.current.getBoundingClientRect();R(ss(Y,Ae.current.offsetWidth,Ae.current.offsetHeight)),he(!0)},[V,w,ie]),l.useLayoutEffect(()=>{if(!V||!ie)return;const Y=xe=>xe?.scrollIntoView({block:"center"});t==="single"?(Y(Ke.current?.querySelector(`[data-time-value="${$e}"]`)),Y(ct.current?.querySelector(`[data-time-value="${pe}"]`))):(Y(Qe.current?.querySelector(`[data-time-value="${ze}"]`)),Y(gt.current?.querySelector(`[data-time-value="${q}"]`)),Y(xt.current?.querySelector(`[data-time-value="${j}"]`)),Y(Re.current?.querySelector(`[data-time-value="${U}"]`)))},[V,ie,t,$e,pe,ze,q,j,U]),l.useEffect(()=>{if(t!=="single"||!Q||A)return;const Y=Yt(Q.getHours(),Q.getMinutes(),I,F);Pe(Y.hour),Ce(Y.minute)},[t,Q,A,I,F]),l.useEffect(()=>{if(t==="range"&&!A){if(G.start){const Y=Yt(G.start.getHours(),G.start.getMinutes(),I,F);C(Y.hour),ae(Y.minute)}if(G.end){const Y=Yt(G.end.getHours(),G.end.getMinutes(),I,F);z(Y.hour),X(Y.minute)}}},[t,G.start,G.end,A,I,F]),l.useEffect(()=>{de.current||t==="single"&&De(Q?it(Q,o):"")},[Q,o,t]),l.useEffect(()=>{de.current||t==="range"&&(O(G.start?it(G.start,o):""),ge(G.end?it(G.end,o):""))},[t,G.start,G.end,o]);const Fe=l.useCallback(Y=>{Ne||re(Y),s?.(Y)},[Ne,s]),et=l.useCallback(Y=>{ue||ye(Y),r?.(Y)},[ue,r]),Gt=Y=>{if(A)return;de.current=!1;const xe=It(Y,I,F),Me=xe.includes(pe)?pe:xe[0]??0;Pe(Y),Ce(Me),Fe(ut(Q,Y,Me))},nt=Y=>{A||(de.current=!1,Ce(Y),Fe(ut(Q,$e,Y)))},st=(Y,xe)=>{if(A)return;de.current=!1;const Me=It(xe,I,F);if(Y==="start"){const Se=Me.includes(q)?q:Me[0]??0;C(xe),ae(Se),Ye("start",xe,Se)}else{const Se=Me.includes(U)?U:Me[0]??0;z(xe),X(Se),Ye("end",xe,Se)}},Be=(Y,xe)=>{A||(de.current=!1,Y==="start"?(ae(xe),Ye("start",ze,xe)):(X(xe),Ye("end",j,xe)))},Ye=(Y,xe,Me)=>{if(Y==="start"){const Se=ut(G.start,xe,Me);let Te=G.end;Te&&Te.getTime()<Se.getTime()&&(Te=ut(Te,xe,Me),z(xe),X(Me)),et({start:Se,end:Te})}else{const Se=G.start;let Te=ut(G.end??G.start,xe,Me);Se&&Te.getTime()<Se.getTime()&&(Te=ut(Te,Se.getHours(),Se.getMinutes()),z(Se.getHours()),X(Se.getMinutes())),et({start:Se,end:Te})}},kt=l.useCallback(Y=>{Y.stopPropagation(),de.current=!1,t==="single"?(De(""),Fe(null)):(O(""),ge(""),et({start:null,end:null}))},[t,Fe,et]),gn=l.useCallback(Y=>{const xe=oa(Y.target.value,o);if(De(xe),xe.length===o.length){const Me=la(xe,o);if(!Me||!A&&!Hn(Me.hour,Me.minute,I,F))return;Fe(ut(Q,Me.hour,Me.minute))}else xe.length===0&&Fe(null)},[o,A,I,F,Fe,Q]),Pt=l.useCallback(Y=>{const xe=oa(Y.target.value,o);if(O(xe),xe.length===o.length){const Me=la(xe,o);if(!Me||!A&&!Hn(Me.hour,Me.minute,I,F))return;const Se=ut(G.start,Me.hour,Me.minute);let Te=G.end;Te&&Te.getTime()<Se.getTime()&&(Te=ut(Te,Se.getHours(),Se.getMinutes())),et({start:Se,end:Te})}},[o,A,I,F,G.start,G.end,et]),Xt=l.useCallback(Y=>{const xe=oa(Y.target.value,o);if(ge(xe),xe.length===o.length){const Me=la(xe,o);if(!Me||!A&&!Hn(Me.hour,Me.minute,I,F))return;let Se=ut(G.end??G.start,Me.hour,Me.minute);const Te=G.start;Te&&Se.getTime()<Te.getTime()&&(Se=ut(Se,Te.getHours(),Te.getMinutes())),et({start:G.start,end:Se})}},[o,A,I,F,G.start,G.end,et]),xn=l.useCallback(Y=>{const xe=Y.relatedTarget;Ae.current?.contains(xe)||be.current?.contains(xe)||(de.current=!1,De(Q?it(Q,o):""),O(G.start?it(G.start,o):""),ge(G.end?it(G.end,o):""))},[Q,G.start,G.end,o]),Zt=(()=>{if(t==="single")return Q?it(Q,o):"";const{start:Y,end:xe}=G;return Y&&xe?`${it(Y,o)} – ${it(xe,o)}`:Y?`${it(Y,o)} – ...`:""})(),vn=t==="single"?!!Q:!!(G.start||G.end),pt=(Y,xe,Me,Se,Te,tn)=>e.jsxs("div",{className:"ui-timepicker__col",children:[e.jsx("span",{className:"ui-timepicker__col-head",id:Y,children:xe}),e.jsx("div",{ref:tn,className:"ui-timepicker__col-list",role:"listbox","aria-labelledby":Y,children:Me.map(M=>e.jsx("button",{type:"button",className:ft("ui-timepicker__col-item",Se===M&&"ui-timepicker__col-item--selected"),"data-time-value":M,role:"option","aria-selected":Se===M,tabIndex:-1,onClick:()=>Te(M),children:String(M).padStart(2,"0")},M))})]}),Jt=()=>e.jsx("div",{className:"ui-timepicker__empty",children:e.jsx("p",{children:"No available times"})}),bn=()=>A||W.length===0?Jt():e.jsx("div",{className:"ui-timepicker__body",children:e.jsx("div",{className:"ui-timepicker__group",children:e.jsxs("div",{className:"ui-timepicker__columns",children:[pt(`${B}-hr`,"Hour",W,$e,Gt,Ke),pt(`${B}-min`,"Minute",_e,pe,nt,ct)]})})}),jn=()=>A||W.length===0?Jt():e.jsxs("div",{className:"ui-timepicker__body ui-timepicker__body--range",children:[e.jsxs("div",{className:"ui-timepicker__group",children:[e.jsx("span",{className:"ui-timepicker__group-label",children:"From"}),e.jsxs("div",{className:"ui-timepicker__columns",children:[pt(`${B}-shr`,"Hour",W,ze,Y=>st("start",Y),Qe),pt(`${B}-smin`,"Minute",ke,q,Y=>Be("start",Y),gt)]})]}),e.jsxs("div",{className:"ui-timepicker__group",children:[e.jsx("span",{className:"ui-timepicker__group-label",children:"To"}),e.jsxs("div",{className:"ui-timepicker__columns",children:[pt(`${B}-ehr`,"Hour",W,j,Y=>st("end",Y),xt),pt(`${B}-emin`,"Minute",N,U,Y=>Be("end",Y),Re)]})]})]}),yn=()=>e.jsx("div",{ref:Ae,className:ft("ui-timepicker__popup",k?.popup),style:{position:"fixed",top:w?.top,bottom:w?.bottom,left:w?.left,maxHeight:w?.maxHeight,visibility:ie?"visible":"hidden",...ht!==void 0?{zIndex:ht}:null},onClick:Y=>Y.stopPropagation(),onMouseDown:Y=>Y.stopPropagation(),role:"dialog","aria-label":"Choose time","aria-modal":"true",children:e.jsx("div",{className:"ui-timepicker__popup-inner",children:t==="single"?bn():jn()})}),Ue=vn&&!m&&e.jsx("button",{type:"button",className:"ui-timepicker__clear-btn",onClick:kt,onMouseDown:Y=>Y.preventDefault(),"aria-label":"Clear time",tabIndex:-1,children:e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round","aria-hidden":"true",focusable:"false",children:[e.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),e.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})}),kn=e.jsx("button",{type:"button",className:ft("ui-timepicker__icon-btn",V&&"ui-timepicker__icon-btn--open"),tabIndex:-1,disabled:m,onMouseDown:Y=>Y.preventDefault(),onClick:V?tt:at,"aria-label":"Open time picker",children:e.jsx(rs,{})}),wn=Y=>{de.current=!0,at(),H?.(Y)},Nn=Y=>{xn(Y),Z?.(Y)},zt=ft("ui-timepicker__input",`ui-timepicker__input--${v}`,k?.input),Qt=ft("ui-timepicker__input","ui-timepicker__input--range",`ui-timepicker__input--${v}`,k?.input),wt={disabled:m,required:x,"aria-expanded":V,"aria-haspopup":"dialog","aria-invalid":h,onFocus:wn,onBlur:Nn},Rt=()=>e.jsxs(e.Fragment,{children:[p&&e.jsxs("label",{htmlFor:ne,className:ft("ui-timepicker__label",h&&"ui-timepicker__label--error",k?.label),children:[p,x&&e.jsx("span",{className:"ui-timepicker__label-required",children:"*"})]}),e.jsxs("div",{className:ft("ui-timepicker__input-wrapper",`ui-timepicker__input-wrapper--${v}`,t==="range"&&"ui-timepicker__input-wrapper--range",h&&"ui-timepicker__input-wrapper--error",m&&"ui-timepicker__input-wrapper--disabled",V&&"ui-timepicker__input-wrapper--open",!!y&&"ui-timepicker__input-wrapper--with-start-adornment",!!S&&"ui-timepicker__input-wrapper--with-end-adornment",k?.wrapper),children:[y&&e.jsx("span",{className:"ui-timepicker__adornment ui-timepicker__adornment--start",children:y}),t==="single"?e.jsx("input",{...te,ref:D,id:ne,type:"text",inputMode:"numeric",className:zt,value:fe,placeholder:c??o,"aria-label":p??c??"Select time",onChange:gn,...wt}):e.jsxs(e.Fragment,{children:[e.jsx("input",{...te,ref:D,id:ne,type:"text",inputMode:"numeric",className:Qt,value:we,placeholder:o,"aria-label":"Start time",onChange:Pt,...wt}),e.jsx("span",{className:"ui-timepicker__range-sep","aria-hidden":"true",children:"–"}),e.jsx("input",{type:"text",inputMode:"numeric",className:Qt,value:oe,placeholder:o,"aria-label":"End time",onChange:Xt,...wt})]}),S&&e.jsx("span",{className:"ui-timepicker__adornment ui-timepicker__adornment--end",children:S}),Ue,kn]})]}),en=()=>e.jsx("button",{type:"button",className:ft("ui-timepicker__icon-trigger",V&&"ui-timepicker__icon-trigger--open",m&&"ui-timepicker__icon-trigger--disabled"),disabled:m,onClick:V?tt:at,"aria-label":Zt||"Select time","aria-expanded":V,"aria-haspopup":"dialog",children:e.jsx(rs,{})});return l.useEffect(()=>{if(!V||t!=="single"||Q||A)return;const Y=Qa(I,F);Y&&(Pe(Y.hour),Ce(Y.minute))},[V,t,Q,A,I,F]),e.jsxs("div",{ref:be,className:ft("ui-timepicker",g&&"ui-timepicker--full-width",k?.root),style:T,children:[i==="input"?Rt():en(),f&&i==="input"&&e.jsx("p",{className:ft("ui-timepicker__helper-text",h&&"ui-timepicker__helper-text--error",k?.helperText),children:f}),V&&w&&Mt.createPortal(yn(),document.body)]})});is.displayName="TimePicker";const ca=({checked:t,defaultChecked:n,onChange:s,label:a,color:r="primary",size:i="medium",isIndeterminate:o=!1,isDisabled:c=!1,name:d,value:u,id:p,sx:f,style:h})=>{const m=l.useRef(null);l.useEffect(()=>{m.current&&(m.current.indeterminate=o)},[o]);const x=["ui-checkbox",`ui-checkbox--${r}`,`ui-checkbox--${i}`,c&&"ui-checkbox--disabled",f].filter(Boolean).join(" "),v=g=>{c||s?.(g.target.checked,g)};return e.jsxs("label",{className:x,style:h,children:[e.jsx("input",{ref:m,type:"checkbox",className:"ui-checkbox__input",checked:t,defaultChecked:n,disabled:c,name:d,value:u,id:p,onChange:v,"aria-checked":o?"mixed":t}),e.jsx("span",{className:"ui-checkbox__box","aria-hidden":"true",children:o?e.jsx("svg",{className:"ui-checkbox__mark",viewBox:"0 0 12 12",focusable:"false",children:e.jsx("line",{x1:"2",y1:"6",x2:"10",y2:"6",strokeWidth:"2",strokeLinecap:"round"})}):e.jsx("svg",{className:"ui-checkbox__mark",viewBox:"0 0 12 12",focusable:"false",children:e.jsx("polyline",{points:"1.5,6 4.5,9 10.5,3",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",fill:"none"})})}),a!=null&&e.jsx("span",{className:"ui-checkbox__label",children:a})]})};ca.displayName="Checkbox";const ls=l.createContext(null),os=l.createContext(null),cs=()=>{const t=l.useContext(ls);if(!t)throw new Error("AccordionTrigger/AccordionContent must be inside AccordionRoot");return t},ds=()=>{const t=l.useContext(os);if(!t)throw new Error("AccordionTrigger/AccordionContent must be inside AccordionItem");return t},da=({children:t,variant:n="outlined",size:s="medium",allowMultiple:a=!1,defaultOpenIds:r=[],onToggle:i,divider:o=!0,sx:c,style:d})=>{const[u,p]=l.useState(new Set(r)),f=l.useCallback(m=>{p(x=>{const v=new Set(x),g=v.has(m);return g?v.delete(m):(a||v.clear(),v.add(m)),i?.(m,!g),v})},[a,i]),h=["ui-accordion",`ui-accordion--${n}`,`ui-accordion--${s}`,o&&"ui-accordion--divider",c].filter(Boolean).join(" ");return e.jsx(ls.Provider,{value:{openIds:u,toggle:f},children:e.jsx("div",{className:h,style:d,children:t})})};da.displayName="AccordionRoot";const ua=({id:t,children:n,isDisabled:s=!1,sx:a,style:r})=>{const{openIds:i}=cs(),o=i.has(t),c=["ui-accordion__item",o&&"ui-accordion__item--open",s&&"ui-accordion__item--disabled",a].filter(Boolean).join(" ");return e.jsx(os.Provider,{value:{itemId:t,isOpen:o,isDisabled:s},children:e.jsx("div",{className:c,style:r,children:n})})};ua.displayName="AccordionItem";const ha=({children:t,showChevron:n=!0,startAdornment:s,endAdornment:a,sx:r,style:i})=>{const{toggle:o}=cs(),{itemId:c,isOpen:d,isDisabled:u}=ds(),p=["ui-accordion__trigger",r].filter(Boolean).join(" "),f=!!(s||a),h=n&&e.jsx("span",{className:["ui-accordion__chevron",d&&"ui-accordion__chevron--open"].filter(Boolean).join(" "),"aria-hidden":"true",children:e.jsx(Qn,{})}),m=e.jsxs("button",{className:p,type:"button","aria-expanded":d,"aria-controls":`accordion-content-${c}`,id:`accordion-header-${c}`,disabled:u,onClick:()=>o(c),style:i,children:[t,!f&&h]});if(!f)return m;const x=v=>v.stopPropagation();return e.jsxs("div",{className:"ui-accordion__header",children:[s&&e.jsx("div",{className:"ui-accordion__adornment ui-accordion__adornment--start",onClick:x,children:s}),m,a&&e.jsx("div",{className:"ui-accordion__adornment ui-accordion__adornment--end",onClick:x,children:a}),h&&e.jsx("span",{className:"ui-accordion__chevron-wrap",onClick:()=>!u&&o(c),"aria-hidden":"true",children:h})]})};ha.displayName="AccordionTrigger";const pa=({children:t,sx:n,style:s})=>{const{itemId:a}=ds(),r=["ui-accordion__content-inner",n].filter(Boolean).join(" ");return e.jsx("div",{id:`accordion-content-${a}`,role:"region","aria-labelledby":`accordion-header-${a}`,className:"ui-accordion__content",children:e.jsx("div",{className:r,style:s,children:t})})};pa.displayName="AccordionContent";const us=({items:t,...n})=>e.jsx(da,{...n,children:t.map(s=>e.jsxs(ua,{id:s.id,isDisabled:s.isDisabled,children:[e.jsxs(ha,{children:[s.icon&&e.jsx("span",{className:"ui-accordion__item-icon",children:s.icon}),e.jsx("span",{className:"ui-accordion__title",children:s.title})]}),e.jsx(pa,{children:s.content})]},s.id))});us.displayName="Accordion";function fi(t,n){return n}function _i(t,n){const s=t[n];return s==null||s===""?"-":s}function mn(t){if(t!==void 0)return typeof t=="number"?`${t}px`:t}function gi({row:t,rowIndex:n,visibleCols:s,tdClasses:a,stickyStyles:r,onRowClick:i,onKeyDown:o}){return e.jsx("tr",{className:"ui-table__tr",tabIndex:i?0:void 0,role:i?"button":void 0,onClick:i?()=>i(t,n):void 0,onKeyDown:o?c=>o(c,t,n):void 0,children:s.map((c,d)=>e.jsx("td",{className:a[d],style:r[d],children:c.render?c.render(t,n):_i(t,c.key)},c.key))})}const xi=l.memo(gi),He=4,hs=80,vi=({x:t,anchorTop:n,anchorBottom:s,items:a,onClose:r,portalNode:i,boundsRect:o})=>{const c=l.useRef(null),[d,u]=l.useState({left:t,top:s}),[p,f]=l.useState(()=>a.findIndex(x=>!x.disabled));At({enabled:!0,onEscape:r}),l.useLayoutEffect(()=>{const x=c.current;if(!x)return;x.style.maxHeight="";const v=x.getBoundingClientRect();let g=t-v.width,y=s,S;o&&v.width<=o.width?(g+v.width>o.right-He&&(g=o.right-v.width-He),g<o.left+He&&(g=o.left+He)):(g+v.width>window.innerWidth-He&&(g=window.innerWidth-v.width-He),g<He&&(g=He));const k=window.innerHeight-s-He,T=n-He;v.height<=k?y=s:v.height<=T?y=n-v.height:k>=T?(y=s,S=Math.max(hs,k)):(S=Math.max(hs,T),y=n-S),u({left:g,top:y,maxHeight:S})},[t,n,s,o]),l.useEffect(()=>{const x=g=>{c.current&&!c.current.contains(g.target)&&r()},v=()=>r();return document.addEventListener("pointerdown",x,!0),window.addEventListener("scroll",v,!0),window.addEventListener("resize",v),()=>{document.removeEventListener("pointerdown",x,!0),window.removeEventListener("scroll",v,!0),window.removeEventListener("resize",v)}},[r]),l.useEffect(()=>{c.current?.focus()},[]);const h=x=>{if(a.length===0)return;let v=p;for(let g=0;g<a.length;g+=1)if(v=(v+x+a.length)%a.length,!a[v].disabled){f(v);return}},m=x=>{if(x.key==="ArrowDown")x.preventDefault(),h(1);else if(x.key==="ArrowUp")x.preventDefault(),h(-1);else if(x.key==="Enter"||x.key===" "){x.preventDefault();const v=a[p];v&&!v.disabled&&(v.onSelect(),r())}};return i?Mt.createPortal(e.jsx("div",{ref:c,className:"ui-table__ctxmenu",role:"menu",tabIndex:-1,style:{left:d.left,top:d.top,maxHeight:d.maxHeight,overflowY:d.maxHeight?"auto":void 0},onKeyDown:m,onContextMenu:x=>x.preventDefault(),children:a.map((x,v)=>e.jsx("div",{role:"menuitem","aria-disabled":x.disabled||void 0,className:["ui-table__ctxmenu-item",x.disabled&&"ui-table__ctxmenu-item--disabled",v===p&&!x.disabled&&"ui-table__ctxmenu-item--focused"].filter(Boolean).join(" "),onMouseEnter:()=>!x.disabled&&f(v),onClick:x.disabled?void 0:()=>{x.onSelect(),r()},children:x.label},x.key))}),i):null},ps=120,ms=36,bi=8,ji=({x:t,anchorTop:n,anchorBottom:s,columns:a,pinnedKeys:r,hiddenKeys:i,visibleCount:o,canPin:c,canHide:d,canReorder:u,onTogglePin:p,onToggleHide:f,onUnpinAll:h,onShowAll:m,onReset:x,onReorder:v,hasUnpinnablePinned:g,hasHiddenColumns:y,labels:S,onClose:k,portalNode:T,boundsRect:$})=>{const H=l.useRef(null),Z=l.useRef(null),[te,D]=l.useState({left:t,top:s}),[B,ne]=l.useState(null),[F,Ne]=l.useState(!1),ue=l.useRef(null);At({enabled:!0,onEscape:k}),l.useLayoutEffect(()=>{const C=H.current;if(!C)return;C.style.maxHeight="";const q=C.getBoundingClientRect();let ae=t-q.width,j=s,z;$&&q.width<=$.width?(ae+q.width>$.right-He&&(ae=$.right-q.width-He),ae<$.left+He&&(ae=$.left+He)):(ae+q.width>window.innerWidth-He&&(ae=window.innerWidth-q.width-He),ae<He&&(ae=He));const U=window.innerHeight-s-He,X=n-He;q.height<=U?j=s:q.height<=X?j=n-q.height:U>=X?(j=s,z=Math.max(ps,U)):(z=Math.max(ps,X),j=n-z),D({left:ae,top:j,maxHeight:z})},[t,n,s,$]);const J=l.useCallback((C,q)=>{const ae=H.current,j=ae?.offsetWidth??0,z=ae?.offsetHeight??0,U=Math.max(He,window.innerWidth-j-He),X=Math.max(He,window.innerHeight-z-He);return{left:Math.min(Math.max(He,C),U),top:Math.min(Math.max(He,q),X)}},[]);l.useEffect(()=>{const C=j=>{H.current&&!H.current.contains(j.target)&&k()},q=j=>{const z=H.current;z&&z.contains(j.target)||k()},ae=()=>{if(B){ne(j=>j&&J(j.left,j.top));return}k()};return document.addEventListener("pointerdown",C,!0),window.addEventListener("scroll",q,!0),window.addEventListener("resize",ae),()=>{document.removeEventListener("pointerdown",C,!0),window.removeEventListener("scroll",q,!0),window.removeEventListener("resize",ae)}},[k,B,J]);const re=l.useCallback(C=>{if(C.button!==0||C.target.closest('button, a, input, [role="button"]'))return;const ae=H.current;if(!ae)return;const j=ae.getBoundingClientRect();ue.current={pointerX:C.clientX,pointerY:C.clientY,left:j.left,top:j.top},C.currentTarget.setPointerCapture(C.pointerId),Ne(!0),ne({left:j.left,top:j.top})},[]),je=l.useCallback(C=>{const q=ue.current;if(!q)return;const ae=J(q.left+(C.clientX-q.pointerX),q.top+(C.clientY-q.pointerY));ne(j=>j&&j.left===ae.left&&j.top===ae.top?j:ae)},[J]),ye=l.useCallback(C=>{if(ue.current){ue.current=null;try{C.currentTarget.releasePointerCapture(C.pointerId)}catch{}Ne(!1)}},[]),Q=l.useMemo(()=>new Set(r),[r]),G=l.useMemo(()=>new Set(i),[i]),[b,A]=l.useState(null),[I,W]=l.useState(null),[V,ve]=l.useState(null),w=l.useRef(0),R=l.useRef(0),ie=l.useCallback(()=>{if(R.current)return;const C=()=>{const q=w.current,ae=Z.current;if(!q||!ae){R.current=0;return}ae.scrollTop+=q*bi,R.current=requestAnimationFrame(C)};R.current=requestAnimationFrame(C)},[]),he=l.useCallback(()=>{w.current=0,R.current&&(cancelAnimationFrame(R.current),R.current=0)},[]);l.useEffect(()=>()=>he(),[he]);const P=l.useCallback((C,q)=>Q.has(C)===Q.has(q),[Q]),le=l.useCallback((C,q)=>{C.dataTransfer.effectAllowed="move";try{C.dataTransfer.setData("text/plain",q)}catch{}A(q)},[]),$e=l.useCallback((C,q,ae)=>{if(!b||b===q||ae.alwaysPinned)return;const j=Z.current;if(j){const ke=j.getBoundingClientRect();C.clientY<ke.top+ms?(w.current=-1,ie()):C.clientY>ke.bottom-ms?(w.current=1,ie()):w.current=0}if(!P(b,q)){C.preventDefault(),C.dataTransfer.dropEffect="none",W({key:q,position:"before"});return}C.preventDefault(),C.dataTransfer.dropEffect="move";const z=C.currentTarget.getBoundingClientRect(),U=z.top+z.height/2,X=C.clientY<U?"before":"after";W(ke=>ke&&ke.key===q&&ke.position===X?ke:{key:q,position:X})},[b,P,ie]),Pe=l.useCallback(C=>{C.preventDefault(),b&&I&&P(b,I.key)&&b!==I.key&&v(b,I.key,I.position),A(null),W(null),he()},[b,I,P,v,he]),pe=l.useCallback(()=>{A(null),W(null),he()},[he]),Ce=l.useCallback((C,q)=>{if(C.key===" "||C.key==="Enter"){C.preventDefault(),ve(z=>z===q?null:q);return}if(C.key==="Escape"){V===q&&(C.preventDefault(),ve(null));return}if(V!==q||C.key!=="ArrowUp"&&C.key!=="ArrowDown")return;C.preventDefault();const ae=C.key==="ArrowUp"?-1:1,j=a.findIndex(z=>z.key===q);if(j!==-1)for(let z=j+ae;z>=0&&z<a.length;z+=ae){const U=a[z];if(!U.alwaysPinned&&P(q,U.key)){v(q,U.key,ae===-1?"before":"after");return}}},[a,V,P,v]);if(!T)return null;const _e=B?B.left:te.left,ze=B?B.top:te.top;return Mt.createPortal(e.jsxs("div",{ref:H,className:["ui-table__manage",F&&"ui-table__manage--dragging"].filter(Boolean).join(" "),role:"dialog","aria-label":S.manageTitle,style:{left:_e,top:ze,...te.maxHeight!==void 0&&!B?{maxHeight:te.maxHeight}:null},children:[e.jsxs("div",{className:"ui-table__manage-header",onPointerDown:re,onPointerMove:je,onPointerUp:ye,onPointerCancel:ye,children:[e.jsx("span",{className:"ui-table__manage-title",children:S.manageTitle}),e.jsx(Ie,{sx:"ui-table__manage-close",icon:e.jsx(jt,{}),size:"small",variant:"ghost",color:"neutral",onClick:k,"aria-label":S.close,title:S.close})]}),e.jsx("div",{ref:Z,className:"ui-table__manage-list",role:"group","aria-label":S.manageTitle,onDragLeave:C=>{C.currentTarget===C.target&&W(null)},children:a.map(C=>{const q=typeof C.label=="string"?C.label:C.key,ae=G.has(C.key),j=!ae,z=Q.has(C.key),U=z?Lr:Zr,X=u&&!C.alwaysPinned,ke=b===C.key,N=V===C.key,de=I?.key===C.key,fe=de&&b!==null&&!P(b,C.key),De=!c||!!C.alwaysPinned||ae,we=!d||!!C.alwaysVisible||j&&o<=1,O=C.alwaysPinned?S.lockedHint:ae?S.pin:z?S.unpin:S.pin,oe=["ui-table__manage-item",!X&&"ui-table__manage-item--locked",ke&&"ui-table__manage-item--dragging",N&&"ui-table__manage-item--lifted",de&&!fe&&I?.position==="before"&&"ui-table__manage-item--drop-before",de&&!fe&&I?.position==="after"&&"ui-table__manage-item--drop-after",de&&fe&&"ui-table__manage-item--drop-forbidden"].filter(Boolean).join(" ");return e.jsxs("div",{className:oe,onDragOver:b?ge=>$e(ge,C.key,C):void 0,onDrop:b?Pe:void 0,children:[u&&e.jsx("button",{type:"button",className:"ui-table__manage-handle","aria-label":S.dragHandle,title:C.alwaysPinned?S.lockedHint:S.dragHandle,disabled:!X,"aria-pressed":N||void 0,draggable:X,onDragStart:X?ge=>le(ge,C.key):void 0,onDragEnd:pe,onKeyDown:X?ge=>Ce(ge,C.key):void 0,children:e.jsx(Nr,{"aria-hidden":"true"})}),e.jsx("div",{className:"ui-table__manage-item-main",children:e.jsx(ca,{size:"small",checked:j,isDisabled:we,onChange:()=>f(C.key),label:q})}),c&&e.jsx(Ie,{sx:["ui-table__manage-pin",De&&"ui-table__manage-pin--locked"].filter(Boolean).join(" "),icon:e.jsx(U,{}),size:"small",variant:"ghost",color:z?"primary":"neutral",onClick:()=>p(C.key),disabled:De,"aria-pressed":z,"aria-label":O,title:O})]},C.key)})}),e.jsxs("div",{className:"ui-table__manage-footer",children:[(g||y)&&e.jsxs("div",{className:"ui-table__manage-footer-row",children:[g&&e.jsx(Xe,{variant:"outlined",size:"small",color:"neutral",onClick:h,children:S.unpinAll}),y&&e.jsx(Xe,{variant:"outlined",size:"small",color:"neutral",onClick:m,children:S.showAll})]}),e.jsx(Xe,{variant:"text",size:"small",color:"primary",onClick:x,sx:"ui-table__manage-reset",children:S.reset})]})]}),T)},yi=120;function fs(t,n=yi){let s=null,a=0;const r=o=>{s=o,a&&window.clearTimeout(a),o?a=window.setTimeout(()=>{s=null,a=0},n):a=0},i=[];for(const o of t){const c=()=>{if(s&&s!==o)return;r(o);const d=o.scrollLeft;for(const u of t)u!==o&&u.scrollLeft!==d&&(u.scrollLeft=d)};o.addEventListener("scroll",c,{passive:!0}),i.push({src:o,handler:c})}return{lockTo:o=>r(o),dispose:()=>{a&&window.clearTimeout(a);for(const{src:o,handler:c}of i)o.removeEventListener("scroll",c)}}}function ki(t,n,s){const a=t.filter(i=>i!==n);let r=0;for(let i=0;i<a.length;i+=1)s.has(a[i])&&(r=i+1);return a.splice(r,0,n),a}function ma(t,n,s,a,r){const i=t.filter(d=>d!==n),o=s.indexOf(n);let c=i.length;for(let d=0;d<i.length;d+=1){const u=i[d];if(a.has(u)===r&&s.indexOf(u)>o){c=d;break}}return i.splice(c,0,n),i}function wi(t,n,s,a,r){if(n===s||r(n)!==r(s))return null;const i=t.indexOf(n);if(i===-1)return null;const o=t.slice();o.splice(i,1);let c=o.indexOf(s);return c===-1?null:(a==="after"&&(c+=1),o.splice(c,0,n),o)}function Ni(t){if(!t)return window;let n=t.parentElement;for(;n&&n!==document.body&&n!==document.documentElement;){const a=getComputedStyle(n).overflowY;if((a==="auto"||a==="scroll"||a==="overlay")&&n.scrollHeight>n.clientHeight)return n;n=n.parentElement}return window}function Ci(t,n){const s=t!==void 0?t:n;return s===!1||s===void 0?{enabled:!1,pin:!1,hide:!1,reorder:!1,manage:!1}:s===!0?{enabled:!0,pin:!0,hide:!0,reorder:!0,manage:!0}:{enabled:!0,pin:s.pin!==!1,hide:s.hide!==!1,reorder:s.reorder!==!1,manage:s.manage!==!1}}function _s({columns:t,data:n,isLoading:s=!1,hasBorder:a=!0,hasRowDividers:r=!0,hasColumnDividers:i=!1,isStriped:o=!1,size:c="medium",variant:d="filled",color:u="default",radius:p="md",visibleColumns:f,stickyColumns:h,columnMenu:m,enableColumnMenu:x,defaultStickyColumns:v,defaultHiddenColumns:g,columnOrder:y,defaultColumnOrder:S,onStickyColumnsChange:k,onHiddenColumnsChange:T,onColumnOrderChange:$,columnMenuLabels:H,columnMenuDefaults:Z,sorting:te,onSort:D,footer:B,onRowClick:ne,rowKey:F=fi,minWidth:Ne,height:ue,maxHeight:J,stickyHeaderOffset:re,stickyFooterOffset:je,emptyState:ye="No data to display",loadingState:Q="Loading…",sx:G,style:b}){const A=re!==void 0,I=je!==void 0&&B!==void 0&&B!==null,W=A||I,V=l.useMemo(()=>Ci(m,x),[m,x]),ve=h!==void 0,w=f!==void 0,R=y!==void 0,[ie,he]=l.useState(()=>v??[]),[P,le]=l.useState(()=>new Set(g??[])),[$e,Pe]=l.useState(()=>S??[]),pe=l.useMemo(()=>{if(w){const _=new Set;for(const[E,K]of Object.entries(f))K===!1&&_.add(E);return _}return P},[w,f,P]),Ce=l.useMemo(()=>{const _=new Set,E=[];for(const K of t)K.alwaysPinned&&!_.has(K.key)&&(_.add(K.key),E.push(K.key));if(ve)for(const K of h){const se=t[K];se&&!_.has(se.key)&&(_.add(se.key),E.push(se.key))}else for(const K of ie)_.has(K)||(_.add(K),E.push(K));return E},[ve,h,t,ie]),_e=l.useMemo(()=>new Set(Ce),[Ce]),ze=l.useMemo(()=>{const _=new Set;for(const E of t)E.alwaysVisible&&_.add(E.key);return _},[t]),C=l.useMemo(()=>{const _=new Set;for(const E of t)E.alwaysPinned&&_.add(E.key);return _},[t]),q=l.useMemo(()=>t.map(_=>_.key),[t]),ae=l.useCallback(_=>ze.has(_)?!1:pe.has(_),[ze,pe]),j=l.useMemo(()=>{const _=R?y:$e,E=[],K=new Set;for(const se of _)C.has(se)||q.includes(se)&&(K.has(se)||(K.add(se),E.push(se)));for(const se of t)se.alwaysPinned||K.has(se.key)||(K.add(se.key),E.push(se.key));return E},[R,y,$e,t,C,q]),z=l.useMemo(()=>{const _=new Map;for(const K of t)_.set(K.key,K);const E=[];for(const K of t)K.alwaysPinned&&E.push(K);for(const K of j){const se=_.get(K);se&&!se.alwaysPinned&&E.push(se)}return E},[t,j]),U=l.useMemo(()=>{const _=z.filter(se=>!ae(se.key));if(Ce.length===0)return _;const E=[],K=[];for(const se of _)_e.has(se.key)?E.push(se):K.push(se);return[...E,...K]},[z,ae,Ce,_e]),X=l.useMemo(()=>{const _=[];return U.forEach((E,K)=>{_e.has(E.key)&&_.push(K)}),_},[U,_e]),ke=l.useMemo(()=>new Set(X),[X]),N=X.length>0?X[X.length-1]:-1,de=l.useRef(null),fe=l.useRef(null),De=l.useRef(null),we=l.useRef(null),O=l.useRef(null),oe=l.useRef(null),ge=l.useRef(null),be=l.useRef([]),Ae=l.useRef(null),[We,ht]=l.useState(new Map),[Ke,ct]=l.useState(!1),[Qe,gt]=l.useState(0),xt=Dn(),[Re,tt]=l.useState(null),at=l.useCallback(()=>tt(null),[]),[Fe,et]=l.useState(null),Gt=l.useCallback(()=>et(null),[]),nt=l.useCallback(_=>{ve||he(_),k?.(_)},[ve,k]),st=l.useCallback(_=>{w||le(_),T?.(Array.from(_))},[w,T]),Be=l.useCallback(_=>{R||Pe(_),$?.(_)},[R,$]),Ye=l.useCallback(_=>{if(_e.has(_))return;const E=[...Ce,_],K=new Set(E);nt(E),Be(ki(j,_,K))},[Ce,_e,j,nt,Be]),kt=l.useCallback(_=>{if(!_e.has(_)||C.has(_))return;const E=Ce.filter(se=>se!==_),K=new Set(E);nt(E),Be(ma(j,_,q,K,!1))},[Ce,_e,C,j,q,nt,Be]),gn=l.useCallback(()=>{if(Ce.length===0)return;const _=Ce.filter(E=>C.has(E));_.length!==Ce.length&&nt(_)},[Ce,C,nt]),Pt=l.useCallback(_=>{if(ze.has(_)||pe.has(_))return;let E=0;for(const se of t)if(se.key!==_&&!pe.has(se.key)&&(E+=1,E>0))break;if(E===0)return;const K=new Set(pe);if(K.add(_),_e.has(_)&&!C.has(_)){const se=Ce.filter(Bt=>Bt!==_),Le=new Set(se);nt(se),Be(ma(j,_,q,Le,!1))}st(K)},[t,ze,C,pe,_e,Ce,j,q,nt,st,Be]),Xt=l.useCallback(_=>{if(!pe.has(_))return;const E=new Set(pe);E.delete(_);const K=_e.has(_);Be(ma(j,_,q,_e,K)),st(E)},[pe,_e,j,q,st,Be]),xn=l.useCallback(()=>{st(new Set)},[st]),Zt=l.useMemo(()=>{const _=[];for(const E of t)ae(E.key)&&_.push(E.key);return _},[t,ae]),vn=Zt.length,pt=l.useCallback((_,E)=>{if(!V.enabled)return;_.preventDefault(),_.stopPropagation();const K=_.currentTarget.getBoundingClientRect(),se=de.current?.getBoundingClientRect()??null;et(null),tt(Le=>Le?.colKey===E.key?null:{colKey:E.key,x:K.right,anchorTop:K.top,anchorBottom:K.bottom,boundsRect:se})},[V.enabled]),Jt=l.useCallback(_=>{_e.has(_)?kt(_):Ye(_)},[_e,kt,Ye]),bn=l.useCallback(_=>{ae(_)?Xt(_):Pt(_)},[ae,Xt,Pt]),jn=l.useCallback(()=>{const _=Z?.pinned??v??[],E=Z?.hidden??g??[],K=Z?.order??S??[];nt(_),st(new Set(E)),Be(K)},[Z,v,g,S,nt,st,Be]),yn=l.useCallback((_,E,K)=>{if(C.has(_)||C.has(E))return;const se=wi(j,_,E,K,Le=>_e.has(Le)&&!C.has(Le));se&&Be(se)},[j,_e,C,Be]),Ue=l.useMemo(()=>({pin:"Pin column",unpin:"Unpin column",hide:"Hide column",manage:"Manage columns",manageTitle:"Manage columns",unpinAll:"Unpin all",showAll:"Show all columns",reset:"Reset",lockedHint:"Locked",dragHandle:"Reorder",close:"Close",...H}),[H]),kn=l.useMemo(()=>({manageTitle:Ue.manageTitle,unpinAll:Ue.unpinAll,showAll:Ue.showAll,reset:Ue.reset,lockedHint:Ue.lockedHint,pin:Ue.pin,unpin:Ue.unpin,dragHandle:Ue.dragHandle,close:Ue.close}),[Ue]),wn=l.useMemo(()=>Ce.some(_=>!C.has(_)),[Ce,C]),Nn=l.useCallback((_,E)=>{if(!V.enabled||!(_.key==="F10"&&_.shiftKey||_.key==="ContextMenu"))return;_.preventDefault();const se=_.currentTarget.getBoundingClientRect(),Le=de.current?.getBoundingClientRect()??null;et(null),tt({colKey:E.key,x:se.right,anchorTop:se.top,anchorBottom:se.bottom,boundsRect:Le})},[V.enabled]);be.current.length>U.length&&(be.current.length=U.length);const zt=l.useRef(null);l.useLayoutEffect(()=>{const _=fe.current,E=De.current,K=O.current;if(!_||!E||!K)return;const se=()=>{const Bt=E.scrollWidth,vt=_.clientWidth;gt(Bt),ct(Bt-vt>1);const Nt=Ae.current;if(Nt){const Ve=Nt.firstElementChild;Ve&&(Ve.style.width=`${vt}px`)}const nn=K.querySelectorAll("th"),Ct=[];for(let Ve=0;Ve<nn.length;Ve+=1)Ct.push(nn[Ve].getBoundingClientRect().width);const Lt=be.current;for(let Ve=0;Ve<Ct.length;Ve+=1){const rt=Lt[Ve];rt&&(rt.style.width=`${Ct[Ve]}px`)}if(X.length===0)ht(Ve=>Ve.size===0?Ve:new Map);else{const Ve=new Map;let rt=0;for(const lt of X)Ve.set(lt,rt),rt+=Ct[lt]??0;ht(lt=>{if(lt.size!==Ve.size)return Ve;for(const[Ca,Ma]of Ve)if(lt.get(Ca)!==Ma)return Ve;return lt})}};zt.current=se,se();const Le=new ResizeObserver(se);return Le.observe(E),Le.observe(_),Le.observe(K),()=>{Le.disconnect(),zt.current=null}},[U,X,A]),l.useLayoutEffect(()=>{zt.current?.()},[s,n.length]);const Qt=l.useRef({prevDisplay:"",prevTop:NaN,prevLeft:NaN,prevWidth:NaN,wasVisible:!1}),wt=l.useRef(null);l.useEffect(()=>{if(!A&&!I)return;const _=oe.current,E=fe.current;if(!E||A&&!_)return;const K=A&&_?fs([E,_]):null,se=Qt.current;let Le=0;const Bt=()=>{Le=0;const Lt=de.current,Ve=O.current;if(!Lt)return;const rt=Lt.getBoundingClientRect(),lt=wt.current,Ca=lt&&lt!==window?lt.getBoundingClientRect().top:0,Ma=lt&&lt!==window?lt.getBoundingClientRect().bottom:window.innerHeight;if(A&&_&&Ve){const Sa=E.getBoundingClientRect(),ar=Ve.offsetHeight,Mn=Ca+re,Wn=Sa.top<=Mn&&rt.bottom>Mn+ar,Ea=Wn?"block":"none";if(Ea!==se.prevDisplay&&(_.style.display=Ea,se.prevDisplay=Ea),Mn!==se.prevTop&&(_.style.top=`${Mn}px`,se.prevTop=Mn),rt.left!==se.prevLeft&&(_.style.left=`${rt.left}px`,se.prevLeft=rt.left),rt.width!==se.prevWidth&&(_.style.width=`${rt.width}px`,se.prevWidth=rt.width),Wn&&!se.wasVisible){const rr=E.scrollLeft;_.scrollLeft!==rr&&(K?.lockTo(E),_.scrollLeft=rr)}se.wasVisible=Wn;const sr=Wn?"true":"false";Lt.dataset.headerStuck!==sr&&(Lt.dataset.headerStuck=sr)}if(I){const Sa=je??0,Da=rt.bottom>Ma-Sa?"true":"false";Lt.dataset.footerStuck!==Da&&(Lt.dataset.footerStuck=Da)}},vt=()=>{Le||(Le=requestAnimationFrame(Bt))};wt.current=Ni(de.current);const Nt=wt.current;Bt(),window.addEventListener("scroll",vt,{passive:!0}),window.addEventListener("resize",vt),Nt&&Nt!==window&&Nt.addEventListener("scroll",vt,{passive:!0});const nn=de.current,Ct=nn?new ResizeObserver(vt):null;return Ct&&nn&&Ct.observe(nn),()=>{Le&&cancelAnimationFrame(Le),window.removeEventListener("scroll",vt),window.removeEventListener("resize",vt),Nt&&Nt!==window&&Nt.removeEventListener("scroll",vt),K?.dispose(),Ct&&Ct.disconnect()}},[A,re,I,je]),l.useEffect(()=>{const _=fe.current,E=we.current;if(!_||!E||!Ke)return;const K=fs([_,E]);return()=>K.dispose()},[Ke]);const Rt=mn(Ne),en=mn(ue),Y=mn(J),xe=["ui-table",`ui-table--${c}`,d!=="filled"&&`ui-table--variant-${d}`,u!=="default"&&`ui-table--color-${u}`,p!=="md"&&`ui-table--radius-${p}`,a&&"ui-table--bordered",!r&&"ui-table--no-row-dividers",i&&"ui-table--col-dividers",o&&"ui-table--striped",ne&&"ui-table--clickable-rows",G].filter(Boolean).join(" "),Me=l.useMemo(()=>U.map((_,E)=>{const K=ke.has(E);return["ui-table__th",_.align&&`ui-table__th--align-${_.align}`,K&&"ui-table__th--sticky",K&&E===N&&"ui-table__th--sticky-last"].filter(Boolean).join(" ")}),[U,ke,N]),Se=l.useMemo(()=>U.map((_,E)=>{const K=ke.has(E);return["ui-table__td",_.align&&`ui-table__td--align-${_.align}`,_.wrap&&"ui-table__td--wrap",K&&"ui-table__td--sticky",K&&E===N&&"ui-table__td--sticky-last"].filter(Boolean).join(" ")}),[U,ke,N]),Te=l.useMemo(()=>U.map((_,E)=>{if(ke.has(E))return{left:`${We.get(E)??0}px`}}),[U,ke,We]),tn=_=>{if(!_.sortable||!D)return null;const E=te?.sort_by===_.key,K=E?te?.sort_order==="ASC"?Vr:Fr:Gr;return e.jsx("span",{className:["ui-table__sort-icon",E&&"ui-table__sort-icon--active"].filter(Boolean).join(" "),"aria-hidden":"true",children:e.jsx(K,{})})},M=_=>{!_.sortable||!D||D(_.key)},L=(_,E)=>{(_.key==="Enter"||_.key===" ")&&(_.preventDefault(),M(E))},me=l.useCallback((_,E,K)=>{ne&&(_.key==="Enter"||_.key===" ")&&(_.preventDefault(),ne(E,K))},[ne]),ce=U.length||1,Oe=()=>e.jsx("colgroup",{children:U.map(_=>e.jsx("col",{style:_.width!==void 0?{width:mn(_.width)}:void 0},_.key))}),dt=W?{overflowX:"auto",overflowY:"visible",maxHeight:"none",height:"auto"}:{height:en,maxHeight:en?void 0:Y},qe={...b};W&&(qe.overflow="visible");const Ht=I?{position:"sticky",bottom:je,zIndex:5}:void 0,Cn=(_,E,K)=>!E&&!K?_:[_,E&&"ui-table__th--sortable",K&&"ui-table__th--sorted"].filter(Boolean).join(" ");return e.jsxs("div",{ref:de,className:[xe,W&&"ui-table--page-sticky"].filter(Boolean).join(" "),style:qe,children:[Ke&&e.jsx("div",{ref:we,className:"ui-table__top-scroll","aria-hidden":"true",children:e.jsx("div",{className:"ui-table__top-scroll-inner",style:{width:`${Qe}px`}})}),e.jsx("div",{ref:fe,className:"ui-table__viewport",style:dt,children:e.jsxs("table",{ref:De,className:"ui-table__table",style:{minWidth:Rt},role:"table",children:[Oe(),e.jsx("thead",{className:"ui-table__thead",children:e.jsx("tr",{ref:O,className:"ui-table__tr",children:U.map((_,E)=>{const K=!!_.sortable&&!!D,se=te?.sort_by===_.key;return e.jsx("th",{scope:"col","aria-label":_.ariaLabel,"aria-sort":se?te?.sort_order==="ASC"?"ascending":"descending":K?"none":void 0,className:Cn(Me[E],K,se),style:Te[E],tabIndex:K?0:void 0,"aria-haspopup":V.enabled?"menu":void 0,onClick:K?()=>M(_):void 0,onKeyDown:Le=>{K&&L(Le,_),V.enabled&&Nn(Le,_)},children:e.jsxs("span",{className:"ui-table__th-inner",children:[V.enabled&&_.align==="center"&&e.jsx("span",{className:"ui-table__th-menu-spacer","aria-hidden":"true"}),e.jsxs("span",{className:"ui-table__th-content",children:[e.jsx("span",{className:"ui-table__th-label",children:_.label}),tn(_)]}),V.enabled&&e.jsx(Ie,{sx:"ui-table__th-menu-btn",icon:e.jsx(Ga,{}),size:"small",variant:"ghost",color:"neutral","aria-label":"Column options","aria-haspopup":"menu","aria-expanded":Re?.colKey===_.key,onClick:Le=>pt(Le,_)})]})},_.key)})})}),e.jsx("tbody",{className:"ui-table__tbody",children:s?e.jsx("tr",{className:"ui-table__tr ui-table__tr--state",children:e.jsx("td",{ref:Ae,className:"ui-table__td ui-table__td--state",colSpan:ce,children:e.jsx("div",{className:"ui-table__state-content",children:Q})})}):n.length===0?e.jsx("tr",{className:"ui-table__tr ui-table__tr--state",children:e.jsx("td",{ref:Ae,className:"ui-table__td ui-table__td--state",colSpan:ce,children:e.jsx("div",{className:"ui-table__state-content",children:ye})})}):n.map((_,E)=>e.jsx(xi,{row:_,rowIndex:E,visibleCols:U,tdClasses:Se,stickyStyles:Te,onRowClick:ne,onKeyDown:ne?me:void 0},F(_,E)))})]})}),B&&!s&&e.jsx("div",{className:"ui-table__footer",style:Ht,children:B}),A&&e.jsx("div",{ref:oe,className:"ui-table__overlay-header","aria-hidden":"true",style:{display:"none",position:"fixed",top:re,left:0,width:0,overflowX:Ke?"auto":"hidden",overflowY:"hidden",zIndex:40},children:e.jsxs("table",{ref:ge,className:"ui-table__table",style:{minWidth:Rt,width:Qe||void 0,tableLayout:"fixed"},role:"presentation",children:[e.jsx("colgroup",{children:U.map((_,E)=>e.jsx("col",{ref:K=>{be.current[E]=K},style:_.width!==void 0?{width:mn(_.width)}:void 0},_.key))}),e.jsx("thead",{className:"ui-table__thead",children:e.jsx("tr",{className:"ui-table__tr",children:U.map((_,E)=>{const K=!!_.sortable&&!!D,se=te?.sort_by===_.key;return e.jsx("th",{scope:"col",className:Cn(Me[E],K,se),style:Te[E],onClick:K?()=>M(_):void 0,children:e.jsxs("span",{className:"ui-table__th-inner",children:[V.enabled&&_.align==="center"&&e.jsx("span",{className:"ui-table__th-menu-spacer","aria-hidden":"true"}),e.jsxs("span",{className:"ui-table__th-content",children:[e.jsx("span",{className:"ui-table__th-label",children:_.label}),tn(_)]}),V.enabled&&e.jsx(Ie,{sx:"ui-table__th-menu-btn",icon:e.jsx(Ga,{}),size:"small",variant:"ghost",color:"neutral","aria-label":"Column options","aria-haspopup":"menu",onClick:Le=>pt(Le,_)})]})},_.key)})})})]})}),V.enabled&&Re&&(()=>{const _=Re.colKey,E=_e.has(_),K=C.has(_),se=ze.has(_),Le=[];return V.pin&&(E?Le.push({key:"unpin",label:Ue.unpin,onSelect:()=>kt(_),disabled:K}):Le.push({key:"pin",label:Ue.pin,onSelect:()=>Ye(_)})),V.hide&&Le.push({key:"hide",label:Ue.hide,onSelect:()=>Pt(_),disabled:se||U.length<=1}),V.manage&&Le.push({key:"manage",label:Ue.manage,onSelect:()=>{tt(null),et({x:Re.x,anchorTop:Re.anchorTop,anchorBottom:Re.anchorBottom,boundsRect:Re.boundsRect})}}),Le.length===0?null:e.jsx(vi,{x:Re.x,anchorTop:Re.anchorTop,anchorBottom:Re.anchorBottom,items:Le,onClose:at,portalNode:xt,boundsRect:Re.boundsRect})})(),V.enabled&&V.manage&&Fe&&e.jsx(ji,{x:Fe.x,anchorTop:Fe.anchorTop,anchorBottom:Fe.anchorBottom,columns:z,pinnedKeys:Ce,hiddenKeys:Zt,visibleCount:U.length,canPin:V.pin,canHide:V.hide,canReorder:V.reorder,onTogglePin:Jt,onToggleHide:bn,onUnpinAll:gn,onShowAll:xn,onReset:jn,onReorder:yn,hasUnpinnablePinned:wn,hasHiddenColumns:vn>0,labels:kn,onClose:Gt,portalNode:xt,boundsRect:Fe.boundsRect})]})}_s.displayName="Table";const fa=({open:t,title:n,message:s,confirmLabel:a="Confirm",cancelLabel:r="Cancel",confirmColor:i="primary",onConfirm:o,onCancel:c,hideCancel:d=!1,closeOnBackdropClick:u=!0,closeOnEscape:p=!0,returnFocusOnClose:f=!1})=>e.jsx(ea,{open:t,onClose:c,size:"small",closeOnBackdropClick:u,closeOnEscape:p,returnFocusOnClose:f,children:e.jsxs("div",{className:"ui-confirm",children:[n&&e.jsx("h2",{className:"ui-confirm__title",children:n}),s&&e.jsx("div",{className:"ui-confirm__message",children:s}),e.jsxs("div",{className:"ui-confirm__actions",children:[!d&&e.jsx(Xe,{variant:"outlined",color:"neutral",onClick:c,children:r}),e.jsx(Xe,{variant:"filled",color:i,onClick:o,autoFocus:!0,children:a})]})]})});fa.displayName="ConfirmDialog";const gs=l.createContext(null),xs=({children:t})=>{const[n,s]=l.useState(null),a=l.useRef(null);a.current=n;const r=l.useCallback(c=>new Promise(d=>{const u=a.current;u&&u.resolve(!1),s({...c,resolve:d})}),[]),i=l.useCallback(c=>{const d=a.current;d&&(d.resolve(c),s(null))},[]),o=l.useMemo(()=>({confirm:r}),[r]);return e.jsxs(gs.Provider,{value:o,children:[t,e.jsx(fa,{open:n!==null,title:n?.title,message:n?.message,confirmLabel:n?.confirmLabel,cancelLabel:n?.cancelLabel,confirmColor:n?.confirmColor,hideCancel:n?.hideCancel,closeOnBackdropClick:n?.closeOnBackdropClick,closeOnEscape:n?.closeOnEscape,onConfirm:()=>i(!0),onCancel:()=>i(!1)})]})};xs.displayName="ConfirmProvider";const Mi=()=>{const t=l.useContext(gs);if(!t)throw new Error("useConfirm must be used within a <ConfirmProvider>");return t},vs=({checked:t,defaultChecked:n,onChange:s,label:a,labelPosition:r="end",color:i="primary",size:o="medium",isDisabled:c=!1,name:d,value:u,id:p,sx:f,style:h})=>{const m=l.useId(),x=p??m,v=["ui-toggle",`ui-toggle--${i}`,`ui-toggle--${o}`,`ui-toggle--label-${r}`,c&&"ui-toggle--disabled",f].filter(Boolean).join(" "),g=y=>{c||s?.(y.target.checked,y)};return e.jsxs("label",{className:v,style:h,htmlFor:x,children:[a!=null&&r==="start"&&e.jsx("span",{className:"ui-toggle__label",children:a}),e.jsxs("span",{className:"ui-toggle__switch",children:[e.jsx("input",{id:x,type:"checkbox",className:"ui-toggle__input",role:"switch",checked:t,defaultChecked:n,disabled:c,name:d,value:u,onChange:g}),e.jsx("span",{className:"ui-toggle__track","aria-hidden":"true",children:e.jsx("span",{className:"ui-toggle__thumb"})})]}),a!=null&&r==="end"&&e.jsx("span",{className:"ui-toggle__label",children:a})]})};vs.displayName="Toggle";const bs=l.createContext(null),_a=t=>{const n=l.useContext(bs);if(!n)throw new Error(`<${t}> must be rendered inside <Tabs>`);return n},js=({value:t,defaultValue:n,onChange:s,variant:a="underline",size:r="medium",color:i="primary",isDisabled:o=!1,children:c,sx:d,style:u})=>{const f=`ui-tabs-${l.useId().replace(/:/g,"")}`,[h,m]=l.useState(n??""),x=t!==void 0,v=x?t:h,g=l.useRef(new Map),y=l.useCallback(H=>{x||m(H),s?.(H)},[x,s]),S=l.useCallback((H,Z)=>{Z&&g.current.set(H,Z)},[]),k=l.useCallback(H=>{g.current.delete(H)},[]),T=l.useMemo(()=>({value:v,setValue:y,baseId:f,registerTab:S,unregisterTab:k,variant:a,size:r,color:i,isDisabled:o}),[v,y,f,S,k,a,r,i,o]),$=["ui-tabs",`ui-tabs--${a}`,`ui-tabs--${r}`,d].filter(Boolean).join(" ");return e.jsx(bs.Provider,{value:T,children:e.jsx("div",{className:$,style:u,children:c})})};js.displayName="Tabs";const ys=({"aria-label":t,"aria-labelledby":n,children:s,sx:a,style:r})=>{const{variant:i,size:o,color:c}=_a("TabList"),d=l.useMemo(()=>{const p=[];return l.Children.forEach(s,f=>{l.isValidElement(f)&&f.type===ga&&p.push(f.props.value)}),p},[s]),u=["ui-tabs__list",`ui-tabs__list--${i}`,`ui-tabs__list--${o}`,`ui-tabs__list--${c}`,a].filter(Boolean).join(" ");return e.jsx("div",{role:"tablist","aria-label":t,"aria-labelledby":n,className:u,style:r,"data-tab-order":d.join(","),children:s})};ys.displayName="TabList";const ga=({value:t,isDisabled:n=!1,icon:s,badge:a,children:r,sx:i,style:o})=>{const c=_a("Tab"),d=l.useRef(null),u=l.useCallback(g=>{d.current=g,c.registerTab(t,g)},[c,t]);l.useEffect(()=>()=>c.unregisterTab(t),[c,t]);const p=c.value===t,f=c.isDisabled||n,h=()=>{f||c.setValue(t)},m=g=>{const y=d.current?.parentElement;if(!y)return;const S=(y.dataset.tabOrder??"").split(",").filter(Boolean);if(S.length===0)return;const k=S.filter(Z=>{const te=y.querySelector(`[data-tab-value="${Z}"]`);return te&&!te.disabled});if(k.length===0)return;let T;const $=k.indexOf(t);switch(g){case"first":T=k[0];break;case"last":T=k[k.length-1];break;case"next":T=k[($+1)%k.length];break;case"prev":T=k[($-1+k.length)%k.length];break}y.querySelector(`[data-tab-value="${T}"]`)?.focus(),c.setValue(T)},x=g=>{if(!f)switch(g.key){case"ArrowRight":case"ArrowDown":g.preventDefault(),m("next");break;case"ArrowLeft":case"ArrowUp":g.preventDefault(),m("prev");break;case"Home":g.preventDefault(),m("first");break;case"End":g.preventDefault(),m("last");break}},v=["ui-tabs__tab",`ui-tabs__tab--${c.variant}`,`ui-tabs__tab--${c.size}`,`ui-tabs__tab--${c.color}`,p&&"ui-tabs__tab--active",f&&"ui-tabs__tab--disabled",i].filter(Boolean).join(" ");return e.jsxs("button",{ref:u,type:"button",role:"tab",id:`${c.baseId}-tab-${t}`,"aria-selected":p,"aria-controls":`${c.baseId}-panel-${t}`,"aria-disabled":f||void 0,tabIndex:p?0:-1,disabled:f,"data-tab-value":t,className:v,style:o,onClick:h,onKeyDown:x,children:[s&&e.jsx("span",{className:"ui-tabs__tab-icon","aria-hidden":"true",children:s}),e.jsx("span",{className:"ui-tabs__tab-label",children:r}),a!=null&&e.jsx("span",{className:"ui-tabs__tab-badge",children:a})]})};ga.displayName="Tab";const ks=({value:t,keepMounted:n=!1,children:s,sx:a,style:r})=>{const i=_a("TabPanel"),o=i.value===t;if(!o&&!n)return null;const c=["ui-tabs__panel",a].filter(Boolean).join(" ");return e.jsx("div",{role:"tabpanel",id:`${i.baseId}-panel-${t}`,"aria-labelledby":`${i.baseId}-tab-${t}`,tabIndex:0,hidden:!o,className:c,style:r,children:s})};ks.displayName="TabPanel";const Si=t=>{const n=t.trim().split(/\s+/).filter(Boolean);return n.length===0?"":n.length===1?n[0].slice(0,2).toUpperCase():(n[0][0]+n[n.length-1][0]).toUpperCase()},Kt=({name:t="",src:n,alt:s,size:a="medium",shape:r="circle",color:i="neutral",fallback:o,crossOrigin:c,referrerPolicy:d,loading:u,sx:p,style:f})=>{const[h,m]=l.useState(!1);l.useEffect(()=>{m(!1)},[n]);const x=!!n&&!h,v=Si(t),g=!!(f?.background||f?.backgroundColor),y=["ui-avatar",`ui-avatar--${a}`,`ui-avatar--${r}`,!x&&!g&&`ui-avatar--${i}`,p].filter(Boolean).join(" "),S=()=>v?e.jsx("span",{className:"ui-avatar__initials","aria-hidden":"true",children:v}):o!=null?e.jsx("span",{className:"ui-avatar__fallback","aria-hidden":"true",children:o}):e.jsx("span",{className:"ui-avatar__initials","aria-hidden":"true",children:"?"});return e.jsx("span",{className:y,style:f,role:"img","aria-label":s??t??"avatar",children:x?e.jsx("img",{className:"ui-avatar__image",src:n,alt:s??t,crossOrigin:c,referrerPolicy:d,loading:u,onError:()=>m(!0)}):S()})};Kt.displayName="Avatar";const Di={small:-4,medium:-8},xa=({children:t,max:n=5,total:s,spacing:a="medium",size:r,shape:i,surplusColor:o="neutral",renderSurplus:c,sx:d,style:u})=>{const p=l.Children.toArray(t),f=s??p.length,h=f>n,m=h?Math.max(0,n-1):Math.min(p.length,n),x=p.slice(0,m),v=h?f-m:0,g=typeof a=="number"?a:Di[a],y=["ui-avatar-group",d].filter(Boolean).join(" "),S=(k,T,$)=>{const H={marginLeft:$};if(l.isValidElement(k)&&k.type===Kt){const Z={};return r&&!k.props.size&&(Z.size=r),i&&!k.props.shape&&(Z.shape=i),e.jsx("span",{className:"ui-avatar-group__item",style:H,children:l.cloneElement(k,Z)},T)}return e.jsx("span",{className:"ui-avatar-group__item",style:H,children:k},T)};return e.jsxs("div",{className:y,style:u,children:[x.map((k,T)=>S(k,T,T===0?0:g)),v>0&&e.jsx("span",{className:"ui-avatar-group__item ui-avatar-group__item--surplus",style:{marginLeft:g},children:c?c(v):e.jsx(Kt,{size:r,shape:i,color:o,fallback:e.jsxs("span",{className:"ui-avatar-group__surplus-text",children:["+",v]})})},"surplus")]})};xa.displayName="AvatarGroup";const Ei={success:e.jsx(wr,{}),error:e.jsx($r,{}),warning:e.jsx(Tr,{}),info:e.jsx(Cr,{})},va=({type:t="info",message:n,title:s,icon:a,onClose:r,duration:i,sx:o,style:c})=>{const d=typeof i=="number"&&i>0,u=["ui-toast",`ui-toast--${t}`,o].filter(Boolean).join(" ");return e.jsxs("div",{className:u,style:c,role:t==="error"||t==="warning"?"alert":"status","aria-live":t==="error"||t==="warning"?"assertive":"polite",children:[e.jsx("span",{className:"ui-toast__icon","aria-hidden":"true",children:a??Ei[t]}),e.jsxs("div",{className:"ui-toast__body",children:[s&&e.jsx("div",{className:"ui-toast__title",children:s}),e.jsx("div",{className:"ui-toast__message",children:n})]}),r&&e.jsx(Ie,{icon:e.jsx(jt,{}),onClick:r,"aria-label":"Dismiss notification",variant:"ghost",color:"neutral",size:"small",sx:"ui-toast__close"}),d&&e.jsx("span",{className:"ui-toast__progress","aria-hidden":"true",style:{animationDuration:`${i}ms`}})]})};va.displayName="Toast";const ws=l.createContext(null),Ns=({children:t,position:n="top-right",defaultDuration:s=5e3,portalContainerId:a})=>{const[r,i]=l.useState([]),o=l.useRef(new Map),c=l.useCallback(h=>{const m=o.current.get(h);m&&(clearTimeout(m),o.current.delete(h))},[]),d=l.useCallback(h=>{c(h),i(m=>m.filter(x=>x.id!==h))},[c]),u=l.useCallback(()=>{o.current.forEach(h=>clearTimeout(h)),o.current.clear(),i([])},[]),p=l.useCallback(h=>{const m=`toast-${Date.now()}-${Math.random().toString(36).slice(2,8)}`,x=h.duration??s;if(i(v=>[...v,{...h,id:m,duration:x}]),x>0){const v=setTimeout(()=>d(m),x);o.current.set(m,v)}return m},[s,d]);l.useEffect(()=>{const h=o.current;return()=>{h.forEach(m=>clearTimeout(m)),h.clear()}},[]);const f=l.useMemo(()=>({showToast:p,dismissToast:d,dismissAll:u}),[p,d,u]);return e.jsxs(ws.Provider,{value:f,children:[t,e.jsx(cn,{containerId:a,children:e.jsx("div",{className:`ui-toast-container ui-toast-container--${n}`,children:r.map(h=>e.jsx(va,{type:h.type,title:h.title,message:h.message,icon:h.icon,duration:h.duration,onClose:()=>d(h.id)},h.id))})})]})};Ns.displayName="ToastProvider";const $i=()=>{const t=l.useContext(ws);if(!t)throw new Error("useToast must be used within a <ToastProvider>");return t},Cs=({size:t="medium",color:n="primary",variant:s="inline",label:a="Loading",sx:r,style:i})=>{const o=["ui-spinner",`ui-spinner--${t}`,n!=="inherit"&&`ui-spinner--${n}`,r].filter(Boolean).join(" "),c=e.jsx("span",{className:o,style:i,role:"status","aria-label":a,children:e.jsx("span",{className:"ui-spinner__visually-hidden",children:a})});return s==="page"?e.jsx(cn,{children:e.jsx("div",{className:"ui-spinner-overlay",children:e.jsx("span",{className:["ui-spinner","ui-spinner--large",n!=="inherit"&&`ui-spinner--${n}`].filter(Boolean).join(" "),role:"status","aria-label":a,children:e.jsx("span",{className:"ui-spinner__visually-hidden",children:a})})})}):c};Cs.displayName="Spinner";function Ti(t,n,s){if(n<=1)return n===1?[1]:[];const a=Math.max(2,t-s),r=Math.min(n-1,t+s),i=t-s>3,o=t+s<n-2,c=[1];if(i)c.push("ellipsis-left");else for(let d=2;d<a;d++)c.push(d);for(let d=a;d<=r;d++)c.push(d);if(o)c.push("ellipsis-right");else for(let d=r+1;d<n;d++)c.push(d);return c.push(n),c}const Ms=({currentPage:t,totalPages:n,totalItems:s,itemsPerPage:a,onPageChange:r,hasFirstLast:i=!0,hasGoToPage:o=!1,showResults:c="none",showOnSinglePage:d=!1,perPageOptions:u,perPage:p,onPerPageChange:f,siblingCount:h=1,size:m="medium",sx:x,style:v})=>{const g=!!u&&!!f&&p!==void 0,y=l.useMemo(()=>u?.map(B=>({value:String(B.value),label:B.label}))??[],[u]),S=c!=="none"&&s!==void 0,k=n>1;if(!k&&(!d||s===0))return null;const $=k?Ti(t,n,h):[],H=t<=1,Z=t>=n,te=B=>{B<1||B>n||B===t||r(B)},D=["ui-pagination",`ui-pagination--${m}`,x].filter(Boolean).join(" ");return e.jsxs("div",{className:D,style:v,role:"navigation","aria-label":"Pagination",children:[e.jsx("div",{className:"ui-pagination__group ui-pagination__group--start",children:S&&e.jsx(Li,{mode:c,currentPage:t,totalItems:s,itemsPerPage:a})}),e.jsxs("div",{className:"ui-pagination__group ui-pagination__group--end",children:[g&&e.jsxs("label",{className:"ui-pagination__per-page",children:[e.jsx("span",{className:"ui-pagination__per-page-label",children:"Per page"}),e.jsx($n,{size:"small",value:String(p),options:y,onChange:B=>{typeof B=="string"&&f(Number(B))},"aria-label":`Items per page: ${p}`})]}),k&&o&&e.jsx(Ai,{totalPages:n,onGo:te}),k&&e.jsxs(e.Fragment,{children:[e.jsxs("span",{className:"ui-pagination__compact-status","aria-hidden":"true",children:["Page ",e.jsx("strong",{children:t})," of ",n]}),e.jsxs("div",{className:"ui-pagination__pages",children:[i&&e.jsx("button",{type:"button",className:"ui-pagination__btn ui-pagination__btn--icon",onClick:()=>te(1),disabled:H,"aria-label":"First page",children:e.jsx(Wr,{})}),e.jsx("button",{type:"button",className:"ui-pagination__btn ui-pagination__btn--icon",onClick:()=>te(t-1),disabled:H,"aria-label":"Previous page",children:e.jsx(In,{})}),$.map(B=>B==="ellipsis-left"||B==="ellipsis-right"?e.jsx("span",{className:"ui-pagination__ellipsis","aria-hidden":"true",children:"…"},B):e.jsx("button",{type:"button",className:["ui-pagination__btn","ui-pagination__btn--num",B===t&&"ui-pagination__btn--active"].filter(Boolean).join(" "),onClick:()=>te(B),"aria-current":B===t?"page":void 0,"aria-label":`Page ${B}`,children:B},B)),e.jsx("button",{type:"button",className:"ui-pagination__btn ui-pagination__btn--icon",onClick:()=>te(t+1),disabled:Z,"aria-label":"Next page",children:e.jsx(Pn,{})}),i&&e.jsx("button",{type:"button",className:"ui-pagination__btn ui-pagination__btn--icon",onClick:()=>te(n),disabled:Z,"aria-label":"Last page",children:e.jsx(Kr,{})})]})]})]})]})};Ms.displayName="Pagination";const Li=({mode:t,currentPage:n,totalItems:s,itemsPerPage:a})=>{if(t==="none"||s===void 0)return null;if(t==="total")return e.jsxs("span",{className:"ui-pagination__summary",children:[e.jsx("strong",{children:s})," ",s===1?"result":"results"]});const r=a??s,i=s===0?0:(n-1)*r+1,o=Math.min(n*r,s);return e.jsxs("span",{className:"ui-pagination__summary",children:["Showing ",e.jsx("strong",{children:i}),"–",e.jsx("strong",{children:o})," of ",e.jsx("strong",{children:s})]})},Ai=({totalPages:t,onGo:n})=>{const[s,a]=l.useState(""),r=l.useRef(null),i=()=>{const d=Number(s);if(!Number.isFinite(d)||d<1||d>t){a("");return}n(Math.floor(d)),a(""),r.current?.blur()},o=d=>{const u=Number(s)||0,p=Math.min(t,Math.max(1,u+d));a(String(p))},c=e.jsxs("span",{className:"ui-pagination__goto-spinner","aria-hidden":"true",children:[e.jsx("button",{type:"button",tabIndex:-1,className:"ui-pagination__goto-spinner-btn",onMouseDown:d=>{d.preventDefault(),o(1)},children:e.jsx(Hr,{})}),e.jsx("button",{type:"button",tabIndex:-1,className:"ui-pagination__goto-spinner-btn",onMouseDown:d=>{d.preventDefault(),o(-1)},children:e.jsx(zr,{})})]});return e.jsxs("label",{className:"ui-pagination__goto",children:[e.jsx("span",{className:"ui-pagination__goto-label",children:"Go to"}),e.jsx(Ot,{ref:r,type:"number",size:"small",min:1,max:t,step:1,value:s,onChange:d=>a(d.target.value),onKeyDown:d=>{d.key==="Enter"&&(d.preventDefault(),i())},onBlur:i,"aria-label":`Go to page (1–${t})`,endAdornment:c,sx:{root:"ui-pagination__goto-field",input:"ui-pagination__goto-input"}})]})},On=4,Fn=3,Ss=20;function Ii(t){return t.find(s=>s.iso2==="gb"||s.iso2==="en"||s.name.toLowerCase()==="english")??t[0]??null}function Ds(t,n){return t.icon?t.icon:`https://flagcdn.com/${n}/${t.iso2}.png`}const Es=({page:t,totalPages:n,onPrev:s,onNext:a})=>{const r=o=>c=>{c.stopPropagation(),c.preventDefault(),o()},i=o=>{o.stopPropagation(),o.preventDefault()};return e.jsxs("div",{className:"ui-employee-card__carousel-nav",onClick:i,children:[e.jsx(Ie,{icon:e.jsx(In,{size:14}),size:"small",variant:"ghost",color:"neutral",sx:"ui-employee-card__carousel-btn",onClick:r(s),disabled:t===0,"aria-label":"Previous"}),e.jsx(Ie,{icon:e.jsx(Pn,{size:14}),size:"small",variant:"ghost",color:"neutral",sx:"ui-employee-card__carousel-btn",onClick:r(a),disabled:t>=n-1,"aria-label":"Next"})]})},$s=({employee:t,profileUrl:n,onClick:s,talkMode:a,selectedToolIds:r,onToolToggle:i,isInCart:o,onCartToggle:c,selectedTierValue:d,onTierChange:u,share:p,onShare:f,sx:h})=>{const[m,x]=l.useState(!1),[v,g]=l.useState(0),[y,S]=l.useState(0),[k,T]=l.useState(!1),$=parseFloat(t.rate?.value??"0"),H=N=>parseFloat(N)<=$,Z=t.pricingTiers?.filter(N=>H(N.value)).sort((N,de)=>parseFloat(de.value)-parseFloat(N.value))[0]?.value??t.pricingTiers?.[0]?.value??null,[te,D]=l.useState(()=>Z),B=d??te,ne=t.pricingTiers?.find(N=>N.value===B)??null,F=N=>{u?u(N):D(N)},[Ne,ue]=l.useState(""),J=l.useRef(null),re=l.useRef(null),je=t.shortName||"Unknown",ye=t.department?.color||"#9e9e9e",Q=t.currency||"$",G=N=>{const de=parseFloat(N||"0");return de?`${Q}${de}/hour`:"—"},b=N=>t.prices_discounted?.find(de=>de.value===N)?.price,A=b(B??"")??ne?.price,I=A?G(A):"—",W=t.tools||[],V=Math.ceil(W.length/On)||1,ve=v*On,w=W.slice(ve,ve+On),R=Math.ceil(W.length/Fn)||1,ie=y*Fn,he=W.slice(ie,ie+Fn),P=t.languages||[],le=Ii(P),$e=a?a.isConnected||a.isConnecting:!1;l.useEffect(()=>{$e||ue("")},[$e]),l.useEffect(()=>{re.current&&(re.current.scrollTop=re.current.scrollHeight)},[a?.messages]);const Pe=["ui-employee-card",m&&"ui-employee-card--flipped",t.is_pinned&&"ui-employee-card--hot",$e&&"ui-employee-card--talk-active",h?.root].filter(Boolean).join(" "),pe=`ui-employee-card__header ${h?.header||""}`.trim(),Ce=`ui-employee-card__content ${h?.content||""}`.trim(),_e={"--department-color":ye},ze=N=>{if(N.target.closest('button, input, [role="button"], .ui-icon-button-wrapper, .ui-dropdown, .ui-employee-card__content--talk')){N.preventDefault();return}s&&(N.preventDefault(),s())},C=N=>{N.stopPropagation(),N.preventDefault(),x(de=>!de)},q=(N,de)=>{N.stopPropagation(),N.preventDefault(),i?.(de)},ae=N=>{N.stopPropagation(),N.preventDefault(),c?.()},j=N=>{N.stopPropagation(),N.preventDefault(),n&&navigator.share?navigator.share({title:t.profession??t.shortName??void 0,text:`${t.shortName} — ${t.profession??"AnyEmp profile"}`,url:n}).then(()=>f?.()).catch(()=>{}):n?navigator.clipboard.writeText(n).then(()=>{T(!0),J.current&&clearTimeout(J.current),J.current=setTimeout(()=>T(!1),1500),f?.()}):f?.()},z=!a?.isMicMuted,U=()=>{!Ne.trim()||!a?.onSendMessage||(a.onSendMessage(Ne.trim()),ue(""))},X=n?"a":"article",ke=n?{href:n,onClick:ze}:{onClick:ze,role:s?"button":void 0,tabIndex:s?0:void 0};return e.jsxs("div",{className:Pe,style:{"--department-color":ye},children:[e.jsxs("div",{className:"ui-employee-card__card-side",children:[e.jsxs("div",{className:"ui-employee-card__inner",children:[e.jsxs(X,{...ke,className:"ui-employee-card__front",children:[e.jsx("div",{className:"ui-employee-card__header-section"}),e.jsxs("div",{className:pe,style:_e,children:[e.jsxs("div",{className:"ui-employee-card__avatar-wrapper",children:[e.jsx("div",{className:"ui-employee-card__avatar-gradient"}),t.avatarUrl?e.jsx("img",{src:t.avatarUrl,alt:`${je} avatar`,className:"ui-employee-card__avatar"}):e.jsx("div",{className:"ui-employee-card__avatar ui-employee-card__avatar--placeholder",children:e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2"}),e.jsx("circle",{cx:"12",cy:"7",r:"4"})]})})]}),e.jsx("div",{className:"ui-employee-card__header-info",children:e.jsxs("div",{className:"ui-employee-card__header-text",children:[t.profession&&e.jsx("h3",{className:"ui-employee-card__profession",children:t.profession}),e.jsx("p",{className:"ui-employee-card__name",children:je})]})}),e.jsx("div",{className:"ui-employee-card__id-badge-wrapper",children:e.jsxs("div",{className:"ui-employee-card__id-badge",children:[e.jsx("span",{className:"ui-employee-card__id-label",children:"ID:"}),e.jsx("span",{className:"ui-employee-card__id-value",children:t.talentId})]})})]}),e.jsxs("div",{className:"ui-employee-card__body-section",children:[e.jsxs("div",{className:`${Ce} ui-employee-card__content--normal ${$e?"ui-employee-card__content--hidden":""}`,children:[t.summary&&e.jsx("div",{style:{marginBottom:"1rem"},children:e.jsx("p",{className:"ui-employee-card__summary",children:t.summary})}),W.length>0&&e.jsxs("div",{className:"ui-employee-card__skills-section",children:[e.jsxs("div",{className:"ui-employee-card__carousel-header",children:[e.jsx("h4",{className:"ui-employee-card__section-title",children:"Tools"}),W.length>On&&e.jsx(Es,{page:v,totalPages:V,onPrev:()=>g(N=>Math.max(0,N-1)),onNext:()=>g(N=>Math.min(V-1,N+1))})]}),e.jsx("div",{className:"ui-employee-card__tools",children:w.map(N=>{const fe=["ui-employee-card__tool",(r?.includes(N.id)??!1)&&"ui-employee-card__tool--selected"].filter(Boolean).join(" ");return e.jsx(Ze,{title:N.name,placement:"top",children:e.jsx("div",{className:fe,onClick:i?De=>q(De,N.id):void 0,children:N.icon?e.jsx("img",{src:N.icon,alt:N.name,className:"ui-employee-card__tool-icon"}):e.jsx("span",{className:"ui-employee-card__tool-placeholder",children:N.name.charAt(0).toUpperCase()})})},N.id)})})]}),a&&e.jsx("div",{className:"ui-employee-card__audio-section",children:e.jsxs("div",{className:"ui-employee-card__audio-controls",role:"button",tabIndex:a.isConnecting?-1:0,onClick:N=>{N.stopPropagation(),N.preventDefault(),a.isConnecting||a.onStart()},children:[e.jsx("div",{className:"ui-employee-card__audio-mic-circle",children:e.jsx(qa,{})}),e.jsx("div",{className:"ui-employee-card__audio-wave",children:[...Array(5)].map((N,de)=>e.jsx("div",{className:"ui-employee-card__audio-wave-bar"},de))}),e.jsxs("div",{className:"ui-employee-card__audio-text",children:[e.jsx("span",{className:"ui-employee-card__audio-label",children:"Talk with AI Employee"}),t.slogan&&e.jsx("span",{className:"ui-employee-card__audio-slogan",children:t.slogan})]})]})})]}),a&&e.jsx("div",{className:`${Ce} ui-employee-card__content--talk ${$e?"":"ui-employee-card__content--hidden"}`,children:e.jsx("div",{className:"ui-employee-card__talk-view",children:t.pricingTiers&&t.pricingTiers.length>0&&t.rate?(()=>{const N=b(B??""),de=parseFloat((N??ne?.price)||"0"),fe=de&&ne?`${Q}${(de*ne.hours*Ss).toLocaleString()}/mo`:"—",De=we=>{const O=parseFloat(we);return O>=1?"var(--palette-primary-main)":O>=.5?"var(--palette-warning-main)":"var(--palette-text-primary)"};return e.jsxs("div",{className:"ui-employee-card__cpv",children:[e.jsx("span",{className:"ui-employee-card__cpv-label",children:"Pricing"}),e.jsx("div",{className:"ui-employee-card__cpv-tiers",children:t.pricingTiers.map(we=>{const O=b(we.value),oe=parseFloat((O??we.price)||"0"),ge=O?parseFloat(we.price||"0"):null,be=oe?`${Q}${(oe*we.hours*Ss).toLocaleString()}/mo`:"—",Ae=oe?`${Q}${oe}/h`:"—",We=H(we.value),Ke=["ui-employee-card__cpv-tier",We&&we.value===B&&"ui-employee-card__cpv-tier--selected",!We&&"ui-employee-card__cpv-tier--disabled",We&&c&&"ui-employee-card__cpv-tier--clickable"].filter(Boolean).join(" ");return e.jsxs("div",{className:Ke,style:{"--tc":De(we.value)},onClick:We&&c?ct=>{ct.stopPropagation(),ct.preventDefault(),F(we.value)}:void 0,children:[e.jsxs("div",{className:"ui-employee-card__cpv-tier-left",children:[e.jsx("span",{className:"ui-employee-card__cpv-tier-label",children:we.name}),e.jsxs("span",{className:"ui-employee-card__cpv-tier-hours",children:[we.hours," h/day"]})]}),e.jsxs("div",{className:"ui-employee-card__cpv-tier-right",children:[ge&&e.jsxs("span",{className:"ui-employee-card__cpv-tier-rate ui-employee-card__cpv-tier-rate--original",children:[Q,ge,"/h"]}),e.jsx("span",{className:"ui-employee-card__cpv-tier-rate",children:Ae}),e.jsx("span",{className:"ui-employee-card__cpv-tier-monthly",children:be})]})]},we.value)})}),e.jsxs("div",{className:"ui-employee-card__cpv-summary",children:[e.jsx("span",{className:"ui-employee-card__cpv-summary-label",children:"In Total"}),e.jsxs("span",{className:"ui-employee-card__cpv-summary-value",children:[t.rate?.name," · ",fe]})]})]})})():null})})]}),t.pricingTiers&&t.pricingTiers.length>0&&t.rate&&e.jsx(Zn,{placement:"bottom-end",variant:"info",divider:!0,sx:{root:"ui-employee-card__price-dropdown"},trigger:e.jsxs(Xe,{variant:"outlined",color:"neutral",size:"small",sx:"ui-employee-card__price-trigger rounded-full",children:[e.jsx("span",{children:I}),t.discount&&e.jsxs("span",{className:"ui-employee-card__discount-badge",children:["-",parseFloat(t.discount).toFixed(0),"%"]}),e.jsx("svg",{className:"ui-dropdown__arrow",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("polyline",{points:"6 9 12 15 18 9"})})]}),children:t.pricingTiers.map(N=>{const de=b(N.value);return e.jsxs(Xn,{sx:"ui-employee-card__price-item",disabled:!H(N.value),children:[e.jsx("span",{className:"ui-employee-card__price-label",children:N.name}),de?e.jsxs("span",{className:"ui-employee-card__price-value-group",children:[e.jsx("span",{className:"ui-employee-card__price-value ui-employee-card__price-value--original",children:G(N.price)}),e.jsx("span",{className:"ui-employee-card__price-value ui-employee-card__price-value--discounted",children:G(de)})]}):e.jsx("span",{className:"ui-employee-card__price-value",children:G(N.price)})]},N.value)})}),e.jsxs("div",{className:"ui-employee-card__avatar-actions",children:[le&&e.jsx(Ze,{placement:"right",title:e.jsxs("span",{className:"ui-employee-card__lang-tooltip-item",children:[e.jsx("span",{children:le.name}),e.jsx("span",{className:"ui-employee-card__lang-level",children:le.level})]}),children:e.jsx("div",{className:"ui-employee-card__language-badge",children:e.jsx("img",{src:Ds(le,"24x18"),alt:le.name})})}),c&&e.jsx(Ie,{icon:o?e.jsx(Yr,{}):e.jsx(Er,{}),size:"small",variant:"outlined",color:o?"warning":"neutral",sx:"ui-employee-card__action-btn",onClick:ae,"aria-label":o?"Remove from cart":"Add to cart"}),(p||f)&&e.jsxs("div",{className:"ui-employee-card__share-wrapper",children:[e.jsx(Ie,{icon:e.jsx(Xa,{}),size:"small",variant:"outlined",color:"neutral",sx:"ui-employee-card__action-btn",onClick:j,"aria-label":"Share profile"}),k&&e.jsx("div",{className:"ui-employee-card__share-copied",children:"Copied!"})]})]})]}),e.jsx("div",{className:"ui-employee-card__back",children:e.jsxs("div",{className:"ui-employee-card__back-content",children:[e.jsx("div",{className:"ui-employee-card__back-header",children:e.jsxs("div",{className:"ui-employee-card__back-header-row",children:[t.profession&&e.jsx("p",{className:"ui-employee-card__back-role",style:{color:ye},children:t.profession}),e.jsxs("span",{className:"ui-employee-card__back-id",children:["ID: ",t.talentId]})]})}),P.length>0&&e.jsx("div",{className:"ui-employee-card__back-section",children:e.jsx("div",{className:"ui-employee-card__back-languages",children:P.map(N=>e.jsx(Ze,{title:N.name,placement:"top",children:e.jsxs("div",{className:"ui-employee-card__back-language-item",children:[e.jsxs("div",{className:"ui-employee-card__back-language-left",children:[e.jsx("img",{src:Ds(N,"20x15"),alt:N.name,className:"ui-employee-card__back-language-flag"}),e.jsx("span",{className:"ui-employee-card__back-language-iso",children:N.iso2.toUpperCase()})]}),e.jsx("span",{className:"ui-employee-card__back-language-level",children:N.level})]})},N.name))})}),W.length>0&&e.jsxs("div",{className:"ui-employee-card__back-section ui-employee-card__back-section--tools",children:[e.jsxs("div",{className:"ui-employee-card__carousel-header",children:[e.jsx("h4",{className:"ui-employee-card__back-section-title",children:"I Can Work With"}),W.length>Fn&&e.jsx(Es,{page:y,totalPages:R,onPrev:()=>S(N=>Math.max(0,N-1)),onNext:()=>S(N=>Math.min(R-1,N+1))})]}),e.jsx("div",{className:"ui-employee-card__back-tools",children:he.map(N=>e.jsxs("div",{className:"ui-employee-card__back-tool",children:[N.icon?e.jsx("img",{src:N.icon,alt:N.name,className:"ui-employee-card__back-tool-icon"}):e.jsx("span",{className:"ui-employee-card__back-tool-placeholder",children:N.name.charAt(0).toUpperCase()}),e.jsx("span",{className:"ui-employee-card__back-tool-name",children:N.name})]},N.id))})]}),t.tasks&&t.tasks.length>0&&e.jsxs("div",{className:"ui-employee-card__back-section",children:[e.jsx("h4",{className:"ui-employee-card__back-section-title",children:"Recent Tasks"}),e.jsx("div",{className:"ui-employee-card__back-tasks",children:t.tasks.map((N,de)=>e.jsx("div",{className:"ui-employee-card__back-task",children:e.jsx("span",{children:N.text})},N.id??de))})]})]})})]}),e.jsx(Ie,{icon:e.jsx(qr,{}),size:"medium",variant:"ghost",color:"primary",sx:"ui-employee-card__flip-btn",onClick:C,"aria-label":m?"Show front side":"Show back side"})]}),$e&&e.jsx("div",{className:"ui-employee-card__panel-clip",children:e.jsx("div",{className:"ui-employee-card__side-panel",children:a?.chatSlot??e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"ui-employee-card__side-panel-actions",children:[a?.onShareChat&&e.jsx(Ie,{icon:e.jsx(Xa,{}),size:"small",variant:"ghost",color:"neutral",sx:"ui-employee-card__side-panel-share",onClick:()=>a.onShareChat(),"aria-label":"Share chat"}),e.jsx(Ie,{icon:e.jsx(jt,{}),size:"small",variant:"ghost",color:"neutral",sx:"ui-employee-card__side-panel-close",onClick:()=>a?.onEnd(),"aria-label":"Close"})]}),e.jsxs("div",{className:"ui-employee-card__panel-voice-bar",children:[e.jsx("div",{className:"ui-employee-card__panel-mic-col",children:e.jsx(Ie,{icon:e.jsx(qa,{}),size:"medium",variant:"filled",color:z?"error":"primary",sx:`ui-employee-card__panel-mic-btn${z?" active-pulse":""}`,"aria-label":z?"Mute microphone":"Unmute microphone",onClick:a?.onMicToggle})}),e.jsx("div",{className:"ui-employee-card__talk-waveform",children:[...Array(7)].map((N,de)=>e.jsx("div",{className:"ui-employee-card__waveform-bar"},de))})]}),a?.faqChips&&a.faqChips.length>0&&e.jsxs("div",{className:"ui-employee-card__panel-faq",children:[e.jsx("span",{className:"ui-employee-card__panel-faq-label",children:"Quick questions"}),e.jsx("div",{className:"ui-employee-card__panel-faq-chips",children:a.faqChips.map((N,de)=>e.jsx(mt,{label:N,variant:"outlined",color:"neutral",size:"small",onClick:()=>a.onSendMessage?.(N)},de))})]}),e.jsx("div",{className:"ui-employee-card__panel-messages-scroll",ref:re,children:e.jsx("div",{className:"ui-employee-card__panel-messages",children:(a?.messages??[]).map((N,de)=>e.jsx("div",{className:`ui-employee-card__panel-bubble ui-employee-card__panel-bubble--${N.role}`,children:e.jsx("div",{className:"ui-employee-card__panel-bubble-text",children:N.text})},de))})}),a?.onSendMessage&&e.jsx("div",{className:"ui-employee-card__panel-input-bar",children:e.jsx(Ot,{fullWidth:!0,size:"small",value:Ne,onChange:N=>ue(N.target.value),onKeyDown:N=>{N.key==="Enter"&&U()},placeholder:"Ask anything...",endAdornment:e.jsx(Ie,{icon:e.jsx(Ar,{}),size:"small",variant:"ghost",color:"primary","aria-label":"Send",onClick:U})})})]})})})]})};$s.displayName="EmployeeCard";const ba=({src:t="/logo.png",alt:n="Any Employee Logo",text:s="Any Employee",onClick:a,size:r="medium",className:i=""})=>{const o=`ui-anyemp-logo ui-anyemp-logo--${r} ${i}`.trim(),c=d=>{a&&(d.key==="Enter"||d.key===" ")&&(d.preventDefault(),a())};return e.jsxs("div",{className:o,onClick:a,role:a?"button":void 0,tabIndex:a?0:void 0,onKeyDown:c,children:[e.jsx("div",{className:"ui-anyemp-logo__image-wrapper",children:e.jsx("img",{src:t,alt:n,className:"ui-anyemp-logo__image"})}),s&&e.jsx("span",{className:"ui-anyemp-logo__text",children:s})]})};ba.displayName="Logo";const Pi=[{label:"ABOUT US",href:"#about"},{label:"FAQ",href:"#faq"},{label:"REVIEWS",href:"#reviews"},{label:"CONTACT US",href:"#contact"}],Ts=({navItems:t=Pi,logoText:n="Any Employee",logoSrc:s,logoAlt:a,onLogoClick:r,sx:i})=>{const o=`ui-anyemp-header ${i?.root||""}`.trim(),c=`ui-anyemp-header__nav ${i?.nav||""}`.trim(),d=`ui-anyemp-header__nav-item ${i?.navItem||""}`.trim(),u=t.slice(0,Math.ceil(t.length/2)),p=t.slice(Math.ceil(t.length/2)),f=(h,m)=>{h.onClick&&(m.preventDefault(),h.onClick())};return e.jsx("header",{className:o,children:e.jsxs("nav",{className:c,children:[e.jsx("div",{className:"ui-anyemp-header__nav-group",children:u.map((h,m)=>e.jsx("a",{href:h.href||"#",className:d,onClick:x=>f(h,x),children:h.label},`left-${m}`))}),e.jsx(ba,{src:s,alt:a,text:n,onClick:r,className:i?.logo}),e.jsx("div",{className:"ui-anyemp-header__nav-group",children:p.map((h,m)=>e.jsx("a",{href:h.href||"#",className:d,onClick:x=>f(h,x),children:h.label},`right-${m}`))})]})})};Ts.displayName="Header";function zi(t,n){let s,a,r=-1;const i=o=>{for(const c of o)c.path&&(c.path===n?s=c.id:n.startsWith(c.path==="/"?"/":c.path+"/")&&c.path.length>r&&(a=c.id,r=c.path.length)),c.children&&i(c.children)};return i(t),s??a}const Ls=({item:t,isCollapsed:n,isActive:s,isExpanded:a,expandedIds:r,parentItemBehavior:i,depth:o,onToggleExpand:c,onItemClick:d,activeItemId:u,onMouseEnter:p,onMouseLeave:f})=>{const h=!!t.children?.length,m=l.useRef(null),x=l.useRef(null),v=["ui-sidebar__item",s&&"ui-sidebar__item--active",h&&"ui-sidebar__item--has-children",h&&a&&"ui-sidebar__item--open"].filter(Boolean).join(" "),g=D=>{if(t.external)return;const B=D.button===0&&!D.metaKey&&!D.ctrlKey&&!D.shiftKey&&!D.altKey;if(!(t.path&&!B)){if(!h){d&&t.path&&D.preventDefault(),d?.(t);return}if(i==="accordion"){t.path&&D.preventDefault(),c(t.id);return}d&&t.path&&D.preventDefault(),d?.(t)}},y=D=>{!h||i!=="navigate"||(D.key==="ArrowRight"&&!a||D.key==="ArrowLeft"&&a)&&(D.preventDefault(),c(t.id))},S=D=>{D.preventDefault(),D.stopPropagation(),c(t.id)},k=D=>{p?.(t.id,D.currentTarget)},T=e.jsxs(e.Fragment,{children:[t.icon&&e.jsx("span",{className:"ui-sidebar__item-icon",children:t.icon}),e.jsx("span",{className:"ui-sidebar__item-label",children:t.label}),t.badge!==void 0&&e.jsx("span",{className:"ui-sidebar__item-badge",children:t.badge}),h&&(i==="accordion"?e.jsx(Qn,{className:"ui-sidebar__item-chevron","aria-hidden":"true"}):e.jsx("button",{type:"button",className:"ui-sidebar__item-toggle",onClick:S,"aria-label":a?"Collapse section":"Expand section","aria-expanded":a,tabIndex:-1,children:e.jsx(Qn,{className:"ui-sidebar__item-chevron","aria-hidden":"true"})}))]}),$={"--ui-sidebar-depth":o},H=e.jsx("a",{ref:x,href:t.path,className:v,style:$,"aria-current":s?"page":void 0,target:t.external?"_blank":void 0,rel:t.external?"noopener noreferrer":void 0,onClick:g,onKeyDown:y,onMouseEnter:k,onMouseLeave:f,children:T}),Z=e.jsx("button",{ref:m,type:"button",className:v,style:$,onClick:g,onKeyDown:y,"aria-expanded":h&&i!=="navigate"?a:void 0,"aria-haspopup":h?!0:void 0,onMouseEnter:k,onMouseLeave:f,children:T}),te=t.path&&(!h||i!=="accordion")?H:Z;return e.jsxs("li",{children:[te,h&&e.jsx("div",{className:["ui-sidebar__children",a&&"ui-sidebar__children--open"].filter(Boolean).join(" "),children:e.jsx("ul",{role:"list",style:{listStyle:"none",margin:0,padding:0},children:t.children.map(D=>e.jsx(Ls,{item:D,isCollapsed:n,isActive:D.id===u,isExpanded:r.includes(D.id),expandedIds:r,parentItemBehavior:i,depth:o+1,onToggleExpand:c,onItemClick:d,activeItemId:u},D.id))})})]})},Hi=({user:t,onLogout:n,onLogin:s,theme:a,onThemeToggle:r,isCollapsed:i})=>{const o=a==="dark",[c,d]=l.useState(null),u=l.useRef(null),p=()=>{u.current!==null&&(clearTimeout(u.current),u.current=null)},f=(x,v)=>{if(!i)return;p();const g=x.getBoundingClientRect();d({kind:"label",label:v,top:g.top+g.height/2})},h=x=>{if(!i)return;p();const v=x.getBoundingClientRect();d({kind:"user",top:v.top+v.height/2})},m=()=>{p(),u.current=window.setTimeout(()=>d(null),200)};return l.useEffect(()=>()=>{u.current!==null&&clearTimeout(u.current)},[]),l.useEffect(()=>{i||d(null)},[i]),e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"ui-sidebar__builtin-footer",children:[r&&e.jsxs(Xe,{variant:"ghost",color:"neutral",size:"small",onClick:r,"aria-label":o?"Switch to light mode":"Switch to dark mode",sx:"ui-sidebar__theme-btn",onMouseEnter:x=>f(x.currentTarget,o?"Light mode":"Dark mode"),onMouseLeave:m,children:[e.jsx("span",{className:"ui-sidebar__footer-icon",children:o?e.jsx(Pr,{size:20}):e.jsx(Ir,{size:20})}),e.jsx("span",{className:"ui-sidebar__footer-label",children:o?"Light mode":"Dark mode"})]}),t&&e.jsxs("div",{className:"ui-sidebar__user",onMouseEnter:x=>h(x.currentTarget),onMouseLeave:m,children:[e.jsx(Kt,{name:t.name??t.email??"",src:t.avatar,alt:t.name??"User",size:"small",fallback:e.jsx(Xr,{}),sx:"ui-sidebar__user-avatar",crossOrigin:"anonymous",referrerPolicy:"no-referrer"}),!i&&e.jsxs("div",{className:"ui-sidebar__user-info",children:[t.name&&e.jsx("span",{className:"ui-sidebar__user-name",children:t.name}),t.email&&e.jsx("span",{className:"ui-sidebar__user-email",children:t.email}),t.roles&&t.roles.length>0&&e.jsx("span",{className:"ui-sidebar__user-roles",children:t.roles.join(", ")})]})]}),n&&e.jsxs(Xe,{variant:"ghost",color:"error",size:"small",onClick:n,"aria-label":"Log out",sx:"ui-sidebar__logout-btn",onMouseEnter:x=>f(x.currentTarget,"Log out"),onMouseLeave:m,children:[e.jsx("span",{className:"ui-sidebar__footer-icon",children:e.jsx(Sr,{size:20})}),e.jsx("span",{className:"ui-sidebar__footer-label",children:"Log out"})]}),!t&&s&&e.jsxs(Xe,{variant:"ghost",color:"primary",size:"small",onClick:s,"aria-label":"Log in",sx:"ui-sidebar__login-btn",onMouseEnter:x=>f(x.currentTarget,"Log in"),onMouseLeave:m,children:[e.jsx("span",{className:"ui-sidebar__footer-icon",children:e.jsx(Mr,{size:20})}),e.jsx("span",{className:"ui-sidebar__footer-label",children:"Log in"})]})]}),i&&c&&e.jsx("div",{className:["ui-sidebar__popover",c.kind==="user"?"ui-sidebar__popover--user":"ui-sidebar__popover--label"].join(" "),style:{top:c.top,transform:"translateY(-50%)"},onMouseEnter:p,onMouseLeave:m,children:c.kind==="label"?e.jsx("span",{children:c.label}):e.jsxs(e.Fragment,{children:[t?.name&&e.jsx("span",{className:"ui-sidebar__user-name",children:t.name}),t?.email&&e.jsx("span",{className:"ui-sidebar__user-email",children:t.email}),t?.roles&&t.roles.length>0&&e.jsx("span",{className:"ui-sidebar__user-roles",children:t.roles.join(", ")})]})})]})},Bi=200,Oi=240,ja=({items:t,collapsed:n,defaultCollapsed:s=!1,onCollapsedChange:a,mobileOpen:r=!1,onMobileClose:i,logo:o,logoIcon:c,logoTitle:d,footer:u,user:p,onLogout:f,onLogin:h,theme:m,onThemeToggle:x,activeItemId:v,activePath:g,onItemClick:y,parentItemBehavior:S="accordion",sx:k,style:T})=>{const $=v??(g!==void 0?zi(t,g):void 0),H=n!==void 0,[Z,te]=l.useState(s),D=H?n:Z,B=()=>{const w=!D;H||te(w),a?.(w)},[ne,F]=l.useState(()=>{if(!$)return[];const w=[],R=ie=>{for(const he of ie){if(he.id===$)return!0;if(he.children&&R(he.children))return w.push(he.id),!0}return!1};return R(t),w});l.useEffect(()=>{if(!$)return;const w=[],R=ie=>{for(const he of ie){if(he.id===$)return!0;if(he.children&&R(he.children))return w.push(he.id),!0}return!1};R(t),w.length!==0&&F(ie=>{const he=new Set(ie);for(const P of w)he.add(P);return Array.from(he)})},[$,t]);const Ne=w=>{F(R=>R.includes(w)?R.filter(ie=>ie!==w):[...R,w])},[ue,J]=l.useState(null),re=l.useRef(0),je=l.useRef(0),ye=l.useRef(null),Q=l.useCallback(()=>{ye.current!==null&&(clearTimeout(ye.current),ye.current=null)},[]),G=l.useCallback((w,R)=>{if(!D)return;Q();const ie=R.getBoundingClientRect();re.current=Math.min(ie.top,window.innerHeight-Oi),je.current=ie.top+ie.height/2,J(w)},[D,Q]),b=l.useCallback(()=>{D&&(Q(),ye.current=window.setTimeout(()=>J(null),Bi))},[D,Q]),A=w=>{Q(),J(w)};l.useEffect(()=>{if(!D||!ue)return;const w=R=>{R.key==="Escape"&&J(null)};return document.addEventListener("keydown",w),()=>document.removeEventListener("keydown",w)},[D,ue]),l.useEffect(()=>()=>Q(),[Q]),l.useEffect(()=>{D||J(null)},[D]);const I=ue?t.find(w=>w.id===ue):null,W=!u&&(p||f||h||x),V=["ui-sidebar",D&&"ui-sidebar--collapsed",k].filter(Boolean).join(" "),ve=(w=!1)=>e.jsxs(e.Fragment,{children:[w?e.jsxs("div",{className:"ui-sidebar__mobile-header",children:[e.jsx("div",{className:"ui-sidebar__mobile-header-logo",children:o}),e.jsx(Ie,{icon:e.jsx(jt,{}),"aria-label":"Close navigation",variant:"ghost",color:"neutral",size:"medium",onClick:i})]}):(o||c||d)&&e.jsx("div",{className:"ui-sidebar__header",children:o??e.jsxs(e.Fragment,{children:[c&&e.jsx("div",{className:"ui-sidebar__logo-icon",children:c}),d&&e.jsx("span",{className:"ui-sidebar__logo-title",children:d})]})}),e.jsx("nav",{className:"ui-sidebar__nav","aria-label":"Main navigation",children:e.jsx("ul",{role:"list",style:{listStyle:"none",margin:0,padding:0},children:t.map(R=>e.jsx(Ls,{item:R,isCollapsed:w?!1:D,isActive:R.id===$,isExpanded:ne.includes(R.id),expandedIds:ne,parentItemBehavior:S,depth:0,onToggleExpand:Ne,onItemClick:y,activeItemId:$,onMouseEnter:w?void 0:G,onMouseLeave:w?void 0:b},R.id))})}),u&&e.jsx("div",{className:"ui-sidebar__footer",children:u}),W&&e.jsx(Hi,{user:p,onLogout:f,onLogin:h,theme:m,onThemeToggle:x,isCollapsed:w?!1:D})]});return e.jsxs(e.Fragment,{children:[e.jsxs("aside",{className:V,style:T,children:[e.jsx(Ie,{icon:D?e.jsx(Pn,{}):e.jsx(In,{}),"aria-label":D?"Expand sidebar":"Collapse sidebar",size:"small",variant:"outlined",color:"neutral",onClick:B,sx:"ui-sidebar__toggle-btn"}),e.jsx("div",{className:"ui-sidebar__inner",children:ve(!1)}),D&&I&&e.jsx("div",{className:["ui-sidebar__popover",!I.children?.length&&"ui-sidebar__popover--label"].filter(Boolean).join(" "),style:I.children?.length?{top:re.current}:{top:je.current,transform:"translateY(-50%)"},onMouseEnter:()=>A(I.id),onMouseLeave:b,role:I.children?.length?"menu":void 0,children:I.children?.length?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"ui-sidebar__popover-header",children:I.label}),I.children.map(w=>{const R=w.id===$,ie=["ui-sidebar__popover-item",R&&"ui-sidebar__popover-item--active"].filter(Boolean).join(" ");return w.path?e.jsxs("a",{href:w.path,className:ie,"aria-current":R?"page":void 0,role:"menuitem",onClick:he=>{he.button===0&&!he.metaKey&&!he.ctrlKey&&!he.shiftKey&&!he.altKey&&(y&&he.preventDefault(),y?.(w),J(null))},children:[w.icon&&e.jsx("span",{className:"ui-sidebar__item-icon",children:w.icon}),w.label]},w.id):e.jsxs("button",{type:"button",className:ie,role:"menuitem",onClick:()=>{y?.(w),J(null)},children:[w.icon&&e.jsx("span",{className:"ui-sidebar__item-icon",children:w.icon}),w.label]},w.id)})]}):e.jsx("span",{children:I.label})})]}),e.jsx(Ja,{open:r,onClose:i,anchor:"left",width:"100vw",showCloseButton:!1,closeOnEscape:!0,closeOnBackdropClick:!0,trapFocus:!0,sx:"ui-sidebar__mobile-drawer",hideBackdrop:!0,children:e.jsx("div",{className:"ui-sidebar__mobile-inner",children:ve(!0)})})]})};ja.displayName="Sidebar";const As=({children:t,variant:n="sidebar",sidebar:s,header:a,sx:r,style:i})=>{const[o,c]=l.useState(s?.defaultCollapsed??!1),[d,u]=l.useState(!1),p=s?.mobileOpen??d,f=s?.onMobileClose??(()=>u(!1)),h=v=>{c(v),s?.onCollapsedChange?.(v)},m=["ui-layout",`ui-layout--${n}`,r].filter(Boolean).join(" ");if(n==="centered")return e.jsxs("div",{className:m,style:i,children:[a&&e.jsx("header",{className:"ui-layout__centered-header",children:a}),e.jsx("div",{className:"ui-layout__content",children:e.jsx("div",{className:"ui-layout__centered-card",children:t})})]});const x=s?.collapsed!==void 0?s.collapsed:o;return e.jsxs("div",{className:m,style:i,children:[e.jsx("div",{className:["ui-layout__sidebar-area",x&&"ui-layout__sidebar-area--collapsed"].filter(Boolean).join(" "),"aria-hidden":"true"}),s&&e.jsx(ja,{...s,collapsed:s.collapsed!==void 0?s.collapsed:o,onCollapsedChange:h,mobileOpen:p,onMobileClose:f}),e.jsxs("div",{className:"ui-layout__content",children:[e.jsx("div",{className:"ui-layout__mobile-header",children:e.jsx(Ie,{icon:e.jsx(Ur,{}),"aria-label":"Open navigation","aria-expanded":p,variant:"ghost",color:"neutral",size:"medium",onClick:()=>u(!0)})}),e.jsx("main",{className:"ui-layout__main",children:t})]})]})};As.displayName="Layout";const ya=2;function Fi(t){const n=Math.floor(t/60),s=t%60;return n>0&&s>0?`${n}h ${s}m`:n>0?`${n}h`:`${s} min`}const Vi=()=>e.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("circle",{cx:"12",cy:"12",r:"10"}),e.jsx("polyline",{points:"12 6 12 12 16 14"})]}),Is=()=>e.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M4 19.5A2.5 2.5 0 0 1 6.5 17H20"}),e.jsx("path",{d:"M6.5 2H20v20H6.5A2.5 2.5 0 0 1 4 19.5v-15A2.5 2.5 0 0 1 6.5 2z"})]}),Yi=()=>e.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("circle",{cx:"12",cy:"12",r:"10"}),e.jsx("path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3"}),e.jsx("line",{x1:"12",y1:"17",x2:"12.01",y2:"17"})]}),Wi=()=>e.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("circle",{cx:"12",cy:"12",r:"10"}),e.jsx("polygon",{points:"10 8 16 12 10 16 10 8",fill:"currentColor",stroke:"none"})]}),Ki=()=>e.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("rect",{x:"2",y:"3",width:"20",height:"14",rx:"2"}),e.jsx("line",{x1:"8",y1:"21",x2:"16",y2:"21"}),e.jsx("line",{x1:"12",y1:"17",x2:"12",y2:"21"})]}),Ui=()=>e.jsx("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"currentColor",children:e.jsx("path",{d:"M19 21l-7-5-7 5V5a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2z"})}),qi=()=>e.jsx("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:e.jsx("path",{d:"M19 21l-7-5-7 5V5a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2z"})}),Gi=()=>e.jsx("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"currentColor",children:e.jsx("polygon",{points:"12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2"})}),Xi=({isBookmarked:t,onToggle:n})=>{const[s,a]=l.useState(0),r=i=>{i.preventDefault(),i.stopPropagation(),n&&(a(o=>o+1),n(!t))};return e.jsx("span",{className:`ui-course-card__badge--bookmark-wrap${s>0?" ui-course-card__badge--bookmark-pop":""}`,children:e.jsx(Ie,{icon:t?e.jsx(Ui,{}):e.jsx(qi,{}),"aria-label":t?"Remove bookmark":"Add bookmark",size:"small",variant:"ghost",sx:"rounded-full",style:{background:"rgba(255, 255, 255, 0.9)",color:"var(--palette-warning-main)",backdropFilter:"blur(4px)",boxShadow:"0 2px 8px rgba(0, 0, 0, 0.2)"},onClick:n?r:void 0,disabled:!n})},s)},Zi=({title:t,description:n,imageUrl:s,difficulty:a,durationMinutes:r,lessonCount:i,testCount:o,videoCount:c,presentationCount:d,professions:u,progress:p,rating:f,author:h,isCompleted:m,isDraft:x,isRecommended:v,badgeSlot:g,isBookmarked:y,onBookmarkToggle:S,href:k,target:T,onClick:$,sx:H})=>{const Z=["ui-course-card",x?"ui-course-card--draft":"",H||""].filter(Boolean).join(" "),te=u?.length||0,D=Math.max(0,te-ya),B=a&&D>0?ya-1:ya,ne=Math.max(0,te-B),F=ne>0?(u||[]).slice(B).map(J=>J.name).join(", "):void 0,Ne=r!=null&&r>0||i!=null||o!=null||c!=null&&c>0||d!=null&&d>0;console.log("professions",u),console.log("maxVisible",B),console.log("hiddenCount",ne),console.log("hiddenProfessionNames",F),console.log("author",h),console.log("isCompleted",m),console.log("isDraft",x),console.log("isRecommended",v),console.log("badgeSlot",g);const ue=e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"ui-course-card__image-wrap",children:[s?e.jsx("img",{className:"ui-course-card__image",src:s,alt:t}):e.jsx("div",{className:"ui-course-card__image-placeholder",children:e.jsx(Is,{})}),n&&e.jsx("div",{className:"ui-course-card__image-overlay",children:e.jsx("p",{className:"ui-course-card__image-overlay-text",children:n})}),(x||m||v||g)&&e.jsxs("div",{className:"ui-course-card__badge-wrap ui-course-card__badge-wrap--top-left",children:[x&&e.jsx(Dt,{label:"Draft",color:"warning",variant:"filled",size:"small"}),m&&e.jsx(Dt,{label:"✓ Done",color:"success",variant:"filled",size:"small"}),v&&e.jsx(Dt,{label:"★ Recommended",color:"info",variant:"filled",size:"small"}),g]}),e.jsx(Xi,{isBookmarked:!!y,onToggle:S})]}),e.jsxs("div",{className:"ui-course-card__body",children:[e.jsx("h3",{className:"ui-course-card__title",children:t}),(a||u&&u.length>0)&&e.jsxs("div",{className:"ui-course-card__professions",children:[a&&e.jsxs("span",{className:"ui-course-card__difficulty-tag","data-difficulty":a,children:[e.jsxs("span",{className:"ui-course-card__level-bars","aria-hidden":"true",children:[e.jsx("span",{className:"ui-course-card__level-bar"}),e.jsx("span",{className:"ui-course-card__level-bar"}),e.jsx("span",{className:"ui-course-card__level-bar"})]}),a.charAt(0).toUpperCase()+a.slice(1)]}),(u||[]).slice(0,B).map((J,re)=>e.jsx("span",{className:"ui-course-card__profession-tag",style:J.color?{"--tag-color":J.color}:void 0,children:J.name},re)),ne>0&&e.jsx(Ze,{title:F,placement:"top",children:e.jsxs("span",{className:"ui-course-card__profession-tag ui-course-card__profession-tag--more",children:["+",ne]})})]}),typeof p=="number"&&e.jsxs("div",{className:"ui-course-card__progress",children:[e.jsx("div",{className:"ui-course-card__progress-track",children:e.jsx("div",{className:"ui-course-card__progress-fill",style:{width:`${Math.min(100,Math.max(0,p))}%`}})}),e.jsxs("span",{className:"ui-course-card__progress-value",children:[Math.round(p),"%"]})]}),(f!=null||h||Ne)&&e.jsxs("div",{className:"ui-course-card__footer",children:[e.jsxs("div",{className:"ui-course-card__footer-left",children:[f!=null&&e.jsxs("span",{className:"ui-course-card__rating",children:[e.jsx(Gi,{}),f.toFixed(1)]}),h&&e.jsxs("span",{className:"ui-course-card__author",children:[h.avatarUrl?e.jsx("img",{className:"ui-course-card__author-avatar",src:h.avatarUrl,alt:h.username}):e.jsx("span",{className:"ui-course-card__author-avatar ui-course-card__author-avatar--placeholder",children:h.username.charAt(0).toUpperCase()}),e.jsx("span",{className:"ui-course-card__author-username",children:h.username})]})]}),e.jsxs("div",{className:"ui-course-card__footer-right",children:[r!=null&&r>0&&e.jsx(Ze,{title:"Duration",placement:"top",children:e.jsxs("span",{className:"ui-course-card__stat-item",children:[e.jsx(Vi,{}),Fi(r)]})}),c!=null&&c>0&&e.jsx(Ze,{title:`${c} video lesson${c!==1?"s":""}`,placement:"top",children:e.jsxs("span",{className:"ui-course-card__stat-item",children:[e.jsx(Wi,{}),c]})}),d!=null&&d>0&&e.jsx(Ze,{title:`${d} presentation${d!==1?"s":""}`,placement:"top",children:e.jsxs("span",{className:"ui-course-card__stat-item",children:[e.jsx(Ki,{}),d]})}),i!=null&&e.jsx(Ze,{title:`${i} lesson${i!==1?"s":""}`,placement:"top",children:e.jsxs("span",{className:"ui-course-card__stat-item",children:[e.jsx(Is,{}),i]})}),o!=null&&e.jsx(Ze,{title:`${o} test${o!==1?"s":""}`,placement:"top",children:e.jsxs("span",{className:"ui-course-card__stat-item",children:[e.jsx(Yi,{}),o]})})]})]})]})]});return k?e.jsx("a",{className:Z,href:k,target:T,rel:T==="_blank"?"noopener noreferrer":void 0,onClick:$,"data-difficulty":a,children:ue}):e.jsx("div",{className:Z,"data-difficulty":a,onClick:$,role:$?"button":void 0,tabIndex:$?0:void 0,children:ue})},Ut=2;function Ji(t){const n=Math.floor(t/60),s=t%60;return n>0&&s>0?`${n}h ${s}m`:n>0?`${n}h`:`${s} min`}const Qi=()=>e.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("circle",{cx:"12",cy:"12",r:"10"}),e.jsx("polyline",{points:"12 6 12 12 16 14"})]}),Ri=()=>e.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("circle",{cx:"12",cy:"12",r:"10"}),e.jsx("path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3"}),e.jsx("line",{x1:"12",y1:"17",x2:"12.01",y2:"17"})]}),el=()=>e.jsxs("svg",{width:"36",height:"36",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M4 19.5A2.5 2.5 0 0 1 6.5 17H20"}),e.jsx("path",{d:"M6.5 2H20v20H6.5A2.5 2.5 0 0 1 4 19.5v-15A2.5 2.5 0 0 1 6.5 2z"})]}),tl=()=>e.jsx("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"currentColor",children:e.jsx("path",{d:"M19 21l-7-5-7 5V5a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2z"})}),nl=()=>e.jsx("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:e.jsx("path",{d:"M19 21l-7-5-7 5V5a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2z"})}),al=()=>e.jsx("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"currentColor",children:e.jsx("polygon",{points:"12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2"})}),sl=({isBookmarked:t,onToggle:n})=>{const[s,a]=l.useState(0),r=i=>{i.preventDefault(),i.stopPropagation(),n&&(a(o=>o+1),n(!t))};return e.jsx("span",{className:`ui-lesson-card__badge--bookmark-wrap${s>0?" ui-lesson-card__badge--bookmark-pop":""}`,children:e.jsx(Ie,{icon:t?e.jsx(tl,{}):e.jsx(nl,{}),"aria-label":t?"Remove bookmark":"Add bookmark",size:"small",variant:"ghost",sx:"rounded-full",style:{background:"rgba(255, 255, 255, 0.9)",color:"var(--palette-warning-main)",backdropFilter:"blur(4px)",boxShadow:"0 2px 8px rgba(0, 0, 0, 0.2)"},onClick:n?r:void 0,disabled:!n})},s)},rl=({title:t,description:n,imageUrl:s,type:a,contentType:r,durationMinutes:i,author:o,module:c,course:d,skills:u,professions:p,testCount:f,rating:h,isBookmarked:m,onBookmarkToggle:x,isCompleted:v,isDraft:g,isRecommended:y,badgeSlot:S,href:k,target:T,onClick:$,customButtons:H,sx:Z})=>{const te=["ui-lesson-card",g?"ui-lesson-card--draft":"",Z||""].filter(Boolean).join(" "),D=(p?.length||0)-Ut,B=D>0?(p||[]).slice(Ut).map(J=>J.name).join(", "):void 0,ne=(u?.length||0)-Ut,F=ne>0?(u||[]).slice(Ut).join(", "):void 0,Ne=i!=null&&i>0||f!=null||!!o,ue=e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"ui-lesson-card__image-wrap",children:[s?e.jsx("img",{className:"ui-lesson-card__image",src:s,alt:t}):e.jsx("div",{className:"ui-lesson-card__image-placeholder",children:e.jsx(el,{})}),n&&e.jsx("div",{className:"ui-lesson-card__image-overlay",children:e.jsx("p",{className:"ui-lesson-card__image-overlay-text",children:n})}),(g||v||y||S)&&e.jsxs("div",{className:"ui-lesson-card__badge-wrap ui-lesson-card__badge-wrap--top-left",children:[g&&e.jsx(Dt,{label:"Draft",color:"warning",variant:"filled",size:"small"}),v&&e.jsx(Dt,{label:"✓ Done",color:"success",variant:"filled",size:"small"}),y&&e.jsx(Dt,{label:"★ Recommended",color:"info",variant:"filled",size:"small"}),S]}),e.jsx(sl,{isBookmarked:!!m,onToggle:x})]}),e.jsxs("div",{className:"ui-lesson-card__body",children:[e.jsx("h3",{className:"ui-lesson-card__title",children:t}),(a||r&&r!=="standard"||p&&p.length>0||u&&u.length>0)&&e.jsxs("div",{className:"ui-lesson-card__chips-row",children:[a&&e.jsx("span",{className:"ui-lesson-card__type-chip","data-type":a.toLowerCase(),children:a}),r&&r!=="standard"&&e.jsx("span",{className:"ui-lesson-card__type-chip ui-lesson-card__type-chip--content",children:r}),(p||[]).slice(0,Ut).map((J,re)=>e.jsx("span",{className:"ui-lesson-card__profession-chip",style:J.color?{"--chip-accent":J.color}:void 0,children:J.name},re)),D>0&&e.jsx(Ze,{title:B,placement:"top",children:e.jsxs("span",{className:"ui-lesson-card__profession-chip ui-lesson-card__profession-chip--more",children:["+",D]})}),(u||[]).slice(0,Ut).map((J,re)=>e.jsx("span",{className:"ui-lesson-card__skill-chip",children:J},re)),ne>0&&e.jsx(Ze,{title:F,placement:"top",children:e.jsxs("span",{className:"ui-lesson-card__skill-chip ui-lesson-card__skill-chip--more",children:["+",ne]})})]}),(h!=null||o||Ne||H)&&e.jsxs("div",{className:"ui-lesson-card__footer",children:[e.jsxs("div",{className:"ui-lesson-card__footer-left",children:[h!=null&&e.jsxs("span",{className:"ui-lesson-card__rating",children:[e.jsx(al,{}),h.toFixed(1)]}),o&&e.jsxs("span",{className:"ui-lesson-card__author",children:[o.avatarUrl?e.jsx("img",{className:"ui-lesson-card__author-avatar",src:o.avatarUrl,alt:o.username}):e.jsx("span",{className:"ui-lesson-card__author-avatar ui-lesson-card__author-avatar--placeholder",children:o.username.charAt(0).toUpperCase()}),e.jsx("span",{className:"ui-lesson-card__author-username",children:o.username})]})]}),e.jsxs("div",{className:"ui-lesson-card__footer-right",children:[i!=null&&i>0&&e.jsx(Ze,{title:"Duration",placement:"top",children:e.jsxs("span",{className:"ui-lesson-card__stat-item",children:[e.jsx(Qi,{}),Ji(i)]})}),f!=null&&e.jsx(Ze,{title:`${f} test${f!==1?"s":""}`,placement:"top",children:e.jsxs("span",{className:"ui-lesson-card__stat-item",children:[e.jsx(Ri,{}),f]})}),H&&e.jsx("span",{onClick:J=>J.stopPropagation(),children:H})]})]}),(c||d)&&e.jsxs("div",{className:"ui-lesson-card__context",children:[c&&e.jsx(Ze,{title:"Module",placement:"top",children:e.jsx("span",{className:"ui-lesson-card__context-item",children:c})}),d&&e.jsx(Ze,{title:"Course",placement:"top",children:e.jsx("span",{className:"ui-lesson-card__context-item",children:d})})]})]})]});return k?e.jsx("a",{className:te,href:k,target:T,rel:T==="_blank"?"noopener noreferrer":void 0,onClick:$,children:ue}):e.jsx("div",{className:te,onClick:$,role:$?"button":void 0,tabIndex:$?0:void 0,children:ue})},il="#6366f1",ll="done",ol=t=>{const n=t instanceof Date?t:new Date(t);if(Number.isNaN(n.getTime()))return"";const s=String(n.getDate()).padStart(2,"0"),a=String(n.getMonth()+1).padStart(2,"0");return`${s}.${a}`},cl=()=>e.jsxs("svg",{width:"11",height:"11",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",focusable:"false",children:[e.jsx("circle",{cx:"12",cy:"12",r:"10"}),e.jsx("line",{x1:"12",y1:"8",x2:"12",y2:"12"}),e.jsx("line",{x1:"12",y1:"16",x2:"12.01",y2:"16"})]}),dl=()=>e.jsxs("svg",{width:"11",height:"11",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",focusable:"false",children:[e.jsx("path",{d:"M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"}),e.jsx("circle",{cx:"12",cy:"12",r:"3"})]}),ul=()=>e.jsx("svg",{width:"11",height:"11",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",focusable:"false",children:e.jsx("path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"})}),hl=()=>e.jsx("svg",{width:"11",height:"11",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",focusable:"false",children:e.jsx("path",{d:"M21.44 11.05l-9.19 9.19a6 6 0 0 1-8.49-8.49l9.19-9.19a4 4 0 0 1 5.66 5.66l-9.2 9.19a2 2 0 0 1-2.83-2.83l8.49-8.48"})}),pl=()=>e.jsxs("svg",{width:"11",height:"11",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",focusable:"false",children:[e.jsx("rect",{x:"3",y:"4",width:"18",height:"18",rx:"2",ry:"2"}),e.jsx("line",{x1:"16",y1:"2",x2:"16",y2:"6"}),e.jsx("line",{x1:"8",y1:"2",x2:"8",y2:"6"}),e.jsx("line",{x1:"3",y1:"10",x2:"21",y2:"10"})]}),ml=()=>e.jsxs("svg",{width:"11",height:"11",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",focusable:"false",children:[e.jsx("polyline",{points:"9 11 12 14 22 4"}),e.jsx("path",{d:"M21 12v7a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11"})]}),fl=()=>e.jsx("svg",{width:"11",height:"11",viewBox:"0 0 24 24",fill:"currentColor",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",focusable:"false",children:e.jsx("polygon",{points:"5 3 19 12 5 21 5 3"})}),_l=()=>e.jsxs("svg",{width:"11",height:"11",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",focusable:"false",children:[e.jsx("path",{d:"M4 15s1-1 4-1 5 2 8 2 4-1 4-1V3s-1 1-4 1-5-2-8-2-4 1-4 1z"}),e.jsx("line",{x1:"4",y1:"22",x2:"4",y2:"15"})]}),gl=t=>t.user?.fullName||t.user?.name||String(t.user_id),Ps=(t,{role:n,shape:s,color:a})=>e.jsx(xa,{max:4,total:t.length,size:"small",spacing:"small",shape:s,surplusColor:"primary",children:t.map(r=>{const i=gl(r);return e.jsx(Kt,{name:i,src:r.user?.avatar,alt:`${n}: ${i}`,color:a??"primary",referrerPolicy:"no-referrer"},r.user_id)})}),zs=({task:t,onClick:n,statusInfo:s,formatDate:a,isDragging:r=!1,dragHandleProps:i,sx:o})=>{const c=!!t._pending,d=t.priority||"low",u=a??ol,p=t.is_done??t.status===ll,f=(()=>{if(!t.due_date||p)return!1;const F=new Date(t.due_date);return F.setHours(23,59,59,999),F<new Date})(),h=t.labels||[],m=t.assignees||[],x=t.controllers||[],v=m.length>0||x.length>0,g=t._commentCount??0,y=t._attachmentCount??0,S=t._activeSessions??0,k=t._subtaskCount??0,T=t._completedSubtaskCount,$=k>0&&T===k,H=!!t.start_date||!!t.due_date,Z=H||S>0||k>0||g>0||y>0,te=["ui-task-card",c&&"ui-task-card--pending",r&&"ui-task-card--dragging",o].filter(Boolean).join(" "),D=()=>{c||r||n?.()},B=c?void 0:i?.attributes,ne=c?void 0:i?.listeners;return e.jsxs("div",{ref:i?.ref,role:n?"button":void 0,tabIndex:n&&!c?0:void 0,"aria-busy":c||void 0,"data-priority":d,className:te,onClick:D,...B,...ne,children:[e.jsxs("div",{className:"ui-task-card__title-row",children:[e.jsx("p",{className:"ui-task-card__title",children:t.title}),s&&e.jsx(mt,{size:"small",label:s.label,sx:"ui-task-card__status",style:{backgroundColor:s.color||"#6B7280",color:"#fff",borderColor:"transparent"}})]}),(t.project?.name||t.milestone?.name)&&e.jsxs("div",{className:"ui-task-card__row ui-task-card__context",title:[t.project?.name,t.milestone?.name].filter(Boolean).join(" · "),children:[t.project?.name&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"ui-task-card__project-dot",style:{backgroundColor:t.project.color||"currentColor"},"aria-hidden":"true"}),e.jsx("span",{className:"ui-task-card__context-project",children:t.project.name})]}),t.project?.name&&t.milestone?.name&&e.jsx("span",{className:"ui-task-card__context-sep","aria-hidden":"true",children:"·"}),t.milestone?.name&&e.jsxs(e.Fragment,{children:[!t.project?.name&&e.jsx("span",{className:"ui-task-card__row-icon","aria-hidden":"true",children:e.jsx(_l,{})}),e.jsx("span",{className:"ui-task-card__context-milestone",children:t.milestone.name})]})]}),v&&e.jsxs("div",{className:"ui-task-card__people",children:[m.length>0&&Ps(m,{role:"Assignee",color:"primary"}),x.length>0&&e.jsxs("span",{className:"ui-task-card__controllers",title:"Controllers",children:[e.jsx("span",{className:"ui-task-card__row-icon",children:e.jsx(dl,{})}),Ps(x,{role:"Controller",shape:"square",color:"warning"})]})]}),h.length>0&&e.jsx("div",{className:"ui-task-card__labels",children:h.map(F=>e.jsx(mt,{size:"small",label:F.name,style:{backgroundColor:F.color||il,color:"#fff",borderColor:"transparent"}},F.id))}),Z&&e.jsxs("div",{className:"ui-task-card__footer",children:[e.jsx("div",{className:"ui-task-card__footer-left",children:H&&e.jsxs("span",{className:f?"ui-task-card__due ui-task-card__due--overdue":"ui-task-card__due",title:[t.start_date&&`Start: ${u(t.start_date)}`,t.due_date&&`Due: ${u(t.due_date)}`].filter(Boolean).join(" · "),children:[e.jsx("span",{className:"ui-task-card__row-icon",children:f?e.jsx(cl,{}):e.jsx(pl,{})}),t.start_date&&t.due_date?e.jsxs(e.Fragment,{children:[u(t.start_date),e.jsx("span",{className:"ui-task-card__due-arrow","aria-hidden":"true",children:"→"}),u(t.due_date)]}):t.due_date?u(t.due_date):t.start_date?e.jsxs(e.Fragment,{children:[u(t.start_date),e.jsx("span",{className:"ui-task-card__due-arrow","aria-hidden":"true",children:"→"})]}):null]})}),e.jsxs("div",{className:"ui-task-card__footer-right",children:[S>0&&e.jsxs("span",{className:"ui-task-card__active",title:S===1?"1 person is working on this now":`${S} people are working on this now`,children:[e.jsx("span",{className:"ui-task-card__row-icon ui-task-card__active-icon",children:e.jsx(fl,{})}),S>1&&S]}),k>0&&e.jsxs("span",{className:$?"ui-task-card__count ui-task-card__count--done":"ui-task-card__count",title:T!==void 0?`${T} of ${k} subtasks done`:`${k} subtask${k===1?"":"s"}`,children:[e.jsx("span",{className:"ui-task-card__row-icon",children:e.jsx(ml,{})}),T!==void 0?`${T}/${k}`:k]}),g>0&&e.jsxs("span",{className:"ui-task-card__count",children:[e.jsx("span",{className:"ui-task-card__row-icon",children:e.jsx(ul,{})}),g]}),y>0&&e.jsxs("span",{className:"ui-task-card__count",children:[e.jsx("span",{className:"ui-task-card__row-icon",children:e.jsx(hl,{})}),y]})]})]})]})};zs.displayName="TaskCard";function _t(t){return!!t.endDate&&t.endDate>t.date}function Hs(t,n){const s=t.endDate&&t.endDate>t.date?t.endDate:t.date;return t.date<=n&&n<=s}const xl={label:"",short:"",icon:"📅",color:"#718096",bg:"rgba(113,128,150,0.10)"};function $t(t,n){return n[t]??{...xl,label:t,short:t}}function fn(t,n){return t.title?t.title:$t(t.category,n??{}).label||t.category}function Tt(t){const n=t.getFullYear(),s=String(t.getMonth()+1).padStart(2,"0"),a=String(t.getDate()).padStart(2,"0");return`${n}-${s}-${a}`}function vl(t){const[n,s,a]=t.split("-").map(Number);return new Date(n,s-1,a)}function Bs(t){const n=t.getDay(),s=n===0?-6:1-n,a=new Date(t);return a.setDate(t.getDate()+s),a.setHours(0,0,0,0),a}const Os=["Mon","Tue","Wed","Thu","Fri","Sat","Sun"],qt=["January","February","March","April","May","June","July","August","September","October","November","December"];function Fs(t){return t.type==="daterange"?{start:null,end:null}:t.type==="select"&&!t.multiple?null:[]}function bl(t,n){if(!t.type||t.type==="pills")return Array.isArray(n)?n.length:0;if(t.type==="select")return Array.isArray(n)?n.length:n!==null&&n!==""?1:0;if(t.type==="daterange"){const s=n;return s?.start||s?.end?1:0}return 0}const Vs=({isOpen:t,onClose:n,sections:s,value:a,onChange:r,onReset:i,renderBody:o})=>{function c(h,m){r({...a,[h]:m})}function d(h,m){const x=a[h]??[],v=x.includes(m)?x.filter(g=>g!==m):[...x,m];r({...a,[h]:v})}function u(){i()}const p=o?0:s.reduce((h,m)=>h+bl(m,a[m.id]??Fs(m)),0),f=`ui-calendar__filter${t?" ui-calendar__filter--open":""}`;return e.jsx("aside",{className:f,"aria-label":"Filters","aria-hidden":!t,children:e.jsxs("div",{className:"ui-cal-filter",children:[e.jsxs("div",{className:"ui-cal-filter__header",children:[e.jsxs("span",{className:"ui-cal-filter__title",children:["Filters",p>0?e.jsx("span",{className:"ui-cal-filter__count",children:p}):null]}),e.jsx(Ie,{icon:e.jsx(jt,{}),"aria-label":"Close filters",onClick:n,variant:"ghost",color:"neutral",size:"small",style:{borderRadius:"var(--radius-sm)"}})]}),e.jsx("div",{className:"ui-cal-filter__body",children:o?o():s.map(h=>e.jsxs("div",{className:"ui-cal-filter__section",children:[e.jsx("div",{className:"ui-cal-filter__section-title",children:h.title}),jl(h,a[h.id]??Fs(h),d,c)]},h.id))}),e.jsx("div",{className:"ui-cal-filter__footer",children:e.jsx(Xe,{variant:"outlined",color:"neutral",size:"small",style:{flex:1},onClick:u,children:"Reset all"})})]})})};Vs.displayName="CalendarFilterPanel";function jl(t,n,s,a){if(t.type==="select")return t.searchable?e.jsx(Jn,{options:t.options,value:n,onChange:i=>a(t.id,i),multiple:t.multiple,placeholder:t.placeholder,clearable:t.clearable,fullWidth:!0}):e.jsx($n,{options:t.options,value:n,onChange:i=>a(t.id,i),multiple:t.multiple,placeholder:t.placeholder,clearable:t.clearable,fullWidth:!0});if(t.type==="daterange")return e.jsx(ia,{mode:"range",rangeValue:n,onRangeChange:i=>a(t.id,i),minDate:t.minDate,maxDate:t.maxDate,triggerVariant:"input",multiMonth:!1});const r=n??[];return e.jsx("div",{className:"ui-cal-filter__pills",children:t.options.map(i=>e.jsx(mt,{label:i.label,variant:"outlined",color:"neutral",size:"small",selected:r.includes(i.value),onClick:()=>{t.multiple===!1?a(t.id,r.includes(i.value)?[]:[i.value]):s(t.id,i.value)}},i.value))})}const yl=[{id:"month",label:"Month"},{id:"week",label:"Week"},{id:"day",label:"Day"}],Vn={borderRadius:"var(--radius-sm)"};function kl(t,n,s,a,r){if(t==="month")return`${qt[s]} ${n}`;if(t==="week"&&a){const i=new Date(a);return i.setDate(a.getDate()+6),a.getMonth()===i.getMonth()?`${qt[a.getMonth()]} ${a.getDate()}–${i.getDate()}, ${a.getFullYear()}`:`${qt[a.getMonth()]} ${a.getDate()} – ${qt[i.getMonth()]} ${i.getDate()}, ${i.getFullYear()}`}if(t==="day"&&r){const[i,o,c]=r.split("-").map(Number);return new Date(i,o-1,c).toLocaleDateString("en-US",{weekday:"long",month:"long",day:"numeric",year:"numeric"})}return`${qt[s]} ${n}`}const Ys=({view:t,year:n,month:s,weekStart:a,dayDate:r,onViewChange:i,onPrev:o,onNext:c,onToday:d,onSearch:u,onFilter:p,onAdd:f,showSearch:h,showFilters:m,showAdd:x,filterOpen:v})=>{const g=kl(t,n,s,a,r);return e.jsxs("div",{className:"ui-calendar__header",children:[e.jsxs("div",{className:"ui-calendar__nav",children:[e.jsx(Ie,{icon:e.jsx(In,{}),"aria-label":"Previous",onClick:o,variant:"outlined",color:"neutral",size:"small",style:Vn}),e.jsx("button",{className:"ui-calendar__today-btn",onClick:d,children:"Today"}),e.jsx(Ie,{icon:e.jsx(Pn,{}),"aria-label":"Next",onClick:c,variant:"outlined",color:"neutral",size:"small",style:Vn})]}),e.jsx("div",{className:"ui-calendar__title",children:g}),e.jsx("div",{className:"ui-calendar__view-switcher",role:"group","aria-label":"Calendar view",children:yl.map(({id:y,label:S})=>e.jsx("button",{className:`ui-calendar__view-btn${t===y?" ui-calendar__view-btn--active":""}`,onClick:()=>i(y),"aria-pressed":t===y,children:S},y))}),e.jsxs("div",{className:"ui-calendar__actions",children:[h&&e.jsx(Ie,{icon:e.jsx(Dr,{}),"aria-label":"Search (Ctrl+K)",onClick:u,variant:"outlined",color:"neutral",size:"small",style:Vn,title:"Search (Ctrl+K)"}),m&&e.jsx(Ie,{icon:e.jsx(Br,{}),"aria-label":"Filters",onClick:p,variant:v?"filled":"outlined",color:"neutral",size:"small",style:Vn,"aria-pressed":v}),x&&e.jsx(Xe,{variant:"filled",color:"primary",size:"small",onClick:f,"aria-label":"Add event",children:"+ New"})]})]})};Ys.displayName="CalendarHeader";const _n=({event:t,compact:n=!1,categoryMeta:s,onClick:a})=>{const r=$t(t.category,s),i=r.variant==="icon",o=fn(t,s),c={"--cal-event-color":r.color,"--cal-event-bg":r.bg},d=["ui-calendar-event",i?"ui-calendar-event--celebration":"",t.urgent?"ui-calendar-event--urgent":""].filter(Boolean).join(" ");return e.jsxs("div",{className:d,style:c,onClick:u=>{u.stopPropagation(),a(t)},role:"button",tabIndex:0,onKeyDown:u=>{(u.key==="Enter"||u.key===" ")&&(u.preventDefault(),a(t))},title:o,children:[i?e.jsx("span",{className:"ui-calendar-event__icon",children:r.icon}):e.jsx("span",{className:"ui-calendar-event__bar"}),e.jsxs("div",{className:"ui-calendar-event__content",children:[e.jsx("div",{className:"ui-calendar-event__name",children:o}),!n&&t.time&&e.jsxs("div",{className:"ui-calendar-event__meta",children:[t.time,t.duration?` · ${t.duration}m`:""]})]})]})};_n.displayName="CalendarEventCard";const Yn=({event:t,categoryMeta:n,continuesLeft:s,continuesRight:a,onClick:r})=>{const i=$t(t.category,n),o=fn(t,n),c={"--cal-event-color":i.color,"--cal-event-bg":i.bg},d=["ui-calendar-range",s?"ui-calendar-range--continues-left":"",a?"ui-calendar-range--continues-right":"",t.urgent?"ui-calendar-range--urgent":""].filter(Boolean).join(" ");return e.jsxs("div",{className:d,style:c,onClick:u=>{u.stopPropagation(),r(t)},role:"button",tabIndex:0,onKeyDown:u=>{(u.key==="Enter"||u.key===" ")&&(u.preventDefault(),r(t))},title:o,children:[s&&e.jsx("span",{className:"ui-calendar-range__chevron ui-calendar-range__chevron--left","aria-hidden":!0,children:"‹"}),e.jsx("span",{className:"ui-calendar-range__title",children:o}),a&&e.jsx("span",{className:"ui-calendar-range__chevron ui-calendar-range__chevron--right","aria-hidden":!0,children:"›"})]})};Yn.displayName="CalendarRangeBar";function Ws(t,n){if(n.length!==7)return{bars:[],laneCount:0};const s=Tt(n[0]),a=Tt(n[6]),i=t.filter(d=>_t(d)?d.date<=a&&d.endDate>=s:!1).slice().sort((d,u)=>{if(d.date!==u.date)return d.date<u.date?-1:1;const p=Us(d.date,d.endDate),f=Us(u.date,u.endDate);return p!==f?f-p:d.id<u.id?-1:d.id>u.id?1:0}),o=[],c=[];for(const d of i){const u=d.date<s?0:Ks(d.date,n),p=d.endDate>a?6:Ks(d.endDate,n);if(u<0||p<0||p<u)continue;let f=o.findIndex(h=>h.every(m=>m.endCol<u));f===-1&&(f=o.length,o.push([])),o[f].push({endCol:p}),c.push({event:d,startCol:u,endCol:p,lane:f,continuesLeft:d.date<s,continuesRight:d.endDate>a})}return{bars:c,laneCount:o.length}}function Ks(t,n){for(let s=0;s<n.length;s++)if(Tt(n[s])===t)return s;return-1}function Us(t,n){const[s,a,r]=t.split("-").map(Number),[i,o,c]=n.split("-").map(Number),d=new Date(s,a-1,r).getTime(),u=new Date(i,o-1,c).getTime();return Math.round((u-d)/864e5)+1}const wl=3,ka=3,qs=({events:t,year:n,month:s,today:a,categoryMeta:r,renderEvent:i,onEventClick:o,onDayClick:c})=>{const d=Nl(n,s),u=l.useMemo(()=>{const p={};for(const f of t)_t(f)||(p[f.date]||(p[f.date]=[]),p[f.date].push(f));return p},[t]);return e.jsxs("div",{className:"ui-calendar-month",children:[e.jsx("div",{className:"ui-calendar-month__weekdays",children:Os.map(p=>e.jsx("div",{className:"ui-calendar-month__weekday",children:p},p))}),e.jsx("div",{className:"ui-calendar-month__grid",children:d.map((p,f)=>{const{bars:h,laneCount:m}=Ws(t,p.map(T=>T.date)),x=h.filter(T=>T.lane<ka),v=h.filter(T=>T.lane>=ka),g=Math.min(m,ka),y=g*Gs,S=Math.max(1,wl-g),k=Array(7).fill(0);for(const T of v)for(let $=T.startCol;$<=T.endCol;$++)k[$]+=1;return e.jsxs("div",{className:"ui-calendar-month__row",children:[p.map((T,$)=>{const H=Tt(T.date),Z=H===a,te=T.date.getDay()===0||T.date.getDay()===6,D=u[H]??[],B=k[$],F=D.length>S||B>0?Math.max(0,S-1):S,Ne=D.slice(0,F),ue=D.length-Ne.length+B,J=["ui-calendar-month__cell",T.outside?"ui-calendar-month__cell--outside":"",Z?"ui-calendar-month__cell--today":"",te?"ui-calendar-month__cell--weekend":""].filter(Boolean).join(" ");return e.jsxs("div",{className:J,onClick:()=>c(H),children:[e.jsx("div",{className:"ui-calendar-month__date",children:T.date.getDate()}),e.jsx("div",{className:"ui-calendar-month__events",style:y?{marginTop:y+4}:void 0,children:Ne.map(re=>e.jsx(l.Fragment,{children:i?i(re,!0):e.jsx(_n,{event:re,compact:!0,categoryMeta:r,onClick:o})},re.id))}),ue>0&&e.jsxs("button",{type:"button",className:"ui-calendar-month__more",onClick:re=>{re.stopPropagation(),c(H)},children:["+",ue]})]},H)}),x.length>0&&e.jsx("div",{className:"ui-calendar-month__ranges",style:{height:y},children:x.map(T=>{const $=T.startCol/7*100,H=(T.endCol-T.startCol+1)/7*100;return e.jsx("div",{className:"ui-calendar-month__range-slot",style:{left:`${$}%`,width:`${H}%`,top:T.lane*Gs},children:e.jsx(Yn,{event:T.event,categoryMeta:r,continuesLeft:T.continuesLeft,continuesRight:T.continuesRight,onClick:o})},T.event.id)})})]},f)})})]})};qs.displayName="MonthView";const Gs=20;function Nl(t,n){const s=new Date(t,n,1),a=s.getDay(),r=a===0?6:a-1,i=new Date(s);i.setDate(1-r);const o=[];for(let c=0;c<6;c++){const d=[];for(let u=0;u<7;u++){const p=new Date(i);p.setDate(i.getDate()+c*7+u),d.push({date:p,outside:p.getMonth()!==n})}o.push(d)}return o}const Xs=22,Zs=({events:t,weekStart:n,today:s,categoryMeta:a,renderEvent:r,onEventClick:i,onDayClick:o})=>{const c=Cl(n),d=l.useMemo(()=>{const f={};for(const h of t)_t(h)||(f[h.date]||(f[h.date]=[]),f[h.date].push(h));return f},[t]),{bars:u,laneCount:p}=l.useMemo(()=>Ws(t,c),[t,c]);return e.jsxs("div",{className:"ui-calendar-week",children:[e.jsx("div",{className:"ui-calendar-week__header",children:c.map((f,h)=>{const m=Tt(f)===s,x=f.getDay()===0||f.getDay()===6,v=["ui-calendar-week__day-header",m?"ui-calendar-week__day-header--today":"",x?"ui-calendar-week__day-header--weekend":""].filter(Boolean).join(" ");return e.jsxs("div",{className:v,children:[e.jsx("div",{className:"ui-calendar-week__day-name",children:Os[h]}),e.jsx("div",{className:"ui-calendar-week__day-num",children:f.getDate()})]},h)})}),u.length>0&&e.jsx("div",{className:"ui-calendar-week__allday",style:{height:p*Xs+8},children:u.map(f=>{const h=f.startCol/7*100,m=(f.endCol-f.startCol+1)/7*100;return e.jsx("div",{className:"ui-calendar-week__range-slot",style:{left:`calc(${h}% + 4px)`,width:`calc(${m}% - 8px)`,top:4+f.lane*Xs},children:e.jsx(Yn,{event:f.event,categoryMeta:a,continuesLeft:f.continuesLeft,continuesRight:f.continuesRight,onClick:i})},f.event.id)})}),e.jsx("div",{className:"ui-calendar-week__columns",children:c.map((f,h)=>{const m=Tt(f),x=f.getDay()===0||f.getDay()===6,v=d[m]??[],g=["ui-calendar-week__col",x?"ui-calendar-week__col--weekend":""].filter(Boolean).join(" ");return e.jsx("div",{className:g,onClick:()=>o(m),children:v.map(y=>e.jsx(l.Fragment,{children:r?r(y,!1):e.jsx(_n,{event:y,categoryMeta:a,onClick:i})},y.id))},h)})})]})};Zs.displayName="WeekView";function Cl(t){return Array.from({length:7},(n,s)=>{const a=new Date(t);return a.setDate(t.getDate()+s),a})}const wa=7,Js=Array.from({length:21-wa},(t,n)=>wa+n),Ml=60,Qs=({events:t,date:n,categoryMeta:s,renderEvent:a,onEventClick:r})=>{const i=t.filter(p=>_t(p)&&Hs(p,n)),o=t.filter(p=>!_t(p)&&p.date===n),c=o.filter(p=>p.time),d=o.filter(p=>!p.time),u=i.length>0||d.length>0;return e.jsxs("div",{className:"ui-calendar-day",children:[u&&e.jsxs("div",{className:"ui-calendar-day__allday",children:[e.jsx("span",{className:"ui-calendar-day__allday-label",children:"All day"}),i.map(p=>e.jsx("div",{className:"ui-calendar-day__range-slot",children:e.jsx(Yn,{event:p,categoryMeta:s,continuesLeft:p.date<n,continuesRight:p.endDate>n,onClick:r})},p.id)),d.map(p=>e.jsx(l.Fragment,{children:a?a(p,!0):e.jsx(_n,{event:p,compact:!0,categoryMeta:s,onClick:r})},p.id))]}),e.jsxs("div",{className:"ui-calendar-day__time-grid",children:[e.jsx("div",{className:"ui-calendar-day__hours",children:Js.map(p=>e.jsxs("div",{className:"ui-calendar-day__hour-label",children:[String(p).padStart(2,"0"),":00"]},p))}),e.jsxs("div",{className:"ui-calendar-day__slots",style:{position:"relative"},children:[Js.map(p=>e.jsx("div",{className:"ui-calendar-day__slot"},p)),e.jsx("div",{className:"ui-calendar-day__events",children:c.map(p=>{const{top:f,height:h}=Sl(p,wa,Ml),m=$t(p.category,s);return e.jsx("div",{className:"ui-calendar-day__timed-event",style:{top:f,minHeight:Math.max(h,32),"--cal-event-color":m.color,"--cal-event-bg":m.bg},onClick:()=>r(p),children:a?a(p,!1):e.jsx(_n,{event:p,categoryMeta:s,onClick:r})},p.id)})})]})]})]})};Qs.displayName="DayView";function Sl(t,n,s){const[a,r]=(t.time??"08:00").split(":").map(Number),o=((a-n)*60+r)/60*s,d=(t.duration??60)/60*s;return{top:o,height:d}}function Dl(t,n){const[s,a,r]=t.split("-").map(Number),o=new Date(s,a-1,r).toLocaleDateString("en-US",{weekday:"short",month:"short",day:"numeric"});return n?`${o} at ${n}`:o}function El(t,n){const[s,a,r]=t.split("-").map(Number),[i,o,c]=n.split("-").map(Number),d=new Date(s,a-1,r),u=new Date(i,o-1,c),p=s===i,f=d.toLocaleDateString("en-US",{month:"short",day:"numeric",year:p?void 0:"numeric"}),h=u.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"});return`${f} – ${h}`}function $l(t,n){const s=_t(t),a=_t(n);if(s!==a)return s?-1:1;if(s&&a)return t.date!==n.date?t.date<n.date?-1:1:t.endDate!==n.endDate?t.endDate>n.endDate?-1:1:t.id<n.id?-1:t.id>n.id?1:0;const r=(t.time??"").localeCompare(n.time??"");return r!==0?r:t.id<n.id?-1:t.id>n.id?1:0}function Tl(t,n){const[s,a,r]=t.split("-").map(Number),[i,o,c]=n.split("-").map(Number),d=new Date(s,a-1,r).getTime(),u=new Date(i,o-1,c).getTime();return Math.round((u-d)/864e5)+1}function Ll(t){const[n,s,a]=t.split("-").map(Number);return`${new Date(n,s-1,a).toLocaleDateString("en-US",{weekday:"long"})}, ${qt[s-1]} ${a}`}const Rs=({event:t,dayDate:n,dayEvents:s,isOpen:a,categoryMeta:r,renderSidebarDetail:i,renderSidebarItem:o,onClose:c,onBack:d,onEventClick:u,onEdit:p,onDelete:f})=>{const h=`ui-calendar__sidebar${a?" ui-calendar__sidebar--open":""}`,m=()=>t?e.jsx(Il,{event:t,categoryMeta:r,renderSidebarDetail:i,onClose:c,onBack:d,onEdit:p,onDelete:f}):n?e.jsx(Al,{dayDate:n,events:s,categoryMeta:r,renderSidebarItem:o,onClose:c,onEventClick:u}):e.jsxs("div",{className:"ui-calendar__sidebar-body",style:{alignItems:"center",justifyContent:"center",color:"var(--cal-text2)"},children:[e.jsx("span",{style:{fontSize:32},children:"📋"}),e.jsx("span",{style:{fontSize:13},children:"Select an event to see details"})]});return e.jsx("aside",{className:h,"aria-label":"Event details",children:e.jsx("div",{className:"ui-calendar__sidebar-inner",children:m()})})};Rs.displayName="CalendarSidebar";const Al=({dayDate:t,events:n,categoryMeta:s,renderSidebarItem:a,onClose:r,onEventClick:i})=>e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"ui-calendar__sidebar-header",children:[e.jsxs("div",{className:"ui-calendar__sidebar-meta",style:{flex:1},children:[e.jsx("div",{className:"ui-calendar__sidebar-title",children:Ll(t)}),e.jsx("div",{className:"ui-calendar__sidebar-subtitle",style:{color:"var(--cal-text2)"},children:n.length===0?"No events":`${n.length} event${n.length>1?"s":""}`})]}),e.jsx(Ie,{icon:e.jsx(jt,{}),"aria-label":"Close sidebar",onClick:r,variant:"ghost",color:"neutral",size:"small",style:{borderRadius:"var(--radius-sm)"}})]}),e.jsx("div",{className:"ui-calendar__sidebar-body",children:n.length===0?e.jsxs("div",{className:"ui-calendar__sidebar-empty",children:[e.jsx("span",{style:{fontSize:28},children:"📅"}),e.jsx("span",{children:"No events this day"})]}):e.jsx("div",{className:"ui-calendar__sidebar-day-list",children:n.slice().sort($l).map(o=>{const c=$t(o.category,s);return e.jsx("button",{className:"ui-calendar__sidebar-day-item",style:{"--cal-event-color":c.color,"--cal-event-bg":c.bg},onClick:()=>i(o),children:a?a(o):e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"ui-calendar__sidebar-day-item-bar"}),e.jsxs("div",{className:"ui-calendar__sidebar-day-item-body",children:[e.jsx("span",{className:"ui-calendar__sidebar-day-item-title",children:fn(o,s)}),e.jsxs("span",{className:"ui-calendar__sidebar-day-item-meta",children:[e.jsx("span",{style:{color:c.color},children:c.label}),o.time&&e.jsxs("span",{children:[" · ",o.time,o.duration?` (${o.duration} min)`:""]})]})]}),e.jsx("span",{className:"ui-calendar__sidebar-day-item-arrow",children:"›"})]})},o.id)})})})]}),Il=({event:t,categoryMeta:n,renderSidebarDetail:s,onClose:a,onBack:r,onEdit:i,onDelete:o})=>{const c=$t(t.category,n),d=c.variant==="icon",u=fn(t,n),p=c.icon??c.label[0]?.toUpperCase()??"?";return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"ui-calendar__sidebar-header",children:[e.jsx("div",{className:"ui-calendar__sidebar-avatar",style:d?{background:c.bg,fontSize:20}:{background:c.bg,color:c.color},children:p}),e.jsxs("div",{className:"ui-calendar__sidebar-meta",children:[e.jsx("div",{className:"ui-calendar__sidebar-title",title:u,children:u}),e.jsx("div",{className:"ui-calendar__sidebar-subtitle",children:e.jsx("span",{style:{color:c.color},children:c.label})})]}),e.jsxs("div",{style:{display:"flex",gap:2},children:[r&&e.jsx(Ie,{icon:e.jsx(Or,{}),"aria-label":"Back to day list",title:"Back to events",onClick:r,variant:"ghost",color:"neutral",size:"small",style:{borderRadius:"var(--radius-sm)"}}),e.jsx(Ie,{icon:e.jsx(jt,{}),"aria-label":"Close sidebar",onClick:a,variant:"ghost",color:"neutral",size:"small",style:{borderRadius:"var(--radius-sm)"}})]})]}),e.jsx("div",{className:"ui-calendar__sidebar-body",children:s?s(t):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"ui-calendar__sidebar-section",children:[e.jsx("div",{className:"ui-calendar__sidebar-section-title",children:"When & Where"}),_t(t)?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"ui-calendar__sidebar-row",children:[e.jsx("span",{className:"ui-calendar__sidebar-row-label",children:"Dates"}),e.jsx("span",{className:"ui-calendar__sidebar-row-value",children:El(t.date,t.endDate)})]}),e.jsxs("div",{className:"ui-calendar__sidebar-row",children:[e.jsx("span",{className:"ui-calendar__sidebar-row-label",children:"Length"}),e.jsxs("span",{className:"ui-calendar__sidebar-row-value",children:[Tl(t.date,t.endDate)," days"]})]})]}):e.jsxs("div",{className:"ui-calendar__sidebar-row",children:[e.jsx("span",{className:"ui-calendar__sidebar-row-label",children:"Date"}),e.jsx("span",{className:"ui-calendar__sidebar-row-value",children:Dl(t.date,t.time)})]}),!_t(t)&&t.duration&&e.jsxs("div",{className:"ui-calendar__sidebar-row",children:[e.jsx("span",{className:"ui-calendar__sidebar-row-label",children:"Duration"}),e.jsxs("span",{className:"ui-calendar__sidebar-row-value",children:[t.duration," min"]})]}),t.platform&&e.jsxs("div",{className:"ui-calendar__sidebar-row",children:[e.jsx("span",{className:"ui-calendar__sidebar-row-label",children:"Platform"}),e.jsx("span",{className:"ui-calendar__sidebar-row-value",children:t.platform})]}),t.meetLink&&e.jsx("a",{className:"ui-calendar__sidebar-link",href:t.meetLink,target:"_blank",rel:"noopener noreferrer",children:"🔗 Join meeting"})]}),t.notes&&e.jsxs("div",{className:"ui-calendar__sidebar-section",children:[e.jsx("div",{className:"ui-calendar__sidebar-section-title",children:"Notes"}),e.jsx("div",{className:"ui-calendar__sidebar-notes",children:t.notes})]})]})}),(i||o)&&e.jsxs("div",{className:"ui-calendar__sidebar-actions",children:[o&&e.jsx(Xe,{variant:"outlined",color:"error",size:"small",style:{flex:1},onClick:()=>o(t.id),children:"Delete"}),i&&e.jsx(Xe,{variant:"filled",color:"primary",size:"small",style:{flex:1},onClick:()=>i(t),children:"Edit"})]})]})};function Pl(t,n,s){const a=n.toLowerCase(),r=t.data?Object.values(t.data).map(String):[];return[t.title,t.notes,$t(t.category,s).label,...r].some(i=>i?.toLowerCase().includes(a))}function Na(t){const[n,s,a]=t.split("-").map(Number);return new Date(n,s-1,a).toLocaleDateString("en-US",{month:"short",day:"numeric"})}function zl(t){return _t(t)?`${Na(t.date)} – ${Na(t.endDate)}`:Na(t.date)}const er=({open:t,events:n,categoryMeta:s,onClose:a,onSelect:r})=>{const[i,o]=l.useState(""),[c,d]=l.useState(0),u=l.useRef(null);l.useEffect(()=>{t&&(o(""),d(0),setTimeout(()=>u.current?.focus(),50))},[t]);const p=l.useMemo(()=>i.trim()?n.filter(h=>Pl(h,i,s)).slice(0,20):[],[i,n,s]);l.useEffect(()=>{d(0)},[p.length]);const f=h=>{h.key==="ArrowDown"&&(h.preventDefault(),d(m=>Math.min(m+1,p.length-1))),h.key==="ArrowUp"&&(h.preventDefault(),d(m=>Math.max(m-1,0))),h.key==="Enter"&&p[c]&&(r(p[c]),a())};return e.jsx(ea,{open:t,onClose:a,closeOnBackdropClick:!0,closeOnEscape:!0,showCloseButton:!1,size:"medium",style:{padding:0,overflow:"hidden",borderRadius:12},children:e.jsxs("div",{className:"ui-calendar-search",onKeyDown:f,children:[e.jsx("div",{className:"ui-calendar-search__input-wrap",children:e.jsx(Ot,{ref:u,fullWidth:!0,placeholder:"Search events…",value:i,onChange:h=>o(h.target.value),autoComplete:"off",startAdornment:e.jsx("span",{children:"⌕"}),endAdornment:e.jsx("kbd",{className:"ui-calendar-search__kbd",children:"Esc"}),sx:{root:"ui-calendar-search__textfield"}})}),e.jsxs("div",{className:"ui-calendar-search__results",children:[i.trim()&&p.length===0&&e.jsxs("div",{className:"ui-calendar-search__empty",children:['No events found for "',i,'"']}),!i.trim()&&e.jsx("div",{className:"ui-calendar-search__empty",children:"Type to search events…"}),p.map((h,m)=>{const x=$t(h.category,s),v=fn(h,s);return e.jsxs("div",{className:`ui-calendar-search__result${m===c?" ui-calendar-search__result--active":""}`,onClick:()=>{r(h),a()},onMouseEnter:()=>d(m),children:[e.jsx("div",{className:"ui-calendar-search__result-icon",style:{background:x.bg,color:x.color},children:x.icon}),e.jsxs("div",{style:{flex:1,minWidth:0},children:[e.jsx("div",{className:"ui-calendar-search__result-name",children:v}),e.jsxs("div",{className:"ui-calendar-search__result-meta",children:[x.label,h.date?` · ${h.date}`:""]})]}),e.jsx("div",{className:"ui-calendar-search__result-date",children:zl(h)})]},h.id)})]})]})})};er.displayName="CalendarSearch";function Hl(t,n){if(t==="month"){const a=n.getFullYear(),r=n.getMonth(),o=(new Date(a,r,1).getDay()+6)%7,c=new Date(a,r,1-o),d=new Date(c);return d.setDate(c.getDate()+41),{start:c,end:d}}if(t==="week"){const a=Bs(n),r=new Date(a);return r.setDate(a.getDate()+6),{start:a,end:r}}const s=new Date(n.getFullYear(),n.getMonth(),n.getDate());return{start:s,end:s}}const tr=({events:t=[],defaultView:n="month",initialDate:s,categoryMeta:a,filterSections:r,filterValues:i,onFilterValuesChange:o,renderEvent:c,renderKPI:d,renderSidebarDetail:u,renderSidebarItem:p,renderFilterPanel:f,renderFilterPanelBody:h,onAddClick:m,onEditClick:x,onEventCreate:v,onEventDelete:g,onFilterChange:y,onNavigate:S,showSearch:k=!0,showFilters:T=!0,showSidebar:$=!0,pageMode:H=!1,sx:Z,style:te})=>{const D=i!==void 0,B=Tt(new Date),ne=l.useMemo(()=>a??{},[a]),[F,Ne]=l.useState(n),[ue,J]=l.useState(s??new Date),re=ue.getFullYear(),je=ue.getMonth(),ye=Bs(ue),Q=Tt(ue),[G,b]=l.useState(null),[A,I]=l.useState(null),[W,V]=l.useState(null),[ve,w]=l.useState(!1),[R,ie]=l.useState(!1),[he,P]=l.useState(!1),le=l.useMemo(()=>r??[],[r]),[$e,Pe]=l.useState({}),pe=D?i:$e,Ce=l.useCallback(fe=>{if(D){const De=typeof fe=="function"?fe(i):fe;o?.(De)}else Pe(fe)},[D,i,o]);l.useEffect(()=>{S&&S(Hl(F,ue))},[F,ue,S]),l.useEffect(()=>{y?.(pe)},[pe,y]);const _e=l.useCallback(fe=>{J(De=>{const we=new Date(De);return F==="month"&&we.setMonth(De.getMonth()+fe),F==="week"&&we.setDate(De.getDate()+fe*7),F==="day"&&we.setDate(De.getDate()+fe),we})},[F]),ze=l.useCallback(()=>J(new Date),[]),C=l.useCallback(()=>{Ce(Object.fromEntries(le.map(fe=>fe.type==="daterange"?[fe.id,{start:null,end:null}]:fe.type==="select"&&!fe.multiple?[fe.id,null]:[fe.id,[]])))},[le,Ce]);l.useEffect(()=>{const fe=!!(m||v),De=we=>{if(!(["INPUT","TEXTAREA","SELECT"].includes(we.target?.tagName)&&we.key!=="Escape")){if((we.ctrlKey||we.metaKey)&&we.key==="k"&&k){we.preventDefault(),ie(!0);return}if(we.key==="Escape"){if(R){ie(!1);return}if(ve){w(!1),b(null),I(null);return}return}if(we.key==="]"&&$){w(oe=>!oe);return}if(we.key==="ArrowLeft"&&!R){_e(-1);return}if(we.key==="ArrowRight"&&!R){_e(1);return}we.key==="n"&&!R&&fe&&m&&m(void 0)}};return window.addEventListener("keydown",De),()=>window.removeEventListener("keydown",De)},[R,ve,_e,k,$,m,v]);const q=l.useCallback(fe=>{V(A),b(fe),I(null),$&&w(!0)},[$,A]),ae=l.useCallback(fe=>{I(fe),b(null),$&&w(!0)},[$]),j=l.useCallback(fe=>{V(null),b(fe),J(vl(fe.date)),$&&w(!0),ie(!1)},[$]),z=l.useCallback(fe=>{g?.(fe),b(null),V(null),w(!1)},[g]),U=l.useCallback(()=>{b(null),I(W),V(null)},[W]),X=l.useCallback(fe=>{x?.(fe)},[x]),ke=l.useMemo(()=>A?t.filter(fe=>Hs(fe,A)):[],[t,A]),N=!!(m||v),de=["ui-calendar",H&&"ui-calendar--page",Z].filter(Boolean).join(" ");return e.jsxs("div",{className:de,style:te,children:[e.jsx(Ys,{view:F,year:re,month:je,weekStart:ye,dayDate:Q,onViewChange:Ne,onPrev:()=>_e(-1),onNext:()=>_e(1),onToday:ze,onSearch:k?()=>ie(!0):void 0,onFilter:T?()=>P(fe=>!fe):void 0,onAdd:N?()=>{m&&m(void 0)}:void 0,showSearch:k,showFilters:T,showAdd:N,filterOpen:he}),d&&d(),e.jsxs("div",{className:"ui-calendar__body",children:[T&&(f?f({isOpen:he,onClose:()=>P(!1)}):e.jsx(Vs,{isOpen:he,onClose:()=>P(!1),sections:le,value:pe,onChange:Ce,onReset:C,renderBody:h})),e.jsx("div",{className:"ui-calendar__main",children:e.jsxs("div",{className:"ui-calendar__grid",children:[F==="month"&&e.jsx(qs,{events:t,year:re,month:je,today:B,categoryMeta:ne,renderEvent:c,onEventClick:q,onDayClick:ae}),F==="week"&&e.jsx(Zs,{events:t,weekStart:ye,today:B,categoryMeta:ne,renderEvent:c,onEventClick:q,onDayClick:ae}),F==="day"&&e.jsx(Qs,{events:t,date:Q,categoryMeta:ne,renderEvent:c,onEventClick:q})]})}),$&&e.jsx(Rs,{event:G,dayDate:A,dayEvents:ke,isOpen:ve,categoryMeta:ne,renderSidebarDetail:u,renderSidebarItem:p,onClose:()=>{w(!1),b(null),I(null),V(null)},onBack:W?U:void 0,onEventClick:q,onEdit:x?X:void 0,onDelete:g?z:void 0})]}),k&&e.jsx(er,{open:R,events:t,categoryMeta:ne,onClose:()=>ie(!1),onSelect:j})]})};tr.displayName="Calendar";const Bl={primary:"var(--palette-primary-main, #4299e1)",success:"var(--palette-success-main, #38a169)",warning:"var(--palette-warning-main, #f97316)",error:"var(--palette-error-main, #d32f2f)",info:"var(--palette-info-main, #0ea5e9)"};function Ol(t){if(t)return Bl[t]??t}const nr=({metrics:t})=>t.length===0?null:e.jsx("div",{className:"ui-calendar__kpi",role:"list","aria-label":"KPI metrics",children:t.map((n,s)=>{const a=Ol(n.color);return e.jsxs("div",{className:`ui-calendar__kpi-item${n.onClick?" ui-calendar__kpi-item--clickable":""}`,onClick:n.onClick,role:n.onClick?"button":"listitem",tabIndex:n.onClick?0:void 0,onKeyDown:n.onClick?r=>{r.key==="Enter"&&n.onClick()}:void 0,children:[a&&e.jsx("span",{className:"ui-calendar__kpi-dot",style:{background:a}}),e.jsx("span",{className:"ui-calendar__kpi-value",children:n.value}),e.jsx("span",{className:"ui-calendar__kpi-label",children:n.label})]},s)})});nr.displayName="CalendarKPIStrip";const Fl={palette:["--palette-primary-main","--palette-primary-light","--palette-primary-dark","--palette-primary-contrast-text","--palette-secondary-main","--palette-secondary-light","--palette-secondary-dark","--palette-secondary-contrast-text","--palette-success-main","--palette-success-light","--palette-success-dark","--palette-success-contrast-text","--palette-tertiary-main","--palette-tertiary-light","--palette-tertiary-dark","--palette-tertiary-contrast-text","--palette-warning-main","--palette-warning-light","--palette-warning-dark","--palette-warning-contrast-text","--palette-error-main","--palette-error-light","--palette-error-dark","--palette-error-contrast-text","--palette-info-main","--palette-info-light","--palette-info-dark","--palette-info-contrast-text","--palette-common-white","--palette-common-black","--palette-background-default","--palette-background-paper","--palette-text-primary","--palette-text-secondary","--palette-divider","--palette-action-hover","--palette-action-selected","--palette-action-disabled","--palette-action-disabledBackground","--palette-overlay-subtle","--palette-overlay-subtle-hover","--palette-badge-bg","--palette-primary-shadow","--palette-primary-shadow-strong","--palette-primary-overlay","--palette-primary-border","--palette-overlay-on-dark"],department:["--department-all-default","--department-all-hover","--department-all-active","--department-design-default","--department-design-hover","--department-design-active","--department-development-default","--department-development-hover","--department-development-active","--department-management-default","--department-management-hover","--department-management-active","--department-marketing-default","--department-marketing-hover","--department-marketing-active","--department-video-default","--department-video-hover","--department-video-active"],layout:["--layout-columns","--layout-gutter","--layout-max-width"],spacing:["--space-xs","--space-sm","--space-md","--space-lg","--space-xl","--space-2xl","--space-3xl"],fluidSpacing:["--space-fluid-xs","--space-fluid-sm","--space-fluid-md","--space-fluid-lg","--space-fluid-xl","--space-fluid-2xl","--space-fluid-3xl"],breakpoint:["--breakpoint-mobile-min","--breakpoint-mobile-max","--breakpoint-tablet-min","--breakpoint-tablet-max","--breakpoint-desktop-min","--breakpoint-desktop-max","--breakpoint-large-desktop-min","--breakpoint-large-desktop-max","--breakpoint-extra-large-min"],typography:["--font-family-base","--font-weight-regular","--font-weight-medium","--font-weight-semibold","--h1-font-size","--h1-font-line-height","--h2-font-size","--h2-font-line-height","--h3-font-size","--h3-font-line-height","--h4-font-size","--h4-font-line-height","--h5-font-size","--h5-font-line-height","--body-regular-font-size","--body-regular-font-line-height","--body-medium-font-size","--body-medium-font-line-height","--body-small-font-size","--body-small-font-line-height","--caption-font-size","--caption-font-line-height"],zIndex:["--z-index-dropdown","--z-index-sticky","--z-index-fixed","--z-index-backdrop","--z-index-modal","--z-index-popover","--z-index-tooltip"],motion:["--motion-fast","--motion-normal","--motion-slow","--motion-easing"],shadow:["--shadow-light","--shadow-card","--shadow-card-elevated","--shadow-card-hover","--shadow-medium","--shadow-heavy","--shadow-avatar","--shadow-badge","--shadow-primary-glow","--shadow-primary-glow-strong"],radius:["--radius-xs","--radius-sm","--radius-md","--radius-lg","--radius-xl","--radius-2xl","--radius-3xl","--radius-full"],gradient:["--gradient-primary-start","--gradient-primary-end","--gradient-primary-horizontal","--gradient-primary-vertical","--gradient-primary-diagonal","--gradient-primary-radial","--gradient-secondary-start","--gradient-secondary-end","--gradient-secondary-horizontal","--gradient-secondary-vertical","--gradient-secondary-diagonal","--gradient-secondary-radial","--gradient-success-horizontal","--gradient-success-diagonal","--gradient-tertiary-horizontal","--gradient-tertiary-diagonal","--gradient-warning-horizontal","--gradient-error-horizontal","--gradient-info-horizontal","--gradient-primary-secondary-horizontal","--gradient-primary-secondary-diagonal","--gradient-primary-tertiary-horizontal","--gradient-primary-success-horizontal","--gradient-success-tertiary-horizontal"],component:["--button-padding-x","--button-padding-y","--button-border-width","--button-border-radius","--textfield-border-color","--textfield-border-radius","--textfield-padding-x","--textfield-padding-y"]};ee.Accordion=us,ee.AccordionContent=pa,ee.AccordionItem=ua,ee.AccordionRoot=da,ee.AccordionTrigger=ha,ee.Autocomplete=Jn,ee.Avatar=Kt,ee.AvatarGroup=xa,ee.Badge=Dt,ee.Button=Xe,ee.Calendar=tr,ee.CalendarKPIStrip=nr,ee.Checkbox=ca,ee.Chip=mt,ee.ConfirmDialog=fa,ee.ConfirmProvider=xs,ee.CourseCard=Zi,ee.DatePicker=ia,ee.Drawer=Ja,ee.Dropdown=Zn,ee.DropdownItem=Xn,ee.EmployeeCard=$s,ee.FilterPanel=ii,ee.Header=Ts,ee.IconButton=Ie,ee.Layout=As,ee.LessonCard=rl,ee.Logo=ba,ee.Modal=ea,ee.Pagination=Ms,ee.Portal=cn,ee.Select=$n,ee.Sidebar=ja,ee.Spinner=Cs,ee.TOKEN_CATEGORIES=Fl,ee.Tab=ga,ee.TabList=ys,ee.TabPanel=ks,ee.Table=_s,ee.Tabs=js,ee.Tags=Va,ee.TaskCard=zs,ee.TextField=Ot,ee.TimePicker=is,ee.Toast=va,ee.ToastProvider=Ns,ee.Toggle=vs,ee.Tooltip=Ze,ee.VideoCard=_r,ee.getGradientClassName=Un,ee.getGradientStyle=Gn,ee.isCustomGradient=Kn,ee.useConfirm=Mi,ee.useEscapeKey=At,ee.useFloatingPosition=Pa,ee.useFocusTrap=Rn,ee.useLockScroll=zn,ee.usePortal=Dn,ee.useTheme=Qr,ee.useToast=$i,Object.defineProperty(ee,Symbol.toStringTag,{value:"Module"})}));
7
7
  //# sourceMappingURL=ui-kit.umd.js.map