heyio 3.1.16 → 3.1.17

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.
@@ -430,7 +430,7 @@ ${S}`}class Zt extends Error{constructor({message:e,code:r,cause:n,name:i}){var
430
430
 
431
431
  `);c({id:T,role:"user",content:E,timestamp:new Date().toISOString(),attachmentName:N}),p(""),g(null),S.current&&(S.current.value=""),b.current&&(b.current.style.height="auto");try{f&&await u(f,T),o(R)}catch{}}function O(E){E.key==="Enter"&&!E.shiftKey&&(E.preventDefault(),A())}function j(E){p(E.target.value),b.current&&(b.current.style.height="auto",b.current.style.height=`${Math.min(b.current.scrollHeight,160)}px`)}return y.jsxs("div",{className:"flex flex-col flex-1 min-h-0",children:[y.jsxs("div",{ref:_,className:"flex-1 overflow-y-auto px-5 py-5 space-y-5",children:[r.map(E=>{var T,N;return y.jsxs("div",{className:`flex gap-3 ${E.role==="user"?"flex-row-reverse":""}`,children:[y.jsx("div",{className:`flex-shrink-0 w-6 h-6 rounded-lg flex items-center justify-center text-[10px] font-mono mt-0.5 ${E.role==="user"?"border border-[#E43A9C]/30 text-[#E43A9C]":"bg-[#282828] border border-white/[0.07] text-zinc-500"}`,style:E.role==="user"?{background:"rgba(228,58,156,0.12)"}:void 0,children:E.role==="user"?((N=(T=t==null?void 0:t.user)==null?void 0:T.email)==null?void 0:N.charAt(0).toUpperCase())??"U":y.jsx(Ra,{height:12})}),y.jsxs("div",{className:`flex flex-col gap-1.5 max-w-[72%] ${E.role==="user"?"items-end":"items-start"}`,children:[E.toolCall&&y.jsxs("button",{type:"button",onClick:()=>x(v===E.id?null:E.id),className:"w-full text-left border border-white/[0.07] bg-[#1e1e1e] rounded-xl px-3 py-2 flex items-center gap-2 hover:border-[#E43A9C]/25 transition-colors",children:[y.jsx(Ds,{className:"w-3 h-3 text-[#E43A9C] flex-shrink-0"}),y.jsx("span",{className:"text-[11px] font-mono text-zinc-400 flex-1",children:E.toolCall.name}),y.jsx(jt,{variant:E.toolCall.status==="done"?"success":E.toolCall.status==="error"?"error":"warning",children:E.toolCall.status}),y.jsx(q5,{className:`w-3 h-3 text-zinc-600 transition-transform flex-shrink-0 ${v===E.id?"rotate-180":""}`})]}),E.toolCall&&v===E.id&&y.jsx("div",{className:"w-full bg-[#181818] border border-white/[0.06] rounded-xl px-3 py-2",children:y.jsx("p",{className:"text-[11px] font-mono text-zinc-500",children:E.toolCall.result})}),E.attachmentName&&y.jsx("div",{className:"rounded-xl border border-white/[0.08] bg-[#1e1e1e] px-3 py-2 text-[11px] font-mono text-zinc-400",children:E.attachmentName}),E.content&&y.jsx("div",{className:`rounded-2xl px-4 py-2.5 text-sm leading-relaxed ${E.role==="user"?"text-white rounded-tr-sm":"bg-[#222222] border border-white/[0.07] text-zinc-200 rounded-tl-sm"}`,style:E.role==="user"?{background:"linear-gradient(135deg, #D83333 0%, #C0285E 100%)"}:void 0,children:E.role==="user"?y.jsx("p",{className:"whitespace-pre-wrap",children:E.content}):y.jsx("div",{className:"prose-io",dangerouslySetInnerHTML:{__html:nt.parse(E.content)}})}),y.jsx("span",{className:"text-[11px] text-zinc-700 font-mono px-0.5",children:Qh(E.timestamp,e)})]})]},E.id)}),a&&y.jsxs("div",{className:"flex gap-3",children:[y.jsx("div",{className:"flex-shrink-0 w-6 h-6 rounded-lg flex items-center justify-center bg-[#282828] border border-white/[0.07] mt-0.5",children:y.jsx(Ra,{height:12})}),y.jsx("div",{className:"bg-[#222222] border border-white/[0.07] rounded-2xl rounded-tl-sm px-4 py-3 flex items-center gap-1.5",children:[0,120,240].map(E=>y.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-[#E43A9C] animate-bounce",style:{animationDelay:`${E}ms`}},E))})]}),i&&n&&y.jsxs("div",{className:"flex gap-3",children:[y.jsx("div",{className:"flex-shrink-0 w-6 h-6 rounded-lg flex items-center justify-center bg-[#282828] border border-white/[0.07] mt-0.5",children:y.jsx(Ra,{height:12})}),y.jsx("div",{className:"bg-[#222222] border border-white/[0.07] rounded-2xl rounded-tl-sm px-4 py-2.5 max-w-[72%]",children:y.jsx("div",{className:"prose-io text-sm",dangerouslySetInnerHTML:{__html:nt.parse(n)}})})]}),i&&!n&&y.jsxs("div",{className:"flex gap-3",children:[y.jsx("div",{className:"flex-shrink-0 w-6 h-6 rounded-lg flex items-center justify-center bg-[#282828] border border-white/[0.07] mt-0.5",children:y.jsx(Ra,{height:12})}),y.jsx("div",{className:"bg-[#222222] border border-white/[0.07] rounded-2xl rounded-tl-sm px-4 py-3 flex items-center gap-1.5",children:[0,120,240].map(E=>y.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-[#E43A9C] animate-bounce",style:{animationDelay:`${E}ms`}},E))})]})]}),y.jsxs("div",{className:"border-t border-white/[0.06] p-4 flex-shrink-0",children:[y.jsxs("div",{className:"bg-[#1e1e1e] border border-white/[0.08] rounded-2xl overflow-hidden transition-colors focus-within:border-[#E43A9C]/30",children:[y.jsx("input",{ref:S,type:"file",className:"hidden",onChange:E=>{var T;return g(((T=E.target.files)==null?void 0:T[0])??null)}}),f&&y.jsxs("div",{className:"px-4 pt-3 text-[11px] font-mono text-zinc-400",children:["Attached: ",f.name]}),y.jsx("textarea",{ref:b,value:d,onChange:j,onKeyDown:O,placeholder:"Message IO…",rows:1,className:"w-full bg-transparent px-4 pt-3 pb-1 text-sm text-zinc-200 placeholder:text-zinc-700 resize-none focus:outline-none",style:{minHeight:"42px",maxHeight:"160px",fontFamily:"Inter, sans-serif"}}),y.jsxs("div",{className:"flex items-center justify-between px-3 pb-2.5",children:[y.jsx("button",{type:"button",onClick:()=>{var E;return(E=S.current)==null?void 0:E.click()},className:"p-1.5 rounded-lg hover:bg-white/[0.05] text-zinc-700 hover:text-zinc-400 transition-colors",children:y.jsx(QN,{className:"w-4 h-4"})}),y.jsx("div",{className:"flex items-center gap-2",children:i?y.jsxs("button",{type:"button",onClick:()=>{},className:"flex items-center gap-1.5 px-3 py-1.5 rounded-lg bg-zinc-800 hover:bg-zinc-700 text-[11px] font-mono text-zinc-300 transition-colors",children:[y.jsx(Jh,{className:"w-3 h-3"})," Stop"]}):y.jsx("button",{type:"button",onClick:A,disabled:!d.trim()&&!f||a,className:"p-2 rounded-xl text-white disabled:opacity-30 disabled:cursor-not-allowed transition-opacity hover:opacity-90",style:{background:"linear-gradient(135deg, #D83333, #E43A9C)"},children:y.jsx(tP,{className:"w-3.5 h-3.5"})})})]})]}),y.jsx("p",{className:"text-center text-[11px] text-zinc-800 font-mono mt-2",children:"IO may make mistakes. Verify important outputs."})]})]})}var Rg,PE;function XU(){if(PE)return Rg;PE=1;function t(D){return D instanceof Map?D.clear=D.delete=D.set=function(){throw new Error("map is read-only")}:D instanceof Set&&(D.add=D.clear=D.delete=function(){throw new Error("set is read-only")}),Object.freeze(D),Object.getOwnPropertyNames(D).forEach(ne=>{const de=D[ne],Re=typeof de;(Re==="object"||Re==="function")&&!Object.isFrozen(de)&&t(de)}),D}class e{constructor(ne){ne.data===void 0&&(ne.data={}),this.data=ne.data,this.isMatchIgnored=!1}ignoreMatch(){this.isMatchIgnored=!0}}function r(D){return D.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#x27;")}function n(D,...ne){const de=Object.create(null);for(const Re in D)de[Re]=D[Re];return ne.forEach(function(Re){for(const ht in Re)de[ht]=Re[ht]}),de}const i="</span>",a=D=>!!D.scope,o=(D,{prefix:ne})=>{if(D.startsWith("language:"))return D.replace("language:","language-");if(D.includes(".")){const de=D.split(".");return[`${ne}${de.shift()}`,...de.map((Re,ht)=>`${Re}${"_".repeat(ht+1)}`)].join(" ")}return`${ne}${D}`};class c{constructor(ne,de){this.buffer="",this.classPrefix=de.classPrefix,ne.walk(this)}addText(ne){this.buffer+=r(ne)}openNode(ne){if(!a(ne))return;const de=o(ne.scope,{prefix:this.classPrefix});this.span(de)}closeNode(ne){a(ne)&&(this.buffer+=i)}value(){return this.buffer}span(ne){this.buffer+=`<span class="${ne}">`}}const u=(D={})=>{const ne={children:[]};return Object.assign(ne,D),ne};class d{constructor(){this.rootNode=u(),this.stack=[this.rootNode]}get top(){return this.stack[this.stack.length-1]}get root(){return this.rootNode}add(ne){this.top.children.push(ne)}openNode(ne){const de=u({scope:ne});this.add(de),this.stack.push(de)}closeNode(){if(this.stack.length>1)return this.stack.pop()}closeAllNodes(){for(;this.closeNode(););}toJSON(){return JSON.stringify(this.rootNode,null,4)}walk(ne){return this.constructor._walk(ne,this.rootNode)}static _walk(ne,de){return typeof de=="string"?ne.addText(de):de.children&&(ne.openNode(de),de.children.forEach(Re=>this._walk(ne,Re)),ne.closeNode(de)),ne}static _collapse(ne){typeof ne!="string"&&ne.children&&(ne.children.every(de=>typeof de=="string")?ne.children=[ne.children.join("")]:ne.children.forEach(de=>{d._collapse(de)}))}}class p extends d{constructor(ne){super(),this.options=ne}addText(ne){ne!==""&&this.add(ne)}startScope(ne){this.openNode(ne)}endScope(){this.closeNode()}__addSublanguage(ne,de){const Re=ne.root;de&&(Re.scope=`language:${de}`),this.add(Re)}toHTML(){return new c(this,this.options).value()}finalize(){return this.closeAllNodes(),!0}}function f(D){return D?typeof D=="string"?D:D.source:null}function g(D){return _("(?=",D,")")}function v(D){return _("(?:",D,")*")}function x(D){return _("(?:",D,")?")}function _(...D){return D.map(de=>f(de)).join("")}function b(D){const ne=D[D.length-1];return typeof ne=="object"&&ne.constructor===Object?(D.splice(D.length-1,1),ne):{}}function S(...D){return"("+(b(D).capture?"":"?:")+D.map(Re=>f(Re)).join("|")+")"}function A(D){return new RegExp(D.toString()+"|").exec("").length-1}function O(D,ne){const de=D&&D.exec(ne);return de&&de.index===0}const j=/\[(?:[^\\\]]|\\.)*\]|\(\??|\\([1-9][0-9]*)|\\./;function E(D,{joinWith:ne}){let de=0;return D.map(Re=>{de+=1;const ht=de;let Ke=f(Re),ye="";for(;Ke.length>0;){const we=j.exec(Ke);if(!we){ye+=Ke;break}ye+=Ke.substring(0,we.index),Ke=Ke.substring(we.index+we[0].length),we[0][0]==="\\"&&we[1]?ye+="\\"+String(Number(we[1])+ht):(ye+=we[0],we[0]==="("&&de++)}return ye}).map(Re=>`(${Re})`).join(ne)}const T=/\b\B/,N="[a-zA-Z]\\w*",R="[a-zA-Z_]\\w*",M="\\b\\d+(\\.\\d+)?",J="(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)",F="\\b(0b[01]+)",B="!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~",K=(D={})=>{const ne=/^#![ ]*\//;return D.binary&&(D.begin=_(ne,/.*\b/,D.binary,/\b.*/)),n({scope:"meta",begin:ne,end:/$/,relevance:0,"on:begin":(de,Re)=>{de.index!==0&&Re.ignoreMatch()}},D)},W={begin:"\\\\[\\s\\S]",relevance:0},X={scope:"string",begin:"'",end:"'",illegal:"\\n",contains:[W]},Y={scope:"string",begin:'"',end:'"',illegal:"\\n",contains:[W]},te={begin:/\b(a|an|the|are|I'm|isn't|don't|doesn't|won't|but|just|should|pretty|simply|enough|gonna|going|wtf|so|such|will|you|your|they|like|more)\b/},H=function(D,ne,de={}){const Re=n({scope:"comment",begin:D,end:ne,contains:[]},de);Re.contains.push({scope:"doctag",begin:"[ ]*(?=(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):)",end:/(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):/,excludeBegin:!0,relevance:0});const ht=S("I","a","is","so","us","to","at","if","in","it","on",/[A-Za-z]+['](d|ve|re|ll|t|s|n)/,/[A-Za-z]+[-][a-z]+/,/[A-Za-z][a-z]{2,}/);return Re.contains.push({begin:_(/[ ]+/,"(",ht,/[.]?[:]?([.][ ]|[ ])/,"){3}")}),Re},Q=H("//","$"),U=H("/\\*","\\*/"),I=H("#","$"),$={scope:"number",begin:M,relevance:0},V={scope:"number",begin:J,relevance:0},oe={scope:"number",begin:F,relevance:0},le={scope:"regexp",begin:/\/(?=[^/\n]*\/)/,end:/\/[gimuy]*/,contains:[W,{begin:/\[/,end:/\]/,relevance:0,contains:[W]}]},ve={scope:"title",begin:N,relevance:0},qe={scope:"title",begin:R,relevance:0},xe={begin:"\\.\\s*"+R,relevance:0};var Se=Object.freeze({__proto__:null,APOS_STRING_MODE:X,BACKSLASH_ESCAPE:W,BINARY_NUMBER_MODE:oe,BINARY_NUMBER_RE:F,COMMENT:H,C_BLOCK_COMMENT_MODE:U,C_LINE_COMMENT_MODE:Q,C_NUMBER_MODE:V,C_NUMBER_RE:J,END_SAME_AS_BEGIN:function(D){return Object.assign(D,{"on:begin":(ne,de)=>{de.data._beginMatch=ne[1]},"on:end":(ne,de)=>{de.data._beginMatch!==ne[1]&&de.ignoreMatch()}})},HASH_COMMENT_MODE:I,IDENT_RE:N,MATCH_NOTHING_RE:T,METHOD_GUARD:xe,NUMBER_MODE:$,NUMBER_RE:M,PHRASAL_WORDS_MODE:te,QUOTE_STRING_MODE:Y,REGEXP_MODE:le,RE_STARTERS_RE:B,SHEBANG:K,TITLE_MODE:ve,UNDERSCORE_IDENT_RE:R,UNDERSCORE_TITLE_MODE:qe});function Me(D,ne){D.input[D.index-1]==="."&&ne.ignoreMatch()}function se(D,ne){D.className!==void 0&&(D.scope=D.className,delete D.className)}function tt(D,ne){ne&&D.beginKeywords&&(D.begin="\\b("+D.beginKeywords.split(" ").join("|")+")(?!\\.)(?=\\b|\\s)",D.__beforeBegin=Me,D.keywords=D.keywords||D.beginKeywords,delete D.beginKeywords,D.relevance===void 0&&(D.relevance=0))}function Fe(D,ne){Array.isArray(D.illegal)&&(D.illegal=S(...D.illegal))}function kt(D,ne){if(D.match){if(D.begin||D.end)throw new Error("begin & end are not supported with match");D.begin=D.match,delete D.match}}function wt(D,ne){D.relevance===void 0&&(D.relevance=1)}const Et=(D,ne)=>{if(!D.beforeMatch)return;if(D.starts)throw new Error("beforeMatch cannot be used with starts");const de=Object.assign({},D);Object.keys(D).forEach(Re=>{delete D[Re]}),D.keywords=de.keywords,D.begin=_(de.beforeMatch,g(de.begin)),D.starts={relevance:0,contains:[Object.assign(de,{endsParent:!0})]},D.relevance=0,delete de.beforeMatch},Sr=["of","and","for","in","not","or","if","then","parent","list","value"],Ut="keyword";function Rr(D,ne,de=Ut){const Re=Object.create(null);return typeof D=="string"?ht(de,D.split(" ")):Array.isArray(D)?ht(de,D):Object.keys(D).forEach(function(Ke){Object.assign(Re,Rr(D[Ke],ne,Ke))}),Re;function ht(Ke,ye){ne&&(ye=ye.map(we=>we.toLowerCase())),ye.forEach(function(we){const je=we.split("|");Re[je[0]]=[Ke,lr(je[0],je[1])]})}}function lr(D,ne){return ne?Number(ne):_t(D)?0:1}function _t(D){return Sr.includes(D.toLowerCase())}const kr={},Ir=D=>{console.error(D)},ni=(D,...ne)=>{console.log(`WARN: ${D}`,...ne)},Ur=(D,ne)=>{kr[`${D}/${ne}`]||(console.log(`Deprecated as of ${D}. ${ne}`),kr[`${D}/${ne}`]=!0)},ii=new Error;function ai(D,ne,{key:de}){let Re=0;const ht=D[de],Ke={},ye={};for(let we=1;we<=ne.length;we++)ye[we+Re]=ht[we],Ke[we+Re]=!0,Re+=A(ne[we-1]);D[de]=ye,D[de]._emit=Ke,D[de]._multi=!0}function aa(D){if(Array.isArray(D.begin)){if(D.skip||D.excludeBegin||D.returnBegin)throw Ir("skip, excludeBegin, returnBegin not compatible with beginScope: {}"),ii;if(typeof D.beginScope!="object"||D.beginScope===null)throw Ir("beginScope must be object"),ii;ai(D,D.begin,{key:"beginScope"}),D.begin=E(D.begin,{joinWith:""})}}function qr(D){if(Array.isArray(D.end)){if(D.skip||D.excludeEnd||D.returnEnd)throw Ir("skip, excludeEnd, returnEnd not compatible with endScope: {}"),ii;if(typeof D.endScope!="object"||D.endScope===null)throw Ir("endScope must be object"),ii;ai(D,D.end,{key:"endScope"}),D.end=E(D.end,{joinWith:""})}}function oi(D){D.scope&&typeof D.scope=="object"&&D.scope!==null&&(D.beginScope=D.scope,delete D.scope)}function si(D){oi(D),typeof D.beginScope=="string"&&(D.beginScope={_wrap:D.beginScope}),typeof D.endScope=="string"&&(D.endScope={_wrap:D.endScope}),aa(D),qr(D)}function Go(D){function ne(ye,we){return new RegExp(f(ye),"m"+(D.case_insensitive?"i":"")+(D.unicodeRegex?"u":"")+(we?"g":""))}class de{constructor(){this.matchIndexes={},this.regexes=[],this.matchAt=1,this.position=0}addRule(we,je){je.position=this.position++,this.matchIndexes[this.matchAt]=je,this.regexes.push([je,we]),this.matchAt+=A(we)+1}compile(){this.regexes.length===0&&(this.exec=()=>null);const we=this.regexes.map(je=>je[1]);this.matcherRe=ne(E(we,{joinWith:"|"}),!0),this.lastIndex=0}exec(we){this.matcherRe.lastIndex=this.lastIndex;const je=this.matcherRe.exec(we);if(!je)return null;const ut=je.findIndex((cr,Ai)=>Ai>0&&cr!==void 0),gt=this.matchIndexes[ut];return je.splice(0,ut),Object.assign(je,gt)}}class Re{constructor(){this.rules=[],this.multiRegexes=[],this.count=0,this.lastIndex=0,this.regexIndex=0}getMatcher(we){if(this.multiRegexes[we])return this.multiRegexes[we];const je=new de;return this.rules.slice(we).forEach(([ut,gt])=>je.addRule(ut,gt)),je.compile(),this.multiRegexes[we]=je,je}resumingScanAtSamePosition(){return this.regexIndex!==0}considerAll(){this.regexIndex=0}addRule(we,je){this.rules.push([we,je]),je.type==="begin"&&this.count++}exec(we){const je=this.getMatcher(this.regexIndex);je.lastIndex=this.lastIndex;let ut=je.exec(we);if(this.resumingScanAtSamePosition()&&!(ut&&ut.index===this.lastIndex)){const gt=this.getMatcher(0);gt.lastIndex=this.lastIndex+1,ut=gt.exec(we)}return ut&&(this.regexIndex+=ut.position+1,this.regexIndex===this.count&&this.considerAll()),ut}}function ht(ye){const we=new Re;return ye.contains.forEach(je=>we.addRule(je.begin,{rule:je,type:"begin"})),ye.terminatorEnd&&we.addRule(ye.terminatorEnd,{type:"end"}),ye.illegal&&we.addRule(ye.illegal,{type:"illegal"}),we}function Ke(ye,we){const je=ye;if(ye.isCompiled)return je;[se,kt,si,Et].forEach(gt=>gt(ye,we)),D.compilerExtensions.forEach(gt=>gt(ye,we)),ye.__beforeBegin=null,[tt,Fe,wt].forEach(gt=>gt(ye,we)),ye.isCompiled=!0;let ut=null;return typeof ye.keywords=="object"&&ye.keywords.$pattern&&(ye.keywords=Object.assign({},ye.keywords),ut=ye.keywords.$pattern,delete ye.keywords.$pattern),ut=ut||/\w+/,ye.keywords&&(ye.keywords=Rr(ye.keywords,D.case_insensitive)),je.keywordPatternRe=ne(ut,!0),we&&(ye.begin||(ye.begin=/\B|\b/),je.beginRe=ne(je.begin),!ye.end&&!ye.endsWithParent&&(ye.end=/\B|\b/),ye.end&&(je.endRe=ne(je.end)),je.terminatorEnd=f(je.end)||"",ye.endsWithParent&&we.terminatorEnd&&(je.terminatorEnd+=(ye.end?"|":"")+we.terminatorEnd)),ye.illegal&&(je.illegalRe=ne(ye.illegal)),ye.contains||(ye.contains=[]),ye.contains=[].concat(...ye.contains.map(function(gt){return Ko(gt==="self"?ye:gt)})),ye.contains.forEach(function(gt){Ke(gt,je)}),ye.starts&&Ke(ye.starts,we),je.matcher=ht(je),je}if(D.compilerExtensions||(D.compilerExtensions=[]),D.contains&&D.contains.includes("self"))throw new Error("ERR: contains `self` is not supported at the top-level of a language. See documentation.");return D.classNameAliases=n(D.classNameAliases||{}),Ke(D)}function Xa(D){return D?D.endsWithParent||Xa(D.starts):!1}function Ko(D){return D.variants&&!D.cachedVariants&&(D.cachedVariants=D.variants.map(function(ne){return n(D,{variants:null},ne)})),D.cachedVariants?D.cachedVariants:Xa(D)?n(D,{starts:D.starts?n(D.starts):null}):Object.isFrozen(D)?n(D):D}var oa="11.11.1";class Ya extends Error{constructor(ne,de){super(ne),this.name="HTMLInjectionError",this.html=de}}const Rn=r,$r=n,sa=Symbol("nomatch"),li=7,hn=function(D){const ne=Object.create(null),de=Object.create(null),Re=[];let ht=!0;const Ke="Could not find the language '{}', did you forget to load/include a language module?",ye={disableAutodetect:!0,name:"Plain text",contains:[]};let we={ignoreUnescapedHTML:!1,throwUnescapedHTML:!1,noHighlightRe:/^(no-?highlight)$/i,languageDetectRe:/\blang(?:uage)?-([\w-]+)\b/i,classPrefix:"hljs-",cssSelector:"pre code",languages:null,__emitter:p};function je(he){return we.noHighlightRe.test(he)}function ut(he){let $e=he.className+" ";$e+=he.parentNode?he.parentNode.className:"";const Xe=we.languageDetectRe.exec($e);if(Xe){const Qe=In(Xe[1]);return Qe||(ni(Ke.replace("{}",Xe[1])),ni("Falling back to no-highlight mode for this block.",he)),Qe?Xe[1]:"no-highlight"}return $e.split(/\s+/).find(Qe=>je(Qe)||In(Qe))}function gt(he,$e,Xe){let Qe="",Gt="";typeof $e=="object"?(Qe=he,Xe=$e.ignoreIllegals,Gt=$e.language):(Ur("10.7.0","highlight(lang, code, ...args) has been deprecated."),Ur("10.7.0",`Please use highlight(code, options) instead.
432
432
  https://github.com/highlightjs/highlight.js/issues/2277`),Gt=he,Qe=$e),Xe===void 0&&(Xe=!0);const Dt={code:Qe,language:Gt};Za("before:highlight",Dt);const ci=Dt.result?Dt.result:cr(Dt.language,Dt.code,Xe);return ci.code=Dt.code,Za("after:highlight",ci),ci}function cr(he,$e,Xe,Qe){const Gt=Object.create(null);function Dt(me,Ee){return me.keywords[Ee]}function ci(){if(!Ge.keywords){Kt.addText(yt);return}let me=0;Ge.keywordPatternRe.lastIndex=0;let Ee=Ge.keywordPatternRe.exec(yt),He="";for(;Ee;){He+=yt.substring(me,Ee.index);const rt=mn.case_insensitive?Ee[0].toLowerCase():Ee[0],qt=Dt(Ge,rt);if(qt){const[ur,Hp]=qt;if(Kt.addText(He),He="",Gt[rt]=(Gt[rt]||0)+1,Gt[rt]<=li&&(to+=Hp),ur.startsWith("_"))He+=Ee[0];else{const Zu=mn.classNameAliases[ur]||ur;Lr(Ee[0],Zu)}}else He+=Ee[0];me=Ge.keywordPatternRe.lastIndex,Ee=Ge.keywordPatternRe.exec(yt)}He+=yt.substring(me),Kt.addText(He)}function Yo(){if(yt==="")return;let me=null;if(typeof Ge.subLanguage=="string"){if(!ne[Ge.subLanguage]){Kt.addText(yt);return}me=cr(Ge.subLanguage,yt,!0,Il[Ge.subLanguage]),Il[Ge.subLanguage]=me._top}else me=Ja(yt,Ge.subLanguage.length?Ge.subLanguage:null);Ge.relevance>0&&(to+=me.relevance),Kt.__addSublanguage(me._emitter,me.language)}function Mr(){Ge.subLanguage!=null?Yo():ci(),yt=""}function Lr(me,Ee){me!==""&&(Kt.startScope(Ee),Kt.addText(me),Kt.endScope())}function Qa(me,Ee){let He=1;const rt=Ee.length-1;for(;He<=rt;){if(!me._emit[He]){He++;continue}const qt=mn.classNameAliases[me[He]]||me[He],ur=Ee[He];qt?Lr(ur,qt):(yt=ur,ci(),yt=""),He++}}function la(me,Ee){return me.scope&&typeof me.scope=="string"&&Kt.openNode(mn.classNameAliases[me.scope]||me.scope),me.beginScope&&(me.beginScope._wrap?(Lr(yt,mn.classNameAliases[me.beginScope._wrap]||me.beginScope._wrap),yt=""):me.beginScope._multi&&(Qa(me.beginScope,Ee),yt="")),Ge=Object.create(me,{parent:{value:Ge}}),Ge}function eo(me,Ee,He){let rt=O(me.endRe,He);if(rt){if(me["on:end"]){const qt=new e(me);me["on:end"](Ee,qt),qt.isMatchIgnored&&(rt=!1)}if(rt){for(;me.endsParent&&me.parent;)me=me.parent;return me}}if(me.endsWithParent)return eo(me.parent,Ee,He)}function qp(me){return Ge.matcher.regexIndex===0?(yt+=me[0],1):(da=!0,0)}function Fp(me){const Ee=me[0],He=me.rule,rt=new e(He),qt=[He.__beforeBegin,He["on:begin"]];for(const ur of qt)if(ur&&(ur(me,rt),rt.isMatchIgnored))return qp(Ee);return He.skip?yt+=Ee:(He.excludeBegin&&(yt+=Ee),Mr(),!He.returnBegin&&!He.excludeBegin&&(yt=Ee)),la(He,me),He.returnBegin?0:Ee.length}function Pl(me){const Ee=me[0],He=$e.substring(me.index),rt=eo(Ge,me,He);if(!rt)return sa;const qt=Ge;Ge.endScope&&Ge.endScope._wrap?(Mr(),Lr(Ee,Ge.endScope._wrap)):Ge.endScope&&Ge.endScope._multi?(Mr(),Qa(Ge.endScope,me)):qt.skip?yt+=Ee:(qt.returnEnd||qt.excludeEnd||(yt+=Ee),Mr(),qt.excludeEnd&&(yt=Ee));do Ge.scope&&Kt.closeNode(),!Ge.skip&&!Ge.subLanguage&&(to+=Ge.relevance),Ge=Ge.parent;while(Ge!==rt.parent);return rt.starts&&la(rt.starts,me),qt.returnEnd?0:Ee.length}function Ju(){const me=[];for(let Ee=Ge;Ee!==mn;Ee=Ee.parent)Ee.scope&&me.unshift(Ee.scope);me.forEach(Ee=>Kt.openNode(Ee))}let ca={};function ua(me,Ee){const He=Ee&&Ee[0];if(yt+=me,He==null)return Mr(),0;if(ca.type==="begin"&&Ee.type==="end"&&ca.index===Ee.index&&He===""){if(yt+=$e.slice(Ee.index,Ee.index+1),!ht){const rt=new Error(`0 width match regex (${he})`);throw rt.languageName=he,rt.badRule=ca.rule,rt}return 1}if(ca=Ee,Ee.type==="begin")return Fp(Ee);if(Ee.type==="illegal"&&!Xe){const rt=new Error('Illegal lexeme "'+He+'" for mode "'+(Ge.scope||"<unnamed>")+'"');throw rt.mode=Ge,rt}else if(Ee.type==="end"){const rt=Pl(Ee);if(rt!==sa)return rt}if(Ee.type==="illegal"&&He==="")return yt+=`
433
- `,1;if(ro>1e5&&ro>Ee.index*3)throw new Error("potential infinite loop, way more iterations than matches");return yt+=He,He.length}const mn=In(he);if(!mn)throw Ir(Ke.replace("{}",he)),new Error('Unknown language: "'+he+'"');const Rl=Go(mn);let lt="",Ge=Qe||Rl;const Il={},Kt=new we.__emitter(we);Ju();let yt="",to=0,ui=0,ro=0,da=!1;try{if(mn.__emitTokens)mn.__emitTokens($e,Kt);else{for(Ge.matcher.considerAll();;){ro++,da?da=!1:Ge.matcher.considerAll(),Ge.matcher.lastIndex=ui;const me=Ge.matcher.exec($e);if(!me)break;const Ee=$e.substring(ui,me.index),He=ua(Ee,me);ui=me.index+He}ua($e.substring(ui))}return Kt.finalize(),lt=Kt.toHTML(),{language:he,value:lt,relevance:to,illegal:!1,_emitter:Kt,_top:Ge}}catch(me){if(me.message&&me.message.includes("Illegal"))return{language:he,value:Rn($e),illegal:!0,relevance:0,_illegalBy:{message:me.message,index:ui,context:$e.slice(ui-100,ui+100),mode:me.mode,resultSoFar:lt},_emitter:Kt};if(ht)return{language:he,value:Rn($e),illegal:!1,relevance:0,errorRaised:me,_emitter:Kt,_top:Ge};throw me}}function Ai(he){const $e={value:Rn(he),illegal:!1,relevance:0,_top:ye,_emitter:new we.__emitter(we)};return $e._emitter.addText(he),$e}function Ja(he,$e){$e=$e||we.languages||Object.keys(ne);const Xe=Ai(he),Qe=$e.filter(In).filter(Yu).map(Mr=>cr(Mr,he,!1));Qe.unshift(Xe);const Gt=Qe.sort((Mr,Lr)=>{if(Mr.relevance!==Lr.relevance)return Lr.relevance-Mr.relevance;if(Mr.language&&Lr.language){if(In(Mr.language).supersetOf===Lr.language)return 1;if(In(Lr.language).supersetOf===Mr.language)return-1}return 0}),[Dt,ci]=Gt,Yo=Dt;return Yo.secondBest=ci,Yo}function zp(he,$e,Xe){const Qe=$e&&de[$e]||Xe;he.classList.add("hljs"),he.classList.add(`language-${Qe}`)}function jl(he){let $e=null;const Xe=ut(he);if(je(Xe))return;if(Za("before:highlightElement",{el:he,language:Xe}),he.dataset.highlighted){console.log("Element previously highlighted. To highlight again, first unset `dataset.highlighted`.",he);return}if(he.children.length>0&&(we.ignoreUnescapedHTML||(console.warn("One of your code blocks includes unescaped HTML. This is a potentially serious security risk."),console.warn("https://github.com/highlightjs/highlight.js/wiki/security"),console.warn("The element with unescaped HTML:"),console.warn(he)),we.throwUnescapedHTML))throw new Ya("One of your code blocks includes unescaped HTML.",he.innerHTML);$e=he;const Qe=$e.textContent,Gt=Xe?gt(Qe,{language:Xe,ignoreIllegals:!0}):Ja(Qe);he.innerHTML=Gt.value,he.dataset.highlighted="yes",zp(he,Xe,Gt.language),he.result={language:Gt.language,re:Gt.relevance,relevance:Gt.relevance},Gt.secondBest&&(he.secondBest={language:Gt.secondBest.language,relevance:Gt.secondBest.relevance}),Za("after:highlightElement",{el:he,result:Gt,text:Qe})}function Bp(he){we=$r(we,he)}const Ti=()=>{Vo(),Ur("10.6.0","initHighlighting() deprecated. Use highlightAll() now.")};function Wu(){Vo(),Ur("10.6.0","initHighlightingOnLoad() deprecated. Use highlightAll() now.")}let Cl=!1;function Vo(){function he(){Vo()}if(document.readyState==="loading"){Cl||window.addEventListener("DOMContentLoaded",he,!1),Cl=!0;return}document.querySelectorAll(we.cssSelector).forEach(jl)}function Gu(he,$e){let Xe=null;try{Xe=$e(D)}catch(Qe){if(Ir("Language definition for '{}' could not be registered.".replace("{}",he)),ht)Ir(Qe);else throw Qe;Xe=ye}Xe.name||(Xe.name=he),ne[he]=Xe,Xe.rawDefinition=$e.bind(null,D),Xe.aliases&&Xu(Xe.aliases,{languageName:he})}function Ku(he){delete ne[he];for(const $e of Object.keys(de))de[$e]===he&&delete de[$e]}function Vu(){return Object.keys(ne)}function In(he){return he=(he||"").toLowerCase(),ne[he]||ne[de[he]]}function Xu(he,{languageName:$e}){typeof he=="string"&&(he=[he]),he.forEach(Xe=>{de[Xe.toLowerCase()]=$e})}function Yu(he){const $e=In(he);return $e&&!$e.disableAutodetect}function Lt(he){he["before:highlightBlock"]&&!he["before:highlightElement"]&&(he["before:highlightElement"]=$e=>{he["before:highlightBlock"](Object.assign({block:$e.el},$e))}),he["after:highlightBlock"]&&!he["after:highlightElement"]&&(he["after:highlightElement"]=$e=>{he["after:highlightBlock"](Object.assign({block:$e.el},$e))})}function Up(he){Lt(he),Re.push(he)}function Nl(he){const $e=Re.indexOf(he);$e!==-1&&Re.splice($e,1)}function Za(he,$e){const Xe=he;Re.forEach(function(Qe){Qe[Xe]&&Qe[Xe]($e)})}function Xo(he){return Ur("10.7.0","highlightBlock will be removed entirely in v12.0"),Ur("10.7.0","Please use highlightElement now."),jl(he)}Object.assign(D,{highlight:gt,highlightAuto:Ja,highlightAll:Vo,highlightElement:jl,highlightBlock:Xo,configure:Bp,initHighlighting:Ti,initHighlightingOnLoad:Wu,registerLanguage:Gu,unregisterLanguage:Ku,listLanguages:Vu,getLanguage:In,registerAliases:Xu,autoDetection:Yu,inherit:$r,addPlugin:Up,removePlugin:Nl}),D.debugMode=function(){ht=!1},D.safeMode=function(){ht=!0},D.versionString=oa,D.regex={concat:_,lookahead:g,either:S,optional:x,anyNumberOfTimes:v};for(const he in Se)typeof Se[he]=="object"&&t(Se[he]);return Object.assign(D,Se),D},pn=hn({});return pn.newInstance=()=>hn({}),Rg=pn,pn.HighlightJS=pn,pn.default=pn,Rg}var YU=XU();const Qt=vt(YU),JU=t=>({IMPORTANT:{scope:"meta",begin:"!important"},BLOCK_COMMENT:t.C_BLOCK_COMMENT_MODE,HEXCOLOR:{scope:"number",begin:/#(([0-9a-fA-F]{3,4})|(([0-9a-fA-F]{2}){3,4}))\b/},FUNCTION_DISPATCH:{className:"built_in",begin:/[\w-]+(?=\()/},ATTRIBUTE_SELECTOR_MODE:{scope:"selector-attr",begin:/\[/,end:/\]/,illegal:"$",contains:[t.APOS_STRING_MODE,t.QUOTE_STRING_MODE]},CSS_NUMBER_MODE:{scope:"number",begin:t.NUMBER_RE+"(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?",relevance:0},CSS_VARIABLE:{className:"attr",begin:/--[A-Za-z_][A-Za-z0-9_-]*/}}),ZU=["a","abbr","address","article","aside","audio","b","blockquote","body","button","canvas","caption","cite","code","dd","del","details","dfn","div","dl","dt","em","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","html","i","iframe","img","input","ins","kbd","label","legend","li","main","mark","menu","nav","object","ol","optgroup","option","p","picture","q","quote","samp","section","select","source","span","strong","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","ul","var","video"],QU=["defs","g","marker","mask","pattern","svg","switch","symbol","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feFlood","feGaussianBlur","feImage","feMerge","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","linearGradient","radialGradient","stop","circle","ellipse","image","line","path","polygon","polyline","rect","text","use","textPath","tspan","foreignObject","clipPath"],eq=[...ZU,...QU],tq=["any-hover","any-pointer","aspect-ratio","color","color-gamut","color-index","device-aspect-ratio","device-height","device-width","display-mode","forced-colors","grid","height","hover","inverted-colors","monochrome","orientation","overflow-block","overflow-inline","pointer","prefers-color-scheme","prefers-contrast","prefers-reduced-motion","prefers-reduced-transparency","resolution","scan","scripting","update","width","min-width","max-width","min-height","max-height"].sort().reverse(),rq=["active","any-link","blank","checked","current","default","defined","dir","disabled","drop","empty","enabled","first","first-child","first-of-type","fullscreen","future","focus","focus-visible","focus-within","has","host","host-context","hover","indeterminate","in-range","invalid","is","lang","last-child","last-of-type","left","link","local-link","not","nth-child","nth-col","nth-last-child","nth-last-col","nth-last-of-type","nth-of-type","only-child","only-of-type","optional","out-of-range","past","placeholder-shown","read-only","read-write","required","right","root","scope","target","target-within","user-invalid","valid","visited","where"].sort().reverse(),nq=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),iq=["accent-color","align-content","align-items","align-self","alignment-baseline","all","anchor-name","animation","animation-composition","animation-delay","animation-direction","animation-duration","animation-fill-mode","animation-iteration-count","animation-name","animation-play-state","animation-range","animation-range-end","animation-range-start","animation-timeline","animation-timing-function","appearance","aspect-ratio","backdrop-filter","backface-visibility","background","background-attachment","background-blend-mode","background-clip","background-color","background-image","background-origin","background-position","background-position-x","background-position-y","background-repeat","background-size","baseline-shift","block-size","border","border-block","border-block-color","border-block-end","border-block-end-color","border-block-end-style","border-block-end-width","border-block-start","border-block-start-color","border-block-start-style","border-block-start-width","border-block-style","border-block-width","border-bottom","border-bottom-color","border-bottom-left-radius","border-bottom-right-radius","border-bottom-style","border-bottom-width","border-collapse","border-color","border-end-end-radius","border-end-start-radius","border-image","border-image-outset","border-image-repeat","border-image-slice","border-image-source","border-image-width","border-inline","border-inline-color","border-inline-end","border-inline-end-color","border-inline-end-style","border-inline-end-width","border-inline-start","border-inline-start-color","border-inline-start-style","border-inline-start-width","border-inline-style","border-inline-width","border-left","border-left-color","border-left-style","border-left-width","border-radius","border-right","border-right-color","border-right-style","border-right-width","border-spacing","border-start-end-radius","border-start-start-radius","border-style","border-top","border-top-color","border-top-left-radius","border-top-right-radius","border-top-style","border-top-width","border-width","bottom","box-align","box-decoration-break","box-direction","box-flex","box-flex-group","box-lines","box-ordinal-group","box-orient","box-pack","box-shadow","box-sizing","break-after","break-before","break-inside","caption-side","caret-color","clear","clip","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","color-scheme","column-count","column-fill","column-gap","column-rule","column-rule-color","column-rule-style","column-rule-width","column-span","column-width","columns","contain","contain-intrinsic-block-size","contain-intrinsic-height","contain-intrinsic-inline-size","contain-intrinsic-size","contain-intrinsic-width","container","container-name","container-type","content","content-visibility","counter-increment","counter-reset","counter-set","cue","cue-after","cue-before","cursor","cx","cy","direction","display","dominant-baseline","empty-cells","enable-background","field-sizing","fill","fill-opacity","fill-rule","filter","flex","flex-basis","flex-direction","flex-flow","flex-grow","flex-shrink","flex-wrap","float","flood-color","flood-opacity","flow","font","font-display","font-family","font-feature-settings","font-kerning","font-language-override","font-optical-sizing","font-palette","font-size","font-size-adjust","font-smooth","font-smoothing","font-stretch","font-style","font-synthesis","font-synthesis-position","font-synthesis-small-caps","font-synthesis-style","font-synthesis-weight","font-variant","font-variant-alternates","font-variant-caps","font-variant-east-asian","font-variant-emoji","font-variant-ligatures","font-variant-numeric","font-variant-position","font-variation-settings","font-weight","forced-color-adjust","gap","glyph-orientation-horizontal","glyph-orientation-vertical","grid","grid-area","grid-auto-columns","grid-auto-flow","grid-auto-rows","grid-column","grid-column-end","grid-column-start","grid-gap","grid-row","grid-row-end","grid-row-start","grid-template","grid-template-areas","grid-template-columns","grid-template-rows","hanging-punctuation","height","hyphenate-character","hyphenate-limit-chars","hyphens","icon","image-orientation","image-rendering","image-resolution","ime-mode","initial-letter","initial-letter-align","inline-size","inset","inset-area","inset-block","inset-block-end","inset-block-start","inset-inline","inset-inline-end","inset-inline-start","isolation","justify-content","justify-items","justify-self","kerning","left","letter-spacing","lighting-color","line-break","line-height","line-height-step","list-style","list-style-image","list-style-position","list-style-type","margin","margin-block","margin-block-end","margin-block-start","margin-bottom","margin-inline","margin-inline-end","margin-inline-start","margin-left","margin-right","margin-top","margin-trim","marker","marker-end","marker-mid","marker-start","marks","mask","mask-border","mask-border-mode","mask-border-outset","mask-border-repeat","mask-border-slice","mask-border-source","mask-border-width","mask-clip","mask-composite","mask-image","mask-mode","mask-origin","mask-position","mask-repeat","mask-size","mask-type","masonry-auto-flow","math-depth","math-shift","math-style","max-block-size","max-height","max-inline-size","max-width","min-block-size","min-height","min-inline-size","min-width","mix-blend-mode","nav-down","nav-index","nav-left","nav-right","nav-up","none","normal","object-fit","object-position","offset","offset-anchor","offset-distance","offset-path","offset-position","offset-rotate","opacity","order","orphans","outline","outline-color","outline-offset","outline-style","outline-width","overflow","overflow-anchor","overflow-block","overflow-clip-margin","overflow-inline","overflow-wrap","overflow-x","overflow-y","overlay","overscroll-behavior","overscroll-behavior-block","overscroll-behavior-inline","overscroll-behavior-x","overscroll-behavior-y","padding","padding-block","padding-block-end","padding-block-start","padding-bottom","padding-inline","padding-inline-end","padding-inline-start","padding-left","padding-right","padding-top","page","page-break-after","page-break-before","page-break-inside","paint-order","pause","pause-after","pause-before","perspective","perspective-origin","place-content","place-items","place-self","pointer-events","position","position-anchor","position-visibility","print-color-adjust","quotes","r","resize","rest","rest-after","rest-before","right","rotate","row-gap","ruby-align","ruby-position","scale","scroll-behavior","scroll-margin","scroll-margin-block","scroll-margin-block-end","scroll-margin-block-start","scroll-margin-bottom","scroll-margin-inline","scroll-margin-inline-end","scroll-margin-inline-start","scroll-margin-left","scroll-margin-right","scroll-margin-top","scroll-padding","scroll-padding-block","scroll-padding-block-end","scroll-padding-block-start","scroll-padding-bottom","scroll-padding-inline","scroll-padding-inline-end","scroll-padding-inline-start","scroll-padding-left","scroll-padding-right","scroll-padding-top","scroll-snap-align","scroll-snap-stop","scroll-snap-type","scroll-timeline","scroll-timeline-axis","scroll-timeline-name","scrollbar-color","scrollbar-gutter","scrollbar-width","shape-image-threshold","shape-margin","shape-outside","shape-rendering","speak","speak-as","src","stop-color","stop-opacity","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","tab-size","table-layout","text-align","text-align-all","text-align-last","text-anchor","text-combine-upright","text-decoration","text-decoration-color","text-decoration-line","text-decoration-skip","text-decoration-skip-ink","text-decoration-style","text-decoration-thickness","text-emphasis","text-emphasis-color","text-emphasis-position","text-emphasis-style","text-indent","text-justify","text-orientation","text-overflow","text-rendering","text-shadow","text-size-adjust","text-transform","text-underline-offset","text-underline-position","text-wrap","text-wrap-mode","text-wrap-style","timeline-scope","top","touch-action","transform","transform-box","transform-origin","transform-style","transition","transition-behavior","transition-delay","transition-duration","transition-property","transition-timing-function","translate","unicode-bidi","user-modify","user-select","vector-effect","vertical-align","view-timeline","view-timeline-axis","view-timeline-inset","view-timeline-name","view-transition-name","visibility","voice-balance","voice-duration","voice-family","voice-pitch","voice-range","voice-rate","voice-stress","voice-volume","white-space","white-space-collapse","widows","width","will-change","word-break","word-spacing","word-wrap","writing-mode","x","y","z-index","zoom"].sort().reverse();function aq(t){const e=t.regex,r=JU(t),n={begin:/-(webkit|moz|ms|o)-(?=[a-z])/},i="and or not only",a=/@-?\w[\w]*(-\w+)*/,o="[a-zA-Z-][a-zA-Z0-9_-]*",c=[t.APOS_STRING_MODE,t.QUOTE_STRING_MODE];return{name:"CSS",case_insensitive:!0,illegal:/[=|'\$]/,keywords:{keyframePosition:"from to"},classNameAliases:{keyframePosition:"selector-tag"},contains:[r.BLOCK_COMMENT,n,r.CSS_NUMBER_MODE,{className:"selector-id",begin:/#[A-Za-z0-9_-]+/,relevance:0},{className:"selector-class",begin:"\\."+o,relevance:0},r.ATTRIBUTE_SELECTOR_MODE,{className:"selector-pseudo",variants:[{begin:":("+rq.join("|")+")"},{begin:":(:)?("+nq.join("|")+")"}]},r.CSS_VARIABLE,{className:"attribute",begin:"\\b("+iq.join("|")+")\\b"},{begin:/:/,end:/[;}{]/,contains:[r.BLOCK_COMMENT,r.HEXCOLOR,r.IMPORTANT,r.CSS_NUMBER_MODE,...c,{begin:/(url|data-uri)\(/,end:/\)/,relevance:0,keywords:{built_in:"url data-uri"},contains:[...c,{className:"string",begin:/[^)]/,endsWithParent:!0,excludeEnd:!0}]},r.FUNCTION_DISPATCH]},{begin:e.lookahead(/@/),end:"[{;]",relevance:0,illegal:/:/,contains:[{className:"keyword",begin:a},{begin:/\s/,endsWithParent:!0,excludeEnd:!0,relevance:0,keywords:{$pattern:/[a-z-]+/,keyword:i,attribute:tq.join(" ")},contains:[{begin:/[a-z-]+(?=:)/,className:"attribute"},...c,r.CSS_NUMBER_MODE]}]},{className:"selector-tag",begin:"\\b("+eq.join("|")+")\\b"}]}}function oq(t){const a={keyword:["break","case","chan","const","continue","default","defer","else","fallthrough","for","func","go","goto","if","import","interface","map","package","range","return","select","struct","switch","type","var"],type:["bool","byte","complex64","complex128","error","float32","float64","int8","int16","int32","int64","string","uint8","uint16","uint32","uint64","int","uint","uintptr","rune"],literal:["true","false","iota","nil"],built_in:["append","cap","close","complex","copy","imag","len","make","new","panic","print","println","real","recover","delete"]};return{name:"Go",aliases:["golang"],keywords:a,illegal:"</",contains:[t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE,{className:"string",variants:[t.QUOTE_STRING_MODE,t.APOS_STRING_MODE,{begin:"`",end:"`"}]},{className:"number",variants:[{match:/-?\b0[xX]\.[a-fA-F0-9](_?[a-fA-F0-9])*[pP][+-]?\d(_?\d)*i?/,relevance:0},{match:/-?\b0[xX](_?[a-fA-F0-9])+((\.([a-fA-F0-9](_?[a-fA-F0-9])*)?)?[pP][+-]?\d(_?\d)*)?i?/,relevance:0},{match:/-?\b0[oO](_?[0-7])*i?/,relevance:0},{match:/-?\.\d(_?\d)*([eE][+-]?\d(_?\d)*)?i?/,relevance:0},{match:/-?\b\d(_?\d)*(\.(\d(_?\d)*)?)?([eE][+-]?\d(_?\d)*)?i?/,relevance:0}]},{begin:/:=/},{className:"function",beginKeywords:"func",end:"\\s*(\\{|$)",excludeEnd:!0,contains:[t.TITLE_MODE,{className:"params",begin:/\(/,end:/\)/,endsParent:!0,keywords:a,illegal:/["']/}]}]}}const RE="[A-Za-z$_][0-9A-Za-z$_]*",sq=["as","in","of","if","for","while","finally","var","new","function","do","return","void","else","break","catch","instanceof","with","throw","case","default","try","switch","continue","typeof","delete","let","yield","const","class","debugger","async","await","static","import","from","export","extends","using"],lq=["true","false","null","undefined","NaN","Infinity"],rR=["Object","Function","Boolean","Symbol","Math","Date","Number","BigInt","String","RegExp","Array","Float32Array","Float64Array","Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Int32Array","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array","Set","Map","WeakSet","WeakMap","ArrayBuffer","SharedArrayBuffer","Atomics","DataView","JSON","Promise","Generator","GeneratorFunction","AsyncFunction","Reflect","Proxy","Intl","WebAssembly"],nR=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],iR=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],cq=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],uq=[].concat(iR,rR,nR);function aR(t){const e=t.regex,r=(H,{after:Q})=>{const U="</"+H[0].slice(1);return H.input.indexOf(U,Q)!==-1},n=RE,i={begin:"<>",end:"</>"},a=/<[A-Za-z0-9\\._:-]+\s*\/>/,o={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(H,Q)=>{const U=H[0].length+H.index,I=H.input[U];if(I==="<"||I===","){Q.ignoreMatch();return}I===">"&&(r(H,{after:U})||Q.ignoreMatch());let $;const V=H.input.substring(U);if($=V.match(/^\s*=/)){Q.ignoreMatch();return}if(($=V.match(/^\s+extends\s+/))&&$.index===0){Q.ignoreMatch();return}}},c={$pattern:RE,keyword:sq,literal:lq,built_in:uq,"variable.language":cq},u="[0-9](_?[0-9])*",d=`\\.(${u})`,p="0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*",f={className:"number",variants:[{begin:`(\\b(${p})((${d})|\\.)?|(${d}))[eE][+-]?(${u})\\b`},{begin:`\\b(${p})\\b((${d})\\b|\\.)?|(${d})\\b`},{begin:"\\b(0|[1-9](_?[0-9])*)n\\b"},{begin:"\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*n?\\b"},{begin:"\\b0[bB][0-1](_?[0-1])*n?\\b"},{begin:"\\b0[oO][0-7](_?[0-7])*n?\\b"},{begin:"\\b0[0-7]+n?\\b"}],relevance:0},g={className:"subst",begin:"\\$\\{",end:"\\}",keywords:c,contains:[]},v={begin:".?html`",end:"",starts:{end:"`",returnEnd:!1,contains:[t.BACKSLASH_ESCAPE,g],subLanguage:"xml"}},x={begin:".?css`",end:"",starts:{end:"`",returnEnd:!1,contains:[t.BACKSLASH_ESCAPE,g],subLanguage:"css"}},_={begin:".?gql`",end:"",starts:{end:"`",returnEnd:!1,contains:[t.BACKSLASH_ESCAPE,g],subLanguage:"graphql"}},b={className:"string",begin:"`",end:"`",contains:[t.BACKSLASH_ESCAPE,g]},A={className:"comment",variants:[t.COMMENT(/\/\*\*(?!\/)/,"\\*/",{relevance:0,contains:[{begin:"(?=@[A-Za-z]+)",relevance:0,contains:[{className:"doctag",begin:"@[A-Za-z]+"},{className:"type",begin:"\\{",end:"\\}",excludeEnd:!0,excludeBegin:!0,relevance:0},{className:"variable",begin:n+"(?=\\s*(-)|$)",endsParent:!0,relevance:0},{begin:/(?=[^\n])\s/,relevance:0}]}]}),t.C_BLOCK_COMMENT_MODE,t.C_LINE_COMMENT_MODE]},O=[t.APOS_STRING_MODE,t.QUOTE_STRING_MODE,v,x,_,b,{match:/\$\d+/},f];g.contains=O.concat({begin:/\{/,end:/\}/,keywords:c,contains:["self"].concat(O)});const j=[].concat(A,g.contains),E=j.concat([{begin:/(\s*)\(/,end:/\)/,keywords:c,contains:["self"].concat(j)}]),T={className:"params",begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:c,contains:E},N={variants:[{match:[/class/,/\s+/,n,/\s+/,/extends/,/\s+/,e.concat(n,"(",e.concat(/\./,n),")*")],scope:{1:"keyword",3:"title.class",5:"keyword",7:"title.class.inherited"}},{match:[/class/,/\s+/,n],scope:{1:"keyword",3:"title.class"}}]},R={relevance:0,match:e.either(/\bJSON/,/\b[A-Z][a-z]+([A-Z][a-z]*|\d)*/,/\b[A-Z]{2,}([A-Z][a-z]+|\d)+([A-Z][a-z]*)*/,/\b[A-Z]{2,}[a-z]+([A-Z][a-z]+|\d)*([A-Z][a-z]*)*/),className:"title.class",keywords:{_:[...rR,...nR]}},M={label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},J={variants:[{match:[/function/,/\s+/,n,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[T],illegal:/%/},F={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function B(H){return e.concat("(?!",H.join("|"),")")}const K={match:e.concat(/\b/,B([...iR,"super","import"].map(H=>`${H}\\s*\\(`)),n,e.lookahead(/\s*\(/)),className:"title.function",relevance:0},W={begin:e.concat(/\./,e.lookahead(e.concat(n,/(?![0-9A-Za-z$_(])/))),end:n,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},X={match:[/get|set/,/\s+/,n,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},T]},Y="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+t.UNDERSCORE_IDENT_RE+")\\s*=>",te={match:[/const|var|let/,/\s+/,n,/\s*/,/=\s*/,/(async\s*)?/,e.lookahead(Y)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[T]};return{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:c,exports:{PARAMS_CONTAINS:E,CLASS_REFERENCE:R},illegal:/#(?![$_A-z])/,contains:[t.SHEBANG({label:"shebang",binary:"node",relevance:5}),M,t.APOS_STRING_MODE,t.QUOTE_STRING_MODE,v,x,_,b,A,{match:/\$\d+/},f,R,{scope:"attr",match:n+e.lookahead(":"),relevance:0},te,{begin:"("+t.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",relevance:0,contains:[A,t.REGEXP_MODE,{className:"function",begin:Y,returnBegin:!0,end:"\\s*=>",contains:[{className:"params",variants:[{begin:t.UNDERSCORE_IDENT_RE,relevance:0},{className:null,begin:/\(\s*\)/,skip:!0},{begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:c,contains:E}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:i.begin,end:i.end},{match:a},{begin:o.begin,"on:begin":o.isTrulyOpeningTag,end:o.end}],subLanguage:"xml",contains:[{begin:o.begin,end:o.end,skip:!0,contains:["self"]}]}]},J,{beginKeywords:"while if switch catch for"},{begin:"\\b(?!function)"+t.UNDERSCORE_IDENT_RE+"\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{",returnBegin:!0,label:"func.def",contains:[T,t.inherit(t.TITLE_MODE,{begin:n,className:"title.function"})]},{match:/\.\.\./,relevance:0},W,{match:"\\$"+n,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[T]},K,F,N,X,{match:/\$[(.]/}]}}function dq(t){const e={className:"attr",begin:/"(\\.|[^\\"\r\n])*"(?=\s*:)/,relevance:1.01},r={match:/[{}[\],:]/,className:"punctuation",relevance:0},n=["true","false","null"],i={scope:"literal",beginKeywords:n.join(" ")};return{name:"JSON",aliases:["jsonc"],keywords:{literal:n},contains:[e,r,t.QUOTE_STRING_MODE,i,t.C_NUMBER_MODE,t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE],illegal:"\\S"}}function oR(t){const e=t.regex,r=new RegExp("[\\p{XID_Start}_]\\p{XID_Continue}*","u"),n=["and","as","assert","async","await","break","case","class","continue","def","del","elif","else","except","finally","for","from","global","if","import","in","is","lambda","match","nonlocal|10","not","or","pass","raise","return","try","while","with","yield"],c={$pattern:/[A-Za-z]\w+|__\w+__/,keyword:n,built_in:["__import__","abs","all","any","ascii","bin","bool","breakpoint","bytearray","bytes","callable","chr","classmethod","compile","complex","delattr","dict","dir","divmod","enumerate","eval","exec","filter","float","format","frozenset","getattr","globals","hasattr","hash","help","hex","id","input","int","isinstance","issubclass","iter","len","list","locals","map","max","memoryview","min","next","object","oct","open","ord","pow","print","property","range","repr","reversed","round","set","setattr","slice","sorted","staticmethod","str","sum","super","tuple","type","vars","zip"],literal:["__debug__","Ellipsis","False","None","NotImplemented","True"],type:["Any","Callable","Coroutine","Dict","List","Literal","Generic","Optional","Sequence","Set","Tuple","Type","Union"]},u={className:"meta",begin:/^(>>>|\.\.\.) /},d={className:"subst",begin:/\{/,end:/\}/,keywords:c,illegal:/#/},p={begin:/\{\{/,relevance:0},f={className:"string",contains:[t.BACKSLASH_ESCAPE],variants:[{begin:/([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?'''/,end:/'''/,contains:[t.BACKSLASH_ESCAPE,u],relevance:10},{begin:/([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?"""/,end:/"""/,contains:[t.BACKSLASH_ESCAPE,u],relevance:10},{begin:/([fF][rR]|[rR][fF]|[fF])'''/,end:/'''/,contains:[t.BACKSLASH_ESCAPE,u,p,d]},{begin:/([fF][rR]|[rR][fF]|[fF])"""/,end:/"""/,contains:[t.BACKSLASH_ESCAPE,u,p,d]},{begin:/([uU]|[rR])'/,end:/'/,relevance:10},{begin:/([uU]|[rR])"/,end:/"/,relevance:10},{begin:/([bB]|[bB][rR]|[rR][bB])'/,end:/'/},{begin:/([bB]|[bB][rR]|[rR][bB])"/,end:/"/},{begin:/([fF][rR]|[rR][fF]|[fF])'/,end:/'/,contains:[t.BACKSLASH_ESCAPE,p,d]},{begin:/([fF][rR]|[rR][fF]|[fF])"/,end:/"/,contains:[t.BACKSLASH_ESCAPE,p,d]},t.APOS_STRING_MODE,t.QUOTE_STRING_MODE]},g="[0-9](_?[0-9])*",v=`(\\b(${g}))?\\.(${g})|\\b(${g})\\.`,x=`\\b|${n.join("|")}`,_={className:"number",relevance:0,variants:[{begin:`(\\b(${g})|(${v}))[eE][+-]?(${g})[jJ]?(?=${x})`},{begin:`(${v})[jJ]?`},{begin:`\\b([1-9](_?[0-9])*|0+(_?0)*)[lLjJ]?(?=${x})`},{begin:`\\b0[bB](_?[01])+[lL]?(?=${x})`},{begin:`\\b0[oO](_?[0-7])+[lL]?(?=${x})`},{begin:`\\b0[xX](_?[0-9a-fA-F])+[lL]?(?=${x})`},{begin:`\\b(${g})[jJ](?=${x})`}]},b={className:"comment",begin:e.lookahead(/# type:/),end:/$/,keywords:c,contains:[{begin:/# type:/},{begin:/#/,end:/\b\B/,endsWithParent:!0}]},S={className:"params",variants:[{className:"",begin:/\(\s*\)/,skip:!0},{begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:c,contains:["self",u,_,f,t.HASH_COMMENT_MODE]}]};return d.contains=[f,_,u],{name:"Python",aliases:["py","gyp","ipython"],unicodeRegex:!0,keywords:c,illegal:/(<\/|\?)|=>/,contains:[u,_,{scope:"variable.language",match:/\bself\b/},{beginKeywords:"if",relevance:0},{match:/\bor\b/,scope:"keyword"},f,b,t.HASH_COMMENT_MODE,{match:[/\bdef/,/\s+/,r],scope:{1:"keyword",3:"title.function"},contains:[S]},{variants:[{match:[/\bclass/,/\s+/,r,/\s*/,/\(\s*/,r,/\s*\)/]},{match:[/\bclass/,/\s+/,r]}],scope:{1:"keyword",3:"title.class",6:"title.class.inherited"}},{className:"meta",begin:/^[\t ]*@/,end:/(?=#)|$/,contains:[_,S,f]}]}}function fq(t){const e=t.regex,r=/(r#)?/,n=e.concat(r,t.UNDERSCORE_IDENT_RE),i=e.concat(r,t.IDENT_RE),a={className:"title.function.invoke",relevance:0,begin:e.concat(/\b/,/(?!let|for|while|if|else|match\b)/,i,e.lookahead(/\s*\(/))},o="([ui](8|16|32|64|128|size)|f(32|64))?",c=["abstract","as","async","await","become","box","break","const","continue","crate","do","dyn","else","enum","extern","false","final","fn","for","if","impl","in","let","loop","macro","match","mod","move","mut","override","priv","pub","ref","return","self","Self","static","struct","super","trait","true","try","type","typeof","union","unsafe","unsized","use","virtual","where","while","yield"],u=["true","false","Some","None","Ok","Err"],d=["drop ","Copy","Send","Sized","Sync","Drop","Fn","FnMut","FnOnce","ToOwned","Clone","Debug","PartialEq","PartialOrd","Eq","Ord","AsRef","AsMut","Into","From","Default","Iterator","Extend","IntoIterator","DoubleEndedIterator","ExactSizeIterator","SliceConcatExt","ToString","assert!","assert_eq!","bitflags!","bytes!","cfg!","col!","concat!","concat_idents!","debug_assert!","debug_assert_eq!","env!","eprintln!","panic!","file!","format!","format_args!","include_bytes!","include_str!","line!","local_data_key!","module_path!","option_env!","print!","println!","select!","stringify!","try!","unimplemented!","unreachable!","vec!","write!","writeln!","macro_rules!","assert_ne!","debug_assert_ne!"],p=["i8","i16","i32","i64","i128","isize","u8","u16","u32","u64","u128","usize","f32","f64","str","char","bool","Box","Option","Result","String","Vec"];return{name:"Rust",aliases:["rs"],keywords:{$pattern:t.IDENT_RE+"!?",type:p,keyword:c,literal:u,built_in:d},illegal:"</",contains:[t.C_LINE_COMMENT_MODE,t.COMMENT("/\\*","\\*/",{contains:["self"]}),t.inherit(t.QUOTE_STRING_MODE,{begin:/b?"/,illegal:null}),{className:"symbol",begin:/'[a-zA-Z_][a-zA-Z0-9_]*(?!')/},{scope:"string",variants:[{begin:/b?r(#*)"(.|\n)*?"\1(?!#)/},{begin:/b?'/,end:/'/,contains:[{scope:"char.escape",match:/\\('|\w|x\w{2}|u\w{4}|U\w{8})/}]}]},{className:"number",variants:[{begin:"\\b0b([01_]+)"+o},{begin:"\\b0o([0-7_]+)"+o},{begin:"\\b0x([A-Fa-f0-9_]+)"+o},{begin:"\\b(\\d[\\d_]*(\\.[0-9_]+)?([eE][+-]?[0-9_]+)?)"+o}],relevance:0},{begin:[/fn/,/\s+/,n],className:{1:"keyword",3:"title.function"}},{className:"meta",begin:"#!?\\[",end:"\\]",contains:[{className:"string",begin:/"/,end:/"/,contains:[t.BACKSLASH_ESCAPE]}]},{begin:[/let/,/\s+/,/(?:mut\s+)?/,n],className:{1:"keyword",3:"keyword",4:"variable"}},{begin:[/for/,/\s+/,n,/\s+/,/in/],className:{1:"keyword",3:"variable",5:"keyword"}},{begin:[/type/,/\s+/,n],className:{1:"keyword",3:"title.class"}},{begin:[/(?:trait|enum|struct|union|impl|for)/,/\s+/,n],className:{1:"keyword",3:"title.class"}},{begin:t.IDENT_RE+"::",keywords:{keyword:"Self",built_in:d,type:p}},{className:"punctuation",begin:"->"},a]}}function e1(t){return{name:"Shell Session",aliases:["console","shellsession"],contains:[{className:"meta.prompt",begin:/^\s{0,3}[/~\w\d[\]()@-]*[>%$#][ ]?/,starts:{end:/[^\\](?=\s*$)/,subLanguage:"bash"}}]}}const Gf="[A-Za-z$_][0-9A-Za-z$_]*",sR=["as","in","of","if","for","while","finally","var","new","function","do","return","void","else","break","catch","instanceof","with","throw","case","default","try","switch","continue","typeof","delete","let","yield","const","class","debugger","async","await","static","import","from","export","extends","using"],lR=["true","false","null","undefined","NaN","Infinity"],cR=["Object","Function","Boolean","Symbol","Math","Date","Number","BigInt","String","RegExp","Array","Float32Array","Float64Array","Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Int32Array","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array","Set","Map","WeakSet","WeakMap","ArrayBuffer","SharedArrayBuffer","Atomics","DataView","JSON","Promise","Generator","GeneratorFunction","AsyncFunction","Reflect","Proxy","Intl","WebAssembly"],uR=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],dR=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],fR=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],hR=[].concat(dR,cR,uR);function hq(t){const e=t.regex,r=(H,{after:Q})=>{const U="</"+H[0].slice(1);return H.input.indexOf(U,Q)!==-1},n=Gf,i={begin:"<>",end:"</>"},a=/<[A-Za-z0-9\\._:-]+\s*\/>/,o={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(H,Q)=>{const U=H[0].length+H.index,I=H.input[U];if(I==="<"||I===","){Q.ignoreMatch();return}I===">"&&(r(H,{after:U})||Q.ignoreMatch());let $;const V=H.input.substring(U);if($=V.match(/^\s*=/)){Q.ignoreMatch();return}if(($=V.match(/^\s+extends\s+/))&&$.index===0){Q.ignoreMatch();return}}},c={$pattern:Gf,keyword:sR,literal:lR,built_in:hR,"variable.language":fR},u="[0-9](_?[0-9])*",d=`\\.(${u})`,p="0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*",f={className:"number",variants:[{begin:`(\\b(${p})((${d})|\\.)?|(${d}))[eE][+-]?(${u})\\b`},{begin:`\\b(${p})\\b((${d})\\b|\\.)?|(${d})\\b`},{begin:"\\b(0|[1-9](_?[0-9])*)n\\b"},{begin:"\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*n?\\b"},{begin:"\\b0[bB][0-1](_?[0-1])*n?\\b"},{begin:"\\b0[oO][0-7](_?[0-7])*n?\\b"},{begin:"\\b0[0-7]+n?\\b"}],relevance:0},g={className:"subst",begin:"\\$\\{",end:"\\}",keywords:c,contains:[]},v={begin:".?html`",end:"",starts:{end:"`",returnEnd:!1,contains:[t.BACKSLASH_ESCAPE,g],subLanguage:"xml"}},x={begin:".?css`",end:"",starts:{end:"`",returnEnd:!1,contains:[t.BACKSLASH_ESCAPE,g],subLanguage:"css"}},_={begin:".?gql`",end:"",starts:{end:"`",returnEnd:!1,contains:[t.BACKSLASH_ESCAPE,g],subLanguage:"graphql"}},b={className:"string",begin:"`",end:"`",contains:[t.BACKSLASH_ESCAPE,g]},A={className:"comment",variants:[t.COMMENT(/\/\*\*(?!\/)/,"\\*/",{relevance:0,contains:[{begin:"(?=@[A-Za-z]+)",relevance:0,contains:[{className:"doctag",begin:"@[A-Za-z]+"},{className:"type",begin:"\\{",end:"\\}",excludeEnd:!0,excludeBegin:!0,relevance:0},{className:"variable",begin:n+"(?=\\s*(-)|$)",endsParent:!0,relevance:0},{begin:/(?=[^\n])\s/,relevance:0}]}]}),t.C_BLOCK_COMMENT_MODE,t.C_LINE_COMMENT_MODE]},O=[t.APOS_STRING_MODE,t.QUOTE_STRING_MODE,v,x,_,b,{match:/\$\d+/},f];g.contains=O.concat({begin:/\{/,end:/\}/,keywords:c,contains:["self"].concat(O)});const j=[].concat(A,g.contains),E=j.concat([{begin:/(\s*)\(/,end:/\)/,keywords:c,contains:["self"].concat(j)}]),T={className:"params",begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:c,contains:E},N={variants:[{match:[/class/,/\s+/,n,/\s+/,/extends/,/\s+/,e.concat(n,"(",e.concat(/\./,n),")*")],scope:{1:"keyword",3:"title.class",5:"keyword",7:"title.class.inherited"}},{match:[/class/,/\s+/,n],scope:{1:"keyword",3:"title.class"}}]},R={relevance:0,match:e.either(/\bJSON/,/\b[A-Z][a-z]+([A-Z][a-z]*|\d)*/,/\b[A-Z]{2,}([A-Z][a-z]+|\d)+([A-Z][a-z]*)*/,/\b[A-Z]{2,}[a-z]+([A-Z][a-z]+|\d)*([A-Z][a-z]*)*/),className:"title.class",keywords:{_:[...cR,...uR]}},M={label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},J={variants:[{match:[/function/,/\s+/,n,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[T],illegal:/%/},F={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function B(H){return e.concat("(?!",H.join("|"),")")}const K={match:e.concat(/\b/,B([...dR,"super","import"].map(H=>`${H}\\s*\\(`)),n,e.lookahead(/\s*\(/)),className:"title.function",relevance:0},W={begin:e.concat(/\./,e.lookahead(e.concat(n,/(?![0-9A-Za-z$_(])/))),end:n,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},X={match:[/get|set/,/\s+/,n,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},T]},Y="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+t.UNDERSCORE_IDENT_RE+")\\s*=>",te={match:[/const|var|let/,/\s+/,n,/\s*/,/=\s*/,/(async\s*)?/,e.lookahead(Y)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[T]};return{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:c,exports:{PARAMS_CONTAINS:E,CLASS_REFERENCE:R},illegal:/#(?![$_A-z])/,contains:[t.SHEBANG({label:"shebang",binary:"node",relevance:5}),M,t.APOS_STRING_MODE,t.QUOTE_STRING_MODE,v,x,_,b,A,{match:/\$\d+/},f,R,{scope:"attr",match:n+e.lookahead(":"),relevance:0},te,{begin:"("+t.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",relevance:0,contains:[A,t.REGEXP_MODE,{className:"function",begin:Y,returnBegin:!0,end:"\\s*=>",contains:[{className:"params",variants:[{begin:t.UNDERSCORE_IDENT_RE,relevance:0},{className:null,begin:/\(\s*\)/,skip:!0},{begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:c,contains:E}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:i.begin,end:i.end},{match:a},{begin:o.begin,"on:begin":o.isTrulyOpeningTag,end:o.end}],subLanguage:"xml",contains:[{begin:o.begin,end:o.end,skip:!0,contains:["self"]}]}]},J,{beginKeywords:"while if switch catch for"},{begin:"\\b(?!function)"+t.UNDERSCORE_IDENT_RE+"\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{",returnBegin:!0,label:"func.def",contains:[T,t.inherit(t.TITLE_MODE,{begin:n,className:"title.function"})]},{match:/\.\.\./,relevance:0},W,{match:"\\$"+n,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[T]},K,F,N,X,{match:/\$[(.]/}]}}function pR(t){const e=t.regex,r=hq(t),n=Gf,i=["any","void","number","boolean","string","object","never","symbol","bigint","unknown"],a={begin:[/namespace/,/\s+/,t.IDENT_RE],beginScope:{1:"keyword",3:"title.class"}},o={beginKeywords:"interface",end:/\{/,excludeEnd:!0,keywords:{keyword:"interface extends",built_in:i},contains:[r.exports.CLASS_REFERENCE]},c={className:"meta",relevance:10,begin:/^\s*['"]use strict['"]/},u=["type","interface","public","private","protected","implements","declare","abstract","readonly","enum","override","satisfies"],d={$pattern:Gf,keyword:sR.concat(u),literal:lR,built_in:hR.concat(i),"variable.language":fR},p={className:"meta",begin:"@"+n},f=(_,b,S)=>{const A=_.contains.findIndex(O=>O.label===b);if(A===-1)throw new Error("can not find mode to replace");_.contains.splice(A,1,S)};Object.assign(r.keywords,d),r.exports.PARAMS_CONTAINS.push(p);const g=r.contains.find(_=>_.scope==="attr"),v=Object.assign({},g,{match:e.concat(n,e.lookahead(/\s*\?:/))});r.exports.PARAMS_CONTAINS.push([r.exports.CLASS_REFERENCE,g,v]),r.contains=r.contains.concat([p,a,o,v]),f(r,"shebang",t.SHEBANG()),f(r,"use_strict",c);const x=r.contains.find(_=>_.label==="func.def");return x.relevance=0,Object.assign(r,{name:"TypeScript",aliases:["ts","tsx","mts","cts"]}),r}function mR(t){const e=t.regex,r=e.concat(/[\p{L}_]/u,e.optional(/[\p{L}0-9_.-]*:/u),/[\p{L}0-9_.-]*/u),n=/[\p{L}0-9._:-]+/u,i={className:"symbol",begin:/&[a-z]+;|&#[0-9]+;|&#x[a-f0-9]+;/},a={begin:/\s/,contains:[{className:"keyword",begin:/#?[a-z_][a-z1-9_-]+/,illegal:/\n/}]},o=t.inherit(a,{begin:/\(/,end:/\)/}),c=t.inherit(t.APOS_STRING_MODE,{className:"string"}),u=t.inherit(t.QUOTE_STRING_MODE,{className:"string"}),d={endsWithParent:!0,illegal:/</,relevance:0,contains:[{className:"attr",begin:n,relevance:0},{begin:/=\s*/,relevance:0,contains:[{className:"string",endsParent:!0,variants:[{begin:/"/,end:/"/,contains:[i]},{begin:/'/,end:/'/,contains:[i]},{begin:/[^\s"'=<>`]+/}]}]}]};return{name:"HTML, XML",aliases:["html","xhtml","rss","atom","xjb","xsd","xsl","plist","wsf","svg"],case_insensitive:!0,unicodeRegex:!0,contains:[{className:"meta",begin:/<![a-z]/,end:/>/,relevance:10,contains:[a,u,c,o,{begin:/\[/,end:/\]/,contains:[{className:"meta",begin:/<![a-z]/,end:/>/,contains:[a,o,u,c]}]}]},t.COMMENT(/<!--/,/-->/,{relevance:10}),{begin:/<!\[CDATA\[/,end:/\]\]>/,relevance:10},i,{className:"meta",end:/\?>/,variants:[{begin:/<\?xml/,relevance:10,contains:[u]},{begin:/<\?[a-z][a-z0-9]+/}]},{className:"tag",begin:/<style(?=\s|>)/,end:/>/,keywords:{name:"style"},contains:[d],starts:{end:/<\/style>/,returnEnd:!0,subLanguage:["css","xml"]}},{className:"tag",begin:/<script(?=\s|>)/,end:/>/,keywords:{name:"script"},contains:[d],starts:{end:/<\/script>/,returnEnd:!0,subLanguage:["javascript","handlebars","xml"]}},{className:"tag",begin:/<>|<\/>/},{className:"tag",begin:e.concat(/</,e.lookahead(e.concat(r,e.either(/\/>/,/>/,/\s/)))),end:/\/?>/,contains:[{className:"name",begin:r,relevance:0,starts:d}]},{className:"tag",begin:e.concat(/<\//,e.lookahead(e.concat(r,/>/))),contains:[{className:"name",begin:r,relevance:0},{begin:/>/,relevance:0,endsParent:!0}]}]}}function gR(t){const e="true false yes no null",r="[\\w#;/?:@&=+$,.~*'()[\\]]+",n={className:"attr",variants:[{begin:/[\w*@][\w*@ :()\./-]*:(?=[ \t]|$)/},{begin:/"[\w*@][\w*@ :()\./-]*":(?=[ \t]|$)/},{begin:/'[\w*@][\w*@ :()\./-]*':(?=[ \t]|$)/}]},i={className:"template-variable",variants:[{begin:/\{\{/,end:/\}\}/},{begin:/%\{/,end:/\}/}]},a={className:"string",relevance:0,begin:/'/,end:/'/,contains:[{match:/''/,scope:"char.escape",relevance:0}]},o={className:"string",relevance:0,variants:[{begin:/"/,end:/"/},{begin:/\S+/}],contains:[t.BACKSLASH_ESCAPE,i]},c=t.inherit(o,{variants:[{begin:/'/,end:/'/,contains:[{begin:/''/,relevance:0}]},{begin:/"/,end:/"/},{begin:/[^\s,{}[\]]+/}]}),g={className:"number",begin:"\\b"+"[0-9]{4}(-[0-9][0-9]){0,2}"+"([Tt \\t][0-9][0-9]?(:[0-9][0-9]){2})?"+"(\\.[0-9]*)?"+"([ \\t])*(Z|[-+][0-9][0-9]?(:[0-9][0-9])?)?"+"\\b"},v={end:",",endsWithParent:!0,excludeEnd:!0,keywords:e,relevance:0},x={begin:/\{/,end:/\}/,contains:[v],illegal:"\\n",relevance:0},_={begin:"\\[",end:"\\]",contains:[v],illegal:"\\n",relevance:0},b=[n,{className:"meta",begin:"^---\\s*$",relevance:10},{className:"string",begin:"[\\|>]([1-9]?[+-])?[ ]*\\n( +)[^ ][^\\n]*\\n(\\2[^\\n]+\\n?)*"},{begin:"<%[%=-]?",end:"[%-]?%>",subLanguage:"ruby",excludeBegin:!0,excludeEnd:!0,relevance:0},{className:"type",begin:"!\\w+!"+r},{className:"type",begin:"!<"+r+">"},{className:"type",begin:"!"+r},{className:"type",begin:"!!"+r},{className:"meta",begin:"&"+t.UNDERSCORE_IDENT_RE+"$"},{className:"meta",begin:"\\*"+t.UNDERSCORE_IDENT_RE+"$"},{className:"bullet",begin:"-(?=[ ]|$)",relevance:0},t.HASH_COMMENT_MODE,{beginKeywords:e,keywords:{literal:e}},g,{className:"number",begin:t.C_NUMBER_RE+"\\b",relevance:0},x,_,a,o],S=[...b];return S.pop(),S.push(c),v.contains=S,{name:"YAML",case_insensitive:!0,aliases:["yml"],contains:b}}Qt.registerLanguage("javascript",aR);Qt.registerLanguage("js",aR);Qt.registerLanguage("typescript",pR);Qt.registerLanguage("ts",pR);Qt.registerLanguage("python",oR);Qt.registerLanguage("py",oR);Qt.registerLanguage("rust",fq);Qt.registerLanguage("go",oq);Qt.registerLanguage("json",dq);Qt.registerLanguage("yaml",gR);Qt.registerLanguage("yml",gR);Qt.registerLanguage("shell",e1);Qt.registerLanguage("bash",e1);Qt.registerLanguage("sh",e1);Qt.registerLanguage("html",mR);Qt.registerLanguage("xml",mR);Qt.registerLanguage("css",aq);nt.use({renderer:{heading({tokens:t,depth:e}){const r=t.map(a=>a.raw).join(""),n=`h${e}`;return`<${n} style="font-size:${{1:"2rem",2:"1.625rem",3:"1.375rem",4:"1.125rem"}[e]??"1rem"};font-weight:500;color:#e4e4e7;margin:1.1em 0 0.4em;line-height:1.5;">${r}</${n}>`},code({text:t,lang:e}){let r;return e&&Qt.getLanguage(e)?r=Qt.highlight(t,{language:e}).value:r=Qt.highlightAuto(t).value,`<pre style="background:#161616;border:1px solid rgba(255,255,255,0.07);border-radius:10px;padding:0.9em 1.1em;overflow-x:auto;margin:0.8em 0;"><code class="hljs" style="background:none;border:none;padding:0;color:#d4d4d8;font-size:0.85em;">${r}</code></pre>`}}});function sp({content:t,className:e=""}){const r=P.useMemo(()=>nt.parse(t),[t]);return y.jsx("div",{className:`prose-io ${e}`,style:{color:"#d4d4d8",fontSize:"0.875rem",lineHeight:"1.7"},dangerouslySetInnerHTML:{__html:r}})}const IE=["#38bdf8","#a78bfa","#34d399","#f59e0b","#f87171","#E43A9C"];function pq(t){let e=0;for(let r=0;r<t.length;r++)e=t.charCodeAt(r)+((e<<5)-e);return IE[Math.abs(e)%IE.length]}function $E({name:t,color:e}){const r=t.toLowerCase(),n=e??(r==="orchestrator"||r==="io"?"#71717a":pq(t));return y.jsx("span",{className:"inline-flex items-center px-1.5 py-px rounded text-[10px] font-mono border",style:{background:`${n}15`,color:n,borderColor:`${n}30`},children:t})}function mq(){const[t,e]=P.useState([]),[r,n]=P.useState(null),[i,a]=P.useState(new Set),[o,c]=P.useState("all"),u=qa();P.useEffect(()=>{Ve.get("/inbox").then(O=>e(O.entries)).catch(()=>{})},[]);const d=t.filter(O=>O.status==="unread").length,p=o==="unread"?t.filter(O=>O.status==="unread"):t,f=p.length>0&&p.every(O=>i.has(O.id)),g=i.size>0;function v(O){g||(n(O),O.status==="unread"&&(Ve.post(`/inbox/${O.id}/read`).catch(()=>{}),e(j=>j.map(E=>E.id===O.id?{...E,status:"read"}:E))))}function x(O,j){O.stopPropagation(),a(E=>{const T=new Set(E);return T.has(j)?T.delete(j):T.add(j),T})}function _(){a(f?new Set:new Set(p.map(O=>O.id)))}function b(){const O=Array.from(i);Ve.post("/inbox/bulk/read",{ids:O}).catch(()=>{}),e(j=>j.map(E=>i.has(E.id)?{...E,status:"read"}:E)),a(new Set)}function S(){const O=Array.from(i);Ve.post("/inbox/bulk/delete",{ids:O}).catch(()=>{}),e(j=>j.filter(E=>!i.has(E.id))),r&&i.has(r.id)&&n(null),a(new Set)}function A(O){Ve.delete(`/inbox/${O}`).catch(()=>{}),e(j=>j.filter(E=>E.id!==O)),(r==null?void 0:r.id)===O&&n(null)}return y.jsxs("div",{className:"flex flex-1 min-h-0 overflow-hidden",children:[y.jsxs("div",{className:"w-72 flex-shrink-0 border-r border-white/[0.06] flex flex-col overflow-hidden",children:[y.jsxs("div",{className:"px-4 py-3 border-b border-white/[0.06] flex-shrink-0 space-y-2",children:[y.jsxs("div",{className:"flex items-center justify-between",children:[y.jsx("span",{className:"text-lg tracking-wide text-zinc-200",style:{fontFamily:"'Bebas Neue', sans-serif"},children:"Inbox"}),d>0&&y.jsxs(jt,{variant:"default",children:[d," unread"]})]}),y.jsx("div",{className:"flex gap-1",children:["all","unread"].map(O=>y.jsx("button",{type:"button",onClick:()=>{c(O),a(new Set)},className:`flex-1 py-1 text-[11px] font-mono rounded-lg transition-colors cursor-pointer ${o===O?"text-[#E43A9C]":"text-zinc-600 hover:text-zinc-300"}`,style:o===O?{background:"rgba(228,58,156,0.12)"}:void 0,children:O},O))})]}),g&&y.jsxs("div",{className:"px-3 py-2 border-b border-white/[0.06] flex items-center gap-1.5 flex-shrink-0",style:{background:"rgba(228,58,156,0.06)"},children:[y.jsxs("span",{className:"text-[10px] font-mono text-zinc-500 flex-1",children:[i.size," selected"]}),y.jsxs("button",{type:"button",onClick:b,className:"flex items-center gap-1 px-2 py-1 rounded-lg text-[10px] font-mono text-zinc-400 hover:text-zinc-200 hover:bg-white/[0.06] transition-colors cursor-pointer",children:[y.jsx(zb,{className:"w-3 h-3"}),"Mark read"]}),y.jsxs("button",{type:"button",onClick:S,className:"flex items-center gap-1 px-2 py-1 rounded-lg text-[10px] font-mono text-red-400 hover:text-red-300 hover:bg-red-500/10 transition-colors cursor-pointer",children:[y.jsx(Ma,{className:"w-3 h-3"}),"Delete"]})]}),p.length>0&&y.jsxs("div",{className:"px-4 py-1.5 border-b border-white/[0.04] flex items-center gap-2 flex-shrink-0",children:[y.jsx("button",{type:"button",onClick:_,className:`w-3.5 h-3.5 rounded border flex items-center justify-center flex-shrink-0 transition-colors cursor-pointer ${f?"border-[#E43A9C] bg-[#E43A9C]":"border-white/20 hover:border-white/40"}`,children:f&&y.jsx("svg",{className:"w-2 h-2 text-white",fill:"none",viewBox:"0 0 8 8",children:y.jsx("path",{d:"M1 4l2 2 4-4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}),y.jsx("span",{className:"text-[10px] font-mono text-zinc-700",children:"Select all"})]}),y.jsxs("div",{className:"flex-1 overflow-y-auto",children:[p.map(O=>{const j=i.has(O.id),E=(r==null?void 0:r.id)===O.id&&!g;return y.jsxs("div",{onClick:()=>v(O),onKeyDown:T=>T.key==="Enter"&&v(O),className:`flex items-start gap-2.5 px-3 py-3 border-b border-white/[0.04] cursor-pointer transition-colors ${E?"border-l-2 border-l-[#E43A9C] pl-2.5":"hover:bg-white/[0.025]"} ${j?"bg-[#E43A9C]/5":""}`,style:E?{background:"rgba(228,58,156,0.05)"}:void 0,children:[y.jsx("button",{type:"button",onClick:T=>x(T,O.id),className:`mt-0.5 w-3.5 h-3.5 rounded border flex items-center justify-center flex-shrink-0 transition-colors cursor-pointer ${j?"border-[#E43A9C] bg-[#E43A9C]":"border-white/20 hover:border-white/50"}`,children:j&&y.jsx("svg",{className:"w-2 h-2 text-white",fill:"none",viewBox:"0 0 8 8",children:y.jsx("path",{d:"M1 4l2 2 4-4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}),y.jsxs("div",{className:"flex-1 min-w-0",children:[y.jsxs("div",{className:"flex items-center gap-1.5 mb-0.5",children:[O.status==="unread"&&y.jsx("div",{className:"w-1 h-1 rounded-full bg-[#E43A9C] flex-shrink-0"}),y.jsx($E,{name:O.squadName??(O.squadId?O.squadId.slice(0,8):"Orchestrator"),color:O.squadColor})]}),y.jsx("p",{className:`text-[11px] truncate ${O.status==="unread"?"text-zinc-200":"text-zinc-500"}`,children:O.title}),y.jsx("p",{className:"text-[10px] text-zinc-700 font-mono mt-1",children:Ws(O.createdAt,u)})]})]},O.id)}),p.length===0&&y.jsxs("div",{className:"flex flex-col items-center justify-center py-12",children:[y.jsx(Bb,{size:32,className:"text-zinc-800 mb-2"}),y.jsx("p",{className:"text-[11px] font-mono text-zinc-700",children:o==="unread"?"All caught up":"No items yet"})]})]})]}),y.jsx("div",{className:"flex-1 flex flex-col overflow-hidden",children:r&&!g?y.jsxs(y.Fragment,{children:[y.jsxs("div",{className:"px-6 py-4 border-b border-white/[0.06] flex items-start justify-between flex-shrink-0",children:[y.jsxs("div",{className:"flex-1 min-w-0 mr-4",children:[y.jsx($E,{name:r.squadName??(r.squadId?r.squadId.slice(0,8):"Orchestrator"),color:r.squadColor}),y.jsx("h3",{className:"text-sm font-mono text-zinc-100 mt-1.5",children:r.title}),y.jsx("p",{className:"text-[11px] text-zinc-700 font-mono mt-0.5",children:Ws(r.createdAt,u)})]}),y.jsxs("button",{type:"button",onClick:()=>A(r.id),className:"flex items-center gap-1.5 px-2.5 py-1 rounded-lg font-mono text-[11px] text-zinc-400 bg-[#252525] hover:bg-red-500/10 hover:text-red-400 transition-colors cursor-pointer",children:[y.jsx(Ma,{className:"w-3 h-3"}),"Delete"]})]}),y.jsx("div",{className:"flex-1 overflow-y-auto px-6 py-5",children:y.jsx(sp,{content:r.content})})]}):g?y.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center gap-4 text-center px-8",children:[y.jsx("div",{className:"w-10 h-10 rounded-2xl flex items-center justify-center border border-[#E43A9C]/20",style:{background:"rgba(228,58,156,0.08)"},children:y.jsx(Bb,{className:"w-4 h-4 text-[#E43A9C]"})}),y.jsxs("div",{children:[y.jsxs("p",{className:"text-sm font-mono text-zinc-300",children:[i.size," message",i.size!==1?"s":""," selected"]}),y.jsx("p",{className:"text-[11px] text-zinc-600 mt-1",children:"Use the actions above to mark as read or delete"})]}),y.jsxs("div",{className:"flex items-center gap-2",children:[y.jsxs("button",{type:"button",onClick:b,className:"flex items-center gap-1.5 px-3 py-1.5 rounded-lg text-[11px] font-mono text-zinc-300 border border-white/[0.1] hover:bg-white/[0.05] transition-colors cursor-pointer",children:[y.jsx(zb,{className:"w-3 h-3"}),"Mark read"]}),y.jsxs("button",{type:"button",onClick:S,className:"flex items-center gap-1.5 px-3 py-1.5 rounded-lg text-[11px] font-mono text-red-400 border border-red-500/20 hover:bg-red-500/10 transition-colors cursor-pointer",children:[y.jsx(Ma,{className:"w-3 h-3"}),"Delete selected"]})]})]}):y.jsx("div",{className:"flex-1 flex items-center justify-center text-zinc-700 font-mono text-xs",children:"Select an item to read"})})]})}function gq(){const{signIn:t}=op(),[e,r]=P.useState(""),[n,i]=P.useState(""),[a,o]=P.useState(null),[c,u]=P.useState(!1);async function d(p){p.preventDefault(),o(null),u(!0);const{error:f}=await t(e,n);f&&o(f),u(!1)}return y.jsxs("div",{className:"min-h-screen bg-[#161616] flex items-center justify-center relative overflow-hidden",children:[y.jsx("div",{className:"absolute inset-0 opacity-[0.04]",style:{backgroundImage:"radial-gradient(circle, #E43A9C 1px, transparent 1px)",backgroundSize:"32px 32px"}}),y.jsx("div",{className:"absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-[60%] w-[400px] h-[300px] rounded-full blur-3xl pointer-events-none",style:{background:"radial-gradient(ellipse, rgba(228,58,156,0.12) 0%, transparent 70%)"}}),y.jsxs("div",{className:"relative z-10 w-full max-w-[360px] mx-4",children:[y.jsxs("div",{className:"flex flex-col items-center mb-8 gap-3",children:[y.jsx(Ra,{height:52}),y.jsx("div",{className:"text-center",children:y.jsx("p",{className:"text-[11px] font-mono text-zinc-600 tracking-widest uppercase mt-1",children:"personal ai orchestrator"})})]}),y.jsxs("form",{onSubmit:d,className:"glass-card border border-white/[0.07] rounded-2xl p-6 space-y-4",children:[y.jsxs("div",{className:"space-y-1",children:[y.jsx("label",{className:"text-[11px] font-mono text-zinc-500 block",children:"Email"}),y.jsx("input",{type:"email",value:e,onChange:p=>r(p.target.value),required:!0,className:"w-full bg-[#161616] border border-white/[0.08] rounded-xl px-3 py-2.5 text-sm text-zinc-200 font-mono placeholder:text-zinc-700 focus:outline-none focus:border-[#E43A9C]/40 focus:ring-1 focus:ring-[#E43A9C]/15 transition-colors"})]}),y.jsxs("div",{className:"space-y-1",children:[y.jsx("label",{className:"text-[11px] font-mono text-zinc-500 block",children:"Password"}),y.jsx("input",{type:"password",value:n,onChange:p=>i(p.target.value),required:!0,placeholder:"••••••••",className:"w-full bg-[#161616] border border-white/[0.08] rounded-xl px-3 py-2.5 text-sm text-zinc-200 font-mono placeholder:text-zinc-700 focus:outline-none focus:border-[#E43A9C]/40 focus:ring-1 focus:ring-[#E43A9C]/15 transition-colors"})]}),a&&y.jsx("p",{className:"text-[11px] font-mono text-red-400",children:a}),y.jsx("button",{type:"submit",disabled:c,className:"w-full text-white font-mono text-sm rounded-xl py-3 mt-1 transition-opacity hover:opacity-90 disabled:opacity-50 flex items-center justify-center gap-2",style:{background:"linear-gradient(135deg, #D83333 0%, #E43A9C 55%, #F041FF 100%)"},children:c?y.jsxs(y.Fragment,{children:[y.jsx("span",{className:"w-3.5 h-3.5 border-2 border-white/30 border-t-white rounded-full animate-spin"}),"Authenticating…"]}):"Sign In"})]}),y.jsx("p",{className:"text-center text-[11px] text-zinc-700 font-mono mt-4",children:"Secured by Supabase Auth"})]})]})}const yR="w-full bg-[#161616] border border-white/[0.08] rounded-xl px-3 py-2 text-[11px] text-zinc-300 font-mono placeholder:text-zinc-700 focus:outline-none focus:border-[#E43A9C]/40 focus:ring-1 focus:ring-[#E43A9C]/10 transition-colors",Bs="bg-[#161616] border border-white/[0.08] rounded-xl px-3 py-2 text-[11px] text-zinc-300 font-mono placeholder:text-zinc-700 focus:outline-none focus:border-[#E43A9C]/40 focus:ring-1 focus:ring-[#E43A9C]/10 transition-colors";function qi({label:t,hint:e,align:r="center",children:n}){const i=r==="start"?"flex-1 min-w-0":"flex-1 flex justify-end items-center";return y.jsxs("div",{className:`glass-card border border-white/[0.07] rounded-2xl px-4 py-3.5 flex gap-4 ${r==="start"?"items-start":"items-center"}`,children:[y.jsxs("div",{className:"w-[140px] shrink-0",children:[y.jsx("span",{className:"text-[11px] font-mono text-zinc-400",children:t}),e&&y.jsxs("span",{className:"text-[10px] font-mono text-zinc-700 ml-1.5",children:["(",e,")"]})]}),y.jsx("div",{className:i,children:n})]})}function yq({onSave:t,onCancel:e,squads:r}){var x;const[n,i]=P.useState("io"),[a,o]=P.useState(((x=r[0])==null?void 0:x.id)??""),[c,u]=P.useState(""),[d,p]=P.useState(""),[f,g]=P.useState(""),v=()=>{!d.trim()||!f.trim()||!c.trim()||t({name:c.trim(),targetType:n==="io"?"orchestrator":"squad",targetId:n==="squad"?a:void 0,cron:d.trim(),prompt:f.trim()})};return y.jsx("div",{className:"fixed inset-0 z-40 flex items-center justify-center p-6",style:{background:"rgba(0,0,0,0.55)",backdropFilter:"blur(4px)"},children:y.jsxs("div",{className:"glass-card border border-white/[0.09] rounded-2xl w-full max-w-lg shadow-2xl flex flex-col",style:{maxHeight:"90vh"},children:[y.jsxs("div",{className:"flex items-center justify-between px-5 py-4 border-b border-white/[0.06] flex-shrink-0",children:[y.jsx("h3",{className:"text-lg tracking-wide text-zinc-100",style:{fontFamily:"'Bebas Neue', sans-serif"},children:"New Schedule"}),y.jsx("button",{type:"button",onClick:e,className:"p-1.5 rounded-lg text-zinc-600 hover:text-zinc-300 hover:bg-white/[0.06] transition-colors cursor-pointer",children:y.jsx(nP,{className:"w-4 h-4"})})]}),y.jsxs("div",{className:"overflow-y-auto flex-1 px-5 py-4 space-y-2",children:[y.jsx(qi,{label:"Name",children:y.jsx("input",{value:c,onChange:_=>u(_.target.value),placeholder:"Daily triage",className:`${Bs} w-48`})}),y.jsx(qi,{label:"Type",children:y.jsx("div",{className:"flex gap-2",children:["io","squad"].map(_=>y.jsx("button",{type:"button",onClick:()=>i(_),className:`px-4 py-1.5 rounded-xl text-[11px] font-mono capitalize transition-colors border cursor-pointer ${n===_?"text-[#E43A9C] border-[#E43A9C]/30":"text-zinc-500 border-white/[0.08] hover:text-zinc-300 hover:bg-white/[0.04]"}`,style:n===_?{background:"rgba(228,58,156,0.08)"}:void 0,children:_==="io"?"IO":"Squad"},_))})}),n==="squad"&&y.jsx(qi,{label:"Squad",children:y.jsx("select",{value:a,onChange:_=>o(_.target.value),className:`${Bs} w-48`,children:r.map(_=>y.jsx("option",{value:_.id,style:{background:"#1a1a1a",color:"#d4d4d8"},children:_.name},_.id))})}),y.jsx(qi,{label:"Cron Expression",children:y.jsx("input",{value:d,onChange:_=>p(_.target.value),placeholder:"0 9 * * 1-5",className:`${Bs} w-40`})}),y.jsx(qi,{label:"Prompt",hint:"supports Markdown",align:"start",children:y.jsx("textarea",{value:f,onChange:_=>g(_.target.value),placeholder:"Describe what IO or the squad should do when this schedule fires.",rows:8,className:`${yR} resize-none leading-relaxed`})})]}),y.jsxs("div",{className:"flex items-center justify-end gap-2 px-5 py-3.5 border-t border-white/[0.06] flex-shrink-0",children:[y.jsx(_i,{onClick:e,children:"Cancel"}),y.jsxs(za,{onClick:v,className:"px-4 py-1.5",children:[y.jsx(Bw,{className:"w-3 h-3"}),"Create Schedule"]})]})]})})}function vq({sched:t,squads:e,onSave:r,onBack:n}){var x,_;const[i,a]=P.useState(t.name),[o,c]=P.useState(t.cron),[u,d]=P.useState(t.prompt),[p,f]=P.useState(t.targetId??((x=e[0])==null?void 0:x.id)??""),g=()=>{!o.trim()||!u.trim()||!i.trim()||r({name:i.trim(),cron:o.trim(),prompt:u.trim(),targetId:t.targetType==="squad"?p:void 0})},v=t.targetType==="orchestrator"?"IO Schedule":`Squad — ${((_=e.find(b=>b.id===t.targetId))==null?void 0:_.name)??"Unknown"}`;return y.jsxs("div",{className:"flex-1 overflow-y-auto p-6 max-w-3xl",children:[y.jsxs("div",{className:"flex items-center gap-2 mb-6",children:[y.jsxs("button",{type:"button",onClick:n,className:"flex items-center gap-1.5 text-[11px] font-mono text-zinc-600 hover:text-zinc-300 transition-colors cursor-pointer",children:[y.jsx(vl,{className:"w-3.5 h-3.5"}),"Schedules"]}),y.jsx("span",{className:"text-zinc-700 text-[11px]",children:"/"}),y.jsx("span",{className:"text-[11px] font-mono text-zinc-400",children:"Edit"})]}),y.jsxs("div",{className:"flex items-start justify-between mb-6",children:[y.jsxs("div",{children:[y.jsx("h2",{className:"text-2xl tracking-wide text-zinc-100",style:{fontFamily:"'Bebas Neue', sans-serif"},children:"Edit Schedule"}),y.jsx("p",{className:"text-[11px] font-mono text-zinc-600 mt-0.5",children:v})]}),y.jsxs("div",{className:"flex items-center gap-2",children:[y.jsx(_i,{onClick:n,children:"Cancel"}),y.jsxs(za,{onClick:g,className:"px-4 py-1.5",children:[y.jsx(Bw,{className:"w-3 h-3"}),"Save Changes"]})]})]}),y.jsxs("div",{className:"space-y-3",children:[y.jsx(qi,{label:"Name",children:y.jsx("input",{value:i,onChange:b=>a(b.target.value),placeholder:"Schedule name",className:`${Bs} w-48`})}),t.targetType==="squad"&&y.jsx(qi,{label:"Squad",children:y.jsx("select",{value:p,onChange:b=>f(b.target.value),className:`${Bs} w-48`,children:e.map(b=>y.jsx("option",{value:b.id,style:{background:"#1a1a1a",color:"#d4d4d8"},children:b.name},b.id))})}),y.jsx(qi,{label:"Cron Expression",children:y.jsx("input",{value:o,onChange:b=>c(b.target.value),placeholder:"0 9 * * 1-5",className:`${Bs} w-40`})}),y.jsx(qi,{label:"Prompt",hint:"supports Markdown",align:"start",children:y.jsxs("div",{className:"space-y-1.5",children:[y.jsx("textarea",{value:u,onChange:b=>d(b.target.value),placeholder:"Describe what IO or the squad should do when this schedule fires.",className:`${yR} leading-relaxed resize-y`,style:{minHeight:"360px"}}),y.jsx("p",{className:"text-[10px] font-mono text-zinc-700",children:"Tip: use # headings and - lists to structure multi-step instructions."})]})})]})]})}function bq(){const[t,e]=P.useState("squad"),[r,n]=P.useState([]),[i,a]=P.useState([]),[o,c]=P.useState(!1),[u,d]=P.useState(null),p=qa();P.useEffect(()=>{f(),g()},[]);function f(){Ve.get("/schedules").then(R=>n(R.schedules)).catch(()=>{})}function g(){Ve.get("/squads").then(R=>a(R.squads)).catch(()=>{})}const v=r.filter(R=>R.targetType==="squad"),x=r.filter(R=>R.targetType==="orchestrator"),_=t==="squad"?v:x;async function b(R){try{await Ve.post("/schedules",R),at.success("Schedule created"),c(!1),f()}catch(M){at.error(M instanceof Error?M.message:"Failed to create")}}async function S(R){if(u)try{await Ve.patch(`/schedules/${u.id}`,R),at.success("Schedule saved"),d(null),f()}catch{at.error("Failed to save schedule")}}const[A,O]=P.useState(null);async function j(R,M){O(R);try{await Ve.patch(`/schedules/${R}`,{enabled:!M}),at.success(M?"Schedule paused":"Schedule resumed"),f()}catch{at.error("Failed to toggle schedule")}finally{O(null)}}async function E(R){O(R);try{await Ve.post(`/schedules/${R}/run`,{}),at.success("Schedule triggered")}catch{at.error("Failed to trigger schedule")}finally{O(null)}}async function T(R){O(R);try{await Ve.delete(`/schedules/${R}`),at.success("Schedule deleted"),f()}catch{at.error("Failed to delete")}finally{O(null)}}if(u)return y.jsx(vq,{sched:u,squads:i,onSave:S,onBack:()=>d(null)});const N=t==="squad"?["Squad","Name","Cron","Next Run","Status",""]:["Name","Cron","Next Run","Status",""];return y.jsxs("div",{className:"flex-1 overflow-y-auto p-6",children:[o&&y.jsx(yq,{onSave:b,onCancel:()=>c(!1),squads:i}),y.jsxs("div",{className:"flex items-center justify-between mb-5",children:[y.jsxs("div",{children:[y.jsx("h2",{className:"text-2xl tracking-wide text-zinc-100",style:{fontFamily:"'Bebas Neue', sans-serif"},children:"Schedules"}),y.jsxs("p",{className:"text-[11px] text-zinc-600 font-mono mt-0.5",children:[r.filter(R=>R.enabled).length," active · ",r.filter(R=>!R.enabled).length," paused"]})]}),y.jsxs(za,{onClick:()=>c(!0),className:"px-3 py-1.5",children:[y.jsx(zw,{className:"w-3.5 h-3.5"}),"Add Schedule"]})]}),y.jsx("div",{className:"flex gap-1 mb-4",children:[["squad","Squad Schedules"],["io","IO Schedules"]].map(([R,M])=>y.jsx("button",{type:"button",onClick:()=>e(R),className:`px-4 py-2 text-[11px] font-mono rounded-xl transition-colors cursor-pointer ${t===R?"text-[#E43A9C]":"text-zinc-600 hover:text-zinc-300 hover:bg-white/[0.04]"}`,style:t===R?{background:"rgba(228,58,156,0.12)"}:void 0,children:M},R))}),y.jsx("div",{className:"overflow-x-auto rounded-2xl border border-white/[0.07] glass-card",children:_.length===0?y.jsx("div",{className:"px-4 py-12 text-center text-zinc-600 font-mono text-sm",children:"No schedules for this category"}):y.jsxs("table",{className:"w-full text-[11px] font-mono min-w-[640px]",children:[y.jsx("thead",{children:y.jsx("tr",{className:"border-b border-white/[0.06]",style:{background:"rgba(20,20,20,0.6)"},children:N.map(R=>y.jsx("th",{className:"text-left px-4 py-2.5 text-zinc-600 font-medium",children:R},R))})}),y.jsx("tbody",{children:_.map(R=>{var M,J;return y.jsxs("tr",{className:`border-b border-white/[0.04] hover:bg-white/[0.015] transition-colors ${R.enabled?"":"opacity-50"}`,children:[t==="squad"?y.jsx("td",{className:"px-4 py-3",children:y.jsx(qB,{name:((M=i.find(F=>F.id===R.targetId))==null?void 0:M.name)??"Unknown",color:(J=i.find(F=>F.id===R.targetId))==null?void 0:J.color})}):null,y.jsx("td",{className:"px-4 py-3 text-zinc-300",children:R.name}),y.jsx("td",{className:"px-4 py-3 text-zinc-600 text-[10px]",children:R.cron}),y.jsx("td",{className:"px-4 py-3 text-zinc-600",children:y.jsxs("span",{className:"flex items-center gap-1",children:[y.jsx(Mw,{className:"w-3 h-3"}),R.enabled&&R.nextRun?Ws(R.nextRun,p):"—"]})}),y.jsx("td",{className:"px-4 py-3",children:y.jsx(jt,{variant:R.enabled?"success":"muted",children:R.enabled?"active":"paused"})}),y.jsx("td",{className:"px-4 py-3",children:y.jsxs("div",{className:`flex items-center gap-1 ${A===R.id?"opacity-50 pointer-events-none":""}`,children:[y.jsxs(_i,{onClick:()=>E(R.id),children:[y.jsx(j4,{className:"w-3 h-3"}),"Run now"]}),y.jsx(FB,{onClick:()=>j(R.id,R.enabled),children:R.enabled?y.jsxs(y.Fragment,{children:[y.jsx(k4,{className:"w-3 h-3"}),"Pause"]}):y.jsxs(y.Fragment,{children:[y.jsx(Ds,{className:"w-3 h-3"}),"Resume"]})}),y.jsxs(_i,{onClick:()=>d(R),children:[y.jsx(O4,{className:"w-3 h-3"}),"Edit"]}),y.jsxs(zf,{onClick:()=>T(R.id),children:[y.jsx(Ma,{className:"w-3 h-3"}),"Delete"]})]})})]},R.id)})})]})})]})}const xq=[{id:"general",label:"General"},{id:"telegram",label:"Telegram"},{id:"auth",label:"Auth"}],Uo="rounded-xl border border-white/[0.07] bg-white/[0.04] px-3 py-2 text-sm font-mono text-zinc-300 outline-none focus:border-[#E43A9C]/50",ME=`${Uo} w-[72px]`,wq=`${Uo} w-[100px]`,LE=`${Uo} w-[200px]`,DE=`${Uo} w-[320px]`,_q=`${Uo} w-[140px] appearance-none bg-[url('data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2212%22%20height%3D%2212%22%20viewBox%3D%220%200%2012%2012%22%3E%3Cpath%20fill%3D%22%2371717a%22%20d%3D%22M3%204.5L6%208l3-3.5H3z%22%2F%3E%3C%2Fsvg%3E')] bg-[position:right_10px_center] bg-no-repeat pr-8`;function Sq(){const[t,e]=P.useState(null),[r,n]=P.useState("general");P.useEffect(()=>{Ve.get("/config").then(o=>e(o.config)).catch(()=>{})},[]);function i(o){t&&e({...t,...o})}async function a(){if(t)try{const{dataDir:o,...c}=t;await Ve.patch("/config",c),at.success("Settings saved")}catch{at.error("Failed to save settings")}}return t?y.jsx("div",{className:"flex-1 overflow-y-auto p-6",children:y.jsxs("div",{className:"max-w-3xl",children:[y.jsx("h2",{className:"mb-6 text-2xl tracking-wide text-zinc-100",style:{fontFamily:"'Bebas Neue', sans-serif"},children:"Settings"}),y.jsx("div",{className:"mb-6 flex gap-6 border-b border-white/[0.07]",children:xq.map(o=>y.jsx("button",{type:"button",onClick:()=>n(o.id),className:`-mb-px border-b-2 px-1 pb-3 text-[11px] font-mono transition-colors ${r===o.id?"border-[#E43A9C] text-[#E43A9C]":"border-transparent text-zinc-500 hover:text-zinc-300"}`,children:o.label},o.id))}),y.jsxs("div",{className:"glass-card rounded-2xl border border-white/[0.07] p-5",children:[r==="general"&&y.jsxs(y.Fragment,{children:[y.jsx(_n,{label:"Log Level",children:y.jsx("select",{value:t.logLevel,onChange:o=>i({logLevel:o.target.value}),className:_q,children:["trace","debug","info","warn","error","fatal"].map(o=>y.jsx("option",{value:o,children:o},o))})}),y.jsx(_n,{label:"Default Model",children:y.jsx("input",{type:"text",value:t.defaultModel,onChange:o=>i({defaultModel:o.target.value}),className:LE})}),y.jsx(_n,{label:"Timezone",children:y.jsx("select",{value:t.timezone,onChange:o=>i({timezone:o.target.value}),className:`${Uo} w-[200px] appearance-none bg-[url('data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2212%22%20height%3D%2212%22%20viewBox%3D%220%200%2012%2012%22%3E%3Cpath%20fill%3D%22%2371717a%22%20d%3D%22M3%204.5L6%208l3-3.5H3z%22%2F%3E%3C%2Fsvg%3E')] bg-[position:right_10px_center] bg-no-repeat pr-8`,children:J4.map(o=>y.jsx("option",{value:o.value,children:o.label},o.value))})}),y.jsx(_n,{label:"Max Instances",children:y.jsx("input",{type:"number",value:t.maxInstancesPerSquad,onChange:o=>i({maxInstancesPerSquad:Number(o.target.value)}),className:ME,min:1,max:10})}),y.jsx(_n,{label:"API Port",children:y.jsx("input",{type:"number",value:t.apiPort,onChange:o=>i({apiPort:Number(o.target.value)}),className:ME})}),y.jsx(_n,{label:"Pricing Refresh (hrs)",children:y.jsx("input",{type:"number",value:t.pricing.refreshIntervalHours,onChange:o=>i({pricing:{refreshIntervalHours:Number(o.target.value)}}),className:wq,min:1})}),y.jsx(_n,{label:"Data Dir",children:y.jsx("input",{type:"text",value:t.dataDir,readOnly:!0,className:`${DE} cursor-default text-zinc-500`})})]}),r==="telegram"&&y.jsxs(y.Fragment,{children:[y.jsx(_n,{label:"Bot Token",children:y.jsx(Ig,{value:t.telegram.botToken??"",onChange:o=>i({telegram:{...t.telegram,botToken:o||null}}),size:"lg"})}),y.jsx(_n,{label:"Allowed Chat IDs",children:y.jsx("input",{type:"text",value:t.telegram.allowedChatIds.join(", "),onChange:o=>i({telegram:{...t.telegram,allowedChatIds:o.target.value.split(",").map(c=>Number(c.trim())).filter(c=>!Number.isNaN(c))}}),className:LE})})]}),r==="auth"&&y.jsxs(y.Fragment,{children:[y.jsx(_n,{label:"Project URL",children:y.jsx("input",{type:"text",value:t.supabase.projectUrl??"",onChange:o=>i({supabase:{...t.supabase,projectUrl:o.target.value||null}}),className:DE})}),y.jsx(_n,{label:"Anon Key",children:y.jsx(Ig,{value:t.supabase.anonKey??"",onChange:o=>i({supabase:{...t.supabase,anonKey:o||null}}),size:"lg"})}),y.jsx(_n,{label:"JWT Secret",children:y.jsx(Ig,{value:t.supabase.jwtSecret??"",onChange:o=>i({supabase:{...t.supabase,jwtSecret:o||null}}),size:"lg"})})]}),y.jsx("div",{className:"flex justify-end pt-6",children:y.jsx(za,{onClick:a,className:"px-4 py-2.5",children:"Save Settings"})})]})]})}):y.jsx("div",{className:"flex h-full items-center justify-center text-zinc-600",children:"Loading..."})}function _n({label:t,children:e}){return y.jsxs("div",{className:"flex items-center justify-between gap-6 border-b border-white/[0.07] py-3",children:[y.jsx("label",{className:"text-[11px] font-mono text-zinc-400 shrink-0",children:t}),y.jsx("div",{className:"flex justify-end",children:e})]})}function Ig({value:t,onChange:e,size:r="lg"}){const[n,i]=P.useState(!1),a=r==="lg"?"w-[320px]":"w-[200px]";return y.jsxs("div",{className:"relative",children:[y.jsx("input",{type:n?"text":"password",value:t,onChange:o=>e(o.target.value),className:`${Uo} ${a} pr-9`}),y.jsx("button",{type:"button",onClick:()=>i(o=>!o),className:"absolute right-2.5 top-1/2 -translate-y-1/2 text-zinc-600 transition-colors hover:text-zinc-400","aria-label":n?"Hide value":"Show value",children:n?y.jsx(t4,{size:14}):y.jsx(zb,{size:14})})]})}const kq=[{id:"installed",label:"Installed"},{id:"awesome-copilot",label:"Awesome Copilot"},{id:"skillssh",label:"skills.sh"}];function zE(t){return t==="awesome-copilot"?"Awesome Copilot":"skills.sh"}function BE(t){return t?t>=1e6?`${(t/1e6).toFixed(1).replace(/\.0$/,"")}M installs`:t>=1e3?`${(t/1e3).toFixed(1).replace(/\.0$/,"")}K installs`:`${t} installs`:null}function Eq(t){const e=t.match(/^---\s*\n([\s\S]*?)\n---\s*\n([\s\S]*)$/);if(!e)return{frontMatter:{},body:t};const r=e[1]??"",n=e[2]??"",i={};let a="",o=null;for(const c of r.split(`
433
+ `,1;if(ro>1e5&&ro>Ee.index*3)throw new Error("potential infinite loop, way more iterations than matches");return yt+=He,He.length}const mn=In(he);if(!mn)throw Ir(Ke.replace("{}",he)),new Error('Unknown language: "'+he+'"');const Rl=Go(mn);let lt="",Ge=Qe||Rl;const Il={},Kt=new we.__emitter(we);Ju();let yt="",to=0,ui=0,ro=0,da=!1;try{if(mn.__emitTokens)mn.__emitTokens($e,Kt);else{for(Ge.matcher.considerAll();;){ro++,da?da=!1:Ge.matcher.considerAll(),Ge.matcher.lastIndex=ui;const me=Ge.matcher.exec($e);if(!me)break;const Ee=$e.substring(ui,me.index),He=ua(Ee,me);ui=me.index+He}ua($e.substring(ui))}return Kt.finalize(),lt=Kt.toHTML(),{language:he,value:lt,relevance:to,illegal:!1,_emitter:Kt,_top:Ge}}catch(me){if(me.message&&me.message.includes("Illegal"))return{language:he,value:Rn($e),illegal:!0,relevance:0,_illegalBy:{message:me.message,index:ui,context:$e.slice(ui-100,ui+100),mode:me.mode,resultSoFar:lt},_emitter:Kt};if(ht)return{language:he,value:Rn($e),illegal:!1,relevance:0,errorRaised:me,_emitter:Kt,_top:Ge};throw me}}function Ai(he){const $e={value:Rn(he),illegal:!1,relevance:0,_top:ye,_emitter:new we.__emitter(we)};return $e._emitter.addText(he),$e}function Ja(he,$e){$e=$e||we.languages||Object.keys(ne);const Xe=Ai(he),Qe=$e.filter(In).filter(Yu).map(Mr=>cr(Mr,he,!1));Qe.unshift(Xe);const Gt=Qe.sort((Mr,Lr)=>{if(Mr.relevance!==Lr.relevance)return Lr.relevance-Mr.relevance;if(Mr.language&&Lr.language){if(In(Mr.language).supersetOf===Lr.language)return 1;if(In(Lr.language).supersetOf===Mr.language)return-1}return 0}),[Dt,ci]=Gt,Yo=Dt;return Yo.secondBest=ci,Yo}function zp(he,$e,Xe){const Qe=$e&&de[$e]||Xe;he.classList.add("hljs"),he.classList.add(`language-${Qe}`)}function jl(he){let $e=null;const Xe=ut(he);if(je(Xe))return;if(Za("before:highlightElement",{el:he,language:Xe}),he.dataset.highlighted){console.log("Element previously highlighted. To highlight again, first unset `dataset.highlighted`.",he);return}if(he.children.length>0&&(we.ignoreUnescapedHTML||(console.warn("One of your code blocks includes unescaped HTML. This is a potentially serious security risk."),console.warn("https://github.com/highlightjs/highlight.js/wiki/security"),console.warn("The element with unescaped HTML:"),console.warn(he)),we.throwUnescapedHTML))throw new Ya("One of your code blocks includes unescaped HTML.",he.innerHTML);$e=he;const Qe=$e.textContent,Gt=Xe?gt(Qe,{language:Xe,ignoreIllegals:!0}):Ja(Qe);he.innerHTML=Gt.value,he.dataset.highlighted="yes",zp(he,Xe,Gt.language),he.result={language:Gt.language,re:Gt.relevance,relevance:Gt.relevance},Gt.secondBest&&(he.secondBest={language:Gt.secondBest.language,relevance:Gt.secondBest.relevance}),Za("after:highlightElement",{el:he,result:Gt,text:Qe})}function Bp(he){we=$r(we,he)}const Ti=()=>{Vo(),Ur("10.6.0","initHighlighting() deprecated. Use highlightAll() now.")};function Wu(){Vo(),Ur("10.6.0","initHighlightingOnLoad() deprecated. Use highlightAll() now.")}let Cl=!1;function Vo(){function he(){Vo()}if(document.readyState==="loading"){Cl||window.addEventListener("DOMContentLoaded",he,!1),Cl=!0;return}document.querySelectorAll(we.cssSelector).forEach(jl)}function Gu(he,$e){let Xe=null;try{Xe=$e(D)}catch(Qe){if(Ir("Language definition for '{}' could not be registered.".replace("{}",he)),ht)Ir(Qe);else throw Qe;Xe=ye}Xe.name||(Xe.name=he),ne[he]=Xe,Xe.rawDefinition=$e.bind(null,D),Xe.aliases&&Xu(Xe.aliases,{languageName:he})}function Ku(he){delete ne[he];for(const $e of Object.keys(de))de[$e]===he&&delete de[$e]}function Vu(){return Object.keys(ne)}function In(he){return he=(he||"").toLowerCase(),ne[he]||ne[de[he]]}function Xu(he,{languageName:$e}){typeof he=="string"&&(he=[he]),he.forEach(Xe=>{de[Xe.toLowerCase()]=$e})}function Yu(he){const $e=In(he);return $e&&!$e.disableAutodetect}function Lt(he){he["before:highlightBlock"]&&!he["before:highlightElement"]&&(he["before:highlightElement"]=$e=>{he["before:highlightBlock"](Object.assign({block:$e.el},$e))}),he["after:highlightBlock"]&&!he["after:highlightElement"]&&(he["after:highlightElement"]=$e=>{he["after:highlightBlock"](Object.assign({block:$e.el},$e))})}function Up(he){Lt(he),Re.push(he)}function Nl(he){const $e=Re.indexOf(he);$e!==-1&&Re.splice($e,1)}function Za(he,$e){const Xe=he;Re.forEach(function(Qe){Qe[Xe]&&Qe[Xe]($e)})}function Xo(he){return Ur("10.7.0","highlightBlock will be removed entirely in v12.0"),Ur("10.7.0","Please use highlightElement now."),jl(he)}Object.assign(D,{highlight:gt,highlightAuto:Ja,highlightAll:Vo,highlightElement:jl,highlightBlock:Xo,configure:Bp,initHighlighting:Ti,initHighlightingOnLoad:Wu,registerLanguage:Gu,unregisterLanguage:Ku,listLanguages:Vu,getLanguage:In,registerAliases:Xu,autoDetection:Yu,inherit:$r,addPlugin:Up,removePlugin:Nl}),D.debugMode=function(){ht=!1},D.safeMode=function(){ht=!0},D.versionString=oa,D.regex={concat:_,lookahead:g,either:S,optional:x,anyNumberOfTimes:v};for(const he in Se)typeof Se[he]=="object"&&t(Se[he]);return Object.assign(D,Se),D},pn=hn({});return pn.newInstance=()=>hn({}),Rg=pn,pn.HighlightJS=pn,pn.default=pn,Rg}var YU=XU();const Qt=vt(YU),JU=t=>({IMPORTANT:{scope:"meta",begin:"!important"},BLOCK_COMMENT:t.C_BLOCK_COMMENT_MODE,HEXCOLOR:{scope:"number",begin:/#(([0-9a-fA-F]{3,4})|(([0-9a-fA-F]{2}){3,4}))\b/},FUNCTION_DISPATCH:{className:"built_in",begin:/[\w-]+(?=\()/},ATTRIBUTE_SELECTOR_MODE:{scope:"selector-attr",begin:/\[/,end:/\]/,illegal:"$",contains:[t.APOS_STRING_MODE,t.QUOTE_STRING_MODE]},CSS_NUMBER_MODE:{scope:"number",begin:t.NUMBER_RE+"(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?",relevance:0},CSS_VARIABLE:{className:"attr",begin:/--[A-Za-z_][A-Za-z0-9_-]*/}}),ZU=["a","abbr","address","article","aside","audio","b","blockquote","body","button","canvas","caption","cite","code","dd","del","details","dfn","div","dl","dt","em","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","html","i","iframe","img","input","ins","kbd","label","legend","li","main","mark","menu","nav","object","ol","optgroup","option","p","picture","q","quote","samp","section","select","source","span","strong","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","ul","var","video"],QU=["defs","g","marker","mask","pattern","svg","switch","symbol","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feFlood","feGaussianBlur","feImage","feMerge","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","linearGradient","radialGradient","stop","circle","ellipse","image","line","path","polygon","polyline","rect","text","use","textPath","tspan","foreignObject","clipPath"],eq=[...ZU,...QU],tq=["any-hover","any-pointer","aspect-ratio","color","color-gamut","color-index","device-aspect-ratio","device-height","device-width","display-mode","forced-colors","grid","height","hover","inverted-colors","monochrome","orientation","overflow-block","overflow-inline","pointer","prefers-color-scheme","prefers-contrast","prefers-reduced-motion","prefers-reduced-transparency","resolution","scan","scripting","update","width","min-width","max-width","min-height","max-height"].sort().reverse(),rq=["active","any-link","blank","checked","current","default","defined","dir","disabled","drop","empty","enabled","first","first-child","first-of-type","fullscreen","future","focus","focus-visible","focus-within","has","host","host-context","hover","indeterminate","in-range","invalid","is","lang","last-child","last-of-type","left","link","local-link","not","nth-child","nth-col","nth-last-child","nth-last-col","nth-last-of-type","nth-of-type","only-child","only-of-type","optional","out-of-range","past","placeholder-shown","read-only","read-write","required","right","root","scope","target","target-within","user-invalid","valid","visited","where"].sort().reverse(),nq=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),iq=["accent-color","align-content","align-items","align-self","alignment-baseline","all","anchor-name","animation","animation-composition","animation-delay","animation-direction","animation-duration","animation-fill-mode","animation-iteration-count","animation-name","animation-play-state","animation-range","animation-range-end","animation-range-start","animation-timeline","animation-timing-function","appearance","aspect-ratio","backdrop-filter","backface-visibility","background","background-attachment","background-blend-mode","background-clip","background-color","background-image","background-origin","background-position","background-position-x","background-position-y","background-repeat","background-size","baseline-shift","block-size","border","border-block","border-block-color","border-block-end","border-block-end-color","border-block-end-style","border-block-end-width","border-block-start","border-block-start-color","border-block-start-style","border-block-start-width","border-block-style","border-block-width","border-bottom","border-bottom-color","border-bottom-left-radius","border-bottom-right-radius","border-bottom-style","border-bottom-width","border-collapse","border-color","border-end-end-radius","border-end-start-radius","border-image","border-image-outset","border-image-repeat","border-image-slice","border-image-source","border-image-width","border-inline","border-inline-color","border-inline-end","border-inline-end-color","border-inline-end-style","border-inline-end-width","border-inline-start","border-inline-start-color","border-inline-start-style","border-inline-start-width","border-inline-style","border-inline-width","border-left","border-left-color","border-left-style","border-left-width","border-radius","border-right","border-right-color","border-right-style","border-right-width","border-spacing","border-start-end-radius","border-start-start-radius","border-style","border-top","border-top-color","border-top-left-radius","border-top-right-radius","border-top-style","border-top-width","border-width","bottom","box-align","box-decoration-break","box-direction","box-flex","box-flex-group","box-lines","box-ordinal-group","box-orient","box-pack","box-shadow","box-sizing","break-after","break-before","break-inside","caption-side","caret-color","clear","clip","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","color-scheme","column-count","column-fill","column-gap","column-rule","column-rule-color","column-rule-style","column-rule-width","column-span","column-width","columns","contain","contain-intrinsic-block-size","contain-intrinsic-height","contain-intrinsic-inline-size","contain-intrinsic-size","contain-intrinsic-width","container","container-name","container-type","content","content-visibility","counter-increment","counter-reset","counter-set","cue","cue-after","cue-before","cursor","cx","cy","direction","display","dominant-baseline","empty-cells","enable-background","field-sizing","fill","fill-opacity","fill-rule","filter","flex","flex-basis","flex-direction","flex-flow","flex-grow","flex-shrink","flex-wrap","float","flood-color","flood-opacity","flow","font","font-display","font-family","font-feature-settings","font-kerning","font-language-override","font-optical-sizing","font-palette","font-size","font-size-adjust","font-smooth","font-smoothing","font-stretch","font-style","font-synthesis","font-synthesis-position","font-synthesis-small-caps","font-synthesis-style","font-synthesis-weight","font-variant","font-variant-alternates","font-variant-caps","font-variant-east-asian","font-variant-emoji","font-variant-ligatures","font-variant-numeric","font-variant-position","font-variation-settings","font-weight","forced-color-adjust","gap","glyph-orientation-horizontal","glyph-orientation-vertical","grid","grid-area","grid-auto-columns","grid-auto-flow","grid-auto-rows","grid-column","grid-column-end","grid-column-start","grid-gap","grid-row","grid-row-end","grid-row-start","grid-template","grid-template-areas","grid-template-columns","grid-template-rows","hanging-punctuation","height","hyphenate-character","hyphenate-limit-chars","hyphens","icon","image-orientation","image-rendering","image-resolution","ime-mode","initial-letter","initial-letter-align","inline-size","inset","inset-area","inset-block","inset-block-end","inset-block-start","inset-inline","inset-inline-end","inset-inline-start","isolation","justify-content","justify-items","justify-self","kerning","left","letter-spacing","lighting-color","line-break","line-height","line-height-step","list-style","list-style-image","list-style-position","list-style-type","margin","margin-block","margin-block-end","margin-block-start","margin-bottom","margin-inline","margin-inline-end","margin-inline-start","margin-left","margin-right","margin-top","margin-trim","marker","marker-end","marker-mid","marker-start","marks","mask","mask-border","mask-border-mode","mask-border-outset","mask-border-repeat","mask-border-slice","mask-border-source","mask-border-width","mask-clip","mask-composite","mask-image","mask-mode","mask-origin","mask-position","mask-repeat","mask-size","mask-type","masonry-auto-flow","math-depth","math-shift","math-style","max-block-size","max-height","max-inline-size","max-width","min-block-size","min-height","min-inline-size","min-width","mix-blend-mode","nav-down","nav-index","nav-left","nav-right","nav-up","none","normal","object-fit","object-position","offset","offset-anchor","offset-distance","offset-path","offset-position","offset-rotate","opacity","order","orphans","outline","outline-color","outline-offset","outline-style","outline-width","overflow","overflow-anchor","overflow-block","overflow-clip-margin","overflow-inline","overflow-wrap","overflow-x","overflow-y","overlay","overscroll-behavior","overscroll-behavior-block","overscroll-behavior-inline","overscroll-behavior-x","overscroll-behavior-y","padding","padding-block","padding-block-end","padding-block-start","padding-bottom","padding-inline","padding-inline-end","padding-inline-start","padding-left","padding-right","padding-top","page","page-break-after","page-break-before","page-break-inside","paint-order","pause","pause-after","pause-before","perspective","perspective-origin","place-content","place-items","place-self","pointer-events","position","position-anchor","position-visibility","print-color-adjust","quotes","r","resize","rest","rest-after","rest-before","right","rotate","row-gap","ruby-align","ruby-position","scale","scroll-behavior","scroll-margin","scroll-margin-block","scroll-margin-block-end","scroll-margin-block-start","scroll-margin-bottom","scroll-margin-inline","scroll-margin-inline-end","scroll-margin-inline-start","scroll-margin-left","scroll-margin-right","scroll-margin-top","scroll-padding","scroll-padding-block","scroll-padding-block-end","scroll-padding-block-start","scroll-padding-bottom","scroll-padding-inline","scroll-padding-inline-end","scroll-padding-inline-start","scroll-padding-left","scroll-padding-right","scroll-padding-top","scroll-snap-align","scroll-snap-stop","scroll-snap-type","scroll-timeline","scroll-timeline-axis","scroll-timeline-name","scrollbar-color","scrollbar-gutter","scrollbar-width","shape-image-threshold","shape-margin","shape-outside","shape-rendering","speak","speak-as","src","stop-color","stop-opacity","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","tab-size","table-layout","text-align","text-align-all","text-align-last","text-anchor","text-combine-upright","text-decoration","text-decoration-color","text-decoration-line","text-decoration-skip","text-decoration-skip-ink","text-decoration-style","text-decoration-thickness","text-emphasis","text-emphasis-color","text-emphasis-position","text-emphasis-style","text-indent","text-justify","text-orientation","text-overflow","text-rendering","text-shadow","text-size-adjust","text-transform","text-underline-offset","text-underline-position","text-wrap","text-wrap-mode","text-wrap-style","timeline-scope","top","touch-action","transform","transform-box","transform-origin","transform-style","transition","transition-behavior","transition-delay","transition-duration","transition-property","transition-timing-function","translate","unicode-bidi","user-modify","user-select","vector-effect","vertical-align","view-timeline","view-timeline-axis","view-timeline-inset","view-timeline-name","view-transition-name","visibility","voice-balance","voice-duration","voice-family","voice-pitch","voice-range","voice-rate","voice-stress","voice-volume","white-space","white-space-collapse","widows","width","will-change","word-break","word-spacing","word-wrap","writing-mode","x","y","z-index","zoom"].sort().reverse();function aq(t){const e=t.regex,r=JU(t),n={begin:/-(webkit|moz|ms|o)-(?=[a-z])/},i="and or not only",a=/@-?\w[\w]*(-\w+)*/,o="[a-zA-Z-][a-zA-Z0-9_-]*",c=[t.APOS_STRING_MODE,t.QUOTE_STRING_MODE];return{name:"CSS",case_insensitive:!0,illegal:/[=|'\$]/,keywords:{keyframePosition:"from to"},classNameAliases:{keyframePosition:"selector-tag"},contains:[r.BLOCK_COMMENT,n,r.CSS_NUMBER_MODE,{className:"selector-id",begin:/#[A-Za-z0-9_-]+/,relevance:0},{className:"selector-class",begin:"\\."+o,relevance:0},r.ATTRIBUTE_SELECTOR_MODE,{className:"selector-pseudo",variants:[{begin:":("+rq.join("|")+")"},{begin:":(:)?("+nq.join("|")+")"}]},r.CSS_VARIABLE,{className:"attribute",begin:"\\b("+iq.join("|")+")\\b"},{begin:/:/,end:/[;}{]/,contains:[r.BLOCK_COMMENT,r.HEXCOLOR,r.IMPORTANT,r.CSS_NUMBER_MODE,...c,{begin:/(url|data-uri)\(/,end:/\)/,relevance:0,keywords:{built_in:"url data-uri"},contains:[...c,{className:"string",begin:/[^)]/,endsWithParent:!0,excludeEnd:!0}]},r.FUNCTION_DISPATCH]},{begin:e.lookahead(/@/),end:"[{;]",relevance:0,illegal:/:/,contains:[{className:"keyword",begin:a},{begin:/\s/,endsWithParent:!0,excludeEnd:!0,relevance:0,keywords:{$pattern:/[a-z-]+/,keyword:i,attribute:tq.join(" ")},contains:[{begin:/[a-z-]+(?=:)/,className:"attribute"},...c,r.CSS_NUMBER_MODE]}]},{className:"selector-tag",begin:"\\b("+eq.join("|")+")\\b"}]}}function oq(t){const a={keyword:["break","case","chan","const","continue","default","defer","else","fallthrough","for","func","go","goto","if","import","interface","map","package","range","return","select","struct","switch","type","var"],type:["bool","byte","complex64","complex128","error","float32","float64","int8","int16","int32","int64","string","uint8","uint16","uint32","uint64","int","uint","uintptr","rune"],literal:["true","false","iota","nil"],built_in:["append","cap","close","complex","copy","imag","len","make","new","panic","print","println","real","recover","delete"]};return{name:"Go",aliases:["golang"],keywords:a,illegal:"</",contains:[t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE,{className:"string",variants:[t.QUOTE_STRING_MODE,t.APOS_STRING_MODE,{begin:"`",end:"`"}]},{className:"number",variants:[{match:/-?\b0[xX]\.[a-fA-F0-9](_?[a-fA-F0-9])*[pP][+-]?\d(_?\d)*i?/,relevance:0},{match:/-?\b0[xX](_?[a-fA-F0-9])+((\.([a-fA-F0-9](_?[a-fA-F0-9])*)?)?[pP][+-]?\d(_?\d)*)?i?/,relevance:0},{match:/-?\b0[oO](_?[0-7])*i?/,relevance:0},{match:/-?\.\d(_?\d)*([eE][+-]?\d(_?\d)*)?i?/,relevance:0},{match:/-?\b\d(_?\d)*(\.(\d(_?\d)*)?)?([eE][+-]?\d(_?\d)*)?i?/,relevance:0}]},{begin:/:=/},{className:"function",beginKeywords:"func",end:"\\s*(\\{|$)",excludeEnd:!0,contains:[t.TITLE_MODE,{className:"params",begin:/\(/,end:/\)/,endsParent:!0,keywords:a,illegal:/["']/}]}]}}const RE="[A-Za-z$_][0-9A-Za-z$_]*",sq=["as","in","of","if","for","while","finally","var","new","function","do","return","void","else","break","catch","instanceof","with","throw","case","default","try","switch","continue","typeof","delete","let","yield","const","class","debugger","async","await","static","import","from","export","extends","using"],lq=["true","false","null","undefined","NaN","Infinity"],rR=["Object","Function","Boolean","Symbol","Math","Date","Number","BigInt","String","RegExp","Array","Float32Array","Float64Array","Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Int32Array","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array","Set","Map","WeakSet","WeakMap","ArrayBuffer","SharedArrayBuffer","Atomics","DataView","JSON","Promise","Generator","GeneratorFunction","AsyncFunction","Reflect","Proxy","Intl","WebAssembly"],nR=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],iR=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],cq=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],uq=[].concat(iR,rR,nR);function aR(t){const e=t.regex,r=(H,{after:Q})=>{const U="</"+H[0].slice(1);return H.input.indexOf(U,Q)!==-1},n=RE,i={begin:"<>",end:"</>"},a=/<[A-Za-z0-9\\._:-]+\s*\/>/,o={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(H,Q)=>{const U=H[0].length+H.index,I=H.input[U];if(I==="<"||I===","){Q.ignoreMatch();return}I===">"&&(r(H,{after:U})||Q.ignoreMatch());let $;const V=H.input.substring(U);if($=V.match(/^\s*=/)){Q.ignoreMatch();return}if(($=V.match(/^\s+extends\s+/))&&$.index===0){Q.ignoreMatch();return}}},c={$pattern:RE,keyword:sq,literal:lq,built_in:uq,"variable.language":cq},u="[0-9](_?[0-9])*",d=`\\.(${u})`,p="0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*",f={className:"number",variants:[{begin:`(\\b(${p})((${d})|\\.)?|(${d}))[eE][+-]?(${u})\\b`},{begin:`\\b(${p})\\b((${d})\\b|\\.)?|(${d})\\b`},{begin:"\\b(0|[1-9](_?[0-9])*)n\\b"},{begin:"\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*n?\\b"},{begin:"\\b0[bB][0-1](_?[0-1])*n?\\b"},{begin:"\\b0[oO][0-7](_?[0-7])*n?\\b"},{begin:"\\b0[0-7]+n?\\b"}],relevance:0},g={className:"subst",begin:"\\$\\{",end:"\\}",keywords:c,contains:[]},v={begin:".?html`",end:"",starts:{end:"`",returnEnd:!1,contains:[t.BACKSLASH_ESCAPE,g],subLanguage:"xml"}},x={begin:".?css`",end:"",starts:{end:"`",returnEnd:!1,contains:[t.BACKSLASH_ESCAPE,g],subLanguage:"css"}},_={begin:".?gql`",end:"",starts:{end:"`",returnEnd:!1,contains:[t.BACKSLASH_ESCAPE,g],subLanguage:"graphql"}},b={className:"string",begin:"`",end:"`",contains:[t.BACKSLASH_ESCAPE,g]},A={className:"comment",variants:[t.COMMENT(/\/\*\*(?!\/)/,"\\*/",{relevance:0,contains:[{begin:"(?=@[A-Za-z]+)",relevance:0,contains:[{className:"doctag",begin:"@[A-Za-z]+"},{className:"type",begin:"\\{",end:"\\}",excludeEnd:!0,excludeBegin:!0,relevance:0},{className:"variable",begin:n+"(?=\\s*(-)|$)",endsParent:!0,relevance:0},{begin:/(?=[^\n])\s/,relevance:0}]}]}),t.C_BLOCK_COMMENT_MODE,t.C_LINE_COMMENT_MODE]},O=[t.APOS_STRING_MODE,t.QUOTE_STRING_MODE,v,x,_,b,{match:/\$\d+/},f];g.contains=O.concat({begin:/\{/,end:/\}/,keywords:c,contains:["self"].concat(O)});const j=[].concat(A,g.contains),E=j.concat([{begin:/(\s*)\(/,end:/\)/,keywords:c,contains:["self"].concat(j)}]),T={className:"params",begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:c,contains:E},N={variants:[{match:[/class/,/\s+/,n,/\s+/,/extends/,/\s+/,e.concat(n,"(",e.concat(/\./,n),")*")],scope:{1:"keyword",3:"title.class",5:"keyword",7:"title.class.inherited"}},{match:[/class/,/\s+/,n],scope:{1:"keyword",3:"title.class"}}]},R={relevance:0,match:e.either(/\bJSON/,/\b[A-Z][a-z]+([A-Z][a-z]*|\d)*/,/\b[A-Z]{2,}([A-Z][a-z]+|\d)+([A-Z][a-z]*)*/,/\b[A-Z]{2,}[a-z]+([A-Z][a-z]+|\d)*([A-Z][a-z]*)*/),className:"title.class",keywords:{_:[...rR,...nR]}},M={label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},J={variants:[{match:[/function/,/\s+/,n,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[T],illegal:/%/},F={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function B(H){return e.concat("(?!",H.join("|"),")")}const K={match:e.concat(/\b/,B([...iR,"super","import"].map(H=>`${H}\\s*\\(`)),n,e.lookahead(/\s*\(/)),className:"title.function",relevance:0},W={begin:e.concat(/\./,e.lookahead(e.concat(n,/(?![0-9A-Za-z$_(])/))),end:n,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},X={match:[/get|set/,/\s+/,n,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},T]},Y="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+t.UNDERSCORE_IDENT_RE+")\\s*=>",te={match:[/const|var|let/,/\s+/,n,/\s*/,/=\s*/,/(async\s*)?/,e.lookahead(Y)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[T]};return{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:c,exports:{PARAMS_CONTAINS:E,CLASS_REFERENCE:R},illegal:/#(?![$_A-z])/,contains:[t.SHEBANG({label:"shebang",binary:"node",relevance:5}),M,t.APOS_STRING_MODE,t.QUOTE_STRING_MODE,v,x,_,b,A,{match:/\$\d+/},f,R,{scope:"attr",match:n+e.lookahead(":"),relevance:0},te,{begin:"("+t.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",relevance:0,contains:[A,t.REGEXP_MODE,{className:"function",begin:Y,returnBegin:!0,end:"\\s*=>",contains:[{className:"params",variants:[{begin:t.UNDERSCORE_IDENT_RE,relevance:0},{className:null,begin:/\(\s*\)/,skip:!0},{begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:c,contains:E}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:i.begin,end:i.end},{match:a},{begin:o.begin,"on:begin":o.isTrulyOpeningTag,end:o.end}],subLanguage:"xml",contains:[{begin:o.begin,end:o.end,skip:!0,contains:["self"]}]}]},J,{beginKeywords:"while if switch catch for"},{begin:"\\b(?!function)"+t.UNDERSCORE_IDENT_RE+"\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{",returnBegin:!0,label:"func.def",contains:[T,t.inherit(t.TITLE_MODE,{begin:n,className:"title.function"})]},{match:/\.\.\./,relevance:0},W,{match:"\\$"+n,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[T]},K,F,N,X,{match:/\$[(.]/}]}}function dq(t){const e={className:"attr",begin:/"(\\.|[^\\"\r\n])*"(?=\s*:)/,relevance:1.01},r={match:/[{}[\],:]/,className:"punctuation",relevance:0},n=["true","false","null"],i={scope:"literal",beginKeywords:n.join(" ")};return{name:"JSON",aliases:["jsonc"],keywords:{literal:n},contains:[e,r,t.QUOTE_STRING_MODE,i,t.C_NUMBER_MODE,t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE],illegal:"\\S"}}function oR(t){const e=t.regex,r=new RegExp("[\\p{XID_Start}_]\\p{XID_Continue}*","u"),n=["and","as","assert","async","await","break","case","class","continue","def","del","elif","else","except","finally","for","from","global","if","import","in","is","lambda","match","nonlocal|10","not","or","pass","raise","return","try","while","with","yield"],c={$pattern:/[A-Za-z]\w+|__\w+__/,keyword:n,built_in:["__import__","abs","all","any","ascii","bin","bool","breakpoint","bytearray","bytes","callable","chr","classmethod","compile","complex","delattr","dict","dir","divmod","enumerate","eval","exec","filter","float","format","frozenset","getattr","globals","hasattr","hash","help","hex","id","input","int","isinstance","issubclass","iter","len","list","locals","map","max","memoryview","min","next","object","oct","open","ord","pow","print","property","range","repr","reversed","round","set","setattr","slice","sorted","staticmethod","str","sum","super","tuple","type","vars","zip"],literal:["__debug__","Ellipsis","False","None","NotImplemented","True"],type:["Any","Callable","Coroutine","Dict","List","Literal","Generic","Optional","Sequence","Set","Tuple","Type","Union"]},u={className:"meta",begin:/^(>>>|\.\.\.) /},d={className:"subst",begin:/\{/,end:/\}/,keywords:c,illegal:/#/},p={begin:/\{\{/,relevance:0},f={className:"string",contains:[t.BACKSLASH_ESCAPE],variants:[{begin:/([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?'''/,end:/'''/,contains:[t.BACKSLASH_ESCAPE,u],relevance:10},{begin:/([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?"""/,end:/"""/,contains:[t.BACKSLASH_ESCAPE,u],relevance:10},{begin:/([fF][rR]|[rR][fF]|[fF])'''/,end:/'''/,contains:[t.BACKSLASH_ESCAPE,u,p,d]},{begin:/([fF][rR]|[rR][fF]|[fF])"""/,end:/"""/,contains:[t.BACKSLASH_ESCAPE,u,p,d]},{begin:/([uU]|[rR])'/,end:/'/,relevance:10},{begin:/([uU]|[rR])"/,end:/"/,relevance:10},{begin:/([bB]|[bB][rR]|[rR][bB])'/,end:/'/},{begin:/([bB]|[bB][rR]|[rR][bB])"/,end:/"/},{begin:/([fF][rR]|[rR][fF]|[fF])'/,end:/'/,contains:[t.BACKSLASH_ESCAPE,p,d]},{begin:/([fF][rR]|[rR][fF]|[fF])"/,end:/"/,contains:[t.BACKSLASH_ESCAPE,p,d]},t.APOS_STRING_MODE,t.QUOTE_STRING_MODE]},g="[0-9](_?[0-9])*",v=`(\\b(${g}))?\\.(${g})|\\b(${g})\\.`,x=`\\b|${n.join("|")}`,_={className:"number",relevance:0,variants:[{begin:`(\\b(${g})|(${v}))[eE][+-]?(${g})[jJ]?(?=${x})`},{begin:`(${v})[jJ]?`},{begin:`\\b([1-9](_?[0-9])*|0+(_?0)*)[lLjJ]?(?=${x})`},{begin:`\\b0[bB](_?[01])+[lL]?(?=${x})`},{begin:`\\b0[oO](_?[0-7])+[lL]?(?=${x})`},{begin:`\\b0[xX](_?[0-9a-fA-F])+[lL]?(?=${x})`},{begin:`\\b(${g})[jJ](?=${x})`}]},b={className:"comment",begin:e.lookahead(/# type:/),end:/$/,keywords:c,contains:[{begin:/# type:/},{begin:/#/,end:/\b\B/,endsWithParent:!0}]},S={className:"params",variants:[{className:"",begin:/\(\s*\)/,skip:!0},{begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:c,contains:["self",u,_,f,t.HASH_COMMENT_MODE]}]};return d.contains=[f,_,u],{name:"Python",aliases:["py","gyp","ipython"],unicodeRegex:!0,keywords:c,illegal:/(<\/|\?)|=>/,contains:[u,_,{scope:"variable.language",match:/\bself\b/},{beginKeywords:"if",relevance:0},{match:/\bor\b/,scope:"keyword"},f,b,t.HASH_COMMENT_MODE,{match:[/\bdef/,/\s+/,r],scope:{1:"keyword",3:"title.function"},contains:[S]},{variants:[{match:[/\bclass/,/\s+/,r,/\s*/,/\(\s*/,r,/\s*\)/]},{match:[/\bclass/,/\s+/,r]}],scope:{1:"keyword",3:"title.class",6:"title.class.inherited"}},{className:"meta",begin:/^[\t ]*@/,end:/(?=#)|$/,contains:[_,S,f]}]}}function fq(t){const e=t.regex,r=/(r#)?/,n=e.concat(r,t.UNDERSCORE_IDENT_RE),i=e.concat(r,t.IDENT_RE),a={className:"title.function.invoke",relevance:0,begin:e.concat(/\b/,/(?!let|for|while|if|else|match\b)/,i,e.lookahead(/\s*\(/))},o="([ui](8|16|32|64|128|size)|f(32|64))?",c=["abstract","as","async","await","become","box","break","const","continue","crate","do","dyn","else","enum","extern","false","final","fn","for","if","impl","in","let","loop","macro","match","mod","move","mut","override","priv","pub","ref","return","self","Self","static","struct","super","trait","true","try","type","typeof","union","unsafe","unsized","use","virtual","where","while","yield"],u=["true","false","Some","None","Ok","Err"],d=["drop ","Copy","Send","Sized","Sync","Drop","Fn","FnMut","FnOnce","ToOwned","Clone","Debug","PartialEq","PartialOrd","Eq","Ord","AsRef","AsMut","Into","From","Default","Iterator","Extend","IntoIterator","DoubleEndedIterator","ExactSizeIterator","SliceConcatExt","ToString","assert!","assert_eq!","bitflags!","bytes!","cfg!","col!","concat!","concat_idents!","debug_assert!","debug_assert_eq!","env!","eprintln!","panic!","file!","format!","format_args!","include_bytes!","include_str!","line!","local_data_key!","module_path!","option_env!","print!","println!","select!","stringify!","try!","unimplemented!","unreachable!","vec!","write!","writeln!","macro_rules!","assert_ne!","debug_assert_ne!"],p=["i8","i16","i32","i64","i128","isize","u8","u16","u32","u64","u128","usize","f32","f64","str","char","bool","Box","Option","Result","String","Vec"];return{name:"Rust",aliases:["rs"],keywords:{$pattern:t.IDENT_RE+"!?",type:p,keyword:c,literal:u,built_in:d},illegal:"</",contains:[t.C_LINE_COMMENT_MODE,t.COMMENT("/\\*","\\*/",{contains:["self"]}),t.inherit(t.QUOTE_STRING_MODE,{begin:/b?"/,illegal:null}),{className:"symbol",begin:/'[a-zA-Z_][a-zA-Z0-9_]*(?!')/},{scope:"string",variants:[{begin:/b?r(#*)"(.|\n)*?"\1(?!#)/},{begin:/b?'/,end:/'/,contains:[{scope:"char.escape",match:/\\('|\w|x\w{2}|u\w{4}|U\w{8})/}]}]},{className:"number",variants:[{begin:"\\b0b([01_]+)"+o},{begin:"\\b0o([0-7_]+)"+o},{begin:"\\b0x([A-Fa-f0-9_]+)"+o},{begin:"\\b(\\d[\\d_]*(\\.[0-9_]+)?([eE][+-]?[0-9_]+)?)"+o}],relevance:0},{begin:[/fn/,/\s+/,n],className:{1:"keyword",3:"title.function"}},{className:"meta",begin:"#!?\\[",end:"\\]",contains:[{className:"string",begin:/"/,end:/"/,contains:[t.BACKSLASH_ESCAPE]}]},{begin:[/let/,/\s+/,/(?:mut\s+)?/,n],className:{1:"keyword",3:"keyword",4:"variable"}},{begin:[/for/,/\s+/,n,/\s+/,/in/],className:{1:"keyword",3:"variable",5:"keyword"}},{begin:[/type/,/\s+/,n],className:{1:"keyword",3:"title.class"}},{begin:[/(?:trait|enum|struct|union|impl|for)/,/\s+/,n],className:{1:"keyword",3:"title.class"}},{begin:t.IDENT_RE+"::",keywords:{keyword:"Self",built_in:d,type:p}},{className:"punctuation",begin:"->"},a]}}function e1(t){return{name:"Shell Session",aliases:["console","shellsession"],contains:[{className:"meta.prompt",begin:/^\s{0,3}[/~\w\d[\]()@-]*[>%$#][ ]?/,starts:{end:/[^\\](?=\s*$)/,subLanguage:"bash"}}]}}const Gf="[A-Za-z$_][0-9A-Za-z$_]*",sR=["as","in","of","if","for","while","finally","var","new","function","do","return","void","else","break","catch","instanceof","with","throw","case","default","try","switch","continue","typeof","delete","let","yield","const","class","debugger","async","await","static","import","from","export","extends","using"],lR=["true","false","null","undefined","NaN","Infinity"],cR=["Object","Function","Boolean","Symbol","Math","Date","Number","BigInt","String","RegExp","Array","Float32Array","Float64Array","Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Int32Array","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array","Set","Map","WeakSet","WeakMap","ArrayBuffer","SharedArrayBuffer","Atomics","DataView","JSON","Promise","Generator","GeneratorFunction","AsyncFunction","Reflect","Proxy","Intl","WebAssembly"],uR=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],dR=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],fR=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],hR=[].concat(dR,cR,uR);function hq(t){const e=t.regex,r=(H,{after:Q})=>{const U="</"+H[0].slice(1);return H.input.indexOf(U,Q)!==-1},n=Gf,i={begin:"<>",end:"</>"},a=/<[A-Za-z0-9\\._:-]+\s*\/>/,o={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(H,Q)=>{const U=H[0].length+H.index,I=H.input[U];if(I==="<"||I===","){Q.ignoreMatch();return}I===">"&&(r(H,{after:U})||Q.ignoreMatch());let $;const V=H.input.substring(U);if($=V.match(/^\s*=/)){Q.ignoreMatch();return}if(($=V.match(/^\s+extends\s+/))&&$.index===0){Q.ignoreMatch();return}}},c={$pattern:Gf,keyword:sR,literal:lR,built_in:hR,"variable.language":fR},u="[0-9](_?[0-9])*",d=`\\.(${u})`,p="0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*",f={className:"number",variants:[{begin:`(\\b(${p})((${d})|\\.)?|(${d}))[eE][+-]?(${u})\\b`},{begin:`\\b(${p})\\b((${d})\\b|\\.)?|(${d})\\b`},{begin:"\\b(0|[1-9](_?[0-9])*)n\\b"},{begin:"\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*n?\\b"},{begin:"\\b0[bB][0-1](_?[0-1])*n?\\b"},{begin:"\\b0[oO][0-7](_?[0-7])*n?\\b"},{begin:"\\b0[0-7]+n?\\b"}],relevance:0},g={className:"subst",begin:"\\$\\{",end:"\\}",keywords:c,contains:[]},v={begin:".?html`",end:"",starts:{end:"`",returnEnd:!1,contains:[t.BACKSLASH_ESCAPE,g],subLanguage:"xml"}},x={begin:".?css`",end:"",starts:{end:"`",returnEnd:!1,contains:[t.BACKSLASH_ESCAPE,g],subLanguage:"css"}},_={begin:".?gql`",end:"",starts:{end:"`",returnEnd:!1,contains:[t.BACKSLASH_ESCAPE,g],subLanguage:"graphql"}},b={className:"string",begin:"`",end:"`",contains:[t.BACKSLASH_ESCAPE,g]},A={className:"comment",variants:[t.COMMENT(/\/\*\*(?!\/)/,"\\*/",{relevance:0,contains:[{begin:"(?=@[A-Za-z]+)",relevance:0,contains:[{className:"doctag",begin:"@[A-Za-z]+"},{className:"type",begin:"\\{",end:"\\}",excludeEnd:!0,excludeBegin:!0,relevance:0},{className:"variable",begin:n+"(?=\\s*(-)|$)",endsParent:!0,relevance:0},{begin:/(?=[^\n])\s/,relevance:0}]}]}),t.C_BLOCK_COMMENT_MODE,t.C_LINE_COMMENT_MODE]},O=[t.APOS_STRING_MODE,t.QUOTE_STRING_MODE,v,x,_,b,{match:/\$\d+/},f];g.contains=O.concat({begin:/\{/,end:/\}/,keywords:c,contains:["self"].concat(O)});const j=[].concat(A,g.contains),E=j.concat([{begin:/(\s*)\(/,end:/\)/,keywords:c,contains:["self"].concat(j)}]),T={className:"params",begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:c,contains:E},N={variants:[{match:[/class/,/\s+/,n,/\s+/,/extends/,/\s+/,e.concat(n,"(",e.concat(/\./,n),")*")],scope:{1:"keyword",3:"title.class",5:"keyword",7:"title.class.inherited"}},{match:[/class/,/\s+/,n],scope:{1:"keyword",3:"title.class"}}]},R={relevance:0,match:e.either(/\bJSON/,/\b[A-Z][a-z]+([A-Z][a-z]*|\d)*/,/\b[A-Z]{2,}([A-Z][a-z]+|\d)+([A-Z][a-z]*)*/,/\b[A-Z]{2,}[a-z]+([A-Z][a-z]+|\d)*([A-Z][a-z]*)*/),className:"title.class",keywords:{_:[...cR,...uR]}},M={label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},J={variants:[{match:[/function/,/\s+/,n,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[T],illegal:/%/},F={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function B(H){return e.concat("(?!",H.join("|"),")")}const K={match:e.concat(/\b/,B([...dR,"super","import"].map(H=>`${H}\\s*\\(`)),n,e.lookahead(/\s*\(/)),className:"title.function",relevance:0},W={begin:e.concat(/\./,e.lookahead(e.concat(n,/(?![0-9A-Za-z$_(])/))),end:n,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},X={match:[/get|set/,/\s+/,n,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},T]},Y="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+t.UNDERSCORE_IDENT_RE+")\\s*=>",te={match:[/const|var|let/,/\s+/,n,/\s*/,/=\s*/,/(async\s*)?/,e.lookahead(Y)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[T]};return{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:c,exports:{PARAMS_CONTAINS:E,CLASS_REFERENCE:R},illegal:/#(?![$_A-z])/,contains:[t.SHEBANG({label:"shebang",binary:"node",relevance:5}),M,t.APOS_STRING_MODE,t.QUOTE_STRING_MODE,v,x,_,b,A,{match:/\$\d+/},f,R,{scope:"attr",match:n+e.lookahead(":"),relevance:0},te,{begin:"("+t.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",relevance:0,contains:[A,t.REGEXP_MODE,{className:"function",begin:Y,returnBegin:!0,end:"\\s*=>",contains:[{className:"params",variants:[{begin:t.UNDERSCORE_IDENT_RE,relevance:0},{className:null,begin:/\(\s*\)/,skip:!0},{begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:c,contains:E}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:i.begin,end:i.end},{match:a},{begin:o.begin,"on:begin":o.isTrulyOpeningTag,end:o.end}],subLanguage:"xml",contains:[{begin:o.begin,end:o.end,skip:!0,contains:["self"]}]}]},J,{beginKeywords:"while if switch catch for"},{begin:"\\b(?!function)"+t.UNDERSCORE_IDENT_RE+"\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{",returnBegin:!0,label:"func.def",contains:[T,t.inherit(t.TITLE_MODE,{begin:n,className:"title.function"})]},{match:/\.\.\./,relevance:0},W,{match:"\\$"+n,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[T]},K,F,N,X,{match:/\$[(.]/}]}}function pR(t){const e=t.regex,r=hq(t),n=Gf,i=["any","void","number","boolean","string","object","never","symbol","bigint","unknown"],a={begin:[/namespace/,/\s+/,t.IDENT_RE],beginScope:{1:"keyword",3:"title.class"}},o={beginKeywords:"interface",end:/\{/,excludeEnd:!0,keywords:{keyword:"interface extends",built_in:i},contains:[r.exports.CLASS_REFERENCE]},c={className:"meta",relevance:10,begin:/^\s*['"]use strict['"]/},u=["type","interface","public","private","protected","implements","declare","abstract","readonly","enum","override","satisfies"],d={$pattern:Gf,keyword:sR.concat(u),literal:lR,built_in:hR.concat(i),"variable.language":fR},p={className:"meta",begin:"@"+n},f=(_,b,S)=>{const A=_.contains.findIndex(O=>O.label===b);if(A===-1)throw new Error("can not find mode to replace");_.contains.splice(A,1,S)};Object.assign(r.keywords,d),r.exports.PARAMS_CONTAINS.push(p);const g=r.contains.find(_=>_.scope==="attr"),v=Object.assign({},g,{match:e.concat(n,e.lookahead(/\s*\?:/))});r.exports.PARAMS_CONTAINS.push([r.exports.CLASS_REFERENCE,g,v]),r.contains=r.contains.concat([p,a,o,v]),f(r,"shebang",t.SHEBANG()),f(r,"use_strict",c);const x=r.contains.find(_=>_.label==="func.def");return x.relevance=0,Object.assign(r,{name:"TypeScript",aliases:["ts","tsx","mts","cts"]}),r}function mR(t){const e=t.regex,r=e.concat(/[\p{L}_]/u,e.optional(/[\p{L}0-9_.-]*:/u),/[\p{L}0-9_.-]*/u),n=/[\p{L}0-9._:-]+/u,i={className:"symbol",begin:/&[a-z]+;|&#[0-9]+;|&#x[a-f0-9]+;/},a={begin:/\s/,contains:[{className:"keyword",begin:/#?[a-z_][a-z1-9_-]+/,illegal:/\n/}]},o=t.inherit(a,{begin:/\(/,end:/\)/}),c=t.inherit(t.APOS_STRING_MODE,{className:"string"}),u=t.inherit(t.QUOTE_STRING_MODE,{className:"string"}),d={endsWithParent:!0,illegal:/</,relevance:0,contains:[{className:"attr",begin:n,relevance:0},{begin:/=\s*/,relevance:0,contains:[{className:"string",endsParent:!0,variants:[{begin:/"/,end:/"/,contains:[i]},{begin:/'/,end:/'/,contains:[i]},{begin:/[^\s"'=<>`]+/}]}]}]};return{name:"HTML, XML",aliases:["html","xhtml","rss","atom","xjb","xsd","xsl","plist","wsf","svg"],case_insensitive:!0,unicodeRegex:!0,contains:[{className:"meta",begin:/<![a-z]/,end:/>/,relevance:10,contains:[a,u,c,o,{begin:/\[/,end:/\]/,contains:[{className:"meta",begin:/<![a-z]/,end:/>/,contains:[a,o,u,c]}]}]},t.COMMENT(/<!--/,/-->/,{relevance:10}),{begin:/<!\[CDATA\[/,end:/\]\]>/,relevance:10},i,{className:"meta",end:/\?>/,variants:[{begin:/<\?xml/,relevance:10,contains:[u]},{begin:/<\?[a-z][a-z0-9]+/}]},{className:"tag",begin:/<style(?=\s|>)/,end:/>/,keywords:{name:"style"},contains:[d],starts:{end:/<\/style>/,returnEnd:!0,subLanguage:["css","xml"]}},{className:"tag",begin:/<script(?=\s|>)/,end:/>/,keywords:{name:"script"},contains:[d],starts:{end:/<\/script>/,returnEnd:!0,subLanguage:["javascript","handlebars","xml"]}},{className:"tag",begin:/<>|<\/>/},{className:"tag",begin:e.concat(/</,e.lookahead(e.concat(r,e.either(/\/>/,/>/,/\s/)))),end:/\/?>/,contains:[{className:"name",begin:r,relevance:0,starts:d}]},{className:"tag",begin:e.concat(/<\//,e.lookahead(e.concat(r,/>/))),contains:[{className:"name",begin:r,relevance:0},{begin:/>/,relevance:0,endsParent:!0}]}]}}function gR(t){const e="true false yes no null",r="[\\w#;/?:@&=+$,.~*'()[\\]]+",n={className:"attr",variants:[{begin:/[\w*@][\w*@ :()\./-]*:(?=[ \t]|$)/},{begin:/"[\w*@][\w*@ :()\./-]*":(?=[ \t]|$)/},{begin:/'[\w*@][\w*@ :()\./-]*':(?=[ \t]|$)/}]},i={className:"template-variable",variants:[{begin:/\{\{/,end:/\}\}/},{begin:/%\{/,end:/\}/}]},a={className:"string",relevance:0,begin:/'/,end:/'/,contains:[{match:/''/,scope:"char.escape",relevance:0}]},o={className:"string",relevance:0,variants:[{begin:/"/,end:/"/},{begin:/\S+/}],contains:[t.BACKSLASH_ESCAPE,i]},c=t.inherit(o,{variants:[{begin:/'/,end:/'/,contains:[{begin:/''/,relevance:0}]},{begin:/"/,end:/"/},{begin:/[^\s,{}[\]]+/}]}),g={className:"number",begin:"\\b"+"[0-9]{4}(-[0-9][0-9]){0,2}"+"([Tt \\t][0-9][0-9]?(:[0-9][0-9]){2})?"+"(\\.[0-9]*)?"+"([ \\t])*(Z|[-+][0-9][0-9]?(:[0-9][0-9])?)?"+"\\b"},v={end:",",endsWithParent:!0,excludeEnd:!0,keywords:e,relevance:0},x={begin:/\{/,end:/\}/,contains:[v],illegal:"\\n",relevance:0},_={begin:"\\[",end:"\\]",contains:[v],illegal:"\\n",relevance:0},b=[n,{className:"meta",begin:"^---\\s*$",relevance:10},{className:"string",begin:"[\\|>]([1-9]?[+-])?[ ]*\\n( +)[^ ][^\\n]*\\n(\\2[^\\n]+\\n?)*"},{begin:"<%[%=-]?",end:"[%-]?%>",subLanguage:"ruby",excludeBegin:!0,excludeEnd:!0,relevance:0},{className:"type",begin:"!\\w+!"+r},{className:"type",begin:"!<"+r+">"},{className:"type",begin:"!"+r},{className:"type",begin:"!!"+r},{className:"meta",begin:"&"+t.UNDERSCORE_IDENT_RE+"$"},{className:"meta",begin:"\\*"+t.UNDERSCORE_IDENT_RE+"$"},{className:"bullet",begin:"-(?=[ ]|$)",relevance:0},t.HASH_COMMENT_MODE,{beginKeywords:e,keywords:{literal:e}},g,{className:"number",begin:t.C_NUMBER_RE+"\\b",relevance:0},x,_,a,o],S=[...b];return S.pop(),S.push(c),v.contains=S,{name:"YAML",case_insensitive:!0,aliases:["yml"],contains:b}}Qt.registerLanguage("javascript",aR);Qt.registerLanguage("js",aR);Qt.registerLanguage("typescript",pR);Qt.registerLanguage("ts",pR);Qt.registerLanguage("python",oR);Qt.registerLanguage("py",oR);Qt.registerLanguage("rust",fq);Qt.registerLanguage("go",oq);Qt.registerLanguage("json",dq);Qt.registerLanguage("yaml",gR);Qt.registerLanguage("yml",gR);Qt.registerLanguage("shell",e1);Qt.registerLanguage("bash",e1);Qt.registerLanguage("sh",e1);Qt.registerLanguage("html",mR);Qt.registerLanguage("xml",mR);Qt.registerLanguage("css",aq);nt.use({renderer:{heading({tokens:t,depth:e}){const r=t.map(a=>a.raw).join(""),n=`h${e}`;return`<${n} style="background:linear-gradient(135deg, #D83333 0%, #E43A9C 50%, #F041FF 100%);-webkit-background-clip:text;-webkit-text-fill-color:transparent;background-clip:text;font-size:${{1:"1.35em",2:"1.15em",3:"1em",4:"0.9em"}[e]??"1em"};font-weight:600;margin:1.1em 0 0.4em;line-height:1.4;">${r}</${n}>`},code({text:t,lang:e}){let r;return e&&Qt.getLanguage(e)?r=Qt.highlight(t,{language:e}).value:r=Qt.highlightAuto(t).value,`<pre style="background:#161616;border:1px solid rgba(255,255,255,0.07);border-radius:10px;padding:0.9em 1.1em;overflow-x:auto;margin:0.8em 0;"><code class="hljs" style="background:none;border:none;padding:0;color:#d4d4d8;font-size:0.85em;">${r}</code></pre>`}}});function sp({content:t,className:e=""}){const r=P.useMemo(()=>nt.parse(t),[t]);return y.jsx("div",{className:`prose-io ${e}`,style:{color:"#d4d4d8",fontSize:"0.875rem",lineHeight:"1.7"},dangerouslySetInnerHTML:{__html:r}})}const IE=["#38bdf8","#a78bfa","#34d399","#f59e0b","#f87171","#E43A9C"];function pq(t){let e=0;for(let r=0;r<t.length;r++)e=t.charCodeAt(r)+((e<<5)-e);return IE[Math.abs(e)%IE.length]}function $E({name:t,color:e}){const r=t.toLowerCase(),n=e??(r==="orchestrator"||r==="io"?"#71717a":pq(t));return y.jsx("span",{className:"inline-flex items-center px-1.5 py-px rounded text-[10px] font-mono border",style:{background:`${n}15`,color:n,borderColor:`${n}30`},children:t})}function mq(){const[t,e]=P.useState([]),[r,n]=P.useState(null),[i,a]=P.useState(new Set),[o,c]=P.useState("all"),u=qa();P.useEffect(()=>{Ve.get("/inbox").then(O=>e(O.entries)).catch(()=>{})},[]);const d=t.filter(O=>O.status==="unread").length,p=o==="unread"?t.filter(O=>O.status==="unread"):t,f=p.length>0&&p.every(O=>i.has(O.id)),g=i.size>0;function v(O){g||(n(O),O.status==="unread"&&(Ve.post(`/inbox/${O.id}/read`).catch(()=>{}),e(j=>j.map(E=>E.id===O.id?{...E,status:"read"}:E))))}function x(O,j){O.stopPropagation(),a(E=>{const T=new Set(E);return T.has(j)?T.delete(j):T.add(j),T})}function _(){a(f?new Set:new Set(p.map(O=>O.id)))}function b(){const O=Array.from(i);Ve.post("/inbox/bulk/read",{ids:O}).catch(()=>{}),e(j=>j.map(E=>i.has(E.id)?{...E,status:"read"}:E)),a(new Set)}function S(){const O=Array.from(i);Ve.post("/inbox/bulk/delete",{ids:O}).catch(()=>{}),e(j=>j.filter(E=>!i.has(E.id))),r&&i.has(r.id)&&n(null),a(new Set)}function A(O){Ve.delete(`/inbox/${O}`).catch(()=>{}),e(j=>j.filter(E=>E.id!==O)),(r==null?void 0:r.id)===O&&n(null)}return y.jsxs("div",{className:"flex flex-1 min-h-0 overflow-hidden",children:[y.jsxs("div",{className:"w-72 flex-shrink-0 border-r border-white/[0.06] flex flex-col overflow-hidden",children:[y.jsxs("div",{className:"px-4 py-3 border-b border-white/[0.06] flex-shrink-0 space-y-2",children:[y.jsxs("div",{className:"flex items-center justify-between",children:[y.jsx("span",{className:"text-lg tracking-wide text-zinc-200",style:{fontFamily:"'Bebas Neue', sans-serif"},children:"Inbox"}),d>0&&y.jsxs(jt,{variant:"default",children:[d," unread"]})]}),y.jsx("div",{className:"flex gap-1",children:["all","unread"].map(O=>y.jsx("button",{type:"button",onClick:()=>{c(O),a(new Set)},className:`flex-1 py-1 text-[11px] font-mono rounded-lg transition-colors cursor-pointer ${o===O?"text-[#E43A9C]":"text-zinc-600 hover:text-zinc-300"}`,style:o===O?{background:"rgba(228,58,156,0.12)"}:void 0,children:O},O))})]}),g&&y.jsxs("div",{className:"px-3 py-2 border-b border-white/[0.06] flex items-center gap-1.5 flex-shrink-0",style:{background:"rgba(228,58,156,0.06)"},children:[y.jsxs("span",{className:"text-[10px] font-mono text-zinc-500 flex-1",children:[i.size," selected"]}),y.jsxs("button",{type:"button",onClick:b,className:"flex items-center gap-1 px-2 py-1 rounded-lg text-[10px] font-mono text-zinc-400 hover:text-zinc-200 hover:bg-white/[0.06] transition-colors cursor-pointer",children:[y.jsx(zb,{className:"w-3 h-3"}),"Mark read"]}),y.jsxs("button",{type:"button",onClick:S,className:"flex items-center gap-1 px-2 py-1 rounded-lg text-[10px] font-mono text-red-400 hover:text-red-300 hover:bg-red-500/10 transition-colors cursor-pointer",children:[y.jsx(Ma,{className:"w-3 h-3"}),"Delete"]})]}),p.length>0&&y.jsxs("div",{className:"px-4 py-1.5 border-b border-white/[0.04] flex items-center gap-2 flex-shrink-0",children:[y.jsx("button",{type:"button",onClick:_,className:`w-3.5 h-3.5 rounded border flex items-center justify-center flex-shrink-0 transition-colors cursor-pointer ${f?"border-[#E43A9C] bg-[#E43A9C]":"border-white/20 hover:border-white/40"}`,children:f&&y.jsx("svg",{className:"w-2 h-2 text-white",fill:"none",viewBox:"0 0 8 8",children:y.jsx("path",{d:"M1 4l2 2 4-4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}),y.jsx("span",{className:"text-[10px] font-mono text-zinc-700",children:"Select all"})]}),y.jsxs("div",{className:"flex-1 overflow-y-auto",children:[p.map(O=>{const j=i.has(O.id),E=(r==null?void 0:r.id)===O.id&&!g;return y.jsxs("div",{onClick:()=>v(O),onKeyDown:T=>T.key==="Enter"&&v(O),className:`flex items-start gap-2.5 px-3 py-3 border-b border-white/[0.04] cursor-pointer transition-colors ${E?"border-l-2 border-l-[#E43A9C] pl-2.5":"hover:bg-white/[0.025]"} ${j?"bg-[#E43A9C]/5":""}`,style:E?{background:"rgba(228,58,156,0.05)"}:void 0,children:[y.jsx("button",{type:"button",onClick:T=>x(T,O.id),className:`mt-0.5 w-3.5 h-3.5 rounded border flex items-center justify-center flex-shrink-0 transition-colors cursor-pointer ${j?"border-[#E43A9C] bg-[#E43A9C]":"border-white/20 hover:border-white/50"}`,children:j&&y.jsx("svg",{className:"w-2 h-2 text-white",fill:"none",viewBox:"0 0 8 8",children:y.jsx("path",{d:"M1 4l2 2 4-4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}),y.jsxs("div",{className:"flex-1 min-w-0",children:[y.jsxs("div",{className:"flex items-center gap-1.5 mb-0.5",children:[O.status==="unread"&&y.jsx("div",{className:"w-1 h-1 rounded-full bg-[#E43A9C] flex-shrink-0"}),y.jsx($E,{name:O.squadName??(O.squadId?O.squadId.slice(0,8):"Orchestrator"),color:O.squadColor})]}),y.jsx("p",{className:`text-[11px] truncate ${O.status==="unread"?"text-zinc-200":"text-zinc-500"}`,children:O.title}),y.jsx("p",{className:"text-[10px] text-zinc-700 font-mono mt-1",children:Ws(O.createdAt,u)})]})]},O.id)}),p.length===0&&y.jsxs("div",{className:"flex flex-col items-center justify-center py-12",children:[y.jsx(Bb,{size:32,className:"text-zinc-800 mb-2"}),y.jsx("p",{className:"text-[11px] font-mono text-zinc-700",children:o==="unread"?"All caught up":"No items yet"})]})]})]}),y.jsx("div",{className:"flex-1 flex flex-col overflow-hidden",children:r&&!g?y.jsxs(y.Fragment,{children:[y.jsxs("div",{className:"px-6 py-4 border-b border-white/[0.06] flex items-start justify-between flex-shrink-0",children:[y.jsxs("div",{className:"flex-1 min-w-0 mr-4",children:[y.jsx($E,{name:r.squadName??(r.squadId?r.squadId.slice(0,8):"Orchestrator"),color:r.squadColor}),y.jsx("h3",{className:"text-sm font-mono text-zinc-100 mt-1.5",children:r.title}),y.jsx("p",{className:"text-[11px] text-zinc-700 font-mono mt-0.5",children:Ws(r.createdAt,u)})]}),y.jsxs("button",{type:"button",onClick:()=>A(r.id),className:"flex items-center gap-1.5 px-2.5 py-1 rounded-lg font-mono text-[11px] text-zinc-400 bg-[#252525] hover:bg-red-500/10 hover:text-red-400 transition-colors cursor-pointer",children:[y.jsx(Ma,{className:"w-3 h-3"}),"Delete"]})]}),y.jsx("div",{className:"flex-1 overflow-y-auto px-6 py-5",children:y.jsx(sp,{content:r.content})})]}):g?y.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center gap-4 text-center px-8",children:[y.jsx("div",{className:"w-10 h-10 rounded-2xl flex items-center justify-center border border-[#E43A9C]/20",style:{background:"rgba(228,58,156,0.08)"},children:y.jsx(Bb,{className:"w-4 h-4 text-[#E43A9C]"})}),y.jsxs("div",{children:[y.jsxs("p",{className:"text-sm font-mono text-zinc-300",children:[i.size," message",i.size!==1?"s":""," selected"]}),y.jsx("p",{className:"text-[11px] text-zinc-600 mt-1",children:"Use the actions above to mark as read or delete"})]}),y.jsxs("div",{className:"flex items-center gap-2",children:[y.jsxs("button",{type:"button",onClick:b,className:"flex items-center gap-1.5 px-3 py-1.5 rounded-lg text-[11px] font-mono text-zinc-300 border border-white/[0.1] hover:bg-white/[0.05] transition-colors cursor-pointer",children:[y.jsx(zb,{className:"w-3 h-3"}),"Mark read"]}),y.jsxs("button",{type:"button",onClick:S,className:"flex items-center gap-1.5 px-3 py-1.5 rounded-lg text-[11px] font-mono text-red-400 border border-red-500/20 hover:bg-red-500/10 transition-colors cursor-pointer",children:[y.jsx(Ma,{className:"w-3 h-3"}),"Delete selected"]})]})]}):y.jsx("div",{className:"flex-1 flex items-center justify-center text-zinc-700 font-mono text-xs",children:"Select an item to read"})})]})}function gq(){const{signIn:t}=op(),[e,r]=P.useState(""),[n,i]=P.useState(""),[a,o]=P.useState(null),[c,u]=P.useState(!1);async function d(p){p.preventDefault(),o(null),u(!0);const{error:f}=await t(e,n);f&&o(f),u(!1)}return y.jsxs("div",{className:"min-h-screen bg-[#161616] flex items-center justify-center relative overflow-hidden",children:[y.jsx("div",{className:"absolute inset-0 opacity-[0.04]",style:{backgroundImage:"radial-gradient(circle, #E43A9C 1px, transparent 1px)",backgroundSize:"32px 32px"}}),y.jsx("div",{className:"absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-[60%] w-[400px] h-[300px] rounded-full blur-3xl pointer-events-none",style:{background:"radial-gradient(ellipse, rgba(228,58,156,0.12) 0%, transparent 70%)"}}),y.jsxs("div",{className:"relative z-10 w-full max-w-[360px] mx-4",children:[y.jsxs("div",{className:"flex flex-col items-center mb-8 gap-3",children:[y.jsx(Ra,{height:52}),y.jsx("div",{className:"text-center",children:y.jsx("p",{className:"text-[11px] font-mono text-zinc-600 tracking-widest uppercase mt-1",children:"personal ai orchestrator"})})]}),y.jsxs("form",{onSubmit:d,className:"glass-card border border-white/[0.07] rounded-2xl p-6 space-y-4",children:[y.jsxs("div",{className:"space-y-1",children:[y.jsx("label",{className:"text-[11px] font-mono text-zinc-500 block",children:"Email"}),y.jsx("input",{type:"email",value:e,onChange:p=>r(p.target.value),required:!0,className:"w-full bg-[#161616] border border-white/[0.08] rounded-xl px-3 py-2.5 text-sm text-zinc-200 font-mono placeholder:text-zinc-700 focus:outline-none focus:border-[#E43A9C]/40 focus:ring-1 focus:ring-[#E43A9C]/15 transition-colors"})]}),y.jsxs("div",{className:"space-y-1",children:[y.jsx("label",{className:"text-[11px] font-mono text-zinc-500 block",children:"Password"}),y.jsx("input",{type:"password",value:n,onChange:p=>i(p.target.value),required:!0,placeholder:"••••••••",className:"w-full bg-[#161616] border border-white/[0.08] rounded-xl px-3 py-2.5 text-sm text-zinc-200 font-mono placeholder:text-zinc-700 focus:outline-none focus:border-[#E43A9C]/40 focus:ring-1 focus:ring-[#E43A9C]/15 transition-colors"})]}),a&&y.jsx("p",{className:"text-[11px] font-mono text-red-400",children:a}),y.jsx("button",{type:"submit",disabled:c,className:"w-full text-white font-mono text-sm rounded-xl py-3 mt-1 transition-opacity hover:opacity-90 disabled:opacity-50 flex items-center justify-center gap-2",style:{background:"linear-gradient(135deg, #D83333 0%, #E43A9C 55%, #F041FF 100%)"},children:c?y.jsxs(y.Fragment,{children:[y.jsx("span",{className:"w-3.5 h-3.5 border-2 border-white/30 border-t-white rounded-full animate-spin"}),"Authenticating…"]}):"Sign In"})]}),y.jsx("p",{className:"text-center text-[11px] text-zinc-700 font-mono mt-4",children:"Secured by Supabase Auth"})]})]})}const yR="w-full bg-[#161616] border border-white/[0.08] rounded-xl px-3 py-2 text-[11px] text-zinc-300 font-mono placeholder:text-zinc-700 focus:outline-none focus:border-[#E43A9C]/40 focus:ring-1 focus:ring-[#E43A9C]/10 transition-colors",Bs="bg-[#161616] border border-white/[0.08] rounded-xl px-3 py-2 text-[11px] text-zinc-300 font-mono placeholder:text-zinc-700 focus:outline-none focus:border-[#E43A9C]/40 focus:ring-1 focus:ring-[#E43A9C]/10 transition-colors";function qi({label:t,hint:e,align:r="center",children:n}){const i=r==="start"?"flex-1 min-w-0":"flex-1 flex justify-end items-center";return y.jsxs("div",{className:`glass-card border border-white/[0.07] rounded-2xl px-4 py-3.5 flex gap-4 ${r==="start"?"items-start":"items-center"}`,children:[y.jsxs("div",{className:"w-[140px] shrink-0",children:[y.jsx("span",{className:"text-[11px] font-mono text-zinc-400",children:t}),e&&y.jsxs("span",{className:"text-[10px] font-mono text-zinc-700 ml-1.5",children:["(",e,")"]})]}),y.jsx("div",{className:i,children:n})]})}function yq({onSave:t,onCancel:e,squads:r}){var x;const[n,i]=P.useState("io"),[a,o]=P.useState(((x=r[0])==null?void 0:x.id)??""),[c,u]=P.useState(""),[d,p]=P.useState(""),[f,g]=P.useState(""),v=()=>{!d.trim()||!f.trim()||!c.trim()||t({name:c.trim(),targetType:n==="io"?"orchestrator":"squad",targetId:n==="squad"?a:void 0,cron:d.trim(),prompt:f.trim()})};return y.jsx("div",{className:"fixed inset-0 z-40 flex items-center justify-center p-6",style:{background:"rgba(0,0,0,0.55)",backdropFilter:"blur(4px)"},children:y.jsxs("div",{className:"glass-card border border-white/[0.09] rounded-2xl w-full max-w-lg shadow-2xl flex flex-col",style:{maxHeight:"90vh"},children:[y.jsxs("div",{className:"flex items-center justify-between px-5 py-4 border-b border-white/[0.06] flex-shrink-0",children:[y.jsx("h3",{className:"text-lg tracking-wide text-zinc-100",style:{fontFamily:"'Bebas Neue', sans-serif"},children:"New Schedule"}),y.jsx("button",{type:"button",onClick:e,className:"p-1.5 rounded-lg text-zinc-600 hover:text-zinc-300 hover:bg-white/[0.06] transition-colors cursor-pointer",children:y.jsx(nP,{className:"w-4 h-4"})})]}),y.jsxs("div",{className:"overflow-y-auto flex-1 px-5 py-4 space-y-2",children:[y.jsx(qi,{label:"Name",children:y.jsx("input",{value:c,onChange:_=>u(_.target.value),placeholder:"Daily triage",className:`${Bs} w-48`})}),y.jsx(qi,{label:"Type",children:y.jsx("div",{className:"flex gap-2",children:["io","squad"].map(_=>y.jsx("button",{type:"button",onClick:()=>i(_),className:`px-4 py-1.5 rounded-xl text-[11px] font-mono capitalize transition-colors border cursor-pointer ${n===_?"text-[#E43A9C] border-[#E43A9C]/30":"text-zinc-500 border-white/[0.08] hover:text-zinc-300 hover:bg-white/[0.04]"}`,style:n===_?{background:"rgba(228,58,156,0.08)"}:void 0,children:_==="io"?"IO":"Squad"},_))})}),n==="squad"&&y.jsx(qi,{label:"Squad",children:y.jsx("select",{value:a,onChange:_=>o(_.target.value),className:`${Bs} w-48`,children:r.map(_=>y.jsx("option",{value:_.id,style:{background:"#1a1a1a",color:"#d4d4d8"},children:_.name},_.id))})}),y.jsx(qi,{label:"Cron Expression",children:y.jsx("input",{value:d,onChange:_=>p(_.target.value),placeholder:"0 9 * * 1-5",className:`${Bs} w-40`})}),y.jsx(qi,{label:"Prompt",hint:"supports Markdown",align:"start",children:y.jsx("textarea",{value:f,onChange:_=>g(_.target.value),placeholder:"Describe what IO or the squad should do when this schedule fires.",rows:8,className:`${yR} resize-none leading-relaxed`})})]}),y.jsxs("div",{className:"flex items-center justify-end gap-2 px-5 py-3.5 border-t border-white/[0.06] flex-shrink-0",children:[y.jsx(_i,{onClick:e,children:"Cancel"}),y.jsxs(za,{onClick:v,className:"px-4 py-1.5",children:[y.jsx(Bw,{className:"w-3 h-3"}),"Create Schedule"]})]})]})})}function vq({sched:t,squads:e,onSave:r,onBack:n}){var x,_;const[i,a]=P.useState(t.name),[o,c]=P.useState(t.cron),[u,d]=P.useState(t.prompt),[p,f]=P.useState(t.targetId??((x=e[0])==null?void 0:x.id)??""),g=()=>{!o.trim()||!u.trim()||!i.trim()||r({name:i.trim(),cron:o.trim(),prompt:u.trim(),targetId:t.targetType==="squad"?p:void 0})},v=t.targetType==="orchestrator"?"IO Schedule":`Squad — ${((_=e.find(b=>b.id===t.targetId))==null?void 0:_.name)??"Unknown"}`;return y.jsxs("div",{className:"flex-1 overflow-y-auto p-6 max-w-3xl",children:[y.jsxs("div",{className:"flex items-center gap-2 mb-6",children:[y.jsxs("button",{type:"button",onClick:n,className:"flex items-center gap-1.5 text-[11px] font-mono text-zinc-600 hover:text-zinc-300 transition-colors cursor-pointer",children:[y.jsx(vl,{className:"w-3.5 h-3.5"}),"Schedules"]}),y.jsx("span",{className:"text-zinc-700 text-[11px]",children:"/"}),y.jsx("span",{className:"text-[11px] font-mono text-zinc-400",children:"Edit"})]}),y.jsxs("div",{className:"flex items-start justify-between mb-6",children:[y.jsxs("div",{children:[y.jsx("h2",{className:"text-2xl tracking-wide text-zinc-100",style:{fontFamily:"'Bebas Neue', sans-serif"},children:"Edit Schedule"}),y.jsx("p",{className:"text-[11px] font-mono text-zinc-600 mt-0.5",children:v})]}),y.jsxs("div",{className:"flex items-center gap-2",children:[y.jsx(_i,{onClick:n,children:"Cancel"}),y.jsxs(za,{onClick:g,className:"px-4 py-1.5",children:[y.jsx(Bw,{className:"w-3 h-3"}),"Save Changes"]})]})]}),y.jsxs("div",{className:"space-y-3",children:[y.jsx(qi,{label:"Name",children:y.jsx("input",{value:i,onChange:b=>a(b.target.value),placeholder:"Schedule name",className:`${Bs} w-48`})}),t.targetType==="squad"&&y.jsx(qi,{label:"Squad",children:y.jsx("select",{value:p,onChange:b=>f(b.target.value),className:`${Bs} w-48`,children:e.map(b=>y.jsx("option",{value:b.id,style:{background:"#1a1a1a",color:"#d4d4d8"},children:b.name},b.id))})}),y.jsx(qi,{label:"Cron Expression",children:y.jsx("input",{value:o,onChange:b=>c(b.target.value),placeholder:"0 9 * * 1-5",className:`${Bs} w-40`})}),y.jsx(qi,{label:"Prompt",hint:"supports Markdown",align:"start",children:y.jsxs("div",{className:"space-y-1.5",children:[y.jsx("textarea",{value:u,onChange:b=>d(b.target.value),placeholder:"Describe what IO or the squad should do when this schedule fires.",className:`${yR} leading-relaxed resize-y`,style:{minHeight:"360px"}}),y.jsx("p",{className:"text-[10px] font-mono text-zinc-700",children:"Tip: use # headings and - lists to structure multi-step instructions."})]})})]})]})}function bq(){const[t,e]=P.useState("squad"),[r,n]=P.useState([]),[i,a]=P.useState([]),[o,c]=P.useState(!1),[u,d]=P.useState(null),p=qa();P.useEffect(()=>{f(),g()},[]);function f(){Ve.get("/schedules").then(R=>n(R.schedules)).catch(()=>{})}function g(){Ve.get("/squads").then(R=>a(R.squads)).catch(()=>{})}const v=r.filter(R=>R.targetType==="squad"),x=r.filter(R=>R.targetType==="orchestrator"),_=t==="squad"?v:x;async function b(R){try{await Ve.post("/schedules",R),at.success("Schedule created"),c(!1),f()}catch(M){at.error(M instanceof Error?M.message:"Failed to create")}}async function S(R){if(u)try{await Ve.patch(`/schedules/${u.id}`,R),at.success("Schedule saved"),d(null),f()}catch{at.error("Failed to save schedule")}}const[A,O]=P.useState(null);async function j(R,M){O(R);try{await Ve.patch(`/schedules/${R}`,{enabled:!M}),at.success(M?"Schedule paused":"Schedule resumed"),f()}catch{at.error("Failed to toggle schedule")}finally{O(null)}}async function E(R){O(R);try{await Ve.post(`/schedules/${R}/run`,{}),at.success("Schedule triggered")}catch{at.error("Failed to trigger schedule")}finally{O(null)}}async function T(R){O(R);try{await Ve.delete(`/schedules/${R}`),at.success("Schedule deleted"),f()}catch{at.error("Failed to delete")}finally{O(null)}}if(u)return y.jsx(vq,{sched:u,squads:i,onSave:S,onBack:()=>d(null)});const N=t==="squad"?["Squad","Name","Cron","Next Run","Status",""]:["Name","Cron","Next Run","Status",""];return y.jsxs("div",{className:"flex-1 overflow-y-auto p-6",children:[o&&y.jsx(yq,{onSave:b,onCancel:()=>c(!1),squads:i}),y.jsxs("div",{className:"flex items-center justify-between mb-5",children:[y.jsxs("div",{children:[y.jsx("h2",{className:"text-2xl tracking-wide text-zinc-100",style:{fontFamily:"'Bebas Neue', sans-serif"},children:"Schedules"}),y.jsxs("p",{className:"text-[11px] text-zinc-600 font-mono mt-0.5",children:[r.filter(R=>R.enabled).length," active · ",r.filter(R=>!R.enabled).length," paused"]})]}),y.jsxs(za,{onClick:()=>c(!0),className:"px-3 py-1.5",children:[y.jsx(zw,{className:"w-3.5 h-3.5"}),"Add Schedule"]})]}),y.jsx("div",{className:"flex gap-1 mb-4",children:[["squad","Squad Schedules"],["io","IO Schedules"]].map(([R,M])=>y.jsx("button",{type:"button",onClick:()=>e(R),className:`px-4 py-2 text-[11px] font-mono rounded-xl transition-colors cursor-pointer ${t===R?"text-[#E43A9C]":"text-zinc-600 hover:text-zinc-300 hover:bg-white/[0.04]"}`,style:t===R?{background:"rgba(228,58,156,0.12)"}:void 0,children:M},R))}),y.jsx("div",{className:"overflow-x-auto rounded-2xl border border-white/[0.07] glass-card",children:_.length===0?y.jsx("div",{className:"px-4 py-12 text-center text-zinc-600 font-mono text-sm",children:"No schedules for this category"}):y.jsxs("table",{className:"w-full text-[11px] font-mono min-w-[640px]",children:[y.jsx("thead",{children:y.jsx("tr",{className:"border-b border-white/[0.06]",style:{background:"rgba(20,20,20,0.6)"},children:N.map(R=>y.jsx("th",{className:"text-left px-4 py-2.5 text-zinc-600 font-medium",children:R},R))})}),y.jsx("tbody",{children:_.map(R=>{var M,J;return y.jsxs("tr",{className:`border-b border-white/[0.04] hover:bg-white/[0.015] transition-colors ${R.enabled?"":"opacity-50"}`,children:[t==="squad"?y.jsx("td",{className:"px-4 py-3",children:y.jsx(qB,{name:((M=i.find(F=>F.id===R.targetId))==null?void 0:M.name)??"Unknown",color:(J=i.find(F=>F.id===R.targetId))==null?void 0:J.color})}):null,y.jsx("td",{className:"px-4 py-3 text-zinc-300",children:R.name}),y.jsx("td",{className:"px-4 py-3 text-zinc-600 text-[10px]",children:R.cron}),y.jsx("td",{className:"px-4 py-3 text-zinc-600",children:y.jsxs("span",{className:"flex items-center gap-1",children:[y.jsx(Mw,{className:"w-3 h-3"}),R.enabled&&R.nextRun?Ws(R.nextRun,p):"—"]})}),y.jsx("td",{className:"px-4 py-3",children:y.jsx(jt,{variant:R.enabled?"success":"muted",children:R.enabled?"active":"paused"})}),y.jsx("td",{className:"px-4 py-3",children:y.jsxs("div",{className:`flex items-center gap-1 ${A===R.id?"opacity-50 pointer-events-none":""}`,children:[y.jsxs(_i,{onClick:()=>E(R.id),children:[y.jsx(j4,{className:"w-3 h-3"}),"Run now"]}),y.jsx(FB,{onClick:()=>j(R.id,R.enabled),children:R.enabled?y.jsxs(y.Fragment,{children:[y.jsx(k4,{className:"w-3 h-3"}),"Pause"]}):y.jsxs(y.Fragment,{children:[y.jsx(Ds,{className:"w-3 h-3"}),"Resume"]})}),y.jsxs(_i,{onClick:()=>d(R),children:[y.jsx(O4,{className:"w-3 h-3"}),"Edit"]}),y.jsxs(zf,{onClick:()=>T(R.id),children:[y.jsx(Ma,{className:"w-3 h-3"}),"Delete"]})]})})]},R.id)})})]})})]})}const xq=[{id:"general",label:"General"},{id:"telegram",label:"Telegram"},{id:"auth",label:"Auth"}],Uo="rounded-xl border border-white/[0.07] bg-white/[0.04] px-3 py-2 text-sm font-mono text-zinc-300 outline-none focus:border-[#E43A9C]/50",ME=`${Uo} w-[72px]`,wq=`${Uo} w-[100px]`,LE=`${Uo} w-[200px]`,DE=`${Uo} w-[320px]`,_q=`${Uo} w-[140px] appearance-none bg-[url('data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2212%22%20height%3D%2212%22%20viewBox%3D%220%200%2012%2012%22%3E%3Cpath%20fill%3D%22%2371717a%22%20d%3D%22M3%204.5L6%208l3-3.5H3z%22%2F%3E%3C%2Fsvg%3E')] bg-[position:right_10px_center] bg-no-repeat pr-8`;function Sq(){const[t,e]=P.useState(null),[r,n]=P.useState("general");P.useEffect(()=>{Ve.get("/config").then(o=>e(o.config)).catch(()=>{})},[]);function i(o){t&&e({...t,...o})}async function a(){if(t)try{const{dataDir:o,...c}=t;await Ve.patch("/config",c),at.success("Settings saved")}catch{at.error("Failed to save settings")}}return t?y.jsx("div",{className:"flex-1 overflow-y-auto p-6",children:y.jsxs("div",{className:"max-w-3xl",children:[y.jsx("h2",{className:"mb-6 text-2xl tracking-wide text-zinc-100",style:{fontFamily:"'Bebas Neue', sans-serif"},children:"Settings"}),y.jsx("div",{className:"mb-6 flex gap-6 border-b border-white/[0.07]",children:xq.map(o=>y.jsx("button",{type:"button",onClick:()=>n(o.id),className:`-mb-px border-b-2 px-1 pb-3 text-[11px] font-mono transition-colors ${r===o.id?"border-[#E43A9C] text-[#E43A9C]":"border-transparent text-zinc-500 hover:text-zinc-300"}`,children:o.label},o.id))}),y.jsxs("div",{className:"glass-card rounded-2xl border border-white/[0.07] p-5",children:[r==="general"&&y.jsxs(y.Fragment,{children:[y.jsx(_n,{label:"Log Level",children:y.jsx("select",{value:t.logLevel,onChange:o=>i({logLevel:o.target.value}),className:_q,children:["trace","debug","info","warn","error","fatal"].map(o=>y.jsx("option",{value:o,children:o},o))})}),y.jsx(_n,{label:"Default Model",children:y.jsx("input",{type:"text",value:t.defaultModel,onChange:o=>i({defaultModel:o.target.value}),className:LE})}),y.jsx(_n,{label:"Timezone",children:y.jsx("select",{value:t.timezone,onChange:o=>i({timezone:o.target.value}),className:`${Uo} w-[200px] appearance-none bg-[url('data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2212%22%20height%3D%2212%22%20viewBox%3D%220%200%2012%2012%22%3E%3Cpath%20fill%3D%22%2371717a%22%20d%3D%22M3%204.5L6%208l3-3.5H3z%22%2F%3E%3C%2Fsvg%3E')] bg-[position:right_10px_center] bg-no-repeat pr-8`,children:J4.map(o=>y.jsx("option",{value:o.value,children:o.label},o.value))})}),y.jsx(_n,{label:"Max Instances",children:y.jsx("input",{type:"number",value:t.maxInstancesPerSquad,onChange:o=>i({maxInstancesPerSquad:Number(o.target.value)}),className:ME,min:1,max:10})}),y.jsx(_n,{label:"API Port",children:y.jsx("input",{type:"number",value:t.apiPort,onChange:o=>i({apiPort:Number(o.target.value)}),className:ME})}),y.jsx(_n,{label:"Pricing Refresh (hrs)",children:y.jsx("input",{type:"number",value:t.pricing.refreshIntervalHours,onChange:o=>i({pricing:{refreshIntervalHours:Number(o.target.value)}}),className:wq,min:1})}),y.jsx(_n,{label:"Data Dir",children:y.jsx("input",{type:"text",value:t.dataDir,readOnly:!0,className:`${DE} cursor-default text-zinc-500`})})]}),r==="telegram"&&y.jsxs(y.Fragment,{children:[y.jsx(_n,{label:"Bot Token",children:y.jsx(Ig,{value:t.telegram.botToken??"",onChange:o=>i({telegram:{...t.telegram,botToken:o||null}}),size:"lg"})}),y.jsx(_n,{label:"Allowed Chat IDs",children:y.jsx("input",{type:"text",value:t.telegram.allowedChatIds.join(", "),onChange:o=>i({telegram:{...t.telegram,allowedChatIds:o.target.value.split(",").map(c=>Number(c.trim())).filter(c=>!Number.isNaN(c))}}),className:LE})})]}),r==="auth"&&y.jsxs(y.Fragment,{children:[y.jsx(_n,{label:"Project URL",children:y.jsx("input",{type:"text",value:t.supabase.projectUrl??"",onChange:o=>i({supabase:{...t.supabase,projectUrl:o.target.value||null}}),className:DE})}),y.jsx(_n,{label:"Anon Key",children:y.jsx(Ig,{value:t.supabase.anonKey??"",onChange:o=>i({supabase:{...t.supabase,anonKey:o||null}}),size:"lg"})}),y.jsx(_n,{label:"JWT Secret",children:y.jsx(Ig,{value:t.supabase.jwtSecret??"",onChange:o=>i({supabase:{...t.supabase,jwtSecret:o||null}}),size:"lg"})})]}),y.jsx("div",{className:"flex justify-end pt-6",children:y.jsx(za,{onClick:a,className:"px-4 py-2.5",children:"Save Settings"})})]})]})}):y.jsx("div",{className:"flex h-full items-center justify-center text-zinc-600",children:"Loading..."})}function _n({label:t,children:e}){return y.jsxs("div",{className:"flex items-center justify-between gap-6 border-b border-white/[0.07] py-3",children:[y.jsx("label",{className:"text-[11px] font-mono text-zinc-400 shrink-0",children:t}),y.jsx("div",{className:"flex justify-end",children:e})]})}function Ig({value:t,onChange:e,size:r="lg"}){const[n,i]=P.useState(!1),a=r==="lg"?"w-[320px]":"w-[200px]";return y.jsxs("div",{className:"relative",children:[y.jsx("input",{type:n?"text":"password",value:t,onChange:o=>e(o.target.value),className:`${Uo} ${a} pr-9`}),y.jsx("button",{type:"button",onClick:()=>i(o=>!o),className:"absolute right-2.5 top-1/2 -translate-y-1/2 text-zinc-600 transition-colors hover:text-zinc-400","aria-label":n?"Hide value":"Show value",children:n?y.jsx(t4,{size:14}):y.jsx(zb,{size:14})})]})}const kq=[{id:"installed",label:"Installed"},{id:"awesome-copilot",label:"Awesome Copilot"},{id:"skillssh",label:"skills.sh"}];function zE(t){return t==="awesome-copilot"?"Awesome Copilot":"skills.sh"}function BE(t){return t?t>=1e6?`${(t/1e6).toFixed(1).replace(/\.0$/,"")}M installs`:t>=1e3?`${(t/1e3).toFixed(1).replace(/\.0$/,"")}K installs`:`${t} installs`:null}function Eq(t){const e=t.match(/^---\s*\n([\s\S]*?)\n---\s*\n([\s\S]*)$/);if(!e)return{frontMatter:{},body:t};const r=e[1]??"",n=e[2]??"",i={};let a="",o=null;for(const c of r.split(`
434
434
  `)){const u=c.match(/^(\w[\w-]*)\s*:\s*(.*)$/);if(u){a&&o&&(i[a]=o,o=null),a=u[1]??"";const d=(u[2]??"").trim();d===""||d==="[]"?o=[]:d.startsWith("[")&&d.endsWith("]")?i[a]=d.slice(1,-1).split(",").map(p=>p.trim().replace(/^["']|["']$/g,"")):i[a]=d.replace(/^["']|["']$/g,"")}else c.match(/^\s+-\s+(.+)/)&&a&&(o||(o=[]),o.push(c.replace(/^\s+-\s+/,"").trim()))}return a&&o&&(i[a]=o),{frontMatter:i,body:n}}const UE=["name","description","version","author","license","argument_hint","argument-hint","use_when","use-when","enhancements","metadata","tags"];function Oq({content:t}){const{frontMatter:e,body:r}=Eq(t),n=UE.filter(o=>e[o]!==void 0),i=Object.keys(e).filter(o=>!UE.includes(o)),a=[...n,...i];return y.jsxs("div",{children:[a.length>0&&y.jsxs("div",{className:"border-b border-white/[0.05] pb-4 mb-4",children:[y.jsx("p",{className:"text-[10px] font-mono text-zinc-700 uppercase tracking-wider mb-3",children:"Front Matter"}),y.jsx("div",{className:"space-y-2",children:a.map(o=>{const c=e[o];return c==null||Array.isArray(c)&&c.length===0?null:y.jsxs("div",{className:"flex gap-3 items-start",children:[y.jsx("span",{className:"text-[10px] font-mono text-zinc-600 w-28 flex-shrink-0 pt-0.5",children:o}),y.jsx("div",{className:"flex-1 min-w-0",children:Array.isArray(c)?y.jsx("div",{className:"flex flex-wrap gap-1",children:c.map((u,d)=>y.jsx(jt,{variant:"muted",children:u},d))}):typeof c=="object"?y.jsx("div",{className:"space-y-0.5",children:Object.entries(c).map(([u,d])=>y.jsxs("p",{className:"text-[11px] font-mono text-zinc-400",children:[y.jsxs("span",{className:"text-zinc-600",children:[u,":"]})," ",d]},u))}):o==="use_when"||o==="use-when"?y.jsx("p",{className:"text-[11px] text-zinc-300 leading-relaxed",children:c}):o==="argument_hint"||o==="argument-hint"?y.jsx("code",{className:"text-[11px] font-mono text-[#E43A9C] bg-[#2d1a24] px-1.5 py-0.5 rounded",children:c}):y.jsx("span",{className:"text-[11px] font-mono text-zinc-300",children:c})})]},o)})})]}),r.trim()&&y.jsxs("div",{children:[y.jsx("p",{className:"text-[10px] font-mono text-zinc-700 uppercase tracking-wider mb-3",children:"Body"}),y.jsx(sp,{content:r})]})]})}function Aq(){const[t,e]=P.useState("installed"),[r,n]=P.useState([]),[i,a]=P.useState([]),[o,c]=P.useState(null);function u($){return"url"in $&&$.url?$.url:$.name}const[d,p]=P.useState(null),[f,g]=P.useState(""),[v,x]=P.useState(!1),[_,b]=P.useState(!1),[S,A]=P.useState(!1),[O,j]=P.useState(""),[E,T]=P.useState(null),[N,R]=P.useState(null),M=P.useCallback(async()=>{try{const $=await Ve.get("/skills"),V=new Set($.skills.map(oe=>oe.name.toLowerCase()));n($.skills),a(oe=>oe.map(le=>({...le,installed:V.has(le.name.toLowerCase())})))}catch($){at.error($ instanceof Error?$.message:"Failed to load skills")}},[]),J=P.useCallback(async $=>{b(!0);try{const V=await Ve.get(`/skills/${encodeURIComponent($)}`);p(V),j(V.content)}catch(V){at.error(V instanceof Error?V.message:"Failed to load skill"),p(null)}finally{b(!1)}},[]);P.useEffect(()=>{M()},[M]),P.useEffect(()=>{if(t==="installed"){R(null);return}const $=f.trim();if(t==="skillssh"&&!$){a([]),R(null),x(!1);return}let V=!1;x(!0);const oe=window.setTimeout(async()=>{try{const le=await Ve.get(`/skills/discover?source=${t}&q=${encodeURIComponent($)}`);if(V)return;a(le.skills),R(null)}catch(le){if(V)return;a([]),R(le instanceof Error?le.message:"Discovery failed")}finally{V||x(!1)}},250);return()=>{V=!0,window.clearTimeout(oe)}},[f,t]);const F=P.useMemo(()=>{const $=f.trim().toLowerCase();return $?r.filter(V=>[V.name,V.description,V.preview].some(oe=>oe.toLowerCase().includes($))):r},[r,f]),B=t==="installed"?F:i,K=F.find($=>$.name===o)??null,W=i.find($=>u($)===o)??null,X=(K==null?void 0:K.name)??(W==null?void 0:W.name)??null;P.useEffect(()=>{if(A(!1),!B.length){c(null),t!=="installed"&&p(null);return}if(!o||!B.some($=>u($)===o)){const $=B[0];$&&c(u($))}},[o,t,B]),P.useEffect(()=>{if(t!=="installed"||!X){p(null);return}J(X)},[J,X,t]);async function Y($){if(!$.url&&!$.registrySource){at.error("Install source is not available for this skill yet");return}T($.name);try{await Ve.post("/skills/install",{name:$.name,source:$.source,url:$.url,registrySource:$.registrySource,skillId:$.skillId}),at.success(`Installed ${$.title||$.name}`),await M(),a(V=>V.map(oe=>oe.name===$.name?{...oe,installed:!0}:oe))}catch(V){at.error(V instanceof Error?V.message:"Install failed")}finally{T(null)}}async function te($){T($);try{await Ve.delete(`/skills/${encodeURIComponent($)}`),at.success(`Removed ${$}`),await M(),a(V=>V.map(oe=>oe.name===$?{...oe,installed:!1}:oe))}catch(V){at.error(V instanceof Error?V.message:"Failed to remove skill")}finally{T(null)}}async function H(){if(d){T(d.name);try{await Ve.put(`/skills/${encodeURIComponent(d.name)}`,{content:O}),at.success(`Updated ${d.name}`),A(!1),await Promise.all([M(),J(d.name)])}catch($){at.error($ instanceof Error?$.message:"Failed to save skill")}finally{T(null)}}}const Q=!!(K!=null&&K.activatedForOrchestrator),U=E===(d==null?void 0:d.name),I=E===(W==null?void 0:W.name);return y.jsxs("div",{className:"flex flex-1 min-h-0 overflow-hidden",children:[y.jsxs("div",{className:"w-64 flex-shrink-0 border-r border-white/[0.06] flex flex-col overflow-hidden",children:[y.jsxs("div",{className:"px-2.5 pt-2.5 pb-2 flex-shrink-0 border-b border-white/[0.06] space-y-2",children:[y.jsxs("div",{className:"relative",children:[y.jsx(eP,{className:"pointer-events-none absolute left-2.5 top-1/2 h-3 w-3 -translate-y-1/2 text-zinc-700"}),y.jsx("input",{type:"text",value:f,onChange:$=>g($.target.value),placeholder:"Search skills…",className:"w-full bg-[#181818] border border-white/[0.06] rounded-xl pl-7 pr-2 py-1.5 text-[11px] text-zinc-300 font-mono placeholder:text-zinc-700 focus:outline-none focus:border-[#E43A9C]/30 transition-colors"})]}),y.jsx("div",{className:"flex flex-col gap-0.5",children:kq.map($=>y.jsxs("button",{type:"button",onClick:()=>e($.id),className:`w-full text-left px-2.5 py-1.5 rounded-lg text-[11px] font-mono transition-colors flex items-center justify-between cursor-pointer ${t===$.id?"text-[#E43A9C]":"text-zinc-500 hover:text-zinc-300 hover:bg-white/[0.04]"}`,style:t===$.id?{background:"rgba(228,58,156,0.10)"}:void 0,children:[y.jsx("span",{children:$.label}),$.id==="installed"&&y.jsx("span",{className:"text-[10px] text-zinc-600",children:r.length})]},$.id))})]}),y.jsxs("div",{className:"flex-1 overflow-y-auto py-1.5",children:[v&&t!=="installed"?y.jsxs("div",{className:"flex items-center gap-2 rounded-2xl border border-white/[0.08] bg-white/[0.03] px-3 py-3 font-mono text-[11px] text-zinc-500",children:[y.jsx(js,{className:"h-3.5 w-3.5 animate-spin"})," Searching registry..."]}):null,B.map($=>{const V=u($),oe=o===V,le=$.description||("preview"in $?$.preview:"No description available.");return y.jsxs("button",{type:"button",onClick:()=>{A(!1),c(V)},className:`w-full text-left px-3 py-2.5 border-b border-white/[0.03] transition-colors cursor-pointer ${oe?"border-l-2 border-l-[#E43A9C] bg-[#E43A9C]/5":"hover:bg-white/[0.03]"}`,children:[y.jsxs("div",{className:"flex items-center gap-2 mb-0.5",children:[y.jsx("span",{className:"truncate font-mono text-[11px] text-zinc-200",children:$.name}),"installed"in $&&$.installed?y.jsx(jt,{variant:"success",children:"installed"}):null]}),y.jsx("p",{className:"line-clamp-2 font-mono text-[10px] leading-relaxed text-zinc-600",children:le})]},`${t}:${V}`)}),!v&&B.length===0?y.jsx("div",{className:"px-4 py-8",children:y.jsx("p",{className:"font-mono text-[11px] leading-relaxed text-zinc-500",children:N||(t==="skillssh"&&!f.trim()?"Start typing to search the skills.sh registry.":f.trim()?"No skills match your search.":"No skills available in this source.")})}):null]})]}),y.jsx("div",{className:"flex min-h-0 flex-1 flex-col overflow-y-auto p-5",children:t==="installed"&&K?y.jsxs(y.Fragment,{children:[y.jsxs("div",{className:"mb-5 flex items-start justify-between gap-4 border-b border-white/[0.06] pb-5",children:[y.jsxs("div",{className:"flex min-w-0 gap-4",children:[y.jsx("div",{className:"flex h-14 w-14 shrink-0 items-center justify-center rounded-2xl bg-[#E43A9C]/12 text-[#E43A9C]",children:y.jsx(qb,{className:"h-6 w-6"})}),y.jsxs("div",{className:"min-w-0",children:[y.jsx("h3",{className:"truncate text-[34px] uppercase tracking-[0.08em] text-zinc-100",style:{fontFamily:"'Bebas Neue', sans-serif"},children:K.name}),y.jsxs("div",{className:"mt-2 flex flex-wrap items-center gap-2",children:[y.jsx(jt,{variant:"success",children:"installed"}),Q?y.jsx(jt,{variant:"warning",children:"active"}):y.jsx(jt,{variant:"muted",children:"inactive"}),y.jsx(jt,{variant:"muted",children:"local skill"})]}),y.jsxs("div",{className:"mt-3 space-y-1 font-mono text-[11px] text-zinc-500",children:[y.jsxs("p",{children:["path: ",K.filePath]}),y.jsxs("p",{children:["orchestrator: ",Q?"enabled":"disabled"]})]})]})]}),y.jsxs("div",{className:"flex items-center gap-2",children:[S?y.jsxs(za,{onClick:H,disabled:U||O===(d==null?void 0:d.content),className:"px-3 py-2",children:[U?y.jsx(js,{className:"h-3.5 w-3.5 animate-spin"}):y.jsx(Ub,{className:"h-3.5 w-3.5"}),"Save"]}):y.jsxs(_i,{onClick:()=>A(!0),className:"px-3 py-2",children:[y.jsx(Ub,{className:"h-3.5 w-3.5"})," Edit"]}),y.jsxs(zf,{onClick:()=>te(K.name),className:"px-3 py-2",children:[U?y.jsx(js,{className:"h-3.5 w-3.5 animate-spin"}):y.jsx(Ma,{className:"h-3.5 w-3.5"}),"Remove"]})]})]}),y.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto pr-1",children:_&&!d?y.jsxs("div",{className:"flex items-center gap-2 font-mono text-[11px] text-zinc-500",children:[y.jsx(js,{className:"h-3.5 w-3.5 animate-spin"})," Loading skill..."]}):S?y.jsxs("div",{className:"space-y-3",children:[y.jsx("textarea",{value:O,onChange:$=>j($.target.value),className:"min-h-[440px] w-full rounded-2xl border border-white/[0.08] bg-black/30 p-4 font-mono text-[12px] leading-6 text-zinc-200 outline-none transition-colors focus:border-[#E43A9C]/50"}),y.jsxs("div",{className:"flex items-center justify-between font-mono text-[11px] text-zinc-500",children:[y.jsx("span",{children:"Editing raw SKILL.md"}),y.jsx(_i,{onClick:()=>{A(!1),j((d==null?void 0:d.content)??"")},className:"px-3 py-2",children:"Cancel"})]})]}):d?y.jsx(Oq,{content:d.content}):y.jsx("p",{className:"font-mono text-[11px] text-zinc-500",children:"Select an installed skill to inspect it."})})]}):t!=="installed"&&W?y.jsxs(y.Fragment,{children:[y.jsxs("div",{className:"mb-5 flex items-start justify-between gap-4 border-b border-white/[0.06] pb-5",children:[y.jsxs("div",{className:"flex min-w-0 gap-4",children:[y.jsx("div",{className:"flex h-14 w-14 shrink-0 items-center justify-center rounded-2xl bg-[#E43A9C]/12 text-[#E43A9C]",children:y.jsx(z4,{className:"h-6 w-6"})}),y.jsxs("div",{className:"min-w-0",children:[y.jsx("h3",{className:"truncate text-[34px] uppercase tracking-[0.08em] text-zinc-100",style:{fontFamily:"'Bebas Neue', sans-serif"},children:W.title||W.name}),y.jsxs("div",{className:"mt-2 flex flex-wrap items-center gap-2",children:[y.jsx(jt,{variant:W.installed?"success":"default",children:W.installed?"installed":"available"}),y.jsx(jt,{variant:"muted",children:zE(W.source)}),BE(W.installs)?y.jsx(jt,{variant:"info",children:BE(W.installs)}):null]}),y.jsxs("div",{className:"mt-3 space-y-1 font-mono text-[11px] text-zinc-500",children:[y.jsxs("p",{children:["registry: ",zE(W.source)]}),W.registrySource?y.jsxs("p",{children:["source: ",W.registrySource]}):null,W.url?y.jsxs("p",{children:["url: ",W.url]}):null]})]})]}),y.jsx("div",{className:"flex items-center gap-2",children:W.installed?y.jsx(_i,{onClick:()=>{e("installed"),c(W.name)},className:"px-3 py-2",children:"Open installed"}):y.jsxs(za,{onClick:()=>Y(W),disabled:I||!W.url&&!W.registrySource,className:"px-3 py-2",children:[I?y.jsx(js,{className:"h-3.5 w-3.5 animate-spin"}):y.jsx(Z5,{className:"h-3.5 w-3.5"}),"Install"]})})]}),y.jsxs("div",{className:"min-h-0 flex-1 overflow-y-auto pr-1",children:[y.jsx("div",{className:"rounded-2xl border border-white/[0.06] bg-white/[0.02] p-5",children:y.jsx("p",{className:"font-mono text-[12px] leading-7 text-zinc-300",children:W.description||"No registry description is available for this skill yet."})}),y.jsx("div",{className:"mt-4 rounded-2xl border border-dashed border-white/[0.08] bg-black/20 p-4 font-mono text-[11px] leading-6 text-zinc-500",children:"Install will fetch the skill definition from the selected registry source and add it to your local skills library."})]})]}):y.jsx("div",{className:"flex h-full items-center justify-center rounded-2xl border border-dashed border-white/[0.08] bg-white/[0.02] p-8 text-center",children:y.jsxs("div",{children:[y.jsx("div",{className:"mx-auto mb-4 flex h-14 w-14 items-center justify-center rounded-2xl bg-[#E43A9C]/12 text-[#E43A9C]",children:y.jsx(qb,{className:"h-6 w-6"})}),y.jsx("h3",{className:"text-[28px] uppercase tracking-[0.08em] text-zinc-100",style:{fontFamily:"'Bebas Neue', sans-serif"},children:"Select a Skill"}),y.jsx("p",{className:"mt-2 font-mono text-[11px] leading-relaxed text-zinc-500",children:"Choose a skill from the left panel to inspect details, install registry entries, or edit local definitions."})]})})})]})}function Tq(t){let e=0;for(let n=0;n<t.length;n++)e=t.charCodeAt(n)+((e<<5)-e);return`hsl(${(e%360+360)%360}, 70%, 65%)`}function $g(){const{name:t,instanceId:e}=eD();return t&&e?y.jsx(Rq,{squadName:t,instanceId:e}):t?y.jsx(Nq,{name:t}):y.jsx(jq,{})}function jq(){const[t,e]=P.useState([]),[r,n]=P.useState(null),i=Nu();return P.useEffect(()=>{Promise.all([Ve.get("/squads"),Ve.get("/config")]).then(([a,o])=>{e(a.squads),n(o.config.maxInstancesPerSquad)}).catch(()=>{})},[]),y.jsxs("div",{className:"flex-1 overflow-y-auto p-6",children:[y.jsx("div",{className:"mb-6",children:y.jsxs("div",{children:[y.jsx("h2",{className:"text-2xl tracking-wide text-zinc-100",style:{fontFamily:"'Bebas Neue', sans-serif"},children:"Squads"}),y.jsxs("p",{className:"text-[11px] text-zinc-600 font-mono mt-0.5",children:[t.length," squads · ",t.reduce((a,o)=>a+(o.activeInstances||0),0)," ","active instances"]})]})}),y.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 xl:grid-cols-3 gap-3",children:[t.map(a=>{const o=a.color||"#38bdf8";return y.jsxs("button",{type:"button",onClick:()=>i(`/squads/${a.name}`),className:"text-left rounded-2xl p-5 transition-all group cursor-pointer",style:{border:`1px solid ${o}30`,background:`${o}08`,backdropFilter:"blur(20px)"},onMouseEnter:c=>{c.currentTarget.style.borderColor=`${o}70`,c.currentTarget.style.background=`${o}12`},onMouseLeave:c=>{c.currentTarget.style.borderColor=`${o}30`,c.currentTarget.style.background=`${o}08`},children:[y.jsxs("div",{className:"flex items-start justify-between mb-1",children:[y.jsx("h3",{className:"text-sm font-mono transition-colors",style:{color:o},children:a.name}),y.jsx(jt,{variant:Co(a.status),children:a.status})]}),y.jsxs("div",{className:"flex items-center justify-between mb-3",children:[y.jsx("p",{className:"text-[11px] text-zinc-600 font-mono",children:a.universe}),y.jsxs("span",{className:"text-[11px] text-zinc-600 font-mono flex items-center gap-1",children:[y.jsx(X5,{className:"w-3 h-3"}),a.activeInstances,"/",r??(a.totalInstances||a.memberCount)]})]}),a.repoUrl&&y.jsxs("div",{className:"flex items-center gap-1.5 text-[11px] text-zinc-700 font-mono mb-4",children:[y.jsx(YN,{className:"w-3 h-3 flex-shrink-0"}),y.jsx("span",{className:"truncate",children:a.repoUrl.replace("https://github.com/","")})]}),a.recentActivity&&a.recentActivity.length>0&&y.jsxs("div",{className:"border-t pt-3",style:{borderColor:`${o}15`},children:[y.jsx("p",{className:"text-[10px] font-mono uppercase tracking-wider mb-2",style:{color:`${o}80`},children:"Recent Work"}),y.jsx("ul",{className:"space-y-1.5",children:a.recentActivity.map(c=>{const u={className:"w-3.5 h-3.5 flex-shrink-0 mt-px"},d=Cq(c.status,u),p=c.objective?c.objective.length>60?`${c.objective.slice(0,60)}…`:c.objective:c.issueRef||"Instance";return y.jsxs("li",{className:"flex items-start gap-1.5 text-[11px] font-mono text-zinc-600",children:[d,y.jsx("span",{className:"truncate",children:p})]},c.id)})})]})]},a.id)}),t.length===0&&y.jsxs("div",{className:"col-span-full text-center py-12 text-zinc-600",children:[y.jsx(Zh,{size:48,className:"mx-auto mb-3 opacity-30"}),y.jsx("p",{className:"text-[11px] font-mono",children:"No squads hired yet. Ask IO to hire a squad for a project."})]})]})]})}function Cq(t,e){const r=t.toLowerCase();return r.includes("complete")||r.includes("success")||r.includes("done")?y.jsx(VN,{...e,style:{color:"#34d399"}}):r.includes("warning")||r.includes("review")?y.jsx(H4,{...e,style:{color:"#fbbf24"}}):r.includes("error")||r.includes("fail")?y.jsx(XN,{...e,style:{color:"#f87171"}}):r.includes("working")||r.includes("progress")||r.includes("running")?y.jsx(ZN,{...e,style:{color:"#E43A9C"}}):y.jsx(p4,{...e,style:{color:"#60a5fa"}})}function Kf(t,e){const r="w-4 h-4",n={color:e},i=t.toLowerCase();return i.includes("lead")||i.includes("pm")||i.includes("technical")?y.jsx(Lw,{className:r,style:n}):i.includes("qa")||i.includes("test")?y.jsx(M5,{className:r,style:n}):i.includes("scribe")?y.jsx(R4,{className:r,style:n}):y.jsx(Uc,{className:r,style:n})}function Nq({name:t}){const[e,r]=P.useState(null),[n,i]=P.useState("agents"),[a,o]=P.useState([]),[c,u]=P.useState(0),[d,p]=P.useState(null),[f,g]=P.useState([]),v=Nu(),x=qa();P.useEffect(()=>{Ve.get(`/squads/${t}`).then(r).catch(()=>{})},[t]),P.useEffect(()=>{n==="history"&&Ve.get(`/squads/${t}/history`).then(S=>{o(S.items),u(S.total)}).catch(()=>{}),n==="schedules"&&e&&Ve.get(`/schedules?targetId=${e.squad.id}`).then(S=>g(S.schedules)).catch(()=>{})},[n,t,e]);const _=S=>{Ve.get(`/squads/${t}/history/${S.id}`).then(p).catch(()=>at.error("Failed to load activity detail"))};if(!e)return y.jsx("div",{className:"h-full flex items-center justify-center text-zinc-600",children:"Loading..."});const b=e.squad.color||"#38bdf8";return d?y.jsx(Pq,{activity:d,squadColor:b,squadName:e.squad.name,onBack:()=>p(null)}):y.jsxs("div",{className:"flex-1 overflow-y-auto p-6",style:{background:`${b}06`},children:[y.jsxs("button",{type:"button",onClick:()=>v("/squads"),className:"flex items-center gap-1.5 text-[11px] text-zinc-600 hover:text-zinc-300 font-mono mb-5 transition-colors",children:[y.jsx(vl,{className:"w-3.5 h-3.5"})," All Squads"]}),y.jsxs("div",{className:"flex items-start justify-between mb-5",children:[y.jsxs("div",{children:[y.jsx("h2",{className:"text-3xl tracking-wide",style:{fontFamily:"'Bebas Neue', sans-serif",color:b},children:e.squad.name}),y.jsxs("p",{className:"text-[11px] text-zinc-600 font-mono",children:[e.squad.universe," · ",e.squad.autonomyTier||"standard"," autonomy"]}),e.squad.repoUrl&&y.jsxs("a",{href:e.squad.repoUrl,target:"_blank",rel:"noreferrer",className:"text-[11px] font-mono text-[#E43A9C] hover:text-[#F041FF] flex items-center gap-1 mt-1 transition-colors",children:[y.jsx(YN,{className:"w-3 h-3"}),e.squad.repoUrl.replace("https://github.com/","")]})]}),y.jsx(jt,{variant:Co(e.squad.status),children:e.squad.status})]}),y.jsx("div",{className:"flex gap-0 mb-5 border-b border-white/[0.06]",children:["agents","instances","schedules","history"].map(S=>y.jsx("button",{type:"button",onClick:()=>i(S),className:`px-4 py-2 text-[11px] font-mono capitalize transition-colors border-b-2 -mb-px ${n===S?"text-[#E43A9C] border-[#E43A9C]":"text-zinc-600 hover:text-zinc-300 border-transparent"}`,children:S},S))}),n==="agents"&&y.jsx("div",{className:"space-y-2",children:e.members.map(S=>y.jsxs("div",{className:"glass-card border border-white/[0.07] rounded-2xl p-4 flex items-center gap-3",children:[y.jsx("div",{className:"w-8 h-8 rounded-xl flex items-center justify-center flex-shrink-0",style:{border:`1px solid ${b}30`,background:`${b}12`},children:Kf(S.roleName||S.role,b)}),y.jsxs("div",{className:"flex-1 min-w-0",children:[y.jsxs("div",{className:"flex items-center gap-2",children:[y.jsx("span",{className:"text-sm font-mono text-zinc-200",children:S.displayName}),y.jsx(jt,{variant:Co(S.status),children:S.status})]}),y.jsx("p",{className:"text-[11px] text-zinc-600 font-mono mt-0.5",children:S.role}),S.currentTask&&y.jsx("p",{className:"text-xs text-zinc-500 mt-1 truncate",children:S.currentTask})]})]},S.id))}),n==="instances"&&y.jsx("div",{className:"space-y-2",children:e.instances.length===0?y.jsx("div",{className:"text-center py-16 text-zinc-700 font-mono text-sm",children:"No active instances"}):e.instances.map(S=>y.jsxs("div",{className:"glass-card border border-white/[0.07] rounded-2xl p-4 flex items-center gap-4",children:[y.jsxs("div",{className:"flex-1 grid grid-cols-2 gap-2 text-[11px] font-mono",children:[y.jsxs("div",{children:[y.jsx("span",{className:"text-zinc-700",children:"ID"}),y.jsx("p",{className:"text-zinc-300 mt-0.5 truncate",children:S.id.slice(0,8)})]}),y.jsxs("div",{children:[y.jsx("span",{className:"text-zinc-700",children:"Branch"}),y.jsx("p",{className:"text-zinc-300 mt-0.5 truncate",children:S.branch||"—"})]}),y.jsxs("div",{children:[y.jsx("span",{className:"text-zinc-700",children:"Status"}),y.jsx("p",{className:"text-zinc-300 mt-0.5",children:y.jsx(jt,{variant:Co(S.status),children:S.status})})]}),y.jsxs("div",{children:[y.jsx("span",{className:"text-zinc-700",children:"Tasks"}),y.jsxs("p",{className:"text-zinc-300 mt-0.5",children:[S.tasksComplete,"/",S.taskCount]})]})]}),y.jsxs("div",{className:"flex items-center gap-1 flex-shrink-0",children:[y.jsx("button",{type:"button",onClick:()=>v(`/squads/${t}/instances/${S.id}`),title:"View instance agents",className:"p-2 rounded-xl hover:bg-white/[0.06] transition-colors cursor-pointer",style:{color:b},children:y.jsx(Ds,{className:"w-4 h-4"})}),y.jsx("button",{type:"button",onClick:()=>at.info("Stop not yet implemented"),title:"Stop instance",className:"p-2 rounded-xl hover:bg-red-500/10 text-zinc-600 hover:text-red-400 transition-colors cursor-pointer",children:y.jsx(Jh,{className:"w-4 h-4"})})]})]},S.id))}),n==="schedules"&&y.jsx("div",{className:"overflow-auto rounded-2xl border border-white/[0.07] glass-card",children:f.length===0?y.jsx("div",{className:"text-center py-16 text-zinc-700 font-mono text-sm",children:"No schedules for this squad"}):y.jsxs("table",{className:"w-full text-[11px] font-mono",children:[y.jsx("thead",{children:y.jsx("tr",{className:"border-b border-white/[0.06]",style:{background:"rgba(20,20,20,0.6)"},children:["Schedule","Next Run","Status"].map(S=>y.jsx("th",{className:"text-left px-4 py-2.5 text-zinc-600 font-medium",children:S},S))})}),y.jsx("tbody",{children:f.map(S=>y.jsxs("tr",{className:`border-b border-white/[0.04] hover:bg-white/[0.015] transition-colors ${S.enabled?"":"opacity-50"}`,children:[y.jsxs("td",{className:"px-4 py-3",children:[y.jsx("div",{className:"text-zinc-300",children:S.name||S.prompt}),y.jsx("div",{className:"text-zinc-700 text-[10px] mt-0.5",children:S.cron})]}),y.jsx("td",{className:"px-4 py-3 text-zinc-600",children:y.jsxs("span",{className:"flex items-center gap-1",children:[y.jsx(Mw,{className:"w-3 h-3"}),S.enabled&&S.nextRun?Ws(S.nextRun,x):"—"]})}),y.jsx("td",{className:"px-4 py-3",children:y.jsx(jt,{variant:S.enabled?"success":"muted",children:S.enabled?"active":"paused"})})]},S.id))})]})}),n==="history"&&y.jsxs("div",{className:"space-y-2",children:[a.length===0?y.jsx("div",{className:"text-center py-16 text-zinc-700 font-mono text-sm",children:"No history yet"}):a.map(S=>y.jsxs("div",{className:"glass-card border border-white/[0.07] rounded-2xl px-4 py-3.5 flex items-center gap-3",children:[y.jsx("div",{className:"flex-shrink-0",children:S.status==="completed"?y.jsx(VN,{className:"w-4 h-4",style:{color:"#34d399"}}):y.jsx(XN,{className:"w-4 h-4",style:{color:"#f87171"}})}),y.jsxs("div",{className:"flex-1 min-w-0",children:[y.jsx("p",{className:"text-[12px] text-zinc-300 font-mono truncate",children:S.title}),y.jsxs("div",{className:"flex items-center gap-3 mt-0.5",children:[y.jsx("span",{className:"text-[10px] text-zinc-700 font-mono",children:Ws(S.completedAt||S.createdAt,x)}),y.jsxs("span",{className:"text-[10px] text-zinc-700 font-mono flex items-center gap-1",children:[y.jsx(Ds,{className:"w-2.5 h-2.5"}),S.duration||"—"]}),y.jsxs("span",{className:"text-[10px] text-zinc-700 font-mono flex items-center gap-1",children:[y.jsx(Uc,{className:"w-2.5 h-2.5"}),S.agentCount," agent",S.agentCount!==1?"s":""]})]})]}),y.jsx(jt,{variant:S.status==="completed"?"success":"error",children:S.status}),y.jsx("button",{type:"button",onClick:()=>_(S),title:"View activity detail",className:"p-2 rounded-xl hover:bg-white/[0.06] transition-colors flex-shrink-0 cursor-pointer",style:{color:b},children:y.jsx(Ds,{className:"w-4 h-4"})})]},S.id)),a.length<c&&y.jsx("button",{type:"button",onClick:()=>{Ve.get(`/squads/${t}/history?offset=${a.length}`).then(S=>{o(A=>[...A,...S.items])}).catch(()=>{})},className:"w-full text-center py-3 text-[11px] font-mono text-zinc-600 hover:text-zinc-300 transition-colors cursor-pointer",children:"Load more"})]})]})}function Pq({activity:t,squadColor:e,squadName:r,onBack:n}){const i=qa(),a=P.useMemo(()=>{const p={};for(const f of t.agentEntries)p[f.agentId]=Tq(f.agentName);return p},[t]),o={thought:{label:"Thinking",icon:Dw},tool_call:{label:"Tool Call",icon:rP},tool_result:{label:"Tool Result",icon:JN},message:{label:"Message",icon:Uc},decision:{label:"Decision",icon:Lw}},c={label:"Message",icon:Uc},u=p=>o[p]??c,d=P.useMemo(()=>{const p=t.agentEntries.flatMap(f=>f.events.map(g=>({ev:g,entry:f})));return p.sort((f,g)=>f.ev.timestamp.localeCompare(g.ev.timestamp)),p},[t]);return y.jsxs("div",{className:"flex-1 overflow-y-auto p-6",style:{background:`${e}06`},children:[y.jsxs("button",{type:"button",onClick:n,className:"flex items-center gap-1.5 text-[11px] text-zinc-600 hover:text-zinc-300 font-mono mb-5 transition-colors cursor-pointer",children:[y.jsx(vl,{className:"w-3.5 h-3.5"})," Back to ",r]}),y.jsxs("div",{className:"flex items-start justify-between mb-5",children:[y.jsxs("div",{children:[y.jsx("h2",{className:"text-2xl tracking-wide",style:{fontFamily:"'Bebas Neue', sans-serif",color:e},children:t.title}),y.jsxs("div",{className:"flex items-center gap-3 mt-1",children:[y.jsx("span",{className:"text-[11px] text-zinc-600 font-mono",children:Ws(t.completedAt||t.createdAt,i)}),y.jsxs("span",{className:"text-[11px] text-zinc-700 font-mono flex items-center gap-1",children:[y.jsx(Mw,{className:"w-3 h-3"}),t.duration||"—"]})]})]}),y.jsx(jt,{variant:t.status==="completed"?"success":"error",children:t.status})]}),y.jsx("div",{className:"flex flex-wrap gap-2 mb-6",children:t.agentEntries.map(p=>{const f=a[p.agentId];return y.jsxs("div",{className:"flex items-center gap-1.5 px-2.5 py-1.5 rounded-xl border",style:{borderColor:`${f}30`,background:`${f}10`},children:[Kf(p.roleType||p.role,f),y.jsx("span",{className:"text-[11px] font-mono",style:{color:f},children:p.agentName}),y.jsxs("span",{className:"text-[10px] font-mono text-zinc-500",children:["— ",p.role]})]},p.agentId)})}),y.jsxs("div",{className:"relative pl-10",children:[y.jsx("div",{className:"absolute left-[15px] top-0 bottom-0 w-px bg-white/[0.06]"}),y.jsx("div",{className:"space-y-3",children:d.map(({ev:p,entry:f})=>{const g=a[f.agentId],{label:v,icon:x}=u(p.kind),_=p.kind==="tool_call"||p.kind==="tool_result";return y.jsxs("div",{className:"relative",children:[y.jsx("div",{className:"absolute -left-10 top-3 w-[30px] h-[30px] rounded-full flex items-center justify-center",style:{background:`${g}15`,border:`1px solid ${g}35`},children:y.jsx(x,{className:"w-3.5 h-3.5",style:{color:g}})}),y.jsxs("div",{className:"glass-card border border-white/[0.07] rounded-2xl px-4 py-3",children:[y.jsxs("div",{className:"flex items-center justify-between mb-1.5",children:[y.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[y.jsxs("div",{className:"flex items-center gap-1",children:[Kf(f.roleType||f.role,g),y.jsx("span",{className:"text-[10px] font-mono",style:{color:g},children:f.agentName})]}),y.jsx("span",{className:"text-zinc-700 text-[10px]",children:"·"}),y.jsx("span",{className:"text-[10px] font-mono uppercase tracking-wider text-zinc-500",children:v}),p.label&&y.jsx("span",{className:"text-[10px] font-mono text-zinc-600 border border-white/[0.08] rounded px-1.5 py-px bg-white/[0.03]",children:p.label}),p.status==="error"&&y.jsx(jt,{variant:"error",children:"failed"}),p.status==="ok"&&p.kind==="tool_result"&&y.jsx(jt,{variant:"success",children:"ok"})]}),y.jsx("span",{className:"text-[10px] font-mono text-zinc-700 flex-shrink-0 ml-2",children:Qh(p.timestamp,i)})]}),_?y.jsx("pre",{className:"text-[11px] font-mono text-zinc-400 whitespace-pre-wrap leading-relaxed overflow-x-auto rounded-lg p-2 mt-1 bg-black/20",children:p.content}):y.jsx(sp,{content:p.content,className:"text-[12px] [&_pre]:text-[10px]"})]})]},p.id)})})]})]})}function Rq({squadName:t,instanceId:e}){const[r,n]=P.useState(null),[i,a]=P.useState(null),o=Nu();if(P.useEffect(()=>{Ve.get(`/squads/${t}/instances/${e}`).then(n).catch(()=>{at.error("Failed to load instance")})},[t,e]),!r)return y.jsx("div",{className:"h-full flex items-center justify-center text-zinc-600",children:"Loading..."});const c=r.squadColor||"#38bdf8";if(i){const u=r.members.find(p=>p.roleName===i),d=r.activity.filter(p=>p.agent===i);return y.jsx(Mq,{agentName:(u==null?void 0:u.displayName)||i,agentRole:i,agentStatus:(u==null?void 0:u.status)||"idle",currentTask:(u==null?void 0:u.currentTask)||null,events:d,color:c,onBack:()=>a(null),squadName:t})}return y.jsxs("div",{className:"flex-1 overflow-y-auto p-6",style:{background:`${c}06`},children:[y.jsxs("button",{type:"button",onClick:()=>o(`/squads/${t}`),className:"flex items-center gap-1.5 text-[11px] text-zinc-600 hover:text-zinc-300 font-mono mb-5 transition-colors",children:[y.jsx(vl,{className:"w-3.5 h-3.5"})," Back to ",t]}),y.jsxs("div",{className:"flex items-start justify-between mb-6",children:[y.jsxs("div",{children:[y.jsx("h2",{className:"text-2xl tracking-wide",style:{fontFamily:"'Bebas Neue', sans-serif",color:c},children:"Instance"}),y.jsx("p",{className:"text-[11px] text-zinc-600 font-mono mt-0.5",children:r.instance.id.slice(0,8)}),r.instance.branch&&y.jsx("p",{className:"text-[11px] text-zinc-700 font-mono mt-0.5",children:r.instance.branch})]}),y.jsx(jt,{variant:Co(r.instance.status),children:r.instance.status})]}),y.jsx("div",{className:"space-y-2",children:r.members.map(u=>y.jsxs("div",{className:"glass-card border border-white/[0.07] rounded-2xl p-4 flex items-center gap-3",children:[y.jsx("div",{className:"w-8 h-8 rounded-xl flex items-center justify-center flex-shrink-0",style:{border:`1px solid ${c}30`,background:`${c}12`},children:Kf(u.roleName||u.role,c)}),y.jsxs("div",{className:"flex-1 min-w-0",children:[y.jsxs("div",{className:"flex items-center gap-2",children:[y.jsx("span",{className:"text-sm font-mono text-zinc-200",children:u.displayName}),y.jsx(jt,{variant:Co(u.status),children:u.status})]}),y.jsx("p",{className:"text-[11px] text-zinc-600 font-mono mt-0.5",children:u.role}),u.currentTask&&y.jsx("p",{className:"text-xs text-zinc-500 mt-1 truncate",children:u.currentTask})]}),(u.status==="working"||u.status==="in meeting")&&y.jsxs("div",{className:"flex items-center gap-1 flex-shrink-0",children:[y.jsx("button",{type:"button",onClick:()=>a(u.roleName||u.role),title:"View work in progress",className:"p-2 rounded-xl hover:bg-white/[0.06] transition-colors cursor-pointer",style:{color:c},children:y.jsx(Ds,{className:"w-4 h-4"})}),u.status==="working"&&y.jsx("button",{type:"button",onClick:()=>at.success(`${u.displayName} stopped`),title:"Stop agent",className:"p-2 rounded-xl hover:bg-red-500/10 text-zinc-600 hover:text-red-400 transition-colors cursor-pointer",children:y.jsx(Jh,{className:"w-4 h-4"})})]})]},u.id))}),(r.instance.status==="meeting"||r.instance.status==="planning")&&r.instance.meetingLog&&r.instance.meetingLog.length>0&&y.jsxs("div",{className:"mt-6",children:[y.jsx("h3",{className:"text-lg tracking-wide mb-3",style:{fontFamily:"'Bebas Neue', sans-serif",color:c},children:"Meeting Discussion"}),y.jsx("div",{className:"space-y-2",children:r.instance.meetingLog.map((u,d)=>{const p=u.match(/^\[([^\]]+)\]\s*(.*)/s),f=p?p[1]:"unknown",g=p?p[2]??u:u;return y.jsxs("div",{className:"glass-card border border-white/[0.07] rounded-xl px-4 py-3",children:[y.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[y.jsx(Zh,{className:"w-3.5 h-3.5",style:{color:"#818cf8"}}),y.jsx("span",{className:"text-[10px] font-mono uppercase tracking-wider text-indigo-400",children:f})]}),y.jsx(sp,{content:g,className:"text-xs [&_pre]:text-[10px]"})]},`meeting-${d}`)})})]})]})}const Iq={thought:{label:"Thinking",icon:Dw,color:"#a78bfa",bg:"rgba(167,139,250,0.1)"},tool_call:{label:"Tool Call",icon:rP,color:"#38bdf8",bg:"rgba(56,189,248,0.1)"},tool_result:{label:"Tool Result",icon:JN,color:"#34d399",bg:"rgba(52,211,153,0.1)"},message:{label:"Message",icon:Uc,color:"#E43A9C",bg:"rgba(228,58,156,0.15)"},decision:{label:"Decision",icon:Lw,color:"#fbbf24",bg:"rgba(251,191,36,0.1)"},meeting:{label:"Meeting",icon:Zh,color:"#818cf8",bg:"rgba(129,140,248,0.1)"}};function $q(t){const e=t.toLowerCase();return e.includes("meeting")?"meeting":e.includes("tool_call")||e.includes("tool-call")?"tool_call":e.includes("tool_result")||e.includes("tool-result")?"tool_result":e.includes("thought")||e.includes("thinking")||e.includes("reason")?"thought":e.includes("decision")?"decision":"message"}function Mq({agentName:t,agentRole:e,agentStatus:r,currentTask:n,events:i,color:a,onBack:o,squadName:c}){const u=qa();return y.jsxs("div",{className:"flex-1 overflow-y-auto p-6",style:{background:`${a}06`},children:[y.jsxs("button",{type:"button",onClick:o,className:"flex items-center gap-1.5 text-[11px] text-zinc-600 hover:text-zinc-300 font-mono mb-5 transition-colors",children:[y.jsx(vl,{className:"w-3.5 h-3.5"})," Back to ",c]}),y.jsxs("div",{className:"flex items-start justify-between mb-6",children:[y.jsxs("div",{children:[y.jsx("h2",{className:"text-2xl tracking-wide",style:{fontFamily:"'Bebas Neue', sans-serif",color:a},children:t}),y.jsx("p",{className:"text-[11px] text-zinc-600 font-mono mt-0.5",children:e}),n&&y.jsx("p",{className:"text-sm text-zinc-400 mt-1",children:n})]}),y.jsx(jt,{variant:Co(r),children:r})]}),y.jsxs("div",{className:"relative",children:[y.jsx("div",{className:"absolute left-[15px] top-0 bottom-0 w-px bg-white/[0.06]"}),y.jsxs("div",{className:"space-y-3 pl-10",children:[i.length===0&&y.jsx("div",{className:"text-center py-12 text-zinc-700 font-mono text-sm",children:"No activity recorded yet"}),i.map(d=>{const p=$q(d.type),f=Iq[p],g=f.icon,v=p==="tool_call"||p==="tool_result",x=d.type.toLowerCase().includes("error")||d.type.toLowerCase().includes("fail");return y.jsxs("div",{className:"relative",children:[y.jsx("div",{className:"absolute -left-10 top-3 w-[30px] h-[30px] rounded-full flex items-center justify-center",style:{background:f.bg,border:`1px solid ${f.color}30`},children:y.jsx(g,{className:"w-3.5 h-3.5",style:{color:f.color}})}),y.jsxs("div",{className:"glass-card border border-white/[0.07] rounded-2xl px-4 py-3",children:[y.jsxs("div",{className:"flex items-center justify-between mb-1.5",children:[y.jsxs("div",{className:"flex items-center gap-2",children:[y.jsx("span",{className:"text-[10px] font-mono uppercase tracking-wider",style:{color:f.color},children:f.label}),d.model&&y.jsx("span",{className:"text-[10px] font-mono text-zinc-600 border border-white/[0.08] rounded px-1.5 py-px bg-white/[0.03]",children:d.model}),x&&y.jsx(jt,{variant:"error",children:"failed"})]}),y.jsx("span",{className:"text-[10px] font-mono text-zinc-700",children:Qh(d.timestamp,u)})]}),v?y.jsx("pre",{className:"text-[11px] font-mono text-zinc-400 whitespace-pre-wrap leading-relaxed overflow-x-auto rounded-lg p-2.5 bg-black/20",children:d.content}):y.jsx("p",{className:"text-[12px] text-zinc-400 leading-relaxed",children:d.content})]})]},d.id)}),y.jsxs("div",{className:"relative",children:[y.jsx("div",{className:"absolute -left-10 top-3 w-[30px] h-[30px] rounded-full flex items-center justify-center",style:{background:`${a}15`,border:`1px solid ${a}40`},children:y.jsx(ZN,{className:"w-3.5 h-3.5 animate-spin",style:{color:a}})}),y.jsx("div",{className:"glass-card border rounded-2xl px-4 py-3",style:{borderColor:`${a}20`},children:y.jsx("span",{className:"text-[11px] font-mono",style:{color:a},children:"Agent is working…"})})]})]})]})]})}var Mg,qE;function Zr(){if(qE)return Mg;qE=1;var t=Array.isArray;return Mg=t,Mg}var Lg,FE;function vR(){if(FE)return Lg;FE=1;var t=typeof Zd=="object"&&Zd&&Zd.Object===Object&&Zd;return Lg=t,Lg}var Dg,HE;function Oi(){if(HE)return Dg;HE=1;var t=vR(),e=typeof self=="object"&&self&&self.Object===Object&&self,r=t||e||Function("return this")();return Dg=r,Dg}var zg,WE;function $u(){if(WE)return zg;WE=1;var t=Oi(),e=t.Symbol;return zg=e,zg}var Bg,GE;function Lq(){if(GE)return Bg;GE=1;var t=$u(),e=Object.prototype,r=e.hasOwnProperty,n=e.toString,i=t?t.toStringTag:void 0;function a(o){var c=r.call(o,i),u=o[i];try{o[i]=void 0;var d=!0}catch{}var p=n.call(o);return d&&(c?o[i]=u:delete o[i]),p}return Bg=a,Bg}var Ug,KE;function Dq(){if(KE)return Ug;KE=1;var t=Object.prototype,e=t.toString;function r(n){return e.call(n)}return Ug=r,Ug}var qg,VE;function ra(){if(VE)return qg;VE=1;var t=$u(),e=Lq(),r=Dq(),n="[object Null]",i="[object Undefined]",a=t?t.toStringTag:void 0;function o(c){return c==null?c===void 0?i:n:a&&a in Object(c)?e(c):r(c)}return qg=o,qg}var Fg,XE;function na(){if(XE)return Fg;XE=1;function t(e){return e!=null&&typeof e=="object"}return Fg=t,Fg}var Hg,YE;function wl(){if(YE)return Hg;YE=1;var t=ra(),e=na(),r="[object Symbol]";function n(i){return typeof i=="symbol"||e(i)&&t(i)==r}return Hg=n,Hg}var Wg,JE;function t1(){if(JE)return Wg;JE=1;var t=Zr(),e=wl(),r=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,n=/^\w*$/;function i(a,o){if(t(a))return!1;var c=typeof a;return c=="number"||c=="symbol"||c=="boolean"||a==null||e(a)?!0:n.test(a)||!r.test(a)||o!=null&&a in Object(o)}return Wg=i,Wg}var Gg,ZE;function Ha(){if(ZE)return Gg;ZE=1;function t(e){var r=typeof e;return e!=null&&(r=="object"||r=="function")}return Gg=t,Gg}var Kg,QE;function r1(){if(QE)return Kg;QE=1;var t=ra(),e=Ha(),r="[object AsyncFunction]",n="[object Function]",i="[object GeneratorFunction]",a="[object Proxy]";function o(c){if(!e(c))return!1;var u=t(c);return u==n||u==i||u==r||u==a}return Kg=o,Kg}var Vg,eO;function zq(){if(eO)return Vg;eO=1;var t=Oi(),e=t["__core-js_shared__"];return Vg=e,Vg}var Xg,tO;function Bq(){if(tO)return Xg;tO=1;var t=zq(),e=(function(){var n=/[^.]+$/.exec(t&&t.keys&&t.keys.IE_PROTO||"");return n?"Symbol(src)_1."+n:""})();function r(n){return!!e&&e in n}return Xg=r,Xg}var Yg,rO;function bR(){if(rO)return Yg;rO=1;var t=Function.prototype,e=t.toString;function r(n){if(n!=null){try{return e.call(n)}catch{}try{return n+""}catch{}}return""}return Yg=r,Yg}var Jg,nO;function Uq(){if(nO)return Jg;nO=1;var t=r1(),e=Bq(),r=Ha(),n=bR(),i=/[\\^$.*+?()[\]{}|]/g,a=/^\[object .+?Constructor\]$/,o=Function.prototype,c=Object.prototype,u=o.toString,d=c.hasOwnProperty,p=RegExp("^"+u.call(d).replace(i,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function f(g){if(!r(g)||e(g))return!1;var v=t(g)?p:a;return v.test(n(g))}return Jg=f,Jg}var Zg,iO;function qq(){if(iO)return Zg;iO=1;function t(e,r){return e==null?void 0:e[r]}return Zg=t,Zg}var Qg,aO;function qo(){if(aO)return Qg;aO=1;var t=Uq(),e=qq();function r(n,i){var a=e(n,i);return t(a)?a:void 0}return Qg=r,Qg}var ey,oO;function lp(){if(oO)return ey;oO=1;var t=qo(),e=t(Object,"create");return ey=e,ey}var ty,sO;function Fq(){if(sO)return ty;sO=1;var t=lp();function e(){this.__data__=t?t(null):{},this.size=0}return ty=e,ty}var ry,lO;function Hq(){if(lO)return ry;lO=1;function t(e){var r=this.has(e)&&delete this.__data__[e];return this.size-=r?1:0,r}return ry=t,ry}var ny,cO;function Wq(){if(cO)return ny;cO=1;var t=lp(),e="__lodash_hash_undefined__",r=Object.prototype,n=r.hasOwnProperty;function i(a){var o=this.__data__;if(t){var c=o[a];return c===e?void 0:c}return n.call(o,a)?o[a]:void 0}return ny=i,ny}var iy,uO;function Gq(){if(uO)return iy;uO=1;var t=lp(),e=Object.prototype,r=e.hasOwnProperty;function n(i){var a=this.__data__;return t?a[i]!==void 0:r.call(a,i)}return iy=n,iy}var ay,dO;function Kq(){if(dO)return ay;dO=1;var t=lp(),e="__lodash_hash_undefined__";function r(n,i){var a=this.__data__;return this.size+=this.has(n)?0:1,a[n]=t&&i===void 0?e:i,this}return ay=r,ay}var oy,fO;function Vq(){if(fO)return oy;fO=1;var t=Fq(),e=Hq(),r=Wq(),n=Gq(),i=Kq();function a(o){var c=-1,u=o==null?0:o.length;for(this.clear();++c<u;){var d=o[c];this.set(d[0],d[1])}}return a.prototype.clear=t,a.prototype.delete=e,a.prototype.get=r,a.prototype.has=n,a.prototype.set=i,oy=a,oy}var sy,hO;function Xq(){if(hO)return sy;hO=1;function t(){this.__data__=[],this.size=0}return sy=t,sy}var ly,pO;function n1(){if(pO)return ly;pO=1;function t(e,r){return e===r||e!==e&&r!==r}return ly=t,ly}var cy,mO;function cp(){if(mO)return cy;mO=1;var t=n1();function e(r,n){for(var i=r.length;i--;)if(t(r[i][0],n))return i;return-1}return cy=e,cy}var uy,gO;function Yq(){if(gO)return uy;gO=1;var t=cp(),e=Array.prototype,r=e.splice;function n(i){var a=this.__data__,o=t(a,i);if(o<0)return!1;var c=a.length-1;return o==c?a.pop():r.call(a,o,1),--this.size,!0}return uy=n,uy}var dy,yO;function Jq(){if(yO)return dy;yO=1;var t=cp();function e(r){var n=this.__data__,i=t(n,r);return i<0?void 0:n[i][1]}return dy=e,dy}var fy,vO;function Zq(){if(vO)return fy;vO=1;var t=cp();function e(r){return t(this.__data__,r)>-1}return fy=e,fy}var hy,bO;function Qq(){if(bO)return hy;bO=1;var t=cp();function e(r,n){var i=this.__data__,a=t(i,r);return a<0?(++this.size,i.push([r,n])):i[a][1]=n,this}return hy=e,hy}var py,xO;function up(){if(xO)return py;xO=1;var t=Xq(),e=Yq(),r=Jq(),n=Zq(),i=Qq();function a(o){var c=-1,u=o==null?0:o.length;for(this.clear();++c<u;){var d=o[c];this.set(d[0],d[1])}}return a.prototype.clear=t,a.prototype.delete=e,a.prototype.get=r,a.prototype.has=n,a.prototype.set=i,py=a,py}var my,wO;function i1(){if(wO)return my;wO=1;var t=qo(),e=Oi(),r=t(e,"Map");return my=r,my}var gy,_O;function e9(){if(_O)return gy;_O=1;var t=Vq(),e=up(),r=i1();function n(){this.size=0,this.__data__={hash:new t,map:new(r||e),string:new t}}return gy=n,gy}var yy,SO;function t9(){if(SO)return yy;SO=1;function t(e){var r=typeof e;return r=="string"||r=="number"||r=="symbol"||r=="boolean"?e!=="__proto__":e===null}return yy=t,yy}var vy,kO;function dp(){if(kO)return vy;kO=1;var t=t9();function e(r,n){var i=r.__data__;return t(n)?i[typeof n=="string"?"string":"hash"]:i.map}return vy=e,vy}var by,EO;function r9(){if(EO)return by;EO=1;var t=dp();function e(r){var n=t(this,r).delete(r);return this.size-=n?1:0,n}return by=e,by}var xy,OO;function n9(){if(OO)return xy;OO=1;var t=dp();function e(r){return t(this,r).get(r)}return xy=e,xy}var wy,AO;function i9(){if(AO)return wy;AO=1;var t=dp();function e(r){return t(this,r).has(r)}return wy=e,wy}var _y,TO;function a9(){if(TO)return _y;TO=1;var t=dp();function e(r,n){var i=t(this,r),a=i.size;return i.set(r,n),this.size+=i.size==a?0:1,this}return _y=e,_y}var Sy,jO;function a1(){if(jO)return Sy;jO=1;var t=e9(),e=r9(),r=n9(),n=i9(),i=a9();function a(o){var c=-1,u=o==null?0:o.length;for(this.clear();++c<u;){var d=o[c];this.set(d[0],d[1])}}return a.prototype.clear=t,a.prototype.delete=e,a.prototype.get=r,a.prototype.has=n,a.prototype.set=i,Sy=a,Sy}var ky,CO;function xR(){if(CO)return ky;CO=1;var t=a1(),e="Expected a function";function r(n,i){if(typeof n!="function"||i!=null&&typeof i!="function")throw new TypeError(e);var a=function(){var o=arguments,c=i?i.apply(this,o):o[0],u=a.cache;if(u.has(c))return u.get(c);var d=n.apply(this,o);return a.cache=u.set(c,d)||u,d};return a.cache=new(r.Cache||t),a}return r.Cache=t,ky=r,ky}var Ey,NO;function o9(){if(NO)return Ey;NO=1;var t=xR(),e=500;function r(n){var i=t(n,function(o){return a.size===e&&a.clear(),o}),a=i.cache;return i}return Ey=r,Ey}var Oy,PO;function s9(){if(PO)return Oy;PO=1;var t=o9(),e=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,r=/\\(\\)?/g,n=t(function(i){var a=[];return i.charCodeAt(0)===46&&a.push(""),i.replace(e,function(o,c,u,d){a.push(u?d.replace(r,"$1"):c||o)}),a});return Oy=n,Oy}var Ay,RO;function o1(){if(RO)return Ay;RO=1;function t(e,r){for(var n=-1,i=e==null?0:e.length,a=Array(i);++n<i;)a[n]=r(e[n],n,e);return a}return Ay=t,Ay}var Ty,IO;function l9(){if(IO)return Ty;IO=1;var t=$u(),e=o1(),r=Zr(),n=wl(),i=t?t.prototype:void 0,a=i?i.toString:void 0;function o(c){if(typeof c=="string")return c;if(r(c))return e(c,o)+"";if(n(c))return a?a.call(c):"";var u=c+"";return u=="0"&&1/c==-1/0?"-0":u}return Ty=o,Ty}var jy,$O;function wR(){if($O)return jy;$O=1;var t=l9();function e(r){return r==null?"":t(r)}return jy=e,jy}var Cy,MO;function _R(){if(MO)return Cy;MO=1;var t=Zr(),e=t1(),r=s9(),n=wR();function i(a,o){return t(a)?a:e(a,o)?[a]:r(n(a))}return Cy=i,Cy}var Ny,LO;function fp(){if(LO)return Ny;LO=1;var t=wl();function e(r){if(typeof r=="string"||t(r))return r;var n=r+"";return n=="0"&&1/r==-1/0?"-0":n}return Ny=e,Ny}var Py,DO;function s1(){if(DO)return Py;DO=1;var t=_R(),e=fp();function r(n,i){i=t(i,n);for(var a=0,o=i.length;n!=null&&a<o;)n=n[e(i[a++])];return a&&a==o?n:void 0}return Py=r,Py}var Ry,zO;function SR(){if(zO)return Ry;zO=1;var t=s1();function e(r,n,i){var a=r==null?void 0:t(r,n);return a===void 0?i:a}return Ry=e,Ry}var c9=SR();const Tn=vt(c9);var Iy,BO;function u9(){if(BO)return Iy;BO=1;function t(e){return e==null}return Iy=t,Iy}var d9=u9();const et=vt(d9);var $y,UO;function f9(){if(UO)return $y;UO=1;var t=ra(),e=Zr(),r=na(),n="[object String]";function i(a){return typeof a=="string"||!e(a)&&r(a)&&t(a)==n}return $y=i,$y}var h9=f9();const Io=vt(h9);var p9=r1();const Je=vt(p9);var m9=Ha();const _l=vt(m9);var My={exports:{}},pt={};/**
435
435
  * @license React
436
436
  * react-is.production.min.js
@@ -502,4 +502,4 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
502
502
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function xM(t,e){if(t){if(typeof t=="string")return _w(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set")return Array.from(t);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return _w(t,e)}}function vne(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function bne(t){if(Array.isArray(t))return _w(t)}function _w(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function wN(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),r.push.apply(r,n)}return r}function ie(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?wN(Object(r),!0).forEach(function(n){ze(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):wN(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function ze(t,e,r){return e=wM(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function wM(t){var e=xne(t,"string");return hl(e)=="symbol"?e:e+""}function xne(t,e){if(hl(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e);if(hl(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var wne={xAxis:["bottom","top"],yAxis:["left","right"]},_ne={width:"100%",height:"100%"},_M={x:0,y:0};function Of(t){return t}var Sne=function(e,r){return r==="horizontal"?e.x:r==="vertical"?e.y:r==="centric"?e.angle:e.radius},kne=function(e,r,n,i){var a=r.find(function(p){return p&&p.index===n});if(a){if(e==="horizontal")return{x:a.coordinate,y:i.y};if(e==="vertical")return{x:i.x,y:a.coordinate};if(e==="centric"){var o=a.coordinate,c=i.radius;return ie(ie(ie({},i),_r(i.cx,i.cy,c,o)),{},{angle:o,radius:c})}var u=a.coordinate,d=i.angle;return ie(ie(ie({},i),_r(i.cx,i.cy,u,d)),{},{angle:d,radius:u})}return _M},Dp=function(e,r){var n=r.graphicalItems,i=r.dataStartIndex,a=r.dataEndIndex,o=(n??[]).reduce(function(c,u){var d=u.props.data;return d&&d.length?[].concat(pl(c),pl(d)):c},[]);return o.length>0?o:e&&e.length&&ge(i)&&ge(a)?e.slice(i,a+1):[]};function SM(t){return t==="number"?[0,"auto"]:void 0}var Sw=function(e,r,n,i){var a=e.graphicalItems,o=e.tooltipAxis,c=Dp(r,e);return n<0||!a||!a.length||n>=c.length?null:a.reduce(function(u,d){var p,f=(p=d.props.data)!==null&&p!==void 0?p:r;f&&e.dataStartIndex+e.dataEndIndex!==0&&e.dataEndIndex-e.dataStartIndex>=n&&(f=f.slice(e.dataStartIndex,e.dataEndIndex+1));var g;if(o.dataKey&&!o.allowDuplicatedCategory){var v=f===void 0?c:f;g=Vf(v,o.dataKey,i)}else g=f&&f[n]||c[n];return g?[].concat(pl(u),[S$(d,g)]):u},[])},_N=function(e,r,n,i){var a=i||{x:e.chartX,y:e.chartY},o=Sne(a,n),c=e.orderedTooltipTicks,u=e.tooltipAxis,d=e.tooltipTicks,p=IX(o,c,d,u);if(p>=0&&d){var f=d[p]&&d[p].value,g=Sw(e,r,p,f),v=kne(n,c,p,a);return{activeTooltipIndex:p,activeLabel:f,activePayload:g,activeCoordinate:v}}return null},Ene=function(e,r){var n=r.axes,i=r.graphicalItems,a=r.axisType,o=r.axisIdKey,c=r.stackGroups,u=r.dataStartIndex,d=r.dataEndIndex,p=e.layout,f=e.children,g=e.stackOffset,v=x$(p,a);return n.reduce(function(x,_){var b,S=_.type.defaultProps!==void 0?ie(ie({},_.type.defaultProps),_.props):_.props,A=S.type,O=S.dataKey,j=S.allowDataOverflow,E=S.allowDuplicatedCategory,T=S.scale,N=S.ticks,R=S.includeHidden,M=S[o];if(x[M])return x;var J=Dp(e.data,{graphicalItems:i.filter(function($){var V,oe=o in $.props?$.props[o]:(V=$.type.defaultProps)===null||V===void 0?void 0:V[o];return oe===M}),dataStartIndex:u,dataEndIndex:d}),F=J.length,B,K,W;Jre(S.domain,j,A)&&(B=Bx(S.domain,null,j),v&&(A==="number"||T!=="auto")&&(W=Lc(J,O,"category")));var X=SM(A);if(!B||B.length===0){var Y,te=(Y=S.domain)!==null&&Y!==void 0?Y:X;if(O){if(B=Lc(J,O,A),A==="category"&&v){var H=E9(B);E&&H?(K=B,B=Rh(0,F)):E||(B=Mj(te,B,_).reduce(function($,V){return $.indexOf(V)>=0?$:[].concat(pl($),[V])},[]))}else if(A==="category")E?B=B.filter(function($){return $!==""&&!et($)}):B=Mj(te,B,_).reduce(function($,V){return $.indexOf(V)>=0||V===""||et(V)?$:[].concat(pl($),[V])},[]);else if(A==="number"){var Q=zX(J,i.filter(function($){var V,oe,le=o in $.props?$.props[o]:(V=$.type.defaultProps)===null||V===void 0?void 0:V[o],ve="hide"in $.props?$.props.hide:(oe=$.type.defaultProps)===null||oe===void 0?void 0:oe.hide;return le===M&&(R||!ve)}),O,a,p);Q&&(B=Q)}v&&(A==="number"||T!=="auto")&&(W=Lc(J,O,"category"))}else v?B=Rh(0,F):c&&c[M]&&c[M].hasStack&&A==="number"?B=g==="expand"?[0,1]:_$(c[M].stackGroups,u,d):B=b$(J,i.filter(function($){var V=o in $.props?$.props[o]:$.type.defaultProps[o],oe="hide"in $.props?$.props.hide:$.type.defaultProps.hide;return V===M&&(R||!oe)}),A,p,!0);if(A==="number")B=xw(f,B,M,a,N),te&&(B=Bx(te,B,j));else if(A==="category"&&te){var U=te,I=B.every(function($){return U.indexOf($)>=0});I&&(B=U)}}return ie(ie({},x),{},ze({},M,ie(ie({},S),{},{axisType:a,domain:B,categoricalDomain:W,duplicateDomain:K,originalDomain:(b=S.domain)!==null&&b!==void 0?b:X,isCategorical:v,layout:p})))},{})},One=function(e,r){var n=r.graphicalItems,i=r.Axis,a=r.axisType,o=r.axisIdKey,c=r.stackGroups,u=r.dataStartIndex,d=r.dataEndIndex,p=e.layout,f=e.children,g=Dp(e.data,{graphicalItems:n,dataStartIndex:u,dataEndIndex:d}),v=g.length,x=x$(p,a),_=-1;return n.reduce(function(b,S){var A=S.type.defaultProps!==void 0?ie(ie({},S.type.defaultProps),S.props):S.props,O=A[o],j=SM("number");if(!b[O]){_++;var E;return x?E=Rh(0,v):c&&c[O]&&c[O].hasStack?(E=_$(c[O].stackGroups,u,d),E=xw(f,E,O,a)):(E=Bx(j,b$(g,n.filter(function(T){var N,R,M=o in T.props?T.props[o]:(N=T.type.defaultProps)===null||N===void 0?void 0:N[o],J="hide"in T.props?T.props.hide:(R=T.type.defaultProps)===null||R===void 0?void 0:R.hide;return M===O&&!J}),"number",p),i.defaultProps.allowDataOverflow),E=xw(f,E,O,a)),ie(ie({},b),{},ze({},O,ie(ie({axisType:a},i.defaultProps),{},{hide:!0,orientation:Tn(wne,"".concat(a,".").concat(_%2),null),domain:E,originalDomain:j,isCategorical:x,layout:p})))}return b},{})},Ane=function(e,r){var n=r.axisType,i=n===void 0?"xAxis":n,a=r.AxisComp,o=r.graphicalItems,c=r.stackGroups,u=r.dataStartIndex,d=r.dataEndIndex,p=e.children,f="".concat(i,"Id"),g=jn(p,a),v={};return g&&g.length?v=Ene(e,{axes:g,graphicalItems:o,axisType:i,axisIdKey:f,stackGroups:c,dataStartIndex:u,dataEndIndex:d}):o&&o.length&&(v=One(e,{Axis:a,graphicalItems:o,axisType:i,axisIdKey:f,stackGroups:c,dataStartIndex:u,dataEndIndex:d})),v},Tne=function(e){var r=Pa(e),n=Wi(r,!1,!0);return{tooltipTicks:n,orderedTooltipTicks:w1(n,function(i){return i.coordinate}),tooltipAxis:r,tooltipAxisBandSize:Sh(r,n)}},SN=function(e){var r=e.children,n=e.defaultShowTooltip,i=sn(r,il),a=0,o=0;return e.data&&e.data.length!==0&&(o=e.data.length-1),i&&i.props&&(i.props.startIndex>=0&&(a=i.props.startIndex),i.props.endIndex>=0&&(o=i.props.endIndex)),{chartX:0,chartY:0,dataStartIndex:a,dataEndIndex:o,activeTooltipIndex:-1,isTooltipActive:!!n}},jne=function(e){return!e||!e.length?!1:e.some(function(r){var n=Gi(r&&r.type);return n&&n.indexOf("Bar")>=0})},kN=function(e){return e==="horizontal"?{numericAxisName:"yAxis",cateAxisName:"xAxis"}:e==="vertical"?{numericAxisName:"xAxis",cateAxisName:"yAxis"}:e==="centric"?{numericAxisName:"radiusAxis",cateAxisName:"angleAxis"}:{numericAxisName:"angleAxis",cateAxisName:"radiusAxis"}},Cne=function(e,r){var n=e.props,i=e.graphicalItems,a=e.xAxisMap,o=a===void 0?{}:a,c=e.yAxisMap,u=c===void 0?{}:c,d=n.width,p=n.height,f=n.children,g=n.margin||{},v=sn(f,il),x=sn(f,qs),_=Object.keys(u).reduce(function(E,T){var N=u[T],R=N.orientation;return!N.mirror&&!N.hide?ie(ie({},E),{},ze({},R,E[R]+N.width)):E},{left:g.left||0,right:g.right||0}),b=Object.keys(o).reduce(function(E,T){var N=o[T],R=N.orientation;return!N.mirror&&!N.hide?ie(ie({},E),{},ze({},R,Tn(E,"".concat(R))+N.height)):E},{top:g.top||0,bottom:g.bottom||0}),S=ie(ie({},b),_),A=S.bottom;v&&(S.bottom+=v.props.height||il.defaultProps.height),x&&r&&(S=LX(S,i,n,r));var O=d-S.left-S.right,j=p-S.top-S.bottom;return ie(ie({brushBottom:A},S),{},{width:Math.max(O,0),height:Math.max(j,0)})},Nne=function(e,r){if(r==="xAxis")return e[r].width;if(r==="yAxis")return e[r].height},kM=function(e){var r=e.chartName,n=e.GraphicalChild,i=e.defaultTooltipEventType,a=i===void 0?"axis":i,o=e.validateTooltipEventTypes,c=o===void 0?["axis"]:o,u=e.axisComponents,d=e.legendContent,p=e.formatAxisMap,f=e.defaultProps,g=function(S,A){var O=A.graphicalItems,j=A.stackGroups,E=A.offset,T=A.updateId,N=A.dataStartIndex,R=A.dataEndIndex,M=S.barSize,J=S.layout,F=S.barGap,B=S.barCategoryGap,K=S.maxBarSize,W=kN(J),X=W.numericAxisName,Y=W.cateAxisName,te=jne(O),H=[];return O.forEach(function(Q,U){var I=Dp(S.data,{graphicalItems:[Q],dataStartIndex:N,dataEndIndex:R}),$=Q.type.defaultProps!==void 0?ie(ie({},Q.type.defaultProps),Q.props):Q.props,V=$.dataKey,oe=$.maxBarSize,le=$["".concat(X,"Id")],ve=$["".concat(Y,"Id")],qe={},xe=u.reduce(function(lr,_t){var kr=A["".concat(_t.axisType,"Map")],Ir=$["".concat(_t.axisType,"Id")];kr&&kr[Ir]||_t.axisType==="zAxis"||Lo();var ni=kr[Ir];return ie(ie({},lr),{},ze(ze({},_t.axisType,ni),"".concat(_t.axisType,"Ticks"),Wi(ni)))},qe),ae=xe[Y],Se=xe["".concat(Y,"Ticks")],Me=j&&j[le]&&j[le].hasStack&&JX(Q,j[le].stackGroups),se=Gi(Q.type).indexOf("Bar")>=0,tt=Sh(ae,Se),Fe=[],kt=te&&$X({barSize:M,stackGroups:j,totalSize:Nne(xe,Y)});if(se){var wt,Et,Sr=et(oe)?K:oe,Ut=(wt=(Et=Sh(ae,Se,!0))!==null&&Et!==void 0?Et:Sr)!==null&&wt!==void 0?wt:0;Fe=MX({barGap:F,barCategoryGap:B,bandSize:Ut!==tt?Ut:tt,sizeList:kt[ve],maxBarSize:Sr}),Ut!==tt&&(Fe=Fe.map(function(lr){return ie(ie({},lr),{},{position:ie(ie({},lr.position),{},{offset:lr.position.offset-Ut/2})})}))}var Rr=Q&&Q.type&&Q.type.getComposedData;Rr&&H.push({props:ie(ie({},Rr(ie(ie({},xe),{},{displayedData:I,props:S,dataKey:V,item:Q,bandSize:tt,barPosition:Fe,offset:E,stackedData:Me,layout:J,dataStartIndex:N,dataEndIndex:R}))),{},ze(ze(ze({key:Q.key||"item-".concat(U)},X,xe[X]),Y,xe[Y]),"animationId",T)),childIndex:D9(Q,S.children),item:Q})}),H},v=function(S,A){var O=S.props,j=S.dataStartIndex,E=S.dataEndIndex,T=S.updateId;if(!YO({props:O}))return null;var N=O.children,R=O.layout,M=O.stackOffset,J=O.data,F=O.reverseStackOrder,B=kN(R),K=B.numericAxisName,W=B.cateAxisName,X=jn(N,n),Y=VX(J,X,"".concat(K,"Id"),"".concat(W,"Id"),M,F),te=u.reduce(function($,V){var oe="".concat(V.axisType,"Map");return ie(ie({},$),{},ze({},oe,Ane(O,ie(ie({},V),{},{graphicalItems:X,stackGroups:V.axisType===K&&Y,dataStartIndex:j,dataEndIndex:E}))))},{}),H=Cne(ie(ie({},te),{},{props:O,graphicalItems:X}),A==null?void 0:A.legendBBox);Object.keys(te).forEach(function($){te[$]=p(O,te[$],H,$.replace("Map",""),r)});var Q=te["".concat(W,"Map")],U=Tne(Q),I=g(O,ie(ie({},te),{},{dataStartIndex:j,dataEndIndex:E,updateId:T,graphicalItems:X,stackGroups:Y,offset:H}));return ie(ie({formattedGraphicalItems:I,graphicalItems:X,offset:H,stackGroups:Y},U),te)},x=(function(b){function S(A){var O,j,E;return une(this,S),E=hne(this,S,[A]),ze(E,"eventEmitterSymbol",Symbol("rechartsEventEmitter")),ze(E,"accessibilityManager",new Yre),ze(E,"handleLegendBBoxUpdate",function(T){if(T){var N=E.state,R=N.dataStartIndex,M=N.dataEndIndex,J=N.updateId;E.setState(ie({legendBBox:T},v({props:E.props,dataStartIndex:R,dataEndIndex:M,updateId:J},ie(ie({},E.state),{},{legendBBox:T}))))}}),ze(E,"handleReceiveSyncEvent",function(T,N,R){if(E.props.syncId===T){if(R===E.eventEmitterSymbol&&typeof E.props.syncMethod!="function")return;E.applySyncEvent(N)}}),ze(E,"handleBrushChange",function(T){var N=T.startIndex,R=T.endIndex;if(N!==E.state.dataStartIndex||R!==E.state.dataEndIndex){var M=E.state.updateId;E.setState(function(){return ie({dataStartIndex:N,dataEndIndex:R},v({props:E.props,dataStartIndex:N,dataEndIndex:R,updateId:M},E.state))}),E.triggerSyncEvent({dataStartIndex:N,dataEndIndex:R})}}),ze(E,"handleMouseEnter",function(T){var N=E.getMouseInfo(T);if(N){var R=ie(ie({},N),{},{isTooltipActive:!0});E.setState(R),E.triggerSyncEvent(R);var M=E.props.onMouseEnter;Je(M)&&M(R,T)}}),ze(E,"triggeredAfterMouseMove",function(T){var N=E.getMouseInfo(T),R=N?ie(ie({},N),{},{isTooltipActive:!0}):{isTooltipActive:!1};E.setState(R),E.triggerSyncEvent(R);var M=E.props.onMouseMove;Je(M)&&M(R,T)}),ze(E,"handleItemMouseEnter",function(T){E.setState(function(){return{isTooltipActive:!0,activeItem:T,activePayload:T.tooltipPayload,activeCoordinate:T.tooltipPosition||{x:T.cx,y:T.cy}}})}),ze(E,"handleItemMouseLeave",function(){E.setState(function(){return{isTooltipActive:!1}})}),ze(E,"handleMouseMove",function(T){T.persist(),E.throttleTriggeredAfterMouseMove(T)}),ze(E,"handleMouseLeave",function(T){E.throttleTriggeredAfterMouseMove.cancel();var N={isTooltipActive:!1};E.setState(N),E.triggerSyncEvent(N);var R=E.props.onMouseLeave;Je(R)&&R(N,T)}),ze(E,"handleOuterEvent",function(T){var N=L9(T),R=Tn(E.props,"".concat(N));if(N&&Je(R)){var M,J;/.*touch.*/i.test(N)?J=E.getMouseInfo(T.changedTouches[0]):J=E.getMouseInfo(T),R((M=J)!==null&&M!==void 0?M:{},T)}}),ze(E,"handleClick",function(T){var N=E.getMouseInfo(T);if(N){var R=ie(ie({},N),{},{isTooltipActive:!0});E.setState(R),E.triggerSyncEvent(R);var M=E.props.onClick;Je(M)&&M(R,T)}}),ze(E,"handleMouseDown",function(T){var N=E.props.onMouseDown;if(Je(N)){var R=E.getMouseInfo(T);N(R,T)}}),ze(E,"handleMouseUp",function(T){var N=E.props.onMouseUp;if(Je(N)){var R=E.getMouseInfo(T);N(R,T)}}),ze(E,"handleTouchMove",function(T){T.changedTouches!=null&&T.changedTouches.length>0&&E.throttleTriggeredAfterMouseMove(T.changedTouches[0])}),ze(E,"handleTouchStart",function(T){T.changedTouches!=null&&T.changedTouches.length>0&&E.handleMouseDown(T.changedTouches[0])}),ze(E,"handleTouchEnd",function(T){T.changedTouches!=null&&T.changedTouches.length>0&&E.handleMouseUp(T.changedTouches[0])}),ze(E,"handleDoubleClick",function(T){var N=E.props.onDoubleClick;if(Je(N)){var R=E.getMouseInfo(T);N(R,T)}}),ze(E,"handleContextMenu",function(T){var N=E.props.onContextMenu;if(Je(N)){var R=E.getMouseInfo(T);N(R,T)}}),ze(E,"triggerSyncEvent",function(T){E.props.syncId!==void 0&&Rb.emit(Ib,E.props.syncId,T,E.eventEmitterSymbol)}),ze(E,"applySyncEvent",function(T){var N=E.props,R=N.layout,M=N.syncMethod,J=E.state.updateId,F=T.dataStartIndex,B=T.dataEndIndex;if(T.dataStartIndex!==void 0||T.dataEndIndex!==void 0)E.setState(ie({dataStartIndex:F,dataEndIndex:B},v({props:E.props,dataStartIndex:F,dataEndIndex:B,updateId:J},E.state)));else if(T.activeTooltipIndex!==void 0){var K=T.chartX,W=T.chartY,X=T.activeTooltipIndex,Y=E.state,te=Y.offset,H=Y.tooltipTicks;if(!te)return;if(typeof M=="function")X=M(H,T);else if(M==="value"){X=-1;for(var Q=0;Q<H.length;Q++)if(H[Q].value===T.activeLabel){X=Q;break}}var U=ie(ie({},te),{},{x:te.left,y:te.top}),I=Math.min(K,U.x+U.width),$=Math.min(W,U.y+U.height),V=H[X]&&H[X].value,oe=Sw(E.state,E.props.data,X),le=H[X]?{x:R==="horizontal"?H[X].coordinate:I,y:R==="horizontal"?$:H[X].coordinate}:_M;E.setState(ie(ie({},T),{},{activeLabel:V,activeCoordinate:le,activePayload:oe,activeTooltipIndex:X}))}else E.setState(T)}),ze(E,"renderCursor",function(T){var N,R=E.state,M=R.isTooltipActive,J=R.activeCoordinate,F=R.activePayload,B=R.offset,K=R.activeTooltipIndex,W=R.tooltipAxisBandSize,X=E.getTooltipEventType(),Y=(N=T.props.active)!==null&&N!==void 0?N:M,te=E.props.layout,H=T.key||"_recharts-cursor";return L.createElement(nne,{key:H,activeCoordinate:J,activePayload:F,activeTooltipIndex:K,chartName:r,element:T,isActive:Y,layout:te,offset:B,tooltipAxisBandSize:W,tooltipEventType:X})}),ze(E,"renderPolarAxis",function(T,N,R){var M=Tn(T,"type.axisType"),J=Tn(E.state,"".concat(M,"Map")),F=T.type.defaultProps,B=F!==void 0?ie(ie({},F),T.props):T.props,K=J&&J[B["".concat(M,"Id")]];return P.cloneElement(T,ie(ie({},K),{},{className:ot(M,K.className),key:T.key||"".concat(N,"-").concat(R),ticks:Wi(K,!0)}))}),ze(E,"renderPolarGrid",function(T){var N=T.props,R=N.radialLines,M=N.polarAngles,J=N.polarRadius,F=E.state,B=F.radiusAxisMap,K=F.angleAxisMap,W=Pa(B),X=Pa(K),Y=X.cx,te=X.cy,H=X.innerRadius,Q=X.outerRadius;return P.cloneElement(T,{polarAngles:Array.isArray(M)?M:Wi(X,!0).map(function(U){return U.coordinate}),polarRadius:Array.isArray(J)?J:Wi(W,!0).map(function(U){return U.coordinate}),cx:Y,cy:te,innerRadius:H,outerRadius:Q,key:T.key||"polar-grid",radialLines:R})}),ze(E,"renderLegend",function(){var T=E.state.formattedGraphicalItems,N=E.props,R=N.children,M=N.width,J=N.height,F=E.props.margin||{},B=M-(F.left||0)-(F.right||0),K=y$({children:R,formattedGraphicalItems:T,legendWidth:B,legendContent:d});if(!K)return null;var W=K.item,X=xN(K,ine);return P.cloneElement(W,ie(ie({},X),{},{chartWidth:M,chartHeight:J,margin:F,onBBoxUpdate:E.handleLegendBBoxUpdate}))}),ze(E,"renderTooltip",function(){var T,N=E.props,R=N.children,M=N.accessibilityLayer,J=sn(R,ln);if(!J)return null;var F=E.state,B=F.isTooltipActive,K=F.activeCoordinate,W=F.activePayload,X=F.activeLabel,Y=F.offset,te=(T=J.props.active)!==null&&T!==void 0?T:B;return P.cloneElement(J,{viewBox:ie(ie({},Y),{},{x:Y.left,y:Y.top}),active:te,label:X,payload:te?W:[],coordinate:K,accessibilityLayer:M})}),ze(E,"renderBrush",function(T){var N=E.props,R=N.margin,M=N.data,J=E.state,F=J.offset,B=J.dataStartIndex,K=J.dataEndIndex,W=J.updateId;return P.cloneElement(T,{key:T.key||"_recharts-brush",onChange:wf(E.handleBrushChange,T.props.onChange),data:M,x:ge(T.props.x)?T.props.x:F.left,y:ge(T.props.y)?T.props.y:F.top+F.height+F.brushBottom-(R.bottom||0),width:ge(T.props.width)?T.props.width:F.width,startIndex:B,endIndex:K,updateId:"brush-".concat(W)})}),ze(E,"renderReferenceElement",function(T,N,R){if(!T)return null;var M=E,J=M.clipPathId,F=E.state,B=F.xAxisMap,K=F.yAxisMap,W=F.offset,X=T.type.defaultProps||{},Y=T.props,te=Y.xAxisId,H=te===void 0?X.xAxisId:te,Q=Y.yAxisId,U=Q===void 0?X.yAxisId:Q;return P.cloneElement(T,{key:T.key||"".concat(N,"-").concat(R),xAxis:B[H],yAxis:K[U],viewBox:{x:W.left,y:W.top,width:W.width,height:W.height},clipPathId:J})}),ze(E,"renderActivePoints",function(T){var N=T.item,R=T.activePoint,M=T.basePoint,J=T.childIndex,F=T.isRange,B=[],K=N.props.key,W=N.item.type.defaultProps!==void 0?ie(ie({},N.item.type.defaultProps),N.item.props):N.item.props,X=W.activeDot,Y=W.dataKey,te=ie(ie({index:J,dataKey:Y,cx:R.x,cy:R.y,r:4,fill:K1(N.item),strokeWidth:2,stroke:"#fff",payload:R.payload,value:R.value},it(X,!1)),Xf(X));return B.push(S.renderActiveDot(X,te,"".concat(K,"-activePoint-").concat(J))),M?B.push(S.renderActiveDot(X,ie(ie({},te),{},{cx:M.x,cy:M.y}),"".concat(K,"-basePoint-").concat(J))):F&&B.push(null),B}),ze(E,"renderGraphicChild",function(T,N,R){var M=E.filterFormatItem(T,N,R);if(!M)return null;var J=E.getTooltipEventType(),F=E.state,B=F.isTooltipActive,K=F.tooltipAxis,W=F.activeTooltipIndex,X=F.activeLabel,Y=E.props.children,te=sn(Y,ln),H=M.props,Q=H.points,U=H.isRange,I=H.baseLine,$=M.item.type.defaultProps!==void 0?ie(ie({},M.item.type.defaultProps),M.item.props):M.item.props,V=$.activeDot,oe=$.hide,le=$.activeBar,ve=$.activeShape,qe=!!(!oe&&B&&te&&(V||le||ve)),xe={};J!=="axis"&&te&&te.props.trigger==="click"?xe={onClick:wf(E.handleItemMouseEnter,T.props.onClick)}:J!=="axis"&&(xe={onMouseLeave:wf(E.handleItemMouseLeave,T.props.onMouseLeave),onMouseEnter:wf(E.handleItemMouseEnter,T.props.onMouseEnter)});var ae=P.cloneElement(T,ie(ie({},M.props),xe));function Se(_t){return typeof K.dataKey=="function"?K.dataKey(_t.payload):null}if(qe)if(W>=0){var Me,se;if(K.dataKey&&!K.allowDuplicatedCategory){var tt=typeof K.dataKey=="function"?Se:"payload.".concat(K.dataKey.toString());Me=Vf(Q,tt,X),se=U&&I&&Vf(I,tt,X)}else Me=Q==null?void 0:Q[W],se=U&&I&&I[W];if(ve||le){var Fe=T.props.activeIndex!==void 0?T.props.activeIndex:W;return[P.cloneElement(T,ie(ie(ie({},M.props),xe),{},{activeIndex:Fe})),null,null]}if(!et(Me))return[ae].concat(pl(E.renderActivePoints({item:M,activePoint:Me,basePoint:se,childIndex:W,isRange:U})))}else{var kt,wt=(kt=E.getItemByXY(E.state.activeCoordinate))!==null&&kt!==void 0?kt:{graphicalItem:ae},Et=wt.graphicalItem,Sr=Et.item,Ut=Sr===void 0?T:Sr,Rr=Et.childIndex,lr=ie(ie(ie({},M.props),xe),{},{activeIndex:Rr});return[P.cloneElement(Ut,lr),null,null]}return U?[ae,null,null]:[ae,null]}),ze(E,"renderCustomized",function(T,N,R){return P.cloneElement(T,ie(ie({key:"recharts-customized-".concat(R)},E.props),E.state))}),ze(E,"renderMap",{CartesianGrid:{handler:Of,once:!0},ReferenceArea:{handler:E.renderReferenceElement},ReferenceLine:{handler:Of},ReferenceDot:{handler:E.renderReferenceElement},XAxis:{handler:Of},YAxis:{handler:Of},Brush:{handler:E.renderBrush,once:!0},Bar:{handler:E.renderGraphicChild},Line:{handler:E.renderGraphicChild},Area:{handler:E.renderGraphicChild},Radar:{handler:E.renderGraphicChild},RadialBar:{handler:E.renderGraphicChild},Scatter:{handler:E.renderGraphicChild},Pie:{handler:E.renderGraphicChild},Funnel:{handler:E.renderGraphicChild},Tooltip:{handler:E.renderCursor,once:!0},PolarGrid:{handler:E.renderPolarGrid,once:!0},PolarAngleAxis:{handler:E.renderPolarAxis},PolarRadiusAxis:{handler:E.renderPolarAxis},Customized:{handler:E.renderCustomized}}),E.clipPathId="".concat((O=A.id)!==null&&O!==void 0?O:Lu("recharts"),"-clip"),E.throttleTriggeredAfterMouseMove=yI(E.triggeredAfterMouseMove,(j=A.throttleDelay)!==null&&j!==void 0?j:1e3/60),E.state={},E}return gne(S,b),fne(S,[{key:"componentDidMount",value:function(){var O,j;this.addListener(),this.accessibilityManager.setDetails({container:this.container,offset:{left:(O=this.props.margin.left)!==null&&O!==void 0?O:0,top:(j=this.props.margin.top)!==null&&j!==void 0?j:0},coordinateList:this.state.tooltipTicks,mouseHandlerCallback:this.triggeredAfterMouseMove,layout:this.props.layout}),this.displayDefaultTooltip()}},{key:"displayDefaultTooltip",value:function(){var O=this.props,j=O.children,E=O.data,T=O.height,N=O.layout,R=sn(j,ln);if(R){var M=R.props.defaultIndex;if(!(typeof M!="number"||M<0||M>this.state.tooltipTicks.length-1)){var J=this.state.tooltipTicks[M]&&this.state.tooltipTicks[M].value,F=Sw(this.state,E,M,J),B=this.state.tooltipTicks[M].coordinate,K=(this.state.offset.top+T)/2,W=N==="horizontal",X=W?{x:B,y:K}:{y:B,x:K},Y=this.state.formattedGraphicalItems.find(function(H){var Q=H.item;return Q.type.name==="Scatter"});Y&&(X=ie(ie({},X),Y.props.points[M].tooltipPosition),F=Y.props.points[M].tooltipPayload);var te={activeTooltipIndex:M,isTooltipActive:!0,activeLabel:J,activePayload:F,activeCoordinate:X};this.setState(te),this.renderCursor(R),this.accessibilityManager.setIndex(M)}}}},{key:"getSnapshotBeforeUpdate",value:function(O,j){if(!this.props.accessibilityLayer)return null;if(this.state.tooltipTicks!==j.tooltipTicks&&this.accessibilityManager.setDetails({coordinateList:this.state.tooltipTicks}),this.props.layout!==O.layout&&this.accessibilityManager.setDetails({layout:this.props.layout}),this.props.margin!==O.margin){var E,T;this.accessibilityManager.setDetails({offset:{left:(E=this.props.margin.left)!==null&&E!==void 0?E:0,top:(T=this.props.margin.top)!==null&&T!==void 0?T:0}})}return null}},{key:"componentDidUpdate",value:function(O){lx([sn(O.children,ln)],[sn(this.props.children,ln)])||this.displayDefaultTooltip()}},{key:"componentWillUnmount",value:function(){this.removeListener(),this.throttleTriggeredAfterMouseMove.cancel()}},{key:"getTooltipEventType",value:function(){var O=sn(this.props.children,ln);if(O&&typeof O.props.shared=="boolean"){var j=O.props.shared?"axis":"item";return c.indexOf(j)>=0?j:a}return a}},{key:"getMouseInfo",value:function(O){if(!this.container)return null;var j=this.container,E=j.getBoundingClientRect(),T=kW(E),N={chartX:Math.round(O.pageX-T.left),chartY:Math.round(O.pageY-T.top)},R=E.width/j.offsetWidth||1,M=this.inRange(N.chartX,N.chartY,R);if(!M)return null;var J=this.state,F=J.xAxisMap,B=J.yAxisMap,K=this.getTooltipEventType(),W=_N(this.state,this.props.data,this.props.layout,M);if(K!=="axis"&&F&&B){var X=Pa(F).scale,Y=Pa(B).scale,te=X&&X.invert?X.invert(N.chartX):null,H=Y&&Y.invert?Y.invert(N.chartY):null;return ie(ie({},N),{},{xValue:te,yValue:H},W)}return W?ie(ie({},N),W):null}},{key:"inRange",value:function(O,j){var E=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,T=this.props.layout,N=O/E,R=j/E;if(T==="horizontal"||T==="vertical"){var M=this.state.offset,J=N>=M.left&&N<=M.left+M.width&&R>=M.top&&R<=M.top+M.height;return J?{x:N,y:R}:null}var F=this.state,B=F.angleAxisMap,K=F.radiusAxisMap;if(B&&K){var W=Pa(B);return zj({x:N,y:R},W)}return null}},{key:"parseEventsOfWrapper",value:function(){var O=this.props.children,j=this.getTooltipEventType(),E=sn(O,ln),T={};E&&j==="axis"&&(E.props.trigger==="click"?T={onClick:this.handleClick}:T={onMouseEnter:this.handleMouseEnter,onDoubleClick:this.handleDoubleClick,onMouseMove:this.handleMouseMove,onMouseLeave:this.handleMouseLeave,onTouchMove:this.handleTouchMove,onTouchStart:this.handleTouchStart,onTouchEnd:this.handleTouchEnd,onContextMenu:this.handleContextMenu});var N=Xf(this.props,this.handleOuterEvent);return ie(ie({},N),T)}},{key:"addListener",value:function(){Rb.on(Ib,this.handleReceiveSyncEvent)}},{key:"removeListener",value:function(){Rb.removeListener(Ib,this.handleReceiveSyncEvent)}},{key:"filterFormatItem",value:function(O,j,E){for(var T=this.state.formattedGraphicalItems,N=0,R=T.length;N<R;N++){var M=T[N];if(M.item===O||M.props.key===O.key||j===Gi(M.item.type)&&E===M.childIndex)return M}return null}},{key:"renderClipPath",value:function(){var O=this.clipPathId,j=this.state.offset,E=j.left,T=j.top,N=j.height,R=j.width;return L.createElement("defs",null,L.createElement("clipPath",{id:O},L.createElement("rect",{x:E,y:T,height:N,width:R})))}},{key:"getXScales",value:function(){var O=this.state.xAxisMap;return O?Object.entries(O).reduce(function(j,E){var T=bN(E,2),N=T[0],R=T[1];return ie(ie({},j),{},ze({},N,R.scale))},{}):null}},{key:"getYScales",value:function(){var O=this.state.yAxisMap;return O?Object.entries(O).reduce(function(j,E){var T=bN(E,2),N=T[0],R=T[1];return ie(ie({},j),{},ze({},N,R.scale))},{}):null}},{key:"getXScaleByAxisId",value:function(O){var j;return(j=this.state.xAxisMap)===null||j===void 0||(j=j[O])===null||j===void 0?void 0:j.scale}},{key:"getYScaleByAxisId",value:function(O){var j;return(j=this.state.yAxisMap)===null||j===void 0||(j=j[O])===null||j===void 0?void 0:j.scale}},{key:"getItemByXY",value:function(O){var j=this.state,E=j.formattedGraphicalItems,T=j.activeItem;if(E&&E.length)for(var N=0,R=E.length;N<R;N++){var M=E[N],J=M.props,F=M.item,B=F.type.defaultProps!==void 0?ie(ie({},F.type.defaultProps),F.props):F.props,K=Gi(F.type);if(K==="Bar"){var W=(J.data||[]).find(function(H){return WZ(O,H)});if(W)return{graphicalItem:M,payload:W}}else if(K==="RadialBar"){var X=(J.data||[]).find(function(H){return zj(O,H)});if(X)return{graphicalItem:M,payload:X}}else if(Np(M,T)||Pp(M,T)||_u(M,T)){var Y=$Q({graphicalItem:M,activeTooltipItem:T,itemData:B.data}),te=B.activeIndex===void 0?Y:B.activeIndex;return{graphicalItem:ie(ie({},M),{},{childIndex:te}),payload:_u(M,T)?B.data[Y]:M.props.data[Y]}}}return null}},{key:"render",value:function(){var O=this;if(!YO(this))return null;var j=this.props,E=j.children,T=j.className,N=j.width,R=j.height,M=j.style,J=j.compact,F=j.title,B=j.desc,K=xN(j,ane),W=it(K,!1);if(J)return L.createElement(eN,{state:this.state,width:this.props.width,height:this.props.height,clipPathId:this.clipPathId},L.createElement(ux,Ls({},W,{width:N,height:R,title:F,desc:B}),this.renderClipPath(),ZO(E,this.renderMap)));if(this.props.accessibilityLayer){var X,Y;W.tabIndex=(X=this.props.tabIndex)!==null&&X!==void 0?X:0,W.role=(Y=this.props.role)!==null&&Y!==void 0?Y:"application",W.onKeyDown=function(H){O.accessibilityManager.keyboardEvent(H)},W.onFocus=function(){O.accessibilityManager.focus()}}var te=this.parseEventsOfWrapper();return L.createElement(eN,{state:this.state,width:this.props.width,height:this.props.height,clipPathId:this.clipPathId},L.createElement("div",Ls({className:ot("recharts-wrapper",T),style:ie({position:"relative",cursor:"default",width:N,height:R},M)},te,{ref:function(Q){O.container=Q}}),L.createElement(ux,Ls({},W,{width:N,height:R,title:F,desc:B,style:_ne}),this.renderClipPath(),ZO(E,this.renderMap)),this.renderLegend(),this.renderTooltip()))}}])})(P.Component);ze(x,"displayName",r),ze(x,"defaultProps",ie({layout:"horizontal",stackOffset:"none",barCategoryGap:"10%",barGap:4,margin:{top:5,right:5,bottom:5,left:5},reverseStackOrder:!1,syncMethod:"index"},f)),ze(x,"getDerivedStateFromProps",function(b,S){var A=b.dataKey,O=b.data,j=b.children,E=b.width,T=b.height,N=b.layout,R=b.stackOffset,M=b.margin,J=S.dataStartIndex,F=S.dataEndIndex;if(S.updateId===void 0){var B=SN(b);return ie(ie(ie({},B),{},{updateId:0},v(ie(ie({props:b},B),{},{updateId:0}),S)),{},{prevDataKey:A,prevData:O,prevWidth:E,prevHeight:T,prevLayout:N,prevStackOffset:R,prevMargin:M,prevChildren:j})}if(A!==S.prevDataKey||O!==S.prevData||E!==S.prevWidth||T!==S.prevHeight||N!==S.prevLayout||R!==S.prevStackOffset||!Us(M,S.prevMargin)){var K=SN(b),W={chartX:S.chartX,chartY:S.chartY,isTooltipActive:S.isTooltipActive},X=ie(ie({},_N(S,O,N)),{},{updateId:S.updateId+1}),Y=ie(ie(ie({},K),W),X);return ie(ie(ie({},Y),v(ie({props:b},Y),S)),{},{prevDataKey:A,prevData:O,prevWidth:E,prevHeight:T,prevLayout:N,prevStackOffset:R,prevMargin:M,prevChildren:j})}if(!lx(j,S.prevChildren)){var te,H,Q,U,I=sn(j,il),$=I&&(te=(H=I.props)===null||H===void 0?void 0:H.startIndex)!==null&&te!==void 0?te:J,V=I&&(Q=(U=I.props)===null||U===void 0?void 0:U.endIndex)!==null&&Q!==void 0?Q:F,oe=$!==J||V!==F,le=!et(O),ve=le&&!oe?S.updateId:S.updateId+1;return ie(ie({updateId:ve},v(ie(ie({props:b},S),{},{updateId:ve,dataStartIndex:$,dataEndIndex:V}),S)),{},{prevChildren:j,dataStartIndex:$,dataEndIndex:V})}return null}),ze(x,"renderActiveDot",function(b,S,A){var O;return P.isValidElement(b)?O=P.cloneElement(b,S):Je(b)?O=b(S):O=L.createElement(X1,S),L.createElement(Xt,{className:"recharts-active-dot",key:A},O)});var _=P.forwardRef(function(S,A){return L.createElement(x,Ls({},S,{ref:A}))});return _.displayName=x.displayName,_},Pne=kM({chartName:"LineChart",GraphicalChild:Hu,axisComponents:[{axisType:"xAxis",AxisComp:Ba},{axisType:"yAxis",AxisComp:Ua}],formatAxisMap:F$}),kw=kM({chartName:"BarChart",GraphicalChild:ea,defaultTooltipEventType:"axis",validateTooltipEventTypes:["axis","item"],axisComponents:[{axisType:"xAxis",AxisComp:Ba},{axisType:"yAxis",AxisComp:Ua}],formatAxisMap:F$});const Kh={backgroundColor:"#1e1e1e",border:"1px solid rgba(255,255,255,0.08)",borderRadius:"12px",color:"#e4e0dc",fontSize:"11px",fontFamily:"JetBrains Mono, monospace"};function It(t){return t>=1e6?`${(t/1e6).toFixed(2)}M`:t>=1e3?`${(t/1e3).toFixed(1)}k`:String(Math.round(t))}function Zn(t){return`$${t.toFixed(2)}`}function $a({label:t,value:e,sub:r,accent:n}){return y.jsxs("div",{className:"glass-card border border-white/[0.07] rounded-2xl px-5 py-4",children:[y.jsx("p",{className:"text-[11px] font-mono text-zinc-600 mb-1",children:t}),y.jsx("p",{className:`text-xl font-mono font-medium ${n?"text-[#E43A9C]":"text-zinc-100"}`,children:e}),r&&y.jsx("p",{className:"text-[10px] font-mono text-zinc-600 mt-0.5",children:r})]})}const Rne={summary:"Summary","by squad":"By Squad","by agent":"By Agent",io:"IO",timeline:"Timeline"};function Ine({tabs:t,active:e,onChange:r}){return y.jsx("div",{className:"flex gap-0 border-b border-white/[0.06] mb-5",children:t.map(n=>y.jsx("button",{type:"button",onClick:()=>r(n),className:`px-4 py-2 text-[11px] font-mono transition-colors border-b-2 -mb-px cursor-pointer ${e===n?"text-[#E43A9C] border-[#E43A9C]":"text-zinc-600 hover:text-zinc-300 border-transparent"}`,children:Rne[n]??n},n))})}function $ne({records:t,totals:e}){const r=e.totalInputTokens+e.totalOutputTokens,n=new Map;for(const o of t){const c=o.squadId??"__io__",u=o.squadName??(o.squadId?`${o.squadId.slice(0,8)} (deleted)`:"IO Orchestrator"),d=n.get(c)??{name:u,inputTokens:0,outputTokens:0,calls:0,cost:0};d.inputTokens+=o.inputTokens,d.outputTokens+=o.outputTokens,d.calls+=1,d.cost+=o.estimatedCostUsd??0,n.set(c,d)}const i=Array.from(n.values()).sort((o,c)=>c.cost-o.cost),a=i.map(o=>({name:o.name.length>12?`${o.name.slice(0,12)}…`:o.name,cost:Number.parseFloat(o.cost.toFixed(2)),tokens:Math.round((o.inputTokens+o.outputTokens)/1e3)}));return y.jsxs("div",{className:"space-y-5",children:[y.jsxs("div",{className:"grid grid-cols-2 lg:grid-cols-4 gap-3",children:[y.jsx($a,{label:"Total Tokens",value:It(r),sub:`${It(e.totalInputTokens)} in · ${It(e.totalOutputTokens)} out`}),y.jsx($a,{label:"Total Cost",value:Zn(e.totalCostUsd),accent:!0}),y.jsx($a,{label:"API Calls",value:It(e.callCount),sub:"across all entities"}),y.jsx($a,{label:"Avg Cost / Call",value:e.callCount>0?Zn(e.totalCostUsd/e.callCount):"$0.00",sub:`over ${e.callCount} calls`})]}),y.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-3",children:[y.jsxs("div",{className:"glass-card border border-white/[0.07] rounded-2xl p-4",children:[y.jsx("p",{className:"text-[11px] font-mono text-zinc-500 mb-3",children:"Cost by entity"}),a.length>0?y.jsx(oh,{width:"100%",height:180,children:y.jsxs(kw,{data:a,barCategoryGap:"35%",children:[y.jsx(Au,{vertical:!1,stroke:"rgba(255,255,255,0.04)"}),y.jsx(Ba,{dataKey:"name",tick:{fill:"#52525b",fontSize:10,fontFamily:"JetBrains Mono, monospace"},axisLine:!1,tickLine:!1}),y.jsx(Ua,{tick:{fill:"#52525b",fontSize:10,fontFamily:"JetBrains Mono, monospace"},axisLine:!1,tickLine:!1,tickFormatter:o=>`$${o}`,width:40}),y.jsx(ln,{contentStyle:Kh,cursor:{fill:"rgba(255,255,255,0.03)"},formatter:o=>[`$${o.toFixed(2)}`,"Cost"]}),y.jsx(ea,{dataKey:"cost",fill:"url(#costGrad)",radius:[6,6,0,0]}),y.jsx("defs",{children:y.jsxs("linearGradient",{id:"costGrad",x1:"0",y1:"0",x2:"0",y2:"1",children:[y.jsx("stop",{offset:"0%",stopColor:"#E43A9C"}),y.jsx("stop",{offset:"100%",stopColor:"#D83333",stopOpacity:.7})]})})]})}):y.jsx("div",{className:"h-[180px] flex items-center justify-center text-zinc-700 text-[11px] font-mono",children:"No data"})]}),y.jsxs("div",{className:"glass-card border border-white/[0.07] rounded-2xl p-4",children:[y.jsx("p",{className:"text-[11px] font-mono text-zinc-500 mb-3",children:"Tokens by entity (k)"}),a.length>0?y.jsx(oh,{width:"100%",height:180,children:y.jsxs(kw,{data:a,barCategoryGap:"35%",children:[y.jsx(Au,{vertical:!1,stroke:"rgba(255,255,255,0.04)"}),y.jsx(Ba,{dataKey:"name",tick:{fill:"#52525b",fontSize:10,fontFamily:"JetBrains Mono, monospace"},axisLine:!1,tickLine:!1}),y.jsx(Ua,{tick:{fill:"#52525b",fontSize:10,fontFamily:"JetBrains Mono, monospace"},axisLine:!1,tickLine:!1,tickFormatter:o=>`${o}k`,width:40}),y.jsx(ln,{contentStyle:Kh,cursor:{fill:"rgba(255,255,255,0.03)"},formatter:o=>[`${o}k`,"Tokens"]}),y.jsx(ea,{dataKey:"tokens",fill:"url(#tokenGrad)",radius:[6,6,0,0]}),y.jsx("defs",{children:y.jsxs("linearGradient",{id:"tokenGrad",x1:"0",y1:"0",x2:"0",y2:"1",children:[y.jsx("stop",{offset:"0%",stopColor:"#818cf8"}),y.jsx("stop",{offset:"100%",stopColor:"#6366f1",stopOpacity:.7})]})})]})}):y.jsx("div",{className:"h-[180px] flex items-center justify-center text-zinc-700 text-[11px] font-mono",children:"No data"})]})]}),y.jsx("div",{className:"overflow-auto rounded-2xl border border-white/[0.07] glass-card",children:y.jsxs("table",{className:"w-full text-[11px] font-mono",children:[y.jsx("thead",{children:y.jsx("tr",{className:"border-b border-white/[0.06] bg-[#1a1a1a]",children:["Entity","Input","Output","Calls","Cost"].map(o=>y.jsx("th",{className:`text-left px-4 py-2.5 text-zinc-600 font-medium ${o==="Cost"?"text-right":""}`,children:o},o))})}),y.jsxs("tbody",{children:[i.map(o=>y.jsxs("tr",{className:"border-b border-white/[0.04] hover:bg-white/[0.015] transition-colors",children:[y.jsx("td",{className:"px-4 py-3 text-zinc-300",children:o.name}),y.jsx("td",{className:"px-4 py-3 text-zinc-500",children:It(o.inputTokens)}),y.jsx("td",{className:"px-4 py-3 text-zinc-500",children:It(o.outputTokens)}),y.jsx("td",{className:"px-4 py-3 text-zinc-500",children:o.calls}),y.jsx("td",{className:"px-4 py-3 text-right text-[#E43A9C]",children:Zn(o.cost)})]},o.name)),y.jsxs("tr",{className:"bg-[#1a1a1a]",children:[y.jsx("td",{className:"px-4 py-3 text-zinc-200 font-medium",children:"Total"}),y.jsx("td",{className:"px-4 py-3 text-zinc-300",children:It(e.totalInputTokens)}),y.jsx("td",{className:"px-4 py-3 text-zinc-300",children:It(e.totalOutputTokens)}),y.jsx("td",{className:"px-4 py-3 text-zinc-300",children:e.callCount}),y.jsx("td",{className:"px-4 py-3 text-right text-[#E43A9C] font-medium",children:Zn(e.totalCostUsd)})]})]})]})})]})}function Mne({records:t}){const[e,r]=P.useState([]),[n,i]=P.useState("cost"),[a,o]=P.useState("desc");function c(f){f===n?o(g=>g==="asc"?"desc":"asc"):(i(f),o("desc"))}const u=P.useMemo(()=>{const f=new Map;for(const v of t){if(!v.squadId)continue;const x=f.get(v.squadId)??{id:v.squadId,name:v.squadName??`${v.squadId.slice(0,8)} (deleted)`,agents:new Map,inputTokens:0,outputTokens:0,calls:0,cost:0};x.inputTokens+=v.inputTokens,x.outputTokens+=v.outputTokens,x.calls+=1,x.cost+=v.estimatedCostUsd??0;const _=`${v.agentRole??"unknown"}:${v.model}`,b=x.agents.get(_)??{role:v.agentRole??"unknown",model:v.model,inputTokens:0,outputTokens:0,calls:0,cost:0};b.inputTokens+=v.inputTokens,b.outputTokens+=v.outputTokens,b.calls+=1,b.cost+=v.estimatedCostUsd??0,x.agents.set(_,b),f.set(v.squadId,x)}return[...Array.from(f.values())].sort((v,x)=>{const _=v[n],b=x[n],S=typeof _=="string"?_.localeCompare(b):_-b;return a==="desc"?-S:S})},[t,n,a]),d=f=>r(g=>g.includes(f)?g.filter(v=>v!==f):[...g,f]),p=[{key:"name",label:"Squad"},{key:"inputTokens",label:"In"},{key:"outputTokens",label:"Out"},{key:"calls",label:"Calls"},{key:"cost",label:"Cost"}];return u.length===0?y.jsx("div",{className:"text-center py-12 text-zinc-700 text-[11px] font-mono",children:"No squad usage data"}):y.jsxs("div",{className:"space-y-2",children:[y.jsxs("div",{className:"flex items-center gap-1 px-1 mb-1",children:[y.jsx("span",{className:"text-[10px] font-mono text-zinc-700 mr-1",children:"sort by"}),p.map(f=>y.jsxs("button",{type:"button",onClick:()=>c(f.key),className:`flex items-center gap-0.5 px-2 py-1 rounded-lg text-[10px] font-mono transition-colors ${n===f.key?"text-[#E43A9C]":"text-zinc-600 hover:text-zinc-400 hover:bg-white/[0.04]"}`,style:n===f.key?{background:"rgba(228,58,156,0.1)"}:void 0,children:[f.label,n===f.key&&y.jsx("span",{className:"text-[9px]",children:a==="desc"?"↓":"↑"})]},f.key))]}),u.map(f=>{const g=e.includes(f.id),v=Array.from(f.agents.values());return y.jsxs("div",{className:"glass-card border border-white/[0.07] rounded-2xl overflow-hidden",children:[y.jsxs("button",{type:"button",onClick:()=>d(f.id),className:"w-full flex items-center gap-3 px-4 py-3.5 hover:bg-white/[0.02] transition-colors text-left cursor-pointer",children:[y.jsx("div",{className:`transition-transform ${g?"rotate-90":""}`,children:y.jsx($w,{className:"w-3.5 h-3.5 text-zinc-600"})}),y.jsx("span",{className:"text-sm font-mono text-zinc-100 flex-1",children:f.name}),y.jsxs("div",{className:"flex items-center gap-6 text-[11px] font-mono",children:[y.jsxs("span",{className:"text-zinc-500 hidden sm:block",children:[y.jsx("span",{className:"text-zinc-700 mr-1",children:"in"}),It(f.inputTokens)]}),y.jsxs("span",{className:"text-zinc-500 hidden sm:block",children:[y.jsx("span",{className:"text-zinc-700 mr-1",children:"out"}),It(f.outputTokens)]}),y.jsxs("span",{className:"text-zinc-500",children:[y.jsx("span",{className:"text-zinc-700 mr-1",children:"calls"}),f.calls]}),y.jsx("span",{className:"text-[#E43A9C] font-medium w-16 text-right",children:Zn(f.cost)})]})]}),g&&y.jsx("div",{className:"border-t border-white/[0.05]",children:y.jsxs("table",{className:"w-full text-[11px] font-mono",children:[y.jsx("thead",{children:y.jsx("tr",{className:"bg-[#191919]",children:["Agent","Model","Input","Output","Calls","Cost"].map(x=>y.jsx("th",{className:`text-left px-4 py-2 text-zinc-700 font-medium ${x==="Cost"?"text-right":""}`,children:x},x))})}),y.jsx("tbody",{children:v.map(x=>y.jsxs("tr",{className:"border-t border-white/[0.04] hover:bg-white/[0.015] transition-colors",children:[y.jsx("td",{className:"px-4 py-2.5 text-zinc-300",children:x.role}),y.jsx("td",{className:"px-4 py-2.5 text-zinc-600",children:x.model}),y.jsx("td",{className:"px-4 py-2.5 text-zinc-500",children:It(x.inputTokens)}),y.jsx("td",{className:"px-4 py-2.5 text-zinc-500",children:It(x.outputTokens)}),y.jsx("td",{className:"px-4 py-2.5 text-zinc-500",children:x.calls}),y.jsx("td",{className:"px-4 py-2.5 text-right text-[#E43A9C]",children:Zn(x.cost)})]},x.role))})]})})]},f.id)})]})}function Lne({records:t}){const e=P.useMemo(()=>{const n=new Map;for(const i of t){const a=`${i.squadId??"io"}:${i.agentRole??"orchestrator"}:${i.model}`,o=n.get(a)??{name:i.agentRole??"orchestrator",squad:i.squadName??(i.squadId?i.squadId.slice(0,8):"IO"),model:i.model,inputTokens:0,outputTokens:0,calls:0,cost:0};o.inputTokens+=i.inputTokens,o.outputTokens+=i.outputTokens,o.calls+=1,o.cost+=i.estimatedCostUsd??0,n.set(a,o)}return Array.from(n.values()).sort((i,a)=>a.cost-i.cost)},[t]),r=e.reduce((n,i)=>n+i.cost,0);return y.jsx("div",{className:"overflow-auto rounded-2xl border border-white/[0.07] glass-card",children:y.jsxs("table",{className:"w-full text-[11px] font-mono",children:[y.jsx("thead",{children:y.jsx("tr",{className:"border-b border-white/[0.06] bg-[#1a1a1a]",children:["Agent","Squad","Model","Input","Output","Calls","Cost","% of total"].map(n=>y.jsx("th",{className:`text-left px-4 py-2.5 text-zinc-600 font-medium ${n==="Cost"?"text-right":""}`,children:n},n))})}),y.jsx("tbody",{children:e.map(n=>y.jsxs("tr",{className:"border-b border-white/[0.04] hover:bg-white/[0.015] transition-colors",children:[y.jsx("td",{className:"px-4 py-3 text-zinc-300",children:n.name}),y.jsx("td",{className:"px-4 py-3 text-zinc-600",children:n.squad}),y.jsx("td",{className:"px-4 py-3 text-zinc-600",children:n.model}),y.jsx("td",{className:"px-4 py-3 text-zinc-500",children:It(n.inputTokens)}),y.jsx("td",{className:"px-4 py-3 text-zinc-500",children:It(n.outputTokens)}),y.jsx("td",{className:"px-4 py-3 text-zinc-500",children:n.calls}),y.jsx("td",{className:"px-4 py-3 text-right text-[#E43A9C]",children:Zn(n.cost)}),y.jsx("td",{className:"px-4 py-3",children:y.jsxs("div",{className:"flex items-center gap-2",children:[y.jsx("div",{className:"w-16 h-1.5 rounded-full bg-[#252525] overflow-hidden",children:y.jsx("div",{className:"h-full bg-[#E43A9C] rounded-full",style:{width:`${r>0?n.cost/r*100:0}%`}})}),y.jsx("span",{className:"text-zinc-600 text-[10px]",children:r>0?`${(n.cost/r*100).toFixed(1)}%`:"0%"})]})})]},`${n.squad}:${n.name}`))})]})})}function Dne({records:t}){const e=P.useMemo(()=>t.filter(o=>!o.squadId),[t]),r=P.useMemo(()=>{const o=new Map;for(const c of e){const u=`${c.agentRole??"orchestrator"}:${c.model}`,d=o.get(u)??{name:c.agentRole??"orchestrator",model:c.model,inputTokens:0,outputTokens:0,calls:0,cost:0};d.inputTokens+=c.inputTokens,d.outputTokens+=c.outputTokens,d.calls+=1,d.cost+=c.estimatedCostUsd??0,o.set(u,d)}return Array.from(o.values()).sort((c,u)=>u.cost-c.cost)},[e]),n=e.reduce((o,c)=>o+c.inputTokens,0),i=e.reduce((o,c)=>o+c.outputTokens,0),a=e.reduce((o,c)=>o+(c.estimatedCostUsd??0),0);return y.jsxs("div",{className:"space-y-5",children:[y.jsxs("div",{className:"grid grid-cols-2 lg:grid-cols-4 gap-3",children:[y.jsx($a,{label:"IO Tokens",value:It(n+i),sub:`${It(n)} in · ${It(i)} out`}),y.jsx($a,{label:"IO Cost",value:Zn(a),accent:!0}),y.jsx($a,{label:"IO Calls",value:It(e.length)}),y.jsx($a,{label:"IO Roles",value:String(r.length)})]}),y.jsx("div",{className:"overflow-auto rounded-2xl border border-white/[0.07] glass-card",children:y.jsxs("table",{className:"w-full text-[11px] font-mono",children:[y.jsx("thead",{children:y.jsx("tr",{className:"border-b border-white/[0.06] bg-[#1a1a1a]",children:["Role","Model","Input","Output","Calls","Cost"].map(o=>y.jsx("th",{className:`text-left px-4 py-2.5 text-zinc-600 font-medium ${o==="Cost"?"text-right":""}`,children:o},o))})}),y.jsx("tbody",{children:r.map(o=>y.jsxs("tr",{className:"border-b border-white/[0.04] hover:bg-white/[0.015] transition-colors",children:[y.jsx("td",{className:"px-4 py-3 text-zinc-300",children:o.name}),y.jsx("td",{className:"px-4 py-3 text-zinc-600",children:o.model}),y.jsx("td",{className:"px-4 py-3 text-zinc-500",children:It(o.inputTokens)}),y.jsx("td",{className:"px-4 py-3 text-zinc-500",children:It(o.outputTokens)}),y.jsx("td",{className:"px-4 py-3 text-zinc-500",children:o.calls}),y.jsx("td",{className:"px-4 py-3 text-right text-[#E43A9C]",children:Zn(o.cost)})]},o.name))})]})})]})}function zne({records:t}){const e=qa(),r=P.useMemo(()=>{const i=new Map;for(const a of t){const o=a.timestamp.slice(0,10),c=i.get(o)??{date:o,inputTokens:0,outputTokens:0,cost:0,calls:0};c.inputTokens+=a.inputTokens,c.outputTokens+=a.outputTokens,c.cost+=a.estimatedCostUsd??0,c.calls+=1,i.set(o,c)}return Array.from(i.values()).sort((a,o)=>a.date.localeCompare(o.date))},[t]),n=r.map(i=>({...i,label:Z4(i.date,e),tokens:i.inputTokens+i.outputTokens}));return y.jsxs("div",{className:"space-y-5",children:[y.jsxs("div",{className:"glass-card border border-white/[0.07] rounded-2xl p-5",children:[y.jsx("p",{className:"text-[11px] font-mono text-zinc-500 mb-3",children:"Tokens per day"}),n.length>0?y.jsx(oh,{width:"100%",height:220,children:y.jsxs(Pne,{data:n,children:[y.jsx(Au,{vertical:!1,stroke:"rgba(255,255,255,0.04)"}),y.jsx(Ba,{dataKey:"label",tick:{fill:"#52525b",fontSize:10,fontFamily:"JetBrains Mono, monospace"},axisLine:!1,tickLine:!1}),y.jsx(Ua,{tick:{fill:"#52525b",fontSize:10,fontFamily:"JetBrains Mono, monospace"},axisLine:!1,tickLine:!1,tickFormatter:It,width:44}),y.jsx(ln,{contentStyle:Kh,cursor:{fill:"rgba(255,255,255,0.03)"},formatter:i=>[It(i),"Tokens"]}),y.jsx(Hu,{type:"monotone",dataKey:"tokens",stroke:"#E43A9C",strokeWidth:2,dot:!1})]})}):y.jsx("div",{className:"h-[220px] flex items-center justify-center text-zinc-700 text-[11px] font-mono",children:"No data"})]}),y.jsxs("div",{className:"glass-card border border-white/[0.07] rounded-2xl p-5",children:[y.jsx("p",{className:"text-[11px] font-mono text-zinc-500 mb-3",children:"Cost per day"}),n.length>0?y.jsx(oh,{width:"100%",height:180,children:y.jsxs(kw,{data:n,barCategoryGap:"20%",children:[y.jsx(Au,{vertical:!1,stroke:"rgba(255,255,255,0.04)"}),y.jsx(Ba,{dataKey:"label",tick:{fill:"#52525b",fontSize:10,fontFamily:"JetBrains Mono, monospace"},axisLine:!1,tickLine:!1}),y.jsx(Ua,{tick:{fill:"#52525b",fontSize:10,fontFamily:"JetBrains Mono, monospace"},axisLine:!1,tickLine:!1,tickFormatter:i=>`$${i.toFixed(2)}`,width:44}),y.jsx(ln,{contentStyle:Kh,cursor:{fill:"rgba(255,255,255,0.03)"},formatter:i=>[Zn(i),"Cost"]}),y.jsx(ea,{dataKey:"cost",fill:"url(#costGradTl)",radius:[4,4,0,0]}),y.jsx("defs",{children:y.jsxs("linearGradient",{id:"costGradTl",x1:"0",y1:"0",x2:"0",y2:"1",children:[y.jsx("stop",{offset:"0%",stopColor:"#E43A9C"}),y.jsx("stop",{offset:"100%",stopColor:"#D83333",stopOpacity:.7})]})})]})}):y.jsx("div",{className:"h-[180px] flex items-center justify-center text-zinc-700 text-[11px] font-mono",children:"No data"})]}),y.jsx("div",{className:"overflow-auto rounded-2xl border border-white/[0.07] glass-card",children:y.jsxs("table",{className:"w-full text-[11px] font-mono",children:[y.jsx("thead",{children:y.jsx("tr",{className:"border-b border-white/[0.06] bg-[#1a1a1a]",children:["Date","Input","Output","Calls","Cost"].map(i=>y.jsx("th",{className:`text-left px-4 py-2.5 text-zinc-600 font-medium ${i==="Cost"?"text-right":""}`,children:i},i))})}),y.jsx("tbody",{children:r.map(i=>y.jsxs("tr",{className:"border-b border-white/[0.04] hover:bg-white/[0.015] transition-colors",children:[y.jsx("td",{className:"px-4 py-3 text-zinc-300",children:i.date}),y.jsx("td",{className:"px-4 py-3 text-zinc-500",children:It(i.inputTokens)}),y.jsx("td",{className:"px-4 py-3 text-zinc-500",children:It(i.outputTokens)}),y.jsx("td",{className:"px-4 py-3 text-zinc-500",children:i.calls}),y.jsx("td",{className:"px-4 py-3 text-right text-[#E43A9C]",children:Zn(i.cost)})]},i.date))})]})})]})}function Bne(){const[t,e]=P.useState("summary"),[r,n]=P.useState(null),[i,a]=P.useState("14d"),o=["summary","by squad","by agent","io","timeline"];if(P.useEffect(()=>{const u=new Date;i==="7d"?u.setDate(u.getDate()-7):i==="14d"?u.setDate(u.getDate()-14):i==="30d"?u.setDate(u.getDate()-30):u.setDate(u.getDate()-1),Ve.get(`/usage?since=${u.toISOString()}`).then(n).catch(()=>{})},[i]),!r)return y.jsx("div",{className:"h-full flex items-center justify-center text-zinc-600 font-mono text-[11px]",children:"Loading..."});const c=i==="1d"?"Today":`Last ${i}`;return y.jsxs("div",{className:"flex-1 overflow-y-auto p-6",children:[y.jsxs("div",{className:"flex items-start justify-between mb-5 gap-4 flex-wrap",children:[y.jsxs("div",{children:[y.jsx("h2",{className:"text-2xl tracking-wide text-zinc-100",style:{fontFamily:"'Bebas Neue', sans-serif"},children:"Usage"}),y.jsx("p",{className:"text-[11px] text-zinc-600 font-mono mt-0.5",children:c})]}),y.jsx("div",{className:"flex gap-1 p-1 rounded-xl bg-white/[0.03] border border-white/[0.07]",children:["1d","7d","14d","30d"].map(u=>y.jsx("button",{type:"button",onClick:()=>a(u),className:`px-3 py-1.5 rounded-lg text-[11px] font-mono transition-colors cursor-pointer ${i===u?"text-[#E43A9C]":"text-zinc-600 hover:text-zinc-400"}`,style:i===u?{background:"rgba(228,58,156,0.12)"}:void 0,children:u},u))})]}),y.jsx(Ine,{tabs:o,active:t,onChange:u=>e(u)}),t==="summary"&&y.jsx($ne,{records:r.records,totals:r.totals}),t==="by squad"&&y.jsx(Mne,{records:r.records}),t==="by agent"&&y.jsx(Lne,{records:r.records}),t==="io"&&y.jsx(Dne,{records:r.records}),t==="timeline"&&y.jsx(zne,{records:r.records})]})}function EM(t){return[...t].sort((e,r)=>e.isDir!==r.isDir?e.isDir?-1:1:e.name.localeCompare(r.name)).map(e=>({...e,children:EM(e.children)}))}function Une(t){const e=[];for(const r of t){const n=r.path.split("/").filter(Boolean);let i=e,a="";if(r.isDir){for(const o of n){a=a?`${a}/${o}`:o;let c=i.find(u=>u.path===a);c||(c={name:o,path:a,isDir:!0,children:[]},i.push(c)),i=c.children}continue}for(const[o,c]of n.entries()){const u=o===n.length-1;a=a?`${a}/${c}`:c;let d=i.find(p=>p.path===a);d||(d={name:u&&r.name||c,path:a,isDir:!u,children:[]},i.push(d)),i=d.children}}return EM(e)}function OM(t,e){return e?t.flatMap(r=>{const n=r.name.toLowerCase().includes(e)||r.path.toLowerCase().includes(e);if(!r.isDir)return n?[r]:[];if(n)return[r];const i=OM(r.children,e);return i.length?[{...r,children:i}]:[]}):t}function Ew(t){const e=new Set;for(const r of t)if(r.isDir){e.add(r.path);for(const n of Ew(r.children))e.add(n)}return e}function qne(t){const e=t.split("/").filter(Boolean),r=[];let n="";for(const i of e.slice(0,-1))n=n?`${n}/${i}`:i,r.push(n);return r}function AM({node:t,depth:e,selectedPage:r,expandedPaths:n,autoExpandedPaths:i,onToggle:a,onSelect:o,onAddToFolder:c,onDeleteFolder:u}){const d=r===t.path,p=t.isDir&&(n.has(t.path)||i.has(t.path)),f=12+e*16,g=t.isDir&&["io","shared","squads","templates"].includes(t.path);return t.isDir?y.jsxs("div",{children:[y.jsxs("div",{className:"flex w-full items-center group rounded-lg py-2 pr-3 text-left text-[11px] font-mono text-zinc-400 transition-colors hover:bg-white/[0.04] hover:text-zinc-200",style:{paddingLeft:f},children:[y.jsxs("button",{type:"button",onClick:()=>a(t.path),className:"flex items-center gap-2 flex-1 min-w-0",children:[y.jsx($w,{size:14,className:`shrink-0 transition-transform ${p?"rotate-90":""}`}),p?y.jsx(o4,{size:14,className:"shrink-0 text-zinc-500"}):y.jsx(l4,{size:14,className:"shrink-0 text-zinc-500"}),y.jsx("span",{className:"truncate",children:t.name})]}),y.jsxs("div",{className:"flex items-center gap-0.5",children:[!g&&y.jsx("button",{type:"button",onClick:v=>{v.stopPropagation(),u(t.path)},className:"opacity-0 group-hover:opacity-100 p-0.5 rounded hover:bg-red-500/20 transition-opacity text-zinc-600 hover:text-red-400",title:`Delete ${t.name}`,children:y.jsx(Ma,{size:12})}),y.jsx("button",{type:"button",onClick:v=>{v.stopPropagation(),c(t.path)},className:"opacity-0 group-hover:opacity-100 p-0.5 rounded hover:bg-white/[0.08] transition-opacity text-zinc-600 hover:text-zinc-300",title:`Add page to ${t.name}`,children:y.jsx(zw,{size:12})})]})]}),p&&y.jsx("div",{children:t.children.map(v=>y.jsx(AM,{node:v,depth:e+1,selectedPage:r,expandedPaths:n,autoExpandedPaths:i,onToggle:a,onSelect:o,onAddToFolder:c,onDeleteFolder:u},v.path))})]}):y.jsxs("button",{type:"button",onClick:()=>o(t.path),className:`flex w-full items-center gap-2 rounded-lg py-2 pr-3 text-left text-[11px] font-mono transition-colors ${d?"border-l-2 border-[#E43A9C] bg-[#E43A9C]/10 text-[#E43A9C]":"text-zinc-500 hover:bg-white/[0.04] hover:text-zinc-300"}`,style:{paddingLeft:f},children:[y.jsx(i4,{size:14,className:"shrink-0"}),y.jsx("span",{className:"truncate",children:t.name})]})}function Fne(){const[t,e]=P.useState([]),[r,n]=P.useState(null),[i,a]=P.useState(""),[o,c]=P.useState(!1),[u,d]=P.useState(""),[p,f]=P.useState(""),[g,v]=P.useState(""),[x,_]=P.useState(new Set),[b,S]=P.useState(!1),[A,O]=P.useState(null),j=P.useRef(null);P.useEffect(()=>{F()},[]);const E=P.useMemo(()=>Une(t),[t]),T=g.trim().toLowerCase(),N=P.useMemo(()=>OM(E,T),[E,T]),R=P.useMemo(()=>{const I=T?Ew(N):new Set;if(r)for(const $ of qne(r))I.add($);return I},[N,T,r]),M=r?(function I($){for(const V of $){if(V.path===r)return V;const oe=I(V.children);if(oe)return oe}return null})(N):null,J=(M==null?void 0:M.name)??(r?r.split("/").pop()??"":"");P.useEffect(()=>{const I=Ew(E);_($=>new Set([...$,...I]))},[E]);async function F(){try{const I=await Ve.get("/wiki/all");e(I.pages)}catch{e([])}}function B(I){if(I.startsWith("squads/")){const $=I.split("/"),V=$[1]??"",oe=$.slice(2).join("/");return{scope:V,relativePath:oe}}return I.startsWith("templates/")?{scope:"templates",relativePath:I.slice(10)}:I.startsWith("io/")?{scope:"io",relativePath:I.slice(3)}:I.startsWith("shared/")?{scope:"shared",relativePath:I.slice(7)}:{scope:"shared",relativePath:I}}async function K(I){try{const{scope:$,relativePath:V}=B(I),oe=await Ve.get(`/wiki/${$}/${V}`);a(oe.content),d(oe.content),n(I),c(!1)}catch{at.error("Failed to load page")}}async function W(){if(r)try{const{scope:I,relativePath:$}=B(r);await Ve.put(`/wiki/${I}/${$}`,{content:u}),a(u),c(!1),at.success("Page saved")}catch{at.error("Failed to save page")}}async function X(){if(r)try{const{scope:I,relativePath:$}=B(r);await Ve.delete(`/wiki/${I}/${$}`),at.success("Page deleted"),n(null),a(""),d(""),c(!1),F()}catch{at.error("Failed to delete page")}}function Y(I){f(`${I}/`),setTimeout(()=>{const $=j.current;$&&($.focus(),$.setSelectionRange($.value.length,$.value.length))},0)}function te(I){O(I)}async function H(){if(A)try{await Ve.delete(`/wiki/dir/${A}`),at.success(`Deleted ${A}`),r!=null&&r.startsWith(A)&&(n(null),a(""),d(""),c(!1)),F()}catch{at.error("Failed to delete directory")}finally{O(null)}}async function Q(){let I=p.trim().replace(/^\/+|\/+$/g,"");if(!I)return;I=I.replace(/\.md$/i,"");const $=I.startsWith("io/")||I.startsWith("shared/")||I.startsWith("squads/")?I:`shared/${I}`;S(!0);try{const{scope:V,relativePath:oe}=B($),le=oe.split("/").slice(-1)[0]??oe;await Ve.put(`/wiki/${V}/${oe}`,{content:`# ${le}
503
503
 
504
504
  `}),at.success("Page created"),f(""),await F(),await K($)}catch{at.error("Failed to create page")}finally{S(!1)}}function U(I){_($=>{const V=new Set($);return V.has(I)?V.delete(I):V.add(I),V})}return y.jsxs("div",{className:"flex h-full",children:[y.jsxs("div",{className:"flex h-full w-64 flex-col border-r border-white/[0.07] bg-[#181818]",children:[y.jsx("div",{className:"border-b border-white/[0.07] p-3",children:y.jsxs("div",{className:"relative",children:[y.jsx(eP,{className:"absolute left-2.5 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-zinc-600"}),y.jsx("input",{type:"text",value:g,onChange:I=>v(I.target.value),placeholder:"Search pages...",className:"w-full rounded-lg border border-white/[0.07] bg-white/[0.04] py-2 pl-8 pr-3 text-[11px] font-mono text-zinc-300 outline-none placeholder:text-zinc-700 focus:border-[#E43A9C]/50"})]})}),y.jsx("div",{className:"flex-1 overflow-y-auto px-2 py-3",children:N.length>0?N.map(I=>y.jsx(AM,{node:I,depth:0,selectedPage:r,expandedPaths:x,autoExpandedPaths:R,onToggle:U,onSelect:K,onAddToFolder:Y,onDeleteFolder:te},I.path)):y.jsx("p",{className:"py-4 text-center font-mono text-[11px] text-zinc-700",children:"No pages found"})}),y.jsx("div",{className:"border-t border-white/[0.07] p-3",children:y.jsxs("div",{className:"space-y-2",children:[y.jsx("input",{ref:j,type:"text",value:p,onChange:I=>f(I.target.value),onKeyDown:I=>{I.key==="Enter"&&Q(),I.key==="Escape"&&f("")},placeholder:"folder/new-page",className:"w-full rounded-lg border border-white/[0.07] bg-white/[0.04] px-3 py-2 text-[11px] font-mono text-zinc-300 outline-none placeholder:text-zinc-700 focus:border-[#E43A9C]/50"}),y.jsx(za,{onClick:Q,disabled:!p.trim()||b,className:"w-full justify-center px-3 py-2",children:b?y.jsxs(y.Fragment,{children:[y.jsx(js,{size:13,className:"animate-spin"})," Creating..."]}):y.jsxs(y.Fragment,{children:[y.jsx(zw,{size:13})," Add Page"]})})]})})]}),y.jsx("div",{className:"flex flex-1 flex-col overflow-hidden",children:r?y.jsxs(y.Fragment,{children:[y.jsxs("div",{className:"flex h-14 shrink-0 items-center justify-between border-b border-white/[0.07] px-6",children:[y.jsxs("div",{className:"min-w-0",children:[y.jsx("h3",{className:"truncate font-mono text-sm text-zinc-100",children:J}),y.jsxs("p",{className:"truncate font-mono text-[11px] text-zinc-500",children:[r,".md"]})]}),y.jsxs("div",{className:"flex items-center gap-2",children:[o?y.jsxs(y.Fragment,{children:[y.jsxs(za,{onClick:W,className:"px-3 py-1.5",children:[y.jsx(Bw,{size:12})," Save"]}),y.jsx(_i,{onClick:()=>{c(!1),d(i)},className:"px-3 py-1.5",children:"Cancel"})]}):y.jsxs(_i,{onClick:()=>{c(!0),d(i)},className:"px-3 py-1.5",children:[y.jsx(Ub,{size:12})," Edit"]}),y.jsxs(zf,{onClick:X,className:"px-3 py-1.5",children:[y.jsx(Ma,{size:12})," Delete"]})]})]}),y.jsx("div",{className:"flex-1 overflow-y-auto p-6",children:o?y.jsx("textarea",{value:u,onChange:I=>d(I.target.value),className:"h-full min-h-[320px] w-full resize-none rounded-xl border border-white/[0.07] bg-[#181818] p-4 font-mono text-sm text-zinc-300 outline-none focus:border-[#E43A9C]/50"}):y.jsx("div",{className:"mx-auto max-w-4xl",children:y.jsx("div",{className:"prose-io text-sm text-zinc-300",dangerouslySetInnerHTML:{__html:nt.parse(i)}})})})]}):y.jsx("div",{className:"flex h-full items-center justify-center",children:y.jsxs("div",{className:"text-center",children:[y.jsx(KN,{size:48,className:"mx-auto mb-3 text-zinc-800"}),y.jsx("p",{className:"font-mono text-[11px] text-zinc-700",children:"Select a page to view"})]})})}),A&&y.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60 backdrop-blur-sm",children:y.jsxs("div",{className:"w-full max-w-sm rounded-2xl border border-white/[0.07] bg-[#1a1a1a] p-6 shadow-2xl",children:[y.jsx("h3",{className:"mb-2 text-sm font-medium text-zinc-100",children:"Delete directory?"}),y.jsxs("p",{className:"mb-4 text-xs text-zinc-400",children:["This will permanently delete ",y.jsx("span",{className:"font-mono text-zinc-200",children:A})," and all its contents."]}),y.jsxs("div",{className:"flex justify-end gap-2",children:[y.jsx(_i,{onClick:()=>O(null),className:"px-3 py-1.5",children:"Cancel"}),y.jsxs(zf,{onClick:H,className:"px-3 py-1.5",children:[y.jsx(Ma,{size:12})," Delete"]})]})]})})]})}function Hne({children:t}){const{session:e,supabase:r,loading:n}=op();return n?y.jsx("div",{className:"min-h-screen flex items-center justify-center text-[var(--color-muted-foreground)]",children:"Loading..."}):r?e?y.jsx(y.Fragment,{children:t}):y.jsx(gq,{}):y.jsx(y.Fragment,{children:t})}function Wne(){const{pathname:t}=ti(),e=t==="/"||t==="/chat"||t.startsWith("/chat/");return y.jsxs(y.Fragment,{children:[y.jsx(yD,{children:y.jsxs(nn,{element:y.jsx(KU,{}),children:[y.jsx(nn,{index:!0,element:y.jsx(VU,{})}),y.jsx(nn,{path:"squads",element:y.jsx($g,{})}),y.jsx(nn,{path:"squads/:name",element:y.jsx($g,{})}),y.jsx(nn,{path:"squads/:name/instances/:instanceId",element:y.jsx($g,{})}),y.jsx(nn,{path:"feed",element:y.jsx(mq,{})}),y.jsx(nn,{path:"skills",element:y.jsx(Aq,{})}),y.jsx(nn,{path:"schedules",element:y.jsx(bq,{})}),y.jsx(nn,{path:"wiki",element:y.jsx(Fne,{})}),y.jsx(nn,{path:"settings",element:y.jsx(Sq,{})}),y.jsx(nn,{path:"usage",element:y.jsx(Bne,{})}),y.jsx(nn,{path:"*",element:y.jsx(pD,{to:"/",replace:!0})})]})}),!e&&y.jsx(Xz,{})]})}function Gne(){return y.jsx(HU,{children:y.jsx(Hne,{children:y.jsx(Y4,{children:y.jsx(sz,{children:y.jsx(Wne,{})})})})})}pL.createRoot(document.getElementById("root")).render(y.jsx(P.StrictMode,{children:y.jsxs(UD,{children:[y.jsx(Gne,{}),y.jsx(k5,{theme:"dark",position:"bottom-right"})]})}));
505
- //# sourceMappingURL=index-BtGuO--O.js.map
505
+ //# sourceMappingURL=index-B580vjXl.js.map