dhx-react-suite 1.0.9 → 1.1.1

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(W,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):(W=typeof globalThis<"u"?globalThis:W||self,e(W.DhxReactSuite={},W.ReactJSXRuntime,W.React,W.Recharts))})(this,function(W,e,u,Y){"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"},ke="dhx-react-styles";function j(){if(typeof document>"u"||document.getElementById(ke))return;const r=document.createElement("style");r.id=ke,r.textContent=`
1
+ (function(W,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):(W=typeof globalThis<"u"?globalThis:W||self,e(W.DhxReactSuite={},W.ReactJSXRuntime,W.React,W.Recharts))})(this,function(W,e,u,Y){"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 j(){if(typeof document>"u"||document.getElementById(we))return;const r=document.createElement("style");r.id=we,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:l="primary",size:d="md",icon:c,disabled:g,onClick:a,style:f,className:s=""}){return u.useEffect(j,[]),e.jsxs("button",{className:`dhx dhx-btn dhx-btn-${l} ${s}`,style:{...Ne[d],...f},disabled:g,onClick:a,children:[c&&e.jsx("span",{style:{fontSize:16},children:c}),r]})}function U(r,l){u.useEffect(()=>{const d=c=>{r.current&&!r.current.contains(c.target)&&l(c)};return document.addEventListener("mousedown",d),()=>document.removeEventListener("mousedown",d)},[r,l])}function we(r){const l=u.useRef(!1),d=u.useRef({x:0,y:0,ox:0,oy:0});return u.useCallback((c,g=0,a=0)=>{l.current=!0,d.current={x:c.clientX,y:c.clientY,ox:g,oy:a};const f=x=>{if(!l.current)return;const{x:b,y:n,ox:S,oy:h}=d.current;r(S+x.clientX-b,h+x.clientY-n)},s=()=>{l.current=!1,document.removeEventListener("mousemove",f),document.removeEventListener("mouseup",s)};document.addEventListener("mousemove",f),document.addEventListener("mouseup",s),c.preventDefault()},[r])}function R({items:r,onSelect:l,style:d}){const[c,g]=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",...d},children:r.map((a,f)=>{var x,b;if(a.type==="separator")return e.jsx("div",{style:{height:1,background:t.border,margin:"4px 0"}},f);const s=c===f;return e.jsxs("div",{style:{position:"relative"},onMouseEnter:()=>g(f),onMouseLeave:()=>g(null),children:[e.jsxs("div",{onClick:()=>{var n;return!a.disabled&&!((n=a.items)!=null&&n.length)&&l(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:s&&!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]}),s&&((b=a.items)!=null&&b.length)?e.jsx(R,{items:a.items,onSelect:l,style:{position:"absolute",left:"100%",top:-4}}):null]},a.id||f)})})}function Ae({items:r=[],label:l="Menu",onSelect:d,style:c}){const[g,a]=u.useState(!1),f=u.useRef(null);return u.useEffect(j,[]),U(f,u.useCallback(()=>a(!1),[])),e.jsxs("div",{ref:f,className:"dhx",style:{position:"relative",display:"inline-block",...c},children:[e.jsxs("button",{className:"dhx dhx-btn dhx-btn-secondary",onClick:()=>a(s=>!s),children:[l," ",e.jsx("span",{style:{fontSize:10},children:g?"▲":"▼"})]}),g&&e.jsx(R,{items:r,onSelect:s=>{d==null||d(s),a(!1)}})]})}function Be({items:r=[],onSelect:l,children:d}){const[c,g]=u.useState(null),a=u.useRef(null);u.useEffect(j,[]),U(a,u.useCallback(()=>g(null),[]));const f=s=>{s.preventDefault(),g({x:s.clientX,y:s.clientY})};return e.jsxs("div",{ref:a,onContextMenu:f,style:{position:"relative",display:"contents"},children:[d,c&&e.jsx("div",{style:{position:"fixed",left:c.x,top:c.y,zIndex:9999},children:e.jsx(R,{items:r,onSelect:s=>{l==null||l(s),g(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:l,style:d}){const[c,g]=u.useState(null),[a,f]=u.useState(()=>{const n={};return r.forEach(S=>{S.id&&(S.twoState||S.group)&&S.active&&(n[S.id]=!0)}),n}),s=u.useRef(null);u.useEffect(j,[]),U(s,u.useCallback(()=>g(null),[]));const x=(n,S)=>{var h,y;if(!n.disabled){if(n.twoState&&n.id&&f(o=>({...o,[n.id]:!o[n.id]})),n.group&&n.id&&f(o=>{const v={...o};return r.forEach(z=>{z.group===n.group&&z.id&&(v[z.id]=!1)}),v[n.id]=!0,v}),(h=n.items)!=null&&h.length){g(o=>o===S?null:S);return}(y=n.onClick)==null||y.call(n,n.id||""),l==null||l(n.id||"")}},b=(n,S)=>{var v,z;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:$=>{var D;return(D=n.onChange)==null?void 0:D.call(n,$.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:$=>{var D;return(D=n.onChange)==null?void 0:D.call(n,$.target.value)},children:(v=n.options)==null?void 0:v.map($=>e.jsx("option",{value:$.value,children:$.label},$.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(Me,{count:n.count})]},S);const h=!!(n.id&&a[n.id]),y=n.value??n.text,o=!!((z=n.items)!=null&&z.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:h?t.primaryLt:"transparent",color:h?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}),y&&e.jsx("span",{style:{fontSize:13},children:y}),o&&e.jsx("span",{style:{fontSize:9,opacity:.55,marginLeft:2},children:"▼"}),n.count!==void 0&&e.jsx(Me,{count:n.count})]}),o&&c===S&&e.jsx(R,{items:n.items,onSelect:()=>g(null),style:{top:"100%",left:0}})]},S)};return e.jsx("div",{ref:s,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(b)})}function Pe({items:r=[],width:l=240,collapsed:d,onSelect:c,header:g,footer:a,style:f}){const[s,x]=u.useState(d??!1),[b,n]=u.useState(null),[S,h]=u.useState({});u.useEffect(j,[]);const y=s?56:l,o=z=>{n(z.id),c==null||c(z)},v=(z,$=0)=>{var k;if(z.type==="separator")return e.jsx("div",{style:{height:1,background:t.border,margin:"6px 8px"}},z.id);if(z.type==="customHTML")return e.jsx("div",{style:{padding:"8px 12px"},dangerouslySetInnerHTML:{__html:z.html||""}},z.id);const D=(((k=z.items)==null?void 0:k.length)??0)>0,T=S[z.id],p=b===z.id;return e.jsxs("div",{children:[e.jsxs("div",{onClick:()=>{D&&h(N=>({...N,[z.id]:!N[z.id]})),o(z)},style:{display:"flex",alignItems:"center",gap:10,padding:`8px ${s?"0px":`${12+$*16}px`}`,cursor:"pointer",borderRadius:t.r,margin:"1px 6px",justifyContent:s?"center":"flex-start",transition:"all .15s",background:p?t.primaryLt:"transparent",color:p?t.primary:t.text,userSelect:"none"},onMouseEnter:N=>!p&&(N.currentTarget.style.background=t.bg),onMouseLeave:N=>!p&&(N.currentTarget.style.background="transparent"),children:[z.icon&&e.jsx("span",{style:{fontSize:18,minWidth:22,textAlign:"center"},children:z.icon}),!s&&e.jsx("span",{style:{flex:1,fontSize:13,fontWeight:p?600:400},children:z.value}),!s&&z.count!==void 0&&e.jsx("span",{style:{background:t.primary,color:"#fff",borderRadius:10,padding:"1px 6px",fontSize:11,fontWeight:700},children:z.count}),!s&&D&&e.jsx("span",{style:{fontSize:12,color:t.textMut,transition:"transform .15s",transform:T?"rotate(90deg)":"rotate(0deg)"},children:"▶"})]}),D&&T&&!s&&z.items.map(N=>v(N,$+1))]},z.id)};return e.jsxs("div",{className:"dhx",style:{width:y,minWidth:y,background:t.surface,borderRight:`1px solid ${t.border}`,display:"flex",flexDirection:"column",transition:"width .2s ease",overflow:"hidden",...f},children:[g&&!s&&e.jsx("div",{style:{padding:"12px 14px",borderBottom:`1px solid ${t.border}`,fontWeight:700,fontSize:15},children:g}),e.jsx("button",{onClick:()=>x(z=>!z),style:{margin:"8px 6px",background:"transparent",border:"none",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:s?"center":"flex-end",padding:"4px 6px",borderRadius:t.r,color:t.textSec},children:e.jsx("span",{style:{fontSize:18},children:s?"☰":"✕"})}),e.jsx("div",{className:"dhx-scroll",style:{flex:1,overflowY:"auto",overflowX:"hidden"},children:r.map(z=>v(z))}),a&&!s&&e.jsx("div",{style:{padding:"10px 14px",borderTop:`1px solid ${t.border}`},children:a})]})}function je({config:r}){const[l,d]=u.useState(!1),c={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},...l?{flex:"0 0 auto"}:{}};return e.jsxs("div",{style:c,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(g=>!g),style:{background:"none",border:"none",cursor:"pointer",color:t.textMut,fontSize:16,lineHeight:1},children:l?"▼":"▲"})]}),!l&&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:l,type:d="line",style:c,children:g}){u.useEffect(j,[]);const a=d==="space"?12:d==="wide"?8:1,f=r||l,s=!!r;return f?e.jsx("div",{className:"dhx",style:{display:"flex",flexDirection:s?"column":"row",gap:a,width:"100%",height:"100%",...c},children:f.map((x,b)=>e.jsx(je,{config:x},x.id||b))}):e.jsx("div",{className:"dhx",style:{width:"100%",height:"100%",...c},children:g})}function Oe({views:r=[],mode:l="top",tabAlign:d="left",closable:c=[],disabled:g=[],defaultActive:a,onBeforeChange:f,onChange:s,style:x}){var p;const[b,n]=u.useState(a||((p=r[0])==null?void 0:p.id)),[S,h]=u.useState(r.map(k=>k.id));u.useEffect(j,[]);const y=(k,N)=>{k.stopPropagation(),h(i=>i.filter(C=>C!==N)),b===N&&n(S.find(i=>i!==N)??"")},o=k=>{g.includes(k)||f&&f(k)===!1||(n(k),s==null||s(k))},v=l==="left"||l==="right",z=r.filter(k=>S.includes(k.id)),$=e.jsx("div",{style:{display:"flex",flexDirection:v?"column":"row",justifyContent:d==="center"?"center":d==="right"?"flex-end":"flex-start",background:t.surface,borderBottom:!v&&l!=="bottom"?`2px solid ${t.border}`:"none",borderTop:l==="bottom"?`2px solid ${t.border}`:"none",borderRight:l==="left"?`2px solid ${t.border}`:"none",borderLeft:l==="right"?`2px solid ${t.border}`:"none",overflowX:"auto",flexShrink:0},children:z.map(k=>{const N=b===k.id,i=g.includes(k.id),C=l==="bottom"?{borderTop:`2px solid ${t.primary}`,color:t.primary,fontWeight:600}:v?{color:t.primary,fontWeight:600,background:t.primaryLt,[l==="left"?"borderRight":"borderLeft"]:`2px solid ${t.primary}`}:{borderBottom:`2px solid ${t.primary}`,color:t.primary,fontWeight:600};return e.jsxs("div",{onClick:()=>o(k.id),style:{display:"flex",alignItems:"center",gap:6,padding:"10px 16px",cursor:i?"not-allowed":"pointer",whiteSpace:"nowrap",fontSize:13,transition:"color .15s",userSelect:"none",minWidth:v?120:"auto",...N?C:{color:i?t.textMut:t.textSec}},children:[k.icon&&e.jsx("span",{style:{fontSize:16},children:k.icon}),e.jsx("span",{children:k.tab}),c.includes(k.id)&&e.jsx("span",{onClick:w=>y(w,k.id),style:{marginLeft:4,opacity:.6,fontSize:12,cursor:"pointer"},children:"✕"})]},k.id)})}),D=z.find(k=>k.id===b),T=e.jsxs("div",{className:"dhx-scroll",style:{flex:1,overflow:"auto"},children:[D==null?void 0:D.content,(D==null?void 0:D.html)&&e.jsx("div",{dangerouslySetInnerHTML:{__html:D.html},style:{padding:16}})]});return e.jsxs("div",{className:"dhx",style:{display:"flex",flexDirection:l==="top"?"column":l==="bottom"?"column-reverse":l==="left"?"row":"row-reverse",width:"100%",height:"100%",background:t.surface,border:`1px solid ${t.border}`,borderRadius:t.r,overflow:"hidden",...x},children:[$,T]})}const Q=`1px solid ${t.border}`;function Ye({active:r,dir:l}){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&&l==="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&&l==="desc"?t.primary:t.borderDk})})]})}function Fe({columns:r,data:l=[],height:d=400,rowHeight:c=40,sortable:g=!0,resizable:a=!0,editable:f=!1,stripe:s=!1,autoWidth:x=!1,keyNavigation:b=!1,selection:n,multiselect:S,onSelect:h,onChange:y,style:o}){const[v,z]=u.useState(null),[$,D]=u.useState("asc"),[T,p]=u.useState({}),[k,N]=u.useState(new Set),[i,C]=u.useState(-1),[w,B]=u.useState(()=>r.map(M=>M.width??M.minWidth??150)),[V,J]=u.useState(null),[Z,le]=u.useState(""),[oe,ae]=u.useState({}),E=u.useRef(null),[P,F]=u.useState(0);u.useEffect(j,[]),u.useEffect(()=>{if(!x||!E.current)return;const M=new ResizeObserver(()=>{var m;return F(((m=E.current)==null?void 0:m.offsetWidth)??0)});return M.observe(E.current),()=>M.disconnect()},[x]);const X=u.useMemo(()=>{if(!x||P===0)return w;const M=w.reduce((L,I)=>L+I,0);if(P<=M)return w;const m=(P-M)/r.length;return w.map(L=>L+m)},[x,P,w,r.length]),K=u.useMemo(()=>{let M=l.map((m,L)=>{const I=String(m.id??L);return oe[I]?{...m,...oe[I]}:m}).filter(m=>Object.entries(T).every(([L,I])=>!I||String(m[L]??"").toLowerCase().includes(I.toLowerCase())));return v&&(M=[...M].sort((m,L)=>{const I=m[v],O=L[v];if(I==null)return 1;if(O==null)return-1;const H=I<O?-1:I>O?1:0;return $==="asc"?H:-H})),M},[l,v,$,T,oe]),G=u.useMemo(()=>{const M={};return r.forEach(m=>{var L;if((L=m.footer)!=null&&L.some(I=>I.summary)){const I=K.map(H=>Number(H[m.id])).filter(H=>!isNaN(H)),O=I.reduce((H,te)=>H+te,0);M[m.id]={sum:O,avg:I.length?O/I.length:0,count:K.length,min:I.length?Math.min(...I):0,max:I.length?Math.max(...I):0}}}),M},[K,r]),q=u.useMemo(()=>{const M={};return r.filter(m=>m.filterType==="select").forEach(m=>{M[m.id]=[...new Set(l.map(L=>String(L[m.id]??"")))].sort()}),M},[l,r]),ie=r.some(M=>M.filterable),de=r.some(M=>{var m;return(m=M.footer)==null?void 0:m.length}),be=X.reduce((M,m)=>M+m,0),se=(M,m)=>M.id??m,ce=M=>{!g||M.sortable===!1||(D(m=>v===M.id&&m==="asc"?"desc":"asc"),z(M.id))},A=(M,m)=>{if(!n)return;const L=se(M,m);C(m),N(I=>{const O=S?new Set(I):new Set;return O.has(L)?O.delete(L):O.add(L),O}),h==null||h(M)},ee=()=>{if(!V)return;const{key:M,colId:m}=V;ae(I=>({...I,[String(M)]:{...I[String(M)]||{},[m]:Z}}));const L=K.find((I,O)=>se(I,O)===M);L&&(y==null||y(L,m,Z)),J(null)},ct=M=>{if(V&&M.key==="Escape"){J(null);return}if(!(!b||!n)){if(M.key==="ArrowDown"){M.preventDefault();const m=Math.min(i+1,K.length-1);m>=0&&A(K[m],m)}else if(M.key==="ArrowUp"){M.preventDefault();const m=Math.max(i-1,0);m>=0&&A(K[m],m)}}},pt=(M,m)=>{M.preventDefault(),M.stopPropagation();const L=M.clientX,I=w[m],O=te=>B(Se=>{const re=[...Se];return re[m]=Math.max(r[m].minWidth||50,I+te.clientX-L),re}),H=()=>{document.removeEventListener("mousemove",O),document.removeEventListener("mouseup",H)};document.addEventListener("mousemove",O),document.addEventListener("mouseup",H)},ve=(M,m,L,I)=>({width:M,minWidth:M,flexShrink:0,boxSizing:"border-box",padding:"0 12px",height:I,display:"flex",alignItems:"center",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",fontSize:13,textAlign:m.align,justifyContent:m.align==="center"?"center":m.align==="right"?"flex-end":"flex-start",borderLeft:L?"none":Q});return e.jsx("div",{ref:E,className:"dhx",tabIndex:b?0:void 0,onKeyDown:ct,style:{width:"100%",height:d,display:"flex",flexDirection:"column",border:Q,borderRadius:t.r,overflow:"hidden",outline:"none",...o},children:e.jsx("div",{style:{overflowX:"auto",flex:1,display:"flex",flexDirection:"column",minHeight:0},children:e.jsxs("div",{style:{minWidth:be,display:"flex",flexDirection:"column",height:"100%"},children:[e.jsx("div",{style:{display:"flex",background:t.bg,borderBottom:Q,flexShrink:0,position:"sticky",top:0,zIndex:2},children:r.map((M,m)=>{var L;return e.jsxs("div",{onClick:()=>ce(M),style:{...ve(X[m],M,m===0,40),position:"relative",fontWeight:500,color:t.text,cursor:g&&M.sortable!==!1?"pointer":"default",userSelect:"none"},children:[e.jsx("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:Array.isArray(M.header)?(L=M.header[0])==null?void 0:L.text:M.header||M.id}),g&&M.sortable!==!1&&e.jsx(Ye,{active:v===M.id,dir:$}),a&&M.resizable!==!1&&m<r.length-1&&e.jsx("div",{onMouseDown:I=>pt(I,m),onClick:I=>I.stopPropagation(),style:{position:"absolute",right:0,top:0,bottom:0,width:4,cursor:"col-resize",zIndex:1},onMouseEnter:I=>I.currentTarget.style.background=t.primary+"55",onMouseLeave:I=>I.currentTarget.style.background="transparent"})]},M.id)})}),ie&&e.jsx("div",{style:{display:"flex",borderBottom:Q,background:t.surface,flexShrink:0},children:r.map((M,m)=>e.jsx("div",{style:{width:X[m],minWidth:X[m],flexShrink:0,padding:"4px 6px",boxSizing:"border-box",borderLeft:m===0?"none":Q},children:M.filterable&&M.filterType==="select"?e.jsxs("select",{className:"dhx dhx-input",style:{height:26,fontSize:12,padding:"0 4px"},value:T[M.id]||"",onChange:L=>p(I=>({...I,[M.id]:L.target.value})),children:[e.jsx("option",{value:"",children:"All"}),(q[M.id]||[]).map(L=>e.jsx("option",{value:L,children:L},L))]}):M.filterable?e.jsx("input",{className:"dhx dhx-input",style:{height:26,fontSize:12},placeholder:"Filter...",value:T[M.id]||"",onChange:L=>p(I=>({...I,[M.id]:L.target.value}))}):null},M.id))}),e.jsxs("div",{className:"dhx-scroll",style:{flex:1,overflowY:"auto",minHeight:0},children:[K.map((M,m)=>{const L=se(M,m),I=k.has(L),O=I?t.primaryLt:s&&m%2!==0?t.bg:t.surface;return e.jsx("div",{style:{display:"flex",height:c,borderBottom:Q,flexShrink:0,background:O,transition:"background .1s",cursor:n?"pointer":"default"},onMouseEnter:H=>!I&&(H.currentTarget.style.background=t.primaryLt+"80"),onMouseLeave:H=>!I&&(H.currentTarget.style.background=O),children:r.map((H,te)=>{const Se=(V==null?void 0:V.key)===L&&(V==null?void 0:V.colId)===H.id,re=M[H.id],ht=H.template?H.template(re,M):String(re??"");return e.jsx("div",{onClick:()=>{A(M,m),f&&H.editable!==!1&&(J({key:L,colId:H.id}),le(String(re??"")))},style:ve(X[te],H,te===0,c),children:Se?e.jsx("input",{autoFocus:!0,value:Z,onChange:ne=>le(ne.target.value),onBlur:ee,onKeyDown:ne=>{ne.key==="Enter"&&ee(),ne.key==="Escape"&&J(null)},onClick:ne=>ne.stopPropagation(),style:{width:"100%",border:"none",outline:`2px solid ${t.primary}`,borderRadius:2,fontSize:13,padding:"2px 4px",background:t.surface,color:t.text}}):ht},H.id)})},String(L))}),K.length===0&&e.jsx("div",{style:{textAlign:"center",padding:40,color:t.textMut,fontSize:13},children:"No data"})]}),de&&e.jsx("div",{style:{display:"flex",borderTop:Q,background:t.bg,flexShrink:0},children:r.map((M,m)=>{var H;const L=(H=M.footer)==null?void 0:H[0],I=G[M.id]??{sum:0,avg:0,count:0,min:0,max:0};let O="";return L&&(typeof L.text=="function"?O=L.text(I):L.text?O=L.text:L.summary&&(O=String(Math.round(I[L.summary]*100)/100))),e.jsx("div",{style:{...ve(X[m],M,m===0,40),fontWeight:600,color:t.text},children:O},M.id)})})]})})})}const _=["#0288d1","#43a047","#f57c00","#e53935","#8e24aa","#00838f","#ef6c00","#2e7d32"];function Ke({type:r="bar",data:l=[],series:d=[],scales:c={},legend:g,height:a=280,style:f}){var v,z,$,D,T;u.useEffect(j,[]);const s=((v=c.bottom)==null?void 0:v.text)||l[0]&&Object.keys(l[0])[0]||"x",x=e.jsx(Y.Tooltip,{contentStyle:{fontSize:12,borderRadius:t.r,border:`1px solid ${t.border}`}}),b=g?e.jsx(Y.Legend,{iconSize:10,wrapperStyle:{fontSize:12},verticalAlign:g.valign,align:g.halign}):null,n=e.jsx(Y.CartesianGrid,{strokeDasharray:"3 3",stroke:t.border}),S=e.jsx(Y.XAxis,{dataKey:s,tick:{fontSize:11,fill:t.textSec},axisLine:{stroke:t.border},tickLine:!1}),h=e.jsx(Y.YAxis,{tick:{fontSize:11,fill:t.textSec},axisLine:!1,tickLine:!1,domain:[((z=c.left)==null?void 0:z.min)??"auto",(($=c.left)==null?void 0:$.max)??"auto"]}),y={data:l,margin:{top:10,right:20,left:0,bottom:0}};let o;if(r==="bar")o=e.jsxs(Y.BarChart,{...y,children:[n,S,h,x,b,d.map((p,k)=>e.jsx(Y.Bar,{dataKey:p.value||p.id,name:p.label||p.id,fill:p.fill||_[k%_.length],radius:[3,3,0,0]},p.id))]});else if(r==="line")o=e.jsxs(Y.LineChart,{...y,children:[n,S,h,x,b,d.map((p,k)=>e.jsx(Y.Line,{type:"monotone",dataKey:p.value||p.id,name:p.label||p.id,stroke:p.color||_[k%_.length],strokeWidth:2,dot:{r:3,fill:p.color||_[k%_.length]}},p.id))]});else if(r==="area")o=e.jsxs(Y.AreaChart,{...y,children:[n,S,h,x,b,d.map((p,k)=>e.jsx(Y.Area,{type:"monotone",dataKey:p.value||p.id,name:p.label||p.id,stroke:p.color||_[k%_.length],fill:(p.fill||_[k%_.length])+"33",strokeWidth:2},p.id))]});else if(r==="pie"||r==="donut"){const p=l[0]||{},k=Object.keys(p).find(i=>typeof p[i]=="number")||"value",N=Object.keys(p).find(i=>typeof p[i]=="string")||"x";o=e.jsxs(Y.PieChart,{children:[e.jsx(Y.Pie,{data:l,cx:"50%",cy:"50%",outerRadius:r==="donut"?"70%":"80%",innerRadius:r==="donut"?"40%":0,dataKey:k,nameKey:N,label:({name:i,percent:C})=>`${i??""} ${((C??0)*100).toFixed(0)}%`,labelLine:!0,paddingAngle:2,children:l.map((i,C)=>e.jsx(Y.Cell,{fill:_[C%_.length]},C))}),x,b]})}else r==="radar"?o=e.jsxs(Y.RadarChart,{...y,cx:"50%",cy:"50%",children:[e.jsx(Y.PolarGrid,{}),e.jsx(Y.PolarAngleAxis,{dataKey:s,tick:{fontSize:11}}),d.map((p,k)=>e.jsx(Y.Radar,{dataKey:p.value||p.id,name:p.label||p.id,stroke:p.color||_[k],fill:(p.fill||_[k])+"44"},p.id)),x,b]}):r==="scatter"&&(o=e.jsxs(Y.ScatterChart,{...y,children:[n,e.jsx(Y.XAxis,{dataKey:((D=d[0])==null?void 0:D.xValue)||"x",type:"number",tick:{fontSize:11,fill:t.textSec}}),e.jsx(Y.YAxis,{dataKey:((T=d[0])==null?void 0:T.yValue)||"y",tick:{fontSize:11,fill:t.textSec}}),x,d.map((p,k)=>e.jsx(Y.Scatter,{data:p.data||l,name:p.label||p.id,fill:p.color||_[k]},p.id))]}));return e.jsx("div",{className:"dhx",style:{width:"100%",height:a,padding:12,background:t.surface,borderRadius:t.rMd,...f},children:e.jsx(Y.ResponsiveContainer,{width:"100%",height:"100%",children:o})})}const Ve=["January","February","March","April","May","June","July","August","September","October","November","December"],Xe=["Su","Mo","Tu","We","Th","Fr","Sa"];function _e({value:r,range:l=!1,timepicker:d=!1,onChange:c,style:g}){const a=new Date,f=r?new Date(Array.isArray(r)?r[0]:r):a,[s,x]=u.useState(f),[b,n]=u.useState(r??(l?[null,null]:null)),[S,h]=u.useState(null),[y,o]=u.useState({h:0,m:0});u.useEffect(j,[]);const v=s.getFullYear(),z=s.getMonth(),$=new Date(v,z,1).getDay(),D=new Date(v,z+1,0).getDate(),T=[];for(let i=0;i<$;i++)T.push(null);for(let i=1;i<=D;i++)T.push(new Date(v,z,i));const p=i=>i.toDateString()===a.toDateString(),k=i=>{if(!b)return!1;if(l&&Array.isArray(b)){const[C,w]=b;if(!C)return!1;const B=i.getTime();return w?B>=C.getTime()&&B<=w.getTime():i.toDateString()===C.toDateString()}return i.toDateString()===b.toDateString()},N=i=>{if(l){const[C,w]=Array.isArray(b)?b:[null,null];if(!C||w)n([i,null]);else{const B=i<C?[i,C]:[C,i];n(B),c==null||c(B)}}else n(i),c==null||c(i)};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,...g},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:12},children:[e.jsx("button",{onClick:()=>x(i=>new Date(i.getFullYear(),i.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:[Ve[z]," ",v]}),e.jsx("button",{onClick:()=>x(i=>new Date(i.getFullYear(),i.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:[Xe.map(i=>e.jsx("div",{style:{textAlign:"center",fontSize:11,fontWeight:600,color:t.textMut,paddingBottom:4},children:i},i)),T.map((i,C)=>{const w=i?k(i):!1,B=i&&S&&i.toDateString()===S.toDateString();return e.jsx("div",{onClick:()=>i&&N(i),onMouseEnter:()=>i&&h(i),onMouseLeave:()=>h(null),style:{width:32,height:32,display:"flex",alignItems:"center",justifyContent:"center",borderRadius:t.r,cursor:i?"pointer":"default",fontSize:12,fontWeight:i&&p(i)?700:400,background:w?t.primary:B?t.bg:"transparent",color:w?"#fff":i&&p(i)?t.primary:i?t.text:"transparent",border:i&&p(i)&&!w?`1px solid ${t.primary}`:"1px solid transparent",transition:"all .1s"},children:i==null?void 0:i.getDate()},C)})]}),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:y.h,onChange:i=>o(C=>({...C,h:+i.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:y.m,onChange:i=>o(C=>({...C,m:+i.target.value})),className:"dhx dhx-input",style:{width:50,textAlign:"center"}})]})]})}function me({value:r,onChange:l,timeFormat:d=12,controls:c=!1,minuteStep:g=5,style:a}){const[f,s]=u.useState((r==null?void 0:r.h)??(d===24?0:12)),[x,b]=u.useState((r==null?void 0:r.m)??0),[n,S]=u.useState((r==null?void 0:r.ampm)??"AM"),[h,y]=u.useState(null);u.useEffect(j,[]);const o=d===24?Array.from({length:24},(p,k)=>k):Array.from({length:12},(p,k)=>k+1),v=Array.from({length:Math.ceil(60/g)},(p,k)=>k*g),z=(p,k,N)=>{const i=d===24?{h:p,m:k}:{h:p,m:k,ampm:N};c?y(i):l==null||l(i)},$=()=>{y(null),s((r==null?void 0:r.h)??(d===24?0:12)),b((r==null?void 0:r.m)??0),S((r==null?void 0:r.ampm)??"AM")},D={display:"flex",flexDirection:"column",alignItems:"center",gap:4},T=p=>({height:32,display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer",fontSize:13,fontWeight:p?700:400,background:p?t.primaryLt:"transparent",color:p?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:D,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:o.map(p=>e.jsx("div",{onClick:()=>{s(p),z(p,x,n)},style:T(f===p),onMouseEnter:k=>f!==p&&(k.currentTarget.style.background=t.bg),onMouseLeave:k=>f!==p&&(k.currentTarget.style.background="transparent"),children:String(p).padStart(2,"0")},p))})]}),e.jsxs("div",{style:D,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:v.map(p=>e.jsx("div",{onClick:()=>{b(p),z(f,p,n)},style:T(x===p),onMouseEnter:k=>x!==p&&(k.currentTarget.style.background=t.bg),onMouseLeave:k=>x!==p&&(k.currentTarget.style.background="transparent"),children:String(p).padStart(2,"0")},p))})]}),d===12&&e.jsxs("div",{style:D,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(p=>e.jsx("div",{onClick:()=>{S(p),z(f,x,p)},style:{height:40,display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer",padding:"0 12px",fontSize:13,fontWeight:n===p?700:400,background:n===p?t.primary:t.surface,color:n===p?"#fff":t.text},children:p},p))})]})]}),e.jsxs("div",{style:{textAlign:"center",marginTop:12,fontSize:22,fontWeight:700,color:t.primary,letterSpacing:2},children:[String(f).padStart(2,"0"),":",String(x).padStart(2,"0"),d===12?` ${n}`:""]}),c&&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:$,children:"Cancel"}),e.jsx("button",{className:"dhx dhx-btn dhx-btn-primary",onClick:()=>h&&(l==null?void 0:l(h)),children:"Apply"})]})]})}const qe=({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 pe({data:r=[],value:l,placeholder:d="Select or type...",multiselection:c=!1,label:g,onChange:a,style:f}){var N;const[s,x]=u.useState(!1),[b,n]=u.useState(""),[S,h]=u.useState(c?l?[].concat(l):[]:l||null),y=u.useRef(null),o=u.useRef(null);u.useEffect(j,[]),U(y,u.useCallback(()=>{x(!1),n("")},[]));const v=u.useMemo(()=>r.filter(i=>!b||i.value.toLowerCase().includes(b.toLowerCase())),[r,b]),z=i=>c?(S||[]).includes(i):S===i,$=i=>{const C=i.id||i.value;if(c){const w=z(C)?S.filter(B=>B!==C):[...S||[],C];h(w),a==null||a(w)}else h(C),n(""),x(!1),a==null||a(C)},D=i=>{const C=S.filter(w=>w!==i);h(C),a==null||a(C)},T=()=>{x(!0),setTimeout(()=>{var i;return(i=o.current)==null?void 0:i.focus()},0)},p=((N=r.find(i=>(i.id||i.value)===S))==null?void 0:N.value)||"",k=c?S||[]:[];return e.jsxs("div",{ref:y,className:"dhx",style:{position:"relative",...f},children:[g&&e.jsx("label",{className:"dhx dhx-label",children:g}),e.jsxs("div",{onClick:T,style:{display:"flex",alignItems:"center",flexWrap:c?"wrap":"nowrap",border:`1px solid ${s?t.primary:t.border}`,borderRadius:t.r,minHeight:34,padding:"4px 8px",cursor:"text",background:t.surface,gap:4,transition:"border-color .15s",boxShadow:s?`0 0 0 3px ${t.primary}22`:"none"},children:[c&&e.jsxs(e.Fragment,{children:[k.map(i=>{var C;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:[((C=r.find(w=>(w.id||w.value)===i))==null?void 0:C.value)||i,e.jsx("span",{onClick:w=>{w.stopPropagation(),D(i)},style:{cursor:"pointer",fontSize:15,lineHeight:1,opacity:.75,marginLeft:2},children:"×"})]},i)}),e.jsx("input",{ref:o,value:b,onChange:i=>{n(i.target.value),x(!0)},onFocus:()=>x(!0),onClick:i=>i.stopPropagation(),placeholder:k.length?"":d,style:{flex:1,minWidth:60,border:"none",outline:"none",fontSize:13,background:"transparent",color:t.text,padding:0}})]}),!c&&e.jsx("input",{ref:o,value:s?b:p,onChange:i=>{n(i.target.value),x(!0)},onFocus:()=>{x(!0),n("")},onClick:i=>i.stopPropagation(),placeholder:d,style:{flex:1,border:"none",outline:"none",fontSize:13,background:"transparent",color:t.text,padding:0}}),e.jsx(qe,{open:s})]}),s&&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:[v.map(i=>{const C=i.id||i.value,w=z(C);return e.jsxs("div",{onClick:()=>$(i),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:B=>!w&&(B.currentTarget.style.background=t.bg),onMouseLeave:B=>!w&&(B.currentTarget.style.background="transparent"),children:[c&&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:i.value}),!c&&w&&e.jsx("span",{style:{color:t.primary,fontSize:12,fontWeight:700},children:"✓"}),i.count!==void 0&&e.jsxs("span",{style:{fontSize:11,color:t.textMut},children:["(",i.count,")"]})]},C)}),v.length===0&&e.jsx("div",{style:{padding:16,textAlign:"center",color:t.textMut,fontSize:13},children:"No matches"})]})})]})}function he({min:r=0,max:l=100,step:d=1,value:c,range:g=!1,label:a,tick:f,disabled:s=!1,onChange:x,style:b}){const[n,S]=u.useState(c??(g?[r,l]:r));u.useEffect(j,[]);const h=($,D)=>{if(!s)if(g){const T=[...n];T[$]=D,S(T),x==null||x(T)}else S(D),x==null||x(D)},y=$=>($-r)/(l-r)*100,o=g?n:[n],v=g?{left:`${y(o[0])}%`,width:`${y(o[1])-y(o[0])}%`}:{left:0,width:`${y(o[0])}%`},z=s?t.border:t.primary;return e.jsxs("div",{className:"dhx",style:{width:"100%",opacity:s?.5:1,...b},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",...v,height:"100%",background:z,borderRadius:2}}),o.map(($,D)=>e.jsx("input",{type:"range",min:r,max:l,step:d,value:$,disabled:s,onChange:T=>{const p=+T.target.value;g&&D===0&&p>=n[1]||g&&D===1&&p<=n[0]||h(D,p)},style:{position:"absolute",width:"100%",height:"100%",opacity:0,cursor:s?"not-allowed":"pointer",top:0,left:0,margin:0}},D)),o.map(($,D)=>e.jsx("div",{style:{position:"absolute",left:`${y($)}%`,top:"50%",transform:"translate(-50%, -50%)",width:16,height:16,borderRadius:"50%",background:t.surface,border:`2px solid ${z}`,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:s?t.textMut:t.primaryDk,color:"#fff",padding:"2px 6px",borderRadius:t.r,fontSize:11,fontWeight:700,whiteSpace:"nowrap"},children:$})},D))]})}),f&&e.jsx("div",{style:{display:"flex",justifyContent:"space-between",marginTop:2},children:[r,Math.round((l+r)/2),l].map($=>e.jsx("span",{style:{fontSize:10,color:t.textMut},children:$},$))})]})}const Ge=["#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 fe(r){const l=parseInt(r.slice(1,3),16)/255,d=parseInt(r.slice(3,5),16)/255,c=parseInt(r.slice(5,7),16)/255,g=Math.max(l,d,c),a=Math.min(l,d,c);let f=0,s=0;const x=(g+a)/2;if(g!==a){const b=g-a;s=x>.5?b/(2-g-a):b/(g+a),f=g===l?((d-c)/b+(d<c?6:0))/6:g===d?((c-l)/b+2)/6:((l-d)/b+4)/6}return[Math.round(f*360),Math.round(s*100),Math.round(x*100)]}function $e(r,l,d){l/=100,d/=100;const c=l*Math.min(d,1-d),g=a=>{const f=(a+r/30)%12,s=d-c*Math.max(Math.min(f-3,9-f,1),-1);return Math.round(255*s).toString(16).padStart(2,"0")};return"#"+g(0)+g(8)+g(4)}function Je({value:r="#0288d1",onChange:l,style:d}){const[c,g]=u.useState(()=>fe(r)),a=$e(...c);u.useEffect(j,[]);const f=s=>{g(s),l==null||l($e(...s))};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(${c[0]},100%,50%))`,cursor:"crosshair"}}),[["Hue",0,360,c[0]],["Saturation",0,100,c[1]],["Lightness",0,100,c[2]]].map(([s,x,b,n],S)=>e.jsxs("div",{style:{marginBottom:S<2?8:12},children:[e.jsxs("div",{className:"dhx dhx-label",children:[s,S>0?` (${n}%)`:""]}),e.jsx("input",{type:"range",min:x,max:b,value:n,onChange:h=>{const y=[...c];y[S]=+h.target.value,f(y)},style:{width:"100%",accentColor:t.primary}})]},s)),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:s=>{try{f(fe(s.target.value)),l==null||l(s.target.value)}catch{}}})]}),e.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(13, 1fr)",gap:3},children:Ge.map(s=>e.jsx("div",{onClick:()=>{g(fe(s)),l==null||l(s)},style:{width:14,height:14,borderRadius:2,background:s,cursor:"pointer",border:a===s?`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)"},s))})]})}function Ue({trigger:r,children:l,placement:d="bottom-start",style:c}){const[g,a]=u.useState(!1),[f,s]=u.useState({top:"100%",left:0}),x=u.useRef(null),b=u.useRef(null);u.useEffect(j,[]),U(x,u.useCallback(()=>a(!1),[]));const n=()=>{a(S=>{if(!S&&b.current){const h=b.current.getBoundingClientRect(),y={"bottom-start":{top:h.height+4,left:0},"bottom-end":{top:h.height+4,right:0,left:"auto"},"top-start":{bottom:h.height+4,top:"auto",left:0}};s(y[d]||y["bottom-start"])}return!S})};return e.jsxs("div",{ref:x,className:"dhx",style:{position:"relative",display:"inline-block"},children:[e.jsx("div",{ref:b,onClick:n,children:r}),g&&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,...c},children:l})]})}function Qe({title:r,children:l,width:d=480,height:c,closable:g=!0,movable:a=!0,modal:f=!1,defaultOpen:s=!0,footer:x,onClose:b,style:n}){const[S,h]=u.useState(s),[y,o]=u.useState({x:0,y:0});u.useEffect(j,[]);const v=we(u.useCallback(($,D)=>a&&o({x:$,y:D}),[a])),z=()=>{h(!1),b==null||b()};return S?e.jsxs(e.Fragment,{children:[f&&e.jsx("div",{style:{position:"fixed",inset:0,background:"rgba(0,0,0,.45)",zIndex:900},onClick:g?z:void 0}),e.jsxs("div",{className:"dhx",style:{position:f?"fixed":"absolute",left:f?"50%":`calc(50% + ${y.x}px)`,top:f?"50%":`calc(50% + ${y.y}px)`,transform:`translate(calc(-50% + ${y.x}px), calc(-50% + ${y.y}px))`,width:d,...c?{height:c}:{},background:t.surface,borderRadius:t.rMd,boxShadow:t.shadowLg,zIndex:901,display:"flex",flexDirection:"column",overflow:"hidden",...n},children:[e.jsxs("div",{onMouseDown:$=>v($,y.x,y.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}),g&&e.jsx("button",{onClick:z,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:$=>$.currentTarget.style.background=t.border,onMouseLeave:$=>$.currentTarget.style.background="none",children:"×"})]}),e.jsx("div",{className:"dhx-scroll",style:{flex:1,minHeight:0,padding:20,overflowY:"auto"},children:l}),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 ue=u.createContext(null),Ze={success:"✓",error:"✕",warning:"⚠",info:"ℹ"},Ce={success:t.success,error:t.danger,warning:t.warning,info:t.primary};function Re({children:r}){const[l,d]=u.useState([]);u.useEffect(j,[]);const c=u.useCallback(f=>d(s=>s.filter(x=>x.id!==f)),[]),g=u.useCallback(f=>{const s=Date.now();return d(x=>[...x,{id:s,...f}]),f.duration!==0&&setTimeout(()=>c(s),f.duration||4e3),s},[c]),a={message:g,alert:(f,s)=>g({type:"info",title:f,...s}),confirm:(f,s,x)=>g({type:"warning",title:f,confirm:s,...x})};return e.jsxs(ue.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:l.map(f=>{const s=f.type||"info";return e.jsxs("div",{style:{background:t.surface,border:`1px solid ${t.border}`,borderLeft:`4px solid ${Ce[s]}`,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:Ce[s],lineHeight:1},children:Ze[s]}),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),c(f.id)},children:"Confirm"}),e.jsx("button",{className:"dhx dhx-btn dhx-btn-secondary",style:{height:26,fontSize:12},onClick:()=>{f.confirm(!1),c(f.id)},children:"Cancel"})]})]}),e.jsx("button",{onClick:()=>c(f.id),style:{background:"none",border:"none",cursor:"pointer",color:t.textMut,fontSize:14,lineHeight:1,padding:0},children:"×"})]},f.id)})})]})}function et(){const r=u.useContext(ue);if(!r)throw new Error("useMessage must be used inside <MessageProvider>");return r}function tt({data:r=[],template:l,keyNavigation:d=!0,multiselection:c=!1,editable:g=!1,height:a=400,onSelect:f,onEdit:s,style:x}){const[b,n]=u.useState(new Set),[S,h]=u.useState(null),[y,o]=u.useState(""),[v,z]=u.useState(null);u.useEffect(j,[]);const $=(T,p)=>{const k=T.id??p;n(N=>{const i=c?new Set(N):new Set;return i.has(k)?i.delete(k):i.add(k),i}),z(p),f==null||f(T)},D=(T,p)=>{s==null||s({...T,value:y},p),h(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:T=>{d&&(T.key==="ArrowDown"&&z(p=>Math.min((p??-1)+1,r.length-1)),T.key==="ArrowUp"&&z(p=>Math.max((p??1)-1,0)))},children:[r.map((T,p)=>{const k=T.id??p,N=b.has(k),i=v===p;return e.jsx("div",{onClick:()=>$(T,p),onDoubleClick:()=>g&&(h(p),o(String(T.value||""))),style:{display:"flex",alignItems:"center",padding:"0 12px",height:40,cursor:"pointer",fontSize:13,borderBottom:`1px solid ${t.border}`,background:N?t.primaryLt:i?t.bg:t.surface,color:N?t.primary:t.text,outline:i?`2px solid ${t.primary}44`:"none",transition:"background .1s"},children:S===p?e.jsx("input",{autoFocus:!0,className:"dhx dhx-input",style:{height:28,flex:1},value:y,onChange:C=>o(C.target.value),onBlur:()=>D(T,p),onKeyDown:C=>{C.key==="Enter"&&D(T,p),C.key==="Escape"&&h(null)},onClick:C=>C.stopPropagation()}):l?e.jsx("div",{dangerouslySetInnerHTML:{__html:l(T)},style:{flex:1}}):e.jsx("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:String(T.value??"")})},String(k))}),r.length===0&&e.jsx("div",{style:{padding:24,textAlign:"center",color:t.textMut},children:"No items"})]})}function rt({data:r=[],template:l,itemsInRow:d=3,gap:c=12,multiselection:g=!1,onSelect:a,style:f}){const[s,x]=u.useState(new Set);u.useEffect(j,[]);const b=n=>{const S=n.id??String(n.title);x(h=>{const y=g?new Set(h):new Set;return y.has(S)?y.delete(S):y.add(S),y}),a==null||a(n)};return e.jsx("div",{className:"dhx",style:{display:"grid",gridTemplateColumns:`repeat(${d}, 1fr)`,gap:c,padding:c,...f},children:r.map((n,S)=>{const h=n.id??S,y=s.has(h);return e.jsx("div",{onClick:()=>b(n),style:{background:t.surface,border:`2px solid ${y?t.primary:t.border}`,borderRadius:t.rMd,overflow:"hidden",cursor:"pointer",transition:"all .15s",boxShadow:y?`0 0 0 3px ${t.primary}33`:t.shadow,transform:y?"translateY(-2px)":"none"},onMouseEnter:o=>{o.currentTarget.style.boxShadow=t.shadowLg,o.currentTarget.style.transform="translateY(-2px)"},onMouseLeave:o=>{o.currentTarget.style.boxShadow=y?`0 0 0 3px ${t.primary}33`:t.shadow,o.currentTarget.style.transform=y?"translateY(-2px)":"none"},children:l?e.jsx("div",{dangerouslySetInnerHTML:{__html:l(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(h))})})}function ge(r){return r.map(l=>({...l,items:l.items?ge(l.items):void 0}))}function xe(r,l={}){return r.forEach(d=>{d.opened&&(l[d.id]=!0),d.items&&xe(d.items,l)}),l}function De(r,l){let d=null;return[r.filter(g=>g.id===l?(d=g,!1):!0).map(g=>{if(g.items){const[a,f]=De(g.items,l);return f&&(d=f),{...g,items:a}}return g}),d]}function ye(r,l,d,c){if(c==="inside")return r.map(a=>a.id===l?{...a,items:[...a.items||[],d]}:a.items?{...a,items:ye(a.items,l,d,c)}:a);if(r.some(a=>a.id===l)){const a=[];for(const f of r)f.id===l?c==="before"?(a.push(d),a.push(f)):(a.push(f),a.push(d)):a.push(f);return a}return r.map(a=>a.items?{...a,items:ye(a.items,l,d,c)}:a)}function nt(r,l,d){function c(g){var a,f;if(g.id===l){const s=x=>{var b;return x.id===d||(((b=x.items)==null?void 0:b.some(s))??!1)};return((a=g.items)==null?void 0:a.some(s))??!1}return((f=g.items)==null?void 0:f.some(c))??!1}return r.some(c)}function Ee(r,l,d){return r.map(c=>c.id===l?{...c,value:d}:{...c,items:c.items?Ee(c.items,l,d):void 0})}function ot(r,l){var a;let d=0,c=0;const g=f=>{var s;d++,l[f.id]&&c++,(s=f.items)==null||s.forEach(g)};return(a=r.items)==null||a.forEach(g),{total:d,checkedCount:c}}function st({data:r=[],checkbox:l=!1,editable:d=!1,dragMode:c,tooltip:g,onSelect:a,onCheck:f,onChange:s,style:x}){const[b,n]=u.useState(()=>ge(r)),[S,h]=u.useState(()=>xe(r)),[y,o]=u.useState(null),[v,z]=u.useState({}),[$,D]=u.useState(null),[T,p]=u.useState(""),[k,N]=u.useState(null),[i,C]=u.useState(null);u.useEffect(j,[]),u.useEffect(()=>{n(ge(r)),h(E=>({...xe(r),...E}))},[r]);const w=E=>h(P=>({...P,[E]:!P[E]})),B=(E,P)=>{z(F=>({...F,[E]:P})),f==null||f(E,P)},V=()=>{if(!$)return;const E=$,P=T;D(null),n(F=>{const X=Ee(F,E,P);return s==null||s(X),X})},J=(E,P)=>{E.dataTransfer.effectAllowed="move",N(P)},Z=(E,P)=>{if(!k||k===P||nt(b,k,P))return;E.preventDefault();const F=E.currentTarget.getBoundingClientRect(),X=E.clientY-F.top,K=F.height,G=X<K*.25?"before":X>K*.75?"after":"inside";C(q=>(q==null?void 0:q.id)===P&&(q==null?void 0:q.pos)===G?q:{id:P,pos:G})},le=(E,P)=>{if(E.preventDefault(),!k||!i||k===P){C(null),N(null);return}n(F=>{const[X,K]=De(F,k);if(!K)return F;const G=ye(X,P,K,i.pos);return s==null||s(G),G}),i.pos==="inside"&&h(F=>({...F,[P]:!0})),C(null),N(null)},oe=()=>{N(null),C(null)},ae=(E,P=0)=>{var ce;const F=(((ce=E.items)==null?void 0:ce.length)??0)>0,X=S[E.id],K=y===E.id,G=k===E.id,q=(i==null?void 0:i.id)===E.id;let ie=!!v[E.id],de=!1;if(l&&F){const{total:A,checkedCount:ee}=ot(E,v);ee>0&&ee<A?de=!0:A>0&&ee===A&&(ie=!0)}const be=q&&i.pos!=="inside"?{boxShadow:i.pos==="before"?`inset 0 2px 0 0 ${t.primary}`:`inset 0 -2px 0 0 ${t.primary}`}:{},se=q&&i.pos==="inside"||K?t.primaryLt:"transparent";return e.jsxs("div",{style:{opacity:G?.4:1},children:[e.jsxs("div",{draggable:!!c,onDragStart:c?A=>J(A,E.id):void 0,onDragOver:c?A=>Z(A,E.id):void 0,onDrop:c?A=>le(A,E.id):void 0,onDragEnd:c?oe:void 0,title:g==null?void 0:g(E),onClick:()=>{o(E.id),a==null||a(E),F&&w(E.id)},onDoubleClick:()=>{d&&(D(E.id),p(E.value||""))},style:{display:"flex",alignItems:"center",gap:4,padding:`5px 8px 5px ${12+P*18}px`,cursor:c?"grab":"pointer",borderRadius:t.r,margin:"1px 4px",background:se,color:K?t.primary:t.text,userSelect:"none",fontSize:13,...be},onMouseEnter:A=>!K&&!q&&(A.currentTarget.style.background=t.bg),onMouseLeave:A=>!K&&!q&&(A.currentTarget.style.background="transparent"),children:[e.jsx("span",{style:{width:16,textAlign:"center",fontSize:11,color:t.textMut,flexShrink:0},onClick:A=>{A.stopPropagation(),F&&w(E.id)},children:F?X?"▾":"▸":""}),e.jsx("span",{style:{fontSize:15,flexShrink:0},children:F?X?"📂":"📁":"📄"}),l&&e.jsx("input",{ref:A=>{A&&(A.indeterminate=de)},type:"checkbox",checked:ie,onChange:A=>{A.stopPropagation(),B(E.id,A.target.checked)},style:{cursor:"pointer",accentColor:t.primary,flexShrink:0},onClick:A=>A.stopPropagation()}),$===E.id?e.jsx("input",{autoFocus:!0,className:"dhx dhx-input",style:{height:24,fontSize:12,flex:1},value:T,onChange:A=>p(A.target.value),onBlur:V,onKeyDown:A=>{A.key==="Enter"&&V(),A.key==="Escape"&&D(null)},onClick:A=>A.stopPropagation()}):e.jsx("span",{style:{flex:1},children:E.value}),E.count!==void 0&&e.jsxs("span",{style:{fontSize:11,color:t.textMut},children:["(",E.count,")"]})]}),F&&X&&e.jsx("div",{children:E.items.map(A=>ae(A,P+1))})]},E.id)};return e.jsx("div",{className:"dhx dhx-scroll",style:{overflowY:"auto",...x},onDragOver:c?E=>E.preventDefault():void 0,onDrop:c?E=>{E.preventDefault(),C(null),N(null)}:void 0,children:b.map(E=>ae(E))})}function lt({total:r,pageSize:l=10,page:d,onChange:c,style:g}){const[a,f]=u.useState(d||1),s=Math.ceil(r/l);u.useEffect(j,[]);const x=n=>{const S=Math.min(Math.max(1,n),s);f(S),c==null||c(S)},b=u.useMemo(()=>{const n=[];for(let h=Math.max(1,a-2);h<=Math.min(s,a+2);h++)n.push(h);return n[0]>1&&(n[0]>2&&n.unshift("..."),n.unshift(1)),n[n.length-1]<s&&(n[n.length-1]<s-1&&n.push("..."),n.push(s)),n},[a,s]);return e.jsxs("div",{className:"dhx",style:{display:"flex",alignItems:"center",gap:4,padding:"8px 12px",...g},children:[e.jsxs("span",{style:{fontSize:12,color:t.textSec,marginRight:8},children:[(a-1)*l+1,"–",Math.min(a*l,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)),b.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],["»",s]].map(([n,S])=>e.jsx("button",{className:"dhx dhx-btn dhx-btn-ghost",style:{height:30,padding:"0 8px",fontSize:14},disabled:a===s,onClick:()=>x(S),children:n},n))]})}function at({config:r={},defaultValues:l={},onSubmit:d,style:c}){const[g,a]=u.useState(l),[f,s]=u.useState({}),[x,b]=u.useState(null);u.useEffect(j,[]);const n=(o,v)=>{a(z=>({...z,[o]:v})),s(z=>({...z,[o]:null}))},S=()=>{const o={};return(r.rows||[]).flat().forEach(v=>{v&&typeof v=="object"&&"name"in v&&v.required&&!g[v.name]&&(o[v.name]=`${v.label||v.name} is required`)}),s(o),Object.keys(o).length===0},h=o=>{const v=g[o.name]??o.value??"",z=f[o.name],$=o.labelWidth??r.labelWidth,D=$!==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(w=>h(w))]},o.name);if(o.type==="spacer")return e.jsx("div",{style:{height:o.height||16}},o.name);const T=$?{minWidth:$,width:$,flexShrink:0,paddingTop:8,boxSizing:"border-box"}:{},p=o.label?e.jsxs("label",{className:"dhx dhx-label",style:{display:"flex",gap:4,...T},children:[o.label,o.required&&e.jsx("span",{style:{color:t.danger},children:"*"})]},"lbl"):null,k=z?e.jsx("div",{style:{fontSize:11,color:t.danger,marginTop:3},children:z}):null,N=o.helpMessage?e.jsxs("div",{style:{fontSize:11,color:t.textMut,marginTop:3},children:["ⓘ ",o.helpMessage]}):null,i={key:o.name,className:"dhx-form-group"},C=w=>D?e.jsxs("div",{...i,style:{display:"flex",alignItems:"flex-start",gap:8},children:[p,e.jsxs("div",{style:{flex:1,minWidth:0},children:[w,k,N]})]}):e.jsxs("div",{...i,children:[p,w,k,N]});if(!o.type||o.type==="input")return C(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:z?t.danger:void 0},type:o.inputType||"text",placeholder:o.placeholder,value:v,onChange:w=>n(o.name,w.target.value),disabled:o.disabled})]}));if(o.type==="textarea")return C(e.jsx("textarea",{className:"dhx dhx-input",style:{height:80,resize:"vertical",padding:"8px 10px"},placeholder:o.placeholder,value:v,onChange:w=>n(o.name,w.target.value)}));if(o.type==="select")return C(e.jsxs("select",{className:"dhx dhx-input",value:v,onChange:w=>n(o.name,w.target.value),style:{cursor:"pointer"},children:[e.jsx("option",{value:"",children:"— Select —"}),(o.options||[]).map(w=>e.jsx("option",{value:w.value,children:w.label||w.value},w.value))]}));if(o.type==="datepicker")return C(e.jsx("input",{type:"date",className:"dhx dhx-input",value:v,onChange:w=>n(o.name,w.target.value)}));if(o.type==="timepicker"){const w=g[o.name]??{h:12,m:0,ampm:"AM"},B=!!g[o.name],V=B?`${String(w.h).padStart(2,"0")}:${String(w.m).padStart(2,"0")}${w.ampm?" "+w.ampm:""}`:o.placeholder||"Click to select",J=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:()=>b(x===o.name?null:o.name),children:[e.jsx("span",{style:{color:B?t.text:t.textMut},children:V}),e.jsx("span",{style:{fontSize:13,color:t.textSec},children:"🕐"})]}),x===o.name&&e.jsx("div",{style:{position:"absolute",zIndex:100,top:"calc(100% + 4px)",left:0},children:e.jsx(me,{value:w,controls:!0,onChange:Z=>{n(o.name,Z),b(null)}})})]});return C(J)}if(o.type==="colorpicker")return C(e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[e.jsx("input",{type:"color",value:v||"#000000",onChange:w=>n(o.name,w.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:v||"#000000"})]}));if(o.type==="text")return C(e.jsx("p",{style:{margin:"6px 0",fontSize:13,color:t.text},children:o.value}));if(o.type==="checkbox")return e.jsxs("div",{...i,children:[D?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:!!v,onChange:w=>n(o.name,w.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:!!v,onChange:w=>n(o.name,w.target.checked),style:{width:16,height:16,accentColor:t.primary,cursor:"pointer"}}),e.jsx("span",{style:{fontSize:13},children:o.label})]}),N]});if(o.type==="radio"){const w=(o.options||[]).map(B=>e.jsxs("label",{style:{display:"flex",alignItems:"center",gap:6,cursor:"pointer",fontSize:13},children:[e.jsx("input",{type:"radio",name:o.name,value:B.value,checked:v===B.value,onChange:()=>n(o.name,B.value),style:{accentColor:t.primary,cursor:"pointer"}}),B.label||B.value]},B.value));return C(e.jsx("div",{style:{display:"flex",gap:16,flexWrap:"wrap",paddingTop:8},children:w}))}if(o.type==="slider")return D?e.jsxs("div",{...i,style:{display:"flex",alignItems:"flex-start",gap:8},children:[p,e.jsxs("div",{style:{flex:1},children:[e.jsx(he,{min:o.min,max:o.max,step:o.step,value:v||o.min,range:o.range,onChange:w=>n(o.name,w)}),N]})]}):e.jsxs("div",{...i,children:[e.jsx(he,{label:o.label,min:o.min,max:o.max,step:o.step,value:v||o.min,range:o.range,onChange:w=>n(o.name,w)}),N]});if(o.type==="combo")return D?e.jsxs("div",{...i,style:{display:"flex",alignItems:"flex-start",gap:8},children:[p,e.jsxs("div",{style:{flex:1},children:[e.jsx(pe,{data:o.data||[],multiselection:o.multiselection,placeholder:o.placeholder||"Select...",value:v||(o.multiselection?[]:null),onChange:w=>n(o.name,w)}),k,N]})]}):e.jsxs("div",{...i,children:[e.jsx(pe,{label:o.label,data:o.data||[],multiselection:o.multiselection,placeholder:o.placeholder||"Select...",value:v||(o.multiselection?[]:null),onChange:w=>n(o.name,w)}),k,N]});if(o.type==="toggle"){const w=!!v,B=w?o.icon:o.offIcon||o.icon,V=w?o.text||o.label:o.offText||o.text||o.label;return e.jsxs("div",{...i,children:[D&&$&&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(Te,{on:w,onClick:()=>n(o.name,!v)}),B&&e.jsx("span",{style:{fontSize:16},children:B}),V&&e.jsx("span",{style:{fontSize:13},children:V})]})]}),!D&&e.jsxs("label",{style:{display:"flex",alignItems:"center",gap:10,cursor:"pointer"},children:[e.jsx(Te,{on:w,onClick:()=>n(o.name,!v)}),B&&e.jsx("span",{style:{fontSize:16},children:B}),V&&e.jsx("span",{style:{fontSize:13},children:V})]}),N]})}return null},y=o=>o.map((v,z)=>Array.isArray(v)?e.jsx("div",{style:{display:"flex",gap:12,alignItems:"flex-start"},children:v.map(h)},z):h(v));return e.jsxs("div",{className:"dhx",style:{padding:r.padding||0,width:r.width||"100%",...c},children:[y(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:()=>S()&&(d==null?void 0:d(g)),children:r.submitText||"Submit"}),r.resetButton!==!1&&e.jsx("button",{className:"dhx dhx-btn dhx-btn-secondary",onClick:()=>{a(l),s({})},children:r.resetText||"Reset"})]})]})}function Te({on:r,onClick:l}){return e.jsxs("div",{style:{position:"relative",width:40,height:22,flexShrink:0},onClick:l,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 Ie(r){const l=[];for(const d of r)"type"in d&&d.type==="block"?l.push(...d.items||[]):l.push(d);return l}function it({items:r=[],onAction:l,style:d}){u.useEffect(j,[]);const[c,g]=u.useState(()=>{const s={};for(const x of Ie(r))x.id&&(s[x.id]=!!x.active);return s}),a=s=>{var x;if(s.id)if(s.group){const b=Ie(r).filter(n=>n.group===s.group&&n.id);g(n=>{const S={...n};for(const h of b)S[h.id]=!1;return S[s.id]=!0,S})}else s.twoState&&g(b=>({...b,[s.id]:!b[s.id]}));(x=s.onClick)==null||x.call(s,s),s.id&&(l==null||l(s.id,s))},f=(s,x)=>{var S,h;if("type"in s&&(s.type==="separator"||s.type==="sep"))return e.jsx("div",{style:{width:1,background:t.border,margin:"8px 4px",alignSelf:"stretch"}},x);if("type"in s&&s.type==="input"){const y=s;return e.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",padding:"4px 6px",gap:4},children:[y.label&&e.jsx("span",{style:{fontSize:10,color:t.textMut},children:y.label}),e.jsx("input",{className:"dhx dhx-input",style:{width:y.width||110,height:26,fontSize:12},placeholder:y.placeholder,defaultValue:y.value,onChange:o=>{var v;return(v=y.onChange)==null?void 0:v.call(y,o.target.value)}})]},x)}if("type"in s&&s.type==="block"){const y=s;return e.jsxs("div",{style:{display:"flex",flexDirection:y.direction==="col"?"column":"row",alignItems:"center",gap:4,padding:"4px 8px",borderRight:`1px solid ${t.border}`,minHeight:64},children:[e.jsx("div",{style:{display:"flex",gap:2},children:(S=y.items)==null?void 0:S.map((o,v)=>f(o,v))}),y.label&&e.jsx("span",{style:{fontSize:10,color:t.textMut,marginTop:2},children:y.label})]},x)}if("type"in s&&s.type==="selectButton"){const y=s;return e.jsx("select",{className:"dhx dhx-input",style:{height:28,fontSize:12,cursor:"pointer",margin:2},defaultValue:y.value,onChange:o=>{var v;return(v=y.onChange)==null?void 0:v.call(y,o.target.value)},children:(h=y.items)==null?void 0:h.map(o=>e.jsx("option",{value:o.value,children:o.value},o.value))},x)}const b=s,n=b.id!==void 0?c[b.id]??!!b.active:!!b.active;return e.jsxs("button",{title:b.tooltip,className:`dhx dhx-btn ${n?"dhx-btn-primary":"dhx-btn-ghost"}`,style:{flexDirection:"column",minHeight:48,padding:"4px 8px",gap:4,fontSize:12},disabled:b.disabled,onClick:()=>a(b),children:[b.icon&&e.jsx("span",{style:{fontSize:b.size==="large"?24:18},children:b.icon}),b.text&&e.jsx("span",{style:{fontSize:10,maxWidth:60,textAlign:"center",lineHeight:1.2,whiteSpace:"normal"},children:b.text})]},x)};return e.jsx("div",{className:"dhx",style:{display:"flex",alignItems:"stretch",background:t.bg,borderBottom:`1px solid ${t.border}`,padding:"4px 0",overflowX:"auto",gap:0,...d},children:r.map(f)})}function Le({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:l=[],vertical:d=!1,onAction:c,style:g}){const[a,f]=u.useState(null),[s,x]=u.useState(()=>{const h={};return l.forEach(y=>{y.id&&y.twoState&&y.active&&(h[y.id]=!0)}),h}),b=u.useRef(null);u.useEffect(j,[]),U(b,u.useCallback(()=>f(null),[]));const n=(h,y)=>{var o,v;if(!h.disabled){if(h.twoState&&h.id&&x(z=>({...z,[h.id]:!z[h.id]})),(o=h.items)!=null&&o.length){f(z=>z===y?null:y);return}(v=h.onClick)==null||v.call(h,h.id||""),c==null||c(h.id||"")}},S=(h,y)=>{var $;if(h.hidden)return null;if(h.type==="separator")return e.jsx("div",{style:{[d?"height":"width"]:1,background:t.border,margin:d?"4px 8px":"0 6px",alignSelf:"stretch"}},y);if(h.type==="spacer")return e.jsx("div",{style:{flex:1}},y);if(h.type==="input")return e.jsxs("div",{style:{position:"relative",display:"flex",alignItems:"center",margin:"0 4px"},children:[h.icon&&e.jsx("span",{style:{position:"absolute",left:8,color:t.textMut,fontSize:15,pointerEvents:"none",zIndex:1},children:h.icon}),e.jsx("input",{className:"dhx dhx-input",style:{width:h.width||200,height:28,paddingLeft:h.icon?30:void 0},placeholder:h.placeholder,onChange:D=>{var T;return(T=h.onChange)==null?void 0:T.call(h,D.target.value)}})]},y);if(h.type==="imageButton")return e.jsxs("button",{title:h.tooltip,disabled:h.disabled,style:{position:"relative",width:36,height:36,padding:2,border:"none",borderRadius:"50%",overflow:"hidden",cursor:h.disabled?"not-allowed":"pointer",background:"transparent",flexShrink:0},onClick:()=>n(h,y),children:[h.src&&e.jsx("img",{src:h.src,alt:h.value||"",style:{width:"100%",height:"100%",objectFit:"cover",borderRadius:"50%"}}),h.count!==void 0&&e.jsx(Le,{count:h.count})]},y);const o=!!(h.twoState&&h.id&&s[h.id]),v=!!(($=h.items)!=null&&$.length),z={position:"relative",height:d?40:36,gap:6,background:o?t.primaryLt:"transparent",color:o?t.primary:h.disabled?t.textMut:t.text,opacity:h.disabled?.55:1,cursor:h.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:h.tooltip,disabled:h.disabled,style:z,onClick:()=>n(h,y),children:[h.icon&&e.jsx("span",{style:{fontSize:16,flexShrink:0},children:h.icon}),h.value&&e.jsx("span",{style:{fontSize:13},children:h.value}),v&&e.jsx("span",{style:{fontSize:9,opacity:.55,marginLeft:2},children:"▼"}),h.count!==void 0&&e.jsx(Le,{count:h.count})]}),v&&a===y&&e.jsx(R,{items:h.items,onSelect:()=>f(null),style:d?{left:"100%",top:0}:{top:"100%"}})]},y)};return e.jsxs("nav",{ref:b,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,...g},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}),l.map(S)]})}W.Button=We,W.Calendar=_e,W.Chart=Ke,W.Colorpicker=Je,W.Combobox=pe,W.ContextMenu=Be,W.DataView=rt,W.Form=at,W.Grid=Fe,W.Layout=ze,W.List=tt,W.Menu=Ae,W.MenuDropdown=R,W.MessageContext=ue,W.MessageProvider=Re,W.Navbar=dt,W.Pagination=lt,W.Popup=Ue,W.Ribbon=it,W.Sidebar=Pe,W.Slider=he,W.Tabbar=Oe,W.Timepicker=me,W.Toolbar=He,W.Tree=st,W.Window=Qe,W.tokens=t,W.useClickOutside=U,W.useDrag=we,W.useMessage=et,Object.defineProperty(W,Symbol.toStringTag,{value:"Module"})});
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:h,disabled:x,onClick:a,style:g,className:i=""}){return u.useEffect(j,[]),e.jsxs("button",{className:`dhx dhx-btn dhx-btn-${s} ${i}`,style:{...Ne[p],...g},disabled:x,onClick:a,children:[h&&e.jsx("span",{style:{fontSize:16},children:h}),r]})}function U(r,s){u.useEffect(()=>{const p=h=>{r.current&&!r.current.contains(h.target)&&s(h)};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((h,x=0,a=0)=>{s.current=!0,p.current={x:h.clientX,y:h.clientY,ox:x,oy:a};const g=v=>{if(!s.current)return;const{x:M,y:n,ox:l,oy:d}=p.current;r(l+v.clientX-M,d+v.clientY-n)},i=()=>{s.current=!1,document.removeEventListener("mousemove",g),document.removeEventListener("mouseup",i)};document.addEventListener("mousemove",g),document.addEventListener("mouseup",i),h.preventDefault()},[r])}function R({items:r,onSelect:s,style:p}){const[h,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,g)=>{var v,M;if(a.type==="separator")return e.jsx("div",{style:{height:1,background:t.border,margin:"4px 0"}},g);const i=h===g;return e.jsxs("div",{style:{position:"relative"},onMouseEnter:()=>x(g),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:i&&!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}),(v=a.items)!=null&&v.length?e.jsx("span",{style:{fontSize:10,color:t.textMut},children:"▶"}):null]}),i&&((M=a.items)!=null&&M.length)?e.jsx(R,{items:a.items,onSelect:s,style:{position:"absolute",left:"100%",top:-4}}):null]},a.id||g)})})}function Ae({items:r=[],label:s="Menu",onSelect:p,style:h}){const[x,a]=u.useState(!1),g=u.useRef(null);return u.useEffect(j,[]),U(g,u.useCallback(()=>a(!1),[])),e.jsxs("div",{ref:g,className:"dhx",style:{position:"relative",display:"inline-block",...h},children:[e.jsxs("button",{className:"dhx dhx-btn dhx-btn-secondary",onClick:()=>a(i=>!i),children:[s," ",e.jsx("span",{style:{fontSize:10},children:x?"▲":"▼"})]}),x&&e.jsx(R,{items:r,onSelect:i=>{p==null||p(i),a(!1)}})]})}function Be({items:r=[],onSelect:s,children:p}){const[h,x]=u.useState(null),a=u.useRef(null);u.useEffect(j,[]),U(a,u.useCallback(()=>x(null),[]));const g=i=>{i.preventDefault(),x({x:i.clientX,y:i.clientY})};return e.jsxs("div",{ref:a,onContextMenu:g,style:{position:"relative",display:"contents"},children:[p,h&&e.jsx("div",{style:{position:"fixed",left:h.x,top:h.y,zIndex:9999},children:e.jsx(R,{items:r,onSelect:i=>{s==null||s(i),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[h,x]=u.useState(null),[a,g]=u.useState(()=>{const n={};return r.forEach(l=>{l.id&&(l.twoState||l.group)&&l.active&&(n[l.id]=!0)}),n}),i=u.useRef(null);u.useEffect(j,[]),U(i,u.useCallback(()=>x(null),[]));const v=(n,l)=>{var d,y;if(!n.disabled){if(n.twoState&&n.id&&g(o=>({...o,[n.id]:!o[n.id]})),n.group&&n.id&&g(o=>{const b={...o};return r.forEach(S=>{S.group===n.group&&S.id&&(b[S.id]=!1)}),b[n.id]=!0,b}),(d=n.items)!=null&&d.length){x(o=>o===l?null:l);return}(y=n.onClick)==null||y.call(n,n.id||""),s==null||s(n.id||"")}},M=(n,l)=>{var b,S;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:z=>{var C;return(C=n.onChange)==null?void 0:C.call(n,z.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:z=>{var C;return(C=n.onChange)==null?void 0:C.call(n,z.target.value)},children:(b=n.options)==null?void 0:b.map(z=>e.jsx("option",{value:z.value,children:z.label},z.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:()=>v(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 d=!!(n.id&&a[n.id]),y=n.value??n.text,o=!!((S=n.items)!=null&&S.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:d?t.primaryLt:"transparent",color:d?t.primary:n.disabled?t.textMut:t.text,opacity:n.disabled?.55:1,cursor:n.disabled?"not-allowed":"pointer"},onClick:()=>v(n,l),children:[n.icon&&e.jsx("span",{style:{fontSize:16},children:n.icon}),y&&e.jsx("span",{style:{fontSize:13},children:y}),o&&e.jsx("span",{style:{fontSize:9,opacity:.55,marginLeft:2},children:"▼"}),n.count!==void 0&&e.jsx(Me,{count:n.count})]}),o&&h===l&&e.jsx(R,{items:n.items,onSelect:()=>x(null),style:{top:"100%",left:0}})]},l)};return e.jsx("div",{ref:i,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:h,header:x,footer:a,style:g}){const[i,v]=u.useState(p??!1),[M,n]=u.useState(null),[l,d]=u.useState({});u.useEffect(j,[]);const y=i?56:s,o=S=>{n(S.id),h==null||h(S)},b=(S,z=0)=>{var k;if(S.type==="separator")return e.jsx("div",{style:{height:1,background:t.border,margin:"6px 8px"}},S.id);if(S.type==="customHTML")return e.jsx("div",{style:{padding:"8px 12px"},dangerouslySetInnerHTML:{__html:S.html||""}},S.id);const C=(((k=S.items)==null?void 0:k.length)??0)>0,I=l[S.id],f=M===S.id;return e.jsxs("div",{children:[e.jsxs("div",{onClick:()=>{C&&d(N=>({...N,[S.id]:!N[S.id]})),o(S)},style:{display:"flex",alignItems:"center",gap:10,padding:`8px ${i?"0px":`${12+z*16}px`}`,cursor:"pointer",borderRadius:t.r,margin:"1px 6px",justifyContent:i?"center":"flex-start",transition:"all .15s",background:f?t.primaryLt:"transparent",color:f?t.primary:t.text,userSelect:"none"},onMouseEnter:N=>!f&&(N.currentTarget.style.background=t.bg),onMouseLeave:N=>!f&&(N.currentTarget.style.background="transparent"),children:[S.icon&&e.jsx("span",{style:{fontSize:18,minWidth:22,textAlign:"center"},children:S.icon}),!i&&e.jsx("span",{style:{flex:1,fontSize:13,fontWeight:f?600:400},children:S.value}),!i&&S.count!==void 0&&e.jsx("span",{style:{background:t.primary,color:"#fff",borderRadius:10,padding:"1px 6px",fontSize:11,fontWeight:700},children:S.count}),!i&&C&&e.jsx("span",{style:{fontSize:12,color:t.textMut,transition:"transform .15s",transform:I?"rotate(90deg)":"rotate(0deg)"},children:"▶"})]}),C&&I&&!i&&S.items.map(N=>b(N,z+1))]},S.id)};return e.jsxs("div",{className:"dhx",style:{width:y,minWidth:y,background:t.surface,borderRight:`1px solid ${t.border}`,display:"flex",flexDirection:"column",transition:"width .2s ease",overflow:"hidden",...g},children:[x&&!i&&e.jsx("div",{style:{padding:"12px 14px",borderBottom:`1px solid ${t.border}`,fontWeight:700,fontSize:15},children:x}),e.jsx("button",{onClick:()=>v(S=>!S),style:{margin:"8px 6px",background:"transparent",border:"none",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:i?"center":"flex-end",padding:"4px 6px",borderRadius:t.r,color:t.textSec},children:e.jsx("span",{style:{fontSize:18},children:i?"☰":"✕"})}),e.jsx("div",{className:"dhx-scroll",style:{flex:1,overflowY:"auto",overflowX:"hidden"},children:r.map(S=>b(S))}),a&&!i&&e.jsx("div",{style:{padding:"10px 14px",borderTop:`1px solid ${t.border}`},children:a})]})}function je({config:r}){const[s,p]=u.useState(!1),h={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:h,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:h,children:x}){u.useEffect(j,[]);const a=p==="space"?12:p==="wide"?8:1,g=r||s,i=!!r;return g?e.jsx("div",{className:"dhx",style:{display:"flex",flexDirection:i?"column":"row",gap:a,width:"100%",height:"100%",...h},children:g.map((v,M)=>e.jsx(je,{config:v},v.id||M))}):e.jsx("div",{className:"dhx",style:{width:"100%",height:"100%",...h},children:x})}function Oe({views:r=[],mode:s="top",tabAlign:p="left",closable:h=[],disabled:x=[],defaultActive:a,onBeforeChange:g,onChange:i,style:v}){var f;const[M,n]=u.useState(a||((f=r[0])==null?void 0:f.id)),[l,d]=u.useState(r.map(k=>k.id));u.useEffect(j,[]);const y=(k,N)=>{k.stopPropagation(),d(c=>c.filter(D=>D!==N)),M===N&&n(l.find(c=>c!==N)??"")},o=k=>{x.includes(k)||g&&g(k)===!1||(n(k),i==null||i(k))},b=s==="left"||s==="right",S=r.filter(k=>l.includes(k.id)),z=e.jsx("div",{style:{display:"flex",flexDirection:b?"column":"row",justifyContent:p==="center"?"center":p==="right"?"flex-end":"flex-start",background:t.surface,borderBottom:!b&&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:S.map(k=>{const N=M===k.id,c=x.includes(k.id),D=s==="bottom"?{borderTop:`2px solid ${t.primary}`,color:t.primary,fontWeight:600}:b?{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:()=>o(k.id),style:{display:"flex",alignItems:"center",gap:6,padding:"10px 16px",cursor:c?"not-allowed":"pointer",whiteSpace:"nowrap",fontSize:13,transition:"color .15s",userSelect:"none",minWidth:b?120:"auto",...N?D:{color:c?t.textMut:t.textSec}},children:[k.icon&&e.jsx("span",{style:{fontSize:16},children:k.icon}),e.jsx("span",{children:k.tab}),h.includes(k.id)&&e.jsx("span",{onClick:w=>y(w,k.id),style:{marginLeft:4,opacity:.6,fontSize:12,cursor:"pointer"},children:"✕"})]},k.id)})}),C=S.find(k=>k.id===M),I=e.jsxs("div",{className:"dhx-scroll",style:{flex:1,overflow:"auto"},children:[C==null?void 0:C.content,(C==null?void 0:C.html)&&e.jsx("div",{dangerouslySetInnerHTML:{__html:C.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",...v},children:[z,I]})}const Q=`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:h=40,sortable:x=!0,resizable:a=!0,editable:g=!1,stripe:i=!1,autoWidth:v=!1,keyNavigation:M=!1,selection:n,multiselect:l,onSelect:d,onChange:y,style:o}){const[b,S]=u.useState(null),[z,C]=u.useState("asc"),[I,f]=u.useState({}),[k,N]=u.useState(new Set),[c,D]=u.useState(-1),[w,B]=u.useState(()=>r.map(m=>m.width??m.minWidth??150)),[V,J]=u.useState(null),[Z,le]=u.useState(""),[oe,ae]=u.useState({}),E=u.useRef(null),[P,F]=u.useState(0);u.useEffect(j,[]),u.useEffect(()=>{if(!v||!E.current)return;const m=new ResizeObserver(()=>{var $;return F((($=E.current)==null?void 0:$.offsetWidth)??0)});return m.observe(E.current),()=>m.disconnect()},[v]);const X=u.useMemo(()=>{if(!v||P===0)return w;const m=w.reduce((L,T)=>L+T,0);if(P<=m)return w;const $=(P-m)/r.length;return w.map(L=>L+$)},[v,P,w,r.length]),K=u.useMemo(()=>{let m=s.map(($,L)=>{const T=String($.id??L);return oe[T]?{...$,...oe[T]}:$}).filter($=>Object.entries(I).every(([L,T])=>!T||String($[L]??"").toLowerCase().includes(T.toLowerCase())));return b&&(m=[...m].sort(($,L)=>{const T=$[b],O=L[b];if(T==null)return 1;if(O==null)return-1;const H=T<O?-1:T>O?1:0;return z==="asc"?H:-H})),m},[s,b,z,I,oe]),G=u.useMemo(()=>{const m={};return r.forEach($=>{var L;if((L=$.footer)!=null&&L.some(T=>T.summary)){const T=K.map(H=>Number(H[$.id])).filter(H=>!isNaN(H)),O=T.reduce((H,te)=>H+te,0);m[$.id]={sum:O,avg:T.length?O/T.length:0,count:K.length,min:T.length?Math.min(...T):0,max:T.length?Math.max(...T):0}}}),m},[K,r]),q=u.useMemo(()=>{const m={};return r.filter($=>$.filterType==="select").forEach($=>{m[$.id]=[...new Set(s.map(L=>String(L[$.id]??"")))].sort()}),m},[s,r]),ie=r.some(m=>m.filterable),de=r.some(m=>{var $;return($=m.footer)==null?void 0:$.length}),ve=X.reduce((m,$)=>m+$,0),se=(m,$)=>m.id??$,ce=m=>{!x||m.sortable===!1||(C($=>b===m.id&&$==="asc"?"desc":"asc"),S(m.id))},A=(m,$)=>{if(!n)return;const L=se(m,$);D($),N(T=>{const O=l?new Set(T):new Set;return O.has(L)?O.delete(L):O.add(L),O}),d==null||d(m)},ee=()=>{if(!V)return;const{key:m,colId:$}=V;ae(T=>({...T,[String(m)]:{...T[String(m)]||{},[$]:Z}}));const L=K.find((T,O)=>se(T,O)===m);L&&(y==null||y(L,$,Z)),J(null)},ct=m=>{if(V&&m.key==="Escape"){J(null);return}if(!(!M||!n)){if(m.key==="ArrowDown"){m.preventDefault();const $=Math.min(c+1,K.length-1);$>=0&&A(K[$],$)}else if(m.key==="ArrowUp"){m.preventDefault();const $=Math.max(c-1,0);$>=0&&A(K[$],$)}}},pt=(m,$)=>{m.preventDefault(),m.stopPropagation();const L=m.clientX,T=w[$],O=te=>B(ke=>{const re=[...ke];return re[$]=Math.max(r[$].minWidth||50,T+te.clientX-L),re}),H=()=>{document.removeEventListener("mousemove",O),document.removeEventListener("mouseup",H)};document.addEventListener("mousemove",O),document.addEventListener("mouseup",H)},Se=(m,$,L,T)=>({width:m,minWidth:m,flexShrink:0,boxSizing:"border-box",padding:"0 12px",height:T,display:"flex",alignItems:"center",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",fontSize:13,textAlign:$.align,justifyContent:$.align==="center"?"center":$.align==="right"?"flex-end":"flex-start",borderLeft:L?"none":Q});return e.jsx("div",{ref:E,className:"dhx",tabIndex:M?0:void 0,onKeyDown:ct,style:{width:"100%",height:p,display:"flex",flexDirection:"column",border:Q,borderRadius:t.r,overflow:"hidden",outline:"none",...o},children:e.jsx("div",{style:{overflowX:"auto",flex:1,display:"flex",flexDirection:"column",minHeight:0},children:e.jsxs("div",{style:{minWidth:ve,display:"flex",flexDirection:"column",height:"100%"},children:[e.jsx("div",{style:{display:"flex",background:t.bg,borderBottom:Q,flexShrink:0,position:"sticky",top:0,zIndex:2},children:r.map((m,$)=>{var L;return e.jsxs("div",{onClick:()=>ce(m),style:{...Se(X[$],m,$===0,40),position:"relative",fontWeight:500,color:t.text,cursor:x&&m.sortable!==!1?"pointer":"default",userSelect:"none"},children:[e.jsx("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:Array.isArray(m.header)?(L=m.header[0])==null?void 0:L.text:m.header||m.id}),x&&m.sortable!==!1&&e.jsx(Ye,{active:b===m.id,dir:z}),a&&m.resizable!==!1&&$<r.length-1&&e.jsx("div",{onMouseDown:T=>pt(T,$),onClick:T=>T.stopPropagation(),style:{position:"absolute",right:0,top:0,bottom:0,width:4,cursor:"col-resize",zIndex:1},onMouseEnter:T=>T.currentTarget.style.background=t.primary+"55",onMouseLeave:T=>T.currentTarget.style.background="transparent"})]},m.id)})}),ie&&e.jsx("div",{style:{display:"flex",borderBottom:Q,background:t.surface,flexShrink:0},children:r.map((m,$)=>e.jsx("div",{style:{width:X[$],minWidth:X[$],flexShrink:0,padding:"4px 6px",boxSizing:"border-box",borderLeft:$===0?"none":Q},children:m.filterable&&m.filterType==="select"?e.jsxs("select",{className:"dhx dhx-input",style:{height:26,fontSize:12,padding:"0 4px"},value:I[m.id]||"",onChange:L=>f(T=>({...T,[m.id]:L.target.value})),children:[e.jsx("option",{value:"",children:"All"}),(q[m.id]||[]).map(L=>e.jsx("option",{value:L,children:L},L))]}):m.filterable?e.jsx("input",{className:"dhx dhx-input",style:{height:26,fontSize:12},placeholder:"Filter...",value:I[m.id]||"",onChange:L=>f(T=>({...T,[m.id]:L.target.value}))}):null},m.id))}),e.jsxs("div",{className:"dhx-scroll",style:{flex:1,overflowY:"auto",minHeight:0},children:[K.map((m,$)=>{const L=se(m,$),T=k.has(L),O=T?t.primaryLt:i&&$%2!==0?t.bg:t.surface;return e.jsx("div",{style:{display:"flex",height:h,borderBottom:Q,flexShrink:0,background:O,transition:"background .1s",cursor:n?"pointer":"default"},onMouseEnter:H=>!T&&(H.currentTarget.style.background=t.primaryLt+"80"),onMouseLeave:H=>!T&&(H.currentTarget.style.background=O),children:r.map((H,te)=>{const ke=(V==null?void 0:V.key)===L&&(V==null?void 0:V.colId)===H.id,re=m[H.id],ht=H.template?H.template(re,m):String(re??"");return e.jsx("div",{onClick:()=>{A(m,$),g&&H.editable!==!1&&(J({key:L,colId:H.id}),le(String(re??"")))},style:Se(X[te],H,te===0,h),children:ke?e.jsx("input",{autoFocus:!0,value:Z,onChange:ne=>le(ne.target.value),onBlur:ee,onKeyDown:ne=>{ne.key==="Enter"&&ee(),ne.key==="Escape"&&J(null)},onClick:ne=>ne.stopPropagation(),style:{width:"100%",border:"none",outline:`2px solid ${t.primary}`,borderRadius:2,fontSize:13,padding:"2px 4px",background:t.surface,color:t.text}}):ht},H.id)})},String(L))}),K.length===0&&e.jsx("div",{style:{textAlign:"center",padding:40,color:t.textMut,fontSize:13},children:"No data"})]}),de&&e.jsx("div",{style:{display:"flex",borderTop:Q,background:t.bg,flexShrink:0},children:r.map((m,$)=>{var H;const L=(H=m.footer)==null?void 0:H[0],T=G[m.id]??{sum:0,avg:0,count:0,min:0,max:0};let O="";return L&&(typeof L.text=="function"?O=L.text(T):L.text?O=L.text:L.summary&&(O=String(Math.round(T[L.summary]*100)/100))),e.jsx("div",{style:{...Se(X[$],m,$===0,40),fontWeight:600,color:t.text},children:O},m.id)})})]})})})}const _=["#0288d1","#43a047","#f57c00","#e53935","#8e24aa","#00838f","#ef6c00","#2e7d32"];function Ke({type:r="bar",data:s=[],series:p=[],scales:h={},legend:x,height:a=280,style:g}){var b,S,z,C,I;u.useEffect(j,[]);const i=((b=h.bottom)==null?void 0:b.text)||s[0]&&Object.keys(s[0])[0]||"x",v=e.jsx(Y.Tooltip,{contentStyle:{fontSize:12,borderRadius:t.r,border:`1px solid ${t.border}`}}),M=x?e.jsx(Y.Legend,{iconSize:10,wrapperStyle:{fontSize:12},verticalAlign:x.valign,align:x.halign}):null,n=e.jsx(Y.CartesianGrid,{strokeDasharray:"3 3",stroke:t.border}),l=e.jsx(Y.XAxis,{dataKey:i,tick:{fontSize:11,fill:t.textSec},axisLine:{stroke:t.border},tickLine:!1}),d=e.jsx(Y.YAxis,{tick:{fontSize:11,fill:t.textSec},axisLine:!1,tickLine:!1,domain:[((S=h.left)==null?void 0:S.min)??"auto",((z=h.left)==null?void 0:z.max)??"auto"]}),y={data:s,margin:{top:10,right:20,left:0,bottom:0}};let o;if(r==="bar")o=e.jsxs(Y.BarChart,{...y,children:[n,l,d,v,M,p.map((f,k)=>e.jsx(Y.Bar,{dataKey:f.value||f.id,name:f.label||f.id,fill:f.fill||_[k%_.length],radius:[3,3,0,0]},f.id))]});else if(r==="line")o=e.jsxs(Y.LineChart,{...y,children:[n,l,d,v,M,p.map((f,k)=>e.jsx(Y.Line,{type:"monotone",dataKey:f.value||f.id,name:f.label||f.id,stroke:f.color||_[k%_.length],strokeWidth:2,dot:{r:3,fill:f.color||_[k%_.length]}},f.id))]});else if(r==="area")o=e.jsxs(Y.AreaChart,{...y,children:[n,l,d,v,M,p.map((f,k)=>e.jsx(Y.Area,{type:"monotone",dataKey:f.value||f.id,name:f.label||f.id,stroke:f.color||_[k%_.length],fill:(f.fill||_[k%_.length])+"33",strokeWidth:2},f.id))]});else if(r==="pie"||r==="donut"){const f=s[0]||{},k=Object.keys(f).find(c=>typeof f[c]=="number")||"value",N=Object.keys(f).find(c=>typeof f[c]=="string")||"x";o=e.jsxs(Y.PieChart,{children:[e.jsx(Y.Pie,{data:s,cx:"50%",cy:"50%",outerRadius:r==="donut"?"70%":"80%",innerRadius:r==="donut"?"40%":0,dataKey:k,nameKey:N,label:({name:c,percent:D})=>`${c??""} ${((D??0)*100).toFixed(0)}%`,labelLine:!0,paddingAngle:2,children:s.map((c,D)=>e.jsx(Y.Cell,{fill:_[D%_.length]},D))}),v,M]})}else r==="radar"?o=e.jsxs(Y.RadarChart,{...y,cx:"50%",cy:"50%",children:[e.jsx(Y.PolarGrid,{}),e.jsx(Y.PolarAngleAxis,{dataKey:i,tick:{fontSize:11}}),p.map((f,k)=>e.jsx(Y.Radar,{dataKey:f.value||f.id,name:f.label||f.id,stroke:f.color||_[k],fill:(f.fill||_[k])+"44"},f.id)),v,M]}):r==="scatter"&&(o=e.jsxs(Y.ScatterChart,{...y,children:[n,e.jsx(Y.XAxis,{dataKey:((C=p[0])==null?void 0:C.xValue)||"x",type:"number",tick:{fontSize:11,fill:t.textSec}}),e.jsx(Y.YAxis,{dataKey:((I=p[0])==null?void 0:I.yValue)||"y",tick:{fontSize:11,fill:t.textSec}}),v,p.map((f,k)=>e.jsx(Y.Scatter,{data:f.data||s,name:f.label||f.id,fill:f.color||_[k]},f.id))]}));return e.jsx("div",{className:"dhx",style:{width:"100%",height:a,padding:12,background:t.surface,borderRadius:t.rMd,...g},children:e.jsx(Y.ResponsiveContainer,{width:"100%",height:"100%",children:o})})}const Ve=["January","February","March","April","May","June","July","August","September","October","November","December"],Xe=["Su","Mo","Tu","We","Th","Fr","Sa"];function _e({value:r,range:s=!1,timepicker:p=!1,onChange:h,style:x}){const a=new Date,g=r?new Date(Array.isArray(r)?r[0]:r):a,[i,v]=u.useState(g),[M,n]=u.useState(r??(s?[null,null]:null)),[l,d]=u.useState(null),[y,o]=u.useState({h:0,m:0});u.useEffect(j,[]);const b=i.getFullYear(),S=i.getMonth(),z=new Date(b,S,1).getDay(),C=new Date(b,S+1,0).getDate(),I=[];for(let c=0;c<z;c++)I.push(null);for(let c=1;c<=C;c++)I.push(new Date(b,S,c));const f=c=>c.toDateString()===a.toDateString(),k=c=>{if(!M)return!1;if(s&&Array.isArray(M)){const[D,w]=M;if(!D)return!1;const B=c.getTime();return w?B>=D.getTime()&&B<=w.getTime():c.toDateString()===D.toDateString()}return c.toDateString()===M.toDateString()},N=c=>{if(s){const[D,w]=Array.isArray(M)?M:[null,null];if(!D||w)n([c,null]);else{const B=c<D?[c,D]:[D,c];n(B),h==null||h(B)}}else n(c),h==null||h(c)};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:()=>v(c=>new Date(c.getFullYear(),c.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:[Ve[S]," ",b]}),e.jsx("button",{onClick:()=>v(c=>new Date(c.getFullYear(),c.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:[Xe.map(c=>e.jsx("div",{style:{textAlign:"center",fontSize:11,fontWeight:600,color:t.textMut,paddingBottom:4},children:c},c)),I.map((c,D)=>{const w=c?k(c):!1,B=c&&l&&c.toDateString()===l.toDateString();return e.jsx("div",{onClick:()=>c&&N(c),onMouseEnter:()=>c&&d(c),onMouseLeave:()=>d(null),style:{width:32,height:32,display:"flex",alignItems:"center",justifyContent:"center",borderRadius:t.r,cursor:c?"pointer":"default",fontSize:12,fontWeight:c&&f(c)?700:400,background:w?t.primary:B?t.bg:"transparent",color:w?"#fff":c&&f(c)?t.primary:c?t.text:"transparent",border:c&&f(c)&&!w?`1px solid ${t.primary}`:"1px solid transparent",transition:"all .1s"},children:c==null?void 0:c.getDate()},D)})]}),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:y.h,onChange:c=>o(D=>({...D,h:+c.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:y.m,onChange:c=>o(D=>({...D,m:+c.target.value})),className:"dhx dhx-input",style:{width:50,textAlign:"center"}})]})]})}function $e({value:r,onChange:s,timeFormat:p=12,controls:h=!1,minuteStep:x=5,style:a}){const[g,i]=u.useState((r==null?void 0:r.h)??(p===24?0:12)),[v,M]=u.useState((r==null?void 0:r.m)??0),[n,l]=u.useState((r==null?void 0:r.ampm)??"AM"),[d,y]=u.useState(null);u.useEffect(j,[]);const o=p===24?Array.from({length:24},(f,k)=>k):Array.from({length:12},(f,k)=>k+1),b=Array.from({length:Math.ceil(60/x)},(f,k)=>k*x),S=(f,k,N)=>{const c=p===24?{h:f,m:k}:{h:f,m:k,ampm:N};h?y(c):s==null||s(c)},z=()=>{y(null),i((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")},C={display:"flex",flexDirection:"column",alignItems:"center",gap:4},I=f=>({height:32,display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer",fontSize:13,fontWeight:f?700:400,background:f?t.primaryLt:"transparent",color:f?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:C,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:o.map(f=>e.jsx("div",{onClick:()=>{i(f),S(f,v,n)},style:I(g===f),onMouseEnter:k=>g!==f&&(k.currentTarget.style.background=t.bg),onMouseLeave:k=>g!==f&&(k.currentTarget.style.background="transparent"),children:String(f).padStart(2,"0")},f))})]}),e.jsxs("div",{style:C,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:b.map(f=>e.jsx("div",{onClick:()=>{M(f),S(g,f,n)},style:I(v===f),onMouseEnter:k=>v!==f&&(k.currentTarget.style.background=t.bg),onMouseLeave:k=>v!==f&&(k.currentTarget.style.background="transparent"),children:String(f).padStart(2,"0")},f))})]}),p===12&&e.jsxs("div",{style:C,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(f=>e.jsx("div",{onClick:()=>{l(f),S(g,v,f)},style:{height:40,display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer",padding:"0 12px",fontSize:13,fontWeight:n===f?700:400,background:n===f?t.primary:t.surface,color:n===f?"#fff":t.text},children:f},f))})]})]}),e.jsxs("div",{style:{textAlign:"center",marginTop:12,fontSize:22,fontWeight:700,color:t.primary,letterSpacing:2},children:[String(g).padStart(2,"0"),":",String(v).padStart(2,"0"),p===12?` ${n}`:""]}),h&&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:()=>d&&(s==null?void 0:s(d)),children:"Apply"})]})]})}const qe=({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 pe({data:r=[],value:s,placeholder:p="Select or type...",multiselection:h=!1,label:x,onChange:a,style:g}){var N;const[i,v]=u.useState(!1),[M,n]=u.useState(""),[l,d]=u.useState(h?s?[].concat(s):[]:s||null),y=u.useRef(null),o=u.useRef(null);u.useEffect(j,[]),U(y,u.useCallback(()=>{v(!1),n("")},[]));const b=u.useMemo(()=>r.filter(c=>!M||c.value.toLowerCase().includes(M.toLowerCase())),[r,M]),S=c=>h?(l||[]).includes(c):l===c,z=c=>{const D=c.id||c.value;if(h){const w=S(D)?l.filter(B=>B!==D):[...l||[],D];d(w),a==null||a(w)}else d(D),n(""),v(!1),a==null||a(D)},C=c=>{const D=l.filter(w=>w!==c);d(D),a==null||a(D)},I=()=>{v(!0),setTimeout(()=>{var c;return(c=o.current)==null?void 0:c.focus()},0)},f=((N=r.find(c=>(c.id||c.value)===l))==null?void 0:N.value)||"",k=h?l||[]:[];return e.jsxs("div",{ref:y,className:"dhx",style:{position:"relative",...g},children:[x&&e.jsx("label",{className:"dhx dhx-label",children:x}),e.jsxs("div",{onClick:I,style:{display:"flex",alignItems:"center",flexWrap:h?"wrap":"nowrap",border:`1px solid ${i?t.primary:t.border}`,borderRadius:t.r,minHeight:34,padding:"4px 8px",cursor:"text",background:t.surface,gap:4,transition:"border-color .15s",boxShadow:i?`0 0 0 3px ${t.primary}22`:"none"},children:[h&&e.jsxs(e.Fragment,{children:[k.map(c=>{var D;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:[((D=r.find(w=>(w.id||w.value)===c))==null?void 0:D.value)||c,e.jsx("span",{onClick:w=>{w.stopPropagation(),C(c)},style:{cursor:"pointer",fontSize:15,lineHeight:1,opacity:.75,marginLeft:2},children:"×"})]},c)}),e.jsx("input",{ref:o,value:M,onChange:c=>{n(c.target.value),v(!0)},onFocus:()=>v(!0),onClick:c=>c.stopPropagation(),placeholder:k.length?"":p,style:{flex:1,minWidth:60,border:"none",outline:"none",fontSize:13,background:"transparent",color:t.text,padding:0}})]}),!h&&e.jsx("input",{ref:o,value:i?M:f,onChange:c=>{n(c.target.value),v(!0)},onFocus:()=>{v(!0),n("")},onClick:c=>c.stopPropagation(),placeholder:p,style:{flex:1,border:"none",outline:"none",fontSize:13,background:"transparent",color:t.text,padding:0}}),e.jsx(qe,{open:i})]}),i&&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:[b.map(c=>{const D=c.id||c.value,w=S(D);return e.jsxs("div",{onClick:()=>z(c),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:B=>!w&&(B.currentTarget.style.background=t.bg),onMouseLeave:B=>!w&&(B.currentTarget.style.background="transparent"),children:[h&&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:c.value}),!h&&w&&e.jsx("span",{style:{color:t.primary,fontSize:12,fontWeight:700},children:"✓"}),c.count!==void 0&&e.jsxs("span",{style:{fontSize:11,color:t.textMut},children:["(",c.count,")"]})]},D)}),b.length===0&&e.jsx("div",{style:{padding:16,textAlign:"center",color:t.textMut,fontSize:13},children:"No matches"})]})})]})}function he({min:r=0,max:s=100,step:p=1,value:h,range:x=!1,label:a,tick:g,disabled:i=!1,onChange:v,style:M}){const[n,l]=u.useState(h??(x?[r,s]:r));u.useEffect(j,[]);const d=(z,C)=>{if(!i)if(x){const I=[...n];I[z]=C,l(I),v==null||v(I)}else l(C),v==null||v(C)},y=z=>(z-r)/(s-r)*100,o=x?n:[n],b=x?{left:`${y(o[0])}%`,width:`${y(o[1])-y(o[0])}%`}:{left:0,width:`${y(o[0])}%`},S=i?t.border:t.primary;return e.jsxs("div",{className:"dhx",style:{width:"100%",opacity:i?.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",...b,height:"100%",background:S,borderRadius:2}}),o.map((z,C)=>e.jsx("input",{type:"range",min:r,max:s,step:p,value:z,disabled:i,onChange:I=>{const f=+I.target.value;x&&C===0&&f>=n[1]||x&&C===1&&f<=n[0]||d(C,f)},style:{position:"absolute",width:"100%",height:"100%",opacity:0,cursor:i?"not-allowed":"pointer",top:0,left:0,margin:0}},C)),o.map((z,C)=>e.jsx("div",{style:{position:"absolute",left:`${y(z)}%`,top:"50%",transform:"translate(-50%, -50%)",width:16,height:16,borderRadius:"50%",background:t.surface,border:`2px solid ${S}`,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:i?t.textMut:t.primaryDk,color:"#fff",padding:"2px 6px",borderRadius:t.r,fontSize:11,fontWeight:700,whiteSpace:"nowrap"},children:z})},C))]})}),g&&e.jsx("div",{style:{display:"flex",justifyContent:"space-between",marginTop:2},children:[r,Math.round((s+r)/2),s].map(z=>e.jsx("span",{style:{fontSize:10,color:t.textMut},children:z},z))})]})}const Ge=["#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 fe(r){const s=parseInt(r.slice(1,3),16)/255,p=parseInt(r.slice(3,5),16)/255,h=parseInt(r.slice(5,7),16)/255,x=Math.max(s,p,h),a=Math.min(s,p,h);let g=0,i=0;const v=(x+a)/2;if(x!==a){const M=x-a;i=v>.5?M/(2-x-a):M/(x+a),g=x===s?((p-h)/M+(p<h?6:0))/6:x===p?((h-s)/M+2)/6:((s-p)/M+4)/6}return[Math.round(g*360),Math.round(i*100),Math.round(v*100)]}function Ce(r,s,p){s/=100,p/=100;const h=s*Math.min(p,1-p),x=a=>{const g=(a+r/30)%12,i=p-h*Math.max(Math.min(g-3,9-g,1),-1);return Math.round(255*i).toString(16).padStart(2,"0")};return"#"+x(0)+x(8)+x(4)}function Je({value:r="#0288d1",onChange:s,style:p}){const[h,x]=u.useState(()=>fe(r)),a=Ce(...h);u.useEffect(j,[]);const g=i=>{x(i),s==null||s(Ce(...i))};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(${h[0]},100%,50%))`,cursor:"crosshair"}}),[["Hue",0,360,h[0]],["Saturation",0,100,h[1]],["Lightness",0,100,h[2]]].map(([i,v,M,n],l)=>e.jsxs("div",{style:{marginBottom:l<2?8:12},children:[e.jsxs("div",{className:"dhx dhx-label",children:[i,l>0?` (${n}%)`:""]}),e.jsx("input",{type:"range",min:v,max:M,value:n,onChange:d=>{const y=[...h];y[l]=+d.target.value,g(y)},style:{width:"100%",accentColor:t.primary}})]},i)),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:i=>{try{g(fe(i.target.value)),s==null||s(i.target.value)}catch{}}})]}),e.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(13, 1fr)",gap:3},children:Ge.map(i=>e.jsx("div",{onClick:()=>{x(fe(i)),s==null||s(i)},style:{width:14,height:14,borderRadius:2,background:i,cursor:"pointer",border:a===i?`2px solid ${t.text}`:"1px solid rgba(0,0,0,.15)",transition:"transform .1s"},onMouseEnter:v=>v.currentTarget.style.transform="scale(1.3)",onMouseLeave:v=>v.currentTarget.style.transform="scale(1)"},i))})]})}function Ue({trigger:r,children:s,placement:p="bottom-start",style:h}){const[x,a]=u.useState(!1),[g,i]=u.useState({top:"100%",left:0}),v=u.useRef(null),M=u.useRef(null);u.useEffect(j,[]),U(v,u.useCallback(()=>a(!1),[]));const n=()=>{a(l=>{if(!l&&M.current){const d=M.current.getBoundingClientRect(),y={"bottom-start":{top:d.height+4,left:0},"bottom-end":{top:d.height+4,right:0,left:"auto"},"top-start":{bottom:d.height+4,top:"auto",left:0}};i(y[p]||y["bottom-start"])}return!l})};return e.jsxs("div",{ref:v,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",...g,zIndex:200,background:t.surface,border:`1px solid ${t.border}`,borderRadius:t.rMd,boxShadow:t.shadowLg,...h},children:s})]})}function Qe({title:r,children:s,width:p=480,height:h,closable:x=!0,movable:a=!0,modal:g=!1,defaultOpen:i=!0,footer:v,onClose:M,style:n}){const[l,d]=u.useState(i),[y,o]=u.useState({x:0,y:0});u.useEffect(j,[]);const b=me(u.useCallback((z,C)=>a&&o({x:z,y:C}),[a])),S=()=>{d(!1),M==null||M()};return l?e.jsxs(e.Fragment,{children:[g&&e.jsx("div",{style:{position:"fixed",inset:0,background:"rgba(0,0,0,.45)",zIndex:900},onClick:x?S:void 0}),e.jsxs("div",{className:"dhx",style:{position:g?"fixed":"absolute",left:"50%",top:"50%",transform:`translate(calc(-50% + ${y.x}px), calc(-50% + ${y.y}px))`,width:p,...h?{height:h}:{},background:t.surface,borderRadius:t.rMd,boxShadow:t.shadowLg,zIndex:901,display:"flex",flexDirection:"column",overflow:"hidden",...n},children:[e.jsxs("div",{onMouseDown:z=>b(z,y.x,y.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:S,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:s}),v&&e.jsx("div",{style:{padding:"12px 16px",borderTop:`1px solid ${t.border}`,display:"flex",justifyContent:"flex-end",gap:8,background:t.bg},children:v})]})]}):null}const ue=u.createContext(null),Ze={success:"✓",error:"✕",warning:"⚠",info:"ℹ"},De={success:t.success,error:t.danger,warning:t.warning,info:t.primary};function Re({children:r}){const[s,p]=u.useState([]);u.useEffect(j,[]);const h=u.useCallback(g=>p(i=>i.filter(v=>v.id!==g)),[]),x=u.useCallback(g=>{const i=Date.now();return p(v=>[...v,{id:i,...g}]),g.duration!==0&&setTimeout(()=>h(i),g.duration||4e3),i},[h]),a={message:x,alert:(g,i)=>x({type:"info",title:g,...i}),confirm:(g,i,v)=>x({type:"warning",title:g,confirm:i,...v})};return e.jsxs(ue.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(g=>{const i=g.type||"info";return e.jsxs("div",{style:{background:t.surface,border:`1px solid ${t.border}`,borderLeft:`4px solid ${De[i]}`,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[i],lineHeight:1},children:Ze[i]}),e.jsxs("div",{style:{flex:1},children:[g.title&&e.jsx("div",{style:{fontWeight:600,fontSize:13,marginBottom:g.text?3:0},children:g.title}),g.text&&e.jsx("div",{style:{fontSize:12,color:t.textSec,lineHeight:1.5},children:g.text}),g.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:()=>{g.confirm(!0),h(g.id)},children:"Confirm"}),e.jsx("button",{className:"dhx dhx-btn dhx-btn-secondary",style:{height:26,fontSize:12},onClick:()=>{g.confirm(!1),h(g.id)},children:"Cancel"})]})]}),e.jsx("button",{onClick:()=>h(g.id),style:{background:"none",border:"none",cursor:"pointer",color:t.textMut,fontSize:14,lineHeight:1,padding:0},children:"×"})]},g.id)})})]})}function et(){const r=u.useContext(ue);if(!r)throw new Error("useMessage must be used inside <MessageProvider>");return r}function tt({data:r=[],template:s,keyNavigation:p=!0,multiselection:h=!1,editable:x=!1,height:a=400,onSelect:g,onEdit:i,style:v}){const[M,n]=u.useState(new Set),[l,d]=u.useState(null),[y,o]=u.useState(""),[b,S]=u.useState(null);u.useEffect(j,[]);const z=(I,f)=>{const k=I.id??f;n(N=>{const c=h?new Set(N):new Set;return c.has(k)?c.delete(k):c.add(k),c}),S(f),g==null||g(I)},C=(I,f)=>{i==null||i({...I,value:y},f),d(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,...v},tabIndex:0,onKeyDown:I=>{p&&(I.key==="ArrowDown"&&S(f=>Math.min((f??-1)+1,r.length-1)),I.key==="ArrowUp"&&S(f=>Math.max((f??1)-1,0)))},children:[r.map((I,f)=>{const k=I.id??f,N=M.has(k),c=b===f;return e.jsx("div",{onClick:()=>z(I,f),onDoubleClick:()=>x&&(d(f),o(String(I.value||""))),style:{display:"flex",alignItems:"center",padding:"0 12px",height:40,cursor:"pointer",fontSize:13,borderBottom:`1px solid ${t.border}`,background:N?t.primaryLt:c?t.bg:t.surface,color:N?t.primary:t.text,outline:c?`2px solid ${t.primary}44`:"none",transition:"background .1s"},children:l===f?e.jsx("input",{autoFocus:!0,className:"dhx dhx-input",style:{height:28,flex:1},value:y,onChange:D=>o(D.target.value),onBlur:()=>C(I,f),onKeyDown:D=>{D.key==="Enter"&&C(I,f),D.key==="Escape"&&d(null)},onClick:D=>D.stopPropagation()}):s?e.jsx("div",{dangerouslySetInnerHTML:{__html:s(I)},style:{flex:1}}):e.jsx("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:String(I.value??"")})},String(k))}),r.length===0&&e.jsx("div",{style:{padding:24,textAlign:"center",color:t.textMut},children:"No items"})]})}function rt({data:r=[],template:s,itemsInRow:p=3,gap:h=12,multiselection:x=!1,onSelect:a,style:g}){const[i,v]=u.useState(new Set);u.useEffect(j,[]);const M=n=>{const l=n.id??String(n.title);v(d=>{const y=x?new Set(d):new Set;return y.has(l)?y.delete(l):y.add(l),y}),a==null||a(n)};return e.jsx("div",{className:"dhx",style:{display:"grid",gridTemplateColumns:`repeat(${p}, 1fr)`,gap:h,padding:h,...g},children:r.map((n,l)=>{const d=n.id??l,y=i.has(d);return e.jsx("div",{onClick:()=>M(n),style:{background:t.surface,border:`2px solid ${y?t.primary:t.border}`,borderRadius:t.rMd,overflow:"hidden",cursor:"pointer",transition:"all .15s",boxShadow:y?`0 0 0 3px ${t.primary}33`:t.shadow,transform:y?"translateY(-2px)":"none"},onMouseEnter:o=>{o.currentTarget.style.boxShadow=t.shadowLg,o.currentTarget.style.transform="translateY(-2px)"},onMouseLeave:o=>{o.currentTarget.style.boxShadow=y?`0 0 0 3px ${t.primary}33`:t.shadow,o.currentTarget.style.transform=y?"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(d))})})}function ge(r){return r.map(s=>({...s,items:s.items?ge(s.items):void 0}))}function xe(r,s={}){return r.forEach(p=>{p.opened&&(s[p.id]=!0),p.items&&xe(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,g]=Ee(x.items,s);return g&&(p=g),{...x,items:a}}return x}),p]}function ye(r,s,p,h){if(h==="inside")return r.map(a=>a.id===s?{...a,items:[...a.items||[],p]}:a.items?{...a,items:ye(a.items,s,p,h)}:a);if(r.some(a=>a.id===s)){const a=[];for(const g of r)g.id===s?h==="before"?(a.push(p),a.push(g)):(a.push(g),a.push(p)):a.push(g);return a}return r.map(a=>a.items?{...a,items:ye(a.items,s,p,h)}:a)}function nt(r,s,p){function h(x){var a,g;if(x.id===s){const i=v=>{var M;return v.id===p||(((M=v.items)==null?void 0:M.some(i))??!1)};return((a=x.items)==null?void 0:a.some(i))??!1}return((g=x.items)==null?void 0:g.some(h))??!1}return r.some(h)}function Ie(r,s,p){return r.map(h=>h.id===s?{...h,value:p}:{...h,items:h.items?Ie(h.items,s,p):void 0})}function ot(r,s){var a;let p=0,h=0;const x=g=>{var i;p++,s[g.id]&&h++,(i=g.items)==null||i.forEach(x)};return(a=r.items)==null||a.forEach(x),{total:p,checkedCount:h}}function st({data:r=[],checkbox:s=!1,editable:p=!1,dragMode:h,tooltip:x,onSelect:a,onCheck:g,onChange:i,style:v}){const[M,n]=u.useState(()=>ge(r)),[l,d]=u.useState(()=>xe(r)),[y,o]=u.useState(null),[b,S]=u.useState({}),[z,C]=u.useState(null),[I,f]=u.useState(""),[k,N]=u.useState(null),[c,D]=u.useState(null);u.useEffect(j,[]),u.useEffect(()=>{n(ge(r)),d(E=>({...xe(r),...E}))},[r]);const w=E=>d(P=>({...P,[E]:!P[E]})),B=(E,P)=>{S(F=>({...F,[E]:P})),g==null||g(E,P)},V=()=>{if(!z)return;const E=z,P=I;C(null),n(F=>{const X=Ie(F,E,P);return i==null||i(X),X})},J=(E,P)=>{E.dataTransfer.effectAllowed="move",N(P)},Z=(E,P)=>{if(!k||k===P||nt(M,k,P))return;E.preventDefault();const F=E.currentTarget.getBoundingClientRect(),X=E.clientY-F.top,K=F.height,G=X<K*.25?"before":X>K*.75?"after":"inside";D(q=>(q==null?void 0:q.id)===P&&(q==null?void 0:q.pos)===G?q:{id:P,pos:G})},le=(E,P)=>{if(E.preventDefault(),!k||!c||k===P){D(null),N(null);return}n(F=>{const[X,K]=Ee(F,k);if(!K)return F;const G=ye(X,P,K,c.pos);return i==null||i(G),G}),c.pos==="inside"&&d(F=>({...F,[P]:!0})),D(null),N(null)},oe=()=>{N(null),D(null)},ae=(E,P=0)=>{var ce;const F=(((ce=E.items)==null?void 0:ce.length)??0)>0,X=l[E.id],K=y===E.id,G=k===E.id,q=(c==null?void 0:c.id)===E.id;let ie=!!b[E.id],de=!1;if(s&&F){const{total:A,checkedCount:ee}=ot(E,b);ee>0&&ee<A?de=!0:A>0&&ee===A&&(ie=!0)}const ve=q&&c.pos!=="inside"?{boxShadow:c.pos==="before"?`inset 0 2px 0 0 ${t.primary}`:`inset 0 -2px 0 0 ${t.primary}`}:{},se=q&&c.pos==="inside"||K?t.primaryLt:"transparent";return e.jsxs("div",{style:{opacity:G?.4:1},children:[e.jsxs("div",{draggable:!!h,onDragStart:h?A=>J(A,E.id):void 0,onDragOver:h?A=>Z(A,E.id):void 0,onDrop:h?A=>le(A,E.id):void 0,onDragEnd:h?oe:void 0,title:x==null?void 0:x(E),onClick:()=>{o(E.id),a==null||a(E),F&&w(E.id)},onDoubleClick:()=>{p&&(C(E.id),f(E.value||""))},style:{display:"flex",alignItems:"center",gap:4,padding:`5px 8px 5px ${12+P*18}px`,cursor:h?"grab":"pointer",borderRadius:t.r,margin:"1px 4px",background:se,color:K?t.primary:t.text,userSelect:"none",fontSize:13,...ve},onMouseEnter:A=>!K&&!q&&(A.currentTarget.style.background=t.bg),onMouseLeave:A=>!K&&!q&&(A.currentTarget.style.background="transparent"),children:[e.jsx("span",{style:{width:16,textAlign:"center",fontSize:11,color:t.textMut,flexShrink:0},onClick:A=>{A.stopPropagation(),F&&w(E.id)},children:F?X?"▾":"▸":""}),e.jsx("span",{style:{fontSize:15,flexShrink:0},children:F?X?"📂":"📁":"📄"}),s&&e.jsx("input",{ref:A=>{A&&(A.indeterminate=de)},type:"checkbox",checked:ie,onChange:A=>{A.stopPropagation(),B(E.id,A.target.checked)},style:{cursor:"pointer",accentColor:t.primary,flexShrink:0},onClick:A=>A.stopPropagation()}),z===E.id?e.jsx("input",{autoFocus:!0,className:"dhx dhx-input",style:{height:24,fontSize:12,flex:1},value:I,onChange:A=>f(A.target.value),onBlur:V,onKeyDown:A=>{A.key==="Enter"&&V(),A.key==="Escape"&&C(null)},onClick:A=>A.stopPropagation()}):e.jsx("span",{style:{flex:1},children:E.value}),E.count!==void 0&&e.jsxs("span",{style:{fontSize:11,color:t.textMut},children:["(",E.count,")"]})]}),F&&X&&e.jsx("div",{children:E.items.map(A=>ae(A,P+1))})]},E.id)};return e.jsx("div",{className:"dhx dhx-scroll",style:{overflowY:"auto",...v},onDragOver:h?E=>E.preventDefault():void 0,onDrop:h?E=>{E.preventDefault(),D(null),N(null)}:void 0,children:M.map(E=>ae(E))})}function lt({total:r,pageSize:s=10,page:p,onChange:h,style:x}){const[a,g]=u.useState(p||1),i=Math.ceil(r/s);u.useEffect(j,[]);const v=n=>{const l=Math.min(Math.max(1,n),i);g(l),h==null||h(l)},M=u.useMemo(()=>{const n=[];for(let d=Math.max(1,a-2);d<=Math.min(i,a+2);d++)n.push(d);return n[0]>1&&(n[0]>2&&n.unshift("..."),n.unshift(1)),n[n.length-1]<i&&(n[n.length-1]<i-1&&n.push("..."),n.push(i)),n},[a,i]);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:()=>v(l),children:n},n)),M.map((n,l)=>e.jsx("button",{onClick:()=>typeof n=="number"&&v(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],["»",i]].map(([n,l])=>e.jsx("button",{className:"dhx dhx-btn dhx-btn-ghost",style:{height:30,padding:"0 8px",fontSize:14},disabled:a===i,onClick:()=>v(l),children:n},n))]})}function at({config:r={},defaultValues:s={},onSubmit:p,style:h}){const[x,a]=u.useState(s),[g,i]=u.useState({}),[v,M]=u.useState(null);u.useEffect(j,[]);const n=(o,b)=>{a(S=>({...S,[o]:b})),i(S=>({...S,[o]:null}))},l=()=>{const o={};return(r.rows||[]).flat().forEach(b=>{b&&typeof b=="object"&&"name"in b&&b.required&&!x[b.name]&&(o[b.name]=`${b.label||b.name} is required`)}),i(o),Object.keys(o).length===0},d=o=>{const b=x[o.name]??o.value??"",S=g[o.name],z=o.labelWidth??r.labelWidth,C=z!==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(w=>d(w))]},o.name);if(o.type==="spacer")return e.jsx("div",{style:{height:o.height||16}},o.name);const I=z?{minWidth:z,width:z,flexShrink:0,paddingTop:8,boxSizing:"border-box"}:{},f=o.label?e.jsxs("label",{className:"dhx dhx-label",style:{display:"flex",gap:4,...I},children:[o.label,o.required&&e.jsx("span",{style:{color:t.danger},children:"*"})]},"lbl"):null,k=S?e.jsx("div",{style:{fontSize:11,color:t.danger,marginTop:3},children:S}):null,N=o.helpMessage?e.jsxs("div",{style:{fontSize:11,color:t.textMut,marginTop:3},children:["ⓘ ",o.helpMessage]}):null,c={key:o.name,className:"dhx-form-group"},D=w=>C?e.jsxs("div",{...c,style:{display:"flex",alignItems:"flex-start",gap:8},children:[f,e.jsxs("div",{style:{flex:1,minWidth:0},children:[w,k,N]})]}):e.jsxs("div",{...c,children:[f,w,k,N]});if(!o.type||o.type==="input")return D(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:S?t.danger:void 0},type:o.inputType||"text",placeholder:o.placeholder,value:b,onChange:w=>n(o.name,w.target.value),disabled:o.disabled})]}));if(o.type==="textarea")return D(e.jsx("textarea",{className:"dhx dhx-input",style:{height:80,resize:"vertical",padding:"8px 10px"},placeholder:o.placeholder,value:b,onChange:w=>n(o.name,w.target.value)}));if(o.type==="select")return D(e.jsxs("select",{className:"dhx dhx-input",value:b,onChange:w=>n(o.name,w.target.value),style:{cursor:"pointer"},children:[e.jsx("option",{value:"",children:"— Select —"}),(o.options||[]).map(w=>e.jsx("option",{value:w.value,children:w.label||w.value},w.value))]}));if(o.type==="datepicker")return D(e.jsx("input",{type:"date",className:"dhx dhx-input",value:b,onChange:w=>n(o.name,w.target.value)}));if(o.type==="timepicker"){const w=x[o.name]??{h:12,m:0,ampm:"AM"},B=!!x[o.name],V=B?`${String(w.h).padStart(2,"0")}:${String(w.m).padStart(2,"0")}${w.ampm?" "+w.ampm:""}`:o.placeholder||"Click to select",J=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(v===o.name?null:o.name),children:[e.jsx("span",{style:{color:B?t.text:t.textMut},children:V}),e.jsx("span",{style:{fontSize:13,color:t.textSec},children:"🕐"})]}),v===o.name&&e.jsx("div",{style:{position:"absolute",zIndex:100,top:"calc(100% + 4px)",left:0},children:e.jsx($e,{value:w,controls:!0,onChange:Z=>{n(o.name,Z),M(null)}})})]});return D(J)}if(o.type==="colorpicker")return D(e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[e.jsx("input",{type:"color",value:b||"#000000",onChange:w=>n(o.name,w.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(o.type==="text")return D(e.jsx("p",{style:{margin:"6px 0",fontSize:13,color:t.text},children:o.value}));if(o.type==="checkbox")return e.jsxs("div",{...c,children:[C?e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[z&&e.jsx("div",{style:{width:z,flexShrink:0}}),e.jsxs("label",{style:{display:"flex",alignItems:"center",gap:8,cursor:"pointer"},children:[e.jsx("input",{type:"checkbox",checked:!!b,onChange:w=>n(o.name,w.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:!!b,onChange:w=>n(o.name,w.target.checked),style:{width:16,height:16,accentColor:t.primary,cursor:"pointer"}}),e.jsx("span",{style:{fontSize:13},children:o.label})]}),N]});if(o.type==="radio"){const w=(o.options||[]).map(B=>e.jsxs("label",{style:{display:"flex",alignItems:"center",gap:6,cursor:"pointer",fontSize:13},children:[e.jsx("input",{type:"radio",name:o.name,value:B.value,checked:b===B.value,onChange:()=>n(o.name,B.value),style:{accentColor:t.primary,cursor:"pointer"}}),B.label||B.value]},B.value));return D(e.jsx("div",{style:{display:"flex",gap:16,flexWrap:"wrap",paddingTop:8},children:w}))}if(o.type==="slider")return C?e.jsxs("div",{...c,style:{display:"flex",alignItems:"flex-start",gap:8},children:[f,e.jsxs("div",{style:{flex:1},children:[e.jsx(he,{min:o.min,max:o.max,step:o.step,value:b||o.min,range:o.range,onChange:w=>n(o.name,w)}),N]})]}):e.jsxs("div",{...c,children:[e.jsx(he,{label:o.label,min:o.min,max:o.max,step:o.step,value:b||o.min,range:o.range,onChange:w=>n(o.name,w)}),N]});if(o.type==="combo")return C?e.jsxs("div",{...c,style:{display:"flex",alignItems:"flex-start",gap:8},children:[f,e.jsxs("div",{style:{flex:1},children:[e.jsx(pe,{data:o.data||[],multiselection:o.multiselection,placeholder:o.placeholder||"Select...",value:b||(o.multiselection?[]:null),onChange:w=>n(o.name,w)}),k,N]})]}):e.jsxs("div",{...c,children:[e.jsx(pe,{label:o.label,data:o.data||[],multiselection:o.multiselection,placeholder:o.placeholder||"Select...",value:b||(o.multiselection?[]:null),onChange:w=>n(o.name,w)}),k,N]});if(o.type==="toggle"){const w=!!b,B=w?o.icon:o.offIcon||o.icon,V=w?o.text||o.label:o.offText||o.text||o.label;return e.jsxs("div",{...c,children:[C&&z&&e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[e.jsx("div",{style:{width:z,flexShrink:0}}),e.jsxs("label",{style:{display:"flex",alignItems:"center",gap:8,cursor:"pointer"},children:[e.jsx(Te,{on:w,onClick:()=>n(o.name,!b)}),B&&e.jsx("span",{style:{fontSize:16},children:B}),V&&e.jsx("span",{style:{fontSize:13},children:V})]})]}),!C&&e.jsxs("label",{style:{display:"flex",alignItems:"center",gap:10,cursor:"pointer"},children:[e.jsx(Te,{on:w,onClick:()=>n(o.name,!b)}),B&&e.jsx("span",{style:{fontSize:16},children:B}),V&&e.jsx("span",{style:{fontSize:13},children:V})]}),N]})}return null},y=o=>o.map((b,S)=>Array.isArray(b)?e.jsx("div",{style:{display:"flex",gap:12,alignItems:"flex-start"},children:b.map(d)},S):d(b));return e.jsxs("div",{className:"dhx",style:{padding:r.padding||0,width:r.width||"100%",...h},children:[y(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:()=>l()&&(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),i({})},children:r.resetText||"Reset"})]})]})}function Te({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 be(r){const s=[];for(const p of r)p.type==="block"?s.push(...be(p.items||[])):s.push(p);return s}function it({items:r=[],onAction:s,style:p}){u.useEffect(j,[]);const[h,x]=u.useState(()=>{const l={};for(const d of be(r))d.id&&(l[d.id]=!!d.active);return l}),a=be(r),g=l=>{var d;if(!l.disabled){if(l.id)if(l.group){const y=a.filter(o=>o.group===l.group&&o.id);x(o=>{const b={...o};for(const S of y)b[S.id]=!1;return b[l.id]=!0,b})}else l.twoState&&x(y=>({...y,[l.id]:!y[l.id]}));(d=l.onClick)==null||d.call(l,l),l.id&&(s==null||s(l.id,l))}},i=(l,d)=>{var S;if(l.hidden)return null;const y=l.value??l.text,o=l.size==="auto",b=l.id!==void 0?h[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"}},d):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:z=>{var C;return(C=l.onChange)==null?void 0:C.call(l,z.target.value)}})]})]},d):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:z=>{var C;return(C=l.onChange)==null?void 0:C.call(l,z.target.value)},children:(S=l.items)==null?void 0:S.map(z=>e.jsx("option",{value:z.value,children:z.value},z.value))},d):e.jsxs("button",{title:l.tooltip,disabled:l.disabled,className:"dhx dhx-btn dhx-btn-ghost",style:{flexDirection:o?"column":"row",alignSelf:o?"stretch":"center",justifyContent:"center",minHeight:o?48:26,padding:o?"6px 10px":"0 8px",gap:o?4:5,position:"relative",background:b?t.primaryLt:"transparent",color:b?t.primary:l.disabled?t.textMut:t.text,opacity:l.disabled?.55:1,cursor:l.disabled?"not-allowed":"pointer"},onClick:()=>g(l),children:[l.icon&&e.jsx("span",{style:{fontSize:o?22:15,lineHeight:1,flexShrink:0},children:l.icon}),y&&e.jsx("span",{style:{fontSize:10,maxWidth:o?64:void 0,textAlign:o?"center":"left",lineHeight:1.2,whiteSpace:o?"normal":"nowrap"},children:y}),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})]},d)},v=(l,d)=>{var y;return e.jsx("div",{style:{display:"flex",flexDirection:l.direction==="col"?"column":"row",alignItems:l.direction==="col"?"flex-start":"center",gap:2},children:(y=l.items)==null?void 0:y.map((o,b)=>o.type==="block"?v(o,`${d}-${b}`):i(o,`${d}-${b}`))},d)},M=(l,d)=>{var o;const y=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:(o=l.items)==null?void 0:o.map((b,S)=>b.type==="block"?v(b,S):i(b,S))}),y&&e.jsx("div",{style:{fontSize:10,color:t.textMut,textAlign:"center",padding:"3px 0 4px",marginTop:2,borderTop:`1px solid ${t.border}`},children:y})]},d)},n=(l,d)=>l.type==="block"?M(l,d):i(l,d);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 Le({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:s=[],vertical:p=!1,onAction:h,style:x}){const[a,g]=u.useState(null),[i,v]=u.useState(()=>{const d={};return s.forEach(y=>{y.id&&y.twoState&&y.active&&(d[y.id]=!0)}),d}),M=u.useRef(null);u.useEffect(j,[]),U(M,u.useCallback(()=>g(null),[]));const n=(d,y)=>{var o,b;if(!d.disabled){if(d.twoState&&d.id&&v(S=>({...S,[d.id]:!S[d.id]})),(o=d.items)!=null&&o.length){g(S=>S===y?null:y);return}(b=d.onClick)==null||b.call(d,d.id||""),h==null||h(d.id||"")}},l=(d,y)=>{var z;if(d.hidden)return null;if(d.type==="separator")return e.jsx("div",{style:{[p?"height":"width"]:1,background:t.border,margin:p?"4px 8px":"0 6px",alignSelf:"stretch"}},y);if(d.type==="spacer")return e.jsx("div",{style:{flex:1}},y);if(d.type==="input")return e.jsxs("div",{style:{position:"relative",display:"flex",alignItems:"center",margin:"0 4px"},children:[d.icon&&e.jsx("span",{style:{position:"absolute",left:8,color:t.textMut,fontSize:15,pointerEvents:"none",zIndex:1},children:d.icon}),e.jsx("input",{className:"dhx dhx-input",style:{width:d.width||200,height:28,paddingLeft:d.icon?30:void 0},placeholder:d.placeholder,onChange:C=>{var I;return(I=d.onChange)==null?void 0:I.call(d,C.target.value)}})]},y);if(d.type==="imageButton")return e.jsxs("button",{title:d.tooltip,disabled:d.disabled,style:{position:"relative",width:36,height:36,padding:2,border:"none",borderRadius:"50%",overflow:"hidden",cursor:d.disabled?"not-allowed":"pointer",background:"transparent",flexShrink:0},onClick:()=>n(d,y),children:[d.src&&e.jsx("img",{src:d.src,alt:d.value||"",style:{width:"100%",height:"100%",objectFit:"cover",borderRadius:"50%"}}),d.count!==void 0&&e.jsx(Le,{count:d.count})]},y);const o=!!(d.twoState&&d.id&&i[d.id]),b=!!((z=d.items)!=null&&z.length),S={position:"relative",height:p?40:36,gap:6,background:o?t.primaryLt:"transparent",color:o?t.primary:d.disabled?t.textMut:t.text,opacity:d.disabled?.55:1,cursor:d.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:d.tooltip,disabled:d.disabled,style:S,onClick:()=>n(d,y),children:[d.icon&&e.jsx("span",{style:{fontSize:16,flexShrink:0},children:d.icon}),d.value&&e.jsx("span",{style:{fontSize:13},children:d.value}),b&&e.jsx("span",{style:{fontSize:9,opacity:.55,marginLeft:2},children:"▼"}),d.count!==void 0&&e.jsx(Le,{count:d.count})]}),b&&a===y&&e.jsx(R,{items:d.items,onSelect:()=>g(null),style:p?{left:"100%",top:0}:{top:"100%"}})]},y)};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)]})}W.Button=We,W.Calendar=_e,W.Chart=Ke,W.Colorpicker=Je,W.Combobox=pe,W.ContextMenu=Be,W.DataView=rt,W.Form=at,W.Grid=Fe,W.Layout=ze,W.List=tt,W.Menu=Ae,W.MenuDropdown=R,W.MessageContext=ue,W.MessageProvider=Re,W.Navbar=dt,W.Pagination=lt,W.Popup=Ue,W.Ribbon=it,W.Sidebar=Pe,W.Slider=he,W.Tabbar=Oe,W.Timepicker=$e,W.Toolbar=He,W.Tree=st,W.Window=Qe,W.tokens=t,W.useClickOutside=U,W.useDrag=me,W.useMessage=et,Object.defineProperty(W,Symbol.toStringTag,{value:"Module"})});
42
42
  //# sourceMappingURL=dhx-react-suite.umd.cjs.map