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