dhx-react-suite 1.1.6 → 1.1.8

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,4 +1,4 @@
1
- (function(H,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("react/jsx-runtime"),require("react"),require("recharts")):typeof define=="function"&&define.amd?define(["exports","react/jsx-runtime","react","recharts"],e):(H=typeof globalThis<"u"?globalThis:H||self,e(H.DhxReactSuite={},H.ReactJSXRuntime,H.React,H.Recharts))})(this,function(H,e,u,V){"use strict";const t={primary:"#0288d1",primaryDk:"#01579b",primaryLt:"#e1f5fe",success:"#43a047",danger:"#e53935",warning:"#fb8c00",bg:"#f5f7fa",surface:"#ffffff",border:"#dde3ea",borderDk:"#b0bec5",text:"#3d4a5c",textSec:"#6b7a8d",textMut:"#9aa5b1",shadow:"0 2px 8px rgba(0,0,0,.10)",shadowLg:"0 8px 28px rgba(0,0,0,.14)",r:"4px",rMd:"8px",font:"'Segoe UI', system-ui, -apple-system, sans-serif"},we="dhx-react-styles";function X(){if(typeof document>"u"||document.getElementById(we))return;const r=document.createElement("style");r.id=we,r.textContent=`
1
+ (function(j,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("react/jsx-runtime"),require("react"),require("recharts")):typeof define=="function"&&define.amd?define(["exports","react/jsx-runtime","react","recharts"],e):(j=typeof globalThis<"u"?globalThis:j||self,e(j.DhxReactSuite={},j.ReactJSXRuntime,j.React,j.Recharts))})(this,function(j,e,g,X){"use strict";const t={primary:"#0288d1",primaryDk:"#01579b",primaryLt:"#e1f5fe",success:"#43a047",danger:"#e53935",warning:"#fb8c00",bg:"#f5f7fa",surface:"#ffffff",border:"#dde3ea",borderDk:"#b0bec5",text:"#3d4a5c",textSec:"#6b7a8d",textMut:"#9aa5b1",shadow:"0 2px 8px rgba(0,0,0,.10)",shadowLg:"0 8px 28px rgba(0,0,0,.14)",r:"4px",rMd:"8px",font:"'Segoe UI', system-ui, -apple-system, sans-serif"},De="dhx-react-styles";function q(){if(typeof document>"u"||document.getElementById(De))return;const r=document.createElement("style");r.id=De,r.textContent=`
2
2
  *,*::before,*::after{box-sizing:border-box}
3
3
  .dhx{font-family:${t.font};font-size:14px;color:${t.text}}
4
4
  .dhx *{box-sizing:border-box}
@@ -38,5 +38,5 @@
38
38
  .dhx-tag-success{background:#e8f5e9;color:#1b5e20}
39
39
  .dhx-tag-danger{background:#ffebee;color:#b71c1c}
40
40
  .dhx-tag-warning{background:#fff3e0;color:#e65100}
41
- `,document.head.appendChild(r)}const Ne={sm:{height:24,padding:"0 8px",fontSize:12},md:{},lg:{height:38,padding:"0 18px",fontSize:14}};function We({children:r,variant:s="primary",size:p="md",icon:i,disabled:x,onClick:a,style:f,className:d=""}){return u.useEffect(X,[]),e.jsxs("button",{className:`dhx dhx-btn dhx-btn-${s} ${d}`,style:{...Ne[p],...f},disabled:x,onClick:a,children:[i&&e.jsx("span",{style:{fontSize:16},children:i}),r]})}function re(r,s){u.useEffect(()=>{const p=i=>{r.current&&!r.current.contains(i.target)&&s(i)};return document.addEventListener("mousedown",p),()=>document.removeEventListener("mousedown",p)},[r,s])}function me(r){const s=u.useRef(!1),p=u.useRef({x:0,y:0,ox:0,oy:0});return u.useCallback((i,x=0,a=0)=>{s.current=!0,p.current={x:i.clientX,y:i.clientY,ox:x,oy:a};const f=y=>{if(!s.current)return;const{x:m,y:n,ox:l,oy:c}=p.current;r(l+y.clientX-m,c+y.clientY-n)},d=()=>{s.current=!1,document.removeEventListener("mousemove",f),document.removeEventListener("mouseup",d)};document.addEventListener("mousemove",f),document.addEventListener("mouseup",d),i.preventDefault()},[r])}function ie({items:r,onSelect:s,style:p}){const[i,x]=u.useState(null);return e.jsx("div",{className:"dhx dhx-anim-fade",style:{position:"absolute",top:"calc(100% + 4px)",left:0,minWidth:180,background:t.surface,border:`1px solid ${t.border}`,borderRadius:t.r,boxShadow:t.shadowLg,zIndex:200,padding:"4px 0",...p},children:r.map((a,f)=>{var y,m;if(a.type==="separator")return e.jsx("div",{style:{height:1,background:t.border,margin:"4px 0"}},f);const d=i===f;return e.jsxs("div",{style:{position:"relative"},onMouseEnter:()=>x(f),onMouseLeave:()=>x(null),children:[e.jsxs("div",{onClick:()=>{var n;return!a.disabled&&!((n=a.items)!=null&&n.length)&&s(a)},style:{display:"flex",alignItems:"center",gap:8,padding:"8px 14px",cursor:a.disabled?"not-allowed":"pointer",fontSize:13,color:a.disabled?t.textMut:t.text,background:d&&!a.disabled?t.bg:"transparent",opacity:a.disabled?.5:1},children:[a.icon&&e.jsx("span",{style:{fontSize:15,width:18,textAlign:"center"},children:a.icon}),e.jsx("span",{style:{flex:1},children:a.value||a.id}),a.hotkey&&e.jsx("span",{style:{fontSize:11,color:t.textMut},children:a.hotkey}),(y=a.items)!=null&&y.length?e.jsx("span",{style:{fontSize:10,color:t.textMut},children:"▶"}):null]}),d&&((m=a.items)!=null&&m.length)?e.jsx(ie,{items:a.items,onSelect:s,style:{position:"absolute",left:"100%",top:-4}}):null]},a.id||f)})})}function Ae({items:r=[],label:s="Menu",onSelect:p,style:i}){const[x,a]=u.useState(!1),f=u.useRef(null);return u.useEffect(X,[]),re(f,u.useCallback(()=>a(!1),[])),e.jsxs("div",{ref:f,className:"dhx",style:{position:"relative",display:"inline-block",...i},children:[e.jsxs("button",{className:"dhx dhx-btn dhx-btn-secondary",onClick:()=>a(d=>!d),children:[s," ",e.jsx("span",{style:{fontSize:10},children:x?"▲":"▼"})]}),x&&e.jsx(ie,{items:r,onSelect:d=>{p==null||p(d),a(!1)}})]})}function Be({items:r=[],onSelect:s,children:p}){const[i,x]=u.useState(null),a=u.useRef(null);u.useEffect(X,[]),re(a,u.useCallback(()=>x(null),[]));const f=d=>{d.preventDefault(),x({x:d.clientX,y:d.clientY})};return e.jsxs("div",{ref:a,onContextMenu:f,style:{position:"relative",display:"contents"},children:[p,i&&e.jsx("div",{style:{position:"fixed",left:i.x,top:i.y,zIndex:9999},children:e.jsx(ie,{items:r,onSelect:d=>{s==null||s(d),x(null)}})})]})}function Me({count:r}){return e.jsx("span",{style:{position:"absolute",top:2,right:2,minWidth:16,height:16,background:t.danger,color:"#fff",borderRadius:8,fontSize:10,fontWeight:700,display:"flex",alignItems:"center",justifyContent:"center",padding:"0 3px",lineHeight:1,pointerEvents:"none"},children:r})}function He({items:r=[],onAction:s,style:p}){const[i,x]=u.useState(null),[a,f]=u.useState(()=>{const n={};return r.forEach(l=>{l.id&&(l.twoState||l.group)&&l.active&&(n[l.id]=!0)}),n}),d=u.useRef(null);u.useEffect(X,[]),re(d,u.useCallback(()=>x(null),[]));const y=(n,l)=>{var c,b;if(!n.disabled){if(n.twoState&&n.id&&f(w=>({...w,[n.id]:!w[n.id]})),n.group&&n.id&&f(w=>{const o={...w};return r.forEach(g=>{g.group===n.group&&g.id&&(o[g.id]=!1)}),o[n.id]=!0,o}),(c=n.items)!=null&&c.length){x(w=>w===l?null:l);return}(b=n.onClick)==null||b.call(n,n.id||""),s==null||s(n.id||"")}},m=(n,l)=>{var o,g;if(n.hidden)return null;if(n.type==="separator")return e.jsx("div",{style:{width:1,background:t.border,margin:"6px 4px",alignSelf:"stretch"}},l);if(n.type==="spacer")return e.jsx("div",{style:{flex:1}},l);if(n.type==="input")return e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6},children:[n.label&&e.jsx("span",{style:{fontSize:12,color:t.textSec,fontWeight:500},children:n.label}),e.jsxs("div",{style:{position:"relative",display:"flex",alignItems:"center"},children:[n.icon&&e.jsx("span",{style:{position:"absolute",left:8,color:t.textMut,fontSize:15,pointerEvents:"none",zIndex:1},children:n.icon}),e.jsx("input",{className:"dhx dhx-input",style:{width:n.width||140,height:28,paddingLeft:n.icon?30:void 0},placeholder:n.placeholder,defaultValue:n.value,onChange:k=>{var $;return($=n.onChange)==null?void 0:$.call(n,k.target.value)}})]})]},l);if(n.type==="select")return e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6},children:[n.label&&e.jsx("span",{style:{fontSize:12,color:t.textSec,fontWeight:500},children:n.label}),e.jsx("select",{className:"dhx dhx-input",style:{width:n.width||100,height:28,cursor:"pointer"},defaultValue:n.value,onChange:k=>{var $;return($=n.onChange)==null?void 0:$.call(n,k.target.value)},children:(o=n.options)==null?void 0:o.map(k=>e.jsx("option",{value:k.value,children:k.label},k.value))})]},l);if(n.type==="imageButton")return e.jsxs("button",{title:n.tooltip,disabled:n.disabled,style:{position:"relative",width:32,height:32,padding:2,border:"none",borderRadius:"50%",overflow:"hidden",cursor:n.disabled?"not-allowed":"pointer",background:"transparent",flexShrink:0},onClick:()=>y(n,l),children:[n.src&&e.jsx("img",{src:n.src,alt:n.value||"",style:{width:"100%",height:"100%",objectFit:"cover",borderRadius:"50%"}}),n.count!==void 0&&e.jsx(Me,{count:n.count})]},l);const c=!!(n.id&&a[n.id]),b=n.value??n.text,w=!!((g=n.items)!=null&&g.length);return e.jsxs("div",{style:{position:"relative"},children:[e.jsxs("button",{className:"dhx dhx-btn dhx-btn-ghost",title:n.tooltip,disabled:n.disabled,style:{height:32,gap:4,position:"relative",background:c?t.primaryLt:"transparent",color:c?t.primary:n.disabled?t.textMut:t.text,opacity:n.disabled?.55:1,cursor:n.disabled?"not-allowed":"pointer"},onClick:()=>y(n,l),children:[n.icon&&e.jsx("span",{style:{fontSize:16},children:n.icon}),b&&e.jsx("span",{style:{fontSize:13},children:b}),w&&e.jsx("span",{style:{fontSize:9,opacity:.55,marginLeft:2},children:"▼"}),n.count!==void 0&&e.jsx(Me,{count:n.count})]}),w&&i===l&&e.jsx(ie,{items:n.items,onSelect:()=>x(null),style:{top:"100%",left:0}})]},l)};return e.jsx("div",{ref:d,className:"dhx",style:{display:"flex",alignItems:"center",gap:2,padding:"4px 8px",background:t.surface,borderBottom:`1px solid ${t.border}`,minHeight:44,flexWrap:"wrap",...p},children:r.map(m)})}function Pe({items:r=[],width:s=240,collapsed:p,onSelect:i,header:x,footer:a,style:f}){const[d,y]=u.useState(p??!1),[m,n]=u.useState(null),[l,c]=u.useState({});u.useEffect(X,[]);const b=d?56:s,w=g=>{n(g.id),i==null||i(g)},o=(g,k=0)=>{var z;if(g.type==="separator")return e.jsx("div",{style:{height:1,background:t.border,margin:"6px 8px"}},g.id);if(g.type==="customHTML")return e.jsx("div",{style:{padding:"8px 12px"},dangerouslySetInnerHTML:{__html:g.html||""}},g.id);const $=(((z=g.items)==null?void 0:z.length)??0)>0,L=l[g.id],v=m===g.id;return e.jsxs("div",{children:[e.jsxs("div",{onClick:()=>{$&&c(A=>({...A,[g.id]:!A[g.id]})),w(g)},style:{display:"flex",alignItems:"center",gap:10,padding:`8px ${d?"0px":`${12+k*16}px`}`,cursor:"pointer",borderRadius:t.r,margin:"1px 6px",justifyContent:d?"center":"flex-start",transition:"all .15s",background:v?t.primaryLt:"transparent",color:v?t.primary:t.text,userSelect:"none"},onMouseEnter:A=>!v&&(A.currentTarget.style.background=t.bg),onMouseLeave:A=>!v&&(A.currentTarget.style.background="transparent"),children:[g.icon&&e.jsx("span",{style:{fontSize:18,minWidth:22,textAlign:"center"},children:g.icon}),!d&&e.jsx("span",{style:{flex:1,fontSize:13,fontWeight:v?600:400},children:g.value}),!d&&g.count!==void 0&&e.jsx("span",{style:{background:t.primary,color:"#fff",borderRadius:10,padding:"1px 6px",fontSize:11,fontWeight:700},children:g.count}),!d&&$&&e.jsx("span",{style:{fontSize:12,color:t.textMut,transition:"transform .15s",transform:L?"rotate(90deg)":"rotate(0deg)"},children:"▶"})]}),$&&L&&!d&&g.items.map(A=>o(A,k+1))]},g.id)};return e.jsxs("div",{className:"dhx",style:{width:b,minWidth:b,background:t.surface,borderRight:`1px solid ${t.border}`,display:"flex",flexDirection:"column",transition:"width .2s ease",overflow:"hidden",...f},children:[x&&!d&&e.jsx("div",{style:{padding:"12px 14px",borderBottom:`1px solid ${t.border}`,fontWeight:700,fontSize:15},children:x}),e.jsx("button",{onClick:()=>y(g=>!g),style:{margin:"8px 6px",background:"transparent",border:"none",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:d?"center":"flex-end",padding:"4px 6px",borderRadius:t.r,color:t.textSec},children:e.jsx("span",{style:{fontSize:18},children:d?"☰":"✕"})}),e.jsx("div",{className:"dhx-scroll",style:{flex:1,overflowY:"auto",overflowX:"hidden"},children:r.map(g=>o(g))}),a&&!d&&e.jsx("div",{style:{padding:"10px 14px",borderTop:`1px solid ${t.border}`},children:a})]})}function je({config:r}){const[s,p]=u.useState(!1),i={position:"relative",background:t.surface,border:`1px solid ${t.border}`,borderRadius:t.r,overflow:"hidden",...r.width?{width:r.width,minWidth:r.width}:{flex:1},...r.height?{height:r.height,minHeight:r.height}:{minHeight:40},...s?{flex:"0 0 auto"}:{}};return e.jsxs("div",{style:i,children:[r.header&&e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"6px 12px",background:t.bg,borderBottom:`1px solid ${t.border}`,fontSize:12,fontWeight:600,color:t.textSec,userSelect:"none"},children:[e.jsx("span",{children:r.header}),r.collapsable&&e.jsx("button",{onClick:()=>p(x=>!x),style:{background:"none",border:"none",cursor:"pointer",color:t.textMut,fontSize:16,lineHeight:1},children:s?"▼":"▲"})]}),!s&&e.jsxs("div",{style:{padding:r.padding||0,height:r.header?"calc(100% - 33px)":"100%",overflow:"auto"},children:[r.html?e.jsx("div",{dangerouslySetInnerHTML:{__html:r.html}}):r.content,(r.rows||r.cols)&&e.jsx(ze,{rows:r.rows,cols:r.cols,style:{height:"100%"}})]})]})}function ze({rows:r,cols:s,type:p="line",style:i,children:x}){u.useEffect(X,[]);const a=p==="space"?12:p==="wide"?8:1,f=r||s,d=!!r;return f?e.jsx("div",{className:"dhx",style:{display:"flex",flexDirection:d?"column":"row",gap:a,width:"100%",height:"100%",...i},children:f.map((y,m)=>e.jsx(je,{config:y},y.id||m))}):e.jsx("div",{className:"dhx",style:{width:"100%",height:"100%",...i},children:x})}function Oe({views:r=[],mode:s="top",tabAlign:p="left",closable:i=[],disabled:x=[],defaultActive:a,onBeforeChange:f,onChange:d,style:y}){var v;const[m,n]=u.useState(a||((v=r[0])==null?void 0:v.id)),[l,c]=u.useState(r.map(z=>z.id));u.useEffect(X,[]);const b=(z,A)=>{z.stopPropagation(),c(h=>h.filter(E=>E!==A)),m===A&&n(l.find(h=>h!==A)??"")},w=z=>{x.includes(z)||f&&f(z)===!1||(n(z),d==null||d(z))},o=s==="left"||s==="right",g=r.filter(z=>l.includes(z.id)),k=e.jsx("div",{style:{display:"flex",flexDirection:o?"column":"row",justifyContent:p==="center"?"center":p==="right"?"flex-end":"flex-start",background:t.surface,borderBottom:!o&&s!=="bottom"?`2px solid ${t.border}`:"none",borderTop:s==="bottom"?`2px solid ${t.border}`:"none",borderRight:s==="left"?`2px solid ${t.border}`:"none",borderLeft:s==="right"?`2px solid ${t.border}`:"none",overflowX:"auto",flexShrink:0},children:g.map(z=>{const A=m===z.id,h=x.includes(z.id),E=s==="bottom"?{borderTop:`2px solid ${t.primary}`,color:t.primary,fontWeight:600}:o?{color:t.primary,fontWeight:600,background:t.primaryLt,[s==="left"?"borderRight":"borderLeft"]:`2px solid ${t.primary}`}:{borderBottom:`2px solid ${t.primary}`,color:t.primary,fontWeight:600};return e.jsxs("div",{onClick:()=>w(z.id),style:{display:"flex",alignItems:"center",gap:6,padding:"10px 16px",cursor:h?"not-allowed":"pointer",whiteSpace:"nowrap",fontSize:13,transition:"color .15s",userSelect:"none",minWidth:o?120:"auto",...A?E:{color:h?t.textMut:t.textSec}},children:[z.icon&&e.jsx("span",{style:{fontSize:16},children:z.icon}),e.jsx("span",{children:z.tab}),i.includes(z.id)&&e.jsx("span",{onClick:T=>b(T,z.id),style:{marginLeft:4,opacity:.6,fontSize:12,cursor:"pointer"},children:"✕"})]},z.id)})}),$=g.find(z=>z.id===m),L=e.jsxs("div",{className:"dhx-scroll",style:{flex:1,overflow:"auto"},children:[$==null?void 0:$.content,($==null?void 0:$.html)&&e.jsx("div",{dangerouslySetInnerHTML:{__html:$.html},style:{padding:16}})]});return e.jsxs("div",{className:"dhx",style:{display:"flex",flexDirection:s==="top"?"column":s==="bottom"?"column-reverse":s==="left"?"row":"row-reverse",width:"100%",height:"100%",background:t.surface,border:`1px solid ${t.border}`,borderRadius:t.r,overflow:"hidden",...y},children:[k,L]})}const ne=`1px solid ${t.border}`;function Ye({active:r,dir:s}){return e.jsxs("span",{style:{display:"inline-flex",flexDirection:"column",gap:1,flexShrink:0,marginLeft:4},children:[e.jsx("svg",{width:"7",height:"4",viewBox:"0 0 7 4",children:e.jsx("path",{d:"M3.5 0L7 4H0z",fill:r&&s==="asc"?t.primary:t.borderDk})}),e.jsx("svg",{width:"7",height:"4",viewBox:"0 0 7 4",children:e.jsx("path",{d:"M3.5 4L0 0H7z",fill:r&&s==="desc"?t.primary:t.borderDk})})]})}function Fe({columns:r,data:s=[],height:p=400,rowHeight:i=40,sortable:x=!0,resizable:a=!0,editable:f=!1,stripe:d=!1,autoWidth:y=!1,keyNavigation:m=!1,selection:n,multiselect:l,onSelect:c,onChange:b,style:w}){const[o,g]=u.useState(null),[k,$]=u.useState("asc"),[L,v]=u.useState({}),[z,A]=u.useState(new Set),[h,E]=u.useState(-1),[T,D]=u.useState(()=>r.map(S=>S.width??S.minWidth??150)),[j,G]=u.useState(null),[Q,Z]=u.useState(""),[R,I]=u.useState({}),M=u.useRef(null),[B,O]=u.useState(0);u.useEffect(X,[]),u.useEffect(()=>{if(!y||!M.current)return;const S=new ResizeObserver(()=>{var C;return O(((C=M.current)==null?void 0:C.offsetWidth)??0)});return S.observe(M.current),()=>S.disconnect()},[y]);const F=u.useMemo(()=>{if(!y||B===0)return T;const S=T.reduce((W,N)=>W+N,0);if(B<=S)return T;const C=(B-S)/r.length;return T.map(W=>W+C)},[y,B,T,r.length]),Y=u.useMemo(()=>{let S=s.map((C,W)=>{const N=String(C.id??W);return R[N]?{...C,...R[N]}:C}).filter(C=>Object.entries(L).every(([W,N])=>!N||String(C[W]??"").toLowerCase().includes(N.toLowerCase())));return o&&(S=[...S].sort((C,W)=>{const N=C[o],_=W[o];if(N==null)return 1;if(_==null)return-1;const K=N<_?-1:N>_?1:0;return k==="asc"?K:-K})),S},[s,o,k,L,R]),U=u.useMemo(()=>{const S={};return r.forEach(C=>{var W;if((W=C.footer)!=null&&W.some(N=>N.summary)){const N=Y.map(K=>Number(K[C.id])).filter(K=>!isNaN(K)),_=N.reduce((K,de)=>K+de,0);S[C.id]={sum:_,avg:N.length?_/N.length:0,count:Y.length,min:N.length?Math.min(...N):0,max:N.length?Math.max(...N):0}}}),S},[Y,r]),q=u.useMemo(()=>{const S={};return r.filter(C=>C.filterType==="select").forEach(C=>{S[C.id]=[...new Set(s.map(W=>String(W[C.id]??"")))].sort()}),S},[s,r]),oe=r.some(S=>S.filterable),ee=r.some(S=>{var C;return(C=S.footer)==null?void 0:C.length}),se=F.reduce((S,C)=>S+C,0),le=(S,C)=>S.id??C,ae=S=>{!x||S.sortable===!1||($(C=>o===S.id&&C==="asc"?"desc":"asc"),g(S.id))},P=(S,C)=>{if(!n)return;const W=le(S,C);E(C),A(N=>{const _=l?new Set(N):new Set;return _.has(W)?_.delete(W):_.add(W),_}),c==null||c(S)},te=()=>{if(!j)return;const{key:S,colId:C}=j;I(N=>({...N,[String(S)]:{...N[String(S)]||{},[C]:Q}}));const W=Y.find((N,_)=>le(N,_)===S);W&&(b==null||b(W,C,Q)),G(null)},pt=S=>{if(j&&S.key==="Escape"){G(null);return}if(!(!m||!n)){if(S.key==="ArrowDown"){S.preventDefault();const C=Math.min(h+1,Y.length-1);C>=0&&P(Y[C],C)}else if(S.key==="ArrowUp"){S.preventDefault();const C=Math.max(h-1,0);C>=0&&P(Y[C],C)}}},ht=(S,C)=>{S.preventDefault(),S.stopPropagation();const W=S.clientX,N=T[C],_=de=>D(ke=>{const ce=[...ke];return ce[C]=Math.max(r[C].minWidth||50,N+de.clientX-W),ce}),K=()=>{document.removeEventListener("mousemove",_),document.removeEventListener("mouseup",K)};document.addEventListener("mousemove",_),document.addEventListener("mouseup",K)},Se=(S,C,W,N)=>({width:S,minWidth:S,flexShrink:0,boxSizing:"border-box",padding:"0 12px",height:N,display:"flex",alignItems:"center",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",fontSize:13,textAlign:C.align,justifyContent:C.align==="center"?"center":C.align==="right"?"flex-end":"flex-start",borderLeft:W?"none":ne});return e.jsx("div",{ref:M,className:"dhx",tabIndex:m?0:void 0,onKeyDown:pt,style:{width:"100%",height:p,display:"flex",flexDirection:"column",border:ne,borderRadius:t.r,overflow:"hidden",outline:"none",...w},children:e.jsx("div",{style:{overflowX:"auto",flex:1,display:"flex",flexDirection:"column",minHeight:0},children:e.jsxs("div",{style:{minWidth:se,display:"flex",flexDirection:"column",height:"100%"},children:[e.jsx("div",{style:{display:"flex",background:t.bg,borderBottom:ne,flexShrink:0,position:"sticky",top:0,zIndex:2},children:r.map((S,C)=>{var W;return e.jsxs("div",{onClick:()=>ae(S),style:{...Se(F[C],S,C===0,40),position:"relative",fontWeight:500,color:t.text,cursor:x&&S.sortable!==!1?"pointer":"default",userSelect:"none"},children:[e.jsx("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:Array.isArray(S.header)?(W=S.header[0])==null?void 0:W.text:S.header||S.id}),x&&S.sortable!==!1&&e.jsx(Ye,{active:o===S.id,dir:k}),a&&S.resizable!==!1&&C<r.length-1&&e.jsx("div",{onMouseDown:N=>ht(N,C),onClick:N=>N.stopPropagation(),style:{position:"absolute",right:0,top:0,bottom:0,width:4,cursor:"col-resize",zIndex:1},onMouseEnter:N=>N.currentTarget.style.background=t.primary+"55",onMouseLeave:N=>N.currentTarget.style.background="transparent"})]},S.id)})}),oe&&e.jsx("div",{style:{display:"flex",borderBottom:ne,background:t.surface,flexShrink:0},children:r.map((S,C)=>e.jsx("div",{style:{width:F[C],minWidth:F[C],flexShrink:0,padding:"4px 6px",boxSizing:"border-box",borderLeft:C===0?"none":ne},children:S.filterable&&S.filterType==="select"?e.jsxs("select",{className:"dhx dhx-input",style:{height:26,fontSize:12,padding:"0 4px"},value:L[S.id]||"",onChange:W=>v(N=>({...N,[S.id]:W.target.value})),children:[e.jsx("option",{value:"",children:"All"}),(q[S.id]||[]).map(W=>e.jsx("option",{value:W,children:W},W))]}):S.filterable?e.jsx("input",{className:"dhx dhx-input",style:{height:26,fontSize:12},placeholder:"Filter...",value:L[S.id]||"",onChange:W=>v(N=>({...N,[S.id]:W.target.value}))}):null},S.id))}),e.jsxs("div",{className:"dhx-scroll",style:{flex:1,overflowY:"auto",minHeight:0},children:[Y.map((S,C)=>{const W=le(S,C),N=z.has(W),_=N?t.primaryLt:d&&C%2!==0?t.bg:t.surface;return e.jsx("div",{style:{display:"flex",height:i,borderBottom:ne,flexShrink:0,background:_,transition:"background .1s",cursor:n?"pointer":"default"},onMouseEnter:K=>!N&&(K.currentTarget.style.background=t.primaryLt+"80"),onMouseLeave:K=>!N&&(K.currentTarget.style.background=_),children:r.map((K,de)=>{const ke=(j==null?void 0:j.key)===W&&(j==null?void 0:j.colId)===K.id,ce=S[K.id],ft=K.template?K.template(ce,S):String(ce??"");return e.jsx("div",{onClick:()=>{P(S,C),f&&K.editable!==!1&&(G({key:W,colId:K.id}),Z(String(ce??"")))},style:Se(F[de],K,de===0,i),children:ke?e.jsx("input",{autoFocus:!0,value:Q,onChange:pe=>Z(pe.target.value),onBlur:te,onKeyDown:pe=>{pe.key==="Enter"&&te(),pe.key==="Escape"&&G(null)},onClick:pe=>pe.stopPropagation(),style:{width:"100%",border:"none",outline:`2px solid ${t.primary}`,borderRadius:2,fontSize:13,padding:"2px 4px",background:t.surface,color:t.text}}):ft},K.id)})},String(W))}),Y.length===0&&e.jsx("div",{style:{textAlign:"center",padding:40,color:t.textMut,fontSize:13},children:"No data"})]}),ee&&e.jsx("div",{style:{display:"flex",borderTop:ne,background:t.bg,flexShrink:0},children:r.map((S,C)=>{var K;const W=(K=S.footer)==null?void 0:K[0],N=U[S.id]??{sum:0,avg:0,count:0,min:0,max:0};let _="";return W&&(typeof W.text=="function"?_=W.text(N):W.text?_=W.text:W.summary&&(_=String(Math.round(N[W.summary]*100)/100))),e.jsx("div",{style:{...Se(F[C],S,C===0,40),fontWeight:600,color:t.text},children:_},S.id)})})]})})})}const J=["#0288d1","#43a047","#f57c00","#e53935","#8e24aa","#00838f","#ef6c00","#2e7d32"];function Ke(r,s,p){const i=r.filter(a=>!a.parent),x=r.filter(a=>!!a.parent);return i.map(a=>({name:a[p],children:x.filter(f=>f.parent===a.id).map(f=>({name:f[p],value:Number(f[s]??0)}))}))}function Ve({type:r="bar",data:s=[],series:p=[],scales:i={},legend:x,height:a=280,style:f}){var g,k,$,L,v,z,A,h,E,T,D,j,G,Q,Z,R;u.useEffect(X,[]);const d=((g=i.bottom)==null?void 0:g.text)||s[0]&&Object.keys(s[0])[0]||"x",y=e.jsx(V.Tooltip,{contentStyle:{fontSize:12,borderRadius:t.r,border:`1px solid ${t.border}`}}),m=x?e.jsx(V.Legend,{iconSize:10,wrapperStyle:{fontSize:12},verticalAlign:x.valign==="bottom"?"bottom":x.valign==="middle"?"middle":"top",align:x.halign??"center"}):null,n=e.jsx(V.CartesianGrid,{strokeDasharray:"3 3",stroke:t.border}),l=e.jsx(V.XAxis,{dataKey:d,tick:{fontSize:11,fill:t.textSec},axisLine:{stroke:t.border},tickLine:!1,label:(k=i.bottom)!=null&&k.title?{value:i.bottom.title,position:"insideBottom",offset:-4,fontSize:11}:void 0}),c=e.jsx(V.YAxis,{tick:{fontSize:11,fill:t.textSec},axisLine:!1,tickLine:!1,domain:[(($=i.left)==null?void 0:$.min)??"auto",((L=i.left)==null?void 0:L.max)??"auto"],tickCount:(v=i.left)==null?void 0:v.maxTicks,label:(z=i.left)!=null&&z.title?{value:i.left.title,angle:-90,position:"insideLeft",fontSize:11}:void 0}),b={top:10,right:20,left:0,bottom:(A=i.bottom)!=null&&A.title?20:0},w={data:s,margin:b};let o;if(r==="bar")o=e.jsxs(V.BarChart,{...w,children:[n,l,c,y,m,p.map((I,M)=>e.jsx(V.Bar,{dataKey:I.value||I.id||"",name:I.label||I.id,fill:I.fill||I.color||J[M%J.length],radius:[3,3,0,0]},I.id??M))]});else if(r==="line")o=e.jsxs(V.LineChart,{...w,children:[n,l,c,y,m,p.map((I,M)=>{const B=I.color||J[M%J.length];return e.jsx(V.Line,{type:"monotone",dataKey:I.value||I.id||"",name:I.label||I.id,stroke:B,strokeWidth:I.strokeWidth??2,dot:{r:3,fill:B}},I.id??M)})]});else if(r==="area")o=e.jsxs(V.AreaChart,{...w,children:[n,l,c,y,m,p.map((I,M)=>{const B=I.color||J[M%J.length];return e.jsx(V.Area,{type:"monotone",dataKey:I.value||I.id||"",name:I.label||I.id,stroke:B,fill:(I.fill||B)+"33",strokeWidth:I.strokeWidth??2},I.id??M)})]});else if(r==="pie"||r==="donut"){const I=p[0]||{},M=I.value||"value",B=I.text||"name",O=I.color&&s[0]&&I.color in s[0]?I.color:null;o=e.jsxs(V.PieChart,{children:[e.jsx(V.Pie,{data:s,cx:"50%",cy:"50%",outerRadius:r==="donut"?"70%":"80%",innerRadius:r==="donut"?"40%":0,dataKey:M,nameKey:B,stroke:I.stroke||"none",strokeWidth:I.strokeWidth??0,label:({name:F,percent:Y})=>`${F??""} ${((Y??0)*100).toFixed(0)}%`,labelLine:!0,paddingAngle:2,children:s.map((F,Y)=>e.jsx(V.Cell,{fill:O?F[O]:J[Y%J.length]},Y))}),y,m]})}else if(r==="radar"){const I=((h=i.radial)==null?void 0:h.value)||d;o=e.jsxs(V.RadarChart,{...w,cx:"50%",cy:"50%",children:[e.jsx(V.PolarGrid,{}),e.jsx(V.PolarAngleAxis,{dataKey:I,tick:{fontSize:11}}),e.jsx(V.PolarRadiusAxis,{tick:{fontSize:9,fill:t.textMut},axisLine:!1}),p.map((M,B)=>{const O=M.color||M.pointColor||J[B%J.length];return e.jsx(V.Radar,{dataKey:M.value||M.id||"",name:M.label||M.id,stroke:O,fill:O+"44"},M.id??B)}),y,m]})}else if(r==="scatter")o=e.jsxs(V.ScatterChart,{margin:b,children:[n,e.jsx(V.XAxis,{type:"number",dataKey:"x",name:((E=i.bottom)==null?void 0:E.title)||"x",tick:{fontSize:11,fill:t.textSec},tickLine:!1,domain:[((T=i.bottom)==null?void 0:T.min)??"auto",((D=i.bottom)==null?void 0:D.max)??"auto"],label:(j=i.bottom)!=null&&j.title?{value:i.bottom.title,position:"insideBottom",offset:-4,fontSize:11}:void 0}),e.jsx(V.YAxis,{type:"number",dataKey:"y",name:((G=i.left)==null?void 0:G.title)||"y",tick:{fontSize:11,fill:t.textSec},tickLine:!1,axisLine:!1,domain:[((Q=i.left)==null?void 0:Q.min)??"auto",((Z=i.left)==null?void 0:Z.max)??"auto"],label:(R=i.left)!=null&&R.title?{value:i.left.title,angle:-90,position:"insideLeft",fontSize:11}:void 0}),y,m,p.map((I,M)=>{const B=I.value||"x",O=I.valueY||"y",F=(I.data||s).map(Y=>({x:Y[B],y:Y[O]}));return e.jsx(V.Scatter,{data:F,name:I.label||I.id,fill:I.color||J[M%J.length]},I.id??M)})]});else if(r==="treeMap"){const I=p[0]||{},M=I.value||"value",B=I.text||"name",O=Ke(s,M,B),F=I.stroke||t.surface,Y=I.strokeWidth??2;o=e.jsx(V.Treemap,{data:O,dataKey:"value",aspectRatio:4/3,stroke:F,content:U=>{const{x:q,y:oe,width:ee,height:se,depth:le,index:ae,name:P}=U;if(le===0)return null;const te=J[ae%J.length];return e.jsxs("g",{children:[e.jsx("rect",{x:q,y:oe,width:ee,height:se,fill:te,stroke:F,strokeWidth:Y,style:{borderRadius:3}}),ee>40&&se>20&&e.jsx("text",{x:q+ee/2,y:oe+se/2,textAnchor:"middle",dominantBaseline:"middle",fill:"#fff",fontSize:11,pointerEvents:"none",children:P})]})}})}return e.jsx("div",{className:"dhx",style:{width:"100%",height:a,padding:12,background:t.surface,borderRadius:t.rMd,...f},children:e.jsx(V.ResponsiveContainer,{width:"100%",height:"100%",children:o})})}const Xe=["January","February","March","April","May","June","July","August","September","October","November","December"],_e=["Su","Mo","Tu","We","Th","Fr","Sa"];function qe({value:r,range:s=!1,timepicker:p=!1,onChange:i,style:x}){const a=new Date,f=r?new Date(Array.isArray(r)?r[0]:r):a,[d,y]=u.useState(f),[m,n]=u.useState(r??(s?[null,null]:null)),[l,c]=u.useState(null),[b,w]=u.useState({h:0,m:0});u.useEffect(X,[]);const o=d.getFullYear(),g=d.getMonth(),k=new Date(o,g,1).getDay(),$=new Date(o,g+1,0).getDate(),L=[];for(let h=0;h<k;h++)L.push(null);for(let h=1;h<=$;h++)L.push(new Date(o,g,h));const v=h=>h.toDateString()===a.toDateString(),z=h=>{if(!m)return!1;if(s&&Array.isArray(m)){const[E,T]=m;if(!E)return!1;const D=h.getTime();return T?D>=E.getTime()&&D<=T.getTime():h.toDateString()===E.toDateString()}return h.toDateString()===m.toDateString()},A=h=>{if(s){const[E,T]=Array.isArray(m)?m:[null,null];if(!E||T)n([h,null]);else{const D=h<E?[h,E]:[E,h];n(D),i==null||i(D)}}else n(h),i==null||i(h)};return e.jsxs("div",{className:"dhx",style:{background:t.surface,border:`1px solid ${t.border}`,borderRadius:t.rMd,padding:16,display:"inline-block",boxShadow:t.shadow,...x},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:12},children:[e.jsx("button",{onClick:()=>y(h=>new Date(h.getFullYear(),h.getMonth()-1,1)),className:"dhx dhx-btn dhx-btn-ghost",style:{height:28,padding:"0 8px",fontSize:16},children:"‹"}),e.jsxs("div",{style:{fontWeight:700,fontSize:14},children:[Xe[g]," ",o]}),e.jsx("button",{onClick:()=>y(h=>new Date(h.getFullYear(),h.getMonth()+1,1)),className:"dhx dhx-btn dhx-btn-ghost",style:{height:28,padding:"0 8px",fontSize:16},children:"›"})]}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(7, 32px)",gap:2},children:[_e.map(h=>e.jsx("div",{style:{textAlign:"center",fontSize:11,fontWeight:600,color:t.textMut,paddingBottom:4},children:h},h)),L.map((h,E)=>{const T=h?z(h):!1,D=h&&l&&h.toDateString()===l.toDateString();return e.jsx("div",{onClick:()=>h&&A(h),onMouseEnter:()=>h&&c(h),onMouseLeave:()=>c(null),style:{width:32,height:32,display:"flex",alignItems:"center",justifyContent:"center",borderRadius:t.r,cursor:h?"pointer":"default",fontSize:12,fontWeight:h&&v(h)?700:400,background:T?t.primary:D?t.bg:"transparent",color:T?"#fff":h&&v(h)?t.primary:h?t.text:"transparent",border:h&&v(h)&&!T?`1px solid ${t.primary}`:"1px solid transparent",transition:"all .1s"},children:h==null?void 0:h.getDate()},E)})]}),p&&e.jsxs("div",{style:{borderTop:`1px solid ${t.border}`,marginTop:12,paddingTop:12,display:"flex",alignItems:"center",justifyContent:"center",gap:8},children:[e.jsx("input",{type:"number",min:0,max:23,value:b.h,onChange:h=>w(E=>({...E,h:+h.target.value})),className:"dhx dhx-input",style:{width:50,textAlign:"center"}}),e.jsx("span",{style:{fontWeight:700,color:t.textSec},children:":"}),e.jsx("input",{type:"number",min:0,max:59,value:b.m,onChange:h=>w(E=>({...E,m:+h.target.value})),className:"dhx dhx-input",style:{width:50,textAlign:"center"}})]})]})}function $e({value:r,onChange:s,timeFormat:p=12,controls:i=!1,minuteStep:x=5,style:a}){const[f,d]=u.useState((r==null?void 0:r.h)??(p===24?0:12)),[y,m]=u.useState((r==null?void 0:r.m)??0),[n,l]=u.useState((r==null?void 0:r.ampm)??"AM"),[c,b]=u.useState(null);u.useEffect(X,[]);const w=p===24?Array.from({length:24},(v,z)=>z):Array.from({length:12},(v,z)=>z+1),o=Array.from({length:Math.ceil(60/x)},(v,z)=>z*x),g=(v,z,A)=>{const h=p===24?{h:v,m:z}:{h:v,m:z,ampm:A};i?b(h):s==null||s(h)},k=()=>{b(null),d((r==null?void 0:r.h)??(p===24?0:12)),m((r==null?void 0:r.m)??0),l((r==null?void 0:r.ampm)??"AM")},$={display:"flex",flexDirection:"column",alignItems:"center",gap:4},L=v=>({height:32,display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer",fontSize:13,fontWeight:v?700:400,background:v?t.primaryLt:"transparent",color:v?t.primary:t.text});return e.jsxs("div",{className:"dhx",style:{background:t.surface,border:`1px solid ${t.border}`,borderRadius:t.rMd,padding:16,display:"inline-block",boxShadow:t.shadow,...a},children:[e.jsxs("div",{style:{display:"flex",gap:8,alignItems:"stretch"},children:[e.jsxs("div",{style:$,children:[e.jsx("span",{style:{fontSize:11,fontWeight:600,color:t.textMut},children:"Hours"}),e.jsx("div",{className:"dhx-scroll",style:{height:160,overflowY:"auto",width:48,border:`1px solid ${t.border}`,borderRadius:t.r},children:w.map(v=>e.jsx("div",{onClick:()=>{d(v),g(v,y,n)},style:L(f===v),onMouseEnter:z=>f!==v&&(z.currentTarget.style.background=t.bg),onMouseLeave:z=>f!==v&&(z.currentTarget.style.background="transparent"),children:String(v).padStart(2,"0")},v))})]}),e.jsxs("div",{style:$,children:[e.jsx("span",{style:{fontSize:11,fontWeight:600,color:t.textMut},children:"Minutes"}),e.jsx("div",{className:"dhx-scroll",style:{height:160,overflowY:"auto",width:48,border:`1px solid ${t.border}`,borderRadius:t.r},children:o.map(v=>e.jsx("div",{onClick:()=>{m(v),g(f,v,n)},style:L(y===v),onMouseEnter:z=>y!==v&&(z.currentTarget.style.background=t.bg),onMouseLeave:z=>y!==v&&(z.currentTarget.style.background="transparent"),children:String(v).padStart(2,"0")},v))})]}),p===12&&e.jsxs("div",{style:$,children:[e.jsx("span",{style:{fontSize:11,fontWeight:600,color:t.textMut},children:"AM/PM"}),e.jsx("div",{style:{display:"flex",flexDirection:"column",border:`1px solid ${t.border}`,borderRadius:t.r,overflow:"hidden"},children:["AM","PM"].map(v=>e.jsx("div",{onClick:()=>{l(v),g(f,y,v)},style:{height:40,display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer",padding:"0 12px",fontSize:13,fontWeight:n===v?700:400,background:n===v?t.primary:t.surface,color:n===v?"#fff":t.text},children:v},v))})]})]}),e.jsxs("div",{style:{textAlign:"center",marginTop:12,fontSize:22,fontWeight:700,color:t.primary,letterSpacing:2},children:[String(f).padStart(2,"0"),":",String(y).padStart(2,"0"),p===12?` ${n}`:""]}),i&&e.jsxs("div",{style:{display:"flex",gap:8,justifyContent:"flex-end",marginTop:12},children:[e.jsx("button",{className:"dhx dhx-btn dhx-btn-secondary",onClick:k,children:"Cancel"}),e.jsx("button",{className:"dhx dhx-btn dhx-btn-primary",onClick:()=>{const v=c??(p===24?{h:f,m:y}:{h:f,m:y,ampm:n});s==null||s(v)},children:"Apply"})]})]})}const Ge=({open:r})=>e.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",style:{flexShrink:0,transition:"transform .15s",transform:r?"rotate(180deg)":"rotate(0deg)"},children:e.jsx("path",{d:"M2 4l4 4 4-4",stroke:t.textMut,strokeWidth:"1.5",fill:"none",strokeLinecap:"round",strokeLinejoin:"round"})});function he({data:r=[],value:s,placeholder:p="Select or type...",multiselection:i=!1,label:x,onChange:a,style:f}){var A;const[d,y]=u.useState(!1),[m,n]=u.useState(""),[l,c]=u.useState(i?s?[].concat(s):[]:s||null),b=u.useRef(null),w=u.useRef(null);u.useEffect(X,[]),re(b,u.useCallback(()=>{y(!1),n("")},[]));const o=u.useMemo(()=>r.filter(h=>!m||h.value.toLowerCase().includes(m.toLowerCase())),[r,m]),g=h=>i?(l||[]).includes(h):l===h,k=h=>{const E=h.id||h.value;if(i){const T=g(E)?l.filter(D=>D!==E):[...l||[],E];c(T),a==null||a(T)}else c(E),n(""),y(!1),a==null||a(E)},$=h=>{const E=l.filter(T=>T!==h);c(E),a==null||a(E)},L=()=>{y(!0),setTimeout(()=>{var h;return(h=w.current)==null?void 0:h.focus()},0)},v=((A=r.find(h=>(h.id||h.value)===l))==null?void 0:A.value)||"",z=i?l||[]:[];return e.jsxs("div",{ref:b,className:"dhx",style:{position:"relative",...f},children:[x&&e.jsx("label",{className:"dhx dhx-label",children:x}),e.jsxs("div",{onClick:L,style:{display:"flex",alignItems:"center",flexWrap:i?"wrap":"nowrap",border:`1px solid ${d?t.primary:t.border}`,borderRadius:t.r,minHeight:34,padding:"4px 8px",cursor:"text",background:t.surface,gap:4,transition:"border-color .15s",boxShadow:d?`0 0 0 3px ${t.primary}22`:"none"},children:[i&&e.jsxs(e.Fragment,{children:[z.map(h=>{var E;return e.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:4,background:t.primary,color:"#fff",borderRadius:12,padding:"2px 10px 2px 8px",fontSize:12,lineHeight:1.5,whiteSpace:"nowrap"},children:[((E=r.find(T=>(T.id||T.value)===h))==null?void 0:E.value)||h,e.jsx("span",{onClick:T=>{T.stopPropagation(),$(h)},style:{cursor:"pointer",fontSize:15,lineHeight:1,opacity:.75,marginLeft:2},children:"×"})]},h)}),e.jsx("input",{ref:w,value:m,onChange:h=>{n(h.target.value),y(!0)},onFocus:()=>y(!0),onClick:h=>h.stopPropagation(),placeholder:z.length?"":p,style:{flex:1,minWidth:60,border:"none",outline:"none",fontSize:13,background:"transparent",color:t.text,padding:0}})]}),!i&&e.jsx("input",{ref:w,value:d?m:v,onChange:h=>{n(h.target.value),y(!0)},onFocus:()=>{y(!0),n("")},onClick:h=>h.stopPropagation(),placeholder:p,style:{flex:1,border:"none",outline:"none",fontSize:13,background:"transparent",color:t.text,padding:0}}),e.jsx(Ge,{open:d})]}),d&&e.jsx("div",{className:"dhx dhx-anim-fade",style:{position:"absolute",top:"calc(100% + 4px)",left:0,right:0,background:t.surface,border:`1px solid ${t.border}`,borderRadius:t.r,boxShadow:t.shadowLg,zIndex:100},children:e.jsxs("div",{className:"dhx-scroll",style:{maxHeight:220,overflowY:"auto"},children:[o.map(h=>{const E=h.id||h.value,T=g(E);return e.jsxs("div",{onClick:()=>k(h),style:{padding:"8px 12px",cursor:"pointer",display:"flex",alignItems:"center",gap:8,fontSize:13,background:T?t.primaryLt:"transparent",color:T?t.primary:t.text},onMouseEnter:D=>!T&&(D.currentTarget.style.background=t.bg),onMouseLeave:D=>!T&&(D.currentTarget.style.background="transparent"),children:[i&&e.jsx("span",{style:{width:14,height:14,flexShrink:0,border:`2px solid ${T?t.primary:t.borderDk}`,borderRadius:3,display:"flex",alignItems:"center",justifyContent:"center",background:T?t.primary:"transparent"},children:T&&e.jsx("span",{style:{color:"#fff",fontSize:9,lineHeight:1},children:"✓"})}),e.jsx("span",{style:{flex:1},children:h.value}),!i&&T&&e.jsx("span",{style:{color:t.primary,fontSize:12,fontWeight:700},children:"✓"}),h.count!==void 0&&e.jsxs("span",{style:{fontSize:11,color:t.textMut},children:["(",h.count,")"]})]},E)}),o.length===0&&e.jsx("div",{style:{padding:16,textAlign:"center",color:t.textMut,fontSize:13},children:"No matches"})]})})]})}function fe({min:r=0,max:s=100,step:p=1,value:i,range:x=!1,label:a,tick:f,disabled:d=!1,onChange:y,style:m}){const[n,l]=u.useState(i??(x?[r,s]:r));u.useEffect(X,[]);const c=(k,$)=>{if(!d)if(x){const L=[...n];L[k]=$,l(L),y==null||y(L)}else l($),y==null||y($)},b=k=>(k-r)/(s-r)*100,w=x?n:[n],o=x?{left:`${b(w[0])}%`,width:`${b(w[1])-b(w[0])}%`}:{left:0,width:`${b(w[0])}%`},g=d?t.border:t.primary;return e.jsxs("div",{className:"dhx",style:{width:"100%",opacity:d?.5:1,...m},children:[a&&e.jsx("label",{className:"dhx dhx-label",children:a}),e.jsx("div",{style:{position:"relative",height:36,display:"flex",alignItems:"center"},children:e.jsxs("div",{style:{position:"relative",flex:1,height:4,background:t.border,borderRadius:2},children:[e.jsx("div",{style:{position:"absolute",...o,height:"100%",background:g,borderRadius:2}}),w.map((k,$)=>e.jsx("input",{type:"range",min:r,max:s,step:p,value:k,disabled:d,onChange:L=>{const v=+L.target.value;x&&$===0&&v>=n[1]||x&&$===1&&v<=n[0]||c($,v)},style:{position:"absolute",width:"100%",height:"100%",opacity:0,cursor:d?"not-allowed":"pointer",top:0,left:0,margin:0}},$)),w.map((k,$)=>e.jsx("div",{style:{position:"absolute",left:`${b(k)}%`,top:"50%",transform:"translate(-50%, -50%)",width:16,height:16,borderRadius:"50%",background:t.surface,border:`2px solid ${g}`,boxShadow:"0 1px 4px rgba(0,0,0,.2)",pointerEvents:"none"},children:e.jsx("div",{style:{position:"absolute",bottom:"calc(100% + 6px)",left:"50%",transform:"translateX(-50%)",background:d?t.textMut:t.primaryDk,color:"#fff",padding:"2px 6px",borderRadius:t.r,fontSize:11,fontWeight:700,whiteSpace:"nowrap"},children:k})},$))]})}),f&&e.jsx("div",{style:{display:"flex",justifyContent:"space-between",marginTop:2},children:[r,Math.round((s+r)/2),s].map(k=>e.jsx("span",{style:{fontSize:10,color:t.textMut},children:k},k))})]})}const Je=["#f44336","#e91e63","#9c27b0","#673ab7","#3f51b5","#2196f3","#03a9f4","#00bcd4","#009688","#4caf50","#8bc34a","#cddc39","#ffeb3b","#ffc107","#ff9800","#ff5722","#795548","#607d8b","#9e9e9e","#000000","#ffffff","#0288d1","#01579b","#43a047","#e53935","#f57c00"];function ue(r){const s=parseInt(r.slice(1,3),16)/255,p=parseInt(r.slice(3,5),16)/255,i=parseInt(r.slice(5,7),16)/255,x=Math.max(s,p,i),a=Math.min(s,p,i);let f=0,d=0;const y=(x+a)/2;if(x!==a){const m=x-a;d=y>.5?m/(2-x-a):m/(x+a),f=x===s?((p-i)/m+(p<i?6:0))/6:x===p?((i-s)/m+2)/6:((s-p)/m+4)/6}return[Math.round(f*360),Math.round(d*100),Math.round(y*100)]}function Ce(r,s,p){s/=100,p/=100;const i=s*Math.min(p,1-p),x=a=>{const f=(a+r/30)%12,d=p-i*Math.max(Math.min(f-3,9-f,1),-1);return Math.round(255*d).toString(16).padStart(2,"0")};return"#"+x(0)+x(8)+x(4)}function Ue({value:r="#0288d1",onChange:s,style:p}){const[i,x]=u.useState(()=>ue(r)),a=Ce(...i);u.useEffect(X,[]);const f=d=>{x(d),s==null||s(Ce(...d))};return e.jsxs("div",{className:"dhx",style:{background:t.surface,border:`1px solid ${t.border}`,borderRadius:t.rMd,padding:16,display:"inline-block",boxShadow:t.shadow,...p},children:[e.jsx("div",{style:{width:200,height:120,borderRadius:t.r,marginBottom:12,background:`linear-gradient(to bottom, transparent, black), linear-gradient(to right, white, hsl(${i[0]},100%,50%))`,cursor:"crosshair"}}),[["Hue",0,360,i[0]],["Saturation",0,100,i[1]],["Lightness",0,100,i[2]]].map(([d,y,m,n],l)=>e.jsxs("div",{style:{marginBottom:l<2?8:12},children:[e.jsxs("div",{className:"dhx dhx-label",children:[d,l>0?` (${n}%)`:""]}),e.jsx("input",{type:"range",min:y,max:m,value:n,onChange:c=>{const b=[...i];b[l]=+c.target.value,f(b)},style:{width:"100%",accentColor:t.primary}})]},d)),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:12},children:[e.jsx("div",{style:{width:36,height:36,borderRadius:t.r,background:a,border:`1px solid ${t.border}`,flexShrink:0}}),e.jsx("input",{className:"dhx dhx-input",style:{flex:1,fontFamily:"monospace",fontSize:12},value:a,onChange:d=>{try{f(ue(d.target.value)),s==null||s(d.target.value)}catch{}}})]}),e.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(13, 1fr)",gap:3},children:Je.map(d=>e.jsx("div",{onClick:()=>{x(ue(d)),s==null||s(d)},style:{width:14,height:14,borderRadius:2,background:d,cursor:"pointer",border:a===d?`2px solid ${t.text}`:"1px solid rgba(0,0,0,.15)",transition:"transform .1s"},onMouseEnter:y=>y.currentTarget.style.transform="scale(1.3)",onMouseLeave:y=>y.currentTarget.style.transform="scale(1)"},d))})]})}function Qe({trigger:r,children:s,placement:p="bottom-start",style:i}){const[x,a]=u.useState(!1),[f,d]=u.useState({top:"100%",left:0}),y=u.useRef(null),m=u.useRef(null);u.useEffect(X,[]),re(y,u.useCallback(()=>a(!1),[]));const n=()=>{a(l=>{if(!l&&m.current){const c=m.current.getBoundingClientRect(),b={"bottom-start":{top:c.height+4,left:0},"bottom-end":{top:c.height+4,right:0,left:"auto"},"top-start":{bottom:c.height+4,top:"auto",left:0}};d(b[p]||b["bottom-start"])}return!l})};return e.jsxs("div",{ref:y,className:"dhx",style:{position:"relative",display:"inline-block"},children:[e.jsx("div",{ref:m,onClick:n,children:r}),x&&e.jsx("div",{className:"dhx dhx-anim-fade",style:{position:"absolute",...f,zIndex:200,background:t.surface,border:`1px solid ${t.border}`,borderRadius:t.rMd,boxShadow:t.shadowLg,...i},children:s})]})}function Ze({title:r,children:s,width:p=480,height:i,closable:x=!0,movable:a=!0,modal:f=!1,defaultOpen:d=!0,footer:y,onClose:m,style:n}){const[l,c]=u.useState(d),[b,w]=u.useState({x:0,y:0});u.useEffect(X,[]);const o=me(u.useCallback((k,$)=>a&&w({x:k,y:$}),[a])),g=()=>{c(!1),m==null||m()};return l?e.jsxs(e.Fragment,{children:[f&&e.jsx("div",{style:{position:"fixed",inset:0,background:"rgba(0,0,0,.45)",zIndex:900},onClick:x?g:void 0}),e.jsxs("div",{className:"dhx",style:{position:f?"fixed":"absolute",left:"50%",top:"50%",transform:`translate(calc(-50% + ${b.x}px), calc(-50% + ${b.y}px))`,width:p,...i?{height:i}:{},background:t.surface,borderRadius:t.rMd,boxShadow:t.shadowLg,zIndex:901,display:"flex",flexDirection:"column",overflow:"hidden",...n},children:[e.jsxs("div",{onMouseDown:k=>o(k,b.x,b.y),style:{display:"flex",alignItems:"center",padding:"12px 16px",borderBottom:`1px solid ${t.border}`,cursor:a?"grab":"default",background:t.bg,gap:8,userSelect:"none"},children:[e.jsx("span",{style:{flex:1,fontWeight:700,fontSize:15},children:r}),x&&e.jsx("button",{onClick:g,style:{background:"none",border:"none",cursor:"pointer",width:28,height:28,borderRadius:t.r,display:"flex",alignItems:"center",justifyContent:"center",fontSize:18,color:t.textSec},onMouseEnter:k=>k.currentTarget.style.background=t.border,onMouseLeave:k=>k.currentTarget.style.background="none",children:"×"})]}),e.jsx("div",{className:"dhx-scroll",style:{flex:1,minHeight:0,padding:20,overflowY:"auto"},children:s}),y&&e.jsx("div",{style:{padding:"12px 16px",borderTop:`1px solid ${t.border}`,display:"flex",justifyContent:"flex-end",gap:8,background:t.bg},children:y})]})]}):null}const xe=u.createContext(null),Re={success:"✓",error:"✕",warning:"⚠",info:"ℹ"},De={success:t.success,error:t.danger,warning:t.warning,info:t.primary};function et({children:r}){const[s,p]=u.useState([]);u.useEffect(X,[]);const i=u.useCallback(f=>p(d=>d.filter(y=>y.id!==f)),[]),x=u.useCallback(f=>{const d=Date.now();return p(y=>[...y,{id:d,...f}]),f.duration!==0&&setTimeout(()=>i(d),f.duration||4e3),d},[i]),a={message:x,alert:(f,d)=>x({type:"info",title:f,...d}),confirm:(f,d,y)=>x({type:"warning",title:f,confirm:d,...y})};return e.jsxs(xe.Provider,{value:a,children:[r,e.jsx("div",{style:{position:"fixed",top:20,right:20,zIndex:9999,display:"flex",flexDirection:"column",gap:8,pointerEvents:"none"},children:s.map(f=>{const d=f.type||"info";return e.jsxs("div",{style:{background:t.surface,border:`1px solid ${t.border}`,borderLeft:`4px solid ${De[d]}`,borderRadius:t.r,boxShadow:t.shadowLg,padding:"12px 16px",minWidth:280,maxWidth:380,pointerEvents:"all",display:"flex",gap:10,alignItems:"flex-start",animation:"dhx-toast .3s ease"},children:[e.jsx("span",{style:{fontSize:18,color:De[d],lineHeight:1},children:Re[d]}),e.jsxs("div",{style:{flex:1},children:[f.title&&e.jsx("div",{style:{fontWeight:600,fontSize:13,marginBottom:f.text?3:0},children:f.title}),f.text&&e.jsx("div",{style:{fontSize:12,color:t.textSec,lineHeight:1.5},children:f.text}),f.confirm&&e.jsxs("div",{style:{display:"flex",gap:6,marginTop:8},children:[e.jsx("button",{className:"dhx dhx-btn dhx-btn-primary",style:{height:26,fontSize:12},onClick:()=>{f.confirm(!0),i(f.id)},children:"Confirm"}),e.jsx("button",{className:"dhx dhx-btn dhx-btn-secondary",style:{height:26,fontSize:12},onClick:()=>{f.confirm(!1),i(f.id)},children:"Cancel"})]})]}),e.jsx("button",{onClick:()=>i(f.id),style:{background:"none",border:"none",cursor:"pointer",color:t.textMut,fontSize:14,lineHeight:1,padding:0},children:"×"})]},f.id)})})]})}function tt(){const r=u.useContext(xe);if(!r)throw new Error("useMessage must be used inside <MessageProvider>");return r}function rt({data:r=[],template:s,keyNavigation:p=!0,multiselection:i=!1,editable:x=!1,height:a=400,onSelect:f,onEdit:d,style:y}){const[m,n]=u.useState(new Set),[l,c]=u.useState(null),[b,w]=u.useState(""),[o,g]=u.useState(null);u.useEffect(X,[]);const k=(L,v)=>{const z=L.id??v;n(A=>{const h=i?new Set(A):new Set;return h.has(z)?h.delete(z):h.add(z),h}),g(v),f==null||f(L)},$=(L,v)=>{d==null||d({...L,value:b},v),c(null)};return e.jsxs("div",{className:"dhx dhx-scroll",style:{height:a,overflowY:"auto",border:`1px solid ${t.border}`,borderRadius:t.r,background:t.surface,...y},tabIndex:0,onKeyDown:L=>{p&&(L.key==="ArrowDown"&&g(v=>Math.min((v??-1)+1,r.length-1)),L.key==="ArrowUp"&&g(v=>Math.max((v??1)-1,0)))},children:[r.map((L,v)=>{const z=L.id??v,A=m.has(z),h=o===v;return e.jsx("div",{onClick:()=>k(L,v),onDoubleClick:()=>x&&(c(v),w(String(L.value||""))),style:{display:"flex",alignItems:"center",padding:"0 12px",height:40,cursor:"pointer",fontSize:13,borderBottom:`1px solid ${t.border}`,background:A?t.primaryLt:h?t.bg:t.surface,color:A?t.primary:t.text,outline:h?`2px solid ${t.primary}44`:"none",transition:"background .1s"},children:l===v?e.jsx("input",{autoFocus:!0,className:"dhx dhx-input",style:{height:28,flex:1},value:b,onChange:E=>w(E.target.value),onBlur:()=>$(L,v),onKeyDown:E=>{E.key==="Enter"&&$(L,v),E.key==="Escape"&&c(null)},onClick:E=>E.stopPropagation()}):s?e.jsx("div",{dangerouslySetInnerHTML:{__html:s(L)},style:{flex:1}}):e.jsx("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:String(L.value??"")})},String(z))}),r.length===0&&e.jsx("div",{style:{padding:24,textAlign:"center",color:t.textMut},children:"No items"})]})}function nt({data:r=[],template:s,itemsInRow:p=3,gap:i=12,multiselection:x=!1,onSelect:a,style:f}){const[d,y]=u.useState(new Set);u.useEffect(X,[]);const m=n=>{const l=n.id??String(n.title);y(c=>{const b=x?new Set(c):new Set;return b.has(l)?b.delete(l):b.add(l),b}),a==null||a(n)};return e.jsx("div",{className:"dhx",style:{display:"grid",gridTemplateColumns:`repeat(${p}, 1fr)`,gap:i,padding:i,...f},children:r.map((n,l)=>{const c=n.id??l,b=d.has(c);return e.jsx("div",{onClick:()=>m(n),style:{background:t.surface,border:`2px solid ${b?t.primary:t.border}`,borderRadius:t.rMd,overflow:"hidden",cursor:"pointer",transition:"all .15s",boxShadow:b?`0 0 0 3px ${t.primary}33`:t.shadow,transform:b?"translateY(-2px)":"none"},onMouseEnter:w=>{w.currentTarget.style.boxShadow=t.shadowLg,w.currentTarget.style.transform="translateY(-2px)"},onMouseLeave:w=>{w.currentTarget.style.boxShadow=b?`0 0 0 3px ${t.primary}33`:t.shadow,w.currentTarget.style.transform=b?"translateY(-2px)":"none"},children:s?e.jsx("div",{dangerouslySetInnerHTML:{__html:s(n)}}):e.jsxs("div",{style:{padding:16},children:[n.img&&e.jsx("img",{src:n.img,alt:n.title||"",style:{width:"100%",borderRadius:t.r,marginBottom:8,display:"block"}}),e.jsx("div",{style:{fontWeight:600,fontSize:14,marginBottom:4},children:n.title||n.value}),n.subtitle&&e.jsx("div",{style:{fontSize:12,color:t.textSec},children:n.subtitle})]})},String(c))})})}function ge(r){return r.map(s=>({...s,items:s.items?ge(s.items):void 0}))}function ye(r,s={}){return r.forEach(p=>{p.opened&&(s[p.id]=!0),p.items&&ye(p.items,s)}),s}function Ee(r,s){let p=null;return[r.filter(x=>x.id===s?(p=x,!1):!0).map(x=>{if(x.items){const[a,f]=Ee(x.items,s);return f&&(p=f),{...x,items:a}}return x}),p]}function be(r,s,p,i){if(i==="inside")return r.map(a=>a.id===s?{...a,items:[...a.items||[],p]}:a.items?{...a,items:be(a.items,s,p,i)}:a);if(r.some(a=>a.id===s)){const a=[];for(const f of r)f.id===s?i==="before"?(a.push(p),a.push(f)):(a.push(f),a.push(p)):a.push(f);return a}return r.map(a=>a.items?{...a,items:be(a.items,s,p,i)}:a)}function ot(r,s,p){function i(x){var a,f;if(x.id===s){const d=y=>{var m;return y.id===p||(((m=y.items)==null?void 0:m.some(d))??!1)};return((a=x.items)==null?void 0:a.some(d))??!1}return((f=x.items)==null?void 0:f.some(i))??!1}return r.some(i)}function Le(r,s,p){return r.map(i=>i.id===s?{...i,value:p}:{...i,items:i.items?Le(i.items,s,p):void 0})}function st(r,s){var a;let p=0,i=0;const x=f=>{var d;p++,s[f.id]&&i++,(d=f.items)==null||d.forEach(x)};return(a=r.items)==null||a.forEach(x),{total:p,checkedCount:i}}function lt({data:r=[],checkbox:s=!1,editable:p=!1,dragMode:i,tooltip:x,onSelect:a,onCheck:f,onChange:d,style:y}){const[m,n]=u.useState(()=>ge(r)),[l,c]=u.useState(()=>ye(r)),[b,w]=u.useState(null),[o,g]=u.useState({}),[k,$]=u.useState(null),[L,v]=u.useState(""),[z,A]=u.useState(null),[h,E]=u.useState(null);u.useEffect(X,[]),u.useEffect(()=>{n(ge(r)),c(M=>({...ye(r),...M}))},[r]);const T=M=>c(B=>({...B,[M]:!B[M]})),D=(M,B)=>{g(O=>({...O,[M]:B})),f==null||f(M,B)},j=()=>{if(!k)return;const M=k,B=L;$(null),n(O=>{const F=Le(O,M,B);return d==null||d(F),F})},G=(M,B)=>{M.dataTransfer.effectAllowed="move",A(B)},Q=(M,B)=>{if(!z||z===B||ot(m,z,B))return;M.preventDefault();const O=M.currentTarget.getBoundingClientRect(),F=M.clientY-O.top,Y=O.height,U=F<Y*.25?"before":F>Y*.75?"after":"inside";E(q=>(q==null?void 0:q.id)===B&&(q==null?void 0:q.pos)===U?q:{id:B,pos:U})},Z=(M,B)=>{if(M.preventDefault(),!z||!h||z===B){E(null),A(null);return}n(O=>{const[F,Y]=Ee(O,z);if(!Y)return O;const U=be(F,B,Y,h.pos);return d==null||d(U),U}),h.pos==="inside"&&c(O=>({...O,[B]:!0})),E(null),A(null)},R=()=>{A(null),E(null)},I=(M,B=0)=>{var ae;const O=(((ae=M.items)==null?void 0:ae.length)??0)>0,F=l[M.id],Y=b===M.id,U=z===M.id,q=(h==null?void 0:h.id)===M.id;let oe=!!o[M.id],ee=!1;if(s&&O){const{total:P,checkedCount:te}=st(M,o);te>0&&te<P?ee=!0:P>0&&te===P&&(oe=!0)}const se=q&&h.pos!=="inside"?{boxShadow:h.pos==="before"?`inset 0 2px 0 0 ${t.primary}`:`inset 0 -2px 0 0 ${t.primary}`}:{},le=q&&h.pos==="inside"||Y?t.primaryLt:"transparent";return e.jsxs("div",{style:{opacity:U?.4:1},children:[e.jsxs("div",{draggable:!!i,onDragStart:i?P=>G(P,M.id):void 0,onDragOver:i?P=>Q(P,M.id):void 0,onDrop:i?P=>Z(P,M.id):void 0,onDragEnd:i?R:void 0,title:x==null?void 0:x(M),onClick:()=>{w(M.id),a==null||a(M),O&&T(M.id)},onDoubleClick:()=>{p&&($(M.id),v(M.value||""))},style:{display:"flex",alignItems:"center",gap:4,padding:`5px 8px 5px ${12+B*18}px`,cursor:i?"grab":"pointer",borderRadius:t.r,margin:"1px 4px",background:le,color:Y?t.primary:t.text,userSelect:"none",fontSize:13,...se},onMouseEnter:P=>!Y&&!q&&(P.currentTarget.style.background=t.bg),onMouseLeave:P=>!Y&&!q&&(P.currentTarget.style.background="transparent"),children:[e.jsx("span",{style:{width:16,textAlign:"center",fontSize:11,color:t.textMut,flexShrink:0},onClick:P=>{P.stopPropagation(),O&&T(M.id)},children:O?F?"▾":"▸":""}),e.jsx("span",{style:{fontSize:15,flexShrink:0},children:O?F?"📂":"📁":"📄"}),s&&e.jsx("input",{ref:P=>{P&&(P.indeterminate=ee)},type:"checkbox",checked:oe,onChange:P=>{P.stopPropagation(),D(M.id,P.target.checked)},style:{cursor:"pointer",accentColor:t.primary,flexShrink:0},onClick:P=>P.stopPropagation()}),k===M.id?e.jsx("input",{autoFocus:!0,className:"dhx dhx-input",style:{height:24,fontSize:12,flex:1},value:L,onChange:P=>v(P.target.value),onBlur:j,onKeyDown:P=>{P.key==="Enter"&&j(),P.key==="Escape"&&$(null)},onClick:P=>P.stopPropagation()}):e.jsx("span",{style:{flex:1},children:M.value}),M.count!==void 0&&e.jsxs("span",{style:{fontSize:11,color:t.textMut},children:["(",M.count,")"]})]}),O&&F&&e.jsx("div",{children:M.items.map(P=>I(P,B+1))})]},M.id)};return e.jsx("div",{className:"dhx dhx-scroll",style:{overflowY:"auto",...y},onDragOver:i?M=>M.preventDefault():void 0,onDrop:i?M=>{M.preventDefault(),E(null),A(null)}:void 0,children:m.map(M=>I(M))})}function it({total:r,pageSize:s=10,page:p,onChange:i,style:x}){const[a,f]=u.useState(p||1),d=Math.ceil(r/s);u.useEffect(X,[]);const y=n=>{const l=Math.min(Math.max(1,n),d);f(l),i==null||i(l)},m=u.useMemo(()=>{const n=[];for(let c=Math.max(1,a-2);c<=Math.min(d,a+2);c++)n.push(c);return n[0]>1&&(n[0]>2&&n.unshift("..."),n.unshift(1)),n[n.length-1]<d&&(n[n.length-1]<d-1&&n.push("..."),n.push(d)),n},[a,d]);return e.jsxs("div",{className:"dhx",style:{display:"flex",alignItems:"center",gap:4,padding:"8px 12px",...x},children:[e.jsxs("span",{style:{fontSize:12,color:t.textSec,marginRight:8},children:[(a-1)*s+1,"–",Math.min(a*s,r)," of ",r]}),[["«",1],["‹",a-1]].map(([n,l])=>e.jsx("button",{className:"dhx dhx-btn dhx-btn-ghost",style:{height:30,padding:"0 8px",fontSize:14},disabled:a===1,onClick:()=>y(l),children:n},n)),m.map((n,l)=>e.jsx("button",{onClick:()=>typeof n=="number"&&y(n),className:`dhx dhx-btn ${n===a?"dhx-btn-primary":"dhx-btn-ghost"}`,style:{height:30,minWidth:30,padding:"0 8px",fontSize:13},disabled:n==="...",children:n},l)),[["›",a+1],["»",d]].map(([n,l])=>e.jsx("button",{className:"dhx dhx-btn dhx-btn-ghost",style:{height:30,padding:"0 8px",fontSize:14},disabled:a===d,onClick:()=>y(l),children:n},n))]})}function at({config:r={},defaultValues:s={},onSubmit:p,style:i}){const[x,a]=u.useState(s),[f,d]=u.useState({}),[y,m]=u.useState(null);u.useEffect(X,[]);const n=(o,g)=>{a(k=>({...k,[o]:g})),d(k=>({...k,[o]:null}))},l=o=>{const g=[];return o.flat().forEach(k=>{!k||typeof k!="object"||!("name"in k)||(g.push(k),k.type==="fieldset"&&k.rows&&g.push(...l(k.rows)))}),g},c=()=>{const o={};return l(r.rows||[]).forEach(g=>{g.required&&!x[g.name]&&(o[g.name]=`${g.label||g.name} is required`)}),d(o),Object.keys(o).length===0},b=o=>{const g=x[o.name]??o.value??"",k=f[o.name],$=o.labelWidth??r.labelWidth,L=$!==void 0||o.labelPosition==="left";if(o.type==="fieldset")return e.jsxs("fieldset",{style:{border:`1px solid ${t.border}`,borderRadius:t.r,padding:"12px 16px",marginBottom:14},children:[e.jsx("legend",{style:{fontSize:12,fontWeight:700,color:t.textSec,padding:"0 6px"},children:o.label}),(o.rows||[]).map(D=>b(D))]},o.name);if(o.type==="spacer")return e.jsx("div",{style:{height:o.height||16}},o.name);const v=$?{minWidth:$,width:$,flexShrink:0,paddingTop:8,boxSizing:"border-box"}:{},z=o.label?e.jsxs("label",{className:"dhx dhx-label",style:{display:"flex",gap:4,...v},children:[o.label,o.required&&e.jsx("span",{style:{color:t.danger},children:"*"})]},"lbl"):null,A=k?e.jsx("div",{style:{fontSize:11,color:t.danger,marginTop:3},children:k}):null,h=o.helpMessage?e.jsxs("div",{style:{fontSize:11,color:t.textMut,marginTop:3},children:["ⓘ ",o.helpMessage]}):null,E={key:o.name,className:"dhx-form-group"},T=D=>L?e.jsxs("div",{...E,style:{display:"flex",alignItems:"flex-start",gap:8},children:[z,e.jsxs("div",{style:{flex:1,minWidth:0},children:[D,A,h]})]}):e.jsxs("div",{...E,children:[z,D,A,h]});if(!o.type||o.type==="input")return T(e.jsxs("div",{className:"dhx-input-wrap",children:[o.icon&&e.jsx("span",{className:"dhx-input-icon",children:o.icon}),e.jsx("input",{className:`dhx dhx-input${o.icon?" dhx-input--with-icon":""}`,style:{borderColor:k?t.danger:void 0},type:o.inputType||"text",placeholder:o.placeholder,value:g,onChange:D=>n(o.name,D.target.value),disabled:o.disabled})]}));if(o.type==="textarea")return T(e.jsx("textarea",{className:"dhx dhx-input",style:{height:80,resize:"vertical",padding:"8px 10px"},placeholder:o.placeholder,value:g,onChange:D=>n(o.name,D.target.value)}));if(o.type==="select")return T(e.jsxs("select",{className:"dhx dhx-input",value:g,onChange:D=>n(o.name,D.target.value),style:{cursor:"pointer"},children:[e.jsx("option",{value:"",children:"— Select —"}),(o.options||[]).map(D=>e.jsx("option",{value:D.value,children:D.label||D.value},D.value))]}));if(o.type==="datepicker")return T(e.jsx("input",{type:"date",className:"dhx dhx-input",value:g,onChange:D=>n(o.name,D.target.value)}));if(o.type==="timepicker"){const D=x[o.name]??{h:12,m:0,ampm:"AM"},j=!!x[o.name],G=j?`${String(D.h).padStart(2,"0")}:${String(D.m).padStart(2,"0")}${D.ampm?" "+D.ampm:""}`:o.placeholder||"Click to select",Q=e.jsxs("div",{style:{position:"relative"},children:[e.jsxs("div",{className:"dhx dhx-input",style:{cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"space-between"},onClick:()=>m(y===o.name?null:o.name),children:[e.jsx("span",{style:{color:j?t.text:t.textMut},children:G}),e.jsx("span",{style:{fontSize:13,color:t.textSec},children:"🕐"})]}),y===o.name&&e.jsx("div",{style:{position:"absolute",zIndex:100,top:"calc(100% + 4px)",left:0},children:e.jsx($e,{value:D,controls:!0,onChange:Z=>{n(o.name,Z),m(null)}})})]});return T(Q)}if(o.type==="colorpicker")return T(e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[e.jsx("input",{type:"color",value:g||"#000000",onChange:D=>n(o.name,D.target.value),style:{width:36,height:36,padding:2,border:`1px solid ${t.border}`,borderRadius:t.r,cursor:"pointer",background:"none"}}),e.jsx("span",{style:{fontSize:12,color:t.textSec,fontFamily:"monospace"},children:g||"#000000"})]}));if(o.type==="text")return T(e.jsx("p",{style:{margin:"6px 0",fontSize:13,color:t.text},children:o.value}));if(o.type==="checkbox")return e.jsxs("div",{...E,children:[L?e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[$&&e.jsx("div",{style:{width:$,flexShrink:0}}),e.jsxs("label",{style:{display:"flex",alignItems:"center",gap:8,cursor:"pointer"},children:[e.jsx("input",{type:"checkbox",checked:!!g,onChange:D=>n(o.name,D.target.checked),style:{width:16,height:16,accentColor:t.primary,cursor:"pointer"}}),e.jsx("span",{style:{fontSize:13},children:o.label})]})]}):e.jsxs("label",{style:{display:"flex",alignItems:"center",gap:8,cursor:"pointer"},children:[e.jsx("input",{type:"checkbox",checked:!!g,onChange:D=>n(o.name,D.target.checked),style:{width:16,height:16,accentColor:t.primary,cursor:"pointer"}}),e.jsx("span",{style:{fontSize:13},children:o.label})]}),h]});if(o.type==="radio"){const D=(o.options||[]).map(j=>e.jsxs("label",{style:{display:"flex",alignItems:"center",gap:6,cursor:"pointer",fontSize:13},children:[e.jsx("input",{type:"radio",name:o.name,value:j.value,checked:g===j.value,onChange:()=>n(o.name,j.value),style:{accentColor:t.primary,cursor:"pointer"}}),j.label||j.value]},j.value));return T(e.jsx("div",{style:{display:"flex",gap:16,flexWrap:"wrap",paddingTop:8},children:D}))}if(o.type==="slider")return L?e.jsxs("div",{...E,style:{display:"flex",alignItems:"flex-start",gap:8},children:[z,e.jsxs("div",{style:{flex:1},children:[e.jsx(fe,{min:o.min,max:o.max,step:o.step,value:g||o.min,range:o.range,onChange:D=>n(o.name,D)}),h]})]}):e.jsxs("div",{...E,children:[e.jsx(fe,{label:o.label,min:o.min,max:o.max,step:o.step,value:g||o.min,range:o.range,onChange:D=>n(o.name,D)}),h]});if(o.type==="combo")return L?e.jsxs("div",{...E,style:{display:"flex",alignItems:"flex-start",gap:8},children:[z,e.jsxs("div",{style:{flex:1},children:[e.jsx(he,{data:o.data||[],multiselection:o.multiselection,placeholder:o.placeholder||"Select...",value:g||(o.multiselection?[]:null),onChange:D=>n(o.name,D)}),A,h]})]}):e.jsxs("div",{...E,children:[e.jsx(he,{label:o.label,data:o.data||[],multiselection:o.multiselection,placeholder:o.placeholder||"Select...",value:g||(o.multiselection?[]:null),onChange:D=>n(o.name,D)}),A,h]});if(o.type==="toggle"){const D=!!g,j=D?o.icon:o.offIcon||o.icon,G=D?o.text||o.label:o.offText||o.text||o.label;return e.jsxs("div",{...E,children:[L&&$&&e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[e.jsx("div",{style:{width:$,flexShrink:0}}),e.jsxs("label",{style:{display:"flex",alignItems:"center",gap:8,cursor:"pointer"},children:[e.jsx(Ie,{on:D,onClick:()=>n(o.name,!g)}),j&&e.jsx("span",{style:{fontSize:16},children:j}),G&&e.jsx("span",{style:{fontSize:13},children:G})]})]}),!L&&e.jsxs("label",{style:{display:"flex",alignItems:"center",gap:10,cursor:"pointer"},children:[e.jsx(Ie,{on:D,onClick:()=>n(o.name,!g)}),j&&e.jsx("span",{style:{fontSize:16},children:j}),G&&e.jsx("span",{style:{fontSize:13},children:G})]}),h]})}return null},w=o=>o.map((g,k)=>Array.isArray(g)?e.jsx("div",{style:{display:"flex",gap:12,alignItems:"flex-start"},children:g.map(b)},k):b(g));return e.jsxs("div",{className:"dhx",style:{padding:r.padding||0,width:r.width||"100%",...i},children:[w(r.rows||[]),(r.buttons||p)&&e.jsxs("div",{style:{display:"flex",gap:8,justifyContent:r.buttonAlign||"flex-start",marginTop:8},children:[e.jsx("button",{className:"dhx dhx-btn dhx-btn-primary",onClick:()=>c()&&(p==null?void 0:p(x)),children:r.submitText||"Submit"}),r.resetButton!==!1&&e.jsx("button",{className:"dhx dhx-btn dhx-btn-secondary",onClick:()=>{a(s),d({})},children:r.resetText||"Reset"})]})]})}function Ie({on:r,onClick:s}){return e.jsxs("div",{style:{position:"relative",width:40,height:22,flexShrink:0},onClick:s,children:[e.jsx("div",{style:{width:40,height:22,borderRadius:11,background:r?t.primary:t.border,transition:"background 0.2s"}}),e.jsx("div",{style:{position:"absolute",top:3,left:r?21:3,width:16,height:16,borderRadius:"50%",background:"#fff",transition:"left 0.2s",boxShadow:"0 1px 3px rgba(0,0,0,.3)"}})]})}function ve(r){const s=[];for(const p of r)p.type==="block"?s.push(...ve(p.items||[])):s.push(p);return s}function dt({items:r=[],onAction:s,style:p}){u.useEffect(X,[]);const[i,x]=u.useState(()=>{const l={};for(const c of ve(r))c.id&&(l[c.id]=!!c.active);return l}),a=ve(r),f=l=>{var c;if(!l.disabled){if(l.id)if(l.group){const b=a.filter(w=>w.group===l.group&&w.id);x(w=>{const o={...w};for(const g of b)o[g.id]=!1;return o[l.id]=!0,o})}else l.twoState&&x(b=>({...b,[l.id]:!b[l.id]}));(c=l.onClick)==null||c.call(l,l),l.id&&(s==null||s(l.id,l))}},d=(l,c)=>{var g;if(l.hidden)return null;const b=l.value??l.text,w=l.size==="auto",o=l.id!==void 0?i[l.id]??!!l.active:!!l.active;return l.type==="separator"||l.type==="sep"?e.jsx("div",{style:{width:1,background:t.border,margin:"4px 2px",alignSelf:"stretch"}},c):l.type==="input"?e.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"flex-start",justifyContent:"center",padding:"2px 4px",gap:2},children:[l.label&&e.jsx("span",{style:{fontSize:10,color:t.textMut},children:l.label}),e.jsxs("div",{style:{position:"relative",display:"flex",alignItems:"center"},children:[l.icon&&e.jsx("span",{style:{position:"absolute",left:6,fontSize:13,color:t.textMut,pointerEvents:"none",zIndex:1},children:l.icon}),e.jsx("input",{className:"dhx dhx-input",style:{width:l.width||110,height:26,fontSize:12,paddingLeft:l.icon?24:void 0},placeholder:l.placeholder,defaultValue:l.value,onChange:k=>{var $;return($=l.onChange)==null?void 0:$.call(l,k.target.value)}})]})]},c):l.type==="selectButton"?e.jsx("select",{className:"dhx dhx-input",style:{height:26,fontSize:12,cursor:"pointer",margin:2,width:l.width},defaultValue:l.value,onChange:k=>{var $;return($=l.onChange)==null?void 0:$.call(l,k.target.value)},children:(g=l.items)==null?void 0:g.map(k=>e.jsx("option",{value:k.value,children:k.value},k.value))},c):e.jsxs("button",{title:l.tooltip,disabled:l.disabled,className:"dhx dhx-btn dhx-btn-ghost",style:{flexDirection:w?"column":"row",alignSelf:w?"stretch":"center",justifyContent:"center",minHeight:w?48:26,padding:w?"6px 10px":"0 8px",gap:w?4:5,position:"relative",background:o?t.primaryLt:"transparent",color:o?t.primary:l.disabled?t.textMut:t.text,opacity:l.disabled?.55:1,cursor:l.disabled?"not-allowed":"pointer"},onClick:()=>f(l),children:[l.icon&&e.jsx("span",{style:{fontSize:w?22:15,lineHeight:1,flexShrink:0},children:l.icon}),b&&e.jsx("span",{style:{fontSize:10,maxWidth:w?64:void 0,textAlign:w?"center":"left",lineHeight:1.2,whiteSpace:w?"normal":"nowrap"},children:b}),l.count!==void 0&&e.jsx("span",{style:{position:"absolute",top:2,right:2,minWidth:14,height:14,background:t.danger,color:"#fff",borderRadius:7,fontSize:9,fontWeight:700,display:"flex",alignItems:"center",justifyContent:"center",padding:"0 2px",pointerEvents:"none"},children:l.count})]},c)},y=(l,c)=>{var b;return e.jsx("div",{style:{display:"flex",flexDirection:l.direction==="col"?"column":"row",alignItems:l.direction==="col"?"flex-start":"center",gap:2},children:(b=l.items)==null?void 0:b.map((w,o)=>w.type==="block"?y(w,`${c}-${o}`):d(w,`${c}-${o}`))},c)},m=(l,c)=>{var w;const b=l.title||l.label;return e.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"stretch",borderRight:`1px solid ${t.border}`,padding:"4px 6px 0",minWidth:40},children:[e.jsx("div",{style:{display:"flex",flexDirection:l.direction==="col"?"column":"row",alignItems:l.direction==="col"?"stretch":"center",gap:2,flex:1},children:(w=l.items)==null?void 0:w.map((o,g)=>o.type==="block"?y(o,g):d(o,g))}),b&&e.jsx("div",{style:{fontSize:10,color:t.textMut,textAlign:"center",padding:"3px 0 4px",marginTop:2,borderTop:`1px solid ${t.border}`},children:b})]},c)},n=(l,c)=>l.type==="block"?m(l,c):d(l,c);return e.jsx("div",{className:"dhx",style:{display:"flex",alignItems:"stretch",background:t.surface,borderBottom:`1px solid ${t.border}`,overflowX:"auto",gap:0,minHeight:72,...p},children:r.map(n)})}function Te({count:r}){return e.jsx("span",{style:{position:"absolute",top:3,right:3,minWidth:16,height:16,background:t.danger,color:"#fff",borderRadius:8,fontSize:10,fontWeight:700,display:"flex",alignItems:"center",justifyContent:"center",padding:"0 3px",lineHeight:1,pointerEvents:"none"},children:r})}function ct({logo:r,items:s=[],vertical:p=!1,onAction:i,style:x}){const[a,f]=u.useState(null),[d,y]=u.useState(()=>{const c={};return s.forEach(b=>{b.id&&b.twoState&&b.active&&(c[b.id]=!0)}),c}),m=u.useRef(null);u.useEffect(X,[]),re(m,u.useCallback(()=>f(null),[]));const n=(c,b)=>{var w,o;if(!c.disabled){if(c.twoState&&c.id&&y(g=>({...g,[c.id]:!g[c.id]})),(w=c.items)!=null&&w.length){f(g=>g===b?null:b);return}(o=c.onClick)==null||o.call(c,c.id||""),i==null||i(c.id||"")}},l=(c,b)=>{var k;if(c.hidden)return null;if(c.type==="separator")return e.jsx("div",{style:{[p?"height":"width"]:1,background:t.border,margin:p?"4px 8px":"0 6px",alignSelf:"stretch"}},b);if(c.type==="spacer")return e.jsx("div",{style:{flex:1}},b);if(c.type==="input")return e.jsxs("div",{style:{position:"relative",display:"flex",alignItems:"center",margin:"0 4px"},children:[c.icon&&e.jsx("span",{style:{position:"absolute",left:8,color:t.textMut,fontSize:15,pointerEvents:"none",zIndex:1},children:c.icon}),e.jsx("input",{className:"dhx dhx-input",style:{width:c.width||200,height:28,paddingLeft:c.icon?30:void 0},placeholder:c.placeholder,onChange:$=>{var L;return(L=c.onChange)==null?void 0:L.call(c,$.target.value)}})]},b);if(c.type==="imageButton")return e.jsxs("button",{title:c.tooltip,disabled:c.disabled,style:{position:"relative",width:36,height:36,padding:2,border:"none",borderRadius:"50%",overflow:"hidden",cursor:c.disabled?"not-allowed":"pointer",background:"transparent",flexShrink:0},onClick:()=>n(c,b),children:[c.src&&e.jsx("img",{src:c.src,alt:c.value||"",style:{width:"100%",height:"100%",objectFit:"cover",borderRadius:"50%"}}),c.count!==void 0&&e.jsx(Te,{count:c.count})]},b);const w=!!(c.twoState&&c.id&&d[c.id]),o=!!((k=c.items)!=null&&k.length),g={position:"relative",height:p?40:36,gap:6,background:w?t.primaryLt:"transparent",color:w?t.primary:c.disabled?t.textMut:t.text,opacity:c.disabled?.55:1,cursor:c.disabled?"not-allowed":"pointer",...p?{width:"100%",justifyContent:"flex-start",padding:"0 16px",borderRadius:0}:{}};return e.jsxs("div",{style:{position:"relative"},children:[e.jsxs("button",{className:"dhx dhx-btn dhx-btn-ghost",title:c.tooltip,disabled:c.disabled,style:g,onClick:()=>n(c,b),children:[c.icon&&e.jsx("span",{style:{fontSize:16,flexShrink:0},children:c.icon}),c.value&&e.jsx("span",{style:{fontSize:13},children:c.value}),o&&e.jsx("span",{style:{fontSize:9,opacity:.55,marginLeft:2},children:"▼"}),c.count!==void 0&&e.jsx(Te,{count:c.count})]}),o&&a===b&&e.jsx(ie,{items:c.items,onSelect:$=>{var L;f(null),$.id&&((L=c.onClick)==null||L.call(c,$.id),i==null||i($.id))},style:p?{left:"100%",top:0}:{top:"100%"}})]},b)};return e.jsxs("nav",{ref:m,className:"dhx",style:{display:"flex",flexDirection:p?"column":"row",alignItems:p?"stretch":"center",background:t.surface,borderBottom:p?"none":`1px solid ${t.border}`,borderRight:p?`1px solid ${t.border}`:"none",padding:p?"8px 0":"0 12px",minHeight:p?void 0:48,gap:2,...x},children:[r&&e.jsx("div",{style:{color:t.text,fontWeight:800,fontSize:16,padding:p?"8px 16px 12px":"0 12px 0 4px",borderBottom:p?`1px solid ${t.border}`:"none",borderRight:p?"none":`1px solid ${t.border}`,marginRight:p?0:8,marginBottom:p?4:0,flexShrink:0},children:r}),s.map(l)]})}H.Button=We,H.Calendar=qe,H.Chart=Ve,H.Colorpicker=Ue,H.Combobox=he,H.ContextMenu=Be,H.DataView=nt,H.Form=at,H.Grid=Fe,H.Layout=ze,H.List=rt,H.Menu=Ae,H.MenuDropdown=ie,H.MessageContext=xe,H.MessageProvider=et,H.Navbar=ct,H.Pagination=it,H.Popup=Qe,H.Ribbon=dt,H.Sidebar=Pe,H.Slider=fe,H.Tabbar=Oe,H.Timepicker=$e,H.Toolbar=He,H.Tree=lt,H.Window=Ze,H.tokens=t,H.useClickOutside=re,H.useDrag=me,H.useMessage=tt,Object.defineProperty(H,Symbol.toStringTag,{value:"Module"})});
41
+ `,document.head.appendChild(r)}const _e={sm:{height:24,padding:"0 8px",fontSize:12},md:{},lg:{height:38,padding:"0 18px",fontSize:14}};function Ve({children:r,variant:o="primary",size:d="md",icon:l,disabled:f,onClick:a,style:u,className:p=""}){return g.useEffect(q,[]),e.jsxs("button",{className:`dhx dhx-btn dhx-btn-${o} ${p}`,style:{..._e[d],...u},disabled:f,onClick:a,children:[l&&e.jsx("span",{style:{fontSize:16},children:l}),r]})}function ce(r,o){g.useEffect(()=>{const d=l=>{r.current&&!r.current.contains(l.target)&&o(l)};return document.addEventListener("mousedown",d),()=>document.removeEventListener("mousedown",d)},[r,o])}function Ee(r){const o=g.useRef(!1),d=g.useRef({x:0,y:0,ox:0,oy:0});return g.useCallback((l,f=0,a=0)=>{o.current=!0,d.current={x:l.clientX,y:l.clientY,ox:f,oy:a};const u=x=>{if(!o.current)return;const{x:m,y:n,ox:s,oy:c}=d.current;r(s+x.clientX-m,c+x.clientY-n)},p=()=>{o.current=!1,document.removeEventListener("mousemove",u),document.removeEventListener("mouseup",p)};document.addEventListener("mousemove",u),document.addEventListener("mouseup",p),l.preventDefault()},[r])}function he({items:r,onSelect:o,style:d}){const[l,f]=g.useState(null);return e.jsx("div",{className:"dhx dhx-anim-fade",style:{position:"absolute",top:"calc(100% + 4px)",left:0,minWidth:180,background:t.surface,border:`1px solid ${t.border}`,borderRadius:t.r,boxShadow:t.shadowLg,zIndex:200,padding:"4px 0",...d},children:r.map((a,u)=>{var x,m;if(a.type==="separator")return e.jsx("div",{style:{height:1,background:t.border,margin:"4px 0"}},u);const p=l===u;return e.jsxs("div",{style:{position:"relative"},onMouseEnter:()=>f(u),onMouseLeave:()=>f(null),children:[e.jsxs("div",{onClick:()=>{var n;return!a.disabled&&!((n=a.items)!=null&&n.length)&&o(a)},style:{display:"flex",alignItems:"center",gap:8,padding:"8px 14px",cursor:a.disabled?"not-allowed":"pointer",fontSize:13,color:a.disabled?t.textMut:t.text,background:p&&!a.disabled?t.bg:"transparent",opacity:a.disabled?.5:1},children:[a.icon&&e.jsx("span",{style:{fontSize:15,width:18,textAlign:"center"},children:a.icon}),e.jsx("span",{style:{flex:1},children:a.value||a.id}),a.hotkey&&e.jsx("span",{style:{fontSize:11,color:t.textMut},children:a.hotkey}),(x=a.items)!=null&&x.length?e.jsx("span",{style:{fontSize:10,color:t.textMut},children:"▶"}):null]}),p&&((m=a.items)!=null&&m.length)?e.jsx(he,{items:a.items,onSelect:o,style:{position:"absolute",left:"100%",top:-4}}):null]},a.id||u)})})}function Xe({items:r=[],label:o="Menu",onSelect:d,style:l}){const[f,a]=g.useState(!1),u=g.useRef(null);return g.useEffect(q,[]),ce(u,g.useCallback(()=>a(!1),[])),e.jsxs("div",{ref:u,className:"dhx",style:{position:"relative",display:"inline-block",...l},children:[e.jsxs("button",{className:"dhx dhx-btn dhx-btn-secondary",onClick:()=>a(p=>!p),children:[o," ",e.jsx("span",{style:{fontSize:10},children:f?"▲":"▼"})]}),f&&e.jsx(he,{items:r,onSelect:p=>{d==null||d(p),a(!1)}})]})}function qe({items:r=[],onSelect:o,children:d}){const[l,f]=g.useState(null),a=g.useRef(null);g.useEffect(q,[]),ce(a,g.useCallback(()=>f(null),[]));const u=p=>{p.preventDefault(),f({x:p.clientX,y:p.clientY})};return e.jsxs("div",{ref:a,onContextMenu:u,style:{position:"relative",display:"contents"},children:[d,l&&e.jsx("div",{style:{position:"fixed",left:l.x,top:l.y,zIndex:9999},children:e.jsx(he,{items:r,onSelect:p=>{o==null||o(p),f(null)}})})]})}function Le({count:r}){return e.jsx("span",{style:{position:"absolute",top:2,right:2,minWidth:16,height:16,background:t.danger,color:"#fff",borderRadius:8,fontSize:10,fontWeight:700,display:"flex",alignItems:"center",justifyContent:"center",padding:"0 3px",lineHeight:1,pointerEvents:"none"},children:r})}function Ge({items:r=[],onAction:o,style:d}){const[l,f]=g.useState(null),[a,u]=g.useState(()=>{const n={};return r.forEach(s=>{s.id&&(s.twoState||s.group)&&s.active&&(n[s.id]=!0)}),n}),p=g.useRef(null);g.useEffect(q,[]),ce(p,g.useCallback(()=>f(null),[]));const x=(n,s)=>{var c,v;if(!n.disabled){if(n.twoState&&n.id&&u(w=>({...w,[n.id]:!w[n.id]})),n.group&&n.id&&u(w=>{const i={...w};return r.forEach(b=>{b.group===n.group&&b.id&&(i[b.id]=!1)}),i[n.id]=!0,i}),(c=n.items)!=null&&c.length){f(w=>w===s?null:s);return}(v=n.onClick)==null||v.call(n,n.id||""),o==null||o(n.id||"")}},m=(n,s)=>{var i,b;if(n.hidden)return null;if(n.type==="separator")return e.jsx("div",{style:{width:1,background:t.border,margin:"6px 4px",alignSelf:"stretch"}},s);if(n.type==="spacer")return e.jsx("div",{style:{flex:1}},s);if(n.type==="input")return e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6},children:[n.label&&e.jsx("span",{style:{fontSize:12,color:t.textSec,fontWeight:500},children:n.label}),e.jsxs("div",{style:{position:"relative",display:"flex",alignItems:"center"},children:[n.icon&&e.jsx("span",{style:{position:"absolute",left:8,color:t.textMut,fontSize:15,pointerEvents:"none",zIndex:1},children:n.icon}),e.jsx("input",{className:"dhx dhx-input",style:{width:n.width||140,height:28,paddingLeft:n.icon?30:void 0},placeholder:n.placeholder,defaultValue:n.value,onChange:z=>{var $;return($=n.onChange)==null?void 0:$.call(n,z.target.value)}})]})]},s);if(n.type==="select")return e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6},children:[n.label&&e.jsx("span",{style:{fontSize:12,color:t.textSec,fontWeight:500},children:n.label}),e.jsx("select",{className:"dhx dhx-input",style:{width:n.width||100,height:28,cursor:"pointer"},defaultValue:n.value,onChange:z=>{var $;return($=n.onChange)==null?void 0:$.call(n,z.target.value)},children:(i=n.options)==null?void 0:i.map(z=>e.jsx("option",{value:z.value,children:z.label},z.value))})]},s);if(n.type==="imageButton")return e.jsxs("button",{title:n.tooltip,disabled:n.disabled,style:{position:"relative",width:32,height:32,padding:2,border:"none",borderRadius:"50%",overflow:"hidden",cursor:n.disabled?"not-allowed":"pointer",background:"transparent",flexShrink:0},onClick:()=>x(n,s),children:[n.src&&e.jsx("img",{src:n.src,alt:n.value||"",style:{width:"100%",height:"100%",objectFit:"cover",borderRadius:"50%"}}),n.count!==void 0&&e.jsx(Le,{count:n.count})]},s);const c=!!(n.id&&a[n.id]),v=n.value??n.text,w=!!((b=n.items)!=null&&b.length);return e.jsxs("div",{style:{position:"relative"},children:[e.jsxs("button",{className:"dhx dhx-btn dhx-btn-ghost",title:n.tooltip,disabled:n.disabled,style:{height:32,gap:4,position:"relative",background:c?t.primaryLt:"transparent",color:c?t.primary:n.disabled?t.textMut:t.text,opacity:n.disabled?.55:1,cursor:n.disabled?"not-allowed":"pointer"},onClick:()=>x(n,s),children:[n.icon&&e.jsx("span",{style:{fontSize:16},children:n.icon}),v&&e.jsx("span",{style:{fontSize:13},children:v}),w&&e.jsx("span",{style:{fontSize:9,opacity:.55,marginLeft:2},children:"▼"}),n.count!==void 0&&e.jsx(Le,{count:n.count})]}),w&&l===s&&e.jsx(he,{items:n.items,onSelect:()=>f(null),style:{top:"100%",left:0}})]},s)};return e.jsx("div",{ref:p,className:"dhx",style:{display:"flex",alignItems:"center",gap:2,padding:"4px 8px",background:t.surface,borderBottom:`1px solid ${t.border}`,minHeight:44,flexWrap:"wrap",...d},children:r.map(m)})}function Je(r){return r==="primary"?t.primary:r==="success"?"#43a047":r==="secondary"?"#9e9e9e":"#e53935"}function Ue(r,o){const d=[],l=f=>{var a;f.id&&f.group===o&&d.push(f.id),(a=f.items)==null||a.forEach(l)};return r.forEach(l),d}function Qe(r){const o={},d=l=>{var f;l.id&&l.twoState&&l.active&&(o[l.id]=!0),(f=l.items)==null||f.forEach(d)};return r.forEach(d),o}function Ze({items:r=[],width:o=240,minWidth:d=64,header:l,footer:f,collapsed:a,defaultCollapsed:u,selected:p,defaultSelected:x,onSelect:m,onCollapse:n,onExpand:s,onBeforeCollapse:c,onBeforeExpand:v,onToggleItem:w,style:i}){const b=a!==void 0,z=p!==void 0,[$,N]=g.useState(u??!1),[M,D]=g.useState(x??null),[F,h]=g.useState({}),[L,W]=g.useState(()=>Qe(r));g.useEffect(q,[]);const S=b?a:$,G=z?p??null:M,U=S?d:o,le=()=>{if(S){if((v==null?void 0:v())===!1)return;b||N(!1),s==null||s()}else{if((c==null?void 0:c())===!1)return;b||N(!0),n==null||n()}},Q=k=>{z||D(k.id??null),m==null||m(k),k.id&&k.onClick&&k.onClick(k.id)},oe=k=>{if(!k.id)return;const O=!L[k.id];let Y={...L,[k.id]:O};k.group&&O&&Ue(r,k.group).forEach(J=>{J!==k.id&&(Y[J]=!1)}),W(Y),w==null||w(k.id,O)},I=(k,O)=>{if(k.count===void 0)return null;const Y=Je(k.countColor),J=k.count>99?"99+":String(k.count);return O?e.jsx("span",{style:{position:"absolute",top:1,right:1,background:Y,color:"#fff",borderRadius:8,fontSize:9,fontWeight:700,padding:"0 3px",minWidth:14,textAlign:"center",lineHeight:"14px",pointerEvents:"none"},children:J}):e.jsx("span",{style:{background:Y,color:"#fff",borderRadius:10,padding:"1px 6px",fontSize:11,fontWeight:700,flexShrink:0},children:J})},C=(k,O,Y)=>{var ae;if(k.hidden)return null;const J=k.id??`${k.type??"navItem"}-${O}-${Y}`,_=k.type??"navItem";if(_==="separator")return e.jsx("div",{style:{height:1,background:t.border,margin:"6px 8px",flexShrink:0}},J);if(_==="spacer")return e.jsx("div",{style:{flex:1}},J);if(_==="title")return S?null:e.jsx("div",{style:{padding:"10px 14px 4px",fontSize:10,fontWeight:700,textTransform:"uppercase",letterSpacing:1,color:t.textMut,flexShrink:0},children:k.value},J);if(_==="customHTML")return e.jsx("div",{dangerouslySetInnerHTML:{__html:k.html??""},style:{padding:"8px 12px",flexShrink:0}},J);const V=(((ae=k.items)==null?void 0:ae.length)??0)>0,Z=!!F[k.id??""],R=k.twoState?!!L[k.id??""]:!1,re=!k.twoState&&G===k.id||R,H=!!k.disabled,ie=S?0:12+O*16,ze=()=>{H||(k.twoState?(oe(k),Q(k)):(V&&h(se=>({...se,[k.id??""]:!se[k.id??""]})),Q(k)))};return e.jsxs("div",{style:{flexShrink:0},children:[e.jsxs("div",{title:k.tooltip,onClick:ze,style:{display:"flex",alignItems:"center",gap:S?0:8,justifyContent:S?"center":"flex-start",paddingTop:8,paddingBottom:8,paddingLeft:S?0:ie,paddingRight:S?0:10,borderRadius:t.r,margin:"1px 6px",cursor:H?"not-allowed":"pointer",userSelect:"none",transition:"background .15s",background:re?t.primaryLt:"transparent",color:H?t.textMut:re?t.primary:t.text,opacity:H?.55:1},onMouseEnter:se=>{!re&&!H&&(se.currentTarget.style.background=t.bg)},onMouseLeave:se=>{!re&&!H&&(se.currentTarget.style.background="transparent")},children:[e.jsxs("span",{style:{position:"relative",minWidth:22,textAlign:"center",fontSize:18,flexShrink:0,lineHeight:1},children:[k.icon??(k.value&&!k.icon,null),S&&I(k,!0)]}),!S&&e.jsx("span",{style:{flex:1,fontSize:13,fontWeight:re?600:400,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:k.value}),!S&&I(k,!1),!S&&k.twoState&&e.jsx("span",{style:{width:14,height:14,borderRadius:2,border:`2px solid ${re?t.primary:t.borderDk}`,background:re?t.primary:"transparent",flexShrink:0,display:"flex",alignItems:"center",justifyContent:"center"},children:re&&e.jsx("span",{style:{color:"#fff",fontSize:8,fontWeight:700,lineHeight:1},children:"✓"})}),!S&&V&&!k.twoState&&e.jsx("span",{style:{fontSize:11,color:t.textMut,flexShrink:0,transition:"transform .2s",transform:Z?"rotate(90deg)":"rotate(0deg)",display:"inline-block"},children:"▶"})]}),V&&Z&&!S&&e.jsx("div",{children:k.items.map((se,ge)=>C(se,O+1,ge))})]},J)},P=e.jsxs("div",{onClick:le,style:{display:"flex",alignItems:"center",justifyContent:S?"center":"flex-start",gap:8,padding:S?"8px 0":"8px 14px",margin:"4px 6px",borderRadius:t.r,cursor:"pointer",color:t.textMut,fontSize:13,userSelect:"none",transition:"background .15s",flexShrink:0},onMouseEnter:k=>k.currentTarget.style.background=t.bg,onMouseLeave:k=>k.currentTarget.style.background="transparent",children:[e.jsx("span",{style:{fontSize:16,fontWeight:700,lineHeight:1},children:S?"›":"‹"}),!S&&e.jsx("span",{children:"Collapse"})]});return e.jsxs("div",{className:"dhx",style:{width:U,minWidth:U,background:t.surface,borderRight:`1px solid ${t.border}`,display:"flex",flexDirection:"column",transition:"width .2s ease, min-width .2s ease",overflow:"hidden",...i},children:[l&&e.jsx("div",{style:{padding:S?"12px 0":"12px 14px",borderBottom:`1px solid ${t.border}`,fontWeight:700,fontSize:15,display:"flex",alignItems:"center",justifyContent:S?"center":"flex-start",overflow:"hidden",flexShrink:0},children:l}),e.jsx("div",{className:"dhx-scroll",style:{flex:1,overflowY:"auto",overflowX:"hidden",display:"flex",flexDirection:"column"},children:r.map((k,O)=>C(k,0,O))}),P,f&&!S&&e.jsx("div",{style:{padding:"10px 14px",borderTop:`1px solid ${t.border}`,flexShrink:0},children:f})]})}function Re({config:r}){const[o,d]=g.useState(!1),l={position:"relative",background:t.surface,border:`1px solid ${t.border}`,borderRadius:t.r,overflow:"hidden",...r.width?{width:r.width,minWidth:r.width}:{flex:1},...r.height?{height:r.height,minHeight:r.height}:{minHeight:40},...o?{flex:"0 0 auto"}:{}};return e.jsxs("div",{style:l,children:[r.header&&e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"6px 12px",background:t.bg,borderBottom:`1px solid ${t.border}`,fontSize:12,fontWeight:600,color:t.textSec,userSelect:"none"},children:[e.jsx("span",{children:r.header}),r.collapsable&&e.jsx("button",{onClick:()=>d(f=>!f),style:{background:"none",border:"none",cursor:"pointer",color:t.textMut,fontSize:16,lineHeight:1},children:o?"▼":"▲"})]}),!o&&e.jsxs("div",{style:{padding:r.padding||0,height:r.header?"calc(100% - 33px)":"100%",overflow:"auto"},children:[r.html?e.jsx("div",{dangerouslySetInnerHTML:{__html:r.html}}):r.content,(r.rows||r.cols)&&e.jsx(Te,{rows:r.rows,cols:r.cols,style:{height:"100%"}})]})]})}function Te({rows:r,cols:o,type:d="line",style:l,children:f}){g.useEffect(q,[]);const a=d==="space"?12:d==="wide"?8:1,u=r||o,p=!!r;return u?e.jsx("div",{className:"dhx",style:{display:"flex",flexDirection:p?"column":"row",gap:a,width:"100%",height:"100%",...l},children:u.map((x,m)=>e.jsx(Re,{config:x},x.id||m))}):e.jsx("div",{className:"dhx",style:{width:"100%",height:"100%",...l},children:f})}function et({views:r=[],mode:o="top",tabAlign:d="left",closable:l=[],disabled:f=[],defaultActive:a,onBeforeChange:u,onChange:p,style:x}){var M;const[m,n]=g.useState(a||((M=r[0])==null?void 0:M.id)),[s,c]=g.useState(r.map(D=>D.id));g.useEffect(q,[]);const v=(D,F)=>{D.stopPropagation(),c(h=>h.filter(L=>L!==F)),m===F&&n(s.find(h=>h!==F)??"")},w=D=>{f.includes(D)||u&&u(D)===!1||(n(D),p==null||p(D))},i=o==="left"||o==="right",b=r.filter(D=>s.includes(D.id)),z=e.jsx("div",{style:{display:"flex",flexDirection:i?"column":"row",justifyContent:d==="center"?"center":d==="right"?"flex-end":"flex-start",background:t.surface,borderBottom:!i&&o!=="bottom"?`2px solid ${t.border}`:"none",borderTop:o==="bottom"?`2px solid ${t.border}`:"none",borderRight:o==="left"?`2px solid ${t.border}`:"none",borderLeft:o==="right"?`2px solid ${t.border}`:"none",overflowX:"auto",flexShrink:0},children:b.map(D=>{const F=m===D.id,h=f.includes(D.id),L=o==="bottom"?{borderTop:`2px solid ${t.primary}`,color:t.primary,fontWeight:600}:i?{color:t.primary,fontWeight:600,background:t.primaryLt,[o==="left"?"borderRight":"borderLeft"]:`2px solid ${t.primary}`}:{borderBottom:`2px solid ${t.primary}`,color:t.primary,fontWeight:600};return e.jsxs("div",{onClick:()=>w(D.id),style:{display:"flex",alignItems:"center",gap:6,padding:"10px 16px",cursor:h?"not-allowed":"pointer",whiteSpace:"nowrap",fontSize:13,transition:"color .15s",userSelect:"none",minWidth:i?120:"auto",...F?L:{color:h?t.textMut:t.textSec}},children:[D.icon&&e.jsx("span",{style:{fontSize:16},children:D.icon}),e.jsx("span",{children:D.tab}),l.includes(D.id)&&e.jsx("span",{onClick:W=>v(W,D.id),style:{marginLeft:4,opacity:.6,fontSize:12,cursor:"pointer"},children:"✕"})]},D.id)})}),$=b.find(D=>D.id===m),N=e.jsxs("div",{className:"dhx-scroll",style:{flex:1,overflow:"auto"},children:[$==null?void 0:$.content,($==null?void 0:$.html)&&e.jsx("div",{dangerouslySetInnerHTML:{__html:$.html},style:{padding:16}})]});return e.jsxs("div",{className:"dhx",style:{display:"flex",flexDirection:o==="top"?"column":o==="bottom"?"column-reverse":o==="left"?"row":"row-reverse",width:"100%",height:"100%",background:t.surface,border:`1px solid ${t.border}`,borderRadius:t.r,overflow:"hidden",...x},children:[z,N]})}const pe=`1px solid ${t.border}`;function tt({active:r,dir:o}){return e.jsxs("span",{style:{display:"inline-flex",flexDirection:"column",gap:1,flexShrink:0,marginLeft:4},children:[e.jsx("svg",{width:"7",height:"4",viewBox:"0 0 7 4",children:e.jsx("path",{d:"M3.5 0L7 4H0z",fill:r&&o==="asc"?t.primary:t.borderDk})}),e.jsx("svg",{width:"7",height:"4",viewBox:"0 0 7 4",children:e.jsx("path",{d:"M3.5 4L0 0H7z",fill:r&&o==="desc"?t.primary:t.borderDk})})]})}function rt({options:r,value:o,onChange:d,onCommit:l,onCancel:f}){const[a,u]=g.useState(o),[p,x]=g.useState(!0),m=g.useRef(null);g.useEffect(()=>{const s=c=>{m.current&&!m.current.contains(c.target)&&l()};return document.addEventListener("mousedown",s),()=>document.removeEventListener("mousedown",s)},[l]);const n=r.filter(s=>!a||s.toLowerCase().includes(a.toLowerCase()));return e.jsxs("div",{ref:m,style:{width:"100%",position:"relative"},children:[e.jsx("input",{autoFocus:!0,value:a,onChange:s=>{u(s.target.value),d(s.target.value),x(!0)},onKeyDown:s=>{s.key==="Enter"&&l(),s.key==="Escape"&&f()},onClick:s=>s.stopPropagation(),style:{width:"100%",border:"none",outline:`2px solid ${t.primary}`,borderRadius:2,fontSize:13,padding:"2px 4px",background:t.surface,color:t.text}}),p&&n.length>0&&e.jsx("div",{style:{position:"absolute",top:"100%",left:0,right:0,zIndex:50,background:t.surface,border:`1px solid ${t.border}`,borderRadius:t.r,boxShadow:t.shadowLg,maxHeight:160,overflowY:"auto"},children:n.map(s=>e.jsx("div",{onMouseDown:c=>{c.preventDefault(),d(s),u(s),x(!1),l()},style:{padding:"6px 10px",cursor:"pointer",fontSize:13,color:t.text},onMouseEnter:c=>c.currentTarget.style.background=t.bg,onMouseLeave:c=>c.currentTarget.style.background=t.surface,children:s},s))})]})}function nt(r,o){if(r==null)return"";if(o==="number")return typeof r=="number"?r.toLocaleString():String(r);if(o==="date"){const d=r instanceof Date?r:new Date(String(r));return isNaN(d.getTime())?String(r):d.toLocaleDateString()}return String(r)}function ot(r,o,d){return r==null?1:o==null?-1:d==="date"?new Date(String(r)).getTime()-new Date(String(o)).getTime():d==="number"?Number(r)-Number(o):String(r)<String(o)?-1:String(r)>String(o)?1:0}function xe(r){var o;return Array.isArray(r.header)&&((o=r.header[1])==null?void 0:o.content)!=null?r.header[1].content:r.filterable?r.filterType==="select"?"selectFilter":"inputFilter":null}function st(r,o,d,l,f){const a={width:"100%",border:"none",outline:`2px solid ${t.primary}`,borderRadius:2,fontSize:13,padding:"2px 4px",background:t.surface,color:t.text},u=r.editorType??"input";if(u==="select")return e.jsx("select",{autoFocus:!0,value:o,onChange:x=>d(x.target.value),onBlur:l,onKeyDown:x=>{x.key==="Enter"&&l(),x.key==="Escape"&&f()},onClick:x=>x.stopPropagation(),style:{...a,cursor:"pointer"},children:(r.options??[]).map(x=>e.jsx("option",{value:x,children:x},x))});if(u==="combobox")return e.jsx(rt,{options:r.options??[],value:o,onChange:d,onCommit:l,onCancel:f});const p=r.type==="number"?"number":r.type==="date"?"date":"text";return e.jsx("input",{autoFocus:!0,type:p,value:o,onChange:x=>d(x.target.value),onBlur:l,onKeyDown:x=>{x.key==="Enter"&&l(),x.key==="Escape"&&f()},onClick:x=>x.stopPropagation(),style:a})}function lt({columns:r,data:o=[],height:d=400,rowHeight:l=40,headerRowHeight:f=40,footerRowHeight:a=40,sortable:u=!0,resizable:p=!0,editable:x=!1,stripe:m=!1,autoWidth:n=!1,keyNavigation:s=!1,selection:c,multiselect:v,leftSplit:w=0,onSelect:i,onChange:b,style:z}){var je;const[$,N]=g.useState(null),[M,D]=g.useState("asc"),[F,h]=g.useState({}),[L,W]=g.useState(new Set),[S,G]=g.useState(-1),[U,le]=g.useState(()=>Object.fromEntries(r.map(y=>[y.id,y.width??y.minWidth??150]))),[Q,oe]=g.useState(null),[I,C]=g.useState(""),[P,k]=g.useState({}),O=g.useRef(null),[Y,J]=g.useState(0);g.useEffect(q,[]),g.useEffect(()=>{if(!n||!O.current)return;const y=new ResizeObserver(()=>{var E;return J(((E=O.current)==null?void 0:E.offsetWidth)??0)});return y.observe(O.current),()=>y.disconnect()},[n]);const _=g.useMemo(()=>r.map(y=>y.summary&&(!y.footer||y.footer.length===0)?{...y,footer:[{summary:y.summary}]}:y),[r]),V=g.useMemo(()=>_.filter(y=>!y.hidden),[_]),Z=g.useMemo(()=>{if(!n||Y===0)return U;const y=V.reduce((T,A)=>T+(U[A.id]??150),0);if(Y<=y)return U;const E=(Y-y)/V.length;return Object.fromEntries(V.map(T=>[T.id,(U[T.id]??150)+E]))},[n,Y,U,V]),R=g.useMemo(()=>{let y=o.map((E,T)=>{const A=String(E.id??T);return P[A]?{...E,...P[A]}:E}).filter(E=>Object.entries(F).every(([T,A])=>!A||String(E[T]??"").toLowerCase().includes(A.toLowerCase())));if($){const E=_.find(T=>T.id===$);y=[...y].sort((T,A)=>{const K=ot(T[$],A[$],E==null?void 0:E.type);return M==="asc"?K:-K})}return y},[o,$,M,F,P,_]),ue=g.useMemo(()=>{const y={};return _.forEach(E=>{var T;if((T=E.footer)!=null&&T.some(A=>A.summary)){const A=R.map(B=>Number(B[E.id])).filter(B=>!isNaN(B)),K=A.reduce((B,ee)=>B+ee,0);y[E.id]={sum:K,avg:A.length?K/A.length:0,count:R.length,min:A.length?Math.min(...A):0,max:A.length?Math.max(...A):0}}}),y},[R,_]),re=g.useMemo(()=>{const y={};return V.filter(E=>{const T=xe(E);return T==="selectFilter"||T==="comboFilter"}).forEach(E=>{y[E.id]=[...new Set(o.map(T=>String(T[E.id]??"")))].sort()}),y},[o,V]),H=V.some(y=>xe(y)!==null),ie=_.some(y=>{var E;return(E=y.footer)==null?void 0:E.length}),ze=V.reduce((y,E)=>y+(Z[E.id]??150),0),ae=g.useMemo(()=>{if(!w)return{};let y=0;const E={};return V.forEach((T,A)=>{A<w&&(E[T.id]=y,y+=Z[T.id]??150)}),E},[w,V,Z]),se=w>0?(je=V[w-1])==null?void 0:je.id:null,ge=(y,E)=>y.id??E,Et=y=>{!u||y.sortable===!1||(D(E=>$===y.id&&E==="asc"?"desc":"asc"),N(y.id))},Ce=(y,E)=>{if(!c)return;const T=ge(y,E);G(E),W(A=>{const K=v?new Set(A):new Set;return K.has(T)?K.delete(T):K.add(T),K}),i==null||i(y)},Lt=()=>{if(!Q)return;const{key:y,colId:E}=Q;k(A=>({...A,[String(y)]:{...A[String(y)]||{},[E]:I}}));const T=R.find((A,K)=>ge(A,K)===y);T&&(b==null||b(T,E,I)),oe(null)},Tt=y=>{if(Q&&y.key==="Escape"){oe(null);return}if(!(!s||!c)){if(y.key==="ArrowDown"){y.preventDefault();const E=Math.min(S+1,R.length-1);E>=0&&Ce(R[E],E)}else if(y.key==="ArrowUp"){y.preventDefault();const E=Math.max(S-1,0);E>=0&&Ce(R[E],E)}}},It=(y,E)=>{y.preventDefault(),y.stopPropagation();const T=y.clientX,A=U[E]??150,K=r.find(te=>te.id===E),B=te=>le(de=>({...de,[E]:Math.max((K==null?void 0:K.minWidth)||50,A+te.clientX-T)})),ee=()=>{document.removeEventListener("mousemove",B),document.removeEventListener("mouseup",ee)};document.addEventListener("mousemove",B),document.addEventListener("mouseup",ee)},$e=(y,E,T,A,K,B="hidden")=>{const ee=y in ae;return{width:E,minWidth:E,flexShrink:0,boxSizing:"border-box",padding:"0 12px",height:K,display:"flex",alignItems:"center",overflow:B,textOverflow:"ellipsis",whiteSpace:"nowrap",fontSize:13,textAlign:T,justifyContent:T==="center"?"center":T==="right"?"flex-end":"flex-start",borderLeft:A?"none":pe,position:ee?"sticky":"relative",...ee?{left:ae[y],zIndex:1,boxShadow:y===se?"2px 0 6px rgba(0,0,0,0.1)":void 0}:{}}};return e.jsx("div",{ref:O,className:"dhx",tabIndex:s?0:void 0,onKeyDown:Tt,style:{width:"100%",height:d,display:"flex",flexDirection:"column",border:pe,borderRadius:t.r,overflow:"hidden",outline:"none",...z},children:e.jsx("div",{className:"dhx-scroll",style:{overflow:"auto",flex:1},children:e.jsxs("div",{style:{minWidth:ze,display:"flex",flexDirection:"column",minHeight:"100%"},children:[e.jsx("div",{style:{display:"flex",background:t.bg,borderBottom:pe,flexShrink:0,position:"sticky",top:0,zIndex:3},children:V.map((y,E)=>{const T=Array.isArray(y.header)?y.header[0]:null,A=(T==null?void 0:T.text)??(typeof y.header=="string"?y.header:y.id),K=(T==null?void 0:T.align)??y.align,B=Z[y.id]??150,ee=y.id in ae;return e.jsxs("div",{onClick:()=>Et(y),style:{...$e(y.id,B,K,E===0,f),fontWeight:500,color:t.text,background:t.bg,cursor:u&&y.sortable!==!1?"pointer":"default",userSelect:"none",...ee?{zIndex:4}:{}},children:[T!=null&&T.htmlEnable?e.jsx("span",{style:{flex:1,overflow:"hidden"},dangerouslySetInnerHTML:{__html:A}}):e.jsx("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:A}),u&&y.sortable!==!1&&e.jsx(tt,{active:$===y.id,dir:M}),p&&y.resizable!==!1&&E<V.length-1&&e.jsx("div",{onMouseDown:te=>It(te,y.id),onClick:te=>te.stopPropagation(),style:{position:"absolute",right:0,top:0,bottom:0,width:4,cursor:"col-resize",zIndex:1},onMouseEnter:te=>te.currentTarget.style.background=t.primary+"55",onMouseLeave:te=>te.currentTarget.style.background="transparent"})]},y.id)})}),H&&e.jsx("div",{style:{display:"flex",borderBottom:pe,background:t.surface,flexShrink:0,...w?{position:"sticky",top:f,zIndex:3}:{}},children:V.map((y,E)=>{const T=xe(y),A=Z[y.id]??150,K=y.id in ae;return e.jsx("div",{style:{width:A,minWidth:A,flexShrink:0,padding:"4px 6px",boxSizing:"border-box",borderLeft:E===0?"none":pe,background:t.surface,...K?{position:"sticky",left:ae[y.id],zIndex:4,boxShadow:y.id===se?"2px 0 6px rgba(0,0,0,0.1)":void 0}:{}},children:T==="selectFilter"||T==="comboFilter"?e.jsxs("select",{className:"dhx dhx-input",style:{height:26,fontSize:12,padding:"0 4px"},value:F[y.id]||"",onChange:B=>h(ee=>({...ee,[y.id]:B.target.value})),children:[e.jsx("option",{value:"",children:"All"}),(re[y.id]||[]).map(B=>e.jsx("option",{value:B,children:B},B))]}):T==="inputFilter"?e.jsx("input",{className:"dhx dhx-input",style:{height:26,fontSize:12},placeholder:"Filter...",value:F[y.id]||"",onChange:B=>h(ee=>({...ee,[y.id]:B.target.value}))}):null},y.id)})}),e.jsxs("div",{style:{flex:1},children:[R.map((y,E)=>{const T=ge(y,E),A=L.has(T),K=A?t.primaryLt:m&&E%2!==0?t.bg:t.surface;return e.jsx("div",{style:{display:"flex",height:l,borderBottom:pe,flexShrink:0,background:K,transition:"background .1s",cursor:c?"pointer":"default"},onMouseEnter:B=>!A&&(B.currentTarget.style.background=t.primaryLt+"80"),onMouseLeave:B=>!A&&(B.currentTarget.style.background=K),children:V.map((B,ee)=>{const te=(Q==null?void 0:Q.key)===T&&(Q==null?void 0:Q.colId)===B.id,de=y[B.id],Nt=Z[B.id]??150,Fe=(x||B.editable)&&B.editable!==!1;let fe;return te?fe=st(B,I,C,Lt,()=>oe(null)):B.template?fe=B.template(de,y):B.htmlEnable?fe=e.jsx("span",{dangerouslySetInnerHTML:{__html:String(de??"")}}):B.type==="boolean"?fe=e.jsx("input",{type:"checkbox",readOnly:!0,checked:!!de,style:{width:16,height:16,accentColor:t.primary,cursor:Fe?"pointer":"default"}}):fe=nt(de,B.type),e.jsx("div",{onClick:()=>{if(Ce(y,E),!!Fe)if(B.type==="boolean"){const Oe=!de,Ye=String(T);k(Ke=>({...Ke,[Ye]:{...Ke[Ye]||{},[B.id]:Oe}})),b==null||b(y,B.id,Oe)}else oe({key:T,colId:B.id}),C(String(de??""))},style:{...$e(B.id,Nt,B.align,ee===0,l,te?"visible":"hidden"),background:K},children:fe},B.id)})},String(T))}),R.length===0&&e.jsx("div",{style:{textAlign:"center",padding:40,color:t.textMut,fontSize:13},children:"No data"})]}),ie&&e.jsx("div",{style:{display:"flex",borderTop:pe,background:t.bg,flexShrink:0,position:"sticky",bottom:0,zIndex:2},children:V.map((y,E)=>{var te;const T=(te=y.footer)==null?void 0:te[0],A=ue[y.id]??{sum:0,avg:0,count:0,min:0,max:0};let K="";T&&(typeof T.text=="function"?K=T.text(A):T.text?K=T.text:T.summary&&(K=String(Math.round(A[T.summary]*100)/100)));const B=Z[y.id]??150,ee=y.id in ae;return e.jsx("div",{style:{...$e(y.id,B,y.align,E===0,a),fontWeight:600,color:t.text,background:t.bg,...ee?{zIndex:3}:{}},children:K},y.id)})})]})})})}const ne=["#0288d1","#43a047","#f57c00","#e53935","#8e24aa","#00838f","#ef6c00","#2e7d32"];function it(r,o,d){const l=r.filter(a=>!a.parent),f=r.filter(a=>!!a.parent);return l.map(a=>({name:a[d],children:f.filter(u=>u.parent===a.id).map(u=>({name:u[d],value:Number(u[o]??0)}))}))}function at({type:r="bar",data:o=[],series:d=[],scales:l={},legend:f,height:a=280,style:u}){var b,z,$,N,M,D,F,h,L,W,S,G,U,le,Q,oe;g.useEffect(q,[]);const p=((b=l.bottom)==null?void 0:b.text)||o[0]&&Object.keys(o[0])[0]||"x",x=e.jsx(X.Tooltip,{contentStyle:{fontSize:12,borderRadius:t.r,border:`1px solid ${t.border}`}}),m=f?e.jsx(X.Legend,{iconSize:10,wrapperStyle:{fontSize:12},verticalAlign:f.valign==="bottom"?"bottom":f.valign==="middle"?"middle":"top",align:f.halign??"center"}):null,n=e.jsx(X.CartesianGrid,{strokeDasharray:"3 3",stroke:t.border}),s=e.jsx(X.XAxis,{dataKey:p,tick:{fontSize:11,fill:t.textSec},axisLine:{stroke:t.border},tickLine:!1,label:(z=l.bottom)!=null&&z.title?{value:l.bottom.title,position:"insideBottom",offset:-4,fontSize:11}:void 0}),c=e.jsx(X.YAxis,{tick:{fontSize:11,fill:t.textSec},axisLine:!1,tickLine:!1,domain:[(($=l.left)==null?void 0:$.min)??"auto",((N=l.left)==null?void 0:N.max)??"auto"],tickCount:(M=l.left)==null?void 0:M.maxTicks,label:(D=l.left)!=null&&D.title?{value:l.left.title,angle:-90,position:"insideLeft",fontSize:11}:void 0}),v={top:10,right:20,left:0,bottom:(F=l.bottom)!=null&&F.title?20:0},w={data:o,margin:v};let i;if(r==="bar")i=e.jsxs(X.BarChart,{...w,children:[n,s,c,x,m,d.map((I,C)=>e.jsx(X.Bar,{dataKey:I.value||I.id||"",name:I.label||I.id,fill:I.fill||I.color||ne[C%ne.length],radius:[3,3,0,0]},I.id??C))]});else if(r==="line")i=e.jsxs(X.LineChart,{...w,children:[n,s,c,x,m,d.map((I,C)=>{const P=I.color||ne[C%ne.length];return e.jsx(X.Line,{type:"monotone",dataKey:I.value||I.id||"",name:I.label||I.id,stroke:P,strokeWidth:I.strokeWidth??2,dot:{r:3,fill:P}},I.id??C)})]});else if(r==="area")i=e.jsxs(X.AreaChart,{...w,children:[n,s,c,x,m,d.map((I,C)=>{const P=I.color||ne[C%ne.length];return e.jsx(X.Area,{type:"monotone",dataKey:I.value||I.id||"",name:I.label||I.id,stroke:P,fill:(I.fill||P)+"33",strokeWidth:I.strokeWidth??2},I.id??C)})]});else if(r==="pie"||r==="donut"){const I=d[0]||{},C=I.value||"value",P=I.text||"name",k=I.color&&o[0]&&I.color in o[0]?I.color:null;i=e.jsxs(X.PieChart,{children:[e.jsx(X.Pie,{data:o,cx:"50%",cy:"50%",outerRadius:r==="donut"?"70%":"80%",innerRadius:r==="donut"?"40%":0,dataKey:C,nameKey:P,stroke:I.stroke||"none",strokeWidth:I.strokeWidth??0,label:({name:O,percent:Y})=>`${O??""} ${((Y??0)*100).toFixed(0)}%`,labelLine:!0,paddingAngle:2,children:o.map((O,Y)=>e.jsx(X.Cell,{fill:k?O[k]:ne[Y%ne.length]},Y))}),x,m]})}else if(r==="radar"){const I=((h=l.radial)==null?void 0:h.value)||p;i=e.jsxs(X.RadarChart,{...w,cx:"50%",cy:"50%",children:[e.jsx(X.PolarGrid,{}),e.jsx(X.PolarAngleAxis,{dataKey:I,tick:{fontSize:11}}),e.jsx(X.PolarRadiusAxis,{tick:{fontSize:9,fill:t.textMut},axisLine:!1}),d.map((C,P)=>{const k=C.color||C.pointColor||ne[P%ne.length];return e.jsx(X.Radar,{dataKey:C.value||C.id||"",name:C.label||C.id,stroke:k,fill:k+"44"},C.id??P)}),x,m]})}else if(r==="scatter")i=e.jsxs(X.ScatterChart,{margin:v,children:[n,e.jsx(X.XAxis,{type:"number",dataKey:"x",name:((L=l.bottom)==null?void 0:L.title)||"x",tick:{fontSize:11,fill:t.textSec},tickLine:!1,domain:[((W=l.bottom)==null?void 0:W.min)??"auto",((S=l.bottom)==null?void 0:S.max)??"auto"],label:(G=l.bottom)!=null&&G.title?{value:l.bottom.title,position:"insideBottom",offset:-4,fontSize:11}:void 0}),e.jsx(X.YAxis,{type:"number",dataKey:"y",name:((U=l.left)==null?void 0:U.title)||"y",tick:{fontSize:11,fill:t.textSec},tickLine:!1,axisLine:!1,domain:[((le=l.left)==null?void 0:le.min)??"auto",((Q=l.left)==null?void 0:Q.max)??"auto"],label:(oe=l.left)!=null&&oe.title?{value:l.left.title,angle:-90,position:"insideLeft",fontSize:11}:void 0}),x,m,d.map((I,C)=>{const P=I.value||"x",k=I.valueY||"y",O=(I.data||o).map(Y=>({x:Y[P],y:Y[k]}));return e.jsx(X.Scatter,{data:O,name:I.label||I.id,fill:I.color||ne[C%ne.length]},I.id??C)})]});else if(r==="treeMap"){const I=d[0]||{},C=I.value||"value",P=I.text||"name",k=it(o,C,P),O=I.stroke||t.surface,Y=I.strokeWidth??2;i=e.jsx(X.Treemap,{data:k,dataKey:"value",aspectRatio:4/3,stroke:O,content:J=>{const{x:_,y:V,width:Z,height:R,depth:ue,index:re,name:H}=J;if(ue===0)return null;const ie=ne[re%ne.length];return e.jsxs("g",{children:[e.jsx("rect",{x:_,y:V,width:Z,height:R,fill:ie,stroke:O,strokeWidth:Y,style:{borderRadius:3}}),Z>40&&R>20&&e.jsx("text",{x:_+Z/2,y:V+R/2,textAnchor:"middle",dominantBaseline:"middle",fill:"#fff",fontSize:11,pointerEvents:"none",children:H})]})}})}return e.jsx("div",{className:"dhx",style:{width:"100%",height:a,padding:12,background:t.surface,borderRadius:t.rMd,...u},children:e.jsx(X.ResponsiveContainer,{width:"100%",height:"100%",children:i})})}const dt=["January","February","March","April","May","June","July","August","September","October","November","December"],ct=["Su","Mo","Tu","We","Th","Fr","Sa"];function pt({value:r,range:o=!1,timepicker:d=!1,onChange:l,style:f}){const a=new Date,u=r?new Date(Array.isArray(r)?r[0]:r):a,[p,x]=g.useState(u),[m,n]=g.useState(r??(o?[null,null]:null)),[s,c]=g.useState(null),[v,w]=g.useState({h:0,m:0});g.useEffect(q,[]);const i=p.getFullYear(),b=p.getMonth(),z=new Date(i,b,1).getDay(),$=new Date(i,b+1,0).getDate(),N=[];for(let h=0;h<z;h++)N.push(null);for(let h=1;h<=$;h++)N.push(new Date(i,b,h));const M=h=>h.toDateString()===a.toDateString(),D=h=>{if(!m)return!1;if(o&&Array.isArray(m)){const[L,W]=m;if(!L)return!1;const S=h.getTime();return W?S>=L.getTime()&&S<=W.getTime():h.toDateString()===L.toDateString()}return h.toDateString()===m.toDateString()},F=h=>{if(o){const[L,W]=Array.isArray(m)?m:[null,null];if(!L||W)n([h,null]);else{const S=h<L?[h,L]:[L,h];n(S),l==null||l(S)}}else n(h),l==null||l(h)};return e.jsxs("div",{className:"dhx",style:{background:t.surface,border:`1px solid ${t.border}`,borderRadius:t.rMd,padding:16,display:"inline-block",boxShadow:t.shadow,...f},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:12},children:[e.jsx("button",{onClick:()=>x(h=>new Date(h.getFullYear(),h.getMonth()-1,1)),className:"dhx dhx-btn dhx-btn-ghost",style:{height:28,padding:"0 8px",fontSize:16},children:"‹"}),e.jsxs("div",{style:{fontWeight:700,fontSize:14},children:[dt[b]," ",i]}),e.jsx("button",{onClick:()=>x(h=>new Date(h.getFullYear(),h.getMonth()+1,1)),className:"dhx dhx-btn dhx-btn-ghost",style:{height:28,padding:"0 8px",fontSize:16},children:"›"})]}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(7, 32px)",gap:2},children:[ct.map(h=>e.jsx("div",{style:{textAlign:"center",fontSize:11,fontWeight:600,color:t.textMut,paddingBottom:4},children:h},h)),N.map((h,L)=>{const W=h?D(h):!1,S=h&&s&&h.toDateString()===s.toDateString();return e.jsx("div",{onClick:()=>h&&F(h),onMouseEnter:()=>h&&c(h),onMouseLeave:()=>c(null),style:{width:32,height:32,display:"flex",alignItems:"center",justifyContent:"center",borderRadius:t.r,cursor:h?"pointer":"default",fontSize:12,fontWeight:h&&M(h)?700:400,background:W?t.primary:S?t.bg:"transparent",color:W?"#fff":h&&M(h)?t.primary:h?t.text:"transparent",border:h&&M(h)&&!W?`1px solid ${t.primary}`:"1px solid transparent",transition:"all .1s"},children:h==null?void 0:h.getDate()},L)})]}),d&&e.jsxs("div",{style:{borderTop:`1px solid ${t.border}`,marginTop:12,paddingTop:12,display:"flex",alignItems:"center",justifyContent:"center",gap:8},children:[e.jsx("input",{type:"number",min:0,max:23,value:v.h,onChange:h=>w(L=>({...L,h:+h.target.value})),className:"dhx dhx-input",style:{width:50,textAlign:"center"}}),e.jsx("span",{style:{fontWeight:700,color:t.textSec},children:":"}),e.jsx("input",{type:"number",min:0,max:59,value:v.m,onChange:h=>w(L=>({...L,m:+h.target.value})),className:"dhx dhx-input",style:{width:50,textAlign:"center"}})]})]})}function Ie({value:r,onChange:o,timeFormat:d=12,controls:l=!1,minuteStep:f=5,style:a}){const[u,p]=g.useState((r==null?void 0:r.h)??(d===24?0:12)),[x,m]=g.useState((r==null?void 0:r.m)??0),[n,s]=g.useState((r==null?void 0:r.ampm)??"AM"),[c,v]=g.useState(null);g.useEffect(q,[]);const w=d===24?Array.from({length:24},(M,D)=>D):Array.from({length:12},(M,D)=>D+1),i=Array.from({length:Math.ceil(60/f)},(M,D)=>D*f),b=(M,D,F)=>{const h=d===24?{h:M,m:D}:{h:M,m:D,ampm:F};l?v(h):o==null||o(h)},z=()=>{v(null),p((r==null?void 0:r.h)??(d===24?0:12)),m((r==null?void 0:r.m)??0),s((r==null?void 0:r.ampm)??"AM")},$={display:"flex",flexDirection:"column",alignItems:"center",gap:4},N=M=>({height:32,display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer",fontSize:13,fontWeight:M?700:400,background:M?t.primaryLt:"transparent",color:M?t.primary:t.text});return e.jsxs("div",{className:"dhx",style:{background:t.surface,border:`1px solid ${t.border}`,borderRadius:t.rMd,padding:16,display:"inline-block",boxShadow:t.shadow,...a},children:[e.jsxs("div",{style:{display:"flex",gap:8,alignItems:"stretch"},children:[e.jsxs("div",{style:$,children:[e.jsx("span",{style:{fontSize:11,fontWeight:600,color:t.textMut},children:"Hours"}),e.jsx("div",{className:"dhx-scroll",style:{height:160,overflowY:"auto",width:48,border:`1px solid ${t.border}`,borderRadius:t.r},children:w.map(M=>e.jsx("div",{onClick:()=>{p(M),b(M,x,n)},style:N(u===M),onMouseEnter:D=>u!==M&&(D.currentTarget.style.background=t.bg),onMouseLeave:D=>u!==M&&(D.currentTarget.style.background="transparent"),children:String(M).padStart(2,"0")},M))})]}),e.jsxs("div",{style:$,children:[e.jsx("span",{style:{fontSize:11,fontWeight:600,color:t.textMut},children:"Minutes"}),e.jsx("div",{className:"dhx-scroll",style:{height:160,overflowY:"auto",width:48,border:`1px solid ${t.border}`,borderRadius:t.r},children:i.map(M=>e.jsx("div",{onClick:()=>{m(M),b(u,M,n)},style:N(x===M),onMouseEnter:D=>x!==M&&(D.currentTarget.style.background=t.bg),onMouseLeave:D=>x!==M&&(D.currentTarget.style.background="transparent"),children:String(M).padStart(2,"0")},M))})]}),d===12&&e.jsxs("div",{style:$,children:[e.jsx("span",{style:{fontSize:11,fontWeight:600,color:t.textMut},children:"AM/PM"}),e.jsx("div",{style:{display:"flex",flexDirection:"column",border:`1px solid ${t.border}`,borderRadius:t.r,overflow:"hidden"},children:["AM","PM"].map(M=>e.jsx("div",{onClick:()=>{s(M),b(u,x,M)},style:{height:40,display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer",padding:"0 12px",fontSize:13,fontWeight:n===M?700:400,background:n===M?t.primary:t.surface,color:n===M?"#fff":t.text},children:M},M))})]})]}),e.jsxs("div",{style:{textAlign:"center",marginTop:12,fontSize:22,fontWeight:700,color:t.primary,letterSpacing:2},children:[String(u).padStart(2,"0"),":",String(x).padStart(2,"0"),d===12?` ${n}`:""]}),l&&e.jsxs("div",{style:{display:"flex",gap:8,justifyContent:"flex-end",marginTop:12},children:[e.jsx("button",{className:"dhx dhx-btn dhx-btn-secondary",onClick:z,children:"Cancel"}),e.jsx("button",{className:"dhx dhx-btn dhx-btn-primary",onClick:()=>{const M=c??(d===24?{h:u,m:x}:{h:u,m:x,ampm:n});o==null||o(M)},children:"Apply"})]})]})}const ht=({open:r})=>e.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",style:{flexShrink:0,transition:"transform .15s",transform:r?"rotate(180deg)":"rotate(0deg)"},children:e.jsx("path",{d:"M2 4l4 4 4-4",stroke:t.textMut,strokeWidth:"1.5",fill:"none",strokeLinecap:"round",strokeLinejoin:"round"})});function ye({data:r=[],value:o,placeholder:d="Select or type...",multiselection:l=!1,label:f,onChange:a,style:u}){var F;const[p,x]=g.useState(!1),[m,n]=g.useState(""),[s,c]=g.useState(l?o?[].concat(o):[]:o||null),v=g.useRef(null),w=g.useRef(null);g.useEffect(q,[]),ce(v,g.useCallback(()=>{x(!1),n("")},[]));const i=g.useMemo(()=>r.filter(h=>!m||h.value.toLowerCase().includes(m.toLowerCase())),[r,m]),b=h=>l?(s||[]).includes(h):s===h,z=h=>{const L=h.id||h.value;if(l){const W=b(L)?s.filter(S=>S!==L):[...s||[],L];c(W),a==null||a(W)}else c(L),n(""),x(!1),a==null||a(L)},$=h=>{const L=s.filter(W=>W!==h);c(L),a==null||a(L)},N=()=>{x(!0),setTimeout(()=>{var h;return(h=w.current)==null?void 0:h.focus()},0)},M=((F=r.find(h=>(h.id||h.value)===s))==null?void 0:F.value)||"",D=l?s||[]:[];return e.jsxs("div",{ref:v,className:"dhx",style:{position:"relative",...u},children:[f&&e.jsx("label",{className:"dhx dhx-label",children:f}),e.jsxs("div",{onClick:N,style:{display:"flex",alignItems:"center",flexWrap:l?"wrap":"nowrap",border:`1px solid ${p?t.primary:t.border}`,borderRadius:t.r,minHeight:34,padding:"4px 8px",cursor:"text",background:t.surface,gap:4,transition:"border-color .15s",boxShadow:p?`0 0 0 3px ${t.primary}22`:"none"},children:[l&&e.jsxs(e.Fragment,{children:[D.map(h=>{var L;return e.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:4,background:t.primary,color:"#fff",borderRadius:12,padding:"2px 10px 2px 8px",fontSize:12,lineHeight:1.5,whiteSpace:"nowrap"},children:[((L=r.find(W=>(W.id||W.value)===h))==null?void 0:L.value)||h,e.jsx("span",{onClick:W=>{W.stopPropagation(),$(h)},style:{cursor:"pointer",fontSize:15,lineHeight:1,opacity:.75,marginLeft:2},children:"×"})]},h)}),e.jsx("input",{ref:w,value:m,onChange:h=>{n(h.target.value),x(!0)},onFocus:()=>x(!0),onClick:h=>h.stopPropagation(),placeholder:D.length?"":d,style:{flex:1,minWidth:60,border:"none",outline:"none",fontSize:13,background:"transparent",color:t.text,padding:0}})]}),!l&&e.jsx("input",{ref:w,value:p?m:M,onChange:h=>{n(h.target.value),x(!0)},onFocus:()=>{x(!0),n("")},onClick:h=>h.stopPropagation(),placeholder:d,style:{flex:1,border:"none",outline:"none",fontSize:13,background:"transparent",color:t.text,padding:0}}),e.jsx(ht,{open:p})]}),p&&e.jsx("div",{className:"dhx dhx-anim-fade",style:{position:"absolute",top:"calc(100% + 4px)",left:0,right:0,background:t.surface,border:`1px solid ${t.border}`,borderRadius:t.r,boxShadow:t.shadowLg,zIndex:100},children:e.jsxs("div",{className:"dhx-scroll",style:{maxHeight:220,overflowY:"auto"},children:[i.map(h=>{const L=h.id||h.value,W=b(L);return e.jsxs("div",{onClick:()=>z(h),style:{padding:"8px 12px",cursor:"pointer",display:"flex",alignItems:"center",gap:8,fontSize:13,background:W?t.primaryLt:"transparent",color:W?t.primary:t.text},onMouseEnter:S=>!W&&(S.currentTarget.style.background=t.bg),onMouseLeave:S=>!W&&(S.currentTarget.style.background="transparent"),children:[l&&e.jsx("span",{style:{width:14,height:14,flexShrink:0,border:`2px solid ${W?t.primary:t.borderDk}`,borderRadius:3,display:"flex",alignItems:"center",justifyContent:"center",background:W?t.primary:"transparent"},children:W&&e.jsx("span",{style:{color:"#fff",fontSize:9,lineHeight:1},children:"✓"})}),e.jsx("span",{style:{flex:1},children:h.value}),!l&&W&&e.jsx("span",{style:{color:t.primary,fontSize:12,fontWeight:700},children:"✓"}),h.count!==void 0&&e.jsxs("span",{style:{fontSize:11,color:t.textMut},children:["(",h.count,")"]})]},L)}),i.length===0&&e.jsx("div",{style:{padding:16,textAlign:"center",color:t.textMut,fontSize:13},children:"No matches"})]})})]})}function be({min:r=0,max:o=100,step:d=1,value:l,range:f=!1,label:a,tick:u,disabled:p=!1,onChange:x,style:m}){const[n,s]=g.useState(l??(f?[r,o]:r));g.useEffect(q,[]);const c=(z,$)=>{if(!p)if(f){const N=[...n];N[z]=$,s(N),x==null||x(N)}else s($),x==null||x($)},v=z=>(z-r)/(o-r)*100,w=f?n:[n],i=f?{left:`${v(w[0])}%`,width:`${v(w[1])-v(w[0])}%`}:{left:0,width:`${v(w[0])}%`},b=p?t.border:t.primary;return e.jsxs("div",{className:"dhx",style:{width:"100%",opacity:p?.5:1,...m},children:[a&&e.jsx("label",{className:"dhx dhx-label",children:a}),e.jsx("div",{style:{position:"relative",height:36,display:"flex",alignItems:"center"},children:e.jsxs("div",{style:{position:"relative",flex:1,height:4,background:t.border,borderRadius:2},children:[e.jsx("div",{style:{position:"absolute",...i,height:"100%",background:b,borderRadius:2}}),w.map((z,$)=>e.jsx("input",{type:"range",min:r,max:o,step:d,value:z,disabled:p,onChange:N=>{const M=+N.target.value;f&&$===0&&M>=n[1]||f&&$===1&&M<=n[0]||c($,M)},style:{position:"absolute",width:"100%",height:"100%",opacity:0,cursor:p?"not-allowed":"pointer",top:0,left:0,margin:0}},$)),w.map((z,$)=>e.jsx("div",{style:{position:"absolute",left:`${v(z)}%`,top:"50%",transform:"translate(-50%, -50%)",width:16,height:16,borderRadius:"50%",background:t.surface,border:`2px solid ${b}`,boxShadow:"0 1px 4px rgba(0,0,0,.2)",pointerEvents:"none"},children:e.jsx("div",{style:{position:"absolute",bottom:"calc(100% + 6px)",left:"50%",transform:"translateX(-50%)",background:p?t.textMut:t.primaryDk,color:"#fff",padding:"2px 6px",borderRadius:t.r,fontSize:11,fontWeight:700,whiteSpace:"nowrap"},children:z})},$))]})}),u&&e.jsx("div",{style:{display:"flex",justifyContent:"space-between",marginTop:2},children:[r,Math.round((o+r)/2),o].map(z=>e.jsx("span",{style:{fontSize:10,color:t.textMut},children:z},z))})]})}const ut=["#f44336","#e91e63","#9c27b0","#673ab7","#3f51b5","#2196f3","#03a9f4","#00bcd4","#009688","#4caf50","#8bc34a","#cddc39","#ffeb3b","#ffc107","#ff9800","#ff5722","#795548","#607d8b","#9e9e9e","#000000","#ffffff","#0288d1","#01579b","#43a047","#e53935","#f57c00"];function ve(r){const o=parseInt(r.slice(1,3),16)/255,d=parseInt(r.slice(3,5),16)/255,l=parseInt(r.slice(5,7),16)/255,f=Math.max(o,d,l),a=Math.min(o,d,l);let u=0,p=0;const x=(f+a)/2;if(f!==a){const m=f-a;p=x>.5?m/(2-f-a):m/(f+a),u=f===o?((d-l)/m+(d<l?6:0))/6:f===d?((l-o)/m+2)/6:((o-d)/m+4)/6}return[Math.round(u*360),Math.round(p*100),Math.round(x*100)]}function Ne(r,o,d){o/=100,d/=100;const l=o*Math.min(d,1-d),f=a=>{const u=(a+r/30)%12,p=d-l*Math.max(Math.min(u-3,9-u,1),-1);return Math.round(255*p).toString(16).padStart(2,"0")};return"#"+f(0)+f(8)+f(4)}function ft({value:r="#0288d1",onChange:o,style:d}){const[l,f]=g.useState(()=>ve(r)),a=Ne(...l);g.useEffect(q,[]);const u=p=>{f(p),o==null||o(Ne(...p))};return e.jsxs("div",{className:"dhx",style:{background:t.surface,border:`1px solid ${t.border}`,borderRadius:t.rMd,padding:16,display:"inline-block",boxShadow:t.shadow,...d},children:[e.jsx("div",{style:{width:200,height:120,borderRadius:t.r,marginBottom:12,background:`linear-gradient(to bottom, transparent, black), linear-gradient(to right, white, hsl(${l[0]},100%,50%))`,cursor:"crosshair"}}),[["Hue",0,360,l[0]],["Saturation",0,100,l[1]],["Lightness",0,100,l[2]]].map(([p,x,m,n],s)=>e.jsxs("div",{style:{marginBottom:s<2?8:12},children:[e.jsxs("div",{className:"dhx dhx-label",children:[p,s>0?` (${n}%)`:""]}),e.jsx("input",{type:"range",min:x,max:m,value:n,onChange:c=>{const v=[...l];v[s]=+c.target.value,u(v)},style:{width:"100%",accentColor:t.primary}})]},p)),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:12},children:[e.jsx("div",{style:{width:36,height:36,borderRadius:t.r,background:a,border:`1px solid ${t.border}`,flexShrink:0}}),e.jsx("input",{className:"dhx dhx-input",style:{flex:1,fontFamily:"monospace",fontSize:12},value:a,onChange:p=>{try{u(ve(p.target.value)),o==null||o(p.target.value)}catch{}}})]}),e.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(13, 1fr)",gap:3},children:ut.map(p=>e.jsx("div",{onClick:()=>{f(ve(p)),o==null||o(p)},style:{width:14,height:14,borderRadius:2,background:p,cursor:"pointer",border:a===p?`2px solid ${t.text}`:"1px solid rgba(0,0,0,.15)",transition:"transform .1s"},onMouseEnter:x=>x.currentTarget.style.transform="scale(1.3)",onMouseLeave:x=>x.currentTarget.style.transform="scale(1)"},p))})]})}function gt({trigger:r,children:o,placement:d="bottom-start",style:l}){const[f,a]=g.useState(!1),[u,p]=g.useState({top:"100%",left:0}),x=g.useRef(null),m=g.useRef(null);g.useEffect(q,[]),ce(x,g.useCallback(()=>a(!1),[]));const n=()=>{a(s=>{if(!s&&m.current){const c=m.current.getBoundingClientRect(),v={"bottom-start":{top:c.height+4,left:0},"bottom-end":{top:c.height+4,right:0,left:"auto"},"top-start":{bottom:c.height+4,top:"auto",left:0}};p(v[d]||v["bottom-start"])}return!s})};return e.jsxs("div",{ref:x,className:"dhx",style:{position:"relative",display:"inline-block"},children:[e.jsx("div",{ref:m,onClick:n,children:r}),f&&e.jsx("div",{className:"dhx dhx-anim-fade",style:{position:"absolute",...u,zIndex:200,background:t.surface,border:`1px solid ${t.border}`,borderRadius:t.rMd,boxShadow:t.shadowLg,...l},children:o})]})}function xt({title:r,children:o,width:d=480,height:l,closable:f=!0,movable:a=!0,modal:u=!1,defaultOpen:p=!0,footer:x,onClose:m,style:n}){const[s,c]=g.useState(p),[v,w]=g.useState({x:0,y:0});g.useEffect(q,[]);const i=Ee(g.useCallback((z,$)=>a&&w({x:z,y:$}),[a])),b=()=>{c(!1),m==null||m()};return s?e.jsxs(e.Fragment,{children:[u&&e.jsx("div",{style:{position:"fixed",inset:0,background:"rgba(0,0,0,.45)",zIndex:900},onClick:f?b:void 0}),e.jsxs("div",{className:"dhx",style:{position:u?"fixed":"absolute",left:"50%",top:"50%",transform:`translate(calc(-50% + ${v.x}px), calc(-50% + ${v.y}px))`,width:d,...l?{height:l}:{},background:t.surface,borderRadius:t.rMd,boxShadow:t.shadowLg,zIndex:901,display:"flex",flexDirection:"column",overflow:"hidden",...n},children:[e.jsxs("div",{onMouseDown:z=>i(z,v.x,v.y),style:{display:"flex",alignItems:"center",padding:"12px 16px",borderBottom:`1px solid ${t.border}`,cursor:a?"grab":"default",background:t.bg,gap:8,userSelect:"none"},children:[e.jsx("span",{style:{flex:1,fontWeight:700,fontSize:15},children:r}),f&&e.jsx("button",{onClick:b,style:{background:"none",border:"none",cursor:"pointer",width:28,height:28,borderRadius:t.r,display:"flex",alignItems:"center",justifyContent:"center",fontSize:18,color:t.textSec},onMouseEnter:z=>z.currentTarget.style.background=t.border,onMouseLeave:z=>z.currentTarget.style.background="none",children:"×"})]}),e.jsx("div",{className:"dhx-scroll",style:{flex:1,minHeight:0,padding:20,overflowY:"auto"},children:o}),x&&e.jsx("div",{style:{padding:"12px 16px",borderTop:`1px solid ${t.border}`,display:"flex",justifyContent:"flex-end",gap:8,background:t.bg},children:x})]})]}):null}const Se=g.createContext(null),yt={success:"✓",error:"✕",warning:"⚠",info:"ℹ"},We={success:t.success,error:t.danger,warning:t.warning,info:t.primary};function bt({children:r}){const[o,d]=g.useState([]);g.useEffect(q,[]);const l=g.useCallback(u=>d(p=>p.filter(x=>x.id!==u)),[]),f=g.useCallback(u=>{const p=Date.now();return d(x=>[...x,{id:p,...u}]),u.duration!==0&&setTimeout(()=>l(p),u.duration||4e3),p},[l]),a={message:f,alert:(u,p)=>f({type:"info",title:u,...p}),confirm:(u,p,x)=>f({type:"warning",title:u,confirm:p,...x})};return e.jsxs(Se.Provider,{value:a,children:[r,e.jsx("div",{style:{position:"fixed",top:20,right:20,zIndex:9999,display:"flex",flexDirection:"column",gap:8,pointerEvents:"none"},children:o.map(u=>{const p=u.type||"info";return e.jsxs("div",{style:{background:t.surface,border:`1px solid ${t.border}`,borderLeft:`4px solid ${We[p]}`,borderRadius:t.r,boxShadow:t.shadowLg,padding:"12px 16px",minWidth:280,maxWidth:380,pointerEvents:"all",display:"flex",gap:10,alignItems:"flex-start",animation:"dhx-toast .3s ease"},children:[e.jsx("span",{style:{fontSize:18,color:We[p],lineHeight:1},children:yt[p]}),e.jsxs("div",{style:{flex:1},children:[u.title&&e.jsx("div",{style:{fontWeight:600,fontSize:13,marginBottom:u.text?3:0},children:u.title}),u.text&&e.jsx("div",{style:{fontSize:12,color:t.textSec,lineHeight:1.5},children:u.text}),u.confirm&&e.jsxs("div",{style:{display:"flex",gap:6,marginTop:8},children:[e.jsx("button",{className:"dhx dhx-btn dhx-btn-primary",style:{height:26,fontSize:12},onClick:()=>{u.confirm(!0),l(u.id)},children:"Confirm"}),e.jsx("button",{className:"dhx dhx-btn dhx-btn-secondary",style:{height:26,fontSize:12},onClick:()=>{u.confirm(!1),l(u.id)},children:"Cancel"})]})]}),e.jsx("button",{onClick:()=>l(u.id),style:{background:"none",border:"none",cursor:"pointer",color:t.textMut,fontSize:14,lineHeight:1,padding:0},children:"×"})]},u.id)})})]})}function vt(){const r=g.useContext(Se);if(!r)throw new Error("useMessage must be used inside <MessageProvider>");return r}function St({data:r=[],template:o,keyNavigation:d=!0,multiselection:l=!1,editable:f=!1,height:a=400,onSelect:u,onEdit:p,style:x}){const[m,n]=g.useState(new Set),[s,c]=g.useState(null),[v,w]=g.useState(""),[i,b]=g.useState(null);g.useEffect(q,[]);const z=(N,M)=>{const D=N.id??M;n(F=>{const h=l?new Set(F):new Set;return h.has(D)?h.delete(D):h.add(D),h}),b(M),u==null||u(N)},$=(N,M)=>{p==null||p({...N,value:v},M),c(null)};return e.jsxs("div",{className:"dhx dhx-scroll",style:{height:a,overflowY:"auto",border:`1px solid ${t.border}`,borderRadius:t.r,background:t.surface,...x},tabIndex:0,onKeyDown:N=>{d&&(N.key==="ArrowDown"&&b(M=>Math.min((M??-1)+1,r.length-1)),N.key==="ArrowUp"&&b(M=>Math.max((M??1)-1,0)))},children:[r.map((N,M)=>{const D=N.id??M,F=m.has(D),h=i===M;return e.jsx("div",{onClick:()=>z(N,M),onDoubleClick:()=>f&&(c(M),w(String(N.value||""))),style:{display:"flex",alignItems:"center",padding:"0 12px",height:40,cursor:"pointer",fontSize:13,borderBottom:`1px solid ${t.border}`,background:F?t.primaryLt:h?t.bg:t.surface,color:F?t.primary:t.text,outline:h?`2px solid ${t.primary}44`:"none",transition:"background .1s"},children:s===M?e.jsx("input",{autoFocus:!0,className:"dhx dhx-input",style:{height:28,flex:1},value:v,onChange:L=>w(L.target.value),onBlur:()=>$(N,M),onKeyDown:L=>{L.key==="Enter"&&$(N,M),L.key==="Escape"&&c(null)},onClick:L=>L.stopPropagation()}):o?e.jsx("div",{dangerouslySetInnerHTML:{__html:o(N)},style:{flex:1}}):e.jsx("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:String(N.value??"")})},String(D))}),r.length===0&&e.jsx("div",{style:{padding:24,textAlign:"center",color:t.textMut},children:"No items"})]})}function kt({data:r=[],template:o,itemsInRow:d=3,gap:l=12,multiselection:f=!1,onSelect:a,style:u}){const[p,x]=g.useState(new Set);g.useEffect(q,[]);const m=n=>{const s=n.id??String(n.title);x(c=>{const v=f?new Set(c):new Set;return v.has(s)?v.delete(s):v.add(s),v}),a==null||a(n)};return e.jsx("div",{className:"dhx",style:{display:"grid",gridTemplateColumns:`repeat(${d}, 1fr)`,gap:l,padding:l,...u},children:r.map((n,s)=>{const c=n.id??s,v=p.has(c);return e.jsx("div",{onClick:()=>m(n),style:{background:t.surface,border:`2px solid ${v?t.primary:t.border}`,borderRadius:t.rMd,overflow:"hidden",cursor:"pointer",transition:"all .15s",boxShadow:v?`0 0 0 3px ${t.primary}33`:t.shadow,transform:v?"translateY(-2px)":"none"},onMouseEnter:w=>{w.currentTarget.style.boxShadow=t.shadowLg,w.currentTarget.style.transform="translateY(-2px)"},onMouseLeave:w=>{w.currentTarget.style.boxShadow=v?`0 0 0 3px ${t.primary}33`:t.shadow,w.currentTarget.style.transform=v?"translateY(-2px)":"none"},children:o?e.jsx("div",{dangerouslySetInnerHTML:{__html:o(n)}}):e.jsxs("div",{style:{padding:16},children:[n.img&&e.jsx("img",{src:n.img,alt:n.title||"",style:{width:"100%",borderRadius:t.r,marginBottom:8,display:"block"}}),e.jsx("div",{style:{fontWeight:600,fontSize:14,marginBottom:4},children:n.title||n.value}),n.subtitle&&e.jsx("div",{style:{fontSize:12,color:t.textSec},children:n.subtitle})]})},String(c))})})}function ke(r){return r.map(o=>({...o,items:o.items?ke(o.items):void 0}))}function we(r,o={}){return r.forEach(d=>{d.opened&&(o[d.id]=!0),d.items&&we(d.items,o)}),o}function Ae(r,o){let d=null;return[r.filter(f=>f.id===o?(d=f,!1):!0).map(f=>{if(f.items){const[a,u]=Ae(f.items,o);return u&&(d=u),{...f,items:a}}return f}),d]}function me(r,o,d,l){if(l==="inside")return r.map(a=>a.id===o?{...a,items:[...a.items||[],d]}:a.items?{...a,items:me(a.items,o,d,l)}:a);if(r.some(a=>a.id===o)){const a=[];for(const u of r)u.id===o?l==="before"?(a.push(d),a.push(u)):(a.push(u),a.push(d)):a.push(u);return a}return r.map(a=>a.items?{...a,items:me(a.items,o,d,l)}:a)}function wt(r,o,d){function l(f){var a,u;if(f.id===o){const p=x=>{var m;return x.id===d||(((m=x.items)==null?void 0:m.some(p))??!1)};return((a=f.items)==null?void 0:a.some(p))??!1}return((u=f.items)==null?void 0:u.some(l))??!1}return r.some(l)}function Be(r,o,d){return r.map(l=>l.id===o?{...l,value:d}:{...l,items:l.items?Be(l.items,o,d):void 0})}function mt(r,o){var a;let d=0,l=0;const f=u=>{var p;d++,o[u.id]&&l++,(p=u.items)==null||p.forEach(f)};return(a=r.items)==null||a.forEach(f),{total:d,checkedCount:l}}function Mt({data:r=[],checkbox:o=!1,editable:d=!1,dragMode:l,tooltip:f,onSelect:a,onCheck:u,onChange:p,style:x}){const[m,n]=g.useState(()=>ke(r)),[s,c]=g.useState(()=>we(r)),[v,w]=g.useState(null),[i,b]=g.useState({}),[z,$]=g.useState(null),[N,M]=g.useState(""),[D,F]=g.useState(null),[h,L]=g.useState(null);g.useEffect(q,[]),g.useEffect(()=>{n(ke(r)),c(C=>({...we(r),...C}))},[r]);const W=C=>c(P=>({...P,[C]:!P[C]})),S=(C,P)=>{b(k=>({...k,[C]:P})),u==null||u(C,P)},G=()=>{if(!z)return;const C=z,P=N;$(null),n(k=>{const O=Be(k,C,P);return p==null||p(O),O})},U=(C,P)=>{C.dataTransfer.effectAllowed="move",F(P)},le=(C,P)=>{if(!D||D===P||wt(m,D,P))return;C.preventDefault();const k=C.currentTarget.getBoundingClientRect(),O=C.clientY-k.top,Y=k.height,J=O<Y*.25?"before":O>Y*.75?"after":"inside";L(_=>(_==null?void 0:_.id)===P&&(_==null?void 0:_.pos)===J?_:{id:P,pos:J})},Q=(C,P)=>{if(C.preventDefault(),!D||!h||D===P){L(null),F(null);return}n(k=>{const[O,Y]=Ae(k,D);if(!Y)return k;const J=me(O,P,Y,h.pos);return p==null||p(J),J}),h.pos==="inside"&&c(k=>({...k,[P]:!0})),L(null),F(null)},oe=()=>{F(null),L(null)},I=(C,P=0)=>{var re;const k=(((re=C.items)==null?void 0:re.length)??0)>0,O=s[C.id],Y=v===C.id,J=D===C.id,_=(h==null?void 0:h.id)===C.id;let V=!!i[C.id],Z=!1;if(o&&k){const{total:H,checkedCount:ie}=mt(C,i);ie>0&&ie<H?Z=!0:H>0&&ie===H&&(V=!0)}const R=_&&h.pos!=="inside"?{boxShadow:h.pos==="before"?`inset 0 2px 0 0 ${t.primary}`:`inset 0 -2px 0 0 ${t.primary}`}:{},ue=_&&h.pos==="inside"||Y?t.primaryLt:"transparent";return e.jsxs("div",{style:{opacity:J?.4:1},children:[e.jsxs("div",{draggable:!!l,onDragStart:l?H=>U(H,C.id):void 0,onDragOver:l?H=>le(H,C.id):void 0,onDrop:l?H=>Q(H,C.id):void 0,onDragEnd:l?oe:void 0,title:f==null?void 0:f(C),onClick:()=>{w(C.id),a==null||a(C),k&&W(C.id)},onDoubleClick:()=>{d&&($(C.id),M(C.value||""))},style:{display:"flex",alignItems:"center",gap:4,padding:`5px 8px 5px ${12+P*18}px`,cursor:l?"grab":"pointer",borderRadius:t.r,margin:"1px 4px",background:ue,color:Y?t.primary:t.text,userSelect:"none",fontSize:13,...R},onMouseEnter:H=>!Y&&!_&&(H.currentTarget.style.background=t.bg),onMouseLeave:H=>!Y&&!_&&(H.currentTarget.style.background="transparent"),children:[e.jsx("span",{style:{width:16,textAlign:"center",fontSize:11,color:t.textMut,flexShrink:0},onClick:H=>{H.stopPropagation(),k&&W(C.id)},children:k?O?"▾":"▸":""}),e.jsx("span",{style:{fontSize:15,flexShrink:0},children:k?O?"📂":"📁":"📄"}),o&&e.jsx("input",{ref:H=>{H&&(H.indeterminate=Z)},type:"checkbox",checked:V,onChange:H=>{H.stopPropagation(),S(C.id,H.target.checked)},style:{cursor:"pointer",accentColor:t.primary,flexShrink:0},onClick:H=>H.stopPropagation()}),z===C.id?e.jsx("input",{autoFocus:!0,className:"dhx dhx-input",style:{height:24,fontSize:12,flex:1},value:N,onChange:H=>M(H.target.value),onBlur:G,onKeyDown:H=>{H.key==="Enter"&&G(),H.key==="Escape"&&$(null)},onClick:H=>H.stopPropagation()}):e.jsx("span",{style:{flex:1},children:C.value}),C.count!==void 0&&e.jsxs("span",{style:{fontSize:11,color:t.textMut},children:["(",C.count,")"]})]}),k&&O&&e.jsx("div",{children:C.items.map(H=>I(H,P+1))})]},C.id)};return e.jsx("div",{className:"dhx dhx-scroll",style:{overflowY:"auto",...x},onDragOver:l?C=>C.preventDefault():void 0,onDrop:l?C=>{C.preventDefault(),L(null),F(null)}:void 0,children:m.map(C=>I(C))})}function zt({total:r,pageSize:o=10,page:d,onChange:l,style:f}){const[a,u]=g.useState(d||1),p=Math.ceil(r/o);g.useEffect(q,[]);const x=n=>{const s=Math.min(Math.max(1,n),p);u(s),l==null||l(s)},m=g.useMemo(()=>{const n=[];for(let c=Math.max(1,a-2);c<=Math.min(p,a+2);c++)n.push(c);return n[0]>1&&(n[0]>2&&n.unshift("..."),n.unshift(1)),n[n.length-1]<p&&(n[n.length-1]<p-1&&n.push("..."),n.push(p)),n},[a,p]);return e.jsxs("div",{className:"dhx",style:{display:"flex",alignItems:"center",gap:4,padding:"8px 12px",...f},children:[e.jsxs("span",{style:{fontSize:12,color:t.textSec,marginRight:8},children:[(a-1)*o+1,"–",Math.min(a*o,r)," of ",r]}),[["«",1],["‹",a-1]].map(([n,s])=>e.jsx("button",{className:"dhx dhx-btn dhx-btn-ghost",style:{height:30,padding:"0 8px",fontSize:14},disabled:a===1,onClick:()=>x(s),children:n},n)),m.map((n,s)=>e.jsx("button",{onClick:()=>typeof n=="number"&&x(n),className:`dhx dhx-btn ${n===a?"dhx-btn-primary":"dhx-btn-ghost"}`,style:{height:30,minWidth:30,padding:"0 8px",fontSize:13},disabled:n==="...",children:n},s)),[["›",a+1],["»",p]].map(([n,s])=>e.jsx("button",{className:"dhx dhx-btn dhx-btn-ghost",style:{height:30,padding:"0 8px",fontSize:14},disabled:a===p,onClick:()=>x(s),children:n},n))]})}function Ct({config:r={},defaultValues:o={},onSubmit:d,style:l}){const[f,a]=g.useState(o),[u,p]=g.useState({}),[x,m]=g.useState(null);g.useEffect(q,[]);const n=(i,b)=>{a(z=>({...z,[i]:b})),p(z=>({...z,[i]:null}))},s=i=>{const b=[];return i.flat().forEach(z=>{!z||typeof z!="object"||!("name"in z)||(b.push(z),z.type==="fieldset"&&z.rows&&b.push(...s(z.rows)))}),b},c=()=>{const i={};return s(r.rows||[]).forEach(b=>{b.required&&!f[b.name]&&(i[b.name]=`${b.label||b.name} is required`)}),p(i),Object.keys(i).length===0},v=i=>{const b=f[i.name]??i.value??"",z=u[i.name],$=i.labelWidth??r.labelWidth,N=$!==void 0||i.labelPosition==="left";if(i.type==="fieldset")return e.jsxs("fieldset",{style:{border:`1px solid ${t.border}`,borderRadius:t.r,padding:"12px 16px",marginBottom:14},children:[e.jsx("legend",{style:{fontSize:12,fontWeight:700,color:t.textSec,padding:"0 6px"},children:i.label}),(i.rows||[]).map(S=>v(S))]},i.name);if(i.type==="spacer")return e.jsx("div",{style:{height:i.height||16}},i.name);const M=$?{minWidth:$,width:$,flexShrink:0,paddingTop:8,boxSizing:"border-box"}:{},D=i.label?e.jsxs("label",{className:"dhx dhx-label",style:{display:"flex",gap:4,...M},children:[i.label,i.required&&e.jsx("span",{style:{color:t.danger},children:"*"})]},"lbl"):null,F=z?e.jsx("div",{style:{fontSize:11,color:t.danger,marginTop:3},children:z}):null,h=i.helpMessage?e.jsxs("div",{style:{fontSize:11,color:t.textMut,marginTop:3},children:["ⓘ ",i.helpMessage]}):null,L={key:i.name,className:"dhx-form-group"},W=S=>N?e.jsxs("div",{...L,style:{display:"flex",alignItems:"flex-start",gap:8},children:[D,e.jsxs("div",{style:{flex:1,minWidth:0},children:[S,F,h]})]}):e.jsxs("div",{...L,children:[D,S,F,h]});if(!i.type||i.type==="input")return W(e.jsxs("div",{className:"dhx-input-wrap",children:[i.icon&&e.jsx("span",{className:"dhx-input-icon",children:i.icon}),e.jsx("input",{className:`dhx dhx-input${i.icon?" dhx-input--with-icon":""}`,style:{borderColor:z?t.danger:void 0},type:i.inputType||"text",placeholder:i.placeholder,value:b,onChange:S=>n(i.name,S.target.value),disabled:i.disabled})]}));if(i.type==="textarea")return W(e.jsx("textarea",{className:"dhx dhx-input",style:{height:80,resize:"vertical",padding:"8px 10px"},placeholder:i.placeholder,value:b,onChange:S=>n(i.name,S.target.value)}));if(i.type==="select")return W(e.jsxs("select",{className:"dhx dhx-input",value:b,onChange:S=>n(i.name,S.target.value),style:{cursor:"pointer"},children:[e.jsx("option",{value:"",children:"— Select —"}),(i.options||[]).map(S=>e.jsx("option",{value:S.value,children:S.label||S.value},S.value))]}));if(i.type==="datepicker")return W(e.jsx("input",{type:"date",className:"dhx dhx-input",value:b,onChange:S=>n(i.name,S.target.value)}));if(i.type==="timepicker"){const S=f[i.name]??{h:12,m:0,ampm:"AM"},G=!!f[i.name],U=G?`${String(S.h).padStart(2,"0")}:${String(S.m).padStart(2,"0")}${S.ampm?" "+S.ampm:""}`:i.placeholder||"Click to select",le=e.jsxs("div",{style:{position:"relative"},children:[e.jsxs("div",{className:"dhx dhx-input",style:{cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"space-between"},onClick:()=>m(x===i.name?null:i.name),children:[e.jsx("span",{style:{color:G?t.text:t.textMut},children:U}),e.jsx("span",{style:{fontSize:13,color:t.textSec},children:"🕐"})]}),x===i.name&&e.jsx("div",{style:{position:"absolute",zIndex:100,top:"calc(100% + 4px)",left:0},children:e.jsx(Ie,{value:S,controls:!0,onChange:Q=>{n(i.name,Q),m(null)}})})]});return W(le)}if(i.type==="colorpicker")return W(e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[e.jsx("input",{type:"color",value:b||"#000000",onChange:S=>n(i.name,S.target.value),style:{width:36,height:36,padding:2,border:`1px solid ${t.border}`,borderRadius:t.r,cursor:"pointer",background:"none"}}),e.jsx("span",{style:{fontSize:12,color:t.textSec,fontFamily:"monospace"},children:b||"#000000"})]}));if(i.type==="text")return W(e.jsx("p",{style:{margin:"6px 0",fontSize:13,color:t.text},children:i.value}));if(i.type==="checkbox")return e.jsxs("div",{...L,children:[N?e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[$&&e.jsx("div",{style:{width:$,flexShrink:0}}),e.jsxs("label",{style:{display:"flex",alignItems:"center",gap:8,cursor:"pointer"},children:[e.jsx("input",{type:"checkbox",checked:!!b,onChange:S=>n(i.name,S.target.checked),style:{width:16,height:16,accentColor:t.primary,cursor:"pointer"}}),e.jsx("span",{style:{fontSize:13},children:i.label})]})]}):e.jsxs("label",{style:{display:"flex",alignItems:"center",gap:8,cursor:"pointer"},children:[e.jsx("input",{type:"checkbox",checked:!!b,onChange:S=>n(i.name,S.target.checked),style:{width:16,height:16,accentColor:t.primary,cursor:"pointer"}}),e.jsx("span",{style:{fontSize:13},children:i.label})]}),h]});if(i.type==="radio"){const S=(i.options||[]).map(G=>e.jsxs("label",{style:{display:"flex",alignItems:"center",gap:6,cursor:"pointer",fontSize:13},children:[e.jsx("input",{type:"radio",name:i.name,value:G.value,checked:b===G.value,onChange:()=>n(i.name,G.value),style:{accentColor:t.primary,cursor:"pointer"}}),G.label||G.value]},G.value));return W(e.jsx("div",{style:{display:"flex",gap:16,flexWrap:"wrap",paddingTop:8},children:S}))}if(i.type==="slider")return N?e.jsxs("div",{...L,style:{display:"flex",alignItems:"flex-start",gap:8},children:[D,e.jsxs("div",{style:{flex:1},children:[e.jsx(be,{min:i.min,max:i.max,step:i.step,value:b||i.min,range:i.range,onChange:S=>n(i.name,S)}),h]})]}):e.jsxs("div",{...L,children:[e.jsx(be,{label:i.label,min:i.min,max:i.max,step:i.step,value:b||i.min,range:i.range,onChange:S=>n(i.name,S)}),h]});if(i.type==="combo")return N?e.jsxs("div",{...L,style:{display:"flex",alignItems:"flex-start",gap:8},children:[D,e.jsxs("div",{style:{flex:1},children:[e.jsx(ye,{data:i.data||[],multiselection:i.multiselection,placeholder:i.placeholder||"Select...",value:b||(i.multiselection?[]:null),onChange:S=>n(i.name,S)}),F,h]})]}):e.jsxs("div",{...L,children:[e.jsx(ye,{label:i.label,data:i.data||[],multiselection:i.multiselection,placeholder:i.placeholder||"Select...",value:b||(i.multiselection?[]:null),onChange:S=>n(i.name,S)}),F,h]});if(i.type==="toggle"){const S=!!b,G=S?i.icon:i.offIcon||i.icon,U=S?i.text||i.label:i.offText||i.text||i.label;return e.jsxs("div",{...L,children:[N&&$&&e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[e.jsx("div",{style:{width:$,flexShrink:0}}),e.jsxs("label",{style:{display:"flex",alignItems:"center",gap:8,cursor:"pointer"},children:[e.jsx(He,{on:S,onClick:()=>n(i.name,!b)}),G&&e.jsx("span",{style:{fontSize:16},children:G}),U&&e.jsx("span",{style:{fontSize:13},children:U})]})]}),!N&&e.jsxs("label",{style:{display:"flex",alignItems:"center",gap:10,cursor:"pointer"},children:[e.jsx(He,{on:S,onClick:()=>n(i.name,!b)}),G&&e.jsx("span",{style:{fontSize:16},children:G}),U&&e.jsx("span",{style:{fontSize:13},children:U})]}),h]})}return null},w=i=>i.map((b,z)=>Array.isArray(b)?e.jsx("div",{style:{display:"flex",gap:12,alignItems:"flex-start"},children:b.map(v)},z):v(b));return e.jsxs("div",{className:"dhx",style:{padding:r.padding||0,width:r.width||"100%",...l},children:[w(r.rows||[]),(r.buttons||d)&&e.jsxs("div",{style:{display:"flex",gap:8,justifyContent:r.buttonAlign||"flex-start",marginTop:8},children:[e.jsx("button",{className:"dhx dhx-btn dhx-btn-primary",onClick:()=>c()&&(d==null?void 0:d(f)),children:r.submitText||"Submit"}),r.resetButton!==!1&&e.jsx("button",{className:"dhx dhx-btn dhx-btn-secondary",onClick:()=>{a(o),p({})},children:r.resetText||"Reset"})]})]})}function He({on:r,onClick:o}){return e.jsxs("div",{style:{position:"relative",width:40,height:22,flexShrink:0},onClick:o,children:[e.jsx("div",{style:{width:40,height:22,borderRadius:11,background:r?t.primary:t.border,transition:"background 0.2s"}}),e.jsx("div",{style:{position:"absolute",top:3,left:r?21:3,width:16,height:16,borderRadius:"50%",background:"#fff",transition:"left 0.2s",boxShadow:"0 1px 3px rgba(0,0,0,.3)"}})]})}function Me(r){const o=[];for(const d of r)d.type==="block"?o.push(...Me(d.items||[])):o.push(d);return o}function $t({items:r=[],onAction:o,style:d}){g.useEffect(q,[]);const[l,f]=g.useState(()=>{const s={};for(const c of Me(r))c.id&&(s[c.id]=!!c.active);return s}),a=Me(r),u=s=>{var c;if(!s.disabled){if(s.id)if(s.group){const v=a.filter(w=>w.group===s.group&&w.id);f(w=>{const i={...w};for(const b of v)i[b.id]=!1;return i[s.id]=!0,i})}else s.twoState&&f(v=>({...v,[s.id]:!v[s.id]}));(c=s.onClick)==null||c.call(s,s),s.id&&(o==null||o(s.id,s))}},p=(s,c)=>{var b;if(s.hidden)return null;const v=s.value??s.text,w=s.size==="auto",i=s.id!==void 0?l[s.id]??!!s.active:!!s.active;return s.type==="separator"||s.type==="sep"?e.jsx("div",{style:{width:1,background:t.border,margin:"4px 2px",alignSelf:"stretch"}},c):s.type==="input"?e.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"flex-start",justifyContent:"center",padding:"2px 4px",gap:2},children:[s.label&&e.jsx("span",{style:{fontSize:10,color:t.textMut},children:s.label}),e.jsxs("div",{style:{position:"relative",display:"flex",alignItems:"center"},children:[s.icon&&e.jsx("span",{style:{position:"absolute",left:6,fontSize:13,color:t.textMut,pointerEvents:"none",zIndex:1},children:s.icon}),e.jsx("input",{className:"dhx dhx-input",style:{width:s.width||110,height:26,fontSize:12,paddingLeft:s.icon?24:void 0},placeholder:s.placeholder,defaultValue:s.value,onChange:z=>{var $;return($=s.onChange)==null?void 0:$.call(s,z.target.value)}})]})]},c):s.type==="selectButton"?e.jsx("select",{className:"dhx dhx-input",style:{height:26,fontSize:12,cursor:"pointer",margin:2,width:s.width},defaultValue:s.value,onChange:z=>{var $;return($=s.onChange)==null?void 0:$.call(s,z.target.value)},children:(b=s.items)==null?void 0:b.map(z=>e.jsx("option",{value:z.value,children:z.value},z.value))},c):e.jsxs("button",{title:s.tooltip,disabled:s.disabled,className:"dhx dhx-btn dhx-btn-ghost",style:{flexDirection:w?"column":"row",alignSelf:w?"stretch":"center",justifyContent:"center",minHeight:w?48:26,padding:w?"6px 10px":"0 8px",gap:w?4:5,position:"relative",background:i?t.primaryLt:"transparent",color:i?t.primary:s.disabled?t.textMut:t.text,opacity:s.disabled?.55:1,cursor:s.disabled?"not-allowed":"pointer"},onClick:()=>u(s),children:[s.icon&&e.jsx("span",{style:{fontSize:w?22:15,lineHeight:1,flexShrink:0},children:s.icon}),v&&e.jsx("span",{style:{fontSize:10,maxWidth:w?64:void 0,textAlign:w?"center":"left",lineHeight:1.2,whiteSpace:w?"normal":"nowrap"},children:v}),s.count!==void 0&&e.jsx("span",{style:{position:"absolute",top:2,right:2,minWidth:14,height:14,background:t.danger,color:"#fff",borderRadius:7,fontSize:9,fontWeight:700,display:"flex",alignItems:"center",justifyContent:"center",padding:"0 2px",pointerEvents:"none"},children:s.count})]},c)},x=(s,c)=>{var v;return e.jsx("div",{style:{display:"flex",flexDirection:s.direction==="col"?"column":"row",alignItems:s.direction==="col"?"flex-start":"center",gap:2},children:(v=s.items)==null?void 0:v.map((w,i)=>w.type==="block"?x(w,`${c}-${i}`):p(w,`${c}-${i}`))},c)},m=(s,c)=>{var w;const v=s.title||s.label;return e.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"stretch",borderRight:`1px solid ${t.border}`,padding:"4px 6px 0",minWidth:40},children:[e.jsx("div",{style:{display:"flex",flexDirection:s.direction==="col"?"column":"row",alignItems:s.direction==="col"?"stretch":"center",gap:2,flex:1},children:(w=s.items)==null?void 0:w.map((i,b)=>i.type==="block"?x(i,b):p(i,b))}),v&&e.jsx("div",{style:{fontSize:10,color:t.textMut,textAlign:"center",padding:"3px 0 4px",marginTop:2,borderTop:`1px solid ${t.border}`},children:v})]},c)},n=(s,c)=>s.type==="block"?m(s,c):p(s,c);return e.jsx("div",{className:"dhx",style:{display:"flex",alignItems:"stretch",background:t.surface,borderBottom:`1px solid ${t.border}`,overflowX:"auto",gap:0,minHeight:72,...d},children:r.map(n)})}function Pe({count:r}){return e.jsx("span",{style:{position:"absolute",top:3,right:3,minWidth:16,height:16,background:t.danger,color:"#fff",borderRadius:8,fontSize:10,fontWeight:700,display:"flex",alignItems:"center",justifyContent:"center",padding:"0 3px",lineHeight:1,pointerEvents:"none"},children:r})}function Dt({logo:r,items:o=[],vertical:d=!1,onAction:l,style:f}){const[a,u]=g.useState(null),[p,x]=g.useState(()=>{const c={};return o.forEach(v=>{v.id&&v.twoState&&v.active&&(c[v.id]=!0)}),c}),m=g.useRef(null);g.useEffect(q,[]),ce(m,g.useCallback(()=>u(null),[]));const n=(c,v)=>{var w,i;if(!c.disabled){if(c.twoState&&c.id&&x(b=>({...b,[c.id]:!b[c.id]})),(w=c.items)!=null&&w.length){u(b=>b===v?null:v);return}(i=c.onClick)==null||i.call(c,c.id||""),l==null||l(c.id||"")}},s=(c,v)=>{var z;if(c.hidden)return null;if(c.type==="separator")return e.jsx("div",{style:{[d?"height":"width"]:1,background:t.border,margin:d?"4px 8px":"0 6px",alignSelf:"stretch"}},v);if(c.type==="spacer")return e.jsx("div",{style:{flex:1}},v);if(c.type==="input")return e.jsxs("div",{style:{position:"relative",display:"flex",alignItems:"center",margin:"0 4px"},children:[c.icon&&e.jsx("span",{style:{position:"absolute",left:8,color:t.textMut,fontSize:15,pointerEvents:"none",zIndex:1},children:c.icon}),e.jsx("input",{className:"dhx dhx-input",style:{width:c.width||200,height:28,paddingLeft:c.icon?30:void 0},placeholder:c.placeholder,onChange:$=>{var N;return(N=c.onChange)==null?void 0:N.call(c,$.target.value)}})]},v);if(c.type==="imageButton")return e.jsxs("button",{title:c.tooltip,disabled:c.disabled,style:{position:"relative",width:36,height:36,padding:2,border:"none",borderRadius:"50%",overflow:"hidden",cursor:c.disabled?"not-allowed":"pointer",background:"transparent",flexShrink:0},onClick:()=>n(c,v),children:[c.src&&e.jsx("img",{src:c.src,alt:c.value||"",style:{width:"100%",height:"100%",objectFit:"cover",borderRadius:"50%"}}),c.count!==void 0&&e.jsx(Pe,{count:c.count})]},v);const w=!!(c.twoState&&c.id&&p[c.id]),i=!!((z=c.items)!=null&&z.length),b={position:"relative",height:d?40:36,gap:6,background:w?t.primaryLt:"transparent",color:w?t.primary:c.disabled?t.textMut:t.text,opacity:c.disabled?.55:1,cursor:c.disabled?"not-allowed":"pointer",...d?{width:"100%",justifyContent:"flex-start",padding:"0 16px",borderRadius:0}:{}};return e.jsxs("div",{style:{position:"relative"},children:[e.jsxs("button",{className:"dhx dhx-btn dhx-btn-ghost",title:c.tooltip,disabled:c.disabled,style:b,onClick:()=>n(c,v),children:[c.icon&&e.jsx("span",{style:{fontSize:16,flexShrink:0},children:c.icon}),c.value&&e.jsx("span",{style:{fontSize:13},children:c.value}),i&&e.jsx("span",{style:{fontSize:9,opacity:.55,marginLeft:2},children:"▼"}),c.count!==void 0&&e.jsx(Pe,{count:c.count})]}),i&&a===v&&e.jsx(he,{items:c.items,onSelect:$=>{var N;u(null),$.id&&((N=c.onClick)==null||N.call(c,$.id),l==null||l($.id))},style:d?{left:"100%",top:0}:{top:"100%"}})]},v)};return e.jsxs("nav",{ref:m,className:"dhx",style:{display:"flex",flexDirection:d?"column":"row",alignItems:d?"stretch":"center",background:t.surface,borderBottom:d?"none":`1px solid ${t.border}`,borderRight:d?`1px solid ${t.border}`:"none",padding:d?"8px 0":"0 12px",minHeight:d?void 0:48,gap:2,...f},children:[r&&e.jsx("div",{style:{color:t.text,fontWeight:800,fontSize:16,padding:d?"8px 16px 12px":"0 12px 0 4px",borderBottom:d?`1px solid ${t.border}`:"none",borderRight:d?"none":`1px solid ${t.border}`,marginRight:d?0:8,marginBottom:d?4:0,flexShrink:0},children:r}),o.map(s)]})}j.Button=Ve,j.Calendar=pt,j.Chart=at,j.Colorpicker=ft,j.Combobox=ye,j.ContextMenu=qe,j.DataView=kt,j.Form=Ct,j.Grid=lt,j.Layout=Te,j.List=St,j.Menu=Xe,j.MenuDropdown=he,j.MessageContext=Se,j.MessageProvider=bt,j.Navbar=Dt,j.Pagination=zt,j.Popup=gt,j.Ribbon=$t,j.Sidebar=Ze,j.Slider=be,j.Tabbar=et,j.Timepicker=Ie,j.Toolbar=Ge,j.Tree=Mt,j.Window=xt,j.tokens=t,j.useClickOutside=ce,j.useDrag=Ee,j.useMessage=vt,Object.defineProperty(j,Symbol.toStringTag,{value:"Module"})});
42
42
  //# sourceMappingURL=dhx-react-suite.umd.cjs.map