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