rails-profiler 0.35.3 → 0.36.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,14 +1,14 @@
1
- "use strict";(()=>{var en=e=>{throw TypeError(e)};var Bs=(e,r,s)=>r.has(e)||en("Cannot "+s);var c=(e,r,s)=>(Bs(e,r,"read from private field"),s?s.call(e):r.get(e)),k=(e,r,s)=>r.has(e)?en("Cannot add the same private member more than once"):r instanceof WeakSet?r.add(e):r.set(e,s),E=(e,r,s,o)=>(Bs(e,r,"write to private field"),o?o.call(e,s):r.set(e,s),s),L=(e,r,s)=>(Bs(e,r,"access private method"),s);var Qr=(e,r,s,o)=>({set _(n){E(e,r,n,s)},get _(){return c(e,r,o)}});var xs,X,on,Ia,vt,tn,nn,an,ln,Xs,Js,zs,un,gs={},vs=[],Va=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,_s=Array.isArray;function ut(e,r){for(var s in r)e[s]=r[s];return e}function Ys(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function Ha(e,r,s){var o,n,i,a={};for(i in r)i=="key"?o=r[i]:i=="ref"?n=r[i]:a[i]=r[i];if(arguments.length>2&&(a.children=arguments.length>3?xs.call(arguments,2):s),typeof e=="function"&&e.defaultProps!=null)for(i in e.defaultProps)a[i]===void 0&&(a[i]=e.defaultProps[i]);return hs(e,a,o,n,null)}function hs(e,r,s,o,n){var i={type:e,props:r,key:s,ref:o,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:n??++on,__i:-1,__u:0};return n==null&&X.vnode!=null&&X.vnode(i),i}function P(e){return e.children}function ys(e,r){this.props=e,this.context=r}function or(e,r){if(r==null)return e.__?or(e.__,e.__i+1):null;for(var s;r<e.__k.length;r++)if((s=e.__k[r])!=null&&s.__e!=null)return s.__e;return typeof e.type=="function"?or(e):null}function $a(e){if(e.__P&&e.__d){var r=e.__v,s=r.__e,o=[],n=[],i=ut({},r);i.__v=r.__v+1,X.vnode&&X.vnode(i),eo(e.__P,i,r,e.__n,e.__P.namespaceURI,32&r.__u?[s]:null,o,s??or(r),!!(32&r.__u),n),i.__v=r.__v,i.__.__k[i.__i]=i,fn(o,i,n),r.__e=r.__=null,i.__e!=s&&cn(i)}}function cn(e){if((e=e.__)!=null&&e.__c!=null)return e.__e=e.__c.base=null,e.__k.some(function(r){if(r!=null&&r.__e!=null)return e.__e=e.__c.base=r.__e}),cn(e)}function Ws(e){(!e.__d&&(e.__d=!0)&&vt.push(e)&&!bs.__r++||tn!=X.debounceRendering)&&((tn=X.debounceRendering)||nn)(bs)}function bs(){try{for(var e,r=1;vt.length;)vt.length>r&&vt.sort(an),e=vt.shift(),r=vt.length,$a(e)}finally{vt.length=bs.__r=0}}function pn(e,r,s,o,n,i,a,l,f,p,h){var d,y,m,g,v,_,T,w=o&&o.__k||vs,S=r.length;for(f=Ga(s,r,w,f,S),d=0;d<S;d++)(m=s.__k[d])!=null&&(y=m.__i!=-1&&w[m.__i]||gs,m.__i=d,_=eo(e,m,y,n,i,a,l,f,p,h),g=m.__e,m.ref&&y.ref!=m.ref&&(y.ref&&to(y.ref,null,m),h.push(m.ref,m.__c||g,m)),v==null&&g!=null&&(v=g),(T=!!(4&m.__u))||y.__k===m.__k?f=dn(m,f,e,T):typeof m.type=="function"&&_!==void 0?f=_:g&&(f=g.nextSibling),m.__u&=-7);return s.__e=v,f}function Ga(e,r,s,o,n){var i,a,l,f,p,h=s.length,d=h,y=0;for(e.__k=new Array(n),i=0;i<n;i++)(a=r[i])!=null&&typeof a!="boolean"&&typeof a!="function"?(typeof a=="string"||typeof a=="number"||typeof a=="bigint"||a.constructor==String?a=e.__k[i]=hs(null,a,null,null,null):_s(a)?a=e.__k[i]=hs(P,{children:a},null,null,null):a.constructor===void 0&&a.__b>0?a=e.__k[i]=hs(a.type,a.props,a.key,a.ref?a.ref:null,a.__v):e.__k[i]=a,f=i+y,a.__=e,a.__b=e.__b+1,l=null,(p=a.__i=Ba(a,s,f,d))!=-1&&(d--,(l=s[p])&&(l.__u|=2)),l==null||l.__v==null?(p==-1&&(n>h?y--:n<h&&y++),typeof a.type!="function"&&(a.__u|=4)):p!=f&&(p==f-1?y--:p==f+1?y++:(p>f?y--:y++,a.__u|=4))):e.__k[i]=null;if(d)for(i=0;i<h;i++)(l=s[i])!=null&&(2&l.__u)==0&&(l.__e==o&&(o=or(l)),hn(l,l));return o}function dn(e,r,s,o){var n,i;if(typeof e.type=="function"){for(n=e.__k,i=0;n&&i<n.length;i++)n[i]&&(n[i].__=e,r=dn(n[i],r,s,o));return r}e.__e!=r&&(o&&(r&&e.type&&!r.parentNode&&(r=or(e)),s.insertBefore(e.__e,r||null)),r=e.__e);do r=r&&r.nextSibling;while(r!=null&&r.nodeType==8);return r}function Ba(e,r,s,o){var n,i,a,l=e.key,f=e.type,p=r[s],h=p!=null&&(2&p.__u)==0;if(p===null&&l==null||h&&l==p.key&&f==p.type)return s;if(o>(h?1:0)){for(n=s-1,i=s+1;n>=0||i<r.length;)if((p=r[a=n>=0?n--:i++])!=null&&(2&p.__u)==0&&l==p.key&&f==p.type)return a}return-1}function rn(e,r,s){r[0]=="-"?e.setProperty(r,s??""):e[r]=s==null?"":typeof s!="number"||Va.test(r)?s:s+"px"}function ms(e,r,s,o,n){var i,a;e:if(r=="style")if(typeof s=="string")e.style.cssText=s;else{if(typeof o=="string"&&(e.style.cssText=o=""),o)for(r in o)s&&r in s||rn(e.style,r,"");if(s)for(r in s)o&&s[r]==o[r]||rn(e.style,r,s[r])}else if(r[0]=="o"&&r[1]=="n")i=r!=(r=r.replace(ln,"$1")),a=r.toLowerCase(),r=a in e||r=="onFocusOut"||r=="onFocusIn"?a.slice(2):r.slice(2),e.l||(e.l={}),e.l[r+i]=s,s?o?s.u=o.u:(s.u=Xs,e.addEventListener(r,i?zs:Js,i)):e.removeEventListener(r,i?zs:Js,i);else{if(n=="http://www.w3.org/2000/svg")r=r.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(r!="width"&&r!="height"&&r!="href"&&r!="list"&&r!="form"&&r!="tabIndex"&&r!="download"&&r!="rowSpan"&&r!="colSpan"&&r!="role"&&r!="popover"&&r in e)try{e[r]=s??"";break e}catch{}typeof s=="function"||(s==null||s===!1&&r[4]!="-"?e.removeAttribute(r):e.setAttribute(r,r=="popover"&&s==1?"":s))}}function sn(e){return function(r){if(this.l){var s=this.l[r.type+e];if(r.t==null)r.t=Xs++;else if(r.t<s.u)return;return s(X.event?X.event(r):r)}}}function eo(e,r,s,o,n,i,a,l,f,p){var h,d,y,m,g,v,_,T,w,S,M,K,I,se,N,D=r.type;if(r.constructor!==void 0)return null;128&s.__u&&(f=!!(32&s.__u),i=[l=r.__e=s.__e]),(h=X.__b)&&h(r);e:if(typeof D=="function")try{if(T=r.props,w=D.prototype&&D.prototype.render,S=(h=D.contextType)&&o[h.__c],M=h?S?S.props.value:h.__:o,s.__c?_=(d=r.__c=s.__c).__=d.__E:(w?r.__c=d=new D(T,M):(r.__c=d=new ys(T,M),d.constructor=D,d.render=za),S&&S.sub(d),d.state||(d.state={}),d.__n=o,y=d.__d=!0,d.__h=[],d._sb=[]),w&&d.__s==null&&(d.__s=d.state),w&&D.getDerivedStateFromProps!=null&&(d.__s==d.state&&(d.__s=ut({},d.__s)),ut(d.__s,D.getDerivedStateFromProps(T,d.__s))),m=d.props,g=d.state,d.__v=r,y)w&&D.getDerivedStateFromProps==null&&d.componentWillMount!=null&&d.componentWillMount(),w&&d.componentDidMount!=null&&d.__h.push(d.componentDidMount);else{if(w&&D.getDerivedStateFromProps==null&&T!==m&&d.componentWillReceiveProps!=null&&d.componentWillReceiveProps(T,M),r.__v==s.__v||!d.__e&&d.shouldComponentUpdate!=null&&d.shouldComponentUpdate(T,d.__s,M)===!1){r.__v!=s.__v&&(d.props=T,d.state=d.__s,d.__d=!1),r.__e=s.__e,r.__k=s.__k,r.__k.some(function(O){O&&(O.__=r)}),vs.push.apply(d.__h,d._sb),d._sb=[],d.__h.length&&a.push(d);break e}d.componentWillUpdate!=null&&d.componentWillUpdate(T,d.__s,M),w&&d.componentDidUpdate!=null&&d.__h.push(function(){d.componentDidUpdate(m,g,v)})}if(d.context=M,d.props=T,d.__P=e,d.__e=!1,K=X.__r,I=0,w)d.state=d.__s,d.__d=!1,K&&K(r),h=d.render(d.props,d.state,d.context),vs.push.apply(d.__h,d._sb),d._sb=[];else do d.__d=!1,K&&K(r),h=d.render(d.props,d.state,d.context),d.state=d.__s;while(d.__d&&++I<25);d.state=d.__s,d.getChildContext!=null&&(o=ut(ut({},o),d.getChildContext())),w&&!y&&d.getSnapshotBeforeUpdate!=null&&(v=d.getSnapshotBeforeUpdate(m,g)),se=h!=null&&h.type===P&&h.key==null?mn(h.props.children):h,l=pn(e,_s(se)?se:[se],r,s,o,n,i,a,l,f,p),d.base=r.__e,r.__u&=-161,d.__h.length&&a.push(d),_&&(d.__E=d.__=null)}catch(O){if(r.__v=null,f||i!=null)if(O.then){for(r.__u|=f?160:128;l&&l.nodeType==8&&l.nextSibling;)l=l.nextSibling;i[i.indexOf(l)]=null,r.__e=l}else{for(N=i.length;N--;)Ys(i[N]);Zs(r)}else r.__e=s.__e,r.__k=s.__k,O.then||Zs(r);X.__e(O,r,s)}else i==null&&r.__v==s.__v?(r.__k=s.__k,r.__e=s.__e):l=r.__e=Ja(s.__e,r,s,o,n,i,a,f,p);return(h=X.diffed)&&h(r),128&r.__u?void 0:l}function Zs(e){e&&(e.__c&&(e.__c.__e=!0),e.__k&&e.__k.some(Zs))}function fn(e,r,s){for(var o=0;o<s.length;o++)to(s[o],s[++o],s[++o]);X.__c&&X.__c(r,e),e.some(function(n){try{e=n.__h,n.__h=[],e.some(function(i){i.call(n)})}catch(i){X.__e(i,n.__v)}})}function mn(e){return typeof e!="object"||e==null||e.__b>0?e:_s(e)?e.map(mn):ut({},e)}function Ja(e,r,s,o,n,i,a,l,f){var p,h,d,y,m,g,v,_=s.props||gs,T=r.props,w=r.type;if(w=="svg"?n="http://www.w3.org/2000/svg":w=="math"?n="http://www.w3.org/1998/Math/MathML":n||(n="http://www.w3.org/1999/xhtml"),i!=null){for(p=0;p<i.length;p++)if((m=i[p])&&"setAttribute"in m==!!w&&(w?m.localName==w:m.nodeType==3)){e=m,i[p]=null;break}}if(e==null){if(w==null)return document.createTextNode(T);e=document.createElementNS(n,w,T.is&&T),l&&(X.__m&&X.__m(r,i),l=!1),i=null}if(w==null)_===T||l&&e.data==T||(e.data=T);else{if(i=i&&xs.call(e.childNodes),!l&&i!=null)for(_={},p=0;p<e.attributes.length;p++)_[(m=e.attributes[p]).name]=m.value;for(p in _)m=_[p],p=="dangerouslySetInnerHTML"?d=m:p=="children"||p in T||p=="value"&&"defaultValue"in T||p=="checked"&&"defaultChecked"in T||ms(e,p,null,m,n);for(p in T)m=T[p],p=="children"?y=m:p=="dangerouslySetInnerHTML"?h=m:p=="value"?g=m:p=="checked"?v=m:l&&typeof m!="function"||_[p]===m||ms(e,p,m,_[p],n);if(h)l||d&&(h.__html==d.__html||h.__html==e.innerHTML)||(e.innerHTML=h.__html),r.__k=[];else if(d&&(e.innerHTML=""),pn(r.type=="template"?e.content:e,_s(y)?y:[y],r,s,o,w=="foreignObject"?"http://www.w3.org/1999/xhtml":n,i,a,i?i[0]:s.__k&&or(s,0),l,f),i!=null)for(p=i.length;p--;)Ys(i[p]);l||(p="value",w=="progress"&&g==null?e.removeAttribute("value"):g!=null&&(g!==e[p]||w=="progress"&&!g||w=="option"&&g!=_[p])&&ms(e,p,g,_[p],n),p="checked",v!=null&&v!=e[p]&&ms(e,p,v,_[p],n))}return e}function to(e,r,s){try{if(typeof e=="function"){var o=typeof e.__u=="function";o&&e.__u(),o&&r==null||(e.__u=e(r))}else e.current=r}catch(n){X.__e(n,s)}}function hn(e,r,s){var o,n;if(X.unmount&&X.unmount(e),(o=e.ref)&&(o.current&&o.current!=e.__e||to(o,null,r)),(o=e.__c)!=null){if(o.componentWillUnmount)try{o.componentWillUnmount()}catch(i){X.__e(i,r)}o.base=o.__P=null}if(o=e.__k)for(n=0;n<o.length;n++)o[n]&&hn(o[n],r,s||typeof e.type!="function");s||Ys(e.__e),e.__c=e.__=e.__e=void 0}function za(e,r,s){return this.constructor(e,s)}function Lr(e,r,s){var o,n,i,a;r==document&&(r=document.documentElement),X.__&&X.__(e,r),n=(o=typeof s=="function")?null:s&&s.__k||r.__k,i=[],a=[],eo(r,e=(!o&&s||r).__k=Ha(P,null,[e]),n||gs,gs,r.namespaceURI,!o&&s?[s]:n?null:r.firstChild?xs.call(r.childNodes):null,i,!o&&s?s:n?n.__e:r.firstChild,o,a),fn(i,e,a)}function nr(e){function r(s){var o,n;return this.getChildContext||(o=new Set,(n={})[r.__c]=this,this.getChildContext=function(){return n},this.componentWillUnmount=function(){o=null},this.shouldComponentUpdate=function(i){this.props.value!=i.value&&o.forEach(function(a){a.__e=!0,Ws(a)})},this.sub=function(i){o.add(i);var a=i.componentWillUnmount;i.componentWillUnmount=function(){o&&o.delete(i),a&&a.call(i)}}),s.children}return r.__c="__cC"+un++,r.__=e,r.Provider=r.__l=(r.Consumer=function(s,o){return s.children(o)}).contextType=r,r}xs=vs.slice,X={__e:function(e,r,s,o){for(var n,i,a;r=r.__;)if((n=r.__c)&&!n.__)try{if((i=n.constructor)&&i.getDerivedStateFromError!=null&&(n.setState(i.getDerivedStateFromError(e)),a=n.__d),n.componentDidCatch!=null&&(n.componentDidCatch(e,o||{}),a=n.__d),a)return n.__E=n}catch(l){e=l}throw e}},on=0,Ia=function(e){return e!=null&&e.constructor===void 0},ys.prototype.setState=function(e,r){var s;s=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=ut({},this.state),typeof e=="function"&&(e=e(ut({},s),this.props)),e&&ut(s,e),e!=null&&this.__v&&(r&&this._sb.push(r),Ws(this))},ys.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),Ws(this))},ys.prototype.render=P,vt=[],nn=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,an=function(e,r){return e.__v.__b-r.__v.__b},bs.__r=0,ln=/(PointerCapture)$|Capture$/i,Xs=0,Js=sn(!1),zs=sn(!0),un=0;var Qe=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}};var Kt,bt,ir,yn,Wa=(yn=class extends Qe{constructor(){super();k(this,Kt);k(this,bt);k(this,ir);E(this,ir,r=>{if(typeof window<"u"&&window.addEventListener){let s=()=>r();return window.addEventListener("visibilitychange",s,!1),()=>{window.removeEventListener("visibilitychange",s)}}})}onSubscribe(){c(this,bt)||this.setEventListener(c(this,ir))}onUnsubscribe(){var r;this.hasListeners()||((r=c(this,bt))==null||r.call(this),E(this,bt,void 0))}setEventListener(r){var s;E(this,ir,r),(s=c(this,bt))==null||s.call(this),E(this,bt,r(o=>{typeof o=="boolean"?this.setFocused(o):this.onFocus()}))}setFocused(r){c(this,Kt)!==r&&(E(this,Kt,r),this.onFocus())}onFocus(){let r=this.isFocused();this.listeners.forEach(s=>{s(r)})}isFocused(){return typeof c(this,Kt)=="boolean"?c(this,Kt):globalThis.document?.visibilityState!=="hidden"}},Kt=new WeakMap,bt=new WeakMap,ir=new WeakMap,yn),ar=new Wa;var Za={setTimeout:(e,r)=>setTimeout(e,r),clearTimeout:e=>clearTimeout(e),setInterval:(e,r)=>setInterval(e,r),clearInterval:e=>clearInterval(e)},xt,ro,gn,Xa=(gn=class{constructor(){k(this,xt,Za);k(this,ro,!1)}setTimeoutProvider(e){E(this,xt,e)}setTimeout(e,r){return c(this,xt).setTimeout(e,r)}clearTimeout(e){c(this,xt).clearTimeout(e)}setInterval(e,r){return c(this,xt).setInterval(e,r)}clearInterval(e){c(this,xt).clearInterval(e)}},xt=new WeakMap,ro=new WeakMap,gn),ze=new Xa;function vn(e){setTimeout(e,0)}var oo=typeof window>"u"||"Deno"in globalThis;function ne(){}function _n(e,r){return typeof e=="function"?e(r):e}function Kr(e){return typeof e=="number"&&e>=0&&e!==1/0}function Ts(e,r){return Math.max(e+(r||0)-Date.now(),0)}function He(e,r){return typeof e=="function"?e(r):e}function Ee(e,r){return typeof e=="function"?e(r):e}function ws(e,r){let{type:s="all",exact:o,fetchStatus:n,predicate:i,queryKey:a,stale:l}=e;if(a){if(o){if(r.queryHash!==Ur(a,r.options))return!1}else if(!Ut(r.queryKey,a))return!1}if(s!=="all"){let f=r.isActive();if(s==="active"&&!f||s==="inactive"&&f)return!1}return!(typeof l=="boolean"&&r.isStale()!==l||n&&n!==r.state.fetchStatus||i&&!i(r))}function Es(e,r){let{exact:s,status:o,predicate:n,mutationKey:i}=e;if(i){if(!r.options.mutationKey)return!1;if(s){if(We(r.options.mutationKey)!==We(i))return!1}else if(!Ut(r.options.mutationKey,i))return!1}return!(o&&r.state.status!==o||n&&!n(r))}function Ur(e,r){return(r?.queryKeyHashFn||We)(e)}function We(e){return JSON.stringify(e,(r,s)=>so(s)?Object.keys(s).sort().reduce((o,n)=>(o[n]=s[n],o),{}):s)}function Ut(e,r){return e===r?!0:typeof e!=typeof r?!1:e&&r&&typeof e=="object"&&typeof r=="object"?Object.keys(r).every(s=>Ut(e[s],r[s])):!1}var Ya=Object.prototype.hasOwnProperty;function no(e,r,s=0){if(e===r)return e;if(s>500)return r;let o=bn(e)&&bn(r);if(!o&&!(so(e)&&so(r)))return r;let i=(o?e:Object.keys(e)).length,a=o?r:Object.keys(r),l=a.length,f=o?new Array(l):{},p=0;for(let h=0;h<l;h++){let d=o?h:a[h],y=e[d],m=r[d];if(y===m){f[d]=y,(o?h<i:Ya.call(e,d))&&p++;continue}if(y===null||m===null||typeof y!="object"||typeof m!="object"){f[d]=m;continue}let g=no(y,m,s+1);f[d]=g,g===y&&p++}return i===l&&p===i?e:f}function lr(e,r){if(!r||Object.keys(e).length!==Object.keys(r).length)return!1;for(let s in e)if(e[s]!==r[s])return!1;return!0}function bn(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function so(e){if(!xn(e))return!1;let r=e.constructor;if(r===void 0)return!0;let s=r.prototype;return!(!xn(s)||!s.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function xn(e){return Object.prototype.toString.call(e)==="[object Object]"}function Tn(e){return new Promise(r=>{ze.setTimeout(r,e)})}function Nr(e,r,s){return typeof s.structuralSharing=="function"?s.structuralSharing(e,r):s.structuralSharing!==!1?no(e,r):r}function wn(e,r,s=0){let o=[...e,r];return s&&o.length>s?o.slice(1):o}function En(e,r,s=0){let o=[r,...e];return s&&o.length>s?o.slice(0,-1):o}var ur=Symbol();function Cs(e,r){return!e.queryFn&&r?.initialPromise?()=>r.initialPromise:!e.queryFn||e.queryFn===ur?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function jr(e,r){return typeof e=="function"?e(...r):!!e}function Cn(e,r,s){let o=!1,n;return Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(n??(n=r()),o||(o=!0,n.aborted?s():n.addEventListener("abort",s,{once:!0})),n)}),e}var Ze=(()=>{let e=()=>oo;return{isServer(){return e()},setIsServer(r){e=r}}})();function Ir(){let e,r,s=new Promise((n,i)=>{e=n,r=i});s.status="pending",s.catch(()=>{});function o(n){Object.assign(s,n),delete s.resolve,delete s.reject}return s.resolve=n=>{o({status:"fulfilled",value:n}),e(n)},s.reject=n=>{o({status:"rejected",reason:n}),r(n)},s}var Rn=vn;function el(){let e=[],r=0,s=l=>{l()},o=l=>{l()},n=Rn,i=l=>{r?e.push(l):n(()=>{s(l)})},a=()=>{let l=e;e=[],l.length&&n(()=>{o(()=>{l.forEach(f=>{s(f)})})})};return{batch:l=>{let f;r++;try{f=l()}finally{r--,r||a()}return f},batchCalls:l=>(...f)=>{i(()=>{l(...f)})},schedule:i,setNotifyFunction:l=>{s=l},setBatchNotifyFunction:l=>{o=l},setScheduler:l=>{n=l}}}var Y=el();var cr,_t,pr,kn,tl=(kn=class extends Qe{constructor(){super();k(this,cr,!0);k(this,_t);k(this,pr);E(this,pr,r=>{if(typeof window<"u"&&window.addEventListener){let s=()=>r(!0),o=()=>r(!1);return window.addEventListener("online",s,!1),window.addEventListener("offline",o,!1),()=>{window.removeEventListener("online",s),window.removeEventListener("offline",o)}}})}onSubscribe(){c(this,_t)||this.setEventListener(c(this,pr))}onUnsubscribe(){var r;this.hasListeners()||((r=c(this,_t))==null||r.call(this),E(this,_t,void 0))}setEventListener(r){var s;E(this,pr,r),(s=c(this,_t))==null||s.call(this),E(this,_t,r(this.setOnline.bind(this)))}setOnline(r){c(this,cr)!==r&&(E(this,cr,r),this.listeners.forEach(o=>{o(r)}))}isOnline(){return c(this,cr)}},cr=new WeakMap,_t=new WeakMap,pr=new WeakMap,kn),dr=new tl;function rl(e){return Math.min(1e3*2**e,3e4)}function io(e){return(e??"online")==="online"?dr.isOnline():!0}var Rs=class extends Error{constructor(e){super("CancelledError"),this.revert=e?.revert,this.silent=e?.silent}};function ks(e){let r=!1,s=0,o,n=Ir(),i=()=>n.status!=="pending",a=v=>{if(!i()){let _=new Rs(v);y(_),e.onCancel?.(_)}},l=()=>{r=!0},f=()=>{r=!1},p=()=>ar.isFocused()&&(e.networkMode==="always"||dr.isOnline())&&e.canRun(),h=()=>io(e.networkMode)&&e.canRun(),d=v=>{i()||(o?.(),n.resolve(v))},y=v=>{i()||(o?.(),n.reject(v))},m=()=>new Promise(v=>{o=_=>{(i()||p())&&v(_)},e.onPause?.()}).then(()=>{o=void 0,i()||e.onContinue?.()}),g=()=>{if(i())return;let v,_=s===0?e.initialPromise:void 0;try{v=_??e.fn()}catch(T){v=Promise.reject(T)}Promise.resolve(v).then(d).catch(T=>{if(i())return;let w=e.retry??(Ze.isServer()?0:3),S=e.retryDelay??rl,M=typeof S=="function"?S(s,T):S,K=w===!0||typeof w=="number"&&s<w||typeof w=="function"&&w(s,T);if(r||!K){y(T);return}s++,e.onFail?.(s,T),Tn(M).then(()=>p()?void 0:m()).then(()=>{r?y(T):g()})})};return{promise:n,status:()=>n.status,cancel:a,continue:()=>(o?.(),n),cancelRetry:l,continueRetry:f,canStart:h,start:()=>(h()?g():m().then(g),n)}}var Nt,Sn,Ss=(Sn=class{constructor(){k(this,Nt)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),Kr(this.gcTime)&&E(this,Nt,ze.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(Ze.isServer()?1/0:300*1e3))}clearGcTimeout(){c(this,Nt)!==void 0&&(ze.clearTimeout(c(this,Nt)),E(this,Nt,void 0))}},Nt=new WeakMap,Sn);function Pn(e){return{onFetch:(r,s)=>{let o=r.options,n=r.fetchOptions?.meta?.fetchMore?.direction,i=r.state.data?.pages||[],a=r.state.data?.pageParams||[],l={pages:[],pageParams:[]},f=0,p=async()=>{let h=!1,d=g=>{Cn(g,()=>r.signal,()=>h=!0)},y=Cs(r.options,r.fetchOptions),m=async(g,v,_)=>{if(h)return Promise.reject(r.signal.reason);if(v==null&&g.pages.length)return Promise.resolve(g);let w=(()=>{let I={client:r.client,queryKey:r.queryKey,pageParam:v,direction:_?"backward":"forward",meta:r.options.meta};return d(I),I})(),S=await y(w),{maxPages:M}=r.options,K=_?En:wn;return{pages:K(g.pages,S,M),pageParams:K(g.pageParams,v,M)}};if(n&&i.length){let g=n==="backward",v=g?An:ao,_={pages:i,pageParams:a},T=v(o,_);l=await m(_,T,g)}else{let g=e??i.length;do{let v=f===0?a[0]??o.initialPageParam:ao(o,l);if(f>0&&v==null)break;l=await m(l,v),f++}while(f<g)}return l};r.options.persister?r.fetchFn=()=>r.options.persister?.(p,{client:r.client,queryKey:r.queryKey,meta:r.options.meta,signal:r.signal},s):r.fetchFn=p}}}function ao(e,{pages:r,pageParams:s}){let o=r.length-1;return r.length>0?e.getNextPageParam(r[o],r,s[o],s):void 0}function An(e,{pages:r,pageParams:s}){return r.length>0?e.getPreviousPageParam?.(r[0],r,s[0],s):void 0}function Mn(e,r){return r?ao(e,r)!=null:!1}function Fn(e,r){return!r||!e.getPreviousPageParam?!1:An(e,r)!=null}var fr,jt,mr,Le,It,pe,Vr,Vt,Oe,Ln,ct,Dn,Qn=(Dn=class extends Ss{constructor(r){super();k(this,Oe);k(this,fr);k(this,jt);k(this,mr);k(this,Le);k(this,It);k(this,pe);k(this,Vr);k(this,Vt);E(this,Vt,!1),E(this,Vr,r.defaultOptions),this.setOptions(r.options),this.observers=[],E(this,It,r.client),E(this,Le,c(this,It).getQueryCache()),this.queryKey=r.queryKey,this.queryHash=r.queryHash,E(this,jt,qn(this.options)),this.state=r.state??c(this,jt),this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return c(this,fr)}get promise(){return c(this,pe)?.promise}setOptions(r){if(this.options={...c(this,Vr),...r},r?._type&&E(this,fr,r._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){let s=qn(this.options);s.data!==void 0&&(this.setState(On(s.data,s.dataUpdatedAt)),E(this,jt,s))}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&c(this,Le).remove(this)}setData(r,s){let o=Nr(this.state.data,r,this.options);return L(this,Oe,ct).call(this,{data:o,type:"success",dataUpdatedAt:s?.updatedAt,manual:s?.manual}),o}setState(r){L(this,Oe,ct).call(this,{type:"setState",state:r})}cancel(r){let s=c(this,pe)?.promise;return c(this,pe)?.cancel(r),s?s.then(ne).catch(ne):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return c(this,jt)}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(r=>Ee(r.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===ur||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0?this.observers.some(r=>He(r.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(r=>r.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(r=0){return this.state.data===void 0?!0:r==="static"?!1:this.state.isInvalidated?!0:!Ts(this.state.dataUpdatedAt,r)}onFocus(){this.observers.find(s=>s.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),c(this,pe)?.continue()}onOnline(){this.observers.find(s=>s.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),c(this,pe)?.continue()}addObserver(r){this.observers.includes(r)||(this.observers.push(r),this.clearGcTimeout(),c(this,Le).notify({type:"observerAdded",query:this,observer:r}))}removeObserver(r){this.observers.includes(r)&&(this.observers=this.observers.filter(s=>s!==r),this.observers.length||(c(this,pe)&&(c(this,Vt)||L(this,Oe,Ln).call(this)?c(this,pe).cancel({revert:!0}):c(this,pe).cancelRetry()),this.scheduleGc()),c(this,Le).notify({type:"observerRemoved",query:this,observer:r}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||L(this,Oe,ct).call(this,{type:"invalidate"})}async fetch(r,s){if(this.state.fetchStatus!=="idle"&&c(this,pe)?.status()!=="rejected"){if(this.state.data!==void 0&&s?.cancelRefetch)this.cancel({silent:!0});else if(c(this,pe))return c(this,pe).continueRetry(),c(this,pe).promise}if(r&&this.setOptions(r),!this.options.queryFn){let p=this.observers.find(h=>h.options.queryFn);p&&this.setOptions(p.options)}let o=new AbortController,n=p=>{Object.defineProperty(p,"signal",{enumerable:!0,get:()=>(E(this,Vt,!0),o.signal)})},i=()=>{let p=Cs(this.options,s),d=(()=>{let y={client:c(this,It),queryKey:this.queryKey,meta:this.meta};return n(y),y})();return E(this,Vt,!1),this.options.persister?this.options.persister(p,d,this):p(d)},l=(()=>{let p={fetchOptions:s,options:this.options,queryKey:this.queryKey,client:c(this,It),state:this.state,fetchFn:i};return n(p),p})();(c(this,fr)==="infinite"?Pn(this.options.pages):this.options.behavior)?.onFetch(l,this),E(this,mr,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==l.fetchOptions?.meta)&&L(this,Oe,ct).call(this,{type:"fetch",meta:l.fetchOptions?.meta}),E(this,pe,ks({initialPromise:s?.initialPromise,fn:l.fetchFn,onCancel:p=>{p instanceof Rs&&p.revert&&this.setState({...c(this,mr),fetchStatus:"idle"}),o.abort()},onFail:(p,h)=>{L(this,Oe,ct).call(this,{type:"failed",failureCount:p,error:h})},onPause:()=>{L(this,Oe,ct).call(this,{type:"pause"})},onContinue:()=>{L(this,Oe,ct).call(this,{type:"continue"})},retry:l.options.retry,retryDelay:l.options.retryDelay,networkMode:l.options.networkMode,canRun:()=>!0}));try{let p=await c(this,pe).start();if(p===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(p),c(this,Le).config.onSuccess?.(p,this),c(this,Le).config.onSettled?.(p,this.state.error,this),p}catch(p){if(p instanceof Rs){if(p.silent)return c(this,pe).promise;if(p.revert){if(this.state.data===void 0)throw p;return this.state.data}}throw L(this,Oe,ct).call(this,{type:"error",error:p}),c(this,Le).config.onError?.(p,this),c(this,Le).config.onSettled?.(this.state.data,p,this),p}finally{this.scheduleGc()}}},fr=new WeakMap,jt=new WeakMap,mr=new WeakMap,Le=new WeakMap,It=new WeakMap,pe=new WeakMap,Vr=new WeakMap,Vt=new WeakMap,Oe=new WeakSet,Ln=function(){return this.state.fetchStatus==="paused"&&this.state.status==="pending"},ct=function(r){let s=o=>{switch(r.type){case"failed":return{...o,fetchFailureCount:r.failureCount,fetchFailureReason:r.error};case"pause":return{...o,fetchStatus:"paused"};case"continue":return{...o,fetchStatus:"fetching"};case"fetch":return{...o,...lo(o.data,this.options),fetchMeta:r.meta??null};case"success":let n={...o,...On(r.data,r.dataUpdatedAt),dataUpdateCount:o.dataUpdateCount+1,...!r.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return E(this,mr,r.manual?n:void 0),n;case"error":let i=r.error;return{...o,error:i,errorUpdateCount:o.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:o.fetchFailureCount+1,fetchFailureReason:i,fetchStatus:"idle",status:"error",isInvalidated:!0};case"invalidate":return{...o,isInvalidated:!0};case"setState":return{...o,...r.state}}};this.state=s(this.state),Y.batch(()=>{this.observers.forEach(o=>{o.onQueryUpdate()}),c(this,Le).notify({query:this,type:"updated",action:r})})},Dn);function lo(e,r){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:io(r.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function On(e,r){return{data:e,dataUpdatedAt:r??Date.now(),error:null,isInvalidated:!1,status:"success"}}function qn(e){let r=typeof e.initialData=="function"?e.initialData():e.initialData,s=r!==void 0,o=s?typeof e.initialDataUpdatedAt=="function"?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:r,dataUpdateCount:0,dataUpdatedAt:s?o??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:s?"success":"pending",fetchStatus:"idle"}}var ke,G,$r,Ce,Ht,hr,pt,Tt,Gr,yr,gr,$t,Gt,wt,vr,W,Hr,uo,co,po,fo,mo,ho,yo,jn,Nn,Br=(Nn=class extends Qe{constructor(r,s){super();k(this,W);k(this,ke);k(this,G);k(this,$r);k(this,Ce);k(this,Ht);k(this,hr);k(this,pt);k(this,Tt);k(this,Gr);k(this,yr);k(this,gr);k(this,$t);k(this,Gt);k(this,wt);k(this,vr,new Set);this.options=s,E(this,ke,r),E(this,Tt,null),E(this,pt,Ir()),this.bindMethods(),this.setOptions(s)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(c(this,G).addObserver(this),Kn(c(this,G),this.options)?L(this,W,Hr).call(this):this.updateResult(),L(this,W,fo).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return go(c(this,G),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return go(c(this,G),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,L(this,W,mo).call(this),L(this,W,ho).call(this),c(this,G).removeObserver(this)}setOptions(r){let s=this.options,o=c(this,G);if(this.options=c(this,ke).defaultQueryOptions(r),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof Ee(this.options.enabled,c(this,G))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");L(this,W,yo).call(this),c(this,G).setOptions(this.options),s._defaulted&&!lr(this.options,s)&&c(this,ke).getQueryCache().notify({type:"observerOptionsUpdated",query:c(this,G),observer:this});let n=this.hasListeners();n&&Un(c(this,G),o,this.options,s)&&L(this,W,Hr).call(this),this.updateResult(),n&&(c(this,G)!==o||Ee(this.options.enabled,c(this,G))!==Ee(s.enabled,c(this,G))||He(this.options.staleTime,c(this,G))!==He(s.staleTime,c(this,G)))&&L(this,W,uo).call(this);let i=L(this,W,co).call(this);n&&(c(this,G)!==o||Ee(this.options.enabled,c(this,G))!==Ee(s.enabled,c(this,G))||i!==c(this,wt))&&L(this,W,po).call(this,i)}getOptimisticResult(r){let s=c(this,ke).getQueryCache().build(c(this,ke),r),o=this.createResult(s,r);return ol(this,o)&&(E(this,Ce,o),E(this,hr,this.options),E(this,Ht,c(this,G).state)),o}getCurrentResult(){return c(this,Ce)}trackResult(r,s){return new Proxy(r,{get:(o,n)=>(this.trackProp(n),s?.(n),n==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&c(this,pt).status==="pending"&&c(this,pt).reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(o,n))})}trackProp(r){c(this,vr).add(r)}getCurrentQuery(){return c(this,G)}refetch({...r}={}){return this.fetch({...r})}fetchOptimistic(r){let s=c(this,ke).defaultQueryOptions(r),o=c(this,ke).getQueryCache().build(c(this,ke),s);return o.fetch().then(()=>this.createResult(o,s))}fetch(r){return L(this,W,Hr).call(this,{...r,cancelRefetch:r.cancelRefetch??!0}).then(()=>(this.updateResult(),c(this,Ce)))}createResult(r,s){let o=c(this,G),n=this.options,i=c(this,Ce),a=c(this,Ht),l=c(this,hr),p=r!==o?r.state:c(this,$r),{state:h}=r,d={...h},y=!1,m;if(s._optimisticResults){let D=this.hasListeners(),O=!D&&Kn(r,s),U=D&&Un(r,o,s,n);(O||U)&&(d={...d,...lo(h.data,r.options)}),s._optimisticResults==="isRestoring"&&(d.fetchStatus="idle")}let{error:g,errorUpdatedAt:v,status:_}=d;m=d.data;let T=!1;if(s.placeholderData!==void 0&&m===void 0&&_==="pending"){let D;i?.isPlaceholderData&&s.placeholderData===l?.placeholderData?(D=i.data,T=!0):D=typeof s.placeholderData=="function"?s.placeholderData(c(this,gr)?.state.data,c(this,gr)):s.placeholderData,D!==void 0&&(_="success",m=Nr(i?.data,D,s),y=!0)}if(s.select&&m!==void 0&&!T)if(i&&m===a?.data&&s.select===c(this,Gr))m=c(this,yr);else try{E(this,Gr,s.select),m=s.select(m),m=Nr(i?.data,m,s),E(this,yr,m),E(this,Tt,null)}catch(D){E(this,Tt,D)}c(this,Tt)&&(g=c(this,Tt),m=c(this,yr),v=Date.now(),_="error");let w=d.fetchStatus==="fetching",S=_==="pending",M=_==="error",K=S&&w,I=m!==void 0,N={status:_,fetchStatus:d.fetchStatus,isPending:S,isSuccess:_==="success",isError:M,isInitialLoading:K,isLoading:K,data:m,dataUpdatedAt:d.dataUpdatedAt,error:g,errorUpdatedAt:v,failureCount:d.fetchFailureCount,failureReason:d.fetchFailureReason,errorUpdateCount:d.errorUpdateCount,isFetched:r.isFetched(),isFetchedAfterMount:d.dataUpdateCount>p.dataUpdateCount||d.errorUpdateCount>p.errorUpdateCount,isFetching:w,isRefetching:w&&!S,isLoadingError:M&&!I,isPaused:d.fetchStatus==="paused",isPlaceholderData:y,isRefetchError:M&&I,isStale:vo(r,s),refetch:this.refetch,promise:c(this,pt),isEnabled:Ee(s.enabled,r)!==!1};if(this.options.experimental_prefetchInRender){let D=N.data!==void 0,O=N.status==="error"&&!D,U=le=>{O?le.reject(N.error):D&&le.resolve(N.data)},z=()=>{let le=E(this,pt,N.promise=Ir());U(le)},H=c(this,pt);switch(H.status){case"pending":r.queryHash===o.queryHash&&U(H);break;case"fulfilled":(O||N.data!==H.value)&&z();break;case"rejected":(!O||N.error!==H.reason)&&z();break}}return N}updateResult(){let r=c(this,Ce),s=this.createResult(c(this,G),this.options);if(E(this,Ht,c(this,G).state),E(this,hr,this.options),c(this,Ht).data!==void 0&&E(this,gr,c(this,G)),lr(s,r))return;E(this,Ce,s);let o=()=>{if(!r)return!0;let{notifyOnChangeProps:n}=this.options,i=typeof n=="function"?n():n;if(i==="all"||!i&&!c(this,vr).size)return!0;let a=new Set(i??c(this,vr));return this.options.throwOnError&&a.add("error"),Object.keys(c(this,Ce)).some(l=>{let f=l;return c(this,Ce)[f]!==r[f]&&a.has(f)})};L(this,W,jn).call(this,{listeners:o()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&L(this,W,fo).call(this)}},ke=new WeakMap,G=new WeakMap,$r=new WeakMap,Ce=new WeakMap,Ht=new WeakMap,hr=new WeakMap,pt=new WeakMap,Tt=new WeakMap,Gr=new WeakMap,yr=new WeakMap,gr=new WeakMap,$t=new WeakMap,Gt=new WeakMap,wt=new WeakMap,vr=new WeakMap,W=new WeakSet,Hr=function(r){L(this,W,yo).call(this);let s=c(this,G).fetch(this.options,r);return r?.throwOnError||(s=s.catch(ne)),s},uo=function(){L(this,W,mo).call(this);let r=He(this.options.staleTime,c(this,G));if(Ze.isServer()||c(this,Ce).isStale||!Kr(r))return;let o=Ts(c(this,Ce).dataUpdatedAt,r)+1;E(this,$t,ze.setTimeout(()=>{c(this,Ce).isStale||this.updateResult()},o))},co=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(c(this,G)):this.options.refetchInterval)??!1},po=function(r){L(this,W,ho).call(this),E(this,wt,r),!(Ze.isServer()||Ee(this.options.enabled,c(this,G))===!1||!Kr(c(this,wt))||c(this,wt)===0)&&E(this,Gt,ze.setInterval(()=>{(this.options.refetchIntervalInBackground||ar.isFocused())&&L(this,W,Hr).call(this)},c(this,wt)))},fo=function(){L(this,W,uo).call(this),L(this,W,po).call(this,L(this,W,co).call(this))},mo=function(){c(this,$t)!==void 0&&(ze.clearTimeout(c(this,$t)),E(this,$t,void 0))},ho=function(){c(this,Gt)!==void 0&&(ze.clearInterval(c(this,Gt)),E(this,Gt,void 0))},yo=function(){let r=c(this,ke).getQueryCache().build(c(this,ke),this.options);if(r===c(this,G))return;let s=c(this,G);E(this,G,r),E(this,$r,r.state),this.hasListeners()&&(s?.removeObserver(this),r.addObserver(this))},jn=function(r){Y.batch(()=>{r.listeners&&this.listeners.forEach(s=>{s(c(this,Ce))}),c(this,ke).getQueryCache().notify({query:c(this,G),type:"observerResultsUpdated"})})},Nn);function sl(e,r){return Ee(r.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&Ee(r.retryOnMount,e)===!1)}function Kn(e,r){return sl(e,r)||e.state.data!==void 0&&go(e,r,r.refetchOnMount)}function go(e,r,s){if(Ee(r.enabled,e)!==!1&&He(r.staleTime,e)!=="static"){let o=typeof s=="function"?s(e):s;return o==="always"||o!==!1&&vo(e,r)}return!1}function Un(e,r,s,o){return(e!==r||Ee(o.enabled,e)===!1)&&(!s.suspense||e.state.status!=="error")&&vo(e,s)}function vo(e,r){return Ee(r.enabled,e)!==!1&&e.isStaleByTime(He(r.staleTime,e))}function ol(e,r){return!lr(e.getCurrentResult(),r)}var bo=class extends Br{constructor(e,r){super(e,r)}bindMethods(){super.bindMethods(),this.fetchNextPage=this.fetchNextPage.bind(this),this.fetchPreviousPage=this.fetchPreviousPage.bind(this)}setOptions(e){e._type="infinite",super.setOptions(e)}getOptimisticResult(e){return e._type="infinite",super.getOptimisticResult(e)}fetchNextPage(e){return this.fetch({...e,meta:{fetchMore:{direction:"forward"}}})}fetchPreviousPage(e){return this.fetch({...e,meta:{fetchMore:{direction:"backward"}}})}createResult(e,r){let{state:s}=e,o=super.createResult(e,r),{isFetching:n,isRefetching:i,isError:a,isRefetchError:l}=o,f=s.fetchMeta?.fetchMore?.direction,p=a&&f==="forward",h=n&&f==="forward",d=a&&f==="backward",y=n&&f==="backward";return{...o,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:Mn(r,s.data),hasPreviousPage:Fn(r,s.data),isFetchNextPageError:p,isFetchingNextPage:h,isFetchPreviousPageError:d,isFetchingPreviousPage:y,isRefetchError:l&&!p&&!d,isRefetching:i&&!h&&!y}}};var Jr,Xe,be,Bt,Ye,Et,In,Vn=(In=class extends Ss{constructor(r){super();k(this,Ye);k(this,Jr);k(this,Xe);k(this,be);k(this,Bt);E(this,Jr,r.client),this.mutationId=r.mutationId,E(this,be,r.mutationCache),E(this,Xe,[]),this.state=r.state||xo(),this.setOptions(r.options),this.scheduleGc()}setOptions(r){this.options=r,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(r){c(this,Xe).includes(r)||(c(this,Xe).push(r),this.clearGcTimeout(),c(this,be).notify({type:"observerAdded",mutation:this,observer:r}))}removeObserver(r){E(this,Xe,c(this,Xe).filter(s=>s!==r)),this.scheduleGc(),c(this,be).notify({type:"observerRemoved",mutation:this,observer:r})}optionalRemove(){c(this,Xe).length||(this.state.status==="pending"?this.scheduleGc():c(this,be).remove(this))}continue(){return c(this,Bt)?.continue()??this.execute(this.state.variables)}async execute(r){let s=()=>{L(this,Ye,Et).call(this,{type:"continue"})},o={client:c(this,Jr),meta:this.options.meta,mutationKey:this.options.mutationKey};E(this,Bt,ks({fn:()=>this.options.mutationFn?this.options.mutationFn(r,o):Promise.reject(new Error("No mutationFn found")),onFail:(a,l)=>{L(this,Ye,Et).call(this,{type:"failed",failureCount:a,error:l})},onPause:()=>{L(this,Ye,Et).call(this,{type:"pause"})},onContinue:s,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>c(this,be).canRun(this)}));let n=this.state.status==="pending",i=!c(this,Bt).canStart();try{if(n)s();else{L(this,Ye,Et).call(this,{type:"pending",variables:r,isPaused:i}),c(this,be).config.onMutate&&await c(this,be).config.onMutate(r,this,o);let l=await this.options.onMutate?.(r,o);l!==this.state.context&&L(this,Ye,Et).call(this,{type:"pending",context:l,variables:r,isPaused:i})}let a=await c(this,Bt).start();return await c(this,be).config.onSuccess?.(a,r,this.state.context,this,o),await this.options.onSuccess?.(a,r,this.state.context,o),await c(this,be).config.onSettled?.(a,null,this.state.variables,this.state.context,this,o),await this.options.onSettled?.(a,null,r,this.state.context,o),L(this,Ye,Et).call(this,{type:"success",data:a}),a}catch(a){try{await c(this,be).config.onError?.(a,r,this.state.context,this,o)}catch(l){Promise.reject(l)}try{await this.options.onError?.(a,r,this.state.context,o)}catch(l){Promise.reject(l)}try{await c(this,be).config.onSettled?.(void 0,a,this.state.variables,this.state.context,this,o)}catch(l){Promise.reject(l)}try{await this.options.onSettled?.(void 0,a,r,this.state.context,o)}catch(l){Promise.reject(l)}throw L(this,Ye,Et).call(this,{type:"error",error:a}),a}finally{c(this,be).runNext(this)}}},Jr=new WeakMap,Xe=new WeakMap,be=new WeakMap,Bt=new WeakMap,Ye=new WeakSet,Et=function(r){let s=o=>{switch(r.type){case"failed":return{...o,failureCount:r.failureCount,failureReason:r.error};case"pause":return{...o,isPaused:!0};case"continue":return{...o,isPaused:!1};case"pending":return{...o,context:r.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:r.isPaused,status:"pending",variables:r.variables,submittedAt:Date.now()};case"success":return{...o,data:r.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...o,data:void 0,error:r.error,failureCount:o.failureCount+1,failureReason:r.error,isPaused:!1,status:"error"}}};this.state=s(this.state),Y.batch(()=>{c(this,Xe).forEach(o=>{o.onMutationUpdate(r)}),c(this,be).notify({mutation:this,type:"updated",action:r})})},In);function xo(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var dt,$e,zr,Hn,$n=(Hn=class extends Qe{constructor(r={}){super();k(this,dt);k(this,$e);k(this,zr);this.config=r,E(this,dt,new Set),E(this,$e,new Map),E(this,zr,0)}build(r,s,o){let n=new Vn({client:r,mutationCache:this,mutationId:++Qr(this,zr)._,options:r.defaultMutationOptions(s),state:o});return this.add(n),n}add(r){c(this,dt).add(r);let s=Ps(r);if(typeof s=="string"){let o=c(this,$e).get(s);o?o.push(r):c(this,$e).set(s,[r])}this.notify({type:"added",mutation:r})}remove(r){if(c(this,dt).delete(r)){let s=Ps(r);if(typeof s=="string"){let o=c(this,$e).get(s);if(o)if(o.length>1){let n=o.indexOf(r);n!==-1&&o.splice(n,1)}else o[0]===r&&c(this,$e).delete(s)}}this.notify({type:"removed",mutation:r})}canRun(r){let s=Ps(r);if(typeof s=="string"){let n=c(this,$e).get(s)?.find(i=>i.state.status==="pending");return!n||n===r}else return!0}runNext(r){let s=Ps(r);return typeof s=="string"?c(this,$e).get(s)?.find(n=>n!==r&&n.state.isPaused)?.continue()??Promise.resolve():Promise.resolve()}clear(){Y.batch(()=>{c(this,dt).forEach(r=>{this.notify({type:"removed",mutation:r})}),c(this,dt).clear(),c(this,$e).clear()})}getAll(){return Array.from(c(this,dt))}find(r){let s={exact:!0,...r};return this.getAll().find(o=>Es(s,o))}findAll(r={}){return this.getAll().filter(s=>Es(r,s))}notify(r){Y.batch(()=>{this.listeners.forEach(s=>{s(r)})})}resumePausedMutations(){let r=this.getAll().filter(s=>s.state.isPaused);return Y.batch(()=>Promise.all(r.map(s=>s.continue().catch(ne))))}},dt=new WeakMap,$e=new WeakMap,zr=new WeakMap,Hn);function Ps(e){return e.options.scope?.id}var ft,Ct,Se,mt,ht,As,_o,Gn,To=(Gn=class extends Qe{constructor(r,s){super();k(this,ht);k(this,ft);k(this,Ct);k(this,Se);k(this,mt);E(this,ft,r),this.setOptions(s),this.bindMethods(),L(this,ht,As).call(this)}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(r){let s=this.options;this.options=c(this,ft).defaultMutationOptions(r),lr(this.options,s)||c(this,ft).getMutationCache().notify({type:"observerOptionsUpdated",mutation:c(this,Se),observer:this}),s?.mutationKey&&this.options.mutationKey&&We(s.mutationKey)!==We(this.options.mutationKey)?this.reset():c(this,Se)?.state.status==="pending"&&c(this,Se).setOptions(this.options)}onUnsubscribe(){this.hasListeners()||c(this,Se)?.removeObserver(this)}onMutationUpdate(r){L(this,ht,As).call(this),L(this,ht,_o).call(this,r)}getCurrentResult(){return c(this,Ct)}reset(){c(this,Se)?.removeObserver(this),E(this,Se,void 0),L(this,ht,As).call(this),L(this,ht,_o).call(this)}mutate(r,s){return E(this,mt,s),c(this,Se)?.removeObserver(this),E(this,Se,c(this,ft).getMutationCache().build(c(this,ft),this.options)),c(this,Se).addObserver(this),c(this,Se).execute(r)}},ft=new WeakMap,Ct=new WeakMap,Se=new WeakMap,mt=new WeakMap,ht=new WeakSet,As=function(){let r=c(this,Se)?.state??xo();E(this,Ct,{...r,isPending:r.status==="pending",isSuccess:r.status==="success",isError:r.status==="error",isIdle:r.status==="idle",mutate:this.mutate,reset:this.reset})},_o=function(r){Y.batch(()=>{if(c(this,mt)&&this.hasListeners()){let s=c(this,Ct).variables,o=c(this,Ct).context,n={client:c(this,ft),meta:this.options.meta,mutationKey:this.options.mutationKey};if(r?.type==="success"){try{c(this,mt).onSuccess?.(r.data,s,o,n)}catch(i){Promise.reject(i)}try{c(this,mt).onSettled?.(r.data,null,s,o,n)}catch(i){Promise.reject(i)}}else if(r?.type==="error"){try{c(this,mt).onError?.(r.error,s,o,n)}catch(i){Promise.reject(i)}try{c(this,mt).onSettled?.(void 0,r.error,s,o,n)}catch(i){Promise.reject(i)}}}this.listeners.forEach(s=>{s(c(this,Ct))})})},Gn);var et,Bn,Jn=(Bn=class extends Qe{constructor(r={}){super();k(this,et);this.config=r,E(this,et,new Map)}build(r,s,o){let n=s.queryKey,i=s.queryHash??Ur(n,s),a=this.get(i);return a||(a=new Qn({client:r,queryKey:n,queryHash:i,options:r.defaultQueryOptions(s),state:o,defaultOptions:r.getQueryDefaults(n)}),this.add(a)),a}add(r){c(this,et).has(r.queryHash)||(c(this,et).set(r.queryHash,r),this.notify({type:"added",query:r}))}remove(r){let s=c(this,et).get(r.queryHash);s&&(r.destroy(),s===r&&c(this,et).delete(r.queryHash),this.notify({type:"removed",query:r}))}clear(){Y.batch(()=>{this.getAll().forEach(r=>{this.remove(r)})})}get(r){return c(this,et).get(r)}getAll(){return[...c(this,et).values()]}find(r){let s={exact:!0,...r};return this.getAll().find(o=>ws(s,o))}findAll(r={}){let s=this.getAll();return Object.keys(r).length>0?s.filter(o=>ws(r,o)):s}notify(r){Y.batch(()=>{this.listeners.forEach(s=>{s(r)})})}onFocus(){Y.batch(()=>{this.getAll().forEach(r=>{r.onFocus()})})}onOnline(){Y.batch(()=>{this.getAll().forEach(r=>{r.onOnline()})})}},et=new WeakMap,Bn);var ie,Rt,kt,br,xr,St,_r,Tr,zn,wo=(zn=class{constructor(e={}){k(this,ie);k(this,Rt);k(this,kt);k(this,br);k(this,xr);k(this,St);k(this,_r);k(this,Tr);E(this,ie,e.queryCache||new Jn),E(this,Rt,e.mutationCache||new $n),E(this,kt,e.defaultOptions||{}),E(this,br,new Map),E(this,xr,new Map),E(this,St,0)}mount(){Qr(this,St)._++,c(this,St)===1&&(E(this,_r,ar.subscribe(async e=>{e&&(await this.resumePausedMutations(),c(this,ie).onFocus())})),E(this,Tr,dr.subscribe(async e=>{e&&(await this.resumePausedMutations(),c(this,ie).onOnline())})))}unmount(){var e,r;Qr(this,St)._--,c(this,St)===0&&((e=c(this,_r))==null||e.call(this),E(this,_r,void 0),(r=c(this,Tr))==null||r.call(this),E(this,Tr,void 0))}isFetching(e){return c(this,ie).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return c(this,Rt).findAll({...e,status:"pending"}).length}getQueryData(e){let r=this.defaultQueryOptions({queryKey:e});return c(this,ie).get(r.queryHash)?.state.data}ensureQueryData(e){let r=this.defaultQueryOptions(e),s=c(this,ie).build(this,r),o=s.state.data;return o===void 0?this.fetchQuery(e):(e.revalidateIfStale&&s.isStaleByTime(He(r.staleTime,s))&&this.prefetchQuery(r),Promise.resolve(o))}getQueriesData(e){return c(this,ie).findAll(e).map(({queryKey:r,state:s})=>{let o=s.data;return[r,o]})}setQueryData(e,r,s){let o=this.defaultQueryOptions({queryKey:e}),i=c(this,ie).get(o.queryHash)?.state.data,a=_n(r,i);if(a!==void 0)return c(this,ie).build(this,o).setData(a,{...s,manual:!0})}setQueriesData(e,r,s){return Y.batch(()=>c(this,ie).findAll(e).map(({queryKey:o})=>[o,this.setQueryData(o,r,s)]))}getQueryState(e){let r=this.defaultQueryOptions({queryKey:e});return c(this,ie).get(r.queryHash)?.state}removeQueries(e){let r=c(this,ie);Y.batch(()=>{r.findAll(e).forEach(s=>{r.remove(s)})})}resetQueries(e,r){let s=c(this,ie);return Y.batch(()=>(s.findAll(e).forEach(o=>{o.reset()}),this.refetchQueries({type:"active",...e},r)))}cancelQueries(e,r={}){let s={revert:!0,...r},o=Y.batch(()=>c(this,ie).findAll(e).map(n=>n.cancel(s)));return Promise.all(o).then(ne).catch(ne)}invalidateQueries(e,r={}){return Y.batch(()=>(c(this,ie).findAll(e).forEach(s=>{s.invalidate()}),e?.refetchType==="none"?Promise.resolve():this.refetchQueries({...e,type:e?.refetchType??e?.type??"active"},r)))}refetchQueries(e,r={}){let s={...r,cancelRefetch:r.cancelRefetch??!0},o=Y.batch(()=>c(this,ie).findAll(e).filter(n=>!n.isDisabled()&&!n.isStatic()).map(n=>{let i=n.fetch(void 0,s);return s.throwOnError||(i=i.catch(ne)),n.state.fetchStatus==="paused"?Promise.resolve():i}));return Promise.all(o).then(ne)}fetchQuery(e){let r=this.defaultQueryOptions(e);r.retry===void 0&&(r.retry=!1);let s=c(this,ie).build(this,r);return s.isStaleByTime(He(r.staleTime,s))?s.fetch(r):Promise.resolve(s.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(ne).catch(ne)}fetchInfiniteQuery(e){return e._type="infinite",this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(ne).catch(ne)}ensureInfiniteQueryData(e){return e._type="infinite",this.ensureQueryData(e)}resumePausedMutations(){return dr.isOnline()?c(this,Rt).resumePausedMutations():Promise.resolve()}getQueryCache(){return c(this,ie)}getMutationCache(){return c(this,Rt)}getDefaultOptions(){return c(this,kt)}setDefaultOptions(e){E(this,kt,e)}setQueryDefaults(e,r){c(this,br).set(We(e),{queryKey:e,defaultOptions:r})}getQueryDefaults(e){let r=[...c(this,br).values()],s={};return r.forEach(o=>{Ut(e,o.queryKey)&&Object.assign(s,o.defaultOptions)}),s}setMutationDefaults(e,r){c(this,xr).set(We(e),{mutationKey:e,defaultOptions:r})}getMutationDefaults(e){let r=[...c(this,xr).values()],s={};return r.forEach(o=>{Ut(e,o.mutationKey)&&Object.assign(s,o.defaultOptions)}),s}defaultQueryOptions(e){if(e._defaulted)return e;let r={...c(this,kt).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return r.queryHash||(r.queryHash=Ur(r.queryKey,r)),r.refetchOnReconnect===void 0&&(r.refetchOnReconnect=r.networkMode!=="always"),r.throwOnError===void 0&&(r.throwOnError=!!r.suspense),!r.networkMode&&r.persister&&(r.networkMode="offlineFirst"),r.queryFn===ur&&(r.enabled=!1),r}defaultMutationOptions(e){return e?._defaulted?e:{...c(this,kt).mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){c(this,ie).clear(),c(this,Rt).clear()}},ie=new WeakMap,Rt=new WeakMap,kt=new WeakMap,br=new WeakMap,xr=new WeakMap,St=new WeakMap,_r=new WeakMap,Tr=new WeakMap,zn);var Jt,re,Eo,Wn,Wr=0,oi=[],ae=X,Zn=ae.__b,Xn=ae.__r,Yn=ae.diffed,ei=ae.__c,ti=ae.unmount,ri=ae.__;function Zr(e,r){ae.__h&&ae.__h(re,e,Wr||r),Wr=0;var s=re.__H||(re.__H={__:[],__h:[]});return e>=s.__.length&&s.__.push({}),s.__[e]}function b(e){return Wr=1,nl(ii,e)}function nl(e,r,s){var o=Zr(Jt++,2);if(o.t=e,!o.__c&&(o.__=[s?s(r):ii(void 0,r),function(l){var f=o.__N?o.__N[0]:o.__[0],p=o.t(f,l);f!==p&&(o.__N=[p,o.__[1]],o.__c.setState({}))}],o.__c=re,!re.__f)){var n=function(l,f,p){if(!o.__c.__H)return!0;var h=o.__c.__H.__.filter(function(y){return y.__c});if(h.every(function(y){return!y.__N}))return!i||i.call(this,l,f,p);var d=o.__c.props!==l;return h.some(function(y){if(y.__N){var m=y.__[0];y.__=y.__N,y.__N=void 0,m!==y.__[0]&&(d=!0)}}),i&&i.call(this,l,f,p)||d};re.__f=!0;var i=re.shouldComponentUpdate,a=re.componentWillUpdate;re.componentWillUpdate=function(l,f,p){if(this.__e){var h=i;i=void 0,n(l,f,p),i=h}a&&a.call(this,l,f,p)},re.shouldComponentUpdate=n}return o.__N||o.__}function B(e,r){var s=Zr(Jt++,3);!ae.__s&&Ro(s.__H,r)&&(s.__=e,s.u=r,re.__H.__h.push(s))}function ni(e,r){var s=Zr(Jt++,4);!ae.__s&&Ro(s.__H,r)&&(s.__=e,s.u=r,re.__h.push(s))}function de(e){return Wr=5,zt(function(){return{current:e}},[])}function zt(e,r){var s=Zr(Jt++,7);return Ro(s.__H,r)&&(s.__=e(),s.__H=r,s.__h=e),s.__}function Wt(e,r){return Wr=8,zt(function(){return e},r)}function wr(e){var r=re.context[e.__c],s=Zr(Jt++,9);return s.c=e,r?(s.__==null&&(s.__=!0,r.sub(re)),r.props.value):e.__}function il(){for(var e;e=oi.shift();){var r=e.__H;if(e.__P&&r)try{r.__h.some(Ms),r.__h.some(Co),r.__h=[]}catch(s){r.__h=[],ae.__e(s,e.__v)}}}ae.__b=function(e){re=null,Zn&&Zn(e)},ae.__=function(e,r){e&&r.__k&&r.__k.__m&&(e.__m=r.__k.__m),ri&&ri(e,r)},ae.__r=function(e){Xn&&Xn(e),Jt=0;var r=(re=e.__c).__H;r&&(Eo===re?(r.__h=[],re.__h=[],r.__.some(function(s){s.__N&&(s.__=s.__N),s.u=s.__N=void 0})):(r.__h.some(Ms),r.__h.some(Co),r.__h=[],Jt=0)),Eo=re},ae.diffed=function(e){Yn&&Yn(e);var r=e.__c;r&&r.__H&&(r.__H.__h.length&&(oi.push(r)!==1&&Wn===ae.requestAnimationFrame||((Wn=ae.requestAnimationFrame)||al)(il)),r.__H.__.some(function(s){s.u&&(s.__H=s.u),s.u=void 0})),Eo=re=null},ae.__c=function(e,r){r.some(function(s){try{s.__h.some(Ms),s.__h=s.__h.filter(function(o){return!o.__||Co(o)})}catch(o){r.some(function(n){n.__h&&(n.__h=[])}),r=[],ae.__e(o,s.__v)}}),ei&&ei(e,r)},ae.unmount=function(e){ti&&ti(e);var r,s=e.__c;s&&s.__H&&(s.__H.__.some(function(o){try{Ms(o)}catch(n){r=n}}),s.__H=void 0,r&&ae.__e(r,s.__v))};var si=typeof requestAnimationFrame=="function";function al(e){var r,s=function(){clearTimeout(o),si&&cancelAnimationFrame(r),setTimeout(e)},o=setTimeout(s,35);si&&(r=requestAnimationFrame(s))}function Ms(e){var r=re,s=e.__c;typeof s=="function"&&(e.__c=void 0,s()),re=r}function Co(e){var r=re;e.__c=e.__(),re=r}function Ro(e,r){return!e||e.length!==r.length||r.some(function(s,o){return s!==e[o]})}function ii(e,r){return typeof r=="function"?r(e):r}var ai=nr(!1),li=()=>wr(ai),gd=ai.Provider;var ll=0;function t(e,r,s,o,n,i){r||(r={});var a,l,f=r;if("ref"in f)for(l in f={},r)l=="ref"?a=r[l]:f[l]=r[l];var p={type:e,props:f,key:s,ref:a,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--ll,__i:-1,__u:0,__source:n,__self:i};if(typeof e=="function"&&(a=e.defaultProps))for(l in a)f[l]===void 0&&(f[l]=a[l]);return X.vnode&&X.vnode(p),p}var ko=nr(void 0),Xr=e=>{let r=wr(ko);if(e)return e;if(!r)throw new Error("No QueryClient set, use QueryClientProvider to set one");return r},Er=({client:e,children:r})=>(B(()=>(e.mount(),()=>{e.unmount()}),[e]),t(ko.Provider,{value:e,children:r}));function ul(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var cl=nr(ul()),ui=()=>wr(cl);var ci=(e,r)=>{(e.suspense||e.throwOnError||e.experimental_prefetchInRender)&&(r.isReset()||(e.retryOnMount=!1))},pi=e=>{B(()=>{e.clearReset()},[e])},di=({result:e,errorResetBoundary:r,throwOnError:s,query:o,suspense:n})=>e.isError&&!r.isReset()&&!e.isFetching&&o&&(n&&e.data===void 0||jr(s,[e.error,o]));var fi=e=>{if(e.suspense){let s=n=>n==="static"?n:Math.max(n??1e3,1e3),o=e.staleTime;e.staleTime=typeof o=="function"?(...n)=>s(o(...n)):s(o),typeof e.gcTime=="number"&&(e.gcTime=Math.max(e.gcTime,1e3))}},mi=(e,r)=>e.isLoading&&e.isFetching&&!r,hi=(e,r)=>e?.suspense&&r.isPending,So=(e,r,s)=>r.fetchOptimistic(e).catch(()=>{s.clearReset()});function Fs(e,r){let s=r(),[{_instance:o},n]=b({_instance:{_value:s,_getSnapshot:r}});return ni(()=>{o._value=s,o._getSnapshot=r,Po(o)&&n({_instance:o})},[e,s,r]),B(()=>(Po(o)&&n({_instance:o}),e(()=>{Po(o)&&n({_instance:o})})),[e]),s}function Po(e){let r=e._getSnapshot,s=e._value;try{let o=r();return!Object.is(s,o)}catch{return!0}}function Os(e,r,s){let o=li(),n=ui(),i=Xr(s),a=i.defaultQueryOptions(e);i.getDefaultOptions().queries?._experimental_beforeQuery?.(a),a._optimisticResults=o?"isRestoring":"optimistic",fi(a),ci(a,n),pi(n);let l=!i.getQueryCache().get(a.queryHash),[f]=b(()=>new r(i,a)),p=f.getOptimisticResult(a),h=!o&&e.subscribed!==!1;if(Fs(Wt(d=>{let y=h?f.subscribe(Y.batchCalls(d)):ne;return f.updateResult(),y},[f,h]),()=>f.getCurrentResult()),B(()=>{f.setOptions(a)},[a,f]),hi(a,p))throw So(a,f,n);if(di({result:p,errorResetBoundary:n,throwOnError:a.throwOnError,query:i.getQueryCache().get(a.queryHash),suspense:a.suspense}))throw p.error;return i.getDefaultOptions().queries?._experimental_afterQuery?.(a,p),a.experimental_prefetchInRender&&!Ze.isServer()&&mi(p,o)&&(l?So(a,f,n):i.getQueryCache().get(a.queryHash)?.promise)?.catch(ne).finally(()=>{f.updateResult()}),a.notifyOnChangeProps?p:f.trackResult(p)}function Yr(e,r){return Os(e,Br,r)}function ye(e,r){let s=Xr(r),[o]=b(()=>new To(s,e));B(()=>{o.setOptions(e)},[o,e]);let n=Fs(Wt(a=>o.subscribe(Y.batchCalls(a)),[o]),()=>o.getCurrentResult()),i=Wt((a,l)=>{o.mutate(a,l).catch(ne)},[o]);if(n.error&&jr(o.options.throwOnError,[n.error]))throw n.error;return{...n,mutate:i,mutateAsync:n.mutate}}function Cr(e,r){return Os(e,bo,r)}var Ao="profiler-active-slave",qs=(()=>{try{let e=sessionStorage.getItem(Ao);return e?`/slaves/${e}`:""}catch{return""}})();function yi(){return qs}function gi(){return qs?qs.replace("/slaves/",""):null}function vi(e){try{e?sessionStorage.setItem(Ao,e):sessionStorage.removeItem(Ao)}catch{}qs=e?`/slaves/${e}`:"",window.location.reload()}async function oe(e){let r=yi(),s=r?e.url.replace("/_profiler/api",`/_profiler/api${r}`):e.url,{method:o,params:n,data:i,headers:a={},signal:l}=e,f=s,p=n?"?"+new URLSearchParams(Object.entries(n).map(([m,g])=>[m,String(g)])).toString():"",h={"X-Profiler-Request":"1",...a},d=await fetch(f+p,{method:o,signal:l,headers:i!==void 0?{"Content-Type":"application/json",...h}:h,body:i!==void 0?JSON.stringify(i):void 0});if(d.status===204)return{};let y=await d.json();if(!d.ok)throw Object.assign(new Error(y?.error??`HTTP ${d.status}`),{status:d.status,data:y});return y}var Zt=(e,r)=>{let s={queryKey:r};for(let o of Object.keys(e))o!=="queryKey"&&Object.defineProperty(s,o,{enumerable:!0,configurable:!0,get:()=>e[o]});return s};var Mo=(e,r)=>oe({url:"/_profiler/api/console",method:"GET",params:e,signal:r}),pl=e=>["infinite","/_profiler/api/console",...e?[e]:[]];var dl=(e,r)=>{let{query:s}=r??{};return{queryKey:s?.queryKey??pl(e),queryFn:({signal:i})=>Mo(e,i),...s}};function bi(e,r){let s=dl(e,r),o=Cr(s);return Zt(o,s.queryKey)}var fl=(e,r)=>oe({url:`/_profiler/api/console/${e}`,method:"DELETE",signal:r}),ml=()=>["deleteConsole"],hl=e=>{let r=ml(),{mutation:s}=e?e.mutation&&"mutationKey"in e.mutation&&e.mutation.mutationKey?e:{...e,mutation:{...e.mutation,mutationKey:r}}:{mutation:{mutationKey:r}};return{mutationFn:n=>{let{id:i}=n??{};return fl(i)},...s}},xi=e=>ye(hl(e)),yl=e=>oe({url:"/_profiler/api/console/clear",method:"DELETE",signal:e}),gl=()=>["clearConsoles"],vl=e=>{let r=gl(),{mutation:s}=e?e.mutation&&"mutationKey"in e.mutation&&e.mutation.mutationKey?e:{...e,mutation:{...e.mutation,mutationKey:r}}:{mutation:{mutationKey:r}};return{mutationFn:()=>yl(),...s}},_i=e=>ye(vl(e)),Fo=e=>oe({url:"/_profiler/api/env_vars",method:"GET",signal:e}),bl=()=>["/_profiler/api/env_vars"],xl=e=>{let{query:r}=e??{};return{queryKey:r?.queryKey??bl(),queryFn:({signal:n})=>Fo(n),...r}};function Ti(e){let r=xl(e),s=Yr(r);return Zt(s,r.queryKey)}var _l=(e,r)=>oe({url:"/_profiler/api/env_vars",method:"PATCH",headers:{"Content-Type":"application/json"},data:e,signal:r}),Tl=()=>["updateEnvVar"],wl=e=>{let r=Tl(),{mutation:s}=e?e.mutation&&"mutationKey"in e.mutation&&e.mutation.mutationKey?e:{...e,mutation:{...e.mutation,mutationKey:r}}:{mutation:{mutationKey:r}};return{mutationFn:n=>{let{data:i}=n??{};return _l(i)},...s}},wi=e=>ye(wl(e)),El=(e,r)=>oe({url:"/_profiler/api/env_vars/reset",method:"DELETE",params:e,signal:r}),Cl=()=>["resetEnvVar"],Rl=e=>{let r=Cl(),{mutation:s}=e?e.mutation&&"mutationKey"in e.mutation&&e.mutation.mutationKey?e:{...e,mutation:{...e.mutation,mutationKey:r}}:{mutation:{mutationKey:r}};return{mutationFn:n=>{let{params:i}=n??{};return El(i)},...s}},Ei=e=>ye(Rl(e)),kl=e=>oe({url:"/_profiler/api/env_vars/reset_all",method:"DELETE",signal:e}),Sl=()=>["resetAllEnvVars"],Pl=e=>{let r=Sl(),{mutation:s}=e?e.mutation&&"mutationKey"in e.mutation&&e.mutation.mutationKey?e:{...e,mutation:{...e.mutation,mutationKey:r}}:{mutation:{mutationKey:r}};return{mutationFn:()=>kl(),...s}},Ci=e=>ye(Pl(e));var Al=(e,r)=>oe({url:"/_profiler/api/explain",method:"POST",headers:{"Content-Type":"application/json"},data:e,signal:r}),Ml=()=>["explainQuery"],Fl=e=>{let r=Ml(),{mutation:s}=e?e.mutation&&"mutationKey"in e.mutation&&e.mutation.mutationKey?e:{...e,mutation:{...e.mutation,mutationKey:r}}:{mutation:{mutationKey:r}};return{mutationFn:n=>{let{data:i}=n??{};return Al(i)},...s}},Ri=e=>ye(Fl(e));var Ol=(e,r)=>oe({url:"/_profiler/api/function_profiling",method:"PATCH",headers:{"Content-Type":"application/json"},data:e,signal:r}),ql=()=>["updateFunctionProfiling"],Dl=e=>{let r=ql(),{mutation:s}=e?e.mutation&&"mutationKey"in e.mutation&&e.mutation.mutationKey?e:{...e,mutation:{...e.mutation,mutationKey:r}}:{mutation:{mutationKey:r}};return{mutationFn:n=>{let{data:i}=n??{};return Ol(i)},...s}},ki=e=>ye(Dl(e)),Oo=(e,r)=>oe({url:"/_profiler/api/jobs",method:"GET",params:e,signal:r}),Ql=e=>["infinite","/_profiler/api/jobs",...e?[e]:[]];var Ll=(e,r)=>{let{query:s}=r??{};return{queryKey:s?.queryKey??Ql(e),queryFn:({signal:i})=>Oo(e,i),...s}};function Si(e,r){let s=Ll(e,r),o=Cr(s);return Zt(o,s.queryKey)}var Kl=(e,r)=>oe({url:`/_profiler/api/jobs/${e}`,method:"DELETE",signal:r}),Ul=()=>["deleteJob"],Nl=e=>{let r=Ul(),{mutation:s}=e?e.mutation&&"mutationKey"in e.mutation&&e.mutation.mutationKey?e:{...e,mutation:{...e.mutation,mutationKey:r}}:{mutation:{mutationKey:r}};return{mutationFn:n=>{let{id:i}=n??{};return Kl(i)},...s}},Pi=e=>ye(Nl(e)),jl=e=>oe({url:"/_profiler/api/jobs/clear",method:"DELETE",signal:e}),Il=()=>["clearJobs"],Vl=e=>{let r=Il(),{mutation:s}=e?e.mutation&&"mutationKey"in e.mutation&&e.mutation.mutationKey?e:{...e,mutation:{...e.mutation,mutationKey:r}}:{mutation:{mutationKey:r}};return{mutationFn:()=>jl(),...s}},Ai=e=>ye(Vl(e)),Hl=e=>oe({url:"/_profiler/api/outbound_http",method:"GET",signal:e}),$l=()=>["/_profiler/api/outbound_http"],Gl=e=>{let{query:r}=e??{};return{queryKey:r?.queryKey??$l(),queryFn:({signal:n})=>Hl(n),...r}};function Mi(e){let r=Gl(e),s=Yr(r);return Zt(s,r.queryKey)}var qo=(e,r)=>oe({url:"/_profiler/api/profiles",method:"GET",params:e,signal:r}),Bl=e=>["infinite","/_profiler/api/profiles",...e?[e]:[]];var Jl=(e,r)=>{let{query:s}=r??{};return{queryKey:s?.queryKey??Bl(e),queryFn:({signal:i})=>qo(e,i),...s}};function Fi(e,r){let s=Jl(e,r),o=Cr(s);return Zt(o,s.queryKey)}var zl=(e,r)=>oe({url:`/_profiler/api/profiles/${e}`,method:"DELETE",signal:r}),Wl=()=>["deleteProfile"],Zl=e=>{let r=Wl(),{mutation:s}=e?e.mutation&&"mutationKey"in e.mutation&&e.mutation.mutationKey?e:{...e,mutation:{...e.mutation,mutationKey:r}}:{mutation:{mutationKey:r}};return{mutationFn:n=>{let{id:i}=n??{};return zl(i)},...s}},Oi=e=>ye(Zl(e)),Xl=e=>oe({url:"/_profiler/api/profiles/clear",method:"DELETE",signal:e}),Yl=()=>["clearProfiles"],eu=e=>{let r=Yl(),{mutation:s}=e?e.mutation&&"mutationKey"in e.mutation&&e.mutation.mutationKey?e:{...e,mutation:{...e.mutation,mutationKey:r}}:{mutation:{mutationKey:r}};return{mutationFn:()=>Xl(),...s}},qi=e=>ye(eu(e)),tu=(e,r)=>oe({url:"/_profiler/api/test_runner/files",method:"GET",params:e,signal:r}),ru=e=>["/_profiler/api/test_runner/files",...e?[e]:[]],su=(e,r)=>{let{query:s}=r??{};return{queryKey:s?.queryKey??ru(e),queryFn:({signal:i})=>tu(e,i),...s}};function Di(e,r){let s=su(e,r),o=Yr(s);return Zt(o,s.queryKey)}var ou=(e,r)=>oe({url:"/_profiler/api/test_runner/runs",method:"POST",headers:{"Content-Type":"application/json"},data:e,signal:r}),nu=()=>["createTestRun"],iu=e=>{let r=nu(),{mutation:s}=e?e.mutation&&"mutationKey"in e.mutation&&e.mutation.mutationKey?e:{...e,mutation:{...e.mutation,mutationKey:r}}:{mutation:{mutationKey:r}};return{mutationFn:n=>{let{data:i}=n??{};return ou(i)},...s}},Qi=e=>ye(iu(e));var au=(e,r)=>oe({url:`/_profiler/api/test_runner/runs/${e}`,method:"DELETE",signal:r}),lu=()=>["deleteTestRun"],uu=e=>{let r=lu(),{mutation:s}=e?e.mutation&&"mutationKey"in e.mutation&&e.mutation.mutationKey?e:{...e,mutation:{...e.mutation,mutationKey:r}}:{mutation:{mutationKey:r}};return{mutationFn:n=>{let{id:i}=n??{};return au(i)},...s}},Li=e=>ye(uu(e)),Do=(e,r)=>oe({url:"/_profiler/api/tests",method:"GET",params:e,signal:r}),cu=e=>["infinite","/_profiler/api/tests",...e?[e]:[]];var pu=(e,r)=>{let{query:s}=r??{};return{queryKey:s?.queryKey??cu(e),queryFn:({signal:i})=>Do(e,i),...s}};function Ki(e,r){let s=pu(e,r),o=Cr(s);return Zt(o,s.queryKey)}var du=(e,r)=>oe({url:`/_profiler/api/tests/${e}`,method:"DELETE",signal:r}),fu=()=>["deleteTest"],mu=e=>{let r=fu(),{mutation:s}=e?e.mutation&&"mutationKey"in e.mutation&&e.mutation.mutationKey?e:{...e,mutation:{...e.mutation,mutationKey:r}}:{mutation:{mutationKey:r}};return{mutationFn:n=>{let{id:i}=n??{};return du(i)},...s}},Ui=e=>ye(mu(e)),hu=e=>oe({url:"/_profiler/api/tests/clear",method:"DELETE",signal:e}),yu=()=>["clearTests"],gu=e=>{let r=yu(),{mutation:s}=e?e.mutation&&"mutationKey"in e.mutation&&e.mutation.mutationKey?e:{...e,mutation:{...e.mutation,mutationKey:r}}:{mutation:{mutationKey:r}};return{mutationFn:()=>hu(),...s}},Ni=e=>ye(gu(e));function Ge(){return document.querySelector('meta[name="profiler-version"]')?.content??""}function xe(e){return e.allocated_objects!=null?e.allocated_objects:e.memory!=null?Math.round(e.memory/40):null}function tt(e){return e==null?"-":`${e.toLocaleString("en")} objects`}var rt="Objects allocated by the whole process while this ran: on a multi-threaded server, it includes what other threads allocated meanwhile.";function es(e){return{GET:"info",POST:"success",PUT:"warning",PATCH:"warning",DELETE:"error"}[e]||"default"}function Ds(e){return e===0?"error":e>=200&&e<300?"success":e>=400?"error":"warning"}function Rr(e){return e<0?"-":e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(2)} MB`}function Qo({text:e}){let[r,s]=b(!1);function o(){navigator.clipboard.writeText(e).then(()=>{s(!0),setTimeout(()=>s(!1),2e3)})}return t("button",{onClick:o,class:"profiler-body-download-btn profiler-text--xs",style:"cursor:pointer",children:r?"Copied!":"Copy"})}function $i(e){let r=e.split(";")[0].trim().toLowerCase();return{"application/json":".json","application/ld+json":".jsonld","application/xml":".xml","text/xml":".xml","text/csv":".csv","application/csv":".csv","text/html":".html","text/plain":".txt","text/css":".css","application/javascript":".js","text/javascript":".js","image/svg+xml":".svg","image/png":".png","image/jpeg":".jpg","image/gif":".gif","image/webp":".webp","image/avif":".avif","application/pdf":".pdf","application/zip":".zip","application/gzip":".gz","application/octet-stream":".bin"}[r]||".bin"}function ji({text:e,mime:r}){let[s,o]=b(null);return B(()=>{let n=URL.createObjectURL(new Blob([e],{type:"application/octet-stream"}));return o(n),()=>URL.revokeObjectURL(n)},[e,r]),s?t("a",{href:s,download:`body${$i(r)}`,class:"profiler-body-download-btn profiler-text--xs",children:"Download"}):null}function Ii({headers:e}){let r=Object.entries(e);return r.length?t("table",{class:"profiler-table profiler-table--compact",children:t("tbody",{children:r.map(([s,o])=>t("tr",{children:[t("td",{class:"profiler-text--xs profiler-text--muted",style:"white-space:nowrap;padding-right:16px",children:s}),t("td",{class:"profiler-text--xs",style:"word-break:break-all",children:o})]},s))})}):t("span",{class:"profiler-text--muted profiler-text--xs",children:"none"})}function vu(e){let s=(Object.entries(e).find(([o])=>o.toLowerCase()==="content-type")?.[1]||"").split(";")[0].trim().toLowerCase();return s.includes("json")?"json":s==="image/svg+xml"?"svg":s.startsWith("image/")?"image":s==="application/pdf"?"pdf":s.includes("xml")?"xml":s==="text/csv"||s==="application/csv"?"csv":s==="text/html"?"html":s.startsWith("application/")&&!s.includes("json")&&!s.includes("xml")&&!s.includes("javascript")?"binary":"text"}function bu(e){try{let r=0;return e.replace(/>\s*</g,"><").replace(/(<\/?[^>]+>)/g,s=>{if(s.startsWith("</"))return r=Math.max(0,r-1),`
1
+ "use strict";(()=>{var rn=e=>{throw TypeError(e)};var Js=(e,r,s)=>r.has(e)||rn("Cannot "+s);var c=(e,r,s)=>(Js(e,r,"read from private field"),s?s.call(e):r.get(e)),k=(e,r,s)=>r.has(e)?rn("Cannot add the same private member more than once"):r instanceof WeakSet?r.add(e):r.set(e,s),E=(e,r,s,o)=>(Js(e,r,"write to private field"),o?o.call(e,s):r.set(e,s),s),L=(e,r,s)=>(Js(e,r,"access private method"),s);var Kr=(e,r,s,o)=>({set _(n){E(e,r,n,s)},get _(){return c(e,r,o)}});var _s,X,an,Ba,vt,sn,ln,un,cn,Ys,zs,Ws,pn,vs={},bs=[],Ja=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,Ts=Array.isArray;function ut(e,r){for(var s in r)e[s]=r[s];return e}function eo(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function za(e,r,s){var o,n,i,a={};for(i in r)i=="key"?o=r[i]:i=="ref"?n=r[i]:a[i]=r[i];if(arguments.length>2&&(a.children=arguments.length>3?_s.call(arguments,2):s),typeof e=="function"&&e.defaultProps!=null)for(i in e.defaultProps)a[i]===void 0&&(a[i]=e.defaultProps[i]);return ys(e,a,o,n,null)}function ys(e,r,s,o,n){var i={type:e,props:r,key:s,ref:o,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:n??++an,__i:-1,__u:0};return n==null&&X.vnode!=null&&X.vnode(i),i}function P(e){return e.children}function gs(e,r){this.props=e,this.context=r}function nr(e,r){if(r==null)return e.__?nr(e.__,e.__i+1):null;for(var s;r<e.__k.length;r++)if((s=e.__k[r])!=null&&s.__e!=null)return s.__e;return typeof e.type=="function"?nr(e):null}function Wa(e){if(e.__P&&e.__d){var r=e.__v,s=r.__e,o=[],n=[],i=ut({},r);i.__v=r.__v+1,X.vnode&&X.vnode(i),to(e.__P,i,r,e.__n,e.__P.namespaceURI,32&r.__u?[s]:null,o,s??nr(r),!!(32&r.__u),n),i.__v=r.__v,i.__.__k[i.__i]=i,hn(o,i,n),r.__e=r.__=null,i.__e!=s&&dn(i)}}function dn(e){if((e=e.__)!=null&&e.__c!=null)return e.__e=e.__c.base=null,e.__k.some(function(r){if(r!=null&&r.__e!=null)return e.__e=e.__c.base=r.__e}),dn(e)}function Zs(e){(!e.__d&&(e.__d=!0)&&vt.push(e)&&!xs.__r++||sn!=X.debounceRendering)&&((sn=X.debounceRendering)||ln)(xs)}function xs(){try{for(var e,r=1;vt.length;)vt.length>r&&vt.sort(un),e=vt.shift(),r=vt.length,Wa(e)}finally{vt.length=xs.__r=0}}function fn(e,r,s,o,n,i,a,l,f,p,h){var d,y,m,g,v,_,T,w=o&&o.__k||bs,S=r.length;for(f=Za(s,r,w,f,S),d=0;d<S;d++)(m=s.__k[d])!=null&&(y=m.__i!=-1&&w[m.__i]||vs,m.__i=d,_=to(e,m,y,n,i,a,l,f,p,h),g=m.__e,m.ref&&y.ref!=m.ref&&(y.ref&&ro(y.ref,null,m),h.push(m.ref,m.__c||g,m)),v==null&&g!=null&&(v=g),(T=!!(4&m.__u))||y.__k===m.__k?f=mn(m,f,e,T):typeof m.type=="function"&&_!==void 0?f=_:g&&(f=g.nextSibling),m.__u&=-7);return s.__e=v,f}function Za(e,r,s,o,n){var i,a,l,f,p,h=s.length,d=h,y=0;for(e.__k=new Array(n),i=0;i<n;i++)(a=r[i])!=null&&typeof a!="boolean"&&typeof a!="function"?(typeof a=="string"||typeof a=="number"||typeof a=="bigint"||a.constructor==String?a=e.__k[i]=ys(null,a,null,null,null):Ts(a)?a=e.__k[i]=ys(P,{children:a},null,null,null):a.constructor===void 0&&a.__b>0?a=e.__k[i]=ys(a.type,a.props,a.key,a.ref?a.ref:null,a.__v):e.__k[i]=a,f=i+y,a.__=e,a.__b=e.__b+1,l=null,(p=a.__i=Xa(a,s,f,d))!=-1&&(d--,(l=s[p])&&(l.__u|=2)),l==null||l.__v==null?(p==-1&&(n>h?y--:n<h&&y++),typeof a.type!="function"&&(a.__u|=4)):p!=f&&(p==f-1?y--:p==f+1?y++:(p>f?y--:y++,a.__u|=4))):e.__k[i]=null;if(d)for(i=0;i<h;i++)(l=s[i])!=null&&(2&l.__u)==0&&(l.__e==o&&(o=nr(l)),gn(l,l));return o}function mn(e,r,s,o){var n,i;if(typeof e.type=="function"){for(n=e.__k,i=0;n&&i<n.length;i++)n[i]&&(n[i].__=e,r=mn(n[i],r,s,o));return r}e.__e!=r&&(o&&(r&&e.type&&!r.parentNode&&(r=nr(e)),s.insertBefore(e.__e,r||null)),r=e.__e);do r=r&&r.nextSibling;while(r!=null&&r.nodeType==8);return r}function Xa(e,r,s,o){var n,i,a,l=e.key,f=e.type,p=r[s],h=p!=null&&(2&p.__u)==0;if(p===null&&l==null||h&&l==p.key&&f==p.type)return s;if(o>(h?1:0)){for(n=s-1,i=s+1;n>=0||i<r.length;)if((p=r[a=n>=0?n--:i++])!=null&&(2&p.__u)==0&&l==p.key&&f==p.type)return a}return-1}function on(e,r,s){r[0]=="-"?e.setProperty(r,s??""):e[r]=s==null?"":typeof s!="number"||Ja.test(r)?s:s+"px"}function hs(e,r,s,o,n){var i,a;e:if(r=="style")if(typeof s=="string")e.style.cssText=s;else{if(typeof o=="string"&&(e.style.cssText=o=""),o)for(r in o)s&&r in s||on(e.style,r,"");if(s)for(r in s)o&&s[r]==o[r]||on(e.style,r,s[r])}else if(r[0]=="o"&&r[1]=="n")i=r!=(r=r.replace(cn,"$1")),a=r.toLowerCase(),r=a in e||r=="onFocusOut"||r=="onFocusIn"?a.slice(2):r.slice(2),e.l||(e.l={}),e.l[r+i]=s,s?o?s.u=o.u:(s.u=Ys,e.addEventListener(r,i?Ws:zs,i)):e.removeEventListener(r,i?Ws:zs,i);else{if(n=="http://www.w3.org/2000/svg")r=r.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(r!="width"&&r!="height"&&r!="href"&&r!="list"&&r!="form"&&r!="tabIndex"&&r!="download"&&r!="rowSpan"&&r!="colSpan"&&r!="role"&&r!="popover"&&r in e)try{e[r]=s??"";break e}catch{}typeof s=="function"||(s==null||s===!1&&r[4]!="-"?e.removeAttribute(r):e.setAttribute(r,r=="popover"&&s==1?"":s))}}function nn(e){return function(r){if(this.l){var s=this.l[r.type+e];if(r.t==null)r.t=Ys++;else if(r.t<s.u)return;return s(X.event?X.event(r):r)}}}function to(e,r,s,o,n,i,a,l,f,p){var h,d,y,m,g,v,_,T,w,S,M,K,I,oe,N,D=r.type;if(r.constructor!==void 0)return null;128&s.__u&&(f=!!(32&s.__u),i=[l=r.__e=s.__e]),(h=X.__b)&&h(r);e:if(typeof D=="function")try{if(T=r.props,w=D.prototype&&D.prototype.render,S=(h=D.contextType)&&o[h.__c],M=h?S?S.props.value:h.__:o,s.__c?_=(d=r.__c=s.__c).__=d.__E:(w?r.__c=d=new D(T,M):(r.__c=d=new gs(T,M),d.constructor=D,d.render=el),S&&S.sub(d),d.state||(d.state={}),d.__n=o,y=d.__d=!0,d.__h=[],d._sb=[]),w&&d.__s==null&&(d.__s=d.state),w&&D.getDerivedStateFromProps!=null&&(d.__s==d.state&&(d.__s=ut({},d.__s)),ut(d.__s,D.getDerivedStateFromProps(T,d.__s))),m=d.props,g=d.state,d.__v=r,y)w&&D.getDerivedStateFromProps==null&&d.componentWillMount!=null&&d.componentWillMount(),w&&d.componentDidMount!=null&&d.__h.push(d.componentDidMount);else{if(w&&D.getDerivedStateFromProps==null&&T!==m&&d.componentWillReceiveProps!=null&&d.componentWillReceiveProps(T,M),r.__v==s.__v||!d.__e&&d.shouldComponentUpdate!=null&&d.shouldComponentUpdate(T,d.__s,M)===!1){r.__v!=s.__v&&(d.props=T,d.state=d.__s,d.__d=!1),r.__e=s.__e,r.__k=s.__k,r.__k.some(function(O){O&&(O.__=r)}),bs.push.apply(d.__h,d._sb),d._sb=[],d.__h.length&&a.push(d);break e}d.componentWillUpdate!=null&&d.componentWillUpdate(T,d.__s,M),w&&d.componentDidUpdate!=null&&d.__h.push(function(){d.componentDidUpdate(m,g,v)})}if(d.context=M,d.props=T,d.__P=e,d.__e=!1,K=X.__r,I=0,w)d.state=d.__s,d.__d=!1,K&&K(r),h=d.render(d.props,d.state,d.context),bs.push.apply(d.__h,d._sb),d._sb=[];else do d.__d=!1,K&&K(r),h=d.render(d.props,d.state,d.context),d.state=d.__s;while(d.__d&&++I<25);d.state=d.__s,d.getChildContext!=null&&(o=ut(ut({},o),d.getChildContext())),w&&!y&&d.getSnapshotBeforeUpdate!=null&&(v=d.getSnapshotBeforeUpdate(m,g)),oe=h!=null&&h.type===P&&h.key==null?yn(h.props.children):h,l=fn(e,Ts(oe)?oe:[oe],r,s,o,n,i,a,l,f,p),d.base=r.__e,r.__u&=-161,d.__h.length&&a.push(d),_&&(d.__E=d.__=null)}catch(O){if(r.__v=null,f||i!=null)if(O.then){for(r.__u|=f?160:128;l&&l.nodeType==8&&l.nextSibling;)l=l.nextSibling;i[i.indexOf(l)]=null,r.__e=l}else{for(N=i.length;N--;)eo(i[N]);Xs(r)}else r.__e=s.__e,r.__k=s.__k,O.then||Xs(r);X.__e(O,r,s)}else i==null&&r.__v==s.__v?(r.__k=s.__k,r.__e=s.__e):l=r.__e=Ya(s.__e,r,s,o,n,i,a,f,p);return(h=X.diffed)&&h(r),128&r.__u?void 0:l}function Xs(e){e&&(e.__c&&(e.__c.__e=!0),e.__k&&e.__k.some(Xs))}function hn(e,r,s){for(var o=0;o<s.length;o++)ro(s[o],s[++o],s[++o]);X.__c&&X.__c(r,e),e.some(function(n){try{e=n.__h,n.__h=[],e.some(function(i){i.call(n)})}catch(i){X.__e(i,n.__v)}})}function yn(e){return typeof e!="object"||e==null||e.__b>0?e:Ts(e)?e.map(yn):ut({},e)}function Ya(e,r,s,o,n,i,a,l,f){var p,h,d,y,m,g,v,_=s.props||vs,T=r.props,w=r.type;if(w=="svg"?n="http://www.w3.org/2000/svg":w=="math"?n="http://www.w3.org/1998/Math/MathML":n||(n="http://www.w3.org/1999/xhtml"),i!=null){for(p=0;p<i.length;p++)if((m=i[p])&&"setAttribute"in m==!!w&&(w?m.localName==w:m.nodeType==3)){e=m,i[p]=null;break}}if(e==null){if(w==null)return document.createTextNode(T);e=document.createElementNS(n,w,T.is&&T),l&&(X.__m&&X.__m(r,i),l=!1),i=null}if(w==null)_===T||l&&e.data==T||(e.data=T);else{if(i=i&&_s.call(e.childNodes),!l&&i!=null)for(_={},p=0;p<e.attributes.length;p++)_[(m=e.attributes[p]).name]=m.value;for(p in _)m=_[p],p=="dangerouslySetInnerHTML"?d=m:p=="children"||p in T||p=="value"&&"defaultValue"in T||p=="checked"&&"defaultChecked"in T||hs(e,p,null,m,n);for(p in T)m=T[p],p=="children"?y=m:p=="dangerouslySetInnerHTML"?h=m:p=="value"?g=m:p=="checked"?v=m:l&&typeof m!="function"||_[p]===m||hs(e,p,m,_[p],n);if(h)l||d&&(h.__html==d.__html||h.__html==e.innerHTML)||(e.innerHTML=h.__html),r.__k=[];else if(d&&(e.innerHTML=""),fn(r.type=="template"?e.content:e,Ts(y)?y:[y],r,s,o,w=="foreignObject"?"http://www.w3.org/1999/xhtml":n,i,a,i?i[0]:s.__k&&nr(s,0),l,f),i!=null)for(p=i.length;p--;)eo(i[p]);l||(p="value",w=="progress"&&g==null?e.removeAttribute("value"):g!=null&&(g!==e[p]||w=="progress"&&!g||w=="option"&&g!=_[p])&&hs(e,p,g,_[p],n),p="checked",v!=null&&v!=e[p]&&hs(e,p,v,_[p],n))}return e}function ro(e,r,s){try{if(typeof e=="function"){var o=typeof e.__u=="function";o&&e.__u(),o&&r==null||(e.__u=e(r))}else e.current=r}catch(n){X.__e(n,s)}}function gn(e,r,s){var o,n;if(X.unmount&&X.unmount(e),(o=e.ref)&&(o.current&&o.current!=e.__e||ro(o,null,r)),(o=e.__c)!=null){if(o.componentWillUnmount)try{o.componentWillUnmount()}catch(i){X.__e(i,r)}o.base=o.__P=null}if(o=e.__k)for(n=0;n<o.length;n++)o[n]&&gn(o[n],r,s||typeof e.type!="function");s||eo(e.__e),e.__c=e.__=e.__e=void 0}function el(e,r,s){return this.constructor(e,s)}function Ur(e,r,s){var o,n,i,a;r==document&&(r=document.documentElement),X.__&&X.__(e,r),n=(o=typeof s=="function")?null:s&&s.__k||r.__k,i=[],a=[],to(r,e=(!o&&s||r).__k=za(P,null,[e]),n||vs,vs,r.namespaceURI,!o&&s?[s]:n?null:r.firstChild?_s.call(r.childNodes):null,i,!o&&s?s:n?n.__e:r.firstChild,o,a),hn(i,e,a)}function ir(e){function r(s){var o,n;return this.getChildContext||(o=new Set,(n={})[r.__c]=this,this.getChildContext=function(){return n},this.componentWillUnmount=function(){o=null},this.shouldComponentUpdate=function(i){this.props.value!=i.value&&o.forEach(function(a){a.__e=!0,Zs(a)})},this.sub=function(i){o.add(i);var a=i.componentWillUnmount;i.componentWillUnmount=function(){o&&o.delete(i),a&&a.call(i)}}),s.children}return r.__c="__cC"+pn++,r.__=e,r.Provider=r.__l=(r.Consumer=function(s,o){return s.children(o)}).contextType=r,r}_s=bs.slice,X={__e:function(e,r,s,o){for(var n,i,a;r=r.__;)if((n=r.__c)&&!n.__)try{if((i=n.constructor)&&i.getDerivedStateFromError!=null&&(n.setState(i.getDerivedStateFromError(e)),a=n.__d),n.componentDidCatch!=null&&(n.componentDidCatch(e,o||{}),a=n.__d),a)return n.__E=n}catch(l){e=l}throw e}},an=0,Ba=function(e){return e!=null&&e.constructor===void 0},gs.prototype.setState=function(e,r){var s;s=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=ut({},this.state),typeof e=="function"&&(e=e(ut({},s),this.props)),e&&ut(s,e),e!=null&&this.__v&&(r&&this._sb.push(r),Zs(this))},gs.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),Zs(this))},gs.prototype.render=P,vt=[],ln=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,un=function(e,r){return e.__v.__b-r.__v.__b},xs.__r=0,cn=/(PointerCapture)$|Capture$/i,Ys=0,zs=nn(!1),Ws=nn(!0),pn=0;var Qe=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}};var Nt,bt,ar,vn,tl=(vn=class extends Qe{constructor(){super();k(this,Nt);k(this,bt);k(this,ar);E(this,ar,r=>{if(typeof window<"u"&&window.addEventListener){let s=()=>r();return window.addEventListener("visibilitychange",s,!1),()=>{window.removeEventListener("visibilitychange",s)}}})}onSubscribe(){c(this,bt)||this.setEventListener(c(this,ar))}onUnsubscribe(){var r;this.hasListeners()||((r=c(this,bt))==null||r.call(this),E(this,bt,void 0))}setEventListener(r){var s;E(this,ar,r),(s=c(this,bt))==null||s.call(this),E(this,bt,r(o=>{typeof o=="boolean"?this.setFocused(o):this.onFocus()}))}setFocused(r){c(this,Nt)!==r&&(E(this,Nt,r),this.onFocus())}onFocus(){let r=this.isFocused();this.listeners.forEach(s=>{s(r)})}isFocused(){return typeof c(this,Nt)=="boolean"?c(this,Nt):globalThis.document?.visibilityState!=="hidden"}},Nt=new WeakMap,bt=new WeakMap,ar=new WeakMap,vn),lr=new tl;var rl={setTimeout:(e,r)=>setTimeout(e,r),clearTimeout:e=>clearTimeout(e),setInterval:(e,r)=>setInterval(e,r),clearInterval:e=>clearInterval(e)},xt,so,bn,sl=(bn=class{constructor(){k(this,xt,rl);k(this,so,!1)}setTimeoutProvider(e){E(this,xt,e)}setTimeout(e,r){return c(this,xt).setTimeout(e,r)}clearTimeout(e){c(this,xt).clearTimeout(e)}setInterval(e,r){return c(this,xt).setInterval(e,r)}clearInterval(e){c(this,xt).clearInterval(e)}},xt=new WeakMap,so=new WeakMap,bn),ze=new sl;function xn(e){setTimeout(e,0)}var no=typeof window>"u"||"Deno"in globalThis;function ne(){}function wn(e,r){return typeof e=="function"?e(r):e}function Nr(e){return typeof e=="number"&&e>=0&&e!==1/0}function ws(e,r){return Math.max(e+(r||0)-Date.now(),0)}function He(e,r){return typeof e=="function"?e(r):e}function Ee(e,r){return typeof e=="function"?e(r):e}function Es(e,r){let{type:s="all",exact:o,fetchStatus:n,predicate:i,queryKey:a,stale:l}=e;if(a){if(o){if(r.queryHash!==jr(a,r.options))return!1}else if(!jt(r.queryKey,a))return!1}if(s!=="all"){let f=r.isActive();if(s==="active"&&!f||s==="inactive"&&f)return!1}return!(typeof l=="boolean"&&r.isStale()!==l||n&&n!==r.state.fetchStatus||i&&!i(r))}function Cs(e,r){let{exact:s,status:o,predicate:n,mutationKey:i}=e;if(i){if(!r.options.mutationKey)return!1;if(s){if(We(r.options.mutationKey)!==We(i))return!1}else if(!jt(r.options.mutationKey,i))return!1}return!(o&&r.state.status!==o||n&&!n(r))}function jr(e,r){return(r?.queryKeyHashFn||We)(e)}function We(e){return JSON.stringify(e,(r,s)=>oo(s)?Object.keys(s).sort().reduce((o,n)=>(o[n]=s[n],o),{}):s)}function jt(e,r){return e===r?!0:typeof e!=typeof r?!1:e&&r&&typeof e=="object"&&typeof r=="object"?Object.keys(r).every(s=>jt(e[s],r[s])):!1}var ol=Object.prototype.hasOwnProperty;function io(e,r,s=0){if(e===r)return e;if(s>500)return r;let o=_n(e)&&_n(r);if(!o&&!(oo(e)&&oo(r)))return r;let i=(o?e:Object.keys(e)).length,a=o?r:Object.keys(r),l=a.length,f=o?new Array(l):{},p=0;for(let h=0;h<l;h++){let d=o?h:a[h],y=e[d],m=r[d];if(y===m){f[d]=y,(o?h<i:ol.call(e,d))&&p++;continue}if(y===null||m===null||typeof y!="object"||typeof m!="object"){f[d]=m;continue}let g=io(y,m,s+1);f[d]=g,g===y&&p++}return i===l&&p===i?e:f}function ur(e,r){if(!r||Object.keys(e).length!==Object.keys(r).length)return!1;for(let s in e)if(e[s]!==r[s])return!1;return!0}function _n(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function oo(e){if(!Tn(e))return!1;let r=e.constructor;if(r===void 0)return!0;let s=r.prototype;return!(!Tn(s)||!s.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function Tn(e){return Object.prototype.toString.call(e)==="[object Object]"}function En(e){return new Promise(r=>{ze.setTimeout(r,e)})}function Ir(e,r,s){return typeof s.structuralSharing=="function"?s.structuralSharing(e,r):s.structuralSharing!==!1?io(e,r):r}function Cn(e,r,s=0){let o=[...e,r];return s&&o.length>s?o.slice(1):o}function Rn(e,r,s=0){let o=[r,...e];return s&&o.length>s?o.slice(0,-1):o}var cr=Symbol();function Rs(e,r){return!e.queryFn&&r?.initialPromise?()=>r.initialPromise:!e.queryFn||e.queryFn===cr?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function Vr(e,r){return typeof e=="function"?e(...r):!!e}function kn(e,r,s){let o=!1,n;return Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(n??(n=r()),o||(o=!0,n.aborted?s():n.addEventListener("abort",s,{once:!0})),n)}),e}var Ze=(()=>{let e=()=>no;return{isServer(){return e()},setIsServer(r){e=r}}})();function Hr(){let e,r,s=new Promise((n,i)=>{e=n,r=i});s.status="pending",s.catch(()=>{});function o(n){Object.assign(s,n),delete s.resolve,delete s.reject}return s.resolve=n=>{o({status:"fulfilled",value:n}),e(n)},s.reject=n=>{o({status:"rejected",reason:n}),r(n)},s}var Sn=xn;function nl(){let e=[],r=0,s=l=>{l()},o=l=>{l()},n=Sn,i=l=>{r?e.push(l):n(()=>{s(l)})},a=()=>{let l=e;e=[],l.length&&n(()=>{o(()=>{l.forEach(f=>{s(f)})})})};return{batch:l=>{let f;r++;try{f=l()}finally{r--,r||a()}return f},batchCalls:l=>(...f)=>{i(()=>{l(...f)})},schedule:i,setNotifyFunction:l=>{s=l},setBatchNotifyFunction:l=>{o=l},setScheduler:l=>{n=l}}}var Y=nl();var pr,_t,dr,Pn,il=(Pn=class extends Qe{constructor(){super();k(this,pr,!0);k(this,_t);k(this,dr);E(this,dr,r=>{if(typeof window<"u"&&window.addEventListener){let s=()=>r(!0),o=()=>r(!1);return window.addEventListener("online",s,!1),window.addEventListener("offline",o,!1),()=>{window.removeEventListener("online",s),window.removeEventListener("offline",o)}}})}onSubscribe(){c(this,_t)||this.setEventListener(c(this,dr))}onUnsubscribe(){var r;this.hasListeners()||((r=c(this,_t))==null||r.call(this),E(this,_t,void 0))}setEventListener(r){var s;E(this,dr,r),(s=c(this,_t))==null||s.call(this),E(this,_t,r(this.setOnline.bind(this)))}setOnline(r){c(this,pr)!==r&&(E(this,pr,r),this.listeners.forEach(o=>{o(r)}))}isOnline(){return c(this,pr)}},pr=new WeakMap,_t=new WeakMap,dr=new WeakMap,Pn),fr=new il;function al(e){return Math.min(1e3*2**e,3e4)}function ao(e){return(e??"online")==="online"?fr.isOnline():!0}var ks=class extends Error{constructor(e){super("CancelledError"),this.revert=e?.revert,this.silent=e?.silent}};function Ss(e){let r=!1,s=0,o,n=Hr(),i=()=>n.status!=="pending",a=v=>{if(!i()){let _=new ks(v);y(_),e.onCancel?.(_)}},l=()=>{r=!0},f=()=>{r=!1},p=()=>lr.isFocused()&&(e.networkMode==="always"||fr.isOnline())&&e.canRun(),h=()=>ao(e.networkMode)&&e.canRun(),d=v=>{i()||(o?.(),n.resolve(v))},y=v=>{i()||(o?.(),n.reject(v))},m=()=>new Promise(v=>{o=_=>{(i()||p())&&v(_)},e.onPause?.()}).then(()=>{o=void 0,i()||e.onContinue?.()}),g=()=>{if(i())return;let v,_=s===0?e.initialPromise:void 0;try{v=_??e.fn()}catch(T){v=Promise.reject(T)}Promise.resolve(v).then(d).catch(T=>{if(i())return;let w=e.retry??(Ze.isServer()?0:3),S=e.retryDelay??al,M=typeof S=="function"?S(s,T):S,K=w===!0||typeof w=="number"&&s<w||typeof w=="function"&&w(s,T);if(r||!K){y(T);return}s++,e.onFail?.(s,T),En(M).then(()=>p()?void 0:m()).then(()=>{r?y(T):g()})})};return{promise:n,status:()=>n.status,cancel:a,continue:()=>(o?.(),n),cancelRetry:l,continueRetry:f,canStart:h,start:()=>(h()?g():m().then(g),n)}}var It,An,Ps=(An=class{constructor(){k(this,It)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),Nr(this.gcTime)&&E(this,It,ze.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(Ze.isServer()?1/0:300*1e3))}clearGcTimeout(){c(this,It)!==void 0&&(ze.clearTimeout(c(this,It)),E(this,It,void 0))}},It=new WeakMap,An);function Mn(e){return{onFetch:(r,s)=>{let o=r.options,n=r.fetchOptions?.meta?.fetchMore?.direction,i=r.state.data?.pages||[],a=r.state.data?.pageParams||[],l={pages:[],pageParams:[]},f=0,p=async()=>{let h=!1,d=g=>{kn(g,()=>r.signal,()=>h=!0)},y=Rs(r.options,r.fetchOptions),m=async(g,v,_)=>{if(h)return Promise.reject(r.signal.reason);if(v==null&&g.pages.length)return Promise.resolve(g);let w=(()=>{let I={client:r.client,queryKey:r.queryKey,pageParam:v,direction:_?"backward":"forward",meta:r.options.meta};return d(I),I})(),S=await y(w),{maxPages:M}=r.options,K=_?Rn:Cn;return{pages:K(g.pages,S,M),pageParams:K(g.pageParams,v,M)}};if(n&&i.length){let g=n==="backward",v=g?Fn:lo,_={pages:i,pageParams:a},T=v(o,_);l=await m(_,T,g)}else{let g=e??i.length;do{let v=f===0?a[0]??o.initialPageParam:lo(o,l);if(f>0&&v==null)break;l=await m(l,v),f++}while(f<g)}return l};r.options.persister?r.fetchFn=()=>r.options.persister?.(p,{client:r.client,queryKey:r.queryKey,meta:r.options.meta,signal:r.signal},s):r.fetchFn=p}}}function lo(e,{pages:r,pageParams:s}){let o=r.length-1;return r.length>0?e.getNextPageParam(r[o],r,s[o],s):void 0}function Fn(e,{pages:r,pageParams:s}){return r.length>0?e.getPreviousPageParam?.(r[0],r,s[0],s):void 0}function On(e,r){return r?lo(e,r)!=null:!1}function qn(e,r){return!r||!e.getPreviousPageParam?!1:Fn(e,r)!=null}var mr,Vt,hr,Le,Ht,pe,$r,$t,Oe,Un,ct,Ln,Kn=(Ln=class extends Ps{constructor(r){super();k(this,Oe);k(this,mr);k(this,Vt);k(this,hr);k(this,Le);k(this,Ht);k(this,pe);k(this,$r);k(this,$t);E(this,$t,!1),E(this,$r,r.defaultOptions),this.setOptions(r.options),this.observers=[],E(this,Ht,r.client),E(this,Le,c(this,Ht).getQueryCache()),this.queryKey=r.queryKey,this.queryHash=r.queryHash,E(this,Vt,Qn(this.options)),this.state=r.state??c(this,Vt),this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return c(this,mr)}get promise(){return c(this,pe)?.promise}setOptions(r){if(this.options={...c(this,$r),...r},r?._type&&E(this,mr,r._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){let s=Qn(this.options);s.data!==void 0&&(this.setState(Dn(s.data,s.dataUpdatedAt)),E(this,Vt,s))}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&c(this,Le).remove(this)}setData(r,s){let o=Ir(this.state.data,r,this.options);return L(this,Oe,ct).call(this,{data:o,type:"success",dataUpdatedAt:s?.updatedAt,manual:s?.manual}),o}setState(r){L(this,Oe,ct).call(this,{type:"setState",state:r})}cancel(r){let s=c(this,pe)?.promise;return c(this,pe)?.cancel(r),s?s.then(ne).catch(ne):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return c(this,Vt)}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(r=>Ee(r.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===cr||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0?this.observers.some(r=>He(r.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(r=>r.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(r=0){return this.state.data===void 0?!0:r==="static"?!1:this.state.isInvalidated?!0:!ws(this.state.dataUpdatedAt,r)}onFocus(){this.observers.find(s=>s.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),c(this,pe)?.continue()}onOnline(){this.observers.find(s=>s.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),c(this,pe)?.continue()}addObserver(r){this.observers.includes(r)||(this.observers.push(r),this.clearGcTimeout(),c(this,Le).notify({type:"observerAdded",query:this,observer:r}))}removeObserver(r){this.observers.includes(r)&&(this.observers=this.observers.filter(s=>s!==r),this.observers.length||(c(this,pe)&&(c(this,$t)||L(this,Oe,Un).call(this)?c(this,pe).cancel({revert:!0}):c(this,pe).cancelRetry()),this.scheduleGc()),c(this,Le).notify({type:"observerRemoved",query:this,observer:r}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||L(this,Oe,ct).call(this,{type:"invalidate"})}async fetch(r,s){if(this.state.fetchStatus!=="idle"&&c(this,pe)?.status()!=="rejected"){if(this.state.data!==void 0&&s?.cancelRefetch)this.cancel({silent:!0});else if(c(this,pe))return c(this,pe).continueRetry(),c(this,pe).promise}if(r&&this.setOptions(r),!this.options.queryFn){let p=this.observers.find(h=>h.options.queryFn);p&&this.setOptions(p.options)}let o=new AbortController,n=p=>{Object.defineProperty(p,"signal",{enumerable:!0,get:()=>(E(this,$t,!0),o.signal)})},i=()=>{let p=Rs(this.options,s),d=(()=>{let y={client:c(this,Ht),queryKey:this.queryKey,meta:this.meta};return n(y),y})();return E(this,$t,!1),this.options.persister?this.options.persister(p,d,this):p(d)},l=(()=>{let p={fetchOptions:s,options:this.options,queryKey:this.queryKey,client:c(this,Ht),state:this.state,fetchFn:i};return n(p),p})();(c(this,mr)==="infinite"?Mn(this.options.pages):this.options.behavior)?.onFetch(l,this),E(this,hr,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==l.fetchOptions?.meta)&&L(this,Oe,ct).call(this,{type:"fetch",meta:l.fetchOptions?.meta}),E(this,pe,Ss({initialPromise:s?.initialPromise,fn:l.fetchFn,onCancel:p=>{p instanceof ks&&p.revert&&this.setState({...c(this,hr),fetchStatus:"idle"}),o.abort()},onFail:(p,h)=>{L(this,Oe,ct).call(this,{type:"failed",failureCount:p,error:h})},onPause:()=>{L(this,Oe,ct).call(this,{type:"pause"})},onContinue:()=>{L(this,Oe,ct).call(this,{type:"continue"})},retry:l.options.retry,retryDelay:l.options.retryDelay,networkMode:l.options.networkMode,canRun:()=>!0}));try{let p=await c(this,pe).start();if(p===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(p),c(this,Le).config.onSuccess?.(p,this),c(this,Le).config.onSettled?.(p,this.state.error,this),p}catch(p){if(p instanceof ks){if(p.silent)return c(this,pe).promise;if(p.revert){if(this.state.data===void 0)throw p;return this.state.data}}throw L(this,Oe,ct).call(this,{type:"error",error:p}),c(this,Le).config.onError?.(p,this),c(this,Le).config.onSettled?.(this.state.data,p,this),p}finally{this.scheduleGc()}}},mr=new WeakMap,Vt=new WeakMap,hr=new WeakMap,Le=new WeakMap,Ht=new WeakMap,pe=new WeakMap,$r=new WeakMap,$t=new WeakMap,Oe=new WeakSet,Un=function(){return this.state.fetchStatus==="paused"&&this.state.status==="pending"},ct=function(r){let s=o=>{switch(r.type){case"failed":return{...o,fetchFailureCount:r.failureCount,fetchFailureReason:r.error};case"pause":return{...o,fetchStatus:"paused"};case"continue":return{...o,fetchStatus:"fetching"};case"fetch":return{...o,...uo(o.data,this.options),fetchMeta:r.meta??null};case"success":let n={...o,...Dn(r.data,r.dataUpdatedAt),dataUpdateCount:o.dataUpdateCount+1,...!r.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return E(this,hr,r.manual?n:void 0),n;case"error":let i=r.error;return{...o,error:i,errorUpdateCount:o.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:o.fetchFailureCount+1,fetchFailureReason:i,fetchStatus:"idle",status:"error",isInvalidated:!0};case"invalidate":return{...o,isInvalidated:!0};case"setState":return{...o,...r.state}}};this.state=s(this.state),Y.batch(()=>{this.observers.forEach(o=>{o.onQueryUpdate()}),c(this,Le).notify({query:this,type:"updated",action:r})})},Ln);function uo(e,r){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:ao(r.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function Dn(e,r){return{data:e,dataUpdatedAt:r??Date.now(),error:null,isInvalidated:!1,status:"success"}}function Qn(e){let r=typeof e.initialData=="function"?e.initialData():e.initialData,s=r!==void 0,o=s?typeof e.initialDataUpdatedAt=="function"?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:r,dataUpdateCount:0,dataUpdatedAt:s?o??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:s?"success":"pending",fetchStatus:"idle"}}var ke,G,Br,Ce,Gt,yr,pt,Tt,Jr,gr,vr,Bt,Jt,wt,br,W,Gr,co,po,fo,mo,ho,yo,go,Vn,In,zr=(In=class extends Qe{constructor(r,s){super();k(this,W);k(this,ke);k(this,G);k(this,Br);k(this,Ce);k(this,Gt);k(this,yr);k(this,pt);k(this,Tt);k(this,Jr);k(this,gr);k(this,vr);k(this,Bt);k(this,Jt);k(this,wt);k(this,br,new Set);this.options=s,E(this,ke,r),E(this,Tt,null),E(this,pt,Hr()),this.bindMethods(),this.setOptions(s)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(c(this,G).addObserver(this),Nn(c(this,G),this.options)?L(this,W,Gr).call(this):this.updateResult(),L(this,W,mo).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return vo(c(this,G),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return vo(c(this,G),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,L(this,W,ho).call(this),L(this,W,yo).call(this),c(this,G).removeObserver(this)}setOptions(r){let s=this.options,o=c(this,G);if(this.options=c(this,ke).defaultQueryOptions(r),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof Ee(this.options.enabled,c(this,G))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");L(this,W,go).call(this),c(this,G).setOptions(this.options),s._defaulted&&!ur(this.options,s)&&c(this,ke).getQueryCache().notify({type:"observerOptionsUpdated",query:c(this,G),observer:this});let n=this.hasListeners();n&&jn(c(this,G),o,this.options,s)&&L(this,W,Gr).call(this),this.updateResult(),n&&(c(this,G)!==o||Ee(this.options.enabled,c(this,G))!==Ee(s.enabled,c(this,G))||He(this.options.staleTime,c(this,G))!==He(s.staleTime,c(this,G)))&&L(this,W,co).call(this);let i=L(this,W,po).call(this);n&&(c(this,G)!==o||Ee(this.options.enabled,c(this,G))!==Ee(s.enabled,c(this,G))||i!==c(this,wt))&&L(this,W,fo).call(this,i)}getOptimisticResult(r){let s=c(this,ke).getQueryCache().build(c(this,ke),r),o=this.createResult(s,r);return ul(this,o)&&(E(this,Ce,o),E(this,yr,this.options),E(this,Gt,c(this,G).state)),o}getCurrentResult(){return c(this,Ce)}trackResult(r,s){return new Proxy(r,{get:(o,n)=>(this.trackProp(n),s?.(n),n==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&c(this,pt).status==="pending"&&c(this,pt).reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(o,n))})}trackProp(r){c(this,br).add(r)}getCurrentQuery(){return c(this,G)}refetch({...r}={}){return this.fetch({...r})}fetchOptimistic(r){let s=c(this,ke).defaultQueryOptions(r),o=c(this,ke).getQueryCache().build(c(this,ke),s);return o.fetch().then(()=>this.createResult(o,s))}fetch(r){return L(this,W,Gr).call(this,{...r,cancelRefetch:r.cancelRefetch??!0}).then(()=>(this.updateResult(),c(this,Ce)))}createResult(r,s){let o=c(this,G),n=this.options,i=c(this,Ce),a=c(this,Gt),l=c(this,yr),p=r!==o?r.state:c(this,Br),{state:h}=r,d={...h},y=!1,m;if(s._optimisticResults){let D=this.hasListeners(),O=!D&&Nn(r,s),U=D&&jn(r,o,s,n);(O||U)&&(d={...d,...uo(h.data,r.options)}),s._optimisticResults==="isRestoring"&&(d.fetchStatus="idle")}let{error:g,errorUpdatedAt:v,status:_}=d;m=d.data;let T=!1;if(s.placeholderData!==void 0&&m===void 0&&_==="pending"){let D;i?.isPlaceholderData&&s.placeholderData===l?.placeholderData?(D=i.data,T=!0):D=typeof s.placeholderData=="function"?s.placeholderData(c(this,vr)?.state.data,c(this,vr)):s.placeholderData,D!==void 0&&(_="success",m=Ir(i?.data,D,s),y=!0)}if(s.select&&m!==void 0&&!T)if(i&&m===a?.data&&s.select===c(this,Jr))m=c(this,gr);else try{E(this,Jr,s.select),m=s.select(m),m=Ir(i?.data,m,s),E(this,gr,m),E(this,Tt,null)}catch(D){E(this,Tt,D)}c(this,Tt)&&(g=c(this,Tt),m=c(this,gr),v=Date.now(),_="error");let w=d.fetchStatus==="fetching",S=_==="pending",M=_==="error",K=S&&w,I=m!==void 0,N={status:_,fetchStatus:d.fetchStatus,isPending:S,isSuccess:_==="success",isError:M,isInitialLoading:K,isLoading:K,data:m,dataUpdatedAt:d.dataUpdatedAt,error:g,errorUpdatedAt:v,failureCount:d.fetchFailureCount,failureReason:d.fetchFailureReason,errorUpdateCount:d.errorUpdateCount,isFetched:r.isFetched(),isFetchedAfterMount:d.dataUpdateCount>p.dataUpdateCount||d.errorUpdateCount>p.errorUpdateCount,isFetching:w,isRefetching:w&&!S,isLoadingError:M&&!I,isPaused:d.fetchStatus==="paused",isPlaceholderData:y,isRefetchError:M&&I,isStale:bo(r,s),refetch:this.refetch,promise:c(this,pt),isEnabled:Ee(s.enabled,r)!==!1};if(this.options.experimental_prefetchInRender){let D=N.data!==void 0,O=N.status==="error"&&!D,U=le=>{O?le.reject(N.error):D&&le.resolve(N.data)},J=()=>{let le=E(this,pt,N.promise=Hr());U(le)},H=c(this,pt);switch(H.status){case"pending":r.queryHash===o.queryHash&&U(H);break;case"fulfilled":(O||N.data!==H.value)&&J();break;case"rejected":(!O||N.error!==H.reason)&&J();break}}return N}updateResult(){let r=c(this,Ce),s=this.createResult(c(this,G),this.options);if(E(this,Gt,c(this,G).state),E(this,yr,this.options),c(this,Gt).data!==void 0&&E(this,vr,c(this,G)),ur(s,r))return;E(this,Ce,s);let o=()=>{if(!r)return!0;let{notifyOnChangeProps:n}=this.options,i=typeof n=="function"?n():n;if(i==="all"||!i&&!c(this,br).size)return!0;let a=new Set(i??c(this,br));return this.options.throwOnError&&a.add("error"),Object.keys(c(this,Ce)).some(l=>{let f=l;return c(this,Ce)[f]!==r[f]&&a.has(f)})};L(this,W,Vn).call(this,{listeners:o()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&L(this,W,mo).call(this)}},ke=new WeakMap,G=new WeakMap,Br=new WeakMap,Ce=new WeakMap,Gt=new WeakMap,yr=new WeakMap,pt=new WeakMap,Tt=new WeakMap,Jr=new WeakMap,gr=new WeakMap,vr=new WeakMap,Bt=new WeakMap,Jt=new WeakMap,wt=new WeakMap,br=new WeakMap,W=new WeakSet,Gr=function(r){L(this,W,go).call(this);let s=c(this,G).fetch(this.options,r);return r?.throwOnError||(s=s.catch(ne)),s},co=function(){L(this,W,ho).call(this);let r=He(this.options.staleTime,c(this,G));if(Ze.isServer()||c(this,Ce).isStale||!Nr(r))return;let o=ws(c(this,Ce).dataUpdatedAt,r)+1;E(this,Bt,ze.setTimeout(()=>{c(this,Ce).isStale||this.updateResult()},o))},po=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(c(this,G)):this.options.refetchInterval)??!1},fo=function(r){L(this,W,yo).call(this),E(this,wt,r),!(Ze.isServer()||Ee(this.options.enabled,c(this,G))===!1||!Nr(c(this,wt))||c(this,wt)===0)&&E(this,Jt,ze.setInterval(()=>{(this.options.refetchIntervalInBackground||lr.isFocused())&&L(this,W,Gr).call(this)},c(this,wt)))},mo=function(){L(this,W,co).call(this),L(this,W,fo).call(this,L(this,W,po).call(this))},ho=function(){c(this,Bt)!==void 0&&(ze.clearTimeout(c(this,Bt)),E(this,Bt,void 0))},yo=function(){c(this,Jt)!==void 0&&(ze.clearInterval(c(this,Jt)),E(this,Jt,void 0))},go=function(){let r=c(this,ke).getQueryCache().build(c(this,ke),this.options);if(r===c(this,G))return;let s=c(this,G);E(this,G,r),E(this,Br,r.state),this.hasListeners()&&(s?.removeObserver(this),r.addObserver(this))},Vn=function(r){Y.batch(()=>{r.listeners&&this.listeners.forEach(s=>{s(c(this,Ce))}),c(this,ke).getQueryCache().notify({query:c(this,G),type:"observerResultsUpdated"})})},In);function ll(e,r){return Ee(r.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&Ee(r.retryOnMount,e)===!1)}function Nn(e,r){return ll(e,r)||e.state.data!==void 0&&vo(e,r,r.refetchOnMount)}function vo(e,r,s){if(Ee(r.enabled,e)!==!1&&He(r.staleTime,e)!=="static"){let o=typeof s=="function"?s(e):s;return o==="always"||o!==!1&&bo(e,r)}return!1}function jn(e,r,s,o){return(e!==r||Ee(o.enabled,e)===!1)&&(!s.suspense||e.state.status!=="error")&&bo(e,s)}function bo(e,r){return Ee(r.enabled,e)!==!1&&e.isStaleByTime(He(r.staleTime,e))}function ul(e,r){return!ur(e.getCurrentResult(),r)}var xo=class extends zr{constructor(e,r){super(e,r)}bindMethods(){super.bindMethods(),this.fetchNextPage=this.fetchNextPage.bind(this),this.fetchPreviousPage=this.fetchPreviousPage.bind(this)}setOptions(e){e._type="infinite",super.setOptions(e)}getOptimisticResult(e){return e._type="infinite",super.getOptimisticResult(e)}fetchNextPage(e){return this.fetch({...e,meta:{fetchMore:{direction:"forward"}}})}fetchPreviousPage(e){return this.fetch({...e,meta:{fetchMore:{direction:"backward"}}})}createResult(e,r){let{state:s}=e,o=super.createResult(e,r),{isFetching:n,isRefetching:i,isError:a,isRefetchError:l}=o,f=s.fetchMeta?.fetchMore?.direction,p=a&&f==="forward",h=n&&f==="forward",d=a&&f==="backward",y=n&&f==="backward";return{...o,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:On(r,s.data),hasPreviousPage:qn(r,s.data),isFetchNextPageError:p,isFetchingNextPage:h,isFetchPreviousPageError:d,isFetchingPreviousPage:y,isRefetchError:l&&!p&&!d,isRefetching:i&&!h&&!y}}};var Wr,Xe,be,zt,Ye,Et,Hn,$n=(Hn=class extends Ps{constructor(r){super();k(this,Ye);k(this,Wr);k(this,Xe);k(this,be);k(this,zt);E(this,Wr,r.client),this.mutationId=r.mutationId,E(this,be,r.mutationCache),E(this,Xe,[]),this.state=r.state||_o(),this.setOptions(r.options),this.scheduleGc()}setOptions(r){this.options=r,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(r){c(this,Xe).includes(r)||(c(this,Xe).push(r),this.clearGcTimeout(),c(this,be).notify({type:"observerAdded",mutation:this,observer:r}))}removeObserver(r){E(this,Xe,c(this,Xe).filter(s=>s!==r)),this.scheduleGc(),c(this,be).notify({type:"observerRemoved",mutation:this,observer:r})}optionalRemove(){c(this,Xe).length||(this.state.status==="pending"?this.scheduleGc():c(this,be).remove(this))}continue(){return c(this,zt)?.continue()??this.execute(this.state.variables)}async execute(r){let s=()=>{L(this,Ye,Et).call(this,{type:"continue"})},o={client:c(this,Wr),meta:this.options.meta,mutationKey:this.options.mutationKey};E(this,zt,Ss({fn:()=>this.options.mutationFn?this.options.mutationFn(r,o):Promise.reject(new Error("No mutationFn found")),onFail:(a,l)=>{L(this,Ye,Et).call(this,{type:"failed",failureCount:a,error:l})},onPause:()=>{L(this,Ye,Et).call(this,{type:"pause"})},onContinue:s,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>c(this,be).canRun(this)}));let n=this.state.status==="pending",i=!c(this,zt).canStart();try{if(n)s();else{L(this,Ye,Et).call(this,{type:"pending",variables:r,isPaused:i}),c(this,be).config.onMutate&&await c(this,be).config.onMutate(r,this,o);let l=await this.options.onMutate?.(r,o);l!==this.state.context&&L(this,Ye,Et).call(this,{type:"pending",context:l,variables:r,isPaused:i})}let a=await c(this,zt).start();return await c(this,be).config.onSuccess?.(a,r,this.state.context,this,o),await this.options.onSuccess?.(a,r,this.state.context,o),await c(this,be).config.onSettled?.(a,null,this.state.variables,this.state.context,this,o),await this.options.onSettled?.(a,null,r,this.state.context,o),L(this,Ye,Et).call(this,{type:"success",data:a}),a}catch(a){try{await c(this,be).config.onError?.(a,r,this.state.context,this,o)}catch(l){Promise.reject(l)}try{await this.options.onError?.(a,r,this.state.context,o)}catch(l){Promise.reject(l)}try{await c(this,be).config.onSettled?.(void 0,a,this.state.variables,this.state.context,this,o)}catch(l){Promise.reject(l)}try{await this.options.onSettled?.(void 0,a,r,this.state.context,o)}catch(l){Promise.reject(l)}throw L(this,Ye,Et).call(this,{type:"error",error:a}),a}finally{c(this,be).runNext(this)}}},Wr=new WeakMap,Xe=new WeakMap,be=new WeakMap,zt=new WeakMap,Ye=new WeakSet,Et=function(r){let s=o=>{switch(r.type){case"failed":return{...o,failureCount:r.failureCount,failureReason:r.error};case"pause":return{...o,isPaused:!0};case"continue":return{...o,isPaused:!1};case"pending":return{...o,context:r.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:r.isPaused,status:"pending",variables:r.variables,submittedAt:Date.now()};case"success":return{...o,data:r.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...o,data:void 0,error:r.error,failureCount:o.failureCount+1,failureReason:r.error,isPaused:!1,status:"error"}}};this.state=s(this.state),Y.batch(()=>{c(this,Xe).forEach(o=>{o.onMutationUpdate(r)}),c(this,be).notify({mutation:this,type:"updated",action:r})})},Hn);function _o(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var dt,$e,Zr,Gn,Bn=(Gn=class extends Qe{constructor(r={}){super();k(this,dt);k(this,$e);k(this,Zr);this.config=r,E(this,dt,new Set),E(this,$e,new Map),E(this,Zr,0)}build(r,s,o){let n=new $n({client:r,mutationCache:this,mutationId:++Kr(this,Zr)._,options:r.defaultMutationOptions(s),state:o});return this.add(n),n}add(r){c(this,dt).add(r);let s=As(r);if(typeof s=="string"){let o=c(this,$e).get(s);o?o.push(r):c(this,$e).set(s,[r])}this.notify({type:"added",mutation:r})}remove(r){if(c(this,dt).delete(r)){let s=As(r);if(typeof s=="string"){let o=c(this,$e).get(s);if(o)if(o.length>1){let n=o.indexOf(r);n!==-1&&o.splice(n,1)}else o[0]===r&&c(this,$e).delete(s)}}this.notify({type:"removed",mutation:r})}canRun(r){let s=As(r);if(typeof s=="string"){let n=c(this,$e).get(s)?.find(i=>i.state.status==="pending");return!n||n===r}else return!0}runNext(r){let s=As(r);return typeof s=="string"?c(this,$e).get(s)?.find(n=>n!==r&&n.state.isPaused)?.continue()??Promise.resolve():Promise.resolve()}clear(){Y.batch(()=>{c(this,dt).forEach(r=>{this.notify({type:"removed",mutation:r})}),c(this,dt).clear(),c(this,$e).clear()})}getAll(){return Array.from(c(this,dt))}find(r){let s={exact:!0,...r};return this.getAll().find(o=>Cs(s,o))}findAll(r={}){return this.getAll().filter(s=>Cs(r,s))}notify(r){Y.batch(()=>{this.listeners.forEach(s=>{s(r)})})}resumePausedMutations(){let r=this.getAll().filter(s=>s.state.isPaused);return Y.batch(()=>Promise.all(r.map(s=>s.continue().catch(ne))))}},dt=new WeakMap,$e=new WeakMap,Zr=new WeakMap,Gn);function As(e){return e.options.scope?.id}var ft,Ct,Se,mt,ht,Ms,To,Jn,wo=(Jn=class extends Qe{constructor(r,s){super();k(this,ht);k(this,ft);k(this,Ct);k(this,Se);k(this,mt);E(this,ft,r),this.setOptions(s),this.bindMethods(),L(this,ht,Ms).call(this)}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(r){let s=this.options;this.options=c(this,ft).defaultMutationOptions(r),ur(this.options,s)||c(this,ft).getMutationCache().notify({type:"observerOptionsUpdated",mutation:c(this,Se),observer:this}),s?.mutationKey&&this.options.mutationKey&&We(s.mutationKey)!==We(this.options.mutationKey)?this.reset():c(this,Se)?.state.status==="pending"&&c(this,Se).setOptions(this.options)}onUnsubscribe(){this.hasListeners()||c(this,Se)?.removeObserver(this)}onMutationUpdate(r){L(this,ht,Ms).call(this),L(this,ht,To).call(this,r)}getCurrentResult(){return c(this,Ct)}reset(){c(this,Se)?.removeObserver(this),E(this,Se,void 0),L(this,ht,Ms).call(this),L(this,ht,To).call(this)}mutate(r,s){return E(this,mt,s),c(this,Se)?.removeObserver(this),E(this,Se,c(this,ft).getMutationCache().build(c(this,ft),this.options)),c(this,Se).addObserver(this),c(this,Se).execute(r)}},ft=new WeakMap,Ct=new WeakMap,Se=new WeakMap,mt=new WeakMap,ht=new WeakSet,Ms=function(){let r=c(this,Se)?.state??_o();E(this,Ct,{...r,isPending:r.status==="pending",isSuccess:r.status==="success",isError:r.status==="error",isIdle:r.status==="idle",mutate:this.mutate,reset:this.reset})},To=function(r){Y.batch(()=>{if(c(this,mt)&&this.hasListeners()){let s=c(this,Ct).variables,o=c(this,Ct).context,n={client:c(this,ft),meta:this.options.meta,mutationKey:this.options.mutationKey};if(r?.type==="success"){try{c(this,mt).onSuccess?.(r.data,s,o,n)}catch(i){Promise.reject(i)}try{c(this,mt).onSettled?.(r.data,null,s,o,n)}catch(i){Promise.reject(i)}}else if(r?.type==="error"){try{c(this,mt).onError?.(r.error,s,o,n)}catch(i){Promise.reject(i)}try{c(this,mt).onSettled?.(void 0,r.error,s,o,n)}catch(i){Promise.reject(i)}}}this.listeners.forEach(s=>{s(c(this,Ct))})})},Jn);var et,zn,Wn=(zn=class extends Qe{constructor(r={}){super();k(this,et);this.config=r,E(this,et,new Map)}build(r,s,o){let n=s.queryKey,i=s.queryHash??jr(n,s),a=this.get(i);return a||(a=new Kn({client:r,queryKey:n,queryHash:i,options:r.defaultQueryOptions(s),state:o,defaultOptions:r.getQueryDefaults(n)}),this.add(a)),a}add(r){c(this,et).has(r.queryHash)||(c(this,et).set(r.queryHash,r),this.notify({type:"added",query:r}))}remove(r){let s=c(this,et).get(r.queryHash);s&&(r.destroy(),s===r&&c(this,et).delete(r.queryHash),this.notify({type:"removed",query:r}))}clear(){Y.batch(()=>{this.getAll().forEach(r=>{this.remove(r)})})}get(r){return c(this,et).get(r)}getAll(){return[...c(this,et).values()]}find(r){let s={exact:!0,...r};return this.getAll().find(o=>Es(s,o))}findAll(r={}){let s=this.getAll();return Object.keys(r).length>0?s.filter(o=>Es(r,o)):s}notify(r){Y.batch(()=>{this.listeners.forEach(s=>{s(r)})})}onFocus(){Y.batch(()=>{this.getAll().forEach(r=>{r.onFocus()})})}onOnline(){Y.batch(()=>{this.getAll().forEach(r=>{r.onOnline()})})}},et=new WeakMap,zn);var ie,Rt,kt,xr,_r,St,Tr,wr,Zn,Eo=(Zn=class{constructor(e={}){k(this,ie);k(this,Rt);k(this,kt);k(this,xr);k(this,_r);k(this,St);k(this,Tr);k(this,wr);E(this,ie,e.queryCache||new Wn),E(this,Rt,e.mutationCache||new Bn),E(this,kt,e.defaultOptions||{}),E(this,xr,new Map),E(this,_r,new Map),E(this,St,0)}mount(){Kr(this,St)._++,c(this,St)===1&&(E(this,Tr,lr.subscribe(async e=>{e&&(await this.resumePausedMutations(),c(this,ie).onFocus())})),E(this,wr,fr.subscribe(async e=>{e&&(await this.resumePausedMutations(),c(this,ie).onOnline())})))}unmount(){var e,r;Kr(this,St)._--,c(this,St)===0&&((e=c(this,Tr))==null||e.call(this),E(this,Tr,void 0),(r=c(this,wr))==null||r.call(this),E(this,wr,void 0))}isFetching(e){return c(this,ie).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return c(this,Rt).findAll({...e,status:"pending"}).length}getQueryData(e){let r=this.defaultQueryOptions({queryKey:e});return c(this,ie).get(r.queryHash)?.state.data}ensureQueryData(e){let r=this.defaultQueryOptions(e),s=c(this,ie).build(this,r),o=s.state.data;return o===void 0?this.fetchQuery(e):(e.revalidateIfStale&&s.isStaleByTime(He(r.staleTime,s))&&this.prefetchQuery(r),Promise.resolve(o))}getQueriesData(e){return c(this,ie).findAll(e).map(({queryKey:r,state:s})=>{let o=s.data;return[r,o]})}setQueryData(e,r,s){let o=this.defaultQueryOptions({queryKey:e}),i=c(this,ie).get(o.queryHash)?.state.data,a=wn(r,i);if(a!==void 0)return c(this,ie).build(this,o).setData(a,{...s,manual:!0})}setQueriesData(e,r,s){return Y.batch(()=>c(this,ie).findAll(e).map(({queryKey:o})=>[o,this.setQueryData(o,r,s)]))}getQueryState(e){let r=this.defaultQueryOptions({queryKey:e});return c(this,ie).get(r.queryHash)?.state}removeQueries(e){let r=c(this,ie);Y.batch(()=>{r.findAll(e).forEach(s=>{r.remove(s)})})}resetQueries(e,r){let s=c(this,ie);return Y.batch(()=>(s.findAll(e).forEach(o=>{o.reset()}),this.refetchQueries({type:"active",...e},r)))}cancelQueries(e,r={}){let s={revert:!0,...r},o=Y.batch(()=>c(this,ie).findAll(e).map(n=>n.cancel(s)));return Promise.all(o).then(ne).catch(ne)}invalidateQueries(e,r={}){return Y.batch(()=>(c(this,ie).findAll(e).forEach(s=>{s.invalidate()}),e?.refetchType==="none"?Promise.resolve():this.refetchQueries({...e,type:e?.refetchType??e?.type??"active"},r)))}refetchQueries(e,r={}){let s={...r,cancelRefetch:r.cancelRefetch??!0},o=Y.batch(()=>c(this,ie).findAll(e).filter(n=>!n.isDisabled()&&!n.isStatic()).map(n=>{let i=n.fetch(void 0,s);return s.throwOnError||(i=i.catch(ne)),n.state.fetchStatus==="paused"?Promise.resolve():i}));return Promise.all(o).then(ne)}fetchQuery(e){let r=this.defaultQueryOptions(e);r.retry===void 0&&(r.retry=!1);let s=c(this,ie).build(this,r);return s.isStaleByTime(He(r.staleTime,s))?s.fetch(r):Promise.resolve(s.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(ne).catch(ne)}fetchInfiniteQuery(e){return e._type="infinite",this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(ne).catch(ne)}ensureInfiniteQueryData(e){return e._type="infinite",this.ensureQueryData(e)}resumePausedMutations(){return fr.isOnline()?c(this,Rt).resumePausedMutations():Promise.resolve()}getQueryCache(){return c(this,ie)}getMutationCache(){return c(this,Rt)}getDefaultOptions(){return c(this,kt)}setDefaultOptions(e){E(this,kt,e)}setQueryDefaults(e,r){c(this,xr).set(We(e),{queryKey:e,defaultOptions:r})}getQueryDefaults(e){let r=[...c(this,xr).values()],s={};return r.forEach(o=>{jt(e,o.queryKey)&&Object.assign(s,o.defaultOptions)}),s}setMutationDefaults(e,r){c(this,_r).set(We(e),{mutationKey:e,defaultOptions:r})}getMutationDefaults(e){let r=[...c(this,_r).values()],s={};return r.forEach(o=>{jt(e,o.mutationKey)&&Object.assign(s,o.defaultOptions)}),s}defaultQueryOptions(e){if(e._defaulted)return e;let r={...c(this,kt).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return r.queryHash||(r.queryHash=jr(r.queryKey,r)),r.refetchOnReconnect===void 0&&(r.refetchOnReconnect=r.networkMode!=="always"),r.throwOnError===void 0&&(r.throwOnError=!!r.suspense),!r.networkMode&&r.persister&&(r.networkMode="offlineFirst"),r.queryFn===cr&&(r.enabled=!1),r}defaultMutationOptions(e){return e?._defaulted?e:{...c(this,kt).mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){c(this,ie).clear(),c(this,Rt).clear()}},ie=new WeakMap,Rt=new WeakMap,kt=new WeakMap,xr=new WeakMap,_r=new WeakMap,St=new WeakMap,Tr=new WeakMap,wr=new WeakMap,Zn);var Wt,re,Co,Xn,Xr=0,ii=[],ae=X,Yn=ae.__b,ei=ae.__r,ti=ae.diffed,ri=ae.__c,si=ae.unmount,oi=ae.__;function Yr(e,r){ae.__h&&ae.__h(re,e,Xr||r),Xr=0;var s=re.__H||(re.__H={__:[],__h:[]});return e>=s.__.length&&s.__.push({}),s.__[e]}function x(e){return Xr=1,cl(li,e)}function cl(e,r,s){var o=Yr(Wt++,2);if(o.t=e,!o.__c&&(o.__=[s?s(r):li(void 0,r),function(l){var f=o.__N?o.__N[0]:o.__[0],p=o.t(f,l);f!==p&&(o.__N=[p,o.__[1]],o.__c.setState({}))}],o.__c=re,!re.__f)){var n=function(l,f,p){if(!o.__c.__H)return!0;var h=o.__c.__H.__.filter(function(y){return y.__c});if(h.every(function(y){return!y.__N}))return!i||i.call(this,l,f,p);var d=o.__c.props!==l;return h.some(function(y){if(y.__N){var m=y.__[0];y.__=y.__N,y.__N=void 0,m!==y.__[0]&&(d=!0)}}),i&&i.call(this,l,f,p)||d};re.__f=!0;var i=re.shouldComponentUpdate,a=re.componentWillUpdate;re.componentWillUpdate=function(l,f,p){if(this.__e){var h=i;i=void 0,n(l,f,p),i=h}a&&a.call(this,l,f,p)},re.shouldComponentUpdate=n}return o.__N||o.__}function z(e,r){var s=Yr(Wt++,3);!ae.__s&&ko(s.__H,r)&&(s.__=e,s.u=r,re.__H.__h.push(s))}function ai(e,r){var s=Yr(Wt++,4);!ae.__s&&ko(s.__H,r)&&(s.__=e,s.u=r,re.__h.push(s))}function de(e){return Xr=5,Zt(function(){return{current:e}},[])}function Zt(e,r){var s=Yr(Wt++,7);return ko(s.__H,r)&&(s.__=e(),s.__H=r,s.__h=e),s.__}function Xt(e,r){return Xr=8,Zt(function(){return e},r)}function Er(e){var r=re.context[e.__c],s=Yr(Wt++,9);return s.c=e,r?(s.__==null&&(s.__=!0,r.sub(re)),r.props.value):e.__}function pl(){for(var e;e=ii.shift();){var r=e.__H;if(e.__P&&r)try{r.__h.some(Fs),r.__h.some(Ro),r.__h=[]}catch(s){r.__h=[],ae.__e(s,e.__v)}}}ae.__b=function(e){re=null,Yn&&Yn(e)},ae.__=function(e,r){e&&r.__k&&r.__k.__m&&(e.__m=r.__k.__m),oi&&oi(e,r)},ae.__r=function(e){ei&&ei(e),Wt=0;var r=(re=e.__c).__H;r&&(Co===re?(r.__h=[],re.__h=[],r.__.some(function(s){s.__N&&(s.__=s.__N),s.u=s.__N=void 0})):(r.__h.some(Fs),r.__h.some(Ro),r.__h=[],Wt=0)),Co=re},ae.diffed=function(e){ti&&ti(e);var r=e.__c;r&&r.__H&&(r.__H.__h.length&&(ii.push(r)!==1&&Xn===ae.requestAnimationFrame||((Xn=ae.requestAnimationFrame)||dl)(pl)),r.__H.__.some(function(s){s.u&&(s.__H=s.u),s.u=void 0})),Co=re=null},ae.__c=function(e,r){r.some(function(s){try{s.__h.some(Fs),s.__h=s.__h.filter(function(o){return!o.__||Ro(o)})}catch(o){r.some(function(n){n.__h&&(n.__h=[])}),r=[],ae.__e(o,s.__v)}}),ri&&ri(e,r)},ae.unmount=function(e){si&&si(e);var r,s=e.__c;s&&s.__H&&(s.__H.__.some(function(o){try{Fs(o)}catch(n){r=n}}),s.__H=void 0,r&&ae.__e(r,s.__v))};var ni=typeof requestAnimationFrame=="function";function dl(e){var r,s=function(){clearTimeout(o),ni&&cancelAnimationFrame(r),setTimeout(e)},o=setTimeout(s,35);ni&&(r=requestAnimationFrame(s))}function Fs(e){var r=re,s=e.__c;typeof s=="function"&&(e.__c=void 0,s()),re=r}function Ro(e){var r=re;e.__c=e.__(),re=r}function ko(e,r){return!e||e.length!==r.length||r.some(function(s,o){return s!==e[o]})}function li(e,r){return typeof r=="function"?r(e):r}var ui=ir(!1),ci=()=>Er(ui),kd=ui.Provider;var fl=0;function t(e,r,s,o,n,i){r||(r={});var a,l,f=r;if("ref"in f)for(l in f={},r)l=="ref"?a=r[l]:f[l]=r[l];var p={type:e,props:f,key:s,ref:a,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--fl,__i:-1,__u:0,__source:n,__self:i};if(typeof e=="function"&&(a=e.defaultProps))for(l in a)f[l]===void 0&&(f[l]=a[l]);return X.vnode&&X.vnode(p),p}var So=ir(void 0),es=e=>{let r=Er(So);if(e)return e;if(!r)throw new Error("No QueryClient set, use QueryClientProvider to set one");return r},Cr=({client:e,children:r})=>(z(()=>(e.mount(),()=>{e.unmount()}),[e]),t(So.Provider,{value:e,children:r}));function ml(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var hl=ir(ml()),pi=()=>Er(hl);var di=(e,r)=>{(e.suspense||e.throwOnError||e.experimental_prefetchInRender)&&(r.isReset()||(e.retryOnMount=!1))},fi=e=>{z(()=>{e.clearReset()},[e])},mi=({result:e,errorResetBoundary:r,throwOnError:s,query:o,suspense:n})=>e.isError&&!r.isReset()&&!e.isFetching&&o&&(n&&e.data===void 0||Vr(s,[e.error,o]));var hi=e=>{if(e.suspense){let s=n=>n==="static"?n:Math.max(n??1e3,1e3),o=e.staleTime;e.staleTime=typeof o=="function"?(...n)=>s(o(...n)):s(o),typeof e.gcTime=="number"&&(e.gcTime=Math.max(e.gcTime,1e3))}},yi=(e,r)=>e.isLoading&&e.isFetching&&!r,gi=(e,r)=>e?.suspense&&r.isPending,Po=(e,r,s)=>r.fetchOptimistic(e).catch(()=>{s.clearReset()});function Os(e,r){let s=r(),[{_instance:o},n]=x({_instance:{_value:s,_getSnapshot:r}});return ai(()=>{o._value=s,o._getSnapshot=r,Ao(o)&&n({_instance:o})},[e,s,r]),z(()=>(Ao(o)&&n({_instance:o}),e(()=>{Ao(o)&&n({_instance:o})})),[e]),s}function Ao(e){let r=e._getSnapshot,s=e._value;try{let o=r();return!Object.is(s,o)}catch{return!0}}function qs(e,r,s){let o=ci(),n=pi(),i=es(s),a=i.defaultQueryOptions(e);i.getDefaultOptions().queries?._experimental_beforeQuery?.(a),a._optimisticResults=o?"isRestoring":"optimistic",hi(a),di(a,n),fi(n);let l=!i.getQueryCache().get(a.queryHash),[f]=x(()=>new r(i,a)),p=f.getOptimisticResult(a),h=!o&&e.subscribed!==!1;if(Os(Xt(d=>{let y=h?f.subscribe(Y.batchCalls(d)):ne;return f.updateResult(),y},[f,h]),()=>f.getCurrentResult()),z(()=>{f.setOptions(a)},[a,f]),gi(a,p))throw Po(a,f,n);if(mi({result:p,errorResetBoundary:n,throwOnError:a.throwOnError,query:i.getQueryCache().get(a.queryHash),suspense:a.suspense}))throw p.error;return i.getDefaultOptions().queries?._experimental_afterQuery?.(a,p),a.experimental_prefetchInRender&&!Ze.isServer()&&yi(p,o)&&(l?Po(a,f,n):i.getQueryCache().get(a.queryHash)?.promise)?.catch(ne).finally(()=>{f.updateResult()}),a.notifyOnChangeProps?p:f.trackResult(p)}function Rr(e,r){return qs(e,zr,r)}function ye(e,r){let s=es(r),[o]=x(()=>new wo(s,e));z(()=>{o.setOptions(e)},[o,e]);let n=Os(Xt(a=>o.subscribe(Y.batchCalls(a)),[o]),()=>o.getCurrentResult()),i=Xt((a,l)=>{o.mutate(a,l).catch(ne)},[o]);if(n.error&&Vr(o.options.throwOnError,[n.error]))throw n.error;return{...n,mutate:i,mutateAsync:n.mutate}}function kr(e,r){return qs(e,xo,r)}var Mo="profiler-active-slave",Ds=(()=>{try{let e=sessionStorage.getItem(Mo);return e?`/slaves/${e}`:""}catch{return""}})();function vi(){return Ds}function bi(){return Ds?Ds.replace("/slaves/",""):null}function xi(e){try{e?sessionStorage.setItem(Mo,e):sessionStorage.removeItem(Mo)}catch{}Ds=e?`/slaves/${e}`:"",window.location.reload()}var yl="/_profiler/api/cluster/";async function se(e){let r=e.url.startsWith(yl)?"":vi(),s=r?e.url.replace("/_profiler/api",`/_profiler/api${r}`):e.url,{method:o,params:n,data:i,headers:a={},signal:l}=e,f=s,p=n?"?"+new URLSearchParams(Object.entries(n).map(([m,g])=>[m,String(g)])).toString():"",h={"X-Profiler-Request":"1",...a},d=await fetch(f+p,{method:o,signal:l,headers:i!==void 0?{"Content-Type":"application/json",...h}:h,body:i!==void 0?JSON.stringify(i):void 0});if(d.status===204)return{};let y=await d.json();if(!d.ok)throw Object.assign(new Error(y?.error??`HTTP ${d.status}`),{status:d.status,data:y});return y}var Pt=(e,r)=>{let s={queryKey:r};for(let o of Object.keys(e))o!=="queryKey"&&Object.defineProperty(s,o,{enumerable:!0,configurable:!0,get:()=>e[o]});return s};var gl=e=>se({url:"/_profiler/api/cluster/slaves",method:"GET",signal:e});var vl=()=>["/_profiler/api/cluster/slaves"];var bl=e=>{let{query:r}=e??{};return{queryKey:r?.queryKey??vl(),queryFn:({signal:n})=>gl(n),...r}};function _i(e){let r=bl(e),s=Rr(r);return Pt(s,r.queryKey)}var Fo=(e,r)=>se({url:"/_profiler/api/console",method:"GET",params:e,signal:r}),xl=e=>["infinite","/_profiler/api/console",...e?[e]:[]];var _l=(e,r)=>{let{query:s}=r??{};return{queryKey:s?.queryKey??xl(e),queryFn:({signal:i})=>Fo(e,i),...s}};function Ti(e,r){let s=_l(e,r),o=kr(s);return Pt(o,s.queryKey)}var Tl=(e,r)=>se({url:`/_profiler/api/console/${e}`,method:"DELETE",signal:r}),wl=()=>["deleteConsole"],El=e=>{let r=wl(),{mutation:s}=e?e.mutation&&"mutationKey"in e.mutation&&e.mutation.mutationKey?e:{...e,mutation:{...e.mutation,mutationKey:r}}:{mutation:{mutationKey:r}};return{mutationFn:n=>{let{id:i}=n??{};return Tl(i)},...s}},wi=e=>ye(El(e)),Cl=e=>se({url:"/_profiler/api/console/clear",method:"DELETE",signal:e}),Rl=()=>["clearConsoles"],kl=e=>{let r=Rl(),{mutation:s}=e?e.mutation&&"mutationKey"in e.mutation&&e.mutation.mutationKey?e:{...e,mutation:{...e.mutation,mutationKey:r}}:{mutation:{mutationKey:r}};return{mutationFn:()=>Cl(),...s}},Ei=e=>ye(kl(e)),Oo=e=>se({url:"/_profiler/api/env_vars",method:"GET",signal:e}),Sl=()=>["/_profiler/api/env_vars"],Pl=e=>{let{query:r}=e??{};return{queryKey:r?.queryKey??Sl(),queryFn:({signal:n})=>Oo(n),...r}};function Ci(e){let r=Pl(e),s=Rr(r);return Pt(s,r.queryKey)}var Al=(e,r)=>se({url:"/_profiler/api/env_vars",method:"PATCH",headers:{"Content-Type":"application/json"},data:e,signal:r}),Ml=()=>["updateEnvVar"],Fl=e=>{let r=Ml(),{mutation:s}=e?e.mutation&&"mutationKey"in e.mutation&&e.mutation.mutationKey?e:{...e,mutation:{...e.mutation,mutationKey:r}}:{mutation:{mutationKey:r}};return{mutationFn:n=>{let{data:i}=n??{};return Al(i)},...s}},Ri=e=>ye(Fl(e)),Ol=(e,r)=>se({url:"/_profiler/api/env_vars/reset",method:"DELETE",params:e,signal:r}),ql=()=>["resetEnvVar"],Dl=e=>{let r=ql(),{mutation:s}=e?e.mutation&&"mutationKey"in e.mutation&&e.mutation.mutationKey?e:{...e,mutation:{...e.mutation,mutationKey:r}}:{mutation:{mutationKey:r}};return{mutationFn:n=>{let{params:i}=n??{};return Ol(i)},...s}},ki=e=>ye(Dl(e)),Ql=e=>se({url:"/_profiler/api/env_vars/reset_all",method:"DELETE",signal:e}),Ll=()=>["resetAllEnvVars"],Kl=e=>{let r=Ll(),{mutation:s}=e?e.mutation&&"mutationKey"in e.mutation&&e.mutation.mutationKey?e:{...e,mutation:{...e.mutation,mutationKey:r}}:{mutation:{mutationKey:r}};return{mutationFn:()=>Ql(),...s}},Si=e=>ye(Kl(e));var Ul=(e,r)=>se({url:"/_profiler/api/explain",method:"POST",headers:{"Content-Type":"application/json"},data:e,signal:r}),Nl=()=>["explainQuery"],jl=e=>{let r=Nl(),{mutation:s}=e?e.mutation&&"mutationKey"in e.mutation&&e.mutation.mutationKey?e:{...e,mutation:{...e.mutation,mutationKey:r}}:{mutation:{mutationKey:r}};return{mutationFn:n=>{let{data:i}=n??{};return Ul(i)},...s}},Pi=e=>ye(jl(e));var Il=(e,r)=>se({url:"/_profiler/api/function_profiling",method:"PATCH",headers:{"Content-Type":"application/json"},data:e,signal:r}),Vl=()=>["updateFunctionProfiling"],Hl=e=>{let r=Vl(),{mutation:s}=e?e.mutation&&"mutationKey"in e.mutation&&e.mutation.mutationKey?e:{...e,mutation:{...e.mutation,mutationKey:r}}:{mutation:{mutationKey:r}};return{mutationFn:n=>{let{data:i}=n??{};return Il(i)},...s}},Ai=e=>ye(Hl(e)),qo=(e,r)=>se({url:"/_profiler/api/jobs",method:"GET",params:e,signal:r}),$l=e=>["infinite","/_profiler/api/jobs",...e?[e]:[]];var Gl=(e,r)=>{let{query:s}=r??{};return{queryKey:s?.queryKey??$l(e),queryFn:({signal:i})=>qo(e,i),...s}};function Mi(e,r){let s=Gl(e,r),o=kr(s);return Pt(o,s.queryKey)}var Bl=(e,r)=>se({url:`/_profiler/api/jobs/${e}`,method:"DELETE",signal:r}),Jl=()=>["deleteJob"],zl=e=>{let r=Jl(),{mutation:s}=e?e.mutation&&"mutationKey"in e.mutation&&e.mutation.mutationKey?e:{...e,mutation:{...e.mutation,mutationKey:r}}:{mutation:{mutationKey:r}};return{mutationFn:n=>{let{id:i}=n??{};return Bl(i)},...s}},Fi=e=>ye(zl(e)),Wl=e=>se({url:"/_profiler/api/jobs/clear",method:"DELETE",signal:e}),Zl=()=>["clearJobs"],Xl=e=>{let r=Zl(),{mutation:s}=e?e.mutation&&"mutationKey"in e.mutation&&e.mutation.mutationKey?e:{...e,mutation:{...e.mutation,mutationKey:r}}:{mutation:{mutationKey:r}};return{mutationFn:()=>Wl(),...s}},Oi=e=>ye(Xl(e)),Yl=e=>se({url:"/_profiler/api/outbound_http",method:"GET",signal:e}),eu=()=>["/_profiler/api/outbound_http"],tu=e=>{let{query:r}=e??{};return{queryKey:r?.queryKey??eu(),queryFn:({signal:n})=>Yl(n),...r}};function qi(e){let r=tu(e),s=Rr(r);return Pt(s,r.queryKey)}var Do=(e,r)=>se({url:"/_profiler/api/profiles",method:"GET",params:e,signal:r}),ru=e=>["infinite","/_profiler/api/profiles",...e?[e]:[]];var su=(e,r)=>{let{query:s}=r??{};return{queryKey:s?.queryKey??ru(e),queryFn:({signal:i})=>Do(e,i),...s}};function Di(e,r){let s=su(e,r),o=kr(s);return Pt(o,s.queryKey)}var ou=(e,r)=>se({url:`/_profiler/api/profiles/${e}`,method:"DELETE",signal:r}),nu=()=>["deleteProfile"],iu=e=>{let r=nu(),{mutation:s}=e?e.mutation&&"mutationKey"in e.mutation&&e.mutation.mutationKey?e:{...e,mutation:{...e.mutation,mutationKey:r}}:{mutation:{mutationKey:r}};return{mutationFn:n=>{let{id:i}=n??{};return ou(i)},...s}},Qi=e=>ye(iu(e)),au=e=>se({url:"/_profiler/api/profiles/clear",method:"DELETE",signal:e}),lu=()=>["clearProfiles"],uu=e=>{let r=lu(),{mutation:s}=e?e.mutation&&"mutationKey"in e.mutation&&e.mutation.mutationKey?e:{...e,mutation:{...e.mutation,mutationKey:r}}:{mutation:{mutationKey:r}};return{mutationFn:()=>au(),...s}},Li=e=>ye(uu(e)),cu=(e,r)=>se({url:"/_profiler/api/test_runner/files",method:"GET",params:e,signal:r}),pu=e=>["/_profiler/api/test_runner/files",...e?[e]:[]],du=(e,r)=>{let{query:s}=r??{};return{queryKey:s?.queryKey??pu(e),queryFn:({signal:i})=>cu(e,i),...s}};function Ki(e,r){let s=du(e,r),o=Rr(s);return Pt(o,s.queryKey)}var fu=(e,r)=>se({url:"/_profiler/api/test_runner/runs",method:"POST",headers:{"Content-Type":"application/json"},data:e,signal:r}),mu=()=>["createTestRun"],hu=e=>{let r=mu(),{mutation:s}=e?e.mutation&&"mutationKey"in e.mutation&&e.mutation.mutationKey?e:{...e,mutation:{...e.mutation,mutationKey:r}}:{mutation:{mutationKey:r}};return{mutationFn:n=>{let{data:i}=n??{};return fu(i)},...s}},Ui=e=>ye(hu(e));var yu=(e,r)=>se({url:`/_profiler/api/test_runner/runs/${e}`,method:"DELETE",signal:r}),gu=()=>["deleteTestRun"],vu=e=>{let r=gu(),{mutation:s}=e?e.mutation&&"mutationKey"in e.mutation&&e.mutation.mutationKey?e:{...e,mutation:{...e.mutation,mutationKey:r}}:{mutation:{mutationKey:r}};return{mutationFn:n=>{let{id:i}=n??{};return yu(i)},...s}},Ni=e=>ye(vu(e)),Qo=(e,r)=>se({url:"/_profiler/api/tests",method:"GET",params:e,signal:r}),bu=e=>["infinite","/_profiler/api/tests",...e?[e]:[]];var xu=(e,r)=>{let{query:s}=r??{};return{queryKey:s?.queryKey??bu(e),queryFn:({signal:i})=>Qo(e,i),...s}};function ji(e,r){let s=xu(e,r),o=kr(s);return Pt(o,s.queryKey)}var _u=(e,r)=>se({url:`/_profiler/api/tests/${e}`,method:"DELETE",signal:r}),Tu=()=>["deleteTest"],wu=e=>{let r=Tu(),{mutation:s}=e?e.mutation&&"mutationKey"in e.mutation&&e.mutation.mutationKey?e:{...e,mutation:{...e.mutation,mutationKey:r}}:{mutation:{mutationKey:r}};return{mutationFn:n=>{let{id:i}=n??{};return _u(i)},...s}},Ii=e=>ye(wu(e)),Eu=e=>se({url:"/_profiler/api/tests/clear",method:"DELETE",signal:e}),Cu=()=>["clearTests"],Ru=e=>{let r=Cu(),{mutation:s}=e?e.mutation&&"mutationKey"in e.mutation&&e.mutation.mutationKey?e:{...e,mutation:{...e.mutation,mutationKey:r}}:{mutation:{mutationKey:r}};return{mutationFn:()=>Eu(),...s}},Vi=e=>ye(Ru(e));async function At(e){if(typeof navigator<"u"&&navigator.clipboard?.writeText)try{return await navigator.clipboard.writeText(e),!0}catch{}return ku(e)}function ku(e){if(typeof document>"u"||typeof document.execCommand!="function")return!1;let r=document.createElement("textarea");r.value=e,r.setAttribute("readonly",""),r.setAttribute("aria-hidden","true"),r.style.cssText="position:fixed;top:0;left:0;width:1px;height:1px;opacity:0;pointer-events:none";let s=document.activeElement;document.body.appendChild(r);try{return r.select(),r.setSelectionRange(0,e.length),document.execCommand("copy")}catch{return!1}finally{document.body.removeChild(r),s?.focus?.()}}function Ge(){return document.querySelector('meta[name="profiler-version"]')?.content??""}function xe(e){return e.allocated_objects!=null?e.allocated_objects:e.memory!=null?Math.round(e.memory/40):null}function tt(e){return e==null?"-":`${e.toLocaleString("en")} objects`}var rt="Objects allocated by the whole process while this ran: on a multi-threaded server, it includes what other threads allocated meanwhile.";function ts(e){return{GET:"info",POST:"success",PUT:"warning",PATCH:"warning",DELETE:"error"}[e]||"default"}function Qs(e){return e===0?"error":e>=200&&e<300?"success":e>=400?"error":"warning"}function Sr(e){return e<0?"-":e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(2)} MB`}function Lo({text:e}){let[r,s]=x(null);function o(){At(e).then(n=>{s(n?"copied":"failed"),setTimeout(()=>s(null),2e3)})}return t("button",{onClick:o,class:"profiler-body-download-btn profiler-text--xs",style:"cursor:pointer",children:r==="copied"?"Copied!":r==="failed"?"Copy not available":"Copy"})}function Ji(e){let r=e.split(";")[0].trim().toLowerCase();return{"application/json":".json","application/ld+json":".jsonld","application/xml":".xml","text/xml":".xml","text/csv":".csv","application/csv":".csv","text/html":".html","text/plain":".txt","text/css":".css","application/javascript":".js","text/javascript":".js","image/svg+xml":".svg","image/png":".png","image/jpeg":".jpg","image/gif":".gif","image/webp":".webp","image/avif":".avif","application/pdf":".pdf","application/zip":".zip","application/gzip":".gz","application/octet-stream":".bin"}[r]||".bin"}function Hi({text:e,mime:r}){let[s,o]=x(null);return z(()=>{let n=URL.createObjectURL(new Blob([e],{type:"application/octet-stream"}));return o(n),()=>URL.revokeObjectURL(n)},[e,r]),s?t("a",{href:s,download:`body${Ji(r)}`,class:"profiler-body-download-btn profiler-text--xs",children:"Download"}):null}function $i({headers:e}){let r=Object.entries(e);return r.length?t("table",{class:"profiler-table profiler-table--compact",children:t("tbody",{children:r.map(([s,o])=>t("tr",{children:[t("td",{class:"profiler-text--xs profiler-text--muted",style:"white-space:nowrap;padding-right:16px",children:s}),t("td",{class:"profiler-text--xs",style:"word-break:break-all",children:o})]},s))})}):t("span",{class:"profiler-text--muted profiler-text--xs",children:"none"})}function Su(e){let s=(Object.entries(e).find(([o])=>o.toLowerCase()==="content-type")?.[1]||"").split(";")[0].trim().toLowerCase();return s.includes("json")?"json":s==="image/svg+xml"?"svg":s.startsWith("image/")?"image":s==="application/pdf"?"pdf":s.includes("xml")?"xml":s==="text/csv"||s==="application/csv"?"csv":s==="text/html"?"html":s.startsWith("application/")&&!s.includes("json")&&!s.includes("xml")&&!s.includes("javascript")?"binary":"text"}function Pu(e){try{let r=0;return e.replace(/>\s*</g,"><").replace(/(<\/?[^>]+>)/g,s=>{if(s.startsWith("</"))return r=Math.max(0,r-1),`
2
2
  `+" ".repeat(r)+s;if(s.endsWith("/>")||/<\?/.test(s))return`
3
3
  `+" ".repeat(r)+s;let o=`
4
- `+" ".repeat(r)+s;return r++,o}).trim()}catch{return e}}function xu(e){return e.split(`
5
- `).filter(Boolean).map(r=>{let s=[],o="",n=!1;for(let i=0;i<r.length;i++){let a=r[i];a==='"'?n=!n:a===","&&!n?(s.push(o),o=""):o+=a}return s.push(o),s})}function _u(e,r){if(r==="json")try{return JSON.stringify(JSON.parse(e),null,2)}catch{return e}return r==="xml"?bu(e):e}function Tu(e){return{json:"application/json",xml:"application/xml",csv:"text/csv",html:"text/html",svg:"image/svg+xml"}[e]||"text/plain"}var wu=["image/png","image/jpeg","image/gif","image/webp","image/avif","application/pdf"];function Eu(e){let r=e.toLowerCase();return wu.includes(r)?r:"application/octet-stream"}var Lo=500,Vi=10;function Hi({body:e,encoding:r,headers:s}){let[o,n]=b(!1),[i,a]=b(null),[l,f]=b(null),p=vu(s);if(B(()=>{if(r!=="base64"||!e)return;let g=Object.entries(s).find(([S])=>S.toLowerCase()==="content-type")?.[1]?.split(";")[0].trim()||"application/octet-stream",v=atob(e),_=new Uint8Array(v.length);for(let S=0;S<v.length;S++)_[S]=v.charCodeAt(S);let T=URL.createObjectURL(new Blob([_],{type:Eu(g)})),w=URL.createObjectURL(new Blob([_],{type:"application/octet-stream"}));return a(T),f(w),()=>{URL.revokeObjectURL(T),URL.revokeObjectURL(w)}},[e,r,s]),!e)return t("span",{class:"profiler-text--muted profiler-text--xs",children:"empty"});if(r==="base64"){let g=Object.entries(s).find(([_])=>_.toLowerCase()==="content-type")?.[1]?.split(";")[0].trim()||"application/octet-stream",v=`body${$i(g)}`;return t("div",{class:"profiler-body-binary",children:[i&&p==="image"&&t("img",{src:i,alt:"response preview",style:"max-width:100%;max-height:300px;display:block;margin-bottom:8px;border-radius:4px;border:1px solid var(--profiler-border)"}),p==="svg"&&t("img",{src:`data:image/svg+xml;base64,${e}`,alt:"response preview",style:"max-width:100%;max-height:300px;display:block;margin-bottom:8px;border-radius:4px;border:1px solid var(--profiler-border)"}),i&&p==="pdf"&&t("iframe",{src:i,class:"profiler-body-preview-frame",title:"PDF preview"}),t("div",{style:"display:flex;gap:8px;margin-top:4px",children:[l&&t("a",{href:l,download:v,class:"profiler-body-download-btn profiler-text--xs",children:["Download ",g]}),t(Qo,{text:e})]}),!i&&t("span",{class:"profiler-text--muted profiler-text--xs",children:"Loading preview\u2026"})]})}let h=Object.entries(s).find(([g])=>g.toLowerCase()==="content-type")?.[1]?.split(";")[0].trim()||Tu(p);if(p==="csv"){let g=xu(e),v=g[0]||[],_=g.slice(1),T=o?_:_.slice(0,Vi),w=_.length>Vi;return t("div",{children:[t("div",{style:"display:flex;gap:8px;margin-bottom:6px",children:[t(Qo,{text:e}),t(ji,{text:e,mime:h})]}),t("div",{style:"overflow-x:auto",children:t("table",{class:"profiler-body-csv",children:[t("thead",{children:t("tr",{children:v.map((S,M)=>t("th",{children:S},M))})}),t("tbody",{children:T.map((S,M)=>t("tr",{children:S.map((K,I)=>t("td",{children:K},I))},M))})]})}),w&&t("button",{class:"profiler-link profiler-text--xs",onClick:()=>n(S=>!S),style:"margin-top:4px;background:none;border:none;cursor:pointer;color:var(--profiler-accent);padding:0",children:o?"Show less":`Show all (${_.length} rows)`})]})}let d=_u(e,p),y=o?d:d.slice(0,Lo),m=d.length>Lo&&!o;return t("div",{children:[t("div",{style:"display:flex;gap:8px;margin-bottom:6px",children:[t(Qo,{text:d}),t(ji,{text:d,mime:h})]}),t("pre",{class:"profiler-code profiler-text--xs",style:"white-space:pre-wrap;word-break:break-all;margin:0",children:[y,m?"\u2026":""]}),d.length>Lo&&t("button",{class:"profiler-link profiler-text--xs",onClick:()=>n(g=>!g),style:"margin-top:4px;background:none;border:none;cursor:pointer;color:var(--profiler-accent);padding:0",children:o?"Show less":`Show all (${d.length} chars)`})]})}function Qs({request:e,response:r,backtrace:s}){return t("div",{style:"padding:12px 4px 4px;border-top:1px solid rgba(0,0,0,0.08);margin-top:8px",children:[t("div",{style:"margin-bottom:16px",children:[t("div",{class:"profiler-text--sm",style:"font-weight:600;margin-bottom:8px;color:var(--profiler-muted)",children:"REQUEST"}),t("div",{class:"profiler-text--xs profiler-text--muted",style:"margin-bottom:4px;text-transform:uppercase;letter-spacing:.5px",children:"Headers"}),t(Ii,{headers:e.headers}),e.params&&Object.keys(e.params).length>0&&!e.body&&t(P,{children:[t("div",{class:"profiler-text--xs profiler-text--muted",style:"margin-top:10px;margin-bottom:4px;text-transform:uppercase;letter-spacing:.5px",children:"Params"}),t("pre",{class:"profiler-code profiler-text--xs",style:"margin:0",children:JSON.stringify(e.params,null,2)})]}),e.body&&t(P,{children:[t("div",{class:"profiler-text--xs profiler-text--muted",style:"margin-top:10px;margin-bottom:4px;text-transform:uppercase;letter-spacing:.5px",children:"Body"}),t(Hi,{body:e.body,encoding:e.body_encoding,headers:e.headers})]})]}),t("div",{children:[t("div",{class:"profiler-text--sm",style:"font-weight:600;margin-bottom:8px;color:var(--profiler-muted)",children:"RESPONSE"}),t("div",{class:"profiler-text--xs profiler-text--muted",style:"margin-bottom:4px;text-transform:uppercase;letter-spacing:.5px",children:"Headers"}),t(Ii,{headers:r.headers}),r.body&&t(P,{children:[t("div",{class:"profiler-text--xs profiler-text--muted",style:"margin-top:10px;margin-bottom:4px;text-transform:uppercase;letter-spacing:.5px",children:"Body"}),t(Hi,{body:r.body,encoding:r.body_encoding,headers:r.headers})]})]}),s&&s.length>1&&t("div",{style:"margin-top:12px",children:[t("div",{class:"profiler-text--xs profiler-text--muted",style:"margin-bottom:4px;text-transform:uppercase;letter-spacing:.5px",children:"Backtrace"}),s.map((o,n)=>t("div",{class:"profiler-text--xs profiler-text--muted",style:"padding:2px 0",children:o},n))]})]})}function Ls({method:e,url:r,copyUrl:s,status:o,duration:n,curlCommand:i,expandable:a,open:l,onToggle:f}){let[p,h]=b(!1),[d,y]=b(!1);function m(v){v.stopPropagation(),navigator.clipboard.writeText(s??r).then(()=>{h(!0),setTimeout(()=>h(!1),2e3)})}function g(v){v.stopPropagation(),navigator.clipboard.writeText(i).then(()=>{y(!0),setTimeout(()=>y(!1),2e3)})}return t("div",{class:"profiler-ajax-card__row",style:a?"cursor:pointer;user-select:none":void 0,onClick:a?f:void 0,children:[t("div",{class:"profiler-flex profiler-flex--gap-3",style:"min-width:0;flex:1",children:[a&&t("span",{style:"font-size:11px;color:var(--profiler-muted)",children:l?"\u25BE":"\u25B8"}),t("span",{class:`profiler-ajax-card__method badge-${es(e)}`,children:e}),t("strong",{class:"profiler-ajax-card__path",style:"word-break:break-all",children:r}),t("button",{onClick:m,class:"profiler-body-download-btn profiler-text--xs",style:"flex-shrink:0;cursor:pointer",title:"Copy URL",children:p?"Copied!":"Copy URL"}),t("button",{onClick:g,class:"profiler-body-download-btn profiler-text--xs",style:"flex-shrink:0;cursor:pointer",title:"Copy as cURL",children:d?"Copied!":"Copy as cURL"})]}),t("div",{class:"profiler-flex profiler-flex--gap-2",style:"flex-shrink:0",children:[t("span",{class:`badge-${Ds(o)}`,children:o===0?"ERR":o}),t("span",{class:n>=500?"badge-error":n>=100?"badge-warning":"badge-success",children:[n.toFixed(2)," ms"]})]})]})}function Cu(e,r){return e===0||e>=500?"var(--profiler-error, #ef4444)":e>=400||r>=500?"var(--profiler-warning, #f59e0b)":"var(--profiler-success, #22c55e)"}function Ru({requests:e}){let r=e.filter(a=>a.started_at).map(a=>({...a,startMs:new Date(a.started_at).getTime()}));if(!r.length)return t("div",{class:"profiler-text--muted profiler-text--sm",children:"No timing data available (started_at missing)."});let s=Math.min(...r.map(a=>a.startMs)),n=Math.max(...r.map(a=>a.startMs+a.duration))-s||1,i=[0,.25,.5,.75,1].map(a=>({pct:a*100,label:`${Math.round(a*n)}ms`}));return t("div",{children:[t("div",{style:"display:flex;position:relative;margin-left:200px;margin-bottom:4px;height:16px",children:i.map(a=>t("div",{style:`position:absolute;left:${a.pct}%;font-size:10px;color:var(--profiler-text-muted);transform:translateX(-50%)`,children:a.label},a.pct))}),t("div",{style:"position:relative",children:[i.map(a=>t("div",{style:`position:absolute;left:calc(200px + ${a.pct}% * (100% - 200px) / 100);top:0;bottom:0;width:1px;background:var(--profiler-border);opacity:0.5;pointer-events:none`},a.pct)),r.map((a,l)=>{let f=(a.startMs-s)/n*100,p=Math.max(a.duration/n*100,.5),h=a.url.replace(/^https?:\/\/[^/]+/,"")||a.url,d=Cu(a.status,a.duration);return t("div",{style:"display:flex;align-items:center;gap:0;margin-bottom:3px;height:22px",children:[t("div",{title:a.url,style:"width:200px;flex-shrink:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:11px;color:var(--profiler-text-muted);padding-right:8px;text-align:right",children:[t("span",{style:`font-size:10px;font-weight:600;margin-right:4px;color:${d}`,children:a.method}),h]}),t("div",{style:"flex:1;position:relative;height:14px;background:var(--profiler-bg-lighter);border-radius:2px",children:t("div",{style:`position:absolute;left:${f}%;width:${p}%;min-width:2px;height:100%;background:${d};border-radius:2px;opacity:0.85`,title:`${a.duration.toFixed(2)}ms \xB7 ${a.status||"ERR"}`})}),t("div",{style:"width:52px;text-align:right;font-size:11px;color:var(--profiler-text-muted);padding-left:6px;flex-shrink:0",children:[a.duration.toFixed(0),"ms"]})]},l)})]}),t("div",{class:"profiler-text--xs profiler-text--muted",style:"margin-top:8px",children:["Total span: ",n.toFixed(0),"ms \xB7 ",r.length," request",r.length!==1?"s":""]})]})}function ku(e){let r=[`curl -X ${e.method}`],s=e.request_headers||{};for(let[o,n]of Object.entries(s))r.push(` -H ${JSON.stringify(`${o}: ${n}`)}`);return e.request_body&&e.request_body_encoding!=="base64"&&r.push(` -d ${JSON.stringify(e.request_body)}`),r.push(` ${JSON.stringify(e.url)}`),r.join(` \\
6
- `)}function Su(e){let r=[];return e.request_body_not_captured&&r.push("Request body not captured: a stream that cannot be rewound is sent unread."),e.request_body_truncated&&r.push("Request body truncated: only the beginning was kept (max_captured_body_bytes)."),e.response_body_truncated&&r.push("Response body truncated: only the beginning was kept (max_captured_body_bytes)."),r}function Ko({req:e,index:r,threshold:s}){let[o,n]=b(!1),i=e.status>=400||e.status===0,a=e.duration>=s;return t("div",{class:`profiler-ajax-card ${i?"profiler-ajax-card--error":a?"profiler-ajax-card--warning":"profiler-ajax-card--success"}`,style:"margin-bottom:8px",children:[t(Ls,{method:e.method,url:e.url,status:e.status,duration:e.duration,curlCommand:ku(e),expandable:!0,open:o,onToggle:()=>n(f=>!f)}),t("div",{class:"profiler-ajax-card__row",children:[t("span",{class:"profiler-text--xs profiler-text--muted",children:["\u2191 ",e.request_size==null?"size unknown":`${e.request_size_is_minimum?"at least ":""}${Rr(e.request_size)}`," \xB7 \u2193 ",Rr(e.response_size)]}),e.backtrace&&e.backtrace.length>0&&t("span",{class:"profiler-text--xs profiler-text--muted",style:"margin-left:12px",children:e.backtrace[0]})]}),Su(e).map(f=>t("div",{class:"profiler-ajax-card__row",children:t("span",{class:"profiler-text--xs profiler-text--muted",children:f})})),e.error&&t("div",{class:"profiler-ajax-card__row",children:t("span",{class:"profiler-text--xs profiler-text--error",children:e.error})}),o&&t(Qs,{request:{headers:e.request_headers||{},body:e.request_body??void 0,body_encoding:e.request_body_encoding},response:{headers:e.response_headers||{},body:e.response_body??void 0,body_encoding:e.response_body_encoding},backtrace:e.backtrace})]})}function kr({httpData:e}){if(!e?.requests?.length)return t("div",{class:"profiler-empty",children:[t("div",{class:"profiler-empty__icon",children:"\u{1F517}"}),t("h3",{class:"profiler-empty__title",children:"No outbound HTTP requests"}),t("p",{class:"profiler-empty__description",children:"External API calls made during this request will appear here."})]});let r=500,s=e.total_duration/e.total_requests;return t(P,{children:[t("h2",{class:"profiler-section__header",children:["Outbound HTTP (",e.total_requests,")"]}),t("div",{class:"profiler-flex profiler-flex--gap-4 profiler-mb-4 profiler-text--sm",children:[t("span",{children:["Total: ",t("strong",{children:[e.total_duration.toFixed(2)," ms"]})]}),t("span",{children:["Avg: ",t("strong",{children:[s.toFixed(2)," ms"]})]}),t("span",{children:["Slow (>",r,"ms): ",t("strong",{class:e.slow_requests>0?"profiler-text--error":"",children:e.slow_requests})]}),t("span",{children:["Errors: ",t("strong",{class:e.error_requests>0?"profiler-text--error":"",children:e.error_requests})]})]}),t("div",{class:"profiler-grid profiler-grid--2 profiler-mb-6",children:[t("div",{class:"profiler-panel profiler-panel--sm",children:[t("h3",{class:"profiler-text--sm profiler-text--muted profiler-text--uppercase profiler-mb-3",children:"By Host"}),Object.entries(e.by_host).map(([o,n])=>t("div",{class:"profiler-kv-row",children:[t("span",{class:"profiler-text--sm",children:o}),t("strong",{children:n})]},o))]}),t("div",{class:"profiler-panel profiler-panel--sm",children:[t("h3",{class:"profiler-text--sm profiler-text--muted profiler-text--uppercase profiler-mb-3",children:"By Status"}),Object.entries(e.by_status).map(([o,n])=>t("div",{class:"profiler-kv-row",children:[t("span",{class:`badge-${o.startsWith("2")?"success":o.startsWith("4")||o.startsWith("5")||o==="error"?"error":"warning"}`,children:o}),t("strong",{children:n})]},o))]})]}),t("h3",{class:"profiler-text--lg profiler-mb-3",children:"Requests"}),t(Ru,{requests:e.requests}),t("div",{style:"margin-top:16px",children:[t("p",{class:"profiler-text--xs profiler-text--muted profiler-mb-3",children:"Click a request to expand headers and body."}),e.requests.map((o,n)=>t(Ko,{req:o,index:n,threshold:r},n))]})]})}var Gi="[FILTERED]";function Pu(e){return e===""?{label:"empty",color:"var(--profiler-text-muted)"}:/^(true|false|yes|no)$/i.test(e)?{label:"bool",color:"#a78bfa"}:/^\d+$/.test(e)?{label:"int",color:"var(--profiler-success,#22c55e)"}:/^\d+\.\d+$/.test(e)?{label:"float",color:"var(--profiler-success,#22c55e)"}:{label:"string",color:"var(--profiler-text-muted)"}}function Au(e){let r=e.indexOf("_");return r>0?e.slice(0,r):"OTHER"}function Mu(e){let r={};for(let s of e.split(`
7
- `)){let o=s.trim();if(!o||o.startsWith("#"))continue;let n=o.indexOf("=");if(n<1)continue;let i=o.slice(0,n).trim(),a=o.slice(n+1);(a.startsWith('"')&&a.endsWith('"')||a.startsWith("'")&&a.endsWith("'"))&&(a=a.slice(1,-1)),r[i]=a}return r}function Fu(){try{let e=localStorage.getItem("profiler_unmasked_env_keys");return e?new Set(JSON.parse(e)):new Set}catch{return new Set}}function Uo(e){try{localStorage.setItem("profiler_unmasked_env_keys",JSON.stringify([...e]))}catch{}}function Bi({value:e}){let r=Pu(e);return r?t("span",{style:{display:"inline-block",padding:"0 5px",borderRadius:"3px",fontSize:"10px",fontWeight:600,fontFamily:"monospace",border:`1px solid ${r.color}`,color:r.color,marginRight:"6px",verticalAlign:"middle",lineHeight:"16px",flexShrink:0},children:r.label}):null}function Ji(e){return/^(true|false|yes|no)$/i.test(e)}function No(e){return!(e===""||Ji(e)||/^\d+(\.\d+)?$/.test(e))}function st({envData:e,readOnly:r=!1}){let[s,o]=b(()=>({...e?.variables??{}})),[n,i]=b(s),[a,l]=b(e?.overrides??{}),[f,p]=b(e?.total??0),[h,d]=b(""),[y,m]=b(new Set),[g,v]=b(null),[_,T]=b(""),[w,S]=b(""),[M,K]=b(""),[I,se]=b(null),[N,D]=b(!1),[O,U]=b(!1),[z,H]=b(Fu),[le,ce]=b(null),[Z,Pe]=b(r),[Ke,Ue]=b(!1),[qe,ge]=b(""),_e=de(null),{mutateAsync:Ae}=wi(),{mutateAsync:ot}=Ei(),{mutateAsync:R}=Ci();B(()=>{g!==null&&_e.current?.focus()},[g]),B(()=>{r||Q()},[]);let j=(x,q)=>{se({type:x,message:q}),setTimeout(()=>se(null),3e3)},Te=x=>{H(q=>{let F=new Set(q);return F.has(x)?F.delete(x):F.add(x),Uo(F),F})},nt=async(x,q)=>{try{await navigator.clipboard.writeText(x),ce(q),setTimeout(()=>ce(null),1500)}catch{j("error","Clipboard access denied")}},Xt=x=>{m(q=>{let F=new Set(q);return F.has(x)?F.delete(x):F.add(x),F})},Q=async()=>{U(!0);try{let x=await Fo();return i(x.variables),p(x.total),l(x.overrides??{}),j("success",`Refreshed - ${x.total} variables`),x}catch(x){j("error",x.message??"Failed to refresh")}finally{U(!1)}},J=()=>{let x=at,q=x.map(([we,Ie])=>`${we}=${Ie}`).join(`
4
+ `+" ".repeat(r)+s;return r++,o}).trim()}catch{return e}}function Au(e){return e.split(`
5
+ `).filter(Boolean).map(r=>{let s=[],o="",n=!1;for(let i=0;i<r.length;i++){let a=r[i];a==='"'?n=!n:a===","&&!n?(s.push(o),o=""):o+=a}return s.push(o),s})}function Mu(e,r){if(r==="json")try{return JSON.stringify(JSON.parse(e),null,2)}catch{return e}return r==="xml"?Pu(e):e}function Fu(e){return{json:"application/json",xml:"application/xml",csv:"text/csv",html:"text/html",svg:"image/svg+xml"}[e]||"text/plain"}var Ou=["image/png","image/jpeg","image/gif","image/webp","image/avif","application/pdf"];function qu(e){let r=e.toLowerCase();return Ou.includes(r)?r:"application/octet-stream"}var Ko=500,Gi=10;function Bi({body:e,encoding:r,headers:s}){let[o,n]=x(!1),[i,a]=x(null),[l,f]=x(null),p=Su(s);if(z(()=>{if(r!=="base64"||!e)return;let g=Object.entries(s).find(([S])=>S.toLowerCase()==="content-type")?.[1]?.split(";")[0].trim()||"application/octet-stream",v=atob(e),_=new Uint8Array(v.length);for(let S=0;S<v.length;S++)_[S]=v.charCodeAt(S);let T=URL.createObjectURL(new Blob([_],{type:qu(g)})),w=URL.createObjectURL(new Blob([_],{type:"application/octet-stream"}));return a(T),f(w),()=>{URL.revokeObjectURL(T),URL.revokeObjectURL(w)}},[e,r,s]),!e)return t("span",{class:"profiler-text--muted profiler-text--xs",children:"empty"});if(r==="base64"){let g=Object.entries(s).find(([_])=>_.toLowerCase()==="content-type")?.[1]?.split(";")[0].trim()||"application/octet-stream",v=`body${Ji(g)}`;return t("div",{class:"profiler-body-binary",children:[i&&p==="image"&&t("img",{src:i,alt:"response preview",style:"max-width:100%;max-height:300px;display:block;margin-bottom:8px;border-radius:4px;border:1px solid var(--profiler-border)"}),p==="svg"&&t("img",{src:`data:image/svg+xml;base64,${e}`,alt:"response preview",style:"max-width:100%;max-height:300px;display:block;margin-bottom:8px;border-radius:4px;border:1px solid var(--profiler-border)"}),i&&p==="pdf"&&t("iframe",{src:i,class:"profiler-body-preview-frame",title:"PDF preview"}),t("div",{style:"display:flex;gap:8px;margin-top:4px",children:[l&&t("a",{href:l,download:v,class:"profiler-body-download-btn profiler-text--xs",children:["Download ",g]}),t(Lo,{text:e})]}),!i&&t("span",{class:"profiler-text--muted profiler-text--xs",children:"Loading preview\u2026"})]})}let h=Object.entries(s).find(([g])=>g.toLowerCase()==="content-type")?.[1]?.split(";")[0].trim()||Fu(p);if(p==="csv"){let g=Au(e),v=g[0]||[],_=g.slice(1),T=o?_:_.slice(0,Gi),w=_.length>Gi;return t("div",{children:[t("div",{style:"display:flex;gap:8px;margin-bottom:6px",children:[t(Lo,{text:e}),t(Hi,{text:e,mime:h})]}),t("div",{style:"overflow-x:auto",children:t("table",{class:"profiler-body-csv",children:[t("thead",{children:t("tr",{children:v.map((S,M)=>t("th",{children:S},M))})}),t("tbody",{children:T.map((S,M)=>t("tr",{children:S.map((K,I)=>t("td",{children:K},I))},M))})]})}),w&&t("button",{class:"profiler-link profiler-text--xs",onClick:()=>n(S=>!S),style:"margin-top:4px;background:none;border:none;cursor:pointer;color:var(--profiler-accent);padding:0",children:o?"Show less":`Show all (${_.length} rows)`})]})}let d=Mu(e,p),y=o?d:d.slice(0,Ko),m=d.length>Ko&&!o;return t("div",{children:[t("div",{style:"display:flex;gap:8px;margin-bottom:6px",children:[t(Lo,{text:d}),t(Hi,{text:d,mime:h})]}),t("pre",{class:"profiler-code profiler-text--xs",style:"white-space:pre-wrap;word-break:break-all;margin:0",children:[y,m?"\u2026":""]}),d.length>Ko&&t("button",{class:"profiler-link profiler-text--xs",onClick:()=>n(g=>!g),style:"margin-top:4px;background:none;border:none;cursor:pointer;color:var(--profiler-accent);padding:0",children:o?"Show less":`Show all (${d.length} chars)`})]})}function Ls({request:e,response:r,backtrace:s}){return t("div",{style:"padding:12px 4px 4px;border-top:1px solid rgba(0,0,0,0.08);margin-top:8px",children:[t("div",{style:"margin-bottom:16px",children:[t("div",{class:"profiler-text--sm",style:"font-weight:600;margin-bottom:8px;color:var(--profiler-muted)",children:"REQUEST"}),t("div",{class:"profiler-text--xs profiler-text--muted",style:"margin-bottom:4px;text-transform:uppercase;letter-spacing:.5px",children:"Headers"}),t($i,{headers:e.headers}),e.params&&Object.keys(e.params).length>0&&!e.body&&t(P,{children:[t("div",{class:"profiler-text--xs profiler-text--muted",style:"margin-top:10px;margin-bottom:4px;text-transform:uppercase;letter-spacing:.5px",children:"Params"}),t("pre",{class:"profiler-code profiler-text--xs",style:"margin:0",children:JSON.stringify(e.params,null,2)})]}),e.body&&t(P,{children:[t("div",{class:"profiler-text--xs profiler-text--muted",style:"margin-top:10px;margin-bottom:4px;text-transform:uppercase;letter-spacing:.5px",children:"Body"}),t(Bi,{body:e.body,encoding:e.body_encoding,headers:e.headers})]})]}),t("div",{children:[t("div",{class:"profiler-text--sm",style:"font-weight:600;margin-bottom:8px;color:var(--profiler-muted)",children:"RESPONSE"}),t("div",{class:"profiler-text--xs profiler-text--muted",style:"margin-bottom:4px;text-transform:uppercase;letter-spacing:.5px",children:"Headers"}),t($i,{headers:r.headers}),r.body&&t(P,{children:[t("div",{class:"profiler-text--xs profiler-text--muted",style:"margin-top:10px;margin-bottom:4px;text-transform:uppercase;letter-spacing:.5px",children:"Body"}),t(Bi,{body:r.body,encoding:r.body_encoding,headers:r.headers})]})]}),s&&s.length>1&&t("div",{style:"margin-top:12px",children:[t("div",{class:"profiler-text--xs profiler-text--muted",style:"margin-bottom:4px;text-transform:uppercase;letter-spacing:.5px",children:"Backtrace"}),s.map((o,n)=>t("div",{class:"profiler-text--xs profiler-text--muted",style:"padding:2px 0",children:o},n))]})]})}function Ks({method:e,url:r,copyUrl:s,status:o,duration:n,curlCommand:i,expandable:a,open:l,onToggle:f}){let[p,h]=x(!1),[d,y]=x(!1);function m(v){v.stopPropagation(),At(s??r).then(_=>{_&&(h(!0),setTimeout(()=>h(!1),2e3))})}function g(v){v.stopPropagation(),At(i).then(_=>{_&&(y(!0),setTimeout(()=>y(!1),2e3))})}return t("div",{class:"profiler-ajax-card__row",style:a?"cursor:pointer;user-select:none":void 0,onClick:a?f:void 0,children:[t("div",{class:"profiler-flex profiler-flex--gap-3",style:"min-width:0;flex:1",children:[a&&t("span",{style:"font-size:11px;color:var(--profiler-muted)",children:l?"\u25BE":"\u25B8"}),t("span",{class:`profiler-ajax-card__method badge-${ts(e)}`,children:e}),t("strong",{class:"profiler-ajax-card__path",style:"word-break:break-all",children:r}),t("button",{onClick:m,class:"profiler-body-download-btn profiler-text--xs",style:"flex-shrink:0;cursor:pointer",title:"Copy URL",children:p?"Copied!":"Copy URL"}),t("button",{onClick:g,class:"profiler-body-download-btn profiler-text--xs",style:"flex-shrink:0;cursor:pointer",title:"Copy as cURL",children:d?"Copied!":"Copy as cURL"})]}),t("div",{class:"profiler-flex profiler-flex--gap-2",style:"flex-shrink:0",children:[t("span",{class:`badge-${Qs(o)}`,children:o===0?"ERR":o}),t("span",{class:n>=500?"badge-error":n>=100?"badge-warning":"badge-success",children:[n.toFixed(2)," ms"]})]})]})}function Du(e,r){return e===0||e>=500?"var(--profiler-error, #ef4444)":e>=400||r>=500?"var(--profiler-warning, #f59e0b)":"var(--profiler-success, #22c55e)"}function Qu({requests:e}){let r=e.filter(a=>a.started_at).map(a=>({...a,startMs:new Date(a.started_at).getTime()}));if(!r.length)return t("div",{class:"profiler-text--muted profiler-text--sm",children:"No timing data available (started_at missing)."});let s=Math.min(...r.map(a=>a.startMs)),n=Math.max(...r.map(a=>a.startMs+a.duration))-s||1,i=[0,.25,.5,.75,1].map(a=>({pct:a*100,label:`${Math.round(a*n)}ms`}));return t("div",{children:[t("div",{style:"display:flex;position:relative;margin-left:200px;margin-bottom:4px;height:16px",children:i.map(a=>t("div",{style:`position:absolute;left:${a.pct}%;font-size:10px;color:var(--profiler-text-muted);transform:translateX(-50%)`,children:a.label},a.pct))}),t("div",{style:"position:relative",children:[i.map(a=>t("div",{style:`position:absolute;left:calc(200px + ${a.pct}% * (100% - 200px) / 100);top:0;bottom:0;width:1px;background:var(--profiler-border);opacity:0.5;pointer-events:none`},a.pct)),r.map((a,l)=>{let f=(a.startMs-s)/n*100,p=Math.max(a.duration/n*100,.5),h=a.url.replace(/^https?:\/\/[^/]+/,"")||a.url,d=Du(a.status,a.duration);return t("div",{style:"display:flex;align-items:center;gap:0;margin-bottom:3px;height:22px",children:[t("div",{title:a.url,style:"width:200px;flex-shrink:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:11px;color:var(--profiler-text-muted);padding-right:8px;text-align:right",children:[t("span",{style:`font-size:10px;font-weight:600;margin-right:4px;color:${d}`,children:a.method}),h]}),t("div",{style:"flex:1;position:relative;height:14px;background:var(--profiler-bg-lighter);border-radius:2px",children:t("div",{style:`position:absolute;left:${f}%;width:${p}%;min-width:2px;height:100%;background:${d};border-radius:2px;opacity:0.85`,title:`${a.duration.toFixed(2)}ms \xB7 ${a.status||"ERR"}`})}),t("div",{style:"width:52px;text-align:right;font-size:11px;color:var(--profiler-text-muted);padding-left:6px;flex-shrink:0",children:[a.duration.toFixed(0),"ms"]})]},l)})]}),t("div",{class:"profiler-text--xs profiler-text--muted",style:"margin-top:8px",children:["Total span: ",n.toFixed(0),"ms \xB7 ",r.length," request",r.length!==1?"s":""]})]})}function Lu(e){let r=[`curl -X ${e.method}`],s=e.request_headers||{};for(let[o,n]of Object.entries(s))r.push(` -H ${JSON.stringify(`${o}: ${n}`)}`);return e.request_body&&e.request_body_encoding!=="base64"&&r.push(` -d ${JSON.stringify(e.request_body)}`),r.push(` ${JSON.stringify(e.url)}`),r.join(` \\
6
+ `)}function Ku(e){let r=[];return e.request_body_not_captured&&r.push("Request body not captured: a stream that cannot be rewound is sent unread."),e.request_body_truncated&&r.push("Request body truncated: only the beginning was kept (max_captured_body_bytes)."),e.response_body_truncated&&r.push("Response body truncated: only the beginning was kept (max_captured_body_bytes)."),r}function Uo({req:e,index:r,threshold:s}){let[o,n]=x(!1),i=e.status>=400||e.status===0,a=e.duration>=s;return t("div",{class:`profiler-ajax-card ${i?"profiler-ajax-card--error":a?"profiler-ajax-card--warning":"profiler-ajax-card--success"}`,style:"margin-bottom:8px",children:[t(Ks,{method:e.method,url:e.url,status:e.status,duration:e.duration,curlCommand:Lu(e),expandable:!0,open:o,onToggle:()=>n(f=>!f)}),t("div",{class:"profiler-ajax-card__row",children:[t("span",{class:"profiler-text--xs profiler-text--muted",children:["\u2191 ",e.request_size==null?"size unknown":`${e.request_size_is_minimum?"at least ":""}${Sr(e.request_size)}`," \xB7 \u2193 ",Sr(e.response_size)]}),e.backtrace&&e.backtrace.length>0&&t("span",{class:"profiler-text--xs profiler-text--muted",style:"margin-left:12px",children:e.backtrace[0]})]}),Ku(e).map(f=>t("div",{class:"profiler-ajax-card__row",children:t("span",{class:"profiler-text--xs profiler-text--muted",children:f})})),e.error&&t("div",{class:"profiler-ajax-card__row",children:t("span",{class:"profiler-text--xs profiler-text--error",children:e.error})}),o&&t(Ls,{request:{headers:e.request_headers||{},body:e.request_body??void 0,body_encoding:e.request_body_encoding},response:{headers:e.response_headers||{},body:e.response_body??void 0,body_encoding:e.response_body_encoding},backtrace:e.backtrace})]})}function Pr({httpData:e}){if(!e?.requests?.length)return t("div",{class:"profiler-empty",children:[t("div",{class:"profiler-empty__icon",children:"\u{1F517}"}),t("h3",{class:"profiler-empty__title",children:"No outbound HTTP requests"}),t("p",{class:"profiler-empty__description",children:"External API calls made during this request will appear here."})]});let r=500,s=e.total_duration/e.total_requests;return t(P,{children:[t("h2",{class:"profiler-section__header",children:["Outbound HTTP (",e.total_requests,")"]}),t("div",{class:"profiler-flex profiler-flex--gap-4 profiler-mb-4 profiler-text--sm",children:[t("span",{children:["Total: ",t("strong",{children:[e.total_duration.toFixed(2)," ms"]})]}),t("span",{children:["Avg: ",t("strong",{children:[s.toFixed(2)," ms"]})]}),t("span",{children:["Slow (>",r,"ms): ",t("strong",{class:e.slow_requests>0?"profiler-text--error":"",children:e.slow_requests})]}),t("span",{children:["Errors: ",t("strong",{class:e.error_requests>0?"profiler-text--error":"",children:e.error_requests})]})]}),t("div",{class:"profiler-grid profiler-grid--2 profiler-mb-6",children:[t("div",{class:"profiler-panel profiler-panel--sm",children:[t("h3",{class:"profiler-text--sm profiler-text--muted profiler-text--uppercase profiler-mb-3",children:"By Host"}),Object.entries(e.by_host).map(([o,n])=>t("div",{class:"profiler-kv-row",children:[t("span",{class:"profiler-text--sm",children:o}),t("strong",{children:n})]},o))]}),t("div",{class:"profiler-panel profiler-panel--sm",children:[t("h3",{class:"profiler-text--sm profiler-text--muted profiler-text--uppercase profiler-mb-3",children:"By Status"}),Object.entries(e.by_status).map(([o,n])=>t("div",{class:"profiler-kv-row",children:[t("span",{class:`badge-${o.startsWith("2")?"success":o.startsWith("4")||o.startsWith("5")||o==="error"?"error":"warning"}`,children:o}),t("strong",{children:n})]},o))]})]}),t("h3",{class:"profiler-text--lg profiler-mb-3",children:"Requests"}),t(Qu,{requests:e.requests}),t("div",{style:"margin-top:16px",children:[t("p",{class:"profiler-text--xs profiler-text--muted profiler-mb-3",children:"Click a request to expand headers and body."}),e.requests.map((o,n)=>t(Uo,{req:o,index:n,threshold:r},n))]})]})}var zi="[FILTERED]";function Uu(e){return e===""?{label:"empty",color:"var(--profiler-text-muted)"}:/^(true|false|yes|no)$/i.test(e)?{label:"bool",color:"#a78bfa"}:/^\d+$/.test(e)?{label:"int",color:"var(--profiler-success,#22c55e)"}:/^\d+\.\d+$/.test(e)?{label:"float",color:"var(--profiler-success,#22c55e)"}:{label:"string",color:"var(--profiler-text-muted)"}}function Nu(e){let r=e.indexOf("_");return r>0?e.slice(0,r):"OTHER"}function ju(e){let r={};for(let s of e.split(`
7
+ `)){let o=s.trim();if(!o||o.startsWith("#"))continue;let n=o.indexOf("=");if(n<1)continue;let i=o.slice(0,n).trim(),a=o.slice(n+1);(a.startsWith('"')&&a.endsWith('"')||a.startsWith("'")&&a.endsWith("'"))&&(a=a.slice(1,-1)),r[i]=a}return r}function Iu(){try{let e=localStorage.getItem("profiler_unmasked_env_keys");return e?new Set(JSON.parse(e)):new Set}catch{return new Set}}function No(e){try{localStorage.setItem("profiler_unmasked_env_keys",JSON.stringify([...e]))}catch{}}function Wi({value:e}){let r=Uu(e);return r?t("span",{style:{display:"inline-block",padding:"0 5px",borderRadius:"3px",fontSize:"10px",fontWeight:600,fontFamily:"monospace",border:`1px solid ${r.color}`,color:r.color,marginRight:"6px",verticalAlign:"middle",lineHeight:"16px",flexShrink:0},children:r.label}):null}function Zi(e){return/^(true|false|yes|no)$/i.test(e)}function jo(e){return!(e===""||Zi(e)||/^\d+(\.\d+)?$/.test(e))}function st({envData:e,readOnly:r=!1}){let[s,o]=x(()=>({...e?.variables??{}})),[n,i]=x(s),[a,l]=x(e?.overrides??{}),[f,p]=x(e?.total??0),[h,d]=x(""),[y,m]=x(new Set),[g,v]=x(null),[_,T]=x(""),[w,S]=x(""),[M,K]=x(""),[I,oe]=x(null),[N,D]=x(!1),[O,U]=x(!1),[J,H]=x(Iu),[le,ce]=x(null),[Z,Pe]=x(r),[Ke,Ue]=x(!1),[qe,ge]=x(""),_e=de(null),{mutateAsync:Ae}=Ri(),{mutateAsync:ot}=ki(),{mutateAsync:R}=Si();z(()=>{g!==null&&_e.current?.focus()},[g]),z(()=>{r||Q()},[]);let j=(b,q)=>{oe({type:b,message:q}),setTimeout(()=>oe(null),3e3)},Te=b=>{H(q=>{let F=new Set(q);return F.has(b)?F.delete(b):F.add(b),No(F),F})},nt=async(b,q)=>{await At(b)?(ce(q),setTimeout(()=>ce(null),1500)):j("error","Copy is not available in this browser: select the value and copy it by hand")},Yt=b=>{m(q=>{let F=new Set(q);return F.has(b)?F.delete(b):F.add(b),F})},Q=async()=>{U(!0);try{let b=await Oo();return i(b.variables),p(b.total),l(b.overrides??{}),j("success",`Refreshed - ${b.total} variables`),b}catch(b){j("error",b.message??"Failed to refresh")}finally{U(!1)}},B=()=>{let b=at,q=b.map(([we,Ie])=>`${we}=${Ie}`).join(`
8
8
  `)+`
9
- `,F=new Blob([q],{type:"text/plain"}),A=URL.createObjectURL(F),$=document.createElement("a");$.href=A,$.download=".env",$.click(),URL.revokeObjectURL(A),j("success",`Exported ${x.length} variables`)},Ne=zt(()=>Mu(qe),[qe]),Me=zt(()=>Object.fromEntries(Object.entries(Ne).filter(([,x])=>x!==Gi)),[Ne]),Fe=Object.keys(Me).length,De=Object.keys(Ne).length-Fe,Dt=async()=>{let x=Object.entries(Me);if(x.length){D(!0);try{await Promise.all(x.map(([F,A])=>Ae({data:{key:F,value:A}}))),i(F=>({...F,...Me})),ge(""),Ue(!1);let q=De>0?`, skipped ${De} masked`:"";j("success",`Imported ${x.length} variables${q}`)}catch(q){j("error",q.message??"Import failed")}finally{D(!1)}}},ue=x=>{v(x),T(n[x]??"")},it=()=>{v(null),T("")},Be=async()=>{if(!g)return;let x=g;if(_===n[x]){v(null);return}D(!0);try{let q=await Ae({data:{key:x,value:_}});i(F=>({...F,[x]:_})),l(F=>{let A={...F};return q.override?A[x]=q.override:delete A[x],A}),j("success",`${x} updated`),v(null)}catch(q){j("error",q.message??"Failed to update")}finally{D(!1)}},is=async x=>{D(!0);try{let q=await Ae({data:{key:x,value:null}});i(F=>{let A={...F};return delete A[x],A}),l(F=>{let A={...F};return q.override?A[x]=q.override:delete A[x],A}),H(F=>{let A=new Set(F);return A.delete(x),Uo(A),A}),j("success",`${x} deleted`)}catch(q){j("error",q.message??"Failed to delete")}finally{D(!1)}},je=async(x,q)=>{let F=/^(true|yes)$/i.test(q)?"false":"true";D(!0);try{let A=await Ae({data:{key:x,value:F}});i($=>({...$,[x]:F})),l($=>{let we={...$};return A.override?we[x]=A.override:delete we[x],we})}catch(A){j("error",A.message??"Failed to update")}finally{D(!1)}},Yt=async()=>{let x=w.trim();if(x){D(!0);try{let q=await Ae({data:{key:x,value:M}});i(F=>({...F,[x]:M})),l(F=>{let A={...F};return q.override?A[x]=q.override:delete A[x],A}),S(""),K(""),j("success",`${x} added`)}catch(q){j("error",q.message??"Failed to add")}finally{D(!1)}}},te=x=>{x.key==="Enter"&&Be(),x.key==="Escape"&&it()},as=async x=>{D(!0);try{let q=await ot({params:{key:x}});l(A=>{let $={...A};return delete $[x],$});let F=A=>{let $={...A};return q.value===null||q.value===void 0?delete $[x]:$[x]=q.value,$};i(F),o(F),j("success",`${x} reset to original`)}catch(q){j("error",q.message??"Failed to reset")}finally{D(!1)}},ve=async()=>{D(!0);try{await R(),l({});let x=await Q();x&&o(x.variables),j("success","All overrides reset")}catch(x){j("error",x.message??"Failed to reset all")}finally{D(!1)}},Pr=Object.keys(a).length,fe=Object.entries(n),at=zt(()=>{let x=h.toLowerCase().trim();return x?fe.filter(([q,F])=>q.toLowerCase().includes(x)||F.toLowerCase().includes(x)):fe},[n,h]),er=zt(()=>{let x={};for(let q of at){let F=Au(q[0]);(x[F]??(x[F]=[])).push(q)}return Object.entries(x).sort(([q],[F])=>q==="OTHER"?1:F==="OTHER"?-1:q.localeCompare(F))},[at]),Ar=at.every(([x])=>z.has(x)),tr=()=>{let x=at.map(([q])=>q);H(q=>{let F=new Set(q);return Ar?x.forEach(A=>F.delete(A)):x.forEach(A=>F.add(A)),Uo(F),F})},Mr="width:100%;font-family:monospace;font-size:12px;padding:2px 6px;border:1px solid var(--profiler-border);border-radius:4px;background:var(--profiler-bg);color:var(--profiler-text);",Je="background:none;border:none;cursor:pointer;font-size:12px;padding:0 3px;color:var(--profiler-text-muted);opacity:0.7;flex-shrink:0;",lt="background:none;border:1px solid var(--profiler-border);border-radius:4px;cursor:pointer;color:var(--profiler-text-muted);font-size:11px;padding:3px 8px;";return t(P,{children:[t("div",{class:"profiler-flex profiler-mb-4",style:"align-items:center;justify-content:space-between;flex-wrap:wrap;gap:8px;",children:[t("h2",{class:"profiler-section__header",style:"margin:0;",children:"Environment Variables"}),t("div",{class:"profiler-flex profiler-flex--gap-2",children:[!r&&t(P,{children:[t("button",{onClick:Q,disabled:O,style:lt,children:O?"\u2026":"\u21BA Refresh"}),t("button",{onClick:()=>Ue(x=>!x),style:`${lt}${Ke?"border-color:var(--profiler-accent);color:var(--profiler-accent);":""}`,children:"\u2B06 Import"})]}),t("button",{onClick:J,style:lt,children:"\u2B07 Export"}),t("button",{onClick:tr,style:lt,children:Ar?"\u{1F648} Mask all":"\u{1F441} Reveal all"}),!r&&Pr>0&&t("button",{onClick:ve,disabled:N,title:"Remove all Sidekiq overrides and restore original values",style:`${lt}border-color:var(--profiler-warning,#f59e0b);color:var(--profiler-warning,#f59e0b);`,children:["\u21A9 Reset all (",Pr,")"]}),!r&&t("button",{onClick:()=>Pe(x=>!x),title:Z?"Unlock editing":"Lock editing",style:`${lt}${Z?"border-color:var(--profiler-error,#ef4444);color:var(--profiler-error,#ef4444);":""}`,children:Z?"\u{1F512} Locked":"\u{1F513} Edit"})]})]}),r?t("div",{style:"background:var(--profiler-bg-subtle,rgba(0,0,0,0.03));border:1px solid var(--profiler-border);border-radius:6px;padding:8px 12px;margin-bottom:16px;font-size:12px;color:var(--profiler-text-muted);",children:["Snapshot taken at request time - modify env vars in ",t("a",{href:"/_profiler?section=env",style:"color:var(--profiler-accent);",children:"/_profiler?section=env"}),"."]}):t("div",{style:"background:var(--profiler-warning-bg,rgba(245,158,11,0.1));border:1px solid var(--profiler-warning,#f59e0b);border-radius:6px;padding:8px 12px;margin-bottom:16px;font-size:12px;color:var(--profiler-warning,#f59e0b);",children:"\u26A0 Changes affect the current process only - for development use."}),I&&t("div",{style:`background:${I.type==="success"?"var(--profiler-success-bg,rgba(34,197,94,0.1))":"var(--profiler-error-bg,rgba(239,68,68,0.08))"};border:1px solid ${I.type==="success"?"var(--profiler-success,#22c55e)":"var(--profiler-error,#ef4444)"};border-radius:6px;padding:6px 12px;margin-bottom:12px;font-size:12px;color:${I.type==="success"?"var(--profiler-success,#22c55e)":"var(--profiler-error,#ef4444)"};`,children:[I.type==="success"?"\u2713":"\u2717"," ",I.message]}),Ke&&t("div",{style:"border:1px solid var(--profiler-border);border-radius:6px;padding:12px;margin-bottom:16px;",children:[t("p",{class:"profiler-text--xs profiler-text--muted",style:"margin:0 0 8px;",children:["Paste the contents of a ",t("code",{children:".env"})," file. Comments and blank lines are ignored."]}),t("textarea",{value:qe,onInput:x=>ge(x.target.value),placeholder:`APP_NAME=MyApp
9
+ `,F=new Blob([q],{type:"text/plain"}),A=URL.createObjectURL(F),$=document.createElement("a");$.href=A,$.download=".env",$.click(),URL.revokeObjectURL(A),j("success",`Exported ${b.length} variables`)},Ne=Zt(()=>ju(qe),[qe]),Me=Zt(()=>Object.fromEntries(Object.entries(Ne).filter(([,b])=>b!==zi)),[Ne]),Fe=Object.keys(Me).length,De=Object.keys(Ne).length-Fe,Lt=async()=>{let b=Object.entries(Me);if(b.length){D(!0);try{await Promise.all(b.map(([F,A])=>Ae({data:{key:F,value:A}}))),i(F=>({...F,...Me})),ge(""),Ue(!1);let q=De>0?`, skipped ${De} masked`:"";j("success",`Imported ${b.length} variables${q}`)}catch(q){j("error",q.message??"Import failed")}finally{D(!1)}}},ue=b=>{v(b),T(n[b]??"")},it=()=>{v(null),T("")},Be=async()=>{if(!g)return;let b=g;if(_===n[b]){v(null);return}D(!0);try{let q=await Ae({data:{key:b,value:_}});i(F=>({...F,[b]:_})),l(F=>{let A={...F};return q.override?A[b]=q.override:delete A[b],A}),j("success",`${b} updated`),v(null)}catch(q){j("error",q.message??"Failed to update")}finally{D(!1)}},as=async b=>{D(!0);try{let q=await Ae({data:{key:b,value:null}});i(F=>{let A={...F};return delete A[b],A}),l(F=>{let A={...F};return q.override?A[b]=q.override:delete A[b],A}),H(F=>{let A=new Set(F);return A.delete(b),No(A),A}),j("success",`${b} deleted`)}catch(q){j("error",q.message??"Failed to delete")}finally{D(!1)}},je=async(b,q)=>{let F=/^(true|yes)$/i.test(q)?"false":"true";D(!0);try{let A=await Ae({data:{key:b,value:F}});i($=>({...$,[b]:F})),l($=>{let we={...$};return A.override?we[b]=A.override:delete we[b],we})}catch(A){j("error",A.message??"Failed to update")}finally{D(!1)}},er=async()=>{let b=w.trim();if(b){D(!0);try{let q=await Ae({data:{key:b,value:M}});i(F=>({...F,[b]:M})),l(F=>{let A={...F};return q.override?A[b]=q.override:delete A[b],A}),S(""),K(""),j("success",`${b} added`)}catch(q){j("error",q.message??"Failed to add")}finally{D(!1)}}},te=b=>{b.key==="Enter"&&Be(),b.key==="Escape"&&it()},ls=async b=>{D(!0);try{let q=await ot({params:{key:b}});l(A=>{let $={...A};return delete $[b],$});let F=A=>{let $={...A};return q.value===null||q.value===void 0?delete $[b]:$[b]=q.value,$};i(F),o(F),j("success",`${b} reset to original`)}catch(q){j("error",q.message??"Failed to reset")}finally{D(!1)}},ve=async()=>{D(!0);try{await R(),l({});let b=await Q();b&&o(b.variables),j("success","All overrides reset")}catch(b){j("error",b.message??"Failed to reset all")}finally{D(!1)}},Mr=Object.keys(a).length,fe=Object.entries(n),at=Zt(()=>{let b=h.toLowerCase().trim();return b?fe.filter(([q,F])=>q.toLowerCase().includes(b)||F.toLowerCase().includes(b)):fe},[n,h]),tr=Zt(()=>{let b={};for(let q of at){let F=Nu(q[0]);(b[F]??(b[F]=[])).push(q)}return Object.entries(b).sort(([q],[F])=>q==="OTHER"?1:F==="OTHER"?-1:q.localeCompare(F))},[at]),Fr=at.every(([b])=>J.has(b)),rr=()=>{let b=at.map(([q])=>q);H(q=>{let F=new Set(q);return Fr?b.forEach(A=>F.delete(A)):b.forEach(A=>F.add(A)),No(F),F})},Or="width:100%;font-family:monospace;font-size:12px;padding:2px 6px;border:1px solid var(--profiler-border);border-radius:4px;background:var(--profiler-bg);color:var(--profiler-text);",Je="background:none;border:none;cursor:pointer;font-size:12px;padding:0 3px;color:var(--profiler-text-muted);opacity:0.7;flex-shrink:0;",lt="background:none;border:1px solid var(--profiler-border);border-radius:4px;cursor:pointer;color:var(--profiler-text-muted);font-size:11px;padding:3px 8px;";return t(P,{children:[t("div",{class:"profiler-flex profiler-mb-4",style:"align-items:center;justify-content:space-between;flex-wrap:wrap;gap:8px;",children:[t("h2",{class:"profiler-section__header",style:"margin:0;",children:"Environment Variables"}),t("div",{class:"profiler-flex profiler-flex--gap-2",children:[!r&&t(P,{children:[t("button",{onClick:Q,disabled:O,style:lt,children:O?"\u2026":"\u21BA Refresh"}),t("button",{onClick:()=>Ue(b=>!b),style:`${lt}${Ke?"border-color:var(--profiler-accent);color:var(--profiler-accent);":""}`,children:"\u2B06 Import"})]}),t("button",{onClick:B,style:lt,children:"\u2B07 Export"}),t("button",{onClick:rr,style:lt,children:Fr?"\u{1F648} Mask all":"\u{1F441} Reveal all"}),!r&&Mr>0&&t("button",{onClick:ve,disabled:N,title:"Remove all Sidekiq overrides and restore original values",style:`${lt}border-color:var(--profiler-warning,#f59e0b);color:var(--profiler-warning,#f59e0b);`,children:["\u21A9 Reset all (",Mr,")"]}),!r&&t("button",{onClick:()=>Pe(b=>!b),title:Z?"Unlock editing":"Lock editing",style:`${lt}${Z?"border-color:var(--profiler-error,#ef4444);color:var(--profiler-error,#ef4444);":""}`,children:Z?"\u{1F512} Locked":"\u{1F513} Edit"})]})]}),r?t("div",{style:"background:var(--profiler-bg-subtle,rgba(0,0,0,0.03));border:1px solid var(--profiler-border);border-radius:6px;padding:8px 12px;margin-bottom:16px;font-size:12px;color:var(--profiler-text-muted);",children:["Snapshot taken at request time - modify env vars in ",t("a",{href:"/_profiler?section=env",style:"color:var(--profiler-accent);",children:"/_profiler?section=env"}),"."]}):t("div",{style:"background:var(--profiler-warning-bg,rgba(245,158,11,0.1));border:1px solid var(--profiler-warning,#f59e0b);border-radius:6px;padding:8px 12px;margin-bottom:16px;font-size:12px;color:var(--profiler-warning,#f59e0b);",children:"\u26A0 Changes affect the current process only - for development use."}),I&&t("div",{style:`background:${I.type==="success"?"var(--profiler-success-bg,rgba(34,197,94,0.1))":"var(--profiler-error-bg,rgba(239,68,68,0.08))"};border:1px solid ${I.type==="success"?"var(--profiler-success,#22c55e)":"var(--profiler-error,#ef4444)"};border-radius:6px;padding:6px 12px;margin-bottom:12px;font-size:12px;color:${I.type==="success"?"var(--profiler-success,#22c55e)":"var(--profiler-error,#ef4444)"};`,children:[I.type==="success"?"\u2713":"\u2717"," ",I.message]}),Ke&&t("div",{style:"border:1px solid var(--profiler-border);border-radius:6px;padding:12px;margin-bottom:16px;",children:[t("p",{class:"profiler-text--xs profiler-text--muted",style:"margin:0 0 8px;",children:["Paste the contents of a ",t("code",{children:".env"})," file. Comments and blank lines are ignored."]}),t("textarea",{value:qe,onInput:b=>ge(b.target.value),placeholder:`APP_NAME=MyApp
10
10
  FEATURE_BETA=true
11
- # comment`,rows:6,style:"width:100%;font-family:monospace;font-size:12px;padding:6px 8px;border:1px solid var(--profiler-border);border-radius:4px;background:var(--profiler-bg);color:var(--profiler-text);resize:vertical;box-sizing:border-box;"}),t("div",{class:"profiler-flex profiler-flex--gap-2 profiler-mt-2",style:"align-items:center;",children:[Fe>0&&t("span",{class:"profiler-text--xs profiler-text--muted",children:[Fe," variable",Fe!==1?"s":""," to import"]}),De>0&&t("span",{class:"profiler-text--xs profiler-text--muted",children:[De," masked (",Gi,") skipped"]}),t("button",{onClick:Dt,disabled:N||Fe===0,style:"background:var(--profiler-accent);border:none;cursor:pointer;color:#fff;font-size:11px;padding:4px 12px;border-radius:4px;margin-left:auto;",children:"Apply"})]})]}),t("div",{class:"profiler-flex profiler-flex--gap-4 profiler-mb-4",children:[t("div",{class:"profiler-stat-card",children:[t("div",{class:"profiler-stat-card__value",children:f}),t("div",{class:"profiler-stat-card__label",children:"Total vars"})]}),h&&t("div",{class:"profiler-stat-card",children:[t("div",{class:"profiler-stat-card__value",children:at.length}),t("div",{class:"profiler-stat-card__label",children:"Matching"})]})]}),t("div",{class:"profiler-flex profiler-flex--gap-2 profiler-mb-3",children:t("input",{type:"text",class:"profiler-filter-input",placeholder:"Filter by key or value\u2026",value:h,onInput:x=>d(x.target.value),style:"flex:1;"})}),t("table",{class:"profiler-table",children:[t("thead",{children:t("tr",{children:[t("th",{style:"width:32%",children:"Key"}),t("th",{children:"Value"}),!Z&&t("th",{style:"width:120px;text-align:right;"})]})}),t("tbody",{children:[er.map(([x,q])=>{let F=y.has(x);return t(P,{children:[t("tr",{onClick:()=>Xt(x),style:"cursor:pointer;background:var(--profiler-bg-subtle,rgba(0,0,0,0.03));",children:t("td",{colspan:Z?2:3,style:"padding:4px 8px;",children:[t("span",{style:"font-size:11px;font-weight:600;color:var(--profiler-text-muted);letter-spacing:0.05em;font-family:monospace;",children:[F?"\u25B6":"\u25BC"," ",x,"_"]}),t("span",{style:"font-size:10px;color:var(--profiler-text-muted);margin-left:6px;",children:q.length})]})},`group-${x}`),!F&&q.map(([A,$])=>{let we=z.has(A),Ie=g===A,Qt=le===A,me=le===`__key__${A}`,rr=s[A]!==void 0&&s[A]!==$,sr=s[A]===void 0,he=a[A];return t("tr",{style:he?"border-left:3px solid var(--profiler-accent);":rr?"border-left:3px solid #f59e0b;":sr?"border-left:3px solid var(--profiler-success,#22c55e);":"",children:[t("td",{children:t("div",{class:"profiler-flex",style:"align-items:center;gap:4px;",children:[t("code",{class:"profiler-text--xs profiler-text--mono",children:A}),t("button",{onClick:()=>nt(A,`__key__${A}`),title:"Copy key",style:`${Je}${me?"color:var(--profiler-success,#22c55e);opacity:1;":""}`,children:me?"\u2713":"\u2398"})]})}),t("td",{children:Ie?t("div",{class:"profiler-flex",style:"align-items:center;gap:2px;",children:[No(_)&&t("span",{style:"font-family:monospace;font-size:12px;color:var(--profiler-text-muted);opacity:0.5;flex-shrink:0;",children:'"'}),t("input",{ref:_e,type:"text",value:_,onInput:ls=>T(ls.target.value),onKeyDown:te,disabled:N,style:"flex:1;font-family:monospace;font-size:12px;padding:2px 6px;border:1px solid var(--profiler-accent);border-radius:4px;background:var(--profiler-bg);color:var(--profiler-text);"}),No(_)&&t("span",{style:"font-family:monospace;font-size:12px;color:var(--profiler-text-muted);opacity:0.5;flex-shrink:0;",children:'"'})]}):Ji($)?t(P,{children:[t("div",{class:"profiler-flex",style:"align-items:center;gap:8px;",children:[t(Bi,{value:$}),t("button",{onClick:()=>!Z&&!N&&je(A,$),disabled:N||Z,title:`Click to set ${/^(true|yes)$/i.test($)?"false":"true"}`,style:`position:relative;display:inline-block;width:36px;height:20px;border-radius:10px;border:none;cursor:${Z||N?"default":"pointer"};padding:0;transition:background 0.2s;background:${/^(true|yes)$/i.test($)?"var(--profiler-accent)":"var(--profiler-border,#d1d5db)"};flex-shrink:0;`,children:t("span",{style:`position:absolute;top:3px;width:14px;height:14px;border-radius:50%;background:#fff;transition:left 0.2s;left:${/^(true|yes)$/i.test($)?"19px":"3px"};`})}),t("span",{class:"profiler-text--xs profiler-text--mono",style:"color:var(--profiler-text-muted);",children:$}),t("button",{onClick:()=>nt($,A),title:"Copy value",style:`${Je}${Qt?"color:var(--profiler-success,#22c55e);opacity:1;":""}`,children:Qt?"\u2713":"\u2398"})]}),he&&t("div",{style:"font-size:10px;color:var(--profiler-accent);margin-top:2px;font-family:monospace;",children:["workers \u2190 ",he.value==="__profiler_deleted__"?"(deleted)":he.value," \xB7 original: ",he.original??"(unset)"]})]}):t(P,{children:[t("div",{class:"profiler-flex",style:"align-items:center;gap:4px;",children:[t(Bi,{value:$}),t("span",{class:"profiler-text--xs profiler-text--mono",onClick:()=>!Z&&!Ie&&ue(A),title:Z?void 0:"Click to edit",style:`word-break:break-all;flex:1;${Z?"":"cursor:pointer;"}`,children:we?No($)?t(P,{children:[t("span",{style:"color:var(--profiler-text-muted);opacity:0.5;",children:'"'}),$,t("span",{style:"color:var(--profiler-text-muted);opacity:0.5;",children:'"'})]}):$:"\u2022".repeat(Math.min($.length,20))}),t("button",{onClick:()=>Te(A),title:we?"Hide value":"Show value",style:`${Je}${we?"opacity:1;color:var(--profiler-accent);":""}`,children:we?"\u{1F441}":"\u{1F648}"}),t("button",{onClick:()=>nt($,A),title:"Copy value",style:`${Je}${Qt?"color:var(--profiler-success,#22c55e);opacity:1;":""}`,children:Qt?"\u2713":"\u2398"})]}),he&&t("div",{style:"font-size:10px;color:var(--profiler-accent);margin-top:2px;font-family:monospace;",children:["workers \u2190 ",he.value==="__profiler_deleted__"?"(deleted)":we?he.value:"\u2022".repeat(Math.min((he.value??"").length,20))," \xB7 original: ",he.original==null?"(unset)":we?he.original:"\u2022".repeat(Math.min(he.original.length,20))]})]})}),!Z&&t("td",{style:"text-align:right;white-space:nowrap;",children:Ie?t(P,{children:[t("button",{onClick:Be,disabled:N,title:"Save",style:"background:none;border:none;cursor:pointer;color:var(--profiler-success,#22c55e);font-size:14px;padding:0 4px;",children:"\u2713"}),t("button",{onClick:it,disabled:N,title:"Cancel",style:"background:none;border:none;cursor:pointer;color:var(--profiler-text-muted);font-size:14px;padding:0 4px;",children:"\u2717"})]}):t(P,{children:[t("button",{onClick:()=>ue(A),disabled:N,title:"Edit",style:"background:none;border:none;cursor:pointer;color:var(--profiler-accent);font-size:14px;padding:0 4px;",children:"\u270E"}),he&&t("button",{onClick:()=>as(A),disabled:N,title:`Reset to original: ${he.original??"(unset)"}`,style:"background:none;border:none;cursor:pointer;color:var(--profiler-warning,#f59e0b);font-size:14px;padding:0 4px;",children:"\u21A9"}),t("button",{onClick:()=>is(A),disabled:N,title:"Delete",style:"background:none;border:none;cursor:pointer;color:var(--profiler-error,#ef4444);font-size:14px;padding:0 4px;",children:"\u2715"})]})})]},A)})]})}),!Z&&t("tr",{children:[t("td",{children:t("input",{type:"text",value:w,onInput:x=>S(x.target.value),onKeyDown:x=>x.key==="Enter"&&Yt(),placeholder:"NEW_KEY",disabled:N,style:Mr})}),t("td",{children:t("input",{type:"text",value:M,onInput:x=>K(x.target.value),onKeyDown:x=>x.key==="Enter"&&Yt(),placeholder:"value",disabled:N,style:Mr})}),t("td",{style:"text-align:right;",children:t("button",{onClick:Yt,disabled:N||!w.trim(),style:"background:var(--profiler-accent);border:none;cursor:pointer;color:#fff;font-size:11px;padding:3px 8px;border-radius:4px;",children:"Add"})})]})]})]})]})}function zi({tree:e,selected:r,onToggleFile:s,onToggleDir:o}){let[n,i]=b(new Set),a=f=>{i(p=>{let h=new Set(p);return h.has(f)?h.delete(f):h.add(f),h})},l=f=>{let p=f.filter(h=>r.has(h)).length;return p===0?"none":p===f.length?"all":"partial"};return t("div",{class:"profiler-text--xs profiler-text--mono",style:"overflow-y: auto; height: 100%",children:e.map(({directory:f,files:p})=>{let h=p.map(m=>m.path),d=l(h),y=n.has(f);return t("div",{style:"margin-bottom: 4px",children:[t("div",{style:"display: flex; align-items: center; gap: 6px; padding: 3px 6px; cursor: pointer; border-radius: 4px; background: var(--profiler-bg-secondary, rgba(255,255,255,0.05))",onClick:()=>a(f),children:[t("input",{type:"checkbox",checked:d==="all",ref:m=>{m&&(m.indeterminate=d==="partial")},onClick:m=>{m.stopPropagation(),o(f,h)},style:"cursor: pointer; flex-shrink: 0"}),t("span",{style:"color: var(--profiler-text-muted, #888); flex-shrink: 0",children:y?"\u25B6":"\u25BC"}),t("span",{style:"color: var(--profiler-accent, #06b6d4); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap",title:f,children:[f,"/"]}),t("span",{style:"color: var(--profiler-text-muted, #888); margin-left: auto; flex-shrink: 0",children:["(",p.length,")"]})]}),!y&&p.map(m=>t("div",{style:"display: flex; align-items: center; gap: 6px; padding: 2px 6px 2px 24px; cursor: pointer; border-radius: 4px",onClick:()=>s(m.path),children:[t("input",{type:"checkbox",checked:r.has(m.path),onClick:g=>{g.stopPropagation(),s(m.path)},style:"cursor: pointer; flex-shrink: 0"}),t("span",{style:"overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--profiler-text, #e2e8f0)",title:m.path,children:m.name})]},m.path))]},f)})})}function Ou(e){return e==="passed"?"var(--profiler-success, #10b981)":e==="failed"?"var(--profiler-error, #ef4444)":e==="running"?"var(--profiler-accent, #06b6d4)":e==="killed"||e==="signaled"||e==="error"?"var(--profiler-warning, #f59e0b)":"var(--profiler-text-muted, #888)"}function qu(e){return{pending:"\u23F3 Pending",running:"\u25CF Running\u2026",passed:"\u2713 Passed",failed:"\u2717 Failed",killed:"\u25A0 Killed",signaled:"\u26A1 Ended by a signal",error:"\u26A0 Error"}[e]||e}function Du(e){let r={0:"",1:"font-weight:bold",31:"color:var(--ansi-red)",32:"color:var(--ansi-green)",33:"color:var(--ansi-yellow)",34:"color:var(--ansi-blue)",35:"color:var(--ansi-purple)",36:"color:var(--ansi-cyan)"},s=[],o="",n=e.split(/(\x1b\[[0-9;]*m)/);for(let i of n)if(i.startsWith("\x1B[")&&i.endsWith("m")){let a=i.slice(2,-1).split(";");if(a.includes("0"))o="";else{let l=a.map(f=>r[f]??"").filter(Boolean);o=[...o?[o]:[],...l].join(";")}}else i.length>0&&s.push({text:i,style:o});return s}function Qu({text:e}){let r=Du(e);return r.length===0?t("span",{style:"color:var(--profiler-text-muted)",children:"No output yet\u2026"}):t(P,{children:r.map((s,o)=>s.style?t("span",{style:s.style,children:s.text},o):t("span",{children:s.text},o))})}function Wi({run:e}){let r=de(null);return B(()=>{r.current&&e?.status==="running"&&(r.current.scrollTop=r.current.scrollHeight)},[e?.output]),e?t("div",{style:"display: flex; flex-direction: column; height: 100%; gap: 12px",children:[t("div",{style:"display: flex; align-items: center; gap: 12px; flex-shrink: 0",children:[t("span",{style:`font-weight: 600; color: ${Ou(e.status)}`,children:qu(e.status)}),e.duration!=null&&t("span",{class:"profiler-text--xs profiler-text--muted",children:[(e.duration/1e3).toFixed(1),"s"]}),(e.status==="passed"||e.status==="failed")&&t("a",{href:"/_profiler?section=tests",class:"profiler-text--xs",style:"color: var(--profiler-accent, #06b6d4); margin-left: auto",children:"View in Profiler \u2192"})]}),t("pre",{ref:r,style:"flex: 1; overflow-y: auto; background: var(--profiler-terminal-bg); color: var(--profiler-terminal-text); padding: 14px 16px; border-radius: 6px; font-family: var(--profiler-font-mono); font-size: 12px; line-height: 1.65; margin: 0; white-space: pre-wrap; word-break: break-all; border: 1px solid var(--profiler-border)",children:t(Qu,{text:e.output||""})}),e.files.length>0&&t("div",{class:"profiler-text--xs profiler-text--muted",style:"flex-shrink: 0",children:[e.files.length," file",e.files.length!==1?"s":""," \xB7 ",e.framework]})]}):t("div",{class:"profiler-empty",style:"height: 100%; display: flex; align-items: center; justify-content: center",children:t("div",{children:[t("div",{class:"profiler-empty__title",style:"font-size: 1.1rem",children:"Select files and click Run"}),t("p",{class:"profiler-empty__description",children:"Test output will appear here in real time"})]})})}var Zi="/_profiler";function Ks(){let[e,r]=b(""),[s,o]=b(new Set),[n,i]=b(null),[a,l]=b(!1),[f,p]=b(null),{data:h,isLoading:d,refetch:y}=Di(e?{framework:e}:{},{query:{refetchOnWindowFocus:!1}}),{mutateAsync:m}=Qi(),{mutateAsync:g}=Li(),v=h?.frameworks??[],_=h?.tree??[];B(()=>{!e&&v.length>0&&r(v[0])},[v]);let T=Wt(O=>{o(new Set),y()},[y]);B(()=>{if(!n||!a)return;if(["passed","failed","killed","signaled","error"].includes(n.status)){l(!1);return}let O=new EventSource(`${Zi}/api/test_runner/runs/${n.id}/stream`);return O.addEventListener("output",U=>{try{let z=JSON.parse(U.data);i(H=>H&&{...H,output:(H.output||"")+z.chunk})}catch{}}),O.addEventListener("done",U=>{try{let z=JSON.parse(U.data);i(H=>H&&{...H,status:z.status})}catch{}l(!1),O.close()}),O.onerror=()=>{O.readyState===EventSource.CLOSED&&fetch(`${Zi}/api/test_runner/runs/${n.id}`).then(U=>U.json()).then(U=>{i(U),l(!1)}).catch(()=>l(!1))},()=>O.close()},[n?.id,a]);let w=O=>{r(O),T(O)},S=O=>{o(U=>{let z=new Set(U);return z.has(O)?z.delete(O):z.add(O),z})},M=(O,U)=>{o(z=>{let H=new Set(z);return U.every(ce=>H.has(ce))?U.forEach(ce=>H.delete(ce)):U.forEach(ce=>H.add(ce)),H})},K=()=>{let O=_.flatMap(U=>U.files.map(z=>z.path));o(new Set(O))},I=()=>o(new Set),se=async()=>{if(!(s.size===0||a)){p(null);try{let O=await m({data:{files:Array.from(s),framework:e}});i(O),l(!0)}catch(O){p(O instanceof Error&&O.message?O.message:"Failed to start test run")}}},N=async()=>{if(n)try{await g({id:n.id}),l(!1),i(O=>O&&{...O,status:"killed"})}catch{}},D=_.reduce((O,U)=>O+U.files.length,0);return t("div",{children:[f&&t("div",{style:"color: var(--profiler-error, #ef4444); background: rgba(239,68,68,0.1); border: 1px solid var(--profiler-error, #ef4444); border-radius: 4px; padding: 8px 12px; margin-bottom: 12px; font-size: 13px",children:f}),t("div",{class:"profiler-action-bar profiler-mb-3",children:[t("div",{class:"profiler-filter-group",children:v.length>0&&v.map(O=>t("button",{class:`profiler-preset-btn${e===O?" profiler-preset-btn--active":""}`,onClick:()=>w(O),disabled:a,children:O==="rspec"?"RSpec":"Minitest"},O))}),t("div",{class:"profiler-filter-group",style:"margin-left: auto",children:[t("span",{class:"profiler-text--xs profiler-text--muted",children:[s.size," / ",D," selected"]}),t("button",{class:"btn btn-secondary btn-sm",onClick:K,disabled:a||d,children:"All"}),t("button",{class:"btn btn-secondary btn-sm",onClick:I,disabled:a,children:"None"}),a?t("button",{class:"btn btn-danger btn-sm",onClick:N,children:"\u25A0 Stop"}):t("button",{class:"btn btn-sm",style:"background: var(--profiler-accent, #06b6d4); color: #000; font-weight: 600",onClick:se,disabled:s.size===0,children:["\u25B6 Run Selected (",s.size,")"]})]})]}),t("div",{style:"display: grid; grid-template-columns: 260px 1fr; height: 460px; border: 1px solid var(--profiler-border, rgba(255,255,255,0.1)); border-radius: 6px; overflow: hidden",children:[t("div",{style:"border-right: 1px solid var(--profiler-border, rgba(255,255,255,0.1)); overflow-y: auto; padding: 8px",children:d?t("div",{class:"profiler-text--xs profiler-text--muted",style:"padding: 8px",children:"Loading files\u2026"}):_.length===0?t("div",{class:"profiler-text--xs profiler-text--muted",style:"padding: 8px",children:["No ",e," test files found"]}):t(zi,{tree:_,selected:s,onToggleFile:S,onToggleDir:M})}),t("div",{style:"overflow: hidden; display: flex; flex-direction: column",children:t(Wi,{run:n})})]})]})}var ts="/_profiler";function Sr({cols:e,rows:r=6}){return t("div",{children:Array.from({length:r}).map((s,o)=>t("div",{class:"profiler-skeleton__row",children:e.map((n,i)=>t("div",{class:`profiler-skeleton__cell profiler-skeleton__cell--${n}`},i))},o))})}function Lu(e){return{GET:"badge-info",POST:"badge-success",PUT:"badge-warning",PATCH:"badge-warning",DELETE:"badge-error"}[e]||"badge-default"}function Ku(e){return e>=200&&e<300?"badge-success":e>=300&&e<400?"badge-info":e>=400&&e<500?"badge-warning":e>=500?"badge-error":"badge-default"}function Us(e){return e>=500?"badge-error":e>=100?"badge-warning":"badge-success"}function Xi(e){let r=e.collectors_data?.job?.status;return r||(e.status===500?"failed":"completed")}function rs(e){return new Date(e).toLocaleTimeString("en",{hour12:!1})}var Yi=[{key:"slow",label:"Slow"},{key:"many_queries",label:"Many queries"},{key:"errors",label:"Errors"},{key:"has_exception",label:"Has exception"}];function ea(){let e=Ge(),r=new URLSearchParams(window.location.search),s=()=>{let u=r.get("section");return u==="http"||u==="jobs"||u==="console"||u==="tests"||u==="runner"||u==="outbound"||u==="env"?u:"http"},o=()=>{let u=r.get("sort"),C=r.get("dir");return{col:u==="date"||u==="duration"||u==="memory"||u==="status"||u==="queries"?u:null,dir:C==="desc"?"desc":"asc"}},[n,i]=b(s),a=(u,C)=>({query:{enabled:n===u,queryFn:({pageParam:V=0,signal:ee})=>C(V,ee),getNextPageParam:V=>V.has_more?V.offset+V.limit:void 0,initialPageParam:0,refetchOnWindowFocus:!1}}),l=Fi({limit:50},a("http",(u,C)=>qo({limit:50,offset:u},C))),f=Si({limit:50},a("jobs",(u,C)=>Oo({limit:50,offset:u},C))),p=bi({limit:50},a("console",(u,C)=>Mo({limit:50,offset:u},C))),h=Ki({limit:50},a("tests",(u,C)=>Do({limit:50,offset:u},C))),d=Mi({query:{enabled:n==="outbound",refetchOnWindowFocus:!1}}),y=Ti({query:{enabled:n==="env",refetchOnWindowFocus:!1}}),{mutateAsync:m}=Oi(),{mutateAsync:g}=qi(),{mutateAsync:v}=Pi(),{mutateAsync:_}=Ai(),{mutateAsync:T}=xi(),{mutateAsync:w}=_i(),{mutateAsync:S}=Ui(),{mutateAsync:M}=Ni(),K=l.data?.pages.flatMap(u=>u.profiles)??[],I=f.data?.pages.flatMap(u=>u.profiles)??[],se=p.data?.pages.flatMap(u=>u.profiles)??[],N=h.data?.pages.flatMap(u=>u.profiles)??[],D=d.data??[],O=y.data,U=l.isLoading,z=f.isLoading,H=p.isLoading,le=h.isLoading,ce=d.isLoading,Z=y.isLoading,Pe=l.error?.message??null,Ke=f.error?.message??null,Ue=p.error?.message??null,qe=h.error?.message??null,ge=d.error?.message??null,_e=y.error?.message??null,Ae=!!l.hasNextPage,ot=!!f.hasNextPage,R=!!p.hasNextPage,j=!!h.hasNextPage,Te=l.isFetchingNextPage,nt=f.isFetchingNextPage,Xt=p.isFetchingNextPage,Q=h.isFetchingNextPage,[J,Ne]=b(null),[Me,Fe]=b(""),[De,Dt]=b(""),[ue,it]=b(""),[Be,is]=b(""),[je,Yt]=b(()=>{let u=r.get("preset");return Yi.some(C=>C.key===u)?u:""}),[te,as]=b(o),[ve,Pr]=b({col:null,dir:"asc"}),[fe,at]=b({col:null,dir:"asc"}),[er,Ar]=b(""),[tr,Mr]=b(""),[Je,lt]=b(""),[x,q]=b(""),[F,A]=b(""),[$,we]=b(""),[Ie,Qt]=b(""),[me,rr]=b({col:null,dir:"asc"}),[sr,he]=b(""),[Fr,ls]=b(""),[Or,Jo]=b("");B(()=>{let u=new URL(window.location.href);te.col?(u.searchParams.set("sort",te.col),u.searchParams.set("dir",te.dir)):(u.searchParams.delete("sort"),u.searchParams.delete("dir")),je?u.searchParams.set("preset",je):u.searchParams.delete("preset"),history.replaceState(null,"",u.toString())},[te,je]);let qr=u=>{as(C=>C.col===u?{col:u,dir:C.dir==="asc"?"desc":"asc"}:{col:u,dir:"asc"})},Vs=u=>{Pr(C=>C.col===u?{col:u,dir:C.dir==="asc"?"desc":"asc"}:{col:u,dir:"asc"})},Ea=u=>{Yt(C=>C===u?"":u)},Ca=()=>l.fetchNextPage(),Ra=()=>f.fetchNextPage(),ka=()=>p.fetchNextPage(),Sa=()=>h.fetchNextPage(),zo=u=>{u==="http"?l.refetch():u==="jobs"?f.refetch():u==="console"?p.refetch():u==="tests"?h.refetch():u==="outbound"?d.refetch():u==="env"&&y.refetch()},gt=u=>{if(u===n){zo(u);return}i(u);let C=new URL(window.location.href);C.searchParams.set("section",u),history.pushState(null,"",C.toString()),Fe(""),Dt(""),it(""),is(""),Yt(""),as({col:null,dir:"asc"}),Ar(""),Mr(""),lt(""),Pr({col:null,dir:"asc"}),q(""),A(""),at({col:null,dir:"asc"}),we(""),Qt(""),rr({col:null,dir:"asc"}),he(""),ls(""),Jo("")},us=u=>{navigator.clipboard.writeText(u).then(()=>{Ne(u),setTimeout(()=>Ne(null),1500)})},Pa=u=>m({id:u}).then(()=>l.refetch()),Aa=u=>v({id:u}).then(()=>f.refetch()),Ma=u=>T({id:u}).then(()=>p.refetch()),Fa=u=>S({id:u}).then(()=>h.refetch()),Oa=()=>{window.confirm("Delete all HTTP profiles?")&&g().then(()=>l.refetch())},qa=()=>{window.confirm("Delete all job profiles?")&&_().then(()=>f.refetch())},Da=()=>{window.confirm("Delete all console profiles?")&&w().then(()=>p.refetch())},Qa=()=>{window.confirm("Delete all test profiles?")&&M().then(()=>h.refetch())},Hs=()=>{window.confirm("Delete all HTTP, job and console profiles?")&&Promise.all([g(),_(),w()]).then(()=>{l.refetch(),f.refetch(),p.refetch()})},Dr=()=>zo(n),$s=u=>{at(C=>C.col===u?{col:u,dir:C.dir==="asc"?"desc":"asc"}:{col:u,dir:"asc"})},Lt=u=>`tab${n===u?" active":""}`,cs=K.filter(u=>{if(Me&&!u.path.toLowerCase().includes(Me.toLowerCase())||De&&u.method!==De)return!1;if(ue){let C=parseInt(ue);if(!(u.status>=C&&u.status<C+100))return!1}return!(Be&&(Be==="lt100"?u.duration>=100:u.duration<parseInt(Be))||je==="slow"&&u.duration<500||je==="many_queries"&&(u.collectors_data?.database?.total_queries??0)<=20||je==="errors"&&u.status<500||je==="has_exception"&&!u.collectors_data?.exception)}),La=te.col?[...cs].sort((u,C)=>{if(te.col==="date"){let Ve=new Date(u.started_at).getTime()-new Date(C.started_at).getTime();return te.dir==="asc"?Ve:-Ve}let V,ee;switch(te.col){case"duration":V=u.duration,ee=C.duration;break;case"memory":V=xe(u)??0,ee=xe(C)??0;break;case"status":V=u.status,ee=C.status;break;case"queries":V=u.collectors_data?.database?.total_queries??0,ee=C.collectors_data?.database?.total_queries??0;break;default:return 0}return te.dir==="asc"?V-ee:ee-V}):cs,ps=I.filter(u=>!(er&&!u.path.toLowerCase().includes(er.toLowerCase())||tr&&Xi(u)!==tr||Je&&(Je==="lt100"?u.duration>=100:u.duration<parseInt(Je)))),Ka=ve.col?[...ps].sort((u,C)=>{if(ve.col==="date"){let Ve=new Date(u.started_at).getTime()-new Date(C.started_at).getTime();return ve.dir==="asc"?Ve:-Ve}let V,ee;switch(ve.col){case"duration":V=u.duration,ee=C.duration;break;case"status":V=u.status,ee=C.status;break;default:return 0}return ve.dir==="asc"?V-ee:ee-V}):ps,Gs=D.filter(u=>{if(sr&&!u.url.toLowerCase().includes(sr.toLowerCase())||Fr&&u.method!==Fr)return!1;if(Or)if(Or==="error"){if(u.status!==0)return!1}else{let C=parseInt(Or);if(!(u.status>=C&&u.status<C+100))return!1}return!0}),ds=se.filter(u=>!(x&&!u.path.toLowerCase().includes(x.toLowerCase())||F==="error"&&u.status!==500||F==="ok"&&u.status===500)),Ua=fe.col?[...ds].sort((u,C)=>{if(fe.col==="date"){let Ve=new Date(u.started_at).getTime()-new Date(C.started_at).getTime();return fe.dir==="asc"?Ve:-Ve}let V,ee;switch(fe.col){case"duration":V=u.duration,ee=C.duration;break;case"status":V=u.status,ee=C.status;break;default:return 0}return fe.dir==="asc"?V-ee:ee-V}):ds,fs=N.filter(u=>!($&&!(u.collectors_data?.test?.test_name||u.path).toLowerCase().includes($.toLowerCase())||Ie==="failed"&&u.status!==500||Ie==="passed"&&u.status===500||Ie==="pending"&&u.collectors_data?.test?.status!=="pending")),Na=me.col?[...fs].sort((u,C)=>{let V,ee;if(me.col==="date"){let Ve=new Date(u.started_at).getTime()-new Date(C.started_at).getTime();return me.dir==="asc"?Ve:-Ve}switch(me.col){case"duration":V=u.duration,ee=C.duration;break;case"status":V=u.status,ee=C.status;break;default:return 0}return me.dir==="asc"?V-ee:ee-V}):fs,Wo=!!(Me||De||ue||Be||je),Zo=!!(er||tr||Je),Xo=!!(x||F),Yo=!!($||Ie),ja=!!(sr||Fr||Or),Re=(u,C,V)=>u!==V?t("span",{class:"sort-icon sort-icon--idle",children:"\u21C5"}):t("span",{class:"sort-icon sort-icon--active",children:C==="asc"?"\u25B2":"\u25BC"});return t("div",{class:"container",children:[t("div",{class:"header",children:[t("h1",{children:[t("span",{class:"h1-emoji",children:"\u{1F50D}"})," Rails Profiler"]}),t("p",{children:"Recent profiled requests and jobs"}),e&&t("span",{class:"profiler-version-badge",children:["v",e]})]}),t("div",{class:"profiler-panel profiler-mb-6",children:[t("div",{class:"tabs",children:[t("a",{href:"#",class:Lt("http"),onClick:u=>{u.preventDefault(),gt("http")},children:"HTTP Requests"}),t("a",{href:"#",class:Lt("jobs"),onClick:u=>{u.preventDefault(),gt("jobs")},children:"Background Jobs"}),t("a",{href:"#",class:Lt("console"),onClick:u=>{u.preventDefault(),gt("console")},children:"Console"}),t("a",{href:"#",class:Lt("tests"),onClick:u=>{u.preventDefault(),gt("tests")},children:"Tests"}),t("div",{style:"flex: 1"}),t("a",{href:"#",class:Lt("runner"),onClick:u=>{u.preventDefault(),gt("runner")},children:"Test Runner"}),t("a",{href:"#",class:Lt("outbound"),onClick:u=>{u.preventDefault(),gt("outbound")},children:"Outbound HTTP"}),t("a",{href:"#",class:Lt("env"),onClick:u=>{u.preventDefault(),gt("env")},children:"Env"})]}),t("div",{class:"profiler-p-4 tab-content active",children:[n==="http"&&(U?t(Sr,{cols:["sm","xs","flex","sm","sm","sm","xs","sm"]}):Pe?t("div",{class:"profiler-empty",children:t("div",{class:"profiler-empty__title",children:Pe})}):K.length===0?t("div",{class:"profiler-empty",children:[t("div",{class:"profiler-empty__title",children:"No profiles found"}),t("p",{class:"profiler-empty__description",children:"Make some requests to your application to see profiling data"})]}):t(P,{children:[t("div",{class:"profiler-action-bar profiler-mb-2",children:t("div",{class:"profiler-filter-group",children:Yi.map(u=>t("button",{class:`profiler-preset-btn${je===u.key?" profiler-preset-btn--active":""}`,onClick:()=>Ea(u.key),children:u.label},u.key))})}),t("div",{class:"profiler-action-bar profiler-mb-3",children:[t("div",{class:"profiler-filter-group",children:[t("input",{type:"text",class:"profiler-filter-input",placeholder:"Search path\u2026",value:Me,onInput:u=>Fe(u.target.value)}),t("select",{class:"profiler-filter-select",value:De,onChange:u=>Dt(u.target.value),children:[t("option",{value:"",children:"All Methods"}),t("option",{value:"GET",children:"GET"}),t("option",{value:"POST",children:"POST"}),t("option",{value:"PUT",children:"PUT"}),t("option",{value:"PATCH",children:"PATCH"}),t("option",{value:"DELETE",children:"DELETE"})]}),t("select",{class:"profiler-filter-select",value:ue,onChange:u=>it(u.target.value),children:[t("option",{value:"",children:"All Statuses"}),t("option",{value:"200",children:"2xx"}),t("option",{value:"300",children:"3xx"}),t("option",{value:"400",children:"4xx"}),t("option",{value:"500",children:"5xx"})]}),t("select",{class:"profiler-filter-select",value:Be,onChange:u=>is(u.target.value),children:[t("option",{value:"",children:"All Durations"}),t("option",{value:"lt100",children:"<100ms"}),t("option",{value:"100",children:"\u2265100ms"}),t("option",{value:"500",children:"\u2265500ms"})]})]}),t("div",{class:"profiler-filter-group",children:[Wo&&t("span",{class:"profiler-filter-count",children:[cs.length," / ",K.length]}),t("button",{class:`btn-refresh${U?" btn-refresh--spinning":""}`,onClick:Dr,disabled:U,title:"Refresh",children:"\u21BA"}),t("button",{class:"btn btn-danger btn-sm",onClick:Oa,title:"Delete HTTP profiles",children:"Clear"}),t("button",{class:"btn btn-danger btn-sm",onClick:Hs,title:"Delete all HTTP and job profiles",children:"Clear All"})]})]}),cs.length===0?t("div",{class:"profiler-empty",children:t("div",{class:"profiler-empty__title",children:"No results match filters"})}):t("table",{children:[t("thead",{children:t("tr",{children:[t("th",{class:`sortable${te.col==="date"?" sortable--active":""}`,onClick:()=>qr("date"),children:["Time ",Re(te.col,te.dir,"date")]}),t("th",{children:"Method"}),t("th",{children:"Path"}),t("th",{class:`sortable${te.col==="duration"?" sortable--active":""}`,onClick:()=>qr("duration"),children:["Duration ",Re(te.col,te.dir,"duration")]}),t("th",{class:`sortable${te.col==="queries"?" sortable--active":""}`,onClick:()=>qr("queries"),children:["Queries ",Re(te.col,te.dir,"queries")]}),t("th",{class:`sortable${te.col==="memory"?" sortable--active":""}`,onClick:()=>qr("memory"),title:rt,children:["Allocations ",Re(te.col,te.dir,"memory")]}),t("th",{class:`sortable${te.col==="status"?" sortable--active":""}`,onClick:()=>qr("status"),children:["Status ",Re(te.col,te.dir,"status")]}),t("th",{children:"Token"}),t("th",{})]})}),t("tbody",{children:La.map(u=>t("tr",{children:[t("td",{children:rs(u.started_at)}),t("td",{children:t("span",{class:Lu(u.method),children:u.method})}),t("td",{children:[t("a",{href:`${ts}/profiles/${u.token}`,children:u.path}),u.gem_version&&u.gem_version!==e&&t("span",{class:"profiler-version-warn",title:`Captur\xE9 avec v${u.gem_version} (actuel : v${e})`,children:"\u26A0\uFE0F"})]}),t("td",{children:t("span",{class:Us(u.duration),children:[u.duration.toFixed(2)," ms"]})}),t("td",{children:u.collectors_data?.database?.total_queries??"-"}),t("td",{children:tt(xe(u))}),t("td",{children:t("span",{class:Ku(u.status),children:u.status})}),t("td",{class:"profiler-text--xs profiler-text--mono profiler-text--muted",children:t("button",{class:"token-copy",onClick:()=>us(u.token),title:"Copy full token",children:J===u.token?"\u2713":u.token.substring(0,8)+"\u2026"})}),t("td",{children:t("button",{class:"btn-row-delete",onClick:()=>Pa(u.token),title:"Delete",children:"\xD7"})})]},u.token))})]}),Ae&&!Wo&&t("div",{class:"profiler-load-more",children:t("button",{class:"btn btn-secondary",onClick:Ca,disabled:Te,children:Te?"Loading\u2026":"Load more"})})]})),n==="jobs"&&(z?t(Sr,{cols:["sm","flex","md","sm","xs","xs","sm"]}):Ke?t("div",{class:"profiler-empty",children:t("div",{class:"profiler-empty__title",children:Ke})}):I.length===0?t("div",{class:"profiler-empty",children:[t("div",{class:"profiler-empty__title",children:"No job profiles found"}),t("p",{class:"profiler-empty__description",children:"Run background jobs in your application to see profiling data"})]}):t(P,{children:[t("div",{class:"profiler-action-bar profiler-mb-3",children:[t("div",{class:"profiler-filter-group",children:[t("input",{type:"text",class:"profiler-filter-input",placeholder:"Search job class\u2026",value:er,onInput:u=>Ar(u.target.value)}),t("select",{class:"profiler-filter-select",value:tr,onChange:u=>Mr(u.target.value),children:[t("option",{value:"",children:"All Statuses"}),t("option",{value:"running",children:"Running"}),t("option",{value:"completed",children:"Completed"}),t("option",{value:"failed",children:"Failed"})]}),t("select",{class:"profiler-filter-select",value:Je,onChange:u=>lt(u.target.value),children:[t("option",{value:"",children:"All Durations"}),t("option",{value:"lt100",children:"<100ms"}),t("option",{value:"100",children:"\u2265100ms"}),t("option",{value:"500",children:"\u2265500ms"})]})]}),t("div",{class:"profiler-filter-group",children:[Zo&&t("span",{class:"profiler-filter-count",children:[ps.length," / ",I.length]}),t("button",{class:`btn-refresh${z?" btn-refresh--spinning":""}`,onClick:Dr,disabled:z,title:"Refresh",children:"\u21BA"}),t("button",{class:"btn btn-danger btn-sm",onClick:qa,title:"Delete job profiles",children:"Clear"}),t("button",{class:"btn btn-danger btn-sm",onClick:Hs,title:"Delete all HTTP and job profiles",children:"Clear All"})]})]}),ps.length===0?t("div",{class:"profiler-empty",children:t("div",{class:"profiler-empty__title",children:"No results match filters"})}):t("table",{children:[t("thead",{children:t("tr",{children:[t("th",{class:`sortable${ve.col==="date"?" sortable--active":""}`,onClick:()=>Vs("date"),children:["Time ",Re(ve.col,ve.dir,"date")]}),t("th",{children:"Job Class"}),t("th",{children:"Queue"}),t("th",{class:`sortable${ve.col==="duration"?" sortable--active":""}`,onClick:()=>Vs("duration"),children:["Duration ",Re(ve.col,ve.dir,"duration")]}),t("th",{class:`sortable${ve.col==="status"?" sortable--active":""}`,onClick:()=>Vs("status"),children:["Status ",Re(ve.col,ve.dir,"status")]}),t("th",{children:"Executions"}),t("th",{children:"Token"}),t("th",{})]})}),t("tbody",{children:Ka.map(u=>{let C=u.collectors_data?.job,V=Xi(u);return t("tr",{children:[t("td",{children:rs(u.started_at)}),t("td",{children:[t("a",{href:`${ts}/profiles/${u.token}`,children:u.path}),u.gem_version&&u.gem_version!==e&&t("span",{class:"profiler-version-warn",title:`Captur\xE9 avec v${u.gem_version} (actuel : v${e})`,children:"\u26A0\uFE0F"})]}),t("td",{children:t("span",{class:"profiler-text--xs profiler-text--mono",children:C?.queue||"-"})}),t("td",{children:V==="running"?t("span",{class:"profiler-text--muted",children:"-"}):t("span",{class:Us(u.duration),children:[u.duration.toFixed(2)," ms"]})}),t("td",{children:V==="running"?t("span",{class:"badge-info",children:[t("span",{class:"profiler-spinner","aria-hidden":"true",children:"\u25D0"})," Running"]}):t("span",{class:V==="failed"?"badge-error":"badge-success",children:V==="failed"?"\u2717 Failed":"\u2713 Completed"})}),t("td",{children:C?.executions??"-"}),t("td",{class:"profiler-text--xs profiler-text--mono profiler-text--muted",children:t("button",{class:"token-copy",onClick:()=>us(u.token),title:"Copy full token",children:J===u.token?"\u2713":u.token.substring(0,8)+"\u2026"})}),t("td",{children:t("button",{class:"btn-row-delete",onClick:()=>Aa(u.token),title:"Delete",children:"\xD7"})})]},u.token)})})]}),ot&&!Zo&&t("div",{class:"profiler-load-more",children:t("button",{class:"btn btn-secondary",onClick:Ra,disabled:nt,children:nt?"Loading\u2026":"Load more"})})]})),n==="console"&&(H?t(Sr,{cols:["sm","flex","sm","sm","xs","sm"]}):Ue?t("div",{class:"profiler-empty",children:t("div",{class:"profiler-empty__title",children:Ue})}):se.length===0?t("div",{class:"profiler-empty",children:[t("div",{class:"profiler-empty__title",children:"No console profiles found"}),t("p",{class:"profiler-empty__description",children:["Run expressions in ",t("code",{children:"rails console"})," to see profiling data"]})]}):t(P,{children:[t("div",{class:"profiler-action-bar profiler-mb-3",children:[t("div",{class:"profiler-filter-group",children:[t("input",{type:"text",class:"profiler-filter-input",placeholder:"Search expression\u2026",value:x,onInput:u=>q(u.target.value)}),t("select",{class:"profiler-filter-select",value:F,onChange:u=>A(u.target.value),children:[t("option",{value:"",children:"All Statuses"}),t("option",{value:"ok",children:"OK"}),t("option",{value:"error",children:"Error"})]})]}),t("div",{class:"profiler-filter-group",children:[Xo&&t("span",{class:"profiler-filter-count",children:[ds.length," / ",se.length]}),t("button",{class:`btn-refresh${H?" btn-refresh--spinning":""}`,onClick:Dr,disabled:H,title:"Refresh",children:"\u21BA"}),t("button",{class:"btn btn-danger btn-sm",onClick:Da,title:"Delete console profiles",children:"Clear"}),t("button",{class:"btn btn-danger btn-sm",onClick:Hs,title:"Delete all profiles",children:"Clear All"})]})]}),ds.length===0?t("div",{class:"profiler-empty",children:t("div",{class:"profiler-empty__title",children:"No results match filters"})}):t("table",{children:[t("thead",{children:t("tr",{children:[t("th",{class:`sortable${fe.col==="date"?" sortable--active":""}`,onClick:()=>$s("date"),children:["Time ",Re(fe.col,fe.dir,"date")]}),t("th",{children:"Expression"}),t("th",{class:`sortable${fe.col==="duration"?" sortable--active":""}`,onClick:()=>$s("duration"),children:["Duration ",Re(fe.col,fe.dir,"duration")]}),t("th",{children:"SQL"}),t("th",{class:`sortable${fe.col==="status"?" sortable--active":""}`,onClick:()=>$s("status"),children:["Status ",Re(fe.col,fe.dir,"status")]}),t("th",{children:"Token"}),t("th",{})]})}),t("tbody",{children:Ua.map(u=>{let C=u.status===500;return t("tr",{children:[t("td",{children:rs(u.started_at)}),t("td",{children:[t("a",{href:`${ts}/profiles/${u.token}`,class:"profiler-text--mono",style:"font-size:0.85em;",children:u.path.length>60?u.path.slice(0,60)+"\u2026":u.path}),u.gem_version&&u.gem_version!==e&&t("span",{class:"profiler-version-warn",title:`Captur\xE9 avec v${u.gem_version} (actuel : v${e})`,children:"\u26A0\uFE0F"})]}),t("td",{children:t("span",{class:Us(u.duration),children:[u.duration.toFixed(2)," ms"]})}),t("td",{children:u.collectors_data?.database?.total_queries??"-"}),t("td",{children:t("span",{class:C?"badge-error":"badge-success",children:C?"\u2717 Error":"\u2713 OK"})}),t("td",{class:"profiler-text--xs profiler-text--mono profiler-text--muted",children:t("button",{class:"token-copy",onClick:()=>us(u.token),title:"Copy full token",children:J===u.token?"\u2713":u.token.substring(0,8)+"\u2026"})}),t("td",{children:t("button",{class:"btn-row-delete",onClick:()=>Ma(u.token),title:"Delete",children:"\xD7"})})]},u.token)})})]}),R&&!Xo&&t("div",{class:"profiler-load-more",children:t("button",{class:"btn btn-secondary",onClick:ka,disabled:Xt,children:Xt?"Loading\u2026":"Load more"})})]})),n==="tests"&&(le?t(Sr,{cols:["sm","flex","md","sm","xs","sm"]}):qe?t("div",{class:"profiler-empty",children:t("div",{class:"profiler-empty__title",children:qe})}):N.length===0?t("div",{class:"profiler-empty",children:[t("div",{class:"profiler-empty__title",children:"No test profiles found"}),t("p",{class:"profiler-empty__description",children:["Add ",t("code",{children:"Profiler::TestHelpers::RSpecSupport.install(config)"})," to your spec_helper.rb and run your tests. Or use the ",t("a",{href:"#",style:"color:var(--profiler-accent,#06b6d4)",onClick:u=>{u.preventDefault(),gt("runner")},children:"Test Runner"})," tab to run tests from here."]})]}):t(P,{children:[t("div",{class:"profiler-action-bar profiler-mb-3",children:[t("div",{class:"profiler-filter-group",children:[t("input",{type:"text",class:"profiler-filter-input",placeholder:"Search test name\u2026",value:$,onInput:u=>we(u.target.value)}),t("select",{class:"profiler-filter-select",value:Ie,onChange:u=>Qt(u.target.value),children:[t("option",{value:"",children:"All Statuses"}),t("option",{value:"passed",children:"Passed"}),t("option",{value:"failed",children:"Failed"}),t("option",{value:"pending",children:"Pending"})]})]}),t("div",{class:"profiler-filter-group",children:[Yo&&t("span",{class:"profiler-filter-count",children:[fs.length," / ",N.length]}),t("button",{class:`btn-refresh${le?" btn-refresh--spinning":""}`,onClick:Dr,disabled:le,title:"Refresh",children:"\u21BA"}),t("button",{class:"btn btn-danger btn-sm",onClick:Qa,title:"Delete test profiles",children:"Clear All"})]})]}),fs.length===0?t("div",{class:"profiler-empty",children:t("div",{class:"profiler-empty__title",children:"No results match filters"})}):t("table",{children:[t("thead",{children:t("tr",{children:[t("th",{class:`sortable${me.col==="date"?" sortable--active":""}`,onClick:()=>rr(u=>({col:"date",dir:u.col==="date"&&u.dir==="asc"?"desc":"asc"})),children:["Time ",Re(me.col,me.dir,"date")]}),t("th",{children:"Test Name"}),t("th",{children:"File"}),t("th",{class:`sortable${me.col==="duration"?" sortable--active":""}`,onClick:()=>rr(u=>({col:"duration",dir:u.col==="duration"&&u.dir==="asc"?"desc":"asc"})),children:["Duration ",Re(me.col,me.dir,"duration")]}),t("th",{children:"Queries"}),t("th",{class:`sortable${me.col==="status"?" sortable--active":""}`,onClick:()=>rr(u=>({col:"status",dir:u.col==="status"&&u.dir==="asc"?"desc":"asc"})),children:["Status ",Re(me.col,me.dir,"status")]}),t("th",{children:"Token"}),t("th",{})]})}),t("tbody",{children:Na.map(u=>{let C=u.collectors_data?.test,V=u.status===500,ee=C?.status||(V?"failed":"passed");return t("tr",{children:[t("td",{children:rs(u.started_at)}),t("td",{style:"max-width: 300px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap",children:t("a",{href:`${ts}/profiles/${u.token}`,title:C?.test_name||u.path,children:C?.test_name||u.path})}),t("td",{class:"profiler-text--xs profiler-text--mono profiler-text--muted",children:C?.test_file||"-"}),t("td",{children:t("span",{class:Us(u.duration),children:[u.duration.toFixed(2)," ms"]})}),t("td",{children:u.collectors_data?.database?.total_queries??"-"}),t("td",{children:t("span",{class:ee==="failed"?"badge-error":ee==="pending"?"badge-warning":"badge-success",children:ee==="failed"?"\u2717 Failed":ee==="pending"?"\u23F8 Pending":"\u2713 Passed"})}),t("td",{class:"profiler-text--xs profiler-text--mono profiler-text--muted",children:t("button",{class:"token-copy",onClick:()=>us(u.token),title:"Copy full token",children:J===u.token?"\u2713":u.token.substring(0,8)+"\u2026"})}),t("td",{children:t("button",{class:"btn-row-delete",onClick:()=>Fa(u.token),title:"Delete",children:"\xD7"})})]},u.token)})})]}),j&&!Yo&&t("div",{class:"profiler-load-more",children:t("button",{class:"btn btn-secondary",onClick:Sa,disabled:Q,children:Q?"Loading\u2026":"Load more"})})]})),n==="runner"&&t(Ks,{}),n==="outbound"&&(ce?t(Sr,{cols:["sm","xs","flex","sm","xs"],rows:4}):ge?t("div",{class:"profiler-empty",children:t("div",{class:"profiler-empty__title",children:ge})}):D.length===0?t("div",{class:"profiler-empty",children:[t("div",{class:"profiler-empty__title",children:"No outbound HTTP requests found"}),t("p",{class:"profiler-empty__description",children:"Make requests to external services to see outbound HTTP data"})]}):t(P,{children:[t("div",{class:"profiler-action-bar profiler-mb-3",children:[t("div",{class:"profiler-filter-group",children:[t("input",{type:"text",class:"profiler-filter-input",placeholder:"Search URL\u2026",value:sr,onInput:u=>he(u.target.value)}),t("select",{class:"profiler-filter-select",value:Fr,onChange:u=>ls(u.target.value),children:[t("option",{value:"",children:"All Methods"}),t("option",{value:"GET",children:"GET"}),t("option",{value:"POST",children:"POST"}),t("option",{value:"PUT",children:"PUT"}),t("option",{value:"PATCH",children:"PATCH"}),t("option",{value:"DELETE",children:"DELETE"})]}),t("select",{class:"profiler-filter-select",value:Or,onChange:u=>Jo(u.target.value),children:[t("option",{value:"",children:"All Statuses"}),t("option",{value:"200",children:"2xx"}),t("option",{value:"300",children:"3xx"}),t("option",{value:"400",children:"4xx"}),t("option",{value:"500",children:"5xx"}),t("option",{value:"error",children:"Error"})]})]}),t("div",{class:"profiler-filter-group",children:[ja&&t("span",{class:"profiler-filter-count",children:[Gs.length," / ",D.length]}),t("button",{class:`btn-refresh${ce?" btn-refresh--spinning":""}`,onClick:Dr,disabled:ce,title:"Refresh",children:"\u21BA"})]})]}),t("p",{class:"profiler-text--xs profiler-text--muted profiler-mb-3",children:[D.length," outbound request",D.length!==1?"s":""," across all profiles. Click a request to expand headers and body."]}),Gs.length===0?t("div",{class:"profiler-empty",children:t("div",{class:"profiler-empty__title",children:"No results match filters"})}):Gs.map((u,C)=>t("div",{style:"margin-bottom:4px",children:[t("div",{class:"profiler-text--xs profiler-text--muted",style:"margin-bottom:2px",children:[rs(u.profile_started_at)," \xB7 Profile: ",t("a",{href:`${ts}/profiles/${u.profile_token}`,children:[u.profile_token.substring(0,8),"\u2026"]})]}),t(Ko,{req:u,index:C,threshold:500})]},C))]})),n==="env"&&(Z?t(Sr,{cols:["sm","flex","sm","sm"],rows:8}):_e?t("div",{class:"profiler-empty",children:t("div",{class:"profiler-empty__title",children:_e})}):t(st,{envData:O}))]})]})]})}function ta(){let[e,r]=b([]),[s,o]=b(!0),n=gi();return B(()=>{fetch("/_profiler/api/cluster/slaves").then(l=>l.json()).then(l=>{r(l.slaves??[]),o(!1)}).catch(()=>o(!1))},[]),s||e.length===0?null:t("div",{class:"profiler-selector",style:{display:"flex",alignItems:"center",gap:"8px",padding:"4px 12px",background:"var(--profiler-bg-secondary, #f5f5f5)",borderBottom:"1px solid var(--profiler-border, #e0e0e0)"},children:[t("span",{style:{fontSize:"12px",fontWeight:600,color:"var(--profiler-text-secondary, #666)",textTransform:"uppercase",letterSpacing:"0.05em"},children:"Profiler"}),t("select",{value:n??"__local__",onChange:l=>{let f=l.target.value;vi(f==="__local__"?null:f)},style:{fontSize:"13px",padding:"2px 6px",borderRadius:"4px",border:"1px solid var(--profiler-border, #ccc)",background:"var(--profiler-bg, #fff)",color:"var(--profiler-text, #333)",cursor:"pointer"},children:[t("option",{value:"__local__",children:"Local (master)"}),e.map(l=>t("option",{value:l.name,disabled:l.status==="offline",children:[l.name," ",l.status==="offline"?"(offline)":""]},l.name))]}),n&&t("span",{style:{fontSize:"11px",color:"var(--profiler-text-secondary, #888)",fontStyle:"italic"},children:"Viewing slave data via proxy"})]})}function Uu(e){let r=e.headers??{},s=e.params??{},o=e.request_body,n=[`curl -X ${e.method}`];Object.entries(r).filter(([a])=>a!=="User-Agent").forEach(([a,l])=>n.push(` -H '${a}: ${l}'`)),["POST","PUT","PATCH"].includes(e.method)&&(o&&o.length>0?n.push(` -d '${o.replace(/'/g,"'\\''")}'`):Object.keys(s).length>0&&((r["Content-Type"]??"").includes("application/json")?n.push(` -d '${JSON.stringify(s).replace(/'/g,"'\\''")}'`):Object.entries(s).forEach(([l,f])=>n.push(` --data-urlencode '${l}=${f}'`))));let i=`http://localhost:3000${e.path}`;return e.method==="GET"&&Object.keys(s).length>0&&(i+="?"+Object.entries(s).map(([a,l])=>`${encodeURIComponent(a)}=${encodeURIComponent(String(l))}`).join("&")),n.push(` '${i}'`),n.join(` \\
12
- `)}function Nu(e,r){let s=[],o=(i,a,l,f)=>{if(a){let p=l!=null?`${f?"at least ":""}${l.toLocaleString("en")} bytes, `:"";s.push(`${i} body truncated: ${p}only the beginning was kept (max_captured_body_bytes).`)}};o("Request",e.request_body_truncated??r.request_body_truncated,e.request_body_size??r.request_body_size,e.request_body_size_is_minimum??r.request_body_size_is_minimum),o("Response",e.response_body_truncated??r.response_body_truncated,e.response_body_size??r.response_body_size,e.response_body_size_is_minimum??r.response_body_size_is_minimum);let n=e.collectors_released_after_seconds??r.collectors_released_after_seconds;return n!=null&&s.push(`Incomplete profile: the collectors of this stream were released after ${n} s, before the server closed it; what it did later is missing.`),s}function ra({profile:e}){let r=e.collectors_data?.request??{},s=e.params&&Object.keys(e.params).length>0,o=Nu(e,r);return t("div",{class:"profiler-ajax-card profiler-ajax-card--success",style:"margin-bottom:8px;background:var(--profiler-bg-elevated);transform:translateX(3px);box-shadow:var(--profiler-shadow-sm);transition:none",children:[t(Ls,{method:e.method,url:e.path,copyUrl:`http://localhost:3000${e.path}`,status:e.status,duration:e.duration,curlCommand:Uu(e)}),(r.controller_action||r.route_pattern)&&t("div",{class:"profiler-ajax-card__row",children:[r.controller_action&&t("span",{class:"profiler-text--xs profiler-text--muted",style:"margin-right:16px",children:r.controller_action}),r.route_pattern&&t("span",{class:"profiler-text--xs profiler-text--muted",style:"font-family:monospace",children:[r.route_name?`${r.route_name} \xB7 `:"",r.route_pattern]})]}),o.map(n=>t("div",{class:"profiler-ajax-card__row profiler-text--xs profiler-text--warning",children:n},n)),t(Qs,{request:{headers:e.headers??{},body:e.request_body??void 0,body_encoding:e.request_body_encoding,params:s?e.params:void 0},response:{headers:e.response_headers??{},body:e.response_body??void 0,body_encoding:e.response_body_encoding}})]})}function ju(e){return e.replace(/\$\d+/g,"?").replace(/\b\d+\b/g,"?").replace(/'[^']*'/g,"?").replace(/"[^"]*"/g,"?").trim()}function Iu(e){let r=new Map;e.forEach((o,n)=>{if(o.cached||o.transaction)return;let i=ju(o.sql);r.has(i)||r.set(i,{indices:[],backtrace:o.backtrace??[]}),r.get(i).indices.push(n)});let s=[];return r.forEach(({indices:o,backtrace:n},i)=>{o.length>=3&&s.push({pattern:i,indices:o,backtrace:n})}),s.sort((o,n)=>n.indices.length-o.indices.length)}function sa(e,r=0){let s=e["Node Type"]??"",o=e["Actual Rows"]??0,n=e["Plan Rows"]??1,i=s.includes("Seq Scan")||s.includes("Hash Join")||s.includes("Nested Loop")||s.includes("Filter")||o>0&&n>0&&o>n*10,a=e.Plans??[];return t("div",{class:`profiler-explain-node${i?" profiler-explain-node--expensive":""}`,style:`margin-left:${r*14}px`,children:[t("span",{class:"profiler-explain-node__type",children:s}),e["Relation Name"]&&t("span",{class:"profiler-text--muted",children:[" on ",e["Relation Name"]]}),e["Index Name"]&&t("span",{class:"profiler-text--muted",children:[" using ",e["Index Name"]]}),t("div",{class:"profiler-explain-node__stats profiler-text--xs profiler-text--muted",children:[e["Actual Total Time"]!=null&&t("span",{children:["time: ",e["Actual Total Time"].toFixed(3),"ms"]}),e["Actual Rows"]!=null&&t("span",{children:["rows: ",o," (est: ",n,")"]}),e["Total Cost"]!=null&&t("span",{children:["cost: ",e["Total Cost"].toFixed(2)]}),e.Filter&&t("span",{class:"profiler-text--warning",children:["filter: ",e.Filter]})]}),a.map((l,f)=>sa(l,r+1))]})}function Vu({state:e,onClose:r}){if(B(()=>{if(!e.open)return;let o=n=>{n.key==="Escape"&&r()};return document.addEventListener("keydown",o),()=>document.removeEventListener("keydown",o)},[e.open]),!e.open)return null;let s=()=>{if(e.loading)return t("div",{class:"profiler-text--muted",children:"Running EXPLAIN ANALYZE\u2026"});if(e.error)return t("div",{class:"profiler-text--error",children:e.error});if(!e.result)return null;if(e.format==="json")try{let o=typeof e.result=="string"?JSON.parse(e.result):e.result,n=Array.isArray(o)?o:[o];return t("div",{class:"profiler-explain-result",children:n.map((i,a)=>t("div",{children:[sa(i.Plan??i),i["Planning Time"]!=null&&t("div",{class:"profiler-text--xs profiler-text--muted profiler-mt-2",children:["Planning: ",i["Planning Time"].toFixed(3),"ms",i["Execution Time"]!=null&&t(P,{children:[" \xB7 Execution: ",i["Execution Time"].toFixed(3),"ms"]})]})]},a))})}catch{return t("pre",{class:"profiler-explain-result",children:String(e.result)})}return t("pre",{class:"profiler-explain-result",children:String(e.result)})};return t("div",{class:"profiler-modal__overlay",onClick:r,children:t("div",{class:"profiler-modal",onClick:o=>o.stopPropagation(),children:[t("div",{class:"profiler-modal__header",children:[t("span",{class:"profiler-modal__title",children:"EXPLAIN ANALYZE"}),t("span",{class:"profiler-text--xs profiler-text--muted",children:e.adapter}),t("button",{class:"profiler-modal__close",onClick:r,children:"\xD7"})]}),t("div",{class:"profiler-modal__body",children:s()})]})})}function Pt({dbData:e,token:r}){let[s,o]=b(new Set),[n,i]=b({open:!1,loading:!1,result:null,format:"text",adapter:"",error:null}),{mutateAsync:a}=Ri();if(!e?.queries)return t("div",{class:"profiler-empty",children:t("p",{class:"profiler-empty__description",children:"No database queries recorded"})});let l=Iu(e.queries),f=new Set(l.flatMap(y=>y.indices)),p=y=>{o(m=>{let g=new Set(m);return g.has(y)?g.delete(y):g.add(y),g})},h=async y=>{i({open:!0,loading:!0,result:null,format:"text",adapter:"",error:null});try{let m=await a({data:{token:r,query_index:y}});i(g=>({...g,loading:!1,result:m.result,format:m.format??"text",adapter:m.adapter??""}))}catch(m){i(g=>({...g,loading:!1,error:m.message??"Request failed"}))}},d=()=>i(y=>({...y,open:!1}));return t(P,{children:[t("h2",{class:"profiler-section__header",children:["Database Queries (",e.total_queries,")"]}),t("div",{class:"profiler-flex profiler-flex--gap-4 profiler-mb-4 profiler-text--sm",children:[t("span",{children:["Total Duration: ",t("strong",{children:[e.total_duration," ms"]})]}),t("span",{children:["Slow Queries: ",t("strong",{class:"profiler-text--error",children:e.slow_queries})]}),t("span",{children:["Cached: ",t("strong",{children:e.cached_queries})]})]}),l.length>0&&t("div",{class:"profiler-alert-banner profiler-alert-banner--warning profiler-mb-4",children:[t("span",{class:"profiler-alert-banner__icon",children:"\u26A0\uFE0F"}),t("div",{style:"flex:1",children:[t("strong",{children:"Potential N+1 detected"})," - ",l.length," pattern",l.length>1?"s":""," repeated ",l.reduce((y,m)=>y+m.indices.length,0)," times total",t("div",{class:"profiler-text--xs profiler-text--muted profiler-mt-1",children:"Queries causing N+1 are highlighted below. Expand each group to see the call stack."})]}),l.length>1&&t("button",{class:"profiler-btn profiler-btn--sm",style:"flex-shrink:0;align-self:flex-start",onClick:()=>{let y=l.every(m=>s.has(m.pattern));o(y?new Set:new Set(l.map(m=>m.pattern)))},children:l.every(y=>s.has(y.pattern))?"Collapse all":"Expand all"})]}),l.map(y=>t("div",{class:"profiler-n1-group profiler-mb-4",children:[t("div",{class:"profiler-n1-group__header",onClick:()=>p(y.pattern),children:[t("span",{class:"profiler-n1-group__count",children:["N+1 \xB7 ",y.indices.length,"\xD7"]}),t("code",{class:"profiler-n1-group__pattern",children:y.pattern}),t("span",{class:"profiler-n1-group__toggle",children:[s.has(y.pattern)?"\u25B2":"\u25BC"," backtrace"]})]}),s.has(y.pattern)&&y.backtrace.length>0&&t("div",{class:"profiler-n1-backtrace",children:y.backtrace.map((m,g)=>t("div",{class:"profiler-n1-backtrace__frame",children:m},g))})]},y.pattern)),e.queries.map((y,m)=>t("div",{class:["profiler-query-card",y.slow?"profiler-query-card--slow":"",f.has(m)?"profiler-query-card--n1":""].filter(Boolean).join(" "),children:[t("div",{class:"profiler-query-card__header",children:[t("div",{class:"profiler-flex profiler-flex--gap-2",children:[t("span",{class:"profiler-text--muted",children:["#",m+1]}),f.has(m)&&t("span",{class:"profiler-badge profiler-badge--warning",children:"N+1"}),y.name&&t("span",{class:"profiler-text--xs profiler-text--muted",children:y.name})]}),t("div",{class:"profiler-flex profiler-flex--gap-2",children:[t("span",{class:`profiler-query-card__duration ${y.slow?"profiler-query-card__duration--slow":"profiler-query-card__duration--fast"}`,children:[y.duration.toFixed(2)," ms"]}),!y.cached&&!y.transaction&&t("button",{class:"profiler-btn profiler-btn--sm",onClick:()=>h(m),children:"Explain"})]})]}),t("code",{class:"profiler-query-card__code",children:y.sql})]},m)),t(Vu,{state:n,onClose:d})]})}function At({dumpData:e}){return e?.dumps?.length?t(P,{children:[t("h2",{class:"profiler-section__header",children:["Dumped Variables (",e.count,")"]}),e.dumps.map((r,s)=>t("div",{class:"profiler-dump-card",children:[t("div",{class:"profiler-dump-card__header",children:[t("div",{children:[t("span",{class:"profiler-text--xs profiler-text--muted",children:["#",s+1]}),r.label&&t("span",{class:"profiler-dump-card__label",children:r.label})]}),t("div",{children:[t("div",{class:"profiler-dump-card__location",children:[r.file,":",r.line]}),t("div",{class:"profiler-text--xs profiler-text--muted profiler-mt-1",children:new Date(r.timestamp).toLocaleTimeString("en",{hour12:!1})})]})]}),t("div",{class:"profiler-dump-card__content",children:t("pre",{children:r.formatted})})]},s))]}):t("div",{class:"profiler-empty",children:[t("div",{class:"profiler-empty__icon",children:"\u{1F50D}"}),t("h3",{class:"profiler-empty__title",children:"No dumps recorded"}),t("div",{class:"profiler-empty__description",children:[t("p",{children:["Use ",t("code",{children:"Profiler.dump(variable)"})," in your code to dump variables here."]}),t("p",{class:"profiler-mt-3",children:["Example: ",t("code",{children:'Profiler.dump(@user, "Current user")'})]})]})]})}var Hu={controller:"#60a5fa",view:"#34d399",partial:"#f59e0b",sql:"#fb923c",cache:"#a78bfa",http:"#f87171",custom:"#e879f9",method:"#94a3b8"},yt=24,$u=1,jo=yt+$u,Gu=60,Bu=300,ss=class{constructor(r,s,o){this.frames=[];this.maxDepth=0;this.globalStart=0;this.globalEnd=0;this.viewport={start:0,end:0};this.targetViewport={start:0,end:0};this.animating=!1;this.animStart=0;this.prevViewport={start:0,end:0};this.dpr=1;this.hoveredFrame=null;this.zoomStack=[];this.searchQuery="";this.highlightName="";this.isPanning=!1;this.panStartX=0;this.panStartViewport={start:0,end:0};this.boundHandlers={};this.canvas=r,this.ctx=r.getContext("2d"),this.callbacks=o,this.flatten(s),this.computeGlobalBounds(),this.viewport={start:this.globalStart,end:this.globalEnd},this.targetViewport={...this.viewport},this.setupCanvas(),this.bindEvents(),this.render()}flatten(r){this.frames=[],this.maxDepth=0;let s=(o,n)=>{for(let i of o)this.frames.push({node:i,depth:n,absStart:i.started_at,absEnd:i.finished_at}),n>this.maxDepth&&(this.maxDepth=n),i.children?.length&&s(i.children,n+1)};s(r,0)}computeGlobalBounds(){if(this.frames.length===0){this.globalStart=0,this.globalEnd=1;return}this.globalStart=Math.min(...this.frames.map(r=>r.absStart)),this.globalEnd=Math.max(...this.frames.map(r=>r.absEnd)),this.globalEnd<=this.globalStart&&(this.globalEnd=this.globalStart+1)}setupCanvas(){this.dpr=window.devicePixelRatio||1,this.resizeCanvas()}resizeCanvas(){let s=this.canvas.getBoundingClientRect().width,o=(this.maxDepth+1)*jo+8;this.canvas.width=s*this.dpr,this.canvas.height=o*this.dpr,this.canvas.style.height=`${o}px`,this.ctx.setTransform(this.dpr,0,0,this.dpr,0,0),this.render()}bindEvents(){this.boundHandlers.mousemove=r=>this.onMouseMove(r),this.boundHandlers.mouseleave=()=>this.onMouseLeave(),this.boundHandlers.click=r=>this.onClickEvent(r),this.boundHandlers.wheel=r=>this.onWheel(r),this.boundHandlers.mousedown=r=>this.onMouseDown(r),this.boundHandlers.mouseupmove=r=>this.onMouseUpOrMove(r),this.boundHandlers.mouseup=()=>this.onMouseUp(),this.canvas.addEventListener("mousemove",this.boundHandlers.mousemove),this.canvas.addEventListener("mouseleave",this.boundHandlers.mouseleave),this.canvas.addEventListener("click",this.boundHandlers.click),this.canvas.addEventListener("wheel",this.boundHandlers.wheel,{passive:!1}),this.canvas.addEventListener("mousedown",this.boundHandlers.mousedown),window.addEventListener("mousemove",this.boundHandlers.mouseupmove),window.addEventListener("mouseup",this.boundHandlers.mouseup)}hitTest(r,s){let o=this.canvas.getBoundingClientRect(),n=r-o.left,i=s-o.top,a=o.width,l=this.viewport.end-this.viewport.start;for(let f=this.frames.length-1;f>=0;f--){let p=this.frames[f],h=(p.absStart-this.viewport.start)/l*a,d=(p.absEnd-p.absStart)/l*a,y=p.depth*jo;if(n>=h&&n<=h+d&&i>=y&&i<=y+yt)return p}return null}onMouseMove(r){if(this.isPanning)return;let s=this.hitTest(r.clientX,r.clientY);this.hoveredFrame=s,this.canvas.style.cursor=s?"pointer":"default",this.callbacks.onHover(s,r.clientX,r.clientY),this.render()}onMouseLeave(){this.hoveredFrame=null,this.canvas.style.cursor="default",this.callbacks.onHover(null,0,0),this.render()}onClickEvent(r){if(this.isPanning)return;let s=this.hitTest(r.clientX,r.clientY);s&&(this.callbacks.onClick(s),this.zoomTo(s.node))}onWheel(r){r.preventDefault();let s=this.canvas.getBoundingClientRect(),n=(r.clientX-s.left)/s.width,i=this.viewport.end-this.viewport.start,a=r.deltaY>0?1.3:.7,l=Math.min(this.globalEnd-this.globalStart,i*a),f=this.viewport.start+n*i,p=f-n*l,h=f+(1-n)*l;p<this.globalStart&&(p=this.globalStart,h=p+l),h>this.globalEnd&&(h=this.globalEnd,p=h-l),this.animateViewport({start:p,end:h}),this.updateZoomStack(p,h)}onMouseDown(r){r.button===0&&(this.isPanning=!0,this.panStartX=r.clientX,this.panStartViewport={...this.viewport},this.canvas.style.cursor="grabbing")}onMouseUpOrMove(r){if(!this.isPanning)return;let s=r.clientX-this.panStartX,o=this.canvas.getBoundingClientRect(),n=this.panStartViewport.end-this.panStartViewport.start,i=-(s/o.width)*n,a=this.panStartViewport.start+i,l=this.panStartViewport.end+i;a<this.globalStart&&(l+=this.globalStart-a,a=this.globalStart),l>this.globalEnd&&(a-=l-this.globalEnd,l=this.globalEnd),this.viewport={start:a,end:l},this.targetViewport={...this.viewport},this.render()}onMouseUp(){this.isPanning&&(this.isPanning=!1,this.canvas.style.cursor="default")}zoomTo(r){let s=[],o=(i,a,l)=>{for(let f of i){if(f===a)return s.push(...l,f),!0;if(f.children?.length&&o(f.children,a,[...l,f]))return!0}return!1},n=this.frames.filter(i=>i.depth===0).map(i=>i.node);o(n,r,[]),this.zoomStack=s,this.animateViewport({start:r.started_at,end:r.finished_at}),this.callbacks.onZoomChange(s)}resetZoom(){this.zoomStack=[],this.animateViewport({start:this.globalStart,end:this.globalEnd}),this.callbacks.onZoomChange([])}updateZoomStack(r,s){let o=this.globalEnd-this.globalStart;s-r>=o*.99&&(this.zoomStack=[],this.callbacks.onZoomChange([]))}animateViewport(r){this.prevViewport={...this.viewport},this.targetViewport=r,this.animStart=performance.now(),this.animating||(this.animating=!0,this.animLoop())}animLoop(){let r=Math.min(1,(performance.now()-this.animStart)/Bu),s=r<.5?2*r*r:1-Math.pow(-2*r+2,2)/2;this.viewport={start:this.prevViewport.start+(this.targetViewport.start-this.prevViewport.start)*s,end:this.prevViewport.end+(this.targetViewport.end-this.prevViewport.end)*s},this.render(),r<1?requestAnimationFrame(()=>this.animLoop()):(this.animating=!1,this.viewport={...this.targetViewport},this.render())}setSearchQuery(r){this.searchQuery=r,this.render()}setHighlightName(r){this.highlightName=r,this.render()}render(){let r=this.ctx,s=this.canvas.width/this.dpr,o=this.canvas.height/this.dpr,n=this.viewport.end-this.viewport.start;r.clearRect(0,0,s,o);let i=getComputedStyle(this.canvas),a=i.getPropertyValue("--profiler-text").trim()||"#eef2f7",l=i.getPropertyValue("--profiler-text-muted").trim()||"#5e7080",f=this.searchQuery.toLowerCase(),p=f.length>0;if(p&&this.callbacks.onSearchResults){let h=0;for(let d of this.frames)d.node.name.toLowerCase().includes(f)&&h++;this.callbacks.onSearchResults(h,this.frames.length)}for(let h of this.frames){let d=(h.absStart-this.viewport.start)/n*s,y=(h.absEnd-h.absStart)/n*s,m=h.depth*jo;if(d+y<0||d>s||y<.5)continue;let g=Hu[h.node.category]||"#a78bfa",v=h===this.hoveredFrame,_=!!this.highlightName&&h.node.name===this.highlightName,T=!p||h.node.name.toLowerCase().includes(f);if(r.fillStyle=v||_?this.lightenColor(g,.2):g,r.globalAlpha=p&&!T?.2:v||_?1:.85,this.roundRect(r,d,m,y,yt,3),r.fill(),r.globalAlpha=1,v?(r.strokeStyle="#ffffff",r.lineWidth=1.5,this.roundRect(r,d,m,y,yt,3),r.stroke()):_?(r.strokeStyle="#fbbf24",r.lineWidth=2,this.roundRect(r,d,m,y,yt,3),r.stroke()):p&&T&&(r.strokeStyle="#ffffff",r.lineWidth=1,r.globalAlpha=.5,this.roundRect(r,d,m,y,yt,3),r.stroke(),r.globalAlpha=1),y>Gu&&T){r.fillStyle=this.getTextColor(g),r.font='11px "JetBrains Mono", monospace',r.textBaseline="middle";let w=h.node.name,S=`${h.node.duration.toFixed(1)}ms`,M=y-8,K=r.measureText(S).width;if(M>K+20){let I=M-K-8;r.fillText(this.truncateText(r,w,I),d+4,m+yt/2),r.fillStyle=v?a:l,r.fillText(S,d+y-K-4,m+yt/2)}else r.fillText(this.truncateText(r,w,M),d+4,m+yt/2)}}}roundRect(r,s,o,n,i,a){r.beginPath(),r.moveTo(s+a,o),r.lineTo(s+n-a,o),r.quadraticCurveTo(s+n,o,s+n,o+a),r.lineTo(s+n,o+i-a),r.quadraticCurveTo(s+n,o+i,s+n-a,o+i),r.lineTo(s+a,o+i),r.quadraticCurveTo(s,o+i,s,o+i-a),r.lineTo(s,o+a),r.quadraticCurveTo(s,o,s+a,o),r.closePath()}truncateText(r,s,o){if(r.measureText(s).width<=o)return s;let n=s;for(;n.length>0&&r.measureText(n+"...").width>o;)n=n.slice(0,-1);return n.length>0?n+"...":""}lightenColor(r,s){let o=parseInt(r.slice(1),16),n=Math.min(255,(o>>16&255)+Math.round(255*s)),i=Math.min(255,(o>>8&255)+Math.round(255*s)),a=Math.min(255,(o&255)+Math.round(255*s));return`rgb(${n},${i},${a})`}getTextColor(r){let s=parseInt(r.slice(1),16),o=s>>16&255,n=s>>8&255,i=s&255;return(.299*o+.587*n+.114*i)/255>.5?"#1a1a2e":"#f0f0f0"}destroy(){this.canvas.removeEventListener("mousemove",this.boundHandlers.mousemove),this.canvas.removeEventListener("mouseleave",this.boundHandlers.mouseleave),this.canvas.removeEventListener("click",this.boundHandlers.click),this.canvas.removeEventListener("wheel",this.boundHandlers.wheel),this.canvas.removeEventListener("mousedown",this.boundHandlers.mousedown),window.removeEventListener("mousemove",this.boundHandlers.mouseupmove),window.removeEventListener("mouseup",this.boundHandlers.mouseup)}};var Ju={controller:"Controller",view:"View",partial:"Partial",sql:"SQL",cache:"Cache",http:"HTTP",custom:"Custom",method:"Method"},zu={controller:"#60a5fa",view:"#34d399",partial:"#f59e0b",sql:"#fb923c",cache:"#a78bfa",http:"#f87171",custom:"#e879f9",method:"#94a3b8"};function Wu(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(2)} MB`}var os=class{constructor(r,s){this.totalDuration=s,this.el=document.createElement("div"),this.el.className="profiler-flamegraph__tooltip",r.appendChild(this.el)}show(r,s,o){let n=r.node,i=n.category,a=zu[i]||"#a78bfa",l=Ju[i]||i,f=this.totalDuration>0?(n.duration/this.totalDuration*100).toFixed(1):"0";this.el.textContent="";let p=document.createElement("div");if(p.className="tooltip-header",p.textContent=n.name,this.el.appendChild(p),this.addRow("Category",()=>{let m=document.createElement("span");return m.className="tooltip-badge",m.style.background=a,m.textContent=l,m}),this.addRow("Duration",()=>{let m=document.createElement("span");return m.className="value",m.textContent=`${n.duration.toFixed(2)} ms`,m}),this.addRow("% of total",()=>{let m=document.createElement("span");return m.className="value",m.textContent=`${f}%`,m}),i==="method"&&n.payload&&(n.payload.memory_bytes!=null&&this.addRow("Memory",()=>{let m=document.createElement("span");return m.className="value",m.textContent=Wu(n.payload.memory_bytes),m}),n.payload.allocated_objects!=null&&this.addRow("Objects",()=>{let m=document.createElement("span");return m.className="value",m.textContent=`${n.payload.allocated_objects.toLocaleString()} obj`,m}),n.payload.recursive&&this.addRow("Recursive",()=>{let m=document.createElement("span");return m.className="value",m.style.color="var(--profiler-warning)",m.textContent="\u21BA yes",m}),n.payload.file)){let m=document.createElement("div");m.className="tooltip-payload",m.textContent=`${n.payload.file}:${n.payload.line}`,this.el.appendChild(m)}if(n.payload&&i!=="method"){let m=null;if(i==="sql"&&n.payload.sql){let g=n.payload.sql;m=g.length>200?g.slice(0,200)+"...":g}else if(i==="cache"&&n.payload.key)m=`Key: ${n.payload.key}`;else if(i==="http"&&n.payload.url)m=n.payload.url;else if(i==="custom"&&Object.keys(n.payload).length>0){let g=Object.entries(n.payload).map(([v,_])=>`${v}: ${JSON.stringify(_)}`).join(`
13
- `);m=g.length>200?g.slice(0,200)+"...":g}if(m){let g=document.createElement("div");g.className="tooltip-payload",g.textContent=m,this.el.appendChild(g)}}let h=s+12,d=o-8,y=this.el.getBoundingClientRect();h+y.width>window.innerWidth&&(h=s-y.width-12),d+y.height>window.innerHeight&&(d=o-y.height-8),d<0&&(d=4),this.el.style.left=`${h}px`,this.el.style.top=`${d}px`,this.el.classList.add("visible")}hide(){this.el.classList.remove("visible")}destroy(){this.el.remove()}addRow(r,s){let o=document.createElement("div");o.className="tooltip-row";let n=document.createElement("span");n.className="label",n.textContent=r,o.appendChild(n),o.appendChild(s()),this.el.appendChild(o)}};var ns=class{constructor(r,s){this.onNavigate=s,this.el=document.createElement("div"),this.el.className="profiler-flamegraph__breadcrumbs",r.appendChild(this.el)}update(r){if(this.el.textContent="",r.length===0){this.el.style.display="none";return}this.el.style.display="flex";let s=document.createElement("button");s.className="breadcrumb-item",s.textContent="Root",s.addEventListener("click",()=>this.onNavigate(null)),this.el.appendChild(s);for(let o of r){let n=document.createElement("span");n.className="breadcrumb-separator",n.textContent="\u203A",this.el.appendChild(n);let i=document.createElement("button");i.className="breadcrumb-item";let a=o.name.length>30?o.name.slice(0,30)+"...":o.name;i.textContent=a,i.addEventListener("click",()=>this.onNavigate(o)),this.el.appendChild(i)}}destroy(){this.el.remove()}};var Io={controller:"#60a5fa",view:"#34d399",partial:"#f59e0b",sql:"#fb923c",cache:"#a78bfa",http:"#f87171",custom:"#e879f9",method:"#94a3b8"},oa={controller:"Controller",view:"View",partial:"Partial",sql:"SQL",cache:"Cache",http:"HTTP",custom:"Custom",method:"Method"};function Mt({flamegraphData:e,perfData:r,functionProfileData:s}){let o=de(null),n=de(null),i=de(null),a=de(null),l=de(null),f=de(null),[p,h]=b(!1),[d,y]=b(""),[m,g]=b(0),[v,_]=b(0),[T,w]=b("total_duration"),[S,M]=b("desc"),[K,I]=b(s?.reason==="stackprof_missing"?!0:s?.enabled??!1),[se,N]=b(s?.max_frames??2e3),[D,O]=b(s?.mode==="lite"?"lite":"full"),[U,z]=b(s?.clock??"wall"),[H,le]=b(!1),[ce,Z]=b(!1),[Pe,Ke]=b(!1),[Ue,qe]=b(!1),{mutateAsync:ge}=ki(),_e=async()=>{le(!0);try{let Q=await ge({data:{enabled:!K}});I(Q.enabled)}finally{le(!1)}},Ae=async Q=>{Z(!0);try{let J=await ge({data:{max_frames:Q}});N(J.max_frames)}finally{Z(!1)}},ot=async Q=>{O(Q),Ke(!0);try{let J=await ge({data:{mode:Q}});O(J.mode??Q)}finally{Ke(!1)}},R=async Q=>{qe(!0);try{let J=await ge({data:{clock:Q}});z(J.clock??Q)}finally{qe(!1)}},j=e;if(B(()=>{if(!j?.root_events?.length||!o.current||!n.current)return;let Q=n.current,J=o.current,Ne=new os(Q,j.total_duration);a.current=Ne;let Me=new ns(Q,ue=>{i.current&&(ue?i.current.zoomTo(ue):i.current.resetZoom())});l.current=Me,Q.insertBefore(Me.el,J);let Fe=new ss(J,j.root_events,{onHover:(ue,it,Be)=>{ue?Ne.show(ue,it,Be):Ne.hide()},onClick:ue=>{h(!0)},onZoomChange:ue=>{Me.update(ue),h(ue.length>0)},onSearchResults:(ue,it)=>{g(ue),_(it)}});i.current=Fe;let De=()=>Fe.resizeCanvas();window.addEventListener("resize",De);let Dt=()=>Fe.render();return document.addEventListener("profiler:theme-change",Dt),()=>{Fe.destroy(),Ne.destroy(),Me.destroy(),window.removeEventListener("resize",De),document.removeEventListener("profiler:theme-change",Dt),i.current=null,a.current=null,l.current=null}},[j]),B(()=>{i.current?.setSearchQuery(d),d||(g(0),_(0))},[d]),B(()=>{let Q=J=>{(J.ctrlKey||J.metaKey)&&J.key==="f"&&(J.preventDefault(),f.current?.focus())};return document.addEventListener("keydown",Q,{capture:!0}),()=>document.removeEventListener("keydown",Q,{capture:!0})},[]),!j?.root_events?.length)return r?.events?.length?t("div",{class:"profiler-flamegraph",children:[t("h2",{class:"profiler-section__header",children:["Performance Timeline (",r.total_events," events)"]}),t("p",{class:"profiler-mb-4",children:["Total Duration: ",t("strong",{children:[r.total_duration," ms"]})]}),r.events.map((Q,J)=>t("div",{class:"profiler-query-card",children:[t("div",{class:"profiler-query-card__header",children:[t("strong",{children:Q.name}),t("span",{class:Q.duration>=500?"badge-error":Q.duration>=100?"badge-warning":"badge-success",children:[Q.duration.toFixed(2)," ms"]})]}),Q.payload&&Object.keys(Q.payload).length>0&&t("pre",{class:"profiler-text--xs profiler-text--muted profiler-mt-2",children:JSON.stringify(Q.payload,null,2)})]},J)),t(Vo,{data:s,enabled:K,toggling:H,maxFrames:se,maxFramesUpdating:ce,mode:D,modeUpdating:Pe,clock:U,clockUpdating:Ue,sortKey:T,sortDir:S,onToggle:_e,onMaxFramesChange:Ae,onModeChange:ot,onClockChange:R,onSortChange:(Q,J)=>{w(Q),M(J)}})]}):t("div",{class:"profiler-flamegraph",children:[t("div",{class:"profiler-empty",children:t("p",{class:"profiler-empty__description",children:"No performance events recorded"})}),t(Vo,{data:s,enabled:K,toggling:H,maxFrames:se,maxFramesUpdating:ce,mode:D,modeUpdating:Pe,clock:U,clockUpdating:Ue,sortKey:T,sortDir:S,onToggle:_e,onMaxFramesChange:Ae,onModeChange:ot,onClockChange:R,onSortChange:(Q,J)=>{w(Q),M(J)}})]});let Te={},nt=Q=>{let J=Q.category;Te[J]||(Te[J]={count:0,duration:0}),Te[J].count++,Te[J].duration+=Q.duration,Q.children?.forEach(nt)};j.root_events.forEach(nt);let Xt=()=>{i.current?.resetZoom(),h(!1)};return t("div",{class:"profiler-flamegraph",children:[t("div",{class:"profiler-flamegraph__stats",children:[t("div",{class:"stat-item",children:[t("span",{class:"stat-label",children:"Total Events"}),t("span",{class:"stat-value",children:j.total_events})]}),t("div",{class:"stat-item",children:[t("span",{class:"stat-label",children:"Total Duration"}),t("span",{class:"stat-value",children:[j.total_duration.toFixed(2)," ",t("small",{children:"ms"})]})]}),Object.keys(Te).map(Q=>t("div",{class:"stat-item",children:[t("span",{class:"stat-label",children:[t("span",{class:"stat-dot",style:{background:Io[Q]}}),oa[Q]]}),t("span",{class:"stat-value",children:Te[Q].count})]},Q))]}),t("div",{class:"profiler-flamegraph__legend",children:Object.keys(Io).map(Q=>t("div",{class:"legend-item",children:[t("span",{class:"legend-color",style:{background:Io[Q]}}),t("span",{children:oa[Q]})]},Q))}),t("div",{class:"profiler-flamegraph__controls",children:[p&&t("button",{class:"profiler-flamegraph__reset",onClick:Xt,children:"Reset Zoom"}),t("div",{class:"profiler-flamegraph__search",children:[t("input",{ref:f,type:"text",class:"profiler-flamegraph__search-input",placeholder:"Search events\u2026 (Ctrl+F)",value:d,onInput:Q=>y(Q.target.value)}),d&&t("span",{class:"profiler-flamegraph__match-count",children:[m," / ",v]})]}),t("span",{class:"profiler-flamegraph__hint",children:"Click to zoom, scroll to zoom in/out, drag to pan"})]}),t("div",{class:"profiler-flamegraph__canvas-container",ref:n,children:t("canvas",{ref:o,class:"profiler-flamegraph__canvas",style:{width:"100%"}})}),t(Vo,{data:s,enabled:K,toggling:H,maxFrames:se,maxFramesUpdating:ce,mode:D,modeUpdating:Pe,clock:U,clockUpdating:Ue,sortKey:T,sortDir:S,onToggle:_e,onMaxFramesChange:Ae,onModeChange:ot,onClockChange:R,onSortChange:(Q,J)=>{w(Q),M(J)}})]})}function na(e,r=new Set){return r.add(e.name),e.children?.forEach(s=>na(s,r)),r}function ia(e,r){for(let s of e){if(s.name===r)return s;let o=ia(s.children??[],r);if(o)return o}return null}function Vo({data:e,enabled:r,toggling:s,maxFrames:o,maxFramesUpdating:n,mode:i,modeUpdating:a,clock:l,clockUpdating:f,sortKey:p,sortDir:h,onToggle:d,onMaxFramesChange:y,onModeChange:m,onClockChange:g,onSortChange:v}){let[_,T]=b(null),[w,S]=b(null),[M,K]=b(null),I=de(null),se=r&&e?.enabled&&(e.functions?.length??0)>0,N=e?.reason==="stackprof_missing"&&i==="lite",D=e?.mode??"full",O=e?.clock??"wall",U=D==="lite",z=O==="object",H=!U,le=D==="full",ce=i==="lite",Z=p==="memory_bytes"&&!le||p==="allocated_objects"&&!H?"total_duration":p,Pe=se?e.root_calls??[]:[],Ke=se?[...e.functions].sort((R,j)=>h==="asc"?R[Z]-j[Z]:j[Z]-R[Z]):[],Ue=_?Ke.filter(R=>_.has(R.name)):Ke,qe=R=>{R?(T(na(R)),S(R.name)):(T(null),S(null))},ge=R=>{R===p?v(R,h==="asc"?"desc":"asc"):v(R,"desc")},_e=R=>Z!==R?t("span",{class:"sort-icon sort-icon--idle",children:"\u21C5"}):t("span",{class:"sort-icon sort-icon--active",children:h==="asc"?"\u25B2":"\u25BC"}),Ae=R=>{let j=parseInt(R.target.value,10);!isNaN(j)&&j>0&&j!==o&&y(j)},ot=R=>{R.key==="Enter"&&R.target.blur()};return t("div",{class:"profiler-fn-profiling",children:[t("div",{class:"profiler-fn-profiling__header",children:[t("span",{class:`profiler-fn-profiling__title${r?" profiler-fn-profiling__title--active":""}`,children:"Function Profiling"}),t("div",{class:"profiler-fn-profiling__controls",children:[t("div",{class:"profiler-fn-profiling__mode-selector",children:["full","lite"].map(R=>t("button",{class:`profiler-fn-profiling__mode-btn${i===R?" profiler-fn-profiling__mode-btn--active":""}`,onClick:()=>i!==R&&m(R),disabled:a,title:R==="full"?"Exhaustive TracePoint - timing + allocations + memory bytes":"StackProf sampling - very low overhead",children:R.charAt(0).toUpperCase()+R.slice(1)},R))}),ce&&t("div",{class:"profiler-fn-profiling__mode-selector",children:["wall","cpu","object"].map(R=>t("button",{class:`profiler-fn-profiling__mode-btn${l===R?" profiler-fn-profiling__mode-btn--active":""}`,onClick:()=>l!==R&&g(R),disabled:f,title:R==="wall"?"Wall-clock time (includes I/O waits)":R==="cpu"?"CPU time only (excludes I/O waits)":"Object allocations per function",children:R==="wall"?"Wall":R==="cpu"?"CPU":"Alloc"},R))}),t("label",{class:"profiler-fn-profiling__max-frames-label",children:["Max frames",t("input",{type:"number",class:"profiler-fn-profiling__max-frames-input",defaultValue:o,min:1,disabled:n,onBlur:Ae,onKeyDown:ot}),n&&t("span",{class:"profiler-fn-profiling__updating",children:"\u2026"})]}),t("button",{class:`profiler-fn-profiling__toggle${r?" profiler-fn-profiling__toggle--active":""}`,onClick:d,disabled:s,children:s?"\u2026":r?"Enabled (click to disable)":"Disabled (click to enable)"})]})]}),!r&&t("p",{class:"profiler-fn-profiling__hint",children:["Enable function profiling to see where your app spends time."," ",t("strong",{children:"Lite"}),": statistical sampling with the stackprof gem, to add to the application's Gemfile; very low overhead (<1%), on by default once stackprof is installed."," ",t("strong",{children:"Full"}),": exhaustive TracePoint tracing with memory bytes - significant overhead."]}),r&&N&&t("p",{class:"profiler-fn-profiling__hint",children:["No data: sampling needs the ",t("code",{children:"stackprof"})," gem, which is not installed. Add"," ",t("code",{children:'gem "stackprof"'})," to the application's Gemfile. To trace every method call instead, at a much higher cost, choose ",t("strong",{children:"Full"}),", or set"," ",t("code",{children:"Profiler.function_profiling_tracepoint_fallback = true"})," in an initializer."]}),r&&!se&&!N&&t("p",{class:"profiler-fn-profiling__hint",children:"Function profiling is active. Data will appear on the next request."}),se&&t(P,{children:[e.frame_cap_reached&&t("div",{class:"profiler-fn-profiling__cap-warning",children:["\u26A0 Frame cap reached (",e.max_frames,' frames) - call tree is truncated. Increase "Max frames" to capture more.']}),t("div",{class:"profiler-flamegraph__stats",style:{marginTop:"0.75rem"},children:[t("div",{class:"stat-item",children:[t("span",{class:"stat-label",children:"Functions"}),t("span",{class:"stat-value",children:e.functions.length})]}),t("div",{class:"stat-item",children:[t("span",{class:"stat-label",children:U?"Total Samples":"Total Calls"}),t("span",{class:"stat-value",children:e.total_calls})]}),!z&&t("div",{class:"stat-item",children:[t("span",{class:"stat-label",children:"Wall"}),t("span",{class:"stat-value",children:[(e.elapsed_wall_ms??e.total_duration??0).toFixed(2)," ",t("small",{children:"ms"})]})]}),U&&!z&&e.elapsed_cpu_ms!=null&&t("div",{class:"stat-item",children:[t("span",{class:"stat-label",title:"CPU time excludes I/O waits (DB, network, sleep). Low CPU% = I/O-bound.",children:"CPU"}),t("span",{class:"stat-value",children:[e.elapsed_cpu_ms.toFixed(2)," ",t("small",{children:"ms"}),e.elapsed_wall_ms!=null&&e.elapsed_wall_ms>0&&t("small",{class:"profiler-fn-profiling__cpu-pct",children:[" ","(",Math.round(e.elapsed_cpu_ms/e.elapsed_wall_ms*100),"%)"]})]})]}),z&&t("div",{class:"stat-item",children:[t("span",{class:"stat-label",children:"Allocations"}),t("span",{class:"stat-value",children:[e.total_duration?.toLocaleString()," ",t("small",{children:"obj"})]})]}),U&&(e.gc_overhead_pct??0)>0&&t("div",{class:"stat-item",children:[t("span",{class:"stat-label",title:`${e.gc_samples} samples during GC`,children:"GC"}),t("span",{class:`stat-value${(e.gc_overhead_pct??0)>=20?" profiler-fn-profiling__gc--high":(e.gc_overhead_pct??0)>=5?" profiler-fn-profiling__gc--medium":""}`,children:[e.gc_overhead_pct,"%"]})]}),H&&t("div",{class:"stat-item",children:[t("span",{class:"stat-label",children:"Allocated"}),t("span",{class:"stat-value",children:[e.total_allocated_objects?.toLocaleString()," ",t("small",{children:"obj"})]})]}),le&&t("div",{class:"stat-item",children:[t("span",{class:"stat-label",children:"Memory"}),t("span",{class:"stat-value",children:Rr(e.total_memory_bytes??0)})]})]}),Pe.length>0&&t(Zu,{rootCalls:Pe,onFrameSelect:qe,rendererRef:I,onHoverName:R=>K(R)}),_&&t("div",{class:"profiler-fn-profiling__filter-active",children:[t("span",{children:["Showing ",t("strong",{children:w})," + ",_.size-1," child function",_.size!==2?"s":""]}),t("button",{class:"profiler-fn-profiling__filter-clear",onClick:()=>{T(null),S(null)},children:"\u2715 Clear"})]}),t("table",{class:"profiler-table profiler-fn-profiling__table",children:[t("thead",{children:t("tr",{children:[t("th",{children:"Function"}),t("th",{children:"File"}),t("th",{class:`profiler-text--right sortable${Z==="calls"?" sortable--active":""}`,onClick:()=>ge("calls"),children:[U?"Samples":"Calls"," ",_e("calls")]}),t("th",{class:`profiler-text--right sortable${Z==="total_duration"?" sortable--active":""}`,onClick:()=>ge("total_duration"),children:[z?"Total Alloc":"Total Time"," ",_e("total_duration")]}),t("th",{class:`profiler-text--right sortable${Z==="self_duration"?" sortable--active":""}`,onClick:()=>ge("self_duration"),children:[z?"Self Alloc":"Self Time"," ",_e("self_duration")]}),H&&t("th",{class:`profiler-text--right sortable${Z==="allocated_objects"?" sortable--active":""}`,onClick:()=>ge("allocated_objects"),children:["Objects ",_e("allocated_objects")]}),le&&t("th",{class:`profiler-text--right sortable${Z==="memory_bytes"?" sortable--active":""}`,onClick:()=>ge("memory_bytes"),children:["Memory ",_e("memory_bytes")]})]})}),t("tbody",{children:Ue.map((R,j)=>t("tr",{class:M===R.name?"profiler-fn-profiling__row--highlighted":"",style:{cursor:Pe.length>0?"pointer":"default"},onMouseEnter:()=>{K(R.name),I.current?.setHighlightName(R.name)},onMouseLeave:()=>{K(null),I.current?.setHighlightName("")},onClick:()=>{let Te=ia(Pe,R.name);Te&&(I.current?.zoomTo(Te),qe(Te))},children:[t("td",{class:"profiler-fn-profiling__name",children:[R.recursive_calls>0&&t("span",{class:"profiler-fn-profiling__recursive",title:`${R.recursive_calls} recursive call(s)`,children:"\u21BA"}),R.name]}),t("td",{class:"profiler-text--muted profiler-text--xs",style:{fontFamily:"var(--profiler-font-mono)"},children:[R.file,":",R.line]}),t("td",{class:"profiler-text--right",children:R.calls}),t("td",{class:"profiler-text--right",children:z?t("span",{class:"profiler-text--muted",children:[R.total_duration.toLocaleString()," ",t("small",{children:"obj"})]}):t("span",{class:R.total_duration>=100?"badge-error":R.total_duration>=10?"badge-warning":"badge-success",children:[R.total_duration.toFixed(2)," ms"]})}),t("td",{class:"profiler-text--right",children:z?t("span",{class:"profiler-text--muted",children:[R.self_duration.toLocaleString()," ",t("small",{children:"obj"})]}):t("span",{class:R.self_duration>=50?"badge-error":R.self_duration>=5?"badge-warning":"badge-success",children:[R.self_duration.toFixed(2)," ms"]})}),H&&t("td",{class:"profiler-text--right profiler-text--muted",children:[R.allocated_objects.toLocaleString()," ",t("small",{children:"obj"})]}),le&&t("td",{class:"profiler-text--right profiler-text--muted",children:Rr(R.memory_bytes)})]},j))})]})]})]})}function Zu({rootCalls:e,onFrameSelect:r,rendererRef:s,onHoverName:o}){let n=de(null),i=de(null),a=de(null),l=de(r),f=de(o),[p,h]=b(!1);B(()=>{l.current=r},[r]),B(()=>{f.current=o},[o]);let d=e.reduce((m,g)=>m+g.duration,0);return B(()=>{if(!e.length||!n.current||!i.current)return;let m=i.current,g=n.current,v=new os(m,d),_=new ns(m,M=>{M?(a.current?.zoomTo(M),l.current?.(M)):(a.current?.resetZoom(),l.current?.(null))});m.insertBefore(_.el,g);let T=new ss(g,e,{onHover:(M,K,I)=>{M?(v.show(M,K,I),f.current?.(M.node.name)):(v.hide(),f.current?.(null))},onClick:M=>{h(!0),l.current?.(M.node),T.zoomTo(M.node)},onZoomChange:M=>{_.update(M),h(M.length>0),M.length===0&&l.current?.(null)}});a.current=T,s&&(s.current=T);let w=()=>T.resizeCanvas();window.addEventListener("resize",w);let S=()=>T.render();return document.addEventListener("profiler:theme-change",S),()=>{T.destroy(),v.destroy(),_.destroy(),window.removeEventListener("resize",w),document.removeEventListener("profiler:theme-change",S),a.current=null,s&&(s.current=null)}},[e]),t("div",{class:"profiler-fn-profiling__flamegraph",children:[t("div",{class:"profiler-flamegraph__controls",children:[p&&t("button",{class:"profiler-flamegraph__reset",onClick:()=>{a.current?.resetZoom(),h(!1),l.current?.(null)},children:"Reset Zoom"}),t("span",{class:"profiler-flamegraph__hint",children:"Click to zoom & filter table \xB7 scroll to zoom in/out \xB7 drag to pan"})]}),t("div",{class:"profiler-flamegraph__canvas-container",ref:i,children:t("canvas",{ref:n,class:"profiler-flamegraph__canvas",style:{width:"100%"}})})]})}function aa({viewData:e}){return e?t(P,{children:[t("h2",{class:"profiler-section__header",children:"View Rendering"}),t("div",{class:"profiler-flex profiler-flex--gap-4 profiler-mb-4 profiler-text--sm",children:[t("span",{children:["Views: ",t("strong",{children:e.total_views})]}),t("span",{children:["Partials: ",t("strong",{children:e.total_partials})]}),t("span",{children:["Total Duration: ",t("strong",{children:[e.total_duration," ms"]})]})]}),e.views&&e.views.length>0&&t(P,{children:[t("h3",{class:"profiler-text--lg profiler-mt-6 profiler-mb-3",children:"Templates"}),e.views.map((r,s)=>t("div",{class:"profiler-query-card profiler-query-card--success",children:t("div",{class:"profiler-query-card__header",children:[t("span",{children:r.identifier}),t("span",{class:"badge-success",children:[r.duration.toFixed(2)," ms"]})]})},s))]}),e.partials&&e.partials.length>0&&t(P,{children:[t("h3",{class:"profiler-text--lg profiler-mt-6 profiler-mb-3",children:"Partials"}),e.partials.map((r,s)=>t("div",{class:"profiler-query-card profiler-query-card--success",children:t("div",{class:"profiler-query-card__header",children:[t("span",{children:r.identifier}),t("span",{class:"badge-success",children:[r.duration.toFixed(2)," ms"]})]})},s))]})]}):t("div",{class:"profiler-empty",children:t("p",{class:"profiler-empty__description",children:"No view data recorded"})})}var Xu={frame:"Turbo Frame request",stream:"Turbo Stream response"};function la({ajaxData:e}){if(!e?.requests?.length)return t("div",{class:"profiler-empty",children:[t("div",{class:"profiler-empty__icon",children:"\u{1F310}"}),t("h3",{class:"profiler-empty__title",children:"No AJAX requests tracked"}),t("p",{class:"profiler-empty__description",children:"AJAX requests made from this page will appear here."})]});let r=e.total_duration/e.total_requests;return t(P,{children:[t("h2",{class:"profiler-section__header",children:["AJAX Requests (",e.total_requests,")"]}),t("div",{class:"profiler-flex profiler-flex--gap-4 profiler-mb-4 profiler-text--sm",children:[t("span",{children:["Total Duration: ",t("strong",{children:[e.total_duration.toFixed(2)," ms"]})]}),t("span",{children:["Average: ",t("strong",{children:[r.toFixed(2)," ms"]})]})]}),t("div",{class:"profiler-grid profiler-grid--2 profiler-mb-6",children:[t("div",{class:"profiler-panel profiler-panel--sm",children:[t("h3",{class:"profiler-text--sm profiler-text--muted profiler-text--uppercase profiler-mb-3",children:"By Method"}),Object.entries(e.by_method).map(([s,o])=>t("div",{class:"profiler-kv-row",children:[t("span",{class:`badge-${es(s)}`,children:s}),t("strong",{children:o})]},s))]}),t("div",{class:"profiler-panel profiler-panel--sm",children:[t("h3",{class:"profiler-text--sm profiler-text--muted profiler-text--uppercase profiler-mb-3",children:"By Status"}),Object.entries(e.by_status).map(([s,o])=>t("div",{class:"profiler-kv-row",children:[t("span",{class:`badge-${s.startsWith("2")?"success":s.startsWith("4")||s.startsWith("5")?"error":"warning"}`,children:s}),t("strong",{children:o})]},s))]})]}),t("h3",{class:"profiler-text--lg profiler-mb-3",children:"Requests"}),e.requests.map((s,o)=>t("div",{class:`profiler-ajax-card profiler-ajax-card--${s.status>=200&&s.status<300?"success":"error"}`,children:[t("div",{class:"profiler-ajax-card__row",children:[t("div",{class:"profiler-flex profiler-flex--gap-3",children:[t("span",{class:`profiler-ajax-card__method badge-${es(s.method)}`,children:s.method}),s.turbo&&t("span",{class:"badge-default",title:Xu[s.turbo],children:s.turbo.toUpperCase()}),t("strong",{class:"profiler-ajax-card__path",children:s.path})]}),t("div",{class:"profiler-flex profiler-flex--gap-2",children:[t("span",{class:`badge-${Ds(s.status)}`,children:s.status}),t("span",{class:s.duration>=500?"badge-error":s.duration>=100?"badge-warning":"badge-success",children:[s.duration.toFixed(2)," ms"]})]})]}),t("div",{class:"profiler-ajax-card__row",children:[t("span",{class:"profiler-ajax-card__time",children:new Date(s.started_at).toLocaleTimeString("en",{hour12:!1})}),t("a",{href:`/_profiler/profiles/${s.token}`,class:"profiler-text--sm",style:"color: var(--profiler-accent);",children:"View Profile \u2192"})]})]},o))]})}function Ft({cacheData:e}){return e?t(P,{children:[t("h2",{class:"profiler-section__header",children:"Cache Operations"}),t("div",{class:"profiler-flex profiler-flex--gap-4 profiler-mb-4 profiler-text--sm",children:[t("span",{children:["Reads: ",t("strong",{children:e.total_reads})]}),t("span",{children:["Writes: ",t("strong",{children:e.total_writes})]}),t("span",{children:["Deletes: ",t("strong",{children:e.total_deletes})]}),t("span",{children:["Hit Rate:"," ",t("strong",{class:`badge-${e.hit_rate>80?"success":"warning"}`,children:[e.hit_rate,"%"]})]})]}),e.reads&&e.reads.length>0&&t(P,{children:[t("h3",{class:"profiler-text--lg profiler-mt-6 profiler-mb-3",children:"Cache Reads"}),e.reads.map((r,s)=>t("div",{class:"profiler-query-card",children:t("div",{class:"profiler-query-card__header",children:[t("span",{class:"profiler-text--mono profiler-text--sm",children:r.key}),t("div",{class:"profiler-flex profiler-flex--gap-2",children:[t("span",{class:r.hit?"badge-success":"badge-error",children:r.hit?"HIT":"MISS"}),t("span",{class:r.duration>=500?"badge-error":r.duration>=100?"badge-warning":"badge-success",children:[r.duration.toFixed(2)," ms"]})]})]})},s))]})]}):t("div",{class:"profiler-empty",children:t("p",{class:"profiler-empty__description",children:"No cache operations recorded"})})}function Yu(e){switch(e){case"ERROR":case"FATAL":return"profiler-text--error";case"WARN":return"profiler-text--warning";case"INFO":return"profiler-text--success";default:return"profiler-text--muted"}}function ec(e){switch(e){case"ERROR":case"FATAL":return"background: var(--profiler-error, #ef4444); color: #fff;";case"WARN":return"background: var(--profiler-warning, #f59e0b); color: #fff;";case"INFO":return"background: var(--profiler-success, #22c55e); color: #fff;";default:return"background: var(--profiler-muted, #6b7280); color: #fff;"}}function Ot({logData:e}){let[r,s]=b("ALL"),[o,n]=b("");if(!e?.logs?.length)return t("div",{class:"profiler-empty",children:[t("div",{class:"profiler-empty__icon",children:"\u{1F4CB}"}),t("h3",{class:"profiler-empty__title",children:"No log messages captured"}),t("div",{class:"profiler-empty__description",children:t("p",{children:["Log messages emitted via ",t("code",{children:"Rails.logger"})," during this request will appear here."]})})]});let i=["ALL","DEBUG","INFO","WARN","ERROR","FATAL"],a=e.logs.filter(l=>!(r!=="ALL"&&l.level!==r||o&&!l.message.toLowerCase().includes(o.toLowerCase())));return t(P,{children:[t("h2",{class:"profiler-section__header",children:["Log Messages (",e.count,")"]}),t("div",{class:"profiler-flex profiler-flex--gap-4 profiler-mb-4 profiler-text--sm",children:[e.errors>0&&t("span",{children:["Errors: ",t("strong",{class:"profiler-text--error",children:e.errors})]}),e.warnings>0&&t("span",{children:["Warnings: ",t("strong",{class:"profiler-text--warning",children:e.warnings})]})]}),t("div",{class:"profiler-action-bar profiler-mb-4",children:[t("div",{class:"profiler-flex profiler-flex--gap-2",children:i.map(l=>t("button",{onClick:()=>s(l),class:`btn btn-sm ${r===l?"btn-primary":"btn-secondary"}`,children:l},l))}),t("input",{type:"text",class:"profiler-filter-input",placeholder:"Search messages\u2026",value:o,onInput:l=>n(l.target.value),style:"width:200px"})]}),a.length===0?t("div",{class:"profiler-text--muted profiler-text--sm",children:["No messages match",o?` "${o}"`:"","."]}):a.map((l,f)=>t("div",{class:"profiler-query-card profiler-mb-2",children:[t("div",{class:"profiler-query-card__header",children:[t("span",{class:"profiler-text--xs",style:`display:inline-block;padding:1px 6px;border-radius:3px;font-weight:600;${ec(l.level)}`,children:l.level}),t("span",{class:"profiler-text--xs profiler-text--muted",children:new Date(l.timestamp).toLocaleTimeString("en",{hour12:!1})})]}),t("pre",{class:`profiler-query-card__code ${Yu(l.level)}`,style:"white-space:pre-wrap;word-break:break-all;",children:l.message})]},f))]})}function qt({exceptionData:e}){let[r,s]=b(!1);if(!e?.exception_class)return t("div",{class:"profiler-empty",children:[t("div",{class:"profiler-empty__icon",children:"\u{1F4A5}"}),t("h3",{class:"profiler-empty__title",children:"No exception recorded"}),t("div",{class:"profiler-empty__description",children:t("p",{children:"Exceptions raised during this request will appear here."})})]});let o=e.backtrace||[],n=o.filter(a=>a.app_frame),i=r?o:o.slice(0,30);return t(P,{children:[t("div",{class:"profiler-mb-4",style:"padding: 12px 16px; background: color-mix(in srgb, var(--profiler-error, #ef4444) 10%, transparent); border-left: 4px solid var(--profiler-error, #ef4444); border-radius: 4px;",children:[t("div",{class:"profiler-text--error",style:"font-size:1.1em;font-weight:700;margin-bottom:4px;",children:e.exception_class}),t("div",{style:"font-family:monospace;font-size:0.9em;word-break:break-word;",children:e.message})]}),n.length>0&&t("div",{class:"profiler-mb-4",children:[t("h3",{class:"profiler-section__header",children:["Application frames (",n.length,")"]}),n.map((a,l)=>t("div",{class:"profiler-query-card profiler-mb-1",children:t("code",{class:"profiler-text--sm",children:a.location})},l))]}),t("div",{children:[t("h3",{class:"profiler-section__header",children:["Full backtrace (",o.length," frames)"]}),i.map((a,l)=>t("div",{class:"profiler-query-card profiler-mb-1",style:a.app_frame?"":"opacity:0.45;",children:t("code",{class:`profiler-text--sm${a.app_frame?" profiler-text--success":" profiler-text--muted"}`,children:a.location})},l)),!r&&o.length>30&&t("button",{class:"btn btn-secondary btn-sm profiler-mt-2",onClick:()=>s(!0),children:["Show all ",o.length," frames"]})]})]})}var tc={GET:"var(--profiler-success)",POST:"var(--profiler-accent)",PUT:"var(--profiler-warning)",PATCH:"var(--profiler-warning)",DELETE:"var(--profiler-error)"};function ua({verb:e}){let r=tc[e]??"var(--profiler-text-muted)";return t("span",{style:{display:"inline-block",minWidth:"52px",textAlign:"center",padding:"1px 6px",borderRadius:"4px",fontSize:"10px",fontWeight:700,fontFamily:"monospace",border:`1px solid ${r}`,color:r},children:e})}function ca({routesData:e}){let[r,s]=b(""),[o,n]=b("ALL"),{total:i,matched:a,routes:l}=e,f=["ALL",...Array.from(new Set(l.map(h=>h.verb))).sort()],p=l.filter(h=>{let d=o==="ALL"||h.verb===o,y=r.toLowerCase(),m=!y||(h.pattern??"").toLowerCase().includes(y)||(h.name??"").toLowerCase().includes(y)||(h.controller_action??"").toLowerCase().includes(y);return d&&m});return t(P,{children:[t("h2",{class:"profiler-section__header",children:"Routes"}),t("div",{class:"profiler-flex profiler-flex--gap-4 profiler-mb-4",children:t("div",{class:"profiler-stat-card",children:[t("div",{class:"profiler-stat-card__value",children:i}),t("div",{class:"profiler-stat-card__label",children:"Total routes"})]})}),a&&t(P,{children:[t("h2",{class:"profiler-section__header profiler-mt-4",children:"Matched Route"}),t("table",{class:"profiler-mb-4",children:[t("tr",{children:[t("th",{class:"profiler-text--sm",style:"width:120px;",children:"Verb"}),t("td",{children:t(ua,{verb:a.verb})})]}),t("tr",{children:[t("th",{class:"profiler-text--sm",children:"Pattern"}),t("td",{class:"profiler-text--mono profiler-text--xs",children:a.pattern})]}),a.name&&t("tr",{children:[t("th",{class:"profiler-text--sm",children:"Route Name"}),t("td",{class:"profiler-text--mono profiler-text--xs",children:[a.name,"_path"]})]}),a.controller_action&&t("tr",{children:[t("th",{class:"profiler-text--sm",children:"Controller#Action"}),t("td",{class:"profiler-text--mono profiler-text--xs",children:a.controller_action})]})]})]}),t("h2",{class:"profiler-section__header profiler-mt-4",children:"All Routes"}),t("div",{class:"profiler-flex profiler-flex--gap-2 profiler-mb-3",style:"flex-wrap:wrap;align-items:center;",children:[t("input",{type:"text",class:"profiler-filter-input",placeholder:"Filter by path, name or controller\u2026",value:r,onInput:h=>s(h.target.value),style:"flex:1;width:auto;min-width:200px;"}),t("div",{class:"profiler-flex profiler-flex--gap-1",children:f.map(h=>t("button",{onClick:()=>n(h),style:{padding:"3px 8px",fontSize:"11px",fontWeight:600,borderRadius:"4px",border:"1px solid var(--profiler-border)",background:o===h?"var(--profiler-accent)":"transparent",color:o===h?"#fff":"var(--profiler-text-muted)",cursor:"pointer"},children:h},h))})]}),t("div",{class:"profiler-flex-table",children:[t("div",{class:"profiler-flex-table__header",children:[t("span",{class:"profiler-flex-table__cell--fixed",children:"Verb"}),t("span",{class:"profiler-flex-table__cell",children:"Pattern"}),t("span",{class:"profiler-flex-table__cell",children:"Name"}),t("span",{class:"profiler-flex-table__cell",children:"Controller#Action"})]}),p.map((h,d)=>t("div",{class:`profiler-flex-table__row${h.matched?" profiler-flex-table__row--matched":""}`,children:[t("span",{class:"profiler-flex-table__cell--fixed",children:t(ua,{verb:h.verb})}),t("span",{class:"profiler-flex-table__cell profiler-text--mono profiler-text--xs",title:h.pattern,children:h.pattern}),t("span",{class:"profiler-flex-table__cell profiler-flex-table__cell--muted profiler-text--mono profiler-text--xs",title:h.name?`${h.name}_path`:"",children:h.name?`${h.name}_path`:"-"}),t("span",{class:"profiler-flex-table__cell profiler-flex-table__cell--muted profiler-text--mono profiler-text--xs",title:h.controller_action??"",children:h.controller_action??"-"})]},d))]})]})}function pa({i18nData:e}){let[r,s]=b("ALL");if(!e?.lookups?.length)return t("div",{class:"profiler-empty",children:[t("div",{class:"profiler-empty__icon",children:"\u{1F310}"}),t("h3",{class:"profiler-empty__title",children:"No translation lookups captured"}),t("div",{class:"profiler-empty__description",children:t("p",{children:["Calls to ",t("code",{children:"I18n.t"})," during this request will appear here."]})})]});let o=r==="MISSING"?e.lookups.filter(n=>n.missing):e.lookups;return t(P,{children:[t("h2",{class:"profiler-section__header",children:["I18n Lookups (",e.total,")"]}),t("div",{class:"profiler-flex profiler-flex--gap-4 profiler-mb-4 profiler-text--sm",children:[t("span",{children:["Locale: ",t("strong",{children:e.locale})]}),e.missing_count>0&&t("span",{children:["Missing: ",t("strong",{class:"profiler-text--error",children:e.missing_count})]})]}),t("div",{class:"profiler-flex profiler-flex--gap-2 profiler-mb-4",children:["ALL","MISSING"].map(n=>t("button",{onClick:()=>s(n),class:`btn btn-sm ${r===n?"btn-primary":"btn-secondary"}`,children:n},n))}),o.length===0?t("div",{class:"profiler-text--muted profiler-text--sm",children:"No missing translations."}):t("table",{class:"profiler-table",children:[t("thead",{children:t("tr",{children:[t("th",{children:"Key"}),t("th",{children:"Locale"}),t("th",{children:"Value"}),t("th",{children:"Status"})]})}),t("tbody",{children:o.map((n,i)=>t("tr",{style:n.missing?"background:var(--profiler-error-bg,rgba(239,68,68,0.08));":"",children:[t("td",{children:t("code",{class:`profiler-text--xs profiler-text--mono${n.missing?" profiler-text--error":""}`,children:n.key})}),t("td",{children:t("span",{class:"profiler-text--xs profiler-text--muted",children:n.locale})}),t("td",{children:t("span",{class:`profiler-text--xs${n.missing?" profiler-text--error":""}`,children:n.value})}),t("td",{children:n.missing?t("span",{class:"profiler-text--xs profiler-text--error",style:"font-weight:600;",children:"\u26A0 missing"}):t("span",{class:"profiler-text--xs profiler-text--success",children:"\u2713"})})]},i))})]})]})}function Ns({jobs:e}){return e?.length?t(P,{children:[t("h2",{class:"profiler-section__header",children:["Background Jobs (",e.length,")"]}),e.map((r,s)=>t("div",{class:`profiler-ajax-card profiler-ajax-card--${r.status==="completed"?"success":r.status==="failed"?"error":"default"}`,children:[t("div",{class:"profiler-ajax-card__row",children:[t("div",{class:"profiler-flex profiler-flex--gap-3",children:[t("span",{class:`badge-${r.status==="completed"?"success":r.status==="failed"?"error":r.status==="running"?"info":"warning"}`,children:r.status??"unknown"}),t("strong",{class:"profiler-ajax-card__path",children:r.job_class})]}),r.status==="running"?t("span",{class:"badge-info",children:"running"}):t("span",{class:r.duration>=1e3?"badge-error":r.duration>=200?"badge-warning":"badge-success",children:[r.duration?.toFixed(2)," ms"]})]}),t("div",{class:"profiler-ajax-card__row",children:[t("span",{class:"profiler-ajax-card__time profiler-text--muted",children:[r.queue&&t("span",{children:["Queue: ",t("strong",{children:r.queue})," \xB7 "]}),new Date(r.started_at).toLocaleTimeString("en",{hour12:!1})]}),t("a",{href:`/_profiler/profiles/${r.token}`,class:"profiler-text--sm",style:"color: var(--profiler-accent);",children:"View Job \u2192"})]})]},s))]}):t("div",{class:"profiler-empty",children:[t("div",{class:"profiler-empty__icon",children:"\u2699\uFE0F"}),t("h3",{class:"profiler-empty__title",children:"No jobs triggered"}),t("p",{class:"profiler-empty__description",children:"Background jobs enqueued during this request will appear here."})]})}function rc({email:e}){let r=!!e.body_html,s=!!e.body_text;if(!e.body_captured)return t("div",{class:"profiler-mt-3 profiler-text--xs profiler-text--muted",children:["Body not captured - enable ",t("code",{children:"config.capture_mail_body = true"})," in your profiler initializer"]});if(!r&&!s)return null;let[o,n]=b(r?"preview":"text"),i=l=>f=>{f.stopPropagation(),n(l)},a={borderColor:"var(--profiler-accent)",color:"var(--profiler-accent)"};return t("div",{class:"profiler-mt-3",children:[t("div",{class:"profiler-mb-2 profiler-flex profiler-flex--gap-2",style:{alignItems:"center"},children:[t("span",{class:"profiler-text--muted profiler-text--xs",children:"Body"}),r&&t(P,{children:[t("button",{class:"profiler-btn profiler-btn--sm",style:o==="preview"?a:{},onClick:i("preview"),children:"HTML preview"}),t("button",{class:"profiler-btn profiler-btn--sm",style:o==="source"?a:{},onClick:i("source"),children:"HTML source"})]}),s&&t("button",{class:"profiler-btn profiler-btn--sm",style:o==="text"?a:{},onClick:i("text"),children:"Plain text"})]}),o==="preview"&&r&&t("iframe",{srcdoc:e.body_html??void 0,sandbox:"",style:{width:"100%",height:"300px",border:"1px solid var(--profiler-border)",borderRadius:"var(--profiler-radius-md)",background:"#fff",display:"block"}}),(o==="source"||o==="text")&&t("pre",{style:{maxHeight:"300px",overflow:"auto",background:"var(--profiler-bg-lighter, rgba(0,0,0,0.2))",padding:"12px",borderRadius:"var(--profiler-radius-md)",fontSize:"12px",margin:0,whiteSpace:"pre-wrap",wordBreak:"break-all",border:"1px solid var(--profiler-border)"},children:o==="source"?e.body_html:e.body_text})]})}function fa({assigns:e}){let r=Object.entries(e);return r.length===0?null:t("div",{class:"profiler-mt-3",children:[t("div",{class:"profiler-text--xs profiler-text--muted profiler-mb-1",style:{textTransform:"uppercase",letterSpacing:"0.05em"},children:"Variables"}),r.map(([s,o])=>t("div",{class:"profiler-kv-row",children:[t("span",{children:t("code",{children:["@",s]})}),t("code",{style:{textAlign:"right",wordBreak:"break-all",maxWidth:"60%"},children:o})]},s))]})}function sc({email:e}){return t("div",{class:"profiler-mt-3",onClick:r=>r.stopPropagation(),children:[e.subject&&t("div",{class:"profiler-kv-row",children:[t("span",{children:"Subject"}),t("span",{children:e.subject})]}),e.to&&e.to.length>0&&t("div",{class:"profiler-kv-row",children:[t("span",{children:"To"}),t("span",{style:{textAlign:"right",wordBreak:"break-all"},children:e.to.join(", ")})]}),e.from&&e.from.length>0&&t("div",{class:"profiler-kv-row",children:[t("span",{children:"From"}),t("span",{style:{textAlign:"right"},children:e.from.join(", ")})]}),e.cc&&e.cc.length>0&&t("div",{class:"profiler-kv-row",children:[t("span",{children:"CC"}),t("span",{style:{textAlign:"right"},children:e.cc.join(", ")})]}),e.bcc&&e.bcc.length>0&&t("div",{class:"profiler-kv-row",children:[t("span",{children:"BCC"}),t("span",{style:{textAlign:"right"},children:e.bcc.join(", ")})]}),e.reply_to&&e.reply_to.length>0&&t("div",{class:"profiler-kv-row",children:[t("span",{children:"Reply-To"}),t("span",{style:{textAlign:"right"},children:e.reply_to.join(", ")})]}),e.template&&t("div",{class:"profiler-kv-row",children:[t("span",{children:"Template"}),t("code",{children:e.template})]}),e.parts&&e.parts.length>0&&t("div",{class:"profiler-kv-row",children:[t("span",{children:"Parts"}),t("span",{style:{textAlign:"right"},children:e.parts.join(", ")})]}),e.attachments&&e.attachments.length>0&&t("div",{class:"profiler-kv-row",children:[t("span",{children:"Attachments"}),t("span",{style:{textAlign:"right"},children:e.attachments.map(r=>`${r.filename} (${(r.size/1024).toFixed(1)} KB)`).join(", ")})]}),t("div",{class:"profiler-kv-row",children:[t("span",{children:"Render"}),t("span",{class:"profiler-query-card__duration",children:e.duration_ms!=null?`${e.duration_ms} ms`:"-"})]}),e.delivery_ms!=null&&t("div",{class:"profiler-kv-row",children:[t("span",{children:"Delivery"}),t("span",{class:"profiler-query-card__duration",children:[e.delivery_ms," ms"]})]}),e.message_id&&t("div",{class:"profiler-kv-row",children:[t("span",{children:"Message-ID"}),t("code",{style:{fontSize:"11px",wordBreak:"break-all",maxWidth:"70%",textAlign:"right"},children:e.message_id})]}),e.error&&t("div",{class:"profiler-kv-row",children:[t("span",{children:"Error"}),t("span",{class:"profiler-text--error",style:{textAlign:"right"},children:e.error})]}),e.assigns&&Object.keys(e.assigns).length>0&&t(fa,{assigns:e.assigns}),t(rc,{email:e})]})}function da({email:e,onClick:r,isExpanded:s}){let o=["profiler-query-card",e.error?"profiler-query-card--slow":""].filter(Boolean).join(" ");return t("div",{class:o,style:{cursor:"pointer",marginBottom:"6px"},onClick:r,children:[t("div",{class:"profiler-query-card__header",children:[t("div",{class:"profiler-flex profiler-flex--gap-2",style:{minWidth:0,flex:1},children:t("span",{class:"profiler-text--sm",style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:[t("strong",{children:e.mailer_class}),t("span",{class:"profiler-text--muted",children:["#",e.action]}),e.subject&&t("span",{class:"profiler-text--muted",children:[" - ",e.subject.slice(0,60),e.subject.length>60?"\u2026":""]})]})}),t("div",{class:"profiler-flex profiler-flex--gap-2",style:{flexShrink:0},children:[e.delivery_mode&&t("span",{class:"badge-info profiler-text--xs",children:e.delivery_mode}),e.duration_ms!=null&&t("span",{class:"profiler-query-card__duration profiler-text--xs",children:[e.duration_ms," ms"]}),e.error?t("span",{class:"badge-error profiler-text--xs",children:"Error"}):t("span",{class:"badge-success profiler-text--xs",children:"Sent"}),t("span",{class:"profiler-text--muted profiler-text--xs",children:s?"\u25B2":"\u25BC"})]})]}),s&&t(sc,{email:e})]})}function oc({email:e}){return t("div",{class:"profiler-query-card",style:{marginBottom:"6px",borderLeft:"3px solid var(--profiler-info, #38bdf8)"},children:[t("div",{class:"profiler-query-card__header",children:[t("span",{class:"profiler-text--sm",children:[t("strong",{children:e.mailer_class}),t("span",{class:"profiler-text--muted",children:["#",e.action]})]}),t("div",{class:"profiler-flex profiler-flex--gap-2",style:{flexShrink:0},children:[t("span",{class:"badge-info profiler-text--xs",children:"queued"}),e.delivery_method&&t("span",{class:"badge-default profiler-text--xs",children:e.delivery_method}),e.duration_ms!=null&&t("span",{class:"profiler-query-card__duration profiler-text--xs",children:[e.duration_ms," ms"]})]})]}),e.assigns&&Object.keys(e.assigns).length>0&&t(fa,{assigns:e.assigns})]})}function js({mailerData:e}){let[r,s]=b(null),[o,n]=b(null),i=e?.queued_count??0;if(!e||e.total===0&&i===0)return t("div",{class:"profiler-empty",children:t("p",{class:"profiler-empty__description",children:"No emails sent during this request"})});let a=f=>s(r===f?null:f),l=f=>n(o===f?null:f);return t(P,{children:[t("h2",{class:"profiler-section__header",children:"Mailer Deliveries"}),t("div",{class:"profiler-flex profiler-flex--gap-4 profiler-mb-4 profiler-text--sm",children:[t("span",{children:["Total: ",t("strong",{children:e.total})]}),e.deliver_now>0&&t("span",{children:["deliver_now: ",t("strong",{children:e.deliver_now})]}),e.deliver_later>0&&t("span",{children:["deliver_later: ",t("strong",{children:e.deliver_later})]}),i>0&&t("span",{children:["queued: ",t("strong",{children:i})]}),e.multi_part_count>0&&t("span",{children:["Multi-part: ",t("strong",{children:e.multi_part_count})]}),e.failed>0&&t("span",{children:["Errors: ",t("strong",{class:"profiler-text--error",children:e.failed})]})]}),e.loop_warnings.length>0&&t("div",{class:"profiler-alert-banner profiler-alert-banner--warning profiler-mb-4",children:[t("span",{class:"profiler-alert-banner__icon",children:"\u26A0\uFE0F"}),t("div",{style:{flex:1},children:[t("strong",{children:"Send loop detected"})," - ",e.loop_warnings.length," pattern",e.loop_warnings.length>1?"s":"",e.loop_warnings.map((f,p)=>t("div",{class:"profiler-text--xs profiler-text--muted profiler-mt-1",children:f.message},p))]})]}),e.truncated&&t("div",{class:"profiler-alert-banner profiler-alert-banner--warning profiler-mb-4",children:[t("span",{class:"profiler-alert-banner__icon",children:"\u26A0\uFE0F"}),t("span",{children:"Showing first 50 emails only - additional emails were truncated"})]}),e.emails.length>0&&t(P,{children:[t("h3",{class:"profiler-text--lg profiler-mt-4 profiler-mb-3",children:["Emails",t("span",{class:"profiler-text--muted profiler-text--sm",style:{fontWeight:"normal",marginLeft:"8px"},children:"click to expand"})]}),e.emails.map((f,p)=>t(da,{email:f,onClick:()=>a(p),isExpanded:r===p},p))]}),e.queued&&e.queued.length>0&&t(P,{children:[t("h3",{class:"profiler-text--lg profiler-mt-4 profiler-mb-2",children:["Queued",t("span",{class:"profiler-text--muted profiler-text--sm",style:{fontWeight:"normal",marginLeft:"8px"},children:"deliver_later - will be sent in a background job"})]}),e.queued.map((f,p)=>t(oc,{email:f},`q-${p}`))]}),e.errors.length>0&&t(P,{children:[t("h3",{class:"profiler-text--lg profiler-mt-6 profiler-mb-3 profiler-text--error",children:"Delivery Errors"}),e.errors.map((f,p)=>t(da,{email:f,onClick:()=>l(p),isExpanded:o===p},`err-${p}`))]})]})}function ma({profile:e,initialTab:r,embedded:s}){let o=e.collectors_data||{},n=(o.ajax?.total_requests??0)>0,i=(o.http?.total_requests??0)>0,a=!!o.exception?.exception_class,l=(o.logs?.count??0)>0,f=(o.routes?.total??0)>0,p=(o.i18n?.total??0)>0,h=(e.child_jobs?.length??0)>0,d=(o.mailer?.total??0)>0,[y,m]=b(a?"exception":r),g=_=>T=>{T.preventDefault(),m(_);let w=new URL(window.location.href);w.searchParams.set("tab",_),history.pushState(null,"",w.toString())},v=_=>`tab${y===_?" active":""}`;return t("div",{class:"container",children:[t("div",{class:"header",children:[t("h1",{children:t("a",{href:"/_profiler?section=http",children:[t("span",{class:"h1-emoji",children:"\u{1F4CA}"})," Profile Details"]})}),t("p",{children:[e.method," ",e.path]}),t("div",{class:"profiler-flex profiler-flex--gap-4 profiler-mt-2",children:[t("span",{children:["Duration: ",t("strong",{children:[e.duration.toFixed(2)," ms"]})]}),t("span",{children:["Status: ",t("strong",{children:e.status})]}),xe(e)!=null&&t("span",{title:rt,children:["Allocations: ",t("strong",{children:tt(xe(e))})]}),t("span",{style:"color:var(--profiler-text-muted)",children:new Date(e.started_at).toLocaleString("en",{hour12:!1,month:"short",day:"numeric",hour:"2-digit",minute:"2-digit",second:"2-digit"})}),e.gem_version&&t("span",{class:"profiler-version-badge",children:["v",e.gem_version]})]}),e.gem_version&&e.gem_version!==Ge()&&t("div",{class:"profiler-version-mismatch",children:["\u26A0\uFE0F Profil captur\xE9 avec la version ",t("strong",{children:e.gem_version})," - version actuelle : ",t("strong",{children:Ge()})]})]}),t("div",{class:"profiler-panel profiler-mb-6",children:[t("div",{class:"tabs",children:[a&&t("a",{href:"#",class:v("exception"),onClick:g("exception"),style:"color:var(--profiler-error,#ef4444);",children:"\u{1F4A5} Exception"}),t("a",{href:"#",class:v("request"),onClick:g("request"),children:"Request"}),t("a",{href:"#",class:v("dump"),onClick:g("dump"),children:"Dump"}),t("a",{href:"#",class:v("database"),onClick:g("database"),children:"Database"}),n&&t("a",{href:"#",class:v("ajax"),onClick:g("ajax"),children:"AJAX"}),i&&t("a",{href:"#",class:v("http"),onClick:g("http"),children:"Outbound HTTP"}),t("a",{href:"#",class:v("timeline"),onClick:g("timeline"),children:"Timeline"}),t("a",{href:"#",class:v("views"),onClick:g("views"),children:"Views"}),t("a",{href:"#",class:v("cache"),onClick:g("cache"),children:"Cache"}),l&&t("a",{href:"#",class:v("logs"),onClick:g("logs"),children:"Logs"}),f&&t("a",{href:"#",class:v("routes"),onClick:g("routes"),children:"Routes"}),p&&t("a",{href:"#",class:v("i18n"),onClick:g("i18n"),children:"I18n"}),h&&t("a",{href:"#",class:v("jobs"),onClick:g("jobs"),children:["Jobs (",e.child_jobs.length,")"]}),d&&t("a",{href:"#",class:v("mailer"),onClick:g("mailer"),children:"Mailers"}),t("a",{href:"#",class:v("env"),onClick:g("env"),children:"Env"})]}),t("div",{class:"profiler-p-4 tab-content active",children:[y==="exception"&&t(qt,{exceptionData:o.exception}),y==="request"&&t(ra,{profile:e}),y==="dump"&&t(At,{dumpData:o.dump}),y==="database"&&t(Pt,{dbData:o.database,token:e.token}),y==="ajax"&&t(la,{ajaxData:o.ajax}),y==="http"&&t(kr,{httpData:o.http}),y==="timeline"&&t(Mt,{flamegraphData:o.flamegraph,perfData:o.performance,functionProfileData:o.function_profile}),y==="views"&&t(aa,{viewData:o.view}),y==="cache"&&t(Ft,{cacheData:o.cache}),y==="logs"&&t(Ot,{logData:o.logs}),y==="routes"&&t(ca,{routesData:o.routes}),y==="i18n"&&t(pa,{i18nData:o.i18n}),y==="jobs"&&t(Ns,{jobs:e.child_jobs}),y==="mailer"&&t(js,{mailerData:o.mailer}),y==="env"&&t(st,{envData:o.env,readOnly:!0})]})]}),!s&&t("div",{class:"profiler-mt-6",children:t("a",{href:"/_profiler",style:"color: var(--profiler-accent);",children:"\u2190 Back to profiles"})})]})}function ha({jobData:e}){if(!e)return t("div",{class:"profiler-empty",children:[t("div",{class:"profiler-empty__icon",children:"\u2699\uFE0F"}),t("h3",{class:"profiler-empty__title",children:"No job data"})]});let r=e.status==="completed";return t(P,{children:[t("h2",{class:"profiler-section__header",children:"Job Details"}),t("div",{class:"profiler-grid profiler-grid--2 profiler-mb-6",children:[t("div",{class:"profiler-panel profiler-panel--sm",children:[t("h3",{class:"profiler-text--sm profiler-text--muted profiler-text--uppercase profiler-mb-3",children:"Info"}),t("div",{class:"profiler-kv-row",children:[t("span",{class:"profiler-text--sm",children:"Class"}),t("strong",{class:"profiler-text--mono",children:e.job_class})]}),t("div",{class:"profiler-kv-row",children:[t("span",{class:"profiler-text--sm",children:"Job ID"}),t("span",{class:"profiler-text--xs profiler-text--mono profiler-text--muted",children:e.job_id})]}),t("div",{class:"profiler-kv-row",children:[t("span",{class:"profiler-text--sm",children:"Queue"}),t("span",{class:"profiler-text--mono",children:e.queue})]}),t("div",{class:"profiler-kv-row",children:[t("span",{class:"profiler-text--sm",children:"Executions"}),t("span",{children:e.executions})]}),t("div",{class:"profiler-kv-row",children:[t("span",{class:"profiler-text--sm",children:"Status"}),t("span",{class:`badge-${r?"success":"error"}`,children:r?"\u2713 Completed":"\u2717 Failed"})]})]}),e.arguments&&e.arguments.length>0&&t("div",{class:"profiler-panel profiler-panel--sm",children:[t("h3",{class:"profiler-text--sm profiler-text--muted profiler-text--uppercase profiler-mb-3",children:"Arguments"}),e.arguments.map((s,o)=>t("div",{class:"profiler-kv-row",children:[t("span",{class:"profiler-text--xs profiler-text--muted",children:["[",o,"]"]}),t("span",{class:"profiler-text--xs profiler-text--mono",style:"word-break:break-all",children:String(s)})]},o))]})]}),e.error&&t("div",{class:"profiler-panel profiler-panel--sm profiler-mb-4",style:"border-left: 3px solid var(--profiler-error, #ef4444)",children:[t("h3",{class:"profiler-text--sm profiler-text--muted profiler-text--uppercase profiler-mb-2",children:"Error"}),t("pre",{class:"profiler-code profiler-text--xs",style:"white-space:pre-wrap;word-break:break-all;margin:0",children:e.error})]})]})}function ya({profile:e,initialTab:r,embedded:s}){let o=e.collectors_data||{},n=o.http?.total_requests>0,i=(e.child_jobs?.length??0)>0,a=(o.dump?.count??0)>0,l=(o.logs?.total??0)>0,f=!!o.exception?.exception_class,p=(o.mailer?.total??0)>0,d=["job","database","cache","http","jobs","dump","logs","exception","env","timeline","mailer"].includes(r)?r:"job",[y,m]=b(f?"exception":d),g=o.job,v=g?.status==="failed",_=g?.status==="running",T=e.parent_profile,w=M=>K=>{K.preventDefault(),m(M);let I=new URL(window.location.href);I.searchParams.set("tab",M),history.pushState(null,"",I.toString())},S=M=>`tab${y===M?" active":""}`;return t("div",{class:"container",children:[t("div",{class:"header",children:[t("h1",{children:t("a",{href:"/_profiler?section=jobs",children:[t("span",{class:"h1-emoji",children:"\u2699\uFE0F"})," Job Profile"]})}),t("p",{children:e.path}),t("div",{class:"profiler-flex profiler-flex--gap-4 profiler-mt-2",children:[t("span",{children:["Duration: ",t("strong",{children:_?"running":`${e.duration.toFixed(2)} ms`})]}),t("span",{children:["Status: ",t("strong",{children:t("span",{class:`badge-${v?"error":_?"info":"success"}`,children:v?"Failed":_?"Running":"Completed"})})]}),xe(e)!=null&&t("span",{title:rt,children:["Allocations: ",t("strong",{children:tt(xe(e))})]}),e.gem_version&&t("span",{class:"profiler-version-badge",children:["v",e.gem_version]})]}),e.gem_version&&e.gem_version!==Ge()&&t("div",{class:"profiler-version-mismatch",children:["\u26A0\uFE0F Profil captur\xE9 avec la version ",t("strong",{children:e.gem_version})," - version actuelle : ",t("strong",{children:Ge()})]}),T&&t("div",{class:"profiler-flex profiler-flex--gap-2 profiler-mt-2 profiler-text--sm",children:[t("span",{style:"color:var(--profiler-text-muted)",children:"Triggered by:"}),T.profile_type==="http"?t("span",{children:[t("strong",{children:T.method})," ",T.path," \xB7 ",T.http_status," \xB7 ",T.duration?.toFixed(2)," ms"]}):t("span",{children:["\u2699\uFE0F ",t("strong",{children:T.path})," \xB7 ",T.duration?.toFixed(2)," ms"]}),t("a",{href:`/_profiler/profiles/${T.token}`,style:"color: var(--profiler-accent);",children:"View \u2192"})]})]}),t("div",{class:"profiler-panel profiler-mb-6",children:[t("div",{class:"tabs",children:[f&&t("a",{href:"#",class:S("exception"),onClick:w("exception"),style:"color:var(--profiler-error,#ef4444);",children:"\u{1F4A5} Exception"}),t("a",{href:"#",class:S("job"),onClick:w("job"),children:"Job"}),t("a",{href:"#",class:S("database"),onClick:w("database"),children:"Database"}),t("a",{href:"#",class:S("cache"),onClick:w("cache"),children:"Cache"}),n&&t("a",{href:"#",class:S("http"),onClick:w("http"),children:"Outbound HTTP"}),t("a",{href:"#",class:S("timeline"),onClick:w("timeline"),children:"Timeline"}),i&&t("a",{href:"#",class:S("jobs"),onClick:w("jobs"),children:["Jobs (",e.child_jobs.length,")"]}),a&&t("a",{href:"#",class:S("dump"),onClick:w("dump"),children:["Dumps (",o.dump.count,")"]}),l&&t("a",{href:"#",class:S("logs"),onClick:w("logs"),children:"Logs"}),p&&t("a",{href:"#",class:S("mailer"),onClick:w("mailer"),children:"Mailers"}),t("a",{href:"#",class:S("env"),onClick:w("env"),children:"Env"})]}),t("div",{class:"profiler-p-4 tab-content active",children:[y==="exception"&&t(qt,{exceptionData:o.exception}),y==="job"&&t(ha,{jobData:o.job}),y==="database"&&t(Pt,{dbData:o.database,token:e.token}),y==="cache"&&t(Ft,{cacheData:o.cache}),y==="http"&&t(kr,{httpData:o.http}),y==="timeline"&&t(Mt,{flamegraphData:o.flamegraph,perfData:o.performance,functionProfileData:o.function_profile}),y==="jobs"&&t(Ns,{jobs:e.child_jobs}),y==="dump"&&t(At,{dumpData:o.dump}),y==="logs"&&t(Ot,{logData:o.logs}),y==="mailer"&&t(js,{mailerData:o.mailer}),y==="env"&&t(st,{envData:o.env,readOnly:!0})]})]}),!s&&t("div",{class:"profiler-mt-6",children:t("a",{href:"/_profiler",style:"color: var(--profiler-accent);",children:"\u2190 Back to profiles"})})]})}function ga({data:e}){return t("div",{class:"profiler-p-4",children:[t("div",{class:"profiler-mb-6",children:[t("h3",{class:"profiler-section-title profiler-mb-2",children:"Expression"}),t("pre",{class:"profiler-code-block profiler-code-block--full",children:e.expression})]}),e.return_value!==void 0&&t("div",{children:[t("h3",{class:"profiler-section-title profiler-mb-2",children:"Return value"}),t("pre",{class:"profiler-code-block profiler-code-block--full",children:e.return_value})]})]})}function va({profile:e,initialTab:r,embedded:s}){let o=e.collectors_data||{},n=o.http?.total_requests>0,i=(o.dump?.count??0)>0,a=(o.logs?.total??0)>0,l=!!o.exception?.exception_class,f=o.console,h=["console","database","cache","http","dump","logs","exception","env","timeline"].includes(r)?r:"console",[d,y]=b(l?"exception":h),m=e.status===500,g=_=>T=>{T.preventDefault(),y(_);let w=new URL(window.location.href);w.searchParams.set("tab",_),history.pushState(null,"",w.toString())},v=_=>`tab${d===_?" active":""}`;return t("div",{class:"container",children:[t("div",{class:"header",children:[t("h1",{children:t("a",{href:"/_profiler?section=console",children:[t("span",{class:"h1-emoji",children:">_"})," Console Profile"]})}),t("p",{style:"font-family: monospace; word-break: break-all",children:e.path}),t("div",{class:"profiler-flex profiler-flex--gap-4 profiler-mt-2",children:[t("span",{children:["Duration: ",t("strong",{children:[e.duration.toFixed(2)," ms"]})]}),t("span",{children:["Status: ",t("strong",{children:t("span",{class:`badge-${m?"error":"success"}`,children:m?"Error":"OK"})})]}),xe(e)!=null&&t("span",{title:rt,children:["Allocations: ",t("strong",{children:tt(xe(e))})]}),e.gem_version&&t("span",{class:"profiler-version-badge",children:["v",e.gem_version]})]}),e.gem_version&&e.gem_version!==Ge()&&t("div",{class:"profiler-version-mismatch",children:["\u26A0\uFE0F Profil captur\xE9 avec la version ",t("strong",{children:e.gem_version})," - version actuelle : ",t("strong",{children:Ge()})]})]}),t("div",{class:"profiler-panel",children:[t("div",{class:"tabs",children:[t("a",{href:"#",class:v("console"),onClick:g("console"),children:"Console"}),t("a",{href:"#",class:v("database"),onClick:g("database"),children:"Database"}),t("a",{href:"#",class:v("cache"),onClick:g("cache"),children:"Cache"}),n&&t("a",{href:"#",class:v("http"),onClick:g("http"),children:"HTTP"}),i&&t("a",{href:"#",class:v("dump"),onClick:g("dump"),children:"Dumps"}),a&&t("a",{href:"#",class:v("logs"),onClick:g("logs"),children:"Logs"}),l&&t("a",{href:"#",class:v("exception"),onClick:g("exception"),children:"Exception"}),t("a",{href:"#",class:v("env"),onClick:g("env"),children:"Env"}),t("a",{href:"#",class:v("timeline"),onClick:g("timeline"),children:"Timeline"})]}),t("div",{class:"profiler-p-0 tab-content active",children:[d==="console"&&f&&t(ga,{data:f}),d==="database"&&t(Pt,{dbData:o.database,token:e.token}),d==="cache"&&t(Ft,{cacheData:o.cache}),d==="http"&&n&&t(kr,{httpData:o.http}),d==="dump"&&i&&t(At,{dumpData:o.dump}),d==="logs"&&a&&t(Ot,{logData:o.logs}),d==="exception"&&l&&t(qt,{exceptionData:o.exception}),d==="env"&&t(st,{envData:o.env,readOnly:!0}),d==="timeline"&&t(Mt,{flamegraphData:o.flamegraph,perfData:o.performance,functionProfileData:o.function_profile})]})]}),!s&&t("div",{class:"profiler-mt-6",children:t("a",{href:"/_profiler",style:"color: var(--profiler-accent);",children:"\u2190 Back to profiles"})})]})}function nc(e){return e==="passed"?t("span",{class:"badge-success",children:"\u2713 Passed"}):e==="failed"?t("span",{class:"badge-error",children:"\u2717 Failed"}):e==="pending"?t("span",{class:"badge-warning",children:"\u23F8 Pending"}):t("span",{class:"badge-default",children:e})}function ba({testData:e}){return t("div",{children:t("table",{class:"profiler-detail-table",children:t("tbody",{children:[t("tr",{children:[t("th",{children:"Test Name"}),t("td",{style:"word-break: break-word",children:e.test_name})]}),t("tr",{children:[t("th",{children:"Status"}),t("td",{children:nc(e.status)})]}),t("tr",{children:[t("th",{children:"File"}),t("td",{class:"profiler-text--mono profiler-text--xs",children:[e.test_file,":",e.test_line]})]}),t("tr",{children:[t("th",{children:"Framework"}),t("td",{class:"profiler-text--mono profiler-text--xs",children:e.framework})]}),e.assertions!=null&&t("tr",{children:[t("th",{children:"Assertions"}),t("td",{children:e.assertions})]}),e.skip_reason&&t("tr",{children:[t("th",{children:"Skip reason"}),t("td",{class:"profiler-text--xs profiler-text--muted",children:e.skip_reason})]}),e.exception_message&&t("tr",{children:[t("th",{children:"Exception"}),t("td",{children:t("pre",{class:"profiler-text--xs",style:"white-space: pre-wrap; color: var(--profiler-error, #ef4444)",children:e.exception_message})})]})]})})})}function xa({profile:e,initialTab:r,embedded:s}){let o=e.collectors_data||{},n=(o.dump?.count??0)>0,i=(o.logs?.total??0)>0,a=!!o.exception?.exception_class,l=o.test,p=["test","database","cache","dump","logs","exception","env","timeline"].includes(r)?r:"test",[h,d]=b(a?"exception":p),y=e.status===500,m=l?.status||(y?"failed":"passed"),g=_=>T=>{T.preventDefault(),d(_);let w=new URL(window.location.href);w.searchParams.set("tab",_),history.pushState(null,"",w.toString())},v=_=>`tab${h===_?" active":""}`;return t("div",{class:"container",children:[t("div",{class:"header",children:[t("h1",{children:t("a",{href:"/_profiler?section=tests",children:[t("span",{class:"h1-emoji",children:"\u{1F9EA}"})," Test Profile"]})}),t("p",{style:"word-break: break-word",children:l?.test_name||e.path}),t("div",{class:"profiler-flex profiler-flex--gap-4 profiler-mt-2",children:[t("span",{children:["Duration: ",t("strong",{children:[e.duration.toFixed(2)," ms"]})]}),t("span",{children:["Status: ",t("strong",{children:t("span",{class:`badge-${y?"error":m==="pending"?"warning":"success"}`,children:m==="failed"?"\u2717 Failed":m==="pending"?"\u23F8 Pending":"\u2713 Passed"})})]}),xe(e)!=null&&t("span",{title:rt,children:["Allocations: ",t("strong",{children:tt(xe(e))})]})]}),l?.test_file&&t("div",{class:"profiler-text--xs profiler-text--muted profiler-mt-2",children:[t("span",{class:"profiler-text--mono",children:[l.test_file,":",l.test_line]}),t("span",{style:"margin-left: 8px",children:["\xB7 ",l.framework]})]})]}),t("div",{class:"profiler-panel profiler-mb-6",children:[t("div",{class:"tabs",children:[a&&t("a",{href:"#",class:v("exception"),onClick:g("exception"),style:"color:var(--profiler-error,#ef4444);",children:"\u{1F4A5} Exception"}),t("a",{href:"#",class:v("test"),onClick:g("test"),children:"Test"}),t("a",{href:"#",class:v("database"),onClick:g("database"),children:"Database"}),t("a",{href:"#",class:v("cache"),onClick:g("cache"),children:"Cache"}),t("a",{href:"#",class:v("timeline"),onClick:g("timeline"),children:"Timeline"}),n&&t("a",{href:"#",class:v("dump"),onClick:g("dump"),children:["Dumps (",o.dump.count,")"]}),i&&t("a",{href:"#",class:v("logs"),onClick:g("logs"),children:"Logs"}),t("a",{href:"#",class:v("env"),onClick:g("env"),children:"Env"})]}),t("div",{class:"profiler-p-4 tab-content active",children:[h==="test"&&l&&t(ba,{testData:l}),h==="database"&&t(Pt,{dbData:o.database,token:e.token}),h==="cache"&&t(Ft,{cacheData:o.cache}),h==="timeline"&&t(Mt,{flamegraphData:o.flamegraph,perfData:o.performance,functionProfileData:o.function_profile}),h==="dump"&&n&&t(At,{dumpData:o.dump}),h==="logs"&&i&&t(Ot,{logData:o.logs}),h==="exception"&&a&&t(qt,{exceptionData:o.exception}),h==="env"&&t(st,{envData:o.env})]})]})]})}var ic="/_profiler";function _a(){return t("div",{class:"container",children:[t("div",{class:"header",children:[t("h1",{children:[t("a",{href:ic,children:t("span",{class:"h1-emoji",children:"\u{1F50D}"})})," ",t("span",{class:"h1-emoji",children:"\u{1F9EA}"})," Test Runner"]}),t("p",{children:"Run tests from the profiler and capture a performance profile for each test."})]}),t("div",{class:"profiler-panel profiler-mb-6",children:t("div",{class:"profiler-p-4",children:t(Ks,{})})})]})}function Ta(e){console.log("Initializing profiler timeline");let r=e.dataset.token;if(!r){console.error("No profile token found");return}ac(r).then(s=>{lc(e,s)})}async function ac(e){return(await(await fetch(`/_profiler/profiles/${e}/timeline`)).json()).events||[]}function lc(e,r){if(!r.length){e.innerHTML="<p>No timeline events recorded</p>";return}let s=uc(r);e.appendChild(s)}function uc(e){let s=e.length*40+40,o=document.createElementNS("http://www.w3.org/2000/svg","svg");o.setAttribute("width","1200"),o.setAttribute("height",s.toString()),o.style.cssText="background: #1e1e1e; border-radius: 4px;";let n=Math.min(...e.map(f=>f.started_at)),l=1100/(Math.max(...e.map(f=>f.finished_at))-n);return e.forEach((f,p)=>{let h=p*40+20,d=(f.started_at-n)*l+50,y=f.duration*l,m=document.createElementNS("http://www.w3.org/2000/svg","rect");m.setAttribute("x",d.toString()),m.setAttribute("y",h.toString()),m.setAttribute("width",Math.max(y,2).toString()),m.setAttribute("height","20"),m.setAttribute("fill",cc(f.name)),m.setAttribute("rx","2");let g=document.createElementNS("http://www.w3.org/2000/svg","title");g.textContent=`${f.name}
14
- Duration: ${f.duration.toFixed(2)}ms`,m.appendChild(g),o.appendChild(m);let v=document.createElementNS("http://www.w3.org/2000/svg","text");v.setAttribute("x","5"),v.setAttribute("y",(h+15).toString()),v.setAttribute("fill","#d4d4d4"),v.setAttribute("font-size","11"),v.textContent=f.name.substring(0,40),o.appendChild(v)}),o}function cc(e){return e.includes("Controller")?"#569cd6":e.includes("Render")?"#4ec9b0":e.includes("Partial")?"#ce9178":"#dcdcaa"}var Ho="profiler-theme",pc="data-theme",$o=class{constructor(){this.systemPreference=window.matchMedia("(prefers-color-scheme: dark)"),this.currentTheme=this.loadTheme(),this.init()}init(){this.applyTheme(this.currentTheme),this.systemPreference.addEventListener("change",r=>{this.currentTheme==="auto"&&this.applyTheme("auto")}),window.addEventListener("storage",r=>{r.key===Ho&&r.newValue&&(this.currentTheme=r.newValue,this.applyTheme(this.currentTheme))})}loadTheme(){return localStorage.getItem(Ho)||"auto"}saveTheme(r){localStorage.setItem(Ho,r)}applyTheme(r){let s=this.resolveTheme(r);document.documentElement.setAttribute(pc,s),window.dispatchEvent(new CustomEvent("profiler:theme-change",{detail:{theme:s}}))}resolveTheme(r){return r==="auto"?this.systemPreference.matches?"dark":"light":r}getTheme(){return this.currentTheme}getResolvedTheme(){return this.resolveTheme(this.currentTheme)}setTheme(r){this.currentTheme=r,this.saveTheme(r),this.applyTheme(r)}toggle(){let s=this.getResolvedTheme()==="dark"?"light":"dark";this.setTheme(s)}},Bo=new $o;function dc(){Bo.toggle()}function Go(){return Bo.getResolvedTheme()}function fc(){let e=document.createElementNS("http://www.w3.org/2000/svg","svg");e.setAttribute("viewBox","0 0 24 24"),e.setAttribute("fill","none");let r=document.createElementNS("http://www.w3.org/2000/svg","path");return r.setAttribute("d","M12 3v1m0 16v1m9-9h-1M4 12H3m15.364 6.364l-.707-.707M6.343 6.343l-.707-.707m12.728 0l-.707.707M6.343 17.657l-.707.707M16 12a4 4 0 11-8 0 4 4 0 018 0z"),r.setAttribute("stroke","currentColor"),r.setAttribute("stroke-width","2"),r.setAttribute("stroke-linecap","round"),r.setAttribute("stroke-linejoin","round"),e.appendChild(r),e}function mc(){let e=document.createElementNS("http://www.w3.org/2000/svg","svg");e.setAttribute("viewBox","0 0 24 24"),e.setAttribute("fill","none");let r=document.createElementNS("http://www.w3.org/2000/svg","path");return r.setAttribute("d","M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z"),r.setAttribute("stroke","currentColor"),r.setAttribute("stroke-width","2"),r.setAttribute("stroke-linecap","round"),r.setAttribute("stroke-linejoin","round"),e.appendChild(r),e}function wa(){let e=document.createElement("button");e.className="profiler-theme-toggle",e.setAttribute("aria-label","Toggle theme"),e.title="Toggle light/dark mode";let r=()=>{let s=Go();for(;e.firstChild;)e.removeChild(e.firstChild);let o=s==="dark"?fc():mc();e.appendChild(o)};return r(),window.addEventListener("profiler:theme-change",r),e.addEventListener("click",()=>{dc()}),e}document.readyState==="loading"?document.addEventListener("DOMContentLoaded",()=>{console.log("\u{1F3A8} Theme system initialized:",Go())}):console.log("\u{1F3A8} Theme system initialized:",Go());var Is=new wo({defaultOptions:{queries:{staleTime:3e4,retry:1}}});document.addEventListener("DOMContentLoaded",()=>{let e=document.getElementById("profiler-cluster-selector"),r=document.querySelector('meta[name="profiler-is-master"]')?.getAttribute("content")==="true";e&&r&&Lr(t(Er,{client:Is,children:t(ta,{})}),e);let s=document.getElementById("profiler-index");s&&Lr(t(Er,{client:Is,children:t(ea,{})}),s);let o=document.getElementById("profiler-show");if(o){let a=document.getElementById("profiler-show-data");if(a){let l=JSON.parse(a.textContent),f=new URLSearchParams(location.search).get("tab")||"request",p=o.dataset.embedded==="true",h;l.profile_type==="job"?h=t(ya,{profile:l,initialTab:f,embedded:p}):l.profile_type==="console"?h=t(va,{profile:l,initialTab:f,embedded:p}):l.profile_type==="test"?h=t(xa,{profile:l,initialTab:f,embedded:p}):h=t(ma,{profile:l,initialTab:f,embedded:p}),Lr(t(Er,{client:Is,children:h}),o)}}let n=document.getElementById("profiler-test-runner");if(n&&Lr(t(Er,{client:Is,children:t(_a,{})}),n),!s&&!o&&!n){let a=document.querySelector(".header, .profiler-detail");if(a){let l=wa();l.style.position="absolute",l.style.top="20px",l.style.right="20px",a.style.position="relative",a.appendChild(l)}}let i=document.getElementById("profiler-timeline");i&&Ta(i)});})();
11
+ # comment`,rows:6,style:"width:100%;font-family:monospace;font-size:12px;padding:6px 8px;border:1px solid var(--profiler-border);border-radius:4px;background:var(--profiler-bg);color:var(--profiler-text);resize:vertical;box-sizing:border-box;"}),t("div",{class:"profiler-flex profiler-flex--gap-2 profiler-mt-2",style:"align-items:center;",children:[Fe>0&&t("span",{class:"profiler-text--xs profiler-text--muted",children:[Fe," variable",Fe!==1?"s":""," to import"]}),De>0&&t("span",{class:"profiler-text--xs profiler-text--muted",children:[De," masked (",zi,") skipped"]}),t("button",{onClick:Lt,disabled:N||Fe===0,style:"background:var(--profiler-accent);border:none;cursor:pointer;color:#fff;font-size:11px;padding:4px 12px;border-radius:4px;margin-left:auto;",children:"Apply"})]})]}),t("div",{class:"profiler-flex profiler-flex--gap-4 profiler-mb-4",children:[t("div",{class:"profiler-stat-card",children:[t("div",{class:"profiler-stat-card__value",children:f}),t("div",{class:"profiler-stat-card__label",children:"Total vars"})]}),h&&t("div",{class:"profiler-stat-card",children:[t("div",{class:"profiler-stat-card__value",children:at.length}),t("div",{class:"profiler-stat-card__label",children:"Matching"})]})]}),t("div",{class:"profiler-flex profiler-flex--gap-2 profiler-mb-3",children:t("input",{type:"text",class:"profiler-filter-input",placeholder:"Filter by key or value\u2026",value:h,onInput:b=>d(b.target.value),style:"flex:1;"})}),t("table",{class:"profiler-table",children:[t("thead",{children:t("tr",{children:[t("th",{style:"width:32%",children:"Key"}),t("th",{children:"Value"}),!Z&&t("th",{style:"width:120px;text-align:right;"})]})}),t("tbody",{children:[tr.map(([b,q])=>{let F=y.has(b);return t(P,{children:[t("tr",{onClick:()=>Yt(b),style:"cursor:pointer;background:var(--profiler-bg-subtle,rgba(0,0,0,0.03));",children:t("td",{colspan:Z?2:3,style:"padding:4px 8px;",children:[t("span",{style:"font-size:11px;font-weight:600;color:var(--profiler-text-muted);letter-spacing:0.05em;font-family:monospace;",children:[F?"\u25B6":"\u25BC"," ",b,"_"]}),t("span",{style:"font-size:10px;color:var(--profiler-text-muted);margin-left:6px;",children:q.length})]})},`group-${b}`),!F&&q.map(([A,$])=>{let we=J.has(A),Ie=g===A,Kt=le===A,me=le===`__key__${A}`,sr=s[A]!==void 0&&s[A]!==$,or=s[A]===void 0,he=a[A];return t("tr",{style:he?"border-left:3px solid var(--profiler-accent);":sr?"border-left:3px solid #f59e0b;":or?"border-left:3px solid var(--profiler-success,#22c55e);":"",children:[t("td",{children:t("div",{class:"profiler-flex",style:"align-items:center;gap:4px;",children:[t("code",{class:"profiler-text--xs profiler-text--mono",children:A}),t("button",{onClick:()=>nt(A,`__key__${A}`),title:"Copy key",style:`${Je}${me?"color:var(--profiler-success,#22c55e);opacity:1;":""}`,children:me?"\u2713":"\u2398"})]})}),t("td",{children:Ie?t("div",{class:"profiler-flex",style:"align-items:center;gap:2px;",children:[jo(_)&&t("span",{style:"font-family:monospace;font-size:12px;color:var(--profiler-text-muted);opacity:0.5;flex-shrink:0;",children:'"'}),t("input",{ref:_e,type:"text",value:_,onInput:us=>T(us.target.value),onKeyDown:te,disabled:N,style:"flex:1;font-family:monospace;font-size:12px;padding:2px 6px;border:1px solid var(--profiler-accent);border-radius:4px;background:var(--profiler-bg);color:var(--profiler-text);"}),jo(_)&&t("span",{style:"font-family:monospace;font-size:12px;color:var(--profiler-text-muted);opacity:0.5;flex-shrink:0;",children:'"'})]}):Zi($)?t(P,{children:[t("div",{class:"profiler-flex",style:"align-items:center;gap:8px;",children:[t(Wi,{value:$}),t("button",{onClick:()=>!Z&&!N&&je(A,$),disabled:N||Z,title:`Click to set ${/^(true|yes)$/i.test($)?"false":"true"}`,style:`position:relative;display:inline-block;width:36px;height:20px;border-radius:10px;border:none;cursor:${Z||N?"default":"pointer"};padding:0;transition:background 0.2s;background:${/^(true|yes)$/i.test($)?"var(--profiler-accent)":"var(--profiler-border,#d1d5db)"};flex-shrink:0;`,children:t("span",{style:`position:absolute;top:3px;width:14px;height:14px;border-radius:50%;background:#fff;transition:left 0.2s;left:${/^(true|yes)$/i.test($)?"19px":"3px"};`})}),t("span",{class:"profiler-text--xs profiler-text--mono",style:"color:var(--profiler-text-muted);",children:$}),t("button",{onClick:()=>nt($,A),title:"Copy value",style:`${Je}${Kt?"color:var(--profiler-success,#22c55e);opacity:1;":""}`,children:Kt?"\u2713":"\u2398"})]}),he&&t("div",{style:"font-size:10px;color:var(--profiler-accent);margin-top:2px;font-family:monospace;",children:["workers \u2190 ",he.value==="__profiler_deleted__"?"(deleted)":he.value," \xB7 original: ",he.original??"(unset)"]})]}):t(P,{children:[t("div",{class:"profiler-flex",style:"align-items:center;gap:4px;",children:[t(Wi,{value:$}),t("span",{class:"profiler-text--xs profiler-text--mono",onClick:()=>!Z&&!Ie&&ue(A),title:Z?void 0:"Click to edit",style:`word-break:break-all;flex:1;${Z?"":"cursor:pointer;"}`,children:we?jo($)?t(P,{children:[t("span",{style:"color:var(--profiler-text-muted);opacity:0.5;",children:'"'}),$,t("span",{style:"color:var(--profiler-text-muted);opacity:0.5;",children:'"'})]}):$:"\u2022".repeat(Math.min($.length,20))}),t("button",{onClick:()=>Te(A),title:we?"Hide value":"Show value",style:`${Je}${we?"opacity:1;color:var(--profiler-accent);":""}`,children:we?"\u{1F441}":"\u{1F648}"}),t("button",{onClick:()=>nt($,A),title:"Copy value",style:`${Je}${Kt?"color:var(--profiler-success,#22c55e);opacity:1;":""}`,children:Kt?"\u2713":"\u2398"})]}),he&&t("div",{style:"font-size:10px;color:var(--profiler-accent);margin-top:2px;font-family:monospace;",children:["workers \u2190 ",he.value==="__profiler_deleted__"?"(deleted)":we?he.value:"\u2022".repeat(Math.min((he.value??"").length,20))," \xB7 original: ",he.original==null?"(unset)":we?he.original:"\u2022".repeat(Math.min(he.original.length,20))]})]})}),!Z&&t("td",{style:"text-align:right;white-space:nowrap;",children:Ie?t(P,{children:[t("button",{onClick:Be,disabled:N,title:"Save",style:"background:none;border:none;cursor:pointer;color:var(--profiler-success,#22c55e);font-size:14px;padding:0 4px;",children:"\u2713"}),t("button",{onClick:it,disabled:N,title:"Cancel",style:"background:none;border:none;cursor:pointer;color:var(--profiler-text-muted);font-size:14px;padding:0 4px;",children:"\u2717"})]}):t(P,{children:[t("button",{onClick:()=>ue(A),disabled:N,title:"Edit",style:"background:none;border:none;cursor:pointer;color:var(--profiler-accent);font-size:14px;padding:0 4px;",children:"\u270E"}),he&&t("button",{onClick:()=>ls(A),disabled:N,title:`Reset to original: ${he.original??"(unset)"}`,style:"background:none;border:none;cursor:pointer;color:var(--profiler-warning,#f59e0b);font-size:14px;padding:0 4px;",children:"\u21A9"}),t("button",{onClick:()=>as(A),disabled:N,title:"Delete",style:"background:none;border:none;cursor:pointer;color:var(--profiler-error,#ef4444);font-size:14px;padding:0 4px;",children:"\u2715"})]})})]},A)})]})}),!Z&&t("tr",{children:[t("td",{children:t("input",{type:"text",value:w,onInput:b=>S(b.target.value),onKeyDown:b=>b.key==="Enter"&&er(),placeholder:"NEW_KEY",disabled:N,style:Or})}),t("td",{children:t("input",{type:"text",value:M,onInput:b=>K(b.target.value),onKeyDown:b=>b.key==="Enter"&&er(),placeholder:"value",disabled:N,style:Or})}),t("td",{style:"text-align:right;",children:t("button",{onClick:er,disabled:N||!w.trim(),style:"background:var(--profiler-accent);border:none;cursor:pointer;color:#fff;font-size:11px;padding:3px 8px;border-radius:4px;",children:"Add"})})]})]})]})]})}function Xi({tree:e,selected:r,onToggleFile:s,onToggleDir:o}){let[n,i]=x(new Set),a=f=>{i(p=>{let h=new Set(p);return h.has(f)?h.delete(f):h.add(f),h})},l=f=>{let p=f.filter(h=>r.has(h)).length;return p===0?"none":p===f.length?"all":"partial"};return t("div",{class:"profiler-text--xs profiler-text--mono",style:"overflow-y: auto; height: 100%",children:e.map(({directory:f,files:p})=>{let h=p.map(m=>m.path),d=l(h),y=n.has(f);return t("div",{style:"margin-bottom: 4px",children:[t("div",{style:"display: flex; align-items: center; gap: 6px; padding: 3px 6px; cursor: pointer; border-radius: 4px; background: var(--profiler-bg-secondary, rgba(255,255,255,0.05))",onClick:()=>a(f),children:[t("input",{type:"checkbox",checked:d==="all",ref:m=>{m&&(m.indeterminate=d==="partial")},onClick:m=>{m.stopPropagation(),o(f,h)},style:"cursor: pointer; flex-shrink: 0"}),t("span",{style:"color: var(--profiler-text-muted, #888); flex-shrink: 0",children:y?"\u25B6":"\u25BC"}),t("span",{style:"color: var(--profiler-accent, #06b6d4); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap",title:f,children:[f,"/"]}),t("span",{style:"color: var(--profiler-text-muted, #888); margin-left: auto; flex-shrink: 0",children:["(",p.length,")"]})]}),!y&&p.map(m=>t("div",{style:"display: flex; align-items: center; gap: 6px; padding: 2px 6px 2px 24px; cursor: pointer; border-radius: 4px",onClick:()=>s(m.path),children:[t("input",{type:"checkbox",checked:r.has(m.path),onClick:g=>{g.stopPropagation(),s(m.path)},style:"cursor: pointer; flex-shrink: 0"}),t("span",{style:"overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--profiler-text, #e2e8f0)",title:m.path,children:m.name})]},m.path))]},f)})})}function Vu(e){return e==="passed"?"var(--profiler-success, #10b981)":e==="failed"?"var(--profiler-error, #ef4444)":e==="running"?"var(--profiler-accent, #06b6d4)":e==="killed"||e==="signaled"||e==="error"?"var(--profiler-warning, #f59e0b)":"var(--profiler-text-muted, #888)"}function Hu(e){return{pending:"\u23F3 Pending",running:"\u25CF Running\u2026",passed:"\u2713 Passed",failed:"\u2717 Failed",killed:"\u25A0 Killed",signaled:"\u26A1 Ended by a signal",error:"\u26A0 Error"}[e]||e}function $u(e){let r={0:"",1:"font-weight:bold",31:"color:var(--ansi-red)",32:"color:var(--ansi-green)",33:"color:var(--ansi-yellow)",34:"color:var(--ansi-blue)",35:"color:var(--ansi-purple)",36:"color:var(--ansi-cyan)"},s=[],o="",n=e.split(/(\x1b\[[0-9;]*m)/);for(let i of n)if(i.startsWith("\x1B[")&&i.endsWith("m")){let a=i.slice(2,-1).split(";");if(a.includes("0"))o="";else{let l=a.map(f=>r[f]??"").filter(Boolean);o=[...o?[o]:[],...l].join(";")}}else i.length>0&&s.push({text:i,style:o});return s}function Gu({text:e}){let r=$u(e);return r.length===0?t("span",{style:"color:var(--profiler-text-muted)",children:"No output yet\u2026"}):t(P,{children:r.map((s,o)=>s.style?t("span",{style:s.style,children:s.text},o):t("span",{children:s.text},o))})}function Yi({run:e}){let r=de(null);return z(()=>{r.current&&e?.status==="running"&&(r.current.scrollTop=r.current.scrollHeight)},[e?.output]),e?t("div",{style:"display: flex; flex-direction: column; height: 100%; gap: 12px",children:[t("div",{style:"display: flex; align-items: center; gap: 12px; flex-shrink: 0",children:[t("span",{style:`font-weight: 600; color: ${Vu(e.status)}`,children:Hu(e.status)}),e.duration!=null&&t("span",{class:"profiler-text--xs profiler-text--muted",children:[(e.duration/1e3).toFixed(1),"s"]}),(e.status==="passed"||e.status==="failed")&&t("a",{href:"/_profiler?section=tests",class:"profiler-text--xs",style:"color: var(--profiler-accent, #06b6d4); margin-left: auto",children:"View in Profiler \u2192"})]}),t("pre",{ref:r,style:"flex: 1; overflow-y: auto; background: var(--profiler-terminal-bg); color: var(--profiler-terminal-text); padding: 14px 16px; border-radius: 6px; font-family: var(--profiler-font-mono); font-size: 12px; line-height: 1.65; margin: 0; white-space: pre-wrap; word-break: break-all; border: 1px solid var(--profiler-border)",children:t(Gu,{text:e.output||""})}),e.files.length>0&&t("div",{class:"profiler-text--xs profiler-text--muted",style:"flex-shrink: 0",children:[e.files.length," file",e.files.length!==1?"s":""," \xB7 ",e.framework]})]}):t("div",{class:"profiler-empty",style:"height: 100%; display: flex; align-items: center; justify-content: center",children:t("div",{children:[t("div",{class:"profiler-empty__title",style:"font-size: 1.1rem",children:"Select files and click Run"}),t("p",{class:"profiler-empty__description",children:"Test output will appear here in real time"})]})})}var ea="/_profiler";function Us(){let[e,r]=x(""),[s,o]=x(new Set),[n,i]=x(null),[a,l]=x(!1),[f,p]=x(null),{data:h,isLoading:d,refetch:y}=Ki(e?{framework:e}:{},{query:{refetchOnWindowFocus:!1}}),{mutateAsync:m}=Ui(),{mutateAsync:g}=Ni(),v=h?.frameworks??[],_=h?.tree??[];z(()=>{!e&&v.length>0&&r(v[0])},[v]);let T=Xt(O=>{o(new Set),y()},[y]);z(()=>{if(!n||!a)return;if(["passed","failed","killed","signaled","error"].includes(n.status)){l(!1);return}let O=new EventSource(`${ea}/api/test_runner/runs/${n.id}/stream`);return O.addEventListener("output",U=>{try{let J=JSON.parse(U.data);i(H=>H&&{...H,output:(H.output||"")+J.chunk})}catch{}}),O.addEventListener("done",U=>{try{let J=JSON.parse(U.data);i(H=>H&&{...H,status:J.status})}catch{}l(!1),O.close()}),O.onerror=()=>{O.readyState===EventSource.CLOSED&&fetch(`${ea}/api/test_runner/runs/${n.id}`).then(U=>U.json()).then(U=>{i(U),l(!1)}).catch(()=>l(!1))},()=>O.close()},[n?.id,a]);let w=O=>{r(O),T(O)},S=O=>{o(U=>{let J=new Set(U);return J.has(O)?J.delete(O):J.add(O),J})},M=(O,U)=>{o(J=>{let H=new Set(J);return U.every(ce=>H.has(ce))?U.forEach(ce=>H.delete(ce)):U.forEach(ce=>H.add(ce)),H})},K=()=>{let O=_.flatMap(U=>U.files.map(J=>J.path));o(new Set(O))},I=()=>o(new Set),oe=async()=>{if(!(s.size===0||a)){p(null);try{let O=await m({data:{files:Array.from(s),framework:e}});i(O),l(!0)}catch(O){p(O instanceof Error&&O.message?O.message:"Failed to start test run")}}},N=async()=>{if(n)try{await g({id:n.id}),l(!1),i(O=>O&&{...O,status:"killed"})}catch{}},D=_.reduce((O,U)=>O+U.files.length,0);return t("div",{children:[f&&t("div",{style:"color: var(--profiler-error, #ef4444); background: rgba(239,68,68,0.1); border: 1px solid var(--profiler-error, #ef4444); border-radius: 4px; padding: 8px 12px; margin-bottom: 12px; font-size: 13px",children:f}),t("div",{class:"profiler-action-bar profiler-mb-3",children:[t("div",{class:"profiler-filter-group",children:v.length>0&&v.map(O=>t("button",{class:`profiler-preset-btn${e===O?" profiler-preset-btn--active":""}`,onClick:()=>w(O),disabled:a,children:O==="rspec"?"RSpec":"Minitest"},O))}),t("div",{class:"profiler-filter-group",style:"margin-left: auto",children:[t("span",{class:"profiler-text--xs profiler-text--muted",children:[s.size," / ",D," selected"]}),t("button",{class:"btn btn-secondary btn-sm",onClick:K,disabled:a||d,children:"All"}),t("button",{class:"btn btn-secondary btn-sm",onClick:I,disabled:a,children:"None"}),a?t("button",{class:"btn btn-danger btn-sm",onClick:N,children:"\u25A0 Stop"}):t("button",{class:"btn btn-sm",style:"background: var(--profiler-accent, #06b6d4); color: #000; font-weight: 600",onClick:oe,disabled:s.size===0,children:["\u25B6 Run Selected (",s.size,")"]})]})]}),t("div",{style:"display: grid; grid-template-columns: 260px 1fr; height: 460px; border: 1px solid var(--profiler-border, rgba(255,255,255,0.1)); border-radius: 6px; overflow: hidden",children:[t("div",{style:"border-right: 1px solid var(--profiler-border, rgba(255,255,255,0.1)); overflow-y: auto; padding: 8px",children:d?t("div",{class:"profiler-text--xs profiler-text--muted",style:"padding: 8px",children:"Loading files\u2026"}):_.length===0?t("div",{class:"profiler-text--xs profiler-text--muted",style:"padding: 8px",children:["No ",e," test files found"]}):t(Xi,{tree:_,selected:s,onToggleFile:S,onToggleDir:M})}),t("div",{style:"overflow: hidden; display: flex; flex-direction: column",children:t(Yi,{run:n})})]})]})}var rs="/_profiler";function Ar({cols:e,rows:r=6}){return t("div",{children:Array.from({length:r}).map((s,o)=>t("div",{class:"profiler-skeleton__row",children:e.map((n,i)=>t("div",{class:`profiler-skeleton__cell profiler-skeleton__cell--${n}`},i))},o))})}function Bu(e){return{GET:"badge-info",POST:"badge-success",PUT:"badge-warning",PATCH:"badge-warning",DELETE:"badge-error"}[e]||"badge-default"}function Ju(e){return e>=200&&e<300?"badge-success":e>=300&&e<400?"badge-info":e>=400&&e<500?"badge-warning":e>=500?"badge-error":"badge-default"}function Ns(e){return e>=500?"badge-error":e>=100?"badge-warning":"badge-success"}function ta(e){let r=e.collectors_data?.job?.status;return r||(e.status===500?"failed":"completed")}function ss(e){return new Date(e).toLocaleTimeString("en",{hour12:!1})}var ra=[{key:"slow",label:"Slow"},{key:"many_queries",label:"Many queries"},{key:"errors",label:"Errors"},{key:"has_exception",label:"Has exception"}];function sa(){let e=Ge(),r=new URLSearchParams(window.location.search),s=()=>{let u=r.get("section");return u==="http"||u==="jobs"||u==="console"||u==="tests"||u==="runner"||u==="outbound"||u==="env"?u:"http"},o=()=>{let u=r.get("sort"),C=r.get("dir");return{col:u==="date"||u==="duration"||u==="memory"||u==="status"||u==="queries"?u:null,dir:C==="desc"?"desc":"asc"}},[n,i]=x(s),a=(u,C)=>({query:{enabled:n===u,queryFn:({pageParam:V=0,signal:ee})=>C(V,ee),getNextPageParam:V=>V.has_more?V.offset+V.limit:void 0,initialPageParam:0,refetchOnWindowFocus:!1}}),l=Di({limit:50},a("http",(u,C)=>Do({limit:50,offset:u},C))),f=Mi({limit:50},a("jobs",(u,C)=>qo({limit:50,offset:u},C))),p=Ti({limit:50},a("console",(u,C)=>Fo({limit:50,offset:u},C))),h=ji({limit:50},a("tests",(u,C)=>Qo({limit:50,offset:u},C))),d=qi({query:{enabled:n==="outbound",refetchOnWindowFocus:!1}}),y=Ci({query:{enabled:n==="env",refetchOnWindowFocus:!1}}),{mutateAsync:m}=Qi(),{mutateAsync:g}=Li(),{mutateAsync:v}=Fi(),{mutateAsync:_}=Oi(),{mutateAsync:T}=wi(),{mutateAsync:w}=Ei(),{mutateAsync:S}=Ii(),{mutateAsync:M}=Vi(),K=l.data?.pages.flatMap(u=>u.profiles)??[],I=f.data?.pages.flatMap(u=>u.profiles)??[],oe=p.data?.pages.flatMap(u=>u.profiles)??[],N=h.data?.pages.flatMap(u=>u.profiles)??[],D=d.data??[],O=y.data,U=l.isLoading,J=f.isLoading,H=p.isLoading,le=h.isLoading,ce=d.isLoading,Z=y.isLoading,Pe=l.error?.message??null,Ke=f.error?.message??null,Ue=p.error?.message??null,qe=h.error?.message??null,ge=d.error?.message??null,_e=y.error?.message??null,Ae=!!l.hasNextPage,ot=!!f.hasNextPage,R=!!p.hasNextPage,j=!!h.hasNextPage,Te=l.isFetchingNextPage,nt=f.isFetchingNextPage,Yt=p.isFetchingNextPage,Q=h.isFetchingNextPage,[B,Ne]=x(null),[Me,Fe]=x(""),[De,Lt]=x(""),[ue,it]=x(""),[Be,as]=x(""),[je,er]=x(()=>{let u=r.get("preset");return ra.some(C=>C.key===u)?u:""}),[te,ls]=x(o),[ve,Mr]=x({col:null,dir:"asc"}),[fe,at]=x({col:null,dir:"asc"}),[tr,Fr]=x(""),[rr,Or]=x(""),[Je,lt]=x(""),[b,q]=x(""),[F,A]=x(""),[$,we]=x(""),[Ie,Kt]=x(""),[me,sr]=x({col:null,dir:"asc"}),[or,he]=x(""),[qr,us]=x(""),[Dr,Wo]=x("");z(()=>{let u=new URL(window.location.href);te.col?(u.searchParams.set("sort",te.col),u.searchParams.set("dir",te.dir)):(u.searchParams.delete("sort"),u.searchParams.delete("dir")),je?u.searchParams.set("preset",je):u.searchParams.delete("preset"),history.replaceState(null,"",u.toString())},[te,je]);let Qr=u=>{ls(C=>C.col===u?{col:u,dir:C.dir==="asc"?"desc":"asc"}:{col:u,dir:"asc"})},Hs=u=>{Mr(C=>C.col===u?{col:u,dir:C.dir==="asc"?"desc":"asc"}:{col:u,dir:"asc"})},Pa=u=>{er(C=>C===u?"":u)},Aa=()=>l.fetchNextPage(),Ma=()=>f.fetchNextPage(),Fa=()=>p.fetchNextPage(),Oa=()=>h.fetchNextPage(),Zo=u=>{u==="http"?l.refetch():u==="jobs"?f.refetch():u==="console"?p.refetch():u==="tests"?h.refetch():u==="outbound"?d.refetch():u==="env"&&y.refetch()},gt=u=>{if(u===n){Zo(u);return}i(u);let C=new URL(window.location.href);C.searchParams.set("section",u),history.pushState(null,"",C.toString()),Fe(""),Lt(""),it(""),as(""),er(""),ls({col:null,dir:"asc"}),Fr(""),Or(""),lt(""),Mr({col:null,dir:"asc"}),q(""),A(""),at({col:null,dir:"asc"}),we(""),Kt(""),sr({col:null,dir:"asc"}),he(""),us(""),Wo("")},cs=u=>{At(u).then(C=>{if(!C){window.prompt("Copy is not available here. Select the token and copy it:",u);return}Ne(u),setTimeout(()=>Ne(null),1500)})},qa=u=>m({id:u}).then(()=>l.refetch()),Da=u=>v({id:u}).then(()=>f.refetch()),Qa=u=>T({id:u}).then(()=>p.refetch()),La=u=>S({id:u}).then(()=>h.refetch()),Ka=()=>{window.confirm("Delete all HTTP profiles?")&&g().then(()=>l.refetch())},Ua=()=>{window.confirm("Delete all job profiles?")&&_().then(()=>f.refetch())},Na=()=>{window.confirm("Delete all console profiles?")&&w().then(()=>p.refetch())},ja=()=>{window.confirm("Delete all test profiles?")&&M().then(()=>h.refetch())},$s=()=>{window.confirm("Delete all HTTP, job and console profiles?")&&Promise.all([g(),_(),w()]).then(()=>{l.refetch(),f.refetch(),p.refetch()})},Lr=()=>Zo(n),Gs=u=>{at(C=>C.col===u?{col:u,dir:C.dir==="asc"?"desc":"asc"}:{col:u,dir:"asc"})},Ut=u=>`tab${n===u?" active":""}`,ps=K.filter(u=>{if(Me&&!u.path.toLowerCase().includes(Me.toLowerCase())||De&&u.method!==De)return!1;if(ue){let C=parseInt(ue);if(!(u.status>=C&&u.status<C+100))return!1}return!(Be&&(Be==="lt100"?u.duration>=100:u.duration<parseInt(Be))||je==="slow"&&u.duration<500||je==="many_queries"&&(u.collectors_data?.database?.total_queries??0)<=20||je==="errors"&&u.status<500||je==="has_exception"&&!u.collectors_data?.exception)}),Ia=te.col?[...ps].sort((u,C)=>{if(te.col==="date"){let Ve=new Date(u.started_at).getTime()-new Date(C.started_at).getTime();return te.dir==="asc"?Ve:-Ve}let V,ee;switch(te.col){case"duration":V=u.duration,ee=C.duration;break;case"memory":V=xe(u)??0,ee=xe(C)??0;break;case"status":V=u.status,ee=C.status;break;case"queries":V=u.collectors_data?.database?.total_queries??0,ee=C.collectors_data?.database?.total_queries??0;break;default:return 0}return te.dir==="asc"?V-ee:ee-V}):ps,ds=I.filter(u=>!(tr&&!u.path.toLowerCase().includes(tr.toLowerCase())||rr&&ta(u)!==rr||Je&&(Je==="lt100"?u.duration>=100:u.duration<parseInt(Je)))),Va=ve.col?[...ds].sort((u,C)=>{if(ve.col==="date"){let Ve=new Date(u.started_at).getTime()-new Date(C.started_at).getTime();return ve.dir==="asc"?Ve:-Ve}let V,ee;switch(ve.col){case"duration":V=u.duration,ee=C.duration;break;case"status":V=u.status,ee=C.status;break;default:return 0}return ve.dir==="asc"?V-ee:ee-V}):ds,Bs=D.filter(u=>{if(or&&!u.url.toLowerCase().includes(or.toLowerCase())||qr&&u.method!==qr)return!1;if(Dr)if(Dr==="error"){if(u.status!==0)return!1}else{let C=parseInt(Dr);if(!(u.status>=C&&u.status<C+100))return!1}return!0}),fs=oe.filter(u=>!(b&&!u.path.toLowerCase().includes(b.toLowerCase())||F==="error"&&u.status!==500||F==="ok"&&u.status===500)),Ha=fe.col?[...fs].sort((u,C)=>{if(fe.col==="date"){let Ve=new Date(u.started_at).getTime()-new Date(C.started_at).getTime();return fe.dir==="asc"?Ve:-Ve}let V,ee;switch(fe.col){case"duration":V=u.duration,ee=C.duration;break;case"status":V=u.status,ee=C.status;break;default:return 0}return fe.dir==="asc"?V-ee:ee-V}):fs,ms=N.filter(u=>!($&&!(u.collectors_data?.test?.test_name||u.path).toLowerCase().includes($.toLowerCase())||Ie==="failed"&&u.status!==500||Ie==="passed"&&u.status===500||Ie==="pending"&&u.collectors_data?.test?.status!=="pending")),$a=me.col?[...ms].sort((u,C)=>{let V,ee;if(me.col==="date"){let Ve=new Date(u.started_at).getTime()-new Date(C.started_at).getTime();return me.dir==="asc"?Ve:-Ve}switch(me.col){case"duration":V=u.duration,ee=C.duration;break;case"status":V=u.status,ee=C.status;break;default:return 0}return me.dir==="asc"?V-ee:ee-V}):ms,Xo=!!(Me||De||ue||Be||je),Yo=!!(tr||rr||Je),en=!!(b||F),tn=!!($||Ie),Ga=!!(or||qr||Dr),Re=(u,C,V)=>u!==V?t("span",{class:"sort-icon sort-icon--idle",children:"\u21C5"}):t("span",{class:"sort-icon sort-icon--active",children:C==="asc"?"\u25B2":"\u25BC"});return t("div",{class:"container",children:[t("div",{class:"header",children:[t("h1",{children:[t("span",{class:"h1-emoji",children:"\u{1F50D}"})," Rails Profiler"]}),t("p",{children:"Recent profiled requests and jobs"}),e&&t("span",{class:"profiler-version-badge",children:["v",e]})]}),t("div",{class:"profiler-panel profiler-mb-6",children:[t("div",{class:"tabs",children:[t("a",{href:"#",class:Ut("http"),onClick:u=>{u.preventDefault(),gt("http")},children:"HTTP Requests"}),t("a",{href:"#",class:Ut("jobs"),onClick:u=>{u.preventDefault(),gt("jobs")},children:"Background Jobs"}),t("a",{href:"#",class:Ut("console"),onClick:u=>{u.preventDefault(),gt("console")},children:"Console"}),t("a",{href:"#",class:Ut("tests"),onClick:u=>{u.preventDefault(),gt("tests")},children:"Tests"}),t("div",{style:"flex: 1"}),t("a",{href:"#",class:Ut("runner"),onClick:u=>{u.preventDefault(),gt("runner")},children:"Test Runner"}),t("a",{href:"#",class:Ut("outbound"),onClick:u=>{u.preventDefault(),gt("outbound")},children:"Outbound HTTP"}),t("a",{href:"#",class:Ut("env"),onClick:u=>{u.preventDefault(),gt("env")},children:"Env"})]}),t("div",{class:"profiler-p-4 tab-content active",children:[n==="http"&&(U?t(Ar,{cols:["sm","xs","flex","sm","sm","sm","xs","sm"]}):Pe?t("div",{class:"profiler-empty",children:t("div",{class:"profiler-empty__title",children:Pe})}):K.length===0?t("div",{class:"profiler-empty",children:[t("div",{class:"profiler-empty__title",children:"No profiles found"}),t("p",{class:"profiler-empty__description",children:"Make some requests to your application to see profiling data"})]}):t(P,{children:[t("div",{class:"profiler-action-bar profiler-mb-2",children:t("div",{class:"profiler-filter-group",children:ra.map(u=>t("button",{class:`profiler-preset-btn${je===u.key?" profiler-preset-btn--active":""}`,onClick:()=>Pa(u.key),children:u.label},u.key))})}),t("div",{class:"profiler-action-bar profiler-mb-3",children:[t("div",{class:"profiler-filter-group",children:[t("input",{type:"text",class:"profiler-filter-input",placeholder:"Search path\u2026",value:Me,onInput:u=>Fe(u.target.value)}),t("select",{class:"profiler-filter-select",value:De,onChange:u=>Lt(u.target.value),children:[t("option",{value:"",children:"All Methods"}),t("option",{value:"GET",children:"GET"}),t("option",{value:"POST",children:"POST"}),t("option",{value:"PUT",children:"PUT"}),t("option",{value:"PATCH",children:"PATCH"}),t("option",{value:"DELETE",children:"DELETE"})]}),t("select",{class:"profiler-filter-select",value:ue,onChange:u=>it(u.target.value),children:[t("option",{value:"",children:"All Statuses"}),t("option",{value:"200",children:"2xx"}),t("option",{value:"300",children:"3xx"}),t("option",{value:"400",children:"4xx"}),t("option",{value:"500",children:"5xx"})]}),t("select",{class:"profiler-filter-select",value:Be,onChange:u=>as(u.target.value),children:[t("option",{value:"",children:"All Durations"}),t("option",{value:"lt100",children:"<100ms"}),t("option",{value:"100",children:"\u2265100ms"}),t("option",{value:"500",children:"\u2265500ms"})]})]}),t("div",{class:"profiler-filter-group",children:[Xo&&t("span",{class:"profiler-filter-count",children:[ps.length," / ",K.length]}),t("button",{class:`btn-refresh${U?" btn-refresh--spinning":""}`,onClick:Lr,disabled:U,title:"Refresh",children:"\u21BA"}),t("button",{class:"btn btn-danger btn-sm",onClick:Ka,title:"Delete HTTP profiles",children:"Clear"}),t("button",{class:"btn btn-danger btn-sm",onClick:$s,title:"Delete all HTTP and job profiles",children:"Clear All"})]})]}),ps.length===0?t("div",{class:"profiler-empty",children:t("div",{class:"profiler-empty__title",children:"No results match filters"})}):t("table",{children:[t("thead",{children:t("tr",{children:[t("th",{class:`sortable${te.col==="date"?" sortable--active":""}`,onClick:()=>Qr("date"),children:["Time ",Re(te.col,te.dir,"date")]}),t("th",{children:"Method"}),t("th",{children:"Path"}),t("th",{class:`sortable${te.col==="duration"?" sortable--active":""}`,onClick:()=>Qr("duration"),children:["Duration ",Re(te.col,te.dir,"duration")]}),t("th",{class:`sortable${te.col==="queries"?" sortable--active":""}`,onClick:()=>Qr("queries"),children:["Queries ",Re(te.col,te.dir,"queries")]}),t("th",{class:`sortable${te.col==="memory"?" sortable--active":""}`,onClick:()=>Qr("memory"),title:rt,children:["Allocations ",Re(te.col,te.dir,"memory")]}),t("th",{class:`sortable${te.col==="status"?" sortable--active":""}`,onClick:()=>Qr("status"),children:["Status ",Re(te.col,te.dir,"status")]}),t("th",{children:"Token"}),t("th",{})]})}),t("tbody",{children:Ia.map(u=>t("tr",{children:[t("td",{children:ss(u.started_at)}),t("td",{children:t("span",{class:Bu(u.method),children:u.method})}),t("td",{children:[t("a",{href:`${rs}/profiles/${u.token}`,children:u.path}),u.gem_version&&u.gem_version!==e&&t("span",{class:"profiler-version-warn",title:`Captur\xE9 avec v${u.gem_version} (actuel : v${e})`,children:"\u26A0\uFE0F"})]}),t("td",{children:t("span",{class:Ns(u.duration),children:[u.duration.toFixed(2)," ms"]})}),t("td",{children:u.collectors_data?.database?.total_queries??"-"}),t("td",{children:tt(xe(u))}),t("td",{children:t("span",{class:Ju(u.status),children:u.status})}),t("td",{class:"profiler-text--xs profiler-text--mono profiler-text--muted",children:t("button",{class:"token-copy",onClick:()=>cs(u.token),title:"Copy full token",children:B===u.token?"\u2713":u.token.substring(0,8)+"\u2026"})}),t("td",{children:t("button",{class:"btn-row-delete",onClick:()=>qa(u.token),title:"Delete",children:"\xD7"})})]},u.token))})]}),Ae&&!Xo&&t("div",{class:"profiler-load-more",children:t("button",{class:"btn btn-secondary",onClick:Aa,disabled:Te,children:Te?"Loading\u2026":"Load more"})})]})),n==="jobs"&&(J?t(Ar,{cols:["sm","flex","md","sm","xs","xs","sm"]}):Ke?t("div",{class:"profiler-empty",children:t("div",{class:"profiler-empty__title",children:Ke})}):I.length===0?t("div",{class:"profiler-empty",children:[t("div",{class:"profiler-empty__title",children:"No job profiles found"}),t("p",{class:"profiler-empty__description",children:"Run background jobs in your application to see profiling data"})]}):t(P,{children:[t("div",{class:"profiler-action-bar profiler-mb-3",children:[t("div",{class:"profiler-filter-group",children:[t("input",{type:"text",class:"profiler-filter-input",placeholder:"Search job class\u2026",value:tr,onInput:u=>Fr(u.target.value)}),t("select",{class:"profiler-filter-select",value:rr,onChange:u=>Or(u.target.value),children:[t("option",{value:"",children:"All Statuses"}),t("option",{value:"running",children:"Running"}),t("option",{value:"completed",children:"Completed"}),t("option",{value:"failed",children:"Failed"})]}),t("select",{class:"profiler-filter-select",value:Je,onChange:u=>lt(u.target.value),children:[t("option",{value:"",children:"All Durations"}),t("option",{value:"lt100",children:"<100ms"}),t("option",{value:"100",children:"\u2265100ms"}),t("option",{value:"500",children:"\u2265500ms"})]})]}),t("div",{class:"profiler-filter-group",children:[Yo&&t("span",{class:"profiler-filter-count",children:[ds.length," / ",I.length]}),t("button",{class:`btn-refresh${J?" btn-refresh--spinning":""}`,onClick:Lr,disabled:J,title:"Refresh",children:"\u21BA"}),t("button",{class:"btn btn-danger btn-sm",onClick:Ua,title:"Delete job profiles",children:"Clear"}),t("button",{class:"btn btn-danger btn-sm",onClick:$s,title:"Delete all HTTP and job profiles",children:"Clear All"})]})]}),ds.length===0?t("div",{class:"profiler-empty",children:t("div",{class:"profiler-empty__title",children:"No results match filters"})}):t("table",{children:[t("thead",{children:t("tr",{children:[t("th",{class:`sortable${ve.col==="date"?" sortable--active":""}`,onClick:()=>Hs("date"),children:["Time ",Re(ve.col,ve.dir,"date")]}),t("th",{children:"Job Class"}),t("th",{children:"Queue"}),t("th",{class:`sortable${ve.col==="duration"?" sortable--active":""}`,onClick:()=>Hs("duration"),children:["Duration ",Re(ve.col,ve.dir,"duration")]}),t("th",{class:`sortable${ve.col==="status"?" sortable--active":""}`,onClick:()=>Hs("status"),children:["Status ",Re(ve.col,ve.dir,"status")]}),t("th",{children:"Executions"}),t("th",{children:"Token"}),t("th",{})]})}),t("tbody",{children:Va.map(u=>{let C=u.collectors_data?.job,V=ta(u);return t("tr",{children:[t("td",{children:ss(u.started_at)}),t("td",{children:[t("a",{href:`${rs}/profiles/${u.token}`,children:u.path}),u.gem_version&&u.gem_version!==e&&t("span",{class:"profiler-version-warn",title:`Captur\xE9 avec v${u.gem_version} (actuel : v${e})`,children:"\u26A0\uFE0F"})]}),t("td",{children:t("span",{class:"profiler-text--xs profiler-text--mono",children:C?.queue||"-"})}),t("td",{children:V==="running"?t("span",{class:"profiler-text--muted",children:"-"}):t("span",{class:Ns(u.duration),children:[u.duration.toFixed(2)," ms"]})}),t("td",{children:V==="running"?t("span",{class:"badge-info",children:[t("span",{class:"profiler-spinner","aria-hidden":"true",children:"\u25D0"})," Running"]}):t("span",{class:V==="failed"?"badge-error":"badge-success",children:V==="failed"?"\u2717 Failed":"\u2713 Completed"})}),t("td",{children:C?.executions??"-"}),t("td",{class:"profiler-text--xs profiler-text--mono profiler-text--muted",children:t("button",{class:"token-copy",onClick:()=>cs(u.token),title:"Copy full token",children:B===u.token?"\u2713":u.token.substring(0,8)+"\u2026"})}),t("td",{children:t("button",{class:"btn-row-delete",onClick:()=>Da(u.token),title:"Delete",children:"\xD7"})})]},u.token)})})]}),ot&&!Yo&&t("div",{class:"profiler-load-more",children:t("button",{class:"btn btn-secondary",onClick:Ma,disabled:nt,children:nt?"Loading\u2026":"Load more"})})]})),n==="console"&&(H?t(Ar,{cols:["sm","flex","sm","sm","xs","sm"]}):Ue?t("div",{class:"profiler-empty",children:t("div",{class:"profiler-empty__title",children:Ue})}):oe.length===0?t("div",{class:"profiler-empty",children:[t("div",{class:"profiler-empty__title",children:"No console profiles found"}),t("p",{class:"profiler-empty__description",children:["Run expressions in ",t("code",{children:"rails console"})," to see profiling data"]})]}):t(P,{children:[t("div",{class:"profiler-action-bar profiler-mb-3",children:[t("div",{class:"profiler-filter-group",children:[t("input",{type:"text",class:"profiler-filter-input",placeholder:"Search expression\u2026",value:b,onInput:u=>q(u.target.value)}),t("select",{class:"profiler-filter-select",value:F,onChange:u=>A(u.target.value),children:[t("option",{value:"",children:"All Statuses"}),t("option",{value:"ok",children:"OK"}),t("option",{value:"error",children:"Error"})]})]}),t("div",{class:"profiler-filter-group",children:[en&&t("span",{class:"profiler-filter-count",children:[fs.length," / ",oe.length]}),t("button",{class:`btn-refresh${H?" btn-refresh--spinning":""}`,onClick:Lr,disabled:H,title:"Refresh",children:"\u21BA"}),t("button",{class:"btn btn-danger btn-sm",onClick:Na,title:"Delete console profiles",children:"Clear"}),t("button",{class:"btn btn-danger btn-sm",onClick:$s,title:"Delete all profiles",children:"Clear All"})]})]}),fs.length===0?t("div",{class:"profiler-empty",children:t("div",{class:"profiler-empty__title",children:"No results match filters"})}):t("table",{children:[t("thead",{children:t("tr",{children:[t("th",{class:`sortable${fe.col==="date"?" sortable--active":""}`,onClick:()=>Gs("date"),children:["Time ",Re(fe.col,fe.dir,"date")]}),t("th",{children:"Expression"}),t("th",{class:`sortable${fe.col==="duration"?" sortable--active":""}`,onClick:()=>Gs("duration"),children:["Duration ",Re(fe.col,fe.dir,"duration")]}),t("th",{children:"SQL"}),t("th",{class:`sortable${fe.col==="status"?" sortable--active":""}`,onClick:()=>Gs("status"),children:["Status ",Re(fe.col,fe.dir,"status")]}),t("th",{children:"Token"}),t("th",{})]})}),t("tbody",{children:Ha.map(u=>{let C=u.status===500;return t("tr",{children:[t("td",{children:ss(u.started_at)}),t("td",{children:[t("a",{href:`${rs}/profiles/${u.token}`,class:"profiler-text--mono",style:"font-size:0.85em;",children:u.path.length>60?u.path.slice(0,60)+"\u2026":u.path}),u.gem_version&&u.gem_version!==e&&t("span",{class:"profiler-version-warn",title:`Captur\xE9 avec v${u.gem_version} (actuel : v${e})`,children:"\u26A0\uFE0F"})]}),t("td",{children:t("span",{class:Ns(u.duration),children:[u.duration.toFixed(2)," ms"]})}),t("td",{children:u.collectors_data?.database?.total_queries??"-"}),t("td",{children:t("span",{class:C?"badge-error":"badge-success",children:C?"\u2717 Error":"\u2713 OK"})}),t("td",{class:"profiler-text--xs profiler-text--mono profiler-text--muted",children:t("button",{class:"token-copy",onClick:()=>cs(u.token),title:"Copy full token",children:B===u.token?"\u2713":u.token.substring(0,8)+"\u2026"})}),t("td",{children:t("button",{class:"btn-row-delete",onClick:()=>Qa(u.token),title:"Delete",children:"\xD7"})})]},u.token)})})]}),R&&!en&&t("div",{class:"profiler-load-more",children:t("button",{class:"btn btn-secondary",onClick:Fa,disabled:Yt,children:Yt?"Loading\u2026":"Load more"})})]})),n==="tests"&&(le?t(Ar,{cols:["sm","flex","md","sm","xs","sm"]}):qe?t("div",{class:"profiler-empty",children:t("div",{class:"profiler-empty__title",children:qe})}):N.length===0?t("div",{class:"profiler-empty",children:[t("div",{class:"profiler-empty__title",children:"No test profiles found"}),t("p",{class:"profiler-empty__description",children:["Add ",t("code",{children:"Profiler::TestHelpers::RSpecSupport.install(config)"})," to your spec_helper.rb and run your tests. Or use the ",t("a",{href:"#",style:"color:var(--profiler-accent,#06b6d4)",onClick:u=>{u.preventDefault(),gt("runner")},children:"Test Runner"})," tab to run tests from here."]})]}):t(P,{children:[t("div",{class:"profiler-action-bar profiler-mb-3",children:[t("div",{class:"profiler-filter-group",children:[t("input",{type:"text",class:"profiler-filter-input",placeholder:"Search test name\u2026",value:$,onInput:u=>we(u.target.value)}),t("select",{class:"profiler-filter-select",value:Ie,onChange:u=>Kt(u.target.value),children:[t("option",{value:"",children:"All Statuses"}),t("option",{value:"passed",children:"Passed"}),t("option",{value:"failed",children:"Failed"}),t("option",{value:"pending",children:"Pending"})]})]}),t("div",{class:"profiler-filter-group",children:[tn&&t("span",{class:"profiler-filter-count",children:[ms.length," / ",N.length]}),t("button",{class:`btn-refresh${le?" btn-refresh--spinning":""}`,onClick:Lr,disabled:le,title:"Refresh",children:"\u21BA"}),t("button",{class:"btn btn-danger btn-sm",onClick:ja,title:"Delete test profiles",children:"Clear All"})]})]}),ms.length===0?t("div",{class:"profiler-empty",children:t("div",{class:"profiler-empty__title",children:"No results match filters"})}):t("table",{children:[t("thead",{children:t("tr",{children:[t("th",{class:`sortable${me.col==="date"?" sortable--active":""}`,onClick:()=>sr(u=>({col:"date",dir:u.col==="date"&&u.dir==="asc"?"desc":"asc"})),children:["Time ",Re(me.col,me.dir,"date")]}),t("th",{children:"Test Name"}),t("th",{children:"File"}),t("th",{class:`sortable${me.col==="duration"?" sortable--active":""}`,onClick:()=>sr(u=>({col:"duration",dir:u.col==="duration"&&u.dir==="asc"?"desc":"asc"})),children:["Duration ",Re(me.col,me.dir,"duration")]}),t("th",{children:"Queries"}),t("th",{class:`sortable${me.col==="status"?" sortable--active":""}`,onClick:()=>sr(u=>({col:"status",dir:u.col==="status"&&u.dir==="asc"?"desc":"asc"})),children:["Status ",Re(me.col,me.dir,"status")]}),t("th",{children:"Token"}),t("th",{})]})}),t("tbody",{children:$a.map(u=>{let C=u.collectors_data?.test,V=u.status===500,ee=C?.status||(V?"failed":"passed");return t("tr",{children:[t("td",{children:ss(u.started_at)}),t("td",{style:"max-width: 300px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap",children:t("a",{href:`${rs}/profiles/${u.token}`,title:C?.test_name||u.path,children:C?.test_name||u.path})}),t("td",{class:"profiler-text--xs profiler-text--mono profiler-text--muted",children:C?.test_file||"-"}),t("td",{children:t("span",{class:Ns(u.duration),children:[u.duration.toFixed(2)," ms"]})}),t("td",{children:u.collectors_data?.database?.total_queries??"-"}),t("td",{children:t("span",{class:ee==="failed"?"badge-error":ee==="pending"?"badge-warning":"badge-success",children:ee==="failed"?"\u2717 Failed":ee==="pending"?"\u23F8 Pending":"\u2713 Passed"})}),t("td",{class:"profiler-text--xs profiler-text--mono profiler-text--muted",children:t("button",{class:"token-copy",onClick:()=>cs(u.token),title:"Copy full token",children:B===u.token?"\u2713":u.token.substring(0,8)+"\u2026"})}),t("td",{children:t("button",{class:"btn-row-delete",onClick:()=>La(u.token),title:"Delete",children:"\xD7"})})]},u.token)})})]}),j&&!tn&&t("div",{class:"profiler-load-more",children:t("button",{class:"btn btn-secondary",onClick:Oa,disabled:Q,children:Q?"Loading\u2026":"Load more"})})]})),n==="runner"&&t(Us,{}),n==="outbound"&&(ce?t(Ar,{cols:["sm","xs","flex","sm","xs"],rows:4}):ge?t("div",{class:"profiler-empty",children:t("div",{class:"profiler-empty__title",children:ge})}):D.length===0?t("div",{class:"profiler-empty",children:[t("div",{class:"profiler-empty__title",children:"No outbound HTTP requests found"}),t("p",{class:"profiler-empty__description",children:"Make requests to external services to see outbound HTTP data"})]}):t(P,{children:[t("div",{class:"profiler-action-bar profiler-mb-3",children:[t("div",{class:"profiler-filter-group",children:[t("input",{type:"text",class:"profiler-filter-input",placeholder:"Search URL\u2026",value:or,onInput:u=>he(u.target.value)}),t("select",{class:"profiler-filter-select",value:qr,onChange:u=>us(u.target.value),children:[t("option",{value:"",children:"All Methods"}),t("option",{value:"GET",children:"GET"}),t("option",{value:"POST",children:"POST"}),t("option",{value:"PUT",children:"PUT"}),t("option",{value:"PATCH",children:"PATCH"}),t("option",{value:"DELETE",children:"DELETE"})]}),t("select",{class:"profiler-filter-select",value:Dr,onChange:u=>Wo(u.target.value),children:[t("option",{value:"",children:"All Statuses"}),t("option",{value:"200",children:"2xx"}),t("option",{value:"300",children:"3xx"}),t("option",{value:"400",children:"4xx"}),t("option",{value:"500",children:"5xx"}),t("option",{value:"error",children:"Error"})]})]}),t("div",{class:"profiler-filter-group",children:[Ga&&t("span",{class:"profiler-filter-count",children:[Bs.length," / ",D.length]}),t("button",{class:`btn-refresh${ce?" btn-refresh--spinning":""}`,onClick:Lr,disabled:ce,title:"Refresh",children:"\u21BA"})]})]}),t("p",{class:"profiler-text--xs profiler-text--muted profiler-mb-3",children:[D.length," outbound request",D.length!==1?"s":""," across all profiles. Click a request to expand headers and body."]}),Bs.length===0?t("div",{class:"profiler-empty",children:t("div",{class:"profiler-empty__title",children:"No results match filters"})}):Bs.map((u,C)=>t("div",{style:"margin-bottom:4px",children:[t("div",{class:"profiler-text--xs profiler-text--muted",style:"margin-bottom:2px",children:[ss(u.profile_started_at)," \xB7 Profile: ",t("a",{href:`${rs}/profiles/${u.profile_token}`,children:[u.profile_token.substring(0,8),"\u2026"]})]}),t(Uo,{req:u,index:C,threshold:500})]},C))]})),n==="env"&&(Z?t(Ar,{cols:["sm","flex","sm","sm"],rows:8}):_e?t("div",{class:"profiler-empty",children:t("div",{class:"profiler-empty__title",children:_e})}):t(st,{envData:O}))]})]})]})}function oa(){let{data:e}=_i({query:{retry:!1,refetchOnWindowFocus:!1}}),r=e?.slaves??[],s=bi();return r.length===0?null:t("div",{class:"profiler-selector",style:{display:"flex",alignItems:"center",gap:"8px",padding:"4px 12px",background:"var(--profiler-bg-secondary, #f5f5f5)",borderBottom:"1px solid var(--profiler-border, #e0e0e0)"},children:[t("span",{style:{fontSize:"12px",fontWeight:600,color:"var(--profiler-text-secondary, #666)",textTransform:"uppercase",letterSpacing:"0.05em"},children:"Profiler"}),t("select",{value:s??"__local__",onChange:i=>{let a=i.target.value;xi(a==="__local__"?null:a)},style:{fontSize:"13px",padding:"2px 6px",borderRadius:"4px",border:"1px solid var(--profiler-border, #ccc)",background:"var(--profiler-bg, #fff)",color:"var(--profiler-text, #333)",cursor:"pointer"},children:[t("option",{value:"__local__",children:"Local (master)"}),r.map(i=>t("option",{value:i.name,disabled:i.status==="offline",children:[i.name," ",i.status==="offline"?"(offline)":""]},i.name))]}),s&&t("span",{style:{fontSize:"11px",color:"var(--profiler-text-secondary, #888)",fontStyle:"italic"},children:"Viewing slave data via proxy"})]})}function zu(e){let r=e.headers??{},s=e.params??{},o=e.request_body,n=[`curl -X ${e.method}`];Object.entries(r).filter(([a])=>a!=="User-Agent").forEach(([a,l])=>n.push(` -H '${a}: ${l}'`)),["POST","PUT","PATCH"].includes(e.method)&&(o&&o.length>0?n.push(` -d '${o.replace(/'/g,"'\\''")}'`):Object.keys(s).length>0&&((r["Content-Type"]??"").includes("application/json")?n.push(` -d '${JSON.stringify(s).replace(/'/g,"'\\''")}'`):Object.entries(s).forEach(([l,f])=>n.push(` --data-urlencode '${l}=${f}'`))));let i=`http://localhost:3000${e.path}`;return e.method==="GET"&&Object.keys(s).length>0&&(i+="?"+Object.entries(s).map(([a,l])=>`${encodeURIComponent(a)}=${encodeURIComponent(String(l))}`).join("&")),n.push(` '${i}'`),n.join(` \\
12
+ `)}function Wu(e,r){let s=[],o=(i,a,l,f)=>{if(a){let p=l!=null?`${f?"at least ":""}${l.toLocaleString("en")} bytes, `:"";s.push(`${i} body truncated: ${p}only the beginning was kept (max_captured_body_bytes).`)}};o("Request",e.request_body_truncated??r.request_body_truncated,e.request_body_size??r.request_body_size,e.request_body_size_is_minimum??r.request_body_size_is_minimum),o("Response",e.response_body_truncated??r.response_body_truncated,e.response_body_size??r.response_body_size,e.response_body_size_is_minimum??r.response_body_size_is_minimum);let n=e.collectors_released_after_seconds??r.collectors_released_after_seconds;return n!=null&&s.push(`Incomplete profile: the collectors of this stream were released after ${n} s, before the server closed it; what it did later is missing.`),s}function na({profile:e}){let r=e.collectors_data?.request??{},s=e.params&&Object.keys(e.params).length>0,o=Wu(e,r);return t("div",{class:"profiler-ajax-card profiler-ajax-card--success",style:"margin-bottom:8px;background:var(--profiler-bg-elevated);transform:translateX(3px);box-shadow:var(--profiler-shadow-sm);transition:none",children:[t(Ks,{method:e.method,url:e.path,copyUrl:`http://localhost:3000${e.path}`,status:e.status,duration:e.duration,curlCommand:zu(e)}),(r.controller_action||r.route_pattern)&&t("div",{class:"profiler-ajax-card__row",children:[r.controller_action&&t("span",{class:"profiler-text--xs profiler-text--muted",style:"margin-right:16px",children:r.controller_action}),r.route_pattern&&t("span",{class:"profiler-text--xs profiler-text--muted",style:"font-family:monospace",children:[r.route_name?`${r.route_name} \xB7 `:"",r.route_pattern]})]}),o.map(n=>t("div",{class:"profiler-ajax-card__row profiler-text--xs profiler-text--warning",children:n},n)),t(Ls,{request:{headers:e.headers??{},body:e.request_body??void 0,body_encoding:e.request_body_encoding,params:s?e.params:void 0},response:{headers:e.response_headers??{},body:e.response_body??void 0,body_encoding:e.response_body_encoding}})]})}function Zu(e){return e.replace(/\$\d+/g,"?").replace(/\b\d+\b/g,"?").replace(/'[^']*'/g,"?").replace(/"[^"]*"/g,"?").trim()}function Xu(e){let r=new Map;e.forEach((o,n)=>{if(o.cached||o.transaction)return;let i=Zu(o.sql);r.has(i)||r.set(i,{indices:[],backtrace:o.backtrace??[]}),r.get(i).indices.push(n)});let s=[];return r.forEach(({indices:o,backtrace:n},i)=>{o.length>=3&&s.push({pattern:i,indices:o,backtrace:n})}),s.sort((o,n)=>n.indices.length-o.indices.length)}function ia(e,r=0){let s=e["Node Type"]??"",o=e["Actual Rows"]??0,n=e["Plan Rows"]??1,i=s.includes("Seq Scan")||s.includes("Hash Join")||s.includes("Nested Loop")||s.includes("Filter")||o>0&&n>0&&o>n*10,a=e.Plans??[];return t("div",{class:`profiler-explain-node${i?" profiler-explain-node--expensive":""}`,style:`margin-left:${r*14}px`,children:[t("span",{class:"profiler-explain-node__type",children:s}),e["Relation Name"]&&t("span",{class:"profiler-text--muted",children:[" on ",e["Relation Name"]]}),e["Index Name"]&&t("span",{class:"profiler-text--muted",children:[" using ",e["Index Name"]]}),t("div",{class:"profiler-explain-node__stats profiler-text--xs profiler-text--muted",children:[e["Actual Total Time"]!=null&&t("span",{children:["time: ",e["Actual Total Time"].toFixed(3),"ms"]}),e["Actual Rows"]!=null&&t("span",{children:["rows: ",o," (est: ",n,")"]}),e["Total Cost"]!=null&&t("span",{children:["cost: ",e["Total Cost"].toFixed(2)]}),e.Filter&&t("span",{class:"profiler-text--warning",children:["filter: ",e.Filter]})]}),a.map((l,f)=>ia(l,r+1))]})}function Yu({state:e,onClose:r}){if(z(()=>{if(!e.open)return;let o=n=>{n.key==="Escape"&&r()};return document.addEventListener("keydown",o),()=>document.removeEventListener("keydown",o)},[e.open]),!e.open)return null;let s=()=>{if(e.loading)return t("div",{class:"profiler-text--muted",children:"Running EXPLAIN ANALYZE\u2026"});if(e.error)return t("div",{class:"profiler-text--error",children:e.error});if(!e.result)return null;if(e.format==="json")try{let o=typeof e.result=="string"?JSON.parse(e.result):e.result,n=Array.isArray(o)?o:[o];return t("div",{class:"profiler-explain-result",children:n.map((i,a)=>t("div",{children:[ia(i.Plan??i),i["Planning Time"]!=null&&t("div",{class:"profiler-text--xs profiler-text--muted profiler-mt-2",children:["Planning: ",i["Planning Time"].toFixed(3),"ms",i["Execution Time"]!=null&&t(P,{children:[" \xB7 Execution: ",i["Execution Time"].toFixed(3),"ms"]})]})]},a))})}catch{return t("pre",{class:"profiler-explain-result",children:String(e.result)})}return t("pre",{class:"profiler-explain-result",children:String(e.result)})};return t("div",{class:"profiler-modal__overlay",onClick:r,children:t("div",{class:"profiler-modal",onClick:o=>o.stopPropagation(),children:[t("div",{class:"profiler-modal__header",children:[t("span",{class:"profiler-modal__title",children:"EXPLAIN ANALYZE"}),t("span",{class:"profiler-text--xs profiler-text--muted",children:e.adapter}),t("button",{class:"profiler-modal__close",onClick:r,children:"\xD7"})]}),t("div",{class:"profiler-modal__body",children:s()})]})})}function Mt({dbData:e,token:r}){let[s,o]=x(new Set),[n,i]=x({open:!1,loading:!1,result:null,format:"text",adapter:"",error:null}),{mutateAsync:a}=Pi();if(!e?.queries)return t("div",{class:"profiler-empty",children:t("p",{class:"profiler-empty__description",children:"No database queries recorded"})});let l=Xu(e.queries),f=new Set(l.flatMap(y=>y.indices)),p=y=>{o(m=>{let g=new Set(m);return g.has(y)?g.delete(y):g.add(y),g})},h=async y=>{i({open:!0,loading:!0,result:null,format:"text",adapter:"",error:null});try{let m=await a({data:{token:r,query_index:y}});i(g=>({...g,loading:!1,result:m.result,format:m.format??"text",adapter:m.adapter??""}))}catch(m){i(g=>({...g,loading:!1,error:m.message??"Request failed"}))}},d=()=>i(y=>({...y,open:!1}));return t(P,{children:[t("h2",{class:"profiler-section__header",children:["Database Queries (",e.total_queries,")"]}),t("div",{class:"profiler-flex profiler-flex--gap-4 profiler-mb-4 profiler-text--sm",children:[t("span",{children:["Total Duration: ",t("strong",{children:[e.total_duration," ms"]})]}),t("span",{children:["Slow Queries: ",t("strong",{class:"profiler-text--error",children:e.slow_queries})]}),t("span",{children:["Cached: ",t("strong",{children:e.cached_queries})]})]}),l.length>0&&t("div",{class:"profiler-alert-banner profiler-alert-banner--warning profiler-mb-4",children:[t("span",{class:"profiler-alert-banner__icon",children:"\u26A0\uFE0F"}),t("div",{style:"flex:1",children:[t("strong",{children:"Potential N+1 detected"})," - ",l.length," pattern",l.length>1?"s":""," repeated ",l.reduce((y,m)=>y+m.indices.length,0)," times total",t("div",{class:"profiler-text--xs profiler-text--muted profiler-mt-1",children:"Queries causing N+1 are highlighted below. Expand each group to see the call stack."})]}),l.length>1&&t("button",{class:"profiler-btn profiler-btn--sm",style:"flex-shrink:0;align-self:flex-start",onClick:()=>{let y=l.every(m=>s.has(m.pattern));o(y?new Set:new Set(l.map(m=>m.pattern)))},children:l.every(y=>s.has(y.pattern))?"Collapse all":"Expand all"})]}),l.map(y=>t("div",{class:"profiler-n1-group profiler-mb-4",children:[t("div",{class:"profiler-n1-group__header",onClick:()=>p(y.pattern),children:[t("span",{class:"profiler-n1-group__count",children:["N+1 \xB7 ",y.indices.length,"\xD7"]}),t("code",{class:"profiler-n1-group__pattern",children:y.pattern}),t("span",{class:"profiler-n1-group__toggle",children:[s.has(y.pattern)?"\u25B2":"\u25BC"," backtrace"]})]}),s.has(y.pattern)&&y.backtrace.length>0&&t("div",{class:"profiler-n1-backtrace",children:y.backtrace.map((m,g)=>t("div",{class:"profiler-n1-backtrace__frame",children:m},g))})]},y.pattern)),e.queries.map((y,m)=>t("div",{class:["profiler-query-card",y.slow?"profiler-query-card--slow":"",f.has(m)?"profiler-query-card--n1":""].filter(Boolean).join(" "),children:[t("div",{class:"profiler-query-card__header",children:[t("div",{class:"profiler-flex profiler-flex--gap-2",children:[t("span",{class:"profiler-text--muted",children:["#",m+1]}),f.has(m)&&t("span",{class:"profiler-badge profiler-badge--warning",children:"N+1"}),y.name&&t("span",{class:"profiler-text--xs profiler-text--muted",children:y.name})]}),t("div",{class:"profiler-flex profiler-flex--gap-2",children:[t("span",{class:`profiler-query-card__duration ${y.slow?"profiler-query-card__duration--slow":"profiler-query-card__duration--fast"}`,children:[y.duration.toFixed(2)," ms"]}),!y.cached&&!y.transaction&&t("button",{class:"profiler-btn profiler-btn--sm",onClick:()=>h(m),children:"Explain"})]})]}),t("code",{class:"profiler-query-card__code",children:y.sql})]},m)),t(Yu,{state:n,onClose:d})]})}function Ft({dumpData:e}){return e?.dumps?.length?t(P,{children:[t("h2",{class:"profiler-section__header",children:["Dumped Variables (",e.count,")"]}),e.dumps.map((r,s)=>t("div",{class:"profiler-dump-card",children:[t("div",{class:"profiler-dump-card__header",children:[t("div",{children:[t("span",{class:"profiler-text--xs profiler-text--muted",children:["#",s+1]}),r.label&&t("span",{class:"profiler-dump-card__label",children:r.label})]}),t("div",{children:[t("div",{class:"profiler-dump-card__location",children:[r.file,":",r.line]}),t("div",{class:"profiler-text--xs profiler-text--muted profiler-mt-1",children:new Date(r.timestamp).toLocaleTimeString("en",{hour12:!1})})]})]}),t("div",{class:"profiler-dump-card__content",children:t("pre",{children:r.formatted})})]},s))]}):t("div",{class:"profiler-empty",children:[t("div",{class:"profiler-empty__icon",children:"\u{1F50D}"}),t("h3",{class:"profiler-empty__title",children:"No dumps recorded"}),t("div",{class:"profiler-empty__description",children:[t("p",{children:["Use ",t("code",{children:"Profiler.dump(variable)"})," in your code to dump variables here."]}),t("p",{class:"profiler-mt-3",children:["Example: ",t("code",{children:'Profiler.dump(@user, "Current user")'})]})]})]})}var ec={controller:"#60a5fa",view:"#34d399",partial:"#f59e0b",sql:"#fb923c",cache:"#a78bfa",http:"#f87171",custom:"#e879f9",method:"#94a3b8"},yt=24,tc=1,Io=yt+tc,rc=60,sc=300,os=class{constructor(r,s,o){this.frames=[];this.maxDepth=0;this.globalStart=0;this.globalEnd=0;this.viewport={start:0,end:0};this.targetViewport={start:0,end:0};this.animating=!1;this.animStart=0;this.prevViewport={start:0,end:0};this.dpr=1;this.hoveredFrame=null;this.zoomStack=[];this.searchQuery="";this.highlightName="";this.isPanning=!1;this.panStartX=0;this.panStartViewport={start:0,end:0};this.boundHandlers={};this.canvas=r,this.ctx=r.getContext("2d"),this.callbacks=o,this.flatten(s),this.computeGlobalBounds(),this.viewport={start:this.globalStart,end:this.globalEnd},this.targetViewport={...this.viewport},this.setupCanvas(),this.bindEvents(),this.render()}flatten(r){this.frames=[],this.maxDepth=0;let s=(o,n)=>{for(let i of o)this.frames.push({node:i,depth:n,absStart:i.started_at,absEnd:i.finished_at}),n>this.maxDepth&&(this.maxDepth=n),i.children?.length&&s(i.children,n+1)};s(r,0)}computeGlobalBounds(){if(this.frames.length===0){this.globalStart=0,this.globalEnd=1;return}this.globalStart=Math.min(...this.frames.map(r=>r.absStart)),this.globalEnd=Math.max(...this.frames.map(r=>r.absEnd)),this.globalEnd<=this.globalStart&&(this.globalEnd=this.globalStart+1)}setupCanvas(){this.dpr=window.devicePixelRatio||1,this.resizeCanvas()}resizeCanvas(){let s=this.canvas.getBoundingClientRect().width,o=(this.maxDepth+1)*Io+8;this.canvas.width=s*this.dpr,this.canvas.height=o*this.dpr,this.canvas.style.height=`${o}px`,this.ctx.setTransform(this.dpr,0,0,this.dpr,0,0),this.render()}bindEvents(){this.boundHandlers.mousemove=r=>this.onMouseMove(r),this.boundHandlers.mouseleave=()=>this.onMouseLeave(),this.boundHandlers.click=r=>this.onClickEvent(r),this.boundHandlers.wheel=r=>this.onWheel(r),this.boundHandlers.mousedown=r=>this.onMouseDown(r),this.boundHandlers.mouseupmove=r=>this.onMouseUpOrMove(r),this.boundHandlers.mouseup=()=>this.onMouseUp(),this.canvas.addEventListener("mousemove",this.boundHandlers.mousemove),this.canvas.addEventListener("mouseleave",this.boundHandlers.mouseleave),this.canvas.addEventListener("click",this.boundHandlers.click),this.canvas.addEventListener("wheel",this.boundHandlers.wheel,{passive:!1}),this.canvas.addEventListener("mousedown",this.boundHandlers.mousedown),window.addEventListener("mousemove",this.boundHandlers.mouseupmove),window.addEventListener("mouseup",this.boundHandlers.mouseup)}hitTest(r,s){let o=this.canvas.getBoundingClientRect(),n=r-o.left,i=s-o.top,a=o.width,l=this.viewport.end-this.viewport.start;for(let f=this.frames.length-1;f>=0;f--){let p=this.frames[f],h=(p.absStart-this.viewport.start)/l*a,d=(p.absEnd-p.absStart)/l*a,y=p.depth*Io;if(n>=h&&n<=h+d&&i>=y&&i<=y+yt)return p}return null}onMouseMove(r){if(this.isPanning)return;let s=this.hitTest(r.clientX,r.clientY);this.hoveredFrame=s,this.canvas.style.cursor=s?"pointer":"default",this.callbacks.onHover(s,r.clientX,r.clientY),this.render()}onMouseLeave(){this.hoveredFrame=null,this.canvas.style.cursor="default",this.callbacks.onHover(null,0,0),this.render()}onClickEvent(r){if(this.isPanning)return;let s=this.hitTest(r.clientX,r.clientY);s&&(this.callbacks.onClick(s),this.zoomTo(s.node))}onWheel(r){r.preventDefault();let s=this.canvas.getBoundingClientRect(),n=(r.clientX-s.left)/s.width,i=this.viewport.end-this.viewport.start,a=r.deltaY>0?1.3:.7,l=Math.min(this.globalEnd-this.globalStart,i*a),f=this.viewport.start+n*i,p=f-n*l,h=f+(1-n)*l;p<this.globalStart&&(p=this.globalStart,h=p+l),h>this.globalEnd&&(h=this.globalEnd,p=h-l),this.animateViewport({start:p,end:h}),this.updateZoomStack(p,h)}onMouseDown(r){r.button===0&&(this.isPanning=!0,this.panStartX=r.clientX,this.panStartViewport={...this.viewport},this.canvas.style.cursor="grabbing")}onMouseUpOrMove(r){if(!this.isPanning)return;let s=r.clientX-this.panStartX,o=this.canvas.getBoundingClientRect(),n=this.panStartViewport.end-this.panStartViewport.start,i=-(s/o.width)*n,a=this.panStartViewport.start+i,l=this.panStartViewport.end+i;a<this.globalStart&&(l+=this.globalStart-a,a=this.globalStart),l>this.globalEnd&&(a-=l-this.globalEnd,l=this.globalEnd),this.viewport={start:a,end:l},this.targetViewport={...this.viewport},this.render()}onMouseUp(){this.isPanning&&(this.isPanning=!1,this.canvas.style.cursor="default")}zoomTo(r){let s=[],o=(i,a,l)=>{for(let f of i){if(f===a)return s.push(...l,f),!0;if(f.children?.length&&o(f.children,a,[...l,f]))return!0}return!1},n=this.frames.filter(i=>i.depth===0).map(i=>i.node);o(n,r,[]),this.zoomStack=s,this.animateViewport({start:r.started_at,end:r.finished_at}),this.callbacks.onZoomChange(s)}resetZoom(){this.zoomStack=[],this.animateViewport({start:this.globalStart,end:this.globalEnd}),this.callbacks.onZoomChange([])}updateZoomStack(r,s){let o=this.globalEnd-this.globalStart;s-r>=o*.99&&(this.zoomStack=[],this.callbacks.onZoomChange([]))}animateViewport(r){this.prevViewport={...this.viewport},this.targetViewport=r,this.animStart=performance.now(),this.animating||(this.animating=!0,this.animLoop())}animLoop(){let r=Math.min(1,(performance.now()-this.animStart)/sc),s=r<.5?2*r*r:1-Math.pow(-2*r+2,2)/2;this.viewport={start:this.prevViewport.start+(this.targetViewport.start-this.prevViewport.start)*s,end:this.prevViewport.end+(this.targetViewport.end-this.prevViewport.end)*s},this.render(),r<1?requestAnimationFrame(()=>this.animLoop()):(this.animating=!1,this.viewport={...this.targetViewport},this.render())}setSearchQuery(r){this.searchQuery=r,this.render()}setHighlightName(r){this.highlightName=r,this.render()}render(){let r=this.ctx,s=this.canvas.width/this.dpr,o=this.canvas.height/this.dpr,n=this.viewport.end-this.viewport.start;r.clearRect(0,0,s,o);let i=getComputedStyle(this.canvas),a=i.getPropertyValue("--profiler-text").trim()||"#eef2f7",l=i.getPropertyValue("--profiler-text-muted").trim()||"#5e7080",f=this.searchQuery.toLowerCase(),p=f.length>0;if(p&&this.callbacks.onSearchResults){let h=0;for(let d of this.frames)d.node.name.toLowerCase().includes(f)&&h++;this.callbacks.onSearchResults(h,this.frames.length)}for(let h of this.frames){let d=(h.absStart-this.viewport.start)/n*s,y=(h.absEnd-h.absStart)/n*s,m=h.depth*Io;if(d+y<0||d>s||y<.5)continue;let g=ec[h.node.category]||"#a78bfa",v=h===this.hoveredFrame,_=!!this.highlightName&&h.node.name===this.highlightName,T=!p||h.node.name.toLowerCase().includes(f);if(r.fillStyle=v||_?this.lightenColor(g,.2):g,r.globalAlpha=p&&!T?.2:v||_?1:.85,this.roundRect(r,d,m,y,yt,3),r.fill(),r.globalAlpha=1,v?(r.strokeStyle="#ffffff",r.lineWidth=1.5,this.roundRect(r,d,m,y,yt,3),r.stroke()):_?(r.strokeStyle="#fbbf24",r.lineWidth=2,this.roundRect(r,d,m,y,yt,3),r.stroke()):p&&T&&(r.strokeStyle="#ffffff",r.lineWidth=1,r.globalAlpha=.5,this.roundRect(r,d,m,y,yt,3),r.stroke(),r.globalAlpha=1),y>rc&&T){r.fillStyle=this.getTextColor(g),r.font='11px "JetBrains Mono", monospace',r.textBaseline="middle";let w=h.node.name,S=`${h.node.duration.toFixed(1)}ms`,M=y-8,K=r.measureText(S).width;if(M>K+20){let I=M-K-8;r.fillText(this.truncateText(r,w,I),d+4,m+yt/2),r.fillStyle=v?a:l,r.fillText(S,d+y-K-4,m+yt/2)}else r.fillText(this.truncateText(r,w,M),d+4,m+yt/2)}}}roundRect(r,s,o,n,i,a){r.beginPath(),r.moveTo(s+a,o),r.lineTo(s+n-a,o),r.quadraticCurveTo(s+n,o,s+n,o+a),r.lineTo(s+n,o+i-a),r.quadraticCurveTo(s+n,o+i,s+n-a,o+i),r.lineTo(s+a,o+i),r.quadraticCurveTo(s,o+i,s,o+i-a),r.lineTo(s,o+a),r.quadraticCurveTo(s,o,s+a,o),r.closePath()}truncateText(r,s,o){if(r.measureText(s).width<=o)return s;let n=s;for(;n.length>0&&r.measureText(n+"...").width>o;)n=n.slice(0,-1);return n.length>0?n+"...":""}lightenColor(r,s){let o=parseInt(r.slice(1),16),n=Math.min(255,(o>>16&255)+Math.round(255*s)),i=Math.min(255,(o>>8&255)+Math.round(255*s)),a=Math.min(255,(o&255)+Math.round(255*s));return`rgb(${n},${i},${a})`}getTextColor(r){let s=parseInt(r.slice(1),16),o=s>>16&255,n=s>>8&255,i=s&255;return(.299*o+.587*n+.114*i)/255>.5?"#1a1a2e":"#f0f0f0"}destroy(){this.canvas.removeEventListener("mousemove",this.boundHandlers.mousemove),this.canvas.removeEventListener("mouseleave",this.boundHandlers.mouseleave),this.canvas.removeEventListener("click",this.boundHandlers.click),this.canvas.removeEventListener("wheel",this.boundHandlers.wheel),this.canvas.removeEventListener("mousedown",this.boundHandlers.mousedown),window.removeEventListener("mousemove",this.boundHandlers.mouseupmove),window.removeEventListener("mouseup",this.boundHandlers.mouseup)}};var oc={controller:"Controller",view:"View",partial:"Partial",sql:"SQL",cache:"Cache",http:"HTTP",custom:"Custom",method:"Method"},nc={controller:"#60a5fa",view:"#34d399",partial:"#f59e0b",sql:"#fb923c",cache:"#a78bfa",http:"#f87171",custom:"#e879f9",method:"#94a3b8"};function ic(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(2)} MB`}var ns=class{constructor(r,s){this.totalDuration=s,this.el=document.createElement("div"),this.el.className="profiler-flamegraph__tooltip",r.appendChild(this.el)}show(r,s,o){let n=r.node,i=n.category,a=nc[i]||"#a78bfa",l=oc[i]||i,f=this.totalDuration>0?(n.duration/this.totalDuration*100).toFixed(1):"0";this.el.textContent="";let p=document.createElement("div");if(p.className="tooltip-header",p.textContent=n.name,this.el.appendChild(p),this.addRow("Category",()=>{let m=document.createElement("span");return m.className="tooltip-badge",m.style.background=a,m.textContent=l,m}),this.addRow("Duration",()=>{let m=document.createElement("span");return m.className="value",m.textContent=`${n.duration.toFixed(2)} ms`,m}),this.addRow("% of total",()=>{let m=document.createElement("span");return m.className="value",m.textContent=`${f}%`,m}),i==="method"&&n.payload&&(n.payload.memory_bytes!=null&&this.addRow("Memory",()=>{let m=document.createElement("span");return m.className="value",m.textContent=ic(n.payload.memory_bytes),m}),n.payload.allocated_objects!=null&&this.addRow("Objects",()=>{let m=document.createElement("span");return m.className="value",m.textContent=`${n.payload.allocated_objects.toLocaleString()} obj`,m}),n.payload.recursive&&this.addRow("Recursive",()=>{let m=document.createElement("span");return m.className="value",m.style.color="var(--profiler-warning)",m.textContent="\u21BA yes",m}),n.payload.file)){let m=document.createElement("div");m.className="tooltip-payload",m.textContent=`${n.payload.file}:${n.payload.line}`,this.el.appendChild(m)}if(n.payload&&i!=="method"){let m=null;if(i==="sql"&&n.payload.sql){let g=n.payload.sql;m=g.length>200?g.slice(0,200)+"...":g}else if(i==="cache"&&n.payload.key)m=`Key: ${n.payload.key}`;else if(i==="http"&&n.payload.url)m=n.payload.url;else if(i==="custom"&&Object.keys(n.payload).length>0){let g=Object.entries(n.payload).map(([v,_])=>`${v}: ${JSON.stringify(_)}`).join(`
13
+ `);m=g.length>200?g.slice(0,200)+"...":g}if(m){let g=document.createElement("div");g.className="tooltip-payload",g.textContent=m,this.el.appendChild(g)}}let h=s+12,d=o-8,y=this.el.getBoundingClientRect();h+y.width>window.innerWidth&&(h=s-y.width-12),d+y.height>window.innerHeight&&(d=o-y.height-8),d<0&&(d=4),this.el.style.left=`${h}px`,this.el.style.top=`${d}px`,this.el.classList.add("visible")}hide(){this.el.classList.remove("visible")}destroy(){this.el.remove()}addRow(r,s){let o=document.createElement("div");o.className="tooltip-row";let n=document.createElement("span");n.className="label",n.textContent=r,o.appendChild(n),o.appendChild(s()),this.el.appendChild(o)}};var is=class{constructor(r,s){this.onNavigate=s,this.el=document.createElement("div"),this.el.className="profiler-flamegraph__breadcrumbs",r.appendChild(this.el)}update(r){if(this.el.textContent="",r.length===0){this.el.style.display="none";return}this.el.style.display="flex";let s=document.createElement("button");s.className="breadcrumb-item",s.textContent="Root",s.addEventListener("click",()=>this.onNavigate(null)),this.el.appendChild(s);for(let o of r){let n=document.createElement("span");n.className="breadcrumb-separator",n.textContent="\u203A",this.el.appendChild(n);let i=document.createElement("button");i.className="breadcrumb-item";let a=o.name.length>30?o.name.slice(0,30)+"...":o.name;i.textContent=a,i.addEventListener("click",()=>this.onNavigate(o)),this.el.appendChild(i)}}destroy(){this.el.remove()}};var Vo={controller:"#60a5fa",view:"#34d399",partial:"#f59e0b",sql:"#fb923c",cache:"#a78bfa",http:"#f87171",custom:"#e879f9",method:"#94a3b8"},aa={controller:"Controller",view:"View",partial:"Partial",sql:"SQL",cache:"Cache",http:"HTTP",custom:"Custom",method:"Method"};function Ot({flamegraphData:e,perfData:r,functionProfileData:s}){let o=de(null),n=de(null),i=de(null),a=de(null),l=de(null),f=de(null),[p,h]=x(!1),[d,y]=x(""),[m,g]=x(0),[v,_]=x(0),[T,w]=x("total_duration"),[S,M]=x("desc"),[K,I]=x(s?.reason==="stackprof_missing"?!0:s?.enabled??!1),[oe,N]=x(s?.max_frames??2e3),[D,O]=x(s?.mode==="lite"?"lite":"full"),[U,J]=x(s?.clock??"wall"),[H,le]=x(!1),[ce,Z]=x(!1),[Pe,Ke]=x(!1),[Ue,qe]=x(!1),{mutateAsync:ge}=Ai(),_e=async()=>{le(!0);try{let Q=await ge({data:{enabled:!K}});I(Q.enabled)}finally{le(!1)}},Ae=async Q=>{Z(!0);try{let B=await ge({data:{max_frames:Q}});N(B.max_frames)}finally{Z(!1)}},ot=async Q=>{O(Q),Ke(!0);try{let B=await ge({data:{mode:Q}});O(B.mode??Q)}finally{Ke(!1)}},R=async Q=>{qe(!0);try{let B=await ge({data:{clock:Q}});J(B.clock??Q)}finally{qe(!1)}},j=e;if(z(()=>{if(!j?.root_events?.length||!o.current||!n.current)return;let Q=n.current,B=o.current,Ne=new ns(Q,j.total_duration);a.current=Ne;let Me=new is(Q,ue=>{i.current&&(ue?i.current.zoomTo(ue):i.current.resetZoom())});l.current=Me,Q.insertBefore(Me.el,B);let Fe=new os(B,j.root_events,{onHover:(ue,it,Be)=>{ue?Ne.show(ue,it,Be):Ne.hide()},onClick:ue=>{h(!0)},onZoomChange:ue=>{Me.update(ue),h(ue.length>0)},onSearchResults:(ue,it)=>{g(ue),_(it)}});i.current=Fe;let De=()=>Fe.resizeCanvas();window.addEventListener("resize",De);let Lt=()=>Fe.render();return document.addEventListener("profiler:theme-change",Lt),()=>{Fe.destroy(),Ne.destroy(),Me.destroy(),window.removeEventListener("resize",De),document.removeEventListener("profiler:theme-change",Lt),i.current=null,a.current=null,l.current=null}},[j]),z(()=>{i.current?.setSearchQuery(d),d||(g(0),_(0))},[d]),z(()=>{let Q=B=>{(B.ctrlKey||B.metaKey)&&B.key==="f"&&(B.preventDefault(),f.current?.focus())};return document.addEventListener("keydown",Q,{capture:!0}),()=>document.removeEventListener("keydown",Q,{capture:!0})},[]),!j?.root_events?.length)return r?.events?.length?t("div",{class:"profiler-flamegraph",children:[t("h2",{class:"profiler-section__header",children:["Performance Timeline (",r.total_events," events)"]}),t("p",{class:"profiler-mb-4",children:["Total Duration: ",t("strong",{children:[r.total_duration," ms"]})]}),r.events.map((Q,B)=>t("div",{class:"profiler-query-card",children:[t("div",{class:"profiler-query-card__header",children:[t("strong",{children:Q.name}),t("span",{class:Q.duration>=500?"badge-error":Q.duration>=100?"badge-warning":"badge-success",children:[Q.duration.toFixed(2)," ms"]})]}),Q.payload&&Object.keys(Q.payload).length>0&&t("pre",{class:"profiler-text--xs profiler-text--muted profiler-mt-2",children:JSON.stringify(Q.payload,null,2)})]},B)),t(Ho,{data:s,enabled:K,toggling:H,maxFrames:oe,maxFramesUpdating:ce,mode:D,modeUpdating:Pe,clock:U,clockUpdating:Ue,sortKey:T,sortDir:S,onToggle:_e,onMaxFramesChange:Ae,onModeChange:ot,onClockChange:R,onSortChange:(Q,B)=>{w(Q),M(B)}})]}):t("div",{class:"profiler-flamegraph",children:[t("div",{class:"profiler-empty",children:t("p",{class:"profiler-empty__description",children:"No performance events recorded"})}),t(Ho,{data:s,enabled:K,toggling:H,maxFrames:oe,maxFramesUpdating:ce,mode:D,modeUpdating:Pe,clock:U,clockUpdating:Ue,sortKey:T,sortDir:S,onToggle:_e,onMaxFramesChange:Ae,onModeChange:ot,onClockChange:R,onSortChange:(Q,B)=>{w(Q),M(B)}})]});let Te={},nt=Q=>{let B=Q.category;Te[B]||(Te[B]={count:0,duration:0}),Te[B].count++,Te[B].duration+=Q.duration,Q.children?.forEach(nt)};j.root_events.forEach(nt);let Yt=()=>{i.current?.resetZoom(),h(!1)};return t("div",{class:"profiler-flamegraph",children:[t("div",{class:"profiler-flamegraph__stats",children:[t("div",{class:"stat-item",children:[t("span",{class:"stat-label",children:"Total Events"}),t("span",{class:"stat-value",children:j.total_events})]}),t("div",{class:"stat-item",children:[t("span",{class:"stat-label",children:"Total Duration"}),t("span",{class:"stat-value",children:[j.total_duration.toFixed(2)," ",t("small",{children:"ms"})]})]}),Object.keys(Te).map(Q=>t("div",{class:"stat-item",children:[t("span",{class:"stat-label",children:[t("span",{class:"stat-dot",style:{background:Vo[Q]}}),aa[Q]]}),t("span",{class:"stat-value",children:Te[Q].count})]},Q))]}),t("div",{class:"profiler-flamegraph__legend",children:Object.keys(Vo).map(Q=>t("div",{class:"legend-item",children:[t("span",{class:"legend-color",style:{background:Vo[Q]}}),t("span",{children:aa[Q]})]},Q))}),t("div",{class:"profiler-flamegraph__controls",children:[p&&t("button",{class:"profiler-flamegraph__reset",onClick:Yt,children:"Reset Zoom"}),t("div",{class:"profiler-flamegraph__search",children:[t("input",{ref:f,type:"text",class:"profiler-flamegraph__search-input",placeholder:"Search events\u2026 (Ctrl+F)",value:d,onInput:Q=>y(Q.target.value)}),d&&t("span",{class:"profiler-flamegraph__match-count",children:[m," / ",v]})]}),t("span",{class:"profiler-flamegraph__hint",children:"Click to zoom, scroll to zoom in/out, drag to pan"})]}),t("div",{class:"profiler-flamegraph__canvas-container",ref:n,children:t("canvas",{ref:o,class:"profiler-flamegraph__canvas",style:{width:"100%"}})}),t(Ho,{data:s,enabled:K,toggling:H,maxFrames:oe,maxFramesUpdating:ce,mode:D,modeUpdating:Pe,clock:U,clockUpdating:Ue,sortKey:T,sortDir:S,onToggle:_e,onMaxFramesChange:Ae,onModeChange:ot,onClockChange:R,onSortChange:(Q,B)=>{w(Q),M(B)}})]})}function la(e,r=new Set){return r.add(e.name),e.children?.forEach(s=>la(s,r)),r}function ua(e,r){for(let s of e){if(s.name===r)return s;let o=ua(s.children??[],r);if(o)return o}return null}function Ho({data:e,enabled:r,toggling:s,maxFrames:o,maxFramesUpdating:n,mode:i,modeUpdating:a,clock:l,clockUpdating:f,sortKey:p,sortDir:h,onToggle:d,onMaxFramesChange:y,onModeChange:m,onClockChange:g,onSortChange:v}){let[_,T]=x(null),[w,S]=x(null),[M,K]=x(null),I=de(null),oe=r&&e?.enabled&&(e.functions?.length??0)>0,N=e?.reason==="stackprof_missing"&&i==="lite",D=e?.mode??"full",O=e?.clock??"wall",U=D==="lite",J=O==="object",H=!U,le=D==="full",ce=i==="lite",Z=p==="memory_bytes"&&!le||p==="allocated_objects"&&!H?"total_duration":p,Pe=oe?e.root_calls??[]:[],Ke=oe?[...e.functions].sort((R,j)=>h==="asc"?R[Z]-j[Z]:j[Z]-R[Z]):[],Ue=_?Ke.filter(R=>_.has(R.name)):Ke,qe=R=>{R?(T(la(R)),S(R.name)):(T(null),S(null))},ge=R=>{R===p?v(R,h==="asc"?"desc":"asc"):v(R,"desc")},_e=R=>Z!==R?t("span",{class:"sort-icon sort-icon--idle",children:"\u21C5"}):t("span",{class:"sort-icon sort-icon--active",children:h==="asc"?"\u25B2":"\u25BC"}),Ae=R=>{let j=parseInt(R.target.value,10);!isNaN(j)&&j>0&&j!==o&&y(j)},ot=R=>{R.key==="Enter"&&R.target.blur()};return t("div",{class:"profiler-fn-profiling",children:[t("div",{class:"profiler-fn-profiling__header",children:[t("span",{class:`profiler-fn-profiling__title${r?" profiler-fn-profiling__title--active":""}`,children:"Function Profiling"}),t("div",{class:"profiler-fn-profiling__controls",children:[t("div",{class:"profiler-fn-profiling__mode-selector",children:["full","lite"].map(R=>t("button",{class:`profiler-fn-profiling__mode-btn${i===R?" profiler-fn-profiling__mode-btn--active":""}`,onClick:()=>i!==R&&m(R),disabled:a,title:R==="full"?"Exhaustive TracePoint - timing + allocations + memory bytes":"StackProf sampling - very low overhead",children:R.charAt(0).toUpperCase()+R.slice(1)},R))}),ce&&t("div",{class:"profiler-fn-profiling__mode-selector",children:["wall","cpu","object"].map(R=>t("button",{class:`profiler-fn-profiling__mode-btn${l===R?" profiler-fn-profiling__mode-btn--active":""}`,onClick:()=>l!==R&&g(R),disabled:f,title:R==="wall"?"Wall-clock time (includes I/O waits)":R==="cpu"?"CPU time only (excludes I/O waits)":"Object allocations per function",children:R==="wall"?"Wall":R==="cpu"?"CPU":"Alloc"},R))}),t("label",{class:"profiler-fn-profiling__max-frames-label",children:["Max frames",t("input",{type:"number",class:"profiler-fn-profiling__max-frames-input",defaultValue:o,min:1,disabled:n,onBlur:Ae,onKeyDown:ot}),n&&t("span",{class:"profiler-fn-profiling__updating",children:"\u2026"})]}),t("button",{class:`profiler-fn-profiling__toggle${r?" profiler-fn-profiling__toggle--active":""}`,onClick:d,disabled:s,children:s?"\u2026":r?"Enabled (click to disable)":"Disabled (click to enable)"})]})]}),!r&&t("p",{class:"profiler-fn-profiling__hint",children:["Enable function profiling to see where your app spends time."," ",t("strong",{children:"Lite"}),": statistical sampling with the stackprof gem, to add to the application's Gemfile; very low overhead (<1%), on by default once stackprof is installed."," ",t("strong",{children:"Full"}),": exhaustive TracePoint tracing with memory bytes - significant overhead."]}),r&&N&&t("p",{class:"profiler-fn-profiling__hint",children:["No data: sampling needs the ",t("code",{children:"stackprof"})," gem, which is not installed. Add"," ",t("code",{children:'gem "stackprof"'})," to the application's Gemfile. To trace every method call instead, at a much higher cost, choose ",t("strong",{children:"Full"}),", or set"," ",t("code",{children:"Profiler.function_profiling_tracepoint_fallback = true"})," in an initializer."]}),r&&!oe&&!N&&t("p",{class:"profiler-fn-profiling__hint",children:"Function profiling is active. Data will appear on the next request."}),oe&&t(P,{children:[e.frame_cap_reached&&t("div",{class:"profiler-fn-profiling__cap-warning",children:["\u26A0 Frame cap reached (",e.max_frames,' frames) - call tree is truncated. Increase "Max frames" to capture more.']}),t("div",{class:"profiler-flamegraph__stats",style:{marginTop:"0.75rem"},children:[t("div",{class:"stat-item",children:[t("span",{class:"stat-label",children:"Functions"}),t("span",{class:"stat-value",children:e.functions.length})]}),t("div",{class:"stat-item",children:[t("span",{class:"stat-label",children:U?"Total Samples":"Total Calls"}),t("span",{class:"stat-value",children:e.total_calls})]}),!J&&t("div",{class:"stat-item",children:[t("span",{class:"stat-label",children:"Wall"}),t("span",{class:"stat-value",children:[(e.elapsed_wall_ms??e.total_duration??0).toFixed(2)," ",t("small",{children:"ms"})]})]}),U&&!J&&e.elapsed_cpu_ms!=null&&t("div",{class:"stat-item",children:[t("span",{class:"stat-label",title:"CPU time excludes I/O waits (DB, network, sleep). Low CPU% = I/O-bound.",children:"CPU"}),t("span",{class:"stat-value",children:[e.elapsed_cpu_ms.toFixed(2)," ",t("small",{children:"ms"}),e.elapsed_wall_ms!=null&&e.elapsed_wall_ms>0&&t("small",{class:"profiler-fn-profiling__cpu-pct",children:[" ","(",Math.round(e.elapsed_cpu_ms/e.elapsed_wall_ms*100),"%)"]})]})]}),J&&t("div",{class:"stat-item",children:[t("span",{class:"stat-label",children:"Allocations"}),t("span",{class:"stat-value",children:[e.total_duration?.toLocaleString()," ",t("small",{children:"obj"})]})]}),U&&(e.gc_overhead_pct??0)>0&&t("div",{class:"stat-item",children:[t("span",{class:"stat-label",title:`${e.gc_samples} samples during GC`,children:"GC"}),t("span",{class:`stat-value${(e.gc_overhead_pct??0)>=20?" profiler-fn-profiling__gc--high":(e.gc_overhead_pct??0)>=5?" profiler-fn-profiling__gc--medium":""}`,children:[e.gc_overhead_pct,"%"]})]}),H&&t("div",{class:"stat-item",children:[t("span",{class:"stat-label",children:"Allocated"}),t("span",{class:"stat-value",children:[e.total_allocated_objects?.toLocaleString()," ",t("small",{children:"obj"})]})]}),le&&t("div",{class:"stat-item",children:[t("span",{class:"stat-label",children:"Memory"}),t("span",{class:"stat-value",children:Sr(e.total_memory_bytes??0)})]})]}),Pe.length>0&&t(ac,{rootCalls:Pe,onFrameSelect:qe,rendererRef:I,onHoverName:R=>K(R)}),_&&t("div",{class:"profiler-fn-profiling__filter-active",children:[t("span",{children:["Showing ",t("strong",{children:w})," + ",_.size-1," child function",_.size!==2?"s":""]}),t("button",{class:"profiler-fn-profiling__filter-clear",onClick:()=>{T(null),S(null)},children:"\u2715 Clear"})]}),t("table",{class:"profiler-table profiler-fn-profiling__table",children:[t("thead",{children:t("tr",{children:[t("th",{children:"Function"}),t("th",{children:"File"}),t("th",{class:`profiler-text--right sortable${Z==="calls"?" sortable--active":""}`,onClick:()=>ge("calls"),children:[U?"Samples":"Calls"," ",_e("calls")]}),t("th",{class:`profiler-text--right sortable${Z==="total_duration"?" sortable--active":""}`,onClick:()=>ge("total_duration"),children:[J?"Total Alloc":"Total Time"," ",_e("total_duration")]}),t("th",{class:`profiler-text--right sortable${Z==="self_duration"?" sortable--active":""}`,onClick:()=>ge("self_duration"),children:[J?"Self Alloc":"Self Time"," ",_e("self_duration")]}),H&&t("th",{class:`profiler-text--right sortable${Z==="allocated_objects"?" sortable--active":""}`,onClick:()=>ge("allocated_objects"),children:["Objects ",_e("allocated_objects")]}),le&&t("th",{class:`profiler-text--right sortable${Z==="memory_bytes"?" sortable--active":""}`,onClick:()=>ge("memory_bytes"),children:["Memory ",_e("memory_bytes")]})]})}),t("tbody",{children:Ue.map((R,j)=>t("tr",{class:M===R.name?"profiler-fn-profiling__row--highlighted":"",style:{cursor:Pe.length>0?"pointer":"default"},onMouseEnter:()=>{K(R.name),I.current?.setHighlightName(R.name)},onMouseLeave:()=>{K(null),I.current?.setHighlightName("")},onClick:()=>{let Te=ua(Pe,R.name);Te&&(I.current?.zoomTo(Te),qe(Te))},children:[t("td",{class:"profiler-fn-profiling__name",children:[R.recursive_calls>0&&t("span",{class:"profiler-fn-profiling__recursive",title:`${R.recursive_calls} recursive call(s)`,children:"\u21BA"}),R.name]}),t("td",{class:"profiler-text--muted profiler-text--xs",style:{fontFamily:"var(--profiler-font-mono)"},children:[R.file,":",R.line]}),t("td",{class:"profiler-text--right",children:R.calls}),t("td",{class:"profiler-text--right",children:J?t("span",{class:"profiler-text--muted",children:[R.total_duration.toLocaleString()," ",t("small",{children:"obj"})]}):t("span",{class:R.total_duration>=100?"badge-error":R.total_duration>=10?"badge-warning":"badge-success",children:[R.total_duration.toFixed(2)," ms"]})}),t("td",{class:"profiler-text--right",children:J?t("span",{class:"profiler-text--muted",children:[R.self_duration.toLocaleString()," ",t("small",{children:"obj"})]}):t("span",{class:R.self_duration>=50?"badge-error":R.self_duration>=5?"badge-warning":"badge-success",children:[R.self_duration.toFixed(2)," ms"]})}),H&&t("td",{class:"profiler-text--right profiler-text--muted",children:[R.allocated_objects.toLocaleString()," ",t("small",{children:"obj"})]}),le&&t("td",{class:"profiler-text--right profiler-text--muted",children:Sr(R.memory_bytes)})]},j))})]})]})]})}function ac({rootCalls:e,onFrameSelect:r,rendererRef:s,onHoverName:o}){let n=de(null),i=de(null),a=de(null),l=de(r),f=de(o),[p,h]=x(!1);z(()=>{l.current=r},[r]),z(()=>{f.current=o},[o]);let d=e.reduce((m,g)=>m+g.duration,0);return z(()=>{if(!e.length||!n.current||!i.current)return;let m=i.current,g=n.current,v=new ns(m,d),_=new is(m,M=>{M?(a.current?.zoomTo(M),l.current?.(M)):(a.current?.resetZoom(),l.current?.(null))});m.insertBefore(_.el,g);let T=new os(g,e,{onHover:(M,K,I)=>{M?(v.show(M,K,I),f.current?.(M.node.name)):(v.hide(),f.current?.(null))},onClick:M=>{h(!0),l.current?.(M.node),T.zoomTo(M.node)},onZoomChange:M=>{_.update(M),h(M.length>0),M.length===0&&l.current?.(null)}});a.current=T,s&&(s.current=T);let w=()=>T.resizeCanvas();window.addEventListener("resize",w);let S=()=>T.render();return document.addEventListener("profiler:theme-change",S),()=>{T.destroy(),v.destroy(),_.destroy(),window.removeEventListener("resize",w),document.removeEventListener("profiler:theme-change",S),a.current=null,s&&(s.current=null)}},[e]),t("div",{class:"profiler-fn-profiling__flamegraph",children:[t("div",{class:"profiler-flamegraph__controls",children:[p&&t("button",{class:"profiler-flamegraph__reset",onClick:()=>{a.current?.resetZoom(),h(!1),l.current?.(null)},children:"Reset Zoom"}),t("span",{class:"profiler-flamegraph__hint",children:"Click to zoom & filter table \xB7 scroll to zoom in/out \xB7 drag to pan"})]}),t("div",{class:"profiler-flamegraph__canvas-container",ref:i,children:t("canvas",{ref:n,class:"profiler-flamegraph__canvas",style:{width:"100%"}})})]})}function ca({viewData:e}){return e?t(P,{children:[t("h2",{class:"profiler-section__header",children:"View Rendering"}),t("div",{class:"profiler-flex profiler-flex--gap-4 profiler-mb-4 profiler-text--sm",children:[t("span",{children:["Views: ",t("strong",{children:e.total_views})]}),t("span",{children:["Partials: ",t("strong",{children:e.total_partials})]}),t("span",{children:["Total Duration: ",t("strong",{children:[e.total_duration," ms"]})]})]}),e.views&&e.views.length>0&&t(P,{children:[t("h3",{class:"profiler-text--lg profiler-mt-6 profiler-mb-3",children:"Templates"}),e.views.map((r,s)=>t("div",{class:"profiler-query-card profiler-query-card--success",children:t("div",{class:"profiler-query-card__header",children:[t("span",{children:r.identifier}),t("span",{class:"badge-success",children:[r.duration.toFixed(2)," ms"]})]})},s))]}),e.partials&&e.partials.length>0&&t(P,{children:[t("h3",{class:"profiler-text--lg profiler-mt-6 profiler-mb-3",children:"Partials"}),e.partials.map((r,s)=>t("div",{class:"profiler-query-card profiler-query-card--success",children:t("div",{class:"profiler-query-card__header",children:[t("span",{children:r.identifier}),t("span",{class:"badge-success",children:[r.duration.toFixed(2)," ms"]})]})},s))]})]}):t("div",{class:"profiler-empty",children:t("p",{class:"profiler-empty__description",children:"No view data recorded"})})}var lc={frame:"Turbo Frame request",stream:"Turbo Stream response"};function pa({ajaxData:e}){if(!e?.requests?.length)return t("div",{class:"profiler-empty",children:[t("div",{class:"profiler-empty__icon",children:"\u{1F310}"}),t("h3",{class:"profiler-empty__title",children:"No AJAX requests tracked"}),t("p",{class:"profiler-empty__description",children:"AJAX requests made from this page will appear here."})]});let r=e.total_duration/e.total_requests;return t(P,{children:[t("h2",{class:"profiler-section__header",children:["AJAX Requests (",e.total_requests,")"]}),t("div",{class:"profiler-flex profiler-flex--gap-4 profiler-mb-4 profiler-text--sm",children:[t("span",{children:["Total Duration: ",t("strong",{children:[e.total_duration.toFixed(2)," ms"]})]}),t("span",{children:["Average: ",t("strong",{children:[r.toFixed(2)," ms"]})]})]}),t("div",{class:"profiler-grid profiler-grid--2 profiler-mb-6",children:[t("div",{class:"profiler-panel profiler-panel--sm",children:[t("h3",{class:"profiler-text--sm profiler-text--muted profiler-text--uppercase profiler-mb-3",children:"By Method"}),Object.entries(e.by_method).map(([s,o])=>t("div",{class:"profiler-kv-row",children:[t("span",{class:`badge-${ts(s)}`,children:s}),t("strong",{children:o})]},s))]}),t("div",{class:"profiler-panel profiler-panel--sm",children:[t("h3",{class:"profiler-text--sm profiler-text--muted profiler-text--uppercase profiler-mb-3",children:"By Status"}),Object.entries(e.by_status).map(([s,o])=>t("div",{class:"profiler-kv-row",children:[t("span",{class:`badge-${s.startsWith("2")?"success":s.startsWith("4")||s.startsWith("5")?"error":"warning"}`,children:s}),t("strong",{children:o})]},s))]})]}),t("h3",{class:"profiler-text--lg profiler-mb-3",children:"Requests"}),e.requests.map((s,o)=>t("div",{class:`profiler-ajax-card profiler-ajax-card--${s.status>=200&&s.status<300?"success":"error"}`,children:[t("div",{class:"profiler-ajax-card__row",children:[t("div",{class:"profiler-flex profiler-flex--gap-3",children:[t("span",{class:`profiler-ajax-card__method badge-${ts(s.method)}`,children:s.method}),s.turbo&&t("span",{class:"badge-default",title:lc[s.turbo],children:s.turbo.toUpperCase()}),t("strong",{class:"profiler-ajax-card__path",children:s.path})]}),t("div",{class:"profiler-flex profiler-flex--gap-2",children:[t("span",{class:`badge-${Qs(s.status)}`,children:s.status}),t("span",{class:s.duration>=500?"badge-error":s.duration>=100?"badge-warning":"badge-success",children:[s.duration.toFixed(2)," ms"]})]})]}),t("div",{class:"profiler-ajax-card__row",children:[t("span",{class:"profiler-ajax-card__time",children:new Date(s.started_at).toLocaleTimeString("en",{hour12:!1})}),t("a",{href:`/_profiler/profiles/${s.token}`,class:"profiler-text--sm",style:"color: var(--profiler-accent);",children:"View Profile \u2192"})]})]},o))]})}function qt({cacheData:e}){return e?t(P,{children:[t("h2",{class:"profiler-section__header",children:"Cache Operations"}),t("div",{class:"profiler-flex profiler-flex--gap-4 profiler-mb-4 profiler-text--sm",children:[t("span",{children:["Reads: ",t("strong",{children:e.total_reads})]}),t("span",{children:["Writes: ",t("strong",{children:e.total_writes})]}),t("span",{children:["Deletes: ",t("strong",{children:e.total_deletes})]}),t("span",{children:["Hit Rate:"," ",t("strong",{class:`badge-${e.hit_rate>80?"success":"warning"}`,children:[e.hit_rate,"%"]})]})]}),e.reads&&e.reads.length>0&&t(P,{children:[t("h3",{class:"profiler-text--lg profiler-mt-6 profiler-mb-3",children:"Cache Reads"}),e.reads.map((r,s)=>t("div",{class:"profiler-query-card",children:t("div",{class:"profiler-query-card__header",children:[t("span",{class:"profiler-text--mono profiler-text--sm",children:r.key}),t("div",{class:"profiler-flex profiler-flex--gap-2",children:[t("span",{class:r.hit?"badge-success":"badge-error",children:r.hit?"HIT":"MISS"}),t("span",{class:r.duration>=500?"badge-error":r.duration>=100?"badge-warning":"badge-success",children:[r.duration.toFixed(2)," ms"]})]})]})},s))]})]}):t("div",{class:"profiler-empty",children:t("p",{class:"profiler-empty__description",children:"No cache operations recorded"})})}function uc(e){switch(e){case"ERROR":case"FATAL":return"profiler-text--error";case"WARN":return"profiler-text--warning";case"INFO":return"profiler-text--success";default:return"profiler-text--muted"}}function cc(e){switch(e){case"ERROR":case"FATAL":return"background: var(--profiler-error, #ef4444); color: #fff;";case"WARN":return"background: var(--profiler-warning, #f59e0b); color: #fff;";case"INFO":return"background: var(--profiler-success, #22c55e); color: #fff;";default:return"background: var(--profiler-muted, #6b7280); color: #fff;"}}function Dt({logData:e}){let[r,s]=x("ALL"),[o,n]=x("");if(!e?.logs?.length)return t("div",{class:"profiler-empty",children:[t("div",{class:"profiler-empty__icon",children:"\u{1F4CB}"}),t("h3",{class:"profiler-empty__title",children:"No log messages captured"}),t("div",{class:"profiler-empty__description",children:t("p",{children:["Log messages emitted via ",t("code",{children:"Rails.logger"})," during this request will appear here."]})})]});let i=["ALL","DEBUG","INFO","WARN","ERROR","FATAL"],a=e.logs.filter(l=>!(r!=="ALL"&&l.level!==r||o&&!l.message.toLowerCase().includes(o.toLowerCase())));return t(P,{children:[t("h2",{class:"profiler-section__header",children:["Log Messages (",e.count,")"]}),t("div",{class:"profiler-flex profiler-flex--gap-4 profiler-mb-4 profiler-text--sm",children:[e.errors>0&&t("span",{children:["Errors: ",t("strong",{class:"profiler-text--error",children:e.errors})]}),e.warnings>0&&t("span",{children:["Warnings: ",t("strong",{class:"profiler-text--warning",children:e.warnings})]})]}),t("div",{class:"profiler-action-bar profiler-mb-4",children:[t("div",{class:"profiler-flex profiler-flex--gap-2",children:i.map(l=>t("button",{onClick:()=>s(l),class:`btn btn-sm ${r===l?"btn-primary":"btn-secondary"}`,children:l},l))}),t("input",{type:"text",class:"profiler-filter-input",placeholder:"Search messages\u2026",value:o,onInput:l=>n(l.target.value),style:"width:200px"})]}),a.length===0?t("div",{class:"profiler-text--muted profiler-text--sm",children:["No messages match",o?` "${o}"`:"","."]}):a.map((l,f)=>t("div",{class:"profiler-query-card profiler-mb-2",children:[t("div",{class:"profiler-query-card__header",children:[t("span",{class:"profiler-text--xs",style:`display:inline-block;padding:1px 6px;border-radius:3px;font-weight:600;${cc(l.level)}`,children:l.level}),t("span",{class:"profiler-text--xs profiler-text--muted",children:new Date(l.timestamp).toLocaleTimeString("en",{hour12:!1})})]}),t("pre",{class:`profiler-query-card__code ${uc(l.level)}`,style:"white-space:pre-wrap;word-break:break-all;",children:l.message})]},f))]})}function Qt({exceptionData:e}){let[r,s]=x(!1);if(!e?.exception_class)return t("div",{class:"profiler-empty",children:[t("div",{class:"profiler-empty__icon",children:"\u{1F4A5}"}),t("h3",{class:"profiler-empty__title",children:"No exception recorded"}),t("div",{class:"profiler-empty__description",children:t("p",{children:"Exceptions raised during this request will appear here."})})]});let o=e.backtrace||[],n=o.filter(a=>a.app_frame),i=r?o:o.slice(0,30);return t(P,{children:[t("div",{class:"profiler-mb-4",style:"padding: 12px 16px; background: color-mix(in srgb, var(--profiler-error, #ef4444) 10%, transparent); border-left: 4px solid var(--profiler-error, #ef4444); border-radius: 4px;",children:[t("div",{class:"profiler-text--error",style:"font-size:1.1em;font-weight:700;margin-bottom:4px;",children:e.exception_class}),t("div",{style:"font-family:monospace;font-size:0.9em;word-break:break-word;",children:e.message})]}),n.length>0&&t("div",{class:"profiler-mb-4",children:[t("h3",{class:"profiler-section__header",children:["Application frames (",n.length,")"]}),n.map((a,l)=>t("div",{class:"profiler-query-card profiler-mb-1",children:t("code",{class:"profiler-text--sm",children:a.location})},l))]}),t("div",{children:[t("h3",{class:"profiler-section__header",children:["Full backtrace (",o.length," frames)"]}),i.map((a,l)=>t("div",{class:"profiler-query-card profiler-mb-1",style:a.app_frame?"":"opacity:0.45;",children:t("code",{class:`profiler-text--sm${a.app_frame?" profiler-text--success":" profiler-text--muted"}`,children:a.location})},l)),!r&&o.length>30&&t("button",{class:"btn btn-secondary btn-sm profiler-mt-2",onClick:()=>s(!0),children:["Show all ",o.length," frames"]})]})]})}var pc={GET:"var(--profiler-success)",POST:"var(--profiler-accent)",PUT:"var(--profiler-warning)",PATCH:"var(--profiler-warning)",DELETE:"var(--profiler-error)"};function da({verb:e}){let r=pc[e]??"var(--profiler-text-muted)";return t("span",{style:{display:"inline-block",minWidth:"52px",textAlign:"center",padding:"1px 6px",borderRadius:"4px",fontSize:"10px",fontWeight:700,fontFamily:"monospace",border:`1px solid ${r}`,color:r},children:e})}function fa({routesData:e}){let[r,s]=x(""),[o,n]=x("ALL"),{total:i,matched:a,routes:l}=e,f=["ALL",...Array.from(new Set(l.map(h=>h.verb))).sort()],p=l.filter(h=>{let d=o==="ALL"||h.verb===o,y=r.toLowerCase(),m=!y||(h.pattern??"").toLowerCase().includes(y)||(h.name??"").toLowerCase().includes(y)||(h.controller_action??"").toLowerCase().includes(y);return d&&m});return t(P,{children:[t("h2",{class:"profiler-section__header",children:"Routes"}),t("div",{class:"profiler-flex profiler-flex--gap-4 profiler-mb-4",children:t("div",{class:"profiler-stat-card",children:[t("div",{class:"profiler-stat-card__value",children:i}),t("div",{class:"profiler-stat-card__label",children:"Total routes"})]})}),a&&t(P,{children:[t("h2",{class:"profiler-section__header profiler-mt-4",children:"Matched Route"}),t("table",{class:"profiler-mb-4",children:[t("tr",{children:[t("th",{class:"profiler-text--sm",style:"width:120px;",children:"Verb"}),t("td",{children:t(da,{verb:a.verb})})]}),t("tr",{children:[t("th",{class:"profiler-text--sm",children:"Pattern"}),t("td",{class:"profiler-text--mono profiler-text--xs",children:a.pattern})]}),a.name&&t("tr",{children:[t("th",{class:"profiler-text--sm",children:"Route Name"}),t("td",{class:"profiler-text--mono profiler-text--xs",children:[a.name,"_path"]})]}),a.controller_action&&t("tr",{children:[t("th",{class:"profiler-text--sm",children:"Controller#Action"}),t("td",{class:"profiler-text--mono profiler-text--xs",children:a.controller_action})]})]})]}),t("h2",{class:"profiler-section__header profiler-mt-4",children:"All Routes"}),t("div",{class:"profiler-flex profiler-flex--gap-2 profiler-mb-3",style:"flex-wrap:wrap;align-items:center;",children:[t("input",{type:"text",class:"profiler-filter-input",placeholder:"Filter by path, name or controller\u2026",value:r,onInput:h=>s(h.target.value),style:"flex:1;width:auto;min-width:200px;"}),t("div",{class:"profiler-flex profiler-flex--gap-1",children:f.map(h=>t("button",{onClick:()=>n(h),style:{padding:"3px 8px",fontSize:"11px",fontWeight:600,borderRadius:"4px",border:"1px solid var(--profiler-border)",background:o===h?"var(--profiler-accent)":"transparent",color:o===h?"#fff":"var(--profiler-text-muted)",cursor:"pointer"},children:h},h))})]}),t("div",{class:"profiler-flex-table",children:[t("div",{class:"profiler-flex-table__header",children:[t("span",{class:"profiler-flex-table__cell--fixed",children:"Verb"}),t("span",{class:"profiler-flex-table__cell",children:"Pattern"}),t("span",{class:"profiler-flex-table__cell",children:"Name"}),t("span",{class:"profiler-flex-table__cell",children:"Controller#Action"})]}),p.map((h,d)=>t("div",{class:`profiler-flex-table__row${h.matched?" profiler-flex-table__row--matched":""}`,children:[t("span",{class:"profiler-flex-table__cell--fixed",children:t(da,{verb:h.verb})}),t("span",{class:"profiler-flex-table__cell profiler-text--mono profiler-text--xs",title:h.pattern,children:h.pattern}),t("span",{class:"profiler-flex-table__cell profiler-flex-table__cell--muted profiler-text--mono profiler-text--xs",title:h.name?`${h.name}_path`:"",children:h.name?`${h.name}_path`:"-"}),t("span",{class:"profiler-flex-table__cell profiler-flex-table__cell--muted profiler-text--mono profiler-text--xs",title:h.controller_action??"",children:h.controller_action??"-"})]},d))]})]})}function ma({i18nData:e}){let[r,s]=x("ALL");if(!e?.lookups?.length)return t("div",{class:"profiler-empty",children:[t("div",{class:"profiler-empty__icon",children:"\u{1F310}"}),t("h3",{class:"profiler-empty__title",children:"No translation lookups captured"}),t("div",{class:"profiler-empty__description",children:t("p",{children:["Calls to ",t("code",{children:"I18n.t"})," during this request will appear here."]})})]});let o=r==="MISSING"?e.lookups.filter(n=>n.missing):e.lookups;return t(P,{children:[t("h2",{class:"profiler-section__header",children:["I18n Lookups (",e.total,")"]}),t("div",{class:"profiler-flex profiler-flex--gap-4 profiler-mb-4 profiler-text--sm",children:[t("span",{children:["Locale: ",t("strong",{children:e.locale})]}),e.missing_count>0&&t("span",{children:["Missing: ",t("strong",{class:"profiler-text--error",children:e.missing_count})]})]}),t("div",{class:"profiler-flex profiler-flex--gap-2 profiler-mb-4",children:["ALL","MISSING"].map(n=>t("button",{onClick:()=>s(n),class:`btn btn-sm ${r===n?"btn-primary":"btn-secondary"}`,children:n},n))}),o.length===0?t("div",{class:"profiler-text--muted profiler-text--sm",children:"No missing translations."}):t("table",{class:"profiler-table",children:[t("thead",{children:t("tr",{children:[t("th",{children:"Key"}),t("th",{children:"Locale"}),t("th",{children:"Value"}),t("th",{children:"Status"})]})}),t("tbody",{children:o.map((n,i)=>t("tr",{style:n.missing?"background:var(--profiler-error-bg,rgba(239,68,68,0.08));":"",children:[t("td",{children:t("code",{class:`profiler-text--xs profiler-text--mono${n.missing?" profiler-text--error":""}`,children:n.key})}),t("td",{children:t("span",{class:"profiler-text--xs profiler-text--muted",children:n.locale})}),t("td",{children:t("span",{class:`profiler-text--xs${n.missing?" profiler-text--error":""}`,children:n.value})}),t("td",{children:n.missing?t("span",{class:"profiler-text--xs profiler-text--error",style:"font-weight:600;",children:"\u26A0 missing"}):t("span",{class:"profiler-text--xs profiler-text--success",children:"\u2713"})})]},i))})]})]})}function js({jobs:e}){return e?.length?t(P,{children:[t("h2",{class:"profiler-section__header",children:["Background Jobs (",e.length,")"]}),e.map((r,s)=>t("div",{class:`profiler-ajax-card profiler-ajax-card--${r.status==="completed"?"success":r.status==="failed"?"error":"default"}`,children:[t("div",{class:"profiler-ajax-card__row",children:[t("div",{class:"profiler-flex profiler-flex--gap-3",children:[t("span",{class:`badge-${r.status==="completed"?"success":r.status==="failed"?"error":r.status==="running"?"info":"warning"}`,children:r.status??"unknown"}),t("strong",{class:"profiler-ajax-card__path",children:r.job_class})]}),r.status==="running"?t("span",{class:"badge-info",children:"running"}):t("span",{class:r.duration>=1e3?"badge-error":r.duration>=200?"badge-warning":"badge-success",children:[r.duration?.toFixed(2)," ms"]})]}),t("div",{class:"profiler-ajax-card__row",children:[t("span",{class:"profiler-ajax-card__time profiler-text--muted",children:[r.queue&&t("span",{children:["Queue: ",t("strong",{children:r.queue})," \xB7 "]}),new Date(r.started_at).toLocaleTimeString("en",{hour12:!1})]}),t("a",{href:`/_profiler/profiles/${r.token}`,class:"profiler-text--sm",style:"color: var(--profiler-accent);",children:"View Job \u2192"})]})]},s))]}):t("div",{class:"profiler-empty",children:[t("div",{class:"profiler-empty__icon",children:"\u2699\uFE0F"}),t("h3",{class:"profiler-empty__title",children:"No jobs triggered"}),t("p",{class:"profiler-empty__description",children:"Background jobs enqueued during this request will appear here."})]})}function dc({email:e}){let r=!!e.body_html,s=!!e.body_text;if(!e.body_captured)return t("div",{class:"profiler-mt-3 profiler-text--xs profiler-text--muted",children:["Body not captured - enable ",t("code",{children:"config.capture_mail_body = true"})," in your profiler initializer"]});if(!r&&!s)return null;let[o,n]=x(r?"preview":"text"),i=l=>f=>{f.stopPropagation(),n(l)},a={borderColor:"var(--profiler-accent)",color:"var(--profiler-accent)"};return t("div",{class:"profiler-mt-3",children:[t("div",{class:"profiler-mb-2 profiler-flex profiler-flex--gap-2",style:{alignItems:"center"},children:[t("span",{class:"profiler-text--muted profiler-text--xs",children:"Body"}),r&&t(P,{children:[t("button",{class:"profiler-btn profiler-btn--sm",style:o==="preview"?a:{},onClick:i("preview"),children:"HTML preview"}),t("button",{class:"profiler-btn profiler-btn--sm",style:o==="source"?a:{},onClick:i("source"),children:"HTML source"})]}),s&&t("button",{class:"profiler-btn profiler-btn--sm",style:o==="text"?a:{},onClick:i("text"),children:"Plain text"})]}),o==="preview"&&r&&t("iframe",{srcdoc:e.body_html??void 0,sandbox:"",style:{width:"100%",height:"300px",border:"1px solid var(--profiler-border)",borderRadius:"var(--profiler-radius-md)",background:"#fff",display:"block"}}),(o==="source"||o==="text")&&t("pre",{style:{maxHeight:"300px",overflow:"auto",background:"var(--profiler-bg-lighter, rgba(0,0,0,0.2))",padding:"12px",borderRadius:"var(--profiler-radius-md)",fontSize:"12px",margin:0,whiteSpace:"pre-wrap",wordBreak:"break-all",border:"1px solid var(--profiler-border)"},children:o==="source"?e.body_html:e.body_text})]})}function ya({assigns:e}){let r=Object.entries(e);return r.length===0?null:t("div",{class:"profiler-mt-3",children:[t("div",{class:"profiler-text--xs profiler-text--muted profiler-mb-1",style:{textTransform:"uppercase",letterSpacing:"0.05em"},children:"Variables"}),r.map(([s,o])=>t("div",{class:"profiler-kv-row",children:[t("span",{children:t("code",{children:["@",s]})}),t("code",{style:{textAlign:"right",wordBreak:"break-all",maxWidth:"60%"},children:o})]},s))]})}function fc({email:e}){return t("div",{class:"profiler-mt-3",onClick:r=>r.stopPropagation(),children:[e.subject&&t("div",{class:"profiler-kv-row",children:[t("span",{children:"Subject"}),t("span",{children:e.subject})]}),e.to&&e.to.length>0&&t("div",{class:"profiler-kv-row",children:[t("span",{children:"To"}),t("span",{style:{textAlign:"right",wordBreak:"break-all"},children:e.to.join(", ")})]}),e.from&&e.from.length>0&&t("div",{class:"profiler-kv-row",children:[t("span",{children:"From"}),t("span",{style:{textAlign:"right"},children:e.from.join(", ")})]}),e.cc&&e.cc.length>0&&t("div",{class:"profiler-kv-row",children:[t("span",{children:"CC"}),t("span",{style:{textAlign:"right"},children:e.cc.join(", ")})]}),e.bcc&&e.bcc.length>0&&t("div",{class:"profiler-kv-row",children:[t("span",{children:"BCC"}),t("span",{style:{textAlign:"right"},children:e.bcc.join(", ")})]}),e.reply_to&&e.reply_to.length>0&&t("div",{class:"profiler-kv-row",children:[t("span",{children:"Reply-To"}),t("span",{style:{textAlign:"right"},children:e.reply_to.join(", ")})]}),e.template&&t("div",{class:"profiler-kv-row",children:[t("span",{children:"Template"}),t("code",{children:e.template})]}),e.parts&&e.parts.length>0&&t("div",{class:"profiler-kv-row",children:[t("span",{children:"Parts"}),t("span",{style:{textAlign:"right"},children:e.parts.join(", ")})]}),e.attachments&&e.attachments.length>0&&t("div",{class:"profiler-kv-row",children:[t("span",{children:"Attachments"}),t("span",{style:{textAlign:"right"},children:e.attachments.map(r=>`${r.filename} (${(r.size/1024).toFixed(1)} KB)`).join(", ")})]}),t("div",{class:"profiler-kv-row",children:[t("span",{children:"Render"}),t("span",{class:"profiler-query-card__duration",children:e.duration_ms!=null?`${e.duration_ms} ms`:"-"})]}),e.delivery_ms!=null&&t("div",{class:"profiler-kv-row",children:[t("span",{children:"Delivery"}),t("span",{class:"profiler-query-card__duration",children:[e.delivery_ms," ms"]})]}),e.message_id&&t("div",{class:"profiler-kv-row",children:[t("span",{children:"Message-ID"}),t("code",{style:{fontSize:"11px",wordBreak:"break-all",maxWidth:"70%",textAlign:"right"},children:e.message_id})]}),e.error&&t("div",{class:"profiler-kv-row",children:[t("span",{children:"Error"}),t("span",{class:"profiler-text--error",style:{textAlign:"right"},children:e.error})]}),e.assigns&&Object.keys(e.assigns).length>0&&t(ya,{assigns:e.assigns}),t(dc,{email:e})]})}function ha({email:e,onClick:r,isExpanded:s}){let o=["profiler-query-card",e.error?"profiler-query-card--slow":""].filter(Boolean).join(" ");return t("div",{class:o,style:{cursor:"pointer",marginBottom:"6px"},onClick:r,children:[t("div",{class:"profiler-query-card__header",children:[t("div",{class:"profiler-flex profiler-flex--gap-2",style:{minWidth:0,flex:1},children:t("span",{class:"profiler-text--sm",style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:[t("strong",{children:e.mailer_class}),t("span",{class:"profiler-text--muted",children:["#",e.action]}),e.subject&&t("span",{class:"profiler-text--muted",children:[" - ",e.subject.slice(0,60),e.subject.length>60?"\u2026":""]})]})}),t("div",{class:"profiler-flex profiler-flex--gap-2",style:{flexShrink:0},children:[e.delivery_mode&&t("span",{class:"badge-info profiler-text--xs",children:e.delivery_mode}),e.duration_ms!=null&&t("span",{class:"profiler-query-card__duration profiler-text--xs",children:[e.duration_ms," ms"]}),e.error?t("span",{class:"badge-error profiler-text--xs",children:"Error"}):t("span",{class:"badge-success profiler-text--xs",children:"Sent"}),t("span",{class:"profiler-text--muted profiler-text--xs",children:s?"\u25B2":"\u25BC"})]})]}),s&&t(fc,{email:e})]})}function mc({email:e}){return t("div",{class:"profiler-query-card",style:{marginBottom:"6px",borderLeft:"3px solid var(--profiler-info, #38bdf8)"},children:[t("div",{class:"profiler-query-card__header",children:[t("span",{class:"profiler-text--sm",children:[t("strong",{children:e.mailer_class}),t("span",{class:"profiler-text--muted",children:["#",e.action]})]}),t("div",{class:"profiler-flex profiler-flex--gap-2",style:{flexShrink:0},children:[t("span",{class:"badge-info profiler-text--xs",children:"queued"}),e.delivery_method&&t("span",{class:"badge-default profiler-text--xs",children:e.delivery_method}),e.duration_ms!=null&&t("span",{class:"profiler-query-card__duration profiler-text--xs",children:[e.duration_ms," ms"]})]})]}),e.assigns&&Object.keys(e.assigns).length>0&&t(ya,{assigns:e.assigns})]})}function Is({mailerData:e}){let[r,s]=x(null),[o,n]=x(null),i=e?.queued_count??0;if(!e||e.total===0&&i===0)return t("div",{class:"profiler-empty",children:t("p",{class:"profiler-empty__description",children:"No emails sent during this request"})});let a=f=>s(r===f?null:f),l=f=>n(o===f?null:f);return t(P,{children:[t("h2",{class:"profiler-section__header",children:"Mailer Deliveries"}),t("div",{class:"profiler-flex profiler-flex--gap-4 profiler-mb-4 profiler-text--sm",children:[t("span",{children:["Total: ",t("strong",{children:e.total})]}),e.deliver_now>0&&t("span",{children:["deliver_now: ",t("strong",{children:e.deliver_now})]}),e.deliver_later>0&&t("span",{children:["deliver_later: ",t("strong",{children:e.deliver_later})]}),i>0&&t("span",{children:["queued: ",t("strong",{children:i})]}),e.multi_part_count>0&&t("span",{children:["Multi-part: ",t("strong",{children:e.multi_part_count})]}),e.failed>0&&t("span",{children:["Errors: ",t("strong",{class:"profiler-text--error",children:e.failed})]})]}),e.loop_warnings.length>0&&t("div",{class:"profiler-alert-banner profiler-alert-banner--warning profiler-mb-4",children:[t("span",{class:"profiler-alert-banner__icon",children:"\u26A0\uFE0F"}),t("div",{style:{flex:1},children:[t("strong",{children:"Send loop detected"})," - ",e.loop_warnings.length," pattern",e.loop_warnings.length>1?"s":"",e.loop_warnings.map((f,p)=>t("div",{class:"profiler-text--xs profiler-text--muted profiler-mt-1",children:f.message},p))]})]}),e.truncated&&t("div",{class:"profiler-alert-banner profiler-alert-banner--warning profiler-mb-4",children:[t("span",{class:"profiler-alert-banner__icon",children:"\u26A0\uFE0F"}),t("span",{children:"Showing first 50 emails only - additional emails were truncated"})]}),e.emails.length>0&&t(P,{children:[t("h3",{class:"profiler-text--lg profiler-mt-4 profiler-mb-3",children:["Emails",t("span",{class:"profiler-text--muted profiler-text--sm",style:{fontWeight:"normal",marginLeft:"8px"},children:"click to expand"})]}),e.emails.map((f,p)=>t(ha,{email:f,onClick:()=>a(p),isExpanded:r===p},p))]}),e.queued&&e.queued.length>0&&t(P,{children:[t("h3",{class:"profiler-text--lg profiler-mt-4 profiler-mb-2",children:["Queued",t("span",{class:"profiler-text--muted profiler-text--sm",style:{fontWeight:"normal",marginLeft:"8px"},children:"deliver_later - will be sent in a background job"})]}),e.queued.map((f,p)=>t(mc,{email:f},`q-${p}`))]}),e.errors.length>0&&t(P,{children:[t("h3",{class:"profiler-text--lg profiler-mt-6 profiler-mb-3 profiler-text--error",children:"Delivery Errors"}),e.errors.map((f,p)=>t(ha,{email:f,onClick:()=>l(p),isExpanded:o===p},`err-${p}`))]})]})}function ga({profile:e,initialTab:r,embedded:s}){let o=e.collectors_data||{},n=(o.ajax?.total_requests??0)>0,i=(o.http?.total_requests??0)>0,a=!!o.exception?.exception_class,l=(o.logs?.count??0)>0,f=(o.routes?.total??0)>0,p=(o.i18n?.total??0)>0,h=(e.child_jobs?.length??0)>0,d=(o.mailer?.total??0)>0,[y,m]=x(a?"exception":r),g=_=>T=>{T.preventDefault(),m(_);let w=new URL(window.location.href);w.searchParams.set("tab",_),history.pushState(null,"",w.toString())},v=_=>`tab${y===_?" active":""}`;return t("div",{class:"container",children:[t("div",{class:"header",children:[t("h1",{children:t("a",{href:"/_profiler?section=http",children:[t("span",{class:"h1-emoji",children:"\u{1F4CA}"})," Profile Details"]})}),t("p",{children:[e.method," ",e.path]}),t("div",{class:"profiler-flex profiler-flex--gap-4 profiler-mt-2",children:[t("span",{children:["Duration: ",t("strong",{children:[e.duration.toFixed(2)," ms"]})]}),t("span",{children:["Status: ",t("strong",{children:e.status})]}),xe(e)!=null&&t("span",{title:rt,children:["Allocations: ",t("strong",{children:tt(xe(e))})]}),t("span",{style:"color:var(--profiler-text-muted)",children:new Date(e.started_at).toLocaleString("en",{hour12:!1,month:"short",day:"numeric",hour:"2-digit",minute:"2-digit",second:"2-digit"})}),e.gem_version&&t("span",{class:"profiler-version-badge",children:["v",e.gem_version]})]}),e.gem_version&&e.gem_version!==Ge()&&t("div",{class:"profiler-version-mismatch",children:["\u26A0\uFE0F Profil captur\xE9 avec la version ",t("strong",{children:e.gem_version})," - version actuelle : ",t("strong",{children:Ge()})]})]}),t("div",{class:"profiler-panel profiler-mb-6",children:[t("div",{class:"tabs",children:[a&&t("a",{href:"#",class:v("exception"),onClick:g("exception"),style:"color:var(--profiler-error,#ef4444);",children:"\u{1F4A5} Exception"}),t("a",{href:"#",class:v("request"),onClick:g("request"),children:"Request"}),t("a",{href:"#",class:v("dump"),onClick:g("dump"),children:"Dump"}),t("a",{href:"#",class:v("database"),onClick:g("database"),children:"Database"}),n&&t("a",{href:"#",class:v("ajax"),onClick:g("ajax"),children:"AJAX"}),i&&t("a",{href:"#",class:v("http"),onClick:g("http"),children:"Outbound HTTP"}),t("a",{href:"#",class:v("timeline"),onClick:g("timeline"),children:"Timeline"}),t("a",{href:"#",class:v("views"),onClick:g("views"),children:"Views"}),t("a",{href:"#",class:v("cache"),onClick:g("cache"),children:"Cache"}),l&&t("a",{href:"#",class:v("logs"),onClick:g("logs"),children:"Logs"}),f&&t("a",{href:"#",class:v("routes"),onClick:g("routes"),children:"Routes"}),p&&t("a",{href:"#",class:v("i18n"),onClick:g("i18n"),children:"I18n"}),h&&t("a",{href:"#",class:v("jobs"),onClick:g("jobs"),children:["Jobs (",e.child_jobs.length,")"]}),d&&t("a",{href:"#",class:v("mailer"),onClick:g("mailer"),children:"Mailers"}),t("a",{href:"#",class:v("env"),onClick:g("env"),children:"Env"})]}),t("div",{class:"profiler-p-4 tab-content active",children:[y==="exception"&&t(Qt,{exceptionData:o.exception}),y==="request"&&t(na,{profile:e}),y==="dump"&&t(Ft,{dumpData:o.dump}),y==="database"&&t(Mt,{dbData:o.database,token:e.token}),y==="ajax"&&t(pa,{ajaxData:o.ajax}),y==="http"&&t(Pr,{httpData:o.http}),y==="timeline"&&t(Ot,{flamegraphData:o.flamegraph,perfData:o.performance,functionProfileData:o.function_profile}),y==="views"&&t(ca,{viewData:o.view}),y==="cache"&&t(qt,{cacheData:o.cache}),y==="logs"&&t(Dt,{logData:o.logs}),y==="routes"&&t(fa,{routesData:o.routes}),y==="i18n"&&t(ma,{i18nData:o.i18n}),y==="jobs"&&t(js,{jobs:e.child_jobs}),y==="mailer"&&t(Is,{mailerData:o.mailer}),y==="env"&&t(st,{envData:o.env,readOnly:!0})]})]}),!s&&t("div",{class:"profiler-mt-6",children:t("a",{href:"/_profiler",style:"color: var(--profiler-accent);",children:"\u2190 Back to profiles"})})]})}function va({jobData:e}){if(!e)return t("div",{class:"profiler-empty",children:[t("div",{class:"profiler-empty__icon",children:"\u2699\uFE0F"}),t("h3",{class:"profiler-empty__title",children:"No job data"})]});let r=e.status==="completed";return t(P,{children:[t("h2",{class:"profiler-section__header",children:"Job Details"}),t("div",{class:"profiler-grid profiler-grid--2 profiler-mb-6",children:[t("div",{class:"profiler-panel profiler-panel--sm",children:[t("h3",{class:"profiler-text--sm profiler-text--muted profiler-text--uppercase profiler-mb-3",children:"Info"}),t("div",{class:"profiler-kv-row",children:[t("span",{class:"profiler-text--sm",children:"Class"}),t("strong",{class:"profiler-text--mono",children:e.job_class})]}),t("div",{class:"profiler-kv-row",children:[t("span",{class:"profiler-text--sm",children:"Job ID"}),t("span",{class:"profiler-text--xs profiler-text--mono profiler-text--muted",children:e.job_id})]}),t("div",{class:"profiler-kv-row",children:[t("span",{class:"profiler-text--sm",children:"Queue"}),t("span",{class:"profiler-text--mono",children:e.queue})]}),t("div",{class:"profiler-kv-row",children:[t("span",{class:"profiler-text--sm",children:"Executions"}),t("span",{children:e.executions})]}),t("div",{class:"profiler-kv-row",children:[t("span",{class:"profiler-text--sm",children:"Status"}),t("span",{class:`badge-${r?"success":"error"}`,children:r?"\u2713 Completed":"\u2717 Failed"})]})]}),e.arguments&&e.arguments.length>0&&t("div",{class:"profiler-panel profiler-panel--sm",children:[t("h3",{class:"profiler-text--sm profiler-text--muted profiler-text--uppercase profiler-mb-3",children:"Arguments"}),e.arguments.map((s,o)=>t("div",{class:"profiler-kv-row",children:[t("span",{class:"profiler-text--xs profiler-text--muted",children:["[",o,"]"]}),t("span",{class:"profiler-text--xs profiler-text--mono",style:"word-break:break-all",children:String(s)})]},o))]})]}),e.error&&t("div",{class:"profiler-panel profiler-panel--sm profiler-mb-4",style:"border-left: 3px solid var(--profiler-error, #ef4444)",children:[t("h3",{class:"profiler-text--sm profiler-text--muted profiler-text--uppercase profiler-mb-2",children:"Error"}),t("pre",{class:"profiler-code profiler-text--xs",style:"white-space:pre-wrap;word-break:break-all;margin:0",children:e.error})]})]})}function ba({profile:e,initialTab:r,embedded:s}){let o=e.collectors_data||{},n=o.http?.total_requests>0,i=(e.child_jobs?.length??0)>0,a=(o.dump?.count??0)>0,l=(o.logs?.total??0)>0,f=!!o.exception?.exception_class,p=(o.mailer?.total??0)>0,d=["job","database","cache","http","jobs","dump","logs","exception","env","timeline","mailer"].includes(r)?r:"job",[y,m]=x(f?"exception":d),g=o.job,v=g?.status==="failed",_=g?.status==="running",T=e.parent_profile,w=M=>K=>{K.preventDefault(),m(M);let I=new URL(window.location.href);I.searchParams.set("tab",M),history.pushState(null,"",I.toString())},S=M=>`tab${y===M?" active":""}`;return t("div",{class:"container",children:[t("div",{class:"header",children:[t("h1",{children:t("a",{href:"/_profiler?section=jobs",children:[t("span",{class:"h1-emoji",children:"\u2699\uFE0F"})," Job Profile"]})}),t("p",{children:e.path}),t("div",{class:"profiler-flex profiler-flex--gap-4 profiler-mt-2",children:[t("span",{children:["Duration: ",t("strong",{children:_?"running":`${e.duration.toFixed(2)} ms`})]}),t("span",{children:["Status: ",t("strong",{children:t("span",{class:`badge-${v?"error":_?"info":"success"}`,children:v?"Failed":_?"Running":"Completed"})})]}),xe(e)!=null&&t("span",{title:rt,children:["Allocations: ",t("strong",{children:tt(xe(e))})]}),e.gem_version&&t("span",{class:"profiler-version-badge",children:["v",e.gem_version]})]}),e.gem_version&&e.gem_version!==Ge()&&t("div",{class:"profiler-version-mismatch",children:["\u26A0\uFE0F Profil captur\xE9 avec la version ",t("strong",{children:e.gem_version})," - version actuelle : ",t("strong",{children:Ge()})]}),T&&t("div",{class:"profiler-flex profiler-flex--gap-2 profiler-mt-2 profiler-text--sm",children:[t("span",{style:"color:var(--profiler-text-muted)",children:"Triggered by:"}),T.profile_type==="http"?t("span",{children:[t("strong",{children:T.method})," ",T.path," \xB7 ",T.http_status," \xB7 ",T.duration?.toFixed(2)," ms"]}):t("span",{children:["\u2699\uFE0F ",t("strong",{children:T.path})," \xB7 ",T.duration?.toFixed(2)," ms"]}),t("a",{href:`/_profiler/profiles/${T.token}`,style:"color: var(--profiler-accent);",children:"View \u2192"})]})]}),t("div",{class:"profiler-panel profiler-mb-6",children:[t("div",{class:"tabs",children:[f&&t("a",{href:"#",class:S("exception"),onClick:w("exception"),style:"color:var(--profiler-error,#ef4444);",children:"\u{1F4A5} Exception"}),t("a",{href:"#",class:S("job"),onClick:w("job"),children:"Job"}),t("a",{href:"#",class:S("database"),onClick:w("database"),children:"Database"}),t("a",{href:"#",class:S("cache"),onClick:w("cache"),children:"Cache"}),n&&t("a",{href:"#",class:S("http"),onClick:w("http"),children:"Outbound HTTP"}),t("a",{href:"#",class:S("timeline"),onClick:w("timeline"),children:"Timeline"}),i&&t("a",{href:"#",class:S("jobs"),onClick:w("jobs"),children:["Jobs (",e.child_jobs.length,")"]}),a&&t("a",{href:"#",class:S("dump"),onClick:w("dump"),children:["Dumps (",o.dump.count,")"]}),l&&t("a",{href:"#",class:S("logs"),onClick:w("logs"),children:"Logs"}),p&&t("a",{href:"#",class:S("mailer"),onClick:w("mailer"),children:"Mailers"}),t("a",{href:"#",class:S("env"),onClick:w("env"),children:"Env"})]}),t("div",{class:"profiler-p-4 tab-content active",children:[y==="exception"&&t(Qt,{exceptionData:o.exception}),y==="job"&&t(va,{jobData:o.job}),y==="database"&&t(Mt,{dbData:o.database,token:e.token}),y==="cache"&&t(qt,{cacheData:o.cache}),y==="http"&&t(Pr,{httpData:o.http}),y==="timeline"&&t(Ot,{flamegraphData:o.flamegraph,perfData:o.performance,functionProfileData:o.function_profile}),y==="jobs"&&t(js,{jobs:e.child_jobs}),y==="dump"&&t(Ft,{dumpData:o.dump}),y==="logs"&&t(Dt,{logData:o.logs}),y==="mailer"&&t(Is,{mailerData:o.mailer}),y==="env"&&t(st,{envData:o.env,readOnly:!0})]})]}),!s&&t("div",{class:"profiler-mt-6",children:t("a",{href:"/_profiler",style:"color: var(--profiler-accent);",children:"\u2190 Back to profiles"})})]})}function xa({data:e}){return t("div",{class:"profiler-p-4",children:[t("div",{class:"profiler-mb-6",children:[t("h3",{class:"profiler-section-title profiler-mb-2",children:"Expression"}),t("pre",{class:"profiler-code-block profiler-code-block--full",children:e.expression})]}),e.return_value!==void 0&&t("div",{children:[t("h3",{class:"profiler-section-title profiler-mb-2",children:"Return value"}),t("pre",{class:"profiler-code-block profiler-code-block--full",children:e.return_value})]})]})}function _a({profile:e,initialTab:r,embedded:s}){let o=e.collectors_data||{},n=o.http?.total_requests>0,i=(o.dump?.count??0)>0,a=(o.logs?.total??0)>0,l=!!o.exception?.exception_class,f=o.console,h=["console","database","cache","http","dump","logs","exception","env","timeline"].includes(r)?r:"console",[d,y]=x(l?"exception":h),m=e.status===500,g=_=>T=>{T.preventDefault(),y(_);let w=new URL(window.location.href);w.searchParams.set("tab",_),history.pushState(null,"",w.toString())},v=_=>`tab${d===_?" active":""}`;return t("div",{class:"container",children:[t("div",{class:"header",children:[t("h1",{children:t("a",{href:"/_profiler?section=console",children:[t("span",{class:"h1-emoji",children:">_"})," Console Profile"]})}),t("p",{style:"font-family: monospace; word-break: break-all",children:e.path}),t("div",{class:"profiler-flex profiler-flex--gap-4 profiler-mt-2",children:[t("span",{children:["Duration: ",t("strong",{children:[e.duration.toFixed(2)," ms"]})]}),t("span",{children:["Status: ",t("strong",{children:t("span",{class:`badge-${m?"error":"success"}`,children:m?"Error":"OK"})})]}),xe(e)!=null&&t("span",{title:rt,children:["Allocations: ",t("strong",{children:tt(xe(e))})]}),e.gem_version&&t("span",{class:"profiler-version-badge",children:["v",e.gem_version]})]}),e.gem_version&&e.gem_version!==Ge()&&t("div",{class:"profiler-version-mismatch",children:["\u26A0\uFE0F Profil captur\xE9 avec la version ",t("strong",{children:e.gem_version})," - version actuelle : ",t("strong",{children:Ge()})]})]}),t("div",{class:"profiler-panel",children:[t("div",{class:"tabs",children:[t("a",{href:"#",class:v("console"),onClick:g("console"),children:"Console"}),t("a",{href:"#",class:v("database"),onClick:g("database"),children:"Database"}),t("a",{href:"#",class:v("cache"),onClick:g("cache"),children:"Cache"}),n&&t("a",{href:"#",class:v("http"),onClick:g("http"),children:"HTTP"}),i&&t("a",{href:"#",class:v("dump"),onClick:g("dump"),children:"Dumps"}),a&&t("a",{href:"#",class:v("logs"),onClick:g("logs"),children:"Logs"}),l&&t("a",{href:"#",class:v("exception"),onClick:g("exception"),children:"Exception"}),t("a",{href:"#",class:v("env"),onClick:g("env"),children:"Env"}),t("a",{href:"#",class:v("timeline"),onClick:g("timeline"),children:"Timeline"})]}),t("div",{class:"profiler-p-0 tab-content active",children:[d==="console"&&f&&t(xa,{data:f}),d==="database"&&t(Mt,{dbData:o.database,token:e.token}),d==="cache"&&t(qt,{cacheData:o.cache}),d==="http"&&n&&t(Pr,{httpData:o.http}),d==="dump"&&i&&t(Ft,{dumpData:o.dump}),d==="logs"&&a&&t(Dt,{logData:o.logs}),d==="exception"&&l&&t(Qt,{exceptionData:o.exception}),d==="env"&&t(st,{envData:o.env,readOnly:!0}),d==="timeline"&&t(Ot,{flamegraphData:o.flamegraph,perfData:o.performance,functionProfileData:o.function_profile})]})]}),!s&&t("div",{class:"profiler-mt-6",children:t("a",{href:"/_profiler",style:"color: var(--profiler-accent);",children:"\u2190 Back to profiles"})})]})}function hc(e){return e==="passed"?t("span",{class:"badge-success",children:"\u2713 Passed"}):e==="failed"?t("span",{class:"badge-error",children:"\u2717 Failed"}):e==="pending"?t("span",{class:"badge-warning",children:"\u23F8 Pending"}):t("span",{class:"badge-default",children:e})}function Ta({testData:e}){return t("div",{children:t("table",{class:"profiler-detail-table",children:t("tbody",{children:[t("tr",{children:[t("th",{children:"Test Name"}),t("td",{style:"word-break: break-word",children:e.test_name})]}),t("tr",{children:[t("th",{children:"Status"}),t("td",{children:hc(e.status)})]}),t("tr",{children:[t("th",{children:"File"}),t("td",{class:"profiler-text--mono profiler-text--xs",children:[e.test_file,":",e.test_line]})]}),t("tr",{children:[t("th",{children:"Framework"}),t("td",{class:"profiler-text--mono profiler-text--xs",children:e.framework})]}),e.assertions!=null&&t("tr",{children:[t("th",{children:"Assertions"}),t("td",{children:e.assertions})]}),e.skip_reason&&t("tr",{children:[t("th",{children:"Skip reason"}),t("td",{class:"profiler-text--xs profiler-text--muted",children:e.skip_reason})]}),e.exception_message&&t("tr",{children:[t("th",{children:"Exception"}),t("td",{children:t("pre",{class:"profiler-text--xs",style:"white-space: pre-wrap; color: var(--profiler-error, #ef4444)",children:e.exception_message})})]})]})})})}function wa({profile:e,initialTab:r,embedded:s}){let o=e.collectors_data||{},n=(o.dump?.count??0)>0,i=(o.logs?.total??0)>0,a=!!o.exception?.exception_class,l=o.test,p=["test","database","cache","dump","logs","exception","env","timeline"].includes(r)?r:"test",[h,d]=x(a?"exception":p),y=e.status===500,m=l?.status||(y?"failed":"passed"),g=_=>T=>{T.preventDefault(),d(_);let w=new URL(window.location.href);w.searchParams.set("tab",_),history.pushState(null,"",w.toString())},v=_=>`tab${h===_?" active":""}`;return t("div",{class:"container",children:[t("div",{class:"header",children:[t("h1",{children:t("a",{href:"/_profiler?section=tests",children:[t("span",{class:"h1-emoji",children:"\u{1F9EA}"})," Test Profile"]})}),t("p",{style:"word-break: break-word",children:l?.test_name||e.path}),t("div",{class:"profiler-flex profiler-flex--gap-4 profiler-mt-2",children:[t("span",{children:["Duration: ",t("strong",{children:[e.duration.toFixed(2)," ms"]})]}),t("span",{children:["Status: ",t("strong",{children:t("span",{class:`badge-${y?"error":m==="pending"?"warning":"success"}`,children:m==="failed"?"\u2717 Failed":m==="pending"?"\u23F8 Pending":"\u2713 Passed"})})]}),xe(e)!=null&&t("span",{title:rt,children:["Allocations: ",t("strong",{children:tt(xe(e))})]})]}),l?.test_file&&t("div",{class:"profiler-text--xs profiler-text--muted profiler-mt-2",children:[t("span",{class:"profiler-text--mono",children:[l.test_file,":",l.test_line]}),t("span",{style:"margin-left: 8px",children:["\xB7 ",l.framework]})]})]}),t("div",{class:"profiler-panel profiler-mb-6",children:[t("div",{class:"tabs",children:[a&&t("a",{href:"#",class:v("exception"),onClick:g("exception"),style:"color:var(--profiler-error,#ef4444);",children:"\u{1F4A5} Exception"}),t("a",{href:"#",class:v("test"),onClick:g("test"),children:"Test"}),t("a",{href:"#",class:v("database"),onClick:g("database"),children:"Database"}),t("a",{href:"#",class:v("cache"),onClick:g("cache"),children:"Cache"}),t("a",{href:"#",class:v("timeline"),onClick:g("timeline"),children:"Timeline"}),n&&t("a",{href:"#",class:v("dump"),onClick:g("dump"),children:["Dumps (",o.dump.count,")"]}),i&&t("a",{href:"#",class:v("logs"),onClick:g("logs"),children:"Logs"}),t("a",{href:"#",class:v("env"),onClick:g("env"),children:"Env"})]}),t("div",{class:"profiler-p-4 tab-content active",children:[h==="test"&&l&&t(Ta,{testData:l}),h==="database"&&t(Mt,{dbData:o.database,token:e.token}),h==="cache"&&t(qt,{cacheData:o.cache}),h==="timeline"&&t(Ot,{flamegraphData:o.flamegraph,perfData:o.performance,functionProfileData:o.function_profile}),h==="dump"&&n&&t(Ft,{dumpData:o.dump}),h==="logs"&&i&&t(Dt,{logData:o.logs}),h==="exception"&&a&&t(Qt,{exceptionData:o.exception}),h==="env"&&t(st,{envData:o.env})]})]})]})}var yc="/_profiler";function Ea(){return t("div",{class:"container",children:[t("div",{class:"header",children:[t("h1",{children:[t("a",{href:yc,children:t("span",{class:"h1-emoji",children:"\u{1F50D}"})})," ",t("span",{class:"h1-emoji",children:"\u{1F9EA}"})," Test Runner"]}),t("p",{children:"Run tests from the profiler and capture a performance profile for each test."})]}),t("div",{class:"profiler-panel profiler-mb-6",children:t("div",{class:"profiler-p-4",children:t(Us,{})})})]})}function Ca(e){console.log("Initializing profiler timeline");let r=e.dataset.token;if(!r){console.error("No profile token found");return}gc(r).then(s=>{vc(e,s)})}async function gc(e){return(await(await fetch(`/_profiler/profiles/${e}/timeline`)).json()).events||[]}function vc(e,r){if(!r.length){e.innerHTML="<p>No timeline events recorded</p>";return}let s=bc(r);e.appendChild(s)}function bc(e){let s=e.length*40+40,o=document.createElementNS("http://www.w3.org/2000/svg","svg");o.setAttribute("width","1200"),o.setAttribute("height",s.toString()),o.style.cssText="background: #1e1e1e; border-radius: 4px;";let n=Math.min(...e.map(f=>f.started_at)),l=1100/(Math.max(...e.map(f=>f.finished_at))-n);return e.forEach((f,p)=>{let h=p*40+20,d=(f.started_at-n)*l+50,y=f.duration*l,m=document.createElementNS("http://www.w3.org/2000/svg","rect");m.setAttribute("x",d.toString()),m.setAttribute("y",h.toString()),m.setAttribute("width",Math.max(y,2).toString()),m.setAttribute("height","20"),m.setAttribute("fill",xc(f.name)),m.setAttribute("rx","2");let g=document.createElementNS("http://www.w3.org/2000/svg","title");g.textContent=`${f.name}
14
+ Duration: ${f.duration.toFixed(2)}ms`,m.appendChild(g),o.appendChild(m);let v=document.createElementNS("http://www.w3.org/2000/svg","text");v.setAttribute("x","5"),v.setAttribute("y",(h+15).toString()),v.setAttribute("fill","#d4d4d4"),v.setAttribute("font-size","11"),v.textContent=f.name.substring(0,40),o.appendChild(v)}),o}function xc(e){return e.includes("Controller")?"#569cd6":e.includes("Render")?"#4ec9b0":e.includes("Partial")?"#ce9178":"#dcdcaa"}var $o=new Map;function Ra(e){try{return localStorage.getItem(e)}catch{return $o.has(e)?$o.get(e):null}}function ka(e,r){$o.set(e,r);try{localStorage.setItem(e,r)}catch{}}var Go="profiler-theme",_c="data-theme",Bo=class{constructor(){this.systemPreference=window.matchMedia("(prefers-color-scheme: dark)"),this.currentTheme=this.loadTheme(),this.init()}init(){this.applyTheme(this.currentTheme),this.systemPreference.addEventListener("change",r=>{this.currentTheme==="auto"&&this.applyTheme("auto")}),window.addEventListener("storage",r=>{r.key===Go&&r.newValue&&(this.currentTheme=r.newValue,this.applyTheme(this.currentTheme))})}loadTheme(){return Ra(Go)||"auto"}saveTheme(r){ka(Go,r)}applyTheme(r){let s=this.resolveTheme(r);document.documentElement.setAttribute(_c,s),window.dispatchEvent(new CustomEvent("profiler:theme-change",{detail:{theme:s}}))}resolveTheme(r){return r==="auto"?this.systemPreference.matches?"dark":"light":r}getTheme(){return this.currentTheme}getResolvedTheme(){return this.resolveTheme(this.currentTheme)}setTheme(r){this.currentTheme=r,this.saveTheme(r),this.applyTheme(r)}toggle(){let s=this.getResolvedTheme()==="dark"?"light":"dark";this.setTheme(s)}},zo=new Bo;function Tc(){zo.toggle()}function Jo(){return zo.getResolvedTheme()}function wc(){let e=document.createElementNS("http://www.w3.org/2000/svg","svg");e.setAttribute("viewBox","0 0 24 24"),e.setAttribute("fill","none");let r=document.createElementNS("http://www.w3.org/2000/svg","path");return r.setAttribute("d","M12 3v1m0 16v1m9-9h-1M4 12H3m15.364 6.364l-.707-.707M6.343 6.343l-.707-.707m12.728 0l-.707.707M6.343 17.657l-.707.707M16 12a4 4 0 11-8 0 4 4 0 018 0z"),r.setAttribute("stroke","currentColor"),r.setAttribute("stroke-width","2"),r.setAttribute("stroke-linecap","round"),r.setAttribute("stroke-linejoin","round"),e.appendChild(r),e}function Ec(){let e=document.createElementNS("http://www.w3.org/2000/svg","svg");e.setAttribute("viewBox","0 0 24 24"),e.setAttribute("fill","none");let r=document.createElementNS("http://www.w3.org/2000/svg","path");return r.setAttribute("d","M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z"),r.setAttribute("stroke","currentColor"),r.setAttribute("stroke-width","2"),r.setAttribute("stroke-linecap","round"),r.setAttribute("stroke-linejoin","round"),e.appendChild(r),e}function Sa(){let e=document.createElement("button");e.className="profiler-theme-toggle",e.setAttribute("aria-label","Toggle theme"),e.title="Toggle light/dark mode";let r=()=>{let s=Jo();for(;e.firstChild;)e.removeChild(e.firstChild);let o=s==="dark"?wc():Ec();e.appendChild(o)};return r(),window.addEventListener("profiler:theme-change",r),e.addEventListener("click",()=>{Tc()}),e}document.readyState==="loading"?document.addEventListener("DOMContentLoaded",()=>{console.log("\u{1F3A8} Theme system initialized:",Jo())}):console.log("\u{1F3A8} Theme system initialized:",Jo());var Vs=new Eo({defaultOptions:{queries:{staleTime:3e4,retry:1}}});document.addEventListener("DOMContentLoaded",()=>{let e=document.getElementById("profiler-cluster-selector"),r=document.querySelector('meta[name="profiler-is-master"]')?.getAttribute("content")==="true";e&&r&&Ur(t(Cr,{client:Vs,children:t(oa,{})}),e);let s=document.getElementById("profiler-index");s&&Ur(t(Cr,{client:Vs,children:t(sa,{})}),s);let o=document.getElementById("profiler-show");if(o){let a=document.getElementById("profiler-show-data");if(a){let l=JSON.parse(a.textContent),f=new URLSearchParams(location.search).get("tab")||"request",p=o.dataset.embedded==="true",h;l.profile_type==="job"?h=t(ba,{profile:l,initialTab:f,embedded:p}):l.profile_type==="console"?h=t(_a,{profile:l,initialTab:f,embedded:p}):l.profile_type==="test"?h=t(wa,{profile:l,initialTab:f,embedded:p}):h=t(ga,{profile:l,initialTab:f,embedded:p}),Ur(t(Cr,{client:Vs,children:h}),o)}}let n=document.getElementById("profiler-test-runner");if(n&&Ur(t(Cr,{client:Vs,children:t(Ea,{})}),n),!s&&!o&&!n){let a=document.querySelector(".header, .profiler-detail");if(a){let l=Sa();l.style.position="absolute",l.style.top="20px",l.style.right="20px",a.style.position="relative",a.appendChild(l)}}let i=document.getElementById("profiler-timeline");i&&Ca(i)});})();