@forinda/kickjs-devtools 7.1.2 → 7.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +3 -2
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +4 -9
- package/dist/index.mjs.map +1 -1
- package/package.json +6 -7
- package/public/spa/assets/index.js +8 -1
- package/public/spa/assets/style.css +1 -1
|
@@ -1 +1,8 @@
|
|
|
1
|
-
(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))n(s);new MutationObserver(s=>{for(const i of s)if(i.type==="childList")for(const u of i.addedNodes)u.tagName==="LINK"&&u.rel==="modulepreload"&&n(u)}).observe(document,{childList:!0,subtree:!0});function r(s){const i={};return s.integrity&&(i.integrity=s.integrity),s.referrerPolicy&&(i.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?i.credentials="include":s.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function n(s){if(s.ep)return;s.ep=!0;const i=r(s);fetch(s.href,i)}})();var j={context:void 0,registry:void 0,effects:void 0,done:!1,getContextId(){return gt(this.context.count)},getNextContextId(){return gt(this.context.count++)}};function gt(e){const t=String(e),r=t.length-1;return j.context.id+(r?String.fromCharCode(96+r):"")+t}function Ze(e){j.context=e}function cr(){return{...j.context,id:j.getNextContextId(),count:0}}var ur=(e,t)=>e===t,dr=Symbol("solid-track"),De={equals:ur},ft=null,qt=Nt,te=1,Ee=2,Ot={owned:null,cleanups:null,context:null,owner:null},L=null,$=null,Ae=null,be=null,O=null,G=null,W=null,Ke=0;function je(e,t){const r=O,n=L,s=e.length===0,i=t===void 0?n:t,u=s?Ot:{owned:null,cleanups:null,context:i?i.context:null,owner:i},a=s?e:()=>e(()=>se(()=>he(u)));L=u,O=null;try{return ce(a,!0)}finally{O=r,L=n}}function x(e,t){t=t?Object.assign({},De,t):De;const r={value:e,observers:null,observerSlots:null,comparator:t.equals||void 0},n=s=>(typeof s=="function"&&($&&$.running&&$.sources.has(r)?s=s(r.tValue):s=s(r.value)),jt(r,s));return[Pt.bind(r),n]}function k(e,t,r){const n=at(e,t,!1,te);Ae&&$&&$.running?G.push(n):Le(n)}function it(e,t,r){qt=pr;const n=at(e,t,!1,te),s=et&&gr(et);s&&(n.suspense=s),(!r||!r.render)&&(n.user=!0),W?W.push(n):Le(n)}function P(e,t,r){r=r?Object.assign({},De,r):De;const n=at(e,t,!0,0);return n.observers=null,n.observerSlots=null,n.comparator=r.equals||void 0,Ae&&$&&$.running?(n.tState=te,G.push(n)):Le(n),Pt.bind(n)}function se(e){if(!be&&O===null)return e();const t=O;O=null;try{return be?be.untrack(e):e()}finally{O=t}}function xe(e){it(()=>se(e))}function ie(e){return L===null||(L.cleanups===null?L.cleanups=[e]:L.cleanups.push(e)),e}function hr(e){if($&&$.running)return e(),$.done;const t=O,r=L;return Promise.resolve().then(()=>{O=t,L=r;let n;return(Ae||et)&&(n=$||($={sources:new Set,effects:[],promises:new Set,disposed:new Set,queue:new Set,running:!0}),n.done||(n.done=new Promise(s=>n.resolve=s)),n.running=!0),ce(e,!1),O=L=null,n?n.done:void 0})}var[pa,vt]=x(!1);function gr(e){let t;return L&&L.context&&(t=L.context[e.id])!==void 0?t:e.defaultValue}var et;function Pt(){const e=$&&$.running;if(this.sources&&(e?this.tState:this.state))if((e?this.tState:this.state)===te)Le(this);else{const t=G;G=null,ce(()=>Ue(this),!1),G=t}if(O){const t=this.observers;if(!t||t[t.length-1]!==O){const r=t?t.length:0;O.sources?(O.sources.push(this),O.sourceSlots.push(r)):(O.sources=[this],O.sourceSlots=[r]),t?(t.push(O),this.observerSlots.push(O.sources.length-1)):(this.observers=[O],this.observerSlots=[O.sources.length-1])}}return e&&$.sources.has(this)?this.tValue:this.value}function jt(e,t,r){let n=$&&$.running&&$.sources.has(e)?e.tValue:e.value;if(!e.comparator||!e.comparator(n,t)){if($){const s=$.running;(s||!r&&$.sources.has(e))&&($.sources.add(e),e.tValue=t),s||(e.value=t)}else e.value=t;e.observers&&e.observers.length&&ce(()=>{for(let s=0;s<e.observers.length;s+=1){const i=e.observers[s],u=$&&$.running;u&&$.disposed.has(i)||((u?!i.tState:!i.state)&&(i.pure?G.push(i):W.push(i),i.observers&&It(i)),u?i.tState=te:i.state=te)}if(G.length>1e6)throw G=[],new Error},!1)}return t}function Le(e){if(!e.fn)return;he(e);const t=Ke;pt(e,$&&$.running&&$.sources.has(e)?e.tValue:e.value,t),$&&!$.running&&$.sources.has(e)&&queueMicrotask(()=>{ce(()=>{$&&($.running=!0),O=L=e,pt(e,e.tValue,t),O=L=null},!1)})}function pt(e,t,r){let n;const s=L,i=O;O=L=e;try{n=e.fn(t)}catch(u){return e.pure&&($&&$.running?(e.tState=te,e.tOwned&&e.tOwned.forEach(he),e.tOwned=void 0):(e.state=te,e.owned&&e.owned.forEach(he),e.owned=null)),e.updatedAt=r+1,ot(u)}finally{O=i,L=s}(!e.updatedAt||e.updatedAt<=r)&&(e.updatedAt!=null&&"observers"in e?jt(e,n,!0):$&&$.running&&e.pure?($.sources.has(e)||(e.value=n),$.sources.add(e),e.tValue=n):e.value=n,e.updatedAt=r)}function at(e,t,r,n=te,s){const i={fn:e,state:n,updatedAt:null,owned:null,sources:null,sourceSlots:null,cleanups:null,value:t,owner:L,context:L?L.context:null,pure:r};if($&&$.running&&(i.state=0,i.tState=n),L===null||L!==Ot&&($&&$.running&&L.pure?L.tOwned?L.tOwned.push(i):L.tOwned=[i]:L.owned?L.owned.push(i):L.owned=[i]),be&&i.fn){const u=i.fn,[a,c]=x(void 0,{equals:!1}),g=be.factory(u,c);ie(()=>g.dispose());let d,h=!1;const f=()=>hr(c).then(()=>{d&&(d.dispose(),d=void 0,h||c())});i.fn=p=>(a(),$&&$.running?(d||(d=be.factory(u,f)),d.track(p)):(h=!0,g.track(p)))}return i}function Te(e){const t=$&&$.running;if((t?e.tState:e.state)===0)return;if((t?e.tState:e.state)===Ee)return Ue(e);if(e.suspense&&se(e.suspense.inFallback))return e.suspense.effects.push(e);const r=[e];for(;(e=e.owner)&&(!e.updatedAt||e.updatedAt<Ke);){if(t&&$.disposed.has(e))return;(t?e.tState:e.state)&&r.push(e)}for(let n=r.length-1;n>=0;n--){if(e=r[n],t){let s=e,i=r[n+1];for(;(s=s.owner)&&s!==i;)if($.disposed.has(s))return}if((t?e.tState:e.state)===te)Le(e);else if((t?e.tState:e.state)===Ee){const s=G;G=null,ce(()=>Ue(e,r[0]),!1),G=s}}}function ce(e,t){if(G)return e();let r=!1;t||(G=[]),W?r=!0:W=[],Ke++;try{const n=e();return fr(r),n}catch(n){r||(W=null),G=null,ot(n)}}function fr(e){if(G&&(Ae&&$&&$.running?vr(G):Nt(G),G=null),e)return;let t;if($){if(!$.promises.size&&!$.queue.size){const n=$.sources,s=$.disposed;W.push.apply(W,$.effects),t=$.resolve;for(const i of W)"tState"in i&&(i.state=i.tState),delete i.tState;$=null,ce(()=>{for(const i of s)he(i);for(const i of n){if(i.value=i.tValue,i.owned)for(let u=0,a=i.owned.length;u<a;u++)he(i.owned[u]);i.tOwned&&(i.owned=i.tOwned),delete i.tValue,delete i.tOwned,i.tState=0}vt(!1)},!1)}else if($.running){$.running=!1,$.effects.push.apply($.effects,W),W=null,vt(!0);return}}const r=W;W=null,r.length&&ce(()=>qt(r),!1),t&&t()}function Nt(e){for(let t=0;t<e.length;t++)Te(e[t])}function vr(e){for(let t=0;t<e.length;t++){const r=e[t],n=$.queue;n.has(r)||(n.add(r),Ae(()=>{n.delete(r),ce(()=>{$.running=!0,Te(r)},!1),$&&($.running=!1)}))}}function pr(e){let t,r=0;for(t=0;t<e.length;t++){const n=e[t];n.user?e[r++]=n:Te(n)}if(j.context){if(j.count){j.effects||(j.effects=[]),j.effects.push(...e.slice(0,r));return}Ze()}for(j.effects&&(j.done||!j.count)&&(e=[...j.effects,...e],r+=j.effects.length,delete j.effects),t=0;t<r;t++)Te(e[t])}function Ue(e,t){const r=$&&$.running;r?e.tState=0:e.state=0;for(let n=0;n<e.sources.length;n+=1){const s=e.sources[n];if(s.sources){const i=r?s.tState:s.state;i===te?s!==t&&(!s.updatedAt||s.updatedAt<Ke)&&Te(s):i===Ee&&Ue(s,t)}}}function It(e){const t=$&&$.running;for(let r=0;r<e.observers.length;r+=1){const n=e.observers[r];(t?!n.tState:!n.state)&&(t?n.tState=Ee:n.state=Ee,n.pure?G.push(n):W.push(n),n.observers&&It(n))}}function he(e){let t;if(e.sources)for(;e.sources.length;){const r=e.sources.pop(),n=e.sourceSlots.pop(),s=r.observers;if(s&&s.length){const i=s.pop(),u=r.observerSlots.pop();n<s.length&&(i.sourceSlots[u]=n,s[n]=i,r.observerSlots[n]=u)}}if(e.tOwned){for(t=e.tOwned.length-1;t>=0;t--)he(e.tOwned[t]);delete e.tOwned}if($&&$.running&&e.pure)Dt(e,!0);else if(e.owned){for(t=e.owned.length-1;t>=0;t--)he(e.owned[t]);e.owned=null}if(e.cleanups){for(t=e.cleanups.length-1;t>=0;t--)e.cleanups[t]();e.cleanups=null}$&&$.running?e.tState=0:e.state=0}function Dt(e,t){if(t||(e.tState=0,$.disposed.add(e)),e.owned)for(let r=0;r<e.owned.length;r++)Dt(e.owned[r])}function mr(e){return e instanceof Error?e:new Error(typeof e=="string"?e:"Unknown error",{cause:e})}function mt(e,t,r){try{for(const n of t)n(e)}catch(n){ot(n,r&&r.owner||null)}}function ot(e,t=L){const r=ft&&t&&t.context&&t.context[ft],n=mr(e);if(!r)throw n;W?W.push({fn(){mt(n,r,t)},state:te}):mt(n,r,t)}var br=Symbol("fallback");function bt(e){for(let t=0;t<e.length;t++)e[t]()}function $r(e,t,r={}){let n=[],s=[],i=[],u=0,a=t.length>1?[]:null;return ie(()=>bt(i)),()=>{let c=e()||[],g=c.length,d,h;return c[dr],se(()=>{let p,m,y,_,C,w,E,S,T;if(g===0)u!==0&&(bt(i),i=[],n=[],s=[],u=0,a&&(a=[])),r.fallback&&(n=[br],s[0]=je(F=>(i[0]=F,r.fallback())),u=1);else if(u===0){for(s=new Array(g),h=0;h<g;h++)n[h]=c[h],s[h]=je(f);u=g}else{for(y=new Array(g),_=new Array(g),a&&(C=new Array(g)),w=0,E=Math.min(u,g);w<E&&n[w]===c[w];w++);for(E=u-1,S=g-1;E>=w&&S>=w&&n[E]===c[S];E--,S--)y[S]=s[E],_[S]=i[E],a&&(C[S]=a[E]);for(p=new Map,m=new Array(S+1),h=S;h>=w;h--)T=c[h],d=p.get(T),m[h]=d===void 0?-1:d,p.set(T,h);for(d=w;d<=E;d++)T=n[d],h=p.get(T),h!==void 0&&h!==-1?(y[h]=s[d],_[h]=i[d],a&&(C[h]=a[d]),h=m[h],p.set(T,h)):i[d]();for(h=w;h<g;h++)h in y?(s[h]=y[h],i[h]=_[h],a&&(a[h]=C[h],a[h](h))):s[h]=je(f);s=s.slice(0,u=g),n=c.slice(0)}return s});function f(p){if(i[h]=p,a){const[m,y]=x(h);return a[h]=y,t(c[h],m)}return t(c[h])}}}var xr=!1;function o(e,t){if(xr&&j.context){const r=j.context;Ze(cr());const n=se(()=>e(t||{}));return Ze(r),n}return se(()=>e(t||{}))}var yr=e=>`Stale read from <${e}>.`;function A(e){const t="fallback"in e&&{fallback:()=>e.fallback};return P($r(()=>e.each,e.children,t||void 0))}function b(e){const t=e.keyed,r=P(()=>e.when,void 0,void 0),n=t?r:P(r,void 0,{equals:(s,i)=>!s==!i});return P(()=>{const s=n();if(s){const i=e.children;return typeof i=="function"&&i.length>0?se(()=>i(t?s:()=>{if(!se(n))throw yr("Show");return r()})):i}return e.fallback},void 0,void 0)}var Re=e=>P(()=>e());function _r(e,t,r){let n=r.length,s=t.length,i=n,u=0,a=0,c=t[s-1].nextSibling,g=null;for(;u<s||a<i;){if(t[u]===r[a]){u++,a++;continue}for(;t[s-1]===r[i-1];)s--,i--;if(s===u){const d=i<n?a?r[a-1].nextSibling:r[i-a]:c;for(;a<i;)e.insertBefore(r[a++],d)}else if(i===a)for(;u<s;)(!g||!g.has(t[u]))&&t[u].remove(),u++;else if(t[u]===r[i-1]&&r[a]===t[s-1]){const d=t[--s].nextSibling;e.insertBefore(r[a++],t[u++].nextSibling),e.insertBefore(r[--i],d),t[s]=r[i]}else{if(!g){g=new Map;let h=a;for(;h<i;)g.set(r[h],h++)}const d=g.get(t[u]);if(d!=null)if(a<d&&d<i){let h=u,f=1,p;for(;++h<s&&h<i&&!((p=g.get(t[h]))==null||p!==d+f);)f++;if(f>d-a){const m=t[u];for(;a<d;)e.insertBefore(r[a++],m)}else e.replaceChild(r[a++],t[u++])}else u++;else t[u++].remove()}}}var $t="_$DX_DELEGATE";function wr(e,t,r,n={}){let s;return je(i=>{s=i,t===document?e():l(t,e(),t.firstChild?null:void 0,r)},n.owner),()=>{s(),t.textContent=""}}function v(e,t,r,n){let s;const i=()=>{const a=n?document.createElementNS("http://www.w3.org/1998/Math/MathML","template"):document.createElement("template");return a.innerHTML=e,r?a.content.firstChild.firstChild:n?a.firstChild:a.content.firstChild},u=t?()=>se(()=>document.importNode(s||(s=i()),!0)):()=>(s||(s=i())).cloneNode(!0);return u.cloneNode=u,u}function J(e,t=window.document){const r=t[$t]||(t[$t]=new Set);for(let n=0,s=e.length;n<s;n++){const i=e[n];r.has(i)||(r.add(i),t.addEventListener(i,kr))}}function N(e,t,r){ut(e)||(r==null?e.removeAttribute(t):e.setAttribute(t,r))}function B(e,t){ut(e)||(t==null?e.removeAttribute("class"):e.className=t)}function ct(e,t,r){if(!t)return r?N(e,"style"):t;const n=e.style;if(typeof t=="string")return n.cssText=t;typeof r=="string"&&(n.cssText=r=void 0),r||(r={}),t||(t={});let s,i;for(i in r)t[i]??n.removeProperty(i),delete r[i];for(i in t)s=t[i],s!==r[i]&&(n.setProperty(i,s),r[i]=s);return r}function Sr(e,t,r){return se(()=>e(t,r))}function l(e,t,r,n){if(r!==void 0&&!n&&(n=[]),typeof t!="function")return ze(e,t,n,r);k(s=>ze(e,t(),s,r),n)}function ut(e){return!!j.context&&!j.done&&(!e||e.isConnected)}function kr(e){if(j.registry&&j.events&&j.events.find(([c,g])=>g===e))return;let t=e.target;const r=`$$${e.type}`,n=e.target,s=e.currentTarget,i=c=>Object.defineProperty(e,"target",{configurable:!0,value:c}),u=()=>{const c=t[r];if(c&&!t.disabled){const g=t[`${r}Data`];if(g!==void 0?c.call(t,g,e):c.call(t,e),e.cancelBubble)return}return t.host&&typeof t.host!="string"&&!t.host._$host&&t.contains(e.target)&&i(t.host),!0},a=()=>{for(;u()&&(t=t._$host||t.parentNode||t.host););};if(Object.defineProperty(e,"currentTarget",{configurable:!0,get(){return t||document}}),j.registry&&!j.done&&(j.done=_$HY.done=!0),e.composedPath){const c=e.composedPath();i(c[0]);for(let g=0;g<c.length-2&&(t=c[g],!!u());g++){if(t._$host){t=t._$host,a();break}if(t.parentNode===s)break}}else a();i(n)}function ze(e,t,r,n,s){const i=ut(e);if(i){!r&&(r=[...e.childNodes]);let c=[];for(let g=0;g<r.length;g++){const d=r[g];d.nodeType===8&&d.data.slice(0,2)==="!$"?d.remove():c.push(d)}r=c}for(;typeof r=="function";)r=r();if(t===r)return r;const u=typeof t,a=n!==void 0;if(e=a&&r[0]&&r[0].parentNode||e,u==="string"||u==="number"){if(i||u==="number"&&(t=t.toString(),t===r))return r;if(a){let c=r[0];c&&c.nodeType===3?c.data!==t&&(c.data=t):c=document.createTextNode(t),r=pe(e,r,n,c)}else r!==""&&typeof r=="string"?r=e.firstChild.data=t:r=e.textContent=t}else if(t==null||u==="boolean"){if(i)return r;r=pe(e,r,n)}else{if(u==="function")return k(()=>{let c=t();for(;typeof c=="function";)c=c();r=ze(e,c,r,n)}),()=>r;if(Array.isArray(t)){const c=[],g=r&&Array.isArray(r);if(tt(c,t,r,s))return k(()=>r=ze(e,c,r,n,!0)),()=>r;if(i){if(!c.length)return r;if(n===void 0)return r=[...e.childNodes];let d=c[0];if(d.parentNode!==e)return r;const h=[d];for(;(d=d.nextSibling)!==n;)h.push(d);return r=h}if(c.length===0){if(r=pe(e,r,n),a)return r}else g?r.length===0?xt(e,c,n):_r(e,r,c):(r&&pe(e),xt(e,c));r=c}else if(t.nodeType){if(i&&t.parentNode)return r=a?[t]:t;if(Array.isArray(r)){if(a)return r=pe(e,r,n,t);pe(e,r,null,t)}else r==null||r===""||!e.firstChild?e.appendChild(t):e.replaceChild(t,e.firstChild);r=t}}return r}function tt(e,t,r,n){let s=!1;for(let i=0,u=t.length;i<u;i++){let a=t[i],c=r&&r[e.length],g;if(!(a==null||a===!0||a===!1))if((g=typeof a)=="object"&&a.nodeType)e.push(a);else if(Array.isArray(a))s=tt(e,a,c)||s;else if(g==="function")if(n){for(;typeof a=="function";)a=a();s=tt(e,Array.isArray(a)?a:[a],Array.isArray(c)?c:[c])||s}else e.push(a),s=!0;else{const d=String(a);c&&c.nodeType===3&&c.data===d?e.push(c):e.push(document.createTextNode(d))}}return s}function xt(e,t,r=null){for(let n=0,s=t.length;n<s;n++)e.insertBefore(t[n],r)}function pe(e,t,r,n){if(r===void 0)return e.textContent="";const s=n||document.createTextNode("");if(t.length){let i=!1;for(let u=t.length-1;u>=0;u--){const a=t[u];if(s!==a){const c=a.parentNode===e;!i&&!u?c?e.replaceChild(s,a):e.insertBefore(s,r):c&&a.remove()}else i=!0}}else e.insertBefore(s,r);return[s]}var Ut="kickjs-devtools-theme";function Cr(){try{const e=localStorage.getItem(Ut);if(e==="dark"||e==="light"||e==="system")return e}catch{}return"system"}function Er(){return typeof window>"u"||!window.matchMedia?"dark":window.matchMedia("(prefers-color-scheme: light)").matches?"light":"dark"}var[zt,Tr]=x(Cr()),[Mr,Ar]=x(Er());if(typeof window<"u"&&window.matchMedia){const e=window.matchMedia("(prefers-color-scheme: light)"),t=r=>Ar(r.matches?"light":"dark");e.addEventListener("change",t)}var Je=zt;function Ft(){const e=zt();return e==="system"?Mr():e}function Lr(e){Tr(e);try{localStorage.setItem(Ut,e)}catch{}}function Rr(){it(()=>{const e=Ft();document.documentElement.dataset.theme=e}),ie(()=>{delete document.documentElement.dataset.theme})}var Ht="kickjs-devtools-density";function Br(){try{const e=localStorage.getItem(Ht);if(e==="sm"||e==="md"||e==="lg")return e}catch{}return"sm"}var[Gt,qr]=x(Br()),yt=Gt;function Or(e){qr(e);try{localStorage.setItem(Ht,e)}catch{}}function Pr(){it(()=>{document.documentElement.dataset.density=Gt()}),ie(()=>{delete document.documentElement.dataset.density})}var[jr,Nr]=x("connecting"),[Ir,_t]=x(null),[Dr,Ur]=x(!1),[zr,Fr]=x(null),[Hr,Gr]=x(null),[Vr,Kr]=x(null),[Wr,Jr]=x([]),[Qr,Yr]=x([]),[Xr,Zr]=x({enabled:!1,queues:[]}),[en,tn]=x({enabled:!1}),M={connectionStatus:jr,lastUpdate:Ir,authRequired:Dr,authError:zr,health:Hr,metrics:Vr,routes:Wr,container:Qr,queues:Xr,ws:en},U={setConnectionStatus:Nr,setLastUpdate:_t,setAuthRequired:Ur,setAuthError:Fr,setHealth:Gr,setMetrics:Kr,setRoutes:Jr,setContainer:Yr,setQueues:Zr,setWs:tn,touch(){_t(new Date)}};function Q(e){return e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(1)} KiB`:e<1073741824?`${(e/1024/1024).toFixed(1)} MiB`:`${(e/1024/1024/1024).toFixed(2)} GiB`}function rn(e){if(e===0)return"0";const t=e*60;return Math.abs(t)<1048576?`${(t/1024).toFixed(1)} KiB/min`:`${(t/1024/1024).toFixed(1)} MiB/min`}function oe(e){return e<1?`${e.toFixed(2)} ms`:e<100?`${e.toFixed(1)} ms`:`${Math.round(e)} ms`}function dt(e){const t=Math.floor(e);return t<60?`${t}s`:t<3600?`${Math.floor(t/60)}m ${t%60}s`:`${Math.floor(t/3600)}h ${Math.floor(t%3600/60)}m ${t%60}s`}function Fe(e){return`${Math.round(e*100)}%`}var nn=v('<span class=dt-tip tabindex=0><svg class=dt-tip-icon viewBox="0 0 24 24"aria-hidden=true><circle cx=12 cy=12 r=9 fill=none stroke=currentColor stroke-width=1.5></circle><path d="M12 8h.01M12 11v6"stroke=currentColor stroke-width=2 stroke-linecap=round fill=none></path></svg><span role=tooltip>'),ln=v('<button type=button class="dt-tip dt-tip-clickable"><svg class=dt-tip-icon viewBox="0 0 24 24"aria-hidden=true><circle cx=12 cy=12 r=9 fill=none stroke=currentColor stroke-width=1.5></circle><path d="M12 8h.01M12 11v6"stroke=currentColor stroke-width=2 stroke-linecap=round fill=none>'),sn=v('<div class="fixed inset-0 z-50 bg-slate-950/80 flex items-center justify-center p-4"><div class="bg-slate-900 border border-slate-700 rounded-2xl p-6 max-w-lg w-full shadow-2xl max-h-[90vh] overflow-y-auto"><div class="flex items-start justify-between mb-4"><h2 class="text-lg font-semibold text-slate-200"></h2><button type=button class="text-slate-500 hover:text-slate-300 p-1"aria-label=Close><svg class="w-5 h-5"fill=none stroke=currentColor viewBox="0 0 24 24"><path stroke-linecap=round stroke-linejoin=round stroke-width=2 d="M6 18L18 6M6 6l12 12"></path></svg></button></div><div class="text-sm text-slate-300 space-y-3">'),rt={"heap.used":{short:"V8-allocated memory currently used by JavaScript objects.",detail:"Grows as your code allocates objects, shrinks after GC frees them. A consistently rising heap-used line on the sparkline is the textbook leak signature."},"heap.total":{short:"V8-allocated memory the JS heap is currently sized to use.",detail:"Larger than heap-used; V8 reserves headroom so allocations don't pause to grow the heap. Bumps up in 1-8 MiB jumps as the heap expands."},rss:{short:"Total memory resident in physical RAM for this Node process.",detail:'Includes the JS heap, native buffers, V8 internal structures, and code. Always larger than heap-used; the gap is "everything the OS sees" minus "JS objects".'},external:{short:"Memory used by C++ objects bound to JS (Buffers, native bindings)."},"array-buffers":{short:"Memory used by ArrayBuffer / SharedArrayBuffer instances."},"event-loop.p99":{short:"99% of event-loop ticks completed within this time.",detail:"Sustained values above ~50ms mean some synchronous operation is blocking the loop. Common culprits: large JSON.parse, sync crypto, blocking DB drivers."},gc:{short:"Garbage-collector activity since process start.",detail:"Total run count and cumulative pause time. Frequent GC with low reclaim ratio = leak; rare GC with healthy reclaim = good citizen."},"leak.risk":{short:"Heap-growth slope over the recent window — stable / warn / critical.",detail:"Bucketed from heap-growth in MB/min: <5 = ok, <20 = warn, ≥20 = critical. Critical sustained for >5 minutes is the moment to capture a heap snapshot."},"gc.reclaim":{short:"Average ratio of memory freed by each GC pass.",detail:"Trending toward zero means GC can't free anything — strong leak indicator. Healthy apps reclaim 20-60% on each major GC."},"heap.utilization":{short:"Fraction of V8's hard heap-size limit currently in use.",detail:"Approaching 1 means the process is close to OOM. Use --max-old-space-size to raise the limit if your workload is memory-bound."},requests:{short:"Total HTTP requests handled since process start."},"server-errors":{short:"5xx responses — server-side failures."},"client-errors":{short:"4xx responses — bad client input, missing routes, auth denials."},"error-rate":{short:"Server errors as a percentage of total requests.",detail:"Computed across the lifetime of the process. Spikes typically signal upstream dependency failures; sustained elevation = code bug."},uptime:{short:"How long this Node process has been running."},"latency.avg":{short:"Mean response time per route (sum of all calls / call count)."},"latency.p50":{short:"Median — half the requests complete faster than this."},"latency.p95":{short:"95% of requests complete within this time."},"latency.p99":{short:"99% of requests complete within this time. Outlier-sensitive."},"latency.max":{short:"Slowest single response observed since process start."},"resolve.count":{short:"Number of times this token was resolved from the DI container."},"resolve.duration":{short:"How long the container took to resolve this token (ms)."},"post-construct":{short:"@PostConstruct lifecycle status: done / failed / none.",detail:'A failed PostConstruct means the service registered but its async init threw. The token is left in a "registered" state; resolve() will throw the original error.'}},Y=e=>{const t=()=>e.text??rt[e.metric??""]?.short??"",r=e.placement??"top";return(()=>{var n=nn(),s=n.firstChild.nextSibling;return B(s,`dt-tip-pop dt-tip-pop-${r}`),l(s,t),k(()=>N(n,"aria-label",t())),n})()},an=e=>{const[t,r]=x(!1);return[(()=>{var n=ln();return n.$$click=()=>r(!0),k(()=>N(n,"aria-label",`More info: ${e.title}`)),n})(),o(b,{get when(){return t()},get children(){return o(on,{get title(){return e.title},onClose:()=>r(!1),get children(){return e.children}})}})]},on=e=>(()=>{var t=sn(),r=t.firstChild.firstChild,n=r.firstChild,s=n.nextSibling,i=r.nextSibling;return t.$$click=u=>{u.target===u.currentTarget&&e.onClose()},l(n,()=>e.title),s.$$click=()=>e.onClose(),l(i,()=>e.children),t})();J(["click"]);var cn=v('<div class="grid grid-cols-1 md:grid-cols-3 gap-4">'),un=v('<div class="bg-surface-1 rounded-xl border border-border p-5"><h2 class="text-xs font-semibold uppercase tracking-wider text-text-muted mb-3">Health'),Vt=v('<p class="text-text-muted italic">Loading…'),dn=v("<span>"),$e=v('<span class="font-semibold tabular-nums">'),Kt=v("<div class=mt-1>"),hn=v('<div class="border-t border-border mt-2 pt-2"><button type=button class="text-xs text-text-muted hover:text-text-strong flex items-center gap-1"><svg fill=none stroke=currentColor viewBox="0 0 24 24"aria-hidden=true><path stroke-linecap=round stroke-linejoin=round stroke-width=2 d="M9 5l7 7-7 7"></path></svg>Adapters (<!>)'),gn=v('<div class="flex items-center justify-between py-1"><span class="text-text-secondary text-sm"></span><span>'),fn=v('<div class="bg-surface-1 rounded-xl border border-border p-5"><h2 class="text-xs font-semibold uppercase tracking-wider text-text-muted mb-3">Metrics'),vn=v('<span class="font-semibold tabular-nums text-red-400">'),pn=v('<span class="font-semibold tabular-nums text-amber-400">'),mn=v('<span class="font-semibold text-sm">'),bn=v('<span class="font-semibold tabular-nums text-emerald-400">'),$n=v('<div class="border-t border-border mt-2 pt-2"><button type=button class="text-xs text-text-muted hover:text-text-strong flex items-center gap-1"><svg fill=none stroke=currentColor viewBox="0 0 24 24"aria-hidden=true><path stroke-linecap=round stroke-linejoin=round stroke-width=2 d="M9 5l7 7-7 7"></path></svg>Namespaces (<!>)'),xn=v('<div class="bg-surface-1 rounded-xl border border-border p-5"><h2 class="text-xs font-semibold uppercase tracking-wider text-text-muted mb-3">WebSocket'),yn=v('<p class="text-text-muted italic">No WsAdapter detected'),_n=v('<div class="flex items-center justify-between py-1"><span class="text-text-secondary text-sm font-mono"></span><span class=text-sm> conn / <!> handlers'),wn=v('<div class="flex items-center justify-between mb-2"><span class=text-text-secondary>'),Sn=()=>(()=>{var e=cn();return l(e,o(kn,{}),null),l(e,o(Cn,{}),null),l(e,o(En,{}),null),e})(),kn=()=>{const[e,t]=x(!0);return(()=>{var r=un();return r.firstChild,l(r,o(b,{get when(){return M.health()},get fallback(){return Vt()},children:n=>[o(re,{label:"Status",get children(){var s=dn();return l(s,()=>n().status),k(()=>B(s,`badge ${Tn(n().status)}`)),s}}),o(re,{label:"Uptime",get children(){var s=$e();return l(s,()=>dt(n().uptime)),s}}),o(re,{label:"Error rate",get children(){var s=$e();return l(s,()=>Fe(n().errorRate),null),l(s,o(Y,{metric:"error-rate"}),null),s}}),o(b,{get when(){return Object.keys(n().adapters).length>0},get children(){var s=hn(),i=s.firstChild,u=i.firstChild,a=u.nextSibling.nextSibling;return a.nextSibling,i.$$click=()=>t(c=>!c),l(i,()=>Object.keys(n().adapters).length,a),l(s,o(b,{get when(){return e()},get children(){var c=Kt();return l(c,o(A,{get each(){return Object.entries(n().adapters)},children:([g,d])=>(()=>{var h=gn(),f=h.firstChild,p=f.nextSibling;return l(f,g),B(p,`badge ${d==="running"?"badge-ok":"badge-warn"}`),l(p,d),h})()})),c}}),null),k(()=>N(u,"class",`w-3 h-3 transition-transform ${e()?"rotate-90":""}`)),s}})]}),null),r})()},Cn=()=>(()=>{var e=fn();return e.firstChild,l(e,o(b,{get when(){return M.metrics()},get fallback(){return Vt()},children:t=>[o(re,{label:"Total requests",get children(){var r=$e();return l(r,()=>t().requests.toLocaleString()),r}}),o(re,{label:"5xx errors",get children(){var r=vn();return l(r,()=>t().serverErrors),r}}),o(re,{label:"4xx errors",get children(){var r=pn();return l(r,()=>t().clientErrors),r}}),o(re,{label:"Started",get children(){var r=mn();return l(r,()=>new Date(t().startedAt).toLocaleTimeString()),r}})]}),null),e})(),En=()=>{const[e,t]=x(!1);return(()=>{var r=xn();return r.firstChild,l(r,o(b,{get when(){return M.ws().enabled},get fallback(){return yn()},get children(){return[o(re,{label:"Active",get children(){var n=bn();return l(n,()=>M.ws().activeConnections??0),n}}),o(re,{label:"Total",get children(){var n=$e();return l(n,()=>M.ws().totalConnections??0),n}}),o(re,{label:"Messages in",get children(){var n=$e();return l(n,()=>M.ws().messagesReceived??0),n}}),o(re,{label:"Messages out",get children(){var n=$e();return l(n,()=>M.ws().messagesSent??0),n}}),o(b,{get when(){return Re(()=>!!M.ws().namespaces)()&&Object.keys(M.ws().namespaces??{}).length>0},get children(){var n=$n(),s=n.firstChild,i=s.firstChild,u=i.nextSibling.nextSibling;return u.nextSibling,s.$$click=()=>t(a=>!a),l(s,()=>Object.keys(M.ws().namespaces??{}).length,u),l(n,o(b,{get when(){return e()},get children(){var a=Kt();return l(a,o(A,{get each(){return Object.entries(M.ws().namespaces??{})},children:([c,g])=>(()=>{var d=_n(),h=d.firstChild,f=h.nextSibling,p=f.firstChild,m=p.nextSibling;return m.nextSibling,l(h,c),l(f,()=>g.connections,p),l(f,()=>g.handlers,m),d})()})),a}}),null),k(()=>N(i,"class",`w-3 h-3 transition-transform ${e()?"rotate-90":""}`)),n}})]}}),null),r})()},re=e=>(()=>{var t=wn(),r=t.firstChild;return l(r,()=>e.label),l(t,()=>e.children,null),t})();function Tn(e){return e==="healthy"?"badge-ok":e==="degraded"?"badge-warn":"badge-critical"}J(["click"]);var Mn=v("<svg class=sparkline preserveAspectRatio=none aria-hidden=true><path fill=none stroke-width=1.5 stroke-linejoin=round stroke-linecap=round>"),Ne=e=>{const t=()=>e.width??200,n=P(()=>{const s=e.values;if(s.length<2)return"";const i=Math.min(...s),u=Math.max(...s)-i||1,a=t()/(s.length-1),c=d=>40-(d-i)/u*36-2;let g=`M0 ${c(s[0]).toFixed(2)}`;for(let d=1;d<s.length;d++)g+=` L${(d*a).toFixed(2)} ${c(s[d]).toFixed(2)}`;return g});return(()=>{var s=Mn(),i=s.firstChild;return k(u=>{var a=`0 0 ${t()} 40`,c=n(),g=e.stroke??"var(--color-accent)";return a!==u.e&&N(s,"viewBox",u.e=a),c!==u.t&&N(i,"d",u.t=c),g!==u.a&&N(i,"stroke",u.a=g),u},{e:void 0,t:void 0,a:void 0}),s})()};function ye(){return document.body.dataset.base??"/_debug"}var Wt="kickjs_devtools_token",An=30,Se=null;function ve(){if(Se)return Se;const e=new URLSearchParams(location.search).get("token");if(e){Jt(e);const r=new URL(location.href);return r.searchParams.delete("token"),history.replaceState({},"",r.toString()),e}const t=document.cookie.match(new RegExp(`${Wt}=([^;]+)`));return t?(Se=decodeURIComponent(t[1]),Se):null}function Jt(e){Se=e,document.cookie=`${Wt}=${encodeURIComponent(e)}; path=/; max-age=${86400*An}; SameSite=Lax`}function Qt(e){const t=ve();return t?`${e}${e.includes("?")?"&":"?"}token=${encodeURIComponent(t)}`:e}var Yt=class extends Error{constructor(){super("AUTH_REQUIRED"),this.name="AuthRequiredError"}};async function le(e){const t=Qt(`${ye()}${e}`),r=await fetch(t,{headers:Ln()});if(r.status===401||r.status===403)throw new Yt;if(!r.ok)throw new Error(`GET ${e} failed: ${r.status} ${r.statusText}`);return await r.json()}function Ln(){const e=ve();return e?{"x-devtools-token":e}:{}}var ee={runtime:()=>le("/runtime"),topology:()=>le("/topology"),metrics:()=>le("/metrics"),routes:()=>le("/metrics"),routeRegistry:()=>le("/routes"),container:()=>le("/container"),health:()=>le("/health"),queues:()=>le("/queues"),ws:()=>le("/ws"),tabs:()=>le("/tabs")};function ht(e,t,r){const n=Qt(`${ye()}${e}`),s=new EventSource(n);return s.addEventListener("message",i=>{try{t(JSON.parse(i.data))}catch(u){console.warn("SSE parse failed",u)}}),r&&s.addEventListener("error",r),()=>s.close()}var Rn=v("<div class=status><span><span></span></span><span> samples"),Bn=v("<div class=proc-strip><span class=proc-label>These stats are for <strong>this Node process</strong> — the one running your KickJS app.</span><span class=proc-meta><span class=proc-pill>Node </span><span class=proc-pill>/</span><span class=proc-pill>pid "),qn=v("<span>engine: "),On=v("<div class=empty>Loading runtime metrics…"),Pn=v("<div class=empty style=padding:0;text-align:left;font-size:11px>GC: <!> runs, <!> total"),wt=v("<div class=grid>"),jn=v("<div class=card><div class=card-header><div class=card-title></div><div class=card-value>"),Nn=()=>{const[e,t]=x(null),[r,n]=x(null),[s,i]=x([]),[u,a]=x([]),[c,g]=x([]),[d,h]=x(!1),f=p=>{t(p),i(m=>[...m,p.memory.heapUsed].slice(-60)),a(m=>[...m,p.memory.rss].slice(-60)),g(m=>[...m,p.eventLoop.p99].slice(-60))};return xe(()=>{ee.runtime().then(m=>{m.process&&n(m.process);for(const y of m.history)f(y);h(!0)}).catch(()=>h(!1));const p=ht("/runtime/stream",m=>{h(!0),f(m)},()=>h(!1));ie(p)}),[o(b,{get when(){return r()},children:p=>(()=>{var m=Bn(),y=m.firstChild.nextSibling,_=y.firstChild;_.firstChild;var C=_.nextSibling,w=C.firstChild,E=C.nextSibling;return E.firstChild,l(y,o(b,{get when(){return p().runtime},children:S=>(()=>{var T=qn();return T.firstChild,l(T,()=>S().name,null),k(()=>B(T,`proc-pill rt-${S().name}`)),T})()}),_),l(_,()=>p().nodeVersion,null),l(C,()=>p().platform,w),l(C,()=>p().arch,null),l(E,()=>p().pid,null),m})()}),o(b,{get when(){return e()},get fallback(){return On()},children:p=>[(()=>{var m=wt();return l(m,o(de,{title:"Heap used",metric:"heap.used",get value(){return Q(p().memory.heapUsed)},get children(){return o(Ne,{get values(){return s()}})}}),null),l(m,o(de,{title:"RSS",metric:"rss",get value(){return Q(p().memory.rss)},get children(){return o(Ne,{get values(){return u()}})}}),null),l(m,o(de,{title:"Event loop p99",metric:"event-loop.p99",get value(){return oe(p().eventLoop.p99)},get children(){return o(Ne,{get values(){return c()}})}}),null),l(m,o(de,{title:"Uptime",metric:"uptime",get value(){return dt(p().uptimeSec)},get children(){var y=Pn(),_=y.firstChild.nextSibling,C=_.nextSibling.nextSibling;return C.nextSibling,l(y,()=>p().gc.count,_),l(y,()=>oe(p().gc.totalPauseMs),C),y}}),null),m})(),(()=>{var m=wt();return l(m,o(de,{title:"External",metric:"external",get value(){return Q(p().memory.external)}}),null),l(m,o(de,{title:"Array buffers",metric:"array-buffers",get value(){return Q(p().memory.arrayBuffers)}}),null),l(m,o(de,{title:"Heap total",metric:"heap.total",get value(){return Q(p().memory.heapTotal)}}),null),l(m,o(de,{title:"CPU (last sample)",get value(){return`${(p().cpu.userMicros/1e3).toFixed(1)} ms u / ${(p().cpu.systemMicros/1e3).toFixed(1)} ms s`}}),null),m})()]}),(()=>{var p=Rn(),m=p.firstChild,y=m.firstChild,_=m.nextSibling,C=_.firstChild;return l(m,()=>d()?"streaming":"reconnecting…",null),l(_,()=>s().length,C),k(()=>B(y,`status-dot ${d()?"connected":"disconnected"}`)),p})()]},de=e=>(()=>{var t=jn(),r=t.firstChild.firstChild,n=r.nextSibling;return l(r,()=>e.title,null),l(r,o(b,{get when(){return e.metric},children:s=>o(Y,{get metric(){return s()}})}),null),l(n,()=>e.value),l(t,()=>e.children,null),t})(),In=v("<div class=status><span><span></span></span><span> samples"),Dn=v("<div class=empty>Loading memory metrics…"),St=v("<p>"),Un=v("<p><strong>Severity buckets</strong> (heap-growth in MB/min):"),zn=v('<ul class="list-disc pl-5 space-y-1"><li><span class="badge badge-ok">ok</span> < 5 MB/min — typical operation.</li><li><span class="badge badge-warn">warn</span> < 20 MB/min — investigate if sustained > 5 minutes.</li><li><span class="badge badge-critical">critical</span> ≥ 20 MB/min — capture a heap snapshot now.'),Fn=v("<div class=card><div class=card-header><div class=card-title>Leak risk</div><span></span></div><div style=display:flex;justify-content:space-between;align-items:baseline><div class=card-value> growth</div><div class=card-value style=font-size:13px;color:var(--text-dim)>GC reclaim<!> <!> • heap util<!> "),Hn=v("<div class=grid>"),Gn=v("<table><thead><tr><th>Type</th><th style=text-align:right>Count</th></tr></thead><tbody>"),Vn=v("<div class=card><div class=card-header><div class=card-title>Active handles</div><div class=card-value>"),Kn=v("<div class=empty>No handle inventory available on this runtime."),Wn=v("<tr><td></td><td style=text-align:right>"),Jn=v("<div class=card><div class=card-header><div class=card-title></div><div class=card-value>"),Qn=v('<div class=card><div class=card-header><div class=card-title>Heap snapshot</div><div class=card-value style=font-size:13px;color:var(--text-dim)>~<!> estimate</div></div><p style="margin:0 0 12px;color:var(--text-dim);font-size:12px">Captures a V8 heap snapshot for retained-size analysis in Chrome DevTools (Memory tab, Load profile). Capture blocks the event loop for several seconds — avoid in production.</p><div style=display:flex;align-items:center;gap:12px><button type=button class=tab style="border:1px solid var(--accent);border-radius:4px;padding:6px 14px;border-bottom-color:var(--accent);color:var(--accent)">'),Yn=v("<span style=color:var(--text-dim);font-size:12px;font-family:var(--font-mono)>Last: <!> (<!>)"),Xt=v('<p style="margin:8px 0 0;color:var(--critical);font-size:12px;font-family:var(--font-mono)">'),Xn=v('<div class=card><div class=card-header><div class=card-title>Force GC</div></div><p style="margin:0 0 12px;color:var(--text-dim);font-size:12px">Triggers a synchronous V8 GC pass to confirm whether heap growth is real retention or just uncollected garbage. Requires <code>node --expose-gc</code>.</p><div style=display:flex;align-items:center;gap:12px;flex-wrap:wrap><button type=button class=tab style="border:1px solid var(--accent);border-radius:4px;padding:6px 14px;border-bottom-color:var(--accent);color:var(--accent)">'),Zn=v("<span style=color:var(--text-dim);font-size:12px;font-family:var(--font-mono)>Reclaimed <!> (<!> → <!>) in <!>ms"),el=()=>{const[e,t]=x(null),[r,n]=x([]),[s,i]=x(!1),u=c=>{t(c),n(g=>[...g,c.snapshot.memory.heapUsed].slice(-60))};xe(()=>{ee.runtime().then(g=>{g.latest&&(u({snapshot:g.latest,health:g.health}),n(g.history.map(d=>d.memory.heapUsed).slice(-60))),i(!0)}).catch(()=>i(!1));const c=ht("/memory/stream",g=>{i(!0),u(g)},()=>i(!1));ie(c)});const a=P(()=>{const c=e();return c?Object.entries(c.health.handlesByType).toSorted((g,d)=>d[1]-g[1]):[]});return[o(b,{get when(){return e()},get fallback(){return Dn()},children:c=>[(()=>{var g=Fn(),d=g.firstChild,h=d.firstChild;h.firstChild;var f=h.nextSibling,p=d.nextSibling.firstChild,m=p.firstChild,y=p.nextSibling,_=y.firstChild.nextSibling,C=_.nextSibling.nextSibling,w=C.nextSibling.nextSibling;return w.nextSibling,l(h,o(an,{title:"What is leak risk?",get children(){return[(()=>{var E=St();return l(E,()=>rt["leak.risk"].short),E})(),(()=>{var E=St();return l(E,()=>rt["leak.risk"].detail),E})(),Un(),zn()]}}),null),l(f,()=>c().health.heapGrowthSeverity),l(p,()=>rn(c().health.heapGrowthBytesPerSec),m),l(y,o(Y,{metric:"gc.reclaim"}),_),l(y,()=>Fe(c().health.gcReclaimRatio),C),l(y,o(Y,{metric:"heap.utilization"}),w),l(y,()=>Fe(c().health.heapUtilization),null),l(g,o(Ne,{get values(){return r()}}),null),k(()=>B(f,`badge badge-${c().health.heapGrowthSeverity}`)),g})(),(()=>{var g=Hn();return l(g,o(Be,{title:"Heap used",metric:"heap.used",get value(){return Q(c().snapshot.memory.heapUsed)}}),null),l(g,o(Be,{title:"Heap total",metric:"heap.total",get value(){return Q(c().snapshot.memory.heapTotal)}}),null),l(g,o(Be,{title:"RSS",metric:"rss",get value(){return Q(c().snapshot.memory.rss)}}),null),l(g,o(Be,{title:"External",metric:"external",get value(){return Q(c().snapshot.memory.external)}}),null),g})(),(()=>{var g=Vn(),d=g.firstChild.firstChild.nextSibling;return l(d,()=>c().health.activeHandles),l(g,o(b,{get when(){return a().length>0},get fallback(){return Kn()},get children(){var h=Gn(),f=h.firstChild.nextSibling;return l(f,o(A,{get each(){return a()},children:([p,m])=>(()=>{var y=Wn(),_=y.firstChild,C=_.nextSibling;return l(_,p),l(C,m),y})()})),h}}),null),g})(),o(tl,{get heapTotal(){return c().snapshot.memory.heapTotal}}),o(ll,{})]}),(()=>{var c=In(),g=c.firstChild,d=g.firstChild,h=g.nextSibling,f=h.firstChild;return l(g,()=>s()?"streaming":"reconnecting…",null),l(h,()=>r().length,f),k(()=>B(d,`status-dot ${s()?"connected":"disconnected"}`)),c})()]},Be=e=>(()=>{var t=Jn(),r=t.firstChild.firstChild,n=r.nextSibling;return l(r,()=>e.title,null),l(r,o(b,{get when(){return e.metric},children:s=>o(Y,{get metric(){return s()}})}),null),l(n,()=>e.value),t})(),tl=e=>{const[t,r]=x(!1),[n,s]=x(null),[i,u]=x(null),a=async()=>{r(!0),s(null);try{const c=ve(),g=`${ye()}/memory/snapshot${c?`?token=${encodeURIComponent(c)}`:""}`,d=await fetch(g,{method:"POST",headers:c?{"x-devtools-token":c}:void 0});if(!d.ok){let p=`${d.status} ${d.statusText}`;try{const m=await d.json();m.error&&(p=m.error)}catch{}throw new Error(p)}const h=await d.blob(),f=rl(d.headers.get("content-disposition"))??`kickjs-heap-${Date.now()}.heapsnapshot`;nl(h,f),u({name:f,sizeBytes:h.size})}catch(c){s(c instanceof Error?c.message:String(c))}finally{r(!1)}};return(()=>{var c=Qn(),g=c.firstChild,d=g.firstChild.nextSibling,h=d.firstChild.nextSibling;h.nextSibling;var f=g.nextSibling.nextSibling,p=f.firstChild;return l(d,()=>Q(e.heapTotal),h),p.$$click=()=>{a()},l(p,()=>t()?"Capturing…":"Take snapshot"),l(f,o(b,{get when(){return i()},children:m=>(()=>{var y=Yn(),_=y.firstChild.nextSibling,C=_.nextSibling.nextSibling;return C.nextSibling,l(y,()=>m().name,_),l(y,()=>Q(m().sizeBytes),C),y})()}),null),l(c,o(b,{get when(){return n()},children:m=>(()=>{var y=Xt();return l(y,m),y})()}),null),k(()=>p.disabled=t()),c})()};function rl(e){if(!e)return null;const t=/filename="?([^";]+)"?/.exec(e);return t?t[1]:null}function nl(e,t){const r=URL.createObjectURL(e),n=document.createElement("a");n.href=r,n.download=t,document.body.appendChild(n),n.click(),document.body.removeChild(n),URL.revokeObjectURL(r)}var ll=()=>{const[e,t]=x(!1),[r,n]=x(null),[s,i]=x(null),u=async()=>{t(!0),i(null);try{const a=ve(),c=`${ye()}/memory/gc${a?`?token=${encodeURIComponent(a)}`:""}`,g=await fetch(c,{method:"POST",headers:a?{"x-devtools-token":a}:void 0});if(!g.ok){let d=`${g.status} ${g.statusText}`;try{const h=await g.json();h.error&&(d=h.error)}catch{}throw new Error(d)}n(await g.json())}catch(a){i(a instanceof Error?a.message:String(a))}finally{t(!1)}};return(()=>{var a=Xn(),c=a.firstChild.nextSibling.nextSibling,g=c.firstChild;return g.$$click=()=>{u()},l(g,()=>e()?"Collecting…":"Run GC"),l(c,o(b,{get when(){return r()},children:d=>(()=>{var h=Zn(),f=h.firstChild.nextSibling,p=f.nextSibling.nextSibling,m=p.nextSibling.nextSibling,y=m.nextSibling.nextSibling;return y.nextSibling,l(h,()=>Q(d().reclaimedBytes),f),l(h,()=>Q(d().before),p),l(h,()=>Q(d().after),m),l(h,()=>d().elapsedMs,y),h})()}),null),l(a,o(b,{get when(){return s()},children:d=>(()=>{var h=Xt();return l(h,d),h})()}),null),k(()=>g.disabled=e()),a})()};J(["click"]);var sl=v('<div class="flex items-center justify-between mt-4 pt-3 border-t border-slate-800 text-xs text-slate-500"><div class="flex items-center gap-3"><span>Showing <!>–<!> of </span><label class="flex items-center gap-1"><span class=text-slate-600>Per page</span><select class="bg-slate-800 border border-slate-700 rounded px-1.5 py-0.5 text-slate-200"></select></label></div><div class="flex items-center gap-1"><button type=button class="px-2.5 py-1 rounded border border-slate-700 bg-slate-800 hover:bg-slate-700 disabled:opacity-30">Prev</button><button type=button class="px-2.5 py-1 rounded border border-slate-700 bg-slate-800 hover:bg-slate-700 disabled:opacity-30">Next'),il=v("<option>"),al=v('<span class="px-1 text-slate-600">…'),ol=v("<button type=button>"),cl=[5,10,15,20,25,50,100];function ge(e,t={}){const r=t.pageSizeChoices??cl,n=t.pageSize??r[0]??5,[s,i]=x(n),[u,a]=x(1),c=P(()=>Math.max(1,Math.ceil(e().length/s()))),g=P(()=>Math.min(u(),c()));return{source:e,page:P(()=>{const d=(g()-1)*s();return e().slice(d,d+s())}),current:g,total:c,pageSize:s,pageSizeChoices:r,range:P(()=>{const d=e().length;return d===0?{start:0,end:0,total:0}:{start:(g()-1)*s()+1,end:Math.min(g()*s(),d),total:d}}),goto(d){a(Math.max(1,Math.min(d,c())))},next(){a(d=>Math.min(d+1,c()))},prev(){a(d=>Math.max(d-1,1))},setPageSize(d){i(d);const h=(g()-1)*s();a(Math.max(1,Math.floor(h/d)+1))}}}var fe=e=>{const t=P(()=>{const r=e.pager.total(),n=e.pager.current();if(r<=7)return Array.from({length:r},(a,c)=>c+1);const s=[1],i=Math.max(2,n-1),u=Math.min(r-1,n+1);i>2&&s.push("gap");for(let a=i;a<=u;a++)s.push(a);return u<r-1&&s.push("gap"),s.push(r),s});return o(b,{get when(){return e.pager.total()>1||e.pager.source().length>e.pager.pageSize()},get children(){var r=sl(),n=r.firstChild,s=n.firstChild,i=s.firstChild.nextSibling,u=i.nextSibling.nextSibling;u.nextSibling;var a=s.nextSibling.firstChild.nextSibling,c=n.nextSibling,g=c.firstChild,d=g.nextSibling;return l(s,()=>e.pager.range().start,i),l(s,()=>e.pager.range().end,u),l(s,()=>e.pager.range().total,null),a.addEventListener("change",h=>e.pager.setPageSize(Number(h.currentTarget.value))),l(a,o(A,{get each(){return e.pager.pageSizeChoices},children:h=>(()=>{var f=il();return f.value=h,l(f,h),f})()})),g.$$click=()=>e.pager.prev(),l(c,o(A,{get each(){return t()},children:h=>o(b,{when:h==="gap",get fallback(){return(()=>{var f=ol();return f.$$click=()=>e.pager.goto(h),l(f,h),k(()=>B(f,`px-2.5 py-1 rounded border ${h===e.pager.current()?"border-kick-500/30 bg-kick-500/20 text-kick-500":"border-slate-700 bg-slate-800 hover:bg-slate-700"}`)),f})()},get children(){return al()}})}),d),d.$$click=()=>e.pager.next(),k(h=>{var f=e.pager.current()===1,p=e.pager.current()===e.pager.total();return f!==h.e&&(g.disabled=h.e=f),p!==h.t&&(d.disabled=h.t=p),h},{e:void 0,t:void 0}),k(()=>a.value=e.pager.pageSize()),r}})};J(["click"]);var ul=v('<div style=display:flex;justify-content:space-between;align-items:center;margin-bottom:12px><h2 style=margin:0;font-size:16px>Topology</h2><button type=button class=tab style="border:1px solid var(--border);border-radius:4px;padding:4px 12px;border-bottom-color:var(--border)">'),dl=v("<div class=card style=border-color:var(--critical)><div class=card-title style=color:var(--critical)>Topology error</div><code>"),hl=v("<div class=empty>Loading topology…"),gl=v('<div class=card style=border-color:var(--warn)><div class=card-title style=color:var(--warn)> introspect failure(s)</div><ul style="margin:8px 0 0;padding-left:20px;font-family:var(--font-mono);font-size:12px">'),fl=v("<li>/<!>: "),vl=v("<table><thead><tr><th>Key</th><th>Source</th><th>Depends on</th></tr></thead><tbody>"),pl=v("<div class=card><div class=card-header><div class=card-title>Contributors (<!>)"),ml=v("<div class=empty>No contributors registered"),bl=v("<tr><td><span class=tree-key></span></td><td></td><td>"),$l=v("<table><thead><tr><th>Token</th><th>Scope</th><th>Kind</th><th>Resolved</th></tr></thead><tbody>"),xl=v("<div class=card><div class=card-header><div class=card-title>DI tokens (<!>)"),yl=v("<div class=empty>No DI tokens registered"),_l=v("<tr><td><span class=tree-key></span></td><td></td><td></td><td>"),wl=v("<div class=card><div class=card-header><div class=card-title>"),Sl=v("<div class=empty>"),kl=v("<span class=tree-meta>[<!>]"),Cl=v("<span class=tree-meta>v"),El=v("<span class=tree-meta>"),Tl=v("<div class=tree-meta>provides: "),Ml=v("<div class=tree-meta>requires: "),kt=v("<div class=tree-meta>"),Al=v("<div class=tree-node><span class=tree-key>"),Ct=v("<span style=margin-right:12px>: <strong style=color:var(--text)>"),Ll=()=>{const[e,t]=x(null),[r,n]=x(null),[s,i]=x(!1),u=async()=>{i(!0),n(null);try{t(await ee.topology())}catch(a){n(a instanceof Error?a.message:String(a))}finally{i(!1)}};return xe(()=>{u()}),[(()=>{var a=ul(),c=a.firstChild.nextSibling;return c.$$click=()=>{u()},l(c,()=>s()?"Refreshing…":"Refresh"),k(()=>c.disabled=s()),a})(),o(b,{get when(){return r()},children:a=>(()=>{var c=dl(),g=c.firstChild.nextSibling;return l(g,a),c})()}),o(b,{get when(){return e()},get fallback(){return hl()},children:a=>[o(b,{get when(){return a().errors.length>0},get children(){var c=gl(),g=c.firstChild,d=g.firstChild,h=g.nextSibling;return l(g,()=>a().errors.length,d),l(h,o(A,{get each(){return a().errors},children:f=>(()=>{var p=fl(),m=p.firstChild,y=m.nextSibling;return y.nextSibling,l(p,()=>f.kind,m),l(p,()=>f.name,y),l(p,()=>f.message,null),p})()})),c}}),o(Et,{get title(){return`Plugins (${a().plugins.length})`},get items(){return a().plugins},empty:"No plugins registered"}),o(Et,{get title(){return`Adapters (${a().adapters.length})`},get items(){return a().adapters},empty:"No adapters registered"}),o(Rl,{get rows(){return a().contributors}}),o(Bl,{get rows(){return a().diTokens}})]})]},Rl=e=>{const t=P(()=>e.rows??[]),r=ge(t);return(()=>{var n=pl(),s=n.firstChild.firstChild,i=s.firstChild.nextSibling;return i.nextSibling,l(s,()=>t().length,i),l(n,o(b,{get when(){return t().length>0},get fallback(){return ml()},get children(){return[(()=>{var u=vl(),a=u.firstChild.nextSibling;return l(a,o(A,{get each(){return r.page()},children:c=>(()=>{var g=bl(),d=g.firstChild,h=d.firstChild,f=d.nextSibling,p=f.nextSibling;return l(h,()=>c.key),l(f,()=>c.source),l(p,()=>c.dependsOn.join(", ")||"—"),g})()})),u})(),o(fe,{pager:r})]}}),null),n})()},Bl=e=>{const t=P(()=>e.rows??[]),r=ge(t);return(()=>{var n=xl(),s=n.firstChild.firstChild,i=s.firstChild.nextSibling;return i.nextSibling,l(s,()=>t().length,i),l(n,o(b,{get when(){return t().length>0},get fallback(){return yl()},get children(){return[(()=>{var u=$l(),a=u.firstChild.nextSibling;return l(a,o(A,{get each(){return r.page()},children:c=>(()=>{var g=_l(),d=g.firstChild,h=d.firstChild,f=d.nextSibling,p=f.nextSibling,m=p.nextSibling;return l(h,()=>c.token),l(f,()=>c.scope),l(p,()=>c.kind),l(m,()=>c.instantiated?"yes":"no"),g})()})),u})(),o(fe,{pager:r})]}}),null),n})()},Et=e=>(()=>{var t=wl(),r=t.firstChild.firstChild;return l(r,()=>e.title),l(t,o(b,{get when(){return e.items.length>0},get fallback(){return(()=>{var n=Sl();return l(n,()=>e.empty),n})()},get children(){return o(A,{get each(){return e.items},children:n=>o(Pl,{item:n})})}}),null),t})();function ql(e){return e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(1)} KB`:e<1073741824?`${(e/1048576).toFixed(1)} MB`:`${(e/1073741824).toFixed(1)} GB`}function Ol(e){if(typeof e!="object"||e===null)return String(e);try{return JSON.stringify(e)}catch{return"[unserializable]"}}var Pl=e=>(()=>{var t=Al(),r=t.firstChild;return l(r,()=>e.item.name),l(t,o(b,{get when(){return e.item.kind},get children(){var n=kl(),s=n.firstChild.nextSibling;return s.nextSibling,l(n,()=>e.item.kind,s),n}}),null),l(t,o(b,{get when(){return e.item.version},get children(){var n=Cl();return n.firstChild,l(n,()=>e.item.version,null),n}}),null),l(t,o(b,{get when(){return typeof e.item.memoryBytes=="number"},get children(){var n=El();return l(n,()=>ql(e.item.memoryBytes)),n}}),null),l(t,o(b,{get when(){return e.item.tokens?.provides.length},get children(){var n=Tl();return n.firstChild,l(n,()=>e.item.tokens?.provides.join(", "),null),n}}),null),l(t,o(b,{get when(){return e.item.tokens?.requires.length},get children(){var n=Ml();return n.firstChild,l(n,()=>e.item.tokens?.requires.join(", "),null),n}}),null),l(t,o(b,{get when(){return Re(()=>!!e.item.state)()&&Object.keys(e.item.state).length>0},get children(){var n=kt();return l(n,o(A,{get each(){return Object.entries(e.item.state??{})},children:([s,i])=>(()=>{var u=Ct(),a=u.firstChild,c=a.nextSibling;return l(u,s,a),l(c,()=>Ol(i)),u})()})),n}}),null),l(t,o(b,{get when(){return e.item.metrics},children:n=>(()=>{var s=kt();return l(s,o(A,{get each(){return Object.entries(n())},children:([i,u])=>(()=>{var a=Ct(),c=a.firstChild,g=c.nextSibling;return l(a,i,c),l(g,u),a})()})),s})()}),null),t})();J(["click"]);var jl=v("<div class=overflow-x-auto><table><thead><tr><th>Method</th><th>Path</th><th>Controller</th><th>Handler</th><th>Middleware</th></tr></thead><tbody>"),Nl=v('<div class="bg-surface-1 rounded-xl border border-border p-5"><div class="flex flex-col sm:flex-row gap-3 mb-4"><div class="relative flex-1"><svg class="absolute left-3 top-2.5 w-4 h-4 text-text-muted"fill=none stroke=currentColor viewBox="0 0 24 24"aria-hidden=true><path stroke-linecap=round stroke-linejoin=round stroke-width=2 d="M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"></path></svg><input type=text placeholder="Search routes (path, controller, handler)…"class="w-full bg-surface-2 border border-border-strong rounded-lg pl-10 pr-4 py-2 text-sm text-text-body placeholder:text-text-muted focus:outline-none focus:border-kick-500"></div><div class="flex gap-1">'),Il=v("<button type=button>"),Dl=v("<div class=empty>"),Ul=v('<tr><td><span></span></td><td class="font-mono text-sm"></td><td></td><td class=text-text-secondary></td><td class="text-text-muted text-xs">'),zl=["ALL","GET","POST","PUT","DELETE","PATCH"],Fl=()=>{const[e,t]=x(""),[r,n]=x("ALL"),s=P(()=>{let u=M.routes();r()!=="ALL"&&(u=u.filter(c=>c.method.toUpperCase()===r()));const a=e().trim().toLowerCase();return a&&(u=u.filter(c=>c.path.toLowerCase().includes(a)||c.controller.toLowerCase().includes(a)||c.handler.toLowerCase().includes(a))),u}),i=ge(()=>s());return(()=>{var u=Nl(),a=u.firstChild.firstChild,c=a.firstChild.nextSibling,g=a.nextSibling;return c.$$input=d=>t(d.currentTarget.value),l(g,o(A,{each:zl,children:d=>(()=>{var h=Il();return h.$$click=()=>n(d),l(h,d),k(()=>B(h,`px-3 py-1.5 text-xs font-semibold rounded-lg transition-colors border ${r()===d?"bg-kick-500/20 text-kick-500 border-kick-500/30":"bg-surface-2 text-text-secondary border-border-strong hover:text-text-body"}`)),h})()})),l(u,o(b,{get when(){return i.page().length>0},get fallback(){return(()=>{var d=Dl();return l(d,()=>e()||r()!=="ALL"?"No routes match the current filter":"No routes registered"),d})()},get children(){return[(()=>{var d=jl(),h=d.firstChild.firstChild.nextSibling;return l(h,o(A,{get each(){return i.page()},children:f=>(()=>{var p=Ul(),m=p.firstChild,y=m.firstChild,_=m.nextSibling,C=_.nextSibling,w=C.nextSibling,E=w.nextSibling;return l(y,()=>f.method),l(_,()=>f.path),l(C,()=>f.controller),l(w,()=>f.handler),l(E,(()=>{var S=Re(()=>!!f.middleware.length);return()=>S()?f.middleware.join(", "):"—"})()),k(()=>B(y,`text-xs font-bold ${Hl(f.method)}`)),p})()})),d})(),o(fe,{pager:i})]}}),null),k(()=>c.value=e()),u})()};function Hl(e){const t=e.toUpperCase();return t==="GET"?"text-emerald-400":t==="POST"?"text-cyan-400":t==="PUT"||t==="PATCH"?"text-amber-400":t==="DELETE"?"text-red-400":"text-text-secondary"}J(["input","click"]);var Gl=v("<div class=card style=border-color:var(--critical)><div class=card-title style=color:var(--critical)>Failed to load metrics</div><code>"),Vl=v("<div class=empty>Loading route metrics…"),Kl=v("<div class=grid>"),Wl=v("<table><thead><tr><th>Route</th><th style=text-align:right>Calls</th><th style=text-align:right>Avg</th><th style=text-align:right>p50</th><th style=text-align:right>p95</th><th style=text-align:right>p99</th><th style=text-align:right>Max</th></tr></thead><tbody>"),Jl=v("<div class=card><div class=card-header><div class=card-title>Per-route latency"),Ql=v("<div class=empty>No requests recorded yet"),Yl=v("<tr><td></td><td style=text-align:right></td><td style=text-align:right></td><td style=text-align:right></td><td style=text-align:right></td><td style=text-align:right></td><td style=text-align:right>"),Xl=v("<div class=card><div class=card-header><div class=card-title></div><div class=card-value>"),Zl=()=>{const[e,t]=x(null),[r,n]=x(null),s=async()=>{try{t(await ee.routes()),n(null)}catch(u){n(u instanceof Error?u.message:String(u))}};xe(()=>{s();const u=setInterval(()=>{s()},2e3);return()=>clearInterval(u)});const i=P(()=>{const u=e();return u?Object.entries(u.routeLatency).map(([a,c])=>Object.assign({key:a},c,{avg:c.count>0?c.totalMs/c.count:0})).toSorted((a,c)=>c.count-a.count):[]});return[o(b,{get when(){return r()},children:u=>(()=>{var a=Gl(),c=a.firstChild.nextSibling;return l(c,u),a})()}),o(b,{get when(){return e()},get fallback(){return Vl()},children:u=>[(()=>{var a=Kl();return l(a,o(we,{title:"Requests",metric:"requests",get value(){return u().requests.toString()}}),null),l(a,o(we,{title:"Server errors",metric:"server-errors",get value(){return u().serverErrors.toString()}}),null),l(a,o(we,{title:"Client errors",metric:"client-errors",get value(){return u().clientErrors.toString()}}),null),l(a,o(we,{title:"Error rate",metric:"error-rate",get value(){return Fe(u().errorRate)}}),null),l(a,o(we,{title:"Uptime",metric:"uptime",get value(){return dt(u().uptimeSeconds)}}),null),a})(),(()=>{var a=Jl();return a.firstChild,l(a,o(b,{get when(){return i().length>0},get fallback(){return Ql()},get children(){var c=Wl(),g=c.firstChild,d=g.firstChild.firstChild.nextSibling.nextSibling;d.firstChild;var h=d.nextSibling;h.firstChild;var f=h.nextSibling;f.firstChild;var p=f.nextSibling;p.firstChild;var m=p.nextSibling;m.firstChild;var y=g.nextSibling;return l(d,o(Y,{metric:"latency.avg",placement:"bottom"}),null),l(h,o(Y,{metric:"latency.p50",placement:"bottom"}),null),l(f,o(Y,{metric:"latency.p95",placement:"bottom"}),null),l(p,o(Y,{metric:"latency.p99",placement:"bottom"}),null),l(m,o(Y,{metric:"latency.max",placement:"bottom"}),null),l(y,o(A,{get each(){return i()},children:_=>(()=>{var C=Yl(),w=C.firstChild,E=w.nextSibling,S=E.nextSibling,T=S.nextSibling,F=T.nextSibling,I=F.nextSibling,q=I.nextSibling;return l(w,()=>_.key),l(E,()=>_.count),l(S,()=>oe(_.avg)),l(T,()=>oe(_.p50)),l(F,()=>oe(_.p95)),l(I,()=>oe(_.p99)),l(q,()=>oe(_.maxMs)),C})()})),c}}),null),a})()]})]},we=e=>(()=>{var t=Xl(),r=t.firstChild.firstChild,n=r.nextSibling;return l(r,()=>e.title,null),l(r,o(b,{get when(){return e.metric},children:s=>o(Y,{get metric(){return s()}})}),null),l(n,()=>e.value),t})(),es=v('<button type=button class="text-text-muted hover:text-text-strong p-1"aria-label=Back><svg class="w-4 h-4"fill=none stroke=currentColor viewBox="0 0 24 24"><path stroke-linecap=round stroke-linejoin=round stroke-width=2 d="M15 19l-7-7 7-7">'),Tt=v('<div class="flex flex-wrap gap-1">'),ts=v('<div class="bg-surface-2/50 rounded-lg border border-border-strong p-3 space-y-2 text-sm">'),rs=v("<span>"),ns=v('<div class="fixed inset-0 z-50 bg-black/70 flex items-center justify-center p-4"><div class="bg-surface-1 border border-border-strong rounded-2xl p-6 max-w-2xl w-full shadow-2xl max-h-[90vh] overflow-y-auto"><div class="flex items-start justify-between mb-4"><div><div class="flex items-center gap-2 mb-1"><h2 class="text-base font-semibold font-mono text-text-body break-all"></h2></div><div class="flex flex-wrap gap-2 mt-2"><span></span><span class="bg-border-strong/50 text-text-strong px-2 py-0.5 rounded text-xs font-semibold"></span><span></span></div></div><button type=button class="text-slate-500 hover:text-slate-300 p-1"aria-label=Close><svg class="w-5 h-5"fill=none stroke=currentColor viewBox="0 0 24 24"><path stroke-linecap=round stroke-linejoin=round stroke-width=2 d="M6 18L18 6M6 6l12 12">'),Mt=v('<span class="text-text-muted text-sm">None'),ls=v('<button type=button class="bg-surface-2 text-kick-500 hover:bg-border-strong px-2.5 py-1 rounded text-xs font-mono border border-border-strong transition-colors">'),ss=v('<button type=button class="bg-surface-2 text-amber-400 hover:bg-border-strong px-2.5 py-1 rounded text-xs font-mono border border-border-strong transition-colors">'),is=v('<div class=mb-4><h3 class="text-xs font-semibold uppercase tracking-wider text-text-muted mb-2">'),as=v('<div class="flex justify-between"><span class=text-text-secondary></span><span class=tabular-nums>'),[nt,Me]=x(null),[os,We]=x([]);function He(e){We([]),Me(e)}function At(e){const t=nt();t&&t!==e&&We(r=>[...r,t]),Me(e)}function cs(){We(e=>{if(e.length===0)return Me(null),e;const t=e.slice(0,-1);return Me(e[e.length-1]),t})}function Lt(){Me(null),We([])}var us=()=>{const e=P(()=>{const r=nt();if(!r)return null;const n=M.container().find(s=>s.token===r);return n||{token:r,kind:void 0,scope:void 0,dependencies:[]}}),t=P(()=>{const r=nt();return r?M.container().filter(n=>n.dependencies?.includes(r)).map(n=>n.token):[]});return o(b,{get when(){return e()},children:r=>(()=>{var n=ns(),s=n.firstChild,i=s.firstChild.firstChild,u=i.firstChild,a=u.firstChild,c=u.nextSibling.firstChild,g=c.nextSibling,d=g.nextSibling,h=i.nextSibling;return n.$$click=f=>{f.target===f.currentTarget&&Lt()},l(u,o(b,{get when(){return os().length>0},get children(){var f=es();return f.$$click=cs,f}}),a),l(a,()=>r().token),l(c,()=>r().kind??"unknown"),l(g,()=>r().scope??"singleton"),l(d,()=>gs(r())),h.$$click=Lt,l(s,o(qe,{title:"Dependencies",get children(){return o(b,{get when(){return(r().dependencies?.length??0)>0},get fallback(){return Mt()},get children(){var f=Tt();return l(f,o(A,{get each(){return r().dependencies},children:p=>(()=>{var m=ls();return m.$$click=()=>At(p),l(m,p),m})()})),f}})}}),null),l(s,o(qe,{title:"Dependents",get children(){return o(b,{get when(){return t().length>0},get fallback(){return Mt()},get children(){var f=Tt();return l(f,o(A,{get each(){return t()},children:p=>(()=>{var m=ss();return m.$$click=()=>At(p),l(m,p),m})()})),f}})}}),null),l(s,o(qe,{title:"Resolve stats",get children(){var f=ts();return l(f,o(Oe,{label:"Resolve count",get value(){return String(r().resolveCount??0)}}),null),l(f,o(b,{get when(){return r().firstResolved},children:p=>o(Oe,{label:"First resolved",get value(){return new Date(p()).toLocaleString()}})}),null),l(f,o(b,{get when(){return r().lastResolved},children:p=>o(Oe,{label:"Last resolved",get value(){return new Date(p()).toLocaleString()}})}),null),l(f,o(b,{get when(){return r().resolveDurationMs!=null},get children(){return o(Oe,{label:"Resolution duration",get value(){return`${(r().resolveDurationMs??0).toFixed(2)} ms`}})}}),null),f}}),null),l(s,o(qe,{title:"PostConstruct",get children(){var f=rs();return l(f,()=>r().postConstructStatus??"none"),k(()=>B(f,`px-2 py-0.5 rounded text-xs font-semibold ${fs(r().postConstructStatus)}`)),f}}),null),k(f=>{var p=`px-2 py-0.5 rounded text-xs font-semibold ${ds(r().kind)}`,m=`px-2 py-0.5 rounded text-xs font-semibold ${hs(r())}`;return p!==f.e&&B(c,f.e=p),m!==f.t&&B(d,f.t=m),f},{e:void 0,t:void 0}),n})()})},qe=e=>(()=>{var t=is(),r=t.firstChild;return l(r,()=>e.title),l(t,()=>e.children,null),t})(),Oe=e=>(()=>{var t=as(),r=t.firstChild,n=r.nextSibling;return l(r,()=>e.label),l(n,()=>e.value),t})();function ds(e){return e==="controller"?"bg-violet-900/50 text-violet-300":e==="service"?"bg-blue-900/50 text-blue-300":e==="repository"?"bg-teal-900/50 text-teal-300":"bg-border-strong/50 text-text-strong"}function hs(e){return e.postConstructStatus==="failed"?"bg-red-900/50 text-red-300":e.instantiated?"bg-emerald-900/50 text-emerald-300":"bg-amber-900/50 text-amber-300"}function gs(e){return e.postConstructStatus==="failed"?"failed":e.instantiated?"active":"registered"}function fs(e){return e==="done"?"bg-emerald-900/50 text-emerald-300":e==="failed"?"bg-red-900/50 text-red-300":"bg-border-strong/50 text-text-secondary"}J(["click"]);var vs=v("<div class=overflow-x-auto><table><thead><tr><th class=w-6 aria-label=expand></th><th>Token</th><th>Kind</th><th>Scope</th><th>Status</th><th class=text-right>Resolves</th><th class=text-right>Deps</th></tr></thead><tbody>"),ps=v('<div class="bg-surface-1 rounded-xl border border-border p-5"><div class="flex flex-col gap-3 mb-4"><div class=relative><svg class="absolute left-3 top-2.5 w-4 h-4 text-text-muted"fill=none stroke=currentColor viewBox="0 0 24 24"aria-hidden=true><path stroke-linecap=round stroke-linejoin=round stroke-width=2 d="M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"></path></svg><input type=text placeholder="Search tokens…"class="w-full bg-surface-2 border border-border-strong rounded-lg pl-10 pr-4 py-2 text-sm text-text-body placeholder:text-text-muted focus:outline-none focus:border-kick-500"></div><div class="flex flex-col sm:flex-row gap-3"><div class="flex gap-1 items-center"><span class="text-xs text-text-muted mr-1">Kind:</span></div><div class="flex gap-1 items-center"><span class="text-xs text-text-muted mr-1">Scope:'),Rt=v("<button type=button>"),ms=v("<div class=empty>"),bs=v('<tr class="cursor-pointer select-none"><td><svg fill=none stroke=currentColor viewBox="0 0 24 24"aria-hidden=true><path stroke-linecap=round stroke-linejoin=round stroke-width=2 d="M9 5l7 7-7 7"></path></svg></td><td class="font-mono text-sm"></td><td><span></span></td><td><span class="bg-border-strong/50 text-text-strong px-2 py-0.5 rounded text-xs font-semibold"></span></td><td><span></span></td><td class="text-right tabular-nums"></td><td class="text-right text-text-muted text-xs">'),$s=v('<tr><td colspan=7 class="bg-surface-2/30 px-6 py-4 border-b border-border">'),xs=v('<div class="flex flex-wrap gap-1">'),ys=v('<div class="flex justify-between"><span class=text-text-secondary>Duration</span><span class=tabular-nums>ms'),_s=v('<div class="grid grid-cols-1 md:grid-cols-2 gap-4"><div><h4 class="text-xs font-semibold uppercase tracking-wider text-text-muted mb-2">Dependencies</h4></div><div><h4 class="text-xs font-semibold uppercase tracking-wider text-text-muted mb-2">Resolve Stats</h4><div class="space-y-1 text-sm"><div class="flex justify-between"><span class=text-text-secondary>Resolve count</span><span class=tabular-nums></span></div></div></div><div><h4 class="text-xs font-semibold uppercase tracking-wider text-text-muted mb-2">PostConstruct</h4><span></span></div><div class="md:col-span-2 flex justify-end"><button type=button class="px-3 py-1.5 text-xs font-semibold rounded-lg bg-kick-500/20 text-kick-500 border border-kick-500/30 hover:bg-kick-500/30 transition-colors">View full details'),ws=v('<span class="text-text-muted text-sm">None'),Ss=v('<button type=button class="bg-border-strong/50 text-kick-500 hover:bg-border-strong px-2 py-0.5 rounded text-xs font-mono transition-colors">'),ks=v('<div class="flex justify-between"><span class=text-text-secondary>First resolved</span><span class=text-xs>'),Cs=v('<div class="flex justify-between"><span class=text-text-secondary>Last resolved</span><span class=text-xs>'),Es=["ALL","controller","service","repository","other"],Ts=["ALL","singleton","transient","request"],Ms=()=>{const[e,t]=x(""),[r,n]=x("ALL"),[s,i]=x("ALL"),[u,a]=x(new Set),c=P(()=>{let h=M.container();if(r()!=="ALL"){const p=r();h=h.filter(m=>p==="other"?!["controller","service","repository"].includes(m.kind??""):m.kind===p)}s()!=="ALL"&&(h=h.filter(p=>p.scope===s()));const f=e().trim().toLowerCase();return f&&(h=h.filter(p=>p.token.toLowerCase().includes(f))),h}),g=ge(()=>c()),d=h=>{a(f=>{const p=new Set(f);return p.has(h)?p.delete(h):p.add(h),p})};return(()=>{var h=ps(),f=h.firstChild.firstChild,p=f.firstChild.nextSibling,m=f.nextSibling.firstChild;m.firstChild;var y=m.nextSibling;return y.firstChild,p.$$input=_=>t(_.currentTarget.value),l(m,o(A,{each:Es,children:_=>(()=>{var C=Rt();return C.$$click=()=>n(_),l(C,_),k(()=>B(C,`px-3 py-1.5 text-xs font-semibold rounded-lg transition-colors border ${r()===_?Rs(_):"bg-surface-2 text-text-secondary border-border-strong hover:text-text-body"}`)),C})()}),null),l(y,o(A,{each:Ts,children:_=>(()=>{var C=Rt();return C.$$click=()=>i(_),l(C,_),k(()=>B(C,`px-3 py-1.5 text-xs font-semibold rounded-lg transition-colors border ${s()===_?"bg-kick-500/20 text-kick-500 border-kick-500/30":"bg-surface-2 text-text-secondary border-border-strong hover:text-text-body"}`)),C})()}),null),l(h,o(b,{get when(){return g.page().length>0},get fallback(){return(()=>{var _=ms();return l(_,()=>e()||r()!=="ALL"||s()!=="ALL"?"No tokens match the current filter":"No DI registrations"),_})()},get children(){return[(()=>{var _=vs(),C=_.firstChild.firstChild,w=C.firstChild.firstChild.nextSibling.nextSibling.nextSibling.nextSibling.nextSibling;w.firstChild;var E=C.nextSibling;return l(w,o(Y,{metric:"resolve.count",placement:"bottom"}),null),l(E,o(A,{get each(){return g.page()},children:S=>[(()=>{var T=bs(),F=T.firstChild,I=F.firstChild,q=F.nextSibling,R=q.nextSibling,X=R.firstChild,z=R.nextSibling,V=z.firstChild,D=z.nextSibling,H=D.firstChild,K=D.nextSibling,Z=K.nextSibling;return T.$$click=()=>d(S.token),l(q,()=>S.token),l(X,()=>S.kind??"unknown"),l(V,()=>S.scope??"—"),l(H,()=>qs(S)),l(K,()=>S.resolveCount??0),l(Z,()=>S.dependencies?.length??0),k(ae=>{var ne=`w-3 h-3 text-text-muted transition-transform ${u().has(S.token)?"rotate-90":""}`,ue=`px-2 py-0.5 rounded text-xs font-semibold ${Ls(S.kind)}`,_e=`px-2 py-0.5 rounded text-xs font-semibold ${Bs(S)}`;return ne!==ae.e&&N(I,"class",ae.e=ne),ue!==ae.t&&B(X,ae.t=ue),_e!==ae.a&&B(H,ae.a=_e),ae},{e:void 0,t:void 0,a:void 0}),T})(),o(b,{get when(){return u().has(S.token)},get children(){var T=$s(),F=T.firstChild;return l(F,o(As,{registration:S})),T}})]})),_})(),o(fe,{pager:g})]}}),null),k(()=>p.value=e()),h})()},As=e=>(()=>{var t=_s(),r=t.firstChild;r.firstChild;var n=r.nextSibling,s=n.firstChild.nextSibling,i=s.firstChild.firstChild.nextSibling,u=n.nextSibling,a=u.firstChild;a.firstChild;var c=a.nextSibling,g=u.nextSibling.firstChild;return l(r,o(b,{get when(){return(e.registration.dependencies?.length??0)>0},get fallback(){return ws()},get children(){var d=xs();return l(d,o(A,{get each(){return e.registration.dependencies},children:h=>(()=>{var f=Ss();return f.$$click=p=>{p.stopPropagation(),He(h)},N(f,"title",`Open detail for ${h}`),l(f,h),f})()})),d}}),null),l(i,()=>e.registration.resolveCount??0),l(s,o(b,{get when(){return e.registration.firstResolved},children:d=>(()=>{var h=ks(),f=h.firstChild.nextSibling;return l(f,()=>new Date(d()).toLocaleTimeString()),h})()}),null),l(s,o(b,{get when(){return e.registration.lastResolved},children:d=>(()=>{var h=Cs(),f=h.firstChild.nextSibling;return l(f,()=>new Date(d()).toLocaleTimeString()),h})()}),null),l(s,o(b,{get when(){return e.registration.resolveDurationMs!=null},get children(){var d=ys(),h=d.firstChild.nextSibling,f=h.firstChild;return l(h,()=>(e.registration.resolveDurationMs??0).toFixed(2),f),d}}),null),l(a,o(Y,{metric:"post-construct"}),null),l(c,()=>e.registration.postConstructStatus??"none"),g.$$click=d=>{d.stopPropagation(),He(e.registration.token)},k(()=>B(c,`px-2 py-0.5 rounded text-xs font-semibold ${Os(e.registration.postConstructStatus)}`)),t})();function Ls(e){return e==="controller"?"bg-violet-900/50 text-violet-300":e==="service"?"bg-blue-900/50 text-blue-300":e==="repository"?"bg-teal-900/50 text-teal-300":"bg-border-strong/50 text-text-strong"}function Rs(e){return e==="controller"?"bg-violet-900/50 text-violet-300 border-violet-700/50":e==="service"?"bg-blue-900/50 text-blue-300 border-blue-700/50":e==="repository"?"bg-teal-900/50 text-teal-300 border-teal-700/50":e==="other"?"bg-border-strong/50 text-text-strong border-border-strong/50":"bg-kick-500/20 text-kick-500 border-kick-500/30"}function Bs(e){return e.postConstructStatus==="failed"?"bg-red-900/50 text-red-300":e.instantiated?"bg-emerald-900/50 text-emerald-300":"bg-amber-900/50 text-amber-300"}function qs(e){return e.postConstructStatus==="failed"?"failed":e.instantiated?"active":"registered"}function Os(e){return e==="done"?"bg-emerald-900/50 text-emerald-300":e==="failed"?"bg-red-900/50 text-red-300":"bg-border-strong/50 text-text-secondary"}J(["input","click"]);var Ps=v('<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4">'),js=v('<div class="bg-surface-1 rounded-xl border border-border p-5"><div class="relative mb-4"><svg class="absolute left-3 top-2.5 w-4 h-4 text-text-muted"fill=none stroke=currentColor viewBox="0 0 24 24"aria-hidden=true><path stroke-linecap=round stroke-linejoin=round stroke-width=2 d="M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"></path></svg><input type=text placeholder="Search queues by name…"class="w-full bg-surface-2 border border-border-strong rounded-lg pl-10 pr-4 py-2 text-sm text-text-body placeholder:text-text-muted focus:outline-none focus:border-kick-500">'),Ns=v('<div class=card><div class=card-title>Queues</div><p class="text-text-muted text-sm mt-2">QueueAdapter not detected. Install <code class="font-mono text-kick-500">@forinda/kickjs-queue</code> and register the adapter in your bootstrap to see queue stats here.'),Is=v("<div class=empty>No queues registered"),Ds=v("<div class=empty>No queues match the search"),Us=v('<div class="grid grid-cols-2 gap-2 text-sm">'),zs=v('<div class="bg-surface-2/50 rounded-lg border border-border-strong p-4"><h3 class="font-mono text-sm font-semibold text-kick-500 mb-3 break-all">'),Fs=v('<div class="text-red-400 text-sm">'),Hs=v('<div class="flex justify-between"><span class=text-text-secondary></span><span>'),Gs=()=>{const[e,t]=x(""),r=P(()=>{const s=M.queues().queues,i=e().trim().toLowerCase();return i?s.filter(u=>u.name.toLowerCase().includes(i)):s}),n=ge(()=>r());return o(b,{get when(){return M.queues().enabled},get fallback(){return Ns()},get children(){return o(b,{get when(){return M.queues().queues.length>0},get fallback(){return Is()},get children(){var s=js(),i=s.firstChild.firstChild.nextSibling;return i.$$input=u=>t(u.currentTarget.value),l(s,o(b,{get when(){return n.page().length>0},get fallback(){return Ds()},get children(){return[(()=>{var u=Ps();return l(u,o(A,{get each(){return n.page()},children:a=>o(Vs,{queue:a})})),u})(),o(fe,{pager:n})]}}),null),k(()=>i.value=e()),s}})}})},Vs=e=>(()=>{var t=zs(),r=t.firstChild;return l(r,()=>e.queue.name),l(t,o(b,{get when(){return!e.queue.error},get fallback(){return(()=>{var n=Fs();return l(n,()=>e.queue.error),n})()},get children(){var n=Us();return l(n,o(me,{label:"Waiting",get value(){return e.queue.waiting??0},colour:"text-amber-400"}),null),l(n,o(me,{label:"Active",get value(){return e.queue.active??0},colour:"text-blue-400"}),null),l(n,o(me,{label:"Completed",get value(){return e.queue.completed??0},colour:"text-emerald-400"}),null),l(n,o(me,{label:"Failed",get value(){return e.queue.failed??0},colour:"text-red-400"}),null),l(n,o(me,{label:"Delayed",get value(){return e.queue.delayed??0},colour:"text-violet-400"}),null),l(n,o(me,{label:"Paused",get value(){return e.queue.paused??0},colour:"text-text-secondary"}),null),n}}),null),t})(),me=e=>(()=>{var t=Hs(),r=t.firstChild,n=r.nextSibling;return l(r,()=>e.label),l(n,()=>e.value),k(()=>B(n,`font-semibold tabular-nums ${e.colour}`)),t})();J(["input"]);function Ks(){let e=new Map,t=new Set;return{on:(r,n)=>{let s=e.get(r);return s||(s=new Set,e.set(r,s)),s.add(n),()=>{let i=e.get(r);i?.delete(n),i&&i.size===0&&e.delete(r)}},onAny:r=>(t.add(r),()=>{t.delete(r)}),dispatch:r=>{let n=e.get(r.type);if(n&&n.size>0)for(let s of[...n])try{s(r.payload)}catch(i){console.error(`[kick:devtools-bus] handler for "${r.type}" threw`,i)}if(t.size>0)for(let s of[...t])try{s(r)}catch(i){console.error("[kick:devtools-bus] onAny handler threw",i)}}}}function Ws(e={}){let t=Ks(),r=e.channel===!1?null:e.channel??"kick-devtools",n=r!=null&&typeof BroadcastChannel<"u"?new BroadcastChannel(r):null;n?.addEventListener("message",f=>{let p=f.data;!p||typeof p.type!="string"||typeof p.ts!="number"||t.dispatch({...p,__kick_origin:"broadcast"})});let s=null,i=0,u=null,a=e.reconnectMs??500,c=e.reconnectMaxMs??5e3,g=()=>{e.wsUrl&&(typeof WebSocket>"u"||s&&(s.readyState===WebSocket.OPEN||s.readyState===WebSocket.CONNECTING)||(s=new WebSocket(e.wsUrl),s.addEventListener("open",()=>{i=0}),s.addEventListener("message",f=>{try{let p=JSON.parse(String(f.data));if(!p||typeof p.type!="string"||typeof p.ts!="number")return;t.dispatch({...p,__kick_origin:"ws"})}catch{}}),s.addEventListener("close",()=>{s=null,d()}),s.addEventListener("error",()=>{d()})))},d=()=>{if(!e.wsUrl||u!=null)return;i+=1;let f=Math.min(i*a,c);u=setTimeout(()=>{u=null,g()},f)},h=f=>{n?.postMessage(f),s&&s.readyState===WebSocket.OPEN?s.send(JSON.stringify(f)):e.wsUrl&&g()};return{on(f,p){return g(),t.on(f,p)},onAny(f){return g(),t.onAny(f)},emit(f,p){let m={type:f,payload:p,ts:Date.now(),__kick_origin:"local"};t.dispatch(m),h(m)}}}var ke=null,[Js,lt]=x([]);function Qs(){if(ke)return()=>{};const e=`${ye()}/_bus`,t=location.protocol==="https:"?"wss:":"ws:",r=ve(),n=r?`?token=${encodeURIComponent(r)}`:"",s=`${t}//${location.host}${e}${n}`;ke=Ws({channel:"kick-devtools",wsUrl:s});const i=ke.onAny(u=>{lt(a=>{const c=a.length>=500?a.slice(1):a.slice();return c.push(u),c})});return()=>{i(),ke=null,lt([])}}function Ge(){return Js}function Ys(){lt([])}function Xs(){return ke}var Qe=200;function Zs(e){if(e==null)return String(e);if(typeof e=="bigint")return`${e.toString()}n`;if(typeof e!="object")return String(e);const t=new WeakSet,r=(s,i)=>{if(typeof i=="bigint")return`${i.toString()}n`;if(i instanceof Error)return{name:i.name,message:i.message};if(i&&typeof i=="object"){if(t.has(i))return"[Circular]";t.add(i)}return i};let n;try{n=JSON.stringify(e,r)}catch{n="[unserialisable]"}return n===void 0&&(n=String(e)),n.length>Qe?`${n.slice(0,Qe)}… (+${n.length-Qe} chars)`:n}function Zt(e){const t=new Date(e);return`${String(t.getHours()).padStart(2,"0")}:${String(t.getMinutes()).padStart(2,"0")}:${String(t.getSeconds()).padStart(2,"0")}.${String(t.getMilliseconds()).padStart(3,"0")}`}var ei=v("<table><thead><tr><th>Time</th><th>Dialect</th><th class=text-right>Duration</th><th>SQL</th></tr></thead><tbody>"),ti=v('<div class="bg-surface-1 rounded-xl border border-border p-5"><div class="grid mb-4"></div><input type=text placeholder="Filter by SQL (substring)…"class="w-full bg-surface-2 border border-border-strong rounded-lg px-3 py-2 text-sm text-text-body placeholder:text-text-muted focus:outline-none focus:border-kick-500 mb-4">'),ri=v("<div class=empty>No queries yet. <code>kick/db</code> emits a <code>db:query</code> event per statement when DevTools is installed — run a query to see it here."),ni=v("<code class=break-all>"),li=v("<tr><td class=dimmed></td><td></td><td class=text-right></td><td>"),si=v("<span style=color:var(--color-red-400)>"),ii=v("<div class=card><div class=card-header><div class=card-title></div></div><div class=card-value>"),Ye=50,ai=300,oi=()=>{const[e,t]=x([]),[r,n]=x(""),s=g=>{t(d=>{const h=d.length>=ai?d.slice(1):d.slice();return h.push(g),h})},i=(g,d)=>{const h=g,f=h.error;return{sql:h.sql,parameters:h.parameters,durationMs:0,dialect:h.dialect,error:f instanceof Error?f.message:String(f??"query error"),ts:d}};xe(()=>{for(const f of Ge()())f.type==="db:query"?s({...f.payload,ts:f.ts}):f.type==="db:query-error"&&s(i(f.payload,f.ts));const g=Xs(),d=g?.on("db:query",f=>{const p=f;s({...p,ts:p.ts??Date.now()})}),h=g?.on("db:query-error",f=>s(i(f,Date.now())));ie(()=>{d?.(),h?.()})});const u=P(()=>{const g=e(),d=g.filter(p=>p.error).length,h=g.filter(p=>p.durationMs>=Ye).length,f=g.length;return{total:f,errors:d,slow:h,avg:f?g.reduce((p,m)=>p+m.durationMs,0)/f:0}}),a=P(()=>{const g=r().trim().toLowerCase();return[...g?e().filter(d=>d.sql.toLowerCase().includes(g)):e()].toReversed()}),c=ge(()=>a());return(()=>{var g=ti(),d=g.firstChild,h=d.nextSibling;return l(d,o(Pe,{label:"Queries",get value(){return String(u().total)}}),null),l(d,o(Pe,{label:"Errors",get value(){return String(u().errors)},get tone(){return u().errors?"err":void 0}}),null),l(d,o(Pe,{label:`Slow (≥${Ye}ms)`,get value(){return String(u().slow)},get tone(){return u().slow?"warn":void 0}}),null),l(d,o(Pe,{label:"Avg duration",get value(){return oe(u().avg)}}),null),h.$$input=f=>n(f.currentTarget.value),l(g,o(b,{get when(){return e().length},get fallback(){return ri()},get children(){return[(()=>{var f=ei(),p=f.firstChild.nextSibling;return l(p,o(A,{get each(){return c.page()},children:m=>(()=>{var y=li(),_=y.firstChild,C=_.nextSibling,w=C.nextSibling,E=w.nextSibling;return l(_,()=>Zt(m.ts)),l(C,()=>m.dialect??"—"),l(w,()=>oe(m.durationMs)),l(E,o(b,{get when(){return!m.error},get fallback(){return(()=>{var S=si();return l(S,()=>m.error),S})()},get children(){var S=ni();return l(S,()=>m.sql),S}})),k(S=>ct(w,m.durationMs>=Ye?"color:var(--color-amber-400);font-weight:600":"",S)),y})()})),f})(),o(fe,{pager:c})]}}),null),k(()=>h.value=r()),g})()},Pe=e=>(()=>{var t=ii(),r=t.firstChild,n=r.firstChild,s=r.nextSibling;return l(n,()=>e.label),l(s,()=>e.value),k(i=>ct(s,e.tone==="err"?"color:var(--color-red-400)":e.tone==="warn"?"color:var(--color-amber-400)":"",i)),t})();J(["input"]);var ci=v("<div class=space-y-6>"),ui=v('<div class="bg-surface-1 rounded-xl border border-border p-5"><div class="relative mb-4"><svg class="absolute left-3 top-2.5 w-4 h-4 text-text-muted"fill=none stroke=currentColor viewBox="0 0 24 24"aria-hidden=true><path stroke-linecap=round stroke-linejoin=round stroke-width=2 d="M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"></path></svg><input type=text placeholder="Filter graph (token or kind)…"class="w-full bg-surface-2 border border-border-strong rounded-lg pl-10 pr-4 py-2 text-sm text-text-body placeholder:text-text-muted focus:outline-none focus:border-kick-500">'),di=v("<div class=empty>"),hi=v("<div class=space-y-1>"),gi=v('<div><button type=button><svg fill=none stroke=currentColor viewBox="0 0 24 24"aria-hidden=true><path stroke-linecap=round stroke-linejoin=round stroke-width=2.5 d="M9 5l7 7-7 7"></path></svg><span></span><span class="ml-2 text-text-muted font-normal normal-case">(<!>)'),fi=v('<span class="bg-border-strong/50 text-text-secondary px-1.5 py-0.5 rounded text-xs">'),vi=v('<span class="text-text-muted text-xs ml-auto tabular-nums"> resolves'),pi=v('<div class="ml-8 mt-1 space-y-0.5">'),mi=v('<button type=button class="w-full text-left px-3 py-2 rounded-lg hover:bg-surface-2/50 transition-colors group"><div class="flex items-center gap-2"><span></span><span class="font-mono text-sm text-text-body break-all">'),bi=v('<div class="flex items-center gap-2 text-xs text-text-muted hover:text-text-strong"><svg class="w-3 h-3 text-text-muted"fill=none stroke=currentColor viewBox="0 0 24 24"aria-hidden=true><path stroke-linecap=round stroke-linejoin=round stroke-width=2 d="M13 7l5 5-5 5M6 12h12"></path></svg><span></span><span class=font-mono>'),$i=[{id:"controllers",label:"Controllers",match:e=>e==="controller"},{id:"services",label:"Services",match:e=>e==="service"},{id:"repositories",label:"Repositories",match:e=>e==="repository"},{id:"other",label:"Other",match:e=>!["controller","service","repository"].includes(e??"")}],xi=()=>{const[e,t]=x(""),r=P(()=>{const s=M.container(),i=e().trim().toLowerCase();return i?s.filter(u=>u.token.toLowerCase().includes(i)||(u.kind??"").toLowerCase().includes(i)):s}),n=P(()=>$i.map(s=>Object.assign(s,{nodes:r().filter(i=>s.match(i.kind))})));return(()=>{var s=ui(),i=s.firstChild.firstChild.nextSibling;return i.$$input=u=>t(u.currentTarget.value),l(s,o(b,{get when(){return r().length>0},get fallback(){return(()=>{var u=di();return l(u,()=>e()?"No nodes match the filter":"No DI registrations to graph"),u})()},get children(){var u=ci();return l(u,o(A,{get each(){return n()},children:a=>o(b,{get when(){return a.nodes.length>0},get children(){return o(yi,{get label(){return a.label},get nodes(){return a.nodes}})}})})),u}}),null),k(()=>i.value=e()),s})()},yi=e=>{const t=P(()=>e.nodes??[]),r=ge(t),n=`kickjs-devtools-graph-collapsed-${e.label}`,s=()=>{try{return localStorage.getItem(n)==="1"}catch{return!1}},[i,u]=x(s()),a=()=>{const c=!i();u(c);try{c?localStorage.setItem(n,"1"):localStorage.removeItem(n)}catch{}};return(()=>{var c=gi(),g=c.firstChild,d=g.firstChild,h=d.nextSibling,f=h.nextSibling,p=f.firstChild.nextSibling;return p.nextSibling,g.$$click=a,l(h,()=>e.label),l(f,()=>t().length,p),l(c,o(b,{get when(){return!i()},get children(){return[(()=>{var m=hi();return l(m,o(A,{get each(){return r.page()},children:y=>o(_i,{node:y})})),m})(),o(b,{get when(){return r.total()>1},get children(){return o(fe,{pager:r})}})]}}),null),k(m=>{var y=!i(),_=`w-full flex items-center text-left text-xs font-semibold uppercase tracking-wider mb-2 ${wi(e.label)} cursor-pointer hover:opacity-80 transition-opacity`,C=`w-3 h-3 mr-1.5 transition-transform ${i()?"":"rotate-90"}`;return y!==m.e&&N(g,"aria-expanded",m.e=y),_!==m.t&&B(g,m.t=_),C!==m.a&&N(d,"class",m.a=C),m},{e:void 0,t:void 0,a:void 0}),c})()},_i=e=>{const t=()=>e.node.dependencies??[];return(()=>{var r=mi(),n=r.firstChild,s=n.firstChild,i=s.nextSibling;return r.$$click=()=>He(e.node.token),l(s,()=>er(e.node.kind)),l(i,()=>e.node.token),l(n,o(b,{get when(){return e.node.scope},get children(){var u=fi();return l(u,()=>e.node.scope),u}}),null),l(n,o(b,{get when(){return(e.node.resolveCount??0)>0},get children(){var u=vi(),a=u.firstChild;return l(u,()=>e.node.resolveCount,a),u}}),null),l(r,o(b,{get when(){return t().length>0},get children(){var u=pi();return l(u,o(A,{get each(){return t()},children:a=>(()=>{var c=bi(),g=c.firstChild.nextSibling,d=g.nextSibling;return c.$$click=h=>{h.stopPropagation(),He(a)},l(g,()=>Si(a)),l(d,a),k(()=>B(g,`px-1.5 py-0.5 rounded text-xs font-semibold ${ki(a)}`)),c})()})),u}}),null),k(()=>B(s,`px-2 py-0.5 rounded text-xs font-semibold ${tr(e.node.kind)}`)),r})()};function er(e){return e==="controller"?"ctrl":e==="service"?"svc":e==="repository"?"repo":"other"}function tr(e){return e==="controller"?"bg-violet-900/50 text-violet-300":e==="service"?"bg-blue-900/50 text-blue-300":e==="repository"?"bg-teal-900/50 text-teal-300":"bg-border-strong/50 text-text-strong"}function wi(e){return e==="Controllers"?"text-violet-400":e==="Services"?"text-blue-400":e==="Repositories"?"text-teal-400":"text-text-secondary"}function Si(e){return er(M.container().find(t=>t.token===e)?.kind)}function ki(e){return tr(M.container().find(t=>t.token===e)?.kind)}J(["input","click"]);var Ci=v("<div class=overflow-x-auto><table><thead><tr><th style=width:140px>Time</th><th style=width:200px>Type</th><th style=width:120px>Source</th><th>Payload</th></tr></thead><tbody>"),Ei=v('<div class="bg-surface-1 rounded-xl border border-border p-5"><div class="flex flex-col sm:flex-row gap-3 mb-4 items-stretch sm:items-center"><input type=text placeholder="Filter by event type (substring)…"class="flex-1 bg-surface-2 border border-border-strong rounded-lg px-3 py-2 text-sm text-text-body placeholder:text-text-muted focus:outline-none focus:border-kick-500"><div class="flex gap-2"><button type=button></button><button type=button class="px-3 py-1.5 text-xs font-semibold rounded-lg bg-surface-2 text-text-secondary border border-border-strong hover:text-text-body transition-colors">Clear</button></div></div><div class="text-xs text-text-muted mb-3 font-mono">/<!> buffered'),Ti=v("<div class=empty>"),Mi=v('<tr><td class="font-mono text-xs text-text-muted"></td><td class="font-mono text-xs"></td><td class="font-mono text-xs text-text-secondary"></td><td class="font-mono text-xs"><code class="text-text-body break-all">'),Ai=()=>{const e=Ge(),[t,r]=x(""),[n,s]=x(!1),[i,u]=x(null),a=()=>{s(d=>{const h=!d;return u(h?e():null),h})},c=P(()=>{const d=i()??e(),h=t().trim().toLowerCase();return[...h?d.filter(f=>f.type.toLowerCase().includes(h)):d].toReversed()}),g=ge(()=>c());return(()=>{var d=Ei(),h=d.firstChild,f=h.firstChild,p=f.nextSibling.firstChild,m=p.nextSibling,y=h.nextSibling,_=y.firstChild,C=_.nextSibling;return C.nextSibling,f.$$input=w=>r(w.currentTarget.value),p.$$click=a,l(p,()=>n()?"▶ Resume":"⏸ Pause"),m.$$click=()=>Ys(),l(y,()=>e().length,_),l(y,500,C),l(y,o(b,{get when(){return n()},children:" · paused"}),null),l(y,o(b,{get when(){return t().trim()},get children(){return[' · filter: "',Re(()=>t().trim()),'"']}}),null),l(d,o(b,{get when(){return g.page().length>0},get fallback(){return(()=>{var w=Ti();return l(w,o(b,{get when(){return e().length===0},fallback:"No events match the current filter",children:"No events yet — emits from kickjs-db, plugins, or the panel itself land here."})),w})()},get children(){return[(()=>{var w=Ci(),E=w.firstChild.firstChild.nextSibling;return l(E,o(A,{get each(){return g.page()},children:S=>(()=>{var T=Mi(),F=T.firstChild,I=F.nextSibling,q=I.nextSibling,R=q.nextSibling.firstChild;return l(F,()=>Zt(S.ts)),l(I,()=>S.type),l(q,()=>S.pluginId??"—"),l(R,()=>Zs(S.payload)),T})()})),w})(),o(fe,{pager:g})]}}),null),k(()=>B(p,`px-3 py-1.5 text-xs font-semibold rounded-lg border transition-colors ${n()?"bg-kick-500/20 text-kick-500 border-kick-500/30":"bg-surface-2 text-text-secondary border-border-strong hover:text-text-body"}`)),k(()=>f.value=t()),d})()};J(["input","click"]);var Li=v("<div style=display:flex;flex-direction:column;height:100%>"),Ri=v('<iframe title="custom devtools tab"sandbox="allow-scripts allow-same-origin allow-forms"style=flex:1;width:100%;border:none;background:var(--bg)>'),Bi=v("<div style=padding:16px><div class=card>"),qi=v("<div style=color:var(--text-dim);font-size:12px>"),Oi=v('<div style="display:flex;align-items:center;justify-content:space-between;padding:8px 0;border-bottom:1px solid var(--border)"><div><div style=font-weight:600></div></div><button type=button class=tab style="border:1px solid var(--border);border-radius:4px;padding:6px 14px;border-bottom-color:var(--border)">'),Pi=v("<div class=card><div class=card-title>Last response</div><code>"),ji=v("<div style=padding:16px;flex:1;overflow:auto>"),Ni=e=>(()=>{var t=Li();return l(t,o(b,{get when(){return e.tab.view.type==="iframe"},get children(){return o(Ii,{get view(){return e.tab.view}})}}),null),l(t,o(b,{get when(){return e.tab.view.type==="launch"},get children(){return o(Di,{get view(){return e.tab.view},get tabId(){return e.tab.id}})}}),null),l(t,o(b,{get when(){return e.tab.view.type==="html"},get children(){return o(Ui,{get view(){return e.tab.view}})}}),null),t})(),Ii=e=>{const t=()=>{const r=e.view.src,n=(r.startsWith("http")||r.startsWith("//"),r),s=ve();return s?`${n}${n.includes("?")?"&":"?"}token=${encodeURIComponent(s)}`:n};return(()=>{var r=Ri();return k(()=>N(r,"src",t())),r})()},Di=e=>{const[t,r]=x(null),[n,s]=x(null),i=async u=>{r(u),s(null);try{const a=`${ye()}/tabs/${encodeURIComponent(e.tabId)}/actions/${encodeURIComponent(u)}`,c=ve(),g=await fetch(c?`${a}?token=${encodeURIComponent(c)}`:a,{method:"POST",headers:c?{"x-devtools-token":c}:void 0});s(`${g.status} ${g.statusText}`)}catch(a){s(a instanceof Error?a.message:String(a))}finally{r(null)}};return(()=>{var u=Bi(),a=u.firstChild;return l(a,o(A,{get each(){return e.view.actions},children:c=>(()=>{var g=Oi(),d=g.firstChild,h=d.firstChild,f=d.nextSibling;return l(h,()=>c.label),l(d,o(b,{get when(){return c.description},get children(){var p=qi();return l(p,()=>c.description),p}}),null),f.$$click=()=>{i(c.id)},l(f,()=>t()===c.id?"Running…":"Run"),k(()=>f.disabled=t()===c.id),g})()})),l(u,o(b,{get when(){return n()},children:c=>(()=>{var g=Pi(),d=g.firstChild.nextSibling;return l(d,c),g})()}),null),u})()},Ui=e=>(()=>{var t=ji();return k(()=>t.innerHTML=e.view.html),t})();J(["click"]);var Ve=!1,Ce=null,Ie=null;async function zi(){return U.setConnectionStatus("connecting"),await st(),Ie=ht("/stream",e=>{if(!Ve){if(U.setConnectionStatus("live"),rr(),e.type==="metrics"){Fi(e),U.touch();return}if(e.type==="container"){st();return}}},()=>{Ve||(U.setConnectionStatus("polling"),Hi())}),Gi}async function st(){const e=await Promise.allSettled([ee.health(),ee.metrics(),ee.routeRegistry(),ee.container(),ee.queues(),ee.ws()]);if(e.every(a=>a.status==="rejected"&&a.reason instanceof Yt)){U.setAuthRequired(!0),U.setConnectionStatus("disconnected");return}M.authRequired()&&(U.setAuthRequired(!1),U.setAuthError(null));const[t,r,n,s,i,u]=e;t.status==="fulfilled"&&U.setHealth({status:t.value.status,errorRate:t.value.errorRate,uptime:t.value.uptime,adapters:t.value.adapters??{}}),r.status==="fulfilled"&&U.setMetrics({requests:r.value.requests,serverErrors:r.value.serverErrors,clientErrors:r.value.clientErrors,errorRate:r.value.errorRate,uptimeSeconds:r.value.uptimeSeconds,startedAt:r.value.startedAt}),n.status==="fulfilled"&&U.setRoutes(n.value.routes??[]),s.status==="fulfilled"&&U.setContainer(s.value.registrations??[]),i.status==="fulfilled"&&U.setQueues({enabled:i.value.enabled,queues:i.value.queues??[]}),u.status==="fulfilled"&&U.setWs(u.value),U.touch()}function Fi(e){const t=M.metrics();if(!t)return;U.setMetrics({...t,requests:e.requestCount,serverErrors:e.errorCount,clientErrors:e.clientErrorCount,errorRate:e.errorRate,uptimeSeconds:e.uptimeSeconds});const r=M.health();r&&U.setHealth({...r,uptime:e.uptimeSeconds,errorRate:e.errorRate})}function Hi(){Ce||(Ce=setInterval(()=>{Ve||st()},5e3))}function rr(){Ce&&(clearInterval(Ce),Ce=null)}function Gi(){Ve=!0,rr(),Ie&&(Ie(),Ie=null),U.setConnectionStatus("disconnected")}var Vi=v('<div class="fixed inset-0 z-[60] bg-slate-950/90 flex items-center justify-center p-4"><div class="bg-slate-900 border border-slate-700 rounded-2xl p-8 max-w-md w-full shadow-2xl"><div class="text-center mb-6"><h2 class="text-xl font-bold text-kick-500 mb-2">⚡ KickJS DevTools</h2><p class="text-sm text-slate-400">Enter your DevTools token to continue.</p><p class="text-xs text-slate-600 mt-1">The token is printed in the server console on startup, e.g. <code class="font-mono text-slate-500">[token: abc123…]</code></p></div><form><input type=text autofocus placeholder="Paste your token here…"class="w-full bg-slate-800 border border-slate-700 rounded-lg px-4 py-3 text-sm text-slate-200 placeholder-slate-500 focus:outline-none focus:border-kick-500 font-mono mb-3"><button type=submit class="w-full bg-kick-500 hover:bg-kick-600 text-white font-semibold py-2.5 rounded-lg transition-colors disabled:opacity-50">'),Ki=v('<p class="text-red-400 text-sm mb-3">'),Wi=()=>{const[e,t]=x(""),[r,n]=x(!1),s=async()=>{const i=e().trim();if(!i){U.setAuthError("Token is required");return}n(!0),U.setAuthError(null);try{Jt(i),await ee.health(),U.setAuthRequired(!1),U.setAuthError(null),t("")}catch{U.setAuthError("Invalid token — request was rejected.")}finally{n(!1)}};return o(b,{get when(){return M.authRequired()},get children(){var i=Vi(),u=i.firstChild.firstChild.nextSibling,a=u.firstChild,c=a.nextSibling;return u.addEventListener("submit",g=>{g.preventDefault(),s()}),a.$$input=g=>t(g.currentTarget.value),l(u,o(b,{get when(){return M.authError()},children:g=>(()=>{var d=Ki();return l(d,g),d})()}),c),l(c,()=>r()?"Verifying…":"Authenticate"),k(()=>c.disabled=r()),k(()=>a.value=e()),i}})};J(["input"]);var Ji=v("<div class=dt-nav-sep>"),Qi=v('<div class=card style=border-color:var(--warn);margin-top:16px><div class=card-title style=color:var(--warn)> custom-tab issue(s)</div><ul style="margin:8px 0 0;padding-left:20px;font-family:var(--font-mono);font-size:12px">'),Yi=v("<div class=app><header class=dt-header><div class=dt-header-brand><span class=dt-bolt aria-hidden=true>⚡</span><h1>KickJS DevTools</h1></div><div style=display:flex;align-items:center;gap:12px></div></header><div class=dt-shell><aside class=dt-sidebar role=tablist></aside><div class=dt-resizer role=separator aria-orientation=vertical></div><main class=dt-main role=tabpanel>"),Xe=v("<button type=button role=tab><span class=dt-nav-label>"),Bt=v("<span class=tab-badge>"),Xi=v("<div class=dt-nav-group><button type=button class=dt-nav-group-header><span>▾"),Zi=v("<li>: "),ea=v("<div class=dt-conn><span aria-hidden=true></span><span class=dt-conn-label></span><span class=dt-conn-sep>·</span><span class=dt-conn-ts>Updated "),ta=v("<div class=dt-settings-pop role=menu><div class=dt-settings-section><div class=dt-settings-label>Density</div><div class=dt-seg></div><div class=dt-settings-hint>Controls spacing & font scale. Default: Small."),ra=v('<div class=dt-settings><button type=button aria-label=Settings aria-haspopup=true title=Settings><svg viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2><circle cx=12 cy=12 r=3></circle><path d="M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 1 1-2.83 2.83l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-4 0v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 1 1-2.83-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1 0-4h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 1 1 2.83-2.83l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 4 0v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 1 1 2.83 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 0 4h-.09a1.65 1.65 0 0 0-1.51 1z">'),na=v("<button type=button>"),la=v('<svg viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2><path d="M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z">'),sa=v("<button type=button class=dt-theme-toggle>"),ia=v('<svg viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2><circle cx=12 cy=12 r=4></circle><path d="M12 2v2M12 20v2M4.93 4.93l1.41 1.41M17.66 17.66l1.41 1.41M2 12h2M20 12h2M4.93 19.07l1.41-1.41M17.66 6.34l1.41-1.41">');function nr(){return[{id:"overview",label:"Overview"},{id:"runtime",label:"Runtime"},{id:"memory",label:"Memory"},{id:"topology",label:"Topology"},{id:"routes",label:"Routes",count:()=>M.routes().length||void 0},{id:"metrics",label:"Metrics"},{id:"container",label:"Container",count:()=>M.container().length||void 0},{id:"queues",label:"Queues",count:()=>M.queues().queues.length||void 0},{id:"database",label:"Database",count:()=>Ge()().filter(e=>e.type==="db:query"||e.type==="db:query-error").length||void 0},{id:"graph",label:"Graph",count:()=>M.container().length||void 0},{id:"activity",label:"Activity",count:()=>Ge()().length||void 0}]}var aa=new Set(nr().map(e=>e.id)),oa=[{label:null,ids:["overview"]},{label:"Runtime",ids:["runtime","memory","topology","metrics"]},{label:"Architecture",ids:["routes","container","graph"]},{label:"Data & Jobs",ids:["database","queues"]},{label:null,ids:["activity"]}],lr="kickjs-devtools-sidebar-w",sr="kickjs-devtools-sidebar-collapsed",ir=150,ar=360;function ca(){try{const e=Number(localStorage.getItem(lr));if(e>=ir&&e<=ar)return e}catch{}return 200}function ua(){try{const e=localStorage.getItem(sr);if(e)return JSON.parse(e)}catch{}return[]}var da=()=>{const e=(()=>{try{const w=localStorage.getItem("kickjs-devtools-tab");if(w)return w}catch{}return"overview"})(),[t,r]=x(e),[n,s]=x([]),[i,u]=x([]),a=nr(),c=new Map(a.map(w=>[w.id,w])),[g,d]=x(ca()),[h,f]=x(ua()),p=w=>{f(E=>{const S=E.includes(w)?E.filter(T=>T!==w):[...E,w];try{localStorage.setItem(sr,JSON.stringify(S))}catch{}return S})};let m=null;ie(()=>m?.());const y=w=>{w.preventDefault();const E=w.clientX,S=g();document.body.style.cursor="col-resize";const T=q=>{const R=Math.min(ar,Math.max(ir,S+(q.clientX-E)));d(R)},F=()=>{document.removeEventListener("mousemove",T),document.removeEventListener("mouseup",I),document.body.style.cursor="",m=null},I=()=>{F();try{localStorage.setItem(lr,String(g()))}catch{}};m=F,document.addEventListener("mousemove",T),document.addEventListener("mouseup",I)};xe(()=>{ee.tabs().then(({tabs:S,errors:T})=>{s(S.filter(F=>!aa.has(F.id))),u(T)}).catch(()=>{});let w=null;zi().then(S=>{w=S});const E=Qs();ie(()=>{w?.(),E()}),Rr(),Pr()});const _=w=>{r(w);try{localStorage.setItem("kickjs-devtools-tab",w)}catch{}queueMicrotask(()=>{document.querySelector(`[role="tab"][data-tab-id="${w}"]`)?.scrollIntoView({behavior:"smooth",inline:"center",block:"nearest"})})},C=()=>n().find(w=>w.id===t());return(()=>{var w=Yi(),E=w.firstChild,S=E.firstChild.nextSibling,T=E.nextSibling.firstChild,F=T.nextSibling,I=F.nextSibling;return l(S,o(ha,{}),null),l(S,o(va,{}),null),l(S,o(fa,{}),null),l(T,o(A,{each:oa,children:q=>o(b,{get when(){return q.label},get fallback(){return o(A,{get each(){return q.ids},children:R=>{const X=c.get(R);return o(b,{when:X,children:z=>(()=>{var V=Xe(),D=V.firstChild;return V.$$click=()=>_(R),N(V,"data-tab-id",R),l(D,()=>z().label),l(V,o(b,{get when(){return z().count?.()},children:H=>(()=>{var K=Bt();return l(K,H),K})()}),null),k(H=>{var K=`dt-nav-item ${t()===R?"active":""}`,Z=t()===R;return K!==H.e&&B(V,H.e=K),Z!==H.t&&N(V,"aria-selected",H.t=Z),H},{e:void 0,t:void 0}),V})()})}})},children:R=>(()=>{var X=Xi(),z=X.firstChild,V=z.firstChild;return z.$$click=()=>p(R()),l(z,R,null),l(X,o(b,{get when(){return!h().includes(R())},get children(){return o(A,{get each(){return q.ids},children:D=>{const H=c.get(D);return o(b,{when:H,children:K=>(()=>{var Z=Xe(),ae=Z.firstChild;return Z.$$click=()=>_(D),N(Z,"data-tab-id",D),l(ae,()=>K().label),l(Z,o(b,{get when(){return K().count?.()},children:ne=>(()=>{var ue=Bt();return l(ue,ne),ue})()}),null),k(ne=>{var ue=`dt-nav-item nested ${t()===D?"active":""}`,_e=t()===D;return ue!==ne.e&&B(Z,ne.e=ue),_e!==ne.t&&N(Z,"aria-selected",ne.t=_e),ne},{e:void 0,t:void 0}),Z})()})}})}}),null),k(D=>{var H=!h().includes(R()),K=`dt-nav-caret ${h().includes(R())?"closed":""}`;return H!==D.e&&N(z,"aria-expanded",D.e=H),K!==D.t&&B(V,D.t=K),D},{e:void 0,t:void 0}),X})()})}),null),l(T,o(b,{get when(){return n().length>0},get children(){return[Ji(),o(A,{get each(){return n()},children:q=>(()=>{var R=Xe(),X=R.firstChild;return R.$$click=()=>_(q.id),l(X,()=>q.title),k(z=>{var V=q.id,D=`dt-nav-item ${t()===q.id?"active":""}`,H=t()===q.id,K=q.title;return V!==z.e&&N(R,"data-tab-id",z.e=V),D!==z.t&&B(R,z.t=D),H!==z.a&&N(R,"aria-selected",z.a=H),K!==z.o&&N(R,"title",z.o=K),z},{e:void 0,t:void 0,a:void 0,o:void 0}),R})()})]}}),null),F.$$mousedown=y,l(I,o(b,{get when(){return t()==="overview"},get children(){return o(Sn,{})}}),null),l(I,o(b,{get when(){return t()==="runtime"},get children(){return o(Nn,{})}}),null),l(I,o(b,{get when(){return t()==="memory"},get children(){return o(el,{})}}),null),l(I,o(b,{get when(){return t()==="topology"},get children(){return o(Ll,{})}}),null),l(I,o(b,{get when(){return t()==="routes"},get children(){return o(Fl,{})}}),null),l(I,o(b,{get when(){return t()==="metrics"},get children(){return o(Zl,{})}}),null),l(I,o(b,{get when(){return t()==="container"},get children(){return o(Ms,{})}}),null),l(I,o(b,{get when(){return t()==="queues"},get children(){return o(Gs,{})}}),null),l(I,o(b,{get when(){return t()==="database"},get children(){return o(oi,{})}}),null),l(I,o(b,{get when(){return t()==="graph"},get children(){return o(xi,{})}}),null),l(I,o(b,{get when(){return t()==="activity"},get children(){return o(Ai,{})}}),null),l(I,o(b,{get when(){return C()},children:q=>o(Ni,{get tab(){return q()}})}),null),l(I,o(b,{get when(){return Re(()=>i().length>0)()&&t()==="overview"},get children(){var q=Qi(),R=q.firstChild,X=R.firstChild,z=R.nextSibling;return l(R,()=>i().length,X),l(z,o(A,{get each(){return i()},children:V=>(()=>{var D=Zi(),H=D.firstChild;return l(D,()=>V.source,H),l(D,()=>V.reason,null),D})()})),q}}),null),l(w,o(us,{}),null),l(w,o(Wi,{}),null),k(q=>ct(T,`width:${g()}px`,q)),w})()},ha=()=>{const e=r=>r==="live"?"Live":r==="polling"?"Polling":r==="disconnected"?"Disconnected":"Connecting…",t=r=>r?r.toLocaleTimeString():"never";return(()=>{var r=ea(),n=r.firstChild,s=n.nextSibling,i=s.nextSibling.nextSibling;return i.firstChild,l(s,()=>e(M.connectionStatus())),l(i,()=>t(M.lastUpdate()),null),k(()=>B(n,`dt-pulse dt-pulse-${M.connectionStatus()}`)),r})()},ga=[{id:"sm",label:"Small"},{id:"md",label:"Medium"},{id:"lg",label:"Large"}],fa=()=>{const[e,t]=x(!1);let r;const n=i=>{e()&&r&&!r.contains(i.target)&&t(!1)},s=i=>{i.key==="Escape"&&t(!1)};return document.addEventListener("click",n),document.addEventListener("keydown",s),ie(()=>{document.removeEventListener("click",n),document.removeEventListener("keydown",s)}),(()=>{var i=ra(),u=i.firstChild;return Sr(a=>r=a,i),u.$$click=()=>t(a=>!a),l(i,o(b,{get when(){return e()},get children(){var a=ta(),c=a.firstChild.firstChild.nextSibling;return l(c,o(A,{each:ga,children:g=>(()=>{var d=na();return d.$$click=()=>Or(g.id),l(d,()=>g.label),k(h=>{var f=`dt-seg-item ${yt()===g.id?"active":""}`,p=yt()===g.id;return f!==h.e&&B(d,h.e=f),p!==h.t&&N(d,"aria-pressed",h.t=p),h},{e:void 0,t:void 0}),d})()})),a}}),null),k(a=>{var c=`dt-settings-btn ${e()?"open":""}`,g=e();return c!==a.e&&B(u,a.e=c),g!==a.t&&N(u,"aria-expanded",a.t=g),a},{e:void 0,t:void 0}),i})()},va=()=>{const e=()=>{const r=Je()==="system"?"light":Je()==="light"?"dark":"system";Lr(r)},t=()=>{const r=Je();return`Theme: ${r==="system"?"follow system":r} (click to cycle)`};return(()=>{var r=sa();return r.$$click=e,l(r,o(b,{get when(){return Ft()==="dark"},get fallback(){return ia()},get children(){return la()}})),k(n=>{var s=t(),i=t();return s!==n.e&&N(r,"aria-label",n.e=s),i!==n.t&&N(r,"title",n.t=i),n},{e:void 0,t:void 0}),r})()};J(["mousedown","click"]);var or=document.getElementById("root");if(!or)throw new Error("#root not found");wr(()=>o(da,{}),or);
|
|
1
|
+
(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))n(s);new MutationObserver(s=>{for(const i of s)if(i.type==="childList")for(const u of i.addedNodes)u.tagName==="LINK"&&u.rel==="modulepreload"&&n(u)}).observe(document,{childList:!0,subtree:!0});function r(s){const i={};return s.integrity&&(i.integrity=s.integrity),s.referrerPolicy&&(i.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?i.credentials="include":s.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function n(s){if(s.ep)return;s.ep=!0;const i=r(s);fetch(s.href,i)}})();var W={context:void 0,registry:void 0,effects:void 0,done:!1,getContextId(){return dr(this.context.count)},getNextContextId(){return dr(this.context.count++)}};function dr(e){const t=String(e),r=t.length-1;return W.context.id+(r?String.fromCharCode(96+r):"")+t}function Ut(e){W.context=e}function jn(){return{...W.context,id:W.getNextContextId(),count:0}}var Nn=(e,t)=>e===t,Ur=Symbol("solid-track"),yt={equals:Nn},hr=null,Fr=Gr,be=1,et=2,Hr={owned:null,cleanups:null,context:null,owner:null},U=null,_=null,nt=null,ze=null,J=null,re=null,se=null,At=0;function Ve(e,t){const r=J,n=U,s=e.length===0,i=t===void 0?n:t,u=s?Hr:{owned:null,cleanups:null,context:i?i.context:null,owner:i},a=s?e:()=>e(()=>xe(()=>Ne(u)));U=u,J=null;try{return Le(a,!0)}finally{J=r,U=n}}function x(e,t){t=t?Object.assign({},yt,t):yt;const r={value:e,observers:null,observerSlots:null,comparator:t.equals||void 0},n=s=>(typeof s=="function"&&(_&&_.running&&_.sources.has(r)?s=s(r.tValue):s=s(r.value)),Vr(r,s));return[zr.bind(r),n]}function w(e,t,r){const n=er(e,t,!1,be);nt&&_&&_.running?re.push(n):lt(n)}function Ce(e,t,r){Fr=Dn;const n=er(e,t,!1,be),s=Ft&&Pn(Ft);s&&(n.suspense=s),(!r||!r.render)&&(n.user=!0),se?se.push(n):lt(n)}function H(e,t,r){r=r?Object.assign({},yt,r):yt;const n=er(e,t,!0,0);return n.observers=null,n.observerSlots=null,n.comparator=r.equals||void 0,nt&&_&&_.running?(n.tState=be,re.push(n)):lt(n),zr.bind(n)}function xe(e){if(!ze&&J===null)return e();const t=J;J=null;try{return ze?ze.untrack(e):e()}finally{J=t}}function Je(e){Ce(()=>xe(e))}function $e(e){return U===null||(U.cleanups===null?U.cleanups=[e]:U.cleanups.push(e)),e}function In(e){if(_&&_.running)return e(),_.done;const t=J,r=U;return Promise.resolve().then(()=>{J=t,U=r;let n;return(nt||Ft)&&(n=_||(_={sources:new Set,effects:[],promises:new Set,disposed:new Set,queue:new Set,running:!0}),n.done||(n.done=new Promise(s=>n.resolve=s)),n.running=!0),Le(e,!1),J=U=null,n?n.done:void 0})}var[Qc,fr]=x(!1);function Pn(e){let t;return U&&U.context&&(t=U.context[e.id])!==void 0?t:e.defaultValue}var Ft;function zr(){const e=_&&_.running;if(this.sources&&(e?this.tState:this.state))if((e?this.tState:this.state)===be)lt(this);else{const t=re;re=null,Le(()=>_t(this),!1),re=t}if(J){const t=this.observers;if(!t||t[t.length-1]!==J){const r=t?t.length:0;J.sources?(J.sources.push(this),J.sourceSlots.push(r)):(J.sources=[this],J.sourceSlots=[r]),t?(t.push(J),this.observerSlots.push(J.sources.length-1)):(this.observers=[J],this.observerSlots=[J.sources.length-1])}}return e&&_.sources.has(this)?this.tValue:this.value}function Vr(e,t,r){let n=_&&_.running&&_.sources.has(e)?e.tValue:e.value;if(!e.comparator||!e.comparator(n,t)){if(_){const s=_.running;(s||!r&&_.sources.has(e))&&(_.sources.add(e),e.tValue=t),s||(e.value=t)}else e.value=t;e.observers&&e.observers.length&&Le(()=>{for(let s=0;s<e.observers.length;s+=1){const i=e.observers[s],u=_&&_.running;u&&_.disposed.has(i)||((u?!i.tState:!i.state)&&(i.pure?re.push(i):se.push(i),i.observers&&Jr(i)),u?i.tState=be:i.state=be)}if(re.length>1e6)throw re=[],new Error},!1)}return t}function lt(e){if(!e.fn)return;Ne(e);const t=At;gr(e,_&&_.running&&_.sources.has(e)?e.tValue:e.value,t),_&&!_.running&&_.sources.has(e)&&queueMicrotask(()=>{Le(()=>{_&&(_.running=!0),J=U=e,gr(e,e.tValue,t),J=U=null},!1)})}function gr(e,t,r){let n;const s=U,i=J;J=U=e;try{n=e.fn(t)}catch(u){return e.pure&&(_&&_.running?(e.tState=be,e.tOwned&&e.tOwned.forEach(Ne),e.tOwned=void 0):(e.state=be,e.owned&&e.owned.forEach(Ne),e.owned=null)),e.updatedAt=r+1,tr(u)}finally{J=i,U=s}(!e.updatedAt||e.updatedAt<=r)&&(e.updatedAt!=null&&"observers"in e?Vr(e,n,!0):_&&_.running&&e.pure?(_.sources.has(e)||(e.value=n),_.sources.add(e),e.tValue=n):e.value=n,e.updatedAt=r)}function er(e,t,r,n=be,s){const i={fn:e,state:n,updatedAt:null,owned:null,sources:null,sourceSlots:null,cleanups:null,value:t,owner:U,context:U?U.context:null,pure:r};if(_&&_.running&&(i.state=0,i.tState=n),U===null||U!==Hr&&(_&&_.running&&U.pure?U.tOwned?U.tOwned.push(i):U.tOwned=[i]:U.owned?U.owned.push(i):U.owned=[i]),ze&&i.fn){const u=i.fn,[a,c]=x(void 0,{equals:!1}),h=ze.factory(u,c);$e(()=>h.dispose());let d,f=!1;const v=()=>In(c).then(()=>{d&&(d.dispose(),d=void 0,f||c())});i.fn=p=>(a(),_&&_.running?(d||(d=ze.factory(u,v)),d.track(p)):(f=!0,h.track(p)))}return i}function tt(e){const t=_&&_.running;if((t?e.tState:e.state)===0)return;if((t?e.tState:e.state)===et)return _t(e);if(e.suspense&&xe(e.suspense.inFallback))return e.suspense.effects.push(e);const r=[e];for(;(e=e.owner)&&(!e.updatedAt||e.updatedAt<At);){if(t&&_.disposed.has(e))return;(t?e.tState:e.state)&&r.push(e)}for(let n=r.length-1;n>=0;n--){if(e=r[n],t){let s=e,i=r[n+1];for(;(s=s.owner)&&s!==i;)if(_.disposed.has(s))return}if((t?e.tState:e.state)===be)lt(e);else if((t?e.tState:e.state)===et){const s=re;re=null,Le(()=>_t(e,r[0]),!1),re=s}}}function Le(e,t){if(re)return e();let r=!1;t||(re=[]),se?r=!0:se=[],At++;try{const n=e();return Bn(r),n}catch(n){r||(se=null),re=null,tr(n)}}function Bn(e){if(re&&(nt&&_&&_.running?qn(re):Gr(re),re=null),e)return;let t;if(_){if(!_.promises.size&&!_.queue.size){const n=_.sources,s=_.disposed;se.push.apply(se,_.effects),t=_.resolve;for(const i of se)"tState"in i&&(i.state=i.tState),delete i.tState;_=null,Le(()=>{for(const i of s)Ne(i);for(const i of n){if(i.value=i.tValue,i.owned)for(let u=0,a=i.owned.length;u<a;u++)Ne(i.owned[u]);i.tOwned&&(i.owned=i.tOwned),delete i.tValue,delete i.tOwned,i.tState=0}fr(!1)},!1)}else if(_.running){_.running=!1,_.effects.push.apply(_.effects,se),se=null,fr(!0);return}}const r=se;se=null,r.length&&Le(()=>Fr(r),!1),t&&t()}function Gr(e){for(let t=0;t<e.length;t++)tt(e[t])}function qn(e){for(let t=0;t<e.length;t++){const r=e[t],n=_.queue;n.has(r)||(n.add(r),nt(()=>{n.delete(r),Le(()=>{_.running=!0,tt(r)},!1),_&&(_.running=!1)}))}}function Dn(e){let t,r=0;for(t=0;t<e.length;t++){const n=e[t];n.user?e[r++]=n:tt(n)}if(W.context){if(W.count){W.effects||(W.effects=[]),W.effects.push(...e.slice(0,r));return}Ut()}for(W.effects&&(W.done||!W.count)&&(e=[...W.effects,...e],r+=W.effects.length,delete W.effects),t=0;t<r;t++)tt(e[t])}function _t(e,t){const r=_&&_.running;r?e.tState=0:e.state=0;for(let n=0;n<e.sources.length;n+=1){const s=e.sources[n];if(s.sources){const i=r?s.tState:s.state;i===be?s!==t&&(!s.updatedAt||s.updatedAt<At)&&tt(s):i===et&&_t(s,t)}}}function Jr(e){const t=_&&_.running;for(let r=0;r<e.observers.length;r+=1){const n=e.observers[r];(t?!n.tState:!n.state)&&(t?n.tState=et:n.state=et,n.pure?re.push(n):se.push(n),n.observers&&Jr(n))}}function Ne(e){let t;if(e.sources)for(;e.sources.length;){const r=e.sources.pop(),n=e.sourceSlots.pop(),s=r.observers;if(s&&s.length){const i=s.pop(),u=r.observerSlots.pop();n<s.length&&(i.sourceSlots[u]=n,s[n]=i,r.observerSlots[n]=u)}}if(e.tOwned){for(t=e.tOwned.length-1;t>=0;t--)Ne(e.tOwned[t]);delete e.tOwned}if(_&&_.running&&e.pure)Kr(e,!0);else if(e.owned){for(t=e.owned.length-1;t>=0;t--)Ne(e.owned[t]);e.owned=null}if(e.cleanups){for(t=e.cleanups.length-1;t>=0;t--)e.cleanups[t]();e.cleanups=null}_&&_.running?e.tState=0:e.state=0}function Kr(e,t){if(t||(e.tState=0,_.disposed.add(e)),e.owned)for(let r=0;r<e.owned.length;r++)Kr(e.owned[r])}function Un(e){return e instanceof Error?e:new Error(typeof e=="string"?e:"Unknown error",{cause:e})}function vr(e,t,r){try{for(const n of t)n(e)}catch(n){tr(n,r&&r.owner||null)}}function tr(e,t=U){const r=hr&&t&&t.context&&t.context[hr],n=Un(e);if(!r)throw n;se?se.push({fn(){vr(n,r,t)},state:be}):vr(n,r,t)}var Ht=Symbol("fallback");function wt(e){for(let t=0;t<e.length;t++)e[t]()}function Fn(e,t,r={}){let n=[],s=[],i=[],u=0,a=t.length>1?[]:null;return $e(()=>wt(i)),()=>{let c=e()||[],h=c.length,d,f;return c[Ur],xe(()=>{let p,m,k,S,y,$,L,A,O;if(h===0)u!==0&&(wt(i),i=[],n=[],s=[],u=0,a&&(a=[])),r.fallback&&(n=[Ht],s[0]=Ve(K=>(i[0]=K,r.fallback())),u=1);else if(u===0){for(s=new Array(h),f=0;f<h;f++)n[f]=c[f],s[f]=Ve(v);u=h}else{for(k=new Array(h),S=new Array(h),a&&(y=new Array(h)),$=0,L=Math.min(u,h);$<L&&n[$]===c[$];$++);for(L=u-1,A=h-1;L>=$&&A>=$&&n[L]===c[A];L--,A--)k[A]=s[L],S[A]=i[L],a&&(y[A]=a[L]);for(p=new Map,m=new Array(A+1),f=A;f>=$;f--)O=c[f],d=p.get(O),m[f]=d===void 0?-1:d,p.set(O,f);for(d=$;d<=L;d++)O=n[d],f=p.get(O),f!==void 0&&f!==-1?(k[f]=s[d],S[f]=i[d],a&&(y[f]=a[d]),f=m[f],p.set(O,f)):i[d]();for(f=$;f<h;f++)f in k?(s[f]=k[f],i[f]=S[f],a&&(a[f]=y[f],a[f](f))):s[f]=Ve(v);s=s.slice(0,u=h),n=c.slice(0)}return s});function v(p){if(i[f]=p,a){const[m,k]=x(f);return a[f]=k,t(c[f],m)}return t(c[f])}}}function Hn(e,t,r={}){let n=[],s=[],i=[],u=[],a=0,c;return $e(()=>wt(i)),()=>{const h=e()||[],d=h.length;return h[Ur],xe(()=>{if(d===0)return a!==0&&(wt(i),i=[],n=[],s=[],a=0,u=[]),r.fallback&&(n=[Ht],s[0]=Ve(v=>(i[0]=v,r.fallback())),a=1),s;for(n[0]===Ht&&(i[0](),i=[],n=[],s=[],a=0),c=0;c<d;c++)c<n.length&&n[c]!==h[c]?u[c](()=>h[c]):c>=n.length&&(s[c]=Ve(f));for(;c<n.length;c++)i[c]();return a=u.length=i.length=d,n=h.slice(0),s=s.slice(0,a)});function f(v){i[c]=v;const[p,m]=x(h[c]);return u[c]=m,t(p,c)}}}var zn=!1;function o(e,t){if(zn&&W.context){const r=W.context;Ut(jn());const n=xe(()=>e(t||{}));return Ut(r),n}return xe(()=>e(t||{}))}var Vn=e=>`Stale read from <${e}>.`;function N(e){const t="fallback"in e&&{fallback:()=>e.fallback};return H(Fn(()=>e.each,e.children,t||void 0))}function Wr(e){const t="fallback"in e&&{fallback:()=>e.fallback};return H(Hn(()=>e.each,e.children,t||void 0))}function b(e){const t=e.keyed,r=H(()=>e.when,void 0,void 0),n=t?r:H(r,void 0,{equals:(s,i)=>!s==!i});return H(()=>{const s=n();if(s){const i=e.children;return typeof i=="function"&&i.length>0?xe(()=>i(t?s:()=>{if(!xe(n))throw Vn("Show");return r()})):i}return e.fallback},void 0,void 0)}var fe=e=>H(()=>e());function Gn(e,t,r){let n=r.length,s=t.length,i=n,u=0,a=0,c=t[s-1].nextSibling,h=null;for(;u<s||a<i;){if(t[u]===r[a]){u++,a++;continue}for(;t[s-1]===r[i-1];)s--,i--;if(s===u){const d=i<n?a?r[a-1].nextSibling:r[i-a]:c;for(;a<i;)e.insertBefore(r[a++],d)}else if(i===a)for(;u<s;)(!h||!h.has(t[u]))&&t[u].remove(),u++;else if(t[u]===r[i-1]&&r[a]===t[s-1]){const d=t[--s].nextSibling;e.insertBefore(r[a++],t[u++].nextSibling),e.insertBefore(r[--i],d),t[s]=r[i]}else{if(!h){h=new Map;let f=a;for(;f<i;)h.set(r[f],f++)}const d=h.get(t[u]);if(d!=null)if(a<d&&d<i){let f=u,v=1,p;for(;++f<s&&f<i&&!((p=h.get(t[f]))==null||p!==d+v);)v++;if(v>d-a){const m=t[u];for(;a<d;)e.insertBefore(r[a++],m)}else e.replaceChild(r[a++],t[u++])}else u++;else t[u++].remove()}}}var pr="_$DX_DELEGATE";function Jn(e,t,r,n={}){let s;return Ve(i=>{s=i,t===document?e():l(t,e(),t.firstChild?null:void 0,r)},n.owner),()=>{s(),t.textContent=""}}function g(e,t,r,n){let s;const i=()=>{const a=n?document.createElementNS("http://www.w3.org/1998/Math/MathML","template"):document.createElement("template");return a.innerHTML=e,r?a.content.firstChild.firstChild:n?a.firstChild:a.content.firstChild},u=t?()=>xe(()=>document.importNode(s||(s=i()),!0)):()=>(s||(s=i())).cloneNode(!0);return u.cloneNode=u,u}function ie(e,t=window.document){const r=t[pr]||(t[pr]=new Set);for(let n=0,s=e.length;n<s;n++){const i=e[n];r.has(i)||(r.add(i),t.addEventListener(i,Wn))}}function z(e,t,r){nr(e)||(r==null?e.removeAttribute(t):e.setAttribute(t,r))}function R(e,t){nr(e)||(t==null?e.removeAttribute("class"):e.className=t)}function rr(e,t,r){if(!t)return r?z(e,"style"):t;const n=e.style;if(typeof t=="string")return n.cssText=t;typeof r=="string"&&(n.cssText=r=void 0),r||(r={}),t||(t={});let s,i;for(i in r)t[i]??n.removeProperty(i),delete r[i];for(i in t)s=t[i],s!==r[i]&&(n.setProperty(i,s),r[i]=s);return r}function Kn(e,t,r){return xe(()=>e(t,r))}function l(e,t,r,n){if(r!==void 0&&!n&&(n=[]),typeof t!="function")return St(e,t,n,r);w(s=>St(e,t(),s,r),n)}function nr(e){return!!W.context&&!W.done&&(!e||e.isConnected)}function Wn(e){if(W.registry&&W.events&&W.events.find(([c,h])=>h===e))return;let t=e.target;const r=`$$${e.type}`,n=e.target,s=e.currentTarget,i=c=>Object.defineProperty(e,"target",{configurable:!0,value:c}),u=()=>{const c=t[r];if(c&&!t.disabled){const h=t[`${r}Data`];if(h!==void 0?c.call(t,h,e):c.call(t,e),e.cancelBubble)return}return t.host&&typeof t.host!="string"&&!t.host._$host&&t.contains(e.target)&&i(t.host),!0},a=()=>{for(;u()&&(t=t._$host||t.parentNode||t.host););};if(Object.defineProperty(e,"currentTarget",{configurable:!0,get(){return t||document}}),W.registry&&!W.done&&(W.done=_$HY.done=!0),e.composedPath){const c=e.composedPath();i(c[0]);for(let h=0;h<c.length-2&&(t=c[h],!!u());h++){if(t._$host){t=t._$host,a();break}if(t.parentNode===s)break}}else a();i(n)}function St(e,t,r,n,s){const i=nr(e);if(i){!r&&(r=[...e.childNodes]);let c=[];for(let h=0;h<r.length;h++){const d=r[h];d.nodeType===8&&d.data.slice(0,2)==="!$"?d.remove():c.push(d)}r=c}for(;typeof r=="function";)r=r();if(t===r)return r;const u=typeof t,a=n!==void 0;if(e=a&&r[0]&&r[0].parentNode||e,u==="string"||u==="number"){if(i||u==="number"&&(t=t.toString(),t===r))return r;if(a){let c=r[0];c&&c.nodeType===3?c.data!==t&&(c.data=t):c=document.createTextNode(t),r=Ue(e,r,n,c)}else r!==""&&typeof r=="string"?r=e.firstChild.data=t:r=e.textContent=t}else if(t==null||u==="boolean"){if(i)return r;r=Ue(e,r,n)}else{if(u==="function")return w(()=>{let c=t();for(;typeof c=="function";)c=c();r=St(e,c,r,n)}),()=>r;if(Array.isArray(t)){const c=[],h=r&&Array.isArray(r);if(zt(c,t,r,s))return w(()=>r=St(e,c,r,n,!0)),()=>r;if(i){if(!c.length)return r;if(n===void 0)return r=[...e.childNodes];let d=c[0];if(d.parentNode!==e)return r;const f=[d];for(;(d=d.nextSibling)!==n;)f.push(d);return r=f}if(c.length===0){if(r=Ue(e,r,n),a)return r}else h?r.length===0?mr(e,c,n):Gn(e,r,c):(r&&Ue(e),mr(e,c));r=c}else if(t.nodeType){if(i&&t.parentNode)return r=a?[t]:t;if(Array.isArray(r)){if(a)return r=Ue(e,r,n,t);Ue(e,r,null,t)}else r==null||r===""||!e.firstChild?e.appendChild(t):e.replaceChild(t,e.firstChild);r=t}}return r}function zt(e,t,r,n){let s=!1;for(let i=0,u=t.length;i<u;i++){let a=t[i],c=r&&r[e.length],h;if(!(a==null||a===!0||a===!1))if((h=typeof a)=="object"&&a.nodeType)e.push(a);else if(Array.isArray(a))s=zt(e,a,c)||s;else if(h==="function")if(n){for(;typeof a=="function";)a=a();s=zt(e,Array.isArray(a)?a:[a],Array.isArray(c)?c:[c])||s}else e.push(a),s=!0;else{const d=String(a);c&&c.nodeType===3&&c.data===d?e.push(c):e.push(document.createTextNode(d))}}return s}function mr(e,t,r=null){for(let n=0,s=t.length;n<s;n++)e.insertBefore(t[n],r)}function Ue(e,t,r,n){if(r===void 0)return e.textContent="";const s=n||document.createTextNode("");if(t.length){let i=!1;for(let u=t.length-1;u>=0;u--){const a=t[u];if(s!==a){const c=a.parentNode===e;!i&&!u?c?e.replaceChild(s,a):e.insertBefore(s,r):c&&a.remove()}else i=!0}}else e.insertBefore(s,r);return[s]}var Yr="kickjs-devtools-theme";function Yn(){try{const e=localStorage.getItem(Yr);if(e==="dark"||e==="light"||e==="system")return e}catch{}return"system"}function Qn(){return typeof window>"u"||!window.matchMedia?"dark":window.matchMedia("(prefers-color-scheme: light)").matches?"light":"dark"}var[Qr,Xn]=x(Yn()),[Zn,el]=x(Qn());if(typeof window<"u"&&window.matchMedia){const e=window.matchMedia("(prefers-color-scheme: light)"),t=r=>el(r.matches?"light":"dark");e.addEventListener("change",t)}var Ot=Qr;function Xr(){const e=Qr();return e==="system"?Zn():e}function tl(e){Xn(e);try{localStorage.setItem(Yr,e)}catch{}}function rl(){Ce(()=>{const e=Xr();document.documentElement.dataset.theme=e}),$e(()=>{delete document.documentElement.dataset.theme})}var Zr="kickjs-devtools-density";function nl(){try{const e=localStorage.getItem(Zr);if(e==="sm"||e==="md"||e==="lg")return e}catch{}return"sm"}var[en,ll]=x(nl()),br=en;function sl(e){ll(e);try{localStorage.setItem(Zr,e)}catch{}}function il(){Ce(()=>{document.documentElement.dataset.density=en()}),$e(()=>{delete document.documentElement.dataset.density})}var[al,ol]=x("connecting"),[cl,xr]=x(null),[ul,dl]=x(!1),[hl,fl]=x(null),[gl,vl]=x(null),[pl,ml]=x(null),[bl,xl]=x([]),[$l,yl]=x([]),[_l,wl]=x({enabled:!1,queues:[]}),[Sl,kl]=x({enabled:!1}),q={connectionStatus:al,lastUpdate:cl,authRequired:ul,authError:hl,health:gl,metrics:pl,routes:bl,container:$l,queues:_l,ws:Sl},X={setConnectionStatus:ol,setLastUpdate:xr,setAuthRequired:dl,setAuthError:fl,setHealth:vl,setMetrics:ml,setRoutes:xl,setContainer:yl,setQueues:wl,setWs:kl,touch(){xr(new Date)}};function he(e){return e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(1)} KiB`:e<1073741824?`${(e/1024/1024).toFixed(1)} MiB`:`${(e/1024/1024/1024).toFixed(2)} GiB`}function Cl(e){if(e===0)return"0";const t=e*60;return Math.abs(t)<1048576?`${(t/1024).toFixed(1)} KiB/min`:`${(t/1024/1024).toFixed(1)} MiB/min`}function Me(e){return e<1?`${e.toFixed(2)} ms`:e<100?`${e.toFixed(1)} ms`:`${Math.round(e)} ms`}function lr(e){const t=Math.floor(e);return t<60?`${t}s`:t<3600?`${Math.floor(t/60)}m ${t%60}s`:`${Math.floor(t/3600)}h ${Math.floor(t%3600/60)}m ${t%60}s`}function kt(e){return`${Math.round(e*100)}%`}function Vt(e){const t=e.toUpperCase();return t==="GET"?"text-emerald-400":t==="POST"?"text-cyan-400":t==="PUT"||t==="PATCH"?"text-amber-400":t==="DELETE"?"text-red-400":"text-text-secondary"}var Tl=g('<span class=dt-tip tabindex=0><svg class=dt-tip-icon viewBox="0 0 24 24"aria-hidden=true><circle cx=12 cy=12 r=9 fill=none stroke=currentColor stroke-width=1.5></circle><path d="M12 8h.01M12 11v6"stroke=currentColor stroke-width=2 stroke-linecap=round fill=none></path></svg><span role=tooltip>'),El=g('<button type=button class="dt-tip dt-tip-clickable"><svg class=dt-tip-icon viewBox="0 0 24 24"aria-hidden=true><circle cx=12 cy=12 r=9 fill=none stroke=currentColor stroke-width=1.5></circle><path d="M12 8h.01M12 11v6"stroke=currentColor stroke-width=2 stroke-linecap=round fill=none>'),Al=g('<div class="fixed inset-0 z-50 bg-slate-950/80 flex items-center justify-center p-4"><div class="bg-slate-900 border border-slate-700 rounded-2xl p-6 max-w-lg w-full shadow-2xl max-h-[90vh] overflow-y-auto"><div class="flex items-start justify-between mb-4"><h2 class="text-lg font-semibold text-slate-200"></h2><button type=button class="text-slate-500 hover:text-slate-300 p-1"aria-label=Close><svg class="w-5 h-5"fill=none stroke=currentColor viewBox="0 0 24 24"><path stroke-linecap=round stroke-linejoin=round stroke-width=2 d="M6 18L18 6M6 6l12 12"></path></svg></button></div><div class="text-sm text-slate-300 space-y-3">'),Gt={"heap.used":{short:"V8-allocated memory currently used by JavaScript objects.",detail:"Grows as your code allocates objects, shrinks after GC frees them. A consistently rising heap-used line on the sparkline is the textbook leak signature."},"heap.total":{short:"V8-allocated memory the JS heap is currently sized to use.",detail:"Larger than heap-used; V8 reserves headroom so allocations don't pause to grow the heap. Bumps up in 1-8 MiB jumps as the heap expands."},rss:{short:"Total memory resident in physical RAM for this Node process.",detail:'Includes the JS heap, native buffers, V8 internal structures, and code. Always larger than heap-used; the gap is "everything the OS sees" minus "JS objects".'},external:{short:"Memory used by C++ objects bound to JS (Buffers, native bindings)."},"array-buffers":{short:"Memory used by ArrayBuffer / SharedArrayBuffer instances."},"event-loop.p99":{short:"99% of event-loop ticks completed within this time.",detail:"Sustained values above ~50ms mean some synchronous operation is blocking the loop. Common culprits: large JSON.parse, sync crypto, blocking DB drivers."},gc:{short:"Garbage-collector activity since process start.",detail:"Total run count and cumulative pause time. Frequent GC with low reclaim ratio = leak; rare GC with healthy reclaim = good citizen."},"leak.risk":{short:"Heap-growth slope over the recent window — stable / warn / critical.",detail:"Bucketed from heap-growth in MB/min: <5 = ok, <20 = warn, ≥20 = critical. Critical sustained for >5 minutes is the moment to capture a heap snapshot."},"gc.reclaim":{short:"Average ratio of memory freed by each GC pass.",detail:"Trending toward zero means GC can't free anything — strong leak indicator. Healthy apps reclaim 20-60% on each major GC."},"heap.utilization":{short:"Fraction of V8's hard heap-size limit currently in use.",detail:"Approaching 1 means the process is close to OOM. Use --max-old-space-size to raise the limit if your workload is memory-bound."},requests:{short:"Total HTTP requests handled since process start."},"server-errors":{short:"5xx responses — server-side failures."},"client-errors":{short:"4xx responses — bad client input, missing routes, auth denials."},"error-rate":{short:"Server errors as a percentage of total requests.",detail:"Computed across the lifetime of the process. Spikes typically signal upstream dependency failures; sustained elevation = code bug."},uptime:{short:"How long this Node process has been running."},"latency.avg":{short:"Mean response time per route (sum of all calls / call count)."},"latency.p50":{short:"Median — half the requests complete faster than this."},"latency.p95":{short:"95% of requests complete within this time."},"latency.p99":{short:"99% of requests complete within this time. Outlier-sensitive."},"latency.max":{short:"Slowest single response observed since process start."},"resolve.count":{short:"Number of times this token was resolved from the DI container."},"resolve.duration":{short:"How long the container took to resolve this token (ms)."},"post-construct":{short:"@PostConstruct lifecycle status: done / failed / none.",detail:'A failed PostConstruct means the service registered but its async init threw. The token is left in a "registered" state; resolve() will throw the original error.'}},ve=e=>{const t=()=>e.text??Gt[e.metric??""]?.short??"",r=e.placement??"top";return(()=>{var n=Tl(),s=n.firstChild.nextSibling;return R(s,`dt-tip-pop dt-tip-pop-${r}`),l(s,t),w(()=>z(n,"aria-label",t())),n})()},Ml=e=>{const[t,r]=x(!1);return[(()=>{var n=El();return n.$$click=()=>r(!0),w(()=>z(n,"aria-label",`More info: ${e.title}`)),n})(),o(b,{get when(){return t()},get children(){return o(Ll,{get title(){return e.title},onClose:()=>r(!1),get children(){return e.children}})}})]},Ll=e=>(()=>{var t=Al(),r=t.firstChild.firstChild,n=r.firstChild,s=n.nextSibling,i=r.nextSibling;return t.$$click=u=>{u.target===u.currentTarget&&e.onClose()},l(n,()=>e.title),s.$$click=()=>e.onClose(),l(i,()=>e.children),t})();ie(["click"]);var Rl=g('<div class="grid grid-cols-1 md:grid-cols-3 gap-4">'),Ol=g('<div class="bg-surface-1 rounded-xl border border-border p-5"><h2 class="text-xs font-semibold uppercase tracking-wider text-text-muted mb-3">Health'),tn=g('<p class="text-text-muted italic">Loading…'),jl=g("<span>"),Ge=g('<span class="font-semibold tabular-nums">'),rn=g("<div class=mt-1>"),Nl=g('<div class="border-t border-border mt-2 pt-2"><button type=button class="text-xs text-text-muted hover:text-text-strong flex items-center gap-1"><svg fill=none stroke=currentColor viewBox="0 0 24 24"aria-hidden=true><path stroke-linecap=round stroke-linejoin=round stroke-width=2 d="M9 5l7 7-7 7"></path></svg>Adapters (<!>)'),Il=g('<div class="flex items-center justify-between py-1"><span class="text-text-secondary text-sm"></span><span>'),Pl=g('<div class="bg-surface-1 rounded-xl border border-border p-5"><h2 class="text-xs font-semibold uppercase tracking-wider text-text-muted mb-3">Metrics'),Bl=g('<span class="font-semibold tabular-nums text-red-400">'),ql=g('<span class="font-semibold tabular-nums text-amber-400">'),Dl=g('<span class="font-semibold text-sm">'),Ul=g('<span class="font-semibold tabular-nums text-emerald-400">'),Fl=g('<div class="border-t border-border mt-2 pt-2"><button type=button class="text-xs text-text-muted hover:text-text-strong flex items-center gap-1"><svg fill=none stroke=currentColor viewBox="0 0 24 24"aria-hidden=true><path stroke-linecap=round stroke-linejoin=round stroke-width=2 d="M9 5l7 7-7 7"></path></svg>Namespaces (<!>)'),Hl=g('<div class="bg-surface-1 rounded-xl border border-border p-5"><h2 class="text-xs font-semibold uppercase tracking-wider text-text-muted mb-3">WebSocket'),zl=g('<p class="text-text-muted italic">No WsAdapter detected'),Vl=g('<div class="flex items-center justify-between py-1"><span class="text-text-secondary text-sm font-mono"></span><span class=text-sm> conn / <!> handlers'),Gl=g('<div class="flex items-center justify-between mb-2"><span class=text-text-secondary>'),Jl=()=>(()=>{var e=Rl();return l(e,o(Kl,{}),null),l(e,o(Wl,{}),null),l(e,o(Yl,{}),null),e})(),Kl=()=>{const[e,t]=x(!0);return(()=>{var r=Ol();return r.firstChild,l(r,o(b,{get when(){return q.health()},get fallback(){return tn()},children:n=>[o(Te,{label:"Status",get children(){var s=jl();return l(s,()=>n().status),w(()=>R(s,`badge ${Ql(n().status)}`)),s}}),o(Te,{label:"Uptime",get children(){var s=Ge();return l(s,()=>lr(n().uptime)),s}}),o(Te,{label:"Error rate",get children(){var s=Ge();return l(s,()=>kt(n().errorRate),null),l(s,o(ve,{metric:"error-rate"}),null),s}}),o(b,{get when(){return Object.keys(n().adapters).length>0},get children(){var s=Nl(),i=s.firstChild,u=i.firstChild,a=u.nextSibling.nextSibling;return a.nextSibling,i.$$click=()=>t(c=>!c),l(i,()=>Object.keys(n().adapters).length,a),l(s,o(b,{get when(){return e()},get children(){var c=rn();return l(c,o(N,{get each(){return Object.entries(n().adapters)},children:([h,d])=>(()=>{var f=Il(),v=f.firstChild,p=v.nextSibling;return l(v,h),R(p,`badge ${d==="running"?"badge-ok":"badge-warn"}`),l(p,d),f})()})),c}}),null),w(()=>z(u,"class",`w-3 h-3 transition-transform ${e()?"rotate-90":""}`)),s}})]}),null),r})()},Wl=()=>(()=>{var e=Pl();return e.firstChild,l(e,o(b,{get when(){return q.metrics()},get fallback(){return tn()},children:t=>[o(Te,{label:"Total requests",get children(){var r=Ge();return l(r,()=>t().requests.toLocaleString()),r}}),o(Te,{label:"5xx errors",get children(){var r=Bl();return l(r,()=>t().serverErrors),r}}),o(Te,{label:"4xx errors",get children(){var r=ql();return l(r,()=>t().clientErrors),r}}),o(Te,{label:"Started",get children(){var r=Dl();return l(r,()=>new Date(t().startedAt).toLocaleTimeString()),r}})]}),null),e})(),Yl=()=>{const[e,t]=x(!1);return(()=>{var r=Hl();return r.firstChild,l(r,o(b,{get when(){return q.ws().enabled},get fallback(){return zl()},get children(){return[o(Te,{label:"Active",get children(){var n=Ul();return l(n,()=>q.ws().activeConnections??0),n}}),o(Te,{label:"Total",get children(){var n=Ge();return l(n,()=>q.ws().totalConnections??0),n}}),o(Te,{label:"Messages in",get children(){var n=Ge();return l(n,()=>q.ws().messagesReceived??0),n}}),o(Te,{label:"Messages out",get children(){var n=Ge();return l(n,()=>q.ws().messagesSent??0),n}}),o(b,{get when(){return fe(()=>!!q.ws().namespaces)()&&Object.keys(q.ws().namespaces??{}).length>0},get children(){var n=Fl(),s=n.firstChild,i=s.firstChild,u=i.nextSibling.nextSibling;return u.nextSibling,s.$$click=()=>t(a=>!a),l(s,()=>Object.keys(q.ws().namespaces??{}).length,u),l(n,o(b,{get when(){return e()},get children(){var a=rn();return l(a,o(N,{get each(){return Object.entries(q.ws().namespaces??{})},children:([c,h])=>(()=>{var d=Vl(),f=d.firstChild,v=f.nextSibling,p=v.firstChild,m=p.nextSibling;return m.nextSibling,l(f,c),l(v,()=>h.connections,p),l(v,()=>h.handlers,m),d})()})),a}}),null),w(()=>z(i,"class",`w-3 h-3 transition-transform ${e()?"rotate-90":""}`)),n}})]}}),null),r})()},Te=e=>(()=>{var t=Gl(),r=t.firstChild;return l(r,()=>e.label),l(t,()=>e.children,null),t})();function Ql(e){return e==="healthy"?"badge-ok":e==="degraded"?"badge-warn":"badge-critical"}ie(["click"]);var Xl=g("<svg class=sparkline preserveAspectRatio=none aria-hidden=true><path fill=none stroke-width=1.5 stroke-linejoin=round stroke-linecap=round>"),mt=e=>{const t=()=>e.width??200,n=H(()=>{const s=e.values;if(s.length<2)return"";const i=Math.min(...s),u=Math.max(...s)-i||1,a=t()/(s.length-1),c=d=>40-(d-i)/u*36-2;let h=`M0 ${c(s[0]).toFixed(2)}`;for(let d=1;d<s.length;d++)h+=` L${(d*a).toFixed(2)} ${c(s[d]).toFixed(2)}`;return h});return(()=>{var s=Xl(),i=s.firstChild;return w(u=>{var a=`0 0 ${t()} 40`,c=n(),h=e.stroke??"var(--color-accent)";return a!==u.e&&z(s,"viewBox",u.e=a),c!==u.t&&z(i,"d",u.t=c),h!==u.a&&z(i,"stroke",u.a=h),u},{e:void 0,t:void 0,a:void 0}),s})()};function Ie(){return document.body.dataset.base??"/_debug"}var sr="kickjs_devtools_token",Zl=30,bt=null;function De(){if(bt)return bt;const e=new URLSearchParams(location.search).get("token");if(e){Jt(e);const r=new URL(location.href);return r.searchParams.delete("token"),history.replaceState({},"",r.toString()),e}const t=document.cookie.match(new RegExp(`${sr}=([^;]+)`));return t?(Jt(decodeURIComponent(t[1])),bt):null}function Jt(e){bt=e,document.cookie=`${sr}=${encodeURIComponent(e)}; path=${Ie()}; max-age=${86400*Zl}; SameSite=Lax`,es()}function es(){Ie()!=="/"&&(document.cookie=`${sr}=; path=/; max-age=0; SameSite=Lax`)}function nn(e){const t=De();return t?`${e}${e.includes("?")?"&":"?"}token=${encodeURIComponent(t)}`:e}var ln=class extends Error{constructor(){super("AUTH_REQUIRED"),this.name="AuthRequiredError"}};async function Se(e){const t=nn(`${Ie()}${e}`),r=await fetch(t,{headers:ts()});if(r.status===401||r.status===403)throw new ln;if(!r.ok)throw new Error(`GET ${e} failed: ${r.status} ${r.statusText}`);return await r.json()}function ts(){const e=De();return e?{"x-devtools-token":e}:{}}var ge={runtime:()=>Se("/runtime"),topology:()=>Se("/topology"),metrics:()=>Se("/metrics"),routes:()=>Se("/metrics"),source:(e,t)=>Se(`/source?${new URLSearchParams({controller:e,handler:t})}`),routeRegistry:()=>Se("/routes"),container:()=>Se("/container"),health:()=>Se("/health"),queues:()=>Se("/queues"),ws:()=>Se("/ws"),tabs:()=>Se("/tabs")};function ir(e,t,r){const n=nn(`${Ie()}${e}`),s=new EventSource(n);return s.addEventListener("message",i=>{try{t(JSON.parse(i.data))}catch(u){console.warn("SSE parse failed",u)}}),r&&s.addEventListener("error",r),()=>s.close()}var rs=g("<div class=status><span><span></span></span><span> samples"),ns=g("<div class=proc-strip><span class=proc-label>These stats are for <strong>this Node process</strong> — the one running your KickJS app.</span><span class=proc-meta><span class=proc-pill>Node </span><span class=proc-pill>/</span><span class=proc-pill>pid "),ls=g("<span>engine: "),ss=g("<div class=empty>Loading runtime metrics…"),is=g("<div class=empty style=padding:0;text-align:left;font-size:11px>GC: <!> runs, <!> total"),$r=g("<div class=grid>"),as=g("<div class=card><div class=card-header><div class=card-title></div><div class=card-value>"),os=()=>{const[e,t]=x(null),[r,n]=x(null),[s,i]=x([]),[u,a]=x([]),[c,h]=x([]),[d,f]=x(!1),v=p=>{t(p),i(m=>[...m,p.memory.heapUsed].slice(-60)),a(m=>[...m,p.memory.rss].slice(-60)),h(m=>[...m,p.eventLoop.p99].slice(-60))};return Je(()=>{ge.runtime().then(m=>{m.process&&n(m.process);for(const k of m.history)v(k);f(!0)}).catch(()=>f(!1));const p=ir("/runtime/stream",m=>{f(!0),v(m)},()=>f(!1));$e(p)}),[o(b,{get when(){return r()},children:p=>(()=>{var m=ns(),k=m.firstChild.nextSibling,S=k.firstChild;S.firstChild;var y=S.nextSibling,$=y.firstChild,L=y.nextSibling;return L.firstChild,l(k,o(b,{get when(){return p().runtime},children:A=>(()=>{var O=ls();return O.firstChild,l(O,()=>A().name,null),w(()=>R(O,`proc-pill rt-${A().name}`)),O})()}),S),l(S,()=>p().nodeVersion,null),l(y,()=>p().platform,$),l(y,()=>p().arch,null),l(L,()=>p().pid,null),m})()}),o(b,{get when(){return e()},get fallback(){return ss()},children:p=>[(()=>{var m=$r();return l(m,o(Oe,{title:"Heap used",metric:"heap.used",get value(){return he(p().memory.heapUsed)},get children(){return o(mt,{get values(){return s()}})}}),null),l(m,o(Oe,{title:"RSS",metric:"rss",get value(){return he(p().memory.rss)},get children(){return o(mt,{get values(){return u()}})}}),null),l(m,o(Oe,{title:"Event loop p99",metric:"event-loop.p99",get value(){return Me(p().eventLoop.p99)},get children(){return o(mt,{get values(){return c()}})}}),null),l(m,o(Oe,{title:"Uptime",metric:"uptime",get value(){return lr(p().uptimeSec)},get children(){var k=is(),S=k.firstChild.nextSibling,y=S.nextSibling.nextSibling;return y.nextSibling,l(k,()=>p().gc.count,S),l(k,()=>Me(p().gc.totalPauseMs),y),k}}),null),m})(),(()=>{var m=$r();return l(m,o(Oe,{title:"External",metric:"external",get value(){return he(p().memory.external)}}),null),l(m,o(Oe,{title:"Array buffers",metric:"array-buffers",get value(){return he(p().memory.arrayBuffers)}}),null),l(m,o(Oe,{title:"Heap total",metric:"heap.total",get value(){return he(p().memory.heapTotal)}}),null),l(m,o(Oe,{title:"CPU (last sample)",get value(){return`${(p().cpu.userMicros/1e3).toFixed(1)} ms u / ${(p().cpu.systemMicros/1e3).toFixed(1)} ms s`}}),null),m})()]}),(()=>{var p=rs(),m=p.firstChild,k=m.firstChild,S=m.nextSibling,y=S.firstChild;return l(m,()=>d()?"streaming":"reconnecting…",null),l(S,()=>s().length,y),w(()=>R(k,`status-dot ${d()?"connected":"disconnected"}`)),p})()]},Oe=e=>(()=>{var t=as(),r=t.firstChild.firstChild,n=r.nextSibling;return l(r,()=>e.title,null),l(r,o(b,{get when(){return e.metric},children:s=>o(ve,{get metric(){return s()}})}),null),l(n,()=>e.value),l(t,()=>e.children,null),t})(),cs=g("<div class=status><span><span></span></span><span> samples"),us=g("<div class=empty>Loading memory metrics…"),yr=g("<p>"),ds=g("<p><strong>Severity buckets</strong> (heap-growth in MB/min):"),hs=g('<ul class="list-disc pl-5 space-y-1"><li><span class="badge badge-ok">ok</span> < 5 MB/min — typical operation.</li><li><span class="badge badge-warn">warn</span> < 20 MB/min — investigate if sustained > 5 minutes.</li><li><span class="badge badge-critical">critical</span> ≥ 20 MB/min — capture a heap snapshot now.'),fs=g("<div class=card><div class=card-header><div class=card-title>Leak risk</div><span></span></div><div style=display:flex;justify-content:space-between;align-items:baseline><div class=card-value> growth</div><div class=card-value style=font-size:13px;color:var(--text-dim)>GC reclaim<!> <!> • heap util<!> "),gs=g("<div class=grid>"),vs=g("<table><thead><tr><th>Type</th><th style=text-align:right>Count</th></tr></thead><tbody>"),ps=g("<div class=card><div class=card-header><div class=card-title>Active handles</div><div class=card-value>"),ms=g("<div class=empty>No handle inventory available on this runtime."),bs=g("<tr><td></td><td style=text-align:right>"),xs=g("<div class=card><div class=card-header><div class=card-title></div><div class=card-value>"),$s=g('<div class=card><div class=card-header><div class=card-title>Heap snapshot</div><div class=card-value style=font-size:13px;color:var(--text-dim)>~<!> estimate</div></div><p style="margin:0 0 12px;color:var(--text-dim);font-size:12px">Captures a V8 heap snapshot for retained-size analysis in Chrome DevTools (Memory tab, Load profile). Capture blocks the event loop for several seconds — avoid in production.</p><div style=display:flex;align-items:center;gap:12px><button type=button class=tab style="border:1px solid var(--accent);border-radius:4px;padding:6px 14px;border-bottom-color:var(--accent);color:var(--accent)">'),ys=g("<span style=color:var(--text-dim);font-size:12px;font-family:var(--font-mono)>Last: <!> (<!>)"),sn=g('<p style="margin:8px 0 0;color:var(--critical);font-size:12px;font-family:var(--font-mono)">'),_s=g('<div class=card><div class=card-header><div class=card-title>Force GC</div></div><p style="margin:0 0 12px;color:var(--text-dim);font-size:12px">Triggers a synchronous V8 GC pass to confirm whether heap growth is real retention or just uncollected garbage. Requires <code>node --expose-gc</code>.</p><div style=display:flex;align-items:center;gap:12px;flex-wrap:wrap><button type=button class=tab style="border:1px solid var(--accent);border-radius:4px;padding:6px 14px;border-bottom-color:var(--accent);color:var(--accent)">'),ws=g("<span style=color:var(--text-dim);font-size:12px;font-family:var(--font-mono)>Reclaimed <!> (<!> → <!>) in <!>ms"),Ss=()=>{const[e,t]=x(null),[r,n]=x([]),[s,i]=x(!1),u=c=>{t(c),n(h=>[...h,c.snapshot.memory.heapUsed].slice(-60))};Je(()=>{ge.runtime().then(h=>{h.latest&&(u({snapshot:h.latest,health:h.health}),n(h.history.map(d=>d.memory.heapUsed).slice(-60))),i(!0)}).catch(()=>i(!1));const c=ir("/memory/stream",h=>{i(!0),u(h)},()=>i(!1));$e(c)});const a=H(()=>{const c=e();return c?Object.entries(c.health.handlesByType).toSorted((h,d)=>d[1]-h[1]):[]});return[o(b,{get when(){return e()},get fallback(){return us()},children:c=>[(()=>{var h=fs(),d=h.firstChild,f=d.firstChild;f.firstChild;var v=f.nextSibling,p=d.nextSibling.firstChild,m=p.firstChild,k=p.nextSibling,S=k.firstChild.nextSibling,y=S.nextSibling.nextSibling,$=y.nextSibling.nextSibling;return $.nextSibling,l(f,o(Ml,{title:"What is leak risk?",get children(){return[(()=>{var L=yr();return l(L,()=>Gt["leak.risk"].short),L})(),(()=>{var L=yr();return l(L,()=>Gt["leak.risk"].detail),L})(),ds(),hs()]}}),null),l(v,()=>c().health.heapGrowthSeverity),l(p,()=>Cl(c().health.heapGrowthBytesPerSec),m),l(k,o(ve,{metric:"gc.reclaim"}),S),l(k,()=>kt(c().health.gcReclaimRatio),y),l(k,o(ve,{metric:"heap.utilization"}),$),l(k,()=>kt(c().health.heapUtilization),null),l(h,o(mt,{get values(){return r()}}),null),w(()=>R(v,`badge badge-${c().health.heapGrowthSeverity}`)),h})(),(()=>{var h=gs();return l(h,o(ot,{title:"Heap used",metric:"heap.used",get value(){return he(c().snapshot.memory.heapUsed)}}),null),l(h,o(ot,{title:"Heap total",metric:"heap.total",get value(){return he(c().snapshot.memory.heapTotal)}}),null),l(h,o(ot,{title:"RSS",metric:"rss",get value(){return he(c().snapshot.memory.rss)}}),null),l(h,o(ot,{title:"External",metric:"external",get value(){return he(c().snapshot.memory.external)}}),null),h})(),(()=>{var h=ps(),d=h.firstChild.firstChild.nextSibling;return l(d,()=>c().health.activeHandles),l(h,o(b,{get when(){return a().length>0},get fallback(){return ms()},get children(){var f=vs(),v=f.firstChild.nextSibling;return l(v,o(N,{get each(){return a()},children:([p,m])=>(()=>{var k=bs(),S=k.firstChild,y=S.nextSibling;return l(S,p),l(y,m),k})()})),f}}),null),h})(),o(ks,{get heapTotal(){return c().snapshot.memory.heapTotal}}),o(Es,{})]}),(()=>{var c=cs(),h=c.firstChild,d=h.firstChild,f=h.nextSibling,v=f.firstChild;return l(h,()=>s()?"streaming":"reconnecting…",null),l(f,()=>r().length,v),w(()=>R(d,`status-dot ${s()?"connected":"disconnected"}`)),c})()]},ot=e=>(()=>{var t=xs(),r=t.firstChild.firstChild,n=r.nextSibling;return l(r,()=>e.title,null),l(r,o(b,{get when(){return e.metric},children:s=>o(ve,{get metric(){return s()}})}),null),l(n,()=>e.value),t})(),ks=e=>{const[t,r]=x(!1),[n,s]=x(null),[i,u]=x(null),a=async()=>{r(!0),s(null);try{const c=De(),h=`${Ie()}/memory/snapshot${c?`?token=${encodeURIComponent(c)}`:""}`,d=await fetch(h,{method:"POST",headers:c?{"x-devtools-token":c}:void 0});if(!d.ok){let p=`${d.status} ${d.statusText}`;try{const m=await d.json();m.error&&(p=m.error)}catch{}throw new Error(p)}const f=await d.blob(),v=Cs(d.headers.get("content-disposition"))??`kickjs-heap-${Date.now()}.heapsnapshot`;Ts(f,v),u({name:v,sizeBytes:f.size})}catch(c){s(c instanceof Error?c.message:String(c))}finally{r(!1)}};return(()=>{var c=$s(),h=c.firstChild,d=h.firstChild.nextSibling,f=d.firstChild.nextSibling;f.nextSibling;var v=h.nextSibling.nextSibling,p=v.firstChild;return l(d,()=>he(e.heapTotal),f),p.$$click=()=>{a()},l(p,()=>t()?"Capturing…":"Take snapshot"),l(v,o(b,{get when(){return i()},children:m=>(()=>{var k=ys(),S=k.firstChild.nextSibling,y=S.nextSibling.nextSibling;return y.nextSibling,l(k,()=>m().name,S),l(k,()=>he(m().sizeBytes),y),k})()}),null),l(c,o(b,{get when(){return n()},children:m=>(()=>{var k=sn();return l(k,m),k})()}),null),w(()=>p.disabled=t()),c})()};function Cs(e){if(!e)return null;const t=/filename="?([^";]+)"?/.exec(e);return t?t[1]:null}function Ts(e,t){const r=URL.createObjectURL(e),n=document.createElement("a");n.href=r,n.download=t,document.body.appendChild(n),n.click(),document.body.removeChild(n),URL.revokeObjectURL(r)}var Es=()=>{const[e,t]=x(!1),[r,n]=x(null),[s,i]=x(null),u=async()=>{t(!0),i(null);try{const a=De(),c=`${Ie()}/memory/gc${a?`?token=${encodeURIComponent(a)}`:""}`,h=await fetch(c,{method:"POST",headers:a?{"x-devtools-token":a}:void 0});if(!h.ok){let d=`${h.status} ${h.statusText}`;try{const f=await h.json();f.error&&(d=f.error)}catch{}throw new Error(d)}n(await h.json())}catch(a){i(a instanceof Error?a.message:String(a))}finally{t(!1)}};return(()=>{var a=_s(),c=a.firstChild.nextSibling.nextSibling,h=c.firstChild;return h.$$click=()=>{u()},l(h,()=>e()?"Collecting…":"Run GC"),l(c,o(b,{get when(){return r()},children:d=>(()=>{var f=ws(),v=f.firstChild.nextSibling,p=v.nextSibling.nextSibling,m=p.nextSibling.nextSibling,k=m.nextSibling.nextSibling;return k.nextSibling,l(f,()=>he(d().reclaimedBytes),v),l(f,()=>he(d().before),p),l(f,()=>he(d().after),m),l(f,()=>d().elapsedMs,k),f})()}),null),l(a,o(b,{get when(){return s()},children:d=>(()=>{var f=sn();return l(f,d),f})()}),null),w(()=>h.disabled=e()),a})()};ie(["click"]);var As=g('<div class="flex items-center justify-between mt-4 pt-3 border-t border-slate-800 text-xs text-slate-500"><div class="flex items-center gap-3"><span>Showing <!>–<!> of </span><label class="flex items-center gap-1"><span class=text-slate-600>Per page</span><select class="bg-slate-800 border border-slate-700 rounded px-1.5 py-0.5 text-slate-200"></select></label></div><div class="flex items-center gap-1"><button type=button class="px-2.5 py-1 rounded border border-slate-700 bg-slate-800 hover:bg-slate-700 disabled:opacity-30">Prev</button><button type=button class="px-2.5 py-1 rounded border border-slate-700 bg-slate-800 hover:bg-slate-700 disabled:opacity-30">Next'),Ms=g("<option>"),Ls=g('<span class="px-1 text-slate-600">…'),Rs=g("<button type=button>"),Os=[5,10,15,20,25,50,100];function Pe(e,t={}){const r=t.pageSizeChoices??Os,n=t.pageSize??r[0]??5,[s,i]=x(n),[u,a]=x(1),c=H(()=>Math.max(1,Math.ceil(e().length/s()))),h=H(()=>Math.min(u(),c()));return{source:e,page:H(()=>{const d=(h()-1)*s();return e().slice(d,d+s())}),current:h,total:c,pageSize:s,pageSizeChoices:r,range:H(()=>{const d=e().length;return d===0?{start:0,end:0,total:0}:{start:(h()-1)*s()+1,end:Math.min(h()*s(),d),total:d}}),goto(d){a(Math.max(1,Math.min(d,c())))},next(){a(d=>Math.min(d+1,c()))},prev(){a(d=>Math.max(d-1,1))},setPageSize(d){i(d);const f=(h()-1)*s();a(Math.max(1,Math.floor(f/d)+1))}}}var Be=e=>{const t=H(()=>{const r=e.pager.total(),n=e.pager.current();if(r<=7)return Array.from({length:r},(a,c)=>c+1);const s=[1],i=Math.max(2,n-1),u=Math.min(r-1,n+1);i>2&&s.push("gap");for(let a=i;a<=u;a++)s.push(a);return u<r-1&&s.push("gap"),s.push(r),s});return o(b,{get when(){return e.pager.total()>1||e.pager.source().length>e.pager.pageSize()},get children(){var r=As(),n=r.firstChild,s=n.firstChild,i=s.firstChild.nextSibling,u=i.nextSibling.nextSibling;u.nextSibling;var a=s.nextSibling.firstChild.nextSibling,c=n.nextSibling,h=c.firstChild,d=h.nextSibling;return l(s,()=>e.pager.range().start,i),l(s,()=>e.pager.range().end,u),l(s,()=>e.pager.range().total,null),a.addEventListener("change",f=>e.pager.setPageSize(Number(f.currentTarget.value))),l(a,o(N,{get each(){return e.pager.pageSizeChoices},children:f=>(()=>{var v=Ms();return v.value=f,l(v,f),v})()})),h.$$click=()=>e.pager.prev(),l(c,o(N,{get each(){return t()},children:f=>o(b,{when:f==="gap",get fallback(){return(()=>{var v=Rs();return v.$$click=()=>e.pager.goto(f),l(v,f),w(()=>R(v,`px-2.5 py-1 rounded border ${f===e.pager.current()?"border-kick-500/30 bg-kick-500/20 text-kick-500":"border-slate-700 bg-slate-800 hover:bg-slate-700"}`)),v})()},get children(){return Ls()}})}),d),d.$$click=()=>e.pager.next(),w(f=>{var v=e.pager.current()===1,p=e.pager.current()===e.pager.total();return v!==f.e&&(h.disabled=f.e=v),p!==f.t&&(d.disabled=f.t=p),f},{e:void 0,t:void 0}),w(()=>a.value=e.pager.pageSize()),r}})};ie(["click"]);var js=g('<div style=display:flex;justify-content:space-between;align-items:center;margin-bottom:12px><h2 style=margin:0;font-size:16px>Topology</h2><button type=button class=tab style="border:1px solid var(--border);border-radius:4px;padding:4px 12px;border-bottom-color:var(--border)">'),Ns=g("<div class=card style=border-color:var(--critical)><div class=card-title style=color:var(--critical)>Topology error</div><code>"),Is=g("<div class=empty>Loading topology…"),Ps=g('<div class=card style=border-color:var(--warn)><div class=card-title style=color:var(--warn)> introspect failure(s)</div><ul style="margin:8px 0 0;padding-left:20px;font-family:var(--font-mono);font-size:12px">'),Bs=g("<li>/<!>: "),qs=g("<table><thead><tr><th>Key</th><th>Source</th><th>Depends on</th></tr></thead><tbody>"),Ds=g("<div class=card><div class=card-header><div class=card-title>Contributors (<!>)"),Us=g("<div class=empty>No contributors registered"),Fs=g("<tr><td><span class=tree-key></span></td><td></td><td>"),Hs=g("<table><thead><tr><th>Token</th><th>Scope</th><th>Kind</th><th>Resolved</th></tr></thead><tbody>"),zs=g("<div class=card><div class=card-header><div class=card-title>DI tokens (<!>)"),Vs=g("<div class=empty>No DI tokens registered"),Gs=g("<tr><td><span class=tree-key></span></td><td></td><td></td><td>"),Js=g("<div class=card><div class=card-header><div class=card-title>"),Ks=g("<div class=empty>"),Ws=g("<span class=tree-meta>[<!>]"),Ys=g("<span class=tree-meta>v"),Qs=g("<span class=tree-meta>"),Xs=g("<div class=tree-meta>provides: "),Zs=g("<div class=tree-meta>requires: "),_r=g("<div class=tree-meta>"),ei=g("<div class=tree-node><span class=tree-key>"),wr=g("<span style=margin-right:12px>: <strong style=color:var(--text)>"),ti=()=>{const[e,t]=x(null),[r,n]=x(null),[s,i]=x(!1),u=async()=>{i(!0),n(null);try{t(await ge.topology())}catch(a){n(a instanceof Error?a.message:String(a))}finally{i(!1)}};return Je(()=>{u()}),[(()=>{var a=js(),c=a.firstChild.nextSibling;return c.$$click=()=>{u()},l(c,()=>s()?"Refreshing…":"Refresh"),w(()=>c.disabled=s()),a})(),o(b,{get when(){return r()},children:a=>(()=>{var c=Ns(),h=c.firstChild.nextSibling;return l(h,a),c})()}),o(b,{get when(){return e()},get fallback(){return Is()},children:a=>[o(b,{get when(){return a().errors.length>0},get children(){var c=Ps(),h=c.firstChild,d=h.firstChild,f=h.nextSibling;return l(h,()=>a().errors.length,d),l(f,o(N,{get each(){return a().errors},children:v=>(()=>{var p=Bs(),m=p.firstChild,k=m.nextSibling;return k.nextSibling,l(p,()=>v.kind,m),l(p,()=>v.name,k),l(p,()=>v.message,null),p})()})),c}}),o(Sr,{get title(){return`Plugins (${a().plugins.length})`},get items(){return a().plugins},empty:"No plugins registered"}),o(Sr,{get title(){return`Adapters (${a().adapters.length})`},get items(){return a().adapters},empty:"No adapters registered"}),o(ri,{get rows(){return a().contributors}}),o(ni,{get rows(){return a().diTokens}})]})]},ri=e=>{const t=H(()=>e.rows??[]),r=Pe(t);return(()=>{var n=Ds(),s=n.firstChild.firstChild,i=s.firstChild.nextSibling;return i.nextSibling,l(s,()=>t().length,i),l(n,o(b,{get when(){return t().length>0},get fallback(){return Us()},get children(){return[(()=>{var u=qs(),a=u.firstChild.nextSibling;return l(a,o(N,{get each(){return r.page()},children:c=>(()=>{var h=Fs(),d=h.firstChild,f=d.firstChild,v=d.nextSibling,p=v.nextSibling;return l(f,()=>c.key),l(v,()=>c.source),l(p,()=>c.dependsOn.join(", ")||"—"),h})()})),u})(),o(Be,{pager:r})]}}),null),n})()},ni=e=>{const t=H(()=>e.rows??[]),r=Pe(t);return(()=>{var n=zs(),s=n.firstChild.firstChild,i=s.firstChild.nextSibling;return i.nextSibling,l(s,()=>t().length,i),l(n,o(b,{get when(){return t().length>0},get fallback(){return Vs()},get children(){return[(()=>{var u=Hs(),a=u.firstChild.nextSibling;return l(a,o(N,{get each(){return r.page()},children:c=>(()=>{var h=Gs(),d=h.firstChild,f=d.firstChild,v=d.nextSibling,p=v.nextSibling,m=p.nextSibling;return l(f,()=>c.token),l(v,()=>c.scope),l(p,()=>c.kind),l(m,()=>c.instantiated?"yes":"no"),h})()})),u})(),o(Be,{pager:r})]}}),null),n})()},Sr=e=>(()=>{var t=Js(),r=t.firstChild.firstChild;return l(r,()=>e.title),l(t,o(b,{get when(){return e.items.length>0},get fallback(){return(()=>{var n=Ks();return l(n,()=>e.empty),n})()},get children(){return o(N,{get each(){return e.items},children:n=>o(ii,{item:n})})}}),null),t})();function li(e){return e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(1)} KB`:e<1073741824?`${(e/1048576).toFixed(1)} MB`:`${(e/1073741824).toFixed(1)} GB`}function si(e){if(typeof e!="object"||e===null)return String(e);try{return JSON.stringify(e)}catch{return"[unserializable]"}}var ii=e=>(()=>{var t=ei(),r=t.firstChild;return l(r,()=>e.item.name),l(t,o(b,{get when(){return e.item.kind},get children(){var n=Ws(),s=n.firstChild.nextSibling;return s.nextSibling,l(n,()=>e.item.kind,s),n}}),null),l(t,o(b,{get when(){return e.item.version},get children(){var n=Ys();return n.firstChild,l(n,()=>e.item.version,null),n}}),null),l(t,o(b,{get when(){return typeof e.item.memoryBytes=="number"},get children(){var n=Qs();return l(n,()=>li(e.item.memoryBytes)),n}}),null),l(t,o(b,{get when(){return e.item.tokens?.provides.length},get children(){var n=Xs();return n.firstChild,l(n,()=>e.item.tokens?.provides.join(", "),null),n}}),null),l(t,o(b,{get when(){return e.item.tokens?.requires.length},get children(){var n=Zs();return n.firstChild,l(n,()=>e.item.tokens?.requires.join(", "),null),n}}),null),l(t,o(b,{get when(){return fe(()=>!!e.item.state)()&&Object.keys(e.item.state).length>0},get children(){var n=_r();return l(n,o(N,{get each(){return Object.entries(e.item.state??{})},children:([s,i])=>(()=>{var u=wr(),a=u.firstChild,c=a.nextSibling;return l(u,s,a),l(c,()=>si(i)),u})()})),n}}),null),l(t,o(b,{get when(){return e.item.metrics},children:n=>(()=>{var s=_r();return l(s,o(N,{get each(){return Object.entries(n())},children:([i,u])=>(()=>{var a=wr(),c=a.firstChild,h=c.nextSibling;return l(a,i,c),l(h,u),a})()})),s})()}),null),t})();ie(["click"]);var ai={publicFlag:"auth.public",csrfCookie:"_csrf",csrfHeader:"x-csrf-token",openApiUrl:"/openapi.json",editorUrl:"vscode://file{file}:{line}"};function Kt(e){return(Array.isArray(e)?e:e.split(",")).map(t=>t.trim()).filter(Boolean)}function an(e,t){return Kt(t.publicFlag).some(r=>e.flags?.[r]!==void 0)}var oi=new Set(["POST","PUT","PATCH","DELETE"]),ci=new Set(["GET","HEAD","OPTIONS"]),ui=e=>["DELETE","PUT","PATCH"].includes(e.toUpperCase()),Wt=e=>oi.has(e.toUpperCase());function xt(e){const t=[...e.matchAll(/:([A-Za-z_$][\w$]*)/g)].map(r=>r[1]);return[...new Set(t)]}function on(e,t,r,n){const s=t.replace(/:([A-Za-z_$][\w$]*)/g,(a,c)=>r[c]?encodeURIComponent(r[c]):a),i=new URLSearchParams;for(const a of n)a.enabled&&a.key&&i.append(a.key,a.value);const u=i.toString();return`${e}${s}${u?`?${u}`:""}`}function di(e,t){for(const r of e.split(";")){const n=r.indexOf("=");if(!(n<0)&&r.slice(0,n).trim()===t)return decodeURIComponent(r.slice(n+1).trim())}}var cn=/\{\{\s*([\w.-]+)\s*\}\}/g;function hi(e,t){return e.replace(cn,(r,n)=>Object.prototype.hasOwnProperty.call(t,n)?t[n]:r)}function fi(e){const t={};for(const r of e)r.enabled&&r.key&&(t[r.key]=r.value);return t}function kr(e){const t=typeof e.body=="string"?e.body:"",r=(e.form??[]).flatMap(s=>[s.name,s.value??""]),n=[e.url,...Object.entries(e.headers).flat(),t,...r].join(`
|
|
2
|
+
`);return[...new Set([...n.matchAll(cn)].map(s=>s[1]))]}function gi(e,t){const r=t.match(/[^.[\]]+/g)??[];let n=e;for(const s of r){if(n===null||typeof n!="object")return;n=n[s]}if(n!==void 0)return typeof n=="string"?n:JSON.stringify(n)}function vi(e){const{route:t,settings:r,origin:n,cookies:s}=e,i=e.variables??{},u=y=>hi(y,i),a=y=>y.map($=>({...$,key:u($.key),value:u($.value)})),c={params:Object.fromEntries(Object.entries(e.inputs.params).map(([y,$])=>[y,u($)])),query:a(e.inputs.query),headers:a(e.inputs.headers),body:u(e.inputs.body),bodyMode:e.inputs.bodyMode,form:(e.inputs.form??[]).map(y=>({...y,key:u(y.key),value:u(y.value)}))},h=a(e.defaults),d=t.method.toUpperCase(),f=an(t,r),v={},p=(y,$)=>{for(const L of y)if(!(!L.enabled||!L.key)&&!($&&L.key.toLowerCase()==="authorization")){for(const A of Object.keys(v))A.toLowerCase()===L.key.toLowerCase()&&delete v[A];v[L.key]=L.value}};p(h,f),p(c.headers,!1);const m=y=>Object.keys(v).some($=>$.toLowerCase()===y);if(!ci.has(d)&&!m(r.csrfHeader.toLowerCase())){const y=di(s,r.csrfCookie);y&&(v[r.csrfHeader]=y)}const k=on(n,t.path,c.params,c.query);if(Wt(d)&&c.bodyMode==="form"){const{body:y,form:$}=pi(c.form??[]);for(const L of Object.keys(v))L.toLowerCase()==="content-type"&&delete v[L];return{method:d,url:k,headers:v,body:y,form:$}}const S=Wt(d)&&c.body.trim()?c.body:void 0;return S!==void 0&&!m("content-type")&&/^\s*[[{]/.test(S)&&(v["Content-Type"]="application/json"),{method:d,url:k,headers:v,...S!==void 0?{body:S}:{}}}function pi(e){const t=new FormData,r=[];for(const n of e)if(!(!n.enabled||!n.key))if(n.type==="file")for(const s of n.files??[])t.append(n.key,s,s.name),r.push({name:n.key,fileName:s.name});else t.append(n.key,n.value),r.push({name:n.key,value:n.value});return{body:t,form:r}}var ct=e=>`'${e.replace(/'/g,"'\\''")}'`;function mi(e){const t=[`curl -X ${e.method} ${ct(e.url)}`];for(const[r,n]of Object.entries(e.headers))t.push(`-H ${ct(`${r}: ${n}`)}`);if(e.form)for(const r of e.form)t.push(`-F ${ct(r.fileName!==void 0?`${r.name}=@${r.fileName}`:`${r.name}=${r.value??""}`)}`);else typeof e.body=="string"&&t.push(`--data-raw ${ct(e.body)}`);return t.join(` \\
|
|
3
|
+
`)}function bi(e){const t={method:e.method};if(Object.keys(e.headers).length&&(t.headers=e.headers),e.form){const r=["const form = new FormData()"];for(const s of e.form)r.push(s.fileName!==void 0?`form.append(${JSON.stringify(s.name)}, fileInput.files[0]) // ${s.fileName}`:`form.append(${JSON.stringify(s.name)}, ${JSON.stringify(s.value??"")})`);const n=JSON.stringify(t,null,2).replace(/\n}$/,`,
|
|
4
|
+
"body": form
|
|
5
|
+
}`);return`${r.join(`
|
|
6
|
+
`)}
|
|
7
|
+
|
|
8
|
+
await fetch(${JSON.stringify(e.url)}, ${n})`}return typeof e.body=="string"&&(t.body=e.body),`await fetch(${JSON.stringify(e.url)}, ${JSON.stringify(t,null,2)})`}function xi(e,t){if(!t?.includes("json"))return e;try{return JSON.stringify(JSON.parse(e),null,2)}catch{return e}}var jt=e=>`kickjs-devtools:runner:${e.method.toUpperCase()} ${e.path}`,$i=e=>{const t=e.upload&&e.upload.mode!=="none"?e.upload:void 0;return{params:Object.fromEntries(xt(e.path).map(r=>[r,""])),query:[],headers:[],body:"",bodyMode:t?"form":"raw",form:t?[{key:t.fieldName??"file",value:"",enabled:!0,type:"file"}]:[]}};function un(e){return{...e,form:e.form?.map(({files:t,...r})=>r)}}function yi(e,t,r=30){return[{...t,inputs:un(t.inputs)},...e].slice(0,r)}var _i=e=>on("",e.path,e.inputs.params,e.inputs.query);function wi(e,t){for(const[r,n]of Object.entries(e?.paths??{}))if(r.replace(/\{([^}]+)\}/g,":$1")===t.path)return n?.[t.method.toLowerCase()]}function dn(e,t){const r=t?.$ref;if(typeof r!="string"||!r.startsWith("#/"))return t;let n=e;for(const s of r.slice(2).split("/"))n=n?.[s];return n}function Qe(e,t,r=0){const n=dn(e,t);if(!n||r>6)return null;if(n.example!==void 0)return n.example;if(n.default!==void 0)return n.default;if(Array.isArray(n.enum)&&n.enum.length)return n.enum[0];const s=n.oneOf?.[0]??n.anyOf?.[0];if(s)return Qe(e,s,r+1);if(n.allOf)return Object.assign({},...n.allOf.map(i=>Qe(e,i,r+1)));switch((Array.isArray(n.type)?n.type.find(i=>i!=="null"):n.type)??(n.properties?"object":void 0)){case"object":return Object.fromEntries(Object.entries(n.properties??{}).map(([i,u])=>[i,Qe(e,u,r+1)]));case"array":return n.items?[Qe(e,n.items,r+1)]:[];case"string":return"";case"integer":case"number":return 0;case"boolean":return!1;default:return null}}function Si(e,t){const r=wi(e,t);if(!r)return;const n={},s=[];for(const u of r.parameters??[]){const a=dn(e,u);a?.name&&(a.in==="path"&&a.description&&(n[a.name]=a.description),a.in==="query"&&s.push({name:a.name,required:!!a.required,description:a.description}))}const i=r.requestBody?.content?.["application/json"]?.schema;return{summary:r.summary??r.description,params:n,query:s,...i?{body:JSON.stringify(Qe(e,i),null,2)}:{}}}function Cr(e,t){const r=new Set(e.query.map(i=>i.key)),n=[...e.query,...t.query.filter(i=>!r.has(i.name)).map(i=>({key:i.name,value:"",enabled:i.required}))],s=e.body.trim()||!t.body?e.body:t.body;return{...e,query:n,body:s}}function ki(e,t,r){const n=t.replace(/\\/g,"/").replace(/^(?=[A-Za-z]:)/,"/");return e.replace("{file}",encodeURI(n)).replace("{line}",String(r))}var Ci=g('<p class="text-sm text-text-secondary mt-1">'),Ti=g('<p class="text-xs text-amber-400 mt-2">No value for <!> — add it under Environment → Variables.'),Ei=g('<label class="flex items-start gap-2 text-sm mb-3"><input type=checkbox class=mt-1><span>Remember on this browser<span class="block text-xs text-text-muted">'),Ai=g('<h3 class="text-xs font-semibold text-text-secondary mb-1">Default headers'),Mi=g('<p class="text-xs text-text-muted mb-2">Sent with every route. A default Authorization is skipped on routes carrying a public flag.'),Li=g('<h3 class="text-xs font-semibold text-text-secondary mt-4 mb-1">Variables'),Ri=g('<p class="text-xs text-text-muted mb-2">Use <code>{{name}}</code> in any param, query, header or body value — e.g. a default header <code>Authorization: Bearer {{token}}</code>. Fill them by hand or with "Save to variable" on a response.'),Oi=g('<h3 class="text-xs font-semibold text-text-secondary mt-4 mb-1">Settings'),ji=g('<div class="grid grid-cols-1 sm:grid-cols-2 gap-3"><label class="flex flex-col gap-1 text-xs text-text-muted">Public route flags (comma-separated)<input>'),Ni=g('<span class="text-xs text-text-muted"role=status>'),Ii=g('<div class="flex items-center gap-1 mb-2"><button type=button>Copy'),Pi=g('<pre class="text-xs font-mono bg-surface-2 border border-border rounded-lg p-3 overflow-x-auto whitespace-pre-wrap break-all select-text">'),Bi=g('<div class="text-sm text-red-400 bg-red-500/10 border border-red-500/30 rounded-lg p-3">Request failed: '),qi=g('<ul class="flex flex-col gap-1">'),Di=g("<button type=button>Clear history"),Ui=g('<div class="fixed inset-0 z-50 bg-black/50"><aside role=dialog aria-modal=true class="absolute right-0 top-0 h-full w-full max-w-2xl bg-surface-1 border-l border-border-strong shadow-2xl flex flex-col"><header class="px-5 py-4 border-b border-border"><div class="flex items-start justify-between gap-4"><div class=min-w-0><div class="flex items-center gap-2"><span></span><h2 class="text-base font-semibold font-mono text-text-body break-all"></h2></div><p class="text-xs text-text-muted mt-1"><button type=button class="underline decoration-dotted hover:text-kick-500"title="Open in editor">.</button></p></div><button type=button class="text-text-muted hover:text-text-strong p-1 text-lg leading-none"aria-label=Close>✕</button></div><div class="font-mono text-xs bg-surface-2 border border-border rounded-lg px-3 py-2 mt-3 break-all text-text-secondary"></div></header><div class="flex-1 overflow-y-auto px-5 py-3 flex flex-col gap-2"></div><footer class="px-5 py-3 border-t border-border flex flex-wrap items-center gap-2"><button type=button>'),ar=g('<div class="flex flex-col gap-2">'),Fi=g('<ul class="text-xs text-text-muted mt-2 flex flex-col gap-0.5">'),Hi=g('<span class="text-xs text-text-muted ml-2">@FileUpload: field <code>'),zi=g('<div class="flex items-center gap-1 mb-2">'),Vi=g(`<p class="text-xs text-text-muted mt-2">Sent as multipart/form-data. Picked files aren't saved — pick them again after reopening.`),Gi=g('<label class="flex items-center gap-3 text-sm"><span class="font-mono text-text-secondary w-28 shrink-0">:</span><input>'),Ji=g("<li><code>"),Tr=g("<button type=button>"),Ki=g('<textarea placeholder="{ "name": "value" }">'),Wi=g("<button type=button>Fill empty inputs from OpenAPI"),Yi=g('<label class="flex flex-col gap-1 text-xs text-text-muted"><input>'),Qi=g('<details class="text-xs mb-2"><summary class="cursor-pointer text-text-secondary">Response headers (<!>)</summary><table class=mt-2><tbody>'),Xi=g('<pre class="text-xs font-mono bg-surface-2 border border-border rounded-lg p-3 overflow-x-auto max-h-[50vh] whitespace-pre-wrap break-all">'),Zi=g('<div class="flex flex-col sm:flex-row sm:items-center gap-2 mt-3 text-xs"><span class="text-text-secondary font-semibold shrink-0">Save to variable</span><input placeholder="JSON path, e.g. data.accessToken"><input placeholder="variable, e.g. token"><button type=button>Save'),ea=g('<p class="text-xs text-text-muted mt-1"role=status>'),ta=g('<p class="mt-1 text-xs text-text-muted">Body truncated to <!> characters.'),ra=g('<span class="flex items-center gap-3">Response<span> </span><span class="text-text-muted text-xs font-normal"> ms'),na=g('<tr><td class="font-mono text-text-secondary pr-4"></td><td class="font-mono break-all">'),la=g('<p class="text-xs text-text-muted">Nothing sent yet.'),sa=g('<li><button type=button class="w-full flex items-center gap-2 text-xs text-left rounded px-2 py-1 hover:bg-surface-2"title="Open with these inputs"><span></span><span class="font-mono truncate flex-1"></span><span></span><span class="text-text-muted w-16 text-right"> ms</span><span class="text-text-muted w-16 text-right">'),ia=g('<span class="text-xs font-normal text-text-muted">(<!>)'),aa=g('<details class="border border-border rounded-lg bg-surface-1 group"><summary class="cursor-pointer select-none px-3 py-2 text-sm font-semibold text-text-body flex items-center gap-2"><span class="text-text-muted transition-transform group-open:rotate-90">▸</span></summary><div class="px-3 pb-3">'),oa=g("<label><input type=file class=sr-only>"),ca=g('<div class="flex items-center gap-2"><input type=checkbox aria-label=Enabled><select aria-label="Field type"><option value=text>Text</option><option value=file>File</option></select><input placeholder=name>'),ua=g("<input placeholder=value>"),da=g('<div class="flex items-center gap-2"><input type=checkbox aria-label=Enabled><input placeholder=name><input placeholder=value>'),Nt="kickjs-devtools:runner:defaults",It="kickjs-devtools:runner:variables",Er="kickjs-devtools:runner:settings",hn="kickjs-devtools:runner:remember",Ar="kickjs-devtools:runner:history",Pt=2e5,[ke,Yt]=x(null),We=0,ut=null,[fn,Mr]=x({});function ha(e){e in xe(fn)||(Mr(t=>({...t,[e]:void 0})),fetch(e,{credentials:"same-origin"}).then(t=>t.ok?t.json():null).catch(()=>null).then(t=>Mr(r=>({...r,[e]:t}))))}function fa(e){Yt(e)}function Lr(e,t,r){try{const n=e().getItem(t);return n?{...r,...JSON.parse(n)}:r}catch{return r}}function Rr(e,t){try{const r=JSON.parse(e().getItem(t)??"[]");return Array.isArray(r)?r:[]}catch{return[]}}function Or(e,t){try{e().removeItem(t)}catch{}}function ga(){try{return localStorage.getItem(hn)==="true"}catch{return!1}}function Fe(e,t,r){try{e().setItem(t,JSON.stringify(r))}catch{}}var dt=e=>e.filter(t=>t.enabled&&t.key).length,va=()=>{const[e,t]=x(null),[r,n]=x(ga()),s=()=>r()?localStorage:sessionStorage,i=()=>r()?sessionStorage:localStorage,[u,a]=x(Rr(s,Nt)),[c,h]=x(Rr(s,It)),[d,f]=x({path:"",name:""}),[v,p]=x(null),[m,k]=x(Lr(()=>localStorage,Er,ai)),[S,y]=x(!1),[$,L]=x(!1),[A,O]=x(null),[K,V]=x(null),[F,B]=x(null),[le,Y]=x("curl"),[Z,G]=x((()=>{try{const E=JSON.parse(localStorage.getItem(Ar)??"[]");return Array.isArray(E)?E:[]}catch{return[]}})()),[Q,ee]=x(null),[de,pe]=x(!1),ne=H(()=>{const E=ke(),j=fn()[m().openApiUrl];return E&&j?Si(j,E):void 0});Ce(()=>{const E=ke();if(We++,!E)return;let j=!1;try{j=localStorage.getItem(jt(E))===null}catch{}const oe=ut??Lr(()=>localStorage,jt(E),$i(E));ut=null;const ye=Object.fromEntries(xt(E.path).map(_e=>[_e,oe.params[_e]??""]));t({...oe,params:ye}),pe(j),ee(null),O(null),V(null),y(!1),L(!1)}),Ce(()=>{const E=ke(),j=e();E&&j&&Fe(()=>localStorage,jt(E),un(j))}),Ce(()=>{Fe(s,Nt,u()),Fe(s,It,c()),Or(i,Nt),Or(i,It),Fe(()=>localStorage,hn,r())}),Ce(()=>Fe(()=>localStorage,Er,m())),Ce(()=>Fe(()=>localStorage,Ar,Z())),Ce(()=>{ke()&&ha(m().openApiUrl)}),Ce(()=>{const E=ne();!E||!de()||(pe(!1),t(j=>j&&Cr(j,E)))}),Ce(()=>{if(!ke())return;const E=j=>{j.key==="Escape"&&Ee()};document.addEventListener("keydown",E),$e(()=>document.removeEventListener("keydown",E))});const ae=H(()=>{const E=ke(),j=e();return!E||!j?null:vi({route:E,inputs:j,defaults:u(),variables:fi(c()),settings:m(),origin:window.location.origin,cookies:document.cookie})}),Ee=()=>Yt(null),Re=E=>{y(!1),t(j=>j&&{...j,...E})};async function Sn(){const E=ae();if(!E)return;if(ui(E.method)&&!S()){y(!0);return}y(!1),L(!0),V(null);const j=performance.now(),oe=We,ye=ke(),_e=e(),we=te=>G(ce=>yi(ce,{at:Date.now(),method:ye.method.toUpperCase(),path:ye.path,inputs:_e,ms:Math.round(performance.now()-j),...te}));try{const te=await fetch(E.url,{method:E.method,headers:E.headers,body:E.body,credentials:"same-origin"}),ce=await te.text();if(we({status:te.status}),oe!==We)return;O({status:te.status,statusText:te.statusText,ms:Math.round(performance.now()-j),headers:[...te.headers.entries()],raw:ce,body:xi(ce.slice(0,Pt),te.headers.get("content-type")),truncated:ce.length>Pt})}catch(te){if(we({error:te instanceof Error?te.message:String(te)}),oe!==We)return;O(null),V(te instanceof Error?te.message:String(te))}finally{oe===We&&L(!1)}}const or=H(()=>{const E=ae();return E?le()==="curl"?mi(E):bi(E):""});async function kn(){try{await navigator.clipboard.writeText(or()),B("Copied")}catch{B("Copy failed — select the text instead")}setTimeout(()=>B(null),1500)}function Cn(){const E=A(),{path:j,name:oe}=d();if(!E||!j.trim()||!oe.trim())return;let ye;try{ye=JSON.parse(E.raw)}catch{p("The response is not JSON");return}const _e=gi(ye,j.trim());if(_e===void 0){p(`Nothing at "${j.trim()}"`);return}const we=oe.trim(),te=c();h(te.some(ce=>ce.key===we)?te.map(ce=>ce.key===we?{...ce,value:_e,enabled:!0}:ce):[...te,{key:we,value:_e,enabled:!0}]),p(`Saved {{${we}}}`)}function Tn(E){const j=q.routes().find(oe=>oe.method.toUpperCase()===E.method&&oe.path===E.path);j&&(ut=E.inputs,j===ke()?(ut=null,Re(E.inputs)):Yt(j))}async function En(){const E=ke();if(E){ee(null);try{const j=await ge.source(E.controller,E.handler);window.location.href=ki(m().editorUrl,j.file,j.line),ee(`${j.relative}:${j.line}`)}catch{ee("Source not found under src/")}}}const An=()=>{const E=ke();return E?an(E,m()):!1};return o(b,{get when(){return ke()},children:E=>(()=>{var j=Ui(),oe=j.firstChild,ye=oe.firstChild,_e=ye.firstChild,we=_e.firstChild,te=we.firstChild,ce=te.firstChild,Mn=ce.nextSibling,Lt=te.nextSibling,st=Lt.firstChild,Ln=st.firstChild,Rn=we.nextSibling,On=_e.nextSibling,qe=ye.nextSibling,it=qe.nextSibling.firstChild;return j.$$click=T=>{T.target===T.currentTarget&&Ee()},l(ce,()=>E().method.toUpperCase()),l(Mn,()=>E().path),st.$$click=En,l(st,()=>E().controller,Ln),l(st,()=>E().handler,null),l(Lt,o(b,{get when(){return Q()},get children(){return[" · ",fe(()=>Q())]}}),null),l(Lt,o(b,{get when(){return An()},children:" · public route — default Authorization not sent"}),null),l(we,o(b,{get when(){return ne()?.summary},get children(){var T=Ci();return l(T,()=>ne().summary),T}}),null),Rn.$$click=Ee,l(On,()=>ae()?.url),l(ye,o(b,{get when(){return fe(()=>!!ae())()&&kr(ae()).length>0},get children(){var T=Ti(),C=T.firstChild.nextSibling;return C.nextSibling,l(T,()=>kr(ae()).map(M=>`{{${M}}}`).join(", "),C),T}}),null),l(qe,o(b,{get when(){return e()},children:T=>[o(b,{get when(){return xt(E().path).length>0},get children(){return o(je,{title:"Path params",open:!0,get children(){var C=ar();return l(C,o(N,{get each(){return xt(E().path)},children:M=>(()=>{var P=Gi(),I=P.firstChild;I.firstChild;var D=I.nextSibling;return l(I,M,null),D.$$input=ue=>Re({params:{...T().params,[M]:ue.currentTarget.value}}),R(D,me),w(()=>z(D,"placeholder",ne()?.params[M])),w(()=>D.value=T().params[M]??""),P})()})),C}})}}),o(je,{title:"Query",get count(){return dt(T().query)},get children(){return[o(ht,{get rows(){return T().query},onChange:C=>Re({query:C})}),o(b,{get when(){return ne()?.query.length},get children(){var C=Fi();return l(C,o(N,{get each(){return ne().query},children:M=>(()=>{var P=Ji(),I=P.firstChild;return l(I,()=>M.name),l(P,()=>M.required?" (required)":"",null),l(P,(()=>{var D=fe(()=>!!M.description);return()=>D()?` — ${M.description}`:""})(),null),P})()})),C}})]}}),o(je,{title:"Headers",get count(){return dt(T().headers)},get children(){return o(ht,{get rows(){return T().headers},onChange:C=>Re({headers:C})})}}),o(b,{get when(){return Wt(E().method)},get children(){return o(je,{title:"Body",open:!0,get children(){return[(()=>{var C=zi();return l(C,o(N,{each:[["raw","Raw"],["form","Form data"]],children:([M,P])=>(()=>{var I=Tr();return I.$$click=()=>Re({bodyMode:M}),l(I,P),w(D=>{var ue=(T().bodyMode??"raw")===M,Ae=`px-3 py-1 text-xs font-semibold rounded-lg border transition-colors ${(T().bodyMode??"raw")===M?"bg-kick-500/20 text-kick-500 border-kick-500/30":"bg-surface-2 text-text-secondary border-border-strong hover:text-text-body"}`;return ue!==D.e&&z(I,"aria-pressed",D.e=ue),Ae!==D.t&&R(I,D.t=Ae),D},{e:void 0,t:void 0}),I})()}),null),l(C,o(b,{get when(){return fe(()=>!!E().upload)()&&E().upload.mode!=="none"},get children(){var M=Hi(),P=M.firstChild.nextSibling;return l(P,()=>E().upload.fieldName??"file"),l(M,(()=>{var I=fe(()=>E().upload.mode==="array");return()=>I()?`, up to ${E().upload.maxCount??10} files`:", one file"})(),null),M}}),null),C})(),o(b,{get when(){return T().bodyMode==="form"},get fallback(){return(()=>{var C=Ki();return C.$$input=M=>Re({body:M.currentTarget.value}),R(C,`${me} font-mono min-h-40`),w(()=>C.value=T().body),C})()},get children(){return[o(pa,{get rows(){return T().form??[]},get multiple(){return E().upload?.mode==="array"},onChange:C=>Re({form:C})}),Vi()]}})]}})}})]}),null),l(qe,o(je,{title:"Environment",get count(){return dt(u())+dt(c())},get children(){return[(()=>{var T=Ei(),C=T.firstChild,M=C.nextSibling.firstChild.nextSibling;return C.addEventListener("change",P=>n(P.currentTarget.checked)),l(M,()=>r()?"Default headers and variables are saved in localStorage and survive closing the tab. They may hold tokens — turn this off on a shared machine.":"Default headers and variables are kept for this browser tab only."),w(()=>C.checked=r()),T})(),Ai(),Mi(),o(ht,{get rows(){return u()},onChange:a}),Li(),Ri(),o(ht,{get rows(){return c()},onChange:h}),o(b,{get when(){return ne()},children:T=>(()=>{var C=Wi();return C.$$click=()=>Re(Cr(e(),T())),R(C,`${ft} mt-4`),C})()}),Oi(),(()=>{var T=ji(),C=T.firstChild.firstChild.nextSibling;return C.addEventListener("change",M=>k({...m(),publicFlag:Kt(M.currentTarget.value)})),R(C,me),l(T,o(N,{each:[["csrfCookie","CSRF cookie"],["csrfHeader","CSRF header"],["openApiUrl","OpenAPI spec URL"],["editorUrl","Editor link ({file}, {line})"]],children:([M,P])=>(()=>{var I=Yi(),D=I.firstChild;return l(I,P,D),D.$$input=ue=>k({...m(),[M]:ue.currentTarget.value}),R(D,me),w(()=>D.value=m()[M]),I})()}),null),w(()=>C.value=Kt(m().publicFlag).join(", ")),T})()]}}),null),l(qe,o(je,{title:"Code snippet",get children(){return[(()=>{var T=Ii(),C=T.firstChild;return l(T,o(N,{each:["curl","fetch"],children:M=>(()=>{var P=Tr();return P.$$click=()=>Y(M),l(P,M),w(I=>{var D=le()===M,ue=`px-3 py-1 text-xs font-semibold rounded-lg border transition-colors ${le()===M?"bg-kick-500/20 text-kick-500 border-kick-500/30":"bg-surface-2 text-text-secondary border-border-strong hover:text-text-body"}`;return D!==I.e&&z(P,"aria-pressed",I.e=D),ue!==I.t&&R(P,I.t=ue),I},{e:void 0,t:void 0}),P})()}),C),C.$$click=kn,R(C,`${ft} ml-auto`),l(T,o(b,{get when(){return F()},get children(){var M=Ni();return l(M,F),M}}),null),T})(),(()=>{var T=Pi();return l(T,or),T})()]}}),null),l(qe,o(b,{get when(){return K()},get children(){var T=Bi();return T.firstChild,l(T,K,null),T}}),null),l(qe,o(b,{get when(){return A()},children:T=>o(je,{open:!0,get title(){return(()=>{var C=ra(),M=C.firstChild.nextSibling,P=M.firstChild,I=M.nextSibling,D=I.firstChild;return l(M,()=>T().status,P),l(M,()=>T().statusText,null),l(I,()=>T().ms,D),w(()=>R(M,`font-bold ${jr(T().status)}`)),C})()},get children(){return[(()=>{var C=Qi(),M=C.firstChild,P=M.firstChild.nextSibling;P.nextSibling;var I=M.nextSibling.firstChild;return l(M,()=>T().headers.length,P),l(I,o(N,{get each(){return T().headers},children:([D,ue])=>(()=>{var Ae=na(),at=Ae.firstChild,Rt=at.nextSibling;return l(at,D),l(Rt,ue),Ae})()})),C})(),(()=>{var C=Xi();return l(C,()=>T().body||"(empty body)"),C})(),(()=>{var C=Zi(),M=C.firstChild.nextSibling,P=M.nextSibling,I=P.nextSibling;return M.$$input=D=>f({...d(),path:D.currentTarget.value}),R(M,me),P.$$input=D=>f({...d(),name:D.currentTarget.value}),R(P,me),I.$$click=Cn,R(I,ft),w(()=>M.value=d().path),w(()=>P.value=d().name),C})(),o(b,{get when(){return v()},get children(){var C=ea();return l(C,v),C}}),o(b,{get when(){return T().truncated},get children(){var C=ta(),M=C.firstChild.nextSibling;return M.nextSibling,l(C,()=>Pt.toLocaleString(),M),C}})]}})}),null),l(qe,o(je,{title:"History",get count(){return Z().length},get children(){return o(b,{get when(){return Z().length>0},get fallback(){return la()},get children(){return[(()=>{var T=qi();return l(T,o(N,{get each(){return Z()},children:C=>(()=>{var M=sa(),P=M.firstChild,I=P.firstChild,D=I.nextSibling,ue=D.nextSibling,Ae=ue.nextSibling,at=Ae.firstChild,Rt=Ae.nextSibling;return P.$$click=()=>Tn(C),l(I,()=>C.method),l(D,()=>_i(C)),l(ue,()=>C.status??"failed"),l(Ae,()=>C.ms,at),l(Rt,()=>new Date(C.at).toLocaleTimeString()),w(Ke=>{var cr=`font-bold w-14 shrink-0 ${Vt(C.method)}`,ur=C.status?jr(C.status):"text-red-400";return cr!==Ke.e&&R(I,Ke.e=cr),ur!==Ke.t&&R(ue,Ke.t=ur),Ke},{e:void 0,t:void 0}),M})()})),T})(),(()=>{var T=Di();return T.$$click=()=>G([]),R(T,`${ft} mt-2`),T})()]}})}}),null),it.$$click=Sn,l(it,(()=>{var T=fe(()=>!!$());return()=>T()?"Sending…":fe(()=>!!S())()?`Click again to send ${E().method.toUpperCase()}`:"Send"})()),w(T=>{var C=`Try ${E().method} ${E().path}`,M=`text-xs font-bold ${Vt(E().method)}`,P=$(),I=`px-4 py-2 text-sm font-semibold rounded-lg border transition-colors ${S()?"bg-red-500/20 text-red-400 border-red-500/40":"bg-kick-500/20 text-kick-500 border-kick-500/30 hover:bg-kick-500/30"}`;return C!==T.e&&z(oe,"aria-label",T.e=C),M!==T.t&&R(ce,T.t=M),P!==T.a&&(it.disabled=T.a=P),I!==T.o&&R(it,T.o=I),T},{e:void 0,t:void 0,a:void 0,o:void 0}),j})()})},je=e=>(()=>{var t=aa(),r=t.firstChild;r.firstChild;var n=r.nextSibling;return l(r,()=>e.title,null),l(r,o(b,{get when(){return e.count},get children(){var s=ia(),i=s.firstChild.nextSibling;return i.nextSibling,l(s,()=>e.count,i),s}}),null),l(n,()=>e.children),w(()=>t.open=e.open),t})(),pa=e=>{const t=()=>[...e.rows,{key:"",value:"",enabled:!0,type:"text"}],r=(n,s)=>{const i=t().map((u,a)=>a===n?{...u,...s}:u);e.onChange(i.filter(u=>u.key||u.value||u.files?.length))};return(()=>{var n=ar();return l(n,o(Wr,{get each(){return t()},children:(s,i)=>(()=>{var u=ca(),a=u.firstChild,c=a.nextSibling,h=c.nextSibling;return a.addEventListener("change",d=>r(i,{enabled:d.currentTarget.checked})),c.addEventListener("change",d=>r(i,{type:d.currentTarget.value,value:"",files:[]})),R(c,`${me} w-24 shrink-0`),h.$$input=d=>r(i,{key:d.currentTarget.value}),R(h,me),l(u,o(b,{get when(){return s().type==="file"},get fallback(){return(()=>{var d=ua();return d.$$input=f=>r(i,{value:f.currentTarget.value}),R(d,me),w(()=>d.value=s().value),d})()},get children(){var d=oa(),f=d.firstChild;return R(d,`${me} cursor-pointer truncate`),f.addEventListener("change",v=>r(i,{files:[...v.currentTarget.files??[]]})),l(d,(()=>{var v=fe(()=>!!s().files?.length);return()=>v()?s().files.map(p=>p.name).join(", "):"Choose file…"})(),null),w(()=>f.multiple=e.multiple),d}}),null),w(()=>a.checked=s().enabled),w(()=>c.value=s().type),w(()=>h.value=s().key),u})()})),n})()},ht=e=>{const t=()=>[...e.rows,{key:"",value:"",enabled:!0}],r=(n,s)=>{const i=t().map((u,a)=>a===n?{...u,...s}:u);e.onChange(i.filter(u=>u.key||u.value))};return(()=>{var n=ar();return l(n,o(Wr,{get each(){return t()},children:(s,i)=>(()=>{var u=da(),a=u.firstChild,c=a.nextSibling,h=c.nextSibling;return a.addEventListener("change",d=>r(i,{enabled:d.currentTarget.checked})),c.$$input=d=>r(i,{key:d.currentTarget.value}),R(c,me),h.$$input=d=>r(i,{value:d.currentTarget.value}),R(h,me),w(()=>a.checked=s().enabled),w(()=>c.value=s().key),w(()=>h.value=s().value),u})()})),n})()},me="w-full min-w-0 bg-surface-2 border border-border-strong rounded-lg px-3 py-1.5 text-sm text-text-body placeholder:text-text-muted focus:outline-none focus:border-kick-500",ft="px-3 py-2 text-xs font-semibold rounded-lg border bg-surface-2 text-text-secondary border-border-strong hover:text-text-body";function jr(e){return e>=500?"text-red-400":e>=400?"text-amber-400":e>=300?"text-cyan-400":"text-emerald-400"}ie(["click","input"]);var ma=g("<div class=overflow-x-auto><table><thead><tr><th>Method</th><th>Path</th><th>Controller</th><th>Handler</th><th>Middleware</th><th>Flags</th><th><span class=sr-only>Try</span></th></tr></thead><tbody>"),ba=g('<div class="bg-surface-1 rounded-xl border border-border p-5"><div class="flex flex-col sm:flex-row gap-3 mb-4"><div class="relative flex-1"><svg class="absolute left-3 top-2.5 w-4 h-4 text-text-muted"fill=none stroke=currentColor viewBox="0 0 24 24"aria-hidden=true><path stroke-linecap=round stroke-linejoin=round stroke-width=2 d="M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"></path></svg><input type=text placeholder="Search routes (path, controller, handler)…"class="w-full bg-surface-2 border border-border-strong rounded-lg pl-10 pr-4 py-2 text-sm text-text-body placeholder:text-text-muted focus:outline-none focus:border-kick-500"></div><div class="flex gap-1">'),xa=g("<button type=button>"),$a=g("<div class=empty>"),ya=g('<tr><td><span></span></td><td class="font-mono text-sm"></td><td></td><td class=text-text-secondary></td><td class="text-text-muted text-xs"></td><td class="text-text-muted text-xs"></td><td><button type=button class="px-2.5 py-1 text-xs font-semibold rounded-lg border bg-surface-2 text-text-secondary border-border-strong hover:text-kick-500 hover:border-kick-500/40">Try'),_a=["ALL","GET","POST","PUT","DELETE","PATCH"];function wa(e){const t=Object.entries(e??{});return t.length?t.map(([r,n])=>n===!0?r:`${r}=${JSON.stringify(n)}`).join(", "):"—"}var Sa=()=>{const[e,t]=x(""),[r,n]=x("ALL"),s=H(()=>{let u=q.routes();r()!=="ALL"&&(u=u.filter(c=>c.method.toUpperCase()===r()));const a=e().trim().toLowerCase();return a&&(u=u.filter(c=>c.path.toLowerCase().includes(a)||c.controller.toLowerCase().includes(a)||c.handler.toLowerCase().includes(a))),u}),i=Pe(()=>s());return(()=>{var u=ba(),a=u.firstChild.firstChild,c=a.firstChild.nextSibling,h=a.nextSibling;return c.$$input=d=>t(d.currentTarget.value),l(h,o(N,{each:_a,children:d=>(()=>{var f=xa();return f.$$click=()=>n(d),l(f,d),w(()=>R(f,`px-3 py-1.5 text-xs font-semibold rounded-lg transition-colors border ${r()===d?"bg-kick-500/20 text-kick-500 border-kick-500/30":"bg-surface-2 text-text-secondary border-border-strong hover:text-text-body"}`)),f})()})),l(u,o(b,{get when(){return i.page().length>0},get fallback(){return(()=>{var d=$a();return l(d,()=>e()||r()!=="ALL"?"No routes match the current filter":"No routes registered"),d})()},get children(){return[(()=>{var d=ma(),f=d.firstChild.firstChild.nextSibling;return l(f,o(N,{get each(){return i.page()},children:v=>(()=>{var p=ya(),m=p.firstChild,k=m.firstChild,S=m.nextSibling,y=S.nextSibling,$=y.nextSibling,L=$.nextSibling,A=L.nextSibling,O=A.nextSibling.firstChild;return l(k,()=>v.method),l(S,()=>v.path),l(y,()=>v.controller),l($,()=>v.handler),l(L,(()=>{var K=fe(()=>!!v.middleware.length);return()=>K()?v.middleware.join(", "):"—"})()),l(A,()=>wa(v.flags)),O.$$click=()=>fa(v),w(()=>R(k,`text-xs font-bold ${Vt(v.method)}`)),p})()})),d})(),o(Be,{pager:i})]}}),null),w(()=>c.value=e()),u})()};ie(["input","click"]);var ka=g("<div class=card style=border-color:var(--critical)><div class=card-title style=color:var(--critical)>Failed to load metrics</div><code>"),Ca=g("<div class=empty>Loading route metrics…"),Ta=g("<div class=grid>"),Ea=g("<table><thead><tr><th>Route</th><th style=text-align:right>Calls</th><th style=text-align:right>Avg</th><th style=text-align:right>p50</th><th style=text-align:right>p95</th><th style=text-align:right>p99</th><th style=text-align:right>Max</th></tr></thead><tbody>"),Aa=g("<div class=card><div class=card-header><div class=card-title>Per-route latency"),Ma=g("<div class=empty>No requests recorded yet"),La=g("<tr><td></td><td style=text-align:right></td><td style=text-align:right></td><td style=text-align:right></td><td style=text-align:right></td><td style=text-align:right></td><td style=text-align:right>"),Ra=g("<div class=card><div class=card-header><div class=card-title></div><div class=card-value>"),Oa=()=>{const[e,t]=x(null),[r,n]=x(null),s=async()=>{try{t(await ge.routes()),n(null)}catch(u){n(u instanceof Error?u.message:String(u))}};Je(()=>{s();const u=setInterval(()=>{s()},2e3);return()=>clearInterval(u)});const i=H(()=>{const u=e();return u?Object.entries(u.routeLatency).map(([a,c])=>Object.assign({key:a},c,{avg:c.count>0?c.totalMs/c.count:0})).toSorted((a,c)=>c.count-a.count):[]});return[o(b,{get when(){return r()},children:u=>(()=>{var a=ka(),c=a.firstChild.nextSibling;return l(c,u),a})()}),o(b,{get when(){return e()},get fallback(){return Ca()},children:u=>[(()=>{var a=Ta();return l(a,o(Ye,{title:"Requests",metric:"requests",get value(){return u().requests.toString()}}),null),l(a,o(Ye,{title:"Server errors",metric:"server-errors",get value(){return u().serverErrors.toString()}}),null),l(a,o(Ye,{title:"Client errors",metric:"client-errors",get value(){return u().clientErrors.toString()}}),null),l(a,o(Ye,{title:"Error rate",metric:"error-rate",get value(){return kt(u().errorRate)}}),null),l(a,o(Ye,{title:"Uptime",metric:"uptime",get value(){return lr(u().uptimeSeconds)}}),null),a})(),(()=>{var a=Aa();return a.firstChild,l(a,o(b,{get when(){return i().length>0},get fallback(){return Ma()},get children(){var c=Ea(),h=c.firstChild,d=h.firstChild.firstChild.nextSibling.nextSibling;d.firstChild;var f=d.nextSibling;f.firstChild;var v=f.nextSibling;v.firstChild;var p=v.nextSibling;p.firstChild;var m=p.nextSibling;m.firstChild;var k=h.nextSibling;return l(d,o(ve,{metric:"latency.avg",placement:"bottom"}),null),l(f,o(ve,{metric:"latency.p50",placement:"bottom"}),null),l(v,o(ve,{metric:"latency.p95",placement:"bottom"}),null),l(p,o(ve,{metric:"latency.p99",placement:"bottom"}),null),l(m,o(ve,{metric:"latency.max",placement:"bottom"}),null),l(k,o(N,{get each(){return i()},children:S=>(()=>{var y=La(),$=y.firstChild,L=$.nextSibling,A=L.nextSibling,O=A.nextSibling,K=O.nextSibling,V=K.nextSibling,F=V.nextSibling;return l($,()=>S.key),l(L,()=>S.count),l(A,()=>Me(S.avg)),l(O,()=>Me(S.p50)),l(K,()=>Me(S.p95)),l(V,()=>Me(S.p99)),l(F,()=>Me(S.maxMs)),y})()})),c}}),null),a})()]})]},Ye=e=>(()=>{var t=Ra(),r=t.firstChild.firstChild,n=r.nextSibling;return l(r,()=>e.title,null),l(r,o(b,{get when(){return e.metric},children:s=>o(ve,{get metric(){return s()}})}),null),l(n,()=>e.value),t})(),ja=g('<button type=button class="text-text-muted hover:text-text-strong p-1"aria-label=Back><svg class="w-4 h-4"fill=none stroke=currentColor viewBox="0 0 24 24"><path stroke-linecap=round stroke-linejoin=round stroke-width=2 d="M15 19l-7-7 7-7">'),Nr=g('<div class="flex flex-wrap gap-1">'),Na=g('<div class="bg-surface-2/50 rounded-lg border border-border-strong p-3 space-y-2 text-sm">'),Ia=g("<span>"),Pa=g('<div class="fixed inset-0 z-50 bg-black/70 flex items-center justify-center p-4"><div class="bg-surface-1 border border-border-strong rounded-2xl p-6 max-w-2xl w-full shadow-2xl max-h-[90vh] overflow-y-auto"><div class="flex items-start justify-between mb-4"><div><div class="flex items-center gap-2 mb-1"><h2 class="text-base font-semibold font-mono text-text-body break-all"></h2></div><div class="flex flex-wrap gap-2 mt-2"><span></span><span class="bg-border-strong/50 text-text-strong px-2 py-0.5 rounded text-xs font-semibold"></span><span></span></div></div><button type=button class="text-slate-500 hover:text-slate-300 p-1"aria-label=Close><svg class="w-5 h-5"fill=none stroke=currentColor viewBox="0 0 24 24"><path stroke-linecap=round stroke-linejoin=round stroke-width=2 d="M6 18L18 6M6 6l12 12">'),Ir=g('<span class="text-text-muted text-sm">None'),Ba=g('<button type=button class="bg-surface-2 text-kick-500 hover:bg-border-strong px-2.5 py-1 rounded text-xs font-mono border border-border-strong transition-colors">'),qa=g('<button type=button class="bg-surface-2 text-amber-400 hover:bg-border-strong px-2.5 py-1 rounded text-xs font-mono border border-border-strong transition-colors">'),Da=g('<div class=mb-4><h3 class="text-xs font-semibold uppercase tracking-wider text-text-muted mb-2">'),Ua=g('<div class="flex justify-between"><span class=text-text-secondary></span><span class=tabular-nums>'),[Qt,rt]=x(null),[Fa,Mt]=x([]);function Ct(e){Mt([]),rt(e)}function Pr(e){const t=Qt();t&&t!==e&&Mt(r=>[...r,t]),rt(e)}function Ha(){Mt(e=>{if(e.length===0)return rt(null),e;const t=e.slice(0,-1);return rt(e[e.length-1]),t})}function Br(){rt(null),Mt([])}var za=()=>{const e=H(()=>{const r=Qt();if(!r)return null;const n=q.container().find(s=>s.token===r);return n||{token:r,kind:void 0,scope:void 0,dependencies:[]}}),t=H(()=>{const r=Qt();return r?q.container().filter(n=>n.dependencies?.includes(r)).map(n=>n.token):[]});return o(b,{get when(){return e()},children:r=>(()=>{var n=Pa(),s=n.firstChild,i=s.firstChild.firstChild,u=i.firstChild,a=u.firstChild,c=u.nextSibling.firstChild,h=c.nextSibling,d=h.nextSibling,f=i.nextSibling;return n.$$click=v=>{v.target===v.currentTarget&&Br()},l(u,o(b,{get when(){return Fa().length>0},get children(){var v=ja();return v.$$click=Ha,v}}),a),l(a,()=>r().token),l(c,()=>r().kind??"unknown"),l(h,()=>r().scope??"singleton"),l(d,()=>Ja(r())),f.$$click=Br,l(s,o(gt,{title:"Dependencies",get children(){return o(b,{get when(){return(r().dependencies?.length??0)>0},get fallback(){return Ir()},get children(){var v=Nr();return l(v,o(N,{get each(){return r().dependencies},children:p=>(()=>{var m=Ba();return m.$$click=()=>Pr(p),l(m,p),m})()})),v}})}}),null),l(s,o(gt,{title:"Dependents",get children(){return o(b,{get when(){return t().length>0},get fallback(){return Ir()},get children(){var v=Nr();return l(v,o(N,{get each(){return t()},children:p=>(()=>{var m=qa();return m.$$click=()=>Pr(p),l(m,p),m})()})),v}})}}),null),l(s,o(gt,{title:"Resolve stats",get children(){var v=Na();return l(v,o(vt,{label:"Resolve count",get value(){return String(r().resolveCount??0)}}),null),l(v,o(b,{get when(){return r().firstResolved},children:p=>o(vt,{label:"First resolved",get value(){return new Date(p()).toLocaleString()}})}),null),l(v,o(b,{get when(){return r().lastResolved},children:p=>o(vt,{label:"Last resolved",get value(){return new Date(p()).toLocaleString()}})}),null),l(v,o(b,{get when(){return r().resolveDurationMs!=null},get children(){return o(vt,{label:"Resolution duration",get value(){return`${(r().resolveDurationMs??0).toFixed(2)} ms`}})}}),null),v}}),null),l(s,o(gt,{title:"PostConstruct",get children(){var v=Ia();return l(v,()=>r().postConstructStatus??"none"),w(()=>R(v,`px-2 py-0.5 rounded text-xs font-semibold ${Ka(r().postConstructStatus)}`)),v}}),null),w(v=>{var p=`px-2 py-0.5 rounded text-xs font-semibold ${Va(r().kind)}`,m=`px-2 py-0.5 rounded text-xs font-semibold ${Ga(r())}`;return p!==v.e&&R(c,v.e=p),m!==v.t&&R(d,v.t=m),v},{e:void 0,t:void 0}),n})()})},gt=e=>(()=>{var t=Da(),r=t.firstChild;return l(r,()=>e.title),l(t,()=>e.children,null),t})(),vt=e=>(()=>{var t=Ua(),r=t.firstChild,n=r.nextSibling;return l(r,()=>e.label),l(n,()=>e.value),t})();function Va(e){return e==="controller"?"bg-violet-900/50 text-violet-300":e==="service"?"bg-blue-900/50 text-blue-300":e==="repository"?"bg-teal-900/50 text-teal-300":"bg-border-strong/50 text-text-strong"}function Ga(e){return e.postConstructStatus==="failed"?"bg-red-900/50 text-red-300":e.instantiated?"bg-emerald-900/50 text-emerald-300":"bg-amber-900/50 text-amber-300"}function Ja(e){return e.postConstructStatus==="failed"?"failed":e.instantiated?"active":"registered"}function Ka(e){return e==="done"?"bg-emerald-900/50 text-emerald-300":e==="failed"?"bg-red-900/50 text-red-300":"bg-border-strong/50 text-text-secondary"}ie(["click"]);var Wa=g("<div class=overflow-x-auto><table><thead><tr><th class=w-6 aria-label=expand></th><th>Token</th><th>Kind</th><th>Scope</th><th>Status</th><th class=text-right>Resolves</th><th class=text-right>Deps</th></tr></thead><tbody>"),Ya=g('<div class="bg-surface-1 rounded-xl border border-border p-5"><div class="flex flex-col gap-3 mb-4"><div class=relative><svg class="absolute left-3 top-2.5 w-4 h-4 text-text-muted"fill=none stroke=currentColor viewBox="0 0 24 24"aria-hidden=true><path stroke-linecap=round stroke-linejoin=round stroke-width=2 d="M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"></path></svg><input type=text placeholder="Search tokens…"class="w-full bg-surface-2 border border-border-strong rounded-lg pl-10 pr-4 py-2 text-sm text-text-body placeholder:text-text-muted focus:outline-none focus:border-kick-500"></div><div class="flex flex-col sm:flex-row gap-3"><div class="flex gap-1 items-center"><span class="text-xs text-text-muted mr-1">Kind:</span></div><div class="flex gap-1 items-center"><span class="text-xs text-text-muted mr-1">Scope:'),qr=g("<button type=button>"),Qa=g("<div class=empty>"),Xa=g('<tr class="cursor-pointer select-none"><td><svg fill=none stroke=currentColor viewBox="0 0 24 24"aria-hidden=true><path stroke-linecap=round stroke-linejoin=round stroke-width=2 d="M9 5l7 7-7 7"></path></svg></td><td class="font-mono text-sm"></td><td><span></span></td><td><span class="bg-border-strong/50 text-text-strong px-2 py-0.5 rounded text-xs font-semibold"></span></td><td><span></span></td><td class="text-right tabular-nums"></td><td class="text-right text-text-muted text-xs">'),Za=g('<tr><td colspan=7 class="bg-surface-2/30 px-6 py-4 border-b border-border">'),eo=g('<div class="flex flex-wrap gap-1">'),to=g('<div class="flex justify-between"><span class=text-text-secondary>Duration</span><span class=tabular-nums>ms'),ro=g('<div class="grid grid-cols-1 md:grid-cols-2 gap-4"><div><h4 class="text-xs font-semibold uppercase tracking-wider text-text-muted mb-2">Dependencies</h4></div><div><h4 class="text-xs font-semibold uppercase tracking-wider text-text-muted mb-2">Resolve Stats</h4><div class="space-y-1 text-sm"><div class="flex justify-between"><span class=text-text-secondary>Resolve count</span><span class=tabular-nums></span></div></div></div><div><h4 class="text-xs font-semibold uppercase tracking-wider text-text-muted mb-2">PostConstruct</h4><span></span></div><div class="md:col-span-2 flex justify-end"><button type=button class="px-3 py-1.5 text-xs font-semibold rounded-lg bg-kick-500/20 text-kick-500 border border-kick-500/30 hover:bg-kick-500/30 transition-colors">View full details'),no=g('<span class="text-text-muted text-sm">None'),lo=g('<button type=button class="bg-border-strong/50 text-kick-500 hover:bg-border-strong px-2 py-0.5 rounded text-xs font-mono transition-colors">'),so=g('<div class="flex justify-between"><span class=text-text-secondary>First resolved</span><span class=text-xs>'),io=g('<div class="flex justify-between"><span class=text-text-secondary>Last resolved</span><span class=text-xs>'),ao=["ALL","controller","service","repository","other"],oo=["ALL","singleton","transient","request"],co=()=>{const[e,t]=x(""),[r,n]=x("ALL"),[s,i]=x("ALL"),[u,a]=x(new Set),c=H(()=>{let f=q.container();if(r()!=="ALL"){const p=r();f=f.filter(m=>p==="other"?!["controller","service","repository"].includes(m.kind??""):m.kind===p)}s()!=="ALL"&&(f=f.filter(p=>p.scope===s()));const v=e().trim().toLowerCase();return v&&(f=f.filter(p=>p.token.toLowerCase().includes(v))),f}),h=Pe(()=>c()),d=f=>{a(v=>{const p=new Set(v);return p.has(f)?p.delete(f):p.add(f),p})};return(()=>{var f=Ya(),v=f.firstChild.firstChild,p=v.firstChild.nextSibling,m=v.nextSibling.firstChild;m.firstChild;var k=m.nextSibling;return k.firstChild,p.$$input=S=>t(S.currentTarget.value),l(m,o(N,{each:ao,children:S=>(()=>{var y=qr();return y.$$click=()=>n(S),l(y,S),w(()=>R(y,`px-3 py-1.5 text-xs font-semibold rounded-lg transition-colors border ${r()===S?fo(S):"bg-surface-2 text-text-secondary border-border-strong hover:text-text-body"}`)),y})()}),null),l(k,o(N,{each:oo,children:S=>(()=>{var y=qr();return y.$$click=()=>i(S),l(y,S),w(()=>R(y,`px-3 py-1.5 text-xs font-semibold rounded-lg transition-colors border ${s()===S?"bg-kick-500/20 text-kick-500 border-kick-500/30":"bg-surface-2 text-text-secondary border-border-strong hover:text-text-body"}`)),y})()}),null),l(f,o(b,{get when(){return h.page().length>0},get fallback(){return(()=>{var S=Qa();return l(S,()=>e()||r()!=="ALL"||s()!=="ALL"?"No tokens match the current filter":"No DI registrations"),S})()},get children(){return[(()=>{var S=Wa(),y=S.firstChild.firstChild,$=y.firstChild.firstChild.nextSibling.nextSibling.nextSibling.nextSibling.nextSibling;$.firstChild;var L=y.nextSibling;return l($,o(ve,{metric:"resolve.count",placement:"bottom"}),null),l(L,o(N,{get each(){return h.page()},children:A=>[(()=>{var O=Xa(),K=O.firstChild,V=K.firstChild,F=K.nextSibling,B=F.nextSibling,le=B.firstChild,Y=B.nextSibling,Z=Y.firstChild,G=Y.nextSibling,Q=G.firstChild,ee=G.nextSibling,de=ee.nextSibling;return O.$$click=()=>d(A.token),l(F,()=>A.token),l(le,()=>A.kind??"unknown"),l(Z,()=>A.scope??"—"),l(Q,()=>vo(A)),l(ee,()=>A.resolveCount??0),l(de,()=>A.dependencies?.length??0),w(pe=>{var ne=`w-3 h-3 text-text-muted transition-transform ${u().has(A.token)?"rotate-90":""}`,ae=`px-2 py-0.5 rounded text-xs font-semibold ${ho(A.kind)}`,Ee=`px-2 py-0.5 rounded text-xs font-semibold ${go(A)}`;return ne!==pe.e&&z(V,"class",pe.e=ne),ae!==pe.t&&R(le,pe.t=ae),Ee!==pe.a&&R(Q,pe.a=Ee),pe},{e:void 0,t:void 0,a:void 0}),O})(),o(b,{get when(){return u().has(A.token)},get children(){var O=Za(),K=O.firstChild;return l(K,o(uo,{registration:A})),O}})]})),S})(),o(Be,{pager:h})]}}),null),w(()=>p.value=e()),f})()},uo=e=>(()=>{var t=ro(),r=t.firstChild;r.firstChild;var n=r.nextSibling,s=n.firstChild.nextSibling,i=s.firstChild.firstChild.nextSibling,u=n.nextSibling,a=u.firstChild;a.firstChild;var c=a.nextSibling,h=u.nextSibling.firstChild;return l(r,o(b,{get when(){return(e.registration.dependencies?.length??0)>0},get fallback(){return no()},get children(){var d=eo();return l(d,o(N,{get each(){return e.registration.dependencies},children:f=>(()=>{var v=lo();return v.$$click=p=>{p.stopPropagation(),Ct(f)},z(v,"title",`Open detail for ${f}`),l(v,f),v})()})),d}}),null),l(i,()=>e.registration.resolveCount??0),l(s,o(b,{get when(){return e.registration.firstResolved},children:d=>(()=>{var f=so(),v=f.firstChild.nextSibling;return l(v,()=>new Date(d()).toLocaleTimeString()),f})()}),null),l(s,o(b,{get when(){return e.registration.lastResolved},children:d=>(()=>{var f=io(),v=f.firstChild.nextSibling;return l(v,()=>new Date(d()).toLocaleTimeString()),f})()}),null),l(s,o(b,{get when(){return e.registration.resolveDurationMs!=null},get children(){var d=to(),f=d.firstChild.nextSibling,v=f.firstChild;return l(f,()=>(e.registration.resolveDurationMs??0).toFixed(2),v),d}}),null),l(a,o(ve,{metric:"post-construct"}),null),l(c,()=>e.registration.postConstructStatus??"none"),h.$$click=d=>{d.stopPropagation(),Ct(e.registration.token)},w(()=>R(c,`px-2 py-0.5 rounded text-xs font-semibold ${po(e.registration.postConstructStatus)}`)),t})();function ho(e){return e==="controller"?"bg-violet-900/50 text-violet-300":e==="service"?"bg-blue-900/50 text-blue-300":e==="repository"?"bg-teal-900/50 text-teal-300":"bg-border-strong/50 text-text-strong"}function fo(e){return e==="controller"?"bg-violet-900/50 text-violet-300 border-violet-700/50":e==="service"?"bg-blue-900/50 text-blue-300 border-blue-700/50":e==="repository"?"bg-teal-900/50 text-teal-300 border-teal-700/50":e==="other"?"bg-border-strong/50 text-text-strong border-border-strong/50":"bg-kick-500/20 text-kick-500 border-kick-500/30"}function go(e){return e.postConstructStatus==="failed"?"bg-red-900/50 text-red-300":e.instantiated?"bg-emerald-900/50 text-emerald-300":"bg-amber-900/50 text-amber-300"}function vo(e){return e.postConstructStatus==="failed"?"failed":e.instantiated?"active":"registered"}function po(e){return e==="done"?"bg-emerald-900/50 text-emerald-300":e==="failed"?"bg-red-900/50 text-red-300":"bg-border-strong/50 text-text-secondary"}ie(["input","click"]);var mo=g('<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4">'),bo=g('<div class="bg-surface-1 rounded-xl border border-border p-5"><div class="relative mb-4"><svg class="absolute left-3 top-2.5 w-4 h-4 text-text-muted"fill=none stroke=currentColor viewBox="0 0 24 24"aria-hidden=true><path stroke-linecap=round stroke-linejoin=round stroke-width=2 d="M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"></path></svg><input type=text placeholder="Search queues by name…"class="w-full bg-surface-2 border border-border-strong rounded-lg pl-10 pr-4 py-2 text-sm text-text-body placeholder:text-text-muted focus:outline-none focus:border-kick-500">'),xo=g('<div class=card><div class=card-title>Queues</div><p class="text-text-muted text-sm mt-2">QueueAdapter not detected. Install <code class="font-mono text-kick-500">@forinda/kickjs-queue</code> and register the adapter in your bootstrap to see queue stats here.'),$o=g("<div class=empty>No queues registered"),yo=g("<div class=empty>No queues match the search"),_o=g('<div class="grid grid-cols-2 gap-2 text-sm">'),wo=g('<div class="bg-surface-2/50 rounded-lg border border-border-strong p-4"><h3 class="font-mono text-sm font-semibold text-kick-500 mb-3 break-all">'),So=g('<div class="text-red-400 text-sm">'),ko=g('<div class="flex justify-between"><span class=text-text-secondary></span><span>'),Co=()=>{const[e,t]=x(""),r=H(()=>{const s=q.queues().queues,i=e().trim().toLowerCase();return i?s.filter(u=>u.name.toLowerCase().includes(i)):s}),n=Pe(()=>r());return o(b,{get when(){return q.queues().enabled},get fallback(){return xo()},get children(){return o(b,{get when(){return q.queues().queues.length>0},get fallback(){return $o()},get children(){var s=bo(),i=s.firstChild.firstChild.nextSibling;return i.$$input=u=>t(u.currentTarget.value),l(s,o(b,{get when(){return n.page().length>0},get fallback(){return yo()},get children(){return[(()=>{var u=mo();return l(u,o(N,{get each(){return n.page()},children:a=>o(To,{queue:a})})),u})(),o(Be,{pager:n})]}}),null),w(()=>i.value=e()),s}})}})},To=e=>(()=>{var t=wo(),r=t.firstChild;return l(r,()=>e.queue.name),l(t,o(b,{get when(){return!e.queue.error},get fallback(){return(()=>{var n=So();return l(n,()=>e.queue.error),n})()},get children(){var n=_o();return l(n,o(He,{label:"Waiting",get value(){return e.queue.waiting??0},colour:"text-amber-400"}),null),l(n,o(He,{label:"Active",get value(){return e.queue.active??0},colour:"text-blue-400"}),null),l(n,o(He,{label:"Completed",get value(){return e.queue.completed??0},colour:"text-emerald-400"}),null),l(n,o(He,{label:"Failed",get value(){return e.queue.failed??0},colour:"text-red-400"}),null),l(n,o(He,{label:"Delayed",get value(){return e.queue.delayed??0},colour:"text-violet-400"}),null),l(n,o(He,{label:"Paused",get value(){return e.queue.paused??0},colour:"text-text-secondary"}),null),n}}),null),t})(),He=e=>(()=>{var t=ko(),r=t.firstChild,n=r.nextSibling;return l(r,()=>e.label),l(n,()=>e.value),w(()=>R(n,`font-semibold tabular-nums ${e.colour}`)),t})();ie(["input"]);function Eo(){let e=new Map,t=new Set;return{on:(r,n)=>{let s=e.get(r);return s||(s=new Set,e.set(r,s)),s.add(n),()=>{let i=e.get(r);i?.delete(n),i&&i.size===0&&e.delete(r)}},onAny:r=>(t.add(r),()=>{t.delete(r)}),dispatch:r=>{let n=e.get(r.type);if(n&&n.size>0)for(let s of[...n])try{s(r.payload)}catch(i){console.error(`[kick:devtools-bus] handler for "${r.type}" threw`,i)}if(t.size>0)for(let s of[...t])try{s(r)}catch(i){console.error("[kick:devtools-bus] onAny handler threw",i)}}}}function Ao(e={}){let t=Eo(),r=e.channel===!1?null:e.channel??"kick-devtools",n=r!=null&&typeof BroadcastChannel<"u"?new BroadcastChannel(r):null;n?.addEventListener("message",v=>{let p=v.data;p&&typeof p.type=="string"&&typeof p.ts=="number"&&t.dispatch({...p,__kick_origin:"broadcast"})});let s=null,i=0,u=null,a=e.reconnectMs??500,c=e.reconnectMaxMs??5e3,h=()=>{e.wsUrl&&(typeof WebSocket>"u"||(!s||s.readyState!==WebSocket.OPEN&&s.readyState!==WebSocket.CONNECTING)&&(s=new WebSocket(e.wsUrl),s.addEventListener("open",()=>{i=0}),s.addEventListener("message",v=>{try{let p=JSON.parse(String(v.data));if(!p||typeof p.type!="string"||typeof p.ts!="number")return;t.dispatch({...p,__kick_origin:"ws"})}catch{}}),s.addEventListener("close",()=>{s=null,d()}),s.addEventListener("error",()=>{d()})))},d=()=>{if(!e.wsUrl||u!=null)return;i+=1;let v=Math.min(i*a,c);u=setTimeout(()=>{u=null,h()},v)},f=v=>{n?.postMessage(v),s&&s.readyState===WebSocket.OPEN?s.send(JSON.stringify(v)):e.wsUrl&&h()};return{on(v,p){return h(),t.on(v,p)},onAny(v){return h(),t.onAny(v)},emit(v,p){let m={type:v,payload:p,ts:Date.now(),__kick_origin:"local"};t.dispatch(m),f(m)}}}var Xe=null,[Mo,Xt]=x([]);function Lo(){if(Xe)return()=>{};const e=`${Ie()}/_bus`,t=location.protocol==="https:"?"wss:":"ws:",r=De(),n=r?`?token=${encodeURIComponent(r)}`:"",s=`${t}//${location.host}${e}${n}`;Xe=Ao({channel:"kick-devtools",wsUrl:s});const i=Xe.onAny(u=>{Xt(a=>{const c=a.length>=500?a.slice(1):a.slice();return c.push(u),c})});return()=>{i(),Xe=null,Xt([])}}function Tt(){return Mo}function Ro(){Xt([])}function Oo(){return Xe}var Bt=200;function jo(e){if(e==null)return String(e);if(typeof e=="bigint")return`${e.toString()}n`;if(typeof e!="object")return String(e);const t=new WeakSet,r=(s,i)=>{if(typeof i=="bigint")return`${i.toString()}n`;if(i instanceof Error)return{name:i.name,message:i.message};if(i&&typeof i=="object"){if(t.has(i))return"[Circular]";t.add(i)}return i};let n;try{n=JSON.stringify(e,r)}catch{n="[unserialisable]"}return n===void 0&&(n=String(e)),n.length>Bt?`${n.slice(0,Bt)}… (+${n.length-Bt} chars)`:n}function gn(e){const t=new Date(e);return`${String(t.getHours()).padStart(2,"0")}:${String(t.getMinutes()).padStart(2,"0")}:${String(t.getSeconds()).padStart(2,"0")}.${String(t.getMilliseconds()).padStart(3,"0")}`}var No=g("<table><thead><tr><th>Time</th><th>Dialect</th><th class=text-right>Duration</th><th>SQL</th></tr></thead><tbody>"),Io=g('<div class="bg-surface-1 rounded-xl border border-border p-5"><div class="grid mb-4"></div><input type=text placeholder="Filter by SQL (substring)…"class="w-full bg-surface-2 border border-border-strong rounded-lg px-3 py-2 text-sm text-text-body placeholder:text-text-muted focus:outline-none focus:border-kick-500 mb-4">'),Po=g("<div class=empty>No queries yet. <code>kick/db</code> emits a <code>db:query</code> event per statement when DevTools is installed — run a query to see it here."),Bo=g("<code class=break-all>"),qo=g("<tr><td class=dimmed></td><td></td><td class=text-right></td><td>"),Do=g("<span style=color:var(--color-red-400)>"),Uo=g("<div class=card><div class=card-header><div class=card-title></div></div><div class=card-value>"),qt=50,Fo=300,Ho=()=>{const[e,t]=x([]),[r,n]=x(""),s=h=>{t(d=>{const f=d.length>=Fo?d.slice(1):d.slice();return f.push(h),f})},i=(h,d)=>{const f=h,v=f.error;return{sql:f.sql,parameters:f.parameters,durationMs:0,dialect:f.dialect,error:v instanceof Error?v.message:String(v??"query error"),ts:d}};Je(()=>{for(const v of Tt()())v.type==="db:query"?s({...v.payload,ts:v.ts}):v.type==="db:query-error"&&s(i(v.payload,v.ts));const h=Oo(),d=h?.on("db:query",v=>{const p=v;s({...p,ts:p.ts??Date.now()})}),f=h?.on("db:query-error",v=>s(i(v,Date.now())));$e(()=>{d?.(),f?.()})});const u=H(()=>{const h=e(),d=h.filter(p=>p.error).length,f=h.filter(p=>p.durationMs>=qt).length,v=h.length;return{total:v,errors:d,slow:f,avg:v?h.reduce((p,m)=>p+m.durationMs,0)/v:0}}),a=H(()=>{const h=r().trim().toLowerCase();return[...h?e().filter(d=>d.sql.toLowerCase().includes(h)):e()].toReversed()}),c=Pe(()=>a());return(()=>{var h=Io(),d=h.firstChild,f=d.nextSibling;return l(d,o(pt,{label:"Queries",get value(){return String(u().total)}}),null),l(d,o(pt,{label:"Errors",get value(){return String(u().errors)},get tone(){return u().errors?"err":void 0}}),null),l(d,o(pt,{label:`Slow (≥${qt}ms)`,get value(){return String(u().slow)},get tone(){return u().slow?"warn":void 0}}),null),l(d,o(pt,{label:"Avg duration",get value(){return Me(u().avg)}}),null),f.$$input=v=>n(v.currentTarget.value),l(h,o(b,{get when(){return e().length},get fallback(){return Po()},get children(){return[(()=>{var v=No(),p=v.firstChild.nextSibling;return l(p,o(N,{get each(){return c.page()},children:m=>(()=>{var k=qo(),S=k.firstChild,y=S.nextSibling,$=y.nextSibling,L=$.nextSibling;return l(S,()=>gn(m.ts)),l(y,()=>m.dialect??"—"),l($,()=>Me(m.durationMs)),l(L,o(b,{get when(){return!m.error},get fallback(){return(()=>{var A=Do();return l(A,()=>m.error),A})()},get children(){var A=Bo();return l(A,()=>m.sql),A}})),w(A=>rr($,m.durationMs>=qt?"color:var(--color-amber-400);font-weight:600":"",A)),k})()})),v})(),o(Be,{pager:c})]}}),null),w(()=>f.value=r()),h})()},pt=e=>(()=>{var t=Uo(),r=t.firstChild,n=r.firstChild,s=r.nextSibling;return l(n,()=>e.label),l(s,()=>e.value),w(i=>rr(s,e.tone==="err"?"color:var(--color-red-400)":e.tone==="warn"?"color:var(--color-amber-400)":"",i)),t})();ie(["input"]);var zo=g("<div class=space-y-6>"),Vo=g('<div class="bg-surface-1 rounded-xl border border-border p-5"><div class="relative mb-4"><svg class="absolute left-3 top-2.5 w-4 h-4 text-text-muted"fill=none stroke=currentColor viewBox="0 0 24 24"aria-hidden=true><path stroke-linecap=round stroke-linejoin=round stroke-width=2 d="M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"></path></svg><input type=text placeholder="Filter graph (token or kind)…"class="w-full bg-surface-2 border border-border-strong rounded-lg pl-10 pr-4 py-2 text-sm text-text-body placeholder:text-text-muted focus:outline-none focus:border-kick-500">'),Go=g("<div class=empty>"),Jo=g("<div class=space-y-1>"),Ko=g('<div><button type=button><svg fill=none stroke=currentColor viewBox="0 0 24 24"aria-hidden=true><path stroke-linecap=round stroke-linejoin=round stroke-width=2.5 d="M9 5l7 7-7 7"></path></svg><span></span><span class="ml-2 text-text-muted font-normal normal-case">(<!>)'),Wo=g('<span class="bg-border-strong/50 text-text-secondary px-1.5 py-0.5 rounded text-xs">'),Yo=g('<span class="text-text-muted text-xs ml-auto tabular-nums"> resolves'),Qo=g('<div class="ml-8 mt-1 space-y-0.5">'),Xo=g('<button type=button class="w-full text-left px-3 py-2 rounded-lg hover:bg-surface-2/50 transition-colors group"><div class="flex items-center gap-2"><span></span><span class="font-mono text-sm text-text-body break-all">'),Zo=g('<div class="flex items-center gap-2 text-xs text-text-muted hover:text-text-strong"><svg class="w-3 h-3 text-text-muted"fill=none stroke=currentColor viewBox="0 0 24 24"aria-hidden=true><path stroke-linecap=round stroke-linejoin=round stroke-width=2 d="M13 7l5 5-5 5M6 12h12"></path></svg><span></span><span class=font-mono>'),ec=[{id:"controllers",label:"Controllers",match:e=>e==="controller"},{id:"services",label:"Services",match:e=>e==="service"},{id:"repositories",label:"Repositories",match:e=>e==="repository"},{id:"other",label:"Other",match:e=>!["controller","service","repository"].includes(e??"")}],tc=()=>{const[e,t]=x(""),r=H(()=>{const s=q.container(),i=e().trim().toLowerCase();return i?s.filter(u=>u.token.toLowerCase().includes(i)||(u.kind??"").toLowerCase().includes(i)):s}),n=H(()=>ec.map(s=>Object.assign(s,{nodes:r().filter(i=>s.match(i.kind))})));return(()=>{var s=Vo(),i=s.firstChild.firstChild.nextSibling;return i.$$input=u=>t(u.currentTarget.value),l(s,o(b,{get when(){return r().length>0},get fallback(){return(()=>{var u=Go();return l(u,()=>e()?"No nodes match the filter":"No DI registrations to graph"),u})()},get children(){var u=zo();return l(u,o(N,{get each(){return n()},children:a=>o(b,{get when(){return a.nodes.length>0},get children(){return o(rc,{get label(){return a.label},get nodes(){return a.nodes}})}})})),u}}),null),w(()=>i.value=e()),s})()},rc=e=>{const t=H(()=>e.nodes??[]),r=Pe(t),n=`kickjs-devtools-graph-collapsed-${e.label}`,s=()=>{try{return localStorage.getItem(n)==="1"}catch{return!1}},[i,u]=x(s()),a=()=>{const c=!i();u(c);try{c?localStorage.setItem(n,"1"):localStorage.removeItem(n)}catch{}};return(()=>{var c=Ko(),h=c.firstChild,d=h.firstChild,f=d.nextSibling,v=f.nextSibling,p=v.firstChild.nextSibling;return p.nextSibling,h.$$click=a,l(f,()=>e.label),l(v,()=>t().length,p),l(c,o(b,{get when(){return!i()},get children(){return[(()=>{var m=Jo();return l(m,o(N,{get each(){return r.page()},children:k=>o(nc,{node:k})})),m})(),o(b,{get when(){return r.total()>1},get children(){return o(Be,{pager:r})}})]}}),null),w(m=>{var k=!i(),S=`w-full flex items-center text-left text-xs font-semibold uppercase tracking-wider mb-2 ${lc(e.label)} cursor-pointer hover:opacity-80 transition-opacity`,y=`w-3 h-3 mr-1.5 transition-transform ${i()?"":"rotate-90"}`;return k!==m.e&&z(h,"aria-expanded",m.e=k),S!==m.t&&R(h,m.t=S),y!==m.a&&z(d,"class",m.a=y),m},{e:void 0,t:void 0,a:void 0}),c})()},nc=e=>{const t=()=>e.node.dependencies??[];return(()=>{var r=Xo(),n=r.firstChild,s=n.firstChild,i=s.nextSibling;return r.$$click=()=>Ct(e.node.token),l(s,()=>vn(e.node.kind)),l(i,()=>e.node.token),l(n,o(b,{get when(){return e.node.scope},get children(){var u=Wo();return l(u,()=>e.node.scope),u}}),null),l(n,o(b,{get when(){return(e.node.resolveCount??0)>0},get children(){var u=Yo(),a=u.firstChild;return l(u,()=>e.node.resolveCount,a),u}}),null),l(r,o(b,{get when(){return t().length>0},get children(){var u=Qo();return l(u,o(N,{get each(){return t()},children:a=>(()=>{var c=Zo(),h=c.firstChild.nextSibling,d=h.nextSibling;return c.$$click=f=>{f.stopPropagation(),Ct(a)},l(h,()=>sc(a)),l(d,a),w(()=>R(h,`px-1.5 py-0.5 rounded text-xs font-semibold ${ic(a)}`)),c})()})),u}}),null),w(()=>R(s,`px-2 py-0.5 rounded text-xs font-semibold ${pn(e.node.kind)}`)),r})()};function vn(e){return e==="controller"?"ctrl":e==="service"?"svc":e==="repository"?"repo":"other"}function pn(e){return e==="controller"?"bg-violet-900/50 text-violet-300":e==="service"?"bg-blue-900/50 text-blue-300":e==="repository"?"bg-teal-900/50 text-teal-300":"bg-border-strong/50 text-text-strong"}function lc(e){return e==="Controllers"?"text-violet-400":e==="Services"?"text-blue-400":e==="Repositories"?"text-teal-400":"text-text-secondary"}function sc(e){return vn(q.container().find(t=>t.token===e)?.kind)}function ic(e){return pn(q.container().find(t=>t.token===e)?.kind)}ie(["input","click"]);var ac=g("<div class=overflow-x-auto><table><thead><tr><th style=width:140px>Time</th><th style=width:200px>Type</th><th style=width:120px>Source</th><th>Payload</th></tr></thead><tbody>"),oc=g('<div class="bg-surface-1 rounded-xl border border-border p-5"><div class="flex flex-col sm:flex-row gap-3 mb-4 items-stretch sm:items-center"><input type=text placeholder="Filter by event type (substring)…"class="flex-1 bg-surface-2 border border-border-strong rounded-lg px-3 py-2 text-sm text-text-body placeholder:text-text-muted focus:outline-none focus:border-kick-500"><div class="flex gap-2"><button type=button></button><button type=button class="px-3 py-1.5 text-xs font-semibold rounded-lg bg-surface-2 text-text-secondary border border-border-strong hover:text-text-body transition-colors">Clear</button></div></div><div class="text-xs text-text-muted mb-3 font-mono">/<!> buffered'),cc=g("<div class=empty>"),uc=g('<tr><td class="font-mono text-xs text-text-muted"></td><td class="font-mono text-xs"></td><td class="font-mono text-xs text-text-secondary"></td><td class="font-mono text-xs"><code class="text-text-body break-all">'),dc=()=>{const e=Tt(),[t,r]=x(""),[n,s]=x(!1),[i,u]=x(null),a=()=>{s(d=>{const f=!d;return u(f?e():null),f})},c=H(()=>{const d=i()??e(),f=t().trim().toLowerCase();return[...f?d.filter(v=>v.type.toLowerCase().includes(f)):d].toReversed()}),h=Pe(()=>c());return(()=>{var d=oc(),f=d.firstChild,v=f.firstChild,p=v.nextSibling.firstChild,m=p.nextSibling,k=f.nextSibling,S=k.firstChild,y=S.nextSibling;return y.nextSibling,v.$$input=$=>r($.currentTarget.value),p.$$click=a,l(p,()=>n()?"▶ Resume":"⏸ Pause"),m.$$click=()=>Ro(),l(k,()=>e().length,S),l(k,500,y),l(k,o(b,{get when(){return n()},children:" · paused"}),null),l(k,o(b,{get when(){return t().trim()},get children(){return[' · filter: "',fe(()=>t().trim()),'"']}}),null),l(d,o(b,{get when(){return h.page().length>0},get fallback(){return(()=>{var $=cc();return l($,o(b,{get when(){return e().length===0},fallback:"No events match the current filter",children:"No events yet — emits from kickjs-db, plugins, or the panel itself land here."})),$})()},get children(){return[(()=>{var $=ac(),L=$.firstChild.firstChild.nextSibling;return l(L,o(N,{get each(){return h.page()},children:A=>(()=>{var O=uc(),K=O.firstChild,V=K.nextSibling,F=V.nextSibling,B=F.nextSibling.firstChild;return l(K,()=>gn(A.ts)),l(V,()=>A.type),l(F,()=>A.pluginId??"—"),l(B,()=>jo(A.payload)),O})()})),$})(),o(Be,{pager:h})]}}),null),w(()=>R(p,`px-3 py-1.5 text-xs font-semibold rounded-lg border transition-colors ${n()?"bg-kick-500/20 text-kick-500 border-kick-500/30":"bg-surface-2 text-text-secondary border-border-strong hover:text-text-body"}`)),w(()=>v.value=t()),d})()};ie(["input","click"]);var hc=g("<div style=display:flex;flex-direction:column;height:100%>"),fc=g('<iframe title="custom devtools tab"sandbox="allow-scripts allow-same-origin allow-forms"style=flex:1;width:100%;border:none;background:var(--bg)>'),gc=g("<div style=padding:16px><div class=card>"),vc=g("<div style=color:var(--text-dim);font-size:12px>"),pc=g('<div style="display:flex;align-items:center;justify-content:space-between;padding:8px 0;border-bottom:1px solid var(--border)"><div><div style=font-weight:600></div></div><button type=button class=tab style="border:1px solid var(--border);border-radius:4px;padding:6px 14px;border-bottom-color:var(--border)">'),mc=g("<div class=card><div class=card-title>Last response</div><code>"),bc=g("<div style=padding:16px;flex:1;overflow:auto>"),xc=e=>(()=>{var t=hc();return l(t,o(b,{get when(){return e.tab.view.type==="iframe"},get children(){return o($c,{get view(){return e.tab.view}})}}),null),l(t,o(b,{get when(){return e.tab.view.type==="launch"},get children(){return o(yc,{get view(){return e.tab.view},get tabId(){return e.tab.id}})}}),null),l(t,o(b,{get when(){return e.tab.view.type==="html"},get children(){return o(_c,{get view(){return e.tab.view}})}}),null),t})(),$c=e=>{const t=()=>{const r=e.view.src,n=(r.startsWith("http")||r.startsWith("//"),r),s=De();return s?`${n}${n.includes("?")?"&":"?"}token=${encodeURIComponent(s)}`:n};return(()=>{var r=fc();return w(()=>z(r,"src",t())),r})()},yc=e=>{const[t,r]=x(null),[n,s]=x(null),i=async u=>{r(u),s(null);try{const a=`${Ie()}/tabs/${encodeURIComponent(e.tabId)}/actions/${encodeURIComponent(u)}`,c=De(),h=await fetch(c?`${a}?token=${encodeURIComponent(c)}`:a,{method:"POST",headers:c?{"x-devtools-token":c}:void 0});s(`${h.status} ${h.statusText}`)}catch(a){s(a instanceof Error?a.message:String(a))}finally{r(null)}};return(()=>{var u=gc(),a=u.firstChild;return l(a,o(N,{get each(){return e.view.actions},children:c=>(()=>{var h=pc(),d=h.firstChild,f=d.firstChild,v=d.nextSibling;return l(f,()=>c.label),l(d,o(b,{get when(){return c.description},get children(){var p=vc();return l(p,()=>c.description),p}}),null),v.$$click=()=>{i(c.id)},l(v,()=>t()===c.id?"Running…":"Run"),w(()=>v.disabled=t()===c.id),h})()})),l(u,o(b,{get when(){return n()},children:c=>(()=>{var h=mc(),d=h.firstChild.nextSibling;return l(d,c),h})()}),null),u})()},_c=e=>(()=>{var t=bc();return w(()=>t.innerHTML=e.view.html),t})();ie(["click"]);var Et=!1,Ze=null,$t=null;async function wc(){return X.setConnectionStatus("connecting"),await Zt(),$t=ir("/stream",e=>{if(!Et){if(X.setConnectionStatus("live"),mn(),e.type==="metrics"){Sc(e),X.touch();return}if(e.type==="container"){Zt();return}}},()=>{Et||(X.setConnectionStatus("polling"),kc())}),Cc}async function Zt(){const e=await Promise.allSettled([ge.health(),ge.metrics(),ge.routeRegistry(),ge.container(),ge.queues(),ge.ws()]);if(e.every(a=>a.status==="rejected"&&a.reason instanceof ln)){X.setAuthRequired(!0),X.setConnectionStatus("disconnected");return}q.authRequired()&&(X.setAuthRequired(!1),X.setAuthError(null));const[t,r,n,s,i,u]=e;t.status==="fulfilled"&&X.setHealth({status:t.value.status,errorRate:t.value.errorRate,uptime:t.value.uptime,adapters:t.value.adapters??{}}),r.status==="fulfilled"&&X.setMetrics({requests:r.value.requests,serverErrors:r.value.serverErrors,clientErrors:r.value.clientErrors,errorRate:r.value.errorRate,uptimeSeconds:r.value.uptimeSeconds,startedAt:r.value.startedAt}),n.status==="fulfilled"&&X.setRoutes(n.value.routes??[]),s.status==="fulfilled"&&X.setContainer(s.value.registrations??[]),i.status==="fulfilled"&&X.setQueues({enabled:i.value.enabled,queues:i.value.queues??[]}),u.status==="fulfilled"&&X.setWs(u.value),X.touch()}function Sc(e){const t=q.metrics();if(!t)return;X.setMetrics({...t,requests:e.requestCount,serverErrors:e.errorCount,clientErrors:e.clientErrorCount,errorRate:e.errorRate,uptimeSeconds:e.uptimeSeconds});const r=q.health();r&&X.setHealth({...r,uptime:e.uptimeSeconds,errorRate:e.errorRate})}function kc(){Ze||(Ze=setInterval(()=>{Et||Zt()},5e3))}function mn(){Ze&&(clearInterval(Ze),Ze=null)}function Cc(){Et=!0,mn(),$t&&($t(),$t=null),X.setConnectionStatus("disconnected")}var Tc=g('<div class="fixed inset-0 z-[60] bg-slate-950/90 flex items-center justify-center p-4"><div class="bg-slate-900 border border-slate-700 rounded-2xl p-8 max-w-md w-full shadow-2xl"><div class="text-center mb-6"><h2 class="text-xl font-bold text-kick-500 mb-2">⚡ KickJS DevTools</h2><p class="text-sm text-slate-400">Enter your DevTools token to continue.</p><p class="text-xs text-slate-600 mt-1">The token is printed in the server console on startup, e.g. <code class="font-mono text-slate-500">[token: abc123…]</code></p></div><form><input type=text autofocus placeholder="Paste your token here…"class="w-full bg-slate-800 border border-slate-700 rounded-lg px-4 py-3 text-sm text-slate-200 placeholder-slate-500 focus:outline-none focus:border-kick-500 font-mono mb-3"><button type=submit class="w-full bg-kick-500 hover:bg-kick-600 text-white font-semibold py-2.5 rounded-lg transition-colors disabled:opacity-50">'),Ec=g('<p class="text-red-400 text-sm mb-3">'),Ac=()=>{const[e,t]=x(""),[r,n]=x(!1),s=async()=>{const i=e().trim();if(!i){X.setAuthError("Token is required");return}n(!0),X.setAuthError(null);try{Jt(i),await ge.health(),X.setAuthRequired(!1),X.setAuthError(null),t("")}catch{X.setAuthError("Invalid token — request was rejected.")}finally{n(!1)}};return o(b,{get when(){return q.authRequired()},get children(){var i=Tc(),u=i.firstChild.firstChild.nextSibling,a=u.firstChild,c=a.nextSibling;return u.addEventListener("submit",h=>{h.preventDefault(),s()}),a.$$input=h=>t(h.currentTarget.value),l(u,o(b,{get when(){return q.authError()},children:h=>(()=>{var d=Ec();return l(d,h),d})()}),c),l(c,()=>r()?"Verifying…":"Authenticate"),w(()=>c.disabled=r()),w(()=>a.value=e()),i}})};ie(["input"]);var Mc=g("<div class=dt-nav-sep>"),Lc=g('<div class=card style=border-color:var(--warn);margin-top:16px><div class=card-title style=color:var(--warn)> custom-tab issue(s)</div><ul style="margin:8px 0 0;padding-left:20px;font-family:var(--font-mono);font-size:12px">'),Rc=g("<div class=app><header class=dt-header><div class=dt-header-brand><span class=dt-bolt aria-hidden=true>⚡</span><h1>KickJS DevTools</h1></div><div style=display:flex;align-items:center;gap:12px></div></header><div class=dt-shell><aside class=dt-sidebar role=tablist></aside><div class=dt-resizer role=separator aria-orientation=vertical></div><main class=dt-main role=tabpanel>"),Dt=g("<button type=button role=tab><span class=dt-nav-label>"),Dr=g("<span class=tab-badge>"),Oc=g("<div class=dt-nav-group><button type=button class=dt-nav-group-header><span>▾"),jc=g("<li>: "),Nc=g("<div class=dt-conn><span aria-hidden=true></span><span class=dt-conn-label></span><span class=dt-conn-sep>·</span><span class=dt-conn-ts>Updated "),Ic=g("<div class=dt-settings-pop role=menu><div class=dt-settings-section><div class=dt-settings-label>Density</div><div class=dt-seg></div><div class=dt-settings-hint>Controls spacing & font scale. Default: Small."),Pc=g('<div class=dt-settings><button type=button aria-label=Settings aria-haspopup=true title=Settings><svg viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2><circle cx=12 cy=12 r=3></circle><path d="M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 1 1-2.83 2.83l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-4 0v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 1 1-2.83-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1 0-4h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 1 1 2.83-2.83l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 4 0v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 1 1 2.83 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 0 4h-.09a1.65 1.65 0 0 0-1.51 1z">'),Bc=g("<button type=button>"),qc=g('<svg viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2><path d="M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z">'),Dc=g("<button type=button class=dt-theme-toggle>"),Uc=g('<svg viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2><circle cx=12 cy=12 r=4></circle><path d="M12 2v2M12 20v2M4.93 4.93l1.41 1.41M17.66 17.66l1.41 1.41M2 12h2M20 12h2M4.93 19.07l1.41-1.41M17.66 6.34l1.41-1.41">');function bn(){return[{id:"overview",label:"Overview"},{id:"runtime",label:"Runtime"},{id:"memory",label:"Memory"},{id:"topology",label:"Topology"},{id:"routes",label:"Routes",count:()=>q.routes().length||void 0},{id:"metrics",label:"Metrics"},{id:"container",label:"Container",count:()=>q.container().length||void 0},{id:"queues",label:"Queues",count:()=>q.queues().queues.length||void 0},{id:"database",label:"Database",count:()=>Tt()().filter(e=>e.type==="db:query"||e.type==="db:query-error").length||void 0},{id:"graph",label:"Graph",count:()=>q.container().length||void 0},{id:"activity",label:"Activity",count:()=>Tt()().length||void 0}]}var Fc=new Set(bn().map(e=>e.id)),Hc=[{label:null,ids:["overview"]},{label:"Runtime",ids:["runtime","memory","topology","metrics"]},{label:"Architecture",ids:["routes","container","graph"]},{label:"Data & Jobs",ids:["database","queues"]},{label:null,ids:["activity"]}],xn="kickjs-devtools-sidebar-w",$n="kickjs-devtools-sidebar-collapsed",yn=150,_n=360;function zc(){try{const e=Number(localStorage.getItem(xn));if(e>=yn&&e<=_n)return e}catch{}return 200}function Vc(){try{const e=localStorage.getItem($n);if(e)return JSON.parse(e)}catch{}return[]}var Gc=()=>{const e=(()=>{try{const $=localStorage.getItem("kickjs-devtools-tab");if($)return $}catch{}return"overview"})(),[t,r]=x(e),[n,s]=x([]),[i,u]=x([]),a=bn(),c=new Map(a.map($=>[$.id,$])),[h,d]=x(zc()),[f,v]=x(Vc()),p=$=>{v(L=>{const A=L.includes($)?L.filter(O=>O!==$):[...L,$];try{localStorage.setItem($n,JSON.stringify(A))}catch{}return A})};let m=null;$e(()=>m?.());const k=$=>{$.preventDefault();const L=$.clientX,A=h();document.body.style.cursor="col-resize";const O=F=>{const B=Math.min(_n,Math.max(yn,A+(F.clientX-L)));d(B)},K=()=>{document.removeEventListener("mousemove",O),document.removeEventListener("mouseup",V),document.body.style.cursor="",m=null},V=()=>{K();try{localStorage.setItem(xn,String(h()))}catch{}};m=K,document.addEventListener("mousemove",O),document.addEventListener("mouseup",V)};Je(()=>{ge.tabs().then(({tabs:A,errors:O})=>{s(A.filter(K=>!Fc.has(K.id))),u(O)}).catch(()=>{});let $=null;wc().then(A=>{$=A});const L=Lo();$e(()=>{$?.(),L()}),rl(),il()});const S=$=>{r($);try{localStorage.setItem("kickjs-devtools-tab",$)}catch{}queueMicrotask(()=>{document.querySelector(`[role="tab"][data-tab-id="${$}"]`)?.scrollIntoView({behavior:"smooth",inline:"center",block:"nearest"})})},y=()=>n().find($=>$.id===t());return(()=>{var $=Rc(),L=$.firstChild,A=L.firstChild.nextSibling,O=L.nextSibling.firstChild,K=O.nextSibling,V=K.nextSibling;return l(A,o(Jc,{}),null),l(A,o(Yc,{}),null),l(A,o(Wc,{}),null),l(O,o(N,{each:Hc,children:F=>o(b,{get when(){return F.label},get fallback(){return o(N,{get each(){return F.ids},children:B=>{const le=c.get(B);return o(b,{when:le,children:Y=>(()=>{var Z=Dt(),G=Z.firstChild;return Z.$$click=()=>S(B),z(Z,"data-tab-id",B),l(G,()=>Y().label),l(Z,o(b,{get when(){return Y().count?.()},children:Q=>(()=>{var ee=Dr();return l(ee,Q),ee})()}),null),w(Q=>{var ee=`dt-nav-item ${t()===B?"active":""}`,de=t()===B;return ee!==Q.e&&R(Z,Q.e=ee),de!==Q.t&&z(Z,"aria-selected",Q.t=de),Q},{e:void 0,t:void 0}),Z})()})}})},children:B=>(()=>{var le=Oc(),Y=le.firstChild,Z=Y.firstChild;return Y.$$click=()=>p(B()),l(Y,B,null),l(le,o(b,{get when(){return!f().includes(B())},get children(){return o(N,{get each(){return F.ids},children:G=>{const Q=c.get(G);return o(b,{when:Q,children:ee=>(()=>{var de=Dt(),pe=de.firstChild;return de.$$click=()=>S(G),z(de,"data-tab-id",G),l(pe,()=>ee().label),l(de,o(b,{get when(){return ee().count?.()},children:ne=>(()=>{var ae=Dr();return l(ae,ne),ae})()}),null),w(ne=>{var ae=`dt-nav-item nested ${t()===G?"active":""}`,Ee=t()===G;return ae!==ne.e&&R(de,ne.e=ae),Ee!==ne.t&&z(de,"aria-selected",ne.t=Ee),ne},{e:void 0,t:void 0}),de})()})}})}}),null),w(G=>{var Q=!f().includes(B()),ee=`dt-nav-caret ${f().includes(B())?"closed":""}`;return Q!==G.e&&z(Y,"aria-expanded",G.e=Q),ee!==G.t&&R(Z,G.t=ee),G},{e:void 0,t:void 0}),le})()})}),null),l(O,o(b,{get when(){return n().length>0},get children(){return[Mc(),o(N,{get each(){return n()},children:F=>(()=>{var B=Dt(),le=B.firstChild;return B.$$click=()=>S(F.id),l(le,()=>F.title),w(Y=>{var Z=F.id,G=`dt-nav-item ${t()===F.id?"active":""}`,Q=t()===F.id,ee=F.title;return Z!==Y.e&&z(B,"data-tab-id",Y.e=Z),G!==Y.t&&R(B,Y.t=G),Q!==Y.a&&z(B,"aria-selected",Y.a=Q),ee!==Y.o&&z(B,"title",Y.o=ee),Y},{e:void 0,t:void 0,a:void 0,o:void 0}),B})()})]}}),null),K.$$mousedown=k,l(V,o(b,{get when(){return t()==="overview"},get children(){return o(Jl,{})}}),null),l(V,o(b,{get when(){return t()==="runtime"},get children(){return o(os,{})}}),null),l(V,o(b,{get when(){return t()==="memory"},get children(){return o(Ss,{})}}),null),l(V,o(b,{get when(){return t()==="topology"},get children(){return o(ti,{})}}),null),l(V,o(b,{get when(){return t()==="routes"},get children(){return o(Sa,{})}}),null),l(V,o(b,{get when(){return t()==="metrics"},get children(){return o(Oa,{})}}),null),l(V,o(b,{get when(){return t()==="container"},get children(){return o(co,{})}}),null),l(V,o(b,{get when(){return t()==="queues"},get children(){return o(Co,{})}}),null),l(V,o(b,{get when(){return t()==="database"},get children(){return o(Ho,{})}}),null),l(V,o(b,{get when(){return t()==="graph"},get children(){return o(tc,{})}}),null),l(V,o(b,{get when(){return t()==="activity"},get children(){return o(dc,{})}}),null),l(V,o(b,{get when(){return y()},children:F=>o(xc,{get tab(){return F()}})}),null),l(V,o(b,{get when(){return fe(()=>i().length>0)()&&t()==="overview"},get children(){var F=Lc(),B=F.firstChild,le=B.firstChild,Y=B.nextSibling;return l(B,()=>i().length,le),l(Y,o(N,{get each(){return i()},children:Z=>(()=>{var G=jc(),Q=G.firstChild;return l(G,()=>Z.source,Q),l(G,()=>Z.reason,null),G})()})),F}}),null),l($,o(za,{}),null),l($,o(va,{}),null),l($,o(Ac,{}),null),w(F=>rr(O,`width:${h()}px`,F)),$})()},Jc=()=>{const e=r=>r==="live"?"Live":r==="polling"?"Polling":r==="disconnected"?"Disconnected":"Connecting…",t=r=>r?r.toLocaleTimeString():"never";return(()=>{var r=Nc(),n=r.firstChild,s=n.nextSibling,i=s.nextSibling.nextSibling;return i.firstChild,l(s,()=>e(q.connectionStatus())),l(i,()=>t(q.lastUpdate()),null),w(()=>R(n,`dt-pulse dt-pulse-${q.connectionStatus()}`)),r})()},Kc=[{id:"sm",label:"Small"},{id:"md",label:"Medium"},{id:"lg",label:"Large"}],Wc=()=>{const[e,t]=x(!1);let r;const n=i=>{e()&&r&&!r.contains(i.target)&&t(!1)},s=i=>{i.key==="Escape"&&t(!1)};return document.addEventListener("click",n),document.addEventListener("keydown",s),$e(()=>{document.removeEventListener("click",n),document.removeEventListener("keydown",s)}),(()=>{var i=Pc(),u=i.firstChild;return Kn(a=>r=a,i),u.$$click=()=>t(a=>!a),l(i,o(b,{get when(){return e()},get children(){var a=Ic(),c=a.firstChild.firstChild.nextSibling;return l(c,o(N,{each:Kc,children:h=>(()=>{var d=Bc();return d.$$click=()=>sl(h.id),l(d,()=>h.label),w(f=>{var v=`dt-seg-item ${br()===h.id?"active":""}`,p=br()===h.id;return v!==f.e&&R(d,f.e=v),p!==f.t&&z(d,"aria-pressed",f.t=p),f},{e:void 0,t:void 0}),d})()})),a}}),null),w(a=>{var c=`dt-settings-btn ${e()?"open":""}`,h=e();return c!==a.e&&R(u,a.e=c),h!==a.t&&z(u,"aria-expanded",a.t=h),a},{e:void 0,t:void 0}),i})()},Yc=()=>{const e=()=>{const r=Ot()==="system"?"light":Ot()==="light"?"dark":"system";tl(r)},t=()=>{const r=Ot();return`Theme: ${r==="system"?"follow system":r} (click to cycle)`};return(()=>{var r=Dc();return r.$$click=e,l(r,o(b,{get when(){return Xr()==="dark"},get fallback(){return Uc()},get children(){return qc()}})),w(n=>{var s=t(),i=t();return s!==n.e&&z(r,"aria-label",n.e=s),i!==n.t&&z(r,"title",n.t=i),n},{e:void 0,t:void 0}),r})()};ie(["mousedown","click"]);var wn=document.getElementById("root");if(!wn)throw new Error("#root not found");Jn(()=>o(Gc,{}),wn);
|