@claude-sessions/web 0.4.0 → 0.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/client/_app/immutable/assets/0.B02QGPuL.css +1 -0
- package/build/client/_app/immutable/assets/0.B02QGPuL.css.br +0 -0
- package/build/client/_app/immutable/assets/0.B02QGPuL.css.gz +0 -0
- package/build/client/_app/immutable/chunks/{pIpqdOQZ.js → B-Z9hXPk.js} +1 -1
- package/build/client/_app/immutable/chunks/B-Z9hXPk.js.br +0 -0
- package/build/client/_app/immutable/chunks/B-Z9hXPk.js.gz +0 -0
- package/build/client/_app/immutable/chunks/{D36ll3tU.js → Cr0eW1j3.js} +1 -1
- package/build/client/_app/immutable/chunks/Cr0eW1j3.js.br +0 -0
- package/build/client/_app/immutable/chunks/Cr0eW1j3.js.gz +0 -0
- package/build/client/_app/immutable/chunks/{Ct7gnOMS.js → D49tNEXH.js} +1 -1
- package/build/client/_app/immutable/chunks/D49tNEXH.js.br +0 -0
- package/build/client/_app/immutable/chunks/D49tNEXH.js.gz +0 -0
- package/build/client/_app/immutable/chunks/DOXVKi87.js +2 -0
- package/build/client/_app/immutable/chunks/DOXVKi87.js.br +0 -0
- package/build/client/_app/immutable/chunks/DOXVKi87.js.gz +0 -0
- package/build/client/_app/immutable/chunks/DVh32r5c.js +90 -0
- package/build/client/_app/immutable/chunks/DVh32r5c.js.br +0 -0
- package/build/client/_app/immutable/chunks/DVh32r5c.js.gz +0 -0
- package/build/client/_app/immutable/chunks/{DSHOiHEu.js → Dzg_BFdu.js} +1 -1
- package/build/client/_app/immutable/chunks/Dzg_BFdu.js.br +0 -0
- package/build/client/_app/immutable/chunks/Dzg_BFdu.js.gz +0 -0
- package/build/client/_app/immutable/chunks/YXuXYbOb.js +1 -0
- package/build/client/_app/immutable/chunks/YXuXYbOb.js.br +0 -0
- package/build/client/_app/immutable/chunks/YXuXYbOb.js.gz +0 -0
- package/build/client/_app/immutable/entry/{app.B8IwrV9r.js → app.Btq_bE7X.js} +2 -2
- package/build/client/_app/immutable/entry/app.Btq_bE7X.js.br +0 -0
- package/build/client/_app/immutable/entry/app.Btq_bE7X.js.gz +0 -0
- package/build/client/_app/immutable/entry/start.DiKqSoAN.js +1 -0
- package/build/client/_app/immutable/entry/start.DiKqSoAN.js.br +2 -0
- package/build/client/_app/immutable/entry/start.DiKqSoAN.js.gz +0 -0
- package/build/client/_app/immutable/nodes/{0.DErsC77t.js → 0.CjrUlXhs.js} +1 -1
- package/build/client/_app/immutable/nodes/0.CjrUlXhs.js.br +0 -0
- package/build/client/_app/immutable/nodes/0.CjrUlXhs.js.gz +0 -0
- package/build/client/_app/immutable/nodes/{1.CttaK5cr.js → 1.C_mir9rr.js} +1 -1
- package/build/client/_app/immutable/nodes/1.C_mir9rr.js.br +0 -0
- package/build/client/_app/immutable/nodes/1.C_mir9rr.js.gz +0 -0
- package/build/client/_app/immutable/nodes/{2.BoE8-2iz.js → 2.C1TvKf9x.js} +1 -1
- package/build/client/_app/immutable/nodes/2.C1TvKf9x.js.br +0 -0
- package/build/client/_app/immutable/nodes/2.C1TvKf9x.js.gz +0 -0
- package/build/client/_app/immutable/nodes/{3.CNK57PCS.js → 3.C4KCGMhg.js} +1 -1
- package/build/client/_app/immutable/nodes/3.C4KCGMhg.js.br +0 -0
- package/build/client/_app/immutable/nodes/3.C4KCGMhg.js.gz +0 -0
- package/build/client/_app/version.json +1 -1
- package/build/client/_app/version.json.br +0 -0
- package/build/client/_app/version.json.gz +0 -0
- package/build/env.js +51 -2
- package/build/handler.js +46 -4
- package/build/index.js +25 -14
- package/build/server/chunks/0-_4Y5P6Pu.js +17 -0
- package/build/server/chunks/{0-BVOw-QLW.js.map → 0-_4Y5P6Pu.js.map} +1 -1
- package/build/server/chunks/1-BFEz-9-0.js +9 -0
- package/build/server/chunks/{1-DcWoDxkF.js.map → 1-BFEz-9-0.js.map} +1 -1
- package/build/server/chunks/2-BJBIDU_y.js +9 -0
- package/build/server/chunks/{2-CeDc2VGX.js.map → 2-BJBIDU_y.js.map} +1 -1
- package/build/server/chunks/3-fx1FyCiP.js +9 -0
- package/build/server/chunks/{3-CnCgC9Lk.js.map → 3-fx1FyCiP.js.map} +1 -1
- package/build/server/chunks/{InputModal-XaplAR5y.js → InputModal-CbpiMXy3.js} +3 -3
- package/build/server/chunks/InputModal-CbpiMXy3.js.map +1 -0
- package/build/server/chunks/{Toast-D4IwVuee.js → Toast-Crka3UoV.js} +4 -4
- package/build/server/chunks/Toast-Crka3UoV.js.map +1 -0
- package/build/server/chunks/{_layout.svelte-D8RsKs1I.js → _layout.svelte-IUZv8Y-p.js} +6 -6
- package/build/server/chunks/_layout.svelte-IUZv8Y-p.js.map +1 -0
- package/build/server/chunks/{_page.svelte-DLMeV_uH.js → _page.svelte-CVZlXeAH.js} +279 -169
- package/build/server/chunks/_page.svelte-CVZlXeAH.js.map +1 -0
- package/build/server/chunks/{_page.svelte-CnzAaQ3o.js → _page.svelte-Hxh7dTyf.js} +7 -7
- package/build/server/chunks/_page.svelte-Hxh7dTyf.js.map +1 -0
- package/build/server/chunks/{_server.ts-Chx6z8Ha.js → _server.ts-B1VENOjw.js} +2 -2
- package/build/server/chunks/{_server.ts-Chx6z8Ha.js.map → _server.ts-B1VENOjw.js.map} +1 -1
- package/build/server/chunks/_server.ts-B2LLvx6I.js +41 -0
- package/build/server/chunks/_server.ts-B2LLvx6I.js.map +1 -0
- package/build/server/chunks/{_server.ts-C_J07ZgO.js → _server.ts-B3x7amtu.js} +2 -2
- package/build/server/chunks/{_server.ts-C_J07ZgO.js.map → _server.ts-B3x7amtu.js.map} +1 -1
- package/build/server/chunks/{_server.ts-WMEN7B0K.js → _server.ts-B7mAMmzV.js} +2 -2
- package/build/server/chunks/{_server.ts-WMEN7B0K.js.map → _server.ts-B7mAMmzV.js.map} +1 -1
- package/build/server/chunks/{_server.ts-BUP1oLdG.js → _server.ts-BDo-cBep.js} +2 -2
- package/build/server/chunks/{_server.ts-BUP1oLdG.js.map → _server.ts-BDo-cBep.js.map} +1 -1
- package/build/server/chunks/{_server.ts-BI9MivzV.js → _server.ts-BEMET_M9.js} +2 -2
- package/build/server/chunks/{_server.ts-BI9MivzV.js.map → _server.ts-BEMET_M9.js.map} +1 -1
- package/build/server/chunks/{_server.ts-CijK2VGG.js → _server.ts-B_tHvJuE.js} +2 -2
- package/build/server/chunks/{_server.ts-CijK2VGG.js.map → _server.ts-B_tHvJuE.js.map} +1 -1
- package/build/server/chunks/{_server.ts-CFN6ekMg.js → _server.ts-CYy3E-wy.js} +2 -2
- package/build/server/chunks/{_server.ts-CFN6ekMg.js.map → _server.ts-CYy3E-wy.js.map} +1 -1
- package/build/server/chunks/_server.ts-Cn3u85fU.js +26 -0
- package/build/server/chunks/_server.ts-Cn3u85fU.js.map +1 -0
- package/build/server/chunks/{_server.ts-DS4LtLJR.js → _server.ts-CwCozCTU.js} +2 -2
- package/build/server/chunks/{_server.ts-DS4LtLJR.js.map → _server.ts-CwCozCTU.js.map} +1 -1
- package/build/server/chunks/{_server.ts-Qm-5UM6l.js → _server.ts-Cyd5L7R7.js} +2 -2
- package/build/server/chunks/{_server.ts-Qm-5UM6l.js.map → _server.ts-Cyd5L7R7.js.map} +1 -1
- package/build/server/chunks/{_server.ts-Csnu3HvS.js → _server.ts-D_nsNW3s.js} +2 -2
- package/build/server/chunks/{_server.ts-Csnu3HvS.js.map → _server.ts-D_nsNW3s.js.map} +1 -1
- package/build/server/chunks/{_server.ts-DrDTz9tO.js → _server.ts-Dm4cFvT_.js} +2 -2
- package/build/server/chunks/{_server.ts-DrDTz9tO.js.map → _server.ts-Dm4cFvT_.js.map} +1 -1
- package/build/server/chunks/{_server.ts-B0L-omzE.js → _server.ts-SM5kuocx.js} +2 -2
- package/build/server/chunks/{_server.ts-B0L-omzE.js.map → _server.ts-SM5kuocx.js.map} +1 -1
- package/build/server/chunks/{_server.ts-BDll_uG4.js → _server.ts-X0UsKGpZ.js} +2 -2
- package/build/server/chunks/{_server.ts-BDll_uG4.js.map → _server.ts-X0UsKGpZ.js.map} +1 -1
- package/build/server/chunks/{_server.ts-3KinOGG2.js → _server.ts-kaRz-iNE.js} +2 -2
- package/build/server/chunks/{_server.ts-3KinOGG2.js.map → _server.ts-kaRz-iNE.js.map} +1 -1
- package/build/server/chunks/{error.svelte-C43AeaaJ.js → error.svelte-BNCG_dZH.js} +3 -3
- package/build/server/chunks/{error.svelte-C43AeaaJ.js.map → error.svelte-BNCG_dZH.js.map} +1 -1
- package/build/server/chunks/exports-BXvEiaiv.js.map +1 -1
- package/build/server/chunks/{index2-Da0doXJY.js → index-BEaiIYry.js} +388 -4
- package/build/server/chunks/index-BEaiIYry.js.map +1 -0
- package/build/server/chunks/index-CoD1IJuy.js.map +1 -1
- package/build/server/chunks/{index-DzYX9r1_.js → index2-ybZwlzIk.js} +110 -116
- package/build/server/chunks/index2-ybZwlzIk.js.map +1 -0
- package/build/server/chunks/{index3-BOWsMtX4.js → index3-CcQtlmu9.js} +135 -70
- package/build/server/chunks/index3-CcQtlmu9.js.map +1 -0
- package/build/server/chunks/{index4-BUZEWk-I.js → index4-B6vRxXfo.js} +2 -2
- package/build/server/chunks/index4-B6vRxXfo.js.map +1 -0
- package/build/server/chunks/shared-server-DaWdgxVh.js +11 -0
- package/build/server/chunks/shared-server-DaWdgxVh.js.map +1 -0
- package/build/server/index.js +115 -439
- package/build/server/index.js.map +1 -1
- package/build/server/manifest.js +21 -21
- package/build/server/manifest.js.map +1 -1
- package/dist/cli.js +26 -1
- package/package.json +18 -18
- package/build/client/_app/immutable/assets/0.CdaICEam.css +0 -1
- package/build/client/_app/immutable/assets/0.CdaICEam.css.br +0 -0
- package/build/client/_app/immutable/assets/0.CdaICEam.css.gz +0 -0
- package/build/client/_app/immutable/chunks/6qMZRyTA.js +0 -90
- package/build/client/_app/immutable/chunks/6qMZRyTA.js.br +0 -0
- package/build/client/_app/immutable/chunks/6qMZRyTA.js.gz +0 -0
- package/build/client/_app/immutable/chunks/BezDCpdL.js +0 -1
- package/build/client/_app/immutable/chunks/BezDCpdL.js.br +0 -0
- package/build/client/_app/immutable/chunks/BezDCpdL.js.gz +0 -0
- package/build/client/_app/immutable/chunks/Ct7gnOMS.js.br +0 -0
- package/build/client/_app/immutable/chunks/Ct7gnOMS.js.gz +0 -0
- package/build/client/_app/immutable/chunks/D36ll3tU.js.br +0 -0
- package/build/client/_app/immutable/chunks/D36ll3tU.js.gz +0 -0
- package/build/client/_app/immutable/chunks/DSHOiHEu.js.br +0 -0
- package/build/client/_app/immutable/chunks/DSHOiHEu.js.gz +0 -0
- package/build/client/_app/immutable/chunks/DW1ZKM0I.js +0 -2
- package/build/client/_app/immutable/chunks/DW1ZKM0I.js.br +0 -0
- package/build/client/_app/immutable/chunks/DW1ZKM0I.js.gz +0 -0
- package/build/client/_app/immutable/chunks/pIpqdOQZ.js.br +0 -0
- package/build/client/_app/immutable/chunks/pIpqdOQZ.js.gz +0 -0
- package/build/client/_app/immutable/entry/app.B8IwrV9r.js.br +0 -0
- package/build/client/_app/immutable/entry/app.B8IwrV9r.js.gz +0 -0
- package/build/client/_app/immutable/entry/start.BWG5JAGE.js +0 -1
- package/build/client/_app/immutable/entry/start.BWG5JAGE.js.br +0 -2
- package/build/client/_app/immutable/entry/start.BWG5JAGE.js.gz +0 -0
- package/build/client/_app/immutable/nodes/0.DErsC77t.js.br +0 -0
- package/build/client/_app/immutable/nodes/0.DErsC77t.js.gz +0 -0
- package/build/client/_app/immutable/nodes/1.CttaK5cr.js.br +0 -0
- package/build/client/_app/immutable/nodes/1.CttaK5cr.js.gz +0 -0
- package/build/client/_app/immutable/nodes/2.BoE8-2iz.js.br +0 -0
- package/build/client/_app/immutable/nodes/2.BoE8-2iz.js.gz +0 -0
- package/build/client/_app/immutable/nodes/3.CNK57PCS.js.br +0 -0
- package/build/client/_app/immutable/nodes/3.CNK57PCS.js.gz +0 -0
- package/build/server/chunks/0-BVOw-QLW.js +0 -17
- package/build/server/chunks/1-DcWoDxkF.js +0 -9
- package/build/server/chunks/2-CeDc2VGX.js +0 -9
- package/build/server/chunks/3-CnCgC9Lk.js +0 -9
- package/build/server/chunks/InputModal-XaplAR5y.js.map +0 -1
- package/build/server/chunks/Toast-D4IwVuee.js.map +0 -1
- package/build/server/chunks/_layout.svelte-D8RsKs1I.js.map +0 -1
- package/build/server/chunks/_page.svelte-CnzAaQ3o.js.map +0 -1
- package/build/server/chunks/_page.svelte-DLMeV_uH.js.map +0 -1
- package/build/server/chunks/_server.ts-CHX8x48n.js +0 -27
- package/build/server/chunks/_server.ts-CHX8x48n.js.map +0 -1
- package/build/server/chunks/_server.ts-u9CxsloP.js +0 -20
- package/build/server/chunks/_server.ts-u9CxsloP.js.map +0 -1
- package/build/server/chunks/index-DzYX9r1_.js.map +0 -1
- package/build/server/chunks/index2-Da0doXJY.js.map +0 -1
- package/build/server/chunks/index3-BOWsMtX4.js.map +0 -1
- package/build/server/chunks/index4-BUZEWk-I.js.map +0 -1
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
import{i as Og,b as Mg,d as Jt,n as Ag,g as Ng,c as ue,a as y,f as E,s as A,e as En,t as Bt}from"./DW1ZKM0I.js";import{aM as La,aN as Au,aO as Fg,l as Ye,P as Nu,aP as Pg,k as Da,aQ as ll,S as Fu,v as Qs,T as Vo,q as kn,V as Ba,aq as Zr,ai as li,Y as Ho,aR as $g,ak as jg,aS as Lg,aT as Dg,af as Bg,aU as Pu,j as Io,m as Ug,g as l,a7 as qg,R as zg,w as Bs,C as Vg,aK as Hg,I as Xn,aV as an,M as is,O as Kg,aI as Ua,aW as Jg,aX as Gg,aY as Wg,J as $u,L as ju,aZ as To,n as Yg,aH as Zg,K as ui,a_ as Lu,a$ as Qg,Q as Xg,b0 as Du,x as Bu,a0 as ep,b1 as tp,b2 as np,b3 as rp,b4 as sp,b5 as ip,b6 as op,b7 as ap,b8 as cp,b9 as lp,ba as Uu,ag as qu,A as zu,U as Vu,bb as up,bc as fp,bd as hp,_ as dp,p as dn,f as ee,c as gn,d as v,r as _,e as R,t as B,s as et,a as fi,u as tr,b as K,h as V,ar as nr,be as Hu,bf as gp}from"./BezDCpdL.js";import{B as Ku,p as Je,i as $,b as qa,r as pp,a as mp,s as _p}from"./pIpqdOQZ.js";const bp=[];function vp(t,e=!1,n=!1){return Xs(t,new Map,"",bp,null,n)}function Xs(t,e,n,r,s=null,i=!1){if(typeof t=="object"&&t!==null){var o=e.get(t);if(o!==void 0)return o;if(t instanceof Map)return new Map(t);if(t instanceof Set)return new Set(t);if(La(t)){var c=Array(t.length);e.set(t,c),s!==null&&e.set(s,c);for(var a=0;a<t.length;a+=1){var u=t[a];a in t&&(c[a]=Xs(u,e,n,r,null,i))}return c}if(Au(t)===Fg){c={},e.set(t,c),s!==null&&e.set(s,c);for(var f in t)c[f]=Xs(t[f],e,n,r,null,i);return c}if(t instanceof Date)return structuredClone(t);if(typeof t.toJSON=="function"&&!i)return Xs(t.toJSON(),e,n,r,t)}if(t instanceof EventTarget)return t;try{return structuredClone(t)}catch{return t}}const ul=0,Co=1;function Ko(t,e,n,r,s){Ye&&Nu();var i=Pg(),o=Pu,c=i?li(o):Ho(o,!1,!1),a=i?li(o):Ho(o,!1,!1),u=new Ku(t);Da(()=>{var f=e(),d=!1;let h=Ye&&ll(f)===(t.data===Fu);if(h&&(Qs(Vo()),kn(!1)),ll(f)){var p=$g(),g=!1;const x=m=>{if(!d){g=!0,p(!1),jg.ensure(),Ye&&kn(!1);try{m()}finally{Lg(),Dg||Bg()}}};f.then(m=>{x(()=>{Zr(c,m),u.ensure(Co,r&&(k=>r(k,c)))})},m=>{x(()=>{if(Zr(a,m),u.ensure(Co,s&&(k=>s(k,a))),!s)throw a.v})}),Ye?u.ensure(ul,n):Ba(()=>{g||x(()=>{u.ensure(ul,n)})})}else Zr(c,f),u.ensure(Co,r&&(x=>r(x,c)));return h&&kn(!0),()=>{d=!0}})}function Ft(t,e){return e}function yp(t,e,n){for(var r=[],s=e.length,i,o=e.length,c=0;c<s;c++){let d=e[c];ju(d,()=>{if(i){if(i.pending.delete(d),i.done.add(d),i.pending.size===0){var h=t.outrogroups;Jo(Ua(i.done)),h.delete(i),h.size===0&&(t.outrogroups=null)}}else o-=1},!1)}if(o===0){var a=r.length===0&&n!==null;if(a){var u=n,f=u.parentNode;Zg(f),f.append(u),t.items.clear()}Jo(e,!a)}else i={pending:new Set(e),done:new Set},(t.outrogroups??=new Set).add(i)}function Jo(t,e=!0){for(var n=0;n<t.length;n++)ui(t[n],e)}var fl;function St(t,e,n,r,s,i=null){var o=t,c=new Map,a=(e&Lu)!==0;if(a){var u=t;o=Ye?Qs(Ug(u)):u.appendChild(Io())}Ye&&Nu();var f=null,d=qg(()=>{var k=n();return La(k)?k:k==null?[]:Ua(k)}),h,p=!0;function g(){m.fallback=f,kp(m,h,o,e,r),f!==null&&(h.length===0?(f.f&an)===0?$u(f):(f.f^=an,Gr(f,null,o)):ju(f,()=>{f=null}))}var x=Da(()=>{h=l(d);var k=h.length;let j=!1;if(Ye){var q=zg(o)===Fu;q!==(k===0)&&(o=Vo(),Qs(o),kn(!1),j=!0)}for(var C=new Set,F=Xn,P=Kg(),M=0;M<k;M+=1){Ye&&Bs.nodeType===Vg&&Bs.data===Hg&&(o=Bs,j=!0,kn(!1));var S=h[M],N=r(S,M),I=p?null:c.get(N);I?(I.v&&Zr(I.v,S),I.i&&Zr(I.i,M),P&&F.skipped_effects.delete(I.e)):(I=xp(c,p?o:fl??=Io(),S,N,M,s,e,n),p||(I.e.f|=an),c.set(N,I)),C.add(N)}if(k===0&&i&&!f&&(p?f=is(()=>i(o)):(f=is(()=>i(fl??=Io())),f.f|=an)),Ye&&k>0&&Qs(Vo()),!p)if(P){for(const[T,U]of c)C.has(T)||F.skipped_effects.add(U.e);F.oncommit(g),F.ondiscard(()=>{})}else g();j&&kn(!0),l(d)}),m={effect:x,items:c,outrogroups:null,fallback:f};p=!1,Ye&&(o=Bs)}function kp(t,e,n,r,s){var i=(r&Qg)!==0,o=e.length,c=t.items,a=t.effect.first,u,f=null,d,h=[],p=[],g,x,m,k;if(i)for(k=0;k<o;k+=1)g=e[k],x=s(g,k),m=c.get(x).e,(m.f&an)===0&&(m.nodes?.a?.measure(),(d??=new Set).add(m));for(k=0;k<o;k+=1){if(g=e[k],x=s(g,k),m=c.get(x).e,t.outrogroups!==null)for(const I of t.outrogroups)I.pending.delete(m),I.done.delete(m);if((m.f&an)!==0)if(m.f^=an,m===a)Gr(m,null,n);else{var j=f?f.next:a;m===t.effect.last&&(t.effect.last=m.prev),m.prev&&(m.prev.next=m.next),m.next&&(m.next.prev=m.prev),_n(t,f,m),_n(t,m,j),Gr(m,j,n),f=m,h=[],p=[],a=f.next;continue}if((m.f&To)!==0&&($u(m),i&&(m.nodes?.a?.unfix(),(d??=new Set).delete(m))),m!==a){if(u!==void 0&&u.has(m)){if(h.length<p.length){var q=p[0],C;f=q.prev;var F=h[0],P=h[h.length-1];for(C=0;C<h.length;C+=1)Gr(h[C],q,n);for(C=0;C<p.length;C+=1)u.delete(p[C]);_n(t,F.prev,P.next),_n(t,f,F),_n(t,P,q),a=q,f=P,k-=1,h=[],p=[]}else u.delete(m),Gr(m,a,n),_n(t,m.prev,m.next),_n(t,m,f===null?t.effect.first:f.next),_n(t,f,m),f=m;continue}for(h=[],p=[];a!==null&&a!==m;)(u??=new Set).add(a),p.push(a),a=a.next;if(a===null)continue}(m.f&an)===0&&h.push(m),f=m,a=m.next}if(t.outrogroups!==null){for(const I of t.outrogroups)I.pending.size===0&&(Jo(Ua(I.done)),t.outrogroups?.delete(I));t.outrogroups.size===0&&(t.outrogroups=null)}if(a!==null||u!==void 0){var M=[];if(u!==void 0)for(m of u)(m.f&To)===0&&M.push(m);for(;a!==null;)(a.f&To)===0&&a!==t.fallback&&M.push(a),a=a.next;var S=M.length;if(S>0){var N=(r&Lu)!==0&&o===0?n:null;if(i){for(k=0;k<S;k+=1)M[k].nodes?.a?.measure();for(k=0;k<S;k+=1)M[k].nodes?.a?.fix()}yp(t,M,N)}}i&&Ba(()=>{if(d!==void 0)for(m of d)m.nodes?.a?.apply()})}function xp(t,e,n,r,s,i,o,c){var a=(o&Jg)!==0?(o&Gg)===0?Ho(n,!1,!1):li(n):null,u=(o&Wg)!==0?li(s):null;return{v:a,i:u,e:is(()=>(i(e,a??n,u??s,c),()=>{t.delete(r)}))}}function Gr(t,e,n){if(t.nodes)for(var r=t.nodes.start,s=t.nodes.end,i=e&&(e.f&an)===0?e.nodes.start:n;r!==null;){var o=Yg(r);if(i.before(r),r===s)return;r=o}}function _n(t,e,n){e===null?t.effect.first=n:e.next=n,n===null?t.effect.last=e:n.prev=e}function Sp(t,e,...n){var r=new Ku(t);Da(()=>{const s=e()??null;r.ensure(s,s&&(i=>s(i,...n)))},Xg)}function wp(t,e){var n=void 0,r;Du(()=>{n!==(n=e())&&(r&&(ui(r),r=null),n&&(r=is(()=>{Bu(()=>n(t))})))})}function Ju(t){var e,n,r="";if(typeof t=="string"||typeof t=="number")r+=t;else if(typeof t=="object")if(Array.isArray(t)){var s=t.length;for(e=0;e<s;e++)t[e]&&(n=Ju(t[e]))&&(r&&(r+=" "),r+=n)}else for(n in t)t[n]&&(r&&(r+=" "),r+=n);return r}function Ip(){for(var t,e,n=0,r="",s=arguments.length;n<s;n++)(t=arguments[n])&&(e=Ju(t))&&(r&&(r+=" "),r+=e);return r}function za(t){return typeof t=="object"?Ip(t):t??""}const hl=[...`
|
|
2
|
-
\r\f \v\uFEFF`];function Tp(t,e,n){var r=t==null?"":""+t;if(e&&(r=r?r+" "+e:e),n){for(var s in n)if(n[s])r=r?r+" "+s:s;else if(r.length)for(var i=s.length,o=0;(o=r.indexOf(s,o))>=0;){var c=o+i;(o===0||hl.includes(r[o-1]))&&(c===r.length||hl.includes(r[c]))?r=(o===0?"":r.substring(0,o))+r.substring(c+1):o=c}}return r===""?null:r}function dl(t,e=!1){var n=e?" !important;":";",r="";for(var s in t){var i=t[s];i!=null&&i!==""&&(r+=" "+s+": "+i+n)}return r}function Ro(t){return t[0]!=="-"||t[1]!=="-"?t.toLowerCase():t}function Cp(t,e){if(e){var n="",r,s;if(Array.isArray(e)?(r=e[0],s=e[1]):r=e,t){t=String(t).replaceAll(/\s*\/\*.*?\*\/\s*/g,"").trim();var i=!1,o=0,c=!1,a=[];r&&a.push(...Object.keys(r).map(Ro)),s&&a.push(...Object.keys(s).map(Ro));var u=0,f=-1;const x=t.length;for(var d=0;d<x;d++){var h=t[d];if(c?h==="/"&&t[d-1]==="*"&&(c=!1):i?i===h&&(i=!1):h==="/"&&t[d+1]==="*"?c=!0:h==='"'||h==="'"?i=h:h==="("?o++:h===")"&&o--,!c&&i===!1&&o===0){if(h===":"&&f===-1)f=d;else if(h===";"||d===x-1){if(f!==-1){var p=Ro(t.substring(u,f).trim());if(!a.includes(p)){h!==";"&&d++;var g=t.substring(u,d).trim();n+=" "+g+";"}}u=d+1,f=-1}}}}return r&&(n+=dl(r)),s&&(n+=dl(s,!0)),n=n.trim(),n===""?null:n}return t==null?null:String(t)}function $e(t,e,n,r,s,i){var o=t.__className;if(Ye||o!==n||o===void 0){var c=Tp(n,r,i);(!Ye||c!==t.getAttribute("class"))&&(c==null?t.removeAttribute("class"):e?t.className=c:t.setAttribute("class",c)),t.__className=n}else if(i&&s!==i)for(var a in i){var u=!!i[a];(s==null||u!==!!s[a])&&t.classList.toggle(a,u)}return i}function Eo(t,e={},n,r){for(var s in n){var i=n[s];e[s]!==i&&(n[s]==null?t.style.removeProperty(s):t.style.setProperty(s,i,r))}}function Gu(t,e,n,r){var s=t.__style;if(Ye||s!==e){var i=Cp(e,r);(!Ye||i!==t.getAttribute("style"))&&(i==null?t.removeAttribute("style"):t.style.cssText=i),t.__style=e}else r&&(Array.isArray(r)?(Eo(t,n?.[0],r[0]),Eo(t,n?.[1],r[1],"important")):Eo(t,n,r));return r}function hi(t,e,n=!1){if(t.multiple){if(e==null)return;if(!La(e))return tp();for(var r of t.options)r.selected=e.includes(gl(r));return}for(r of t.options){var s=gl(r);if(np(s,e)){r.selected=!0;return}}(!n||e!==void 0)&&(t.selectedIndex=-1)}function Wu(t){var e=new MutationObserver(()=>{hi(t,t.__value)});e.observe(t,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["value"]}),ep(()=>{e.disconnect()})}function gl(t){return"__value"in t?t.__value:t.value}const Us=Symbol("class"),Dr=Symbol("style"),Yu=Symbol("is custom element"),Zu=Symbol("is html");function Qu(t){if(Ye){var e=!1,n=()=>{if(!e){if(e=!0,t.hasAttribute("value")){var r=t.value;Ae(t,"value",null),t.value=r}if(t.hasAttribute("checked")){var s=t.checked;Ae(t,"checked",null),t.checked=s}}};t.__on_r=n,Ba(n),sp()}}function aT(t,e){var n=Va(t);n.value===(n.value=e??void 0)||t.value===e&&(e!==0||t.nodeName!=="PROGRESS")||(t.value=e??"")}function Rp(t,e){e?t.hasAttribute("selected")||t.setAttribute("selected",""):t.removeAttribute("selected")}function Ae(t,e,n,r){var s=Va(t);Ye&&(s[e]=t.getAttribute(e),e==="src"||e==="srcset"||e==="href"&&t.nodeName==="LINK")||s[e]!==(s[e]=n)&&(e==="loading"&&(t[ip]=n),n==null?t.removeAttribute(e):typeof n!="string"&&Xu(t).includes(e)?t[e]=n:t.setAttribute(e,n))}function Ep(t,e,n,r,s=!1,i=!1){if(Ye&&s&&t.tagName==="INPUT"){var o=t,c=o.type==="checkbox"?"defaultChecked":"defaultValue";c in n||Qu(o)}var a=Va(t),u=a[Yu],f=!a[Zu];let d=Ye&&u;d&&kn(!1);var h=e||{},p=t.tagName==="OPTION";for(var g in e)g in n||(n[g]=null);n.class?n.class=za(n.class):n.class=null,n[Dr]&&(n.style??=null);var x=Xu(t);for(const P in n){let M=n[P];if(p&&P==="value"&&M==null){t.value=t.__value="",h[P]=M;continue}if(P==="class"){var m=t.namespaceURI==="http://www.w3.org/1999/xhtml";$e(t,m,M,r,e?.[Us],n[Us]),h[P]=M,h[Us]=n[Us];continue}if(P==="style"){Gu(t,M,e?.[Dr],n[Dr]),h[P]=M,h[Dr]=n[Dr];continue}var k=h[P];if(!(M===k&&!(M===void 0&&t.hasAttribute(P)))){h[P]=M;var j=P[0]+P[1];if(j!=="$$")if(j==="on"){const S={},N="$$"+P;let I=P.slice(2);var q=Ng(I);if(Og(I)&&(I=I.slice(0,-7),S.capture=!0),!q&&k){if(M!=null)continue;t.removeEventListener(I,h[N],S),h[N]=null}if(M!=null)if(q)t[`__${I}`]=M,Jt([I]);else{let T=function(U){h[P].call(this,U)};h[N]=Mg(I,t,T,S)}else q&&(t[`__${I}`]=void 0)}else if(P==="style")Ae(t,P,M);else if(P==="autofocus")lp(t,!!M);else if(!u&&(P==="__value"||P==="value"&&M!=null))t.value=t.__value=M;else if(P==="selected"&&p)Rp(t,M);else{var C=P;f||(C=Ag(C));var F=C==="defaultValue"||C==="defaultChecked";if(M==null&&!u&&!F)if(a[P]=null,C==="value"||C==="checked"){let S=t;const N=e===void 0;if(C==="value"){let I=S.defaultValue;S.removeAttribute(C),S.defaultValue=I,S.value=S.__value=N?I:null}else{let I=S.defaultChecked;S.removeAttribute(C),S.defaultChecked=I,S.checked=N?I:!1}}else t.removeAttribute(P);else F||x.includes(C)&&(u||typeof M!="string")?(t[C]=M,C in a&&(a[C]=Pu)):typeof M!="function"&&Ae(t,C,M)}}}return d&&kn(!0),h}function Op(t,e,n=[],r=[],s=[],i,o=!1,c=!1){ap(s,n,r,a=>{var u=void 0,f={},d=t.nodeName==="SELECT",h=!1;if(Du(()=>{var g=e(...a.map(l)),x=Ep(t,u,g,i,o,c);h&&d&&"value"in g&&hi(t,g.value);for(let k of Object.getOwnPropertySymbols(f))g[k]||ui(f[k]);for(let k of Object.getOwnPropertySymbols(g)){var m=g[k];k.description===cp&&(!u||m!==u[k])&&(f[k]&&ui(f[k]),f[k]=is(()=>wp(t,()=>m))),x[k]=m}u=x}),d){var p=t;Bu(()=>{hi(p,u.value,!0),Wu(p)})}h=!0})}function Va(t){return t.__attributes??={[Yu]:t.nodeName.includes("-"),[Zu]:t.namespaceURI===rp}}var pl=new Map;function Xu(t){var e=t.getAttribute("is")||t.nodeName,n=pl.get(e);if(n)return n;pl.set(e,n=[]);for(var r,s=t,i=Element.prototype;i!==s;){r=op(s);for(var o in r)r[o].set&&n.push(o);s=Au(s)}return n}function Mp(t,e,n=e){var r=new WeakSet;Uu(t,"input",async s=>{var i=s?t.defaultValue:t.value;if(i=Oo(t)?Mo(i):i,n(i),Xn!==null&&r.add(Xn),await qu(),i!==(i=e())){var o=t.selectionStart,c=t.selectionEnd,a=t.value.length;if(t.value=i??"",c!==null){var u=t.value.length;o===c&&c===a&&u>a?(t.selectionStart=u,t.selectionEnd=u):(t.selectionStart=o,t.selectionEnd=Math.min(c,u))}}}),(Ye&&t.defaultValue!==t.value||zu(e)==null&&t.value)&&(n(Oo(t)?Mo(t.value):t.value),Xn!==null&&r.add(Xn)),Vu(()=>{var s=e();if(t===document.activeElement){var i=up??Xn;if(r.has(i))return}Oo(t)&&s===Mo(t.value)||t.type==="date"&&!s&&!t.value||s!==t.value&&(t.value=s??"")})}function cT(t,e,n=e){Uu(t,"change",r=>{var s=r?t.defaultChecked:t.checked;n(s)}),(Ye&&t.defaultChecked!==t.checked||zu(e)==null)&&n(t.checked),Vu(()=>{var r=e();t.checked=!!r})}function Oo(t){var e=t.type;return e==="number"||e==="range"}function Mo(t){return t===""?null:+t}const Li="/api",Xt=async t=>{const e=await fetch(`${Li}${t}`);if(!e.ok)throw new Error(await e.text());return e.json()},pn=async(t,e)=>{const n=await fetch(`${Li}${t}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!n.ok)throw new Error(await n.text());return n.json()},ef=async t=>{const e=await fetch(`${Li}${t}`,{method:"DELETE"});if(!e.ok)throw new Error(await e.text());return e.json()},Ap=async(t,e)=>{const n=await fetch(`${Li}${t}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!n.ok)throw new Error(await n.text());return n.json()},lT=()=>Xt("/projects"),uT=t=>Xt(`/sessions?project=${encodeURIComponent(t)}`),fT=(t,e)=>Xt(`/session?project=${encodeURIComponent(t)}&id=${encodeURIComponent(e)}`),hT=(t,e)=>ef(`/session?project=${encodeURIComponent(t)}&id=${encodeURIComponent(e)}`),dT=(t,e,n)=>pn("/session/rename",{project:t,id:e,title:n}),Np=(t,e,n)=>ef(`/message?project=${encodeURIComponent(t)}&session=${encodeURIComponent(e)}&uuid=${encodeURIComponent(n)}`),Fp=(t,e,n,r)=>pn(`/message?project=${encodeURIComponent(t)}&session=${encodeURIComponent(e)}`,{message:n,index:r}),gT=(t,e,n,r)=>Ap(`/message?project=${encodeURIComponent(t)}&session=${encodeURIComponent(e)}&uuid=${encodeURIComponent(n)}`,{customTitle:r}),pT=t=>Xt("/cleanup"),mT=t=>pn("/cleanup",t),_T=()=>Xt("/version"),bT=()=>pn("/shutdown",{}),Pp=(t,e)=>pn("/open-file",{sessionId:t,backupFileName:e}),Ha=t=>pn("/open-file",{filePath:t}),vT=(t,e,n)=>pn("/session/split",{project:t,sessionId:e,messageUuid:n}),yT=(t,e,n)=>pn("/session/move",{sourceProject:t,sessionId:e,targetProject:n}),Go=async t=>{try{return(await Xt(`/file-exists?path=${encodeURIComponent(t)}`)).exists}catch{return!1}},kT=(t,e)=>{const n=new URLSearchParams({q:t});return e?.project&&n.set("project",e.project),e?.searchContent&&n.set("content","true"),Xt(`/search?${n}`)},xT=(t,e)=>{const n=new URLSearchParams({project:t});return e?.field&&n.set("sortField",e.field),e?.order&&n.set("sortOrder",e.order),Xt(`/project/expand?${n.toString()}`)},ST=(t,e)=>Xt(`/session/tree-data?project=${encodeURIComponent(t)}&id=${encodeURIComponent(e)}`),$p=(t,e,n)=>Xt(`/agent/messages?project=${encodeURIComponent(t)}&session=${encodeURIComponent(e)}&agent=${encodeURIComponent(n)}`),wT=(t,e)=>pn("/session/resume",{projectName:t,sessionId:e}),jp={},tf=Object.freeze(Object.defineProperty({__proto__:null,default:jp},Symbol.toStringTag,{value:"Module"})),Lp=t=>typeof t=="function",b=function(t,e){if(typeof t=="function")return function(){return t(arguments)?e.apply(this,arguments):n=>e(n,...arguments)};switch(t){case 0:case 1:throw new RangeError(`Invalid arity ${t}`);case 2:return function(n,r){return arguments.length>=2?e(n,r):function(s){return e(s,n)}};case 3:return function(n,r,s){return arguments.length>=3?e(n,r,s):function(i){return e(i,n,r)}};case 4:return function(n,r,s,i){return arguments.length>=4?e(n,r,s,i):function(o){return e(o,n,r,s)}};case 5:return function(n,r,s,i,o){return arguments.length>=5?e(n,r,s,i,o):function(c){return e(c,n,r,s,i)}};default:return function(){if(arguments.length>=t)return e.apply(this,arguments);const n=arguments;return function(r){return e(r,...n)}}}},je=t=>t,Di=t=>()=>t,ml=Di(!0),Wo=Di(!1),nf=Di(void 0),Dp=nf;function w(t,e,n,r,s,i,o,c,a){switch(arguments.length){case 1:return t;case 2:return e(t);case 3:return n(e(t));case 4:return r(n(e(t)));case 5:return s(r(n(e(t))));case 6:return i(s(r(n(e(t)))));case 7:return o(i(s(r(n(e(t))))));case 8:return c(o(i(s(r(n(e(t)))))));case 9:return a(c(o(i(s(r(n(e(t))))))));default:{let u=arguments[0];for(let f=1;f<arguments.length;f++)u=arguments[f](u);return u}}}const Ka=t=>(e,n)=>e===n||t(e,n),Bp=b(2,(t,e)=>Ka((n,r)=>t(e(n),e(r)))),Up=t=>Ka((e,n)=>{if(e.length!==n.length)return!1;for(let r=0;r<e.length;r++)if(!t(e[r],n[r]))return!1;return!0}),_l="effect/GlobalValue";let Br;const ke=(t,e)=>(Br||(globalThis[_l]??=new Map,Br=globalThis[_l]),Br.has(t)||Br.set(t,e()),Br.get(t)),qp=t=>typeof t=="string",Yo=t=>typeof t=="number",zp=t=>typeof t=="bigint",Bi=Lp,Vp=t=>typeof t=="object"&&t!==null,Ui=t=>Vp(t)||Bi(t),ce=b(2,(t,e)=>Ui(t)&&e in t),rf=b(2,(t,e)=>ce(t,"_tag")&&t._tag===e),Yn=t=>t==null,sf=t=>typeof t=="string"||ce(t,Symbol.iterator),Hp=t=>ce(t,"then")&&Bi(t.then),qi=t=>`BUG: ${t} - please report an issue at https://github.com/Effect-TS/effect/issues`;let of=class af{self;called=!1;constructor(e){this.self=e}next(e){return this.called?{value:e,done:!0}:(this.called=!0,{value:this.self,done:!1})}return(e){return{value:e,done:!0}}throw(e){throw e}[Symbol.iterator](){return new af(this.self)}};const Kp=335903614,Jp=4150755663,Gp=1481765933,Wp=1284865837,Yp=9007199254740992,Zp=134217728;class Qp{_state;constructor(e,n,r,s){return Yn(n)&&Yn(e)?(n=Math.random()*4294967295>>>0,e=0):Yn(n)&&(n=e,e=0),Yn(s)&&Yn(r)?(s=this._state?this._state[3]:Jp,r=this._state?this._state[2]:Kp):Yn(s)&&(s=r,r=0),this._state=new Int32Array([0,0,r>>>0,((s||0)|1)>>>0]),this._next(),bl(this._state,this._state[0],this._state[1],e>>>0,n>>>0),this._next(),this}getState(){return[this._state[0],this._state[1],this._state[2],this._state[3]]}setState(e){this._state[0]=e[0],this._state[1]=e[1],this._state[2]=e[2],this._state[3]=e[3]|1}integer(e){return Math.round(this.number()*Number.MAX_SAFE_INTEGER)%e}number(){const e=(this._next()&67108863)*1,n=(this._next()&134217727)*1;return(e*Zp+n)/Yp}_next(){const e=this._state[0]>>>0,n=this._state[1]>>>0;Xp(this._state,e,n,Gp,Wp),bl(this._state,this._state[0],this._state[1],this._state[2],this._state[3]);let r=e>>>18,s=(n>>>18|e<<14)>>>0;r=(r^e)>>>0,s=(s^n)>>>0;const i=(s>>>27|r<<5)>>>0,o=e>>>27,c=(-o>>>0&31)>>>0;return(i>>>o|i<<c)>>>0}}function Xp(t,e,n,r,s){let i=(n>>>16)*(s&65535)>>>0,o=(n&65535)*(s>>>16)>>>0,c=(n&65535)*(s&65535)>>>0,a=(n>>>16)*(s>>>16)+((o>>>16)+(i>>>16))>>>0;o=o<<16>>>0,c=c+o>>>0,c>>>0<o>>>0&&(a=a+1>>>0),i=i<<16>>>0,c=c+i>>>0,c>>>0<i>>>0&&(a=a+1>>>0),a=a+Math.imul(n,r)>>>0,a=a+Math.imul(e,s)>>>0,t[0]=a,t[1]=c}function bl(t,e,n,r,s){let i=e+r>>>0;const o=n+s>>>0;o>>>0<n>>>0&&(i=i+1|0),t[0]=i,t[1]=o}const Zo=Symbol.for("effect/Utils/YieldWrap");class _s{#e;constructor(e){this.#e=e}[Zo](){return this.#e}}function em(t){if(typeof t=="object"&&t!==null&&Zo in t)return t[Zo]();throw new Error(qi("yieldWrapGet"))}const At=ke("effect/Utils/isStructuralRegion",()=>({enabled:!1,tester:void 0})),cf={effect_internal_function:t=>t()},tm={effect_internal_function:t=>t()},nm=cf.effect_internal_function(()=>new Error().stack)?.includes("effect_internal_function")===!0,_t=nm?cf.effect_internal_function:tm.effect_internal_function,Ao=ke(Symbol.for("effect/Hash/randomHashCache"),()=>new WeakMap),oe=Symbol.for("effect/Hash"),z=t=>{if(At.enabled===!0)return 0;switch(typeof t){case"number":return Ga(t);case"bigint":return Ke(t.toString(10));case"boolean":return Ke(String(t));case"symbol":return Ke(String(t));case"string":return Ke(t);case"undefined":return Ke("undefined");case"function":case"object":return t===null?Ke("null"):t instanceof Date?Number.isNaN(t.getTime())?Ke("Invalid Date"):z(t.toISOString()):t instanceof URL?z(t.href):rm(t)?t[oe]():Ja(t);default:throw new Error(`BUG: unhandled typeof ${typeof t} - please report an issue at https://github.com/Effect-TS/effect/issues`)}},Ja=t=>(Ao.has(t)||Ao.set(t,Ga(Math.floor(Math.random()*Number.MAX_SAFE_INTEGER))),Ao.get(t)),me=t=>e=>e*53^t,zi=t=>t&3221225471|t>>>1&1073741824,rm=t=>ce(t,oe),Ga=t=>{if(t!==t||t===1/0)return 0;let e=t|0;for(e!==t&&(e^=t*4294967295);t>4294967295;)e^=t/=4294967295;return zi(e)},Ke=t=>{let e=5381,n=t.length;for(;n;)e=e*33^t.charCodeAt(--n);return zi(e)},sm=(t,e)=>{let n=12289;for(let r=0;r<e.length;r++)n^=w(Ke(e[r]),me(z(t[e[r]])));return zi(n)},lf=t=>sm(t,Object.keys(t)),bs=t=>{let e=6151;for(let n=0;n<t.length;n++)e=w(e,me(z(t[n])));return zi(e)},qe=function(){if(arguments.length===1){const n=arguments[0];return function(r){return Object.defineProperty(n,oe,{value(){return r},enumerable:!1}),r}}const t=arguments[0],e=arguments[1];return Object.defineProperty(t,oe,{value(){return e},enumerable:!1}),e},re=Symbol.for("effect/Equal");function ae(){return arguments.length===1?t=>di(t,arguments[0]):di(arguments[0],arguments[1])}function di(t,e){if(t===e)return!0;const n=typeof t;if(n!==typeof e)return!1;if(n==="object"||n==="function"){if(t!==null&&e!==null){if(gi(t)&&gi(e))return z(t)===z(e)&&t[re](e)?!0:At.enabled&&At.tester?At.tester(t,e):!1;if(t instanceof Date&&e instanceof Date){const r=t.getTime(),s=e.getTime();return r===s||Number.isNaN(r)&&Number.isNaN(s)}else if(t instanceof URL&&e instanceof URL)return t.href===e.href}if(At.enabled){if(Array.isArray(t)&&Array.isArray(e))return t.length===e.length&&t.every((r,s)=>di(r,e[s]));if(Object.getPrototypeOf(t)===Object.prototype&&Object.getPrototypeOf(t)===Object.prototype){const r=Object.keys(t),s=Object.keys(e);if(r.length===s.length){for(const i of r)if(!(i in e&&di(t[i],e[i])))return At.tester?At.tester(t,e):!1;return!0}}return At.tester?At.tester(t,e):!1}}return At.enabled&&At.tester?At.tester(t,e):!1}const gi=t=>ce(t,re),Wa=()=>ae,Ge=Symbol.for("nodejs.util.inspect.custom"),nt=t=>{try{if(ce(t,"toJSON")&&Bi(t.toJSON)&&t.toJSON.length===0)return t.toJSON();if(Array.isArray(t))return t.map(nt)}catch{return{}}return om(t)},ot=t=>JSON.stringify(t,null,2),cr=(t,e=2)=>{if(typeof t=="string")return t;try{return typeof t=="object"?uf(t,e):String(t)}catch{return String(t)}},uf=(t,e)=>{let n=[];const r=JSON.stringify(t,(s,i)=>typeof i=="object"&&i!==null?n.includes(i)?void 0:n.push(i)&&(Nn.fiberRefs!==void 0&&ff(i)?i[Ya](Nn.fiberRefs):i):i,e);return n=void 0,r},Ya=Symbol.for("effect/Inspectable/Redactable"),ff=t=>typeof t=="object"&&t!==null&&Ya in t,Nn=ke("effect/Inspectable/redactableState",()=>({fiberRefs:void 0})),im=(t,e)=>{const n=Nn.fiberRefs;Nn.fiberRefs=t;try{return e()}finally{Nn.fiberRefs=n}},om=t=>ff(t)&&Nn.fiberRefs!==void 0?t[Ya](Nn.fiberRefs):t,ne=(t,e)=>{switch(e.length){case 0:return t;case 1:return e[0](t);case 2:return e[1](e[0](t));case 3:return e[2](e[1](e[0](t)));case 4:return e[3](e[2](e[1](e[0](t))));case 5:return e[4](e[3](e[2](e[1](e[0](t)))));case 6:return e[5](e[4](e[3](e[2](e[1](e[0](t))))));case 7:return e[6](e[5](e[4](e[3](e[2](e[1](e[0](t)))))));case 8:return e[7](e[6](e[5](e[4](e[3](e[2](e[1](e[0](t))))))));case 9:return e[8](e[7](e[6](e[5](e[4](e[3](e[2](e[1](e[0](t)))))))));default:{let n=t;for(let r=0,s=e.length;r<s;r++)n=e[r](n);return n}}},Qr="Async",Vi="Commit",zt="Failure",No="OnFailure",pi="OnSuccess",mi="OnSuccessAndFailure",Vt="Success",hf="Sync",am="Tag",vs="UpdateRuntimeFlags",_i="While",Xr="Iterator",df="WithRuntime",ei="Yield",Za="RevertFlags";let cm="3.19.14";const Qa=()=>cm,lm=Symbol.for("effect/Effect"),um=Symbol.for("effect/Stream"),fm=Symbol.for("effect/Sink"),hm=Symbol.for("effect/Channel"),lr={_R:t=>t,_E:t=>t,_A:t=>t,_V:Qa()},dm={_A:t=>t,_In:t=>t,_L:t=>t,_E:t=>t,_R:t=>t},gm={_Env:t=>t,_InErr:t=>t,_InElem:t=>t,_InDone:t=>t,_OutErr:t=>t,_OutElem:t=>t,_OutDone:t=>t},ys={[lm]:lr,[um]:lr,[fm]:dm,[hm]:gm,[re](t){return this===t},[oe](){return qe(this,Ja(this))},[Symbol.iterator](){return new of(new _s(this))},pipe(){return ne(this,arguments)}},Xa={[oe](){return qe(this,lf(this))},[re](t){const e=Object.keys(this),n=Object.keys(t);if(e.length!==n.length)return!1;for(const r of e)if(!(r in t&&ae(this[r],t[r])))return!1;return!0}},ks={...ys,_op:Vi},pm={...ks,...Xa},mm=(function(){function t(){}return t.prototype=ks,t})(),gf=Symbol.for("effect/Option"),pf={...ys,[gf]:{_A:t=>t},[Ge](){return this.toJSON()},toString(){return ot(this.toJSON())}},_m=Object.assign(Object.create(pf),{_tag:"Some",_op:"Some",[re](t){return mf(t)&&bf(t)&&ae(this.value,t.value)},[oe](){return qe(this,me(z(this._tag))(z(this.value)))},toJSON(){return{_id:"Option",_tag:this._tag,value:nt(this.value)}}}),bm=z("None"),vm=Object.assign(Object.create(pf),{_tag:"None",_op:"None",[re](t){return mf(t)&&_f(t)},[oe](){return bm},toJSON(){return{_id:"Option",_tag:this._tag}}}),mf=t=>ce(t,gf),_f=t=>t._tag==="None",bf=t=>t._tag==="Some",vf=Object.create(vm),Qo=t=>{const e=Object.create(_m);return e.value=t,e},yf=Symbol.for("effect/Either"),kf={...ys,[yf]:{_R:t=>t},[Ge](){return this.toJSON()},toString(){return ot(this.toJSON())}},ym=Object.assign(Object.create(kf),{_tag:"Right",_op:"Right",[re](t){return xf(t)&&wf(t)&&ae(this.right,t.right)},[oe](){return me(z(this._tag))(z(this.right))},toJSON(){return{_id:"Either",_tag:this._tag,right:nt(this.right)}}}),km=Object.assign(Object.create(kf),{_tag:"Left",_op:"Left",[re](t){return xf(t)&&Sf(t)&&ae(this.left,t.left)},[oe](){return me(z(this._tag))(z(this.left))},toJSON(){return{_id:"Either",_tag:this._tag,left:nt(this.left)}}}),xf=t=>ce(t,yf),Sf=t=>t._tag==="Left",wf=t=>t._tag==="Right",xm=t=>{const e=Object.create(km);return e.left=t,e},Sm=t=>{const e=Object.create(ym);return e.right=t,e},cn=Sm,ur=xm,Wr=Sf,qs=wf,wm=b(2,(t,{onLeft:e,onRight:n})=>Wr(t)?e(t.left):n(t.right)),Im=wm({onLeft:je,onRight:je}),If=t=>t.length>0,Tf=t=>(e,n)=>e===n?0:t(e,n),Tm=Tf((t,e)=>t<e?-1:1),Cm=b(2,(t,e)=>Tf((n,r)=>t(e(n),e(r)))),Rm=t=>b(2,(e,n)=>t(e,n)===1),te=()=>vf,ge=Qo,yt=_f,Zt=bf,Kn=b(2,(t,{onNone:e,onSome:n})=>yt(t)?e():n(t.value)),jn=b(2,(t,e)=>yt(t)?e():t.value),Em=b(2,(t,e)=>yt(t)?ge(e()):t),ec=t=>t==null?te():ge(t),Cn=jn(nf),Om=b(2,(t,e)=>yt(t)?te():ge(e(t.value))),Mm=b(2,(t,e)=>yt(t)?te():e(t.value)),Am=t=>b(2,(e,n)=>yt(e)?!1:t(e.value,n)),Nm=Wa(),Fm=Am(Nm),Pm=(...t)=>t,tc=t=>new Array(t),$m=b(2,(t,e)=>{const n=Math.max(1,Math.floor(t)),r=new Array(n);for(let s=0;s<n;s++)r[s]=e(s);return r}),Ze=t=>Array.isArray(t)?t:Array.from(t),jm=t=>Array.isArray(t)?t:[t],bi=b(2,(t,e)=>[e,...t]),Lm=b(2,(t,e)=>[...t,e]),Cf=b(2,(t,e)=>Ze(t).concat(Ze(e))),Dm=t=>t.length===0,Bm=Dm,Um=If,Tt=If,Rf=(t,e)=>t<0||t>=e.length,qm=(t,e)=>Math.floor(Math.min(Math.max(0,t),e.length)),zm=b(2,(t,e)=>{const n=Math.floor(e);return Rf(n,t)?te():ge(t[n])}),Ef=b(2,(t,e)=>{const n=Math.floor(e);if(Rf(n,t))throw new Error(`Index ${n} out of bounds`);return t[n]}),es=zm(0),wt=Ef(0),Vm=t=>Tt(t)?ge(Of(t)):te(),Of=t=>t[t.length-1],fr=t=>t.slice(1),Hm=(t,e)=>{let n=0;for(const r of t){if(!e(r,n))break;n++}return n},Km=b(2,(t,e)=>Ym(t,Hm(t,e))),Jm=b(2,(t,e)=>{const n=Ze(t);return n.slice(qm(e,n),n.length)}),vl=t=>Array.from(t).reverse(),vi=b(2,(t,e)=>{const n=Array.from(t);return n.sort(e),n}),yl=b(2,(t,e)=>Gm(t,e,Pm)),Gm=b(3,(t,e,n)=>{const r=Ze(t),s=Ze(e);if(Tt(r)&&Tt(s)){const i=[n(wt(r),wt(s))],o=Math.min(r.length,s.length);for(let c=1;c<o;c++)i[c]=n(r[c],s[c]);return i}return[]}),Wm=Wa(),Ym=b(2,(t,e)=>{const n=Array.from(t),r=Math.floor(e);return Tt(n)?r>=1?Zm(n,r):[[],n]:[n,[]]}),Zm=b(2,(t,e)=>{const n=Math.max(1,Math.floor(e));return n>=t.length?[Qm(t),[]]:[bi(t.slice(1,n),wt(t)),t.slice(n)]}),Qm=t=>t.slice(),Xm=b(3,(t,e,n)=>{const r=Ze(t),s=Ze(e);return Tt(r)?Tt(s)?Af(n)(Cf(r,s)):r:s}),ti=b(2,(t,e)=>Xm(t,e,Wm)),hr=()=>[],jt=t=>[t],rr=b(2,(t,e)=>t.map(e)),e_=b(2,(t,e)=>{if(Bm(t))return[];const n=[];for(let r=0;r<t.length;r++){const s=e(t[r],r);for(let i=0;i<s.length;i++)n.push(s[i])}return n}),t_=e_(je),Mf=b(3,(t,e,n)=>Ze(t).reduce((r,s,i)=>n(r,s,i),e)),kl=(t,e)=>{const n=[];let r=t,s;for(;Zt(s=e(r));){const[i,o]=s.value;n.push(i),r=o}return n},nc=Up,Af=b(2,(t,e)=>{const n=Ze(t);if(Tt(n)){const r=[wt(n)],s=fr(n);for(const i of s)r.every(o=>!e(i,o))&&r.push(i);return r}return[]}),n_=t=>Af(t,Wa()),Er=b(2,(t,e)=>Ze(t).join(e)),os=Tm,r_=t=>t.replace(/[/\\^$*+?.()|[\]{}]/g,"\\$&"),s_=Symbol.for("effect/Context/Tag"),yi=Symbol.for("effect/Context/Reference"),i_="effect/STM",o_=Symbol.for(i_),Nf={...ys,_op:"Tag",[o_]:lr,[s_]:{_Service:t=>t,_Identifier:t=>t},toString(){return ot(this.toJSON())},toJSON(){return{_id:"Tag",key:this.key,stack:this.stack}},[Ge](){return this.toJSON()},of(t){return t},context(t){return Pf(this,t)}},a_={...Nf,[yi]:yi},c_=t=>{const e=Error.stackTraceLimit;Error.stackTraceLimit=2;const n=new Error;Error.stackTraceLimit=e;const r=Object.create(Nf);return Object.defineProperty(r,"stack",{get(){return n.stack}}),r.key=t,r},l_=()=>(t,e)=>{const n=Error.stackTraceLimit;Error.stackTraceLimit=2;const r=new Error;Error.stackTraceLimit=n;function s(){}return Object.setPrototypeOf(s,a_),s.key=t,s.defaultValue=e.defaultValue,Object.defineProperty(s,"stack",{get(){return r.stack}}),s},Ff=Symbol.for("effect/Context"),u_={[Ff]:{_Services:t=>t},[re](t){if(h_(t)&&this.unsafeMap.size===t.unsafeMap.size){for(const e of this.unsafeMap.keys())if(!t.unsafeMap.has(e)||!ae(this.unsafeMap.get(e),t.unsafeMap.get(e)))return!1;return!0}return!1},[oe](){return qe(this,Ga(this.unsafeMap.size))},pipe(){return ne(this,arguments)},toString(){return ot(this.toJSON())},toJSON(){return{_id:"Context",services:Array.from(this.unsafeMap).map(nt)}},[Ge](){return this.toJSON()}},dr=t=>{const e=Object.create(u_);return e.unsafeMap=t,e},f_=t=>{const e=new Error(`Service not found${t.key?`: ${String(t.key)}`:""}`);if(t.stack){const n=t.stack.split(`
|
|
3
|
-
`);if(n.length>2){const r=n[2].match(/at (.*)/);r&&(e.message=e.message+` (defined at ${r[1]})`)}}if(e.stack){const n=e.stack.split(`
|
|
4
|
-
`);n.splice(1,3),e.stack=n.join(`
|
|
5
|
-
`)}return e},h_=t=>ce(t,Ff),d_=t=>ce(t,yi),g_=dr(new Map),p_=()=>g_,Pf=(t,e)=>dr(new Map([[t.key,e]])),m_=b(3,(t,e,n)=>{const r=new Map(t.unsafeMap);return r.set(e.key,n),dr(r)}),Fo=ke("effect/Context/defaultValueCache",()=>new Map),rc=t=>{if(Fo.has(t.key))return Fo.get(t.key);const e=t.defaultValue();return Fo.set(t.key,e),e},__=(t,e)=>t.unsafeMap.has(e.key)?t.unsafeMap.get(e.key):rc(e),$f=b(2,(t,e)=>{if(!t.unsafeMap.has(e.key)){if(yi in e)return rc(e);throw f_(e)}return t.unsafeMap.get(e.key)}),b_=$f,v_=b(2,(t,e)=>t.unsafeMap.has(e.key)?Qo(t.unsafeMap.get(e.key)):d_(e)?Qo(rc(e)):vf),y_=b(2,(t,e)=>{const n=new Map(t.unsafeMap);for(const[r,s]of e.unsafeMap)n.set(r,s);return dr(n)}),Jn=c_,jf=p_,k_=Pf,Ur=m_,Lf=b_,Df=$f,xs=v_,Bf=y_,Uf=l_,qf=Symbol.for("effect/Chunk");function x_(t,e,n,r,s){for(let i=e;i<Math.min(t.length,e+s);i++)n[r+i-e]=t[i];return n}const zf=[],S_=t=>Ka((e,n)=>e.length===n.length&&Fn(e).every((r,s)=>t(r,sr(n,s)))),w_=S_(ae),I_={[qf]:{_A:t=>t},toString(){return ot(this.toJSON())},toJSON(){return{_id:"Chunk",values:Fn(this).map(nt)}},[Ge](){return this.toJSON()},[re](t){return Vf(t)&&w_(this,t)},[oe](){return qe(this,bs(Fn(this)))},[Symbol.iterator](){switch(this.backing._tag){case"IArray":return this.backing.array[Symbol.iterator]();case"IEmpty":return zf[Symbol.iterator]();default:return Fn(this)[Symbol.iterator]()}},pipe(){return ne(this,arguments)}},Qe=t=>{const e=Object.create(I_);switch(e.backing=t,t._tag){case"IEmpty":{e.length=0,e.depth=0,e.left=e,e.right=e;break}case"IConcat":{e.length=t.left.length+t.right.length,e.depth=1+Math.max(t.left.depth,t.right.depth),e.left=t.left,e.right=t.right;break}case"IArray":{e.length=t.array.length,e.depth=0,e.left=Yt,e.right=Yt;break}case"ISingleton":{e.length=1,e.depth=0,e.left=Yt,e.right=Yt;break}case"ISlice":{e.length=t.length,e.depth=t.chunk.depth+1,e.left=Yt,e.right=Yt;break}}return e},Vf=t=>ce(t,qf),Yt=Qe({_tag:"IEmpty"}),fn=()=>Yt,Po=(...t)=>R_(t),Ct=t=>Qe({_tag:"ISingleton",a:t}),Hf=t=>Vf(t)?t:Hi(Ze(t)),Xo=(t,e,n)=>{switch(t.backing._tag){case"IArray":{x_(t.backing.array,0,e,n,t.length);break}case"IConcat":{Xo(t.left,e,n),Xo(t.right,e,n+t.left.length);break}case"ISingleton":{e[n]=t.backing.a;break}case"ISlice":{let r=0,s=n;for(;r<t.length;)e[s]=sr(t,r),r+=1,s+=1;break}}},T_=t=>{switch(t.backing._tag){case"IEmpty":return zf;case"IArray":return t.backing.array;default:{const e=new Array(t.length);return Xo(t,e,0),t.backing={_tag:"IArray",array:e},t.left=Yt,t.right=Yt,t.depth=0,e}}},Fn=T_,C_=t=>{switch(t.backing._tag){case"IEmpty":case"ISingleton":return t;case"IArray":return Qe({_tag:"IArray",array:vl(t.backing.array)});case"IConcat":return Qe({_tag:"IConcat",left:gr(t.backing.right),right:gr(t.backing.left)});case"ISlice":return Hi(vl(Fn(t)))}},gr=C_,Hi=t=>t.length===0?fn():t.length===1?Ct(t[0]):Qe({_tag:"IArray",array:t}),R_=t=>Hi(t),sr=b(2,(t,e)=>{switch(t.backing._tag){case"IEmpty":throw new Error("Index out of bounds");case"ISingleton":{if(e!==0)throw new Error("Index out of bounds");return t.backing.a}case"IArray":{if(e>=t.length||e<0)throw new Error("Index out of bounds");return t.backing.array[e]}case"IConcat":return e<t.left.length?sr(t.left,e):sr(t.right,e-t.left.length);case"ISlice":return sr(t.backing.chunk,e+t.backing.offset)}}),E_=b(2,(t,e)=>Ut(t,Ct(e))),Ht=b(2,(t,e)=>Ut(Ct(e),t)),ea=b(2,(t,e)=>{if(e<=0)return t;if(e>=t.length)return Yt;switch(t.backing._tag){case"ISlice":return Qe({_tag:"ISlice",chunk:t.backing.chunk,offset:t.backing.offset+e,length:t.backing.length-e});case"IConcat":return e>t.left.length?ea(t.right,e-t.left.length):Qe({_tag:"IConcat",left:ea(t.left,e),right:t.right});default:return Qe({_tag:"ISlice",chunk:t,offset:e,length:t.length-e})}}),Ut=b(2,(t,e)=>{if(t.backing._tag==="IEmpty")return e;if(e.backing._tag==="IEmpty")return t;const n=e.depth-t.depth;if(Math.abs(n)<=1)return Qe({_tag:"IConcat",left:t,right:e});if(n<-1)if(t.left.depth>=t.right.depth){const r=Ut(t.right,e);return Qe({_tag:"IConcat",left:t.left,right:r})}else{const r=Ut(t.right.right,e);if(r.depth===t.depth-3){const s=Qe({_tag:"IConcat",left:t.right.left,right:r});return Qe({_tag:"IConcat",left:t.left,right:s})}else{const s=Qe({_tag:"IConcat",left:t.left,right:t.right.left});return Qe({_tag:"IConcat",left:s,right:r})}}else if(e.right.depth>=e.left.depth){const r=Ut(t,e.left);return Qe({_tag:"IConcat",left:r,right:e.right})}else{const r=Ut(t,e.left.left);if(r.depth===e.depth-3){const s=Qe({_tag:"IConcat",left:r,right:e.left.right});return Qe({_tag:"IConcat",left:s,right:e.right})}else{const s=Qe({_tag:"IConcat",left:e.left.right,right:e.right});return Qe({_tag:"IConcat",left:r,right:s})}}}),O_=t=>t.length===0,pr=t=>t.length>0,Kf=t=>sr(t,0),mr=Kf,On=t=>ea(t,1),ta=Symbol.for("effect/Duration"),Jf=BigInt(0),xl=BigInt(24),zs=BigInt(60),na=BigInt(1e3),Sl=BigInt(1e6),wl=BigInt(1e9),M_=/^(-?\d+(?:\.\d+)?)\s+(nanos?|micros?|millis?|seconds?|minutes?|hours?|days?|weeks?)$/,hn=t=>{if(Gf(t))return t;if(Yo(t))return ra(t);if(zp(t))return $o(t);if(Array.isArray(t)&&t.length===2&&t.every(Yo))return t[0]===-1/0||t[1]===-1/0||Number.isNaN(t[0])||Number.isNaN(t[1])?Wf:t[0]===1/0||t[1]===1/0?P_:$o(BigInt(Math.round(t[0]*1e9))+BigInt(Math.round(t[1])));if(qp(t)){const e=M_.exec(t);if(e){const[n,r,s]=e,i=Number(r);switch(s){case"nano":case"nanos":return $o(BigInt(r));case"micro":case"micros":return $_(BigInt(r));case"milli":case"millis":return ra(i);case"second":case"seconds":return j_(i);case"minute":case"minutes":return L_(i);case"hour":case"hours":return D_(i);case"day":case"days":return B_(i);case"week":case"weeks":return U_(i)}}}throw new Error("Invalid DurationInput")},Il={_tag:"Millis",millis:0},A_={_tag:"Infinity"},N_={[ta]:ta,[oe](){return qe(this,lf(this.value))},[re](t){return Gf(t)&&G_(this,t)},toString(){return`Duration(${Y_(this)})`},toJSON(){switch(this.value._tag){case"Millis":return{_id:"Duration",_tag:"Millis",millis:this.value.millis};case"Nanos":return{_id:"Duration",_tag:"Nanos",hrtime:z_(this)};case"Infinity":return{_id:"Duration",_tag:"Infinity"}}},[Ge](){return this.toJSON()},pipe(){return ne(this,arguments)}},en=t=>{const e=Object.create(N_);return Yo(t)?isNaN(t)||t<=0?e.value=Il:Number.isFinite(t)?Number.isInteger(t)?e.value={_tag:"Millis",millis:t}:e.value={_tag:"Nanos",nanos:BigInt(Math.round(t*1e6))}:e.value=A_:t<=Jf?e.value=Il:e.value={_tag:"Nanos",nanos:t},e},Gf=t=>ce(t,ta),F_=t=>{switch(t.value._tag){case"Millis":return t.value.millis===0;case"Nanos":return t.value.nanos===Jf;case"Infinity":return!1}},Wf=en(0),P_=en(1/0),$o=t=>en(t),$_=t=>en(t*na),ra=t=>en(t),j_=t=>en(t*1e3),L_=t=>en(t*6e4),D_=t=>en(t*36e5),B_=t=>en(t*864e5),U_=t=>en(t*6048e5),sa=t=>V_(t,{onMillis:e=>e,onNanos:e=>Number(e)/1e6}),q_=t=>{const e=hn(t);switch(e.value._tag){case"Infinity":throw new Error("Cannot convert infinite duration to nanos");case"Nanos":return e.value.nanos;case"Millis":return BigInt(Math.round(e.value.millis*1e6))}},z_=t=>{const e=hn(t);switch(e.value._tag){case"Infinity":return[1/0,0];case"Nanos":return[Number(e.value.nanos/wl),Number(e.value.nanos%wl)];case"Millis":return[Math.floor(e.value.millis/1e3),Math.round(e.value.millis%1e3*1e6)]}},V_=b(2,(t,e)=>{const n=hn(t);switch(n.value._tag){case"Nanos":return e.onNanos(n.value.nanos);case"Infinity":return e.onMillis(1/0);case"Millis":return e.onMillis(n.value.millis)}}),sc=b(3,(t,e,n)=>{const r=hn(t),s=hn(e);if(r.value._tag==="Infinity"||s.value._tag==="Infinity")return n.onMillis(sa(r),sa(s));if(r.value._tag==="Nanos"||s.value._tag==="Nanos"){const i=r.value._tag==="Nanos"?r.value.nanos:BigInt(Math.round(r.value.millis*1e6)),o=s.value._tag==="Nanos"?s.value.nanos:BigInt(Math.round(s.value.millis*1e6));return n.onNanos(i,o)}return n.onMillis(r.value.millis,s.value.millis)}),H_=(t,e)=>sc(t,e,{onMillis:(n,r)=>n===r,onNanos:(n,r)=>n===r}),K_=b(2,(t,e)=>sc(t,e,{onMillis:(n,r)=>n<=r,onNanos:(n,r)=>n<=r})),J_=b(2,(t,e)=>sc(t,e,{onMillis:(n,r)=>n>=r,onNanos:(n,r)=>n>=r})),G_=b(2,(t,e)=>H_(hn(t),hn(e))),W_=t=>{const e=hn(t);if(e.value._tag==="Infinity")return{days:1/0,hours:1/0,minutes:1/0,seconds:1/0,millis:1/0,nanos:1/0};const n=q_(e),r=n/Sl,s=r/na,i=s/zs,o=i/zs,c=o/xl;return{days:Number(c),hours:Number(o%xl),minutes:Number(i%zs),seconds:Number(s%zs),millis:Number(r%na),nanos:Number(n%Sl)}},Y_=t=>{const e=hn(t);if(e.value._tag==="Infinity")return"Infinity";if(F_(e))return"0";const n=W_(e),r=[];return n.days!==0&&r.push(`${n.days}d`),n.hours!==0&&r.push(`${n.hours}h`),n.minutes!==0&&r.push(`${n.minutes}m`),n.seconds!==0&&r.push(`${n.seconds}s`),n.millis!==0&&r.push(`${n.millis}ms`),n.nanos!==0&&r.push(`${n.nanos}ns`),r.join(" ")},Ln=5,ic=Math.pow(2,Ln),Z_=ic-1,Q_=ic/2,X_=ic/4;function eb(t){return t-=t>>1&1431655765,t=(t&858993459)+(t>>2&858993459),t=t+(t>>4)&252645135,t+=t>>8,t+=t>>16,t&127}function _r(t,e){return e>>>t&Z_}function er(t){return 1<<t}function Yf(t,e){return eb(t&e-1)}const tb=(t,e)=>({value:t,previous:e});function ir(t,e,n,r){let s=r;if(!t){const i=r.length;s=new Array(i);for(let o=0;o<i;++o)s[o]=r[o]}return s[e]=n,s}function Zf(t,e,n){const r=n.length-1;let s=0,i=0,o=n;if(t)s=i=e;else for(o=new Array(r);s<e;)o[i++]=n[s++];for(++s;s<=r;)o[i++]=n[s++];return t&&(o.length=r),o}function nb(t,e,n,r){const s=r.length;if(t){let a=s;for(;a>=e;)r[a--]=r[a];return r[e]=n,r}let i=0,o=0;const c=new Array(s+1);for(;i<e;)c[o++]=r[i++];for(c[e]=n;i<s;)c[++o]=r[i++];return c}class xn{_tag="EmptyNode";modify(e,n,r,s,i,o){const c=r(te());return yt(c)?new xn:(++o.value,new Pn(e,s,i,c))}}function qt(t){return rf(t,"EmptyNode")}function rb(t){return qt(t)||t._tag==="LeafNode"||t._tag==="CollisionNode"}function Ki(t,e){return qt(t)?!1:e===t.edit}class Pn{edit;hash;key;value;_tag="LeafNode";constructor(e,n,r,s){this.edit=e,this.hash=n,this.key=r,this.value=s}modify(e,n,r,s,i,o){if(ae(i,this.key)){const a=r(this.value);return a===this.value?this:yt(a)?(--o.value,new xn):Ki(this,e)?(this.value=a,this):new Pn(e,s,i,a)}const c=r(te());return yt(c)?this:(++o.value,Qf(e,n,this.hash,this,s,new Pn(e,s,i,c)))}}class oc{edit;hash;children;_tag="CollisionNode";constructor(e,n,r){this.edit=e,this.hash=n,this.children=r}modify(e,n,r,s,i,o){if(s===this.hash){const a=Ki(this,e),u=this.updateCollisionList(a,e,this.hash,this.children,r,i,o);return u===this.children?this:u.length>1?new oc(e,this.hash,u):u[0]}const c=r(te());return yt(c)?this:(++o.value,Qf(e,n,this.hash,this,s,new Pn(e,s,i,c)))}updateCollisionList(e,n,r,s,i,o,c){const a=s.length;for(let f=0;f<a;++f){const d=s[f];if("key"in d&&ae(o,d.key)){const h=d.value,p=i(h);return p===h?s:yt(p)?(--c.value,Zf(e,f,s)):ir(e,f,new Pn(n,r,o,p),s)}}const u=i(te());return yt(u)?s:(++c.value,ir(e,a,new Pn(n,r,o,u),s))}}class br{edit;mask;children;_tag="IndexedNode";constructor(e,n,r){this.edit=e,this.mask=n,this.children=r}modify(e,n,r,s,i,o){const c=this.mask,a=this.children,u=_r(n,s),f=er(u),d=Yf(c,f),h=c&f,p=Ki(this,e);if(!h){const j=new xn().modify(e,n+Ln,r,s,i,o);return j?a.length>=Q_?ib(e,u,j,c,a):new br(e,c|f,nb(p,d,j,a)):this}const g=a[d],x=g.modify(e,n+Ln,r,s,i,o);if(g===x)return this;let m=c,k;if(qt(x)){if(m&=~f,!m)return new xn;if(a.length<=2&&rb(a[d^1]))return a[d^1];k=Zf(p,d,a)}else k=ir(p,d,x,a);return p?(this.mask=m,this.children=k,this):new br(e,m,k)}}class ac{edit;size;children;_tag="ArrayNode";constructor(e,n,r){this.edit=e,this.size=n,this.children=r}modify(e,n,r,s,i,o){let c=this.size;const a=this.children,u=_r(n,s),f=a[u],d=(f||new xn).modify(e,n+Ln,r,s,i,o);if(f===d)return this;const h=Ki(this,e);let p;if(qt(f)&&!qt(d))++c,p=ir(h,u,d,a);else if(!qt(f)&&qt(d)){if(--c,c<=X_)return sb(e,c,u,a);p=ir(h,u,new xn,a)}else p=ir(h,u,d,a);return h?(this.size=c,this.children=p,this):new ac(e,c,p)}}function sb(t,e,n,r){const s=new Array(e-1);let i=0,o=0;for(let c=0,a=r.length;c<a;++c)if(c!==n){const u=r[c];u&&!qt(u)&&(s[i++]=u,o|=1<<c)}return new br(t,o,s)}function ib(t,e,n,r,s){const i=[];let o=r,c=0;for(let a=0;o;++a)o&1&&(i[a]=s[c++]),o>>>=1;return i[e]=n,new ac(t,c+1,i)}function ob(t,e,n,r,s,i){if(n===s)return new oc(t,n,[i,r]);const o=_r(e,n),c=_r(e,s);if(o===c)return a=>new br(t,er(o)|er(c),[a]);{const a=o<c?[r,i]:[i,r];return new br(t,er(o)|er(c),a)}}function Qf(t,e,n,r,s,i){let o,c=e;for(;;){const a=ob(t,c,n,r,s,i);if(typeof a=="function")o=tb(a,o),c=c+Ln;else{let u=a;for(;o!=null;)u=o.value(u),o=o.previous;return u}}}const Xf="effect/HashMap",ia=Symbol.for(Xf),ab={[ia]:ia,[Symbol.iterator](){return new Ji(this,(t,e)=>[t,e])},[oe](){let t=z(Xf);for(const e of this)t^=w(z(e[0]),me(z(e[1])));return qe(this,t)},[re](t){if(ub(t)){if(t._size!==this._size)return!1;for(const e of this){const n=w(t,lc(e[0],z(e[0])));if(yt(n))return!1;if(!ae(e[1],n.value))return!1}return!0}return!1},toString(){return ot(this.toJSON())},toJSON(){return{_id:"HashMap",values:Array.from(this).map(nt)}},[Ge](){return this.toJSON()},pipe(){return ne(this,arguments)}},cc=(t,e,n,r)=>{const s=Object.create(ab);return s._editable=t,s._edit=e,s._root=n,s._size=r,s};class Ji{map;f;v;constructor(e,n){this.map=e,this.f=n,this.v=eh(this.map._root,this.f,void 0)}next(){if(yt(this.v))return{done:!0,value:void 0};const e=this.v.value;return this.v=ki(e.cont),{done:!1,value:e.value}}[Symbol.iterator](){return new Ji(this.map,this.f)}}const ki=t=>t?th(t[0],t[1],t[2],t[3],t[4]):te(),eh=(t,e,n=void 0)=>{switch(t._tag){case"LeafNode":return Zt(t.value)?ge({value:e(t.key,t.value.value),cont:n}):ki(n);case"CollisionNode":case"ArrayNode":case"IndexedNode":{const r=t.children;return th(r.length,r,0,e,n)}default:return ki(n)}},th=(t,e,n,r,s)=>{for(;n<t;){const i=e[n++];if(i&&!qt(i))return eh(i,r,[t,e,n,r,s])}return ki(s)},cb=cc(!1,0,new xn,0),Gi=()=>cb,lb=t=>{const e=rh(Gi());for(const n of t)as(e,n[0],n[1]);return pb(e)},ub=t=>ce(t,ia),fb=t=>t&&qt(t._root),hb=b(2,(t,e)=>lc(t,e,z(e))),lc=b(3,(t,e,n)=>{let r=t._root,s=0;for(;;)switch(r._tag){case"LeafNode":return ae(e,r.key)?r.value:te();case"CollisionNode":{if(n===r.hash){const i=r.children;for(let o=0,c=i.length;o<c;++o){const a=i[o];if("key"in a&&ae(e,a.key))return a.value}}return te()}case"IndexedNode":{const i=_r(s,n),o=er(i);if(r.mask&o){r=r.children[Yf(r.mask,o)],s+=Ln;break}return te()}case"ArrayNode":{if(r=r.children[_r(s,n)],r){s+=Ln;break}return te()}default:return te()}}),db=b(2,(t,e)=>Zt(lc(t,e,z(e)))),as=b(3,(t,e,n)=>uc(t,e,()=>ge(n))),gb=b(3,(t,e,n)=>t._editable?(t._root=e,t._size=n,t):e===t._root?t:cc(t._editable,t._edit,e,n)),nh=t=>new Ji(t,e=>e),oa=t=>t._size,rh=t=>cc(!0,t._edit+1,t._root,t._size),pb=t=>(t._editable=!1,t),uc=b(3,(t,e,n)=>mb(t,e,z(e),n)),mb=b(4,(t,e,n,r)=>{const s={value:t._size},i=t._root.modify(t._editable?t._edit:NaN,0,r,n,e,s);return w(t,gb(i,s.value))}),Tl=b(2,(t,e)=>uc(t,e,te)),_b=b(2,(t,e)=>Wi(t,Gi(),(n,r,s)=>as(n,s,e(r,s)))),bb=b(2,(t,e)=>Wi(t,void 0,(n,r,s)=>e(r,s))),Wi=b(3,(t,e,n)=>{const r=t._root;if(r._tag==="LeafNode")return Zt(r.value)?n(e,r.value.value,r.key):e;if(r._tag==="EmptyNode")return e;const s=[r.children];let i;for(;i=s.pop();)for(let o=0,c=i.length;o<c;){const a=i[o++];a&&!qt(a)&&(a._tag==="LeafNode"?Zt(a.value)&&(e=n(e,a.value.value,a.key)):s.push(a.children))}return e}),sh="effect/HashSet",aa=Symbol.for(sh),vb={[aa]:aa,[Symbol.iterator](){return nh(this._keyMap)},[oe](){return qe(this,me(z(this._keyMap))(z(sh)))},[re](t){return yb(t)?oa(this._keyMap)===oa(t._keyMap)&&ae(this._keyMap,t._keyMap):!1},toString(){return ot(this.toJSON())},toJSON(){return{_id:"HashSet",values:Array.from(this).map(nt)}},[Ge](){return this.toJSON()},pipe(){return ne(this,arguments)}},Yi=t=>{const e=Object.create(vb);return e._keyMap=t,e},yb=t=>ce(t,aa),kb=Yi(Gi()),Zi=()=>kb,xb=t=>{const e=fc(Zi());for(const n of t)cs(e,n);return hc(e)},Sb=(...t)=>{const e=fc(Zi());for(const n of t)cs(e,n);return hc(e)},wb=b(2,(t,e)=>db(t._keyMap,e)),Ib=t=>oa(t._keyMap),fc=t=>Yi(rh(t._keyMap)),hc=t=>(t._keyMap._editable=!1,t),ih=b(2,(t,e)=>{const n=fc(t);return e(n),hc(n)}),cs=b(2,(t,e)=>t._keyMap._editable?(as(e,!0)(t._keyMap),t):Yi(as(e,!0)(t._keyMap))),oh=b(2,(t,e)=>t._keyMap._editable?(Tl(e)(t._keyMap),t):Yi(Tl(e)(t._keyMap))),Tb=b(2,(t,e)=>ih(t,n=>{for(const r of e)oh(n,r)})),Cb=b(2,(t,e)=>ih(Zi(),n=>{Rb(t,r=>cs(n,r));for(const r of e)cs(n,r)})),Rb=b(2,(t,e)=>bb(t._keyMap,(n,r)=>e(r))),Eb=b(3,(t,e,n)=>Wi(t._keyMap,e,(r,s,i)=>n(r,i))),Dn=Zi,Ob=xb,dc=Sb,Mb=wb,ah=Ib,ts=cs,ch=oh,Cl=Tb,ls=Cb,xi=Eb,Rl=Symbol.for("effect/MutableRef"),Ab={[Rl]:Rl,toString(){return ot(this.toJSON())},toJSON(){return{_id:"MutableRef",current:nt(this.current)}},[Ge](){return this.toJSON()},pipe(){return ne(this,arguments)}},lh=t=>{const e=Object.create(Ab);return e.current=t,e},Qi=t=>t.current,uh=b(2,(t,e)=>(t.current=e,t)),gc="effect/FiberId",us=Symbol.for(gc),Si="None",ca="Runtime",Nb="Composite",Fb=Ke(`${gc}-${Si}`);let Pb=class{[us]=us;_tag=Si;id=-1;startTimeMillis=-1;[oe](){return Fb}[re](e){return fh(e)&&e._tag===Si}toString(){return ot(this.toJSON())}toJSON(){return{_id:"FiberId",_tag:this._tag}}[Ge](){return this.toJSON()}};class $b{id;startTimeMillis;[us]=us;_tag=ca;constructor(e,n){this.id=e,this.startTimeMillis=n}[oe](){return qe(this,Ke(`${gc}-${this._tag}-${this.id}-${this.startTimeMillis}`))}[re](e){return fh(e)&&e._tag===ca&&this.id===e.id&&this.startTimeMillis===e.startTimeMillis}toString(){return ot(this.toJSON())}toJSON(){return{_id:"FiberId",_tag:this._tag,id:this.id,startTimeMillis:this.startTimeMillis}}[Ge](){return this.toJSON()}}const jb=new Pb,fh=t=>ce(t,us),la=t=>{switch(t._tag){case Si:return Dn();case ca:return dc(t.id);case Nb:return w(la(t.left),ls(la(t.right)))}},El=ke(Symbol.for("effect/Fiber/Id/_fiberCounter"),()=>lh(0)),hh=t=>Array.from(la(t)).map(n=>`#${n}`).join(","),Lb=()=>{const t=Qi(El);return w(El,uh(t+1)),new $b(t,Date.now())},vr=jb,Db=hh,Bb=Lb,pc=Gi,Ub=lb,qb=fb,dh=hb,gh=as,ph=nh,zb=uc,Vb=_b,mh=Wi,fs=Symbol.for("effect/List"),ua=t=>Ze(t),Hb=t=>Bp(nc(t),ua),Kb=Hb(ae),Jb={[fs]:fs,_tag:"Cons",toString(){return ot(this.toJSON())},toJSON(){return{_id:"List",_tag:"Cons",values:ua(this).map(nt)}},[Ge](){return this.toJSON()},[re](t){return bh(t)&&this._tag===t._tag&&Kb(this,t)},[oe](){return qe(this,bs(ua(this)))},[Symbol.iterator](){let t=!1,e=this;return{next(){if(t)return this.return();if(e._tag==="Nil")return t=!0,this.return();const n=e.head;return e=e.tail,{done:t,value:n}},return(n){return t||(t=!0),{done:!0,value:n}}}},pipe(){return ne(this,arguments)}},wi=(t,e)=>{const n=Object.create(Jb);return n.head=t,n.tail=e,n},Gb=Ke("Nil"),Wb={[fs]:fs,_tag:"Nil",toString(){return ot(this.toJSON())},toJSON(){return{_id:"List",_tag:"Nil"}},[Ge](){return this.toJSON()},[oe](){return Gb},[re](t){return bh(t)&&this._tag===t._tag},[Symbol.iterator](){return{next(){return{done:!0,value:void 0}}}},pipe(){return ne(this,arguments)}},_h=Object.create(Wb),bh=t=>ce(t,fs),ln=t=>t._tag==="Nil",Yb=t=>t._tag==="Cons",Zb=()=>_h,Bn=(t,e)=>wi(t,e),yr=Zb,mc=t=>wi(t,_h),Qb=b(2,(t,e)=>ev(e,t)),Xb=b(2,(t,e)=>Bn(e,t)),ev=b(2,(t,e)=>{if(ln(t))return e;if(ln(e))return t;{const n=wi(e.head,t);let r=n,s=e.tail;for(;!ln(s);){const i=wi(s.head,t);r.tail=i,r=i,s=s.tail}return n}}),tv=b(3,(t,e,n)=>{let r=e,s=t;for(;!ln(s);)r=n(r,s.head),s=s.tail;return r}),nv=t=>{let e=yr(),n=t;for(;!ln(n);)e=Xb(e,n.head),n=n.tail;return e},_c=(function(){function t(e){e&&Object.assign(this,e)}return t.prototype=Xa,t})(),rv=Symbol.for("effect/DifferContextPatch");function Ol(t){return t}const Ss={..._c.prototype,[rv]:{_Value:Ol,_Patch:Ol}},sv=Object.assign(Object.create(Ss),{_tag:"Empty"}),iv=Object.create(sv),vh=()=>iv,ov=Object.assign(Object.create(Ss),{_tag:"AndThen"}),av=(t,e)=>{const n=Object.create(ov);return n.first=t,n.second=e,n},cv=Object.assign(Object.create(Ss),{_tag:"AddService"}),lv=(t,e)=>{const n=Object.create(cv);return n.key=t,n.service=e,n},uv=Object.assign(Object.create(Ss),{_tag:"RemoveService"}),fv=t=>{const e=Object.create(uv);return e.key=t,e},hv=Object.assign(Object.create(Ss),{_tag:"UpdateService"}),dv=(t,e)=>{const n=Object.create(hv);return n.key=t,n.update=e,n},gv=(t,e)=>{const n=new Map(t.unsafeMap);let r=vh();for(const[s,i]of e.unsafeMap.entries())if(n.has(s)){const o=n.get(s);n.delete(s),ae(o,i)||(r=ni(dv(s,()=>i))(r))}else n.delete(s),r=ni(lv(s,i))(r);for(const[s]of n.entries())r=ni(fv(s))(r);return r},ni=b(2,(t,e)=>av(t,e)),pv=b(2,(t,e)=>{if(t._tag==="Empty")return e;let n=!1,r=Ct(t);const s=new Map(e.unsafeMap);for(;pr(r);){const o=mr(r),c=On(r);switch(o._tag){case"Empty":{r=c;break}case"AddService":{s.set(o.key,o.service),r=c;break}case"AndThen":{r=Ht(Ht(c,o.second),o.first);break}case"RemoveService":{s.delete(o.key),r=c;break}case"UpdateService":{s.set(o.key,o.update(s.get(o.key))),n=!0,r=c;break}}}if(!n)return dr(s);const i=new Map;for(const[o]of e.unsafeMap)s.has(o)&&(i.set(o,s.get(o)),s.delete(o));for(const[o,c]of s)i.set(o,c);return dr(i)}),mv=Symbol.for("effect/DifferHashSetPatch");function jo(t){return t}const Xi={..._c.prototype,[mv]:{_Value:jo,_Key:jo,_Patch:jo}},_v=Object.assign(Object.create(Xi),{_tag:"Empty"}),bv=Object.create(_v),yh=()=>bv,vv=Object.assign(Object.create(Xi),{_tag:"AndThen"}),yv=(t,e)=>{const n=Object.create(vv);return n.first=t,n.second=e,n},kv=Object.assign(Object.create(Xi),{_tag:"Add"}),xv=t=>{const e=Object.create(kv);return e.value=t,e},Sv=Object.assign(Object.create(Xi),{_tag:"Remove"}),wv=t=>{const e=Object.create(Sv);return e.value=t,e},Iv=(t,e)=>{const[n,r]=xi([t,yh()],([s,i],o)=>Mb(o)(s)?[ch(o)(s),i]:[s,fa(xv(o))(i)])(e);return xi(r,(s,i)=>fa(wv(i))(s))(n)},fa=b(2,(t,e)=>yv(t,e)),Tv=b(2,(t,e)=>{if(t._tag==="Empty")return e;let n=e,r=Ct(t);for(;pr(r);){const s=mr(r),i=On(r);switch(s._tag){case"Empty":{r=i;break}case"AndThen":{r=Ht(s.first)(Ht(s.second)(i));break}case"Add":{n=ts(s.value)(n),r=i;break}case"Remove":n=ch(s.value)(n),r=i}}return n}),Cv=Symbol.for("effect/DifferReadonlyArrayPatch");function Ml(t){return t}const ws={..._c.prototype,[Cv]:{_Value:Ml,_Patch:Ml}},Rv=Object.assign(Object.create(ws),{_tag:"Empty"}),Ev=Object.create(Rv),kh=()=>Ev,Ov=Object.assign(Object.create(ws),{_tag:"AndThen"}),Mv=(t,e)=>{const n=Object.create(Ov);return n.first=t,n.second=e,n},Av=Object.assign(Object.create(ws),{_tag:"Append"}),Nv=t=>{const e=Object.create(Av);return e.values=t,e},Fv=Object.assign(Object.create(ws),{_tag:"Slice"}),Pv=(t,e)=>{const n=Object.create(Fv);return n.from=t,n.until=e,n},$v=Object.assign(Object.create(ws),{_tag:"Update"}),jv=(t,e)=>{const n=Object.create($v);return n.index=t,n.patch=e,n},Lv=t=>{let e=0,n=kh();for(;e<t.oldValue.length&&e<t.newValue.length;){const r=t.oldValue[e],s=t.newValue[e],i=t.differ.diff(r,s);ae(i,t.differ.empty)||(n=ri(n,jv(e,i))),e=e+1}return e<t.oldValue.length&&(n=ri(n,Pv(0,e))),e<t.newValue.length&&(n=ri(n,Nv(Jm(e)(t.newValue)))),n},ri=b(2,(t,e)=>Mv(t,e)),Dv=b(3,(t,e,n)=>{if(t._tag==="Empty")return e;let r=e.slice(),s=jt(t);for(;Um(s);){const i=wt(s),o=fr(s);switch(i._tag){case"Empty":{s=o;break}case"AndThen":{o.unshift(i.first,i.second),s=o;break}case"Append":{for(const c of i.values)r.push(c);s=o;break}case"Slice":{r=r.slice(i.from,i.until),s=o;break}case"Update":{r[i.index]=n.patch(i.patch,r[i.index]),s=o;break}}}return r}),Bv=Symbol.for("effect/Differ"),Uv={[Bv]:{_P:je,_V:je},pipe(){return ne(this,arguments)}},Or=t=>{const e=Object.create(Uv);return e.empty=t.empty,e.diff=t.diff,e.combine=t.combine,e.patch=t.patch,e},qv=()=>Or({empty:vh(),combine:(t,e)=>ni(e)(t),diff:(t,e)=>gv(t,e),patch:(t,e)=>pv(e)(t)}),zv=()=>Or({empty:yh(),combine:(t,e)=>fa(e)(t),diff:(t,e)=>Iv(t,e),patch:(t,e)=>Tv(e)(t)}),Vv=t=>Or({empty:kh(),combine:(e,n)=>ri(e,n),diff:(e,n)=>Lv({oldValue:e,newValue:n,differ:t}),patch:(e,n)=>Dv(e,n,t)}),xh=()=>Hv((t,e)=>e),Hv=t=>Or({empty:je,combine:(e,n)=>e===je?n:n===je?e:r=>n(e(r)),diff:(e,n)=>ae(e,n)?je:Di(n),patch:(e,n)=>t(n,e(n))}),hs=255,Sh=8,ha=t=>t&hs,da=t=>t>>Sh&hs,Is=(t,e)=>(t&hs)+((e&t&hs)<<Sh),Kv=Is(0,0),Jv=t=>Is(t,t),Gv=t=>Is(t,0),Wv=b(2,(t,e)=>Is(ha(t)&~e,da(t))),Yv=b(2,(t,e)=>t|e),Zv=t=>~t>>>0&hs,Qv=0,Ts=1,Xv=2,ey=4,ga=16,ty=32,ny=t=>eo(t,ty),ry=b(2,(t,e)=>t|e),bn=t=>wh(t)&&!oy(t),wh=t=>eo(t,Ts),eo=b(2,(t,e)=>(t&e)!==0),sy=(...t)=>t.reduce((e,n)=>e|n,0),iy=sy(Qv),Al=t=>eo(t,ey),oy=t=>eo(t,ga),si=b(2,(t,e)=>Is(t^e,e)),ii=b(2,(t,e)=>t&(Zv(ha(e))|da(e))|ha(e)&da(e)),Nl=Or({empty:Kv,diff:(t,e)=>si(t,e),combine:(t,e)=>Yv(e)(t),patch:(t,e)=>ii(e,t)}),ay=Jv,Ih=Gv,Fl=Wv,Th=(t,e)=>({_tag:"Par",left:t,right:e}),Vs=(t,e)=>({_tag:"Seq",left:t,right:e}),cy=t=>{let e=mc(t),n=yr();for(;;){const[r,s]=tv(e,[Ch(),yr()],([i,o],c)=>{const[a,u]=ly(c);return[gy(i,a),Qb(o,u)]});if(n=uy(n,r),ln(s))return nv(n);e=s}throw new Error("BUG: BlockedRequests.flatten - please report an issue at https://github.com/Effect-TS/effect/issues")},ly=t=>{let e=t,n=Ch(),r=yr(),s=yr();for(;;)switch(e._tag){case"Empty":{if(ln(r))return[n,s];e=r.head,r=r.tail;break}case"Par":{r=Bn(e.right,r),e=e.left;break}case"Seq":{const i=e.left,o=e.right;switch(i._tag){case"Empty":{e=o;break}case"Par":{const c=i.left,a=i.right;e=Th(Vs(c,o),Vs(a,o));break}case"Seq":{const c=i.left,a=i.right;e=Vs(c,Vs(a,o));break}case"Single":{e=i,s=Bn(o,s);break}}break}case"Single":{if(n=dy(n,e),ln(r))return[n,s];e=r.head,r=r.tail;break}}throw new Error("BUG: BlockedRequests.step - please report an issue at https://github.com/Effect-TS/effect/issues")},uy=(t,e)=>{if(ln(t))return mc(Lo(e));if(py(e))return t;const n=ky(t.head),r=my(e);return n.length===1&&r.length===1&&ae(n[0],r[0])?Bn(yy(t.head,Lo(e)),t.tail):Bn(Lo(e),t)},fy=Symbol.for("effect/RequestBlock/RequestBlockParallel"),hy={_R:t=>t};class bc{map;[fy]=hy;constructor(e){this.map=e}}const Ch=()=>new bc(pc()),dy=(t,e)=>new bc(zb(t.map,e.dataSource,n=>Em(Om(n,E_(e.blockedRequest)),()=>Ct(e.blockedRequest)))),gy=(t,e)=>new bc(mh(t.map,e.map,(n,r,s)=>gh(n,s,Kn(dh(n,s),{onNone:()=>r,onSome:i=>Ut(r,i)})))),py=t=>qb(t.map),my=t=>Array.from(ph(t.map)),Lo=t=>vy(Vb(t.map,e=>Ct(e))),_y=Symbol.for("effect/RequestBlock/RequestBlockSequential"),by={_R:t=>t};class Rh{map;[_y]=by;constructor(e){this.map=e}}const vy=t=>new Rh(t),yy=(t,e)=>new Rh(mh(e.map,t.map,(n,r,s)=>gh(n,s,Kn(dh(n,s),{onNone:()=>fn(),onSome:i=>Ut(i,r)})))),ky=t=>Array.from(ph(t.map)),xy=t=>Array.from(t.map),Cs="Die",Un="Empty",Mr="Fail",Ar="Interrupt",kr="Parallel",xr="Sequential",Eh="effect/Cause",Oh=Symbol.for(Eh),Sy={_E:t=>t},Nr={[Oh]:Sy,[oe](){return w(z(Eh),me(z($y(this))),qe(this))},[re](t){return wy(t)&&Py(this,t)},pipe(){return ne(this,arguments)},toJSON(){switch(this._tag){case"Empty":return{_id:"Cause",_tag:this._tag};case"Die":return{_id:"Cause",_tag:this._tag,defect:nt(this.defect)};case"Interrupt":return{_id:"Cause",_tag:this._tag,fiberId:this.fiberId.toJSON()};case"Fail":return{_id:"Cause",_tag:this._tag,failure:nt(this.error)};case"Sequential":case"Parallel":return{_id:"Cause",_tag:this._tag,left:nt(this.left),right:nt(this.right)}}},toString(){return no(this)},[Ge](){return this.toJSON()}},Sr=(()=>{const t=Object.create(Nr);return t._tag=Un,t})(),pa=t=>{const e=Object.create(Nr);return e._tag=Mr,e.error=t,e},un=t=>{const e=Object.create(Nr);return e._tag=Cs,e.defect=t,e},vn=t=>{const e=Object.create(Nr);return e._tag=Ar,e.fiberId=t,e},to=(t,e)=>{const n=Object.create(Nr);return n._tag=kr,n.left=t,n.right=e,n},Pt=(t,e)=>{const n=Object.create(Nr);return n._tag=xr,n.left=t,n.right=e,n},wy=t=>ce(t,Oh),Iy=t=>t._tag===Un,Ty=t=>t._tag===Un?!0:wr(t,!0,(e,n)=>{switch(n._tag){case Un:return ge(e);case Cs:case Mr:case Ar:return ge(!1);default:return te()}}),Cy=t=>Zt(Ny(t)),vc=t=>yc(void 0,Ly)(t),Ry=t=>gr(wr(t,fn(),(e,n)=>n._tag===Mr?ge(w(e,Ht(n.error))):te())),Ey=t=>gr(wr(t,fn(),(e,n)=>n._tag===Cs?ge(w(e,Ht(n.defect))):te())),Oy=t=>wr(t,Dn(),(e,n)=>n._tag===Ar?ge(w(e,ts(n.fiberId))):te()),My=t=>Mh(t,e=>e._tag===Mr?ge(e.error):te()),Ay=t=>{const e=My(t);switch(e._tag){case"None":return cn(t);case"Some":return ur(e.value)}},Ny=t=>Mh(t,e=>e._tag===Ar?ge(e.fiberId):te()),Pl=t=>Ah(t,{onEmpty:Sr,onFail:()=>Sr,onDie:un,onInterrupt:vn,onSequential:Pt,onParallel:to}),Fy=t=>Ah(t,{onEmpty:Sr,onFail:un,onDie:un,onInterrupt:vn,onSequential:Pt,onParallel:to}),Py=(t,e)=>{let n=Ct(t),r=Ct(e);for(;pr(n)&&pr(r);){const[s,i]=w(mr(n),wr([Dn(),fn()],([a,u],f)=>{const[d,h]=ma(f);return ge([w(a,ls(d)),w(u,Ut(h))])})),[o,c]=w(mr(r),wr([Dn(),fn()],([a,u],f)=>{const[d,h]=ma(f);return ge([w(a,ls(d)),w(u,Ut(h))])}));if(!ae(s,o))return!1;n=i,r=c}return!0},$y=t=>jy(Ct(t),fn()),jy=(t,e)=>{for(;;){const[n,r]=w(t,Mf([Dn(),fn()],([i,o],c)=>{const[a,u]=ma(c);return[w(i,ls(a)),w(o,Ut(u))]})),s=ah(n)>0?w(e,Ht(n)):e;if(O_(r))return gr(s);t=r,e=s}throw new Error(qi("Cause.flattenCauseLoop"))},Mh=b(2,(t,e)=>{const n=[t];for(;n.length>0;){const r=n.pop(),s=e(r);switch(s._tag){case"None":{switch(r._tag){case xr:case kr:{n.push(r.right),n.push(r.left);break}}break}case"Some":return s}}return te()}),ma=t=>{let e=t;const n=[];let r=Dn(),s=fn();for(;e!==void 0;)switch(e._tag){case Un:{if(n.length===0)return[r,s];e=n.pop();break}case Mr:{if(r=ts(r,Po(e._tag,e.error)),n.length===0)return[r,s];e=n.pop();break}case Cs:{if(r=ts(r,Po(e._tag,e.defect)),n.length===0)return[r,s];e=n.pop();break}case Ar:{if(r=ts(r,Po(e._tag,e.fiberId)),n.length===0)return[r,s];e=n.pop();break}case xr:{switch(e.left._tag){case Un:{e=e.right;break}case xr:{e=Pt(e.left.left,Pt(e.left.right,e.right));break}case kr:{e=to(Pt(e.left.left,e.right),Pt(e.left.right,e.right));break}default:{s=Ht(s,e.right),e=e.left;break}}break}case kr:{n.push(e.right),e=e.left;break}}throw new Error(qi("Cause.evaluateCauseLoop"))},Ly={emptyCase:ml,failCase:Wo,dieCase:Wo,interruptCase:ml,sequentialCase:(t,e,n)=>e&&n,parallelCase:(t,e,n)=>e&&n},$l="SequentialCase",jl="ParallelCase",Ah=b(2,(t,{onDie:e,onEmpty:n,onFail:r,onInterrupt:s,onParallel:i,onSequential:o})=>yc(t,void 0,{emptyCase:()=>n,failCase:(c,a)=>r(a),dieCase:(c,a)=>e(a),interruptCase:(c,a)=>s(a),sequentialCase:(c,a,u)=>o(a,u),parallelCase:(c,a,u)=>i(a,u)})),wr=b(3,(t,e,n)=>{let r=e,s=t;const i=[];for(;s!==void 0;){const o=n(r,s);switch(r=Zt(o)?o.value:r,s._tag){case xr:{i.push(s.right),s=s.left;break}case kr:{i.push(s.right),s=s.left;break}default:{s=void 0;break}}s===void 0&&i.length>0&&(s=i.pop())}return r}),yc=b(3,(t,e,n)=>{const r=[t],s=[];for(;r.length>0;){const o=r.pop();switch(o._tag){case Un:{s.push(cn(n.emptyCase(e)));break}case Mr:{s.push(cn(n.failCase(e,o.error)));break}case Cs:{s.push(cn(n.dieCase(e,o.defect)));break}case Ar:{s.push(cn(n.interruptCase(e,o.fiberId)));break}case xr:{r.push(o.right),r.push(o.left),s.push(ur({_tag:$l}));break}case kr:{r.push(o.right),r.push(o.left),s.push(ur({_tag:jl}));break}}}const i=[];for(;s.length>0;){const o=s.pop();switch(o._tag){case"Left":{switch(o.left._tag){case $l:{const c=i.pop(),a=i.pop(),u=n.sequentialCase(e,c,a);i.push(u);break}case jl:{const c=i.pop(),a=i.pop(),u=n.parallelCase(e,c,a);i.push(u);break}}break}case"Right":{i.push(o.right);break}}}if(i.length===0)throw new Error("BUG: Cause.reduceWithContext - please report an issue at https://github.com/Effect-TS/effect/issues");return i.pop()}),no=(t,e)=>vc(t)?"All fibers interrupted without errors.":zy(t).map(function(n){return e?.renderErrorCause!==!0||n.cause===void 0?n.stack:`${n.stack} {
|
|
6
|
-
${Nh(n.cause," ")}
|
|
7
|
-
}`}).join(`
|
|
8
|
-
`),Nh=(t,e)=>{const n=t.stack.split(`
|
|
9
|
-
`);let r=`${e}[cause]: ${n[0]}`;for(let s=1,i=n.length;s<i;s++)r+=`
|
|
10
|
-
${e}${n[s]}`;return t.cause&&(r+=` {
|
|
11
|
-
${Nh(t.cause,`${e} `)}
|
|
12
|
-
${e}}`),r};class Ii extends globalThis.Error{span=void 0;constructor(e){const n=typeof e=="object"&&e!==null,r=Error.stackTraceLimit;Error.stackTraceLimit=1,super(Dy(e),n&&"cause"in e&&typeof e.cause<"u"?{cause:new Ii(e.cause)}:void 0),this.message===""&&(this.message="An error has occurred"),Error.stackTraceLimit=r,this.name=e instanceof Error?e.name:"Error",n&&(Ir in e&&(this.span=e[Ir]),Object.keys(e).forEach(s=>{s in this||(this[s]=e[s])})),this.stack=qy(`${this.name}: ${this.message}`,e instanceof Error&&e.stack?e.stack:"",this.span)}}const Dy=t=>{if(typeof t=="string")return t;if(typeof t=="object"&&t!==null&&t instanceof Error)return t.message;try{if(ce(t,"toString")&&Bi(t.toString)&&t.toString!==Object.prototype.toString&&t.toString!==globalThis.Array.prototype.toString)return t.toString()}catch{}return uf(t)},By=/\((.*)\)/g,Uy=ke("effect/Tracer/spanToTrace",()=>new WeakMap),qy=(t,e,n)=>{const r=[t],s=e.startsWith(t)?e.slice(t.length).split(`
|
|
13
|
-
`):e.split(`
|
|
14
|
-
`);for(let i=1;i<s.length;i++){if(s[i].includes(" at new BaseEffectError")||s[i].includes(" at new YieldableError")){i++;continue}if(s[i].includes("Generator.next")||s[i].includes("effect_internal_function"))break;r.push(s[i].replace(/at .*effect_instruction_i.*\((.*)\)/,"at $1").replace(/EffectPrimitive\.\w+/,"<anonymous>"))}if(n){let i=n,o=0;for(;i&&i._tag==="Span"&&o<10;){const c=Uy.get(i);if(typeof c=="function"){const a=c();if(typeof a=="string"){const u=a.matchAll(By);let f=!1;for(const[,d]of u)f=!0,r.push(` at ${i.name} (${d})`);f||r.push(` at ${i.name} (${a.replace(/^at /,"")})`)}else r.push(` at ${i.name}`)}else r.push(` at ${i.name}`);i=Cn(i.parent),o++}}return r.join(`
|
|
15
|
-
`)},Ir=Symbol.for("effect/SpanAnnotation"),zy=t=>yc(t,void 0,{emptyCase:()=>[],dieCase:(e,n)=>[new Ii(n)],failCase:(e,n)=>[new Ii(n)],interruptCase:()=>[],parallelCase:(e,n,r)=>[...n,...r],sequentialCase:(e,n,r)=>[...n,...r]}),ro="Pending",Fh="Done",Vy="effect/Deferred",Hy=Symbol.for(Vy),Ky={_E:t=>t,_A:t=>t},Jy=t=>({_tag:ro,joiners:t}),Gy=t=>({_tag:Fh,effect:t});class Rs{self;called=!1;constructor(e){this.self=e}next(e){return this.called?{value:e,done:!0}:(this.called=!0,{value:this.self,done:!1})}return(e){return{value:e,done:!0}}throw(e){throw e}[Symbol.iterator](){return new Rs(this.self)}}const Ph=(t,e)=>{const n=new at("Blocked");return n.effect_instruction_i0=t,n.effect_instruction_i1=e,n},Wy=t=>{const e=new at("RunBlocked");return e.effect_instruction_i0=t,e},Tr=Symbol.for("effect/Effect");class Yy{patch;op;_op=Za;constructor(e,n){this.patch=e,this.op=n}}class at{_op;effect_instruction_i0=void 0;effect_instruction_i1=void 0;effect_instruction_i2=void 0;trace=void 0;[Tr]=lr;constructor(e){this._op=e}[re](e){return this===e}[oe](){return qe(this,Ja(this))}pipe(){return ne(this,arguments)}toJSON(){return{_id:"Effect",_op:this._op,effect_instruction_i0:nt(this.effect_instruction_i0),effect_instruction_i1:nt(this.effect_instruction_i1),effect_instruction_i2:nt(this.effect_instruction_i2)}}toString(){return ot(this.toJSON())}[Ge](){return this.toJSON()}[Symbol.iterator](){return new Rs(new _s(this))}}class $h{_op;effect_instruction_i0=void 0;effect_instruction_i1=void 0;effect_instruction_i2=void 0;trace=void 0;[Tr]=lr;constructor(e){this._op=e,this._tag=e}[re](e){return lo(e)&&e._op==="Failure"&&ae(this.effect_instruction_i0,e.effect_instruction_i0)}[oe](){return w(Ke(this._tag),me(z(this.effect_instruction_i0)),qe(this))}get cause(){return this.effect_instruction_i0}pipe(){return ne(this,arguments)}toJSON(){return{_id:"Exit",_tag:this._op,cause:this.cause.toJSON()}}toString(){return ot(this.toJSON())}[Ge](){return this.toJSON()}[Symbol.iterator](){return new Rs(new _s(this))}}class jh{_op;effect_instruction_i0=void 0;effect_instruction_i1=void 0;effect_instruction_i2=void 0;trace=void 0;[Tr]=lr;constructor(e){this._op=e,this._tag=e}[re](e){return lo(e)&&e._op==="Success"&&ae(this.effect_instruction_i0,e.effect_instruction_i0)}[oe](){return w(Ke(this._tag),me(z(this.effect_instruction_i0)),qe(this))}get value(){return this.effect_instruction_i0}pipe(){return ne(this,arguments)}toJSON(){return{_id:"Exit",_tag:this._op,value:nt(this.value)}}toString(){return ot(this.toJSON())}[Ge](){return this.toJSON()}[Symbol.iterator](){return new Rs(new _s(this))}}const kc=t=>ce(t,Tr),Rt=t=>{const e=new at(df);return e.effect_instruction_i0=t,e},Zy=b(3,(t,e,n)=>oo(r=>X(t,s=>X(Bh(Xe(()=>r(e(s)))),i=>Xe(()=>n(s,i)).pipe(Cr({onFailure:o=>{switch(i._tag){case zt:return Kt(Pt(i.effect_instruction_i0,o));case Vt:return Kt(o)}},onSuccess:()=>i})))))),Es=b(2,(t,e)=>X(t,()=>Re(e))),so=t=>Es(t,void 0),Lh=function(){const t=new at(Vi);switch(arguments.length){case 2:{t.effect_instruction_i0=arguments[0],t.commit=arguments[1];break}case 3:{t.effect_instruction_i0=arguments[0],t.effect_instruction_i1=arguments[1],t.commit=arguments[2];break}case 4:{t.effect_instruction_i0=arguments[0],t.effect_instruction_i1=arguments[1],t.effect_instruction_i2=arguments[2],t.commit=arguments[3];break}default:throw new Error(qi("you're not supposed to end up here"))}return t},Ti=(t,e=vr)=>{const n=new at(Qr);let r;return n.effect_instruction_i0=s=>{r=t(s)},n.effect_instruction_i1=e,Hh(n,s=>kc(r)?r:Qt)},Qy=(t,e=vr)=>Xe(()=>Ti(t,e)),qn=(t,e=vr)=>Lh(t,function(){let n,r;function s(a){n?n(a):r===void 0&&(r=a)}const i=new at(Qr);i.effect_instruction_i0=a=>{n=a,r&&a(r)},i.effect_instruction_i1=e;let o,c;return this.effect_instruction_i0.length!==1?(c=new AbortController,o=_t(()=>this.effect_instruction_i0(s,c.signal))):o=_t(()=>this.effect_instruction_i0(s)),o||c?Hh(i,a=>(c&&c.abort(),o??Qt)):i}),Ll=b(2,(t,e)=>Sc(t,{onFailure:e,onSuccess:Re})),Dl=Symbol.for("effect/OriginalAnnotation"),Dh=(t,e)=>Zt(e)?new Proxy(t,{has(n,r){return r===Ir||r===Dl||r in n},get(n,r){return r===Ir?e.value:r===Dl?t:n[r]}}):t,Bl=t=>Ui(t)&&!(Ir in t)?Rt(e=>Kt(un(Dh(t,id(e))))):Kt(un(t)),Xy=t=>e0(()=>un(new N0(t))),ds=t=>Sc(t,{onFailure:e=>Re(ur(e)),onSuccess:e=>Re(cn(e))}),Bh=t=>s0(t,{onFailure:Ue,onSuccess:it}),dt=t=>Ui(t)&&!(Ir in t)?Rt(e=>Kt(pa(Dh(t,id(e))))):Kt(pa(t)),xc=t=>X(Q(t),dt),Kt=t=>{const e=new $h(zt);return e.effect_instruction_i0=t,e},e0=t=>X(Q(t),Kt),t0=Rt(t=>Re(t.id())),n0=t=>Rt(e=>t(e.id())),X=b(2,(t,e)=>{const n=new at(pi);return n.effect_instruction_i0=t,n.effect_instruction_i1=e,n}),r0=t=>{const e=new at("OnStep");return e.effect_instruction_i0=t,e},Uh=t=>X(t,je),s0=b(2,(t,e)=>Cr(t,{onFailure:n=>Re(e.onFailure(n)),onSuccess:n=>Re(e.onSuccess(n))})),Cr=b(2,(t,e)=>{const n=new at(mi);return n.effect_instruction_i0=t,n.effect_instruction_i1=e.onFailure,n.effect_instruction_i2=e.onSuccess,n}),Sc=b(2,(t,e)=>Cr(t,{onFailure:n=>{if(Ey(n).length>0)return Kt(Fy(n));const s=Ry(n);return s.length>0?e.onFailure(Kf(s)):Kt(n)},onSuccess:e.onSuccess})),yn=b(2,(t,e)=>Xe(()=>{const n=Ze(t),r=tc(n.length);let s=0;return Es(Ic({while:()=>s<n.length,body:()=>e(n[s],s),step:i=>{r[s++]=i}}),r)})),io=b(2,(t,e)=>Xe(()=>{const n=Ze(t);let r=0;return Ic({while:()=>r<n.length,body:()=>e(n[r],r),step:()=>{r++}})})),qh=t=>{const e=new at(vs);return e.effect_instruction_i0=ay(Ts),e.effect_instruction_i1=()=>t,e},bt=b(2,(t,e)=>X(t,n=>Q(()=>e(n)))),zh=b(2,(t,e)=>Sc(t,{onFailure:n=>xc(()=>e.onFailure(n)),onSuccess:n=>Q(()=>e.onSuccess(n))})),wc=b(2,(t,e)=>Cr(t,{onFailure:n=>{const r=Ay(n);switch(r._tag){case"Left":return xc(()=>e(r.left));case"Right":return Kt(r.right)}},onSuccess:Re})),Vh=b(2,(t,e)=>oo(n=>Cr(n(t),{onFailure:r=>{const s=Ue(r);return Cr(e(s),{onFailure:i=>Ue(Pt(r,i)),onSuccess:()=>s})},onSuccess:r=>{const s=it(r);return Cc(e(s),s)}}))),Hh=b(2,(t,e)=>Vh(t,nd({onFailure:n=>vc(n)?so(e(Oy(n))):Qt,onSuccess:()=>Qt}))),Re=t=>{const e=new jh(Vt);return e.effect_instruction_i0=t,e},Xe=t=>{const e=new at(Vi);return e.commit=t,e},Q=t=>{const e=new at(hf);return e.effect_instruction_i0=t,e},i0=b(t=>t.length===3||t.length===2&&!(Ui(t[1])&&"onlyEffect"in t[1]),(t,e)=>X(t,n=>{const r=typeof e=="function"?e(n):e;return kc(r)?Es(r,n):Hp(r)?Ti(s=>{r.then(i=>s(Re(n)),i=>s(dt(new td(i,"An unknown error occurred in Effect.tap"))))}):Re(n)})),o0=t=>Rt(e=>{const n=e.getFiberRef(ba),r=w(n,jn(()=>e.scope()));return t(ao(ba,ge(r)))}),Kh=t=>{const e=new at(vs);return e.effect_instruction_i0=Ih(Ts),e.effect_instruction_i1=()=>t,e},oo=t=>Lh(t,function(){const e=new at(vs);return e.effect_instruction_i0=Ih(Ts),e.effect_instruction_i1=n=>wh(n)?_t(()=>this.effect_instruction_i0(qh)):_t(()=>this.effect_instruction_i0(Kh)),e}),Qt=Re(void 0),a0=t=>{const e=new at(vs);return e.effect_instruction_i0=t,e.effect_instruction_i1=void 0,e},Ic=t=>{const e=new at(_i);return e.effect_instruction_i0=t.while,e.effect_instruction_i1=t.body,e.effect_instruction_i2=t.step,e},c0=t=>Xe(()=>{const e=new at(Xr);return e.effect_instruction_i0=t(),e}),l0=function(){const t=arguments.length===1?arguments[0]:arguments[1].bind(arguments[0]);return c0(()=>t(w))},Tc=t=>{const e=new at(ei);return typeof t?.priority<"u"?R0(e,t.priority):e},Jh=b(2,(t,e)=>X(t,n=>bt(e,r=>[n,r]))),Gh=b(2,(t,e)=>X(t,n=>Es(e,n))),Cc=b(2,(t,e)=>X(t,()=>e)),u0=t=>X(t0,e=>w(t,f0(e))),f0=b(2,(t,e)=>X(t.interruptAsFork(e),()=>t.await)),h0={_tag:"All",syslog:0,label:"ALL",ordinal:Number.MIN_SAFE_INTEGER,pipe(){return ne(this,arguments)}},d0={_tag:"Fatal",syslog:2,label:"FATAL",ordinal:5e4,pipe(){return ne(this,arguments)}},g0={_tag:"Error",syslog:3,label:"ERROR",ordinal:4e4,pipe(){return ne(this,arguments)}},Wh={_tag:"Warning",syslog:4,label:"WARN",ordinal:3e4,pipe(){return ne(this,arguments)}},Yh={_tag:"Info",syslog:6,label:"INFO",ordinal:2e4,pipe(){return ne(this,arguments)}},Zh={_tag:"Debug",syslog:7,label:"DEBUG",ordinal:1e4,pipe(){return ne(this,arguments)}},p0={_tag:"Trace",syslog:7,label:"TRACE",ordinal:0,pipe(){return ne(this,arguments)}},m0={_tag:"None",syslog:7,label:"OFF",ordinal:Number.MAX_SAFE_INTEGER,pipe(){return ne(this,arguments)}},_0="effect/FiberRef",b0=Symbol.for(_0),v0={_A:t=>t},Rc=t=>Rt(e=>it(e.getFiberRef(t))),Ec=b(2,(t,e)=>X(Rc(t),e)),Ul=b(2,(t,e)=>y0(t,()=>[void 0,e])),y0=b(2,(t,e)=>Rt(n=>{const[r,s]=e(n.getFiberRef(t));return n.setFiberRef(t,s),Re(r)})),ao=b(3,(t,e,n)=>Zy(Gh(Rc(e),Ul(e,n)),()=>t,r=>Ul(e,r))),It=(t,e)=>Fr(t,{differ:xh(),fork:e?.fork??je,join:e?.join}),k0=t=>{const e=zv();return Fr(t,{differ:e,fork:e.empty})},x0=t=>{const e=Vv(xh());return Fr(t,{differ:e,fork:e.empty})},Qh=t=>{const e=qv();return Fr(t,{differ:e,fork:e.empty})},Fr=(t,e)=>({...ks,[b0]:v0,initial:t,commit(){return Rc(this)},diff:(r,s)=>e.differ.diff(r,s),combine:(r,s)=>e.differ.combine(r,s),patch:r=>s=>e.differ.patch(r,s),fork:e.fork,join:e.join??((r,s)=>s)}),S0=t=>Fr(t,{differ:Nl,fork:Nl.empty}),co=ke(Symbol.for("effect/FiberRef/currentContext"),()=>Qh(jf())),Oc=ke(Symbol.for("effect/FiberRef/currentSchedulingPriority"),()=>It(0)),w0=ke(Symbol.for("effect/FiberRef/currentMaxOpsBeforeYield"),()=>It(2048)),I0=ke(Symbol.for("effect/FiberRef/currentLogAnnotation"),()=>It(pc())),T0=ke(Symbol.for("effect/FiberRef/currentLogLevel"),()=>It(Yh)),C0=ke(Symbol.for("effect/FiberRef/currentLogSpan"),()=>It(yr())),R0=b(2,(t,e)=>ao(t,Oc,e)),E0=ke(Symbol.for("effect/FiberRef/currentConcurrency"),()=>It("unbounded")),O0=ke(Symbol.for("effect/FiberRef/currentRequestBatching"),()=>It(!0)),M0=ke(Symbol.for("effect/FiberRef/currentUnhandledErrorLogLevel"),()=>It(ge(Zh))),A0=ke(Symbol.for("effect/FiberRef/versionMismatchErrorLogLevel"),()=>It(ge(Wh))),_a=ke(Symbol.for("effect/FiberRef/currentMetricLabels"),()=>x0(hr())),ba=ke(Symbol.for("effect/FiberRef/currentForkScopeOverride"),()=>It(te(),{fork:()=>te(),join:(t,e)=>t})),Hs=ke(Symbol.for("effect/FiberRef/currentInterruptedCause"),()=>It(Sr,{fork:()=>Sr,join:(t,e)=>t})),Mc=(t,e)=>t.fork(e),Xh=(function(){class t extends globalThis.Error{commit(){return dt(this)}toJSON(){const n={...this};return this.message&&(n.message=this.message),this.cause&&(n.cause=this.cause),n}[Ge](){return this.toString!==globalThis.Error.prototype.toString?this.stack?`${this.toString()}
|
|
16
|
-
${this.stack.split(`
|
|
17
|
-
`).slice(1).join(`
|
|
18
|
-
`)}`:this.toString():"Bun"in globalThis?no(pa(this),{renderErrorCause:!0}):this}}return Object.assign(t.prototype,pm),t})(),ed=(t,e)=>{class n extends Xh{_tag=e}return Object.assign(n.prototype,t),n.prototype.name=e,n},ql=Symbol.for("effect/Cause/errors/RuntimeException"),N0=ed({[ql]:ql},"RuntimeException"),F0=Symbol.for("effect/Cause/errors/InterruptedException"),P0=t=>ce(t,F0),zl=Symbol.for("effect/Cause/errors/NoSuchElement"),$0=ed({[zl]:zl},"NoSuchElementException"),Vl=Symbol.for("effect/Cause/errors/UnknownException"),td=(function(){class t extends Xh{_tag="UnknownException";error;constructor(n,r){super(r??"An unknown error occurred",{cause:n}),this.error=n}}return Object.assign(t.prototype,{[Vl]:Vl,name:"UnknownException"}),t})(),lo=t=>kc(t)&&"_tag"in t&&(t._tag==="Success"||t._tag==="Failure"),Hl=(t,e)=>D0(t,e?.parallel?to:Pt),Ue=t=>{const e=new $h(zt);return e.effect_instruction_i0=t,e},j0=t=>Ue(vn(t)),Do=b(2,(t,e)=>{switch(t._tag){case zt:return Ue(t.effect_instruction_i0);case Vt:return it(e(t.effect_instruction_i0))}}),nd=b(2,(t,{onFailure:e,onSuccess:n})=>{switch(t._tag){case zt:return e(t.effect_instruction_i0);case Vt:return n(t.effect_instruction_i0)}}),it=t=>{const e=new jh(Vt);return e.effect_instruction_i0=t,e},Mn=it(void 0),L0=b(3,(t,e,{onFailure:n,onSuccess:r})=>{switch(t._tag){case zt:switch(e._tag){case Vt:return Ue(t.effect_instruction_i0);case zt:return Ue(n(t.effect_instruction_i0,e.effect_instruction_i0))}case Vt:switch(e._tag){case Vt:return it(r(t.effect_instruction_i0,e.effect_instruction_i0));case zt:return Ue(e.effect_instruction_i0)}}}),D0=(t,e)=>{const n=Hf(t);return pr(n)?w(On(n),Mf(w(mr(n),Do(Ct)),(r,s)=>w(r,L0(s,{onSuccess:(i,o)=>w(i,Ht(o)),onFailure:e}))),Do(gr),Do(r=>Fn(r)),ge):te()},B0=t=>({...ks,[Hy]:Ky,state:lh(Jy([])),commit(){return rd(this)},blockingOn:t}),rd=t=>Qy(e=>{const n=Qi(t.state);switch(n._tag){case Fh:return e(n.effect);case ro:return n.joiners.push(e),U0(t,e)}},t.blockingOn),sd=(t,e)=>{const n=Qi(t.state);if(n._tag===ro){uh(t.state,Gy(e));for(let r=0,s=n.joiners.length;r<s;r++)n.joiners[r](e)}},U0=(t,e)=>Q(()=>{const n=Qi(t.state);if(n._tag===ro){const r=n.joiners.indexOf(e);r>=0&&n.joiners.splice(r,1)}}),q0=Rt(t=>it(t.currentContext)),z0=()=>q0,Os=t=>X(z0(),t),V0=b(2,(t,e)=>ao(co,e)(t)),H0=b(2,(t,e)=>Os(n=>V0(t,e(n)))),id=t=>{const e=t.currentSpan;return e!==void 0&&e._tag==="Span"?ge(e):te()},Kl=Symbol.for("effect/MutableHashMap"),K0={[Kl]:Kl,[Symbol.iterator](){return new Ac(this)},toString(){return ot(this.toJSON())},toJSON(){return{_id:"MutableHashMap",values:Array.from(this).map(nt)}},[Ge](){return this.toJSON()},pipe(){return ne(this,arguments)}};class Ac{self;referentialIterator;bucketIterator;constructor(e){this.self=e,this.referentialIterator=e.referential[Symbol.iterator]()}next(){if(this.bucketIterator!==void 0)return this.bucketIterator.next();const e=this.referentialIterator.next();return e.done?(this.bucketIterator=new J0(this.self.buckets.values()),this.next()):e}[Symbol.iterator](){return new Ac(this.self)}}class J0{backing;constructor(e){this.backing=e}currentBucket;next(){if(this.currentBucket===void 0){const n=this.backing.next();if(n.done)return n;this.currentBucket=n.value[Symbol.iterator]()}const e=this.currentBucket.next();return e.done?(this.currentBucket=void 0,this.next()):e}}const G0=()=>{const t=Object.create(K0);return t.referential=new Map,t.buckets=new Map,t.bucketsSize=0,t},Rn=b(2,(t,e)=>{if(gi(e)===!1)return t.referential.has(e)?ge(t.referential.get(e)):te();const n=e[oe](),r=t.buckets.get(n);return r===void 0?te():W0(t,r,e)}),W0=(t,e,n,r=!1)=>{for(let s=0,i=e.length;s<i;s++)if(n[re](e[s][0])){const o=e[s][1];return r&&(e.splice(s,1),t.bucketsSize--),ge(o)}return te()},qr=b(2,(t,e)=>Zt(Rn(t,e))),zr=b(3,(t,e,n)=>{if(gi(e)===!1)return t.referential.set(e,n),t;const r=e[oe](),s=t.buckets.get(r);return s===void 0?(t.buckets.set(r,[[e,n]]),t.bucketsSize++,t):(Y0(t,s,e),s.push([e,n]),t.bucketsSize++,t)}),Y0=(t,e,n)=>{for(let r=0,s=e.length;r<s;r++)if(n[re](e[r][0])){e.splice(r,1),t.bucketsSize--;return}},Z0="effect/Clock",Jl=Symbol.for(Z0),Nc=Jn("effect/Clock"),Q0=2**31-1,Gl={unsafeSchedule(t,e){const n=sa(e);if(n>Q0)return Wo;let r=!1;const s=setTimeout(()=>{r=!0,t()},n);return()=>(clearTimeout(s),!r)}},Wl=(function(){const t=BigInt(1e6);if(typeof performance>"u"||typeof performance.now!="function")return()=>BigInt(Date.now())*t;let e;return()=>(e===void 0&&(e=BigInt(Date.now())*t-BigInt(Math.round(performance.now()*1e6))),e+BigInt(Math.round(performance.now()*1e6)))})(),X0=(function(){const t=typeof process=="object"&&"hrtime"in process&&typeof process.hrtime.bigint=="function"?process.hrtime:void 0;if(!t)return Wl;const e=Wl()-t.bigint();return()=>e+t.bigint()})();class ek{[Jl]=Jl;unsafeCurrentTimeMillis(){return Date.now()}unsafeCurrentTimeNanos(){return X0()}currentTimeMillis=Q(()=>this.unsafeCurrentTimeMillis());currentTimeNanos=Q(()=>this.unsafeCurrentTimeNanos());scheduler(){return Re(Gl)}sleep(e){return qn(n=>{const r=Gl.unsafeSchedule(()=>n(Qt),e);return so(Q(r))})}}const tk=()=>new ek,od="And",ad="Or",cd="InvalidData",ld="MissingData",ud="SourceUnavailable",fd="Unsupported",nk="effect/ConfigError",Yl=Symbol.for(nk),Pr={_tag:"ConfigError",[Yl]:Yl},hd=(t,e)=>{const n=Object.create(Pr);return n._op=od,n.left=t,n.right=e,Object.defineProperty(n,"toString",{enumerable:!1,value(){return`${this.left} and ${this.right}`}}),Object.defineProperty(n,"message",{enumerable:!1,get(){return this.toString()}}),n},dd=(t,e)=>{const n=Object.create(Pr);return n._op=ad,n.left=t,n.right=e,Object.defineProperty(n,"toString",{enumerable:!1,value(){return`${this.left} or ${this.right}`}}),Object.defineProperty(n,"message",{enumerable:!1,get(){return this.toString()}}),n},rk=(t,e,n={pathDelim:"."})=>{const r=Object.create(Pr);return r._op=cd,r.path=t,r.message=e,Object.defineProperty(r,"toString",{enumerable:!1,value(){return`(Invalid data at ${w(this.path,Er(n.pathDelim))}: "${this.message}")`}}),r},zn=(t,e,n={pathDelim:"."})=>{const r=Object.create(Pr);return r._op=ld,r.path=t,r.message=e,Object.defineProperty(r,"toString",{enumerable:!1,value(){return`(Missing data at ${w(this.path,Er(n.pathDelim))}: "${this.message}")`}}),r},sk=(t,e,n,r={pathDelim:"."})=>{const s=Object.create(Pr);return s._op=ud,s.path=t,s.message=e,s.cause=n,Object.defineProperty(s,"toString",{enumerable:!1,value(){return`(Source unavailable at ${w(this.path,Er(r.pathDelim))}: "${this.message}")`}}),s},ik=(t,e,n={pathDelim:"."})=>{const r=Object.create(Pr);return r._op=fd,r.path=t,r.message=e,Object.defineProperty(r,"toString",{enumerable:!1,value(){return`(Unsupported operation at ${w(this.path,Er(n.pathDelim))}: "${this.message}")`}}),r},An=b(2,(t,e)=>{switch(t._op){case od:return hd(An(t.left,e),An(t.right,e));case ad:return dd(An(t.left,e),An(t.right,e));case cd:return rk([...e,...t.path],t.message);case ld:return zn([...e,...t.path],t.message);case ud:return sk([...e,...t.path],t.message,t.cause);case fd:return ik([...e,...t.path],t.message)}}),ok={_tag:"Empty"},Bo=b(2,(t,e)=>{let n=mc(e),r=t;for(;Yb(n);){const s=n.head;switch(s._tag){case"Empty":{n=n.tail;break}case"AndThen":{n=Bn(s.first,Bn(s.second,n.tail));break}case"MapName":{r=rr(r,s.f),n=n.tail;break}case"Nested":{r=bi(r,s.name),n=n.tail;break}case"Unnested":{if(w(es(r),Fm(s.name)))r=fr(r),n=n.tail;else return ur(zn(r,`Expected ${s.name} to be in path in ConfigProvider#unnested`));break}}}return cn(r)}),ak="Constant",ck="Fail",lk="Fallback",uk="Described",fk="Lazy",hk="MapOrFail",dk="Nested",gk="Primitive",pk="Sequence",mk="HashMap",_k="ZipWith";var Zl={};const Ci=(t,e)=>[...t,...e],bk="effect/ConfigProvider",Ql=Symbol.for(bk),vk=Jn("effect/ConfigProvider"),yk="effect/ConfigProviderFlat",Xl=Symbol.for(yk),kk=t=>({[Ql]:Ql,pipe(){return ne(this,arguments)},...t}),xk=t=>({[Xl]:Xl,patch:t.patch,load:(e,n,r=!0)=>t.load(e,n,r),enumerateChildren:t.enumerateChildren}),Sk=t=>kk({load:e=>X(Nt(t,hr(),e,!1),n=>Kn(es(n),{onNone:()=>dt(zn(hr(),`Expected a single value having structure: ${e}`)),onSome:Re})),flattened:t}),wk=t=>{const{pathDelim:e,seqDelim:n}=Object.assign({},{pathDelim:"_",seqDelim:","},t),r=a=>w(a,Er(e)),s=a=>a.split(e),i=()=>typeof process<"u"&&"env"in process&&typeof Zl=="object"?Zl:{};return Sk(xk({load:(a,u,f=!0)=>{const d=r(a),h=i(),p=d in h?ge(h[d]):te();return w(p,wc(()=>zn(a,`Expected ${d} to exist in the process context`)),X(g=>Ek(g,a,u,n,f)))},enumerateChildren:a=>Q(()=>{const u=i(),h=Object.keys(u).map(p=>s(p.toUpperCase())).filter(p=>{for(let g=0;g<a.length;g++){const x=w(a,Ef(g)),m=p[g];if(m===void 0||x!==m)return!1}return!0}).flatMap(p=>p.slice(a.length,a.length+1));return Ob(h)}),patch:ok}))},Ik=(t,e,n,r)=>{const s=kl(n.length,a=>a>=r.length?te():ge([t(a),a+1])),i=kl(r.length,a=>a>=n.length?te():ge([e(a),a+1])),o=Ci(n,s),c=Ci(r,i);return[o,c]},Tk=(t,e)=>{let n=e;if(n._tag==="Nested"){const r=t.slice();for(;n._tag==="Nested";)r.push(n.name),n=n.config;return r}return t},Nt=(t,e,n,r)=>{const s=n;switch(s._tag){case ak:return Re(jt(s.value));case uk:return Xe(()=>Nt(t,e,s.config,r));case ck:return dt(zn(e,s.message));case lk:return w(Xe(()=>Nt(t,e,s.first,r)),Ll(i=>s.condition(i)?w(Nt(t,e,s.second,r),Ll(o=>dt(dd(i,o)))):dt(i)));case fk:return Xe(()=>Nt(t,e,s.config(),r));case hk:return Xe(()=>w(Nt(t,e,s.original,r),X(yn(i=>w(s.mapOrFail(i),wc(An(Tk(e,s.original))))))));case dk:return Xe(()=>Nt(t,Ci(e,jt(s.name)),s.config,r));case gk:return w(Bo(e,t.patch),X(i=>w(t.load(i,s,r),X(o=>{if(o.length===0){const c=w(Vm(i),jn(()=>"<n/a>"));return dt(zn([],`Expected ${s.description} with name ${c}`))}return Re(o)}))));case pk:return w(Bo(e,t.patch),X(i=>w(t.enumerateChildren(i),X(Mk),X(o=>o.length===0?Xe(()=>bt(Nt(t,e,s.config,!0),jt)):w(yn(o,c=>Nt(t,Lm(e,`[${c}]`),s.config,!0)),bt(c=>{const a=t_(c);return a.length===0?jt(hr()):jt(a)}))))));case mk:return Xe(()=>w(Bo(e,t.patch),X(i=>w(t.enumerateChildren(i),X(o=>w(o,yn(c=>Nt(t,Ci(i,jt(c)),s.valueConfig,r)),bt(c=>c.length===0?jt(pc()):w(Ok(c),rr(a=>Ub(yl(Ze(o),a)))))))))));case _k:return Xe(()=>w(Nt(t,e,s.left,r),ds,X(i=>w(Nt(t,e,s.right,r),ds,X(o=>{if(Wr(i)&&Wr(o))return dt(hd(i.left,o.left));if(Wr(i)&&qs(o))return dt(i.left);if(qs(i)&&Wr(o))return dt(o.left);if(qs(i)&&qs(o)){const c=w(e,Er(".")),a=Ck(e,c),[u,f]=Ik(a,a,w(i.right,rr(cn)),w(o.right,rr(cn)));return w(u,yl(f),yn(([d,h])=>w(Jh(d,h),bt(([p,g])=>s.zip(p,g)))))}throw new Error("BUG: ConfigProvider.fromFlatLoop - please report an issue at https://github.com/Effect-TS/effect/issues")})))))}},Ck=(t,e)=>n=>ur(zn(t,`The element at index ${n} in a sequence at path "${e}" was missing`)),Rk=(t,e)=>t.split(new RegExp(`\\s*${r_(e)}\\s*`)),Ek=(t,e,n,r,s)=>s?w(Rk(t,r),yn(i=>n.parse(i.trim())),wc(An(e))):w(n.parse(t),zh({onFailure:An(e),onSuccess:jt})),Ok=t=>Object.keys(t[0]).map(e=>t.map(n=>n[e])),Mk=t=>w(yn(t,Nk),zh({onFailure:()=>hr(),onSuccess:vi(os)}),ds,bt(Im)),Ak=/^(\[(\d+)\])$/,Nk=t=>{const e=t.match(Ak);if(e!==null){const n=e[2];return w(n!==void 0&&n.length>0?ge(n):te(),Mm(Fk))}return te()},Fk=t=>{const e=Number.parseInt(t);return Number.isNaN(e)?te():ge(e)},eu=Symbol.for("effect/Console"),gd=Jn("effect/Console"),Pk={[eu]:eu,assert(t,...e){return Q(()=>{console.assert(t,...e)})},clear:Q(()=>{console.clear()}),count(t){return Q(()=>{console.count(t)})},countReset(t){return Q(()=>{console.countReset(t)})},debug(...t){return Q(()=>{console.debug(...t)})},dir(t,e){return Q(()=>{console.dir(t,e)})},dirxml(...t){return Q(()=>{console.dirxml(...t)})},error(...t){return Q(()=>{console.error(...t)})},group(t){return t?.collapsed?Q(()=>console.groupCollapsed(t?.label)):Q(()=>console.group(t?.label))},groupEnd:Q(()=>{console.groupEnd()}),info(...t){return Q(()=>{console.info(...t)})},log(...t){return Q(()=>{console.log(...t)})},table(t,e){return Q(()=>{console.table(t,e)})},time(t){return Q(()=>console.time(t))},timeEnd(t){return Q(()=>console.timeEnd(t))},timeLog(t,...e){return Q(()=>{console.timeLog(t,...e)})},trace(...t){return Q(()=>{console.trace(...t)})},warn(...t){return Q(()=>{console.warn(...t)})},unsafe:console},$k="effect/Random",tu=Symbol.for($k),jk=Jn("effect/Random");class Lk{seed;[tu]=tu;PRNG;constructor(e){this.seed=e,this.PRNG=new Qp(e)}get next(){return Q(()=>this.PRNG.number())}get nextBoolean(){return bt(this.next,e=>e>.5)}get nextInt(){return Q(()=>this.PRNG.integer(Number.MAX_SAFE_INTEGER))}nextRange(e,n){return bt(this.next,r=>(n-e)*r+e)}nextIntBetween(e,n){return Q(()=>this.PRNG.integer(n-e)+e)}shuffle(e){return Dk(e,n=>this.nextIntBetween(0,n))}}const Dk=(t,e)=>Xe(()=>w(Q(()=>Array.from(t)),X(n=>{const r=[];for(let s=n.length;s>=2;s=s-1)r.push(s);return w(r,io(s=>w(e(s),bt(i=>Bk(n,s-1,i)))),Es(Hf(n)))}))),Bk=(t,e,n)=>{const r=t[e];return t[e]=t[n],t[n]=r,t},Uk=t=>new Lk(z(t)),nu=Symbol.for("effect/Tracer"),qk=t=>({[nu]:nu,...t}),pd=Jn("effect/Tracer"),md=Jn("effect/ParentSpan"),ru=(function(){const t="abcdef0123456789",e=t.length;return function(n){let r="";for(let s=0;s<n;s++)r+=t.charAt(Math.floor(Math.random()*e));return r}})();class zk{name;parent;context;startTime;kind;_tag="Span";spanId;traceId="native";sampled=!0;status;attributes;events=[];links;constructor(e,n,r,s,i,o){this.name=e,this.parent=n,this.context=r,this.startTime=i,this.kind=o,this.status={_tag:"Started",startTime:i},this.attributes=new Map,this.traceId=n._tag==="Some"?n.value.traceId:ru(32),this.spanId=ru(16),this.links=Array.from(s)}end(e,n){this.status={_tag:"Ended",endTime:e,exit:n,startTime:this.status.startTime}}attribute(e,n){this.attributes.set(e,n)}event(e,n,r){this.events.push([e,n,r??{}])}addLinks(e){this.links.push(...e)}}const Vk=qk({span:(t,e,n,r,s,i)=>new zk(t,e,n,r,s,i),context:t=>t()}),Hk=w(jf(),Ur(Nc,tk()),Ur(gd,Pk),Ur(jk,Uk(Math.random())),Ur(vk,wk()),Ur(pd,Vk)),Ri=ke(Symbol.for("effect/DefaultServices/currentServices"),()=>Qh(Hk)),su=Symbol.for("effect/FiberRefs");class gs{locals;[su]=su;constructor(e){this.locals=e}pipe(){return ne(this,arguments)}}const Kk=(t,e,n,r=!1)=>{const s=t;let i=e,o=n,c=r,a;for(;a===void 0;)if(Tt(i)&&Tt(o)){const u=wt(i)[0],f=fr(i),d=wt(o)[0],h=wt(o)[1],p=fr(o);u.startTimeMillis<d.startTimeMillis?(o=p,c=!0):u.startTimeMillis>d.startTimeMillis?i=f:u.id<d.id?(o=p,c=!0):u.id>d.id?i=f:a=[h,c]}else a=[s.initial,!0];return a},Jk=b(3,(t,e,n)=>{const r=new Map(t.locals);return n.locals.forEach((s,i)=>{const o=s[0][1];if(!s[0][0][re](e)){if(!r.has(i)){if(ae(o,i.initial))return;r.set(i,[[e,i.join(i.initial,o)]]);return}const c=r.get(i),[a,u]=Kk(i,c,s);if(u){const f=i.diff(a,o),d=c[0][1],h=i.join(d,i.patch(f)(d));if(!ae(d,h)){let p;const g=c[0][0];g[re](e)?p=[[g,h],...c.slice(1)]:p=[[e,h],...c],r.set(i,p)}}}}),new gs(r)}),Gk=b(2,(t,e)=>{const n=new Map;return Wk(t,n,e),new gs(n)}),Wk=(t,e,n)=>{t.locals.forEach((r,s)=>{const i=r[0][1],o=s.patch(s.fork)(i);ae(i,o)?e.set(s,r):e.set(s,[[n,o],...r])})},_d=b(2,(t,e)=>{const n=new Map(t.locals);return n.delete(e),new gs(n)}),Yk=b(2,(t,e)=>t.locals.has(e)?ge(wt(t.locals.get(e))[1]):te()),ps=b(2,(t,e)=>w(Yk(t,e),jn(()=>e.initial))),va=b(2,(t,{fiberId:e,fiberRef:n,value:r})=>{if(t.locals.size===0)return new gs(new Map([[n,[[e,r]]]]));const s=new Map(t.locals);return Zk(s,e,n,r),new gs(s)}),Zk=(t,e,n,r)=>{const s=t.get(n)??[];let i;if(Tt(s)){const[o,c]=wt(s);if(o[re](e)){if(ae(c,r))return;i=[[e,r],...s.slice(1)]}else i=[[e,r],...s]}else i=[[e,r]];t.set(n,i)},Qk=ps,Xk=h0,ex=d0,tx=g0,nx=Wh,rx=Yh,sx=Zh,ix=p0,ox=m0,ax=w(os,Cm(t=>t.ordinal)),cx=Rm(ax),lx=t=>{switch(t){case"All":return Xk;case"Debug":return sx;case"Error":return tx;case"Fatal":return ex;case"Info":return rx;case"Trace":return ix;case"None":return ox;case"Warning":return nx}},bd=t=>t.replace(/[\s="]/g,"_"),ux=t=>e=>`${bd(e.label)}=${t-e.startTime}ms`,fx=ys,hx=mm;class dx extends hx{}const vd="Empty",yd="Add",kd="Remove",xd="Update",Sd="AndThen",gx={_tag:vd},px=(t,e)=>{const n=new Map(t.locals);let r=gx;for(const[s,i]of e.locals.entries()){const o=wt(i)[1],c=n.get(s);if(c!==void 0){const a=wt(c)[1];ae(a,o)||(r=Uo({_tag:xd,fiberRef:s,patch:s.diff(a,o)})(r))}else r=Uo({_tag:yd,fiberRef:s,value:o})(r);n.delete(s)}for(const[s]of n.entries())r=Uo({_tag:kd,fiberRef:s})(r);return r},Uo=b(2,(t,e)=>({_tag:Sd,first:t,second:e})),mx=b(3,(t,e,n)=>{let r=n,s=jt(t);for(;Tt(s);){const i=wt(s),o=fr(s);switch(i._tag){case vd:{s=o;break}case yd:{r=va(r,{fiberId:e,fiberRef:i.fiberRef,value:i.value}),s=o;break}case kd:{r=_d(r,i.fiberRef),s=o;break}case xd:{const c=ps(r,i.fiberRef);r=va(r,{fiberId:e,fiberRef:i.fiberRef,value:i.fiberRef.patch(i.patch)(c)}),s=o;break}case Sd:{s=bi(i.first)(bi(i.second)(o));break}}}return r}),wd="effect/MetricLabel",ya=Symbol.for(wd);class _x{key;value;[ya]=ya;_hash;constructor(e,n){this.key=e,this.value=n,this._hash=Ke(wd+this.key+this.value)}[oe](){return this._hash}[re](e){return vx(e)&&this.key===e.key&&this.value===e.value}pipe(){return ne(this,arguments)}}const bx=(t,e)=>new _x(t,e),vx=t=>ce(t,ya),yx=t=>{let e,n;typeof t=="function"?e=t:(e=t.try,n=t.catch);const r=s=>n?xc(()=>n(s)):dt(new td(s,"An unknown error occurred in Effect.tryPromise"));return e.length>=1?qn((s,i)=>{try{e(i).then(o=>s(Re(o)),o=>s(r(o)))}catch(o){s(r(o))}}):qn(s=>{try{e().then(i=>s(Re(i)),i=>s(r(i)))}catch(i){s(r(i))}})},kx="Sequential",xx="Parallel",Sx="ParallelN",wx={_tag:kx},Ix={_tag:xx},Tx=t=>({_tag:Sx,parallelism:t}),ka=wx,xa=Ix,Sa=Tx,Cx=px,Rx=mx,uo="effect/FiberStatus",Vn=Symbol.for(uo),Ei="Done",iu="Running",ou="Suspended",Ex=Ke(`${uo}-${Ei}`);class Ox{[Vn]=Vn;_tag=Ei;[oe](){return Ex}[re](e){return Fc(e)&&e._tag===Ei}}class Mx{runtimeFlags;[Vn]=Vn;_tag=iu;constructor(e){this.runtimeFlags=e}[oe](){return w(z(uo),me(z(this._tag)),me(z(this.runtimeFlags)),qe(this))}[re](e){return Fc(e)&&e._tag===iu&&this.runtimeFlags===e.runtimeFlags}}class Ax{runtimeFlags;blockingOn;[Vn]=Vn;_tag=ou;constructor(e,n){this.runtimeFlags=e,this.blockingOn=n}[oe](){return w(z(uo),me(z(this._tag)),me(z(this.runtimeFlags)),me(z(this.blockingOn)),qe(this))}[re](e){return Fc(e)&&e._tag===ou&&this.runtimeFlags===e.runtimeFlags&&ae(this.blockingOn,e.blockingOn)}}const Nx=new Ox,Fx=t=>new Mx(t),Px=(t,e)=>new Ax(t,e),Fc=t=>ce(t,Vn),$x=t=>t._tag===Ei,jx=Nx,Id=Fx,Lx=Px,Dx=$x,Bx=Symbol.for("effect/Micro"),Oi=Symbol.for("effect/Micro/MicroExit"),au=Symbol.for("effect/Micro/MicroCause"),Ux={_E:je};class Td extends globalThis.Error{_tag;traces;[au];constructor(e,n,r){const s=`MicroCause.${e}`;let i,o,c;if(n instanceof globalThis.Error){i=`(${s}) ${n.name}`,o=n.message;const a=o.split(`
|
|
19
|
-
`).length;c=n.stack?`(${s}) ${n.stack.split(`
|
|
20
|
-
`).slice(0,a+3).join(`
|
|
21
|
-
`)}`:`${i}: ${o}`}else i=s,o=cr(n,0),c=`${i}: ${o}`;r.length>0&&(c+=`
|
|
22
|
-
${r.join(`
|
|
23
|
-
`)}`),super(o),this._tag=e,this.traces=r,this[au]=Ux,this.name=i,this.stack=c}pipe(){return ne(this,arguments)}toString(){return this.stack}[Ge](){return this.stack}}class qx extends Td{defect;constructor(e,n=[]){super("Die",e,n),this.defect=e}}const zx=(t,e=[])=>new qx(t,e);class Vx extends Td{constructor(e=[]){super("Interrupt","interrupted",e)}}const Hx=(t=[])=>new Vx(t),Kx=t=>t._tag==="Interrupt",cu=Symbol.for("effect/Micro/MicroFiber"),Jx={_A:je,_E:je};class Gx{context;interruptible;[cu];_stack=[];_observers=[];_exit;_children;currentOpCount=0;constructor(e,n=!0){this.context=e,this.interruptible=n,this[cu]=Jx}getRef(e){return __(this.context,e)}addObserver(e){return this._exit?(e(this._exit),Dp):(this._observers.push(e),()=>{const n=this._observers.indexOf(e);n>=0&&this._observers.splice(n,1)})}_interrupted=!1;unsafeInterrupt(){this._exit||(this._interrupted=!0,this.interruptible&&this.evaluate(Dc))}unsafePoll(){return this._exit}evaluate(e){if(this._exit)return;if(this._yielded!==void 0){const s=this._yielded;this._yielded=void 0,s()}const n=this.runLoop(e);if(n===Ks)return;const r=lu.interruptChildren&&lu.interruptChildren(this);if(r!==void 0)return this.evaluate(Ai(r,()=>n));this._exit=n;for(let s=0;s<this._observers.length;s++)this._observers[s](n);this._observers.length=0}runLoop(e){let n=!1,r=e;this.currentOpCount=0;try{for(;;){if(this.currentOpCount++,!n&&this.getRef(Bc).shouldYield(this)){n=!0;const s=r;r=Ai(Xx,()=>s)}if(r=r[wa](this),r===Ks){const s=this._yielded;return Oi in s?(this._yielded=void 0,s):Ks}}}catch(s){return ce(r,wa)?Ia(s):Ia(`MicroFiber.runLoop: Not a valid effect: ${String(r)}`)}}getCont(e){for(;;){const n=this._stack.pop();if(!n)return;const r=n[Mi]&&n[Mi](this);if(r)return{[e]:r};if(n[e])return n}}_yielded=void 0;yieldWith(e){return this._yielded=e,Ks}children(){return this._children??=new Set}}const lu=ke("effect/Micro/fiberMiddleware",()=>({interruptChildren:void 0})),Cd=Symbol.for("effect/Micro/identifier"),tt=Symbol.for("effect/Micro/args"),wa=Symbol.for("effect/Micro/evaluate"),Rr=Symbol.for("effect/Micro/successCont"),or=Symbol.for("effect/Micro/failureCont"),Mi=Symbol.for("effect/Micro/ensureCont"),Ks=Symbol.for("effect/Micro/Yield"),Wx={_A:je,_E:je,_R:je},Yx={...fx,_op:"Micro",[Bx]:Wx,pipe(){return ne(this,arguments)},[Symbol.iterator](){return new of(new _s(this))},toJSON(){return{_id:"Micro",op:this[Cd],...tt in this?{args:this[tt]}:void 0}},toString(){return ot(this)},[Ge](){return ot(this)}};function Zx(t){return Ia("Micro.evaluate: Not implemented")}const fo=t=>({...Yx,[Cd]:t.op,[wa]:t.eval??Zx,[Rr]:t.contA,[or]:t.contE,[Mi]:t.ensure}),Pc=t=>{const e=fo(t);return function(){const n=Object.create(e);return n[tt]=t.single===!1?arguments:arguments[0],n}},Rd=t=>{const e={...fo(t),[Oi]:Oi,_tag:t.op,get[t.prop](){return this[tt]},toJSON(){return{_id:"MicroExit",_tag:t.op,[t.prop]:this[tt]}},[re](n){return nS(n)&&n._tag===t.op&&ae(this[tt],n[tt])},[oe](){return qe(this,me(Ke(t.op))(z(this[tt])))}};return function(n){const r=Object.create(e);return r[tt]=n,r[Rr]=void 0,r[or]=void 0,r[Mi]=void 0,r}},$c=Rd({op:"Success",prop:"value",eval(t){const e=t.getCont(Rr);return e?e[Rr](this[tt],t):t.yieldWith(this)}}),Ed=Rd({op:"Failure",prop:"cause",eval(t){let e=t.getCont(or);for(;Kx(this[tt])&&e&&t.interruptible;)e=t.getCont(or);return e?e[or](this[tt],t):t.yieldWith(this)}}),Qx=Pc({op:"Yield",eval(t){let e=!1;return t.getRef(Bc).scheduleTask(()=>{e||t.evaluate(rS)},this[tt]??0),t.yieldWith(()=>{e=!0})}}),Xx=Qx(0),eS=$c(void 0),jc=Pc({op:"WithMicroFiber",eval(t){return this[tt](t)}}),Ai=b(2,(t,e)=>{const n=Object.create(tS);return n[tt]=t,n[Rr]=e,n}),tS=fo({op:"OnSuccess",eval(t){return t._stack.push(this),this[tt]}}),nS=t=>ce(t,Oi),Od=$c,Lc=Ed,Dc=Lc(Hx()),Ia=t=>Lc(zx(t)),rS=Od(void 0),sS="setImmediate"in globalThis?globalThis.setImmediate:t=>setTimeout(t,0);class Md{tasks=[];running=!1;scheduleTask(e,n){this.tasks.push(e),this.running||(this.running=!0,sS(this.afterScheduled))}afterScheduled=()=>{this.running=!1,this.runTasks()};runTasks(){const e=this.tasks;this.tasks=[];for(let n=0,r=e.length;n<r;n++)e[n]()}shouldYield(e){return e.currentOpCount>=e.getRef(aS)}flush(){for(;this.tasks.length>0;)this.runTasks()}}const iS=b(2,(t,e)=>jc(n=>{const r=n.context;return n.context=e(r),uS(t,()=>(n.context=r,eS))})),oS=b(2,(t,e)=>iS(t,Bf(e)));class aS extends Uf()("effect/Micro/currentMaxOpsBeforeYield",{defaultValue:()=>2048}){}class Bc extends Uf()("effect/Micro/currentScheduler",{defaultValue:()=>new Md}){}const cS=b(2,(t,e)=>{const n=Object.create(lS);return n[tt]=t,n[Rr]=e.onSuccess,n[or]=e.onFailure,n}),lS=fo({op:"OnSuccessAndFailure",eval(t){return t._stack.push(this),this[tt]}}),uS=b(2,(t,e)=>hS(n=>cS(n(t),{onFailure:r=>Ai(e(Lc(r)),()=>Ed(r)),onSuccess:r=>Ai(e(Od(r)),()=>$c(r))}))),Ad=Pc({op:"SetInterruptible",ensure(t){if(t.interruptible=this[tt],t._interrupted&&t.interruptible)return()=>Dc}}),fS=t=>jc(e=>e.interruptible?t:(e.interruptible=!0,e._stack.push(Ad(!1)),e._interrupted?Dc:t)),hS=t=>jc(e=>e.interruptible?(e.interruptible=!1,e._stack.push(Ad(!0)),t(fS)):t(je)),dS=(t,e)=>{const n=new Gx(Bc.context(new Md));return n.evaluate(t),n};class gS{buckets=[];scheduleTask(e,n){const r=this.buckets.length;let s,i=0;for(;i<r&&this.buckets[i][0]<=n;i++)s=this.buckets[i];s&&s[0]===n?s[1].push(e):i===r?this.buckets.push([n,[e]]):this.buckets.splice(i,0,[n,[e]])}}class pS{maxNextTickBeforeTimer;running=!1;tasks=new gS;constructor(e){this.maxNextTickBeforeTimer=e}starveInternal(e){const n=this.tasks.buckets;this.tasks.buckets=[];for(const[r,s]of n)for(let i=0;i<s.length;i++)s[i]();this.tasks.buckets.length===0?this.running=!1:this.starve(e)}starve(e=0){e>=this.maxNextTickBeforeTimer?setTimeout(()=>this.starveInternal(0),0):Promise.resolve(void 0).then(()=>this.starveInternal(e+1))}shouldYield(e){return e.currentOpCount>e.getFiberRef(w0)?e.getFiberRef(Oc):!1}scheduleTask(e,n){this.tasks.scheduleTask(e,n),this.running||(this.running=!0,this.starve())}}const mS=ke(Symbol.for("effect/Scheduler/defaultScheduler"),()=>new pS(2048)),_S=ke(Symbol.for("effect/FiberRef/currentScheduler"),()=>It(mS)),Nd=ke(Symbol.for("effect/FiberRef/currentRequestMap"),()=>It(new Map)),uu=(t,e,n,r)=>{switch(t){case void 0:return e();case"unbounded":return n();case"inherit":return Ec(E0,s=>s==="unbounded"?n():s>1?r(s):e());default:return t>1?r(t):e()}},Uc="InterruptSignal",qc="Stateful",zc="Resume",Vc="YieldNow",qo=t=>({_tag:Uc,cause:t}),oi=t=>({_tag:qc,onFiber:t}),Zn=t=>({_tag:zc,effect:t}),bS=()=>({_tag:Vc}),vS="effect/FiberScope",Ni=Symbol.for(vS);class yS{[Ni]=Ni;fiberId=vr;roots=new Set;add(e,n){this.roots.add(n),n.addObserver(()=>{this.roots.delete(n)})}}class kS{fiberId;parent;[Ni]=Ni;constructor(e,n){this.fiberId=e,this.parent=n}add(e,n){this.parent.tell(oi(r=>{r.addChild(n),n.addObserver(()=>{r.removeChild(n)})}))}}const xS=t=>new kS(t.id(),t),Fd=ke(Symbol.for("effect/FiberScope/Global"),()=>new yS),SS="effect/Fiber",wS=Symbol.for(SS),IS={_E:t=>t,_A:t=>t},TS="effect/Fiber",CS=Symbol.for(TS),Pd=t=>Gh(Uh(t.await),t.inheritAll);({...ks});const Tn="effect/FiberCurrent",RS="effect/Logger",ES=Symbol.for(RS),OS={_Message:t=>t,_Output:t=>t},Hc=t=>({[ES]:OS,log:t,pipe(){return ne(this,arguments)}}),MS=/^[^\s"=]*$/,AS=(t,e)=>({annotations:n,cause:r,date:s,fiberId:i,logLevel:o,message:c,spans:a})=>{const u=g=>g.match(MS)?g:t(g),f=(g,x)=>`${bd(g)}=${u(x)}`,d=(g,x)=>" "+f(g,x);let h=f("timestamp",s.toISOString());h+=d("level",o.label),h+=d("fiber",hh(i));const p=jm(c);for(let g=0;g<p.length;g++)h+=d("message",cr(p[g],e));Iy(r)||(h+=d("cause",no(r,{renderErrorCause:!0})));for(const g of a)h+=" "+ux(s.getTime())(g);for(const[g,x]of n)h+=d(g,cr(x,e));return h},NS=t=>`"${t.replace(/\\([\s\S])|(")/g,"\\$1$2")}"`,FS=Hc(AS(NS)),PS=typeof process=="object"&&process!==null&&typeof process.stdout=="object"&&process.stdout!==null;PS&&process.stdout.isTTY;const $d="effect/MetricBoundaries",Ta=Symbol.for($d);class $S{values;[Ta]=Ta;constructor(e){this.values=e,this._hash=w(Ke($d),me(bs(this.values)))}_hash;[oe](){return this._hash}[re](e){return jS(e)&&ae(this.values,e.values)}pipe(){return ne(this,arguments)}}const jS=t=>ce(t,Ta),LS=t=>{const e=w(t,Cf(Ct(Number.POSITIVE_INFINITY)),n_);return new $S(e)},DS=t=>w($m(t.count-1,e=>t.start*Math.pow(t.factor,e)),Hi,LS),BS="effect/MetricKeyType",jd=Symbol.for(BS),Ld="effect/MetricKeyType/Counter",Ca=Symbol.for(Ld),US="effect/MetricKeyType/Frequency",qS=Symbol.for(US),zS="effect/MetricKeyType/Gauge",VS=Symbol.for(zS),Dd="effect/MetricKeyType/Histogram",Ra=Symbol.for(Dd),HS="effect/MetricKeyType/Summary",KS=Symbol.for(HS),Bd={_In:t=>t,_Out:t=>t};class JS{incremental;bigint;[jd]=Bd;[Ca]=Ca;constructor(e,n){this.incremental=e,this.bigint=n,this._hash=Ke(Ld)}_hash;[oe](){return this._hash}[re](e){return Ud(e)}pipe(){return ne(this,arguments)}}class GS{boundaries;[jd]=Bd;[Ra]=Ra;constructor(e){this.boundaries=e,this._hash=w(Ke(Dd),me(z(this.boundaries)))}_hash;[oe](){return this._hash}[re](e){return qd(e)&&ae(this.boundaries,e.boundaries)}pipe(){return ne(this,arguments)}}const WS=t=>new JS(t?.incremental??!1,t?.bigint??!1),YS=t=>new GS(t),Ud=t=>ce(t,Ca),ZS=t=>ce(t,qS),QS=t=>ce(t,VS),qd=t=>ce(t,Ra),XS=t=>ce(t,KS),e1="effect/MetricKey",zd=Symbol.for(e1),t1={_Type:t=>t},n1=nc(ae);class Kc{name;keyType;description;tags;[zd]=t1;constructor(e,n,r,s=[]){this.name=e,this.keyType=n,this.description=r,this.tags=s,this._hash=w(Ke(this.name+this.description),me(z(this.keyType)),me(bs(this.tags)))}_hash;[oe](){return this._hash}[re](e){return r1(e)&&this.name===e.name&&ae(this.keyType,e.keyType)&&ae(this.description,e.description)&&n1(this.tags,e.tags)}pipe(){return ne(this,arguments)}}const r1=t=>ce(t,zd),s1=(t,e)=>new Kc(t,WS(e),ec(e?.description)),i1=(t,e,n)=>new Kc(t,YS(e),ec(n)),o1=b(2,(t,e)=>e.length===0?t:new Kc(t.name,t.keyType,t.description,ti(t.tags,e))),a1="effect/MetricState",Ms=Symbol.for(a1),Vd="effect/MetricState/Counter",Ea=Symbol.for(Vd),Hd="effect/MetricState/Frequency",Oa=Symbol.for(Hd),Kd="effect/MetricState/Gauge",Ma=Symbol.for(Kd),Jd="effect/MetricState/Histogram",Aa=Symbol.for(Jd),Gd="effect/MetricState/Summary",Na=Symbol.for(Gd),As={_A:t=>t};class c1{count;[Ms]=As;[Ea]=Ea;constructor(e){this.count=e}[oe](){return w(z(Vd),me(z(this.count)),qe(this))}[re](e){return v1(e)&&this.count===e.count}pipe(){return ne(this,arguments)}}const l1=nc(ae);class u1{occurrences;[Ms]=As;[Oa]=Oa;constructor(e){this.occurrences=e}_hash;[oe](){return w(Ke(Hd),me(bs(Ze(this.occurrences.entries()))),qe(this))}[re](e){return y1(e)&&l1(Ze(this.occurrences.entries()),Ze(e.occurrences.entries()))}pipe(){return ne(this,arguments)}}class f1{value;[Ms]=As;[Ma]=Ma;constructor(e){this.value=e}[oe](){return w(z(Kd),me(z(this.value)),qe(this))}[re](e){return k1(e)&&this.value===e.value}pipe(){return ne(this,arguments)}}class h1{buckets;count;min;max;sum;[Ms]=As;[Aa]=Aa;constructor(e,n,r,s,i){this.buckets=e,this.count=n,this.min=r,this.max=s,this.sum=i}[oe](){return w(z(Jd),me(z(this.buckets)),me(z(this.count)),me(z(this.min)),me(z(this.max)),me(z(this.sum)),qe(this))}[re](e){return x1(e)&&ae(this.buckets,e.buckets)&&this.count===e.count&&this.min===e.min&&this.max===e.max&&this.sum===e.sum}pipe(){return ne(this,arguments)}}class d1{error;quantiles;count;min;max;sum;[Ms]=As;[Na]=Na;constructor(e,n,r,s,i,o){this.error=e,this.quantiles=n,this.count=r,this.min=s,this.max=i,this.sum=o}[oe](){return w(z(Gd),me(z(this.error)),me(z(this.quantiles)),me(z(this.count)),me(z(this.min)),me(z(this.max)),me(z(this.sum)),qe(this))}[re](e){return S1(e)&&this.error===e.error&&ae(this.quantiles,e.quantiles)&&this.count===e.count&&this.min===e.min&&this.max===e.max&&this.sum===e.sum}pipe(){return ne(this,arguments)}}const g1=t=>new c1(t),p1=t=>new u1(t),m1=t=>new f1(t),_1=t=>new h1(t.buckets,t.count,t.min,t.max,t.sum),b1=t=>new d1(t.error,t.quantiles,t.count,t.min,t.max,t.sum),v1=t=>ce(t,Ea),y1=t=>ce(t,Oa),k1=t=>ce(t,Ma),x1=t=>ce(t,Aa),S1=t=>ce(t,Na),w1="effect/MetricHook",I1=Symbol.for(w1),T1={_In:t=>t,_Out:t=>t},Ns=t=>({[I1]:T1,pipe(){return ne(this,arguments)},...t}),fu=BigInt(0),C1=t=>{let e=t.keyType.bigint?fu:0;const n=t.keyType.incremental?t.keyType.bigint?s=>s>=fu:s=>s>=0:s=>!0,r=s=>{n(s)&&(e=e+s)};return Ns({get:()=>g1(e),update:r,modify:r})},R1=t=>{const e=new Map;for(const r of t.keyType.preregisteredWords)e.set(r,0);const n=r=>{const s=e.get(r)??0;e.set(r,s+1)};return Ns({get:()=>p1(e),update:n,modify:n})},E1=(t,e)=>{let n=e;return Ns({get:()=>m1(n),update:r=>{n=r},modify:r=>{n=n+r}})},O1=t=>{const e=t.keyType.boundaries.values,n=e.length,r=new Uint32Array(n+1),s=new Float64Array(n);let i=0,o=0,c=Number.MAX_VALUE,a=Number.MIN_VALUE;w(e,vi(os),rr((d,h)=>{s[h]=d}));const u=d=>{let h=0,p=n;for(;h!==p;){const g=Math.floor(h+(p-h)/2),x=s[g];d<=x?p=g:h=g,p===h+1&&(d<=s[h]?p=h:h=p)}r[h]=r[h]+1,i=i+1,o=o+d,d<c&&(c=d),d>a&&(a=d)},f=()=>{const d=tc(n);let h=0;for(let p=0;p<n;p++){const g=s[p],x=r[p];h=h+x,d[p]=[g,h]}return d};return Ns({get:()=>_1({buckets:f(),count:i,min:c,max:a,sum:o}),update:u,modify:u})},M1=t=>{const{error:e,maxAge:n,maxSize:r,quantiles:s}=t.keyType,i=w(s,vi(os)),o=tc(r);let c=0,a=0,u=0,f=0,d=0;const h=g=>{const x=[];let m=0;for(;m!==r-1;){const k=o[m];if(k!=null){const[j,q]=k,C=ra(g-j);J_(C,Wf)&&K_(C,n)&&x.push(q)}m=m+1}return A1(e,i,vi(x,os))},p=(g,x)=>{if(r>0){c=c+1;const m=c%r;o[m]=[x,g]}f=a===0?g:Math.min(f,g),d=a===0?g:Math.max(d,g),a=a+1,u=u+g};return Ns({get:()=>b1({error:e,quantiles:h(Date.now()),count:a,min:f,max:d,sum:u}),update:([g,x])=>p(g,x),modify:([g,x])=>p(g,x)})},A1=(t,e,n)=>{const r=n.length;if(!Tt(e))return hr();const s=e[0],i=e.slice(1),o=hu(t,r,te(),0,s,n),c=jt(o);return i.forEach(a=>{c.push(hu(t,r,o.value,o.consumed,a,o.rest))}),rr(c,a=>[a.quantile,a.value])},hu=(t,e,n,r,s,i)=>{let o=t,c=e,a=n,u=r,f=s,d=i,h=t,p=e,g=n,x=r,m=s,k=i;for(;;){if(!Tt(d))return{quantile:f,value:te(),consumed:u,rest:[]};if(f===1)return{quantile:f,value:ge(Of(d)),consumed:u+d.length,rest:[]};const j=wt(d),q=Km(d,S=>S===j),C=f*c,F=o/2*C,P=u+q[0].length,M=Math.abs(P-C);if(P<C-F){h=o,p=c,g=es(d),x=P,m=f,k=q[1],o=h,c=p,a=g,u=x,f=m,d=k;continue}if(P>C+F){const S=yt(a)?ge(j):a;return{quantile:f,value:S,consumed:u,rest:d}}switch(a._tag){case"None":{h=o,p=c,g=es(d),x=P,m=f,k=q[1],o=h,c=p,a=g,u=x,f=m,d=k;continue}case"Some":{const S=Math.abs(C-a.value);if(M<S){h=o,p=c,g=es(d),x=P,m=f,k=q[1],o=h,c=p,a=g,u=x,f=m,d=k;continue}return{quantile:f,value:ge(a.value),consumed:u,rest:d}}}}throw new Error("BUG: MetricHook.resolveQuantiles - please report an issue at https://github.com/Effect-TS/effect/issues")},N1="effect/MetricPair",F1=Symbol.for(N1),P1={_Type:t=>t},$1=(t,e)=>({[F1]:P1,metricKey:t,metricState:e,pipe(){return ne(this,arguments)}}),j1="effect/MetricRegistry",du=Symbol.for(j1);class L1{[du]=du;map=G0();snapshot(){const e=[];for(const[n,r]of this.map)e.push($1(n,r.get()));return e}get(e){const n=w(this.map,Rn(e),Cn);if(n==null){if(Ud(e.keyType))return this.getCounter(e);if(QS(e.keyType))return this.getGauge(e);if(ZS(e.keyType))return this.getFrequency(e);if(qd(e.keyType))return this.getHistogram(e);if(XS(e.keyType))return this.getSummary(e);throw new Error("BUG: MetricRegistry.get - unknown MetricKeyType - please report an issue at https://github.com/Effect-TS/effect/issues")}else return n}getCounter(e){let n=w(this.map,Rn(e),Cn);if(n==null){const r=C1(e);w(this.map,qr(e))||w(this.map,zr(e,r)),n=r}return n}getFrequency(e){let n=w(this.map,Rn(e),Cn);if(n==null){const r=R1(e);w(this.map,qr(e))||w(this.map,zr(e,r)),n=r}return n}getGauge(e){let n=w(this.map,Rn(e),Cn);if(n==null){const r=E1(e,e.keyType.bigint?BigInt(0):0);w(this.map,qr(e))||w(this.map,zr(e,r)),n=r}return n}getHistogram(e){let n=w(this.map,Rn(e),Cn);if(n==null){const r=O1(e);w(this.map,qr(e))||w(this.map,zr(e,r)),n=r}return n}getSummary(e){let n=w(this.map,Rn(e),Cn);if(n==null){const r=M1(e);w(this.map,qr(e))||w(this.map,zr(e,r)),n=r}return n}}const D1=()=>new L1,B1="effect/Metric",U1=Symbol.for(B1),q1={_Type:t=>t,_In:t=>t,_Out:t=>t},gu=ke(Symbol.for("effect/Metric/globalMetricRegistry"),()=>D1()),Wd=function(t,e,n,r){const s=Object.assign(i=>i0(i,o=>K1(s,o)),{[U1]:q1,keyType:t,unsafeUpdate:e,unsafeValue:n,unsafeModify:r,register(){return this.unsafeValue([]),this},pipe(){return ne(this,arguments)}});return s},ho=(t,e)=>Yd(s1(t,e)),Yd=t=>{let e;const n=new WeakMap,r=s=>{if(s.length===0)return e!==void 0||(e=gu.get(t)),e;let i=n.get(s);return i!==void 0||(i=gu.get(o1(t,s)),n.set(s,i)),i};return Wd(t.keyType,(s,i)=>r(i).update(s),s=>r(s).get(),(s,i)=>r(i).modify(s))},z1=(t,e,n)=>Yd(i1(t,e,n)),V1=b(3,(t,e,n)=>H1(t,[bx(e,n)])),H1=b(2,(t,e)=>Wd(t.keyType,(n,r)=>t.unsafeUpdate(n,ti(e,r)),n=>t.unsafeValue(ti(e,n)),(n,r)=>t.unsafeModify(n,ti(e,r)))),K1=b(2,(t,e)=>Ec(_a,n=>Q(()=>t.unsafeUpdate(e,n))));({...Xa});const J1=b(2,(t,e)=>Ec(Nd,n=>Q(()=>{if(n.has(t)){const r=n.get(t);r.state.completed||(r.state.completed=!0,sd(r.result,e))}}))),G1="effect/Supervisor",go=Symbol.for(G1),Jc={_T:t=>t};class po{underlying;value0;[go]=Jc;constructor(e,n){this.underlying=e,this.value0=n}get value(){return this.value0}onStart(e,n,r,s){this.underlying.onStart(e,n,r,s)}onEnd(e,n){this.underlying.onEnd(e,n)}onEffect(e,n){this.underlying.onEffect(e,n)}onSuspend(e){this.underlying.onSuspend(e)}onResume(e){this.underlying.onResume(e)}map(e){return new po(this,w(this.value,bt(e)))}zip(e){return new mo(this,e)}}class mo{left;right;_tag="Zip";[go]=Jc;constructor(e,n){this.left=e,this.right=n}get value(){return Jh(this.left.value,this.right.value)}onStart(e,n,r,s){this.left.onStart(e,n,r,s),this.right.onStart(e,n,r,s)}onEnd(e,n){this.left.onEnd(e,n),this.right.onEnd(e,n)}onEffect(e,n){this.left.onEffect(e,n),this.right.onEffect(e,n)}onSuspend(e){this.left.onSuspend(e),this.right.onSuspend(e)}onResume(e){this.left.onResume(e),this.right.onResume(e)}map(e){return new po(this,w(this.value,bt(e)))}zip(e){return new mo(this,e)}}const Zd=t=>ce(t,go)&&rf(t,"Zip");class W1{effect;[go]=Jc;constructor(e){this.effect=e}get value(){return this.effect}onStart(e,n,r,s){}onEnd(e,n){}onEffect(e,n){}onSuspend(e){}onResume(e){}map(e){return new po(this,w(this.value,bt(e)))}zip(e){return new mo(this,e)}onRun(e,n){return e()}}const Y1=t=>new W1(t),Gc=ke("effect/Supervisor/none",()=>Y1(Qt)),Z1=Or,Qd="Empty",Xd="AddSupervisor",eg="RemoveSupervisor",tg="AndThen",ns={_tag:Qd},ai=(t,e)=>({_tag:tg,first:t,second:e}),Q1=(t,e)=>X1(e,Ct(t)),X1=(t,e)=>{let n=t,r=e;for(;pr(r);){const s=mr(r);switch(s._tag){case Qd:{r=On(r);break}case Xd:{n=n.zip(s.supervisor),r=On(r);break}case eg:{n=Fa(n,s.supervisor),r=On(r);break}case tg:{r=Ht(s.first)(Ht(s.second)(On(r)));break}}}return n},Fa=(t,e)=>ae(t,e)?Gc:Zd(t)?Fa(t.left,e).zip(Fa(t.right,e)):t,Fi=t=>ae(t,Gc)?Dn():Zd(t)?w(Fi(t.left),ls(Fi(t.right))):dc(t),ew=(t,e)=>{if(ae(t,e))return ns;const n=Fi(t),r=Fi(e),s=w(r,Cl(n),xi(ns,(o,c)=>ai(o,{_tag:Xd,supervisor:c}))),i=w(n,Cl(r),xi(ns,(o,c)=>ai(o,{_tag:eg,supervisor:c})));return ai(s,i)},tw=Z1({empty:ns,patch:Q1,combine:ai,diff:ew}),nw=ho("effect_fiber_started",{incremental:!0}),pu=ho("effect_fiber_active"),rw=ho("effect_fiber_successes",{incremental:!0}),sw=ho("effect_fiber_failures",{incremental:!0}),iw=V1(z1("effect_fiber_lifetimes",DS({start:.5,factor:2,count:35})),"time_unit","milliseconds"),Vr="Continue",ow="Done",mu="Yield",aw={_E:t=>t,_A:t=>t},Js=t=>{throw new Error(`BUG: FiberRuntime - ${cr(t)} - please report an issue at https://github.com/Effect-TS/effect/issues`)},rn=Symbol.for("effect/internal/fiberRuntime/YieldedOp"),sn=ke("effect/internal/fiberRuntime/yieldedOpChannel",()=>({currentOp:null})),Hr={[pi]:(t,e,n)=>_t(()=>e.effect_instruction_i1(n)),OnStep:(t,e,n)=>it(it(n)),[mi]:(t,e,n)=>_t(()=>e.effect_instruction_i2(n)),[Za]:(t,e,n)=>(t.patchRuntimeFlags(t.currentRuntimeFlags,e.patch),bn(t.currentRuntimeFlags)&&t.isInterrupted()?Ue(t.getInterruptedCause()):it(n)),[_i]:(t,e,n)=>(_t(()=>e.effect_instruction_i2(n)),_t(()=>e.effect_instruction_i0())?(t.pushStack(e),_t(()=>e.effect_instruction_i1())):Qt),[Xr]:(t,e,n)=>{for(;;){const r=_t(()=>e.effect_instruction_i0.next(n));if(r.done)return it(r.value);const s=em(r.value);if(lo(s)){if(s._tag==="Failure")return s}else return t.pushStack(e),s;n=s.value}}},cw={[Uc]:(t,e,n,r)=>(t.processNewInterruptSignal(r.cause),bn(e)?Ue(r.cause):n),[zc]:(t,e,n,r)=>{throw new Error("It is illegal to have multiple concurrent run loops in a single fiber")},[qc]:(t,e,n,r)=>(r.onFiber(t,Id(e)),n),[Vc]:(t,e,n,r)=>X(Tc(),()=>n)},lw=t=>io(cy(t),e=>$n(xy(e),([n,r])=>{const s=new Map,i=[];for(const c of r){i.push(Fn(c));for(const a of c)s.set(a.request,a)}const o=i.flat();return ao(Cw(n.runAll(i),o,()=>o.forEach(c=>{c.listeners.interrupted=!0})),Nd,s)},!1,!1)),uw=Qa();class fw extends dx{[wS]=IS;[CS]=aw;_fiberRefs;_fiberId;_queue=new Array;_children=null;_observers=new Array;_running=!1;_stack=[];_asyncInterruptor=null;_asyncBlockingOn=null;_exitValue=null;_steps=[];_isYielding=!1;currentRuntimeFlags;currentOpCount=0;currentSupervisor;currentScheduler;currentTracer;currentSpan;currentContext;currentDefaultServices;constructor(e,n,r){if(super(),this.currentRuntimeFlags=r,this._fiberId=e,this._fiberRefs=n,Al(r)){const s=this.getFiberRef(_a);nw.unsafeUpdate(1,s),pu.unsafeUpdate(1,s)}this.refreshRefCache()}commit(){return Pd(this)}id(){return this._fiberId}resume(e){this.tell(Zn(e))}get status(){return this.ask((e,n)=>n)}get runtimeFlags(){return this.ask((e,n)=>Dx(n)?e.currentRuntimeFlags:n.runtimeFlags)}scope(){return xS(this)}get children(){return this.ask(e=>Array.from(e.getChildren()))}getChildren(){return this._children===null&&(this._children=new Set),this._children}getInterruptedCause(){return this.getFiberRef(Hs)}fiberRefs(){return this.ask(e=>e.getFiberRefs())}ask(e){return Xe(()=>{const n=B0(this._fiberId);return this.tell(oi((r,s)=>{sd(n,Q(()=>e(r,s)))})),rd(n)})}tell(e){this._queue.push(e),this._running||(this._running=!0,this.drainQueueLaterOnExecutor())}get await(){return qn(e=>{const n=r=>e(Re(r));return this.tell(oi((r,s)=>{r._exitValue!==null?n(this._exitValue):r.addObserver(n)})),Q(()=>this.tell(oi((r,s)=>{r.removeObserver(n)})))},this.id())}get inheritAll(){return Rt((e,n)=>{const r=e.id(),s=e.getFiberRefs(),i=n.runtimeFlags,o=this.getFiberRefs(),c=Jk(s,r,o);e.setFiberRefs(c);const a=e.getFiberRef(ku),u=w(si(i,a),Fl(Ts),Fl(ga));return a0(u)})}get poll(){return Q(()=>ec(this._exitValue))}unsafePoll(){return this._exitValue}interruptAsFork(e){return Q(()=>this.tell(qo(vn(e))))}unsafeInterruptAsFork(e){this.tell(qo(vn(e)))}addObserver(e){this._exitValue!==null?e(this._exitValue):this._observers.push(e)}removeObserver(e){this._observers=this._observers.filter(n=>n!==e)}getFiberRefs(){return this.setFiberRef(ku,this.currentRuntimeFlags),this._fiberRefs}unsafeDeleteFiberRef(e){this._fiberRefs=_d(this._fiberRefs,e)}getFiberRef(e){return this._fiberRefs.locals.has(e)?this._fiberRefs.locals.get(e)[0][1]:e.initial}setFiberRef(e,n){this._fiberRefs=va(this._fiberRefs,{fiberId:this._fiberId,fiberRef:e,value:n}),this.refreshRefCache()}refreshRefCache(){this.currentDefaultServices=this.getFiberRef(Ri),this.currentTracer=this.currentDefaultServices.unsafeMap.get(pd.key),this.currentSupervisor=this.getFiberRef(Tw),this.currentScheduler=this.getFiberRef(_S),this.currentContext=this.getFiberRef(co),this.currentSpan=this.currentContext.unsafeMap.get(md.key)}setFiberRefs(e){this._fiberRefs=e,this.refreshRefCache()}addChild(e){this.getChildren().add(e)}removeChild(e){this.getChildren().delete(e)}transferChildren(e){const n=this._children;if(this._children=null,n!==null&&n.size>0)for(const r of n)r._exitValue===null&&e.add(this.currentRuntimeFlags,r)}drainQueueOnCurrentThread(){let e=!0;for(;e;){let n=Vr;const r=globalThis[Tn];globalThis[Tn]=this;try{for(;n===Vr;)n=this._queue.length===0?ow:this.evaluateMessageWhileSuspended(this._queue.splice(0,1)[0])}finally{this._running=!1,globalThis[Tn]=r}this._queue.length>0&&!this._running?(this._running=!0,n===mu?(this.drainQueueLaterOnExecutor(),e=!1):e=!0):e=!1}}drainQueueLaterOnExecutor(){this.currentScheduler.scheduleTask(this.run,this.getFiberRef(Oc))}drainQueueWhileRunning(e,n){let r=n;for(;this._queue.length>0;){const s=this._queue.splice(0,1)[0];r=cw[s._tag](this,e,r,s)}return r}isInterrupted(){return!Ty(this.getFiberRef(Hs))}addInterruptedCause(e){const n=this.getFiberRef(Hs);this.setFiberRef(Hs,Pt(n,e))}processNewInterruptSignal(e){this.addInterruptedCause(e),this.sendInterruptSignalToAllChildren()}sendInterruptSignalToAllChildren(){if(this._children===null||this._children.size===0)return!1;let e=!1;for(const n of this._children)n.tell(qo(vn(this.id()))),e=!0;return e}interruptAllChildren(){if(this.sendInterruptSignalToAllChildren()){const e=this._children.values();this._children=null;let n=!1;return Ic({while:()=>!n,body:()=>{const s=e.next();return s.done?Q(()=>{n=!0}):so(s.value.await)},step:()=>{}})}return null}reportExitValue(e){if(Al(this.currentRuntimeFlags)){const n=this.getFiberRef(_a),r=this.id().startTimeMillis,s=Date.now();switch(iw.unsafeUpdate(s-r,n),pu.unsafeUpdate(-1,n),e._tag){case Vt:{rw.unsafeUpdate(1,n);break}case zt:{sw.unsafeUpdate(1,n);break}}}if(e._tag==="Failure"){const n=this.getFiberRef(M0);!vc(e.cause)&&n._tag==="Some"&&this.log("Fiber terminated with an unhandled error",e.cause,n)}}setExitValue(e){this._exitValue=e,this.reportExitValue(e);for(let n=this._observers.length-1;n>=0;n--)this._observers[n](e);this._observers=[]}getLoggers(){return this.getFiberRef(mw)}log(e,n,r){const s=Zt(r)?r.value:this.getFiberRef(T0),i=this.getFiberRef(hw);if(cx(i,s))return;const o=this.getFiberRef(C0),c=this.getFiberRef(I0),a=this.getLoggers(),u=this.getFiberRefs();if(ah(a)>0){const f=Lf(this.getFiberRef(Ri),Nc),d=new Date(f.unsafeCurrentTimeMillis());im(u,()=>{for(const h of a)h.log({fiberId:this.id(),logLevel:s,message:e,cause:n,context:u,spans:o,annotations:c,date:d})})}}evaluateMessageWhileSuspended(e){switch(e._tag){case Vc:return mu;case Uc:return this.processNewInterruptSignal(e.cause),this._asyncInterruptor!==null&&(this._asyncInterruptor(Ue(e.cause)),this._asyncInterruptor=null),Vr;case zc:return this._asyncInterruptor=null,this._asyncBlockingOn=null,this.evaluateEffect(e.effect),Vr;case qc:return e.onFiber(this,this._exitValue!==null?jx:Lx(this.currentRuntimeFlags,this._asyncBlockingOn)),Vr;default:return Js(e)}}evaluateEffect(e){this.currentSupervisor.onResume(this);try{let n=bn(this.currentRuntimeFlags)&&this.isInterrupted()?Ue(this.getInterruptedCause()):e;for(;n!==null;){const r=n,s=this.runLoop(r);if(s===rn){const i=sn.currentOp;sn.currentOp=null,i._op===ei?ny(this.currentRuntimeFlags)?(this.tell(bS()),this.tell(Zn(Mn)),n=null):n=Mn:i._op===Qr&&(n=null)}else{this.currentRuntimeFlags=w(this.currentRuntimeFlags,ry(ga));const i=this.interruptAllChildren();i!==null?n=X(i,()=>s):(this._queue.length===0?this.setExitValue(s):this.tell(Zn(s)),n=null)}}}finally{this.currentSupervisor.onSuspend(this)}}start(e){if(this._running)this.tell(Zn(e));else{this._running=!0;const n=globalThis[Tn];globalThis[Tn]=this;try{this.evaluateEffect(e)}finally{this._running=!1,globalThis[Tn]=n,this._queue.length>0&&this.drainQueueLaterOnExecutor()}}}startFork(e){this.tell(Zn(e))}patchRuntimeFlags(e,n){const r=ii(e,n);return globalThis[Tn]=this,this.currentRuntimeFlags=r,r}initiateAsync(e,n){let r=!1;const s=i=>{r||(r=!0,this.tell(Zn(i)))};bn(e)&&(this._asyncInterruptor=s);try{n(s)}catch(i){s(Kt(un(i)))}}pushStack(e){this._stack.push(e),e._op==="OnStep"&&this._steps.push({refs:this.getFiberRefs(),flags:this.currentRuntimeFlags})}popStack(){const e=this._stack.pop();if(e)return e._op==="OnStep"&&this._steps.pop(),e}getNextSuccessCont(){let e=this.popStack();for(;e;){if(e._op!==No)return e;e=this.popStack()}}getNextFailCont(){let e=this.popStack();for(;e;){if(e._op!==pi&&e._op!==_i&&e._op!==Xr)return e;e=this.popStack()}}[am](e){return Q(()=>Df(this.currentContext,e))}Left(e){return dt(e.left)}None(e){return dt(new $0)}Right(e){return it(e.right)}Some(e){return it(e.value)}Micro(e){return Ti(n=>{let r=n;const s=dS(oS(e,this.currentContext));return s.addObserver(i=>{if(i._tag==="Success")return r(it(i.value));switch(i.cause._tag){case"Interrupt":return r(Ue(vn(vr)));case"Fail":return r(dt(i.cause.error));case"Die":return r(Bl(i.cause.defect))}}),Ti(i=>{r=o=>{i(Qt)},s.unsafeInterrupt()})})}[hf](e){const n=_t(()=>e.effect_instruction_i0()),r=this.getNextSuccessCont();return r!==void 0?(r._op in Hr||Js(r),Hr[r._op](this,r,n)):(sn.currentOp=it(n),rn)}[Vt](e){const n=e,r=this.getNextSuccessCont();return r!==void 0?(r._op in Hr||Js(r),Hr[r._op](this,r,n.effect_instruction_i0)):(sn.currentOp=n,rn)}[zt](e){const n=e.effect_instruction_i0,r=this.getNextFailCont();if(r!==void 0)switch(r._op){case No:case mi:return bn(this.currentRuntimeFlags)&&this.isInterrupted()?Ue(Pl(n)):_t(()=>r.effect_instruction_i1(n));case"OnStep":return bn(this.currentRuntimeFlags)&&this.isInterrupted()?Ue(Pl(n)):it(Ue(n));case Za:return this.patchRuntimeFlags(this.currentRuntimeFlags,r.patch),bn(this.currentRuntimeFlags)&&this.isInterrupted()?Ue(Pt(n,this.getInterruptedCause())):Ue(n);default:Js(r)}else return sn.currentOp=Ue(n),rn}[df](e){return _t(()=>e.effect_instruction_i0(this,Id(this.currentRuntimeFlags)))}Blocked(e){const n=this.getFiberRefs(),r=this.currentRuntimeFlags;if(this._steps.length>0){const s=[],i=this._steps[this._steps.length-1];let o=this.popStack();for(;o&&o._op!=="OnStep";)s.push(o),o=this.popStack();this.setFiberRefs(i.refs),this.currentRuntimeFlags=i.flags;const c=Cx(i.refs,n),a=si(i.flags,r);return it(Ph(e.effect_instruction_i0,Rt(u=>{for(;s.length>0;)u.pushStack(s.pop());return u.setFiberRefs(Rx(u.id(),u.getFiberRefs())(c)),u.currentRuntimeFlags=ii(a)(u.currentRuntimeFlags),e.effect_instruction_i1})))}return oo(s=>X(ng(Wy(e.effect_instruction_i0)),()=>s(e.effect_instruction_i1)))}RunBlocked(e){return lw(e.effect_instruction_i0)}[vs](e){const n=e.effect_instruction_i0,r=this.currentRuntimeFlags,s=ii(r,n);if(bn(s)&&this.isInterrupted())return Ue(this.getInterruptedCause());if(this.patchRuntimeFlags(this.currentRuntimeFlags,n),e.effect_instruction_i1){const i=si(s,r);return this.pushStack(new Yy(i,e)),_t(()=>e.effect_instruction_i1(r))}else return Mn}[pi](e){return this.pushStack(e),e.effect_instruction_i0}OnStep(e){return this.pushStack(e),e.effect_instruction_i0}[No](e){return this.pushStack(e),e.effect_instruction_i0}[mi](e){return this.pushStack(e),e.effect_instruction_i0}[Qr](e){return this._asyncBlockingOn=e.effect_instruction_i1,this.initiateAsync(this.currentRuntimeFlags,e.effect_instruction_i0),sn.currentOp=e,rn}[ei](e){return this._isYielding=!1,sn.currentOp=e,rn}[_i](e){const n=e.effect_instruction_i0,r=e.effect_instruction_i1;return n()?(this.pushStack(e),r()):Mn}[Xr](e){return Hr[Xr](this,e,void 0)}[Vi](e){return _t(()=>e.commit())}runLoop(e){let n=e;for(this.currentOpCount=0;;){if((this.currentRuntimeFlags&Xv)!==0&&this.currentSupervisor.onEffect(this,n),this._queue.length>0&&(n=this.drainQueueWhileRunning(this.currentRuntimeFlags,n)),!this._isYielding){this.currentOpCount+=1;const r=this.currentScheduler.shouldYield(this);if(r!==!1){this._isYielding=!0,this.currentOpCount=0;const s=n;n=X(Tc({priority:r}),()=>s)}}try{if(n=this.currentTracer.context(()=>{if(uw!==n[Tr]._V){const r=this.getFiberRef(A0);if(r._tag==="Some"){const s=n[Tr]._V;this.log(`Executing an Effect versioned ${s} with a Runtime of version ${Qa()}, you may want to dedupe the effect dependencies, you can use the language service plugin to detect this at compile time: https://github.com/Effect-TS/language-service`,Sr,r)}}return this[n._op](n)},this),n===rn){const r=sn.currentOp;return r._op===ei||r._op===Qr?rn:(sn.currentOp=null,r._op===Vt||r._op===zt?r:Ue(un(r)))}}catch(r){n!==rn&&!ce(n,"_op")||!(n._op in this)?n=Xy(`Not a valid effect: ${cr(n)}`):P0(r)?n=Ue(Pt(un(r),vn(vr))):n=Bl(r)}}}run=()=>{this.drainQueueOnCurrentThread()}}const hw=ke("effect/FiberRef/currentMinimumLogLevel",()=>It(lx("Info"))),dw=t=>Hc(e=>{const n=Qk(e.context,Ri);Lf(n,gd).unsafe.log(t.log(e))}),gw=ke(Symbol.for("effect/Logger/defaultLogger"),()=>dw(FS)),pw=ke(Symbol.for("effect/Logger/tracerLogger"),()=>Hc(({annotations:t,cause:e,context:n,fiberId:r,logLevel:s,message:i})=>{const o=xs(ps(n,co),md);if(o._tag==="None"||o.value._tag==="ExternalSpan")return;const c=Df(ps(n,Ri),Nc),a={};for(const[u,f]of t)a[u]=f;a["effect.fiberId"]=Db(r),a["effect.logLevel"]=s.label,e!==null&&e._tag!=="Empty"&&(a["effect.cause"]=no(e,{renderErrorCause:!0})),o.value.event(cr(Array.isArray(i)&&i.length===1?i[0]:i),c.unsafeCurrentTimeNanos(),a)})),mw=ke(Symbol.for("effect/FiberRef/currentLoggers"),()=>k0(dc(gw,pw))),_w=t=>{if(Array.isArray(t)||sf(t))return[t,te()];const e=Object.keys(t),n=e.length;return[e.map(r=>t[r]),ge(r=>{const s={};for(let i=0;i<n;i++)s[e[i]]=r[i];return s})]},bw=(t,e,n)=>{const r=[];for(const s of t)r.push(ds(s));return X(ms(r,je,{concurrency:n?.concurrency,batching:n?.batching,concurrentFinalizers:n?.concurrentFinalizers}),s=>{const i=te(),o=s.length,c=new Array(o),a=new Array(o);let u=!1;for(let f=0;f<o;f++){const d=s[f];d._tag==="Left"?(c[f]=ge(d.left),u=!0):(a[f]=d.right,c[f]=i)}return u?e._tag==="Some"?dt(e.value(c)):dt(c):n?.discard?Qt:e._tag==="Some"?Re(e.value(a)):Re(a)})},vw=(t,e,n)=>{const r=[];for(const s of t)r.push(ds(s));return n?.discard?ms(r,je,{concurrency:n?.concurrency,batching:n?.batching,discard:!0,concurrentFinalizers:n?.concurrentFinalizers}):bt(ms(r,je,{concurrency:n?.concurrency,batching:n?.batching,concurrentFinalizers:n?.concurrentFinalizers}),s=>e._tag==="Some"?e.value(s):s)},yw=(t,e)=>{const[n,r]=_w(t);return e?.mode==="validate"?bw(n,r,e):e?.mode==="either"?vw(n,r,e):e?.discard!==!0&&r._tag==="Some"?bt(ms(n,je,e),r.value):ms(n,je,e)},ms=b(t=>sf(t[0]),(t,e,n)=>Rt(r=>{const s=n?.batching===!0||n?.batching==="inherit"&&r.getFiberRef(O0);return n?.discard?uu(n.concurrency,()=>Qn(ka,n?.concurrentFinalizers)(i=>s?$n(t,(o,c)=>i(e(o,c)),!0,!1,1):io(t,(o,c)=>i(e(o,c)))),()=>Qn(xa,n?.concurrentFinalizers)(i=>$n(t,(o,c)=>i(e(o,c)),s,!1)),i=>Qn(Sa(i),n?.concurrentFinalizers)(o=>$n(t,(c,a)=>o(e(c,a)),s,!1,i))):uu(n?.concurrency,()=>Qn(ka,n?.concurrentFinalizers)(i=>s?_u(t,1,(o,c)=>i(e(o,c)),!0):yn(t,(o,c)=>i(e(o,c)))),()=>Qn(xa,n?.concurrentFinalizers)(i=>kw(t,(o,c)=>i(e(o,c)),s)),i=>Qn(Sa(i),n?.concurrentFinalizers)(o=>_u(t,i,(c,a)=>o(e(c,a)),s)))})),kw=(t,e,n)=>Xe(()=>{const r=Ze(t),s=new Array(r.length);return Cc($n(r,(o,c)=>X(e(o,c),a=>Q(()=>s[c]=a)),n,!1),Re(s))}),$n=(t,e,n,r,s)=>oo(i=>o0(o=>Rt(c=>{let a=Array.from(t).reverse(),u=a.length;if(u===0)return Qt;let f=0,d=!1;const h=s?Math.min(a.length,s):a.length,p=new Set,g=new Array,x=()=>p.forEach(S=>{S.currentScheduler.scheduleTask(()=>{S.unsafeInterruptAsFork(c.id())},0)}),m=new Array,k=new Array,j=new Array,q=()=>{const S=g.filter(({exit:N})=>N._tag==="Failure").sort((N,I)=>N.index<I.index?-1:N.index===I.index?0:1).map(({exit:N})=>N);return S.length===0&&S.push(Mn),S},C=(S,N=!1)=>{const I=Kh(o(S)),T=Sw(I,c,c.currentRuntimeFlags,Fd);return c.currentScheduler.scheduleTask(()=>{N&&T.unsafeInterruptAsFork(c.id()),T.resume(I)},0),T},F=()=>{r||(u-=a.length,a=[]),d=!0,x()},P=n?r0:Bh,M=C(qn(S=>{const N=(T,U)=>{T._op==="Blocked"?j.push(T):(g.push({index:U,exit:T}),T._op==="Failure"&&!d&&F())},I=()=>{if(a.length>0){const T=a.pop();let U=f++;const le=()=>{const O=a.pop();return U=f++,X(Tc(),()=>X(P(i(e(O,U))),fe))},fe=O=>a.length>0&&(N(O,U),a.length>0)?le():Re(O),Ne=X(P(i(e(T,U))),fe),L=C(Ne);m.push(L),p.add(L),d&&L.currentScheduler.scheduleTask(()=>{L.unsafeInterruptAsFork(c.id())},0),L.addObserver(O=>{let Ee;if(O._op==="Failure"?Ee=O:Ee=O.effect_instruction_i0,k.push(L),p.delete(L),N(Ee,U),g.length===u)S(Re(jn(Hl(q(),{parallel:!0}),()=>Mn)));else if(j.length+g.length===u){const De=q(),We=j.map(Ie=>Ie.effect_instruction_i0).reduce(Th);S(Re(Ph(We,$n([jn(Hl(De,{parallel:!0}),()=>Mn),...j.map(Ie=>Ie.effect_instruction_i1)],Ie=>Ie,n,!0,s))))}else I()})}};for(let T=0;T<h;T++)I()}));return so(Vh(Uh(i(Pd(M))),nd({onFailure:S=>{F();const N=j.length+1,I=Math.min(typeof s=="number"?s:j.length,j.length),T=Array.from(j);return qn(U=>{let le=0,fe=0;const Ne=(O,Ee)=>De=>{le++,le===N&&U(it(Ue(S))),T.length>0&&Ee&&L()},L=()=>{C(T.pop(),!0).addObserver(Ne(fe,!0)),fe++};M.addObserver(Ne(fe,!1)),fe++;for(let O=0;O<I;O++)L()})},onSuccess:()=>yn(k,S=>S.inheritAll)})))}))),_u=(t,e,n,r)=>Xe(()=>{const s=Ze(t),i=new Array(s.length);return Cc($n(s,(c,a)=>bt(n(c,a),u=>i[a]=u),r,!1,e),Re(i))}),ng=t=>ww(t,Fd),xw=(t,e,n,r=null)=>{const s=rg(t,e,n,r);return s.resume(t),s},Sw=(t,e,n,r=null)=>rg(t,e,n,r),rg=(t,e,n,r=null)=>{const s=Bb(),i=e.getFiberRefs(),o=Gk(i,s),c=new fw(s,o,n),a=ps(o,co),u=c.currentSupervisor;return u.onStart(a,t,ge(e),c),c.addObserver(d=>u.onEnd(d,c)),(r!==null?r:w(e.getFiberRef(ba),jn(()=>e.scope()))).add(n,c),c},ww=(t,e)=>Rt((n,r)=>Re(xw(t,n,r.runtimeFlags,e))),bu=t=>Os(e=>Kn(xs(e,Fs),{onNone:()=>t,onSome:n=>{switch(n.strategy._tag){case"Parallel":return t;case"Sequential":case"ParallelN":return X(Mc(n,xa),r=>Wc(t,r))}}})),vu=t=>e=>Os(n=>Kn(xs(n,Fs),{onNone:()=>e,onSome:r=>r.strategy._tag==="ParallelN"&&r.strategy.parallelism===t?e:X(Mc(r,Sa(t)),s=>Wc(e,s))})),Qn=(t,e)=>n=>Os(r=>Kn(xs(r,Fs),{onNone:()=>n(je),onSome:s=>{if(e===!0){const i=t._tag==="Parallel"?bu:t._tag==="Sequential"?yu:vu(t.parallelism);switch(s.strategy._tag){case"Parallel":return i(n(bu));case"Sequential":return i(n(yu));case"ParallelN":return i(n(vu(s.strategy.parallelism)))}}else return n(je)}})),yu=t=>Os(e=>Kn(xs(e,Fs),{onNone:()=>t,onSome:n=>{switch(n.strategy._tag){case"Sequential":return t;case"Parallel":case"ParallelN":return X(Mc(n,ka),r=>Wc(t,r))}}})),Fs=Jn("effect/Scope"),Wc=b(2,(t,e)=>H0(t,Bf(k_(Fs,e)))),Iw=t=>Fr(t,{differ:tw,fork:ns}),ku=S0(iy),Tw=Iw(Gc),Cw=(t,e,n)=>n0(r=>X(X(ng(qh(t)),s=>qn(i=>{const o=e.map(u=>u.listeners.count),c=()=>{o.every(u=>u===0)&&e.every(u=>u.result.state.current._tag==="Pending"?!0:!!(u.result.state.current._tag==="Done"&&lo(u.result.state.current.effect)&&u.result.state.current.effect._tag==="Failure"&&Cy(u.result.state.current.effect.cause)))&&(a.forEach(u=>u()),n?.(),i(u0(s)))};s.addObserver(u=>{a.forEach(f=>f()),i(u)});const a=e.map((u,f)=>{const d=h=>{o[f]=h,c()};return u.listeners.addObserver(d),()=>u.listeners.removeObserver(d)});return c(),Q(()=>{a.forEach(u=>u())})})),()=>Xe(()=>{const s=e.flatMap(i=>i.state.completed?[]:[i]);return io(s,i=>J1(i.request,j0(r)))}))),Rw=yw,xu=l0,zo=yx;var Ew={},Ow={debug:(t,...e)=>console.debug(`[DEBUG] ${t}`,...e),info:(t,...e)=>console.info(`[INFO] ${t}`,...e),warn:(t,...e)=>console.warn(`[WARN] ${t}`,...e),error:(t,...e)=>console.error(`[ERROR] ${t}`,...e)},Gs=Ow,Mw=t=>({debug:(e,...n)=>Gs.debug(`[${t}] ${e}`,...n),info:(e,...n)=>Gs.info(`[${t}] ${e}`,...n),warn:(e,...n)=>Gs.warn(`[${t}] ${e}`,...n),error:(e,...n)=>Gs.error(`[${t}] ${e}`,...n)}),sg=Mw("paths"),ig=()=>Ew.CLAUDE_SESSIONS_DIR||(void 0)((void 0)(),".claude","projects"),Aw=t=>{const e=t.split(`
|
|
24
|
-
`).filter(n=>n.trim());for(const n of e)try{const r=JSON.parse(n);if(r?.cwd)return r.cwd}catch{}return null},Nw=t=>t.endsWith(".jsonl")&&!t.startsWith("agent-"),Su=(t,e)=>{const n=t.replace(/\\/g,"/"),r=e.replace(/\\/g,"/");return n===r?"~":n.startsWith(r+"/")?"~"+n.slice(r.length):t},Fw=t=>{const e=t.match(/^([A-Za-z])--/);if(e){const n=e[1],r=t.slice(3);return n+":\\"+r.replace(/--/g,"\\.").replace(/-/g,"\\")}return t.replace(/^-/,"/").replace(/--/g,"/.").replace(/-/g,"/")},og=t=>{const e=r=>[...r].map(s=>s.charCodeAt(0)<=127?s:"-").join(""),n=t.match(/^([A-Za-z]):[/\\]/);if(n){const r=n[1].toLowerCase(),s=t.slice(3);return r+"--"+e(s).replace(/[/\\]\./g,"--").replace(/[/\\]/g,"-").replace(/\./g,"-")}return e(t).replace(/^\//g,"-").replace(/\/\./g,"--").replace(/\//g,"-").replace(/\./g,"-")},Pw=(t,e=tf,n=sg)=>{const r=(void 0)(t);try{const s=e.readFileSync(t,"utf-8"),i=Aw(s);if(i===null){const o=s.split(`
|
|
25
|
-
`).filter(c=>c.trim());return o.length===0?n.debug(`tryGetCwdFromFile: ${r} -> empty file`):n.debug(`tryGetCwdFromFile: ${r} -> no cwd found in ${o.length} lines`),null}return i}catch(s){return n.warn(`tryGetCwdFromFile: ${r} -> read error: ${s}`),null}},$w=(t,e=ig(),n=tf,r=sg)=>{const s=(void 0)(e,t);try{const i=n.readdirSync(s).filter(Nw),o=[];for(const a of i){const u=Pw((void 0)(s,a),n,r);u!==null&&o.push(u)}const c=o.find(a=>og(a)===t);return c||(o.length>0?r.warn(`getRealPathFromSession: ${t} -> no match, cwds found: ${o.join(", ")}`):r.warn(`getRealPathFromSession: ${t} -> no valid cwd in any session`),null)}catch{return null}},jw=t=>{const e=(void 0)(),n=$w(t);if(n)return Su(n,e);const r=Fw(t);return Su(r,e)},Lw=(t,e,n,r=60,s="Untitled")=>t||(e?e.length>r?e.slice(0,r-3)+"...":e:n&&n!=="Untitled"?n:s),Dw=(t,e)=>{if(!e)return t;const n=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),r=new RegExp(`${n}(?=[/\\\\]|$)`,"g");return t.replace(r,"~")},Bw=(t,e={})=>{const{currentProjectName:n,homeDir:r,filterEmpty:s=!0}=e,i=s?t.filter(c=>c.sessionCount>0):t,o=r?og(r):null;return i.sort((c,a)=>{if(n){if(c.name===n)return-1;if(a.name===n)return 1}if(o){const u=c.name.startsWith(o),f=a.name.startsWith(o);if(u&&!f)return-1;if(!u&&f)return 1}return c.displayName.localeCompare(a.displayName)})};xu(function*(){const t=ig();if(!(yield*zo(()=>(void 0)(t).then(()=>!0).catch(()=>!1))))return[];const n=yield*zo(()=>(void 0)(t,{withFileTypes:!0}));return yield*Rw(n.filter(s=>s.isDirectory()&&!s.name.startsWith(".")).map(s=>xu(function*(){const i=(void 0)(t,s.name),c=(yield*zo(()=>(void 0)(i))).filter(a=>a.endsWith(".jsonl")&&!a.startsWith("agent-"));return{name:s.name,displayName:jw(s.name),path:i,sessionCount:c.length}})),{concurrency:10})});const Yc=hp({version:"",homeDir:"",currentProjectName:""}),Zc=(t,e)=>{const n=e??dp(Yc).homeDir;return n?Dw(t,n):t.replace(/(?:\/Users\/[^/\s]+|C:\\Users\\[^\\\s]+)(?=[/\\]|(?=\s|$|[)"'\]}>,:;]))/g,"~")};fp(Yc,t=>e=>Zc(e,t.homeDir));var Uw=E('<div class="fixed inset-0 bg-black/50 flex items-center justify-center z-50" role="dialog" aria-modal="true"><div class="bg-gh-bg-secondary border border-gh-border rounded-lg p-6 w-[380px] shadow-xl text-gh-text"><h2 class="text-lg font-semibold mb-3"> </h2> <p class="text-sm text-gh-text-secondary mb-6 whitespace-pre-wrap"> </p> <div class="flex gap-2 justify-end"><button class="px-4 py-2 text-sm rounded-md border border-gh-border hover:bg-gh-border-subtle"> </button> <button> </button></div></div></div>');function TT(t,e){dn(e,!0);let n=Je(e,"confirmText",3,"Confirm"),r=Je(e,"cancelText",3,"Cancel"),s=Je(e,"variant",3,"default");const i=u=>{u.key==="Escape"&&e.onCancel(),u.key==="Enter"&&e.onConfirm()};var o=ue(),c=ee(o);{var a=u=>{var f=Uw();f.__click=F=>F.target===F.currentTarget&&e.onCancel(),f.__keydown=i;var d=v(f),h=v(d),p=v(h,!0);_(h);var g=R(h,2),x=v(g,!0);_(g);var m=R(g,2),k=v(m);k.__click=function(...F){e.onCancel?.apply(this,F)};var j=v(k,!0);_(k);var q=R(k,2);q.__click=function(...F){e.onConfirm?.apply(this,F)};var C=v(q,!0);_(q),_(m),_(d),_(f),B(()=>{A(p,e.title),A(x,e.message),A(j,r()),$e(q,1,`px-4 py-2 text-sm rounded-md ${s()==="danger"?"bg-gh-red text-white hover:bg-red-700":"bg-gh-accent text-white hover:bg-blue-700"}`),A(C,n())}),y(u,f)};$(c,u=>{e.show&&u(a)})}y(t,o),gn()}Jt(["click","keydown"]);var qw=E('<label class="block text-sm text-gh-text-secondary mb-2"> </label>'),zw=E('<div class="fixed inset-0 bg-black/50 flex items-center justify-center z-50" role="dialog" aria-modal="true"><div class="bg-gh-bg-secondary border border-gh-border rounded-lg p-6 w-[400px] shadow-xl text-gh-text"><h2 class="text-lg font-semibold mb-4"> </h2> <!> <input type="text" class="w-full px-3 py-2 text-sm rounded-md border border-gh-border bg-gh-bg focus:outline-none focus:border-gh-accent"/> <div class="flex gap-2 justify-end mt-6"><button class="px-4 py-2 text-sm rounded-md border border-gh-border hover:bg-gh-border-subtle"> </button> <button class="px-4 py-2 text-sm rounded-md bg-gh-accent text-white hover:bg-blue-700"> </button></div></div></div>');function CT(t,e){dn(e,!0);let n=Je(e,"label",3,""),r=Je(e,"placeholder",3,""),s=Je(e,"initialValue",3,""),i=Je(e,"confirmText",3,"Save"),o=Je(e,"cancelText",3,"Cancel"),c=et(fi(s())),a=et(void 0);tr(()=>{e.show&&(K(c,s()),qu().then(()=>{l(a)?.focus(),l(a)?.select()}))});const u=()=>{e.onConfirm(l(c).trim())},f=g=>{g.key==="Escape"&&e.onCancel(),g.key==="Enter"&&u()};var d=ue(),h=ee(d);{var p=g=>{var x=zw();x.__click=T=>T.target===T.currentTarget&&e.onCancel(),x.__keydown=f;var m=v(x),k=v(m),j=v(k,!0);_(k);var q=R(k,2);{var C=T=>{var U=qw(),le=v(U,!0);_(U),B(()=>A(le,n())),y(T,U)};$(q,T=>{n()&&T(C)})}var F=R(q,2);Qu(F),qa(F,T=>K(a,T),()=>l(a));var P=R(F,2),M=v(P);M.__click=function(...T){e.onCancel?.apply(this,T)};var S=v(M,!0);_(M);var N=R(M,2);N.__click=u;var I=v(N,!0);_(N),_(P),_(m),_(x),B(()=>{A(j,e.title),Ae(F,"placeholder",r()),A(S,o()),A(I,i())}),Mp(F,()=>l(c),T=>K(c,T)),y(g,x)};$(h,g=>{e.show&&g(p)})}y(t,d),gn()}Jt(["click","keydown"]);function Qc(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var Gn=Qc();function ag(t){Gn=t}var rs={exec:()=>null};function ye(t,e=""){let n=typeof t=="string"?t:t.source,r={replace:(s,i)=>{let o=typeof i=="string"?i:i.source;return o=o.replace(vt.caret,"$1"),n=n.replace(s,o),r},getRegex:()=>new RegExp(n,e)};return r}var Vw=(()=>{try{return!!new RegExp("(?<=1)(?<!1)")}catch{return!1}})(),vt={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceTabs:/^\t+/,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] +\S/,listReplaceTask:/^\[[ xX]\] +/,listTaskCheckbox:/\[[ xX]\]/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,unescapeTest:/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:t=>new RegExp(`^( {0,3}${t})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),hrRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}#`),htmlBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}<(?:[a-z].*>|!--)`,"i")},Hw=/^(?:[ \t]*(?:\n|$))+/,Kw=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,Jw=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,Ps=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,Gw=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,Xc=/(?:[*+-]|\d{1,9}[.)])/,cg=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,lg=ye(cg).replace(/bull/g,Xc).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),Ww=ye(cg).replace(/bull/g,Xc).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),el=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,Yw=/^[^\n]+/,tl=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,Zw=ye(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",tl).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),Qw=ye(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,Xc).getRegex(),_o="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",nl=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,Xw=ye("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",nl).replace("tag",_o).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),ug=ye(el).replace("hr",Ps).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",_o).getRegex(),e2=ye(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",ug).getRegex(),rl={blockquote:e2,code:Kw,def:Zw,fences:Jw,heading:Gw,hr:Ps,html:Xw,lheading:lg,list:Qw,newline:Hw,paragraph:ug,table:rs,text:Yw},wu=ye("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",Ps).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",_o).getRegex(),t2={...rl,lheading:Ww,table:wu,paragraph:ye(el).replace("hr",Ps).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",wu).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",_o).getRegex()},n2={...rl,html:ye(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",nl).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:rs,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:ye(el).replace("hr",Ps).replace("heading",` *#{1,6} *[^
|
|
26
|
-
]`).replace("lheading",lg).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},r2=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,s2=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,fg=/^( {2,}|\\)\n(?!\s*$)/,i2=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,bo=/[\p{P}\p{S}]/u,sl=/[\s\p{P}\p{S}]/u,hg=/[^\s\p{P}\p{S}]/u,o2=ye(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,sl).getRegex(),dg=/(?!~)[\p{P}\p{S}]/u,a2=/(?!~)[\s\p{P}\p{S}]/u,c2=/(?:[^\s\p{P}\p{S}]|~)/u,l2=ye(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",Vw?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),gg=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,u2=ye(gg,"u").replace(/punct/g,bo).getRegex(),f2=ye(gg,"u").replace(/punct/g,dg).getRegex(),pg="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",h2=ye(pg,"gu").replace(/notPunctSpace/g,hg).replace(/punctSpace/g,sl).replace(/punct/g,bo).getRegex(),d2=ye(pg,"gu").replace(/notPunctSpace/g,c2).replace(/punctSpace/g,a2).replace(/punct/g,dg).getRegex(),g2=ye("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,hg).replace(/punctSpace/g,sl).replace(/punct/g,bo).getRegex(),p2=ye(/\\(punct)/,"gu").replace(/punct/g,bo).getRegex(),m2=ye(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),_2=ye(nl).replace("(?:-->|$)","-->").getRegex(),b2=ye("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",_2).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),Pi=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+[^`]*?`+(?!`)|[^\[\]\\`])*?/,v2=ye(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label",Pi).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),mg=ye(/^!?\[(label)\]\[(ref)\]/).replace("label",Pi).replace("ref",tl).getRegex(),_g=ye(/^!?\[(ref)\](?:\[\])?/).replace("ref",tl).getRegex(),y2=ye("reflink|nolink(?!\\()","g").replace("reflink",mg).replace("nolink",_g).getRegex(),Iu=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,il={_backpedal:rs,anyPunctuation:p2,autolink:m2,blockSkip:l2,br:fg,code:s2,del:rs,emStrongLDelim:u2,emStrongRDelimAst:h2,emStrongRDelimUnd:g2,escape:r2,link:v2,nolink:_g,punctuation:o2,reflink:mg,reflinkSearch:y2,tag:b2,text:i2,url:rs},k2={...il,link:ye(/^!?\[(label)\]\((.*?)\)/).replace("label",Pi).getRegex(),reflink:ye(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",Pi).getRegex()},Pa={...il,emStrongRDelimAst:d2,emStrongLDelim:f2,url:ye(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",Iu).replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:ye(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol",Iu).getRegex()},x2={...Pa,br:ye(fg).replace("{2,}","*").getRegex(),text:ye(Pa.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},Ws={normal:rl,gfm:t2,pedantic:n2},Kr={normal:il,gfm:Pa,breaks:x2,pedantic:k2},S2={"&":"&","<":"<",">":">",'"':""","'":"'"},Tu=t=>S2[t];function on(t,e){if(e){if(vt.escapeTest.test(t))return t.replace(vt.escapeReplace,Tu)}else if(vt.escapeTestNoEncode.test(t))return t.replace(vt.escapeReplaceNoEncode,Tu);return t}function Cu(t){try{t=encodeURI(t).replace(vt.percentDecode,"%")}catch{return null}return t}function Ru(t,e){let n=t.replace(vt.findPipe,(i,o,c)=>{let a=!1,u=o;for(;--u>=0&&c[u]==="\\";)a=!a;return a?"|":" |"}),r=n.split(vt.splitPipe),s=0;if(r[0].trim()||r.shift(),r.length>0&&!r.at(-1)?.trim()&&r.pop(),e)if(r.length>e)r.splice(e);else for(;r.length<e;)r.push("");for(;s<r.length;s++)r[s]=r[s].trim().replace(vt.slashPipe,"|");return r}function Jr(t,e,n){let r=t.length;if(r===0)return"";let s=0;for(;s<r&&t.charAt(r-s-1)===e;)s++;return t.slice(0,r-s)}function w2(t,e){if(t.indexOf(e[1])===-1)return-1;let n=0;for(let r=0;r<t.length;r++)if(t[r]==="\\")r++;else if(t[r]===e[0])n++;else if(t[r]===e[1]&&(n--,n<0))return r;return n>0?-2:-1}function Eu(t,e,n,r,s){let i=e.href,o=e.title||null,c=t[1].replace(s.other.outputLinkReplace,"$1");r.state.inLink=!0;let a={type:t[0].charAt(0)==="!"?"image":"link",raw:n,href:i,title:o,text:c,tokens:r.inlineTokens(c)};return r.state.inLink=!1,a}function I2(t,e,n){let r=t.match(n.other.indentCodeCompensation);if(r===null)return e;let s=r[1];return e.split(`
|
|
27
|
-
`).map(i=>{let o=i.match(n.other.beginningSpace);if(o===null)return i;let[c]=o;return c.length>=s.length?i.slice(s.length):i}).join(`
|
|
28
|
-
`)}var $i=class{options;rules;lexer;constructor(t){this.options=t||Gn}space(t){let e=this.rules.block.newline.exec(t);if(e&&e[0].length>0)return{type:"space",raw:e[0]}}code(t){let e=this.rules.block.code.exec(t);if(e){let n=e[0].replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:e[0],codeBlockStyle:"indented",text:this.options.pedantic?n:Jr(n,`
|
|
29
|
-
`)}}}fences(t){let e=this.rules.block.fences.exec(t);if(e){let n=e[0],r=I2(n,e[3]||"",this.rules);return{type:"code",raw:n,lang:e[2]?e[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):e[2],text:r}}}heading(t){let e=this.rules.block.heading.exec(t);if(e){let n=e[2].trim();if(this.rules.other.endingHash.test(n)){let r=Jr(n,"#");(this.options.pedantic||!r||this.rules.other.endingSpaceChar.test(r))&&(n=r.trim())}return{type:"heading",raw:e[0],depth:e[1].length,text:n,tokens:this.lexer.inline(n)}}}hr(t){let e=this.rules.block.hr.exec(t);if(e)return{type:"hr",raw:Jr(e[0],`
|
|
30
|
-
`)}}blockquote(t){let e=this.rules.block.blockquote.exec(t);if(e){let n=Jr(e[0],`
|
|
31
|
-
`).split(`
|
|
32
|
-
`),r="",s="",i=[];for(;n.length>0;){let o=!1,c=[],a;for(a=0;a<n.length;a++)if(this.rules.other.blockquoteStart.test(n[a]))c.push(n[a]),o=!0;else if(!o)c.push(n[a]);else break;n=n.slice(a);let u=c.join(`
|
|
33
|
-
`),f=u.replace(this.rules.other.blockquoteSetextReplace,`
|
|
34
|
-
$1`).replace(this.rules.other.blockquoteSetextReplace2,"");r=r?`${r}
|
|
35
|
-
${u}`:u,s=s?`${s}
|
|
36
|
-
${f}`:f;let d=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(f,i,!0),this.lexer.state.top=d,n.length===0)break;let h=i.at(-1);if(h?.type==="code")break;if(h?.type==="blockquote"){let p=h,g=p.raw+`
|
|
37
|
-
`+n.join(`
|
|
38
|
-
`),x=this.blockquote(g);i[i.length-1]=x,r=r.substring(0,r.length-p.raw.length)+x.raw,s=s.substring(0,s.length-p.text.length)+x.text;break}else if(h?.type==="list"){let p=h,g=p.raw+`
|
|
39
|
-
`+n.join(`
|
|
40
|
-
`),x=this.list(g);i[i.length-1]=x,r=r.substring(0,r.length-h.raw.length)+x.raw,s=s.substring(0,s.length-p.raw.length)+x.raw,n=g.substring(i.at(-1).raw.length).split(`
|
|
41
|
-
`);continue}}return{type:"blockquote",raw:r,tokens:i,text:s}}}list(t){let e=this.rules.block.list.exec(t);if(e){let n=e[1].trim(),r=n.length>1,s={type:"list",raw:"",ordered:r,start:r?+n.slice(0,-1):"",loose:!1,items:[]};n=r?`\\d{1,9}\\${n.slice(-1)}`:`\\${n}`,this.options.pedantic&&(n=r?n:"[*+-]");let i=this.rules.other.listItemRegex(n),o=!1;for(;t;){let a=!1,u="",f="";if(!(e=i.exec(t))||this.rules.block.hr.test(t))break;u=e[0],t=t.substring(u.length);let d=e[2].split(`
|
|
42
|
-
`,1)[0].replace(this.rules.other.listReplaceTabs,x=>" ".repeat(3*x.length)),h=t.split(`
|
|
43
|
-
`,1)[0],p=!d.trim(),g=0;if(this.options.pedantic?(g=2,f=d.trimStart()):p?g=e[1].length+1:(g=e[2].search(this.rules.other.nonSpaceChar),g=g>4?1:g,f=d.slice(g),g+=e[1].length),p&&this.rules.other.blankLine.test(h)&&(u+=h+`
|
|
44
|
-
`,t=t.substring(h.length+1),a=!0),!a){let x=this.rules.other.nextBulletRegex(g),m=this.rules.other.hrRegex(g),k=this.rules.other.fencesBeginRegex(g),j=this.rules.other.headingBeginRegex(g),q=this.rules.other.htmlBeginRegex(g);for(;t;){let C=t.split(`
|
|
45
|
-
`,1)[0],F;if(h=C,this.options.pedantic?(h=h.replace(this.rules.other.listReplaceNesting," "),F=h):F=h.replace(this.rules.other.tabCharGlobal," "),k.test(h)||j.test(h)||q.test(h)||x.test(h)||m.test(h))break;if(F.search(this.rules.other.nonSpaceChar)>=g||!h.trim())f+=`
|
|
46
|
-
`+F.slice(g);else{if(p||d.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||k.test(d)||j.test(d)||m.test(d))break;f+=`
|
|
47
|
-
`+h}!p&&!h.trim()&&(p=!0),u+=C+`
|
|
48
|
-
`,t=t.substring(C.length+1),d=F.slice(g)}}s.loose||(o?s.loose=!0:this.rules.other.doubleBlankLine.test(u)&&(o=!0)),s.items.push({type:"list_item",raw:u,task:!!this.options.gfm&&this.rules.other.listIsTask.test(f),loose:!1,text:f,tokens:[]}),s.raw+=u}let c=s.items.at(-1);if(c)c.raw=c.raw.trimEnd(),c.text=c.text.trimEnd();else return;s.raw=s.raw.trimEnd();for(let a of s.items){if(this.lexer.state.top=!1,a.tokens=this.lexer.blockTokens(a.text,[]),a.task){if(a.text=a.text.replace(this.rules.other.listReplaceTask,""),a.tokens[0]?.type==="text"||a.tokens[0]?.type==="paragraph"){a.tokens[0].raw=a.tokens[0].raw.replace(this.rules.other.listReplaceTask,""),a.tokens[0].text=a.tokens[0].text.replace(this.rules.other.listReplaceTask,"");for(let f=this.lexer.inlineQueue.length-1;f>=0;f--)if(this.rules.other.listIsTask.test(this.lexer.inlineQueue[f].src)){this.lexer.inlineQueue[f].src=this.lexer.inlineQueue[f].src.replace(this.rules.other.listReplaceTask,"");break}}let u=this.rules.other.listTaskCheckbox.exec(a.raw);if(u){let f={type:"checkbox",raw:u[0]+" ",checked:u[0]!=="[ ]"};a.checked=f.checked,s.loose?a.tokens[0]&&["paragraph","text"].includes(a.tokens[0].type)&&"tokens"in a.tokens[0]&&a.tokens[0].tokens?(a.tokens[0].raw=f.raw+a.tokens[0].raw,a.tokens[0].text=f.raw+a.tokens[0].text,a.tokens[0].tokens.unshift(f)):a.tokens.unshift({type:"paragraph",raw:f.raw,text:f.raw,tokens:[f]}):a.tokens.unshift(f)}}if(!s.loose){let u=a.tokens.filter(d=>d.type==="space"),f=u.length>0&&u.some(d=>this.rules.other.anyLine.test(d.raw));s.loose=f}}if(s.loose)for(let a of s.items){a.loose=!0;for(let u of a.tokens)u.type==="text"&&(u.type="paragraph")}return s}}html(t){let e=this.rules.block.html.exec(t);if(e)return{type:"html",block:!0,raw:e[0],pre:e[1]==="pre"||e[1]==="script"||e[1]==="style",text:e[0]}}def(t){let e=this.rules.block.def.exec(t);if(e){let n=e[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal," "),r=e[2]?e[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",s=e[3]?e[3].substring(1,e[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):e[3];return{type:"def",tag:n,raw:e[0],href:r,title:s}}}table(t){let e=this.rules.block.table.exec(t);if(!e||!this.rules.other.tableDelimiter.test(e[2]))return;let n=Ru(e[1]),r=e[2].replace(this.rules.other.tableAlignChars,"").split("|"),s=e[3]?.trim()?e[3].replace(this.rules.other.tableRowBlankLine,"").split(`
|
|
49
|
-
`):[],i={type:"table",raw:e[0],header:[],align:[],rows:[]};if(n.length===r.length){for(let o of r)this.rules.other.tableAlignRight.test(o)?i.align.push("right"):this.rules.other.tableAlignCenter.test(o)?i.align.push("center"):this.rules.other.tableAlignLeft.test(o)?i.align.push("left"):i.align.push(null);for(let o=0;o<n.length;o++)i.header.push({text:n[o],tokens:this.lexer.inline(n[o]),header:!0,align:i.align[o]});for(let o of s)i.rows.push(Ru(o,i.header.length).map((c,a)=>({text:c,tokens:this.lexer.inline(c),header:!1,align:i.align[a]})));return i}}lheading(t){let e=this.rules.block.lheading.exec(t);if(e)return{type:"heading",raw:e[0],depth:e[2].charAt(0)==="="?1:2,text:e[1],tokens:this.lexer.inline(e[1])}}paragraph(t){let e=this.rules.block.paragraph.exec(t);if(e){let n=e[1].charAt(e[1].length-1)===`
|
|
50
|
-
`?e[1].slice(0,-1):e[1];return{type:"paragraph",raw:e[0],text:n,tokens:this.lexer.inline(n)}}}text(t){let e=this.rules.block.text.exec(t);if(e)return{type:"text",raw:e[0],text:e[0],tokens:this.lexer.inline(e[0])}}escape(t){let e=this.rules.inline.escape.exec(t);if(e)return{type:"escape",raw:e[0],text:e[1]}}tag(t){let e=this.rules.inline.tag.exec(t);if(e)return!this.lexer.state.inLink&&this.rules.other.startATag.test(e[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(e[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(e[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(e[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:e[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:e[0]}}link(t){let e=this.rules.inline.link.exec(t);if(e){let n=e[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(n)){if(!this.rules.other.endAngleBracket.test(n))return;let i=Jr(n.slice(0,-1),"\\");if((n.length-i.length)%2===0)return}else{let i=w2(e[2],"()");if(i===-2)return;if(i>-1){let o=(e[0].indexOf("!")===0?5:4)+e[1].length+i;e[2]=e[2].substring(0,i),e[0]=e[0].substring(0,o).trim(),e[3]=""}}let r=e[2],s="";if(this.options.pedantic){let i=this.rules.other.pedanticHrefTitle.exec(r);i&&(r=i[1],s=i[3])}else s=e[3]?e[3].slice(1,-1):"";return r=r.trim(),this.rules.other.startAngleBracket.test(r)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(n)?r=r.slice(1):r=r.slice(1,-1)),Eu(e,{href:r&&r.replace(this.rules.inline.anyPunctuation,"$1"),title:s&&s.replace(this.rules.inline.anyPunctuation,"$1")},e[0],this.lexer,this.rules)}}reflink(t,e){let n;if((n=this.rules.inline.reflink.exec(t))||(n=this.rules.inline.nolink.exec(t))){let r=(n[2]||n[1]).replace(this.rules.other.multipleSpaceGlobal," "),s=e[r.toLowerCase()];if(!s){let i=n[0].charAt(0);return{type:"text",raw:i,text:i}}return Eu(n,s,n[0],this.lexer,this.rules)}}emStrong(t,e,n=""){let r=this.rules.inline.emStrongLDelim.exec(t);if(!(!r||r[3]&&n.match(this.rules.other.unicodeAlphaNumeric))&&(!(r[1]||r[2])||!n||this.rules.inline.punctuation.exec(n))){let s=[...r[0]].length-1,i,o,c=s,a=0,u=r[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(u.lastIndex=0,e=e.slice(-1*t.length+s);(r=u.exec(e))!=null;){if(i=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!i)continue;if(o=[...i].length,r[3]||r[4]){c+=o;continue}else if((r[5]||r[6])&&s%3&&!((s+o)%3)){a+=o;continue}if(c-=o,c>0)continue;o=Math.min(o,o+c+a);let f=[...r[0]][0].length,d=t.slice(0,s+r.index+f+o);if(Math.min(s,o)%2){let p=d.slice(1,-1);return{type:"em",raw:d,text:p,tokens:this.lexer.inlineTokens(p)}}let h=d.slice(2,-2);return{type:"strong",raw:d,text:h,tokens:this.lexer.inlineTokens(h)}}}}codespan(t){let e=this.rules.inline.code.exec(t);if(e){let n=e[2].replace(this.rules.other.newLineCharGlobal," "),r=this.rules.other.nonSpaceChar.test(n),s=this.rules.other.startingSpaceChar.test(n)&&this.rules.other.endingSpaceChar.test(n);return r&&s&&(n=n.substring(1,n.length-1)),{type:"codespan",raw:e[0],text:n}}}br(t){let e=this.rules.inline.br.exec(t);if(e)return{type:"br",raw:e[0]}}del(t){let e=this.rules.inline.del.exec(t);if(e)return{type:"del",raw:e[0],text:e[2],tokens:this.lexer.inlineTokens(e[2])}}autolink(t){let e=this.rules.inline.autolink.exec(t);if(e){let n,r;return e[2]==="@"?(n=e[1],r="mailto:"+n):(n=e[1],r=n),{type:"link",raw:e[0],text:n,href:r,tokens:[{type:"text",raw:n,text:n}]}}}url(t){let e;if(e=this.rules.inline.url.exec(t)){let n,r;if(e[2]==="@")n=e[0],r="mailto:"+n;else{let s;do s=e[0],e[0]=this.rules.inline._backpedal.exec(e[0])?.[0]??"";while(s!==e[0]);n=e[0],e[1]==="www."?r="http://"+e[0]:r=e[0]}return{type:"link",raw:e[0],text:n,href:r,tokens:[{type:"text",raw:n,text:n}]}}}inlineText(t){let e=this.rules.inline.text.exec(t);if(e){let n=this.lexer.state.inRawBlock;return{type:"text",raw:e[0],text:e[0],escaped:n}}}},Lt=class $a{tokens;options;state;inlineQueue;tokenizer;constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||Gn,this.options.tokenizer=this.options.tokenizer||new $i,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};let n={other:vt,block:Ws.normal,inline:Kr.normal};this.options.pedantic?(n.block=Ws.pedantic,n.inline=Kr.pedantic):this.options.gfm&&(n.block=Ws.gfm,this.options.breaks?n.inline=Kr.breaks:n.inline=Kr.gfm),this.tokenizer.rules=n}static get rules(){return{block:Ws,inline:Kr}}static lex(e,n){return new $a(n).lex(e)}static lexInline(e,n){return new $a(n).inlineTokens(e)}lex(e){e=e.replace(vt.carriageReturn,`
|
|
51
|
-
`),this.blockTokens(e,this.tokens);for(let n=0;n<this.inlineQueue.length;n++){let r=this.inlineQueue[n];this.inlineTokens(r.src,r.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(e,n=[],r=!1){for(this.options.pedantic&&(e=e.replace(vt.tabCharGlobal," ").replace(vt.spaceLine,""));e;){let s;if(this.options.extensions?.block?.some(o=>(s=o.call({lexer:this},e,n))?(e=e.substring(s.raw.length),n.push(s),!0):!1))continue;if(s=this.tokenizer.space(e)){e=e.substring(s.raw.length);let o=n.at(-1);s.raw.length===1&&o!==void 0?o.raw+=`
|
|
52
|
-
`:n.push(s);continue}if(s=this.tokenizer.code(e)){e=e.substring(s.raw.length);let o=n.at(-1);o?.type==="paragraph"||o?.type==="text"?(o.raw+=(o.raw.endsWith(`
|
|
53
|
-
`)?"":`
|
|
54
|
-
`)+s.raw,o.text+=`
|
|
55
|
-
`+s.text,this.inlineQueue.at(-1).src=o.text):n.push(s);continue}if(s=this.tokenizer.fences(e)){e=e.substring(s.raw.length),n.push(s);continue}if(s=this.tokenizer.heading(e)){e=e.substring(s.raw.length),n.push(s);continue}if(s=this.tokenizer.hr(e)){e=e.substring(s.raw.length),n.push(s);continue}if(s=this.tokenizer.blockquote(e)){e=e.substring(s.raw.length),n.push(s);continue}if(s=this.tokenizer.list(e)){e=e.substring(s.raw.length),n.push(s);continue}if(s=this.tokenizer.html(e)){e=e.substring(s.raw.length),n.push(s);continue}if(s=this.tokenizer.def(e)){e=e.substring(s.raw.length);let o=n.at(-1);o?.type==="paragraph"||o?.type==="text"?(o.raw+=(o.raw.endsWith(`
|
|
56
|
-
`)?"":`
|
|
57
|
-
`)+s.raw,o.text+=`
|
|
58
|
-
`+s.raw,this.inlineQueue.at(-1).src=o.text):this.tokens.links[s.tag]||(this.tokens.links[s.tag]={href:s.href,title:s.title},n.push(s));continue}if(s=this.tokenizer.table(e)){e=e.substring(s.raw.length),n.push(s);continue}if(s=this.tokenizer.lheading(e)){e=e.substring(s.raw.length),n.push(s);continue}let i=e;if(this.options.extensions?.startBlock){let o=1/0,c=e.slice(1),a;this.options.extensions.startBlock.forEach(u=>{a=u.call({lexer:this},c),typeof a=="number"&&a>=0&&(o=Math.min(o,a))}),o<1/0&&o>=0&&(i=e.substring(0,o+1))}if(this.state.top&&(s=this.tokenizer.paragraph(i))){let o=n.at(-1);r&&o?.type==="paragraph"?(o.raw+=(o.raw.endsWith(`
|
|
59
|
-
`)?"":`
|
|
60
|
-
`)+s.raw,o.text+=`
|
|
61
|
-
`+s.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=o.text):n.push(s),r=i.length!==e.length,e=e.substring(s.raw.length);continue}if(s=this.tokenizer.text(e)){e=e.substring(s.raw.length);let o=n.at(-1);o?.type==="text"?(o.raw+=(o.raw.endsWith(`
|
|
62
|
-
`)?"":`
|
|
63
|
-
`)+s.raw,o.text+=`
|
|
64
|
-
`+s.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=o.text):n.push(s);continue}if(e){let o="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(o);break}else throw new Error(o)}}return this.state.top=!0,n}inline(e,n=[]){return this.inlineQueue.push({src:e,tokens:n}),n}inlineTokens(e,n=[]){let r=e,s=null;if(this.tokens.links){let a=Object.keys(this.tokens.links);if(a.length>0)for(;(s=this.tokenizer.rules.inline.reflinkSearch.exec(r))!=null;)a.includes(s[0].slice(s[0].lastIndexOf("[")+1,-1))&&(r=r.slice(0,s.index)+"["+"a".repeat(s[0].length-2)+"]"+r.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(s=this.tokenizer.rules.inline.anyPunctuation.exec(r))!=null;)r=r.slice(0,s.index)+"++"+r.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);let i;for(;(s=this.tokenizer.rules.inline.blockSkip.exec(r))!=null;)i=s[2]?s[2].length:0,r=r.slice(0,s.index+i)+"["+"a".repeat(s[0].length-i-2)+"]"+r.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);r=this.options.hooks?.emStrongMask?.call({lexer:this},r)??r;let o=!1,c="";for(;e;){o||(c=""),o=!1;let a;if(this.options.extensions?.inline?.some(f=>(a=f.call({lexer:this},e,n))?(e=e.substring(a.raw.length),n.push(a),!0):!1))continue;if(a=this.tokenizer.escape(e)){e=e.substring(a.raw.length),n.push(a);continue}if(a=this.tokenizer.tag(e)){e=e.substring(a.raw.length),n.push(a);continue}if(a=this.tokenizer.link(e)){e=e.substring(a.raw.length),n.push(a);continue}if(a=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(a.raw.length);let f=n.at(-1);a.type==="text"&&f?.type==="text"?(f.raw+=a.raw,f.text+=a.text):n.push(a);continue}if(a=this.tokenizer.emStrong(e,r,c)){e=e.substring(a.raw.length),n.push(a);continue}if(a=this.tokenizer.codespan(e)){e=e.substring(a.raw.length),n.push(a);continue}if(a=this.tokenizer.br(e)){e=e.substring(a.raw.length),n.push(a);continue}if(a=this.tokenizer.del(e)){e=e.substring(a.raw.length),n.push(a);continue}if(a=this.tokenizer.autolink(e)){e=e.substring(a.raw.length),n.push(a);continue}if(!this.state.inLink&&(a=this.tokenizer.url(e))){e=e.substring(a.raw.length),n.push(a);continue}let u=e;if(this.options.extensions?.startInline){let f=1/0,d=e.slice(1),h;this.options.extensions.startInline.forEach(p=>{h=p.call({lexer:this},d),typeof h=="number"&&h>=0&&(f=Math.min(f,h))}),f<1/0&&f>=0&&(u=e.substring(0,f+1))}if(a=this.tokenizer.inlineText(u)){e=e.substring(a.raw.length),a.raw.slice(-1)!=="_"&&(c=a.raw.slice(-1)),o=!0;let f=n.at(-1);f?.type==="text"?(f.raw+=a.raw,f.text+=a.text):n.push(a);continue}if(e){let f="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(f);break}else throw new Error(f)}}return n}},ji=class{options;parser;constructor(t){this.options=t||Gn}space(t){return""}code({text:t,lang:e,escaped:n}){let r=(e||"").match(vt.notSpaceStart)?.[0],s=t.replace(vt.endingNewline,"")+`
|
|
65
|
-
`;return r?'<pre><code class="language-'+on(r)+'">'+(n?s:on(s,!0))+`</code></pre>
|
|
66
|
-
`:"<pre><code>"+(n?s:on(s,!0))+`</code></pre>
|
|
67
|
-
`}blockquote({tokens:t}){return`<blockquote>
|
|
68
|
-
${this.parser.parse(t)}</blockquote>
|
|
69
|
-
`}html({text:t}){return t}def(t){return""}heading({tokens:t,depth:e}){return`<h${e}>${this.parser.parseInline(t)}</h${e}>
|
|
70
|
-
`}hr(t){return`<hr>
|
|
71
|
-
`}list(t){let e=t.ordered,n=t.start,r="";for(let o=0;o<t.items.length;o++){let c=t.items[o];r+=this.listitem(c)}let s=e?"ol":"ul",i=e&&n!==1?' start="'+n+'"':"";return"<"+s+i+`>
|
|
72
|
-
`+r+"</"+s+`>
|
|
73
|
-
`}listitem(t){return`<li>${this.parser.parse(t.tokens)}</li>
|
|
74
|
-
`}checkbox({checked:t}){return"<input "+(t?'checked="" ':"")+'disabled="" type="checkbox"> '}paragraph({tokens:t}){return`<p>${this.parser.parseInline(t)}</p>
|
|
75
|
-
`}table(t){let e="",n="";for(let s=0;s<t.header.length;s++)n+=this.tablecell(t.header[s]);e+=this.tablerow({text:n});let r="";for(let s=0;s<t.rows.length;s++){let i=t.rows[s];n="";for(let o=0;o<i.length;o++)n+=this.tablecell(i[o]);r+=this.tablerow({text:n})}return r&&(r=`<tbody>${r}</tbody>`),`<table>
|
|
76
|
-
<thead>
|
|
77
|
-
`+e+`</thead>
|
|
78
|
-
`+r+`</table>
|
|
79
|
-
`}tablerow({text:t}){return`<tr>
|
|
80
|
-
${t}</tr>
|
|
81
|
-
`}tablecell(t){let e=this.parser.parseInline(t.tokens),n=t.header?"th":"td";return(t.align?`<${n} align="${t.align}">`:`<${n}>`)+e+`</${n}>
|
|
82
|
-
`}strong({tokens:t}){return`<strong>${this.parser.parseInline(t)}</strong>`}em({tokens:t}){return`<em>${this.parser.parseInline(t)}</em>`}codespan({text:t}){return`<code>${on(t,!0)}</code>`}br(t){return"<br>"}del({tokens:t}){return`<del>${this.parser.parseInline(t)}</del>`}link({href:t,title:e,tokens:n}){let r=this.parser.parseInline(n),s=Cu(t);if(s===null)return r;t=s;let i='<a href="'+t+'"';return e&&(i+=' title="'+on(e)+'"'),i+=">"+r+"</a>",i}image({href:t,title:e,text:n,tokens:r}){r&&(n=this.parser.parseInline(r,this.parser.textRenderer));let s=Cu(t);if(s===null)return on(n);t=s;let i=`<img src="${t}" alt="${n}"`;return e&&(i+=` title="${on(e)}"`),i+=">",i}text(t){return"tokens"in t&&t.tokens?this.parser.parseInline(t.tokens):"escaped"in t&&t.escaped?t.text:on(t.text)}},ol=class{strong({text:t}){return t}em({text:t}){return t}codespan({text:t}){return t}del({text:t}){return t}html({text:t}){return t}text({text:t}){return t}link({text:t}){return""+t}image({text:t}){return""+t}br(){return""}checkbox({raw:t}){return t}},Dt=class ja{options;renderer;textRenderer;constructor(e){this.options=e||Gn,this.options.renderer=this.options.renderer||new ji,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new ol}static parse(e,n){return new ja(n).parse(e)}static parseInline(e,n){return new ja(n).parseInline(e)}parse(e){let n="";for(let r=0;r<e.length;r++){let s=e[r];if(this.options.extensions?.renderers?.[s.type]){let o=s,c=this.options.extensions.renderers[o.type].call({parser:this},o);if(c!==!1||!["space","hr","heading","code","table","blockquote","list","html","def","paragraph","text"].includes(o.type)){n+=c||"";continue}}let i=s;switch(i.type){case"space":{n+=this.renderer.space(i);break}case"hr":{n+=this.renderer.hr(i);break}case"heading":{n+=this.renderer.heading(i);break}case"code":{n+=this.renderer.code(i);break}case"table":{n+=this.renderer.table(i);break}case"blockquote":{n+=this.renderer.blockquote(i);break}case"list":{n+=this.renderer.list(i);break}case"checkbox":{n+=this.renderer.checkbox(i);break}case"html":{n+=this.renderer.html(i);break}case"def":{n+=this.renderer.def(i);break}case"paragraph":{n+=this.renderer.paragraph(i);break}case"text":{n+=this.renderer.text(i);break}default:{let o='Token with "'+i.type+'" type was not found.';if(this.options.silent)return console.error(o),"";throw new Error(o)}}}return n}parseInline(e,n=this.renderer){let r="";for(let s=0;s<e.length;s++){let i=e[s];if(this.options.extensions?.renderers?.[i.type]){let c=this.options.extensions.renderers[i.type].call({parser:this},i);if(c!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(i.type)){r+=c||"";continue}}let o=i;switch(o.type){case"escape":{r+=n.text(o);break}case"html":{r+=n.html(o);break}case"link":{r+=n.link(o);break}case"image":{r+=n.image(o);break}case"checkbox":{r+=n.checkbox(o);break}case"strong":{r+=n.strong(o);break}case"em":{r+=n.em(o);break}case"codespan":{r+=n.codespan(o);break}case"br":{r+=n.br(o);break}case"del":{r+=n.del(o);break}case"text":{r+=n.text(o);break}default:{let c='Token with "'+o.type+'" type was not found.';if(this.options.silent)return console.error(c),"";throw new Error(c)}}}return r}},Yr=class{options;block;constructor(t){this.options=t||Gn}static passThroughHooks=new Set(["preprocess","postprocess","processAllTokens","emStrongMask"]);static passThroughHooksRespectAsync=new Set(["preprocess","postprocess","processAllTokens"]);preprocess(t){return t}postprocess(t){return t}processAllTokens(t){return t}emStrongMask(t){return t}provideLexer(){return this.block?Lt.lex:Lt.lexInline}provideParser(){return this.block?Dt.parse:Dt.parseInline}},T2=class{defaults=Qc();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=Dt;Renderer=ji;TextRenderer=ol;Lexer=Lt;Tokenizer=$i;Hooks=Yr;constructor(...t){this.use(...t)}walkTokens(t,e){let n=[];for(let r of t)switch(n=n.concat(e.call(this,r)),r.type){case"table":{let s=r;for(let i of s.header)n=n.concat(this.walkTokens(i.tokens,e));for(let i of s.rows)for(let o of i)n=n.concat(this.walkTokens(o.tokens,e));break}case"list":{let s=r;n=n.concat(this.walkTokens(s.items,e));break}default:{let s=r;this.defaults.extensions?.childTokens?.[s.type]?this.defaults.extensions.childTokens[s.type].forEach(i=>{let o=s[i].flat(1/0);n=n.concat(this.walkTokens(o,e))}):s.tokens&&(n=n.concat(this.walkTokens(s.tokens,e)))}}return n}use(...t){let e=this.defaults.extensions||{renderers:{},childTokens:{}};return t.forEach(n=>{let r={...n};if(r.async=this.defaults.async||r.async||!1,n.extensions&&(n.extensions.forEach(s=>{if(!s.name)throw new Error("extension name required");if("renderer"in s){let i=e.renderers[s.name];i?e.renderers[s.name]=function(...o){let c=s.renderer.apply(this,o);return c===!1&&(c=i.apply(this,o)),c}:e.renderers[s.name]=s.renderer}if("tokenizer"in s){if(!s.level||s.level!=="block"&&s.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");let i=e[s.level];i?i.unshift(s.tokenizer):e[s.level]=[s.tokenizer],s.start&&(s.level==="block"?e.startBlock?e.startBlock.push(s.start):e.startBlock=[s.start]:s.level==="inline"&&(e.startInline?e.startInline.push(s.start):e.startInline=[s.start]))}"childTokens"in s&&s.childTokens&&(e.childTokens[s.name]=s.childTokens)}),r.extensions=e),n.renderer){let s=this.defaults.renderer||new ji(this.defaults);for(let i in n.renderer){if(!(i in s))throw new Error(`renderer '${i}' does not exist`);if(["options","parser"].includes(i))continue;let o=i,c=n.renderer[o],a=s[o];s[o]=(...u)=>{let f=c.apply(s,u);return f===!1&&(f=a.apply(s,u)),f||""}}r.renderer=s}if(n.tokenizer){let s=this.defaults.tokenizer||new $i(this.defaults);for(let i in n.tokenizer){if(!(i in s))throw new Error(`tokenizer '${i}' does not exist`);if(["options","rules","lexer"].includes(i))continue;let o=i,c=n.tokenizer[o],a=s[o];s[o]=(...u)=>{let f=c.apply(s,u);return f===!1&&(f=a.apply(s,u)),f}}r.tokenizer=s}if(n.hooks){let s=this.defaults.hooks||new Yr;for(let i in n.hooks){if(!(i in s))throw new Error(`hook '${i}' does not exist`);if(["options","block"].includes(i))continue;let o=i,c=n.hooks[o],a=s[o];Yr.passThroughHooks.has(i)?s[o]=u=>{if(this.defaults.async&&Yr.passThroughHooksRespectAsync.has(i))return(async()=>{let d=await c.call(s,u);return a.call(s,d)})();let f=c.call(s,u);return a.call(s,f)}:s[o]=(...u)=>{if(this.defaults.async)return(async()=>{let d=await c.apply(s,u);return d===!1&&(d=await a.apply(s,u)),d})();let f=c.apply(s,u);return f===!1&&(f=a.apply(s,u)),f}}r.hooks=s}if(n.walkTokens){let s=this.defaults.walkTokens,i=n.walkTokens;r.walkTokens=function(o){let c=[];return c.push(i.call(this,o)),s&&(c=c.concat(s.call(this,o))),c}}this.defaults={...this.defaults,...r}}),this}setOptions(t){return this.defaults={...this.defaults,...t},this}lexer(t,e){return Lt.lex(t,e??this.defaults)}parser(t,e){return Dt.parse(t,e??this.defaults)}parseMarkdown(t){return(e,n)=>{let r={...n},s={...this.defaults,...r},i=this.onError(!!s.silent,!!s.async);if(this.defaults.async===!0&&r.async===!1)return i(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof e>"u"||e===null)return i(new Error("marked(): input parameter is undefined or null"));if(typeof e!="string")return i(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(e)+", string expected"));if(s.hooks&&(s.hooks.options=s,s.hooks.block=t),s.async)return(async()=>{let o=s.hooks?await s.hooks.preprocess(e):e,c=await(s.hooks?await s.hooks.provideLexer():t?Lt.lex:Lt.lexInline)(o,s),a=s.hooks?await s.hooks.processAllTokens(c):c;s.walkTokens&&await Promise.all(this.walkTokens(a,s.walkTokens));let u=await(s.hooks?await s.hooks.provideParser():t?Dt.parse:Dt.parseInline)(a,s);return s.hooks?await s.hooks.postprocess(u):u})().catch(i);try{s.hooks&&(e=s.hooks.preprocess(e));let o=(s.hooks?s.hooks.provideLexer():t?Lt.lex:Lt.lexInline)(e,s);s.hooks&&(o=s.hooks.processAllTokens(o)),s.walkTokens&&this.walkTokens(o,s.walkTokens);let c=(s.hooks?s.hooks.provideParser():t?Dt.parse:Dt.parseInline)(o,s);return s.hooks&&(c=s.hooks.postprocess(c)),c}catch(o){return i(o)}}}onError(t,e){return n=>{if(n.message+=`
|
|
83
|
-
Please report this to https://github.com/markedjs/marked.`,t){let r="<p>An error occurred:</p><pre>"+on(n.message+"",!0)+"</pre>";return e?Promise.resolve(r):r}if(e)return Promise.reject(n);throw n}}},Hn=new T2;function xe(t,e){return Hn.parse(t,e)}xe.options=xe.setOptions=function(t){return Hn.setOptions(t),xe.defaults=Hn.defaults,ag(xe.defaults),xe};xe.getDefaults=Qc;xe.defaults=Gn;xe.use=function(...t){return Hn.use(...t),xe.defaults=Hn.defaults,ag(xe.defaults),xe};xe.walkTokens=function(t,e){return Hn.walkTokens(t,e)};xe.parseInline=Hn.parseInline;xe.Parser=Dt;xe.parser=Dt.parse;xe.Renderer=ji;xe.TextRenderer=ol;xe.Lexer=Lt;xe.lexer=Lt.lex;xe.Tokenizer=$i;xe.Hooks=Yr;xe.parse=xe;xe.options;xe.setOptions;xe.use;xe.walkTokens;xe.parseInline;Dt.parse;Lt.lex;xe.setOptions({breaks:!0,gfm:!0});const Ys=t=>t?new Date(t).toLocaleString():"-",C2=(t,e)=>t.length>e?t.slice(0,e)+"...":t,R2=t=>Zc(t),ci=t=>Zc(t),ss=t=>typeof t=="string"?t:Array.isArray(t)?t.map(ss).join(""):t.type==="text"?t.text??"":t.type==="thinking"?"":t.type==="tool_result"?t.content?ss(t.content):"0":t.content?ss(t.content):"",Ou=t=>{let e="";if(t.summary)e=t.summary;else if(t.content)e=ss(t.content);else{const n=t.message;n?.content&&(e=ss(n.content))}return ci(e)},E2=t=>{const e=[],n=/<(ide_[^>]+)>([\s\S]*?)<\/\1>/g;let r=0,s;for(;(s=n.exec(t))!==null;){if(s.index>r){const i=t.slice(r,s.index).trim();i&&e.push({type:"text",content:i})}e.push({type:"ide_tag",tag:s[1],content:s[2].trim()}),r=n.lastIndex}if(r<t.length){const i=t.slice(r).trim();i&&e.push({type:"text",content:i})}return e};var O2=E('<pre class="whitespace-pre-wrap font-mono text-xs text-gh-text-secondary overflow-x-auto"><code> </code></pre>'),M2=E('<pre class="whitespace-pre-wrap font-mono text-xs text-gh-text-secondary overflow-x-auto"> </pre>'),A2=E('<button class="absolute bottom-1 left-1/2 -translate-x-1/2 px-3 py-1 text-xs bg-gh-border hover:bg-gh-border-muted rounded-full cursor-pointer border-none text-gh-text-secondary transition-all"> </button>'),N2=E('<div class="absolute bottom-0 left-0 right-0 h-8 bg-gradient-to-t from-gh-canvas to-transparent pointer-events-none"></div> <!>',1),F2=E('<button class="mt-2 px-3 py-1 text-xs bg-gh-border hover:bg-gh-border-muted rounded-full cursor-pointer border-none text-gh-text-secondary">Collapse</button>'),P2=E('<div class="relative"><!> <!></div>'),$2=E('<pre class="whitespace-pre-wrap font-mono text-xs text-gh-text-secondary overflow-x-auto"><code> </code></pre>'),j2=E('<pre class="whitespace-pre-wrap font-mono text-xs text-gh-text-secondary overflow-x-auto"> </pre>');function Zs(t,e){dn(e,!0);let n=Je(e,"maxLines",3,10),r=et(!1),s=et(!1);const i=V(()=>e.content.split(`
|
|
84
|
-
`)),o=V(()=>l(i).length>n()),c=V(()=>l(o)&&!l(r)?l(i).slice(0,n()).join(`
|
|
85
|
-
`):e.content);var a=ue(),u=ee(a);{var f=h=>{var p=P2(),g=v(p);{var x=C=>{var F=O2(),P=v(F),M=v(P,!0);_(P),_(F),B(()=>{$e(P,1,`language-${e.lang??""}`),A(M,l(c))}),y(C,F)},m=C=>{var F=M2(),P=v(F,!0);_(F),B(()=>A(P,l(c))),y(C,F)};$(g,C=>{e.lang?C(x):C(m,!1)})}var k=R(g,2);{var j=C=>{var F=N2(),P=R(ee(F),2);{var M=S=>{var N=A2();N.__click=()=>K(r,!0);var I=v(N);_(N),B(()=>A(I,`Click to expand (${l(i).length-n()} more lines)`)),y(S,N)};$(P,S=>{l(s)&&S(M)})}y(C,F)},q=C=>{var F=F2();F.__click=()=>K(r,!1),y(C,F)};$(k,C=>{l(r)?C(q,!1):C(j)})}_(p),En("mouseenter",p,()=>K(s,!0)),En("mouseleave",p,()=>K(s,!1)),y(h,p)},d=h=>{var p=ue(),g=ee(p);{var x=k=>{var j=$2(),q=v(j),C=v(q,!0);_(q),_(j),B(()=>{$e(q,1,`language-${e.lang??""}`),A(C,e.content)}),y(k,j)},m=k=>{var j=j2(),q=v(j,!0);_(j),B(()=>A(q,e.content)),y(k,j)};$(g,k=>{e.lang?k(x):k(m,!1)},!0)}y(h,p)};$(u,h=>{l(o)?h(f):h(d,!1)})}y(t,a),gn()}Jt(["click"]);var L2=E('<button class="font-mono hover:underline cursor-pointer bg-transparent border-none text-blue-400 p-0"> </button>'),D2=E('<span class="font-mono opacity-60"> </span>'),B2=E('<span class="font-mono"> </span>'),U2=E('<span class="opacity-60"> </span>'),q2=E('<div class="flex items-center gap-2 text-xs text-blue-400 bg-blue-900/20 rounded px-2 py-1"><span class="opacity-60">📂</span> <!></div>'),z2=E('<button class="font-mono hover:underline cursor-pointer bg-transparent border-none text-purple-400 p-0"> </button>'),V2=E('<span class="font-mono opacity-60"> </span>'),H2=E('<span class="font-mono"> </span>'),K2=E('<span class="font-mono"> </span>'),J2=E('<div class="text-xs text-purple-400 bg-purple-900/20 rounded px-2 py-1"><div class="flex items-center gap-2"><span class="opacity-60">✂️</span> <!></div></div>'),G2=E('<div class="text-xs text-yellow-400 bg-yellow-900/20 rounded px-2 py-1"><span class="opacity-60">⚠️</span> <span class="font-mono"> </span> <span class="opacity-60 ml-1"> </span></div>');function W2(t,e){dn(e,!0);const n=V(()=>{const u=e.content.match(/(?:opened the file |selected.*from )(\/[^\s]+)/);return u?u[1]:e.content.trim().startsWith("/")?e.content.trim().split(`
|
|
86
|
-
`)[0].split(" ")[0]:null}),r=V(()=>{const u=e.content.match(/lines? (\d+)(?:\s*to\s*(\d+))?/);return u?u[2]?`L${u[1]}-${u[2]}`:`L${u[1]}`:null}),s=async()=>{l(n)&&await Ha(l(n))};var i=ue(),o=ee(i);{var c=u=>{var f=q2(),d=R(v(f),2);{var h=g=>{var x=ue(),m=ee(x);Ko(m,()=>Go(l(n)),k=>{var j=B2(),q=v(j,!0);_(j),B(C=>A(q,C),[()=>l(n).split("/").pop()]),y(k,j)},(k,j)=>{var q=ue(),C=ee(q);{var F=M=>{var S=L2();S.__click=s;var N=v(S);_(S),B(I=>{Ae(S,"title",l(n)),A(N,`${I??""}${l(r)?`:${l(r)}`:""}`)},[()=>l(n).split("/").pop()]),y(M,S)},P=M=>{var S=D2(),N=v(S,!0);_(S),B(I=>{Ae(S,"title",l(n)),A(N,I)},[()=>l(n).split("/").pop()]),y(M,S)};$(C,M=>{l(j)?M(F):M(P,!1)})}y(k,q)}),y(g,x)},p=g=>{var x=U2(),m=v(x,!0);_(x),B(()=>A(m,e.content)),y(g,x)};$(d,g=>{l(n)?g(h):g(p,!1)})}_(f),y(u,f)},a=u=>{var f=ue(),d=ee(f);{var h=g=>{var x=J2(),m=v(x),k=R(v(m),2);{var j=C=>{var F=ue(),P=ee(F);Ko(P,()=>Go(l(n)),M=>{var S=H2(),N=v(S);_(S),B(I=>A(N,`${I??""}${l(r)?`:${l(r)}`:""}`),[()=>l(n).split("/").pop()]),y(M,S)},(M,S)=>{var N=ue(),I=ee(N);{var T=le=>{var fe=z2();fe.__click=s;var Ne=v(fe);_(fe),B(L=>{Ae(fe,"title",l(n)),A(Ne,`${L??""}${l(r)?`:${l(r)}`:""}`)},[()=>l(n).split("/").pop()]),y(le,fe)},U=le=>{var fe=V2(),Ne=v(fe);_(fe),B(L=>{Ae(fe,"title",l(n)),A(Ne,`${L??""}${l(r)?`:${l(r)}`:""}`)},[()=>l(n).split("/").pop()]),y(le,fe)};$(I,le=>{l(S)?le(T):le(U,!1)})}y(M,N)}),y(C,F)},q=C=>{var F=K2(),P=v(F,!0);_(F),B(M=>A(P,M),[()=>e.content.split(`
|
|
87
|
-
`)[0].slice(0,60)]),y(C,F)};$(k,C=>{l(n)?C(j):C(q,!1)})}_(m),_(x),y(g,x)},p=g=>{var x=G2(),m=R(v(x),2),k=v(m);_(m);var j=R(m,2),q=v(j);_(j),_(x),B(C=>{A(k,`<${e.tag??""}>`),A(q,`${C??""}${e.content.length>50?"...":""}`)},[()=>e.content.slice(0,50)]),y(g,x)};$(d,g=>{e.tag==="ide_selection"?g(h):g(p,!1)},!0)}y(u,f)};$(o,u=>{e.tag==="ide_opened_file"?u(c):u(a,!1)})}y(t,i),gn()}Jt(["click"]);var Y2=E('<li><span class="flex-shrink-0"> </span> <span> </span></li>'),Z2=E('<ul class="space-y-1.5 mt-1"></ul>');function Q2(t,e){const n=i=>{switch(i){case"completed":return"✅";case"in_progress":return"🔄";case"pending":return"⬜"}},r=i=>{switch(i){case"completed":return"text-gh-green";case"in_progress":return"text-gh-accent";case"pending":return"text-gh-text-secondary"}};var s=Z2();St(s,21,()=>e.todos,Ft,(i,o)=>{var c=Y2(),a=v(c),u=v(a,!0);_(a);var f=R(a,2),d=v(f,!0);_(f),_(c),B((h,p)=>{$e(c,1,`flex items-start gap-2 text-sm ${h??""}`),A(u,p),$e(f,1,za(l(o).status==="completed"?"line-through opacity-70":"")),A(d,l(o).status==="in_progress"?l(o).activeForm:l(o).content)},[()=>r(l(o).status),()=>n(l(o).status)]),y(i,c)}),_(s),y(t,s)}var X2=E('<span class="tooltip svelte-1yfjzin"> </span>'),eI=E("<button><!></button> <!>",1);function ar(t,e){let n=Je(e,"position",3,"bottom"),r=Je(e,"class",3,""),s=pp(e,["$$slots","$$events","$$legacy","title","children","position","class"]),i=et(null),o=et(!1),c=et("");const a=()=>{if(!l(i))return;const m=l(i).getBoundingClientRect(),k=m.left+m.width/2;n()==="top"?K(c,`left: ${k}px; bottom: ${window.innerHeight-m.top+8}px;`):K(c,`left: ${k}px; top: ${m.bottom+8}px;`)},u=()=>{a(),K(o,!0)},f=()=>{K(o,!1)};var d=eI(),h=ee(d);Op(h,()=>({class:`tooltip-btn ${r()??""}`,onmouseenter:u,onmouseleave:f,...s}),void 0,void 0,void 0,"svelte-1yfjzin");var p=v(h);Sp(p,()=>e.children),_(h),qa(h,m=>K(i,m),()=>l(i));var g=R(h,2);{var x=m=>{var k=X2(),j=v(k,!0);_(k),B(()=>{Gu(k,l(c)),A(j,e.title)}),y(m,k)};$(g,m=>{l(o)&&m(x)})}y(t,d)}var tI=E('<button class="text-gh-accent hover:underline cursor-pointer bg-transparent border-none p-0" title="Open backup in VS Code"> </button>'),nI=E('<span class="text-gh-text-secondary"> </span>'),rI=E('<li class="font-mono text-xs truncate"><!></li>'),sI=E('<div class="p-4 rounded-lg bg-amber-500/10 border-l-3 border-l-amber-500 group relative"><div class="flex justify-between mb-2 text-xs text-gh-text-secondary"><span class="uppercase font-semibold text-amber-400"> </span> <div class="flex items-center gap-2"><span> </span> <!> <!></div></div> <ul class="space-y-1"></ul></div>'),iI=E('<p class="mt-1 text-sm text-gh-text-secondary"> </p>'),oI=E('<div class="p-3 rounded-lg bg-cyan-500/10 border-l-3 border-l-cyan-500 group relative"><div class="flex justify-between items-center text-xs text-gh-text-secondary"><span class="font-semibold text-cyan-400"> </span> <div class="flex items-center gap-2"><span> </span> <!> <!></div></div> <!></div>'),aI=E('<button class="mt-1 text-sm text-gh-accent hover:underline cursor-pointer bg-transparent border-none p-0 font-mono truncate block max-w-full text-left"> </button>'),cI=E('<span class="mt-1 text-sm text-gh-text-secondary font-mono"> </span>'),lI=E('<span class="mt-1 text-sm text-gh-text-secondary font-mono"> </span>'),uI=E('<p class="mt-1 text-sm text-gh-text-secondary"> </p>'),fI=E("<!> <!>",1),hI=E(" <!>",1),dI=E('<div class="p-3 rounded-lg bg-violet-500/10 border-l-3 border-l-violet-500 group relative"><div class="flex justify-between items-center text-xs text-gh-text-secondary"><span class="font-semibold text-violet-400"> </span> <div class="flex items-center gap-2"><span> </span> <!> <!></div></div> <!></div>'),gI=E('<details class="text-gh-text-secondary"><summary class="cursor-pointer text-xs italic hover:text-gh-text select-none"> </summary> <p class="mt-1 whitespace-pre-wrap italic opacity-70"> </p></details>'),pI=E('<div class="message-content text-sm"></div>'),mI=E('<span class="font-semibold text-purple-400"> </span>'),_I=E('<p class="whitespace-pre-wrap"> </p>'),bI=E('<div class="message-content text-sm"><!></div>'),vI=E('<div><div class="flex justify-between text-xs text-gh-text-secondary"><span class="uppercase font-semibold"> </span> <div class="flex items-center gap-2"><span class="group-hover:hidden"> </span> <span class="hidden group-hover:inline font-mono text-gh-text-secondary/70"> </span> <!> <!> <!></div></div> <!> <!></div>');function Mu(t,e){dn(e,!0);const n=T=>{var U=ue(),le=ee(U);{var fe=Ne=>{ar(Ne,{class:"opacity-0 group-hover:opacity-100 transition-opacity p-1 rounded hover:bg-gh-accent/20 text-xs",onclick:()=>e.onSplit(e.msg),title:"Split session from this message",children:(L,O)=>{nr();var Ee=Bt("✂️");y(L,Ee)},$$slots:{default:!0}})};$(le,Ne=>{e.onSplit&&!s()&&e.msg.uuid&&Ne(fe)})}y(T,U)},r=T=>{ar(T,{class:"opacity-0 group-hover:opacity-100 transition-opacity p-1 rounded hover:bg-gh-red/20 text-xs",onclick:()=>e.onDelete(e.msg),title:"Delete message",children:(U,le)=>{nr();var fe=Bt("🗑️");y(U,fe)},$$slots:{default:!0}})};let s=Je(e,"isFirst",3,!1);const i=V(()=>e.msg.uuid??""),o=V(()=>e.msg.type==="assistant"),c=V(()=>e.msg.type==="custom-title"),a=V(()=>e.msg.type==="file-history-snapshot"),u=V(()=>e.msg.type==="human"||e.msg.type==="user"),f=V(()=>e.msg.type==="system"&&e.msg.subtype==="local_command"),d=V(()=>e.msg.type==="queue-operation"),h=V(()=>{if(e.msg.type!=="user")return!1;const T=e.msg.message;return Array.isArray(T?.content)?T.content[0]?.type==="tool_result":!1}),p=V(()=>{if(!l(a))return null;const T=e.msg.snapshot,U=T?.trackedFileBackups??{};return{files:Object.entries(U),timestamp:T?.timestamp}}),g=V(()=>{if(!l(f))return null;const T=typeof e.msg.content=="string"?e.msg.content:"",U=T.match(/<command-name>([^<]+)<\/command-name>/)?.[1]??"",le=T.match(/<command-message>([^<]+)<\/command-message>/)?.[1]??"";return{name:U,message:le}}),x=["Read","Write","Edit"],m=V(()=>{if(!l(o))return null;const T=e.msg.message;if(!Array.isArray(T?.content))return null;const U=T.content.find(le=>typeof le=="object"&&le!==null&&le.type==="tool_use");return U?{name:U.name,input:U.input,filePath:x.includes(U.name)?U.input.file_path:null}:null}),k=V(()=>{if(!l(o))return[];const T=e.msg.message;return Array.isArray(T?.content)?T.content.filter(U=>typeof U=="object"&&U!==null&&U.type==="thinking"):[]}),j=V(()=>e.msg.customTitle??""),q=V(()=>e.msg.uuid||e.msg.messageId||""),C=V(()=>{if(l(d))return!1;if(l(a)||l(f)||l(c)||l(m)||Ou(e.msg).trim().length>0)return!0;if(e.msg.type==="user"||e.msg.type==="human"){const U=l(h)?"Tool result":"User message";console.warn(`${U} without content:`,vp(e.msg))}return!1}),F=V(()=>l(C)||l(k).length>0),P=V(()=>l(u)?"bg-gh-accent/15 border-l-3 border-l-gh-accent":l(o)?"bg-gh-green/15 border-l-3 border-l-gh-green":l(c)?"bg-purple-500/15 border-l-3 border-l-purple-500":"bg-gh-border-subtle");var M=ue(),S=ee(M);{var N=T=>{},I=T=>{var U=ue(),le=ee(U);{var fe=L=>{var O=sI(),Ee=v(O),De=v(Ee),We=v(De);_(De);var Ie=R(De,2),ct=v(Ie),lt=v(ct,!0);_(ct);var Et=R(ct,2);n(Et);var D=R(Et,2);r(D),_(Ie),_(Ee);var H=R(Ee,2);St(H,21,()=>l(p).files,Ft,(J,Oe)=>{var se=V(()=>Hu(l(Oe),2));let G=()=>l(se)[0],pe=()=>l(se)[1];const ze=V(()=>!!(pe().backupFileName&&e.sessionId));var Se=rI(),_e=v(Se);{var he=Le=>{var W=tI();W.__click=()=>Pp(e.sessionId,pe().backupFileName);var Te=v(W,!0);_(W),B(we=>A(Te,we),[()=>ci(G())]),y(Le,W)},Me=Le=>{var W=nI(),Te=v(W,!0);_(W),B(we=>A(Te,we),[()=>ci(G())]),y(Le,W)};$(_e,Le=>{l(ze)?Le(he):Le(Me,!1)})}_(Se),B(Le=>Ae(Se,"title",Le),[()=>ci(G())]),y(J,Se)}),_(H),_(O),B(J=>{Ae(O,"data-msg-id",l(i)),A(We,`📁 File Backups (${l(p).files.length??""})`),A(lt,J)},[()=>Ys(l(p).timestamp)]),y(L,O)},Ne=L=>{var O=ue(),Ee=ee(O);{var De=Ie=>{var ct=oI(),lt=v(ct),Et=v(lt),D=v(Et);_(Et);var H=R(Et,2),J=v(H),Oe=v(J,!0);_(J);var se=R(J,2);n(se);var G=R(se,2);r(G),_(H),_(lt);var pe=R(lt,2);{var ze=Se=>{var _e=iI(),he=v(_e,!0);_(_e),B(()=>A(he,l(g).message)),y(Se,_e)};$(pe,Se=>{l(g).message&&l(g).message!==l(g).name?.slice(1)&&Se(ze)})}_(ct),B(Se=>{Ae(ct,"data-msg-id",l(i)),A(D,`⚡ ${(l(g).name||"Command")??""}`),A(Oe,Se)},[()=>Ys(e.msg.timestamp)]),y(Ie,ct)},We=Ie=>{var ct=ue(),lt=ee(ct);{var Et=H=>{var J=dI(),Oe=v(J),se=v(Oe),G=v(se);_(se);var pe=R(se,2),ze=v(pe),Se=v(ze,!0);_(ze);var _e=R(ze,2);n(_e);var he=R(_e,2);r(he),_(pe),_(Oe);var Me=R(Oe,2);{var Le=Te=>{var we=ue(),Ce=ee(we);Ko(Ce,()=>Go(l(m).filePath),gt=>{var rt=lI(),Y=v(rt,!0);_(rt),B(Be=>A(Y,Be),[()=>l(m).filePath.split("/").pop()]),y(gt,rt)},(gt,rt)=>{var Y=ue(),Be=ee(Y);{var ut=de=>{var Z=aI();Z.__click=()=>Ha(l(m).filePath);var Fe=v(Z,!0);_(Z),B(be=>{Ae(Z,"title",l(m).filePath),A(Fe,be)},[()=>l(m).filePath.split("/").pop()]),y(de,Z)},pt=de=>{var Z=cI(),Fe=v(Z,!0);_(Z),B(be=>{Ae(Z,"title",l(m).filePath),A(Fe,be)},[()=>l(m).filePath.split("/").pop()]),y(de,Z)};$(Be,de=>{l(rt)?de(ut):de(pt,!1)})}y(gt,Y)}),y(Te,we)},W=Te=>{var we=ue(),Ce=ee(we);{var gt=Y=>{var Be=fI(),ut=ee(Be);{var pt=Z=>{var Fe=uI(),be=v(Fe,!0);_(Fe),B(()=>A(be,l(m).input.description)),y(Z,Fe)};$(ut,Z=>{l(m).input.description&&Z(pt)})}var de=R(ut,2);{let Z=V(()=>String(l(m).input.command));Zs(de,{get content(){return l(Z)},lang:"sh",maxLines:3})}y(Y,Be)},rt=Y=>{const Be=V(()=>{const{path:be,...Ve}=l(m).input;return{_path:be,input:Ve}}),ut=V(()=>Object.keys(l(Be).input));var pt=ue(),de=ee(pt);{var Z=be=>{const Ve=V(()=>l(ut)[0]),Pe=V(()=>l(Be).input[l(Ve)]);var He=hI(),Ot=ee(He),ft=R(Ot);{var kt=st=>{Q2(st,{get todos(){return l(Pe)}})},Wn=st=>{{let Sn=V(()=>`${l(Ve)} = ${JSON.stringify(l(Pe),null,2)}`);Zs(st,{get content(){return l(Sn)},lang:"js",maxLines:1})}};$(ft,st=>{l(Ve)==="todos"&&Array.isArray(l(Pe))?st(kt):st(Wn,!1)})}B(st=>A(Ot,`${st??""} `),[()=>(console.info(`${l(Ve)} =`,l(Pe)),"")]),y(be,He)},Fe=be=>{{let Ve=V(()=>JSON.stringify(l(Be).input,null,2));Zs(be,{get content(){return l(Ve)},lang:"json",maxLines:6})}};$(de,be=>{l(ut).length===1?be(Z):be(Fe,!1)})}y(Y,pt)};$(Ce,Y=>{l(m).input.command?Y(gt):Y(rt,!1)},!0)}y(Te,we)};$(Me,Te=>{l(m).filePath?Te(Le):Te(W,!1)})}_(J),B(Te=>{Ae(J,"data-msg-id",l(i)),A(G,`🔧 ${l(m).name??""}`),A(Se,Te)},[()=>Ys(e.msg.timestamp)]),y(H,J)},D=H=>{var J=ue(),Oe=ee(J);{var se=G=>{var pe=vI(),ze=v(pe),Se=v(ze),_e=v(Se,!0);_(Se);var he=R(Se,2),Me=v(he),Le=v(Me,!0);_(Me);var W=R(Me,2),Te=v(W,!0);_(W);var we=R(W,2);{var Ce=de=>{ar(de,{class:"opacity-0 group-hover:opacity-100 transition-opacity p-1 rounded hover:bg-gh-border text-xs",onclick:()=>e.onEditTitle(e.msg),title:"Edit title",children:(Z,Fe)=>{nr();var be=Bt("✏️");y(Z,be)},$$slots:{default:!0}})};$(we,de=>{l(c)&&e.onEditTitle&&de(Ce)})}var gt=R(we,2);n(gt);var rt=R(gt,2);r(rt),_(he),_(ze);var Y=R(ze,2);{var Be=de=>{var Z=pI();St(Z,21,()=>l(k),Ft,(Fe,be,Ve)=>{var Pe=gI(),He=v(Pe),Ot=v(He);_(He);var ft=R(He,2),kt=v(ft,!0);_(ft),_(Pe),B(()=>{A(Ot,`💭 Thinking ${l(k).length>1?`(${Ve+1}/${l(k).length})`:""}`),A(kt,l(be).thinking)}),y(Fe,Pe)}),_(Z),y(de,Z)};$(Y,de=>{l(k).length>0&&de(Be)})}var ut=R(Y,2);{var pt=de=>{var Z=bI(),Fe=v(Z);{var be=Pe=>{var He=mI(),Ot=v(He,!0);_(He),B(()=>A(Ot,l(j))),y(Pe,He)},Ve=Pe=>{const He=V(()=>Ou(e.msg)),Ot=V(()=>E2(l(He)));var ft=ue(),kt=ee(ft);St(kt,17,()=>l(Ot),Ft,(Wn,st)=>{var Sn=ue(),vo=ee(Sn);{var yo=Gt=>{W2(Gt,{get tag(){return l(st).tag},get content(){return l(st).content}})},ko=Gt=>{const $r=V(()=>l(st).content.split(`
|
|
88
|
-
`));var $s=ue(),xo=ee($s);{var So=tn=>{Zs(tn,{get content(){return l(st).content},maxLines:10})},js=tn=>{var jr=_I(),Ls=v(jr,!0);_(jr),B(()=>A(Ls,l(st).content)),y(tn,jr)};$(xo,tn=>{l($r).length>10?tn(So):tn(js,!1)})}y(Gt,$s)};$(vo,Gt=>{l(st).type==="ide_tag"&&l(st).tag?Gt(yo):Gt(ko,!1)})}y(Wn,Sn)}),y(Pe,ft)};$(Fe,Pe=>{l(c)?Pe(be):Pe(Ve,!1)})}_(Z),y(de,Z)};$(ut,de=>{l(C)&&de(pt)})}_(pe),B(de=>{Ae(pe,"data-msg-id",l(i)),$e(pe,1,`p-4 rounded-lg group relative ${l(P)??""} flex flex-col ${l(F)?"gap-2":""}`),A(_e,l(h)?"OUT":e.msg.type),A(Le,de),A(Te,l(q))},[()=>Ys(e.msg.timestamp)]),y(G,pe)};$(Oe,G=>{l(F)&&G(se)},!0)}y(H,J)};$(lt,H=>{l(m)?H(Et):H(D,!1)},!0)}y(Ie,ct)};$(Ee,Ie=>{l(f)&&l(g)?Ie(De):Ie(We,!1)},!0)}y(L,O)};$(le,L=>{l(a)&&l(p)?L(fe):L(Ne,!1)},!0)}y(T,U)};$(S,T=>{l(d)?T(N):T(I,!1)})}y(t,M),gn()}Jt(["click"]);Jt(["click"]);var yI=E("<option> </option>"),kI=E('<li class="py-2 px-8 text-gh-text-secondary text-sm">Loading...</li>'),xI=E('<button class="flex-shrink-0 w-5 h-8 flex items-center justify-center bg-transparent border-none cursor-pointer text-gh-text-secondary text-xs ml-1 z-10 relative"> </button>'),SI=E('<span class="w-5 ml-1"></span>'),wI=E('<span class="flex items-center gap-0.5"><span>🤖</span><span> </span></span>'),II=E('<span class="flex items-center gap-0.5"><span>📋</span><span> </span></span>'),TI=E('<span class="pl-6 text-[10px] text-gh-text-secondary/70"> </span>'),CI=E('<li><div class="flex items-start gap-2"><span class="flex-shrink-0">📝</span> <span class="overflow-hidden text-ellipsis line-clamp-2"> </span></div> <!></li>'),RI=E('<li class="py-1.5 px-4 pl-8 text-gh-text-secondary hover:bg-gh-border-subtle/50 flex items-start gap-2"><span class="flex-shrink-0">📋</span> <span> </span></li>'),EI=E('<li class="py-1.5 px-4 pl-8 text-gh-text-secondary hover:bg-gh-border-subtle/50 flex items-start gap-2"><span class="flex-shrink-0">📋</span> <span> </span></li>'),OI=E('<li class="py-1.5 px-4 pl-8 text-gh-text-secondary hover:bg-gh-border-subtle/50 flex items-start gap-2"><span class="flex-shrink-0">🤖</span> <span class="overflow-hidden text-ellipsis whitespace-nowrap"> </span></li>'),MI=E('<ul class="bg-gh-bg-secondary/50 border-t border-gh-border-subtle text-xs"><!> <!> <!> <!></ul>'),AI=E('<li draggable="true"><div class="flex items-center"><!> <button class="flex-1 min-w-0 py-2 pr-2 bg-transparent border-none text-gh-text cursor-pointer text-left flex items-center gap-2 text-sm"><span> </span> <span class="flex-shrink-0 flex items-center gap-2 text-xs text-gh-text-secondary"><span class="flex items-center gap-0.5"><span>💬</span><span> </span></span> <!> <!></span></button> <div><span class="flex-1 min-w-0 pl-7 pr-2 text-xs text-gh-text-secondary italic overflow-hidden text-ellipsis whitespace-nowrap"><!></span> <div class="flex-shrink-0 flex gap-0.5 pr-2 pointer-events-auto"><!> <!> <!></div></div></div> <!></li>'),NI=E('<ul class="bg-gh-bg"><!></ul>'),FI=E('<li class="border-b border-gh-border-subtle"><button><span class="text-xs w-3 text-gh-text-secondary"> </span> <span class="flex-1 overflow-hidden text-ellipsis whitespace-nowrap"> </span> <span class="bg-gh-border px-2 py-0.5 rounded-full text-xs font-normal"> </span></button> <!></li>'),PI=E('<aside class="bg-gh-bg-secondary border border-gh-border rounded-lg overflow-hidden flex flex-col"><div class="p-4 border-b border-gh-border bg-gh-bg"><h2 class="text-base font-semibold mb-2"> </h2> <div class="flex items-center gap-2 text-sm"><span class="text-gh-text-secondary">Sort:</span> <select class="bg-gh-bg-secondary border border-gh-border rounded px-2 py-1 text-sm text-gh-text cursor-pointer hover:border-gh-accent focus:border-gh-accent focus:outline-none"></select> <button class="bg-gh-bg-secondary border border-gh-border rounded px-2 py-1 text-sm cursor-pointer hover:border-gh-accent hover:bg-gh-border-subtle"> </button></div></div> <ul class="overflow-y-auto flex-1"></ul></aside>');function RT(t,e){dn(e,!0);const n=()=>_p(Yc,"$appConfig",r),[r,s]=mp(),i={summary:"Summary Time",modified:"Modified",created:"Created",updated:"Last Message",messageCount:"Messages",title:"Title"},o=L=>{const O=L.target;e.onSortChange?.(O.value,e.sortOrder)},c=()=>{e.onSortChange?.(e.sortField,e.sortOrder==="asc"?"desc":"asc")},a=(L,O)=>e.projectSessionData.get(L)?.get(O),u=L=>{const O=a(L.projectName,L.id);if(O?.customTitle)return O.customTitle;if(O?.currentSummary){const Ee=O.currentSummary;return Ee.length>60?Ee.slice(0,57)+"...":Ee}return L.title&&L.title!=="Untitled"?L.title:"Untitled"},f=L=>{const O=a(L.projectName,L.id);return O?.customTitle&&O?.currentSummary?O.currentSummary:O?.currentSummary&&L.title&&L.title!=="Untitled"?L.title:O?.currentSummary?O.currentSummary:L.title??"No summary available"},d=L=>{const O=a(L.projectName,L.id),Ee=O?.todos?O.todos.sessionTodos.length+O.todos.agentTodos.reduce((De,We)=>De+We.todos.length,0):0;return{agents:O?.agents.length??0,todos:Ee,summaries:O?.summaries.length??0}},h=V(()=>Bw(e.projects,{currentProjectName:n().currentProjectName,homeDir:n().homeDir}));let p=et(fi(e.selectedSession?new Set([e.selectedSession.id]):new Set));const g=(L,O)=>{L.stopPropagation(),l(p).has(O)?l(p).delete(O):l(p).add(O),K(p,new Set(l(p)),!0)};let x=et(null),m=et(null);const k=(L,O)=>{L.dataTransfer&&(K(x,O,!0),L.dataTransfer.effectAllowed="move",L.dataTransfer.setData("text/plain",JSON.stringify({id:O.id,project:O.projectName})))},j=()=>{K(x,null),K(m,null)},q=(L,O)=>{!l(x)||l(x).projectName===O||(L.preventDefault(),L.dataTransfer&&(L.dataTransfer.dropEffect="move"),K(m,O,!0))},C=()=>{K(m,null)},F=(L,O)=>{L.preventDefault(),K(m,null),!(!l(x)||l(x).projectName===O)&&(e.onMoveSession?.(l(x),O),K(x,null))};var P=PI(),M=v(P),S=v(M),N=v(S);_(S);var I=R(S,2),T=R(v(I),2);T.__change=o,St(T,21,()=>Object.entries(i),Ft,(L,O)=>{var Ee=V(()=>Hu(l(O),2));let De=()=>l(Ee)[0],We=()=>l(Ee)[1];var Ie=yI(),ct=v(Ie,!0);_(Ie);var lt={};B(()=>{A(ct,We()),lt!==(lt=De())&&(Ie.value=(Ie.__value=De())??"")}),y(L,Ie)}),_(T);var U;Wu(T);var le=R(T,2);le.__click=c;var fe=v(le,!0);_(le),_(I),_(M);var Ne=R(M,2);St(Ne,21,()=>l(h),Ft,(L,O)=>{const Ee=V(()=>l(m)===l(O).name);var De=FI(),We=v(De);We.__click=()=>e.onToggleProject(l(O).name);var Ie=v(We),ct=v(Ie,!0);_(Ie);var lt=R(Ie,2),Et=v(lt,!0);_(lt);var D=R(lt,2),H=v(D,!0);_(D),_(We);var J=R(We,2);{var Oe=se=>{var G=NI(),pe=v(G);{var ze=_e=>{var he=kI();y(_e,he)},Se=_e=>{var he=ue(),Me=ee(he);St(Me,17,()=>e.projectSessions.get(l(O).name)??[],Ft,(Le,W)=>{const Te=V(()=>e.selectedSession?.id===l(W).id),we=V(()=>l(x)?.id===l(W).id),Ce=V(()=>d(l(W))),gt=V(()=>u(l(W))),rt=V(()=>f(l(W))),Y=V(()=>a(l(W).projectName,l(W).id)),Be=V(()=>!l(Y)?.customTitle&&!l(Y)?.currentSummary),ut=V(()=>l(p).has(l(W).id)),pt=V(()=>l(Ce).summaries>0||l(Ce).agents>0||l(Ce).todos>0);var de=AI(),Z=v(de),Fe=v(Z);{var be=ie=>{var ve=xI();ve.__click=nn=>g(nn,l(W).id);var ht=v(ve,!0);_(ve),B(()=>{Ae(ve,"title",l(ut)?"Collapse":"Expand"),A(ht,l(ut)?"▼":"▶")}),y(ie,ve)},Ve=ie=>{var ve=SI();y(ie,ve)};$(Fe,ie=>{l(pt)?ie(be):ie(Ve,!1)})}var Pe=R(Fe,2);Pe.__click=()=>e.onSelectSession(l(W));var He=v(Pe),Ot=v(He,!0);_(He);var ft=R(He,2),kt=v(ft),Wn=R(v(kt)),st=v(Wn,!0);_(Wn),_(kt);var Sn=R(kt,2);{var vo=ie=>{var ve=wI(),ht=R(v(ve)),nn=v(ht,!0);_(ht),_(ve),B(()=>{Ae(ve,"title",`${l(Ce).agents??""} agent(s)`),A(nn,l(Ce).agents)}),y(ie,ve)};$(Sn,ie=>{l(Ce).agents>0&&ie(vo)})}var yo=R(Sn,2);{var ko=ie=>{var ve=II(),ht=R(v(ve)),nn=v(ht,!0);_(ht),_(ve),B(()=>{Ae(ve,"title",`${l(Ce).todos??""} todo(s)`),A(nn,l(Ce).todos)}),y(ie,ve)};$(yo,ie=>{l(Ce).todos>0&&ie(ko)})}_(ft),_(Pe);var Gt=R(Pe,2),$r=v(Gt),$s=v($r);{var xo=ie=>{var ve=Bt();B(ht=>A(ve,ht),[()=>l(Y).currentSummary.length>50?l(Y).currentSummary.slice(0,47)+"...":l(Y).currentSummary]),y(ie,ve)},So=ie=>{var ve=Bt();B(()=>A(ve,l(gt))),y(ie,ve)};$($s,ie=>{l(Y)?.currentSummary?ie(xo):ie(So,!1)})}_($r);var js=R($r,2),tn=v(js);{var jr=ie=>{ar(ie,{class:"p-1 rounded hover:bg-gh-green/20 text-xs",onclick:ve=>e.onResumeSession(ve,l(W)),title:"Resume session",children:(ve,ht)=>{nr();var nn=Bt("▶️");y(ve,nn)},$$slots:{default:!0}})};$(tn,ie=>{e.onResumeSession&&ie(jr)})}var Ls=R(tn,2);ar(Ls,{class:"p-1 rounded hover:bg-gh-border text-xs",onclick:ie=>e.onRenameSession(ie,l(W)),title:"Rename",children:(ie,ve)=>{nr();var ht=Bt("✏️");y(ie,ht)},$$slots:{default:!0}});var bg=R(Ls,2);ar(bg,{class:"p-1 rounded hover:bg-gh-red/20 text-xs",onclick:ie=>e.onDeleteSession(ie,l(W)),title:"Delete",children:(ie,ve)=>{nr();var ht=Bt("🗑️");y(ie,ht)},$$slots:{default:!0}}),_(js),_(Gt),_(Z);var vg=R(Z,2);{var yg=ie=>{var ve=MI(),ht=v(ve);{var nn=mt=>{var Mt=ue(),mn=ee(Mt);St(mn,17,()=>l(Y).summaries,Ft,(wn,xt,Wt)=>{var $t=CI();$e($t,1,`py-1.5 px-4 pl-8 hover:bg-gh-border-subtle/50 flex flex-col gap-0.5 ${Wt===0?"text-gh-text":"text-gh-text-secondary"}`);var In=v($t),Ds=R(v(In),2),Ig=v(Ds,!0);_(Ds),_(In);var Tg=R(In,2);{var Cg=Lr=>{var wo=TI(),Rg=v(wo,!0);_(wo),B(Eg=>A(Rg,Eg),[()=>new Date(l(xt).timestamp).toLocaleString()]),y(Lr,wo)};$(Tg,Lr=>{l(xt).timestamp&&Lr(Cg)})}_($t),B(Lr=>{Ae($t,"title",l(xt).summary),A(Ig,Lr)},[()=>l(xt).summary.length>100?l(xt).summary.slice(0,97)+"...":l(xt).summary]),y(wn,$t)}),y(mt,Mt)};$(ht,mt=>{l(Y)?.summaries&&l(Y).summaries.length>0&&mt(nn)})}var al=R(ht,2);{var kg=mt=>{var Mt=RI(),mn=R(v(Mt),2),wn=v(mn);_(mn),_(Mt),B(()=>A(wn,`Session Todos (${l(Y).todos.sessionTodos.length??""})`)),y(mt,Mt)};$(al,mt=>{l(Y)?.todos?.sessionTodos&&l(Y).todos.sessionTodos.length>0&&mt(kg)})}var cl=R(al,2);{var xg=mt=>{var Mt=ue(),mn=ee(Mt);St(mn,17,()=>l(Y).todos.agentTodos,Ft,(wn,xt)=>{var Wt=EI(),$t=R(v(Wt),2),In=v($t);_($t),_(Wt),B(()=>A(In,`Agent Todos (${l(xt).todos.length??""})`)),y(wn,Wt)}),y(mt,Mt)};$(cl,mt=>{l(Y)?.todos?.agentTodos&&mt(xg)})}var Sg=R(cl,2);{var wg=mt=>{var Mt=ue(),mn=ee(Mt);St(mn,17,()=>l(Y).agents,Ft,(wn,xt)=>{var Wt=OI(),$t=R(v(Wt),2),In=v($t);_($t),_(Wt),B(Ds=>{Ae(Wt,"title",l(xt).name??l(xt).id),A(In,`${Ds??""} (${l(xt).messageCount??""} msgs)`)},[()=>l(xt).name??l(xt).id.slice(0,12)+"..."]),y(wn,Wt)}),y(mt,Mt)};$(Sg,mt=>{l(Y)?.agents&&l(Y).agents.length>0&&mt(wg)})}_(ve),y(ie,ve)};$(vg,ie=>{l(ut)&&l(pt)&&ie(yg)})}_(de),B(()=>{$e(de,1,`relative border-t border-gh-border-subtle group ${l(Te)?"bg-gh-accent/20 border-l-3 border-l-gh-accent":""} ${l(we)?"opacity-50":""}`),Ae(Pe,"title",l(rt)),$e(He,1,`flex-1 min-w-0 overflow-hidden text-ellipsis whitespace-nowrap ${l(Be)?"italic text-gh-text-secondary":""}`),A(Ot,l(gt)),Ae(kt,"title",`${l(W).messageCount??""} messages`),A(st,l(W).messageCount),$e(Gt,1,`absolute left-0 right-0 top-0 h-8 flex items-center opacity-0 group-hover:opacity-100 transition-opacity pointer-events-none ${l(Te)?"bg-gradient-to-r from-[color-mix(in_srgb,var(--color-gh-accent)_20%,var(--color-gh-bg))] via-[color-mix(in_srgb,var(--color-gh-accent)_20%,var(--color-gh-bg))] to-[color-mix(in_srgb,var(--color-gh-accent)_20%,var(--color-gh-bg))]":"bg-gradient-to-r from-gh-bg via-gh-bg to-gh-bg"}`)}),En("dragstart",de,ie=>k(ie,l(W))),En("dragend",de,j),y(Le,de)}),y(_e,he)};$(pe,_e=>{e.loadingProject===l(O).name?_e(ze):_e(Se,!1)})}_(G),y(se,G)};$(J,se=>{e.expandedProjects.has(l(O).name)&&se(Oe)})}_(De),B((se,G,pe)=>{$e(We,1,`w-full py-3 px-4 bg-transparent border-none text-gh-text cursor-pointer text-left flex items-center gap-2 font-medium hover:bg-gh-border-subtle ${se??""} ${l(Ee)?"bg-gh-green/20 ring-2 ring-gh-green ring-inset":""}`),A(ct,G),Ae(lt,"title",l(O).displayName),A(Et,pe),A(H,l(O).sessionCount)},[()=>e.expandedProjects.has(l(O).name)?"bg-gh-accent/10":"",()=>e.expandedProjects.has(l(O).name)?"▼":"▶",()=>R2(l(O).displayName)]),En("dragover",We,se=>q(se,l(O).name)),En("dragleave",We,C),En("drop",We,se=>F(se,l(O).name)),y(L,De)}),_(Ne),_(P),B(()=>{A(N,`Projects (${l(h).length??""})`),U!==(U=e.sortField)&&(T.value=(T.__value=e.sortField)??"",hi(T,e.sortField)),Ae(le,"title",e.sortOrder==="desc"?"Descending (newest first)":"Ascending (oldest first)"),A(fe,e.sortOrder==="desc"?"↓":"↑")}),y(t,P),gn(),s()}Jt(["change","click"]);var $I=E('<button><svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M17.657 16.657L13.414 20.9a1.998 1.998 0 01-2.827 0l-4.244-4.243a8 8 0 1111.314 0z"></path><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 11a3 3 0 11-6 0 3 3 0 016 0z"></path></svg> <span class="tooltip svelte-12kovyu">Last compacted point</span></button>'),jI=E('<div><button><svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 11l7-7 7 7M5 19l7-7 7 7"></path></svg> <span class="tooltip svelte-12kovyu">Top</span></button> <button><svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 15l7-7 7 7"></path></svg> <span class="tooltip svelte-12kovyu">Previous user message</span></button> <!> <button><svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 9l7 7 7-7"></path></svg> <span class="tooltip svelte-12kovyu">Next user message</span></button> <button><svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 5l7 7 7-7M5 13l7 7 7-7"></path></svg> <span class="tooltip svelte-12kovyu">Bottom</span></button></div>');function LI(t,e){dn(e,!0);let n=Je(e,"class",3,"");const r=S=>{if(S.type!=="user"||!S.uuid)return!1;const N=S.toolUseResult;if(N){if(typeof N=="object")return"answers"in N;if(typeof N=="string"){const T="The user provided the following reason for the rejection:",U=N.indexOf(T);if(U!==-1)return N.slice(U+T.length).trim().length>0}return!1}const I=S.message?.content??S.content;if(!I)return!1;if(typeof I=="string")return I.trim().length>0;if(!Array.isArray(I))return!1;for(const T of I)if(T.type==="text"&&T.text?.trim())return!0;return!1};let s=null,i=null;const o=()=>{if(s===null||i!==e.messages){s=[];for(let S=0;S<e.messages.length;S++)r(e.messages[S])&&s.push(S);i=e.messages}return s};let c=-1,a=null;const u=()=>{if(a!==e.messages){c=-1;for(let S=e.messages.length-1;S>=0;S--)if(e.messages[S].isCompactSummary){c=S;break}a=e.messages}},f=()=>(u(),c),d=()=>(u(),c>=0);let h=et(!1);tr(()=>{e.messages.length,K(h,d(),!0)});let p=et(0);const g=()=>{if(!e.scrollContainer)return 0;const S=e.scrollContainer.getBoundingClientRect(),N=e.scrollContainer.querySelectorAll("[data-msg-id]");for(let I=0;I<N.length;I++){const T=N[I];if(T.getBoundingClientRect().top>=S.top-50){const le=T.getAttribute("data-msg-id"),fe=e.messages.findIndex(Ne=>(Ne.uuid??`idx-${e.messages.indexOf(Ne)}`)===le);return fe>=0?fe:I}}return 0},x=S=>{if(!e.scrollContainer||S<0||S>=e.messages.length)return;const N=e.messages[S].uuid??`idx-${S}`,I=e.scrollContainer.querySelector(`[data-msg-id="${N}"]`);I&&(I.scrollIntoView({behavior:"smooth",block:"start"}),K(p,S,!0))},m=()=>{e.scrollContainer?.scrollTo({top:0,behavior:"smooth"}),K(p,0)},k=()=>{e.scrollContainer&&(e.scrollContainer.scrollTo({top:e.scrollContainer.scrollHeight+1e4,behavior:"smooth"}),K(p,e.messages.length-1))},j=()=>{const S=f();S>=0&&x(S)},q=()=>{const S=g(),N=o();for(let I=N.length-1;I>=0;I--)if(N[I]<S){x(N[I]);return}m()},C=()=>{const S=g(),N=o();for(const I of N)if(I>S){x(I);return}k()};var F=ue(),P=ee(F);{var M=S=>{var N=jI(),I=v(N);$e(I,1,"nav-btn p-1.5 text-sm rounded border border-gh-border hover:bg-gh-border-subtle text-gh-text-secondary hover:text-gh-text transition-colors bg-gh-bg svelte-12kovyu"),I.__click=m;var T=R(I,2);$e(T,1,"nav-btn p-1.5 text-sm rounded border border-gh-border hover:bg-gh-border-subtle text-gh-text-secondary hover:text-gh-text transition-colors bg-gh-bg svelte-12kovyu"),T.__click=q;var U=R(T,2);{var le=L=>{var O=$I();$e(O,1,"nav-btn p-1.5 text-sm rounded border border-gh-border hover:bg-gh-border-subtle text-gh-text-secondary hover:text-gh-text transition-colors bg-gh-bg svelte-12kovyu"),O.__click=j,y(L,O)};$(U,L=>{l(h)&&L(le)})}var fe=R(U,2);$e(fe,1,"nav-btn p-1.5 text-sm rounded border border-gh-border hover:bg-gh-border-subtle text-gh-text-secondary hover:text-gh-text transition-colors bg-gh-bg svelte-12kovyu"),fe.__click=C;var Ne=R(fe,2);$e(Ne,1,"nav-btn p-1.5 text-sm rounded border border-gh-border hover:bg-gh-border-subtle text-gh-text-secondary hover:text-gh-text transition-colors bg-gh-bg svelte-12kovyu"),Ne.__click=k,_(N),B(()=>$e(N,1,`flex gap-0.5 ${n()??""}`,"svelte-12kovyu")),y(S,N)};$(P,S=>{e.messages.length>0&&S(M)})}y(t,F),gn()}Jt(["click"]);var DI=E('<a class="text-gh-muted hover:text-gh-fg flex-shrink-0" title="Back to project"><svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M10 19l-7-7m0 0l7-7m-7 7h18"></path></svg></a>'),BI=E(`<h2 class="text-base font-semibold"> </h2> <button class="text-xs text-gh-text-secondary font-mono mt-1 hover:text-gh-accent
|
|
89
|
-
hover:underline cursor-pointer bg-transparent border-none p-0 text-left" title="Open session file in VSCode"> </button>`,1),UI=E('<h2 class="text-base font-semibold">Messages</h2>'),qI=E('<button>🤖 <span class="hidden md:inline"> </span><span class="md:hidden"> </span> </button>'),zI=E("<button> </button>"),VI=E('<div class="flex border-b border-gh-border bg-gh-bg overflow-x-auto"><div class="flex-1 flex justify-center"><button> </button> <!></div> <!></div>'),HI=E('<div class="flex items-center justify-center h-full text-gh-text-secondary">Select a session to view</div>'),KI=E('<div class="flex items-center justify-center h-full text-gh-text-secondary">No messages</div>'),JI=E('<div class="p-4 flex flex-col gap-4"></div>'),GI=E('<div class="text-gh-text-secondary text-center py-8">No todos</div>'),WI=E('<li class="flex items-start gap-2 p-3 bg-gh-bg rounded border border-gh-border"><span class="flex-shrink-0"><!></span> <span> </span></li>'),YI=E('<ul class="space-y-2"></ul>'),ZI=E('<div class="p-4"><!></div>'),QI=E('<div class="flex items-center justify-center h-full text-gh-text-secondary">Loading agent messages...</div>'),XI=E('<div class="flex items-center justify-center h-full text-gh-text-secondary">No messages</div>'),eT=E('<div class="p-4 flex flex-col gap-4"></div>'),tT=E(`<div class="fixed bottom-4 left-1/2 -translate-x-1/2 bg-neutral-500/20 border border-neutral-600
|
|
90
|
-
rounded-lg shadow-2xl px-4 py-3 flex items-center gap-4 z-50 backdrop-blur-sm"><span class="text-sm text-white"> </span> <span class="text-xs text-gh-text-secondary tabular-nums"> </span> <button class="px-3 py-1 text-sm font-medium text-gh-accent hover:bg-gh-border-subtle rounded transition-colors">Undo</button> <button class="px-2 py-1 text-sm text-gh-text-secondary hover:text-gh-text hover:bg-gh-border-subtle rounded transition-colors" title="Dismiss (already deleted)">✕</button></div>`),nT=E('<section><div class="p-4 border-b border-gh-border bg-gh-bg flex flex-wrap justify-between items-start gap-2"><!> <div class="flex-1 min-w-[200px]"><!></div> <!></div> <!> <div><!></div> <!></section>');function ET(t,e){dn(e,!0);let n=Je(e,"todos",19,()=>[]),r=Je(e,"agents",19,()=>[]),s=Je(e,"enableScroll",3,!0),i=Je(e,"externalScrollContainer",3,null),o=Je(e,"fullWidth",3,!1);const c=V(()=>Lw(e.customTitle,e.currentSummary,e.session?.title,50));let a=et("messages"),u=et(fi([])),f=et(!1),d=et(fi([])),h=et(0),p=et(null);tr(()=>{if(l(h)<=0)return;const D=setInterval(()=>{K(h,Math.max(0,l(h)-1),!0),l(h)===0&&K(d,[],!0)},1e3);return()=>clearInterval(D)}),tr(()=>{e.session?.id,K(a,"messages"),K(u,[],!0)});const g=V(()=>l(a).startsWith("agent:")?l(a).slice(6):null);tr(()=>{l(g)&&e.session&&(K(f,!0),$p(e.session.projectName,e.session.id,l(g)).then(D=>{K(u,D,!0)}).catch(D=>{console.error("Failed to load agent messages:",D),K(u,[],!0)}).finally(()=>{K(f,!1)}))});const x=async()=>{if(l(p)&&clearTimeout(l(p)),!e.session||l(d).length===0)return;const D=[...l(d)].reverse();for(const H of D)try{if(await Fp(e.session.projectName,H.sessionId,H.msg,H.index),H.isAgent){const J=[...l(u)];J.splice(H.index,0,H.msg),K(u,J,!0)}else{const J=[...e.messages];J.splice(H.index,0,H.msg),e.onMessagesChange?.(J)}}catch(J){console.error("Failed to restore message:",J)}K(d,[],!0),K(h,0),K(p,null)},m=async(D,H)=>{if(!e.session)return;const J=D.uuid||D.messageId||D.leafUuid;if(!J)return;const Oe=H&&l(g)?l(g):e.session.id;let se;if(H){if(se=l(u).findIndex(G=>(G.uuid||G.messageId||G.leafUuid)===J),se===-1)return}else if(se=e.messages.findIndex(G=>(G.uuid||G.messageId||G.leafUuid)===J),se===-1)return;try{if(await Np(e.session.projectName,Oe,J),H)K(u,l(u).filter(G=>(G.uuid||G.messageId||G.leafUuid)!==J),!0);else{const G=e.messages.filter(pe=>(pe.uuid||pe.messageId||pe.leafUuid)!==J);e.onMessagesChange?.(G)}K(d,[...l(d),{msg:D,index:se,isAgent:H,sessionId:Oe}],!0),l(p)&&clearTimeout(l(p)),K(h,10),K(p,setTimeout(()=>{K(d,[],!0),K(h,0),K(p,null)},1e4),!0),e.onDeleteMessage?.(D)}catch(G){console.error("Failed to delete message:",G)}},k=D=>{m(D,!0)},j=D=>{m(D,!1)},q=async()=>{if(!e.session)return;const D=`~/.claude/projects/${e.session.projectName}/${e.session.id}.jsonl`;try{await Ha(D)}catch(H){console.error("Failed to open file:",H)}},C=V(()=>e.messages.findIndex(D=>D.type==="user"||D.type==="assistant"||D.type==="human"));let F=et(void 0);const P=V(()=>i()??l(F));var M=nT(),S=v(M),N=v(S);{var I=D=>{var H=DI();B(()=>Ae(H,"href",e.backUrl)),y(D,H)};$(N,D=>{e.backUrl&&D(I)})}var T=R(N,2),U=v(T);{var le=D=>{var H=BI(),J=ee(H),Oe=v(J,!0);_(J);var se=R(J,2);se.__click=q;var G=v(se,!0);_(se),B(pe=>{A(Oe,pe),A(G,e.session.id)},[()=>C2(l(c),50)]),y(D,H)},fe=D=>{var H=UI();y(D,H)};$(U,D=>{e.session?D(le):D(fe,!1)})}_(T);var Ne=R(T,2);{var L=D=>{LI(D,{get messages(){return e.messages},get scrollContainer(){return l(P)}})};$(Ne,D=>{l(a)!=="todos"&&D(L)})}_(S);var O=R(S,2);{var Ee=D=>{var H=VI(),J=v(H),Oe=v(J);Oe.__click=()=>K(a,"messages");var se=v(Oe);_(Oe);var G=R(Oe,2);St(G,17,r,Ft,(Se,_e)=>{var he=qI();he.__click=()=>K(a,`agent:${l(_e).id}`);var Me=R(v(he)),Le=v(Me,!0);_(Me);var W=R(Me),Te=v(W,!0);_(W);var we=R(W);_(he),B(Ce=>{$e(he,1,`px-4 py-2 text-sm font-medium transition-colors whitespace-nowrap ${l(a)===`agent:${l(_e).id}`?"text-gh-accent border-b-2 border-gh-accent":"text-gh-text-secondary hover:text-gh-text hover:bg-gh-border-subtle"}`),A(Le,l(_e).id),A(Te,Ce),A(we,` (${l(_e).messageCount??""})`)},[()=>l(_e).id.replace("agent-","")]),y(Se,he)}),_(J);var pe=R(J,2);{var ze=Se=>{var _e=zI();_e.__click=()=>K(a,"todos");var he=v(_e);_(_e),B(()=>{$e(_e,1,`px-4 py-2 text-sm font-medium transition-colors whitespace-nowrap ${l(a)==="todos"?"text-gh-accent border-b-2 border-gh-accent":"text-gh-text-secondary hover:text-gh-text hover:bg-gh-border-subtle"}`),A(he,`✅ Todos (${n().length??""})`)}),y(Se,_e)};$(pe,Se=>{n().length>0&&Se(ze)})}_(H),B(()=>{$e(Oe,1,`px-4 py-2 text-sm font-medium transition-colors whitespace-nowrap ${l(a)==="messages"?"text-gh-accent border-b-2 border-gh-accent":"text-gh-text-secondary hover:text-gh-text hover:bg-gh-border-subtle"}`),A(se,`💬 Messages (${e.messages.length??""})`)}),y(D,H)};$(O,D=>{e.session&&D(Ee)})}var De=R(O,2),We=v(De);{var Ie=D=>{var H=HI();y(D,H)},ct=D=>{var H=ue(),J=ee(H);{var Oe=G=>{var pe=ue(),ze=ee(pe);{var Se=he=>{var Me=KI();y(he,Me)},_e=he=>{var Me=JI();St(Me,23,()=>e.messages,(Le,W)=>Le.uuid??`idx-${W}`,(Le,W,Te)=>{{let we=V(()=>e.session?.id??""),Ce=V(()=>l(Te)===l(C));Mu(Le,{get msg(){return l(W)},get sessionId(){return l(we)},onDelete:j,get onEditTitle(){return e.onEditTitle},get onSplit(){return e.onSplitSession},get isFirst(){return l(Ce)}})}}),_(Me),y(he,Me)};$(ze,he=>{e.messages.length===0?he(Se):he(_e,!1)})}y(G,pe)},se=G=>{var pe=ue(),ze=ee(pe);{var Se=he=>{var Me=ZI(),Le=v(Me);{var W=we=>{var Ce=GI();y(we,Ce)},Te=we=>{var Ce=YI();St(Ce,21,n,Ft,(gt,rt)=>{var Y=WI(),Be=v(Y),ut=v(Be);{var pt=be=>{var Ve=Bt("✅");y(be,Ve)},de=be=>{var Ve=ue(),Pe=ee(Ve);{var He=ft=>{var kt=Bt("🔄");y(ft,kt)},Ot=ft=>{var kt=Bt("⬜");y(ft,kt)};$(Pe,ft=>{l(rt).status==="in_progress"?ft(He):ft(Ot,!1)},!0)}y(be,Ve)};$(ut,be=>{l(rt).status==="completed"?be(pt):be(de,!1)})}_(Be);var Z=R(Be,2),Fe=v(Z,!0);_(Z),_(Y),B(()=>{$e(Z,1,za(l(rt).status==="completed"?"text-gh-text-secondary line-through":"")),A(Fe,l(rt).content)}),y(gt,Y)}),_(Ce),y(we,Ce)};$(Le,we=>{n().length===0?we(W):we(Te,!1)})}_(Me),y(he,Me)},_e=he=>{var Me=ue(),Le=ee(Me);{var W=Te=>{var we=ue(),Ce=ee(we);{var gt=Y=>{var Be=QI();y(Y,Be)},rt=Y=>{var Be=ue(),ut=ee(Be);{var pt=Z=>{var Fe=XI();y(Z,Fe)},de=Z=>{var Fe=eT();St(Fe,23,()=>l(u),be=>be.uuid,(be,Ve,Pe)=>{{let He=V(()=>l(Pe)===0);Mu(be,{get msg(){return l(Ve)},get sessionId(){return l(g)},onDelete:k,get isFirst(){return l(He)}})}}),_(Fe),y(Z,Fe)};$(ut,Z=>{l(u).length===0?Z(pt):Z(de,!1)},!0)}y(Y,Be)};$(Ce,Y=>{l(f)?Y(gt):Y(rt,!1)})}y(Te,we)};$(Le,Te=>{l(g)&&Te(W)},!0)}y(he,Me)};$(ze,he=>{l(a)==="todos"?he(Se):he(_e,!1)},!0)}y(G,pe)};$(J,G=>{l(a)==="messages"?G(Oe):G(se,!1)},!0)}y(D,H)};$(We,D=>{e.session?D(ct,!1):D(Ie)})}_(De),qa(De,D=>K(F,D),()=>l(F));var lt=R(De,2);{var Et=D=>{var H=tT(),J=v(H),Oe=v(J,!0);_(J);var se=R(J,2),G=v(se);_(se);var pe=R(se,2);pe.__click=x;var ze=R(pe,2);ze.__click=()=>{l(p)&&clearTimeout(l(p)),K(d,[],!0),K(h,0)},_(H),B(()=>{A(Oe,l(d).length===1?"Message deleted":`${l(d).length} messages deleted`),A(G,`${l(h)??""}s`)}),y(D,H)};$(lt,D=>{l(d).length>0&&D(Et)})}_(M),B(()=>{$e(M,1,`bg-gh-bg-secondary overflow-hidden flex flex-col h-full ${o()?"":"border border-gh-border rounded-lg"}`),$e(De,1,`flex-1 ${s()?"overflow-y-auto":""}`)}),y(t,M),gn()}Jt(["click"]);var rT=E('<div><span> </span> <button class="text-white/70 hover:text-white transition-colors" title="Dismiss">✕</button></div>');function OT(t,e){dn(e,!0);let n=Je(e,"message",15),r=Je(e,"variant",3,"success"),s=Je(e,"duration",3,3e3),i=null;const o={success:"bg-gh-green/90",error:"bg-gh-red/90",info:"bg-gh-accent/90",warning:"bg-yellow-600/90"};tr(()=>{n()&&(i&&clearTimeout(i),i=setTimeout(()=>n(null),s()))}),gp(()=>{i&&clearTimeout(i)});var c=ue(),a=ee(c);{var u=f=>{var d=rT(),h=v(d),p=v(h,!0);_(h);var g=R(h,2);g.__click=()=>n(null),_(d),B(()=>{$e(d,1,`fixed bottom-4 left-1/2 -translate-x-1/2 text-white px-4 py-2 rounded-lg shadow-lg z-50 flex items-center gap-3 animate-fade-in ${o[r()]??""}`,"svelte-1cpok13"),A(p,n())}),y(f,d)};$(a,f=>{n()&&f(u)})}y(t,c),gn()}Jt(["click"]);export{Ft as A,TT as C,CT as I,RT as P,ET as S,OT as T,Yc as a,fT as b,ST as c,Np as d,xT as e,hT as f,Lw as g,dT as h,uT as i,Sp as j,kT as k,lT as l,yT as m,_T as n,bT as o,pT as p,Qu as q,wT as r,vT as s,Ae as t,gT as u,aT as v,$e as w,cT as x,mT as y,St as z};
|