@superdangerous/app-framework 4.16.11 → 4.16.12
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/package.json +1 -1
- package/ui/dist/index.js +1 -1
- package/ui/dist/index.js.map +1 -1
- package/ui/dist/index.mjs +1 -1
- package/ui/dist/index.mjs.map +1 -1
package/ui/dist/index.mjs
CHANGED
|
@@ -51,7 +51,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
51
51
|
`))})}function w4(e){var t=e.codeString,r=e.codeStyle,n=e.containerStyle,o=n===void 0?{float:"left",paddingRight:"10px"}:n,a=e.numberStyle,i=a===void 0?{}:a,s=e.startingLineNumber;return ur__default.createElement("code",{style:Object.assign({},r,o)},E4({lines:t.replace(/\n$/,"").split(`
|
|
52
52
|
`),style:i,startingLineNumber:s}))}function x4(e){return "".concat(e.toString().length,".25em")}function sk(e,t){return {type:"element",tagName:"span",properties:{key:"line-number--".concat(e),className:["comment","linenumber","react-syntax-highlighter-line-number"],style:t},children:[{type:"text",value:e}]}}function lk(e,t,r){var n={display:"inline-block",minWidth:x4(r),paddingRight:"1em",textAlign:"right",userSelect:"none"},o=typeof e=="function"?e(t):e,a=Ur(Ur({},n),o);return a}function bi(e){var t=e.children,r=e.lineNumber,n=e.lineNumberStyle,o=e.largestLineNumber,a=e.showInlineLineNumbers,i=e.lineProps,s=i===void 0?{}:i,l=e.className,c=l===void 0?[]:l,d=e.showLineNumbers,u=e.wrapLongLines,g=e.wrapLines,p=g===void 0?false:g,f=p?Ur({},typeof s=="function"?s(r):s):{};if(f.className=f.className?[].concat(pi(f.className.trim().split(/\s+/)),pi(c)):c,r&&a){var m=lk(n,r,o);t.unshift(sk(r,m));}return u&d&&(f.style=Ur({display:"flex"},f.style)),{type:"element",tagName:"span",properties:f,children:t}}function ck(e){for(var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:[],n=0;n<e.length;n++){var o=e[n];if(o.type==="text")r.push(bi({children:[o],className:pi(new Set(t))}));else if(o.children){var a=t.concat(o.properties.className);ck(o.children,a).forEach(function(i){return r.push(i)});}}return r}function v4(e,t,r,n,o,a,i,s,l){var c,d=ck(e.value),u=[],g=-1,p=0;function f(C,k){var D=arguments.length>2&&arguments[2]!==void 0?arguments[2]:[];return bi({children:C,lineNumber:k,lineNumberStyle:s,largestLineNumber:i,showInlineLineNumbers:o,lineProps:r,className:D,showLineNumbers:n,wrapLongLines:l,wrapLines:t})}function m(C,k){if(n&&k&&o){var D=lk(s,k,i);C.unshift(sk(k,D));}return C}function b(C,k){var D=arguments.length>2&&arguments[2]!==void 0?arguments[2]:[];return t||D.length>0?f(C,k,D):m(C,k)}for(var h=function(){var k=d[p],D=k.children[0].value,P=k4(D);if(P){var A=D.split(`
|
|
53
53
|
`);A.forEach(function(v,G){var _=n&&u.length+a,M={type:"text",value:"".concat(v,`
|
|
54
|
-
`)};if(G===0){var O=d.slice(g+1,p).concat(bi({children:[M],className:k.properties.className})),B=b(O,_);u.push(B);}else if(G===A.length-1){var W=d[p+1]&&d[p+1].children&&d[p+1].children[0],V={type:"text",value:"".concat(v)};if(W){var re=bi({children:[V],className:k.properties.className});d.splice(p+1,0,re);}else {var Z=[V],x=b(Z,_,k.properties.className);u.push(x);}}else {var z=[M],Q=b(z,_,k.properties.className);u.push(Q);}}),g=p;}p++;};p<d.length;)h();if(g!==d.length-1){var S=d.slice(g+1,d.length);if(S&&S.length){var w=n&&u.length+a,N=b(S,w);u.push(N);}}return t?u:(c=[]).concat.apply(c,u)}function T4(e){var t=e.rows,r=e.stylesheet,n=e.useInlineStyles;return t.map(function(o,a){return fi({node:o,stylesheet:r,useInlineStyles:n,key:"code-segment-".concat(a)})})}function uk(e){return e&&typeof e.highlightAuto<"u"}function A4(e){var t=e.astGenerator,r=e.language,n=e.code,o=e.defaultCodeValue;if(uk(t)){var a=ak(t,r);return r==="text"?{value:o,language:"text"}:a?t.highlight(r,n):t.highlightAuto(n)}try{return r&&r!=="text"?{value:t.highlight(n,r)}:{value:o}}catch{return {value:o}}}function dk(e,t){return function(n){var o,a,i=n.language,s=n.children,l=n.style,c=l===void 0?t:l,d=n.customStyle,u=d===void 0?{}:d,g=n.codeTagProps,p=g===void 0?{className:i?"language-".concat(i):void 0,style:Ur(Ur({},c['code[class*="language-"]']),c['code[class*="language-'.concat(i,'"]')])}:g,f=n.useInlineStyles,m=f===void 0?true:f,b=n.showLineNumbers,h=b===void 0?false:b,S=n.showInlineLineNumbers,w=S===void 0?true:S,N=n.startingLineNumber,C=N===void 0?1:N,k=n.lineNumberContainerStyle,D=n.lineNumberStyle,P=D===void 0?{}:D,A=n.wrapLines,v=n.wrapLongLines,G=v===void 0?false:v,_=n.lineProps,M=_===void 0?{}:_,O=n.renderer,B=n.PreTag,W=B===void 0?"pre":B,V=n.CodeTag,re=V===void 0?"code":V,Z=n.code,x=Z===void 0?(Array.isArray(s)?s[0]:s)||"":Z,z=n.astGenerator,Q=XS(n,y4);z=z||e;var T=h?ur__default.createElement(w4,{containerStyle:k,codeStyle:p.style||{},numberStyle:P,startingLineNumber:C,codeString:x}):null,ye=c.hljs||c['pre[class*="language-"]']||{backgroundColor:"#fff"},_e=uk(z)?"hljs":"prismjs",Pe=m?Object.assign({},Q,{style:Object.assign({},ye,u)}):Object.assign({},Q,{className:Q.className?"".concat(_e," ").concat(Q.className):_e,style:Object.assign({},u)});if(G?p.style=Ur({whiteSpace:"pre-wrap"},p.style):p.style=Ur({whiteSpace:"pre"},p.style),!z)return ur__default.createElement(W,Pe,T,ur__default.createElement(re,p,x));(A===void 0&&O||G)&&(A=true),O=O||T4;var Ue=[{type:"text",value:x}],Se=A4({astGenerator:z,language:i,code:x,defaultCodeValue:Ue});Se.language===null&&(Se.value=Ue);var at=(o=(a=x.match(/\n/g))===null||a===void 0?void 0:a.length)!==null&&o!==void 0?o:0,xe=C+at,Qe=v4(Se,A,M,h,w,C,xe,P,G);return ur__default.createElement(W,Pe,ur__default.createElement(re,p,!w&&T,O({rows:Qe,stylesheet:c,useInlineStyles:m})))}}var pk=["abap","abnf","actionscript","ada","agda","al","antlr4","apacheconf","apex","apl","applescript","aql","arduino","arff","asciidoc","asm6502","asmatmel","aspnet","autohotkey","autoit","avisynth","avro-idl","bash","basic","batch","bbcode","bicep","birb","bison","bnf","brainfuck","brightscript","bro","bsl","c","cfscript","chaiscript","cil","clike","clojure","cmake","cobol","coffeescript","concurnas","coq","cpp","crystal","csharp","cshtml","csp","css-extras","css","csv","cypher","d","dart","dataweave","dax","dhall","diff","django","dns-zone-file","docker","dot","ebnf","editorconfig","eiffel","ejs","elixir","elm","erb","erlang","etlua","excel-formula","factor","false","firestore-security-rules","flow","fortran","fsharp","ftl","gap","gcode","gdscript","gedcom","gherkin","git","glsl","gml","gn","go-module","go","graphql","groovy","haml","handlebars","haskell","haxe","hcl","hlsl","hoon","hpkp","hsts","http","ichigojam","icon","icu-message-format","idris","iecst","ignore","inform7","ini","io","j","java","javadoc","javadoclike","javascript","javastacktrace","jexl","jolie","jq","js-extras","js-templates","jsdoc","json","json5","jsonp","jsstacktrace","jsx","julia","keepalived","keyman","kotlin","kumir","kusto","latex","latte","less","lilypond","liquid","lisp","livescript","llvm","log","lolcode","lua","magma","makefile","markdown","markup-templating","markup","matlab","maxscript","mel","mermaid","mizar","mongodb","monkey","moonscript","n1ql","n4js","nand2tetris-hdl","naniscript","nasm","neon","nevod","nginx","nim","nix","nsis","objectivec","ocaml","opencl","openqasm","oz","parigp","parser","pascal","pascaligo","pcaxis","peoplecode","perl","php-extras","php","phpdoc","plsql","powerquery","powershell","processing","prolog","promql","properties","protobuf","psl","pug","puppet","pure","purebasic","purescript","python","q","qml","qore","qsharp","r","racket","reason","regex","rego","renpy","rest","rip","roboconf","robotframework","ruby","rust","sas","sass","scala","scheme","scss","shell-session","smali","smalltalk","smarty","sml","solidity","solution-file","soy","sparql","splunk-spl","sqf","sql","squirrel","stan","stylus","swift","systemd","t4-cs","t4-templating","t4-vb","tap","tcl","textile","toml","tremor","tsx","tt2","turtle","twig","typescript","typoscript","unrealscript","uorazor","uri","v","vala","vbnet","velocity","verilog","vhdl","vim","visual-basic","warpscript","wasm","web-idl","wiki","wolfram","wren","xeora","xml-doc","xojo","xquery","yaml","yang","zig"];var QE={'code[class*="language-"]':{color:"black",background:"none",textShadow:"0 1px white",fontFamily:"Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace",fontSize:"1em",textAlign:"left",whiteSpace:"pre",wordSpacing:"normal",wordBreak:"normal",wordWrap:"normal",lineHeight:"1.5",MozTabSize:"4",OTabSize:"4",tabSize:"4",WebkitHyphens:"none",MozHyphens:"none",msHyphens:"none",hyphens:"none"},'pre[class*="language-"]':{color:"black",background:"#f5f2f0",textShadow:"0 1px white",fontFamily:"Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace",fontSize:"1em",textAlign:"left",whiteSpace:"pre",wordSpacing:"normal",wordBreak:"normal",wordWrap:"normal",lineHeight:"1.5",MozTabSize:"4",OTabSize:"4",tabSize:"4",WebkitHyphens:"none",MozHyphens:"none",msHyphens:"none",hyphens:"none",padding:"1em",margin:".5em 0",overflow:"auto"},'pre[class*="language-"]::-moz-selection':{textShadow:"none",background:"#b3d4fc"},'pre[class*="language-"] ::-moz-selection':{textShadow:"none",background:"#b3d4fc"},'code[class*="language-"]::-moz-selection':{textShadow:"none",background:"#b3d4fc"},'code[class*="language-"] ::-moz-selection':{textShadow:"none",background:"#b3d4fc"},'pre[class*="language-"]::selection':{textShadow:"none",background:"#b3d4fc"},'pre[class*="language-"] ::selection':{textShadow:"none",background:"#b3d4fc"},'code[class*="language-"]::selection':{textShadow:"none",background:"#b3d4fc"},'code[class*="language-"] ::selection':{textShadow:"none",background:"#b3d4fc"},':not(pre) > code[class*="language-"]':{background:"#f5f2f0",padding:".1em",borderRadius:".3em",whiteSpace:"normal"},comment:{color:"slategray"},prolog:{color:"slategray"},doctype:{color:"slategray"},cdata:{color:"slategray"},punctuation:{color:"#999"},namespace:{Opacity:".7"},property:{color:"#905"},tag:{color:"#905"},boolean:{color:"#905"},number:{color:"#905"},constant:{color:"#905"},symbol:{color:"#905"},deleted:{color:"#905"},selector:{color:"#690"},"attr-name":{color:"#690"},string:{color:"#690"},char:{color:"#690"},builtin:{color:"#690"},inserted:{color:"#690"},operator:{color:"#9a6e3a",background:"hsla(0, 0%, 100%, .5)"},entity:{color:"#9a6e3a",background:"hsla(0, 0%, 100%, .5)",cursor:"help"},url:{color:"#9a6e3a",background:"hsla(0, 0%, 100%, .5)"},".language-css .token.string":{color:"#9a6e3a",background:"hsla(0, 0%, 100%, .5)"},".style .token.string":{color:"#9a6e3a",background:"hsla(0, 0%, 100%, .5)"},atrule:{color:"#07a"},"attr-value":{color:"#07a"},keyword:{color:"#07a"},function:{color:"#DD4A68"},"class-name":{color:"#DD4A68"},regex:{color:"#e90"},important:{color:"#e90",fontWeight:"bold"},variable:{color:"#e90"},bold:{fontWeight:"bold"},italic:{fontStyle:"italic"}};var UI=ea(zI());var HI=dk(UI.default,QE);HI.supportedLanguages=pk;var Ho=HI;var D_=ea(L_());function _f({content:e,className:t,showCopyButton:r=true}){let[n,o]=useState(null),a=s=>{navigator.clipboard.writeText(s),o(s),setTimeout(()=>o(null),2e3);},i=useMemo(()=>({code({node:s,inline:l,className:c,children:d,...u}){let g=/language-(\w+)/.exec(c||""),p=String(d).replace(/\n$/,"");return !l&&g?jsxs("div",{className:"relative group",children:[jsx(Ho,{style:D_.oneDark,language:g[1],PreTag:"div",className:"!rounded-md !my-4",...u,children:p}),r&&jsx(Y,{size:"sm",variant:"ghost",className:"absolute top-2 right-2 opacity-0 group-hover:opacity-100 transition-opacity",onClick:()=>a(p),children:n===p?jsx(Check,{className:"h-4 w-4"}):jsx(Copy,{className:"h-4 w-4"})})]}):jsx("code",{className:"px-1.5 py-0.5 rounded bg-muted text-sm font-mono",...u,children:d})},pre({children:s}){return jsx(Fragment,{children:s})},h1:({children:s})=>jsx("h1",{className:"text-2xl font-bold mt-6 mb-4",children:s}),h2:({children:s})=>jsx("h2",{className:"text-xl font-semibold mt-5 mb-3",children:s}),h3:({children:s})=>jsx("h3",{className:"text-lg font-semibold mt-4 mb-2",children:s}),p:({children:s})=>jsx("p",{className:"mb-4 leading-relaxed",children:s}),ul:({children:s})=>jsx("ul",{className:"list-disc list-inside mb-4 space-y-1",children:s}),ol:({children:s})=>jsx("ol",{className:"list-decimal list-inside mb-4 space-y-1",children:s}),blockquote:({children:s})=>jsx("blockquote",{className:"border-l-4 border-muted-foreground/30 pl-4 my-4 italic",children:s}),a:({href:s,children:l})=>jsx("a",{href:s,target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline",children:l}),table:({children:s})=>jsx("div",{className:"overflow-x-auto my-4",children:jsx("table",{className:"min-w-full divide-y divide-border",children:s})}),th:({children:s})=>jsx("th",{className:"px-4 py-2 text-left font-medium",children:s}),td:({children:s})=>jsx("td",{className:"px-4 py-2 border-t",children:s})}),[n,r]);return jsx("div",{className:he("prose prose-sm dark:prose-invert max-w-none",t),children:jsx(uc,{remarkPlugins:[di],components:i,children:e})})}function yz({content:e,className:t,title:r,...n}){return jsxs(Ne,{className:he("p-6",t),children:[r&&jsx("h2",{className:"text-xl font-semibold mb-4",children:r}),jsx(_f,{content:e,...n})]})}function Sz({content:e,className:t,height:r="400px",...n}){return jsx(js,{className:he("w-full",t),style:{height:r},children:jsx("div",{className:"pr-4",children:jsx(_f,{content:e,...n})})})}function Tz({children:e,className:t,maxWidth:r,tooltipSide:n="top"}){let o=useRef(null),[a,i]=useState(false),s=useCallback(()=>{o.current&&i(o.current.scrollWidth>o.current.clientWidth);},[]);useEffect(()=>{let c=o.current;if(!c)return;s();let d=new ResizeObserver(()=>{requestAnimationFrame(s);});return d.observe(c),()=>{d.disconnect();}},[s,e]);let l=r?{maxWidth:r}:void 0;return jsxs(ia,{children:[jsx(sa,{asChild:true,disabled:!a,children:jsx("span",{ref:o,className:R("truncate block",a&&"cursor-help",t),style:l,children:e})}),a&&jsx(io,{side:n,className:"max-w-md break-words",children:e})]})}var xr=[{hex:"#3b82f6",name:"Blue"},{hex:"#6366f1",name:"Indigo"},{hex:"#8b5cf6",name:"Violet"},{hex:"#a855f7",name:"Purple"},{hex:"#d946ef",name:"Fuchsia"},{hex:"#ec4899",name:"Pink"},{hex:"#f43f5e",name:"Rose"},{hex:"#ef4444",name:"Red"},{hex:"#f97316",name:"Orange"},{hex:"#f59e0b",name:"Amber"},{hex:"#eab308",name:"Yellow"},{hex:"#84cc16",name:"Lime"},{hex:"#22c55e",name:"Green"},{hex:"#10b981",name:"Emerald"},{hex:"#14b8a6",name:"Teal"},{hex:"#06b6d4",name:"Cyan"},{hex:"#0ea5e9",name:"Sky"},{hex:"#64748b",name:"Slate"},{hex:"#78716c",name:"Stone"},{hex:"#737373",name:"Gray"}];function Nz({value:e,onChange:t,columns:r=10,className:n}){return jsx("div",{className:R("flex flex-wrap gap-1.5",n),style:{maxWidth:r*28+(r-1)*6},children:xr.map(o=>{let a=e.toLowerCase()===o.hex.toLowerCase();return jsx("button",{type:"button",onClick:()=>t(o.hex),className:R("w-6 h-6 rounded-md transition-all focus:outline-none flex items-center justify-center","hover:brightness-110",a&&"ring-2 ring-foreground/70"),style:{backgroundColor:o.hex},title:o.name,children:a&&jsx(Check,{className:"h-3.5 w-3.5 text-white drop-shadow-[0_1px_1px_rgba(0,0,0,0.5)]"})},o.hex)})})}function Rz(){let e=Math.floor(Math.random()*xr.length);return xr[e].hex}function Iz(e){let r=(xr.findIndex(n=>n.hex===e)+1)%xr.length;return xr[r].hex}function _z(e){let t=new Set(e.map(n=>n.toLowerCase()));for(let n of xr)if(!t.has(n.hex.toLowerCase()))return n.hex;let r=xr.map(n=>({hex:n.hex,count:e.filter(o=>o.toLowerCase()===n.hex.toLowerCase()).length}));return r.sort((n,o)=>n.count-o.count),r[0].hex}function Fz({open:e,onOpenChange:t,title:r,children:n,footer:o,defaultWidth:a=800,defaultHeight:i=600,minWidth:s=400,minHeight:l=300,className:c,onFullscreenChange:d}){let[u,g]=useState(false),[p,f]=useState({x:0,y:0}),[m,b]=useState(()=>({width:Math.min(a,typeof window<"u"?window.innerWidth-32:a),height:Math.min(i,typeof window<"u"?window.innerHeight-32:i)})),[h,S]=useState(false),w=useRef(null),N=useRef({type:null,direction:null,startMouseX:0,startMouseY:0,startPosX:0,startPosY:0,startWidth:0,startHeight:0});useEffect(()=>{if(e&&!u){let A=Math.min(a,window.innerWidth-32),v=Math.min(i,window.innerHeight-32);b({width:A,height:v});let G=(window.innerWidth-A)/2,_=(window.innerHeight-v)/2;f({x:G,y:Math.max(16,_)});}},[e,u,a,i]);let C=useCallback(A=>{u||!w.current||(A.preventDefault(),N.current={type:"drag",direction:null,startMouseX:A.clientX,startMouseY:A.clientY,startPosX:p.x,startPosY:p.y,startWidth:m.width,startHeight:m.height},S(true),document.body.style.cursor="grabbing",document.body.style.userSelect="none");},[u,p,m]),k=useCallback((A,v)=>{u||!w.current||(A.preventDefault(),A.stopPropagation(),N.current={type:"resize",direction:v,startMouseX:A.clientX,startMouseY:A.clientY,startPosX:p.x,startPosY:p.y,startWidth:m.width,startHeight:m.height},S(true),document.body.style.userSelect="none");},[u,p,m]);useEffect(()=>{if(!h)return;let A=G=>{let _=N.current,M=w.current;if(!_.type||!M)return;let O=G.clientX-_.startMouseX,B=G.clientY-_.startMouseY;if(_.type==="drag"){let W=_.startPosX+O,V=Math.max(0,_.startPosY+B);M.style.left=`${W}px`,M.style.top=`${V}px`;}else if(_.type==="resize"&&_.direction){let W=_.startWidth,V=_.startHeight,re=_.startPosX,Z=_.startPosY;if(_.direction.includes("e")&&(W=Math.max(s,_.startWidth+O)),_.direction.includes("w")){let x=Math.min(O,_.startWidth-s);W=_.startWidth-x,re=_.startPosX+x;}if(_.direction.includes("s")&&(V=Math.max(l,_.startHeight+B)),_.direction.includes("n")){let x=Math.min(B,_.startHeight-l);V=_.startHeight-x,Z=Math.max(0,_.startPosY+x);}M.style.width=`${W}px`,M.style.height=`${V}px`,M.style.left=`${re}px`,M.style.top=`${Z}px`;}},v=()=>{let G=N.current,_=w.current;if(_&&G.type){let M=_.getBoundingClientRect();f({x:M.left,y:M.top}),b({width:M.width,height:M.height});}N.current.type=null,N.current.direction=null,S(false),document.body.style.cursor="",document.body.style.userSelect="";};return document.addEventListener("mousemove",A),document.addEventListener("mouseup",v),()=>{document.removeEventListener("mousemove",A),document.removeEventListener("mouseup",v);}},[h,s,l]);let D=useCallback(()=>{g(A=>{let v=!A;return d?.(v),v});},[d]),P=useMemo(()=>u?{position:"fixed",top:0,left:0,width:"100vw",height:"100vh",maxWidth:"100vw",maxHeight:"100vh",borderRadius:0,transform:"none"}:{position:"fixed",top:p.y,left:p.x,width:m.width,height:m.height,maxWidth:"none",maxHeight:"none",transform:"none",willChange:h?"left, top, width, height":"auto"},[u,p.x,p.y,m.width,m.height,h]);return jsx(Tn,{open:e,onOpenChange:t,children:jsxs(Yr,{ref:w,style:P,hideCloseButton:true,className:R("flex flex-col p-0 gap-0",h&&"transition-none duration-0 [&_*]:transition-none",u?"rounded-none":"rounded-lg",c),children:[jsxs("div",{className:R("flex items-center gap-2 px-4 py-3 border-b bg-muted/30 flex-shrink-0",!u&&"cursor-grab active:cursor-grabbing"),onMouseDown:C,children:[!u&&jsx(GripVertical,{className:"h-4 w-4 text-muted-foreground flex-shrink-0"}),jsx("div",{className:"flex-1 min-w-0",children:r&&jsx(Kr,{className:"p-0 space-y-0",children:jsx(Xr,{className:"text-base font-semibold leading-tight truncate",children:r})})}),jsxs("div",{className:"flex items-center gap-1 flex-shrink-0",children:[jsx(Y,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0",onClick:D,children:u?jsx(Minimize2,{className:"h-4 w-4"}):jsx(Maximize2,{className:"h-4 w-4"})}),jsx(Y,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0",onClick:()=>t(false),children:jsx(X,{className:"h-4 w-4"})})]})]}),jsx("div",{className:"flex-1 overflow-y-auto p-4",children:typeof n=="function"?n({isFullscreen:u}):n}),o&&jsx(Xn,{className:"px-4 py-3 border-t bg-muted/30 flex-shrink-0",children:o}),!u&&jsxs(Fragment,{children:[jsx("div",{className:"absolute top-0 left-2 right-2 h-1 cursor-n-resize",onMouseDown:A=>k(A,"n")}),jsx("div",{className:"absolute bottom-0 left-2 right-2 h-1 cursor-s-resize",onMouseDown:A=>k(A,"s")}),jsx("div",{className:"absolute left-0 top-2 bottom-2 w-1 cursor-w-resize",onMouseDown:A=>k(A,"w")}),jsx("div",{className:"absolute right-0 top-2 bottom-2 w-1 cursor-e-resize",onMouseDown:A=>k(A,"e")}),jsx("div",{className:"absolute top-0 left-0 w-3 h-3 cursor-nw-resize",onMouseDown:A=>k(A,"nw")}),jsx("div",{className:"absolute top-0 right-0 w-3 h-3 cursor-ne-resize",onMouseDown:A=>k(A,"ne")}),jsx("div",{className:"absolute bottom-0 left-0 w-3 h-3 cursor-sw-resize",onMouseDown:A=>k(A,"sw")}),jsx("div",{className:"absolute bottom-0 right-0 w-3 h-3 cursor-se-resize",onMouseDown:A=>k(A,"se")})]})]})})}function B_({position:e,onClose:t,children:r,className:n}){let o=useRef(null),[a,i]=useState(e);useLayoutEffect(()=>{if(!o.current)return;let c=o.current.getBoundingClientRect(),d=window.innerWidth,u=window.innerHeight,g=8,p=e.x,f=e.y;e.x+c.width>d-g&&(p=Math.max(g,d-c.width-g)),e.y+c.height>u-g&&(f=Math.max(g,u-c.height-g)),p<g&&(p=g),f<g&&(f=g),(p!==e.x||f!==e.y)&&i({x:p,y:f});},[e]),useEffect(()=>{let l=()=>t(),c=()=>t();return document.addEventListener("click",l),document.addEventListener("scroll",c,true),()=>{document.removeEventListener("click",l),document.removeEventListener("scroll",c,true);}},[t]);let s=useCallback(l=>{l.stopPropagation();},[]);return jsx("div",{ref:o,role:"menu","aria-label":"Context menu",className:R("fixed z-50 min-w-[180px] rounded-md border bg-popover p-1 text-popover-foreground shadow-md animate-in fade-in-0 zoom-in-95",n),style:{top:a.y,left:a.x},onClick:s,children:r})}var Wz={default:"hover:bg-accent hover:text-accent-foreground",success:"text-green-600 hover:bg-green-50 hover:text-green-700:bg-green-950",warning:"text-amber-600 hover:bg-amber-50 hover:text-amber-700:bg-amber-950",destructive:"text-destructive hover:bg-destructive hover:text-destructive-foreground",purple:"text-purple-600 hover:bg-purple-50 hover:text-purple-700:bg-purple-950"};function z_({onClick:e,onMouseEnter:t,icon:r,children:n,variant:o="default",disabled:a=false,className:i}){return jsxs("button",{role:"menuitem",onClick:e,onMouseEnter:t,disabled:a,"aria-disabled":a,className:R("relative flex w-full cursor-pointer select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none",Wz[o],a&&"opacity-50 cursor-not-allowed",i),children:[r&&jsx("span",{className:"mr-2 h-4 w-4 flex items-center justify-center","aria-hidden":"true",children:r}),n]})}function U_(){return jsx("div",{role:"separator",className:"h-px bg-border my-1"})}function G_({label:e,icon:t,children:r,onOpen:n,isOpen:o,onOpenChange:a,className:i}){let[s,l]=useState(false),c=o!==void 0,d=c?o:s,u=()=>{c?a?.(true):l(true),n?.();},g=()=>{c?a?.(false):l(false);};return jsxs("div",{className:R("relative",i),onMouseEnter:u,onMouseLeave:g,children:[jsxs("button",{role:"menuitem","aria-haspopup":"menu","aria-expanded":d,className:"relative flex w-full cursor-pointer select-none items-center justify-between rounded-sm px-2 py-1.5 text-sm outline-none hover:bg-accent hover:text-accent-foreground",children:[jsxs("span",{className:"flex items-center",children:[t&&jsx("span",{className:"mr-2 h-4 w-4 flex items-center justify-center","aria-hidden":"true",children:t}),e]}),jsx(ChevronRight,{className:"h-4 w-4","aria-hidden":"true"})]}),d&&jsx("div",{role:"menu","aria-label":`${e} submenu`,className:"absolute left-full top-0 ml-1 min-w-[160px] max-h-[300px] overflow-y-auto rounded-md border bg-popover p-1 text-popover-foreground shadow-md",children:r})]})}var Ff={'code[class*="language-"]':{background:"hsl(220, 13%, 18%)",color:"hsl(220, 14%, 71%)",textShadow:"0 1px rgba(0, 0, 0, 0.3)",fontFamily:'"Fira Code", "Fira Mono", Menlo, Consolas, "DejaVu Sans Mono", monospace',direction:"ltr",textAlign:"left",whiteSpace:"pre",wordSpacing:"normal",wordBreak:"normal",lineHeight:"1.5",MozTabSize:"2",OTabSize:"2",tabSize:"2",WebkitHyphens:"none",MozHyphens:"none",msHyphens:"none",hyphens:"none"},'pre[class*="language-"]':{background:"hsl(220, 13%, 18%)",color:"hsl(220, 14%, 71%)",textShadow:"0 1px rgba(0, 0, 0, 0.3)",fontFamily:'"Fira Code", "Fira Mono", Menlo, Consolas, "DejaVu Sans Mono", monospace',direction:"ltr",textAlign:"left",whiteSpace:"pre",wordSpacing:"normal",wordBreak:"normal",lineHeight:"1.5",MozTabSize:"2",OTabSize:"2",tabSize:"2",WebkitHyphens:"none",MozHyphens:"none",msHyphens:"none",hyphens:"none",padding:"1em",margin:"0.5em 0",overflow:"auto",borderRadius:"0.3em"},'code[class*="language-"]::-moz-selection':{background:"hsl(220, 13%, 28%)",color:"inherit",textShadow:"none"},'code[class*="language-"] *::-moz-selection':{background:"hsl(220, 13%, 28%)",color:"inherit",textShadow:"none"},'pre[class*="language-"] *::-moz-selection':{background:"hsl(220, 13%, 28%)",color:"inherit",textShadow:"none"},'code[class*="language-"]::selection':{background:"hsl(220, 13%, 28%)",color:"inherit",textShadow:"none"},'code[class*="language-"] *::selection':{background:"hsl(220, 13%, 28%)",color:"inherit",textShadow:"none"},'pre[class*="language-"] *::selection':{background:"hsl(220, 13%, 28%)",color:"inherit",textShadow:"none"},':not(pre) > code[class*="language-"]':{padding:"0.2em 0.3em",borderRadius:"0.3em",whiteSpace:"normal"},comment:{color:"hsl(220, 10%, 40%)",fontStyle:"italic"},prolog:{color:"hsl(220, 10%, 40%)"},cdata:{color:"hsl(220, 10%, 40%)"},doctype:{color:"hsl(220, 14%, 71%)"},punctuation:{color:"hsl(220, 14%, 71%)"},entity:{color:"hsl(220, 14%, 71%)",cursor:"help"},"attr-name":{color:"hsl(29, 54%, 61%)"},"class-name":{color:"hsl(29, 54%, 61%)"},boolean:{color:"hsl(29, 54%, 61%)"},constant:{color:"hsl(29, 54%, 61%)"},number:{color:"hsl(29, 54%, 61%)"},atrule:{color:"hsl(29, 54%, 61%)"},keyword:{color:"hsl(286, 60%, 67%)"},property:{color:"hsl(355, 65%, 65%)"},tag:{color:"hsl(355, 65%, 65%)"},symbol:{color:"hsl(355, 65%, 65%)"},deleted:{color:"hsl(355, 65%, 65%)"},important:{color:"hsl(355, 65%, 65%)"},selector:{color:"hsl(95, 38%, 62%)"},string:{color:"hsl(95, 38%, 62%)"},char:{color:"hsl(95, 38%, 62%)"},builtin:{color:"hsl(95, 38%, 62%)"},inserted:{color:"hsl(95, 38%, 62%)"},regex:{color:"hsl(95, 38%, 62%)"},"attr-value":{color:"hsl(95, 38%, 62%)"},"attr-value > .token.punctuation":{color:"hsl(95, 38%, 62%)"},variable:{color:"hsl(207, 82%, 66%)"},operator:{color:"hsl(207, 82%, 66%)"},function:{color:"hsl(207, 82%, 66%)"},url:{color:"hsl(187, 47%, 55%)"},"attr-value > .token.punctuation.attr-equals":{color:"hsl(220, 14%, 71%)"},"special-attr > .token.attr-value > .token.value.css":{color:"hsl(220, 14%, 71%)"},".language-css .token.selector":{color:"hsl(355, 65%, 65%)"},".language-css .token.property":{color:"hsl(220, 14%, 71%)"},".language-css .token.function":{color:"hsl(187, 47%, 55%)"},".language-css .token.url > .token.function":{color:"hsl(187, 47%, 55%)"},".language-css .token.url > .token.string.url":{color:"hsl(95, 38%, 62%)"},".language-css .token.important":{color:"hsl(286, 60%, 67%)"},".language-css .token.atrule .token.rule":{color:"hsl(286, 60%, 67%)"},".language-javascript .token.operator":{color:"hsl(286, 60%, 67%)"},".language-javascript .token.template-string > .token.interpolation > .token.interpolation-punctuation.punctuation":{color:"hsl(5, 48%, 51%)"},".language-json .token.operator":{color:"hsl(220, 14%, 71%)"},".language-json .token.null.keyword":{color:"hsl(29, 54%, 61%)"},".language-markdown .token.url":{color:"hsl(220, 14%, 71%)"},".language-markdown .token.url > .token.operator":{color:"hsl(220, 14%, 71%)"},".language-markdown .token.url-reference.url > .token.string":{color:"hsl(220, 14%, 71%)"},".language-markdown .token.url > .token.content":{color:"hsl(207, 82%, 66%)"},".language-markdown .token.url > .token.url":{color:"hsl(187, 47%, 55%)"},".language-markdown .token.url-reference.url":{color:"hsl(187, 47%, 55%)"},".language-markdown .token.blockquote.punctuation":{color:"hsl(220, 10%, 40%)",fontStyle:"italic"},".language-markdown .token.hr.punctuation":{color:"hsl(220, 10%, 40%)",fontStyle:"italic"},".language-markdown .token.code-snippet":{color:"hsl(95, 38%, 62%)"},".language-markdown .token.bold .token.content":{color:"hsl(29, 54%, 61%)"},".language-markdown .token.italic .token.content":{color:"hsl(286, 60%, 67%)"},".language-markdown .token.strike .token.content":{color:"hsl(355, 65%, 65%)"},".language-markdown .token.strike .token.punctuation":{color:"hsl(355, 65%, 65%)"},".language-markdown .token.list.punctuation":{color:"hsl(355, 65%, 65%)"},".language-markdown .token.title.important > .token.punctuation":{color:"hsl(355, 65%, 65%)"},bold:{fontWeight:"bold"},italic:{fontStyle:"italic"},namespace:{Opacity:"0.8"},"token.tab:not(:empty):before":{color:"hsla(220, 14%, 71%, 0.15)",textShadow:"none"},"token.cr:before":{color:"hsla(220, 14%, 71%, 0.15)",textShadow:"none"},"token.lf:before":{color:"hsla(220, 14%, 71%, 0.15)",textShadow:"none"},"token.space:before":{color:"hsla(220, 14%, 71%, 0.15)",textShadow:"none"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item":{marginRight:"0.4em"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > button":{background:"hsl(220, 13%, 26%)",color:"hsl(220, 9%, 55%)",padding:"0.1em 0.4em",borderRadius:"0.3em"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > a":{background:"hsl(220, 13%, 26%)",color:"hsl(220, 9%, 55%)",padding:"0.1em 0.4em",borderRadius:"0.3em"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > span":{background:"hsl(220, 13%, 26%)",color:"hsl(220, 9%, 55%)",padding:"0.1em 0.4em",borderRadius:"0.3em"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > button:hover":{background:"hsl(220, 13%, 28%)",color:"hsl(220, 14%, 71%)"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > button:focus":{background:"hsl(220, 13%, 28%)",color:"hsl(220, 14%, 71%)"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > a:hover":{background:"hsl(220, 13%, 28%)",color:"hsl(220, 14%, 71%)"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > a:focus":{background:"hsl(220, 13%, 28%)",color:"hsl(220, 14%, 71%)"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > span:hover":{background:"hsl(220, 13%, 28%)",color:"hsl(220, 14%, 71%)"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > span:focus":{background:"hsl(220, 13%, 28%)",color:"hsl(220, 14%, 71%)"},".line-highlight.line-highlight":{background:"hsla(220, 100%, 80%, 0.04)"},".line-highlight.line-highlight:before":{background:"hsl(220, 13%, 26%)",color:"hsl(220, 14%, 71%)",padding:"0.1em 0.6em",borderRadius:"0.3em",boxShadow:"0 2px 0 0 rgba(0, 0, 0, 0.2)"},".line-highlight.line-highlight[data-end]:after":{background:"hsl(220, 13%, 26%)",color:"hsl(220, 14%, 71%)",padding:"0.1em 0.6em",borderRadius:"0.3em",boxShadow:"0 2px 0 0 rgba(0, 0, 0, 0.2)"},"pre[id].linkable-line-numbers.linkable-line-numbers span.line-numbers-rows > span:hover:before":{backgroundColor:"hsla(220, 100%, 80%, 0.04)"},".line-numbers.line-numbers .line-numbers-rows":{borderRightColor:"hsla(220, 14%, 71%, 0.15)"},".command-line .command-line-prompt":{borderRightColor:"hsla(220, 14%, 71%, 0.15)"},".line-numbers .line-numbers-rows > span:before":{color:"hsl(220, 14%, 45%)"},".command-line .command-line-prompt > span:before":{color:"hsl(220, 14%, 45%)"},".rainbow-braces .token.token.punctuation.brace-level-1":{color:"hsl(355, 65%, 65%)"},".rainbow-braces .token.token.punctuation.brace-level-5":{color:"hsl(355, 65%, 65%)"},".rainbow-braces .token.token.punctuation.brace-level-9":{color:"hsl(355, 65%, 65%)"},".rainbow-braces .token.token.punctuation.brace-level-2":{color:"hsl(95, 38%, 62%)"},".rainbow-braces .token.token.punctuation.brace-level-6":{color:"hsl(95, 38%, 62%)"},".rainbow-braces .token.token.punctuation.brace-level-10":{color:"hsl(95, 38%, 62%)"},".rainbow-braces .token.token.punctuation.brace-level-3":{color:"hsl(207, 82%, 66%)"},".rainbow-braces .token.token.punctuation.brace-level-7":{color:"hsl(207, 82%, 66%)"},".rainbow-braces .token.token.punctuation.brace-level-11":{color:"hsl(207, 82%, 66%)"},".rainbow-braces .token.token.punctuation.brace-level-4":{color:"hsl(286, 60%, 67%)"},".rainbow-braces .token.token.punctuation.brace-level-8":{color:"hsl(286, 60%, 67%)"},".rainbow-braces .token.token.punctuation.brace-level-12":{color:"hsl(286, 60%, 67%)"},"pre.diff-highlight > code .token.token.deleted:not(.prefix)":{backgroundColor:"hsla(353, 100%, 66%, 0.15)"},"pre > code.diff-highlight .token.token.deleted:not(.prefix)":{backgroundColor:"hsla(353, 100%, 66%, 0.15)"},"pre.diff-highlight > code .token.token.deleted:not(.prefix)::-moz-selection":{backgroundColor:"hsla(353, 95%, 66%, 0.25)"},"pre.diff-highlight > code .token.token.deleted:not(.prefix) *::-moz-selection":{backgroundColor:"hsla(353, 95%, 66%, 0.25)"},"pre > code.diff-highlight .token.token.deleted:not(.prefix)::-moz-selection":{backgroundColor:"hsla(353, 95%, 66%, 0.25)"},"pre > code.diff-highlight .token.token.deleted:not(.prefix) *::-moz-selection":{backgroundColor:"hsla(353, 95%, 66%, 0.25)"},"pre.diff-highlight > code .token.token.deleted:not(.prefix)::selection":{backgroundColor:"hsla(353, 95%, 66%, 0.25)"},"pre.diff-highlight > code .token.token.deleted:not(.prefix) *::selection":{backgroundColor:"hsla(353, 95%, 66%, 0.25)"},"pre > code.diff-highlight .token.token.deleted:not(.prefix)::selection":{backgroundColor:"hsla(353, 95%, 66%, 0.25)"},"pre > code.diff-highlight .token.token.deleted:not(.prefix) *::selection":{backgroundColor:"hsla(353, 95%, 66%, 0.25)"},"pre.diff-highlight > code .token.token.inserted:not(.prefix)":{backgroundColor:"hsla(137, 100%, 55%, 0.15)"},"pre > code.diff-highlight .token.token.inserted:not(.prefix)":{backgroundColor:"hsla(137, 100%, 55%, 0.15)"},"pre.diff-highlight > code .token.token.inserted:not(.prefix)::-moz-selection":{backgroundColor:"hsla(135, 73%, 55%, 0.25)"},"pre.diff-highlight > code .token.token.inserted:not(.prefix) *::-moz-selection":{backgroundColor:"hsla(135, 73%, 55%, 0.25)"},"pre > code.diff-highlight .token.token.inserted:not(.prefix)::-moz-selection":{backgroundColor:"hsla(135, 73%, 55%, 0.25)"},"pre > code.diff-highlight .token.token.inserted:not(.prefix) *::-moz-selection":{backgroundColor:"hsla(135, 73%, 55%, 0.25)"},"pre.diff-highlight > code .token.token.inserted:not(.prefix)::selection":{backgroundColor:"hsla(135, 73%, 55%, 0.25)"},"pre.diff-highlight > code .token.token.inserted:not(.prefix) *::selection":{backgroundColor:"hsla(135, 73%, 55%, 0.25)"},"pre > code.diff-highlight .token.token.inserted:not(.prefix)::selection":{backgroundColor:"hsla(135, 73%, 55%, 0.25)"},"pre > code.diff-highlight .token.token.inserted:not(.prefix) *::selection":{backgroundColor:"hsla(135, 73%, 55%, 0.25)"},".prism-previewer.prism-previewer:before":{borderColor:"hsl(224, 13%, 17%)"},".prism-previewer-gradient.prism-previewer-gradient div":{borderColor:"hsl(224, 13%, 17%)",borderRadius:"0.3em"},".prism-previewer-color.prism-previewer-color:before":{borderRadius:"0.3em"},".prism-previewer-easing.prism-previewer-easing:before":{borderRadius:"0.3em"},".prism-previewer.prism-previewer:after":{borderTopColor:"hsl(224, 13%, 17%)"},".prism-previewer-flipped.prism-previewer-flipped.after":{borderBottomColor:"hsl(224, 13%, 17%)"},".prism-previewer-angle.prism-previewer-angle:before":{background:"hsl(219, 13%, 22%)"},".prism-previewer-time.prism-previewer-time:before":{background:"hsl(219, 13%, 22%)"},".prism-previewer-easing.prism-previewer-easing":{background:"hsl(219, 13%, 22%)"},".prism-previewer-angle.prism-previewer-angle circle":{stroke:"hsl(220, 14%, 71%)",strokeOpacity:"1"},".prism-previewer-time.prism-previewer-time circle":{stroke:"hsl(220, 14%, 71%)",strokeOpacity:"1"},".prism-previewer-easing.prism-previewer-easing circle":{stroke:"hsl(220, 14%, 71%)",fill:"transparent"},".prism-previewer-easing.prism-previewer-easing path":{stroke:"hsl(220, 14%, 71%)"},".prism-previewer-easing.prism-previewer-easing line":{stroke:"hsl(220, 14%, 71%)"}};var Bf={'code[class*="language-"]':{background:"hsl(230, 1%, 98%)",color:"hsl(230, 8%, 24%)",fontFamily:'"Fira Code", "Fira Mono", Menlo, Consolas, "DejaVu Sans Mono", monospace',direction:"ltr",textAlign:"left",whiteSpace:"pre",wordSpacing:"normal",wordBreak:"normal",lineHeight:"1.5",MozTabSize:"2",OTabSize:"2",tabSize:"2",WebkitHyphens:"none",MozHyphens:"none",msHyphens:"none",hyphens:"none"},'pre[class*="language-"]':{background:"hsl(230, 1%, 98%)",color:"hsl(230, 8%, 24%)",fontFamily:'"Fira Code", "Fira Mono", Menlo, Consolas, "DejaVu Sans Mono", monospace',direction:"ltr",textAlign:"left",whiteSpace:"pre",wordSpacing:"normal",wordBreak:"normal",lineHeight:"1.5",MozTabSize:"2",OTabSize:"2",tabSize:"2",WebkitHyphens:"none",MozHyphens:"none",msHyphens:"none",hyphens:"none",padding:"1em",margin:"0.5em 0",overflow:"auto",borderRadius:"0.3em"},'code[class*="language-"]::-moz-selection':{background:"hsl(230, 1%, 90%)",color:"inherit"},'code[class*="language-"] *::-moz-selection':{background:"hsl(230, 1%, 90%)",color:"inherit"},'pre[class*="language-"] *::-moz-selection':{background:"hsl(230, 1%, 90%)",color:"inherit"},'code[class*="language-"]::selection':{background:"hsl(230, 1%, 90%)",color:"inherit"},'code[class*="language-"] *::selection':{background:"hsl(230, 1%, 90%)",color:"inherit"},'pre[class*="language-"] *::selection':{background:"hsl(230, 1%, 90%)",color:"inherit"},':not(pre) > code[class*="language-"]':{padding:"0.2em 0.3em",borderRadius:"0.3em",whiteSpace:"normal"},comment:{color:"hsl(230, 4%, 64%)",fontStyle:"italic"},prolog:{color:"hsl(230, 4%, 64%)"},cdata:{color:"hsl(230, 4%, 64%)"},doctype:{color:"hsl(230, 8%, 24%)"},punctuation:{color:"hsl(230, 8%, 24%)"},entity:{color:"hsl(230, 8%, 24%)",cursor:"help"},"attr-name":{color:"hsl(35, 99%, 36%)"},"class-name":{color:"hsl(35, 99%, 36%)"},boolean:{color:"hsl(35, 99%, 36%)"},constant:{color:"hsl(35, 99%, 36%)"},number:{color:"hsl(35, 99%, 36%)"},atrule:{color:"hsl(35, 99%, 36%)"},keyword:{color:"hsl(301, 63%, 40%)"},property:{color:"hsl(5, 74%, 59%)"},tag:{color:"hsl(5, 74%, 59%)"},symbol:{color:"hsl(5, 74%, 59%)"},deleted:{color:"hsl(5, 74%, 59%)"},important:{color:"hsl(5, 74%, 59%)"},selector:{color:"hsl(119, 34%, 47%)"},string:{color:"hsl(119, 34%, 47%)"},char:{color:"hsl(119, 34%, 47%)"},builtin:{color:"hsl(119, 34%, 47%)"},inserted:{color:"hsl(119, 34%, 47%)"},regex:{color:"hsl(119, 34%, 47%)"},"attr-value":{color:"hsl(119, 34%, 47%)"},"attr-value > .token.punctuation":{color:"hsl(119, 34%, 47%)"},variable:{color:"hsl(221, 87%, 60%)"},operator:{color:"hsl(221, 87%, 60%)"},function:{color:"hsl(221, 87%, 60%)"},url:{color:"hsl(198, 99%, 37%)"},"attr-value > .token.punctuation.attr-equals":{color:"hsl(230, 8%, 24%)"},"special-attr > .token.attr-value > .token.value.css":{color:"hsl(230, 8%, 24%)"},".language-css .token.selector":{color:"hsl(5, 74%, 59%)"},".language-css .token.property":{color:"hsl(230, 8%, 24%)"},".language-css .token.function":{color:"hsl(198, 99%, 37%)"},".language-css .token.url > .token.function":{color:"hsl(198, 99%, 37%)"},".language-css .token.url > .token.string.url":{color:"hsl(119, 34%, 47%)"},".language-css .token.important":{color:"hsl(301, 63%, 40%)"},".language-css .token.atrule .token.rule":{color:"hsl(301, 63%, 40%)"},".language-javascript .token.operator":{color:"hsl(301, 63%, 40%)"},".language-javascript .token.template-string > .token.interpolation > .token.interpolation-punctuation.punctuation":{color:"hsl(344, 84%, 43%)"},".language-json .token.operator":{color:"hsl(230, 8%, 24%)"},".language-json .token.null.keyword":{color:"hsl(35, 99%, 36%)"},".language-markdown .token.url":{color:"hsl(230, 8%, 24%)"},".language-markdown .token.url > .token.operator":{color:"hsl(230, 8%, 24%)"},".language-markdown .token.url-reference.url > .token.string":{color:"hsl(230, 8%, 24%)"},".language-markdown .token.url > .token.content":{color:"hsl(221, 87%, 60%)"},".language-markdown .token.url > .token.url":{color:"hsl(198, 99%, 37%)"},".language-markdown .token.url-reference.url":{color:"hsl(198, 99%, 37%)"},".language-markdown .token.blockquote.punctuation":{color:"hsl(230, 4%, 64%)",fontStyle:"italic"},".language-markdown .token.hr.punctuation":{color:"hsl(230, 4%, 64%)",fontStyle:"italic"},".language-markdown .token.code-snippet":{color:"hsl(119, 34%, 47%)"},".language-markdown .token.bold .token.content":{color:"hsl(35, 99%, 36%)"},".language-markdown .token.italic .token.content":{color:"hsl(301, 63%, 40%)"},".language-markdown .token.strike .token.content":{color:"hsl(5, 74%, 59%)"},".language-markdown .token.strike .token.punctuation":{color:"hsl(5, 74%, 59%)"},".language-markdown .token.list.punctuation":{color:"hsl(5, 74%, 59%)"},".language-markdown .token.title.important > .token.punctuation":{color:"hsl(5, 74%, 59%)"},bold:{fontWeight:"bold"},italic:{fontStyle:"italic"},namespace:{Opacity:"0.8"},"token.tab:not(:empty):before":{color:"hsla(230, 8%, 24%, 0.2)"},"token.cr:before":{color:"hsla(230, 8%, 24%, 0.2)"},"token.lf:before":{color:"hsla(230, 8%, 24%, 0.2)"},"token.space:before":{color:"hsla(230, 8%, 24%, 0.2)"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item":{marginRight:"0.4em"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > button":{background:"hsl(230, 1%, 90%)",color:"hsl(230, 6%, 44%)",padding:"0.1em 0.4em",borderRadius:"0.3em"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > a":{background:"hsl(230, 1%, 90%)",color:"hsl(230, 6%, 44%)",padding:"0.1em 0.4em",borderRadius:"0.3em"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > span":{background:"hsl(230, 1%, 90%)",color:"hsl(230, 6%, 44%)",padding:"0.1em 0.4em",borderRadius:"0.3em"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > button:hover":{background:"hsl(230, 1%, 78%)",color:"hsl(230, 8%, 24%)"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > button:focus":{background:"hsl(230, 1%, 78%)",color:"hsl(230, 8%, 24%)"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > a:hover":{background:"hsl(230, 1%, 78%)",color:"hsl(230, 8%, 24%)"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > a:focus":{background:"hsl(230, 1%, 78%)",color:"hsl(230, 8%, 24%)"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > span:hover":{background:"hsl(230, 1%, 78%)",color:"hsl(230, 8%, 24%)"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > span:focus":{background:"hsl(230, 1%, 78%)",color:"hsl(230, 8%, 24%)"},".line-highlight.line-highlight":{background:"hsla(230, 8%, 24%, 0.05)"},".line-highlight.line-highlight:before":{background:"hsl(230, 1%, 90%)",color:"hsl(230, 8%, 24%)",padding:"0.1em 0.6em",borderRadius:"0.3em",boxShadow:"0 2px 0 0 rgba(0, 0, 0, 0.2)"},".line-highlight.line-highlight[data-end]:after":{background:"hsl(230, 1%, 90%)",color:"hsl(230, 8%, 24%)",padding:"0.1em 0.6em",borderRadius:"0.3em",boxShadow:"0 2px 0 0 rgba(0, 0, 0, 0.2)"},"pre[id].linkable-line-numbers.linkable-line-numbers span.line-numbers-rows > span:hover:before":{backgroundColor:"hsla(230, 8%, 24%, 0.05)"},".line-numbers.line-numbers .line-numbers-rows":{borderRightColor:"hsla(230, 8%, 24%, 0.2)"},".command-line .command-line-prompt":{borderRightColor:"hsla(230, 8%, 24%, 0.2)"},".line-numbers .line-numbers-rows > span:before":{color:"hsl(230, 1%, 62%)"},".command-line .command-line-prompt > span:before":{color:"hsl(230, 1%, 62%)"},".rainbow-braces .token.token.punctuation.brace-level-1":{color:"hsl(5, 74%, 59%)"},".rainbow-braces .token.token.punctuation.brace-level-5":{color:"hsl(5, 74%, 59%)"},".rainbow-braces .token.token.punctuation.brace-level-9":{color:"hsl(5, 74%, 59%)"},".rainbow-braces .token.token.punctuation.brace-level-2":{color:"hsl(119, 34%, 47%)"},".rainbow-braces .token.token.punctuation.brace-level-6":{color:"hsl(119, 34%, 47%)"},".rainbow-braces .token.token.punctuation.brace-level-10":{color:"hsl(119, 34%, 47%)"},".rainbow-braces .token.token.punctuation.brace-level-3":{color:"hsl(221, 87%, 60%)"},".rainbow-braces .token.token.punctuation.brace-level-7":{color:"hsl(221, 87%, 60%)"},".rainbow-braces .token.token.punctuation.brace-level-11":{color:"hsl(221, 87%, 60%)"},".rainbow-braces .token.token.punctuation.brace-level-4":{color:"hsl(301, 63%, 40%)"},".rainbow-braces .token.token.punctuation.brace-level-8":{color:"hsl(301, 63%, 40%)"},".rainbow-braces .token.token.punctuation.brace-level-12":{color:"hsl(301, 63%, 40%)"},"pre.diff-highlight > code .token.token.deleted:not(.prefix)":{backgroundColor:"hsla(353, 100%, 66%, 0.15)"},"pre > code.diff-highlight .token.token.deleted:not(.prefix)":{backgroundColor:"hsla(353, 100%, 66%, 0.15)"},"pre.diff-highlight > code .token.token.deleted:not(.prefix)::-moz-selection":{backgroundColor:"hsla(353, 95%, 66%, 0.25)"},"pre.diff-highlight > code .token.token.deleted:not(.prefix) *::-moz-selection":{backgroundColor:"hsla(353, 95%, 66%, 0.25)"},"pre > code.diff-highlight .token.token.deleted:not(.prefix)::-moz-selection":{backgroundColor:"hsla(353, 95%, 66%, 0.25)"},"pre > code.diff-highlight .token.token.deleted:not(.prefix) *::-moz-selection":{backgroundColor:"hsla(353, 95%, 66%, 0.25)"},"pre.diff-highlight > code .token.token.deleted:not(.prefix)::selection":{backgroundColor:"hsla(353, 95%, 66%, 0.25)"},"pre.diff-highlight > code .token.token.deleted:not(.prefix) *::selection":{backgroundColor:"hsla(353, 95%, 66%, 0.25)"},"pre > code.diff-highlight .token.token.deleted:not(.prefix)::selection":{backgroundColor:"hsla(353, 95%, 66%, 0.25)"},"pre > code.diff-highlight .token.token.deleted:not(.prefix) *::selection":{backgroundColor:"hsla(353, 95%, 66%, 0.25)"},"pre.diff-highlight > code .token.token.inserted:not(.prefix)":{backgroundColor:"hsla(137, 100%, 55%, 0.15)"},"pre > code.diff-highlight .token.token.inserted:not(.prefix)":{backgroundColor:"hsla(137, 100%, 55%, 0.15)"},"pre.diff-highlight > code .token.token.inserted:not(.prefix)::-moz-selection":{backgroundColor:"hsla(135, 73%, 55%, 0.25)"},"pre.diff-highlight > code .token.token.inserted:not(.prefix) *::-moz-selection":{backgroundColor:"hsla(135, 73%, 55%, 0.25)"},"pre > code.diff-highlight .token.token.inserted:not(.prefix)::-moz-selection":{backgroundColor:"hsla(135, 73%, 55%, 0.25)"},"pre > code.diff-highlight .token.token.inserted:not(.prefix) *::-moz-selection":{backgroundColor:"hsla(135, 73%, 55%, 0.25)"},"pre.diff-highlight > code .token.token.inserted:not(.prefix)::selection":{backgroundColor:"hsla(135, 73%, 55%, 0.25)"},"pre.diff-highlight > code .token.token.inserted:not(.prefix) *::selection":{backgroundColor:"hsla(135, 73%, 55%, 0.25)"},"pre > code.diff-highlight .token.token.inserted:not(.prefix)::selection":{backgroundColor:"hsla(135, 73%, 55%, 0.25)"},"pre > code.diff-highlight .token.token.inserted:not(.prefix) *::selection":{backgroundColor:"hsla(135, 73%, 55%, 0.25)"},".prism-previewer.prism-previewer:before":{borderColor:"hsl(0, 0, 95%)"},".prism-previewer-gradient.prism-previewer-gradient div":{borderColor:"hsl(0, 0, 95%)",borderRadius:"0.3em"},".prism-previewer-color.prism-previewer-color:before":{borderRadius:"0.3em"},".prism-previewer-easing.prism-previewer-easing:before":{borderRadius:"0.3em"},".prism-previewer.prism-previewer:after":{borderTopColor:"hsl(0, 0, 95%)"},".prism-previewer-flipped.prism-previewer-flipped.after":{borderBottomColor:"hsl(0, 0, 95%)"},".prism-previewer-angle.prism-previewer-angle:before":{background:"hsl(0, 0%, 100%)"},".prism-previewer-time.prism-previewer-time:before":{background:"hsl(0, 0%, 100%)"},".prism-previewer-easing.prism-previewer-easing":{background:"hsl(0, 0%, 100%)"},".prism-previewer-angle.prism-previewer-angle circle":{stroke:"hsl(230, 8%, 24%)",strokeOpacity:"1"},".prism-previewer-time.prism-previewer-time circle":{stroke:"hsl(230, 8%, 24%)",strokeOpacity:"1"},".prism-previewer-easing.prism-previewer-easing circle":{stroke:"hsl(230, 8%, 24%)",fill:"transparent"},".prism-previewer-easing.prism-previewer-easing path":{stroke:"hsl(230, 8%, 24%)"},".prism-previewer-easing.prism-previewer-easing line":{stroke:"hsl(230, 8%, 24%)"}};function Xz(e){let t=e.split(".").pop()?.toLowerCase()||"";return {ts:"typescript",tsx:"tsx",js:"javascript",jsx:"jsx",py:"python",rb:"ruby",rs:"rust",go:"go",java:"java",kt:"kotlin",swift:"swift",cs:"csharp",cpp:"cpp",c:"c",h:"c",hpp:"cpp",php:"php",html:"html",css:"css",scss:"scss",less:"less",json:"json",yaml:"yaml",yml:"yaml",xml:"xml",md:"markdown",sql:"sql",sh:"bash",bash:"bash",zsh:"bash",dockerfile:"docker",makefile:"makefile"}[t]||"text"}function Zz(){return typeof window>"u"?false:document.documentElement.classList.contains("dark")}function W_({code:e,language:t,filename:r,lineStart:n=1,highlightLines:o=[],className:a,showLineNumbers:i=true,showFilename:s=true,autoScrollToHighlight:l=true}){let c=Zz(),d=t||(r?Xz(r):"text"),u=useRef(null),g=useRef(false),p=new Set(o),f=useCallback(()=>{if(!l||o.length===0||!u.current||g.current)return;let b=Math.min(...o)-n,h=u.current,S=h.querySelector("pre");if(!S)return;let w=S.querySelector("code");if(!w)return;let N=w.children;if(b>=0&&b<N.length){let C=N[b];if(C){let k=C.offsetHeight,D=C.offsetTop-k*3;h.scrollTop=Math.max(0,D),g.current=true;}}},[l,o,n]);return useEffect(()=>{g.current=false;},[e,o.join(",")]),useEffect(()=>{let m=setTimeout(f,100);return ()=>clearTimeout(m)},[f,e]),jsxs("div",{className:R("rounded-lg border flex flex-col",a),children:[r&&s&&jsxs("div",{className:"px-3 py-2 bg-muted/50 border-b text-xs font-mono text-muted-foreground flex items-center gap-2 flex-shrink-0",children:[jsx("span",{className:"truncate",children:r}),n>1&&jsxs("span",{className:"text-muted-foreground/60",children:["starting at line ",n]})]}),jsx("div",{ref:u,className:"flex-1 overflow-auto",children:jsx(Ho,{language:d,style:c?Ff:Bf,showLineNumbers:i,startingLineNumber:n,wrapLines:true,lineProps:m=>{let b={display:"block",width:"100%"};return p.has(m)&&(b.backgroundColor=c?"rgba(255, 255, 0, 0.1)":"rgba(255, 255, 0, 0.2)",b.borderLeft="3px solid #f59e0b",b.paddingLeft="0.5rem",b.marginLeft="-0.5rem"),{style:b}},customStyle:{margin:0,padding:"1rem",fontSize:"0.8125rem",lineHeight:"1.5",backgroundColor:c?"#1e1e1e":"#fafafa"},codeTagProps:{style:{fontFamily:'ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace'}},children:e})})]})}function Qz({code:e,language:t,filename:r,className:n}){return jsx(W_,{code:e,language:t,filename:r,showLineNumbers:false,className:R("text-sm",n)})}function Mle(e){let t=new Date,r=new Date(e),n=Math.floor((t.getTime()-r.getTime())/1e3);if(isNaN(n))return "Unknown";if(n<0)return "In the future";if(n<10)return "Just now";if(n<60)return `${n} seconds ago`;let o=Math.floor(n/60);if(o===1)return "1 minute ago";if(o<60)return `${o} minutes ago`;let a=Math.floor(o/60);if(a===1)return "1 hour ago";if(a<24)return `${a} hours ago`;let i=Math.floor(a/24);if(i===1)return "1 day ago";if(i<7)return `${i} days ago`;let s=Math.floor(i/7);if(s===1)return "1 week ago";if(s<4)return `${s} weeks ago`;let l=Math.floor(i/30);if(l===1)return "1 month ago";if(l<12)return `${l} months ago`;let c=Math.floor(i/365);return c===1?"1 year ago":`${c} years ago`}function Ple(e,t={year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}){try{let r=new Date(e);return isNaN(r.getTime())?"Invalid date":r.toLocaleString(void 0,t)}catch{return "Invalid date"}}function Fle(e){if(e<60)return `${Math.floor(e)}s`;let t=Math.floor(e/60);if(t<60)return `${t}m`;let r=Math.floor(t/60),n=t%60;if(r<24)return n>0?`${r}h ${n}m`:`${r}h`;let o=Math.floor(r/24),a=r%24;return a>0?`${o}d ${a}h`:`${o}d`}function Ble(e){let t=new Date,r=new Date(e),n=Math.floor((t.getTime()-r.getTime())/1e3);if(isNaN(n)||n<0)return "--";if(n<60)return `${n}s`;let o=Math.floor(n/60);if(o<60)return `${o}m`;let a=Math.floor(o/60);if(a<24)return `${a}h`;let i=Math.floor(a/24);return i<365?`${i}d`:`${Math.floor(i/365)}y`}function Ule(e){if(e===0)return "0 B";let t=["B","KB","MB","GB","TB"],r=Math.floor(Math.log(e)/Math.log(1024));return `${(e/Math.pow(1024,r)).toFixed(2)} ${t[r]}`}function Hle(e){if(e<1e3)return String(e);if(e<1e6){let r=e/1e3;return `${Number.isInteger(r)?r:r.toFixed(1).replace(/\.0$/,"")}K`}let t=e/1e6;return `${Number.isInteger(t)?t:t.toFixed(1).replace(/\.0$/,"")}M`}function Gle(e){let t=Math.floor(e/1e3),r=Math.floor(t/60),n=Math.floor(r/60);return n>0?`${n}h ${r%60}m`:r>0?`${r}m ${t%60}s`:`${t}s`}var j_=[{bg:"bg-blue-100",text:"text-blue-800",border:"border-blue-300"},{bg:"bg-green-100",text:"text-green-800",border:"border-green-300"},{bg:"bg-yellow-100",text:"text-yellow-800",border:"border-yellow-300"},{bg:"bg-purple-100",text:"text-purple-800",border:"border-purple-300"},{bg:"bg-pink-100",text:"text-pink-800",border:"border-pink-300"},{bg:"bg-indigo-100",text:"text-indigo-800",border:"border-indigo-300"},{bg:"bg-red-100",text:"text-red-800",border:"border-red-300"},{bg:"bg-orange-100",text:"text-orange-800",border:"border-orange-300"},{bg:"bg-teal-100",text:"text-teal-800",border:"border-teal-300"},{bg:"bg-cyan-100",text:"text-cyan-800",border:"border-cyan-300"}];function Jz(e){let t=0;for(let r=0;r<e.length;r++){let n=e.charCodeAt(r);t=(t<<5)-t+n,t=t&t;}return Math.abs(t)}function eU(e){let t=Jz(e)%j_.length;return j_[t]}function qle(e){let t=eU(e);return t?`${t.bg} ${t.text} ${t.border} border`:"bg-gray-100 text-gray-700 border-gray-300 border"}function tU(e,t){let r=new Date,n=new Date(e),o=Math.floor((r.getTime()-n.getTime())/1e3);if(o<60)return t?.justNow?"just now":`${o}s ago`;let a=Math.floor(o/60);if(a<60)return `${a}m ago`;let i=Math.floor(a/60);if(i<24)return `${i}h ago`;let s=Math.floor(i/24);if(s<30)return `${s}d ago`;let l=Math.floor(s/30);return l<12?`${l}mo ago`:`${Math.floor(l/12)}y ago`}function jle(e){return tU(e,{justNow:true})}async function Uf(e,t=5e3){try{let r=new AbortController,n=setTimeout(()=>r.abort(),t),o=await fetch(`${e}/api/health`,{signal:r.signal,method:"GET",headers:{Accept:"application/json"}});return clearTimeout(n),o.ok?(await o.json(),{ready:!0}):{ready:!1,error:`Server returned ${o.status}: ${o.statusText}`,retryAfter:2e3}}catch(r){return r.name==="AbortError"?{ready:false,error:"Request timeout",retryAfter:3e3}:r.code==="ECONNREFUSED"||r.message.includes("fetch")?{ready:false,error:"Server not ready",retryAfter:2e3}:{ready:false,error:r.message,retryAfter:5e3}}}async function V_(e,t={}){let{maxAttempts:r=10,initialDelay:n=1e3,maxDelay:o=1e4,timeout:a=5e3}=t,i=0,s=n;for(;i<r;){i++,console.log(`\u{1F50D} Checking API readiness (attempt ${i}/${r})...`);let l=await Uf(e,a);if(l.ready)return console.log("\u2705 API is ready!"),true;console.log(`\u23F3 API not ready: ${l.error}. Retrying in ${s}ms...`),i<r&&(await new Promise(c=>setTimeout(c,s)),s=Math.min(s*2,o));}return console.error("\u274C API failed to become ready after all attempts"),false}async function rU(e,t,r={}){let n=await Uf(e);if(!n.ready)throw new Error(`API not ready: ${n.error}`);let o=t.startsWith("http")?t:`${e}${t}`,a=await fetch(o,{...r,headers:{"Content-Type":"application/json",...r.headers}});if(!a.ok)throw new Error(`API request failed: ${a.status} ${a.statusText}`);return a.json()}function nU(e,t={}){if(typeof window>"u")return {ready:true,error:null,checking:false};let[r,n]=window.React?.useState?.({ready:false,error:null,checking:true})||{ready:false,error:null,checking:true};return window.React?.useEffect?.(()=>{let o=true;async function a(){if(!o)return;n(s=>({...s,checking:true}));let i=await V_(e,t);o&&n({ready:i,error:i?null:"API is not available",checking:false});}return a(),()=>{o=false;}},[e]),r}function Hf(e,t){if(e===t)return true;if(e==null||t==null||typeof e!="object"||typeof t!="object")return false;let r=Object.keys(e),n=Object.keys(t);if(r.length!==n.length)return false;for(let o of r)if(!n.includes(o)||!Hf(e[o],t[o]))return false;return true}function oU({initialValues:e,defaultValues:t,onSave:r,timeout:n=1e4,validateChanges:o}){let[a,i]=useState(e),[s,l]=useState(false),[c,d]=useState(false),[u,g]=useState(null),p=useRef(e),f=useRef();useEffect(()=>{let w=o?o(a):!Hf(a,p.current);l(w);},[a,o]);let m=useCallback((w,N)=>{i(C=>({...C,[w]:N}));},[]),b=useCallback(async()=>{if(!s||c)return;d(true),g(null);let w=new Promise((N,C)=>{f.current=setTimeout(()=>{C(new Error("Save operation timed out"));},n);});try{await Promise.race([r(a),w]),p.current=a,l(!1);}catch(N){let C=N instanceof Error?N.message:"Failed to save changes";g(C),console.error("Save failed:",N);}finally{f.current&&clearTimeout(f.current),d(false);}},[a,s,c,r,n]),h=useCallback(()=>{i(p.current),l(false),g(null);},[]),S=useCallback(()=>{t&&(i(t),g(null),l(!Hf(t,p.current)));},[t]);return useEffect(()=>()=>{f.current&&clearTimeout(f.current);},[]),{values:a,isDirty:s,isSaving:c,error:u,setValues:i,setFieldValue:m,save:b,reset:h,resetToDefaults:S,canSave:s&&!c}}function lU({appName:e,appVersion:t,navigation:r,children:n,logoSrc:o="/assets/logo.png",logoClassName:a="h-8 w-auto",logoOffset:i,headerHeight:s="h-16",showLogout:l=false,onLogout:c,authenticated:d=true,connectionStatusUrl:u,className:g,primaryColor:p="#3b82f6"}){let f={pathname:"/"};try{let S=useLocation();S&&(f=S);}catch{}let[m,b]=useState(false),h=async()=>{if(c)c();else try{await fetch("/api/logout",{method:"POST"}),window.location.href="/login";}catch(S){console.error("Logout failed:",S);}};return jsxs("div",{className:R("min-h-screen bg-gray-50",g),children:[jsx("header",{className:"bg-black",children:jsx("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8",children:jsxs("div",{className:R("flex justify-between items-center",s),children:[jsxs("div",{className:"flex items-center",children:[jsx("img",{src:o,alt:"Logo",className:R(a,"mr-3"),style:i?{position:"relative",top:i.top??0,left:i.left??0}:void 0,onError:S=>{S.target.style.display="none";}}),e&&jsx("h1",{className:"text-xl font-semibold text-white",children:e}),t&&jsxs("span",{className:"ml-2 text-xs text-gray-400",children:["v",t]})]}),jsxs("div",{className:"flex items-center space-x-4",children:[jsx(ma,{url:u,className:"text-xs text-gray-400"}),l&&d&&jsxs("button",{onClick:h,className:"text-gray-400 hover:text-white flex items-center gap-2 text-sm",children:[jsx(LogOut,{className:"h-4 w-4"}),jsx("span",{className:"hidden sm:inline",children:"Logout"})]}),jsx("button",{className:"md:hidden p-2 text-white",onClick:()=>b(!m),children:m?jsx(X,{className:"h-6 w-6"}):jsx(Menu,{className:"h-6 w-6"})})]})]})})}),jsx("nav",{className:"bg-[#444444]",children:jsxs("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8",children:[jsx("div",{className:"hidden md:flex space-x-0",children:r.map(S=>{let w=f.pathname===S.href||S.href==="/"&&f.pathname==="/"||S.href!=="/"&&f.pathname.startsWith(S.href);return jsxs(Link,{to:S.href,className:R("flex items-center gap-2 px-4 py-3 text-sm font-medium transition-colors",w?"text-white":"text-gray-300 hover:bg-[#555555] hover:text-white"),style:w?{backgroundColor:p}:void 0,children:[S.icon,S.name]},S.href)})}),m&&jsx("div",{className:"md:hidden py-2 space-y-1",children:r.map(S=>{let w=f.pathname===S.href||S.href==="/"&&f.pathname==="/"||S.href!=="/"&&f.pathname.startsWith(S.href);return jsxs(Link,{to:S.href,className:R("flex items-center gap-2 px-3 py-2 rounded text-sm font-medium",w?"text-white":"text-gray-300 hover:text-white hover:bg-[#555555]"),style:w?{backgroundColor:p}:void 0,onClick:()=>b(false),children:[S.icon,S.name]},S.href)})})]})}),jsx("main",{className:"flex-1 max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-6",children:n})]})}function cU({appName:e,appVersion:t,navigation:r,children:n,logoSrc:o="/assets/logo.png",logoClassName:a="h-8 w-auto",logoOffset:i,headerHeight:s="h-16",showLogout:l=false,onLogout:c,authenticated:d=true,connectionStatusUrl:u,sidebarWidth:g=256,className:p}){let f={pathname:"/"};try{f=useLocation();}catch{console.warn("SidebarLayout: useLocation called outside Router context, using default pathname");}let m=async()=>{if(c)c();else try{await fetch("/api/logout",{method:"POST"}),window.location.href="/login";}catch(b){console.error("Logout failed:",b);}};return jsxs("div",{className:R("h-screen flex flex-col bg-gray-50",p),children:[jsx("header",{className:"bg-black",children:jsx("div",{className:"px-4 sm:px-6 lg:px-8",children:jsxs("div",{className:R("flex justify-between items-center",s),children:[jsxs("div",{className:"flex items-center",children:[jsx("img",{src:o,alt:"Logo",className:R(a,"mr-3"),style:i?{position:"relative",top:i.top??0,left:i.left??0}:void 0,onError:b=>{b.target.style.display="none";}}),e&&jsx("h1",{className:"text-xl font-semibold text-white",children:e}),t&&jsxs("span",{className:"ml-2 text-xs text-gray-400",children:["v",t]})]}),jsxs("div",{className:"flex items-center space-x-4",children:[jsx(ma,{url:u,className:"text-white"}),l&&d&&jsxs("button",{onClick:m,className:"text-gray-400 hover:text-white flex items-center gap-2 text-sm",children:[jsx(LogOut,{className:"h-4 w-4"}),jsx("span",{children:"Logout"})]})]})]})})}),jsxs("div",{className:"flex flex-1 overflow-hidden",children:[jsx("nav",{className:"bg-white border-r border-gray-200",style:{width:`${g}px`},children:jsx("div",{className:"p-4",children:jsx("ul",{className:"space-y-1",children:r.map(b=>{let h=f.pathname===b.href||b.href==="/"&&f.pathname==="/"||b.href!=="/"&&f.pathname.startsWith(b.href);return jsx("li",{children:jsxs(Link,{to:b.href,className:R("flex items-center space-x-3 px-3 py-2 rounded-lg transition-colors",h?"bg-blue-50 text-blue-600":"text-gray-700 hover:bg-gray-100"),children:[b.icon,jsx("span",{className:"font-medium",children:b.name})]})},b.href)})})})}),jsx("main",{className:"flex-1 overflow-auto",children:n})]})]})}var uU={active:{bg:"bg-green-500",ring:"ring-green-400"},success:{bg:"bg-emerald-500",ring:"ring-emerald-400"},inactive:{bg:"bg-gray-400",ring:"ring-gray-300"},warning:{bg:"bg-yellow-500",ring:"ring-yellow-400"},error:{bg:"bg-red-500",ring:"ring-red-400"}},dU={xs:"h-2 w-2",sm:"h-3 w-3",md:"h-4 w-4",lg:"h-5 w-5"};function qf({status:e,size:t="sm",animate:r=true,label:n,className:o}){let a=uU[e],i=r&&(e==="active"||e==="warning"||e==="error");return jsxs("div",{className:R("inline-flex items-center gap-2",o),children:[jsxs("span",{className:"relative inline-flex",children:[i&&jsx("span",{className:R("absolute inline-flex h-full w-full rounded-full opacity-75",a.bg,e==="active"&&"animate-ping",e==="warning"&&"animate-pulse",e==="error"&&"animate-pulse")}),jsx("span",{className:R("relative inline-flex rounded-full",dU[t],a.bg,i&&"ring-1",i&&a.ring)})]}),n&&jsx("span",{className:"text-xs text-muted-foreground",children:n})]})}function Wf({data:e,width:t=100,height:r=30,color:n="#10b981",strokeWidth:o=2,fill:a=false,className:i}){let s=useMemo(()=>{if(!e||e.length===0)return "";let c=Math.max(...e),d=Math.min(...e),u=c-d||1;return e.map((g,p)=>{let f=p/(e.length-1)*t,m=r-(g-d)/u*r;return `${f},${m}`}).join(" ")},[e,t,r]);if(!e||e.length===0)return jsx("svg",{width:t,height:r,className:i,children:jsx("line",{x1:"0",y1:r/2,x2:t,y2:r/2,stroke:"#e5e7eb",strokeWidth:1})});let l=s?`0,${r} ${s} ${t},${r}`:"";return jsxs("svg",{width:t,height:r,className:i,children:[a&&s&&jsx("polygon",{points:l,fill:n,fillOpacity:.1}),s&&jsx("polyline",{points:s,fill:"none",stroke:n,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"}),e.length>0&&jsx("circle",{cx:t,cy:r-(e[e.length-1]-Math.min(...e))/(Math.max(...e)-Math.min(...e)||1)*r,r:o,fill:n})]})}function fU({data:e,columns:t,keyField:r,title:n,description:o,showActivity:a=false,activityField:i="activity",activityDecay:s=1e3,showSparkline:l=false,sparklineField:c="value",sparklineHistory:d,sparklineColor:u="#10b981",showStatus:g=false,statusField:p="status",statusConfig:f,expandable:m=false,childrenField:b="children",defaultExpanded:h=false,className:S,striped:w=false,hover:N=true,compact:C=false,onRowClick:k,onRefresh:D}){let[P,A]=useState(new Set),[v,G]=useState(new Map);useEffect(()=>{if(h&&m){let O=e.map(B=>B[r]);A(new Set(O));}},[h,m,e,r]),useEffect(()=>{if(a){let O=new Map;e.forEach(B=>{let W=B[r],V=B[i];V&&V!=="inactive"&&(O.set(W,V),setTimeout(()=>{G(re=>{let Z=new Map(re);return Z.delete(W),Z});},s));}),G(B=>new Map([...B,...O]));}},[e,a,r,i,s]);let _=useCallback(O=>{A(B=>{let W=new Set(B);return W.has(O)?W.delete(O):W.add(O),W});},[]),M=(O,B=0)=>{let W=O[r],V=P.has(W),re=m&&O[b]&&O[b].length>0,Z=v.get(W)||"inactive";return jsxs(Fragment,{children:[jsx(br,{className:R(N&&"hover:bg-gray-50 transition-colors",k&&"cursor-pointer",B>0&&"bg-gray-50/50"),onClick:()=>k?.(O),children:t.map((x,z)=>jsx(hr,{className:R(x.align==="center"&&"text-center",x.align==="right"&&"text-right",C&&"py-2",z===0&&B>0&&`pl-${4+B*4}`),style:{width:x.width},children:jsxs("div",{className:"flex items-center gap-2",children:[z===0&&re&&jsx("button",{onClick:Q=>{Q.stopPropagation(),_(W);},className:"p-0.5 hover:bg-gray-200 rounded",children:V?"\u25BC":"\u25B6"}),z===0&&a&&jsx(qf,{status:Z,size:"sm"}),x.render?x.render(x.accessor(O),O):x.accessor(O),x.key===p&&g&&f&&jsxs(nt,{variant:f[O[p]]?.variant||"default",children:[f[O[p]]?.icon,f[O[p]]?.label||O[p]]}),x.key===c&&l&&d&&jsx(Wf,{data:d.get(W)||[],color:u,width:60,height:20})]})},x.key))},W),V&&re&&O[b].map(x=>M(x,B+1))]})};return jsxs(Ne,{className:S,children:[(n||o)&&jsxs("div",{className:"p-4 border-b",children:[n&&jsx("h3",{className:"font-semibold text-lg",children:n}),o&&jsx("p",{className:"text-sm text-gray-600 mt-1",children:o})]}),jsx("div",{className:"overflow-x-auto",children:jsxs(no,{children:[jsx(oo,{children:jsx(br,{children:t.map(O=>jsx(Zr,{className:R(O.align==="center"&&"text-center",O.align==="right"&&"text-right"),style:{width:O.width},children:O.label},O.key))})}),jsx(ao,{children:e.length===0?jsx(br,{children:jsx(hr,{colSpan:t.length,className:"text-center py-8 text-gray-500",children:"No data available"})}):e.map(O=>M(O))})]})})]})}function hU({stats:e,columns:t=4,className:r}){let n={1:"grid-cols-1",2:"grid-cols-1 md:grid-cols-2",3:"grid-cols-1 md:grid-cols-2 lg:grid-cols-3",4:"grid-cols-1 md:grid-cols-2 lg:grid-cols-4",5:"grid-cols-1 md:grid-cols-2 lg:grid-cols-5",6:"grid-cols-1 md:grid-cols-3 lg:grid-cols-6"},o={default:"",primary:"border-blue-200 bg-blue-50/50",success:"border-green-200 bg-green-50/50",warning:"border-yellow-200 bg-yellow-50/50",danger:"border-red-200 bg-red-50/50"},a={default:"text-gray-600",primary:"text-blue-600",success:"text-green-600",warning:"text-yellow-600",danger:"text-red-600"};return jsx("div",{className:R(`grid gap-4 ${n[t]}`,r),children:e.map((i,s)=>{let l=i.icon,c=i.color||"default";return jsx(Ne,{className:R("p-4 transition-all hover:shadow-md",o[c],i.className),children:jsx("div",{className:"flex items-start justify-between",children:jsxs("div",{className:"flex-1",children:[jsxs("div",{className:"flex items-center gap-2",children:[l&&jsx(l,{className:R("h-4 w-4",a[c])}),jsx("p",{className:"text-sm font-medium text-gray-600",children:i.label})]}),jsxs("div",{className:"mt-2",children:[jsx("p",{className:"text-2xl font-bold",children:i.value}),i.description&&jsx("p",{className:"text-xs text-gray-500 mt-1",children:i.description}),i.trend&&jsxs("div",{className:"flex items-center gap-1 mt-2",children:[jsxs("span",{className:R("text-xs font-medium",i.trend.positive?"text-green-600":"text-red-600"),children:[i.trend.positive?"\u2191":"\u2193",Math.abs(i.trend.value),"%"]}),i.trend.label&&jsx("span",{className:"text-xs text-gray-500",children:i.trend.label})]})]})]})})},s)})})}function yU({label:e,value:t,icon:r,trend:n,className:o}){return jsxs("div",{className:R("flex items-center justify-between p-3 bg-white rounded-lg border",o),children:[jsxs("div",{className:"flex items-center gap-3",children:[r&&jsx("div",{className:"p-2 bg-gray-100 rounded",children:jsx(r,{className:"h-4 w-4 text-gray-600"})}),jsxs("div",{children:[jsx("p",{className:"text-xs text-gray-600",children:e}),jsx("p",{className:"font-semibold",children:t})]})]}),n!==void 0&&jsxs("span",{className:R("text-xs font-medium",n>=0?"text-green-600":"text-red-600"),children:[n>=0?"\u2191":"\u2193"," ",Math.abs(n),"%"]})]})}function SU({stats:e}){if(!e)return null;let{total:t,error:r,warn:n,info:o,debug:a,fileSize:i,oldestEntry:s,newestEntry:l}=e;return jsxs(Ne,{className:"p-4 mb-4",children:[jsxs("div",{className:"grid grid-cols-2 md:grid-cols-6 gap-4",children:[jsxs("div",{children:[jsx("div",{className:"text-sm text-muted-foreground",children:"Total"}),jsx("div",{className:"text-xl font-semibold",children:t??0})]}),jsxs("div",{children:[jsx("div",{className:"text-sm text-muted-foreground",children:"Errors"}),jsx(nt,{variant:"destructive",children:r??0})]}),jsxs("div",{children:[jsx("div",{className:"text-sm text-muted-foreground",children:"Warnings"}),jsx(nt,{variant:"secondary",children:n??0})]}),jsxs("div",{children:[jsx("div",{className:"text-sm text-muted-foreground",children:"Info"}),jsx(nt,{variant:"outline",children:o??0})]}),jsxs("div",{children:[jsx("div",{className:"text-sm text-muted-foreground",children:"Debug"}),jsx(nt,{variant:"outline",children:a??0})]}),jsxs("div",{children:[jsx("div",{className:"text-sm text-muted-foreground",children:"File Size"}),jsx("div",{className:"text-xl font-semibold",children:String(i??"-")})]})]}),(s||l)&&jsxs("div",{className:"mt-3 text-xs text-muted-foreground",children:[s&&jsxs("span",{children:["Oldest: ",s," "]}),l&&jsxs("span",{children:["Newest: ",l]})]})]})}function vU({categories:e,onSave:t,onLoad:r,onValidate:n,onRestartRequired:o,title:a="Settings",description:i="Configure application preferences",showResetButton:s=true,showUndoButton:l=true,customFields:c={},renderCategory:d,renderSetting:u,autoSave:g=false,autoSaveDelay:p=3e3,confirmReset:f=true,persistState:m=true,className:b,containerClassName:h,categoryClassName:S,settingClassName:w,height:N="calc(100vh - 200px)",maxContentWidth:C="800px"}){let[k,D]=useState({}),[P,A]=useState({}),[v,G]=useState({}),[_,M]=useState(true),[O,B]=useState(false),[W,V]=useState(e?.[0]?.id||""),[re,Z]=useState({}),[x,z]=useState(false),[Q,T]=useState(false),[ye,_e]=useState(null),Pe=()=>{let I={};return e.forEach(ee=>{(ee.settings||[]).forEach(se=>{I[se.key]=se.defaultValue;});}),I};useEffect(()=>{(async()=>{M(true);try{let ee=r?await r():Pe();if(D(ee),A(ee),m){let se=localStorage.getItem("settings-active-category");se&&e.find(Ce=>Ce.id===se)&&V(se);}}catch(ee){console.error("Failed to load settings:",ee),D(Pe()),A(Pe());}finally{M(false);}})();},[]),useEffect(()=>{let I=JSON.stringify(k)!==JSON.stringify(P);T(I);},[k,P]),useEffect(()=>{if(!g||!Q)return;let I=setTimeout(()=>{at();},p);return ()=>clearTimeout(I)},[k,g,p,Q]),useEffect(()=>{m&&localStorage.setItem("settings-active-category",W);},[W,m]);let Ue=(I,ee)=>I.validation?I.validation(ee):null,Se=()=>{let I={},ee=false;if(e.forEach(se=>{(se.settings||[]).forEach(Ce=>{let Ve=Ue(Ce,k[Ce.key]);Ve&&(I[Ce.key]=Ve,ee=true);});}),n){let se=n(k);se&&(Object.assign(I,se),ee=true);}return G(I),!ee},at=async()=>{if(Se()){B(true);try{let ee=Object.keys(k).filter(se=>k[se]!==P[se]).filter(se=>e.flatMap(Ve=>Ve.settings||[]).find(Ve=>Ve.key===se)?.requiresRestart);ee.length>0&&(z(!0),o?.(ee)),await t(k),A(k);}catch(I){console.error("Failed to save settings:",I),_e(I instanceof Error?I.message:"Failed to save settings. Please try again.");}finally{B(false);}}},xe=()=>{if(f&&!confirm("Reset all settings to defaults? This will override your current configuration."))return;let I=Pe();D(I);},Qe=()=>{D(P);},it=(I,ee)=>{D(se=>({...se,[I]:ee})),v[I]&&G(se=>{let Ce={...se};return delete Ce[I],Ce}),ye&&_e(null);},H=I=>{if(I.hidden)return null;let ee=k[I.key]??I.defaultValue,se=v[I.key],Ce=re[I.key];if(I.showIf&&!I.showIf(k))return null;let Ve=I.inputWidth==="small"?"max-w-[180px]":I.inputWidth==="large"?"w-full max-w-xl":"max-w-sm";if(I.type==="custom"||I.customComponent){let Ye=I.customComponent||c[I.type];if(Ye)return jsx(Ye,{value:ee,onChange:xn=>it(I.key,xn),error:se,disabled:O,setting:I})}let lr=c[I.type];if(lr)return jsx(lr,{value:ee,onChange:Ye=>it(I.key,Ye),error:se,disabled:O,setting:I});switch(I.type){case "string":case "text":case "password":return jsxs("div",{className:R("flex items-center gap-2",Ve),children:[jsx(kt,{id:I.key,type:I.type==="password"&&!Ce?"password":"text",value:ee||"",onChange:Ye=>it(I.key,Ye.target.value),className:R(se&&"border-red-500",Ve),placeholder:I.placeholder||(I.type==="password"?"\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022":void 0),disabled:O}),I.suffix&&jsx("span",{className:"text-xs text-muted-foreground",children:I.suffix})]});case "number":return jsxs("div",{className:R("flex items-center gap-2",Ve),children:[jsx(kt,{id:I.key,type:"number",value:ee??"",onChange:Ye=>it(I.key,parseFloat(Ye.target.value)||0),className:R(se&&"border-red-500",Ve),placeholder:I.placeholder,disabled:O,step:I.step,min:I.min,max:I.max}),I.suffix&&jsx("span",{className:"text-xs text-muted-foreground",children:I.suffix})]});case "boolean":return jsx(Vt,{id:I.key,checked:ee||false,onCheckedChange:Ye=>it(I.key,Ye),disabled:O});case "select":return jsxs(Et,{value:String(ee||I.defaultValue),onValueChange:Ye=>it(I.key,Ye),disabled:O,children:[jsx(pt,{id:I.key,className:R(se&&"border-red-500"),children:jsx(wt,{})}),jsx(gt,{children:I.options?.map(Ye=>jsx(Fe,{value:String(Ye.value),children:Ye.label},Ye.value))})]});default:return null}},ie=e.find(I=>I.id===W);return jsxs("div",{className:R("space-y-6",b),children:[jsxs("div",{className:"flex items-center justify-between",children:[jsxs("div",{children:[jsx("h1",{className:"text-3xl font-bold",children:a}),jsx("p",{className:"text-muted-foreground",children:i})]}),jsxs("div",{className:"flex items-center gap-2",children:[l&&Q&&jsxs(Y,{variant:"outline",onClick:Qe,disabled:O,children:[jsx(Undo,{className:"h-4 w-4 mr-2"}),"Undo"]}),s&&jsxs(Y,{variant:"outline",onClick:xe,disabled:O,children:[jsx(RotateCcw,{className:"h-4 w-4 mr-2"}),"Defaults"]}),jsx(Y,{onClick:at,disabled:!Q||O,className:R("transition-all",Q&&"ring-2 ring-primary/20"),children:O?jsxs(Fragment,{children:[jsx(RefreshCw,{className:"h-4 w-4 mr-2 animate-spin"}),"Saving..."]}):Q?jsxs(Fragment,{children:[jsx(Save,{className:"h-4 w-4 mr-2"}),"Save"]}):jsxs(Fragment,{children:[jsx(Check,{className:"h-4 w-4 mr-2"}),"Saved"]})})]})]}),ye&&jsxs(st,{variant:"destructive",className:"mb-6",children:[jsx(AlertCircle,{className:"h-4 w-4"}),jsx(lt,{children:ye})]}),jsxs("div",{className:R("flex gap-6",h),style:{height:N},children:[jsxs(Ne,{className:"w-56 shrink-0 flex flex-col",children:[jsx("div",{className:"p-4 border-b",children:jsx("h3",{className:"font-semibold",children:"Categories"})}),jsx("div",{className:"flex-1 overflow-y-auto p-2",children:jsx("div",{className:"space-y-1",children:e.map(I=>jsxs("button",{onClick:()=>V(I.id),className:R("w-full flex items-center gap-3 px-3 py-2 rounded-md text-sm transition-colors",W===I.id?"bg-primary text-primary-foreground":"hover:bg-muted",S),children:[typeof I.icon=="function"&&(()=>{let ee=I.icon;return jsx(ee,{className:"h-4 w-4 shrink-0"})})(),jsx("span",{className:"text-left truncate",children:I.label})]},I.id))})})]}),jsx("div",{className:"flex-1 overflow-y-auto min-h-0",children:_?jsx(Ne,{className:"p-8",children:jsx("div",{className:"flex items-center justify-center",children:jsx(RefreshCw,{className:"h-8 w-8 animate-spin text-muted-foreground"})})}):ie?.component?jsxs(Ne,{className:"p-6 h-full overflow-y-auto",children:[jsxs("div",{className:"mb-6",children:[jsx("h2",{className:"text-xl font-semibold",children:ie.label}),ie.description&&jsx("p",{className:"text-sm text-muted-foreground mt-1",children:ie.description})]}),jsx(ie.component,{category:ie})]}):ie?jsx(Ne,{className:"p-6 h-full overflow-y-auto",children:jsx("div",{style:{maxWidth:C},children:d?d(ie,jsx("div",{className:"space-y-6",children:(ie.settings||[]).map(I=>{let ee=H(I);if(!ee)return null;let se=jsxs("div",{className:R("space-y-2",w),children:[jsxs("div",{className:"flex items-center justify-between",children:[jsxs("div",{className:"flex items-center gap-2",children:[jsxs(Rt,{htmlFor:I.key,className:"text-sm font-medium",children:[I.label,I.requiresRestart&&jsx("span",{className:"ml-2 text-xs text-amber-600 dark:text-amber-400",children:"(Requires restart)"})]}),I.help&&jsx("button",{type:"button",className:"text-muted-foreground hover:text-foreground transition-colors",title:I.help,children:jsx(Info,{className:"h-3 w-3"})})]}),I.type==="password"&&k[I.key]&&jsx(Y,{type:"button",variant:"ghost",size:"sm",className:"h-6 px-2",onClick:()=>Z(Ce=>({...Ce,[I.key]:!Ce[I.key]})),children:re[I.key]?jsx(EyeOff,{className:"h-3 w-3"}):jsx(Eye,{className:"h-3 w-3"})})]}),I.description&&jsx("p",{className:"text-xs text-muted-foreground",children:I.description}),I.hint&&jsx("p",{className:"text-[11px] text-muted-foreground",children:I.hint}),ee,v[I.key]&&jsx("p",{className:"text-xs text-red-500",children:v[I.key]})]},I.key);return u?u(I,se):se})})):jsxs(Fragment,{children:[jsxs("div",{className:"mb-6",children:[jsx("h2",{className:"text-xl font-semibold",children:ie.label}),jsx("p",{className:"text-sm text-muted-foreground mt-1",children:ie.description})]}),jsx("div",{className:"space-y-6",children:(ie.settings||[]).map(I=>{let ee=H(I);if(!ee)return null;let se=jsxs("div",{className:R("space-y-2",w),children:[jsxs("div",{className:"flex items-center justify-between",children:[jsxs("div",{className:"flex items-center gap-2",children:[jsxs(Rt,{htmlFor:I.key,className:"text-sm font-medium",children:[I.label,I.requiresRestart&&jsx("span",{className:"ml-2 text-xs text-amber-600 dark:text-amber-400",children:"(Requires restart)"})]}),I.help&&jsx("button",{type:"button",className:"text-muted-foreground hover:text-foreground transition-colors",title:I.help,children:jsx(Info,{className:"h-3 w-3"})})]}),I.type==="password"&&k[I.key]&&jsx(Y,{type:"button",variant:"ghost",size:"sm",className:"h-6 px-2",onClick:()=>Z(Ce=>({...Ce,[I.key]:!Ce[I.key]})),children:re[I.key]?jsx(EyeOff,{className:"h-3 w-3"}):jsx(Eye,{className:"h-3 w-3"})})]}),I.description&&jsx("p",{className:"text-xs text-muted-foreground",children:I.description}),ee,v[I.key]&&jsx("p",{className:"text-xs text-red-500",children:v[I.key]})]},I.key);return u?u(I,se):se})})]})})}):jsx(Ne,{className:"p-8",children:jsxs(st,{children:[jsx(AlertCircle,{className:"h-4 w-4"}),jsx(lt,{children:"No settings available for this category"})]})})})]}),x&&jsxs(st,{className:"border-amber-500",children:[jsx(AlertCircle,{className:"h-4 w-4 text-amber-600"}),jsx(lt,{children:"Some settings require a restart to take effect."})]})]})}function TU({onFetchLogs:e,onFetchArchives:t,onClearLogs:r,onDownloadArchive:n,onDeleteArchive:o,autoRefreshMs:a=3e3,height:i="calc(100vh - 400px)"}){return jsx(co,{onFetchLogs:e,onFetchArchives:t,onClearLogs:r,onDownloadArchive:n,onDeleteArchive:o,enableAutoScroll:true,autoRefreshMs:a,enableSearch:true,enableFilter:true,enableExport:true,enableClear:!!r,showArchives:!!t,height:i})}var Ns={colors:{primary:{DEFAULT:"#3b82f6",hover:"#2563eb",light:"#60a5fa",dark:"#1d4ed8"},dark:{bg:{primary:"#0a0a0a",secondary:"#141414",tertiary:"#1a1a1a",elevated:"#242424"},border:{DEFAULT:"#2a2a2a",subtle:"#1f1f1f",strong:"#3a3a3a"}},light:{bg:{primary:"#ffffff",secondary:"#f8f9fa",tertiary:"#f3f4f6",elevated:"#ffffff"},border:{DEFAULT:"#e5e7eb",subtle:"#f3f4f6",strong:"#d1d5db"}},success:{DEFAULT:"#10b981",light:"#34d399",dark:"#059669"},warning:{DEFAULT:"#f59e0b",light:"#fbbf24",dark:"#d97706"},error:{DEFAULT:"#ef4444",light:"#f87171",dark:"#dc2626"},info:{DEFAULT:"#3b82f6",light:"#60a5fa",dark:"#2563eb"},intelligent:{DEFAULT:"#8b5cf6",light:"#a78bfa",dark:"#7c3aed"},activity:{read:"#10b981",write:"#3b82f6",inactive:"#6b7280"}},gradients:{subtle:"linear-gradient(180deg, rgba(255,255,255,0.05) 0%, rgba(255,255,255,0) 100%)",card:"linear-gradient(135deg, rgba(255,255,255,0.1) 0%, rgba(255,255,255,0.05) 100%)",glow:"radial-gradient(circle at 50% 0%, rgba(226,19,80,0.15) 0%, transparent 70%)",intelligent:"linear-gradient(135deg, rgba(139,92,246,0.1) 0%, rgba(139,92,246,0.05) 100%)"},shadows:{sm:"0 1px 2px 0 rgba(0, 0, 0, 0.05)",DEFAULT:"0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06)",md:"0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06)",lg:"0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05)",xl:"0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04)",glow:"0 0 20px rgba(226,19,80,0.3)","glow-intelligent":"0 0 20px rgba(139,92,246,0.3)"},radius:{sm:"0.25rem",DEFAULT:"0.375rem",md:"0.5rem",lg:"0.75rem",xl:"1rem","2xl":"1.5rem",full:"9999px"},spacing:{xs:"0.5rem",sm:"0.75rem",DEFAULT:"1rem",md:"1.5rem",lg:"2rem",xl:"3rem","2xl":"4rem"},typography:{fonts:{sans:'Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif',mono:'"JetBrains Mono", "SF Mono", Monaco, Consolas, "Liberation Mono", "Courier New", monospace'},sizes:{xs:"0.75rem",sm:"0.875rem",base:"1rem",lg:"1.125rem",xl:"1.25rem","2xl":"1.5rem","3xl":"1.875rem","4xl":"2.25rem"},weights:{light:"300",normal:"400",medium:"500",semibold:"600",bold:"700"}},transitions:{fast:"150ms",DEFAULT:"200ms",slow:"300ms",timing:"cubic-bezier(0.4, 0, 0.2, 1)"},zIndex:{base:0,elevated:10,dropdown:20,sticky:30,fixed:40,modal:50,popover:60,tooltip:70},opacity:{hover:.8,disabled:.5,backdrop:.7,subtle:.1}},Vce=(e=false)=>{let t=e?Ns.colors.dark:Ns.colors.light;return {"--color-bg-primary":t.bg.primary,"--color-bg-secondary":t.bg.secondary,"--color-bg-tertiary":t.bg.tertiary,"--color-bg-elevated":t.bg.elevated,"--color-border":t.border.DEFAULT,"--color-border-subtle":t.border.subtle,"--color-border-strong":t.border.strong,"--color-text":e?"#ffffff":"#000000","--color-text-secondary":e?"#a1a1aa":"#6b7280","--color-text-tertiary":e?"#71717a":"#9ca3af"}};var iO=createContext(void 0);function RU({children:e,defaultMode:t="system",theme:r=Ns,customColors:n,persistPreference:o=true}){let[a,i]=useState({mode:t,theme:r,customColors:n}),[s,l]=useState(false);useEffect(()=>{if(o){let g=localStorage.getItem("theme-mode");g&&i(p=>({...p,mode:g}));}},[o]),useEffect(()=>{let g=document.documentElement;if(a.mode==="system"){let p=window.matchMedia("(prefers-color-scheme: dark)"),f=p.matches;l(f),g.classList.toggle("dark",f);let m=b=>{let h=b.matches;l(h),g.classList.toggle("dark",h);};return p.addEventListener("change",m),()=>{p.removeEventListener("change",m);}}else {let p=a.mode==="dark";l(p),g.classList.toggle("dark",p);return}},[a.mode]),useEffect(()=>{if(n){let g=document.documentElement;if(n.primary){let p=Yf(n.primary);g.style.setProperty("--primary",p);}if(n.secondary){let p=Yf(n.secondary);g.style.setProperty("--secondary",p);}if(n.accent){let p=Yf(n.accent);g.style.setProperty("--accent",p);}}},[n]);let c=g=>{i(p=>({...p,mode:g})),o&&localStorage.setItem("theme-mode",g);},u={themeConfig:a,setThemeMode:c,toggleTheme:()=>{c(s?"light":"dark");},isDark:s};return jsx(iO.Provider,{value:u,children:e})}function Rs(){let e=useContext(iO);if(!e)throw new Error("useTheme must be used within a ThemeProvider");return e}function Yf(e){e=e.replace("#","");let t=parseInt(e.substr(0,2),16)/255,r=parseInt(e.substr(2,2),16)/255,n=parseInt(e.substr(4,2),16)/255,o=Math.max(t,r,n),a=Math.min(t,r,n),i=0,s=0,l=(o+a)/2;if(o!==a){let c=o-a;switch(s=l>.5?c/(2-o-a):c/(o+a),o){case t:i=((r-n)/c+(r<n?6:0))/6;break;case r:i=((n-t)/c+2)/6;break;case n:i=((t-r)/c+4)/6;break}}return `${Math.round(i*360)} ${Math.round(s*100)}% ${Math.round(l*100)}%`}function OU({className:e,showLabel:t=true,variant:r="select"}){let{themeConfig:n,setThemeMode:o,toggleTheme:a,isDark:i}=Rs();return r==="button"?jsxs("div",{className:R("flex items-center gap-2",e),children:[t&&jsx(Rt,{children:"Theme"}),jsx(Y,{variant:"outline",size:"icon",onClick:a,className:"w-10 h-10",children:i?jsx(Sun,{className:"h-4 w-4"}):jsx(Moon,{className:"h-4 w-4"})})]}):jsxs("div",{className:R("flex flex-col gap-2",e),children:[t&&jsx(Rt,{htmlFor:"theme-select",children:"Theme"}),jsxs(Et,{value:n.mode,onValueChange:s=>o(s),children:[jsx(pt,{id:"theme-select",className:"w-[180px]",children:jsx(wt,{placeholder:"Select theme"})}),jsxs(gt,{children:[jsx(Fe,{value:"light",children:jsxs("div",{className:"flex items-center gap-2",children:[jsx(Sun,{className:"h-4 w-4"}),jsx("span",{children:"Light"})]})}),jsx(Fe,{value:"dark",children:jsxs("div",{className:"flex items-center gap-2",children:[jsx(Moon,{className:"h-4 w-4"}),jsx("span",{children:"Dark"})]})}),jsx(Fe,{value:"system",children:jsxs("div",{className:"flex items-center gap-2",children:[jsx(Monitor,{className:"h-4 w-4"}),jsx("span",{children:"System"})]})})]})]})]})}function LU({className:e}){let{toggleTheme:t,isDark:r}=Rs();return jsx(Y,{variant:"ghost",size:"icon",onClick:t,className:R("w-8 h-8",e),title:`Switch to ${r?"light":"dark"} theme`,children:r?jsx(Sun,{className:"h-4 w-4"}):jsx(Moon,{className:"h-4 w-4"})})}var zU=[{id:"general",label:"General",description:"Basic application settings",icon:jsx(Settings,{className:"h-4 w-4"}),settings:[]},{id:"network",label:"Network",description:"Network and connectivity",icon:jsx(Network,{className:"h-4 w-4"}),settings:[]},{id:"logging",label:"Logging",description:"Logging configuration",icon:jsx(FileText,{className:"h-4 w-4"}),settings:[]},{id:"security",label:"Security",description:"Security settings",icon:jsx(Shield,{className:"h-4 w-4"}),settings:[]},{id:"notifications",label:"Notifications",description:"Email and alerts",icon:jsx(Mail,{className:"h-4 w-4"}),settings:[]},{id:"appearance",label:"Appearance",description:"UI preferences",icon:jsx(Palette,{className:"h-4 w-4"}),settings:[]},{id:"advanced",label:"Advanced",description:"Advanced settings",icon:jsx(Activity,{className:"h-4 w-4"}),settings:[]}];function UU(e,t,r,n){return {id:e,label:t,description:n,icon:HU[r]||jsx(Settings,{className:"h-4 w-4"})}}var HU={Server:jsx(Server,{className:"h-4 w-4"}),Network:jsx(Network,{className:"h-4 w-4"}),FileText:jsx(FileText,{className:"h-4 w-4"}),Shield:jsx(Shield,{className:"h-4 w-4"}),Mail:jsx(Mail,{className:"h-4 w-4"}),Settings:jsx(Settings,{className:"h-4 w-4"}),Database:jsx(Database,{className:"h-4 w-4"}),Bell:jsx(Bell,{className:"h-4 w-4"}),Users:jsx(Users,{className:"h-4 w-4"}),Palette:jsx(Palette,{className:"h-4 w-4"}),Globe:jsx(Globe,{className:"h-4 w-4"}),Activity:jsx(Activity,{className:"h-4 w-4"})};function WU({apiUrl:e="/api/updates",checkInterval:t=36e5,onDownload:r}){let[n,o]=useState(null),[a,i]=useState(false),[s,l]=useState(false),[c,d]=useState(false);useEffect(()=>{u();let f=setInterval(u,t);return ()=>clearInterval(f)},[t]);let u=async(f=false)=>{i(true);try{let m=await fetch(`${e}/check${f?"?force=true":""}`);if(m.ok){let b=await m.json();o(b),b.updateAvailable&&s&&localStorage.getItem("dismissedUpdateVersion")!==b.latestRelease?.version&&l(!1);}}catch(m){console.error("Failed to check for updates:",m);}finally{i(false);}},g=()=>{l(true),n?.latestRelease&&localStorage.setItem("dismissedUpdateVersion",n.latestRelease.version);},p=async()=>{if(r&&n)r(n);else try{let f=await fetch(`${e}/download-url`);if(f.ok){let{url:m}=await f.json();window.open(m,"_blank");}}catch{n?.latestRelease?.url&&window.open(n.latestRelease.url,"_blank");}};return !n?.updateAvailable||s?null:jsx("div",{className:"fixed bottom-4 right-4 z-50 max-w-md animate-in slide-in-from-bottom-2",children:jsxs(st,{className:"border-green-500 bg-green-50 dark:bg-green-950/20",children:[jsx(Download,{className:"h-4 w-4 text-green-600 dark:text-green-400"}),jsxs(lt,{className:"pr-8",children:[jsxs("div",{className:"font-semibold text-green-800 dark:text-green-200 mb-1",children:["Update Available: v",n.latestRelease?.version]}),jsx("div",{className:"text-sm text-green-700 dark:text-green-300 mb-3",children:n.latestRelease?.name||"A new version is available"}),c&&n.latestRelease?.body&&jsx("div",{className:"mt-3 p-2 bg-white/50 dark:bg-black/20 rounded text-xs",children:jsx("pre",{className:"whitespace-pre-wrap font-sans",children:n.latestRelease.body})}),jsxs("div",{className:"flex gap-2 mt-3",children:[jsxs(Y,{size:"sm",variant:"default",onClick:p,className:"bg-green-600 hover:bg-green-700",children:[jsx(Download,{className:"h-3 w-3 mr-1"}),"Download"]}),jsxs(Y,{size:"sm",variant:"outline",onClick:()=>d(!c),children:[c?"Hide":"Show"," Changes"]}),jsx(Y,{size:"sm",variant:"ghost",onClick:()=>window.open(n.latestRelease?.url,"_blank"),children:jsx(ExternalLink,{className:"h-3 w-3"})})]})]}),jsx(Y,{size:"sm",variant:"ghost",className:"absolute top-2 right-2 h-6 w-6 p-0",onClick:g,children:jsx(X,{className:"h-4 w-4"})})]})})}function YU(e,t){let[r,n]=useState(e);return useEffect(()=>{let o=setTimeout(()=>{n(e);},t);return ()=>{clearTimeout(o);}},[e,t]),r}function KU(e){let[t,r]=po(e);return {connected:t.connected,connecting:t.connecting,transport:t.transport,error:t.error,retryCount:t.retryCount,reconnect:r.reconnect}}var Qf=class{constructor(t={}){this.config={loginEndpoint:t.loginEndpoint||"/api/login",logoutEndpoint:t.logoutEndpoint||"/api/logout",refreshEndpoint:t.refreshEndpoint||"/api/refresh",tokenKey:t.tokenKey||"auth_token",authKey:t.authKey||"authenticated",tokenExpiry:t.tokenExpiry||36e5};}async login(t,r){try{let n=await fetch(this.config.loginEndpoint,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:t,password:r})}),o=await n.json();return n.ok&&o.success?(localStorage.setItem(this.config.authKey,"true"),o.token&&(localStorage.setItem(this.config.tokenKey,o.token),this.scheduleTokenRefresh(o.expiresIn||this.config.tokenExpiry)),o.user&&localStorage.setItem("user",JSON.stringify(o.user)),{success:!0,token:o.token,user:o.user,expiresIn:o.expiresIn}):{success:!1,error:o.error||"Invalid credentials"}}catch(n){return console.error("Login error:",n),{success:false,error:"Login failed. Please try again."}}}async logout(){try{let t=this.getToken();t&&await fetch(this.config.logoutEndpoint,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${t}`}});}catch(t){console.error("Logout error:",t);}finally{localStorage.removeItem(this.config.authKey),localStorage.removeItem(this.config.tokenKey),localStorage.removeItem("user"),this.refreshTimer&&clearTimeout(this.refreshTimer);}}isAuthenticated(){return localStorage.getItem(this.config.authKey)==="true"}getToken(){return localStorage.getItem(this.config.tokenKey)}getUser(){let t=localStorage.getItem("user");if(t)try{return JSON.parse(t)}catch{return null}return null}async refreshToken(){try{let t=this.getToken();if(!t)return !1;let r=await fetch(this.config.refreshEndpoint,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${t}`}});if(r.ok){let n=await r.json();if(n.token)return localStorage.setItem(this.config.tokenKey,n.token),this.scheduleTokenRefresh(n.expiresIn||this.config.tokenExpiry),!0}return !1}catch(t){return console.error("Token refresh error:",t),false}}scheduleTokenRefresh(t){this.refreshTimer&&clearTimeout(this.refreshTimer);let r=Math.max(0,t-3e5);this.refreshTimer=setTimeout(()=>{this.refreshToken();},r);}async authenticatedFetch(t,r={}){let n=this.getToken(),o=new Headers(r.headers);n&&o.set("Authorization",`Bearer ${n}`);let a=await fetch(t,{...r,headers:o});if(a.status===401&&await this.refreshToken()){let s=this.getToken();return s&&o.set("Authorization",`Bearer ${s}`),fetch(t,{...r,headers:o})}return a}requireAuth(t="/login"){return this.isAuthenticated()?true:(window.location.href=t,false)}},XU=new Qf;var vue={base:"transition-all duration-200",interactive:"hover:shadow-md hover:border-gray-300 dark:hover:border-gray-700 cursor-pointer",elevation:"shadow-sm"},Tue={primary:"gap-2",icon:"h-4 w-4"},Aue={container:"flex flex-col items-center justify-center py-12 text-center",icon:"h-12 w-12 text-muted-foreground mb-4",title:"text-lg font-medium mb-2",description:"text-sm text-muted-foreground max-w-sm"},Cue={led:"w-2 h-2 rounded-full transition-all duration-200",pulse:"animate-pulse",colors:{read:"bg-green-500",write:"bg-blue-500",inactive:"bg-gray-400",error:"bg-red-500"}},Nue={badge:{success:"bg-green-100 text-green-800 dark:bg-green-900 dark:text-green-200",warning:"bg-yellow-100 text-yellow-800 dark:bg-yellow-900 dark:text-yellow-200",error:"bg-red-100 text-red-800 dark:bg-red-900 dark:text-red-200",info:"bg-blue-100 text-blue-800 dark:bg-blue-900 dark:text-blue-200",default:"bg-gray-100 text-gray-800 dark:bg-gray-800 dark:text-gray-200"}};var QU=25,JU=[10,25,50,100];function qo({data:e,pageSize:t=QU,storageKey:r}){let[n,o]=useState(()=>{if(r)try{let h=localStorage.getItem(`pagination-${r}`);if(h)return {page:1,pageSize:JSON.parse(h).pageSize||t}}catch{}return {page:1,pageSize:t}}),{page:a,pageSize:i}=n,s=useMemo(()=>Math.max(1,Math.ceil(e.length/i)),[e.length,i]);useEffect(()=>{a>s&&o(h=>({...h,page:Math.max(1,s)}));},[s,a]),useEffect(()=>{if(r)try{localStorage.setItem(`pagination-${r}`,JSON.stringify({pageSize:i}));}catch{}},[i,r]);let l=(a-1)*i,c=Math.min(l+i,e.length),d=useMemo(()=>e.slice(l,c),[e,l,c]),u=useCallback(h=>{o(S=>({...S,page:Math.max(1,Math.min(h,s))}));},[s]),g=useCallback(h=>{o({page:1,pageSize:h});},[]),p=useCallback(()=>{u(a+1);},[a,u]),f=useCallback(()=>{u(a-1);},[a,u]),m=useCallback(()=>{u(1);},[u]),b=useCallback(()=>{u(s);},[s,u]);return {paginatedData:d,page:a,pageSize:i,totalPages:s,totalItems:e.length,setPage:u,setPageSize:g,nextPage:p,prevPage:f,firstPage:m,lastPage:b,startIndex:l+1,endIndex:c,canGoNext:a<s,canGoPrev:a>1,pageSizeOptions:JU}}function Wo({columns:e,storageKey:t}){let r=`column-visibility-${t}`,[n,o]=useState(()=>{let c={};if(e.forEach(d=>{c[d.id]=d.defaultVisible!==false;}),typeof window>"u")return c;try{let d=localStorage.getItem(r);if(d){let u=JSON.parse(d),g={};return e.forEach(p=>{p.locked?g[p.id]=!0:u[p.id]!==void 0?g[p.id]=u[p.id]:g[p.id]=p.defaultVisible!==!1;}),g}}catch(d){console.error("Error loading column visibility state:",d);}return c});useEffect(()=>{if(!(typeof window>"u"))try{localStorage.setItem(r,JSON.stringify(n));}catch(c){console.error("Error saving column visibility state:",c);}},[n,r]);let a=useCallback(c=>e.find(u=>u.id===c)?.locked?true:n[c]!==false,[n,e]),i=useCallback(c=>{e.find(u=>u.id===c)?.locked||o(u=>({...u,[c]:!u[c]}));},[e]),s=useCallback(()=>{let c={};e.forEach(d=>{c[d.id]=true;}),o(c);},[e]),l=useCallback(()=>{let c={};e.forEach(d=>{c[d.id]=d.locked===true;}),o(c);},[e]);return {visibleColumns:n,isColumnVisible:a,toggleColumn:i,showAllColumns:s,hideAllColumns:l,columns:e}}var bO=50,Ls=150,n6=3;function jo({tableId:e,columns:t,storageKey:r}){let n=r||`table-columns-${e}`,o=useCallback(()=>t.reduce((C,k)=>(C[k.key]=k.defaultWidth||Ls,C),{}),[t]),[a,i]=useState(()=>{try{let C=localStorage.getItem(n);if(C){let k=JSON.parse(C);return {widths:{...o(),...k},isResizing:!1,resizingColumn:null}}}catch{}return {widths:o(),isResizing:false,resizingColumn:null}}),s=useRef(0),l=useRef(0),c=useRef(null),d=useRef(false),u=useRef(t);useEffect(()=>{u.current=t;},[t]);let g=useCallback(C=>u.current.find(k=>k.key===C),[]);useEffect(()=>{try{localStorage.setItem(n,JSON.stringify(a.widths));}catch{}},[a.widths,n]);let p=useRef(null);p.current||(p.current={onPointerMove:C=>{if(!c.current)return;let k=C.clientX-s.current;if(!d.current){if(Math.abs(k)<n6)return;d.current=true,i(G=>({...G,isResizing:true,resizingColumn:c.current})),document.body.style.cursor="col-resize",document.body.style.userSelect="none";}let D=g(c.current),P=D?.minWidth||bO,A=D?.maxWidth,v=Math.max(P,l.current+k);A&&(v=Math.min(A,v)),i(G=>({...G,widths:{...G.widths,[c.current]:v}}));},onPointerUp:()=>{c.current=null,d.current=false,i(C=>({...C,isResizing:false,resizingColumn:null})),document.removeEventListener("pointermove",p.current.onPointerMove),document.removeEventListener("pointerup",p.current.onPointerUp),document.removeEventListener("pointercancel",p.current.onPointerUp),document.body.style.cursor="",document.body.style.userSelect="";}}),useEffect(()=>()=>{p.current&&(document.removeEventListener("pointermove",p.current.onPointerMove),document.removeEventListener("pointerup",p.current.onPointerUp),document.removeEventListener("pointercancel",p.current.onPointerUp)),document.body.style.cursor="",document.body.style.userSelect="";},[]);let f=useRef(a.widths);useEffect(()=>{f.current=a.widths;},[a.widths]);let m=useCallback((C,k)=>{s.current=k,l.current=f.current[C]||Ls,c.current=C,d.current=false,document.addEventListener("pointermove",p.current.onPointerMove),document.addEventListener("pointerup",p.current.onPointerUp),document.addEventListener("pointercancel",p.current.onPointerUp);},[]),b=useCallback(C=>({onPointerDown:k=>{k.preventDefault(),k.stopPropagation(),m(C,k.clientX);},onMouseDown:k=>{k.preventDefault(),k.stopPropagation();},draggable:false,onDragStart:k=>{k.preventDefault(),k.stopPropagation();},className:"resize-handle","data-resizing":a.resizingColumn===C}),[m,a.resizingColumn]),h=useCallback(C=>{let k=a.widths[C]||Ls,P=g(C)?.minWidth||bO;return {width:k,minWidth:P,position:"relative"}},[a.widths,g]),S=t.reduce((C,k)=>C+(a.widths[k.key]||k.defaultWidth||Ls),0),w=useCallback(()=>({minWidth:S}),[S]),N=useCallback(()=>{i(C=>({...C,widths:o()}));},[o]);return {widths:a.widths,isResizing:a.isResizing,totalWidth:S,getResizeHandleProps:b,getColumnStyle:h,getTableStyle:w,resetToDefaults:N}}function Vo({storageKey:e,defaultOrder:t}){let[r,n]=useState(()=>{try{let l=localStorage.getItem(e);if(l){let c=JSON.parse(l),d=new Set(c),u=new Set(t),g=c.filter(f=>u.has(f)),p=t.filter(f=>!d.has(f));if(p.length>0){let f=[...g];for(let m of p){let b=t.indexOf(m),h=f.length;for(let S=0;S<f.length;S++)if(t.indexOf(f[S])>b){h=S;break}f.splice(h,0,m);}return f}return g.length>0?g:t}}catch(l){console.warn("Failed to load column order from localStorage:",l);}return t});useEffect(()=>{try{localStorage.setItem(e,JSON.stringify(r));}catch(l){console.warn("Failed to save column order to localStorage:",l);}},[e,r]);let o=useCallback((l,c)=>{l!==c&&n(d=>{let u=[...d],[g]=u.splice(l,1);return g!==void 0&&u.splice(c,0,g),u});},[]),a=useCallback((l,c)=>{n(d=>{let u=d.indexOf(l);if(u===-1)return d;let g=c==="left"?Math.max(0,u-1):Math.min(d.length-1,u+1);if(u===g)return d;let p=[...d],[f]=p.splice(u,1);return f!==void 0&&p.splice(g,0,f),p});},[]),i=useCallback(()=>{n(t);},[t]),s=useCallback(l=>{let c=new Map(l.map(d=>[d.id,d]));return r.map(d=>c.get(d)).filter(d=>d!==void 0)},[r]);return {columnOrder:r,moveColumn:o,moveColumnById:a,resetOrder:i,getOrderedColumns:s}}function Yo(e,t,r=[]){let[n,o]=useState({isDragging:false,draggedId:null,dropIndex:null}),a=useCallback(u=>{r.includes(u)||o({isDragging:true,draggedId:u,dropIndex:null});},[r]),i=useCallback((u,g)=>{if(r.includes(u))return;let p=e.indexOf(u);if(p===-1)return;let f=g.currentTarget.getBoundingClientRect(),m=f.left+f.width/2,b=g.clientX<m?p:p+1;o(h=>({...h,dropIndex:b}));},[r,e]),s=useCallback(()=>{if(!n.draggedId||n.dropIndex===null){o({isDragging:false,draggedId:null,dropIndex:null});return}let u=e.indexOf(n.draggedId),g=n.dropIndex;u<g&&(g=g-1),u!==-1&&g!==-1&&u!==g&&t(u,g),o({isDragging:false,draggedId:null,dropIndex:null});},[n.draggedId,n.dropIndex,e,t]),l=useCallback(()=>{o({isDragging:false,draggedId:null,dropIndex:null});},[]),c=useCallback(u=>({draggable:!r.includes(u),onDragStart:g=>{if(r.includes(u)){g.preventDefault();return}g.dataTransfer.effectAllowed="move",a(u);},onDragOver:g=>{g.preventDefault(),g.dataTransfer.dropEffect="move",i(u,g);},onDrop:g=>{g.preventDefault(),s();},onDragEnd:l}),[r,a,i,s,l]),d=useCallback(u=>!n.isDragging||n.dropIndex===null?false:e.indexOf(u)===n.dropIndex,[n.isDragging,n.dropIndex,e]);return {dragState:n,getDragHandleProps:c,showDropIndicator:d}}function Ko({page:e,pageSize:t,totalPages:r,totalItems:n,startIndex:o,endIndex:a,canGoNext:i,canGoPrev:s,pageSizeOptions:l,onPageChange:c,onPageSizeChange:d,onNextPage:u,onPrevPage:g,onFirstPage:p,onLastPage:f,className:m}){let b=()=>{let h=[],w=Math.floor(2.5),N=Math.max(1,e-w),C=Math.min(r,e+w);e<=w&&(C=Math.min(r,5)),e>r-w&&(N=Math.max(1,r-5+1)),N>1&&(h.push(1),N>2&&h.push("ellipsis"));for(let k=N;k<=C;k++)k!==1&&k!==r&&h.push(k);return C<r&&(C<r-1&&h.push("ellipsis"),h.push(r)),h};return n===0?null:jsxs("div",{className:R("flex flex-col sm:flex-row items-center justify-between gap-4 px-2 py-3",m),children:[jsxs("div",{className:"text-sm text-muted-foreground",children:["Showing ",o," to ",a," of ",n," items"]}),jsxs("div",{className:"flex items-center gap-4",children:[jsxs("div",{className:"flex items-center gap-2",children:[jsx("span",{className:"text-sm text-muted-foreground",children:"Per page:"}),jsxs(Et,{value:String(t),onValueChange:h=>d(Number(h)),children:[jsx(pt,{className:"w-20 h-8",children:jsx(wt,{})}),jsx(gt,{children:l.map(h=>jsx(Fe,{value:String(h),children:h},h))})]})]}),jsxs("div",{className:"flex items-center gap-1",children:[jsx(Y,{variant:"outline",size:"icon",className:"h-8 w-8",onClick:p,disabled:!s,title:"First page",children:jsx(ChevronsLeft,{className:"h-4 w-4"})}),jsx(Y,{variant:"outline",size:"icon",className:"h-8 w-8",onClick:g,disabled:!s,title:"Previous page",children:jsx(ChevronLeft,{className:"h-4 w-4"})}),jsx("div",{className:"flex items-center gap-1",children:b().map((h,S)=>h==="ellipsis"?jsx("span",{className:"px-2 text-muted-foreground",children:"..."},`ellipsis-${S}`):jsx(Y,{variant:e===h?"default":"outline",size:"icon",className:"h-8 w-8",onClick:()=>c(h),children:h},h))}),jsx(Y,{variant:"outline",size:"icon",className:"h-8 w-8",onClick:u,disabled:!i,title:"Next page",children:jsx(ChevronRight,{className:"h-4 w-4"})}),jsx(Y,{variant:"outline",size:"icon",className:"h-8 w-8",onClick:f,disabled:!i,title:"Last page",children:jsx(ChevronsRight,{className:"h-4 w-4"})})]})]})]})}function Jf({data:e,columns:t,storageKey:r,getRowId:n,selectable:o=false,selectedIds:a,onSelectionChange:i,onRowClick:s,onRowContextMenu:l,sortField:c,sortOrder:d,onSort:u,actionsColumn:g,actionsColumnWidth:p=80,pageSize:f=25,pagination:m,hidePagination:b=false,className:h,rowClassName:S,enableHeaderContextMenu:w=true,lockedColumns:N=[],defaultColumnOrder:C,loading:k=false,emptyState:D}){let P=useMemo(()=>{let H=[];return o&&H.push({key:"select",defaultWidth:40,minWidth:40}),t.forEach(ie=>{H.push({key:ie.id,defaultWidth:ie.width?.default??150,minWidth:ie.width?.min??80,maxWidth:ie.width?.max});}),g&&H.push({key:"actions",defaultWidth:p,minWidth:60}),H},[t,o,g,p]),A=useMemo(()=>t.map(H=>({id:H.id,label:typeof H.header=="string"?H.header:H.id,defaultVisible:H.visibility?.default??true,locked:H.visibility?.locked})),[t]),v=useMemo(()=>{if(C)return C;let H=[];return o&&H.push("select"),t.forEach(ie=>H.push(ie.id)),g&&H.push("actions"),H},[C,t,o,g]),{getResizeHandleProps:G,getColumnStyle:_,getTableStyle:M}=jo({tableId:r,columns:P}),O=Wo({columns:A,storageKey:r}),{columnOrder:B,moveColumn:W}=Vo({storageKey:`${r}-order`,defaultOrder:v}),{dragState:V,getDragHandleProps:re,showDropIndicator:Z}=Yo(B,W,[...N,"select","actions"]),x=qo({data:e,pageSize:f,storageKey:r}),z=m||x,[Q,T]=useState(null),ye=useCallback(H=>{w&&(H.preventDefault(),T({x:H.clientX,y:H.clientY}));},[w]);useEffect(()=>{if(!Q)return;let H=()=>T(null);return window.addEventListener("click",H),()=>{window.removeEventListener("click",H);}},[Q]);let _e=useMemo(()=>!o||!a||z.paginatedData.length===0?false:z.paginatedData.every(H=>a.has(n(H))),[o,a,z.paginatedData,n]),Pe=useMemo(()=>{if(!o||!a)return false;let H=z.paginatedData.filter(ie=>a.has(n(ie)));return H.length>0&&H.length<z.paginatedData.length},[o,a,z.paginatedData,n]),Ue=useCallback(H=>{if(!i||!a)return;let ie=new Set(a);ie.has(H)?ie.delete(H):ie.add(H),i(ie);},[a,i]),Se=useCallback(()=>{if(!i)return;let H=new Set(z.paginatedData.map(n));i(H);},[z.paginatedData,n,i]),at=useCallback(()=>{i&&i(new Set);},[i]),xe=useCallback(H=>c!==H?jsx(ArrowUpDown,{className:"h-3.5 w-3.5 text-muted-foreground"}):d==="asc"?jsx(ChevronUp,{className:"h-3.5 w-3.5"}):jsx(ChevronDown,{className:"h-3.5 w-3.5"}),[c,d]),Qe=useCallback(H=>t.find(ie=>ie.id===H),[t]),it=useCallback(H=>{let ie={columnId:H.id,isSorted:c===H.sortKey,sortDirection:c===H.sortKey?d:void 0};return typeof H.header=="function"?H.header(ie):H.sortKey&&u?jsxs("button",{onClick:()=>u(H.sortKey),className:R("flex items-center gap-1 hover:text-foreground transition-colors",c===H.sortKey&&"text-primary font-medium"),children:[H.header,xe(H.sortKey)]}):H.header},[c,d,u,xe]);return jsx(aa,{children:jsxs(Fragment,{children:[jsx("div",{className:"overflow-auto border rounded-lg max-h-[calc(100vh-16rem)]",children:jsxs(no,{style:M(),className:R("resizable-table sticky-actions-table",h),children:[jsx(oo,{className:"sticky top-0 z-20 bg-muted",children:jsxs(br,{onContextMenu:ye,className:"border-t-0",children:[B.map(H=>{if(H==="select"&&o)return jsx(Zr,{className:"sticky-select-header w-10 sticky left-0 z-20 bg-muted relative after:absolute after:right-0 after:top-0 after:bottom-0 after:w-px after:bg-border",children:jsx("input",{type:"checkbox",checked:_e,ref:I=>{I&&(I.indeterminate=Pe);},onChange:I=>I.target.checked?Se():at(),className:"h-4 w-4 rounded border-gray-300 text-primary focus:ring-primary cursor-pointer",title:_e?"Deselect all":"Select all visible"})},"select");let ie=Qe(H);return !ie||!O.isColumnVisible(H)?null:jsxs(Zr,{style:_(H),...re(H),className:R("cursor-grab relative",V.draggedId===H&&"column-dragging opacity-50",Z(H)&&"drop-indicator"),children:[it(ie),jsx("div",{...G(H)})]},H)}),g&&jsx(Zr,{className:"sticky right-0 z-20 bg-muted text-center relative before:absolute before:left-0 before:top-0 before:bottom-0 before:w-px before:bg-border",style:{width:p,minWidth:p,maxWidth:p},children:"Actions"})]})}),jsx(ao,{children:k?jsx(br,{children:jsx(hr,{colSpan:B.length+(g?1:0),className:"!p-0 h-32",children:jsx("div",{className:"sticky left-0 w-screen max-w-full h-full bg-background flex justify-center items-center",children:jsxs("div",{className:"flex items-center gap-2 text-muted-foreground",children:[jsx(Loader2,{className:"h-5 w-5 animate-spin"}),"Loading..."]})})})}):z.paginatedData.length===0?null:z.paginatedData.map(H=>{let ie=n(H),I=a?.has(ie)??false;return jsxs(br,{className:R("group cursor-pointer bg-background hover:bg-muted transition-none",I&&"bg-primary/5",S?.(H)),onClick:()=>s?.(H),onContextMenu:ee=>{l&&(ee.preventDefault(),l(H,{x:ee.clientX,y:ee.clientY}));},children:[B.map(ee=>{if(ee==="select"&&o)return jsx(hr,{className:R("sticky-select-cell w-10 sticky left-0 z-10 relative after:absolute after:right-0 after:top-0 after:bottom-0 after:w-px after:bg-border","bg-background group-hover:bg-muted",I&&"bg-primary/5 group-hover:bg-primary/10"),onClick:Ve=>Ve.stopPropagation(),children:jsx("input",{type:"checkbox",checked:I,onChange:()=>Ue(ie),className:"h-4 w-4 rounded border-gray-300 text-primary focus:ring-primary cursor-pointer"})},"select");let se=Qe(ee);if(!se||!O.isColumnVisible(ee))return null;let Ce={columnId:ee,isDragging:V.draggedId===ee};return jsx(hr,{style:_(ee),className:R(se.className,V.draggedId===ee&&"column-dragging"),children:se.cell(H,Ce)},ee)}),g&&jsx(hr,{className:R("sticky right-0 z-10 text-center relative before:absolute before:left-0 before:top-0 before:bottom-0 before:w-px before:bg-border","bg-background group-hover:bg-muted",I&&"bg-primary/5 group-hover:bg-primary/10"),style:{width:p,minWidth:p,maxWidth:p},onClick:ee=>ee.stopPropagation(),children:g(H)})]},ie)})})]})}),!k&&z.paginatedData.length===0&&jsx("div",{className:"empty-state-container flex-1 flex items-center justify-center bg-background",children:D||jsx("span",{className:"block text-center text-muted-foreground py-8",children:"No data"})}),!b&&!k&&z.totalPages>1&&jsx(Ko,{page:z.page,pageSize:z.pageSize,totalItems:z.totalItems,totalPages:z.totalPages,startIndex:z.startIndex,endIndex:z.endIndex,canGoPrev:z.canGoPrev,canGoNext:z.canGoNext,onPageChange:z.setPage,onPageSizeChange:z.setPageSize,onNextPage:z.nextPage,onPrevPage:z.prevPage,onFirstPage:"firstPage"in z?z.firstPage:()=>z.setPage(1),onLastPage:"lastPage"in z?z.lastPage:()=>z.setPage(z.totalPages),pageSizeOptions:z.pageSizeOptions}),Q&&jsxs("div",{className:"fixed z-50 min-w-[200px] overflow-y-auto rounded-md border bg-popover p-1 text-popover-foreground shadow-md animate-in fade-in-0 zoom-in-95",style:{top:Q.y,left:Q.x,maxHeight:`calc(100vh - ${Q.y}px - 20px)`},onClick:H=>H.stopPropagation(),children:[jsx("div",{className:"px-2 py-1.5 text-xs font-medium text-muted-foreground",children:"Toggle columns"}),jsx("div",{className:"h-px bg-border my-1"}),O.columns.map(H=>{let ie=O.isColumnVisible(H.id),I=H.locked===true;return jsxs("button",{onClick:()=>!I&&O.toggleColumn(H.id),disabled:I,className:R("flex items-center gap-2 w-full px-2 py-1.5 text-sm rounded-sm hover:bg-accent",I&&"opacity-50 cursor-not-allowed"),children:[jsx("div",{className:"w-4 h-4 flex items-center justify-center",children:ie&&jsx(Check,{className:"h-3.5 w-3.5 text-primary"})}),jsx("span",{className:"flex-1 text-left",children:H.label}),I&&jsx("span",{className:"text-xs text-muted-foreground",children:"Required"})]},H.id)}),jsx("div",{className:"h-px bg-border my-1"}),jsxs("button",{onClick:()=>O.showAllColumns(),className:"flex items-center gap-2 w-full px-2 py-1.5 text-sm rounded-sm hover:bg-accent",children:[jsx(Eye,{className:"h-4 w-4"}),"Show All"]}),jsxs("button",{onClick:()=>O.hideAllColumns(),className:"flex items-center gap-2 w-full px-2 py-1.5 text-sm rounded-sm hover:bg-accent",children:[jsx(EyeOff,{className:"h-4 w-4"}),"Hide Optional"]})]})]})})}function Zo({page:e,pageSize:t,totalPages:r,totalItems:n,startIndex:o,endIndex:a,canGoNext:i,canGoPrev:s,pageSizeOptions:l,setPage:c,setPageSize:d,nextPage:u,prevPage:g,className:p}){return n===0?null:jsxs("div",{className:R("flex items-center gap-3 text-sm",p),children:[jsxs("div",{className:"hidden md:flex items-center gap-1.5",children:[jsx("span",{className:"text-muted-foreground hidden lg:inline",children:"Rows:"}),jsxs(Et,{value:String(t),onValueChange:f=>d(Number(f)),children:[jsx(pt,{className:"w-16 h-8 text-xs",children:jsx(wt,{})}),jsx(gt,{children:l.map(f=>jsx(Fe,{value:String(f),children:f},f))})]})]}),r>1&&jsxs("div",{className:"flex items-center gap-1",children:[jsx(Y,{variant:"outline",size:"icon",className:"h-8 w-8",onClick:g,disabled:!s,title:"Previous page",children:jsx(ChevronLeft,{className:"h-4 w-4"})}),jsxs("span",{className:"hidden sm:inline px-2 text-muted-foreground tabular-nums min-w-[60px] text-center",children:[e," / ",r]}),jsx(Y,{variant:"outline",size:"icon",className:"h-8 w-8",onClick:u,disabled:!i,title:"Next page",children:jsx(ChevronRight,{className:"h-4 w-4"})})]}),jsxs("span",{className:"text-muted-foreground whitespace-nowrap hidden lg:inline",children:["Showing ",o,"\u2013",a," of ",n]})]})}function eb({title:e,description:t,search:r,onSearchChange:n,searchPlaceholder:o="Search...",filters:a,activeFilterCount:i=0,onClearFilters:s,pagination:l,actions:c,beforeTable:d,children:u,className:g,loading:p,loadingComponent:f}){let m=l&&l.totalItems>0;return jsxs("div",{className:R("flex flex-col h-full",g),children:[jsxs("div",{className:"data-table-page-header flex-shrink-0 space-y-4 pb-4",children:[jsxs("div",{children:[jsx("h1",{className:"text-3xl font-bold",children:e}),t&&jsx("p",{className:"text-muted-foreground",children:t})]}),jsxs("div",{className:"flex items-center gap-3 flex-wrap",children:[n!==void 0&&jsxs("div",{className:"relative w-full sm:w-auto sm:min-w-[200px] sm:max-w-xs",children:[jsx(Search,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 h-4 w-4 text-muted-foreground pointer-events-none z-10"}),jsx(kt,{placeholder:o,value:r||"",onChange:b=>n(b.target.value),className:"pl-9 h-9"}),r&&jsx("button",{type:"button",onClick:()=>n(""),className:"absolute right-2 top-1/2 transform -translate-y-1/2 p-1 rounded-sm hover:bg-muted",children:jsx(X,{className:"h-3 w-3 text-muted-foreground"})})]}),a&&a.length>0&&jsxs(Nr,{children:[jsx(Rr,{asChild:true,children:jsxs(Y,{variant:"outline",size:"sm",className:"gap-2 h-9",children:[jsx(Filter,{className:"h-4 w-4"}),jsx("span",{className:"hidden sm:inline",children:"Filters"}),i>0&&jsx("span",{className:"rounded-full bg-primary text-primary-foreground px-2 py-0.5 text-xs font-medium",children:i})]})}),jsx(pr,{className:"w-80 overflow-y-auto",align:"start",collisionPadding:16,style:{maxHeight:"var(--radix-popover-content-available-height)"},children:jsxs("div",{className:"space-y-4",children:[jsxs("div",{className:"flex items-center justify-between",children:[jsx("h4",{className:"font-medium text-sm",children:"Filters"}),i>0&&s&&jsx(Y,{variant:"ghost",size:"sm",onClick:s,className:"h-auto p-0 text-xs text-destructive hover:text-destructive",children:"Clear all"})]}),jsx("div",{className:"space-y-3",children:a.map(b=>jsxs("div",{className:"space-y-1.5",children:[jsx("label",{className:"text-xs font-medium text-muted-foreground",children:b.label}),b.render()]},b.id))})]})})]}),i>0&&s&&jsxs(Y,{variant:"ghost",size:"sm",onClick:s,className:"h-9 gap-1.5 text-muted-foreground hover:text-foreground",title:"Clear filters",children:[jsx(X,{className:"h-4 w-4"}),jsx("span",{className:"hidden sm:inline",children:"Clear"})]}),m&&jsx(Zo,{...l}),jsx("div",{className:"flex-1"}),c&&jsx("div",{className:"flex items-center gap-2 flex-shrink-0",children:c})]})]}),d&&jsx("div",{className:"px-6 pb-2",children:d}),jsx("div",{className:"relative flex-1 min-h-0",children:jsx("div",{className:"data-table-scroll-container h-full",children:p?f||jsx("div",{className:"flex items-center justify-center h-full",children:jsx("div",{className:"text-muted-foreground",children:"Loading..."})}):u})})]})}function rb({selectedCount:e,onClear:t,children:r,itemLabel:n,className:o}){if(e===0)return null;let a=n??(e===1?"item":"items");return jsx(Ne,{className:R("p-3 bg-primary/5 border-primary/20",o),children:jsxs("div",{className:"flex items-center justify-between",children:[jsxs("div",{className:"flex items-center gap-3",children:[jsxs("span",{className:"font-medium text-sm",role:"status","aria-live":"polite",children:[e," ",a," selected"]}),jsxs(Y,{variant:"ghost",size:"sm",onClick:t,"aria-label":"Clear selection",children:[jsx(X,{className:"h-4 w-4 mr-1","aria-hidden":"true"}),"Clear"]})]}),jsx("div",{className:"flex items-center gap-2",role:"group","aria-label":"Batch actions",children:r})]})})}function nb({columns:e,isColumnVisible:t,toggleColumn:r,showAllColumns:n,hideAllColumns:o}){let a=e.filter(s=>t(s.id)).length,i=e.filter(s=>!s.locked);return jsxs(cb,{children:[jsx(ub,{asChild:true,children:jsxs(Y,{variant:"outline",size:"sm",className:"gap-2",children:[jsx(Columns3,{className:"h-4 w-4"}),"Columns",jsxs("span",{className:"text-muted-foreground text-xs",children:["(",a,"/",e.length,")"]})]})}),jsxs(Hs,{align:"end",className:"w-48",children:[jsx(Gs,{className:"font-normal text-xs text-muted-foreground",children:"Toggle columns"}),jsx(na,{}),e.map(s=>{let l=t(s.id),c=s.locked===true;return jsxs(Qn,{onClick:d=>{d.preventDefault(),c||r(s.id);},className:R("gap-2 cursor-pointer",c&&"opacity-50 cursor-not-allowed"),disabled:c,children:[jsx("div",{className:"w-4 h-4 flex items-center justify-center",children:l?jsx(Check,{className:"h-3.5 w-3.5 text-primary"}):jsx("div",{className:"h-3.5 w-3.5"})}),jsx("span",{className:"flex-1",children:s.label}),c&&jsx("span",{className:"text-xs text-muted-foreground",children:"Required"})]},s.id)}),i.length>1&&jsxs(Fragment,{children:[jsx(na,{}),jsxs(Qn,{onClick:s=>{s.preventDefault(),n();},className:"gap-2 cursor-pointer",children:[jsx(Eye,{className:"h-4 w-4"}),"Show All"]}),jsxs(Qn,{onClick:s=>{s.preventDefault(),o();},className:"gap-2 cursor-pointer",children:[jsx(EyeOff,{className:"h-4 w-4"}),"Hide Optional"]})]})]})]})}function ob({search:e,onSearchChange:t,searchPlaceholder:r="Search...",filters:n,activeFilterCount:o=0,onClearFilters:a,className:i,children:s}){return jsxs("div",{className:R("flex items-center gap-3 flex-wrap",i),children:[t!==void 0&&jsxs("div",{className:"relative flex-1 min-w-[200px] max-w-xs",children:[jsx(Search,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 h-4 w-4 text-muted-foreground pointer-events-none z-10"}),jsx(kt,{placeholder:r,value:e||"",onChange:l=>t(l.target.value),className:"pl-9 h-9"}),e&&jsx("button",{type:"button",onClick:()=>t(""),className:"absolute right-2 top-1/2 transform -translate-y-1/2 p-1 rounded-sm hover:bg-muted",children:jsx(X,{className:"h-3 w-3 text-muted-foreground"})})]}),n&&n.length>0&&jsxs(Nr,{children:[jsx(Rr,{asChild:true,children:jsxs(Y,{variant:"outline",size:"sm",className:"gap-2 h-9",children:[jsx(Filter,{className:"h-4 w-4"}),"Filters",o>0&&jsx("span",{className:"ml-1 rounded-full bg-primary text-primary-foreground px-2 py-0.5 text-xs font-medium",children:o})]})}),jsx(pr,{className:"w-80 overflow-y-auto",align:"start",collisionPadding:16,style:{maxHeight:"var(--radix-popover-content-available-height)"},children:jsxs("div",{className:"space-y-4",children:[jsxs("div",{className:"flex items-center justify-between",children:[jsx("h4",{className:"font-medium text-sm",children:"Filters"}),o>0&&a&&jsx(Y,{variant:"ghost",size:"sm",onClick:a,className:"h-auto p-0 text-xs text-destructive hover:text-destructive",children:"Clear all"})]}),jsx("div",{className:"space-y-3",children:n.map(l=>jsxs("div",{className:"space-y-1.5",children:[jsx("label",{className:"text-xs font-medium text-muted-foreground",children:l.label}),l.render()]},l.id))})]})})]}),o>0&&a&&jsxs(Y,{variant:"ghost",size:"sm",onClick:a,className:"h-9 gap-1.5 text-muted-foreground hover:text-foreground",children:[jsx(X,{className:"h-4 w-4"}),"Clear"]}),jsx("div",{className:"flex-1"}),s]})}/*! Bundled license information:
|
|
54
|
+
`)};if(G===0){var O=d.slice(g+1,p).concat(bi({children:[M],className:k.properties.className})),B=b(O,_);u.push(B);}else if(G===A.length-1){var W=d[p+1]&&d[p+1].children&&d[p+1].children[0],V={type:"text",value:"".concat(v)};if(W){var re=bi({children:[V],className:k.properties.className});d.splice(p+1,0,re);}else {var Z=[V],x=b(Z,_,k.properties.className);u.push(x);}}else {var z=[M],Q=b(z,_,k.properties.className);u.push(Q);}}),g=p;}p++;};p<d.length;)h();if(g!==d.length-1){var S=d.slice(g+1,d.length);if(S&&S.length){var w=n&&u.length+a,N=b(S,w);u.push(N);}}return t?u:(c=[]).concat.apply(c,u)}function T4(e){var t=e.rows,r=e.stylesheet,n=e.useInlineStyles;return t.map(function(o,a){return fi({node:o,stylesheet:r,useInlineStyles:n,key:"code-segment-".concat(a)})})}function uk(e){return e&&typeof e.highlightAuto<"u"}function A4(e){var t=e.astGenerator,r=e.language,n=e.code,o=e.defaultCodeValue;if(uk(t)){var a=ak(t,r);return r==="text"?{value:o,language:"text"}:a?t.highlight(r,n):t.highlightAuto(n)}try{return r&&r!=="text"?{value:t.highlight(n,r)}:{value:o}}catch{return {value:o}}}function dk(e,t){return function(n){var o,a,i=n.language,s=n.children,l=n.style,c=l===void 0?t:l,d=n.customStyle,u=d===void 0?{}:d,g=n.codeTagProps,p=g===void 0?{className:i?"language-".concat(i):void 0,style:Ur(Ur({},c['code[class*="language-"]']),c['code[class*="language-'.concat(i,'"]')])}:g,f=n.useInlineStyles,m=f===void 0?true:f,b=n.showLineNumbers,h=b===void 0?false:b,S=n.showInlineLineNumbers,w=S===void 0?true:S,N=n.startingLineNumber,C=N===void 0?1:N,k=n.lineNumberContainerStyle,D=n.lineNumberStyle,P=D===void 0?{}:D,A=n.wrapLines,v=n.wrapLongLines,G=v===void 0?false:v,_=n.lineProps,M=_===void 0?{}:_,O=n.renderer,B=n.PreTag,W=B===void 0?"pre":B,V=n.CodeTag,re=V===void 0?"code":V,Z=n.code,x=Z===void 0?(Array.isArray(s)?s[0]:s)||"":Z,z=n.astGenerator,Q=XS(n,y4);z=z||e;var T=h?ur__default.createElement(w4,{containerStyle:k,codeStyle:p.style||{},numberStyle:P,startingLineNumber:C,codeString:x}):null,ye=c.hljs||c['pre[class*="language-"]']||{backgroundColor:"#fff"},_e=uk(z)?"hljs":"prismjs",Pe=m?Object.assign({},Q,{style:Object.assign({},ye,u)}):Object.assign({},Q,{className:Q.className?"".concat(_e," ").concat(Q.className):_e,style:Object.assign({},u)});if(G?p.style=Ur({whiteSpace:"pre-wrap"},p.style):p.style=Ur({whiteSpace:"pre"},p.style),!z)return ur__default.createElement(W,Pe,T,ur__default.createElement(re,p,x));(A===void 0&&O||G)&&(A=true),O=O||T4;var Ue=[{type:"text",value:x}],Se=A4({astGenerator:z,language:i,code:x,defaultCodeValue:Ue});Se.language===null&&(Se.value=Ue);var at=(o=(a=x.match(/\n/g))===null||a===void 0?void 0:a.length)!==null&&o!==void 0?o:0,xe=C+at,Qe=v4(Se,A,M,h,w,C,xe,P,G);return ur__default.createElement(W,Pe,ur__default.createElement(re,p,!w&&T,O({rows:Qe,stylesheet:c,useInlineStyles:m})))}}var pk=["abap","abnf","actionscript","ada","agda","al","antlr4","apacheconf","apex","apl","applescript","aql","arduino","arff","asciidoc","asm6502","asmatmel","aspnet","autohotkey","autoit","avisynth","avro-idl","bash","basic","batch","bbcode","bicep","birb","bison","bnf","brainfuck","brightscript","bro","bsl","c","cfscript","chaiscript","cil","clike","clojure","cmake","cobol","coffeescript","concurnas","coq","cpp","crystal","csharp","cshtml","csp","css-extras","css","csv","cypher","d","dart","dataweave","dax","dhall","diff","django","dns-zone-file","docker","dot","ebnf","editorconfig","eiffel","ejs","elixir","elm","erb","erlang","etlua","excel-formula","factor","false","firestore-security-rules","flow","fortran","fsharp","ftl","gap","gcode","gdscript","gedcom","gherkin","git","glsl","gml","gn","go-module","go","graphql","groovy","haml","handlebars","haskell","haxe","hcl","hlsl","hoon","hpkp","hsts","http","ichigojam","icon","icu-message-format","idris","iecst","ignore","inform7","ini","io","j","java","javadoc","javadoclike","javascript","javastacktrace","jexl","jolie","jq","js-extras","js-templates","jsdoc","json","json5","jsonp","jsstacktrace","jsx","julia","keepalived","keyman","kotlin","kumir","kusto","latex","latte","less","lilypond","liquid","lisp","livescript","llvm","log","lolcode","lua","magma","makefile","markdown","markup-templating","markup","matlab","maxscript","mel","mermaid","mizar","mongodb","monkey","moonscript","n1ql","n4js","nand2tetris-hdl","naniscript","nasm","neon","nevod","nginx","nim","nix","nsis","objectivec","ocaml","opencl","openqasm","oz","parigp","parser","pascal","pascaligo","pcaxis","peoplecode","perl","php-extras","php","phpdoc","plsql","powerquery","powershell","processing","prolog","promql","properties","protobuf","psl","pug","puppet","pure","purebasic","purescript","python","q","qml","qore","qsharp","r","racket","reason","regex","rego","renpy","rest","rip","roboconf","robotframework","ruby","rust","sas","sass","scala","scheme","scss","shell-session","smali","smalltalk","smarty","sml","solidity","solution-file","soy","sparql","splunk-spl","sqf","sql","squirrel","stan","stylus","swift","systemd","t4-cs","t4-templating","t4-vb","tap","tcl","textile","toml","tremor","tsx","tt2","turtle","twig","typescript","typoscript","unrealscript","uorazor","uri","v","vala","vbnet","velocity","verilog","vhdl","vim","visual-basic","warpscript","wasm","web-idl","wiki","wolfram","wren","xeora","xml-doc","xojo","xquery","yaml","yang","zig"];var QE={'code[class*="language-"]':{color:"black",background:"none",textShadow:"0 1px white",fontFamily:"Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace",fontSize:"1em",textAlign:"left",whiteSpace:"pre",wordSpacing:"normal",wordBreak:"normal",wordWrap:"normal",lineHeight:"1.5",MozTabSize:"4",OTabSize:"4",tabSize:"4",WebkitHyphens:"none",MozHyphens:"none",msHyphens:"none",hyphens:"none"},'pre[class*="language-"]':{color:"black",background:"#f5f2f0",textShadow:"0 1px white",fontFamily:"Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace",fontSize:"1em",textAlign:"left",whiteSpace:"pre",wordSpacing:"normal",wordBreak:"normal",wordWrap:"normal",lineHeight:"1.5",MozTabSize:"4",OTabSize:"4",tabSize:"4",WebkitHyphens:"none",MozHyphens:"none",msHyphens:"none",hyphens:"none",padding:"1em",margin:".5em 0",overflow:"auto"},'pre[class*="language-"]::-moz-selection':{textShadow:"none",background:"#b3d4fc"},'pre[class*="language-"] ::-moz-selection':{textShadow:"none",background:"#b3d4fc"},'code[class*="language-"]::-moz-selection':{textShadow:"none",background:"#b3d4fc"},'code[class*="language-"] ::-moz-selection':{textShadow:"none",background:"#b3d4fc"},'pre[class*="language-"]::selection':{textShadow:"none",background:"#b3d4fc"},'pre[class*="language-"] ::selection':{textShadow:"none",background:"#b3d4fc"},'code[class*="language-"]::selection':{textShadow:"none",background:"#b3d4fc"},'code[class*="language-"] ::selection':{textShadow:"none",background:"#b3d4fc"},':not(pre) > code[class*="language-"]':{background:"#f5f2f0",padding:".1em",borderRadius:".3em",whiteSpace:"normal"},comment:{color:"slategray"},prolog:{color:"slategray"},doctype:{color:"slategray"},cdata:{color:"slategray"},punctuation:{color:"#999"},namespace:{Opacity:".7"},property:{color:"#905"},tag:{color:"#905"},boolean:{color:"#905"},number:{color:"#905"},constant:{color:"#905"},symbol:{color:"#905"},deleted:{color:"#905"},selector:{color:"#690"},"attr-name":{color:"#690"},string:{color:"#690"},char:{color:"#690"},builtin:{color:"#690"},inserted:{color:"#690"},operator:{color:"#9a6e3a",background:"hsla(0, 0%, 100%, .5)"},entity:{color:"#9a6e3a",background:"hsla(0, 0%, 100%, .5)",cursor:"help"},url:{color:"#9a6e3a",background:"hsla(0, 0%, 100%, .5)"},".language-css .token.string":{color:"#9a6e3a",background:"hsla(0, 0%, 100%, .5)"},".style .token.string":{color:"#9a6e3a",background:"hsla(0, 0%, 100%, .5)"},atrule:{color:"#07a"},"attr-value":{color:"#07a"},keyword:{color:"#07a"},function:{color:"#DD4A68"},"class-name":{color:"#DD4A68"},regex:{color:"#e90"},important:{color:"#e90",fontWeight:"bold"},variable:{color:"#e90"},bold:{fontWeight:"bold"},italic:{fontStyle:"italic"}};var UI=ea(zI());var HI=dk(UI.default,QE);HI.supportedLanguages=pk;var Ho=HI;var D_=ea(L_());function _f({content:e,className:t,showCopyButton:r=true}){let[n,o]=useState(null),a=s=>{navigator.clipboard.writeText(s),o(s),setTimeout(()=>o(null),2e3);},i=useMemo(()=>({code({node:s,inline:l,className:c,children:d,...u}){let g=/language-(\w+)/.exec(c||""),p=String(d).replace(/\n$/,"");return !l&&g?jsxs("div",{className:"relative group",children:[jsx(Ho,{style:D_.oneDark,language:g[1],PreTag:"div",className:"!rounded-md !my-4",...u,children:p}),r&&jsx(Y,{size:"sm",variant:"ghost",className:"absolute top-2 right-2 opacity-0 group-hover:opacity-100 transition-opacity",onClick:()=>a(p),children:n===p?jsx(Check,{className:"h-4 w-4"}):jsx(Copy,{className:"h-4 w-4"})})]}):jsx("code",{className:"px-1.5 py-0.5 rounded bg-muted text-sm font-mono",...u,children:d})},pre({children:s}){return jsx(Fragment,{children:s})},h1:({children:s})=>jsx("h1",{className:"text-2xl font-bold mt-6 mb-4",children:s}),h2:({children:s})=>jsx("h2",{className:"text-xl font-semibold mt-5 mb-3",children:s}),h3:({children:s})=>jsx("h3",{className:"text-lg font-semibold mt-4 mb-2",children:s}),p:({children:s})=>jsx("p",{className:"mb-4 leading-relaxed",children:s}),ul:({children:s})=>jsx("ul",{className:"list-disc list-inside mb-4 space-y-1",children:s}),ol:({children:s})=>jsx("ol",{className:"list-decimal list-inside mb-4 space-y-1",children:s}),blockquote:({children:s})=>jsx("blockquote",{className:"border-l-4 border-muted-foreground/30 pl-4 my-4 italic",children:s}),a:({href:s,children:l})=>jsx("a",{href:s,target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline",children:l}),table:({children:s})=>jsx("div",{className:"overflow-x-auto my-4",children:jsx("table",{className:"min-w-full divide-y divide-border",children:s})}),th:({children:s})=>jsx("th",{className:"px-4 py-2 text-left font-medium",children:s}),td:({children:s})=>jsx("td",{className:"px-4 py-2 border-t",children:s})}),[n,r]);return jsx("div",{className:he("prose prose-sm dark:prose-invert max-w-none",t),children:jsx(uc,{remarkPlugins:[di],components:i,children:e})})}function yz({content:e,className:t,title:r,...n}){return jsxs(Ne,{className:he("p-6",t),children:[r&&jsx("h2",{className:"text-xl font-semibold mb-4",children:r}),jsx(_f,{content:e,...n})]})}function Sz({content:e,className:t,height:r="400px",...n}){return jsx(js,{className:he("w-full",t),style:{height:r},children:jsx("div",{className:"pr-4",children:jsx(_f,{content:e,...n})})})}function Tz({children:e,className:t,maxWidth:r,tooltipSide:n="top"}){let o=useRef(null),[a,i]=useState(false),s=useCallback(()=>{o.current&&i(o.current.scrollWidth>o.current.clientWidth);},[]);useEffect(()=>{let c=o.current;if(!c)return;s();let d=new ResizeObserver(()=>{requestAnimationFrame(s);});return d.observe(c),()=>{d.disconnect();}},[s,e]);let l=r?{maxWidth:r}:void 0;return jsxs(ia,{children:[jsx(sa,{asChild:true,disabled:!a,children:jsx("span",{ref:o,className:R("truncate block",a&&"cursor-help",t),style:l,children:e})}),a&&jsx(io,{side:n,className:"max-w-md break-words",children:e})]})}var xr=[{hex:"#3b82f6",name:"Blue"},{hex:"#6366f1",name:"Indigo"},{hex:"#8b5cf6",name:"Violet"},{hex:"#a855f7",name:"Purple"},{hex:"#d946ef",name:"Fuchsia"},{hex:"#ec4899",name:"Pink"},{hex:"#f43f5e",name:"Rose"},{hex:"#ef4444",name:"Red"},{hex:"#f97316",name:"Orange"},{hex:"#f59e0b",name:"Amber"},{hex:"#eab308",name:"Yellow"},{hex:"#84cc16",name:"Lime"},{hex:"#22c55e",name:"Green"},{hex:"#10b981",name:"Emerald"},{hex:"#14b8a6",name:"Teal"},{hex:"#06b6d4",name:"Cyan"},{hex:"#0ea5e9",name:"Sky"},{hex:"#64748b",name:"Slate"},{hex:"#78716c",name:"Stone"},{hex:"#737373",name:"Gray"}];function Nz({value:e,onChange:t,columns:r=10,className:n}){return jsx("div",{className:R("flex flex-wrap gap-1.5",n),style:{maxWidth:r*28+(r-1)*6},children:xr.map(o=>{let a=e.toLowerCase()===o.hex.toLowerCase();return jsx("button",{type:"button",onClick:()=>t(o.hex),className:R("w-6 h-6 rounded-md transition-all focus:outline-none flex items-center justify-center","hover:brightness-110",a&&"ring-2 ring-foreground/70"),style:{backgroundColor:o.hex},title:o.name,children:a&&jsx(Check,{className:"h-3.5 w-3.5 text-white drop-shadow-[0_1px_1px_rgba(0,0,0,0.5)]"})},o.hex)})})}function Rz(){let e=Math.floor(Math.random()*xr.length);return xr[e].hex}function Iz(e){let r=(xr.findIndex(n=>n.hex===e)+1)%xr.length;return xr[r].hex}function _z(e){let t=new Set(e.map(n=>n.toLowerCase()));for(let n of xr)if(!t.has(n.hex.toLowerCase()))return n.hex;let r=xr.map(n=>({hex:n.hex,count:e.filter(o=>o.toLowerCase()===n.hex.toLowerCase()).length}));return r.sort((n,o)=>n.count-o.count),r[0].hex}function Fz({open:e,onOpenChange:t,title:r,children:n,footer:o,defaultWidth:a=800,defaultHeight:i=600,minWidth:s=400,minHeight:l=300,className:c,onFullscreenChange:d}){let[u,g]=useState(false),[p,f]=useState({x:0,y:0}),[m,b]=useState(()=>({width:Math.min(a,typeof window<"u"?window.innerWidth-32:a),height:Math.min(i,typeof window<"u"?window.innerHeight-32:i)})),[h,S]=useState(false),w=useRef(null),N=useRef({type:null,direction:null,startMouseX:0,startMouseY:0,startPosX:0,startPosY:0,startWidth:0,startHeight:0});useEffect(()=>{if(e&&!u){let A=Math.min(a,window.innerWidth-32),v=Math.min(i,window.innerHeight-32);b({width:A,height:v});let G=(window.innerWidth-A)/2,_=(window.innerHeight-v)/2;f({x:G,y:Math.max(16,_)});}},[e,u,a,i]);let C=useCallback(A=>{u||!w.current||(A.preventDefault(),N.current={type:"drag",direction:null,startMouseX:A.clientX,startMouseY:A.clientY,startPosX:p.x,startPosY:p.y,startWidth:m.width,startHeight:m.height},S(true),document.body.style.cursor="grabbing",document.body.style.userSelect="none");},[u,p,m]),k=useCallback((A,v)=>{u||!w.current||(A.preventDefault(),A.stopPropagation(),N.current={type:"resize",direction:v,startMouseX:A.clientX,startMouseY:A.clientY,startPosX:p.x,startPosY:p.y,startWidth:m.width,startHeight:m.height},S(true),document.body.style.userSelect="none");},[u,p,m]);useEffect(()=>{if(!h)return;let A=G=>{let _=N.current,M=w.current;if(!_.type||!M)return;let O=G.clientX-_.startMouseX,B=G.clientY-_.startMouseY;if(_.type==="drag"){let W=_.startPosX+O,V=Math.max(0,_.startPosY+B);M.style.left=`${W}px`,M.style.top=`${V}px`;}else if(_.type==="resize"&&_.direction){let W=_.startWidth,V=_.startHeight,re=_.startPosX,Z=_.startPosY;if(_.direction.includes("e")&&(W=Math.max(s,_.startWidth+O)),_.direction.includes("w")){let x=Math.min(O,_.startWidth-s);W=_.startWidth-x,re=_.startPosX+x;}if(_.direction.includes("s")&&(V=Math.max(l,_.startHeight+B)),_.direction.includes("n")){let x=Math.min(B,_.startHeight-l);V=_.startHeight-x,Z=Math.max(0,_.startPosY+x);}M.style.width=`${W}px`,M.style.height=`${V}px`,M.style.left=`${re}px`,M.style.top=`${Z}px`;}},v=()=>{let G=N.current,_=w.current;if(_&&G.type){let M=_.getBoundingClientRect();f({x:M.left,y:M.top}),b({width:M.width,height:M.height});}N.current.type=null,N.current.direction=null,S(false),document.body.style.cursor="",document.body.style.userSelect="";};return document.addEventListener("mousemove",A),document.addEventListener("mouseup",v),()=>{document.removeEventListener("mousemove",A),document.removeEventListener("mouseup",v);}},[h,s,l]);let D=useCallback(()=>{g(A=>{let v=!A;return d?.(v),v});},[d]),P=useMemo(()=>u?{position:"fixed",top:0,left:0,width:"100vw",height:"100vh",maxWidth:"100vw",maxHeight:"100vh",borderRadius:0,transform:"none"}:{position:"fixed",top:p.y,left:p.x,width:m.width,height:m.height,maxWidth:"none",maxHeight:"none",transform:"none",willChange:h?"left, top, width, height":"auto"},[u,p.x,p.y,m.width,m.height,h]);return jsx(Tn,{open:e,onOpenChange:t,children:jsxs(Yr,{ref:w,style:P,hideCloseButton:true,className:R("flex flex-col p-0 gap-0",h&&"transition-none duration-0 [&_*]:transition-none",u?"rounded-none":"rounded-lg",c),children:[jsxs("div",{className:R("flex items-center gap-2 px-4 py-3 border-b bg-muted/30 flex-shrink-0",!u&&"cursor-grab active:cursor-grabbing"),onMouseDown:C,children:[!u&&jsx(GripVertical,{className:"h-4 w-4 text-muted-foreground flex-shrink-0"}),jsx("div",{className:"flex-1 min-w-0",children:r&&jsx(Kr,{className:"p-0 space-y-0",children:jsx(Xr,{className:"text-base font-semibold leading-tight truncate",children:r})})}),jsxs("div",{className:"flex items-center gap-1 flex-shrink-0",children:[jsx(Y,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0",onClick:D,children:u?jsx(Minimize2,{className:"h-4 w-4"}):jsx(Maximize2,{className:"h-4 w-4"})}),jsx(Y,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0",onClick:()=>t(false),children:jsx(X,{className:"h-4 w-4"})})]})]}),jsx("div",{className:"flex-1 overflow-y-auto p-4",children:typeof n=="function"?n({isFullscreen:u}):n}),o&&jsx(Xn,{className:"px-4 py-3 border-t bg-muted/30 flex-shrink-0",children:o}),!u&&jsxs(Fragment,{children:[jsx("div",{className:"absolute top-0 left-2 right-2 h-1 cursor-n-resize",onMouseDown:A=>k(A,"n")}),jsx("div",{className:"absolute bottom-0 left-2 right-2 h-1 cursor-s-resize",onMouseDown:A=>k(A,"s")}),jsx("div",{className:"absolute left-0 top-2 bottom-2 w-1 cursor-w-resize",onMouseDown:A=>k(A,"w")}),jsx("div",{className:"absolute right-0 top-2 bottom-2 w-1 cursor-e-resize",onMouseDown:A=>k(A,"e")}),jsx("div",{className:"absolute top-0 left-0 w-3 h-3 cursor-nw-resize",onMouseDown:A=>k(A,"nw")}),jsx("div",{className:"absolute top-0 right-0 w-3 h-3 cursor-ne-resize",onMouseDown:A=>k(A,"ne")}),jsx("div",{className:"absolute bottom-0 left-0 w-3 h-3 cursor-sw-resize",onMouseDown:A=>k(A,"sw")}),jsx("div",{className:"absolute bottom-0 right-0 w-3 h-3 cursor-se-resize",onMouseDown:A=>k(A,"se")})]})]})})}function B_({position:e,onClose:t,children:r,className:n}){let o=useRef(null),[a,i]=useState(e);useLayoutEffect(()=>{if(!o.current)return;let c=o.current.getBoundingClientRect(),d=window.innerWidth,u=window.innerHeight,g=8,p=e.x,f=e.y;e.x+c.width>d-g&&(p=Math.max(g,d-c.width-g)),e.y+c.height>u-g&&(f=Math.max(g,u-c.height-g)),p<g&&(p=g),f<g&&(f=g),(p!==e.x||f!==e.y)&&i({x:p,y:f});},[e]),useEffect(()=>{let l=()=>t(),c=()=>t();return document.addEventListener("click",l),document.addEventListener("scroll",c,true),()=>{document.removeEventListener("click",l),document.removeEventListener("scroll",c,true);}},[t]);let s=useCallback(l=>{l.stopPropagation();},[]);return jsx("div",{ref:o,role:"menu","aria-label":"Context menu",className:R("fixed z-50 min-w-[180px] rounded-md border bg-popover p-1 text-popover-foreground shadow-md animate-in fade-in-0 zoom-in-95",n),style:{top:a.y,left:a.x},onClick:s,children:r})}var Wz={default:"hover:bg-accent hover:text-accent-foreground",success:"text-green-600 hover:bg-green-50 hover:text-green-700:bg-green-950",warning:"text-amber-600 hover:bg-amber-50 hover:text-amber-700:bg-amber-950",destructive:"text-destructive hover:bg-destructive hover:text-destructive-foreground",purple:"text-purple-600 hover:bg-purple-50 hover:text-purple-700:bg-purple-950"};function z_({onClick:e,onMouseEnter:t,icon:r,children:n,variant:o="default",disabled:a=false,className:i}){return jsxs("button",{role:"menuitem",onClick:e,onMouseEnter:t,disabled:a,"aria-disabled":a,className:R("relative flex w-full cursor-pointer select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none",Wz[o],a&&"opacity-50 cursor-not-allowed",i),children:[r&&jsx("span",{className:"mr-2 h-4 w-4 flex items-center justify-center","aria-hidden":"true",children:r}),n]})}function U_(){return jsx("div",{role:"separator",className:"h-px bg-border my-1"})}function G_({label:e,icon:t,children:r,onOpen:n,isOpen:o,onOpenChange:a,className:i}){let[s,l]=useState(false),c=o!==void 0,d=c?o:s,u=()=>{c?a?.(true):l(true),n?.();},g=()=>{c?a?.(false):l(false);};return jsxs("div",{className:R("relative",i),onMouseEnter:u,onMouseLeave:g,children:[jsxs("button",{role:"menuitem","aria-haspopup":"menu","aria-expanded":d,className:"relative flex w-full cursor-pointer select-none items-center justify-between rounded-sm px-2 py-1.5 text-sm outline-none hover:bg-accent hover:text-accent-foreground",children:[jsxs("span",{className:"flex items-center",children:[t&&jsx("span",{className:"mr-2 h-4 w-4 flex items-center justify-center","aria-hidden":"true",children:t}),e]}),jsx(ChevronRight,{className:"h-4 w-4","aria-hidden":"true"})]}),d&&jsx("div",{role:"menu","aria-label":`${e} submenu`,className:"absolute left-full top-0 ml-1 min-w-[160px] max-h-[300px] overflow-y-auto rounded-md border bg-popover p-1 text-popover-foreground shadow-md",children:r})]})}var Ff={'code[class*="language-"]':{background:"hsl(220, 13%, 18%)",color:"hsl(220, 14%, 71%)",textShadow:"0 1px rgba(0, 0, 0, 0.3)",fontFamily:'"Fira Code", "Fira Mono", Menlo, Consolas, "DejaVu Sans Mono", monospace',direction:"ltr",textAlign:"left",whiteSpace:"pre",wordSpacing:"normal",wordBreak:"normal",lineHeight:"1.5",MozTabSize:"2",OTabSize:"2",tabSize:"2",WebkitHyphens:"none",MozHyphens:"none",msHyphens:"none",hyphens:"none"},'pre[class*="language-"]':{background:"hsl(220, 13%, 18%)",color:"hsl(220, 14%, 71%)",textShadow:"0 1px rgba(0, 0, 0, 0.3)",fontFamily:'"Fira Code", "Fira Mono", Menlo, Consolas, "DejaVu Sans Mono", monospace',direction:"ltr",textAlign:"left",whiteSpace:"pre",wordSpacing:"normal",wordBreak:"normal",lineHeight:"1.5",MozTabSize:"2",OTabSize:"2",tabSize:"2",WebkitHyphens:"none",MozHyphens:"none",msHyphens:"none",hyphens:"none",padding:"1em",margin:"0.5em 0",overflow:"auto",borderRadius:"0.3em"},'code[class*="language-"]::-moz-selection':{background:"hsl(220, 13%, 28%)",color:"inherit",textShadow:"none"},'code[class*="language-"] *::-moz-selection':{background:"hsl(220, 13%, 28%)",color:"inherit",textShadow:"none"},'pre[class*="language-"] *::-moz-selection':{background:"hsl(220, 13%, 28%)",color:"inherit",textShadow:"none"},'code[class*="language-"]::selection':{background:"hsl(220, 13%, 28%)",color:"inherit",textShadow:"none"},'code[class*="language-"] *::selection':{background:"hsl(220, 13%, 28%)",color:"inherit",textShadow:"none"},'pre[class*="language-"] *::selection':{background:"hsl(220, 13%, 28%)",color:"inherit",textShadow:"none"},':not(pre) > code[class*="language-"]':{padding:"0.2em 0.3em",borderRadius:"0.3em",whiteSpace:"normal"},comment:{color:"hsl(220, 10%, 40%)",fontStyle:"italic"},prolog:{color:"hsl(220, 10%, 40%)"},cdata:{color:"hsl(220, 10%, 40%)"},doctype:{color:"hsl(220, 14%, 71%)"},punctuation:{color:"hsl(220, 14%, 71%)"},entity:{color:"hsl(220, 14%, 71%)",cursor:"help"},"attr-name":{color:"hsl(29, 54%, 61%)"},"class-name":{color:"hsl(29, 54%, 61%)"},boolean:{color:"hsl(29, 54%, 61%)"},constant:{color:"hsl(29, 54%, 61%)"},number:{color:"hsl(29, 54%, 61%)"},atrule:{color:"hsl(29, 54%, 61%)"},keyword:{color:"hsl(286, 60%, 67%)"},property:{color:"hsl(355, 65%, 65%)"},tag:{color:"hsl(355, 65%, 65%)"},symbol:{color:"hsl(355, 65%, 65%)"},deleted:{color:"hsl(355, 65%, 65%)"},important:{color:"hsl(355, 65%, 65%)"},selector:{color:"hsl(95, 38%, 62%)"},string:{color:"hsl(95, 38%, 62%)"},char:{color:"hsl(95, 38%, 62%)"},builtin:{color:"hsl(95, 38%, 62%)"},inserted:{color:"hsl(95, 38%, 62%)"},regex:{color:"hsl(95, 38%, 62%)"},"attr-value":{color:"hsl(95, 38%, 62%)"},"attr-value > .token.punctuation":{color:"hsl(95, 38%, 62%)"},variable:{color:"hsl(207, 82%, 66%)"},operator:{color:"hsl(207, 82%, 66%)"},function:{color:"hsl(207, 82%, 66%)"},url:{color:"hsl(187, 47%, 55%)"},"attr-value > .token.punctuation.attr-equals":{color:"hsl(220, 14%, 71%)"},"special-attr > .token.attr-value > .token.value.css":{color:"hsl(220, 14%, 71%)"},".language-css .token.selector":{color:"hsl(355, 65%, 65%)"},".language-css .token.property":{color:"hsl(220, 14%, 71%)"},".language-css .token.function":{color:"hsl(187, 47%, 55%)"},".language-css .token.url > .token.function":{color:"hsl(187, 47%, 55%)"},".language-css .token.url > .token.string.url":{color:"hsl(95, 38%, 62%)"},".language-css .token.important":{color:"hsl(286, 60%, 67%)"},".language-css .token.atrule .token.rule":{color:"hsl(286, 60%, 67%)"},".language-javascript .token.operator":{color:"hsl(286, 60%, 67%)"},".language-javascript .token.template-string > .token.interpolation > .token.interpolation-punctuation.punctuation":{color:"hsl(5, 48%, 51%)"},".language-json .token.operator":{color:"hsl(220, 14%, 71%)"},".language-json .token.null.keyword":{color:"hsl(29, 54%, 61%)"},".language-markdown .token.url":{color:"hsl(220, 14%, 71%)"},".language-markdown .token.url > .token.operator":{color:"hsl(220, 14%, 71%)"},".language-markdown .token.url-reference.url > .token.string":{color:"hsl(220, 14%, 71%)"},".language-markdown .token.url > .token.content":{color:"hsl(207, 82%, 66%)"},".language-markdown .token.url > .token.url":{color:"hsl(187, 47%, 55%)"},".language-markdown .token.url-reference.url":{color:"hsl(187, 47%, 55%)"},".language-markdown .token.blockquote.punctuation":{color:"hsl(220, 10%, 40%)",fontStyle:"italic"},".language-markdown .token.hr.punctuation":{color:"hsl(220, 10%, 40%)",fontStyle:"italic"},".language-markdown .token.code-snippet":{color:"hsl(95, 38%, 62%)"},".language-markdown .token.bold .token.content":{color:"hsl(29, 54%, 61%)"},".language-markdown .token.italic .token.content":{color:"hsl(286, 60%, 67%)"},".language-markdown .token.strike .token.content":{color:"hsl(355, 65%, 65%)"},".language-markdown .token.strike .token.punctuation":{color:"hsl(355, 65%, 65%)"},".language-markdown .token.list.punctuation":{color:"hsl(355, 65%, 65%)"},".language-markdown .token.title.important > .token.punctuation":{color:"hsl(355, 65%, 65%)"},bold:{fontWeight:"bold"},italic:{fontStyle:"italic"},namespace:{Opacity:"0.8"},"token.tab:not(:empty):before":{color:"hsla(220, 14%, 71%, 0.15)",textShadow:"none"},"token.cr:before":{color:"hsla(220, 14%, 71%, 0.15)",textShadow:"none"},"token.lf:before":{color:"hsla(220, 14%, 71%, 0.15)",textShadow:"none"},"token.space:before":{color:"hsla(220, 14%, 71%, 0.15)",textShadow:"none"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item":{marginRight:"0.4em"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > button":{background:"hsl(220, 13%, 26%)",color:"hsl(220, 9%, 55%)",padding:"0.1em 0.4em",borderRadius:"0.3em"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > a":{background:"hsl(220, 13%, 26%)",color:"hsl(220, 9%, 55%)",padding:"0.1em 0.4em",borderRadius:"0.3em"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > span":{background:"hsl(220, 13%, 26%)",color:"hsl(220, 9%, 55%)",padding:"0.1em 0.4em",borderRadius:"0.3em"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > button:hover":{background:"hsl(220, 13%, 28%)",color:"hsl(220, 14%, 71%)"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > button:focus":{background:"hsl(220, 13%, 28%)",color:"hsl(220, 14%, 71%)"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > a:hover":{background:"hsl(220, 13%, 28%)",color:"hsl(220, 14%, 71%)"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > a:focus":{background:"hsl(220, 13%, 28%)",color:"hsl(220, 14%, 71%)"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > span:hover":{background:"hsl(220, 13%, 28%)",color:"hsl(220, 14%, 71%)"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > span:focus":{background:"hsl(220, 13%, 28%)",color:"hsl(220, 14%, 71%)"},".line-highlight.line-highlight":{background:"hsla(220, 100%, 80%, 0.04)"},".line-highlight.line-highlight:before":{background:"hsl(220, 13%, 26%)",color:"hsl(220, 14%, 71%)",padding:"0.1em 0.6em",borderRadius:"0.3em",boxShadow:"0 2px 0 0 rgba(0, 0, 0, 0.2)"},".line-highlight.line-highlight[data-end]:after":{background:"hsl(220, 13%, 26%)",color:"hsl(220, 14%, 71%)",padding:"0.1em 0.6em",borderRadius:"0.3em",boxShadow:"0 2px 0 0 rgba(0, 0, 0, 0.2)"},"pre[id].linkable-line-numbers.linkable-line-numbers span.line-numbers-rows > span:hover:before":{backgroundColor:"hsla(220, 100%, 80%, 0.04)"},".line-numbers.line-numbers .line-numbers-rows":{borderRightColor:"hsla(220, 14%, 71%, 0.15)"},".command-line .command-line-prompt":{borderRightColor:"hsla(220, 14%, 71%, 0.15)"},".line-numbers .line-numbers-rows > span:before":{color:"hsl(220, 14%, 45%)"},".command-line .command-line-prompt > span:before":{color:"hsl(220, 14%, 45%)"},".rainbow-braces .token.token.punctuation.brace-level-1":{color:"hsl(355, 65%, 65%)"},".rainbow-braces .token.token.punctuation.brace-level-5":{color:"hsl(355, 65%, 65%)"},".rainbow-braces .token.token.punctuation.brace-level-9":{color:"hsl(355, 65%, 65%)"},".rainbow-braces .token.token.punctuation.brace-level-2":{color:"hsl(95, 38%, 62%)"},".rainbow-braces .token.token.punctuation.brace-level-6":{color:"hsl(95, 38%, 62%)"},".rainbow-braces .token.token.punctuation.brace-level-10":{color:"hsl(95, 38%, 62%)"},".rainbow-braces .token.token.punctuation.brace-level-3":{color:"hsl(207, 82%, 66%)"},".rainbow-braces .token.token.punctuation.brace-level-7":{color:"hsl(207, 82%, 66%)"},".rainbow-braces .token.token.punctuation.brace-level-11":{color:"hsl(207, 82%, 66%)"},".rainbow-braces .token.token.punctuation.brace-level-4":{color:"hsl(286, 60%, 67%)"},".rainbow-braces .token.token.punctuation.brace-level-8":{color:"hsl(286, 60%, 67%)"},".rainbow-braces .token.token.punctuation.brace-level-12":{color:"hsl(286, 60%, 67%)"},"pre.diff-highlight > code .token.token.deleted:not(.prefix)":{backgroundColor:"hsla(353, 100%, 66%, 0.15)"},"pre > code.diff-highlight .token.token.deleted:not(.prefix)":{backgroundColor:"hsla(353, 100%, 66%, 0.15)"},"pre.diff-highlight > code .token.token.deleted:not(.prefix)::-moz-selection":{backgroundColor:"hsla(353, 95%, 66%, 0.25)"},"pre.diff-highlight > code .token.token.deleted:not(.prefix) *::-moz-selection":{backgroundColor:"hsla(353, 95%, 66%, 0.25)"},"pre > code.diff-highlight .token.token.deleted:not(.prefix)::-moz-selection":{backgroundColor:"hsla(353, 95%, 66%, 0.25)"},"pre > code.diff-highlight .token.token.deleted:not(.prefix) *::-moz-selection":{backgroundColor:"hsla(353, 95%, 66%, 0.25)"},"pre.diff-highlight > code .token.token.deleted:not(.prefix)::selection":{backgroundColor:"hsla(353, 95%, 66%, 0.25)"},"pre.diff-highlight > code .token.token.deleted:not(.prefix) *::selection":{backgroundColor:"hsla(353, 95%, 66%, 0.25)"},"pre > code.diff-highlight .token.token.deleted:not(.prefix)::selection":{backgroundColor:"hsla(353, 95%, 66%, 0.25)"},"pre > code.diff-highlight .token.token.deleted:not(.prefix) *::selection":{backgroundColor:"hsla(353, 95%, 66%, 0.25)"},"pre.diff-highlight > code .token.token.inserted:not(.prefix)":{backgroundColor:"hsla(137, 100%, 55%, 0.15)"},"pre > code.diff-highlight .token.token.inserted:not(.prefix)":{backgroundColor:"hsla(137, 100%, 55%, 0.15)"},"pre.diff-highlight > code .token.token.inserted:not(.prefix)::-moz-selection":{backgroundColor:"hsla(135, 73%, 55%, 0.25)"},"pre.diff-highlight > code .token.token.inserted:not(.prefix) *::-moz-selection":{backgroundColor:"hsla(135, 73%, 55%, 0.25)"},"pre > code.diff-highlight .token.token.inserted:not(.prefix)::-moz-selection":{backgroundColor:"hsla(135, 73%, 55%, 0.25)"},"pre > code.diff-highlight .token.token.inserted:not(.prefix) *::-moz-selection":{backgroundColor:"hsla(135, 73%, 55%, 0.25)"},"pre.diff-highlight > code .token.token.inserted:not(.prefix)::selection":{backgroundColor:"hsla(135, 73%, 55%, 0.25)"},"pre.diff-highlight > code .token.token.inserted:not(.prefix) *::selection":{backgroundColor:"hsla(135, 73%, 55%, 0.25)"},"pre > code.diff-highlight .token.token.inserted:not(.prefix)::selection":{backgroundColor:"hsla(135, 73%, 55%, 0.25)"},"pre > code.diff-highlight .token.token.inserted:not(.prefix) *::selection":{backgroundColor:"hsla(135, 73%, 55%, 0.25)"},".prism-previewer.prism-previewer:before":{borderColor:"hsl(224, 13%, 17%)"},".prism-previewer-gradient.prism-previewer-gradient div":{borderColor:"hsl(224, 13%, 17%)",borderRadius:"0.3em"},".prism-previewer-color.prism-previewer-color:before":{borderRadius:"0.3em"},".prism-previewer-easing.prism-previewer-easing:before":{borderRadius:"0.3em"},".prism-previewer.prism-previewer:after":{borderTopColor:"hsl(224, 13%, 17%)"},".prism-previewer-flipped.prism-previewer-flipped.after":{borderBottomColor:"hsl(224, 13%, 17%)"},".prism-previewer-angle.prism-previewer-angle:before":{background:"hsl(219, 13%, 22%)"},".prism-previewer-time.prism-previewer-time:before":{background:"hsl(219, 13%, 22%)"},".prism-previewer-easing.prism-previewer-easing":{background:"hsl(219, 13%, 22%)"},".prism-previewer-angle.prism-previewer-angle circle":{stroke:"hsl(220, 14%, 71%)",strokeOpacity:"1"},".prism-previewer-time.prism-previewer-time circle":{stroke:"hsl(220, 14%, 71%)",strokeOpacity:"1"},".prism-previewer-easing.prism-previewer-easing circle":{stroke:"hsl(220, 14%, 71%)",fill:"transparent"},".prism-previewer-easing.prism-previewer-easing path":{stroke:"hsl(220, 14%, 71%)"},".prism-previewer-easing.prism-previewer-easing line":{stroke:"hsl(220, 14%, 71%)"}};var Bf={'code[class*="language-"]':{background:"hsl(230, 1%, 98%)",color:"hsl(230, 8%, 24%)",fontFamily:'"Fira Code", "Fira Mono", Menlo, Consolas, "DejaVu Sans Mono", monospace',direction:"ltr",textAlign:"left",whiteSpace:"pre",wordSpacing:"normal",wordBreak:"normal",lineHeight:"1.5",MozTabSize:"2",OTabSize:"2",tabSize:"2",WebkitHyphens:"none",MozHyphens:"none",msHyphens:"none",hyphens:"none"},'pre[class*="language-"]':{background:"hsl(230, 1%, 98%)",color:"hsl(230, 8%, 24%)",fontFamily:'"Fira Code", "Fira Mono", Menlo, Consolas, "DejaVu Sans Mono", monospace',direction:"ltr",textAlign:"left",whiteSpace:"pre",wordSpacing:"normal",wordBreak:"normal",lineHeight:"1.5",MozTabSize:"2",OTabSize:"2",tabSize:"2",WebkitHyphens:"none",MozHyphens:"none",msHyphens:"none",hyphens:"none",padding:"1em",margin:"0.5em 0",overflow:"auto",borderRadius:"0.3em"},'code[class*="language-"]::-moz-selection':{background:"hsl(230, 1%, 90%)",color:"inherit"},'code[class*="language-"] *::-moz-selection':{background:"hsl(230, 1%, 90%)",color:"inherit"},'pre[class*="language-"] *::-moz-selection':{background:"hsl(230, 1%, 90%)",color:"inherit"},'code[class*="language-"]::selection':{background:"hsl(230, 1%, 90%)",color:"inherit"},'code[class*="language-"] *::selection':{background:"hsl(230, 1%, 90%)",color:"inherit"},'pre[class*="language-"] *::selection':{background:"hsl(230, 1%, 90%)",color:"inherit"},':not(pre) > code[class*="language-"]':{padding:"0.2em 0.3em",borderRadius:"0.3em",whiteSpace:"normal"},comment:{color:"hsl(230, 4%, 64%)",fontStyle:"italic"},prolog:{color:"hsl(230, 4%, 64%)"},cdata:{color:"hsl(230, 4%, 64%)"},doctype:{color:"hsl(230, 8%, 24%)"},punctuation:{color:"hsl(230, 8%, 24%)"},entity:{color:"hsl(230, 8%, 24%)",cursor:"help"},"attr-name":{color:"hsl(35, 99%, 36%)"},"class-name":{color:"hsl(35, 99%, 36%)"},boolean:{color:"hsl(35, 99%, 36%)"},constant:{color:"hsl(35, 99%, 36%)"},number:{color:"hsl(35, 99%, 36%)"},atrule:{color:"hsl(35, 99%, 36%)"},keyword:{color:"hsl(301, 63%, 40%)"},property:{color:"hsl(5, 74%, 59%)"},tag:{color:"hsl(5, 74%, 59%)"},symbol:{color:"hsl(5, 74%, 59%)"},deleted:{color:"hsl(5, 74%, 59%)"},important:{color:"hsl(5, 74%, 59%)"},selector:{color:"hsl(119, 34%, 47%)"},string:{color:"hsl(119, 34%, 47%)"},char:{color:"hsl(119, 34%, 47%)"},builtin:{color:"hsl(119, 34%, 47%)"},inserted:{color:"hsl(119, 34%, 47%)"},regex:{color:"hsl(119, 34%, 47%)"},"attr-value":{color:"hsl(119, 34%, 47%)"},"attr-value > .token.punctuation":{color:"hsl(119, 34%, 47%)"},variable:{color:"hsl(221, 87%, 60%)"},operator:{color:"hsl(221, 87%, 60%)"},function:{color:"hsl(221, 87%, 60%)"},url:{color:"hsl(198, 99%, 37%)"},"attr-value > .token.punctuation.attr-equals":{color:"hsl(230, 8%, 24%)"},"special-attr > .token.attr-value > .token.value.css":{color:"hsl(230, 8%, 24%)"},".language-css .token.selector":{color:"hsl(5, 74%, 59%)"},".language-css .token.property":{color:"hsl(230, 8%, 24%)"},".language-css .token.function":{color:"hsl(198, 99%, 37%)"},".language-css .token.url > .token.function":{color:"hsl(198, 99%, 37%)"},".language-css .token.url > .token.string.url":{color:"hsl(119, 34%, 47%)"},".language-css .token.important":{color:"hsl(301, 63%, 40%)"},".language-css .token.atrule .token.rule":{color:"hsl(301, 63%, 40%)"},".language-javascript .token.operator":{color:"hsl(301, 63%, 40%)"},".language-javascript .token.template-string > .token.interpolation > .token.interpolation-punctuation.punctuation":{color:"hsl(344, 84%, 43%)"},".language-json .token.operator":{color:"hsl(230, 8%, 24%)"},".language-json .token.null.keyword":{color:"hsl(35, 99%, 36%)"},".language-markdown .token.url":{color:"hsl(230, 8%, 24%)"},".language-markdown .token.url > .token.operator":{color:"hsl(230, 8%, 24%)"},".language-markdown .token.url-reference.url > .token.string":{color:"hsl(230, 8%, 24%)"},".language-markdown .token.url > .token.content":{color:"hsl(221, 87%, 60%)"},".language-markdown .token.url > .token.url":{color:"hsl(198, 99%, 37%)"},".language-markdown .token.url-reference.url":{color:"hsl(198, 99%, 37%)"},".language-markdown .token.blockquote.punctuation":{color:"hsl(230, 4%, 64%)",fontStyle:"italic"},".language-markdown .token.hr.punctuation":{color:"hsl(230, 4%, 64%)",fontStyle:"italic"},".language-markdown .token.code-snippet":{color:"hsl(119, 34%, 47%)"},".language-markdown .token.bold .token.content":{color:"hsl(35, 99%, 36%)"},".language-markdown .token.italic .token.content":{color:"hsl(301, 63%, 40%)"},".language-markdown .token.strike .token.content":{color:"hsl(5, 74%, 59%)"},".language-markdown .token.strike .token.punctuation":{color:"hsl(5, 74%, 59%)"},".language-markdown .token.list.punctuation":{color:"hsl(5, 74%, 59%)"},".language-markdown .token.title.important > .token.punctuation":{color:"hsl(5, 74%, 59%)"},bold:{fontWeight:"bold"},italic:{fontStyle:"italic"},namespace:{Opacity:"0.8"},"token.tab:not(:empty):before":{color:"hsla(230, 8%, 24%, 0.2)"},"token.cr:before":{color:"hsla(230, 8%, 24%, 0.2)"},"token.lf:before":{color:"hsla(230, 8%, 24%, 0.2)"},"token.space:before":{color:"hsla(230, 8%, 24%, 0.2)"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item":{marginRight:"0.4em"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > button":{background:"hsl(230, 1%, 90%)",color:"hsl(230, 6%, 44%)",padding:"0.1em 0.4em",borderRadius:"0.3em"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > a":{background:"hsl(230, 1%, 90%)",color:"hsl(230, 6%, 44%)",padding:"0.1em 0.4em",borderRadius:"0.3em"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > span":{background:"hsl(230, 1%, 90%)",color:"hsl(230, 6%, 44%)",padding:"0.1em 0.4em",borderRadius:"0.3em"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > button:hover":{background:"hsl(230, 1%, 78%)",color:"hsl(230, 8%, 24%)"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > button:focus":{background:"hsl(230, 1%, 78%)",color:"hsl(230, 8%, 24%)"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > a:hover":{background:"hsl(230, 1%, 78%)",color:"hsl(230, 8%, 24%)"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > a:focus":{background:"hsl(230, 1%, 78%)",color:"hsl(230, 8%, 24%)"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > span:hover":{background:"hsl(230, 1%, 78%)",color:"hsl(230, 8%, 24%)"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > span:focus":{background:"hsl(230, 1%, 78%)",color:"hsl(230, 8%, 24%)"},".line-highlight.line-highlight":{background:"hsla(230, 8%, 24%, 0.05)"},".line-highlight.line-highlight:before":{background:"hsl(230, 1%, 90%)",color:"hsl(230, 8%, 24%)",padding:"0.1em 0.6em",borderRadius:"0.3em",boxShadow:"0 2px 0 0 rgba(0, 0, 0, 0.2)"},".line-highlight.line-highlight[data-end]:after":{background:"hsl(230, 1%, 90%)",color:"hsl(230, 8%, 24%)",padding:"0.1em 0.6em",borderRadius:"0.3em",boxShadow:"0 2px 0 0 rgba(0, 0, 0, 0.2)"},"pre[id].linkable-line-numbers.linkable-line-numbers span.line-numbers-rows > span:hover:before":{backgroundColor:"hsla(230, 8%, 24%, 0.05)"},".line-numbers.line-numbers .line-numbers-rows":{borderRightColor:"hsla(230, 8%, 24%, 0.2)"},".command-line .command-line-prompt":{borderRightColor:"hsla(230, 8%, 24%, 0.2)"},".line-numbers .line-numbers-rows > span:before":{color:"hsl(230, 1%, 62%)"},".command-line .command-line-prompt > span:before":{color:"hsl(230, 1%, 62%)"},".rainbow-braces .token.token.punctuation.brace-level-1":{color:"hsl(5, 74%, 59%)"},".rainbow-braces .token.token.punctuation.brace-level-5":{color:"hsl(5, 74%, 59%)"},".rainbow-braces .token.token.punctuation.brace-level-9":{color:"hsl(5, 74%, 59%)"},".rainbow-braces .token.token.punctuation.brace-level-2":{color:"hsl(119, 34%, 47%)"},".rainbow-braces .token.token.punctuation.brace-level-6":{color:"hsl(119, 34%, 47%)"},".rainbow-braces .token.token.punctuation.brace-level-10":{color:"hsl(119, 34%, 47%)"},".rainbow-braces .token.token.punctuation.brace-level-3":{color:"hsl(221, 87%, 60%)"},".rainbow-braces .token.token.punctuation.brace-level-7":{color:"hsl(221, 87%, 60%)"},".rainbow-braces .token.token.punctuation.brace-level-11":{color:"hsl(221, 87%, 60%)"},".rainbow-braces .token.token.punctuation.brace-level-4":{color:"hsl(301, 63%, 40%)"},".rainbow-braces .token.token.punctuation.brace-level-8":{color:"hsl(301, 63%, 40%)"},".rainbow-braces .token.token.punctuation.brace-level-12":{color:"hsl(301, 63%, 40%)"},"pre.diff-highlight > code .token.token.deleted:not(.prefix)":{backgroundColor:"hsla(353, 100%, 66%, 0.15)"},"pre > code.diff-highlight .token.token.deleted:not(.prefix)":{backgroundColor:"hsla(353, 100%, 66%, 0.15)"},"pre.diff-highlight > code .token.token.deleted:not(.prefix)::-moz-selection":{backgroundColor:"hsla(353, 95%, 66%, 0.25)"},"pre.diff-highlight > code .token.token.deleted:not(.prefix) *::-moz-selection":{backgroundColor:"hsla(353, 95%, 66%, 0.25)"},"pre > code.diff-highlight .token.token.deleted:not(.prefix)::-moz-selection":{backgroundColor:"hsla(353, 95%, 66%, 0.25)"},"pre > code.diff-highlight .token.token.deleted:not(.prefix) *::-moz-selection":{backgroundColor:"hsla(353, 95%, 66%, 0.25)"},"pre.diff-highlight > code .token.token.deleted:not(.prefix)::selection":{backgroundColor:"hsla(353, 95%, 66%, 0.25)"},"pre.diff-highlight > code .token.token.deleted:not(.prefix) *::selection":{backgroundColor:"hsla(353, 95%, 66%, 0.25)"},"pre > code.diff-highlight .token.token.deleted:not(.prefix)::selection":{backgroundColor:"hsla(353, 95%, 66%, 0.25)"},"pre > code.diff-highlight .token.token.deleted:not(.prefix) *::selection":{backgroundColor:"hsla(353, 95%, 66%, 0.25)"},"pre.diff-highlight > code .token.token.inserted:not(.prefix)":{backgroundColor:"hsla(137, 100%, 55%, 0.15)"},"pre > code.diff-highlight .token.token.inserted:not(.prefix)":{backgroundColor:"hsla(137, 100%, 55%, 0.15)"},"pre.diff-highlight > code .token.token.inserted:not(.prefix)::-moz-selection":{backgroundColor:"hsla(135, 73%, 55%, 0.25)"},"pre.diff-highlight > code .token.token.inserted:not(.prefix) *::-moz-selection":{backgroundColor:"hsla(135, 73%, 55%, 0.25)"},"pre > code.diff-highlight .token.token.inserted:not(.prefix)::-moz-selection":{backgroundColor:"hsla(135, 73%, 55%, 0.25)"},"pre > code.diff-highlight .token.token.inserted:not(.prefix) *::-moz-selection":{backgroundColor:"hsla(135, 73%, 55%, 0.25)"},"pre.diff-highlight > code .token.token.inserted:not(.prefix)::selection":{backgroundColor:"hsla(135, 73%, 55%, 0.25)"},"pre.diff-highlight > code .token.token.inserted:not(.prefix) *::selection":{backgroundColor:"hsla(135, 73%, 55%, 0.25)"},"pre > code.diff-highlight .token.token.inserted:not(.prefix)::selection":{backgroundColor:"hsla(135, 73%, 55%, 0.25)"},"pre > code.diff-highlight .token.token.inserted:not(.prefix) *::selection":{backgroundColor:"hsla(135, 73%, 55%, 0.25)"},".prism-previewer.prism-previewer:before":{borderColor:"hsl(0, 0, 95%)"},".prism-previewer-gradient.prism-previewer-gradient div":{borderColor:"hsl(0, 0, 95%)",borderRadius:"0.3em"},".prism-previewer-color.prism-previewer-color:before":{borderRadius:"0.3em"},".prism-previewer-easing.prism-previewer-easing:before":{borderRadius:"0.3em"},".prism-previewer.prism-previewer:after":{borderTopColor:"hsl(0, 0, 95%)"},".prism-previewer-flipped.prism-previewer-flipped.after":{borderBottomColor:"hsl(0, 0, 95%)"},".prism-previewer-angle.prism-previewer-angle:before":{background:"hsl(0, 0%, 100%)"},".prism-previewer-time.prism-previewer-time:before":{background:"hsl(0, 0%, 100%)"},".prism-previewer-easing.prism-previewer-easing":{background:"hsl(0, 0%, 100%)"},".prism-previewer-angle.prism-previewer-angle circle":{stroke:"hsl(230, 8%, 24%)",strokeOpacity:"1"},".prism-previewer-time.prism-previewer-time circle":{stroke:"hsl(230, 8%, 24%)",strokeOpacity:"1"},".prism-previewer-easing.prism-previewer-easing circle":{stroke:"hsl(230, 8%, 24%)",fill:"transparent"},".prism-previewer-easing.prism-previewer-easing path":{stroke:"hsl(230, 8%, 24%)"},".prism-previewer-easing.prism-previewer-easing line":{stroke:"hsl(230, 8%, 24%)"}};function Xz(e){let t=e.split(".").pop()?.toLowerCase()||"";return {ts:"typescript",tsx:"tsx",js:"javascript",jsx:"jsx",py:"python",rb:"ruby",rs:"rust",go:"go",java:"java",kt:"kotlin",swift:"swift",cs:"csharp",cpp:"cpp",c:"c",h:"c",hpp:"cpp",php:"php",html:"html",css:"css",scss:"scss",less:"less",json:"json",yaml:"yaml",yml:"yaml",xml:"xml",md:"markdown",sql:"sql",sh:"bash",bash:"bash",zsh:"bash",dockerfile:"docker",makefile:"makefile"}[t]||"text"}function Zz(){return typeof window>"u"?false:document.documentElement.classList.contains("dark")}function W_({code:e,language:t,filename:r,lineStart:n=1,highlightLines:o=[],className:a,showLineNumbers:i=true,showFilename:s=true,autoScrollToHighlight:l=true}){let c=Zz(),d=t||(r?Xz(r):"text"),u=useRef(null),g=useRef(false),p=new Set(o),f=useCallback(()=>{if(!l||o.length===0||!u.current||g.current)return;let b=Math.min(...o)-n,h=u.current,S=h.querySelector("pre");if(!S)return;let w=S.querySelector("code");if(!w)return;let N=w.children;if(b>=0&&b<N.length){let C=N[b];if(C){let k=C.offsetHeight,D=C.offsetTop-k*3;h.scrollTop=Math.max(0,D),g.current=true;}}},[l,o,n]);return useEffect(()=>{g.current=false;},[e,o.join(",")]),useEffect(()=>{let m=setTimeout(f,100);return ()=>clearTimeout(m)},[f,e]),jsxs("div",{className:R("rounded-lg border flex flex-col",a),children:[r&&s&&jsxs("div",{className:"px-3 py-2 bg-muted/50 border-b text-xs font-mono text-muted-foreground flex items-center gap-2 flex-shrink-0",children:[jsx("span",{className:"truncate",children:r}),n>1&&jsxs("span",{className:"text-muted-foreground/60",children:["starting at line ",n]})]}),jsx("div",{ref:u,className:"flex-1 overflow-auto",children:jsx(Ho,{language:d,style:c?Ff:Bf,showLineNumbers:i,startingLineNumber:n,wrapLines:true,lineProps:m=>{let b={display:"block",width:"100%"};return p.has(m)&&(b.backgroundColor=c?"rgba(255, 255, 0, 0.1)":"rgba(255, 255, 0, 0.2)",b.borderLeft="3px solid #f59e0b",b.paddingLeft="0.5rem",b.marginLeft="-0.5rem"),{style:b}},customStyle:{margin:0,padding:"1rem",fontSize:"0.8125rem",lineHeight:"1.5",backgroundColor:c?"#1e1e1e":"#fafafa"},codeTagProps:{style:{fontFamily:'ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace'}},children:e})})]})}function Qz({code:e,language:t,filename:r,className:n}){return jsx(W_,{code:e,language:t,filename:r,showLineNumbers:false,className:R("text-sm",n)})}function Mle(e){let t=new Date,r=new Date(e),n=Math.floor((t.getTime()-r.getTime())/1e3);if(isNaN(n))return "Unknown";if(n<0)return "In the future";if(n<10)return "Just now";if(n<60)return `${n} seconds ago`;let o=Math.floor(n/60);if(o===1)return "1 minute ago";if(o<60)return `${o} minutes ago`;let a=Math.floor(o/60);if(a===1)return "1 hour ago";if(a<24)return `${a} hours ago`;let i=Math.floor(a/24);if(i===1)return "1 day ago";if(i<7)return `${i} days ago`;let s=Math.floor(i/7);if(s===1)return "1 week ago";if(s<4)return `${s} weeks ago`;let l=Math.floor(i/30);if(l===1)return "1 month ago";if(l<12)return `${l} months ago`;let c=Math.floor(i/365);return c===1?"1 year ago":`${c} years ago`}function Ple(e,t={year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}){try{let r=new Date(e);return isNaN(r.getTime())?"Invalid date":r.toLocaleString(void 0,t)}catch{return "Invalid date"}}function Fle(e){if(e<60)return `${Math.floor(e)}s`;let t=Math.floor(e/60);if(t<60)return `${t}m`;let r=Math.floor(t/60),n=t%60;if(r<24)return n>0?`${r}h ${n}m`:`${r}h`;let o=Math.floor(r/24),a=r%24;return a>0?`${o}d ${a}h`:`${o}d`}function Ble(e){let t=new Date,r=new Date(e),n=Math.floor((t.getTime()-r.getTime())/1e3);if(isNaN(n)||n<0)return "--";if(n<60)return `${n}s`;let o=Math.floor(n/60);if(o<60)return `${o}m`;let a=Math.floor(o/60);if(a<24)return `${a}h`;let i=Math.floor(a/24);return i<365?`${i}d`:`${Math.floor(i/365)}y`}function Ule(e){if(e===0)return "0 B";let t=["B","KB","MB","GB","TB"],r=Math.floor(Math.log(e)/Math.log(1024));return `${(e/Math.pow(1024,r)).toFixed(2)} ${t[r]}`}function Hle(e){if(e<1e3)return String(e);if(e<1e6){let r=e/1e3;return `${Number.isInteger(r)?r:r.toFixed(1).replace(/\.0$/,"")}K`}let t=e/1e6;return `${Number.isInteger(t)?t:t.toFixed(1).replace(/\.0$/,"")}M`}function Gle(e){let t=Math.floor(e/1e3),r=Math.floor(t/60),n=Math.floor(r/60);return n>0?`${n}h ${r%60}m`:r>0?`${r}m ${t%60}s`:`${t}s`}var j_=[{bg:"bg-blue-100",text:"text-blue-800",border:"border-blue-300"},{bg:"bg-green-100",text:"text-green-800",border:"border-green-300"},{bg:"bg-yellow-100",text:"text-yellow-800",border:"border-yellow-300"},{bg:"bg-purple-100",text:"text-purple-800",border:"border-purple-300"},{bg:"bg-pink-100",text:"text-pink-800",border:"border-pink-300"},{bg:"bg-indigo-100",text:"text-indigo-800",border:"border-indigo-300"},{bg:"bg-red-100",text:"text-red-800",border:"border-red-300"},{bg:"bg-orange-100",text:"text-orange-800",border:"border-orange-300"},{bg:"bg-teal-100",text:"text-teal-800",border:"border-teal-300"},{bg:"bg-cyan-100",text:"text-cyan-800",border:"border-cyan-300"}];function Jz(e){let t=0;for(let r=0;r<e.length;r++){let n=e.charCodeAt(r);t=(t<<5)-t+n,t=t&t;}return Math.abs(t)}function eU(e){let t=Jz(e)%j_.length;return j_[t]}function qle(e){let t=eU(e);return t?`${t.bg} ${t.text} ${t.border} border`:"bg-gray-100 text-gray-700 border-gray-300 border"}function tU(e,t){let r=new Date,n=new Date(e),o=Math.floor((r.getTime()-n.getTime())/1e3);if(o<60)return t?.justNow?"just now":`${o}s ago`;let a=Math.floor(o/60);if(a<60)return `${a}m ago`;let i=Math.floor(a/60);if(i<24)return `${i}h ago`;let s=Math.floor(i/24);if(s<30)return `${s}d ago`;let l=Math.floor(s/30);return l<12?`${l}mo ago`:`${Math.floor(l/12)}y ago`}function jle(e){return tU(e,{justNow:true})}async function Uf(e,t=5e3){try{let r=new AbortController,n=setTimeout(()=>r.abort(),t),o=await fetch(`${e}/api/health`,{signal:r.signal,method:"GET",headers:{Accept:"application/json"}});return clearTimeout(n),o.ok?(await o.json(),{ready:!0}):{ready:!1,error:`Server returned ${o.status}: ${o.statusText}`,retryAfter:2e3}}catch(r){return r.name==="AbortError"?{ready:false,error:"Request timeout",retryAfter:3e3}:r.code==="ECONNREFUSED"||r.message.includes("fetch")?{ready:false,error:"Server not ready",retryAfter:2e3}:{ready:false,error:r.message,retryAfter:5e3}}}async function V_(e,t={}){let{maxAttempts:r=10,initialDelay:n=1e3,maxDelay:o=1e4,timeout:a=5e3}=t,i=0,s=n;for(;i<r;){i++,console.log(`\u{1F50D} Checking API readiness (attempt ${i}/${r})...`);let l=await Uf(e,a);if(l.ready)return console.log("\u2705 API is ready!"),true;console.log(`\u23F3 API not ready: ${l.error}. Retrying in ${s}ms...`),i<r&&(await new Promise(c=>setTimeout(c,s)),s=Math.min(s*2,o));}return console.error("\u274C API failed to become ready after all attempts"),false}async function rU(e,t,r={}){let n=await Uf(e);if(!n.ready)throw new Error(`API not ready: ${n.error}`);let o=t.startsWith("http")?t:`${e}${t}`,a=await fetch(o,{...r,headers:{"Content-Type":"application/json",...r.headers}});if(!a.ok)throw new Error(`API request failed: ${a.status} ${a.statusText}`);return a.json()}function nU(e,t={}){if(typeof window>"u")return {ready:true,error:null,checking:false};let[r,n]=window.React?.useState?.({ready:false,error:null,checking:true})||{ready:false,error:null,checking:true};return window.React?.useEffect?.(()=>{let o=true;async function a(){if(!o)return;n(s=>({...s,checking:true}));let i=await V_(e,t);o&&n({ready:i,error:i?null:"API is not available",checking:false});}return a(),()=>{o=false;}},[e]),r}function Hf(e,t){if(e===t)return true;if(e==null||t==null||typeof e!="object"||typeof t!="object")return false;let r=Object.keys(e),n=Object.keys(t);if(r.length!==n.length)return false;for(let o of r)if(!n.includes(o)||!Hf(e[o],t[o]))return false;return true}function oU({initialValues:e,defaultValues:t,onSave:r,timeout:n=1e4,validateChanges:o}){let[a,i]=useState(e),[s,l]=useState(false),[c,d]=useState(false),[u,g]=useState(null),p=useRef(e),f=useRef();useEffect(()=>{let w=o?o(a):!Hf(a,p.current);l(w);},[a,o]);let m=useCallback((w,N)=>{i(C=>({...C,[w]:N}));},[]),b=useCallback(async()=>{if(!s||c)return;d(true),g(null);let w=new Promise((N,C)=>{f.current=setTimeout(()=>{C(new Error("Save operation timed out"));},n);});try{await Promise.race([r(a),w]),p.current=a,l(!1);}catch(N){let C=N instanceof Error?N.message:"Failed to save changes";g(C),console.error("Save failed:",N);}finally{f.current&&clearTimeout(f.current),d(false);}},[a,s,c,r,n]),h=useCallback(()=>{i(p.current),l(false),g(null);},[]),S=useCallback(()=>{t&&(i(t),g(null),l(!Hf(t,p.current)));},[t]);return useEffect(()=>()=>{f.current&&clearTimeout(f.current);},[]),{values:a,isDirty:s,isSaving:c,error:u,setValues:i,setFieldValue:m,save:b,reset:h,resetToDefaults:S,canSave:s&&!c}}function lU({appName:e,appVersion:t,navigation:r,children:n,logoSrc:o="/assets/logo.png",logoClassName:a="h-8 w-auto",logoOffset:i,headerHeight:s="h-16",showLogout:l=false,onLogout:c,authenticated:d=true,connectionStatusUrl:u,className:g,primaryColor:p="#3b82f6"}){let f={pathname:"/"};try{let S=useLocation();S&&(f=S);}catch{}let[m,b]=useState(false),h=async()=>{if(c)c();else try{await fetch("/api/logout",{method:"POST"}),window.location.href="/login";}catch(S){console.error("Logout failed:",S);}};return jsxs("div",{className:R("min-h-screen bg-gray-50",g),children:[jsx("header",{className:"bg-black",children:jsx("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8",children:jsxs("div",{className:R("flex justify-between items-center",s),children:[jsxs("div",{className:"flex items-center",children:[jsx("img",{src:o,alt:"Logo",className:R(a,"mr-3"),style:i?{position:"relative",top:i.top??0,left:i.left??0}:void 0,onError:S=>{S.target.style.display="none";}}),e&&jsx("h1",{className:"text-xl font-semibold text-white",children:e}),t&&jsxs("span",{className:"ml-2 text-xs text-gray-400",children:["v",t]})]}),jsxs("div",{className:"flex items-center space-x-4",children:[jsx(ma,{url:u,className:"text-xs text-gray-400"}),l&&d&&jsxs("button",{onClick:h,className:"text-gray-400 hover:text-white flex items-center gap-2 text-sm",children:[jsx(LogOut,{className:"h-4 w-4"}),jsx("span",{className:"hidden sm:inline",children:"Logout"})]}),jsx("button",{className:"md:hidden p-2 text-white",onClick:()=>b(!m),children:m?jsx(X,{className:"h-6 w-6"}):jsx(Menu,{className:"h-6 w-6"})})]})]})})}),jsx("nav",{className:"bg-[#444444]",children:jsxs("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8",children:[jsx("div",{className:"hidden md:flex space-x-0",children:r.map(S=>{let w=f.pathname===S.href||S.href==="/"&&f.pathname==="/"||S.href!=="/"&&f.pathname.startsWith(S.href);return jsxs(Link,{to:S.href,className:R("flex items-center gap-2 px-4 py-3 text-sm font-medium transition-colors",w?"text-white":"text-gray-300 hover:bg-[#555555] hover:text-white"),style:w?{backgroundColor:p}:void 0,children:[S.icon,S.name]},S.href)})}),m&&jsx("div",{className:"md:hidden py-2 space-y-1",children:r.map(S=>{let w=f.pathname===S.href||S.href==="/"&&f.pathname==="/"||S.href!=="/"&&f.pathname.startsWith(S.href);return jsxs(Link,{to:S.href,className:R("flex items-center gap-2 px-3 py-2 rounded text-sm font-medium",w?"text-white":"text-gray-300 hover:text-white hover:bg-[#555555]"),style:w?{backgroundColor:p}:void 0,onClick:()=>b(false),children:[S.icon,S.name]},S.href)})})]})}),jsx("main",{className:"flex-1 max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-6",children:n})]})}function cU({appName:e,appVersion:t,navigation:r,children:n,logoSrc:o="/assets/logo.png",logoClassName:a="h-8 w-auto",logoOffset:i,headerHeight:s="h-16",showLogout:l=false,onLogout:c,authenticated:d=true,connectionStatusUrl:u,sidebarWidth:g=256,className:p}){let f={pathname:"/"};try{f=useLocation();}catch{console.warn("SidebarLayout: useLocation called outside Router context, using default pathname");}let m=async()=>{if(c)c();else try{await fetch("/api/logout",{method:"POST"}),window.location.href="/login";}catch(b){console.error("Logout failed:",b);}};return jsxs("div",{className:R("h-screen flex flex-col bg-gray-50",p),children:[jsx("header",{className:"bg-black",children:jsx("div",{className:"px-4 sm:px-6 lg:px-8",children:jsxs("div",{className:R("flex justify-between items-center",s),children:[jsxs("div",{className:"flex items-center",children:[jsx("img",{src:o,alt:"Logo",className:R(a,"mr-3"),style:i?{position:"relative",top:i.top??0,left:i.left??0}:void 0,onError:b=>{b.target.style.display="none";}}),e&&jsx("h1",{className:"text-xl font-semibold text-white",children:e}),t&&jsxs("span",{className:"ml-2 text-xs text-gray-400",children:["v",t]})]}),jsxs("div",{className:"flex items-center space-x-4",children:[jsx(ma,{url:u,className:"text-white"}),l&&d&&jsxs("button",{onClick:m,className:"text-gray-400 hover:text-white flex items-center gap-2 text-sm",children:[jsx(LogOut,{className:"h-4 w-4"}),jsx("span",{children:"Logout"})]})]})]})})}),jsxs("div",{className:"flex flex-1 overflow-hidden",children:[jsx("nav",{className:"bg-white border-r border-gray-200",style:{width:`${g}px`},children:jsx("div",{className:"p-4",children:jsx("ul",{className:"space-y-1",children:r.map(b=>{let h=f.pathname===b.href||b.href==="/"&&f.pathname==="/"||b.href!=="/"&&f.pathname.startsWith(b.href);return jsx("li",{children:jsxs(Link,{to:b.href,className:R("flex items-center space-x-3 px-3 py-2 rounded-lg transition-colors",h?"bg-blue-50 text-blue-600":"text-gray-700 hover:bg-gray-100"),children:[b.icon,jsx("span",{className:"font-medium",children:b.name})]})},b.href)})})})}),jsx("main",{className:"flex-1 overflow-auto",children:n})]})]})}var uU={active:{bg:"bg-green-500",ring:"ring-green-400"},success:{bg:"bg-emerald-500",ring:"ring-emerald-400"},inactive:{bg:"bg-gray-400",ring:"ring-gray-300"},warning:{bg:"bg-yellow-500",ring:"ring-yellow-400"},error:{bg:"bg-red-500",ring:"ring-red-400"}},dU={xs:"h-2 w-2",sm:"h-3 w-3",md:"h-4 w-4",lg:"h-5 w-5"};function qf({status:e,size:t="sm",animate:r=true,label:n,className:o}){let a=uU[e],i=r&&(e==="active"||e==="warning"||e==="error");return jsxs("div",{className:R("inline-flex items-center gap-2",o),children:[jsxs("span",{className:"relative inline-flex",children:[i&&jsx("span",{className:R("absolute inline-flex h-full w-full rounded-full opacity-75",a.bg,e==="active"&&"animate-ping",e==="warning"&&"animate-pulse",e==="error"&&"animate-pulse")}),jsx("span",{className:R("relative inline-flex rounded-full",dU[t],a.bg,i&&"ring-1",i&&a.ring)})]}),n&&jsx("span",{className:"text-xs text-muted-foreground",children:n})]})}function Wf({data:e,width:t=100,height:r=30,color:n="#10b981",strokeWidth:o=2,fill:a=false,className:i}){let s=useMemo(()=>{if(!e||e.length===0)return "";let c=Math.max(...e),d=Math.min(...e),u=c-d||1;return e.map((g,p)=>{let f=p/(e.length-1)*t,m=r-(g-d)/u*r;return `${f},${m}`}).join(" ")},[e,t,r]);if(!e||e.length===0)return jsx("svg",{width:t,height:r,className:i,children:jsx("line",{x1:"0",y1:r/2,x2:t,y2:r/2,stroke:"#e5e7eb",strokeWidth:1})});let l=s?`0,${r} ${s} ${t},${r}`:"";return jsxs("svg",{width:t,height:r,className:i,children:[a&&s&&jsx("polygon",{points:l,fill:n,fillOpacity:.1}),s&&jsx("polyline",{points:s,fill:"none",stroke:n,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"}),e.length>0&&jsx("circle",{cx:t,cy:r-(e[e.length-1]-Math.min(...e))/(Math.max(...e)-Math.min(...e)||1)*r,r:o,fill:n})]})}function fU({data:e,columns:t,keyField:r,title:n,description:o,showActivity:a=false,activityField:i="activity",activityDecay:s=1e3,showSparkline:l=false,sparklineField:c="value",sparklineHistory:d,sparklineColor:u="#10b981",showStatus:g=false,statusField:p="status",statusConfig:f,expandable:m=false,childrenField:b="children",defaultExpanded:h=false,className:S,striped:w=false,hover:N=true,compact:C=false,onRowClick:k,onRefresh:D}){let[P,A]=useState(new Set),[v,G]=useState(new Map);useEffect(()=>{if(h&&m){let O=e.map(B=>B[r]);A(new Set(O));}},[h,m,e,r]),useEffect(()=>{if(a){let O=new Map;e.forEach(B=>{let W=B[r],V=B[i];V&&V!=="inactive"&&(O.set(W,V),setTimeout(()=>{G(re=>{let Z=new Map(re);return Z.delete(W),Z});},s));}),G(B=>new Map([...B,...O]));}},[e,a,r,i,s]);let _=useCallback(O=>{A(B=>{let W=new Set(B);return W.has(O)?W.delete(O):W.add(O),W});},[]),M=(O,B=0)=>{let W=O[r],V=P.has(W),re=m&&O[b]&&O[b].length>0,Z=v.get(W)||"inactive";return jsxs(Fragment,{children:[jsx(br,{className:R(N&&"hover:bg-gray-50 transition-colors",k&&"cursor-pointer",B>0&&"bg-gray-50/50"),onClick:()=>k?.(O),children:t.map((x,z)=>jsx(hr,{className:R(x.align==="center"&&"text-center",x.align==="right"&&"text-right",C&&"py-2",z===0&&B>0&&`pl-${4+B*4}`),style:{width:x.width},children:jsxs("div",{className:"flex items-center gap-2",children:[z===0&&re&&jsx("button",{onClick:Q=>{Q.stopPropagation(),_(W);},className:"p-0.5 hover:bg-gray-200 rounded",children:V?"\u25BC":"\u25B6"}),z===0&&a&&jsx(qf,{status:Z,size:"sm"}),x.render?x.render(x.accessor(O),O):x.accessor(O),x.key===p&&g&&f&&jsxs(nt,{variant:f[O[p]]?.variant||"default",children:[f[O[p]]?.icon,f[O[p]]?.label||O[p]]}),x.key===c&&l&&d&&jsx(Wf,{data:d.get(W)||[],color:u,width:60,height:20})]})},x.key))},W),V&&re&&O[b].map(x=>M(x,B+1))]})};return jsxs(Ne,{className:S,children:[(n||o)&&jsxs("div",{className:"p-4 border-b",children:[n&&jsx("h3",{className:"font-semibold text-lg",children:n}),o&&jsx("p",{className:"text-sm text-gray-600 mt-1",children:o})]}),jsx("div",{className:"overflow-x-auto",children:jsxs(no,{children:[jsx(oo,{children:jsx(br,{children:t.map(O=>jsx(Zr,{className:R(O.align==="center"&&"text-center",O.align==="right"&&"text-right"),style:{width:O.width},children:O.label},O.key))})}),jsx(ao,{children:e.length===0?jsx(br,{children:jsx(hr,{colSpan:t.length,className:"text-center py-8 text-gray-500",children:"No data available"})}):e.map(O=>M(O))})]})})]})}function hU({stats:e,columns:t=4,className:r}){let n={1:"grid-cols-1",2:"grid-cols-1 md:grid-cols-2",3:"grid-cols-1 md:grid-cols-2 lg:grid-cols-3",4:"grid-cols-1 md:grid-cols-2 lg:grid-cols-4",5:"grid-cols-1 md:grid-cols-2 lg:grid-cols-5",6:"grid-cols-1 md:grid-cols-3 lg:grid-cols-6"},o={default:"",primary:"border-blue-200 bg-blue-50/50",success:"border-green-200 bg-green-50/50",warning:"border-yellow-200 bg-yellow-50/50",danger:"border-red-200 bg-red-50/50"},a={default:"text-gray-600",primary:"text-blue-600",success:"text-green-600",warning:"text-yellow-600",danger:"text-red-600"};return jsx("div",{className:R(`grid gap-4 ${n[t]}`,r),children:e.map((i,s)=>{let l=i.icon,c=i.color||"default";return jsx(Ne,{className:R("p-4 transition-all hover:shadow-md",o[c],i.className),children:jsx("div",{className:"flex items-start justify-between",children:jsxs("div",{className:"flex-1",children:[jsxs("div",{className:"flex items-center gap-2",children:[l&&jsx(l,{className:R("h-4 w-4",a[c])}),jsx("p",{className:"text-sm font-medium text-gray-600",children:i.label})]}),jsxs("div",{className:"mt-2",children:[jsx("p",{className:"text-2xl font-bold",children:i.value}),i.description&&jsx("p",{className:"text-xs text-gray-500 mt-1",children:i.description}),i.trend&&jsxs("div",{className:"flex items-center gap-1 mt-2",children:[jsxs("span",{className:R("text-xs font-medium",i.trend.positive?"text-green-600":"text-red-600"),children:[i.trend.positive?"\u2191":"\u2193",Math.abs(i.trend.value),"%"]}),i.trend.label&&jsx("span",{className:"text-xs text-gray-500",children:i.trend.label})]})]})]})})},s)})})}function yU({label:e,value:t,icon:r,trend:n,className:o}){return jsxs("div",{className:R("flex items-center justify-between p-3 bg-white rounded-lg border",o),children:[jsxs("div",{className:"flex items-center gap-3",children:[r&&jsx("div",{className:"p-2 bg-gray-100 rounded",children:jsx(r,{className:"h-4 w-4 text-gray-600"})}),jsxs("div",{children:[jsx("p",{className:"text-xs text-gray-600",children:e}),jsx("p",{className:"font-semibold",children:t})]})]}),n!==void 0&&jsxs("span",{className:R("text-xs font-medium",n>=0?"text-green-600":"text-red-600"),children:[n>=0?"\u2191":"\u2193"," ",Math.abs(n),"%"]})]})}function SU({stats:e}){if(!e)return null;let{total:t,error:r,warn:n,info:o,debug:a,fileSize:i,oldestEntry:s,newestEntry:l}=e;return jsxs(Ne,{className:"p-4 mb-4",children:[jsxs("div",{className:"grid grid-cols-2 md:grid-cols-6 gap-4",children:[jsxs("div",{children:[jsx("div",{className:"text-sm text-muted-foreground",children:"Total"}),jsx("div",{className:"text-xl font-semibold",children:t??0})]}),jsxs("div",{children:[jsx("div",{className:"text-sm text-muted-foreground",children:"Errors"}),jsx(nt,{variant:"destructive",children:r??0})]}),jsxs("div",{children:[jsx("div",{className:"text-sm text-muted-foreground",children:"Warnings"}),jsx(nt,{variant:"secondary",children:n??0})]}),jsxs("div",{children:[jsx("div",{className:"text-sm text-muted-foreground",children:"Info"}),jsx(nt,{variant:"outline",children:o??0})]}),jsxs("div",{children:[jsx("div",{className:"text-sm text-muted-foreground",children:"Debug"}),jsx(nt,{variant:"outline",children:a??0})]}),jsxs("div",{children:[jsx("div",{className:"text-sm text-muted-foreground",children:"File Size"}),jsx("div",{className:"text-xl font-semibold",children:String(i??"-")})]})]}),(s||l)&&jsxs("div",{className:"mt-3 text-xs text-muted-foreground",children:[s&&jsxs("span",{children:["Oldest: ",s," "]}),l&&jsxs("span",{children:["Newest: ",l]})]})]})}function vU({categories:e,onSave:t,onLoad:r,onValidate:n,onRestartRequired:o,title:a="Settings",description:i="Configure application preferences",showResetButton:s=true,showUndoButton:l=true,customFields:c={},renderCategory:d,renderSetting:u,autoSave:g=false,autoSaveDelay:p=3e3,confirmReset:f=true,persistState:m=true,className:b,containerClassName:h,categoryClassName:S,settingClassName:w,height:N="calc(100vh - 200px)",maxContentWidth:C="800px"}){let[k,D]=useState({}),[P,A]=useState({}),[v,G]=useState({}),[_,M]=useState(true),[O,B]=useState(false),[W,V]=useState(e?.[0]?.id||""),[re,Z]=useState({}),[x,z]=useState(false),[Q,T]=useState(false),[ye,_e]=useState(null),Pe=()=>{let I={};return e.forEach(ee=>{(ee.settings||[]).forEach(se=>{I[se.key]=se.defaultValue;});}),I};useEffect(()=>{(async()=>{M(true);try{let ee=r?await r():Pe();if(D(ee),A(ee),m){let se=localStorage.getItem("settings-active-category");se&&e.find(Ce=>Ce.id===se)&&V(se);}}catch(ee){console.error("Failed to load settings:",ee),D(Pe()),A(Pe());}finally{M(false);}})();},[]),useEffect(()=>{let I=JSON.stringify(k)!==JSON.stringify(P);T(I);},[k,P]),useEffect(()=>{if(!g||!Q)return;let I=setTimeout(()=>{at();},p);return ()=>clearTimeout(I)},[k,g,p,Q]),useEffect(()=>{m&&localStorage.setItem("settings-active-category",W);},[W,m]);let Ue=(I,ee)=>I.validation?I.validation(ee):null,Se=()=>{let I={},ee=false;if(e.forEach(se=>{(se.settings||[]).forEach(Ce=>{let Ve=Ue(Ce,k[Ce.key]);Ve&&(I[Ce.key]=Ve,ee=true);});}),n){let se=n(k);se&&(Object.assign(I,se),ee=true);}return G(I),!ee},at=async()=>{if(Se()){B(true);try{let ee=Object.keys(k).filter(se=>k[se]!==P[se]).filter(se=>e.flatMap(Ve=>Ve.settings||[]).find(Ve=>Ve.key===se)?.requiresRestart);ee.length>0&&(z(!0),o?.(ee)),await t(k),A(k);}catch(I){console.error("Failed to save settings:",I),_e(I instanceof Error?I.message:"Failed to save settings. Please try again.");}finally{B(false);}}},xe=()=>{if(f&&!confirm("Reset all settings to defaults? This will override your current configuration."))return;let I=Pe();D(I);},Qe=()=>{D(P);},it=(I,ee)=>{D(se=>({...se,[I]:ee})),v[I]&&G(se=>{let Ce={...se};return delete Ce[I],Ce}),ye&&_e(null);},H=I=>{if(I.hidden)return null;let ee=k[I.key]??I.defaultValue,se=v[I.key],Ce=re[I.key];if(I.showIf&&!I.showIf(k))return null;let Ve=I.inputWidth==="small"?"max-w-[180px]":I.inputWidth==="large"?"w-full max-w-xl":"max-w-sm";if(I.type==="custom"||I.customComponent){let Ye=I.customComponent||c[I.type];if(Ye)return jsx(Ye,{value:ee,onChange:xn=>it(I.key,xn),error:se,disabled:O,setting:I})}let lr=c[I.type];if(lr)return jsx(lr,{value:ee,onChange:Ye=>it(I.key,Ye),error:se,disabled:O,setting:I});switch(I.type){case "string":case "text":case "password":return jsxs("div",{className:R("flex items-center gap-2",Ve),children:[jsx(kt,{id:I.key,type:I.type==="password"&&!Ce?"password":"text",value:ee||"",onChange:Ye=>it(I.key,Ye.target.value),className:R(se&&"border-red-500",Ve),placeholder:I.placeholder||(I.type==="password"?"\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022":void 0),disabled:O}),I.suffix&&jsx("span",{className:"text-xs text-muted-foreground",children:I.suffix})]});case "number":return jsxs("div",{className:R("flex items-center gap-2",Ve),children:[jsx(kt,{id:I.key,type:"number",value:ee??"",onChange:Ye=>it(I.key,parseFloat(Ye.target.value)||0),className:R(se&&"border-red-500",Ve),placeholder:I.placeholder,disabled:O,step:I.step,min:I.min,max:I.max}),I.suffix&&jsx("span",{className:"text-xs text-muted-foreground",children:I.suffix})]});case "boolean":return jsx(Vt,{id:I.key,checked:ee||false,onCheckedChange:Ye=>it(I.key,Ye),disabled:O});case "select":return jsxs(Et,{value:String(ee||I.defaultValue),onValueChange:Ye=>it(I.key,Ye),disabled:O,children:[jsx(pt,{id:I.key,className:R(se&&"border-red-500"),children:jsx(wt,{})}),jsx(gt,{children:I.options?.map(Ye=>jsx(Fe,{value:String(Ye.value),children:Ye.label},Ye.value))})]});default:return null}},ie=e.find(I=>I.id===W);return jsxs("div",{className:R("flex flex-col",b),style:{height:N},children:[jsxs("div",{className:"flex items-center justify-between mb-6 shrink-0",children:[jsxs("div",{children:[jsx("h1",{className:"text-3xl font-bold",children:a}),jsx("p",{className:"text-muted-foreground",children:i})]}),jsxs("div",{className:"flex items-center gap-2",children:[l&&Q&&jsxs(Y,{variant:"outline",onClick:Qe,disabled:O,children:[jsx(Undo,{className:"h-4 w-4 mr-2"}),"Undo"]}),s&&jsxs(Y,{variant:"outline",onClick:xe,disabled:O,children:[jsx(RotateCcw,{className:"h-4 w-4 mr-2"}),"Defaults"]}),jsx(Y,{onClick:at,disabled:!Q||O,className:R("transition-all",Q&&"ring-2 ring-primary/20"),children:O?jsxs(Fragment,{children:[jsx(RefreshCw,{className:"h-4 w-4 mr-2 animate-spin"}),"Saving..."]}):Q?jsxs(Fragment,{children:[jsx(Save,{className:"h-4 w-4 mr-2"}),"Save"]}):jsxs(Fragment,{children:[jsx(Check,{className:"h-4 w-4 mr-2"}),"Saved"]})})]})]}),ye&&jsxs(st,{variant:"destructive",className:"mb-6 shrink-0",children:[jsx(AlertCircle,{className:"h-4 w-4"}),jsx(lt,{children:ye})]}),jsxs("div",{className:R("flex gap-6 flex-1 min-h-0",h),children:[jsxs(Ne,{className:"w-56 shrink-0 flex flex-col min-h-0",children:[jsx("div",{className:"p-4 border-b shrink-0",children:jsx("h3",{className:"font-semibold",children:"Categories"})}),jsx("div",{className:"flex-1 overflow-y-auto p-2 min-h-0",children:jsx("div",{className:"space-y-1",children:e.map(I=>{let ee=I.icon;return jsxs("button",{onClick:()=>V(I.id),className:R("w-full flex items-center gap-3 px-3 py-2 rounded-md text-sm transition-colors",W===I.id?"bg-primary text-primary-foreground":"hover:bg-muted",S),children:[ee&&jsx(ee,{className:"h-4 w-4 shrink-0"}),jsx("span",{className:"text-left truncate",children:I.label})]},I.id)})})})]}),jsx("div",{className:"flex-1 min-h-0 flex flex-col",children:_?jsx(Ne,{className:"p-8",children:jsx("div",{className:"flex items-center justify-center",children:jsx(RefreshCw,{className:"h-8 w-8 animate-spin text-muted-foreground"})})}):ie?.component?jsxs(Ne,{className:"p-6 flex-1 min-h-0 overflow-y-auto",children:[jsxs("div",{className:"mb-6",children:[jsx("h2",{className:"text-xl font-semibold",children:ie.label}),ie.description&&jsx("p",{className:"text-sm text-muted-foreground mt-1",children:ie.description})]}),jsx(ie.component,{category:ie})]}):ie?jsx(Ne,{className:"p-6 flex-1 min-h-0 overflow-y-auto",children:jsx("div",{style:{maxWidth:C},children:d?d(ie,jsx("div",{className:"space-y-6",children:(ie.settings||[]).map(I=>{let ee=H(I);if(!ee)return null;let se=jsxs("div",{className:R("space-y-2",w),children:[jsxs("div",{className:"flex items-center justify-between",children:[jsxs("div",{className:"flex items-center gap-2",children:[jsxs(Rt,{htmlFor:I.key,className:"text-sm font-medium",children:[I.label,I.requiresRestart&&jsx("span",{className:"ml-2 text-xs text-amber-600 dark:text-amber-400",children:"(Requires restart)"})]}),I.help&&jsx("button",{type:"button",className:"text-muted-foreground hover:text-foreground transition-colors",title:I.help,children:jsx(Info,{className:"h-3 w-3"})})]}),I.type==="password"&&k[I.key]&&jsx(Y,{type:"button",variant:"ghost",size:"sm",className:"h-6 px-2",onClick:()=>Z(Ce=>({...Ce,[I.key]:!Ce[I.key]})),children:re[I.key]?jsx(EyeOff,{className:"h-3 w-3"}):jsx(Eye,{className:"h-3 w-3"})})]}),I.description&&jsx("p",{className:"text-xs text-muted-foreground",children:I.description}),I.hint&&jsx("p",{className:"text-[11px] text-muted-foreground",children:I.hint}),ee,v[I.key]&&jsx("p",{className:"text-xs text-red-500",children:v[I.key]})]},I.key);return u?u(I,se):se})})):jsxs(Fragment,{children:[jsxs("div",{className:"mb-6",children:[jsx("h2",{className:"text-xl font-semibold",children:ie.label}),jsx("p",{className:"text-sm text-muted-foreground mt-1",children:ie.description})]}),jsx("div",{className:"space-y-6",children:(ie.settings||[]).map(I=>{let ee=H(I);if(!ee)return null;let se=jsxs("div",{className:R("space-y-2",w),children:[jsxs("div",{className:"flex items-center justify-between",children:[jsxs("div",{className:"flex items-center gap-2",children:[jsxs(Rt,{htmlFor:I.key,className:"text-sm font-medium",children:[I.label,I.requiresRestart&&jsx("span",{className:"ml-2 text-xs text-amber-600 dark:text-amber-400",children:"(Requires restart)"})]}),I.help&&jsx("button",{type:"button",className:"text-muted-foreground hover:text-foreground transition-colors",title:I.help,children:jsx(Info,{className:"h-3 w-3"})})]}),I.type==="password"&&k[I.key]&&jsx(Y,{type:"button",variant:"ghost",size:"sm",className:"h-6 px-2",onClick:()=>Z(Ce=>({...Ce,[I.key]:!Ce[I.key]})),children:re[I.key]?jsx(EyeOff,{className:"h-3 w-3"}):jsx(Eye,{className:"h-3 w-3"})})]}),I.description&&jsx("p",{className:"text-xs text-muted-foreground",children:I.description}),ee,v[I.key]&&jsx("p",{className:"text-xs text-red-500",children:v[I.key]})]},I.key);return u?u(I,se):se})})]})})}):jsx(Ne,{className:"p-8",children:jsxs(st,{children:[jsx(AlertCircle,{className:"h-4 w-4"}),jsx(lt,{children:"No settings available for this category"})]})})})]}),x&&jsxs(st,{className:"border-amber-500",children:[jsx(AlertCircle,{className:"h-4 w-4 text-amber-600"}),jsx(lt,{children:"Some settings require a restart to take effect."})]})]})}function TU({onFetchLogs:e,onFetchArchives:t,onClearLogs:r,onDownloadArchive:n,onDeleteArchive:o,autoRefreshMs:a=3e3,height:i="calc(100vh - 400px)"}){return jsx(co,{onFetchLogs:e,onFetchArchives:t,onClearLogs:r,onDownloadArchive:n,onDeleteArchive:o,enableAutoScroll:true,autoRefreshMs:a,enableSearch:true,enableFilter:true,enableExport:true,enableClear:!!r,showArchives:!!t,height:i})}var Ns={colors:{primary:{DEFAULT:"#3b82f6",hover:"#2563eb",light:"#60a5fa",dark:"#1d4ed8"},dark:{bg:{primary:"#0a0a0a",secondary:"#141414",tertiary:"#1a1a1a",elevated:"#242424"},border:{DEFAULT:"#2a2a2a",subtle:"#1f1f1f",strong:"#3a3a3a"}},light:{bg:{primary:"#ffffff",secondary:"#f8f9fa",tertiary:"#f3f4f6",elevated:"#ffffff"},border:{DEFAULT:"#e5e7eb",subtle:"#f3f4f6",strong:"#d1d5db"}},success:{DEFAULT:"#10b981",light:"#34d399",dark:"#059669"},warning:{DEFAULT:"#f59e0b",light:"#fbbf24",dark:"#d97706"},error:{DEFAULT:"#ef4444",light:"#f87171",dark:"#dc2626"},info:{DEFAULT:"#3b82f6",light:"#60a5fa",dark:"#2563eb"},intelligent:{DEFAULT:"#8b5cf6",light:"#a78bfa",dark:"#7c3aed"},activity:{read:"#10b981",write:"#3b82f6",inactive:"#6b7280"}},gradients:{subtle:"linear-gradient(180deg, rgba(255,255,255,0.05) 0%, rgba(255,255,255,0) 100%)",card:"linear-gradient(135deg, rgba(255,255,255,0.1) 0%, rgba(255,255,255,0.05) 100%)",glow:"radial-gradient(circle at 50% 0%, rgba(226,19,80,0.15) 0%, transparent 70%)",intelligent:"linear-gradient(135deg, rgba(139,92,246,0.1) 0%, rgba(139,92,246,0.05) 100%)"},shadows:{sm:"0 1px 2px 0 rgba(0, 0, 0, 0.05)",DEFAULT:"0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06)",md:"0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06)",lg:"0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05)",xl:"0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04)",glow:"0 0 20px rgba(226,19,80,0.3)","glow-intelligent":"0 0 20px rgba(139,92,246,0.3)"},radius:{sm:"0.25rem",DEFAULT:"0.375rem",md:"0.5rem",lg:"0.75rem",xl:"1rem","2xl":"1.5rem",full:"9999px"},spacing:{xs:"0.5rem",sm:"0.75rem",DEFAULT:"1rem",md:"1.5rem",lg:"2rem",xl:"3rem","2xl":"4rem"},typography:{fonts:{sans:'Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif',mono:'"JetBrains Mono", "SF Mono", Monaco, Consolas, "Liberation Mono", "Courier New", monospace'},sizes:{xs:"0.75rem",sm:"0.875rem",base:"1rem",lg:"1.125rem",xl:"1.25rem","2xl":"1.5rem","3xl":"1.875rem","4xl":"2.25rem"},weights:{light:"300",normal:"400",medium:"500",semibold:"600",bold:"700"}},transitions:{fast:"150ms",DEFAULT:"200ms",slow:"300ms",timing:"cubic-bezier(0.4, 0, 0.2, 1)"},zIndex:{base:0,elevated:10,dropdown:20,sticky:30,fixed:40,modal:50,popover:60,tooltip:70},opacity:{hover:.8,disabled:.5,backdrop:.7,subtle:.1}},Vce=(e=false)=>{let t=e?Ns.colors.dark:Ns.colors.light;return {"--color-bg-primary":t.bg.primary,"--color-bg-secondary":t.bg.secondary,"--color-bg-tertiary":t.bg.tertiary,"--color-bg-elevated":t.bg.elevated,"--color-border":t.border.DEFAULT,"--color-border-subtle":t.border.subtle,"--color-border-strong":t.border.strong,"--color-text":e?"#ffffff":"#000000","--color-text-secondary":e?"#a1a1aa":"#6b7280","--color-text-tertiary":e?"#71717a":"#9ca3af"}};var iO=createContext(void 0);function RU({children:e,defaultMode:t="system",theme:r=Ns,customColors:n,persistPreference:o=true}){let[a,i]=useState({mode:t,theme:r,customColors:n}),[s,l]=useState(false);useEffect(()=>{if(o){let g=localStorage.getItem("theme-mode");g&&i(p=>({...p,mode:g}));}},[o]),useEffect(()=>{let g=document.documentElement;if(a.mode==="system"){let p=window.matchMedia("(prefers-color-scheme: dark)"),f=p.matches;l(f),g.classList.toggle("dark",f);let m=b=>{let h=b.matches;l(h),g.classList.toggle("dark",h);};return p.addEventListener("change",m),()=>{p.removeEventListener("change",m);}}else {let p=a.mode==="dark";l(p),g.classList.toggle("dark",p);return}},[a.mode]),useEffect(()=>{if(n){let g=document.documentElement;if(n.primary){let p=Yf(n.primary);g.style.setProperty("--primary",p);}if(n.secondary){let p=Yf(n.secondary);g.style.setProperty("--secondary",p);}if(n.accent){let p=Yf(n.accent);g.style.setProperty("--accent",p);}}},[n]);let c=g=>{i(p=>({...p,mode:g})),o&&localStorage.setItem("theme-mode",g);},u={themeConfig:a,setThemeMode:c,toggleTheme:()=>{c(s?"light":"dark");},isDark:s};return jsx(iO.Provider,{value:u,children:e})}function Rs(){let e=useContext(iO);if(!e)throw new Error("useTheme must be used within a ThemeProvider");return e}function Yf(e){e=e.replace("#","");let t=parseInt(e.substr(0,2),16)/255,r=parseInt(e.substr(2,2),16)/255,n=parseInt(e.substr(4,2),16)/255,o=Math.max(t,r,n),a=Math.min(t,r,n),i=0,s=0,l=(o+a)/2;if(o!==a){let c=o-a;switch(s=l>.5?c/(2-o-a):c/(o+a),o){case t:i=((r-n)/c+(r<n?6:0))/6;break;case r:i=((n-t)/c+2)/6;break;case n:i=((t-r)/c+4)/6;break}}return `${Math.round(i*360)} ${Math.round(s*100)}% ${Math.round(l*100)}%`}function OU({className:e,showLabel:t=true,variant:r="select"}){let{themeConfig:n,setThemeMode:o,toggleTheme:a,isDark:i}=Rs();return r==="button"?jsxs("div",{className:R("flex items-center gap-2",e),children:[t&&jsx(Rt,{children:"Theme"}),jsx(Y,{variant:"outline",size:"icon",onClick:a,className:"w-10 h-10",children:i?jsx(Sun,{className:"h-4 w-4"}):jsx(Moon,{className:"h-4 w-4"})})]}):jsxs("div",{className:R("flex flex-col gap-2",e),children:[t&&jsx(Rt,{htmlFor:"theme-select",children:"Theme"}),jsxs(Et,{value:n.mode,onValueChange:s=>o(s),children:[jsx(pt,{id:"theme-select",className:"w-[180px]",children:jsx(wt,{placeholder:"Select theme"})}),jsxs(gt,{children:[jsx(Fe,{value:"light",children:jsxs("div",{className:"flex items-center gap-2",children:[jsx(Sun,{className:"h-4 w-4"}),jsx("span",{children:"Light"})]})}),jsx(Fe,{value:"dark",children:jsxs("div",{className:"flex items-center gap-2",children:[jsx(Moon,{className:"h-4 w-4"}),jsx("span",{children:"Dark"})]})}),jsx(Fe,{value:"system",children:jsxs("div",{className:"flex items-center gap-2",children:[jsx(Monitor,{className:"h-4 w-4"}),jsx("span",{children:"System"})]})})]})]})]})}function LU({className:e}){let{toggleTheme:t,isDark:r}=Rs();return jsx(Y,{variant:"ghost",size:"icon",onClick:t,className:R("w-8 h-8",e),title:`Switch to ${r?"light":"dark"} theme`,children:r?jsx(Sun,{className:"h-4 w-4"}):jsx(Moon,{className:"h-4 w-4"})})}var zU=[{id:"general",label:"General",description:"Basic application settings",icon:jsx(Settings,{className:"h-4 w-4"}),settings:[]},{id:"network",label:"Network",description:"Network and connectivity",icon:jsx(Network,{className:"h-4 w-4"}),settings:[]},{id:"logging",label:"Logging",description:"Logging configuration",icon:jsx(FileText,{className:"h-4 w-4"}),settings:[]},{id:"security",label:"Security",description:"Security settings",icon:jsx(Shield,{className:"h-4 w-4"}),settings:[]},{id:"notifications",label:"Notifications",description:"Email and alerts",icon:jsx(Mail,{className:"h-4 w-4"}),settings:[]},{id:"appearance",label:"Appearance",description:"UI preferences",icon:jsx(Palette,{className:"h-4 w-4"}),settings:[]},{id:"advanced",label:"Advanced",description:"Advanced settings",icon:jsx(Activity,{className:"h-4 w-4"}),settings:[]}];function UU(e,t,r,n){return {id:e,label:t,description:n,icon:HU[r]||jsx(Settings,{className:"h-4 w-4"})}}var HU={Server:jsx(Server,{className:"h-4 w-4"}),Network:jsx(Network,{className:"h-4 w-4"}),FileText:jsx(FileText,{className:"h-4 w-4"}),Shield:jsx(Shield,{className:"h-4 w-4"}),Mail:jsx(Mail,{className:"h-4 w-4"}),Settings:jsx(Settings,{className:"h-4 w-4"}),Database:jsx(Database,{className:"h-4 w-4"}),Bell:jsx(Bell,{className:"h-4 w-4"}),Users:jsx(Users,{className:"h-4 w-4"}),Palette:jsx(Palette,{className:"h-4 w-4"}),Globe:jsx(Globe,{className:"h-4 w-4"}),Activity:jsx(Activity,{className:"h-4 w-4"})};function WU({apiUrl:e="/api/updates",checkInterval:t=36e5,onDownload:r}){let[n,o]=useState(null),[a,i]=useState(false),[s,l]=useState(false),[c,d]=useState(false);useEffect(()=>{u();let f=setInterval(u,t);return ()=>clearInterval(f)},[t]);let u=async(f=false)=>{i(true);try{let m=await fetch(`${e}/check${f?"?force=true":""}`);if(m.ok){let b=await m.json();o(b),b.updateAvailable&&s&&localStorage.getItem("dismissedUpdateVersion")!==b.latestRelease?.version&&l(!1);}}catch(m){console.error("Failed to check for updates:",m);}finally{i(false);}},g=()=>{l(true),n?.latestRelease&&localStorage.setItem("dismissedUpdateVersion",n.latestRelease.version);},p=async()=>{if(r&&n)r(n);else try{let f=await fetch(`${e}/download-url`);if(f.ok){let{url:m}=await f.json();window.open(m,"_blank");}}catch{n?.latestRelease?.url&&window.open(n.latestRelease.url,"_blank");}};return !n?.updateAvailable||s?null:jsx("div",{className:"fixed bottom-4 right-4 z-50 max-w-md animate-in slide-in-from-bottom-2",children:jsxs(st,{className:"border-green-500 bg-green-50 dark:bg-green-950/20",children:[jsx(Download,{className:"h-4 w-4 text-green-600 dark:text-green-400"}),jsxs(lt,{className:"pr-8",children:[jsxs("div",{className:"font-semibold text-green-800 dark:text-green-200 mb-1",children:["Update Available: v",n.latestRelease?.version]}),jsx("div",{className:"text-sm text-green-700 dark:text-green-300 mb-3",children:n.latestRelease?.name||"A new version is available"}),c&&n.latestRelease?.body&&jsx("div",{className:"mt-3 p-2 bg-white/50 dark:bg-black/20 rounded text-xs",children:jsx("pre",{className:"whitespace-pre-wrap font-sans",children:n.latestRelease.body})}),jsxs("div",{className:"flex gap-2 mt-3",children:[jsxs(Y,{size:"sm",variant:"default",onClick:p,className:"bg-green-600 hover:bg-green-700",children:[jsx(Download,{className:"h-3 w-3 mr-1"}),"Download"]}),jsxs(Y,{size:"sm",variant:"outline",onClick:()=>d(!c),children:[c?"Hide":"Show"," Changes"]}),jsx(Y,{size:"sm",variant:"ghost",onClick:()=>window.open(n.latestRelease?.url,"_blank"),children:jsx(ExternalLink,{className:"h-3 w-3"})})]})]}),jsx(Y,{size:"sm",variant:"ghost",className:"absolute top-2 right-2 h-6 w-6 p-0",onClick:g,children:jsx(X,{className:"h-4 w-4"})})]})})}function YU(e,t){let[r,n]=useState(e);return useEffect(()=>{let o=setTimeout(()=>{n(e);},t);return ()=>{clearTimeout(o);}},[e,t]),r}function KU(e){let[t,r]=po(e);return {connected:t.connected,connecting:t.connecting,transport:t.transport,error:t.error,retryCount:t.retryCount,reconnect:r.reconnect}}var Qf=class{constructor(t={}){this.config={loginEndpoint:t.loginEndpoint||"/api/login",logoutEndpoint:t.logoutEndpoint||"/api/logout",refreshEndpoint:t.refreshEndpoint||"/api/refresh",tokenKey:t.tokenKey||"auth_token",authKey:t.authKey||"authenticated",tokenExpiry:t.tokenExpiry||36e5};}async login(t,r){try{let n=await fetch(this.config.loginEndpoint,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:t,password:r})}),o=await n.json();return n.ok&&o.success?(localStorage.setItem(this.config.authKey,"true"),o.token&&(localStorage.setItem(this.config.tokenKey,o.token),this.scheduleTokenRefresh(o.expiresIn||this.config.tokenExpiry)),o.user&&localStorage.setItem("user",JSON.stringify(o.user)),{success:!0,token:o.token,user:o.user,expiresIn:o.expiresIn}):{success:!1,error:o.error||"Invalid credentials"}}catch(n){return console.error("Login error:",n),{success:false,error:"Login failed. Please try again."}}}async logout(){try{let t=this.getToken();t&&await fetch(this.config.logoutEndpoint,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${t}`}});}catch(t){console.error("Logout error:",t);}finally{localStorage.removeItem(this.config.authKey),localStorage.removeItem(this.config.tokenKey),localStorage.removeItem("user"),this.refreshTimer&&clearTimeout(this.refreshTimer);}}isAuthenticated(){return localStorage.getItem(this.config.authKey)==="true"}getToken(){return localStorage.getItem(this.config.tokenKey)}getUser(){let t=localStorage.getItem("user");if(t)try{return JSON.parse(t)}catch{return null}return null}async refreshToken(){try{let t=this.getToken();if(!t)return !1;let r=await fetch(this.config.refreshEndpoint,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${t}`}});if(r.ok){let n=await r.json();if(n.token)return localStorage.setItem(this.config.tokenKey,n.token),this.scheduleTokenRefresh(n.expiresIn||this.config.tokenExpiry),!0}return !1}catch(t){return console.error("Token refresh error:",t),false}}scheduleTokenRefresh(t){this.refreshTimer&&clearTimeout(this.refreshTimer);let r=Math.max(0,t-3e5);this.refreshTimer=setTimeout(()=>{this.refreshToken();},r);}async authenticatedFetch(t,r={}){let n=this.getToken(),o=new Headers(r.headers);n&&o.set("Authorization",`Bearer ${n}`);let a=await fetch(t,{...r,headers:o});if(a.status===401&&await this.refreshToken()){let s=this.getToken();return s&&o.set("Authorization",`Bearer ${s}`),fetch(t,{...r,headers:o})}return a}requireAuth(t="/login"){return this.isAuthenticated()?true:(window.location.href=t,false)}},XU=new Qf;var vue={base:"transition-all duration-200",interactive:"hover:shadow-md hover:border-gray-300 dark:hover:border-gray-700 cursor-pointer",elevation:"shadow-sm"},Tue={primary:"gap-2",icon:"h-4 w-4"},Aue={container:"flex flex-col items-center justify-center py-12 text-center",icon:"h-12 w-12 text-muted-foreground mb-4",title:"text-lg font-medium mb-2",description:"text-sm text-muted-foreground max-w-sm"},Cue={led:"w-2 h-2 rounded-full transition-all duration-200",pulse:"animate-pulse",colors:{read:"bg-green-500",write:"bg-blue-500",inactive:"bg-gray-400",error:"bg-red-500"}},Nue={badge:{success:"bg-green-100 text-green-800 dark:bg-green-900 dark:text-green-200",warning:"bg-yellow-100 text-yellow-800 dark:bg-yellow-900 dark:text-yellow-200",error:"bg-red-100 text-red-800 dark:bg-red-900 dark:text-red-200",info:"bg-blue-100 text-blue-800 dark:bg-blue-900 dark:text-blue-200",default:"bg-gray-100 text-gray-800 dark:bg-gray-800 dark:text-gray-200"}};var QU=25,JU=[10,25,50,100];function qo({data:e,pageSize:t=QU,storageKey:r}){let[n,o]=useState(()=>{if(r)try{let h=localStorage.getItem(`pagination-${r}`);if(h)return {page:1,pageSize:JSON.parse(h).pageSize||t}}catch{}return {page:1,pageSize:t}}),{page:a,pageSize:i}=n,s=useMemo(()=>Math.max(1,Math.ceil(e.length/i)),[e.length,i]);useEffect(()=>{a>s&&o(h=>({...h,page:Math.max(1,s)}));},[s,a]),useEffect(()=>{if(r)try{localStorage.setItem(`pagination-${r}`,JSON.stringify({pageSize:i}));}catch{}},[i,r]);let l=(a-1)*i,c=Math.min(l+i,e.length),d=useMemo(()=>e.slice(l,c),[e,l,c]),u=useCallback(h=>{o(S=>({...S,page:Math.max(1,Math.min(h,s))}));},[s]),g=useCallback(h=>{o({page:1,pageSize:h});},[]),p=useCallback(()=>{u(a+1);},[a,u]),f=useCallback(()=>{u(a-1);},[a,u]),m=useCallback(()=>{u(1);},[u]),b=useCallback(()=>{u(s);},[s,u]);return {paginatedData:d,page:a,pageSize:i,totalPages:s,totalItems:e.length,setPage:u,setPageSize:g,nextPage:p,prevPage:f,firstPage:m,lastPage:b,startIndex:l+1,endIndex:c,canGoNext:a<s,canGoPrev:a>1,pageSizeOptions:JU}}function Wo({columns:e,storageKey:t}){let r=`column-visibility-${t}`,[n,o]=useState(()=>{let c={};if(e.forEach(d=>{c[d.id]=d.defaultVisible!==false;}),typeof window>"u")return c;try{let d=localStorage.getItem(r);if(d){let u=JSON.parse(d),g={};return e.forEach(p=>{p.locked?g[p.id]=!0:u[p.id]!==void 0?g[p.id]=u[p.id]:g[p.id]=p.defaultVisible!==!1;}),g}}catch(d){console.error("Error loading column visibility state:",d);}return c});useEffect(()=>{if(!(typeof window>"u"))try{localStorage.setItem(r,JSON.stringify(n));}catch(c){console.error("Error saving column visibility state:",c);}},[n,r]);let a=useCallback(c=>e.find(u=>u.id===c)?.locked?true:n[c]!==false,[n,e]),i=useCallback(c=>{e.find(u=>u.id===c)?.locked||o(u=>({...u,[c]:!u[c]}));},[e]),s=useCallback(()=>{let c={};e.forEach(d=>{c[d.id]=true;}),o(c);},[e]),l=useCallback(()=>{let c={};e.forEach(d=>{c[d.id]=d.locked===true;}),o(c);},[e]);return {visibleColumns:n,isColumnVisible:a,toggleColumn:i,showAllColumns:s,hideAllColumns:l,columns:e}}var bO=50,Ls=150,n6=3;function jo({tableId:e,columns:t,storageKey:r}){let n=r||`table-columns-${e}`,o=useCallback(()=>t.reduce((C,k)=>(C[k.key]=k.defaultWidth||Ls,C),{}),[t]),[a,i]=useState(()=>{try{let C=localStorage.getItem(n);if(C){let k=JSON.parse(C);return {widths:{...o(),...k},isResizing:!1,resizingColumn:null}}}catch{}return {widths:o(),isResizing:false,resizingColumn:null}}),s=useRef(0),l=useRef(0),c=useRef(null),d=useRef(false),u=useRef(t);useEffect(()=>{u.current=t;},[t]);let g=useCallback(C=>u.current.find(k=>k.key===C),[]);useEffect(()=>{try{localStorage.setItem(n,JSON.stringify(a.widths));}catch{}},[a.widths,n]);let p=useRef(null);p.current||(p.current={onPointerMove:C=>{if(!c.current)return;let k=C.clientX-s.current;if(!d.current){if(Math.abs(k)<n6)return;d.current=true,i(G=>({...G,isResizing:true,resizingColumn:c.current})),document.body.style.cursor="col-resize",document.body.style.userSelect="none";}let D=g(c.current),P=D?.minWidth||bO,A=D?.maxWidth,v=Math.max(P,l.current+k);A&&(v=Math.min(A,v)),i(G=>({...G,widths:{...G.widths,[c.current]:v}}));},onPointerUp:()=>{c.current=null,d.current=false,i(C=>({...C,isResizing:false,resizingColumn:null})),document.removeEventListener("pointermove",p.current.onPointerMove),document.removeEventListener("pointerup",p.current.onPointerUp),document.removeEventListener("pointercancel",p.current.onPointerUp),document.body.style.cursor="",document.body.style.userSelect="";}}),useEffect(()=>()=>{p.current&&(document.removeEventListener("pointermove",p.current.onPointerMove),document.removeEventListener("pointerup",p.current.onPointerUp),document.removeEventListener("pointercancel",p.current.onPointerUp)),document.body.style.cursor="",document.body.style.userSelect="";},[]);let f=useRef(a.widths);useEffect(()=>{f.current=a.widths;},[a.widths]);let m=useCallback((C,k)=>{s.current=k,l.current=f.current[C]||Ls,c.current=C,d.current=false,document.addEventListener("pointermove",p.current.onPointerMove),document.addEventListener("pointerup",p.current.onPointerUp),document.addEventListener("pointercancel",p.current.onPointerUp);},[]),b=useCallback(C=>({onPointerDown:k=>{k.preventDefault(),k.stopPropagation(),m(C,k.clientX);},onMouseDown:k=>{k.preventDefault(),k.stopPropagation();},draggable:false,onDragStart:k=>{k.preventDefault(),k.stopPropagation();},className:"resize-handle","data-resizing":a.resizingColumn===C}),[m,a.resizingColumn]),h=useCallback(C=>{let k=a.widths[C]||Ls,P=g(C)?.minWidth||bO;return {width:k,minWidth:P,position:"relative"}},[a.widths,g]),S=t.reduce((C,k)=>C+(a.widths[k.key]||k.defaultWidth||Ls),0),w=useCallback(()=>({minWidth:S}),[S]),N=useCallback(()=>{i(C=>({...C,widths:o()}));},[o]);return {widths:a.widths,isResizing:a.isResizing,totalWidth:S,getResizeHandleProps:b,getColumnStyle:h,getTableStyle:w,resetToDefaults:N}}function Vo({storageKey:e,defaultOrder:t}){let[r,n]=useState(()=>{try{let l=localStorage.getItem(e);if(l){let c=JSON.parse(l),d=new Set(c),u=new Set(t),g=c.filter(f=>u.has(f)),p=t.filter(f=>!d.has(f));if(p.length>0){let f=[...g];for(let m of p){let b=t.indexOf(m),h=f.length;for(let S=0;S<f.length;S++)if(t.indexOf(f[S])>b){h=S;break}f.splice(h,0,m);}return f}return g.length>0?g:t}}catch(l){console.warn("Failed to load column order from localStorage:",l);}return t});useEffect(()=>{try{localStorage.setItem(e,JSON.stringify(r));}catch(l){console.warn("Failed to save column order to localStorage:",l);}},[e,r]);let o=useCallback((l,c)=>{l!==c&&n(d=>{let u=[...d],[g]=u.splice(l,1);return g!==void 0&&u.splice(c,0,g),u});},[]),a=useCallback((l,c)=>{n(d=>{let u=d.indexOf(l);if(u===-1)return d;let g=c==="left"?Math.max(0,u-1):Math.min(d.length-1,u+1);if(u===g)return d;let p=[...d],[f]=p.splice(u,1);return f!==void 0&&p.splice(g,0,f),p});},[]),i=useCallback(()=>{n(t);},[t]),s=useCallback(l=>{let c=new Map(l.map(d=>[d.id,d]));return r.map(d=>c.get(d)).filter(d=>d!==void 0)},[r]);return {columnOrder:r,moveColumn:o,moveColumnById:a,resetOrder:i,getOrderedColumns:s}}function Yo(e,t,r=[]){let[n,o]=useState({isDragging:false,draggedId:null,dropIndex:null}),a=useCallback(u=>{r.includes(u)||o({isDragging:true,draggedId:u,dropIndex:null});},[r]),i=useCallback((u,g)=>{if(r.includes(u))return;let p=e.indexOf(u);if(p===-1)return;let f=g.currentTarget.getBoundingClientRect(),m=f.left+f.width/2,b=g.clientX<m?p:p+1;o(h=>({...h,dropIndex:b}));},[r,e]),s=useCallback(()=>{if(!n.draggedId||n.dropIndex===null){o({isDragging:false,draggedId:null,dropIndex:null});return}let u=e.indexOf(n.draggedId),g=n.dropIndex;u<g&&(g=g-1),u!==-1&&g!==-1&&u!==g&&t(u,g),o({isDragging:false,draggedId:null,dropIndex:null});},[n.draggedId,n.dropIndex,e,t]),l=useCallback(()=>{o({isDragging:false,draggedId:null,dropIndex:null});},[]),c=useCallback(u=>({draggable:!r.includes(u),onDragStart:g=>{if(r.includes(u)){g.preventDefault();return}g.dataTransfer.effectAllowed="move",a(u);},onDragOver:g=>{g.preventDefault(),g.dataTransfer.dropEffect="move",i(u,g);},onDrop:g=>{g.preventDefault(),s();},onDragEnd:l}),[r,a,i,s,l]),d=useCallback(u=>!n.isDragging||n.dropIndex===null?false:e.indexOf(u)===n.dropIndex,[n.isDragging,n.dropIndex,e]);return {dragState:n,getDragHandleProps:c,showDropIndicator:d}}function Ko({page:e,pageSize:t,totalPages:r,totalItems:n,startIndex:o,endIndex:a,canGoNext:i,canGoPrev:s,pageSizeOptions:l,onPageChange:c,onPageSizeChange:d,onNextPage:u,onPrevPage:g,onFirstPage:p,onLastPage:f,className:m}){let b=()=>{let h=[],w=Math.floor(2.5),N=Math.max(1,e-w),C=Math.min(r,e+w);e<=w&&(C=Math.min(r,5)),e>r-w&&(N=Math.max(1,r-5+1)),N>1&&(h.push(1),N>2&&h.push("ellipsis"));for(let k=N;k<=C;k++)k!==1&&k!==r&&h.push(k);return C<r&&(C<r-1&&h.push("ellipsis"),h.push(r)),h};return n===0?null:jsxs("div",{className:R("flex flex-col sm:flex-row items-center justify-between gap-4 px-2 py-3",m),children:[jsxs("div",{className:"text-sm text-muted-foreground",children:["Showing ",o," to ",a," of ",n," items"]}),jsxs("div",{className:"flex items-center gap-4",children:[jsxs("div",{className:"flex items-center gap-2",children:[jsx("span",{className:"text-sm text-muted-foreground",children:"Per page:"}),jsxs(Et,{value:String(t),onValueChange:h=>d(Number(h)),children:[jsx(pt,{className:"w-20 h-8",children:jsx(wt,{})}),jsx(gt,{children:l.map(h=>jsx(Fe,{value:String(h),children:h},h))})]})]}),jsxs("div",{className:"flex items-center gap-1",children:[jsx(Y,{variant:"outline",size:"icon",className:"h-8 w-8",onClick:p,disabled:!s,title:"First page",children:jsx(ChevronsLeft,{className:"h-4 w-4"})}),jsx(Y,{variant:"outline",size:"icon",className:"h-8 w-8",onClick:g,disabled:!s,title:"Previous page",children:jsx(ChevronLeft,{className:"h-4 w-4"})}),jsx("div",{className:"flex items-center gap-1",children:b().map((h,S)=>h==="ellipsis"?jsx("span",{className:"px-2 text-muted-foreground",children:"..."},`ellipsis-${S}`):jsx(Y,{variant:e===h?"default":"outline",size:"icon",className:"h-8 w-8",onClick:()=>c(h),children:h},h))}),jsx(Y,{variant:"outline",size:"icon",className:"h-8 w-8",onClick:u,disabled:!i,title:"Next page",children:jsx(ChevronRight,{className:"h-4 w-4"})}),jsx(Y,{variant:"outline",size:"icon",className:"h-8 w-8",onClick:f,disabled:!i,title:"Last page",children:jsx(ChevronsRight,{className:"h-4 w-4"})})]})]})]})}function Jf({data:e,columns:t,storageKey:r,getRowId:n,selectable:o=false,selectedIds:a,onSelectionChange:i,onRowClick:s,onRowContextMenu:l,sortField:c,sortOrder:d,onSort:u,actionsColumn:g,actionsColumnWidth:p=80,pageSize:f=25,pagination:m,hidePagination:b=false,className:h,rowClassName:S,enableHeaderContextMenu:w=true,lockedColumns:N=[],defaultColumnOrder:C,loading:k=false,emptyState:D}){let P=useMemo(()=>{let H=[];return o&&H.push({key:"select",defaultWidth:40,minWidth:40}),t.forEach(ie=>{H.push({key:ie.id,defaultWidth:ie.width?.default??150,minWidth:ie.width?.min??80,maxWidth:ie.width?.max});}),g&&H.push({key:"actions",defaultWidth:p,minWidth:60}),H},[t,o,g,p]),A=useMemo(()=>t.map(H=>({id:H.id,label:typeof H.header=="string"?H.header:H.id,defaultVisible:H.visibility?.default??true,locked:H.visibility?.locked})),[t]),v=useMemo(()=>{if(C)return C;let H=[];return o&&H.push("select"),t.forEach(ie=>H.push(ie.id)),g&&H.push("actions"),H},[C,t,o,g]),{getResizeHandleProps:G,getColumnStyle:_,getTableStyle:M}=jo({tableId:r,columns:P}),O=Wo({columns:A,storageKey:r}),{columnOrder:B,moveColumn:W}=Vo({storageKey:`${r}-order`,defaultOrder:v}),{dragState:V,getDragHandleProps:re,showDropIndicator:Z}=Yo(B,W,[...N,"select","actions"]),x=qo({data:e,pageSize:f,storageKey:r}),z=m||x,[Q,T]=useState(null),ye=useCallback(H=>{w&&(H.preventDefault(),T({x:H.clientX,y:H.clientY}));},[w]);useEffect(()=>{if(!Q)return;let H=()=>T(null);return window.addEventListener("click",H),()=>{window.removeEventListener("click",H);}},[Q]);let _e=useMemo(()=>!o||!a||z.paginatedData.length===0?false:z.paginatedData.every(H=>a.has(n(H))),[o,a,z.paginatedData,n]),Pe=useMemo(()=>{if(!o||!a)return false;let H=z.paginatedData.filter(ie=>a.has(n(ie)));return H.length>0&&H.length<z.paginatedData.length},[o,a,z.paginatedData,n]),Ue=useCallback(H=>{if(!i||!a)return;let ie=new Set(a);ie.has(H)?ie.delete(H):ie.add(H),i(ie);},[a,i]),Se=useCallback(()=>{if(!i)return;let H=new Set(z.paginatedData.map(n));i(H);},[z.paginatedData,n,i]),at=useCallback(()=>{i&&i(new Set);},[i]),xe=useCallback(H=>c!==H?jsx(ArrowUpDown,{className:"h-3.5 w-3.5 text-muted-foreground"}):d==="asc"?jsx(ChevronUp,{className:"h-3.5 w-3.5"}):jsx(ChevronDown,{className:"h-3.5 w-3.5"}),[c,d]),Qe=useCallback(H=>t.find(ie=>ie.id===H),[t]),it=useCallback(H=>{let ie={columnId:H.id,isSorted:c===H.sortKey,sortDirection:c===H.sortKey?d:void 0};return typeof H.header=="function"?H.header(ie):H.sortKey&&u?jsxs("button",{onClick:()=>u(H.sortKey),className:R("flex items-center gap-1 hover:text-foreground transition-colors",c===H.sortKey&&"text-primary font-medium"),children:[H.header,xe(H.sortKey)]}):H.header},[c,d,u,xe]);return jsx(aa,{children:jsxs(Fragment,{children:[jsx("div",{className:"overflow-auto border rounded-lg max-h-[calc(100vh-16rem)]",children:jsxs(no,{style:M(),className:R("resizable-table sticky-actions-table",h),children:[jsx(oo,{className:"sticky top-0 z-20 bg-muted",children:jsxs(br,{onContextMenu:ye,className:"border-t-0",children:[B.map(H=>{if(H==="select"&&o)return jsx(Zr,{className:"sticky-select-header w-10 sticky left-0 z-20 bg-muted relative after:absolute after:right-0 after:top-0 after:bottom-0 after:w-px after:bg-border",children:jsx("input",{type:"checkbox",checked:_e,ref:I=>{I&&(I.indeterminate=Pe);},onChange:I=>I.target.checked?Se():at(),className:"h-4 w-4 rounded border-gray-300 text-primary focus:ring-primary cursor-pointer",title:_e?"Deselect all":"Select all visible"})},"select");let ie=Qe(H);return !ie||!O.isColumnVisible(H)?null:jsxs(Zr,{style:_(H),...re(H),className:R("cursor-grab relative",V.draggedId===H&&"column-dragging opacity-50",Z(H)&&"drop-indicator"),children:[it(ie),jsx("div",{...G(H)})]},H)}),g&&jsx(Zr,{className:"sticky right-0 z-20 bg-muted text-center relative before:absolute before:left-0 before:top-0 before:bottom-0 before:w-px before:bg-border",style:{width:p,minWidth:p,maxWidth:p},children:"Actions"})]})}),jsx(ao,{children:k?jsx(br,{children:jsx(hr,{colSpan:B.length+(g?1:0),className:"!p-0 h-32",children:jsx("div",{className:"sticky left-0 w-screen max-w-full h-full bg-background flex justify-center items-center",children:jsxs("div",{className:"flex items-center gap-2 text-muted-foreground",children:[jsx(Loader2,{className:"h-5 w-5 animate-spin"}),"Loading..."]})})})}):z.paginatedData.length===0?null:z.paginatedData.map(H=>{let ie=n(H),I=a?.has(ie)??false;return jsxs(br,{className:R("group cursor-pointer bg-background hover:bg-muted transition-none",I&&"bg-primary/5",S?.(H)),onClick:()=>s?.(H),onContextMenu:ee=>{l&&(ee.preventDefault(),l(H,{x:ee.clientX,y:ee.clientY}));},children:[B.map(ee=>{if(ee==="select"&&o)return jsx(hr,{className:R("sticky-select-cell w-10 sticky left-0 z-10 relative after:absolute after:right-0 after:top-0 after:bottom-0 after:w-px after:bg-border","bg-background group-hover:bg-muted",I&&"bg-primary/5 group-hover:bg-primary/10"),onClick:Ve=>Ve.stopPropagation(),children:jsx("input",{type:"checkbox",checked:I,onChange:()=>Ue(ie),className:"h-4 w-4 rounded border-gray-300 text-primary focus:ring-primary cursor-pointer"})},"select");let se=Qe(ee);if(!se||!O.isColumnVisible(ee))return null;let Ce={columnId:ee,isDragging:V.draggedId===ee};return jsx(hr,{style:_(ee),className:R(se.className,V.draggedId===ee&&"column-dragging"),children:se.cell(H,Ce)},ee)}),g&&jsx(hr,{className:R("sticky right-0 z-10 text-center relative before:absolute before:left-0 before:top-0 before:bottom-0 before:w-px before:bg-border","bg-background group-hover:bg-muted",I&&"bg-primary/5 group-hover:bg-primary/10"),style:{width:p,minWidth:p,maxWidth:p},onClick:ee=>ee.stopPropagation(),children:g(H)})]},ie)})})]})}),!k&&z.paginatedData.length===0&&jsx("div",{className:"empty-state-container flex-1 flex items-center justify-center bg-background",children:D||jsx("span",{className:"block text-center text-muted-foreground py-8",children:"No data"})}),!b&&!k&&z.totalPages>1&&jsx(Ko,{page:z.page,pageSize:z.pageSize,totalItems:z.totalItems,totalPages:z.totalPages,startIndex:z.startIndex,endIndex:z.endIndex,canGoPrev:z.canGoPrev,canGoNext:z.canGoNext,onPageChange:z.setPage,onPageSizeChange:z.setPageSize,onNextPage:z.nextPage,onPrevPage:z.prevPage,onFirstPage:"firstPage"in z?z.firstPage:()=>z.setPage(1),onLastPage:"lastPage"in z?z.lastPage:()=>z.setPage(z.totalPages),pageSizeOptions:z.pageSizeOptions}),Q&&jsxs("div",{className:"fixed z-50 min-w-[200px] overflow-y-auto rounded-md border bg-popover p-1 text-popover-foreground shadow-md animate-in fade-in-0 zoom-in-95",style:{top:Q.y,left:Q.x,maxHeight:`calc(100vh - ${Q.y}px - 20px)`},onClick:H=>H.stopPropagation(),children:[jsx("div",{className:"px-2 py-1.5 text-xs font-medium text-muted-foreground",children:"Toggle columns"}),jsx("div",{className:"h-px bg-border my-1"}),O.columns.map(H=>{let ie=O.isColumnVisible(H.id),I=H.locked===true;return jsxs("button",{onClick:()=>!I&&O.toggleColumn(H.id),disabled:I,className:R("flex items-center gap-2 w-full px-2 py-1.5 text-sm rounded-sm hover:bg-accent",I&&"opacity-50 cursor-not-allowed"),children:[jsx("div",{className:"w-4 h-4 flex items-center justify-center",children:ie&&jsx(Check,{className:"h-3.5 w-3.5 text-primary"})}),jsx("span",{className:"flex-1 text-left",children:H.label}),I&&jsx("span",{className:"text-xs text-muted-foreground",children:"Required"})]},H.id)}),jsx("div",{className:"h-px bg-border my-1"}),jsxs("button",{onClick:()=>O.showAllColumns(),className:"flex items-center gap-2 w-full px-2 py-1.5 text-sm rounded-sm hover:bg-accent",children:[jsx(Eye,{className:"h-4 w-4"}),"Show All"]}),jsxs("button",{onClick:()=>O.hideAllColumns(),className:"flex items-center gap-2 w-full px-2 py-1.5 text-sm rounded-sm hover:bg-accent",children:[jsx(EyeOff,{className:"h-4 w-4"}),"Hide Optional"]})]})]})})}function Zo({page:e,pageSize:t,totalPages:r,totalItems:n,startIndex:o,endIndex:a,canGoNext:i,canGoPrev:s,pageSizeOptions:l,setPage:c,setPageSize:d,nextPage:u,prevPage:g,className:p}){return n===0?null:jsxs("div",{className:R("flex items-center gap-3 text-sm",p),children:[jsxs("div",{className:"hidden md:flex items-center gap-1.5",children:[jsx("span",{className:"text-muted-foreground hidden lg:inline",children:"Rows:"}),jsxs(Et,{value:String(t),onValueChange:f=>d(Number(f)),children:[jsx(pt,{className:"w-16 h-8 text-xs",children:jsx(wt,{})}),jsx(gt,{children:l.map(f=>jsx(Fe,{value:String(f),children:f},f))})]})]}),r>1&&jsxs("div",{className:"flex items-center gap-1",children:[jsx(Y,{variant:"outline",size:"icon",className:"h-8 w-8",onClick:g,disabled:!s,title:"Previous page",children:jsx(ChevronLeft,{className:"h-4 w-4"})}),jsxs("span",{className:"hidden sm:inline px-2 text-muted-foreground tabular-nums min-w-[60px] text-center",children:[e," / ",r]}),jsx(Y,{variant:"outline",size:"icon",className:"h-8 w-8",onClick:u,disabled:!i,title:"Next page",children:jsx(ChevronRight,{className:"h-4 w-4"})})]}),jsxs("span",{className:"text-muted-foreground whitespace-nowrap hidden lg:inline",children:["Showing ",o,"\u2013",a," of ",n]})]})}function eb({title:e,description:t,search:r,onSearchChange:n,searchPlaceholder:o="Search...",filters:a,activeFilterCount:i=0,onClearFilters:s,pagination:l,actions:c,beforeTable:d,children:u,className:g,loading:p,loadingComponent:f}){let m=l&&l.totalItems>0;return jsxs("div",{className:R("flex flex-col h-full",g),children:[jsxs("div",{className:"data-table-page-header flex-shrink-0 space-y-4 pb-4",children:[jsxs("div",{children:[jsx("h1",{className:"text-3xl font-bold",children:e}),t&&jsx("p",{className:"text-muted-foreground",children:t})]}),jsxs("div",{className:"flex items-center gap-3 flex-wrap",children:[n!==void 0&&jsxs("div",{className:"relative w-full sm:w-auto sm:min-w-[200px] sm:max-w-xs",children:[jsx(Search,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 h-4 w-4 text-muted-foreground pointer-events-none z-10"}),jsx(kt,{placeholder:o,value:r||"",onChange:b=>n(b.target.value),className:"pl-9 h-9"}),r&&jsx("button",{type:"button",onClick:()=>n(""),className:"absolute right-2 top-1/2 transform -translate-y-1/2 p-1 rounded-sm hover:bg-muted",children:jsx(X,{className:"h-3 w-3 text-muted-foreground"})})]}),a&&a.length>0&&jsxs(Nr,{children:[jsx(Rr,{asChild:true,children:jsxs(Y,{variant:"outline",size:"sm",className:"gap-2 h-9",children:[jsx(Filter,{className:"h-4 w-4"}),jsx("span",{className:"hidden sm:inline",children:"Filters"}),i>0&&jsx("span",{className:"rounded-full bg-primary text-primary-foreground px-2 py-0.5 text-xs font-medium",children:i})]})}),jsx(pr,{className:"w-80 overflow-y-auto",align:"start",collisionPadding:16,style:{maxHeight:"var(--radix-popover-content-available-height)"},children:jsxs("div",{className:"space-y-4",children:[jsxs("div",{className:"flex items-center justify-between",children:[jsx("h4",{className:"font-medium text-sm",children:"Filters"}),i>0&&s&&jsx(Y,{variant:"ghost",size:"sm",onClick:s,className:"h-auto p-0 text-xs text-destructive hover:text-destructive",children:"Clear all"})]}),jsx("div",{className:"space-y-3",children:a.map(b=>jsxs("div",{className:"space-y-1.5",children:[jsx("label",{className:"text-xs font-medium text-muted-foreground",children:b.label}),b.render()]},b.id))})]})})]}),i>0&&s&&jsxs(Y,{variant:"ghost",size:"sm",onClick:s,className:"h-9 gap-1.5 text-muted-foreground hover:text-foreground",title:"Clear filters",children:[jsx(X,{className:"h-4 w-4"}),jsx("span",{className:"hidden sm:inline",children:"Clear"})]}),m&&jsx(Zo,{...l}),jsx("div",{className:"flex-1"}),c&&jsx("div",{className:"flex items-center gap-2 flex-shrink-0",children:c})]})]}),d&&jsx("div",{className:"px-6 pb-2",children:d}),jsx("div",{className:"relative flex-1 min-h-0",children:jsx("div",{className:"data-table-scroll-container h-full",children:p?f||jsx("div",{className:"flex items-center justify-center h-full",children:jsx("div",{className:"text-muted-foreground",children:"Loading..."})}):u})})]})}function rb({selectedCount:e,onClear:t,children:r,itemLabel:n,className:o}){if(e===0)return null;let a=n??(e===1?"item":"items");return jsx(Ne,{className:R("p-3 bg-primary/5 border-primary/20",o),children:jsxs("div",{className:"flex items-center justify-between",children:[jsxs("div",{className:"flex items-center gap-3",children:[jsxs("span",{className:"font-medium text-sm",role:"status","aria-live":"polite",children:[e," ",a," selected"]}),jsxs(Y,{variant:"ghost",size:"sm",onClick:t,"aria-label":"Clear selection",children:[jsx(X,{className:"h-4 w-4 mr-1","aria-hidden":"true"}),"Clear"]})]}),jsx("div",{className:"flex items-center gap-2",role:"group","aria-label":"Batch actions",children:r})]})})}function nb({columns:e,isColumnVisible:t,toggleColumn:r,showAllColumns:n,hideAllColumns:o}){let a=e.filter(s=>t(s.id)).length,i=e.filter(s=>!s.locked);return jsxs(cb,{children:[jsx(ub,{asChild:true,children:jsxs(Y,{variant:"outline",size:"sm",className:"gap-2",children:[jsx(Columns3,{className:"h-4 w-4"}),"Columns",jsxs("span",{className:"text-muted-foreground text-xs",children:["(",a,"/",e.length,")"]})]})}),jsxs(Hs,{align:"end",className:"w-48",children:[jsx(Gs,{className:"font-normal text-xs text-muted-foreground",children:"Toggle columns"}),jsx(na,{}),e.map(s=>{let l=t(s.id),c=s.locked===true;return jsxs(Qn,{onClick:d=>{d.preventDefault(),c||r(s.id);},className:R("gap-2 cursor-pointer",c&&"opacity-50 cursor-not-allowed"),disabled:c,children:[jsx("div",{className:"w-4 h-4 flex items-center justify-center",children:l?jsx(Check,{className:"h-3.5 w-3.5 text-primary"}):jsx("div",{className:"h-3.5 w-3.5"})}),jsx("span",{className:"flex-1",children:s.label}),c&&jsx("span",{className:"text-xs text-muted-foreground",children:"Required"})]},s.id)}),i.length>1&&jsxs(Fragment,{children:[jsx(na,{}),jsxs(Qn,{onClick:s=>{s.preventDefault(),n();},className:"gap-2 cursor-pointer",children:[jsx(Eye,{className:"h-4 w-4"}),"Show All"]}),jsxs(Qn,{onClick:s=>{s.preventDefault(),o();},className:"gap-2 cursor-pointer",children:[jsx(EyeOff,{className:"h-4 w-4"}),"Hide Optional"]})]})]})]})}function ob({search:e,onSearchChange:t,searchPlaceholder:r="Search...",filters:n,activeFilterCount:o=0,onClearFilters:a,className:i,children:s}){return jsxs("div",{className:R("flex items-center gap-3 flex-wrap",i),children:[t!==void 0&&jsxs("div",{className:"relative flex-1 min-w-[200px] max-w-xs",children:[jsx(Search,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 h-4 w-4 text-muted-foreground pointer-events-none z-10"}),jsx(kt,{placeholder:r,value:e||"",onChange:l=>t(l.target.value),className:"pl-9 h-9"}),e&&jsx("button",{type:"button",onClick:()=>t(""),className:"absolute right-2 top-1/2 transform -translate-y-1/2 p-1 rounded-sm hover:bg-muted",children:jsx(X,{className:"h-3 w-3 text-muted-foreground"})})]}),n&&n.length>0&&jsxs(Nr,{children:[jsx(Rr,{asChild:true,children:jsxs(Y,{variant:"outline",size:"sm",className:"gap-2 h-9",children:[jsx(Filter,{className:"h-4 w-4"}),"Filters",o>0&&jsx("span",{className:"ml-1 rounded-full bg-primary text-primary-foreground px-2 py-0.5 text-xs font-medium",children:o})]})}),jsx(pr,{className:"w-80 overflow-y-auto",align:"start",collisionPadding:16,style:{maxHeight:"var(--radix-popover-content-available-height)"},children:jsxs("div",{className:"space-y-4",children:[jsxs("div",{className:"flex items-center justify-between",children:[jsx("h4",{className:"font-medium text-sm",children:"Filters"}),o>0&&a&&jsx(Y,{variant:"ghost",size:"sm",onClick:a,className:"h-auto p-0 text-xs text-destructive hover:text-destructive",children:"Clear all"})]}),jsx("div",{className:"space-y-3",children:n.map(l=>jsxs("div",{className:"space-y-1.5",children:[jsx("label",{className:"text-xs font-medium text-muted-foreground",children:l.label}),l.render()]},l.id))})]})})]}),o>0&&a&&jsxs(Y,{variant:"ghost",size:"sm",onClick:a,className:"h-9 gap-1.5 text-muted-foreground hover:text-foreground",children:[jsx(X,{className:"h-4 w-4"}),"Clear"]}),jsx("div",{className:"flex-1"}),s]})}/*! Bundled license information:
|
|
55
55
|
|
|
56
56
|
prismjs/components/prism-core.js:
|
|
57
57
|
(**
|