@cmmd-center/forge 0.13.121 → 0.13.122

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,5 +1,5 @@
1
1
  const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/transport-CgH8pQK3.js","assets/rolldown-runtime-hePW80VL.js","assets/workspaceReadinessAtom-D6bgTvKb.js","assets/atomRegistry-C1yW8tyM.js","assets/Stream-mUTFnSY9.js","assets/angular-html-B8mrqUL5.js","assets/html-XwrE-1r6.js","assets/javascript-obGGvMPs.js","assets/css-CNuuLpMC.js","assets/angular-ts-Bzix210W.js","assets/scss-YesllqfO.js","assets/apl-Dhin1L29.js","assets/xml-BlnrEAEy.js","assets/java-DdHNQ9hk.js","assets/json-DAgxKhMr.js","assets/astro-B-4NNgOP.js","assets/typescript-BydbNFcO.js","assets/postcss-BXeXVLqQ.js","assets/tsx-CUOciP0b.js","assets/blade-Wr94ul2N.js","assets/html-derivative-i4STDFnl.js","assets/sql-ClgswhA6.js","assets/bsl-BkkzgIyY.js","assets/sdbl-bTVj8UrX.js","assets/c-iCihek07.js","assets/cairo-DLTphjLi.js","assets/python-gzcpVVnB.js","assets/cobol-Cw2-KvLW.js","assets/coffee-CiiSLhB6.js","assets/cpp-DjoE5qBx.js","assets/regexp-DR20uMnK.js","assets/glsl-D5MA2a_X.js","assets/crystal-wCJpIkgB.js","assets/shellscript-Da78Ox-3.js","assets/edge-DCY0a-ow.js","assets/elixir-DP304Xio.js","assets/elm-o4NJxfws.js","assets/erb-BcNYoZVd.js","assets/ruby-2bd251b9.js","assets/haml-CwEpbK1d.js","assets/graphql-Ctjuxyvl.js","assets/jsx-gTgmArGx.js","assets/lua-FONpmTUP.js","assets/yaml-Du_6cdrH.js","assets/erlang-Cphh6RMH.js","assets/markdown-BYOwaDjH.js","assets/fortran-fixed-form-DEKoE2YW.js","assets/fortran-free-form-CYNrtFtB.js","assets/fsharp-D13ZGOAj.js","assets/gdresource-C0sCabJj.js","assets/gdshader-CBce3t8t.js","assets/gdscript-Cp2uCuqX.js","assets/git-commit-BSykSTBG.js","assets/diff-woXpYk--.js","assets/git-rebase-BDPpS8w6.js","assets/glimmer-js-BONyzAsu.js","assets/glimmer-ts-f9c0GCOe.js","assets/hack-7ztQ7Up-.js","assets/handlebars-ryMP1rBR.js","assets/http-kmH8AyfE.js","assets/hurl-DCZHXKU4.js","assets/csv-Dx-8-gkx.js","assets/hxml-B0Qn7Nwc.js","assets/haxe-OTjmBuCE.js","assets/jinja-B-tLrNsM.js","assets/jison-CBjhYtSs.js","assets/julia-CjHxn3vf.js","assets/r-D6UWEOL2.js","assets/just-CZ9bduw9.js","assets/perl-BAov3eih.js","assets/latex-D9bvcAJr.js","assets/tex-0w6-Dtgt.js","assets/liquid-G0MH4h_m.js","assets/marko-DV5GrDmo.js","assets/less-DVTAwKKz.js","assets/mdc-cg1lnqpW.js","assets/nextflow-BJtWHP5T.js","assets/nextflow-groovy-DJMQeKeT.js","assets/nginx-BTMw9COX.js","assets/nim-B6yJ_yaC.js","assets/php-Cg76ANFt.js","assets/pug-DkgDHZci.js","assets/qml-_a-QhfPD.js","assets/razor-D3EoCAik.js","assets/csharp-Ct8U2NOr.js","assets/rst-YTmaoyaq.js","assets/cmake-Bj61d0ZC.js","assets/sas-B6p8-ynO.js","assets/shaderlab-TOUzSsQk.js","assets/hlsl-Cvrh5tZx.js","assets/shellsession-CVsQGYfZ.js","assets/soy-DEd-qcad.js","assets/sparql-D_iOobhT.js","assets/turtle-ByJddavk.js","assets/stata-RoaAgbqU.js","assets/surrealql-DIn4NJsS.js","assets/svelte-Bj3Hmc9F.js","assets/templ-TjxbArHn.js","assets/go-rLFTqkRN.js","assets/ts-tags-DFwAVxhO.js","assets/twig-BbcH-NR0.js","assets/vue-BNi0qJZP.js","assets/vue-html-DkKkQnZL.js","assets/vue-vine-DFaKYU4X.js","assets/stylus-B6D30XZt.js","assets/xsl-BOPS8gLt.js"])))=>i.map(i=>d[i]);
2
- import{n as e,r as t,t as n}from"./rolldown-runtime-hePW80VL.js";import{$ as r,$t as i,Aa as a,An as o,Ar as s,At as c,B as l,Br as u,Bt as d,Ci as f,Dn as p,Ei as m,En as h,Er as g,Fa as _,Fi as v,Fn as y,Gn as b,Gt as x,Ha as S,Hn as C,Hr as w,Ht as T,Ia as E,It as ee,J as te,Jt as ne,Kt as re,L as ie,La as ae,Ln as oe,Lt as D,M as se,Ma as ce,Mr as le,Ni as ue,Nn as de,Nt as fe,Oa as pe,Pi as me,Pn as he,Pt as ge,Qi as _e,Rn as ve,Rr as ye,Rt as be,Si as xe,Ta as Se,Tn as Ce,Tr as we,Tt as Te,Ua as Ee,Un as De,Ur as Oe,Ut as eee,V as tee,Va as ke,Vn as Ae,Vr as je,Vt as Me,W as nee,Wa as ree,Wn as iee,Wr as aee,Wt as oee,X as see,Yi as Ne,Yt as cee,Z as lee,Zi as uee,_ as dee,_t as fee,an as pee,at as Pe,bn as mee,br as hee,bt as Fe,ca as Ie,ci as Le,ct as gee,dn as _ee,ea as Re,en as ze,et as Be,fi as Ve,gi as vee,gn as He,hn as yee,hr as bee,ht as xee,in as Ue,it as See,ja as Cee,jn as We,jr as wee,jt as Ge,ki as Tee,kr as Ke,kt as Eee,li as qe,ln as Dee,m as Oee,mn as kee,mr as Je,na as Aee,ni as jee,nt as Ye,oa as Mee,or as Xe,pn as Ze,pt as Nee,q as Pee,qt as Fee,r as Iee,rn as Qe,rr as Lee,rt as Ree,sn as zee,un as Bee,ut as $e,vn as et,vr as Vee,wn as Hee,wr as Uee,wt as tt,xi as Wee,xn as nt,y as Gee,yi as Kee,yn as qee,z as Jee,zn as Yee,zt as Xee}from"./Stream-mUTFnSY9.js";import{i as Zee,l as rt,n as it,o as at,s as ot}from"./atomRegistry-C1yW8tyM.js";import{An as Qee,_n as st,cn as $ee,on as ete,sn as ct,vn as tte}from"./CompositeItem-DNVaubQt.js";import{$t as nte,A as lt,At as ut,Bt as dt,C as rte,Ct as ft,Dt as pt,En as mt,Et as ht,Fn as gt,G as ite,Gn as ate,Gt as _t,H as vt,Hn as ote,Ht as ste,In as yt,J as cte,Jt as bt,Kn as lte,Kt as xt,Lt as St,Mn as Ct,Mt as wt,Nn as ute,Nt as Tt,On as dte,Ot as Et,Q as fte,Qt as pte,R as Dt,Rt as mte,Sn as hte,Tn as gte,U as Ot,Un as kt,Ut as At,Vn as jt,Vt as _te,W as vte,Wn as yte,Wt as Mt,Xt as bte,Yn as xte,Yt as Ste,Zt as Nt,_n as Pt,_t as Cte,a as wte,an as Tte,b as Ft,bt as Ete,c as Dte,cn as It,dt as Lt,en as Ote,er as Rt,ft as zt,gn as Bt,gt as Vt,hn as Ht,i as kte,in as Ate,j as Ut,jn as jte,jt as Wt,kn as Gt,l as Kt,mt as Mte,nn as qt,nt as Jt,on as Yt,pn as Xt,qt as Zt,rt as Qt,s as O,sn as $t,tn as Nte,tt as Pte,ut as en,v as tn,vn as k,vt as nn,w as Fte,wt as Ite,x as rn,xn as an,yn as on,zn as sn,zt as Lte}from"./src-BAHvoNAY.js";import{$ as Rte,A as cn,B as zte,C as Bte,D as Vte,E as Hte,F as ln,G as Ute,H as Wte,I as un,J as Gte,K as Kte,L as dn,M as fn,N as pn,O as qte,P as mn,Q as Jte,R as Yte,T as Xte,U as Zte,W as Qte,X as $te,Y as ene,Z as tne,_ as nne,a as hn,c as rne,d as ine,et as ane,it as gn,l as one,n as _n,nt as sne,q as cne,rt as lne,s as une,tt as dne,u as fne,w as pne}from"./cmmdAuthRedirect-BYBGztDm.js";import{t as A}from"./preload-helper-Czpn1I53.js";import{a as vn,i as mne,n as hne,o as yn,r as gne,t as bn}from"./debouncer-BmyJL8Gi.js";import{n as j,t as xn}from"./transport-CgH8pQK3.js";import{n as _ne,t as vne}from"./workspaceReadinessAtom-D6bgTvKb.js";import{a as yne,c as bne,n as xne,r as Sn,s as Sne,u as Cn}from"./themePalette-eOA8OvYM.js";function Cne(e){return e[e.length-1]}function wne(e,t){return typeof e==`function`?e(t):e}var wn=Object.prototype.hasOwnProperty,Tne=Object.prototype.propertyIsEnumerable;function Ene(e){for(let t in e)if(wn.call(e,t))return!0;return!1}var Dne=()=>Object.create(null),One=(e,t)=>Tn(e,t,Dne);function Tn(e,t,n=()=>({}),r=0){if(e===t)return e;if(r>500)return t;let i=t,a=kn(e)&&kn(i);if(!a&&!(Dn(e)&&Dn(i)))return i;let o=a?e:En(e);if(!o)return i;let s=a?i:En(i);if(!s)return i;let c=o.length,l=s.length,u=a?Array(l):n(),d=0;for(let t=0;t<l;t++){let o=a?t:s[t],l=e[o],f=i[o];if(l===f){u[o]=l,(a?t<c:wn.call(e,o))&&d++;continue}if(l===null||f===null||typeof l!=`object`||typeof f!=`object`){u[o]=f;continue}let p=Tn(l,f,n,r+1);u[o]=p,p===l&&d++}return c===l&&d===c?e:u}function En(e){let t=Object.keys(e);if(t.length!==Object.getOwnPropertyNames(e).length)return!1;let n=Object.getOwnPropertySymbols(e);if(n.length===0)return t;for(let r of n){if(!Tne.call(e,r))return!1;t.push(r)}return t}function Dn(e){if(!On(e))return!1;let t=e.constructor;if(t===void 0)return!0;let n=t.prototype;return!(!On(n)||!n.hasOwnProperty(`isPrototypeOf`))}function On(e){return Object.prototype.toString.call(e)===`[object Object]`}function kn(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function An(e,t,n){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return!1;for(let r=0,i=e.length;r<i;r++)if(!An(e[r],t[r],n))return!1;return!0}if(Dn(e)&&Dn(t)){let r=n?.ignoreUndefined??!0;if(n?.partial){for(let i in t)if((!r||t[i]!==void 0)&&!An(e[i],t[i],n))return!1;return!0}let i=0;if(!r)i=Object.keys(e).length;else for(let t in e)e[t]!==void 0&&i++;let a=0;for(let o in t)if((!r||t[o]!==void 0)&&(a++,a>i||!An(e[o],t[o],n)))return!1;return i===a}return!1}var kne=/[\x00-\x1f\x7f"<>`{}]/g;function Ane(e){return e.replace(kne,e=>`%`+e.charCodeAt(0).toString(16).toUpperCase().padStart(2,`0`))}function jn(e){let t;try{t=decodeURI(e)}catch{t=e.replaceAll(/%[0-9A-F]{2}/gi,e=>{try{return decodeURI(e)}catch{return e}})}return Ane(t)}var jne=[`http:`,`https:`,`mailto:`,`tel:`];function Mne(e,t){if(!e)return!1;try{let n=new URL(e);return!t.has(n.protocol)}catch{return!1}}function Nne(e){if(!e||!/[%\\\x00-\x1f\x7f]/.test(e)&&!e.startsWith(`//`))return{path:e,handledProtocolRelativeURL:!1};let t=/%25|%5C/gi,n=0,r=``,i;for(;(i=t.exec(e))!==null;)r+=jn(e.slice(n,i.index))+i[0],n=t.lastIndex;r+=jn(n?e.slice(n):e);let a=!1;return r.startsWith(`//`)&&(a=!0,r=`/`+r.replace(/^\/+/,``)),{path:r,handledProtocolRelativeURL:a}}function Pne(e){return/\s|[^\u0000-\u007F]/.test(e)?e.replace(/\s|[^\u0000-\u007F]/gu,encodeURIComponent):e}function Fne(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function Mn(){throw Error(`Invariant failed`)}var M=t(ree(),1),Nn=M.createContext(null);function Pn(e){return M.useContext(Nn)}var Fn=M.createContext(void 0),Ine=M.createContext(void 0),Lne=Qee();function Rne(e,t){return e===t}function In(e,t,n=Rne){let r=(0,M.useCallback)(t=>{if(!e)return()=>{};let{unsubscribe:n}=e.subscribe(t);return n},[e]),i=(0,M.useCallback)(()=>e?.get(),[e]);return(0,Lne.useSyncExternalStoreWithSelector)(r,i,i,t,n)}var Ln={};function Rn(e,t){let n=M.useRef();return r=>{let i=e?.select?e.select(r):r;return e?.structuralSharing??t.options.defaultStructuralSharing?n.current=Tn(n.current,i):i}}function zn(e){let t=Pn(),n=M.useContext(e.from?Ine:Fn),r=e.from??n,i=t.stores.getMatchStore(r),a=Rn(e,t),o=In(i,e=>e?a(e):Ln);if(o!==Ln)return o;(e.shouldThrow??!0)&&Mn()}function zne(e){return zn({from:e.from,shouldThrow:e.shouldThrow,structuralSharing:e.structuralSharing,strict:e.strict,select:t=>{let n=e.strict===!1?t.params:t._strictParams;return e.select?e.select(n):n}})}var N=Ee(),Bn=typeof window<`u`&&(window.desktopBridge!==void 0||window.nativeApi!==void 0),Vn=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(){}},Hn=new class extends Vn{#e;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<`u`&&window.addEventListener){let t=()=>e();return window.addEventListener(`visibilitychange`,t,!1),()=>{window.removeEventListener(`visibilitychange`,t)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(e=>{typeof e==`boolean`?this.setFocused(e):this.onFocus()})}setFocused(e){this.#e!==e&&(this.#e=e,this.onFocus())}onFocus(){let e=this.isFocused();this.listeners.forEach(t=>{t(e)})}isFocused(){return typeof this.#e==`boolean`?this.#e:globalThis.document?.visibilityState!==`hidden`}},Un={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},Wn=new class{#e=Un;setTimeoutProvider(e){this.#e=e}setTimeout(e,t){return this.#e.setTimeout(e,t)}clearTimeout(e){this.#e.clearTimeout(e)}setInterval(e,t){return this.#e.setInterval(e,t)}clearInterval(e){this.#e.clearInterval(e)}};function Gn(e){setTimeout(e,0)}var Kn=typeof window>`u`||`Deno`in globalThis;function qn(){}function Bne(e,t){return typeof e==`function`?e(t):e}function Jn(e){return typeof e==`number`&&e>=0&&e!==1/0}function Yn(e,t){return Math.max(e+(t||0)-Date.now(),0)}function Xn(e,t){return typeof e==`function`?e(t):e}function Zn(e,t){return typeof e==`function`?e(t):e}function Vne(e,t){let{type:n=`all`,exact:r,fetchStatus:i,predicate:a,queryKey:o,stale:s}=e;if(o){if(r){if(t.queryHash!==Qn(o,t.options))return!1}else if(!er(t.queryKey,o))return!1}if(n!==`all`){let e=t.isActive();if(n===`active`&&!e||n===`inactive`&&e)return!1}return!(typeof s==`boolean`&&t.isStale()!==s||i&&i!==t.state.fetchStatus||a&&!a(t))}function Hne(e,t){let{exact:n,status:r,predicate:i,mutationKey:a}=e;if(a){if(!t.options.mutationKey)return!1;if(n){if($n(t.options.mutationKey)!==$n(a))return!1}else if(!er(t.options.mutationKey,a))return!1}return!(r&&t.state.status!==r||i&&!i(t))}function Qn(e,t){return(t?.queryKeyHashFn||$n)(e)}function $n(e){return JSON.stringify(e,(e,t)=>ir(t)?Object.keys(t).sort().reduce((e,n)=>(e[n]=t[n],e),{}):t)}function er(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(e&&t&&typeof e==`object`&&typeof t==`object`){if(Array.isArray(e)&&Array.isArray(t)){for(let n=0;n<t.length;n++)if(!er(e[n],t[n]))return!1;return!0}let n=Object.keys(t);for(let r of n)if(!er(e[r],t[r]))return!1;return!0}return!1}var Une=Object.prototype.hasOwnProperty;function tr(e,t,n=0){if(e===t)return e;if(n>500)return t;let r=rr(e)&&rr(t);if(!r&&!(ir(e)&&ir(t)))return t;let i=(r?e:Object.keys(e)).length,a=r?t:Object.keys(t),o=a.length,s=r?Array(o):{},c=0;for(let l=0;l<o;l++){let o=r?l:a[l],u=e[o],d=t[o];if(u===d){s[o]=u,(r?l<i:Une.call(e,o))&&c++;continue}if(u===null||d===null||typeof u!=`object`||typeof d!=`object`){s[o]=d;continue}let f=tr(u,d,n+1);s[o]=f,f===u&&c++}return i===o&&c===i?e:s}function nr(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(let n in e)if(e[n]!==t[n])return!1;return!0}function rr(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function ir(e){if(!ar(e))return!1;let t=e.constructor;if(t===void 0)return!0;let n=t.prototype;return!(!ar(n)||!n.hasOwnProperty(`isPrototypeOf`)||Object.getPrototypeOf(e)!==Object.prototype)}function ar(e){return Object.prototype.toString.call(e)===`[object Object]`}function Wne(e){return new Promise(t=>{Wn.setTimeout(t,e)})}function or(e,t,n){return typeof n.structuralSharing==`function`?n.structuralSharing(e,t):n.structuralSharing===!1?t:tr(e,t)}function Gne(e){return e}function Kne(e,t,n=0){let r=[...e,t];return n&&r.length>n?r.slice(1):r}function qne(e,t,n=0){let r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var sr=Symbol();function cr(e,t){return!e.queryFn&&t?.initialPromise?()=>t.initialPromise:!e.queryFn||e.queryFn===sr?()=>Promise.reject(Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function lr(e,t){return typeof e==`function`?e(...t):!!e}function Jne(e,t,n){let r=!1,i;return Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(i??=t(),r?i:(r=!0,i.aborted?n():i.addEventListener(`abort`,n,{once:!0}),i))}),e}var ur=(()=>{let e=()=>Kn;return{isServer(){return e()},setIsServer(t){e=t}}})();function dr(){let e,t,n=new Promise((n,r)=>{e=n,t=r});n.status=`pending`,n.catch(()=>{});function r(e){Object.assign(n,e),delete n.resolve,delete n.reject}return n.resolve=t=>{r({status:`fulfilled`,value:t}),e(t)},n.reject=e=>{r({status:`rejected`,reason:e}),t(e)},n}var Yne=Gn;function Xne(){let e=[],t=0,n=e=>{e()},r=e=>{e()},i=Yne,a=r=>{t?e.push(r):i(()=>{n(r)})},o=()=>{let t=e;e=[],t.length&&i(()=>{r(()=>{t.forEach(e=>{n(e)})})})};return{batch:e=>{let n;t++;try{n=e()}finally{t--,t||o()}return n},batchCalls:e=>(...t)=>{a(()=>{e(...t)})},schedule:a,setNotifyFunction:e=>{n=e},setBatchNotifyFunction:e=>{r=e},setScheduler:e=>{i=e}}}var fr=Xne(),pr=new class extends Vn{#e=!0;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<`u`&&window.addEventListener){let t=()=>e(!0),n=()=>e(!1);return window.addEventListener(`online`,t,!1),window.addEventListener(`offline`,n,!1),()=>{window.removeEventListener(`online`,t),window.removeEventListener(`offline`,n)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(this.setOnline.bind(this))}setOnline(e){this.#e!==e&&(this.#e=e,this.listeners.forEach(t=>{t(e)}))}isOnline(){return this.#e}};function Zne(e){return Math.min(1e3*2**e,3e4)}function mr(e){return(e??`online`)!==`online`||pr.isOnline()}var hr=class extends Error{constructor(e){super(`CancelledError`),this.revert=e?.revert,this.silent=e?.silent}};function gr(e){let t=!1,n=0,r,i=dr(),a=()=>i.status!==`pending`,o=t=>{if(!a()){let n=new hr(t);f(n),e.onCancel?.(n)}},s=()=>{t=!0},c=()=>{t=!1},l=()=>Hn.isFocused()&&(e.networkMode===`always`||pr.isOnline())&&e.canRun(),u=()=>mr(e.networkMode)&&e.canRun(),d=e=>{a()||(r?.(),i.resolve(e))},f=e=>{a()||(r?.(),i.reject(e))},p=()=>new Promise(t=>{r=e=>{(a()||l())&&t(e)},e.onPause?.()}).then(()=>{r=void 0,a()||e.onContinue?.()}),m=()=>{if(a())return;let r,i=n===0?e.initialPromise:void 0;try{r=i??e.fn()}catch(e){r=Promise.reject(e)}Promise.resolve(r).then(d).catch(r=>{if(a())return;let i=e.retry??(ur.isServer()?0:3),o=e.retryDelay??Zne,s=typeof o==`function`?o(n,r):o,c=i===!0||typeof i==`number`&&n<i||typeof i==`function`&&i(n,r);if(t||!c){f(r);return}n++,e.onFail?.(n,r),Wne(s).then(()=>l()?void 0:p()).then(()=>{t?f(r):m()})})};return{promise:i,status:()=>i.status,cancel:o,continue:()=>(r?.(),i),cancelRetry:s,continueRetry:c,canStart:u,start:()=>(u()?m():p().then(m),i)}}var _r=class{#e;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),Jn(this.gcTime)&&(this.#e=Wn.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(ur.isServer()?1/0:3e5))}clearGcTimeout(){this.#e!==void 0&&(Wn.clearTimeout(this.#e),this.#e=void 0)}};function Qne(e){return{onFetch:(t,n)=>{let r=t.options,i=t.fetchOptions?.meta?.fetchMore?.direction,a=t.state.data?.pages||[],o=t.state.data?.pageParams||[],s={pages:[],pageParams:[]},c=0,l=async()=>{let n=!1,l=e=>{Jne(e,()=>t.signal,()=>n=!0)},u=cr(t.options,t.fetchOptions),d=async(e,r,i)=>{if(n)return Promise.reject(t.signal.reason);if(r==null&&e.pages.length)return Promise.resolve(e);let a=(()=>{let e={client:t.client,queryKey:t.queryKey,pageParam:r,direction:i?`backward`:`forward`,meta:t.options.meta};return l(e),e})(),o=await u(a),{maxPages:s}=t.options,c=i?qne:Kne;return{pages:c(e.pages,o,s),pageParams:c(e.pageParams,r,s)}};if(i&&a.length){let e=i===`backward`,t=e?yr:vr,n={pages:a,pageParams:o};s=await d(n,t(r,n),e)}else{let t=e??a.length;do{let e=c===0?o[0]??r.initialPageParam:vr(r,s);if(c>0&&e==null)break;s=await d(s,e),c++}while(c<t)}return s};t.fetchFn=t.options.persister?()=>t.options.persister?.(l,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n):l}}}function vr(e,{pages:t,pageParams:n}){let r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,n[r],n):void 0}function yr(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}function $ne(e,t){return t?vr(e,t)!=null:!1}function ere(e,t){return!t||!e.getPreviousPageParam?!1:yr(e,t)!=null}var tre=class extends _r{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e){super(),this.#s=!1,this.#o=e.defaultOptions,this.setOptions(e.options),this.observers=[],this.#i=e.client,this.#r=this.#i.getQueryCache(),this.queryKey=e.queryKey,this.queryHash=e.queryHash,this.#t=Sr(this.options),this.state=e.state??this.#t,this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return this.#e}get promise(){return this.#a?.promise}setOptions(e){if(this.options={...this.#o,...e},e?._type&&(this.#e=e._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){let e=Sr(this.options);e.data!==void 0&&(this.setState(xr(e.data,e.dataUpdatedAt)),this.#t=e)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus===`idle`&&this.#r.remove(this)}setData(e,t){let n=or(this.state.data,e,this.options);return this.#l({data:n,type:`success`,dataUpdatedAt:t?.updatedAt,manual:t?.manual}),n}setState(e){this.#l({type:`setState`,state:e})}cancel(e){let t=this.#a?.promise;return this.#a?.cancel(e),t?t.then(qn).catch(qn):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return this.#t}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(e=>Zn(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===sr||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0&&this.observers.some(e=>Xn(e.options.staleTime,this)===`static`)}isStale(){return this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(e=0){return this.state.data===void 0?!0:e===`static`?!1:this.state.isInvalidated?!0:!Yn(this.state.dataUpdatedAt,e)}onFocus(){this.observers.find(e=>e.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#a?.continue()}onOnline(){this.observers.find(e=>e.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#a?.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),this.#r.notify({type:`observerAdded`,query:this,observer:e}))}removeObserver(e){this.observers.includes(e)&&(this.observers=this.observers.filter(t=>t!==e),this.observers.length||(this.#a&&(this.#s||this.#c()?this.#a.cancel({revert:!0}):this.#a.cancelRetry()),this.scheduleGc()),this.#r.notify({type:`observerRemoved`,query:this,observer:e}))}getObserversCount(){return this.observers.length}#c(){return this.state.fetchStatus===`paused`&&this.state.status===`pending`}invalidate(){this.state.isInvalidated||this.#l({type:`invalidate`})}async fetch(e,t){if(this.state.fetchStatus!==`idle`&&this.#a?.status()!==`rejected`){if(this.state.data!==void 0&&t?.cancelRefetch)this.cancel({silent:!0});else if(this.#a)return this.#a.continueRetry(),this.#a.promise}if(e&&this.setOptions(e),!this.options.queryFn){let e=this.observers.find(e=>e.options.queryFn);e&&this.setOptions(e.options)}let n=new AbortController,r=e=>{Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(this.#s=!0,n.signal)})},i=()=>{let e=cr(this.options,t),n=(()=>{let e={client:this.#i,queryKey:this.queryKey,meta:this.meta};return r(e),e})();return this.#s=!1,this.options.persister?this.options.persister(e,n,this):e(n)},a=(()=>{let e={fetchOptions:t,options:this.options,queryKey:this.queryKey,client:this.#i,state:this.state,fetchFn:i};return r(e),e})();(this.#e===`infinite`?Qne(this.options.pages):this.options.behavior)?.onFetch(a,this),this.#n=this.state,(this.state.fetchStatus===`idle`||this.state.fetchMeta!==a.fetchOptions?.meta)&&this.#l({type:`fetch`,meta:a.fetchOptions?.meta}),this.#a=gr({initialPromise:t?.initialPromise,fn:a.fetchFn,onCancel:e=>{e instanceof hr&&e.revert&&this.setState({...this.#n,fetchStatus:`idle`}),n.abort()},onFail:(e,t)=>{this.#l({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#l({type:`pause`})},onContinue:()=>{this.#l({type:`continue`})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0});try{let e=await this.#a.start();if(e===void 0)throw Error(`${this.queryHash} data is undefined`);return this.setData(e),this.#r.config.onSuccess?.(e,this),this.#r.config.onSettled?.(e,this.state.error,this),e}catch(e){if(e instanceof hr){if(e.silent)return this.#a.promise;if(e.revert){if(this.state.data===void 0)throw e;return this.state.data}}throw this.#l({type:`error`,error:e}),this.#r.config.onError?.(e,this),this.#r.config.onSettled?.(this.state.data,e,this),e}finally{this.scheduleGc()}}#l(e){let t=t=>{switch(e.type){case`failed`:return{...t,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case`pause`:return{...t,fetchStatus:`paused`};case`continue`:return{...t,fetchStatus:`fetching`};case`fetch`:return{...t,...br(t.data,this.options),fetchMeta:e.meta??null};case`success`:let n={...t,...xr(e.data,e.dataUpdatedAt),dataUpdateCount:t.dataUpdateCount+1,...!e.manual&&{fetchStatus:`idle`,fetchFailureCount:0,fetchFailureReason:null}};return this.#n=e.manual?n:void 0,n;case`error`:let r=e.error;return{...t,error:r,errorUpdateCount:t.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:t.fetchFailureCount+1,fetchFailureReason:r,fetchStatus:`idle`,status:`error`,isInvalidated:!0};case`invalidate`:return{...t,isInvalidated:!0};case`setState`:return{...t,...e.state}}};this.state=t(this.state),fr.batch(()=>{this.observers.forEach(e=>{e.onQueryUpdate()}),this.#r.notify({query:this,type:`updated`,action:e})})}};function br(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:mr(t.networkMode)?`fetching`:`paused`,...e===void 0&&{error:null,status:`pending`}}}function xr(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:`success`}}function Sr(e){let t=typeof e.initialData==`function`?e.initialData():e.initialData,n=t!==void 0,r=n?typeof e.initialDataUpdatedAt==`function`?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?`success`:`pending`,fetchStatus:`idle`}}var Cr=class extends Vn{constructor(e,t){super(),this.options=t,this.#e=e,this.#s=null,this.#o=dr(),this.bindMethods(),this.setOptions(t)}#e;#t=void 0;#n=void 0;#r=void 0;#i;#a;#o;#s;#c;#l;#u;#d;#f;#p;#m=new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#t.addObserver(this),wr(this.#t,this.options)?this.#h():this.updateResult(),this.#y())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return Tr(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Tr(this.#t,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#b(),this.#x(),this.#t.removeObserver(this)}setOptions(e){let t=this.options,n=this.#t;if(this.options=this.#e.defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!=`boolean`&&typeof this.options.enabled!=`function`&&typeof Zn(this.options.enabled,this.#t)!=`boolean`)throw Error(`Expected enabled to be a boolean or a callback that returns a boolean`);this.#S(),this.#t.setOptions(this.options),t._defaulted&&!nr(this.options,t)&&this.#e.getQueryCache().notify({type:`observerOptionsUpdated`,query:this.#t,observer:this});let r=this.hasListeners();r&&Er(this.#t,n,this.options,t)&&this.#h(),this.updateResult(),r&&(this.#t!==n||Zn(this.options.enabled,this.#t)!==Zn(t.enabled,this.#t)||Xn(this.options.staleTime,this.#t)!==Xn(t.staleTime,this.#t))&&this.#g();let i=this.#_();r&&(this.#t!==n||Zn(this.options.enabled,this.#t)!==Zn(t.enabled,this.#t)||i!==this.#p)&&this.#v(i)}getOptimisticResult(e){let t=this.#e.getQueryCache().build(this.#e,e),n=this.createResult(t,e);return rre(this,n)&&(this.#r=n,this.#a=this.options,this.#i=this.#t.state),n}getCurrentResult(){return this.#r}trackResult(e,t){return new Proxy(e,{get:(e,n)=>(this.trackProp(n),t?.(n),n===`promise`&&(this.trackProp(`data`),!this.options.experimental_prefetchInRender&&this.#o.status===`pending`&&this.#o.reject(Error(`experimental_prefetchInRender feature flag is not enabled`))),Reflect.get(e,n))})}trackProp(e){this.#m.add(e)}getCurrentQuery(){return this.#t}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){let t=this.#e.defaultQueryOptions(e),n=this.#e.getQueryCache().build(this.#e,t);return n.fetch().then(()=>this.createResult(n,t))}fetch(e){return this.#h({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#r))}#h(e){this.#S();let t=this.#t.fetch(this.options,e);return e?.throwOnError||(t=t.catch(qn)),t}#g(){this.#b();let e=Xn(this.options.staleTime,this.#t);if(ur.isServer()||this.#r.isStale||!Jn(e))return;let t=Yn(this.#r.dataUpdatedAt,e)+1;this.#d=Wn.setTimeout(()=>{this.#r.isStale||this.updateResult()},t)}#_(){return(typeof this.options.refetchInterval==`function`?this.options.refetchInterval(this.#t):this.options.refetchInterval)??!1}#v(e){this.#x(),this.#p=e,!(ur.isServer()||Zn(this.options.enabled,this.#t)===!1||!Jn(this.#p)||this.#p===0)&&(this.#f=Wn.setInterval(()=>{(this.options.refetchIntervalInBackground||Hn.isFocused())&&this.#h()},this.#p))}#y(){this.#g(),this.#v(this.#_())}#b(){this.#d!==void 0&&(Wn.clearTimeout(this.#d),this.#d=void 0)}#x(){this.#f!==void 0&&(Wn.clearInterval(this.#f),this.#f=void 0)}createResult(e,t){let n=this.#t,r=this.options,i=this.#r,a=this.#i,o=this.#a,s=e===n?this.#n:e.state,{state:c}=e,l={...c},u=!1,d;if(t._optimisticResults){let i=this.hasListeners(),a=!i&&wr(e,t),o=i&&Er(e,n,t,r);(a||o)&&(l={...l,...br(c.data,e.options)}),t._optimisticResults===`isRestoring`&&(l.fetchStatus=`idle`)}let{error:f,errorUpdatedAt:p,status:m}=l;d=l.data;let h=!1;if(t.placeholderData!==void 0&&d===void 0&&m===`pending`){let e;i?.isPlaceholderData&&t.placeholderData===o?.placeholderData?(e=i.data,h=!0):e=typeof t.placeholderData==`function`?t.placeholderData(this.#u?.state.data,this.#u):t.placeholderData,e!==void 0&&(m=`success`,d=or(i?.data,e,t),u=!0)}if(t.select&&d!==void 0&&!h)if(i&&d===a?.data&&t.select===this.#c)d=this.#l;else try{this.#c=t.select,d=t.select(d),d=or(i?.data,d,t),this.#l=d,this.#s=null}catch(e){this.#s=e}this.#s&&(f=this.#s,d=this.#l,p=Date.now(),m=`error`);let g=l.fetchStatus===`fetching`,_=m===`pending`,v=m===`error`,y=_&&g,b=d!==void 0,x={status:m,fetchStatus:l.fetchStatus,isPending:_,isSuccess:m===`success`,isError:v,isInitialLoading:y,isLoading:y,data:d,dataUpdatedAt:l.dataUpdatedAt,error:f,errorUpdatedAt:p,failureCount:l.fetchFailureCount,failureReason:l.fetchFailureReason,errorUpdateCount:l.errorUpdateCount,isFetched:e.isFetched(),isFetchedAfterMount:l.dataUpdateCount>s.dataUpdateCount||l.errorUpdateCount>s.errorUpdateCount,isFetching:g,isRefetching:g&&!_,isLoadingError:v&&!b,isPaused:l.fetchStatus===`paused`,isPlaceholderData:u,isRefetchError:v&&b,isStale:Dr(e,t),refetch:this.refetch,promise:this.#o,isEnabled:Zn(t.enabled,e)!==!1};if(this.options.experimental_prefetchInRender){let t=x.data!==void 0,r=x.status===`error`&&!t,i=e=>{r?e.reject(x.error):t&&e.resolve(x.data)},a=()=>{let e=this.#o=x.promise=dr();i(e)},o=this.#o;switch(o.status){case`pending`:e.queryHash===n.queryHash&&i(o);break;case`fulfilled`:(r||x.data!==o.value)&&a();break;case`rejected`:(!r||x.error!==o.reason)&&a()}}return x}updateResult(){let e=this.#r,t=this.createResult(this.#t,this.options);this.#i=this.#t.state,this.#a=this.options,this.#i.data!==void 0&&(this.#u=this.#t),!nr(t,e)&&(this.#r=t,this.#C({listeners:(()=>{if(!e)return!0;let{notifyOnChangeProps:t}=this.options,n=typeof t==`function`?t():t;if(n===`all`||!n&&!this.#m.size)return!0;let r=new Set(n??this.#m);return this.options.throwOnError&&r.add(`error`),Object.keys(this.#r).some(t=>{let n=t;return this.#r[n]!==e[n]&&r.has(n)})})()}))}#S(){let e=this.#e.getQueryCache().build(this.#e,this.options);if(e===this.#t)return;let t=this.#t;this.#t=e,this.#n=e.state,this.hasListeners()&&(t?.removeObserver(this),e.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#y()}#C(e){fr.batch(()=>{e.listeners&&this.listeners.forEach(e=>{e(this.#r)}),this.#e.getQueryCache().notify({query:this.#t,type:`observerResultsUpdated`})})}};function nre(e,t){return Zn(t.enabled,e)!==!1&&e.state.data===void 0&&(e.state.status!==`error`||Zn(t.retryOnMount,e)!==!1)}function wr(e,t){return nre(e,t)||e.state.data!==void 0&&Tr(e,t,t.refetchOnMount)}function Tr(e,t,n){if(Zn(t.enabled,e)!==!1&&Xn(t.staleTime,e)!==`static`){let r=typeof n==`function`?n(e):n;return r===`always`||r!==!1&&Dr(e,t)}return!1}function Er(e,t,n,r){return(e!==t||Zn(r.enabled,e)===!1)&&(!n.suspense||e.state.status!==`error`)&&Dr(e,n)}function Dr(e,t){return Zn(t.enabled,e)!==!1&&e.isStaleByTime(Xn(t.staleTime,e))}function rre(e,t){return!nr(e.getCurrentResult(),t)}var Or=M.createContext(void 0),kr=e=>{let t=M.useContext(Or);if(e)return e;if(!t)throw Error(`No QueryClient set, use QueryClientProvider to set one`);return t},ire=({client:e,children:t})=>(M.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),(0,N.jsx)(Or.Provider,{value:e,children:t})),Ar=M.createContext(!1),jr=()=>M.useContext(Ar);Ar.Provider;function are(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var ore=M.createContext(are()),Mr=()=>M.useContext(ore),Nr=(e,t,n)=>{let r=n?.state.error&&typeof e.throwOnError==`function`?lr(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||r)&&(t.isReset()||(e.retryOnMount=!1))},Pr=e=>{M.useEffect(()=>{e.clearReset()},[e])},Fr=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:i})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(i&&e.data===void 0||lr(n,[e.error,r])),Ir=e=>{if(e.suspense){let t=1e3,n=e=>e===`static`?e:Math.max(e??t,t),r=e.staleTime;e.staleTime=typeof r==`function`?(...e)=>n(r(...e)):n(r),typeof e.gcTime==`number`&&(e.gcTime=Math.max(e.gcTime,t))}},sre=(e,t)=>e.isLoading&&e.isFetching&&!t,Lr=(e,t)=>e?.suspense&&t.isPending,Rr=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function zr(e,t,n){let r=jr(),i=Mr(),a=kr(n),o=a.defaultQueryOptions(e);a.getDefaultOptions().queries?._experimental_beforeQuery?.(o);let s=a.getQueryCache().get(o.queryHash),c=e.subscribed!==!1;o._optimisticResults=r?`isRestoring`:c?`optimistic`:void 0,Ir(o),Nr(o,i,s),Pr(i);let l=!a.getQueryCache().get(o.queryHash),[u]=M.useState(()=>new t(a,o)),d=u.getOptimisticResult(o),f=!r&&c;if(M.useSyncExternalStore(M.useCallback(e=>{let t=f?u.subscribe(fr.batchCalls(e)):qn;return u.updateResult(),t},[u,f]),()=>u.getCurrentResult(),()=>u.getCurrentResult()),M.useEffect(()=>{u.setOptions(o)},[o,u]),Lr(o,d))throw Rr(o,u,i);if(Fr({result:d,errorResetBoundary:i,throwOnError:o.throwOnError,query:s,suspense:o.suspense}))throw d.error;return a.getDefaultOptions().queries?._experimental_afterQuery?.(o,d),o.experimental_prefetchInRender&&!ur.isServer()&&sre(d,r)&&(l?Rr(o,u,i):s?.promise)?.catch(qn).finally(()=>{u.updateResult()}),o.notifyOnChangeProps?d:u.trackResult(d)}function Br(e,t){return zr(e,Cr,t)}function cre(e){return e}var lre=g,Vr=globalThis.Number,ure=e=>{if(e===`NaN`)return v(NaN);if(e===`Infinity`)return v(1/0);if(e===`-Infinity`)return v(-1/0);if(e.trim()===``)return me();let t=Vr(e);return Vr.isNaN(t)?me():v(t)},dre=[[`GET`,`get`],[`POST`,`post`],[`PUT`,`put`],[`DELETE`,`del`],[`PATCH`,`patch`],[`HEAD`,`head`],[`OPTIONS`,`options`],[`TRACE`,`trace`]],Hr=`~effect/http/HttpClientRequest`,fre={[Hr]:Hr,..._e,toJSON(){return{_id:`HttpClientRequest`,method:this.method,url:this.url,urlParams:this.urlParams,hash:this.hash,headers:Mee(this.headers),body:this.body.toJSON()}},pipe(){return ke(this,arguments)}};function Ur(e,t,n,r,i,a){let o=Object.create(fre);return o.method=e,o.url=t,o.urlParams=n,o.hash=r,o.headers=i,o.body=a,o}var pre=Ur(`GET`,``,pte,me(),ste,bte),Wr=e=>(t,n)=>hre(pre,{method:e,url:t,...n??void 0}),mre=Wr(`POST`),hre=_(2,(e,t)=>{let n=e;return t.method&&(n=gre(n,t.method)),t.url&&(n=yre(n,t.url)),t.headers&&(n=Gr(n,t.headers)),t.urlParams&&(n=bre(n,t.urlParams)),t.hash&&(n=xre(n,t.hash)),t.body&&(n=qr(n,t.body)),t.accept&&(n=Kr(n,t.accept)),t.acceptJson&&(n=vre(n)),n}),gre=_(2,(e,t)=>Ur(t,e.url,e.urlParams,e.hash,e.headers,e.body)),_re=_(3,(e,t,n)=>Ur(e.method,e.url,e.urlParams,e.hash,bt(e.headers,t,n),e.body)),Gr=_(2,(e,t)=>Ur(e.method,e.url,e.urlParams,e.hash,Ste(e.headers,t),e.body)),Kr=_(2,(e,t)=>_re(e,`Accept`,t)),vre=Kr(`application/json`),yre=_(2,(e,t)=>{if(typeof t==`string`)return Ur(e.method,t,e.urlParams,e.hash,e.headers,e.body);let n=new URL(t.toString()),r=nte(n.searchParams),i=Wee(n.hash===``?void 0:n.hash.slice(1));return n.search=``,n.hash=``,Ur(e.method,n.toString(),r,i,e.headers,e.body)}),bre=_(2,(e,t)=>Ur(e.method,e.url,Nte(e.urlParams,t),e.hash,e.headers,e.body)),xre=_(2,(e,t)=>Ur(e.method,e.url,e.urlParams,v(t),e.headers,e.body)),qr=_(2,(e,t)=>{let n=e.headers;return t._tag===`Empty`||t._tag===`FormData`?n=Zt(Zt(n,`Content-Type`),`Content-length`):(t.contentType&&(n=bt(n,`content-type`,t.contentType)),t.contentLength!==void 0&&(n=bt(n,`content-length`,t.contentLength.toString()))),Ur(e.method,e.url,e.urlParams,e.hash,n,t)}),Sre=e=>Mt({b3:`${e.traceId}-${e.spanId}-${e.sampled?`1`:`0`}${ue(e.parent,{onNone:()=>``,onSome:e=>`-${e.spanId}`})}`,traceparent:`00-${e.traceId}-${e.spanId}-${e.sampled?`01`:`00`}`}),Jr=`~effect/http/HttpClient`,Yr=qe(`effect/HttpClient`),Xr=_(2,(e,t)=>Zr(n=>t(e.postprocess(n)),e.preprocess)),Cre=Xr(Ye(mte)),Zr=(e,t)=>{let n=Object.create(wre);return n.preprocess=t,n.postprocess=e,n.execute=function(n){return e(t(n))},n},wre={[Jr]:Jr,pipe(){return ke(this,arguments)},..._e,toJSON(){return{_id:`effect/HttpClient`}},...Object.fromEntries(dre.map(([e,t])=>[t,function(t,n){return this.execute(Wr(e)(t,n))}]))},Tre=e=>Zr(t=>Ye(t,t=>et(n=>{let i=kre.get(t),a=i??new AbortController,o=Ote(t.url,t.urlParams,m(t.hash));if(jee(o))return r(new qt({reason:new Ate({request:t,cause:o.failure})}));let s=o.success;if(n.getRef(Ke)||n.getRef(Qr)(t)){let r=e(t,s,a.signal,n);return i?r:Ze(e=>Te(e(r),{onSuccess(e){return ei.register(e,a),ze(new ti(e,a))},onFailure(e){return Je(e)&&a.abort(),Be(e)}}))}return yee(n.getRef(Dre)(t),{kind:`client`},r=>{r.attribute(`http.request.method`,t.method),r.attribute(`server.address`,s.origin),s.port!==``&&r.attribute(`server.port`,+s.port),r.attribute(`url.full`,s.toString()),r.attribute(`url.path`,s.pathname),r.attribute(`url.scheme`,s.protocol.slice(0,-1));let o=s.search.slice(1);o!==``&&r.attribute(`url.query`,o);let c=n.getRef(_te),l=xt(t.headers,c);for(let e in l)r.attribute(`http.request.header.${e}`,String(l[e]));return t=n.getRef($r)?Gr(t,Sre(r)):t,Ze(o=>o(e(t,s,a.signal,n)).pipe(qee(r,{captureStackTrace:!1}),Te({onSuccess:e=>{r.attribute(`http.response.status_code`,e.status);let t=xt(e.headers,c);for(let e in t)r.attribute(`http.response.header.${e}`,String(t[e]));return i?ze(e):(ei.register(e,a),ze(new ti(e,a)))},onFailure(e){return!i&&Je(e)&&a.abort(),Be(e)}})))})})),ze),Ere=_(2,(e,t)=>{let n=Ce(t),r=n?`errors-and-responses`:t.retryOn??`errors-and-responses`,i=n?t:t.schedule,o=i&&h(i),s=n?void 0:t.times;return Xr(e,E(r===`errors-only`?ae:ee({schedule:o,times:s,while:ri}),r===`response-only`?ae:D({while:n||t.while===void 0?ni:a(ni,t.while),schedule:i,times:s})))}),Qr=Le(`effect/http/HttpClient/TracerDisabledWhen`,{defaultValue:()=>Cee}),$r=Le(`effect/HttpClient/TracerPropagationEnabled`,{defaultValue:ce}),Dre=Le(`effect/http/HttpClient/SpanNameGenerator`,{defaultValue:()=>e=>`http.client ${e.method}`}),Ore=e=>We(Yr)(te(t=>Fe(e,e=>Xr(e,kee(e=>vee(t,e)))))),ei=(()=>{if(`FinalizationRegistry`in globalThis&&globalThis.FinalizationRegistry){let e=new FinalizationRegistry(e=>{e.abort()});return{register(t,n){e.register(t,n,t)},unregister(t){e.unregister(t)}}}let e=new Map;return{register(t,n){e.set(t,setTimeout(()=>n.abort(),5e3))},unregister(t){let n=e.get(t);n!==void 0&&(clearTimeout(n),e.delete(t))}}})(),kre=new WeakMap,ti=class{original;controller;constructor(e,t){this.original=e,this.controller=t}[St]=St;[dt]=dt;applyInterrupt(e){return Qe(()=>(ei.unregister(this.original),Eee(e,()=>Ue(()=>{this.controller.abort()}))))}get request(){return this.original.request}get status(){return this.original.status}get headers(){return this.original.headers}get cookies(){return this.original.cookies}get remoteAddress(){return this.original.remoteAddress}get formData(){return this.applyInterrupt(this.original.formData)}get text(){return this.applyInterrupt(this.original.text)}get json(){return this.applyInterrupt(this.original.json)}get urlParamsBody(){return this.applyInterrupt(this.original.urlParamsBody)}get arrayBuffer(){return this.applyInterrupt(this.original.arrayBuffer)}get stream(){return dee(()=>(ei.unregister(this.original),Iee(this.original.stream,Ue(()=>{this.controller.abort()}))))}toJSON(){return this.original.toJSON()}[Re](){return this.original[Re]()}pipe(){return ke(this,arguments)}},ni=e=>hee(e)||Are(e),Are=e=>Yt(e)&&(e.reason._tag===`TransportError`||e.reason._tag===`StatusCodeError`&&ri(e.reason.response)),ri=e=>e.status===408||e.status===429||e.status===500||e.status===502||e.status===503||e.status===504;function ii(e){return{id:e.id??`ws:${e.label}`,label:e.label,source:e.source??`manual`,target:e.target}}function jre(e){return e?.target.wsBaseUrl??null}function Mre(e){return e?.target.httpBaseUrl??null}function Nre(e,t){return{...e,environmentId:t.environmentId,label:t.label}}function Pre(e){return e.cloudMode?`cmmd-cloud-runtime`:`local-web`}function Fre(e){let t=Pre(e);return{topology:t,controlPlane:t!==`cmmd-cloud-runtime`,executionPlane:!0,workspaceProxy:!1}}function Ire(e){let t=e.topology===`cmmd-cloud-runtime`;return{cmmd:!0,ownerBootstrapPromotion:e.topology!==`cloud-shell`&&!t,bearerBootstrap:!0,desktopBootstrap:e.topology===`desktop-local`,providerCredentialBroker:e.topology===`cmmd-control-plane`}}function Lre(e){let t=e.executionPlane;return{agents:t,browser:t,github:t,terminal:t,providerEgress:e.topology===`cmmd-control-plane`}}function Rre(e,t){return{localProjects:t.executionPlane,cloudProjects:e.cloudMode}}function ai(e){let t=e.capabilities,n=t.runtime??Fre(t);return{repositoryIdentity:t.repositoryIdentity,pullRequests:t.pullRequests??!1,cloudMode:t.cloudMode,posthogPublicKey:t.posthogPublicKey,posthogHost:t.posthogHost,runtime:n,auth:t.auth??Ire(n),tools:t.tools??Lre(n),projects:t.projects??Rre(t,n)}}function zre(e){return e?ai(e).projects.cloudProjects:!1}function Bre(e){return e?ai(e).runtime.workspaceProxy??!1:!1}function oi(e,t){return{environmentId:e,projectId:t}}function si(e,t){return{environmentId:e,threadId:t}}var ci=`scoped:v1:`;function li(e){let t=`projectId`in e?e.projectId:e.threadId;return t.includes(`:`)||e.environmentId.startsWith(ci)?`${ci}${encodeURIComponent(e.environmentId)}:${encodeURIComponent(t)}`:`${e.environmentId}:${t}`}function ui(e){return li(e)}function di(e){return li(e)}function Vre(e){let t=e.slice(10),n=t.indexOf(`:`);if(n<=0||n>=t.length-1||t.indexOf(`:`,n+1)!==-1)return null;try{let e=decodeURIComponent(t.slice(0,n)),r=decodeURIComponent(t.slice(n+1));return e.length>0&&r.length>0?{environmentId:e,localId:r}:null}catch{return null}}function fi(e){if(e.startsWith(ci))return Vre(e);let t=e.lastIndexOf(`:`);return t<=0||t>=e.length-1?null:{environmentId:e.slice(0,t),localId:e.slice(t+1)}}function pi(e){let t=fi(e);return t?{environmentId:t.environmentId,projectId:t.localId}:null}function mi(e){let t=fi(e);return t?{environmentId:t.environmentId,threadId:t.localId}:null}var hi=`~effect/ManagedRuntime`,gi=(e,t)=>{let n=t?.memoMap??de(),r=iee(`parallel`),i=C(r,`sequential`),a={onFiberStart:ie(r)},s=e=>e?{...e,onFiberStart:e.onFiberStart?t=>{a.onFiberStart(t),e.onFiberStart(t)}:a.onFiberStart}:a,c,l=et(t=>(c||=d(pee(o(e,n,i),e=>Ue(()=>{u.cachedContext=e})),{...a,scheduler:t.currentScheduler}),See(se(c)))),u={[hi]:hi,memoMap:n,scope:r,contextEffect:l,cachedContext:void 0,context(){return u.cachedContext===void 0?T(u.contextEffect):Promise.resolve(u.cachedContext)},dispose(){return T(u.disposeEffect)},disposeEffect:Qe(()=>(u.contextEffect=see(`ManagedRuntime disposed`),u.cachedContext=void 0,Ae(u.scope,Xe))),runFork(e,t){return u.cachedContext===void 0?d(_i(u,e),s(t)):Me(u.cachedContext)(e,s(t))},runCallback(e,t){return u.cachedContext===void 0?be(_i(u,e),s(t)):Xee(u.cachedContext)(e,s(t))},runSyncExit(e){return u.cachedContext===void 0?Fee(_i(u,e)):ne(u.cachedContext)(e)},runSync(e){return u.cachedContext===void 0?re(_i(u,e)):cee(u.cachedContext)(e)},runPromiseExit(e,t){return u.cachedContext===void 0?eee(_i(u,e),s(t)):oee(u.cachedContext)(e,s(t))},runPromise(e,t){return u.cachedContext===void 0?T(_i(u,e),s(t)):x(u.cachedContext)(e,s(t))}};return u};function _i(e,t){return Ye(e.contextEffect,e=>fe(t,e))}var vi={accept:!1,observe:!1,missingFrameCount:0,startsNewStream:!1};function yi(e){let t=e===!0;return{accept:t,observe:t,missingFrameCount:0,startsNewStream:t}}function Hre(e,t){let n=e.streamGeneration===void 0&&e.streamId===void 0,r=t.streamGeneration!==void 0||t.streamId!==void 0;return n&&r?yi(t.keyframe):null}function Ure(e,t){return e.streamGeneration===void 0||t.streamGeneration===void 0?null:t.streamGeneration<e.streamGeneration?vi:t.streamGeneration>e.streamGeneration?yi(t.keyframe):null}function Wre(e,t){if(!e.streamId||!t.streamId)return null;if(e.streamId!==t.streamId)return yi(t.keyframe);if(t.sequence<=e.observedSequence)return vi;let n=Math.max(0,t.sequence-e.observedSequence-1);return{accept:n===0||t.keyframe===!0,observe:!0,missingFrameCount:n,startsNewStream:!1}}function Gre(e,t){if(t.sequence>e.acceptedSequence)return{accept:!0,observe:!0,missingFrameCount:0,startsNewStream:!1};if(!e.acceptedCapturedAt)return vi;let n=Date.parse(e.acceptedCapturedAt),r=Date.parse(t.capturedAt);return Number.isNaN(n)||Number.isNaN(r)||r<=n?vi:{accept:!0,observe:!0,missingFrameCount:0,startsNewStream:!1}}function Kre(e,t){return Hre(e,t)??Ure(e,t)??Wre(e,t)??Gre(e,t)}function qre(e,t){let n=Kre(e,t);if(!n.observe)return{accept:n.accept,observe:n.observe,missingFrameCount:n.missingFrameCount,state:e};let r=n.startsNewStream?t.sequence:Math.max(e.observedSequence,t.sequence),i={...e,observedSequence:r,gapCount:e.gapCount+n.missingFrameCount},a=n.accept?{...i,acceptedSequence:t.sequence,acceptedCapturedAt:t.capturedAt,...t.streamId?{streamId:t.streamId}:{},...t.streamGeneration===void 0?{}:{streamGeneration:t.streamGeneration}}:i;return{accept:n.accept,observe:n.observe,missingFrameCount:n.missingFrameCount,state:a}}var bi=S();function Jre(e){return e.stageLabel.trim().toLowerCase()===`latest`?e.baseName:`${e.baseName} (${e.stageLabel})`}var xi=`Forge`,Si=``,Ci=Si===`latest`||Si===`nightly`?Si:null,wi=Ci===`nightly`?`Nightly`:Ci===`latest`?`Latest`:null,Ti=wi??`Alpha`,Ei=wi?Jre({baseName:xi,stageLabel:Ti}):xi,Di=`0.13.4`,Oi=ct(`forge-app-top-bar drag-region @container/header-actions relative z-20 w-full min-w-0 shrink-0 bg-background`,`grid grid-cols-[minmax(0,1fr)_minmax(0,auto)] items-center`),ki=`flex h-full min-w-0 items-center gap-1 md:gap-1.5`,Ai=`flex h-touch min-w-0 max-w-full touch-manipulation items-center justify-center rounded-lg px-3 text-foreground transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring md:h-7 md:px-2`,Yre={width:`calc(100% - var(--forge-right-panel-reserved-width, 0px))`},Xre=`forge-app-shell flex w-full min-w-0 flex-row`,ji=`forge-app-shell flex w-full min-w-0 flex-col`,Zre=`flex min-h-0 min-w-0 flex-1 flex-col`,Qre=`relative flex h-[var(--forge-content-height)] min-h-0 min-w-0 flex-1 overflow-hidden`;function Mi(e){let t=(0,bi.c)(19),{showStageBadge:n,tone:r,variant:i}=e,a=n!==void 0&&n,o=r===void 0?`default`:r,s=(i===void 0?`default`:i)===`auth`,c=s?20:16,l=s?`h-5 w-5 shrink-0`:`h-4 w-4 shrink-0`,u;t[0]!==c||t[1]!==l?(u=(0,N.jsx)(`img`,{className:l,src:`/forge-mark.svg`,width:c,height:c,alt:``,"aria-hidden":`true`}),t[0]=c,t[1]=l,t[2]=u):u=t[2];let d=u,f=s?`text-[15px] sm:text-base`:`text-sm`,p=o===`on-dark`?`text-primary-foreground`:`text-foreground`,m;t[3]!==f||t[4]!==p?(m=ct(`truncate font-semibold tracking-tight`,f,p),t[3]=f,t[4]=p,t[5]=m):m=t[5];let h;t[6]===m?h=t[7]:(h=(0,N.jsx)(`span`,{className:m,children:xi}),t[6]=m,t[7]=h);let g=h,_=s?`rounded-full bg-muted/50 px-2 py-0.5 text-[9px] leading-none font-medium tracking-[0.14em] text-muted-foreground/70 uppercase [text-indent:0.14em]`:`rounded-full bg-muted/50 px-1.5 py-0.5 text-[8px] leading-none font-medium tracking-[0.18em] text-muted-foreground/60 uppercase [text-indent:0.18em]`,v;t[8]===_?v=t[9]:(v=(0,N.jsx)(`span`,{className:_,children:Ti}),t[8]=_,t[9]=v);let y=v;if(a){let e;t[10]!==d||t[11]!==g?(e=(0,N.jsxs)(`span`,{className:`flex items-center gap-2`,children:[d,g]}),t[10]=d,t[11]=g,t[12]=e):e=t[12];let n;return t[13]!==y||t[14]!==e?(n=(0,N.jsxs)(`div`,{className:`flex items-center gap-1.5 rounded-md`,"aria-label":Ei,children:[e,y]}),t[13]=y,t[14]=e,t[15]=n):n=t[15],n}let b;return t[16]!==d||t[17]!==g?(b=(0,N.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5`,"aria-label":Ei,children:[d,g]}),t[16]=d,t[17]=g,t[18]=b):b=t[18],b}function Ni(e){let t=(0,bi.c)(5),{className:n}=e,r;t[0]===n?r=t[1]:(r=ct(`pointer-events-none flex select-none items-center`,n),t[0]=n,t[1]=r);let i;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,N.jsx)(Mi,{}),t[2]=i):i=t[2];let a;return t[3]===r?a=t[4]:(a=(0,N.jsx)(`div`,{className:r,children:i}),t[3]=r,t[4]=a),a}function $re(){let e=new Map;return{clear:()=>e.clear(),getItem:t=>e.get(t)??null,key:t=>Array.from(e.keys()).at(t)??null,get length(){return e.size},removeItem:t=>e.delete(t),setItem:(t,n)=>e.set(t,n)}}var Pi=typeof window<`u`?window.localStorage:$re(),eie=(e,t)=>gte(Ct(e))(t),tie=(e,t)=>jte(Ct(e))(t),Fi=(e,t)=>{let n=Pi.getItem(e);return n?eie(t,n):null},Ii=(e,t,n)=>{let r=tie(n,t);Pi.setItem(e,r)},Li=e=>{Pi.removeItem(e)},Ri=`forge:local_storage_change`;function nie(e){typeof window>`u`||window.dispatchEvent(new CustomEvent(Ri,{detail:{key:e}}))}function zi(e,t,n){let[r,i]=(0,M.useState)(()=>{try{return Fi(e,n)??t}catch(e){return console.error(`[LOCALSTORAGE] Error:`,e),t}}),a=(0,M.useCallback)(t=>{i(r=>{try{let i=typeof t==`function`?t(r):t;return i===null?Li(e):Ii(e,i,n),queueMicrotask(()=>nie(e)),i}catch(e){return console.error(`[LOCALSTORAGE] Error:`,e),r}})},[e,n]),o=(0,M.useRef)(e);return(0,M.useEffect)(()=>{if(o.current!==e){o.current=e;try{let r=Fi(e,n);i(r??t)}catch(e){console.error(`[LOCALSTORAGE] Error:`,e)}}},[e,t,n]),(0,M.useEffect)(()=>{let r=()=>{try{let r=Fi(e,n);i(r??t)}catch(e){console.error(`[LOCALSTORAGE] Error:`,e)}},a=t=>{t.key===e&&r()},o=t=>{t.detail.key===e&&r()};return window.addEventListener(`storage`,a),window.addEventListener(Ri,o),()=>{window.removeEventListener(`storage`,a),window.removeEventListener(Ri,o)}},[e,t,n]),[r,a]}var Bi=`cmmd-runtime:`;function Vi(e){return`${Bi}${e}`}var rie=/^env_[0-9a-f]{32}$/,iie=/^[A-Za-z0-9][A-Za-z0-9._-]*$/,Hi={shape:`local`,isCloud:!1,legacyRuntimeId:null},aie={shape:`cloud-project-placeholder`,isCloud:!0,legacyRuntimeId:null},oie={shape:`durable-environment`,isCloud:!0,legacyRuntimeId:null};function Ui(e){if(typeof e!=`string`)return Hi;if(e.startsWith(`cmmd-runtime:`)){let t=e.slice(Bi.length);return iie.test(t)?{shape:`legacy-runtime`,isCloud:!0,legacyRuntimeId:t}:Hi}return e.startsWith(`cmmd-cloud-project:`)?aie:rie.test(e)?oie:Hi}var Wi=`forge:client-settings:v1`,sie=`forge:saved-environment-registry:v1`,cie=on({environmentId:Et,label:k,httpBaseUrl:k,wsBaseUrl:k,createdAt:k,lastConnectedAt:Ht(k),cmmdOrganizationId:yt(k),cmmdProjectId:yt(k),runtimeId:yt(k),runtimeTicketExpiresAt:yt(k),lastAuthenticatedPullRequestCapability:yt(It),bearerToken:yt(k)}),Gi=on({version:yt(Bt),records:yt($t(cie))});function Ki(){return typeof window<`u`}var lie={uiFontSize:14,codeFontSize:15},uie=[[`uiFontSize`,11,20],[`codeFontSize`,11,20]];function die(e){return e.defaultThreadRuntime===`desktop-cloud-bridge`?{...e,defaultThreadRuntime:`cloud`}:null}function fie(e){if(typeof e.fontDefaultsVersion==`number`)return null;let t=Object.entries(lie).filter(([t,n])=>e[t]===n);if(t.length===0)return null;let n={...e};for(let[e]of t)delete n[e];return n}function pie(e){let t=uie.flatMap(([t,n,r])=>{let i=e[t];if(typeof i!=`number`||!Number.isFinite(i))return[];let a=Math.min(r,Math.max(n,Math.round(i)));return a===i?[]:[[t,a]]});if(t.length===0)return null;let n={...e};for(let[e,r]of t)n[e]=r;return n}function qi(e){if(!e||typeof e!=`object`)return e;let t=e,n=!1;for(let e of[die,fie,pie]){let r=e(t);r!==null&&(t=r,n=!0)}return n?t:e}function mie(){if(!Ki())return null;try{let e=window.localStorage.getItem(Wi);return e?Gt(tn)(qi(JSON.parse(e))):null}catch{return null}}function hie(e){Ki()&&Ii(Wi,e,tn)}function Ji(){if(!Ki())return{};try{return Fi(`forge:saved-environment-registry:v1`,Gi)??{}}catch{return{}}}function Yi(e){Ki()&&Ii(sie,e,Gi)}function Xi(){return Ji().records??[]}function gie(e){Yi({version:1,records:e})}function _ie(){return Xi().map(e=>vt(e))}function vie(e){let t=new Map(Xi().map(e=>[e.environmentId,e]));gie(e.map(e=>{let n=Ui(e.environmentId).legacyRuntimeId===null?t.get(e.environmentId)?.bearerToken:void 0;return n?{...vt(e),bearerToken:n}:vt(e)}))}function yie(e){return Xi().find(t=>t.environmentId===e)?.bearerToken??null}function bie(e,t){let n=Ji(),r=n.records??[],i=!1;return Yi({version:n.version??1,records:r.map(n=>n.environmentId===e?(i=!0,Object.assign(vt(n),{bearerToken:t})):n)}),i}function xie(e){let t=Ji();Yi({version:t.version??1,records:(t.records??[]).map(t=>t.environmentId===e?vt(t):t)})}var Sie=Gt(tn);function Cie(){return typeof window>`u`?void 0:window.desktopBridge}function Zi(e){let t=Cie(),n=t?.[e];return typeof n==`function`?n.bind(t):null}async function Qi(){let e=Zi(`getClientSettings`);if(e){let t=await e();return t?Sie(t):null}return mie()}async function $i(e){let t=Zi(`setClientSettings`);if(t)return t(e);hie(e)}async function ea(){let e=Zi(`getSavedEnvironmentRegistry`);return e?e():_ie()}async function ta(e){let t=Zi(`setSavedEnvironmentRegistry`);if(t)return t(e);vie(e)}async function na(e){let t=Zi(`getSavedEnvironmentSecret`);return t?t(e):yie(e)}async function ra(e,t){let n=Zi(`setSavedEnvironmentSecret`);return n?n(e,t):bie(e,t)}async function ia(e){let t=Zi(`removeSavedEnvironmentSecret`);if(t)return t(e);xie(e)}var aa=`token`;function oa(e){return new URLSearchParams(e.hash.startsWith(`#`)?e.hash.slice(1):e.hash)}function sa(e){let t=oa(e).get(aa)?.trim()??``;if(t.length>0)return t;let n=e.searchParams.get(aa)?.trim()??``;return n.length>0?n:null}function wie(e){let t=new URL(e.toString()),n=oa(t);return n.has(aa)&&(n.delete(aa),t.hash=n.toString()),t.searchParams.delete(aa),t}function ca(e,t){let n=new URL(e.toString());return n.searchParams.delete(aa),n.hash=new URLSearchParams([[aa,t]]).toString(),n}function Tie(e,t){let n=new URL(e);return n.pathname=`/login`,ca(n,t).toString()}function Eie(e){return ca(new URL(`/login`,window.location.href),e).toString()}var Die=`host`;function Oie(e){let t=new URL(e),n=sa(t),r=new URL(`forge:///pair`);return r.searchParams.set(Die,t.origin),n&&r.searchParams.set(aa,n),r.toString()}function kie(e){return{_tag:`Value`,value:e}}function Aie(e,t){return{_tag:`Record`,keys:e,value:t}}function jie(e,t){return{_tag:`Array`,length:e,value:t}}Rt(`SourceError`);var Mie=Le(`effect/ConfigProvider`,{defaultValue:()=>Fie()}),Nie={...Ne,toJSON(){return{_id:`ConfigProvider`}}};function Pie(e,t,n){let r=Object.create(Nie);return r.get=e,r.mapInput=t,r.prefix=n,r.load=r=>(t&&(r=t(r)),n&&(r=[...n,...r]),e(r)),r}function Fie(e){let t=e?.env??{APP_VERSION:`0.13.4`,BASE_URL:`/`,DEV:!1,MODE:`production`,PROD:!0,SSR:!1,TSS_INLINE_CSS_ENABLED:`false`,VITE_COMMIT_SHA:``,VITE_HOSTED_APP_CHANNEL:``,VITE_HTTP_URL:``,VITE_SENTRY_COMMIT_SHA:`9acfb6057470e43c02f81df6b16969f9edbbede4`,VITE_SENTRY_DEBUG:``,VITE_SENTRY_DSN:``,VITE_SENTRY_ENABLED:``,VITE_SENTRY_ENVIRONMENT:`production`,VITE_SENTRY_PROFILES_SAMPLE_RATE:``,VITE_SENTRY_RELEASE:`forge-web@0.13.4+9acfb6057470e43c02f81df6b16969f9edbbede4`,VITE_SENTRY_REPLAYS_ON_ERROR_SAMPLE_RATE:``,VITE_SENTRY_REPLAYS_SESSION_SAMPLE_RATE:``,VITE_SENTRY_TRACES_SAMPLE_RATE:``,VITE_WS_URL:``},n=Iie(t);return Pie(e=>ze(Rie(n,t,e)))}function Iie(e){let t={};for(let[n,r]of Object.entries(e)){if(r===void 0)continue;let e=n.split(`_`),i=t;for(let t of e)i.children??={},i=i.children[t]??={};i.value=r}return t}var Lie=/^(0|[1-9][0-9]*)$/;function Rie(e,t,n){let r=t[n.map(String).join(`_`)],i=zie(e,n),a=i?.children?Object.keys(i.children):[];return a.length===0?r===void 0?void 0:kie(r):a.every(e=>Lie.test(e))?jie(Math.max(...a.map(e=>parseInt(e,10)))+1,r):Aie(new Set(a),r)}function zie(e,t){if(t.length===0)return e;let n=e;for(let e of t)if(n=n?.children?.[String(e)],!n)return;return n}var la=`~effect/Config`,Bie=class{_tag=`ConfigError`;name=`ConfigError`;cause;constructor(e){this.cause=e}get message(){return this.cause.toString()}toString(){return`ConfigError(${this.message})`}},Vie={...Ne,...uee,[la]:la,asEffect(){return Ye(Mie.asEffect(),e=>this.parse(e))},toJSON(){return{_id:`Config`}}};function Hie(e){let t=Object.create(Vie);return t.parse=e,t}var ua=Pe(function*(e,t){let n=yield*e.load(t);if(n!==void 0)switch(n._tag){case`Value`:return n.value;case`Record`:{if(n.value!==void 0)return n.value;let r={};for(let i of n.keys){let n=yield*ua(e,[...t,i]);n!==void 0&&(r[i]=n)}return r}case`Array`:{if(n.value!==void 0)return n.value;let r=[];for(let i=0;i<n.length;i++)r.push(yield*ua(e,[...t,i]));return r}}}),da=Pe(function*(e,t,n){switch(e._tag){case`Objects`:{let r={};for(let i of e.propertySignatures){let e=i.name;if(typeof e==`string`){let a=yield*da(i.type,t,[...n,e]);a!==void 0&&(r[e]=a)}}if(e.indexSignatures.length>0){let i=yield*t.load(n);if(i&&i._tag===`Record`)for(let a of e.indexSignatures){let e=ote(a.parameter);for(let o of i.keys)if(!Object.hasOwn(r,o)&&e(o)){let e=yield*da(a.type,t,[...n,o]);e!==void 0&&(r[o]=e)}}}return r}case`Arrays`:{let r=yield*t.load(n);if(r&&r._tag===`Value`)return r.value;let i=[];for(let r=0;r<e.elements.length;r++)i.push(yield*da(e.elements[r],t,[...n,r]));return i}case`Union`:return yield*ua(t,n);case`Suspend`:return yield*da(e.thunk(),t,n);default:{let e=yield*t.load(n);return e===void 0?void 0:e._tag===`Value`||e._tag===`Record`&&e.value!==void 0||e._tag===`Array`&&e.value!==void 0?e.value:void 0}}});function fa(e,t){let n=sn(e),r=kt(n),i=ate(n.ast),a=typeof t==`string`?[t]:t??[];return Hie(e=>{let t=e.prefix?[...e.prefix,...a]:a;return da(i,e,a).pipe(Ree(e=>r(e).pipe(tt(e=>new jt(t.length>0?new xte(t,e):e)))),tt(e=>new Bie(e)))})}var Uie=(e,t,n)=>{let r=Pt(e,t),i=k.pipe(mt(Pt(k,k),lte(n)),mt(r));return hte([r,i])},P=typeof __SENTRY_DEBUG__>`u`||__SENTRY_DEBUG__,F=globalThis,pa=`10.74.0`;function ma(){return ha(F),F}function ha(e){let t=e.__SENTRY__=e.__SENTRY__||{};return t.version=t.version||`10.74.0`,t[pa]=t[`10.74.0`]||{}}function ga(e,t,n=F){let r=n.__SENTRY__=n.__SENTRY__||{},i=r[pa]=r[`10.74.0`]||{};return i[e]||(i[e]=t())}var _a=[`debug`,`info`,`warn`,`error`,`log`,`assert`,`trace`],Wie=`Sentry Logger `,va={};function ya(e){if(!(`console`in F))return e();let t=F.console,n={},r=Object.keys(va);r.forEach(e=>{let r=va[e];n[e]=t[e],t[e]=r});try{return e()}finally{r.forEach(e=>{t[e]=n[e]})}}function Gie(){Sa().enabled=!0}function Kie(){Sa().enabled=!1}function ba(){return Sa().enabled}function qie(...e){xa(`log`,...e)}function Jie(...e){xa(`warn`,...e)}function Yie(...e){xa(`error`,...e)}function xa(e,...t){P&&ba()&&ya(()=>{F.console[e](`${Wie}[${e}]:`,...t)})}function Sa(){return P?ga(`loggerSettings`,()=>({enabled:!1})):{enabled:!1}}var I={enable:Gie,disable:Kie,isEnabled:ba,log:qie,warn:Jie,error:Yie},Ca=50,wa=/\(error: (.*)\)/,Ta=/captureMessage|captureException/;function Ea(...e){let t=e.sort((e,t)=>e[0]-t[0]).map(e=>e[1]);return(e,n=0,r=0)=>{let i=[],a=e.split(`
2
+ import{n as e,r as t,t as n}from"./rolldown-runtime-hePW80VL.js";import{$ as r,$t as i,Aa as a,An as o,Ar as s,At as c,B as l,Br as u,Bt as d,Ci as f,Dn as p,Ei as m,En as h,Er as g,Fa as _,Fi as v,Fn as y,Gn as b,Gt as x,Ha as S,Hn as C,Hr as w,Ht as T,Ia as E,It as ee,J as te,Jt as ne,Kt as re,L as ie,La as ae,Ln as oe,Lt as D,M as se,Ma as ce,Mr as le,Ni as ue,Nn as de,Nt as fe,Oa as pe,Pi as me,Pn as he,Pt as ge,Qi as _e,Rn as ve,Rr as ye,Rt as be,Si as xe,Ta as Se,Tn as Ce,Tr as we,Tt as Te,Ua as Ee,Un as De,Ur as Oe,Ut as eee,V as tee,Va as ke,Vn as Ae,Vr as je,Vt as Me,W as nee,Wa as ree,Wn as iee,Wr as aee,Wt as oee,X as see,Yi as Ne,Yt as cee,Z as lee,Zi as uee,_ as dee,_t as fee,an as pee,at as Pe,bn as mee,br as hee,bt as Fe,ca as Ie,ci as Le,ct as gee,dn as _ee,ea as Re,en as ze,et as Be,fi as Ve,gi as vee,gn as He,hn as yee,hr as bee,ht as xee,in as Ue,it as See,ja as Cee,jn as We,jr as wee,jt as Ge,ki as Tee,kr as Ke,kt as Eee,li as qe,ln as Dee,m as Oee,mn as kee,mr as Je,na as Aee,ni as jee,nt as Ye,oa as Mee,or as Xe,pn as Ze,pt as Nee,q as Pee,qt as Fee,r as Iee,rn as Qe,rr as Lee,rt as Ree,sn as zee,un as Bee,ut as $e,vn as et,vr as Vee,wn as Hee,wr as Uee,wt as tt,xi as Wee,xn as nt,y as Gee,yi as Kee,yn as qee,z as Jee,zn as Yee,zt as Xee}from"./Stream-mUTFnSY9.js";import{i as Zee,l as rt,n as it,o as at,s as ot}from"./atomRegistry-C1yW8tyM.js";import{An as Qee,_n as st,cn as $ee,on as ete,sn as ct,vn as tte}from"./CompositeItem-DNVaubQt.js";import{$t as nte,A as lt,At as ut,Bt as dt,C as rte,Ct as ft,Dt as pt,En as mt,Et as ht,Fn as gt,G as ite,Gn as ate,Gt as _t,H as vt,Hn as ote,Ht as ste,In as yt,J as cte,Jt as bt,Kn as lte,Kt as xt,Lt as St,Mn as Ct,Mt as wt,Nn as ute,Nt as Tt,On as dte,Ot as Et,Q as fte,Qt as pte,R as Dt,Rt as mte,Sn as hte,Tn as gte,U as Ot,Un as kt,Ut as At,Vn as jt,Vt as _te,W as vte,Wn as yte,Wt as Mt,Xt as bte,Yn as xte,Yt as Ste,Zt as Nt,_n as Pt,_t as Cte,a as wte,an as Tte,b as Ft,bt as Ete,c as Dte,cn as It,dt as Lt,en as Ote,er as Rt,ft as zt,gn as Bt,gt as Vt,hn as Ht,i as kte,in as Ate,j as Ut,jn as jte,jt as Wt,kn as Gt,l as Kt,mt as Mte,nn as qt,nt as Jt,on as Yt,pn as Xt,qt as Zt,rt as Qt,s as O,sn as $t,tn as Nte,tt as Pte,ut as en,v as tn,vn as k,vt as nn,w as Fte,wt as Ite,x as rn,xn as an,yn as on,zn as sn,zt as Lte}from"./src-BAHvoNAY.js";import{$ as Rte,A as cn,B as zte,C as Bte,D as Vte,E as Hte,F as ln,G as Ute,H as Wte,I as un,J as Gte,K as Kte,L as dn,M as fn,N as pn,O as qte,P as mn,Q as Jte,R as Yte,T as Xte,U as Zte,W as Qte,X as $te,Y as ene,Z as tne,_ as nne,a as hn,c as rne,d as ine,et as ane,it as gn,l as one,n as _n,nt as sne,q as cne,rt as lne,s as une,tt as dne,u as fne,w as pne}from"./cmmdAuthRedirect-BYBGztDm.js";import{t as A}from"./preload-helper-Czpn1I53.js";import{a as vn,i as mne,n as hne,o as yn,r as gne,t as bn}from"./debouncer-BmyJL8Gi.js";import{n as j,t as xn}from"./transport-CgH8pQK3.js";import{n as _ne,t as vne}from"./workspaceReadinessAtom-D6bgTvKb.js";import{a as yne,c as bne,n as xne,r as Sn,s as Sne,u as Cn}from"./themePalette-eOA8OvYM.js";function Cne(e){return e[e.length-1]}function wne(e,t){return typeof e==`function`?e(t):e}var wn=Object.prototype.hasOwnProperty,Tne=Object.prototype.propertyIsEnumerable;function Ene(e){for(let t in e)if(wn.call(e,t))return!0;return!1}var Dne=()=>Object.create(null),One=(e,t)=>Tn(e,t,Dne);function Tn(e,t,n=()=>({}),r=0){if(e===t)return e;if(r>500)return t;let i=t,a=kn(e)&&kn(i);if(!a&&!(Dn(e)&&Dn(i)))return i;let o=a?e:En(e);if(!o)return i;let s=a?i:En(i);if(!s)return i;let c=o.length,l=s.length,u=a?Array(l):n(),d=0;for(let t=0;t<l;t++){let o=a?t:s[t],l=e[o],f=i[o];if(l===f){u[o]=l,(a?t<c:wn.call(e,o))&&d++;continue}if(l===null||f===null||typeof l!=`object`||typeof f!=`object`){u[o]=f;continue}let p=Tn(l,f,n,r+1);u[o]=p,p===l&&d++}return c===l&&d===c?e:u}function En(e){let t=Object.keys(e);if(t.length!==Object.getOwnPropertyNames(e).length)return!1;let n=Object.getOwnPropertySymbols(e);if(n.length===0)return t;for(let r of n){if(!Tne.call(e,r))return!1;t.push(r)}return t}function Dn(e){if(!On(e))return!1;let t=e.constructor;if(t===void 0)return!0;let n=t.prototype;return!(!On(n)||!n.hasOwnProperty(`isPrototypeOf`))}function On(e){return Object.prototype.toString.call(e)===`[object Object]`}function kn(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function An(e,t,n){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return!1;for(let r=0,i=e.length;r<i;r++)if(!An(e[r],t[r],n))return!1;return!0}if(Dn(e)&&Dn(t)){let r=n?.ignoreUndefined??!0;if(n?.partial){for(let i in t)if((!r||t[i]!==void 0)&&!An(e[i],t[i],n))return!1;return!0}let i=0;if(!r)i=Object.keys(e).length;else for(let t in e)e[t]!==void 0&&i++;let a=0;for(let o in t)if((!r||t[o]!==void 0)&&(a++,a>i||!An(e[o],t[o],n)))return!1;return i===a}return!1}var kne=/[\x00-\x1f\x7f"<>`{}]/g;function Ane(e){return e.replace(kne,e=>`%`+e.charCodeAt(0).toString(16).toUpperCase().padStart(2,`0`))}function jn(e){let t;try{t=decodeURI(e)}catch{t=e.replaceAll(/%[0-9A-F]{2}/gi,e=>{try{return decodeURI(e)}catch{return e}})}return Ane(t)}var jne=[`http:`,`https:`,`mailto:`,`tel:`];function Mne(e,t){if(!e)return!1;try{let n=new URL(e);return!t.has(n.protocol)}catch{return!1}}function Nne(e){if(!e||!/[%\\\x00-\x1f\x7f]/.test(e)&&!e.startsWith(`//`))return{path:e,handledProtocolRelativeURL:!1};let t=/%25|%5C/gi,n=0,r=``,i;for(;(i=t.exec(e))!==null;)r+=jn(e.slice(n,i.index))+i[0],n=t.lastIndex;r+=jn(n?e.slice(n):e);let a=!1;return r.startsWith(`//`)&&(a=!0,r=`/`+r.replace(/^\/+/,``)),{path:r,handledProtocolRelativeURL:a}}function Pne(e){return/\s|[^\u0000-\u007F]/.test(e)?e.replace(/\s|[^\u0000-\u007F]/gu,encodeURIComponent):e}function Fne(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function Mn(){throw Error(`Invariant failed`)}var M=t(ree(),1),Nn=M.createContext(null);function Pn(e){return M.useContext(Nn)}var Fn=M.createContext(void 0),Ine=M.createContext(void 0),Lne=Qee();function Rne(e,t){return e===t}function In(e,t,n=Rne){let r=(0,M.useCallback)(t=>{if(!e)return()=>{};let{unsubscribe:n}=e.subscribe(t);return n},[e]),i=(0,M.useCallback)(()=>e?.get(),[e]);return(0,Lne.useSyncExternalStoreWithSelector)(r,i,i,t,n)}var Ln={};function Rn(e,t){let n=M.useRef();return r=>{let i=e?.select?e.select(r):r;return e?.structuralSharing??t.options.defaultStructuralSharing?n.current=Tn(n.current,i):i}}function zn(e){let t=Pn(),n=M.useContext(e.from?Ine:Fn),r=e.from??n,i=t.stores.getMatchStore(r),a=Rn(e,t),o=In(i,e=>e?a(e):Ln);if(o!==Ln)return o;(e.shouldThrow??!0)&&Mn()}function zne(e){return zn({from:e.from,shouldThrow:e.shouldThrow,structuralSharing:e.structuralSharing,strict:e.strict,select:t=>{let n=e.strict===!1?t.params:t._strictParams;return e.select?e.select(n):n}})}var N=Ee(),Bn=typeof window<`u`&&(window.desktopBridge!==void 0||window.nativeApi!==void 0),Vn=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(){}},Hn=new class extends Vn{#e;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<`u`&&window.addEventListener){let t=()=>e();return window.addEventListener(`visibilitychange`,t,!1),()=>{window.removeEventListener(`visibilitychange`,t)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(e=>{typeof e==`boolean`?this.setFocused(e):this.onFocus()})}setFocused(e){this.#e!==e&&(this.#e=e,this.onFocus())}onFocus(){let e=this.isFocused();this.listeners.forEach(t=>{t(e)})}isFocused(){return typeof this.#e==`boolean`?this.#e:globalThis.document?.visibilityState!==`hidden`}},Un={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},Wn=new class{#e=Un;setTimeoutProvider(e){this.#e=e}setTimeout(e,t){return this.#e.setTimeout(e,t)}clearTimeout(e){this.#e.clearTimeout(e)}setInterval(e,t){return this.#e.setInterval(e,t)}clearInterval(e){this.#e.clearInterval(e)}};function Gn(e){setTimeout(e,0)}var Kn=typeof window>`u`||`Deno`in globalThis;function qn(){}function Bne(e,t){return typeof e==`function`?e(t):e}function Jn(e){return typeof e==`number`&&e>=0&&e!==1/0}function Yn(e,t){return Math.max(e+(t||0)-Date.now(),0)}function Xn(e,t){return typeof e==`function`?e(t):e}function Zn(e,t){return typeof e==`function`?e(t):e}function Vne(e,t){let{type:n=`all`,exact:r,fetchStatus:i,predicate:a,queryKey:o,stale:s}=e;if(o){if(r){if(t.queryHash!==Qn(o,t.options))return!1}else if(!er(t.queryKey,o))return!1}if(n!==`all`){let e=t.isActive();if(n===`active`&&!e||n===`inactive`&&e)return!1}return!(typeof s==`boolean`&&t.isStale()!==s||i&&i!==t.state.fetchStatus||a&&!a(t))}function Hne(e,t){let{exact:n,status:r,predicate:i,mutationKey:a}=e;if(a){if(!t.options.mutationKey)return!1;if(n){if($n(t.options.mutationKey)!==$n(a))return!1}else if(!er(t.options.mutationKey,a))return!1}return!(r&&t.state.status!==r||i&&!i(t))}function Qn(e,t){return(t?.queryKeyHashFn||$n)(e)}function $n(e){return JSON.stringify(e,(e,t)=>ir(t)?Object.keys(t).sort().reduce((e,n)=>(e[n]=t[n],e),{}):t)}function er(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(e&&t&&typeof e==`object`&&typeof t==`object`){if(Array.isArray(e)&&Array.isArray(t)){for(let n=0;n<t.length;n++)if(!er(e[n],t[n]))return!1;return!0}let n=Object.keys(t);for(let r of n)if(!er(e[r],t[r]))return!1;return!0}return!1}var Une=Object.prototype.hasOwnProperty;function tr(e,t,n=0){if(e===t)return e;if(n>500)return t;let r=rr(e)&&rr(t);if(!r&&!(ir(e)&&ir(t)))return t;let i=(r?e:Object.keys(e)).length,a=r?t:Object.keys(t),o=a.length,s=r?Array(o):{},c=0;for(let l=0;l<o;l++){let o=r?l:a[l],u=e[o],d=t[o];if(u===d){s[o]=u,(r?l<i:Une.call(e,o))&&c++;continue}if(u===null||d===null||typeof u!=`object`||typeof d!=`object`){s[o]=d;continue}let f=tr(u,d,n+1);s[o]=f,f===u&&c++}return i===o&&c===i?e:s}function nr(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(let n in e)if(e[n]!==t[n])return!1;return!0}function rr(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function ir(e){if(!ar(e))return!1;let t=e.constructor;if(t===void 0)return!0;let n=t.prototype;return!(!ar(n)||!n.hasOwnProperty(`isPrototypeOf`)||Object.getPrototypeOf(e)!==Object.prototype)}function ar(e){return Object.prototype.toString.call(e)===`[object Object]`}function Wne(e){return new Promise(t=>{Wn.setTimeout(t,e)})}function or(e,t,n){return typeof n.structuralSharing==`function`?n.structuralSharing(e,t):n.structuralSharing===!1?t:tr(e,t)}function Gne(e){return e}function Kne(e,t,n=0){let r=[...e,t];return n&&r.length>n?r.slice(1):r}function qne(e,t,n=0){let r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var sr=Symbol();function cr(e,t){return!e.queryFn&&t?.initialPromise?()=>t.initialPromise:!e.queryFn||e.queryFn===sr?()=>Promise.reject(Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function lr(e,t){return typeof e==`function`?e(...t):!!e}function Jne(e,t,n){let r=!1,i;return Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(i??=t(),r?i:(r=!0,i.aborted?n():i.addEventListener(`abort`,n,{once:!0}),i))}),e}var ur=(()=>{let e=()=>Kn;return{isServer(){return e()},setIsServer(t){e=t}}})();function dr(){let e,t,n=new Promise((n,r)=>{e=n,t=r});n.status=`pending`,n.catch(()=>{});function r(e){Object.assign(n,e),delete n.resolve,delete n.reject}return n.resolve=t=>{r({status:`fulfilled`,value:t}),e(t)},n.reject=e=>{r({status:`rejected`,reason:e}),t(e)},n}var Yne=Gn;function Xne(){let e=[],t=0,n=e=>{e()},r=e=>{e()},i=Yne,a=r=>{t?e.push(r):i(()=>{n(r)})},o=()=>{let t=e;e=[],t.length&&i(()=>{r(()=>{t.forEach(e=>{n(e)})})})};return{batch:e=>{let n;t++;try{n=e()}finally{t--,t||o()}return n},batchCalls:e=>(...t)=>{a(()=>{e(...t)})},schedule:a,setNotifyFunction:e=>{n=e},setBatchNotifyFunction:e=>{r=e},setScheduler:e=>{i=e}}}var fr=Xne(),pr=new class extends Vn{#e=!0;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<`u`&&window.addEventListener){let t=()=>e(!0),n=()=>e(!1);return window.addEventListener(`online`,t,!1),window.addEventListener(`offline`,n,!1),()=>{window.removeEventListener(`online`,t),window.removeEventListener(`offline`,n)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(this.setOnline.bind(this))}setOnline(e){this.#e!==e&&(this.#e=e,this.listeners.forEach(t=>{t(e)}))}isOnline(){return this.#e}};function Zne(e){return Math.min(1e3*2**e,3e4)}function mr(e){return(e??`online`)!==`online`||pr.isOnline()}var hr=class extends Error{constructor(e){super(`CancelledError`),this.revert=e?.revert,this.silent=e?.silent}};function gr(e){let t=!1,n=0,r,i=dr(),a=()=>i.status!==`pending`,o=t=>{if(!a()){let n=new hr(t);f(n),e.onCancel?.(n)}},s=()=>{t=!0},c=()=>{t=!1},l=()=>Hn.isFocused()&&(e.networkMode===`always`||pr.isOnline())&&e.canRun(),u=()=>mr(e.networkMode)&&e.canRun(),d=e=>{a()||(r?.(),i.resolve(e))},f=e=>{a()||(r?.(),i.reject(e))},p=()=>new Promise(t=>{r=e=>{(a()||l())&&t(e)},e.onPause?.()}).then(()=>{r=void 0,a()||e.onContinue?.()}),m=()=>{if(a())return;let r,i=n===0?e.initialPromise:void 0;try{r=i??e.fn()}catch(e){r=Promise.reject(e)}Promise.resolve(r).then(d).catch(r=>{if(a())return;let i=e.retry??(ur.isServer()?0:3),o=e.retryDelay??Zne,s=typeof o==`function`?o(n,r):o,c=i===!0||typeof i==`number`&&n<i||typeof i==`function`&&i(n,r);if(t||!c){f(r);return}n++,e.onFail?.(n,r),Wne(s).then(()=>l()?void 0:p()).then(()=>{t?f(r):m()})})};return{promise:i,status:()=>i.status,cancel:o,continue:()=>(r?.(),i),cancelRetry:s,continueRetry:c,canStart:u,start:()=>(u()?m():p().then(m),i)}}var _r=class{#e;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),Jn(this.gcTime)&&(this.#e=Wn.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(ur.isServer()?1/0:3e5))}clearGcTimeout(){this.#e!==void 0&&(Wn.clearTimeout(this.#e),this.#e=void 0)}};function Qne(e){return{onFetch:(t,n)=>{let r=t.options,i=t.fetchOptions?.meta?.fetchMore?.direction,a=t.state.data?.pages||[],o=t.state.data?.pageParams||[],s={pages:[],pageParams:[]},c=0,l=async()=>{let n=!1,l=e=>{Jne(e,()=>t.signal,()=>n=!0)},u=cr(t.options,t.fetchOptions),d=async(e,r,i)=>{if(n)return Promise.reject(t.signal.reason);if(r==null&&e.pages.length)return Promise.resolve(e);let a=(()=>{let e={client:t.client,queryKey:t.queryKey,pageParam:r,direction:i?`backward`:`forward`,meta:t.options.meta};return l(e),e})(),o=await u(a),{maxPages:s}=t.options,c=i?qne:Kne;return{pages:c(e.pages,o,s),pageParams:c(e.pageParams,r,s)}};if(i&&a.length){let e=i===`backward`,t=e?yr:vr,n={pages:a,pageParams:o};s=await d(n,t(r,n),e)}else{let t=e??a.length;do{let e=c===0?o[0]??r.initialPageParam:vr(r,s);if(c>0&&e==null)break;s=await d(s,e),c++}while(c<t)}return s};t.fetchFn=t.options.persister?()=>t.options.persister?.(l,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n):l}}}function vr(e,{pages:t,pageParams:n}){let r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,n[r],n):void 0}function yr(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}function $ne(e,t){return t?vr(e,t)!=null:!1}function ere(e,t){return!t||!e.getPreviousPageParam?!1:yr(e,t)!=null}var tre=class extends _r{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e){super(),this.#s=!1,this.#o=e.defaultOptions,this.setOptions(e.options),this.observers=[],this.#i=e.client,this.#r=this.#i.getQueryCache(),this.queryKey=e.queryKey,this.queryHash=e.queryHash,this.#t=Sr(this.options),this.state=e.state??this.#t,this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return this.#e}get promise(){return this.#a?.promise}setOptions(e){if(this.options={...this.#o,...e},e?._type&&(this.#e=e._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){let e=Sr(this.options);e.data!==void 0&&(this.setState(xr(e.data,e.dataUpdatedAt)),this.#t=e)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus===`idle`&&this.#r.remove(this)}setData(e,t){let n=or(this.state.data,e,this.options);return this.#l({data:n,type:`success`,dataUpdatedAt:t?.updatedAt,manual:t?.manual}),n}setState(e){this.#l({type:`setState`,state:e})}cancel(e){let t=this.#a?.promise;return this.#a?.cancel(e),t?t.then(qn).catch(qn):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return this.#t}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(e=>Zn(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===sr||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0&&this.observers.some(e=>Xn(e.options.staleTime,this)===`static`)}isStale(){return this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(e=0){return this.state.data===void 0?!0:e===`static`?!1:this.state.isInvalidated?!0:!Yn(this.state.dataUpdatedAt,e)}onFocus(){this.observers.find(e=>e.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#a?.continue()}onOnline(){this.observers.find(e=>e.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#a?.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),this.#r.notify({type:`observerAdded`,query:this,observer:e}))}removeObserver(e){this.observers.includes(e)&&(this.observers=this.observers.filter(t=>t!==e),this.observers.length||(this.#a&&(this.#s||this.#c()?this.#a.cancel({revert:!0}):this.#a.cancelRetry()),this.scheduleGc()),this.#r.notify({type:`observerRemoved`,query:this,observer:e}))}getObserversCount(){return this.observers.length}#c(){return this.state.fetchStatus===`paused`&&this.state.status===`pending`}invalidate(){this.state.isInvalidated||this.#l({type:`invalidate`})}async fetch(e,t){if(this.state.fetchStatus!==`idle`&&this.#a?.status()!==`rejected`){if(this.state.data!==void 0&&t?.cancelRefetch)this.cancel({silent:!0});else if(this.#a)return this.#a.continueRetry(),this.#a.promise}if(e&&this.setOptions(e),!this.options.queryFn){let e=this.observers.find(e=>e.options.queryFn);e&&this.setOptions(e.options)}let n=new AbortController,r=e=>{Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(this.#s=!0,n.signal)})},i=()=>{let e=cr(this.options,t),n=(()=>{let e={client:this.#i,queryKey:this.queryKey,meta:this.meta};return r(e),e})();return this.#s=!1,this.options.persister?this.options.persister(e,n,this):e(n)},a=(()=>{let e={fetchOptions:t,options:this.options,queryKey:this.queryKey,client:this.#i,state:this.state,fetchFn:i};return r(e),e})();(this.#e===`infinite`?Qne(this.options.pages):this.options.behavior)?.onFetch(a,this),this.#n=this.state,(this.state.fetchStatus===`idle`||this.state.fetchMeta!==a.fetchOptions?.meta)&&this.#l({type:`fetch`,meta:a.fetchOptions?.meta}),this.#a=gr({initialPromise:t?.initialPromise,fn:a.fetchFn,onCancel:e=>{e instanceof hr&&e.revert&&this.setState({...this.#n,fetchStatus:`idle`}),n.abort()},onFail:(e,t)=>{this.#l({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#l({type:`pause`})},onContinue:()=>{this.#l({type:`continue`})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0});try{let e=await this.#a.start();if(e===void 0)throw Error(`${this.queryHash} data is undefined`);return this.setData(e),this.#r.config.onSuccess?.(e,this),this.#r.config.onSettled?.(e,this.state.error,this),e}catch(e){if(e instanceof hr){if(e.silent)return this.#a.promise;if(e.revert){if(this.state.data===void 0)throw e;return this.state.data}}throw this.#l({type:`error`,error:e}),this.#r.config.onError?.(e,this),this.#r.config.onSettled?.(this.state.data,e,this),e}finally{this.scheduleGc()}}#l(e){let t=t=>{switch(e.type){case`failed`:return{...t,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case`pause`:return{...t,fetchStatus:`paused`};case`continue`:return{...t,fetchStatus:`fetching`};case`fetch`:return{...t,...br(t.data,this.options),fetchMeta:e.meta??null};case`success`:let n={...t,...xr(e.data,e.dataUpdatedAt),dataUpdateCount:t.dataUpdateCount+1,...!e.manual&&{fetchStatus:`idle`,fetchFailureCount:0,fetchFailureReason:null}};return this.#n=e.manual?n:void 0,n;case`error`:let r=e.error;return{...t,error:r,errorUpdateCount:t.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:t.fetchFailureCount+1,fetchFailureReason:r,fetchStatus:`idle`,status:`error`,isInvalidated:!0};case`invalidate`:return{...t,isInvalidated:!0};case`setState`:return{...t,...e.state}}};this.state=t(this.state),fr.batch(()=>{this.observers.forEach(e=>{e.onQueryUpdate()}),this.#r.notify({query:this,type:`updated`,action:e})})}};function br(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:mr(t.networkMode)?`fetching`:`paused`,...e===void 0&&{error:null,status:`pending`}}}function xr(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:`success`}}function Sr(e){let t=typeof e.initialData==`function`?e.initialData():e.initialData,n=t!==void 0,r=n?typeof e.initialDataUpdatedAt==`function`?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?`success`:`pending`,fetchStatus:`idle`}}var Cr=class extends Vn{constructor(e,t){super(),this.options=t,this.#e=e,this.#s=null,this.#o=dr(),this.bindMethods(),this.setOptions(t)}#e;#t=void 0;#n=void 0;#r=void 0;#i;#a;#o;#s;#c;#l;#u;#d;#f;#p;#m=new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#t.addObserver(this),wr(this.#t,this.options)?this.#h():this.updateResult(),this.#y())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return Tr(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Tr(this.#t,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#b(),this.#x(),this.#t.removeObserver(this)}setOptions(e){let t=this.options,n=this.#t;if(this.options=this.#e.defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!=`boolean`&&typeof this.options.enabled!=`function`&&typeof Zn(this.options.enabled,this.#t)!=`boolean`)throw Error(`Expected enabled to be a boolean or a callback that returns a boolean`);this.#S(),this.#t.setOptions(this.options),t._defaulted&&!nr(this.options,t)&&this.#e.getQueryCache().notify({type:`observerOptionsUpdated`,query:this.#t,observer:this});let r=this.hasListeners();r&&Er(this.#t,n,this.options,t)&&this.#h(),this.updateResult(),r&&(this.#t!==n||Zn(this.options.enabled,this.#t)!==Zn(t.enabled,this.#t)||Xn(this.options.staleTime,this.#t)!==Xn(t.staleTime,this.#t))&&this.#g();let i=this.#_();r&&(this.#t!==n||Zn(this.options.enabled,this.#t)!==Zn(t.enabled,this.#t)||i!==this.#p)&&this.#v(i)}getOptimisticResult(e){let t=this.#e.getQueryCache().build(this.#e,e),n=this.createResult(t,e);return rre(this,n)&&(this.#r=n,this.#a=this.options,this.#i=this.#t.state),n}getCurrentResult(){return this.#r}trackResult(e,t){return new Proxy(e,{get:(e,n)=>(this.trackProp(n),t?.(n),n===`promise`&&(this.trackProp(`data`),!this.options.experimental_prefetchInRender&&this.#o.status===`pending`&&this.#o.reject(Error(`experimental_prefetchInRender feature flag is not enabled`))),Reflect.get(e,n))})}trackProp(e){this.#m.add(e)}getCurrentQuery(){return this.#t}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){let t=this.#e.defaultQueryOptions(e),n=this.#e.getQueryCache().build(this.#e,t);return n.fetch().then(()=>this.createResult(n,t))}fetch(e){return this.#h({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#r))}#h(e){this.#S();let t=this.#t.fetch(this.options,e);return e?.throwOnError||(t=t.catch(qn)),t}#g(){this.#b();let e=Xn(this.options.staleTime,this.#t);if(ur.isServer()||this.#r.isStale||!Jn(e))return;let t=Yn(this.#r.dataUpdatedAt,e)+1;this.#d=Wn.setTimeout(()=>{this.#r.isStale||this.updateResult()},t)}#_(){return(typeof this.options.refetchInterval==`function`?this.options.refetchInterval(this.#t):this.options.refetchInterval)??!1}#v(e){this.#x(),this.#p=e,!(ur.isServer()||Zn(this.options.enabled,this.#t)===!1||!Jn(this.#p)||this.#p===0)&&(this.#f=Wn.setInterval(()=>{(this.options.refetchIntervalInBackground||Hn.isFocused())&&this.#h()},this.#p))}#y(){this.#g(),this.#v(this.#_())}#b(){this.#d!==void 0&&(Wn.clearTimeout(this.#d),this.#d=void 0)}#x(){this.#f!==void 0&&(Wn.clearInterval(this.#f),this.#f=void 0)}createResult(e,t){let n=this.#t,r=this.options,i=this.#r,a=this.#i,o=this.#a,s=e===n?this.#n:e.state,{state:c}=e,l={...c},u=!1,d;if(t._optimisticResults){let i=this.hasListeners(),a=!i&&wr(e,t),o=i&&Er(e,n,t,r);(a||o)&&(l={...l,...br(c.data,e.options)}),t._optimisticResults===`isRestoring`&&(l.fetchStatus=`idle`)}let{error:f,errorUpdatedAt:p,status:m}=l;d=l.data;let h=!1;if(t.placeholderData!==void 0&&d===void 0&&m===`pending`){let e;i?.isPlaceholderData&&t.placeholderData===o?.placeholderData?(e=i.data,h=!0):e=typeof t.placeholderData==`function`?t.placeholderData(this.#u?.state.data,this.#u):t.placeholderData,e!==void 0&&(m=`success`,d=or(i?.data,e,t),u=!0)}if(t.select&&d!==void 0&&!h)if(i&&d===a?.data&&t.select===this.#c)d=this.#l;else try{this.#c=t.select,d=t.select(d),d=or(i?.data,d,t),this.#l=d,this.#s=null}catch(e){this.#s=e}this.#s&&(f=this.#s,d=this.#l,p=Date.now(),m=`error`);let g=l.fetchStatus===`fetching`,_=m===`pending`,v=m===`error`,y=_&&g,b=d!==void 0,x={status:m,fetchStatus:l.fetchStatus,isPending:_,isSuccess:m===`success`,isError:v,isInitialLoading:y,isLoading:y,data:d,dataUpdatedAt:l.dataUpdatedAt,error:f,errorUpdatedAt:p,failureCount:l.fetchFailureCount,failureReason:l.fetchFailureReason,errorUpdateCount:l.errorUpdateCount,isFetched:e.isFetched(),isFetchedAfterMount:l.dataUpdateCount>s.dataUpdateCount||l.errorUpdateCount>s.errorUpdateCount,isFetching:g,isRefetching:g&&!_,isLoadingError:v&&!b,isPaused:l.fetchStatus===`paused`,isPlaceholderData:u,isRefetchError:v&&b,isStale:Dr(e,t),refetch:this.refetch,promise:this.#o,isEnabled:Zn(t.enabled,e)!==!1};if(this.options.experimental_prefetchInRender){let t=x.data!==void 0,r=x.status===`error`&&!t,i=e=>{r?e.reject(x.error):t&&e.resolve(x.data)},a=()=>{let e=this.#o=x.promise=dr();i(e)},o=this.#o;switch(o.status){case`pending`:e.queryHash===n.queryHash&&i(o);break;case`fulfilled`:(r||x.data!==o.value)&&a();break;case`rejected`:(!r||x.error!==o.reason)&&a()}}return x}updateResult(){let e=this.#r,t=this.createResult(this.#t,this.options);this.#i=this.#t.state,this.#a=this.options,this.#i.data!==void 0&&(this.#u=this.#t),!nr(t,e)&&(this.#r=t,this.#C({listeners:(()=>{if(!e)return!0;let{notifyOnChangeProps:t}=this.options,n=typeof t==`function`?t():t;if(n===`all`||!n&&!this.#m.size)return!0;let r=new Set(n??this.#m);return this.options.throwOnError&&r.add(`error`),Object.keys(this.#r).some(t=>{let n=t;return this.#r[n]!==e[n]&&r.has(n)})})()}))}#S(){let e=this.#e.getQueryCache().build(this.#e,this.options);if(e===this.#t)return;let t=this.#t;this.#t=e,this.#n=e.state,this.hasListeners()&&(t?.removeObserver(this),e.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#y()}#C(e){fr.batch(()=>{e.listeners&&this.listeners.forEach(e=>{e(this.#r)}),this.#e.getQueryCache().notify({query:this.#t,type:`observerResultsUpdated`})})}};function nre(e,t){return Zn(t.enabled,e)!==!1&&e.state.data===void 0&&(e.state.status!==`error`||Zn(t.retryOnMount,e)!==!1)}function wr(e,t){return nre(e,t)||e.state.data!==void 0&&Tr(e,t,t.refetchOnMount)}function Tr(e,t,n){if(Zn(t.enabled,e)!==!1&&Xn(t.staleTime,e)!==`static`){let r=typeof n==`function`?n(e):n;return r===`always`||r!==!1&&Dr(e,t)}return!1}function Er(e,t,n,r){return(e!==t||Zn(r.enabled,e)===!1)&&(!n.suspense||e.state.status!==`error`)&&Dr(e,n)}function Dr(e,t){return Zn(t.enabled,e)!==!1&&e.isStaleByTime(Xn(t.staleTime,e))}function rre(e,t){return!nr(e.getCurrentResult(),t)}var Or=M.createContext(void 0),kr=e=>{let t=M.useContext(Or);if(e)return e;if(!t)throw Error(`No QueryClient set, use QueryClientProvider to set one`);return t},ire=({client:e,children:t})=>(M.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),(0,N.jsx)(Or.Provider,{value:e,children:t})),Ar=M.createContext(!1),jr=()=>M.useContext(Ar);Ar.Provider;function are(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var ore=M.createContext(are()),Mr=()=>M.useContext(ore),Nr=(e,t,n)=>{let r=n?.state.error&&typeof e.throwOnError==`function`?lr(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||r)&&(t.isReset()||(e.retryOnMount=!1))},Pr=e=>{M.useEffect(()=>{e.clearReset()},[e])},Fr=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:i})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(i&&e.data===void 0||lr(n,[e.error,r])),Ir=e=>{if(e.suspense){let t=1e3,n=e=>e===`static`?e:Math.max(e??t,t),r=e.staleTime;e.staleTime=typeof r==`function`?(...e)=>n(r(...e)):n(r),typeof e.gcTime==`number`&&(e.gcTime=Math.max(e.gcTime,t))}},sre=(e,t)=>e.isLoading&&e.isFetching&&!t,Lr=(e,t)=>e?.suspense&&t.isPending,Rr=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function zr(e,t,n){let r=jr(),i=Mr(),a=kr(n),o=a.defaultQueryOptions(e);a.getDefaultOptions().queries?._experimental_beforeQuery?.(o);let s=a.getQueryCache().get(o.queryHash),c=e.subscribed!==!1;o._optimisticResults=r?`isRestoring`:c?`optimistic`:void 0,Ir(o),Nr(o,i,s),Pr(i);let l=!a.getQueryCache().get(o.queryHash),[u]=M.useState(()=>new t(a,o)),d=u.getOptimisticResult(o),f=!r&&c;if(M.useSyncExternalStore(M.useCallback(e=>{let t=f?u.subscribe(fr.batchCalls(e)):qn;return u.updateResult(),t},[u,f]),()=>u.getCurrentResult(),()=>u.getCurrentResult()),M.useEffect(()=>{u.setOptions(o)},[o,u]),Lr(o,d))throw Rr(o,u,i);if(Fr({result:d,errorResetBoundary:i,throwOnError:o.throwOnError,query:s,suspense:o.suspense}))throw d.error;return a.getDefaultOptions().queries?._experimental_afterQuery?.(o,d),o.experimental_prefetchInRender&&!ur.isServer()&&sre(d,r)&&(l?Rr(o,u,i):s?.promise)?.catch(qn).finally(()=>{u.updateResult()}),o.notifyOnChangeProps?d:u.trackResult(d)}function Br(e,t){return zr(e,Cr,t)}function cre(e){return e}var lre=g,Vr=globalThis.Number,ure=e=>{if(e===`NaN`)return v(NaN);if(e===`Infinity`)return v(1/0);if(e===`-Infinity`)return v(-1/0);if(e.trim()===``)return me();let t=Vr(e);return Vr.isNaN(t)?me():v(t)},dre=[[`GET`,`get`],[`POST`,`post`],[`PUT`,`put`],[`DELETE`,`del`],[`PATCH`,`patch`],[`HEAD`,`head`],[`OPTIONS`,`options`],[`TRACE`,`trace`]],Hr=`~effect/http/HttpClientRequest`,fre={[Hr]:Hr,..._e,toJSON(){return{_id:`HttpClientRequest`,method:this.method,url:this.url,urlParams:this.urlParams,hash:this.hash,headers:Mee(this.headers),body:this.body.toJSON()}},pipe(){return ke(this,arguments)}};function Ur(e,t,n,r,i,a){let o=Object.create(fre);return o.method=e,o.url=t,o.urlParams=n,o.hash=r,o.headers=i,o.body=a,o}var pre=Ur(`GET`,``,pte,me(),ste,bte),Wr=e=>(t,n)=>hre(pre,{method:e,url:t,...n??void 0}),mre=Wr(`POST`),hre=_(2,(e,t)=>{let n=e;return t.method&&(n=gre(n,t.method)),t.url&&(n=yre(n,t.url)),t.headers&&(n=Gr(n,t.headers)),t.urlParams&&(n=bre(n,t.urlParams)),t.hash&&(n=xre(n,t.hash)),t.body&&(n=qr(n,t.body)),t.accept&&(n=Kr(n,t.accept)),t.acceptJson&&(n=vre(n)),n}),gre=_(2,(e,t)=>Ur(t,e.url,e.urlParams,e.hash,e.headers,e.body)),_re=_(3,(e,t,n)=>Ur(e.method,e.url,e.urlParams,e.hash,bt(e.headers,t,n),e.body)),Gr=_(2,(e,t)=>Ur(e.method,e.url,e.urlParams,e.hash,Ste(e.headers,t),e.body)),Kr=_(2,(e,t)=>_re(e,`Accept`,t)),vre=Kr(`application/json`),yre=_(2,(e,t)=>{if(typeof t==`string`)return Ur(e.method,t,e.urlParams,e.hash,e.headers,e.body);let n=new URL(t.toString()),r=nte(n.searchParams),i=Wee(n.hash===``?void 0:n.hash.slice(1));return n.search=``,n.hash=``,Ur(e.method,n.toString(),r,i,e.headers,e.body)}),bre=_(2,(e,t)=>Ur(e.method,e.url,Nte(e.urlParams,t),e.hash,e.headers,e.body)),xre=_(2,(e,t)=>Ur(e.method,e.url,e.urlParams,v(t),e.headers,e.body)),qr=_(2,(e,t)=>{let n=e.headers;return t._tag===`Empty`||t._tag===`FormData`?n=Zt(Zt(n,`Content-Type`),`Content-length`):(t.contentType&&(n=bt(n,`content-type`,t.contentType)),t.contentLength!==void 0&&(n=bt(n,`content-length`,t.contentLength.toString()))),Ur(e.method,e.url,e.urlParams,e.hash,n,t)}),Sre=e=>Mt({b3:`${e.traceId}-${e.spanId}-${e.sampled?`1`:`0`}${ue(e.parent,{onNone:()=>``,onSome:e=>`-${e.spanId}`})}`,traceparent:`00-${e.traceId}-${e.spanId}-${e.sampled?`01`:`00`}`}),Jr=`~effect/http/HttpClient`,Yr=qe(`effect/HttpClient`),Xr=_(2,(e,t)=>Zr(n=>t(e.postprocess(n)),e.preprocess)),Cre=Xr(Ye(mte)),Zr=(e,t)=>{let n=Object.create(wre);return n.preprocess=t,n.postprocess=e,n.execute=function(n){return e(t(n))},n},wre={[Jr]:Jr,pipe(){return ke(this,arguments)},..._e,toJSON(){return{_id:`effect/HttpClient`}},...Object.fromEntries(dre.map(([e,t])=>[t,function(t,n){return this.execute(Wr(e)(t,n))}]))},Tre=e=>Zr(t=>Ye(t,t=>et(n=>{let i=kre.get(t),a=i??new AbortController,o=Ote(t.url,t.urlParams,m(t.hash));if(jee(o))return r(new qt({reason:new Ate({request:t,cause:o.failure})}));let s=o.success;if(n.getRef(Ke)||n.getRef(Qr)(t)){let r=e(t,s,a.signal,n);return i?r:Ze(e=>Te(e(r),{onSuccess(e){return ei.register(e,a),ze(new ti(e,a))},onFailure(e){return Je(e)&&a.abort(),Be(e)}}))}return yee(n.getRef(Dre)(t),{kind:`client`},r=>{r.attribute(`http.request.method`,t.method),r.attribute(`server.address`,s.origin),s.port!==``&&r.attribute(`server.port`,+s.port),r.attribute(`url.full`,s.toString()),r.attribute(`url.path`,s.pathname),r.attribute(`url.scheme`,s.protocol.slice(0,-1));let o=s.search.slice(1);o!==``&&r.attribute(`url.query`,o);let c=n.getRef(_te),l=xt(t.headers,c);for(let e in l)r.attribute(`http.request.header.${e}`,String(l[e]));return t=n.getRef($r)?Gr(t,Sre(r)):t,Ze(o=>o(e(t,s,a.signal,n)).pipe(qee(r,{captureStackTrace:!1}),Te({onSuccess:e=>{r.attribute(`http.response.status_code`,e.status);let t=xt(e.headers,c);for(let e in t)r.attribute(`http.response.header.${e}`,String(t[e]));return i?ze(e):(ei.register(e,a),ze(new ti(e,a)))},onFailure(e){return!i&&Je(e)&&a.abort(),Be(e)}})))})})),ze),Ere=_(2,(e,t)=>{let n=Ce(t),r=n?`errors-and-responses`:t.retryOn??`errors-and-responses`,i=n?t:t.schedule,o=i&&h(i),s=n?void 0:t.times;return Xr(e,E(r===`errors-only`?ae:ee({schedule:o,times:s,while:ri}),r===`response-only`?ae:D({while:n||t.while===void 0?ni:a(ni,t.while),schedule:i,times:s})))}),Qr=Le(`effect/http/HttpClient/TracerDisabledWhen`,{defaultValue:()=>Cee}),$r=Le(`effect/HttpClient/TracerPropagationEnabled`,{defaultValue:ce}),Dre=Le(`effect/http/HttpClient/SpanNameGenerator`,{defaultValue:()=>e=>`http.client ${e.method}`}),Ore=e=>We(Yr)(te(t=>Fe(e,e=>Xr(e,kee(e=>vee(t,e)))))),ei=(()=>{if(`FinalizationRegistry`in globalThis&&globalThis.FinalizationRegistry){let e=new FinalizationRegistry(e=>{e.abort()});return{register(t,n){e.register(t,n,t)},unregister(t){e.unregister(t)}}}let e=new Map;return{register(t,n){e.set(t,setTimeout(()=>n.abort(),5e3))},unregister(t){let n=e.get(t);n!==void 0&&(clearTimeout(n),e.delete(t))}}})(),kre=new WeakMap,ti=class{original;controller;constructor(e,t){this.original=e,this.controller=t}[St]=St;[dt]=dt;applyInterrupt(e){return Qe(()=>(ei.unregister(this.original),Eee(e,()=>Ue(()=>{this.controller.abort()}))))}get request(){return this.original.request}get status(){return this.original.status}get headers(){return this.original.headers}get cookies(){return this.original.cookies}get remoteAddress(){return this.original.remoteAddress}get formData(){return this.applyInterrupt(this.original.formData)}get text(){return this.applyInterrupt(this.original.text)}get json(){return this.applyInterrupt(this.original.json)}get urlParamsBody(){return this.applyInterrupt(this.original.urlParamsBody)}get arrayBuffer(){return this.applyInterrupt(this.original.arrayBuffer)}get stream(){return dee(()=>(ei.unregister(this.original),Iee(this.original.stream,Ue(()=>{this.controller.abort()}))))}toJSON(){return this.original.toJSON()}[Re](){return this.original[Re]()}pipe(){return ke(this,arguments)}},ni=e=>hee(e)||Are(e),Are=e=>Yt(e)&&(e.reason._tag===`TransportError`||e.reason._tag===`StatusCodeError`&&ri(e.reason.response)),ri=e=>e.status===408||e.status===429||e.status===500||e.status===502||e.status===503||e.status===504;function ii(e){return{id:e.id??`ws:${e.label}`,label:e.label,source:e.source??`manual`,target:e.target}}function jre(e){return e?.target.wsBaseUrl??null}function Mre(e){return e?.target.httpBaseUrl??null}function Nre(e,t){return{...e,environmentId:t.environmentId,label:t.label}}function Pre(e){return e.cloudMode?`cmmd-cloud-runtime`:`local-web`}function Fre(e){let t=Pre(e);return{topology:t,controlPlane:t!==`cmmd-cloud-runtime`,executionPlane:!0,workspaceProxy:!1}}function Ire(e){let t=e.topology===`cmmd-cloud-runtime`;return{cmmd:!0,ownerBootstrapPromotion:e.topology!==`cloud-shell`&&!t,bearerBootstrap:!0,desktopBootstrap:e.topology===`desktop-local`,providerCredentialBroker:e.topology===`cmmd-control-plane`}}function Lre(e){let t=e.executionPlane;return{agents:t,browser:t,github:t,terminal:t,providerEgress:e.topology===`cmmd-control-plane`}}function Rre(e,t){return{localProjects:t.executionPlane,cloudProjects:e.cloudMode}}function ai(e){let t=e.capabilities,n=t.runtime??Fre(t);return{repositoryIdentity:t.repositoryIdentity,pullRequests:t.pullRequests??!1,cloudMode:t.cloudMode,posthogPublicKey:t.posthogPublicKey,posthogHost:t.posthogHost,runtime:n,auth:t.auth??Ire(n),tools:t.tools??Lre(n),projects:t.projects??Rre(t,n)}}function zre(e){return e?ai(e).projects.cloudProjects:!1}function Bre(e){return e?ai(e).runtime.workspaceProxy??!1:!1}function oi(e,t){return{environmentId:e,projectId:t}}function si(e,t){return{environmentId:e,threadId:t}}var ci=`scoped:v1:`;function li(e){let t=`projectId`in e?e.projectId:e.threadId;return t.includes(`:`)||e.environmentId.startsWith(ci)?`${ci}${encodeURIComponent(e.environmentId)}:${encodeURIComponent(t)}`:`${e.environmentId}:${t}`}function ui(e){return li(e)}function di(e){return li(e)}function Vre(e){let t=e.slice(10),n=t.indexOf(`:`);if(n<=0||n>=t.length-1||t.indexOf(`:`,n+1)!==-1)return null;try{let e=decodeURIComponent(t.slice(0,n)),r=decodeURIComponent(t.slice(n+1));return e.length>0&&r.length>0?{environmentId:e,localId:r}:null}catch{return null}}function fi(e){if(e.startsWith(ci))return Vre(e);let t=e.lastIndexOf(`:`);return t<=0||t>=e.length-1?null:{environmentId:e.slice(0,t),localId:e.slice(t+1)}}function pi(e){let t=fi(e);return t?{environmentId:t.environmentId,projectId:t.localId}:null}function mi(e){let t=fi(e);return t?{environmentId:t.environmentId,threadId:t.localId}:null}var hi=`~effect/ManagedRuntime`,gi=(e,t)=>{let n=t?.memoMap??de(),r=iee(`parallel`),i=C(r,`sequential`),a={onFiberStart:ie(r)},s=e=>e?{...e,onFiberStart:e.onFiberStart?t=>{a.onFiberStart(t),e.onFiberStart(t)}:a.onFiberStart}:a,c,l=et(t=>(c||=d(pee(o(e,n,i),e=>Ue(()=>{u.cachedContext=e})),{...a,scheduler:t.currentScheduler}),See(se(c)))),u={[hi]:hi,memoMap:n,scope:r,contextEffect:l,cachedContext:void 0,context(){return u.cachedContext===void 0?T(u.contextEffect):Promise.resolve(u.cachedContext)},dispose(){return T(u.disposeEffect)},disposeEffect:Qe(()=>(u.contextEffect=see(`ManagedRuntime disposed`),u.cachedContext=void 0,Ae(u.scope,Xe))),runFork(e,t){return u.cachedContext===void 0?d(_i(u,e),s(t)):Me(u.cachedContext)(e,s(t))},runCallback(e,t){return u.cachedContext===void 0?be(_i(u,e),s(t)):Xee(u.cachedContext)(e,s(t))},runSyncExit(e){return u.cachedContext===void 0?Fee(_i(u,e)):ne(u.cachedContext)(e)},runSync(e){return u.cachedContext===void 0?re(_i(u,e)):cee(u.cachedContext)(e)},runPromiseExit(e,t){return u.cachedContext===void 0?eee(_i(u,e),s(t)):oee(u.cachedContext)(e,s(t))},runPromise(e,t){return u.cachedContext===void 0?T(_i(u,e),s(t)):x(u.cachedContext)(e,s(t))}};return u};function _i(e,t){return Ye(e.contextEffect,e=>fe(t,e))}var vi={accept:!1,observe:!1,missingFrameCount:0,startsNewStream:!1};function yi(e){let t=e===!0;return{accept:t,observe:t,missingFrameCount:0,startsNewStream:t}}function Hre(e,t){let n=e.streamGeneration===void 0&&e.streamId===void 0,r=t.streamGeneration!==void 0||t.streamId!==void 0;return n&&r?yi(t.keyframe):null}function Ure(e,t){return e.streamGeneration===void 0||t.streamGeneration===void 0?null:t.streamGeneration<e.streamGeneration?vi:t.streamGeneration>e.streamGeneration?yi(t.keyframe):null}function Wre(e,t){if(!e.streamId||!t.streamId)return null;if(e.streamId!==t.streamId)return yi(t.keyframe);if(t.sequence<=e.observedSequence)return vi;let n=Math.max(0,t.sequence-e.observedSequence-1);return{accept:n===0||t.keyframe===!0,observe:!0,missingFrameCount:n,startsNewStream:!1}}function Gre(e,t){if(t.sequence>e.acceptedSequence)return{accept:!0,observe:!0,missingFrameCount:0,startsNewStream:!1};if(!e.acceptedCapturedAt)return vi;let n=Date.parse(e.acceptedCapturedAt),r=Date.parse(t.capturedAt);return Number.isNaN(n)||Number.isNaN(r)||r<=n?vi:{accept:!0,observe:!0,missingFrameCount:0,startsNewStream:!1}}function Kre(e,t){return Hre(e,t)??Ure(e,t)??Wre(e,t)??Gre(e,t)}function qre(e,t){let n=Kre(e,t);if(!n.observe)return{accept:n.accept,observe:n.observe,missingFrameCount:n.missingFrameCount,state:e};let r=n.startsNewStream?t.sequence:Math.max(e.observedSequence,t.sequence),i={...e,observedSequence:r,gapCount:e.gapCount+n.missingFrameCount},a=n.accept?{...i,acceptedSequence:t.sequence,acceptedCapturedAt:t.capturedAt,...t.streamId?{streamId:t.streamId}:{},...t.streamGeneration===void 0?{}:{streamGeneration:t.streamGeneration}}:i;return{accept:n.accept,observe:n.observe,missingFrameCount:n.missingFrameCount,state:a}}var bi=S();function Jre(e){return e.stageLabel.trim().toLowerCase()===`latest`?e.baseName:`${e.baseName} (${e.stageLabel})`}var xi=`Forge`,Si=``,Ci=Si===`latest`||Si===`nightly`?Si:null,wi=Ci===`nightly`?`Nightly`:Ci===`latest`?`Latest`:null,Ti=wi??`Alpha`,Ei=wi?Jre({baseName:xi,stageLabel:Ti}):xi,Di=`0.13.4`,Oi=ct(`forge-app-top-bar drag-region @container/header-actions relative z-20 w-full min-w-0 shrink-0 bg-background`,`grid grid-cols-[minmax(0,1fr)_minmax(0,auto)] items-center`),ki=`flex h-full min-w-0 items-center gap-1 md:gap-1.5`,Ai=`flex h-touch min-w-0 max-w-full touch-manipulation items-center justify-center rounded-lg px-3 text-foreground transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring md:h-7 md:px-2`,Yre={width:`calc(100% - var(--forge-right-panel-reserved-width, 0px))`},Xre=`forge-app-shell flex w-full min-w-0 flex-row`,ji=`forge-app-shell flex w-full min-w-0 flex-col`,Zre=`flex min-h-0 min-w-0 flex-1 flex-col`,Qre=`relative flex h-[var(--forge-content-height)] min-h-0 min-w-0 flex-1 overflow-hidden`;function Mi(e){let t=(0,bi.c)(19),{showStageBadge:n,tone:r,variant:i}=e,a=n!==void 0&&n,o=r===void 0?`default`:r,s=(i===void 0?`default`:i)===`auth`,c=s?20:16,l=s?`h-5 w-5 shrink-0`:`h-4 w-4 shrink-0`,u;t[0]!==c||t[1]!==l?(u=(0,N.jsx)(`img`,{className:l,src:`/forge-mark.svg`,width:c,height:c,alt:``,"aria-hidden":`true`}),t[0]=c,t[1]=l,t[2]=u):u=t[2];let d=u,f=s?`text-[15px] sm:text-base`:`text-sm`,p=o===`on-dark`?`text-primary-foreground`:`text-foreground`,m;t[3]!==f||t[4]!==p?(m=ct(`truncate font-semibold tracking-tight`,f,p),t[3]=f,t[4]=p,t[5]=m):m=t[5];let h;t[6]===m?h=t[7]:(h=(0,N.jsx)(`span`,{className:m,children:xi}),t[6]=m,t[7]=h);let g=h,_=s?`rounded-full bg-muted/50 px-2 py-0.5 text-[9px] leading-none font-medium tracking-[0.14em] text-muted-foreground/70 uppercase [text-indent:0.14em]`:`rounded-full bg-muted/50 px-1.5 py-0.5 text-[8px] leading-none font-medium tracking-[0.18em] text-muted-foreground/60 uppercase [text-indent:0.18em]`,v;t[8]===_?v=t[9]:(v=(0,N.jsx)(`span`,{className:_,children:Ti}),t[8]=_,t[9]=v);let y=v;if(a){let e;t[10]!==d||t[11]!==g?(e=(0,N.jsxs)(`span`,{className:`flex items-center gap-2`,children:[d,g]}),t[10]=d,t[11]=g,t[12]=e):e=t[12];let n;return t[13]!==y||t[14]!==e?(n=(0,N.jsxs)(`div`,{className:`flex items-center gap-1.5 rounded-md`,"aria-label":Ei,children:[e,y]}),t[13]=y,t[14]=e,t[15]=n):n=t[15],n}let b;return t[16]!==d||t[17]!==g?(b=(0,N.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5`,"aria-label":Ei,children:[d,g]}),t[16]=d,t[17]=g,t[18]=b):b=t[18],b}function Ni(e){let t=(0,bi.c)(5),{className:n}=e,r;t[0]===n?r=t[1]:(r=ct(`pointer-events-none flex select-none items-center`,n),t[0]=n,t[1]=r);let i;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,N.jsx)(Mi,{}),t[2]=i):i=t[2];let a;return t[3]===r?a=t[4]:(a=(0,N.jsx)(`div`,{className:r,children:i}),t[3]=r,t[4]=a),a}function $re(){let e=new Map;return{clear:()=>e.clear(),getItem:t=>e.get(t)??null,key:t=>Array.from(e.keys()).at(t)??null,get length(){return e.size},removeItem:t=>e.delete(t),setItem:(t,n)=>e.set(t,n)}}var Pi=typeof window<`u`?window.localStorage:$re(),eie=(e,t)=>gte(Ct(e))(t),tie=(e,t)=>jte(Ct(e))(t),Fi=(e,t)=>{let n=Pi.getItem(e);return n?eie(t,n):null},Ii=(e,t,n)=>{let r=tie(n,t);Pi.setItem(e,r)},Li=e=>{Pi.removeItem(e)},Ri=`forge:local_storage_change`;function nie(e){typeof window>`u`||window.dispatchEvent(new CustomEvent(Ri,{detail:{key:e}}))}function zi(e,t,n){let[r,i]=(0,M.useState)(()=>{try{return Fi(e,n)??t}catch(e){return console.error(`[LOCALSTORAGE] Error:`,e),t}}),a=(0,M.useCallback)(t=>{i(r=>{try{let i=typeof t==`function`?t(r):t;return i===null?Li(e):Ii(e,i,n),queueMicrotask(()=>nie(e)),i}catch(e){return console.error(`[LOCALSTORAGE] Error:`,e),r}})},[e,n]),o=(0,M.useRef)(e);return(0,M.useEffect)(()=>{if(o.current!==e){o.current=e;try{let r=Fi(e,n);i(r??t)}catch(e){console.error(`[LOCALSTORAGE] Error:`,e)}}},[e,t,n]),(0,M.useEffect)(()=>{let r=()=>{try{let r=Fi(e,n);i(r??t)}catch(e){console.error(`[LOCALSTORAGE] Error:`,e)}},a=t=>{t.key===e&&r()},o=t=>{t.detail.key===e&&r()};return window.addEventListener(`storage`,a),window.addEventListener(Ri,o),()=>{window.removeEventListener(`storage`,a),window.removeEventListener(Ri,o)}},[e,t,n]),[r,a]}var Bi=`cmmd-runtime:`;function Vi(e){return`${Bi}${e}`}var rie=/^env_[0-9a-f]{32}$/,iie=/^[A-Za-z0-9][A-Za-z0-9._-]*$/,Hi={shape:`local`,isCloud:!1,legacyRuntimeId:null},aie={shape:`cloud-project-placeholder`,isCloud:!0,legacyRuntimeId:null},oie={shape:`durable-environment`,isCloud:!0,legacyRuntimeId:null};function Ui(e){if(typeof e!=`string`)return Hi;if(e.startsWith(`cmmd-runtime:`)){let t=e.slice(Bi.length);return iie.test(t)?{shape:`legacy-runtime`,isCloud:!0,legacyRuntimeId:t}:Hi}return e.startsWith(`cmmd-cloud-project:`)?aie:rie.test(e)?oie:Hi}var Wi=`forge:client-settings:v1`,sie=`forge:saved-environment-registry:v1`,cie=on({environmentId:Et,label:k,httpBaseUrl:k,wsBaseUrl:k,createdAt:k,lastConnectedAt:Ht(k),cmmdOrganizationId:yt(k),cmmdProjectId:yt(k),runtimeId:yt(k),runtimeTicketExpiresAt:yt(k),lastAuthenticatedPullRequestCapability:yt(It),bearerToken:yt(k)}),Gi=on({version:yt(Bt),records:yt($t(cie))});function Ki(){return typeof window<`u`}var lie={uiFontSize:14,codeFontSize:15},uie=[[`uiFontSize`,11,20],[`codeFontSize`,11,20]];function die(e){return e.defaultThreadRuntime===`desktop-cloud-bridge`?{...e,defaultThreadRuntime:`cloud`}:null}function fie(e){if(typeof e.fontDefaultsVersion==`number`)return null;let t=Object.entries(lie).filter(([t,n])=>e[t]===n);if(t.length===0)return null;let n={...e};for(let[e]of t)delete n[e];return n}function pie(e){let t=uie.flatMap(([t,n,r])=>{let i=e[t];if(typeof i!=`number`||!Number.isFinite(i))return[];let a=Math.min(r,Math.max(n,Math.round(i)));return a===i?[]:[[t,a]]});if(t.length===0)return null;let n={...e};for(let[e,r]of t)n[e]=r;return n}function qi(e){if(!e||typeof e!=`object`)return e;let t=e,n=!1;for(let e of[die,fie,pie]){let r=e(t);r!==null&&(t=r,n=!0)}return n?t:e}function mie(){if(!Ki())return null;try{let e=window.localStorage.getItem(Wi);return e?Gt(tn)(qi(JSON.parse(e))):null}catch{return null}}function hie(e){Ki()&&Ii(Wi,e,tn)}function Ji(){if(!Ki())return{};try{return Fi(`forge:saved-environment-registry:v1`,Gi)??{}}catch{return{}}}function Yi(e){Ki()&&Ii(sie,e,Gi)}function Xi(){return Ji().records??[]}function gie(e){Yi({version:1,records:e})}function _ie(){return Xi().map(e=>vt(e))}function vie(e){let t=new Map(Xi().map(e=>[e.environmentId,e]));gie(e.map(e=>{let n=Ui(e.environmentId).legacyRuntimeId===null?t.get(e.environmentId)?.bearerToken:void 0;return n?{...vt(e),bearerToken:n}:vt(e)}))}function yie(e){return Xi().find(t=>t.environmentId===e)?.bearerToken??null}function bie(e,t){let n=Ji(),r=n.records??[],i=!1;return Yi({version:n.version??1,records:r.map(n=>n.environmentId===e?(i=!0,Object.assign(vt(n),{bearerToken:t})):n)}),i}function xie(e){let t=Ji();Yi({version:t.version??1,records:(t.records??[]).map(t=>t.environmentId===e?vt(t):t)})}var Sie=Gt(tn);function Cie(){return typeof window>`u`?void 0:window.desktopBridge}function Zi(e){let t=Cie(),n=t?.[e];return typeof n==`function`?n.bind(t):null}async function Qi(){let e=Zi(`getClientSettings`);if(e){let t=await e();return t?Sie(t):null}return mie()}async function $i(e){let t=Zi(`setClientSettings`);if(t)return t(e);hie(e)}async function ea(){let e=Zi(`getSavedEnvironmentRegistry`);return e?e():_ie()}async function ta(e){let t=Zi(`setSavedEnvironmentRegistry`);if(t)return t(e);vie(e)}async function na(e){let t=Zi(`getSavedEnvironmentSecret`);return t?t(e):yie(e)}async function ra(e,t){let n=Zi(`setSavedEnvironmentSecret`);return n?n(e,t):bie(e,t)}async function ia(e){let t=Zi(`removeSavedEnvironmentSecret`);if(t)return t(e);xie(e)}var aa=`token`;function oa(e){return new URLSearchParams(e.hash.startsWith(`#`)?e.hash.slice(1):e.hash)}function sa(e){let t=oa(e).get(aa)?.trim()??``;if(t.length>0)return t;let n=e.searchParams.get(aa)?.trim()??``;return n.length>0?n:null}function wie(e){let t=new URL(e.toString()),n=oa(t);return n.has(aa)&&(n.delete(aa),t.hash=n.toString()),t.searchParams.delete(aa),t}function ca(e,t){let n=new URL(e.toString());return n.searchParams.delete(aa),n.hash=new URLSearchParams([[aa,t]]).toString(),n}function Tie(e,t){let n=new URL(e);return n.pathname=`/login`,ca(n,t).toString()}function Eie(e){return ca(new URL(`/login`,window.location.href),e).toString()}var Die=`host`;function Oie(e){let t=new URL(e),n=sa(t),r=new URL(`forge:///pair`);return r.searchParams.set(Die,t.origin),n&&r.searchParams.set(aa,n),r.toString()}function kie(e){return{_tag:`Value`,value:e}}function Aie(e,t){return{_tag:`Record`,keys:e,value:t}}function jie(e,t){return{_tag:`Array`,length:e,value:t}}Rt(`SourceError`);var Mie=Le(`effect/ConfigProvider`,{defaultValue:()=>Fie()}),Nie={...Ne,toJSON(){return{_id:`ConfigProvider`}}};function Pie(e,t,n){let r=Object.create(Nie);return r.get=e,r.mapInput=t,r.prefix=n,r.load=r=>(t&&(r=t(r)),n&&(r=[...n,...r]),e(r)),r}function Fie(e){let t=e?.env??{APP_VERSION:`0.13.4`,BASE_URL:`/`,DEV:!1,MODE:`production`,PROD:!0,SSR:!1,TSS_INLINE_CSS_ENABLED:`false`,VITE_COMMIT_SHA:``,VITE_HOSTED_APP_CHANNEL:``,VITE_HTTP_URL:``,VITE_SENTRY_COMMIT_SHA:`c1966e8e386db52c6da92563f72d10bed783d57a`,VITE_SENTRY_DEBUG:``,VITE_SENTRY_DSN:``,VITE_SENTRY_ENABLED:``,VITE_SENTRY_ENVIRONMENT:`production`,VITE_SENTRY_PROFILES_SAMPLE_RATE:``,VITE_SENTRY_RELEASE:`forge-web@0.13.4+c1966e8e386db52c6da92563f72d10bed783d57a`,VITE_SENTRY_REPLAYS_ON_ERROR_SAMPLE_RATE:``,VITE_SENTRY_REPLAYS_SESSION_SAMPLE_RATE:``,VITE_SENTRY_TRACES_SAMPLE_RATE:``,VITE_WS_URL:``},n=Iie(t);return Pie(e=>ze(Rie(n,t,e)))}function Iie(e){let t={};for(let[n,r]of Object.entries(e)){if(r===void 0)continue;let e=n.split(`_`),i=t;for(let t of e)i.children??={},i=i.children[t]??={};i.value=r}return t}var Lie=/^(0|[1-9][0-9]*)$/;function Rie(e,t,n){let r=t[n.map(String).join(`_`)],i=zie(e,n),a=i?.children?Object.keys(i.children):[];return a.length===0?r===void 0?void 0:kie(r):a.every(e=>Lie.test(e))?jie(Math.max(...a.map(e=>parseInt(e,10)))+1,r):Aie(new Set(a),r)}function zie(e,t){if(t.length===0)return e;let n=e;for(let e of t)if(n=n?.children?.[String(e)],!n)return;return n}var la=`~effect/Config`,Bie=class{_tag=`ConfigError`;name=`ConfigError`;cause;constructor(e){this.cause=e}get message(){return this.cause.toString()}toString(){return`ConfigError(${this.message})`}},Vie={...Ne,...uee,[la]:la,asEffect(){return Ye(Mie.asEffect(),e=>this.parse(e))},toJSON(){return{_id:`Config`}}};function Hie(e){let t=Object.create(Vie);return t.parse=e,t}var ua=Pe(function*(e,t){let n=yield*e.load(t);if(n!==void 0)switch(n._tag){case`Value`:return n.value;case`Record`:{if(n.value!==void 0)return n.value;let r={};for(let i of n.keys){let n=yield*ua(e,[...t,i]);n!==void 0&&(r[i]=n)}return r}case`Array`:{if(n.value!==void 0)return n.value;let r=[];for(let i=0;i<n.length;i++)r.push(yield*ua(e,[...t,i]));return r}}}),da=Pe(function*(e,t,n){switch(e._tag){case`Objects`:{let r={};for(let i of e.propertySignatures){let e=i.name;if(typeof e==`string`){let a=yield*da(i.type,t,[...n,e]);a!==void 0&&(r[e]=a)}}if(e.indexSignatures.length>0){let i=yield*t.load(n);if(i&&i._tag===`Record`)for(let a of e.indexSignatures){let e=ote(a.parameter);for(let o of i.keys)if(!Object.hasOwn(r,o)&&e(o)){let e=yield*da(a.type,t,[...n,o]);e!==void 0&&(r[o]=e)}}}return r}case`Arrays`:{let r=yield*t.load(n);if(r&&r._tag===`Value`)return r.value;let i=[];for(let r=0;r<e.elements.length;r++)i.push(yield*da(e.elements[r],t,[...n,r]));return i}case`Union`:return yield*ua(t,n);case`Suspend`:return yield*da(e.thunk(),t,n);default:{let e=yield*t.load(n);return e===void 0?void 0:e._tag===`Value`||e._tag===`Record`&&e.value!==void 0||e._tag===`Array`&&e.value!==void 0?e.value:void 0}}});function fa(e,t){let n=sn(e),r=kt(n),i=ate(n.ast),a=typeof t==`string`?[t]:t??[];return Hie(e=>{let t=e.prefix?[...e.prefix,...a]:a;return da(i,e,a).pipe(Ree(e=>r(e).pipe(tt(e=>new jt(t.length>0?new xte(t,e):e)))),tt(e=>new Bie(e)))})}var Uie=(e,t,n)=>{let r=Pt(e,t),i=k.pipe(mt(Pt(k,k),lte(n)),mt(r));return hte([r,i])},P=typeof __SENTRY_DEBUG__>`u`||__SENTRY_DEBUG__,F=globalThis,pa=`10.74.0`;function ma(){return ha(F),F}function ha(e){let t=e.__SENTRY__=e.__SENTRY__||{};return t.version=t.version||`10.74.0`,t[pa]=t[`10.74.0`]||{}}function ga(e,t,n=F){let r=n.__SENTRY__=n.__SENTRY__||{},i=r[pa]=r[`10.74.0`]||{};return i[e]||(i[e]=t())}var _a=[`debug`,`info`,`warn`,`error`,`log`,`assert`,`trace`],Wie=`Sentry Logger `,va={};function ya(e){if(!(`console`in F))return e();let t=F.console,n={},r=Object.keys(va);r.forEach(e=>{let r=va[e];n[e]=t[e],t[e]=r});try{return e()}finally{r.forEach(e=>{t[e]=n[e]})}}function Gie(){Sa().enabled=!0}function Kie(){Sa().enabled=!1}function ba(){return Sa().enabled}function qie(...e){xa(`log`,...e)}function Jie(...e){xa(`warn`,...e)}function Yie(...e){xa(`error`,...e)}function xa(e,...t){P&&ba()&&ya(()=>{F.console[e](`${Wie}[${e}]:`,...t)})}function Sa(){return P?ga(`loggerSettings`,()=>({enabled:!1})):{enabled:!1}}var I={enable:Gie,disable:Kie,isEnabled:ba,log:qie,warn:Jie,error:Yie},Ca=50,wa=/\(error: (.*)\)/,Ta=/captureMessage|captureException/;function Ea(...e){let t=e.sort((e,t)=>e[0]-t[0]).map(e=>e[1]);return(e,n=0,r=0)=>{let i=[],a=e.split(`
3
3
  `);for(let e=n;e<a.length;e++){let n=a[e];n.length>1024&&(n=n.slice(0,1024));let o=wa.test(n)?n.replace(wa,`$1`):n;if(!o.includes(`Error: `)){for(let e of t){let t=e(o);if(t){i.push(t);break}}if(i.length>=Ca+r)break}}return Zie(i.slice(r))}}function Xie(e){return Array.isArray(e)?Ea(...e):e}function Zie(e){if(!e.length)return[];let t=Array.from(e);return/sentryWrapped/.test(Da(t).function||``)&&t.pop(),t.reverse(),Ta.test(Da(t).function||``)&&(t.pop(),Ta.test(Da(t).function||``)&&t.pop()),t.slice(0,Ca).map(e=>({...e,filename:e.filename||Da(t).filename,function:e.function||`?`}))}function Da(e){return e[e.length-1]||{}}var Oa=`<anonymous>`;function ka(e){try{return!e||typeof e!=`function`?Oa:e.name||Oa}catch{return Oa}}function Aa(e){let t=e.exception;if(t){let e=[];try{return t.values.forEach(t=>{t.stacktrace.frames&&e.push(...t.stacktrace.frames)}),e}catch{return}}}function Qie(e){let t=e?.startsWith(`file://`)?e.slice(7):e;return t?.match(/\/[A-Z]:/)&&(t=t.slice(1)),t}var ja={},Ma={};function Na(e,t){return ja[e]=ja[e]||[],ja[e].push(t),()=>{let n=ja[e];if(n){let e=n.indexOf(t);e!==-1&&n.splice(e,1)}}}function Pa(e,t){if(!Ma[e]){Ma[e]=!0;try{t()}catch(t){P&&I.error(`Error while instrumenting ${e}`,t)}}}function Fa(e,t){let n=e&&ja[e];if(n)for(let r of n)try{r(t)}catch(t){P&&I.error(`Error while triggering instrumentation handler.
4
4
  Type: ${e}
5
5
  Name: ${ka(r)}
@@ -1002,7 +1002,7 @@ or you can use record.mirror to access the mirror instance during recording.`,zz
1002
1002
  now you can use replayer.getMirror() to access the mirror instance of a replayer,\r
1003
1003
  or you can use record.mirror to access the mirror instance during recording.`,ZV={map:{},getId(){return console.error(XV),-1},getNode(){return console.error(XV),null},removeNodeFromMap(){console.error(XV)},has(){return console.error(XV),!1},reset(){console.error(XV)}};typeof window<`u`&&window.Proxy&&window.Reflect&&(ZV=new Proxy(ZV,{get(e,t,n){return t===`map`&&console.error(XV),Reflect.get(e,t,n)}}));function QV(e,t,n,r,i=window){let a=i.Object.getOwnPropertyDescriptor(e,t);return i.Object.defineProperty(e,t,r?n:{set(e){iH(()=>{n.set.call(this,e)},0),a&&a.set&&a.set.call(this,e)}}),()=>QV(e,t,a||{},!0)}function $V(e,t,n){try{if(!(t in e))return()=>{};let r=e[t],i=n(r);return typeof i==`function`&&(i.prototype=i.prototype||{},Object.defineProperties(i,{__rrweb_original__:{enumerable:!1,value:r}})),e[t]=i,()=>{e[t]=r}}catch{return()=>{}}}Date.now().toString();function nLe(e){if(!e)return null;try{return e.nodeType===e.ELEMENT_NODE?e:e.parentElement}catch{return null}}function eH(e,t,n,r,i){if(!e)return!1;let a=nLe(e);if(!a)return!1;let o=YV(t,n);if(!i){let e=r&&a.matches(r);return o(a)&&!e}let s=JV(a,o),c=-1;return s<0?!1:(r&&(c=JV(a,YV(null,r))),s>-1&&c<0||s<c)}var tH={};function nH(e){let t=tH[e];if(t)return t;let n=window.document,r=window[e];if(n&&typeof n.createElement==`function`)try{let t=n.createElement(`iframe`);t.hidden=!0,n.head.appendChild(t);let i=t.contentWindow;i&&i[e]&&(r=i[e]),n.head.removeChild(t)}catch{}return tH[e]=r.bind(window)}function rH(...e){return nH(`requestAnimationFrame`)(...e)}function iH(...e){return nH(`setTimeout`)(...e)}var aH=(e=>(e[e[`2D`]=0]=`2D`,e[e.WebGL=1]=`WebGL`,e[e.WebGL2=2]=`WebGL2`,e))(aH||{}),oH;function rLe(e){oH=e}for(var sH=e=>oH?((...t)=>{try{return e(...t)}catch(e){if(oH&&oH(e)===!0)return()=>{};throw e}}):e,cH=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`,iLe=typeof Uint8Array>`u`?[]:new Uint8Array(256),lH=0;lH<cH.length;lH++)iLe[cH.charCodeAt(lH)]=lH;var aLe=function(e){var t=new Uint8Array(e),n,r=t.length,i=``;for(n=0;n<r;n+=3)i+=cH[t[n]>>2],i+=cH[(t[n]&3)<<4|t[n+1]>>4],i+=cH[(t[n+1]&15)<<2|t[n+2]>>6],i+=cH[t[n+2]&63];return r%3==2?i=i.substring(0,i.length-1)+`=`:r%3==1&&(i=i.substring(0,i.length-2)+`==`),i},uH=new Map;function oLe(e,t){let n=uH.get(e);return n||(n=new Map,uH.set(e,n)),n.has(t)||n.set(t,[]),n.get(t)}var dH=(e,t,n)=>{if(!e||!(mH(e,t)||typeof e==`object`))return;let r=e.constructor.name,i=oLe(n,r),a=i.indexOf(e);return a===-1&&(a=i.length,i.push(e)),a};function fH(e,t,n){if(e instanceof Array)return e.map(e=>fH(e,t,n));if(e===null)return e;if(e instanceof Float32Array||e instanceof Float64Array||e instanceof Int32Array||e instanceof Uint32Array||e instanceof Uint8Array||e instanceof Uint16Array||e instanceof Int16Array||e instanceof Int8Array||e instanceof Uint8ClampedArray)return{rr_type:e.constructor.name,args:[Object.values(e)]};if(e instanceof ArrayBuffer)return{rr_type:e.constructor.name,base64:aLe(e)};if(e instanceof DataView)return{rr_type:e.constructor.name,args:[fH(e.buffer,t,n),e.byteOffset,e.byteLength]};if(e instanceof HTMLImageElement){let t=e.constructor.name,{src:n}=e;return{rr_type:t,src:n}}return e instanceof HTMLCanvasElement?{rr_type:`HTMLImageElement`,src:e.toDataURL()}:e instanceof ImageData?{rr_type:e.constructor.name,args:[fH(e.data,t,n),e.width,e.height]}:mH(e,t)||typeof e==`object`?{rr_type:e.constructor.name,index:dH(e,t,n)}:e}var pH=(e,t,n)=>e.map(e=>fH(e,t,n)),mH=(e,t)=>!![`WebGLActiveInfo`,`WebGLBuffer`,`WebGLFramebuffer`,`WebGLProgram`,`WebGLRenderbuffer`,`WebGLShader`,`WebGLShaderPrecisionFormat`,`WebGLTexture`,`WebGLUniformLocation`,`WebGLVertexArrayObject`,`WebGLVertexArrayObjectOES`].filter(e=>typeof t[e]==`function`).find(n=>e instanceof t[n]);function sLe(e,t,n,r,i){let a=[],o=Object.getOwnPropertyNames(t.CanvasRenderingContext2D.prototype);for(let s of o)try{if(typeof t.CanvasRenderingContext2D.prototype[s]!=`function`)continue;let o=$V(t.CanvasRenderingContext2D.prototype,s,function(a){return function(...o){return eH(this.canvas,n,r,i,!0)||iH(()=>{let n=pH(o,t,this);e(this.canvas,{type:aH[`2D`],property:s,args:n})},0),a.apply(this,o)}});a.push(o)}catch{let n=QV(t.CanvasRenderingContext2D.prototype,s,{set(t){e(this.canvas,{type:aH[`2D`],property:s,args:[t],setter:!0})}});a.push(n)}return()=>{a.forEach(e=>e())}}function cLe(e){return e===`experimental-webgl`?`webgl`:e}function hH(e,t,n,r,i){let a=[];try{let o=$V(e.HTMLCanvasElement.prototype,`getContext`,function(e){return function(a,...o){if(!eH(this,t,n,r,!0)){let e=cLe(a);if(`__context`in this||(this.__context=e),i&&[`webgl`,`webgl2`].includes(e))if(o[0]&&typeof o[0]==`object`){let e=o[0];e.preserveDrawingBuffer||=!0}else o.splice(0,1,{preserveDrawingBuffer:!0})}return e.apply(this,[a,...o])}});a.push(o)}catch{console.error(`failed to patch HTMLCanvasElement.prototype.getContext`)}return()=>{a.forEach(e=>e())}}function gH(e,t,n,r,i,a,o,s){let c=[],l=Object.getOwnPropertyNames(e);for(let o of l)if(![`isContextLost`,`canvas`,`drawingBufferWidth`,`drawingBufferHeight`].includes(o))try{if(typeof e[o]!=`function`)continue;let l=$V(e,o,function(e){return function(...c){let l=e.apply(this,c);if(dH(l,s,this),`tagName`in this.canvas&&!eH(this.canvas,r,i,a,!0)){let e=pH(c,s,this),r={type:t,property:o,args:e};n(this.canvas,r)}return l}});c.push(l)}catch{let r=QV(e,o,{set(e){n(this.canvas,{type:t,property:o,args:[e],setter:!0})}});c.push(r)}return c}function lLe(e,t,n,r,i,a){let o=[];return o.push(...gH(t.WebGLRenderingContext.prototype,aH.WebGL,e,n,r,i,a,t)),t.WebGL2RenderingContext!==void 0&&o.push(...gH(t.WebGL2RenderingContext.prototype,aH.WebGL2,e,n,r,i,a,t)),()=>{o.forEach(e=>e())}}var uLe=`for(var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",t="undefined"==typeof Uint8Array?[]:new Uint8Array(256),a=0;a<64;a++)t[e.charCodeAt(a)]=a;var n=function(t){var a,n=new Uint8Array(t),r=n.length,s="";for(a=0;a<r;a+=3)s+=e[n[a]>>2],s+=e[(3&n[a])<<4|n[a+1]>>4],s+=e[(15&n[a+1])<<2|n[a+2]>>6],s+=e[63&n[a+2]];return r%3==2?s=s.substring(0,s.length-1)+"=":r%3==1&&(s=s.substring(0,s.length-2)+"=="),s};const r=new Map,s=new Map;const i=self;i.onmessage=async function(e){if(!("OffscreenCanvas"in globalThis))return i.postMessage({id:e.data.id});{const{id:t,bitmap:a,width:o,height:f,maxCanvasSize:c,dataURLOptions:g}=e.data,u=async function(e,t,a){const r=e+"-"+t;if("OffscreenCanvas"in globalThis){if(s.has(r))return s.get(r);const i=new OffscreenCanvas(e,t);i.getContext("2d");const o=await i.convertToBlob(a),f=await o.arrayBuffer(),c=n(f);return s.set(r,c),c}return""}(o,f,g),[h,d]=function(e,t,a){if(!a)return[e,t];const[n,r]=a;if(e<=n&&t<=r)return[e,t];let s=e,i=t;return s>n&&(i=Math.floor(n*t/e),s=n),i>r&&(s=Math.floor(r*e/t),i=r),[s,i]}(o,f,c),l=new OffscreenCanvas(h,d),w=l.getContext("bitmaprenderer"),p=h===o&&d===f?a:await createImageBitmap(a,{resizeWidth:h,resizeHeight:d,resizeQuality:"low"});w?.transferFromImageBitmap(p),a.close();const y=await l.convertToBlob(g),v=y.type,b=await y.arrayBuffer(),m=n(b);if(p.close(),!r.has(t)&&await u===m)return r.set(t,m),i.postMessage({id:t});if(r.get(t)===m)return i.postMessage({id:t});i.postMessage({id:t,type:v,base64:m,width:o,height:f}),r.set(t,m)}};`;function dLe(){let e=new Blob([uLe]);return URL.createObjectURL(e)}var fLe=class{constructor(e){this.pendingCanvasMutations=new Map,this.rafStamps={latestId:0,invokeId:null},this.shadowDoms=new Set,this.windowsSet=new WeakSet,this.windows=[],this.restoreHandlers=[],this.frozen=!1,this.locked=!1,this.snapshotInProgressMap=new Map,this.worker=null,this.lastSnapshotTime=0,this.processMutation=(e,t)=>{(this.rafStamps.invokeId&&this.rafStamps.latestId!==this.rafStamps.invokeId||!this.rafStamps.invokeId)&&(this.rafStamps.invokeId=this.rafStamps.latestId),this.pendingCanvasMutations.has(e)||this.pendingCanvasMutations.set(e,[]),this.pendingCanvasMutations.get(e).push(t)};let{enableManualSnapshot:t,sampling:n=`all`,win:r,recordCanvas:i,errorHandler:a}=e;e.sampling=n,this.mutationCb=e.mutationCb,this.mirror=e.mirror,this.options=e,a&&rLe(a),(i&&typeof n==`number`||t)&&(this.worker=this.initFPSWorker()),this.addWindow(r),!t&&sH(()=>{i&&n===`all`&&(this.startRAFTimestamping(),this.startPendingCanvasMutationFlusher()),i&&typeof n==`number`&&this.initCanvasFPSObserver()})()}reset(){this.pendingCanvasMutations.clear(),this.restoreHandlers.forEach(e=>{try{e()}catch{}}),this.restoreHandlers=[],this.windowsSet=new WeakSet,this.windows=[],this.shadowDoms=new Set,this.worker?.terminate(),this.worker=null,this.snapshotInProgressMap=new Map}freeze(){this.frozen=!0}unfreeze(){this.frozen=!1}lock(){this.locked=!0}unlock(){this.locked=!1}addWindow(e){let{sampling:t=`all`,blockClass:n,blockSelector:r,unblockSelector:i,recordCanvas:a,enableManualSnapshot:o}=this.options;if(!this.windowsSet.has(e)){if(o){this.windowsSet.add(e),this.windows.push(new WeakRef(e));return}sH(()=>{if(a&&t===`all`&&this.initCanvasMutationObserver(e,n,r,i),a&&typeof t==`number`){let t=hH(e,n,r,i,!0);this.restoreHandlers.push(()=>{t()})}})(),this.windowsSet.add(e),this.windows.push(new WeakRef(e))}}addShadowRoot(e){this.shadowDoms.add(new WeakRef(e))}resetShadowRoots(){this.shadowDoms=new Set}snapshot(e,t){if(t?.skipRequestAnimationFrame){this.takeSnapshot(performance.now(),!0,e);return}rH(t=>this.takeSnapshot(t,!0,e))}initFPSWorker(){let e=new Worker(dLe());return e.onmessage=e=>{let t=e.data,{id:n}=t;if(this.snapshotInProgressMap.set(n,!1),!(`base64`in t))return;let{base64:r,type:i,width:a,height:o}=t;this.mutationCb({id:n,type:aH[`2D`],commands:[{property:`clearRect`,args:[0,0,a,o]},{property:`drawImage`,args:[{rr_type:`ImageBitmap`,args:[{rr_type:`Blob`,data:[{rr_type:`ArrayBuffer`,base64:r}],type:i}]},0,0,a,o]}]})},e}initCanvasFPSObserver(){let e;if(!this.windows.length&&!this.shadowDoms.size)return;let t=n=>{this.takeSnapshot(n,!1),e=rH(t)};e=rH(t),this.restoreHandlers.push(()=>{e&&cancelAnimationFrame(e)})}initCanvasMutationObserver(e,t,n,r){let i=hH(e,t,n,r,!1),a=sLe(this.processMutation.bind(this),e,t,n,r),o=lLe(this.processMutation.bind(this),e,t,n,r,this.mirror);this.restoreHandlers.push(()=>{i(),a(),o()})}getCanvasElements(e,t,n){let r=[],i=i=>{i.querySelectorAll(`canvas`).forEach(i=>{eH(i,e,t,n,!0)||r.push(i)})};for(let e of this.windows){let t=e.deref(),n;try{n=t&&t.document}catch{}n&&i(n)}for(let e of this.shadowDoms){let t=e.deref();t&&i(t)}return r}takeSnapshot(e,t,n){let{sampling:r,blockClass:i,blockSelector:a,unblockSelector:o,dataURLOptions:s,maxCanvasSize:c}=this.options,l=1e3/(r===`all`?2:r||2);return this.lastSnapshotTime&&e-this.lastSnapshotTime<l?!1:(this.lastSnapshotTime=e,(n?[n]:this.getCanvasElements(i,a,o)).forEach(e=>{let n=this.mirror.getId(e);if(!(!this.mirror.hasNode(e)||!e.width||!e.height||this.snapshotInProgressMap.get(n))){if(this.snapshotInProgressMap.set(n,!0),!t&&[`webgl`,`webgl2`].includes(e.__context)){let t=e.getContext(e.__context);t?.getContextAttributes()?.preserveDrawingBuffer===!1&&t.clear(t.COLOR_BUFFER_BIT)}createImageBitmap(e).then(t=>{this.worker?.postMessage({id:n,bitmap:t,width:e.width,height:e.height,dataURLOptions:s,maxCanvasSize:c},[t])}).catch(e=>{sH(()=>{throw this.snapshotInProgressMap.delete(n),e})()})}}),!0)}startPendingCanvasMutationFlusher(){rH(()=>this.flushPendingCanvasMutations())}startRAFTimestamping(){let e=t=>{this.rafStamps.latestId=t,rH(e)};rH(e)}flushPendingCanvasMutations(){this.pendingCanvasMutations.forEach((e,t)=>{let n=this.mirror.getId(t);this.flushPendingCanvasMutationFor(t,n)}),rH(()=>this.flushPendingCanvasMutations())}flushPendingCanvasMutationFor(e,t){if(this.frozen||this.locked)return;let n=this.pendingCanvasMutations.get(e);if(!n||t===-1)return;let r=n.map(e=>{let{type:t,...n}=e;return n}),{type:i}=n[0];this.mutationCb({id:t,type:i,commands:r}),this.pendingCanvasMutations.delete(e)}};try{if(Array.from([1],e=>e*2)[0]!==2){let e=document.createElement(`iframe`);document.body.appendChild(e),Array.from=e.contentWindow?.Array.from||Array.from,document.body.removeChild(e)}}catch(e){console.debug(`Unable to override Array.from`,e)}eLe();var pLe;(function(e){e[e.NotStarted=0]=`NotStarted`,e[e.Running=1]=`Running`,e[e.Stopped=2]=`Stopped`})(pLe||={});var _H={low:{sampling:{canvas:1},dataURLOptions:{type:`image/webp`,quality:.25}},medium:{sampling:{canvas:2},dataURLOptions:{type:`image/webp`,quality:.4}},high:{sampling:{canvas:4},dataURLOptions:{type:`image/webp`,quality:.5}}},mLe=`ReplayCanvas`,vH=1280,hLe=rk(((e={})=>{let[t,n]=e.maxCanvasSize||[],r={quality:e.quality||`medium`,enableManualSnapshot:e.enableManualSnapshot,maxCanvasSize:[t?Math.min(t,vH):vH,n?Math.min(n,vH):vH]},i,a,o=new Promise(e=>a=e);return{name:mLe,getOptions(){let{quality:e,enableManualSnapshot:t,maxCanvasSize:n}=r;return{enableManualSnapshot:t,recordCanvas:!0,getCanvasManager:e=>{let r=new fLe({...e,enableManualSnapshot:t,maxCanvasSize:n,errorHandler:e=>{try{typeof e==`object`&&(e.__rrweb__=!0)}catch{}}});return i=r,a(r),r},..._H[e]||_H.medium}},async snapshot(e,t){(i||await o).snapshot(e,t)}}}));function gLe(e){return e.split(`,`).some(e=>e.trim().startsWith(`sentry-`))}function yH(e){try{return new URL(e,Y.location.origin).href}catch{return}}function _Le(e){return e.entryType===`resource`&&`initiatorType`in e&&typeof e.nextHopProtocol==`string`&&(e.initiatorType===`fetch`||e.initiatorType===`xmlhttprequest`)}function bH(e){try{return new Headers(e)}catch{return}}var xH={traceFetch:!0,traceXHR:!0,enableHTTPTimings:!0,trackFetchStreamPerformance:!1};function SH(e,t){let{traceFetch:n,traceXHR:r,shouldCreateSpanForRequest:i,enableHTTPTimings:a,tracePropagationTargets:o,onRequestSpanStart:s,onRequestSpanEnd:c}={...xH,...t},l=typeof i==`function`?i:e=>!0,u=e=>yLe(e,o),d={},f=e.getOptions().propagateTraceparent;n&&iP(t=>{let n=oOe(t,l,u,d,{propagateTraceparent:f,onRequestSpanEnd:c});if(n){let r=yH(t.fetchData.url),i=r?Xk(r).host:void 0,o=r?Qk(r):void 0;n.setAttributes({"http.url":o,"url.full":o,"server.address":i}),a&&CH(n,e),s?.(n,{headers:t.headers})}}),r&&mR(t=>{let n=bLe(t,l,u,d,f,c);n&&(a&&CH(n,e),s?.(n,{headers:bH(t.xhr.__sentry_xhr_v3__?.request_headers)}))})}var vLe=300;function CH(e,t){let{url:n}=iD(e).data;if(!n||typeof n!=`string`)return;let r=()=>void setTimeout(i);if(JD(t)){let t=e.end.bind(e);e.end=e=>{let n=e??JT(),a=!1,o=()=>{a||(a=!0,setTimeout(i),t(n),clearTimeout(s))};r=o;let s=setTimeout(o,vLe)}}let i=OL(`resource`,({entries:t})=>{t.forEach(t=>{_Le(t)&&t.name.endsWith(n)&&(e.setAttributes(GL(t)),r())})})}function yLe(e,t){let n=yP();if(n){let r,i;try{r=new URL(e,n),i=new URL(n).origin}catch{return!1}let a=r.origin===i;return t?RT(r.toString(),t)||a&&RT(r.pathname,t):a}{let n=!!e.match(/^\/(?!\/)/);return t?RT(e,t):n}}function bLe(e,t,n,r,i,a){let o=e.xhr,s=o?.[pR];if(!o||o.__sentry_own_request__||!s)return;let{url:c,method:l}=s,u=wD()&&t(c);if(e.endTimestamp){let t=o.__sentry_xhr_span_id__;if(!t)return;let n=r[t];n&&(u&&s.status_code!==void 0&&(ME(n,s.status_code),n.end(),a?.(n,{headers:bH(vR(o)),error:e.error})),delete r[t]);return}let d=yH(c),f=Xk(d||c),p=d?Qk(d):void 0,m=Qk(Zk(c)),h=J(),g=!!bD(),_=g||!!h&&JD(h),v=u&&_?rO({name:`${l} ${m}`,attributes:{url:Qk(c),type:`xhr`,"http.method":l,"http.url":p,"url.full":p,"server.address":f?.host,[wE]:`auto.http.browser`,[CE]:`http.client`,...f?.search&&{"http.query":f?.search},...f?.hash&&{"http.fragment":f?.hash}}}):new OD,y=mO(v)&&g?void 0:v;return u&&!_&&h?.recordDroppedEvent(`no_parent_span`,`span`),o.__sentry_xhr_span_id__=v.spanContext().spanId,r[o.__sentry_xhr_span_id__]=v,n(c)&&xLe(o,wD()&&_?y:void 0,i),h&&h.emit(`beforeOutgoingRequestSpan`,v,e),v}function xLe(e,t,n){let{"sentry-trace":r,baggage:i,traceparent:a}=nA({span:t,propagateTraceparent:n});r&&SLe(e,r,i,a)}function SLe(e,t,n,r){let i=e.__sentry_xhr_v3__?.request_headers;if(!(i?.[`sentry-trace`]||!e.setRequestHeader))try{if(e.setRequestHeader(`sentry-trace`,t),r&&!i?.traceparent&&e.setRequestHeader(`traceparent`,r),n){let t=i?.baggage;(!t||!gLe(t))&&e.setRequestHeader(`baggage`,n)}}catch{}}var wH=new WeakMap,TH=new WeakMap,CLe=9e4,wLe=[`text/event-stream`,`application/x-ndjson`,`application/stream+json`],EH=rk(()=>({name:`FetchStreamPerformance`,setup(){aP(e=>{if(e.response){let t=wH.get(e.response);if(t&&e.endTimestamp){t.end(e.endTimestamp);let n=TH.get(e.response);n&&clearTimeout(n)}}}),iP(e=>{if(e.endTimestamp&&e.response){let t=e.response.headers?.get(`content-type`)||``;if(e.response.headers?.get(`content-length`)||!wLe.some(e=>t.startsWith(e)))return;let n=e.fetchData?.url||``,r=e.fetchData?.method||`GET`,i=Jk(n),a=rO({name:`${r} ${n.startsWith(`data:`)?Qk(n):i?Yk(i):n}`,startTime:e.endTimestamp,attributes:{url:Qk(n),"http.method":r,type:`fetch`,[CE]:`http.client.stream`,[wE]:`auto.http.browser.stream`}});wH.set(e.response,a);let o=setTimeout(()=>{a.isRecording()&&a.end()},CLe);TH.set(e.response,o)}})}})),TLe=`WebVitals`,DH=rk((e={})=>{let t=new Set(e.ignore??[]);return{name:TLe,setup(n){let r=JD(n),{enableStandaloneClsSpans:i,enableStandaloneLcpSpans:a}=e._experiments??{},o=r||t.has(`cls`)?void 0:i||!1,s=r||t.has(`lcp`)?void 0:a||!1,c=ZAe({recordClsStandaloneSpans:o,recordLcpStandaloneSpans:s,client:n}),l=new WeakSet;n.on(`afterStartPageLoadSpan`,e=>{l.add(e)}),n.on(`spanEnd`,e=>{l.delete(e)&&(c(),oje(e,{recordClsOnPageloadSpan:o===!1,recordLcpOnPageloadSpan:s===!1,spanStreamingEnabled:r}))}),r?(t.has(`lcp`)||Tje(n),t.has(`cls`)||Dje(n),t.has(`inp`)||kje()):t.has(`inp`)||bje()},afterAllSetup(){t.has(`inp`)||wje()}}});function ELe(){Y.document?Y.document.addEventListener(`visibilitychange`,()=>{let e=bD();if(!e)return;let t=vD(e);if(Y.document.hidden&&t){let e=`cancelled`,{op:n,status:r}=iD(t);X&&K.log(`[Tracing] Transaction: ${e} -> since tab moved to the background, op: ${n}`),r||t.setStatus({code:2,message:e}),t.setAttribute(`sentry.cancellation_reason`,`document.hidden`),t.end()}}):X&&K.warn(`[Tracing] Could not set up background tab detection due to lack of global document`)}var OH=`sentry_previous_trace`,DLe=`sentry.previous_trace`;function OLe(e,{linkPreviousTrace:t,consistentTraceSampling:n}){let r=t===`session-storage`,i=r?jLe():void 0;e.on(`spanStart`,e=>{if(vD(e)!==e)return;let t=q().getPropagationContext();i=kLe(i,e,t),r&&ALe(i)});let a=!0;n&&e.on(`beforeSampling`,e=>{if(!i)return;let t=q(),n=t.getPropagationContext();if(a&&n.parentSpanId){a=!1;return}t.setPropagationContext({...n,dsc:{...n.dsc,sample_rate:String(i.sampleRate),sampled:String(kH(i.spanContext))},sampleRand:i.sampleRand}),e.parentSampled=kH(i.spanContext),e.parentSampleRate=i.sampleRate,e.spanAttributes={...e.spanAttributes,[QCe]:i.sampleRate}})}function kLe(e,t,n){let r=iD(t);function i(){try{let e=Number(r.data?.[`sentry.sample_rate`]??n.dsc?.sample_rate);return Number.isNaN(e)?0:e}catch{return 0}}let a={spanContext:t.spanContext(),startTimestamp:r.start_timestamp,sampleRate:i(),sampleRand:n.sampleRand};if(!e)return a;let o=e.spanContext;return o.traceId===r.trace_id?e:(Date.now()/1e3-e.startTimestamp<=3600&&(X&&K.log(`Adding previous_trace \`${JSON.stringify(o)}\` link to span \`${JSON.stringify({op:r.op,...t.spanContext()})}\``),t.addLink({context:o,attributes:{[swe]:`previous_trace`}}),t.setAttribute(DLe,`${o.traceId}-${o.spanId}-${+!!kH(o)}`)),a)}function ALe(e){try{Y.sessionStorage.setItem(OH,JSON.stringify(e))}catch(e){X&&K.warn(`Could not store previous trace in sessionStorage`,e)}}function jLe(){try{let e=Y.sessionStorage?.getItem(OH);return JSON.parse(e)}catch{return}}function kH(e){return e.traceFlags===1}var MLe=`BrowserTracing`,NLe=/Googlebot|Google-InspectionTool|Storebot-Google|Bingbot|Slurp|DuckDuckBot|Baiduspider|YandexBot|Facebot|facebookexternalhit|LinkedInBot|Twitterbot|Applebot/i;function AH(){let e=Y.navigator;return e?.userAgent?NLe.test(e.userAgent):!1}var PLe={...hO,instrumentNavigation:!0,instrumentPageLoad:!0,markBackgroundSpan:!0,enableLongTask:!0,enableLongAnimationFrame:!0,enableInp:!0,ignoreResourceSpans:[],ignorePerformanceApiSpans:[],detectRedirects:!0,linkPreviousTrace:`in-memory`,consistentTraceSampling:!1,enableReportPageLoaded:!1,_experiments:{},...xH},jH=((e={})=>{`enableElementTiming`in e&&Pw(()=>{console.warn("[Sentry] `enableElementTiming` is deprecated and no longer has any effect. Use the standalone `elementTimingIntegration` instead.")});let t={name:void 0,source:void 0},n=Y.document,{enableInp:r,enableLongTask:i,enableLongAnimationFrame:a,_experiments:{enableInteractions:o,enableStandaloneClsSpans:s,enableStandaloneLcpSpans:c},beforeStartSpan:l,idleTimeout:u,finalTimeout:d,childSpanTimeout:f,markBackgroundSpan:p,traceFetch:m,traceXHR:h,trackFetchStreamPerformance:g,shouldCreateSpanForRequest:_,enableHTTPTimings:v,ignoreResourceSpans:y,ignorePerformanceApiSpans:b,instrumentPageLoad:x,instrumentNavigation:S,detectRedirects:C,linkPreviousTrace:w,consistentTraceSampling:T,enableReportPageLoaded:E,onRequestSpanStart:ee,onRequestSpanEnd:te}={...PLe,...e},ne=AH(),re,ie;function ae(e,r,i=!0,a){let o=r.op===`pageload`,s=r.name,c=l?l(r):r,p=Jk(a||yP()),m={...p?.pathname&&{"url.path":p.pathname},...p&&!qk(p)&&{"url.full":p.href},...c.attributes};if(s!==c.name&&(m[xE]=`custom`),c.attributes=m,!i){let e=qT();rO({...c,startTime:e}).end(e);return}t.name=c.name,t.source=m[xE];let h=gO(c,{idleTimeout:u,finalTimeout:d,childSpanTimeout:f,disableAutoFinish:o,beforeSpanEnd:t=>{aje(t,{ignoreResourceSpans:y,ignorePerformanceApiSpans:b,spanStreamingEnabled:JD(e)}),RH(e,void 0);let n=q(),r=n.getPropagationContext();n.setPropagationContext({...r,traceId:h.spanContext().traceId,sampled:uD(h),dsc:PD(t)}),o&&(ie=void 0)},trimIdleSpanEndTimestamp:!E});o&&E&&(ie=h),RH(e,h);function g(){n&&[`interactive`,`complete`].includes(n.readyState)&&(e.emit(`idleSpanEnableAutoFinish`,h),n.removeEventListener(`readystatechange`,g))}o&&!E&&n&&(n.addEventListener(`readystatechange`,g),g())}return{name:MLe,setup(e){if(ne){X&&K.log(`[Tracing] Skipping browserTracingIntegration setup for bot user agent.`);return}if(CD(),a&&G.PerformanceObserver&&PerformanceObserver.supportedEntryTypes?.includes(`long-animation-frame`)?$Ae():i&&QAe(),o&&eje(),C&&n){let e=()=>{re=JT()};addEventListener(`click`,e,{capture:!0}),addEventListener(`keydown`,e,{capture:!0,passive:!0})}function t(){let t=LH(e);t&&!iD(t).timestamp&&(X&&K.log(`[Tracing] Finishing current active span with op: ${iD(t).op}`),t.setAttribute(TE,`cancelled`),t.end())}e.on(`startNavigationSpan`,(n,r)=>{if(J()!==e)return;if(r?.isRedirect){X&&K.warn(`[Tracing] Detected redirect, navigation span will not be the root span, but a child span.`),ae(e,{op:`navigation.redirect`,...n},!1,r.url);return}re=void 0,t(),_E().setPropagationContext({traceId:$T(),sampleRand:Math.random(),propagationSpanId:wD()?void 0:eE()});let i=q();i.setPropagationContext({traceId:$T(),sampleRand:Math.random(),propagationSpanId:wD()?void 0:eE()}),i.setSDKProcessingMetadata({normalizedRequest:void 0}),ae(e,{op:`navigation`,...n,parentSpan:null,forceTransaction:!0},!0,r?.url)}),e.on(`startPageLoadSpan`,(n,r={})=>{if(J()!==e)return;t();let i=YE(r.sentryTrace||PH(`sentry-trace`)||FH(`sentry-trace`),r.baggage||PH(`baggage`)||FH(`baggage`)),a=q();a.setPropagationContext(i),wD()||(a.getPropagationContext().propagationSpanId=eE()),a.setSDKProcessingMetadata({normalizedRequest:FI()}),ae(e,{op:`pageload`,...n})}),e.on(`endPageloadSpan`,()=>{E&&ie&&(ie.setAttribute(TE,`reportPageLoaded`),ie.end())})},afterAllSetup(e){if(ne)return;e.addIntegration&&!e.getIntegrationByName?.(`WebVitals`)&&e.addIntegration(DH({ignore:r?[]:[`inp`],_experiments:{enableStandaloneClsSpans:s,enableStandaloneLcpSpans:c}}));let n=yP();if(w!==`off`&&OLe(e,{linkPreviousTrace:w,consistentTraceSampling:T}),Y.location){if(x){let t=XT();MH(e,{name:Y.location.pathname,startTime:t?t/1e3:void 0,attributes:{[xE]:`url`,[wE]:`auto.pageload.browser`}})}S&&lR(({to:t,from:r})=>{if(r===void 0&&n?.indexOf(t)!==-1){n=void 0;return}n=void 0;let i=Jk(t),a=LH(e),o=a&&C&&ILe(a,re);NH(e,{name:i?.pathname||Y.location.pathname,attributes:{[xE]:`url`,[wE]:`auto.navigation.browser`}},{url:t,isRedirect:o})})}p&&ELe(),o&&FLe(e,u,d,f,t),SH(e,{traceFetch:m,traceXHR:h,tracePropagationTargets:e.getOptions().tracePropagationTargets,shouldCreateSpanForRequest:_,enableHTTPTimings:v,onRequestSpanStart:ee,onRequestSpanEnd:te}),g&&e.addIntegration(EH())}}});function MH(e,t,n){e.emit(`startPageLoadSpan`,t,n),q().setTransactionName(t.name);let r=LH(e);return r&&e.emit(`afterStartPageLoadSpan`,r),r}function NH(e,t,n){let{url:r,isRedirect:i}=n||{};e.emit(`beforeStartNavigationSpan`,t,{isRedirect:i,url:r}),e.emit(`startNavigationSpan`,t,{isRedirect:i,url:r});let a=q();return a.setTransactionName(t.name),r&&!i&&a.setSDKProcessingMetadata({normalizedRequest:{...FI(),url:r}}),LH(e)}function PH(e){return(Y.document?.querySelector(`meta[name=${e}]`))?.getAttribute(`content`)||void 0}function FH(e){return(Y.performance?.getEntriesByType?.(`navigation`)[0])?.serverTiming?.find(t=>t.name===e)?.description}function FLe(e,t,n,r,i){let a=Y.document,o;a&&addEventListener(`click`,()=>{let a=`ui.action.click`,s=LH(e);if(s){let e=iD(s).op;if([`navigation`,`pageload`].includes(e)){X&&K.warn(`[Tracing] Did not create ${a} span because a pageload or navigation span is in progress.`);return}}if(o&&=(o.setAttribute(TE,`interactionInterrupted`),o.end(),void 0),!i.name){X&&K.warn(`[Tracing] Did not create ${a} transaction because _latestRouteName is missing.`);return}o=gO({name:i.name,op:a,attributes:{[xE]:i.source||`url`}},{idleTimeout:t,finalTimeout:n,childSpanTimeout:r})},{capture:!0})}var IH=`_sentry_idleSpan`;function LH(e){return e[IH]}function RH(e,t){vT(e,IH,t)}var zH=1.5;function ILe(e,t){let n=iD(e),r=qT();return!(r-n.start_timestamp>zH||t&&r-t<=zH)}function LLe(e=J()){e?.emit(`endPageloadSpan`)}function RLe(e){let t=bD();if(t===e)return;let n=q();e.end=new Proxy(e.end,{apply(e,r,i){return iE(n,t),Reflect.apply(e,r,i)}}),iE(n,e)}var zLe=rk(()=>({name:`SpanStreaming`,beforeSetup(e){let t=e.getOptions();t.traceLifecycle||=(X&&K.log('[SpanStreaming] setting `traceLifecycle` to "stream"'),`stream`)},setup(e){let t=`SpanStreaming integration requires`,n=`Falling back to static trace lifecycle.`,r=e.getOptions();if(!JD(e)){r.traceLifecycle=`static`,X&&K.warn(`${t} \`traceLifecycle\` to be set to "stream"! ${n}`);return}let i=r.beforeSendSpan;if(i&&!FD(i)){r.traceLifecycle=`static`,X&&K.warn(`${t} a beforeSendSpan callback using \`withStreamedSpan\`! ${n}`);return}let a=new XN(e);e.on(`afterSpanEnd`,t=>{uD(t)&&a.add(STe(t,e))}),e.on(`afterSegmentSpanEnd`,e=>{let t=e.spanContext().traceId;setTimeout(()=>{a.flush(t)},500)})}})),BH=1e6,BLe=`window`in G&&G.window===G&&typeof importScripts>`u`,VH=`0`,HH=BLe?`main`:`worker`,UH=Y.navigator,WH=``,GH=``,KH=``,qH=UH?.userAgent||``,JH=``,VLe=UH?.language||UH?.languages?.[0]||``;function HLe(e){return typeof e==`object`&&!!e&&`getHighEntropyValues`in e}var YH=UH?.userAgentData;HLe(YH)&&YH.getHighEntropyValues([`architecture`,`model`,`platform`,`platformVersion`,`fullVersionList`]).then(e=>{if(WH=e.platform||``,KH=e.architecture||``,JH=e.model||``,GH=e.platformVersion||``,e.fullVersionList?.length){let t=e.fullVersionList[e.fullVersionList.length-1];qH=`${t.brand} ${t.version}`}}).catch(e=>void 0);function ULe(e){return!(`thread_metadata`in e)}function WLe(e){return ULe(e)?XLe(e):e}function GLe(e){let t=e.contexts?.trace?.trace_id;return typeof t==`string`&&t.length!==32&&X&&K.log(`[Profiling] Invalid traceId: ${t} on profiled event`),typeof t==`string`?t:``}function KLe(e,t,n,r){if(r.type!==`transaction`)throw TypeError(`Profiling events may only be attached to transactions, this should never occur.`);if(n==null)throw TypeError(`Cannot construct profiling event envelope without a valid profile. Got ${n} instead.`);let i=GLe(r),a=WLe(n),o=t||(typeof r.start_timestamp==`number`?r.start_timestamp*1e3:JT()*1e3),s=typeof r.timestamp==`number`?r.timestamp*1e3:JT()*1e3;return{event_id:e,timestamp:new Date(o).toISOString(),platform:`javascript`,version:`1`,release:r.release||``,environment:r.environment||`production`,runtime:{name:`javascript`,version:Y.navigator.userAgent},os:{name:WH,version:GH,build_number:qH},device:{locale:VLe,model:JH,manufacturer:qH,architecture:KH,is_emulator:!1},debug_meta:{images:ZH(n.resources)},profile:a,transactions:[{name:r.transaction||``,id:r.event_id||BT(),trace_id:i,active_thread_id:VH,relative_start_ns:`0`,relative_end_ns:((s-o)*1e6).toFixed(0)}]}}function qLe(e,t,n){if(e==null)throw TypeError(`Cannot construct profiling event envelope without a valid profile. Got ${e} instead.`);let r=YLe(e),i=t.getOptions(),a=t.getSdkMetadata?.()?.sdk;return{chunk_id:BT(),client_sdk:{name:a?.name??`sentry.javascript.browser`,version:a?.version??`0.0.0`},profiler_id:n||BT(),platform:`javascript`,version:`2`,release:i.release??``,environment:i.environment??`production`,debug_meta:{images:ZH(e.resources)},profile:r}}function JLe(e){try{if(!e||typeof e!=`object`)return{reason:`chunk is not an object`};let t=e=>typeof e==`string`&&/^[a-f0-9]{32}$/.test(e);if(!t(e.profiler_id))return{reason:`missing or invalid profiler_id`};if(!t(e.chunk_id))return{reason:`missing or invalid chunk_id`};if(!e.client_sdk)return{reason:`missing client_sdk metadata`};let n=e.profile;return n?!Array.isArray(n.frames)||!n.frames.length?{reason:`profile has no frames`}:!Array.isArray(n.stacks)||!n.stacks.length?{reason:`profile has no stacks`}:!Array.isArray(n.samples)||!n.samples.length?{reason:`profile has no samples`}:{valid:!0}:{reason:`missing profile data`}}catch(e){return{reason:`unknown validation error: ${e}`}}}function YLe(e){let t=[];for(let n=0;n<e.frames.length;n++){let r=e.frames[n];r&&(t[n]={function:r.name,abs_path:typeof r.resourceId==`number`?e.resources[r.resourceId]:void 0,lineno:r.line,colno:r.column})}let n=[];for(let t=0;t<e.stacks.length;t++){let r=e.stacks[t];if(!r)continue;let i=[],a=r;for(;a;)i.push(a.frameId),a=a.parentId===void 0?void 0:e.stacks[a.parentId];n[t]=i}let r=XT(),i=typeof performance.timeOrigin==`number`?performance.timeOrigin:r||0,a=i-(r||i),o=[];for(let t=0;t<e.samples.length;t++){let n=e.samples[t];if(!n)continue;let r=(i+(n.timestamp-a))/1e3;o[t]={stack_id:n.stackId??0,thread_id:VH,timestamp:r}}return{frames:t,stacks:n,samples:o,thread_metadata:{[VH]:{name:HH}}}}function XH(e){return iD(e).op===`pageload`}function XLe(e){let t,n=0,r={samples:[],stacks:[],frames:[],thread_metadata:{[VH]:{name:HH}}},i=e.samples[0];if(!i)return r;let a=i.timestamp,o=XT(),s=typeof performance.timeOrigin==`number`?performance.timeOrigin:o||0,c=s-(o||s);return e.samples.forEach((i,o)=>{if(i.stackId===void 0){t===void 0&&(t=n,r.stacks[t]=[],n++),r.samples[o]={elapsed_since_start_ns:((i.timestamp+c-a)*BH).toFixed(0),stack_id:t,thread_id:VH};return}let s=e.stacks[i.stackId],l=[];for(;s;){l.push(s.frameId);let t=e.frames[s.frameId];t&&r.frames[s.frameId]===void 0&&(r.frames[s.frameId]={function:t.name,abs_path:typeof t.resourceId==`number`?e.resources[t.resourceId]:void 0,lineno:t.line,colno:t.column}),s=s.parentId===void 0?void 0:e.stacks[s.parentId]}let u={elapsed_since_start_ns:((i.timestamp+c-a)*BH).toFixed(0),stack_id:n,thread_id:VH};r.stacks[n]=l,r.samples[o]=u,n++}),r}function ZLe(e,t){if(!t.length)return e;for(let n of t)e[1].push([{type:`profile`},n]);return e}function QLe(e){let t=[];return RD(e,(e,n)=>{if(n===`transaction`)for(let n=1;n<e.length;n++)e[n]?.contexts?.profile?.profile_id&&t.push(e[n])}),t}function ZH(e){let t=J()?.getOptions()?.stackParser;return t?OTe(t,e):[]}function QH(e){return typeof e!=`number`&&typeof e!=`boolean`||typeof e==`number`&&isNaN(e)?(X&&K.warn(`[Profiling] Invalid sample rate. Sample rate must be a boolean or a number between 0 and 1. Got ${JSON.stringify(e)} of type ${JSON.stringify(typeof e)}.`),!1):e===!0||e===!1?!0:e<0||e>1?(X&&K.warn(`[Profiling] Invalid sample rate. Sample rate must be between 0 and 1. Got ${e}.`),!1):!0}function $Le(e){return e.samples.length<2?(X&&K.log(`[Profiling] Discarding profile because it contains less than 2 samples`),!1):e.frames.length?!0:(X&&K.log(`[Profiling] Discarding profile because it contains no frames`),!1)}var $H=!1,eU=3e4;function eRe(e){return typeof e==`function`}function tU(){let e=Y.Profiler;if(!eRe(e)){X&&K.log(`[Profiling] Profiling is not supported by this browser, Profiler interface missing on window object.`);return}let t=Math.floor(eU/10);try{return new e({sampleInterval:10,maxBufferSize:t})}catch{X&&(K.log(`[Profiling] Failed to initialize the Profiling constructor, this is likely due to a missing 'Document-Policy': 'js-profiling' header.`),K.log(`[Profiling] Disabling profiling for current user session.`)),$H=!0}}function nU(e){if($H)return X&&K.log(`[Profiling] Profiling has been disabled for the duration of the current user session.`),!1;if(!e.isRecording())return X&&K.log(`[Profiling] Discarding profile because root span was not sampled.`),!1;let t=J()?.getOptions();if(!t)return X&&K.log(`[Profiling] Profiling disabled, no options found.`),!1;let n=t.profilesSampleRate;return QH(n)?n?n===!0||Math.random()<n||(X&&K.log(`[Profiling] Discarding profile because it's not included in the random sample (sampling rate = ${Number(n)})`),!1):(X&&K.log(`[Profiling] Discarding profile because a negative sampling decision was inherited or profileSampleRate is set to 0`),!1):(X&&K.warn(`[Profiling] Discarding profile because of invalid sample rate.`),!1)}function tRe(e){if($H)return X&&K.log(`[Profiling] Profiling has been disabled for the duration of the current user session as the JS Profiler could not be started.`),!1;if(e.profileLifecycle!==`trace`&&e.profileLifecycle!==`manual`)return X&&K.warn("[Profiling] Session not sampled. Invalid `profileLifecycle` option."),!1;let t=e.profileSessionSampleRate;return QH(t)?t?Math.random()<=t:(X&&K.log(`[Profiling] Discarding profile because profileSessionSampleRate is not defined or set to 0`),!1):(X&&K.warn(`[Profiling] Discarding profile because of invalid profileSessionSampleRate.`),!1)}function rU(e){return e.profilesSampleRate!==void 0}function nRe(e,t,n,r){return $Le(n)?KLe(e,t,n,r):null}var iU=new Map;function rRe(){return iU.size}function iRe(e){let t=iU.get(e);return t&&iU.delete(e),t}function aRe(e,t){if(iU.set(e,t),iU.size>30){let e=iU.keys().next().value;e!==void 0&&iU.delete(e)}}var aU=new WeakSet;function oU(e){e.setAttribute(`thread.id`,VH),e.setAttribute(`thread.name`,HH)}function sU(e){let t;XH(e)&&(t=JT()*1e3);let n=tU();if(!n)return;X&&K.log(`[Profiling] started profiling span: ${iD(e).description}`);let r=BT(),i=null;q().setContext(`profile`,{profile_id:r,start_timestamp:t}),aU.add(e),oU(e);async function a(){if(e&&n){if(i){X&&K.log(`[Profiling] profile for:`,iD(e).description,`already exists, returning early`);return}return n.stop().then(t=>{if(o&&=(Y.clearTimeout(o),void 0),X&&K.log(`[Profiling] stopped profiling of span: ${iD(e).description}`),!t){X&&K.log(`[Profiling] profiler returned null profile for: ${iD(e).description}`,`this may indicate an overlapping span or a call to stopProfiling with a profile title that was never started`);return}i=t,aRe(r,t)}).catch(e=>{X&&K.log(`[Profiling] error while stopping profiler:`,e)})}}let o=Y.setTimeout(()=>{X&&K.log(`[Profiling] max profile duration elapsed, stopping profiling for:`,iD(e).description),a()},eU),s=e.end.bind(e);function c(){return e?(a().then(()=>{s()},()=>{s()}),e):s()}e.end=c}var oRe=6e4,sRe=3e5,cRe=class{constructor(){this._client=void 0,this._profiler=void 0,this._chunkTimer=void 0,this._profilerId=void 0,this._isRunning=!1,this._sessionSampled=!1,this._lifecycleMode=void 0,this._activeRootSpanIds=new Set,this._rootSpanTimeouts=new Map}initialize(e){let t=e.getOptions().profileLifecycle,n=tRe(e.getOptions());X&&K.log(`[Profiling] Initializing profiler (lifecycle='${t}').`),n||X&&K.log(`[Profiling] Session not sampled. Skipping lifecycle profiler initialization.`),this._profilerId=BT(),this._client=e,this._sessionSampled=n,this._lifecycleMode=t,t===`trace`&&this._setupTraceLifecycleListeners(e),e.on(`spanStart`,e=>{this._isRunning&&oU(e)})}start(){if(this._lifecycleMode===`trace`){X&&K.warn('[Profiling] `profileLifecycle` is set to "trace". Calls to `uiProfiler.start()` are ignored in trace mode.');return}if(this._isRunning){X&&K.warn("[Profiling] Profile session is already running, `uiProfiler.start()` is a no-op.");return}if(!this._sessionSampled){X&&K.warn("[Profiling] Session is not sampled, `uiProfiler.start()` is a no-op.");return}this._beginProfiling()}stop(){if(this._lifecycleMode===`trace`){X&&K.warn('[Profiling] `profileLifecycle` is set to "trace". Calls to `uiProfiler.stop()` are ignored in trace mode.');return}if(!this._isRunning){X&&K.warn("[Profiling] Profiler is not running, `uiProfiler.stop()` is a no-op.");return}this._endProfiling()}notifyRootSpanActive(e){if(this._lifecycleMode!==`trace`||!this._sessionSampled)return;let t=e.spanContext().spanId;if(!t||this._activeRootSpanIds.has(t))return;this._registerTraceRootSpan(t);let n=this._activeRootSpanIds.size;n===1&&(X&&K.log(`[Profiling] Detected already active root span during setup. Active root spans now:`,n),this._beginProfiling()),this._isRunning&&oU(e)}_beginProfiling(){if(!this._isRunning){if(this._isRunning=!0,X&&K.log(`[Profiling] Started profiling with profiler ID:`,this._profilerId),vE().setContext(`profile`,{profiler_id:this._profilerId}),this._startProfilerInstance(),!this._profiler){X&&K.log(`[Profiling] Failed to start JS Profiler; stopping.`),this._resetProfilerInfo();return}this._startPeriodicChunking()}}_endProfiling(){this._isRunning&&(this._isRunning=!1,this._chunkTimer&&=(clearTimeout(this._chunkTimer),void 0),this._clearAllRootSpanTimeouts(),this._collectCurrentChunk().catch(e=>{X&&K.error("[Profiling] Failed to collect current profile chunk on `stop()`:",e)}),this._lifecycleMode===`manual`&&vE().setContext(`profile`,{}))}_setupTraceLifecycleListeners(e){e.on(`spanStart`,e=>{if(!this._sessionSampled){X&&K.log(`[Profiling] Span not profiled because of negative sampling decision for user session.`);return}if(e!==vD(e))return;if(!e.isRecording()){X&&K.log(`[Profiling] Discarding profile because root span was not sampled.`);return}let t=e.spanContext().spanId;if(!t||this._activeRootSpanIds.has(t))return;this._registerTraceRootSpan(t);let n=this._activeRootSpanIds.size;n===1&&(X&&K.log(`[Profiling] Root span ${t} started. Profiling active while there are active root spans (count=${n}).`),this._beginProfiling())}),e.on(`spanEnd`,e=>{if(!this._sessionSampled)return;let t=e.spanContext().spanId;if(!t||!this._activeRootSpanIds.has(t))return;this._activeRootSpanIds.delete(t);let n=this._activeRootSpanIds.size;X&&K.log(`[Profiling] Root span with ID ${t} ended. Will continue profiling for as long as there are active root spans (currently: ${n}).`),n===0&&(this._collectCurrentChunk().catch(e=>{X&&K.error("[Profiling] Failed to collect current profile chunk on last `spanEnd`:",e)}),this._endProfiling())})}_resetProfilerInfo(){this._isRunning=!1,vE().setContext(`profile`,{})}_clearAllRootSpanTimeouts(){this._rootSpanTimeouts.forEach(e=>clearTimeout(e)),this._rootSpanTimeouts.clear()}_registerTraceRootSpan(e){this._activeRootSpanIds.add(e);let t=setTimeout(()=>this._onRootSpanTimeout(e),sRe);this._rootSpanTimeouts.set(e,t)}_startProfilerInstance(){if(this._profiler?.stopped===!1)return;let e=tU();if(!e){X&&K.log(`[Profiling] Failed to start JS Profiler.`);return}this._profiler=e}_startPeriodicChunking(){this._isRunning&&(this._chunkTimer=setTimeout(()=>{if(this._collectCurrentChunk().catch(e=>{X&&K.error(`[Profiling] Failed to collect current profile chunk during periodic chunking:`,e)}),this._isRunning){if(this._startProfilerInstance(),!this._profiler){this._resetProfilerInfo();return}this._startPeriodicChunking()}},oRe))}_onRootSpanTimeout(e){this._rootSpanTimeouts.has(e)&&(this._rootSpanTimeouts.delete(e),this._activeRootSpanIds.has(e)&&(X&&K.log(`[Profiling] Reached 5-minute timeout for root span ${e}. You likely started a manual root span that never called \`.end()\`.`),this._activeRootSpanIds.delete(e),this._activeRootSpanIds.size===0&&this._endProfiling()))}async _collectCurrentChunk(){let e=this._profiler;if(this._profiler=void 0,e)try{let t=qLe(await e.stop(),this._client,this._profilerId),n=JLe(t);if(`reason`in n){X&&K.log(`[Profiling] Discarding invalid profile chunk (this is probably a bug in the SDK):`,n.reason);return}this._sendProfileChunk(t),X&&K.log(`[Profiling] Collected browser profile chunk.`)}catch(e){X&&K.log(`[Profiling] Error while stopping JS Profiler for chunk:`,e)}}_sendProfileChunk(e){let t=this._client,n=UD(t.getSdkMetadata?.()),r=t.getDsn(),i=t.getOptions().tunnel,a=ID({event_id:BT(),sent_at:new Date().toISOString(),...n&&{sdk:n},...!!i&&r&&{dsn:UE(r)}},[[{type:`profile_chunk`,platform:`javascript`},e]]);t.sendEnvelope(a).then(null,e=>{X&&K.error(`Error while sending profile chunk envelope:`,e)})}},lRe=`BrowserProfiling`,uRe=rk((()=>({name:lRe,setup(e){let t=e.getOptions(),n=new cRe;if(!rU(t)&&!t.profileLifecycle&&(t.profileLifecycle=`manual`),rU(t)&&!t.profilesSampleRate){X&&K.log(`[Profiling] Profiling disabled, no profiling options found.`);return}let r=bD(),i=r&&vD(r);if(rU(t)&&t.profileSessionSampleRate!==void 0&&X&&K.warn("[Profiling] Both legacy profiling (`profilesSampleRate`) and UI profiling settings are defined. `profileSessionSampleRate` has no effect when legacy profiling is enabled."),rU(t))i&&XH(i)&&nU(i)&&sU(i),e.on(`spanStart`,e=>{let t=vD(e);e===t?nU(e)&&sU(e):aU.has(t)&&oU(e)}),e.on(`beforeEnvelope`,e=>{if(!rRe())return;let t=QLe(e);if(!t.length)return;let n=[];for(let e of t){let t=e?.contexts,r=t?.profile?.profile_id,i=t?.profile?.start_timestamp;if(typeof r!=`string`){X&&K.log(`[Profiling] cannot find profile for a span without a profile context`);continue}if(!r){X&&K.log(`[Profiling] cannot find profile for a span without a profile context`);continue}t?.profile&&delete t.profile;let a=iRe(r);if(!a){X&&K.log(`[Profiling] Could not retrieve profile for span: ${r}`);continue}let o=nRe(r,i,a,e);o&&n.push(o)}ZLe(e,n)});else{let r=t.profileLifecycle;if(e.on(`startUIProfiler`,()=>n.start()),e.on(`stopUIProfiler`,()=>n.stop()),r===`manual`)n.initialize(e);else if(r===`trace`){if(!wD(t)){X&&K.warn("[Profiling] `profileLifecycle` is 'trace' but tracing is disabled. Set a `tracesSampleRate` or `tracesSampler` to enable span tracing.");return}n.initialize(e),i&&n.notifyRootSpanActive(i),Y.setTimeout(()=>{let e=bD(),t=e&&vD(e);t&&n.notifyRootSpanActive(t)},0)}}}}))),dRe=`SpotlightBrowser`,fRe=[{op:`ui.interaction.click`,name:`#sentry-spotlight`}],pRe=((e={})=>{let t=e.sidecarUrl||`http://localhost:8969/stream`;return{name:dRe,setup:()=>{X&&K.log(`Using Sidecar URL`,t)},beforeSetup(e){let t=e.getOptions();t.ignoreSpans=[...t.ignoreSpans||[],...fRe]},afterAllSetup:e=>{mRe(e,t)}}});function mRe(e,t){let n=dR(`fetch`),r=0;e.on(`beforeEnvelope`,e=>{if(r>3){K.warn(`[Spotlight] Disabled Sentry -> Spotlight integration due to too many failed requests:`,r);return}n(t,{method:`POST`,body:BD(e),headers:{"Content-Type":`application/x-sentry-envelope`},mode:`cors`}).then(e=>{e.status>=200&&e.status<400&&(r=0)},e=>{r++,K.error(`Sentry SDK can't connect to Sidecar is it running? See: https://spotlightjs.com/sidecar/npx/`,e)})})}var hRe=rk(pRe),gRe=rk(()=>({name:`LaunchDarkly`,processEvent(e,t,n){return RA(e)}}));function _Re(){return{name:`sentry-flag-auditor`,type:`flag-used`,synchronous:!0,method:(e,t,n)=>{zA(e,t.value),BA(e,t.value)}}}var vRe=rk(()=>({name:`OpenFeature`,processEvent(e,t,n){return RA(e)}})),yRe=class{after(e,t){zA(t.flagKey,t.value),BA(t.flagKey,t.value)}error(e,t,n){zA(e.flagKey,e.defaultValue),BA(e.flagKey,e.defaultValue)}},bRe=rk(({featureFlagClientClass:e})=>({name:`Unleash`,setupOnce(){let t=e.prototype;_T(t,`isEnabled`,xRe)},processEvent(e,t,n){return RA(e)}}));function xRe(e){return function(...t){let n=t[0],r=e.apply(this,t);return typeof n==`string`&&typeof r==`boolean`?(zA(n,r),BA(n,r)):X&&K.error(`[Feature Flags] UnleashClient.isEnabled does not match expected signature. arg0: ${n} (${typeof n}), result: ${r} (${typeof r})`),r}}var SRe=(({growthbookClass:e})=>rOe({growthbookClass:e})),CRe=rk(({featureFlagClient:e})=>({name:`Statsig`,setup(t){e.on(`gate_evaluation`,e=>{zA(e.gate.name,e.gate.value),BA(e.gate.name,e.gate.value)})},processEvent(e,t,n){return RA(e)}})),wRe=`WebWorker`,TRe=rk(({worker:e})=>({name:wRe,setupOnce:()=>{(Array.isArray(e)?e:[e]).forEach(e=>cU(e))},addWorker:e=>cU(e)}));function cU(e){e.addEventListener(`message`,e=>{if(ORe(e.data)){if(e.stopImmediatePropagation(),e.data._sentryDebugIds&&(X&&K.log(`Sentry debugId web worker message received`,e.data),Y._sentryDebugIds={...e.data._sentryDebugIds,...Y._sentryDebugIds}),e.data._sentryModuleMetadata&&(X&&K.log(`Sentry module metadata web worker message received`,e.data),Y._sentryModuleMetadata={...e.data._sentryModuleMetadata,...Y._sentryModuleMetadata}),e.data._sentryWasmImages){X&&K.log(`Sentry WASM images web worker message received`,e.data);let t=Y._sentryWasmImages||[],n=e.data._sentryWasmImages.filter(e=>dT(e)&&typeof e.code_file==`string`&&!t.some(t=>t.code_file===e.code_file));Y._sentryWasmImages=[...t,...n]}e.data._sentryWorkerError&&(X&&K.log(`Sentry worker rejection message received`,e.data._sentryWorkerError),ERe(e.data._sentryWorkerError))}})}function ERe(e){let t=J();if(!t)return;let n=t.getOptions().stackParser,r=t.getOptions().attachStacktrace,i=e.reason,a=uT(i)?AR(i):WI(n,i,void 0,r,!0);a.level=`error`,e.filename&&(a.contexts={...a.contexts,worker:{filename:e.filename}}),VO(a,{originalException:i,mechanism:{handled:!1,type:`auto.browser.web_worker.onunhandledrejection`}}),X&&K.log(`Captured worker unhandled rejection`,i)}function DRe({self:e}){e.postMessage({_sentryMessage:!0,_sentryDebugIds:e._sentryDebugIds??void 0,_sentryModuleMetadata:e._sentryModuleMetadata??void 0}),e.addEventListener(`unhandledrejection`,t=>{let n={reason:kR(t),filename:e.location?.href};e.postMessage({_sentryMessage:!0,_sentryWorkerError:n}),X&&K.log(`[Sentry Worker] Forwarding unhandled rejection to parent`,n)}),X&&K.log(`[Sentry Worker] Registered worker with unhandled rejection handling`)}function ORe(e){if(!dT(e)||e._sentryMessage!==!0)return!1;let t=`_sentryDebugIds`in e,n=`_sentryModuleMetadata`in e,r=`_sentryWorkerError`in e,i=`_sentryWasmImages`in e;return!(!t&&!n&&!r&&!i||t&&!(dT(e._sentryDebugIds)||e._sentryDebugIds===void 0)||n&&!(dT(e._sentryModuleMetadata)||e._sentryModuleMetadata===void 0)||r&&!dT(e._sentryWorkerError)||i&&(!Array.isArray(e._sentryWasmImages)||!e._sentryWasmImages.every(e=>dT(e)&&typeof e.code_file==`string`)))}var kRe=50,[,ARe]=bR,[,jRe]=hP(),lU=(e,t=0)=>{let n=[];for(let r of e.split(`
1004
1004
  `).slice(t)){let e=ARe(r),t=jRe(r);if(e&&t?.in_app!==!1?n.push(e):t&&(t.module===void 0&&delete t.module,n.push(t)),n.length>=kRe)break}return Hw(n)},MRe=rk(e=>{let t=e?.threshold??1e3,n=e?.pollInterval||t/2;return{name:`EventLoopBlockRenderer`,setup(r){let i={pollInterval:n,anrThreshold:t,captureStackTrace:!0,...e},a=EP(r);a.sendStatus({status:document.visibilityState,config:i}),setInterval(()=>{a.sendStatus({status:`alive`,config:i})},i.pollInterval)}}});function uU(){let e=vE().getScopeData(),t=_E().getScopeData(),n=q().getScopeData();return SO(e,t),SO(e,n),e.eventProcessors=[],e}function NRe(e){_E().addScopeListener(t=>{e(uU(),t)}),q().addScopeListener(t=>{e(uU(),t)}),vE().addScopeListener(t=>{e(uU(),t)})}var dU=rk(()=>({name:`ScopeToMain`,setup(e){let t=EP(e);NRe((e,n)=>{t.sendScope(JSON.stringify(kT(e,20,2e3))),n.clearBreadcrumbs(),n.clearAttachments()})}}));function fU(e){let t;return wk(e,async e=>(t||=EP(),t.sendEnvelope(e.body),{statusCode:200}))}function pU(e){return[...IR(e).filter(e=>e.name!==`BrowserSession`&&e.name!==`CultureContext`),dU()]}function mU(e={},t=FMe){if(window?.__SENTRY__RENDERER_INIT__){K.warn(`The browser SDK has already been initialized.
1005
- If init has been called in the preload and contextIsolation is disabled, is not required to call init in the renderer`);return}window.__SENTRY__RENDERER_INIT__=!0,e.sendClientReports=!1,e.defaultIntegrations===void 0&&(e.defaultIntegrations=pU(e)),e.stackParser===void 0&&(e.stackParser=lU),e.ipcNamespace===void 0&&(e.ipcNamespace=`sentry-ipc`),e.dsn===void 0&&(e.dsn=`https://12345@dummy.dsn/12345`),e.transport===void 0&&(e.transport=fU),delete e.initialScope,t(e)}var hU=e({BrowserClient:()=>KI,MULTIPLEXED_TRANSPORT_EXTRA_KEY:()=>IEe,OpenFeatureIntegrationHook:()=>yRe,SEMANTIC_ATTRIBUTE_SENTRY_OP:()=>CE,SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN:()=>wE,SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE:()=>SE,SEMANTIC_ATTRIBUTE_SENTRY_SOURCE:()=>xE,Scope:()=>oE,addBreadcrumb:()=>rA,addEventProcessor:()=>KO,addIntegration:()=>nk,bindScopeToEmitter:()=>uTe,breadcrumbsIntegration:()=>CR,browserApiErrorsIntegration:()=>wR,browserProfilingIntegration:()=>uRe,browserSessionIntegration:()=>ER,browserTracingIntegration:()=>jH,buildLaunchDarklyFlagUsedHandler:()=>_Re,captureConsoleIntegration:()=>dDe,captureEvent:()=>VO,captureException:()=>zO,captureFeedback:()=>WA,captureMessage:()=>BO,captureSession:()=>XO,chromeStackLineParser:()=>bR,consoleLoggingIntegration:()=>hOe,contextLinesIntegration:()=>eNe,continueTrace:()=>Zwe,createConsolaReporter:()=>vOe,createLangChainCallbackHandler:()=>CN,createTransport:()=>wk,createUserFeedbackEnvelope:()=>iMe,dedupeIntegration:()=>CA,defaultRequestInstrumentationOptions:()=>xH,defaultStackParser:()=>lU,elementTimingIntegration:()=>yje,endSession:()=>JO,eventFiltersIntegration:()=>oA,eventFromException:()=>HI,eventFromMessage:()=>UI,eventLoopBlockIntegration:()=>MRe,exceptionFromError:()=>RI,extraErrorDataIntegration:()=>vDe,featureFlagsIntegration:()=>nOe,feedbackAsyncIntegration:()=>nAe,feedbackIntegration:()=>LI,feedbackSyncIntegration:()=>LI,fetchStreamPerformanceIntegration:()=>EH,forceLoad:()=>IMe,functionToStringIntegration:()=>aA,getAbsoluteUrl:()=>Uje,getActiveSpan:()=>bD,getClient:()=>J,getCurrentScope:()=>q,getDefaultIntegrations:()=>pU,getFeedback:()=>lke,getGlobalScope:()=>vE,getIsolationScope:()=>_E,getReplay:()=>XIe,getRootSpan:()=>vD,getSpanDescendants:()=>_D,getSpanStatusFromHttpCode:()=>jE,getTraceData:()=>nA,globalHandlersIntegration:()=>OR,graphqlClientIntegration:()=>cNe,growthbookIntegration:()=>SRe,httpClientIntegration:()=>HMe,httpContextIntegration:()=>NR,inboundFiltersIntegration:()=>sA,init:()=>mU,instrumentAnthropicAiClient:()=>RM,instrumentCreateReactAgent:()=>UN,instrumentGoogleGenAIClient:()=>eN,instrumentLangChainEmbeddings:()=>ON,instrumentLangGraph:()=>WN,instrumentOpenAiClient:()=>mM,instrumentOutgoingRequests:()=>SH,instrumentSupabaseClient:()=>FA,isBotUserAgent:()=>AH,isEnabled:()=>GO,isInitialized:()=>KTe,lastEventId:()=>WO,launchDarklyIntegration:()=>gRe,linkedErrorsIntegration:()=>PR,logger:()=>DP,makeRendererTransport:()=>fU,metrics:()=>FP,moduleMetadataIntegration:()=>cDe,normalizeStringifyValue:()=>FR,onLoad:()=>LMe,openFeatureIntegration:()=>vRe,parameterize:()=>tA,registerSpanErrorInstrumentation:()=>CD,registerWebWorker:()=>DRe,replayCanvasIntegration:()=>hLe,replayIntegration:()=>GV,reportPageLoaded:()=>LLe,reportingObserverIntegration:()=>BMe,rewriteFramesIntegration:()=>EDe,scopeToMainIntegration:()=>dU,sendFeedback:()=>mF,setActiveSpanInBrowser:()=>RLe,setAttribute:()=>WTe,setAttributes:()=>UTe,setContext:()=>HO,setConversationId:()=>GTe,setCurrentClient:()=>Uk,setExtra:()=>BTe,setExtras:()=>zTe,setHttpStatus:()=>ME,setMeasurement:()=>GD,setTag:()=>HTe,setTags:()=>VTe,setUser:()=>UO,showReportDialog:()=>LR,spanStreamingIntegration:()=>zLe,spanToBaggageHeader:()=>Nwe,spanToJSON:()=>iD,spanToTraceHeader:()=>$E,spotlightBrowserIntegration:()=>hRe,startBrowserTracingNavigationSpan:()=>NH,startBrowserTracingPageLoadSpan:()=>MH,startInactiveSpan:()=>rO,startNewTrace:()=>oO,startSession:()=>qO,startSpan:()=>tO,startSpanManual:()=>nO,statsigIntegration:()=>CRe,supabaseIntegration:()=>BDe,suppressTracing:()=>Qwe,thirdPartyErrorFilterIntegration:()=>YDe,uiProfiler:()=>Jje,unleashIntegration:()=>bRe,updateSpanName:()=>Owe,viewHierarchyIntegration:()=>lNe,webVitalsIntegration:()=>DH,webWorkerIntegration:()=>TRe,withActiveSpan:()=>iO,withIsolationScope:()=>ZCe,withScope:()=>yE,withStreamedSpan:()=>Pwe,zodErrorsIntegration:()=>JDe}),PRe=100,FRe=5,IRe=[`ResizeObserver loop completed with undelivered notifications.`,`ResizeObserver loop limit exceeded`,`AbortError`,`The user aborted a request.`,`Network request failed`,`NetworkError when attempting to fetch resource.`,`Failed to fetch`,`ChunkLoadError`,`Loading chunk`,`Loading CSS chunk`,`Non-Error promise rejection captured with value: Object Not Found Matching Id`];function gU(e){if(e)for(let t of Object.keys(e))/token|secret|password|api[_-]?key/i.test(t)&&(e[t]=`[redacted]`)}function LRe(e){e.request?.url&&(e.request.url=e.request.url.replace(/([?&](?:code|token|access_token|state)=)[^&]+/gi,`$1[redacted]`)),gU(e.extra),gU(e.tags)}function RRe(e){let t=vU(e.version)??`0.0.0`,n=vU(e.commitHash);return n?`${e.appName}@${t}+${n}`:`${e.appName}@${t}`}function _U(e,t){for(let n of t){let t=vU(e[n]);if(t)return t}}function zRe(e){return yU(e.enabled)??e.defaultEnabled??!1}function BRe(e){let t=vU(e.dsn);return!t||zRe(e)===!1?null:{dsn:t,environment:vU(e.environment)??vU(e.defaultEnvironment)??`production`,release:vU(e.release)??vU(e.defaultRelease)??void 0,debug:yU(e.debug)??e.defaultDebug??!1,tracesSampleRate:xU(e.tracesSampleRate,e.defaultTracesSampleRate??.1),profilesSampleRate:bU(e.profilesSampleRate,e.defaultProfilesSampleRate),replaysSessionSampleRate:bU(e.replaysSessionSampleRate,e.defaultReplaysSessionSampleRate),replaysOnErrorSampleRate:bU(e.replaysOnErrorSampleRate,e.defaultReplaysOnErrorSampleRate),attachStacktrace:!0,maxBreadcrumbs:PRe,normalizeDepth:FRe,tags:VRe(e)}}function VRe(e){let t={app:e.appName,runtime:e.runtime};for(let[n,r]of Object.entries(e.tags??{})){let e=vU(r);e&&(t[n]=e)}return t}function vU(e){if(e==null)return null;let t=e.trim();return t.length>0?t:null}function yU(e){if(typeof e==`boolean`)return e;let t=vU(e);if(t){if(t===`1`||t.toLowerCase()===`true`)return!0;if(t===`0`||t.toLowerCase()===`false`)return!1}}function bU(e,t){if(t!==void 0||e!==void 0)return xU(e,t??0)}function xU(e,t){let n=HRe(e);return n===null||n<0||n>1?t:n}function HRe(e){if(typeof e==`number`)return Number.isFinite(e)?e:null;let t=vU(e);if(!t)return null;let n=Number.parseFloat(t);return Number.isFinite(n)?n:null}function URe(e){let t=(0,bi.c)(11),n;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=ct(ji,`bg-background text-foreground`),t[0]=n):n=t[0];let r;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(r=ct(ki,`pl-1 md:pl-2.5`),t[1]=r):r=t[1];let i;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,N.jsx)(Ni,{}),t[2]=i):i=t[2];let a;t[3]===e.onGoToNewChat?a=t[4]:(a=(0,N.jsx)(`div`,{className:r,children:(0,N.jsx)(`button`,{type:`button`,"aria-label":`Go to new chat`,onClick:e.onGoToNewChat,className:`${Ai} hover:bg-accent/70`,children:i})}),t[3]=e.onGoToNewChat,t[4]=a);let o;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,N.jsx)(`div`,{}),t[5]=o):o=t[5];let s;t[6]===a?s=t[7]:(s=(0,N.jsxs)(`header`,{className:Oi,children:[a,o]}),t[6]=a,t[7]=s);let c;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,N.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center px-4`,children:(0,N.jsxs)(`div`,{className:`max-w-md rounded-xl border border-border bg-card p-6 text-center shadow-lg`,children:[(0,N.jsx)(`h1`,{className:`text-xl font-semibold tracking-tight`,children:`Something went wrong.`}),(0,N.jsx)(`p`,{className:`mt-2 text-sm text-muted-foreground`,children:`Forge hit an unexpected error and reported it.`}),(0,N.jsx)(`button`,{className:`mt-4 inline-flex rounded-md border border-border px-3 py-2 text-sm font-medium hover:bg-accent`,onClick:WRe,type:`button`,children:`Reload app`})]})}),t[8]=c):c=t[8];let l;return t[9]===s?l=t[10]:(l=(0,N.jsxs)(`div`,{className:n,children:[s,c]}),t[9]=s,t[10]=l),l}function WRe(){return window.location.reload()}var GRe=[/\bDeepSeek\b/i,/\bKimi\b/i,/\bMoonshot\b/i,/\bdeepseek[-._a-z0-9]*\b/i,/\bkimi[-._a-z0-9]*\b/i,/\bmoonshot[-._a-z0-9]*\b/i,/\bAPEX_API_KEY\b/,/\bDEEPSEEK_API_KEY\b/,/\bKIMI_API_KEY\b/,/\bOPENAI_API_KEY\b/,/\bANTHROPIC_API_KEY\b/,/\bCURSOR_API_KEY\b/,/\bOPENCODE_API_KEY\b/,/\bforge_proxy_[A-Za-z0-9._-]+\b/,/\bProviderValidationError\b/,/\/forge-server\/node_modules\//,/https?:\/\/[^\s'"<>)]*\/api\/provider-egress\/[^\s'"<>)]*/i,/https?:\/\/[^\s'"<>)]*(?:apex|deepseek|moonshot|kimi)[^\s'"<>)]*/i],KRe=`CMMD is temporarily unavailable. Check the workspace AI connection and retry.`;function SU(e){if(!e)return!1;let t=e.toLowerCase();return/\b(rate[\s-]?limit|too\s+many\s+requests|usage[ _-]limit|usage_limit_reached|quota|insufficient_quota)\b/.test(t)||/\b429\b/.test(t)}function qRe(e){return/\bbound to provider account\b/.test(e)&&/\bcannot use provider account\b/.test(e)?`Forge could not switch this conversation to the selected AI account. Retry the account switch.`:/\bforge_runtime_repairing\b/.test(e)||/\bthis turn was interrupted because the environment is being repaired\b/.test(e)?`This turn was interrupted because the environment is being repaired. Retry after the repair finishes.`:/\bforge_runtime_stopped\b/.test(e)||/\bthis turn was interrupted because the environment was stopped\b/.test(e)?`This turn was interrupted because the environment was stopped. Start the environment and retry.`:null}function JRe(e){if(!e)return null;let t=e.toLowerCase(),n=qRe(t);return n===null?/\bforge_provider_model_not_allowed\b/.test(t)||/\bnot\s+scoped\s+to\s+the\s+requested\s+model\b/.test(t)?`The workspace AI credential does not cover the model this turn asked for. Retry, or pick that model for the thread.`:/\bmodel\b[\s\S]*\b(not\s+(found|available|supported)|does\s+not\s+exist|unsupported|invalid|unknown)\b/.test(t)||/\b(unsupported|unknown|invalid)\b[\s\S]*\bmodel\b/.test(t)||/\b(model_not_found|invalid_model|model_not_supported)\b/.test(t)?`The selected model isn't available right now. Pick a different model and retry.`:SU(t)?`The AI service is rate-limited or out of quota. Wait a moment and retry.`:/_credential_reconnect_required\b/.test(t)?`The workspace AI credential needs to be reconnected. Reconnect it in Settings > Providers, then retry.`:/\b(unauthorized|forbidden|authentication\s+(failed|error|required)|invalid\s+api\s+key|expired\s+(token|credential))\b/.test(t)||/\b40[13]\b/.test(t)?`Workspace AI authentication failed. Reconnect the workspace and retry.`:/\b(timed?\s*out|timeout|overloaded|service\s+unavailable)\b/.test(t)||/\b50[234]\b/.test(t)?`The AI service is temporarily overloaded. Retry in a moment.`:null:n}function YRe(e){return e?GRe.some(t=>t.test(e)):!1}function CU(e,t={}){if(e==null)return null;let n=e.trim();return n.length===0?null:YRe(n)?JRe(n)??t.fallback??`CMMD is temporarily unavailable. Check the workspace AI connection and retry.`:n}var XRe=[/\bSocketCloseError\b/i,/\bSocketOpenError\b/i,/\bSocketReadError\b/i,/\bRpcClientDefect:\s*Unknown socket error\b/i,/Unable to connect to the Forge server WebSocket\./i,/\bping timeout\b/i];function wU(e){if(typeof e!=`string`)return!1;let t=e.trim();return t.length!==0&&XRe.some(e=>e.test(t))}function TU(e){return wU(e)?null:CU(e,{fallback:KRe})}var ZRe=[/^Transport disposed$/,/WebSocket RPC request timed out after \d+ms\./],QRe=`Lost the connection to this Environment. Your message was not sent.`;function $Re(e){return e instanceof Error?wU(e.message)||ZRe.some(t=>t.test(e.message.trim()))?QRe:e.message:`Failed to send message.`}var EU=`forge-web`,DU=[`VITE_SENTRY_ENVIRONMENT`,`MODE`],OU=[`VITE_SENTRY_RELEASE`],eze=[`VITE_SENTRY_DSN`],tze=[`VITE_SENTRY_DEBUG`],nze=[`VITE_SENTRY_ENABLED`],rze=[`VITE_SENTRY_TRACES_SAMPLE_RATE`],ize=[`VITE_SENTRY_PROFILES_SAMPLE_RATE`],aze=[`VITE_SENTRY_REPLAYS_SESSION_SAMPLE_RATE`],oze=[`VITE_SENTRY_REPLAYS_ON_ERROR_SAMPLE_RATE`],sze=[`VITE_SENTRY_COMMIT_SHA`,`VITE_COMMIT_SHA`],kU=!1,AU={autoInject:!1,colorScheme:`system`,formTitle:`Report a Bug`,themeLight:{accentBackground:`oklch(0.52 0.19 48)`,accentForeground:`#ffffff`,background:`#ffffff`,boxShadow:`0 24px 80px rgba(0, 0, 0, 0.18)`,foreground:`#262626`,outline:`1px solid oklch(0.52 0.19 48)`},themeDark:{accentBackground:`oklch(0.62 0.2 47)`,accentForeground:`#ffffff`,background:`#171717`,boxShadow:`0 24px 80px rgba(0, 0, 0, 0.45)`,foreground:`#f5f5f5`,outline:`1px solid oklch(0.62 0.2 47)`}};function cze(e){let t=e.exception&&typeof e.exception==`object`&&`values`in e.exception&&Array.isArray(e.exception.values)?e.exception.values:[];return[typeof e.title==`string`?e.title:void 0,...t.flatMap(e=>{if(typeof e!=`object`||!e)return[];let t=e;return[typeof t.type==`string`?t.type:void 0,typeof t.value==`string`?t.value:void 0]})]}function lze(e){return(e.exception&&typeof e.exception==`object`&&`values`in e.exception&&Array.isArray(e.exception.values)?e.exception.values:[]).some(e=>{if(typeof e!=`object`||!e)return!1;let t=e;return typeof t.value!=`string`||!/All fibers interrupted without error/i.test(t.value)?!1:t.stacktrace?.frames?.some(e=>{let t=typeof e.filename==`string`?e.filename:``,n=typeof e.function==`string`?e.function:``;return t.includes(`src/rpc/wsTransport.ts`)&&n===`WsTransport.request`})})}function uze(e){return cze(e).some(wU)||lze(e)}function dze(){let e=new URL(window.location.href);Bn?e.hash=`/new`:(e.pathname=`/new`,e.search=``,e.hash=``),window.location.assign(e.toString())}function fze(){let e=Bn?`electron-renderer`:`browser`,t={APP_VERSION:`0.13.4`,BASE_URL:`/`,DEV:!1,MODE:`production`,PROD:!0,SSR:!1,TSS_INLINE_CSS_ENABLED:`false`,VITE_COMMIT_SHA:``,VITE_HOSTED_APP_CHANNEL:``,VITE_HTTP_URL:``,VITE_SENTRY_COMMIT_SHA:`9acfb6057470e43c02f81df6b16969f9edbbede4`,VITE_SENTRY_DEBUG:``,VITE_SENTRY_DSN:``,VITE_SENTRY_ENABLED:``,VITE_SENTRY_ENVIRONMENT:`production`,VITE_SENTRY_PROFILES_SAMPLE_RATE:``,VITE_SENTRY_RELEASE:`forge-web@0.13.4+9acfb6057470e43c02f81df6b16969f9edbbede4`,VITE_SENTRY_REPLAYS_ON_ERROR_SAMPLE_RATE:``,VITE_SENTRY_REPLAYS_SESSION_SAMPLE_RATE:``,VITE_SENTRY_TRACES_SAMPLE_RATE:``,VITE_WS_URL:``},n=_U(t,[...OU])??RRe({appName:EU,version:`0.13.4`,commitHash:_U(t,[...sze])});return BRe({appName:EU,runtime:e,defaultEnvironment:_U(t,[...DU])??`development`,defaultRelease:n,defaultEnabled:!0,defaultTracesSampleRate:0,defaultReplaysSessionSampleRate:0,defaultReplaysOnErrorSampleRate:0,enabled:_U(t,[...nze]),dsn:_U(t,[...eze]),environment:_U(t,[...DU]),release:_U(t,[...OU]),debug:_U(t,[...tze]),tracesSampleRate:_U(t,[...rze]),profilesSampleRate:_U(t,[...ize]),replaysSessionSampleRate:_U(t,[...aze]),replaysOnErrorSampleRate:_U(t,[...oze]),tags:{platform:Bn?`desktop`:`web`}})}function jU(e){return LRe(e),uze(e)?null:e}function pze(e){return{...e.replaysOnErrorSampleRate===void 0?{}:{replaysOnErrorSampleRate:e.replaysOnErrorSampleRate},...e.replaysSessionSampleRate===void 0?{}:{replaysSessionSampleRate:e.replaysSessionSampleRate}}}function MU(e){return{attachStacktrace:e.attachStacktrace,debug:e.debug,dsn:e.dsn,environment:e.environment,ignoreErrors:[...IRe],initialScope:{tags:e.tags},maxBreadcrumbs:e.maxBreadcrumbs,normalizeDepth:e.normalizeDepth,sendDefaultPii:!1,tracesSampleRate:e.tracesSampleRate,...e.release===void 0?{}:{release:e.release},...pze(e)}}function mze(e){let t=[];e.tracesSampleRate>0&&t.push(jH()),((e.replaysSessionSampleRate??0)>0||(e.replaysOnErrorSampleRate??0)>0)&&t.push(GV());let n=LI(AU);t.push(n);try{mU({...MU(e),beforeSend:e=>jU(e),integrations:t})}catch{return null}return kU=!0,hU}function hze(e){let t=[];e.tracesSampleRate>0&&t.push(yS()),((e.replaysSessionSampleRate??0)>0||(e.replaysOnErrorSampleRate??0)>0)&&t.push(xx());let n=Yh(AU);t.push(n);try{$S({...MU(e),beforeSend:e=>jU(e),integrations:t})}catch{return null}return kU=!0,Dw}function NU(){if(kU)return Bn?hU:Dw;let e=fze();return e?Bn?mze(e):hze(e):null}function PU(e){if(NU()){if(Bn){UO(e);return}ou(e)}}function FU(e,t,n){if(!NU())return;let r=gze(e);if(Bn){yE(e=>{t&&e.setTags(t);let i=zO(r);n?.showReportDialog&&LR({eventId:i})});return}ss(e=>{t&&e.setTags(t);let i=Xl(r);n?.showReportDialog&&iv({eventId:i})})}function gze(e){if(e instanceof Error)return e;if(typeof e==`string`&&e.trim().length>0)return Error(e);try{return Error(JSON.stringify(e))}catch{return Error(`Unknown non-Error exception`)}}var _ze=class extends M.Component{constructor(e){super(e),this.state={hasError:!1}}static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(e){FU(e,{origin:`react-boundary`},{showReportDialog:!0})}render(){return this.state.hasError?(0,N.jsx)(URe,{onGoToNewChat:dze}):this.props.children}},IU=!1,LU=!1,RU=null,zU=null,BU=null,VU=!1,HU=new Set;function vze(e){if(IU||LU)return;if(!e.publicKey||!e.host){LU=!0;return}if(RU)return;if(typeof window>`u`||typeof location>`u`){LU=!0;return}let t=e.publicKey,n=e.host;RU=A(async()=>{let{default:e}=await import(`./module-CPO4cjSm.js`);return{default:e}},[]).then(({default:e})=>{zU=e,e.init(t,{api_host:n,person_profiles:`identified_only`,capture_pageview:!1,capture_pageleave:!1,autocapture:!1,disable_session_recording:!0,loaded:()=>{IU=!0,BU&&UU(BU),WU(),HU.forEach(e=>e())}})}).catch(()=>{LU=!0,zU=null})}function UU(e){if(BU=e,!IU||!zU)return;let t={};e.email!==void 0&&(t.email=e.email),e.displayName!==void 0&&(t.name=e.displayName),zU.identify(e.cmmdUserId,t)}function yze(e){return!IU||!zU?!1:zU.isFeatureEnabled(e)===!0}function WU(){!zU||VU||(VU=!0,zU.onFeatureFlags(()=>{HU.forEach(e=>e())}))}function bze(e){return HU.add(e),IU&&zU&&(WU(),e()),()=>{HU.delete(e)}}var GU=`/api/cmmd/auth-runtime`;function xze(e){return j({method:`POST`,path:GU},e)}function Sze(e){return j({method:`GET`,path:GU},e)}function Cze(e){return j({method:`DELETE`,path:GU},e)}function wze(e){return j({method:`POST`,path:`${GU}/connect`},e)}function Tze(e,t){return j({method:`GET`,path:`/api/cmmd/billing`,...t?.organizationId===void 0?{}:{query:{orgId:t.organizationId}}},e)}function Eze(e,t){return j({method:`GET`,path:`/api/cmmd/billing/series`,query:{timeZone:t.timeZone}},e)}var KU=`/api/cmmd/providers/codex/credential`,qU=`/api/cmmd/providers/claude/credential`;function Dze(e){return j({method:`GET`,path:KU},e)}function Oze(e){return j({method:`DELETE`,path:KU},e)}function kze(e){return j({method:`GET`,path:qU},e)}function Aze(e){return j({method:`DELETE`,path:qU},e)}function jze(e,t){return j({method:`DELETE`,path:`/api/cmmd/providers/accounts/${encodeURIComponent(String(t))}`},e)}function Mze(e,t,n){return`/api/cmmd/threads/${encodeURIComponent(e)}/${encodeURIComponent(t)}/${encodeURIComponent(n)}/disposition`}function Nze(e,t,n,r,i){return j({method:`PUT`,path:Mze(t,n,r),body:i},e)}function Pze(e){return(t,n,r,i)=>Nze(e,t,n,r,i)}function JU(e,t=``){return`/api/cmmd/thread-attachments/${encodeURIComponent(e)}${t}`}function Fze(e){return{async listThreadAttachments(t){return j({method:`GET`,path:JU(t)},e)},async uploadThreadAttachment(t,n,r,i){let a=new FormData;return a.append(`file`,n),r!==void 0&&a.append(`attachmentId`,r),j({method:`POST`,path:JU(t),form:a,...i===void 0?{}:{signal:i}},e)},async getThreadAttachmentDownloadUrl(t,n){return j({method:`GET`,path:JU(t,`/${encodeURIComponent(n)}/download`)},e)},async deleteThreadAttachment(t,n){await j({method:`DELETE`,path:JU(t,`/${encodeURIComponent(n)}`)},e)}}}var Ize=class extends Error{constructor(e){super(e),this.name=`CmmdApiAuthError`}},Lze=class extends Error{status;constructor(e,t){super(e),this.name=`CmmdApiServerError`,this.status=t}};async function YU(e){try{return await e}catch(e){throw e instanceof xn?e.kind===`auth`?new Ize(e.message):new Lze(e.message,e.status??502):e}}function Rze(e,t,n){return`/api/cmmd/threads/${encodeURIComponent(e)}/${encodeURIComponent(t)}/${encodeURIComponent(n)}/archive`}function zze(e,t,n,r,i){return j({method:`POST`,path:Rze(t,n,r),body:i},e)}function Bze(e){return(t,n,r,i)=>zze(e,t,n,r,i)}function Vze(e){return typeof e==`object`&&!!e&&`status`in e&&e.status===409}async function Hze(e){let t={action:e.action,...e.operationId===void 0?{}:{operationId:e.operationId},expectedRevision:e.expectedRevision,force:e.force};try{return await e.submit(t)}catch(n){if(!Vze(n))throw n;let r=await e.refresh();return e.submit({...t,expectedRevision:r.revision})}}function Uze(e){return{getForgeAccountPreferences:()=>j({method:`GET`,path:`/api/cmmd/account/preferences`},e),updateForgeAccountPreferences:t=>j({method:`PATCH`,path:`/api/cmmd/account/preferences`,body:t},e),getUserSettings:t=>j({method:`GET`,path:`/api/cmmd/user/settings/${t}`},e),putUserSettings:(t,n)=>j({method:`PUT`,path:`/api/cmmd/user/settings/${t}`,body:n},e)}}function Wze(e,t,n){return j({method:`POST`,path:`/api/cmmd/forge-runtimes/${encodeURIComponent(t)}/rename`,body:{displayName:n}},e)}function Gze(e,t,n){return j({method:`POST`,path:`/api/cmmd/devices/${encodeURIComponent(String(t))}/rename`,body:{displayName:n}},e)}function Kze(e,t){return j({method:`POST`,path:`/api/cmmd/devices/${encodeURIComponent(String(t))}/revoke`},e)}function qze(e){return{...e?.projectId===void 0?{}:{projectId:String(e.projectId)},...e?.allWorkspaces===!0?{allWorkspaces:`true`}:{},...e?.organizationId===void 0?{}:{orgId:String(e.organizationId)}}}var XU=`rt-demo`,ZU=`th-demo`,QU=`example-project`,Jze=`example-conversation`,$U=`2026-09-26T20:00:00.000Z`;function Yze(e,t){return e===XU&&t===ZU}function Xze(){return{runtime:{id:XU,source:`forge-cloud`,runtimeKind:`cloud-vm`,displayName:`Example Forge Server`,status:`online`,endpointUrl:null,hostId:null,deviceId:null,workspaceRoot:null,githubRepoFullName:null,lastSeenAt:$U,reachability:{status:`online`,lastReachableAt:$U,source:`cloud-runtime`},metadata:null},inventoryStatus:`synced`,inventoryPublishedAt:$U,projectCount:1,threadCount:1,projects:[{projectId:QU,title:`Example project`,workspaceRoot:null,githubRepoFullName:null,branch:null,status:`active`,threadCount:1,lastActivityAt:$U,metadata:null,publishedAt:$U,updatedAt:$U,threads:[{threadId:ZU,title:`Example thread (viewer check)`,status:`active`,model:null,provider:null,providerAccountId:null,branch:null,lastMessagePreview:null,lastActivityAt:$U,kind:`master`,parentThreadId:null,workerRole:null,anchorKind:`scratch`,anchorCmmdId:null,archive:null,disposition:{manualDisposition:null,automaticDisposition:null,effectiveDisposition:null,revision:null,source:null},metadata:null,publishedAt:$U,updatedAt:$U}]}]}}function Zze(){return{conversationId:Jze,runtime:{id:XU,source:`forge-cloud`,runtimeKind:`cloud-vm`,displayName:`Example Forge Server`,status:`online`,endpointUrl:null,deviceId:null,workspaceRoot:null,githubRepoFullName:null,lastSeenAt:$U,metadata:null},project:{projectId:QU,title:`Example project`,githubRepoFullName:null,branch:null},thread:{threadId:ZU,title:`Example thread (viewer check)`,status:`active`,model:null,provider:null,providerAccountId:null,branch:null,lastActivityAt:$U,metadata:null},reachability:`online`,execution:{available:!0,reason:null},replication:null,events:[{sequence:1,eventId:`example-user-1`,kind:`user_message`,turnId:null,text:`This is an example chat thread for verifying the Forge embed viewer. It is not a live Work Session.`,status:null,occurredAt:`2026-09-26T19:58:00.000Z`},{sequence:2,eventId:`example-assistant-1`,kind:`assistant_message`,turnId:null,text:`Understood. You should see this reply in the iframe under CMMD /forge, with the composer still available below.`,status:null,occurredAt:`2026-09-26T19:59:00.000Z`},{sequence:3,eventId:`example-user-2`,kind:`user_message`,turnId:null,text:`Thanks. If these three turns render, the thread wire is working.`,status:null,occurredAt:$U}]}}function Qze(e){return e.runtimes.some(e=>e.runtime.id===XU)?{...e,runtimes:[...e.runtimes]}:{...e,runtimes:[...e.runtimes,Xze()]}}function eW(e,t){if(!e||typeof e!=`object`)return null;let n=e[t];return typeof n==`string`&&n.trim().length>0?n.trim():null}function $ze(e,t){if(!e||typeof e!=`object`)return null;let n=e[t];return typeof n==`boolean`?n:null}function tW(e,t){if(!e||typeof e!=`object`)return null;let n=e[t];return typeof n==`string`&&n.trim().length>0?n.trim():typeof n==`number`&&Number.isFinite(n)?String(n):null}function nW(e){return{...e.limit===void 0?{}:{limit:e.limit},...e.cursor?{cursor:e.cursor}:{}}}var rW=class extends Error{constructor(e){super(`CmmdApiClient.${e} is not implemented yet`),this.name=`CmmdApiNotImplementedError`}};function iW(e,t){if(Array.isArray(e))return e;if(e&&typeof e==`object`){let n=e[t];if(Array.isArray(n))return n}return[]}function aW(e,t){if(Array.isArray(e))return e;if(e&&typeof e==`object`){let n=e[t];if(Array.isArray(n))return n}return[]}function oW(e,t){let n={};return e?.organizationId&&(n.orgId=e.organizationId),t!==void 0&&(n.taskId=String(t)),Object.keys(n).length>0?n:void 0}function sW(e){let t=`${eW(e,`firstName`)??``} ${eW(e,`lastName`)??``}`.trim()||eW(e,`username`)||eW(e,`email`)||`Unknown`;return{id:tW(e,`userId`)??tW(e,`id`)??t,name:t,email:eW(e,`email`),role:eW(e,`role`),avatarUrl:eW(e,`profileImage`)??eW(e,`avatar`)}}function eBe(e){let t=lW(e,`user`)??e;return sW({...typeof t==`object`&&t?t:{},userId:tW(e,`userId`)??tW(t,`id`),role:eW(e,`role`)})}function cW(e){let t=eW(e,`authorFirstName`)??``,n=eW(e,`authorLastName`)??``,r=eW(e,`status`),i=r===`at_risk`||r===`off_track`||r===`complete`?r:`on_track`;return{id:tW(e,`id`)??``,status:i,body:eW(e,`body`)??``,authorName:`${t} ${n}`.trim()||null,authorAvatarUrl:eW(e,`authorProfileImage`)??null,createdAt:eW(e,`createdAt`)??``,updatedAt:eW(e,`updatedAt`)??eW(e,`createdAt`)??``,canEdit:$ze(e,`canEdit`)??!1}}function tBe(e,t,n){let r=Array.isArray(e.data)?e.data.map(cW):[];return{updates:r,pagination:e.pagination??{page:t,limit:n,total:r.length,hasMore:!1}}}function lW(e,t){if(!e||typeof e!=`object`)return null;let n=e[t];return n&&typeof n==`object`?n:null}var nBe=[`avatarUrl`,`avatar_url`,`profileImage`,`profile_image`,`profileImageUrl`,`profile_image_url`,`image`,`imageUrl`,`image_url`,`picture`];function uW(e,t){let n=lW(e,t);if(!n)return null;for(let e of nBe){let t=eW(n,e);if(t)return t}return null}function dW(e,t){let n=lW(e,t);return n?tW(n,`id`):null}function fW(e,t){return!!(e&&typeof e==`object`&&Object.hasOwn(e,t))}function rBe(e){let t={...e,id:tW(e,`id`)??e.id,title:e.title??eW(e,`name`)??``},n=tW(e,`workspaceId`)??tW(e,`workspace_id`)??dW(e,`workspace`)??e.workspaceId??null;return n!==null||fW(e,`workspaceId`)?{...t,workspaceId:n,startDate:e.startDate??eW(e,`start_date`)??null,endDate:e.endDate??eW(e,`end_date`)??null}:t}function pW(e){let t=e.ownerAvatarUrl??eW(e,`owner_avatar_url`)??eW(e,`ownerProfileImage`)??eW(e,`owner_profile_image`)??eW(e,`ownerImage`)??eW(e,`owner_image`)??eW(e,`ownerImageUrl`)??eW(e,`owner_image_url`)??eW(e,`createdByAvatarUrl`)??eW(e,`created_by_avatar_url`)??eW(e,`createdByProfileImage`)??eW(e,`created_by_profile_image`)??uW(e,`owner`)??uW(e,`createdBy`)??uW(e,`created_by`)??null,n={...e,id:tW(e,`id`)??e.id},r=tW(e,`campaignId`)??tW(e,`campaign_id`)??dW(e,`campaign`)??e.campaignId??null;(r!==null||fW(e,`campaignId`))&&(n.campaignId=r);let i=e.campaignTitle??eW(e,`campaignTitle`)??eW(e,`campaign_title`)??eW(lW(e,`campaign`),`title`)??eW(lW(e,`campaign`),`name`)??null;(i!==null||fW(e,`campaignTitle`))&&(n.campaignTitle=i);let a=tW(e,`workspaceId`)??tW(e,`workspace_id`)??dW(e,`workspace`)??e.workspaceId??null;(a!==null||fW(e,`workspaceId`))&&(n.workspaceId=a);let o=e.workspaceName??eW(e,`workspace_name`)??eW(lW(e,`workspace`),`name`)??null;(o!==null||fW(e,`workspaceName`))&&(n.workspaceName=o);let s=eW(e,`workspaceIconUrl`)??eW(e,`workspace_icon_url`)??eW(lW(e,`workspace`),`iconUrl`)??null;(s!==null||fW(e,`workspaceIconUrl`))&&(n.workspaceIconUrl=s);let c=tW(e,`ownerId`)??tW(e,`owner_id`)??dW(e,`owner`)??e.ownerId??null;(c!==null||fW(e,`ownerId`))&&(n.ownerId=c);let l=e.ownerName??eW(e,`owner_name`)??eW(lW(e,`owner`),`name`)??null;(l!==null||fW(e,`ownerName`))&&(n.ownerName=l),(t!==null||fW(e,`ownerAvatarUrl`))&&(n.ownerAvatarUrl=t);let u=tW(e,`teamId`)??tW(e,`team_id`)??dW(e,`team`)??e.teamId??null;(u!==null||fW(e,`teamId`))&&(n.teamId=u);let d=e.teamName??eW(e,`team_name`)??eW(lW(e,`team`),`name`)??null;(d!==null||fW(e,`teamName`))&&(n.teamName=d);let f=e.startDate??eW(e,`start_date`)??null;(f!==null||fW(e,`startDate`))&&(n.startDate=f);let p=e.targetEndDate??eW(e,`target_end_date`)??null;return(p!==null||fW(e,`targetEndDate`))&&(n.targetEndDate=p),n}function mW(e){if(Array.isArray(e))return e;if(e&&typeof e==`object`){let t=e;if(Array.isArray(t.items))return t.items;if(Array.isArray(t.results))return t.results}return[]}function iBe(e){return mW(e).flatMap(e=>{let t=e,n=typeof t.id==`number`?t.id:null,r=typeof t.name==`string`?t.name:null;if(n===null||r===null)return[];let i=e=>typeof t[e]==`string`?t[e]:null;return[{id:n,name:r,startDate:i(`startDate`),endDate:i(`endDate`),status:i(`status`)}]})}function aBe(e){if(e&&typeof e==`object`){let t=e;if(t.project&&typeof t.project==`object`)return t.project}return e}function hW(e){if(e===null||e.trim()===``)return null;let t=Number(e);return Number.isSafeInteger(t)?t:e}var gW=class e{cfg;putThreadDisposition;listThreadAttachments;uploadThreadAttachment;getThreadAttachmentDownloadUrl;deleteThreadAttachment;postThreadArchive;getForgeAccountPreferences;updateForgeAccountPreferences;getUserSettings;putUserSettings;commentEditIdempotencyKeys=new Map;commentDeleteIdempotencyKeys=new Map;constructor(e={}){let t=e.forgeOrigin===void 0,n=e.forgeOrigin??`http://localhost:13773`;this.cfg={resolveUrl:t?ln:e=>`${n}${e}`,maxRetries:e.maxRetries??3,onAuthExpired:e.onAuthExpired??_n,...t?{resolveBearerToken:()=>mn()?.bearerToken??null}:{}},this.putThreadDisposition=Pze(this.cfg);let r=Fze(this.cfg);this.listThreadAttachments=r.listThreadAttachments,this.uploadThreadAttachment=r.uploadThreadAttachment,this.getThreadAttachmentDownloadUrl=r.getThreadAttachmentDownloadUrl,this.deleteThreadAttachment=r.deleteThreadAttachment,this.postThreadArchive=Bze(this.cfg);let i=Uze(this.cfg);this.getForgeAccountPreferences=i.getForgeAccountPreferences,this.updateForgeAccountPreferences=i.updateForgeAccountPreferences,this.getUserSettings=i.getUserSettings,this.putUserSettings=i.putUserSettings}async getTask(e){return YU(j({method:`GET`,path:`/api/cmmd/tasks/${e}`},this.cfg))}async getForgeTaskDetail(e){return j({method:`GET`,path:`/api/cmmd/tasks/${e}`},this.cfg)}async searchTasks(e){let t={q:e.q};return e.status&&(t.status=e.status),e.limit!==void 0&&(t.limit=e.limit),e.projectId&&(t.projectId=e.projectId),(await YU(j({method:`GET`,path:`/api/cmmd/tasks/search`,query:t},this.cfg))).tasks??[]}async getTaskComments(e){return(await YU(j({method:`GET`,path:`/api/cmmd/tasks/${e}/comments`},this.cfg))).comments??[]}async listProjectTaskComments(e){return(await YU(j({method:`GET`,path:`/api/cmmd/tasks/${e}/comments`},this.cfg))).comments??[]}async createProjectTaskComment(e,t){return(await YU(j({method:`POST`,path:`/api/cmmd/tasks/comment`,body:{taskId:e,content:t.content}},this.cfg))).details}async updateProjectTaskComment(e,t,n){return(await YU(j({method:`PATCH`,path:`/api/cmmd/tasks/${e}/comments/${encodeURIComponent(t)}`,body:n},this.cfg))).comment}async deleteProjectTaskComment(e,t,n){return YU(j({method:`DELETE`,path:`/api/cmmd/tasks/${e}/comments/${encodeURIComponent(t)}`,body:n},this.cfg))}async getTaskAttachments(e){return YU(j({method:`GET`,path:`/api/cmmd/tasks/${e}/attachments`},this.cfg))}async getProjectRepository(e){return YU(j({method:`GET`,path:`/api/cmmd/projects/${e}/repository`},this.cfg))}async listProjectRepositories(e){return(await YU(j({method:`GET`,path:`/api/cmmd/projects/${e}/repositories`},this.cfg))).repositories}async getWorkspaceMembers(e){return YU(j({method:`GET`,path:`/api/cmmd/organizations/${e}/members`},this.cfg))}async getWebSocketToken(e){return j({method:`GET`,path:`/api/cmmd/ws-token`,...e?.signal===void 0?{}:{signal:e.signal}},this.cfg)}async getProjectComments(e,t){let n={};return t?.organizationId&&(n.organizationId=t.organizationId),(await j({method:`GET`,path:`/api/cmmd/projects/${e}/comments`,query:n},this.cfg))?.comments??[]}async getProjectLink(e){return j({method:`GET`,path:`/.well-known/forge/project-link`,query:{environmentId:e.environmentId,projectId:e.projectId,cwd:e.cwd}},this.cfg)}async listProjectLinks(){return j({method:`GET`,path:`/.well-known/forge/project-links`,suppressBearerToken:!0},this.cfg)}async listProjectContextLinks(e){let t={};e.environmentId&&(t.forgeEnvironmentId=e.environmentId),e.projectId&&(t.forgeProjectId=e.projectId),e.githubRepoFullName&&(t.githubRepoFullName=e.githubRepoFullName),e.cmmdOrganizationId&&(t.cmmdOrganizationId=e.cmmdOrganizationId);let n=await j({method:`GET`,path:`/.well-known/forge/cmmd/project-links`,query:t},this.cfg),r=dte(cte)(n);return r._tag===`Some`?r.value.links:[]}async listCmmdWorkspaces(){return mW(await j({method:`GET`,path:`/.well-known/forge/cmmd/workspaces`},this.cfg))}async listCmmdCampaigns(e){return iBe(await j({method:`GET`,path:`/.well-known/forge/cmmd/campaigns`,query:{workspaceId:e.workspaceId}},this.cfg))}async listCmmdProjects(e){return mW(await j({method:`GET`,path:`/.well-known/forge/cmmd/projects`,query:{campaignId:e.campaignId}},this.cfg))}async updateTask(e,t){let n={taskId:e};return t.title!==void 0&&(n.title=t.title),t.description!==void 0&&(n.description=t.description),t.status!==void 0&&(n.status=t.status),t.priority!==void 0&&(n.priority=t.priority),t.dueDate!==void 0&&(n.dueDate=t.dueDate),t.assigneeId!==void 0&&(n.assigneeId=t.assigneeId),t.labels!==void 0&&(n.labels=t.labels),YU(j({method:`POST`,path:`/api/cmmd/tasks/update`,body:n},this.cfg))}async createComment(e){return YU(j({method:`POST`,path:`/api/cmmd/tasks/comment`,body:{taskId:e.entityId,content:e.content}},this.cfg))}async updateComment(e,t,n){let r=`${e}:${t}:${n}`,i=this.commentEditIdempotencyKeys.get(r)??crypto.randomUUID();this.commentEditIdempotencyKeys.set(r,i);let a=await YU(j({method:`PATCH`,path:`/api/cmmd/tasks/${e}/comments/${t}`,body:{content:n,idempotencyKey:i}},this.cfg));return this.commentEditIdempotencyKeys.delete(r),a}async deleteComment(e,t){let n=`${e}:${t}`,r=this.commentDeleteIdempotencyKeys.get(n)??crypto.randomUUID();this.commentDeleteIdempotencyKeys.set(n,r),await YU(j({method:`DELETE`,path:`/api/cmmd/tasks/${e}/comments/${t}`,body:{idempotencyKey:r}},this.cfg)),this.commentDeleteIdempotencyKeys.delete(n)}async createProjectComment(e,t){let n=(await j({method:`POST`,path:`/api/cmmd/projects/${e}/comments`,body:{content:t.content,organizationId:t.organizationId??null}},this.cfg))?.comment;if(!n)throw new xn({kind:`server`,message:`CMMD did not return the created project comment.`});return n}async updateProject(e,t){let n={};for(let e of wte){let r=t[e];r!==void 0&&(n[e]=kte[e]===`nullableId`?hW(r):r)}await j({method:`PATCH`,path:`/api/cmmd/projects/${e}`,body:n},this.cfg)}async setProjectLink(e){await j({method:`POST`,path:`/.well-known/forge/project-link`,body:e},this.cfg)}async deleteProjectLink(e){await j({method:`DELETE`,path:`/.well-known/forge/project-link`,query:{environmentId:e.environmentId,projectId:e.projectId,cwd:e.cwd,...e.cmmdProjectId?{cmmdProjectId:e.cmmdProjectId}:{}}},this.cfg)}async createCmmdProject(e){return j({method:`POST`,path:`/.well-known/forge/cmmd/projects`,body:e},this.cfg)}async ensureGitHubProjectContext(e){return j({method:`POST`,path:`/.well-known/forge/cmmd/github-project-contexts/ensure`,body:e},this.cfg)}async createBrainDoc(e){return j({method:`POST`,path:`/api/cmmd/brain-docs`,body:e},this.cfg)}async uploadTaskAttachment(e,t){let n=new FormData;return n.append(`file`,t),YU(j({method:`POST`,path:`/api/cmmd/tasks/${e}/attachments`,form:n},this.cfg))}async archiveTask(e){await j({method:`POST`,path:`/api/cmmd/tasks/${e}/archive`},this.cfg)}async unarchiveTask(e){await j({method:`POST`,path:`/api/cmmd/tasks/${e}/unarchive`},this.cfg)}async getProfile(){return j({method:`GET`,path:`/api/cmmd/profile`},this.cfg)}async getUsageSummary(e){return j({method:`GET`,path:`/api/cmmd/usage/summary`,query:{sinceDay:e.sinceDay,untilDay:e.untilDay,timeZone:e.timeZone,...e.resolution===`hour`?{resolution:e.resolution,sinceTime:e.sinceTime,untilTime:e.untilTime}:{}}},this.cfg)}getBilling(e){return Tze(this.cfg,e)}getBillingSeries(e){return Eze(this.cfg,e)}async getBootstrap(){return j({method:`GET`,path:`/api/cmmd/bootstrap`},this.cfg)}async getOrgProviderPolicy(){return j({method:`GET`,path:`/api/cmmd/org/provider-policy`},this.cfg)}async listSavedDataViews(e){return j({method:`GET`,path:`/api/cmmd/saved-views`,query:{surface:e.surface,projectId:e.projectId}},this.cfg)}async createSavedDataView(e){return j({method:`POST`,path:`/api/cmmd/saved-views`,body:e},this.cfg)}async importSavedDataView(e){return j({method:`POST`,path:`/api/cmmd/saved-views/import`,body:e},this.cfg)}async updateSavedDataView(e,t){return j({method:`PATCH`,path:`/api/cmmd/saved-views/${encodeURIComponent(e)}`,body:t},this.cfg)}async deleteSavedDataView(e,t){return j({method:`DELETE`,path:`/api/cmmd/saved-views/${encodeURIComponent(e)}`,query:t},this.cfg)}async getDeviceRegistry(e){return j({method:`GET`,path:`/api/cmmd/devices`,...e?.projectId===void 0?{}:{query:{projectId:String(e.projectId)}},...e?.signal===void 0?{}:{signal:e.signal}},this.cfg)}async registerDevice(e){return j({method:`POST`,path:`/api/cmmd/devices/register`,body:e},this.cfg)}async grantRuntimeAccess(e,t){return j({method:`POST`,path:`/api/cmmd/devices/runtimes/${encodeURIComponent(e)}/access-grants`,body:t},this.cfg)}async revokeRuntimeAccess(e,t){return j({method:`POST`,path:`/api/cmmd/devices/runtimes/${encodeURIComponent(e)}/access-grants/${encodeURIComponent(String(t))}/revoke`},this.cfg)}async issueRelayControlRoute(e,t){return j({method:`POST`,path:`/api/cmmd/devices/runtimes/${encodeURIComponent(e)}/relay-routes`,body:t},this.cfg)}async issueRelayActionGrant(e,t){return j({method:`POST`,path:`/api/cmmd/devices/runtimes/${encodeURIComponent(e)}/relay-action-grants`,body:t},this.cfg)}async getRuntimeInventory(e){let t=qze(e);return Qze(await j({method:`GET`,path:`/api/cmmd/runtime-inventory`,...Object.keys(t).length>0?{query:t}:{}},this.cfg))}async getRuntimeDiagnostics(e){return j({method:`GET`,path:`/api/cmmd/runtime-diagnostics/v2/runtimes/${encodeURIComponent(e)}`},this.cfg)}async getCloudProjectLifecyclePreflight(e){return(await j({method:`GET`,path:`/api/cmmd/forge-cloud-projects/${encodeURIComponent(String(e))}/lifecycle-preflight`},this.cfg)).preflight}async replaceRuntimeInventory(e,t){return j({method:`PUT`,path:`/api/cmmd/devices/runtimes/${encodeURIComponent(e)}/inventory`,body:t},this.cfg)}static PROVIDER_ACCOUNTS_PATH=`/api/cmmd/providers/accounts`;static PROVIDER_USAGE_PATH=`/api/cmmd/providers/usage`;static PROVIDER_USAGE_REFRESH_PATH=`/api/cmmd/providers/usage/refresh`;provisionAuthRuntime(){return xze(this.cfg)}getAuthRuntimeState(){return Sze(this.cfg)}destroyAuthRuntime(){return Cze(this.cfg)}connectAuthRuntime(){return wze(this.cfg)}getUserCodexCredential(){return Dze(this.cfg)}disconnectUserCodexCredential(){return Oze(this.cfg)}getUserClaudeCredential(){return kze(this.cfg)}async getProviderAccounts(){return j({method:`GET`,path:e.PROVIDER_ACCOUNTS_PATH},this.cfg)}async removeLinkedProviderAccount(e){return jze(this.cfg,e)}async setProviderAccountDefault(t){return j({method:`PUT`,path:`${e.PROVIDER_ACCOUNTS_PATH}/default`,body:{provider:t.provider,provider_account_id:t.providerAccountId}},this.cfg)}async getProviderUsage(){return j({method:`GET`,path:e.PROVIDER_USAGE_PATH},this.cfg)}async refreshProviderUsage(t,n){return j({method:`POST`,path:e.PROVIDER_USAGE_REFRESH_PATH,body:{provider:t,providerAccountId:n}},this.cfg)}disconnectUserClaudeCredential(){return Aze(this.cfg)}async getClaudeRuntimeReadiness(e){return j({method:`GET`,path:`/api/cmmd/providers/claude/runtime-readiness/${encodeURIComponent(e)}`},this.cfg)}async appendRuntimeThreadEvents(e,t,n){return j({method:`POST`,path:`/api/cmmd/devices/runtimes/${encodeURIComponent(e)}/threads/${encodeURIComponent(t)}/events`,body:n},this.cfg)}async getRuntimeThreadReplica(e,t){return Yze(e,t)?Zze():j({method:`GET`,path:`/api/cmmd/threads/${encodeURIComponent(e)}/${encodeURIComponent(t)}`},this.cfg)}renameCloudEnvironment(e,t){return Wze(this.cfg,e,t)}renameDevice(e,t){return Gze(this.cfg,e,t)}revokeDevice(e){return Kze(this.cfg,e)}static SIM_PATH=`/api/cmmd/sim-host`;static simScope(e){return e?.orgId===void 0?``:`?orgId=${encodeURIComponent(String(e.orgId))}`}async listSimHosts(t){return j({method:`GET`,path:`${e.SIM_PATH}/hosts${e.simScope(t)}`},this.cfg)}async getSimLease(t){let n=new URLSearchParams({forgeEnvironmentId:t.forgeEnvironmentId,threadId:t.threadId,...t.orgId===void 0?{}:{orgId:String(t.orgId)}});return j({method:`GET`,path:`${e.SIM_PATH}/leases?${n.toString()}`},this.cfg)}async claimSimLease(t){return j({method:`POST`,path:`${e.SIM_PATH}/leases${e.simScope(t)}`,body:{hostId:t.hostId,forgeEnvironmentId:t.forgeEnvironmentId,threadId:t.threadId,ttlMs:t.ttlMs}},this.cfg)}async renewSimLease(t){return j({method:`POST`,path:`${e.SIM_PATH}/leases/${encodeURIComponent(String(t.leaseId))}/renew${e.simScope(t)}`,body:{generation:t.generation,rowVersion:t.rowVersion,ttlMs:t.ttlMs}},this.cfg)}async releaseSimLease(t){await j({method:`POST`,path:`${e.SIM_PATH}/leases/${encodeURIComponent(String(t.leaseId))}/release${e.simScope(t)}`,body:{generation:t.generation,rowVersion:t.rowVersion}},this.cfg)}async listCampaigns(e){let t={};return e?.orgId&&(t.orgId=e.orgId),e?.allWorkspaces&&(t.allWorkspaces=`true`),iW(await j({method:`GET`,path:`/api/cmmd/campaigns`,query:t,...e?.signal?{signal:e.signal}:{}},this.cfg),`campaigns`).map(rBe)}async getCampaign(e){return j({method:`GET`,path:`/api/cmmd/campaigns/${e}`},this.cfg)}async createCampaign(e){return j({method:`POST`,path:`/api/cmmd/campaigns`,body:e},this.cfg)}async updateCampaign(e,t){return j({method:`PUT`,path:`/api/cmmd/campaigns/${e}`,body:t},this.cfg)}async deleteCampaign(e){await j({method:`DELETE`,path:`/api/cmmd/campaigns/${e}`},this.cfg)}async listProjects(e){let t={};return e?.campaignId&&(t.campaignId=e.campaignId),e?.orgId&&(t.orgId=e.orgId),e?.allWorkspaces&&(t.allWorkspaces=`true`),iW(await j({method:`GET`,path:`/api/cmmd/projects`,query:t,...e?.signal?{signal:e.signal}:{}},this.cfg),`projects`).map(pW)}async listTasks(e){let t={};return e?.projectId&&(t.projectId=e.projectId),e?.status&&(t.status=e.status),j({method:`GET`,path:`/api/cmmd/tasks`,query:t},this.cfg)}async getProject(e){return pW(await j({method:`GET`,path:`/api/cmmd/projects/${e}`},this.cfg))}async getProjectMembers(e){let t=await j({method:`GET`,path:`/api/cmmd/projects/${e}/members`},this.cfg);return Array.isArray(t)?t.map(sW):[]}async listWorkspaceMembers(){let e=await j({method:`GET`,path:`/api/cmmd/members`},this.cfg);return Array.isArray(e)?e.map(eBe):[]}async addProjectMember(e,t){return j({method:`POST`,path:`/api/cmmd/projects/${e}/members`,body:t},this.cfg)}async listProjectAgentMembers(e){return j({method:`GET`,path:`/api/cmmd/projects/${e}/agent-members`},this.cfg)}async createProjectAgentMember(e,t){return j({method:`POST`,path:`/api/cmmd/projects/${e}/agent-members`,body:t},this.cfg)}async renameProjectAgentMember(e,t,n){return j({method:`PATCH`,path:`/api/cmmd/projects/${e}/agent-members/${t}`,body:n},this.cfg)}async retireProjectAgentMember(e,t,n){return j({method:`POST`,path:`/api/cmmd/projects/${e}/agent-members/${t}/retire`,body:n},this.cfg)}async updateProjectAgentMemberAvatar(e,t,n){return j({method:`PUT`,path:`/api/cmmd/projects/${e}/agent-members/${t}/avatar`,body:n},this.cfg)}async listProjectAgentMemberInstances(e,t){return j({method:`GET`,path:`/api/cmmd/projects/${e}/agent-members/${t}/instances`},this.cfg)}async previewProjectAgentMemberConsolidation(e){return j({method:`POST`,path:`/api/cmmd/projects/${e}/agent-members/consolidation/preview`},this.cfg)}async applyProjectAgentMemberConsolidation(e,t){return j({method:`POST`,path:`/api/cmmd/projects/${e}/agent-members/consolidation/apply`,body:t},this.cfg)}async setProjectTaskAssignment(e,t,n){return j({method:`PUT`,path:`/api/cmmd/projects/${e}/tasks/${t}/assignment`,body:n},this.cfg)}async getProjectUpdates(e,t){let n=t?.page??1,r=t?.limit??10;return tBe(await j({method:`GET`,path:`/api/cmmd/projects/${e}/updates`,query:{page:n,limit:r},unwrapEnvelope:!1},this.cfg),n,r)}async createProjectUpdate(e,t){return cW(await j({method:`POST`,path:`/api/cmmd/projects/${e}/updates`,body:t},this.cfg))}async updateProjectUpdate(e,t,n){return cW(await j({method:`PATCH`,path:`/api/cmmd/projects/${e}/updates/${t}`,body:n},this.cfg))}async deleteProjectUpdate(e,t){await j({method:`DELETE`,path:`/api/cmmd/projects/${e}/updates/${t}`},this.cfg)}async listProjectMilestones(e){return j({method:`GET`,path:`/api/cmmd/projects/${e}/milestones`},this.cfg)}async createProjectMilestone(e,t){return j({method:`POST`,path:`/api/cmmd/projects/${e}/milestones`,body:t},this.cfg)}async updateProjectMilestone(e,t,n){return j({method:`PATCH`,path:`/api/cmmd/projects/${e}/milestones/${t}`,body:n},this.cfg)}async deleteProjectMilestone(e,t){await j({method:`DELETE`,path:`/api/cmmd/projects/${e}/milestones/${t}`},this.cfg)}async improveProjectContent(e,t){return j({method:`POST`,path:`/api/cmmd/projects/${e}/content/readability`,body:t},this.cfg)}async listProjectBoard(e){return j({method:`GET`,path:`/api/cmmd/projects/${e}/board`},this.cfg)}async createProjectTaskDraft(e,t){return j({method:`POST`,path:`/api/cmmd/projects/${e}/task-drafts`,body:t},this.cfg)}async getProjectTaskDraft(e,t){return j({method:`GET`,path:`/api/cmmd/projects/${e}/task-drafts/${t}`},this.cfg)}async updateProjectTaskDraft(e,t,n){return j({method:`PATCH`,path:`/api/cmmd/projects/${e}/task-drafts/${t}`,body:n},this.cfg)}async previewProjectTaskDraft(e,t,n){return j({method:`POST`,path:`/api/cmmd/projects/${e}/task-drafts/${t}/preview`,body:n},this.cfg)}async commitProjectTaskDraft(e,t,n){return j({method:`POST`,path:`/api/cmmd/projects/${e}/task-drafts/${t}/commit`,body:n},this.cfg)}async discardProjectTaskDraft(e,t,n){return j({method:`POST`,path:`/api/cmmd/projects/${e}/task-drafts/${t}/discard`,body:n},this.cfg)}async getProjectTaskWorkflow(e){return j({method:`GET`,path:`/api/cmmd/projects/${e}/task-workflow`},this.cfg)}async updateProjectTaskWorkflow(e,t){return j({method:`PUT`,path:`/api/cmmd/projects/${e}/task-workflow`,body:t},this.cfg)}async getProjectLeadPlan(e){return j({method:`GET`,path:`/api/cmmd/projects/${e}/project-lead/plan`},this.cfg)}async activateProjectLeadAutomaticStaffing(e){return j({method:`POST`,path:`/api/cmmd/projects/${e}/project-lead/authority/activate`,body:{}},this.cfg)}async getProjectLeadReadiness(e){return j({method:`GET`,path:`/api/cmmd/projects/${e}/project-lead/readiness`},this.cfg)}async getProjectLeadCapabilities(e){return j({method:`GET`,path:`/api/cmmd/projects/${e}/project-lead/capabilities`},this.cfg)}async getProjectLeadSummary(e){return j({method:`GET`,path:`/api/cmmd/projects/${e}/project-lead/summary`},this.cfg)}async getProjectLeadDetail(e){return j({method:`GET`,path:`/api/cmmd/projects/${e}/project-lead/detail`},this.cfg)}async getProjectLeadBriefing(e){return j({method:`GET`,path:`/api/cmmd/projects/${e}/project-lead/briefing`},this.cfg)}async decideProjectLeadApproval(e,t,n){return j({method:`POST`,path:`/api/cmmd/projects/${e}/project-lead/approvals/${t}/decision`,body:n},this.cfg)}async listProjectLeadEvents(e,t){return j({method:`GET`,path:`/api/cmmd/projects/${e}/project-lead/events`,...t?{query:{...t.afterEventId===void 0?{}:{afterEventId:String(t.afterEventId)},...t.latest===void 0?{}:{latest:String(t.latest)},...t.limit===void 0?{}:{limit:String(t.limit)}}}:{}},this.cfg)}async explainProjectLead(e){return j({method:`GET`,path:`/api/cmmd/projects/${e}/project-lead/explain`},this.cfg)}async pauseProjectLead(e,t){return j({method:`POST`,path:`/api/cmmd/projects/${e}/project-lead/pause`,body:t},this.cfg)}async resumeProjectLead(e,t){return j({method:`POST`,path:`/api/cmmd/projects/${e}/project-lead/resume`,body:t},this.cfg)}async reserveProjectLeadTask(e,t,n){return j({method:`POST`,path:`/api/cmmd/projects/${e}/project-lead/tasks/${t}/reservations`,body:n},this.cfg)}async releaseProjectLeadReservation(e,t,n){return j({method:`POST`,path:`/api/cmmd/projects/${e}/project-lead/reservations/${t}/release`,body:n},this.cfg)}async reconcileProjectLead(e,t){return j({method:`POST`,path:`/api/cmmd/projects/${e}/project-lead/reconcile`,body:t},this.cfg)}async resolveProjectLeadAttention(e,t,n){return j({method:`POST`,path:`/api/cmmd/projects/${e}/project-lead/attention/${t}/resolve`,body:n},this.cfg)}async listCenterBoard(e){let t={};return e?.status&&(t.status=e.status),e?.workspaceId&&(t.workspaceId=String(e.workspaceId)),e?.campaignId&&(t.campaignId=String(e.campaignId)),e?.ownerId&&(t.ownerId=String(e.ownerId)),e?.includeArchived!==void 0&&(t.includeArchived=e.includeArchived),e?.q&&(t.q=e.q),j({method:`GET`,path:`/api/cmmd/work-items/board`,query:t},this.cfg)}async listForgeAutomationPresets(){return aW(await j({method:`GET`,path:`/api/cmmd/automations/presets`},this.cfg),`presets`)}async listUserForgeAutomationRules(){return aW(await j({method:`GET`,path:`/api/cmmd/automations/user/rules`},this.cfg),`rules`)}async createUserForgeAutomationRule(e){return j({method:`POST`,path:`/api/cmmd/automations/user/rules`,body:e},this.cfg)}async updateUserForgeAutomationRule(e,t){return j({method:`PATCH`,path:`/api/cmmd/automations/user/rules/${e}`,body:t},this.cfg)}async listUserForgeAutomationRuns(e){return aW(await j({method:`GET`,path:`/api/cmmd/automations/user/rules/${e}/runs`},this.cfg),`runs`)}async startUserForgeAutomationRun(e,t){return j({method:`POST`,path:`/api/cmmd/automations/user/rules/${e}/runs`,body:t},this.cfg)}async listForgeAutomationRules(e,t){let n=oW(t);return aW(await j({method:`GET`,path:`/api/cmmd/automations/projects/${e}/rules`,...n?{query:n}:{}},this.cfg),`rules`)}async createForgeAutomationRule(e,t,n){let r=oW(n);return j({method:`POST`,path:`/api/cmmd/automations/projects/${e}/rules`,body:t,...r?{query:r}:{}},this.cfg)}async updateForgeAutomationRule(e,t,n,r){let i=oW(r);return j({method:`PATCH`,path:`/api/cmmd/automations/projects/${e}/rules/${t}`,body:n,...i?{query:i}:{}},this.cfg)}async listForgeAutomationRuns(e,t){let n=oW(t,t?.taskId);return aW(await j({method:`GET`,path:`/api/cmmd/automations/projects/${e}/runs`,...n?{query:n}:{}},this.cfg),`runs`)}async getForgeAutomationRun(e,t){let n=oW(t);return j({method:`GET`,path:`/api/cmmd/automations/runs/${e}`,...n?{query:n}:{}},this.cfg)}async startForgeAutomationRun(e,t,n,r){let i=oW(r);return j({method:`POST`,path:`/api/cmmd/automations/projects/${e}/tasks/${t}/runs`,body:n,...i?{query:i}:{}},this.cfg)}async retryForgeAutomationRun(e,t,n){let r=oW(n);return j({method:`POST`,path:`/api/cmmd/automations/runs/${e}/retry`,body:t,...r?{query:r}:{}},this.cfg)}async cancelForgeAutomationRun(e,t,n){let r=oW(n);return j({method:`POST`,path:`/api/cmmd/automations/runs/${e}/cancel`,body:t,...r?{query:r}:{}},this.cfg)}async approveForgeAutomationEscalation(e,t,n){let r=oW(n);return j({method:`POST`,path:`/api/cmmd/automations/runs/${e}/escalations/approve`,body:t,...r?{query:r}:{}},this.cfg)}async rejectForgeAutomationEscalation(e,t,n){let r=oW(n);return j({method:`POST`,path:`/api/cmmd/automations/runs/${e}/escalations/reject`,body:t,...r?{query:r}:{}},this.cfg)}async createProjectBoardTask(e,t){let n={title:t.title};return t.description!==void 0&&(n.description=t.description),t.priority!==void 0&&(n.priority=t.priority),t.status!==void 0&&(n.status=t.status),t.workflowStageId!==void 0&&(n.workflowStageId=t.workflowStageId),t.assignee!==void 0&&(n.assignee=t.assignee),t.dueDate!==void 0&&(n.dueDate=t.dueDate),t.workItemType!==void 0&&(n.workItemType=t.workItemType),t.parentTaskId!==void 0&&(n.parentTaskId=t.parentTaskId),t.milestoneId!==void 0&&(n.milestoneId=t.milestoneId),t.dependsOn!==void 0&&(n.dependsOn=t.dependsOn),j({method:`POST`,path:`/api/cmmd/projects/${e}/board`,body:n},this.cfg)}async createCenterBoardTask(e){let t={title:e.title,projectId:e.projectId};return e.description!==void 0&&(t.description=e.description),e.priority!==void 0&&(t.priority=e.priority),e.status!==void 0&&(t.status=e.status),e.assignee!==void 0&&(t.assignee=e.assignee),e.dueDate!==void 0&&(t.dueDate=e.dueDate),e.workItemType!==void 0&&(t.workItemType=e.workItemType),e.parentTaskId!==void 0&&(t.parentTaskId=e.parentTaskId),e.milestoneId!==void 0&&(t.milestoneId=e.milestoneId),e.dependsOn!==void 0&&(t.dependsOn=e.dependsOn),j({method:`POST`,path:`/api/cmmd/work-items/board`,body:t},this.cfg)}async submitFeedback(e){let t={type:e.type,title:e.title,source:e.source};return e.description!==void 0&&(t.description=e.description),e.priority!==void 0&&(t.priority=e.priority),e.senderName!==void 0&&(t.senderName=e.senderName),j({method:`POST`,path:`/api/cmmd/feedback`,body:t},this.cfg)}async updateProjectBoardTask(e,t,n){return j({method:`PATCH`,path:`/api/cmmd/projects/${e}/board/${t}`,body:n},this.cfg)}async updateCenterBoardTask(e,t){return j({method:`PATCH`,path:`/api/cmmd/work-items/board/${e}`,body:t},this.cfg)}async moveCenterBoardTask(e,t){let n={toStatus:t.toStatus};return t.beforeTaskId!==void 0&&(n.beforeTaskId=t.beforeTaskId),t.afterTaskId!==void 0&&(n.afterTaskId=t.afterTaskId),j({method:`PATCH`,path:`/api/cmmd/work-items/board/${e}/move`,body:n},this.cfg)}async moveProjectBoardTask(e,t,n){let r={toStatus:n.toStatus};return n.toStageId!==void 0&&(r.toStageId=n.toStageId),n.beforeTaskId!==void 0&&(r.beforeTaskId=n.beforeTaskId),n.afterTaskId!==void 0&&(r.afterTaskId=n.afterTaskId),j({method:`PATCH`,path:`/api/cmmd/projects/${e}/board/${t}/move`,body:r},this.cfg)}async archiveProjectBoardTask(e,t){return j({method:`POST`,path:`/api/cmmd/projects/${e}/board/${t}/archive`},this.cfg)}async unarchiveProjectBoardTask(e,t){return j({method:`POST`,path:`/api/cmmd/projects/${e}/board/${t}/unarchive`},this.cfg)}async updateProjectBoardTaskStatus(e,t,n,r){return j({method:`PATCH`,path:`/api/cmmd/projects/${e}/board/${t}/status`,body:{status:n,...r?{workflowStageId:r}:{}}},this.cfg)}async listTaskExecutionOptions(e,t){return j({method:`GET`,path:`/api/cmmd/projects/${e}/board/${t}/execution-options`},this.cfg)}async createTaskWorkSession(e,t,n){return j({method:`POST`,path:`/api/cmmd/projects/${e}/board/${t}/work-sessions`,body:n},this.cfg)}async listProjectWorkSessions(e,t={}){return j({method:`GET`,path:`/api/cmmd/projects/${e}/work-sessions`,query:t},this.cfg)}async getWorkSession(e){return j({method:`GET`,path:`/api/cmmd/work-sessions/${e}`},this.cfg)}async updateWorkSessionStatus(e,t){return j({method:`PATCH`,path:`/api/cmmd/work-sessions/${e}`,body:{status:t}},this.cfg)}async attachWorkSessionThread(e,t){return j({method:`POST`,path:`/api/cmmd/work-sessions/${e}/threads`,body:t},this.cfg)}async listTaskConversations(e,t={}){return j({method:`GET`,path:`/api/cmmd/tasks/${e}/conversations`,query:nW(t)},this.cfg)}async linkTaskConversation(e,t){return j({method:`POST`,path:`/api/cmmd/tasks/${e}/conversations`,body:t},this.cfg)}async getTaskHistory(e){return j({method:`GET`,path:`/api/cmmd/tasks/${e}/history`},this.cfg)}async upsertTaskPullRequest(e,t){return j({method:`PUT`,path:`/api/cmmd/tasks/${e}/pull-requests`,body:t},this.cfg)}postPullRequest(e,t){return j({method:`POST`,path:`/api/cmmd/pull-requests/${e}`,body:t},this.cfg)}async listPullRequests(e){return this.postPullRequest(`list`,e)}async getPullRequestListStats(e){return this.postPullRequest(`list-stats`,e)}async getPullRequestDetail(e){return this.postPullRequest(`detail`,e)}async getPullRequestActivity(e){return this.postPullRequest(`activity`,e)}async getPullRequestDiff(e){return this.postPullRequest(`diff`,e)}async getPullRequestDiffFileContents(e){return this.postPullRequest(`diff-file-contents`,e)}async getPullRequestThreadComments(e){return this.postPullRequest(`thread/comments`,e)}async getPullRequestReviewerCandidates(e){return this.postPullRequest(`reviewer-candidates`,e)}async runPullRequestAction(e){return this.postPullRequest(`action`,e)}async createPullRequestComment(e){return this.postPullRequest(`comment`,e)}async updatePullRequest(e){return this.postPullRequest(`update`,e)}async updatePullRequestComment(e){return this.postPullRequest(`comment/update`,e)}async submitPullRequestReview(e){return this.postPullRequest(`review`,e)}async replyToPullRequestThread(e){return this.postPullRequest(`thread/reply`,e)}async setPullRequestThreadResolution(e){return this.postPullRequest(`thread/resolution`,e)}async requestPullRequestReviewers(e){return this.postPullRequest(`reviewers`,e)}async setPullRequestReaction(e){return this.postPullRequest(`reaction`,e)}async getTaskConversation(e,t,n={}){return j({method:`GET`,path:`/api/cmmd/tasks/${e}/conversations/${encodeURIComponent(t)}`,query:nW(n)},this.cfg)}async createTask(e){return j({method:`POST`,path:`/api/cmmd/tasks`,body:e},this.cfg)}async createSubtask(e){throw new rW(`createSubtask`)}async createBoardTask(e){throw new rW(`createBoardTask`)}async createProject(e){let t={};for(let[n,r]of Object.entries(e))r!=null&&(t[n]=r);return e.campaignId!==void 0&&e.campaignId!==null&&(t.campaignId=hW(e.campaignId)),e.organizationId!==void 0&&e.organizationId!==null&&(t.organizationId=hW(e.organizationId)),aBe(await j({method:`POST`,path:`/api/cmmd/projects`,body:t},this.cfg))}async moveProject(e,t){let n={targetOrgId:hW(t.targetOrgId)};return t.campaignStrategy!==void 0&&(n.campaignStrategy=t.campaignStrategy),t.targetCampaignId!==void 0&&(n.targetCampaignId=hW(t.targetCampaignId)),t.dryRun!==void 0&&(n.dryRun=t.dryRun),j({method:`POST`,path:`/api/cmmd/projects/${e}/move`,body:n},this.cfg)}async uploadBrainDoc(e,t){throw new rW(`uploadBrainDoc`)}};function _W(e){return new gW(e)}var vW=new gW({onAuthExpired:_n}),yW=class extends Rt(`BootstrapHttpError`){},bW=e=>pe(e,`BootstrapHttpError`);function xW(e){return typeof e!=`object`||!e?!1:!!(bW(e)&&e.status===401||e instanceof Error&&e.name===`RemoteEnvironmentAuthHttpError`&&`status`in e&&e.status===401||e instanceof xn&&e.kind===`auth`)}function oBe(e){let t=e.replace(/\s+/g,` `).trim();return t.length===0?`<empty response>`:t.slice(0,120)}async function SW(e,t){let n=await e.text();try{return JSON.parse(n)}catch{throw new yW({message:`${t} returned a non-JSON response (${oBe(n)}). Ensure the Forge server is running and this route is proxied correctly.`,status:e.status})}}function sBe(e){if(!e.authenticated||!e.role)throw Error(`Authenticated session is required.`);let t=cBe(e.cmmdIdentity??null);return t?{displayName:t,email:e.cmmdIdentity?.email??null,avatarUrl:e.cmmdIdentity?.avatarUrl??null,role:e.role,verified:!0,source:`cmmd-identity`}:{displayName:`CMMD identity unavailable`,email:null,avatarUrl:null,role:e.role,verified:!1,source:`fallback`}}function cBe(e){return e&&([e.firstName,e.lastName].map(e=>e?.trim()??``).filter(e=>e.length>0).join(` `)||e.username.trim()||e.email.trim())||null}var CW=null;function lBe(){if(CW)return CW;let e=new URL(`/api/auth/session`,window.location.origin).toString(),t=fetch(e,{credentials:`include`}).then(async t=>{if(!t.ok)throw new yW({message:`Failed to load current app auth session state (${t.status}).`,status:t.status});return SW(t,e)}).then(sBe).finally(()=>{CW===t&&(CW=null)});return CW=t,t}function wW(e={resolveUrl:ln}){let t=mn()?.bearerToken;return t?{...e,bearerToken:t}:e}var TW=null,EW=null,DW=null,OW=null,kW=new Set,AW=`cmmd-forge.loggedOutLocalBootstrapCredentials.v1`;function uBe(e){let t=`${e.firstName??``} ${e.lastName??``}`.trim();PU({id:e.id,email:e.email,...t.length>0?{username:t}:{}}),UU({cmmdUserId:e.id,...e.email?{email:e.email}:{},...t.length>0?{displayName:t}:{}})}function jW(){if(typeof window>`u`||DW)return;let e=window.desktopBridge?.desktopAuth?.onStateChange;e&&(DW=e(e=>{TW=null,EW=null,OW=null,e.sessionLifecycle.status!==`ready`&&PU(null),(e.sessionLifecycle.status===`expired`||e.sessionLifecycle.status===`signed-out`&&e.sessionLifecycle.reason===`refresh-revoked`)&&rne().catch(e=>{FU(e,{route:`desktop-auth-session-expired`})})}))}function dBe(){return sa(new URL(window.location.href))}function MW(){let e=new URL(window.location.href),t=wie(e);t.toString()!==e.toString()&&window.history.replaceState({},document.title,t.toString())}async function fBe(){return VW(async()=>{let e=ln(`/api/auth/session`),t=async()=>{let t=await fetch(e,pn({credentials:`include`}));if(!t.ok)throw new yW({message:`Failed to load server auth session state (${t.status}).`,status:t.status});return SW(t,e)},n=await t();return!n.authenticated&&n.auth.sessionMethods.length===1&&n.auth.sessionMethods[0]===`proxy-asserted`&&typeof window<`u`&&!window.desktopBridge&&e.startsWith(`https://`)&&await one()?t():n})}var NW=new Set([`CMMD_AUTH_REQUIRED`,`CMMD_AUTH_EXPIRED`]);async function pBe(e){return VW(async()=>{let t={credential:e},n=ln(`/api/auth/bootstrap`),r=await fetch(n,pn({body:JSON.stringify(t),credentials:`include`,headers:{"content-type":`application/json`},method:`POST`}));if(!r.ok)throw new yW({message:await r.text()||`Failed to bootstrap auth session (${r.status}).`,status:r.status});return SW(r,n)})}function PW(e){return new URL(e,window.location.origin).toString()}function FW(e){let t=(e?.primaryMode===`cloud`?null:e)?.bootstrapToken?.trim();return t&&t.length>0?t:null}function IW(){return typeof window>`u`?null:FW(window.desktopBridge?.getLocalEnvironmentBootstrap?.()??null)}function mBe(){return typeof window>`u`?!1:une()===`session-expired`}function LW(){if(typeof window>`u`)return new Set;try{let e=window.sessionStorage.getItem(AW),t=e?JSON.parse(e):[];return Array.isArray(t)?new Set(t.filter(e=>typeof e==`string`)):new Set}catch{return new Set}}function RW(e){if(!(typeof window>`u`))try{if(e.size===0){window.sessionStorage.removeItem(AW);return}window.sessionStorage.setItem(AW,JSON.stringify([...e]))}catch{}}function hBe(){let e=IW();if(!e)return;let t=new Set(LW());t.add(e),RW(t)}function gBe(e){return LW().has(e)}function zW(){let e=IW();if(!e){RW(new Set);return}let t=new Set(LW());t.delete(e),RW(t)}async function BW(){let e=PW(`/api/auth/session`),t=await fetch(e,{credentials:`include`});return t.ok?SW(t,e):null}async function _Be(e){if(typeof window>`u`)return;let t=FW(e);if(!t||mBe()||kW.has(t)||gBe(t))return;if((await BW().catch(()=>null))?.authenticated){kW.add(t);return}let n=PW(`/api/auth/bootstrap`),r=await fetch(n,{body:JSON.stringify({credential:t}),credentials:`include`,headers:{"content-type":`application/json`},method:`POST`});if(!r.ok){if(r.status===401)return;throw new yW({message:await r.text()||`Failed to bootstrap local web owner session (${r.status}).`,status:r.status})}await SW(r,n),kW.add(t)}async function vBe(){let e=await fBe();if(e.authenticated)return e;let t=mn();if(t?.source!==`desktop-managed`||!t.bearerToken)return e;let n=await BW().catch(()=>null);return n?.authenticated?n:e}var yBe=new Set([404,502,503,504]),bBe=15e3,xBe=500;function SBe(e){mn()?.source===`paired-bearer`&&xW(e)&&cn(`http`)}async function VW(e){let t=Date.now();for(;;)try{return await e()}catch(e){if(SBe(e),!wBe(e))throw e;if(Date.now()-t>=bBe)throw FU(e,{route:`bootstrap-retry-exhausted`}),e;await CBe(xBe)}}function CBe(e){return new Promise(t=>{setTimeout(t,e)})}function wBe(e){return bW(e)?yBe.has(e.status):e instanceof TypeError||e instanceof DOMException&&e.name===`AbortError`}function TBe(e,t){return e.sessionLifecycle.status===`ready`?e.sessionLifecycle.principalId!==t.id||e.cmmd.identity?.id!==t.id?`desktop-principal-mismatch`:null:`desktop-session-required`}async function EBe(e){if(typeof window>`u`||!window.desktopBridge)return null;let t=window.desktopBridge.desktopAuth?.getState;if(!t)return`desktop-state-unavailable`;try{return TBe(await t(),e)}catch(e){return FU(e,{route:`desktop-auth-gate-state`}),`desktop-state-unavailable`}}async function DBe(e,t){return PU(null),ine(t),await fn().catch(e=>{FU(e,{route:`desktop-auth-gate-logout`})}),{status:`requires-auth`,auth:e.auth,errorMessage:fne(t)??`Forge Desktop requires CMMD authentication.`}}async function OBe(){let e=await vBe();if(e.authenticated){if(e.cmmdIdentity){let t=await EBe(e.cmmdIdentity);return t?(hn(),DBe(e,t)):(hn(),uBe(e.cmmdIdentity),{status:`authenticated`})}return{status:`requires-auth`,auth:e.auth}}return{status:`requires-auth`,auth:e.auth}}async function kBe(e){let t=e.trim();if(!t)throw Error(`Enter a pairing token to continue.`);EW=null,zW(),await pBe(t),TW=null,MW()}function HW(){zW(),EW=null,TW=null}async function UW(e,t,n){let r=e.trim();if(!r)throw Error(`CMMD (Command) OAuth did not return an access token.`);let i=n?.refreshToken?.trim(),a=n?.mcpToken?.trim(),o=ln(`/api/auth/bootstrap/command`),s=await fetch(o,pn({body:JSON.stringify({accessToken:r,...i?{refreshToken:i}:{},...a?{mcpToken:a}:{},...t===void 0?{}:{user:t}}),credentials:`include`,headers:{"content-type":`application/json`},method:`POST`}));if(!s.ok)throw new yW({message:await s.text()||`Failed to bootstrap with CMMD OAuth token (${s.status}).`,status:s.status});await SW(s,o),HW()}async function ABe(){let e=ln(`/api/auth/ws-token`),t=await fetch(e,pn({credentials:`include`,method:`POST`}));if(!t.ok)throw new yW({message:await t.text()||`Failed to issue websocket token (${t.status}).`,status:t.status});return SW(t,e)}async function jBe(e){let t=await ABe(),n=new URL(e,window.location.origin);return n.searchParams.set(`wsToken`,t.token),n.toString()}async function MBe(e){let t=`/api/cmmd/work-intake`,n;try{n=await j({method:`GET`,path:t,allowRetry:!1,...e?{query:{fresh:1}}:{}},wW())}catch(e){throw e instanceof xn&&e.kind!==`auth`&&e.code!==null&&NW.has(e.code)?new xn({kind:`auth`,message:e.message,status:e.status??401,code:e.code}):e}if(!n)throw Error(`Invalid response from ${t}`);return n}async function NBe(e={}){return MBe(e.forceFresh===!0)}async function WW(e,t){try{return await j({method:`POST`,path:e,body:t,allowRetry:!1},wW())}catch(e){throw e instanceof xn&&e.kind!==`auth`&&e.code!==null&&NW.has(e.code)?new xn({kind:`auth`,message:e.message,status:e.status??401,code:e.code}):e}}async function PBe(e){try{return await WW(`/api/cmmd/tasks/update`,e)}catch(t){if(t instanceof xn&&(t.kind===`auth`||t.kind===`permission`))throw t;if(t instanceof xn||t instanceof Error)return WW(`/api/command/tasks/update`,e);throw t}}async function FBe(){typeof window>`u`||await window.desktopBridge?.desktopAuth?.logoutCloud?.()}async function IBe(){let e=await Promise.allSettled([fn(),FBe()]);PU(null),hBe(),TW=null,EW=null;let t=e.find(e=>e.status===`rejected`);if(t)throw t.reason}async function GW(){if(jW(),EW?.status===`authenticated`)return hn(),EW;if(TW)return TW;let e=KW().then(t=>TW===e?(t.status===`authenticated`&&(EW=t),t):GW()).finally(()=>{TW===e&&(TW=null)});return TW=e,e}async function KW(){return dn().then(e=>_Be(e)).then(()=>OBe())}function qW(){if(jW(),OW)return OW;TW=null,EW=null;let e=KW().then(t=>OW===e?(t.status===`authenticated`&&(EW=t,hn()),t):qW()).finally(()=>{OW===e&&(OW=null)});return OW=e,e}function LBe(e){let t=``;for(let n of e)t+=String.fromCharCode(n);return btoa(t).replace(/\+/g,`-`).replace(/\//g,`_`).replace(/=+$/u,``)}function RBe(e){let t=LBe(e).replace(/-/g,`+`).replace(/_/g,`/`);return`-----BEGIN PUBLIC KEY-----\n${((t+`=`.repeat((4-t.length%4)%4)).match(/.{1,64}/gu)??[]).join(`
1005
+ If init has been called in the preload and contextIsolation is disabled, is not required to call init in the renderer`);return}window.__SENTRY__RENDERER_INIT__=!0,e.sendClientReports=!1,e.defaultIntegrations===void 0&&(e.defaultIntegrations=pU(e)),e.stackParser===void 0&&(e.stackParser=lU),e.ipcNamespace===void 0&&(e.ipcNamespace=`sentry-ipc`),e.dsn===void 0&&(e.dsn=`https://12345@dummy.dsn/12345`),e.transport===void 0&&(e.transport=fU),delete e.initialScope,t(e)}var hU=e({BrowserClient:()=>KI,MULTIPLEXED_TRANSPORT_EXTRA_KEY:()=>IEe,OpenFeatureIntegrationHook:()=>yRe,SEMANTIC_ATTRIBUTE_SENTRY_OP:()=>CE,SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN:()=>wE,SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE:()=>SE,SEMANTIC_ATTRIBUTE_SENTRY_SOURCE:()=>xE,Scope:()=>oE,addBreadcrumb:()=>rA,addEventProcessor:()=>KO,addIntegration:()=>nk,bindScopeToEmitter:()=>uTe,breadcrumbsIntegration:()=>CR,browserApiErrorsIntegration:()=>wR,browserProfilingIntegration:()=>uRe,browserSessionIntegration:()=>ER,browserTracingIntegration:()=>jH,buildLaunchDarklyFlagUsedHandler:()=>_Re,captureConsoleIntegration:()=>dDe,captureEvent:()=>VO,captureException:()=>zO,captureFeedback:()=>WA,captureMessage:()=>BO,captureSession:()=>XO,chromeStackLineParser:()=>bR,consoleLoggingIntegration:()=>hOe,contextLinesIntegration:()=>eNe,continueTrace:()=>Zwe,createConsolaReporter:()=>vOe,createLangChainCallbackHandler:()=>CN,createTransport:()=>wk,createUserFeedbackEnvelope:()=>iMe,dedupeIntegration:()=>CA,defaultRequestInstrumentationOptions:()=>xH,defaultStackParser:()=>lU,elementTimingIntegration:()=>yje,endSession:()=>JO,eventFiltersIntegration:()=>oA,eventFromException:()=>HI,eventFromMessage:()=>UI,eventLoopBlockIntegration:()=>MRe,exceptionFromError:()=>RI,extraErrorDataIntegration:()=>vDe,featureFlagsIntegration:()=>nOe,feedbackAsyncIntegration:()=>nAe,feedbackIntegration:()=>LI,feedbackSyncIntegration:()=>LI,fetchStreamPerformanceIntegration:()=>EH,forceLoad:()=>IMe,functionToStringIntegration:()=>aA,getAbsoluteUrl:()=>Uje,getActiveSpan:()=>bD,getClient:()=>J,getCurrentScope:()=>q,getDefaultIntegrations:()=>pU,getFeedback:()=>lke,getGlobalScope:()=>vE,getIsolationScope:()=>_E,getReplay:()=>XIe,getRootSpan:()=>vD,getSpanDescendants:()=>_D,getSpanStatusFromHttpCode:()=>jE,getTraceData:()=>nA,globalHandlersIntegration:()=>OR,graphqlClientIntegration:()=>cNe,growthbookIntegration:()=>SRe,httpClientIntegration:()=>HMe,httpContextIntegration:()=>NR,inboundFiltersIntegration:()=>sA,init:()=>mU,instrumentAnthropicAiClient:()=>RM,instrumentCreateReactAgent:()=>UN,instrumentGoogleGenAIClient:()=>eN,instrumentLangChainEmbeddings:()=>ON,instrumentLangGraph:()=>WN,instrumentOpenAiClient:()=>mM,instrumentOutgoingRequests:()=>SH,instrumentSupabaseClient:()=>FA,isBotUserAgent:()=>AH,isEnabled:()=>GO,isInitialized:()=>KTe,lastEventId:()=>WO,launchDarklyIntegration:()=>gRe,linkedErrorsIntegration:()=>PR,logger:()=>DP,makeRendererTransport:()=>fU,metrics:()=>FP,moduleMetadataIntegration:()=>cDe,normalizeStringifyValue:()=>FR,onLoad:()=>LMe,openFeatureIntegration:()=>vRe,parameterize:()=>tA,registerSpanErrorInstrumentation:()=>CD,registerWebWorker:()=>DRe,replayCanvasIntegration:()=>hLe,replayIntegration:()=>GV,reportPageLoaded:()=>LLe,reportingObserverIntegration:()=>BMe,rewriteFramesIntegration:()=>EDe,scopeToMainIntegration:()=>dU,sendFeedback:()=>mF,setActiveSpanInBrowser:()=>RLe,setAttribute:()=>WTe,setAttributes:()=>UTe,setContext:()=>HO,setConversationId:()=>GTe,setCurrentClient:()=>Uk,setExtra:()=>BTe,setExtras:()=>zTe,setHttpStatus:()=>ME,setMeasurement:()=>GD,setTag:()=>HTe,setTags:()=>VTe,setUser:()=>UO,showReportDialog:()=>LR,spanStreamingIntegration:()=>zLe,spanToBaggageHeader:()=>Nwe,spanToJSON:()=>iD,spanToTraceHeader:()=>$E,spotlightBrowserIntegration:()=>hRe,startBrowserTracingNavigationSpan:()=>NH,startBrowserTracingPageLoadSpan:()=>MH,startInactiveSpan:()=>rO,startNewTrace:()=>oO,startSession:()=>qO,startSpan:()=>tO,startSpanManual:()=>nO,statsigIntegration:()=>CRe,supabaseIntegration:()=>BDe,suppressTracing:()=>Qwe,thirdPartyErrorFilterIntegration:()=>YDe,uiProfiler:()=>Jje,unleashIntegration:()=>bRe,updateSpanName:()=>Owe,viewHierarchyIntegration:()=>lNe,webVitalsIntegration:()=>DH,webWorkerIntegration:()=>TRe,withActiveSpan:()=>iO,withIsolationScope:()=>ZCe,withScope:()=>yE,withStreamedSpan:()=>Pwe,zodErrorsIntegration:()=>JDe}),PRe=100,FRe=5,IRe=[`ResizeObserver loop completed with undelivered notifications.`,`ResizeObserver loop limit exceeded`,`AbortError`,`The user aborted a request.`,`Network request failed`,`NetworkError when attempting to fetch resource.`,`Failed to fetch`,`ChunkLoadError`,`Loading chunk`,`Loading CSS chunk`,`Non-Error promise rejection captured with value: Object Not Found Matching Id`];function gU(e){if(e)for(let t of Object.keys(e))/token|secret|password|api[_-]?key/i.test(t)&&(e[t]=`[redacted]`)}function LRe(e){e.request?.url&&(e.request.url=e.request.url.replace(/([?&](?:code|token|access_token|state)=)[^&]+/gi,`$1[redacted]`)),gU(e.extra),gU(e.tags)}function RRe(e){let t=vU(e.version)??`0.0.0`,n=vU(e.commitHash);return n?`${e.appName}@${t}+${n}`:`${e.appName}@${t}`}function _U(e,t){for(let n of t){let t=vU(e[n]);if(t)return t}}function zRe(e){return yU(e.enabled)??e.defaultEnabled??!1}function BRe(e){let t=vU(e.dsn);return!t||zRe(e)===!1?null:{dsn:t,environment:vU(e.environment)??vU(e.defaultEnvironment)??`production`,release:vU(e.release)??vU(e.defaultRelease)??void 0,debug:yU(e.debug)??e.defaultDebug??!1,tracesSampleRate:xU(e.tracesSampleRate,e.defaultTracesSampleRate??.1),profilesSampleRate:bU(e.profilesSampleRate,e.defaultProfilesSampleRate),replaysSessionSampleRate:bU(e.replaysSessionSampleRate,e.defaultReplaysSessionSampleRate),replaysOnErrorSampleRate:bU(e.replaysOnErrorSampleRate,e.defaultReplaysOnErrorSampleRate),attachStacktrace:!0,maxBreadcrumbs:PRe,normalizeDepth:FRe,tags:VRe(e)}}function VRe(e){let t={app:e.appName,runtime:e.runtime};for(let[n,r]of Object.entries(e.tags??{})){let e=vU(r);e&&(t[n]=e)}return t}function vU(e){if(e==null)return null;let t=e.trim();return t.length>0?t:null}function yU(e){if(typeof e==`boolean`)return e;let t=vU(e);if(t){if(t===`1`||t.toLowerCase()===`true`)return!0;if(t===`0`||t.toLowerCase()===`false`)return!1}}function bU(e,t){if(t!==void 0||e!==void 0)return xU(e,t??0)}function xU(e,t){let n=HRe(e);return n===null||n<0||n>1?t:n}function HRe(e){if(typeof e==`number`)return Number.isFinite(e)?e:null;let t=vU(e);if(!t)return null;let n=Number.parseFloat(t);return Number.isFinite(n)?n:null}function URe(e){let t=(0,bi.c)(11),n;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=ct(ji,`bg-background text-foreground`),t[0]=n):n=t[0];let r;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(r=ct(ki,`pl-1 md:pl-2.5`),t[1]=r):r=t[1];let i;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,N.jsx)(Ni,{}),t[2]=i):i=t[2];let a;t[3]===e.onGoToNewChat?a=t[4]:(a=(0,N.jsx)(`div`,{className:r,children:(0,N.jsx)(`button`,{type:`button`,"aria-label":`Go to new chat`,onClick:e.onGoToNewChat,className:`${Ai} hover:bg-accent/70`,children:i})}),t[3]=e.onGoToNewChat,t[4]=a);let o;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,N.jsx)(`div`,{}),t[5]=o):o=t[5];let s;t[6]===a?s=t[7]:(s=(0,N.jsxs)(`header`,{className:Oi,children:[a,o]}),t[6]=a,t[7]=s);let c;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,N.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center px-4`,children:(0,N.jsxs)(`div`,{className:`max-w-md rounded-xl border border-border bg-card p-6 text-center shadow-lg`,children:[(0,N.jsx)(`h1`,{className:`text-xl font-semibold tracking-tight`,children:`Something went wrong.`}),(0,N.jsx)(`p`,{className:`mt-2 text-sm text-muted-foreground`,children:`Forge hit an unexpected error and reported it.`}),(0,N.jsx)(`button`,{className:`mt-4 inline-flex rounded-md border border-border px-3 py-2 text-sm font-medium hover:bg-accent`,onClick:WRe,type:`button`,children:`Reload app`})]})}),t[8]=c):c=t[8];let l;return t[9]===s?l=t[10]:(l=(0,N.jsxs)(`div`,{className:n,children:[s,c]}),t[9]=s,t[10]=l),l}function WRe(){return window.location.reload()}var GRe=[/\bDeepSeek\b/i,/\bKimi\b/i,/\bMoonshot\b/i,/\bdeepseek[-._a-z0-9]*\b/i,/\bkimi[-._a-z0-9]*\b/i,/\bmoonshot[-._a-z0-9]*\b/i,/\bAPEX_API_KEY\b/,/\bDEEPSEEK_API_KEY\b/,/\bKIMI_API_KEY\b/,/\bOPENAI_API_KEY\b/,/\bANTHROPIC_API_KEY\b/,/\bCURSOR_API_KEY\b/,/\bOPENCODE_API_KEY\b/,/\bforge_proxy_[A-Za-z0-9._-]+\b/,/\bProviderValidationError\b/,/\/forge-server\/node_modules\//,/https?:\/\/[^\s'"<>)]*\/api\/provider-egress\/[^\s'"<>)]*/i,/https?:\/\/[^\s'"<>)]*(?:apex|deepseek|moonshot|kimi)[^\s'"<>)]*/i],KRe=`CMMD is temporarily unavailable. Check the workspace AI connection and retry.`;function SU(e){if(!e)return!1;let t=e.toLowerCase();return/\b(rate[\s-]?limit|too\s+many\s+requests|usage[ _-]limit|usage_limit_reached|quota|insufficient_quota)\b/.test(t)||/\b429\b/.test(t)}function qRe(e){return/\bbound to provider account\b/.test(e)&&/\bcannot use provider account\b/.test(e)?`Forge could not switch this conversation to the selected AI account. Retry the account switch.`:/\bforge_runtime_repairing\b/.test(e)||/\bthis turn was interrupted because the environment is being repaired\b/.test(e)?`This turn was interrupted because the environment is being repaired. Retry after the repair finishes.`:/\bforge_runtime_stopped\b/.test(e)||/\bthis turn was interrupted because the environment was stopped\b/.test(e)?`This turn was interrupted because the environment was stopped. Start the environment and retry.`:null}function JRe(e){if(!e)return null;let t=e.toLowerCase(),n=qRe(t);return n===null?/\bforge_provider_model_not_allowed\b/.test(t)||/\bnot\s+scoped\s+to\s+the\s+requested\s+model\b/.test(t)?`The workspace AI credential does not cover the model this turn asked for. Retry, or pick that model for the thread.`:/\bmodel\b[\s\S]*\b(not\s+(found|available|supported)|does\s+not\s+exist|unsupported|invalid|unknown)\b/.test(t)||/\b(unsupported|unknown|invalid)\b[\s\S]*\bmodel\b/.test(t)||/\b(model_not_found|invalid_model|model_not_supported)\b/.test(t)?`The selected model isn't available right now. Pick a different model and retry.`:SU(t)?`The AI service is rate-limited or out of quota. Wait a moment and retry.`:/_credential_reconnect_required\b/.test(t)?`The workspace AI credential needs to be reconnected. Reconnect it in Settings > Providers, then retry.`:/\b(unauthorized|forbidden|authentication\s+(failed|error|required)|invalid\s+api\s+key|expired\s+(token|credential))\b/.test(t)||/\b40[13]\b/.test(t)?`Workspace AI authentication failed. Reconnect the workspace and retry.`:/\b(timed?\s*out|timeout|overloaded|service\s+unavailable)\b/.test(t)||/\b50[234]\b/.test(t)?`The AI service is temporarily overloaded. Retry in a moment.`:null:n}function YRe(e){return e?GRe.some(t=>t.test(e)):!1}function CU(e,t={}){if(e==null)return null;let n=e.trim();return n.length===0?null:YRe(n)?JRe(n)??t.fallback??`CMMD is temporarily unavailable. Check the workspace AI connection and retry.`:n}var XRe=[/\bSocketCloseError\b/i,/\bSocketOpenError\b/i,/\bSocketReadError\b/i,/\bRpcClientDefect:\s*Unknown socket error\b/i,/Unable to connect to the Forge server WebSocket\./i,/\bping timeout\b/i];function wU(e){if(typeof e!=`string`)return!1;let t=e.trim();return t.length!==0&&XRe.some(e=>e.test(t))}function TU(e){return wU(e)?null:CU(e,{fallback:KRe})}var ZRe=[/^Transport disposed$/,/WebSocket RPC request timed out after \d+ms\./],QRe=`Lost the connection to this Environment. Your message was not sent.`;function $Re(e){return e instanceof Error?wU(e.message)||ZRe.some(t=>t.test(e.message.trim()))?QRe:e.message:`Failed to send message.`}var EU=`forge-web`,DU=[`VITE_SENTRY_ENVIRONMENT`,`MODE`],OU=[`VITE_SENTRY_RELEASE`],eze=[`VITE_SENTRY_DSN`],tze=[`VITE_SENTRY_DEBUG`],nze=[`VITE_SENTRY_ENABLED`],rze=[`VITE_SENTRY_TRACES_SAMPLE_RATE`],ize=[`VITE_SENTRY_PROFILES_SAMPLE_RATE`],aze=[`VITE_SENTRY_REPLAYS_SESSION_SAMPLE_RATE`],oze=[`VITE_SENTRY_REPLAYS_ON_ERROR_SAMPLE_RATE`],sze=[`VITE_SENTRY_COMMIT_SHA`,`VITE_COMMIT_SHA`],kU=!1,AU={autoInject:!1,colorScheme:`system`,formTitle:`Report a Bug`,themeLight:{accentBackground:`oklch(0.52 0.19 48)`,accentForeground:`#ffffff`,background:`#ffffff`,boxShadow:`0 24px 80px rgba(0, 0, 0, 0.18)`,foreground:`#262626`,outline:`1px solid oklch(0.52 0.19 48)`},themeDark:{accentBackground:`oklch(0.62 0.2 47)`,accentForeground:`#ffffff`,background:`#171717`,boxShadow:`0 24px 80px rgba(0, 0, 0, 0.45)`,foreground:`#f5f5f5`,outline:`1px solid oklch(0.62 0.2 47)`}};function cze(e){let t=e.exception&&typeof e.exception==`object`&&`values`in e.exception&&Array.isArray(e.exception.values)?e.exception.values:[];return[typeof e.title==`string`?e.title:void 0,...t.flatMap(e=>{if(typeof e!=`object`||!e)return[];let t=e;return[typeof t.type==`string`?t.type:void 0,typeof t.value==`string`?t.value:void 0]})]}function lze(e){return(e.exception&&typeof e.exception==`object`&&`values`in e.exception&&Array.isArray(e.exception.values)?e.exception.values:[]).some(e=>{if(typeof e!=`object`||!e)return!1;let t=e;return typeof t.value!=`string`||!/All fibers interrupted without error/i.test(t.value)?!1:t.stacktrace?.frames?.some(e=>{let t=typeof e.filename==`string`?e.filename:``,n=typeof e.function==`string`?e.function:``;return t.includes(`src/rpc/wsTransport.ts`)&&n===`WsTransport.request`})})}function uze(e){return cze(e).some(wU)||lze(e)}function dze(){let e=new URL(window.location.href);Bn?e.hash=`/new`:(e.pathname=`/new`,e.search=``,e.hash=``),window.location.assign(e.toString())}function fze(){let e=Bn?`electron-renderer`:`browser`,t={APP_VERSION:`0.13.4`,BASE_URL:`/`,DEV:!1,MODE:`production`,PROD:!0,SSR:!1,TSS_INLINE_CSS_ENABLED:`false`,VITE_COMMIT_SHA:``,VITE_HOSTED_APP_CHANNEL:``,VITE_HTTP_URL:``,VITE_SENTRY_COMMIT_SHA:`c1966e8e386db52c6da92563f72d10bed783d57a`,VITE_SENTRY_DEBUG:``,VITE_SENTRY_DSN:``,VITE_SENTRY_ENABLED:``,VITE_SENTRY_ENVIRONMENT:`production`,VITE_SENTRY_PROFILES_SAMPLE_RATE:``,VITE_SENTRY_RELEASE:`forge-web@0.13.4+c1966e8e386db52c6da92563f72d10bed783d57a`,VITE_SENTRY_REPLAYS_ON_ERROR_SAMPLE_RATE:``,VITE_SENTRY_REPLAYS_SESSION_SAMPLE_RATE:``,VITE_SENTRY_TRACES_SAMPLE_RATE:``,VITE_WS_URL:``},n=_U(t,[...OU])??RRe({appName:EU,version:`0.13.4`,commitHash:_U(t,[...sze])});return BRe({appName:EU,runtime:e,defaultEnvironment:_U(t,[...DU])??`development`,defaultRelease:n,defaultEnabled:!0,defaultTracesSampleRate:0,defaultReplaysSessionSampleRate:0,defaultReplaysOnErrorSampleRate:0,enabled:_U(t,[...nze]),dsn:_U(t,[...eze]),environment:_U(t,[...DU]),release:_U(t,[...OU]),debug:_U(t,[...tze]),tracesSampleRate:_U(t,[...rze]),profilesSampleRate:_U(t,[...ize]),replaysSessionSampleRate:_U(t,[...aze]),replaysOnErrorSampleRate:_U(t,[...oze]),tags:{platform:Bn?`desktop`:`web`}})}function jU(e){return LRe(e),uze(e)?null:e}function pze(e){return{...e.replaysOnErrorSampleRate===void 0?{}:{replaysOnErrorSampleRate:e.replaysOnErrorSampleRate},...e.replaysSessionSampleRate===void 0?{}:{replaysSessionSampleRate:e.replaysSessionSampleRate}}}function MU(e){return{attachStacktrace:e.attachStacktrace,debug:e.debug,dsn:e.dsn,environment:e.environment,ignoreErrors:[...IRe],initialScope:{tags:e.tags},maxBreadcrumbs:e.maxBreadcrumbs,normalizeDepth:e.normalizeDepth,sendDefaultPii:!1,tracesSampleRate:e.tracesSampleRate,...e.release===void 0?{}:{release:e.release},...pze(e)}}function mze(e){let t=[];e.tracesSampleRate>0&&t.push(jH()),((e.replaysSessionSampleRate??0)>0||(e.replaysOnErrorSampleRate??0)>0)&&t.push(GV());let n=LI(AU);t.push(n);try{mU({...MU(e),beforeSend:e=>jU(e),integrations:t})}catch{return null}return kU=!0,hU}function hze(e){let t=[];e.tracesSampleRate>0&&t.push(yS()),((e.replaysSessionSampleRate??0)>0||(e.replaysOnErrorSampleRate??0)>0)&&t.push(xx());let n=Yh(AU);t.push(n);try{$S({...MU(e),beforeSend:e=>jU(e),integrations:t})}catch{return null}return kU=!0,Dw}function NU(){if(kU)return Bn?hU:Dw;let e=fze();return e?Bn?mze(e):hze(e):null}function PU(e){if(NU()){if(Bn){UO(e);return}ou(e)}}function FU(e,t,n){if(!NU())return;let r=gze(e);if(Bn){yE(e=>{t&&e.setTags(t);let i=zO(r);n?.showReportDialog&&LR({eventId:i})});return}ss(e=>{t&&e.setTags(t);let i=Xl(r);n?.showReportDialog&&iv({eventId:i})})}function gze(e){if(e instanceof Error)return e;if(typeof e==`string`&&e.trim().length>0)return Error(e);try{return Error(JSON.stringify(e))}catch{return Error(`Unknown non-Error exception`)}}var _ze=class extends M.Component{constructor(e){super(e),this.state={hasError:!1}}static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(e){FU(e,{origin:`react-boundary`},{showReportDialog:!0})}render(){return this.state.hasError?(0,N.jsx)(URe,{onGoToNewChat:dze}):this.props.children}},IU=!1,LU=!1,RU=null,zU=null,BU=null,VU=!1,HU=new Set;function vze(e){if(IU||LU)return;if(!e.publicKey||!e.host){LU=!0;return}if(RU)return;if(typeof window>`u`||typeof location>`u`){LU=!0;return}let t=e.publicKey,n=e.host;RU=A(async()=>{let{default:e}=await import(`./module-CPO4cjSm.js`);return{default:e}},[]).then(({default:e})=>{zU=e,e.init(t,{api_host:n,person_profiles:`identified_only`,capture_pageview:!1,capture_pageleave:!1,autocapture:!1,disable_session_recording:!0,loaded:()=>{IU=!0,BU&&UU(BU),WU(),HU.forEach(e=>e())}})}).catch(()=>{LU=!0,zU=null})}function UU(e){if(BU=e,!IU||!zU)return;let t={};e.email!==void 0&&(t.email=e.email),e.displayName!==void 0&&(t.name=e.displayName),zU.identify(e.cmmdUserId,t)}function yze(e){return!IU||!zU?!1:zU.isFeatureEnabled(e)===!0}function WU(){!zU||VU||(VU=!0,zU.onFeatureFlags(()=>{HU.forEach(e=>e())}))}function bze(e){return HU.add(e),IU&&zU&&(WU(),e()),()=>{HU.delete(e)}}var GU=`/api/cmmd/auth-runtime`;function xze(e){return j({method:`POST`,path:GU},e)}function Sze(e){return j({method:`GET`,path:GU},e)}function Cze(e){return j({method:`DELETE`,path:GU},e)}function wze(e){return j({method:`POST`,path:`${GU}/connect`},e)}function Tze(e,t){return j({method:`GET`,path:`/api/cmmd/billing`,...t?.organizationId===void 0?{}:{query:{orgId:t.organizationId}}},e)}function Eze(e,t){return j({method:`GET`,path:`/api/cmmd/billing/series`,query:{timeZone:t.timeZone}},e)}var KU=`/api/cmmd/providers/codex/credential`,qU=`/api/cmmd/providers/claude/credential`;function Dze(e){return j({method:`GET`,path:KU},e)}function Oze(e){return j({method:`DELETE`,path:KU},e)}function kze(e){return j({method:`GET`,path:qU},e)}function Aze(e){return j({method:`DELETE`,path:qU},e)}function jze(e,t){return j({method:`DELETE`,path:`/api/cmmd/providers/accounts/${encodeURIComponent(String(t))}`},e)}function Mze(e,t,n){return`/api/cmmd/threads/${encodeURIComponent(e)}/${encodeURIComponent(t)}/${encodeURIComponent(n)}/disposition`}function Nze(e,t,n,r,i){return j({method:`PUT`,path:Mze(t,n,r),body:i},e)}function Pze(e){return(t,n,r,i)=>Nze(e,t,n,r,i)}function JU(e,t=``){return`/api/cmmd/thread-attachments/${encodeURIComponent(e)}${t}`}function Fze(e){return{async listThreadAttachments(t){return j({method:`GET`,path:JU(t)},e)},async uploadThreadAttachment(t,n,r,i){let a=new FormData;return a.append(`file`,n),r!==void 0&&a.append(`attachmentId`,r),j({method:`POST`,path:JU(t),form:a,...i===void 0?{}:{signal:i}},e)},async getThreadAttachmentDownloadUrl(t,n){return j({method:`GET`,path:JU(t,`/${encodeURIComponent(n)}/download`)},e)},async deleteThreadAttachment(t,n){await j({method:`DELETE`,path:JU(t,`/${encodeURIComponent(n)}`)},e)}}}var Ize=class extends Error{constructor(e){super(e),this.name=`CmmdApiAuthError`}},Lze=class extends Error{status;constructor(e,t){super(e),this.name=`CmmdApiServerError`,this.status=t}};async function YU(e){try{return await e}catch(e){throw e instanceof xn?e.kind===`auth`?new Ize(e.message):new Lze(e.message,e.status??502):e}}function Rze(e,t,n){return`/api/cmmd/threads/${encodeURIComponent(e)}/${encodeURIComponent(t)}/${encodeURIComponent(n)}/archive`}function zze(e,t,n,r,i){return j({method:`POST`,path:Rze(t,n,r),body:i},e)}function Bze(e){return(t,n,r,i)=>zze(e,t,n,r,i)}function Vze(e){return typeof e==`object`&&!!e&&`status`in e&&e.status===409}async function Hze(e){let t={action:e.action,...e.operationId===void 0?{}:{operationId:e.operationId},expectedRevision:e.expectedRevision,force:e.force};try{return await e.submit(t)}catch(n){if(!Vze(n))throw n;let r=await e.refresh();return e.submit({...t,expectedRevision:r.revision})}}function Uze(e){return{getForgeAccountPreferences:()=>j({method:`GET`,path:`/api/cmmd/account/preferences`},e),updateForgeAccountPreferences:t=>j({method:`PATCH`,path:`/api/cmmd/account/preferences`,body:t},e),getUserSettings:t=>j({method:`GET`,path:`/api/cmmd/user/settings/${t}`},e),putUserSettings:(t,n)=>j({method:`PUT`,path:`/api/cmmd/user/settings/${t}`,body:n},e)}}function Wze(e,t,n){return j({method:`POST`,path:`/api/cmmd/forge-runtimes/${encodeURIComponent(t)}/rename`,body:{displayName:n}},e)}function Gze(e,t,n){return j({method:`POST`,path:`/api/cmmd/devices/${encodeURIComponent(String(t))}/rename`,body:{displayName:n}},e)}function Kze(e,t){return j({method:`POST`,path:`/api/cmmd/devices/${encodeURIComponent(String(t))}/revoke`},e)}function qze(e){return{...e?.projectId===void 0?{}:{projectId:String(e.projectId)},...e?.allWorkspaces===!0?{allWorkspaces:`true`}:{},...e?.organizationId===void 0?{}:{orgId:String(e.organizationId)}}}var XU=`rt-demo`,ZU=`th-demo`,QU=`example-project`,Jze=`example-conversation`,$U=`2026-09-26T20:00:00.000Z`;function Yze(e,t){return e===XU&&t===ZU}function Xze(){return{runtime:{id:XU,source:`forge-cloud`,runtimeKind:`cloud-vm`,displayName:`Example Forge Server`,status:`online`,endpointUrl:null,hostId:null,deviceId:null,workspaceRoot:null,githubRepoFullName:null,lastSeenAt:$U,reachability:{status:`online`,lastReachableAt:$U,source:`cloud-runtime`},metadata:null},inventoryStatus:`synced`,inventoryPublishedAt:$U,projectCount:1,threadCount:1,projects:[{projectId:QU,title:`Example project`,workspaceRoot:null,githubRepoFullName:null,branch:null,status:`active`,threadCount:1,lastActivityAt:$U,metadata:null,publishedAt:$U,updatedAt:$U,threads:[{threadId:ZU,title:`Example thread (viewer check)`,status:`active`,model:null,provider:null,providerAccountId:null,branch:null,lastMessagePreview:null,lastActivityAt:$U,kind:`master`,parentThreadId:null,workerRole:null,anchorKind:`scratch`,anchorCmmdId:null,archive:null,disposition:{manualDisposition:null,automaticDisposition:null,effectiveDisposition:null,revision:null,source:null},metadata:null,publishedAt:$U,updatedAt:$U}]}]}}function Zze(){return{conversationId:Jze,runtime:{id:XU,source:`forge-cloud`,runtimeKind:`cloud-vm`,displayName:`Example Forge Server`,status:`online`,endpointUrl:null,deviceId:null,workspaceRoot:null,githubRepoFullName:null,lastSeenAt:$U,metadata:null},project:{projectId:QU,title:`Example project`,githubRepoFullName:null,branch:null},thread:{threadId:ZU,title:`Example thread (viewer check)`,status:`active`,model:null,provider:null,providerAccountId:null,branch:null,lastActivityAt:$U,metadata:null},reachability:`online`,execution:{available:!0,reason:null},replication:null,events:[{sequence:1,eventId:`example-user-1`,kind:`user_message`,turnId:null,text:`This is an example chat thread for verifying the Forge embed viewer. It is not a live Work Session.`,status:null,occurredAt:`2026-09-26T19:58:00.000Z`},{sequence:2,eventId:`example-assistant-1`,kind:`assistant_message`,turnId:null,text:`Understood. You should see this reply in the iframe under CMMD /forge, with the composer still available below.`,status:null,occurredAt:`2026-09-26T19:59:00.000Z`},{sequence:3,eventId:`example-user-2`,kind:`user_message`,turnId:null,text:`Thanks. If these three turns render, the thread wire is working.`,status:null,occurredAt:$U}]}}function Qze(e){return e.runtimes.some(e=>e.runtime.id===XU)?{...e,runtimes:[...e.runtimes]}:{...e,runtimes:[...e.runtimes,Xze()]}}function eW(e,t){if(!e||typeof e!=`object`)return null;let n=e[t];return typeof n==`string`&&n.trim().length>0?n.trim():null}function $ze(e,t){if(!e||typeof e!=`object`)return null;let n=e[t];return typeof n==`boolean`?n:null}function tW(e,t){if(!e||typeof e!=`object`)return null;let n=e[t];return typeof n==`string`&&n.trim().length>0?n.trim():typeof n==`number`&&Number.isFinite(n)?String(n):null}function nW(e){return{...e.limit===void 0?{}:{limit:e.limit},...e.cursor?{cursor:e.cursor}:{}}}var rW=class extends Error{constructor(e){super(`CmmdApiClient.${e} is not implemented yet`),this.name=`CmmdApiNotImplementedError`}};function iW(e,t){if(Array.isArray(e))return e;if(e&&typeof e==`object`){let n=e[t];if(Array.isArray(n))return n}return[]}function aW(e,t){if(Array.isArray(e))return e;if(e&&typeof e==`object`){let n=e[t];if(Array.isArray(n))return n}return[]}function oW(e,t){let n={};return e?.organizationId&&(n.orgId=e.organizationId),t!==void 0&&(n.taskId=String(t)),Object.keys(n).length>0?n:void 0}function sW(e){let t=`${eW(e,`firstName`)??``} ${eW(e,`lastName`)??``}`.trim()||eW(e,`username`)||eW(e,`email`)||`Unknown`;return{id:tW(e,`userId`)??tW(e,`id`)??t,name:t,email:eW(e,`email`),role:eW(e,`role`),avatarUrl:eW(e,`profileImage`)??eW(e,`avatar`)}}function eBe(e){let t=lW(e,`user`)??e;return sW({...typeof t==`object`&&t?t:{},userId:tW(e,`userId`)??tW(t,`id`),role:eW(e,`role`)})}function cW(e){let t=eW(e,`authorFirstName`)??``,n=eW(e,`authorLastName`)??``,r=eW(e,`status`),i=r===`at_risk`||r===`off_track`||r===`complete`?r:`on_track`;return{id:tW(e,`id`)??``,status:i,body:eW(e,`body`)??``,authorName:`${t} ${n}`.trim()||null,authorAvatarUrl:eW(e,`authorProfileImage`)??null,createdAt:eW(e,`createdAt`)??``,updatedAt:eW(e,`updatedAt`)??eW(e,`createdAt`)??``,canEdit:$ze(e,`canEdit`)??!1}}function tBe(e,t,n){let r=Array.isArray(e.data)?e.data.map(cW):[];return{updates:r,pagination:e.pagination??{page:t,limit:n,total:r.length,hasMore:!1}}}function lW(e,t){if(!e||typeof e!=`object`)return null;let n=e[t];return n&&typeof n==`object`?n:null}var nBe=[`avatarUrl`,`avatar_url`,`profileImage`,`profile_image`,`profileImageUrl`,`profile_image_url`,`image`,`imageUrl`,`image_url`,`picture`];function uW(e,t){let n=lW(e,t);if(!n)return null;for(let e of nBe){let t=eW(n,e);if(t)return t}return null}function dW(e,t){let n=lW(e,t);return n?tW(n,`id`):null}function fW(e,t){return!!(e&&typeof e==`object`&&Object.hasOwn(e,t))}function rBe(e){let t={...e,id:tW(e,`id`)??e.id,title:e.title??eW(e,`name`)??``},n=tW(e,`workspaceId`)??tW(e,`workspace_id`)??dW(e,`workspace`)??e.workspaceId??null;return n!==null||fW(e,`workspaceId`)?{...t,workspaceId:n,startDate:e.startDate??eW(e,`start_date`)??null,endDate:e.endDate??eW(e,`end_date`)??null}:t}function pW(e){let t=e.ownerAvatarUrl??eW(e,`owner_avatar_url`)??eW(e,`ownerProfileImage`)??eW(e,`owner_profile_image`)??eW(e,`ownerImage`)??eW(e,`owner_image`)??eW(e,`ownerImageUrl`)??eW(e,`owner_image_url`)??eW(e,`createdByAvatarUrl`)??eW(e,`created_by_avatar_url`)??eW(e,`createdByProfileImage`)??eW(e,`created_by_profile_image`)??uW(e,`owner`)??uW(e,`createdBy`)??uW(e,`created_by`)??null,n={...e,id:tW(e,`id`)??e.id},r=tW(e,`campaignId`)??tW(e,`campaign_id`)??dW(e,`campaign`)??e.campaignId??null;(r!==null||fW(e,`campaignId`))&&(n.campaignId=r);let i=e.campaignTitle??eW(e,`campaignTitle`)??eW(e,`campaign_title`)??eW(lW(e,`campaign`),`title`)??eW(lW(e,`campaign`),`name`)??null;(i!==null||fW(e,`campaignTitle`))&&(n.campaignTitle=i);let a=tW(e,`workspaceId`)??tW(e,`workspace_id`)??dW(e,`workspace`)??e.workspaceId??null;(a!==null||fW(e,`workspaceId`))&&(n.workspaceId=a);let o=e.workspaceName??eW(e,`workspace_name`)??eW(lW(e,`workspace`),`name`)??null;(o!==null||fW(e,`workspaceName`))&&(n.workspaceName=o);let s=eW(e,`workspaceIconUrl`)??eW(e,`workspace_icon_url`)??eW(lW(e,`workspace`),`iconUrl`)??null;(s!==null||fW(e,`workspaceIconUrl`))&&(n.workspaceIconUrl=s);let c=tW(e,`ownerId`)??tW(e,`owner_id`)??dW(e,`owner`)??e.ownerId??null;(c!==null||fW(e,`ownerId`))&&(n.ownerId=c);let l=e.ownerName??eW(e,`owner_name`)??eW(lW(e,`owner`),`name`)??null;(l!==null||fW(e,`ownerName`))&&(n.ownerName=l),(t!==null||fW(e,`ownerAvatarUrl`))&&(n.ownerAvatarUrl=t);let u=tW(e,`teamId`)??tW(e,`team_id`)??dW(e,`team`)??e.teamId??null;(u!==null||fW(e,`teamId`))&&(n.teamId=u);let d=e.teamName??eW(e,`team_name`)??eW(lW(e,`team`),`name`)??null;(d!==null||fW(e,`teamName`))&&(n.teamName=d);let f=e.startDate??eW(e,`start_date`)??null;(f!==null||fW(e,`startDate`))&&(n.startDate=f);let p=e.targetEndDate??eW(e,`target_end_date`)??null;return(p!==null||fW(e,`targetEndDate`))&&(n.targetEndDate=p),n}function mW(e){if(Array.isArray(e))return e;if(e&&typeof e==`object`){let t=e;if(Array.isArray(t.items))return t.items;if(Array.isArray(t.results))return t.results}return[]}function iBe(e){return mW(e).flatMap(e=>{let t=e,n=typeof t.id==`number`?t.id:null,r=typeof t.name==`string`?t.name:null;if(n===null||r===null)return[];let i=e=>typeof t[e]==`string`?t[e]:null;return[{id:n,name:r,startDate:i(`startDate`),endDate:i(`endDate`),status:i(`status`)}]})}function aBe(e){if(e&&typeof e==`object`){let t=e;if(t.project&&typeof t.project==`object`)return t.project}return e}function hW(e){if(e===null||e.trim()===``)return null;let t=Number(e);return Number.isSafeInteger(t)?t:e}var gW=class e{cfg;putThreadDisposition;listThreadAttachments;uploadThreadAttachment;getThreadAttachmentDownloadUrl;deleteThreadAttachment;postThreadArchive;getForgeAccountPreferences;updateForgeAccountPreferences;getUserSettings;putUserSettings;commentEditIdempotencyKeys=new Map;commentDeleteIdempotencyKeys=new Map;constructor(e={}){let t=e.forgeOrigin===void 0,n=e.forgeOrigin??`http://localhost:13773`;this.cfg={resolveUrl:t?ln:e=>`${n}${e}`,maxRetries:e.maxRetries??3,onAuthExpired:e.onAuthExpired??_n,...t?{resolveBearerToken:()=>mn()?.bearerToken??null}:{}},this.putThreadDisposition=Pze(this.cfg);let r=Fze(this.cfg);this.listThreadAttachments=r.listThreadAttachments,this.uploadThreadAttachment=r.uploadThreadAttachment,this.getThreadAttachmentDownloadUrl=r.getThreadAttachmentDownloadUrl,this.deleteThreadAttachment=r.deleteThreadAttachment,this.postThreadArchive=Bze(this.cfg);let i=Uze(this.cfg);this.getForgeAccountPreferences=i.getForgeAccountPreferences,this.updateForgeAccountPreferences=i.updateForgeAccountPreferences,this.getUserSettings=i.getUserSettings,this.putUserSettings=i.putUserSettings}async getTask(e){return YU(j({method:`GET`,path:`/api/cmmd/tasks/${e}`},this.cfg))}async getForgeTaskDetail(e){return j({method:`GET`,path:`/api/cmmd/tasks/${e}`},this.cfg)}async searchTasks(e){let t={q:e.q};return e.status&&(t.status=e.status),e.limit!==void 0&&(t.limit=e.limit),e.projectId&&(t.projectId=e.projectId),(await YU(j({method:`GET`,path:`/api/cmmd/tasks/search`,query:t},this.cfg))).tasks??[]}async getTaskComments(e){return(await YU(j({method:`GET`,path:`/api/cmmd/tasks/${e}/comments`},this.cfg))).comments??[]}async listProjectTaskComments(e){return(await YU(j({method:`GET`,path:`/api/cmmd/tasks/${e}/comments`},this.cfg))).comments??[]}async createProjectTaskComment(e,t){return(await YU(j({method:`POST`,path:`/api/cmmd/tasks/comment`,body:{taskId:e,content:t.content}},this.cfg))).details}async updateProjectTaskComment(e,t,n){return(await YU(j({method:`PATCH`,path:`/api/cmmd/tasks/${e}/comments/${encodeURIComponent(t)}`,body:n},this.cfg))).comment}async deleteProjectTaskComment(e,t,n){return YU(j({method:`DELETE`,path:`/api/cmmd/tasks/${e}/comments/${encodeURIComponent(t)}`,body:n},this.cfg))}async getTaskAttachments(e){return YU(j({method:`GET`,path:`/api/cmmd/tasks/${e}/attachments`},this.cfg))}async getProjectRepository(e){return YU(j({method:`GET`,path:`/api/cmmd/projects/${e}/repository`},this.cfg))}async listProjectRepositories(e){return(await YU(j({method:`GET`,path:`/api/cmmd/projects/${e}/repositories`},this.cfg))).repositories}async getWorkspaceMembers(e){return YU(j({method:`GET`,path:`/api/cmmd/organizations/${e}/members`},this.cfg))}async getWebSocketToken(e){return j({method:`GET`,path:`/api/cmmd/ws-token`,...e?.signal===void 0?{}:{signal:e.signal}},this.cfg)}async getProjectComments(e,t){let n={};return t?.organizationId&&(n.organizationId=t.organizationId),(await j({method:`GET`,path:`/api/cmmd/projects/${e}/comments`,query:n},this.cfg))?.comments??[]}async getProjectLink(e){return j({method:`GET`,path:`/.well-known/forge/project-link`,query:{environmentId:e.environmentId,projectId:e.projectId,cwd:e.cwd}},this.cfg)}async listProjectLinks(){return j({method:`GET`,path:`/.well-known/forge/project-links`,suppressBearerToken:!0},this.cfg)}async listProjectContextLinks(e){let t={};e.environmentId&&(t.forgeEnvironmentId=e.environmentId),e.projectId&&(t.forgeProjectId=e.projectId),e.githubRepoFullName&&(t.githubRepoFullName=e.githubRepoFullName),e.cmmdOrganizationId&&(t.cmmdOrganizationId=e.cmmdOrganizationId);let n=await j({method:`GET`,path:`/.well-known/forge/cmmd/project-links`,query:t},this.cfg),r=dte(cte)(n);return r._tag===`Some`?r.value.links:[]}async listCmmdWorkspaces(){return mW(await j({method:`GET`,path:`/.well-known/forge/cmmd/workspaces`},this.cfg))}async listCmmdCampaigns(e){return iBe(await j({method:`GET`,path:`/.well-known/forge/cmmd/campaigns`,query:{workspaceId:e.workspaceId}},this.cfg))}async listCmmdProjects(e){return mW(await j({method:`GET`,path:`/.well-known/forge/cmmd/projects`,query:{campaignId:e.campaignId}},this.cfg))}async updateTask(e,t){let n={taskId:e};return t.title!==void 0&&(n.title=t.title),t.description!==void 0&&(n.description=t.description),t.status!==void 0&&(n.status=t.status),t.priority!==void 0&&(n.priority=t.priority),t.dueDate!==void 0&&(n.dueDate=t.dueDate),t.assigneeId!==void 0&&(n.assigneeId=t.assigneeId),t.labels!==void 0&&(n.labels=t.labels),YU(j({method:`POST`,path:`/api/cmmd/tasks/update`,body:n},this.cfg))}async createComment(e){return YU(j({method:`POST`,path:`/api/cmmd/tasks/comment`,body:{taskId:e.entityId,content:e.content}},this.cfg))}async updateComment(e,t,n){let r=`${e}:${t}:${n}`,i=this.commentEditIdempotencyKeys.get(r)??crypto.randomUUID();this.commentEditIdempotencyKeys.set(r,i);let a=await YU(j({method:`PATCH`,path:`/api/cmmd/tasks/${e}/comments/${t}`,body:{content:n,idempotencyKey:i}},this.cfg));return this.commentEditIdempotencyKeys.delete(r),a}async deleteComment(e,t){let n=`${e}:${t}`,r=this.commentDeleteIdempotencyKeys.get(n)??crypto.randomUUID();this.commentDeleteIdempotencyKeys.set(n,r),await YU(j({method:`DELETE`,path:`/api/cmmd/tasks/${e}/comments/${t}`,body:{idempotencyKey:r}},this.cfg)),this.commentDeleteIdempotencyKeys.delete(n)}async createProjectComment(e,t){let n=(await j({method:`POST`,path:`/api/cmmd/projects/${e}/comments`,body:{content:t.content,organizationId:t.organizationId??null}},this.cfg))?.comment;if(!n)throw new xn({kind:`server`,message:`CMMD did not return the created project comment.`});return n}async updateProject(e,t){let n={};for(let e of wte){let r=t[e];r!==void 0&&(n[e]=kte[e]===`nullableId`?hW(r):r)}await j({method:`PATCH`,path:`/api/cmmd/projects/${e}`,body:n},this.cfg)}async setProjectLink(e){await j({method:`POST`,path:`/.well-known/forge/project-link`,body:e},this.cfg)}async deleteProjectLink(e){await j({method:`DELETE`,path:`/.well-known/forge/project-link`,query:{environmentId:e.environmentId,projectId:e.projectId,cwd:e.cwd,...e.cmmdProjectId?{cmmdProjectId:e.cmmdProjectId}:{}}},this.cfg)}async createCmmdProject(e){return j({method:`POST`,path:`/.well-known/forge/cmmd/projects`,body:e},this.cfg)}async ensureGitHubProjectContext(e){return j({method:`POST`,path:`/.well-known/forge/cmmd/github-project-contexts/ensure`,body:e},this.cfg)}async createBrainDoc(e){return j({method:`POST`,path:`/api/cmmd/brain-docs`,body:e},this.cfg)}async uploadTaskAttachment(e,t){let n=new FormData;return n.append(`file`,t),YU(j({method:`POST`,path:`/api/cmmd/tasks/${e}/attachments`,form:n},this.cfg))}async archiveTask(e){await j({method:`POST`,path:`/api/cmmd/tasks/${e}/archive`},this.cfg)}async unarchiveTask(e){await j({method:`POST`,path:`/api/cmmd/tasks/${e}/unarchive`},this.cfg)}async getProfile(){return j({method:`GET`,path:`/api/cmmd/profile`},this.cfg)}async getUsageSummary(e){return j({method:`GET`,path:`/api/cmmd/usage/summary`,query:{sinceDay:e.sinceDay,untilDay:e.untilDay,timeZone:e.timeZone,...e.resolution===`hour`?{resolution:e.resolution,sinceTime:e.sinceTime,untilTime:e.untilTime}:{}}},this.cfg)}getBilling(e){return Tze(this.cfg,e)}getBillingSeries(e){return Eze(this.cfg,e)}async getBootstrap(){return j({method:`GET`,path:`/api/cmmd/bootstrap`},this.cfg)}async getOrgProviderPolicy(){return j({method:`GET`,path:`/api/cmmd/org/provider-policy`},this.cfg)}async listSavedDataViews(e){return j({method:`GET`,path:`/api/cmmd/saved-views`,query:{surface:e.surface,projectId:e.projectId}},this.cfg)}async createSavedDataView(e){return j({method:`POST`,path:`/api/cmmd/saved-views`,body:e},this.cfg)}async importSavedDataView(e){return j({method:`POST`,path:`/api/cmmd/saved-views/import`,body:e},this.cfg)}async updateSavedDataView(e,t){return j({method:`PATCH`,path:`/api/cmmd/saved-views/${encodeURIComponent(e)}`,body:t},this.cfg)}async deleteSavedDataView(e,t){return j({method:`DELETE`,path:`/api/cmmd/saved-views/${encodeURIComponent(e)}`,query:t},this.cfg)}async getDeviceRegistry(e){return j({method:`GET`,path:`/api/cmmd/devices`,...e?.projectId===void 0?{}:{query:{projectId:String(e.projectId)}},...e?.signal===void 0?{}:{signal:e.signal}},this.cfg)}async registerDevice(e){return j({method:`POST`,path:`/api/cmmd/devices/register`,body:e},this.cfg)}async grantRuntimeAccess(e,t){return j({method:`POST`,path:`/api/cmmd/devices/runtimes/${encodeURIComponent(e)}/access-grants`,body:t},this.cfg)}async revokeRuntimeAccess(e,t){return j({method:`POST`,path:`/api/cmmd/devices/runtimes/${encodeURIComponent(e)}/access-grants/${encodeURIComponent(String(t))}/revoke`},this.cfg)}async issueRelayControlRoute(e,t){return j({method:`POST`,path:`/api/cmmd/devices/runtimes/${encodeURIComponent(e)}/relay-routes`,body:t},this.cfg)}async issueRelayActionGrant(e,t){return j({method:`POST`,path:`/api/cmmd/devices/runtimes/${encodeURIComponent(e)}/relay-action-grants`,body:t},this.cfg)}async getRuntimeInventory(e){let t=qze(e);return Qze(await j({method:`GET`,path:`/api/cmmd/runtime-inventory`,...Object.keys(t).length>0?{query:t}:{}},this.cfg))}async getRuntimeDiagnostics(e){return j({method:`GET`,path:`/api/cmmd/runtime-diagnostics/v2/runtimes/${encodeURIComponent(e)}`},this.cfg)}async getCloudProjectLifecyclePreflight(e){return(await j({method:`GET`,path:`/api/cmmd/forge-cloud-projects/${encodeURIComponent(String(e))}/lifecycle-preflight`},this.cfg)).preflight}async replaceRuntimeInventory(e,t){return j({method:`PUT`,path:`/api/cmmd/devices/runtimes/${encodeURIComponent(e)}/inventory`,body:t},this.cfg)}static PROVIDER_ACCOUNTS_PATH=`/api/cmmd/providers/accounts`;static PROVIDER_USAGE_PATH=`/api/cmmd/providers/usage`;static PROVIDER_USAGE_REFRESH_PATH=`/api/cmmd/providers/usage/refresh`;provisionAuthRuntime(){return xze(this.cfg)}getAuthRuntimeState(){return Sze(this.cfg)}destroyAuthRuntime(){return Cze(this.cfg)}connectAuthRuntime(){return wze(this.cfg)}getUserCodexCredential(){return Dze(this.cfg)}disconnectUserCodexCredential(){return Oze(this.cfg)}getUserClaudeCredential(){return kze(this.cfg)}async getProviderAccounts(){return j({method:`GET`,path:e.PROVIDER_ACCOUNTS_PATH},this.cfg)}async removeLinkedProviderAccount(e){return jze(this.cfg,e)}async setProviderAccountDefault(t){return j({method:`PUT`,path:`${e.PROVIDER_ACCOUNTS_PATH}/default`,body:{provider:t.provider,provider_account_id:t.providerAccountId}},this.cfg)}async getProviderUsage(){return j({method:`GET`,path:e.PROVIDER_USAGE_PATH},this.cfg)}async refreshProviderUsage(t,n){return j({method:`POST`,path:e.PROVIDER_USAGE_REFRESH_PATH,body:{provider:t,providerAccountId:n}},this.cfg)}disconnectUserClaudeCredential(){return Aze(this.cfg)}async getClaudeRuntimeReadiness(e){return j({method:`GET`,path:`/api/cmmd/providers/claude/runtime-readiness/${encodeURIComponent(e)}`},this.cfg)}async appendRuntimeThreadEvents(e,t,n){return j({method:`POST`,path:`/api/cmmd/devices/runtimes/${encodeURIComponent(e)}/threads/${encodeURIComponent(t)}/events`,body:n},this.cfg)}async getRuntimeThreadReplica(e,t){return Yze(e,t)?Zze():j({method:`GET`,path:`/api/cmmd/threads/${encodeURIComponent(e)}/${encodeURIComponent(t)}`},this.cfg)}renameCloudEnvironment(e,t){return Wze(this.cfg,e,t)}renameDevice(e,t){return Gze(this.cfg,e,t)}revokeDevice(e){return Kze(this.cfg,e)}static SIM_PATH=`/api/cmmd/sim-host`;static simScope(e){return e?.orgId===void 0?``:`?orgId=${encodeURIComponent(String(e.orgId))}`}async listSimHosts(t){return j({method:`GET`,path:`${e.SIM_PATH}/hosts${e.simScope(t)}`},this.cfg)}async getSimLease(t){let n=new URLSearchParams({forgeEnvironmentId:t.forgeEnvironmentId,threadId:t.threadId,...t.orgId===void 0?{}:{orgId:String(t.orgId)}});return j({method:`GET`,path:`${e.SIM_PATH}/leases?${n.toString()}`},this.cfg)}async claimSimLease(t){return j({method:`POST`,path:`${e.SIM_PATH}/leases${e.simScope(t)}`,body:{hostId:t.hostId,forgeEnvironmentId:t.forgeEnvironmentId,threadId:t.threadId,ttlMs:t.ttlMs}},this.cfg)}async renewSimLease(t){return j({method:`POST`,path:`${e.SIM_PATH}/leases/${encodeURIComponent(String(t.leaseId))}/renew${e.simScope(t)}`,body:{generation:t.generation,rowVersion:t.rowVersion,ttlMs:t.ttlMs}},this.cfg)}async releaseSimLease(t){await j({method:`POST`,path:`${e.SIM_PATH}/leases/${encodeURIComponent(String(t.leaseId))}/release${e.simScope(t)}`,body:{generation:t.generation,rowVersion:t.rowVersion}},this.cfg)}async listCampaigns(e){let t={};return e?.orgId&&(t.orgId=e.orgId),e?.allWorkspaces&&(t.allWorkspaces=`true`),iW(await j({method:`GET`,path:`/api/cmmd/campaigns`,query:t,...e?.signal?{signal:e.signal}:{}},this.cfg),`campaigns`).map(rBe)}async getCampaign(e){return j({method:`GET`,path:`/api/cmmd/campaigns/${e}`},this.cfg)}async createCampaign(e){return j({method:`POST`,path:`/api/cmmd/campaigns`,body:e},this.cfg)}async updateCampaign(e,t){return j({method:`PUT`,path:`/api/cmmd/campaigns/${e}`,body:t},this.cfg)}async deleteCampaign(e){await j({method:`DELETE`,path:`/api/cmmd/campaigns/${e}`},this.cfg)}async listProjects(e){let t={};return e?.campaignId&&(t.campaignId=e.campaignId),e?.orgId&&(t.orgId=e.orgId),e?.allWorkspaces&&(t.allWorkspaces=`true`),iW(await j({method:`GET`,path:`/api/cmmd/projects`,query:t,...e?.signal?{signal:e.signal}:{}},this.cfg),`projects`).map(pW)}async listTasks(e){let t={};return e?.projectId&&(t.projectId=e.projectId),e?.status&&(t.status=e.status),j({method:`GET`,path:`/api/cmmd/tasks`,query:t},this.cfg)}async getProject(e){return pW(await j({method:`GET`,path:`/api/cmmd/projects/${e}`},this.cfg))}async getProjectMembers(e){let t=await j({method:`GET`,path:`/api/cmmd/projects/${e}/members`},this.cfg);return Array.isArray(t)?t.map(sW):[]}async listWorkspaceMembers(){let e=await j({method:`GET`,path:`/api/cmmd/members`},this.cfg);return Array.isArray(e)?e.map(eBe):[]}async addProjectMember(e,t){return j({method:`POST`,path:`/api/cmmd/projects/${e}/members`,body:t},this.cfg)}async listProjectAgentMembers(e){return j({method:`GET`,path:`/api/cmmd/projects/${e}/agent-members`},this.cfg)}async createProjectAgentMember(e,t){return j({method:`POST`,path:`/api/cmmd/projects/${e}/agent-members`,body:t},this.cfg)}async renameProjectAgentMember(e,t,n){return j({method:`PATCH`,path:`/api/cmmd/projects/${e}/agent-members/${t}`,body:n},this.cfg)}async retireProjectAgentMember(e,t,n){return j({method:`POST`,path:`/api/cmmd/projects/${e}/agent-members/${t}/retire`,body:n},this.cfg)}async updateProjectAgentMemberAvatar(e,t,n){return j({method:`PUT`,path:`/api/cmmd/projects/${e}/agent-members/${t}/avatar`,body:n},this.cfg)}async listProjectAgentMemberInstances(e,t){return j({method:`GET`,path:`/api/cmmd/projects/${e}/agent-members/${t}/instances`},this.cfg)}async previewProjectAgentMemberConsolidation(e){return j({method:`POST`,path:`/api/cmmd/projects/${e}/agent-members/consolidation/preview`},this.cfg)}async applyProjectAgentMemberConsolidation(e,t){return j({method:`POST`,path:`/api/cmmd/projects/${e}/agent-members/consolidation/apply`,body:t},this.cfg)}async setProjectTaskAssignment(e,t,n){return j({method:`PUT`,path:`/api/cmmd/projects/${e}/tasks/${t}/assignment`,body:n},this.cfg)}async getProjectUpdates(e,t){let n=t?.page??1,r=t?.limit??10;return tBe(await j({method:`GET`,path:`/api/cmmd/projects/${e}/updates`,query:{page:n,limit:r},unwrapEnvelope:!1},this.cfg),n,r)}async createProjectUpdate(e,t){return cW(await j({method:`POST`,path:`/api/cmmd/projects/${e}/updates`,body:t},this.cfg))}async updateProjectUpdate(e,t,n){return cW(await j({method:`PATCH`,path:`/api/cmmd/projects/${e}/updates/${t}`,body:n},this.cfg))}async deleteProjectUpdate(e,t){await j({method:`DELETE`,path:`/api/cmmd/projects/${e}/updates/${t}`},this.cfg)}async listProjectMilestones(e){return j({method:`GET`,path:`/api/cmmd/projects/${e}/milestones`},this.cfg)}async createProjectMilestone(e,t){return j({method:`POST`,path:`/api/cmmd/projects/${e}/milestones`,body:t},this.cfg)}async updateProjectMilestone(e,t,n){return j({method:`PATCH`,path:`/api/cmmd/projects/${e}/milestones/${t}`,body:n},this.cfg)}async deleteProjectMilestone(e,t){await j({method:`DELETE`,path:`/api/cmmd/projects/${e}/milestones/${t}`},this.cfg)}async improveProjectContent(e,t){return j({method:`POST`,path:`/api/cmmd/projects/${e}/content/readability`,body:t},this.cfg)}async listProjectBoard(e){return j({method:`GET`,path:`/api/cmmd/projects/${e}/board`},this.cfg)}async createProjectTaskDraft(e,t){return j({method:`POST`,path:`/api/cmmd/projects/${e}/task-drafts`,body:t},this.cfg)}async getProjectTaskDraft(e,t){return j({method:`GET`,path:`/api/cmmd/projects/${e}/task-drafts/${t}`},this.cfg)}async updateProjectTaskDraft(e,t,n){return j({method:`PATCH`,path:`/api/cmmd/projects/${e}/task-drafts/${t}`,body:n},this.cfg)}async previewProjectTaskDraft(e,t,n){return j({method:`POST`,path:`/api/cmmd/projects/${e}/task-drafts/${t}/preview`,body:n},this.cfg)}async commitProjectTaskDraft(e,t,n){return j({method:`POST`,path:`/api/cmmd/projects/${e}/task-drafts/${t}/commit`,body:n},this.cfg)}async discardProjectTaskDraft(e,t,n){return j({method:`POST`,path:`/api/cmmd/projects/${e}/task-drafts/${t}/discard`,body:n},this.cfg)}async getProjectTaskWorkflow(e){return j({method:`GET`,path:`/api/cmmd/projects/${e}/task-workflow`},this.cfg)}async updateProjectTaskWorkflow(e,t){return j({method:`PUT`,path:`/api/cmmd/projects/${e}/task-workflow`,body:t},this.cfg)}async getProjectLeadPlan(e){return j({method:`GET`,path:`/api/cmmd/projects/${e}/project-lead/plan`},this.cfg)}async activateProjectLeadAutomaticStaffing(e){return j({method:`POST`,path:`/api/cmmd/projects/${e}/project-lead/authority/activate`,body:{}},this.cfg)}async getProjectLeadReadiness(e){return j({method:`GET`,path:`/api/cmmd/projects/${e}/project-lead/readiness`},this.cfg)}async getProjectLeadCapabilities(e){return j({method:`GET`,path:`/api/cmmd/projects/${e}/project-lead/capabilities`},this.cfg)}async getProjectLeadSummary(e){return j({method:`GET`,path:`/api/cmmd/projects/${e}/project-lead/summary`},this.cfg)}async getProjectLeadDetail(e){return j({method:`GET`,path:`/api/cmmd/projects/${e}/project-lead/detail`},this.cfg)}async getProjectLeadBriefing(e){return j({method:`GET`,path:`/api/cmmd/projects/${e}/project-lead/briefing`},this.cfg)}async decideProjectLeadApproval(e,t,n){return j({method:`POST`,path:`/api/cmmd/projects/${e}/project-lead/approvals/${t}/decision`,body:n},this.cfg)}async listProjectLeadEvents(e,t){return j({method:`GET`,path:`/api/cmmd/projects/${e}/project-lead/events`,...t?{query:{...t.afterEventId===void 0?{}:{afterEventId:String(t.afterEventId)},...t.latest===void 0?{}:{latest:String(t.latest)},...t.limit===void 0?{}:{limit:String(t.limit)}}}:{}},this.cfg)}async explainProjectLead(e){return j({method:`GET`,path:`/api/cmmd/projects/${e}/project-lead/explain`},this.cfg)}async pauseProjectLead(e,t){return j({method:`POST`,path:`/api/cmmd/projects/${e}/project-lead/pause`,body:t},this.cfg)}async resumeProjectLead(e,t){return j({method:`POST`,path:`/api/cmmd/projects/${e}/project-lead/resume`,body:t},this.cfg)}async reserveProjectLeadTask(e,t,n){return j({method:`POST`,path:`/api/cmmd/projects/${e}/project-lead/tasks/${t}/reservations`,body:n},this.cfg)}async releaseProjectLeadReservation(e,t,n){return j({method:`POST`,path:`/api/cmmd/projects/${e}/project-lead/reservations/${t}/release`,body:n},this.cfg)}async reconcileProjectLead(e,t){return j({method:`POST`,path:`/api/cmmd/projects/${e}/project-lead/reconcile`,body:t},this.cfg)}async resolveProjectLeadAttention(e,t,n){return j({method:`POST`,path:`/api/cmmd/projects/${e}/project-lead/attention/${t}/resolve`,body:n},this.cfg)}async listCenterBoard(e){let t={};return e?.status&&(t.status=e.status),e?.workspaceId&&(t.workspaceId=String(e.workspaceId)),e?.campaignId&&(t.campaignId=String(e.campaignId)),e?.ownerId&&(t.ownerId=String(e.ownerId)),e?.includeArchived!==void 0&&(t.includeArchived=e.includeArchived),e?.q&&(t.q=e.q),j({method:`GET`,path:`/api/cmmd/work-items/board`,query:t},this.cfg)}async listForgeAutomationPresets(){return aW(await j({method:`GET`,path:`/api/cmmd/automations/presets`},this.cfg),`presets`)}async listUserForgeAutomationRules(){return aW(await j({method:`GET`,path:`/api/cmmd/automations/user/rules`},this.cfg),`rules`)}async createUserForgeAutomationRule(e){return j({method:`POST`,path:`/api/cmmd/automations/user/rules`,body:e},this.cfg)}async updateUserForgeAutomationRule(e,t){return j({method:`PATCH`,path:`/api/cmmd/automations/user/rules/${e}`,body:t},this.cfg)}async listUserForgeAutomationRuns(e){return aW(await j({method:`GET`,path:`/api/cmmd/automations/user/rules/${e}/runs`},this.cfg),`runs`)}async startUserForgeAutomationRun(e,t){return j({method:`POST`,path:`/api/cmmd/automations/user/rules/${e}/runs`,body:t},this.cfg)}async listForgeAutomationRules(e,t){let n=oW(t);return aW(await j({method:`GET`,path:`/api/cmmd/automations/projects/${e}/rules`,...n?{query:n}:{}},this.cfg),`rules`)}async createForgeAutomationRule(e,t,n){let r=oW(n);return j({method:`POST`,path:`/api/cmmd/automations/projects/${e}/rules`,body:t,...r?{query:r}:{}},this.cfg)}async updateForgeAutomationRule(e,t,n,r){let i=oW(r);return j({method:`PATCH`,path:`/api/cmmd/automations/projects/${e}/rules/${t}`,body:n,...i?{query:i}:{}},this.cfg)}async listForgeAutomationRuns(e,t){let n=oW(t,t?.taskId);return aW(await j({method:`GET`,path:`/api/cmmd/automations/projects/${e}/runs`,...n?{query:n}:{}},this.cfg),`runs`)}async getForgeAutomationRun(e,t){let n=oW(t);return j({method:`GET`,path:`/api/cmmd/automations/runs/${e}`,...n?{query:n}:{}},this.cfg)}async startForgeAutomationRun(e,t,n,r){let i=oW(r);return j({method:`POST`,path:`/api/cmmd/automations/projects/${e}/tasks/${t}/runs`,body:n,...i?{query:i}:{}},this.cfg)}async retryForgeAutomationRun(e,t,n){let r=oW(n);return j({method:`POST`,path:`/api/cmmd/automations/runs/${e}/retry`,body:t,...r?{query:r}:{}},this.cfg)}async cancelForgeAutomationRun(e,t,n){let r=oW(n);return j({method:`POST`,path:`/api/cmmd/automations/runs/${e}/cancel`,body:t,...r?{query:r}:{}},this.cfg)}async approveForgeAutomationEscalation(e,t,n){let r=oW(n);return j({method:`POST`,path:`/api/cmmd/automations/runs/${e}/escalations/approve`,body:t,...r?{query:r}:{}},this.cfg)}async rejectForgeAutomationEscalation(e,t,n){let r=oW(n);return j({method:`POST`,path:`/api/cmmd/automations/runs/${e}/escalations/reject`,body:t,...r?{query:r}:{}},this.cfg)}async createProjectBoardTask(e,t){let n={title:t.title};return t.description!==void 0&&(n.description=t.description),t.priority!==void 0&&(n.priority=t.priority),t.status!==void 0&&(n.status=t.status),t.workflowStageId!==void 0&&(n.workflowStageId=t.workflowStageId),t.assignee!==void 0&&(n.assignee=t.assignee),t.dueDate!==void 0&&(n.dueDate=t.dueDate),t.workItemType!==void 0&&(n.workItemType=t.workItemType),t.parentTaskId!==void 0&&(n.parentTaskId=t.parentTaskId),t.milestoneId!==void 0&&(n.milestoneId=t.milestoneId),t.dependsOn!==void 0&&(n.dependsOn=t.dependsOn),j({method:`POST`,path:`/api/cmmd/projects/${e}/board`,body:n},this.cfg)}async createCenterBoardTask(e){let t={title:e.title,projectId:e.projectId};return e.description!==void 0&&(t.description=e.description),e.priority!==void 0&&(t.priority=e.priority),e.status!==void 0&&(t.status=e.status),e.assignee!==void 0&&(t.assignee=e.assignee),e.dueDate!==void 0&&(t.dueDate=e.dueDate),e.workItemType!==void 0&&(t.workItemType=e.workItemType),e.parentTaskId!==void 0&&(t.parentTaskId=e.parentTaskId),e.milestoneId!==void 0&&(t.milestoneId=e.milestoneId),e.dependsOn!==void 0&&(t.dependsOn=e.dependsOn),j({method:`POST`,path:`/api/cmmd/work-items/board`,body:t},this.cfg)}async submitFeedback(e){let t={type:e.type,title:e.title,source:e.source};return e.description!==void 0&&(t.description=e.description),e.priority!==void 0&&(t.priority=e.priority),e.senderName!==void 0&&(t.senderName=e.senderName),j({method:`POST`,path:`/api/cmmd/feedback`,body:t},this.cfg)}async updateProjectBoardTask(e,t,n){return j({method:`PATCH`,path:`/api/cmmd/projects/${e}/board/${t}`,body:n},this.cfg)}async updateCenterBoardTask(e,t){return j({method:`PATCH`,path:`/api/cmmd/work-items/board/${e}`,body:t},this.cfg)}async moveCenterBoardTask(e,t){let n={toStatus:t.toStatus};return t.beforeTaskId!==void 0&&(n.beforeTaskId=t.beforeTaskId),t.afterTaskId!==void 0&&(n.afterTaskId=t.afterTaskId),j({method:`PATCH`,path:`/api/cmmd/work-items/board/${e}/move`,body:n},this.cfg)}async moveProjectBoardTask(e,t,n){let r={toStatus:n.toStatus};return n.toStageId!==void 0&&(r.toStageId=n.toStageId),n.beforeTaskId!==void 0&&(r.beforeTaskId=n.beforeTaskId),n.afterTaskId!==void 0&&(r.afterTaskId=n.afterTaskId),j({method:`PATCH`,path:`/api/cmmd/projects/${e}/board/${t}/move`,body:r},this.cfg)}async archiveProjectBoardTask(e,t){return j({method:`POST`,path:`/api/cmmd/projects/${e}/board/${t}/archive`},this.cfg)}async unarchiveProjectBoardTask(e,t){return j({method:`POST`,path:`/api/cmmd/projects/${e}/board/${t}/unarchive`},this.cfg)}async updateProjectBoardTaskStatus(e,t,n,r){return j({method:`PATCH`,path:`/api/cmmd/projects/${e}/board/${t}/status`,body:{status:n,...r?{workflowStageId:r}:{}}},this.cfg)}async listTaskExecutionOptions(e,t){return j({method:`GET`,path:`/api/cmmd/projects/${e}/board/${t}/execution-options`},this.cfg)}async createTaskWorkSession(e,t,n){return j({method:`POST`,path:`/api/cmmd/projects/${e}/board/${t}/work-sessions`,body:n},this.cfg)}async listProjectWorkSessions(e,t={}){return j({method:`GET`,path:`/api/cmmd/projects/${e}/work-sessions`,query:t},this.cfg)}async getWorkSession(e){return j({method:`GET`,path:`/api/cmmd/work-sessions/${e}`},this.cfg)}async updateWorkSessionStatus(e,t){return j({method:`PATCH`,path:`/api/cmmd/work-sessions/${e}`,body:{status:t}},this.cfg)}async attachWorkSessionThread(e,t){return j({method:`POST`,path:`/api/cmmd/work-sessions/${e}/threads`,body:t},this.cfg)}async listTaskConversations(e,t={}){return j({method:`GET`,path:`/api/cmmd/tasks/${e}/conversations`,query:nW(t)},this.cfg)}async linkTaskConversation(e,t){return j({method:`POST`,path:`/api/cmmd/tasks/${e}/conversations`,body:t},this.cfg)}async getTaskHistory(e){return j({method:`GET`,path:`/api/cmmd/tasks/${e}/history`},this.cfg)}async upsertTaskPullRequest(e,t){return j({method:`PUT`,path:`/api/cmmd/tasks/${e}/pull-requests`,body:t},this.cfg)}postPullRequest(e,t){return j({method:`POST`,path:`/api/cmmd/pull-requests/${e}`,body:t},this.cfg)}async listPullRequests(e){return this.postPullRequest(`list`,e)}async getPullRequestListStats(e){return this.postPullRequest(`list-stats`,e)}async getPullRequestDetail(e){return this.postPullRequest(`detail`,e)}async getPullRequestActivity(e){return this.postPullRequest(`activity`,e)}async getPullRequestDiff(e){return this.postPullRequest(`diff`,e)}async getPullRequestDiffFileContents(e){return this.postPullRequest(`diff-file-contents`,e)}async getPullRequestThreadComments(e){return this.postPullRequest(`thread/comments`,e)}async getPullRequestReviewerCandidates(e){return this.postPullRequest(`reviewer-candidates`,e)}async runPullRequestAction(e){return this.postPullRequest(`action`,e)}async createPullRequestComment(e){return this.postPullRequest(`comment`,e)}async updatePullRequest(e){return this.postPullRequest(`update`,e)}async updatePullRequestComment(e){return this.postPullRequest(`comment/update`,e)}async submitPullRequestReview(e){return this.postPullRequest(`review`,e)}async replyToPullRequestThread(e){return this.postPullRequest(`thread/reply`,e)}async setPullRequestThreadResolution(e){return this.postPullRequest(`thread/resolution`,e)}async requestPullRequestReviewers(e){return this.postPullRequest(`reviewers`,e)}async setPullRequestReaction(e){return this.postPullRequest(`reaction`,e)}async getTaskConversation(e,t,n={}){return j({method:`GET`,path:`/api/cmmd/tasks/${e}/conversations/${encodeURIComponent(t)}`,query:nW(n)},this.cfg)}async createTask(e){return j({method:`POST`,path:`/api/cmmd/tasks`,body:e},this.cfg)}async createSubtask(e){throw new rW(`createSubtask`)}async createBoardTask(e){throw new rW(`createBoardTask`)}async createProject(e){let t={};for(let[n,r]of Object.entries(e))r!=null&&(t[n]=r);return e.campaignId!==void 0&&e.campaignId!==null&&(t.campaignId=hW(e.campaignId)),e.organizationId!==void 0&&e.organizationId!==null&&(t.organizationId=hW(e.organizationId)),aBe(await j({method:`POST`,path:`/api/cmmd/projects`,body:t},this.cfg))}async moveProject(e,t){let n={targetOrgId:hW(t.targetOrgId)};return t.campaignStrategy!==void 0&&(n.campaignStrategy=t.campaignStrategy),t.targetCampaignId!==void 0&&(n.targetCampaignId=hW(t.targetCampaignId)),t.dryRun!==void 0&&(n.dryRun=t.dryRun),j({method:`POST`,path:`/api/cmmd/projects/${e}/move`,body:n},this.cfg)}async uploadBrainDoc(e,t){throw new rW(`uploadBrainDoc`)}};function _W(e){return new gW(e)}var vW=new gW({onAuthExpired:_n}),yW=class extends Rt(`BootstrapHttpError`){},bW=e=>pe(e,`BootstrapHttpError`);function xW(e){return typeof e!=`object`||!e?!1:!!(bW(e)&&e.status===401||e instanceof Error&&e.name===`RemoteEnvironmentAuthHttpError`&&`status`in e&&e.status===401||e instanceof xn&&e.kind===`auth`)}function oBe(e){let t=e.replace(/\s+/g,` `).trim();return t.length===0?`<empty response>`:t.slice(0,120)}async function SW(e,t){let n=await e.text();try{return JSON.parse(n)}catch{throw new yW({message:`${t} returned a non-JSON response (${oBe(n)}). Ensure the Forge server is running and this route is proxied correctly.`,status:e.status})}}function sBe(e){if(!e.authenticated||!e.role)throw Error(`Authenticated session is required.`);let t=cBe(e.cmmdIdentity??null);return t?{displayName:t,email:e.cmmdIdentity?.email??null,avatarUrl:e.cmmdIdentity?.avatarUrl??null,role:e.role,verified:!0,source:`cmmd-identity`}:{displayName:`CMMD identity unavailable`,email:null,avatarUrl:null,role:e.role,verified:!1,source:`fallback`}}function cBe(e){return e&&([e.firstName,e.lastName].map(e=>e?.trim()??``).filter(e=>e.length>0).join(` `)||e.username.trim()||e.email.trim())||null}var CW=null;function lBe(){if(CW)return CW;let e=new URL(`/api/auth/session`,window.location.origin).toString(),t=fetch(e,{credentials:`include`}).then(async t=>{if(!t.ok)throw new yW({message:`Failed to load current app auth session state (${t.status}).`,status:t.status});return SW(t,e)}).then(sBe).finally(()=>{CW===t&&(CW=null)});return CW=t,t}function wW(e={resolveUrl:ln}){let t=mn()?.bearerToken;return t?{...e,bearerToken:t}:e}var TW=null,EW=null,DW=null,OW=null,kW=new Set,AW=`cmmd-forge.loggedOutLocalBootstrapCredentials.v1`;function uBe(e){let t=`${e.firstName??``} ${e.lastName??``}`.trim();PU({id:e.id,email:e.email,...t.length>0?{username:t}:{}}),UU({cmmdUserId:e.id,...e.email?{email:e.email}:{},...t.length>0?{displayName:t}:{}})}function jW(){if(typeof window>`u`||DW)return;let e=window.desktopBridge?.desktopAuth?.onStateChange;e&&(DW=e(e=>{TW=null,EW=null,OW=null,e.sessionLifecycle.status!==`ready`&&PU(null),(e.sessionLifecycle.status===`expired`||e.sessionLifecycle.status===`signed-out`&&e.sessionLifecycle.reason===`refresh-revoked`)&&rne().catch(e=>{FU(e,{route:`desktop-auth-session-expired`})})}))}function dBe(){return sa(new URL(window.location.href))}function MW(){let e=new URL(window.location.href),t=wie(e);t.toString()!==e.toString()&&window.history.replaceState({},document.title,t.toString())}async function fBe(){return VW(async()=>{let e=ln(`/api/auth/session`),t=async()=>{let t=await fetch(e,pn({credentials:`include`}));if(!t.ok)throw new yW({message:`Failed to load server auth session state (${t.status}).`,status:t.status});return SW(t,e)},n=await t();return!n.authenticated&&n.auth.sessionMethods.length===1&&n.auth.sessionMethods[0]===`proxy-asserted`&&typeof window<`u`&&!window.desktopBridge&&e.startsWith(`https://`)&&await one()?t():n})}var NW=new Set([`CMMD_AUTH_REQUIRED`,`CMMD_AUTH_EXPIRED`]);async function pBe(e){return VW(async()=>{let t={credential:e},n=ln(`/api/auth/bootstrap`),r=await fetch(n,pn({body:JSON.stringify(t),credentials:`include`,headers:{"content-type":`application/json`},method:`POST`}));if(!r.ok)throw new yW({message:await r.text()||`Failed to bootstrap auth session (${r.status}).`,status:r.status});return SW(r,n)})}function PW(e){return new URL(e,window.location.origin).toString()}function FW(e){let t=(e?.primaryMode===`cloud`?null:e)?.bootstrapToken?.trim();return t&&t.length>0?t:null}function IW(){return typeof window>`u`?null:FW(window.desktopBridge?.getLocalEnvironmentBootstrap?.()??null)}function mBe(){return typeof window>`u`?!1:une()===`session-expired`}function LW(){if(typeof window>`u`)return new Set;try{let e=window.sessionStorage.getItem(AW),t=e?JSON.parse(e):[];return Array.isArray(t)?new Set(t.filter(e=>typeof e==`string`)):new Set}catch{return new Set}}function RW(e){if(!(typeof window>`u`))try{if(e.size===0){window.sessionStorage.removeItem(AW);return}window.sessionStorage.setItem(AW,JSON.stringify([...e]))}catch{}}function hBe(){let e=IW();if(!e)return;let t=new Set(LW());t.add(e),RW(t)}function gBe(e){return LW().has(e)}function zW(){let e=IW();if(!e){RW(new Set);return}let t=new Set(LW());t.delete(e),RW(t)}async function BW(){let e=PW(`/api/auth/session`),t=await fetch(e,{credentials:`include`});return t.ok?SW(t,e):null}async function _Be(e){if(typeof window>`u`)return;let t=FW(e);if(!t||mBe()||kW.has(t)||gBe(t))return;if((await BW().catch(()=>null))?.authenticated){kW.add(t);return}let n=PW(`/api/auth/bootstrap`),r=await fetch(n,{body:JSON.stringify({credential:t}),credentials:`include`,headers:{"content-type":`application/json`},method:`POST`});if(!r.ok){if(r.status===401)return;throw new yW({message:await r.text()||`Failed to bootstrap local web owner session (${r.status}).`,status:r.status})}await SW(r,n),kW.add(t)}async function vBe(){let e=await fBe();if(e.authenticated)return e;let t=mn();if(t?.source!==`desktop-managed`||!t.bearerToken)return e;let n=await BW().catch(()=>null);return n?.authenticated?n:e}var yBe=new Set([404,502,503,504]),bBe=15e3,xBe=500;function SBe(e){mn()?.source===`paired-bearer`&&xW(e)&&cn(`http`)}async function VW(e){let t=Date.now();for(;;)try{return await e()}catch(e){if(SBe(e),!wBe(e))throw e;if(Date.now()-t>=bBe)throw FU(e,{route:`bootstrap-retry-exhausted`}),e;await CBe(xBe)}}function CBe(e){return new Promise(t=>{setTimeout(t,e)})}function wBe(e){return bW(e)?yBe.has(e.status):e instanceof TypeError||e instanceof DOMException&&e.name===`AbortError`}function TBe(e,t){return e.sessionLifecycle.status===`ready`?e.sessionLifecycle.principalId!==t.id||e.cmmd.identity?.id!==t.id?`desktop-principal-mismatch`:null:`desktop-session-required`}async function EBe(e){if(typeof window>`u`||!window.desktopBridge)return null;let t=window.desktopBridge.desktopAuth?.getState;if(!t)return`desktop-state-unavailable`;try{return TBe(await t(),e)}catch(e){return FU(e,{route:`desktop-auth-gate-state`}),`desktop-state-unavailable`}}async function DBe(e,t){return PU(null),ine(t),await fn().catch(e=>{FU(e,{route:`desktop-auth-gate-logout`})}),{status:`requires-auth`,auth:e.auth,errorMessage:fne(t)??`Forge Desktop requires CMMD authentication.`}}async function OBe(){let e=await vBe();if(e.authenticated){if(e.cmmdIdentity){let t=await EBe(e.cmmdIdentity);return t?(hn(),DBe(e,t)):(hn(),uBe(e.cmmdIdentity),{status:`authenticated`})}return{status:`requires-auth`,auth:e.auth}}return{status:`requires-auth`,auth:e.auth}}async function kBe(e){let t=e.trim();if(!t)throw Error(`Enter a pairing token to continue.`);EW=null,zW(),await pBe(t),TW=null,MW()}function HW(){zW(),EW=null,TW=null}async function UW(e,t,n){let r=e.trim();if(!r)throw Error(`CMMD (Command) OAuth did not return an access token.`);let i=n?.refreshToken?.trim(),a=n?.mcpToken?.trim(),o=ln(`/api/auth/bootstrap/command`),s=await fetch(o,pn({body:JSON.stringify({accessToken:r,...i?{refreshToken:i}:{},...a?{mcpToken:a}:{},...t===void 0?{}:{user:t}}),credentials:`include`,headers:{"content-type":`application/json`},method:`POST`}));if(!s.ok)throw new yW({message:await s.text()||`Failed to bootstrap with CMMD OAuth token (${s.status}).`,status:s.status});await SW(s,o),HW()}async function ABe(){let e=ln(`/api/auth/ws-token`),t=await fetch(e,pn({credentials:`include`,method:`POST`}));if(!t.ok)throw new yW({message:await t.text()||`Failed to issue websocket token (${t.status}).`,status:t.status});return SW(t,e)}async function jBe(e){let t=await ABe(),n=new URL(e,window.location.origin);return n.searchParams.set(`wsToken`,t.token),n.toString()}async function MBe(e){let t=`/api/cmmd/work-intake`,n;try{n=await j({method:`GET`,path:t,allowRetry:!1,...e?{query:{fresh:1}}:{}},wW())}catch(e){throw e instanceof xn&&e.kind!==`auth`&&e.code!==null&&NW.has(e.code)?new xn({kind:`auth`,message:e.message,status:e.status??401,code:e.code}):e}if(!n)throw Error(`Invalid response from ${t}`);return n}async function NBe(e={}){return MBe(e.forceFresh===!0)}async function WW(e,t){try{return await j({method:`POST`,path:e,body:t,allowRetry:!1},wW())}catch(e){throw e instanceof xn&&e.kind!==`auth`&&e.code!==null&&NW.has(e.code)?new xn({kind:`auth`,message:e.message,status:e.status??401,code:e.code}):e}}async function PBe(e){try{return await WW(`/api/cmmd/tasks/update`,e)}catch(t){if(t instanceof xn&&(t.kind===`auth`||t.kind===`permission`))throw t;if(t instanceof xn||t instanceof Error)return WW(`/api/command/tasks/update`,e);throw t}}async function FBe(){typeof window>`u`||await window.desktopBridge?.desktopAuth?.logoutCloud?.()}async function IBe(){let e=await Promise.allSettled([fn(),FBe()]);PU(null),hBe(),TW=null,EW=null;let t=e.find(e=>e.status===`rejected`);if(t)throw t.reason}async function GW(){if(jW(),EW?.status===`authenticated`)return hn(),EW;if(TW)return TW;let e=KW().then(t=>TW===e?(t.status===`authenticated`&&(EW=t),t):GW()).finally(()=>{TW===e&&(TW=null)});return TW=e,e}async function KW(){return dn().then(e=>_Be(e)).then(()=>OBe())}function qW(){if(jW(),OW)return OW;TW=null,EW=null;let e=KW().then(t=>OW===e?(t.status===`authenticated`&&(EW=t,hn()),t):qW()).finally(()=>{OW===e&&(OW=null)});return OW=e,e}function LBe(e){let t=``;for(let n of e)t+=String.fromCharCode(n);return btoa(t).replace(/\+/g,`-`).replace(/\//g,`_`).replace(/=+$/u,``)}function RBe(e){let t=LBe(e).replace(/-/g,`+`).replace(/_/g,`/`);return`-----BEGIN PUBLIC KEY-----\n${((t+`=`.repeat((4-t.length%4)%4)).match(/.{1,64}/gu)??[]).join(`
1006
1006
  `)}\n-----END PUBLIC KEY-----\n`}function JW(e){return{publicKeyPem:RBe(e.publicKeySpkiDer),async sign(t){let n=await crypto.subtle.sign(`Ed25519`,e.privateKey,new TextEncoder().encode(t));return new Uint8Array(n)}}}var zBe=`cmmd-session-pop`,YW=`keys`,XW=`device-key`;function BBe(){return!1}var ZW=class extends Error{constructor(e){super(`CMMD session key storage is unavailable (${e}). Session binding is enabled, so login cannot continue without a bound key: allow site data and IndexedDB for this origin, then retry.`),this.name=`CmmdSessionPopKeyStorageError`}};function VBe(e){return e===void 0?typeof indexedDB>`u`?null:indexedDB:e}function QW(e){return new Promise((t,n)=>{e.addEventListener(`success`,()=>t(e.result),{once:!0}),e.addEventListener(`error`,()=>n(e.error),{once:!0})})}function HBe(e){return new Promise((t,n)=>{e.addEventListener(`complete`,()=>t(),{once:!0}),e.addEventListener(`abort`,()=>n(e.error??new DOMException(`The transaction aborted.`,`AbortError`)),{once:!0}),e.addEventListener(`error`,()=>n(e.error??new DOMException(`The transaction failed.`,`UnknownError`)),{once:!0})})}function UBe(e){return new Promise((t,n)=>{let r=e.open(zBe,1);r.addEventListener(`upgradeneeded`,()=>{r.result.objectStoreNames.contains(YW)||r.result.createObjectStore(YW)}),r.addEventListener(`success`,()=>t(r.result),{once:!0}),r.addEventListener(`error`,()=>n(r.error),{once:!0})})}function $W(e){if(!e||typeof e!=`object`)return!1;let t=e;return t.privateKey instanceof CryptoKey&&t.publicKeySpkiDer instanceof Uint8Array}async function WBe(e){let t=await QW(e.transaction(YW,`readonly`).objectStore(YW).get(XW));return $W(t)?{privateKey:t.privateKey,publicKeySpkiDer:t.publicKeySpkiDer}:null}async function GBe(e,t){let n=e.transaction(YW,`readwrite`),r=n.objectStore(YW),i=HBe(n);i.catch(()=>void 0);let a=await QW(r.get(XW));return $W(a)?{privateKey:a.privateKey,publicKeySpkiDer:a.publicKeySpkiDer}:(await QW(r.add(t,XW)),await i,t)}var eG=null;async function KBe(e={}){return BBe()?(eG??=qBe(e).finally(()=>{eG=null}),eG):null}async function qBe(e){let t=VBe(e.indexedDB),n=e.subtle??crypto.subtle;if(!t)throw new ZW(`IndexedDB is not available in this context`);let r;try{r=await UBe(t)}catch{throw new ZW(`the key database could not be opened`)}try{let e=await WBe(r);if(e)return JW({privateKey:e.privateKey,publicKeySpkiDer:e.publicKeySpkiDer});let t=await n.generateKey({name:`Ed25519`},!1,[`sign`]),i={privateKey:t.privateKey,publicKeySpkiDer:new Uint8Array(await n.exportKey(`spki`,t.publicKey))};return JW(await GBe(r,i))}catch(e){throw e instanceof ZW?e:new ZW(`the session key could not be generated or persisted`)}}function tG(e={}){return KBe(e).then(e=>e?.publicKeyPem??null)}async function JBe(e,t={}){let n=e.email.trim();if(!n||!e.password)throw Error(`Enter your CMMD email and password.`);let r=await(t.resolvePopPublicKey??tG)(),i=ln(`/api/auth/cmmd-password/token`),a=await fetch(i,pn({body:JSON.stringify({email:n,password:e.password,...r?{pop_public_key:r}:{}}),credentials:`include`,headers:{"content-type":`application/json`},method:`POST`}));if(!a.ok)throw new yW({message:await a.text()||`CMMD login failed (${a.status}).`,status:a.status});let o=await SW(a,i);if(o.authenticated===!0)return HW(),{serverEstablishedSession:!0};if(typeof o.access_token!=`string`||o.access_token.trim().length===0)throw Error(`CMMD login did not return an access token.`);return await UW(o.access_token,o.user,{refreshToken:typeof o.refresh_token==`string`?o.refresh_token:void 0,mcpToken:typeof o.mcp_token==`string`?o.mcp_token:void 0}),{serverEstablishedSession:!1}}async function nG(e,t){return await e.text()||t}async function YBe(e,t){let n=e?.trim(),r={...n?{label:n}:{},...t?{role:t}:{}},i=ln(`/api/auth/pairing-token`),a=await fetch(i,pn({body:JSON.stringify(r),credentials:`include`,headers:{"content-type":`application/json`},method:`POST`}));if(!a.ok)throw Error(await nG(a,`Failed to create pairing credential (${a.status}).`));return SW(a,i)}async function XBe(){let e=ln(`/api/auth/clients`),t=await fetch(e,pn({credentials:`include`}));if(!t.ok)throw Error(await nG(t,`Failed to load paired clients (${t.status}).`));return SW(t,e)}async function ZBe(e){let t=ln(`/api/auth/pairing-links/revoke`),n=await fetch(t,pn({body:JSON.stringify({id:e}),credentials:`include`,headers:{"content-type":`application/json`},method:`POST`}));if(!n.ok)throw Error(await nG(n,`Failed to revoke the pairing link (${n.status}).`));return(await SW(n,t)).revoked}var QBe=`/.well-known/forge/environment`,rG=yn()(e=>({descriptor:null,setDescriptor:t=>e({descriptor:t}),reset:()=>e({descriptor:null})})),iG=null;function $Be(e){let t=aG();return t?Nre(ii({id:t.environmentId,label:t.label,source:e.source,target:e.target}),t):null}async function eVe(){return VW(async()=>{await dn();let e=mn()?.bearerToken,t=ln(QBe),n=e?await fetch(t,{headers:{Authorization:`Bearer ${e}`}}):await fetch(t);if(!n.ok)throw new yW({message:`Failed to load server environment descriptor (${n.status}).`,status:n.status});let r=await SW(n,t);return oG(r),r})}function aG(){return rG.getState().descriptor}function tVe(){return rG(nVe)}function nVe(e){return e.descriptor?.environmentId??null}function rVe(){return rG(iVe)}function iVe(e){return e.descriptor}function aVe(){return rG(oVe)}function oVe(e){return e.descriptor?.deviceRuntimeId??null}function sVe(){return aG()?.deviceRuntimeId??null}function cVe(){return rG(lVe)}function lVe(e){return zre(e.descriptor)}function uVe(){return rG(dVe)}function dVe(e){return Bre(e.descriptor)}function oG(e){rG.getState().setDescriptor(e)}function fVe(e,t){return t?.primaryMode!==`cloud`||e.environmentId===t.environmentId}function sG(){let e=mn();return e?$Be({source:e.source,target:e.target}):null}function pVe(){return mVe()}async function mVe(){let e=await dn(),t=aG();if(t&&fVe(t,e))return Promise.resolve(t);if(t&&oG(null),iG)return iG;let n=eVe();return iG=n,n.finally(()=>{iG===n&&(iG=null)})}var cG=class e{#e;constructor(e){this.#e=e}static namedByCatalog(t){return new e(t.projectId)}get registrationProjectId(){return this.#e}asConfirmationIdentity(){return{registrationProjectId:this.#e}}};function lG(e){return{match:t=>t.present({target:e})}}function uG(){return{match:e=>e.provablyAbsent()}}function hVe(e){return{match:t=>t.unprovable(e)}}var gVe=class e{#e;#t;capacity;constructor(e,t,n){this.#e=e,this.#t=t,this.capacity=n}static fromValidatedBody(t,n,r){return new e(t,n,r)}listRowsForDisplay(){return this.#e}listEnvironmentsForDisplay(){return this.#t}locate(e){if(e.registrationProjectId!==void 0){let t=this.#e.find(t=>t.projectId===e.registrationProjectId);return t===void 0?uG():lG(cG.namedByCatalog(t))}if(e.runtimeId!==void 0||e.cmmdEnvironmentId!==void 0){let t=this.#e.find(t=>t.runtime!=null&&(e.runtimeId!==void 0&&t.runtime.runtimeId===e.runtimeId||e.cmmdEnvironmentId!==void 0&&t.runtime.environmentId===e.cmmdEnvironmentId));if(t)return lG(cG.namedByCatalog(t))}if(this.#e.length===0)return uG();let t=e.runtimeId??e.cmmdEnvironmentId;return hVe(t===void 0?`no identity this catalog can be matched on`:`the catalog holds ${String(this.#e.length)} row(s) that ${t} cannot be ruled out against`)}};function dG(e){let t=e,n=t&&typeof t==`object`&&`data`in t&&t.data?t.data:t,r=n?.projects;if(!Array.isArray(r))throw Error("Forge Cloud returned a project catalog this version cannot read (no `projects` list).");let i=n?.environments;if(!Array.isArray(i))throw Error("Forge Cloud returned an Environment catalog this version cannot read (invalid `environments` list).");if(!r.every(_Ve))throw Error(`Forge Cloud returned a project catalog this version cannot read (invalid project entry).`);if(!i.every(vVe))throw Error(`Forge Cloud returned an Environment catalog this version cannot read (invalid Environment entry).`);return gVe.fromValidatedBody(r,i,n?.capacity??null)}function _Ve(e){return!pG(e)||typeof e.organizationId!=`number`||typeof e.projectId!=`number`?!1:e.runtime===void 0||e.runtime===null||fG(e.runtime)}function vVe(e){return pG(e)&&typeof e.organizationId==`number`&&typeof e.userId==`number`&&fG(e.runtime)}function fG(e){return pG(e)&&typeof e.runtimeId==`string`&&typeof e.status==`string`}function pG(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function yVe(e,t){let n=new URL(e);return n.pathname=t,n.search=``,n.hash=``,n.toString()}function mG(e){return e.accessToken??e.resolveAccessToken?.()}function hG(e,t,n=t=>yVe(e.cmmdHttpBaseUrl,t)){return j({method:t.method,path:t.path,...t.body===void 0?{}:{body:t.body},...t.signal===void 0?{}:{signal:t.signal}},{resolveUrl:n,resolveBearerToken:()=>mG(e)})}function bVe(e,t){return hG(e,{method:`GET`,path:`/api/forge/context/cloud-projects/${encodeURIComponent(String(t.projectId))}/removal-preview`,...t.signal===void 0?{}:{signal:t.signal}},e.cloudProjectRemovalPreviewUrl?()=>e.cloudProjectRemovalPreviewUrl(t.projectId):void 0).then(e=>e.preview)}function xVe(e,t){return hG(e,{method:`POST`,path:`/api/forge/context/cloud-projects/${encodeURIComponent(String(t.projectId))}/removal`,body:{idempotencyKey:t.idempotencyKey,deletePlanningProject:t.deletePlanningProject,...t.deleteCheckoutFiles===void 0?{}:{deleteCheckoutFiles:t.deleteCheckoutFiles},...t.previewToken===void 0?{}:{previewToken:t.previewToken},...t.forceDirty===void 0?{}:{forceDirty:t.forceDirty}},...t.signal===void 0?{}:{signal:t.signal}},e.cloudProjectRemovalUrl?()=>e.cloudProjectRemovalUrl(t.projectId):void 0).then(e=>e.operation)}function gG(e,t=``){return`/api/forge/context/runtimes/${encodeURIComponent(e)}${t}`}async function SVe(e){if(e.ok)return;let{CmmdApiError:t}=await A(async()=>{let{CmmdApiError:e}=await import(`./transport-CgH8pQK3.js`).then(e=>e.r);return{CmmdApiError:e}},__vite__mapDeps([0,1]));if(e.status===401||e.status===403){let n=null;try{let t=await e.json();n=typeof t?.code==`string`?t.code:null}catch{}throw new t({kind:`auth`,message:`CMMD authentication required. Sign in again to continue.`,status:e.status,code:n})}throw new t({kind:e.status>=500?`server`:`client`,message:`forge-cloud-projects proxy error (${e.status})`,status:e.status})}var _G=class{config;constructor(e){this.config=e}async ensureRuntime(e){return(await hG(this.config,{method:`POST`,path:`/api/forge/context/runtimes/ensure`,body:{...e.projectId===void 0?{}:{projectId:e.projectId},...e.organizationId===void 0?{}:{organizationId:e.organizationId},...e.githubRepoFullName===void 0?{}:{githubRepoFullName:e.githubRepoFullName},...e.workspaceRoot===void 0?{}:{workspaceRoot:e.workspaceRoot}},...e.signal===void 0?{}:{signal:e.signal}},this.config.ensureUrl?()=>this.config.ensureUrl:void 0)).runtime}async connectRuntime(e){return hG(this.config,{method:`POST`,path:gG(e.runtimeId,`/connect`),...e.organizationId===void 0?{}:{body:{organizationId:e.organizationId}},...e.signal===void 0?{}:{signal:e.signal}})}async getRuntime(e){return(await hG(this.config,{method:`GET`,path:gG(e.runtimeId),...e.signal===void 0?{}:{signal:e.signal}})).runtime}async destroyRuntime(e){return(await hG(this.config,{method:`POST`,path:gG(e.runtimeId,`/destroy`),body:{purgeVolume:e.purgeVolume??!1,...e.force===!0?{force:!0}:{},...e.reason===void 0?{}:{reason:e.reason},...e.organizationId===void 0?{}:{organizationId:e.organizationId}},...e.signal===void 0?{}:{signal:e.signal}},this.config.destroyUrl?()=>this.config.destroyUrl(e.runtimeId):void 0)).runtime}async runRuntimeLifecycleAction(e){return(await hG(this.config,{method:`POST`,path:gG(e.runtimeId,`/${e.action}`),body:e.organizationId===void 0?{}:{organizationId:e.organizationId},...e.signal===void 0?{}:{signal:e.signal}},this.config.lifecycleUrl?()=>this.config.lifecycleUrl(e.runtimeId,e.action):void 0)).runtime}async updateRuntimeCommit(e){return(await hG(this.config,{method:`POST`,path:gG(e.runtimeId,`/update-commit`),body:e.organizationId===void 0?{}:{organizationId:e.organizationId},...e.signal===void 0?{}:{signal:e.signal}},this.config.updateCommitUrl?()=>this.config.updateCommitUrl(e.runtimeId):void 0)).operation}async getRuntimeCommitUpdateOperation(e){return(await hG(this.config,{method:`GET`,path:gG(e.runtimeId,`/update-commit/${encodeURIComponent(String(e.operationId))}`),...e.signal===void 0?{}:{signal:e.signal}},this.config.updateCommitOperationUrl?()=>this.config.updateCommitOperationUrl(e.runtimeId,e.operationId):void 0)).operation}async listCloudProjects(e){if(this.config.listUrl){let t=mG(this.config),n=await fetch(this.config.listUrl,{method:`GET`,headers:{Accept:`application/json`,...t?{Authorization:`Bearer ${t}`}:{}},credentials:t?`omit`:`include`,cache:`no-store`,...e?.signal===void 0?{}:{signal:e.signal}});return await SVe(n),dG(await n.json())}return dG(await hG(this.config,{method:`GET`,path:`/api/forge/context/cloud-projects`,...e?.signal===void 0?{}:{signal:e.signal}}))}async previewCloudProjectRemoval(e){return bVe(this.config,e)}async requestCloudProjectRemoval(e){return xVe(this.config,e)}async getCloudProjectRemoval(e){return(await hG(this.config,{method:`GET`,path:`/api/forge/context/cloud-projects/removals/${encodeURIComponent(e.operationId)}`,...e.signal===void 0?{}:{signal:e.signal}},this.config.cloudProjectRemovalReceiptUrl?()=>this.config.cloudProjectRemovalReceiptUrl(e.operationId):void 0)).operation}},vG=`/api/attachments/upload/`;function CVe(e){if(!e.relativeUrl.startsWith(vG))throw Error(`Attachment upload URL did not use the expected upload route.`);let t=e.relativeUrl.slice(24);if(!/^[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+$/.test(t))throw Error(`Attachment upload URL did not contain a valid signed token.`);if(e.relativeUrl.includes(`?`)||e.relativeUrl.includes(`#`))throw Error(`Attachment upload URL must not include a query or fragment.`);let n=new URL(e.httpBaseUrl),r=n.pathname.endsWith(`/`)?n.pathname.slice(0,-1):n.pathname,i=`${r}${vG}`,a=new URL(`${r}${e.relativeUrl}`,n);if(a.origin!==n.origin||!a.pathname.startsWith(i))throw Error(`Attachment upload URL resolved outside the selected environment.`);return a.toString()}var yG=!1,bG=null;function xG(e){return Object.values(e)}function SG(e){return e.map(e=>vt(e))}function CG(e){try{ta(SG(xG(e))).catch(e=>{console.error(`[SAVED_ENVIRONMENTS] persist failed`,e)})}catch(e){console.error(`[SAVED_ENVIRONMENTS] persist failed`,e)}}function wVe(e){let t=wG.getState().byId,n=Object.fromEntries(e.map(e=>[e.environmentId,e]));wG.setState({byId:{...n,...t}})}async function TVe(){if(yG)return;if(bG)return bG;let e=(async()=>{try{wVe(await ea())}catch(e){console.error(`[SAVED_ENVIRONMENTS] hydrate failed`,e)}finally{yG=!0,wG.setState({hydrated:!0})}})().finally(()=>{bG===e&&(bG=null)});return bG=e,bG}var wG=yn()(e=>({byId:{},hydrated:yG,upsert:t=>e(e=>{let n={...e.byId,[t.environmentId]:t};return CG(n),{byId:n}}),remove:t=>e(e=>{let{[t]:n,...r}=e.byId;return CG(r),{byId:r}}),markConnected:(t,n)=>e(e=>{let r=e.byId[t];if(!r)return e;let i={...e.byId,[t]:{...r,lastConnectedAt:n}};return CG(i),{byId:i}}),reset:()=>{CG({}),e({byId:{}})}}));function TG(){return yG}function EG(){return TG()?Promise.resolve():TVe()}function DG(){return Object.values(wG.getState().byId).toSorted((e,t)=>e.label.localeCompare(t.label))}function EVe(){return DG().filter(e=>e.lastAuthenticatedPullRequestCapability===!0)}function OG(e){return wG.getState().byId[e]??null}function kG(e){let t=sG();return t?.environmentId===e?Mre(t):OG(e)?.httpBaseUrl??null}function AG(e){let t=kG(e.environmentId)??(typeof window<`u`?window.location.origin:null);if(!t)throw Error(`Unable to resolve HTTP base URL for environment ${e.environmentId}.`);let n=new URL(t);return n.pathname=`${n.pathname.endsWith(`/`)?n.pathname.slice(0,-1):n.pathname}${e.pathname.startsWith(`/`)?e.pathname:`/${e.pathname}`}`,e.searchParams&&(n.search=new URLSearchParams(e.searchParams).toString()),n.toString()}function jG(e){if(!kG(e))throw Error(`Unable to resolve HTTP base URL for environment ${e}.`)}function DVe(e){return jG(e.environmentId),CVe({httpBaseUrl:kG(e.environmentId),relativeUrl:e.relativeUrl})}async function MG(e){await ta(SG(xG({...wG.getState().byId,[e.environmentId]:e})))}async function OVe(e,t){let{[e]:n,...r}=wG.getState().byId,i={...r,[t.environmentId]:t};await ta(SG(xG(i))),wG.setState({byId:i})}async function NG(e){return na(e)}async function kVe(e,t){return ra(e,t)}async function PG(e){await ia(e)}function AVe(e){return new Promise(t=>globalThis.setTimeout(t,e))}function FG(){let e=Error(`The environment connection attempt was cancelled.`);return e.name=`AbortError`,e}function IG(e){if(e?.aborted)throw FG()}function LG(e,t){return t?t.aborted?Promise.reject(FG()):new Promise((n,r)=>{let i=()=>r(FG());t.addEventListener(`abort`,i,{once:!0}),e.then(n,r).finally(()=>{t.removeEventListener(`abort`,i)})}):e}function RG(e,t){return t?t.aborted?Promise.reject(FG()):new Promise((n,r)=>{let i=globalThis.setTimeout(()=>{t.removeEventListener(`abort`,a),n()},e),a=()=>{globalThis.clearTimeout(i),r(FG())};t.addEventListener(`abort`,a,{once:!0})}):AVe(e)}var jVe=Object.freeze({connectionState:`disconnected`,authState:`unknown`,lastError:null,lastErrorAt:null,role:null,descriptor:null,serverConfig:null,connectedAt:null,disconnectedAt:null,providerAuthority:null}),zG=()=>({...jVe}),BG=yn()(e=>({byId:{},ensure:t=>e(e=>e.byId[t]?e:{byId:{...e.byId,[t]:zG()}}),patch:(t,n)=>e(e=>({byId:{...e.byId,[t]:{...e.byId[t]??zG(),...n}}})),clear:t=>e(e=>{let{[t]:n,...r}=e.byId;return{byId:r}}),reset:()=>e({byId:{}})}));function VG(e){let t=OG(e.environmentId);if(t?.lastAuthenticatedPullRequestCapability!==void 0)return{...e,lastAuthenticatedPullRequestCapability:t.lastAuthenticatedPullRequestCapability};let n=BG.getState().byId?.[e.environmentId];return n?.authState===`authenticated`&&n.descriptor?{...e,lastAuthenticatedPullRequestCapability:n.descriptor.capabilities.pullRequests===!0}:e}function HG(e){return!!e.runtimeId?.trim()||Ui(e.environmentId).isCloud}function UG(e,t){return e.environmentId===t.environmentId&&e.httpBaseUrl===t.httpBaseUrl&&e.wsBaseUrl===t.wsBaseUrl&&e.runtimeId===t.runtimeId&&e.cmmdOrganizationId===t.cmmdOrganizationId}function MVe(e){return e.replacedRecord===null&&e.existing!==null&&UG(e.existing,e.record)}function NVe(e){let t=e.replacesEnvironmentId?Et.make(e.replacesEnvironmentId):null,n=t&&t!==e.environmentId?OG(t):null;return{existing:OG(e.environmentId)??n,replacedRecord:n}}async function PVe(e){return{records:DG(),bearerToken:e?await NG(e.environmentId):null}}async function WG(e){let t=e.replacedRecord?.environmentId??e.record.environmentId;await ta(e.rollback.records),await PG(e.record.environmentId).catch(()=>void 0),e.rollback.bearerToken&&await kVe(t,e.rollback.bearerToken)}async function FVe(e){try{e.replacedRecord?await OVe(e.replacedRecord.environmentId,e.record):await MG(e.record),IG(e.signal),await PG(e.record.environmentId),e.replacedRecord&&await PG(e.replacedRecord.environmentId),IG(e.signal)}catch(t){try{await WG(e)}catch(e){let n=AggregateError([t,e],`Cloud Environment rollback failed.`);throw n.cause=t,n}throw t}}function IVe(e){return{lastError:e instanceof Error?e.message:String(e),lastErrorAt:new Date().toISOString()}}var GG=new Map;function KG(e,t){return e.acquire(t?{signal:t}:{})}function LVe(e,t){GG.set(e,t)}function RVe(e){return GG.has(e)}function qG(e,t){let n=GG.get(e);if(t&&n!==t){t.dispose();return}n?.dispose(),GG.delete(e)}async function zVe(e){let t=GG.get(e);if(t)return(await t.acquire()).bearerToken;let n=OG(e);return n&&HG(n)?null:NG(e)}function JG(){return{executionCount:0,isPending:!1,lastArgs:void 0,lastExecutionTime:0,nextExecutionTime:0,status:`idle`,maybeExecuteCount:0}}var BVe={enabled:!0,leading:!0,trailing:!0,wait:0},VVe=class{#e;constructor(e,t){this.fn=e,this.store=new mne(JG()),this.setOptions=e=>{this.options={...this.options,...e},this.#n()||this.cancel()},this.#t=e=>{this.store.setState(t=>{let n={...t,...e},{isPending:r}=n;return{...n,status:this.#n()?r?`pending`:`idle`:`disabled`}}),hne(`Throttler`,this)},this.#n=()=>!!vn(this.options.enabled,this),this.#r=()=>vn(this.options.wait,this),this.maybeExecute=(...e)=>{this.#t({maybeExecuteCount:this.store.state.maybeExecuteCount+1});let t=Date.now(),n=t-this.store.state.lastExecutionTime,r=this.#r();if(this.options.leading&&n>=r)this.#i(...e);else if(this.#t({lastArgs:e}),!this.#e&&this.options.trailing){let e=r-(this.store.state.lastExecutionTime?t-this.store.state.lastExecutionTime:0);this.#t({isPending:!0}),this.#e=setTimeout(()=>{let{lastArgs:e}=this.store.state;e!==void 0&&this.#i(...e)},e)}},this.#i=(...e)=>{if(!this.#n())return;this.fn(...e);let t=Date.now(),n=t+this.#r();this.#a(),this.#t({executionCount:this.store.state.executionCount+1,lastExecutionTime:t,nextExecutionTime:n,isPending:!1,lastArgs:void 0}),this.options.onExecute?.(e,this),setTimeout(()=>{this.store.state.isPending||this.#t({nextExecutionTime:void 0})},this.#r())},this.flush=()=>{this.store.state.isPending&&this.store.state.lastArgs&&this.#i(...this.store.state.lastArgs)},this.#a=()=>{this.#e&&=(clearTimeout(this.#e),void 0)},this.cancel=()=>{this.#a(),this.#t({lastArgs:void 0,isPending:!1})},this.reset=()=>{this.#t(JG())},this.key=t.key,this.options={...BVe,...t},this.#t(this.options.initialState??{}),this.key&&gne.on(`d-Throttler`,e=>{e.payload.key===this.key&&(this.#t(e.payload.store.state),this.setOptions(e.payload.options))})}#t;#n;#r;#i;#a},YG={all:[`projects`],searchContents:(e,t,n,r,i,a,o)=>[`projects`,`search-contents`,e??null,t,n,r,i,a,o],searchEntries:(e,t,n,r)=>[`projects`,`search-entries`,e??null,t,n,r]},XG={all:[`providers`],checkpointDiff:e=>[`providers`,`checkpointDiff`,e.environmentId??null,e.threadId,e.fromTurnCount,e.toTurnCount,e.cacheScope??null]};function HVe(e){let t=null,n=!1;function r(){return t}function i(){n=!0,t?.queryInvalidationThrottler.maybeExecute()}function a(){t?.stop(),t=null}function o(r){if(t?.queryClient===r)return t.refCount+=1,()=>{!t||t.queryClient!==r||(--t.refCount,t.refCount===0&&a())};a(),n=!1;let i=new VVe(()=>{n&&(n=!1,r.invalidateQueries({queryKey:XG.all}),r.invalidateQueries({queryKey:YG.all}))},{wait:100,leading:!1,trailing:!0});e.createPrimaryEnvironmentConnection(),dn().catch(()=>void 0);let o=wG.subscribe(()=>{TG()&&e.syncSavedEnvironmentConnections(DG())});return EG().then(()=>e.syncSavedEnvironmentConnections(DG())).catch(()=>void 0),t={queryClient:r,queryInvalidationThrottler:i,refCount:1,stop:()=>{o(),i.cancel()}},()=>{!t||t.queryClient!==r||(--t.refCount,t.refCount===0&&a())}}return{readActiveService:r,notifyProviderInvalidation:i,stopActiveService:a,start:o}}var UVe=class extends Error{status;constructor(e,t){super(e),this.name=`RemoteEnvironmentAuthHttpError`,this.status=t}};function WVe(e,t){let n=new URL(e);return n.pathname=`${n.pathname.endsWith(`/`)?n.pathname.slice(0,-1):n.pathname}${t.startsWith(`/`)?t:`/${t}`}`,n.search=``,n.hash=``,n.toString()}async function GVe(e,t){let n=await e.text();if(!n)return t;try{let e=JSON.parse(n);if(typeof e.error==`string`&&e.error.length>0)return e.error}catch{}return n}async function ZG(e){let t=WVe(e.httpBaseUrl,e.pathname),n;try{n=await fetch(t,{method:e.method??`GET`,headers:{...e.body===void 0?{}:{"content-type":`application/json`},...e.bearerToken?{authorization:`Bearer ${e.bearerToken}`}:{}},...e.body===void 0?{}:{body:JSON.stringify(e.body)},...e.signal?{signal:e.signal}:{}})}catch(e){throw Error(`Failed to fetch remote auth endpoint ${t} (${e.message}).`,{cause:e})}if(!n.ok)throw new UVe(await GVe(n,`Remote auth request failed (${n.status}).`),n.status);return await n.json()}async function QG(e){return ZG({httpBaseUrl:e.httpBaseUrl,pathname:`/api/auth/session`,bearerToken:e.bearerToken,...e.signal?{signal:e.signal}:{}})}async function KVe(e){return ZG({httpBaseUrl:e.httpBaseUrl,pathname:`/.well-known/forge/environment`,...e.bearerToken?{bearerToken:e.bearerToken}:{}})}async function qVe(e){return ZG({httpBaseUrl:e.httpBaseUrl,pathname:`/api/auth/ws-token`,method:`POST`,bearerToken:e.bearerToken})}async function $G(e){let t=new URL(e.wsBaseUrl,window.location.origin);if(e.runtimeTicket)return t.searchParams.set(`runtimeTicket`,e.runtimeTicket),t.searchParams.delete(`wsToken`),t.toString();let n=await qVe({httpBaseUrl:e.httpBaseUrl,bearerToken:e.bearerToken});return t.searchParams.set(`wsToken`,n.token),t.toString()}function JVe(e,t){if(t){_ne(t,e);return}vne(e)}function YVe(e){let t=null,n=[];for(let r of e.split(/\r?\n/)){if(r.startsWith(`event:`)){t=r.slice(6).trim();continue}r.startsWith(`data:`)&&n.push(r.slice(5).trimStart())}return{eventName:t,data:n.join(`
1007
1007
  `)}}function XVe(e,t){let n=YVe(e);if(n.eventName!==`phase`||!n.data)return!1;try{let e=JSON.parse(n.data);return JVe(e,t),e.phase===`app-ready`||e.phase===`error`}catch{return!1}}async function eK(e,t,n){if(!e.body)return;let r=e.body.getReader(),i=new TextDecoder,a=``;for(;!n.aborted;){let{done:e,value:n}=await r.read();if(e)break;a+=i.decode(n,{stream:!0});let o=a.indexOf(`
1008
1008
 
@@ -2535,4 +2535,4 @@ XID_Start XIDS`.split(/\s/).map(e=>[b5(e),e])),F7e=new Map([[`s`,U5(383)],[U5(38
2535
2535
  ${e}
2536
2536
  }
2537
2537
  }`}function Iet(e,t){let n=_9(t);return e.replace(Net,n)}function Let(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function Ret({code:e,pre:t,columnType:n,rowSpan:r,containerSize:i=!1}={}){return e??(e=document.createElement(`code`),e.setAttribute(`data-code`,``),n!=null&&e.setAttribute(`data-${n}`,``),t?.appendChild(e)),r==null?e.style.removeProperty(`grid-row`):e.style.setProperty(`grid-row`,`span ${r}`),i?e.setAttribute(`data-container-size`,``):e.removeAttribute(`data-container-size`),e}function zet(e,t){if(t==null)return;let n=e.shadowRoot??e.attachShadow({mode:`open`});n.innerHTML===``&&(n.innerHTML=t)}function Bet(e,{type:t,diffIndicators:n,disableBackground:r,disableLineNumbers:i,overflow:a,split:o,totalLines:s,customProperties:c}){if(c!=null)for(let t in c){let n=c[t];n!=null&&e.setAttribute(t,`${n}`)}switch(t===`diff`?(e.setAttribute(`data-diff`,``),e.removeAttribute(`data-file`)):(e.setAttribute(`data-file`,``),e.removeAttribute(`data-diff`)),n){case`bars`:case`classic`:e.setAttribute(`data-indicators`,n);break;case`none`:e.removeAttribute(`data-indicators`)}return i?e.setAttribute(`data-disable-line-numbers`,``):e.removeAttribute(`data-disable-line-numbers`),r?e.removeAttribute(`data-background`):e.setAttribute(`data-background`,``),t===`diff`?e.setAttribute(`data-diff-type`,o?`split`:`single`):e.removeAttribute(`data-diff-type`),e.setAttribute(`data-overflow`,a),e.style.setProperty(`--diffs-min-number-column-width-default`,`${`${s}`.length}ch`),e}function Vet(e){if(typeof HTMLStyleElement<`u`&&e instanceof HTMLStyleElement)return!0;let t=e.tagName??e.nodeName;return typeof t==`string`&&t.toLowerCase()===`style`}function Het(e){return e?.useTokenTransformer===!0||e?.onTokenClick!=null||e?.onTokenEnter!=null||e?.onTokenLeave!=null}function Uet(e,t){let n=e?.offsetHeight??0;if(e==null||n===0){t();return}e.style.minHeight=`${n}px`;try{t(),e.offsetHeight}finally{e.style.minHeight=``}}function Wet({shadowRoot:e,currentNode:t,themeCSS:n}){if(n.trim()===``){t?.remove();return}return t??=Get(),t.textContent=n,t.parentNode!==e&&e.appendChild(t),t}function Get(){let e=document.createElement(`style`);return e.setAttribute(g4e,``),e}var Ket=void 0;function qet(){return Ket??=`safari`in window&&`pushNotification`in window.safari||/^((?!chrome|android).)*safari/i.test(navigator.userAgent)}if(typeof HTMLElement<`u`&&customElements.get(`diffs-container`)==null){let e;class t extends HTMLElement{constructor(){if(super(),this.shadowRoot!=null)return;let t=this.attachShadow({mode:`open`});e??(e=new CSSStyleSheet,e.replaceSync(Met)),t.adoptedStyleSheets=[e]}connectedCallback(){g9(this.shadowRoot??this.attachShadow({mode:`open`}))}}customElements.define(F2,t)}function Jet(e){return{...H2,...e}}function Yet(e,t){let n=Xet(e,t);return t?n:e.diffHeaderHeight+n}function Xet(e,t){return e.paddingTop??(t?e.spacing:0)}function Zet(e){return e.paddingBottom??e.spacing}function Qet(e){switch(e){case`simple`:return 4;case`metadata`:case`line-info`:case`line-info-basic`:case`custom`:return 32}}function y9(e,t){return e===t||e?.cacheKey!=null&&e.cacheKey===t?.cacheKey}function b9(e,t){return Y2(e.theme,t.theme)&&e.useTokenTransformer===t.useTokenTransformer&&e.tokenizeMaxLineLength===t.tokenizeMaxLineLength&&e.lineDiffType===t.lineDiffType&&e.maxLineDiffLength===t.maxLineDiffLength}function x9({line:e,spanStart:t,spanLength:n}){return{start:{line:e,character:t},end:{line:e,character:t+n},properties:{"data-diff-span":``},alwaysWrap:!0}}function S9({item:e,arr:t,enableJoin:n,isNeutral:r=!1,isLastItem:i=!1}){let a=t[t.length-1];if(a==null||i||!n){t.push([+!r,e.value]);return}let o=a[0]===0;if(r===o||r&&e.value.length===1&&!o){a[1]+=e.value;return}t.push([+!r,e.value])}function C9(e){return[$2(e.additionStart,e.additionCount)+1,e4(e.additionStart,e.additionCount)+1]}function w9({isPartial:e,rangeSize:t,expandedHunks:n,hunkIndex:r,collapsedContextThreshold:i}){let a=Math.max(t,0);if(a===0||e)return{fromStart:0,fromEnd:0,rangeSize:a,collapsedLines:a,renderAll:!1};if(n===!0||a<=i)return{fromStart:a,fromEnd:0,rangeSize:a,collapsedLines:0,renderAll:!0};let o=n?.get(r),s=Math.min(Math.max(o?.fromStart??0,0),a),c=Math.min(Math.max(o?.fromEnd??0,0),a),l=s+c,u=l>=a;return{fromStart:u?a:s,fromEnd:u?0:c,rangeSize:a,collapsedLines:Math.max(a-l,0),renderAll:u}}function $et(e){let t=e.hunks[e.hunks.length-1];if(t==null||e.isPartial||e.additionLines.length===0||e.deletionLines.length===0)return!1;let n=e.additionLines.length-e4(t.additionStart,t.additionCount),r=e.deletionLines.length-e4(t.deletionStart,t.deletionCount);return n<=0&&r<=0?!1:n!==r}function T9({fileDiff:e,errorPrefix:t}){let n=e.hunks[e.hunks.length-1];if(n==null||e.isPartial||e.additionLines.length===0||e.deletionLines.length===0)return 0;let r=e.additionLines.length-e4(n.additionStart,n.additionCount),i=e.deletionLines.length-e4(n.deletionStart,n.deletionCount);if(r<=0&&i<=0)return 0;if(r!==i)throw Error(`${t}: trailing context mismatch (additions=${r}, deletions=${i}) for ${e.name}`);return Math.min(r,i)}function E9({fileDiff:e,hunkIndex:t,expandedHunks:n,collapsedContextThreshold:r,errorPrefix:i}){if(t!==e.hunks.length-1)return;let a=T9({fileDiff:e,errorPrefix:i});if(a<=0)return;if(n===!0||a<=r)return{fromStart:a,fromEnd:0,rangeSize:a,collapsedLines:0,renderAll:!0};let o=n?.get(e.hunks.length),s=Math.min(Math.max(o?.fromStart??0,0),a);return{fromStart:s,fromEnd:0,rangeSize:a,collapsedLines:a-s,renderAll:s>=a}}function ett({fileDiff:e,lineNumber:t,expandedHunks:n,collapsedContextThreshold:r}){if(n===!0||e.isPartial)return!0;for(let[i,a]of e.hunks.entries()){let[o,s]=C9(a);if(t<o){let s=w9({isPartial:e.isPartial,rangeSize:a.collapsedBefore,expandedHunks:n,hunkIndex:i,collapsedContextThreshold:r}),c=o-s.rangeSize;return s.renderAll||t<c+s.fromStart||t>=o-s.fromEnd}if(t<s)return!0}let i=E9({fileDiff:e,hunkIndex:e.hunks.length-1,expandedHunks:n,collapsedContextThreshold:r,errorPrefix:`isAdditionLineRenderable`});if(i==null||i.renderAll)return!0;let a=e.hunks[e.hunks.length-1],[,o]=C9(a);return t<o+i.fromStart||t>=o+i.rangeSize}function ttt({fileDiff:e,lineNumber:t,direction:n,expandedHunks:r,collapsedContextThreshold:i}){if(r===!0||e.isPartial)return t;let a=[],o=1;for(let[t,n]of e.hunks.entries()){let[s,c]=C9(n),l=w9({isPartial:e.isPartial,rangeSize:n.collapsedBefore,expandedHunks:r,hunkIndex:t,collapsedContextThreshold:i}),u=s-l.rangeSize;l.renderAll?a.push([u,s]):(l.fromStart>0&&a.push([u,u+l.fromStart]),l.fromEnd>0&&a.push([s-l.fromEnd,s])),a.push([s,c]),o=c}let s=E9({fileDiff:e,hunkIndex:e.hunks.length-1,expandedHunks:r,collapsedContextThreshold:i,errorPrefix:`getNearestRenderableAdditionLine`});if(s!=null){let e=o;o=e+s.rangeSize,s.renderAll?a.push([e,o]):s.fromStart>0&&a.push([e,e+s.fromStart])}if(t>=o)return t;if(n===`down`){for(let[e,n]of a)if(n>t)return Math.max(e,t);return}for(let e=a.length-1;e>=0;e--){let[n,r]=a[e];if(n<=t)return Math.min(r-1,t)}}function D9({type:e,metrics:t}){return t.hunkSeparatorHeight??Qet(e)}function O9({type:e,metrics:t}){return e===`simple`||e===`metadata`||e===`line-info-basic`?0:t.spacing}function ntt({type:e,hunkIndex:t,hunkSpecs:n}){switch(e){case`simple`:return t>0;case`metadata`:return n!=null;case`line-info`:case`line-info-basic`:case`custom`:return!0}}function rtt(e){return e!==`simple`&&e!==`metadata`}function itt({type:e,metrics:t,hunkIndex:n,hunkSpecs:r}){if(!ntt({type:e,hunkIndex:n,hunkSpecs:r}))return;let i=D9({type:e,metrics:t}),a=O9({type:e,metrics:t}),o=n>0?a:0,s=a;return{height:i,gapBefore:o,gapAfter:s,totalHeight:o+i+s}}function att({type:e,metrics:t}){if(!rtt(e))return;let n=D9({type:e,metrics:t}),r=O9({type:e,metrics:t});return{height:n,gapBefore:r,gapAfter:0,totalHeight:r+n}}function k9({diff:e,diffStyle:t,startingLine:n=0,totalLines:r=1/0,expandedHunks:i,collapsedContextThreshold:a=1,callback:o}){let s=ott({diff:e,diffStyle:t,startingLine:n,expandedHunks:i,collapsedContextThreshold:a}),c={viewportStart:n,viewportEnd:n+r,isWindowedHighlight:n>0||r<1/0,splitCount:s.splitCount,unifiedCount:s.unifiedCount,finalHunkIndex:e.hunks.length-1,shouldBreak(){if(!c.isWindowedHighlight)return!1;let e=c.unifiedCount>=n+r,i=c.splitCount>=n+r;return t===`unified`?e:(t===`split`||e)&&i},shouldSkip(e,r){if(!c.isWindowedHighlight)return!1;let i=e>0&&c.unifiedCount+e<=n,a=r>0&&c.splitCount+r<=n;return t===`unified`?i:(t===`split`||i)&&a},incrementCounts(e,n){(t===`unified`||t===`both`)&&(c.unifiedCount+=e),(t===`split`||t===`both`)&&(c.splitCount+=n)},isInWindow(e,n){if(!c.isWindowedHighlight)return!0;let r=c.isInUnifiedWindow(e),i=c.isInSplitWindow(n);return t===`unified`?r:t===`split`?i:r||i},isInUnifiedWindow(e){return!c.isWindowedHighlight||c.unifiedCount>=n-e&&c.unifiedCount<n+r},isInSplitWindow(e){return!c.isWindowedHighlight||c.splitCount>=n-e&&c.splitCount<n+r},emit(e,n=!1){return n||(t===`unified`?c.incrementCounts(1,0):t===`split`?c.incrementCounts(0,1):c.incrementCounts(1,1)),o(e)??!1}};hunkIterator:for(let n=s.hunkIndex;n<e.hunks.length;n++){let r=e.hunks[n];if(r==null)throw Error(`iterateOverDiff: invalid hunk index`);if(c.shouldBreak())break;let o=$2(r.deletionStart,r.deletionCount),s=$2(r.additionStart,r.additionCount),l=!e.isPartial&&r.deletionCount===0?o:r.deletionLineIndex,u=!e.isPartial&&r.additionCount===0?s:r.additionLineIndex,d=w9({isPartial:e.isPartial,rangeSize:r.collapsedBefore,expandedHunks:i,hunkIndex:n,collapsedContextThreshold:a}),f=n===c.finalHunkIndex?E9({fileDiff:e,hunkIndex:n,expandedHunks:i,collapsedContextThreshold:a,errorPrefix:`iterateOverDiff`}):void 0,p=d.fromStart+d.fromEnd;function m(e,n){return f==null||f.collapsedLines<=0||f.fromStart+f.fromEnd>0?0:t===`unified`?e===r.unifiedLineStart+r.unifiedLineCount-1?f.collapsedLines:0:n===r.splitLineStart+r.splitLineCount-1?f.collapsedLines:0}let h=d.collapsedLines===0;function g(){return h?0:(h=!0,d.collapsedLines)}if(c.shouldSkip(p,p))c.incrementCounts(p,p),g();else{let e=r.unifiedLineStart-d.rangeSize,i=r.splitLineStart-d.rangeSize,a=l-d.rangeSize,f=u-d.rangeSize,p=o+1-d.rangeSize,m=s+1-d.rangeSize;if(A9(c,d.fromStart,t,t=>c.emit({hunkIndex:n,hunk:r,collapsedBefore:0,collapsedAfter:0,type:`context-expanded`,deletionLine:{lineNumber:p+t,lineIndex:a+t,noEOFCR:!1,unifiedLineIndex:e+t,splitLineIndex:i+t},additionLine:{unifiedLineIndex:e+t,splitLineIndex:i+t,lineIndex:f+t,lineNumber:m+t,noEOFCR:!1}}))||(e=r.unifiedLineStart-d.fromEnd,i=r.splitLineStart-d.fromEnd,a=l-d.fromEnd,f=u-d.fromEnd,p=o+1-d.fromEnd,m=s+1-d.fromEnd,A9(c,d.fromEnd,t,t=>c.emit({hunkIndex:n,hunk:r,collapsedBefore:g(),collapsedAfter:0,type:`context-expanded`,deletionLine:{lineNumber:p+t,lineIndex:a+t,noEOFCR:!1,unifiedLineIndex:e+t,splitLineIndex:i+t},additionLine:{unifiedLineIndex:e+t,splitLineIndex:i+t,lineIndex:f+t,lineNumber:m+t,noEOFCR:!1}}),()=>{g()})))break hunkIterator}let _=r.unifiedLineStart,v=r.splitLineStart,y=l,b=u,x=o+1,S=s+1,C=r.hunkContent.at(-1);for(let e of r.hunkContent){if(c.shouldBreak())break hunkIterator;let i=e===C;if(e.type===`context`){if(c.shouldSkip(e.lines,e.lines))c.incrementCounts(e.lines,e.lines),g();else if(A9(c,e.lines,t,t=>{let a=i&&t===e.lines-1,o=_+t,s=v+t;return c.emit({hunkIndex:n,hunk:r,collapsedBefore:g(),collapsedAfter:m(o,s),type:`context`,deletionLine:{lineNumber:x+t,lineIndex:y+t,noEOFCR:a&&r.noEOFCRDeletions,unifiedLineIndex:o,splitLineIndex:s},additionLine:{unifiedLineIndex:o,splitLineIndex:s,lineIndex:b+t,lineNumber:S+t,noEOFCR:a&&r.noEOFCRAdditions}})},()=>{g()}))break hunkIterator;_+=e.lines,v+=e.lines,y+=e.lines,b+=e.lines,x+=e.lines,S+=e.lines}else{let a=Math.max(e.deletions,e.additions),o=e.deletions+e.additions;if(!c.shouldSkip(o,a)){let s=ltt(c,e,t);(s[0]?.[0]??0)>0&&g();for(let[l,u]of s)for(let s=l;s<u;s++){let l=m(_+s,t===`unified`?v+(s<e.deletions?s:s-e.deletions):v+s);if(c.emit(utt({hunkIndex:n,hunk:r,collapsedBefore:g(),collapsedAfter:l,diffStyle:t,index:s,unifiedLineIndex:_,splitLineIndex:v,additionLineIndex:b,deletionLineIndex:y,additionLineNumber:S,deletionLineNumber:x,content:e,isLastContent:i,unifiedCount:o,splitCount:a}),!0))break hunkIterator}}g(),c.incrementCounts(o,a),_+=o,v+=a,y+=e.deletions,b+=e.additions,x+=e.deletions,S+=e.additions}}if(f!=null){let{collapsedLines:n,fromStart:r,fromEnd:i}=f,a=r+i;if(A9(c,a,t,t=>{let r=t===a-1;return c.emit({hunkIndex:e.hunks.length,hunk:void 0,collapsedBefore:0,collapsedAfter:r?n:0,type:`context-expanded`,deletionLine:{lineNumber:x+t,lineIndex:y+t,noEOFCR:!1,unifiedLineIndex:_+t,splitLineIndex:v+t},additionLine:{unifiedLineIndex:_+t,splitLineIndex:v+t,lineIndex:b+t,lineNumber:S+t,noEOFCR:!1}})},void 0,()=>c.shouldBreak()))break hunkIterator}}}function ott({diff:e,diffStyle:t,startingLine:n,expandedHunks:r,collapsedContextThreshold:i}){if(n<=0||t===`both`)return{hunkIndex:0,splitCount:0,unifiedCount:0};let a=stt({diff:e,expandedHunks:r,collapsedContextThreshold:i}),o=0,s=e.hunks.length-1,c=e.hunks.length;for(;o<=s;){let e=o+s>>1,r=a[e+1];if(r==null)throw Error(`iterateOverDiff: invalid hunk prefix index`);(t===`unified`?r.unifiedCount:r.splitCount)>n?(c=e,s=e-1):o=e+1}if(c>=e.hunks.length){let t=a[e.hunks.length];if(t==null)throw Error(`iterateOverDiff: invalid terminal hunk prefix index`);return{hunkIndex:e.hunks.length,splitCount:t.splitCount,unifiedCount:t.unifiedCount}}let l=a[c];if(l==null)throw Error(`iterateOverDiff: invalid selected hunk prefix index`);return{hunkIndex:c,splitCount:l.splitCount,unifiedCount:l.unifiedCount}}function stt({diff:e,expandedHunks:t,collapsedContextThreshold:n}){let r=0,i=0,a=e.hunks.length-1,o=[{splitCount:0,unifiedCount:0}];for(let s=0;s<e.hunks.length;s++){let c=e.hunks[s];if(c==null)throw Error(`iterateOverDiff: invalid hunk summary index`);let l=w9({isPartial:e.isPartial,rangeSize:c.collapsedBefore,expandedHunks:t,hunkIndex:s,collapsedContextThreshold:n}),u=l.fromStart+l.fromEnd;r+=u+c.splitLineCount,i+=u+c.unifiedLineCount;let d=s===a?E9({fileDiff:e,hunkIndex:s,expandedHunks:t,collapsedContextThreshold:n,errorPrefix:`iterateOverDiff`}):void 0;if(d!=null){let e=d.fromStart+d.fromEnd;r+=e,i+=e}o.push({splitCount:r,unifiedCount:i})}return o}function ctt(e,t,n){if(!e.isWindowedHighlight||t<=0)return[0,t];let r=[];function i(n){let i=Math.max(0,e.viewportStart-n),a=Math.min(t,e.viewportEnd-n);a>i&&r.push([i,a])}if(n!==`split`&&i(e.unifiedCount),n!==`unified`&&i(e.splitCount),r.length===0)return[0,0];let a=r[0][0],o=r[0][1];for(let e=1;e<r.length;e++){let t=r[e];a=Math.min(a,t[0]),o=Math.max(o,t[1])}return[a,o]}function A9(e,t,n,r,i,a){let[o,s]=ctt(e,t,n);o>0&&(e.incrementCounts(o,o),i?.());let c=o;for(;c<t;){if(a?.()===!0)return!0;if(c>=s){e.incrementCounts(t-c,t-c);break}if(e.isInWindow(0,0)){if(r(c)===!0)return!0}else e.incrementCounts(1,1);c++}return!1}function ltt(e,t,n){if(!e.isWindowedHighlight)return[[0,n===`unified`?t.deletions+t.additions:Math.max(t.deletions,t.additions)]];let r=n!==`split`,i=n!==`unified`,a=n===`unified`?`unified`:`split`,o=[];function s(t,n){if(t+n<=e.viewportStart||t>=e.viewportEnd)return;let r=Math.max(0,e.viewportStart-t),i=Math.min(n,e.viewportEnd-t);return i>r?[r,i]:void 0}function c(e,n){return a===`split`?e:n===`additions`?[e[0]+t.deletions,e[1]+t.deletions]:e}function l(e,t){if(e==null)return;let[n,r]=c(e,t);r>n&&o.push([n,r])}if(r&&(l(s(e.unifiedCount,t.deletions),`deletions`),l(s(e.unifiedCount+t.deletions,t.additions),`additions`)),i&&(l(s(e.splitCount,t.deletions),`deletions`),l(s(e.splitCount,t.additions),`additions`)),o.length===0)return o;o.sort((e,t)=>e[0]-t[0]);let u=[o[0]];for(let[e,t]of o.slice(1)){let n=u[u.length-1];e<=n[1]?n[1]=Math.max(n[1],t):u.push([e,t])}return u}function utt({hunkIndex:e,hunk:t,collapsedAfter:n,collapsedBefore:r,diffStyle:i,index:a,unifiedLineIndex:o,splitLineIndex:s,additionLineIndex:c,deletionLineIndex:l,additionLineNumber:u,deletionLineNumber:d,content:f,isLastContent:p,unifiedCount:m,splitCount:h}){let g=a<f.deletions?o+a:void 0,_=i===`unified`?a>=f.deletions?o+a:void 0:a<f.additions?o+f.deletions+a:void 0,v=i===`unified`?s+(a<f.deletions?a:a-f.deletions):s+a,y=a<f.deletions?l+a:void 0,b=a<f.deletions?d+a:void 0,x=i===`unified`?a>=f.deletions?c+(a-f.deletions):void 0:a<f.additions?c+a:void 0,S=i===`unified`?a>=f.deletions?u+(a-f.deletions):void 0:a<f.additions?u+a:void 0,C=i===`unified`?p&&a===f.deletions-1&&t.noEOFCRDeletions:p&&a===h-1&&t.noEOFCRDeletions,w=i===`unified`?p&&a===m-1&&t.noEOFCRAdditions:p&&a===h-1&&t.noEOFCRAdditions,T=y!=null&&b!=null&&g!=null?{lineNumber:b,lineIndex:y,noEOFCR:C,unifiedLineIndex:g,splitLineIndex:v}:void 0,E=x!=null&&S!=null&&_!=null?{unifiedLineIndex:_,splitLineIndex:v,lineIndex:x,lineNumber:S,noEOFCR:w}:void 0;if(T==null&&E!=null)return{type:`change`,hunkIndex:e,hunk:t,collapsedAfter:n,collapsedBefore:r,deletionLine:void 0,additionLine:E};if(T!=null&&E==null)return{type:`change`,hunkIndex:e,hunk:t,collapsedAfter:n,collapsedBefore:r,deletionLine:T,additionLine:void 0};if(T==null||E==null)throw Error(`iterateOverDiff: missing change line data`);return{type:`change`,hunkIndex:e,hunk:t,collapsedAfter:n,collapsedBefore:r,deletionLine:T,additionLine:E}}var dtt={forcePlainText:!1};function j9(e,t,n,{forcePlainText:r,startingLine:i,totalLines:a,expandedHunks:o,collapsedContextThreshold:s=1}=dtt){r?(i??=0,a??=1/0):(i=0,a=1/0);let c=i>0||a<1/0,l=typeof n.theme==`string`?t.getTheme(n.theme).type:void 0,u=o9({theme:n.theme,highlighter:t}),d=r&&!c&&(e.unifiedLineCount>1e3||e.splitLineCount>1e3)?`none`:n.lineDiffType,f={deletionLines:[],additionLines:[]},{maxLineDiffLength:p}=n,m=!r&&!e.isPartial,h=r?o:void 0,g=new Map;function _(e){let t=m?0:e,n=g.get(t)??ptt();return g.set(t,n),n}function v(e,t,n,r){if(c){let e=n.at(-1);(e==null||e.targetIndex+e.count!==t)&&(e={targetIndex:t,originalOffset:r.length,count:0},n.push(e)),e.count++}r.push(e)}k9({diff:e,diffStyle:`both`,startingLine:i,totalLines:a,expandedHunks:!c||h,collapsedContextThreshold:s,callback:({hunkIndex:t,additionLine:n,deletionLine:r,type:i})=>{let a=_(t),o=n==null?r.splitLineIndex:n.splitLineIndex;i===`change`&&n!=null&&r!=null&&ftt({additionLine:e.additionLines[n.lineIndex],deletionLine:e.deletionLines[r.lineIndex],deletionLineIndex:a.deletionContent.length,additionLineIndex:a.additionContent.length,deletionDecorations:a.deletionDecorations,additionDecorations:a.additionDecorations,lineDiffType:d,maxLineDiffLength:p}),r!=null&&(v(e.deletionLines[r.lineIndex],r.lineIndex,a.deletionSegments,a.deletionContent),a.deletionInfo.push({type:i===`change`?`change-deletion`:i,lineNumber:r.lineNumber,altLineNumber:i===`change`?void 0:n.lineNumber??void 0,lineIndex:`${r.unifiedLineIndex},${o}`})),n!=null&&(v(e.additionLines[n.lineIndex],n.lineIndex,a.additionSegments,a.additionContent),a.additionInfo.push({type:i===`change`?`change-addition`:i,lineNumber:n.lineNumber,altLineNumber:i===`change`?void 0:r.lineNumber??void 0,lineIndex:`${n.unifiedLineIndex},${o}`}))}});for(let i of g.values()){if(i.deletionContent.length===0&&i.additionContent.length===0)continue;let a={name:e.prevName??e.name,contents:i.deletionContent.value},o={name:e.name,contents:i.additionContent.value},{deletionLines:s,additionLines:c}=mtt({deletionFile:a,deletionInfo:i.deletionInfo,deletionDecorations:i.deletionDecorations,additionFile:o,additionInfo:i.additionInfo,additionDecorations:i.additionDecorations,highlighter:t,options:n,languageOverride:r?`text`:e.lang});if(m){f.deletionLines=s,f.additionLines=c;continue}if(i.deletionSegments.length>0)for(let e of i.deletionSegments)for(let t=0;t<e.count;t++)f.deletionLines[e.targetIndex+t]=s[e.originalOffset+t];else f.deletionLines.push(...s);if(i.additionSegments.length>0)for(let e of i.additionSegments)for(let t=0;t<e.count;t++)f.additionLines[e.targetIndex+t]=c[e.originalOffset+t];else f.additionLines.push(...c)}return{code:f,themeStyles:u,baseThemeType:l}}function ftt({deletionLine:e,additionLine:t,deletionLineIndex:n,additionLineIndex:r,deletionDecorations:i,additionDecorations:a,lineDiffType:o,maxLineDiffLength:s}){if(e==null||t==null||o===`none`||(e=Q2(e),t=Q2(t),e.length>s||t.length>s))return;let c=o===`char`?j4e(e,t):F4e(e,t),l=[],u=[],d=o===`word-alt`,f=c.at(-1);for(let e of c){let t=e===f;!e.added&&!e.removed?(S9({item:e,arr:l,enableJoin:d,isNeutral:!0,isLastItem:t}),S9({item:e,arr:u,enableJoin:d,isNeutral:!0,isLastItem:t})):e.removed?S9({item:e,arr:l,enableJoin:d,isLastItem:t}):S9({item:e,arr:u,enableJoin:d,isLastItem:t})}let p=0;for(let e of l)e[0]===1&&i.push(x9({line:n,spanStart:p,spanLength:e[1].length})),p+=e[1].length;p=0;for(let e of u)e[0]===1&&a.push(x9({line:r,spanStart:p,spanLength:e[1].length})),p+=e[1].length}function ptt(){return{deletionContent:{push(e){this.value+=e,this.length++},value:``,length:0},additionContent:{push(e){this.value+=e,this.length++},value:``,length:0},deletionInfo:[],additionInfo:[],deletionDecorations:[],additionDecorations:[],deletionSegments:[],additionSegments:[]}}function mtt({deletionFile:e,additionFile:t,deletionInfo:n,additionInfo:r,highlighter:i,deletionDecorations:a,additionDecorations:o,languageOverride:s,options:{theme:c=B2,...l}}){let u=s??W7(e.name),d=s??W7(t.name),{state:f,transformers:p}=Z7(l.useTokenTransformer),m=typeof c==`string`?{...l,lang:`text`,theme:c,transformers:p,decorations:void 0,defaultColor:!1,cssVariablePrefix:$7(`token`),tokenizeTimeLimit:0}:{...l,lang:`text`,themes:c,transformers:p,decorations:void 0,defaultColor:!1,cssVariablePrefix:$7(`token`),tokenizeTimeLimit:0};return{deletionLines:e.contents===``?[]:(m.lang=u,f.lineInfo=n,m.decorations=a,c9(i.codeToHast(Q2(e.contents),m))),additionLines:t.contents===``?[]:(m.lang=d,m.decorations=o,f.lineInfo=r,c9(i.codeToHast(Q2(t.contents),m)))}}function M9(e){let t=e.lang??W7(e.name),n=e.lang??(e.prevName==null?`text`:W7(e.prevName));return t===`text`&&n===`text`}function N9(e){let t=[];for(let n of e){let e=I3.get(n);if(e==null)throw Error(`getResolvedLanguages: ${n} is not resolved. Please resolve languages before calling getResolvedLanguages`);t.push(e)}return t}function P9(e){for(let t of Array.isArray(e)?e:[e])if(!I3.has(t))return!1;return!0}async function F9(e){let t=[],n=[];for(let r of e){if(r===`text`||r===`ansi`)continue;let e=w7(r)??C7(r);`then`in e?n.push(e):t.push(e)}return n.length>0&&await Promise.all(n).then(e=>{for(let n of e){if(n==null)throw Error(`resolvedLanguages: unable to resolve language`);t.push(n)}}),t}function I9(e){return k7.getResolvedThemes(e)}async function L9(e){for(let t of e)F7(t);let t=await k7.resolveThemes(e);for(let n=0;n<e.length;n++)I7(e[n],t[n]);return t}var R9={light:`pierre-light`,dark:`pierre-dark`};function htt(e){return e===`dark`?R9.dark:R9.light}var z9=2166136261,B9=16777619,gtt=2654435769,_tt=2246822507;function V9(e,t=z9,n=B9){let r=t>>>0;for(let t=0;t<e.length;t+=1)r^=e.charCodeAt(t),r=Math.imul(r,n)>>>0;return r>>>0}function vtt(e,t=`diff-panel`){let n=e.trim(),r=V9(n,z9,B9).toString(36),i=V9(n,gtt,_tt).toString(36);return`${t}:${n.length}:${r}:${i}`}function H9(e){return ct(`flex items-center justify-between gap-2 px-4 wco:pr-[calc(100vw-env(titlebar-area-width)-env(titlebar-area-x)+1em)]`,Bn&&e!==`sheet`?`h-[52px] border-b border-border wco:h-[env(titlebar-area-height)]`:`h-12 wco:max-h-[env(titlebar-area-height)]`)}function ytt(e){let t=(0,bi.c)(10),n=Bn&&e.mode!==`sheet`,r=e.mode===`inline`?`w-[42vw] min-w-[360px] max-w-[560px] shrink-0 border-l border-border`:`w-full`,i;t[0]===r?i=t[1]:(i=ct(`flex h-full min-w-0 flex-col bg-background`,r),t[0]=r,t[1]=i);let a;t[2]!==e.header||t[3]!==e.mode||t[4]!==n?(a=n?(0,N.jsx)(`div`,{className:H9(e.mode),children:e.header}):(0,N.jsx)(`div`,{className:`border-b border-border`,children:(0,N.jsx)(`div`,{className:H9(e.mode),children:e.header})}),t[2]=e.header,t[3]=e.mode,t[4]=n,t[5]=a):a=t[5];let o;return t[6]!==e.children||t[7]!==i||t[8]!==a?(o=(0,N.jsxs)(`div`,{className:i,children:[a,e.children]}),t[6]=e.children,t[7]=i,t[8]=a,t[9]=o):o=t[9],o}function btt(){let e=(0,bi.c)(4),t,n;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,N.jsx)(E$,{className:`absolute left-0 top-1/2 size-6 -translate-y-1/2 rounded-md border border-border/50`}),n=(0,N.jsx)(E$,{className:`absolute right-0 top-1/2 size-6 -translate-y-1/2 rounded-md border border-border/50`}),e[0]=t,e[1]=n):(t=e[0],n=e[1]);let r;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,N.jsxs)(`div`,{className:`relative min-w-0 flex-1`,children:[t,n,(0,N.jsxs)(`div`,{className:`flex gap-1 overflow-hidden px-8 py-0.5`,children:[(0,N.jsx)(E$,{className:`h-6 w-16 shrink-0 rounded-md`}),(0,N.jsx)(E$,{className:`h-6 w-24 shrink-0 rounded-md`}),(0,N.jsx)(E$,{className:`h-6 w-24 shrink-0 rounded-md max-sm:hidden`})]})]}),e[2]=r):r=e[2];let i;return e[3]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,N.jsxs)(N.Fragment,{children:[r,(0,N.jsxs)(`div`,{className:`flex shrink-0 gap-1`,children:[(0,N.jsx)(E$,{className:`size-7 rounded-md`}),(0,N.jsx)(E$,{className:`size-7 rounded-md`})]})]}),e[3]=i):i=e[3],i}function xtt(e){let t=(0,bi.c)(7),n;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,N.jsxs)(`div`,{className:`flex items-center gap-2 border-b border-border/50 px-3 py-2`,children:[(0,N.jsx)(E$,{className:`h-4 w-32 rounded-full`}),(0,N.jsx)(E$,{className:`ml-auto h-4 w-20 rounded-full`})]}),t[0]=n):n=t[0];let r;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,N.jsxs)(`div`,{className:`space-y-2`,children:[(0,N.jsx)(E$,{className:`h-3 w-full rounded-full`}),(0,N.jsx)(E$,{className:`h-3 w-full rounded-full`}),(0,N.jsx)(E$,{className:`h-3 w-10/12 rounded-full`}),(0,N.jsx)(E$,{className:`h-3 w-11/12 rounded-full`}),(0,N.jsx)(E$,{className:`h-3 w-9/12 rounded-full`})]}),t[1]=r):r=t[1];let i;t[2]===e.label?i=t[3]:(i=(0,N.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-4 px-3 py-4`,children:[r,(0,N.jsx)(`span`,{className:`sr-only`,children:e.label})]}),t[2]=e.label,t[3]=i);let a;return t[4]!==e.label||t[5]!==i?(a=(0,N.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col p-2`,children:(0,N.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-hidden rounded-md border border-border/60 bg-card/25`,role:`status`,"aria-live":`polite`,"aria-label":e.label,children:[n,i]})}),t[4]=e.label,t[5]=i,t[6]=a):a=t[6],a}function Stt(e){let t=(0,M.useRef)(e);return(0,M.useInsertionEffect)(()=>void(t.current=e)),(0,M.useCallback)((...e)=>t.current(...e),[])}var Ctt=(0,M.createContext)(void 0);function wtt(){return(0,M.useContext)(Ctt)}var Ttt={position:`absolute`,top:0,bottom:0,textAlign:`center`,whiteSpace:`normal`,touchAction:`none`},Ett={display:`contents`};function Dtt(){return null}var U9=t(n(((e,t)=>{(function(n,r){typeof e==`object`&&t!==void 0?r(e):typeof define==`function`&&define.amd?define([`exports`],r):r((n||=self).lru_map=n.lru_map||{})})(e,function(e){let t=Symbol(`newer`),n=Symbol(`older`);class r{constructor(e,t){typeof e!=`number`&&(t=e,e=0),this.size=0,this.limit=e,this.oldest=this.newest=void 0,this._keymap=new Map,t&&(this.assign(t),e<1&&(this.limit=this.size))}_markEntryAsUsed(e){e!==this.newest&&(e[t]&&(e===this.oldest&&(this.oldest=e[t]),e[t][n]=e[n]),e[n]&&(e[n][t]=e[t]),e[t]=void 0,e[n]=this.newest,this.newest&&(this.newest[t]=e),this.newest=e)}assign(e){let r,a=this.limit||Number.MAX_VALUE;this._keymap.clear();let o=e[Symbol.iterator]();for(let e=o.next();!e.done;e=o.next()){let o=new i(e.value[0],e.value[1]);if(this._keymap.set(o.key,o),r?(r[t]=o,o[n]=r):this.oldest=o,r=o,a--==0)throw Error(`overflow`)}this.newest=r,this.size=this._keymap.size}get(e){var t=this._keymap.get(e);return t?(this._markEntryAsUsed(t),t.value):void 0}set(e,r){var a=this._keymap.get(e);return a?(a.value=r,this._markEntryAsUsed(a),this):(this._keymap.set(e,a=new i(e,r)),this.newest?(this.newest[t]=a,a[n]=this.newest):this.oldest=a,this.newest=a,++this.size,this.size>this.limit&&this.shift(),this)}shift(){var e=this.oldest;if(e)return this.oldest[t]?(this.oldest=this.oldest[t],this.oldest[n]=void 0):(this.oldest=void 0,this.newest=void 0),e[t]=e[n]=void 0,this._keymap.delete(e.key),--this.size,[e.key,e.value]}find(e){let t=this._keymap.get(e);return t?t.value:void 0}has(e){return this._keymap.has(e)}delete(e){var r=this._keymap.get(e);return r?(this._keymap.delete(r.key),r[t]&&r[n]?(r[n][t]=r[t],r[t][n]=r[n]):r[t]?(r[t][n]=void 0,this.oldest=r[t]):r[n]?(r[n][t]=void 0,this.newest=r[n]):this.oldest=this.newest=void 0,this.size--,r.value):void 0}clear(){this.oldest=this.newest=void 0,this.size=0,this._keymap.clear()}keys(){return new o(this.oldest)}values(){return new s(this.oldest)}entries(){return this}[Symbol.iterator](){return new a(this.oldest)}forEach(e,n){typeof n!=`object`&&(n=this);let r=this.oldest;for(;r;)e.call(n,r.value,r.key,this),r=r[t]}toJSON(){for(var e=Array(this.size),n=0,r=this.oldest;r;)e[n++]={key:r.key,value:r.value},r=r[t];return e}toString(){for(var e=``,n=this.oldest;n;)e+=String(n.key)+`:`+n.value,n=n[t],n&&(e+=` < `);return e}}e.LRUMap=r;function i(e,r){this.key=e,this.value=r,this[t]=void 0,this[n]=void 0}function a(e){this.entry=e}a.prototype[Symbol.iterator]=function(){return this},a.prototype.next=function(){let e=this.entry;return e?(this.entry=e[t],{done:!1,value:[e.key,e.value]}):{done:!0,value:void 0}};function o(e){this.entry=e}o.prototype[Symbol.iterator]=function(){return this},o.prototype.next=function(){let e=this.entry;return e?(this.entry=e[t],{done:!1,value:e.key}):{done:!0,value:void 0}};function s(e){this.entry=e}s.prototype[Symbol.iterator]=function(){return this},s.prototype.next=function(){let e=this.entry;return e?(this.entry=e[t],{done:!1,value:e.value}):{done:!0,value:void 0}}})}))(),1),W9=Symbol(`IGNORE_RESPONSE`),G9=class extends Error{constructor(){super(`WorkerPoolManager: operation canceled because the pool terminated`)}},K9=class extends Error{constructor(){super(`WorkerPoolManager: operation canceled before the task completed`)}},Ott=class{options;highlighter;preferredHighlighter;renderOptions;renderOptionsRequestVersion=0;renderOptionsVersion=0;initialized=!1;workers=[];queuedTasks=[];queuedTaskByInstance=new Map;taskByHighlightKey=new Map;activeTaskById=new Map;activeRequestByInstance=new Map;nextRequestId=0;themeSubscribers=new Set;workersFailed=!1;statSubscribers=new Set;fileCache;diffCache;_queuedBroadcast;lifecycleGeneration=0;constructor(e,{langs:t,theme:n=B2,useTokenTransformer:r=!1,lineDiffType:i=`word-alt`,maxLineDiffLength:a=1e3,tokenizeMaxLineLength:o=1e3,preferredHighlighter:s=`shiki-js`}){this.options=e,this.preferredHighlighter=s,this.renderOptions={theme:n,useTokenTransformer:r,lineDiffType:i,maxLineDiffLength:a,tokenizeMaxLineLength:o},this.fileCache=new U9.default.LRUMap(e.totalASTLRUCacheSize??100),this.diffCache=new U9.default.LRUMap(e.totalASTLRUCacheSize??100),this.queueInitialization(t)}isWorkingPool(){return!this.workersFailed}getFileResultCache(e){return e.cacheKey==null?void 0:this.fileCache.get(e.cacheKey)}getDiffResultCache(e){return e.cacheKey==null?void 0:this.diffCache.get(e.cacheKey)}inspectCaches(){let{fileCache:e,diffCache:t}=this;return{fileCache:e,diffCache:t}}evictFileFromCache(e){try{return this.fileCache.delete(e)!==void 0}finally{this.queueBroadcastStateChanges()}}evictDiffFromCache(e){try{return this.diffCache.delete(e)!==void 0}finally{this.queueBroadcastStateChanges()}}async setRenderOptions({theme:e=this.renderOptions.theme??B2,useTokenTransformer:t=this.renderOptions.useTokenTransformer??!1,lineDiffType:n=this.renderOptions.lineDiffType??`word-alt`,maxLineDiffLength:r=this.renderOptions.maxLineDiffLength??1e3,tokenizeMaxLineLength:i=this.renderOptions.tokenizeMaxLineLength??1e3}){let{lifecycleGeneration:a}=this,o=++this.renderOptionsRequestVersion,s=()=>this.isCurrentLifecycle(a)&&this.renderOptionsRequestVersion===o;try{let a={theme:e,useTokenTransformer:t,lineDiffType:n,maxLineDiffLength:r,tokenizeMaxLineLength:i};if(this.isInitialized()||await this.initialize(),!s()||b9(a,this.renderOptions))return;let o=z7(e),c=[];if(Y2(a.theme,this.renderOptions.theme)||(c=B7(o)?I9(o):await L9(o)),!s())return;if(this.highlighter!=null)A7(c,this.highlighter);else{let e=await R7({themes:o,langs:[`text`],preferredHighlighter:this.preferredHighlighter});if(!s())return;this.highlighter=e}let l=this.setRenderOptionsOnWorkers(a,c);this.renderOptions=a,this.renderOptionsVersion++,this.diffCache.clear(),this.fileCache.clear(),this.invalidateRenderTasks();for(let e of this.themeSubscribers)e.onThemeChange();await l}catch(e){if(e instanceof G9||!s())return;throw e}}getPreferredHighlighter(){return this.preferredHighlighter}getFileRenderOptions(){let{tokenizeMaxLineLength:e,theme:t,useTokenTransformer:n}=this.renderOptions;return{theme:t,useTokenTransformer:n,tokenizeMaxLineLength:e}}getDiffRenderOptions(){return{...this.renderOptions}}async setRenderOptionsOnWorkers(e,t){if(this.workersFailed)return;this.isInitialized()||await this.initialize();let n=[];for(let r of this.workers){if(!r.initialized)throw console.log({managedWorker:r}),Error(`setRenderOptionsOnWorkers: Somehow we have an uninitialized worker`);n.push(new Promise((n,i)=>{let a=this.generateRequestId(),o={type:`set-render-options`,id:a,request:{type:`set-render-options`,id:a,renderOptions:e,resolvedThemes:t},resolve:n,reject:i,requestStart:Date.now()};this.activeTaskById.set(a,o),r.pendingSetupRequestId=a,r.worker.postMessage(o.request)}))}await Promise.all(n)}subscribeToThemeChanges(e){return this.themeSubscribers.add(e),this.queueBroadcastStateChanges(),()=>{this.unsubscribeToThemeChanges(e),this.queueBroadcastStateChanges()}}unsubscribeToThemeChanges(e){this.themeSubscribers.delete(e),this.queueBroadcastStateChanges()}subscribeToStatChanges(e){return this.statSubscribers.add(e),e(this.getStats()),()=>{this.statSubscribers.delete(e)}}queueBroadcastStateChanges(){this._queuedBroadcast??=requestAnimationFrame(this._broadcastStateChanges)}_broadcastStateChanges=()=>{this._queuedBroadcast!=null&&(cancelAnimationFrame(this._queuedBroadcast),this._queuedBroadcast=void 0);let e=this.getStats();for(let t of this.statSubscribers)t(e)};cleanUpTasks(e){this.detachInstanceFromQueuedTasks(e);let t=this.activeRequestByInstance.get(e);if(t!=null){let n=this.activeTaskById.get(t);J9(n)?(this.detachInstanceFromRenderTask(n,e),!n.primeCache&&n.instances.size===0&&this.removeActiveTask(n)):this.activeTaskById.delete(t)}this.activeRequestByInstance.delete(e),this.queueBroadcastStateChanges()}isInitialized(){return this.initialized===!0}async initialize(e=[]){if(this.initialized!==!0)if(this.initialized===!1){let{lifecycleGeneration:t}=this;this.initialized=new Promise((n,r)=>{(async()=>{try{let r=z7(this.renderOptions.theme),i=[];if(i=B7(r)?I9(r):await L9(r),!this.isCurrentLifecycle(t)){n();return}let a=[];if(a=P9(e)?N9(e):await F9(e),!this.isCurrentLifecycle(t)){n();return}let[o]=await Promise.all([R7({themes:r,langs:[`text`,...e],preferredHighlighter:this.preferredHighlighter}),this.initializeWorkers(i,a)]);if(!this.isCurrentLifecycle(t)){this.terminateWorkers(),n();return}this.highlighter=o,this.initialized=!0,this.diffCache.clear(),this.fileCache.clear(),this.drainQueue(),this.queueBroadcastStateChanges(),n()}catch(e){if(e instanceof G9||!this.isCurrentLifecycle(t)){n();return}this.initialized=!1,this.workersFailed=!0;for(let t of this.queuedTasks)this.rejectRenderTaskCallbacks(t,X9(e));this.queueBroadcastStateChanges(),r(e)}})()}),this.queueBroadcastStateChanges()}else return this.initialized}async initializeWorkers(e,t){this.workersFailed=!1;let n=[],r=G7(),i=r>0?K7():void 0;this.workers.length>0&&this.terminateWorkers();for(let a=0;a<(this.options.poolSize??8);a++){let a=this.options.workerFactory(),o={worker:a,requestId:void 0,pendingSetupRequestId:void 0,initialized:!1,langs:new Set([`text`,...t.map(({name:e})=>e)]),customExtensionsVersion:0};a.addEventListener(`message`,e=>{this.handleWorkerMessage(o,e.data)}),a.addEventListener(`error`,e=>console.error(`Worker error:`,e,o)),this.workers.push(o),n.push(new Promise((n,a)=>{let s=this.generateRequestId(),c={type:`initialize`,id:s,request:{type:`initialize`,id:s,renderOptions:this.renderOptions,preferredHighlighter:this.preferredHighlighter,resolvedThemes:e,resolvedLanguages:t,customExtensionsVersion:i==null?void 0:r,customExtensionMap:i},resolve(){o.initialized=!0,n()},reject:a,requestStart:Date.now()};this.activeTaskById.set(s,c),this.executeTask(o,c)}))}await Promise.all(n)}drainQueue=()=>{if(this._queuedDrain=void 0,this.initialized===!0&&this.queuedTasks.length!==0){for(let e=0;e<this.queuedTasks.length;){let t=this.queuedTasks[e];if(this.hasActiveRequest(t)){e++;continue}let n=q9(t),r=this.getAvailableWorker(n);if(r==null)break;this.queuedTasks.splice(e,1),this.assignWorkerToTask(t,r),this.resolveLanguagesAndExecuteTask(r,t,n)}this.queueBroadcastStateChanges()}};highlightFileAST(e,t){let n=this.getFileResultCache(t);p9(t)||n!=null&&V7(n.options,this.getFileRenderOptions())||this.hasMatchingFileInstanceTask(e,t)||this.submitTask(e,{type:`file`,file:t})}primeFileHighlightCache(e){if(!this.isWorkingPool())return Promise.reject(Error(`WorkerPoolManager.primeFileHighlightCache: worker pool is not working`));let t=this.getOrCreateFileHighlightCacheTask(e);return t==null?Promise.resolve():this.createRenderTaskCallbacks(t)}getOrCreateFileHighlightCacheTask(e){if(e.cacheKey==null){console.warn(`WorkerPoolManager.primeFileHighlightCache: priming highlight cache requires file.cacheKey; skipping "${e.name}".`);return}let t=this.getFileResultCache(e),n=this.getFileHighlightKey(e);if(n==null||p9(e)||t!=null&&V7(t.options,this.getFileRenderOptions()))return;let r=this.getTaskByHighlightKey(n);if(r!=null)return r.primeCache=!0,r.type===`file`?r:void 0;{let t=this.submitCacheTask({type:`file`,file:e},n);return t.type===`file`?t:void 0}}getPlainFileAST(e,t,n,r){if(this.highlighter==null){this.queueInitialization();return}return f9(e,this.highlighter,this.renderOptions,{forcePlainText:!0,startingLine:t,totalLines:n,lines:r})}highlightDiffAST(e,t){let n=this.getDiffResultCache(t);M9(t)||n!=null&&b9(n.options,this.getDiffRenderOptions())||this.hasMatchingDiffInstanceTask(e,t)||this.submitTask(e,{type:`diff`,diff:t})}primeDiffHighlightCache(e){if(!this.isWorkingPool())return Promise.reject(Error(`WorkerPoolManager.primeDiffHighlightCache: worker pool is not working`));let t=this.getOrCreateDiffHighlightCacheTask(e);return t==null?Promise.resolve():this.createRenderTaskCallbacks(t)}getOrCreateDiffHighlightCacheTask(e){if(e.cacheKey==null){console.warn(`WorkerPoolManager.primeDiffHighlightCache: priming highlight cache requires diff.cacheKey; skipping "${e.prevName??e.name}" -> "${e.name}".`);return}let t=this.getDiffResultCache(e),n=this.getDiffHighlightKey(e);if(n==null||M9(e)||t!=null&&b9(t.options,this.getDiffRenderOptions()))return;let r=this.getTaskByHighlightKey(n);if(r!=null)return r.primeCache=!0,r.type===`diff`?r:void 0;{let t=this.submitCacheTask({type:`diff`,diff:e},n);return t.type===`diff`?t:void 0}}getPlainDiffAST(e,t,n,r,i){return this.highlighter==null?void 0:j9(e,this.highlighter,this.renderOptions,{forcePlainText:!0,startingLine:t,totalLines:n,expandedHunks:r,collapsedContextThreshold:i})}terminate(){this.lifecycleGeneration++,this.cancelActiveWorkerTasks(),this.terminateWorkers();let e=new G9;for(let t of this.queuedTasks)this.rejectRenderTaskCallbacks(t,e);this.fileCache.clear(),this.diffCache.clear(),this.activeRequestByInstance.clear(),this.queuedTasks.length=0,this.queuedTaskByInstance.clear(),this.taskByHighlightKey.clear(),this.activeTaskById.clear(),this.highlighter=void 0,this.initialized=!1,this.workersFailed=!1,this.queueBroadcastStateChanges()}isCurrentLifecycle(e){return this.lifecycleGeneration===e}queueInitialization(e){this.initialize(e).catch(e=>{console.error(e)})}cancelActiveWorkerTasks(){let e=new G9;for(let t of this.activeTaskById.values())`reject`in t?t.reject(e):J9(t)&&this.rejectRenderTaskCallbacks(t,e)}terminateWorkers(){for(let e of this.workers)e.worker.terminate();this.workers.length=0}getStats(){return{managerState:this.initialized===!1?`waiting`:this.initialized===!0?`initialized`:`initializing`,totalWorkers:this.workers.length,workersFailed:this.workersFailed,busyWorkers:this.workers.filter(e=>e.requestId!=null||e.pendingSetupRequestId!=null).length,queuedTasks:this.queuedTasks.length,activeTasks:this.activeTaskById.size,themeSubscribers:this.themeSubscribers.size,fileCacheSize:this.fileCache.size,diffCacheSize:this.diffCache.size}}submitTask(e,t){this.initialized===!1&&this.queueInitialization();let n=this.getHighlightKeyForRequest(t),r=n==null?void 0:this.getTaskByHighlightKey(n);if(r!=null){this.detachInstanceFromQueuedTasks(e,r),this.addInstanceToTask(r,e),this.queueBroadcastStateChanges();return}this.detachInstanceFromQueuedTasks(e);let i=this.generateRequestId(),a=Date.now(),{renderOptionsVersion:o}=this,s=(()=>{switch(t.type){case`file`:return{type:`file`,id:i,request:{...t,id:i},instances:new Set([e]),primeCache:!1,highlightKey:n,callbacks:new Set,renderOptionsVersion:o,requestStart:a};case`diff`:return{type:`diff`,id:i,request:{...t,id:i},instances:new Set([e]),primeCache:!1,highlightKey:n,callbacks:new Set,renderOptionsVersion:o,requestStart:a}}})();this.enqueueRenderTask(s,e)}submitCacheTask(e,t){this.initialized===!1&&this.queueInitialization();let n=this.generateRequestId(),r=Date.now(),{renderOptionsVersion:i}=this,a=(()=>{switch(e.type){case`file`:return{type:`file`,id:n,request:{...e,id:n},instances:new Set,primeCache:!0,highlightKey:t,callbacks:new Set,renderOptionsVersion:i,requestStart:r};case`diff`:return{type:`diff`,id:n,request:{...e,id:n},instances:new Set,primeCache:!0,highlightKey:t,callbacks:new Set,renderOptionsVersion:i,requestStart:r}}})();return this.enqueueRenderTask(a),a}enqueueRenderTask(e,t){this.queuedTasks.push(e),t!=null&&this.queuedTaskByInstance.set(t,e),e.highlightKey!=null&&this.taskByHighlightKey.set(e.highlightKey,e),this.queueDrain()}async resolveLanguagesAndExecuteTask(e,t,n){try{let r=n.filter(t=>!e.langs.has(t));if(r.length>0&&(P9(r)?t.request.resolvedLanguages=N9(r):t.request.resolvedLanguages=await F9(r)),!this.activeTaskById.has(t.id)){e.requestId===t.id&&(this.cleanWorkerAndTask(e,t),this.queueBroadcastStateChanges(),this.queuedTasks.length>0&&this.queueDrain());return}this.executeTask(e,t)}catch(n){this.rejectRenderTaskCallbacks(t,X9(n)),this.cleanWorkerAndTask(e,t),this.queueBroadcastStateChanges(),this.queuedTasks.length>0&&this.queueDrain()}}handleWorkerMessage(e,t){let n=this.activeTaskById.get(t.id);try{if(n==null)throw W9;if(t.type===`error`){let e=Error(t.error);if(t.stack&&(e.stack=t.stack),`reject`in n)n.reject(e);else if(J9(n))this.notifyHighlightError(n,e),this.rejectRenderTaskCallbacks(n,e);else throw Error(`handleWorkerMessage: unknown task type`);throw e}switch(t.requestType){case`initialize`:if(n.type!==`initialize`)throw Error(`handleWorkerMessage: task/response dont match`);this.syncCustomExtensionVersion(e,n.request),n.resolve();break;case`set-render-options`:if(n.type!==`set-render-options`)throw Error(`handleWorkerMessage: task/response dont match`);n.resolve();break;case`file`:{if(n.type!==`file`)throw Error(`handleWorkerMessage: task/response dont match`);let{result:r,options:i}=t;if(!this.isCurrentRenderTask(n)||!V7(i,this.getFileRenderOptions()))throw W9;let{request:a}=n;this.syncCustomExtensionVersion(e,a),n.cacheKeyAtDispatch!=null&&this.fileCache.set(n.cacheKeyAtDispatch,{result:r,options:i}),this.resolveRenderTaskCallbacks(n),this.notifyFileInstances(n,r,i);break}case`diff`:{if(n.type!==`diff`)throw Error(`handleWorkerMessage: task/response dont match`);let{result:r,options:i}=t;if(!this.isCurrentRenderTask(n)||!b9(i,this.getDiffRenderOptions()))throw W9;let{request:a}=n;this.syncCustomExtensionVersion(e,a),n.cacheKeyAtDispatch!=null&&this.diffCache.set(n.cacheKeyAtDispatch,{result:r,options:i}),this.resolveRenderTaskCallbacks(n),this.notifyDiffInstances(n,r,i);break}}}catch(e){e!==W9&&console.error(e,n,t)}this.cleanWorkerAndTask(e,n,t.id),this.queueBroadcastStateChanges(),this.queuedTasks.length>0&&this.queueDrain()}_queuedDrain;queueDrain(){this._queuedDrain??(this._queuedDrain=Promise.resolve().then(this.drainQueue),this.queueBroadcastStateChanges())}assignWorkerToTask(e,t){t.requestId=e.id,J9(e)&&(this.clearQueuedInstanceRequests(e),this.trackInstanceRequests(e)),this.activeTaskById.set(e.id,e)}cleanWorkerAndTask(e,t,n=t?.id){e.requestId===n&&(e.requestId=void 0),e.pendingSetupRequestId===n&&(e.pendingSetupRequestId=void 0),t!=null&&(J9(t)&&(this.rejectRenderTaskCallbacks(t,new K9),this.clearInstanceRequests(t),this.clearHighlightKey(t)),this.activeTaskById.delete(t.id))}executeTask(e,t){ktt(t.request)&&this.maybeAttachCustomExtensions(e,t.request),this.activeTaskById.has(t.id)||this.assignWorkerToTask(t,e);for(let n of q9(t))e.langs.add(n);try{t.type===`file`?t.cacheKeyAtDispatch=t.request.file.cacheKey:t.type===`diff`&&(t.cacheKeyAtDispatch=t.request.diff.cacheKey),e.worker.postMessage(t.request)}catch(n){console.error(`Failed to post message to worker:`,n),J9(t)?(this.notifyHighlightError(t,n),this.rejectRenderTaskCallbacks(t,X9(n))):`reject`in t&&t.reject(n),this.cleanWorkerAndTask(e,t),this.queuedTasks.length>0&&this.queueDrain()}this.queueBroadcastStateChanges()}maybeAttachCustomExtensions(e,t){if(t.customExtensionsVersion!=null)return;let n=G7();e.customExtensionsVersion>=n||(t.customExtensionsVersion=n,t.customExtensionMap=K7())}syncCustomExtensionVersion(e,t){t.customExtensionsVersion!=null&&(e.customExtensionsVersion=t.customExtensionsVersion)}getAvailableWorker(e){let t;for(let n of this.workers){if(n.requestId!=null||n.pendingSetupRequestId!=null||!n.initialized)continue;if(t=n,e.length===0)break;let r=!0;for(let t of e)if(!n.langs.has(t)){r=!1;break}if(r)break}return t}getFileHighlightKey(e){if(e.cacheKey!=null)return`file:${e.cacheKey}:${this.renderOptionsVersion}`}getDiffHighlightKey(e){if(e.cacheKey!=null)return`diff:${e.cacheKey}:${this.renderOptionsVersion}`}getHighlightKeyForRequest(e){switch(e.type){case`file`:return this.getFileHighlightKey(e.file);case`diff`:return this.getDiffHighlightKey(e.diff)}}hasActiveRequest(e){for(let t of Y9(e))if(this.activeRequestByInstance.has(t))return!0;return!1}addInstanceToTask(e,t){e.type,e.instances.add(t),this.activeTaskById.has(e.id)?this.activeRequestByInstance.set(t,e.id):this.queuedTaskByInstance.set(t,e)}detachInstanceFromQueuedTasks(e,t){let n=this.queuedTaskByInstance.get(e);n!=null&&n!==t&&(this.queuedTaskByInstance.delete(e),this.detachInstanceFromRenderTask(n,e),!n.primeCache&&n.instances.size===0&&this.removeQueuedTask(n))}detachInstanceFromRenderTask(e,t){e.type,e.instances.delete(t)}removeQueuedTask(e){let t=this.queuedTasks.indexOf(e);t!==-1&&this.queuedTasks.splice(t,1),this.rejectRenderTaskCallbacks(e,new K9),this.clearQueuedInstanceRequests(e),this.clearHighlightKey(e)}removeActiveTask(e){this.rejectRenderTaskCallbacks(e,new K9),this.clearInstanceRequests(e),this.clearHighlightKey(e),this.activeTaskById.delete(e.id)}createRenderTaskCallbacks(e){return new Promise((t,n)=>{e.callbacks.add({resolve:t,reject:n})})}resolveRenderTaskCallbacks(e){for(let t of e.callbacks)t.resolve();e.callbacks.clear()}rejectRenderTaskCallbacks(e,t){for(let n of e.callbacks)n.reject(t);e.callbacks.clear()}invalidateRenderTasks(){for(let e=this.queuedTasks.length-1;e>=0;e--){let t=this.queuedTasks[e];t.renderOptionsVersion!==this.renderOptionsVersion&&this.removeQueuedTask(t)}for(let e of Array.from(this.activeTaskById.values()))J9(e)&&e.renderOptionsVersion!==this.renderOptionsVersion&&this.removeActiveTask(e)}clearQueuedInstanceRequests(e){for(let t of Y9(e))this.queuedTaskByInstance.get(t)===e&&this.queuedTaskByInstance.delete(t)}clearHighlightKey(e){e.highlightKey!=null&&this.taskByHighlightKey.get(e.highlightKey)===e&&this.taskByHighlightKey.delete(e.highlightKey)}trackInstanceRequests(e){for(let t of Y9(e))this.activeRequestByInstance.set(t,e.id)}clearInstanceRequests(e){for(let t of Y9(e))this.activeRequestByInstance.get(t)===e.id&&this.activeRequestByInstance.delete(t)}notifyFileInstances(e,t,n){for(let r of e.instances)this.activeRequestByInstance.get(r)===e.id&&r.onHighlightSuccess(e.request.file,t,n)}notifyDiffInstances(e,t,n){for(let r of e.instances)this.activeRequestByInstance.get(r)===e.id&&r.onHighlightSuccess(e.request.diff,t,n)}notifyHighlightError(e,t){for(let n of Y9(e))this.activeRequestByInstance.get(n)===e.id&&n.onHighlightError(t)}hasMatchingFileInstanceTask(e,t){for(let n of this.iterateRenderTasks())if(n.type===`file`&&this.isCurrentRenderTask(n)&&n.instances.has(e)&&S4(t,n.request.file))return!0;return!1}hasMatchingDiffInstanceTask(e,t){for(let n of this.iterateRenderTasks())if(n.type===`diff`&&this.isCurrentRenderTask(n)&&n.instances.has(e)&&y9(n.request.diff,t))return!0;return!1}getTaskByHighlightKey(e){let t=this.taskByHighlightKey.get(e);return t!=null&&this.isCurrentRenderTask(t)?t:void 0}isCurrentRenderTask(e){return e.renderOptionsVersion===this.renderOptionsVersion}*iterateRenderTasks(){for(let e of this.queuedTasks)yield e;for(let e of this.activeTaskById.values())J9(e)&&(yield e)}generateRequestId(){return`req_${++this.nextRequestId}`}};function ktt(e){return e.type===`initialize`||e.type===`file`||e.type===`diff`}function q9(e){let t=new Set;if(e.type===`initialize`||e.type===`set-render-options`)return[];switch(e.type){case`file`:t.add(e.request.file.lang??W7(e.request.file.name));break;case`diff`:t.add(e.request.diff.lang??W7(e.request.diff.name)),t.add(e.request.diff.lang??W7(e.request.diff.prevName??`-`))}return t.delete(`text`),Array.from(t)}function J9(e){return e?.type===`file`||e?.type===`diff`}function Y9(e){return e.instances}function X9(e){return e instanceof Error?e:Error(String(e))}var Z9;function Att({poolOptions:e,highlighterOptions:t}){return Z9??=new Ott(e,t),Z9}function jtt(){Z9!=null&&(Z9.terminate(),Z9=void 0)}var Q9=(0,M.createContext)(void 0),$9=0;function Mtt({children:e,poolOptions:t,highlighterOptions:n}){let[r]=(0,M.useState)(()=>{if(!(typeof window>`u`))return Att({poolOptions:t,highlighterOptions:n})});return(0,M.useInsertionEffect)(()=>{if(r!=null)return $9++,()=>{$9--}},[r]),(0,M.useEffect)(()=>()=>{$9===0&&jtt()},[]),(0,N.jsx)(Q9.Provider,{value:r,children:e})}function Ntt(){return(0,M.useContext)(Q9)}export{xet as $,$Y as $a,Mi as $c,hZe as $i,Bn as $l,N0e as $n,Qq as $o,I$e as $r,DVe as $s,b4e as $t,Yet as A,bJe as Aa,_W as Ac,sQe as Ai,Cr as Al,O2 as An,_Ke as Ao,_1e as Ar,IUe as As,$4 as At,Iet as B,dX as Ba,SU as Bc,nQe as Bi,Qn as Bl,Q0e as Bn,hJ as Bo,N1e as Br,kHe as Bs,S4 as Bt,E9 as C,CYe as Ca,MW as Cc,HQe as Ci,Nr as Cl,n4e as Cn,uY as Co,r0 as Cr,QK as Cs,S3e as Ct,b9 as D,jX as Da,lBe as Dc,o$ as Di,jr as Dl,N2 as Dn,aKe as Do,F1e as Dr,WK as Ds,c3 as Dt,ett as E,ZJe as Ea,PBe as Ec,x$ as Ei,Mr as El,i4e as En,mKe as Eo,b1e as Er,rWe as Es,l3 as Et,Het as F,aJe as Fa,_ze as Fc,iQe as Fi,gr as Fl,f2 as Fn,HGe as Fo,S1e as Fr,eUe as Fs,U4e as Ft,Aet as G,iX as Ga,Ui as Gc,qQ as Gi,er as Gl,G0e as Gn,bGe as Go,e1e as Gr,zVe as Gs,k4e as Gt,Pet as H,zqe as Ha,Eie as Hc,YZe as Hi,Hne as Hl,Y0 as Hn,gJ as Ho,J1 as Hr,$G as Hs,e4 as Ht,Vet as I,bX as Ia,FU as Ic,e$ as Ii,pr as Il,u2 as In,WGe as Io,Y1 as Ir,nUe as Is,H4e as It,Eet as J,ZY as Ja,Fi as Jc,HZe as Ji,nr as Jl,z0e as Jn,mGe as Jo,U$e as Jr,LG as Js,Y2 as Jt,ket as K,rX as Ka,Bi as Kc,BZe as Ki,tr as Kl,R0e as Kn,pJ as Ko,H$e as Kr,HG as Ks,Z2 as Kt,Bet as L,yX as La,NU as Lc,rQe as Li,fr as Ll,l2e as Ln,UGe as Lo,h1e as Lr,EK as Ls,w4 as Lt,qet as M,oZ as Ma,vze as Mc,cQe as Mi,$ne as Ml,L2e as Mn,yKe as Mo,P1e as Mr,FK as Ms,A4 as Mt,Wet as N,VJe as Na,yze as Nc,ZQ as Ni,ere as Nl,M2e as Nn,vKe as No,E1e as Nr,$He as Ns,D4 as Nt,y9 as O,WJe as Oa,xW as Oc,r$ as Oi,ire as Ol,a4e as On,rY as Oo,x1e as Or,$Ue as Os,t3 as Ot,Uet as P,dJe as Pa,bze as Pc,$Q as Pi,_r as Pl,v2 as Pn,VGe as Po,Q1 as Pr,cUe as Ps,W4e as Pt,yet as Q,eX as Qa,Ni as Qc,vZe as Qi,Vn as Ql,U0 as Qn,nJ as Qo,F$e as Qr,NG as Qs,m4e as Qt,zet as R,uX as Ra,$Re as Rc,QQ as Ri,Bne as Rl,o2e as Rn,qJ as Ro,C1e as Rr,DK as Rs,T4 as Rt,T9 as S,DZ as Sa,GW as Sc,BQe as Si,Lr as Sl,r4e as Sn,hY as So,t0 as Sr,eq as Ss,d3 as St,$et as T,YJe as Ta,UW as Tc,KQe as Ti,Pr as Tl,s4e as Tn,dKe as To,m1e as Tr,nWe as Ts,x3e as Tt,g9 as U,oX as Ua,Tie as Uc,JZe as Ui,Vne as Ul,q0e as Un,sJ as Uo,l1e as Ur,XG as Us,$2 as Ut,Fet as V,Uqe as Va,CU as Vc,XQ as Vi,Gne as Vl,$0e as Vn,mJ as Vo,X1 as Vr,bHe as Vs,z4e as Vt,jet as W,Bqe as Wa,Oie as Wc,YQ as Wi,qn as Wl,K0e as Wn,fJ as Wo,I1 as Wr,YG as Ws,Q2 as Wt,Tet as X,Rqe as Xa,Ii as Xc,RQ as Xi,sr as Xl,V0e as Xn,vGe as Xo,E1 as Xr,OG as Xs,K2 as Xt,p9 as Y,XY as Ya,Li as Yc,BQ as Yi,lr as Yl,B0e as Yn,rJ as Yo,K$e as Yr,jG as Ys,J2 as Yt,wet as Z,tX as Za,zi as Zc,zQ as Zi,Hn as Zl,B0 as Zn,aJ as Zo,C1 as Zr,DG as Zs,G2 as Zt,k9 as _,uQ as _a,zW as _c,WQe as _i,cre as _l,L2 as _n,PKe as _o,k0e as _r,KK as _s,x6e as _t,Cne as _u,Ett as a,OQ as aa,pVe as ac,e$e as ai,ki as al,T4e as an,HY as ao,v0 as ar,Xq as as,$9e as at,Pn as au,itt as b,OYe as ba,dBe as bc,C$ as bi,Ir as bl,h4e as bn,bY as bo,i0e as br,ZK as bs,a6e as bt,Stt as c,TQ as ca,aVe as cc,E$ as ci,Ei as cl,B2 as cn,Aqe as co,y0e as cr,nGe as cs,q9e as ct,jne as cu,ytt as d,GXe as da,oG as dc,XQe as di,mi as dl,c4e as dn,wqe as do,A0e as dr,eGe as ds,V7 as dt,An as du,NQ as ea,AG as ec,k$e as ei,ji as el,y4e as en,GY as eo,P0e as er,eJ as es,bet as et,zne as eu,vtt as f,bQ as fa,YBe as fc,ZQe as fi,oi as fl,F2 as fn,pqe as fo,w0e as fr,$We as fs,B7 as ft,Pne as fu,j9 as g,sQ as ga,tG as gc,RQe as gi,ai as gl,u4e as gn,MKe as go,D0 as gr,YK as gs,R7 as gt,Mne as gu,M9 as h,EXe as ha,JBe as hc,UQe as hi,di as hl,p4e as hn,AKe as ho,C0e as hr,$K as hs,V9e as ht,wn as hu,Ttt as i,AQ as ia,sVe as ic,O$e as ii,Oi as il,C4e as in,RY as io,x0 as ir,Wq as is,eet as it,Fn as iu,Zet as j,HJe as ja,Hze as jc,t$ as ji,tre as jl,q2e as jn,iKe as jo,y1e as jr,LK as js,Z4 as jt,Jet as k,xJe as ka,vW as kc,n$ as ki,kr as kl,J2e as kn,nY as ko,g1e as kr,UK as ks,Q4 as kt,btt as l,wQ as la,tVe as lc,YQe as li,Di as ll,x4e as ln,xqe as lo,T0e as lr,Yq as ls,G9e as lt,Fne as lu,htt as m,kXe as ma,ZBe as mc,VQe as mi,ui as ml,f4e as mn,jY as mo,D0e as mr,dWe as ms,z7 as mt,Ene as mu,Mtt as n,rZe as na,_G as nc,t1 as ni,Qre as nl,z2 as nn,WY as no,G0 as nr,Uq as ns,f9 as nt,Rn as nu,Dtt as o,CQ as oa,cVe as oc,O$ as oi,Ai as ol,E4e as on,UY as oo,h0e as or,tGe as os,W7 as ot,Nn as ou,V9 as p,yQ as pa,XBe as pc,qQe as pi,si as pl,D4e as pn,AY as po,E0e as pr,Zq as ps,U9e as pt,wne as pu,Det as q,nX as qa,Vi as qc,GQ as qi,Xn as ql,U0e as qn,oJ as qo,v1 as qr,BG as qs,O4e as qt,Ntt as r,nZe as ra,aG as rc,r1 as ri,Xre as rl,S4e as rn,KY as ro,b0 as rr,iGe as rs,d9 as rt,In as ru,wtt as s,DQ as sa,rVe as sc,QQe as si,Yre as sl,w4e as sn,PY as so,v0e as sr,Jq as ss,X9e as st,Mn as su,Q9 as t,sZe as ta,wG as tc,A$e as ti,Zre as tl,l4e as tn,Pqe as to,W0 as tr,rGe as ts,Cet as tt,zn as tu,xtt as u,qXe as ua,uVe as uc,JQe as ui,Ci as ul,H2 as un,vqe as uo,S0e as ur,aGe as us,W9e as ut,Nne as uu,w9 as v,_Xe as va,NBe as vc,GQe as vi,Br as vl,R2 as vn,FKe as vo,O0e as vr,JK as vs,m6e as vt,One as vu,att as w,wZ as wa,kBe as wc,LQe as wi,Fr as wl,o4e as wn,lY as wo,a0 as wr,uWe as ws,u3 as wt,ttt as x,kYe as xa,qW as xc,S$ as xi,Rr as xl,d4e as xn,_Y as xo,n0 as xr,qK as xs,C3 as xt,C9 as y,QYe as ya,IBe as yc,IQe as yi,zr as yl,I2 as yn,xY as yo,e0e as yr,XK as ys,i6e as yt,Tn as yu,Ret as z,lX as za,TU as zc,oQe as zi,$n as zl,d2 as zn,YJ as zo,w1e as zr,EHe as zs,C4 as zt};
2538
- //# sourceMappingURL=WorkerPoolContext-C6VEghMH.js.map
2538
+ //# sourceMappingURL=WorkerPoolContext-6gkCtwqY.js.map