rails-profiler 0.41.0 → 0.43.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,14 +1,15 @@
1
- "use strict";(()=>{var an=e=>{throw TypeError(e)};var Xs=(e,r,s)=>r.has(e)||an("Cannot "+s);var c=(e,r,s)=>(Xs(e,r,"read from private field"),s?s.call(e):r.get(e)),k=(e,r,s)=>r.has(e)?an("Cannot add the same private member more than once"):r instanceof WeakSet?r.add(e):r.set(e,s),E=(e,r,s,o)=>(Xs(e,r,"write to private field"),o?o.call(e,s):r.set(e,s),s),L=(e,r,s)=>(Xs(e,r,"access private method"),s);var jr=(e,r,s,o)=>({set _(n){E(e,r,n,s)},get _(){return c(e,r,o)}});var Cs,X,pn,sl,xt,ln,dn,fn,mn,so,Ys,eo,hn,Ts={},ws=[],ol=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,Rs=Array.isArray;function ct(e,r){for(var s in r)e[s]=r[s];return e}function oo(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function nl(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?Cs.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 xs(e,a,o,n,null)}function xs(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??++pn,__i:-1,__u:0};return n==null&&X.vnode!=null&&X.vnode(i),i}function S(e){return e.children}function _s(e,r){this.props=e,this.context=r}function ur(e,r){if(r==null)return e.__?ur(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"?ur(e):null}function il(e){if(e.__P&&e.__d){var r=e.__v,s=r.__e,o=[],n=[],i=ct({},r);i.__v=r.__v+1,X.vnode&&X.vnode(i),no(e.__P,i,r,e.__n,e.__P.namespaceURI,32&r.__u?[s]:null,o,s??ur(r),!!(32&r.__u),n),i.__v=r.__v,i.__.__k[i.__i]=i,bn(o,i,n),r.__e=r.__=null,i.__e!=s&&yn(i)}}function yn(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}),yn(e)}function to(e){(!e.__d&&(e.__d=!0)&&xt.push(e)&&!Es.__r++||ln!=X.debounceRendering)&&((ln=X.debounceRendering)||dn)(Es)}function Es(){try{for(var e,r=1;xt.length;)xt.length>r&&xt.sort(fn),e=xt.shift(),r=xt.length,il(e)}finally{xt.length=Es.__r=0}}function gn(e,r,s,o,n,i,a,l,f,p,h){var d,y,m,g,v,_,T,w=o&&o.__k||ws,P=r.length;for(f=al(s,r,w,f,P),d=0;d<P;d++)(m=s.__k[d])!=null&&(y=m.__i!=-1&&w[m.__i]||Ts,m.__i=d,_=no(e,m,y,n,i,a,l,f,p,h),g=m.__e,m.ref&&y.ref!=m.ref&&(y.ref&&io(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=vn(m,f,e,T):typeof m.type=="function"&&_!==void 0?f=_:g&&(f=g.nextSibling),m.__u&=-7);return s.__e=v,f}function al(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]=xs(null,a,null,null,null):Rs(a)?a=e.__k[i]=xs(S,{children:a},null,null,null):a.constructor===void 0&&a.__b>0?a=e.__k[i]=xs(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=ll(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=ur(l)),_n(l,l));return o}function vn(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=vn(n[i],r,s,o));return r}e.__e!=r&&(o&&(r&&e.type&&!r.parentNode&&(r=ur(e)),s.insertBefore(e.__e,r||null)),r=e.__e);do r=r&&r.nextSibling;while(r!=null&&r.nodeType==8);return r}function ll(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 un(e,r,s){r[0]=="-"?e.setProperty(r,s??""):e[r]=s==null?"":typeof s!="number"||ol.test(r)?s:s+"px"}function bs(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||un(e.style,r,"");if(s)for(r in s)o&&s[r]==o[r]||un(e.style,r,s[r])}else if(r[0]=="o"&&r[1]=="n")i=r!=(r=r.replace(mn,"$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=so,e.addEventListener(r,i?eo:Ys,i)):e.removeEventListener(r,i?eo:Ys,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 cn(e){return function(r){if(this.l){var s=this.l[r.type+e];if(r.t==null)r.t=so++;else if(r.t<s.u)return;return s(X.event?X.event(r):r)}}}function no(e,r,s,o,n,i,a,l,f,p){var h,d,y,m,g,v,_,T,w,P,M,K,j,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,P=(h=D.contextType)&&o[h.__c],M=h?P?P.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 _s(T,M),d.constructor=D,d.render=cl),P&&P.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=ct({},d.__s)),ct(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)}),ws.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,j=0,w)d.state=d.__s,d.__d=!1,K&&K(r),h=d.render(d.props,d.state,d.context),ws.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&&++j<25);d.state=d.__s,d.getChildContext!=null&&(o=ct(ct({},o),d.getChildContext())),w&&!y&&d.getSnapshotBeforeUpdate!=null&&(v=d.getSnapshotBeforeUpdate(m,g)),oe=h!=null&&h.type===S&&h.key==null?xn(h.props.children):h,l=gn(e,Rs(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--;)oo(i[N]);ro(r)}else r.__e=s.__e,r.__k=s.__k,O.then||ro(r);X.__e(O,r,s)}else i==null&&r.__v==s.__v?(r.__k=s.__k,r.__e=s.__e):l=r.__e=ul(s.__e,r,s,o,n,i,a,f,p);return(h=X.diffed)&&h(r),128&r.__u?void 0:l}function ro(e){e&&(e.__c&&(e.__c.__e=!0),e.__k&&e.__k.some(ro))}function bn(e,r,s){for(var o=0;o<s.length;o++)io(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 xn(e){return typeof e!="object"||e==null||e.__b>0?e:Rs(e)?e.map(xn):ct({},e)}function ul(e,r,s,o,n,i,a,l,f){var p,h,d,y,m,g,v,_=s.props||Ts,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&&Cs.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||bs(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||bs(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=""),gn(r.type=="template"?e.content:e,Rs(y)?y:[y],r,s,o,w=="foreignObject"?"http://www.w3.org/1999/xhtml":n,i,a,i?i[0]:s.__k&&ur(s,0),l,f),i!=null)for(p=i.length;p--;)oo(i[p]);l||(p="value",w=="progress"&&g==null?e.removeAttribute("value"):g!=null&&(g!==e[p]||w=="progress"&&!g||w=="option"&&g!=_[p])&&bs(e,p,g,_[p],n),p="checked",v!=null&&v!=e[p]&&bs(e,p,v,_[p],n))}return e}function io(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 _n(e,r,s){var o,n;if(X.unmount&&X.unmount(e),(o=e.ref)&&(o.current&&o.current!=e.__e||io(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]&&_n(o[n],r,s||typeof e.type!="function");s||oo(e.__e),e.__c=e.__=e.__e=void 0}function cl(e,r,s){return this.constructor(e,s)}function Vr(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=[],no(r,e=(!o&&s||r).__k=nl(S,null,[e]),n||Ts,Ts,r.namespaceURI,!o&&s?[s]:n?null:r.firstChild?Cs.call(r.childNodes):null,i,!o&&s?s:n?n.__e:r.firstChild,o,a),bn(i,e,a)}function cr(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,to(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"+hn++,r.__=e,r.Provider=r.__l=(r.Consumer=function(s,o){return s.children(o)}).contextType=r,r}Cs=ws.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}},pn=0,sl=function(e){return e!=null&&e.constructor===void 0},_s.prototype.setState=function(e,r){var s;s=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=ct({},this.state),typeof e=="function"&&(e=e(ct({},s),this.props)),e&&ct(s,e),e!=null&&this.__v&&(r&&this._sb.push(r),to(this))},_s.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),to(this))},_s.prototype.render=S,xt=[],dn=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,fn=function(e,r){return e.__v.__b-r.__v.__b},Es.__r=0,mn=/(PointerCapture)$|Capture$/i,so=0,Ys=cn(!1),eo=cn(!0),hn=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 jt,_t,pr,Tn,pl=(Tn=class extends Qe{constructor(){super();k(this,jt);k(this,_t);k(this,pr);E(this,pr,r=>{if(typeof window<"u"&&window.addEventListener){let s=()=>r();return window.addEventListener("visibilitychange",s,!1),()=>{window.removeEventListener("visibilitychange",s)}}})}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(o=>{typeof o=="boolean"?this.setFocused(o):this.onFocus()}))}setFocused(r){c(this,jt)!==r&&(E(this,jt,r),this.onFocus())}onFocus(){let r=this.isFocused();this.listeners.forEach(s=>{s(r)})}isFocused(){return typeof c(this,jt)=="boolean"?c(this,jt):globalThis.document?.visibilityState!=="hidden"}},jt=new WeakMap,_t=new WeakMap,pr=new WeakMap,Tn),dr=new pl;var dl={setTimeout:(e,r)=>setTimeout(e,r),clearTimeout:e=>clearTimeout(e),setInterval:(e,r)=>setInterval(e,r),clearInterval:e=>clearInterval(e)},Tt,ao,wn,fl=(wn=class{constructor(){k(this,Tt,dl);k(this,ao,!1)}setTimeoutProvider(e){E(this,Tt,e)}setTimeout(e,r){return c(this,Tt).setTimeout(e,r)}clearTimeout(e){c(this,Tt).clearTimeout(e)}setInterval(e,r){return c(this,Tt).setInterval(e,r)}clearInterval(e){c(this,Tt).clearInterval(e)}},Tt=new WeakMap,ao=new WeakMap,wn),ze=new fl;function En(e){setTimeout(e,0)}var uo=typeof window>"u"||"Deno"in globalThis;function ne(){}function kn(e,r){return typeof e=="function"?e(r):e}function Hr(e){return typeof e=="number"&&e>=0&&e!==1/0}function ks(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 Ss(e,r){let{type:s="all",exact:o,fetchStatus:n,predicate:i,queryKey:a,stale:l}=e;if(a){if(o){if(r.queryHash!==$r(a,r.options))return!1}else if(!Vt(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 Ps(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(!Vt(r.options.mutationKey,i))return!1}return!(o&&r.state.status!==o||n&&!n(r))}function $r(e,r){return(r?.queryKeyHashFn||We)(e)}function We(e){return JSON.stringify(e,(r,s)=>lo(s)?Object.keys(s).sort().reduce((o,n)=>(o[n]=s[n],o),{}):s)}function Vt(e,r){return e===r?!0:typeof e!=typeof r?!1:e&&r&&typeof e=="object"&&typeof r=="object"?Object.keys(r).every(s=>Vt(e[s],r[s])):!1}var ml=Object.prototype.hasOwnProperty;function co(e,r,s=0){if(e===r)return e;if(s>500)return r;let o=Cn(e)&&Cn(r);if(!o&&!(lo(e)&&lo(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:ml.call(e,d))&&p++;continue}if(y===null||m===null||typeof y!="object"||typeof m!="object"){f[d]=m;continue}let g=co(y,m,s+1);f[d]=g,g===y&&p++}return i===l&&p===i?e:f}function fr(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 Cn(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function lo(e){if(!Rn(e))return!1;let r=e.constructor;if(r===void 0)return!0;let s=r.prototype;return!(!Rn(s)||!s.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function Rn(e){return Object.prototype.toString.call(e)==="[object Object]"}function Sn(e){return new Promise(r=>{ze.setTimeout(r,e)})}function Gr(e,r,s){return typeof s.structuralSharing=="function"?s.structuralSharing(e,r):s.structuralSharing!==!1?co(e,r):r}function Pn(e,r,s=0){let o=[...e,r];return s&&o.length>s?o.slice(1):o}function An(e,r,s=0){let o=[r,...e];return s&&o.length>s?o.slice(0,-1):o}var mr=Symbol();function As(e,r){return!e.queryFn&&r?.initialPromise?()=>r.initialPromise:!e.queryFn||e.queryFn===mr?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function Br(e,r){return typeof e=="function"?e(...r):!!e}function Mn(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=()=>uo;return{isServer(){return e()},setIsServer(r){e=r}}})();function Jr(){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 Fn=En;function hl(){let e=[],r=0,s=l=>{l()},o=l=>{l()},n=Fn,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=hl();var hr,wt,yr,On,yl=(On=class extends Qe{constructor(){super();k(this,hr,!0);k(this,wt);k(this,yr);E(this,yr,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,wt)||this.setEventListener(c(this,yr))}onUnsubscribe(){var r;this.hasListeners()||((r=c(this,wt))==null||r.call(this),E(this,wt,void 0))}setEventListener(r){var s;E(this,yr,r),(s=c(this,wt))==null||s.call(this),E(this,wt,r(this.setOnline.bind(this)))}setOnline(r){c(this,hr)!==r&&(E(this,hr,r),this.listeners.forEach(o=>{o(r)}))}isOnline(){return c(this,hr)}},hr=new WeakMap,wt=new WeakMap,yr=new WeakMap,On),gr=new yl;function gl(e){return Math.min(1e3*2**e,3e4)}function po(e){return(e??"online")==="online"?gr.isOnline():!0}var Ms=class extends Error{constructor(e){super("CancelledError"),this.revert=e?.revert,this.silent=e?.silent}};function Fs(e){let r=!1,s=0,o,n=Jr(),i=()=>n.status!=="pending",a=v=>{if(!i()){let _=new Ms(v);y(_),e.onCancel?.(_)}},l=()=>{r=!0},f=()=>{r=!1},p=()=>dr.isFocused()&&(e.networkMode==="always"||gr.isOnline())&&e.canRun(),h=()=>po(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),P=e.retryDelay??gl,M=typeof P=="function"?P(s,T):P,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),Sn(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 Ht,qn,Os=(qn=class{constructor(){k(this,Ht)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),Hr(this.gcTime)&&E(this,Ht,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,Ht)!==void 0&&(ze.clearTimeout(c(this,Ht)),E(this,Ht,void 0))}},Ht=new WeakMap,qn);function Dn(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=>{Mn(g,()=>r.signal,()=>h=!0)},y=As(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 j={client:r.client,queryKey:r.queryKey,pageParam:v,direction:_?"backward":"forward",meta:r.options.meta};return d(j),j})(),P=await y(w),{maxPages:M}=r.options,K=_?An:Pn;return{pages:K(g.pages,P,M),pageParams:K(g.pageParams,v,M)}};if(n&&i.length){let g=n==="backward",v=g?Qn:fo,_={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:fo(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 fo(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 Qn(e,{pages:r,pageParams:s}){return r.length>0?e.getPreviousPageParam?.(r[0],r,s[0],s):void 0}function Ln(e,r){return r?fo(e,r)!=null:!1}function Kn(e,r){return!r||!e.getPreviousPageParam?!1:Qn(e,r)!=null}var vr,$t,br,Le,Gt,pe,zr,Bt,Oe,Vn,pt,In,jn=(In=class extends Os{constructor(r){super();k(this,Oe);k(this,vr);k(this,$t);k(this,br);k(this,Le);k(this,Gt);k(this,pe);k(this,zr);k(this,Bt);E(this,Bt,!1),E(this,zr,r.defaultOptions),this.setOptions(r.options),this.observers=[],E(this,Gt,r.client),E(this,Le,c(this,Gt).getQueryCache()),this.queryKey=r.queryKey,this.queryHash=r.queryHash,E(this,$t,Nn(this.options)),this.state=r.state??c(this,$t),this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return c(this,vr)}get promise(){return c(this,pe)?.promise}setOptions(r){if(this.options={...c(this,zr),...r},r?._type&&E(this,vr,r._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){let s=Nn(this.options);s.data!==void 0&&(this.setState(Un(s.data,s.dataUpdatedAt)),E(this,$t,s))}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&c(this,Le).remove(this)}setData(r,s){let o=Gr(this.state.data,r,this.options);return L(this,Oe,pt).call(this,{data:o,type:"success",dataUpdatedAt:s?.updatedAt,manual:s?.manual}),o}setState(r){L(this,Oe,pt).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,$t)}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===mr||!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:!ks(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,Bt)||L(this,Oe,Vn).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,pt).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,Bt,!0),o.signal)})},i=()=>{let p=As(this.options,s),d=(()=>{let y={client:c(this,Gt),queryKey:this.queryKey,meta:this.meta};return n(y),y})();return E(this,Bt,!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,Gt),state:this.state,fetchFn:i};return n(p),p})();(c(this,vr)==="infinite"?Dn(this.options.pages):this.options.behavior)?.onFetch(l,this),E(this,br,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==l.fetchOptions?.meta)&&L(this,Oe,pt).call(this,{type:"fetch",meta:l.fetchOptions?.meta}),E(this,pe,Fs({initialPromise:s?.initialPromise,fn:l.fetchFn,onCancel:p=>{p instanceof Ms&&p.revert&&this.setState({...c(this,br),fetchStatus:"idle"}),o.abort()},onFail:(p,h)=>{L(this,Oe,pt).call(this,{type:"failed",failureCount:p,error:h})},onPause:()=>{L(this,Oe,pt).call(this,{type:"pause"})},onContinue:()=>{L(this,Oe,pt).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 Ms){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,pt).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()}}},vr=new WeakMap,$t=new WeakMap,br=new WeakMap,Le=new WeakMap,Gt=new WeakMap,pe=new WeakMap,zr=new WeakMap,Bt=new WeakMap,Oe=new WeakSet,Vn=function(){return this.state.fetchStatus==="paused"&&this.state.status==="pending"},pt=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,...mo(o.data,this.options),fetchMeta:r.meta??null};case"success":let n={...o,...Un(r.data,r.dataUpdatedAt),dataUpdateCount:o.dataUpdateCount+1,...!r.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return E(this,br,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})})},In);function mo(e,r){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:po(r.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function Un(e,r){return{data:e,dataUpdatedAt:r??Date.now(),error:null,isInvalidated:!1,status:"success"}}function Nn(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,Zr,Ce,Jt,xr,dt,Et,Xr,_r,Tr,zt,Wt,Ct,wr,W,Wr,ho,yo,go,vo,bo,xo,_o,Bn,Gn,Yr=(Gn=class extends Qe{constructor(r,s){super();k(this,W);k(this,ke);k(this,G);k(this,Zr);k(this,Ce);k(this,Jt);k(this,xr);k(this,dt);k(this,Et);k(this,Xr);k(this,_r);k(this,Tr);k(this,zt);k(this,Wt);k(this,Ct);k(this,wr,new Set);this.options=s,E(this,ke,r),E(this,Et,null),E(this,dt,Jr()),this.bindMethods(),this.setOptions(s)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(c(this,G).addObserver(this),Hn(c(this,G),this.options)?L(this,W,Wr).call(this):this.updateResult(),L(this,W,vo).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return To(c(this,G),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return To(c(this,G),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,L(this,W,bo).call(this),L(this,W,xo).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,_o).call(this),c(this,G).setOptions(this.options),s._defaulted&&!fr(this.options,s)&&c(this,ke).getQueryCache().notify({type:"observerOptionsUpdated",query:c(this,G),observer:this});let n=this.hasListeners();n&&$n(c(this,G),o,this.options,s)&&L(this,W,Wr).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,ho).call(this);let i=L(this,W,yo).call(this);n&&(c(this,G)!==o||Ee(this.options.enabled,c(this,G))!==Ee(s.enabled,c(this,G))||i!==c(this,Ct))&&L(this,W,go).call(this,i)}getOptimisticResult(r){let s=c(this,ke).getQueryCache().build(c(this,ke),r),o=this.createResult(s,r);return bl(this,o)&&(E(this,Ce,o),E(this,xr,this.options),E(this,Jt,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,dt).status==="pending"&&c(this,dt).reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(o,n))})}trackProp(r){c(this,wr).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,Wr).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,Jt),l=c(this,xr),p=r!==o?r.state:c(this,Zr),{state:h}=r,d={...h},y=!1,m;if(s._optimisticResults){let D=this.hasListeners(),O=!D&&Hn(r,s),U=D&&$n(r,o,s,n);(O||U)&&(d={...d,...mo(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,Tr)?.state.data,c(this,Tr)):s.placeholderData,D!==void 0&&(_="success",m=Gr(i?.data,D,s),y=!0)}if(s.select&&m!==void 0&&!T)if(i&&m===a?.data&&s.select===c(this,Xr))m=c(this,_r);else try{E(this,Xr,s.select),m=s.select(m),m=Gr(i?.data,m,s),E(this,_r,m),E(this,Et,null)}catch(D){E(this,Et,D)}c(this,Et)&&(g=c(this,Et),m=c(this,_r),v=Date.now(),_="error");let w=d.fetchStatus==="fetching",P=_==="pending",M=_==="error",K=P&&w,j=m!==void 0,N={status:_,fetchStatus:d.fetchStatus,isPending:P,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&&!P,isLoadingError:M&&!j,isPaused:d.fetchStatus==="paused",isPlaceholderData:y,isRefetchError:M&&j,isStale:wo(r,s),refetch:this.refetch,promise:c(this,dt),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,dt,N.promise=Jr());U(le)},H=c(this,dt);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,Jt,c(this,G).state),E(this,xr,this.options),c(this,Jt).data!==void 0&&E(this,Tr,c(this,G)),fr(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,wr).size)return!0;let a=new Set(i??c(this,wr));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,Bn).call(this,{listeners:o()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&L(this,W,vo).call(this)}},ke=new WeakMap,G=new WeakMap,Zr=new WeakMap,Ce=new WeakMap,Jt=new WeakMap,xr=new WeakMap,dt=new WeakMap,Et=new WeakMap,Xr=new WeakMap,_r=new WeakMap,Tr=new WeakMap,zt=new WeakMap,Wt=new WeakMap,Ct=new WeakMap,wr=new WeakMap,W=new WeakSet,Wr=function(r){L(this,W,_o).call(this);let s=c(this,G).fetch(this.options,r);return r?.throwOnError||(s=s.catch(ne)),s},ho=function(){L(this,W,bo).call(this);let r=He(this.options.staleTime,c(this,G));if(Ze.isServer()||c(this,Ce).isStale||!Hr(r))return;let o=ks(c(this,Ce).dataUpdatedAt,r)+1;E(this,zt,ze.setTimeout(()=>{c(this,Ce).isStale||this.updateResult()},o))},yo=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(c(this,G)):this.options.refetchInterval)??!1},go=function(r){L(this,W,xo).call(this),E(this,Ct,r),!(Ze.isServer()||Ee(this.options.enabled,c(this,G))===!1||!Hr(c(this,Ct))||c(this,Ct)===0)&&E(this,Wt,ze.setInterval(()=>{(this.options.refetchIntervalInBackground||dr.isFocused())&&L(this,W,Wr).call(this)},c(this,Ct)))},vo=function(){L(this,W,ho).call(this),L(this,W,go).call(this,L(this,W,yo).call(this))},bo=function(){c(this,zt)!==void 0&&(ze.clearTimeout(c(this,zt)),E(this,zt,void 0))},xo=function(){c(this,Wt)!==void 0&&(ze.clearInterval(c(this,Wt)),E(this,Wt,void 0))},_o=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,Zr,r.state),this.hasListeners()&&(s?.removeObserver(this),r.addObserver(this))},Bn=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"})})},Gn);function vl(e,r){return Ee(r.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&Ee(r.retryOnMount,e)===!1)}function Hn(e,r){return vl(e,r)||e.state.data!==void 0&&To(e,r,r.refetchOnMount)}function To(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&&wo(e,r)}return!1}function $n(e,r,s,o){return(e!==r||Ee(o.enabled,e)===!1)&&(!s.suspense||e.state.status!=="error")&&wo(e,s)}function wo(e,r){return Ee(r.enabled,e)!==!1&&e.isStaleByTime(He(r.staleTime,e))}function bl(e,r){return!fr(e.getCurrentResult(),r)}var Eo=class extends Yr{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:Ln(r,s.data),hasPreviousPage:Kn(r,s.data),isFetchNextPageError:p,isFetchingNextPage:h,isFetchPreviousPageError:d,isFetchingPreviousPage:y,isRefetchError:l&&!p&&!d,isRefetching:i&&!h&&!y}}};var es,Xe,be,Zt,Ye,Rt,Jn,zn=(Jn=class extends Os{constructor(r){super();k(this,Ye);k(this,es);k(this,Xe);k(this,be);k(this,Zt);E(this,es,r.client),this.mutationId=r.mutationId,E(this,be,r.mutationCache),E(this,Xe,[]),this.state=r.state||Co(),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,Rt).call(this,{type:"continue"})},o={client:c(this,es),meta:this.options.meta,mutationKey:this.options.mutationKey};E(this,Zt,Fs({fn:()=>this.options.mutationFn?this.options.mutationFn(r,o):Promise.reject(new Error("No mutationFn found")),onFail:(a,l)=>{L(this,Ye,Rt).call(this,{type:"failed",failureCount:a,error:l})},onPause:()=>{L(this,Ye,Rt).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,Rt).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,Rt).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,Rt).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,Rt).call(this,{type:"error",error:a}),a}finally{c(this,be).runNext(this)}}},es=new WeakMap,Xe=new WeakMap,be=new WeakMap,Zt=new WeakMap,Ye=new WeakSet,Rt=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})})},Jn);function Co(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var ft,$e,ts,Wn,Zn=(Wn=class extends Qe{constructor(r={}){super();k(this,ft);k(this,$e);k(this,ts);this.config=r,E(this,ft,new Set),E(this,$e,new Map),E(this,ts,0)}build(r,s,o){let n=new zn({client:r,mutationCache:this,mutationId:++jr(this,ts)._,options:r.defaultMutationOptions(s),state:o});return this.add(n),n}add(r){c(this,ft).add(r);let s=qs(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,ft).delete(r)){let s=qs(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=qs(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=qs(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,ft).forEach(r=>{this.notify({type:"removed",mutation:r})}),c(this,ft).clear(),c(this,$e).clear()})}getAll(){return Array.from(c(this,ft))}find(r){let s={exact:!0,...r};return this.getAll().find(o=>Ps(s,o))}findAll(r={}){return this.getAll().filter(s=>Ps(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))))}},ft=new WeakMap,$e=new WeakMap,ts=new WeakMap,Wn);function qs(e){return e.options.scope?.id}var mt,kt,Se,ht,yt,Ds,Ro,Xn,ko=(Xn=class extends Qe{constructor(r,s){super();k(this,yt);k(this,mt);k(this,kt);k(this,Se);k(this,ht);E(this,mt,r),this.setOptions(s),this.bindMethods(),L(this,yt,Ds).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,mt).defaultMutationOptions(r),fr(this.options,s)||c(this,mt).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,yt,Ds).call(this),L(this,yt,Ro).call(this,r)}getCurrentResult(){return c(this,kt)}reset(){c(this,Se)?.removeObserver(this),E(this,Se,void 0),L(this,yt,Ds).call(this),L(this,yt,Ro).call(this)}mutate(r,s){return E(this,ht,s),c(this,Se)?.removeObserver(this),E(this,Se,c(this,mt).getMutationCache().build(c(this,mt),this.options)),c(this,Se).addObserver(this),c(this,Se).execute(r)}},mt=new WeakMap,kt=new WeakMap,Se=new WeakMap,ht=new WeakMap,yt=new WeakSet,Ds=function(){let r=c(this,Se)?.state??Co();E(this,kt,{...r,isPending:r.status==="pending",isSuccess:r.status==="success",isError:r.status==="error",isIdle:r.status==="idle",mutate:this.mutate,reset:this.reset})},Ro=function(r){Y.batch(()=>{if(c(this,ht)&&this.hasListeners()){let s=c(this,kt).variables,o=c(this,kt).context,n={client:c(this,mt),meta:this.options.meta,mutationKey:this.options.mutationKey};if(r?.type==="success"){try{c(this,ht).onSuccess?.(r.data,s,o,n)}catch(i){Promise.reject(i)}try{c(this,ht).onSettled?.(r.data,null,s,o,n)}catch(i){Promise.reject(i)}}else if(r?.type==="error"){try{c(this,ht).onError?.(r.error,s,o,n)}catch(i){Promise.reject(i)}try{c(this,ht).onSettled?.(void 0,r.error,s,o,n)}catch(i){Promise.reject(i)}}}this.listeners.forEach(s=>{s(c(this,kt))})})},Xn);var et,Yn,ei=(Yn=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??$r(n,s),a=this.get(i);return a||(a=new jn({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=>Ss(s,o))}findAll(r={}){let s=this.getAll();return Object.keys(r).length>0?s.filter(o=>Ss(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,Yn);var ie,St,Pt,Er,Cr,At,Rr,kr,ti,So=(ti=class{constructor(e={}){k(this,ie);k(this,St);k(this,Pt);k(this,Er);k(this,Cr);k(this,At);k(this,Rr);k(this,kr);E(this,ie,e.queryCache||new ei),E(this,St,e.mutationCache||new Zn),E(this,Pt,e.defaultOptions||{}),E(this,Er,new Map),E(this,Cr,new Map),E(this,At,0)}mount(){jr(this,At)._++,c(this,At)===1&&(E(this,Rr,dr.subscribe(async e=>{e&&(await this.resumePausedMutations(),c(this,ie).onFocus())})),E(this,kr,gr.subscribe(async e=>{e&&(await this.resumePausedMutations(),c(this,ie).onOnline())})))}unmount(){var e,r;jr(this,At)._--,c(this,At)===0&&((e=c(this,Rr))==null||e.call(this),E(this,Rr,void 0),(r=c(this,kr))==null||r.call(this),E(this,kr,void 0))}isFetching(e){return c(this,ie).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return c(this,St).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=kn(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 gr.isOnline()?c(this,St).resumePausedMutations():Promise.resolve()}getQueryCache(){return c(this,ie)}getMutationCache(){return c(this,St)}getDefaultOptions(){return c(this,Pt)}setDefaultOptions(e){E(this,Pt,e)}setQueryDefaults(e,r){c(this,Er).set(We(e),{queryKey:e,defaultOptions:r})}getQueryDefaults(e){let r=[...c(this,Er).values()],s={};return r.forEach(o=>{Vt(e,o.queryKey)&&Object.assign(s,o.defaultOptions)}),s}setMutationDefaults(e,r){c(this,Cr).set(We(e),{mutationKey:e,defaultOptions:r})}getMutationDefaults(e){let r=[...c(this,Cr).values()],s={};return r.forEach(o=>{Vt(e,o.mutationKey)&&Object.assign(s,o.defaultOptions)}),s}defaultQueryOptions(e){if(e._defaulted)return e;let r={...c(this,Pt).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return r.queryHash||(r.queryHash=$r(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===mr&&(r.enabled=!1),r}defaultMutationOptions(e){return e?._defaulted?e:{...c(this,Pt).mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){c(this,ie).clear(),c(this,St).clear()}},ie=new WeakMap,St=new WeakMap,Pt=new WeakMap,Er=new WeakMap,Cr=new WeakMap,At=new WeakMap,Rr=new WeakMap,kr=new WeakMap,ti);var Xt,se,Po,ri,rs=0,ci=[],ae=X,si=ae.__b,oi=ae.__r,ni=ae.diffed,ii=ae.__c,ai=ae.unmount,li=ae.__;function ss(e,r){ae.__h&&ae.__h(se,e,rs||r),rs=0;var s=se.__H||(se.__H={__:[],__h:[]});return e>=s.__.length&&s.__.push({}),s.__[e]}function x(e){return rs=1,xl(di,e)}function xl(e,r,s){var o=ss(Xt++,2);if(o.t=e,!o.__c&&(o.__=[s?s(r):di(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=se,!se.__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};se.__f=!0;var i=se.shouldComponentUpdate,a=se.componentWillUpdate;se.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)},se.shouldComponentUpdate=n}return o.__N||o.__}function z(e,r){var s=ss(Xt++,3);!ae.__s&&Mo(s.__H,r)&&(s.__=e,s.u=r,se.__H.__h.push(s))}function pi(e,r){var s=ss(Xt++,4);!ae.__s&&Mo(s.__H,r)&&(s.__=e,s.u=r,se.__h.push(s))}function de(e){return rs=5,Yt(function(){return{current:e}},[])}function Yt(e,r){var s=ss(Xt++,7);return Mo(s.__H,r)&&(s.__=e(),s.__H=r,s.__h=e),s.__}function er(e,r){return rs=8,Yt(function(){return e},r)}function Sr(e){var r=se.context[e.__c],s=ss(Xt++,9);return s.c=e,r?(s.__==null&&(s.__=!0,r.sub(se)),r.props.value):e.__}function _l(){for(var e;e=ci.shift();){var r=e.__H;if(e.__P&&r)try{r.__h.some(Qs),r.__h.some(Ao),r.__h=[]}catch(s){r.__h=[],ae.__e(s,e.__v)}}}ae.__b=function(e){se=null,si&&si(e)},ae.__=function(e,r){e&&r.__k&&r.__k.__m&&(e.__m=r.__k.__m),li&&li(e,r)},ae.__r=function(e){oi&&oi(e),Xt=0;var r=(se=e.__c).__H;r&&(Po===se?(r.__h=[],se.__h=[],r.__.some(function(s){s.__N&&(s.__=s.__N),s.u=s.__N=void 0})):(r.__h.some(Qs),r.__h.some(Ao),r.__h=[],Xt=0)),Po=se},ae.diffed=function(e){ni&&ni(e);var r=e.__c;r&&r.__H&&(r.__H.__h.length&&(ci.push(r)!==1&&ri===ae.requestAnimationFrame||((ri=ae.requestAnimationFrame)||Tl)(_l)),r.__H.__.some(function(s){s.u&&(s.__H=s.u),s.u=void 0})),Po=se=null},ae.__c=function(e,r){r.some(function(s){try{s.__h.some(Qs),s.__h=s.__h.filter(function(o){return!o.__||Ao(o)})}catch(o){r.some(function(n){n.__h&&(n.__h=[])}),r=[],ae.__e(o,s.__v)}}),ii&&ii(e,r)},ae.unmount=function(e){ai&&ai(e);var r,s=e.__c;s&&s.__H&&(s.__H.__.some(function(o){try{Qs(o)}catch(n){r=n}}),s.__H=void 0,r&&ae.__e(r,s.__v))};var ui=typeof requestAnimationFrame=="function";function Tl(e){var r,s=function(){clearTimeout(o),ui&&cancelAnimationFrame(r),setTimeout(e)},o=setTimeout(s,35);ui&&(r=requestAnimationFrame(s))}function Qs(e){var r=se,s=e.__c;typeof s=="function"&&(e.__c=void 0,s()),se=r}function Ao(e){var r=se;e.__c=e.__(),se=r}function Mo(e,r){return!e||e.length!==r.length||r.some(function(s,o){return s!==e[o]})}function di(e,r){return typeof r=="function"?r(e):r}var fi=cr(!1),mi=()=>Sr(fi),Jd=fi.Provider;var wl=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:--wl,__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 Fo=cr(void 0),os=e=>{let r=Sr(Fo);if(e)return e;if(!r)throw new Error("No QueryClient set, use QueryClientProvider to set one");return r},Pr=({client:e,children:r})=>(z(()=>(e.mount(),()=>{e.unmount()}),[e]),t(Fo.Provider,{value:e,children:r}));function El(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var Cl=cr(El()),hi=()=>Sr(Cl);var yi=(e,r)=>{(e.suspense||e.throwOnError||e.experimental_prefetchInRender)&&(r.isReset()||(e.retryOnMount=!1))},gi=e=>{z(()=>{e.clearReset()},[e])},vi=({result:e,errorResetBoundary:r,throwOnError:s,query:o,suspense:n})=>e.isError&&!r.isReset()&&!e.isFetching&&o&&(n&&e.data===void 0||Br(s,[e.error,o]));var bi=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))}},xi=(e,r)=>e.isLoading&&e.isFetching&&!r,_i=(e,r)=>e?.suspense&&r.isPending,Oo=(e,r,s)=>r.fetchOptimistic(e).catch(()=>{s.clearReset()});function Ls(e,r){let s=r(),[{_instance:o},n]=x({_instance:{_value:s,_getSnapshot:r}});return pi(()=>{o._value=s,o._getSnapshot=r,qo(o)&&n({_instance:o})},[e,s,r]),z(()=>(qo(o)&&n({_instance:o}),e(()=>{qo(o)&&n({_instance:o})})),[e]),s}function qo(e){let r=e._getSnapshot,s=e._value;try{let o=r();return!Object.is(s,o)}catch{return!0}}function Ks(e,r,s){let o=mi(),n=hi(),i=os(s),a=i.defaultQueryOptions(e);i.getDefaultOptions().queries?._experimental_beforeQuery?.(a),a._optimisticResults=o?"isRestoring":"optimistic",bi(a),yi(a,n),gi(n);let l=!i.getQueryCache().get(a.queryHash),[f]=x(()=>new r(i,a)),p=f.getOptimisticResult(a),h=!o&&e.subscribed!==!1;if(Ls(er(d=>{let y=h?f.subscribe(Y.batchCalls(d)):ne;return f.updateResult(),y},[f,h]),()=>f.getCurrentResult()),z(()=>{f.setOptions(a)},[a,f]),_i(a,p))throw Oo(a,f,n);if(vi({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()&&xi(p,o)&&(l?Oo(a,f,n):i.getQueryCache().get(a.queryHash)?.promise)?.catch(ne).finally(()=>{f.updateResult()}),a.notifyOnChangeProps?p:f.trackResult(p)}function Mt(e,r){return Ks(e,Yr,r)}function ye(e,r){let s=os(r),[o]=x(()=>new ko(s,e));z(()=>{o.setOptions(e)},[o,e]);let n=Ls(er(a=>o.subscribe(Y.batchCalls(a)),[o]),()=>o.getCurrentResult()),i=er((a,l)=>{o.mutate(a,l).catch(ne)},[o]);if(n.error&&Br(o.options.throwOnError,[n.error]))throw n.error;return{...n,mutate:i,mutateAsync:n.mutate}}function Ar(e,r){return Ks(e,Eo,r)}var Do="profiler-active-slave",Us=(()=>{try{let e=sessionStorage.getItem(Do);return e?`/slaves/${e}`:""}catch{return""}})();function Ti(){return Us}function wi(){return Us?Us.replace("/slaves/",""):null}function Ei(e){try{e?sessionStorage.setItem(Do,e):sessionStorage.removeItem(Do)}catch{}Us=e?`/slaves/${e}`:"",window.location.reload()}var Rl="/_profiler/api/cluster/";async function re(e){let r=e.url.startsWith(Rl)?"":Ti(),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 tt=(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 kl=e=>re({url:"/_profiler/api/cluster/slaves",method:"GET",signal:e});var Sl=()=>["/_profiler/api/cluster/slaves"];var Pl=e=>{let{query:r}=e??{};return{queryKey:r?.queryKey??Sl(),queryFn:({signal:n})=>kl(n),...r}};function Ci(e){let r=Pl(e),s=Mt(r);return tt(s,r.queryKey)}var Qo=(e,r)=>re({url:"/_profiler/api/console",method:"GET",params:e,signal:r}),Al=e=>["infinite","/_profiler/api/console",...e?[e]:[]];var Ml=(e,r)=>{let{query:s}=r??{};return{queryKey:s?.queryKey??Al(e),queryFn:({signal:i})=>Qo(e,i),...s}};function Ri(e,r){let s=Ml(e,r),o=Ar(s);return tt(o,s.queryKey)}var Fl=(e,r)=>re({url:`/_profiler/api/console/${e}`,method:"DELETE",signal:r}),Ol=()=>["deleteConsole"],ql=e=>{let r=Ol(),{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}},ki=e=>ye(ql(e)),Dl=e=>re({url:"/_profiler/api/console/clear",method:"DELETE",signal:e}),Ql=()=>["clearConsoles"],Ll=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:()=>Dl(),...s}},Si=e=>ye(Ll(e)),Lo=e=>re({url:"/_profiler/api/env_vars",method:"GET",signal:e}),Kl=()=>["/_profiler/api/env_vars"],Ul=e=>{let{query:r}=e??{};return{queryKey:r?.queryKey??Kl(),queryFn:({signal:n})=>Lo(n),...r}};function Pi(e){let r=Ul(e),s=Mt(r);return tt(s,r.queryKey)}var Nl=(e,r)=>re({url:"/_profiler/api/env_vars",method:"PATCH",headers:{"Content-Type":"application/json"},data:e,signal:r}),Il=()=>["updateEnvVar"],jl=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:n=>{let{data:i}=n??{};return Nl(i)},...s}},Ai=e=>ye(jl(e)),Vl=(e,r)=>re({url:"/_profiler/api/env_vars/reset",method:"DELETE",params:e,signal:r}),Hl=()=>["resetEnvVar"],$l=e=>{let r=Hl(),{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 Vl(i)},...s}},Mi=e=>ye($l(e)),Gl=e=>re({url:"/_profiler/api/env_vars/reset_all",method:"DELETE",signal:e}),Bl=()=>["resetAllEnvVars"],Jl=e=>{let r=Bl(),{mutation:s}=e?e.mutation&&"mutationKey"in e.mutation&&e.mutation.mutationKey?e:{...e,mutation:{...e.mutation,mutationKey:r}}:{mutation:{mutationKey:r}};return{mutationFn:()=>Gl(),...s}},Fi=e=>ye(Jl(e));var zl=(e,r)=>re({url:"/_profiler/api/explain",method:"POST",headers:{"Content-Type":"application/json"},data:e,signal:r}),Wl=()=>["explainQuery"],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{data:i}=n??{};return zl(i)},...s}},Oi=e=>ye(Zl(e)),Xl=e=>re({url:"/_profiler/api/config",method:"GET",signal:e}),Ko=()=>["/_profiler/api/config"],Yl=e=>{let{query:r}=e??{};return{queryKey:r?.queryKey??Ko(),queryFn:({signal:n})=>Xl(n),...r}};function qi(e){let r=Yl(e),s=Mt(r);return tt(s,r.queryKey)}var eu=(e,r)=>re({url:"/_profiler/api/function_profiling",method:"PATCH",headers:{"Content-Type":"application/json"},data:e,signal:r}),tu=()=>["updateFunctionProfiling"],ru=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{data:i}=n??{};return eu(i)},...s}},Di=e=>ye(ru(e)),Uo=(e,r)=>re({url:"/_profiler/api/jobs",method:"GET",params:e,signal:r}),su=e=>["infinite","/_profiler/api/jobs",...e?[e]:[]];var ou=(e,r)=>{let{query:s}=r??{};return{queryKey:s?.queryKey??su(e),queryFn:({signal:i})=>Uo(e,i),...s}};function Qi(e,r){let s=ou(e,r),o=Ar(s);return tt(o,s.queryKey)}var nu=(e,r)=>re({url:`/_profiler/api/jobs/${e}`,method:"DELETE",signal:r}),iu=()=>["deleteJob"],au=e=>{let r=iu(),{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 nu(i)},...s}},Li=e=>ye(au(e)),lu=e=>re({url:"/_profiler/api/jobs/clear",method:"DELETE",signal:e}),uu=()=>["clearJobs"],cu=e=>{let r=uu(),{mutation:s}=e?e.mutation&&"mutationKey"in e.mutation&&e.mutation.mutationKey?e:{...e,mutation:{...e.mutation,mutationKey:r}}:{mutation:{mutationKey:r}};return{mutationFn:()=>lu(),...s}},Ki=e=>ye(cu(e)),pu=e=>re({url:"/_profiler/api/outbound_http",method:"GET",signal:e}),du=()=>["/_profiler/api/outbound_http"],fu=e=>{let{query:r}=e??{};return{queryKey:r?.queryKey??du(),queryFn:({signal:n})=>pu(n),...r}};function Ui(e){let r=fu(e),s=Mt(r);return tt(s,r.queryKey)}var Ns=(e,r)=>re({url:"/_profiler/api/profiles",method:"GET",params:e,signal:r}),mu=e=>["infinite","/_profiler/api/profiles",...e?[e]:[]],hu=e=>["/_profiler/api/profiles",...e?[e]:[]],yu=(e,r)=>{let{query:s}=r??{};return{queryKey:s?.queryKey??mu(e),queryFn:({signal:i})=>Ns(e,i),...s}};function Ni(e,r){let s=yu(e,r),o=Ar(s);return tt(o,s.queryKey)}var gu=(e,r)=>{let{query:s}=r??{};return{queryKey:s?.queryKey??hu(e),queryFn:({signal:i})=>Ns(e,i),...s}};function Ii(e,r){let s=gu(e,r),o=Mt(s);return tt(o,s.queryKey)}var vu=(e,r)=>re({url:`/_profiler/api/profiles/${e}`,method:"DELETE",signal:r}),bu=()=>["deleteProfile"],xu=e=>{let r=bu(),{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 vu(i)},...s}},ji=e=>ye(xu(e)),_u=e=>re({url:"/_profiler/api/profiles/clear",method:"DELETE",signal:e}),Tu=()=>["clearProfiles"],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:()=>_u(),...s}},Vi=e=>ye(wu(e)),Eu=(e,r)=>re({url:"/_profiler/api/test_runner/files",method:"GET",params:e,signal:r}),Cu=e=>["/_profiler/api/test_runner/files",...e?[e]:[]],Ru=(e,r)=>{let{query:s}=r??{};return{queryKey:s?.queryKey??Cu(e),queryFn:({signal:i})=>Eu(e,i),...s}};function Hi(e,r){let s=Ru(e,r),o=Mt(s);return tt(o,s.queryKey)}var ku=(e,r)=>re({url:"/_profiler/api/test_runner/runs",method:"POST",headers:{"Content-Type":"application/json"},data:e,signal:r}),Su=()=>["createTestRun"],Pu=e=>{let r=Su(),{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 ku(i)},...s}},$i=e=>ye(Pu(e));var Au=(e,r)=>re({url:`/_profiler/api/test_runner/runs/${e}`,method:"DELETE",signal:r}),Mu=()=>["deleteTestRun"],Fu=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{id:i}=n??{};return Au(i)},...s}},Gi=e=>ye(Fu(e)),No=(e,r)=>re({url:"/_profiler/api/tests",method:"GET",params:e,signal:r}),Ou=e=>["infinite","/_profiler/api/tests",...e?[e]:[]];var qu=(e,r)=>{let{query:s}=r??{};return{queryKey:s?.queryKey??Ou(e),queryFn:({signal:i})=>No(e,i),...s}};function Bi(e,r){let s=qu(e,r),o=Ar(s);return tt(o,s.queryKey)}var Du=(e,r)=>re({url:`/_profiler/api/tests/${e}`,method:"DELETE",signal:r}),Qu=()=>["deleteTest"],Lu=e=>{let r=Qu(),{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}},Ji=e=>ye(Lu(e)),Ku=e=>re({url:"/_profiler/api/tests/clear",method:"DELETE",signal:e}),Uu=()=>["clearTests"],Nu=e=>{let r=Uu(),{mutation:s}=e?e.mutation&&"mutationKey"in e.mutation&&e.mutation.mutationKey?e:{...e,mutation:{...e.mutation,mutationKey:r}}:{mutation:{mutationKey:r}};return{mutationFn:()=>Ku(),...s}},zi=e=>ye(Nu(e));async function Ft(e){if(typeof navigator<"u"&&navigator.clipboard?.writeText)try{return await navigator.clipboard.writeText(e),!0}catch{}return Iu(e)}function Iu(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 rt(e){return e==null?"-":`${e.toLocaleString("en")} objects`}var st="Objects allocated by the whole process while this ran: on a multi-threaded server, it includes what other threads allocated meanwhile.";function Wi(){let{data:e,isError:r}=qi({query:{queryKey:Ko(),staleTime:1/0,retry:!1}});return e?{scheme:e.editor_url_scheme,pathMap:e.editor_path_map}:r?{scheme:"vscode",pathMap:{}}:{scheme:null,pathMap:{}}}var ju=["vscode","idea","cursor"];function Vu(e){return typeof e=="string"&&ju.includes(e)}var Hu=/^[A-Za-z]:\//;function ns(e){return e.replace(/\\/g,"/")}function $u(e,r){if(!r)return e;let s=null;for(let i of Object.keys(r)){let a=ns(i).replace(/\/+$/,"");(e===a||e.startsWith(a+"/"))&&(s===null||a.length>ns(s).replace(/\/+$/,"").length)&&(s=i)}if(s===null)return e;let o=ns(s).replace(/\/+$/,"");return ns(String(r[s])).replace(/\/+$/,"")+e.slice(o.length)}function Gu(e){return e.startsWith("/")||Hu.test(e)}function Bu(e){return(e.startsWith("/")?e:"/"+e).split("/").map((s,o)=>o===1&&/^[A-Za-z]:$/.test(s)?s:encodeURIComponent(s)).join("/")}function Zi(e,r,s){let{scheme:o,pathMap:n}=s;if(!Vu(o)||!Number.isInteger(r)||r<1||typeof e!="string"||e===""||e.includes("\0"))return null;let i=$u(ns(e),n);return Gu(i)?o==="idea"?`idea://open?file=${encodeURIComponent(i)}&line=${r}`:`${o}://file${Bu(i)}:${r}`:null}function Xi(e){let r=/^(.+?):(\d+)(?::in\b.*)?$/.exec(e);return r?{file:r[1],line:Number(r[2])}:null}function tr({file:e,line:r,children:s,class:o}){let n=Wi(),i=s??`${e}:${r}`,a=Zi(e,r,n);return a?t("a",{href:a,class:o,title:`Open ${e}:${r} in your editor`,rel:"noopener noreferrer","data-source-link":"",onClick:l=>l.stopPropagation(),children:i}):t("span",{class:o,children:i})}function gt({frame:e,class:r}){let s=Xi(e);return s?t(tr,{file:s.file,line:s.line,class:r,children:e}):t("span",{class:r,children:e})}function rr(e){return{GET:"info",POST:"success",PUT:"warning",PATCH:"warning",DELETE:"error"}[e]||"default"}function Mr(e){return e===0?"error":e>=200&&e<300?"success":e>=400?"error":"warning"}function Fr(e){return e<0?"-":e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(2)} MB`}function Io({text:e}){let[r,s]=x(null);function o(){Ft(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 sa(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 Yi({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${sa(r)}`,class:"profiler-body-download-btn profiler-text--xs",children:"Download"}):null}function ea({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 Ju(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 zu(e){try{let r=0;return e.replace(/>\s*</g,"><").replace(/(<\/?[^>]+>)/g,s=>{if(s.startsWith("</"))return r=Math.max(0,r-1),`
2
- `+" ".repeat(r)+s;if(s.endsWith("/>")||/<\?/.test(s))return`
3
- `+" ".repeat(r)+s;let o=`
4
- `+" ".repeat(r)+s;return r++,o}).trim()}catch{return e}}function Wu(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 Zu(e,r){if(r==="json")try{return JSON.stringify(JSON.parse(e),null,2)}catch{return e}return r==="xml"?zu(e):e}function Xu(e){return{json:"application/json",xml:"application/xml",csv:"text/csv",html:"text/html",svg:"image/svg+xml"}[e]||"text/plain"}var Yu=["image/png","image/jpeg","image/gif","image/webp","image/avif","application/pdf"];function ec(e){let r=e.toLowerCase();return Yu.includes(r)?r:"application/octet-stream"}var jo=500,ta=10;function ra({body:e,encoding:r,headers:s}){let[o,n]=x(!1),[i,a]=x(null),[l,f]=x(null),p=Ju(s);if(z(()=>{if(r!=="base64"||!e)return;let g=Object.entries(s).find(([P])=>P.toLowerCase()==="content-type")?.[1]?.split(";")[0].trim()||"application/octet-stream",v=atob(e),_=new Uint8Array(v.length);for(let P=0;P<v.length;P++)_[P]=v.charCodeAt(P);let T=URL.createObjectURL(new Blob([_],{type:ec(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${sa(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(Io,{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()||Xu(p);if(p==="csv"){let g=Wu(e),v=g[0]||[],_=g.slice(1),T=o?_:_.slice(0,ta),w=_.length>ta;return t("div",{children:[t("div",{style:"display:flex;gap:8px;margin-bottom:6px",children:[t(Io,{text:e}),t(Yi,{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((P,M)=>t("th",{children:P},M))})}),t("tbody",{children:T.map((P,M)=>t("tr",{children:P.map((K,j)=>t("td",{children:K},j))},M))})]})}),w&&t("button",{class:"profiler-link profiler-text--xs",onClick:()=>n(P=>!P),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=Zu(e,p),y=o?d:d.slice(0,jo),m=d.length>jo&&!o;return t("div",{children:[t("div",{style:"display:flex;gap:8px;margin-bottom:6px",children:[t(Io,{text:d}),t(Yi,{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>jo&&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 Is({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(ea,{headers:e.headers}),e.params&&Object.keys(e.params).length>0&&!e.body&&t(S,{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(S,{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(ra,{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(ea,{headers:r.headers}),r.body&&t(S,{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(ra,{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:t(gt,{frame:o})},n))]})]})}function js({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(),Ft(s??r).then(_=>{_&&(h(!0),setTimeout(()=>h(!1),2e3))})}function g(v){v.stopPropagation(),Ft(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-${rr(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-${Mr(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 tc(e,r){return e===0||e>=500?"var(--profiler-error, #ef4444)":e>=400||r>=500?"var(--profiler-warning, #f59e0b)":"var(--profiler-success, #22c55e)"}function rc({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=tc(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 sc(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 oc(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 Vo({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(js,{method:e.method,url:e.url,status:e.status,duration:e.duration,curlCommand:sc(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 ":""}${Fr(e.request_size)}`," \xB7 \u2193 ",Fr(e.response_size)]}),e.backtrace&&e.backtrace.length>0&&t("span",{class:"profiler-text--xs profiler-text--muted",style:"margin-left:12px",children:t(gt,{frame:e.backtrace[0]})})]}),oc(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(Is,{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 Or({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(S,{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(rc,{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(Vo,{req:o,index:n,threshold:r},n))]})]})}var oa="[FILTERED]";function nc(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 ic(e){let r=e.indexOf("_");return r>0?e.slice(0,r):"OTHER"}function ac(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 lc(){try{let e=localStorage.getItem("profiler_unmasked_env_keys");return e?new Set(JSON.parse(e)):new Set}catch{return new Set}}function Ho(e){try{localStorage.setItem("profiler_unmasked_env_keys",JSON.stringify([...e]))}catch{}}function na({value:e}){let r=nc(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 ia(e){return/^(true|false|yes|no)$/i.test(e)}function $o(e){return!(e===""||ia(e)||/^\d+(\.\d+)?$/.test(e))}function ot({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,P]=x(""),[M,K]=x(""),[j,oe]=x(null),[N,D]=x(!1),[O,U]=x(!1),[J,H]=x(lc),[le,ce]=x(null),[Z,Pe]=x(r),[Ke,Ue]=x(!1),[qe,ge]=x(""),_e=de(null),{mutateAsync:Ae}=Ai(),{mutateAsync:nt}=Mi(),{mutateAsync:R}=Fi();z(()=>{g!==null&&_e.current?.focus()},[g]),z(()=>{r||Q()},[]);let I=(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),Ho(F),F})},it=async(b,q)=>{await Ft(b)?(ce(q),setTimeout(()=>ce(null),1500)):I("error","Copy is not available in this browser: select the value and copy it by hand")},sr=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 Lo();return i(b.variables),p(b.total),l(b.overrides??{}),I("success",`Refreshed - ${b.total} variables`),b}catch(b){I("error",b.message??"Failed to refresh")}finally{U(!1)}},B=()=>{let b=lt,q=b.map(([we,je])=>`${we}=${je}`).join(`
1
+ "use strict";(()=>{var gn=e=>{throw TypeError(e)};var is=(e,r,o)=>r.has(e)||gn("Cannot "+o);var c=(e,r,o)=>(is(e,r,"read from private field"),o?o.call(e):r.get(e)),P=(e,r,o)=>r.has(e)?gn("Cannot add the same private member more than once"):r instanceof WeakSet?r.add(e):r.set(e,o),E=(e,r,o,s)=>(is(e,r,"write to private field"),s?s.call(e,o):r.set(e,o),o),I=(e,r,o)=>(is(e,r,"access private method"),o);var Jr=(e,r,o,s)=>({set _(n){E(e,r,n,o)},get _(){return c(e,r,s)}});var Fo,ee,_n,yl,wt,vn,Tn,wn,Cn,ds,ls,us,En,Po={},Ao=[],gl=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,qo=Array.isArray;function dt(e,r){for(var o in r)e[o]=r[o];return e}function fs(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function vl(e,r,o){var s,n,a,i={};for(a in r)a=="key"?s=r[a]:a=="ref"?n=r[a]:i[a]=r[a];if(arguments.length>2&&(i.children=arguments.length>3?Fo.call(arguments,2):o),typeof e=="function"&&e.defaultProps!=null)for(a in e.defaultProps)i[a]===void 0&&(i[a]=e.defaultProps[a]);return ko(e,i,s,n,null)}function ko(e,r,o,s,n){var a={type:e,props:r,key:o,ref:s,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:n??++_n,__i:-1,__u:0};return n==null&&ee.vnode!=null&&ee.vnode(a),a}function M(e){return e.children}function So(e,r){this.props=e,this.context=r}function dr(e,r){if(r==null)return e.__?dr(e.__,e.__i+1):null;for(var o;r<e.__k.length;r++)if((o=e.__k[r])!=null&&o.__e!=null)return o.__e;return typeof e.type=="function"?dr(e):null}function bl(e){if(e.__P&&e.__d){var r=e.__v,o=r.__e,s=[],n=[],a=dt({},r);a.__v=r.__v+1,ee.vnode&&ee.vnode(a),ms(e.__P,a,r,e.__n,e.__P.namespaceURI,32&r.__u?[o]:null,s,o??dr(r),!!(32&r.__u),n),a.__v=r.__v,a.__.__k[a.__i]=a,Pn(s,a,n),r.__e=r.__=null,a.__e!=o&&Rn(a)}}function Rn(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}),Rn(e)}function cs(e){(!e.__d&&(e.__d=!0)&&wt.push(e)&&!Mo.__r++||vn!=ee.debounceRendering)&&((vn=ee.debounceRendering)||Tn)(Mo)}function Mo(){try{for(var e,r=1;wt.length;)wt.length>r&&wt.sort(wn),e=wt.shift(),r=wt.length,bl(e)}finally{wt.length=Mo.__r=0}}function kn(e,r,o,s,n,a,i,l,f,p,m){var d,y,h,g,v,x,w,C=s&&s.__k||Ao,A=r.length;for(f=xl(o,r,C,f,A),d=0;d<A;d++)(h=o.__k[d])!=null&&(y=h.__i!=-1&&C[h.__i]||Po,h.__i=d,x=ms(e,h,y,n,a,i,l,f,p,m),g=h.__e,h.ref&&y.ref!=h.ref&&(y.ref&&hs(y.ref,null,h),m.push(h.ref,h.__c||g,h)),v==null&&g!=null&&(v=g),(w=!!(4&h.__u))||y.__k===h.__k?f=Sn(h,f,e,w):typeof h.type=="function"&&x!==void 0?f=x:g&&(f=g.nextSibling),h.__u&=-7);return o.__e=v,f}function xl(e,r,o,s,n){var a,i,l,f,p,m=o.length,d=m,y=0;for(e.__k=new Array(n),a=0;a<n;a++)(i=r[a])!=null&&typeof i!="boolean"&&typeof i!="function"?(typeof i=="string"||typeof i=="number"||typeof i=="bigint"||i.constructor==String?i=e.__k[a]=ko(null,i,null,null,null):qo(i)?i=e.__k[a]=ko(M,{children:i},null,null,null):i.constructor===void 0&&i.__b>0?i=e.__k[a]=ko(i.type,i.props,i.key,i.ref?i.ref:null,i.__v):e.__k[a]=i,f=a+y,i.__=e,i.__b=e.__b+1,l=null,(p=i.__i=_l(i,o,f,d))!=-1&&(d--,(l=o[p])&&(l.__u|=2)),l==null||l.__v==null?(p==-1&&(n>m?y--:n<m&&y++),typeof i.type!="function"&&(i.__u|=4)):p!=f&&(p==f-1?y--:p==f+1?y++:(p>f?y--:y++,i.__u|=4))):e.__k[a]=null;if(d)for(a=0;a<m;a++)(l=o[a])!=null&&(2&l.__u)==0&&(l.__e==s&&(s=dr(l)),Mn(l,l));return s}function Sn(e,r,o,s){var n,a;if(typeof e.type=="function"){for(n=e.__k,a=0;n&&a<n.length;a++)n[a]&&(n[a].__=e,r=Sn(n[a],r,o,s));return r}e.__e!=r&&(s&&(r&&e.type&&!r.parentNode&&(r=dr(e)),o.insertBefore(e.__e,r||null)),r=e.__e);do r=r&&r.nextSibling;while(r!=null&&r.nodeType==8);return r}function _l(e,r,o,s){var n,a,i,l=e.key,f=e.type,p=r[o],m=p!=null&&(2&p.__u)==0;if(p===null&&l==null||m&&l==p.key&&f==p.type)return o;if(s>(m?1:0)){for(n=o-1,a=o+1;n>=0||a<r.length;)if((p=r[i=n>=0?n--:a++])!=null&&(2&p.__u)==0&&l==p.key&&f==p.type)return i}return-1}function bn(e,r,o){r[0]=="-"?e.setProperty(r,o??""):e[r]=o==null?"":typeof o!="number"||gl.test(r)?o:o+"px"}function Ro(e,r,o,s,n){var a,i;e:if(r=="style")if(typeof o=="string")e.style.cssText=o;else{if(typeof s=="string"&&(e.style.cssText=s=""),s)for(r in s)o&&r in o||bn(e.style,r,"");if(o)for(r in o)s&&o[r]==s[r]||bn(e.style,r,o[r])}else if(r[0]=="o"&&r[1]=="n")a=r!=(r=r.replace(Cn,"$1")),i=r.toLowerCase(),r=i in e||r=="onFocusOut"||r=="onFocusIn"?i.slice(2):r.slice(2),e.l||(e.l={}),e.l[r+a]=o,o?s?o.u=s.u:(o.u=ds,e.addEventListener(r,a?us:ls,a)):e.removeEventListener(r,a?us:ls,a);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]=o??"";break e}catch{}typeof o=="function"||(o==null||o===!1&&r[4]!="-"?e.removeAttribute(r):e.setAttribute(r,r=="popover"&&o==1?"":o))}}function xn(e){return function(r){if(this.l){var o=this.l[r.type+e];if(r.t==null)r.t=ds++;else if(r.t<o.u)return;return o(ee.event?ee.event(r):r)}}}function ms(e,r,o,s,n,a,i,l,f,p){var m,d,y,h,g,v,x,w,C,A,k,K,U,L,j,T=r.type;if(r.constructor!==void 0)return null;128&o.__u&&(f=!!(32&o.__u),a=[l=r.__e=o.__e]),(m=ee.__b)&&m(r);e:if(typeof T=="function")try{if(w=r.props,C=T.prototype&&T.prototype.render,A=(m=T.contextType)&&s[m.__c],k=m?A?A.props.value:m.__:s,o.__c?x=(d=r.__c=o.__c).__=d.__E:(C?r.__c=d=new T(w,k):(r.__c=d=new So(w,k),d.constructor=T,d.render=wl),A&&A.sub(d),d.state||(d.state={}),d.__n=s,y=d.__d=!0,d.__h=[],d._sb=[]),C&&d.__s==null&&(d.__s=d.state),C&&T.getDerivedStateFromProps!=null&&(d.__s==d.state&&(d.__s=dt({},d.__s)),dt(d.__s,T.getDerivedStateFromProps(w,d.__s))),h=d.props,g=d.state,d.__v=r,y)C&&T.getDerivedStateFromProps==null&&d.componentWillMount!=null&&d.componentWillMount(),C&&d.componentDidMount!=null&&d.__h.push(d.componentDidMount);else{if(C&&T.getDerivedStateFromProps==null&&w!==h&&d.componentWillReceiveProps!=null&&d.componentWillReceiveProps(w,k),r.__v==o.__v||!d.__e&&d.shouldComponentUpdate!=null&&d.shouldComponentUpdate(w,d.__s,k)===!1){r.__v!=o.__v&&(d.props=w,d.state=d.__s,d.__d=!1),r.__e=o.__e,r.__k=o.__k,r.__k.some(function(F){F&&(F.__=r)}),Ao.push.apply(d.__h,d._sb),d._sb=[],d.__h.length&&i.push(d);break e}d.componentWillUpdate!=null&&d.componentWillUpdate(w,d.__s,k),C&&d.componentDidUpdate!=null&&d.__h.push(function(){d.componentDidUpdate(h,g,v)})}if(d.context=k,d.props=w,d.__P=e,d.__e=!1,K=ee.__r,U=0,C)d.state=d.__s,d.__d=!1,K&&K(r),m=d.render(d.props,d.state,d.context),Ao.push.apply(d.__h,d._sb),d._sb=[];else do d.__d=!1,K&&K(r),m=d.render(d.props,d.state,d.context),d.state=d.__s;while(d.__d&&++U<25);d.state=d.__s,d.getChildContext!=null&&(s=dt(dt({},s),d.getChildContext())),C&&!y&&d.getSnapshotBeforeUpdate!=null&&(v=d.getSnapshotBeforeUpdate(h,g)),L=m!=null&&m.type===M&&m.key==null?An(m.props.children):m,l=kn(e,qo(L)?L:[L],r,o,s,n,a,i,l,f,p),d.base=r.__e,r.__u&=-161,d.__h.length&&i.push(d),x&&(d.__E=d.__=null)}catch(F){if(r.__v=null,f||a!=null)if(F.then){for(r.__u|=f?160:128;l&&l.nodeType==8&&l.nextSibling;)l=l.nextSibling;a[a.indexOf(l)]=null,r.__e=l}else{for(j=a.length;j--;)fs(a[j]);ps(r)}else r.__e=o.__e,r.__k=o.__k,F.then||ps(r);ee.__e(F,r,o)}else a==null&&r.__v==o.__v?(r.__k=o.__k,r.__e=o.__e):l=r.__e=Tl(o.__e,r,o,s,n,a,i,f,p);return(m=ee.diffed)&&m(r),128&r.__u?void 0:l}function ps(e){e&&(e.__c&&(e.__c.__e=!0),e.__k&&e.__k.some(ps))}function Pn(e,r,o){for(var s=0;s<o.length;s++)hs(o[s],o[++s],o[++s]);ee.__c&&ee.__c(r,e),e.some(function(n){try{e=n.__h,n.__h=[],e.some(function(a){a.call(n)})}catch(a){ee.__e(a,n.__v)}})}function An(e){return typeof e!="object"||e==null||e.__b>0?e:qo(e)?e.map(An):dt({},e)}function Tl(e,r,o,s,n,a,i,l,f){var p,m,d,y,h,g,v,x=o.props||Po,w=r.props,C=r.type;if(C=="svg"?n="http://www.w3.org/2000/svg":C=="math"?n="http://www.w3.org/1998/Math/MathML":n||(n="http://www.w3.org/1999/xhtml"),a!=null){for(p=0;p<a.length;p++)if((h=a[p])&&"setAttribute"in h==!!C&&(C?h.localName==C:h.nodeType==3)){e=h,a[p]=null;break}}if(e==null){if(C==null)return document.createTextNode(w);e=document.createElementNS(n,C,w.is&&w),l&&(ee.__m&&ee.__m(r,a),l=!1),a=null}if(C==null)x===w||l&&e.data==w||(e.data=w);else{if(a=a&&Fo.call(e.childNodes),!l&&a!=null)for(x={},p=0;p<e.attributes.length;p++)x[(h=e.attributes[p]).name]=h.value;for(p in x)h=x[p],p=="dangerouslySetInnerHTML"?d=h:p=="children"||p in w||p=="value"&&"defaultValue"in w||p=="checked"&&"defaultChecked"in w||Ro(e,p,null,h,n);for(p in w)h=w[p],p=="children"?y=h:p=="dangerouslySetInnerHTML"?m=h:p=="value"?g=h:p=="checked"?v=h:l&&typeof h!="function"||x[p]===h||Ro(e,p,h,x[p],n);if(m)l||d&&(m.__html==d.__html||m.__html==e.innerHTML)||(e.innerHTML=m.__html),r.__k=[];else if(d&&(e.innerHTML=""),kn(r.type=="template"?e.content:e,qo(y)?y:[y],r,o,s,C=="foreignObject"?"http://www.w3.org/1999/xhtml":n,a,i,a?a[0]:o.__k&&dr(o,0),l,f),a!=null)for(p=a.length;p--;)fs(a[p]);l||(p="value",C=="progress"&&g==null?e.removeAttribute("value"):g!=null&&(g!==e[p]||C=="progress"&&!g||C=="option"&&g!=x[p])&&Ro(e,p,g,x[p],n),p="checked",v!=null&&v!=e[p]&&Ro(e,p,v,x[p],n))}return e}function hs(e,r,o){try{if(typeof e=="function"){var s=typeof e.__u=="function";s&&e.__u(),s&&r==null||(e.__u=e(r))}else e.current=r}catch(n){ee.__e(n,o)}}function Mn(e,r,o){var s,n;if(ee.unmount&&ee.unmount(e),(s=e.ref)&&(s.current&&s.current!=e.__e||hs(s,null,r)),(s=e.__c)!=null){if(s.componentWillUnmount)try{s.componentWillUnmount()}catch(a){ee.__e(a,r)}s.base=s.__P=null}if(s=e.__k)for(n=0;n<s.length;n++)s[n]&&Mn(s[n],r,o||typeof e.type!="function");o||fs(e.__e),e.__c=e.__=e.__e=void 0}function wl(e,r,o){return this.constructor(e,o)}function fr(e,r,o){var s,n,a,i;r==document&&(r=document.documentElement),ee.__&&ee.__(e,r),n=(s=typeof o=="function")?null:o&&o.__k||r.__k,a=[],i=[],ms(r,e=(!s&&o||r).__k=vl(M,null,[e]),n||Po,Po,r.namespaceURI,!s&&o?[o]:n?null:r.firstChild?Fo.call(r.childNodes):null,a,!s&&o?o:n?n.__e:r.firstChild,s,i),Pn(a,e,i)}function mr(e){function r(o){var s,n;return this.getChildContext||(s=new Set,(n={})[r.__c]=this,this.getChildContext=function(){return n},this.componentWillUnmount=function(){s=null},this.shouldComponentUpdate=function(a){this.props.value!=a.value&&s.forEach(function(i){i.__e=!0,cs(i)})},this.sub=function(a){s.add(a);var i=a.componentWillUnmount;a.componentWillUnmount=function(){s&&s.delete(a),i&&i.call(a)}}),o.children}return r.__c="__cC"+En++,r.__=e,r.Provider=r.__l=(r.Consumer=function(o,s){return o.children(s)}).contextType=r,r}Fo=Ao.slice,ee={__e:function(e,r,o,s){for(var n,a,i;r=r.__;)if((n=r.__c)&&!n.__)try{if((a=n.constructor)&&a.getDerivedStateFromError!=null&&(n.setState(a.getDerivedStateFromError(e)),i=n.__d),n.componentDidCatch!=null&&(n.componentDidCatch(e,s||{}),i=n.__d),i)return n.__E=n}catch(l){e=l}throw e}},_n=0,yl=function(e){return e!=null&&e.constructor===void 0},So.prototype.setState=function(e,r){var o;o=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=dt({},this.state),typeof e=="function"&&(e=e(dt({},o),this.props)),e&&dt(o,e),e!=null&&this.__v&&(r&&this._sb.push(r),cs(this))},So.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),cs(this))},So.prototype.render=M,wt=[],Tn=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,wn=function(e,r){return e.__v.__b-r.__v.__b},Mo.__r=0,Cn=/(PointerCapture)$|Capture$/i,ds=0,ls=xn(!1),us=xn(!0),En=0;var Ke=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 Jt,Ct,hr,Fn,Cl=(Fn=class extends Ke{constructor(){super();P(this,Jt);P(this,Ct);P(this,hr);E(this,hr,r=>{if(typeof window<"u"&&window.addEventListener){let o=()=>r();return window.addEventListener("visibilitychange",o,!1),()=>{window.removeEventListener("visibilitychange",o)}}})}onSubscribe(){c(this,Ct)||this.setEventListener(c(this,hr))}onUnsubscribe(){var r;this.hasListeners()||((r=c(this,Ct))==null||r.call(this),E(this,Ct,void 0))}setEventListener(r){var o;E(this,hr,r),(o=c(this,Ct))==null||o.call(this),E(this,Ct,r(s=>{typeof s=="boolean"?this.setFocused(s):this.onFocus()}))}setFocused(r){c(this,Jt)!==r&&(E(this,Jt,r),this.onFocus())}onFocus(){let r=this.isFocused();this.listeners.forEach(o=>{o(r)})}isFocused(){return typeof c(this,Jt)=="boolean"?c(this,Jt):globalThis.document?.visibilityState!=="hidden"}},Jt=new WeakMap,Ct=new WeakMap,hr=new WeakMap,Fn),yr=new Cl;var El={setTimeout:(e,r)=>setTimeout(e,r),clearTimeout:e=>clearTimeout(e),setInterval:(e,r)=>setInterval(e,r),clearInterval:e=>clearInterval(e)},Et,ys,qn,Rl=(qn=class{constructor(){P(this,Et,El);P(this,ys,!1)}setTimeoutProvider(e){E(this,Et,e)}setTimeout(e,r){return c(this,Et).setTimeout(e,r)}clearTimeout(e){c(this,Et).clearTimeout(e)}setInterval(e,r){return c(this,Et).setInterval(e,r)}clearInterval(e){c(this,Et).clearInterval(e)}},Et=new WeakMap,ys=new WeakMap,qn),ze=new Rl;function On(e){setTimeout(e,0)}var vs=typeof window>"u"||"Deno"in globalThis;function ie(){}function Ln(e,r){return typeof e=="function"?e(r):e}function zr(e){return typeof e=="number"&&e>=0&&e!==1/0}function Oo(e,r){return Math.max(e+(r||0)-Date.now(),0)}function He(e,r){return typeof e=="function"?e(r):e}function ke(e,r){return typeof e=="function"?e(r):e}function Do(e,r){let{type:o="all",exact:s,fetchStatus:n,predicate:a,queryKey:i,stale:l}=e;if(i){if(s){if(r.queryHash!==Wr(i,r.options))return!1}else if(!zt(r.queryKey,i))return!1}if(o!=="all"){let f=r.isActive();if(o==="active"&&!f||o==="inactive"&&f)return!1}return!(typeof l=="boolean"&&r.isStale()!==l||n&&n!==r.state.fetchStatus||a&&!a(r))}function Qo(e,r){let{exact:o,status:s,predicate:n,mutationKey:a}=e;if(a){if(!r.options.mutationKey)return!1;if(o){if(We(r.options.mutationKey)!==We(a))return!1}else if(!zt(r.options.mutationKey,a))return!1}return!(s&&r.state.status!==s||n&&!n(r))}function Wr(e,r){return(r?.queryKeyHashFn||We)(e)}function We(e){return JSON.stringify(e,(r,o)=>gs(o)?Object.keys(o).sort().reduce((s,n)=>(s[n]=o[n],s),{}):o)}function zt(e,r){return e===r?!0:typeof e!=typeof r?!1:e&&r&&typeof e=="object"&&typeof r=="object"?Object.keys(r).every(o=>zt(e[o],r[o])):!1}var kl=Object.prototype.hasOwnProperty;function bs(e,r,o=0){if(e===r)return e;if(o>500)return r;let s=Dn(e)&&Dn(r);if(!s&&!(gs(e)&&gs(r)))return r;let a=(s?e:Object.keys(e)).length,i=s?r:Object.keys(r),l=i.length,f=s?new Array(l):{},p=0;for(let m=0;m<l;m++){let d=s?m:i[m],y=e[d],h=r[d];if(y===h){f[d]=y,(s?m<a:kl.call(e,d))&&p++;continue}if(y===null||h===null||typeof y!="object"||typeof h!="object"){f[d]=h;continue}let g=bs(y,h,o+1);f[d]=g,g===y&&p++}return a===l&&p===a?e:f}function gr(e,r){if(!r||Object.keys(e).length!==Object.keys(r).length)return!1;for(let o in e)if(e[o]!==r[o])return!1;return!0}function Dn(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function gs(e){if(!Qn(e))return!1;let r=e.constructor;if(r===void 0)return!0;let o=r.prototype;return!(!Qn(o)||!o.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function Qn(e){return Object.prototype.toString.call(e)==="[object Object]"}function Kn(e){return new Promise(r=>{ze.setTimeout(r,e)})}function Zr(e,r,o){return typeof o.structuralSharing=="function"?o.structuralSharing(e,r):o.structuralSharing!==!1?bs(e,r):r}function Un(e,r,o=0){let s=[...e,r];return o&&s.length>o?s.slice(1):s}function Nn(e,r,o=0){let s=[r,...e];return o&&s.length>o?s.slice(0,-1):s}var vr=Symbol();function Lo(e,r){return!e.queryFn&&r?.initialPromise?()=>r.initialPromise:!e.queryFn||e.queryFn===vr?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function Xr(e,r){return typeof e=="function"?e(...r):!!e}function jn(e,r,o){let s=!1,n;return Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(n??(n=r()),s||(s=!0,n.aborted?o():n.addEventListener("abort",o,{once:!0})),n)}),e}var Ze=(()=>{let e=()=>vs;return{isServer(){return e()},setIsServer(r){e=r}}})();function Yr(){let e,r,o=new Promise((n,a)=>{e=n,r=a});o.status="pending",o.catch(()=>{});function s(n){Object.assign(o,n),delete o.resolve,delete o.reject}return o.resolve=n=>{s({status:"fulfilled",value:n}),e(n)},o.reject=n=>{s({status:"rejected",reason:n}),r(n)},o}var In=On;function Sl(){let e=[],r=0,o=l=>{l()},s=l=>{l()},n=In,a=l=>{r?e.push(l):n(()=>{o(l)})},i=()=>{let l=e;e=[],l.length&&n(()=>{s(()=>{l.forEach(f=>{o(f)})})})};return{batch:l=>{let f;r++;try{f=l()}finally{r--,r||i()}return f},batchCalls:l=>(...f)=>{a(()=>{l(...f)})},schedule:a,setNotifyFunction:l=>{o=l},setBatchNotifyFunction:l=>{s=l},setScheduler:l=>{n=l}}}var te=Sl();var br,Rt,xr,$n,Pl=($n=class extends Ke{constructor(){super();P(this,br,!0);P(this,Rt);P(this,xr);E(this,xr,r=>{if(typeof window<"u"&&window.addEventListener){let o=()=>r(!0),s=()=>r(!1);return window.addEventListener("online",o,!1),window.addEventListener("offline",s,!1),()=>{window.removeEventListener("online",o),window.removeEventListener("offline",s)}}})}onSubscribe(){c(this,Rt)||this.setEventListener(c(this,xr))}onUnsubscribe(){var r;this.hasListeners()||((r=c(this,Rt))==null||r.call(this),E(this,Rt,void 0))}setEventListener(r){var o;E(this,xr,r),(o=c(this,Rt))==null||o.call(this),E(this,Rt,r(this.setOnline.bind(this)))}setOnline(r){c(this,br)!==r&&(E(this,br,r),this.listeners.forEach(s=>{s(r)}))}isOnline(){return c(this,br)}},br=new WeakMap,Rt=new WeakMap,xr=new WeakMap,$n),_r=new Pl;function Al(e){return Math.min(1e3*2**e,3e4)}function xs(e){return(e??"online")==="online"?_r.isOnline():!0}var Ko=class extends Error{constructor(e){super("CancelledError"),this.revert=e?.revert,this.silent=e?.silent}};function Uo(e){let r=!1,o=0,s,n=Yr(),a=()=>n.status!=="pending",i=v=>{if(!a()){let x=new Ko(v);y(x),e.onCancel?.(x)}},l=()=>{r=!0},f=()=>{r=!1},p=()=>yr.isFocused()&&(e.networkMode==="always"||_r.isOnline())&&e.canRun(),m=()=>xs(e.networkMode)&&e.canRun(),d=v=>{a()||(s?.(),n.resolve(v))},y=v=>{a()||(s?.(),n.reject(v))},h=()=>new Promise(v=>{s=x=>{(a()||p())&&v(x)},e.onPause?.()}).then(()=>{s=void 0,a()||e.onContinue?.()}),g=()=>{if(a())return;let v,x=o===0?e.initialPromise:void 0;try{v=x??e.fn()}catch(w){v=Promise.reject(w)}Promise.resolve(v).then(d).catch(w=>{if(a())return;let C=e.retry??(Ze.isServer()?0:3),A=e.retryDelay??Al,k=typeof A=="function"?A(o,w):A,K=C===!0||typeof C=="number"&&o<C||typeof C=="function"&&C(o,w);if(r||!K){y(w);return}o++,e.onFail?.(o,w),Kn(k).then(()=>p()?void 0:h()).then(()=>{r?y(w):g()})})};return{promise:n,status:()=>n.status,cancel:i,continue:()=>(s?.(),n),cancelRetry:l,continueRetry:f,canStart:m,start:()=>(m()?g():h().then(g),n)}}var Wt,Vn,No=(Vn=class{constructor(){P(this,Wt)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),zr(this.gcTime)&&E(this,Wt,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,Wt)!==void 0&&(ze.clearTimeout(c(this,Wt)),E(this,Wt,void 0))}},Wt=new WeakMap,Vn);function Hn(e){return{onFetch:(r,o)=>{let s=r.options,n=r.fetchOptions?.meta?.fetchMore?.direction,a=r.state.data?.pages||[],i=r.state.data?.pageParams||[],l={pages:[],pageParams:[]},f=0,p=async()=>{let m=!1,d=g=>{jn(g,()=>r.signal,()=>m=!0)},y=Lo(r.options,r.fetchOptions),h=async(g,v,x)=>{if(m)return Promise.reject(r.signal.reason);if(v==null&&g.pages.length)return Promise.resolve(g);let C=(()=>{let U={client:r.client,queryKey:r.queryKey,pageParam:v,direction:x?"backward":"forward",meta:r.options.meta};return d(U),U})(),A=await y(C),{maxPages:k}=r.options,K=x?Nn:Un;return{pages:K(g.pages,A,k),pageParams:K(g.pageParams,v,k)}};if(n&&a.length){let g=n==="backward",v=g?Gn:_s,x={pages:a,pageParams:i},w=v(s,x);l=await h(x,w,g)}else{let g=e??a.length;do{let v=f===0?i[0]??s.initialPageParam:_s(s,l);if(f>0&&v==null)break;l=await h(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},o):r.fetchFn=p}}}function _s(e,{pages:r,pageParams:o}){let s=r.length-1;return r.length>0?e.getNextPageParam(r[s],r,o[s],o):void 0}function Gn(e,{pages:r,pageParams:o}){return r.length>0?e.getPreviousPageParam?.(r[0],r,o[0],o):void 0}function Bn(e,r){return r?_s(e,r)!=null:!1}function Jn(e,r){return!r||!e.getPreviousPageParam?!1:Gn(e,r)!=null}var Tr,Zt,wr,Ue,Xt,me,eo,Yt,Oe,Yn,ft,Zn,Xn=(Zn=class extends No{constructor(r){super();P(this,Oe);P(this,Tr);P(this,Zt);P(this,wr);P(this,Ue);P(this,Xt);P(this,me);P(this,eo);P(this,Yt);E(this,Yt,!1),E(this,eo,r.defaultOptions),this.setOptions(r.options),this.observers=[],E(this,Xt,r.client),E(this,Ue,c(this,Xt).getQueryCache()),this.queryKey=r.queryKey,this.queryHash=r.queryHash,E(this,Zt,Wn(this.options)),this.state=r.state??c(this,Zt),this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return c(this,Tr)}get promise(){return c(this,me)?.promise}setOptions(r){if(this.options={...c(this,eo),...r},r?._type&&E(this,Tr,r._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){let o=Wn(this.options);o.data!==void 0&&(this.setState(zn(o.data,o.dataUpdatedAt)),E(this,Zt,o))}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&c(this,Ue).remove(this)}setData(r,o){let s=Zr(this.state.data,r,this.options);return I(this,Oe,ft).call(this,{data:s,type:"success",dataUpdatedAt:o?.updatedAt,manual:o?.manual}),s}setState(r){I(this,Oe,ft).call(this,{type:"setState",state:r})}cancel(r){let o=c(this,me)?.promise;return c(this,me)?.cancel(r),o?o.then(ie).catch(ie):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return c(this,Zt)}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(r=>ke(r.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===vr||!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:!Oo(this.state.dataUpdatedAt,r)}onFocus(){this.observers.find(o=>o.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),c(this,me)?.continue()}onOnline(){this.observers.find(o=>o.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),c(this,me)?.continue()}addObserver(r){this.observers.includes(r)||(this.observers.push(r),this.clearGcTimeout(),c(this,Ue).notify({type:"observerAdded",query:this,observer:r}))}removeObserver(r){this.observers.includes(r)&&(this.observers=this.observers.filter(o=>o!==r),this.observers.length||(c(this,me)&&(c(this,Yt)||I(this,Oe,Yn).call(this)?c(this,me).cancel({revert:!0}):c(this,me).cancelRetry()),this.scheduleGc()),c(this,Ue).notify({type:"observerRemoved",query:this,observer:r}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||I(this,Oe,ft).call(this,{type:"invalidate"})}async fetch(r,o){if(this.state.fetchStatus!=="idle"&&c(this,me)?.status()!=="rejected"){if(this.state.data!==void 0&&o?.cancelRefetch)this.cancel({silent:!0});else if(c(this,me))return c(this,me).continueRetry(),c(this,me).promise}if(r&&this.setOptions(r),!this.options.queryFn){let p=this.observers.find(m=>m.options.queryFn);p&&this.setOptions(p.options)}let s=new AbortController,n=p=>{Object.defineProperty(p,"signal",{enumerable:!0,get:()=>(E(this,Yt,!0),s.signal)})},a=()=>{let p=Lo(this.options,o),d=(()=>{let y={client:c(this,Xt),queryKey:this.queryKey,meta:this.meta};return n(y),y})();return E(this,Yt,!1),this.options.persister?this.options.persister(p,d,this):p(d)},l=(()=>{let p={fetchOptions:o,options:this.options,queryKey:this.queryKey,client:c(this,Xt),state:this.state,fetchFn:a};return n(p),p})();(c(this,Tr)==="infinite"?Hn(this.options.pages):this.options.behavior)?.onFetch(l,this),E(this,wr,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==l.fetchOptions?.meta)&&I(this,Oe,ft).call(this,{type:"fetch",meta:l.fetchOptions?.meta}),E(this,me,Uo({initialPromise:o?.initialPromise,fn:l.fetchFn,onCancel:p=>{p instanceof Ko&&p.revert&&this.setState({...c(this,wr),fetchStatus:"idle"}),s.abort()},onFail:(p,m)=>{I(this,Oe,ft).call(this,{type:"failed",failureCount:p,error:m})},onPause:()=>{I(this,Oe,ft).call(this,{type:"pause"})},onContinue:()=>{I(this,Oe,ft).call(this,{type:"continue"})},retry:l.options.retry,retryDelay:l.options.retryDelay,networkMode:l.options.networkMode,canRun:()=>!0}));try{let p=await c(this,me).start();if(p===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(p),c(this,Ue).config.onSuccess?.(p,this),c(this,Ue).config.onSettled?.(p,this.state.error,this),p}catch(p){if(p instanceof Ko){if(p.silent)return c(this,me).promise;if(p.revert){if(this.state.data===void 0)throw p;return this.state.data}}throw I(this,Oe,ft).call(this,{type:"error",error:p}),c(this,Ue).config.onError?.(p,this),c(this,Ue).config.onSettled?.(this.state.data,p,this),p}finally{this.scheduleGc()}}},Tr=new WeakMap,Zt=new WeakMap,wr=new WeakMap,Ue=new WeakMap,Xt=new WeakMap,me=new WeakMap,eo=new WeakMap,Yt=new WeakMap,Oe=new WeakSet,Yn=function(){return this.state.fetchStatus==="paused"&&this.state.status==="pending"},ft=function(r){let o=s=>{switch(r.type){case"failed":return{...s,fetchFailureCount:r.failureCount,fetchFailureReason:r.error};case"pause":return{...s,fetchStatus:"paused"};case"continue":return{...s,fetchStatus:"fetching"};case"fetch":return{...s,...Ts(s.data,this.options),fetchMeta:r.meta??null};case"success":let n={...s,...zn(r.data,r.dataUpdatedAt),dataUpdateCount:s.dataUpdateCount+1,...!r.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return E(this,wr,r.manual?n:void 0),n;case"error":let a=r.error;return{...s,error:a,errorUpdateCount:s.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:s.fetchFailureCount+1,fetchFailureReason:a,fetchStatus:"idle",status:"error",isInvalidated:!0};case"invalidate":return{...s,isInvalidated:!0};case"setState":return{...s,...r.state}}};this.state=o(this.state),te.batch(()=>{this.observers.forEach(s=>{s.onQueryUpdate()}),c(this,Ue).notify({query:this,type:"updated",action:r})})},Zn);function Ts(e,r){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:xs(r.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function zn(e,r){return{data:e,dataUpdatedAt:r??Date.now(),error:null,isInvalidated:!1,status:"success"}}function Wn(e){let r=typeof e.initialData=="function"?e.initialData():e.initialData,o=r!==void 0,s=o?typeof e.initialDataUpdatedAt=="function"?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:r,dataUpdateCount:0,dataUpdatedAt:o?s??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:o?"success":"pending",fetchStatus:"idle"}}var Ae,z,ro,Se,er,Cr,mt,kt,oo,Er,Rr,tr,rr,St,kr,X,to,ws,Cs,Es,Rs,ks,Ss,Ps,oa,ra,so=(ra=class extends Ke{constructor(r,o){super();P(this,X);P(this,Ae);P(this,z);P(this,ro);P(this,Se);P(this,er);P(this,Cr);P(this,mt);P(this,kt);P(this,oo);P(this,Er);P(this,Rr);P(this,tr);P(this,rr);P(this,St);P(this,kr,new Set);this.options=o,E(this,Ae,r),E(this,kt,null),E(this,mt,Yr()),this.bindMethods(),this.setOptions(o)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(c(this,z).addObserver(this),ea(c(this,z),this.options)?I(this,X,to).call(this):this.updateResult(),I(this,X,Rs).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return As(c(this,z),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return As(c(this,z),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,I(this,X,ks).call(this),I(this,X,Ss).call(this),c(this,z).removeObserver(this)}setOptions(r){let o=this.options,s=c(this,z);if(this.options=c(this,Ae).defaultQueryOptions(r),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof ke(this.options.enabled,c(this,z))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");I(this,X,Ps).call(this),c(this,z).setOptions(this.options),o._defaulted&&!gr(this.options,o)&&c(this,Ae).getQueryCache().notify({type:"observerOptionsUpdated",query:c(this,z),observer:this});let n=this.hasListeners();n&&ta(c(this,z),s,this.options,o)&&I(this,X,to).call(this),this.updateResult(),n&&(c(this,z)!==s||ke(this.options.enabled,c(this,z))!==ke(o.enabled,c(this,z))||He(this.options.staleTime,c(this,z))!==He(o.staleTime,c(this,z)))&&I(this,X,ws).call(this);let a=I(this,X,Cs).call(this);n&&(c(this,z)!==s||ke(this.options.enabled,c(this,z))!==ke(o.enabled,c(this,z))||a!==c(this,St))&&I(this,X,Es).call(this,a)}getOptimisticResult(r){let o=c(this,Ae).getQueryCache().build(c(this,Ae),r),s=this.createResult(o,r);return Fl(this,s)&&(E(this,Se,s),E(this,Cr,this.options),E(this,er,c(this,z).state)),s}getCurrentResult(){return c(this,Se)}trackResult(r,o){return new Proxy(r,{get:(s,n)=>(this.trackProp(n),o?.(n),n==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&c(this,mt).status==="pending"&&c(this,mt).reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(s,n))})}trackProp(r){c(this,kr).add(r)}getCurrentQuery(){return c(this,z)}refetch({...r}={}){return this.fetch({...r})}fetchOptimistic(r){let o=c(this,Ae).defaultQueryOptions(r),s=c(this,Ae).getQueryCache().build(c(this,Ae),o);return s.fetch().then(()=>this.createResult(s,o))}fetch(r){return I(this,X,to).call(this,{...r,cancelRefetch:r.cancelRefetch??!0}).then(()=>(this.updateResult(),c(this,Se)))}createResult(r,o){let s=c(this,z),n=this.options,a=c(this,Se),i=c(this,er),l=c(this,Cr),p=r!==s?r.state:c(this,ro),{state:m}=r,d={...m},y=!1,h;if(o._optimisticResults){let T=this.hasListeners(),F=!T&&ea(r,o),$=T&&ta(r,s,o,n);(F||$)&&(d={...d,...Ts(m.data,r.options)}),o._optimisticResults==="isRestoring"&&(d.fetchStatus="idle")}let{error:g,errorUpdatedAt:v,status:x}=d;h=d.data;let w=!1;if(o.placeholderData!==void 0&&h===void 0&&x==="pending"){let T;a?.isPlaceholderData&&o.placeholderData===l?.placeholderData?(T=a.data,w=!0):T=typeof o.placeholderData=="function"?o.placeholderData(c(this,Rr)?.state.data,c(this,Rr)):o.placeholderData,T!==void 0&&(x="success",h=Zr(a?.data,T,o),y=!0)}if(o.select&&h!==void 0&&!w)if(a&&h===i?.data&&o.select===c(this,oo))h=c(this,Er);else try{E(this,oo,o.select),h=o.select(h),h=Zr(a?.data,h,o),E(this,Er,h),E(this,kt,null)}catch(T){E(this,kt,T)}c(this,kt)&&(g=c(this,kt),h=c(this,Er),v=Date.now(),x="error");let C=d.fetchStatus==="fetching",A=x==="pending",k=x==="error",K=A&&C,U=h!==void 0,j={status:x,fetchStatus:d.fetchStatus,isPending:A,isSuccess:x==="success",isError:k,isInitialLoading:K,isLoading:K,data:h,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:C,isRefetching:C&&!A,isLoadingError:k&&!U,isPaused:d.fetchStatus==="paused",isPlaceholderData:y,isRefetchError:k&&U,isStale:Ms(r,o),refetch:this.refetch,promise:c(this,mt),isEnabled:ke(o.enabled,r)!==!1};if(this.options.experimental_prefetchInRender){let T=j.data!==void 0,F=j.status==="error"&&!T,$=ce=>{F?ce.reject(j.error):T&&ce.resolve(j.data)},Z=()=>{let ce=E(this,mt,j.promise=Yr());$(ce)},B=c(this,mt);switch(B.status){case"pending":r.queryHash===s.queryHash&&$(B);break;case"fulfilled":(F||j.data!==B.value)&&Z();break;case"rejected":(!F||j.error!==B.reason)&&Z();break}}return j}updateResult(){let r=c(this,Se),o=this.createResult(c(this,z),this.options);if(E(this,er,c(this,z).state),E(this,Cr,this.options),c(this,er).data!==void 0&&E(this,Rr,c(this,z)),gr(o,r))return;E(this,Se,o);let s=()=>{if(!r)return!0;let{notifyOnChangeProps:n}=this.options,a=typeof n=="function"?n():n;if(a==="all"||!a&&!c(this,kr).size)return!0;let i=new Set(a??c(this,kr));return this.options.throwOnError&&i.add("error"),Object.keys(c(this,Se)).some(l=>{let f=l;return c(this,Se)[f]!==r[f]&&i.has(f)})};I(this,X,oa).call(this,{listeners:s()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&I(this,X,Rs).call(this)}},Ae=new WeakMap,z=new WeakMap,ro=new WeakMap,Se=new WeakMap,er=new WeakMap,Cr=new WeakMap,mt=new WeakMap,kt=new WeakMap,oo=new WeakMap,Er=new WeakMap,Rr=new WeakMap,tr=new WeakMap,rr=new WeakMap,St=new WeakMap,kr=new WeakMap,X=new WeakSet,to=function(r){I(this,X,Ps).call(this);let o=c(this,z).fetch(this.options,r);return r?.throwOnError||(o=o.catch(ie)),o},ws=function(){I(this,X,ks).call(this);let r=He(this.options.staleTime,c(this,z));if(Ze.isServer()||c(this,Se).isStale||!zr(r))return;let s=Oo(c(this,Se).dataUpdatedAt,r)+1;E(this,tr,ze.setTimeout(()=>{c(this,Se).isStale||this.updateResult()},s))},Cs=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(c(this,z)):this.options.refetchInterval)??!1},Es=function(r){I(this,X,Ss).call(this),E(this,St,r),!(Ze.isServer()||ke(this.options.enabled,c(this,z))===!1||!zr(c(this,St))||c(this,St)===0)&&E(this,rr,ze.setInterval(()=>{(this.options.refetchIntervalInBackground||yr.isFocused())&&I(this,X,to).call(this)},c(this,St)))},Rs=function(){I(this,X,ws).call(this),I(this,X,Es).call(this,I(this,X,Cs).call(this))},ks=function(){c(this,tr)!==void 0&&(ze.clearTimeout(c(this,tr)),E(this,tr,void 0))},Ss=function(){c(this,rr)!==void 0&&(ze.clearInterval(c(this,rr)),E(this,rr,void 0))},Ps=function(){let r=c(this,Ae).getQueryCache().build(c(this,Ae),this.options);if(r===c(this,z))return;let o=c(this,z);E(this,z,r),E(this,ro,r.state),this.hasListeners()&&(o?.removeObserver(this),r.addObserver(this))},oa=function(r){te.batch(()=>{r.listeners&&this.listeners.forEach(o=>{o(c(this,Se))}),c(this,Ae).getQueryCache().notify({query:c(this,z),type:"observerResultsUpdated"})})},ra);function Ml(e,r){return ke(r.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&ke(r.retryOnMount,e)===!1)}function ea(e,r){return Ml(e,r)||e.state.data!==void 0&&As(e,r,r.refetchOnMount)}function As(e,r,o){if(ke(r.enabled,e)!==!1&&He(r.staleTime,e)!=="static"){let s=typeof o=="function"?o(e):o;return s==="always"||s!==!1&&Ms(e,r)}return!1}function ta(e,r,o,s){return(e!==r||ke(s.enabled,e)===!1)&&(!o.suspense||e.state.status!=="error")&&Ms(e,o)}function Ms(e,r){return ke(r.enabled,e)!==!1&&e.isStaleByTime(He(r.staleTime,e))}function Fl(e,r){return!gr(e.getCurrentResult(),r)}var Fs=class extends so{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:o}=e,s=super.createResult(e,r),{isFetching:n,isRefetching:a,isError:i,isRefetchError:l}=s,f=o.fetchMeta?.fetchMore?.direction,p=i&&f==="forward",m=n&&f==="forward",d=i&&f==="backward",y=n&&f==="backward";return{...s,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:Bn(r,o.data),hasPreviousPage:Jn(r,o.data),isFetchNextPageError:p,isFetchingNextPage:m,isFetchPreviousPageError:d,isFetchingPreviousPage:y,isRefetchError:l&&!p&&!d,isRefetching:a&&!m&&!y}}};var no,Xe,_e,or,Ye,Pt,sa,na=(sa=class extends No{constructor(r){super();P(this,Ye);P(this,no);P(this,Xe);P(this,_e);P(this,or);E(this,no,r.client),this.mutationId=r.mutationId,E(this,_e,r.mutationCache),E(this,Xe,[]),this.state=r.state||qs(),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,_e).notify({type:"observerAdded",mutation:this,observer:r}))}removeObserver(r){E(this,Xe,c(this,Xe).filter(o=>o!==r)),this.scheduleGc(),c(this,_e).notify({type:"observerRemoved",mutation:this,observer:r})}optionalRemove(){c(this,Xe).length||(this.state.status==="pending"?this.scheduleGc():c(this,_e).remove(this))}continue(){return c(this,or)?.continue()??this.execute(this.state.variables)}async execute(r){let o=()=>{I(this,Ye,Pt).call(this,{type:"continue"})},s={client:c(this,no),meta:this.options.meta,mutationKey:this.options.mutationKey};E(this,or,Uo({fn:()=>this.options.mutationFn?this.options.mutationFn(r,s):Promise.reject(new Error("No mutationFn found")),onFail:(i,l)=>{I(this,Ye,Pt).call(this,{type:"failed",failureCount:i,error:l})},onPause:()=>{I(this,Ye,Pt).call(this,{type:"pause"})},onContinue:o,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>c(this,_e).canRun(this)}));let n=this.state.status==="pending",a=!c(this,or).canStart();try{if(n)o();else{I(this,Ye,Pt).call(this,{type:"pending",variables:r,isPaused:a}),c(this,_e).config.onMutate&&await c(this,_e).config.onMutate(r,this,s);let l=await this.options.onMutate?.(r,s);l!==this.state.context&&I(this,Ye,Pt).call(this,{type:"pending",context:l,variables:r,isPaused:a})}let i=await c(this,or).start();return await c(this,_e).config.onSuccess?.(i,r,this.state.context,this,s),await this.options.onSuccess?.(i,r,this.state.context,s),await c(this,_e).config.onSettled?.(i,null,this.state.variables,this.state.context,this,s),await this.options.onSettled?.(i,null,r,this.state.context,s),I(this,Ye,Pt).call(this,{type:"success",data:i}),i}catch(i){try{await c(this,_e).config.onError?.(i,r,this.state.context,this,s)}catch(l){Promise.reject(l)}try{await this.options.onError?.(i,r,this.state.context,s)}catch(l){Promise.reject(l)}try{await c(this,_e).config.onSettled?.(void 0,i,this.state.variables,this.state.context,this,s)}catch(l){Promise.reject(l)}try{await this.options.onSettled?.(void 0,i,r,this.state.context,s)}catch(l){Promise.reject(l)}throw I(this,Ye,Pt).call(this,{type:"error",error:i}),i}finally{c(this,_e).runNext(this)}}},no=new WeakMap,Xe=new WeakMap,_e=new WeakMap,or=new WeakMap,Ye=new WeakSet,Pt=function(r){let o=s=>{switch(r.type){case"failed":return{...s,failureCount:r.failureCount,failureReason:r.error};case"pause":return{...s,isPaused:!0};case"continue":return{...s,isPaused:!1};case"pending":return{...s,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{...s,data:r.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...s,data:void 0,error:r.error,failureCount:s.failureCount+1,failureReason:r.error,isPaused:!1,status:"error"}}};this.state=o(this.state),te.batch(()=>{c(this,Xe).forEach(s=>{s.onMutationUpdate(r)}),c(this,_e).notify({mutation:this,type:"updated",action:r})})},sa);function qs(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var ht,Ge,ao,aa,ia=(aa=class extends Ke{constructor(r={}){super();P(this,ht);P(this,Ge);P(this,ao);this.config=r,E(this,ht,new Set),E(this,Ge,new Map),E(this,ao,0)}build(r,o,s){let n=new na({client:r,mutationCache:this,mutationId:++Jr(this,ao)._,options:r.defaultMutationOptions(o),state:s});return this.add(n),n}add(r){c(this,ht).add(r);let o=jo(r);if(typeof o=="string"){let s=c(this,Ge).get(o);s?s.push(r):c(this,Ge).set(o,[r])}this.notify({type:"added",mutation:r})}remove(r){if(c(this,ht).delete(r)){let o=jo(r);if(typeof o=="string"){let s=c(this,Ge).get(o);if(s)if(s.length>1){let n=s.indexOf(r);n!==-1&&s.splice(n,1)}else s[0]===r&&c(this,Ge).delete(o)}}this.notify({type:"removed",mutation:r})}canRun(r){let o=jo(r);if(typeof o=="string"){let n=c(this,Ge).get(o)?.find(a=>a.state.status==="pending");return!n||n===r}else return!0}runNext(r){let o=jo(r);return typeof o=="string"?c(this,Ge).get(o)?.find(n=>n!==r&&n.state.isPaused)?.continue()??Promise.resolve():Promise.resolve()}clear(){te.batch(()=>{c(this,ht).forEach(r=>{this.notify({type:"removed",mutation:r})}),c(this,ht).clear(),c(this,Ge).clear()})}getAll(){return Array.from(c(this,ht))}find(r){let o={exact:!0,...r};return this.getAll().find(s=>Qo(o,s))}findAll(r={}){return this.getAll().filter(o=>Qo(r,o))}notify(r){te.batch(()=>{this.listeners.forEach(o=>{o(r)})})}resumePausedMutations(){let r=this.getAll().filter(o=>o.state.isPaused);return te.batch(()=>Promise.all(r.map(o=>o.continue().catch(ie))))}},ht=new WeakMap,Ge=new WeakMap,ao=new WeakMap,aa);function jo(e){return e.options.scope?.id}var yt,At,Me,gt,vt,Io,Os,la,Ds=(la=class extends Ke{constructor(r,o){super();P(this,vt);P(this,yt);P(this,At);P(this,Me);P(this,gt);E(this,yt,r),this.setOptions(o),this.bindMethods(),I(this,vt,Io).call(this)}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(r){let o=this.options;this.options=c(this,yt).defaultMutationOptions(r),gr(this.options,o)||c(this,yt).getMutationCache().notify({type:"observerOptionsUpdated",mutation:c(this,Me),observer:this}),o?.mutationKey&&this.options.mutationKey&&We(o.mutationKey)!==We(this.options.mutationKey)?this.reset():c(this,Me)?.state.status==="pending"&&c(this,Me).setOptions(this.options)}onUnsubscribe(){this.hasListeners()||c(this,Me)?.removeObserver(this)}onMutationUpdate(r){I(this,vt,Io).call(this),I(this,vt,Os).call(this,r)}getCurrentResult(){return c(this,At)}reset(){c(this,Me)?.removeObserver(this),E(this,Me,void 0),I(this,vt,Io).call(this),I(this,vt,Os).call(this)}mutate(r,o){return E(this,gt,o),c(this,Me)?.removeObserver(this),E(this,Me,c(this,yt).getMutationCache().build(c(this,yt),this.options)),c(this,Me).addObserver(this),c(this,Me).execute(r)}},yt=new WeakMap,At=new WeakMap,Me=new WeakMap,gt=new WeakMap,vt=new WeakSet,Io=function(){let r=c(this,Me)?.state??qs();E(this,At,{...r,isPending:r.status==="pending",isSuccess:r.status==="success",isError:r.status==="error",isIdle:r.status==="idle",mutate:this.mutate,reset:this.reset})},Os=function(r){te.batch(()=>{if(c(this,gt)&&this.hasListeners()){let o=c(this,At).variables,s=c(this,At).context,n={client:c(this,yt),meta:this.options.meta,mutationKey:this.options.mutationKey};if(r?.type==="success"){try{c(this,gt).onSuccess?.(r.data,o,s,n)}catch(a){Promise.reject(a)}try{c(this,gt).onSettled?.(r.data,null,o,s,n)}catch(a){Promise.reject(a)}}else if(r?.type==="error"){try{c(this,gt).onError?.(r.error,o,s,n)}catch(a){Promise.reject(a)}try{c(this,gt).onSettled?.(void 0,r.error,o,s,n)}catch(a){Promise.reject(a)}}}this.listeners.forEach(o=>{o(c(this,At))})})},la);var et,ua,ca=(ua=class extends Ke{constructor(r={}){super();P(this,et);this.config=r,E(this,et,new Map)}build(r,o,s){let n=o.queryKey,a=o.queryHash??Wr(n,o),i=this.get(a);return i||(i=new Xn({client:r,queryKey:n,queryHash:a,options:r.defaultQueryOptions(o),state:s,defaultOptions:r.getQueryDefaults(n)}),this.add(i)),i}add(r){c(this,et).has(r.queryHash)||(c(this,et).set(r.queryHash,r),this.notify({type:"added",query:r}))}remove(r){let o=c(this,et).get(r.queryHash);o&&(r.destroy(),o===r&&c(this,et).delete(r.queryHash),this.notify({type:"removed",query:r}))}clear(){te.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 o={exact:!0,...r};return this.getAll().find(s=>Do(o,s))}findAll(r={}){let o=this.getAll();return Object.keys(r).length>0?o.filter(s=>Do(r,s)):o}notify(r){te.batch(()=>{this.listeners.forEach(o=>{o(r)})})}onFocus(){te.batch(()=>{this.getAll().forEach(r=>{r.onFocus()})})}onOnline(){te.batch(()=>{this.getAll().forEach(r=>{r.onOnline()})})}},et=new WeakMap,ua);var le,Mt,Ft,Sr,Pr,qt,Ar,Mr,pa,Qs=(pa=class{constructor(e={}){P(this,le);P(this,Mt);P(this,Ft);P(this,Sr);P(this,Pr);P(this,qt);P(this,Ar);P(this,Mr);E(this,le,e.queryCache||new ca),E(this,Mt,e.mutationCache||new ia),E(this,Ft,e.defaultOptions||{}),E(this,Sr,new Map),E(this,Pr,new Map),E(this,qt,0)}mount(){Jr(this,qt)._++,c(this,qt)===1&&(E(this,Ar,yr.subscribe(async e=>{e&&(await this.resumePausedMutations(),c(this,le).onFocus())})),E(this,Mr,_r.subscribe(async e=>{e&&(await this.resumePausedMutations(),c(this,le).onOnline())})))}unmount(){var e,r;Jr(this,qt)._--,c(this,qt)===0&&((e=c(this,Ar))==null||e.call(this),E(this,Ar,void 0),(r=c(this,Mr))==null||r.call(this),E(this,Mr,void 0))}isFetching(e){return c(this,le).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return c(this,Mt).findAll({...e,status:"pending"}).length}getQueryData(e){let r=this.defaultQueryOptions({queryKey:e});return c(this,le).get(r.queryHash)?.state.data}ensureQueryData(e){let r=this.defaultQueryOptions(e),o=c(this,le).build(this,r),s=o.state.data;return s===void 0?this.fetchQuery(e):(e.revalidateIfStale&&o.isStaleByTime(He(r.staleTime,o))&&this.prefetchQuery(r),Promise.resolve(s))}getQueriesData(e){return c(this,le).findAll(e).map(({queryKey:r,state:o})=>{let s=o.data;return[r,s]})}setQueryData(e,r,o){let s=this.defaultQueryOptions({queryKey:e}),a=c(this,le).get(s.queryHash)?.state.data,i=Ln(r,a);if(i!==void 0)return c(this,le).build(this,s).setData(i,{...o,manual:!0})}setQueriesData(e,r,o){return te.batch(()=>c(this,le).findAll(e).map(({queryKey:s})=>[s,this.setQueryData(s,r,o)]))}getQueryState(e){let r=this.defaultQueryOptions({queryKey:e});return c(this,le).get(r.queryHash)?.state}removeQueries(e){let r=c(this,le);te.batch(()=>{r.findAll(e).forEach(o=>{r.remove(o)})})}resetQueries(e,r){let o=c(this,le);return te.batch(()=>(o.findAll(e).forEach(s=>{s.reset()}),this.refetchQueries({type:"active",...e},r)))}cancelQueries(e,r={}){let o={revert:!0,...r},s=te.batch(()=>c(this,le).findAll(e).map(n=>n.cancel(o)));return Promise.all(s).then(ie).catch(ie)}invalidateQueries(e,r={}){return te.batch(()=>(c(this,le).findAll(e).forEach(o=>{o.invalidate()}),e?.refetchType==="none"?Promise.resolve():this.refetchQueries({...e,type:e?.refetchType??e?.type??"active"},r)))}refetchQueries(e,r={}){let o={...r,cancelRefetch:r.cancelRefetch??!0},s=te.batch(()=>c(this,le).findAll(e).filter(n=>!n.isDisabled()&&!n.isStatic()).map(n=>{let a=n.fetch(void 0,o);return o.throwOnError||(a=a.catch(ie)),n.state.fetchStatus==="paused"?Promise.resolve():a}));return Promise.all(s).then(ie)}fetchQuery(e){let r=this.defaultQueryOptions(e);r.retry===void 0&&(r.retry=!1);let o=c(this,le).build(this,r);return o.isStaleByTime(He(r.staleTime,o))?o.fetch(r):Promise.resolve(o.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(ie).catch(ie)}fetchInfiniteQuery(e){return e._type="infinite",this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(ie).catch(ie)}ensureInfiniteQueryData(e){return e._type="infinite",this.ensureQueryData(e)}resumePausedMutations(){return _r.isOnline()?c(this,Mt).resumePausedMutations():Promise.resolve()}getQueryCache(){return c(this,le)}getMutationCache(){return c(this,Mt)}getDefaultOptions(){return c(this,Ft)}setDefaultOptions(e){E(this,Ft,e)}setQueryDefaults(e,r){c(this,Sr).set(We(e),{queryKey:e,defaultOptions:r})}getQueryDefaults(e){let r=[...c(this,Sr).values()],o={};return r.forEach(s=>{zt(e,s.queryKey)&&Object.assign(o,s.defaultOptions)}),o}setMutationDefaults(e,r){c(this,Pr).set(We(e),{mutationKey:e,defaultOptions:r})}getMutationDefaults(e){let r=[...c(this,Pr).values()],o={};return r.forEach(s=>{zt(e,s.mutationKey)&&Object.assign(o,s.defaultOptions)}),o}defaultQueryOptions(e){if(e._defaulted)return e;let r={...c(this,Ft).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return r.queryHash||(r.queryHash=Wr(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===vr&&(r.enabled=!1),r}defaultMutationOptions(e){return e?._defaulted?e:{...c(this,Ft).mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){c(this,le).clear(),c(this,Mt).clear()}},le=new WeakMap,Mt=new WeakMap,Ft=new WeakMap,Sr=new WeakMap,Pr=new WeakMap,qt=new WeakMap,Ar=new WeakMap,Mr=new WeakMap,pa);var sr,ne,Ls,da,io=0,xa=[],ue=ee,fa=ue.__b,ma=ue.__r,ha=ue.diffed,ya=ue.__c,ga=ue.unmount,va=ue.__;function lo(e,r){ue.__h&&ue.__h(ne,e,io||r),io=0;var o=ne.__H||(ne.__H={__:[],__h:[]});return e>=o.__.length&&o.__.push({}),o.__[e]}function b(e){return io=1,ql(Ta,e)}function ql(e,r,o){var s=lo(sr++,2);if(s.t=e,!s.__c&&(s.__=[o?o(r):Ta(void 0,r),function(l){var f=s.__N?s.__N[0]:s.__[0],p=s.t(f,l);f!==p&&(s.__N=[p,s.__[1]],s.__c.setState({}))}],s.__c=ne,!ne.__f)){var n=function(l,f,p){if(!s.__c.__H)return!0;var m=s.__c.__H.__.filter(function(y){return y.__c});if(m.every(function(y){return!y.__N}))return!a||a.call(this,l,f,p);var d=s.__c.props!==l;return m.some(function(y){if(y.__N){var h=y.__[0];y.__=y.__N,y.__N=void 0,h!==y.__[0]&&(d=!0)}}),a&&a.call(this,l,f,p)||d};ne.__f=!0;var a=ne.shouldComponentUpdate,i=ne.componentWillUpdate;ne.componentWillUpdate=function(l,f,p){if(this.__e){var m=a;a=void 0,n(l,f,p),a=m}i&&i.call(this,l,f,p)},ne.shouldComponentUpdate=n}return s.__N||s.__}function G(e,r){var o=lo(sr++,3);!ue.__s&&Us(o.__H,r)&&(o.__=e,o.u=r,ne.__H.__h.push(o))}function _a(e,r){var o=lo(sr++,4);!ue.__s&&Us(o.__H,r)&&(o.__=e,o.u=r,ne.__h.push(o))}function he(e){return io=5,nr(function(){return{current:e}},[])}function nr(e,r){var o=lo(sr++,7);return Us(o.__H,r)&&(o.__=e(),o.__H=r,o.__h=e),o.__}function ar(e,r){return io=8,nr(function(){return e},r)}function Fr(e){var r=ne.context[e.__c],o=lo(sr++,9);return o.c=e,r?(o.__==null&&(o.__=!0,r.sub(ne)),r.props.value):e.__}function Ol(){for(var e;e=xa.shift();){var r=e.__H;if(e.__P&&r)try{r.__h.some($o),r.__h.some(Ks),r.__h=[]}catch(o){r.__h=[],ue.__e(o,e.__v)}}}ue.__b=function(e){ne=null,fa&&fa(e)},ue.__=function(e,r){e&&r.__k&&r.__k.__m&&(e.__m=r.__k.__m),va&&va(e,r)},ue.__r=function(e){ma&&ma(e),sr=0;var r=(ne=e.__c).__H;r&&(Ls===ne?(r.__h=[],ne.__h=[],r.__.some(function(o){o.__N&&(o.__=o.__N),o.u=o.__N=void 0})):(r.__h.some($o),r.__h.some(Ks),r.__h=[],sr=0)),Ls=ne},ue.diffed=function(e){ha&&ha(e);var r=e.__c;r&&r.__H&&(r.__H.__h.length&&(xa.push(r)!==1&&da===ue.requestAnimationFrame||((da=ue.requestAnimationFrame)||Dl)(Ol)),r.__H.__.some(function(o){o.u&&(o.__H=o.u),o.u=void 0})),Ls=ne=null},ue.__c=function(e,r){r.some(function(o){try{o.__h.some($o),o.__h=o.__h.filter(function(s){return!s.__||Ks(s)})}catch(s){r.some(function(n){n.__h&&(n.__h=[])}),r=[],ue.__e(s,o.__v)}}),ya&&ya(e,r)},ue.unmount=function(e){ga&&ga(e);var r,o=e.__c;o&&o.__H&&(o.__H.__.some(function(s){try{$o(s)}catch(n){r=n}}),o.__H=void 0,r&&ue.__e(r,o.__v))};var ba=typeof requestAnimationFrame=="function";function Dl(e){var r,o=function(){clearTimeout(s),ba&&cancelAnimationFrame(r),setTimeout(e)},s=setTimeout(o,35);ba&&(r=requestAnimationFrame(o))}function $o(e){var r=ne,o=e.__c;typeof o=="function"&&(e.__c=void 0,o()),ne=r}function Ks(e){var r=ne;e.__c=e.__(),ne=r}function Us(e,r){return!e||e.length!==r.length||r.some(function(o,s){return o!==e[s]})}function Ta(e,r){return typeof r=="function"?r(e):r}var wa=mr(!1),Ca=()=>Fr(wa),ff=wa.Provider;var Ql=0;function t(e,r,o,s,n,a){r||(r={});var i,l,f=r;if("ref"in f)for(l in f={},r)l=="ref"?i=r[l]:f[l]=r[l];var p={type:e,props:f,key:o,ref:i,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--Ql,__i:-1,__u:0,__source:n,__self:a};if(typeof e=="function"&&(i=e.defaultProps))for(l in i)f[l]===void 0&&(f[l]=i[l]);return ee.vnode&&ee.vnode(p),p}var Ns=mr(void 0),uo=e=>{let r=Fr(Ns);if(e)return e;if(!r)throw new Error("No QueryClient set, use QueryClientProvider to set one");return r},qr=({client:e,children:r})=>(G(()=>(e.mount(),()=>{e.unmount()}),[e]),t(Ns.Provider,{value:e,children:r}));function Ll(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var Kl=mr(Ll()),Ea=()=>Fr(Kl);var Ra=(e,r)=>{(e.suspense||e.throwOnError||e.experimental_prefetchInRender)&&(r.isReset()||(e.retryOnMount=!1))},ka=e=>{G(()=>{e.clearReset()},[e])},Sa=({result:e,errorResetBoundary:r,throwOnError:o,query:s,suspense:n})=>e.isError&&!r.isReset()&&!e.isFetching&&s&&(n&&e.data===void 0||Xr(o,[e.error,s]));var Pa=e=>{if(e.suspense){let o=n=>n==="static"?n:Math.max(n??1e3,1e3),s=e.staleTime;e.staleTime=typeof s=="function"?(...n)=>o(s(...n)):o(s),typeof e.gcTime=="number"&&(e.gcTime=Math.max(e.gcTime,1e3))}},Aa=(e,r)=>e.isLoading&&e.isFetching&&!r,Ma=(e,r)=>e?.suspense&&r.isPending,js=(e,r,o)=>r.fetchOptimistic(e).catch(()=>{o.clearReset()});function Vo(e,r){let o=r(),[{_instance:s},n]=b({_instance:{_value:o,_getSnapshot:r}});return _a(()=>{s._value=o,s._getSnapshot=r,Is(s)&&n({_instance:s})},[e,o,r]),G(()=>(Is(s)&&n({_instance:s}),e(()=>{Is(s)&&n({_instance:s})})),[e]),o}function Is(e){let r=e._getSnapshot,o=e._value;try{let s=r();return!Object.is(o,s)}catch{return!0}}function Ho(e,r,o){let s=Ca(),n=Ea(),a=uo(o),i=a.defaultQueryOptions(e);a.getDefaultOptions().queries?._experimental_beforeQuery?.(i),i._optimisticResults=s?"isRestoring":"optimistic",Pa(i),Ra(i,n),ka(n);let l=!a.getQueryCache().get(i.queryHash),[f]=b(()=>new r(a,i)),p=f.getOptimisticResult(i),m=!s&&e.subscribed!==!1;if(Vo(ar(d=>{let y=m?f.subscribe(te.batchCalls(d)):ie;return f.updateResult(),y},[f,m]),()=>f.getCurrentResult()),G(()=>{f.setOptions(i)},[i,f]),Ma(i,p))throw js(i,f,n);if(Sa({result:p,errorResetBoundary:n,throwOnError:i.throwOnError,query:a.getQueryCache().get(i.queryHash),suspense:i.suspense}))throw p.error;return a.getDefaultOptions().queries?._experimental_afterQuery?.(i,p),i.experimental_prefetchInRender&&!Ze.isServer()&&Aa(p,s)&&(l?js(i,f,n):a.getQueryCache().get(i.queryHash)?.promise)?.catch(ie).finally(()=>{f.updateResult()}),i.notifyOnChangeProps?p:f.trackResult(p)}function Ot(e,r){return Ho(e,so,r)}function ge(e,r){let o=uo(r),[s]=b(()=>new Ds(o,e));G(()=>{s.setOptions(e)},[s,e]);let n=Vo(ar(i=>s.subscribe(te.batchCalls(i)),[s]),()=>s.getCurrentResult()),a=ar((i,l)=>{s.mutate(i,l).catch(ie)},[s]);if(n.error&&Xr(s.options.throwOnError,[n.error]))throw n.error;return{...n,mutate:a,mutateAsync:n.mutate}}function Or(e,r){return Ho(e,Fs,r)}var $s="profiler-active-slave",Go=(()=>{try{let e=sessionStorage.getItem($s);return e?`/slaves/${e}`:""}catch{return""}})();function Fa(){return Go}function qa(){return Go?Go.replace("/slaves/",""):null}function Oa(e){try{e?sessionStorage.setItem($s,e):sessionStorage.removeItem($s)}catch{}Go=e?`/slaves/${e}`:"",window.location.reload()}var Ul="/_profiler/api/cluster/";async function se(e){let r=e.url.startsWith(Ul)?"":Fa(),o=r?e.url.replace("/_profiler/api",`/_profiler/api${r}`):e.url,{method:s,params:n,data:a,headers:i={},signal:l}=e,f=o,p=n?"?"+new URLSearchParams(Object.entries(n).map(([h,g])=>[h,String(g)])).toString():"",m={"X-Profiler-Request":"1",...i},d=await fetch(f+p,{method:s,signal:l,headers:a!==void 0?{"Content-Type":"application/json",...m}:m,body:a!==void 0?JSON.stringify(a):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 tt=(e,r)=>{let o={queryKey:r};for(let s of Object.keys(e))s!=="queryKey"&&Object.defineProperty(o,s,{enumerable:!0,configurable:!0,get:()=>e[s]});return o};var Nl=e=>se({url:"/_profiler/api/cluster/slaves",method:"GET",signal:e});var jl=()=>["/_profiler/api/cluster/slaves"];var Il=e=>{let{query:r}=e??{};return{queryKey:r?.queryKey??jl(),queryFn:({signal:n})=>Nl(n),...r}};function Da(e){let r=Il(e),o=Ot(r);return tt(o,r.queryKey)}var Vs=(e,r)=>se({url:"/_profiler/api/console",method:"GET",params:e,signal:r}),$l=e=>["infinite","/_profiler/api/console",...e?[e]:[]];var Vl=(e,r)=>{let{query:o}=r??{};return{queryKey:o?.queryKey??$l(e),queryFn:({signal:a})=>Vs(e,a),...o}};function Qa(e,r){let o=Vl(e,r),s=Or(o);return tt(s,o.queryKey)}var Hl=(e,r)=>se({url:`/_profiler/api/console/${e}`,method:"DELETE",signal:r}),Gl=()=>["deleteConsole"],Bl=e=>{let r=Gl(),{mutation:o}=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:a}=n??{};return Hl(a)},...o}},La=e=>ge(Bl(e)),Jl=e=>se({url:"/_profiler/api/console/clear",method:"DELETE",signal:e}),zl=()=>["clearConsoles"],Wl=e=>{let r=zl(),{mutation:o}=e?e.mutation&&"mutationKey"in e.mutation&&e.mutation.mutationKey?e:{...e,mutation:{...e.mutation,mutationKey:r}}:{mutation:{mutationKey:r}};return{mutationFn:()=>Jl(),...o}},Ka=e=>ge(Wl(e)),Hs=e=>se({url:"/_profiler/api/env_vars",method:"GET",signal:e}),Zl=()=>["/_profiler/api/env_vars"],Xl=e=>{let{query:r}=e??{};return{queryKey:r?.queryKey??Zl(),queryFn:({signal:n})=>Hs(n),...r}};function Ua(e){let r=Xl(e),o=Ot(r);return tt(o,r.queryKey)}var Yl=(e,r)=>se({url:"/_profiler/api/env_vars",method:"PATCH",headers:{"Content-Type":"application/json"},data:e,signal:r}),eu=()=>["updateEnvVar"],tu=e=>{let r=eu(),{mutation:o}=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:a}=n??{};return Yl(a)},...o}},Na=e=>ge(tu(e)),ru=(e,r)=>se({url:"/_profiler/api/env_vars/reset",method:"DELETE",params:e,signal:r}),ou=()=>["resetEnvVar"],su=e=>{let r=ou(),{mutation:o}=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:a}=n??{};return ru(a)},...o}},ja=e=>ge(su(e)),nu=e=>se({url:"/_profiler/api/env_vars/reset_all",method:"DELETE",signal:e}),au=()=>["resetAllEnvVars"],iu=e=>{let r=au(),{mutation:o}=e?e.mutation&&"mutationKey"in e.mutation&&e.mutation.mutationKey?e:{...e,mutation:{...e.mutation,mutationKey:r}}:{mutation:{mutationKey:r}};return{mutationFn:()=>nu(),...o}},Ia=e=>ge(iu(e));var lu=(e,r)=>se({url:"/_profiler/api/explain",method:"POST",headers:{"Content-Type":"application/json"},data:e,signal:r}),uu=()=>["explainQuery"],cu=e=>{let r=uu(),{mutation:o}=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:a}=n??{};return lu(a)},...o}},$a=e=>ge(cu(e)),pu=e=>se({url:"/_profiler/api/config",method:"GET",signal:e}),Gs=()=>["/_profiler/api/config"],du=e=>{let{query:r}=e??{};return{queryKey:r?.queryKey??Gs(),queryFn:({signal:n})=>pu(n),...r}};function Va(e){let r=du(e),o=Ot(r);return tt(o,r.queryKey)}var fu=(e,r)=>se({url:"/_profiler/api/function_profiling",method:"PATCH",headers:{"Content-Type":"application/json"},data:e,signal:r}),mu=()=>["updateFunctionProfiling"],hu=e=>{let r=mu(),{mutation:o}=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:a}=n??{};return fu(a)},...o}},Ha=e=>ge(hu(e)),Bs=(e,r)=>se({url:"/_profiler/api/jobs",method:"GET",params:e,signal:r}),yu=e=>["infinite","/_profiler/api/jobs",...e?[e]:[]];var gu=(e,r)=>{let{query:o}=r??{};return{queryKey:o?.queryKey??yu(e),queryFn:({signal:a})=>Bs(e,a),...o}};function Ga(e,r){let o=gu(e,r),s=Or(o);return tt(s,o.queryKey)}var vu=(e,r)=>se({url:`/_profiler/api/jobs/${e}`,method:"DELETE",signal:r}),bu=()=>["deleteJob"],xu=e=>{let r=bu(),{mutation:o}=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:a}=n??{};return vu(a)},...o}},Ba=e=>ge(xu(e)),_u=e=>se({url:"/_profiler/api/jobs/clear",method:"DELETE",signal:e}),Tu=()=>["clearJobs"],wu=e=>{let r=Tu(),{mutation:o}=e?e.mutation&&"mutationKey"in e.mutation&&e.mutation.mutationKey?e:{...e,mutation:{...e.mutation,mutationKey:r}}:{mutation:{mutationKey:r}};return{mutationFn:()=>_u(),...o}},Ja=e=>ge(wu(e)),Cu=e=>se({url:"/_profiler/api/outbound_http",method:"GET",signal:e}),Eu=()=>["/_profiler/api/outbound_http"],Ru=e=>{let{query:r}=e??{};return{queryKey:r?.queryKey??Eu(),queryFn:({signal:n})=>Cu(n),...r}};function za(e){let r=Ru(e),o=Ot(r);return tt(o,r.queryKey)}var Bo=(e,r)=>se({url:"/_profiler/api/profiles",method:"GET",params:e,signal:r}),ku=e=>["infinite","/_profiler/api/profiles",...e?[e]:[]],Su=e=>["/_profiler/api/profiles",...e?[e]:[]],Pu=(e,r)=>{let{query:o}=r??{};return{queryKey:o?.queryKey??ku(e),queryFn:({signal:a})=>Bo(e,a),...o}};function Wa(e,r){let o=Pu(e,r),s=Or(o);return tt(s,o.queryKey)}var Au=(e,r)=>{let{query:o}=r??{};return{queryKey:o?.queryKey??Su(e),queryFn:({signal:a})=>Bo(e,a),...o}};function Za(e,r){let o=Au(e,r),s=Ot(o);return tt(s,o.queryKey)}var Mu=(e,r)=>se({url:`/_profiler/api/profiles/${e}`,method:"DELETE",signal:r}),Fu=()=>["deleteProfile"],qu=e=>{let r=Fu(),{mutation:o}=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:a}=n??{};return Mu(a)},...o}},Xa=e=>ge(qu(e)),Ou=e=>se({url:"/_profiler/api/profiles/clear",method:"DELETE",signal:e}),Du=()=>["clearProfiles"],Qu=e=>{let r=Du(),{mutation:o}=e?e.mutation&&"mutationKey"in e.mutation&&e.mutation.mutationKey?e:{...e,mutation:{...e.mutation,mutationKey:r}}:{mutation:{mutationKey:r}};return{mutationFn:()=>Ou(),...o}},Ya=e=>ge(Qu(e)),Lu=(e,r)=>se({url:"/_profiler/api/test_runner/files",method:"GET",params:e,signal:r}),Ku=e=>["/_profiler/api/test_runner/files",...e?[e]:[]],Uu=(e,r)=>{let{query:o}=r??{};return{queryKey:o?.queryKey??Ku(e),queryFn:({signal:a})=>Lu(e,a),...o}};function ei(e,r){let o=Uu(e,r),s=Ot(o);return tt(s,o.queryKey)}var Nu=(e,r)=>se({url:"/_profiler/api/test_runner/runs",method:"POST",headers:{"Content-Type":"application/json"},data:e,signal:r}),ju=()=>["createTestRun"],Iu=e=>{let r=ju(),{mutation:o}=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:a}=n??{};return Nu(a)},...o}},ti=e=>ge(Iu(e));var $u=(e,r)=>se({url:`/_profiler/api/test_runner/runs/${e}`,method:"DELETE",signal:r}),Vu=()=>["deleteTestRun"],Hu=e=>{let r=Vu(),{mutation:o}=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:a}=n??{};return $u(a)},...o}},ri=e=>ge(Hu(e)),Js=(e,r)=>se({url:"/_profiler/api/tests",method:"GET",params:e,signal:r}),Gu=e=>["infinite","/_profiler/api/tests",...e?[e]:[]];var Bu=(e,r)=>{let{query:o}=r??{};return{queryKey:o?.queryKey??Gu(e),queryFn:({signal:a})=>Js(e,a),...o}};function oi(e,r){let o=Bu(e,r),s=Or(o);return tt(s,o.queryKey)}var Ju=(e,r)=>se({url:`/_profiler/api/tests/${e}`,method:"DELETE",signal:r}),zu=()=>["deleteTest"],Wu=e=>{let r=zu(),{mutation:o}=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:a}=n??{};return Ju(a)},...o}},si=e=>ge(Wu(e)),Zu=e=>se({url:"/_profiler/api/tests/clear",method:"DELETE",signal:e}),Xu=()=>["clearTests"],Yu=e=>{let r=Xu(),{mutation:o}=e?e.mutation&&"mutationKey"in e.mutation&&e.mutation.mutationKey?e:{...e,mutation:{...e.mutation,mutationKey:r}}:{mutation:{mutationKey:r}};return{mutationFn:()=>Zu(),...o}},ni=e=>ge(Yu(e));async function Dt(e){if(typeof navigator<"u"&&navigator.clipboard?.writeText)try{return await navigator.clipboard.writeText(e),!0}catch{}return ec(e)}function ec(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 o=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),o?.focus?.()}}function Be(){return document.querySelector('meta[name="profiler-version"]')?.content??""}function Te(e){return e.allocated_objects!=null?e.allocated_objects:e.memory!=null?Math.round(e.memory/40):null}function rt(e){return e==null?"-":`${e.toLocaleString("en")} objects`}var ot="Objects allocated by the whole process while this ran: on a multi-threaded server, it includes what other threads allocated meanwhile.";function ai(){let{data:e,isError:r}=Va({query:{queryKey:Gs(),staleTime:1/0,retry:!1}});return e?{scheme:e.editor_url_scheme,pathMap:e.editor_path_map}:r?{scheme:"vscode",pathMap:{}}:{scheme:null,pathMap:{}}}var tc=["vscode","idea","cursor"];function rc(e){return typeof e=="string"&&tc.includes(e)}var oc=/^[A-Za-z]:\//;function co(e){return e.replace(/\\/g,"/")}function sc(e,r){if(!r)return e;let o=null;for(let a of Object.keys(r)){let i=co(a).replace(/\/+$/,"");(e===i||e.startsWith(i+"/"))&&(o===null||i.length>co(o).replace(/\/+$/,"").length)&&(o=a)}if(o===null)return e;let s=co(o).replace(/\/+$/,"");return co(String(r[o])).replace(/\/+$/,"")+e.slice(s.length)}function nc(e){return e.startsWith("/")||oc.test(e)}function ac(e){return(e.startsWith("/")?e:"/"+e).split("/").map((o,s)=>s===1&&/^[A-Za-z]:$/.test(o)?o:encodeURIComponent(o)).join("/")}function ii(e,r,o){let{scheme:s,pathMap:n}=o;if(!rc(s)||!Number.isInteger(r)||r<1||typeof e!="string"||e===""||e.includes("\0"))return null;let a=sc(co(e),n);return nc(a)?s==="idea"?`idea://open?file=${encodeURIComponent(a)}&line=${r}`:`${s}://file${ac(a)}:${r}`:null}function li(e){let r=/^(.+?):(\d+)(?::in\b.*)?$/.exec(e);return r?{file:r[1],line:Number(r[2])}:null}function ir({file:e,line:r,children:o,class:s}){let n=ai(),a=o??`${e}:${r}`,i=ii(e,r,n);return i?t("a",{href:i,class:s,title:`Open ${e}:${r} in your editor`,rel:"noopener noreferrer","data-source-link":"",onClick:l=>l.stopPropagation(),children:a}):t("span",{class:s,children:a})}function bt({frame:e,class:r}){let o=li(e);return o?t(ir,{file:o.file,line:o.line,class:r,children:e}):t("span",{class:r,children:e})}function lr(e){return{GET:"info",POST:"success",PUT:"warning",PATCH:"warning",DELETE:"error"}[e]||"default"}function Dr(e){return e===0?"error":e>=200&&e<300?"success":e>=400?"error":"warning"}function Qr(e){return e<0?"-":e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(2)} MB`}function zs({text:e}){let[r,o]=b(null);function s(){Dt(e).then(n=>{o(n?"copied":"failed"),setTimeout(()=>o(null),2e3)})}return t("button",{onClick:s,class:"profiler-body-download-btn profiler-text--xs",style:"cursor:pointer",children:r==="copied"?"Copied!":r==="failed"?"Copy not available":"Copy"})}function fi(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 ui({text:e,mime:r}){let[o,s]=b(null);return G(()=>{let n=URL.createObjectURL(new Blob([e],{type:"application/octet-stream"}));return s(n),()=>URL.revokeObjectURL(n)},[e,r]),o?t("a",{href:o,download:`body${fi(r)}`,class:"profiler-body-download-btn profiler-text--xs",children:"Download"}):null}function ci({headers:e}){let r=Object.entries(e);return r.length?t("table",{class:"profiler-table profiler-table--compact",children:t("tbody",{children:r.map(([o,s])=>t("tr",{children:[t("td",{class:"profiler-text--xs profiler-text--muted",style:"white-space:nowrap;padding-right:16px",children:o}),t("td",{class:"profiler-text--xs",style:"word-break:break-all",children:s})]},o))})}):t("span",{class:"profiler-text--muted profiler-text--xs",children:"none"})}function ic(e){let o=(Object.entries(e).find(([s])=>s.toLowerCase()==="content-type")?.[1]||"").split(";")[0].trim().toLowerCase();return o.includes("json")?"json":o==="image/svg+xml"?"svg":o.startsWith("image/")?"image":o==="application/pdf"?"pdf":o.includes("xml")?"xml":o==="text/csv"||o==="application/csv"?"csv":o==="text/html"?"html":o.startsWith("application/")&&!o.includes("json")&&!o.includes("xml")&&!o.includes("javascript")?"binary":"text"}function lc(e){try{let r=0;return e.replace(/>\s*</g,"><").replace(/(<\/?[^>]+>)/g,o=>{if(o.startsWith("</"))return r=Math.max(0,r-1),`
2
+ `+" ".repeat(r)+o;if(o.endsWith("/>")||/<\?/.test(o))return`
3
+ `+" ".repeat(r)+o;let s=`
4
+ `+" ".repeat(r)+o;return r++,s}).trim()}catch{return e}}function uc(e){return e.split(`
5
+ `).filter(Boolean).map(r=>{let o=[],s="",n=!1;for(let a=0;a<r.length;a++){let i=r[a];i==='"'?n=!n:i===","&&!n?(o.push(s),s=""):s+=i}return o.push(s),o})}function cc(e,r){if(r==="json")try{return JSON.stringify(JSON.parse(e),null,2)}catch{return e}return r==="xml"?lc(e):e}function pc(e){return{json:"application/json",xml:"application/xml",csv:"text/csv",html:"text/html",svg:"image/svg+xml"}[e]||"text/plain"}var dc=["image/png","image/jpeg","image/gif","image/webp","image/avif","application/pdf"];function fc(e){let r=e.toLowerCase();return dc.includes(r)?r:"application/octet-stream"}var Ws=500,pi=10;function di({body:e,encoding:r,headers:o}){let[s,n]=b(!1),[a,i]=b(null),[l,f]=b(null),p=ic(o);if(G(()=>{if(r!=="base64"||!e)return;let g=Object.entries(o).find(([A])=>A.toLowerCase()==="content-type")?.[1]?.split(";")[0].trim()||"application/octet-stream",v=atob(e),x=new Uint8Array(v.length);for(let A=0;A<v.length;A++)x[A]=v.charCodeAt(A);let w=URL.createObjectURL(new Blob([x],{type:fc(g)})),C=URL.createObjectURL(new Blob([x],{type:"application/octet-stream"}));return i(w),f(C),()=>{URL.revokeObjectURL(w),URL.revokeObjectURL(C)}},[e,r,o]),!e)return t("span",{class:"profiler-text--muted profiler-text--xs",children:"empty"});if(r==="base64"){let g=Object.entries(o).find(([x])=>x.toLowerCase()==="content-type")?.[1]?.split(";")[0].trim()||"application/octet-stream",v=`body${fi(g)}`;return t("div",{class:"profiler-body-binary",children:[a&&p==="image"&&t("img",{src:a,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)"}),a&&p==="pdf"&&t("iframe",{src:a,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(zs,{text:e})]}),!a&&t("span",{class:"profiler-text--muted profiler-text--xs",children:"Loading preview\u2026"})]})}let m=Object.entries(o).find(([g])=>g.toLowerCase()==="content-type")?.[1]?.split(";")[0].trim()||pc(p);if(p==="csv"){let g=uc(e),v=g[0]||[],x=g.slice(1),w=s?x:x.slice(0,pi),C=x.length>pi;return t("div",{children:[t("div",{style:"display:flex;gap:8px;margin-bottom:6px",children:[t(zs,{text:e}),t(ui,{text:e,mime:m})]}),t("div",{style:"overflow-x:auto",children:t("table",{class:"profiler-body-csv",children:[t("thead",{children:t("tr",{children:v.map((A,k)=>t("th",{children:A},k))})}),t("tbody",{children:w.map((A,k)=>t("tr",{children:A.map((K,U)=>t("td",{children:K},U))},k))})]})}),C&&t("button",{class:"profiler-link profiler-text--xs",onClick:()=>n(A=>!A),style:"margin-top:4px;background:none;border:none;cursor:pointer;color:var(--profiler-accent);padding:0",children:s?"Show less":`Show all (${x.length} rows)`})]})}let d=cc(e,p),y=s?d:d.slice(0,Ws),h=d.length>Ws&&!s;return t("div",{children:[t("div",{style:"display:flex;gap:8px;margin-bottom:6px",children:[t(zs,{text:d}),t(ui,{text:d,mime:m})]}),t("pre",{class:"profiler-code profiler-text--xs",style:"white-space:pre-wrap;word-break:break-all;margin:0",children:[y,h?"\u2026":""]}),d.length>Ws&&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:s?"Show less":`Show all (${d.length} chars)`})]})}function Jo({request:e,response:r,backtrace:o}){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(ci,{headers:e.headers}),e.params&&Object.keys(e.params).length>0&&!e.body&&t(M,{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(M,{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(di,{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(ci,{headers:r.headers}),r.body&&t(M,{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(di,{body:r.body,encoding:r.body_encoding,headers:r.headers})]})]}),o&&o.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"}),o.map((s,n)=>t("div",{class:"profiler-text--xs profiler-text--muted",style:"padding:2px 0",children:t(bt,{frame:s})},n))]})]})}function zo({method:e,url:r,copyUrl:o,status:s,duration:n,curlCommand:a,expandable:i,open:l,onToggle:f}){let[p,m]=b(!1),[d,y]=b(!1);function h(v){v.stopPropagation(),Dt(o??r).then(x=>{x&&(m(!0),setTimeout(()=>m(!1),2e3))})}function g(v){v.stopPropagation(),Dt(a).then(x=>{x&&(y(!0),setTimeout(()=>y(!1),2e3))})}return t("div",{class:"profiler-ajax-card__row",style:i?"cursor:pointer;user-select:none":void 0,onClick:i?f:void 0,children:[t("div",{class:"profiler-flex profiler-flex--gap-3",style:"min-width:0;flex:1",children:[i&&t("span",{style:"font-size:11px;color:var(--profiler-muted)",children:l?"\u25BE":"\u25B8"}),t("span",{class:`profiler-ajax-card__method badge-${lr(e)}`,children:e}),t("strong",{class:"profiler-ajax-card__path",style:"word-break:break-all",children:r}),t("button",{onClick:h,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-${Dr(s)}`,children:s===0?"ERR":s}),t("span",{class:n>=500?"badge-error":n>=100?"badge-warning":"badge-success",children:[n.toFixed(2)," ms"]})]})]})}function mc(e,r){return e===0||e>=500?"var(--profiler-error, #ef4444)":e>=400||r>=500?"var(--profiler-warning, #f59e0b)":"var(--profiler-success, #22c55e)"}function hc({requests:e}){let r=e.filter(i=>i.started_at).map(i=>({...i,startMs:new Date(i.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 o=Math.min(...r.map(i=>i.startMs)),n=Math.max(...r.map(i=>i.startMs+i.duration))-o||1,a=[0,.25,.5,.75,1].map(i=>({pct:i*100,label:`${Math.round(i*n)}ms`}));return t("div",{children:[t("div",{style:"display:flex;position:relative;margin-left:200px;margin-bottom:4px;height:16px",children:a.map(i=>t("div",{style:`position:absolute;left:${i.pct}%;font-size:10px;color:var(--profiler-text-muted);transform:translateX(-50%)`,children:i.label},i.pct))}),t("div",{style:"position:relative",children:[a.map(i=>t("div",{style:`position:absolute;left:calc(200px + ${i.pct}% * (100% - 200px) / 100);top:0;bottom:0;width:1px;background:var(--profiler-border);opacity:0.5;pointer-events:none`},i.pct)),r.map((i,l)=>{let f=(i.startMs-o)/n*100,p=Math.max(i.duration/n*100,.5),m=i.url.replace(/^https?:\/\/[^/]+/,"")||i.url,d=mc(i.status,i.duration);return t("div",{style:"display:flex;align-items:center;gap:0;margin-bottom:3px;height:22px",children:[t("div",{title:i.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:i.method}),m]}),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:`${i.duration.toFixed(2)}ms \xB7 ${i.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:[i.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 yc(e){let r=[`curl -X ${e.method}`],o=e.request_headers||{};for(let[s,n]of Object.entries(o))r.push(` -H ${JSON.stringify(`${s}: ${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 gc(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 Zs({req:e,index:r,threshold:o}){let[s,n]=b(!1),a=e.status>=400||e.status===0,i=e.duration>=o;return t("div",{class:`profiler-ajax-card ${a?"profiler-ajax-card--error":i?"profiler-ajax-card--warning":"profiler-ajax-card--success"}`,style:"margin-bottom:8px",children:[t(zo,{method:e.method,url:e.url,status:e.status,duration:e.duration,curlCommand:yc(e),expandable:!0,open:s,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 ":""}${Qr(e.request_size)}`," \xB7 \u2193 ",Qr(e.response_size)]}),e.backtrace&&e.backtrace.length>0&&t("span",{class:"profiler-text--xs profiler-text--muted",style:"margin-left:12px",children:t(bt,{frame:e.backtrace[0]})})]}),gc(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})}),s&&t(Jo,{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 Lr({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,o=e.total_duration/e.total_requests;return t(M,{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:[o.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(([s,n])=>t("div",{class:"profiler-kv-row",children:[t("span",{class:"profiler-text--sm",children:s}),t("strong",{children:n})]},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,n])=>t("div",{class:"profiler-kv-row",children:[t("span",{class:`badge-${s.startsWith("2")?"success":s.startsWith("4")||s.startsWith("5")||s==="error"?"error":"warning"}`,children:s}),t("strong",{children:n})]},s))]})]}),t("h3",{class:"profiler-text--lg profiler-mb-3",children:"Requests"}),t(hc,{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((s,n)=>t(Zs,{req:s,index:n,threshold:r},n))]})]})}var mi="[FILTERED]";function vc(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 bc(e){let r=e.indexOf("_");return r>0?e.slice(0,r):"OTHER"}function xc(e){let r={};for(let o of e.split(`
7
+ `)){let s=o.trim();if(!s||s.startsWith("#"))continue;let n=s.indexOf("=");if(n<1)continue;let a=s.slice(0,n).trim(),i=s.slice(n+1);(i.startsWith('"')&&i.endsWith('"')||i.startsWith("'")&&i.endsWith("'"))&&(i=i.slice(1,-1)),r[a]=i}return r}function _c(){try{let e=localStorage.getItem("profiler_unmasked_env_keys");return e?new Set(JSON.parse(e)):new Set}catch{return new Set}}function Xs(e){try{localStorage.setItem("profiler_unmasked_env_keys",JSON.stringify([...e]))}catch{}}function hi({value:e}){let r=vc(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 yi(e){return/^(true|false|yes|no)$/i.test(e)}function Ys(e){return!(e===""||yi(e)||/^\d+(\.\d+)?$/.test(e))}function st({envData:e,readOnly:r=!1}){let[o,s]=b(()=>({...e?.variables??{}})),[n,a]=b(o),[i,l]=b(e?.overrides??{}),[f,p]=b(e?.total??0),[m,d]=b(""),[y,h]=b(new Set),[g,v]=b(null),[x,w]=b(""),[C,A]=b(""),[k,K]=b(""),[U,L]=b(null),[j,T]=b(!1),[F,$]=b(!1),[Z,B]=b(_c),[ce,fe]=b(null),[Y,Fe]=b(r),[Ne,je]=b(!1),[De,ve]=b(""),we=he(null),{mutateAsync:qe}=Na(),{mutateAsync:nt}=ja(),{mutateAsync:S}=Ia();G(()=>{g!==null&&we.current?.focus()},[g]),G(()=>{r||Q()},[]);let H=(_,D)=>{L({type:_,message:D}),setTimeout(()=>L(null),3e3)},Ce=_=>{B(D=>{let O=new Set(D);return O.has(_)?O.delete(_):O.add(_),Xs(O),O})},at=async(_,D)=>{await Dt(_)?(fe(D),setTimeout(()=>fe(null),1500)):H("error","Copy is not available in this browser: select the value and copy it by hand")},ur=_=>{h(D=>{let O=new Set(D);return O.has(_)?O.delete(_):O.add(_),O})},Q=async()=>{$(!0);try{let _=await Hs();return a(_.variables),p(_.total),l(_.overrides??{}),H("success",`Refreshed - ${_.total} variables`),_}catch(_){H("error",_.message??"Failed to refresh")}finally{$(!1)}},W=()=>{let _=ut,D=_.map(([Re,Je])=>`${Re}=${Je}`).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),I("success",`Exported ${b.length} variables`)},Ne=Yt(()=>ac(qe),[qe]),Me=Yt(()=>Object.fromEntries(Object.entries(Ne).filter(([,b])=>b!==oa)),[Ne]),Fe=Object.keys(Me).length,De=Object.keys(Ne).length-Fe,Ut=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`:"";I("success",`Imported ${b.length} variables${q}`)}catch(q){I("error",q.message??"Import failed")}finally{D(!1)}}},ue=b=>{v(b),T(n[b]??"")},at=()=>{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}),I("success",`${b} updated`),v(null)}catch(q){I("error",q.message??"Failed to update")}finally{D(!1)}},ps=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),Ho(A),A}),I("success",`${b} deleted`)}catch(q){I("error",q.message??"Failed to delete")}finally{D(!1)}},Ie=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){I("error",A.message??"Failed to update")}finally{D(!1)}},or=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}),P(""),K(""),I("success",`${b} added`)}catch(q){I("error",q.message??"Failed to add")}finally{D(!1)}}},te=b=>{b.key==="Enter"&&Be(),b.key==="Escape"&&at()},ds=async b=>{D(!0);try{let q=await nt({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),I("success",`${b} reset to original`)}catch(q){I("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),I("success","All overrides reset")}catch(b){I("error",b.message??"Failed to reset all")}finally{D(!1)}},Dr=Object.keys(a).length,fe=Object.entries(n),lt=Yt(()=>{let b=h.toLowerCase().trim();return b?fe.filter(([q,F])=>q.toLowerCase().includes(b)||F.toLowerCase().includes(b)):fe},[n,h]),nr=Yt(()=>{let b={};for(let q of lt){let F=ic(q[0]);(b[F]??(b[F]=[])).push(q)}return Object.entries(b).sort(([q],[F])=>q==="OTHER"?1:F==="OTHER"?-1:q.localeCompare(F))},[lt]),Qr=lt.every(([b])=>J.has(b)),ir=()=>{let b=lt.map(([q])=>q);H(q=>{let F=new Set(q);return Qr?b.forEach(A=>F.delete(A)):b.forEach(A=>F.add(A)),Ho(F),F})},Lr="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;",ut="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(S,{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(S,{children:[t("button",{onClick:Q,disabled:O,style:ut,children:O?"\u2026":"\u21BA Refresh"}),t("button",{onClick:()=>Ue(b=>!b),style:`${ut}${Ke?"border-color:var(--profiler-accent);color:var(--profiler-accent);":""}`,children:"\u2B06 Import"})]}),t("button",{onClick:B,style:ut,children:"\u2B07 Export"}),t("button",{onClick:ir,style:ut,children:Qr?"\u{1F648} Mask all":"\u{1F441} Reveal all"}),!r&&Dr>0&&t("button",{onClick:ve,disabled:N,title:"Remove all Sidekiq overrides and restore original values",style:`${ut}border-color:var(--profiler-warning,#f59e0b);color:var(--profiler-warning,#f59e0b);`,children:["\u21A9 Reset all (",Dr,")"]}),!r&&t("button",{onClick:()=>Pe(b=>!b),title:Z?"Unlock editing":"Lock editing",style:`${ut}${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."}),j&&t("div",{style:`background:${j.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 ${j.type==="success"?"var(--profiler-success,#22c55e)":"var(--profiler-error,#ef4444)"};border-radius:6px;padding:6px 12px;margin-bottom:12px;font-size:12px;color:${j.type==="success"?"var(--profiler-success,#22c55e)":"var(--profiler-error,#ef4444)"};`,children:[j.type==="success"?"\u2713":"\u2717"," ",j.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
9
+ `,O=new Blob([D],{type:"text/plain"}),q=URL.createObjectURL(O),J=document.createElement("a");J.href=q,J.download=".env",J.click(),URL.revokeObjectURL(q),H("success",`Exported ${_.length} variables`)},Ie=nr(()=>xc(De),[De]),Ee=nr(()=>Object.fromEntries(Object.entries(Ie).filter(([,_])=>_!==mi)),[Ie]),Qe=Object.keys(Ee).length,Le=Object.keys(Ie).length-Qe,Vt=async()=>{let _=Object.entries(Ee);if(_.length){T(!0);try{await Promise.all(_.map(([O,q])=>qe({data:{key:O,value:q}}))),a(O=>({...O,...Ee})),ve(""),je(!1);let D=Le>0?`, skipped ${Le} masked`:"";H("success",`Imported ${_.length} variables${D}`)}catch(D){H("error",D.message??"Import failed")}finally{T(!1)}}},pe=_=>{v(_),w(n[_]??"")},it=()=>{v(null),w("")},lt=async()=>{if(!g)return;let _=g;if(x===n[_]){v(null);return}T(!0);try{let D=await qe({data:{key:_,value:x}});a(O=>({...O,[_]:x})),l(O=>{let q={...O};return D.override?q[_]=D.override:delete q[_],q}),H("success",`${_} updated`),v(null)}catch(D){H("error",D.message??"Failed to update")}finally{T(!1)}},yo=async _=>{T(!0);try{let D=await qe({data:{key:_,value:null}});a(O=>{let q={...O};return delete q[_],q}),l(O=>{let q={...O};return D.override?q[_]=D.override:delete q[_],q}),B(O=>{let q=new Set(O);return q.delete(_),Xs(q),q}),H("success",`${_} deleted`)}catch(D){H("error",D.message??"Failed to delete")}finally{T(!1)}},Ht=async(_,D)=>{let O=/^(true|yes)$/i.test(D)?"false":"true";T(!0);try{let q=await qe({data:{key:_,value:O}});a(J=>({...J,[_]:O})),l(J=>{let Re={...J};return q.override?Re[_]=q.override:delete Re[_],Re})}catch(q){H("error",q.message??"Failed to update")}finally{T(!1)}},cr=async()=>{let _=C.trim();if(_){T(!0);try{let D=await qe({data:{key:_,value:k}});a(O=>({...O,[_]:k})),l(O=>{let q={...O};return D.override?q[_]=D.override:delete q[_],q}),A(""),K(""),H("success",`${_} added`)}catch(D){H("error",D.message??"Failed to add")}finally{T(!1)}}},$e=_=>{_.key==="Enter"&&lt(),_.key==="Escape"&&it()},go=async _=>{T(!0);try{let D=await nt({params:{key:_}});l(q=>{let J={...q};return delete J[_],J});let O=q=>{let J={...q};return D.value===null||D.value===void 0?delete J[_]:J[_]=D.value,J};a(O),s(O),H("success",`${_} reset to original`)}catch(D){H("error",D.message??"Failed to reset")}finally{T(!1)}},oe=async()=>{T(!0);try{await S(),l({});let _=await Q();_&&s(_.variables),H("success","All overrides reset")}catch(_){H("error",_.message??"Failed to reset all")}finally{T(!1)}},jr=Object.keys(i).length,ye=Object.entries(n),ut=nr(()=>{let _=m.toLowerCase().trim();return _?ye.filter(([D,O])=>D.toLowerCase().includes(_)||O.toLowerCase().includes(_)):ye},[n,m]),be=nr(()=>{let _={};for(let D of ut){let O=bc(D[0]);(_[O]??(_[O]=[])).push(D)}return Object.entries(_).sort(([D],[O])=>D==="OTHER"?1:O==="OTHER"?-1:D.localeCompare(O))},[ut]),Ir=ut.every(([_])=>Z.has(_)),pr=()=>{let _=ut.map(([D])=>D);B(D=>{let O=new Set(D);return Ir?_.forEach(q=>O.delete(q)):_.forEach(q=>O.add(q)),Xs(O),O})},$r="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);",ct="background:none;border:none;cursor:pointer;font-size:12px;padding:0 3px;color:var(--profiler-text-muted);opacity:0.7;flex-shrink:0;",pt="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(M,{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(M,{children:[t("button",{onClick:Q,disabled:F,style:pt,children:F?"\u2026":"\u21BA Refresh"}),t("button",{onClick:()=>je(_=>!_),style:`${pt}${Ne?"border-color:var(--profiler-accent);color:var(--profiler-accent);":""}`,children:"\u2B06 Import"})]}),t("button",{onClick:W,style:pt,children:"\u2B07 Export"}),t("button",{onClick:pr,style:pt,children:Ir?"\u{1F648} Mask all":"\u{1F441} Reveal all"}),!r&&jr>0&&t("button",{onClick:oe,disabled:j,title:"Remove all Sidekiq overrides and restore original values",style:`${pt}border-color:var(--profiler-warning,#f59e0b);color:var(--profiler-warning,#f59e0b);`,children:["\u21A9 Reset all (",jr,")"]}),!r&&t("button",{onClick:()=>Fe(_=>!_),title:Y?"Unlock editing":"Lock editing",style:`${pt}${Y?"border-color:var(--profiler-error,#ef4444);color:var(--profiler-error,#ef4444);":""}`,children:Y?"\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."}),U&&t("div",{style:`background:${U.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 ${U.type==="success"?"var(--profiler-success,#22c55e)":"var(--profiler-error,#ef4444)"};border-radius:6px;padding:6px 12px;margin-bottom:12px;font-size:12px;color:${U.type==="success"?"var(--profiler-success,#22c55e)":"var(--profiler-error,#ef4444)"};`,children:[U.type==="success"?"\u2713":"\u2717"," ",U.message]}),Ne&&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:De,onInput:_=>ve(_.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 (",oa,") skipped"]}),t("button",{onClick:Ut,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:lt.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:[nr.map(([b,q])=>{let F=y.has(b);return t(S,{children:[t("tr",{onClick:()=>sr(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),je=g===A,Nt=le===A,me=le===`__key__${A}`,ar=s[A]!==void 0&&s[A]!==$,lr=s[A]===void 0,he=a[A];return t("tr",{style:he?"border-left:3px solid var(--profiler-accent);":ar?"border-left:3px solid #f59e0b;":lr?"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:()=>it(A,`__key__${A}`),title:"Copy key",style:`${Je}${me?"color:var(--profiler-success,#22c55e);opacity:1;":""}`,children:me?"\u2713":"\u2398"})]})}),t("td",{children:je?t("div",{class:"profiler-flex",style:"align-items:center;gap:2px;",children:[$o(_)&&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:fs=>T(fs.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);"}),$o(_)&&t("span",{style:"font-family:monospace;font-size:12px;color:var(--profiler-text-muted);opacity:0.5;flex-shrink:0;",children:'"'})]}):ia($)?t(S,{children:[t("div",{class:"profiler-flex",style:"align-items:center;gap:8px;",children:[t(na,{value:$}),t("button",{onClick:()=>!Z&&!N&&Ie(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:()=>it($,A),title:"Copy value",style:`${Je}${Nt?"color:var(--profiler-success,#22c55e);opacity:1;":""}`,children:Nt?"\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(S,{children:[t("div",{class:"profiler-flex",style:"align-items:center;gap:4px;",children:[t(na,{value:$}),t("span",{class:"profiler-text--xs profiler-text--mono",onClick:()=>!Z&&!je&&ue(A),title:Z?void 0:"Click to edit",style:`word-break:break-all;flex:1;${Z?"":"cursor:pointer;"}`,children:we?$o($)?t(S,{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:()=>it($,A),title:"Copy value",style:`${Je}${Nt?"color:var(--profiler-success,#22c55e);opacity:1;":""}`,children:Nt?"\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:je?t(S,{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:at,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(S,{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:()=>ds(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:()=>ps(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=>P(b.target.value),onKeyDown:b=>b.key==="Enter"&&or(),placeholder:"NEW_KEY",disabled:N,style:Lr})}),t("td",{children:t("input",{type:"text",value:M,onInput:b=>K(b.target.value),onKeyDown:b=>b.key==="Enter"&&or(),placeholder:"value",disabled:N,style:Lr})}),t("td",{style:"text-align:right;",children:t("button",{onClick:or,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 aa({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 uc(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 cc(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 pc(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 dc({text:e}){let r=pc(e);return r.length===0?t("span",{style:"color:var(--profiler-text-muted)",children:"No output yet\u2026"}):t(S,{children:r.map((s,o)=>s.style?t("span",{style:s.style,children:s.text},o):t("span",{children:s.text},o))})}function la({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: ${uc(e.status)}`,children:cc(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(dc,{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 ua="/_profiler";function Vs(){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}=Hi(e?{framework:e}:{},{query:{refetchOnWindowFocus:!1}}),{mutateAsync:m}=$i(),{mutateAsync:g}=Gi(),v=h?.frameworks??[],_=h?.tree??[];z(()=>{!e&&v.length>0&&r(v[0])},[v]);let T=er(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(`${ua}/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(`${ua}/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)},P=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))},j=()=>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:j,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(aa,{tree:_,selected:s,onToggleFile:P,onToggleDir:M})}),t("div",{style:"overflow: hidden; display: flex; flex-direction: column",children:t(la,{run:n})})]})]})}var is="/_profiler";function qr({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 fc(e){return{GET:"badge-info",POST:"badge-success",PUT:"badge-warning",PATCH:"badge-warning",DELETE:"badge-error"}[e]||"badge-default"}function mc(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 Hs(e){return e>=500?"badge-error":e>=100?"badge-warning":"badge-success"}function ca(e){let r=e.collectors_data?.job?.status;return r||(e.status===500?"failed":"completed")}function as(e){return new Date(e).toLocaleTimeString("en",{hour12:!1})}var pa=[{key:"slow",label:"Slow"},{key:"many_queries",label:"Many queries"},{key:"errors",label:"Errors"},{key:"has_exception",label:"Has exception"}];function da(){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=Ni({limit:50},a("http",(u,C)=>Ns({limit:50,offset:u},C))),f=Qi({limit:50},a("jobs",(u,C)=>Uo({limit:50,offset:u},C))),p=Ri({limit:50},a("console",(u,C)=>Qo({limit:50,offset:u},C))),h=Bi({limit:50},a("tests",(u,C)=>No({limit:50,offset:u},C))),d=Ui({query:{enabled:n==="outbound",refetchOnWindowFocus:!1}}),y=Pi({query:{enabled:n==="env",refetchOnWindowFocus:!1}}),{mutateAsync:m}=ji(),{mutateAsync:g}=Vi(),{mutateAsync:v}=Li(),{mutateAsync:_}=Ki(),{mutateAsync:T}=ki(),{mutateAsync:w}=Si(),{mutateAsync:P}=Ji(),{mutateAsync:M}=zi(),K=l.data?.pages.flatMap(u=>u.profiles)??[],j=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,nt=!!f.hasNextPage,R=!!p.hasNextPage,I=!!h.hasNextPage,Te=l.isFetchingNextPage,it=f.isFetchingNextPage,sr=p.isFetchingNextPage,Q=h.isFetchingNextPage,[B,Ne]=x(null),[Me,Fe]=x(""),[De,Ut]=x(""),[ue,at]=x(""),[Be,ps]=x(""),[Ie,or]=x(()=>{let u=r.get("preset");return pa.some(C=>C.key===u)?u:""}),[te,ds]=x(o),[ve,Dr]=x({col:null,dir:"asc"}),[fe,lt]=x({col:null,dir:"asc"}),[nr,Qr]=x(""),[ir,Lr]=x(""),[Je,ut]=x(""),[b,q]=x(""),[F,A]=x(""),[$,we]=x(""),[je,Nt]=x(""),[me,ar]=x({col:null,dir:"asc"}),[lr,he]=x(""),[Kr,fs]=x(""),[Ur,en]=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")),Ie?u.searchParams.set("preset",Ie):u.searchParams.delete("preset"),history.replaceState(null,"",u.toString())},[te,Ie]);let Nr=u=>{ds(C=>C.col===u?{col:u,dir:C.dir==="asc"?"desc":"asc"}:{col:u,dir:"asc"})},Js=u=>{Dr(C=>C.col===u?{col:u,dir:C.dir==="asc"?"desc":"asc"}:{col:u,dir:"asc"})},Ua=u=>{or(C=>C===u?"":u)},Na=()=>l.fetchNextPage(),Ia=()=>f.fetchNextPage(),ja=()=>p.fetchNextPage(),Va=()=>h.fetchNextPage(),tn=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()},bt=u=>{if(u===n){tn(u);return}i(u);let C=new URL(window.location.href);C.searchParams.set("section",u),history.pushState(null,"",C.toString()),Fe(""),Ut(""),at(""),ps(""),or(""),ds({col:null,dir:"asc"}),Qr(""),Lr(""),ut(""),Dr({col:null,dir:"asc"}),q(""),A(""),lt({col:null,dir:"asc"}),we(""),Nt(""),ar({col:null,dir:"asc"}),he(""),fs(""),en("")},ms=u=>{Ft(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)})},Ha=u=>m({id:u}).then(()=>l.refetch()),$a=u=>v({id:u}).then(()=>f.refetch()),Ga=u=>T({id:u}).then(()=>p.refetch()),Ba=u=>P({id:u}).then(()=>h.refetch()),Ja=()=>{window.confirm("Delete all HTTP profiles?")&&g().then(()=>l.refetch())},za=()=>{window.confirm("Delete all job profiles?")&&_().then(()=>f.refetch())},Wa=()=>{window.confirm("Delete all console profiles?")&&w().then(()=>p.refetch())},Za=()=>{window.confirm("Delete all test profiles?")&&M().then(()=>h.refetch())},zs=()=>{window.confirm("Delete all HTTP, job and console profiles?")&&Promise.all([g(),_(),w()]).then(()=>{l.refetch(),f.refetch(),p.refetch()})},Ir=()=>tn(n),Ws=u=>{lt(C=>C.col===u?{col:u,dir:C.dir==="asc"?"desc":"asc"}:{col:u,dir:"asc"})},It=u=>`tab${n===u?" active":""}`,hs=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))||Ie==="slow"&&u.duration<500||Ie==="many_queries"&&(u.collectors_data?.database?.total_queries??0)<=20||Ie==="errors"&&u.status<500||Ie==="has_exception"&&!u.collectors_data?.exception)}),Xa=te.col?[...hs].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}):hs,ys=j.filter(u=>!(nr&&!u.path.toLowerCase().includes(nr.toLowerCase())||ir&&ca(u)!==ir||Je&&(Je==="lt100"?u.duration>=100:u.duration<parseInt(Je)))),Ya=ve.col?[...ys].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}):ys,Zs=D.filter(u=>{if(lr&&!u.url.toLowerCase().includes(lr.toLowerCase())||Kr&&u.method!==Kr)return!1;if(Ur)if(Ur==="error"){if(u.status!==0)return!1}else{let C=parseInt(Ur);if(!(u.status>=C&&u.status<C+100))return!1}return!0}),gs=oe.filter(u=>!(b&&!u.path.toLowerCase().includes(b.toLowerCase())||F==="error"&&u.status!==500||F==="ok"&&u.status===500)),el=fe.col?[...gs].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}):gs,vs=N.filter(u=>!($&&!(u.collectors_data?.test?.test_name||u.path).toLowerCase().includes($.toLowerCase())||je==="failed"&&u.status!==500||je==="passed"&&u.status===500||je==="pending"&&u.collectors_data?.test?.status!=="pending")),tl=me.col?[...vs].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}):vs,rn=!!(Me||De||ue||Be||Ie),sn=!!(nr||ir||Je),on=!!(b||F),nn=!!($||je),rl=!!(lr||Kr||Ur),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:It("http"),onClick:u=>{u.preventDefault(),bt("http")},children:"HTTP Requests"}),t("a",{href:"#",class:It("jobs"),onClick:u=>{u.preventDefault(),bt("jobs")},children:"Background Jobs"}),t("a",{href:"#",class:It("console"),onClick:u=>{u.preventDefault(),bt("console")},children:"Console"}),t("a",{href:"#",class:It("tests"),onClick:u=>{u.preventDefault(),bt("tests")},children:"Tests"}),t("div",{style:"flex: 1"}),t("a",{href:"#",class:It("runner"),onClick:u=>{u.preventDefault(),bt("runner")},children:"Test Runner"}),t("a",{href:"#",class:It("outbound"),onClick:u=>{u.preventDefault(),bt("outbound")},children:"Outbound HTTP"}),t("a",{href:"#",class:It("env"),onClick:u=>{u.preventDefault(),bt("env")},children:"Env"})]}),t("div",{class:"profiler-p-4 tab-content active",children:[n==="http"&&(U?t(qr,{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(S,{children:[t("div",{class:"profiler-action-bar profiler-mb-2",children:t("div",{class:"profiler-filter-group",children:pa.map(u=>t("button",{class:`profiler-preset-btn${Ie===u.key?" profiler-preset-btn--active":""}`,onClick:()=>Ua(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=>Ut(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=>at(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=>ps(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:[rn&&t("span",{class:"profiler-filter-count",children:[hs.length," / ",K.length]}),t("button",{class:`btn-refresh${U?" btn-refresh--spinning":""}`,onClick:Ir,disabled:U,title:"Refresh",children:"\u21BA"}),t("button",{class:"btn btn-danger btn-sm",onClick:Ja,title:"Delete HTTP profiles",children:"Clear"}),t("button",{class:"btn btn-danger btn-sm",onClick:zs,title:"Delete all HTTP and job profiles",children:"Clear All"})]})]}),hs.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:()=>Nr("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:()=>Nr("duration"),children:["Duration ",Re(te.col,te.dir,"duration")]}),t("th",{class:`sortable${te.col==="queries"?" sortable--active":""}`,onClick:()=>Nr("queries"),children:["Queries ",Re(te.col,te.dir,"queries")]}),t("th",{class:`sortable${te.col==="memory"?" sortable--active":""}`,onClick:()=>Nr("memory"),title:st,children:["Allocations ",Re(te.col,te.dir,"memory")]}),t("th",{class:`sortable${te.col==="status"?" sortable--active":""}`,onClick:()=>Nr("status"),children:["Status ",Re(te.col,te.dir,"status")]}),t("th",{children:"Token"}),t("th",{})]})}),t("tbody",{children:Xa.map(u=>t("tr",{children:[t("td",{children:as(u.started_at)}),t("td",{children:t("span",{class:fc(u.method),children:u.method})}),t("td",{children:[t("a",{href:`${is}/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:Hs(u.duration),children:[u.duration.toFixed(2)," ms"]})}),t("td",{children:u.collectors_data?.database?.total_queries??"-"}),t("td",{children:rt(xe(u))}),t("td",{children:t("span",{class:mc(u.status),children:u.status})}),t("td",{class:"profiler-text--xs profiler-text--mono profiler-text--muted",children:t("button",{class:"token-copy",onClick:()=>ms(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:()=>Ha(u.token),title:"Delete",children:"\xD7"})})]},u.token))})]}),Ae&&!rn&&t("div",{class:"profiler-load-more",children:t("button",{class:"btn btn-secondary",onClick:Na,disabled:Te,children:Te?"Loading\u2026":"Load more"})})]})),n==="jobs"&&(J?t(qr,{cols:["sm","flex","md","sm","xs","xs","sm"]}):Ke?t("div",{class:"profiler-empty",children:t("div",{class:"profiler-empty__title",children:Ke})}):j.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(S,{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:nr,onInput:u=>Qr(u.target.value)}),t("select",{class:"profiler-filter-select",value:ir,onChange:u=>Lr(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=>ut(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:[sn&&t("span",{class:"profiler-filter-count",children:[ys.length," / ",j.length]}),t("button",{class:`btn-refresh${J?" btn-refresh--spinning":""}`,onClick:Ir,disabled:J,title:"Refresh",children:"\u21BA"}),t("button",{class:"btn btn-danger btn-sm",onClick:za,title:"Delete job profiles",children:"Clear"}),t("button",{class:"btn btn-danger btn-sm",onClick:zs,title:"Delete all HTTP and job profiles",children:"Clear All"})]})]}),ys.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:()=>Js("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:()=>Js("duration"),children:["Duration ",Re(ve.col,ve.dir,"duration")]}),t("th",{class:`sortable${ve.col==="status"?" sortable--active":""}`,onClick:()=>Js("status"),children:["Status ",Re(ve.col,ve.dir,"status")]}),t("th",{children:"Executions"}),t("th",{children:"Token"}),t("th",{})]})}),t("tbody",{children:Ya.map(u=>{let C=u.collectors_data?.job,V=ca(u);return t("tr",{children:[t("td",{children:as(u.started_at)}),t("td",{children:[t("a",{href:`${is}/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:Hs(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:()=>ms(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:()=>$a(u.token),title:"Delete",children:"\xD7"})})]},u.token)})})]}),nt&&!sn&&t("div",{class:"profiler-load-more",children:t("button",{class:"btn btn-secondary",onClick:Ia,disabled:it,children:it?"Loading\u2026":"Load more"})})]})),n==="console"&&(H?t(qr,{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(S,{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:[on&&t("span",{class:"profiler-filter-count",children:[gs.length," / ",oe.length]}),t("button",{class:`btn-refresh${H?" btn-refresh--spinning":""}`,onClick:Ir,disabled:H,title:"Refresh",children:"\u21BA"}),t("button",{class:"btn btn-danger btn-sm",onClick:Wa,title:"Delete console profiles",children:"Clear"}),t("button",{class:"btn btn-danger btn-sm",onClick:zs,title:"Delete all profiles",children:"Clear All"})]})]}),gs.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:()=>Ws("date"),children:["Time ",Re(fe.col,fe.dir,"date")]}),t("th",{children:"Expression"}),t("th",{class:`sortable${fe.col==="duration"?" sortable--active":""}`,onClick:()=>Ws("duration"),children:["Duration ",Re(fe.col,fe.dir,"duration")]}),t("th",{children:"SQL"}),t("th",{class:`sortable${fe.col==="status"?" sortable--active":""}`,onClick:()=>Ws("status"),children:["Status ",Re(fe.col,fe.dir,"status")]}),t("th",{children:"Token"}),t("th",{})]})}),t("tbody",{children:el.map(u=>{let C=u.status===500;return t("tr",{children:[t("td",{children:as(u.started_at)}),t("td",{children:[t("a",{href:`${is}/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:Hs(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:()=>ms(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:()=>Ga(u.token),title:"Delete",children:"\xD7"})})]},u.token)})})]}),R&&!on&&t("div",{class:"profiler-load-more",children:t("button",{class:"btn btn-secondary",onClick:ja,disabled:sr,children:sr?"Loading\u2026":"Load more"})})]})),n==="tests"&&(le?t(qr,{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(),bt("runner")},children:"Test Runner"})," tab to run tests from here."]})]}):t(S,{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:je,onChange:u=>Nt(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:[nn&&t("span",{class:"profiler-filter-count",children:[vs.length," / ",N.length]}),t("button",{class:`btn-refresh${le?" btn-refresh--spinning":""}`,onClick:Ir,disabled:le,title:"Refresh",children:"\u21BA"}),t("button",{class:"btn btn-danger btn-sm",onClick:Za,title:"Delete test profiles",children:"Clear All"})]})]}),vs.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:()=>ar(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:()=>ar(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:()=>ar(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:tl.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:as(u.started_at)}),t("td",{style:"max-width: 300px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap",children:t("a",{href:`${is}/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:Hs(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:()=>ms(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:()=>Ba(u.token),title:"Delete",children:"\xD7"})})]},u.token)})})]}),I&&!nn&&t("div",{class:"profiler-load-more",children:t("button",{class:"btn btn-secondary",onClick:Va,disabled:Q,children:Q?"Loading\u2026":"Load more"})})]})),n==="runner"&&t(Vs,{}),n==="outbound"&&(ce?t(qr,{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(S,{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:lr,onInput:u=>he(u.target.value)}),t("select",{class:"profiler-filter-select",value:Kr,onChange:u=>fs(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:Ur,onChange:u=>en(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:[rl&&t("span",{class:"profiler-filter-count",children:[Zs.length," / ",D.length]}),t("button",{class:`btn-refresh${ce?" btn-refresh--spinning":""}`,onClick:Ir,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."]}),Zs.length===0?t("div",{class:"profiler-empty",children:t("div",{class:"profiler-empty__title",children:"No results match filters"})}):Zs.map((u,C)=>t("div",{style:"margin-bottom:4px",children:[t("div",{class:"profiler-text--xs profiler-text--muted",style:"margin-bottom:2px",children:[as(u.profile_started_at)," \xB7 Profile: ",t("a",{href:`${is}/profiles/${u.profile_token}`,children:[u.profile_token.substring(0,8),"\u2026"]})]}),t(Vo,{req:u,index:C,threshold:500})]},C))]})),n==="env"&&(Z?t(qr,{cols:["sm","flex","sm","sm"],rows:8}):_e?t("div",{class:"profiler-empty",children:t("div",{class:"profiler-empty__title",children:_e})}):t(ot,{envData:O}))]})]})]})}function fa(){let{data:e}=Ci({query:{retry:!1,refetchOnWindowFocus:!1}}),r=e?.slaves??[],s=wi();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;Ei(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 hc(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 yc(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 ma({profile:e}){let r=e.collectors_data?.request??{},s=e.params&&Object.keys(e.params).length>0,o=yc(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(js,{method:e.method,url:e.path,copyUrl:`http://localhost:3000${e.path}`,status:e.status,duration:e.duration,curlCommand:hc(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(Is,{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 gc(e){return e.replace(/\$\d+/g,"?").replace(/\b\d+\b/g,"?").replace(/'[^']*'/g,"?").replace(/"[^"]*"/g,"?").trim()}function vc(e){let r=new Map;e.forEach((o,n)=>{if(o.cached||o.transaction)return;let i=gc(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 ha(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)=>ha(l,r+1))]})}function bc({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:[ha(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(S,{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 Ot({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}=Oi();if(!e?.queries)return t("div",{class:"profiler-empty",children:t("p",{class:"profiler-empty__description",children:"No database queries recorded"})});let l=vc(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(S,{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:t(gt,{frame: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(bc,{state:n,onClose:d})]})}function qt({dumpData:e}){return e?.dumps?.length?t(S,{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:t(tr,{file:r.file,line: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 xc={controller:"#60a5fa",view:"#34d399",partial:"#f59e0b",sql:"#fb923c",cache:"#a78bfa",http:"#f87171",custom:"#e879f9",method:"#94a3b8"},vt=24,_c=1,Go=vt+_c,Tc=60,wc=300,ls=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)*Go+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*Go;if(n>=h&&n<=h+d&&i>=y&&i<=y+vt)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)/wc),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*Go;if(d+y<0||d>s||y<.5)continue;let g=xc[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,vt,3),r.fill(),r.globalAlpha=1,v?(r.strokeStyle="#ffffff",r.lineWidth=1.5,this.roundRect(r,d,m,y,vt,3),r.stroke()):_?(r.strokeStyle="#fbbf24",r.lineWidth=2,this.roundRect(r,d,m,y,vt,3),r.stroke()):p&&T&&(r.strokeStyle="#ffffff",r.lineWidth=1,r.globalAlpha=.5,this.roundRect(r,d,m,y,vt,3),r.stroke(),r.globalAlpha=1),y>Tc&&T){r.fillStyle=this.getTextColor(g),r.font='11px "JetBrains Mono", monospace',r.textBaseline="middle";let w=h.node.name,P=`${h.node.duration.toFixed(1)}ms`,M=y-8,K=r.measureText(P).width;if(M>K+20){let j=M-K-8;r.fillText(this.truncateText(r,w,j),d+4,m+vt/2),r.fillStyle=v?a:l,r.fillText(P,d+y-K-4,m+vt/2)}else r.fillText(this.truncateText(r,w,M),d+4,m+vt/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 Ec={controller:"Controller",view:"View",partial:"Partial",sql:"SQL",cache:"Cache",http:"HTTP",custom:"Custom",method:"Method"},Cc={controller:"#60a5fa",view:"#34d399",partial:"#f59e0b",sql:"#fb923c",cache:"#a78bfa",http:"#f87171",custom:"#e879f9",method:"#94a3b8"};function Rc(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(2)} MB`}var us=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=Cc[i]||"#a78bfa",l=Ec[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=Rc(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 cs=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 Bo={controller:"#60a5fa",view:"#34d399",partial:"#f59e0b",sql:"#fb923c",cache:"#a78bfa",http:"#f87171",custom:"#e879f9",method:"#94a3b8"},ya={controller:"Controller",view:"View",partial:"Partial",sql:"SQL",cache:"Cache",http:"HTTP",custom:"Custom",method:"Method"};function Dt({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"),[P,M]=x("desc"),[K,j]=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}=Di(),_e=async()=>{le(!0);try{let Q=await ge({data:{enabled:!K}});j(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)}},nt=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)}},I=e;if(z(()=>{if(!I?.root_events?.length||!o.current||!n.current)return;let Q=n.current,B=o.current,Ne=new us(Q,I.total_duration);a.current=Ne;let Me=new cs(Q,ue=>{i.current&&(ue?i.current.zoomTo(ue):i.current.resetZoom())});l.current=Me,Q.insertBefore(Me.el,B);let Fe=new ls(B,I.root_events,{onHover:(ue,at,Be)=>{ue?Ne.show(ue,at,Be):Ne.hide()},onClick:ue=>{h(!0)},onZoomChange:ue=>{Me.update(ue),h(ue.length>0)},onSearchResults:(ue,at)=>{g(ue),_(at)}});i.current=Fe;let De=()=>Fe.resizeCanvas();window.addEventListener("resize",De);let Ut=()=>Fe.render();return document.addEventListener("profiler:theme-change",Ut),()=>{Fe.destroy(),Ne.destroy(),Me.destroy(),window.removeEventListener("resize",De),document.removeEventListener("profiler:theme-change",Ut),i.current=null,a.current=null,l.current=null}},[I]),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})},[]),!I?.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(Jo,{data:s,enabled:K,toggling:H,maxFrames:oe,maxFramesUpdating:ce,mode:D,modeUpdating:Pe,clock:U,clockUpdating:Ue,sortKey:T,sortDir:P,onToggle:_e,onMaxFramesChange:Ae,onModeChange:nt,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(Jo,{data:s,enabled:K,toggling:H,maxFrames:oe,maxFramesUpdating:ce,mode:D,modeUpdating:Pe,clock:U,clockUpdating:Ue,sortKey:T,sortDir:P,onToggle:_e,onMaxFramesChange:Ae,onModeChange:nt,onClockChange:R,onSortChange:(Q,B)=>{w(Q),M(B)}})]});let Te={},it=Q=>{let B=Q.category;Te[B]||(Te[B]={count:0,duration:0}),Te[B].count++,Te[B].duration+=Q.duration,Q.children?.forEach(it)};I.root_events.forEach(it);let sr=()=>{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:I.total_events})]}),t("div",{class:"stat-item",children:[t("span",{class:"stat-label",children:"Total Duration"}),t("span",{class:"stat-value",children:[I.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:Bo[Q]}}),ya[Q]]}),t("span",{class:"stat-value",children:Te[Q].count})]},Q))]}),t("div",{class:"profiler-flamegraph__legend",children:Object.keys(Bo).map(Q=>t("div",{class:"legend-item",children:[t("span",{class:"legend-color",style:{background:Bo[Q]}}),t("span",{children:ya[Q]})]},Q))}),t("div",{class:"profiler-flamegraph__controls",children:[p&&t("button",{class:"profiler-flamegraph__reset",onClick:sr,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(Jo,{data:s,enabled:K,toggling:H,maxFrames:oe,maxFramesUpdating:ce,mode:D,modeUpdating:Pe,clock:U,clockUpdating:Ue,sortKey:T,sortDir:P,onToggle:_e,onMaxFramesChange:Ae,onModeChange:nt,onClockChange:R,onSortChange:(Q,B)=>{w(Q),M(B)}})]})}function ga(e,r=new Set){return r.add(e.name),e.children?.forEach(s=>ga(s,r)),r}function va(e,r){for(let s of e){if(s.name===r)return s;let o=va(s.children??[],r);if(o)return o}return null}function Jo({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,P]=x(null),[M,K]=x(null),j=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,I)=>h==="asc"?R[Z]-I[Z]:I[Z]-R[Z]):[],Ue=_?Ke.filter(R=>_.has(R.name)):Ke,qe=R=>{R?(T(ga(R)),P(R.name)):(T(null),P(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 I=parseInt(R.target.value,10);!isNaN(I)&&I>0&&I!==o&&y(I)},nt=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:nt}),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(S,{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:Fr(e.total_memory_bytes??0)})]})]}),Pe.length>0&&t(kc,{rootCalls:Pe,onFrameSelect:qe,rendererRef:j,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),P(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,I)=>t("tr",{class:M===R.name?"profiler-fn-profiling__row--highlighted":"",style:{cursor:Pe.length>0?"pointer":"default"},onMouseEnter:()=>{K(R.name),j.current?.setHighlightName(R.name)},onMouseLeave:()=>{K(null),j.current?.setHighlightName("")},onClick:()=>{let Te=va(Pe,R.name);Te&&(j.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:t(tr,{file:R.file,line: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:Fr(R.memory_bytes)})]},I))})]})]})]})}function kc({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 us(m,d),_=new cs(m,M=>{M?(a.current?.zoomTo(M),l.current?.(M)):(a.current?.resetZoom(),l.current?.(null))});m.insertBefore(_.el,g);let T=new ls(g,e,{onHover:(M,K,j)=>{M?(v.show(M,K,j),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 P=()=>T.render();return document.addEventListener("profiler:theme-change",P),()=>{T.destroy(),v.destroy(),_.destroy(),window.removeEventListener("resize",w),document.removeEventListener("profiler:theme-change",P),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 ba({viewData:e}){return e?t(S,{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(S,{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(S,{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 Sc={frame:"Turbo Frame request",stream:"Turbo Stream response"};function xa({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(S,{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-${rr(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-${rr(s.method)}`,children:s.method}),s.turbo&&t("span",{class:"badge-default",title:Sc[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-${Mr(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(S,{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(S,{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 Pc(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 Ac(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 Lt({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(S,{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;${Ac(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 ${Pc(l.level)}`,style:"white-space:pre-wrap;word-break:break-all;",children:l.message})]},f))]})}function Kt({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(S,{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:t(gt,{frame: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:t(gt,{frame: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 Mc={GET:"var(--profiler-success)",POST:"var(--profiler-accent)",PUT:"var(--profiler-warning)",PATCH:"var(--profiler-warning)",DELETE:"var(--profiler-error)"};function _a({verb:e}){let r=Mc[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 Ta({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(S,{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(S,{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(_a,{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(_a,{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 wa({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(S,{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 $s({jobs:e}){return e?.length?t(S,{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 Fc({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(S,{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 Ca({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 Oc({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(Ca,{assigns:e.assigns}),t(Fc,{email:e})]})}function Ea({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(Oc,{email:e})]})}function qc({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(Ca,{assigns:e.assigns})]})}function Gs({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(S,{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(S,{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(Ea,{email:f,onClick:()=>a(p),isExpanded:r===p},p))]}),e.queued&&e.queued.length>0&&t(S,{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(qc,{email:f},`q-${p}`))]}),e.errors.length>0&&t(S,{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(Ea,{email:f,onClick:()=>l(p),isExpanded:o===p},`err-${p}`))]})]})}function Ra({profile:e}){return e.trace_id?t(Dc,{profile:e,traceId:e.trace_id}):t("div",{class:"profiler-empty",children:[t("div",{class:"profiler-empty__icon",children:"\u{1F517}"}),t("h3",{class:"profiler-empty__title",children:"No trace for this profile"}),t("p",{class:"profiler-empty__description",children:"This profile was saved before distributed tracing was available."})]})}function Dc({profile:e,traceId:r}){let{data:s,isLoading:o,isError:n}=Ii({trace_id:r,limit:50}),i=(s?.profiles??[]).filter(a=>a.token!==e.token);return t(S,{children:[t("h2",{class:"profiler-section__header",children:"Trace"}),t("div",{class:"profiler-panel profiler-panel--sm profiler-mb-6",children:[t("div",{class:"profiler-kv-row",children:[t("span",{children:"Trace ID"}),t("code",{class:"profiler-code",children:r})]}),t("div",{class:"profiler-kv-row",children:[t("span",{children:"Span ID"}),t("code",{class:"profiler-code",children:e.span_id??"-"})]}),t("div",{class:"profiler-kv-row",children:[t("span",{children:"Parent span ID"}),e.parent_span_id?t("code",{class:"profiler-code",children:e.parent_span_id}):t("span",{class:"profiler-text--muted",children:"none, this request started the trace"})]})]}),t("h3",{class:"profiler-text--lg profiler-mb-3",children:"Other profiles in this trace"}),o&&t("p",{class:"profiler-text--muted",children:"Loading..."}),n&&t("p",{class:"profiler-text--muted",children:"Could not load the profiles of this trace."}),!o&&!n&&i.length===0&&t("div",{class:"profiler-empty",children:[t("div",{class:"profiler-empty__icon",children:"\u{1F517}"}),t("h3",{class:"profiler-empty__title",children:"Single-span trace"}),t("p",{class:"profiler-empty__description",children:"No other stored profile shares this trace id. The request had no traceparent from a caller, or the other services are not profiled here."})]}),i.map(a=>t("div",{class:"profiler-ajax-card",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-${rr(a.method??"")}`,children:a.method}),t("strong",{class:"profiler-ajax-card__path",children:a.path})]}),t("div",{class:"profiler-flex profiler-flex--gap-2",children:[t("span",{class:`badge-${Mr(a.status??0)}`,children:a.status}),a.span_id&&a.span_id===e.parent_span_id&&t("span",{class:"badge-info",children:"caller"})]})]}),t("div",{class:"profiler-ajax-card__row",children:[t("span",{class:"profiler-ajax-card__time",children:["span ",a.span_id??"-"]}),t("a",{href:`/_profiler/profiles/${a.token}`,class:"profiler-text--sm",style:"color: var(--profiler-accent);",children:"View Profile \u2192"})]})]},a.token))]})}function ka({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:st,children:["Allocations: ",t("strong",{children:rt(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("trace"),onClick:g("trace"),children:"Trace"}),t("a",{href:"#",class:v("env"),onClick:g("env"),children:"Env"})]}),t("div",{class:"profiler-p-4 tab-content active",children:[y==="exception"&&t(Kt,{exceptionData:o.exception}),y==="request"&&t(ma,{profile:e}),y==="dump"&&t(qt,{dumpData:o.dump}),y==="database"&&t(Ot,{dbData:o.database,token:e.token}),y==="ajax"&&t(xa,{ajaxData:o.ajax}),y==="http"&&t(Or,{httpData:o.http}),y==="timeline"&&t(Dt,{flamegraphData:o.flamegraph,perfData:o.performance,functionProfileData:o.function_profile}),y==="views"&&t(ba,{viewData:o.view}),y==="cache"&&t(Qt,{cacheData:o.cache}),y==="logs"&&t(Lt,{logData:o.logs}),y==="routes"&&t(Ta,{routesData:o.routes}),y==="i18n"&&t(wa,{i18nData:o.i18n}),y==="jobs"&&t($s,{jobs:e.child_jobs}),y==="mailer"&&t(Gs,{mailerData:o.mailer}),y==="trace"&&t(Ra,{profile:e}),y==="env"&&t(ot,{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 Sa({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(S,{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 Pa({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 j=new URL(window.location.href);j.searchParams.set("tab",M),history.pushState(null,"",j.toString())},P=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:st,children:["Allocations: ",t("strong",{children:rt(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:P("exception"),onClick:w("exception"),style:"color:var(--profiler-error,#ef4444);",children:"\u{1F4A5} Exception"}),t("a",{href:"#",class:P("job"),onClick:w("job"),children:"Job"}),t("a",{href:"#",class:P("database"),onClick:w("database"),children:"Database"}),t("a",{href:"#",class:P("cache"),onClick:w("cache"),children:"Cache"}),n&&t("a",{href:"#",class:P("http"),onClick:w("http"),children:"Outbound HTTP"}),t("a",{href:"#",class:P("timeline"),onClick:w("timeline"),children:"Timeline"}),i&&t("a",{href:"#",class:P("jobs"),onClick:w("jobs"),children:["Jobs (",e.child_jobs.length,")"]}),a&&t("a",{href:"#",class:P("dump"),onClick:w("dump"),children:["Dumps (",o.dump.count,")"]}),l&&t("a",{href:"#",class:P("logs"),onClick:w("logs"),children:"Logs"}),p&&t("a",{href:"#",class:P("mailer"),onClick:w("mailer"),children:"Mailers"}),t("a",{href:"#",class:P("env"),onClick:w("env"),children:"Env"})]}),t("div",{class:"profiler-p-4 tab-content active",children:[y==="exception"&&t(Kt,{exceptionData:o.exception}),y==="job"&&t(Sa,{jobData:o.job}),y==="database"&&t(Ot,{dbData:o.database,token:e.token}),y==="cache"&&t(Qt,{cacheData:o.cache}),y==="http"&&t(Or,{httpData:o.http}),y==="timeline"&&t(Dt,{flamegraphData:o.flamegraph,perfData:o.performance,functionProfileData:o.function_profile}),y==="jobs"&&t($s,{jobs:e.child_jobs}),y==="dump"&&t(qt,{dumpData:o.dump}),y==="logs"&&t(Lt,{logData:o.logs}),y==="mailer"&&t(Gs,{mailerData:o.mailer}),y==="env"&&t(ot,{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 Aa({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 Ma({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:st,children:["Allocations: ",t("strong",{children:rt(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(Aa,{data:f}),d==="database"&&t(Ot,{dbData:o.database,token:e.token}),d==="cache"&&t(Qt,{cacheData:o.cache}),d==="http"&&n&&t(Or,{httpData:o.http}),d==="dump"&&i&&t(qt,{dumpData:o.dump}),d==="logs"&&a&&t(Lt,{logData:o.logs}),d==="exception"&&l&&t(Kt,{exceptionData:o.exception}),d==="env"&&t(ot,{envData:o.env,readOnly:!0}),d==="timeline"&&t(Dt,{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 Qc(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 Fa({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:Qc(e.status)})]}),t("tr",{children:[t("th",{children:"File"}),t("td",{class:"profiler-text--mono profiler-text--xs",children:t(tr,{file:e.test_file,line: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 Oa({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:st,children:["Allocations: ",t("strong",{children:rt(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(Fa,{testData:l}),h==="database"&&t(Ot,{dbData:o.database,token:e.token}),h==="cache"&&t(Qt,{cacheData:o.cache}),h==="timeline"&&t(Dt,{flamegraphData:o.flamegraph,perfData:o.performance,functionProfileData:o.function_profile}),h==="dump"&&n&&t(qt,{dumpData:o.dump}),h==="logs"&&i&&t(Lt,{logData:o.logs}),h==="exception"&&a&&t(Kt,{exceptionData:o.exception}),h==="env"&&t(ot,{envData:o.env})]})]})]})}var Lc="/_profiler";function qa(){return t("div",{class:"container",children:[t("div",{class:"header",children:[t("h1",{children:[t("a",{href:Lc,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(Vs,{})})})]})}function Da(e){console.log("Initializing profiler timeline");let r=e.dataset.token;if(!r){console.error("No profile token found");return}Kc(r).then(s=>{Uc(e,s)})}async function Kc(e){return(await(await fetch(`/_profiler/profiles/${e}/timeline`)).json()).events||[]}function Uc(e,r){if(!r.length){e.innerHTML="<p>No timeline events recorded</p>";return}let s=Nc(r);e.appendChild(s)}function Nc(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",Ic(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 Ic(e){return e.includes("Controller")?"#569cd6":e.includes("Render")?"#4ec9b0":e.includes("Partial")?"#ce9178":"#dcdcaa"}var zo=new Map;function Qa(e){try{return localStorage.getItem(e)}catch{return zo.has(e)?zo.get(e):null}}function La(e,r){zo.set(e,r);try{localStorage.setItem(e,r)}catch{}}var Wo="profiler-theme",jc="data-theme",Zo=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===Wo&&r.newValue&&(this.currentTheme=r.newValue,this.applyTheme(this.currentTheme))})}loadTheme(){return Qa(Wo)||"auto"}saveTheme(r){La(Wo,r)}applyTheme(r){let s=this.resolveTheme(r);document.documentElement.setAttribute(jc,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)}},Yo=new Zo;function Vc(){Yo.toggle()}function Xo(){return Yo.getResolvedTheme()}function Hc(){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 $c(){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 Ka(){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=Xo();for(;e.firstChild;)e.removeChild(e.firstChild);let o=s==="dark"?Hc():$c();e.appendChild(o)};return r(),window.addEventListener("profiler:theme-change",r),e.addEventListener("click",()=>{Vc()}),e}document.readyState==="loading"?document.addEventListener("DOMContentLoaded",()=>{console.log("\u{1F3A8} Theme system initialized:",Xo())}):console.log("\u{1F3A8} Theme system initialized:",Xo());var Bs=new So({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&&Vr(t(Pr,{client:Bs,children:t(fa,{})}),e);let s=document.getElementById("profiler-index");s&&Vr(t(Pr,{client:Bs,children:t(da,{})}),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(Pa,{profile:l,initialTab:f,embedded:p}):l.profile_type==="console"?h=t(Ma,{profile:l,initialTab:f,embedded:p}):l.profile_type==="test"?h=t(Oa,{profile:l,initialTab:f,embedded:p}):h=t(ka,{profile:l,initialTab:f,embedded:p}),Vr(t(Pr,{client:Bs,children:h}),o)}}let n=document.getElementById("profiler-test-runner");if(n&&Vr(t(Pr,{client:Bs,children:t(qa,{})}),n),!s&&!o&&!n){let a=document.querySelector(".header, .profiler-detail");if(a){let l=Ka();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&&Da(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:[Qe>0&&t("span",{class:"profiler-text--xs profiler-text--muted",children:[Qe," variable",Qe!==1?"s":""," to import"]}),Le>0&&t("span",{class:"profiler-text--xs profiler-text--muted",children:[Le," masked (",mi,") skipped"]}),t("button",{onClick:Vt,disabled:j||Qe===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"})]}),m&&t("div",{class:"profiler-stat-card",children:[t("div",{class:"profiler-stat-card__value",children:ut.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:m,onInput:_=>d(_.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"}),!Y&&t("th",{style:"width:120px;text-align:right;"})]})}),t("tbody",{children:[be.map(([_,D])=>{let O=y.has(_);return t(M,{children:[t("tr",{onClick:()=>ur(_),style:"cursor:pointer;background:var(--profiler-bg-subtle,rgba(0,0,0,0.03));",children:t("td",{colspan:Y?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:[O?"\u25B6":"\u25BC"," ",_,"_"]}),t("span",{style:"font-size:10px;color:var(--profiler-text-muted);margin-left:6px;",children:D.length})]})},`group-${_}`),!O&&D.map(([q,J])=>{let Re=Z.has(q),Je=g===q,Gt=ce===q,_t=ce===`__key__${q}`,vo=o[q]!==void 0&&o[q]!==J,xe=o[q]===void 0,de=i[q];return t("tr",{style:de?"border-left:3px solid var(--profiler-accent);":vo?"border-left:3px solid #f59e0b;":xe?"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:q}),t("button",{onClick:()=>at(q,`__key__${q}`),title:"Copy key",style:`${ct}${_t?"color:var(--profiler-success,#22c55e);opacity:1;":""}`,children:_t?"\u2713":"\u2398"})]})}),t("td",{children:Je?t("div",{class:"profiler-flex",style:"align-items:center;gap:2px;",children:[Ys(x)&&t("span",{style:"font-family:monospace;font-size:12px;color:var(--profiler-text-muted);opacity:0.5;flex-shrink:0;",children:'"'}),t("input",{ref:we,type:"text",value:x,onInput:bo=>w(bo.target.value),onKeyDown:$e,disabled:j,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);"}),Ys(x)&&t("span",{style:"font-family:monospace;font-size:12px;color:var(--profiler-text-muted);opacity:0.5;flex-shrink:0;",children:'"'})]}):yi(J)?t(M,{children:[t("div",{class:"profiler-flex",style:"align-items:center;gap:8px;",children:[t(hi,{value:J}),t("button",{onClick:()=>!Y&&!j&&Ht(q,J),disabled:j||Y,title:`Click to set ${/^(true|yes)$/i.test(J)?"false":"true"}`,style:`position:relative;display:inline-block;width:36px;height:20px;border-radius:10px;border:none;cursor:${Y||j?"default":"pointer"};padding:0;transition:background 0.2s;background:${/^(true|yes)$/i.test(J)?"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(J)?"19px":"3px"};`})}),t("span",{class:"profiler-text--xs profiler-text--mono",style:"color:var(--profiler-text-muted);",children:J}),t("button",{onClick:()=>at(J,q),title:"Copy value",style:`${ct}${Gt?"color:var(--profiler-success,#22c55e);opacity:1;":""}`,children:Gt?"\u2713":"\u2398"})]}),de&&t("div",{style:"font-size:10px;color:var(--profiler-accent);margin-top:2px;font-family:monospace;",children:["workers \u2190 ",de.value==="__profiler_deleted__"?"(deleted)":de.value," \xB7 original: ",de.original??"(unset)"]})]}):t(M,{children:[t("div",{class:"profiler-flex",style:"align-items:center;gap:4px;",children:[t(hi,{value:J}),t("span",{class:"profiler-text--xs profiler-text--mono",onClick:()=>!Y&&!Je&&pe(q),title:Y?void 0:"Click to edit",style:`word-break:break-all;flex:1;${Y?"":"cursor:pointer;"}`,children:Re?Ys(J)?t(M,{children:[t("span",{style:"color:var(--profiler-text-muted);opacity:0.5;",children:'"'}),J,t("span",{style:"color:var(--profiler-text-muted);opacity:0.5;",children:'"'})]}):J:"\u2022".repeat(Math.min(J.length,20))}),t("button",{onClick:()=>Ce(q),title:Re?"Hide value":"Show value",style:`${ct}${Re?"opacity:1;color:var(--profiler-accent);":""}`,children:Re?"\u{1F441}":"\u{1F648}"}),t("button",{onClick:()=>at(J,q),title:"Copy value",style:`${ct}${Gt?"color:var(--profiler-success,#22c55e);opacity:1;":""}`,children:Gt?"\u2713":"\u2398"})]}),de&&t("div",{style:"font-size:10px;color:var(--profiler-accent);margin-top:2px;font-family:monospace;",children:["workers \u2190 ",de.value==="__profiler_deleted__"?"(deleted)":Re?de.value:"\u2022".repeat(Math.min((de.value??"").length,20))," \xB7 original: ",de.original==null?"(unset)":Re?de.original:"\u2022".repeat(Math.min(de.original.length,20))]})]})}),!Y&&t("td",{style:"text-align:right;white-space:nowrap;",children:Je?t(M,{children:[t("button",{onClick:lt,disabled:j,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:j,title:"Cancel",style:"background:none;border:none;cursor:pointer;color:var(--profiler-text-muted);font-size:14px;padding:0 4px;",children:"\u2717"})]}):t(M,{children:[t("button",{onClick:()=>pe(q),disabled:j,title:"Edit",style:"background:none;border:none;cursor:pointer;color:var(--profiler-accent);font-size:14px;padding:0 4px;",children:"\u270E"}),de&&t("button",{onClick:()=>go(q),disabled:j,title:`Reset to original: ${de.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:()=>yo(q),disabled:j,title:"Delete",style:"background:none;border:none;cursor:pointer;color:var(--profiler-error,#ef4444);font-size:14px;padding:0 4px;",children:"\u2715"})]})})]},q)})]})}),!Y&&t("tr",{children:[t("td",{children:t("input",{type:"text",value:C,onInput:_=>A(_.target.value),onKeyDown:_=>_.key==="Enter"&&cr(),placeholder:"NEW_KEY",disabled:j,style:$r})}),t("td",{children:t("input",{type:"text",value:k,onInput:_=>K(_.target.value),onKeyDown:_=>_.key==="Enter"&&cr(),placeholder:"value",disabled:j,style:$r})}),t("td",{style:"text-align:right;",children:t("button",{onClick:cr,disabled:j||!C.trim(),style:"background:var(--profiler-accent);border:none;cursor:pointer;color:#fff;font-size:11px;padding:3px 8px;border-radius:4px;",children:"Add"})})]})]})]})]})}function gi({tree:e,selected:r,onToggleFile:o,onToggleDir:s}){let[n,a]=b(new Set),i=f=>{a(p=>{let m=new Set(p);return m.has(f)?m.delete(f):m.add(f),m})},l=f=>{let p=f.filter(m=>r.has(m)).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 m=p.map(h=>h.path),d=l(m),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:()=>i(f),children:[t("input",{type:"checkbox",checked:d==="all",ref:h=>{h&&(h.indeterminate=d==="partial")},onClick:h=>{h.stopPropagation(),s(f,m)},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(h=>t("div",{style:"display: flex; align-items: center; gap: 6px; padding: 2px 6px 2px 24px; cursor: pointer; border-radius: 4px",onClick:()=>o(h.path),children:[t("input",{type:"checkbox",checked:r.has(h.path),onClick:g=>{g.stopPropagation(),o(h.path)},style:"cursor: pointer; flex-shrink: 0"}),t("span",{style:"overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--profiler-text, #e2e8f0)",title:h.path,children:h.name})]},h.path))]},f)})})}function Tc(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 wc(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 Cc(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)"},o=[],s="",n=e.split(/(\x1b\[[0-9;]*m)/);for(let a of n)if(a.startsWith("\x1B[")&&a.endsWith("m")){let i=a.slice(2,-1).split(";");if(i.includes("0"))s="";else{let l=i.map(f=>r[f]??"").filter(Boolean);s=[...s?[s]:[],...l].join(";")}}else a.length>0&&o.push({text:a,style:s});return o}function Ec({text:e}){let r=Cc(e);return r.length===0?t("span",{style:"color:var(--profiler-text-muted)",children:"No output yet\u2026"}):t(M,{children:r.map((o,s)=>o.style?t("span",{style:o.style,children:o.text},s):t("span",{children:o.text},s))})}function vi({run:e}){let r=he(null);return G(()=>{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: ${Tc(e.status)}`,children:wc(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(Ec,{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 bi="/_profiler";function Wo(){let[e,r]=b(""),[o,s]=b(new Set),[n,a]=b(null),[i,l]=b(!1),[f,p]=b(null),{data:m,isLoading:d,refetch:y}=ei(e?{framework:e}:{},{query:{refetchOnWindowFocus:!1}}),{mutateAsync:h}=ti(),{mutateAsync:g}=ri(),v=m?.frameworks??[],x=m?.tree??[];G(()=>{!e&&v.length>0&&r(v[0])},[v]);let w=ar(F=>{s(new Set),y()},[y]);G(()=>{if(!n||!i)return;if(["passed","failed","killed","signaled","error"].includes(n.status)){l(!1);return}let F=new EventSource(`${bi}/api/test_runner/runs/${n.id}/stream`);return F.addEventListener("output",$=>{try{let Z=JSON.parse($.data);a(B=>B&&{...B,output:(B.output||"")+Z.chunk})}catch{}}),F.addEventListener("done",$=>{try{let Z=JSON.parse($.data);a(B=>B&&{...B,status:Z.status})}catch{}l(!1),F.close()}),F.onerror=()=>{F.readyState===EventSource.CLOSED&&fetch(`${bi}/api/test_runner/runs/${n.id}`).then($=>$.json()).then($=>{a($),l(!1)}).catch(()=>l(!1))},()=>F.close()},[n?.id,i]);let C=F=>{r(F),w(F)},A=F=>{s($=>{let Z=new Set($);return Z.has(F)?Z.delete(F):Z.add(F),Z})},k=(F,$)=>{s(Z=>{let B=new Set(Z);return $.every(fe=>B.has(fe))?$.forEach(fe=>B.delete(fe)):$.forEach(fe=>B.add(fe)),B})},K=()=>{let F=x.flatMap($=>$.files.map(Z=>Z.path));s(new Set(F))},U=()=>s(new Set),L=async()=>{if(!(o.size===0||i)){p(null);try{let F=await h({data:{files:Array.from(o),framework:e}});a(F),l(!0)}catch(F){p(F instanceof Error&&F.message?F.message:"Failed to start test run")}}},j=async()=>{if(n)try{await g({id:n.id}),l(!1),a(F=>F&&{...F,status:"killed"})}catch{}},T=x.reduce((F,$)=>F+$.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(F=>t("button",{class:`profiler-preset-btn${e===F?" profiler-preset-btn--active":""}`,onClick:()=>C(F),disabled:i,children:F==="rspec"?"RSpec":"Minitest"},F))}),t("div",{class:"profiler-filter-group",style:"margin-left: auto",children:[t("span",{class:"profiler-text--xs profiler-text--muted",children:[o.size," / ",T," selected"]}),t("button",{class:"btn btn-secondary btn-sm",onClick:K,disabled:i||d,children:"All"}),t("button",{class:"btn btn-secondary btn-sm",onClick:U,disabled:i,children:"None"}),i?t("button",{class:"btn btn-danger btn-sm",onClick:j,children:"\u25A0 Stop"}):t("button",{class:"btn btn-sm",style:"background: var(--profiler-accent, #06b6d4); color: #000; font-weight: 600",onClick:L,disabled:o.size===0,children:["\u25B6 Run Selected (",o.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"}):x.length===0?t("div",{class:"profiler-text--xs profiler-text--muted",style:"padding: 8px",children:["No ",e," test files found"]}):t(gi,{tree:x,selected:o,onToggleFile:A,onToggleDir:k})}),t("div",{style:"overflow: hidden; display: flex; flex-direction: column",children:t(vi,{run:n})})]})]})}var Kr="/_profiler";function Ur({cols:e,rows:r=6}){return t("div",{children:Array.from({length:r}).map((o,s)=>t("div",{class:"profiler-skeleton__row",children:e.map((n,a)=>t("div",{class:`profiler-skeleton__cell profiler-skeleton__cell--${n}`},a))},s))})}function Rc(e){return{GET:"badge-info",POST:"badge-success",PUT:"badge-warning",PATCH:"badge-warning",DELETE:"badge-error"}[e]||"badge-default"}function kc(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 Zo(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 po(e){return new Date(e).toLocaleTimeString("en",{hour12:!1})}var _i=[{key:"slow",label:"Slow"},{key:"many_queries",label:"Many queries"},{key:"errors",label:"Errors"},{key:"has_exception",label:"Has exception"}];function Ti(){let e=Be(),r=new URLSearchParams(window.location.search),o=()=>{let u=r.get("section");return u==="http"||u==="jobs"||u==="console"||u==="tests"||u==="runner"||u==="outbound"||u==="env"?u:"http"},s=()=>{let u=r.get("sort"),R=r.get("dir");return{col:u==="date"||u==="duration"||u==="memory"||u==="status"||u==="queries"?u:null,dir:R==="desc"?"desc":"asc"}},[n,a]=b(o),i=(u,R)=>({query:{enabled:n===u,queryFn:({pageParam:N=0,signal:re})=>R(N,re),getNextPageParam:N=>N.has_more?N.offset+N.limit:void 0,initialPageParam:0,refetchOnWindowFocus:!1}}),l=Wa({limit:50},i("http",(u,R)=>Bo({limit:50,offset:u},R))),f=Ga({limit:50},i("jobs",(u,R)=>Bs({limit:50,offset:u},R))),p=Qa({limit:50},i("console",(u,R)=>Vs({limit:50,offset:u},R))),m=oi({limit:50},i("tests",(u,R)=>Js({limit:50,offset:u},R))),d=za({query:{enabled:n==="outbound",refetchOnWindowFocus:!1}}),y=Ua({query:{enabled:n==="env",refetchOnWindowFocus:!1}}),{mutateAsync:h}=Xa(),{mutateAsync:g}=Ya(),{mutateAsync:v}=Ba(),{mutateAsync:x}=Ja(),{mutateAsync:w}=La(),{mutateAsync:C}=Ka(),{mutateAsync:A}=si(),{mutateAsync:k}=ni(),K=l.data?.pages.flatMap(u=>u.profiles)??[],U=f.data?.pages.flatMap(u=>u.profiles)??[],L=p.data?.pages.flatMap(u=>u.profiles)??[],j=m.data?.pages.flatMap(u=>u.profiles)??[],T=d.data??[],F=y.data,$=l.isLoading,Z=f.isLoading,B=p.isLoading,ce=m.isLoading,fe=d.isLoading,Y=y.isLoading,Fe=l.error?.message??null,Ne=f.error?.message??null,je=p.error?.message??null,De=m.error?.message??null,ve=d.error?.message??null,we=y.error?.message??null,qe=!!l.hasNextPage,nt=!!f.hasNextPage,S=!!p.hasNextPage,H=!!m.hasNextPage,Ce=l.isFetchingNextPage,at=f.isFetchingNextPage,ur=p.isFetchingNextPage,Q=m.isFetchingNextPage,[W,Ie]=b(null),[Ee,Qe]=b(new Set),[Le,Vt]=b(""),[pe,it]=b(""),[lt,yo]=b(""),[Ht,cr]=b(""),[$e,go]=b(()=>{let u=r.get("preset");return _i.some(R=>R.key===u)?u:""}),[oe,jr]=b(s),[ye,ut]=b({col:null,dir:"asc"}),[be,Ir]=b({col:null,dir:"asc"}),[pr,$r]=b(""),[ct,pt]=b(""),[_,D]=b(""),[O,q]=b(""),[J,Re]=b(""),[Je,Gt]=b(""),[_t,vo]=b(""),[xe,de]=b({col:null,dir:"asc"}),[Vr,bo]=b(""),[xo,cn]=b(""),[Hr,pn]=b("");G(()=>{let u=new URL(window.location.href);oe.col?(u.searchParams.set("sort",oe.col),u.searchParams.set("dir",oe.dir)):(u.searchParams.delete("sort"),u.searchParams.delete("dir")),$e?u.searchParams.set("preset",$e):u.searchParams.delete("preset"),history.replaceState(null,"",u.toString())},[oe,$e]);let Gr=u=>{jr(R=>R.col===u?{col:u,dir:R.dir==="asc"?"desc":"asc"}:{col:u,dir:"asc"})},os=u=>{ut(R=>R.col===u?{col:u,dir:R.dir==="asc"?"desc":"asc"}:{col:u,dir:"asc"})},Zi=u=>{go(R=>R===u?"":u)},Xi=()=>l.fetchNextPage(),Yi=()=>f.fetchNextPage(),el=()=>p.fetchNextPage(),tl=()=>m.fetchNextPage(),dn=u=>{u==="http"?l.refetch():u==="jobs"?f.refetch():u==="console"?p.refetch():u==="tests"?m.refetch():u==="outbound"?d.refetch():u==="env"&&y.refetch()},Tt=u=>{if(u===n){dn(u);return}a(u);let R=new URL(window.location.href);R.searchParams.set("section",u),history.pushState(null,"",R.toString()),Vt(""),it(""),yo(""),cr(""),go(""),jr({col:null,dir:"asc"}),$r(""),pt(""),D(""),ut({col:null,dir:"asc"}),q(""),Re(""),Ir({col:null,dir:"asc"}),Gt(""),vo(""),de({col:null,dir:"asc"}),bo(""),cn(""),pn("")},_o=u=>{Dt(u).then(R=>{if(!R){window.prompt("Copy is not available here. Select the token and copy it:",u);return}Ie(u),setTimeout(()=>Ie(null),1500)})},rl=u=>h({id:u}).then(()=>l.refetch()),ol=u=>{Qe(R=>{let N=new Set(R);return N.has(u)?N.delete(u):N.size<2&&N.add(u),N})},sl=u=>v({id:u}).then(()=>f.refetch()),nl=u=>w({id:u}).then(()=>p.refetch()),al=u=>A({id:u}).then(()=>m.refetch()),il=()=>{window.confirm("Delete all HTTP profiles?")&&g().then(()=>l.refetch())},ll=()=>{window.confirm("Delete all job profiles?")&&x().then(()=>f.refetch())},ul=()=>{window.confirm("Delete all console profiles?")&&C().then(()=>p.refetch())},cl=()=>{window.confirm("Delete all test profiles?")&&k().then(()=>m.refetch())},ss=()=>{window.confirm("Delete all HTTP, job and console profiles?")&&Promise.all([g(),x(),C()]).then(()=>{l.refetch(),f.refetch(),p.refetch()})},Br=()=>dn(n),ns=u=>{Ir(R=>R.col===u?{col:u,dir:R.dir==="asc"?"desc":"asc"}:{col:u,dir:"asc"})},Bt=u=>`tab${n===u?" active":""}`,To=K.filter(u=>{if(Le&&!u.path.toLowerCase().includes(Le.toLowerCase())||pe&&u.method!==pe)return!1;if(lt){let R=parseInt(lt);if(!(u.status>=R&&u.status<R+100))return!1}return!(Ht&&(Ht==="lt100"?u.duration>=100:u.duration<parseInt(Ht))||$e==="slow"&&u.duration<500||$e==="many_queries"&&(u.collectors_data?.database?.total_queries??0)<=20||$e==="errors"&&u.status<500||$e==="has_exception"&&!u.collectors_data?.exception)}),pl=oe.col?[...To].sort((u,R)=>{if(oe.col==="date"){let Ve=new Date(u.started_at).getTime()-new Date(R.started_at).getTime();return oe.dir==="asc"?Ve:-Ve}let N,re;switch(oe.col){case"duration":N=u.duration,re=R.duration;break;case"memory":N=Te(u)??0,re=Te(R)??0;break;case"status":N=u.status,re=R.status;break;case"queries":N=u.collectors_data?.database?.total_queries??0,re=R.collectors_data?.database?.total_queries??0;break;default:return 0}return oe.dir==="asc"?N-re:re-N}):To,wo=U.filter(u=>!(pr&&!u.path.toLowerCase().includes(pr.toLowerCase())||ct&&xi(u)!==ct||_&&(_==="lt100"?u.duration>=100:u.duration<parseInt(_)))),dl=ye.col?[...wo].sort((u,R)=>{if(ye.col==="date"){let Ve=new Date(u.started_at).getTime()-new Date(R.started_at).getTime();return ye.dir==="asc"?Ve:-Ve}let N,re;switch(ye.col){case"duration":N=u.duration,re=R.duration;break;case"status":N=u.status,re=R.status;break;default:return 0}return ye.dir==="asc"?N-re:re-N}):wo,as=T.filter(u=>{if(Vr&&!u.url.toLowerCase().includes(Vr.toLowerCase())||xo&&u.method!==xo)return!1;if(Hr)if(Hr==="error"){if(u.status!==0)return!1}else{let R=parseInt(Hr);if(!(u.status>=R&&u.status<R+100))return!1}return!0}),Co=L.filter(u=>!(O&&!u.path.toLowerCase().includes(O.toLowerCase())||J==="error"&&u.status!==500||J==="ok"&&u.status===500)),fl=be.col?[...Co].sort((u,R)=>{if(be.col==="date"){let Ve=new Date(u.started_at).getTime()-new Date(R.started_at).getTime();return be.dir==="asc"?Ve:-Ve}let N,re;switch(be.col){case"duration":N=u.duration,re=R.duration;break;case"status":N=u.status,re=R.status;break;default:return 0}return be.dir==="asc"?N-re:re-N}):Co,Eo=j.filter(u=>!(Je&&!(u.collectors_data?.test?.test_name||u.path).toLowerCase().includes(Je.toLowerCase())||_t==="failed"&&u.status!==500||_t==="passed"&&u.status===500||_t==="pending"&&u.collectors_data?.test?.status!=="pending")),ml=xe.col?[...Eo].sort((u,R)=>{let N,re;if(xe.col==="date"){let Ve=new Date(u.started_at).getTime()-new Date(R.started_at).getTime();return xe.dir==="asc"?Ve:-Ve}switch(xe.col){case"duration":N=u.duration,re=R.duration;break;case"status":N=u.status,re=R.status;break;default:return 0}return xe.dir==="asc"?N-re:re-N}):Eo,fn=!!(Le||pe||lt||Ht||$e),mn=!!(pr||ct||_),hn=!!(O||J),yn=!!(Je||_t),hl=!!(Vr||xo||Hr),Pe=(u,R,N)=>u!==N?t("span",{class:"sort-icon sort-icon--idle",children:"\u21C5"}):t("span",{class:"sort-icon sort-icon--active",children:R==="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:Bt("http"),onClick:u=>{u.preventDefault(),Tt("http")},children:"HTTP Requests"}),t("a",{href:"#",class:Bt("jobs"),onClick:u=>{u.preventDefault(),Tt("jobs")},children:"Background Jobs"}),t("a",{href:"#",class:Bt("console"),onClick:u=>{u.preventDefault(),Tt("console")},children:"Console"}),t("a",{href:"#",class:Bt("tests"),onClick:u=>{u.preventDefault(),Tt("tests")},children:"Tests"}),t("div",{style:"flex: 1"}),t("a",{href:"#",class:Bt("runner"),onClick:u=>{u.preventDefault(),Tt("runner")},children:"Test Runner"}),t("a",{href:"#",class:Bt("outbound"),onClick:u=>{u.preventDefault(),Tt("outbound")},children:"Outbound HTTP"}),t("a",{href:"#",class:Bt("env"),onClick:u=>{u.preventDefault(),Tt("env")},children:"Env"})]}),t("div",{class:"profiler-p-4 tab-content active",children:[n==="http"&&($?t(Ur,{cols:["sm","xs","flex","sm","sm","sm","xs","sm"]}):Fe?t("div",{class:"profiler-empty",children:t("div",{class:"profiler-empty__title",children:Fe})}):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(M,{children:[t("div",{class:"profiler-action-bar profiler-mb-2",children:t("div",{class:"profiler-filter-group",children:_i.map(u=>t("button",{class:`profiler-preset-btn${$e===u.key?" profiler-preset-btn--active":""}`,onClick:()=>Zi(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:Le,onInput:u=>Vt(u.target.value)}),t("select",{class:"profiler-filter-select",value:pe,onChange:u=>it(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:lt,onChange:u=>yo(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:Ht,onChange:u=>cr(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:[fn&&t("span",{class:"profiler-filter-count",children:[To.length," / ",K.length]}),Ee.size===2&&t("a",{class:"btn btn-secondary btn-sm",href:`${Kr}/compare?a=${encodeURIComponent(Array.from(Ee)[0])}&b=${encodeURIComponent(Array.from(Ee)[1])}`,children:"Compare 2 profiles"}),Ee.size===1&&t("span",{class:"profiler-text--xs profiler-text--muted",children:"Select 1 more to compare"}),t("button",{class:`btn-refresh${$?" btn-refresh--spinning":""}`,onClick:Br,disabled:$,title:"Refresh",children:"\u21BA"}),t("button",{class:"btn btn-danger btn-sm",onClick:il,title:"Delete HTTP profiles",children:"Clear"}),t("button",{class:"btn btn-danger btn-sm",onClick:ss,title:"Delete all HTTP and job profiles",children:"Clear All"})]})]}),To.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",{style:"width:32px"}),t("th",{class:`sortable${oe.col==="date"?" sortable--active":""}`,onClick:()=>Gr("date"),children:["Time ",Pe(oe.col,oe.dir,"date")]}),t("th",{children:"Method"}),t("th",{children:"Path"}),t("th",{class:`sortable${oe.col==="duration"?" sortable--active":""}`,onClick:()=>Gr("duration"),children:["Duration ",Pe(oe.col,oe.dir,"duration")]}),t("th",{class:`sortable${oe.col==="queries"?" sortable--active":""}`,onClick:()=>Gr("queries"),children:["Queries ",Pe(oe.col,oe.dir,"queries")]}),t("th",{class:`sortable${oe.col==="memory"?" sortable--active":""}`,onClick:()=>Gr("memory"),title:ot,children:["Allocations ",Pe(oe.col,oe.dir,"memory")]}),t("th",{class:`sortable${oe.col==="status"?" sortable--active":""}`,onClick:()=>Gr("status"),children:["Status ",Pe(oe.col,oe.dir,"status")]}),t("th",{children:"Token"}),t("th",{})]})}),t("tbody",{children:pl.map(u=>{let R=Ee.has(u.token),N=!R&&Ee.size>=2;return t("tr",{class:R?"profiler-row--selected":"",children:[t("td",{children:t("input",{type:"checkbox",checked:R,disabled:N,onChange:()=>ol(u.token),title:N?"Deselect another profile first":"Select for comparison"})}),t("td",{children:po(u.started_at)}),t("td",{children:t("span",{class:Rc(u.method),children:u.method})}),t("td",{children:[t("a",{href:`${Kr}/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:Zo(u.duration),children:[u.duration.toFixed(2)," ms"]})}),t("td",{children:u.collectors_data?.database?.total_queries??"-"}),t("td",{children:rt(Te(u))}),t("td",{children:t("span",{class:kc(u.status),children:u.status})}),t("td",{class:"profiler-text--xs profiler-text--mono profiler-text--muted",children:t("button",{class:"token-copy",onClick:()=>_o(u.token),title:"Copy full token",children:W===u.token?"\u2713":u.token.substring(0,8)+"\u2026"})}),t("td",{children:t("button",{class:"btn-row-delete",onClick:()=>rl(u.token),title:"Delete",children:"\xD7"})})]},u.token)})})]}),qe&&!fn&&t("div",{class:"profiler-load-more",children:t("button",{class:"btn btn-secondary",onClick:Xi,disabled:Ce,children:Ce?"Loading\u2026":"Load more"})})]})),n==="jobs"&&(Z?t(Ur,{cols:["sm","flex","md","sm","xs","xs","sm"]}):Ne?t("div",{class:"profiler-empty",children:t("div",{class:"profiler-empty__title",children:Ne})}):U.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(M,{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:pr,onInput:u=>$r(u.target.value)}),t("select",{class:"profiler-filter-select",value:ct,onChange:u=>pt(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:_,onChange:u=>D(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:[mn&&t("span",{class:"profiler-filter-count",children:[wo.length," / ",U.length]}),t("button",{class:`btn-refresh${Z?" btn-refresh--spinning":""}`,onClick:Br,disabled:Z,title:"Refresh",children:"\u21BA"}),t("button",{class:"btn btn-danger btn-sm",onClick:ll,title:"Delete job profiles",children:"Clear"}),t("button",{class:"btn btn-danger btn-sm",onClick:ss,title:"Delete all HTTP and job profiles",children:"Clear All"})]})]}),wo.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${ye.col==="date"?" sortable--active":""}`,onClick:()=>os("date"),children:["Time ",Pe(ye.col,ye.dir,"date")]}),t("th",{children:"Job Class"}),t("th",{children:"Queue"}),t("th",{class:`sortable${ye.col==="duration"?" sortable--active":""}`,onClick:()=>os("duration"),children:["Duration ",Pe(ye.col,ye.dir,"duration")]}),t("th",{class:`sortable${ye.col==="status"?" sortable--active":""}`,onClick:()=>os("status"),children:["Status ",Pe(ye.col,ye.dir,"status")]}),t("th",{children:"Executions"}),t("th",{children:"Token"}),t("th",{})]})}),t("tbody",{children:dl.map(u=>{let R=u.collectors_data?.job,N=xi(u);return t("tr",{children:[t("td",{children:po(u.started_at)}),t("td",{children:[t("a",{href:`${Kr}/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:R?.queue||"-"})}),t("td",{children:N==="running"?t("span",{class:"profiler-text--muted",children:"-"}):t("span",{class:Zo(u.duration),children:[u.duration.toFixed(2)," ms"]})}),t("td",{children:N==="running"?t("span",{class:"badge-info",children:[t("span",{class:"profiler-spinner","aria-hidden":"true",children:"\u25D0"})," Running"]}):t("span",{class:N==="failed"?"badge-error":"badge-success",children:N==="failed"?"\u2717 Failed":"\u2713 Completed"})}),t("td",{children:R?.executions??"-"}),t("td",{class:"profiler-text--xs profiler-text--mono profiler-text--muted",children:t("button",{class:"token-copy",onClick:()=>_o(u.token),title:"Copy full token",children:W===u.token?"\u2713":u.token.substring(0,8)+"\u2026"})}),t("td",{children:t("button",{class:"btn-row-delete",onClick:()=>sl(u.token),title:"Delete",children:"\xD7"})})]},u.token)})})]}),nt&&!mn&&t("div",{class:"profiler-load-more",children:t("button",{class:"btn btn-secondary",onClick:Yi,disabled:at,children:at?"Loading\u2026":"Load more"})})]})),n==="console"&&(B?t(Ur,{cols:["sm","flex","sm","sm","xs","sm"]}):je?t("div",{class:"profiler-empty",children:t("div",{class:"profiler-empty__title",children:je})}):L.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(M,{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:O,onInput:u=>q(u.target.value)}),t("select",{class:"profiler-filter-select",value:J,onChange:u=>Re(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:[hn&&t("span",{class:"profiler-filter-count",children:[Co.length," / ",L.length]}),t("button",{class:`btn-refresh${B?" btn-refresh--spinning":""}`,onClick:Br,disabled:B,title:"Refresh",children:"\u21BA"}),t("button",{class:"btn btn-danger btn-sm",onClick:ul,title:"Delete console profiles",children:"Clear"}),t("button",{class:"btn btn-danger btn-sm",onClick:ss,title:"Delete all profiles",children:"Clear All"})]})]}),Co.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${be.col==="date"?" sortable--active":""}`,onClick:()=>ns("date"),children:["Time ",Pe(be.col,be.dir,"date")]}),t("th",{children:"Expression"}),t("th",{class:`sortable${be.col==="duration"?" sortable--active":""}`,onClick:()=>ns("duration"),children:["Duration ",Pe(be.col,be.dir,"duration")]}),t("th",{children:"SQL"}),t("th",{class:`sortable${be.col==="status"?" sortable--active":""}`,onClick:()=>ns("status"),children:["Status ",Pe(be.col,be.dir,"status")]}),t("th",{children:"Token"}),t("th",{})]})}),t("tbody",{children:fl.map(u=>{let R=u.status===500;return t("tr",{children:[t("td",{children:po(u.started_at)}),t("td",{children:[t("a",{href:`${Kr}/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:Zo(u.duration),children:[u.duration.toFixed(2)," ms"]})}),t("td",{children:u.collectors_data?.database?.total_queries??"-"}),t("td",{children:t("span",{class:R?"badge-error":"badge-success",children:R?"\u2717 Error":"\u2713 OK"})}),t("td",{class:"profiler-text--xs profiler-text--mono profiler-text--muted",children:t("button",{class:"token-copy",onClick:()=>_o(u.token),title:"Copy full token",children:W===u.token?"\u2713":u.token.substring(0,8)+"\u2026"})}),t("td",{children:t("button",{class:"btn-row-delete",onClick:()=>nl(u.token),title:"Delete",children:"\xD7"})})]},u.token)})})]}),S&&!hn&&t("div",{class:"profiler-load-more",children:t("button",{class:"btn btn-secondary",onClick:el,disabled:ur,children:ur?"Loading\u2026":"Load more"})})]})),n==="tests"&&(ce?t(Ur,{cols:["sm","flex","md","sm","xs","sm"]}):De?t("div",{class:"profiler-empty",children:t("div",{class:"profiler-empty__title",children:De})}):j.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(),Tt("runner")},children:"Test Runner"})," tab to run tests from here."]})]}):t(M,{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:Je,onInput:u=>Gt(u.target.value)}),t("select",{class:"profiler-filter-select",value:_t,onChange:u=>vo(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:[yn&&t("span",{class:"profiler-filter-count",children:[Eo.length," / ",j.length]}),t("button",{class:`btn-refresh${ce?" btn-refresh--spinning":""}`,onClick:Br,disabled:ce,title:"Refresh",children:"\u21BA"}),t("button",{class:"btn btn-danger btn-sm",onClick:cl,title:"Delete test profiles",children:"Clear All"})]})]}),Eo.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${xe.col==="date"?" sortable--active":""}`,onClick:()=>de(u=>({col:"date",dir:u.col==="date"&&u.dir==="asc"?"desc":"asc"})),children:["Time ",Pe(xe.col,xe.dir,"date")]}),t("th",{children:"Test Name"}),t("th",{children:"File"}),t("th",{class:`sortable${xe.col==="duration"?" sortable--active":""}`,onClick:()=>de(u=>({col:"duration",dir:u.col==="duration"&&u.dir==="asc"?"desc":"asc"})),children:["Duration ",Pe(xe.col,xe.dir,"duration")]}),t("th",{children:"Queries"}),t("th",{class:`sortable${xe.col==="status"?" sortable--active":""}`,onClick:()=>de(u=>({col:"status",dir:u.col==="status"&&u.dir==="asc"?"desc":"asc"})),children:["Status ",Pe(xe.col,xe.dir,"status")]}),t("th",{children:"Token"}),t("th",{})]})}),t("tbody",{children:ml.map(u=>{let R=u.collectors_data?.test,N=u.status===500,re=R?.status||(N?"failed":"passed");return t("tr",{children:[t("td",{children:po(u.started_at)}),t("td",{style:"max-width: 300px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap",children:t("a",{href:`${Kr}/profiles/${u.token}`,title:R?.test_name||u.path,children:R?.test_name||u.path})}),t("td",{class:"profiler-text--xs profiler-text--mono profiler-text--muted",children:R?.test_file||"-"}),t("td",{children:t("span",{class:Zo(u.duration),children:[u.duration.toFixed(2)," ms"]})}),t("td",{children:u.collectors_data?.database?.total_queries??"-"}),t("td",{children:t("span",{class:re==="failed"?"badge-error":re==="pending"?"badge-warning":"badge-success",children:re==="failed"?"\u2717 Failed":re==="pending"?"\u23F8 Pending":"\u2713 Passed"})}),t("td",{class:"profiler-text--xs profiler-text--mono profiler-text--muted",children:t("button",{class:"token-copy",onClick:()=>_o(u.token),title:"Copy full token",children:W===u.token?"\u2713":u.token.substring(0,8)+"\u2026"})}),t("td",{children:t("button",{class:"btn-row-delete",onClick:()=>al(u.token),title:"Delete",children:"\xD7"})})]},u.token)})})]}),H&&!yn&&t("div",{class:"profiler-load-more",children:t("button",{class:"btn btn-secondary",onClick:tl,disabled:Q,children:Q?"Loading\u2026":"Load more"})})]})),n==="runner"&&t(Wo,{}),n==="outbound"&&(fe?t(Ur,{cols:["sm","xs","flex","sm","xs"],rows:4}):ve?t("div",{class:"profiler-empty",children:t("div",{class:"profiler-empty__title",children:ve})}):T.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(M,{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:Vr,onInput:u=>bo(u.target.value)}),t("select",{class:"profiler-filter-select",value:xo,onChange:u=>cn(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:Hr,onChange:u=>pn(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:[hl&&t("span",{class:"profiler-filter-count",children:[as.length," / ",T.length]}),t("button",{class:`btn-refresh${fe?" btn-refresh--spinning":""}`,onClick:Br,disabled:fe,title:"Refresh",children:"\u21BA"})]})]}),t("p",{class:"profiler-text--xs profiler-text--muted profiler-mb-3",children:[T.length," outbound request",T.length!==1?"s":""," across all profiles. Click a request to expand headers and body."]}),as.length===0?t("div",{class:"profiler-empty",children:t("div",{class:"profiler-empty__title",children:"No results match filters"})}):as.map((u,R)=>t("div",{style:"margin-bottom:4px",children:[t("div",{class:"profiler-text--xs profiler-text--muted",style:"margin-bottom:2px",children:[po(u.profile_started_at)," \xB7 Profile: ",t("a",{href:`${Kr}/profiles/${u.profile_token}`,children:[u.profile_token.substring(0,8),"\u2026"]})]}),t(Zs,{req:u,index:R,threshold:500})]},R))]})),n==="env"&&(Y?t(Ur,{cols:["sm","flex","sm","sm"],rows:8}):we?t("div",{class:"profiler-empty",children:t("div",{class:"profiler-empty__title",children:we})}):t(st,{envData:F}))]})]})]})}function wi(){let{data:e}=Da({query:{retry:!1,refetchOnWindowFocus:!1}}),r=e?.slaves??[],o=qa();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:o??"__local__",onChange:a=>{let i=a.target.value;Oa(i==="__local__"?null:i)},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(a=>t("option",{value:a.name,disabled:a.status==="offline",children:[a.name," ",a.status==="offline"?"(offline)":""]},a.name))]}),o&&t("span",{style:{fontSize:"11px",color:"var(--profiler-text-secondary, #888)",fontStyle:"italic"},children:"Viewing slave data via proxy"})]})}function Sc(e){let r=e.headers??{},o=e.params??{},s=e.request_body,n=[`curl -X ${e.method}`];Object.entries(r).filter(([i])=>i!=="User-Agent").forEach(([i,l])=>n.push(` -H '${i}: ${l}'`)),["POST","PUT","PATCH"].includes(e.method)&&(s&&s.length>0?n.push(` -d '${s.replace(/'/g,"'\\''")}'`):Object.keys(o).length>0&&((r["Content-Type"]??"").includes("application/json")?n.push(` -d '${JSON.stringify(o).replace(/'/g,"'\\''")}'`):Object.entries(o).forEach(([l,f])=>n.push(` --data-urlencode '${l}=${f}'`))));let a=`http://localhost:3000${e.path}`;return e.method==="GET"&&Object.keys(o).length>0&&(a+="?"+Object.entries(o).map(([i,l])=>`${encodeURIComponent(i)}=${encodeURIComponent(String(l))}`).join("&")),n.push(` '${a}'`),n.join(` \\
12
+ `)}function Pc(e,r){let o=[],s=(a,i,l,f)=>{if(i){let p=l!=null?`${f?"at least ":""}${l.toLocaleString("en")} bytes, `:"";o.push(`${a} body truncated: ${p}only the beginning was kept (max_captured_body_bytes).`)}};s("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),s("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&&o.push(`Incomplete profile: the collectors of this stream were released after ${n} s, before the server closed it; what it did later is missing.`),o}function Ci({profile:e}){let r=e.collectors_data?.request??{},o=e.params&&Object.keys(e.params).length>0,s=Pc(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(zo,{method:e.method,url:e.path,copyUrl:`http://localhost:3000${e.path}`,status:e.status,duration:e.duration,curlCommand:Sc(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]})]}),s.map(n=>t("div",{class:"profiler-ajax-card__row profiler-text--xs profiler-text--warning",children:n},n)),t(Jo,{request:{headers:e.headers??{},body:e.request_body??void 0,body_encoding:e.request_body_encoding,params:o?e.params:void 0},response:{headers:e.response_headers??{},body:e.response_body??void 0,body_encoding:e.response_body_encoding}})]})}function Ac(e){return e.replace(/\$\d+/g,"?").replace(/\b\d+\b/g,"?").replace(/'[^']*'/g,"?").replace(/"[^"]*"/g,"?").trim()}function Mc(e){let r=new Map;e.forEach((s,n)=>{if(s.cached||s.transaction)return;let a=Ac(s.sql);r.has(a)||r.set(a,{indices:[],backtrace:s.backtrace??[]}),r.get(a).indices.push(n)});let o=[];return r.forEach(({indices:s,backtrace:n},a)=>{s.length>=3&&o.push({pattern:a,indices:s,backtrace:n})}),o.sort((s,n)=>n.indices.length-s.indices.length)}function Ei(e,r=0){let o=e["Node Type"]??"",s=e["Actual Rows"]??0,n=e["Plan Rows"]??1,a=o.includes("Seq Scan")||o.includes("Hash Join")||o.includes("Nested Loop")||o.includes("Filter")||s>0&&n>0&&s>n*10,i=e.Plans??[];return t("div",{class:`profiler-explain-node${a?" profiler-explain-node--expensive":""}`,style:`margin-left:${r*14}px`,children:[t("span",{class:"profiler-explain-node__type",children:o}),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: ",s," (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]})]}),i.map((l,f)=>Ei(l,r+1))]})}function Fc({state:e,onClose:r}){if(G(()=>{if(!e.open)return;let s=n=>{n.key==="Escape"&&r()};return document.addEventListener("keydown",s),()=>document.removeEventListener("keydown",s)},[e.open]),!e.open)return null;let o=()=>{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 s=typeof e.result=="string"?JSON.parse(e.result):e.result,n=Array.isArray(s)?s:[s];return t("div",{class:"profiler-explain-result",children:n.map((a,i)=>t("div",{children:[Ei(a.Plan??a),a["Planning Time"]!=null&&t("div",{class:"profiler-text--xs profiler-text--muted profiler-mt-2",children:["Planning: ",a["Planning Time"].toFixed(3),"ms",a["Execution Time"]!=null&&t(M,{children:[" \xB7 Execution: ",a["Execution Time"].toFixed(3),"ms"]})]})]},i))})}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:s=>s.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:o()})]})})}function Qt({dbData:e,token:r}){let[o,s]=b(new Set),[n,a]=b({open:!1,loading:!1,result:null,format:"text",adapter:"",error:null}),{mutateAsync:i}=$a();if(!e?.queries)return t("div",{class:"profiler-empty",children:t("p",{class:"profiler-empty__description",children:"No database queries recorded"})});let l=Mc(e.queries),f=new Set(l.flatMap(y=>y.indices)),p=y=>{s(h=>{let g=new Set(h);return g.has(y)?g.delete(y):g.add(y),g})},m=async y=>{a({open:!0,loading:!0,result:null,format:"text",adapter:"",error:null});try{let h=await i({data:{token:r,query_index:y}});a(g=>({...g,loading:!1,result:h.result,format:h.format??"text",adapter:h.adapter??""}))}catch(h){a(g=>({...g,loading:!1,error:h.message??"Request failed"}))}},d=()=>a(y=>({...y,open:!1}));return t(M,{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,h)=>y+h.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(h=>o.has(h.pattern));s(y?new Set:new Set(l.map(h=>h.pattern)))},children:l.every(y=>o.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:[o.has(y.pattern)?"\u25B2":"\u25BC"," backtrace"]})]}),o.has(y.pattern)&&y.backtrace.length>0&&t("div",{class:"profiler-n1-backtrace",children:y.backtrace.map((h,g)=>t("div",{class:"profiler-n1-backtrace__frame",children:t(bt,{frame:h})},g))})]},y.pattern)),e.queries.map((y,h)=>t("div",{class:["profiler-query-card",y.slow?"profiler-query-card--slow":"",f.has(h)?"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:["#",h+1]}),f.has(h)&&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:()=>m(h),children:"Explain"})]})]}),t("code",{class:"profiler-query-card__code",children:y.sql})]},h)),t(Fc,{state:n,onClose:d})]})}function Lt({dumpData:e}){return e?.dumps?.length?t(M,{children:[t("h2",{class:"profiler-section__header",children:["Dumped Variables (",e.count,")"]}),e.dumps.map((r,o)=>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:["#",o+1]}),r.label&&t("span",{class:"profiler-dump-card__label",children:r.label})]}),t("div",{children:[t("div",{class:"profiler-dump-card__location",children:t(ir,{file:r.file,line: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})})]},o))]}):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 qc={controller:"#60a5fa",view:"#34d399",partial:"#f59e0b",sql:"#fb923c",cache:"#a78bfa",http:"#f87171",custom:"#e879f9",method:"#94a3b8"},xt=24,Oc=1,en=xt+Oc,Dc=60,Qc=300,fo=class{constructor(r,o,s){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=s,this.flatten(o),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 o=(s,n)=>{for(let a of s)this.frames.push({node:a,depth:n,absStart:a.started_at,absEnd:a.finished_at}),n>this.maxDepth&&(this.maxDepth=n),a.children?.length&&o(a.children,n+1)};o(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 o=this.canvas.getBoundingClientRect().width,s=(this.maxDepth+1)*en+8;this.canvas.width=o*this.dpr,this.canvas.height=s*this.dpr,this.canvas.style.height=`${s}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,o){let s=this.canvas.getBoundingClientRect(),n=r-s.left,a=o-s.top,i=s.width,l=this.viewport.end-this.viewport.start;for(let f=this.frames.length-1;f>=0;f--){let p=this.frames[f],m=(p.absStart-this.viewport.start)/l*i,d=(p.absEnd-p.absStart)/l*i,y=p.depth*en;if(n>=m&&n<=m+d&&a>=y&&a<=y+xt)return p}return null}onMouseMove(r){if(this.isPanning)return;let o=this.hitTest(r.clientX,r.clientY);this.hoveredFrame=o,this.canvas.style.cursor=o?"pointer":"default",this.callbacks.onHover(o,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 o=this.hitTest(r.clientX,r.clientY);o&&(this.callbacks.onClick(o),this.zoomTo(o.node))}onWheel(r){r.preventDefault();let o=this.canvas.getBoundingClientRect(),n=(r.clientX-o.left)/o.width,a=this.viewport.end-this.viewport.start,i=r.deltaY>0?1.3:.7,l=Math.min(this.globalEnd-this.globalStart,a*i),f=this.viewport.start+n*a,p=f-n*l,m=f+(1-n)*l;p<this.globalStart&&(p=this.globalStart,m=p+l),m>this.globalEnd&&(m=this.globalEnd,p=m-l),this.animateViewport({start:p,end:m}),this.updateZoomStack(p,m)}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 o=r.clientX-this.panStartX,s=this.canvas.getBoundingClientRect(),n=this.panStartViewport.end-this.panStartViewport.start,a=-(o/s.width)*n,i=this.panStartViewport.start+a,l=this.panStartViewport.end+a;i<this.globalStart&&(l+=this.globalStart-i,i=this.globalStart),l>this.globalEnd&&(i-=l-this.globalEnd,l=this.globalEnd),this.viewport={start:i,end:l},this.targetViewport={...this.viewport},this.render()}onMouseUp(){this.isPanning&&(this.isPanning=!1,this.canvas.style.cursor="default")}zoomTo(r){let o=[],s=(a,i,l)=>{for(let f of a){if(f===i)return o.push(...l,f),!0;if(f.children?.length&&s(f.children,i,[...l,f]))return!0}return!1},n=this.frames.filter(a=>a.depth===0).map(a=>a.node);s(n,r,[]),this.zoomStack=o,this.animateViewport({start:r.started_at,end:r.finished_at}),this.callbacks.onZoomChange(o)}resetZoom(){this.zoomStack=[],this.animateViewport({start:this.globalStart,end:this.globalEnd}),this.callbacks.onZoomChange([])}updateZoomStack(r,o){let s=this.globalEnd-this.globalStart;o-r>=s*.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)/Qc),o=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)*o,end:this.prevViewport.end+(this.targetViewport.end-this.prevViewport.end)*o},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,o=this.canvas.width/this.dpr,s=this.canvas.height/this.dpr,n=this.viewport.end-this.viewport.start;r.clearRect(0,0,o,s);let a=getComputedStyle(this.canvas),i=a.getPropertyValue("--profiler-text").trim()||"#eef2f7",l=a.getPropertyValue("--profiler-text-muted").trim()||"#5e7080",f=this.searchQuery.toLowerCase(),p=f.length>0;if(p&&this.callbacks.onSearchResults){let m=0;for(let d of this.frames)d.node.name.toLowerCase().includes(f)&&m++;this.callbacks.onSearchResults(m,this.frames.length)}for(let m of this.frames){let d=(m.absStart-this.viewport.start)/n*o,y=(m.absEnd-m.absStart)/n*o,h=m.depth*en;if(d+y<0||d>o||y<.5)continue;let g=qc[m.node.category]||"#a78bfa",v=m===this.hoveredFrame,x=!!this.highlightName&&m.node.name===this.highlightName,w=!p||m.node.name.toLowerCase().includes(f);if(r.fillStyle=v||x?this.lightenColor(g,.2):g,r.globalAlpha=p&&!w?.2:v||x?1:.85,this.roundRect(r,d,h,y,xt,3),r.fill(),r.globalAlpha=1,v?(r.strokeStyle="#ffffff",r.lineWidth=1.5,this.roundRect(r,d,h,y,xt,3),r.stroke()):x?(r.strokeStyle="#fbbf24",r.lineWidth=2,this.roundRect(r,d,h,y,xt,3),r.stroke()):p&&w&&(r.strokeStyle="#ffffff",r.lineWidth=1,r.globalAlpha=.5,this.roundRect(r,d,h,y,xt,3),r.stroke(),r.globalAlpha=1),y>Dc&&w){r.fillStyle=this.getTextColor(g),r.font='11px "JetBrains Mono", monospace',r.textBaseline="middle";let C=m.node.name,A=`${m.node.duration.toFixed(1)}ms`,k=y-8,K=r.measureText(A).width;if(k>K+20){let U=k-K-8;r.fillText(this.truncateText(r,C,U),d+4,h+xt/2),r.fillStyle=v?i:l,r.fillText(A,d+y-K-4,h+xt/2)}else r.fillText(this.truncateText(r,C,k),d+4,h+xt/2)}}}roundRect(r,o,s,n,a,i){r.beginPath(),r.moveTo(o+i,s),r.lineTo(o+n-i,s),r.quadraticCurveTo(o+n,s,o+n,s+i),r.lineTo(o+n,s+a-i),r.quadraticCurveTo(o+n,s+a,o+n-i,s+a),r.lineTo(o+i,s+a),r.quadraticCurveTo(o,s+a,o,s+a-i),r.lineTo(o,s+i),r.quadraticCurveTo(o,s,o+i,s),r.closePath()}truncateText(r,o,s){if(r.measureText(o).width<=s)return o;let n=o;for(;n.length>0&&r.measureText(n+"...").width>s;)n=n.slice(0,-1);return n.length>0?n+"...":""}lightenColor(r,o){let s=parseInt(r.slice(1),16),n=Math.min(255,(s>>16&255)+Math.round(255*o)),a=Math.min(255,(s>>8&255)+Math.round(255*o)),i=Math.min(255,(s&255)+Math.round(255*o));return`rgb(${n},${a},${i})`}getTextColor(r){let o=parseInt(r.slice(1),16),s=o>>16&255,n=o>>8&255,a=o&255;return(.299*s+.587*n+.114*a)/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 Lc={controller:"Controller",view:"View",partial:"Partial",sql:"SQL",cache:"Cache",http:"HTTP",custom:"Custom",method:"Method"},Kc={controller:"#60a5fa",view:"#34d399",partial:"#f59e0b",sql:"#fb923c",cache:"#a78bfa",http:"#f87171",custom:"#e879f9",method:"#94a3b8"};function Uc(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(2)} MB`}var mo=class{constructor(r,o){this.totalDuration=o,this.el=document.createElement("div"),this.el.className="profiler-flamegraph__tooltip",r.appendChild(this.el)}show(r,o,s){let n=r.node,a=n.category,i=Kc[a]||"#a78bfa",l=Lc[a]||a,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 h=document.createElement("span");return h.className="tooltip-badge",h.style.background=i,h.textContent=l,h}),this.addRow("Duration",()=>{let h=document.createElement("span");return h.className="value",h.textContent=`${n.duration.toFixed(2)} ms`,h}),this.addRow("% of total",()=>{let h=document.createElement("span");return h.className="value",h.textContent=`${f}%`,h}),a==="method"&&n.payload&&(n.payload.memory_bytes!=null&&this.addRow("Memory",()=>{let h=document.createElement("span");return h.className="value",h.textContent=Uc(n.payload.memory_bytes),h}),n.payload.allocated_objects!=null&&this.addRow("Objects",()=>{let h=document.createElement("span");return h.className="value",h.textContent=`${n.payload.allocated_objects.toLocaleString()} obj`,h}),n.payload.recursive&&this.addRow("Recursive",()=>{let h=document.createElement("span");return h.className="value",h.style.color="var(--profiler-warning)",h.textContent="\u21BA yes",h}),n.payload.file)){let h=document.createElement("div");h.className="tooltip-payload",h.textContent=`${n.payload.file}:${n.payload.line}`,this.el.appendChild(h)}if(n.payload&&a!=="method"){let h=null;if(a==="sql"&&n.payload.sql){let g=n.payload.sql;h=g.length>200?g.slice(0,200)+"...":g}else if(a==="cache"&&n.payload.key)h=`Key: ${n.payload.key}`;else if(a==="http"&&n.payload.url)h=n.payload.url;else if(a==="custom"&&Object.keys(n.payload).length>0){let g=Object.entries(n.payload).map(([v,x])=>`${v}: ${JSON.stringify(x)}`).join(`
13
+ `);h=g.length>200?g.slice(0,200)+"...":g}if(h){let g=document.createElement("div");g.className="tooltip-payload",g.textContent=h,this.el.appendChild(g)}}let m=o+12,d=s-8,y=this.el.getBoundingClientRect();m+y.width>window.innerWidth&&(m=o-y.width-12),d+y.height>window.innerHeight&&(d=s-y.height-8),d<0&&(d=4),this.el.style.left=`${m}px`,this.el.style.top=`${d}px`,this.el.classList.add("visible")}hide(){this.el.classList.remove("visible")}destroy(){this.el.remove()}addRow(r,o){let s=document.createElement("div");s.className="tooltip-row";let n=document.createElement("span");n.className="label",n.textContent=r,s.appendChild(n),s.appendChild(o()),this.el.appendChild(s)}};var ho=class{constructor(r,o){this.onNavigate=o,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 o=document.createElement("button");o.className="breadcrumb-item",o.textContent="Root",o.addEventListener("click",()=>this.onNavigate(null)),this.el.appendChild(o);for(let s of r){let n=document.createElement("span");n.className="breadcrumb-separator",n.textContent="\u203A",this.el.appendChild(n);let a=document.createElement("button");a.className="breadcrumb-item";let i=s.name.length>30?s.name.slice(0,30)+"...":s.name;a.textContent=i,a.addEventListener("click",()=>this.onNavigate(s)),this.el.appendChild(a)}}destroy(){this.el.remove()}};var tn={controller:"#60a5fa",view:"#34d399",partial:"#f59e0b",sql:"#fb923c",cache:"#a78bfa",http:"#f87171",custom:"#e879f9",method:"#94a3b8"},Ri={controller:"Controller",view:"View",partial:"Partial",sql:"SQL",cache:"Cache",http:"HTTP",custom:"Custom",method:"Method"};function Kt({flamegraphData:e,perfData:r,functionProfileData:o}){let s=he(null),n=he(null),a=he(null),i=he(null),l=he(null),f=he(null),[p,m]=b(!1),[d,y]=b(""),[h,g]=b(0),[v,x]=b(0),[w,C]=b("total_duration"),[A,k]=b("desc"),[K,U]=b(o?.reason==="stackprof_missing"?!0:o?.enabled??!1),[L,j]=b(o?.max_frames??2e3),[T,F]=b(o?.mode==="lite"?"lite":"full"),[$,Z]=b(o?.clock??"wall"),[B,ce]=b(!1),[fe,Y]=b(!1),[Fe,Ne]=b(!1),[je,De]=b(!1),{mutateAsync:ve}=Ha(),we=async()=>{ce(!0);try{let Q=await ve({data:{enabled:!K}});U(Q.enabled)}finally{ce(!1)}},qe=async Q=>{Y(!0);try{let W=await ve({data:{max_frames:Q}});j(W.max_frames)}finally{Y(!1)}},nt=async Q=>{F(Q),Ne(!0);try{let W=await ve({data:{mode:Q}});F(W.mode??Q)}finally{Ne(!1)}},S=async Q=>{De(!0);try{let W=await ve({data:{clock:Q}});Z(W.clock??Q)}finally{De(!1)}},H=e;if(G(()=>{if(!H?.root_events?.length||!s.current||!n.current)return;let Q=n.current,W=s.current,Ie=new mo(Q,H.total_duration);i.current=Ie;let Ee=new ho(Q,pe=>{a.current&&(pe?a.current.zoomTo(pe):a.current.resetZoom())});l.current=Ee,Q.insertBefore(Ee.el,W);let Qe=new fo(W,H.root_events,{onHover:(pe,it,lt)=>{pe?Ie.show(pe,it,lt):Ie.hide()},onClick:pe=>{m(!0)},onZoomChange:pe=>{Ee.update(pe),m(pe.length>0)},onSearchResults:(pe,it)=>{g(pe),x(it)}});a.current=Qe;let Le=()=>Qe.resizeCanvas();window.addEventListener("resize",Le);let Vt=()=>Qe.render();return document.addEventListener("profiler:theme-change",Vt),()=>{Qe.destroy(),Ie.destroy(),Ee.destroy(),window.removeEventListener("resize",Le),document.removeEventListener("profiler:theme-change",Vt),a.current=null,i.current=null,l.current=null}},[H]),G(()=>{a.current?.setSearchQuery(d),d||(g(0),x(0))},[d]),G(()=>{let Q=W=>{(W.ctrlKey||W.metaKey)&&W.key==="f"&&(W.preventDefault(),f.current?.focus())};return document.addEventListener("keydown",Q,{capture:!0}),()=>document.removeEventListener("keydown",Q,{capture:!0})},[]),!H?.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,W)=>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)})]},W)),t(rn,{data:o,enabled:K,toggling:B,maxFrames:L,maxFramesUpdating:fe,mode:T,modeUpdating:Fe,clock:$,clockUpdating:je,sortKey:w,sortDir:A,onToggle:we,onMaxFramesChange:qe,onModeChange:nt,onClockChange:S,onSortChange:(Q,W)=>{C(Q),k(W)}})]}):t("div",{class:"profiler-flamegraph",children:[t("div",{class:"profiler-empty",children:t("p",{class:"profiler-empty__description",children:"No performance events recorded"})}),t(rn,{data:o,enabled:K,toggling:B,maxFrames:L,maxFramesUpdating:fe,mode:T,modeUpdating:Fe,clock:$,clockUpdating:je,sortKey:w,sortDir:A,onToggle:we,onMaxFramesChange:qe,onModeChange:nt,onClockChange:S,onSortChange:(Q,W)=>{C(Q),k(W)}})]});let Ce={},at=Q=>{let W=Q.category;Ce[W]||(Ce[W]={count:0,duration:0}),Ce[W].count++,Ce[W].duration+=Q.duration,Q.children?.forEach(at)};H.root_events.forEach(at);let ur=()=>{a.current?.resetZoom(),m(!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:H.total_events})]}),t("div",{class:"stat-item",children:[t("span",{class:"stat-label",children:"Total Duration"}),t("span",{class:"stat-value",children:[H.total_duration.toFixed(2)," ",t("small",{children:"ms"})]})]}),Object.keys(Ce).map(Q=>t("div",{class:"stat-item",children:[t("span",{class:"stat-label",children:[t("span",{class:"stat-dot",style:{background:tn[Q]}}),Ri[Q]]}),t("span",{class:"stat-value",children:Ce[Q].count})]},Q))]}),t("div",{class:"profiler-flamegraph__legend",children:Object.keys(tn).map(Q=>t("div",{class:"legend-item",children:[t("span",{class:"legend-color",style:{background:tn[Q]}}),t("span",{children:Ri[Q]})]},Q))}),t("div",{class:"profiler-flamegraph__controls",children:[p&&t("button",{class:"profiler-flamegraph__reset",onClick:ur,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:[h," / ",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:s,class:"profiler-flamegraph__canvas",style:{width:"100%"}})}),t(rn,{data:o,enabled:K,toggling:B,maxFrames:L,maxFramesUpdating:fe,mode:T,modeUpdating:Fe,clock:$,clockUpdating:je,sortKey:w,sortDir:A,onToggle:we,onMaxFramesChange:qe,onModeChange:nt,onClockChange:S,onSortChange:(Q,W)=>{C(Q),k(W)}})]})}function ki(e,r=new Set){return r.add(e.name),e.children?.forEach(o=>ki(o,r)),r}function Si(e,r){for(let o of e){if(o.name===r)return o;let s=Si(o.children??[],r);if(s)return s}return null}function rn({data:e,enabled:r,toggling:o,maxFrames:s,maxFramesUpdating:n,mode:a,modeUpdating:i,clock:l,clockUpdating:f,sortKey:p,sortDir:m,onToggle:d,onMaxFramesChange:y,onModeChange:h,onClockChange:g,onSortChange:v}){let[x,w]=b(null),[C,A]=b(null),[k,K]=b(null),U=he(null),L=r&&e?.enabled&&(e.functions?.length??0)>0,j=e?.reason==="stackprof_missing"&&a==="lite",T=e?.mode??"full",F=e?.clock??"wall",$=T==="lite",Z=F==="object",B=!$,ce=T==="full",fe=a==="lite",Y=p==="memory_bytes"&&!ce||p==="allocated_objects"&&!B?"total_duration":p,Fe=L?e.root_calls??[]:[],Ne=L?[...e.functions].sort((S,H)=>m==="asc"?S[Y]-H[Y]:H[Y]-S[Y]):[],je=x?Ne.filter(S=>x.has(S.name)):Ne,De=S=>{S?(w(ki(S)),A(S.name)):(w(null),A(null))},ve=S=>{S===p?v(S,m==="asc"?"desc":"asc"):v(S,"desc")},we=S=>Y!==S?t("span",{class:"sort-icon sort-icon--idle",children:"\u21C5"}):t("span",{class:"sort-icon sort-icon--active",children:m==="asc"?"\u25B2":"\u25BC"}),qe=S=>{let H=parseInt(S.target.value,10);!isNaN(H)&&H>0&&H!==s&&y(H)},nt=S=>{S.key==="Enter"&&S.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(S=>t("button",{class:`profiler-fn-profiling__mode-btn${a===S?" profiler-fn-profiling__mode-btn--active":""}`,onClick:()=>a!==S&&h(S),disabled:i,title:S==="full"?"Exhaustive TracePoint - timing + allocations + memory bytes":"StackProf sampling - very low overhead",children:S.charAt(0).toUpperCase()+S.slice(1)},S))}),fe&&t("div",{class:"profiler-fn-profiling__mode-selector",children:["wall","cpu","object"].map(S=>t("button",{class:`profiler-fn-profiling__mode-btn${l===S?" profiler-fn-profiling__mode-btn--active":""}`,onClick:()=>l!==S&&g(S),disabled:f,title:S==="wall"?"Wall-clock time (includes I/O waits)":S==="cpu"?"CPU time only (excludes I/O waits)":"Object allocations per function",children:S==="wall"?"Wall":S==="cpu"?"CPU":"Alloc"},S))}),t("label",{class:"profiler-fn-profiling__max-frames-label",children:["Max frames",t("input",{type:"number",class:"profiler-fn-profiling__max-frames-input",defaultValue:s,min:1,disabled:n,onBlur:qe,onKeyDown:nt}),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:o,children:o?"\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&&j&&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&&!L&&!j&&t("p",{class:"profiler-fn-profiling__hint",children:"Function profiling is active. Data will appear on the next request."}),L&&t(M,{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:$?"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"})]})]}),$&&!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"})]})]}),$&&(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,"%"]})]}),B&&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"})]})]}),ce&&t("div",{class:"stat-item",children:[t("span",{class:"stat-label",children:"Memory"}),t("span",{class:"stat-value",children:Qr(e.total_memory_bytes??0)})]})]}),Fe.length>0&&t(Nc,{rootCalls:Fe,onFrameSelect:De,rendererRef:U,onHoverName:S=>K(S)}),x&&t("div",{class:"profiler-fn-profiling__filter-active",children:[t("span",{children:["Showing ",t("strong",{children:C})," + ",x.size-1," child function",x.size!==2?"s":""]}),t("button",{class:"profiler-fn-profiling__filter-clear",onClick:()=>{w(null),A(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${Y==="calls"?" sortable--active":""}`,onClick:()=>ve("calls"),children:[$?"Samples":"Calls"," ",we("calls")]}),t("th",{class:`profiler-text--right sortable${Y==="total_duration"?" sortable--active":""}`,onClick:()=>ve("total_duration"),children:[Z?"Total Alloc":"Total Time"," ",we("total_duration")]}),t("th",{class:`profiler-text--right sortable${Y==="self_duration"?" sortable--active":""}`,onClick:()=>ve("self_duration"),children:[Z?"Self Alloc":"Self Time"," ",we("self_duration")]}),B&&t("th",{class:`profiler-text--right sortable${Y==="allocated_objects"?" sortable--active":""}`,onClick:()=>ve("allocated_objects"),children:["Objects ",we("allocated_objects")]}),ce&&t("th",{class:`profiler-text--right sortable${Y==="memory_bytes"?" sortable--active":""}`,onClick:()=>ve("memory_bytes"),children:["Memory ",we("memory_bytes")]})]})}),t("tbody",{children:je.map((S,H)=>t("tr",{class:k===S.name?"profiler-fn-profiling__row--highlighted":"",style:{cursor:Fe.length>0?"pointer":"default"},onMouseEnter:()=>{K(S.name),U.current?.setHighlightName(S.name)},onMouseLeave:()=>{K(null),U.current?.setHighlightName("")},onClick:()=>{let Ce=Si(Fe,S.name);Ce&&(U.current?.zoomTo(Ce),De(Ce))},children:[t("td",{class:"profiler-fn-profiling__name",children:[S.recursive_calls>0&&t("span",{class:"profiler-fn-profiling__recursive",title:`${S.recursive_calls} recursive call(s)`,children:"\u21BA"}),S.name]}),t("td",{class:"profiler-text--muted profiler-text--xs",style:{fontFamily:"var(--profiler-font-mono)"},children:t(ir,{file:S.file,line:S.line})}),t("td",{class:"profiler-text--right",children:S.calls}),t("td",{class:"profiler-text--right",children:Z?t("span",{class:"profiler-text--muted",children:[S.total_duration.toLocaleString()," ",t("small",{children:"obj"})]}):t("span",{class:S.total_duration>=100?"badge-error":S.total_duration>=10?"badge-warning":"badge-success",children:[S.total_duration.toFixed(2)," ms"]})}),t("td",{class:"profiler-text--right",children:Z?t("span",{class:"profiler-text--muted",children:[S.self_duration.toLocaleString()," ",t("small",{children:"obj"})]}):t("span",{class:S.self_duration>=50?"badge-error":S.self_duration>=5?"badge-warning":"badge-success",children:[S.self_duration.toFixed(2)," ms"]})}),B&&t("td",{class:"profiler-text--right profiler-text--muted",children:[S.allocated_objects.toLocaleString()," ",t("small",{children:"obj"})]}),ce&&t("td",{class:"profiler-text--right profiler-text--muted",children:Qr(S.memory_bytes)})]},H))})]})]})]})}function Nc({rootCalls:e,onFrameSelect:r,rendererRef:o,onHoverName:s}){let n=he(null),a=he(null),i=he(null),l=he(r),f=he(s),[p,m]=b(!1);G(()=>{l.current=r},[r]),G(()=>{f.current=s},[s]);let d=e.reduce((h,g)=>h+g.duration,0);return G(()=>{if(!e.length||!n.current||!a.current)return;let h=a.current,g=n.current,v=new mo(h,d),x=new ho(h,k=>{k?(i.current?.zoomTo(k),l.current?.(k)):(i.current?.resetZoom(),l.current?.(null))});h.insertBefore(x.el,g);let w=new fo(g,e,{onHover:(k,K,U)=>{k?(v.show(k,K,U),f.current?.(k.node.name)):(v.hide(),f.current?.(null))},onClick:k=>{m(!0),l.current?.(k.node),w.zoomTo(k.node)},onZoomChange:k=>{x.update(k),m(k.length>0),k.length===0&&l.current?.(null)}});i.current=w,o&&(o.current=w);let C=()=>w.resizeCanvas();window.addEventListener("resize",C);let A=()=>w.render();return document.addEventListener("profiler:theme-change",A),()=>{w.destroy(),v.destroy(),x.destroy(),window.removeEventListener("resize",C),document.removeEventListener("profiler:theme-change",A),i.current=null,o&&(o.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:()=>{i.current?.resetZoom(),m(!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:a,children:t("canvas",{ref:n,class:"profiler-flamegraph__canvas",style:{width:"100%"}})})]})}function Pi({viewData:e}){return e?t(M,{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(M,{children:[t("h3",{class:"profiler-text--lg profiler-mt-6 profiler-mb-3",children:"Templates"}),e.views.map((r,o)=>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"]})]})},o))]}),e.partials&&e.partials.length>0&&t(M,{children:[t("h3",{class:"profiler-text--lg profiler-mt-6 profiler-mb-3",children:"Partials"}),e.partials.map((r,o)=>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"]})]})},o))]})]}):t("div",{class:"profiler-empty",children:t("p",{class:"profiler-empty__description",children:"No view data recorded"})})}var jc={frame:"Turbo Frame request",stream:"Turbo Stream response"};function Ai({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(M,{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(([o,s])=>t("div",{class:"profiler-kv-row",children:[t("span",{class:`badge-${lr(o)}`,children:o}),t("strong",{children:s})]},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,s])=>t("div",{class:"profiler-kv-row",children:[t("span",{class:`badge-${o.startsWith("2")?"success":o.startsWith("4")||o.startsWith("5")?"error":"warning"}`,children:o}),t("strong",{children:s})]},o))]})]}),t("h3",{class:"profiler-text--lg profiler-mb-3",children:"Requests"}),e.requests.map((o,s)=>t("div",{class:`profiler-ajax-card profiler-ajax-card--${o.status>=200&&o.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-${lr(o.method)}`,children:o.method}),o.turbo&&t("span",{class:"badge-default",title:jc[o.turbo],children:o.turbo.toUpperCase()}),t("strong",{class:"profiler-ajax-card__path",children:o.path})]}),t("div",{class:"profiler-flex profiler-flex--gap-2",children:[t("span",{class:`badge-${Dr(o.status)}`,children:o.status}),t("span",{class:o.duration>=500?"badge-error":o.duration>=100?"badge-warning":"badge-success",children:[o.duration.toFixed(2)," ms"]})]})]}),t("div",{class:"profiler-ajax-card__row",children:[t("span",{class:"profiler-ajax-card__time",children:new Date(o.started_at).toLocaleTimeString("en",{hour12:!1})}),t("a",{href:`/_profiler/profiles/${o.token}`,class:"profiler-text--sm",style:"color: var(--profiler-accent);",children:"View Profile \u2192"})]})]},s))]})}function Ut({cacheData:e}){return e?t(M,{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(M,{children:[t("h3",{class:"profiler-text--lg profiler-mt-6 profiler-mb-3",children:"Cache Reads"}),e.reads.map((r,o)=>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"]})]})]})},o))]})]}):t("div",{class:"profiler-empty",children:t("p",{class:"profiler-empty__description",children:"No cache operations recorded"})})}function Ic(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 $c(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 Nt({logData:e}){let[r,o]=b("ALL"),[s,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 a=["ALL","DEBUG","INFO","WARN","ERROR","FATAL"],i=e.logs.filter(l=>!(r!=="ALL"&&l.level!==r||s&&!l.message.toLowerCase().includes(s.toLowerCase())));return t(M,{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:a.map(l=>t("button",{onClick:()=>o(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:s,onInput:l=>n(l.target.value),style:"width:200px"})]}),i.length===0?t("div",{class:"profiler-text--muted profiler-text--sm",children:["No messages match",s?` "${s}"`:"","."]}):i.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;${$c(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 ${Ic(l.level)}`,style:"white-space:pre-wrap;word-break:break-all;",children:l.message})]},f))]})}function jt({exceptionData:e}){let[r,o]=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 s=e.backtrace||[],n=s.filter(i=>i.app_frame),a=r?s:s.slice(0,30);return t(M,{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((i,l)=>t("div",{class:"profiler-query-card profiler-mb-1",children:t("code",{class:"profiler-text--sm",children:t(bt,{frame:i.location})})},l))]}),t("div",{children:[t("h3",{class:"profiler-section__header",children:["Full backtrace (",s.length," frames)"]}),a.map((i,l)=>t("div",{class:"profiler-query-card profiler-mb-1",style:i.app_frame?"":"opacity:0.45;",children:t("code",{class:`profiler-text--sm${i.app_frame?" profiler-text--success":" profiler-text--muted"}`,children:t(bt,{frame:i.location})})},l)),!r&&s.length>30&&t("button",{class:"btn btn-secondary btn-sm profiler-mt-2",onClick:()=>o(!0),children:["Show all ",s.length," frames"]})]})]})}var Vc={GET:"var(--profiler-success)",POST:"var(--profiler-accent)",PUT:"var(--profiler-warning)",PATCH:"var(--profiler-warning)",DELETE:"var(--profiler-error)"};function Mi({verb:e}){let r=Vc[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 Fi({routesData:e}){let[r,o]=b(""),[s,n]=b("ALL"),{total:a,matched:i,routes:l}=e,f=["ALL",...Array.from(new Set(l.map(m=>m.verb))).sort()],p=l.filter(m=>{let d=s==="ALL"||m.verb===s,y=r.toLowerCase(),h=!y||(m.pattern??"").toLowerCase().includes(y)||(m.name??"").toLowerCase().includes(y)||(m.controller_action??"").toLowerCase().includes(y);return d&&h});return t(M,{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:a}),t("div",{class:"profiler-stat-card__label",children:"Total routes"})]})}),i&&t(M,{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(Mi,{verb:i.verb})})]}),t("tr",{children:[t("th",{class:"profiler-text--sm",children:"Pattern"}),t("td",{class:"profiler-text--mono profiler-text--xs",children:i.pattern})]}),i.name&&t("tr",{children:[t("th",{class:"profiler-text--sm",children:"Route Name"}),t("td",{class:"profiler-text--mono profiler-text--xs",children:[i.name,"_path"]})]}),i.controller_action&&t("tr",{children:[t("th",{class:"profiler-text--sm",children:"Controller#Action"}),t("td",{class:"profiler-text--mono profiler-text--xs",children:i.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:m=>o(m.target.value),style:"flex:1;width:auto;min-width:200px;"}),t("div",{class:"profiler-flex profiler-flex--gap-1",children:f.map(m=>t("button",{onClick:()=>n(m),style:{padding:"3px 8px",fontSize:"11px",fontWeight:600,borderRadius:"4px",border:"1px solid var(--profiler-border)",background:s===m?"var(--profiler-accent)":"transparent",color:s===m?"#fff":"var(--profiler-text-muted)",cursor:"pointer"},children:m},m))})]}),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((m,d)=>t("div",{class:`profiler-flex-table__row${m.matched?" profiler-flex-table__row--matched":""}`,children:[t("span",{class:"profiler-flex-table__cell--fixed",children:t(Mi,{verb:m.verb})}),t("span",{class:"profiler-flex-table__cell profiler-text--mono profiler-text--xs",title:m.pattern,children:m.pattern}),t("span",{class:"profiler-flex-table__cell profiler-flex-table__cell--muted profiler-text--mono profiler-text--xs",title:m.name?`${m.name}_path`:"",children:m.name?`${m.name}_path`:"-"}),t("span",{class:"profiler-flex-table__cell profiler-flex-table__cell--muted profiler-text--mono profiler-text--xs",title:m.controller_action??"",children:m.controller_action??"-"})]},d))]})]})}function qi({i18nData:e}){let[r,o]=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 s=r==="MISSING"?e.lookups.filter(n=>n.missing):e.lookups;return t(M,{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:()=>o(n),class:`btn btn-sm ${r===n?"btn-primary":"btn-secondary"}`,children:n},n))}),s.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:s.map((n,a)=>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"})})]},a))})]})]})}function Xo({jobs:e}){return e?.length?t(M,{children:[t("h2",{class:"profiler-section__header",children:["Background Jobs (",e.length,")"]}),e.map((r,o)=>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"})]})]},o))]}):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 Hc({email:e}){let r=!!e.body_html,o=!!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&&!o)return null;let[s,n]=b(r?"preview":"text"),a=l=>f=>{f.stopPropagation(),n(l)},i={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(M,{children:[t("button",{class:"profiler-btn profiler-btn--sm",style:s==="preview"?i:{},onClick:a("preview"),children:"HTML preview"}),t("button",{class:"profiler-btn profiler-btn--sm",style:s==="source"?i:{},onClick:a("source"),children:"HTML source"})]}),o&&t("button",{class:"profiler-btn profiler-btn--sm",style:s==="text"?i:{},onClick:a("text"),children:"Plain text"})]}),s==="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"}}),(s==="source"||s==="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:s==="source"?e.body_html:e.body_text})]})}function Di({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(([o,s])=>t("div",{class:"profiler-kv-row",children:[t("span",{children:t("code",{children:["@",o]})}),t("code",{style:{textAlign:"right",wordBreak:"break-all",maxWidth:"60%"},children:s})]},o))]})}function Gc({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(Di,{assigns:e.assigns}),t(Hc,{email:e})]})}function Oi({email:e,onClick:r,isExpanded:o}){let s=["profiler-query-card",e.error?"profiler-query-card--slow":""].filter(Boolean).join(" ");return t("div",{class:s,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:o?"\u25B2":"\u25BC"})]})]}),o&&t(Gc,{email:e})]})}function Bc({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(Di,{assigns:e.assigns})]})}function Yo({mailerData:e}){let[r,o]=b(null),[s,n]=b(null),a=e?.queued_count??0;if(!e||e.total===0&&a===0)return t("div",{class:"profiler-empty",children:t("p",{class:"profiler-empty__description",children:"No emails sent during this request"})});let i=f=>o(r===f?null:f),l=f=>n(s===f?null:f);return t(M,{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})]}),a>0&&t("span",{children:["queued: ",t("strong",{children:a})]}),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(M,{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(Oi,{email:f,onClick:()=>i(p),isExpanded:r===p},p))]}),e.queued&&e.queued.length>0&&t(M,{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(Bc,{email:f},`q-${p}`))]}),e.errors.length>0&&t(M,{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(Oi,{email:f,onClick:()=>l(p),isExpanded:s===p},`err-${p}`))]})]})}function Qi({profile:e}){return e.trace_id?t(Jc,{profile:e,traceId:e.trace_id}):t("div",{class:"profiler-empty",children:[t("div",{class:"profiler-empty__icon",children:"\u{1F517}"}),t("h3",{class:"profiler-empty__title",children:"No trace for this profile"}),t("p",{class:"profiler-empty__description",children:"This profile was saved before distributed tracing was available."})]})}function Jc({profile:e,traceId:r}){let{data:o,isLoading:s,isError:n}=Za({trace_id:r,limit:50}),a=(o?.profiles??[]).filter(i=>i.token!==e.token);return t(M,{children:[t("h2",{class:"profiler-section__header",children:"Trace"}),t("div",{class:"profiler-panel profiler-panel--sm profiler-mb-6",children:[t("div",{class:"profiler-kv-row",children:[t("span",{children:"Trace ID"}),t("code",{class:"profiler-code",children:r})]}),t("div",{class:"profiler-kv-row",children:[t("span",{children:"Span ID"}),t("code",{class:"profiler-code",children:e.span_id??"-"})]}),t("div",{class:"profiler-kv-row",children:[t("span",{children:"Parent span ID"}),e.parent_span_id?t("code",{class:"profiler-code",children:e.parent_span_id}):t("span",{class:"profiler-text--muted",children:"none, this request started the trace"})]})]}),t("h3",{class:"profiler-text--lg profiler-mb-3",children:"Other profiles in this trace"}),s&&t("p",{class:"profiler-text--muted",children:"Loading..."}),n&&t("p",{class:"profiler-text--muted",children:"Could not load the profiles of this trace."}),!s&&!n&&a.length===0&&t("div",{class:"profiler-empty",children:[t("div",{class:"profiler-empty__icon",children:"\u{1F517}"}),t("h3",{class:"profiler-empty__title",children:"Single-span trace"}),t("p",{class:"profiler-empty__description",children:"No other stored profile shares this trace id. The request had no traceparent from a caller, or the other services are not profiled here."})]}),a.map(i=>t("div",{class:"profiler-ajax-card",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-${lr(i.method??"")}`,children:i.method}),t("strong",{class:"profiler-ajax-card__path",children:i.path})]}),t("div",{class:"profiler-flex profiler-flex--gap-2",children:[t("span",{class:`badge-${Dr(i.status??0)}`,children:i.status}),i.span_id&&i.span_id===e.parent_span_id&&t("span",{class:"badge-info",children:"caller"})]})]}),t("div",{class:"profiler-ajax-card__row",children:[t("span",{class:"profiler-ajax-card__time",children:["span ",i.span_id??"-"]}),t("a",{href:`/_profiler/profiles/${i.token}`,class:"profiler-text--sm",style:"color: var(--profiler-accent);",children:"View Profile \u2192"})]})]},i.token))]})}function Li({profile:e,initialTab:r,embedded:o}){let s=e.collectors_data||{},n=(s.ajax?.total_requests??0)>0,a=(s.http?.total_requests??0)>0,i=!!s.exception?.exception_class,l=(s.logs?.count??0)>0,f=(s.routes?.total??0)>0,p=(s.i18n?.total??0)>0,m=(e.child_jobs?.length??0)>0,d=(s.mailer?.total??0)>0,[y,h]=b(i?"exception":r),g=x=>w=>{w.preventDefault(),h(x);let C=new URL(window.location.href);C.searchParams.set("tab",x),history.pushState(null,"",C.toString())},v=x=>`tab${y===x?" 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})]}),Te(e)!=null&&t("span",{title:ot,children:["Allocations: ",t("strong",{children:rt(Te(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!==Be()&&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:Be()})]})]}),t("div",{class:"profiler-panel profiler-mb-6",children:[t("div",{class:"tabs",children:[i&&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"}),a&&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"}),m&&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("trace"),onClick:g("trace"),children:"Trace"}),t("a",{href:"#",class:v("env"),onClick:g("env"),children:"Env"})]}),t("div",{class:"profiler-p-4 tab-content active",children:[y==="exception"&&t(jt,{exceptionData:s.exception}),y==="request"&&t(Ci,{profile:e}),y==="dump"&&t(Lt,{dumpData:s.dump}),y==="database"&&t(Qt,{dbData:s.database,token:e.token}),y==="ajax"&&t(Ai,{ajaxData:s.ajax}),y==="http"&&t(Lr,{httpData:s.http}),y==="timeline"&&t(Kt,{flamegraphData:s.flamegraph,perfData:s.performance,functionProfileData:s.function_profile}),y==="views"&&t(Pi,{viewData:s.view}),y==="cache"&&t(Ut,{cacheData:s.cache}),y==="logs"&&t(Nt,{logData:s.logs}),y==="routes"&&t(Fi,{routesData:s.routes}),y==="i18n"&&t(qi,{i18nData:s.i18n}),y==="jobs"&&t(Xo,{jobs:e.child_jobs}),y==="mailer"&&t(Yo,{mailerData:s.mailer}),y==="trace"&&t(Qi,{profile:e}),y==="env"&&t(st,{envData:s.env,readOnly:!0})]})]}),!o&&t("div",{class:"profiler-mt-6",children:t("a",{href:"/_profiler",style:"color: var(--profiler-accent);",children:"\u2190 Back to profiles"})})]})}function Ki({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(M,{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((o,s)=>t("div",{class:"profiler-kv-row",children:[t("span",{class:"profiler-text--xs profiler-text--muted",children:["[",s,"]"]}),t("span",{class:"profiler-text--xs profiler-text--mono",style:"word-break:break-all",children:String(o)})]},s))]})]}),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 Ui({profile:e,initialTab:r,embedded:o}){let s=e.collectors_data||{},n=s.http?.total_requests>0,a=(e.child_jobs?.length??0)>0,i=(s.dump?.count??0)>0,l=(s.logs?.total??0)>0,f=!!s.exception?.exception_class,p=(s.mailer?.total??0)>0,d=["job","database","cache","http","jobs","dump","logs","exception","env","timeline","mailer"].includes(r)?r:"job",[y,h]=b(f?"exception":d),g=s.job,v=g?.status==="failed",x=g?.status==="running",w=e.parent_profile,C=k=>K=>{K.preventDefault(),h(k);let U=new URL(window.location.href);U.searchParams.set("tab",k),history.pushState(null,"",U.toString())},A=k=>`tab${y===k?" 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:x?"running":`${e.duration.toFixed(2)} ms`})]}),t("span",{children:["Status: ",t("strong",{children:t("span",{class:`badge-${v?"error":x?"info":"success"}`,children:v?"Failed":x?"Running":"Completed"})})]}),Te(e)!=null&&t("span",{title:ot,children:["Allocations: ",t("strong",{children:rt(Te(e))})]}),e.gem_version&&t("span",{class:"profiler-version-badge",children:["v",e.gem_version]})]}),e.gem_version&&e.gem_version!==Be()&&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:Be()})]}),w&&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:"}),w.profile_type==="http"?t("span",{children:[t("strong",{children:w.method})," ",w.path," \xB7 ",w.http_status," \xB7 ",w.duration?.toFixed(2)," ms"]}):t("span",{children:["\u2699\uFE0F ",t("strong",{children:w.path})," \xB7 ",w.duration?.toFixed(2)," ms"]}),t("a",{href:`/_profiler/profiles/${w.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:A("exception"),onClick:C("exception"),style:"color:var(--profiler-error,#ef4444);",children:"\u{1F4A5} Exception"}),t("a",{href:"#",class:A("job"),onClick:C("job"),children:"Job"}),t("a",{href:"#",class:A("database"),onClick:C("database"),children:"Database"}),t("a",{href:"#",class:A("cache"),onClick:C("cache"),children:"Cache"}),n&&t("a",{href:"#",class:A("http"),onClick:C("http"),children:"Outbound HTTP"}),t("a",{href:"#",class:A("timeline"),onClick:C("timeline"),children:"Timeline"}),a&&t("a",{href:"#",class:A("jobs"),onClick:C("jobs"),children:["Jobs (",e.child_jobs.length,")"]}),i&&t("a",{href:"#",class:A("dump"),onClick:C("dump"),children:["Dumps (",s.dump.count,")"]}),l&&t("a",{href:"#",class:A("logs"),onClick:C("logs"),children:"Logs"}),p&&t("a",{href:"#",class:A("mailer"),onClick:C("mailer"),children:"Mailers"}),t("a",{href:"#",class:A("env"),onClick:C("env"),children:"Env"})]}),t("div",{class:"profiler-p-4 tab-content active",children:[y==="exception"&&t(jt,{exceptionData:s.exception}),y==="job"&&t(Ki,{jobData:s.job}),y==="database"&&t(Qt,{dbData:s.database,token:e.token}),y==="cache"&&t(Ut,{cacheData:s.cache}),y==="http"&&t(Lr,{httpData:s.http}),y==="timeline"&&t(Kt,{flamegraphData:s.flamegraph,perfData:s.performance,functionProfileData:s.function_profile}),y==="jobs"&&t(Xo,{jobs:e.child_jobs}),y==="dump"&&t(Lt,{dumpData:s.dump}),y==="logs"&&t(Nt,{logData:s.logs}),y==="mailer"&&t(Yo,{mailerData:s.mailer}),y==="env"&&t(st,{envData:s.env,readOnly:!0})]})]}),!o&&t("div",{class:"profiler-mt-6",children:t("a",{href:"/_profiler",style:"color: var(--profiler-accent);",children:"\u2190 Back to profiles"})})]})}function Ni({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 ji({profile:e,initialTab:r,embedded:o}){let s=e.collectors_data||{},n=s.http?.total_requests>0,a=(s.dump?.count??0)>0,i=(s.logs?.total??0)>0,l=!!s.exception?.exception_class,f=s.console,m=["console","database","cache","http","dump","logs","exception","env","timeline"].includes(r)?r:"console",[d,y]=b(l?"exception":m),h=e.status===500,g=x=>w=>{w.preventDefault(),y(x);let C=new URL(window.location.href);C.searchParams.set("tab",x),history.pushState(null,"",C.toString())},v=x=>`tab${d===x?" 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-${h?"error":"success"}`,children:h?"Error":"OK"})})]}),Te(e)!=null&&t("span",{title:ot,children:["Allocations: ",t("strong",{children:rt(Te(e))})]}),e.gem_version&&t("span",{class:"profiler-version-badge",children:["v",e.gem_version]})]}),e.gem_version&&e.gem_version!==Be()&&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:Be()})]})]}),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"}),a&&t("a",{href:"#",class:v("dump"),onClick:g("dump"),children:"Dumps"}),i&&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(Ni,{data:f}),d==="database"&&t(Qt,{dbData:s.database,token:e.token}),d==="cache"&&t(Ut,{cacheData:s.cache}),d==="http"&&n&&t(Lr,{httpData:s.http}),d==="dump"&&a&&t(Lt,{dumpData:s.dump}),d==="logs"&&i&&t(Nt,{logData:s.logs}),d==="exception"&&l&&t(jt,{exceptionData:s.exception}),d==="env"&&t(st,{envData:s.env,readOnly:!0}),d==="timeline"&&t(Kt,{flamegraphData:s.flamegraph,perfData:s.performance,functionProfileData:s.function_profile})]})]}),!o&&t("div",{class:"profiler-mt-6",children:t("a",{href:"/_profiler",style:"color: var(--profiler-accent);",children:"\u2190 Back to profiles"})})]})}function zc(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 Ii({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:zc(e.status)})]}),t("tr",{children:[t("th",{children:"File"}),t("td",{class:"profiler-text--mono profiler-text--xs",children:t(ir,{file:e.test_file,line: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 $i({profile:e,initialTab:r,embedded:o}){let s=e.collectors_data||{},n=(s.dump?.count??0)>0,a=(s.logs?.total??0)>0,i=!!s.exception?.exception_class,l=s.test,p=["test","database","cache","dump","logs","exception","env","timeline"].includes(r)?r:"test",[m,d]=b(i?"exception":p),y=e.status===500,h=l?.status||(y?"failed":"passed"),g=x=>w=>{w.preventDefault(),d(x);let C=new URL(window.location.href);C.searchParams.set("tab",x),history.pushState(null,"",C.toString())},v=x=>`tab${m===x?" 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":h==="pending"?"warning":"success"}`,children:h==="failed"?"\u2717 Failed":h==="pending"?"\u23F8 Pending":"\u2713 Passed"})})]}),Te(e)!=null&&t("span",{title:ot,children:["Allocations: ",t("strong",{children:rt(Te(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:[i&&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 (",s.dump.count,")"]}),a&&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:[m==="test"&&l&&t(Ii,{testData:l}),m==="database"&&t(Qt,{dbData:s.database,token:e.token}),m==="cache"&&t(Ut,{cacheData:s.cache}),m==="timeline"&&t(Kt,{flamegraphData:s.flamegraph,perfData:s.performance,functionProfileData:s.function_profile}),m==="dump"&&n&&t(Lt,{dumpData:s.dump}),m==="logs"&&a&&t(Nt,{logData:s.logs}),m==="exception"&&i&&t(jt,{exceptionData:s.exception}),m==="env"&&t(st,{envData:s.env})]})]})]})}var Wc="/_profiler";function Vi(){return t("div",{class:"container",children:[t("div",{class:"header",children:[t("h1",{children:[t("a",{href:Wc,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(Wo,{})})})]})}var Nr="/_profiler";function ts(e){return new Date(e).toLocaleTimeString("en",{hour12:!1})}function ae(e){return e==null?"-":e.toFixed(2)+" ms"}function V(e,r=""){return e==null?"-":e.toFixed(2)+r}function Zc(e){return e>0?`+${e.toFixed(2)}`:e.toFixed(2)}function Xc(e){return e!=null?` (${e>0?"+":""}${e.toFixed(1)}%)`:""}function It(e,r,o,s){if(!r)return"";let n=o?o(r.value_a):V(r.value_a),a=s?s(r.value_b):V(r.value_b),i=`${Zc(r.delta)}${Xc(r.delta_pct)}`,l=r.status==="improved"?"\u2705":r.status==="regression"?"\u274C":"\u2796";return`| ${e} | ${n} | ${a} | ${i} | ${l} |`}function Yc(e){let{profile_a:r,profile_b:o,metrics:s}=e,n=["## Profile Comparison","",`**A:** \`${r.token}\` - ${r.method} ${r.path} - ${ts(r.started_at)}`,`**B:** \`${o.token}\` - ${o.method} ${o.path} - ${ts(o.started_at)}`];return e.same_endpoint||n.push("","> \u26A0\uFE0F Profiles are from different endpoints."),n.push("","| Metric | Before (A) | After (B) | Delta | |","|--------|-----------|-----------|-------|---|",It("Duration",s.duration,ae,ae),It("Allocated objects",s.allocated_objects,V,V),It("DB Queries",s.db_queries,V,V),It("DB Duration",s.db_duration,ae,ae),It("Cache Hit Rate",s.cache_hit_rate,a=>V(a,"%"),a=>V(a,"%")),It("View Duration",s.view_duration,ae,ae),It("HTTP Requests",s.http_requests,V,V),It("HTTP Duration",s.http_duration,ae,ae)),n.filter(a=>a!=="").join(`
14
+ `)}function ep(e){return e==="improved"?"badge-success":e==="regression"?"badge-error":"badge-default"}function tp({metric:e}){if(!e)return t("span",{class:"badge-default",children:"-"});let r=e.delta>0?"+":"",o=e.delta_pct!=null?` (${e.delta>0?"+":""}${e.delta_pct}%)`:"",s=`${r}${e.delta.toFixed(2)}${o}`;return t("span",{class:ep(e.status),children:s})}function $t({label:e,metric:r,formatA:o,formatB:s}){return r?t("tr",{children:[t("td",{children:e}),t("td",{class:"profiler-text--mono",children:o(r.value_a)}),t("td",{class:"profiler-text--mono",children:s(r.value_b)}),t("td",{children:t(tp,{metric:r})})]}):null}function es({label:e,rows:r}){return r.some(s=>s.a!=="-"||s.b!=="-")?t("div",{class:"profiler-mb-4",children:t("table",{children:[t("thead",{children:t("tr",{children:[t("th",{children:"Metric"}),t("th",{children:"Profile A"}),t("th",{children:"Profile B"})]})}),t("tbody",{children:r.map(s=>t("tr",{children:[t("td",{children:s.key}),t("td",{class:"profiler-text--mono",children:s.a}),t("td",{class:"profiler-text--mono",children:s.b})]},s.key))})]})}):t("div",{class:"profiler-empty profiler-mb-4",children:t("div",{class:"profiler-empty__title",children:["No ",e.toLowerCase()," data"]})})}function on({title:e,rows:r}){return t("div",{class:"profiler-mb-4",children:[t("h3",{children:[e," (",r.length,")"]}),r.length===0?t("p",{class:"profiler-text--muted",children:"None."}):t("table",{children:[t("thead",{children:t("tr",{children:[t("th",{children:"Query"}),t("th",{children:"Count A"}),t("th",{children:"Count B"}),t("th",{children:"Time A"}),t("th",{children:"Time B"})]})}),t("tbody",{children:r.map(o=>t("tr",{children:[t("td",{class:"profiler-text--mono profiler-text--xs",children:o.fingerprint}),t("td",{children:o.count_a}),t("td",{children:o.count_b}),t("td",{children:ae(o.total_duration_a)}),t("td",{children:[ae(o.total_duration_b),o.delta_pct!=null?` (+${o.delta_pct}%)`:""]})]}))})]})]})}function Hi({label:e,name:r,value:o,nodes:s,onChange:n}){return t("label",{style:"margin-right: 16px",children:[e," ",t("select",{name:r,value:o,onChange:a=>n(a.target.value),children:s.map(a=>t("option",{value:a,children:a}))})]})}function Gi({tokenA:e,tokenB:r,nodeA:o="",nodeB:s=""}){let[n,a]=b(["local"]),[i,l]=b(o||"local"),[f,p]=b(s||"local");G(()=>{fetch(`${Nr}/api/compare/nodes`,{headers:{"X-Profiler-Request":"1"}}).then(T=>T.ok?T.json():{nodes:["local"]}).then(T=>a(T.nodes)).catch(()=>{})},[]);let[m,d]=b(null),[y,h]=b(null),[g,v]=b(!0),[x,w]=b("sql");G(()=>{fetch(`${Nr}/api/compare?${new URLSearchParams({a:e,b:r,node_a:o,node_b:s}).toString()}`,{headers:{"X-Profiler-Request":"1"}}).then(T=>T.ok?T.json():T.json().then(F=>Promise.reject(F.errors?.join(", ")||"Error"))).then(T=>{d(T),v(!1)}).catch(T=>{h(typeof T=="string"?T:"Failed to load comparison"),v(!1)})},[e,r,o,s]);let[C,A]=b("");if(G(()=>{if(!m)return;let T=Yc(m),F=new Blob([T],{type:"text/plain"}),$=URL.createObjectURL(F);return A($),()=>URL.revokeObjectURL($)},[m]),g)return t("div",{class:"container",children:[t("div",{class:"header",children:t("h1",{children:"Profile Comparison"})}),t("div",{class:"profiler-panel profiler-p-4",children:t("div",{class:"profiler-empty",children:t("div",{class:"profiler-empty__title",children:"Loading\u2026"})})})]});if(y||!m)return t("div",{class:"container",children:[t("div",{class:"header",children:t("h1",{children:"Profile Comparison"})}),t("div",{class:"profiler-panel profiler-p-4",children:t("div",{class:"profiler-empty",children:t("div",{class:"profiler-empty__title",children:y||"Unknown error"})})})]});let{profile_a:k,profile_b:K,metrics:U,collectors:L}=m,j=T=>`tab${x===T?" active":""}`;return t("div",{class:"container",children:[t("div",{class:"header",children:[t("h1",{children:"Profile Comparison"}),t("p",{children:t("a",{href:`${Nr}/`,children:"\u2190 Back to list"})}),n.length>1&&t("form",{method:"get",action:`${Nr}/compare`,children:[t("input",{type:"hidden",name:"a",value:e}),t("input",{type:"hidden",name:"b",value:r}),t(Hi,{label:"Node A",name:"node_a",value:i,nodes:n,onChange:l}),t(Hi,{label:"Node B",name:"node_b",value:f,nodes:n,onChange:p}),t("button",{type:"submit",class:"btn btn-secondary btn-sm",children:"Compare"})]})]}),!m.same_endpoint&&t("div",{class:"profiler-panel profiler-p-4 profiler-mb-4",style:"border-left: 3px solid var(--color-warning, #f59e0b)",children:"\u26A0\uFE0F These profiles are from different endpoints - comparison may not be meaningful."}),t("div",{class:"profiler-panel profiler-mb-4",children:t("div",{class:"profiler-p-4",children:t("table",{children:[t("thead",{children:t("tr",{children:[t("th",{}),t("th",{children:"Profile A"}),t("th",{children:"Profile B"})]})}),t("tbody",{children:[t("tr",{children:[t("td",{children:"Endpoint"}),t("td",{children:k.node==="local"?t("a",{href:`${Nr}/profiles/${k.token}`,children:[k.method," ",k.path]}):t("span",{children:[k.method," ",k.path]})}),t("td",{children:K.node==="local"?t("a",{href:`${Nr}/profiles/${K.token}`,children:[K.method," ",K.path]}):t("span",{children:[K.method," ",K.path]})})]}),t("tr",{children:[t("td",{children:"Time"}),t("td",{class:"profiler-text--mono",children:ts(k.started_at)}),t("td",{class:"profiler-text--mono",children:ts(K.started_at)})]}),t("tr",{children:[t("td",{children:"Token"}),t("td",{class:"profiler-text--xs profiler-text--mono profiler-text--muted",children:[k.token.substring(0,16),"\u2026"]}),t("td",{class:"profiler-text--xs profiler-text--mono profiler-text--muted",children:[K.token.substring(0,16),"\u2026"]})]})]})]})})}),t("div",{class:"profiler-panel profiler-mb-4",children:t("div",{class:"profiler-p-4",children:[t("div",{style:"display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px",children:[t("h2",{style:"margin: 0",children:"Scorecard"}),C&&t("a",{class:"btn btn-secondary btn-sm",href:C,download:`compare-${e.substring(0,8)}-vs-${r.substring(0,8)}.md`,children:"Export as Markdown"})]}),t("table",{children:[t("thead",{children:t("tr",{children:[t("th",{children:"Metric"}),t("th",{children:"A"}),t("th",{children:"B"}),t("th",{children:"Delta"})]})}),t("tbody",{children:[t($t,{label:"Duration",metric:U.duration,formatA:ae,formatB:ae}),t($t,{label:"Allocated objects",metric:U.allocated_objects,formatA:T=>V(T),formatB:T=>V(T)}),t($t,{label:"DB Queries",metric:U.db_queries,formatA:T=>V(T),formatB:T=>V(T)}),t($t,{label:"DB Duration",metric:U.db_duration,formatA:ae,formatB:ae}),t($t,{label:"Cache Hit Rate",metric:U.cache_hit_rate,formatA:T=>V(T,"%"),formatB:T=>V(T,"%")}),t($t,{label:"View Duration",metric:U.view_duration,formatA:ae,formatB:ae}),t($t,{label:"HTTP Requests",metric:U.http_requests,formatA:T=>V(T),formatB:T=>V(T)}),t($t,{label:"HTTP Duration",metric:U.http_duration,formatA:ae,formatB:ae})]})]})]})}),t("div",{class:"profiler-panel profiler-mb-6",children:[t("div",{class:"tabs",children:[t("a",{href:"#",class:j("sql"),onClick:T=>{T.preventDefault(),w("sql")},children:"SQL"}),t("a",{href:"#",class:j("database"),onClick:T=>{T.preventDefault(),w("database")},children:"Database"}),t("a",{href:"#",class:j("cache"),onClick:T=>{T.preventDefault(),w("cache")},children:"Cache"}),t("a",{href:"#",class:j("views"),onClick:T=>{T.preventDefault(),w("views")},children:"Views"}),t("a",{href:"#",class:j("http"),onClick:T=>{T.preventDefault(),w("http")},children:"HTTP"})]}),t("div",{class:"profiler-p-4 tab-content active",children:[x==="sql"&&t("div",{children:[t(on,{title:"New queries (only in B)",rows:m.sql.new}),t(on,{title:"Gone queries (only in A)",rows:m.sql.gone}),t(on,{title:"Slower queries",rows:m.sql.slower})]}),x==="database"&&t(es,{label:"Database",rows:[{key:"Total Queries",a:V(L.database.total_queries_a),b:V(L.database.total_queries_b)},{key:"Total Duration",a:ae(L.database.total_duration_a),b:ae(L.database.total_duration_b)},{key:"Slow Queries",a:V(L.database.slow_queries_a),b:V(L.database.slow_queries_b)},{key:"Cached Queries",a:V(L.database.cached_queries_a),b:V(L.database.cached_queries_b)}]}),x==="cache"&&t(es,{label:"Cache",rows:[{key:"Total Reads",a:V(L.cache.total_reads_a),b:V(L.cache.total_reads_b)},{key:"Total Writes",a:V(L.cache.total_writes_a),b:V(L.cache.total_writes_b)},{key:"Hit Rate",a:V(L.cache.hit_rate_a,"%"),b:V(L.cache.hit_rate_b,"%")}]}),x==="views"&&t(es,{label:"Views",rows:[{key:"Templates",a:V(L.views.total_views_a),b:V(L.views.total_views_b)},{key:"Partials",a:V(L.views.total_partials_a),b:V(L.views.total_partials_b)},{key:"Total Duration",a:ae(L.views.total_duration_a),b:ae(L.views.total_duration_b)}]}),x==="http"&&t(es,{label:"HTTP",rows:[{key:"Total Requests",a:V(L.http.total_requests_a),b:V(L.http.total_requests_b)},{key:"Total Duration",a:ae(L.http.total_duration_a),b:ae(L.http.total_duration_b)},{key:"Slow Requests",a:V(L.http.slow_requests_a),b:V(L.http.slow_requests_b)},{key:"Error Requests",a:V(L.http.error_requests_a),b:V(L.http.error_requests_b)}]})]})]})]})}function Bi(e){console.log("Initializing profiler timeline");let r=e.dataset.token;if(!r){console.error("No profile token found");return}rp(r).then(o=>{op(e,o)})}async function rp(e){return(await(await fetch(`/_profiler/profiles/${e}/timeline`)).json()).events||[]}function op(e,r){if(!r.length){e.innerHTML="<p>No timeline events recorded</p>";return}let o=sp(r);e.appendChild(o)}function sp(e){let o=e.length*40+40,s=document.createElementNS("http://www.w3.org/2000/svg","svg");s.setAttribute("width","1200"),s.setAttribute("height",o.toString()),s.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 m=p*40+20,d=(f.started_at-n)*l+50,y=f.duration*l,h=document.createElementNS("http://www.w3.org/2000/svg","rect");h.setAttribute("x",d.toString()),h.setAttribute("y",m.toString()),h.setAttribute("width",Math.max(y,2).toString()),h.setAttribute("height","20"),h.setAttribute("fill",np(f.name)),h.setAttribute("rx","2");let g=document.createElementNS("http://www.w3.org/2000/svg","title");g.textContent=`${f.name}
15
+ Duration: ${f.duration.toFixed(2)}ms`,h.appendChild(g),s.appendChild(h);let v=document.createElementNS("http://www.w3.org/2000/svg","text");v.setAttribute("x","5"),v.setAttribute("y",(m+15).toString()),v.setAttribute("fill","#d4d4d4"),v.setAttribute("font-size","11"),v.textContent=f.name.substring(0,40),s.appendChild(v)}),s}function np(e){return e.includes("Controller")?"#569cd6":e.includes("Render")?"#4ec9b0":e.includes("Partial")?"#ce9178":"#dcdcaa"}var sn=new Map;function Ji(e){try{return localStorage.getItem(e)}catch{return sn.has(e)?sn.get(e):null}}function zi(e,r){sn.set(e,r);try{localStorage.setItem(e,r)}catch{}}var nn="profiler-theme",ap="data-theme",an=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===nn&&r.newValue&&(this.currentTheme=r.newValue,this.applyTheme(this.currentTheme))})}loadTheme(){return Ji(nn)||"auto"}saveTheme(r){zi(nn,r)}applyTheme(r){let o=this.resolveTheme(r);document.documentElement.setAttribute(ap,o),window.dispatchEvent(new CustomEvent("profiler:theme-change",{detail:{theme:o}}))}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 o=this.getResolvedTheme()==="dark"?"light":"dark";this.setTheme(o)}},un=new an;function ip(){un.toggle()}function ln(){return un.getResolvedTheme()}function lp(){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 up(){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 Wi(){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 o=ln();for(;e.firstChild;)e.removeChild(e.firstChild);let s=o==="dark"?lp():up();e.appendChild(s)};return r(),window.addEventListener("profiler:theme-change",r),e.addEventListener("click",()=>{ip()}),e}document.readyState==="loading"?document.addEventListener("DOMContentLoaded",()=>{console.log("\u{1F3A8} Theme system initialized:",ln())}):console.log("\u{1F3A8} Theme system initialized:",ln());var rs=new Qs({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&&fr(t(qr,{client:rs,children:t(wi,{})}),e);let o=document.getElementById("profiler-index");o&&fr(t(qr,{client:rs,children:t(Ti,{})}),o);let s=document.getElementById("profiler-show");if(s){let l=document.getElementById("profiler-show-data");if(l){let f=JSON.parse(l.textContent),p=new URLSearchParams(location.search).get("tab")||"request",m=s.dataset.embedded==="true",d;f.profile_type==="job"?d=t(Ui,{profile:f,initialTab:p,embedded:m}):f.profile_type==="console"?d=t(ji,{profile:f,initialTab:p,embedded:m}):f.profile_type==="test"?d=t($i,{profile:f,initialTab:p,embedded:m}):d=t(Li,{profile:f,initialTab:p,embedded:m}),fr(t(qr,{client:rs,children:d}),s)}}let n=document.getElementById("profiler-test-runner");n&&fr(t(qr,{client:rs,children:t(Vi,{})}),n);let a=document.getElementById("profiler-compare");if(a){let l=a.dataset.tokenA,f=a.dataset.tokenB;l&&f&&fr(t(Gi,{tokenA:l,tokenB:f,nodeA:a.dataset.nodeA||"",nodeB:a.dataset.nodeB||""}),a)}if(!o&&!s&&!n&&!a){let l=document.querySelector(".header, .profiler-detail");if(l){let f=Wi();f.style.position="absolute",f.style.top="20px",f.style.right="20px",l.style.position="relative",l.appendChild(f)}}let i=document.getElementById("profiler-timeline");i&&Bi(i)});})();