@deslop/workbench 0.0.383 → 0.0.390

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.
Files changed (58) hide show
  1. package/dist/{anthropic-C02QVQ9u.mjs → anthropic-DcE0yHBZ.mjs} +5 -5
  2. package/dist/{azure-openai-responses-CUFLNwdy.mjs → azure-openai-responses-ecGypQVA.mjs} +4 -4
  3. package/dist/client/assets/-workbench-terminal-BXoM87zf.js +145 -0
  4. package/dist/client/assets/agent-15Ys-EV7.js +1 -0
  5. package/dist/client/assets/agent-CwZrrVgw.js +2 -0
  6. package/dist/client/assets/{dialog-B0kBnYwI.js → dialog-D3SsOi-l.js} +17 -17
  7. package/dist/client/assets/{diff-o4xLJTw0.js → diff-CSExRPif.js} +51 -49
  8. package/dist/client/assets/diff-Dwyi9RiJ.js +2 -0
  9. package/dist/client/assets/{external-link-D7Q28KpR.js → external-link-Dg1sMSmg.js} +1 -1
  10. package/dist/client/assets/fallbacks-D1MIlTO6.js +16 -0
  11. package/dist/client/assets/index-B2S_w1d1.css +2 -0
  12. package/dist/client/assets/{index-ClCMMzj9.js → index-YdollqUD.js} +3 -3
  13. package/dist/client/assets/input-DZnkCVx3.js +1 -0
  14. package/dist/client/assets/portless-DGijexQV.js +2 -0
  15. package/dist/client/assets/portless-DSDYE-Pc.js +1 -0
  16. package/dist/client/assets/resizable-BWgF68j6.js +1 -0
  17. package/dist/client/assets/route-BuzkrubX.js +45 -0
  18. package/dist/client/assets/route-D3fj0Kxy.js +2 -0
  19. package/dist/client/assets/{run-wjcPjpA5.js → run-ByOu_fKi.js} +1 -1
  20. package/dist/client/assets/run-D-KGLETl.js +2 -0
  21. package/dist/client/assets/{sonner-DgKrvTU1.js → sonner-vAlNGB2c.js} +1 -1
  22. package/dist/client/assets/state-DipxiPcD.js +2 -0
  23. package/dist/client/assets/terminal-dP11iiPC.js +1 -0
  24. package/dist/client/assets/terminal-zDmQe2b5.js +2 -0
  25. package/dist/client/assets/{triangle-alert-cDPYgb7f.js → triangle-alert-CHTnDlTF.js} +1 -1
  26. package/dist/client/index.html +11 -11
  27. package/dist/{github-copilot-headers-B--aVYl2.mjs → github-copilot-headers-P0xZolzq.mjs} +2 -2
  28. package/dist/{google-DHtiCcEt.mjs → google-Jzn1v4-q.mjs} +4 -4
  29. package/dist/{google-shared-BT0mQb3v.mjs → google-shared-DNNqX1gf.mjs} +3 -3
  30. package/dist/{google-vertex-CRkz0MgQ.mjs → google-vertex-z0Cbw7eq.mjs} +4 -4
  31. package/dist/{hash-CDrrQIkY.mjs → hash-CScAQ-b_.mjs} +1 -1
  32. package/dist/{headers-m19bM8_9.mjs → headers-oksLmLNC.mjs} +1 -1
  33. package/dist/{mistral-DXtHhhUc.mjs → mistral-CxEIkz4y.mjs} +4 -4
  34. package/dist/{openai-codex-responses-BSLixEC8.mjs → openai-codex-responses-7ZUsVcbT.mjs} +6 -6
  35. package/dist/{openai-completions-CE-LDmL4.mjs → openai-completions-CaGFVr3X.mjs} +48 -10
  36. package/dist/{openai-responses-41QiypX_.mjs → openai-responses-Vjw8-3qm.mjs} +5 -5
  37. package/dist/{openai-responses-shared-BAoGGIxP.mjs → openai-responses-shared-DtEshy-7.mjs} +4 -4
  38. package/dist/{openrouter-CDq1vETJ.mjs → openrouter-CZ-H_QwG.mjs} +3 -3
  39. package/dist/{sanitize-unicode-CPcy0g31.mjs → sanitize-unicode-BbVojtka.mjs} +1 -1
  40. package/dist/server.js +2498 -1877
  41. package/dist/{transform-messages-CUKh2_5w.mjs → transform-messages-CLmkH5Gu.mjs} +2 -2
  42. package/package.json +1 -1
  43. package/dist/client/assets/-workbench-terminal-nnzNYgEY.js +0 -145
  44. package/dist/client/assets/agent-CnBPS10_.js +0 -1
  45. package/dist/client/assets/agent-XCbfwj2z.js +0 -2
  46. package/dist/client/assets/diff-ClnF3EUN.js +0 -2
  47. package/dist/client/assets/fallbacks-DwGmG_0c.js +0 -16
  48. package/dist/client/assets/index-DT_QSnKQ.css +0 -2
  49. package/dist/client/assets/input-CEh4Uy0l.js +0 -1
  50. package/dist/client/assets/portless-BEzC3sH4.js +0 -2
  51. package/dist/client/assets/portless-DLmFLaZz.js +0 -1
  52. package/dist/client/assets/resizable-A9BpOcmt.js +0 -1
  53. package/dist/client/assets/route-Da0uHKH9.js +0 -45
  54. package/dist/client/assets/route-ULg8h9n0.js +0 -2
  55. package/dist/client/assets/run-DY23jobN.js +0 -2
  56. package/dist/client/assets/state-_2CmL5IM.js +0 -2
  57. package/dist/client/assets/terminal-BC9WKciF.js +0 -1
  58. package/dist/client/assets/terminal-Bn9lFOEg.js +0 -2
@@ -1,2 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/route-Da0uHKH9.js","assets/rolldown-runtime-QTnfLwEv.js","assets/compiler-runtime-CLAvuQ-D.js","assets/fallbacks-DwGmG_0c.js","assets/dialog-B0kBnYwI.js","assets/resizable-A9BpOcmt.js","assets/preload-helper-CjdClQve.js","assets/sonner-DgKrvTU1.js","assets/triangle-alert-cDPYgb7f.js","assets/state-_2CmL5IM.js"])))=>i.map(i=>d[i]);
2
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{n as t,r as n}from"./compiler-runtime-CLAvuQ-D.js";import{$s as r,As as i,Bs as a,Ds as o,Fs as s,Gs as c,Hs as l,Is as u,Js as d,Ks as f,Ls as p,Ms as m,Ns as h,Ot as g,Ps as _,Qs as v,Rs as y,Ss as b,Us as x,Vs as S,Ws as C,Xs as w,Ys as T,Zs as E,ac as D,cc as O,ec as k,ic as A,lc as ee,nc as j,nt as te,oc as ne,qs as re,rc as ie,sc as M,uc as N,vs as ae,ws as oe,ys as se,zs as ce}from"./fallbacks-DwGmG_0c.js";import{t as le}from"./preload-helper-CjdClQve.js";function ue(e){let t=e;return{get(){return t},set(e){t=j(e,t)}}}function de(e){return{get(){return e()}}}function fe(e,t){let{createMutableStore:n,createReadonlyStore:r,batch:i,init:a}=t,o=new Map,s=new Map,c=new Map,l=n(e.status),u=n(e.loadedAt),d=n(e.isLoading),f=n(e.isTransitioning),p=n(e.location),m=n(e.resolvedLocation),h=n(e.statusCode),g=n(e.redirect),_=n([]),v=n([]),y=n([]),b=r(()=>P(o,_.get())),x=r(()=>P(s,v.get())),S=r(()=>P(c,y.get())),C=r(()=>_.get()[0]),w=r(()=>_.get().some(e=>o.get(e)?.get().status===`pending`)),T=r(()=>({locationHref:p.get().href,resolvedLocationHref:m.get()?.href,status:l.get()})),E=r(()=>({status:l.get(),loadedAt:u.get(),isLoading:d.get(),isTransitioning:f.get(),matches:b.get(),location:p.get(),resolvedLocation:m.get(),statusCode:h.get(),redirect:g.get()})),D=re(64);function O(e){let t=D.get(e);return t||(t=r(()=>{let t=_.get();for(let n of t){let t=o.get(n);if(t&&t.routeId===e)return t.get()}}),D.set(e,t)),t}let k={status:l,loadedAt:u,isLoading:d,isTransitioning:f,location:p,resolvedLocation:m,statusCode:h,redirect:g,matchesId:_,pendingIds:v,cachedIds:y,matches:b,pendingMatches:x,cachedMatches:S,firstId:C,hasPending:w,matchRouteDeps:T,matchStores:o,pendingMatchStores:s,cachedMatchStores:c,__store:E,getRouteMatchStore:O,setMatches:A,setPending:ee,setCached:j};A(e.matches),a?.(k);function A(e){F(e,o,_,n,i)}function ee(e){F(e,s,v,n,i)}function j(e){F(e,c,y,n,i)}return k}function P(e,t){let n=[];for(let r of t){let t=e.get(r);t&&n.push(t.get())}return n}function F(e,t,n,r,i){let a=e.map(e=>e.id),o=new Set(a);i(()=>{for(let e of t.keys())o.has(e)||t.delete(e);for(let n of e){let e=t.get(n.id);if(!e){let e=r(n);e.routeId=n.routeId,t.set(n.id,e);continue}e.routeId=n.routeId,e.get()!==n&&e.set(n)}w(n.get(),a)||n.set(a)})}function pe(){try{return sessionStorage}catch{return}}var me=`tsr-scroll-restoration-v1_3`,he=pe();function ge(){try{return JSON.parse(he?.getItem(`tsr-scroll-restoration-v1_3`)||`{}`)}catch{return{}}}function _e(){try{he?.setItem(me,JSON.stringify(I))}catch{}}var I=ge(),ve=`data-scroll-restoration-id`,ye=e=>e.state.__TSR_key||e.href;function be(e){let t=e.getAttribute(ve);if(t)return`[${ve}="${t}"]`;let n=``,r=e,i;for(;i=r.parentNode;){let e=1,t=r;for(;t=t.previousElementSibling;)e++;let a=`${r.localName}:nth-child(${e})`;n=n?`${a} > ${n}`:a,r=i}return n}var L=!1,R=`window`;function z(e){try{return typeof e==`function`?e():document.querySelector(e)}catch{}}function xe(e){let t=[];for(let n of e){if(n===R)continue;let e=z(n);e&&t.push(e)}return t}function Se(e,t){let n=t??e.options.scrollRestoration,r=e._scroll;n&&(r.restoring=!0);let i=e.options.getScrollRestorationKey||ye,a=new Map,o=(e,t,n)=>{let r=a.get(e)||{};r.scrollX=t,r.scrollY=n,a.set(e,r)},s=e=>{if(!(L||!r.restoring))if(e.target===document)o(R,scrollX,scrollY);else{let t=e.target;o(t,t.scrollLeft,t.scrollTop)}},c=e=>{if(!r.restoring)return;let t=I[e]||={};for(let[e,n]of a)e===R?t[R]=n:e.isConnected&&(t[be(e)]=n)};n&&!r.restoration&&(r.restoration=!0,L=!1,history.scrollRestoration=`manual`,document.addEventListener(`scroll`,s,!0),e.subscribe(`onBeforeLoad`,e=>{e.fromLocation&&c(i(e.fromLocation)),a.clear()}),addEventListener(`pagehide`,()=>{c(i(e.stores.resolvedLocation.get()??e.stores.location.get())),_e()})),!r.reset&&(r.reset=!0,e.subscribe(`onRendered`,t=>{let n=e.options.scrollRestorationBehavior,o=e.options.scrollToTopSelectors,s=r.next,c;if(a.clear(),s||(r.next=!0),typeof e.options.scrollRestoration==`function`&&!e.options.scrollRestoration({location:e.latestLocation}))return;let l=i(t.toLocation),u=t.fromLocation&&i(t.fromLocation);if(r.restoring&&u&&u!==l){let e=I[u];if(e){let t=I[l];for(let n in e){if(n===R){if(s)continue}else{let e=z(n);if(!e||s&&o&&(c??=xe(o),c.includes(e)))continue}t||=I[l]={},t[n]??=e[n]}}}L=!0;try{let e=t.toLocation.hash,i=t.toLocation.state.__hashScrollIntoViewOptions??!0,a=!1;if(s){let s=rt.get(t.toLocation),u=e&&i&&(s===`PUSH`||s===`REPLACE`),d=r.restoring?I[l]:void 0;if(d)for(let e in d){let{scrollX:t,scrollY:r}=d[e];if(e===R){if(u)continue;scrollTo({top:r,left:t,behavior:n}),a=!0}else{let n=z(e);n&&(n.scrollLeft=t,n.scrollTop=r)}}if(!a&&!e){let e={top:0,left:0,behavior:n};if(scrollTo(e),o){c??=xe(o);for(let t of c)t.scrollTo(e)}}}!a&&e&&i&&document.getElementById(e)?.scrollIntoView(i)}finally{L=!1}}))}function Ce(e,t=String){let n=new URLSearchParams;for(let r in e){let i=e[r];i!==void 0&&n.set(r,t(i))}return n.toString()}function we(e){return e?e===`false`?!1:e===`true`?!0:e*0==0&&+e+``===e?+e:e:``}function Te(e){let t=new URLSearchParams(e),n=Object.create(null);for(let[e,r]of t.entries()){let t=n[e];t==null?n[e]=we(r):Array.isArray(t)?t.push(we(r)):n[e]=[t,we(r)]}return n}var Ee=Oe(JSON.parse),De=ke(JSON.stringify,JSON.parse);function Oe(e){return t=>{t[0]===`?`&&(t=t.substring(1));let n=Te(t);for(let t in n){let r=n[t];if(typeof r==`string`)try{n[t]=e(r)}catch{}}return n}}function ke(e,t){let n=typeof t==`function`;function r(r){if(typeof r==`object`&&r)try{return e(r)}catch{}else if(n&&typeof r==`string`)try{return t(r),e(r)}catch{}return r}return e=>{let t=Ce(e,r);return t?`?${t}`:``}}var Ae=e=>{if(!e.rendered)return e.rendered=!0,e.onReady?.()},je=e=>e.stores.matchesId.get().some(t=>e.stores.matchStores.get(t)?.get()._forcePending),B=(e,t)=>!!(e.preload&&!e.router.stores.matchStores.has(t)),V=(e,t,n=!0)=>{let r={...e.router.options.context??{}},i=n?t:t-1;for(let t=0;t<=i;t++){let n=e.matches[t];if(!n)continue;let i=e.router.getMatch(n.id);i&&Object.assign(r,i.__routeContext,i.__beforeLoadContext)}return r},Me=(e,t)=>{if(!e.matches.length)return;let n=t.routeId,r=e.matches.findIndex(t=>t.routeId===e.router.routeTree.id),i=r>=0?r:0,a=n?e.matches.findIndex(e=>e.routeId===n):e.firstBadMatchIndex??e.matches.length-1;a<0&&(a=i);for(let t=a;t>=0;t--){let n=e.matches[t];if(e.router.looseRoutesById[n.routeId].options.notFoundComponent)return t}return n?a:i},H=(e,t,n)=>{if(!(!i(n)&&!h(n)))throw i(n)&&n.redirectHandled&&!n.options.reloadDocument?n:(t&&(t._nonReactive.beforeLoadPromise?.resolve(),t._nonReactive.loaderPromise?.resolve(),t._nonReactive.beforeLoadPromise=void 0,t._nonReactive.loaderPromise=void 0,t._nonReactive.error=n,e.updateMatch(t.id,r=>({...r,status:i(n)?`redirected`:h(n)?`notFound`:r.status===`pending`?`success`:r.status,context:V(e,t.index),isFetching:!1,error:n})),h(n)&&!n.routeId&&(n.routeId=t.routeId),t._nonReactive.loadPromise?.resolve()),i(n)&&(e.rendered=!0,n.options._fromLocation=e.location,n.redirectHandled=!0,n=e.router.resolveRedirect(n)),n)},Ne=(e,t)=>{let n=e.router.getMatch(t);return!!(!n||n._nonReactive.dehydrated)},Pe=(e,t,n)=>{let r=V(e,n);e.updateMatch(t,e=>({...e,context:r}))},U=(e,t,n)=>{let{id:r,routeId:a}=e.matches[t],o=e.router.looseRoutesById[a];if(n instanceof Promise)throw n;e.firstBadMatchIndex??=t,H(e,e.router.getMatch(r),n);try{o.options.onError?.(n)}catch(t){n=t,H(e,e.router.getMatch(r),n)}e.updateMatch(r,e=>(e._nonReactive.beforeLoadPromise?.resolve(),e._nonReactive.beforeLoadPromise=void 0,e._nonReactive.loadPromise?.resolve(),{...e,error:n,status:`error`,isFetching:!1,updatedAt:Date.now(),abortController:new AbortController})),!e.preload&&!i(n)&&!h(n)&&(e.serialError??=n)},Fe=(e,t,n,r)=>{if(r._nonReactive.pendingTimeout!==void 0)return;let i=n.options.pendingMs??e.router.options.defaultPendingMs;if(e.onReady&&!B(e,t)&&(n.options.loader||n.options.beforeLoad||Ge(n))&&typeof i==`number`&&i!==1/0&&(n.options.pendingComponent??e.router.options?.defaultPendingComponent)){let t=setTimeout(()=>{Ae(e)},i);r._nonReactive.pendingTimeout=t}},Ie=(e,t,n)=>{let r=e.router.getMatch(t);if(!r._nonReactive.beforeLoadPromise&&!r._nonReactive.loaderPromise)return;Fe(e,t,n,r);let i=()=>{let n=e.router.getMatch(t);n.preload&&(n.status===`redirected`||n.status===`notFound`)&&H(e,n,n.error)};return r._nonReactive.beforeLoadPromise?r._nonReactive.beforeLoadPromise.then(i):i()},Le=(e,t,n,r)=>{let a=e.router.getMatch(t),o=a._nonReactive.loadPromise;a._nonReactive.loadPromise=E(()=>{o?.resolve(),o=void 0});let{paramsError:s,searchError:c}=a;s&&U(e,n,s),c&&U(e,n,c),Fe(e,t,r,a);let l=new AbortController,u=!1,d=()=>{u||(u=!0,e.updateMatch(t,e=>({...e,isFetching:`beforeLoad`,fetchCount:e.fetchCount+1,abortController:l})))},f=()=>{a._nonReactive.beforeLoadPromise?.resolve(),a._nonReactive.beforeLoadPromise=void 0,e.updateMatch(t,e=>({...e,isFetching:!1}))};if(!r.options.beforeLoad){e.router.batch(()=>{d(),f()});return}a._nonReactive.beforeLoadPromise=E();let p={...V(e,n,!1),...a.__routeContext},{search:m,params:g,cause:_}=a,v=B(e,t),y={search:m,abortController:l,params:g,preload:v,context:p,location:e.location,navigate:t=>e.router.navigate({...t,_fromLocation:e.location}),buildLocation:e.router.buildLocation,cause:v?`preload`:_,matches:e.matches,routeId:r.id,...e.router.options.additionalContext},b=r=>{if(r===void 0){e.router.batch(()=>{d(),f()});return}(i(r)||h(r))&&(d(),U(e,n,r)),e.router.batch(()=>{d(),e.updateMatch(t,e=>({...e,__beforeLoadContext:r})),f()})},x;try{if(x=r.options.beforeLoad(y),D(x))return d(),x.catch(t=>{U(e,n,t)}).then(b)}catch(t){d(),U(e,n,t)}b(x)},Re=(e,t)=>{let{id:n,routeId:r}=e.matches[t],i=e.router.looseRoutesById[r],a=()=>s(),o=()=>Le(e,n,t,i),s=()=>{if(Ne(e,n))return;let t=Ie(e,n,i);return D(t)?t.then(o):o()};return a()},ze=(e,t,n)=>{let r=e.router.getMatch(t);if(!r||!n.options.head&&!n.options.scripts&&!n.options.headers)return;let i={ssr:e.router.options.ssr,matches:e.matches,match:r,params:r.params,loaderData:r.loaderData};return Promise.all([n.options.head?.(i),n.options.scripts?.(i),n.options.headers?.(i)]).then(([e,t,n])=>({meta:e?.meta,links:e?.links,headScripts:e?.scripts,headers:n,scripts:t,styles:e?.styles}))},Be=(e,t,n,r,i)=>{let a=t[r-1],{params:o,loaderDeps:s,abortController:c,cause:l}=e.router.getMatch(n),u=V(e,r),d=B(e,n);return{params:o,deps:s,preload:!!d,parentMatchPromise:a,abortController:c,context:u,location:e.location,navigate:t=>e.router.navigate({...t,_fromLocation:e.location}),cause:d?`preload`:l,route:i,...e.router.options.additionalContext}},Ve=async(e,t,n,r,a)=>{try{let o=e.router.getMatch(n);try{W(a);let i=a.options.loader,s=typeof i==`function`?i:i?.handler,c=s?.(Be(e,t,n,r,a)),l=!!s&&D(c);if((l||a._lazyPromise||a._componentsPromise||a.options.head||a.options.scripts||a.options.headers||o._nonReactive.minPendingPromise)&&e.updateMatch(n,e=>({...e,isFetching:`loader`})),s){let t=l?await c:c;H(e,e.router.getMatch(n),t),t!==void 0&&e.updateMatch(n,e=>({...e,loaderData:t}))}a._lazyPromise&&await a._lazyPromise;let u=o._nonReactive.minPendingPromise;u&&await u,a._componentsPromise&&await a._componentsPromise,e.updateMatch(n,t=>({...t,error:void 0,context:V(e,r),status:`success`,isFetching:!1,updatedAt:Date.now()}))}catch(t){let s=t;if(s?.name===`AbortError`){if(o.abortController.signal.aborted){o._nonReactive.loaderPromise?.resolve(),o._nonReactive.loaderPromise=void 0;return}e.updateMatch(n,t=>({...t,status:t.status===`pending`?`success`:t.status,isFetching:!1,context:V(e,r)}));return}let c=o._nonReactive.minPendingPromise;c&&await c,h(t)&&await a.options.notFoundComponent?.preload?.(),H(e,e.router.getMatch(n),t);try{a.options.onError?.(t)}catch(t){s=t,H(e,e.router.getMatch(n),t)}!i(s)&&!h(s)&&await W(a,[`errorComponent`]),e.updateMatch(n,t=>({...t,error:s,context:V(e,r),status:`error`,isFetching:!1}))}}catch(t){let r=e.router.getMatch(n);r&&(r._nonReactive.loaderPromise=void 0),H(e,r,t)}},He=async(e,t,n)=>{async function r(r,o,l,u,f){let p=Date.now()-o.updatedAt,m=r?f.options.preloadStaleTime??e.router.options.defaultPreloadStaleTime??3e4:f.options.staleTime??e.router.options.defaultStaleTime??0,h=f.options.shouldReload,g=typeof h==`function`?h(Be(e,t,a,n,f)):h,{status:_,invalid:v}=u,y=p>=m&&(!!e.forceStaleReload||u.cause===`enter`||l!==void 0&&l!==u.id);s=_===`success`&&(v||(g??y)),r&&f.options.preload===!1||(s&&!e.sync&&d?(c=!0,(async()=>{try{await Ve(e,t,a,n,f);let r=e.router.getMatch(a);r._nonReactive.loaderPromise?.resolve(),r._nonReactive.loadPromise?.resolve(),r._nonReactive.loaderPromise=void 0,r._nonReactive.loadPromise=void 0}catch(t){i(t)&&await e.router.navigate(t.options)}})()):_!==`success`||s?await Ve(e,t,a,n,f):Pe(e,a,n))}let{id:a,routeId:o}=e.matches[n],s=!1,c=!1,l=e.router.looseRoutesById[o],u=l.options.loader,d=((typeof u==`function`?void 0:u?.staleReloadMode)??e.router.options.defaultStaleReloadMode)!==`blocking`;if(Ne(e,a)){if(!e.router.getMatch(a))return e.matches[n];Pe(e,a,n)}else{let t=e.router.getMatch(a),i=e.router.stores.matchesId.get()[n],s=(i&&e.router.stores.matchStores.get(i)||null)?.routeId===o?i:e.router.stores.matches.get().find(e=>e.routeId===o)?.id,c=B(e,a);if(t._nonReactive.loaderPromise){if(t.status===`success`&&!e.sync&&!t.preload&&d)return t;await t._nonReactive.loaderPromise;let n=e.router.getMatch(a),i=n._nonReactive.error||n.error;i&&H(e,n,i),n.status===`pending`&&await r(c,t,s,n,l)}else{let n=c&&!e.router.stores.matchStores.has(a),i=e.router.getMatch(a);i._nonReactive.loaderPromise=E(),n!==i.preload&&e.updateMatch(a,e=>({...e,preload:n})),await r(c,t,s,i,l)}}let f=e.router.getMatch(a);c||(f._nonReactive.loaderPromise?.resolve(),f._nonReactive.loadPromise?.resolve(),f._nonReactive.loadPromise=void 0),clearTimeout(f._nonReactive.pendingTimeout),f._nonReactive.pendingTimeout=void 0,c||(f._nonReactive.loaderPromise=void 0),f._nonReactive.dehydrated=void 0;let p=c?f.isFetching:!1;return p!==f.isFetching||f.invalid!==!1?(e.updateMatch(a,e=>({...e,isFetching:p,invalid:!1})),e.router.getMatch(a)):f};async function Ue(e){let t=e,n=[];je(t.router)&&Ae(t);let r;for(let e=0;e<t.matches.length;e++){try{let n=Re(t,e);D(n)&&await n}catch(e){if(i(e))throw e;if(h(e))r=e;else if(!t.preload)throw e;break}if(t.serialError||t.firstBadMatchIndex!=null)break}let a=t.firstBadMatchIndex??t.matches.length,o=r&&!t.preload?Me(t,r):void 0,s=r&&t.preload?0:o===void 0?a:Math.min(o+1,a),c,l;for(let e=0;e<s;e++)n.push(He(t,n,e));try{await Promise.all(n)}catch{let e=await Promise.allSettled(n);for(let t of e){if(t.status!==`rejected`)continue;let e=t.reason;if(i(e))throw e;h(e)?c??=e:l??=e}if(l!==void 0)throw l}let u=c??(r&&!t.preload?r:void 0),f=t.firstBadMatchIndex===void 0?t.matches.length-1:t.firstBadMatchIndex;if(!u&&r&&t.preload)return t.matches;if(u){let e=Me(t,u);e===void 0&&d();let n=t.matches[e],r=t.router.looseRoutesById[n.routeId],i=t.router.options?.defaultNotFoundComponent;!r.options.notFoundComponent&&i&&(r.options.notFoundComponent=i),u.routeId=n.routeId;let a=n.routeId===t.router.routeTree.id;t.updateMatch(n.id,e=>({...e,...a?{status:`success`,globalNotFound:!0,error:void 0}:{status:`notFound`,error:u},isFetching:!1})),f=e,await W(r,[`notFoundComponent`])}else if(!t.preload){let e=t.matches[0];e.globalNotFound||t.router.getMatch(e.id)?.globalNotFound&&t.updateMatch(e.id,e=>({...e,globalNotFound:!1,error:void 0}))}if(t.serialError&&t.firstBadMatchIndex!==void 0){let e=t.router.looseRoutesById[t.matches[t.firstBadMatchIndex].routeId];await W(e,[`errorComponent`])}for(let e=0;e<=f;e++){let{id:n,routeId:r}=t.matches[e],i=t.router.looseRoutesById[r];try{let e=ze(t,n,i);if(e){let r=await e;t.updateMatch(n,e=>({...e,...r}))}}catch(e){console.error(`Error executing head for route ${r}:`,e)}}let p=Ae(t);if(D(p)&&await p,u)throw u;if(t.serialError&&!t.preload&&!t.onReady)throw t.serialError;return t.matches}function We(e,t){let n=t.map(t=>e.options[t]?.preload?.()).filter(Boolean);if(n.length!==0)return Promise.all(n)}function W(e,t=G){!e._lazyLoaded&&e._lazyPromise===void 0&&(e.lazyFn?e._lazyPromise=e.lazyFn().then(t=>{let{id:n,...r}=t.options;Object.assign(e.options,r),e._lazyLoaded=!0,e._lazyPromise=void 0}):e._lazyLoaded=!0);let n=()=>e._componentsLoaded?void 0:t===G?(()=>{if(e._componentsPromise===void 0){let t=We(e,G);t?e._componentsPromise=t.then(()=>{e._componentsLoaded=!0,e._componentsPromise=void 0}):e._componentsLoaded=!0}return e._componentsPromise})():We(e,t);return e._lazyPromise?e._lazyPromise.then(n):n()}function Ge(e){for(let t of G)if(e.options[t]?.preload)return!0;return!1}var G=[`component`,`errorComponent`,`pendingComponent`,`notFoundComponent`];function Ke(e){return{input:({url:t})=>{for(let n of e)t=Je(n,t);return t},output:({url:t})=>{for(let n=e.length-1;n>=0;n--)t=Ye(e[n],t);return t}}}function qe(e){let t=ce(e.basepath),n=`/${t}`,r=e.caseSensitive?n:n.toLowerCase(),i=`${r}/`;return{input:({url:t})=>{let a=e.caseSensitive?t.pathname:t.pathname.toLowerCase();return a===r?t.pathname=`/`:a.startsWith(i)&&(t.pathname=t.pathname.slice(n.length)),t},output:({url:e})=>(e.pathname=p([`/`,t,e.pathname]),e)}}function Je(e,t){let n=e?.input?.({url:t});if(n){if(typeof n==`string`)return new URL(n);if(n instanceof URL)return n}return t}function Ye(e,t){let n=e?.output?.({url:t});if(n){if(typeof n==`string`)return new URL(n);if(n instanceof URL)return n}return t}var K=`__TSR_index`,Xe=`popstate`,Ze=`beforeunload`;function Qe(e){let t=e.getLocation(),n=new Set,r=r=>{t=e.getLocation(),n.forEach(e=>e({location:t,action:r}))},i=n=>{e.notifyOnIndexChange??!0?r(n):t=e.getLocation()},a=async({task:n,navigateOpts:r,...i})=>{if(r?.ignoreBlocker??!1){n();return}let a=e.getBlockers?.()??[],o=i.type===`PUSH`||i.type===`REPLACE`;if(typeof document<`u`&&a.length&&o)for(let n of a){let r=q(i.path,i.state);if(await n.blockerFn({currentLocation:t,nextLocation:r,action:i.type})){e.onBlocked?.();return}}n()};return{get location(){return t},get length(){return e.getLength()},subscribers:n,subscribe:e=>(n.add(e),()=>{n.delete(e)}),push:(n,i,o)=>{let s=t.state[K];i=$e(s+1,i),a({task:()=>{e.pushState(n,i),r({type:`PUSH`})},navigateOpts:o,type:`PUSH`,path:n,state:i})},replace:(n,i,o)=>{let s=t.state[K];i=$e(s,i),a({task:()=>{e.replaceState(n,i),r({type:`REPLACE`})},navigateOpts:o,type:`REPLACE`,path:n,state:i})},go:(t,n)=>{a({task:()=>{e.go(t),i({type:`GO`,index:t})},navigateOpts:n,type:`GO`})},back:t=>{a({task:()=>{e.back(t?.ignoreBlocker??!1),i({type:`BACK`})},navigateOpts:t,type:`BACK`})},forward:t=>{a({task:()=>{e.forward(t?.ignoreBlocker??!1),i({type:`FORWARD`})},navigateOpts:t,type:`FORWARD`})},canGoBack:()=>t.state[K]!==0,createHref:t=>e.createHref(t),block:t=>{if(!e.setBlockers)return()=>{};let n=e.getBlockers?.()??[];return e.setBlockers([...n,t]),()=>{let n=e.getBlockers?.()??[];e.setBlockers?.(n.filter(e=>e!==t))}},flush:()=>e.flush?.(),destroy:()=>e.destroy?.(),notify:r}}function $e(e,t){t||={};let n=nt();return{...t,key:n,__TSR_key:n,[K]:e}}function et(e){let t=e?.window??(typeof document<`u`?window:void 0),n=t.history.pushState,r=t.history.replaceState,i=[],a=()=>i,o=e=>i=e,s=e?.createHref??(e=>e),c=e?.parseLocation??(()=>q(`${t.location.pathname}${t.location.search}${t.location.hash}`,t.history.state));if(!t.history.state?.__TSR_key&&!t.history.state?.key){let e=nt();t.history.replaceState({[K]:0,key:e,__TSR_key:e},``)}let l=c(),u,d=!1,f=!1,p=!1,m=!1,h=()=>l,g,_,v=()=>{g&&(C._ignoreSubscribers=!0,(g.isPush?t.history.pushState:t.history.replaceState)(g.state,``,g.href),C._ignoreSubscribers=!1,g=void 0,_=void 0,u=void 0)},y=(e,t,n)=>{let r=s(t);_||(u=l),l=q(t,n),g={href:r,state:n,isPush:g?.isPush||e===`push`},_||=Promise.resolve().then(()=>v())},b=e=>{l=c(),C.notify({type:e})},x=async()=>{if(f){f=!1;return}let e=c(),n=e.state[K]-l.state[K],r=n===1,i=n===-1,o=!r&&!i||d;d=!1;let s=o?`GO`:i?`BACK`:`FORWARD`,u=o?{type:`GO`,index:n}:{type:i?`BACK`:`FORWARD`};if(p)p=!1;else{let n=a();if(typeof document<`u`&&n.length){for(let r of n)if(await r.blockerFn({currentLocation:l,nextLocation:e,action:s})){f=!0,t.history.go(1),C.notify(u);return}}}l=c(),C.notify(u)},S=e=>{if(m){m=!1;return}let t=!1,n=a();if(typeof document<`u`&&n.length)for(let e of n){let n=e.enableBeforeUnload??!0;if(n===!0){t=!0;break}if(typeof n==`function`&&n()===!0){t=!0;break}}if(t)return e.preventDefault(),e.returnValue=``},C=Qe({getLocation:h,getLength:()=>t.history.length,pushState:(e,t)=>y(`push`,e,t),replaceState:(e,t)=>y(`replace`,e,t),back:e=>(e&&(p=!0),m=!0,t.history.back()),forward:e=>{e&&(p=!0),m=!0,t.history.forward()},go:e=>{d=!0,t.history.go(e)},createHref:e=>s(e),flush:v,destroy:()=>{t.history.pushState=n,t.history.replaceState=r,t.removeEventListener(Ze,S,{capture:!0}),t.removeEventListener(Xe,x)},onBlocked:()=>{u&&l!==u&&(l=u)},getBlockers:a,setBlockers:o,notifyOnIndexChange:!1});return t.addEventListener(Ze,S,{capture:!0}),t.addEventListener(Xe,x),t.history.pushState=function(...e){let r=n.apply(t.history,e);return C._ignoreSubscribers||b(`PUSH`),r},t.history.replaceState=function(...e){let n=r.apply(t.history,e);return C._ignoreSubscribers||b(`REPLACE`),n},C}function tt(e){let t=e.replace(/[\x00-\x1f\x7f]/g,``);return t.startsWith(`//`)&&(t=`/`+t.replace(/^\/+/,``)),t}function q(e,t){let n=tt(e),r=n.indexOf(`#`),i=n.indexOf(`?`),a=nt();return{href:n,pathname:n.substring(0,r>0?i>0?Math.min(r,i):r:i>0?i:n.length),hash:r>-1?n.substring(r):``,search:i>-1?n.slice(i,r===-1?void 0:r):``,state:t||{[K]:0,key:a,__TSR_key:a}}}function nt(){return(Math.random()+1).toString(36).substring(7)}function J(e,t){let n=t,r=e;return{fromLocation:n,toLocation:r,pathChanged:n?.pathname!==r.pathname,hrefChanged:n?.href!==r.href,hashChanged:n?.hash!==r.hash}}var rt=new WeakMap,it=class{constructor(e,t){this.tempLocationKey=`${Math.round(Math.random()*1e7)}`,this._scroll={next:!0},this.shouldViewTransition=void 0,this.isViewTransitionTypesSupported=void 0,this.subscribers=new Set,this.routeBranchCache=new WeakMap,this.startTransition=e=>e(),this.update=e=>{let t=this.options,n=this.basepath??t?.basepath??`/`,r=this.basepath===void 0,i=t?.rewrite;if(this.options={...t,...e},this.isServer=this.options.isServer??typeof document>`u`,this.protocolAllowlist=new Set(this.options.protocolAllowlist),this.options.pathParamsAllowedCharacters&&(this.pathParamsDecoder=s(this.options.pathParamsAllowedCharacters)),(!this.history||this.options.history&&this.options.history!==this.history)&&(this.options.history?this.history=this.options.history:this.history=et()),this.origin=this.options.origin,this.origin||(window?.origin&&window.origin!==`null`?this.origin=window.origin:this.origin=`http://localhost`),this.history&&this.updateLatestLocation(),this.options.routeTree!==this.routeTree){this.routeTree=this.options.routeTree;let e;this.resolvePathCache=re(1e3),e=this.buildRouteTree(),this.setRoutes(e)}if(!this.stores&&this.latestLocation){let e=this.getStoreConfig(this);this.batch=e.batch,this.stores=fe(ot(this.latestLocation),e),Se(this)}let a=!1,o=this.options.basepath??`/`,c=this.options.rewrite;if(r||n!==o||i!==c){this.basepath=o;let e=[],t=ce(o);t&&t!==`/`&&e.push(qe({basepath:o})),c&&e.push(c),this.rewrite=e.length===0?void 0:e.length===1?e[0]:Ke(e),this.history&&this.updateLatestLocation(),a=!0}a&&this.stores&&this.stores.location.set(this.latestLocation),typeof window<`u`&&`CSS`in window&&typeof window.CSS?.supports==`function`&&(this.isViewTransitionTypesSupported=window.CSS.supports(`selector(:active-view-transition-type(a))`))},this.updateLatestLocation=()=>{this.latestLocation=this.parseLocation(this.history.location,this.latestLocation)},this.buildRouteTree=()=>{let e=f(this.routeTree,this.options.caseSensitive,(e,t)=>{e.init({originalIndex:t})});return this.options.routeMasks&&c(this.options.routeMasks,e.processedTree),e},this.subscribe=(e,t)=>{let n={eventType:e,fn:t};return this.subscribers.add(n),()=>{this.subscribers.delete(n)}},this.emit=e=>{this.subscribers.forEach(t=>{t.eventType===e.type&&t.fn(e)})},this.parseLocation=(e,t)=>{let n=({pathname:e,search:n,hash:r,href:i,state:a})=>{if(!this.rewrite&&!/[ \x00-\x1f\x7f\u0080-\uffff]/.test(e)){let i=this.options.parseSearch(n),o=this.options.stringifySearch(i);return{href:e+o+r,publicHref:e+o+r,pathname:v(e).path,external:!1,searchStr:o,search:M(t?.search,i),hash:v(r.slice(1)).path,state:O(t?.state,a)}}let o=new URL(i,this.origin),s=Je(this.rewrite,o),c=this.options.parseSearch(s.search),l=this.options.stringifySearch(c);return s.search=l,{href:s.href.replace(s.origin,``),publicHref:i,pathname:v(s.pathname).path,external:!!this.rewrite&&s.origin!==this.origin,searchStr:l,search:M(t?.search,c),hash:v(s.hash.slice(1)).path,state:O(t?.state,a)}},r=n(e),{__tempLocation:i,__tempKey:a}=r.state;if(i&&(!a||a===this.tempLocationKey)){let e=n(i);return e.state.key=r.state.key,e.state.__TSR_key=r.state.__TSR_key,delete e.state.__tempLocation,{...e,maskedLocation:r}}return r},this.resolvePathWithBase=(e,t)=>y({base:e,to:t.includes(`//`)?_(t):t,trailingSlash:this.options.trailingSlash,cache:this.resolvePathCache}),this.matchRoutes=(e,t,n)=>typeof e==`string`?this.matchRoutesInternal({pathname:e,search:t},n):this.matchRoutesInternal(e,t),this.getMatchedRoutes=e=>st({pathname:e,routesById:this.routesById,processedTree:this.processedTree}),this.cancelMatch=e=>{let t=this.getMatch(e);t&&(t.abortController.abort(),clearTimeout(t._nonReactive.pendingTimeout),t._nonReactive.pendingTimeout=void 0)},this.cancelMatches=()=>{this.stores.pendingIds.get().forEach(e=>{this.cancelMatch(e)}),this.stores.matchesId.get().forEach(e=>{if(this.stores.pendingMatchStores.has(e))return;let t=this.stores.matchStores.get(e)?.get();t&&(t.status===`pending`||t.isFetching===`loader`)&&this.cancelMatch(e)})},this.buildLocation=e=>{let t=(t={})=>{let n=t._fromLocation||this.pendingBuiltLocation||this.latestLocation,r=this.matchRoutesLightweight(n);t.from;let i=t.unsafeRelative===`path`?n.pathname:t.from??r.fullPath,o=t.to?`${t.to}`:void 0,s=r.search,c=Object.assign(Object.create(null),r.params),l=o?.charCodeAt(0)===47?`/`:this.resolvePathWithBase(i,`.`),d=o?this.resolvePathWithBase(l,o):l,f=t.params===!1||t.params===null?Object.create(null):(t.params??!0)===!0?c:Object.assign(c,j(t.params,c)),p=this.routesByPath[a(d)],m;if(p)m=this.getRouteBranch(p);else if(d.includes(`$`))m=[];else{let e=this.getMatchedRoutes(d);m=e.matchedRoutes,this.options.notFoundRoute&&(!e.foundRoute||e.foundRoute.path!==`/`&&e.routeParams[`**`])&&(m=[...m,this.options.notFoundRoute])}if(m.length&&ie(f))for(let e of m){let t=e.options.params?.stringify??e.options.stringifyParams;if(t)try{Object.assign(f,t(f))}catch{}}let h=e.leaveParams?d:v(u({path:d,params:f,decoder:this.pathParamsDecoder,server:this.isServer}).interpolatedPath).path,g=s;if(e._includeValidateSearch&&this.options.search?.strict){let e={};m.forEach(t=>{if(t.options.validateSearch)try{Object.assign(e,X(t.options.validateSearch,{...e,...g}))}catch{}}),g=e}g=ct({search:g,dest:t,destRoutes:m,_includeValidateSearch:e._includeValidateSearch}),g=M(s,g);let _=this.options.stringifySearch(g),y=t.hash===!0?n.hash:t.hash?j(t.hash,n.hash):void 0,b=y?`#${y}`:``,x=t.state===!0?n.state:t.state?j(t.state,n.state):{};x=O(n.state,x);let S=`${h}${_}${b}`,C,w,T=!1;if(this.rewrite){let e=new URL(S,this.origin),t=Ye(this.rewrite,e);C=e.href.replace(e.origin,``),t.origin===this.origin?w=t.pathname+t.search+t.hash:(w=t.href,T=!0)}else C=k(S),w=C;return{publicHref:w,href:C,pathname:h,search:g,searchStr:_,state:x,hash:y??``,external:T,unmaskOnReload:t.unmaskOnReload}},n=(n={},r)=>{let i=t(n),a=r?t(r):void 0;if(!a){let n=Object.create(null);if(this.options.routeMasks){let o=l(i.pathname,this.processedTree);if(o){Object.assign(n,o.rawParams);let{from:i,params:s,...c}=o.route,l=s===!1||s===null?Object.create(null):(s??!0)===!0?n:Object.assign(n,j(s,n));r={from:e.from,...c,params:l},a=t(r)}}}return a&&(i.maskedLocation=a),i};return e.mask?n(e,{from:e.from,...e.mask}):n(e)},this.commitLocation=async({viewTransition:e,ignoreBlocker:t,...n})=>{let i,o=()=>{let e=[`key`,`__TSR_key`,`__TSR_index`,`__hashScrollIntoViewOptions`];e.forEach(e=>{n.state[e]=this.latestLocation.state[e]});let t=r(n.state,this.latestLocation.state);return e.forEach(e=>{delete n.state[e]}),t},s=a(this.latestLocation.href)===a(n.href),c=this.commitLocationPromise;if(this.commitLocationPromise=E(()=>{c?.resolve(),c=void 0}),s&&o())this.load();else{let{maskedLocation:r,hashScrollIntoView:a,...o}=n;r&&(o={...r,state:{...r.state,__tempKey:void 0,__tempLocation:{...o,search:o.searchStr,state:{...o.state,__tempKey:void 0,__tempLocation:void 0,__TSR_key:void 0,key:void 0}}}},(o.unmaskOnReload??this.options.unmaskOnReload??!1)&&(o.state.__tempKey=this.tempLocationKey)),o.state.__hashScrollIntoViewOptions=a??this.options.defaultHashScrollIntoView??!0,this.shouldViewTransition=e,i=n.replace?`REPLACE`:`PUSH`,this.history[i===`REPLACE`?`replace`:`push`](o.publicHref,o.state,{ignoreBlocker:t})}return this._scroll.next=n.resetScroll??!0,this.history.subscribers.size||this.load(i?{action:{type:i}}:void 0),this.commitLocationPromise},this.buildAndCommitLocation=({replace:e,resetScroll:t,hashScrollIntoView:n,viewTransition:r,ignoreBlocker:i,href:a,...o}={})=>{if(a){let t=this.history.location.state.__TSR_index,n=q(a,{__TSR_index:e?t:t+1}),r=new URL(n.pathname,this.origin);o.to=Je(this.rewrite,r).pathname,o.search=this.options.parseSearch(n.search),o.hash=n.hash.slice(1)}let s=this.buildLocation({...o,_includeValidateSearch:!0});this.pendingBuiltLocation=s;let c=this.commitLocation({...s,viewTransition:r,replace:e,resetScroll:t,hashScrollIntoView:n,ignoreBlocker:i});return Promise.resolve().then(()=>{this.pendingBuiltLocation===s&&(this.pendingBuiltLocation=void 0)}),c},this.navigate=async({to:e,reloadDocument:t,href:n,publicHref:r,...i})=>{let a=!1;if(n)try{new URL(`${n}`),a=!0}catch{}if(a&&!t&&(t=!0),t){if(e!==void 0||!n){let t=this.buildLocation({to:e,...i});n??=t.publicHref,r??=t.publicHref}let t=!a&&r?r:n;if(A(t,this.protocolAllowlist))return Promise.resolve();if(!i.ignoreBlocker){let e=this.history.getBlockers?.()??[];for(let t of e)if(t?.blockerFn&&await t.blockerFn({currentLocation:this.latestLocation,nextLocation:this.latestLocation,action:`PUSH`}))return Promise.resolve()}return i.replace?window.location.replace(t):window.location.href=t,Promise.resolve()}return this.buildAndCommitLocation({...i,href:n,to:e,_isNavigate:!0})},this.beforeLoad=()=>{this.cancelMatches(),this.updateLatestLocation();let e=this.matchRoutes(this.latestLocation),t=this.stores.cachedMatches.get().filter(t=>!e.some(e=>e.id===t.id));this.batch(()=>{this.stores.status.set(`pending`),this.stores.statusCode.set(200),this.stores.isLoading.set(!0),this.stores.location.set(this.latestLocation),this.stores.setPending(e),this.stores.setCached(t)})},this.load=async e=>{let t=e?.action?.type,n,r,a,o=this.stores.resolvedLocation.get()??this.stores.location.get();for(a=new Promise(s=>{this.startTransition(async()=>{try{this.beforeLoad(),t?rt.set(this.latestLocation,t):rt.delete(this.latestLocation);let n=this.latestLocation,r=J(n,this.stores.resolvedLocation.get());this.stores.redirect.get()||this.emit({type:`onBeforeNavigate`,...r}),this.emit({type:`onBeforeLoad`,...r}),await Ue({router:this,sync:e?.sync,forceStaleReload:o.href===n.href,matches:this.stores.pendingMatches.get(),location:n,updateMatch:this.updateMatch,onReady:async()=>{this.startTransition(()=>{this.startViewTransition(async()=>{let e=null,t=null,n=null,r=null;this.batch(()=>{let i=this.stores.pendingMatches.get(),a=i.length,o=this.stores.matches.get();e=a?o.filter(e=>!this.stores.pendingMatchStores.has(e.id)):null;let s=new Set;for(let e of this.stores.pendingMatchStores.values())e.routeId&&s.add(e.routeId);let c=new Set;for(let e of this.stores.matchStores.values())e.routeId&&c.add(e.routeId);t=a?o.filter(e=>!s.has(e.routeId)):null,n=a?i.filter(e=>!c.has(e.routeId)):null,r=a?i.filter(e=>c.has(e.routeId)):o,this.stores.isLoading.set(!1),this.stores.loadedAt.set(Date.now()),a&&(this.stores.setMatches(i),this.stores.setPending([]),this.stores.setCached([...this.stores.cachedMatches.get(),...e.filter(e=>e.status!==`error`&&e.status!==`notFound`&&e.status!==`redirected`)]),this.clearExpiredCache())});for(let[e,i]of[[t,`onLeave`],[n,`onEnter`],[r,`onStay`]])if(e)for(let t of e)this.looseRoutesById[t.routeId].options[i]?.(t)})})}})}catch(e){i(e)?(n=e,this.navigate({...n.options,replace:!0,ignoreBlocker:!0})):h(e)&&(r=e);let t=n?n.status:r?404:this.stores.matches.get().some(e=>e.status===`error`)?500:200;this.batch(()=>{this.stores.statusCode.set(t),this.stores.redirect.set(n)})}this.latestLoadPromise===a&&(this.commitLocationPromise?.resolve(),this.latestLoadPromise=void 0,this.commitLocationPromise=void 0),s()})}),this.latestLoadPromise=a,await a;this.latestLoadPromise&&a!==this.latestLoadPromise;)await this.latestLoadPromise;let s;this.hasNotFoundMatch()?s=404:this.stores.matches.get().some(e=>e.status===`error`)&&(s=500),s!==void 0&&this.stores.statusCode.set(s)},this.startViewTransition=e=>{let t=this.shouldViewTransition??this.options.defaultViewTransition;if(this.shouldViewTransition=void 0,t&&typeof document<`u`&&`startViewTransition`in document&&typeof document.startViewTransition==`function`){let n;if(typeof t==`object`&&this.isViewTransitionTypesSupported){let r=this.latestLocation,i=this.stores.resolvedLocation.get(),a=typeof t.types==`function`?t.types(J(r,i)):t.types;if(a===!1){e();return}n={update:e,types:a}}else n=e;document.startViewTransition(n)}else e()},this.updateMatch=(e,t)=>{this.startTransition(()=>{let n=this.stores.pendingMatchStores.get(e);if(n){n.set(t);return}let r=this.stores.matchStores.get(e);if(r){r.set(t);return}let i=this.stores.cachedMatchStores.get(e);if(i){let n=t(i.get());n.status===`redirected`?this.stores.cachedMatchStores.delete(e)&&this.stores.cachedIds.set(t=>t.filter(t=>t!==e)):i.set(n)}})},this.getMatch=e=>this.stores.cachedMatchStores.get(e)?.get()??this.stores.pendingMatchStores.get(e)?.get()??this.stores.matchStores.get(e)?.get(),this.invalidate=e=>{let t=t=>e?.filter?.(t)??!0?{...t,invalid:!0,...e?.forcePending||t.status===`error`||t.status===`notFound`?{status:`pending`,error:void 0}:void 0}:t;return this.batch(()=>{this.stores.setMatches(this.stores.matches.get().map(t)),this.stores.setCached(this.stores.cachedMatches.get().map(t)),this.stores.setPending(this.stores.pendingMatches.get().map(t))}),this.shouldViewTransition=!1,this.load({sync:e?.sync})},this.getParsedLocationHref=e=>e.publicHref||`/`,this.resolveRedirect=e=>{let t=e.headers.get(`Location`);if(!e.options.href||e.options._builtLocation){let t=e.options._builtLocation??this.buildLocation(e.options),n=this.getParsedLocationHref(t);e.options.href=n,e.headers.set(`Location`,n)}else if(t)try{let n=new URL(t);if(this.origin&&n.origin===this.origin){let t=n.pathname+n.search+n.hash;e.options.href=t,e.headers.set(`Location`,t)}}catch{}if(e.options.href&&!e.options._builtLocation&&A(e.options.href,this.protocolAllowlist))throw Error(`Redirect blocked: unsafe protocol`);return e.headers.get(`Location`)||e.headers.set(`Location`,e.options.href),e},this.clearCache=e=>{let t=e?.filter;t===void 0?this.stores.setCached([]):this.stores.setCached(this.stores.cachedMatches.get().filter(e=>!t(e)))},this.clearExpiredCache=()=>{let e=Date.now();this.clearCache({filter:t=>{let n=this.looseRoutesById[t.routeId];if(!n.options.loader)return!0;let r=(t.preload?n.options.preloadGcTime??this.options.defaultPreloadGcTime:n.options.gcTime??this.options.defaultGcTime)??300*1e3;return t.status===`error`?!0:e-t.updatedAt>=r}})},this.loadRouteChunk=W,this.preloadRoute=async e=>{let t=e._builtLocation??this.buildLocation(e),n=this.matchRoutes(t,{throwOnError:!0,preload:!0,dest:e}),r=new Set([...this.stores.matchesId.get(),...this.stores.pendingIds.get()]),a=new Set([...r,...this.stores.cachedIds.get()]),o=n.filter(e=>!a.has(e.id));if(o.length){let e=this.stores.cachedMatches.get();this.stores.setCached([...e,...o])}try{return n=await Ue({router:this,matches:n,location:t,preload:!0,updateMatch:(e,t)=>{r.has(e)?n=n.map(n=>n.id===e?t(n):n):this.updateMatch(e,t)}}),n}catch(e){if(i(e))return e.options.reloadDocument?void 0:await this.preloadRoute({...e.options,_fromLocation:t});h(e)||console.error(e);return}},this.matchRoute=(e,t)=>{let n={...e,to:e.to?this.resolvePathWithBase(e.from||``,e.to):void 0,params:e.params||{},leaveParams:!0},i=this.buildLocation(n);if(t?.pending&&this.stores.status.get()!==`pending`)return!1;let a=(t?.pending===void 0?!this.stores.isLoading.get():t.pending)?this.latestLocation:this.stores.resolvedLocation.get()||this.stores.location.get(),o=C(i.pathname,t?.caseSensitive??!1,t?.fuzzy??!1,a.pathname,this.processedTree);return!o||e.params&&!r(o.rawParams,e.params,{partial:!0})?!1:t?.includeSearch??!0?r(a.search,i.search,{partial:!0})?o.rawParams:!1:o.rawParams},this.hasNotFoundMatch=()=>this.stores.matches.get().some(e=>e.status===`notFound`||e.globalNotFound),this.getStoreConfig=t,this.update({defaultPreloadDelay:50,defaultPendingMs:1e3,defaultPendingMinMs:500,context:void 0,...e,caseSensitive:e.caseSensitive??!1,notFoundMode:e.notFoundMode??`fuzzy`,stringifySearch:e.stringifySearch??De,parseSearch:e.parseSearch??Ee,protocolAllowlist:e.protocolAllowlist??T}),typeof document<`u`&&(self.__TSR_ROUTER__=this)}isShell(){return!!this.options.isShell}isPrerendering(){return!!this.options.isPrerendering}get state(){return this.stores.__store.get()}setRoutes({routesById:e,routesByPath:t,processedTree:n}){this.routesById=e,this.routesByPath=t,this.processedTree=n;let r=this.options.notFoundRoute;r&&(r.init({originalIndex:99999999999}),this.routesById[r.id]=r)}getRouteBranch(e){let t=this.routeBranchCache.get(e);return t||(t=S(e),this.routeBranchCache.set(e,t)),t}get looseRoutesById(){return this.routesById}getParentContext(e){return e?.id?e.context??this.options.context??void 0:this.options.context??void 0}matchRoutesInternal(e,t){let n=this.getMatchedRoutes(e.pathname),{foundRoute:r,routeParams:o}=n,{matchedRoutes:s}=n,c=!1;(r?r.path!==`/`&&o[`**`]:a(e.pathname))&&(this.options.notFoundRoute?s=[...s,this.options.notFoundRoute]:c=!0);let l=c?ut(this.options.notFoundMode,s):void 0,d=Array(s.length),f=new Map;for(let e of this.stores.matchStores.values())e.routeId&&f.set(e.routeId,e.get());for(let n=0;n<s.length;n++){let r=s[n],a=d[n-1],c,p,m;{let n=a?.search??e.search,i=a?._strictSearch??void 0;try{let e=X(r.options.validateSearch,{...n})??void 0;c={...n,...e},p={...i,...e},m=void 0}catch(e){let r=e;if(e instanceof Y||(r=new Y(e.message,{cause:e})),t?.throwOnError)throw r;c=n,p={},m=r}}let g=r.options.loaderDeps?.({search:c})??``,_=g?JSON.stringify(g):``,{interpolatedPath:v,usedParams:y}=u({path:r.fullPath,params:o,decoder:this.pathParamsDecoder,server:this.isServer}),b=r.id+v+_,x=this.getMatch(b),S=f.get(r.id),C=x?._strictParams??y,w;if(!x)try{dt(r,C)}catch(e){if(w=h(e)||i(e)?e:new at(e.message,{cause:e}),t?.throwOnError)throw w}Object.assign(o,C);let T=S?`stay`:`enter`,D;if(x)D={...x,cause:T,params:S?.params??o,_strictParams:C,search:M(S?S.search:x.search,c),_strictSearch:p};else{let e=r.options.loader||r.options.beforeLoad||r.lazyFn||Ge(r)?`pending`:`success`;D={id:b,ssr:r.options.ssr,index:n,routeId:r.id,params:S?.params??o,_strictParams:C,pathname:v,updatedAt:Date.now(),search:S?M(S.search,c):c,_strictSearch:p,searchError:void 0,status:e,isFetching:!1,error:void 0,paramsError:w,__routeContext:void 0,_nonReactive:{loadPromise:E()},__beforeLoadContext:void 0,context:{},abortController:new AbortController,fetchCount:0,cause:T,loaderDeps:S?O(S.loaderDeps,g):g,invalid:!1,preload:!1,links:void 0,scripts:void 0,headScripts:void 0,meta:void 0,staticData:r.options.staticData||{},fullPath:r.fullPath}}t?.preload||(D.globalNotFound=l===r.id),D.searchError=m;let k=this.getParentContext(a);D.context={...k,...D.__routeContext,...D.__beforeLoadContext},d[n]=D}for(let t=0;t<d.length;t++){let n=d[t],r=this.looseRoutesById[n.routeId],i=this.getMatch(n.id),a=f.get(n.routeId);if(n.params=a?M(a.params,o):o,!i){let i=d[t-1],a=this.getParentContext(i);if(r.options.context){let t={deps:n.loaderDeps,params:n.params,context:a??{},location:e,navigate:t=>this.navigate({...t,_fromLocation:e}),buildLocation:this.buildLocation,cause:n.cause,abortController:n.abortController,preload:!!n.preload,matches:d,routeId:r.id};n.__routeContext=r.options.context(t)??void 0}n.context={...a,...n.__routeContext,...n.__beforeLoadContext}}}return d}matchRoutesLightweight(e){let{matchedRoutes:t,routeParams:n}=this.getMatchedRoutes(e.pathname),r=ne(t),i={...e.search};for(let e of t)try{Object.assign(i,X(e.options.validateSearch,i))}catch{}let a=ne(this.stores.matchesId.get()),o=a&&this.stores.matchStores.get(a)?.get(),s=o&&o.routeId===r.id&&o.pathname===e.pathname,c;if(s)c=o.params;else{let e=Object.assign(Object.create(null),n);for(let n of t)try{dt(n,e)}catch{}c=e}return{matchedRoutes:t,fullPath:r.fullPath,search:i,params:c}}},Y=class extends Error{},at=class extends Error{};function ot(e){return{loadedAt:0,isLoading:!1,isTransitioning:!1,status:`idle`,resolvedLocation:void 0,location:e,matches:[],statusCode:200}}function X(e,t){if(e==null)return{};if(`~standard`in e){let n=e[`~standard`].validate(t);if(n instanceof Promise)throw new Y(`Async validation not supported`);if(n.issues)throw new Y(JSON.stringify(n.issues,void 0,2),{cause:n});return n.value}return`parse`in e?e.parse(t):typeof e==`function`?e(t):{}}function st({pathname:e,routesById:t,processedTree:n}){let r=Object.create(null),i=a(e),o,s=x(i,n,!0);return s&&(o=s.route,Object.assign(r,s.rawParams)),{matchedRoutes:s?.branch||[t.__root__],routeParams:r,foundRoute:o}}function ct({search:e,dest:t,destRoutes:n,_includeValidateSearch:r}){return lt(n)(e,t,r??!1)}function lt(e){let t,n,r=[];for(let t of e){let e=t.options;`search`in e?e.search?.middlewares&&r.push(...e.search.middlewares):(e.preSearchFilters||e.postSearchFilters)&&r.push(({search:t,next:n})=>{let r=n(e.preSearchFilters?e.preSearchFilters.reduce((e,t)=>t(e),t):t);return e.postSearchFilters?e.postSearchFilters.reduce((e,t)=>t(e),r):r});let i=e.validateSearch;i&&r.push(({search:e,next:t,meta:r})=>{let a=t(e);if(n)try{let e=X(i,a);if(r&&e)for(let t in e)t in a||(r.defaulted||=new Map).set(t,e[t]);return{...a,...e}}catch{}return a})}let i=(e,n,a)=>{if(e>=r.length){if(!t.search)return{};if(t.search===!0)return n;let e=j(t.search,n);return a&&(a.explicit=e),e}return r[e]({search:n,next:(t,n)=>{if(n){let n=a||{};return{search:i(e+1,t,n),meta:n}}return i(e+1,t,a)},meta:a})};return function(e,r,a){return t=r,n=a,i(0,e)}}function ut(e,t){if(e!==`root`)for(let e=t.length-1;e>=0;e--){let n=t[e];if(n.children)return n.id}return m}function dt(e,t){let n=e.options.params?.parse??e.options.parseParams;if(n){let e=n(t);if(e===!1)throw Error(`Route params.parse returned false for a matched route`);Object.assign(t,e)}}var Z=e(n(),1),Q=t();function ft(e){let t=e.errorComponent??mt;return(0,Q.jsx)(pt,{getResetKey:e.getResetKey,onCatch:e.onCatch,children:({error:n,reset:r})=>n?Z.createElement(t,{error:n,reset:r}):e.children})}var pt=class extends Z.Component{constructor(...e){super(...e),this.state={error:null}}static getDerivedStateFromProps(e,t){let n=e.getResetKey();return t.error&&t.resetKey!==n?{resetKey:n,error:null}:{resetKey:n}}static getDerivedStateFromError(e){return{error:e}}reset(){this.setState({error:null})}componentDidCatch(e,t){this.props.onCatch&&this.props.onCatch(e,t)}render(){return this.props.children({error:this.state.error,reset:()=>{this.reset()}})}};function mt({error:e}){let[t,n]=Z.useState(!1);return(0,Q.jsxs)(`div`,{style:{padding:`.5rem`,maxWidth:`100%`},children:[(0,Q.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:`.5rem`},children:[(0,Q.jsx)(`strong`,{style:{fontSize:`1rem`},children:`Something went wrong!`}),(0,Q.jsx)(`button`,{style:{appearance:`none`,fontSize:`.6em`,border:`1px solid currentColor`,padding:`.1rem .2rem`,fontWeight:`bold`,borderRadius:`.25rem`},onClick:()=>n(e=>!e),children:t?`Hide Error`:`Show Error`})]}),(0,Q.jsx)(`div`,{style:{height:`.25rem`}}),t?(0,Q.jsx)(`div`,{children:(0,Q.jsx)(`pre`,{style:{fontSize:`.7em`,border:`1px solid red`,borderRadius:`.25rem`,padding:`.3rem`,color:`red`,overflow:`auto`},children:e.message?(0,Q.jsx)(`code`,{children:e.message}):null})}):null]})}function ht(e){let t=N(),n=`not-found-${o(t.stores.location,e=>e.pathname)}-${o(t.stores.status,e=>e)}`;return(0,Q.jsx)(ft,{getResetKey:()=>n,onCatch:(t,n)=>{if(h(t))e.onCatch?.(t,n);else throw t},errorComponent:({error:t})=>{if(h(t))return e.fallback?.(t);throw t},children:e.children})}function gt(){return(0,Q.jsx)(`p`,{children:`Not Found`})}function $(e){return(0,Q.jsx)(Q.Fragment,{children:e.children})}function _t(e,t,n){return t.options.notFoundComponent?(0,Q.jsx)(t.options.notFoundComponent,{...n}):e.options.defaultNotFoundComponent?(0,Q.jsx)(e.options.defaultNotFoundComponent,{...n}):(0,Q.jsx)(gt,{})}var vt=(e,t)=>e.routeId===t.routeId&&e._displayPending===t._displayPending,yt=(e,t)=>e[0]===t[0]&&e[1]===t[1],bt=Z.memo(function({matchId:e}){let t=N(),n=t.stores.matchStores.get(e);n||d();let r=o(t.stores.loadedAt,e=>e),i=o(n,e=>e,vt);return(0,Q.jsx)(xt,{router:t,matchId:e,resetKey:r,matchState:Z.useMemo(()=>{let e=i.routeId,n=t.routesById[e].parentRoute?.id;return{routeId:e,ssr:i.ssr,_displayPending:i._displayPending,parentRouteId:n}},[i._displayPending,i.routeId,i.ssr,t.routesById])})});function xt({router:e,matchId:t,resetKey:n,matchState:r}){let i=e.routesById[r.routeId],a=i.options.pendingComponent??e.options.defaultPendingComponent,o=a?(0,Q.jsx)(a,{}):null,s=i.options.errorComponent??e.options.defaultErrorComponent,c=i.options.onCatch??e.options.defaultOnCatch,l=i.isRoot?i.options.notFoundComponent??e.options.notFoundRoute?.options.component:i.options.notFoundComponent,u=r.ssr===!1||r.ssr===`data-only`,d=(!i.isRoot||i.options.wrapInSuspense||u)&&(i.options.wrapInSuspense??a??(i.options.errorComponent?.preload||u))?Z.Suspense:$,f=s?ft:$,p=l?ht:$;return(0,Q.jsxs)(i.isRoot?i.options.shellComponent??$:$,{children:[(0,Q.jsx)(ee.Provider,{value:t,children:(0,Q.jsx)(d,{fallback:o,children:(0,Q.jsx)(f,{getResetKey:()=>n,errorComponent:s||mt,onCatch:(e,t)=>{if(h(e))throw e.routeId??=r.routeId,e;c?.(e,t)},children:(0,Q.jsx)(p,{fallback:e=>{if(e.routeId??=r.routeId,!l||e.routeId&&e.routeId!==r.routeId||!e.routeId&&!i.isRoot)throw e;return Z.createElement(l,e)},children:u||r._displayPending?(0,Q.jsx)(b,{fallback:o,children:(0,Q.jsx)(Ct,{matchId:t})}):(0,Q.jsx)(Ct,{matchId:t})})})})}),r.parentRouteId===`__root__`?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(St,{}),(e.options.scrollRestoration,null)]}):null]})}function St(){let e=N(),t=Z.useRef();return oe(()=>{let n=e.stores.resolvedLocation.get(),r=t.current;n&&(!r||r.href!==n.href)&&e.emit({type:`onRendered`,...J(e.stores.location.get(),r??n)}),t.current=n},[o(e.stores.resolvedLocation,e=>e?.state.__TSR_key),e]),null}var Ct=Z.memo(function({matchId:e}){let t=N(),n=(e,n)=>t.getMatch(e.id)?._nonReactive[n]??e._nonReactive[n],r=t.stores.matchStores.get(e);r||d();let a=o(r,e=>e),s=a.routeId,c=t.routesById[s],l=Z.useMemo(()=>{let e=(t.routesById[s].options.remountDeps??t.options.defaultRemountDeps)?.({routeId:s,loaderDeps:a.loaderDeps,params:a._strictParams,search:a._strictSearch});return e?JSON.stringify(e):void 0},[s,a.loaderDeps,a._strictParams,a._strictSearch,t.options.defaultRemountDeps,t.routesById]),u=Z.useMemo(()=>{let e=c.options.component??t.options.defaultComponent;return e?(0,Q.jsx)(e,{},l):(0,Q.jsx)(wt,{})},[l,c.options.component,t.options.defaultComponent]);if(a._displayPending)throw n(a,`displayPendingPromise`);if(a._forcePending)throw n(a,`minPendingPromise`);if(a.status===`pending`){let e=c.options.pendingMinMs??t.options.defaultPendingMinMs;if(e){let n=t.getMatch(a.id);if(n&&!n._nonReactive.minPendingPromise){let t=E();n._nonReactive.minPendingPromise=t,setTimeout(()=>{t.resolve(),n._nonReactive.minPendingPromise=void 0},e)}}throw n(a,`loadPromise`)}if(a.status===`notFound`)return h(a.error)||d(),_t(t,c,a.error);if(a.status===`redirected`)throw i(a.error)||d(),n(a,`loadPromise`);if(a.status===`error`)throw a.error;return u}),wt=Z.memo(function(){let e=N(),t=Z.useContext(ee),n,r=!1,i;{let a=t?e.stores.matchStores.get(t):void 0;[n,r]=o(a,e=>[e?.routeId,e?.globalNotFound??!1],yt),i=o(e.stores.matchesId,e=>e[e.findIndex(e=>e===t)+1])}let a=n?e.routesById[n]:void 0,s=e.options.defaultPendingComponent?(0,Q.jsx)(e.options.defaultPendingComponent,{}):null;if(r)return a||d(),_t(e,a,void 0);if(!i)return null;let c=(0,Q.jsx)(bt,{matchId:i});return n===`__root__`?(0,Q.jsx)(Z.Suspense,{fallback:s,children:c}):c}),Tt=se(`/(home)`)({component:ae(()=>le(()=>import(`./route-Da0uHKH9.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9])),`component`),validateSearch:g(te({}))});export{ft as a,J as c,$ as i,ue as l,bt as n,mt as o,wt as r,it as s,Tt as t,de as u};
@@ -1,2 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/run-wjcPjpA5.js","assets/compiler-runtime-CLAvuQ-D.js","assets/rolldown-runtime-QTnfLwEv.js","assets/fallbacks-DwGmG_0c.js","assets/state-_2CmL5IM.js","assets/-workbench-terminal-nnzNYgEY.js"])))=>i.map(i=>d[i]);
2
- import{Ot as e,nt as t,tt as n,vs as r,wt as i,ys as a,z as o}from"./fallbacks-DwGmG_0c.js";import{t as s}from"./preload-helper-CjdClQve.js";var c=a(`/(home)/$worktree/run`)({component:r(()=>s(()=>import(`./run-wjcPjpA5.js`),__vite__mapDeps([0,1,2,3,4,5])),`component`),validateSearch:e(t({inactive:i(o),sessionId:n}))});export{c as t};
@@ -1,2 +0,0 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{r as t}from"./compiler-runtime-CLAvuQ-D.js";import{$ as n,$a as r,$i as i,$n as a,$o as o,$r as s,$t as c,Ai as l,An as u,Ao as d,At as f,B as p,Ba as m,Bi as h,Bn as ee,Bo as te,Br as ne,Bt as g,Ca as re,Ci as ie,Cn as ae,Co as oe,Cr as se,Ct as ce,Da as le,Di as ue,Dn as _,Do as de,Dt as fe,Ea as pe,Ei as me,En as he,Eo as ge,Er as _e,Et as ve,Fi as ye,Fn as be,Fo as xe,G as Se,Ga as Ce,Gi as we,Gn as Te,Go as Ee,Gr as De,H as Oe,Ha as ke,Hi as Ae,Hn as je,Ho as Me,Hr as Ne,Ht as Pe,Ii as Fe,In as Ie,Io as Le,Ir as Re,J as v,Ja as ze,Ji as Be,Jn as Ve,Jo as He,Jr as Ue,Jt as We,K as Ge,Ki as Ke,Kn as qe,Ko as Je,Kr as Ye,La as Xe,Li as Ze,Ln as Qe,Lo as $e,Lr as et,Mi as tt,Mn as nt,Mo as rt,Mt as it,Na as at,Ni as ot,Nn as st,No as ct,Nt as lt,Oa as ut,Oi as dt,On as ft,Oo as pt,Pi as mt,Pn as ht,Po as gt,Pt as _t,Q as y,Qa as vt,Qi as yt,Qn as bt,Qo as xt,Qr as St,Qt as Ct,R as b,Ra as wt,Ri as Tt,Rn as Et,Ro as Dt,Rr as Ot,Sa as kt,Sn as At,So as jt,Sr as Mt,St as Nt,Ta as Pt,Ti as Ft,Tn as It,To as Lt,Tr as Rt,Tt as zt,U as x,Ua as Bt,Ui as Vt,Un as Ht,Uo as Ut,Ur as Wt,Ut as Gt,V as S,Vi as Kt,Vn as qt,Vo as Jt,Vr as Yt,Vt as Xt,W as Zt,Wa as Qt,Wi as $t,Wn as en,Wo as tn,Wr as nn,Wt as rn,X as an,Xa as on,Xi as sn,Xn as cn,Xo as ln,Xr as un,Xt as dn,Y as fn,Ya as pn,Yi as mn,Yn as hn,Yo as gn,Yr as _n,Yt as vn,Z as yn,Za as bn,Zi as xn,Zn as Sn,Zo as Cn,Zr as wn,Zt as Tn,_a as En,_i as Dn,_n as On,_o as kn,_r as An,_s as jn,aa as Mn,ai as Nn,an as Pn,ao as Fn,ar as In,as as Ln,ba as Rn,bi as zn,bn as Bn,bo as Vn,br as Hn,bt as Un,ca as Wn,ci as Gn,cn as Kn,co as qn,cr as Jn,cs as Yn,ct as Xn,da as Zn,di as Qn,dn as $n,do as er,dr as tr,ds as nr,dt as rr,ea as ir,ei as ar,en as or,er as C,es as sr,et as cr,fa as lr,fi as ur,fn as dr,fo as fr,fr as pr,fs as w,ft as mr,ga as hr,gi as gr,gn as _r,go as vr,gr as yr,gt as br,ha as xr,hi as Sr,hn as Cr,ho as wr,hr as T,ht as Tr,ia as Er,ii as Dr,in as Or,io as kr,ir as Ar,is as jr,it as Mr,ja as Nr,ji as Pr,jn as Fr,jo as Ir,jt as Lr,ka as Rr,ki as zr,kn as Br,ko as Vr,kr as Hr,kt as Ur,la as Wr,li as Gr,ln as Kr,lo as qr,lr as Jr,ls as Yr,lt as E,ma as Xr,mi as Zr,mn as Qr,mo as $r,mr as ei,ms as ti,mt as ni,na as ri,ni as ii,nn as ai,no as oi,nr as si,ns as ci,nt as D,oa as li,oi as ui,on as di,oo as fi,or as pi,os as mi,ot as hi,pa as gi,pi as _i,po as vi,pr as yi,ps as O,pt as bi,q as k,qi as xi,qn as Si,qo as Ci,qr as wi,qt as Ti,ra as Ei,ri as Di,rn as Oi,rr as A,rt as ki,sa as Ai,si as ji,sn as Mi,so as Ni,sr as Pi,st as Fi,ta as Ii,ti as Li,tn as Ri,to as zi,tr as Bi,tt as j,ua as Vi,ui as Hi,un as M,uo as Ui,ur as Wi,us as N,ut as Gi,va as Ki,vi as qi,vn as Ji,vo as Yi,vr as Xi,vt as Zi,wa as Qi,wi as $i,wn as ea,wo as ta,wr as na,wt as P,xa as ra,xi as ia,xn as aa,xo as oa,xr as sa,xt as ca,ya as F,yn as la,yo as ua,yr as da,yt as fa,z as pa,za as ma,zi as ha,zn as ga,zo as _a,zr as va,zt as ya}from"./fallbacks-DwGmG_0c.js";var ba=Vt,xa=$t,Sa=Kt,Ca=Ae,wa=Be,Ta=we,Ea=sn,Da=Symbol.for(`effect/MutableList/Empty`),Oa=()=>({head:void 0,tail:void 0,length:0}),ka=()=>({array:[],mutable:!0,offset:0,next:void 0}),Aa=(e,t)=>{e.tail?e.tail.mutable||(e.tail.next=ka(),e.tail=e.tail.next):e.head=e.tail=ka(),e.tail.array.push(t),e.length++},ja=(e,t)=>Ma(e,ke(t),!Array.isArray(t)),Ma=(e,t,n=!1)=>{if(t.length===0)return 0;let r={array:t,mutable:n,offset:0,next:void 0};return e.head?e.tail=e.tail.next=r:e.head=e.tail=r,e.length+=t.length,t.length},Na=e=>{e.head=e.tail=void 0,e.length=0},Pa=(e,t)=>{if(t<=0||!e.head)return[];if(t=Math.min(t,e.length),t===e.length&&e.head?.offset===0&&!e.head.next){let t=e.head.array;return Na(e),t}let n=Array(t),r=0,i=e.head;for(;i;){for(;i.offset<i.array.length;)if(n[r++]=i.array[i.offset],i.mutable&&(i.array[i.offset]=void 0),i.offset++,r===t)return e.head=i,e.length-=t,e.length===0&&Na(e),n;i=i.next}return Na(e),n},Fa=e=>Pa(e,e.length),Ia=e=>{if(!e.head)return Da;let t=e.head.array[e.head.offset];return e.head.mutable&&(e.head.array[e.head.offset]=void 0),e.head.offset++,e.length--,e.head.offset===e.head.array.length&&(e.head.next?e.head=e.head.next:Na(e)),t},La=(e,t)=>{let n=[],r=e.head;for(;r;){for(let e=r.offset;e<r.array.length;e++)t(r.array[e],e)&&n.push(r.array[e]);r=r.next}e.head=e.tail={array:n,mutable:!0,offset:0,next:void 0},e.length=n.length},Ra=(e,t)=>La(e,e=>e!==t),za=`~effect/MutableRef`,Ba={[za]:za,...de,toJSON(){return{_id:`MutableRef`,current:$e(this.current)}}},Va=e=>{let t=Object.create(Ba);return t.current=e,t},Ha=N(2,(e,t)=>(e.current=t,e)),Ua=`~effect/PubSub/Subscription`,Wa=N(2,(e,t)=>e.shutdownFlag.current?!1:e.pubsub.publish(t)?(e.strategy.completeSubscribersUnsafe(e.pubsub,e.subscribers),!0):!1),Ga=e=>tr(Pn(t=>{let n=kt(t,_n),r=s(e.scope),i=Ya(e.pubsub,e.subscribers,e.strategy);return un(r,Ka(i)).pipe(vn(wn(n,e=>St(r,e))),Tn(i))})),Ka=e=>tr(Xi(t=>(Ha(e.shutdownFlag,!0),Cr(Fa(e.pollers),e=>ui(e,t.id),{discard:!0,concurrency:`unbounded`}).pipe(Ar(()=>A(()=>{e.subscribers.delete(e.subscription),e.subscription.unsubscribe(),e.strategy.onPubSubEmptySpaceUnsafe(e.pubsub,e.subscribers)})),yr(e.shutdownHook.open),Ct)))),qa=e=>si(function t(n){if(e.shutdownFlag.current)return At;let r=e.pollers.length===0?e.subscription.pollUpTo(1/0):[];return n&&(r=n.concat(r)),e.strategy.onPubSubEmptySpaceUnsafe(e.pubsub,e.subscribers),e.replayWindow.remaining>0?C(e.replayWindow.takeAll().concat(r)):Bt(r)?C(r):M(Ja(e),e=>t([e]))}),Ja=e=>{let t=Gn(),n=e.subscribers.get(e.subscription);return n||(n=new Set,e.subscribers.set(e.subscription,n)),n.add(e.pollers),Aa(e.pollers,t),e.strategy.completePollersUnsafe(e.pubsub,e.subscribers,e.subscription,e.pollers),be(Dr(t),()=>(Ra(e.pollers,t),T))},Ya=(e,t,n)=>new Xa(e,t,e.subscribe(),Oa(),Ea(!1),Va(!1),n,e.replayWindow()),Xa=class{[Ua]={_A:w};pubsub;subscribers;subscription;pollers;shutdownHook;shutdownFlag;strategy;replayWindow;constructor(e,t,n,r,i,a,o,s){this.pubsub=e,this.subscribers=t,this.subscription=n,this.pollers=r,this.shutdownHook=i,this.shutdownFlag=a,this.strategy=o,this.replayWindow=s}pipe(){return ti(this,arguments)}},Za=`~effect/Queue`,Qa=`~effect/Queue/Enqueue`,$a=`~effect/Queue/Dequeue`,eo={_A:w,_E:w},to={[Za]:eo,[Qa]:eo,[$a]:eo,...de,toJSON(){return{_id:`effect/Queue`,state:this.state._tag,size:_o(this)}}},no=e=>ct(t=>{let n=Object.create(to);return n.dispatcher=t.currentDispatcher,n.capacity=e?.capacity??1/0,n.strategy=e?.strategy??`suspend`,n.messages=Oa(),n.scheduleRunning=!1,n.state={_tag:`Open`,takers:new Set,offers:new Set,awaiters:new Set},yt(n)}),ro=e=>no({capacity:e}),io=(e,t)=>ir(()=>{if(e.state._tag!==`Open`)return vo;if(e.messages.length>=e.capacity)switch(e.strategy){case`dropping`:return vo;case`suspend`:return e.capacity<=0&&e.state.takers.size>0?(Aa(e.messages,t),So(e),yo):To(e,t);case`sliding`:return Ia(e.messages),Aa(e.messages,t),yo}return Aa(e.messages,t),Co(e),yo}),ao=(e,t)=>e.state._tag===`Open`?e.messages.length>=e.capacity?e.strategy===`sliding`?(Ia(e.messages),Aa(e.messages,t),!0):e.capacity<=0&&e.state.takers.size>0?(Aa(e.messages,t),So(e),!0):!1:(Aa(e.messages,t),Co(e),!0):!1,oo=(e,t)=>ir(()=>{if(e.state._tag!==`Open`)return yt(ke(t));let n=so(e,t);return n.length===0?Ir([]):e.strategy===`dropping`?yt(n):Eo(e,n)}),so=(e,t)=>{if(e.state._tag!==`Open`)return ke(t);if(e.capacity===1/0||e.strategy===`sliding`)return ja(e.messages,t),e.strategy===`sliding`&&Pa(e.messages,e.messages.length-e.capacity),Co(e),[];let n=e.capacity<=0?e.state.takers.size:e.capacity-e.messages.length;if(n===0)return ke(t);let r=[],i=0;for(let a of t)i<n?Aa(e.messages,a):r.push(a),i++;return Co(e),r},co=N(2,(e,t)=>Ii(()=>lo(e,t))),lo=(e,t)=>{if(e.state._tag!==`Open`)return!1;let n=h(d(t),bo);return e.state.offers.size===0&&e.messages.length===0?(ko(e,n),!0):(e.state={...e.state,_tag:`Closing`,exit:n},!0)},uo=e=>co(e,pt(ge())),fo=e=>Ii(()=>{if(e.state._tag===`Done`)return!0;Na(e.messages);let t=e.state.offers;if(ko(e,e.state._tag===`Open`?xo:e.state.exit),t.size>0){for(let e of t)e._tag===`Single`?e.resume(vo):e.resume(Ir(e.remaining.slice(e.offset)));t.clear()}return!0}),po=e=>mo(e,1,1/0),mo=(e,t,n)=>ir(()=>wo(e,t,n)??ye(Oo(e),mo(e,1,n))),ho=e=>ir(()=>go(e)??ye(Oo(e),ho(e))),go=e=>{if(e.state._tag===`Done`)return e.state.exit;if(e.messages.length>0){let t=Ia(e.messages);return Do(e),Ir(t)}else if(e.capacity<=0&&e.state.offers.size>0){e.capacity=1,Do(e),e.capacity=0;let t=Ia(e.messages);return Do(e),Ir(t)}},_o=e=>e.state._tag===`Done`?0:e.messages.length,vo=Ir(!1),yo=Ir(!0),bo=Vr(ge()),xo=Tt(),So=e=>{if(e.scheduleRunning=!1,!(e.state._tag===`Done`||e.state.takers.size===0)){for(let t of e.state.takers)if(e.state.takers.delete(t),t(ha),e.messages.length===0)break}},Co=e=>{e.scheduleRunning||e.state._tag===`Done`||e.state.takers.size===0||(e.scheduleRunning=!0,e.dispatcher.scheduleTask(()=>So(e),0))},wo=(e,t,n)=>{if(e.state._tag===`Done`)return e.state.exit;if(n<=0||t<=0)return Ir([]);if(e.capacity<=0&&e.state.offers.size>0){e.capacity=1,Do(e),e.capacity=0;let t=[Ia(e.messages)];return Do(e),Ir(t)}if(t=Math.min(t,e.capacity||1),t<=e.messages.length){let t=Pa(e.messages,n);return Do(e),Ir(t)}},To=(e,t)=>Ze(n=>{if(e.state._tag!==`Open`)return n(vo);let r={_tag:`Single`,message:t,resume:n};return e.state.offers.add(r),Ii(()=>{e.state._tag===`Open`&&e.state.offers.delete(r)})}),Eo=(e,t)=>Ze(n=>{if(e.state._tag!==`Open`)return n(Ir(t));let r={_tag:`Array`,remaining:t,offset:0,resume:n};return e.state.offers.add(r),Ii(()=>{e.state._tag===`Open`&&e.state.offers.delete(r)})}),Do=e=>{if(e.state._tag===`Done`)return _e(e.state.exit.cause);if(e.state.offers.size===0)return e.state._tag===`Closing`&&e.messages.length===0?(ko(e,e.state.exit),_e(e.state.exit.cause)):!1;let t=e.capacity-e.messages.length;for(let n of e.state.offers)if(t===0)break;else if(n._tag===`Single`)Aa(e.messages,n.message),t--,n.resume(yo),e.state.offers.delete(n);else{for(;n.offset<n.remaining.length;n.offset++){if(t===0)return!1;Aa(e.messages,n.remaining[n.offset]),t--}n.resume(Ir([])),e.state.offers.delete(n)}return!1},Oo=e=>Ze(t=>e.state._tag===`Done`?t(e.state.exit):(e.state.takers.add(t),Ii(()=>{e.state._tag!==`Done`&&e.state.takers.delete(t)}))),ko=(e,t)=>{if(e.state._tag===`Done`)return;let n=e.state;e.state={_tag:`Done`,exit:t};for(let e of n.takers)e(t);n.takers.clear();for(let e of n.awaiters)e(t);n.awaiters.clear()},Ao=e=>new jo(e),jo=class{waiters=new Set;taken=0;permits;constructor(e){this.permits=e}get free(){return this.permits-this.taken}take(e){let t=ir(()=>this.free<e?Ze(n=>{if(this.free>=e)return n(t);let r=()=>{this.free<e||(this.waiters.delete(r),n(t))};return this.waiters.add(r),Ii(()=>{this.waiters.delete(r)})}):(this.taken+=e,yt(e)));return t}updateTakenUnsafe(e,t){return this.taken=t(this.taken),this.waiters.size>0&&e.currentDispatcher.scheduleTask(()=>{let e=this.waiters.values(),t=e.next();for(;t.done===!1&&this.free>0;)t.value(),t=e.next()},0),this.free}updateTaken(e){return ct(t=>yt(this.updateTakenUnsafe(t,e)))}resize(e){return ct(t=>(this.permits=e,this.free<0||this.updateTakenUnsafe(t,e=>e),Ei))}release(e){return this.updateTaken(t=>t-e)}get releaseAll(){return this.updateTaken(e=>0)}withPermits(e){return t=>ri(n=>Ke(n(this.take(e)),e=>xn(n(t),()=>{this.updateTakenUnsafe(Be(),t=>t-e)},!0)))}withPermit=this.withPermits(1);withPermitsIfAvailable(e){return t=>ri(n=>this.free<e?i:(this.taken+=e,xn(n(Fe(t)),()=>{this.updateTakenUnsafe(Be(),t=>t-e)},!0)))}},Mo=`~effect/Channel`,No=e=>o(e,Mo),Po={[Mo]:{_Env:w,_InErr:w,_InElem:w,_OutErr:w,_OutElem:w},pipe(){return ti(this,arguments)}},Fo=e=>{let t=Object.create(Po);return t.transform=(t,n)=>Ri(e(t,n),e=>C(Kr(e))),t},Io=(e,t)=>Fo((n,r)=>M(zo(e)(n,r),e=>t(e,r))),Lo=e=>Fo((t,n)=>e),Ro=e=>Fo(Qr(function*(t,n){let r=s(n),i=e=>St(r,Rt(e));return st(yield*st(e(t,n,r),i),i)})),zo=e=>e.transform,Bo=(e,t,n)=>no({capacity:n?.bufferSize,strategy:n?.strategy}).pipe(Ar(t=>un(e,fo(t))),Ar(n=>Ji(Li(t(n),e),e))),Vo=(e,t)=>Fo((n,r)=>_(Bo(r,e,t),po)),Ho=e=>Fo((t,n)=>si(()=>zo(e())(t,n))),Uo=Lo(C(ie())),Wo=e=>Lo(C(Kn(e))),Go=e=>Lo(C(po(e))),Ko=e=>Lo(C(be(qa(e),()=>ie()))),qo=e=>ts(_(Ga(e),Ko)),Jo=N(2,(e,t)=>Io(e,e=>A(()=>{let n=0;return _(e,e=>t(e,n++))}))),Yo=e=>e===void 0||e!==`unbounded`&&e<=1,Xo=N(e=>No(e[0]),(e,t,n)=>Yo(n?.concurrency)?Zo(e,t):Qo(e,t,n)),Zo=(e,t)=>Fo((n,r)=>{let i=0;return _(zo(e)(n,r),M(e=>t(e,i++)))}),Qo=(e,t,n)=>Ro(Qr(function*(r,i,a){let o=0,s=yield*zo(e)(r,i),c=n.concurrency===`unbounded`?2**53-1:n.concurrency,l=yield*ro(0);yield*un(a,fo(l));let u=Te(yield*Or()),d=Ta(a);if(n.unordered){let e=Ao(c),n=Yr(e.release(1)),r=Fr({onFailure:e=>M(co(l,e),n),onSuccess:e=>M(io(l,e),n)});yield*e.take(1).pipe(M(()=>s),M(e=>(d(u(r(t(e,o++)))),T)),_r({disableYield:!0}),Ri(t=>e.withPermits(c-1)(co(l,t))),Ji(a))}else{let e=yield*ro(c-2);yield*un(a,fo(l)),yield*ho(e).pipe(dr,M(e=>io(l,e)),_r({disableYield:!0}),Ri(e=>co(l,e)),Ji(a));let n,r=e=>{e._tag!==`Success`&&(n=e.cause,lo(l,e.cause))};yield*s.pipe(M(i=>{if(n)return Kr(n);let a=u(t(i,o++));return d(a),a.addObserver(r),io(e,ba(a))}),_r({disableYield:!0}),Ri(t=>io(e,Qn(t)).pipe(vn(co(e,t)))),Ji(a))}return ho(l)})),$o=e=>Io(e,e=>{let t,n=0;return C(si(function r(){if(t===void 0)return M(e,e=>{switch(e.length){case 0:return r();case 1:return C(e[0]);default:return t=e,C(e[n++])}});let i=t[n++];return n>=t.length&&(t=void 0,n=0),C(i)}))}),es=N(2,(e,t)=>Io(e,e=>C(M(e,function n(r){let i=[];for(let e=0;e<r.length;e++)t(r[e])&&i.push(r[e]);return Ce(i)?C(i):M(e,n)})))),ts=e=>Fo((t,n)=>{let r;return C(si(()=>r||e.pipe(Li(n),M(e=>zo(e)(t,n)),M(e=>r=e))))}),ns=N(2,(e,t)=>Ro((n,r,i)=>wn(i,t).pipe(vn(zo(e)(n,r))))),rs=N(2,(e,t)=>ns(e,e=>t)),is=(e,t,n)=>si(()=>{let r=ar();return na(M(zo(e)(ie(),r),t),n||C).pipe(ht(e=>St(r,e)))}),as=N(2,(e,t)=>Fo((n,r)=>_(ga(zo(e)(n,r),t),ga(t)))),os=N(2,(e,t)=>is(e,e=>_r(M(e,t),{disableYield:!0}))),ss=Qr(function*(e){let t=Ao(1),n=yield*Or(),r=kt(n,_n);return(yield*zo(e)(ie(),r)).pipe(ga(n),t.withPermits(1))},Ri(e=>C(Kr(e)))),cs=(e,t)=>zo(e)(ie(),t),ls=`~effect/Stream`,us={_R:w,_E:w,_A:w},ds={[ls]:us,pipe(){return ti(this,arguments)}},fs=e=>{let t=Object.create(ds);return t.channel=e,t},ps=`~effect/collections/MutableHashMap`,ms={[ps]:ps,[Symbol.iterator](){return this.backing[Symbol.iterator]()},toString(){return`MutableHashMap(${_a(Array.from(this))})`},toJSON(){return{_id:`MutableHashMap`,values:$e(Array.from(this))}},[Le](){return this.toJSON()},pipe(){return ti(this,arguments)}},hs=()=>{let e=Object.create(ms);return e.backing=new Map,e.buckets=new Map,e},gs=N(2,(e,t)=>{if(e.backing.has(t))return ta(e.backing.get(t));if(vs(t))return jt();let n=_s.get(e);if(n!==void 0)return e.backing.has(n)?ta(e.backing.get(n)):jt();let r=gn(t),i=e.buckets.get(r);return i===void 0?jt():ys(e,i,t)}),_s=new WeakMap,vs=e=>typeof e!=`object`&&typeof e!=`function`,ys=(e,t,n)=>{for(let r=0,i=t.length;r<i;r++)if(Ee(n,t[r])){let i=t[r];return _s.set(n,i),ta(e.backing.get(i))}return jt()},bs=N(3,(e,t,n)=>{if(e.backing.has(t)||vs(t))return e.backing.set(t,n),e;let r=_s.get(e);if(r!==void 0&&e.backing.has(r))return e.backing.set(r,n),e;let i=gn(t),a=e.buckets.get(i);return a===void 0?(e.buckets.set(i,[t]),e.backing.set(t,n),e):(r=xs(a,t),r===void 0&&(a.push(t),r=t),e.backing.set(r,n),e)}),xs=(e,t)=>{for(let n=0,r=e.length;n<r;n++)if(Ee(t,e[n]))return _s.set(t,e[n]),e[n]},Ss=N(2,(e,t)=>{if(vs(t))return e.backing.delete(t),e;let n=_s.get(e)??t,r=gn(n),i=e.buckets.get(r);if(i===void 0)return e;for(let t=0,r=i.length;t<r;t++){let r=i[t];if(r===n||Ee(n,r)){e.backing.delete(r),i.splice(t,1);break}}return i.length===0&&e.buckets.delete(r),e}),Cs=`~effect/Stream`,ws=e=>o(e,Cs),Ts=fs,Es=e=>e.channel,Ds=(e,t)=>Ts(Vo(e,t)),Os=Ts(Uo),ks=e=>Ts(Ho(()=>e().channel)),As=e=>Ts(Wo(e)),js=e=>Ts(Go(e)),Ms=e=>Ts(qo(e)),Ns=e=>Ts(Fo(Qr(function*(t,n){let r=e.evaluate().getReader();return yield*un(n,e.releaseLockOnEnd?A(()=>r.releaseLock()):Qe(()=>r.cancel())),M(Jr({try:()=>r.read(),catch:t=>e.onError(t)}),({done:e,value:t})=>e?ie():C(vt(t)))}))),Ps=e=>Ts(ts(_(e,Es))),Fs=N(e=>ws(e[0]),(e,t,n)=>e.channel.pipe($o,Xo(t,n),Jo(vt),Ts)),Is=N(2,(e,t)=>Ts(es(Es(e),t))),Ls=N(2,(e,t)=>Ts(rs(e.channel,t))),Rs=N(2,(e,t)=>Ts(as(e.channel,t))),zs=N(2,(e,t)=>os(e.channel,t)),Bs=e=>ss(e.channel),Vs=N(e=>ws(e[0]),(e,t,n)=>{let r,i,a=Ea(!1);return new ReadableStream({start(n){i=en(ga(zs(e,e=>a.whenOpen(A(()=>{a.closeUnsafe();for(let t=0;t<e.length;t++)n.enqueue(e[t]);r(),r=void 0}))),t)),i.addObserver(e=>{e._tag===`Failure`?n.error(ot(e.cause)):n.close()})},pull(){return new Promise(e=>{r=e,a.openUnsafe()})},cancel(){if(i)return qe(Ct(Sa(i)))}},n?.strategy)}),Hs=N(e=>ws(e[0]),(e,t)=>_(Or(),n=>Vs(e,n,t))),Us=e(t(),1),Ws=e(jn(),1);function Gs(e){return{_tag:`Value`,value:e}}function Ks(e,t){return{_tag:`Record`,keys:e,value:t}}function qs(e,t){return{_tag:`Array`,length:e,value:t}}zn(`SourceError`);var Js=Ki(`effect/ConfigProvider`,{defaultValue:()=>tc()}),Ys={...de,toJSON(){return{_id:`ConfigProvider`}}};function Xs(e,t,n){let r=Object.create(Ys);return r.get=e,r.mapInput=t,r.prefix=n,r.load=r=>(t&&(r=t(r)),n&&(r=[...n,...r]),e(r)),r}var Zs=e=>ea(e)?Ot(Js)(e):wi(Js)(e);function Qs(e){return Xs(t=>C($s(e,t)))}function $s(e,t){let n=e;for(let e of t){if(n==null)return;if(Array.isArray(n)){if(typeof e!=`number`||!Number.isInteger(e)||e<0||e>=n.length)return;n=n[e];continue}if(ci(n)){if(typeof e!=`string`||!Object.hasOwn(n,e))return;n=n[e];continue}return}return ec(n)}function ec(e){if(e!=null)return typeof e==`string`?Gs(e):typeof e==`number`||typeof e==`boolean`||typeof e==`bigint`?Gs(String(e)):Array.isArray(e)?qs(e.length):ci(e)?Ks(new Set(Object.keys(e))):Gs(_a(e))}function tc(e){let t=e?.env??{BASE_URL:`/`,DEV:!1,MODE:`production`,PROD:!0,SSR:!1,TSS_INLINE_CSS_ENABLED:`false`},n=nc(t);return Xs(e=>C(ic(n,t,e)))}function nc(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 rc=/^(0|[1-9][0-9]*)$/;function ic(e,t,n){let r=t[n.map(String).join(`_`)],i=ac(e,n),a=i?.children?Object.keys(i.children):[];return a.length===0?r===void 0?void 0:Gs(r):a.every(e=>rc.test(e))?qs(Math.max(...a.map(e=>parseInt(e,10)))+1,r):Ks(new Set(a),r)}function ac(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 oc=`~effect/Config`,sc=class{_tag=`ConfigError`;name=`ConfigError`;cause;constructor(e){this.cause=e}get message(){return this.cause.toString()}toString(){return`ConfigError(${this.message})`}},cc={...ut({label:`Config`,evaluate(e){return this.parse(e.getRef(Js))}}),[oc]:oc,toJSON(){return{_id:`Config`}}};function lc(e){let t=Object.create(cc);return t.parse=e,t}var uc=N(2,(e,t)=>lc(n=>_(e.parse(n),t))),dc=N(2,(e,t)=>lc(n=>Oi(e.parse(n),e=>t(e).parse(n))));function fc(e){switch(e._tag){case`MissingKey`:return!0;case`InvalidType`:case`InvalidValue`:return Yi(e.actual)||ua(e.actual)&&e.actual.value===void 0;case`OneOf`:return e.actual===void 0;case`Encoding`:return Yi(e.actual)||ua(e.actual)&&e.actual.value===void 0?!0:fc(e.issue);case`Pointer`:case`Filter`:return fc(e.issue);case`UnexpectedKey`:return!1;case`Forbidden`:return!1;case`Composite`:case`AnyOf`:return e.issues.every(fc)}}var pc=N(2,(e,t)=>dc(e,e=>{if(ca(e.cause)){let n=e.cause.issue;if(fc(n))return yc(t)}return vc(e.cause)})),mc=e=>e.pipe(uc(ta),pc(jt())),hc=Qr(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*hc(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*hc(e,[...t,i]));return r}}}),gc=Qr(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*gc(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=lt(a.parameter);for(let o of i.keys)if(!Object.hasOwn(r,o)&&e(o)){let e=yield*gc(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*gc(e.elements[r],t,[...n,r]));return i}case`Union`:return yield*hc(t,n);case`Suspend`:return yield*gc(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 _c(e,t){let n=fe(e),r=_t(n),i=ya(n.ast),a=typeof t==`string`?[t]:t??[];return lc(e=>{let t=e.prefix?[...e.prefix,...a]:a;return gc(i,e,a).pipe($n(e=>r(e).pipe(u(e=>new it(t.length>0?new Gt(t,e):e)))),u(e=>new sc(e)))})}function vc(e){return lc(()=>Kn(new sc(e)))}function yc(e){return lc(()=>C(e))}function bc(e){return _c(j,e)}var xc=`~effect/SubscriptionRef`,Sc=e=>o(e,xc);({...de});var Cc=e=>Ms(e.pubsub),wc=e=>A(()=>e.value),Tc=(e,t)=>{e.value=t,Wa(e.pubsub,t)},Ec=N(2,(e,t)=>e.semaphore.withPermit(A(()=>Tc(e,t)))),Dc=class extends F()(`effect/reactivity/Reactivity`){},Oc=A(()=>{let e=new Map,t=t=>{Pc(t,t=>{let n=e.get(t);n!==void 0&&n.forEach(e=>e())})},n=e=>Pn(n=>{let r=n.mapUnsafe.get(kc.key);return r?Pc(e,e=>{r.add(e)}):t(e),T}),r=(e,t)=>Ar(t,n(e)),i=(t,n)=>{let r=[];return Pc(t,t=>{r.push(t);let i=e.get(t);i===void 0&&(i=new Set,e.set(t,i)),i.add(n)}),()=>{for(let t=0;t<r.length;t++){let i=e.get(r[t]);i.delete(n),i.size===0&&e.delete(r[t])}}},a=(e,t)=>Bn(function*(){let n=yield*Or(),r=kt(n,_n),a=yield*no(),o=nr(Te(n),Ta(r)),s=!1,c=!1,l=e=>{e._tag===`Failure`?lo(a,e.cause):ao(a,e.value),c?(c=!1,o(t).addObserver(l)):s=!1};function u(){if(s){c=!0;return}s=!0,o(t).addObserver(l)}return yield*un(r,A(i(e,u))),u(),a});return Dc.of({mutation:r,query:a,stream:(e,t)=>a(e,t).pipe(_(js),Ps),invalidateUnsafe:t,invalidate:n,registerUnsafe:i,withBatch:t=>si(()=>{let n=new Set;return t.pipe(ee(kc,n),ht(t=>A(()=>{n.forEach(t=>{let n=e.get(t);n!==void 0&&n.forEach(e=>e())})})))})})}),kc=class extends F()(`effect/reactivity/Reactivity/PendingInvalidation`){},Ac=N(2,(e,t)=>Dc.use(n=>n.mutation(t,e))),jc=e=>Dc.use(t=>t.invalidate(e)),Mc=Ot(Dc)(Oc);function Nc(e){switch(typeof e){case`string`:case`number`:case`bigint`:case`boolean`:return String(e);default:return gn(e)}}var Pc=(e,t)=>{if(Array.isArray(e)){for(let n=0;n<e.length;n++)t(Nc(e[n]));return}for(let n in e){t(n);let r=e[n];for(let e=0;e<r.length;e++)t(`${n}:${Nc(r[e])}`)}},Fc=`~effect/reactivity/AsyncResult`,Ic=e=>o(e,Fc),Lc={[Fc]:{E:w,A:w},pipe(){return ti(this,arguments)},[Je](e){if(this._tag!==e._tag||this.waiting!==e.waiting)return!1;switch(this._tag){case`Initial`:return!0;case`Success`:return Ee(this.value,e.value);case`Failure`:return Ee(this.cause,e.cause)}},[xt](){let e=ln(`${this._tag}:${this.waiting}`);return this._tag===`Initial`?e:He(e)(this._tag===`Success`?gn(this.value):gn(this.cause))}},Rc=(e,t)=>e._tag===`Success`?Wc(e.value):qc(e.cause,{previous:t}),zc=e=>e._tag===`None`?Hc(!0):Yc(e.value),Bc=e=>e._tag===`Initial`,Vc=e=>e._tag!==`Initial`,Hc=(e=!1)=>{let t=Object.create(Lc);return t._tag=`Initial`,t.waiting=e,t},Uc=e=>e._tag===`Success`,Wc=(e,t)=>{let n=Object.create(Lc);return n._tag=`Success`,n.value=e,n.waiting=t?.waiting??!1,n.timestamp=t?.timestamp??Date.now(),n},Gc=e=>e._tag===`Failure`,Kc=(e,t)=>{let n=Object.create(Lc);return n._tag=`Failure`,n.cause=e,n.previousSuccess=t?.previousSuccess??jt(),n.waiting=t?.waiting??!1,n},qc=(e,t)=>Kc(e,{previousSuccess:fr(t.previous,e=>Uc(e)?ta(e):Gc(e)?e.previousSuccess:jt()),waiting:t.waiting}),Jc=(e,t)=>qc($i(e),t),Yc=(e,t)=>{if(e.waiting)return t?.touch?Xc(e):e;let n=Object.assign(Object.create(Lc),e);return n.waiting=!0,t?.touch&&Uc(n)&&(n.timestamp=Date.now()),n},Xc=e=>Uc(e)?Wc(e.value,{waiting:e.waiting}):e,Zc=(e,t)=>e._tag===`Failure`?qc(e.cause,{previous:t,waiting:e.waiting}):e,Qc=e=>e._tag===`Success`?ta(e.value):e._tag===`Failure`?Vn(e.previousSuccess,e=>e.value):jt(),$c=e=>vr(Qc(e),()=>new ia(`AsyncResult.getOrThrow: no value found`)),el=e=>{switch(e._tag){case`Success`:return gr(e.value);case`Failure`:return Qn(e.cause);default:return Hi(new ia)}},tl=N(2,(e,t)=>{switch(e._tag){case`Initial`:return e;case`Failure`:return Kc(e.cause,{previousSuccess:Vn(e.previousSuccess,e=>Wc(t(e.value),e)),waiting:e.waiting});case`Success`:return Wc(t(e.value),e)}}),nl=e=>{let t=e.success??fn,r=e.error??fn,i=bi()([t,p(r,x)],([e,t])=>(n,r,i)=>{if(!Ic(n))return Kn(new Pe(r,ta(n)));switch(n._tag){case`Initial`:return C(n);case`Success`:return ft(_t(e)(n.value,i),{onSuccess:e=>Wc(e,n),onFailure:e=>new Xt(r,ta(n),[new Gt([`value`],e)])});case`Failure`:{let a=n.previousSuccess.pipe(Vn(t=>ft(_t(e)(t.value,i),{onSuccess:e=>ta(Wc(e,t)),onFailure:e=>new Xt(r,ta(n),[new Gt([`previousSuccess`,`value`],e)])})),wr(()=>Bi)),o=u(_t(t)(n.cause,i),e=>new Xt(r,ta(n),[new Gt([`cause`],e)]));return $n(a,e=>Br(o,t=>Kc(t,{previousSuccess:e,waiting:n.waiting})))}}},{expected:`AsyncResult`,toCodec([e,t]){let r=Mr(`Success`,{value:e,waiting:pa,timestamp:y});return Nt()(E([Mr(`Initial`,{waiting:pa}),r,Mr(`Failure`,{cause:t,previousSuccess:n(r),waiting:pa})]),g({decode:e=>{switch(e._tag){case`Initial`:return Hc(e.waiting);case`Success`:return Wc(e.value,{waiting:e.waiting,timestamp:e.timestamp});case`Failure`:return Kc(e.cause,{previousSuccess:Vn(e.previousSuccess,e=>Wc(e.value,e)),waiting:e.waiting})}},encode(e){switch(e._tag){case`Initial`:return{_tag:`Initial`,waiting:e.waiting};case`Success`:return{_tag:`Success`,value:e.value,waiting:e.waiting,timestamp:e.timestamp};case`Failure`:return{_tag:`Failure`,cause:e.cause,previousSuccess:e.previousSuccess,waiting:e.waiting}}}}))},toEquivalence:tn,toFormatter:([e,t])=>n=>{switch(n._tag){case`Success`:return`AsyncResult.Success(${e(n.value)}, ${n.waiting}, ${n.timestamp})`;case`Failure`:return`AsyncResult.Failure(${t(n.cause)}, ${n.waiting})`;case`Initial`:return`AsyncResult.Initial(${n.waiting}, ${n.waiting})`}}});return Object.assign(i,{success:t,error:r})},rl=`~effect/reactivity/AtomRegistry`,il=e=>o(e,rl),al=e=>new fl(e?.initialValues,e?.scheduleTask,e?.timeoutResolution,e?.defaultIdleTTL),ol=F(rl),sl=N(e=>il(e[0]),(e,t,n)=>{let r=n?.suspendOnWaiting??!1;return or(n=>{let i=e.get(t);if(i._tag!==`Initial`&&!(r&&i.waiting))return n(el(i));let a=e.subscribe(t,e=>{e._tag!==`Initial`&&!(r&&e.waiting)&&(n(el(e)),a())});return A(a)})}),cl={immediate:!0},ll=e=>{e()},ul=`~effect-atom/atom/Atom/Serializable`,dl=e=>ul in e?e[ul].key:e,fl=class{[rl];timeoutResolution;defaultIdleTTL;scheduler;schedulerAsync;dispatcher;onNodeAdded;onNodeRemoved;constructor(e,t,n,r){if(this[rl]=rl,this.scheduler=new Wr(`sync`,t),this.schedulerAsync=new Wr(`async`,t),this.dispatcher=this.schedulerAsync.makeDispatcher(),this.defaultIdleTTL=r,n===void 0&&r!==void 0?this.timeoutResolution=Math.round(r/2):this.timeoutResolution=n??1e3,e!==void 0)for(let[t,n]of e){let e=t;for(;e.initialValueTarget;)e=e.initialValueTarget;this.ensureNode(e).setInitialValue(n)}}nodes=new Map;preloadedSerializable=new Map;timeoutBuckets=new Map;nodeTimeoutBucket=new Map;disposed=!1;getNodes(){return this.nodes}get(e){return this.ensureNode(e).value()}set(e,t){e.write(this.ensureNode(e).writeContext,t)}setSerializable(e,t){this.preloadedSerializable.set(e,t)}modify(e,t){let n=this.ensureNode(e),r=t(n.value());return e.write(n.writeContext,r[1]),r[0]}update(e,t){let n=this.ensureNode(e);e.write(n.writeContext,t(n.value()))}refresh=e=>{e.refresh===void 0?this.invalidateAtom(e):e.refresh(this.refresh)};subscribe(e,t,n){let r=this.ensureNode(e);n?.immediate&&t(r.value());let i=r.subscribe(function(){t(r._value)});return()=>{i(),r.canBeRemoved&&this.scheduleNodeRemoval(r)}}mount(e){return this.subscribe(e,Yn,cl)}atomHasTtl(e){return!e.keepAlive&&e.idleTTL!==0&&(e.idleTTL!==void 0||this.defaultIdleTTL!==void 0)}ensureNode(e){let t=dl(e),n=this.nodes.get(t);if(n===void 0?(n=this.createNode(e),this.nodes.set(t,n),this.onNodeAdded?.(n)):this.atomHasTtl(e)&&this.removeNodeTimeout(n),typeof t==`string`&&this.preloadedSerializable.has(t)){let r=this.preloadedSerializable.get(t);this.preloadedSerializable.delete(t);let i=e[ul].decode(r);n.setValue(i)}return n}createNode(e){if(this.disposed)throw Error(`Cannot access Atom ${e}: registry is disposed`);return e.keepAlive||this.scheduleAtomRemoval(e),new hl(this,e)}invalidateAtom=e=>{this.ensureNode(e).invalidate()};scheduleAtomRemoval(e){this.dispatcher.scheduleTask(()=>{let t=this.nodes.get(dl(e));t!==void 0&&t.canBeRemoved&&this.removeNode(t)},0)}scheduleNodeRemoval(e){this.dispatcher.scheduleTask(()=>{e.canBeRemoved&&this.removeNode(e)},0)}removeNode(e){this.atomHasTtl(e.atom)?this.setNodeTimeout(e):(this.nodes.delete(dl(e.atom)),e.remove(),this.onNodeRemoved?.(e))}setNodeTimeout(e){if(this.nodeTimeoutBucket.has(e))return;let t=e.atom.idleTTL??this.defaultIdleTTL;if(this.#e!==null&&(t-=this.#e,t<=0)){this.nodes.delete(dl(e.atom)),e.remove(),this.onNodeRemoved?.(e);return}let n=Math.ceil(t/this.timeoutResolution)*this.timeoutResolution,r=Date.now()+n,i=r-r%this.timeoutResolution+this.timeoutResolution,a=this.timeoutBuckets.get(i);a===void 0&&(a=[new Set,setTimeout(()=>this.sweepBucket(i),i-Date.now())],this.timeoutBuckets.set(i,a)),a[0].add(e),this.nodeTimeoutBucket.set(e,i)}removeNodeTimeout(e){let t=this.nodeTimeoutBucket.get(e);if(t===void 0)return;this.nodeTimeoutBucket.delete(e),this.scheduleNodeRemoval(e);let[n,r]=this.timeoutBuckets.get(t);n.delete(e),n.size===0&&(clearTimeout(r),this.timeoutBuckets.delete(t))}#e=null;sweepBucket(e){let t=this.timeoutBuckets.get(e)[0];this.timeoutBuckets.delete(e),t.forEach(e=>{this.nodeTimeoutBucket.delete(e),e.canBeRemoved&&(this.nodes.delete(dl(e.atom)),this.onNodeRemoved?.(e),this.#e=e.atom.idleTTL??this.defaultIdleTTL,e.remove(),this.#e=null)})}reset(){this.timeoutBuckets.forEach(([,e])=>clearTimeout(e)),this.timeoutBuckets.clear(),this.nodeTimeoutBucket.clear(),this.nodes.forEach(e=>{e.remove(),this.onNodeRemoved?.(e)}),this.nodes.clear()}dispose(){this.disposed=!0,this.reset()}},pl={alive:1,initialized:2,waitingForValue:4},ml={uninitialized:pl.alive|pl.waitingForValue,stale:pl.alive|pl.initialized|pl.waitingForValue,valid:pl.alive|pl.initialized,removed:0},hl=class{constructor(e,t){this.registry=e,this.atom=t,this.writeContext=new yl(e,this)}registry;atom;state=ml.uninitialized;lifetime;writeContext;preserveInitialValueOnBuild=!1;parents=[];previousParents;children=[];listeners=new Set;skipInvalidation=!1;currentState(){switch(this.state){case ml.uninitialized:return`uninitialized`;case ml.stale:return`stale`;case ml.valid:return`valid`;default:return`removed`}}get canBeRemoved(){return!this.atom.keepAlive&&this.listeners.size===0&&this.children.length===0&&this.state!==0}_value=void 0;value(){if((this.state&pl.waitingForValue)!==0){this.lifetime=vl(this);let e=this.atom.read(this.lifetime);if((this.state&pl.waitingForValue)!==0&&(this.preserveInitialValueOnBuild?(this.preserveInitialValueOnBuild=!1,this.state=ml.valid):this.setValue(e)),this.previousParents){let e=this.previousParents;this.previousParents=void 0;for(let t=0;t<e.length;t++)e[t].removeChild(this),e[t].canBeRemoved&&this.registry.scheduleNodeRemoval(e[t])}}return this._value}valueOption(){return(this.state&pl.initialized)===0?jt():ta(this._value)}setInitialValue(e){if((this.state&pl.initialized)===0){this.preserveInitialValueOnBuild=!0,this.state=ml.stale,this._value=e,I.phase===bl.collect?I.notify.add(this):this.notify();return}this.setValue(e)}setValue(e){if((this.state&pl.initialized)===0){this.state=ml.valid,this._value=e,I.phase===bl.collect?I.notify.add(this):this.notify();return}this.state=ml.valid,!Object.is(this._value,e)&&(this._value=e,this.skipInvalidation?this.skipInvalidation=!1:this.invalidateChildren(),this.listeners.size>0&&(I.phase===bl.collect?I.notify.add(this):this.notify()))}addParent(e){if(this.parents.push(e),this.previousParents!==void 0){let t=this.previousParents.indexOf(e);t!==-1&&(this.previousParents[t]=this.previousParents[this.previousParents.length-1],this.previousParents.pop()===void 0&&(this.previousParents=void 0))}e.children.indexOf(this)===-1&&(e.children.push(this),e.skipInvalidation&&=!1)}removeChild(e){let t=this.children.indexOf(e);t!==-1&&(this.children[t]=this.children[this.children.length-1],this.children.pop())}invalidate(){this.state===ml.valid&&(this.state=ml.stale,this.disposeLifetime()),I.phase===bl.collect?I.stale.push(this):this.atom.lazy&&this.listeners.size===0&&!gl(this.children)?(this.invalidateChildren(),this.skipInvalidation=!0):this.value()}invalidateChildren(){if(this.children.length===0)return;let e=this.children;this.children=[];for(let t=0;t<e.length;t++)e[t].invalidate()}notify(){this.listeners.forEach(ll),I.phase===bl.commit&&I.notify.delete(this)}disposeLifetime(){this.lifetime!==void 0&&(this.lifetime.dispose(),this.lifetime=void 0),this.parents.length!==0&&(this.previousParents=this.parents,this.parents=[])}remove(){if(this.state=ml.removed,this.listeners.clear(),this.lifetime===void 0||(this.disposeLifetime(),this.previousParents===void 0))return;let e=this.previousParents;this.previousParents=void 0;for(let t=0;t<e.length;t++)e[t].removeChild(this),e[t].canBeRemoved&&this.registry.removeNode(e[t])}subscribe(e){return this.listeners.add(e),()=>this.listeners.delete(e)}};function gl(e){if(e.length===0)return!1;let t=e,n,r=0;for(;t!==void 0;){for(let e=0,r=t.length;e<r;e++){let r=t[e];if(!r.atom.lazy||r.listeners.size>0)return!0;r.children.length>0&&(n===void 0?n=[r.children]:n.push(r.children))}t=n?.[r++]}return!1}var _l={get registry(){return this.node.registry},addFinalizer(e){if(this.disposed)return e();this.finalizers??=[],this.finalizers.push(e)},get(e){if(this.disposed)return this.node.registry.get(e);let t=this.node.registry.ensureNode(e);return this.node.addParent(t),t.value()},result(e,t){if(this.disposed||this.isFn)return this.resultOnce(e,t);let n=this.get(e);if(t?.suspendOnWaiting&&n.waiting)return nt;switch(n._tag){case`Initial`:return nt;case`Failure`:return Qn(n.cause);case`Success`:return C(n.value)}},resultOnce(e,t){return or(n=>{let r=this.once(e);if(r._tag!==`Initial`&&!(t?.suspendOnWaiting&&r.waiting))return n(el(r));let i=this.node.registry.subscribe(e,e=>{e._tag===`Initial`||t?.suspendOnWaiting&&e.waiting||(i(),n(el(e)))},{immediate:!1});return A(i)})},setResult(e,t){return this.disposed?nt:(this.node.registry.set(e,t),this.resultOnce(e,{suspendOnWaiting:!0}))},some(e){if(this.disposed||this.isFn)return this.someOnce(e);let t=this.get(e);return t._tag===`None`?nt:C(t.value)},someOnce(e){return or(t=>{let n=this.once(e);if(ua(n))return t(C(n.value));let r=this.node.registry.subscribe(e,e=>{Yi(e)||(r(),t(C(e.value)))},{immediate:!1});return A(r)})},once(e){return this.node.registry.get(e)},self(){return this.disposed?jt():this.node.valueOption()},refresh(e){this.disposed||this.node.registry.refresh(e)},refreshSelf(){this.disposed||this.node.invalidate()},mount(e){this.disposed||this.addFinalizer(this.node.registry.mount(e))},subscribe(e,t,n){this.disposed||this.addFinalizer(this.node.registry.subscribe(e,t,n))},setSelf(e){this.disposed||this.node.setValue(e)},set(e,t){this.disposed||this.node.registry.set(e,t)},stream(e,t){return this.disposed?Os:Ds(n=>A(()=>{this.subscribe(e,e=>ao(n,e),{immediate:!t?.withoutInitialValue})}))},streamResult(e,t){return this.stream(e,t).pipe(Is(Vc),Fs(e=>e._tag===`Success`?C(e.value):Kr(e.cause)))},dispose(){if(this.disposed=!0,this.finalizers===void 0)return;let e=this.finalizers;this.finalizers=void 0;for(let t=e.length-1;t>=0;t--)e[t]()}},vl=e=>{function t(n){if(t.disposed||t.isFn)return e.registry.get(n);let r=e.registry.ensureNode(n),i=r.value();return e.addParent(r),i}return Object.setPrototypeOf(t,_l),t.isFn=!1,t.disposed=!1,t.finalizers=void 0,t.node=e,t},yl=class{constructor(e,t){this.registry=e,this.node=t}registry;node;get(e){return this.registry.get(e)}set(e,t){return this.registry.set(e,t)}setSelf(e){return this.node.setValue(e)}refreshSelf(){return this.node.invalidate()}},bl={disabled:0,collect:1,commit:2},I={phase:bl.disabled,depth:0,stale:[],notify:new Set};function xl(e){I.phase=bl.collect,I.depth++;try{if(e(),I.depth===1){for(let e=0;e<I.stale.length;e++)Sl(I.stale[e]);I.phase=bl.commit;for(let e of I.notify)e.notify();I.notify.clear()}}finally{I.depth--,I.depth===0&&(I.phase=bl.disabled,I.stale=[])}}function Sl(e){if(e.state!==ml.valid){for(let t=0;t<e.parents.length;t++){let n=e.parents[t];n.state!==ml.valid&&Sl(n)}e.state!==ml.valid&&e.value()}}var Cl=`~effect/reactivity/Atom`,wl=e=>o(e,Cl),Tl=`~effect/reactivity/Atom/Writable`,El=N(2,(e,t)=>{let n=Xr(t),r=xr(n);return Object.assign(Object.create(Object.getPrototypeOf(e)),{...e,keepAlive:!r,idleTTL:r?En(n):void 0})}),Dl=El(0),Ol={[Cl]:Cl,...de,toJSON(){return{_id:`Atom`,keepAlive:this.keepAlive,lazy:this.lazy,label:this.label}}},kl={...Ol,atom(e,t){let n=Ll(e,t);return Nl(e=>{let t=e.self(),r=e(this);return r._tag===`Success`?n(e,r.value):Zc(r,t)})},fn(e,t){return arguments.length===0?(e,t)=>Al(this,e,t):Al(this,e,t)},pull(e,t){let n=Dl(Bl(0));return nu(n,Nl(r=>{let i=r.self(),a=r(this);return a._tag===`Success`?Hl(r,tu(r,n,e,t),Hc(!0),a.value):Zc(a,i)}))},subscriptionRef(e){return Jl(Dl(Nl(t=>{let n=t.self(),r=t(this);if(r._tag!==`Success`)return Zc(r,n);let i=typeof e==`function`?e(t):e;return Sc(i)?i:Hl(t,i,Hc(!0),r.value)})),(e,t)=>ql(e,t,$c(e(this))))}},Al=(e,t,n)=>{let[r,i,a]=$l(n?.reactivityKeys?(e,r)=>{let i=t(e,r);return ea(i)?Ac(i,n.reactivityKeys):Ls(i,jc(n.reactivityKeys))}:t,n);return Pl(t=>{t.get(a);let n=t.self(),i=t.get(e);return i._tag===`Success`?r(t,i.value):Zc(i,n)},i)},jl={...Ol,[Tl]:Tl},Ml=e=>Tl in e,Nl=(e,t)=>{let n=Object.create(Ol);return n.keepAlive=!1,n.lazy=!0,n.read=e,n.refresh=t,n},Pl=(e,t,n)=>{let r=Object.create(jl);return r.keepAlive=!1,r.lazy=!0,r.read=e,r.write=t,r.refresh=n,r};function Fl(e,t){e.setSelf(t)}var Il=(e,t)=>{let n=Ll(e,t);return`~effect/reactivity/Atom`in n?n:Nl(n)},Ll=(e,t)=>{if(typeof e==`function`&&!ea(e)&&!ws(e)){let n=e;return function(e,r){let i=n(e);switch(typeof i){case`function`:case`object`:return i===null?i:Rl in i?Vl(e,i,t,r):zl in i?Gl(e,i,t,r):i;default:return i}}}else if(ea(e))return function(n,r){return Vl(n,e,t,r)};else if(ws(e))return function(n,r){return Gl(n,e,t,r)};return Bl(e)},Rl=`~effect/Effect`,zl=`~effect/Stream`,Bl=e=>Pl(function(t){return e},Fl),Vl=(e,t,n,r)=>Hl(e,t,n?.initialValue===void 0?Hc():Wc(n.initialValue),r,n?.uninterruptible);function Hl(e,t,n,r=ra(),i=!1){let a=e.self(),o=ar();e.addFinalizer(()=>{Te(r)(St(o,Dn))});let s=new Map(r.mapUnsafe);s.set(_n.key,o),s.set(ol.key,e.registry),s.set(Vi.key,e.registry.scheduler);let c,l=!1,u=Ul(pe(s),t,function(t){c=Rc(t,a),l&&e.setSelf(c)},i);return l=!0,u!==void 0&&e.addFinalizer(u),c===void 0?a._tag===`Some`?zc(a):Yc(n):c}function Ul(e,t,n,r=!1){if(_i(t)){n(t);return}let i=Te(e)(t);i.currentDispatcher?.flush();let a=i.pollUnsafe();if(a){n(a);return}let o=i.addObserver(n);function s(){o(),r||i.interruptUnsafe()}return s}var Wl=(e=>{let t=Mc;function n(r){let i=Object.create(kl);i.keepAlive=!1,i.lazy=!0,i.refresh=void 0,i.factory=n;let a=iu(Nl(typeof r==`function`?e=>Ye(r(e),t):()=>Ye(r,t)));return i.layer=a,i.read=function(t){let n=t(a);return Vl(t,M(cn,t=>et(n,e.memoMap,t)),{uninterruptible:!0})},i}n.memoMap=e.memoMap,n.addGlobalLayer=e=>{t=Ye(t,De(e,Mc))};let r=Dl(Il(Pn(t=>et(Mc,e.memoMap,kt(t,_n))).pipe(_(kt(Dc)))));return n.withReactivity=e=>t=>ou(t,n=>{let i=$c(n(r));return n.addFinalizer(i.registerUnsafe(e,()=>{n.refresh(t)})),n.subscribe(t,e=>n.setSelf(e)),n.once(t)},{initialValueTarget:t}),n})({memoMap:Ne()});Wl.withReactivity;var Gl=(e,t,n,r)=>Kl(e,t,n?.initialValue===void 0?Hc():Wc(n.initialValue),r);function Kl(e,t,n,r=ra()){let i=e.self();r=Rn(r,ol,e.registry);let a=Sn(n=>M(cs(t.channel,n),t=>An({while:mi,body:()=>t,step(t){e.setSelf(Wc(ze(t),{waiting:!0}))}}))).pipe(Ri(t=>(_e(t)?O(e.self(),fr(Qc),oa({onNone:()=>e.setSelf(Jc(new ia,{previous:e.self()})),onSome:t=>e.setSelf(Wc(t))})):e.setSelf(qc(t,{previous:e.self()})),T))),o=new Map(r.mapUnsafe);o.set(ol.key,e.registry),o.set(Vi.key,e.registry.scheduler);let s=Ul(pe(o),a,Yn,!1);return s!==void 0&&e.addFinalizer(s),i._tag===`Some`?zc(i):Yc(n)}var ql=(e,t,n=ra())=>Sc(t)?(e.addFinalizer(Cc(t).pipe(zs(t=>{for(let n=0;n<t.length;n++)e.setSelf(t[n]);return T}),Ht(n))),hn(n)(wc(t))):t._tag===`Success`?Kl(e,Cc(t.value),Hc(!0),n):t,Jl=(e,t)=>{function n(t,n){let r=t.get(e);Sc(r)?Ve(Ec(r,n)):Uc(r)&&Ve(Ec(r.value,n))}return Pl(n=>{let r=n(e);return Sc(r)||Uc(r)?t(n,r):r},n)},Yl=Symbol.for(`effect/reactivity/atom/Atom/Reset`),Xl=Symbol.for(`effect/reactivity/atom/Atom/Interrupt`),Zl=function(...e){return e.length===0?Ql:Ql(...e)},Ql=(e,t)=>{let[n,r]=$l(e,t);return Pl(n,r)};function $l(e,t){let n=Dl(Bl([0,void 0])),r=t?.initialValue===void 0?Hc():Wc(t.initialValue),i=t?.concurrent?Dl(Nl(e=>{let t=new Set;return e.addFinalizer(()=>t.forEach(e=>e.interruptUnsafe())),t})):void 0;function a(t,a){let o=i?t(i):void 0;t.isFn=!0;let[s,c]=t.get(n);if(s===0)return r;if(c===Xl)return qc(zr(),{previous:t.self()});let l=e(c,t);return Rl in l?(o&&(l=M(On(l,{startImmediately:!0}),e=>(o.add(e),e.addObserver(()=>o.delete(e)),_(xa(o),e=>e[0])))),Hl(t,l,r,a,!1)):Kl(t,l,r,a)}function o(e,t){du(()=>{t===Yl?e.set(n,[0,void 0]):t===Xl?e.set(n,[e.get(n)[0]+1,Xl]):e.set(n,[e.get(n)[0]+1,t]),e.refreshSelf()})}return[a,o,n]}var eu=(e,t)=>{let n=Dl(Bl(0));return nu(n,Nl(Ll(function(r){return tu(r,n,e,t)})))},tu=(e,t,n,r)=>M(Bs(typeof n==`function`?n(e):n),n=>{let i=wa().context,a=Xe(),o=Fr(n,{onFailure(e){return _e(e)?Ce(a)?C({done:!0,items:a}):Kn(new ia(`Atom.pull: no items`)):Kr(e)},onSuccess(e){let t;return r?.disableAccumulation?t=e:(t=Nr(a,e),a=t),C({done:!1,items:t})}}),s=new Set;return e.addFinalizer(()=>{for(let e of s)e()}),e.once(t),e.subscribe(t,()=>{e.setSelf(zc(e.self()));let t;t=Ul(i,o,n=>{t&&s.delete(t);let r=Rc(n,e.self()),i=s.size>0;e.setSelf(i?Yc(r):r)}),t&&s.add(t)}),o}),nu=(e,t)=>Pl(t.read,function(t,n){t.set(e,t.get(e)+1)}),ru=typeof WeakRef>`u`||typeof FinalizationRegistry>`u`?e=>{let t=hs();return function(n){let r=gs(t,n);if(r._tag===`Some`)return r.value;let i=e(n);return bs(t,n,i),i}}:e=>{let t=hs(),n=new FinalizationRegistry(e=>{Ss(t,e)});return function(r){let i=gs(t,r).pipe(vi(e=>e.deref()));if(i._tag===`Some`)return i.value;let a=e(r);return bs(t,r,new WeakRef(a)),n.register(a,r),a}},iu=e=>Object.assign(Object.create(Object.getPrototypeOf(e)),{...e,keepAlive:!0}),au=e=>Object.assign(Object.create(Object.getPrototypeOf(e)),{...e,keepAlive:!1}),ou=N(e=>wl(e[0]),(e,t,n)=>{let r=Dl(Ml(e)?Pl(n=>t(n,e),function(t,n){t.set(e,n)},e.refresh??function(t){t(e)}):Nl(n=>t(n,e),e.refresh??function(t){t(e)}));return n?.initialValueTarget&&(r.initialValueTarget=su(n.initialValueTarget)),r}),su=e=>{let t=e;for(;t.initialValueTarget;)t=t.initialValueTarget;return t},cu=N(2,(e,t)=>ou(e,n=>t(n(e)))),lu=e=>{let t=0,n=Dl(Bl([t,void 0]));return Pl(t=>{let r=t.once(e),i=!1;t.subscribe(e,e=>{if(r=e,a.size>0)return;if(i=!1,!Ic(e))return t.setSelf(e);let n=kn(t.self());switch(e._tag){case`Initial`:Bc(n)&&t.setSelf(e);return;case`Success`:Uc(n)?!e.waiting&&e.timestamp>=n.timestamp&&t.setSelf(e):t.setSelf(e);return;case`Failure`:return t.setSelf(e)}});let a=new Set,o=new Set;return t.subscribe(n,([,n])=>{if(a.has(n))return;a.add(n);let s;s=t.registry.subscribe(n,c=>{if(Uc(c)&&c.waiting)return t.setSelf(c.value);a.delete(n),s&&(o.delete(s),s()),!i&&!Gc(c)&&(i=!0),a.size===0&&(i?(i=!1,t.refresh(e)):t.setSelf(r))},{immediate:!0}),a.has(n)?o.add(s):s()}),t.addFinalizer(()=>{for(let e of o)e();a.clear(),o.clear()}),r},(e,r)=>e.set(n,[++t,r]),t=>t(e))},uu=N(2,(e,t)=>{let n=Dl(Bl(Hc()));return Zl((r,i)=>{let a=t.reducer(i(e),r);Ic(a)&&(a=Yc(a,{touch:!0})),i.set(n,Wc(a,{waiting:!0})),i.set(e,n);let o=typeof t.fn==`function`?au(t.fn(e=>i.set(n,Wc(Ic(e)?Yc(e):e,{waiting:!0})))):t.fn;return i.set(o,r),or(e=>{i.subscribe(o,t=>{t._tag===`Initial`||t.waiting||(i.set(n,tl(t,()=>a)),e(el(t)))},{immediate:!0})})})}),du=xl,fu=`~effect-atom/atom/Atom/Serializable`,pu=N(2,(e,t)=>{let n=ve(t.schema);return Object.assign(Object.create(Object.getPrototypeOf(e)),{...e,label:e.label??[t.key,Error().stack?.split(`
2
- `)[5]??``],[fu]:{key:t.key,encode:fa(n),decode:ni(n)}})}),mu=`~effect-atom/atom/Atom/ServerValue`,hu=N(2,(e,t)=>`~effect-atom/atom/Atom/ServerValue`in e?e[mu](e=>t.get(e)):t.get(e));function gu(e){let t=Ws.unstable_scheduleCallback(4,e);return()=>Ws.unstable_cancelCallback(t)}var _u=Us.createContext(al({scheduleTask:gu,defaultIdleTTL:400})),vu=new WeakMap;function yu(e,t){let n=vu.get(e);n===void 0&&(n=new WeakMap,vu.set(e,n));let r=n.get(t);if(r!==void 0)return r;let i={subscribe(n){return e.subscribe(t,n)},snapshot(){return e.get(t)},getServerSnapshot(){return hu(t,e)}};return n.set(t,i),i}function bu(e,t){let n=yu(e,t);return Us.useSyncExternalStore(n.subscribe,n.snapshot,n.getServerSnapshot)}var xu=(e,t)=>{let n=Us.useContext(_u);return t?bu(n,Us.useMemo(()=>cu(e,t),[e,t])):bu(n,e)};function Su(e,t){Us.useEffect(()=>e.mount(t),[t,e])}function Cu(e,t,n){return n?.mode===`promise`||n?.mode===`promiseExit`?Us.useCallback(r=>{e.set(t,r);let i=Si(sl(e,t,{suspendOnWaiting:!0}));return n.mode===`promise`?i.then(wu):i},[e,t,n.mode]):Us.useCallback(n=>{e.set(t,typeof n==`function`?n(e.get(t)):n)},[e,t])}var wu=e=>{if(Sr(e))return e.value;throw ot(e.cause)},Tu=(e,t)=>{let n=Us.useContext(_u);return Su(n,e),Cu(n,e,t)},Eu=e=>{let t=Us.useContext(_u);return Su(t,e),Us.useCallback(()=>{t.refresh(e)},[t,e])},Du={suspendOnWaiting:new Map,default:new Map};function Ou(e,t,n){let r=n?Du.suspendOnWaiting:Du.default,i=r.get(t);return i===void 0?(i=new Promise(i=>{let a=e.subscribe(t,e=>{e._tag===`Initial`||n&&e.waiting||(setTimeout(a,1e3),i(),r.delete(t))})}),r.set(t,i),i):i}function ku(e,t,n){let r=bu(e,t);if(r._tag===`Initial`||n&&r.waiting)throw Ou(e,t,n);return r}var Au=(e,t)=>{let n=ku(Us.useContext(_u),e,t?.suspendOnWaiting??!1);if(n._tag===`Failure`&&!t?.includeFailure)throw ot(n.cause);return n},ju=(e,t,n)=>{let r=Us.useContext(_u);Us.useEffect(()=>r.subscribe(e,t,n),[r,e,t,n?.immediate])},Mu=Symbol.for(`~effect/http/Headers`),Nu=Object.create(null);Object.defineProperties(Nu,{[Mu]:{value:Mu},[Jt]:{value(e){return Uu(this,kt(e,Wu))}},toJSON:{value(){return te(this)}},[Je]:{value(e){return Fu(this,e)}},[xt]:{value(){return Cn(this)}},toString:{value:gt.toString},[Le]:{value:gt[Le]}});var Pu=e=>Object.assign(Object.create(Nu),e),Fu=kr(Ut()),Iu=Object.create(Nu),Lu=e=>{if(e===void 0)return Iu;if(Symbol.iterator in e){let t=Object.create(Nu);for(let[n,r]of e)t[n.toLowerCase()]=r;return t}let t=Object.create(Nu);for(let[n,r]of Object.entries(e))Array.isArray(r)?t[n.toLowerCase()]=r.join(`, `):r!==void 0&&(t[n.toLowerCase()]=r);return t},Ru=e=>Object.setPrototypeOf(e,Nu),zu=N(3,(e,t,n)=>{let r=Pu(e);return r[t.toLowerCase()]=n,r}),Bu=N(2,(e,t)=>Pu({...e,...Lu(t)})),Vu=N(2,(e,t)=>{let n=Pu(e);return Object.assign(n,t),n}),Hu=N(2,(e,t)=>{let n=Pu(e);return delete n[t.toLowerCase()],n}),Uu=N(2,(e,t)=>{let n={...e},r=t=>{if(typeof t==`string`){let r=t.toLowerCase();r in e&&(n[r]=rn(e[r]))}else for(let r in e)t.test(r)&&(n[r]=rn(e[r]))};if(Array.isArray(t))for(let e=0;e<t.length;e++)r(t[e]);else r(t);return n}),Wu=Ki(`effect/Headers/CurrentRedactedNames`,{defaultValue:()=>[`authorization`,`cookie`,`set-cookie`,`x-api-key`]}),Gu=`~effect/http/UrlParams`,Ku={...de,[Gu]:Gu,[Symbol.iterator](){return this.params[Symbol.iterator]()},toJSON(){return{_id:`UrlParams`,params:Object.fromEntries(this.params)}},[Je](e){return Xu(this,e)},[xt](){return Ci(this.params.flat())}},qu=e=>{let t=Object.create(Ku);return t.params=e,t},Ju=e=>{let t=Yu(e),n=[];for(let e=0;e<t.length;e++)if(Array.isArray(t[e][0])){let[r,i]=t[e];n.push([`${r[0]}[${r.slice(1).join(`][`)}]`,i])}else n.push(t[e]);return qu(n)},Yu=e=>{let t=typeof e[Symbol.iterator]==`function`?ke(e):Object.entries(e),n=[];for(let[e,r]of t)if(Array.isArray(r))for(let t=0;t<r.length;t++)r[t]!==void 0&&n.push([e,String(r[t])]);else if(typeof r==`object`){let t=Yu(r);for(let[r,i]of t)n.push([[e,...typeof r==`string`?[r]:r],i])}else r!==void 0&&n.push([e,String(r)]);return n},Xu=Me((e,t)=>Zu(e.params,t.params)),Zu=on(Ni([Ut(),Ut()])),Qu=qu([]),$u=N(2,(e,t)=>{let n=Ju(t),r=n.params,i=new Set;for(let e=0;e<r.length;e++)i.add(r[e][0]);for(let t=0;t<e.params.length;t++)i.has(e.params[t][0])||r.push(e.params[t]);return n}),ed=class extends zn(`UrlParamsError`){},td=(e,t,n)=>{try{let r=new URL(e,nd());for(let e=0;e<t.params.length;e++){let[n,i]=t.params[e];i!==void 0&&r.searchParams.append(n,i)}return n!==void 0&&(r.hash=n),er(r)}catch(e){return qn(new ed({cause:e}))}},nd=()=>{if(`location`in globalThis&&globalThis.location!==void 0&&globalThis.location.origin!==void 0&&globalThis.location.pathname!==void 0)return location.origin+location.pathname},rd=`~effect/http/HttpBody`;zn(`HttpBodyError`);var id=class{[rd];constructor(){this[rd]=rd}[Le](){return this.toJSON()}toString(){return _a(this,{ignoreToString:!0})}},ad=new class extends id{_tag=`Empty`;toJSON(){return{_id:`effect/HttpBody`,_tag:`Empty`}}},od=`~effect/http/Cookies`,sd=`~effect/http/Cookies/Cookie`;zn(`CookieError`);var cd={[od]:od,...gt,toJSON(){return{_id:`effect/Cookies`,cookies:Fn(this.cookies,e=>e.toJSON())}},pipe(){return ti(this,arguments)}},ld=e=>{let t=Object.create(cd);return t.cookies=e,t},ud=e=>{let t={};for(let n of e)t[n.name]=n;return ld(t)},dd=e=>{let t=typeof e==`string`?[e]:e,n=[];for(let e of t){let t=fd(e.trim());t&&n.push(t)}return ud(n)};function fd(e){let t=e.split(`;`).map(e=>e.trim()).filter(e=>e!==``);if(t.length===0)return;let n=t[0].indexOf(`=`);if(n===-1)return;let r=t[0].slice(0,n);if(!pd.test(r))return;let i=t[0].slice(n+1),a=hd(i);if(t.length===1)return Object.assign(Object.create(md),{name:r,value:a,valueEncoded:i});let o={};for(let e=1;e<t.length;e++){let n=t[e],r=n.indexOf(`=`),i=r===-1?n:n.slice(0,r).trim(),a=r===-1?void 0:n.slice(r+1).trim();switch(i.toLowerCase()){case`domain`:{if(a===void 0)break;let e=a.trim().replace(/^\./,``);e&&(o.domain=e);break}case`expires`:{if(a===void 0)break;let e=new Date(a);isNaN(e.getTime())||(o.expires=e);break}case`max-age`:{if(a===void 0)break;let e=parseInt(a,10);isNaN(e)||(o.maxAge=hr(e));break}case`path`:if(a===void 0)break;a[0]===`/`&&(o.path=a);break;case`priority`:if(a===void 0)break;switch(a.toLowerCase()){case`low`:o.priority=`low`;break;case`medium`:o.priority=`medium`;break;case`high`:o.priority=`high`;break}break;case`httponly`:o.httpOnly=!0;break;case`secure`:o.secure=!0;break;case`partitioned`:o.partitioned=!0;break;case`samesite`:if(a===void 0)break;switch(a.toLowerCase()){case`lax`:o.sameSite=`lax`;break;case`strict`:o.sameSite=`strict`;break;case`none`:o.sameSite=`none`;break}break}}return Object.assign(Object.create(md),{name:r,value:a,valueEncoded:i,options:Object.keys(o).length>0?o:void 0})}var pd=/^[\u0009\u0020-\u007e\u0080-\u00ff]+$/,md={[sd]:sd,...gt,toJSON(){return{_id:`effect/Cookies/Cookie`,name:this.name,value:this.value,options:this.options}}},hd=e=>{try{return decodeURIComponent(e)}catch{return e}},gd=`~effect/http/HttpClientError`,_d=class extends zn(`HttpClientError`){constructor(e){`cause`in e.reason?super({...e,cause:e.reason.cause}):super(e)}[gd]=gd;get request(){return this.reason.request}get response(){return`response`in this.reason?this.reason.response:void 0}get message(){return this.reason.message}},vd=e=>e.endsWith(`Error`)?e.slice(0,-5):e,yd=(e,t,n)=>t?`${e}: ${t} (${n})`:`${e} error (${n})`,bd=class extends zn(`TransportError`){get methodAndUrl(){return`${this.request.method} ${this.request.url}`}get message(){return yd(vd(this._tag),this.description,this.methodAndUrl)}};zn(`EncodeError`);var xd=class extends zn(`InvalidUrlError`){get methodAndUrl(){return`${this.request.method} ${this.request.url}`}get message(){return yd(vd(this._tag),this.description,this.methodAndUrl)}};zn(`StatusCodeError`);var Sd=class extends zn(`DecodeError`){get methodAndUrl(){return`${this.request.method} ${this.request.url}`}get message(){let e=`${this.response.status} ${this.methodAndUrl}`;return yd(vd(this._tag),this.description,e)}},Cd=class extends zn(`EmptyBodyError`){get methodAndUrl(){return`${this.request.method} ${this.request.url}`}get message(){let e=`${this.response.status} ${this.methodAndUrl}`;return yd(vd(this._tag),this.description,e)}},wd=class e extends Zt(gd)({_tag:zt(`HttpError`),kind:v([`EncodeError`,`DecodeError`,`TransportError`,`InvalidUrlError`,`StatusCodeError`,`EmptyBodyError`]),cause:P(x)}){static fromHttpClientError(t){return new e({_tag:`HttpError`,kind:t.reason._tag,cause:t.reason})}},Td=[[`GET`,`get`],[`POST`,`post`],[`PUT`,`put`],[`DELETE`,`del`],[`PATCH`,`patch`],[`HEAD`,`head`],[`OPTIONS`,`options`],[`TRACE`,`trace`]],Ed=`~effect/http/HttpClientRequest`,Dd={[Ed]:Ed,...gt,toJSON(){return{_id:`HttpClientRequest`,method:this.method,url:this.url,urlParams:this.urlParams,hash:this.hash,headers:te(this.headers),body:this.body.toJSON()}},pipe(){return ti(this,arguments)}};function Od(e,t,n,r,i,a){let o=Object.create(Dd);return o.method=e,o.url=t,o.urlParams=n,o.hash=r,o.headers=i,o.body=a,o}var kd=Od(`GET`,``,Qu,jt(),Iu,ad),Ad=e=>(t,n)=>jd(kd,{method:e,url:t,...n??void 0}),jd=N(2,(e,t)=>{let n=e;return t.method&&(n=Md(n,t.method)),t.url&&(n=Ld(n,t.url)),t.headers&&(n=Pd(n,t.headers)),t.urlParams&&(n=Rd(n,t.urlParams)),t.hash&&(n=zd(n,t.hash)),t.body&&(n=Bd(n,t.body)),t.accept&&(n=Fd(n,t.accept)),t.acceptJson&&(n=Id(n)),n}),Md=N(2,(e,t)=>Od(t,e.url,e.urlParams,e.hash,e.headers,e.body)),Nd=N(3,(e,t,n)=>Od(e.method,e.url,e.urlParams,e.hash,zu(e.headers,t,n),e.body)),Pd=N(2,(e,t)=>Od(e.method,e.url,e.urlParams,e.hash,Bu(e.headers,t),e.body)),Fd=N(2,(e,t)=>Nd(e,`Accept`,t)),Id=Fd(`application/json`),Ld=N(2,(e,t)=>{if(typeof t==`string`)return Od(e.method,t,e.urlParams,e.hash,e.headers,e.body);let n=new URL(t.toString()),r=Ju(n.searchParams),i=$r(n.hash===``?void 0:n.hash.slice(1));return n.search=``,n.hash=``,Od(e.method,n.toString(),r,i,e.headers,e.body)}),Rd=N(2,(e,t)=>Od(e.method,e.url,$u(e.urlParams,t),e.hash,e.headers,e.body)),zd=N(2,(e,t)=>Od(e.method,e.url,e.urlParams,ta(t),e.headers,e.body)),Bd=N(2,(e,t)=>{let n=e.headers;return t._tag===`Empty`||t._tag===`FormData`?n=Hu(Hu(n,`Content-Type`),`Content-length`):(t.contentType&&(n=zu(n,`content-type`,t.contentType)),t.contentLength!==void 0&&(n=zu(n,`content-length`,t.contentLength.toString()))),Od(e.method,e.url,e.urlParams,e.hash,n,t)}),Vd=`~effect/http/HttpIncomingMessage`,Hd=(e,t)=>{let n=e.headers[`content-type`]??``,r;if(n.includes(`application/json`))try{r=Ve(e.json)}catch{}else if(n.includes(`text/`)||n.includes(`urlencoded`))try{r=Ve(e.text)}catch{}let i={...t,headers:te(e.headers),remoteAddress:e.remoteAddress};return r!==void 0&&(i.body=r),i},Ud=`~effect/http/HttpClientResponse`,Wd=(e,t)=>new Gd(e,t),Gd=class extends xe{[Vd];[Ud];request;source;constructor(e,t){super(),this.request=e,this.source=t,this[Vd]=Vd,this[Ud]=Ud}toJSON(){return Hd(this,{_id:`HttpClientResponse`,request:this.request.toJSON(),status:this.status})}get status(){return this.source.status}get headers(){return Lu(this.source.headers)}cachedCookies;get cookies(){return this.cachedCookies?this.cachedCookies:this.cachedCookies=dd(this.source.headers.getSetCookie())}get remoteAddress(){return jt()}get stream(){return this.source.body?Ns({evaluate:()=>this.source.body,onError:e=>new _d({reason:new Sd({request:this.request,response:this,cause:e})})}):As(new _d({reason:new Cd({request:this.request,response:this,description:`can not create stream from empty body`})}))}get json(){return M(this.text,e=>Wi({try:()=>e===``?null:JSON.parse(e),catch:e=>new _d({reason:new Sd({request:this.request,response:this,cause:e})})}))}textBody;get text(){return this.textBody?this.textBody:(this.textBody=Jr({try:()=>this.source.text(),catch:e=>new _d({reason:new Sd({request:this.request,response:this,cause:e})})}).pipe(c,Ve),this.arrayBufferBody=_(this.textBody,e=>new TextEncoder().encode(e).buffer),this.textBody)}get urlParamsBody(){return M(this.text,e=>Wi({try:()=>Ju(new URLSearchParams(e)),catch:e=>new _d({reason:new Sd({request:this.request,response:this,cause:e})})}))}formDataBody;get formData(){return this.formDataBody??=Jr({try:()=>this.source.formData(),catch:e=>new _d({reason:new Sd({request:this.request,response:this,cause:e})})}).pipe(c,Ve)}arrayBufferBody;get arrayBuffer(){return this.arrayBufferBody?this.arrayBufferBody:(this.arrayBufferBody=Jr({try:()=>this.source.arrayBuffer(),catch:e=>new _d({reason:new Sd({request:this.request,response:this,cause:e})})}).pipe(c,Ve),this.textBody=_(this.arrayBufferBody,e=>new TextDecoder().decode(e)),this.arrayBufferBody)}pipe(){return ti(this,arguments)}},Kd=e=>Ru({b3:`${e.traceId}-${e.spanId}-${e.sampled?`1`:`0`}${oa(e.parent,{onNone:()=>``,onSome:e=>`-${e.spanId}`})}`,traceparent:`00-${e.traceId}-${e.spanId}-${e.sampled?`01`:`00`}`}),qd=`~effect/http/HttpClient`,Jd=F(`effect/HttpClient`),Yd=N(2,(e,t)=>Xd(n=>t(e.postprocess(n)),e.preprocess)),Xd=(e,t)=>{let n=Object.create(Zd);return n.preprocess=t,n.postprocess=e,n.execute=function(n){return e(t(n))},n},Zd={[qd]:qd,pipe(){return ti(this,arguments)},...gt,toJSON(){return{_id:`effect/HttpClient`}},...Object.fromEntries(Td.map(([e,t])=>[t,function(t,n){return this.execute(Ad(e)(t,n))}]))},Qd=e=>Xd(t=>M(t,t=>Xi(n=>{let r=af.get(t),i=r??new AbortController,a=td(t.url,t.urlParams,kn(t.hash));if(qr(a))return Kn(new _d({reason:new xd({request:t,cause:a.failure})}));let o=a.success;if(n.getRef(Er)||n.getRef($d)(t)){let a=e(t,o,i.signal,n);return r?a:pr(e=>Fr(e(a),{onSuccess(e){return rf.register(e,i),C(new of(e,i))},onFailure(e){return ue(e)&&i.abort(),Kr(e)}}))}return ei(n.getRef(tf)(t),{kind:`client`},a=>{a.attribute(`http.request.method`,t.method),a.attribute(`server.address`,o.origin),o.port!==``&&a.attribute(`server.port`,+o.port),a.attribute(`url.full`,o.toString()),a.attribute(`url.path`,o.pathname),a.attribute(`url.scheme`,o.protocol.slice(0,-1));let s=o.search.slice(1);s!==``&&a.attribute(`url.query`,s);let c=n.getRef(Wu),l=Uu(t.headers,c);for(let e in l)a.attribute(`http.request.header.${e}`,String(l[e]));return t=n.getRef(ef)?Pd(t,Kd(a)):t,pr(s=>s(e(t,o,i.signal,n)).pipe(da(a,{captureStackTrace:!1}),Fr({onSuccess:e=>{a.attribute(`http.response.status_code`,e.status);let t=Uu(e.headers,c);for(let e in t)a.attribute(`http.response.header.${e}`,String(t[e]));return r?C(e):(rf.register(e,i),C(new of(e,i)))},onFailure(e){return!r&&ue(e)&&i.abort(),Kr(e)}})))})})),C),$d=Ki(`effect/http/HttpClient/TracerDisabledWhen`,{defaultValue:()=>Ln}),ef=Ki(`effect/HttpClient/TracerPropagationEnabled`,{defaultValue:mi}),tf=Ki(`effect/http/HttpClient/SpanNameGenerator`,{defaultValue:()=>e=>`http.client ${e.method}`}),nf=e=>Ot(Jd)(Pn(t=>_(e,e=>Yd(e,yi(e=>le(t,e)))))),rf=(()=>{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))}}})(),af=new WeakMap,of=class{original;controller;constructor(e,t){this.original=e,this.controller=t}[Ud]=Ud;[Vd]=Vd;applyInterrupt(e){return si(()=>(rf.unregister(this.original),be(e,()=>A(()=>{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 ks(()=>(rf.unregister(this.original),Ls(this.original.stream,A(()=>{this.controller.abort()}))))}toJSON(){return this.original.toJSON()}[Le](){return this.original[Le]()}pipe(){return ti(this,arguments)}},sf=`~effect/FiberSet`,cf=e=>o(e,sf),lf={[sf]:sf,[Symbol.iterator](){return this.state._tag===`Closed`?fi():this.state.backing[Symbol.iterator]()},...de,toJSON(){return{_id:`FiberMap`,state:this.state}}},uf=(e,t)=>{let n=Object.create(lf);return n.state={_tag:`Open`,backing:e},n.deferred=t,n},df=()=>Ti(A(()=>uf(new Set,Gn())),e=>si(()=>{let t=e.state;if(t._tag===`Closed`)return T;e.state={_tag:`Closed`};let n=t.backing;return Ca(n).pipe(ji(e.deferred))})),ff=-1,pf=gi(Zn(Ft,lr(ff))),mf=N(e=>cf(e[0]),(e,t,n)=>{if(e.state._tag===`Closed`){t.interruptUnsafe(ff);return}else if(e.state.backing.has(t))return;e.state.backing.add(t),t.addObserver(r=>{e.state._tag!==`Closed`&&(e.state.backing.delete(t),Zr(r)&&(n?.propagateInterruption===!0?!pf(r.cause):!dt(r.cause))&&Nn(e.deferred,r))})}),hf=function(){let e;return()=>(e===void 0&&(e=en(At)),e)}(),gf=e=>()=>_(Or(),t=>{let n=Te(t);return(t,r)=>{if(e.state._tag===`Closed`)return hf();let i=n(t,r);return mf(e,i),i}}),_f=e=>Dr(e.deferred),vf=`~effect/socket/Socket`,yf=F(`effect/socket/Socket`),bf=e=>yf.of({[vf]:vf,runRaw:e.runRaw,run:e.run??((t,n)=>e.runRaw(e=>typeof e==`string`?t(xf.encode(e)):e instanceof Uint8Array?t(e):t(new Uint8Array(e)),n)),runString:e.runString??(e.run?(t,n)=>e.run(e=>t(Sf.decode(e)),n):(t,n)=>e.runRaw(e=>typeof e==`string`?t(e):e instanceof Uint8Array?t(Sf.decode(e)):t(Sf.decode(new Uint8Array(e))),n)),writer:e.writer}),xf=new TextEncoder,Sf=new TextDecoder,Cf=`~effect/socket/Socket/CloseEvent`,wf=e=>o(e,Cf),Tf=`~effect/socket/Socket/SocketError`,Ef=e=>o(e,Tf),Df=class extends Zt(`effect/socket/Socket/SocketReadError`)({_tag:zt(`SocketReadError`),cause:x}){message=`An error occurred during Read`},Of=class extends Zt(`effect/socket/Socket/SocketWriteError`)({_tag:zt(`SocketWriteError`),cause:x}){message=`An error occurred during Write`},kf=class extends Zt(`effect/socket/Socket/SocketOpenError`)({_tag:zt(`SocketOpenError`),kind:v([`Unknown`,`Timeout`]),cause:x}){get message(){return this.kind===`Timeout`?`timeout waiting for "open"`:`An error occurred during Open`}},Af=class extends Zt(`effect/socket/Socket/SocketCloseError`)({_tag:zt(`SocketCloseError`),code:y,closeReason:P(j)}){static filterClean(e){return function(t){return Mf.is(t)&&t.reason._tag===`SocketCloseError`&&e(t.reason.code)?er(t.reason):qn(t)}}get message(){return this.closeReason?`${this.code}: ${this.closeReason}`:`${this.code}`}},jf=E([Df,Of,kf,Af]),Mf=class extends ki(Tf)(`SocketError`,{_tag:zt(`SocketError`),reason:jf}){constructor(e){`cause`in e.reason?super({...e,cause:e.reason.cause}):super(e)}[Tf]=Tf;static is(e){return Ef(e)}message=this.reason.message},Nf=e=>!0,Pf=class extends F()(`~effect/socket/Socket/WebSocket`){},Ff=class extends F()(`@effect/platform/Socket/WebSocketConstructor`){},If=wi(Ff)((e,t)=>new globalThis.WebSocket(e,t)),Lf=(e,t)=>Ff.use(n=>Rf(Ti((typeof e==`string`?C(e):e).pipe(_(e=>n(e,t?.protocols))),e=>A(()=>e.close(1e3))),t)),Rf=(e,t)=>Xi(n=>{let r,i=Ea(!1),a=n.context,o=t?.closeCodeIsError??Nf;return C(bf({runRaw:(n,s)=>Sn(Qr(function*(a){let c=yield*df().pipe(Li(a)),l=yield*Li(e,a),u=yield*ee(gf(c)(),Pf,l),d=!1;function f(e){if(e.data instanceof Blob)return u(M(Qe(()=>e.data.arrayBuffer()),e=>{let t=n(new Uint8Array(e));return ea(t)?t:T}));let t=n(e.data);ea(t)&&u(t)}function p(e){l.removeEventListener(`message`,f),l.removeEventListener(`close`,m),Nn(c.deferred,Kn(new Mf({reason:d?new Df({cause:e}):new kf({kind:`Unknown`,cause:e})})))}function m(e){let t=typeof e.code==`number`?e.code:1001;l.removeEventListener(`message`,f),l.removeEventListener(`error`,p),Nn(c.deferred,Kn(new Mf({reason:new Af({code:t,closeReason:e.reason})})))}if(l.addEventListener(`close`,m,{once:!0}),l.addEventListener(`error`,p,{once:!0}),l.addEventListener(`message`,f),l.readyState!==1){let e=Gn();l.addEventListener(`open`,()=>{d=!0,Nn(e,T)},{once:!0}),yield*Dr(e).pipe(Jn({duration:t?.openTimeout??1e4,orElse:()=>Kn(new Mf({reason:new kf({kind:`Timeout`,cause:Error(`timeout waiting for "open"`)})}))}),qt(_f(c)))}return d=!0,r=l,i.openUnsafe(),s?.onOpen&&(yield*s.onOpen),yield*ai(_f(c),Af.filterClean(e=>!o(e)),()=>T)})).pipe(yi(e=>le(a,e)),Mi(A(()=>{i.closeUnsafe(),r=void 0}))),writer:C(e=>i.whenOpen(A(()=>{let t=r;wf(e)?t.close(e.code,e.reason):t.send(e)})))}))}),zf=nr(Lf,Ot(yf)),Bf=class extends F()(`effect/workers/Transferable/Collector`){},Vf=()=>{let e=[],t=t=>{e.push(...t)},n=()=>e,r=()=>{let t=e;return e=[],t};return Bf.of({addAllUnsafe:t,addAll:e=>A(()=>t(e)),readUnsafe:n,read:A(n),clearUnsafe:r,clear:A(r)})},Hf=`~effect/workers/WorkerError`,Uf=E([class extends Zt(`effect/workers/WorkerError/WorkerSpawnError`)({_tag:zt(`WorkerSpawnError`),message:j,cause:P(x)}){},class extends Zt(`effect/workers/WorkerError/WorkerSendError`)({_tag:zt(`WorkerSendError`),message:j,cause:P(x)}){},class extends Zt(`effect/workers/WorkerError/WorkerReceiveError`)({_tag:zt(`WorkerReceiveError`),message:j,cause:P(x)}){},class extends Zt(`effect/workers/WorkerError/WorkerUnknownError`)({_tag:zt(`WorkerUnknownError`),message:j,cause:P(x)}){}]);Zt(Hf)({_tag:zt(`WorkerError`),reason:Uf});var Wf=`~effect/interfaces/PrimaryKey`,Gf=`~effect/rpc/RpcSchema/StreamSchema`;function Kf(e){return o(e,Gf)}function qf(e){return Kf(e)?ta({success:e.success,error:e.error}):jt()}var Jf=mr(ws);function Yf(e,t){return ce(Jf.ast,{[Gf]:Gf,success:e,error:t})}F()(`effect/rpc/RpcSchema/ClientAbort`);var Xf=`~effect/rpc/Rpc`,Zf={[Xf]:Xf,pipe(){return ti(this,arguments)},setSuccess(e){return Qf({_tag:this._tag,payloadSchema:this.payloadSchema,successSchema:e,errorSchema:this.errorSchema,defectSchema:this.defectSchema,annotations:this.annotations,middlewares:this.middlewares})},setError(e){return Qf({_tag:this._tag,payloadSchema:this.payloadSchema,successSchema:this.successSchema,errorSchema:e,defectSchema:this.defectSchema,annotations:this.annotations,middlewares:this.middlewares})},setPayload(e){return Qf({_tag:this._tag,payloadSchema:Un(e)?e:D(e),successSchema:this.successSchema,errorSchema:this.errorSchema,defectSchema:this.defectSchema,annotations:this.annotations,middlewares:this.middlewares})},middleware(e){return Qf({_tag:this._tag,payloadSchema:this.payloadSchema,successSchema:this.successSchema,errorSchema:this.errorSchema,defectSchema:this.defectSchema,annotations:this.annotations,middlewares:new Set([...this.middlewares,e])})},prefix(e){return Qf({_tag:`${e}${this._tag}`,payloadSchema:this.payloadSchema,successSchema:this.successSchema,errorSchema:this.errorSchema,defectSchema:this.defectSchema,annotations:this.annotations,middlewares:this.middlewares})},annotate(e,t){return Qf({_tag:this._tag,payloadSchema:this.payloadSchema,successSchema:this.successSchema,errorSchema:this.errorSchema,defectSchema:this.defectSchema,middlewares:this.middlewares,annotations:Rn(this.annotations,e,t)})},annotateMerge(e){return Qf({_tag:this._tag,payloadSchema:this.payloadSchema,successSchema:this.successSchema,errorSchema:this.errorSchema,defectSchema:this.defectSchema,middlewares:this.middlewares,annotations:le(this.annotations,e)})}},Qf=e=>{function t(){}return Object.setPrototypeOf(t,Zf),Object.assign(t,e),t.key=`effect/rpc/Rpc/${e._tag}`,t},L=(e,t)=>{let n=t?.success??rr,r=t?.error??fn,i=t?.defect??x,a;return a=t?.primaryKey?class extends S(`effect/rpc/Rpc/${e}`)(t.payload){[Wf](){return t.primaryKey(this)}}:Un(t?.payload)?t?.payload:t?.payload?D(t?.payload):rr,Qf({_tag:e,payloadSchema:a,successSchema:t?.stream?Yf(n,r):n,errorSchema:t?.stream?fn:r,defectSchema:i,annotations:ra(),middlewares:new Set})},$f=new WeakMap,ep=e=>{if($f.has(e))return $f.get(e);let t=e,n=new Set([t.errorSchema]),r=qf(t.successSchema);ua(r)&&n.add(r.value.error);for(let e of t.middlewares)n.add(e.error);let i=Se(ua(r)?rr:t.successSchema,E([...n]),t.defectSchema);return $f.set(e,i),i},tp=`~effect/rpc/Rpc/Wrapper`,np=e=>tp in e,rp=`~effect/rpc/RpcClientError`,ip=class extends Zt(`effect/rpc/RpcClientError/RpcClientDefect`)({_tag:zt(`RpcClientDefect`),message:j,cause:x}){},ap=class extends Zt(rp)({_tag:zt(`RpcClientError`),reason:E([Uf,jf,wd,ip])}){[rp]=rp;get message(){return`${this.reason._tag}: ${this.reason.message}`}},op=e=>typeof e==`bigint`?e:BigInt(e),sp={_tag:`Ping`},cp;try{cp=new TextDecoder}catch{}var R,lp,z=0,up=[],dp=up,fp=0,B={},V,pp,mp=0,hp=0,H,gp,_p=[],U,vp={useRecords:!1,mapsAsObjects:!0},yp=class{},bp=new yp;bp.name=`MessagePack 0xC1`;var xp=!1,Sp=2,Cp=class e{constructor(e){e&&(e.useRecords===!1&&e.mapsAsObjects===void 0&&(e.mapsAsObjects=!0),e.sequential&&e.trusted!==!1&&(e.trusted=!0,!e.structures&&e.useRecords!=0&&(e.structures=[],e.maxSharedStructures||=0)),e.structures?e.structures.sharedLength=e.structures.length:e.getStructures&&((e.structures=[]).uninitialized=!0,e.structures.sharedLength=0),e.int64AsNumber&&(e.int64AsType=`number`)),Object.assign(this,e)}unpack(t,n){if(R)return Xp(()=>(Zp(),this?this.unpack(t,n):e.prototype.unpack.call(vp,t,n)));!t.buffer&&t.constructor===ArrayBuffer&&(t=typeof Buffer<`u`?Buffer.from(t):new Uint8Array(t)),typeof n==`object`?(lp=n.end||t.length,z=n.start||0):(z=0,lp=n>-1?n:t.length),fp=0,hp=0,pp=null,dp=up,H=null,R=t;try{U=t.dataView||=new DataView(t.buffer,t.byteOffset,t.byteLength)}catch(e){throw R=null,t instanceof Uint8Array?e:Error(`Source must be a Uint8Array or Buffer but was a `+(t&&typeof t==`object`?t.constructor.name:typeof t))}if(this instanceof e){if(B=this,this.structures)return V=this.structures,wp(n);(!V||V.length>0)&&(V=[])}else B=vp,(!V||V.length>0)&&(V=[]);return wp(n)}unpackMultiple(e,t){let n,r=0;try{xp=!0;let i=e.length,a=this?this.unpack(e,i):$p.unpack(e,i);if(t){if(t(a,r,z)===!1)return;for(;z<i;)if(r=z,t(wp(),r,z)===!1)return}else{for(n=[a];z<i;)r=z,n.push(wp());return n}}catch(e){throw e.lastPosition=r,e.values=n,e}finally{xp=!1,Zp()}}_mergeStructures(e,t){this._onLoadedStructures&&(e=this._onLoadedStructures(e)),e||=[],Object.isFrozen(e)&&(e=e.map(e=>e.slice(0)));for(let t=0,n=e.length;t<n;t++){let n=e[t];n&&(n.isShared=!0,t>=32&&(n.highByte=t-32>>5))}e.sharedLength=e.length;for(let n in t||[])if(n>=0){let r=e[n],i=t[n];i&&(r&&((e.restoreStructures||=[])[n]=r),e[n]=i)}return this.structures=e}decode(e,t){return this.unpack(e,t)}};function wp(e){try{if(!B.trusted&&!xp){let e=V.sharedLength||0;e<V.length&&(V.length=e)}let t;if(B._readStruct&&R[z]<64&&R[z]>=32?(t=B._readStruct(R,z,lp),R=null,!(e&&e.lazy)&&t&&(t=t.toJSON()),z=lp):t=W(),H&&=(z=H.postBundlePosition,null),xp&&(V.restoreStructures=null),z==lp)V&&V.restoreStructures&&Tp(),V=null,R=null,gp&&=null;else if(z>lp)throw Error(`Unexpected end of MessagePack data`);else if(!xp){let e;try{e=JSON.stringify(t,(e,t)=>typeof t==`bigint`?`${t}n`:t).slice(0,100)}catch(t){e=`(JSON view not available `+t+`)`}throw Error(`Data read, but end of buffer not reached `+e)}return t}catch(e){throw V&&V.restoreStructures&&Tp(),Zp(),(e instanceof RangeError||e.message.startsWith(`Unexpected end of buffer`)||z>lp)&&(e.incomplete=!0),e}}function Tp(){for(let e in V.restoreStructures)V[e]=V.restoreStructures[e];V.restoreStructures=null}function W(){let e=R[z++];if(e<160)if(e<128){if(e<64)return e;{let t=V[e&63]||B.getStructures&&kp()[e&63];return t?(t.read||=Dp(t,e&63),t.read()):e}}else if(e<144)if(e-=128,B.mapsAsObjects){let t={};for(let n=0;n<e;n++){let e=Up();e===`__proto__`&&(e=`__proto_`),t[e]=W()}return t}else{let t=new Map;for(let n=0;n<e;n++)t.set(W(),W());return t}else{e-=144;let t=Array(e);for(let n=0;n<e;n++)t[n]=W();return B.freezeData?Object.freeze(t):t}else if(e<192){let t=e-160;if(hp>=z)return pp.slice(z-mp,(z+=t)-mp);if(hp==0&&lp<140){let e=t<16?Rp(t):Lp(t);if(e!=null)return e}return Ap(t)}else{let t;switch(e){case 192:return null;case 193:return H?(t=W(),t>0?H[1].slice(H.position1,H.position1+=t):H[0].slice(H.position0,H.position0-=t)):bp;case 194:return!1;case 195:return!0;case 196:if(t=R[z++],t===void 0)throw Error(`Unexpected end of buffer`);return Bp(t);case 197:return t=U.getUint16(z),z+=2,Bp(t);case 198:return t=U.getUint32(z),z+=4,Bp(t);case 199:return Vp(R[z++]);case 200:return t=U.getUint16(z),z+=2,Vp(t);case 201:return t=U.getUint32(z),z+=4,Vp(t);case 202:if(t=U.getFloat32(z),B.useFloat32>2){let e=Qp[(R[z]&127)<<1|R[z+1]>>7];return z+=4,(e*t+(t>0?.5:-.5)>>0)/e}return z+=4,t;case 203:return t=U.getFloat64(z),z+=8,t;case 204:return R[z++];case 205:return t=U.getUint16(z),z+=2,t;case 206:return t=U.getUint32(z),z+=4,t;case 207:return B.int64AsType===`number`?(t=U.getUint32(z)*4294967296,t+=U.getUint32(z+4)):B.int64AsType===`string`?t=U.getBigUint64(z).toString():B.int64AsType===`auto`?(t=U.getBigUint64(z),t<=BigInt(2)<<BigInt(52)&&(t=Number(t))):t=U.getBigUint64(z),z+=8,t;case 208:return U.getInt8(z++);case 209:return t=U.getInt16(z),z+=2,t;case 210:return t=U.getInt32(z),z+=4,t;case 211:return B.int64AsType===`number`?(t=U.getInt32(z)*4294967296,t+=U.getUint32(z+4)):B.int64AsType===`string`?t=U.getBigInt64(z).toString():B.int64AsType===`auto`?(t=U.getBigInt64(z),t>=BigInt(-2)<<BigInt(52)&&t<=BigInt(2)<<BigInt(52)&&(t=Number(t))):t=U.getBigInt64(z),z+=8,t;case 212:if(t=R[z++],t==114)return Gp(R[z++]&63);{let e=_p[t];if(e)return e.read?(z++,e.read(W())):e.noBuffer?(z++,e()):e(R.subarray(z,++z));throw Error(`Unknown extension `+t)}case 213:return t=R[z],t==114?(z++,Gp(R[z++]&63,R[z++])):Vp(2);case 214:return Vp(4);case 215:return Vp(8);case 216:return Vp(16);case 217:return t=R[z++],hp>=z?pp.slice(z-mp,(z+=t)-mp):jp(t);case 218:return t=U.getUint16(z),z+=2,hp>=z?pp.slice(z-mp,(z+=t)-mp):Mp(t);case 219:return t=U.getUint32(z),z+=4,hp>=z?pp.slice(z-mp,(z+=t)-mp):Np(t);case 220:return t=U.getUint16(z),z+=2,Fp(t);case 221:return t=U.getUint32(z),z+=4,Fp(t);case 222:return t=U.getUint16(z),z+=2,Ip(t);case 223:return t=U.getUint32(z),z+=4,Ip(t);default:if(e>=224)return e-256;if(e===void 0){let e=Error(`Unexpected end of MessagePack data`);throw e.incomplete=!0,e}throw Error(`Unknown MessagePack token `+e)}}}var Ep=/^[a-zA-Z_$][a-zA-Z\d_$]*$/;function Dp(e,t){function n(){if(n.count++>Sp){let r;try{r=e.read=Function(`r`,`return function(){return `+(B.freezeData?`Object.freeze`:``)+`({`+e.map(e=>e===`__proto__`?`__proto_:r()`:Ep.test(e)?e+`:r()`:`[`+JSON.stringify(e)+`]:r()`).join(`,`)+`})}`)(W)}catch{return Sp=1/0,n()}return e.highByte===0&&(e.read=Op(t,e.read)),r()}let r={};for(let t=0,n=e.length;t<n;t++){let n=e[t];n===`__proto__`&&(n=`__proto_`),r[n]=W()}return B.freezeData?Object.freeze(r):r}return n.count=0,e.highByte===0?Op(t,n):n}var Op=(e,t)=>function(){let n=R[z++];if(n===0)return t();let r=e<32?-(e+(n<<5)):e+(n<<5),i=V[r]||kp()[r];if(!i)throw Error(`Record id is not defined for `+r);return i.read||=Dp(i,e),i.read()};function kp(){let e=Xp(()=>(R=null,B.getStructures()));return V=B._mergeStructures(e,V)}var Ap=Pp,jp=Pp,Mp=Pp,Np=Pp;function Pp(e){let t;if(e<16&&(t=Rp(e)))return t;if(e>64&&cp)return cp.decode(R.subarray(z,z+=e));let n=z+e,r=[];for(t=``;z<n;){let e=R[z++];if(!(e&128))r.push(e);else if((e&224)==192){let t=R[z++]&63,n=(e&31)<<6|t;n<128?r.push(65533):r.push(n)}else if((e&240)==224){let t=R[z++]&63,n=R[z++]&63,i=(e&31)<<12|t<<6|n;i<2048||i>=55296&&i<=57343?r.push(65533):r.push(i)}else if((e&248)==240){let t=R[z++]&63,n=R[z++]&63,i=R[z++]&63,a=(e&7)<<18|t<<12|n<<6|i;a<65536||a>1114111?r.push(65533):a>65535?(a-=65536,r.push(a>>>10&1023|55296),a=56320|a&1023,r.push(a)):r.push(a)}else r.push(65533);r.length>=4096&&(t+=G.apply(String,r),r.length=0)}return r.length>0&&(t+=G.apply(String,r)),t}function Fp(e){let t=Array(e);for(let n=0;n<e;n++)t[n]=W();return B.freezeData?Object.freeze(t):t}function Ip(e){if(B.mapsAsObjects){let t={};for(let n=0;n<e;n++){let e=Up();e===`__proto__`&&(e=`__proto_`),t[e]=W()}return t}else{let t=new Map;for(let n=0;n<e;n++)t.set(W(),W());return t}}var G=String.fromCharCode;function Lp(e){let t=z,n=Array(e);for(let r=0;r<e;r++){let e=R[z++];if((e&128)>0){z=t;return}n[r]=e}return G.apply(String,n)}function Rp(e){if(e<4)if(e<2){if(e===0)return``;{let e=R[z++];if((e&128)>1){--z;return}return G(e)}}else{let t=R[z++],n=R[z++];if((t&128)>0||(n&128)>0){z-=2;return}if(e<3)return G(t,n);let r=R[z++];if((r&128)>0){z-=3;return}return G(t,n,r)}else{let t=R[z++],n=R[z++],r=R[z++],i=R[z++];if((t&128)>0||(n&128)>0||(r&128)>0||(i&128)>0){z-=4;return}if(e<6){if(e===4)return G(t,n,r,i);{let e=R[z++];if((e&128)>0){z-=5;return}return G(t,n,r,i,e)}}else if(e<8){let a=R[z++],o=R[z++];if((a&128)>0||(o&128)>0){z-=6;return}if(e<7)return G(t,n,r,i,a,o);let s=R[z++];if((s&128)>0){z-=7;return}return G(t,n,r,i,a,o,s)}else{let a=R[z++],o=R[z++],s=R[z++],c=R[z++];if((a&128)>0||(o&128)>0||(s&128)>0||(c&128)>0){z-=8;return}if(e<10){if(e===8)return G(t,n,r,i,a,o,s,c);{let e=R[z++];if((e&128)>0){z-=9;return}return G(t,n,r,i,a,o,s,c,e)}}else if(e<12){let l=R[z++],u=R[z++];if((l&128)>0||(u&128)>0){z-=10;return}if(e<11)return G(t,n,r,i,a,o,s,c,l,u);let d=R[z++];if((d&128)>0){z-=11;return}return G(t,n,r,i,a,o,s,c,l,u,d)}else{let l=R[z++],u=R[z++],d=R[z++],f=R[z++];if((l&128)>0||(u&128)>0||(d&128)>0||(f&128)>0){z-=12;return}if(e<14){if(e===12)return G(t,n,r,i,a,o,s,c,l,u,d,f);{let e=R[z++];if((e&128)>0){z-=13;return}return G(t,n,r,i,a,o,s,c,l,u,d,f,e)}}else{let p=R[z++],m=R[z++];if((p&128)>0||(m&128)>0){z-=14;return}if(e<15)return G(t,n,r,i,a,o,s,c,l,u,d,f,p,m);let h=R[z++];if((h&128)>0){z-=15;return}return G(t,n,r,i,a,o,s,c,l,u,d,f,p,m,h)}}}}}function zp(){let e=R[z++],t;if(e<192)t=e-160;else switch(e){case 217:t=R[z++];break;case 218:t=U.getUint16(z),z+=2;break;case 219:t=U.getUint32(z),z+=4;break;default:throw Error(`Expected string`)}return Pp(t)}function Bp(e){return B.copyBuffers?Uint8Array.prototype.slice.call(R,z,z+=e):R.subarray(z,z+=e)}function Vp(e){let t=R[z++];if(_p[t]){let n;return _p[t](R.subarray(z,n=z+=e),e=>{z=e;try{return W()}finally{z=n}})}else throw Error(`Unknown extension type `+t)}var Hp=Array(4096);function Up(){let e=R[z++];if(e>=160&&e<192){if(e-=160,hp>=z)return pp.slice(z-mp,(z+=e)-mp);if(!(hp==0&&lp<180))return Ap(e)}else return z--,Wp(W());let t=(e<<5^(e>1?U.getUint16(z):e>0?R[z]:0))&4095,n=Hp[t],r=z,i=z+e-3,a,o=0;if(n&&n.bytes==e){for(;r<i;){if(a=U.getUint32(r),a!=n[o++]){r=1879048192;break}r+=4}for(i+=3;r<i;)if(a=R[r++],a!=n[o++]){r=1879048192;break}if(r===i)return z=r,n.string;i-=3,r=z}for(n=[],Hp[t]=n,n.bytes=e;r<i;)a=U.getUint32(r),n.push(a),r+=4;for(i+=3;r<i;)a=R[r++],n.push(a);let s=e<16?Rp(e):Lp(e);return s==null?n.string=Ap(e):n.string=s}function Wp(e){if(typeof e==`string`)return e;if(typeof e==`number`||typeof e==`boolean`||typeof e==`bigint`)return e.toString();if(e==null)return e+``;if(B.allowArraysInMapKeys&&Array.isArray(e)&&e.flat().every(e=>[`string`,`number`,`boolean`,`bigint`].includes(typeof e)))return e.flat().toString();throw Error(`Invalid property type for record: ${typeof e}`)}var Gp=(e,t)=>{let n=W().map(Wp),r=e;t!==void 0&&(e=e<32?-((t<<5)+e):(t<<5)+e,n.highByte=t);let i=V[e];return i&&(i.isShared||xp)&&((V.restoreStructures||=[])[e]=i),V[e]=n,n.read=Dp(n,r),n.read()};_p[0]=()=>{},_p[0].noBuffer=!0,_p[66]=e=>{let t=e.byteLength%8||8,n=BigInt(e[0]&128?e[0]-256:e[0]);for(let r=1;r<t;r++)n<<=BigInt(8),n+=BigInt(e[r]);if(e.byteLength!==t){let r=new DataView(e.buffer,e.byteOffset,e.byteLength),i=(e,t)=>{let n=t-e;if(n<=40){let n=r.getBigUint64(e);for(let i=e+8;i<t;i+=8)n<<=BigInt(64),n|=r.getBigUint64(i);return n}let a=e+(n>>4<<3),o=i(e,a),s=i(a,t);return o<<BigInt((t-a)*8)|s};n=n<<BigInt((r.byteLength-t)*8)|i(t,r.byteLength)}return n};var Kp={Error,EvalError,RangeError,ReferenceError,SyntaxError,TypeError,URIError,AggregateError:typeof AggregateError==`function`?AggregateError:null};_p[101]=()=>{let e=W();if(!Kp[e[0]]){let t=Error(e[1],{cause:e[2]});return t.name=e[0],t}return Kp[e[0]](e[1],{cause:e[2]})},_p[105]=e=>{if(B.structuredClone===!1)throw Error(`Structured clone extension is disabled`);let t=U.getUint32(z-4);gp||=new Map;let n=R[z],r;r=n>=144&&n<160||n==220||n==221?[]:n>=128&&n<144||n==222||n==223?new Map:(n>=199&&n<=201||n>=212&&n<=216)&&R[z+1]===115?new Set:{};let i={target:r};gp.set(t,i);let a=W();if(i.used)Object.assign(r,a);else return i.target=a;if(r instanceof Map)for(let[e,t]of a.entries())r.set(e,t);if(r instanceof Set)for(let e of Array.from(a))r.add(e);return r},_p[112]=e=>{if(B.structuredClone===!1)throw Error(`Structured clone extension is disabled`);let t=U.getUint32(z-4),n=gp.get(t);return n.used=!0,n.target},_p[115]=()=>new Set(W());var qp=[`Int8`,`Uint8`,`Uint8Clamped`,`Int16`,`Uint16`,`Int32`,`Uint32`,`Float32`,`Float64`,`BigInt64`,`BigUint64`].map(e=>e+`Array`),Jp=typeof globalThis==`object`?globalThis:window;_p[116]=e=>{let t=e[0],n=Uint8Array.prototype.slice.call(e,1).buffer,r=qp[t];if(!r){if(t===16)return n;if(t===17)return new DataView(n);throw Error(`Could not find typed array for code `+t)}return new Jp[r](n)},_p[120]=()=>{let e=W();return new RegExp(e[0],e[1])};var Yp=[];_p[98]=e=>{let t=(e[0]<<24)+(e[1]<<16)+(e[2]<<8)+e[3],n=z;return z+=t-e.length,H=Yp,H=[zp(),zp()],H.position0=0,H.position1=0,H.postBundlePosition=z,z=n,W()},_p[255]=e=>e.length==4?new Date((e[0]*16777216+(e[1]<<16)+(e[2]<<8)+e[3])*1e3):e.length==8?new Date(((e[0]<<22)+(e[1]<<14)+(e[2]<<6)+(e[3]>>2))/1e6+((e[3]&3)*4294967296+e[4]*16777216+(e[5]<<16)+(e[6]<<8)+e[7])*1e3):e.length==12?new Date(((e[0]<<24)+(e[1]<<16)+(e[2]<<8)+e[3])/1e6+((e[4]&128?-281474976710656:0)+e[6]*1099511627776+e[7]*4294967296+e[8]*16777216+(e[9]<<16)+(e[10]<<8)+e[11])*1e3):new Date(`invalid`);function Xp(e){B&&B._onSaveState&&B._onSaveState();let t=lp,n=z,r=fp,i=mp,a=hp,o=pp,s=dp,c=gp,l=H,u=new Uint8Array(R.slice(0,lp)),d=V,f=V.slice(0,V.length),p=B,m=xp,h=e();return lp=t,z=n,fp=r,mp=i,hp=a,pp=o,dp=s,gp=c,H=l,R=u,xp=m,V=d,V.splice(0,V.length,...f),B=p,U=new DataView(R.buffer,R.byteOffset,R.byteLength),h}function Zp(){R=null,gp=null,V=null}var Qp=Array(147);for(let e=0;e<256;e++)Qp[e]=+(`1e`+Math.floor(45.15-e*.30103));var $p=new Cp({useRecords:!1});$p.unpack,$p.unpackMultiple,$p.unpack;var em={NEVER:0,ALWAYS:1,DECIMAL_ROUND:3,DECIMAL_FIT:4};new Uint8Array(new Float32Array(1).buffer,0,4),Cp.SUPPORTS_STRUCT_HOOKS=!0;var tm;try{tm=new TextEncoder}catch{}var nm,rm,im=typeof Buffer<`u`,am=im?function(e){return Buffer.allocUnsafeSlow(e)}:Uint8Array,om=im?Buffer:Uint8Array,sm=im?4294967296:2144337920,K,cm,q,J=0,Y,X=null,lm=21760,um=/[\u0080-\uFFFF]/,dm=Symbol(`record-id`),fm=class extends Cp{constructor(e){super(e),this.offset=0;let t,n,r,i,a=om.prototype.utf8Write?function(e,t){return K.utf8Write(e,t,K.byteLength-t)}:tm&&tm.encodeInto?function(e,t){return tm.encodeInto(e,K.subarray(t)).written}:!1,o=this;e||={};let s=e&&e.sequential,c=e.structures||e.saveStructures,l=e.maxSharedStructures;if(l??=c?32:0,l>8160)throw Error(`Maximum maxSharedStructure is 8160`);e.structuredClone&&e.moreTypes==null&&(this.moreTypes=!0);let u=e.maxOwnStructures;u??=c?32:64,!this.structures&&e.useRecords!=0&&(this.structures=[]);let d=l>32||u+l>64,f=l+64,p=l+u+64;if(p>8256)throw Error(`Maximum maxSharedStructure + maxOwnStructure is 8192`);let m=[],h=0,ee=0;this.pack=this.encode=function(e,a){if(K||(K=new am(8192),q=K.dataView||=new DataView(K.buffer,0,8192),J=0),Y=K.length-10,Y-J<2048?(K=new am(K.length),q=K.dataView||=new DataView(K.buffer,0,K.length),Y=K.length-10,J=0):J=J+7&2147483640,t=J,a&2048&&(J+=a&255),i=o.structuredClone?new Map:null,o.bundleStrings&&typeof e!=`string`?(X=[],X.size=1/0):X=null,r=o.structures,r){r.uninitialized&&(r=o._mergeStructures(o.getStructures()));let e=r.sharedLength||0;if(e>l)throw Error(`Shared structures is larger than maximum shared structures, try increasing maxSharedStructures to `+r.sharedLength);if(!r.transitions){r.transitions=Object.create(null);for(let t=0;t<e;t++){let e=r[t];if(!e)continue;let n,i=r.transitions;for(let t=0,r=e.length;t<r;t++){let r=e[t];n=i[r],n||=i[r]=Object.create(null),i=n}i[dm]=t+64}this.lastNamedStructuresLength=e}s||(r.nextId=e+64)}n&&=!1;let c;try{o._writeStruct&&e&&typeof e==`object`?e.constructor===Object?se(e):e.constructor!==Map&&!Array.isArray(e)&&!rm.some(t=>e instanceof t)?se(e.toJSON?e.toJSON():e):g(e):g(e);let n=X;if(X&&_m(t,g,0),i&&i.idsToInsert){let e=i.idsToInsert.sort((e,t)=>e.offset>t.offset?1:-1),r=e.length,a=-1;for(;n&&r>0;){let i=e[--r].offset+t;i<n.stringsPosition+t&&a===-1&&(a=0),i>n.position+t?a>=0&&(a+=6):(a>=0&&(q.setUint32(n.position+t,q.getUint32(n.position+t)+a),a=-1),n=n.previous,r++)}a>=0&&n&&q.setUint32(n.position+t,q.getUint32(n.position+t)+a),J+=e.length*6,J>Y&&ce(J),o.offset=J;let s=gm(K.subarray(t,J),e);return i=null,s}return o.offset=J,a&512?(K.start=t,K.end=J,K):K.subarray(t,J)}catch(e){throw c=e,e}finally{if(r&&(te(),n&&o.saveStructures)){let n=r.sharedLength||0,i=K.subarray(t,J),s=(o._prepareStructures||vm)(r,o);if(!c)return o.saveStructures(s,s.isCompatible)===!1?o.pack(e,a):(o.lastNamedStructuresLength=n,K.length>1073741824&&(K=null),i)}K.length>1073741824&&(K=null),a&1024&&(J=t)}};let te=()=>{ee<10&&ee++;let e=r.sharedLength||0;if(r.length>e&&!s&&(r.length=e),h>1e4)r.transitions=null,ee=0,h=0,m.length>0&&(m=[]);else if(m.length>0&&!s){for(let e=0,t=m.length;e<t;e++)m[e][dm]=0;m=[]}},ne=e=>{var t=e.length;t<16?K[J++]=144|t:t<65536?(K[J++]=220,K[J++]=t>>8,K[J++]=t&255):(K[J++]=221,q.setUint32(J,t),J+=4);for(let n=0;n<t;n++)g(e[n])},g=e=>{J>Y&&(K=ce(J));var n=typeof e,r;if(n===`string`){let n=e.length;if(X&&n>=4&&n<4096){if((X.size+=n)>lm){let e,n=(X[0]?X[0].length*3+X[1].length:0)+10;J+n>Y&&(K=ce(J+n));let r;X.position?(r=X,K[J]=200,J+=3,K[J++]=98,e=J-t,J+=4,_m(t,g,0),q.setUint16(e+t-3,J-t-e)):(K[J++]=214,K[J++]=98,e=J-t,J+=4),X=[``,``],X.previous=r,X.size=0,X.position=e}let r=um.test(e);X[+!r]+=e,K[J++]=193,g(r?-n:n);return}let i;i=n<32?1:n<256?2:n<65536?3:5;let o=n*3;if(J+o>Y&&(K=ce(J+o)),n<64||!a){let t,a,o,s=J+i;for(t=0;t<n;t++)a=e.charCodeAt(t),a<128?K[s++]=a:a<2048?(K[s++]=a>>6|192,K[s++]=a&63|128):(a&64512)==55296&&((o=e.charCodeAt(t+1))&64512)==56320?(a=65536+((a&1023)<<10)+(o&1023),t++,K[s++]=a>>18|240,K[s++]=a>>12&63|128,K[s++]=a>>6&63|128,K[s++]=a&63|128):(K[s++]=a>>12|224,K[s++]=a>>6&63|128,K[s++]=a&63|128);r=s-J-i}else r=a(e,J+i);r<32?K[J++]=160|r:r<256?(i<2&&K.copyWithin(J+2,J+1,J+1+r),K[J++]=217,K[J++]=r):r<65536?(i<3&&K.copyWithin(J+3,J+2,J+2+r),K[J++]=218,K[J++]=r>>8,K[J++]=r&255):(i<5&&K.copyWithin(J+5,J+3,J+3+r),K[J++]=219,q.setUint32(J,r),J+=4),J+=r}else if(n===`number`)if(e>>>0===e)e<32||e<128&&this.useRecords===!1||e<64&&!this._writeStruct?K[J++]=e:e<256?(K[J++]=204,K[J++]=e):e<65536?(K[J++]=205,K[J++]=e>>8,K[J++]=e&255):(K[J++]=206,q.setUint32(J,e),J+=4);else if(e>>0===e)e>=-32?K[J++]=256+e:e>=-128?(K[J++]=208,K[J++]=e+256):e>=-32768?(K[J++]=209,q.setInt16(J,e),J+=2):(K[J++]=210,q.setInt32(J,e),J+=4);else{let t;if((t=this.useFloat32)>0&&e<4294967296&&e>=-2147483648){K[J++]=202,q.setFloat32(J,e);let n;if(t<4||(n=e*Qp[(K[J]&127)<<1|K[J+1]>>7])>>0===n){J+=4;return}else J--}K[J++]=203,q.setFloat64(J,e),J+=8}else if(n===`object`||n===`function`)if(!e)K[J++]=192;else{if(i){let n=i.get(e);if(n){n.id||=(i.idsToInsert||=[]).push(n),K[J++]=214,K[J++]=112,q.setUint32(J,n.id),J+=4;return}else i.set(e,{offset:J-t})}let a=e.constructor;if(a===Object)oe(e);else if(a===Array)ne(e);else if(a===Map)if(this.mapAsEmptyObject)K[J++]=128;else{r=e.size,r<16?K[J++]=128|r:r<65536?(K[J++]=222,K[J++]=r>>8,K[J++]=r&255):(K[J++]=223,q.setUint32(J,r),J+=4);for(let[t,n]of e)g(t),g(n)}else{for(let t=0,n=nm.length;t<n;t++){let n=rm[t];if(e instanceof n){let n=nm[t];if(n.write){n.type&&(K[J++]=212,K[J++]=n.type,K[J++]=0);let t=n.write.call(this,e);t===e?Array.isArray(e)?ne(e):oe(e):g(t);return}let r=K,i=q,a=J;K=null;let o;try{o=n.pack.call(this,e,e=>(K=r,r=null,J+=e,J>Y&&ce(J),{target:K,targetView:q,position:J-e}),g)}finally{r&&(K=r,q=i,J=a,Y=K.length-10)}o&&(o.length+J>Y&&ce(o.length+J),J=hm(o,K,J,n.type));return}}if(Array.isArray(e))ne(e);else{if(e.toJSON){let t=e.toJSON();if(t!==e)return g(t)}if(n===`function`)return g(this.writeFunction&&this.writeFunction(e));oe(e)}}}else if(n===`boolean`)K[J++]=e?195:194;else if(n===`bigint`){if(e<0x8000000000000000&&e>=-0x8000000000000000)K[J++]=211,q.setBigInt64(J,e);else if(e<0x10000000000000000&&e>0)K[J++]=207,q.setBigUint64(J,e);else if(this.largeBigIntToFloat)K[J++]=203,q.setFloat64(J,Number(e));else if(this.largeBigIntToString)return g(e.toString());else if(this.useBigIntExtension||this.moreTypes){let t=BigInt(e<0?-1:0),n;if(e>>BigInt(65536)===t){let r=BigInt(0x10000000000000000)-BigInt(1),i=[];for(;i.push(e&r),e>>BigInt(63)!==t;)e>>=BigInt(64);n=new Uint8Array(new BigUint64Array(i).buffer),n.reverse()}else{let t=e<0,r=(t?~e:e).toString(16);if(r.length%2?r=`0`+r:parseInt(r.charAt(0),16)>=8&&(r=`00`+r),im)n=Buffer.from(r,`hex`);else{n=new Uint8Array(r.length/2);for(let e=0;e<n.length;e++)n[e]=parseInt(r.slice(e*2,e*2+2),16)}if(t)for(let e=0;e<n.length;e++)n[e]=~n[e]}n.length+J>Y&&ce(n.length+J),J=hm(n,K,J,66);return}else throw RangeError(e+` was too large to fit in MessagePack 64-bit integer format, use useBigIntExtension, or set largeBigIntToFloat to convert to float-64, or set largeBigIntToString to convert to string`);J+=8}else if(n===`undefined`)this.encodeUndefinedAsNil?K[J++]=192:(K[J++]=212,K[J++]=0,K[J++]=0);else throw Error(`Unknown type: `+n)},re=this.variableMapSize||this.coercibleKeyAsNumber||this.skipValues?e=>{let t;if(this.skipValues){t=[];for(let n in e)(typeof e.hasOwnProperty!=`function`||e.hasOwnProperty(n))&&!this.skipValues.includes(e[n])&&t.push(n)}else t=Object.keys(e);let n=t.length;n<16?K[J++]=128|n:n<65536?(K[J++]=222,K[J++]=n>>8,K[J++]=n&255):(K[J++]=223,q.setUint32(J,n),J+=4);let r;if(this.coercibleKeyAsNumber)for(let i=0;i<n;i++){r=t[i];let n=Number(r);g(isNaN(n)?r:n),g(e[r])}else for(let i=0;i<n;i++)g(r=t[i]),g(e[r])}:e=>{K[J++]=222;let n=J-t;J+=2;let r=0;for(let t in e)(typeof e.hasOwnProperty!=`function`||e.hasOwnProperty(t))&&(g(t),g(e[t]),r++);if(r>65535)throw Error(`Object is too large to serialize with fast 16-bit map size, use the "variableMapSize" option to serialize this object`);K[n+++t]=r>>8,K[n+t]=r&255},ie=this.useRecords===!1?re:e.progressiveRecords&&!d?e=>{let n,i=r.transitions||=Object.create(null),a=J++-t,o;for(let s in e)if(typeof e.hasOwnProperty!=`function`||e.hasOwnProperty(s)){if(n=i[s],n)i=n;else{let c=Object.keys(e),l=i;i=r.transitions;let u=0;for(let e=0,t=c.length;e<t;e++){let t=c[e];n=i[t],n||(n=i[t]=Object.create(null),u++),i=n}a+t+1==J?(J--,le(i,c,u)):ue(i,c,a,u),o=!0,i=l[s]}g(e[s])}if(!o){let n=i[dm];n?K[a+t]=n:ue(i,Object.keys(e),a,0)}}:e=>{let t,n=r.transitions||=Object.create(null),i=0;for(let r in e)(typeof e.hasOwnProperty!=`function`||e.hasOwnProperty(r))&&(t=n[r],t||(t=n[r]=Object.create(null),i++),n=t);let a=n[dm];a?a>=96&&d?(K[J++]=((a-=96)&31)+96,K[J++]=a>>5):K[J++]=a:le(n,n.__keys__||Object.keys(e),i);for(let t in e)(typeof e.hasOwnProperty!=`function`||e.hasOwnProperty(t))&&g(e[t])},ae=typeof this.useRecords==`function`&&this.useRecords,oe=ae?e=>{ae(e)?ie(e):re(e)}:ie,se=e=>{let i=o._writeStruct(e,K,t,J,r,ce,(e,t,r)=>{if(r)return n=!0;J=t;let i=K;return g(e),te(),i===K?J:{position:J,targetView:q,target:K}});if(i===0)return oe(e);J=i},ce=e=>{let n;if(e>16777216){if(e-t>sm)throw Error(`Packed buffer would be larger than maximum buffer size`);n=Math.min(sm,Math.round(Math.max((e-t)*(e>67108864?1.25:2),4194304)/4096)*4096)}else n=(Math.max(e-t<<2,K.length-1)>>12)+1<<12;let r=new am(n);return q=r.dataView||=new DataView(r.buffer,0,n),e=Math.min(e,K.length),K.copy?K.copy(r,0,t,e):r.set(K.slice(t,e)),J-=t,t=0,Y=r.length-10,K=r},le=(e,t,i)=>{let a=r.nextId;a||=64,a<f&&this.shouldShareStructure&&!this.shouldShareStructure(t)?(a=r.nextOwnId,a<p||(a=f),r.nextOwnId=a+1):(a>=p&&(a=f),r.nextId=a+1);let o=t.highByte=a>=96&&d?a-96>>5:-1;e[dm]=a,e.__keys__=t,r[a-64]=t,a<f?(t.isShared=!0,r.sharedLength=a-63,n=!0,o>=0?(K[J++]=(a&31)+96,K[J++]=o):K[J++]=a):(o>=0?(K[J++]=213,K[J++]=114,K[J++]=(a&31)+96,K[J++]=o):(K[J++]=212,K[J++]=114,K[J++]=a),i&&(h+=ee*i),m.length>=u&&(m.shift()[dm]=0),m.push(e),g(t))},ue=(e,n,r,i)=>{let a=K,o=J,s=Y,c=t;K=cm,J=0,t=0,K||(cm=K=new am(8192)),Y=K.length-10,le(e,n,i),cm=K;let l=J;if(K=a,J=o,Y=s,t=c,l>1){let e=J+l-1;e>Y&&ce(e);let n=r+t;K.copyWithin(n+l,n+1,J),K.set(cm.slice(0,l),n),J=e}else K[r+t]=cm[0]}}useBuffer(e){K=e,K.dataView||=new DataView(K.buffer,K.byteOffset,K.byteLength),q=K.dataView,J=0}set position(e){J=e}get position(){return J}clearSharedData(){this.structures&&=[],this.typedStructs&&=[]}};rm=[Date,Set,Error,RegExp,ArrayBuffer,Object.getPrototypeOf(Uint8Array.prototype).constructor,DataView,yp],nm=[{pack(e,t,n){let r=e.getTime()/1e3;if((this.useTimestamp32||e.getMilliseconds()===0)&&r>=0&&r<4294967296){let{target:e,targetView:n,position:i}=t(6);e[i++]=214,e[i++]=255,n.setUint32(i,r)}else if(r>0&&r<4294967296){let{target:n,targetView:i,position:a}=t(10);n[a++]=215,n[a++]=255,i.setUint32(a,e.getMilliseconds()*4e6+(r/1e3/4294967296>>0)),i.setUint32(a+4,r)}else if(isNaN(r)){if(this.onInvalidDate)return t(0),n(this.onInvalidDate());let{target:e,targetView:r,position:i}=t(3);e[i++]=212,e[i++]=255,e[i++]=255}else{let{target:n,targetView:i,position:a}=t(15);n[a++]=199,n[a++]=12,n[a++]=255,i.setUint32(a,e.getMilliseconds()*1e6),i.setBigInt64(a+4,BigInt(Math.floor(r)))}}},{pack(e,t,n){if(this.setAsEmptyObject)return t(0),n({});let r=Array.from(e),{target:i,position:a}=t(this.moreTypes?3:0);this.moreTypes&&(i[a++]=212,i[a++]=115,i[a++]=0),n(r)}},{pack(e,t,n){let{target:r,position:i}=t(this.moreTypes?3:0);this.moreTypes&&(r[i++]=212,r[i++]=101,r[i++]=0),n([e.name,e.message,e.cause])}},{pack(e,t,n){let{target:r,position:i}=t(this.moreTypes?3:0);this.moreTypes&&(r[i++]=212,r[i++]=120,r[i++]=0),n([e.source,e.flags])}},{pack(e,t){this.moreTypes?pm(e,16,t):mm(im?Buffer.from(e):new Uint8Array(e),t)}},{pack(e,t){let n=e.constructor;n!==om&&this.moreTypes?pm(e,qp.indexOf(n.name),t):mm(e,t)}},{pack(e,t){this.moreTypes?pm(e,17,t):mm(im?Buffer.from(e):new Uint8Array(e),t)}},{pack(e,t){let{target:n,position:r}=t(1);n[r]=193}}];function pm(e,t,n,r){let i=e.byteLength;if(i+1<256){var{target:a,position:o}=n(4+i);a[o++]=199,a[o++]=i+1}else if(i+1<65536){var{target:a,position:o}=n(5+i);a[o++]=200,a[o++]=i+1>>8,a[o++]=i+1&255}else{var{target:a,position:o,targetView:s}=n(7+i);a[o++]=201,s.setUint32(o,i+1),o+=4}a[o++]=116,a[o++]=t,e.buffer||(e=new Uint8Array(e)),a.set(new Uint8Array(e.buffer,e.byteOffset,e.byteLength),o)}function mm(e,t){let n=e.byteLength;var r,i;if(n<256){var{target:r,position:i}=t(n+2);r[i++]=196,r[i++]=n}else if(n<65536){var{target:r,position:i}=t(n+3);r[i++]=197,r[i++]=n>>8,r[i++]=n&255}else{var{target:r,position:i,targetView:a}=t(n+5);r[i++]=198,a.setUint32(i,n),i+=4}r.set(e,i)}function hm(e,t,n,r){let i=e.length;switch(i){case 1:t[n++]=212;break;case 2:t[n++]=213;break;case 4:t[n++]=214;break;case 8:t[n++]=215;break;case 16:t[n++]=216;break;default:i<256?(t[n++]=199,t[n++]=i):i<65536?(t[n++]=200,t[n++]=i>>8,t[n++]=i&255):(t[n++]=201,t[n++]=i>>24,t[n++]=i>>16&255,t[n++]=i>>8&255,t[n++]=i&255)}return t[n++]=r,t.set(e,n),n+=i,n}function gm(e,t){let n,r=t.length*6,i=e.length-r;for(;n=t.pop();){let t=n.offset,a=n.id;e.copyWithin(t+r,t,i),r-=6;let o=t+r;e[o++]=214,e[o++]=105,e[o++]=a>>24,e[o++]=a>>16&255,e[o++]=a>>8&255,e[o++]=a&255,i=t}return e}function _m(e,t,n){if(X.length>0){q.setUint32(X.position+e,J+n-X.position-e),X.stringsPosition=J-e;let r=X;X=null,t(r[0]),t(r[1])}}function vm(e,t){return e.isCompatible=e=>{let n=!e||(t.lastNamedStructuresLength||0)===e.length;return n||t._mergeStructures(e),n},e}fm.SUPPORTS_STRUCT_HOOKS=!0;var ym=new fm({useRecords:!1});ym.pack,ym.pack;var{NEVER:bm,ALWAYS:xm,DECIMAL_ROUND:Sm,DECIMAL_FIT:Cm}=em,wm=class extends F()(`effect/rpc/RpcSerialization`){},Tm=(e=>wm.of({contentType:`application/msgpack`,includesFraming:!0,makeUnsafe:()=>{let t=new Cp(e),n=new fm(e),r=new TextEncoder,i;return{decode(e){let n=typeof e==`string`?r.encode(e):e;if(i!==void 0){let t=n;e=new Uint8Array(i.length+n.length),e.set(i),e.set(t,i.length),n=e,i=void 0}try{return t.unpackMultiple(n)}catch(e){let t=e;if(t.incomplete)return i=n.subarray(t.lastPosition),t.values??[];throw e}},encode:e=>n.pack(e)}}}))({useRecords:!0}),Em=wi(wm)(Tm),Dm=e=>si(()=>{let t=new Set,n=new Map,r=new Map,i=(e,t)=>Pn(r=>{let i=n.get(e);return i||(i=[],n.set(e,i)),i.push([t,r]),T});return _(e((e,t)=>{let n=r.get(e);return n?n(t):i(e,t)},t),e=>({...e,run(e,i){return Bn(function*(){t.add(e),r.set(e,i);let a=n.get(e);if(a){n.delete(e);for(let[e,t]of a)yield*ga(si(()=>i(e)),t)}return yield*ht(nt,()=>(t.delete(e),r.delete(e),T))})}}))}),Om=BigInt(0),km=Qr(function*(e,t){let n=t?.spanPrefix??`RpcClient`,r=t?.supportsAck??!0,i=t?.disableTracing??!1,a=t?.generateRequestId??(()=>Om++),o=yield*Or(),s=kt(o,_n),c=new Map,u=!1;yield*un(s,Xi(e=>(u=!0,d(ur(e.id)))));let d=Qr(function*(e){for(let[t,n]of c)c.delete(t),n._tag===`Queue`?yield*e._tag===`Success`?uo(n.queue):co(n.queue,e.cause):n.resume(e)}),f=e=>{let r=Kf(e.successSchema),a=h(e);return(o,s)=>{let c=s?.headers?Lu(s.headers):Iu,l=s?.context??ra();if(!r){let r=t=>p(e,a,t,e.payloadSchema.make(o),c,l,s?.discard??!1);return i?r(void 0):ei(`${n}.${e._tag}`,{attributes:t.spanAttributes},r)}let u=m(e,a,e.payloadSchema.make(o),c,s?.streamBufferSize??16,l);return s?.asQueue?u:Ps(_(u,js))}},p=(e,n,r,i,o,s,l)=>Xi(d=>{if(u)return At;let f=a(),p=n(e=>t.onFromClient({message:e,context:s,discard:l}),{_tag:`Request`,id:f,tag:e._tag,payload:i,...r?{traceId:r.traceId,spanId:r.spanId,sampled:r.sampled}:{},headers:Vu(d.getRef(Pm),o)});if(l)return p;let m;return be(or(t=>{let n={_tag:`Effect`,rpc:e,context:s,resume(e){t(e),m&&!m.pollUnsafe()&&d.currentDispatcher.scheduleTask(()=>{m.interruptUnsafe(d.id)},0)}};c.set(f,n),m=p.pipe(r?da(r,{captureStackTrace:!1}):w,Te(d.context)),m.addObserver(e=>{if(e._tag===`Failure`)return t(e)})}),e=>(c.delete(f),vn(Sa(m),ee(f,Array.from(e),s))))}),m=Qr(function*(e,r,o,s,d,f){if(u)return yield*At;let p=i?void 0:yield*he(`${n}.${e._tag}`,{attributes:t.spanAttributes}),m=wa(),h=a(),te=Qi(m.context,_n);yield*wn(te,e=>c.has(h)?(c.delete(h),ee(h,Zr(e)?Array.from(l(e.cause)):[],f)):T);let ne=yield*ro(d);return c.set(h,{_tag:`Queue`,rpc:e,queue:ne,scope:te,context:f}),yield*r(e=>t.onFromClient({message:e,context:f,discard:!1}),{_tag:`Request`,id:h,tag:e._tag,payload:o,...p?{traceId:p.traceId,spanId:p.spanId,sampled:p.sampled}:{},headers:Vu(m.getRef(Pm),s)}).pipe(p?da(p,{captureStackTrace:!1}):w,Ri(e=>co(ne,e)),ae,Ji(te,{startImmediately:!0})),ne}),h=e=>{let t=[];for(let n of e.middlewares.values()){let e=o.mapUnsafe.get(`${n.key}/Client`);e&&t.push(e)}return t.length===0?(e,t)=>e(t):function n(r,i,a=t.length-1){return a===-1?r(i):t[a]({rpc:e,request:i,next(e){return n(r,e,a-1)}})}},ee=(e,n,r)=>or(i=>{let a=wa();t.onFromClient({message:{_tag:`Interrupt`,requestId:e,interruptors:n},context:r,discard:!1}).pipe(pi(1e3),Te(a.context)).addObserver(()=>{i(T)})}),te=e=>{switch(e._tag){case`Chunk`:{let n=e.requestId,i=c.get(n);return!i||i._tag!==`Queue`?T:oo(i.queue,e.values).pipe(r?M(()=>t.onFromClient({message:{_tag:`Ack`,requestId:e.requestId},context:i.context,discard:!1})):w,Ri(e=>co(i.queue,e)))}case`Exit`:{let t=e.requestId,n=c.get(t);return n?(c.delete(t),n._tag===`Effect`?(n.resume(e.exit),T):e.exit._tag===`Success`?uo(n.queue):co(n.queue,e.exit.cause)):T}case`Defect`:return d(Gr(e.defect));case`ClientEnd`:return T}},ne;if(t.flatten){let t=new Map;ne=function(n,r,i){let a=t.get(n);return a||(a=f(e.requests.get(n)),t.set(n,a)),a(r,i)}}else ne={},e.requests.forEach(e=>{ne[e._tag]=f(e)});return{client:ne,write:te}}),Am=0,jm=Qr(function*(e,t){let n=Am++,{run:r,send:i,supportsAck:a,supportsTransferables:o}=yield*Fm,s=new Map,{client:c,write:l}=yield*km(e,{...t,supportsAck:a,onFromClient({message:t}){switch(t._tag){case`Request`:{let r=e.requests.get(t.tag),a=o?Vf():void 0,c=wa(),l={rpc:r,context:a?Rn(c.context,Bf,a):c.context,schemas:Nm(r)};return s.set(t.id,l),l.schemas.encodePayload(t.payload).pipe(ga(l.context),Ie,M(e=>i(n,{...t,id:String(t.id),payload:e,headers:Object.entries(t.headers)},a&&a.readUnsafe())))}case`Ack`:return s.get(t.requestId)?i(n,{_tag:`Ack`,requestId:String(t.requestId)}):T;case`Interrupt`:return s.get(t.requestId)?(s.delete(t.requestId),i(n,{_tag:`Interrupt`,requestId:String(t.requestId)})):T;case`Eof`:return T}}});return yield*r(n,e=>{switch(e._tag){case`Chunk`:{let t=op(e.requestId),n=s.get(t);return!n||Yi(n.schemas.decodeChunk)?T:n.schemas.decodeChunk.value(e.values).pipe(ga(n.context),Ie,M(t=>l({_tag:`Chunk`,clientId:0,requestId:op(e.requestId),values:t})),st(t=>l({_tag:`Exit`,clientId:0,requestId:op(e.requestId),exit:Qn(t)})))}case`Exit`:{let t=op(e.requestId),n=s.get(t);return n?(s.delete(t),n.schemas.decodeExit(e.exit).pipe(ga(n.context),Ie,Fr({onSuccess:e=>l({_tag:`Exit`,clientId:0,requestId:t,exit:e}),onFailure:e=>l({_tag:`Exit`,clientId:0,requestId:t,exit:Qn(e)})}))):T}case`Defect`:return l({_tag:`Defect`,clientId:0,defect:Vm(e.defect)});case`ClientProtocolError`:{let t=Hi(e.error);return Cr(s.keys(),e=>l({_tag:`Exit`,clientId:0,requestId:e,exit:t}))}default:return T}}).pipe(Ri(It),ae,la),c}),Mm=new WeakMap,Nm=e=>{let t=Mm.get(e);return t===void 0?(t={decodeChunk:Vn(qf(e.successSchema),e=>br(ve(an(e.success)))),encodePayload:Zi(ve(e.payloadSchema)),decodeExit:br(ve(ep(e)))},Mm.set(e,t),t):t},Pm=Ki(`effect/rpc/RpcClient/CurrentHeaders`,{defaultValue:()=>Iu}),Fm=class extends F()(`effect/rpc/RpcClient/Protocol`){static make=Dm},Im=e=>Fm.make(Qr(function*(t,n){let r=yield*yf,i=yield*wm,o=yield*a(Bm),s=new Map,c=yield*r.writer,l=i.makeUnsafe(),u=yield*Rm(c(l.encode(sp))),d,f=si(()=>(d=void 0,ua(o)?o.value.onConnect:T)),p=e=>Cr(n,n=>t(n,e));return yield*si(()=>(l=i.makeUnsafe(),u.reset(),r.runRaw(e=>{try{let n=l.decode(e);if(n.length===0)return;let r=0;return An({while:()=>r<n.length,body:()=>{let e=n[r++];if(e._tag===`Pong`)return u.onPong(),T;if(`requestId`in e){let n=s.get(e.requestId);if(n!==void 0)return e._tag===`Exit`&&s.delete(e.requestId),t(n,e)}return p(e)},step:Yn})}catch(e){return p({_tag:`ClientProtocolError`,error:new ap({reason:new ip({message:`Error decoding message`,cause:e})})})}},{onOpen:f}).pipe(qt(M(u.timeout,()=>Kn(new Mf({reason:new kf({kind:`Timeout`,cause:Error(`ping timeout`)})}))))))).pipe(M(()=>Kn(new Mf({reason:new Af({code:1e3})}))),ua(o)?Mi(o.value.onDisconnect):w,In(t=>{let n=me(t),r=Ui(n);return e?.retryTransientErrors&&r&&n.success.reason._tag===`SocketOpenError`?T:(d=new ap({reason:r?n.success.reason:new ip({message:`Unknown socket error`,cause:ot(t)})}),p({_tag:`ClientProtocolError`,error:d}))}),je(e?.retryPolicy??Lm),dn({module:`RpcClient`,method:`makeProtocolSocket`}),la),{send(e,t){if(d)return Kn(d);t._tag===`Request`&&s.set(t.id,e);let n=l.encode(t);return n===void 0?T:Ie(c(n))},supportsAck:!0,supportsTransferables:!1}})),Lm=Mt(500,1.5).pipe(sa(se(5e3))),Rm=Qr(function*(e){let t=!0,n=Ea();return yield*si(()=>t?(t=!1,e):n.open).pipe(di(`5 seconds`),aa,_r,ae,la),{timeout:n.await,reset:()=>{t=!0,n.closeUnsafe()},onPong:()=>{t=!0}}}),zm=e=>Ot(Fm)(Im(e)),Bm=class extends F()(`effect/rpc/RpcClient/ConnectionHooks`){},Vm=ni(x),Hm=()=>(e,t)=>{let n=F()(e),r=Ot(n,t.makeEffect??jm(t.group,{...t,flatten:!0}));n.runtime=(t.runtime??Wl)(typeof t.protocol==`function`?e=>De(r,nn(t.protocol(e))):De(r,nn(t.protocol))),n.mutation=ru(e=>{let r=t.group.requests.get(e);return n.runtime.fn()(Qr(function*({headers:t,payload:r,reactivityKeys:i}){let a=(yield*n)(e,r,{headers:t});return yield*i?Ac(a,i):a})).pipe(pu({key:`AtomRpc:mutation:${e}`,schema:nl({success:r.successSchema,error:Um(r)})}))});let i=ru(e=>{let{headers:r,payload:i,reactivityKeys:a,tag:o,timeToLive:s}=e,c=t.group.requests.get(o),l=Kf(c.successSchema),u=l?n.runtime.pull(Ps(n.use(e=>C(e(o,i,{headers:r}))))):n.runtime.atom(n.use(e=>e(o,i,{headers:r})));return!l&&e.serializationKey&&(u=pu(u,{key:`AtomRpc:${e.tag}:${e.serializationKey}`,schema:nl({success:c.successSchema,error:Um(c)})})),s&&(u=xr(s)?El(u,s):iu(u)),a?n.runtime.factory.withReactivity(a)(u):u});return n.query=(e,t,n)=>i({tag:e,payload:t,headers:n?.headers?Lu(n.headers):void 0,reactivityKeys:n?.reactivityKeys,timeToLive:n?.timeToLive?Xr(n.timeToLive):void 0,serializationKey:n?.serializationKey}),n},Um=e=>E([e.errorSchema,...Array.from(e.middlewares,e=>e.error),ap]),Wm=Ki(`effect/http/FetchHttpClient/Fetch`,{defaultValue:()=>globalThis.fetch}),Gm=class extends F()(`effect/http/FetchHttpClient/RequestInit`){},Km=nf(C(Qd((e,t,n,r)=>{let i=r.getRef(Wm),a=r.context.mapUnsafe.get(Gm.key)??{},o=a.headers?Vu(Lu(a.headers),e.headers):e.headers;o[`content-length`]&&(o=Hu(o,`content-length`));let s=r=>_(Jr({try:()=>i(t,{...a,method:e.method,headers:o,body:r,duplex:e.body._tag===`Stream`?`half`:void 0,signal:n}),catch:t=>new _d({reason:new bd({request:e,cause:t})})}),t=>Wd(e,t));switch(e.body._tag){case`Raw`:case`Uint8Array`:return s(e.body.body);case`FormData`:return s(e.body.formData);case`Stream`:return M(Hs(e.body.stream),s)}return s(void 0)}))),qm={add(...e){let t=new Map(this.requests);for(let n of e)t.set(n._tag,n);return Jm({requests:t,annotations:this.annotations})},merge(...e){let t=new Map(this.requests),n=new Map(this.annotations.mapUnsafe);for(let r of e){for(let[e,n]of r.requests)t.set(e,n);for(let[e,t]of r.annotations.mapUnsafe)n.set(e,t)}return Jm({requests:t,annotations:pe(n)})},omit(...e){let t=new Map(this.requests);for(let n of e)t.delete(n);return Jm({requests:t,annotations:this.annotations})},middleware(e){let t=new Map;for(let[n,r]of this.requests)t.set(n,r.middleware(e));return Jm({requests:t,annotations:this.annotations})},toHandlers(e){let t=this;return Bn(function*(){let n=yield*Or(),r=ea(e)?yield*e:e,i=new Map;for(let[e,a]of Object.entries(r)){let r=t.requests.get(e);i.set(r.key,{tag:r._tag,handler:a,context:n})}return pe(i)})},prefix(e){let t=new Map;for(let n of this.requests.values()){let r=n.prefix(e);t.set(r._tag,r)}return Jm({requests:t,annotations:this.annotations})},toLayer(e){return va(this.toHandlers(e))},of:w,toLayerHandler(e,t){let n=this;return va(Bn(function*(){let r=yield*Or(),i=ea(t)?yield*t:t,a=new Map,o=n.requests.get(e);return a.set(o.key,{handler:i,context:r}),pe(a)}))},accessHandler(e){return Pn(t=>{let n=this.requests.get(e),{handler:r,context:i}=t.mapUnsafe.get(n.key);return C((e,t)=>{t.rpc=n;let a=r(e,t),o=np(a)?a.value:a;return ea(o)?Et(o,i):Rs(o,i)})})},annotate(e,t){return Jm({requests:this.requests,annotations:Rn(this.annotations,e,t)})},annotateRpcs(e,t){return this.annotateRpcsMerge(Pt(e,t))},annotateMerge(e){return Jm({requests:this.requests,annotations:le(this.annotations,e)})},annotateRpcsMerge(e){let t=new Map;for(let[n,r]of this.requests)t.set(n,r.annotateMerge(le(e,r.annotations)));return Jm({requests:t,annotations:this.annotations})}},Jm=e=>Object.assign(function(){},qm,{requests:e.requests,annotations:e.annotations}),Ym=(...e)=>Jm({requests:new Map(e.map(e=>[e._tag,e])),annotations:ra()}),Xm=cr(j,yn(Ge)),Zm=`~effect/ai/Prompt/Part`,Qm=D({[Zm]:k(Zm).pipe(Lr(C(Zm),{encodingStrategy:`omit`})),options:Xm.pipe(f(C({})))}),$m=(e,t)=>({...t,[Zm]:Zm,type:e,options:t.options??{}}),eh=D({...Qm.fields,type:k(`text`),text:j}).annotate({identifier:`TextPart`}),th=D({...Qm.fields,type:k(`reasoning`),text:j}).annotate({identifier:`ReasoningPart`}),nh=D({...Qm.fields,type:k(`file`),mediaType:j,fileName:P(j),data:E([j,Fi,hi])}).annotate({identifier:`FilePart`}),rh=D({...Qm.fields,type:k(`tool-call`),id:j,name:j,params:Gi,providerExecuted:pa.pipe(f(C(!1)))}).annotate({identifier:`ToolCallPart`}),ih=D({...Qm.fields,type:k(`tool-result`),id:j,name:j,isFailure:pa,result:Gi}).annotate({identifier:`ToolResultPart`}),ah=D({...Qm.fields,type:k(`tool-approval-response`),approvalId:j,approved:pa,reason:P(j)}).annotate({identifier:`ToolApprovalResponsePart`}),oh=D({...Qm.fields,type:k(`tool-approval-request`),approvalId:j,toolCallId:j}).annotate({identifier:`ToolApprovalRequestPart`}),sh=`~effect/ai/Prompt/Message`,ch=D({[sh]:k(sh).pipe(Lr(C(sh),{encodingStrategy:`omit`})),options:Xm.pipe(f(C({})))}),lh=j.pipe(Tr(an(Ur(eh)),g({decode:e=>vt($m(`text`,{text:e})),encode:e=>e[0].text}))),uh=D({...ch.fields,role:k(`system`),content:j}).annotate({identifier:`SystemMessage`}),dh=E([uh,D({...ch.fields,role:k(`user`),content:E([lh,b(E([eh,nh]))])}).annotate({identifier:`UserMessage`}),D({...ch.fields,role:k(`assistant`),content:E([lh,b(E([eh,nh,th,rh,ih,oh]))])}).annotate({identifier:`AssistantMessage`}),D({...ch.fields,role:k(`tool`),content:b(E([ih,ah]))}).annotate({identifier:`ToolMessage`})]),fh=class extends ki()(`AiError`,{cause:P(x),message:j}){};S(`AgentStatus`)({state:v([`idle`,`running`,`retrying`,`stopping`,`awaiting_input`,`error`]),updatedAt:Oe});var ph=v([`off`,`minimal`,`low`,`medium`,`high`,`xhigh`]),mh=v([`pi`]),hh=v([`openai-codex`]),gh=v([`gpt-5.5`]);S(`AgentPrompt`)({messages:b(dh),model:gh,provider:hh,thinkingLevel:P(ph)}),S(`AgentLayerConfig`)({agent:mh,cwd:j,systemPrompt:uh,tools:P(E([v([`all`,`none`]),b(j)]))});var _h=v([`opencode-gpt-5.5`,`codex-gpt-5.5-low`,`pi-gpt-5.5-low`,`claude-code-opus-4.8-bypass`]),vh=v([`opencode`,`codex`,`pi`,`claude`]),yh=class extends S(`AgentCommandProfile`)({icon:vh,id:_h,label:j}){},bh=class extends S(`AgentCommandRequest`)({cwd:j,profileId:_h}){},xh=class extends ki()(`GitError`,{cause:P(x),message:P(j)}){},Sh=v([`added`,`deleted`,`modified`,`renamed`]),Ch=class extends S(`GitDiffSegment`)({filePath:j,fingerprint:j,id:j,type:v([`commit`,`worktree`])}){},wh=class extends S(`GitDiff`)({fileContent:P(j),filePath:j,patch:j,segments:b(Ch),status:Sh}){},Th=E([D({_tag:k(`changes`)}),D({_tag:k(`local`)}),D({_tag:k(`branch`)}),D({_tag:k(`commit`),hash:j})]),Eh=class extends S(`GitCommit`)({hash:j,shortHash:j,subject:j}){},Dh=class extends S(`GitPullRequest`)({url:j}){},Oh=class extends S(`GitReviewMetadata`)({branchCommits:b(Eh),dirty:pa,localCommits:b(Eh),prUrl:P(j),unpushedCommits:pa,upstream:P(D({ahead:y,behind:y}))}){},kh=class extends S(`GitReviewMark`)({filePath:j,fingerprint:j,segmentId:j}){},Ah=class extends S(`GitReviewComment`)({body:j,filePath:j,lineNumber:y,resolved:pa,side:P(v([`additions`,`deletions`])),source:P(v([`local`,`github`])),threadId:P(j),url:P(j)}){},jh=class extends S(`GitReviewState`)({comments:b(Ah),marks:b(kh)}){},Mh=class extends S(`GitRepository`)({gitDirectory:j,root:j}){},Nh=class extends S(`GitBranch`)({name:j,remote:P(j),type:v([`local`,`remote`])}){},Ph=class extends S(`GitBranchesSnapshot`)({branches:b(Nh),defaultBranch:j}){},Fh=E([D({_tag:k(`local`)}),D({_tag:k(`remote`),remote:j}),D({_tag:k(`new`)})]),Ih=class extends S(`GitWorktree`)({branch:P(j),root:j}){},Lh=class extends S(`GitProject`)({repository:Mh,worktrees:b(Ih)}){};function Rh(e){return`${e.source??`local`}:${e.threadId??``}:${e.filePath}:${e.side??`additions`}:${e.lineNumber}`}function zh(e){return`${e.filePath}:${e.fingerprint}`}function Bh(e){return bn(e.segments,e=>({filePath:e.filePath,fingerprint:e.fingerprint,segmentId:e.id}))}function Vh(e,t){let n=ma(e,e=>t.has(zh(e)));return Qt(e)||Qt(n)?`unchecked`:pn(n)===pn(e)?`checked`:`indeterminate`}var Hh=D({state:v([`idle`,`prepared`,`running`,`stopped`,`exited`,`failed`])}),Uh=class extends S(`PortlessScript`)({baseOrigin:P(j),command:P(j),cwd:j,env:cr(j,j),origin:P(j),packageName:P(j),portless:pa,scriptName:P(j),sessionId:j,taskId:j}){},Wh=class extends S(`PortlessOrigin`)({base:P(j),host:j,origin:j,port:y,sessionId:j,taskId:j}){},Gh=class extends S(`PortlessRun`)({origin:Wh,script:Uh,status:Hh}){},Kh=class extends ki()(`TerminalError`,{cause:P(x),message:P(j)}){},qh=D({state:v([`idle`,`starting`,`running`,`waiting`,`stopped`,`exited`,`failed`]),title:j});function Jh(e){return e===`idle`||e===`starting`||e===`running`||e===`waiting`}D({cols:y,rows:y});var Yh=E([D({data:j,type:k(`text`)}),D({data:Xn,type:k(`bytes`)})]),Xh=E([D({sequence:y,type:k(`reset`)}),D({data:j,sequence:y,type:k(`output`)})]),Zh=class extends ki()(`UsageError`,{cause:P(x),message:P(j)}){},Qh=class extends S(`UsageWindow`)({resetsAt:P(j),utilization:y}){},$h=class extends S(`UsageProvider`)({fiveHour:Qh,weekly:Qh}){},eg=class extends S(`SystemUsage`)({cpuUtilization:y,memoryUtilization:y}){},tg={cwd:j},ng=D(tg),rg={args:P(b(j)),command:P(j),cwd:j,env:P(cr(j,j)),sessionId:P(j)},ig=D(rg),ag=D({args:b(j),command:j,cwd:j,icon:vh,label:j,profileId:_h,state:qh,uuid:j}),og=D({command:j,scriptName:j,sessionId:j,taskId:j}),sg=D({agents:b(ag),branch:P(j),portlessRuns:b(Gh),root:j,runStatuses:cr(j,qh),scriptRuns:b(og)}),cg=D({repository:Lh.fields.repository,worktrees:b(sg)}),lg=D({agentProfiles:b(yh),projects:b(cg)}),ug=E([xh,fh]),dg=class extends Ym(L(`agents.create`,{error:Kh,payload:bh,success:ag}),L(`agents.profiles`,{error:fh,success:b(yh)}),L(`agents.remove`,{error:Kh,payload:D({cwd:j,uuid:j})}),L(`agents`,{error:Kh,payload:ng,stream:!0,success:b(ag)}),L(`home.sidebar`,{error:E([xh,Kh,fh]),stream:!0,success:lg}),L(`projects`,{error:xh,stream:!0,success:b(Lh)}),L(`projects.branches`,{error:xh,payload:ng,success:Ph}),L(`review.metadata`,{error:xh,payload:ng,stream:!0,success:Oh}),L(`review.diffs`,{error:xh,payload:D({...tg,target:Th}),stream:!0,success:b(wh)}),L(`review.state`,{error:xh,payload:ng,stream:!0,success:jh}),L(`review.state.mark`,{error:xh,payload:D({...tg,marks:b(kh)})}),L(`review.state.unmark`,{error:xh,payload:D({...tg,marks:b(kh)})}),L(`review.comments.save`,{error:xh,payload:D({...tg,comment:Ah})}),L(`review.comments.resolve`,{error:xh,payload:D({...tg,filePath:j,lineNumber:y,side:P(v([`additions`,`deletions`])),threadId:P(j)})}),L(`publish.approve`,{error:xh,payload:D({...tg,message:j}),success:P(Dh)}),L(`publish.message.generate`,{error:ug,payload:ng,success:j}),L(`projects.createWorktree`,{error:xh,payload:D({...tg,branch:j,source:Fh}),success:j}),L(`projects.deleteWorktree`,{error:xh,payload:ng}),L(`projects.fix`,{error:xh,payload:ng}),L(`runs.portless`,{error:Kh,payload:ng,success:b(Gh)}),L(`runs.scripts`,{error:Kh,payload:ng,success:b(og)}),L(`terminal.write`,{error:Kh,payload:D({...rg,data:Yh})}),L(`terminal.resize`,{error:Kh,payload:D({...rg,cols:y,rows:y})}),L(`terminal.restart`,{error:Kh,payload:ig,success:qh}),L(`terminal.status`,{error:Kh,payload:ig,stream:!0,success:qh}),L(`terminal.stop`,{error:Kh,payload:ig,success:qh}),L(`terminal.attach`,{error:Kh,payload:D({...rg,cols:P(y),rows:P(y)}),stream:!0,success:Xh}),L(`usage`,{error:Zh,payload:D({provider:v([`claude`,`codex`])}),stream:!0,success:$h}),L(`usage.system`,{error:Zh,stream:!0,success:eg})){},fg=`1.9.1`,pg=/^(\d+)\.(\d+)\.(\d+)(-(.+))?$/;function mg(e){let t=new Set([e]),n=new Set,r=e.match(pg);if(!r)return()=>!1;let i={major:+r[1],minor:+r[2],patch:+r[3],prerelease:r[4]};if(i.prerelease!=null)return function(t){return t===e};function a(e){return n.add(e),!1}function o(e){return t.add(e),!0}return function(e){if(t.has(e))return!0;if(n.has(e))return!1;let r=e.match(pg);if(!r)return a(e);let s={major:+r[1],minor:+r[2],patch:+r[3],prerelease:r[4]};return s.prerelease!=null||i.major!==s.major?a(e):i.major===0?i.minor===s.minor&&i.patch<=s.patch?o(e):a(e):i.minor<=s.minor?o(e):a(e)}}var hg=mg(fg),gg=fg.split(`.`)[0],_g=Symbol.for(`opentelemetry.js.api.${gg}`),vg=typeof globalThis==`object`?globalThis:typeof self==`object`?self:typeof window==`object`?window:typeof global==`object`?global:{};function yg(e,t,n,r=!1){let i=vg[_g]=vg[_g]??{version:fg};if(!r&&i[e]){let t=Error(`@opentelemetry/api: Attempted duplicate registration of API: ${e}`);return n.error(t.stack||t.message),!1}if(i.version!==`1.9.1`){let t=Error(`@opentelemetry/api: Registration of version v${i.version} for ${e} does not match previously registered API v${fg}`);return n.error(t.stack||t.message),!1}return i[e]=t,n.debug(`@opentelemetry/api: Registered a global for ${e} v${fg}.`),!0}function bg(e){let t=vg[_g]?.version;if(!(!t||!hg(t)))return vg[_g]?.[e]}function xg(e,t){t.debug(`@opentelemetry/api: Unregistering a global for ${e} v${fg}.`);let n=vg[_g];n&&delete n[e]}var Sg=class{constructor(e){this._namespace=e.namespace||`DiagComponentLogger`}debug(...e){return Cg(`debug`,this._namespace,e)}error(...e){return Cg(`error`,this._namespace,e)}info(...e){return Cg(`info`,this._namespace,e)}warn(...e){return Cg(`warn`,this._namespace,e)}verbose(...e){return Cg(`verbose`,this._namespace,e)}};function Cg(e,t,n){let r=bg(`diag`);if(r)return r[e](t,...n)}var wg;(function(e){e[e.NONE=0]=`NONE`,e[e.ERROR=30]=`ERROR`,e[e.WARN=50]=`WARN`,e[e.INFO=60]=`INFO`,e[e.DEBUG=70]=`DEBUG`,e[e.VERBOSE=80]=`VERBOSE`,e[e.ALL=9999]=`ALL`})(wg||={});function Tg(e,t){e<wg.NONE?e=wg.NONE:e>wg.ALL&&(e=wg.ALL),t||={};function n(n,r){let i=t[n];return typeof i==`function`&&e>=r?i.bind(t):function(){}}return{error:n(`error`,wg.ERROR),warn:n(`warn`,wg.WARN),info:n(`info`,wg.INFO),debug:n(`debug`,wg.DEBUG),verbose:n(`verbose`,wg.VERBOSE)}}var Eg=`diag`,Dg=class e{static instance(){return this._instance||=new e,this._instance}constructor(){function e(e){return function(...t){let n=bg(`diag`);if(n)return n[e](...t)}}let t=this;t.setLogger=(e,n={logLevel:wg.INFO})=>{if(e===t){let e=Error(`Cannot use diag as the logger for itself. Please use a DiagLogger implementation like ConsoleDiagLogger or a custom implementation`);return t.error(e.stack??e.message),!1}typeof n==`number`&&(n={logLevel:n});let r=bg(`diag`),i=Tg(n.logLevel??wg.INFO,e);if(r&&!n.suppressOverrideMessage){let e=Error().stack??`<failed to generate stacktrace>`;r.warn(`Current logger will be overwritten from ${e}`),i.warn(`Current logger will overwrite one already registered from ${e}`)}return yg(`diag`,i,t,!0)},t.disable=()=>{xg(Eg,t)},t.createComponentLogger=e=>new Sg(e),t.verbose=e(`verbose`),t.debug=e(`debug`),t.info=e(`info`),t.warn=e(`warn`),t.error=e(`error`)}},Og=class e{constructor(e){this._entries=e?new Map(e):new Map}getEntry(e){let t=this._entries.get(e);if(t)return Object.assign({},t)}getAllEntries(){return Array.from(this._entries.entries())}setEntry(t,n){let r=new e(this._entries);return r._entries.set(t,n),r}removeEntry(t){let n=new e(this._entries);return n._entries.delete(t),n}removeEntries(...t){let n=new e(this._entries);for(let e of t)n._entries.delete(e);return n}clear(){return new e}},kg=Symbol(`BaggageEntryMetadata`),Ag=Dg.instance();function jg(e={}){return new Og(new Map(Object.entries(e)))}function Mg(e){return typeof e!=`string`&&(Ag.error(`Cannot create baggage metadata from unknown type: ${typeof e}`),e=``),{__TYPE__:kg,toString(){return e}}}function Ng(e){return Symbol.for(e)}var Pg=new class e{constructor(t){let n=this;n._currentContext=t?new Map(t):new Map,n.getValue=e=>n._currentContext.get(e),n.setValue=(t,r)=>{let i=new e(n._currentContext);return i._currentContext.set(t,r),i},n.deleteValue=t=>{let r=new e(n._currentContext);return r._currentContext.delete(t),r}}},Fg=class{constructor(){}createGauge(e,t){return qg}createHistogram(e,t){return Jg}createCounter(e,t){return Kg}createUpDownCounter(e,t){return Yg}createObservableGauge(e,t){return Zg}createObservableCounter(e,t){return Xg}createObservableUpDownCounter(e,t){return Qg}addBatchObservableCallback(e,t){}removeBatchObservableCallback(e){}},Ig=class{},Lg=class extends Ig{add(e,t){}},Rg=class extends Ig{add(e,t){}},zg=class extends Ig{record(e,t){}},Bg=class extends Ig{record(e,t){}},Vg=class{addCallback(e){}removeCallback(e){}},Hg=class extends Vg{},Ug=class extends Vg{},Wg=class extends Vg{},Gg=new Fg,Kg=new Lg,qg=new zg,Jg=new Bg,Yg=new Rg,Xg=new Hg,Zg=new Ug,Qg=new Wg;function $g(){return Gg}var e_;(function(e){e[e.INT=0]=`INT`,e[e.DOUBLE=1]=`DOUBLE`})(e_||={});var t_={get(e,t){if(e!=null)return e[t]},keys(e){return e==null?[]:Object.keys(e)}},n_={set(e,t,n){e!=null&&(e[t]=n)}},r_=class{active(){return Pg}with(e,t,n,...r){return t.call(n,...r)}bind(e,t){return t}enable(){return this}disable(){return this}},i_=`context`,a_=new r_,o_=class e{constructor(){}static getInstance(){return this._instance||=new e,this._instance}setGlobalContextManager(e){return yg(i_,e,Dg.instance())}active(){return this._getContextManager().active()}with(e,t,n,...r){return this._getContextManager().with(e,t,n,...r)}bind(e,t){return this._getContextManager().bind(e,t)}_getContextManager(){return bg(i_)||a_}disable(){this._getContextManager().disable(),xg(i_,Dg.instance())}},s_;(function(e){e[e.NONE=0]=`NONE`,e[e.SAMPLED=1]=`SAMPLED`})(s_||={});var c_={traceId:`00000000000000000000000000000000`,spanId:`0000000000000000`,traceFlags:s_.NONE},l_=class{constructor(e=c_){this._spanContext=e}spanContext(){return this._spanContext}setAttribute(e,t){return this}setAttributes(e){return this}addEvent(e,t){return this}addLink(e){return this}addLinks(e){return this}setStatus(e){return this}updateName(e){return this}end(e){}isRecording(){return!1}recordException(e,t){}},u_=Ng(`OpenTelemetry Context Key SPAN`);function d_(e){return e.getValue(u_)||void 0}function f_(){return d_(o_.getInstance().active())}function p_(e,t){return e.setValue(u_,t)}function m_(e){return e.deleteValue(u_)}function h_(e,t){return p_(e,new l_(t))}function g_(e){return d_(e)?.spanContext()}var __=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1]);function v_(e,t){if(typeof e!=`string`||e.length!==t)return!1;let n=0;for(let t=0;t<e.length;t+=4)n+=(__[e.charCodeAt(t)]|0)+(__[e.charCodeAt(t+1)]|0)+(__[e.charCodeAt(t+2)]|0)+(__[e.charCodeAt(t+3)]|0);return n===t}function y_(e){return v_(e,32)&&e!==`00000000000000000000000000000000`}function b_(e){return v_(e,16)&&e!==`0000000000000000`}function x_(e){return y_(e.traceId)&&b_(e.spanId)}function S_(e){return new l_(e)}var C_=o_.getInstance(),w_=class{startSpan(e,t,n=C_.active()){if(t?.root)return new l_;let r=n&&g_(n);return T_(r)&&x_(r)?new l_(r):new l_}startActiveSpan(e,t,n,r){let i,a,o;if(arguments.length<2)return;arguments.length===2?o=t:arguments.length===3?(i=t,o=n):(i=t,a=n,o=r);let s=a??C_.active(),c=this.startSpan(e,i,s),l=p_(s,c);return C_.with(l,o,void 0,c)}};function T_(e){return typeof e==`object`&&!!e&&`spanId`in e&&typeof e.spanId==`string`&&`traceId`in e&&typeof e.traceId==`string`&&`traceFlags`in e&&typeof e.traceFlags==`number`}var E_=new w_,D_=class{constructor(e,t,n,r){this._provider=e,this.name=t,this.version=n,this.options=r}startSpan(e,t,n){return this._getTracer().startSpan(e,t,n)}startActiveSpan(e,t,n,r){let i=this._getTracer();return Reflect.apply(i.startActiveSpan,i,arguments)}_getTracer(){if(this._delegate)return this._delegate;let e=this._provider.getDelegateTracer(this.name,this.version,this.options);return e?(this._delegate=e,this._delegate):E_}},O_=new class{getTracer(e,t,n){return new w_}},k_=class{getTracer(e,t,n){return this.getDelegateTracer(e,t,n)??new D_(this,e,t,n)}getDelegate(){return this._delegate??O_}setDelegate(e){this._delegate=e}getDelegateTracer(e,t,n){return this._delegate?.getTracer(e,t,n)}},A_;(function(e){e[e.NOT_RECORD=0]=`NOT_RECORD`,e[e.RECORD=1]=`RECORD`,e[e.RECORD_AND_SAMPLED=2]=`RECORD_AND_SAMPLED`})(A_||={});var j_;(function(e){e[e.INTERNAL=0]=`INTERNAL`,e[e.SERVER=1]=`SERVER`,e[e.CLIENT=2]=`CLIENT`,e[e.PRODUCER=3]=`PRODUCER`,e[e.CONSUMER=4]=`CONSUMER`})(j_||={});var M_;(function(e){e[e.UNSET=0]=`UNSET`,e[e.OK=1]=`OK`,e[e.ERROR=2]=`ERROR`})(M_||={});var N_=o_.getInstance(),Z=Dg.instance(),P_=class{inject(e,t){}extract(e,t){return e}fields(){return[]}},F_=Ng(`OpenTelemetry Baggage Key`);function I_(e){return e.getValue(F_)||void 0}function L_(){return I_(o_.getInstance().active())}function R_(e,t){return e.setValue(F_,t)}function z_(e){return e.deleteValue(F_)}var B_=`propagation`,V_=new P_,H_=class e{constructor(){this.createBaggage=jg,this.getBaggage=I_,this.getActiveBaggage=L_,this.setBaggage=R_,this.deleteBaggage=z_}static getInstance(){return this._instance||=new e,this._instance}setGlobalPropagator(e){return yg(B_,e,Dg.instance())}inject(e,t,n=n_){return this._getGlobalPropagator().inject(e,t,n)}extract(e,t,n=t_){return this._getGlobalPropagator().extract(e,t,n)}fields(){return this._getGlobalPropagator().fields()}disable(){xg(B_,Dg.instance())}_getGlobalPropagator(){return bg(B_)||V_}}.getInstance(),U_=`trace`,Q=class e{constructor(){this._proxyTracerProvider=new k_,this.wrapSpanContext=S_,this.isSpanContextValid=x_,this.deleteSpan=m_,this.getSpan=d_,this.getActiveSpan=f_,this.getSpanContext=g_,this.setSpan=p_,this.setSpanContext=h_}static getInstance(){return this._instance||=new e,this._instance}setGlobalTracerProvider(e){let t=yg(U_,this._proxyTracerProvider,Dg.instance());return t&&this._proxyTracerProvider.setDelegate(e),t}getTracerProvider(){return bg(U_)||this._proxyTracerProvider}getTracer(e,t){return this.getTracerProvider().getTracer(e,t)}disable(){xg(U_,Dg.instance()),this._proxyTracerProvider=new k_}}.getInstance(),W_=Ng(`OpenTelemetry SDK Context Key SUPPRESS_TRACING`);function G_(e){return e.setValue(W_,!0)}function K_(e){return e.getValue(W_)===!0}var q_=`baggage`,J_=4096;function Y_(e){return e.reduce((e,t)=>{let n=`${e}${e===``?``:`,`}${t}`;return n.length>8192?e:n},``)}function X_(e){return e.getAllEntries().map(([e,t])=>{let n=`${encodeURIComponent(e)}=${encodeURIComponent(t.value)}`;return t.metadata!==void 0&&(n+=`;`+t.metadata.toString()),n})}function Z_(e){if(!e)return;let t=e.indexOf(`;`),n=t===-1?e:e.substring(0,t),r=n.indexOf(`=`);if(r<=0)return;let i=n.substring(0,r).trim(),a=n.substring(r+1).trim();if(!i||!a)return;let o,s;try{o=decodeURIComponent(i),s=decodeURIComponent(a)}catch{return}let c;return t!==-1&&t<e.length-1&&(c=Mg(e.substring(t+1))),{key:o,value:s,metadata:c}}function Q_(e,t,n,r){let i=0;for(;i<e.length&&n<180;){let a=e.indexOf(`,`,i),o=a===-1?e.length:a,s=o-i;if(s<=4096){let a=Z_(e.substring(i,o));if(a){let e=(n===0?0:1)+s;if(r+e>8192)break;t[a.key]=a.metadata?{value:a.value,metadata:a.metadata}:{value:a.value},n++,r+=e}}if(a===-1)break;i=a+1}return[n,r]}var $_=class{inject(e,t,n){let r=H_.getBaggage(e);if(!r||K_(e))return;let i=Y_(X_(r).filter(e=>e.length<=J_).slice(0,180));i.length>0&&n.set(t,q_,i)}extract(e,t,n){let r=n.get(t,q_);if(!r)return e;let i={},a=0,o=0;if(Array.isArray(r))for(let e=0;e<r.length;e++)[a,o]=Q_(r[e],i,a,o);else[a]=Q_(r,i,a,o);return a===0?e:H_.setBaggage(e,H_.createBaggage(i))}fields(){return[q_]}};function ev(e){let t={};if(typeof e!=`object`||!e)return t;for(let n in e){if(!Object.prototype.hasOwnProperty.call(e,n))continue;if(!tv(n)){Z.warn(`Invalid attribute key: ${n}`);continue}let r=e[n];if(!nv(r)){Z.warn(`Invalid attribute value set for key: ${n}`);continue}Array.isArray(r)?t[n]=r.slice():t[n]=r}return t}function tv(e){return typeof e==`string`&&e!==``}function nv(e){return e==null?!0:Array.isArray(e)?rv(e):iv(typeof e)}function rv(e){let t;for(let n of e){if(n==null)continue;let e=typeof n;if(e!==t){if(!t){if(iv(e)){t=e;continue}return!1}return!1}}return!0}function iv(e){switch(e){case`number`:case`boolean`:case`string`:return!0}return!1}function av(){return e=>{Z.error(ov(e))}}function ov(e){return typeof e==`string`?e:JSON.stringify(sv(e))}function sv(e){let t={},n=e;for(;n!==null;)Object.getOwnPropertyNames(n).forEach(e=>{if(t[e])return;let r=n[e];r&&(t[e]=String(r))}),n=Object.getPrototypeOf(n);return t}var cv=av();function lv(e){try{cv(e)}catch{}}var uv=`2.8.0`,dv=`exception.message`,fv=`exception.stacktrace`,pv=`exception.type`,mv=`service.name`,hv=`service.version`,gv=`telemetry.sdk.language`,_v=`nodejs`,vv=`webjs`,yv=`telemetry.sdk.name`,bv=`telemetry.sdk.version`,xv=`process.runtime.name`,Sv={[yv]:`opentelemetry`,[xv]:`browser`,[gv]:vv,[bv]:uv},Cv=performance,wv=9,Tv=10**6,Ev=10**wv;function Dv(e){let t=e/1e3;return[Math.trunc(t),Math.round(e%1e3*Tv)]}function Ov(e){return Pv(Dv(Cv.timeOrigin),Dv(typeof e==`number`?e:Cv.now()))}function kv(e){if(Mv(e))return e;if(typeof e==`number`)return e<Cv.timeOrigin?Ov(e):Dv(e);if(e instanceof Date)return Dv(e.getTime());throw TypeError(`Invalid input type`)}function Av(e,t){let n=t[0]-e[0],r=t[1]-e[1];return r<0&&(--n,r+=Ev),[n,r]}function jv(e){return e[0]*Ev+e[1]}function Mv(e){return Array.isArray(e)&&e.length===2&&typeof e[0]==`number`&&typeof e[1]==`number`}function Nv(e){return Mv(e)||typeof e==`number`||e instanceof Date}function Pv(e,t){let n=[e[0]+t[0],e[1]+t[1]];return n[1]>=Ev&&(n[1]-=Ev,n[0]+=1),n}var Fv;(function(e){e[e.SUCCESS=0]=`SUCCESS`,e[e.FAILED=1]=`FAILED`})(Fv||={});var Iv=class{_propagators;_fields;constructor(e={}){this._propagators=e.propagators??[];let t=new Set;for(let e of this._propagators){let n=typeof e.fields==`function`?e.fields():[];for(let e of n)t.add(e)}this._fields=Array.from(t)}inject(e,t,n){for(let r of this._propagators)try{r.inject(e,t,n)}catch(e){Z.warn(`Failed to inject with ${r.constructor.name}. Err: ${e.message}`)}}extract(e,t,n){return this._propagators.reduce((e,r)=>{try{return r.extract(e,t,n)}catch(e){Z.warn(`Failed to extract with ${r.constructor.name}. Err: ${e.message}`)}return e},e)}fields(){return this._fields.slice()}},Lv=`[_0-9a-z-*/]`,Rv=RegExp(`^(?:${`[a-z]${Lv}{0,255}`}|${`[a-z0-9]${Lv}{0,240}@[a-z]${Lv}{0,13}`})$`),zv=/^[ -~]{0,255}[!-~]$/,Bv=/,|=/;function Vv(e){return Rv.test(e)}function Hv(e){return zv.test(e)&&!Bv.test(e)}var Uv=32,Wv=512,Gv=`,`,Kv=`=`,qv=class e{_length;_rawTraceState;_internalState;constructor(e){this._rawTraceState=typeof e==`string`?e:``,this._length=this._rawTraceState.length}set(e,t){if(!Vv(e)||!Hv(t))return this;let n=this._getState(),r=n.get(e),i=this._length;if(typeof r==`string`?i+=t.length-r.length:i+=e.length+t.length+(n.size>0?2:1),i>Wv)return this;let a=new Map(n);return a.delete(e),a.set(e,t),this._fromState(a,i)}unset(e){let t=this._getState(),n=t.get(e);if(typeof n!=`string`)return this;let r=this._length-(e.length+n.length+1);t.size>1&&--r;let i=new Map(t);return i.delete(e),this._fromState(i,r)}get(e){return this._getState().get(e)}serialize(){let e=``,t=0;for(let n of this._getState())t>0&&(e=Gv+e),e=`${n[0]}${Kv}${n[1]}`+e,t++;return e}_getState(){if(this._internalState)return this._internalState;let e=this._rawTraceState.split(Gv),t=new Map,n=0;for(let r of e){let e=r.trim(),i=e.indexOf(Kv);if(i===-1)continue;let a=e.slice(0,i),o=e.slice(i+1);if(!Vv(a)||!Hv(o))continue;let s=n+e.length+ +(t.size>0);if(!(s>Wv)&&(t.set(a,o),n=s,t.size>=Uv))break}return this._length=n,this._internalState=new Map(Array.from(t.entries()).reverse()),this._internalState}_fromState(t,n){let r=Object.create(e.prototype);return r._internalState=t,r._length=n,r}},Jv=`traceparent`,Yv=`tracestate`,Xv=`00`,Zv=RegExp(`^\\s?((?!ff)[\\da-f]{2})-((?![0]{32})[\\da-f]{32})-((?![0]{16})[\\da-f]{16})-([\\da-f]{2})(-.*)?\\s?$`);function Qv(e){let t=Zv.exec(e);return!t||t[1]===`00`&&t[5]?null:{traceId:t[2],spanId:t[3],traceFlags:parseInt(t[4],16)}}var $v=class{inject(e,t,n){let r=Q.getSpanContext(e);if(!r||K_(e)||!x_(r))return;let i=`${Xv}-${r.traceId}-${r.spanId}-0${Number(r.traceFlags||s_.NONE).toString(16)}`;n.set(t,Jv,i),r.traceState&&n.set(t,Yv,r.traceState.serialize())}extract(e,t,n){let r=n.get(t,Jv);if(!r)return e;let i=Array.isArray(r)?r[0]:r;if(typeof i!=`string`)return e;let a=Qv(i);if(!a)return e;a.isRemote=!0;let o=n.get(t,Yv);if(o){let e=Array.isArray(o)?o.join(`,`):o;a.traceState=new qv(typeof e==`string`?e:void 0)}return Q.setSpanContext(e,a)}fields(){return[Jv,Yv]}},ey=`[object Object]`,ty=`[object Null]`,ny=`[object Undefined]`,ry=Function.prototype.toString,iy=ry.call(Object),ay=Object.getPrototypeOf,oy=Object.prototype,sy=oy.hasOwnProperty,cy=Symbol?Symbol.toStringTag:void 0,ly=oy.toString;function uy(e){if(!dy(e)||fy(e)!==ey)return!1;let t=ay(e);if(t===null)return!0;let n=sy.call(t,`constructor`)&&t.constructor;return typeof n==`function`&&n instanceof n&&ry.call(n)===iy}function dy(e){return typeof e==`object`&&!!e}function fy(e){return e==null?e===void 0?ny:ty:cy&&cy in Object(e)?py(e):my(e)}function py(e){let t=sy.call(e,cy),n=e[cy],r=!1;try{e[cy]=void 0,r=!0}catch{}let i=ly.call(e);return r&&(t?e[cy]=n:delete e[cy]),i}function my(e){return ly.call(e)}var hy=20;function gy(...e){let t=e.shift(),n=new WeakMap;for(;e.length>0;)t=vy(t,e.shift(),0,n);return t}function _y(e){return by(e)?e.slice():e}function vy(e,t,n=0,r){let i;if(!(n>hy)){if(n++,Cy(e)||Cy(t)||xy(t))i=_y(t);else if(by(e)){if(i=e.slice(),by(t))for(let e=0,n=t.length;e<n;e++)i.push(_y(t[e]));else if(Sy(t)){let e=Object.keys(t);for(let n=0,r=e.length;n<r;n++){let r=e[n];r===`__proto__`||r===`constructor`||r===`prototype`||(i[r]=_y(t[r]))}}}else if(Sy(e))if(Sy(t)){if(!wy(e,t))return t;i=Object.assign({},e);let a=Object.keys(t);for(let o=0,s=a.length;o<s;o++){let s=a[o];if(s===`__proto__`||s===`constructor`||s===`prototype`)continue;let c=t[s];if(Cy(c))c===void 0?delete i[s]:i[s]=c;else{let a=i[s],o=c;if(yy(e,s,r)||yy(t,s,r))delete i[s];else{if(Sy(a)&&Sy(o)){let n=r.get(a)||[],i=r.get(o)||[];n.push({obj:e,key:s}),i.push({obj:t,key:s}),r.set(a,n),r.set(o,i)}i[s]=vy(i[s],c,n,r)}}}}else i=t;return i}}function yy(e,t,n){let r=n.get(e[t])||[];for(let n=0,i=r.length;n<i;n++){let i=r[n];if(i.key===t&&i.obj===e)return!0}return!1}function by(e){return Array.isArray(e)}function xy(e){return typeof e==`function`}function Sy(e){return!Cy(e)&&!by(e)&&!xy(e)&&typeof e==`object`}function Cy(e){return typeof e==`string`||typeof e==`number`||typeof e==`boolean`||e===void 0||e instanceof Date||e instanceof RegExp||e===null}function wy(e,t){return!(!uy(e)||!uy(t))}var Ty=class e extends Error{constructor(t){super(t),Object.setPrototypeOf(this,e.prototype)}};function Ey(e,t){let n,r=new Promise(function(e,r){n=setTimeout(function(){r(new Ty(`Operation timed out.`))},t)});return Promise.race([e,r]).then(e=>(clearTimeout(n),e),e=>{throw clearTimeout(n),e})}var Dy=class{_promise;_resolve;_reject;constructor(){this._promise=new Promise((e,t)=>{this._resolve=e,this._reject=t})}get promise(){return this._promise}resolve(e){this._resolve(e)}reject(e){this._reject(e)}},Oy=class{_isCalled=!1;_deferred=new Dy;_callback;_that;constructor(e,t){this._callback=e,this._that=t}get isCalled(){return this._isCalled}get promise(){return this._deferred.promise}call(...e){if(!this._isCalled){this._isCalled=!0;try{Promise.resolve(this._callback.call(this._that,...e)).then(e=>this._deferred.resolve(e),e=>this._deferred.reject(e))}catch(e){this._deferred.reject(e)}}return this._deferred.promise}};function ky(e,t){return new Promise(n=>{N_.with(G_(N_.active()),()=>{e.export(t,n)})})}var Ay={_export:ky},jy;function My(){if(jy===void 0)try{let e=globalThis.process.argv0;jy=e?`unknown_service:${e}`:`unknown_service`}catch{jy=`unknown_service`}return jy}var Ny=e=>typeof e==`object`&&!!e&&typeof e.then==`function`,Py=class e{_rawAttributes;_asyncAttributesPending=!1;_schemaUrl;_memoizedAttributes;static FromAttributeList(t,n){let r=new e({},n);return r._rawAttributes=Ly(t),r._asyncAttributesPending=t.filter(([e,t])=>Ny(t)).length>0,r}constructor(e,t){let n=e.attributes??{};this._rawAttributes=Object.entries(n).map(([e,t])=>(Ny(t)&&(this._asyncAttributesPending=!0),[e,t])),this._rawAttributes=Ly(this._rawAttributes),this._schemaUrl=Ry(t?.schemaUrl)}get asyncAttributesPending(){return this._asyncAttributesPending}async waitForAsyncAttributes(){if(this.asyncAttributesPending){for(let e=0;e<this._rawAttributes.length;e++){let[t,n]=this._rawAttributes[e];this._rawAttributes[e]=[t,Ny(n)?await n:n]}this._asyncAttributesPending=!1}}get attributes(){if(this.asyncAttributesPending&&Z.error(`Accessing resource attributes before async attributes settled`),this._memoizedAttributes)return this._memoizedAttributes;let e={};for(let[t,n]of this._rawAttributes){if(Ny(n)){Z.debug(`Unsettled resource attribute ${t} skipped`);continue}n!=null&&(e[t]??=n)}return this._asyncAttributesPending||(this._memoizedAttributes=e),e}getRawAttributes(){return this._rawAttributes}get schemaUrl(){return this._schemaUrl}merge(t){if(t==null)return this;let n=zy(this,t),r=n?{schemaUrl:n}:void 0;return e.FromAttributeList([...t.getRawAttributes(),...this.getRawAttributes()],r)}};function Fy(e,t){return Py.FromAttributeList(Object.entries(e),t)}function Iy(){return Fy({[mv]:My(),[gv]:Sv[gv],[yv]:Sv[yv],[bv]:Sv[bv]})}function Ly(e){return e.map(([e,t])=>Ny(t)?[e,t.catch(t=>{Z.debug(`promise rejection for resource attribute: %s - %s`,e,t)})]:[e,t])}function Ry(e){if(typeof e==`string`||e===void 0)return e;Z.warn(`Schema URL must be string or undefined, got %s. Schema URL will be ignored.`,e)}function zy(e,t){let n=e?.schemaUrl,r=t?.schemaUrl,i=n===void 0||n===``,a=r===void 0||r===``;if(i)return r;if(a||n===r)return n;Z.warn(`Schema URL merge conflict: old resource has "%s", updating resource has "%s". Resulting resource will have undefined Schema URL.`,n,r)}var By=`exception`,Vy=Symbol.for(`nodejs.util.inspect.custom`);function Hy(e){let t={};for(let[n,r]of e.getRawAttributes())typeof r?.then!=`function`&&r!=null&&(t[n]??=r);return t}function Uy(e,t,n,r,i){if(typeof n==`number`&&n<0){let t=`[${e}]`;return r?.stylize?r.stylize(t,`special`):t}return typeof i!=`function`||!r?t:`${e} ${i(t,{...r,depth:r.depth==null?r.depth:r.depth-1})}`}var Wy=class{_spanContext;kind;parentSpanContext;attributes={};links=[];events=[];startTime;resource;instrumentationScope;_droppedAttributesCount=0;_droppedEventsCount=0;_droppedLinksCount=0;_attributesCount=0;name;status={code:M_.UNSET};endTime=[0,0];_ended=!1;_duration=[-1,-1];_spanProcessor;_spanLimits;_attributeValueLengthLimit;_recordEndMetrics;_performanceStartTime;_performanceOffset;_startTimeProvided;constructor(e){let t=Date.now();if(this._spanContext=e.spanContext,this._performanceStartTime=Cv.now(),this._performanceOffset=t-(this._performanceStartTime+Cv.timeOrigin),this._startTimeProvided=e.startTime!=null,this._spanLimits=e.spanLimits,this._attributeValueLengthLimit=this._spanLimits.attributeValueLengthLimit??0,this._spanProcessor=e.spanProcessor,this.name=e.name,this.parentSpanContext=e.parentSpanContext,this.kind=e.kind,e.links)for(let t of e.links)this.addLink(t);this.startTime=this._getTime(e.startTime??t),this.resource=e.resource,this.instrumentationScope=e.scope,this._recordEndMetrics=e.recordEndMetrics,e.attributes!=null&&this.setAttributes(e.attributes),this._spanProcessor.onStart(this,e.context)}spanContext(){return this._spanContext}setAttribute(e,t){if(t==null||this._isSpanEnded())return this;if(e.length===0)return Z.warn(`Invalid attribute key: ${e}`),this;if(!nv(t))return Z.warn(`Invalid attribute value set for key: ${e}`),this;let{attributeCountLimit:n}=this._spanLimits,r=!Object.prototype.hasOwnProperty.call(this.attributes,e);return n!==void 0&&this._attributesCount>=n&&r?(this._droppedAttributesCount++,this):(this.attributes[e]=this._truncateToSize(t),r&&this._attributesCount++,this)}setAttributes(e){for(let t in e)Object.prototype.hasOwnProperty.call(e,t)&&this.setAttribute(t,e[t]);return this}addEvent(e,t,n){if(this._isSpanEnded())return this;let{eventCountLimit:r}=this._spanLimits;if(r===0)return Z.warn(`No events allowed.`),this._droppedEventsCount++,this;r!==void 0&&this.events.length>=r&&(this._droppedEventsCount===0&&Z.debug(`Dropping extra events.`),this.events.shift(),this._droppedEventsCount++),Nv(t)&&(Nv(n)||(n=t),t=void 0);let i=ev(t),{attributePerEventCountLimit:a}=this._spanLimits,o={},s=0,c=0;for(let e in i){if(!Object.prototype.hasOwnProperty.call(i,e))continue;let t=i[e];if(a!==void 0&&c>=a){s++;continue}o[e]=this._truncateToSize(t),c++}return this.events.push({name:e,attributes:o,time:this._getTime(n),droppedAttributesCount:s}),this}addLink(e){if(this._isSpanEnded())return this;let{linkCountLimit:t}=this._spanLimits;if(t===0)return this._droppedLinksCount++,this;t!==void 0&&this.links.length>=t&&(this._droppedLinksCount===0&&Z.debug(`Dropping extra links.`),this.links.shift(),this._droppedLinksCount++);let{attributePerLinkCountLimit:n}=this._spanLimits,r=ev(e.attributes),i={},a=0,o=0;for(let e in r){if(!Object.prototype.hasOwnProperty.call(r,e))continue;let t=r[e];if(n!==void 0&&o>=n){a++;continue}i[e]=this._truncateToSize(t),o++}let s={context:e.context};return o>0&&(s.attributes=i),a>0&&(s.droppedAttributesCount=a),this.links.push(s),this}addLinks(e){for(let t of e)this.addLink(t);return this}setStatus(e){if(this._isSpanEnded()||e.code===M_.UNSET||this.status.code===M_.OK)return this;let t={code:e.code};return e.code===M_.ERROR&&(typeof e.message==`string`?t.message=e.message:e.message!=null&&Z.warn(`Dropping invalid status.message of type '${typeof e.message}', expected 'string'`)),this.status=t,this}updateName(e){return this._isSpanEnded()||(this.name=e),this}end(e){if(this._isSpanEnded()){Z.error(`${this.name} ${this._spanContext.traceId}-${this._spanContext.spanId} - You can only call end() on a span once.`);return}this.endTime=this._getTime(e),this._duration=Av(this.startTime,this.endTime),this._duration[0]<0&&(Z.warn(`Inconsistent start and end time, startTime > endTime. Setting span duration to 0ms.`,this.startTime,this.endTime),this.endTime=this.startTime.slice(),this._duration=[0,0]),this._droppedEventsCount>0&&Z.warn(`Dropped ${this._droppedEventsCount} events because eventCountLimit reached`),this._droppedLinksCount>0&&Z.warn(`Dropped ${this._droppedLinksCount} links because linkCountLimit reached`),this._spanProcessor.onEnding&&this._spanProcessor.onEnding(this),this._recordEndMetrics?.(),this._ended=!0,this._spanProcessor.onEnd(this)}_getTime(e){if(typeof e==`number`&&e<=Cv.now())return Ov(e+this._performanceOffset);if(typeof e==`number`)return Dv(e);if(e instanceof Date)return Dv(e.getTime());if(Mv(e))return e;if(this._startTimeProvided)return Dv(Date.now());let t=Cv.now()-this._performanceStartTime;return Pv(this.startTime,Dv(t))}isRecording(){return this._ended===!1}recordException(e,t){let n={};typeof e==`string`?n[dv]=e:e&&(e.code?n[pv]=e.code.toString():e.name&&(n[pv]=e.name),e.message&&(n[dv]=e.message),e.stack&&(n[fv]=e.stack)),n[`exception.type`]||n[`exception.message`]?this.addEvent(By,n,t):Z.warn(`Failed to record an exception ${e}`)}get duration(){return this._duration}get ended(){return this._ended}get droppedAttributesCount(){return this._droppedAttributesCount}get droppedEventsCount(){return this._droppedEventsCount}get droppedLinksCount(){return this._droppedLinksCount}_isSpanEnded(){if(this._ended){let e=Error(`Operation attempted on ended Span {traceId: ${this._spanContext.traceId}, spanId: ${this._spanContext.spanId}}`);Z.warn(`Cannot execute the operation on ended Span {traceId: ${this._spanContext.traceId}, spanId: ${this._spanContext.spanId}}`,e)}return this._ended}_truncateToLimitUtil(e,t){return e.length<=t?e:e.substring(0,t)}_truncateToSize(e){let t=this._attributeValueLengthLimit;return t<=0?(Z.warn(`Attribute value limit must be positive, got ${t}`),e):typeof e==`string`?this._truncateToLimitUtil(e,t):Array.isArray(e)?e.map(e=>typeof e==`string`?this._truncateToLimitUtil(e,t):e):e}[Vy](e,t,n){return Uy(`SpanImpl`,{name:this.name,kind:this.kind,spanContext:this._spanContext,parentSpanContext:this.parentSpanContext,status:this.status,startTime:this.startTime,endTime:this.endTime,duration:this._duration,ended:this._ended,attributes:this.attributes,events:this.events,links:this.links,droppedAttributesCount:this._droppedAttributesCount,droppedEventsCount:this._droppedEventsCount,droppedLinksCount:this._droppedLinksCount,instrumentationScope:this.instrumentationScope,resource:{attributes:Hy(this.resource)}},e,t,n)}},Gy;(function(e){e[e.NOT_RECORD=0]=`NOT_RECORD`,e[e.RECORD=1]=`RECORD`,e[e.RECORD_AND_SAMPLED=2]=`RECORD_AND_SAMPLED`})(Gy||={});var Ky=class{shouldSample(){return{decision:Gy.NOT_RECORD}}toString(){return`AlwaysOffSampler`}},qy=class{shouldSample(){return{decision:Gy.RECORD_AND_SAMPLED}}toString(){return`AlwaysOnSampler`}},Jy=class{_root;_remoteParentSampled;_remoteParentNotSampled;_localParentSampled;_localParentNotSampled;constructor(e){this._root=e.root,this._root||=(lv(Error(`ParentBasedSampler must have a root sampler configured`)),new qy),this._remoteParentSampled=e.remoteParentSampled??new qy,this._remoteParentNotSampled=e.remoteParentNotSampled??new Ky,this._localParentSampled=e.localParentSampled??new qy,this._localParentNotSampled=e.localParentNotSampled??new Ky}shouldSample(e,t,n,r,i,a){let o=Q.getSpanContext(e);return!o||!x_(o)?this._root.shouldSample(e,t,n,r,i,a):o.isRemote?o.traceFlags&s_.SAMPLED?this._remoteParentSampled.shouldSample(e,t,n,r,i,a):this._remoteParentNotSampled.shouldSample(e,t,n,r,i,a):o.traceFlags&s_.SAMPLED?this._localParentSampled.shouldSample(e,t,n,r,i,a):this._localParentNotSampled.shouldSample(e,t,n,r,i,a)}toString(){return`ParentBased{root=${this._root.toString()}, remoteParentSampled=${this._remoteParentSampled.toString()}, remoteParentNotSampled=${this._remoteParentNotSampled.toString()}, localParentSampled=${this._localParentSampled.toString()}, localParentNotSampled=${this._localParentNotSampled.toString()}}`}},Yy=class{_ratio;_upperBound;constructor(e=0){this._ratio=this._normalize(e),this._upperBound=Math.floor(this._ratio*4294967295)}shouldSample(e,t){return{decision:y_(t)&&this._accumulate(t)<this._upperBound?Gy.RECORD_AND_SAMPLED:Gy.NOT_RECORD}}toString(){return`TraceIdRatioBased{${this._ratio}}`}_normalize(e){return typeof e!=`number`||isNaN(e)?0:e>=1?1:e<=0?0:e}_accumulate(e){let t=0;for(let n=0;n<32;n+=8){let r=0;for(let t=0;t<8;t++){let i=e.charCodeAt(n+t),a=i<58?i-48:i<71?i-55:i-87;r=r<<4|a}t=(t^r)>>>0}return t}},Xy;(function(e){e.AlwaysOff=`always_off`,e.AlwaysOn=`always_on`,e.ParentBasedAlwaysOff=`parentbased_always_off`,e.ParentBasedAlwaysOn=`parentbased_always_on`,e.ParentBasedTraceIdRatio=`parentbased_traceidratio`,e.TraceIdRatio=`traceidratio`})(Xy||={});var Zy=1;function Qy(){return{sampler:$y(),forceFlushTimeoutMillis:3e4,generalLimits:{attributeValueLengthLimit:1/0,attributeCountLimit:128},spanLimits:{attributeValueLengthLimit:1/0,attributeCountLimit:128,linkCountLimit:128,eventCountLimit:128,attributePerEventCountLimit:128,attributePerLinkCountLimit:128}}}function $y(){let e=Xy.ParentBasedAlwaysOn;switch(e){case Xy.AlwaysOn:return new qy;case Xy.AlwaysOff:return new Ky;case Xy.ParentBasedAlwaysOn:return new Jy({root:new qy});case Xy.ParentBasedAlwaysOff:return new Jy({root:new Ky});case Xy.TraceIdRatio:return new Yy(eb());case Xy.ParentBasedTraceIdRatio:return new Jy({root:new Yy(eb())});default:return Z.error(`OTEL_TRACES_SAMPLER value "${e}" invalid, defaulting to "${Xy.ParentBasedAlwaysOn}".`),new Jy({root:new qy})}}function eb(){return Z.error(`OTEL_TRACES_SAMPLER_ARG is blank, defaulting to ${Zy}.`),Zy}function tb(e){let t={sampler:$y()},n=Qy(),r=Object.assign({},n,t,e);return r.generalLimits=Object.assign({},n.generalLimits,e.generalLimits||{}),r.spanLimits=Object.assign({},n.spanLimits,e.spanLimits||{}),r}function nb(e){let t=Object.assign({},e.spanLimits);return t.attributeCountLimit=e.spanLimits?.attributeCountLimit??e.generalLimits?.attributeCountLimit??void 0??void 0??128,t.attributeValueLengthLimit=e.spanLimits?.attributeValueLengthLimit??e.generalLimits?.attributeValueLengthLimit??void 0??void 0??1/0,Object.assign({},e,{spanLimits:t})}var rb=16,ib=8,ab=new Uint8Array(rb),ob=new Uint8Array(ib),sb=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,`0`));function cb(e){for(let t=0;t<e.length;t++)e[t]=Math.random()*256>>>0;for(let t=0;t<e.length;t++)if(e[t]>0)return;e[e.length-1]=1}function lb(e){let t=``;for(let n=0;n<e.length;n++)t+=sb[e[n]];return t}var ub=class{generateTraceId(){return cb(ab),lb(ab)}generateSpanId(){return cb(ob),lb(ob)}},db=`otel.span.parent.origin`,fb=`otel.span.sampling_result`,pb=`otel.sdk.span.live`,mb=`otel.sdk.span.started`,hb=class{startedSpans;liveSpans;constructor(e){this.startedSpans=e.createCounter(mb,{unit:`{span}`,description:`The number of created spans.`}),this.liveSpans=e.createUpDownCounter(pb,{unit:`{span}`,description:`The number of currently live spans.`})}startSpan(e,t){let n=_b(t);if(this.startedSpans.add(1,{[db]:gb(e),[fb]:n}),t===Gy.NOT_RECORD)return()=>{};let r={[fb]:n};return this.liveSpans.add(1,r),()=>{this.liveSpans.add(-1,r)}}};function gb(e){return e?e.isRemote?`remote`:`local`:`none`}function _b(e){switch(e){case Gy.RECORD_AND_SAMPLED:return`RECORD_AND_SAMPLE`;case Gy.RECORD:return`RECORD_ONLY`;case Gy.NOT_RECORD:return`DROP`}}var vb=`2.8.0`,yb=class{_sampler;_generalLimits;_spanLimits;_idGenerator;instrumentationScope;_resource;_spanProcessor;_tracerMetrics;constructor(e,t,n,r){let i=tb(t);this._sampler=i.sampler,this._generalLimits=i.generalLimits,this._spanLimits=i.spanLimits,this._idGenerator=t.idGenerator||new ub,this._resource=n,this._spanProcessor=r,this.instrumentationScope=e;let a=i.meterProvider?i.meterProvider.getMeter(`@opentelemetry/sdk-trace`,vb):$g();this._tracerMetrics=new hb(a)}startSpan(e,t={},n=N_.active()){t.root&&(n=Q.deleteSpan(n));let r=Q.getSpan(n);if(K_(n))return Z.debug(`Instrumentation suppressed, returning Noop Span`),Q.wrapSpanContext(c_);let i=r?.spanContext(),a=this._idGenerator.generateSpanId(),o,s,c;!i||!Q.isSpanContextValid(i)?s=this._idGenerator.generateTraceId():(s=i.traceId,c=i.traceState,o=i);let l=t.kind??j_.INTERNAL,u=(t.links??[]).map(e=>({context:e.context,attributes:ev(e.attributes)})),d=ev(t.attributes),f=this._sampler.shouldSample(n,s,e,l,d,u),p=this._tracerMetrics.startSpan(i,f.decision);c=f.traceState??c;let m=f.decision===A_.RECORD_AND_SAMPLED?s_.SAMPLED:s_.NONE,h={traceId:s,spanId:a,traceFlags:m,traceState:c};if(f.decision===A_.NOT_RECORD)return Z.debug(`Recording is off, propagating context in a non-recording span`),Q.wrapSpanContext(h);let ee=ev(Object.assign(d,f.attributes));return new Wy({resource:this._resource,scope:this.instrumentationScope,context:n,spanContext:h,name:e,kind:l,links:u,parentSpanContext:o,attributes:ee,startTime:t.startTime,spanProcessor:this._spanProcessor,spanLimits:this._spanLimits,recordEndMetrics:p})}startActiveSpan(e,t,n,r){let i,a,o;if(arguments.length<2)return;arguments.length===2?o=t:arguments.length===3?(i=t,o=n):(i=t,a=n,o=r);let s=a??N_.active(),c=this.startSpan(e,i,s),l=Q.setSpan(s,c);return N_.with(l,o,void 0,c)}getGeneralLimits(){return this._generalLimits}getSpanLimits(){return this._spanLimits}[Vy](e,t,n){return Uy(`Tracer`,{instrumentationScope:this.instrumentationScope,resource:{attributes:Hy(this._resource)},spanLimits:this._spanLimits,generalLimits:this._generalLimits},e,t,n)}},bb=class{_spanProcessors;constructor(e){this._spanProcessors=e}forceFlush(){let e=[];for(let t of this._spanProcessors)e.push(t.forceFlush());return new Promise(t=>{Promise.all(e).then(()=>{t()}).catch(e=>{lv(e||Error(`MultiSpanProcessor: forceFlush failed`)),t()})})}onStart(e,t){for(let n of this._spanProcessors)n.onStart(e,t)}onEnding(e){for(let t of this._spanProcessors)t.onEnding&&t.onEnding(e)}onEnd(e){for(let t of this._spanProcessors)t.onEnd(e)}shutdown(){let e=[];for(let t of this._spanProcessors)e.push(t.shutdown());return new Promise((t,n)=>{Promise.all(e).then(()=>{t()},n)})}},xb;(function(e){e[e.resolved=0]=`resolved`,e[e.timeout=1]=`timeout`,e[e.error=2]=`error`,e[e.unresolved=3]=`unresolved`})(xb||={});var Sb=class{_config;_tracers=new Map;_resource;_activeSpanProcessor;constructor(e={}){let t=gy({},Qy(),nb(e));this._resource=t.resource??Iy(),this._config=Object.assign({},t,{resource:this._resource});let n=[];e.spanProcessors?.length&&n.push(...e.spanProcessors),this._activeSpanProcessor=new bb(n)}getTracer(e,t,n){let r=`${e}@${t||``}:${n?.schemaUrl||``}`;return this._tracers.has(r)||this._tracers.set(r,new yb({name:e,version:t,schemaUrl:n?.schemaUrl},this._config,this._resource,this._activeSpanProcessor)),this._tracers.get(r)}forceFlush(){let e=this._config.forceFlushTimeoutMillis,t=this._activeSpanProcessor._spanProcessors.map(t=>new Promise(n=>{let r,i=setTimeout(()=>{n(Error(`Span processor did not completed within timeout period of ${e} ms`)),r=xb.timeout},e);t.forceFlush().then(()=>{clearTimeout(i),r!==xb.timeout&&(r=xb.resolved,n(r))}).catch(e=>{clearTimeout(i),r=xb.error,n(e)})}));return new Promise((e,n)=>{Promise.all(t).then(t=>{let r=t.filter(e=>e!==xb.resolved);r.length>0?n(r):e()}).catch(e=>n([e]))})}shutdown(){return this._activeSpanProcessor.shutdown()}[Vy](e,t,n){let r=this._activeSpanProcessor._spanProcessors;return Uy(`BasicTracerProvider`,{resource:{attributes:Hy(this._resource)},tracers:Array.from(this._tracers.keys()),spanProcessors:r.map(e=>e.constructor?.name??`SpanProcessor`)},e,t,n)}},Cb=class{_exporter;_shutdownOnce;_pendingExports;constructor(e){this._exporter=e,this._shutdownOnce=new Oy(this._shutdown,this),this._pendingExports=new Set}async forceFlush(){await Promise.all(Array.from(this._pendingExports)),this._exporter.forceFlush&&await this._exporter.forceFlush()}onStart(e,t){}onEnd(e){if(this._shutdownOnce.isCalled||(e.spanContext().traceFlags&s_.SAMPLED)===0)return;let t=this._doExport(e).catch(e=>lv(e));this._pendingExports.add(t),t.finally(()=>this._pendingExports.delete(t))}async _doExport(e){e.resource.asyncAttributesPending&&await e.resource.waitForAsyncAttributes?.();let t=await Ay._export(this._exporter,[e]);if(t.code!==Fv.SUCCESS)throw t.error??Error(`SimpleSpanProcessor: span export failed (status ${t})`)}shutdown(){return this._shutdownOnce.call()}_shutdown(){return this._exporter.shutdown()}},wb=class{_enabled=!1;_currentContext=Pg;_bindFunction(e=Pg,t){let n=this,r=function(...r){return n.with(e,()=>t.apply(this,r))};return Object.defineProperty(r,"length",{enumerable:!1,configurable:!0,writable:!1,value:t.length}),r}active(){return this._currentContext}bind(e,t){return e===void 0&&(e=this.active()),typeof t==`function`?this._bindFunction(e,t):t}disable(){return this._currentContext=Pg,this._enabled=!1,this}enable(){return this._enabled?this:(this._enabled=!0,this._currentContext=Pg,this)}with(e,t,n,...r){let i=this._currentContext;this._currentContext=e||Pg;try{return t.call(n,...r)}finally{this._currentContext=i}}};function Tb(e){if(e!==null){if(e===void 0){let e=new wb;e.enable(),N_.setGlobalContextManager(e);return}e.enable(),N_.setGlobalContextManager(e)}}function Eb(e){if(e!==null){if(e===void 0){H_.setGlobalPropagator(new Iv({propagators:[new $v,new $_]}));return}H_.setGlobalPropagator(e)}}var Db=class extends Sb{constructor(e={}){super(e)}register(e={}){Q.setGlobalTracerProvider(this),Eb(e.propagator),Tb(e.contextManager)}},Ob=e=>e!==void 0&&!(Array.isArray(e)&&e.length===0),kb;(function(e){e[e.UNSPECIFIED=0]=`UNSPECIFIED`,e[e.TRACE=1]=`TRACE`,e[e.TRACE2=2]=`TRACE2`,e[e.TRACE3=3]=`TRACE3`,e[e.TRACE4=4]=`TRACE4`,e[e.DEBUG=5]=`DEBUG`,e[e.DEBUG2=6]=`DEBUG2`,e[e.DEBUG3=7]=`DEBUG3`,e[e.DEBUG4=8]=`DEBUG4`,e[e.INFO=9]=`INFO`,e[e.INFO2=10]=`INFO2`,e[e.INFO3=11]=`INFO3`,e[e.INFO4=12]=`INFO4`,e[e.WARN=13]=`WARN`,e[e.WARN2=14]=`WARN2`,e[e.WARN3=15]=`WARN3`,e[e.WARN4=16]=`WARN4`,e[e.ERROR=17]=`ERROR`,e[e.ERROR2=18]=`ERROR2`,e[e.ERROR3=19]=`ERROR3`,e[e.ERROR4=20]=`ERROR4`,e[e.FATAL=21]=`FATAL`,e[e.FATAL2=22]=`FATAL2`,e[e.FATAL3=23]=`FATAL3`,e[e.FATAL4=24]=`FATAL4`})(kb||={});var Ab=new class{emit(e){}enabled(){return!1}};function jb(){return Ab}function Mb(e){return Nb(e,new WeakSet)}function Nb(e,t){if(e==null||typeof e==`string`||typeof e==`number`||typeof e==`boolean`||e instanceof Uint8Array)return!0;if(typeof e==`object`){if(t.has(e))return!1;if(t.add(e),Array.isArray(e)){for(let n of e)if(!Nb(n,t))return!1;return!0}let n=e;if(n.constructor!==Object&&n.constructor!==void 0)return!1;for(let e in n)if(Object.prototype.hasOwnProperty.call(n,e)&&!Nb(n[e],t))return!1;return!0}return!1}var Pb;(function(e){e[e.DROP_INVALID=0]=`DROP_INVALID`,e[e.DROP_LIMIT_REACHED=1]=`DROP_LIMIT_REACHED`,e[e.ADD_NEW=2]=`ADD_NEW`,e[e.ADD_OVERWRITE_EXISTING=3]=`ADD_OVERWRITE_EXISTING`})(Pb||={});function Fb(e,t,n,r,i){if(r.length===0)return Z.warn(`Invalid attribute key: ${r}`),Pb.DROP_INVALID;if(!Mb(i))return Z.warn(`Invalid attribute value set for key: ${r}`),Pb.DROP_INVALID;let a=!Object.prototype.hasOwnProperty.call(e,r);return a&&n>=t.attributeCountLimit?Pb.DROP_LIMIT_REACHED:(e[r]=Ib(i,t.attributeValueLengthLimit),a?Pb.ADD_NEW:Pb.ADD_OVERWRITE_EXISTING)}function Ib(e,t){if(t<=0)return Z.warn(`Attribute value limit must be positive, got ${t}`),e;if(e==null)return e;if(typeof e==`string`)return e.length<=t?e:e.substring(0,t);if(e instanceof Uint8Array)return e;if(Array.isArray(e))return e.map(e=>Ib(e,t));if(typeof e==`object`){let n={};for(let[r,i]of Object.entries(e))n[r]=Ib(i,t);return n}return e}function Lb(e,t){if(t==null)return{};let n={},r=0,i=0;for(let[a,o]of Object.entries(t)){let t=Fb(n,e,r,a,o);t===Pb.ADD_NEW?r+=1:(t===Pb.DROP_INVALID||t===Pb.DROP_LIMIT_REACHED)&&(i+=1)}return{attributes:r>0?n:void 0,droppedAttributesCount:i}}var Rb=class{hrTime;hrTimeObserved;spanContext;resource;instrumentationScope;attributes={};_severityText;_severityNumber;_body;_eventName;_attributesCount=0;_droppedAttributesCount=0;_isReadonly=!1;_logRecordLimits;set severityText(e){this._isLogRecordReadonly()||(this._severityText=e)}get severityText(){return this._severityText}set severityNumber(e){this._isLogRecordReadonly()||(this._severityNumber=e)}get severityNumber(){return this._severityNumber}set body(e){this._isLogRecordReadonly()||(this._body=e)}get body(){return this._body}get eventName(){return this._eventName}set eventName(e){this._isLogRecordReadonly()||(this._eventName=e)}get droppedAttributesCount(){return this._droppedAttributesCount}constructor(e,t,n){let{timestamp:r,observedTimestamp:i,eventName:a,severityNumber:o,severityText:s,body:c,attributes:l={},exception:u,context:d}=n,f=Date.now();if(this.hrTime=kv(r??f),this.hrTimeObserved=kv(i??f),d){let e=Q.getSpanContext(d);e&&x_(e)&&(this.spanContext=e)}this.severityNumber=o,this.severityText=s,this.body=c,this.resource=e.resource,this.instrumentationScope=t,this._logRecordLimits=e.logRecordLimits,this._eventName=a,this.setAttributes(l),u!=null&&this._setException(u)}setAttribute(e,t){if(this._isLogRecordReadonly())return this;let n=Fb(this.attributes,this._logRecordLimits,this._attributesCount,e,t);return n===Pb.DROP_LIMIT_REACHED?(this._droppedAttributesCount++,this._droppedAttributesCount===1&&Z.warn(`Dropping extra attributes.`)):n===Pb.ADD_NEW&&this._attributesCount++,this}setAttributes(e){for(let[t,n]of Object.entries(e))this.setAttribute(t,n);return this}setBody(e){return this.body=e,this}setEventName(e){return this.eventName=e,this}setSeverityNumber(e){return this.severityNumber=e,this}setSeverityText(e){return this.severityText=e,this}_makeReadonly(){this._isReadonly=!0}_setException(e){let t=!1;if(typeof e==`string`||typeof e==`number`)Object.hasOwn(this.attributes,`exception.message`)||this.setAttribute(dv,String(e)),t=!0;else if(e&&typeof e==`object`){let n=e;n.code?(Object.hasOwn(this.attributes,`exception.type`)||this.setAttribute(pv,n.code.toString()),t=!0):n.name&&(Object.hasOwn(this.attributes,`exception.type`)||this.setAttribute(pv,n.name),t=!0),n.message&&(Object.hasOwn(this.attributes,`exception.message`)||this.setAttribute(dv,n.message),t=!0),n.stack&&(Object.hasOwn(this.attributes,`exception.stacktrace`)||this.setAttribute(fv,n.stack),t=!0)}t||Z.warn(`Failed to record an exception ${e}`)}_isLogRecordReadonly(){return this._isReadonly&&Z.warn(`Can not execute the operation on emitted log record`),this._isReadonly}},zb=class{_instrumentationScope;_sharedState;_loggerConfig;constructor(e,t){this._instrumentationScope=e,this._sharedState=t,this._loggerConfig=this._sharedState.getLoggerConfig(this._instrumentationScope)}emit(e){let t=e.context||N_.active();if(!this.enabled(e))return;let n=new Rb(this._sharedState,this._instrumentationScope,{context:t,...e});this._sharedState.loggerMetrics.emitLog(),this._sharedState.activeProcessor.onEmit(n,t),n._makeReadonly()}enabled(e){let t=this._loggerConfig;if(t.disabled)return!1;let n=e?.severityNumber;if(typeof n==`number`&&n!==kb.UNSPECIFIED&&n<t.minimumSeverity)return!1;let r=e?.context||N_.active();if(t.traceBased){let e=Q.getSpanContext(r);if(e&&x_(e)&&(e.traceFlags&s_.SAMPLED)!==s_.SAMPLED)return!1}let i={context:r,instrumentationScope:this._instrumentationScope,severityNumber:e?.severityNumber,eventName:e?.eventName};for(let e of this._sharedState.processors)if(!e.enabled||e.enabled(i))return!0;return!1}},Bb=class{forceFlush(){return Promise.resolve()}onEmit(e,t){}shutdown(){return Promise.resolve()}enabled(e){return!1}},Vb=class{processors;forceFlushTimeoutMillis;constructor(e,t){this.processors=e,this.forceFlushTimeoutMillis=t}async forceFlush(){let e=this.forceFlushTimeoutMillis;await Promise.all(this.processors.map(t=>Ey(t.forceFlush(),e)))}onEmit(e,t){this.processors.forEach(n=>n.onEmit(e,t))}async shutdown(){await Promise.all(this.processors.map(e=>e.shutdown()))}enabled(e){for(let t of this.processors)if(!t.enabled||t.enabled(e))return!0;return!1}};function Hb(e){if(e===void 0)return[`u`,null];if(e===null)return[`n`,null];let t=typeof e;return t===`string`?[`s`,e]:t===`boolean`?[`b`,e]:t===`number`?Number.isNaN(e)?[`nan`,null]:e===1/0?[`inf`,null]:e===-1/0?[`-inf`,null]:Object.is(e,-0)?[`n0`,null]:[`d`,e]:e instanceof Uint8Array?[`bytes`,Array.from(e)]:Array.isArray(e)?[`arr`,e.map(Hb)]:[`map`,Object.entries(e).sort(([e],[t])=>e.localeCompare(t)).map(([e,t])=>[e,Hb(t)])]}function Ub(e){return JSON.stringify([e.name,e.version||``,e.schemaUrl||``,Hb(e.attributes),e.droppedAttributesCount??0])}var Wb=`otel.sdk.log.created`,Gb=class{createdLogs;constructor(e){this.createdLogs=e.createCounter(Wb,{unit:`{log_record}`,description:`The number of logs submitted to enabled SDK Loggers.`})}emitLog(){this.createdLogs.add(1)}},Kb=`0.219.0`,qb={disabled:!1,minimumSeverity:kb.UNSPECIFIED,traceBased:!1},Jb=()=>({...qb}),Yb=class{loggers=new Map;activeProcessor;registeredLogRecordProcessors=[];resource;forceFlushTimeoutMillis;logRecordLimits;processors;loggerMetrics;_loggerConfigurator;_loggerConfigs=new Map;constructor(e,t,n,r,i,a){this.resource=e,this.forceFlushTimeoutMillis=t,this.logRecordLimits=n,this.processors=r,r.length>0?(this.registeredLogRecordProcessors=r,this.activeProcessor=new Vb(this.registeredLogRecordProcessors,this.forceFlushTimeoutMillis)):this.activeProcessor=new Bb,this._loggerConfigurator=i??Jb;let o=a?a.getMeter(`@opentelemetry/sdk-logs`,Kb):$g();this.loggerMetrics=new Gb(o)}getLoggerConfig(e){let t=Ub(e),n=this._loggerConfigs.get(t);return n||(n=this._loggerConfigurator(e),this._loggerConfigs.set(t,n),n)}},Xb=class{_shutdownOnce;_sharedState;constructor(e={}){let t={resource:e.resource??Iy(),forceFlushTimeoutMillis:e.forceFlushTimeoutMillis??3e4,logRecordLimits:{attributeCountLimit:e.logRecordLimits?.attributeCountLimit??128,attributeValueLengthLimit:e.logRecordLimits?.attributeValueLengthLimit??1/0},loggerConfigurator:e.loggerConfigurator??Jb,processors:e.processors??[],meterProvider:e.meterProvider};this._sharedState=new Yb(t.resource,t.forceFlushTimeoutMillis,t.logRecordLimits,t.processors,t.loggerConfigurator,t.meterProvider),this._shutdownOnce=new Oy(this._shutdown,this)}getLogger(e,t,n){if(this._shutdownOnce.isCalled)return Z.warn(`A shutdown LoggerProvider cannot provide a Logger`),jb();e||Z.warn(`Logger requested without instrumentation scope name.`);let r={name:e||`unknown`,version:t,schemaUrl:n?.schemaUrl,...Lb(this._sharedState.logRecordLimits,n?.attributes)},i=Ub(r);return this._sharedState.loggers.has(i)||this._sharedState.loggers.set(i,new zb(r,this._sharedState)),this._sharedState.loggers.get(i)}forceFlush(){return this._shutdownOnce.isCalled?(Z.warn(`invalid attempt to force flush after LoggerProvider shutdown`),this._shutdownOnce.promise):this._sharedState.activeProcessor.forceFlush()}shutdown(){return this._shutdownOnce.isCalled?(Z.warn(`shutdown may only be called once per LoggerProvider`),this._shutdownOnce.promise):this._shutdownOnce.call()}_shutdown(){return this._sharedState.activeProcessor.shutdown()}},Zb=mt,Qb=mn,$b=(e,t)=>Ot(Zb,ct(xi(function*(n){let r=new Set(t?.mergeWithExisting===!0?n.getRef(mt):[]);for(let t of e)r.add(rt(t)?yield*t:t);return r}))),ex=BigInt(1e9),tx=e=>[Number(e/ex),Number(e%ex)],nx=e=>{let t={};for(let[n,r]of Object.entries(e))t[n]=rx(r);return t},rx=e=>typeof e==`string`||typeof e==`number`||typeof e==`boolean`?e:typeof e==`bigint`?e.toString():Dt(e),ix=class extends F()(`@effect/opentelemetry/Resource`){},ax=e=>wi(ix,Fy(ox(e))),ox=e=>{let t={...e.attributes??void 0,[mv]:e.serviceName,[yv]:`@effect/opentelemetry`,[gv]:globalThis.document===void 0?_v:vv};return e.serviceVersion&&(t[hv]=e.serviceVersion),t},sx=class extends F()(`@effect/opentelemetry/Logger/OtelLoggerProvider`){},cx=e=>{switch(e){case`Trace`:return kb.TRACE;case`Debug`:return kb.DEBUG;case`Info`:return kb.INFO;case`Warn`:return kb.WARN;case`Error`:return kb.ERROR;case`Fatal`:return kb.FATAL;default:return kb.UNSPECIFIED}},lx=Bn(function*(){let e=yield*sx,t=yield*Re,n=e.getLogger(`@effect/opentelemetry`);return Qb(e=>{let r={fiberId:e.fiber.id},i=re(e.fiber.context,Mn);sr(i)&&(r.spanId=i.spanId,r.traceId=i.traceId);for(let[t,n]of Object.entries(e.fiber.getRef(ii)))r[t]=rx(n);let a=e.date.getTime();for(let[t,n]of e.fiber.getRef(Di))r[`logSpan.${t}`]=`${a-n}ms`;let o=wt(e.message).map(rx),s=tx(t.currentTimeNanosUnsafe());n.emit({body:o.length===1?o[0]:o,severityText:e.logLevel,severityNumber:cx(e.logLevel),timestamp:s,observedTimestamp:s,attributes:r})})}),ux=e=>$b([lx],{mergeWithExisting:e.mergeWithExisting??!0}),dx=(e,t)=>Ot(sx,Bn(function*(){let n=yield*ix;return yield*Ti(A(()=>new Xb({...t??void 0,processors:wt(e),resource:n})),e=>Qe(()=>e.forceFlush().then(()=>e.shutdown())).pipe(aa,ae,Pi(t?.shutdownTimeout??3e3)))})),fx;(function(e){e[e.DELTA=0]=`DELTA`,e[e.CUMULATIVE=1]=`CUMULATIVE`})(fx||={});var px;(function(e){e.COUNTER=`COUNTER`,e.GAUGE=`GAUGE`,e.HISTOGRAM=`HISTOGRAM`,e.UP_DOWN_COUNTER=`UP_DOWN_COUNTER`,e.OBSERVABLE_COUNTER=`OBSERVABLE_COUNTER`,e.OBSERVABLE_GAUGE=`OBSERVABLE_GAUGE`,e.OBSERVABLE_UP_DOWN_COUNTER=`OBSERVABLE_UP_DOWN_COUNTER`})(px||={});var mx;(function(e){e[e.HISTOGRAM=0]=`HISTOGRAM`,e[e.EXPONENTIAL_HISTOGRAM=1]=`EXPONENTIAL_HISTOGRAM`,e[e.GAUGE=2]=`GAUGE`,e[e.SUM=3]=`SUM`})(mx||={});var hx=`@effect/opentelemetry/Metrics`,gx=class{resource;context;temporality;startTimes;startTimeNanos;previousExportTimeNanos;previousCounterState;previousHistogramState;previousFrequencyState;previousSummaryState;constructor(e,t,n=`cumulative`){this.resource=e,this.context=t,this.temporality=n,this.startTimes=new Map,this.startTimeNanos=vx(),this.previousExportTimeNanos=this.startTimeNanos,this.previousCounterState=new Map,this.previousHistogramState=new Map,this.previousFrequencyState=new Map,this.previousSummaryState=new Map}startTimeFor(e,t){return this.startTimes.has(e)?this.startTimes.get(e):(this.startTimes.set(e,t),t)}collect(e){let t=Hn(this.context),n=vx(),i=[],a=new Map,o=e=>{i.push(e),a.set(e.descriptor.name,e)},s=this.temporality===`delta`,c=s?fx.DELTA:fx.CUMULATIVE,l=s?this.previousExportTimeNanos:this.startTimeNanos;for(let e=0,i=t.length;e<i;e++){let i=t[e],u=i.attributes?r(Object.entries(i.attributes),{},(e,[t,n])=>(e[t]=String(n),e)):{},d=_x(i.id,i.attributes);switch(i.type){case`Counter`:{let e=i.state.count,t=e;if(s){let n=this.previousCounterState.get(d);if(n!==void 0)if(typeof e==`bigint`&&typeof n==`bigint`)t=e-n,t<BigInt(0)&&(t=e);else{let r=Number(e);t=r-Number(n),t<0&&(t=r)}this.previousCounterState.set(d,e)}let r=yx(i,u),f={startTime:this.startTimeFor(r.name,l),endTime:n,attributes:u,value:Number(t)};a.has(i.id)?a.get(i.id).dataPoints.push(f):o({dataPointType:mx.SUM,descriptor:r,isMonotonic:i.state.incremental,aggregationTemporality:c,dataPoints:[f]});break}case`Gauge`:{let e=yx(i,u),t={startTime:this.startTimeFor(e.name,this.startTimeNanos),endTime:n,attributes:u,value:Number(i.state.value)};a.has(i.id)?a.get(i.id).dataPoints.push(t):o({dataPointType:mx.GAUGE,descriptor:e,aggregationTemporality:fx.CUMULATIVE,dataPoints:[t]});break}case`Histogram`:{let e=i.state.buckets.length,t={boundaries:Rr(e-1),counts:Rr(e)},r=0,f=0;for(let[n,a]of i.state.buckets)r<e-1&&(t.boundaries[r]=n),t.counts[r]=a-f,f=a,r++;let p=i.state.count,m=i.state.sum,h=t.counts,ee=i.state.min,te=i.state.max;if(s){let e=this.previousHistogramState.get(d);e!==void 0&&(p=i.state.count-e.count,m=i.state.sum-e.sum,h=t.counts.map((t,n)=>Math.max(0,t-(e.bucketCounts[n]??0)))),this.previousHistogramState.set(d,{count:i.state.count,sum:i.state.sum,bucketCounts:t.counts.slice(),min:i.state.min,max:i.state.max})}let ne=yx(i,u),g={startTime:this.startTimeFor(ne.name,l),endTime:n,attributes:u,value:{buckets:{boundaries:t.boundaries,counts:h},count:p,min:ee,max:te,sum:m}};a.has(i.id)?a.get(i.id).dataPoints.push(g):o({dataPointType:mx.HISTOGRAM,descriptor:ne,aggregationTemporality:c,dataPoints:[g]});break}case`Frequency`:{let e=[],t=new Map;for(let[r,a]of i.state.occurrences){t.set(r,a);let o=a;if(s){let e=this.previousFrequencyState.get(d);if(e!==void 0){let t=e.get(r)??0;o=Math.max(0,a-t)}}let c=yx(i,u),f=this.startTimeFor(c.name,l);e.push({startTime:f,endTime:n,attributes:{...u,key:r},value:o})}if(s&&this.previousFrequencyState.set(d,t),a.has(i.id))a.get(i.id).dataPoints.push(...e);else{let t=yx(i,u);o({dataPointType:mx.SUM,descriptor:t,aggregationTemporality:c,isMonotonic:!0,dataPoints:e})}break}case`Summary`:{let e=[{startTime:l,endTime:n,attributes:{...u,quantile:`min`},value:i.state.min}];for(let[t,r]of i.state.quantiles)e.push({startTime:l,endTime:n,attributes:{...u,quantile:t.toString()},value:r??0});e.push({startTime:l,endTime:n,attributes:{...u,quantile:`max`},value:i.state.max});let t=i.state.count,r=i.state.sum;if(s){let e=this.previousSummaryState.get(d);e!==void 0&&(t=i.state.count-e.count,r=i.state.sum-e.sum),this.previousSummaryState.set(d,{count:i.state.count,sum:i.state.sum})}let f={startTime:l,endTime:n,attributes:u,value:t},p={startTime:l,endTime:n,attributes:u,value:r};if(a.has(`${i.id}_quantiles`))a.get(`${i.id}_quantiles`).dataPoints.push(...e),a.get(`${i.id}_count`).dataPoints.push(f),a.get(`${i.id}_sum`).dataPoints.push(p);else{let t=yx(i,u);o({dataPointType:mx.SUM,descriptor:{...t,name:`${t.name}_quantiles`},aggregationTemporality:c,isMonotonic:!1,dataPoints:e}),o({dataPointType:mx.SUM,descriptor:{name:`${i.id}_count`,description:i.description??``,unit:`1`,type:px.COUNTER,valueType:e_.INT,advice:{}},aggregationTemporality:c,isMonotonic:!0,dataPoints:[f]}),o({dataPointType:mx.SUM,descriptor:{name:`${i.id}_sum`,description:i.description??``,unit:`1`,type:px.COUNTER,valueType:e_.DOUBLE,advice:{}},aggregationTemporality:c,isMonotonic:!0,dataPoints:[p]})}break}}}return s&&(this.previousExportTimeNanos=n),Promise.resolve({resourceMetrics:{resource:this.resource,scopeMetrics:[{scope:{name:hx},metrics:i}]},errors:[]})}},_x=(e,t)=>{if(t===void 0||Object.keys(t).length===0)return e;let n=Object.entries(t).sort((e,t)=>e[0].localeCompare(t[0]));return`${e}:${JSON.stringify(n)}`},vx=()=>{let e=Date.now();return[Math.floor(e/1e3),e%1e3*1e6]},yx=(e,t)=>{let n=t.unit??t.time_unit??`1`;return{name:e.id,description:e.description??``,unit:n,type:bx(e),valueType:xx(e),advice:{}}},bx=e=>{switch(e.type){case`Histogram`:return px.HISTOGRAM;case`Gauge`:return px.OBSERVABLE_GAUGE;case`Frequency`:return px.COUNTER;case`Counter`:return e.state.incremental?px.COUNTER:px.UP_DOWN_COUNTER;case`Summary`:return px.COUNTER}},xx=e=>e.type===`Counter`?typeof e.state.count==`bigint`?e_.INT:e_.DOUBLE:e.type===`Gauge`&&typeof e.state.value==`bigint`?e_.INT:e_.DOUBLE,Sx=e=>Bn(function*(){return new gx(yield*ix,yield*Or(),e)}),Cx=(e,t,n)=>Ti(A(()=>{let n=t(),r=Array.isArray(n)?n:[n];return r.forEach(t=>t.setMetricProducer(e)),r}),e=>Qe(()=>Promise.all(e.map(e=>e.shutdown()))).pipe(aa,ae,Pi(n?.shutdownTimeout??3e3))),wx=(e,t)=>ne(M(Sx(t?.temporality),n=>Cx(n,e,t))),Tx=class extends F()(`@effect/opentelemetry/Tracer`){},Ex=class extends F()(`@effect/opentelemetry/Tracer/OtelTracerProvider`){},Dx=class extends F()(`@effect/opentelemetry/Tracer/OtelTraceFlags`){},Ox=class extends F()(`@effect/opentelemetry/Tracer/OtelTraceState`){},kx=_(bt(Tx),e=>Wn({span(t){return new Px(N_,Q,e,t)},context(e,t){let n=t.currentSpan;return n===void 0?e[`~effect/Effect/evaluate`](t):N_.with(Vx(N_.active(),n),()=>e[`~effect/Effect/evaluate`](t))}})),Ax=Ot(Tx,Bn(function*(){let e=yield*ix;return(yield*Ex).getTracer(e.attributes[mv],e.attributes[hv])})),jx=Ot(li,kx).pipe(Ye(Ax)),Mx=`~@effect/opentelemetry/Tracer/OtelSpan`,Nx={internal:j_.INTERNAL,client:j_.CLIENT,server:j_.SERVER,producer:j_.PRODUCER,consumer:j_.CONSUMER},Px=class{[Mx];_tag=`Span`;name;kind;annotations;links;span;spanId;traceId;attributes=new Map;sampled;parent;status;constructor(e,t,n,r){this[Mx]=Mx,this.name=r.name,this.annotations=r.annotations,this.links=r.links,this.kind=r.kind;let i=e.active();this.parent=r.root===!0?r.parent:oe(r.parent,()=>Ix(t,i,r.annotations)),this.span=n.startSpan(r.name,{startTime:tx(r.startTime),links:r.links.length>0?r.links.map(e=>({context:Lx(e.span),attributes:nx(e.attributes)})):void 0,kind:Nx[this.kind]},ua(this.parent)?Vx(i,this.parent.value,r.annotations):Q.deleteSpan(i));let a=this.span.spanContext();this.spanId=a.spanId,this.traceId=a.traceId,this.status={_tag:`Started`,startTime:r.startTime},this.sampled=Fx(a.traceFlags)}attribute(e,t){this.span.setAttribute(e,rx(t)),this.attributes.set(e,t)}addLinks(e){this.links.push(...e),this.span.addLinks(e.map(e=>({context:Lx(e.span),attributes:nx(e.attributes)})))}end(e,t){let n=tx(e);if(this.status={_tag:`Ended`,endTime:e,exit:t,startTime:this.status.startTime},t._tag===`Success`)this.span.setStatus({code:M_.OK});else if(dt(t.cause))this.span.setStatus({code:M_.OK,message:Pr(t.cause)}),this.span.setAttribute(`span.label`,`⚠︎ Interrupted`),this.span.setAttribute(`status.interrupted`,!0);else{let e=tt(t.cause);if(e.length>0){for(let t of e)this.span.recordException(t,n);this.span.setStatus({code:M_.ERROR,message:e[0].message})}else this.span.setStatus({code:M_.OK})}this.span.end(n)}event(e,t,n){this.span.addEvent(e,n?nx(n):void 0,tx(t))}},Fx=e=>(e&s_.SAMPLED)===s_.SAMPLED,Ix=(e,t,n)=>{let r=e.getSpan(t)?.spanContext();return r?ta(Ai({spanId:r.spanId,traceId:r.traceId,sampled:(r.traceFlags&1)==1,annotations:n})):jt()},Lx=(e,t)=>{let n=Rx(e,t),r=zx(e,t);return{spanId:e.spanId,traceId:e.traceId,isRemote:e._tag===`ExternalSpan`,traceFlags:n,traceState:r}},Rx=(e,t)=>{let n;return sr(t)&&(n=Bx(e,t,Dx),jr(n)&&(n=re(e.annotations,Dx))),n??s_.SAMPLED},zx=(e,t)=>{let n;return sr(t)&&(n=Bx(e,t,Ox),jr(n)&&(n=re(e.annotations,Ox))),n},Bx=(e,t,n)=>{let r=re(t,n);return sr(r)?r:re(e.annotations,n)},Vx=(e,t,n)=>t instanceof Px?Q.setSpan(e,t.span):Q.setSpanContext(e,Lx(t,n)),Hx=(e,t)=>Ot(Ex,Bn(function*(){let n=yield*ix;return yield*Ti(A(()=>new Db({...t??void 0,resource:n,spanProcessors:Array.isArray(e)?e:[e]})),e=>aa(Qe(()=>e.forceFlush().then(()=>e.shutdown()))))})),Ux=e=>Ue(Bn(function*(){let t=yield*ea(e)?e:A(e),n=ax(t.resource),r=Ob(t.spanProcessor)?De(jx,Hx(t.spanProcessor,t.tracerConfig)):Yt,i=Ob(t.logRecordProcessor)?De(ux({mergeWithExisting:t.loggerMergeWithExisting}),dx(t.logRecordProcessor,t.loggerProviderConfig)):Yt;return Wt(r,Ob(t.metricReader)?wx(Yr(t.metricReader),{temporality:t.metricTemporality}):Yt,i).pipe(Ye(n))})),Wx=class{_delegate;constructor(e){this._delegate=e}export(e,t){this._delegate.export(e,t)}forceFlush(){return this._delegate.forceFlush()}shutdown(){return this._delegate.shutdown()}};function Gx(e,t){let n={attributes:qx(e.attributes,t),droppedAttributesCount:0},r=e.schemaUrl;return r&&r!==``&&(n.schemaUrl=r),n}function Kx(e,t){let n={name:e.name,version:e.version};return e.attributes&&Object.keys(e.attributes).length>0&&(n.attributes=qx(e.attributes,t),n.droppedAttributesCount=e.droppedAttributesCount??0),n}function qx(e,t){return Object.keys(e).map(n=>Jx(n,e[n],t))}function Jx(e,t,n){return{key:e,value:Yx(t,n)}}function Yx(e,t){let n=typeof e;if(n===`string`)return{stringValue:e};if(n===`number`)return Number.isInteger(e)?{intValue:e}:{doubleValue:e};if(n===`boolean`)return{boolValue:e};if(e instanceof Uint8Array)return{bytesValue:t.encodeUint8Array(e)};if(Array.isArray(e)){let n=Array(e.length);for(let r=0;r<e.length;r++)n[r]=Yx(e[r],t);return{arrayValue:{values:n}}}if(n===`object`&&e!=null){let n=Object.keys(e),r=Array(n.length);for(let i=0;i<n.length;i++)r[i]={key:n[i],value:Yx(e[n[i]],t)};return{kvlistValue:{values:r}}}return{}}var Xx=256,Zx=512;function Qx(e,t){let n=e&255|Xx;return t&&(n|=Zx),n}function $x(e,t){let n=e.spanContext(),r=e.status,i=e.parentSpanContext?.spanId?t.encodeSpanContext(e.parentSpanContext?.spanId):void 0;return{traceId:t.encodeSpanContext(n.traceId),spanId:t.encodeSpanContext(n.spanId),parentSpanId:i,traceState:n.traceState?.serialize(),name:e.name,kind:e.kind==null?0:e.kind+1,startTimeUnixNano:t.encodeHrTime(e.startTime),endTimeUnixNano:t.encodeHrTime(e.endTime),attributes:qx(e.attributes,t),droppedAttributesCount:e.droppedAttributesCount,events:e.events.map(e=>tS(e,t)),droppedEventsCount:e.droppedEventsCount,status:{code:r.code,message:r.message},links:e.links.map(e=>eS(e,t)),droppedLinksCount:e.droppedLinksCount,flags:Qx(n.traceFlags,e.parentSpanContext?.isRemote)}}function eS(e,t){return{attributes:e.attributes?qx(e.attributes,t):[],spanId:t.encodeSpanContext(e.context.spanId),traceId:t.encodeSpanContext(e.context.traceId),traceState:e.context.traceState?.serialize(),droppedAttributesCount:e.droppedAttributesCount||0,flags:Qx(e.context.traceFlags,e.context.isRemote)}}function tS(e,t){return{attributes:e.attributes?qx(e.attributes,t):[],name:e.name,timeUnixNano:t.encodeHrTime(e.time),droppedAttributesCount:e.droppedAttributesCount||0}}function nS(e,t){return{resourceSpans:iS(e,t)}}function rS(e){let t=new Map;for(let n of e){let e=t.get(n.resource);e||(e=new Map,t.set(n.resource,e));let r=`${n.instrumentationScope.name}@${n.instrumentationScope.version||``}:${n.instrumentationScope.schemaUrl||``}`,i=e.get(r);i||(i=[],e.set(r,i)),i.push(n)}return t}function iS(e,t){let n=rS(e),r=[],i=n.entries(),a=i.next();for(;!a.done;){let[e,n]=a.value,o=[],s=n.values(),c=s.next();for(;!c.done;){let e=c.value;if(e.length>0){let n=e.map(e=>$x(e,t));o.push({scope:Kx(e[0].instrumentationScope,t),spans:n,schemaUrl:e[0].instrumentationScope.schemaUrl})}c=s.next()}let l=Gx(e,t),u={resource:l,scopeSpans:o,schemaUrl:l.schemaUrl};r.push(u),a=i.next()}return r}function aS(e){let t=BigInt(1e9);return BigInt(Math.trunc(e[0]))*t+BigInt(Math.trunc(e[1]))}function oS(e){return aS(e).toString()}var sS=typeof BigInt<`u`?oS:jv;function cS(e){return e}var lS={encodeHrTime:sS,encodeSpanContext:cS,encodeOptionalSpanContext:cS,encodeUint8Array:e=>{if(typeof Buffer<`u`)return Buffer.from(e).toString(`base64`);let t=Array(e.length);for(let n=0;n<e.length;n++)t[n]=String.fromCharCode(e[n]);return btoa(t.join(``))}},uS={serializeRequest:e=>{let t=nS(e,lS);return new TextEncoder().encode(JSON.stringify(t))},deserializeResponse:e=>{if(e.length===0)return{};let t=new TextDecoder;try{return JSON.parse(t.decode(e))}catch(e){return Z.warn(`Failed to parse trace export response: ${e.message}. Returning empty response`),{}}}},dS=5,fS=1e3,pS=5e3,mS=1.5,hS=.2;function gS(){return 2*hS*Math.random()-hS}var _S=class{_transport;constructor(e){this._transport=e}retry(e,t,n){return new Promise((r,i)=>{setTimeout(()=>{this._transport.send(e,t).then(r,i)},n)})}async send(e,t){let n=dS,r=fS,i=Date.now()+t,a=await this._transport.send(e,t);for(;a.status===`retryable`&&n>0;){n--;let t=Math.max(Math.min(r*(1+gS()),pS),0);r*=mS;let o=a.retryInMillis??t,s=i-Date.now();if(o>s)return Z.info(`Export retry time ${Math.round(o)}ms exceeds remaining timeout ${Math.round(s)}ms, not retrying further.`),a;Z.verbose(`Scheduling export retry in ${Math.round(o)}ms`),a=await this.retry(e,s,o)}return a.status===`success`?Z.verbose(`Export succeeded after ${dS-n} retry attempts.`):a.status===`retryable`?Z.info(`Export failed after maximum retry attempts (${dS}).`):Z.info(`Export failed with non-retryable error: ${a.error}`),a}shutdown(){return this._transport.shutdown()}};function vS(e){return new _S(e.transport)}var yS=class{_concurrencyLimit;_sendingPromises=[];constructor(e){this._concurrencyLimit=e}pushPromise(e){if(this.hasReachedLimit())throw Error(`Concurrency Limit reached`);this._sendingPromises.push(e);let t=()=>{let t=this._sendingPromises.indexOf(e);this._sendingPromises.splice(t,1)};e.then(t,t)}hasReachedLimit(){return this._sendingPromises.length>=this._concurrencyLimit}async awaitAll(){await Promise.all(this._sendingPromises)}};function bS(e){return new yS(e.concurrencyLimit)}var xS=class extends Error{code;name=`OTLPExporterError`;data;constructor(e,t,n){super(e),this.data=n,this.code=t}};function SS(e){return Object.prototype.hasOwnProperty.call(e,`partialSuccess`)}function CS(){return{handleResponse(e){e==null||!SS(e)||e.partialSuccess==null||Object.keys(e.partialSuccess).length===0||Z.warn(`Received Partial Success response:`,JSON.stringify(e.partialSuccess))}}}var wS=class{_diagLogger;_transport;_serializer;_responseHandler;_promiseQueue;_timeout;constructor(e,t,n,r,i){this._transport=e,this._serializer=t,this._responseHandler=n,this._promiseQueue=r,this._timeout=i,this._diagLogger=Z.createComponentLogger({namespace:`OTLPExportDelegate`})}export(e,t){if(this._diagLogger.debug(`items to be sent`,e),this._promiseQueue.hasReachedLimit()){t({code:Fv.FAILED,error:Error(`Concurrent export limit reached`)});return}let n=this._serializer.serializeRequest(e);if(n==null){t({code:Fv.FAILED,error:Error(`Nothing to send`)});return}this._promiseQueue.pushPromise(this._transport.send(n,this._timeout).then(e=>{if(e.status===`success`){if(e.data!=null)try{this._responseHandler.handleResponse(this._serializer.deserializeResponse(e.data))}catch(t){this._diagLogger.warn(`Export succeeded but could not deserialize response - is the response specification compliant?`,t,e.data)}t({code:Fv.SUCCESS});return}else if(e.status===`failure`&&e.error){t({code:Fv.FAILED,error:e.error});return}else e.status===`retryable`?t({code:Fv.FAILED,error:e.error??new xS(`Export failed with retryable status`)}):t({code:Fv.FAILED,error:new xS(`Export failed with unknown error`)})},e=>t({code:Fv.FAILED,error:e})))}forceFlush(){return this._promiseQueue.awaitAll()}async shutdown(){this._diagLogger.debug(`shutdown started`),await this.forceFlush(),this._transport.shutdown()}};function TS(e,t){return new wS(e.transport,e.serializer,CS(),e.promiseHandler,t.timeout)}function ES(e,t,n){return TS({transport:n,serializer:t,promiseHandler:bS(e)},{timeout:e.timeoutMillis})}function DS(e){return e===429||e===502||e===503||e===504}function OS(e){if(e==null)return;let t=Number.parseInt(e,10);if(Number.isInteger(t))return t>0?t*1e3:-1;let n=new Date(e).getTime()-Date.now();return n>=0?n:0}var kS=60*1024,AS=9,jS=0,MS=0,NS=class{_parameters;constructor(e){this._parameters=e}async send(e,t){let n=new AbortController,r=setTimeout(()=>n.abort(),t),i=globalThis.fetch;typeof i.__original==`function`&&(i=i.__original);let a=e.byteLength,o=jS+a>kS,s=!o&&!(MS>=AS);if(s)jS+=a,MS++;else{let e=o?`size limit`:`count limit`;Z.debug(`keepalive disabled: ${(a/1024).toFixed(1)}KB payload, ${MS} pending (${e})`)}try{let t=new URL(this._parameters.url),r=await i(t.href,{method:`POST`,headers:await this._parameters.headers(),body:e,signal:n.signal,keepalive:s,mode:globalThis.location?globalThis.location.origin===t.origin?`same-origin`:`cors`:`no-cors`});return r.status>=200&&r.status<=299?(Z.debug(`export response success (status: ${r.status})`),{status:`success`}):DS(r.status)?(Z.warn(`export response retryable (status: ${r.status})`),{status:`retryable`,retryInMillis:OS(r.headers.get(`Retry-After`))}):(Z.error(`export response failure (status: ${r.status})`),{status:`failure`,error:Error(`Fetch request failed with non-retryable status ${r.status}`)})}catch(e){return FS(e)?(Z.warn(`export request retryable (network error: ${e})`),{status:`retryable`,error:Error(`Fetch request encountered a network error`,{cause:e})}):(Z.error(`export request failure (error: ${e})`),{status:`failure`,error:Error(`Fetch request errored`,{cause:e})})}finally{clearTimeout(r),s&&(jS-=a,MS--)}}shutdown(){}};function PS(e){return new NS(e)}function FS(e){return e instanceof TypeError&&!e.cause}function IS(e,t){return ES(e,t,vS({transport:PS(e)}))}function LS(e){if(Number.isFinite(e)&&e>0)return e;throw Error(`Configuration: timeoutMillis is invalid, expected number greater than 0 (actual: '${e}')`)}function RS(e){if(e!=null)return async()=>e}function zS(e,t,n){return{timeoutMillis:LS(e.timeoutMillis??t.timeoutMillis??n.timeoutMillis),concurrencyLimit:e.concurrencyLimit??t.concurrencyLimit??n.concurrencyLimit,compression:e.compression??t.compression??n.compression}}function BS(){return{timeoutMillis:1e4,concurrencyLimit:30,compression:`none`}}function VS(e){let t={};return Object.entries(e??{}).forEach(([e,n])=>{n===void 0?Z.warn(`Header "${e}" has invalid value (${n}) and will be ignored`):t[e]=String(n)}),t}function HS(e,t,n){return async()=>{let r={...await n()},i={};return t!=null&&Object.assign(i,await t()),e!=null&&Object.assign(i,VS(await e())),Object.assign(i,r)}}function US(e){if(e!=null)try{let t=globalThis.location?.href;return new URL(e,t).href}catch{throw Error(`Configuration: Could not parse user-provided export URL: '${e}'`)}}function WS(e,t,n){return{...zS(e,t,n),headers:HS(e.headers,t.headers,n.headers),url:US(e.url)??t.url??n.url}}function GS(e,t){return{...BS(),headers:async()=>e,url:`http://localhost:4318/`+t}}function KS(e){return typeof e.headers==`function`?e.headers:RS(e.headers)}function qS(e,t,n){return WS({url:e.url,timeoutMillis:e.timeoutMillis,headers:KS(e),concurrencyLimit:e.concurrencyLimit},{},GS(n,t))}function JS(e,t,n,r){return IS(qS(e,n,r),t)}var YS=class extends Wx{constructor(e={}){super(JS(e,uS,`v1/traces`,{"Content-Type":`application/json`}))}};function XS(e){return Ue(_(mc(bc(`VITE_OTEL_URL`)),oa({onNone:()=>Yt,onSome:t=>Ux(A(()=>({resource:{serviceName:e},spanProcessor:[new Cb(new YS({url:t}))]})))})))}var ZS=O(Yt,Ye(XS(`workbench-client`)),Ye(Km),Ye(Em),Ye(Zs(Qs({VITE_OTEL_URL:{BASE_URL:`/`,DEV:!1,MODE:`production`,PROD:!0,SSR:!1,TSS_INLINE_CSS_ENABLED:`false`}.VITE_OTEL_URL,VITE_PORTLESS_BASE_ORIGIN:{BASE_URL:`/`,DEV:!1,MODE:`production`,PROD:!0,SSR:!1,TSS_INLINE_CSS_ENABLED:`false`}.VITE_PORTLESS_BASE_ORIGIN,VITE_PORTLESS_ORIGIN:{BASE_URL:`/`,DEV:!1,MODE:`production`,PROD:!0,SSR:!1,TSS_INLINE_CSS_ENABLED:`false`}.VITE_PORTLESS_ORIGIN})))),$=class extends Hm()(`ApiClient`,{group:dg,protocol:O(zm({retryTransientErrors:!0}),Ye(zf(O(We({base:mc(bc(`VITE_PORTLESS_BASE_ORIGIN`)),origin:mc(bc(`VITE_PORTLESS_ORIGIN`))}),_(e=>O(e.base,Vn(e=>{let t=new URL(e);return t.hostname=`server.${t.hostname}`,t.origin}),oe(()=>Vn(e.origin,e=>{let t=new URL(e);return t.hostname=[`server`,...t.hostname.split(`.`).slice(1)].join(`.`),t.origin})),oa({onNone:()=>`${location.origin}/api/rpc`,onSome:e=>`${e}/api/rpc`}))),Ie))),Ye(If),Ye(ZS))}){},QS=class extends qi{},$S=class extends qi{};function eC(e){if(e!==void 0)return Object.fromEntries(O(Object.entries(e),oi(e=>e[0],Lt)))}function tC(e){let t=eC(e.env);return{...e.args===void 0?{}:{args:[...e.args]},...e.command===void 0?{}:{command:e.command},cwd:e.cwd,...t===void 0?{}:{env:t},...e.sessionId===void 0?{}:{sessionId:e.sessionId}}}function nC(e){return JSON.stringify(tC(e))}function rC(e){return Math.abs(ln(e)).toString(36)}function iC(){return{state:`idle`,title:``}}var aC=ru(e=>$.runtime.atom(O($,M(t=>t(`terminal.attach`,{...tC(e.session),...e.size},{asQueue:!0}))))),oC=ru(e=>eu(t=>O(t.result(aC(e),{suspendOnWaiting:!0}),_(js),Ps),{disableAccumulation:!0}));function sC(e,t,n){return oC(new $S({attachId:t,session:tC(e),size:n}))}var cC=ru(e=>$.runtime.atom(O($,_(t=>t(`terminal.status`,tC(e))),Ps),{initialValue:iC()}));function lC(e){return cC(new QS(tC(e)))}var uC=ru(e=>iu($.runtime.atom(M($,t=>Hr(e)?t(`runs.portless`,{cwd:e}):C([])),{initialValue:[]})));ru(e=>iu($.runtime.atom(M($,t=>Hr(e)?t(`runs.scripts`,{cwd:e}):C([])),{initialValue:[]})));var dC=ru(e=>Il(t=>O(t.result(uC(e)),_(e=>O(e,bn(e=>e.origin.origin),at,oi(e=>e,Lt)))))),fC=iu($.runtime.atom(O($,_(e=>e(`projects`,void 0)),Ps))),pC=iu($.runtime.atom(O($,_(e=>e(`home.sidebar`,void 0)),Ps))),mC=ru(e=>iu(Il(t=>O(t.result(fC),_(t=>{let n=m(t,t=>zi(t.worktrees,t=>rC(t.root)===e)),r=O(n,fr(t=>m(t.worktrees,t=>rC(t.root)===e)));return{activeProject:kn(n),activeWorktree:kn(r),projects:t}}))))),hC=ru(e=>iu(Il(t=>O(t.result(pC),_(t=>{let n=m(t.projects,t=>zi(t.worktrees,t=>rC(t.root)===e)),r=O(n,fr(t=>m(t.worktrees,t=>rC(t.root)===e)));return{activeProject:kn(n),activeWorktree:kn(r),agentProfiles:t.agentProfiles,projects:t.projects}}))))),gC=ru(e=>$.runtime.atom(O($,_(t=>t(`agents`,{cwd:e})),Ps)));iu($.runtime.atom(M($,e=>e(`agents.profiles`,void 0)),{initialValue:[]}));var _C=ru(e=>iu($.runtime.atom(O($,_(t=>t(`usage`,{provider:e})),Ps)))),vC=iu($.runtime.atom(O($,_(e=>e(`usage.system`,void 0)),Ps)));export{Gc as A,xu as C,cu as D,Il as E,Ps as M,lu as O,Au as S,iu as T,Bh as _,vC as a,Tu as b,lC as c,$ as d,Jh as f,zh as g,Rh as h,dC as i,Uc as j,uu as k,_C as l,jh as m,hC as n,sC as o,Ph as p,gC as r,nC as s,mC as t,rC as u,Vh as v,ru as w,ju as x,Eu as y};
@@ -1 +0,0 @@
1
- import{n as e,t}from"./compiler-runtime-CLAvuQ-D.js";import{S as n,t as r}from"./state-_2CmL5IM.js";import{t as i}from"./terminal-Bn9lFOEg.js";import{t as a}from"./-workbench-terminal-nnzNYgEY.js";var o=t(),s=e();function c(){let e=(0,o.c)(7),t=i.useParams(),c;e[0]===t.worktree?c=e[1]:(c=r(t.worktree),e[0]=t.worktree,e[1]=c);let l=n(c);if(!l.value.activeWorktree)return;let u;e[2]===l.value.activeWorktree.root?u=e[3]:(u=(0,s.jsx)(a,{session:{cwd:l.value.activeWorktree.root}}),e[2]=l.value.activeWorktree.root,e[3]=u);let d;return e[4]!==l.value.activeWorktree.root||e[5]!==u?(d=(0,s.jsx)(`div`,{className:`bg-background h-full min-h-0 min-w-0`,children:u},l.value.activeWorktree.root),e[4]=l.value.activeWorktree.root,e[5]=u,e[6]=d):d=e[6],d}export{c as component};
@@ -1,2 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/terminal-BC9WKciF.js","assets/compiler-runtime-CLAvuQ-D.js","assets/rolldown-runtime-QTnfLwEv.js","assets/state-_2CmL5IM.js","assets/fallbacks-DwGmG_0c.js","assets/-workbench-terminal-nnzNYgEY.js"])))=>i.map(i=>d[i]);
2
- import{vs as e,ys as t}from"./fallbacks-DwGmG_0c.js";import{t as n}from"./preload-helper-CjdClQve.js";var r=t(`/(home)/$worktree/terminal`)({component:e(()=>n(()=>import(`./terminal-BC9WKciF.js`),__vite__mapDeps([0,1,2,3,4,5])),`component`)});export{r as t};