dhx-react-suite 1.0.1 → 1.0.3

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