@claude-sessions/web 0.3.3 → 0.3.4
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.012AOslr.css +1 -0
- package/build/client/_app/immutable/assets/0.012AOslr.css.br +0 -0
- package/build/client/_app/immutable/assets/0.012AOslr.css.gz +0 -0
- package/build/client/_app/immutable/chunks/{HouQR_BO.js → B8FrDj8m.js} +1 -1
- package/build/client/_app/immutable/chunks/B8FrDj8m.js.br +0 -0
- package/build/client/_app/immutable/chunks/B8FrDj8m.js.gz +0 -0
- package/build/client/_app/immutable/chunks/{CzuOkoRV.js → CXOnRY8x.js} +1 -1
- package/build/client/_app/immutable/chunks/CXOnRY8x.js.br +0 -0
- package/build/client/_app/immutable/chunks/CXOnRY8x.js.gz +0 -0
- package/build/client/_app/immutable/chunks/C_89ThaI.js +90 -0
- package/build/client/_app/immutable/chunks/C_89ThaI.js.br +0 -0
- package/build/client/_app/immutable/chunks/C_89ThaI.js.gz +0 -0
- package/build/client/_app/immutable/chunks/CbJths_J.js +1 -0
- package/build/client/_app/immutable/chunks/CbJths_J.js.br +0 -0
- package/build/client/_app/immutable/chunks/CbJths_J.js.gz +0 -0
- package/build/client/_app/immutable/chunks/Cyo3OVYg.js +2 -0
- package/build/client/_app/immutable/chunks/Cyo3OVYg.js.br +0 -0
- package/build/client/_app/immutable/chunks/Cyo3OVYg.js.gz +0 -0
- package/build/client/_app/immutable/chunks/Dfkti507.js +1 -0
- package/build/client/_app/immutable/chunks/Dfkti507.js.br +0 -0
- package/build/client/_app/immutable/chunks/Dfkti507.js.gz +0 -0
- package/build/client/_app/immutable/chunks/Dz2P4HIo.js +1 -0
- package/build/client/_app/immutable/chunks/Dz2P4HIo.js.br +0 -0
- package/build/client/_app/immutable/chunks/Dz2P4HIo.js.gz +0 -0
- package/build/client/_app/immutable/entry/app.DQ0sG0qQ.js +2 -0
- package/build/client/_app/immutable/entry/app.DQ0sG0qQ.js.br +0 -0
- package/build/client/_app/immutable/entry/app.DQ0sG0qQ.js.gz +0 -0
- package/build/client/_app/immutable/entry/start.BF7HJ4fZ.js +1 -0
- package/build/client/_app/immutable/entry/start.BF7HJ4fZ.js.br +2 -0
- package/build/client/_app/immutable/entry/start.BF7HJ4fZ.js.gz +0 -0
- package/build/client/_app/immutable/nodes/0.B2tjwvIL.js +1 -0
- package/build/client/_app/immutable/nodes/0.B2tjwvIL.js.br +0 -0
- package/build/client/_app/immutable/nodes/0.B2tjwvIL.js.gz +0 -0
- package/build/client/_app/immutable/nodes/1.BcsF7AIE.js +1 -0
- package/build/client/_app/immutable/nodes/1.BcsF7AIE.js.br +0 -0
- package/build/client/_app/immutable/nodes/1.BcsF7AIE.js.gz +0 -0
- package/build/client/_app/immutable/nodes/2.BOGTlhJ8.js +4 -0
- package/build/client/_app/immutable/nodes/2.BOGTlhJ8.js.br +0 -0
- package/build/client/_app/immutable/nodes/2.BOGTlhJ8.js.gz +0 -0
- package/build/client/_app/immutable/nodes/3.B6_hPOud.js +4 -0
- package/build/client/_app/immutable/nodes/3.B6_hPOud.js.br +0 -0
- package/build/client/_app/immutable/nodes/3.B6_hPOud.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/server/chunks/0-Bz7vAUYh.js +17 -0
- package/build/server/chunks/0-Bz7vAUYh.js.map +1 -0
- package/build/server/chunks/{1-NzhdkXbT.js → 1-Dpd0kp2f.js} +2 -2
- package/build/server/chunks/{1-NzhdkXbT.js.map → 1-Dpd0kp2f.js.map} +1 -1
- package/build/server/chunks/2-CH9DzrUp.js +9 -0
- package/build/server/chunks/2-CH9DzrUp.js.map +1 -0
- package/build/server/chunks/3-p3bGcXaZ.js +9 -0
- package/build/server/chunks/3-p3bGcXaZ.js.map +1 -0
- package/build/server/chunks/InputModal-CzUvurky.js +36 -0
- package/build/server/chunks/InputModal-CzUvurky.js.map +1 -0
- package/build/server/chunks/Toast-BzlMSW2A.js +80 -0
- package/build/server/chunks/Toast-BzlMSW2A.js.map +1 -0
- package/build/server/chunks/_layout.svelte-Dr7pTiAq.js +105 -0
- package/build/server/chunks/_layout.svelte-Dr7pTiAq.js.map +1 -0
- package/build/server/chunks/{_page.svelte-C7sseaTW.js → _page.svelte-D8oP1bKp.js} +43 -3
- package/build/server/chunks/_page.svelte-D8oP1bKp.js.map +1 -0
- package/build/server/chunks/{_page.svelte-Bgd-L7N_.js → _page.svelte-OvxQOUCZ.js} +405 -346
- package/build/server/chunks/_page.svelte-OvxQOUCZ.js.map +1 -0
- package/build/server/chunks/{_server.ts-DZQssvoI.js → _server.ts-BGkiZqyw.js} +2 -2
- package/build/server/chunks/{_server.ts-DZQssvoI.js.map → _server.ts-BGkiZqyw.js.map} +1 -1
- package/build/server/chunks/index2-gtN4acH3.js.map +1 -1
- package/build/server/index.js +1 -1
- package/build/server/index.js.map +1 -1
- package/build/server/manifest.js +6 -6
- package/build/server/manifest.js.map +1 -1
- package/package.json +2 -2
- package/build/client/_app/immutable/assets/0.B2yA_bPQ.css +0 -1
- package/build/client/_app/immutable/assets/0.B2yA_bPQ.css.br +0 -0
- package/build/client/_app/immutable/assets/0.B2yA_bPQ.css.gz +0 -0
- package/build/client/_app/immutable/chunks/Bapp9IYO.js +0 -1
- package/build/client/_app/immutable/chunks/Bapp9IYO.js.br +0 -0
- package/build/client/_app/immutable/chunks/Bapp9IYO.js.gz +0 -0
- package/build/client/_app/immutable/chunks/BzTxzCCu.js +0 -1
- package/build/client/_app/immutable/chunks/BzTxzCCu.js.br +0 -0
- package/build/client/_app/immutable/chunks/BzTxzCCu.js.gz +0 -0
- package/build/client/_app/immutable/chunks/CUTXPORg.js +0 -1
- package/build/client/_app/immutable/chunks/CUTXPORg.js.br +0 -0
- package/build/client/_app/immutable/chunks/CUTXPORg.js.gz +0 -0
- package/build/client/_app/immutable/chunks/CzuOkoRV.js.br +0 -0
- package/build/client/_app/immutable/chunks/CzuOkoRV.js.gz +0 -0
- package/build/client/_app/immutable/chunks/DHCLGQT_.js +0 -1
- package/build/client/_app/immutable/chunks/DHCLGQT_.js.br +0 -0
- package/build/client/_app/immutable/chunks/DHCLGQT_.js.gz +0 -0
- package/build/client/_app/immutable/chunks/DUNnSDh5.js +0 -66
- package/build/client/_app/immutable/chunks/DUNnSDh5.js.br +0 -0
- package/build/client/_app/immutable/chunks/DUNnSDh5.js.gz +0 -0
- package/build/client/_app/immutable/chunks/Di6YbRZt.js +0 -2
- package/build/client/_app/immutable/chunks/Di6YbRZt.js.br +0 -0
- package/build/client/_app/immutable/chunks/Di6YbRZt.js.gz +0 -0
- package/build/client/_app/immutable/chunks/HouQR_BO.js.br +0 -0
- package/build/client/_app/immutable/chunks/HouQR_BO.js.gz +0 -0
- package/build/client/_app/immutable/chunks/IVrlObbe.js +0 -25
- package/build/client/_app/immutable/chunks/IVrlObbe.js.br +0 -0
- package/build/client/_app/immutable/chunks/IVrlObbe.js.gz +0 -0
- package/build/client/_app/immutable/entry/app.Dj3HhwA8.js +0 -2
- package/build/client/_app/immutable/entry/app.Dj3HhwA8.js.br +0 -0
- package/build/client/_app/immutable/entry/app.Dj3HhwA8.js.gz +0 -0
- package/build/client/_app/immutable/entry/start.DhjCZi9N.js +0 -1
- package/build/client/_app/immutable/entry/start.DhjCZi9N.js.br +0 -2
- package/build/client/_app/immutable/entry/start.DhjCZi9N.js.gz +0 -0
- package/build/client/_app/immutable/nodes/0.CAbelkQT.js +0 -1
- package/build/client/_app/immutable/nodes/0.CAbelkQT.js.br +0 -0
- package/build/client/_app/immutable/nodes/0.CAbelkQT.js.gz +0 -0
- package/build/client/_app/immutable/nodes/1.DYaH4O8k.js +0 -1
- package/build/client/_app/immutable/nodes/1.DYaH4O8k.js.br +0 -0
- package/build/client/_app/immutable/nodes/1.DYaH4O8k.js.gz +0 -0
- package/build/client/_app/immutable/nodes/2.VvV6w9cZ.js +0 -5
- package/build/client/_app/immutable/nodes/2.VvV6w9cZ.js.br +0 -0
- package/build/client/_app/immutable/nodes/2.VvV6w9cZ.js.gz +0 -0
- package/build/client/_app/immutable/nodes/3.D_uYLiIh.js +0 -4
- package/build/client/_app/immutable/nodes/3.D_uYLiIh.js.br +0 -0
- package/build/client/_app/immutable/nodes/3.D_uYLiIh.js.gz +0 -0
- package/build/server/chunks/0-CWHakFRJ.js +0 -17
- package/build/server/chunks/0-CWHakFRJ.js.map +0 -1
- package/build/server/chunks/2-DrysGJ9C.js +0 -9
- package/build/server/chunks/2-DrysGJ9C.js.map +0 -1
- package/build/server/chunks/3-D4BIPCPc.js +0 -9
- package/build/server/chunks/3-D4BIPCPc.js.map +0 -1
- package/build/server/chunks/Toast-CTZhGpnd.js +0 -45
- package/build/server/chunks/Toast-CTZhGpnd.js.map +0 -1
- package/build/server/chunks/_layout.svelte-D9DyGgZM.js +0 -61
- package/build/server/chunks/_layout.svelte-D9DyGgZM.js.map +0 -1
- package/build/server/chunks/_page.svelte-Bgd-L7N_.js.map +0 -1
- package/build/server/chunks/_page.svelte-C7sseaTW.js.map +0 -1
- package/build/server/chunks/config-DKyxRWWg.js +0 -20
- package/build/server/chunks/config-DKyxRWWg.js.map +0 -1
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
var mp=Object.defineProperty;var ul=e=>{throw TypeError(e)};var _p=(e,t,r)=>t in e?mp(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var h=(e,t,r)=>_p(e,typeof t!="symbol"?t+"":t,r),fl=(e,t,r)=>t.has(e)||ul("Cannot "+r);var hl=(e,t,r)=>(fl(e,t,"read from private field"),r?r.call(e):t.get(e)),dl=(e,t,r)=>t.has(e)?ul("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r),gl=(e,t,r,n)=>(fl(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r);import{i as bp,b as vp,d as Wt,n as yp,g as kp,c as fe,a as S,f as M,s as P,e as Cr,t as _r}from"./Cyo3OVYg.js";import{aM as Lo,aN as If,aO as xp,k as Ye,P as Tf,aP as Sp,j as Do,aQ as pl,S as Rf,q as Zs,T as qa,n as yr,V as Bo,aq as Gn,ai as li,_ as za,aR as wp,ak as Ip,aS as Tp,aT as Rp,af as Cp,aU as Cf,i as ka,l as Ep,g as u,a7 as Op,R as Mp,v as Ls,C as Ap,aK as Np,I as Zr,aV as ir,M as rs,O as Fp,aI as Uo,aW as Pp,aX as $p,aY as jp,J as Ef,L as Of,aZ as xa,m as Lp,aH as Dp,K as ui,a_ as Mf,a$ as Bp,Q as Up,b0 as Af,w as Nf,b1 as qp,b2 as zp,X as Vp,b3 as Hp,b4 as Kp,b5 as Jp,b6 as Gp,b7 as Wp,b8 as Yp,b9 as Qp,ba as Ff,ag as Pf,A as $f,U as jf,bb as Zp,bc as Xp,bd as em,a1 as tm,p as fr,f as re,b as hr,d as x,r as v,c as A,t as U,s as tt,a as fi,z as en,e as H,u as z,be as rm,ar as Sa,bf as nm}from"./Dz2P4HIo.js";import{B as Lf,p as Ke,i as L,b as qo,r as sm,s as im,a as am}from"./CbJths_J.js";const om=[];function cm(e,t=!1,r=!1){return Xs(e,new Map,"",om,null,r)}function Xs(e,t,r,n,s=null,i=!1){if(typeof e=="object"&&e!==null){var a=t.get(e);if(a!==void 0)return a;if(e instanceof Map)return new Map(e);if(e instanceof Set)return new Set(e);if(Lo(e)){var o=Array(e.length);t.set(e,o),s!==null&&t.set(s,o);for(var c=0;c<e.length;c+=1){var l=e[c];c in e&&(o[c]=Xs(l,t,r,n,null,i))}return o}if(If(e)===xp){o={},t.set(e,o),s!==null&&t.set(s,o);for(var f in e)o[f]=Xs(e[f],t,r,n,null,i);return o}if(e instanceof Date)return structuredClone(e);if(typeof e.toJSON=="function"&&!i)return Xs(e.toJSON(),t,r,n,e)}if(e instanceof EventTarget)return e;try{return structuredClone(e)}catch{return e}}const ml=0,wa=1;function Va(e,t,r,n,s){Ye&&Tf();var i=Sp(),a=Cf,o=i?li(a):za(a,!1,!1),c=i?li(a):za(a,!1,!1),l=new Lf(e);Do(()=>{var f=t(),p=!1;let d=Ye&&pl(f)===(e.data===Rf);if(d&&(Zs(qa()),yr(!1)),pl(f)){var g=wp(),_=!1;const k=b=>{if(!p){_=!0,g(!1),Ip.ensure(),Ye&&yr(!1);try{b()}finally{Tp(),Rp||Cp()}}};f.then(b=>{k(()=>{Gn(o,b),l.ensure(wa,n&&(w=>n(w,o)))})},b=>{k(()=>{if(Gn(c,b),l.ensure(wa,s&&(w=>s(w,c))),!s)throw c.v})}),Ye?l.ensure(ml,r):Bo(()=>{_||k(()=>{l.ensure(ml,r)})})}else Gn(o,f),l.ensure(wa,n&&(k=>n(k,o)));return d&&yr(!0),()=>{p=!0}})}function qt(e,t){return t}function lm(e,t,r){for(var n=[],s=t.length,i,a=t.length,o=0;o<s;o++){let p=t[o];Of(p,()=>{if(i){if(i.pending.delete(p),i.done.add(p),i.pending.size===0){var d=e.outrogroups;Ha(Uo(i.done)),d.delete(i),d.size===0&&(e.outrogroups=null)}}else a-=1},!1)}if(a===0){var c=n.length===0&&r!==null;if(c){var l=r,f=l.parentNode;Dp(f),f.append(l),e.items.clear()}Ha(t,!c)}else i={pending:new Set(t),done:new Set},(e.outrogroups??(e.outrogroups=new Set)).add(i)}function Ha(e,t=!0){for(var r=0;r<e.length;r++)ui(e[r],t)}var _l;function Ct(e,t,r,n,s,i=null){var a=e,o=new Map,c=(t&Mf)!==0;if(c){var l=e;a=Ye?Zs(Ep(l)):l.appendChild(ka())}Ye&&Tf();var f=null,p=Op(()=>{var w=r();return Lo(w)?w:w==null?[]:Uo(w)}),d,g=!0;function _(){b.fallback=f,um(b,d,a,t,n),f!==null&&(d.length===0?(f.f&ir)===0?Ef(f):(f.f^=ir,Hn(f,null,a)):Of(f,()=>{f=null}))}var k=Do(()=>{d=u(p);var w=d.length;let $=!1;if(Ye){var B=Mp(a)===Rf;B!==(w===0)&&(a=qa(),Zs(a),yr(!1),$=!0)}for(var O=new Set,D=Zr,N=Fp(),I=0;I<w;I+=1){Ye&&Ls.nodeType===Ap&&Ls.data===Np&&(a=Ls,$=!0,yr(!1));var m=d[I],C=n(m,I),E=g?null:o.get(C);E?(E.v&&Gn(E.v,m),E.i&&Gn(E.i,I),N&&D.skipped_effects.delete(E.e)):(E=fm(o,g?a:_l??(_l=ka()),m,C,I,s,t,r),g||(E.e.f|=ir),o.set(C,E)),O.add(C)}if(w===0&&i&&!f&&(g?f=rs(()=>i(a)):(f=rs(()=>i(_l??(_l=ka()))),f.f|=ir)),Ye&&w>0&&Zs(qa()),!g)if(N){for(const[R,j]of o)O.has(R)||D.skipped_effects.add(j.e);D.oncommit(_),D.ondiscard(()=>{})}else _();$&&yr(!0),u(p)}),b={effect:k,items:o,outrogroups:null,fallback:f};g=!1,Ye&&(a=Ls)}function um(e,t,r,n,s){var E,R,j,ie,Y,ke,ue,_e,st;var i=(n&Bp)!==0,a=t.length,o=e.items,c=e.effect.first,l,f=null,p,d=[],g=[],_,k,b,w;if(i)for(w=0;w<a;w+=1)_=t[w],k=s(_,w),b=o.get(k).e,(b.f&ir)===0&&((R=(E=b.nodes)==null?void 0:E.a)==null||R.measure(),(p??(p=new Set)).add(b));for(w=0;w<a;w+=1){if(_=t[w],k=s(_,w),b=o.get(k).e,e.outrogroups!==null)for(const Me of e.outrogroups)Me.pending.delete(b),Me.done.delete(b);if((b.f&ir)!==0)if(b.f^=ir,b===c)Hn(b,null,r);else{var $=f?f.next:c;b===e.effect.last&&(e.effect.last=b.prev),b.prev&&(b.prev.next=b.next),b.next&&(b.next.prev=b.prev),pr(e,f,b),pr(e,b,$),Hn(b,$,r),f=b,d=[],g=[],c=f.next;continue}if((b.f&xa)!==0&&(Ef(b),i&&((ie=(j=b.nodes)==null?void 0:j.a)==null||ie.unfix(),(p??(p=new Set)).delete(b))),b!==c){if(l!==void 0&&l.has(b)){if(d.length<g.length){var B=g[0],O;f=B.prev;var D=d[0],N=d[d.length-1];for(O=0;O<d.length;O+=1)Hn(d[O],B,r);for(O=0;O<g.length;O+=1)l.delete(g[O]);pr(e,D.prev,N.next),pr(e,f,D),pr(e,N,B),c=B,f=N,w-=1,d=[],g=[]}else l.delete(b),Hn(b,c,r),pr(e,b.prev,b.next),pr(e,b,f===null?e.effect.first:f.next),pr(e,f,b),f=b;continue}for(d=[],g=[];c!==null&&c!==b;)(l??(l=new Set)).add(c),g.push(c),c=c.next;if(c===null)continue}(b.f&ir)===0&&d.push(b),f=b,c=b.next}if(e.outrogroups!==null){for(const Me of e.outrogroups)Me.pending.size===0&&(Ha(Uo(Me.done)),(Y=e.outrogroups)==null||Y.delete(Me));e.outrogroups.size===0&&(e.outrogroups=null)}if(c!==null||l!==void 0){var I=[];if(l!==void 0)for(b of l)(b.f&xa)===0&&I.push(b);for(;c!==null;)(c.f&xa)===0&&c!==e.fallback&&I.push(c),c=c.next;var m=I.length;if(m>0){var C=(n&Mf)!==0&&a===0?r:null;if(i){for(w=0;w<m;w+=1)(ue=(ke=I[w].nodes)==null?void 0:ke.a)==null||ue.measure();for(w=0;w<m;w+=1)(st=(_e=I[w].nodes)==null?void 0:_e.a)==null||st.fix()}lm(e,I,C)}}i&&Bo(()=>{var Me,Ge;if(p!==void 0)for(b of p)(Ge=(Me=b.nodes)==null?void 0:Me.a)==null||Ge.apply()})}function fm(e,t,r,n,s,i,a,o){var c=(a&Pp)!==0?(a&$p)===0?za(r,!1,!1):li(r):null,l=(a&jp)!==0?li(s):null;return{v:c,i:l,e:rs(()=>(i(t,c??r,l??s,o),()=>{e.delete(n)}))}}function Hn(e,t,r){if(e.nodes)for(var n=e.nodes.start,s=e.nodes.end,i=t&&(t.f&ir)===0?t.nodes.start:r;n!==null;){var a=Lp(n);if(i.before(n),n===s)return;n=a}}function pr(e,t,r){t===null?e.effect.first=r:t.next=r,r===null?e.effect.last=t:r.prev=t}function hm(e,t,...r){var n=new Lf(e);Do(()=>{const s=t()??null;n.ensure(s,s&&(i=>s(i,...r)))},Up)}function dm(e,t){var r=void 0,n;Af(()=>{r!==(r=t())&&(n&&(ui(n),n=null),r&&(n=rs(()=>{Nf(()=>r(e))})))})}function Df(e){var t,r,n="";if(typeof e=="string"||typeof e=="number")n+=e;else if(typeof e=="object")if(Array.isArray(e)){var s=e.length;for(t=0;t<s;t++)e[t]&&(r=Df(e[t]))&&(n&&(n+=" "),n+=r)}else for(r in e)e[r]&&(n&&(n+=" "),n+=r);return n}function gm(){for(var e,t,r=0,n="",s=arguments.length;r<s;r++)(e=arguments[r])&&(t=Df(e))&&(n&&(n+=" "),n+=t);return n}function zo(e){return typeof e=="object"?gm(e):e??""}const bl=[...`
|
|
2
|
+
\r\f \v\uFEFF`];function pm(e,t,r){var n=e==null?"":""+e;if(t&&(n=n?n+" "+t:t),r){for(var s in r)if(r[s])n=n?n+" "+s:s;else if(n.length)for(var i=s.length,a=0;(a=n.indexOf(s,a))>=0;){var o=a+i;(a===0||bl.includes(n[a-1]))&&(o===n.length||bl.includes(n[o]))?n=(a===0?"":n.substring(0,a))+n.substring(o+1):a=o}}return n===""?null:n}function vl(e,t=!1){var r=t?" !important;":";",n="";for(var s in e){var i=e[s];i!=null&&i!==""&&(n+=" "+s+": "+i+r)}return n}function Ia(e){return e[0]!=="-"||e[1]!=="-"?e.toLowerCase():e}function mm(e,t){if(t){var r="",n,s;if(Array.isArray(t)?(n=t[0],s=t[1]):n=t,e){e=String(e).replaceAll(/\s*\/\*.*?\*\/\s*/g,"").trim();var i=!1,a=0,o=!1,c=[];n&&c.push(...Object.keys(n).map(Ia)),s&&c.push(...Object.keys(s).map(Ia));var l=0,f=-1;const k=e.length;for(var p=0;p<k;p++){var d=e[p];if(o?d==="/"&&e[p-1]==="*"&&(o=!1):i?i===d&&(i=!1):d==="/"&&e[p+1]==="*"?o=!0:d==='"'||d==="'"?i=d:d==="("?a++:d===")"&&a--,!o&&i===!1&&a===0){if(d===":"&&f===-1)f=p;else if(d===";"||p===k-1){if(f!==-1){var g=Ia(e.substring(l,f).trim());if(!c.includes(g)){d!==";"&&p++;var _=e.substring(l,p).trim();r+=" "+_+";"}}l=p+1,f=-1}}}}return n&&(r+=vl(n)),s&&(r+=vl(s,!0)),r=r.trim(),r===""?null:r}return e==null?null:String(e)}function $e(e,t,r,n,s,i){var a=e.__className;if(Ye||a!==r||a===void 0){var o=pm(r,n,i);(!Ye||o!==e.getAttribute("class"))&&(o==null?e.removeAttribute("class"):t?e.className=o:e.setAttribute("class",o)),e.__className=r}else if(i&&s!==i)for(var c in i){var l=!!i[c];(s==null||l!==!!s[c])&&e.classList.toggle(c,l)}return i}function Ta(e,t={},r,n){for(var s in r){var i=r[s];t[s]!==i&&(r[s]==null?e.style.removeProperty(s):e.style.setProperty(s,i,n))}}function Bf(e,t,r,n){var s=e.__style;if(Ye||s!==t){var i=mm(t,n);(!Ye||i!==e.getAttribute("style"))&&(i==null?e.removeAttribute("style"):e.style.cssText=i),e.__style=t}else n&&(Array.isArray(n)?(Ta(e,r==null?void 0:r[0],n[0]),Ta(e,r==null?void 0:r[1],n[1],"important")):Ta(e,r,n));return n}function Ka(e,t,r=!1){if(e.multiple){if(t==null)return;if(!Lo(t))return qp();for(var n of e.options)n.selected=t.includes(yl(n));return}for(n of e.options){var s=yl(n);if(zp(s,t)){n.selected=!0;return}}(!r||t!==void 0)&&(e.selectedIndex=-1)}function _m(e){var t=new MutationObserver(()=>{Ka(e,e.__value)});t.observe(e,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["value"]}),Vp(()=>{t.disconnect()})}function yl(e){return"__value"in e?e.__value:e.value}const Ds=Symbol("class"),$n=Symbol("style"),Uf=Symbol("is custom element"),qf=Symbol("is html");function zf(e){if(Ye){var t=!1,r=()=>{if(!t){if(t=!0,e.hasAttribute("value")){var n=e.value;Pe(e,"value",null),e.value=n}if(e.hasAttribute("checked")){var s=e.checked;Pe(e,"checked",null),e.checked=s}}};e.__on_r=r,Bo(r),Hp()}}function XT(e,t){var r=Vo(e);r.value===(r.value=t??void 0)||e.value===t&&(t!==0||e.nodeName!=="PROGRESS")||(e.value=t??"")}function bm(e,t){t?e.hasAttribute("selected")||e.setAttribute("selected",""):e.removeAttribute("selected")}function Pe(e,t,r,n){var s=Vo(e);Ye&&(s[t]=e.getAttribute(t),t==="src"||t==="srcset"||t==="href"&&e.nodeName==="LINK")||s[t]!==(s[t]=r)&&(t==="loading"&&(e[Kp]=r),r==null?e.removeAttribute(t):typeof r!="string"&&Vf(e).includes(t)?e[t]=r:e.setAttribute(t,r))}function vm(e,t,r,n,s=!1,i=!1){if(Ye&&s&&e.tagName==="INPUT"){var a=e,o=a.type==="checkbox"?"defaultChecked":"defaultValue";o in r||zf(a)}var c=Vo(e),l=c[Uf],f=!c[qf];let p=Ye&&l;p&&yr(!1);var d=t||{},g=e.tagName==="OPTION";for(var _ in t)_ in r||(r[_]=null);r.class?r.class=zo(r.class):r.class=null,r[$n]&&(r.style??(r.style=null));var k=Vf(e);for(const N in r){let I=r[N];if(g&&N==="value"&&I==null){e.value=e.__value="",d[N]=I;continue}if(N==="class"){var b=e.namespaceURI==="http://www.w3.org/1999/xhtml";$e(e,b,I,n,t==null?void 0:t[Ds],r[Ds]),d[N]=I,d[Ds]=r[Ds];continue}if(N==="style"){Bf(e,I,t==null?void 0:t[$n],r[$n]),d[N]=I,d[$n]=r[$n];continue}var w=d[N];if(!(I===w&&!(I===void 0&&e.hasAttribute(N)))){d[N]=I;var $=N[0]+N[1];if($!=="$$")if($==="on"){const m={},C="$$"+N;let E=N.slice(2);var B=kp(E);if(bp(E)&&(E=E.slice(0,-7),m.capture=!0),!B&&w){if(I!=null)continue;e.removeEventListener(E,d[C],m),d[C]=null}if(I!=null)if(B)e[`__${E}`]=I,Wt([E]);else{let R=function(j){d[N].call(this,j)};d[C]=vp(E,e,R,m)}else B&&(e[`__${E}`]=void 0)}else if(N==="style")Pe(e,N,I);else if(N==="autofocus")Qp(e,!!I);else if(!l&&(N==="__value"||N==="value"&&I!=null))e.value=e.__value=I;else if(N==="selected"&&g)bm(e,I);else{var O=N;f||(O=yp(O));var D=O==="defaultValue"||O==="defaultChecked";if(I==null&&!l&&!D)if(c[N]=null,O==="value"||O==="checked"){let m=e;const C=t===void 0;if(O==="value"){let E=m.defaultValue;m.removeAttribute(O),m.defaultValue=E,m.value=m.__value=C?E:null}else{let E=m.defaultChecked;m.removeAttribute(O),m.defaultChecked=E,m.checked=C?E:!1}}else e.removeAttribute(N);else D||k.includes(O)&&(l||typeof I!="string")?(e[O]=I,O in c&&(c[O]=Cf)):typeof I!="function"&&Pe(e,O,I)}}}return p&&yr(!0),d}function ym(e,t,r=[],n=[],s=[],i,a=!1,o=!1){Wp(s,r,n,c=>{var l=void 0,f={},p=e.nodeName==="SELECT",d=!1;if(Af(()=>{var _=t(...c.map(u)),k=vm(e,l,_,i,a,o);d&&p&&"value"in _&&Ka(e,_.value);for(let w of Object.getOwnPropertySymbols(f))_[w]||ui(f[w]);for(let w of Object.getOwnPropertySymbols(_)){var b=_[w];w.description===Yp&&(!l||b!==l[w])&&(f[w]&&ui(f[w]),f[w]=rs(()=>dm(e,()=>b))),k[w]=b}l=k}),p){var g=e;Nf(()=>{Ka(g,l.value,!0),_m(g)})}d=!0})}function Vo(e){return e.__attributes??(e.__attributes={[Uf]:e.nodeName.includes("-"),[qf]:e.namespaceURI===Jp})}var kl=new Map;function Vf(e){var t=e.getAttribute("is")||e.nodeName,r=kl.get(t);if(r)return r;kl.set(t,r=[]);for(var n,s=e,i=Element.prototype;i!==s;){n=Gp(s);for(var a in n)n[a].set&&r.push(a);s=If(s)}return r}function km(e,t,r=t){var n=new WeakSet;Ff(e,"input",async s=>{var i=s?e.defaultValue:e.value;if(i=Ra(e)?Ca(i):i,r(i),Zr!==null&&n.add(Zr),await Pf(),i!==(i=t())){var a=e.selectionStart,o=e.selectionEnd,c=e.value.length;if(e.value=i??"",o!==null){var l=e.value.length;a===o&&o===c&&l>c?(e.selectionStart=l,e.selectionEnd=l):(e.selectionStart=a,e.selectionEnd=Math.min(o,l))}}}),(Ye&&e.defaultValue!==e.value||$f(t)==null&&e.value)&&(r(Ra(e)?Ca(e.value):e.value),Zr!==null&&n.add(Zr)),jf(()=>{var s=t();if(e===document.activeElement){var i=Zp??Zr;if(n.has(i))return}Ra(e)&&s===Ca(e.value)||e.type==="date"&&!s&&!e.value||s!==e.value&&(e.value=s??"")})}function eR(e,t,r=t){Ff(e,"change",n=>{var s=n?e.defaultChecked:e.checked;r(s)}),(Ye&&e.defaultChecked!==e.checked||$f(t)==null)&&r(e.checked),jf(()=>{var n=t();e.checked=!!n})}function Ra(e){var t=e.type;return t==="number"||t==="range"}function Ca(e){return e===""?null:+e}const Di="/api",er=async e=>{const t=await fetch(`${Di}${e}`);if(!t.ok)throw new Error(await t.text());return t.json()},dr=async(e,t)=>{const r=await fetch(`${Di}${e}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});if(!r.ok)throw new Error(await r.text());return r.json()},Hf=async e=>{const t=await fetch(`${Di}${e}`,{method:"DELETE"});if(!t.ok)throw new Error(await t.text());return t.json()},xm=async(e,t)=>{const r=await fetch(`${Di}${e}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});if(!r.ok)throw new Error(await r.text());return r.json()},tR=()=>er("/projects"),rR=e=>er(`/sessions?project=${encodeURIComponent(e)}`),nR=(e,t)=>er(`/session?project=${encodeURIComponent(e)}&id=${encodeURIComponent(t)}`),sR=(e,t)=>Hf(`/session?project=${encodeURIComponent(e)}&id=${encodeURIComponent(t)}`),iR=(e,t,r)=>dr("/session/rename",{project:e,id:t,title:r}),Sm=(e,t,r)=>Hf(`/message?project=${encodeURIComponent(e)}&session=${encodeURIComponent(t)}&uuid=${encodeURIComponent(r)}`),wm=(e,t,r,n)=>dr(`/message?project=${encodeURIComponent(e)}&session=${encodeURIComponent(t)}`,{message:r,index:n}),aR=(e,t,r,n)=>xm(`/message?project=${encodeURIComponent(e)}&session=${encodeURIComponent(t)}&uuid=${encodeURIComponent(r)}`,{customTitle:n}),oR=e=>er("/cleanup"),cR=e=>dr("/cleanup",e),lR=()=>er("/version"),uR=()=>dr("/shutdown",{}),Im=(e,t)=>dr("/open-file",{sessionId:e,backupFileName:t}),Ho=e=>dr("/open-file",{filePath:e}),fR=(e,t,r)=>dr("/session/split",{project:e,sessionId:t,messageUuid:r}),hR=(e,t,r)=>dr("/session/move",{sourceProject:e,sessionId:t,targetProject:r}),Ja=async e=>{try{return(await er(`/file-exists?path=${encodeURIComponent(e)}`)).exists}catch{return!1}},dR=(e,t)=>{const r=new URLSearchParams({q:e});return t!=null&&t.project&&r.set("project",t.project),t!=null&&t.searchContent&&r.set("content","true"),er(`/search?${r}`)},gR=e=>er(`/project/expand?project=${encodeURIComponent(e)}`),pR=(e,t)=>er(`/session/tree-data?project=${encodeURIComponent(e)}&id=${encodeURIComponent(t)}`),Tm=(e,t,r)=>er(`/agent/messages?project=${encodeURIComponent(e)}&session=${encodeURIComponent(t)}&agent=${encodeURIComponent(r)}`),mR=(e,t)=>dr("/session/resume",{projectName:e,sessionId:t}),Rm={},Kf=Object.freeze(Object.defineProperty({__proto__:null,default:Rm},Symbol.toStringTag,{value:"Module"})),Cm=e=>typeof e=="function",y=function(e,t){if(typeof e=="function")return function(){return e(arguments)?t.apply(this,arguments):r=>t(r,...arguments)};switch(e){case 0:case 1:throw new RangeError(`Invalid arity ${e}`);case 2:return function(r,n){return arguments.length>=2?t(r,n):function(s){return t(s,r)}};case 3:return function(r,n,s){return arguments.length>=3?t(r,n,s):function(i){return t(i,r,n)}};case 4:return function(r,n,s,i){return arguments.length>=4?t(r,n,s,i):function(a){return t(a,r,n,s)}};case 5:return function(r,n,s,i,a){return arguments.length>=5?t(r,n,s,i,a):function(o){return t(o,r,n,s,i)}};default:return function(){if(arguments.length>=e)return t.apply(this,arguments);const r=arguments;return function(n){return t(n,...r)}}}},je=e=>e,Bi=e=>()=>e,xl=Bi(!0),Ga=Bi(!1),Jf=Bi(void 0),Em=Jf;function T(e,t,r,n,s,i,a,o,c){switch(arguments.length){case 1:return e;case 2:return t(e);case 3:return r(t(e));case 4:return n(r(t(e)));case 5:return s(n(r(t(e))));case 6:return i(s(n(r(t(e)))));case 7:return a(i(s(n(r(t(e))))));case 8:return o(a(i(s(n(r(t(e)))))));case 9:return c(o(a(i(s(n(r(t(e))))))));default:{let l=arguments[0];for(let f=1;f<arguments.length;f++)l=arguments[f](l);return l}}}const Ko=e=>(t,r)=>t===r||e(t,r),Om=y(2,(e,t)=>Ko((r,n)=>e(t(r),t(n)))),Mm=e=>Ko((t,r)=>{if(t.length!==r.length)return!1;for(let n=0;n<t.length;n++)if(!e(t[n],r[n]))return!1;return!0}),Bs="effect/GlobalValue";let jn;const ye=(e,t)=>(jn||(globalThis[Bs]??(globalThis[Bs]=new Map),jn=globalThis[Bs]),jn.has(e)||jn.set(e,t()),jn.get(e)),Am=e=>typeof e=="string",Wa=e=>typeof e=="number",Nm=e=>typeof e=="bigint",Ui=Cm,Fm=e=>typeof e=="object"&&e!==null,qi=e=>Fm(e)||Ui(e),le=y(2,(e,t)=>qi(e)&&t in e),Gf=y(2,(e,t)=>le(e,"_tag")&&e._tag===t),Wr=e=>e==null,Wf=e=>typeof e=="string"||le(e,Symbol.iterator),Pm=e=>le(e,"then")&&Ui(e.then),zi=e=>`BUG: ${e} - please report an issue at https://github.com/Effect-TS/effect/issues`;let Yf=class Qf{constructor(t){h(this,"self");h(this,"called",!1);this.self=t}next(t){return this.called?{value:t,done:!0}:(this.called=!0,{value:this.self,done:!1})}return(t){return{value:t,done:!0}}throw(t){throw t}[Symbol.iterator](){return new Qf(this.self)}};const $m=335903614,jm=4150755663,Lm=1481765933,Dm=1284865837,Bm=9007199254740992,Um=134217728;class qm{constructor(t,r,n,s){h(this,"_state");return Wr(r)&&Wr(t)?(r=Math.random()*4294967295>>>0,t=0):Wr(r)&&(r=t,t=0),Wr(s)&&Wr(n)?(s=this._state?this._state[3]:jm,n=this._state?this._state[2]:$m):Wr(s)&&(s=n,n=0),this._state=new Int32Array([0,0,n>>>0,((s||0)|1)>>>0]),this._next(),Sl(this._state,this._state[0],this._state[1],t>>>0,r>>>0),this._next(),this}getState(){return[this._state[0],this._state[1],this._state[2],this._state[3]]}setState(t){this._state[0]=t[0],this._state[1]=t[1],this._state[2]=t[2],this._state[3]=t[3]|1}integer(t){return Math.round(this.number()*Number.MAX_SAFE_INTEGER)%t}number(){const t=(this._next()&67108863)*1,r=(this._next()&134217727)*1;return(t*Um+r)/Bm}_next(){const t=this._state[0]>>>0,r=this._state[1]>>>0;zm(this._state,t,r,Lm,Dm),Sl(this._state,this._state[0],this._state[1],this._state[2],this._state[3]);let n=t>>>18,s=(r>>>18|t<<14)>>>0;n=(n^t)>>>0,s=(s^r)>>>0;const i=(s>>>27|n<<5)>>>0,a=t>>>27,o=(-a>>>0&31)>>>0;return(i>>>a|i<<o)>>>0}}function zm(e,t,r,n,s){let i=(r>>>16)*(s&65535)>>>0,a=(r&65535)*(s>>>16)>>>0,o=(r&65535)*(s&65535)>>>0,c=(r>>>16)*(s>>>16)+((a>>>16)+(i>>>16))>>>0;a=a<<16>>>0,o=o+a>>>0,o>>>0<a>>>0&&(c=c+1>>>0),i=i<<16>>>0,o=o+i>>>0,o>>>0<i>>>0&&(c=c+1>>>0),c=c+Math.imul(r,n)>>>0,c=c+Math.imul(t,s)>>>0,e[0]=c,e[1]=o}function Sl(e,t,r,n,s){let i=t+n>>>0;const a=r+s>>>0;a>>>0<r>>>0&&(i=i+1|0),e[0]=i,e[1]=a}const Ya=Symbol.for("effect/Utils/YieldWrap");var gs;class ps{constructor(t){dl(this,gs);gl(this,gs,t)}[Ya](){return hl(this,gs)}}gs=new WeakMap;function Vm(e){if(typeof e=="object"&&e!==null&&Ya in e)return e[Ya]();throw new Error(zi("yieldWrapGet"))}const Nt=ye("effect/Utils/isStructuralRegion",()=>({enabled:!1,tester:void 0})),Zf={effect_internal_function:e=>e()},Hm={effect_internal_function:e=>{try{return e()}finally{}}};var ju;const Km=((ju=Zf.effect_internal_function(()=>new Error().stack))==null?void 0:ju.includes("effect_internal_function"))===!0,vt=Km?Zf.effect_internal_function:Hm.effect_internal_function,Ea=ye(Symbol.for("effect/Hash/randomHashCache"),()=>new WeakMap),oe=Symbol.for("effect/Hash"),q=e=>{if(Nt.enabled===!0)return 0;switch(typeof e){case"number":return Go(e);case"bigint":return He(e.toString(10));case"boolean":return He(String(e));case"symbol":return He(String(e));case"string":return He(e);case"undefined":return He("undefined");case"function":case"object":return e===null?He("null"):e instanceof Date?Number.isNaN(e.getTime())?He("Invalid Date"):q(e.toISOString()):e instanceof URL?q(e.href):Jm(e)?e[oe]():Jo(e);default:throw new Error(`BUG: unhandled typeof ${typeof e} - please report an issue at https://github.com/Effect-TS/effect/issues`)}},Jo=e=>(Ea.has(e)||Ea.set(e,Go(Math.floor(Math.random()*Number.MAX_SAFE_INTEGER))),Ea.get(e)),ge=e=>t=>t*53^e,Vi=e=>e&3221225471|e>>>1&1073741824,Jm=e=>le(e,oe),Go=e=>{if(e!==e||e===1/0)return 0;let t=e|0;for(t!==e&&(t^=e*4294967295);e>4294967295;)t^=e/=4294967295;return Vi(t)},He=e=>{let t=5381,r=e.length;for(;r;)t=t*33^e.charCodeAt(--r);return Vi(t)},Gm=(e,t)=>{let r=12289;for(let n=0;n<t.length;n++)r^=T(He(t[n]),ge(q(e[t[n]])));return Vi(r)},Xf=e=>Gm(e,Object.keys(e)),ms=e=>{let t=6151;for(let r=0;r<e.length;r++)t=T(t,ge(q(e[r])));return Vi(t)},qe=function(){if(arguments.length===1){const r=arguments[0];return function(n){return Object.defineProperty(r,oe,{value(){return n},enumerable:!1}),n}}const e=arguments[0],t=arguments[1];return Object.defineProperty(e,oe,{value(){return t},enumerable:!1}),t},ae=Symbol.for("effect/Equal");function ce(){return arguments.length===1?e=>hi(e,arguments[0]):hi(arguments[0],arguments[1])}function hi(e,t){if(e===t)return!0;const r=typeof e;if(r!==typeof t)return!1;if(r==="object"||r==="function"){if(e!==null&&t!==null){if(di(e)&&di(t))return q(e)===q(t)&&e[ae](t)?!0:Nt.enabled&&Nt.tester?Nt.tester(e,t):!1;if(e instanceof Date&&t instanceof Date){const n=e.getTime(),s=t.getTime();return n===s||Number.isNaN(n)&&Number.isNaN(s)}else if(e instanceof URL&&t instanceof URL)return e.href===t.href}if(Nt.enabled){if(Array.isArray(e)&&Array.isArray(t))return e.length===t.length&&e.every((n,s)=>hi(n,t[s]));if(Object.getPrototypeOf(e)===Object.prototype&&Object.getPrototypeOf(e)===Object.prototype){const n=Object.keys(e),s=Object.keys(t);if(n.length===s.length){for(const i of n)if(!(i in t&&hi(e[i],t[i])))return Nt.tester?Nt.tester(e,t):!1;return!0}}return Nt.tester?Nt.tester(e,t):!1}}return Nt.enabled&&Nt.tester?Nt.tester(e,t):!1}const di=e=>le(e,ae),Wo=()=>ce,Je=Symbol.for("nodejs.util.inspect.custom"),nt=e=>{try{if(le(e,"toJSON")&&Ui(e.toJSON)&&e.toJSON.length===0)return e.toJSON();if(Array.isArray(e))return e.map(nt)}catch{return{}}return Ym(e)},ut=e=>JSON.stringify(e,null,2),an=(e,t=2)=>{if(typeof e=="string")return e;try{return typeof e=="object"?eh(e,t):String(e)}catch{return String(e)}},eh=(e,t)=>{let r=[];const n=JSON.stringify(e,(s,i)=>typeof i=="object"&&i!==null?r.includes(i)?void 0:r.push(i)&&(Ar.fiberRefs!==void 0&&th(i)?i[Yo](Ar.fiberRefs):i):i,t);return r=void 0,n},Yo=Symbol.for("effect/Inspectable/Redactable"),th=e=>typeof e=="object"&&e!==null&&Yo in e,Ar=ye("effect/Inspectable/redactableState",()=>({fiberRefs:void 0})),Wm=(e,t)=>{const r=Ar.fiberRefs;Ar.fiberRefs=e;try{return t()}finally{Ar.fiberRefs=r}},Ym=e=>th(e)&&Ar.fiberRefs!==void 0?e[Yo](Ar.fiberRefs):e,se=(e,t)=>{switch(t.length){case 0:return e;case 1:return t[0](e);case 2:return t[1](t[0](e));case 3:return t[2](t[1](t[0](e)));case 4:return t[3](t[2](t[1](t[0](e))));case 5:return t[4](t[3](t[2](t[1](t[0](e)))));case 6:return t[5](t[4](t[3](t[2](t[1](t[0](e))))));case 7:return t[6](t[5](t[4](t[3](t[2](t[1](t[0](e)))))));case 8:return t[7](t[6](t[5](t[4](t[3](t[2](t[1](t[0](e))))))));case 9:return t[8](t[7](t[6](t[5](t[4](t[3](t[2](t[1](t[0](e)))))))));default:{let r=e;for(let n=0,s=t.length;n<s;n++)r=t[n](r);return r}}},Wn="Async",Hi="Commit",Ht="Failure",Oa="OnFailure",gi="OnSuccess",pi="OnSuccessAndFailure",Kt="Success",rh="Sync",Qm="Tag",_s="UpdateRuntimeFlags",mi="While",Yn="Iterator",nh="WithRuntime",ei="Yield",Qo="RevertFlags";let Zm="3.19.12";const Zo=()=>Zm,Xm=Symbol.for("effect/Effect"),e_=Symbol.for("effect/Stream"),t_=Symbol.for("effect/Sink"),r_=Symbol.for("effect/Channel"),on={_R:e=>e,_E:e=>e,_A:e=>e,_V:Zo()},n_={_A:e=>e,_In:e=>e,_L:e=>e,_E:e=>e,_R:e=>e},s_={_Env:e=>e,_InErr:e=>e,_InElem:e=>e,_InDone:e=>e,_OutErr:e=>e,_OutElem:e=>e,_OutDone:e=>e},bs={[Xm]:on,[e_]:on,[t_]:n_,[r_]:s_,[ae](e){return this===e},[oe](){return qe(this,Jo(this))},[Symbol.iterator](){return new Yf(new ps(this))},pipe(){return se(this,arguments)}},Xo={[oe](){return qe(this,Xf(this))},[ae](e){const t=Object.keys(this),r=Object.keys(e);if(t.length!==r.length)return!1;for(const n of t)if(!(n in e&&ce(this[n],e[n])))return!1;return!0}},vs={...bs,_op:Hi},i_={...vs,...Xo},a_=(function(){function e(){}return e.prototype=vs,e})(),sh=Symbol.for("effect/Option"),ih={...bs,[sh]:{_A:e=>e},[Je](){return this.toJSON()},toString(){return ut(this.toJSON())}},o_=Object.assign(Object.create(ih),{_tag:"Some",_op:"Some",[ae](e){return ah(e)&&ch(e)&&ce(this.value,e.value)},[oe](){return qe(this,ge(q(this._tag))(q(this.value)))},toJSON(){return{_id:"Option",_tag:this._tag,value:nt(this.value)}}}),c_=q("None"),l_=Object.assign(Object.create(ih),{_tag:"None",_op:"None",[ae](e){return ah(e)&&oh(e)},[oe](){return c_},toJSON(){return{_id:"Option",_tag:this._tag}}}),ah=e=>le(e,sh),oh=e=>e._tag==="None",ch=e=>e._tag==="Some",lh=Object.create(l_),Qa=e=>{const t=Object.create(o_);return t.value=e,t},uh=Symbol.for("effect/Either"),fh={...bs,[uh]:{_R:e=>e},[Je](){return this.toJSON()},toString(){return ut(this.toJSON())}},u_=Object.assign(Object.create(fh),{_tag:"Right",_op:"Right",[ae](e){return hh(e)&&gh(e)&&ce(this.right,e.right)},[oe](){return ge(q(this._tag))(q(this.right))},toJSON(){return{_id:"Either",_tag:this._tag,right:nt(this.right)}}}),f_=Object.assign(Object.create(fh),{_tag:"Left",_op:"Left",[ae](e){return hh(e)&&dh(e)&&ce(this.left,e.left)},[oe](){return ge(q(this._tag))(q(this.left))},toJSON(){return{_id:"Either",_tag:this._tag,left:nt(this.left)}}}),hh=e=>le(e,uh),dh=e=>e._tag==="Left",gh=e=>e._tag==="Right",h_=e=>{const t=Object.create(f_);return t.left=e,t},d_=e=>{const t=Object.create(u_);return t.right=e,t},ar=d_,cn=h_,Kn=dh,Us=gh,g_=y(2,(e,{onLeft:t,onRight:r})=>Kn(e)?t(e.left):r(e.right)),p_=g_({onLeft:je,onRight:je}),ph=e=>e.length>0,mh=e=>(t,r)=>t===r?0:e(t,r),m_=mh((e,t)=>e<t?-1:1),__=y(2,(e,t)=>mh((r,n)=>e(t(r),t(n)))),b_=e=>y(2,(t,r)=>e(t,r)===1),ne=()=>lh,he=Qa,xt=oh,Zt=ch,Hr=y(2,(e,{onNone:t,onSome:r})=>xt(e)?t():r(e.value)),$r=y(2,(e,t)=>xt(e)?t():e.value),v_=y(2,(e,t)=>xt(e)?he(t()):e),ec=e=>e==null?ne():he(e),Tr=$r(Jf),y_=y(2,(e,t)=>xt(e)?ne():he(t(e.value))),k_=y(2,(e,t)=>xt(e)?ne():t(e.value)),x_=e=>y(2,(t,r)=>xt(t)?!1:e(t.value,r)),S_=Wo(),w_=x_(S_),I_=(...e)=>e,tc=e=>new Array(e),T_=y(2,(e,t)=>{const r=Math.max(1,Math.floor(e)),n=new Array(r);for(let s=0;s<r;s++)n[s]=t(s);return n}),Qe=e=>Array.isArray(e)?e:Array.from(e),R_=e=>Array.isArray(e)?e:[e],_i=y(2,(e,t)=>[t,...e]),C_=y(2,(e,t)=>[...e,t]),_h=y(2,(e,t)=>Qe(e).concat(Qe(t))),E_=e=>e.length===0,O_=E_,M_=ph,Et=ph,bh=(e,t)=>e<0||e>=t.length,A_=(e,t)=>Math.floor(Math.min(Math.max(0,e),t.length)),N_=y(2,(e,t)=>{const r=Math.floor(t);return bh(r,e)?ne():he(e[r])}),vh=y(2,(e,t)=>{const r=Math.floor(t);if(bh(r,e))throw new Error(`Index ${r} out of bounds`);return e[r]}),Qn=N_(0),Tt=vh(0),F_=e=>Et(e)?he(yh(e)):ne(),yh=e=>e[e.length-1],ln=e=>e.slice(1),P_=(e,t)=>{let r=0;for(const n of e){if(!t(n,r))break;r++}return r},$_=y(2,(e,t)=>B_(e,P_(e,t))),j_=y(2,(e,t)=>{const r=Qe(e);return r.slice(A_(t,r),r.length)}),wl=e=>Array.from(e).reverse(),bi=y(2,(e,t)=>{const r=Array.from(e);return r.sort(t),r}),Il=y(2,(e,t)=>L_(e,t,I_)),L_=y(3,(e,t,r)=>{const n=Qe(e),s=Qe(t);if(Et(n)&&Et(s)){const i=[r(Tt(n),Tt(s))],a=Math.min(n.length,s.length);for(let o=1;o<a;o++)i[o]=r(n[o],s[o]);return i}return[]}),D_=Wo(),B_=y(2,(e,t)=>{const r=Array.from(e),n=Math.floor(t);return Et(r)?n>=1?U_(r,n):[[],r]:[r,[]]}),U_=y(2,(e,t)=>{const r=Math.max(1,Math.floor(t));return r>=e.length?[q_(e),[]]:[_i(e.slice(1,r),Tt(e)),e.slice(r)]}),q_=e=>e.slice(),z_=y(3,(e,t,r)=>{const n=Qe(e),s=Qe(t);return Et(n)?Et(s)?xh(r)(_h(n,s)):n:s}),ti=y(2,(e,t)=>z_(e,t,D_)),un=()=>[],Dt=e=>[e],tn=y(2,(e,t)=>e.map(t)),V_=y(2,(e,t)=>{if(O_(e))return[];const r=[];for(let n=0;n<e.length;n++){const s=t(e[n],n);for(let i=0;i<s.length;i++)r.push(s[i])}return r}),H_=V_(je),kh=y(3,(e,t,r)=>Qe(e).reduce((n,s,i)=>r(n,s,i),t)),Tl=(e,t)=>{const r=[];let n=e,s;for(;Zt(s=t(n));){const[i,a]=s.value;r.push(i),n=a}return r},rc=Mm,xh=y(2,(e,t)=>{const r=Qe(e);if(Et(r)){const n=[Tt(r)],s=ln(r);for(const i of s)n.every(a=>!t(i,a))&&n.push(i);return n}return[]}),K_=e=>xh(e,Wo()),Rn=y(2,(e,t)=>Qe(e).join(t)),ns=m_,J_=e=>e.replace(/[/\\^$*+?.()|[\]{}]/g,"\\$&"),G_=Symbol.for("effect/Context/Tag"),vi=Symbol.for("effect/Context/Reference"),W_="effect/STM",Y_=Symbol.for(W_),Sh={...bs,_op:"Tag",[Y_]:on,[G_]:{_Service:e=>e,_Identifier:e=>e},toString(){return ut(this.toJSON())},toJSON(){return{_id:"Tag",key:this.key,stack:this.stack}},[Je](){return this.toJSON()},of(e){return e},context(e){return Ih(this,e)}},Q_={...Sh,[vi]:vi},Z_=e=>{const t=Error.stackTraceLimit;Error.stackTraceLimit=2;const r=new Error;Error.stackTraceLimit=t;const n=Object.create(Sh);return Object.defineProperty(n,"stack",{get(){return r.stack}}),n.key=e,n},X_=()=>(e,t)=>{const r=Error.stackTraceLimit;Error.stackTraceLimit=2;const n=new Error;Error.stackTraceLimit=r;function s(){}return Object.setPrototypeOf(s,Q_),s.key=e,s.defaultValue=t.defaultValue,Object.defineProperty(s,"stack",{get(){return n.stack}}),s},wh=Symbol.for("effect/Context"),eb={[wh]:{_Services:e=>e},[ae](e){if(rb(e)&&this.unsafeMap.size===e.unsafeMap.size){for(const t of this.unsafeMap.keys())if(!e.unsafeMap.has(t)||!ce(this.unsafeMap.get(t),e.unsafeMap.get(t)))return!1;return!0}return!1},[oe](){return qe(this,Go(this.unsafeMap.size))},pipe(){return se(this,arguments)},toString(){return ut(this.toJSON())},toJSON(){return{_id:"Context",services:Array.from(this.unsafeMap).map(nt)}},[Je](){return this.toJSON()}},fn=e=>{const t=Object.create(eb);return t.unsafeMap=e,t},tb=e=>{const t=new Error(`Service not found${e.key?`: ${String(e.key)}`:""}`);if(e.stack){const r=e.stack.split(`
|
|
3
|
+
`);if(r.length>2){const n=r[2].match(/at (.*)/);n&&(t.message=t.message+` (defined at ${n[1]})`)}}if(t.stack){const r=t.stack.split(`
|
|
4
|
+
`);r.splice(1,3),t.stack=r.join(`
|
|
5
|
+
`)}return t},rb=e=>le(e,wh),nb=e=>le(e,vi),sb=fn(new Map),ib=()=>sb,Ih=(e,t)=>fn(new Map([[e.key,t]])),ab=y(3,(e,t,r)=>{const n=new Map(e.unsafeMap);return n.set(t.key,r),fn(n)}),Ma=ye("effect/Context/defaultValueCache",()=>new Map),nc=e=>{if(Ma.has(e.key))return Ma.get(e.key);const t=e.defaultValue();return Ma.set(e.key,t),t},ob=(e,t)=>e.unsafeMap.has(t.key)?e.unsafeMap.get(t.key):nc(t),Th=y(2,(e,t)=>{if(!e.unsafeMap.has(t.key)){if(vi in t)return nc(t);throw tb(t)}return e.unsafeMap.get(t.key)}),cb=Th,lb=y(2,(e,t)=>e.unsafeMap.has(t.key)?Qa(e.unsafeMap.get(t.key)):nb(t)?Qa(nc(t)):lh),ub=y(2,(e,t)=>{const r=new Map(e.unsafeMap);for(const[n,s]of t.unsafeMap)r.set(n,s);return fn(r)}),Kr=Z_,Rh=ib,fb=Ih,Ln=ab,Ch=cb,Eh=Th,ys=lb,Oh=ub,Mh=X_,Ah=Symbol.for("effect/Chunk");function hb(e,t,r,n,s){for(let i=t;i<Math.min(e.length,t+s);i++)r[n+i-t]=e[i];return r}const Nh=[],db=e=>Ko((t,r)=>t.length===r.length&&Nr(t).every((n,s)=>e(n,rn(r,s)))),gb=db(ce),pb={[Ah]:{_A:e=>e},toString(){return ut(this.toJSON())},toJSON(){return{_id:"Chunk",values:Nr(this).map(nt)}},[Je](){return this.toJSON()},[ae](e){return Fh(e)&&gb(this,e)},[oe](){return qe(this,ms(Nr(this)))},[Symbol.iterator](){switch(this.backing._tag){case"IArray":return this.backing.array[Symbol.iterator]();case"IEmpty":return Nh[Symbol.iterator]();default:return Nr(this)[Symbol.iterator]()}},pipe(){return se(this,arguments)}},Xe=e=>{const t=Object.create(pb);switch(t.backing=e,e._tag){case"IEmpty":{t.length=0,t.depth=0,t.left=t,t.right=t;break}case"IConcat":{t.length=e.left.length+e.right.length,t.depth=1+Math.max(e.left.depth,e.right.depth),t.left=e.left,t.right=e.right;break}case"IArray":{t.length=e.array.length,t.depth=0,t.left=Qt,t.right=Qt;break}case"ISingleton":{t.length=1,t.depth=0,t.left=Qt,t.right=Qt;break}case"ISlice":{t.length=e.length,t.depth=e.chunk.depth+1,t.left=Qt,t.right=Qt;break}}return t},Fh=e=>le(e,Ah),Qt=Xe({_tag:"IEmpty"}),lr=()=>Qt,Aa=(...e)=>bb(e),Ot=e=>Xe({_tag:"ISingleton",a:e}),Ph=e=>Fh(e)?e:Ki(Qe(e)),Za=(e,t,r)=>{switch(e.backing._tag){case"IArray":{hb(e.backing.array,0,t,r,e.length);break}case"IConcat":{Za(e.left,t,r),Za(e.right,t,r+e.left.length);break}case"ISingleton":{t[r]=e.backing.a;break}case"ISlice":{let n=0,s=r;for(;n<e.length;)t[s]=rn(e,n),n+=1,s+=1;break}}},mb=e=>{switch(e.backing._tag){case"IEmpty":return Nh;case"IArray":return e.backing.array;default:{const t=new Array(e.length);return Za(e,t,0),e.backing={_tag:"IArray",array:t},e.left=Qt,e.right=Qt,e.depth=0,t}}},Nr=mb,_b=e=>{switch(e.backing._tag){case"IEmpty":case"ISingleton":return e;case"IArray":return Xe({_tag:"IArray",array:wl(e.backing.array)});case"IConcat":return Xe({_tag:"IConcat",left:hn(e.backing.right),right:hn(e.backing.left)});case"ISlice":return Ki(wl(Nr(e)))}},hn=_b,Ki=e=>e.length===0?lr():e.length===1?Ot(e[0]):Xe({_tag:"IArray",array:e}),bb=e=>Ki(e),rn=y(2,(e,t)=>{switch(e.backing._tag){case"IEmpty":throw new Error("Index out of bounds");case"ISingleton":{if(t!==0)throw new Error("Index out of bounds");return e.backing.a}case"IArray":{if(t>=e.length||t<0)throw new Error("Index out of bounds");return e.backing.array[t]}case"IConcat":return t<e.left.length?rn(e.left,t):rn(e.right,t-e.left.length);case"ISlice":return rn(e.backing.chunk,t+e.backing.offset)}}),vb=y(2,(e,t)=>zt(e,Ot(t))),Jt=y(2,(e,t)=>zt(Ot(t),e)),Xa=y(2,(e,t)=>{if(t<=0)return e;if(t>=e.length)return Qt;switch(e.backing._tag){case"ISlice":return Xe({_tag:"ISlice",chunk:e.backing.chunk,offset:e.backing.offset+t,length:e.backing.length-t});case"IConcat":return t>e.left.length?Xa(e.right,t-e.left.length):Xe({_tag:"IConcat",left:Xa(e.left,t),right:e.right});default:return Xe({_tag:"ISlice",chunk:e,offset:t,length:e.length-t})}}),zt=y(2,(e,t)=>{if(e.backing._tag==="IEmpty")return t;if(t.backing._tag==="IEmpty")return e;const r=t.depth-e.depth;if(Math.abs(r)<=1)return Xe({_tag:"IConcat",left:e,right:t});if(r<-1)if(e.left.depth>=e.right.depth){const n=zt(e.right,t);return Xe({_tag:"IConcat",left:e.left,right:n})}else{const n=zt(e.right.right,t);if(n.depth===e.depth-3){const s=Xe({_tag:"IConcat",left:e.right.left,right:n});return Xe({_tag:"IConcat",left:e.left,right:s})}else{const s=Xe({_tag:"IConcat",left:e.left,right:e.right.left});return Xe({_tag:"IConcat",left:s,right:n})}}else if(t.right.depth>=t.left.depth){const n=zt(e,t.left);return Xe({_tag:"IConcat",left:n,right:t.right})}else{const n=zt(e,t.left.left);if(n.depth===t.depth-3){const s=Xe({_tag:"IConcat",left:n,right:t.left.right});return Xe({_tag:"IConcat",left:s,right:t.right})}else{const s=Xe({_tag:"IConcat",left:t.left.right,right:t.right});return Xe({_tag:"IConcat",left:n,right:s})}}}),yb=e=>e.length===0,dn=e=>e.length>0,$h=e=>rn(e,0),gn=$h,Er=e=>Xa(e,1),eo=Symbol.for("effect/Duration"),jh=BigInt(0),Rl=BigInt(24),qs=BigInt(60),to=BigInt(1e3),Cl=BigInt(1e6),El=BigInt(1e9),kb=/^(-?\d+(?:\.\d+)?)\s+(nanos?|micros?|millis?|seconds?|minutes?|hours?|days?|weeks?)$/,ur=e=>{if(Lh(e))return e;if(Wa(e))return ro(e);if(Nm(e))return Na(e);if(Array.isArray(e)&&e.length===2&&e.every(Wa))return e[0]===-1/0||e[1]===-1/0||Number.isNaN(e[0])||Number.isNaN(e[1])?Dh:e[0]===1/0||e[1]===1/0?Ib:Na(BigInt(Math.round(e[0]*1e9))+BigInt(Math.round(e[1])));if(Am(e)){const t=kb.exec(e);if(t){const[r,n,s]=t,i=Number(n);switch(s){case"nano":case"nanos":return Na(BigInt(n));case"micro":case"micros":return Tb(BigInt(n));case"milli":case"millis":return ro(i);case"second":case"seconds":return Rb(i);case"minute":case"minutes":return Cb(i);case"hour":case"hours":return Eb(i);case"day":case"days":return Ob(i);case"week":case"weeks":return Mb(i)}}}throw new Error("Invalid DurationInput")},Ol={_tag:"Millis",millis:0},xb={_tag:"Infinity"},Sb={[eo]:eo,[oe](){return qe(this,Xf(this.value))},[ae](e){return Lh(e)&&Lb(this,e)},toString(){return`Duration(${Bb(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:Nb(this)};case"Infinity":return{_id:"Duration",_tag:"Infinity"}}},[Je](){return this.toJSON()},pipe(){return se(this,arguments)}},tr=e=>{const t=Object.create(Sb);return Wa(e)?isNaN(e)||e<=0?t.value=Ol:Number.isFinite(e)?Number.isInteger(e)?t.value={_tag:"Millis",millis:e}:t.value={_tag:"Nanos",nanos:BigInt(Math.round(e*1e6))}:t.value=xb:e<=jh?t.value=Ol:t.value={_tag:"Nanos",nanos:e},t},Lh=e=>le(e,eo),wb=e=>{switch(e.value._tag){case"Millis":return e.value.millis===0;case"Nanos":return e.value.nanos===jh;case"Infinity":return!1}},Dh=tr(0),Ib=tr(1/0),Na=e=>tr(e),Tb=e=>tr(e*to),ro=e=>tr(e),Rb=e=>tr(e*1e3),Cb=e=>tr(e*6e4),Eb=e=>tr(e*36e5),Ob=e=>tr(e*864e5),Mb=e=>tr(e*6048e5),no=e=>Fb(e,{onMillis:t=>t,onNanos:t=>Number(t)/1e6}),Ab=e=>{const t=ur(e);switch(t.value._tag){case"Infinity":throw new Error("Cannot convert infinite duration to nanos");case"Nanos":return t.value.nanos;case"Millis":return BigInt(Math.round(t.value.millis*1e6))}},Nb=e=>{const t=ur(e);switch(t.value._tag){case"Infinity":return[1/0,0];case"Nanos":return[Number(t.value.nanos/El),Number(t.value.nanos%El)];case"Millis":return[Math.floor(t.value.millis/1e3),Math.round(t.value.millis%1e3*1e6)]}},Fb=y(2,(e,t)=>{const r=ur(e);switch(r.value._tag){case"Nanos":return t.onNanos(r.value.nanos);case"Infinity":return t.onMillis(1/0);case"Millis":return t.onMillis(r.value.millis)}}),sc=y(3,(e,t,r)=>{const n=ur(e),s=ur(t);if(n.value._tag==="Infinity"||s.value._tag==="Infinity")return r.onMillis(no(n),no(s));if(n.value._tag==="Nanos"||s.value._tag==="Nanos"){const i=n.value._tag==="Nanos"?n.value.nanos:BigInt(Math.round(n.value.millis*1e6)),a=s.value._tag==="Nanos"?s.value.nanos:BigInt(Math.round(s.value.millis*1e6));return r.onNanos(i,a)}return r.onMillis(n.value.millis,s.value.millis)}),Pb=(e,t)=>sc(e,t,{onMillis:(r,n)=>r===n,onNanos:(r,n)=>r===n}),$b=y(2,(e,t)=>sc(e,t,{onMillis:(r,n)=>r<=n,onNanos:(r,n)=>r<=n})),jb=y(2,(e,t)=>sc(e,t,{onMillis:(r,n)=>r>=n,onNanos:(r,n)=>r>=n})),Lb=y(2,(e,t)=>Pb(ur(e),ur(t))),Db=e=>{const t=ur(e);if(t.value._tag==="Infinity")return{days:1/0,hours:1/0,minutes:1/0,seconds:1/0,millis:1/0,nanos:1/0};const r=Ab(t),n=r/Cl,s=n/to,i=s/qs,a=i/qs,o=a/Rl;return{days:Number(o),hours:Number(a%Rl),minutes:Number(i%qs),seconds:Number(s%qs),millis:Number(n%to),nanos:Number(r%Cl)}},Bb=e=>{const t=ur(e);if(t.value._tag==="Infinity")return"Infinity";if(wb(t))return"0";const r=Db(t),n=[];return r.days!==0&&n.push(`${r.days}d`),r.hours!==0&&n.push(`${r.hours}h`),r.minutes!==0&&n.push(`${r.minutes}m`),r.seconds!==0&&n.push(`${r.seconds}s`),r.millis!==0&&n.push(`${r.millis}ms`),r.nanos!==0&&n.push(`${r.nanos}ns`),n.join(" ")},jr=5,ic=Math.pow(2,jr),Ub=ic-1,qb=ic/2,zb=ic/4;function Vb(e){return e-=e>>1&1431655765,e=(e&858993459)+(e>>2&858993459),e=e+(e>>4)&252645135,e+=e>>8,e+=e>>16,e&127}function pn(e,t){return t>>>e&Ub}function Xr(e){return 1<<e}function Bh(e,t){return Vb(e&t-1)}const Hb=(e,t)=>({value:e,previous:t});function nn(e,t,r,n){let s=n;if(!e){const i=n.length;s=new Array(i);for(let a=0;a<i;++a)s[a]=n[a]}return s[t]=r,s}function Uh(e,t,r){const n=r.length-1;let s=0,i=0,a=r;if(e)s=i=t;else for(a=new Array(n);s<t;)a[i++]=r[s++];for(++s;s<=n;)a[i++]=r[s++];return e&&(a.length=n),a}function Kb(e,t,r,n){const s=n.length;if(e){let c=s;for(;c>=t;)n[c--]=n[c];return n[t]=r,n}let i=0,a=0;const o=new Array(s+1);for(;i<t;)o[a++]=n[i++];for(o[t]=r;i<s;)o[++a]=n[i++];return o}class kr{constructor(){h(this,"_tag","EmptyNode")}modify(t,r,n,s,i,a){const o=n(ne());return xt(o)?new kr:(++a.value,new Fr(t,s,i,o))}}function Vt(e){return Gf(e,"EmptyNode")}function Jb(e){return Vt(e)||e._tag==="LeafNode"||e._tag==="CollisionNode"}function Ji(e,t){return Vt(e)?!1:t===e.edit}class Fr{constructor(t,r,n,s){h(this,"edit");h(this,"hash");h(this,"key");h(this,"value");h(this,"_tag","LeafNode");this.edit=t,this.hash=r,this.key=n,this.value=s}modify(t,r,n,s,i,a){if(ce(i,this.key)){const c=n(this.value);return c===this.value?this:xt(c)?(--a.value,new kr):Ji(this,t)?(this.value=c,this):new Fr(t,s,i,c)}const o=n(ne());return xt(o)?this:(++a.value,qh(t,r,this.hash,this,s,new Fr(t,s,i,o)))}}class ac{constructor(t,r,n){h(this,"edit");h(this,"hash");h(this,"children");h(this,"_tag","CollisionNode");this.edit=t,this.hash=r,this.children=n}modify(t,r,n,s,i,a){if(s===this.hash){const c=Ji(this,t),l=this.updateCollisionList(c,t,this.hash,this.children,n,i,a);return l===this.children?this:l.length>1?new ac(t,this.hash,l):l[0]}const o=n(ne());return xt(o)?this:(++a.value,qh(t,r,this.hash,this,s,new Fr(t,s,i,o)))}updateCollisionList(t,r,n,s,i,a,o){const c=s.length;for(let f=0;f<c;++f){const p=s[f];if("key"in p&&ce(a,p.key)){const d=p.value,g=i(d);return g===d?s:xt(g)?(--o.value,Uh(t,f,s)):nn(t,f,new Fr(r,n,a,g),s)}}const l=i(ne());return xt(l)?s:(++o.value,nn(t,c,new Fr(r,n,a,l),s))}}class mn{constructor(t,r,n){h(this,"edit");h(this,"mask");h(this,"children");h(this,"_tag","IndexedNode");this.edit=t,this.mask=r,this.children=n}modify(t,r,n,s,i,a){const o=this.mask,c=this.children,l=pn(r,s),f=Xr(l),p=Bh(o,f),d=o&f,g=Ji(this,t);if(!d){const $=new kr().modify(t,r+jr,n,s,i,a);return $?c.length>=qb?Wb(t,l,$,o,c):new mn(t,o|f,Kb(g,p,$,c)):this}const _=c[p],k=_.modify(t,r+jr,n,s,i,a);if(_===k)return this;let b=o,w;if(Vt(k)){if(b&=~f,!b)return new kr;if(c.length<=2&&Jb(c[p^1]))return c[p^1];w=Uh(g,p,c)}else w=nn(g,p,k,c);return g?(this.mask=b,this.children=w,this):new mn(t,b,w)}}class oc{constructor(t,r,n){h(this,"edit");h(this,"size");h(this,"children");h(this,"_tag","ArrayNode");this.edit=t,this.size=r,this.children=n}modify(t,r,n,s,i,a){let o=this.size;const c=this.children,l=pn(r,s),f=c[l],p=(f||new kr).modify(t,r+jr,n,s,i,a);if(f===p)return this;const d=Ji(this,t);let g;if(Vt(f)&&!Vt(p))++o,g=nn(d,l,p,c);else if(!Vt(f)&&Vt(p)){if(--o,o<=zb)return Gb(t,o,l,c);g=nn(d,l,new kr,c)}else g=nn(d,l,p,c);return d?(this.size=o,this.children=g,this):new oc(t,o,g)}}function Gb(e,t,r,n){const s=new Array(t-1);let i=0,a=0;for(let o=0,c=n.length;o<c;++o)if(o!==r){const l=n[o];l&&!Vt(l)&&(s[i++]=l,a|=1<<o)}return new mn(e,a,s)}function Wb(e,t,r,n,s){const i=[];let a=n,o=0;for(let c=0;a;++c)a&1&&(i[c]=s[o++]),a>>>=1;return i[t]=r,new oc(e,o+1,i)}function Yb(e,t,r,n,s,i){if(r===s)return new ac(e,r,[i,n]);const a=pn(t,r),o=pn(t,s);if(a===o)return c=>new mn(e,Xr(a)|Xr(o),[c]);{const c=a<o?[n,i]:[i,n];return new mn(e,Xr(a)|Xr(o),c)}}function qh(e,t,r,n,s,i){let a,o=t;for(;;){const c=Yb(e,o,r,n,s,i);if(typeof c=="function")a=Hb(c,a),o=o+jr;else{let l=c;for(;a!=null;)l=a.value(l),a=a.previous;return l}}}const zh="effect/HashMap",so=Symbol.for(zh),Qb={[so]:so,[Symbol.iterator](){return new Gi(this,(e,t)=>[e,t])},[oe](){let e=q(zh);for(const t of this)e^=T(q(t[0]),ge(q(t[1])));return qe(this,e)},[ae](e){if(ev(e)){if(e._size!==this._size)return!1;for(const t of this){const r=T(e,lc(t[0],q(t[0])));if(xt(r))return!1;if(!ce(t[1],r.value))return!1}return!0}return!1},toString(){return ut(this.toJSON())},toJSON(){return{_id:"HashMap",values:Array.from(this).map(nt)}},[Je](){return this.toJSON()},pipe(){return se(this,arguments)}},cc=(e,t,r,n)=>{const s=Object.create(Qb);return s._editable=e,s._edit=t,s._root=r,s._size=n,s};class Gi{constructor(t,r){h(this,"map");h(this,"f");h(this,"v");this.map=t,this.f=r,this.v=Vh(this.map._root,this.f,void 0)}next(){if(xt(this.v))return{done:!0,value:void 0};const t=this.v.value;return this.v=yi(t.cont),{done:!1,value:t.value}}[Symbol.iterator](){return new Gi(this.map,this.f)}}const yi=e=>e?Hh(e[0],e[1],e[2],e[3],e[4]):ne(),Vh=(e,t,r=void 0)=>{switch(e._tag){case"LeafNode":return Zt(e.value)?he({value:t(e.key,e.value.value),cont:r}):yi(r);case"CollisionNode":case"ArrayNode":case"IndexedNode":{const n=e.children;return Hh(n.length,n,0,t,r)}default:return yi(r)}},Hh=(e,t,r,n,s)=>{for(;r<e;){const i=t[r++];if(i&&!Vt(i))return Vh(i,n,[e,t,r,n,s])}return yi(s)},Zb=cc(!1,0,new kr,0),Wi=()=>Zb,Xb=e=>{const t=Jh(Wi());for(const r of e)ss(t,r[0],r[1]);return iv(t)},ev=e=>le(e,so),tv=e=>e&&Vt(e._root),rv=y(2,(e,t)=>lc(e,t,q(t))),lc=y(3,(e,t,r)=>{let n=e._root,s=0;for(;;)switch(n._tag){case"LeafNode":return ce(t,n.key)?n.value:ne();case"CollisionNode":{if(r===n.hash){const i=n.children;for(let a=0,o=i.length;a<o;++a){const c=i[a];if("key"in c&&ce(t,c.key))return c.value}}return ne()}case"IndexedNode":{const i=pn(s,r),a=Xr(i);if(n.mask&a){n=n.children[Bh(n.mask,a)],s+=jr;break}return ne()}case"ArrayNode":{if(n=n.children[pn(s,r)],n){s+=jr;break}return ne()}default:return ne()}}),nv=y(2,(e,t)=>Zt(lc(e,t,q(t)))),ss=y(3,(e,t,r)=>uc(e,t,()=>he(r))),sv=y(3,(e,t,r)=>e._editable?(e._root=t,e._size=r,e):t===e._root?e:cc(e._editable,e._edit,t,r)),Kh=e=>new Gi(e,t=>t),io=e=>e._size,Jh=e=>cc(!0,e._edit+1,e._root,e._size),iv=e=>(e._editable=!1,e),uc=y(3,(e,t,r)=>av(e,t,q(t),r)),av=y(4,(e,t,r,n)=>{const s={value:e._size},i=e._root.modify(e._editable?e._edit:NaN,0,n,r,t,s);return T(e,sv(i,s.value))}),Ml=y(2,(e,t)=>uc(e,t,ne)),ov=y(2,(e,t)=>Yi(e,Wi(),(r,n,s)=>ss(r,s,t(n,s)))),cv=y(2,(e,t)=>Yi(e,void 0,(r,n,s)=>t(n,s))),Yi=y(3,(e,t,r)=>{const n=e._root;if(n._tag==="LeafNode")return Zt(n.value)?r(t,n.value.value,n.key):t;if(n._tag==="EmptyNode")return t;const s=[n.children];let i;for(;i=s.pop();)for(let a=0,o=i.length;a<o;){const c=i[a++];c&&!Vt(c)&&(c._tag==="LeafNode"?Zt(c.value)&&(t=r(t,c.value.value,c.key)):s.push(c.children))}return t}),Gh="effect/HashSet",ao=Symbol.for(Gh),lv={[ao]:ao,[Symbol.iterator](){return Kh(this._keyMap)},[oe](){return qe(this,ge(q(this._keyMap))(q(Gh)))},[ae](e){return uv(e)?io(this._keyMap)===io(e._keyMap)&&ce(this._keyMap,e._keyMap):!1},toString(){return ut(this.toJSON())},toJSON(){return{_id:"HashSet",values:Array.from(this).map(nt)}},[Je](){return this.toJSON()},pipe(){return se(this,arguments)}},Qi=e=>{const t=Object.create(lv);return t._keyMap=e,t},uv=e=>le(e,ao),fv=Qi(Wi()),Zi=()=>fv,hv=e=>{const t=fc(Zi());for(const r of e)is(t,r);return hc(t)},dv=(...e)=>{const t=fc(Zi());for(const r of e)is(t,r);return hc(t)},gv=y(2,(e,t)=>nv(e._keyMap,t)),pv=e=>io(e._keyMap),fc=e=>Qi(Jh(e._keyMap)),hc=e=>(e._keyMap._editable=!1,e),Wh=y(2,(e,t)=>{const r=fc(e);return t(r),hc(r)}),is=y(2,(e,t)=>e._keyMap._editable?(ss(t,!0)(e._keyMap),e):Qi(ss(t,!0)(e._keyMap))),Yh=y(2,(e,t)=>e._keyMap._editable?(Ml(t)(e._keyMap),e):Qi(Ml(t)(e._keyMap))),mv=y(2,(e,t)=>Wh(e,r=>{for(const n of t)Yh(r,n)})),_v=y(2,(e,t)=>Wh(Zi(),r=>{bv(e,n=>is(r,n));for(const n of t)is(r,n)})),bv=y(2,(e,t)=>cv(e._keyMap,(r,n)=>t(n))),vv=y(3,(e,t,r)=>Yi(e._keyMap,t,(n,s,i)=>r(n,i))),Lr=Zi,yv=hv,dc=dv,kv=gv,Qh=pv,Zn=is,Zh=Yh,Al=mv,as=_v,ki=vv,Nl=Symbol.for("effect/MutableRef"),xv={[Nl]:Nl,toString(){return ut(this.toJSON())},toJSON(){return{_id:"MutableRef",current:nt(this.current)}},[Je](){return this.toJSON()},pipe(){return se(this,arguments)}},Xh=e=>{const t=Object.create(xv);return t.current=e,t},Xi=e=>e.current,ed=y(2,(e,t)=>(e.current=t,e)),gc="effect/FiberId",os=Symbol.for(gc),xi="None",oo="Runtime",Sv="Composite",wv=He(`${gc}-${xi}`);var Lu;let Iv=class{constructor(){h(this,Lu,os);h(this,"_tag",xi);h(this,"id",-1);h(this,"startTimeMillis",-1)}[(Lu=os,oe)](){return wv}[ae](t){return td(t)&&t._tag===xi}toString(){return ut(this.toJSON())}toJSON(){return{_id:"FiberId",_tag:this._tag}}[Je](){return this.toJSON()}};var Du;class Tv{constructor(t,r){h(this,"id");h(this,"startTimeMillis");h(this,Du,os);h(this,"_tag",oo);this.id=t,this.startTimeMillis=r}[(Du=os,oe)](){return qe(this,He(`${gc}-${this._tag}-${this.id}-${this.startTimeMillis}`))}[ae](t){return td(t)&&t._tag===oo&&this.id===t.id&&this.startTimeMillis===t.startTimeMillis}toString(){return ut(this.toJSON())}toJSON(){return{_id:"FiberId",_tag:this._tag,id:this.id,startTimeMillis:this.startTimeMillis}}[Je](){return this.toJSON()}}const Rv=new Iv,td=e=>le(e,os),co=e=>{switch(e._tag){case xi:return Lr();case oo:return dc(e.id);case Sv:return T(co(e.left),as(co(e.right)))}},Fl=ye(Symbol.for("effect/Fiber/Id/_fiberCounter"),()=>Xh(0)),rd=e=>Array.from(co(e)).map(r=>`#${r}`).join(","),Cv=()=>{const e=Xi(Fl);return T(Fl,ed(e+1)),new Tv(e,Date.now())},_n=Rv,Ev=rd,Ov=Cv,pc=Wi,Mv=Xb,Av=tv,nd=rv,sd=ss,id=Kh,Nv=uc,Fv=ov,ad=Yi,cs=Symbol.for("effect/List"),lo=e=>Qe(e),Pv=e=>Om(rc(e),lo),$v=Pv(ce),jv={[cs]:cs,_tag:"Cons",toString(){return ut(this.toJSON())},toJSON(){return{_id:"List",_tag:"Cons",values:lo(this).map(nt)}},[Je](){return this.toJSON()},[ae](e){return cd(e)&&this._tag===e._tag&&$v(this,e)},[oe](){return qe(this,ms(lo(this)))},[Symbol.iterator](){let e=!1,t=this;return{next(){if(e)return this.return();if(t._tag==="Nil")return e=!0,this.return();const r=t.head;return t=t.tail,{done:e,value:r}},return(r){return e||(e=!0),{done:!0,value:r}}}},pipe(){return se(this,arguments)}},Si=(e,t)=>{const r=Object.create(jv);return r.head=e,r.tail=t,r},Lv=He("Nil"),Dv={[cs]:cs,_tag:"Nil",toString(){return ut(this.toJSON())},toJSON(){return{_id:"List",_tag:"Nil"}},[Je](){return this.toJSON()},[oe](){return Lv},[ae](e){return cd(e)&&this._tag===e._tag},[Symbol.iterator](){return{next(){return{done:!0,value:void 0}}}},pipe(){return se(this,arguments)}},od=Object.create(Dv),cd=e=>le(e,cs),or=e=>e._tag==="Nil",Bv=e=>e._tag==="Cons",Uv=()=>od,Dr=(e,t)=>Si(e,t),bn=Uv,mc=e=>Si(e,od),qv=y(2,(e,t)=>Vv(t,e)),zv=y(2,(e,t)=>Dr(t,e)),Vv=y(2,(e,t)=>{if(or(e))return t;if(or(t))return e;{const r=Si(t.head,e);let n=r,s=t.tail;for(;!or(s);){const i=Si(s.head,e);n.tail=i,n=i,s=s.tail}return r}}),Hv=y(3,(e,t,r)=>{let n=t,s=e;for(;!or(s);)n=r(n,s.head),s=s.tail;return n}),Kv=e=>{let t=bn(),r=e;for(;!or(r);)t=zv(t,r.head),r=r.tail;return t},_c=(function(){function e(t){t&&Object.assign(this,t)}return e.prototype=Xo,e})(),Jv=Symbol.for("effect/DifferContextPatch");function Pl(e){return e}const ks={..._c.prototype,[Jv]:{_Value:Pl,_Patch:Pl}},Gv=Object.assign(Object.create(ks),{_tag:"Empty"}),Wv=Object.create(Gv),ld=()=>Wv,Yv=Object.assign(Object.create(ks),{_tag:"AndThen"}),Qv=(e,t)=>{const r=Object.create(Yv);return r.first=e,r.second=t,r},Zv=Object.assign(Object.create(ks),{_tag:"AddService"}),Xv=(e,t)=>{const r=Object.create(Zv);return r.key=e,r.service=t,r},ey=Object.assign(Object.create(ks),{_tag:"RemoveService"}),ty=e=>{const t=Object.create(ey);return t.key=e,t},ry=Object.assign(Object.create(ks),{_tag:"UpdateService"}),ny=(e,t)=>{const r=Object.create(ry);return r.key=e,r.update=t,r},sy=(e,t)=>{const r=new Map(e.unsafeMap);let n=ld();for(const[s,i]of t.unsafeMap.entries())if(r.has(s)){const a=r.get(s);r.delete(s),ce(a,i)||(n=ri(ny(s,()=>i))(n))}else r.delete(s),n=ri(Xv(s,i))(n);for(const[s]of r.entries())n=ri(ty(s))(n);return n},ri=y(2,(e,t)=>Qv(e,t)),iy=y(2,(e,t)=>{if(e._tag==="Empty")return t;let r=!1,n=Ot(e);const s=new Map(t.unsafeMap);for(;dn(n);){const a=gn(n),o=Er(n);switch(a._tag){case"Empty":{n=o;break}case"AddService":{s.set(a.key,a.service),n=o;break}case"AndThen":{n=Jt(Jt(o,a.second),a.first);break}case"RemoveService":{s.delete(a.key),n=o;break}case"UpdateService":{s.set(a.key,a.update(s.get(a.key))),r=!0,n=o;break}}}if(!r)return fn(s);const i=new Map;for(const[a]of t.unsafeMap)s.has(a)&&(i.set(a,s.get(a)),s.delete(a));for(const[a,o]of s)i.set(a,o);return fn(i)}),ay=Symbol.for("effect/DifferHashSetPatch");function Fa(e){return e}const ea={..._c.prototype,[ay]:{_Value:Fa,_Key:Fa,_Patch:Fa}},oy=Object.assign(Object.create(ea),{_tag:"Empty"}),cy=Object.create(oy),ud=()=>cy,ly=Object.assign(Object.create(ea),{_tag:"AndThen"}),uy=(e,t)=>{const r=Object.create(ly);return r.first=e,r.second=t,r},fy=Object.assign(Object.create(ea),{_tag:"Add"}),hy=e=>{const t=Object.create(fy);return t.value=e,t},dy=Object.assign(Object.create(ea),{_tag:"Remove"}),gy=e=>{const t=Object.create(dy);return t.value=e,t},py=(e,t)=>{const[r,n]=ki([e,ud()],([s,i],a)=>kv(a)(s)?[Zh(a)(s),i]:[s,uo(hy(a))(i)])(t);return ki(n,(s,i)=>uo(gy(i))(s))(r)},uo=y(2,(e,t)=>uy(e,t)),my=y(2,(e,t)=>{if(e._tag==="Empty")return t;let r=t,n=Ot(e);for(;dn(n);){const s=gn(n),i=Er(n);switch(s._tag){case"Empty":{n=i;break}case"AndThen":{n=Jt(s.first)(Jt(s.second)(i));break}case"Add":{r=Zn(s.value)(r),n=i;break}case"Remove":r=Zh(s.value)(r),n=i}}return r}),_y=Symbol.for("effect/DifferReadonlyArrayPatch");function $l(e){return e}const xs={..._c.prototype,[_y]:{_Value:$l,_Patch:$l}},by=Object.assign(Object.create(xs),{_tag:"Empty"}),vy=Object.create(by),fd=()=>vy,yy=Object.assign(Object.create(xs),{_tag:"AndThen"}),ky=(e,t)=>{const r=Object.create(yy);return r.first=e,r.second=t,r},xy=Object.assign(Object.create(xs),{_tag:"Append"}),Sy=e=>{const t=Object.create(xy);return t.values=e,t},wy=Object.assign(Object.create(xs),{_tag:"Slice"}),Iy=(e,t)=>{const r=Object.create(wy);return r.from=e,r.until=t,r},Ty=Object.assign(Object.create(xs),{_tag:"Update"}),Ry=(e,t)=>{const r=Object.create(Ty);return r.index=e,r.patch=t,r},Cy=e=>{let t=0,r=fd();for(;t<e.oldValue.length&&t<e.newValue.length;){const n=e.oldValue[t],s=e.newValue[t],i=e.differ.diff(n,s);ce(i,e.differ.empty)||(r=ni(r,Ry(t,i))),t=t+1}return t<e.oldValue.length&&(r=ni(r,Iy(0,t))),t<e.newValue.length&&(r=ni(r,Sy(j_(t)(e.newValue)))),r},ni=y(2,(e,t)=>ky(e,t)),Ey=y(3,(e,t,r)=>{if(e._tag==="Empty")return t;let n=t.slice(),s=Dt(e);for(;M_(s);){const i=Tt(s),a=ln(s);switch(i._tag){case"Empty":{s=a;break}case"AndThen":{a.unshift(i.first,i.second),s=a;break}case"Append":{for(const o of i.values)n.push(o);s=a;break}case"Slice":{n=n.slice(i.from,i.until),s=a;break}case"Update":{n[i.index]=r.patch(i.patch,n[i.index]),s=a;break}}}return n}),Oy=Symbol.for("effect/Differ"),My={[Oy]:{_P:je,_V:je},pipe(){return se(this,arguments)}},Cn=e=>{const t=Object.create(My);return t.empty=e.empty,t.diff=e.diff,t.combine=e.combine,t.patch=e.patch,t},Ay=()=>Cn({empty:ld(),combine:(e,t)=>ri(t)(e),diff:(e,t)=>sy(e,t),patch:(e,t)=>iy(t)(e)}),Ny=()=>Cn({empty:ud(),combine:(e,t)=>uo(t)(e),diff:(e,t)=>py(e,t),patch:(e,t)=>my(t)(e)}),Fy=e=>Cn({empty:fd(),combine:(t,r)=>ni(t,r),diff:(t,r)=>Cy({oldValue:t,newValue:r,differ:e}),patch:(t,r)=>Ey(t,r,e)}),hd=()=>Py((e,t)=>t),Py=e=>Cn({empty:je,combine:(t,r)=>t===je?r:r===je?t:n=>r(t(n)),diff:(t,r)=>ce(t,r)?je:Bi(r),patch:(t,r)=>e(r,t(r))}),ls=255,dd=8,fo=e=>e&ls,ho=e=>e>>dd&ls,Ss=(e,t)=>(e&ls)+((t&e&ls)<<dd),$y=Ss(0,0),jy=e=>Ss(e,e),Ly=e=>Ss(e,0),Dy=y(2,(e,t)=>Ss(fo(e)&~t,ho(e))),By=y(2,(e,t)=>e|t),Uy=e=>~e>>>0&ls,qy=0,ws=1,zy=2,Vy=4,go=16,Hy=32,Ky=e=>ta(e,Hy),Jy=y(2,(e,t)=>e|t),mr=e=>gd(e)&&!Yy(e),gd=e=>ta(e,ws),ta=y(2,(e,t)=>(e&t)!==0),Gy=(...e)=>e.reduce((t,r)=>t|r,0),Wy=Gy(qy),jl=e=>ta(e,Vy),Yy=e=>ta(e,go),si=y(2,(e,t)=>Ss(e^t,t)),ii=y(2,(e,t)=>e&(Uy(fo(t))|ho(t))|fo(t)&ho(t)),Ll=Cn({empty:$y,diff:(e,t)=>si(e,t),combine:(e,t)=>By(t)(e),patch:(e,t)=>ii(t,e)}),Qy=jy,pd=Ly,Dl=Dy,md=(e,t)=>({_tag:"Par",left:e,right:t}),zs=(e,t)=>({_tag:"Seq",left:e,right:t}),Zy=e=>{let t=mc(e),r=bn();for(;;){const[n,s]=Hv(t,[_d(),bn()],([i,a],o)=>{const[c,l]=Xy(o);return[s0(i,c),qv(a,l)]});if(r=e0(r,n),or(s))return Kv(r);t=s}throw new Error("BUG: BlockedRequests.flatten - please report an issue at https://github.com/Effect-TS/effect/issues")},Xy=e=>{let t=e,r=_d(),n=bn(),s=bn();for(;;)switch(t._tag){case"Empty":{if(or(n))return[r,s];t=n.head,n=n.tail;break}case"Par":{n=Dr(t.right,n),t=t.left;break}case"Seq":{const i=t.left,a=t.right;switch(i._tag){case"Empty":{t=a;break}case"Par":{const o=i.left,c=i.right;t=md(zs(o,a),zs(c,a));break}case"Seq":{const o=i.left,c=i.right;t=zs(o,zs(c,a));break}case"Single":{t=i,s=Dr(a,s);break}}break}case"Single":{if(r=n0(r,t),or(n))return[r,s];t=n.head,n=n.tail;break}}throw new Error("BUG: BlockedRequests.step - please report an issue at https://github.com/Effect-TS/effect/issues")},e0=(e,t)=>{if(or(e))return mc(Pa(t));if(i0(t))return e;const r=f0(e.head),n=a0(t);return r.length===1&&n.length===1&&ce(r[0],n[0])?Dr(u0(e.head,Pa(t)),e.tail):Dr(Pa(t),e)},t0=Symbol.for("effect/RequestBlock/RequestBlockParallel"),r0={_R:e=>e};var Bu;Bu=t0;class bc{constructor(t){h(this,"map");h(this,Bu,r0);this.map=t}}const _d=()=>new bc(pc()),n0=(e,t)=>new bc(Nv(e.map,t.dataSource,r=>v_(y_(r,vb(t.blockedRequest)),()=>Ot(t.blockedRequest)))),s0=(e,t)=>new bc(ad(e.map,t.map,(r,n,s)=>sd(r,s,Hr(nd(r,s),{onNone:()=>n,onSome:i=>zt(n,i)})))),i0=e=>Av(e.map),a0=e=>Array.from(id(e.map)),Pa=e=>l0(Fv(e.map,t=>Ot(t))),o0=Symbol.for("effect/RequestBlock/RequestBlockSequential"),c0={_R:e=>e};var Uu;Uu=o0;class bd{constructor(t){h(this,"map");h(this,Uu,c0);this.map=t}}const l0=e=>new bd(e),u0=(e,t)=>new bd(ad(t.map,e.map,(r,n,s)=>sd(r,s,Hr(nd(r,s),{onNone:()=>lr(),onSome:i=>zt(i,n)})))),f0=e=>Array.from(id(e.map)),h0=e=>Array.from(e.map),Is="Die",Br="Empty",En="Fail",On="Interrupt",vn="Parallel",yn="Sequential",vd="effect/Cause",yd=Symbol.for(vd),d0={_E:e=>e},Mn={[yd]:d0,[oe](){return T(q(vd),ge(q(T0(this))),qe(this))},[ae](e){return g0(e)&&I0(this,e)},pipe(){return se(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 na(this)},[Je](){return this.toJSON()}},kn=(()=>{const e=Object.create(Mn);return e._tag=Br,e})(),po=e=>{const t=Object.create(Mn);return t._tag=En,t.error=e,t},cr=e=>{const t=Object.create(Mn);return t._tag=Is,t.defect=e,t},br=e=>{const t=Object.create(Mn);return t._tag=On,t.fiberId=e,t},ra=(e,t)=>{const r=Object.create(Mn);return r._tag=vn,r.left=e,r.right=t,r},Pt=(e,t)=>{const r=Object.create(Mn);return r._tag=yn,r.left=e,r.right=t,r},g0=e=>le(e,yd),p0=e=>e._tag===Br,m0=e=>e._tag===Br?!0:xn(e,!0,(t,r)=>{switch(r._tag){case Br:return he(t);case Is:case En:case On:return he(!1);default:return ne()}}),_0=e=>Zt(S0(e)),vc=e=>yc(void 0,C0)(e),b0=e=>hn(xn(e,lr(),(t,r)=>r._tag===En?he(T(t,Jt(r.error))):ne())),v0=e=>hn(xn(e,lr(),(t,r)=>r._tag===Is?he(T(t,Jt(r.defect))):ne())),y0=e=>xn(e,Lr(),(t,r)=>r._tag===On?he(T(t,Zn(r.fiberId))):ne()),k0=e=>kd(e,t=>t._tag===En?he(t.error):ne()),x0=e=>{const t=k0(e);switch(t._tag){case"None":return ar(e);case"Some":return cn(t.value)}},S0=e=>kd(e,t=>t._tag===On?he(t.fiberId):ne()),Bl=e=>xd(e,{onEmpty:kn,onFail:()=>kn,onDie:cr,onInterrupt:br,onSequential:Pt,onParallel:ra}),w0=e=>xd(e,{onEmpty:kn,onFail:cr,onDie:cr,onInterrupt:br,onSequential:Pt,onParallel:ra}),I0=(e,t)=>{let r=Ot(e),n=Ot(t);for(;dn(r)&&dn(n);){const[s,i]=T(gn(r),xn([Lr(),lr()],([c,l],f)=>{const[p,d]=mo(f);return he([T(c,as(p)),T(l,zt(d))])})),[a,o]=T(gn(n),xn([Lr(),lr()],([c,l],f)=>{const[p,d]=mo(f);return he([T(c,as(p)),T(l,zt(d))])}));if(!ce(s,a))return!1;r=i,n=o}return!0},T0=e=>R0(Ot(e),lr()),R0=(e,t)=>{for(;;){const[r,n]=T(e,kh([Lr(),lr()],([i,a],o)=>{const[c,l]=mo(o);return[T(i,as(c)),T(a,zt(l))]})),s=Qh(r)>0?T(t,Jt(r)):t;if(yb(n))return hn(s);e=n,t=s}throw new Error(zi("Cause.flattenCauseLoop"))},kd=y(2,(e,t)=>{const r=[e];for(;r.length>0;){const n=r.pop(),s=t(n);switch(s._tag){case"None":{switch(n._tag){case yn:case vn:{r.push(n.right),r.push(n.left);break}}break}case"Some":return s}}return ne()}),mo=e=>{let t=e;const r=[];let n=Lr(),s=lr();for(;t!==void 0;)switch(t._tag){case Br:{if(r.length===0)return[n,s];t=r.pop();break}case En:{if(n=Zn(n,Aa(t._tag,t.error)),r.length===0)return[n,s];t=r.pop();break}case Is:{if(n=Zn(n,Aa(t._tag,t.defect)),r.length===0)return[n,s];t=r.pop();break}case On:{if(n=Zn(n,Aa(t._tag,t.fiberId)),r.length===0)return[n,s];t=r.pop();break}case yn:{switch(t.left._tag){case Br:{t=t.right;break}case yn:{t=Pt(t.left.left,Pt(t.left.right,t.right));break}case vn:{t=ra(Pt(t.left.left,t.right),Pt(t.left.right,t.right));break}default:{s=Jt(s,t.right),t=t.left;break}}break}case vn:{r.push(t.right),t=t.left;break}}throw new Error(zi("Cause.evaluateCauseLoop"))},C0={emptyCase:xl,failCase:Ga,dieCase:Ga,interruptCase:xl,sequentialCase:(e,t,r)=>t&&r,parallelCase:(e,t,r)=>t&&r},Ul="SequentialCase",ql="ParallelCase",xd=y(2,(e,{onDie:t,onEmpty:r,onFail:n,onInterrupt:s,onParallel:i,onSequential:a})=>yc(e,void 0,{emptyCase:()=>r,failCase:(o,c)=>n(c),dieCase:(o,c)=>t(c),interruptCase:(o,c)=>s(c),sequentialCase:(o,c,l)=>a(c,l),parallelCase:(o,c,l)=>i(c,l)})),xn=y(3,(e,t,r)=>{let n=t,s=e;const i=[];for(;s!==void 0;){const a=r(n,s);switch(n=Zt(a)?a.value:n,s._tag){case yn:{i.push(s.right),s=s.left;break}case vn:{i.push(s.right),s=s.left;break}default:{s=void 0;break}}s===void 0&&i.length>0&&(s=i.pop())}return n}),yc=y(3,(e,t,r)=>{const n=[e],s=[];for(;n.length>0;){const a=n.pop();switch(a._tag){case Br:{s.push(ar(r.emptyCase(t)));break}case En:{s.push(ar(r.failCase(t,a.error)));break}case Is:{s.push(ar(r.dieCase(t,a.defect)));break}case On:{s.push(ar(r.interruptCase(t,a.fiberId)));break}case yn:{n.push(a.right),n.push(a.left),s.push(cn({_tag:Ul}));break}case vn:{n.push(a.right),n.push(a.left),s.push(cn({_tag:ql}));break}}}const i=[];for(;s.length>0;){const a=s.pop();switch(a._tag){case"Left":{switch(a.left._tag){case Ul:{const o=i.pop(),c=i.pop(),l=r.sequentialCase(t,o,c);i.push(l);break}case ql:{const o=i.pop(),c=i.pop(),l=r.parallelCase(t,o,c);i.push(l);break}}break}case"Right":{i.push(a.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()}),na=(e,t)=>vc(e)?"All fibers interrupted without errors.":N0(e).map(function(r){return(t==null?void 0:t.renderErrorCause)!==!0||r.cause===void 0?r.stack:`${r.stack} {
|
|
6
|
+
${Sd(r.cause," ")}
|
|
7
|
+
}`}).join(`
|
|
8
|
+
`),Sd=(e,t)=>{const r=e.stack.split(`
|
|
9
|
+
`);let n=`${t}[cause]: ${r[0]}`;for(let s=1,i=r.length;s<i;s++)n+=`
|
|
10
|
+
${t}${r[s]}`;return e.cause&&(n+=` {
|
|
11
|
+
${Sd(e.cause,`${t} `)}
|
|
12
|
+
${t}}`),n};class wi extends globalThis.Error{constructor(r){const n=typeof r=="object"&&r!==null,s=Error.stackTraceLimit;Error.stackTraceLimit=1;super(E0(r),n&&"cause"in r&&typeof r.cause<"u"?{cause:new wi(r.cause)}:void 0);h(this,"span");this.message===""&&(this.message="An error has occurred"),Error.stackTraceLimit=s,this.name=r instanceof Error?r.name:"Error",n&&(Sn in r&&(this.span=r[Sn]),Object.keys(r).forEach(i=>{i in this||(this[i]=r[i])})),this.stack=A0(`${this.name}: ${this.message}`,r instanceof Error&&r.stack?r.stack:"",this.span)}}const E0=e=>{if(typeof e=="string")return e;if(typeof e=="object"&&e!==null&&e instanceof Error)return e.message;try{if(le(e,"toString")&&Ui(e.toString)&&e.toString!==Object.prototype.toString&&e.toString!==globalThis.Array.prototype.toString)return e.toString()}catch{}return eh(e)},O0=/\((.*)\)/g,M0=ye("effect/Tracer/spanToTrace",()=>new WeakMap),A0=(e,t,r)=>{const n=[e],s=t.startsWith(e)?t.slice(e.length).split(`
|
|
13
|
+
`):t.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;n.push(s[i].replace(/at .*effect_instruction_i.*\((.*)\)/,"at $1").replace(/EffectPrimitive\.\w+/,"<anonymous>"))}if(r){let i=r,a=0;for(;i&&i._tag==="Span"&&a<10;){const o=M0.get(i);if(typeof o=="function"){const c=o();if(typeof c=="string"){const l=c.matchAll(O0);let f=!1;for(const[,p]of l)f=!0,n.push(` at ${i.name} (${p})`);f||n.push(` at ${i.name} (${c.replace(/^at /,"")})`)}else n.push(` at ${i.name}`)}else n.push(` at ${i.name}`);i=Tr(i.parent),a++}}return n.join(`
|
|
15
|
+
`)},Sn=Symbol.for("effect/SpanAnnotation"),N0=e=>yc(e,void 0,{emptyCase:()=>[],dieCase:(t,r)=>[new wi(r)],failCase:(t,r)=>[new wi(r)],interruptCase:()=>[],parallelCase:(t,r,n)=>[...r,...n],sequentialCase:(t,r,n)=>[...r,...n]}),sa="Pending",wd="Done",F0="effect/Deferred",P0=Symbol.for(F0),$0={_E:e=>e,_A:e=>e},j0=e=>({_tag:sa,joiners:e}),L0=e=>({_tag:wd,effect:e});class Ts{constructor(t){h(this,"self");h(this,"called",!1);this.self=t}next(t){return this.called?{value:t,done:!0}:(this.called=!0,{value:this.self,done:!1})}return(t){return{value:t,done:!0}}throw(t){throw t}[Symbol.iterator](){return new Ts(this.self)}}const Id=(e,t)=>{const r=new ft("Blocked");return r.effect_instruction_i0=e,r.effect_instruction_i1=t,r},D0=e=>{const t=new ft("RunBlocked");return t.effect_instruction_i0=e,t},wn=Symbol.for("effect/Effect");class B0{constructor(t,r){h(this,"patch");h(this,"op");h(this,"_op",Qo);this.patch=t,this.op=r}}var qu;class ft{constructor(t){h(this,"_op");h(this,"effect_instruction_i0");h(this,"effect_instruction_i1");h(this,"effect_instruction_i2");h(this,"trace");h(this,qu,on);this._op=t}[(qu=wn,ae)](t){return this===t}[oe](){return qe(this,Jo(this))}pipe(){return se(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 ut(this.toJSON())}[Je](){return this.toJSON()}[Symbol.iterator](){return new Ts(new ps(this))}}var zu;class Td{constructor(t){h(this,"_op");h(this,"effect_instruction_i0");h(this,"effect_instruction_i1");h(this,"effect_instruction_i2");h(this,"trace");h(this,zu,on);this._op=t,this._tag=t}[(zu=wn,ae)](t){return ua(t)&&t._op==="Failure"&&ce(this.effect_instruction_i0,t.effect_instruction_i0)}[oe](){return T(He(this._tag),ge(q(this.effect_instruction_i0)),qe(this))}get cause(){return this.effect_instruction_i0}pipe(){return se(this,arguments)}toJSON(){return{_id:"Exit",_tag:this._op,cause:this.cause.toJSON()}}toString(){return ut(this.toJSON())}[Je](){return this.toJSON()}[Symbol.iterator](){return new Ts(new ps(this))}}var Vu;class Rd{constructor(t){h(this,"_op");h(this,"effect_instruction_i0");h(this,"effect_instruction_i1");h(this,"effect_instruction_i2");h(this,"trace");h(this,Vu,on);this._op=t,this._tag=t}[(Vu=wn,ae)](t){return ua(t)&&t._op==="Success"&&ce(this.effect_instruction_i0,t.effect_instruction_i0)}[oe](){return T(He(this._tag),ge(q(this.effect_instruction_i0)),qe(this))}get value(){return this.effect_instruction_i0}pipe(){return se(this,arguments)}toJSON(){return{_id:"Exit",_tag:this._op,value:nt(this.value)}}toString(){return ut(this.toJSON())}[Je](){return this.toJSON()}[Symbol.iterator](){return new Ts(new ps(this))}}const kc=e=>le(e,wn),Mt=e=>{const t=new ft(nh);return t.effect_instruction_i0=e,t},U0=y(3,(e,t,r)=>oa(n=>ee(e,s=>ee(Od(et(()=>n(t(s)))),i=>et(()=>r(s,i)).pipe(In({onFailure:a=>{switch(i._tag){case Ht:return Gt(Pt(i.effect_instruction_i0,a));case Kt:return Gt(a)}},onSuccess:()=>i})))))),Rs=y(2,(e,t)=>ee(e,()=>Oe(t))),ia=e=>Rs(e,void 0),Cd=function(){const e=new ft(Hi);switch(arguments.length){case 2:{e.effect_instruction_i0=arguments[0],e.commit=arguments[1];break}case 3:{e.effect_instruction_i0=arguments[0],e.effect_instruction_i1=arguments[1],e.commit=arguments[2];break}case 4:{e.effect_instruction_i0=arguments[0],e.effect_instruction_i1=arguments[1],e.effect_instruction_i2=arguments[2],e.commit=arguments[3];break}default:throw new Error(zi("you're not supposed to end up here"))}return e},Ii=(e,t=_n)=>{const r=new ft(Wn);let n;return r.effect_instruction_i0=s=>{n=e(s)},r.effect_instruction_i1=t,Pd(r,s=>kc(n)?n:Xt)},q0=(e,t=_n)=>et(()=>Ii(e,t)),Ur=(e,t=_n)=>Cd(e,function(){let r,n;function s(c){r?r(c):n===void 0&&(n=c)}const i=new ft(Wn);i.effect_instruction_i0=c=>{r=c,n&&c(n)},i.effect_instruction_i1=t;let a,o;return this.effect_instruction_i0.length!==1?(o=new AbortController,a=vt(()=>this.effect_instruction_i0(s,o.signal))):a=vt(()=>this.effect_instruction_i0(s)),a||o?Pd(i,c=>(o&&o.abort(),a??Xt)):i}),zl=y(2,(e,t)=>Sc(e,{onFailure:t,onSuccess:Oe})),Vl=Symbol.for("effect/OriginalAnnotation"),Ed=(e,t)=>Zt(t)?new Proxy(e,{has(r,n){return n===Sn||n===Vl||n in r},get(r,n){return n===Sn?t.value:n===Vl?e:r[n]}}):e,Hl=e=>qi(e)&&!(Sn in e)?Mt(t=>Gt(cr(Ed(e,Wd(t))))):Gt(cr(e)),z0=e=>V0(()=>cr(new Sk(e))),us=e=>Sc(e,{onFailure:t=>Oe(cn(t)),onSuccess:t=>Oe(ar(t))}),Od=e=>G0(e,{onFailure:Ue,onSuccess:lt}),gt=e=>qi(e)&&!(Sn in e)?Mt(t=>Gt(po(Ed(e,Wd(t))))):Gt(po(e)),xc=e=>ee(X(e),gt),Gt=e=>{const t=new Td(Ht);return t.effect_instruction_i0=e,t},V0=e=>ee(X(e),Gt),H0=Mt(e=>Oe(e.id())),K0=e=>Mt(t=>e(t.id())),ee=y(2,(e,t)=>{const r=new ft(gi);return r.effect_instruction_i0=e,r.effect_instruction_i1=t,r}),J0=e=>{const t=new ft("OnStep");return t.effect_instruction_i0=e,t},Md=e=>ee(e,je),G0=y(2,(e,t)=>In(e,{onFailure:r=>Oe(t.onFailure(r)),onSuccess:r=>Oe(t.onSuccess(r))})),In=y(2,(e,t)=>{const r=new ft(pi);return r.effect_instruction_i0=e,r.effect_instruction_i1=t.onFailure,r.effect_instruction_i2=t.onSuccess,r}),Sc=y(2,(e,t)=>In(e,{onFailure:r=>{if(v0(r).length>0)return Gt(w0(r));const s=b0(r);return s.length>0?t.onFailure($h(s)):Gt(r)},onSuccess:t.onSuccess})),vr=y(2,(e,t)=>et(()=>{const r=Qe(e),n=tc(r.length);let s=0;return Rs(Ic({while:()=>s<r.length,body:()=>t(r[s],s),step:i=>{n[s++]=i}}),n)})),aa=y(2,(e,t)=>et(()=>{const r=Qe(e);let n=0;return Ic({while:()=>n<r.length,body:()=>t(r[n],n),step:()=>{n++}})})),Ad=e=>{const t=new ft(_s);return t.effect_instruction_i0=Qy(ws),t.effect_instruction_i1=()=>e,t},yt=y(2,(e,t)=>ee(e,r=>X(()=>t(r)))),Nd=y(2,(e,t)=>Sc(e,{onFailure:r=>xc(()=>t.onFailure(r)),onSuccess:r=>X(()=>t.onSuccess(r))})),wc=y(2,(e,t)=>In(e,{onFailure:r=>{const n=x0(r);switch(n._tag){case"Left":return xc(()=>t(n.left));case"Right":return Gt(n.right)}},onSuccess:Oe})),Fd=y(2,(e,t)=>oa(r=>In(r(e),{onFailure:n=>{const s=Ue(n);return In(t(s),{onFailure:i=>Ue(Pt(n,i)),onSuccess:()=>s})},onSuccess:n=>{const s=lt(n);return Rc(t(s),s)}}))),Pd=y(2,(e,t)=>Fd(e,Kd({onFailure:r=>vc(r)?ia(t(y0(r))):Xt,onSuccess:()=>Xt}))),Oe=e=>{const t=new Rd(Kt);return t.effect_instruction_i0=e,t},et=e=>{const t=new ft(Hi);return t.commit=e,t},X=e=>{const t=new ft(rh);return t.effect_instruction_i0=e,t},W0=y(e=>e.length===3||e.length===2&&!(qi(e[1])&&"onlyEffect"in e[1]),(e,t)=>ee(e,r=>{const n=typeof t=="function"?t(r):t;return kc(n)?Rs(n,r):Pm(n)?Ii(s=>{n.then(i=>s(Oe(r)),i=>s(gt(new Hd(i,"An unknown error occurred in Effect.tap"))))}):Oe(r)})),Y0=e=>Mt(t=>{const r=t.getFiberRef(bo),n=T(r,$r(()=>t.scope()));return e(ca(bo,he(n)))}),$d=e=>{const t=new ft(_s);return t.effect_instruction_i0=pd(ws),t.effect_instruction_i1=()=>e,t},oa=e=>Cd(e,function(){const t=new ft(_s);return t.effect_instruction_i0=pd(ws),t.effect_instruction_i1=r=>gd(r)?vt(()=>this.effect_instruction_i0(Ad)):vt(()=>this.effect_instruction_i0($d)),t}),Xt=Oe(void 0),Q0=e=>{const t=new ft(_s);return t.effect_instruction_i0=e,t.effect_instruction_i1=void 0,t},Ic=e=>{const t=new ft(mi);return t.effect_instruction_i0=e.while,t.effect_instruction_i1=e.body,t.effect_instruction_i2=e.step,t},Z0=e=>et(()=>{const t=new ft(Yn);return t.effect_instruction_i0=e(),t}),X0=function(){const e=arguments.length===1?arguments[0]:arguments[1].bind(arguments[0]);return Z0(()=>e(T))},Tc=e=>{const t=new ft(ei);return typeof(e==null?void 0:e.priority)<"u"?bk(t,e.priority):t},jd=y(2,(e,t)=>ee(e,r=>yt(t,n=>[r,n]))),Ld=y(2,(e,t)=>ee(e,r=>Rs(t,r))),Rc=y(2,(e,t)=>ee(e,()=>t)),ek=e=>ee(H0,t=>T(e,tk(t))),tk=y(2,(e,t)=>ee(e.interruptAsFork(t),()=>e.await)),rk={_tag:"All",syslog:0,label:"ALL",ordinal:Number.MIN_SAFE_INTEGER,pipe(){return se(this,arguments)}},nk={_tag:"Fatal",syslog:2,label:"FATAL",ordinal:5e4,pipe(){return se(this,arguments)}},sk={_tag:"Error",syslog:3,label:"ERROR",ordinal:4e4,pipe(){return se(this,arguments)}},Dd={_tag:"Warning",syslog:4,label:"WARN",ordinal:3e4,pipe(){return se(this,arguments)}},Bd={_tag:"Info",syslog:6,label:"INFO",ordinal:2e4,pipe(){return se(this,arguments)}},Ud={_tag:"Debug",syslog:7,label:"DEBUG",ordinal:1e4,pipe(){return se(this,arguments)}},ik={_tag:"Trace",syslog:7,label:"TRACE",ordinal:0,pipe(){return se(this,arguments)}},ak={_tag:"None",syslog:7,label:"OFF",ordinal:Number.MAX_SAFE_INTEGER,pipe(){return se(this,arguments)}},ok="effect/FiberRef",ck=Symbol.for(ok),lk={_A:e=>e},Cc=e=>Mt(t=>lt(t.getFiberRef(e))),Ec=y(2,(e,t)=>ee(Cc(e),t)),Kl=y(2,(e,t)=>uk(e,()=>[void 0,t])),uk=y(2,(e,t)=>Mt(r=>{const[n,s]=t(r.getFiberRef(e));return r.setFiberRef(e,s),Oe(n)})),ca=y(3,(e,t,r)=>U0(Ld(Cc(t),Kl(t,r)),()=>e,n=>Kl(t,n))),Rt=(e,t)=>An(e,{differ:hd(),fork:(t==null?void 0:t.fork)??je,join:t==null?void 0:t.join}),fk=e=>{const t=Ny();return An(e,{differ:t,fork:t.empty})},hk=e=>{const t=Fy(hd());return An(e,{differ:t,fork:t.empty})},qd=e=>{const t=Ay();return An(e,{differ:t,fork:t.empty})},An=(e,t)=>({...vs,[ck]:lk,initial:e,commit(){return Cc(this)},diff:(n,s)=>t.differ.diff(n,s),combine:(n,s)=>t.differ.combine(n,s),patch:n=>s=>t.differ.patch(n,s),fork:t.fork,join:t.join??((n,s)=>s)}),dk=e=>An(e,{differ:Ll,fork:Ll.empty}),la=ye(Symbol.for("effect/FiberRef/currentContext"),()=>qd(Rh())),Oc=ye(Symbol.for("effect/FiberRef/currentSchedulingPriority"),()=>Rt(0)),gk=ye(Symbol.for("effect/FiberRef/currentMaxOpsBeforeYield"),()=>Rt(2048)),pk=ye(Symbol.for("effect/FiberRef/currentLogAnnotation"),()=>Rt(pc())),mk=ye(Symbol.for("effect/FiberRef/currentLogLevel"),()=>Rt(Bd)),_k=ye(Symbol.for("effect/FiberRef/currentLogSpan"),()=>Rt(bn())),bk=y(2,(e,t)=>ca(e,Oc,t)),vk=ye(Symbol.for("effect/FiberRef/currentConcurrency"),()=>Rt("unbounded")),yk=ye(Symbol.for("effect/FiberRef/currentRequestBatching"),()=>Rt(!0)),kk=ye(Symbol.for("effect/FiberRef/currentUnhandledErrorLogLevel"),()=>Rt(he(Ud))),xk=ye(Symbol.for("effect/FiberRef/versionMismatchErrorLogLevel"),()=>Rt(he(Dd))),_o=ye(Symbol.for("effect/FiberRef/currentMetricLabels"),()=>hk(un())),bo=ye(Symbol.for("effect/FiberRef/currentForkScopeOverride"),()=>Rt(ne(),{fork:()=>ne(),join:(e,t)=>e})),Vs=ye(Symbol.for("effect/FiberRef/currentInterruptedCause"),()=>Rt(kn,{fork:()=>kn,join:(e,t)=>e})),Mc=(e,t)=>e.fork(t),zd=(function(){class e extends globalThis.Error{commit(){return gt(this)}toJSON(){const r={...this};return this.message&&(r.message=this.message),this.cause&&(r.cause=this.cause),r}[Je](){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?na(po(this),{renderErrorCause:!0}):this}}return Object.assign(e.prototype,i_),e})(),Vd=(e,t)=>{class r extends zd{constructor(){super(...arguments);h(this,"_tag",t)}}return Object.assign(r.prototype,e),r.prototype.name=t,r},Jl=Symbol.for("effect/Cause/errors/RuntimeException"),Sk=Vd({[Jl]:Jl},"RuntimeException"),wk=Symbol.for("effect/Cause/errors/InterruptedException"),Ik=e=>le(e,wk),Gl=Symbol.for("effect/Cause/errors/NoSuchElement"),Tk=Vd({[Gl]:Gl},"NoSuchElementException"),Wl=Symbol.for("effect/Cause/errors/UnknownException"),Hd=(function(){class e extends zd{constructor(n,s){super(s??"An unknown error occurred",{cause:n});h(this,"_tag","UnknownException");h(this,"error");this.error=n}}return Object.assign(e.prototype,{[Wl]:Wl,name:"UnknownException"}),e})(),ua=e=>kc(e)&&"_tag"in e&&(e._tag==="Success"||e._tag==="Failure"),Yl=(e,t)=>Ek(e,t!=null&&t.parallel?ra:Pt),Ue=e=>{const t=new Td(Ht);return t.effect_instruction_i0=e,t},Rk=e=>Ue(br(e)),$a=y(2,(e,t)=>{switch(e._tag){case Ht:return Ue(e.effect_instruction_i0);case Kt:return lt(t(e.effect_instruction_i0))}}),Kd=y(2,(e,{onFailure:t,onSuccess:r})=>{switch(e._tag){case Ht:return t(e.effect_instruction_i0);case Kt:return r(e.effect_instruction_i0)}}),lt=e=>{const t=new Rd(Kt);return t.effect_instruction_i0=e,t},Or=lt(void 0),Ck=y(3,(e,t,{onFailure:r,onSuccess:n})=>{switch(e._tag){case Ht:switch(t._tag){case Kt:return Ue(e.effect_instruction_i0);case Ht:return Ue(r(e.effect_instruction_i0,t.effect_instruction_i0))}case Kt:switch(t._tag){case Kt:return lt(n(e.effect_instruction_i0,t.effect_instruction_i0));case Ht:return Ue(t.effect_instruction_i0)}}}),Ek=(e,t)=>{const r=Ph(e);return dn(r)?T(Er(r),kh(T(gn(r),$a(Ot)),(n,s)=>T(n,Ck(s,{onSuccess:(i,a)=>T(i,Jt(a)),onFailure:t}))),$a(hn),$a(n=>Nr(n)),he):ne()},Ok=e=>({...vs,[P0]:$0,state:Xh(j0([])),commit(){return Jd(this)},blockingOn:e}),Jd=e=>q0(t=>{const r=Xi(e.state);switch(r._tag){case wd:return t(r.effect);case sa:return r.joiners.push(t),Mk(e,t)}},e.blockingOn),Gd=(e,t)=>{const r=Xi(e.state);if(r._tag===sa){ed(e.state,L0(t));for(let n=0,s=r.joiners.length;n<s;n++)r.joiners[n](t)}},Mk=(e,t)=>X(()=>{const r=Xi(e.state);if(r._tag===sa){const n=r.joiners.indexOf(t);n>=0&&r.joiners.splice(n,1)}}),Ak=Mt(e=>lt(e.currentContext)),Nk=()=>Ak,Cs=e=>ee(Nk(),e),Fk=y(2,(e,t)=>ca(la,t)(e)),Pk=y(2,(e,t)=>Cs(r=>Fk(e,t(r)))),Wd=e=>{const t=e.currentSpan;return t!==void 0&&t._tag==="Span"?he(t):ne()},Ql=Symbol.for("effect/MutableHashMap"),$k={[Ql]:Ql,[Symbol.iterator](){return new Ac(this)},toString(){return ut(this.toJSON())},toJSON(){return{_id:"MutableHashMap",values:Array.from(this).map(nt)}},[Je](){return this.toJSON()},pipe(){return se(this,arguments)}};class Ac{constructor(t){h(this,"self");h(this,"referentialIterator");h(this,"bucketIterator");this.self=t,this.referentialIterator=t.referential[Symbol.iterator]()}next(){if(this.bucketIterator!==void 0)return this.bucketIterator.next();const t=this.referentialIterator.next();return t.done?(this.bucketIterator=new jk(this.self.buckets.values()),this.next()):t}[Symbol.iterator](){return new Ac(this.self)}}class jk{constructor(t){h(this,"backing");h(this,"currentBucket");this.backing=t}next(){if(this.currentBucket===void 0){const r=this.backing.next();if(r.done)return r;this.currentBucket=r.value[Symbol.iterator]()}const t=this.currentBucket.next();return t.done?(this.currentBucket=void 0,this.next()):t}}const Lk=()=>{const e=Object.create($k);return e.referential=new Map,e.buckets=new Map,e.bucketsSize=0,e},Rr=y(2,(e,t)=>{if(di(t)===!1)return e.referential.has(t)?he(e.referential.get(t)):ne();const r=t[oe](),n=e.buckets.get(r);return n===void 0?ne():Dk(e,n,t)}),Dk=(e,t,r,n=!1)=>{for(let s=0,i=t.length;s<i;s++)if(r[ae](t[s][0])){const a=t[s][1];return n&&(t.splice(s,1),e.bucketsSize--),he(a)}return ne()},Dn=y(2,(e,t)=>Zt(Rr(e,t))),Bn=y(3,(e,t,r)=>{if(di(t)===!1)return e.referential.set(t,r),e;const n=t[oe](),s=e.buckets.get(n);return s===void 0?(e.buckets.set(n,[[t,r]]),e.bucketsSize++,e):(Bk(e,s,t),s.push([t,r]),e.bucketsSize++,e)}),Bk=(e,t,r)=>{for(let n=0,s=t.length;n<s;n++)if(r[ae](t[n][0])){t.splice(n,1),e.bucketsSize--;return}},Uk="effect/Clock",Zl=Symbol.for(Uk),Nc=Kr("effect/Clock"),qk=2**31-1,Xl={unsafeSchedule(e,t){const r=no(t);if(r>qk)return Ga;let n=!1;const s=setTimeout(()=>{n=!0,e()},r);return()=>(clearTimeout(s),!n)}},eu=(function(){const e=BigInt(1e6);if(typeof performance>"u"||typeof performance.now!="function")return()=>BigInt(Date.now())*e;let t;return()=>(t===void 0&&(t=BigInt(Date.now())*e-BigInt(Math.round(performance.now()*1e6))),t+BigInt(Math.round(performance.now()*1e6)))})(),zk=(function(){const e=typeof process=="object"&&"hrtime"in process&&typeof process.hrtime.bigint=="function"?process.hrtime:void 0;if(!e)return eu;const t=eu()-e.bigint();return()=>t+e.bigint()})();var Hu;Hu=Zl;class Vk{constructor(){h(this,Hu,Zl);h(this,"currentTimeMillis",X(()=>this.unsafeCurrentTimeMillis()));h(this,"currentTimeNanos",X(()=>this.unsafeCurrentTimeNanos()))}unsafeCurrentTimeMillis(){return Date.now()}unsafeCurrentTimeNanos(){return zk()}scheduler(){return Oe(Xl)}sleep(t){return Ur(r=>{const n=Xl.unsafeSchedule(()=>r(Xt),t);return ia(X(n))})}}const Hk=()=>new Vk,Yd="And",Qd="Or",Zd="InvalidData",Xd="MissingData",eg="SourceUnavailable",tg="Unsupported",Kk="effect/ConfigError",tu=Symbol.for(Kk),Nn={_tag:"ConfigError",[tu]:tu},rg=(e,t)=>{const r=Object.create(Nn);return r._op=Yd,r.left=e,r.right=t,Object.defineProperty(r,"toString",{enumerable:!1,value(){return`${this.left} and ${this.right}`}}),Object.defineProperty(r,"message",{enumerable:!1,get(){return this.toString()}}),r},ng=(e,t)=>{const r=Object.create(Nn);return r._op=Qd,r.left=e,r.right=t,Object.defineProperty(r,"toString",{enumerable:!1,value(){return`${this.left} or ${this.right}`}}),Object.defineProperty(r,"message",{enumerable:!1,get(){return this.toString()}}),r},Jk=(e,t,r={pathDelim:"."})=>{const n=Object.create(Nn);return n._op=Zd,n.path=e,n.message=t,Object.defineProperty(n,"toString",{enumerable:!1,value(){return`(Invalid data at ${T(this.path,Rn(r.pathDelim))}: "${this.message}")`}}),n},qr=(e,t,r={pathDelim:"."})=>{const n=Object.create(Nn);return n._op=Xd,n.path=e,n.message=t,Object.defineProperty(n,"toString",{enumerable:!1,value(){return`(Missing data at ${T(this.path,Rn(r.pathDelim))}: "${this.message}")`}}),n},Gk=(e,t,r,n={pathDelim:"."})=>{const s=Object.create(Nn);return s._op=eg,s.path=e,s.message=t,s.cause=r,Object.defineProperty(s,"toString",{enumerable:!1,value(){return`(Source unavailable at ${T(this.path,Rn(n.pathDelim))}: "${this.message}")`}}),s},Wk=(e,t,r={pathDelim:"."})=>{const n=Object.create(Nn);return n._op=tg,n.path=e,n.message=t,Object.defineProperty(n,"toString",{enumerable:!1,value(){return`(Unsupported operation at ${T(this.path,Rn(r.pathDelim))}: "${this.message}")`}}),n},Mr=y(2,(e,t)=>{switch(e._op){case Yd:return rg(Mr(e.left,t),Mr(e.right,t));case Qd:return ng(Mr(e.left,t),Mr(e.right,t));case Zd:return Jk([...t,...e.path],e.message);case Xd:return qr([...t,...e.path],e.message);case eg:return Gk([...t,...e.path],e.message,e.cause);case tg:return Wk([...t,...e.path],e.message)}}),Yk={_tag:"Empty"},ja=y(2,(e,t)=>{let r=mc(t),n=e;for(;Bv(r);){const s=r.head;switch(s._tag){case"Empty":{r=r.tail;break}case"AndThen":{r=Dr(s.first,Dr(s.second,r.tail));break}case"MapName":{n=tn(n,s.f),r=r.tail;break}case"Nested":{n=_i(n,s.name),r=r.tail;break}case"Unnested":{if(T(Qn(n),w_(s.name)))n=ln(n),r=r.tail;else return cn(qr(n,`Expected ${s.name} to be in path in ConfigProvider#unnested`));break}}}return ar(n)}),Qk="Constant",Zk="Fail",Xk="Fallback",ex="Described",tx="Lazy",rx="MapOrFail",nx="Nested",sx="Primitive",ix="Sequence",ax="HashMap",ox="ZipWith";var ru={};const Ti=(e,t)=>[...e,...t],cx="effect/ConfigProvider",nu=Symbol.for(cx),lx=Kr("effect/ConfigProvider"),ux="effect/ConfigProviderFlat",su=Symbol.for(ux),fx=e=>({[nu]:nu,pipe(){return se(this,arguments)},...e}),hx=e=>({[su]:su,patch:e.patch,load:(t,r,n=!0)=>e.load(t,r,n),enumerateChildren:e.enumerateChildren}),dx=e=>fx({load:t=>ee(Ft(e,un(),t,!1),r=>Hr(Qn(r),{onNone:()=>gt(qr(un(),`Expected a single value having structure: ${t}`)),onSome:Oe})),flattened:e}),gx=e=>{const{pathDelim:t,seqDelim:r}=Object.assign({},{pathDelim:"_",seqDelim:","},e),n=c=>T(c,Rn(t)),s=c=>c.split(t),i=()=>typeof process<"u"&&"env"in process&&typeof ru=="object"?ru:{};return dx(hx({load:(c,l,f=!0)=>{const p=n(c),d=i(),g=p in d?he(d[p]):ne();return T(g,wc(()=>qr(c,`Expected ${p} to exist in the process context`)),ee(_=>vx(_,c,l,r,f)))},enumerateChildren:c=>X(()=>{const l=i(),d=Object.keys(l).map(g=>s(g.toUpperCase())).filter(g=>{for(let _=0;_<c.length;_++){const k=T(c,vh(_)),b=g[_];if(b===void 0||k!==b)return!1}return!0}).flatMap(g=>g.slice(c.length,c.length+1));return yv(d)}),patch:Yk}))},px=(e,t,r,n)=>{const s=Tl(r.length,c=>c>=n.length?ne():he([e(c),c+1])),i=Tl(n.length,c=>c>=r.length?ne():he([t(c),c+1])),a=Ti(r,s),o=Ti(n,i);return[a,o]},mx=(e,t)=>{let r=t;if(r._tag==="Nested"){const n=e.slice();for(;r._tag==="Nested";)n.push(r.name),r=r.config;return n}return e},Ft=(e,t,r,n)=>{const s=r;switch(s._tag){case Qk:return Oe(Dt(s.value));case ex:return et(()=>Ft(e,t,s.config,n));case Zk:return gt(qr(t,s.message));case Xk:return T(et(()=>Ft(e,t,s.first,n)),zl(i=>s.condition(i)?T(Ft(e,t,s.second,n),zl(a=>gt(ng(i,a)))):gt(i)));case tx:return et(()=>Ft(e,t,s.config(),n));case rx:return et(()=>T(Ft(e,t,s.original,n),ee(vr(i=>T(s.mapOrFail(i),wc(Mr(mx(t,s.original))))))));case nx:return et(()=>Ft(e,Ti(t,Dt(s.name)),s.config,n));case sx:return T(ja(t,e.patch),ee(i=>T(e.load(i,s,n),ee(a=>{if(a.length===0){const o=T(F_(i),$r(()=>"<n/a>"));return gt(qr([],`Expected ${s.description} with name ${o}`))}return Oe(a)}))));case ix:return T(ja(t,e.patch),ee(i=>T(e.enumerateChildren(i),ee(kx),ee(a=>a.length===0?et(()=>yt(Ft(e,t,s.config,!0),Dt)):T(vr(a,o=>Ft(e,C_(t,`[${o}]`),s.config,!0)),yt(o=>{const c=H_(o);return c.length===0?Dt(un()):Dt(c)}))))));case ax:return et(()=>T(ja(t,e.patch),ee(i=>T(e.enumerateChildren(i),ee(a=>T(a,vr(o=>Ft(e,Ti(i,Dt(o)),s.valueConfig,n)),yt(o=>o.length===0?Dt(pc()):T(yx(o),tn(c=>Mv(Il(Qe(a),c)))))))))));case ox:return et(()=>T(Ft(e,t,s.left,n),us,ee(i=>T(Ft(e,t,s.right,n),us,ee(a=>{if(Kn(i)&&Kn(a))return gt(rg(i.left,a.left));if(Kn(i)&&Us(a))return gt(i.left);if(Us(i)&&Kn(a))return gt(a.left);if(Us(i)&&Us(a)){const o=T(t,Rn(".")),c=_x(t,o),[l,f]=px(c,c,T(i.right,tn(ar)),T(a.right,tn(ar)));return T(l,Il(f),vr(([p,d])=>T(jd(p,d),yt(([g,_])=>s.zip(g,_)))))}throw new Error("BUG: ConfigProvider.fromFlatLoop - please report an issue at https://github.com/Effect-TS/effect/issues")})))))}},_x=(e,t)=>r=>cn(qr(e,`The element at index ${r} in a sequence at path "${t}" was missing`)),bx=(e,t)=>e.split(new RegExp(`\\s*${J_(t)}\\s*`)),vx=(e,t,r,n,s)=>s?T(bx(e,n),vr(i=>r.parse(i.trim())),wc(Mr(t))):T(r.parse(e),Nd({onFailure:Mr(t),onSuccess:Dt})),yx=e=>Object.keys(e[0]).map(t=>e.map(r=>r[t])),kx=e=>T(vr(e,Sx),Nd({onFailure:()=>un(),onSuccess:bi(ns)}),us,yt(p_)),xx=/^(\[(\d+)\])$/,Sx=e=>{const t=e.match(xx);if(t!==null){const r=t[2];return T(r!==void 0&&r.length>0?he(r):ne(),k_(wx))}return ne()},wx=e=>{const t=Number.parseInt(e);return Number.isNaN(t)?ne():he(t)},iu=Symbol.for("effect/Console"),sg=Kr("effect/Console"),Ix={[iu]:iu,assert(e,...t){return X(()=>{console.assert(e,...t)})},clear:X(()=>{console.clear()}),count(e){return X(()=>{console.count(e)})},countReset(e){return X(()=>{console.countReset(e)})},debug(...e){return X(()=>{console.debug(...e)})},dir(e,t){return X(()=>{console.dir(e,t)})},dirxml(...e){return X(()=>{console.dirxml(...e)})},error(...e){return X(()=>{console.error(...e)})},group(e){return e!=null&&e.collapsed?X(()=>console.groupCollapsed(e==null?void 0:e.label)):X(()=>console.group(e==null?void 0:e.label))},groupEnd:X(()=>{console.groupEnd()}),info(...e){return X(()=>{console.info(...e)})},log(...e){return X(()=>{console.log(...e)})},table(e,t){return X(()=>{console.table(e,t)})},time(e){return X(()=>console.time(e))},timeEnd(e){return X(()=>console.timeEnd(e))},timeLog(e,...t){return X(()=>{console.timeLog(e,...t)})},trace(...e){return X(()=>{console.trace(...e)})},warn(...e){return X(()=>{console.warn(...e)})},unsafe:console},Tx="effect/Random",au=Symbol.for(Tx),Rx=Kr("effect/Random");var Ku;Ku=au;class Cx{constructor(t){h(this,"seed");h(this,Ku,au);h(this,"PRNG");this.seed=t,this.PRNG=new qm(t)}get next(){return X(()=>this.PRNG.number())}get nextBoolean(){return yt(this.next,t=>t>.5)}get nextInt(){return X(()=>this.PRNG.integer(Number.MAX_SAFE_INTEGER))}nextRange(t,r){return yt(this.next,n=>(r-t)*n+t)}nextIntBetween(t,r){return X(()=>this.PRNG.integer(r-t)+t)}shuffle(t){return Ex(t,r=>this.nextIntBetween(0,r))}}const Ex=(e,t)=>et(()=>T(X(()=>Array.from(e)),ee(r=>{const n=[];for(let s=r.length;s>=2;s=s-1)n.push(s);return T(n,aa(s=>T(t(s),yt(i=>Ox(r,s-1,i)))),Rs(Ph(r)))}))),Ox=(e,t,r)=>{const n=e[t];return e[t]=e[r],e[r]=n,e},Mx=e=>new Cx(q(e)),ou=Symbol.for("effect/Tracer"),Ax=e=>({[ou]:ou,...e}),ig=Kr("effect/Tracer"),ag=Kr("effect/ParentSpan"),cu=(function(){const e="abcdef0123456789",t=e.length;return function(r){let n="";for(let s=0;s<r;s++)n+=e.charAt(Math.floor(Math.random()*t));return n}})();class Nx{constructor(t,r,n,s,i,a){h(this,"name");h(this,"parent");h(this,"context");h(this,"startTime");h(this,"kind");h(this,"_tag","Span");h(this,"spanId");h(this,"traceId","native");h(this,"sampled",!0);h(this,"status");h(this,"attributes");h(this,"events",[]);h(this,"links");this.name=t,this.parent=r,this.context=n,this.startTime=i,this.kind=a,this.status={_tag:"Started",startTime:i},this.attributes=new Map,this.traceId=r._tag==="Some"?r.value.traceId:cu(32),this.spanId=cu(16),this.links=Array.from(s)}end(t,r){this.status={_tag:"Ended",endTime:t,exit:r,startTime:this.status.startTime}}attribute(t,r){this.attributes.set(t,r)}event(t,r,n){this.events.push([t,r,n??{}])}addLinks(t){this.links.push(...t)}}const Fx=Ax({span:(e,t,r,n,s,i)=>new Nx(e,t,r,n,s,i),context:e=>e()}),Px=T(Rh(),Ln(Nc,Hk()),Ln(sg,Ix),Ln(Rx,Mx(Math.random())),Ln(lx,gx()),Ln(ig,Fx)),Ri=ye(Symbol.for("effect/DefaultServices/currentServices"),()=>qd(Px)),lu=Symbol.for("effect/FiberRefs");var Ju;Ju=lu;class fs{constructor(t){h(this,"locals");h(this,Ju,lu);this.locals=t}pipe(){return se(this,arguments)}}const $x=(e,t,r,n=!1)=>{const s=e;let i=t,a=r,o=n,c;for(;c===void 0;)if(Et(i)&&Et(a)){const l=Tt(i)[0],f=ln(i),p=Tt(a)[0],d=Tt(a)[1],g=ln(a);l.startTimeMillis<p.startTimeMillis?(a=g,o=!0):l.startTimeMillis>p.startTimeMillis?i=f:l.id<p.id?(a=g,o=!0):l.id>p.id?i=f:c=[d,o]}else c=[s.initial,!0];return c},jx=y(3,(e,t,r)=>{const n=new Map(e.locals);return r.locals.forEach((s,i)=>{const a=s[0][1];if(!s[0][0][ae](t)){if(!n.has(i)){if(ce(a,i.initial))return;n.set(i,[[t,i.join(i.initial,a)]]);return}const o=n.get(i),[c,l]=$x(i,o,s);if(l){const f=i.diff(c,a),p=o[0][1],d=i.join(p,i.patch(f)(p));if(!ce(p,d)){let g;const _=o[0][0];_[ae](t)?g=[[_,d],...o.slice(1)]:g=[[t,d],...o],n.set(i,g)}}}}),new fs(n)}),Lx=y(2,(e,t)=>{const r=new Map;return Dx(e,r,t),new fs(r)}),Dx=(e,t,r)=>{e.locals.forEach((n,s)=>{const i=n[0][1],a=s.patch(s.fork)(i);ce(i,a)?t.set(s,n):t.set(s,[[r,a],...n])})},og=y(2,(e,t)=>{const r=new Map(e.locals);return r.delete(t),new fs(r)}),Bx=y(2,(e,t)=>e.locals.has(t)?he(Tt(e.locals.get(t))[1]):ne()),hs=y(2,(e,t)=>T(Bx(e,t),$r(()=>t.initial))),vo=y(2,(e,{fiberId:t,fiberRef:r,value:n})=>{if(e.locals.size===0)return new fs(new Map([[r,[[t,n]]]]));const s=new Map(e.locals);return Ux(s,t,r,n),new fs(s)}),Ux=(e,t,r,n)=>{const s=e.get(r)??[];let i;if(Et(s)){const[a,o]=Tt(s);if(a[ae](t)){if(ce(o,n))return;i=[[t,n],...s.slice(1)]}else i=[[t,n],...s]}else i=[[t,n]];e.set(r,i)},qx=hs,zx=rk,Vx=nk,Hx=sk,Kx=Dd,Jx=Bd,Gx=Ud,Wx=ik,Yx=ak,Qx=T(ns,__(e=>e.ordinal)),Zx=b_(Qx),Xx=e=>{switch(e){case"All":return zx;case"Debug":return Gx;case"Error":return Hx;case"Fatal":return Vx;case"Info":return Jx;case"Trace":return Wx;case"None":return Yx;case"Warning":return Kx}},cg=e=>e.replace(/[\s="]/g,"_"),eS=e=>t=>`${cg(t.label)}=${e-t.startTime}ms`,tS=bs,rS=a_;class nS extends rS{}const lg="Empty",ug="Add",fg="Remove",hg="Update",dg="AndThen",sS={_tag:lg},iS=(e,t)=>{const r=new Map(e.locals);let n=sS;for(const[s,i]of t.locals.entries()){const a=Tt(i)[1],o=r.get(s);if(o!==void 0){const c=Tt(o)[1];ce(c,a)||(n=La({_tag:hg,fiberRef:s,patch:s.diff(c,a)})(n))}else n=La({_tag:ug,fiberRef:s,value:a})(n);r.delete(s)}for(const[s]of r.entries())n=La({_tag:fg,fiberRef:s})(n);return n},La=y(2,(e,t)=>({_tag:dg,first:e,second:t})),aS=y(3,(e,t,r)=>{let n=r,s=Dt(e);for(;Et(s);){const i=Tt(s),a=ln(s);switch(i._tag){case lg:{s=a;break}case ug:{n=vo(n,{fiberId:t,fiberRef:i.fiberRef,value:i.value}),s=a;break}case fg:{n=og(n,i.fiberRef),s=a;break}case hg:{const o=hs(n,i.fiberRef);n=vo(n,{fiberId:t,fiberRef:i.fiberRef,value:i.fiberRef.patch(i.patch)(o)}),s=a;break}case dg:{s=_i(i.first)(_i(i.second)(a));break}}}return n}),gg="effect/MetricLabel",yo=Symbol.for(gg);var Gu;class oS{constructor(t,r){h(this,"key");h(this,"value");h(this,Gu,yo);h(this,"_hash");this.key=t,this.value=r,this._hash=He(gg+this.key+this.value)}[(Gu=yo,oe)](){return this._hash}[ae](t){return lS(t)&&this.key===t.key&&this.value===t.value}pipe(){return se(this,arguments)}}const cS=(e,t)=>new oS(e,t),lS=e=>le(e,yo),uS=e=>{let t,r;typeof e=="function"?t=e:(t=e.try,r=e.catch);const n=s=>r?xc(()=>r(s)):gt(new Hd(s,"An unknown error occurred in Effect.tryPromise"));return t.length>=1?Ur((s,i)=>{try{t(i).then(a=>s(Oe(a)),a=>s(n(a)))}catch(a){s(n(a))}}):Ur(s=>{try{t().then(i=>s(Oe(i)),i=>s(n(i)))}catch(i){s(n(i))}})},fS="Sequential",hS="Parallel",dS="ParallelN",gS={_tag:fS},pS={_tag:hS},mS=e=>({_tag:dS,parallelism:e}),ko=gS,xo=pS,So=mS,_S=iS,bS=aS,fa="effect/FiberStatus",zr=Symbol.for(fa),Ci="Done",uu="Running",fu="Suspended",vS=He(`${fa}-${Ci}`);var Wu;class yS{constructor(){h(this,Wu,zr);h(this,"_tag",Ci)}[(Wu=zr,oe)](){return vS}[ae](t){return Fc(t)&&t._tag===Ci}}var Yu;class kS{constructor(t){h(this,"runtimeFlags");h(this,Yu,zr);h(this,"_tag",uu);this.runtimeFlags=t}[(Yu=zr,oe)](){return T(q(fa),ge(q(this._tag)),ge(q(this.runtimeFlags)),qe(this))}[ae](t){return Fc(t)&&t._tag===uu&&this.runtimeFlags===t.runtimeFlags}}var Qu;class xS{constructor(t,r){h(this,"runtimeFlags");h(this,"blockingOn");h(this,Qu,zr);h(this,"_tag",fu);this.runtimeFlags=t,this.blockingOn=r}[(Qu=zr,oe)](){return T(q(fa),ge(q(this._tag)),ge(q(this.runtimeFlags)),ge(q(this.blockingOn)),qe(this))}[ae](t){return Fc(t)&&t._tag===fu&&this.runtimeFlags===t.runtimeFlags&&ce(this.blockingOn,t.blockingOn)}}const SS=new yS,wS=e=>new kS(e),IS=(e,t)=>new xS(e,t),Fc=e=>le(e,zr),TS=e=>e._tag===Ci,RS=SS,pg=wS,CS=IS,ES=TS,OS=Symbol.for("effect/Micro"),Ei=Symbol.for("effect/Micro/MicroExit"),hu=Symbol.for("effect/Micro/MicroCause"),MS={_E:je};var Zu;class mg extends globalThis.Error{constructor(r,n,s){const i=`MicroCause.${r}`;let a,o,c;if(n instanceof globalThis.Error){a=`(${i}) ${n.name}`,o=n.message;const l=o.split(`
|
|
19
|
+
`).length;c=n.stack?`(${i}) ${n.stack.split(`
|
|
20
|
+
`).slice(0,l+3).join(`
|
|
21
|
+
`)}`:`${a}: ${o}`}else a=i,o=an(n,0),c=`${a}: ${o}`;s.length>0&&(c+=`
|
|
22
|
+
${s.join(`
|
|
23
|
+
`)}`);super(o);h(this,"_tag");h(this,"traces");h(this,Zu);this._tag=r,this.traces=s,this[hu]=MS,this.name=a,this.stack=c}pipe(){return se(this,arguments)}toString(){return this.stack}[(Zu=hu,Je)](){return this.stack}}class AS extends mg{constructor(r,n=[]){super("Die",r,n);h(this,"defect");this.defect=r}}const NS=(e,t=[])=>new AS(e,t);class FS extends mg{constructor(t=[]){super("Interrupt","interrupted",t)}}const PS=(e=[])=>new FS(e),$S=e=>e._tag==="Interrupt",du=Symbol.for("effect/Micro/MicroFiber"),jS={_A:je,_E:je};var Xu;Xu=du;class LS{constructor(t,r=!0){h(this,"context");h(this,"interruptible");h(this,Xu);h(this,"_stack",[]);h(this,"_observers",[]);h(this,"_exit");h(this,"_children");h(this,"currentOpCount",0);h(this,"_interrupted",!1);h(this,"_yielded");this.context=t,this.interruptible=r,this[du]=jS}getRef(t){return ob(this.context,t)}addObserver(t){return this._exit?(t(this._exit),Em):(this._observers.push(t),()=>{const r=this._observers.indexOf(t);r>=0&&this._observers.splice(r,1)})}unsafeInterrupt(){this._exit||(this._interrupted=!0,this.interruptible&&this.evaluate(Dc))}unsafePoll(){return this._exit}evaluate(t){if(this._exit)return;if(this._yielded!==void 0){const s=this._yielded;this._yielded=void 0,s()}const r=this.runLoop(t);if(r===Hs)return;const n=gu.interruptChildren&&gu.interruptChildren(this);if(n!==void 0)return this.evaluate(Mi(n,()=>r));this._exit=r;for(let s=0;s<this._observers.length;s++)this._observers[s](r);this._observers.length=0}runLoop(t){let r=!1,n=t;this.currentOpCount=0;try{for(;;){if(this.currentOpCount++,!r&&this.getRef(Bc).shouldYield(this)){r=!0;const s=n;n=Mi(zS,()=>s)}if(n=n[wo](this),n===Hs){const s=this._yielded;return Ei in s?(this._yielded=void 0,s):Hs}}}catch(s){return le(n,wo)?Io(s):Io(`MicroFiber.runLoop: Not a valid effect: ${String(n)}`)}}getCont(t){for(;;){const r=this._stack.pop();if(!r)return;const n=r[Oi]&&r[Oi](this);if(n)return{[t]:n};if(r[t])return r}}yieldWith(t){return this._yielded=t,Hs}children(){return this._children??(this._children=new Set)}}const gu=ye("effect/Micro/fiberMiddleware",()=>({interruptChildren:void 0})),_g=Symbol.for("effect/Micro/identifier"),rt=Symbol.for("effect/Micro/args"),wo=Symbol.for("effect/Micro/evaluate"),Tn=Symbol.for("effect/Micro/successCont"),sn=Symbol.for("effect/Micro/failureCont"),Oi=Symbol.for("effect/Micro/ensureCont"),Hs=Symbol.for("effect/Micro/Yield"),DS={_A:je,_E:je,_R:je},BS={...tS,_op:"Micro",[OS]:DS,pipe(){return se(this,arguments)},[Symbol.iterator](){return new Yf(new ps(this))},toJSON(){return{_id:"Micro",op:this[_g],...rt in this?{args:this[rt]}:void 0}},toString(){return ut(this)},[Je](){return ut(this)}};function US(e){return Io("Micro.evaluate: Not implemented")}const ha=e=>({...BS,[_g]:e.op,[wo]:e.eval??US,[Tn]:e.contA,[sn]:e.contE,[Oi]:e.ensure}),Pc=e=>{const t=ha(e);return function(){const r=Object.create(t);return r[rt]=e.single===!1?arguments:arguments[0],r}},bg=e=>{const t={...ha(e),[Ei]:Ei,_tag:e.op,get[e.prop](){return this[rt]},toJSON(){return{_id:"MicroExit",_tag:e.op,[e.prop]:this[rt]}},[ae](r){return KS(r)&&r._tag===e.op&&ce(this[rt],r[rt])},[oe](){return qe(this,ge(He(e.op))(q(this[rt])))}};return function(r){const n=Object.create(t);return n[rt]=r,n[Tn]=void 0,n[sn]=void 0,n[Oi]=void 0,n}},$c=bg({op:"Success",prop:"value",eval(e){const t=e.getCont(Tn);return t?t[Tn](this[rt],e):e.yieldWith(this)}}),vg=bg({op:"Failure",prop:"cause",eval(e){let t=e.getCont(sn);for(;$S(this[rt])&&t&&e.interruptible;)t=e.getCont(sn);return t?t[sn](this[rt],e):e.yieldWith(this)}}),qS=Pc({op:"Yield",eval(e){let t=!1;return e.getRef(Bc).scheduleTask(()=>{t||e.evaluate(JS)},this[rt]??0),e.yieldWith(()=>{t=!0})}}),zS=qS(0),VS=$c(void 0),jc=Pc({op:"WithMicroFiber",eval(e){return this[rt](e)}}),Mi=y(2,(e,t)=>{const r=Object.create(HS);return r[rt]=e,r[Tn]=t,r}),HS=ha({op:"OnSuccess",eval(e){return e._stack.push(this),this[rt]}}),KS=e=>le(e,Ei),yg=$c,Lc=vg,Dc=Lc(PS()),Io=e=>Lc(NS(e)),JS=yg(void 0),GS="setImmediate"in globalThis?globalThis.setImmediate:e=>setTimeout(e,0);class kg{constructor(){h(this,"tasks",[]);h(this,"running",!1);h(this,"afterScheduled",()=>{this.running=!1,this.runTasks()})}scheduleTask(t,r){this.tasks.push(t),this.running||(this.running=!0,GS(this.afterScheduled))}runTasks(){const t=this.tasks;this.tasks=[];for(let r=0,n=t.length;r<n;r++)t[r]()}shouldYield(t){return t.currentOpCount>=t.getRef(QS)}flush(){for(;this.tasks.length>0;)this.runTasks()}}const WS=y(2,(e,t)=>jc(r=>{const n=r.context;return r.context=t(n),e1(e,()=>(r.context=n,VS))})),YS=y(2,(e,t)=>WS(e,Oh(t)));class QS extends Mh()("effect/Micro/currentMaxOpsBeforeYield",{defaultValue:()=>2048}){}class Bc extends Mh()("effect/Micro/currentScheduler",{defaultValue:()=>new kg}){}const ZS=y(2,(e,t)=>{const r=Object.create(XS);return r[rt]=e,r[Tn]=t.onSuccess,r[sn]=t.onFailure,r}),XS=ha({op:"OnSuccessAndFailure",eval(e){return e._stack.push(this),this[rt]}}),e1=y(2,(e,t)=>r1(r=>ZS(r(e),{onFailure:n=>Mi(t(Lc(n)),()=>vg(n)),onSuccess:n=>Mi(t(yg(n)),()=>$c(n))}))),xg=Pc({op:"SetInterruptible",ensure(e){if(e.interruptible=this[rt],e._interrupted&&e.interruptible)return()=>Dc}}),t1=e=>jc(t=>t.interruptible?e:(t.interruptible=!0,t._stack.push(xg(!1)),t._interrupted?Dc:e)),r1=e=>jc(t=>t.interruptible?(t.interruptible=!1,t._stack.push(xg(!0)),e(t1)):e(je)),n1=(e,t)=>{const r=new LS(Bc.context(new kg));return r.evaluate(e),r};class s1{constructor(){h(this,"buckets",[])}scheduleTask(t,r){const n=this.buckets.length;let s,i=0;for(;i<n&&this.buckets[i][0]<=r;i++)s=this.buckets[i];s&&s[0]===r?s[1].push(t):i===n?this.buckets.push([r,[t]]):this.buckets.splice(i,0,[r,[t]])}}class i1{constructor(t){h(this,"maxNextTickBeforeTimer");h(this,"running",!1);h(this,"tasks",new s1);this.maxNextTickBeforeTimer=t}starveInternal(t){const r=this.tasks.buckets;this.tasks.buckets=[];for(const[n,s]of r)for(let i=0;i<s.length;i++)s[i]();this.tasks.buckets.length===0?this.running=!1:this.starve(t)}starve(t=0){t>=this.maxNextTickBeforeTimer?setTimeout(()=>this.starveInternal(0),0):Promise.resolve(void 0).then(()=>this.starveInternal(t+1))}shouldYield(t){return t.currentOpCount>t.getFiberRef(gk)?t.getFiberRef(Oc):!1}scheduleTask(t,r){this.tasks.scheduleTask(t,r),this.running||(this.running=!0,this.starve())}}const a1=ye(Symbol.for("effect/Scheduler/defaultScheduler"),()=>new i1(2048)),o1=ye(Symbol.for("effect/FiberRef/currentScheduler"),()=>Rt(a1)),Sg=ye(Symbol.for("effect/FiberRef/currentRequestMap"),()=>Rt(new Map)),pu=(e,t,r,n)=>{switch(e){case void 0:return t();case"unbounded":return r();case"inherit":return Ec(vk,s=>s==="unbounded"?r():s>1?n(s):t());default:return e>1?n(e):t()}},Uc="InterruptSignal",qc="Stateful",zc="Resume",Vc="YieldNow",Da=e=>({_tag:Uc,cause:e}),ai=e=>({_tag:qc,onFiber:e}),Yr=e=>({_tag:zc,effect:e}),c1=()=>({_tag:Vc}),l1="effect/FiberScope",Ai=Symbol.for(l1);var ef;ef=Ai;class u1{constructor(){h(this,ef,Ai);h(this,"fiberId",_n);h(this,"roots",new Set)}add(t,r){this.roots.add(r),r.addObserver(()=>{this.roots.delete(r)})}}var tf;tf=Ai;class f1{constructor(t,r){h(this,"fiberId");h(this,"parent");h(this,tf,Ai);this.fiberId=t,this.parent=r}add(t,r){this.parent.tell(ai(n=>{n.addChild(r),r.addObserver(()=>{n.removeChild(r)})}))}}const h1=e=>new f1(e.id(),e),wg=ye(Symbol.for("effect/FiberScope/Global"),()=>new u1),d1="effect/Fiber",g1=Symbol.for(d1),p1={_E:e=>e,_A:e=>e},m1="effect/Fiber",_1=Symbol.for(m1),Ig=e=>Ld(Md(e.await),e.inheritAll);({...vs});const Ir="effect/FiberCurrent",b1="effect/Logger",v1=Symbol.for(b1),y1={_Message:e=>e,_Output:e=>e},Hc=e=>({[v1]:y1,log:e,pipe(){return se(this,arguments)}}),k1=/^[^\s"=]*$/,x1=(e,t)=>({annotations:r,cause:n,date:s,fiberId:i,logLevel:a,message:o,spans:c})=>{const l=_=>_.match(k1)?_:e(_),f=(_,k)=>`${cg(_)}=${l(k)}`,p=(_,k)=>" "+f(_,k);let d=f("timestamp",s.toISOString());d+=p("level",a.label),d+=p("fiber",rd(i));const g=R_(o);for(let _=0;_<g.length;_++)d+=p("message",an(g[_],t));p0(n)||(d+=p("cause",na(n,{renderErrorCause:!0})));for(const _ of c)d+=" "+eS(s.getTime())(_);for(const[_,k]of r)d+=p(_,an(k,t));return d},S1=e=>`"${e.replace(/\\([\s\S])|(")/g,"\\$1$2")}"`,w1=Hc(x1(S1)),I1=typeof process=="object"&&process!==null&&typeof process.stdout=="object"&&process.stdout!==null;I1&&process.stdout.isTTY;const Tg="effect/MetricBoundaries",To=Symbol.for(Tg);var rf;class T1{constructor(t){h(this,"values");h(this,rf,To);h(this,"_hash");this.values=t,this._hash=T(He(Tg),ge(ms(this.values)))}[(rf=To,oe)](){return this._hash}[ae](t){return R1(t)&&ce(this.values,t.values)}pipe(){return se(this,arguments)}}const R1=e=>le(e,To),C1=e=>{const t=T(e,_h(Ot(Number.POSITIVE_INFINITY)),K_);return new T1(t)},E1=e=>T(T_(e.count-1,t=>e.start*Math.pow(e.factor,t)),Ki,C1),O1="effect/MetricKeyType",Rg=Symbol.for(O1),Cg="effect/MetricKeyType/Counter",Ro=Symbol.for(Cg),M1="effect/MetricKeyType/Frequency",A1=Symbol.for(M1),N1="effect/MetricKeyType/Gauge",F1=Symbol.for(N1),Eg="effect/MetricKeyType/Histogram",Co=Symbol.for(Eg),P1="effect/MetricKeyType/Summary",$1=Symbol.for(P1),Og={_In:e=>e,_Out:e=>e};var nf,sf;class j1{constructor(t,r){h(this,"incremental");h(this,"bigint");h(this,sf,Og);h(this,nf,Ro);h(this,"_hash");this.incremental=t,this.bigint=r,this._hash=He(Cg)}[(sf=Rg,nf=Ro,oe)](){return this._hash}[ae](t){return Mg(t)}pipe(){return se(this,arguments)}}var af,of;class L1{constructor(t){h(this,"boundaries");h(this,of,Og);h(this,af,Co);h(this,"_hash");this.boundaries=t,this._hash=T(He(Eg),ge(q(this.boundaries)))}[(of=Rg,af=Co,oe)](){return this._hash}[ae](t){return Ag(t)&&ce(this.boundaries,t.boundaries)}pipe(){return se(this,arguments)}}const D1=e=>new j1((e==null?void 0:e.incremental)??!1,(e==null?void 0:e.bigint)??!1),B1=e=>new L1(e),Mg=e=>le(e,Ro),U1=e=>le(e,A1),q1=e=>le(e,F1),Ag=e=>le(e,Co),z1=e=>le(e,$1),V1="effect/MetricKey",Ng=Symbol.for(V1),H1={_Type:e=>e},K1=rc(ce);var cf;class Kc{constructor(t,r,n,s=[]){h(this,"name");h(this,"keyType");h(this,"description");h(this,"tags");h(this,cf,H1);h(this,"_hash");this.name=t,this.keyType=r,this.description=n,this.tags=s,this._hash=T(He(this.name+this.description),ge(q(this.keyType)),ge(ms(this.tags)))}[(cf=Ng,oe)](){return this._hash}[ae](t){return J1(t)&&this.name===t.name&&ce(this.keyType,t.keyType)&&ce(this.description,t.description)&&K1(this.tags,t.tags)}pipe(){return se(this,arguments)}}const J1=e=>le(e,Ng),G1=(e,t)=>new Kc(e,D1(t),ec(t==null?void 0:t.description)),W1=(e,t,r)=>new Kc(e,B1(t),ec(r)),Y1=y(2,(e,t)=>t.length===0?e:new Kc(e.name,e.keyType,e.description,ti(e.tags,t))),Q1="effect/MetricState",Es=Symbol.for(Q1),Fg="effect/MetricState/Counter",Eo=Symbol.for(Fg),Pg="effect/MetricState/Frequency",Oo=Symbol.for(Pg),$g="effect/MetricState/Gauge",Mo=Symbol.for($g),jg="effect/MetricState/Histogram",Ao=Symbol.for(jg),Lg="effect/MetricState/Summary",No=Symbol.for(Lg),Os={_A:e=>e};var lf,uf;class Z1{constructor(t){h(this,"count");h(this,uf,Os);h(this,lf,Eo);this.count=t}[(uf=Es,lf=Eo,oe)](){return T(q(Fg),ge(q(this.count)),qe(this))}[ae](t){return lw(t)&&this.count===t.count}pipe(){return se(this,arguments)}}const X1=rc(ce);var ff,hf;class ew{constructor(t){h(this,"occurrences");h(this,hf,Os);h(this,ff,Oo);h(this,"_hash");this.occurrences=t}[(hf=Es,ff=Oo,oe)](){return T(He(Pg),ge(ms(Qe(this.occurrences.entries()))),qe(this))}[ae](t){return uw(t)&&X1(Qe(this.occurrences.entries()),Qe(t.occurrences.entries()))}pipe(){return se(this,arguments)}}var df,gf;class tw{constructor(t){h(this,"value");h(this,gf,Os);h(this,df,Mo);this.value=t}[(gf=Es,df=Mo,oe)](){return T(q($g),ge(q(this.value)),qe(this))}[ae](t){return fw(t)&&this.value===t.value}pipe(){return se(this,arguments)}}var pf,mf;class rw{constructor(t,r,n,s,i){h(this,"buckets");h(this,"count");h(this,"min");h(this,"max");h(this,"sum");h(this,mf,Os);h(this,pf,Ao);this.buckets=t,this.count=r,this.min=n,this.max=s,this.sum=i}[(mf=Es,pf=Ao,oe)](){return T(q(jg),ge(q(this.buckets)),ge(q(this.count)),ge(q(this.min)),ge(q(this.max)),ge(q(this.sum)),qe(this))}[ae](t){return hw(t)&&ce(this.buckets,t.buckets)&&this.count===t.count&&this.min===t.min&&this.max===t.max&&this.sum===t.sum}pipe(){return se(this,arguments)}}var _f,bf;class nw{constructor(t,r,n,s,i,a){h(this,"error");h(this,"quantiles");h(this,"count");h(this,"min");h(this,"max");h(this,"sum");h(this,bf,Os);h(this,_f,No);this.error=t,this.quantiles=r,this.count=n,this.min=s,this.max=i,this.sum=a}[(bf=Es,_f=No,oe)](){return T(q(Lg),ge(q(this.error)),ge(q(this.quantiles)),ge(q(this.count)),ge(q(this.min)),ge(q(this.max)),ge(q(this.sum)),qe(this))}[ae](t){return dw(t)&&this.error===t.error&&ce(this.quantiles,t.quantiles)&&this.count===t.count&&this.min===t.min&&this.max===t.max&&this.sum===t.sum}pipe(){return se(this,arguments)}}const sw=e=>new Z1(e),iw=e=>new ew(e),aw=e=>new tw(e),ow=e=>new rw(e.buckets,e.count,e.min,e.max,e.sum),cw=e=>new nw(e.error,e.quantiles,e.count,e.min,e.max,e.sum),lw=e=>le(e,Eo),uw=e=>le(e,Oo),fw=e=>le(e,Mo),hw=e=>le(e,Ao),dw=e=>le(e,No),gw="effect/MetricHook",pw=Symbol.for(gw),mw={_In:e=>e,_Out:e=>e},Ms=e=>({[pw]:mw,pipe(){return se(this,arguments)},...e}),mu=BigInt(0),_w=e=>{let t=e.keyType.bigint?mu:0;const r=e.keyType.incremental?e.keyType.bigint?s=>s>=mu:s=>s>=0:s=>!0,n=s=>{r(s)&&(t=t+s)};return Ms({get:()=>sw(t),update:n,modify:n})},bw=e=>{const t=new Map;for(const n of e.keyType.preregisteredWords)t.set(n,0);const r=n=>{const s=t.get(n)??0;t.set(n,s+1)};return Ms({get:()=>iw(t),update:r,modify:r})},vw=(e,t)=>{let r=t;return Ms({get:()=>aw(r),update:n=>{r=n},modify:n=>{r=r+n}})},yw=e=>{const t=e.keyType.boundaries.values,r=t.length,n=new Uint32Array(r+1),s=new Float64Array(r);let i=0,a=0,o=Number.MAX_VALUE,c=Number.MIN_VALUE;T(t,bi(ns),tn((p,d)=>{s[d]=p}));const l=p=>{let d=0,g=r;for(;d!==g;){const _=Math.floor(d+(g-d)/2),k=s[_];p<=k?g=_:d=_,g===d+1&&(p<=s[d]?g=d:d=g)}n[d]=n[d]+1,i=i+1,a=a+p,p<o&&(o=p),p>c&&(c=p)},f=()=>{const p=tc(r);let d=0;for(let g=0;g<r;g++){const _=s[g],k=n[g];d=d+k,p[g]=[_,d]}return p};return Ms({get:()=>ow({buckets:f(),count:i,min:o,max:c,sum:a}),update:l,modify:l})},kw=e=>{const{error:t,maxAge:r,maxSize:n,quantiles:s}=e.keyType,i=T(s,bi(ns)),a=tc(n);let o=0,c=0,l=0,f=0,p=0;const d=_=>{const k=[];let b=0;for(;b!==n-1;){const w=a[b];if(w!=null){const[$,B]=w,O=ro(_-$);jb(O,Dh)&&$b(O,r)&&k.push(B)}b=b+1}return xw(t,i,bi(k,ns))},g=(_,k)=>{if(n>0){o=o+1;const b=o%n;a[b]=[k,_]}f=c===0?_:Math.min(f,_),p=c===0?_:Math.max(p,_),c=c+1,l=l+_};return Ms({get:()=>cw({error:t,quantiles:d(Date.now()),count:c,min:f,max:p,sum:l}),update:([_,k])=>g(_,k),modify:([_,k])=>g(_,k)})},xw=(e,t,r)=>{const n=r.length;if(!Et(t))return un();const s=t[0],i=t.slice(1),a=_u(e,n,ne(),0,s,r),o=Dt(a);return i.forEach(c=>{o.push(_u(e,n,a.value,a.consumed,c,a.rest))}),tn(o,c=>[c.quantile,c.value])},_u=(e,t,r,n,s,i)=>{let a=e,o=t,c=r,l=n,f=s,p=i,d=e,g=t,_=r,k=n,b=s,w=i;for(;;){if(!Et(p))return{quantile:f,value:ne(),consumed:l,rest:[]};if(f===1)return{quantile:f,value:he(yh(p)),consumed:l+p.length,rest:[]};const $=Tt(p),B=$_(p,m=>m===$),O=f*o,D=a/2*O,N=l+B[0].length,I=Math.abs(N-O);if(N<O-D){d=a,g=o,_=Qn(p),k=N,b=f,w=B[1],a=d,o=g,c=_,l=k,f=b,p=w;continue}if(N>O+D){const m=xt(c)?he($):c;return{quantile:f,value:m,consumed:l,rest:p}}switch(c._tag){case"None":{d=a,g=o,_=Qn(p),k=N,b=f,w=B[1],a=d,o=g,c=_,l=k,f=b,p=w;continue}case"Some":{const m=Math.abs(O-c.value);if(I<m){d=a,g=o,_=Qn(p),k=N,b=f,w=B[1],a=d,o=g,c=_,l=k,f=b,p=w;continue}return{quantile:f,value:he(c.value),consumed:l,rest:p}}}}throw new Error("BUG: MetricHook.resolveQuantiles - please report an issue at https://github.com/Effect-TS/effect/issues")},Sw="effect/MetricPair",ww=Symbol.for(Sw),Iw={_Type:e=>e},Tw=(e,t)=>({[ww]:Iw,metricKey:e,metricState:t,pipe(){return se(this,arguments)}}),Rw="effect/MetricRegistry",bu=Symbol.for(Rw);var vf;vf=bu;class Cw{constructor(){h(this,vf,bu);h(this,"map",Lk())}snapshot(){const t=[];for(const[r,n]of this.map)t.push(Tw(r,n.get()));return t}get(t){const r=T(this.map,Rr(t),Tr);if(r==null){if(Mg(t.keyType))return this.getCounter(t);if(q1(t.keyType))return this.getGauge(t);if(U1(t.keyType))return this.getFrequency(t);if(Ag(t.keyType))return this.getHistogram(t);if(z1(t.keyType))return this.getSummary(t);throw new Error("BUG: MetricRegistry.get - unknown MetricKeyType - please report an issue at https://github.com/Effect-TS/effect/issues")}else return r}getCounter(t){let r=T(this.map,Rr(t),Tr);if(r==null){const n=_w(t);T(this.map,Dn(t))||T(this.map,Bn(t,n)),r=n}return r}getFrequency(t){let r=T(this.map,Rr(t),Tr);if(r==null){const n=bw(t);T(this.map,Dn(t))||T(this.map,Bn(t,n)),r=n}return r}getGauge(t){let r=T(this.map,Rr(t),Tr);if(r==null){const n=vw(t,t.keyType.bigint?BigInt(0):0);T(this.map,Dn(t))||T(this.map,Bn(t,n)),r=n}return r}getHistogram(t){let r=T(this.map,Rr(t),Tr);if(r==null){const n=yw(t);T(this.map,Dn(t))||T(this.map,Bn(t,n)),r=n}return r}getSummary(t){let r=T(this.map,Rr(t),Tr);if(r==null){const n=kw(t);T(this.map,Dn(t))||T(this.map,Bn(t,n)),r=n}return r}}const Ew=()=>new Cw,Ow="effect/Metric",Mw=Symbol.for(Ow),Aw={_Type:e=>e,_In:e=>e,_Out:e=>e},vu=ye(Symbol.for("effect/Metric/globalMetricRegistry"),()=>Ew()),Dg=function(e,t,r,n){const s=Object.assign(i=>W0(i,a=>$w(s,a)),{[Mw]:Aw,keyType:e,unsafeUpdate:t,unsafeValue:r,unsafeModify:n,register(){return this.unsafeValue([]),this},pipe(){return se(this,arguments)}});return s},da=(e,t)=>Bg(G1(e,t)),Bg=e=>{let t;const r=new WeakMap,n=s=>{if(s.length===0)return t!==void 0||(t=vu.get(e)),t;let i=r.get(s);return i!==void 0||(i=vu.get(Y1(e,s)),r.set(s,i)),i};return Dg(e.keyType,(s,i)=>n(i).update(s),s=>n(s).get(),(s,i)=>n(i).modify(s))},Nw=(e,t,r)=>Bg(W1(e,t,r)),Fw=y(3,(e,t,r)=>Pw(e,[cS(t,r)])),Pw=y(2,(e,t)=>Dg(e.keyType,(r,n)=>e.unsafeUpdate(r,ti(t,n)),r=>e.unsafeValue(ti(t,r)),(r,n)=>e.unsafeModify(r,ti(t,n)))),$w=y(2,(e,t)=>Ec(_o,r=>X(()=>e.unsafeUpdate(t,r))));({...Xo});const jw=y(2,(e,t)=>Ec(Sg,r=>X(()=>{if(r.has(e)){const n=r.get(e);n.state.completed||(n.state.completed=!0,Gd(n.result,t))}}))),Lw="effect/Supervisor",ga=Symbol.for(Lw),Jc={_T:e=>e};var yf;yf=ga;const ol=class ol{constructor(t,r){h(this,"underlying");h(this,"value0");h(this,yf,Jc);this.underlying=t,this.value0=r}get value(){return this.value0}onStart(t,r,n,s){this.underlying.onStart(t,r,n,s)}onEnd(t,r){this.underlying.onEnd(t,r)}onEffect(t,r){this.underlying.onEffect(t,r)}onSuspend(t){this.underlying.onSuspend(t)}onResume(t){this.underlying.onResume(t)}map(t){return new ol(this,T(this.value,yt(t)))}zip(t){return new Fi(this,t)}};let Ni=ol;var kf;kf=ga;const cl=class cl{constructor(t,r){h(this,"left");h(this,"right");h(this,"_tag","Zip");h(this,kf,Jc);this.left=t,this.right=r}get value(){return jd(this.left.value,this.right.value)}onStart(t,r,n,s){this.left.onStart(t,r,n,s),this.right.onStart(t,r,n,s)}onEnd(t,r){this.left.onEnd(t,r),this.right.onEnd(t,r)}onEffect(t,r){this.left.onEffect(t,r),this.right.onEffect(t,r)}onSuspend(t){this.left.onSuspend(t),this.right.onSuspend(t)}onResume(t){this.left.onResume(t),this.right.onResume(t)}map(t){return new Ni(this,T(this.value,yt(t)))}zip(t){return new cl(this,t)}};let Fi=cl;const Ug=e=>le(e,ga)&&Gf(e,"Zip");var xf;xf=ga;class Dw{constructor(t){h(this,"effect");h(this,xf,Jc);this.effect=t}get value(){return this.effect}onStart(t,r,n,s){}onEnd(t,r){}onEffect(t,r){}onSuspend(t){}onResume(t){}map(t){return new Ni(this,T(this.value,yt(t)))}zip(t){return new Fi(this,t)}onRun(t,r){return t()}}const Bw=e=>new Dw(e),Gc=ye("effect/Supervisor/none",()=>Bw(Xt)),Uw=Cn,qg="Empty",zg="AddSupervisor",Vg="RemoveSupervisor",Hg="AndThen",Xn={_tag:qg},oi=(e,t)=>({_tag:Hg,first:e,second:t}),qw=(e,t)=>zw(t,Ot(e)),zw=(e,t)=>{let r=e,n=t;for(;dn(n);){const s=gn(n);switch(s._tag){case qg:{n=Er(n);break}case zg:{r=r.zip(s.supervisor),n=Er(n);break}case Vg:{r=Fo(r,s.supervisor),n=Er(n);break}case Hg:{n=Jt(s.first)(Jt(s.second)(Er(n)));break}}}return r},Fo=(e,t)=>ce(e,t)?Gc:Ug(e)?Fo(e.left,t).zip(Fo(e.right,t)):e,Pi=e=>ce(e,Gc)?Lr():Ug(e)?T(Pi(e.left),as(Pi(e.right))):dc(e),Vw=(e,t)=>{if(ce(e,t))return Xn;const r=Pi(e),n=Pi(t),s=T(n,Al(r),ki(Xn,(a,o)=>oi(a,{_tag:zg,supervisor:o}))),i=T(r,Al(n),ki(Xn,(a,o)=>oi(a,{_tag:Vg,supervisor:o})));return oi(s,i)},Hw=Uw({empty:Xn,patch:qw,combine:oi,diff:Vw}),Kw=da("effect_fiber_started",{incremental:!0}),yu=da("effect_fiber_active"),Jw=da("effect_fiber_successes",{incremental:!0}),Gw=da("effect_fiber_failures",{incremental:!0}),Ww=Fw(Nw("effect_fiber_lifetimes",E1({start:.5,factor:2,count:35})),"time_unit","milliseconds"),Un="Continue",Yw="Done",ku="Yield",Qw={_E:e=>e,_A:e=>e},Ks=e=>{throw new Error(`BUG: FiberRuntime - ${an(e)} - please report an issue at https://github.com/Effect-TS/effect/issues`)},rr=Symbol.for("effect/internal/fiberRuntime/YieldedOp"),nr=ye("effect/internal/fiberRuntime/yieldedOpChannel",()=>({currentOp:null})),qn={[gi]:(e,t,r)=>vt(()=>t.effect_instruction_i1(r)),OnStep:(e,t,r)=>lt(lt(r)),[pi]:(e,t,r)=>vt(()=>t.effect_instruction_i2(r)),[Qo]:(e,t,r)=>(e.patchRuntimeFlags(e.currentRuntimeFlags,t.patch),mr(e.currentRuntimeFlags)&&e.isInterrupted()?Ue(e.getInterruptedCause()):lt(r)),[mi]:(e,t,r)=>(vt(()=>t.effect_instruction_i2(r)),vt(()=>t.effect_instruction_i0())?(e.pushStack(t),vt(()=>t.effect_instruction_i1())):Xt),[Yn]:(e,t,r)=>{for(;;){const n=vt(()=>t.effect_instruction_i0.next(r));if(n.done)return lt(n.value);const s=Vm(n.value);if(ua(s)){if(s._tag==="Failure")return s}else return e.pushStack(t),s;r=s.value}}},Zw={[Uc]:(e,t,r,n)=>(e.processNewInterruptSignal(n.cause),mr(t)?Ue(n.cause):r),[zc]:(e,t,r,n)=>{throw new Error("It is illegal to have multiple concurrent run loops in a single fiber")},[qc]:(e,t,r,n)=>(n.onFiber(e,pg(t)),r),[Vc]:(e,t,r,n)=>ee(Tc(),()=>r)},Xw=e=>aa(Zy(e),t=>Pr(h0(t),([r,n])=>{const s=new Map,i=[];for(const o of n){i.push(Nr(o));for(const c of o)s.set(c.request,c)}const a=i.flat();return ca(_2(r.runAll(i),a,()=>a.forEach(o=>{o.listeners.interrupted=!0})),Sg,s)},!1,!1)),e2=Zo();var Sf,wf;class t2 extends nS{constructor(r,n,s){super();h(this,wf,p1);h(this,Sf,Qw);h(this,"_fiberRefs");h(this,"_fiberId");h(this,"_queue",new Array);h(this,"_children",null);h(this,"_observers",new Array);h(this,"_running",!1);h(this,"_stack",[]);h(this,"_asyncInterruptor",null);h(this,"_asyncBlockingOn",null);h(this,"_exitValue",null);h(this,"_steps",[]);h(this,"_isYielding",!1);h(this,"currentRuntimeFlags");h(this,"currentOpCount",0);h(this,"currentSupervisor");h(this,"currentScheduler");h(this,"currentTracer");h(this,"currentSpan");h(this,"currentContext");h(this,"currentDefaultServices");h(this,"run",()=>{this.drainQueueOnCurrentThread()});if(this.currentRuntimeFlags=s,this._fiberId=r,this._fiberRefs=n,jl(s)){const i=this.getFiberRef(_o);Kw.unsafeUpdate(1,i),yu.unsafeUpdate(1,i)}this.refreshRefCache()}commit(){return Ig(this)}id(){return this._fiberId}resume(r){this.tell(Yr(r))}get status(){return this.ask((r,n)=>n)}get runtimeFlags(){return this.ask((r,n)=>ES(n)?r.currentRuntimeFlags:n.runtimeFlags)}scope(){return h1(this)}get children(){return this.ask(r=>Array.from(r.getChildren()))}getChildren(){return this._children===null&&(this._children=new Set),this._children}getInterruptedCause(){return this.getFiberRef(Vs)}fiberRefs(){return this.ask(r=>r.getFiberRefs())}ask(r){return et(()=>{const n=Ok(this._fiberId);return this.tell(ai((s,i)=>{Gd(n,X(()=>r(s,i)))})),Jd(n)})}tell(r){this._queue.push(r),this._running||(this._running=!0,this.drainQueueLaterOnExecutor())}get await(){return Ur(r=>{const n=s=>r(Oe(s));return this.tell(ai((s,i)=>{s._exitValue!==null?n(this._exitValue):s.addObserver(n)})),X(()=>this.tell(ai((s,i)=>{s.removeObserver(n)})))},this.id())}get inheritAll(){return Mt((r,n)=>{const s=r.id(),i=r.getFiberRefs(),a=n.runtimeFlags,o=this.getFiberRefs(),c=jx(i,s,o);r.setFiberRefs(c);const l=r.getFiberRef(Tu),f=T(si(a,l),Dl(ws),Dl(go));return Q0(f)})}get poll(){return X(()=>ec(this._exitValue))}unsafePoll(){return this._exitValue}interruptAsFork(r){return X(()=>this.tell(Da(br(r))))}unsafeInterruptAsFork(r){this.tell(Da(br(r)))}addObserver(r){this._exitValue!==null?r(this._exitValue):this._observers.push(r)}removeObserver(r){this._observers=this._observers.filter(n=>n!==r)}getFiberRefs(){return this.setFiberRef(Tu,this.currentRuntimeFlags),this._fiberRefs}unsafeDeleteFiberRef(r){this._fiberRefs=og(this._fiberRefs,r)}getFiberRef(r){return this._fiberRefs.locals.has(r)?this._fiberRefs.locals.get(r)[0][1]:r.initial}setFiberRef(r,n){this._fiberRefs=vo(this._fiberRefs,{fiberId:this._fiberId,fiberRef:r,value:n}),this.refreshRefCache()}refreshRefCache(){this.currentDefaultServices=this.getFiberRef(Ri),this.currentTracer=this.currentDefaultServices.unsafeMap.get(ig.key),this.currentSupervisor=this.getFiberRef(m2),this.currentScheduler=this.getFiberRef(o1),this.currentContext=this.getFiberRef(la),this.currentSpan=this.currentContext.unsafeMap.get(ag.key)}setFiberRefs(r){this._fiberRefs=r,this.refreshRefCache()}addChild(r){this.getChildren().add(r)}removeChild(r){this.getChildren().delete(r)}transferChildren(r){const n=this._children;if(this._children=null,n!==null&&n.size>0)for(const s of n)s._exitValue===null&&r.add(this.currentRuntimeFlags,s)}drainQueueOnCurrentThread(){let r=!0;for(;r;){let n=Un;const s=globalThis[Ir];globalThis[Ir]=this;try{for(;n===Un;)n=this._queue.length===0?Yw:this.evaluateMessageWhileSuspended(this._queue.splice(0,1)[0])}finally{this._running=!1,globalThis[Ir]=s}this._queue.length>0&&!this._running?(this._running=!0,n===ku?(this.drainQueueLaterOnExecutor(),r=!1):r=!0):r=!1}}drainQueueLaterOnExecutor(){this.currentScheduler.scheduleTask(this.run,this.getFiberRef(Oc))}drainQueueWhileRunning(r,n){let s=n;for(;this._queue.length>0;){const i=this._queue.splice(0,1)[0];s=Zw[i._tag](this,r,s,i)}return s}isInterrupted(){return!m0(this.getFiberRef(Vs))}addInterruptedCause(r){const n=this.getFiberRef(Vs);this.setFiberRef(Vs,Pt(n,r))}processNewInterruptSignal(r){this.addInterruptedCause(r),this.sendInterruptSignalToAllChildren()}sendInterruptSignalToAllChildren(){if(this._children===null||this._children.size===0)return!1;let r=!1;for(const n of this._children)n.tell(Da(br(this.id()))),r=!0;return r}interruptAllChildren(){if(this.sendInterruptSignalToAllChildren()){const r=this._children.values();this._children=null;let n=!1;return Ic({while:()=>!n,body:()=>{const i=r.next();return i.done?X(()=>{n=!0}):ia(i.value.await)},step:()=>{}})}return null}reportExitValue(r){if(jl(this.currentRuntimeFlags)){const n=this.getFiberRef(_o),s=this.id().startTimeMillis,i=Date.now();switch(Ww.unsafeUpdate(i-s,n),yu.unsafeUpdate(-1,n),r._tag){case Kt:{Jw.unsafeUpdate(1,n);break}case Ht:{Gw.unsafeUpdate(1,n);break}}}if(r._tag==="Failure"){const n=this.getFiberRef(kk);!vc(r.cause)&&n._tag==="Some"&&this.log("Fiber terminated with an unhandled error",r.cause,n)}}setExitValue(r){this._exitValue=r,this.reportExitValue(r);for(let n=this._observers.length-1;n>=0;n--)this._observers[n](r);this._observers=[]}getLoggers(){return this.getFiberRef(a2)}log(r,n,s){const i=Zt(s)?s.value:this.getFiberRef(mk),a=this.getFiberRef(r2);if(Zx(a,i))return;const o=this.getFiberRef(_k),c=this.getFiberRef(pk),l=this.getLoggers(),f=this.getFiberRefs();if(Qh(l)>0){const p=Ch(this.getFiberRef(Ri),Nc),d=new Date(p.unsafeCurrentTimeMillis());Wm(f,()=>{for(const g of l)g.log({fiberId:this.id(),logLevel:i,message:r,cause:n,context:f,spans:o,annotations:c,date:d})})}}evaluateMessageWhileSuspended(r){switch(r._tag){case Vc:return ku;case Uc:return this.processNewInterruptSignal(r.cause),this._asyncInterruptor!==null&&(this._asyncInterruptor(Ue(r.cause)),this._asyncInterruptor=null),Un;case zc:return this._asyncInterruptor=null,this._asyncBlockingOn=null,this.evaluateEffect(r.effect),Un;case qc:return r.onFiber(this,this._exitValue!==null?RS:CS(this.currentRuntimeFlags,this._asyncBlockingOn)),Un;default:return Ks(r)}}evaluateEffect(r){this.currentSupervisor.onResume(this);try{let n=mr(this.currentRuntimeFlags)&&this.isInterrupted()?Ue(this.getInterruptedCause()):r;for(;n!==null;){const s=n,i=this.runLoop(s);if(i===rr){const a=nr.currentOp;nr.currentOp=null,a._op===ei?Ky(this.currentRuntimeFlags)?(this.tell(c1()),this.tell(Yr(Or)),n=null):n=Or:a._op===Wn&&(n=null)}else{this.currentRuntimeFlags=T(this.currentRuntimeFlags,Jy(go));const a=this.interruptAllChildren();a!==null?n=ee(a,()=>i):(this._queue.length===0?this.setExitValue(i):this.tell(Yr(i)),n=null)}}}finally{this.currentSupervisor.onSuspend(this)}}start(r){if(this._running)this.tell(Yr(r));else{this._running=!0;const n=globalThis[Ir];globalThis[Ir]=this;try{this.evaluateEffect(r)}finally{this._running=!1,globalThis[Ir]=n,this._queue.length>0&&this.drainQueueLaterOnExecutor()}}}startFork(r){this.tell(Yr(r))}patchRuntimeFlags(r,n){const s=ii(r,n);return globalThis[Ir]=this,this.currentRuntimeFlags=s,s}initiateAsync(r,n){let s=!1;const i=a=>{s||(s=!0,this.tell(Yr(a)))};mr(r)&&(this._asyncInterruptor=i);try{n(i)}catch(a){i(Gt(cr(a)))}}pushStack(r){this._stack.push(r),r._op==="OnStep"&&this._steps.push({refs:this.getFiberRefs(),flags:this.currentRuntimeFlags})}popStack(){const r=this._stack.pop();if(r)return r._op==="OnStep"&&this._steps.pop(),r}getNextSuccessCont(){let r=this.popStack();for(;r;){if(r._op!==Oa)return r;r=this.popStack()}}getNextFailCont(){let r=this.popStack();for(;r;){if(r._op!==gi&&r._op!==mi&&r._op!==Yn)return r;r=this.popStack()}}[(wf=g1,Sf=_1,Qm)](r){return X(()=>Eh(this.currentContext,r))}Left(r){return gt(r.left)}None(r){return gt(new Tk)}Right(r){return lt(r.right)}Some(r){return lt(r.value)}Micro(r){return Ii(n=>{let s=n;const i=n1(YS(r,this.currentContext));return i.addObserver(a=>{if(a._tag==="Success")return s(lt(a.value));switch(a.cause._tag){case"Interrupt":return s(Ue(br(_n)));case"Fail":return s(gt(a.cause.error));case"Die":return s(Hl(a.cause.defect))}}),Ii(a=>{s=o=>{a(Xt)},i.unsafeInterrupt()})})}[rh](r){const n=vt(()=>r.effect_instruction_i0()),s=this.getNextSuccessCont();return s!==void 0?(s._op in qn||Ks(s),qn[s._op](this,s,n)):(nr.currentOp=lt(n),rr)}[Kt](r){const n=r,s=this.getNextSuccessCont();return s!==void 0?(s._op in qn||Ks(s),qn[s._op](this,s,n.effect_instruction_i0)):(nr.currentOp=n,rr)}[Ht](r){const n=r.effect_instruction_i0,s=this.getNextFailCont();if(s!==void 0)switch(s._op){case Oa:case pi:return mr(this.currentRuntimeFlags)&&this.isInterrupted()?Ue(Bl(n)):vt(()=>s.effect_instruction_i1(n));case"OnStep":return mr(this.currentRuntimeFlags)&&this.isInterrupted()?Ue(Bl(n)):lt(Ue(n));case Qo:return this.patchRuntimeFlags(this.currentRuntimeFlags,s.patch),mr(this.currentRuntimeFlags)&&this.isInterrupted()?Ue(Pt(n,this.getInterruptedCause())):Ue(n);default:Ks(s)}else return nr.currentOp=Ue(n),rr}[nh](r){return vt(()=>r.effect_instruction_i0(this,pg(this.currentRuntimeFlags)))}Blocked(r){const n=this.getFiberRefs(),s=this.currentRuntimeFlags;if(this._steps.length>0){const i=[],a=this._steps[this._steps.length-1];let o=this.popStack();for(;o&&o._op!=="OnStep";)i.push(o),o=this.popStack();this.setFiberRefs(a.refs),this.currentRuntimeFlags=a.flags;const c=_S(a.refs,n),l=si(a.flags,s);return lt(Id(r.effect_instruction_i0,Mt(f=>{for(;i.length>0;)f.pushStack(i.pop());return f.setFiberRefs(bS(f.id(),f.getFiberRefs())(c)),f.currentRuntimeFlags=ii(l)(f.currentRuntimeFlags),r.effect_instruction_i1})))}return oa(i=>ee(Kg(D0(r.effect_instruction_i0)),()=>i(r.effect_instruction_i1)))}RunBlocked(r){return Xw(r.effect_instruction_i0)}[_s](r){const n=r.effect_instruction_i0,s=this.currentRuntimeFlags,i=ii(s,n);if(mr(i)&&this.isInterrupted())return Ue(this.getInterruptedCause());if(this.patchRuntimeFlags(this.currentRuntimeFlags,n),r.effect_instruction_i1){const a=si(i,s);return this.pushStack(new B0(a,r)),vt(()=>r.effect_instruction_i1(s))}else return Or}[gi](r){return this.pushStack(r),r.effect_instruction_i0}OnStep(r){return this.pushStack(r),r.effect_instruction_i0}[Oa](r){return this.pushStack(r),r.effect_instruction_i0}[pi](r){return this.pushStack(r),r.effect_instruction_i0}[Wn](r){return this._asyncBlockingOn=r.effect_instruction_i1,this.initiateAsync(this.currentRuntimeFlags,r.effect_instruction_i0),nr.currentOp=r,rr}[ei](r){return this._isYielding=!1,nr.currentOp=r,rr}[mi](r){const n=r.effect_instruction_i0,s=r.effect_instruction_i1;return n()?(this.pushStack(r),s()):Or}[Yn](r){return qn[Yn](this,r,void 0)}[Hi](r){return vt(()=>r.commit())}runLoop(r){let n=r;for(this.currentOpCount=0;;){if((this.currentRuntimeFlags&zy)!==0&&this.currentSupervisor.onEffect(this,n),this._queue.length>0&&(n=this.drainQueueWhileRunning(this.currentRuntimeFlags,n)),!this._isYielding){this.currentOpCount+=1;const s=this.currentScheduler.shouldYield(this);if(s!==!1){this._isYielding=!0,this.currentOpCount=0;const i=n;n=ee(Tc({priority:s}),()=>i)}}try{if(n=this.currentTracer.context(()=>{if(e2!==n[wn]._V){const s=this.getFiberRef(xk);if(s._tag==="Some"){const i=n[wn]._V;this.log(`Executing an Effect versioned ${i} with a Runtime of version ${Zo()}, 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`,kn,s)}}return this[n._op](n)},this),n===rr){const s=nr.currentOp;return s._op===ei||s._op===Wn?rr:(nr.currentOp=null,s._op===Kt||s._op===Ht?s:Ue(cr(s)))}}catch(s){n!==rr&&!le(n,"_op")||!(n._op in this)?n=z0(`Not a valid effect: ${an(n)}`):Ik(s)?n=Ue(Pt(cr(s),br(_n))):n=Hl(s)}}}}const r2=ye("effect/FiberRef/currentMinimumLogLevel",()=>Rt(Xx("Info"))),n2=e=>Hc(t=>{const r=qx(t.context,Ri);Ch(r,sg).unsafe.log(e.log(t))}),s2=ye(Symbol.for("effect/Logger/defaultLogger"),()=>n2(w1)),i2=ye(Symbol.for("effect/Logger/tracerLogger"),()=>Hc(({annotations:e,cause:t,context:r,fiberId:n,logLevel:s,message:i})=>{const a=ys(hs(r,la),ag);if(a._tag==="None"||a.value._tag==="ExternalSpan")return;const o=Eh(hs(r,Ri),Nc),c={};for(const[l,f]of e)c[l]=f;c["effect.fiberId"]=Ev(n),c["effect.logLevel"]=s.label,t!==null&&t._tag!=="Empty"&&(c["effect.cause"]=na(t,{renderErrorCause:!0})),a.value.event(an(Array.isArray(i)&&i.length===1?i[0]:i),o.unsafeCurrentTimeNanos(),c)})),a2=ye(Symbol.for("effect/FiberRef/currentLoggers"),()=>fk(dc(s2,i2))),o2=e=>{if(Array.isArray(e)||Wf(e))return[e,ne()];const t=Object.keys(e),r=t.length;return[t.map(n=>e[n]),he(n=>{const s={};for(let i=0;i<r;i++)s[t[i]]=n[i];return s})]},c2=(e,t,r)=>{const n=[];for(const s of e)n.push(us(s));return ee(ds(n,je,{concurrency:r==null?void 0:r.concurrency,batching:r==null?void 0:r.batching,concurrentFinalizers:r==null?void 0:r.concurrentFinalizers}),s=>{const i=ne(),a=s.length,o=new Array(a),c=new Array(a);let l=!1;for(let f=0;f<a;f++){const p=s[f];p._tag==="Left"?(o[f]=he(p.left),l=!0):(c[f]=p.right,o[f]=i)}return l?t._tag==="Some"?gt(t.value(o)):gt(o):r!=null&&r.discard?Xt:t._tag==="Some"?Oe(t.value(c)):Oe(c)})},l2=(e,t,r)=>{const n=[];for(const s of e)n.push(us(s));return r!=null&&r.discard?ds(n,je,{concurrency:r==null?void 0:r.concurrency,batching:r==null?void 0:r.batching,discard:!0,concurrentFinalizers:r==null?void 0:r.concurrentFinalizers}):yt(ds(n,je,{concurrency:r==null?void 0:r.concurrency,batching:r==null?void 0:r.batching,concurrentFinalizers:r==null?void 0:r.concurrentFinalizers}),s=>t._tag==="Some"?t.value(s):s)},u2=(e,t)=>{const[r,n]=o2(e);return(t==null?void 0:t.mode)==="validate"?c2(r,n,t):(t==null?void 0:t.mode)==="either"?l2(r,n,t):(t==null?void 0:t.discard)!==!0&&n._tag==="Some"?yt(ds(r,je,t),n.value):ds(r,je,t)},ds=y(e=>Wf(e[0]),(e,t,r)=>Mt(n=>{const s=(r==null?void 0:r.batching)===!0||(r==null?void 0:r.batching)==="inherit"&&n.getFiberRef(yk);return r!=null&&r.discard?pu(r.concurrency,()=>Qr(ko,r==null?void 0:r.concurrentFinalizers)(i=>s?Pr(e,(a,o)=>i(t(a,o)),!0,!1,1):aa(e,(a,o)=>i(t(a,o)))),()=>Qr(xo,r==null?void 0:r.concurrentFinalizers)(i=>Pr(e,(a,o)=>i(t(a,o)),s,!1)),i=>Qr(So(i),r==null?void 0:r.concurrentFinalizers)(a=>Pr(e,(o,c)=>a(t(o,c)),s,!1,i))):pu(r==null?void 0:r.concurrency,()=>Qr(ko,r==null?void 0:r.concurrentFinalizers)(i=>s?xu(e,1,(a,o)=>i(t(a,o)),!0):vr(e,(a,o)=>i(t(a,o)))),()=>Qr(xo,r==null?void 0:r.concurrentFinalizers)(i=>f2(e,(a,o)=>i(t(a,o)),s)),i=>Qr(So(i),r==null?void 0:r.concurrentFinalizers)(a=>xu(e,i,(o,c)=>a(t(o,c)),s)))})),f2=(e,t,r)=>et(()=>{const n=Qe(e),s=new Array(n.length);return Rc(Pr(n,(a,o)=>ee(t(a,o),c=>X(()=>s[o]=c)),r,!1),Oe(s))}),Pr=(e,t,r,n,s)=>oa(i=>Y0(a=>Mt(o=>{let c=Array.from(e).reverse(),l=c.length;if(l===0)return Xt;let f=0,p=!1;const d=s?Math.min(c.length,s):c.length,g=new Set,_=new Array,k=()=>g.forEach(m=>{m.currentScheduler.scheduleTask(()=>{m.unsafeInterruptAsFork(o.id())},0)}),b=new Array,w=new Array,$=new Array,B=()=>{const m=_.filter(({exit:C})=>C._tag==="Failure").sort((C,E)=>C.index<E.index?-1:C.index===E.index?0:1).map(({exit:C})=>C);return m.length===0&&m.push(Or),m},O=(m,C=!1)=>{const E=$d(a(m)),R=d2(E,o,o.currentRuntimeFlags,wg);return o.currentScheduler.scheduleTask(()=>{C&&R.unsafeInterruptAsFork(o.id()),R.resume(E)},0),R},D=()=>{n||(l-=c.length,c=[]),p=!0,k()},N=r?J0:Od,I=O(Ur(m=>{const C=(R,j)=>{R._op==="Blocked"?$.push(R):(_.push({index:j,exit:R}),R._op==="Failure"&&!p&&D())},E=()=>{if(c.length>0){const R=c.pop();let j=f++;const ie=()=>{const _e=c.pop();return j=f++,ee(Tc(),()=>ee(N(i(t(_e,j))),Y))},Y=_e=>c.length>0&&(C(_e,j),c.length>0)?ie():Oe(_e),ke=ee(N(i(t(R,j))),Y),ue=O(ke);b.push(ue),g.add(ue),p&&ue.currentScheduler.scheduleTask(()=>{ue.unsafeInterruptAsFork(o.id())},0),ue.addObserver(_e=>{let st;if(_e._op==="Failure"?st=_e:st=_e.effect_instruction_i0,w.push(ue),g.delete(ue),C(st,j),_.length===l)m(Oe($r(Yl(B(),{parallel:!0}),()=>Or)));else if($.length+_.length===l){const Me=B(),Ge=$.map(De=>De.effect_instruction_i0).reduce(md);m(Oe(Id(Ge,Pr([$r(Yl(Me,{parallel:!0}),()=>Or),...$.map(De=>De.effect_instruction_i1)],De=>De,r,!0,s))))}else E()})}};for(let R=0;R<d;R++)E()}));return ia(Fd(Md(i(Ig(I))),Kd({onFailure:m=>{D();const C=$.length+1,E=Math.min(typeof s=="number"?s:$.length,$.length),R=Array.from($);return Ur(j=>{let ie=0,Y=0;const ke=(_e,st)=>Me=>{ie++,ie===C&&j(lt(Ue(m))),R.length>0&&st&&ue()},ue=()=>{O(R.pop(),!0).addObserver(ke(Y,!0)),Y++};I.addObserver(ke(Y,!1)),Y++;for(let _e=0;_e<E;_e++)ue()})},onSuccess:()=>vr(w,m=>m.inheritAll)})))}))),xu=(e,t,r,n)=>et(()=>{const s=Qe(e),i=new Array(s.length);return Rc(Pr(s,(o,c)=>yt(r(o,c),l=>i[c]=l),n,!1,t),Oe(i))}),Kg=e=>g2(e,wg),h2=(e,t,r,n=null)=>{const s=Jg(e,t,r,n);return s.resume(e),s},d2=(e,t,r,n=null)=>Jg(e,t,r,n),Jg=(e,t,r,n=null)=>{const s=Ov(),i=t.getFiberRefs(),a=Lx(i,s),o=new t2(s,a,r),c=hs(a,la),l=o.currentSupervisor;return l.onStart(c,e,he(t),o),o.addObserver(p=>l.onEnd(p,o)),(n!==null?n:T(t.getFiberRef(bo),$r(()=>t.scope()))).add(r,o),o},g2=(e,t)=>Mt((r,n)=>Oe(h2(e,r,n.runtimeFlags,t))),Su=e=>Cs(t=>Hr(ys(t,As),{onNone:()=>e,onSome:r=>{switch(r.strategy._tag){case"Parallel":return e;case"Sequential":case"ParallelN":return ee(Mc(r,xo),n=>Wc(e,n))}}})),wu=e=>t=>Cs(r=>Hr(ys(r,As),{onNone:()=>t,onSome:n=>n.strategy._tag==="ParallelN"&&n.strategy.parallelism===e?t:ee(Mc(n,So(e)),s=>Wc(t,s))})),Qr=(e,t)=>r=>Cs(n=>Hr(ys(n,As),{onNone:()=>r(je),onSome:s=>{if(t===!0){const i=e._tag==="Parallel"?Su:e._tag==="Sequential"?Iu:wu(e.parallelism);switch(s.strategy._tag){case"Parallel":return i(r(Su));case"Sequential":return i(r(Iu));case"ParallelN":return i(r(wu(s.strategy.parallelism)))}}else return r(je)}})),Iu=e=>Cs(t=>Hr(ys(t,As),{onNone:()=>e,onSome:r=>{switch(r.strategy._tag){case"Sequential":return e;case"Parallel":case"ParallelN":return ee(Mc(r,ko),n=>Wc(e,n))}}})),As=Kr("effect/Scope"),Wc=y(2,(e,t)=>Pk(e,Oh(fb(As,t)))),p2=e=>An(e,{differ:Hw,fork:Xn}),Tu=dk(Wy),m2=p2(Gc),_2=(e,t,r)=>K0(n=>ee(ee(Kg(Ad(e)),s=>Ur(i=>{const a=t.map(l=>l.listeners.count),o=()=>{a.every(l=>l===0)&&t.every(l=>l.result.state.current._tag==="Pending"?!0:!!(l.result.state.current._tag==="Done"&&ua(l.result.state.current.effect)&&l.result.state.current.effect._tag==="Failure"&&_0(l.result.state.current.effect.cause)))&&(c.forEach(l=>l()),r==null||r(),i(ek(s)))};s.addObserver(l=>{c.forEach(f=>f()),i(l)});const c=t.map((l,f)=>{const p=d=>{a[f]=d,o()};return l.listeners.addObserver(p),()=>l.listeners.removeObserver(p)});return o(),X(()=>{c.forEach(l=>l())})})),()=>et(()=>{const s=t.flatMap(i=>i.state.completed?[]:[i]);return aa(s,i=>jw(i.request,Rk(n)))}))),b2=u2,Ru=X0,Ba=uS;var v2={debug:(e,...t)=>console.debug(`[DEBUG] ${e}`,...t),info:(e,...t)=>console.info(`[INFO] ${e}`,...t),warn:(e,...t)=>console.warn(`[WARN] ${e}`,...t),error:(e,...t)=>console.error(`[ERROR] ${e}`,...t)},Js=v2,y2=e=>({debug:(t,...r)=>Js.debug(`[${e}] ${t}`,...r),info:(t,...r)=>Js.info(`[${e}] ${t}`,...r),warn:(t,...r)=>Js.warn(`[${e}] ${t}`,...r),error:(t,...r)=>Js.error(`[${e}] ${t}`,...r)}),Gg=y2("paths"),Wg=()=>(void 0)((void 0)(),".claude","projects"),k2=e=>{const t=e.split(`
|
|
24
|
+
`).filter(r=>r.trim());for(const r of t)try{const n=JSON.parse(r);if(n!=null&&n.cwd)return n.cwd}catch{}return null},x2=e=>e.endsWith(".jsonl")&&!e.startsWith("agent-"),Cu=(e,t)=>{const r=e.replace(/\\/g,"/"),n=t.replace(/\\/g,"/");return r===n?"~":r.startsWith(n+"/")?"~"+r.slice(n.length):e},S2=e=>{const t=e.match(/^([A-Za-z])--/);if(t){const r=t[1],n=e.slice(3);return r+":\\"+n.replace(/--/g,"\\.").replace(/-/g,"\\")}return e.replace(/^-/,"/").replace(/--/g,"/.").replace(/-/g,"/")},Yg=e=>{const t=n=>[...n].map(s=>s.charCodeAt(0)<=127?s:"-").join(""),r=e.match(/^([A-Za-z]):[/\\]/);if(r){const n=r[1].toLowerCase(),s=e.slice(3);return n+"--"+t(s).replace(/[/\\]\./g,"--").replace(/[/\\]/g,"-").replace(/\./g,"-")}return t(e).replace(/^\//g,"-").replace(/\/\./g,"--").replace(/\//g,"-").replace(/\./g,"-")},w2=(e,t=Kf,r=Gg)=>{const n=(void 0)(e);try{const s=t.readFileSync(e,"utf-8"),i=k2(s);if(i===null){const a=s.split(`
|
|
25
|
+
`).filter(o=>o.trim());return a.length===0?r.debug(`tryGetCwdFromFile: ${n} -> empty file`):r.debug(`tryGetCwdFromFile: ${n} -> no cwd found in ${a.length} lines`),null}return i}catch(s){return r.warn(`tryGetCwdFromFile: ${n} -> read error: ${s}`),null}},I2=(e,t=Wg(),r=Kf,n=Gg)=>{const s=(void 0)(t,e);try{const i=r.readdirSync(s).filter(x2),a=[];for(const c of i){const l=w2((void 0)(s,c),r,n);l!==null&&a.push(l)}const o=a.find(c=>Yg(c)===e);return o||(a.length>0?n.warn(`getRealPathFromSession: ${e} -> no match, cwds found: ${a.join(", ")}`):n.warn(`getRealPathFromSession: ${e} -> no valid cwd in any session`),null)}catch{return null}},T2=e=>{const t=(void 0)(),r=I2(e);if(r)return Cu(r,t);const n=S2(e);return Cu(n,t)},R2=(e,t,r,n=60,s="Untitled")=>e||(t?t.length>n?t.slice(0,n-3)+"...":t:r&&r!=="Untitled"?r:s),C2=(e,t)=>{if(!t)return e;const r=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),n=new RegExp(`${r}(?=[/\\\\]|$)`,"g");return e.replace(n,"~")},E2=(e,t={})=>{const{currentProjectName:r,homeDir:n,filterEmpty:s=!0}=t,i=s?e.filter(o=>o.sessionCount>0):e,a=n?Yg(n):null;return i.sort((o,c)=>{if(r){if(o.name===r)return-1;if(c.name===r)return 1}if(a){const l=o.name.startsWith(a),f=c.name.startsWith(a);if(l&&!f)return-1;if(!l&&f)return 1}return o.displayName.localeCompare(c.displayName)})};Ru(function*(){const e=Wg();if(!(yield*Ba(()=>(void 0)(e).then(()=>!0).catch(()=>!1))))return[];const r=yield*Ba(()=>(void 0)(e,{withFileTypes:!0}));return yield*b2(r.filter(s=>s.isDirectory()&&!s.name.startsWith(".")).map(s=>Ru(function*(){const i=(void 0)(e,s.name),o=(yield*Ba(()=>(void 0)(i))).filter(c=>c.endsWith(".jsonl")&&!c.startsWith("agent-"));return{name:s.name,displayName:T2(s.name),path:i,sessionCount:o.length}})),{concurrency:10})});const Yc=em({version:"",homeDir:"",currentProjectName:""}),Qc=(e,t)=>{const r=t??tm(Yc).homeDir;return r?C2(e,r):e.replace(/(?:\/Users\/[^/\s]+|C:\\Users\\[^\\\s]+)(?=[/\\]|(?=\s|$|[)"'\]}>,:;]))/g,"~")};Xp(Yc,e=>t=>Qc(t,e.homeDir));var O2=M('<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 bR(e,t){fr(t,!0);let r=Ke(t,"confirmText",3,"Confirm"),n=Ke(t,"cancelText",3,"Cancel"),s=Ke(t,"variant",3,"default");const i=l=>{l.key==="Escape"&&t.onCancel(),l.key==="Enter"&&t.onConfirm()};var a=fe(),o=re(a);{var c=l=>{var f=O2();f.__click=D=>D.target===D.currentTarget&&t.onCancel(),f.__keydown=i;var p=x(f),d=x(p),g=x(d,!0);v(d);var _=A(d,2),k=x(_,!0);v(_);var b=A(_,2),w=x(b);w.__click=function(...D){var N;(N=t.onCancel)==null||N.apply(this,D)};var $=x(w,!0);v(w);var B=A(w,2);B.__click=function(...D){var N;(N=t.onConfirm)==null||N.apply(this,D)};var O=x(B,!0);v(B),v(b),v(p),v(f),U(()=>{P(g,t.title),P(k,t.message),P($,n()),$e(B,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"}`),P(O,r())}),S(l,f)};L(o,l=>{t.show&&l(c)})}S(e,a),hr()}Wt(["click","keydown"]);var M2=M('<label class="block text-sm text-gh-text-secondary mb-2"> </label>'),A2=M('<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 vR(e,t){fr(t,!0);let r=Ke(t,"label",3,""),n=Ke(t,"placeholder",3,""),s=Ke(t,"initialValue",3,""),i=Ke(t,"confirmText",3,"Save"),a=Ke(t,"cancelText",3,"Cancel"),o=tt(fi(s())),c=tt(void 0);en(()=>{t.show&&(H(o,s()),Pf().then(()=>{var _,k;(_=u(c))==null||_.focus(),(k=u(c))==null||k.select()}))});const l=()=>{t.onConfirm(u(o).trim())},f=_=>{_.key==="Escape"&&t.onCancel(),_.key==="Enter"&&l()};var p=fe(),d=re(p);{var g=_=>{var k=A2();k.__click=R=>R.target===R.currentTarget&&t.onCancel(),k.__keydown=f;var b=x(k),w=x(b),$=x(w,!0);v(w);var B=A(w,2);{var O=R=>{var j=M2(),ie=x(j,!0);v(j),U(()=>P(ie,r())),S(R,j)};L(B,R=>{r()&&R(O)})}var D=A(B,2);zf(D),qo(D,R=>H(c,R),()=>u(c));var N=A(D,2),I=x(N);I.__click=function(...R){var j;(j=t.onCancel)==null||j.apply(this,R)};var m=x(I,!0);v(I);var C=A(I,2);C.__click=l;var E=x(C,!0);v(C),v(N),v(b),v(k),U(()=>{P($,t.title),Pe(D,"placeholder",n()),P(m,a()),P(E,i())}),km(D,()=>u(o),R=>H(o,R)),S(_,k)};L(d,_=>{t.show&&_(g)})}S(e,p),hr()}Wt(["click","keydown"]);function Zc(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var Jr=Zc();function Qg(e){Jr=e}var es={exec:()=>null};function ve(e,t=""){let r=typeof e=="string"?e:e.source,n={replace:(s,i)=>{let a=typeof i=="string"?i:i.source;return a=a.replace(kt.caret,"$1"),r=r.replace(s,a),n},getRegex:()=>new RegExp(r,t)};return n}var N2=(()=>{try{return!!new RegExp("(?<=1)(?<!1)")}catch{return!1}})(),kt={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:e=>new RegExp(`^( {0,3}${e})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),hrRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}#`),htmlBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}<(?:[a-z].*>|!--)`,"i")},F2=/^(?:[ \t]*(?:\n|$))+/,P2=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,$2=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,Ns=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,j2=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,Xc=/(?:[*+-]|\d{1,9}[.)])/,Zg=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,Xg=ve(Zg).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(),L2=ve(Zg).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]+)*)/,D2=/^[^\n]+/,tl=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,B2=ve(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",tl).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),U2=ve(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,Xc).getRegex(),pa="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",rl=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,q2=ve("^ {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",rl).replace("tag",pa).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),ep=ve(el).replace("hr",Ns).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",pa).getRegex(),z2=ve(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",ep).getRegex(),nl={blockquote:z2,code:P2,def:B2,fences:$2,heading:j2,hr:Ns,html:q2,lheading:Xg,list:U2,newline:F2,paragraph:ep,table:es,text:D2},Eu=ve("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",Ns).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",pa).getRegex(),V2={...nl,lheading:L2,table:Eu,paragraph:ve(el).replace("hr",Ns).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",Eu).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",pa).getRegex()},H2={...nl,html:ve(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",rl).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:es,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:ve(el).replace("hr",Ns).replace("heading",` *#{1,6} *[^
|
|
26
|
+
]`).replace("lheading",Xg).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},K2=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,J2=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,tp=/^( {2,}|\\)\n(?!\s*$)/,G2=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,ma=/[\p{P}\p{S}]/u,sl=/[\s\p{P}\p{S}]/u,rp=/[^\s\p{P}\p{S}]/u,W2=ve(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,sl).getRegex(),np=/(?!~)[\p{P}\p{S}]/u,Y2=/(?!~)[\s\p{P}\p{S}]/u,Q2=/(?:[^\s\p{P}\p{S}]|~)/u,Z2=ve(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",N2?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),sp=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,X2=ve(sp,"u").replace(/punct/g,ma).getRegex(),eI=ve(sp,"u").replace(/punct/g,np).getRegex(),ip="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",tI=ve(ip,"gu").replace(/notPunctSpace/g,rp).replace(/punctSpace/g,sl).replace(/punct/g,ma).getRegex(),rI=ve(ip,"gu").replace(/notPunctSpace/g,Q2).replace(/punctSpace/g,Y2).replace(/punct/g,np).getRegex(),nI=ve("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,rp).replace(/punctSpace/g,sl).replace(/punct/g,ma).getRegex(),sI=ve(/\\(punct)/,"gu").replace(/punct/g,ma).getRegex(),iI=ve(/^<(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(),aI=ve(rl).replace("(?:-->|$)","-->").getRegex(),oI=ve("^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",aI).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),$i=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+[^`]*?`+(?!`)|[^\[\]\\`])*?/,cI=ve(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label",$i).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),ap=ve(/^!?\[(label)\]\[(ref)\]/).replace("label",$i).replace("ref",tl).getRegex(),op=ve(/^!?\[(ref)\](?:\[\])?/).replace("ref",tl).getRegex(),lI=ve("reflink|nolink(?!\\()","g").replace("reflink",ap).replace("nolink",op).getRegex(),Ou=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,il={_backpedal:es,anyPunctuation:sI,autolink:iI,blockSkip:Z2,br:tp,code:J2,del:es,emStrongLDelim:X2,emStrongRDelimAst:tI,emStrongRDelimUnd:nI,escape:K2,link:cI,nolink:op,punctuation:W2,reflink:ap,reflinkSearch:lI,tag:oI,text:G2,url:es},uI={...il,link:ve(/^!?\[(label)\]\((.*?)\)/).replace("label",$i).getRegex(),reflink:ve(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",$i).getRegex()},Po={...il,emStrongRDelimAst:rI,emStrongLDelim:eI,url:ve(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",Ou).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:ve(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol",Ou).getRegex()},fI={...Po,br:ve(tp).replace("{2,}","*").getRegex(),text:ve(Po.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},Gs={normal:nl,gfm:V2,pedantic:H2},zn={normal:il,gfm:Po,breaks:fI,pedantic:uI},hI={"&":"&","<":"<",">":">",'"':""","'":"'"},Mu=e=>hI[e];function sr(e,t){if(t){if(kt.escapeTest.test(e))return e.replace(kt.escapeReplace,Mu)}else if(kt.escapeTestNoEncode.test(e))return e.replace(kt.escapeReplaceNoEncode,Mu);return e}function Au(e){try{e=encodeURI(e).replace(kt.percentDecode,"%")}catch{return null}return e}function Nu(e,t){var i;let r=e.replace(kt.findPipe,(a,o,c)=>{let l=!1,f=o;for(;--f>=0&&c[f]==="\\";)l=!l;return l?"|":" |"}),n=r.split(kt.splitPipe),s=0;if(n[0].trim()||n.shift(),n.length>0&&!((i=n.at(-1))!=null&&i.trim())&&n.pop(),t)if(n.length>t)n.splice(t);else for(;n.length<t;)n.push("");for(;s<n.length;s++)n[s]=n[s].trim().replace(kt.slashPipe,"|");return n}function Vn(e,t,r){let n=e.length;if(n===0)return"";let s=0;for(;s<n&&e.charAt(n-s-1)===t;)s++;return e.slice(0,n-s)}function dI(e,t){if(e.indexOf(t[1])===-1)return-1;let r=0;for(let n=0;n<e.length;n++)if(e[n]==="\\")n++;else if(e[n]===t[0])r++;else if(e[n]===t[1]&&(r--,r<0))return n;return r>0?-2:-1}function Fu(e,t,r,n,s){let i=t.href,a=t.title||null,o=e[1].replace(s.other.outputLinkReplace,"$1");n.state.inLink=!0;let c={type:e[0].charAt(0)==="!"?"image":"link",raw:r,href:i,title:a,text:o,tokens:n.inlineTokens(o)};return n.state.inLink=!1,c}function gI(e,t,r){let n=e.match(r.other.indentCodeCompensation);if(n===null)return t;let s=n[1];return t.split(`
|
|
27
|
+
`).map(i=>{let a=i.match(r.other.beginningSpace);if(a===null)return i;let[o]=a;return o.length>=s.length?i.slice(s.length):i}).join(`
|
|
28
|
+
`)}var ji=class{constructor(e){h(this,"options");h(this,"rules");h(this,"lexer");this.options=e||Jr}space(e){let t=this.rules.block.newline.exec(e);if(t&&t[0].length>0)return{type:"space",raw:t[0]}}code(e){let t=this.rules.block.code.exec(e);if(t){let r=t[0].replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:t[0],codeBlockStyle:"indented",text:this.options.pedantic?r:Vn(r,`
|
|
29
|
+
`)}}}fences(e){let t=this.rules.block.fences.exec(e);if(t){let r=t[0],n=gI(r,t[3]||"",this.rules);return{type:"code",raw:r,lang:t[2]?t[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):t[2],text:n}}}heading(e){let t=this.rules.block.heading.exec(e);if(t){let r=t[2].trim();if(this.rules.other.endingHash.test(r)){let n=Vn(r,"#");(this.options.pedantic||!n||this.rules.other.endingSpaceChar.test(n))&&(r=n.trim())}return{type:"heading",raw:t[0],depth:t[1].length,text:r,tokens:this.lexer.inline(r)}}}hr(e){let t=this.rules.block.hr.exec(e);if(t)return{type:"hr",raw:Vn(t[0],`
|
|
30
|
+
`)}}blockquote(e){let t=this.rules.block.blockquote.exec(e);if(t){let r=Vn(t[0],`
|
|
31
|
+
`).split(`
|
|
32
|
+
`),n="",s="",i=[];for(;r.length>0;){let a=!1,o=[],c;for(c=0;c<r.length;c++)if(this.rules.other.blockquoteStart.test(r[c]))o.push(r[c]),a=!0;else if(!a)o.push(r[c]);else break;r=r.slice(c);let l=o.join(`
|
|
33
|
+
`),f=l.replace(this.rules.other.blockquoteSetextReplace,`
|
|
34
|
+
$1`).replace(this.rules.other.blockquoteSetextReplace2,"");n=n?`${n}
|
|
35
|
+
${l}`:l,s=s?`${s}
|
|
36
|
+
${f}`:f;let p=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(f,i,!0),this.lexer.state.top=p,r.length===0)break;let d=i.at(-1);if((d==null?void 0:d.type)==="code")break;if((d==null?void 0:d.type)==="blockquote"){let g=d,_=g.raw+`
|
|
37
|
+
`+r.join(`
|
|
38
|
+
`),k=this.blockquote(_);i[i.length-1]=k,n=n.substring(0,n.length-g.raw.length)+k.raw,s=s.substring(0,s.length-g.text.length)+k.text;break}else if((d==null?void 0:d.type)==="list"){let g=d,_=g.raw+`
|
|
39
|
+
`+r.join(`
|
|
40
|
+
`),k=this.list(_);i[i.length-1]=k,n=n.substring(0,n.length-d.raw.length)+k.raw,s=s.substring(0,s.length-g.raw.length)+k.raw,r=_.substring(i.at(-1).raw.length).split(`
|
|
41
|
+
`);continue}}return{type:"blockquote",raw:n,tokens:i,text:s}}}list(e){var r,n;let t=this.rules.block.list.exec(e);if(t){let s=t[1].trim(),i=s.length>1,a={type:"list",raw:"",ordered:i,start:i?+s.slice(0,-1):"",loose:!1,items:[]};s=i?`\\d{1,9}\\${s.slice(-1)}`:`\\${s}`,this.options.pedantic&&(s=i?s:"[*+-]");let o=this.rules.other.listItemRegex(s),c=!1;for(;e;){let f=!1,p="",d="";if(!(t=o.exec(e))||this.rules.block.hr.test(e))break;p=t[0],e=e.substring(p.length);let g=t[2].split(`
|
|
42
|
+
`,1)[0].replace(this.rules.other.listReplaceTabs,w=>" ".repeat(3*w.length)),_=e.split(`
|
|
43
|
+
`,1)[0],k=!g.trim(),b=0;if(this.options.pedantic?(b=2,d=g.trimStart()):k?b=t[1].length+1:(b=t[2].search(this.rules.other.nonSpaceChar),b=b>4?1:b,d=g.slice(b),b+=t[1].length),k&&this.rules.other.blankLine.test(_)&&(p+=_+`
|
|
44
|
+
`,e=e.substring(_.length+1),f=!0),!f){let w=this.rules.other.nextBulletRegex(b),$=this.rules.other.hrRegex(b),B=this.rules.other.fencesBeginRegex(b),O=this.rules.other.headingBeginRegex(b),D=this.rules.other.htmlBeginRegex(b);for(;e;){let N=e.split(`
|
|
45
|
+
`,1)[0],I;if(_=N,this.options.pedantic?(_=_.replace(this.rules.other.listReplaceNesting," "),I=_):I=_.replace(this.rules.other.tabCharGlobal," "),B.test(_)||O.test(_)||D.test(_)||w.test(_)||$.test(_))break;if(I.search(this.rules.other.nonSpaceChar)>=b||!_.trim())d+=`
|
|
46
|
+
`+I.slice(b);else{if(k||g.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||B.test(g)||O.test(g)||$.test(g))break;d+=`
|
|
47
|
+
`+_}!k&&!_.trim()&&(k=!0),p+=N+`
|
|
48
|
+
`,e=e.substring(N.length+1),g=I.slice(b)}}a.loose||(c?a.loose=!0:this.rules.other.doubleBlankLine.test(p)&&(c=!0)),a.items.push({type:"list_item",raw:p,task:!!this.options.gfm&&this.rules.other.listIsTask.test(d),loose:!1,text:d,tokens:[]}),a.raw+=p}let l=a.items.at(-1);if(l)l.raw=l.raw.trimEnd(),l.text=l.text.trimEnd();else return;a.raw=a.raw.trimEnd();for(let f of a.items){if(this.lexer.state.top=!1,f.tokens=this.lexer.blockTokens(f.text,[]),f.task){if(f.text=f.text.replace(this.rules.other.listReplaceTask,""),((r=f.tokens[0])==null?void 0:r.type)==="text"||((n=f.tokens[0])==null?void 0:n.type)==="paragraph"){f.tokens[0].raw=f.tokens[0].raw.replace(this.rules.other.listReplaceTask,""),f.tokens[0].text=f.tokens[0].text.replace(this.rules.other.listReplaceTask,"");for(let d=this.lexer.inlineQueue.length-1;d>=0;d--)if(this.rules.other.listIsTask.test(this.lexer.inlineQueue[d].src)){this.lexer.inlineQueue[d].src=this.lexer.inlineQueue[d].src.replace(this.rules.other.listReplaceTask,"");break}}let p=this.rules.other.listTaskCheckbox.exec(f.raw);if(p){let d={type:"checkbox",raw:p[0]+" ",checked:p[0]!=="[ ]"};f.checked=d.checked,a.loose?f.tokens[0]&&["paragraph","text"].includes(f.tokens[0].type)&&"tokens"in f.tokens[0]&&f.tokens[0].tokens?(f.tokens[0].raw=d.raw+f.tokens[0].raw,f.tokens[0].text=d.raw+f.tokens[0].text,f.tokens[0].tokens.unshift(d)):f.tokens.unshift({type:"paragraph",raw:d.raw,text:d.raw,tokens:[d]}):f.tokens.unshift(d)}}if(!a.loose){let p=f.tokens.filter(g=>g.type==="space"),d=p.length>0&&p.some(g=>this.rules.other.anyLine.test(g.raw));a.loose=d}}if(a.loose)for(let f of a.items){f.loose=!0;for(let p of f.tokens)p.type==="text"&&(p.type="paragraph")}return a}}html(e){let t=this.rules.block.html.exec(e);if(t)return{type:"html",block:!0,raw:t[0],pre:t[1]==="pre"||t[1]==="script"||t[1]==="style",text:t[0]}}def(e){let t=this.rules.block.def.exec(e);if(t){let r=t[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal," "),n=t[2]?t[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",s=t[3]?t[3].substring(1,t[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):t[3];return{type:"def",tag:r,raw:t[0],href:n,title:s}}}table(e){var a;let t=this.rules.block.table.exec(e);if(!t||!this.rules.other.tableDelimiter.test(t[2]))return;let r=Nu(t[1]),n=t[2].replace(this.rules.other.tableAlignChars,"").split("|"),s=(a=t[3])!=null&&a.trim()?t[3].replace(this.rules.other.tableRowBlankLine,"").split(`
|
|
49
|
+
`):[],i={type:"table",raw:t[0],header:[],align:[],rows:[]};if(r.length===n.length){for(let o of n)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<r.length;o++)i.header.push({text:r[o],tokens:this.lexer.inline(r[o]),header:!0,align:i.align[o]});for(let o of s)i.rows.push(Nu(o,i.header.length).map((c,l)=>({text:c,tokens:this.lexer.inline(c),header:!1,align:i.align[l]})));return i}}lheading(e){let t=this.rules.block.lheading.exec(e);if(t)return{type:"heading",raw:t[0],depth:t[2].charAt(0)==="="?1:2,text:t[1],tokens:this.lexer.inline(t[1])}}paragraph(e){let t=this.rules.block.paragraph.exec(e);if(t){let r=t[1].charAt(t[1].length-1)===`
|
|
50
|
+
`?t[1].slice(0,-1):t[1];return{type:"paragraph",raw:t[0],text:r,tokens:this.lexer.inline(r)}}}text(e){let t=this.rules.block.text.exec(e);if(t)return{type:"text",raw:t[0],text:t[0],tokens:this.lexer.inline(t[0])}}escape(e){let t=this.rules.inline.escape.exec(e);if(t)return{type:"escape",raw:t[0],text:t[1]}}tag(e){let t=this.rules.inline.tag.exec(e);if(t)return!this.lexer.state.inLink&&this.rules.other.startATag.test(t[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(t[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(t[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(t[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:t[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:t[0]}}link(e){let t=this.rules.inline.link.exec(e);if(t){let r=t[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(r)){if(!this.rules.other.endAngleBracket.test(r))return;let i=Vn(r.slice(0,-1),"\\");if((r.length-i.length)%2===0)return}else{let i=dI(t[2],"()");if(i===-2)return;if(i>-1){let a=(t[0].indexOf("!")===0?5:4)+t[1].length+i;t[2]=t[2].substring(0,i),t[0]=t[0].substring(0,a).trim(),t[3]=""}}let n=t[2],s="";if(this.options.pedantic){let i=this.rules.other.pedanticHrefTitle.exec(n);i&&(n=i[1],s=i[3])}else s=t[3]?t[3].slice(1,-1):"";return n=n.trim(),this.rules.other.startAngleBracket.test(n)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(r)?n=n.slice(1):n=n.slice(1,-1)),Fu(t,{href:n&&n.replace(this.rules.inline.anyPunctuation,"$1"),title:s&&s.replace(this.rules.inline.anyPunctuation,"$1")},t[0],this.lexer,this.rules)}}reflink(e,t){let r;if((r=this.rules.inline.reflink.exec(e))||(r=this.rules.inline.nolink.exec(e))){let n=(r[2]||r[1]).replace(this.rules.other.multipleSpaceGlobal," "),s=t[n.toLowerCase()];if(!s){let i=r[0].charAt(0);return{type:"text",raw:i,text:i}}return Fu(r,s,r[0],this.lexer,this.rules)}}emStrong(e,t,r=""){let n=this.rules.inline.emStrongLDelim.exec(e);if(!(!n||n[3]&&r.match(this.rules.other.unicodeAlphaNumeric))&&(!(n[1]||n[2])||!r||this.rules.inline.punctuation.exec(r))){let s=[...n[0]].length-1,i,a,o=s,c=0,l=n[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(l.lastIndex=0,t=t.slice(-1*e.length+s);(n=l.exec(t))!=null;){if(i=n[1]||n[2]||n[3]||n[4]||n[5]||n[6],!i)continue;if(a=[...i].length,n[3]||n[4]){o+=a;continue}else if((n[5]||n[6])&&s%3&&!((s+a)%3)){c+=a;continue}if(o-=a,o>0)continue;a=Math.min(a,a+o+c);let f=[...n[0]][0].length,p=e.slice(0,s+n.index+f+a);if(Math.min(s,a)%2){let g=p.slice(1,-1);return{type:"em",raw:p,text:g,tokens:this.lexer.inlineTokens(g)}}let d=p.slice(2,-2);return{type:"strong",raw:p,text:d,tokens:this.lexer.inlineTokens(d)}}}}codespan(e){let t=this.rules.inline.code.exec(e);if(t){let r=t[2].replace(this.rules.other.newLineCharGlobal," "),n=this.rules.other.nonSpaceChar.test(r),s=this.rules.other.startingSpaceChar.test(r)&&this.rules.other.endingSpaceChar.test(r);return n&&s&&(r=r.substring(1,r.length-1)),{type:"codespan",raw:t[0],text:r}}}br(e){let t=this.rules.inline.br.exec(e);if(t)return{type:"br",raw:t[0]}}del(e){let t=this.rules.inline.del.exec(e);if(t)return{type:"del",raw:t[0],text:t[2],tokens:this.lexer.inlineTokens(t[2])}}autolink(e){let t=this.rules.inline.autolink.exec(e);if(t){let r,n;return t[2]==="@"?(r=t[1],n="mailto:"+r):(r=t[1],n=r),{type:"link",raw:t[0],text:r,href:n,tokens:[{type:"text",raw:r,text:r}]}}}url(e){var r;let t;if(t=this.rules.inline.url.exec(e)){let n,s;if(t[2]==="@")n=t[0],s="mailto:"+n;else{let i;do i=t[0],t[0]=((r=this.rules.inline._backpedal.exec(t[0]))==null?void 0:r[0])??"";while(i!==t[0]);n=t[0],t[1]==="www."?s="http://"+t[0]:s=t[0]}return{type:"link",raw:t[0],text:n,href:s,tokens:[{type:"text",raw:n,text:n}]}}}inlineText(e){let t=this.rules.inline.text.exec(e);if(t){let r=this.lexer.state.inRawBlock;return{type:"text",raw:t[0],text:t[0],escaped:r}}}},Bt=class $o{constructor(t){h(this,"tokens");h(this,"options");h(this,"state");h(this,"inlineQueue");h(this,"tokenizer");this.tokens=[],this.tokens.links=Object.create(null),this.options=t||Jr,this.options.tokenizer=this.options.tokenizer||new ji,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 r={other:kt,block:Gs.normal,inline:zn.normal};this.options.pedantic?(r.block=Gs.pedantic,r.inline=zn.pedantic):this.options.gfm&&(r.block=Gs.gfm,this.options.breaks?r.inline=zn.breaks:r.inline=zn.gfm),this.tokenizer.rules=r}static get rules(){return{block:Gs,inline:zn}}static lex(t,r){return new $o(r).lex(t)}static lexInline(t,r){return new $o(r).inlineTokens(t)}lex(t){t=t.replace(kt.carriageReturn,`
|
|
51
|
+
`),this.blockTokens(t,this.tokens);for(let r=0;r<this.inlineQueue.length;r++){let n=this.inlineQueue[r];this.inlineTokens(n.src,n.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(t,r=[],n=!1){var s,i,a;for(this.options.pedantic&&(t=t.replace(kt.tabCharGlobal," ").replace(kt.spaceLine,""));t;){let o;if((i=(s=this.options.extensions)==null?void 0:s.block)!=null&&i.some(l=>(o=l.call({lexer:this},t,r))?(t=t.substring(o.raw.length),r.push(o),!0):!1))continue;if(o=this.tokenizer.space(t)){t=t.substring(o.raw.length);let l=r.at(-1);o.raw.length===1&&l!==void 0?l.raw+=`
|
|
52
|
+
`:r.push(o);continue}if(o=this.tokenizer.code(t)){t=t.substring(o.raw.length);let l=r.at(-1);(l==null?void 0:l.type)==="paragraph"||(l==null?void 0:l.type)==="text"?(l.raw+=(l.raw.endsWith(`
|
|
53
|
+
`)?"":`
|
|
54
|
+
`)+o.raw,l.text+=`
|
|
55
|
+
`+o.text,this.inlineQueue.at(-1).src=l.text):r.push(o);continue}if(o=this.tokenizer.fences(t)){t=t.substring(o.raw.length),r.push(o);continue}if(o=this.tokenizer.heading(t)){t=t.substring(o.raw.length),r.push(o);continue}if(o=this.tokenizer.hr(t)){t=t.substring(o.raw.length),r.push(o);continue}if(o=this.tokenizer.blockquote(t)){t=t.substring(o.raw.length),r.push(o);continue}if(o=this.tokenizer.list(t)){t=t.substring(o.raw.length),r.push(o);continue}if(o=this.tokenizer.html(t)){t=t.substring(o.raw.length),r.push(o);continue}if(o=this.tokenizer.def(t)){t=t.substring(o.raw.length);let l=r.at(-1);(l==null?void 0:l.type)==="paragraph"||(l==null?void 0:l.type)==="text"?(l.raw+=(l.raw.endsWith(`
|
|
56
|
+
`)?"":`
|
|
57
|
+
`)+o.raw,l.text+=`
|
|
58
|
+
`+o.raw,this.inlineQueue.at(-1).src=l.text):this.tokens.links[o.tag]||(this.tokens.links[o.tag]={href:o.href,title:o.title},r.push(o));continue}if(o=this.tokenizer.table(t)){t=t.substring(o.raw.length),r.push(o);continue}if(o=this.tokenizer.lheading(t)){t=t.substring(o.raw.length),r.push(o);continue}let c=t;if((a=this.options.extensions)!=null&&a.startBlock){let l=1/0,f=t.slice(1),p;this.options.extensions.startBlock.forEach(d=>{p=d.call({lexer:this},f),typeof p=="number"&&p>=0&&(l=Math.min(l,p))}),l<1/0&&l>=0&&(c=t.substring(0,l+1))}if(this.state.top&&(o=this.tokenizer.paragraph(c))){let l=r.at(-1);n&&(l==null?void 0:l.type)==="paragraph"?(l.raw+=(l.raw.endsWith(`
|
|
59
|
+
`)?"":`
|
|
60
|
+
`)+o.raw,l.text+=`
|
|
61
|
+
`+o.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=l.text):r.push(o),n=c.length!==t.length,t=t.substring(o.raw.length);continue}if(o=this.tokenizer.text(t)){t=t.substring(o.raw.length);let l=r.at(-1);(l==null?void 0:l.type)==="text"?(l.raw+=(l.raw.endsWith(`
|
|
62
|
+
`)?"":`
|
|
63
|
+
`)+o.raw,l.text+=`
|
|
64
|
+
`+o.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=l.text):r.push(o);continue}if(t){let l="Infinite loop on byte: "+t.charCodeAt(0);if(this.options.silent){console.error(l);break}else throw new Error(l)}}return this.state.top=!0,r}inline(t,r=[]){return this.inlineQueue.push({src:t,tokens:r}),r}inlineTokens(t,r=[]){var c,l,f,p,d;let n=t,s=null;if(this.tokens.links){let g=Object.keys(this.tokens.links);if(g.length>0)for(;(s=this.tokenizer.rules.inline.reflinkSearch.exec(n))!=null;)g.includes(s[0].slice(s[0].lastIndexOf("[")+1,-1))&&(n=n.slice(0,s.index)+"["+"a".repeat(s[0].length-2)+"]"+n.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(s=this.tokenizer.rules.inline.anyPunctuation.exec(n))!=null;)n=n.slice(0,s.index)+"++"+n.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);let i;for(;(s=this.tokenizer.rules.inline.blockSkip.exec(n))!=null;)i=s[2]?s[2].length:0,n=n.slice(0,s.index+i)+"["+"a".repeat(s[0].length-i-2)+"]"+n.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);n=((l=(c=this.options.hooks)==null?void 0:c.emStrongMask)==null?void 0:l.call({lexer:this},n))??n;let a=!1,o="";for(;t;){a||(o=""),a=!1;let g;if((p=(f=this.options.extensions)==null?void 0:f.inline)!=null&&p.some(k=>(g=k.call({lexer:this},t,r))?(t=t.substring(g.raw.length),r.push(g),!0):!1))continue;if(g=this.tokenizer.escape(t)){t=t.substring(g.raw.length),r.push(g);continue}if(g=this.tokenizer.tag(t)){t=t.substring(g.raw.length),r.push(g);continue}if(g=this.tokenizer.link(t)){t=t.substring(g.raw.length),r.push(g);continue}if(g=this.tokenizer.reflink(t,this.tokens.links)){t=t.substring(g.raw.length);let k=r.at(-1);g.type==="text"&&(k==null?void 0:k.type)==="text"?(k.raw+=g.raw,k.text+=g.text):r.push(g);continue}if(g=this.tokenizer.emStrong(t,n,o)){t=t.substring(g.raw.length),r.push(g);continue}if(g=this.tokenizer.codespan(t)){t=t.substring(g.raw.length),r.push(g);continue}if(g=this.tokenizer.br(t)){t=t.substring(g.raw.length),r.push(g);continue}if(g=this.tokenizer.del(t)){t=t.substring(g.raw.length),r.push(g);continue}if(g=this.tokenizer.autolink(t)){t=t.substring(g.raw.length),r.push(g);continue}if(!this.state.inLink&&(g=this.tokenizer.url(t))){t=t.substring(g.raw.length),r.push(g);continue}let _=t;if((d=this.options.extensions)!=null&&d.startInline){let k=1/0,b=t.slice(1),w;this.options.extensions.startInline.forEach($=>{w=$.call({lexer:this},b),typeof w=="number"&&w>=0&&(k=Math.min(k,w))}),k<1/0&&k>=0&&(_=t.substring(0,k+1))}if(g=this.tokenizer.inlineText(_)){t=t.substring(g.raw.length),g.raw.slice(-1)!=="_"&&(o=g.raw.slice(-1)),a=!0;let k=r.at(-1);(k==null?void 0:k.type)==="text"?(k.raw+=g.raw,k.text+=g.text):r.push(g);continue}if(t){let k="Infinite loop on byte: "+t.charCodeAt(0);if(this.options.silent){console.error(k);break}else throw new Error(k)}}return r}},Li=class{constructor(e){h(this,"options");h(this,"parser");this.options=e||Jr}space(e){return""}code({text:e,lang:t,escaped:r}){var i;let n=(i=(t||"").match(kt.notSpaceStart))==null?void 0:i[0],s=e.replace(kt.endingNewline,"")+`
|
|
65
|
+
`;return n?'<pre><code class="language-'+sr(n)+'">'+(r?s:sr(s,!0))+`</code></pre>
|
|
66
|
+
`:"<pre><code>"+(r?s:sr(s,!0))+`</code></pre>
|
|
67
|
+
`}blockquote({tokens:e}){return`<blockquote>
|
|
68
|
+
${this.parser.parse(e)}</blockquote>
|
|
69
|
+
`}html({text:e}){return e}def(e){return""}heading({tokens:e,depth:t}){return`<h${t}>${this.parser.parseInline(e)}</h${t}>
|
|
70
|
+
`}hr(e){return`<hr>
|
|
71
|
+
`}list(e){let t=e.ordered,r=e.start,n="";for(let a=0;a<e.items.length;a++){let o=e.items[a];n+=this.listitem(o)}let s=t?"ol":"ul",i=t&&r!==1?' start="'+r+'"':"";return"<"+s+i+`>
|
|
72
|
+
`+n+"</"+s+`>
|
|
73
|
+
`}listitem(e){return`<li>${this.parser.parse(e.tokens)}</li>
|
|
74
|
+
`}checkbox({checked:e}){return"<input "+(e?'checked="" ':"")+'disabled="" type="checkbox"> '}paragraph({tokens:e}){return`<p>${this.parser.parseInline(e)}</p>
|
|
75
|
+
`}table(e){let t="",r="";for(let s=0;s<e.header.length;s++)r+=this.tablecell(e.header[s]);t+=this.tablerow({text:r});let n="";for(let s=0;s<e.rows.length;s++){let i=e.rows[s];r="";for(let a=0;a<i.length;a++)r+=this.tablecell(i[a]);n+=this.tablerow({text:r})}return n&&(n=`<tbody>${n}</tbody>`),`<table>
|
|
76
|
+
<thead>
|
|
77
|
+
`+t+`</thead>
|
|
78
|
+
`+n+`</table>
|
|
79
|
+
`}tablerow({text:e}){return`<tr>
|
|
80
|
+
${e}</tr>
|
|
81
|
+
`}tablecell(e){let t=this.parser.parseInline(e.tokens),r=e.header?"th":"td";return(e.align?`<${r} align="${e.align}">`:`<${r}>`)+t+`</${r}>
|
|
82
|
+
`}strong({tokens:e}){return`<strong>${this.parser.parseInline(e)}</strong>`}em({tokens:e}){return`<em>${this.parser.parseInline(e)}</em>`}codespan({text:e}){return`<code>${sr(e,!0)}</code>`}br(e){return"<br>"}del({tokens:e}){return`<del>${this.parser.parseInline(e)}</del>`}link({href:e,title:t,tokens:r}){let n=this.parser.parseInline(r),s=Au(e);if(s===null)return n;e=s;let i='<a href="'+e+'"';return t&&(i+=' title="'+sr(t)+'"'),i+=">"+n+"</a>",i}image({href:e,title:t,text:r,tokens:n}){n&&(r=this.parser.parseInline(n,this.parser.textRenderer));let s=Au(e);if(s===null)return sr(r);e=s;let i=`<img src="${e}" alt="${r}"`;return t&&(i+=` title="${sr(t)}"`),i+=">",i}text(e){return"tokens"in e&&e.tokens?this.parser.parseInline(e.tokens):"escaped"in e&&e.escaped?e.text:sr(e.text)}},al=class{strong({text:e}){return e}em({text:e}){return e}codespan({text:e}){return e}del({text:e}){return e}html({text:e}){return e}text({text:e}){return e}link({text:e}){return""+e}image({text:e}){return""+e}br(){return""}checkbox({raw:e}){return e}},Ut=class jo{constructor(t){h(this,"options");h(this,"renderer");h(this,"textRenderer");this.options=t||Jr,this.options.renderer=this.options.renderer||new Li,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new al}static parse(t,r){return new jo(r).parse(t)}static parseInline(t,r){return new jo(r).parseInline(t)}parse(t){var n,s;let r="";for(let i=0;i<t.length;i++){let a=t[i];if((s=(n=this.options.extensions)==null?void 0:n.renderers)!=null&&s[a.type]){let c=a,l=this.options.extensions.renderers[c.type].call({parser:this},c);if(l!==!1||!["space","hr","heading","code","table","blockquote","list","html","def","paragraph","text"].includes(c.type)){r+=l||"";continue}}let o=a;switch(o.type){case"space":{r+=this.renderer.space(o);break}case"hr":{r+=this.renderer.hr(o);break}case"heading":{r+=this.renderer.heading(o);break}case"code":{r+=this.renderer.code(o);break}case"table":{r+=this.renderer.table(o);break}case"blockquote":{r+=this.renderer.blockquote(o);break}case"list":{r+=this.renderer.list(o);break}case"checkbox":{r+=this.renderer.checkbox(o);break}case"html":{r+=this.renderer.html(o);break}case"def":{r+=this.renderer.def(o);break}case"paragraph":{r+=this.renderer.paragraph(o);break}case"text":{r+=this.renderer.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}parseInline(t,r=this.renderer){var s,i;let n="";for(let a=0;a<t.length;a++){let o=t[a];if((i=(s=this.options.extensions)==null?void 0:s.renderers)!=null&&i[o.type]){let l=this.options.extensions.renderers[o.type].call({parser:this},o);if(l!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(o.type)){n+=l||"";continue}}let c=o;switch(c.type){case"escape":{n+=r.text(c);break}case"html":{n+=r.html(c);break}case"link":{n+=r.link(c);break}case"image":{n+=r.image(c);break}case"checkbox":{n+=r.checkbox(c);break}case"strong":{n+=r.strong(c);break}case"em":{n+=r.em(c);break}case"codespan":{n+=r.codespan(c);break}case"br":{n+=r.br(c);break}case"del":{n+=r.del(c);break}case"text":{n+=r.text(c);break}default:{let l='Token with "'+c.type+'" type was not found.';if(this.options.silent)return console.error(l),"";throw new Error(l)}}}return n}},Qs,Jn=(Qs=class{constructor(e){h(this,"options");h(this,"block");this.options=e||Jr}preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}emStrongMask(e){return e}provideLexer(){return this.block?Bt.lex:Bt.lexInline}provideParser(){return this.block?Ut.parse:Ut.parseInline}},h(Qs,"passThroughHooks",new Set(["preprocess","postprocess","processAllTokens","emStrongMask"])),h(Qs,"passThroughHooksRespectAsync",new Set(["preprocess","postprocess","processAllTokens"])),Qs),pI=class{constructor(...e){h(this,"defaults",Zc());h(this,"options",this.setOptions);h(this,"parse",this.parseMarkdown(!0));h(this,"parseInline",this.parseMarkdown(!1));h(this,"Parser",Ut);h(this,"Renderer",Li);h(this,"TextRenderer",al);h(this,"Lexer",Bt);h(this,"Tokenizer",ji);h(this,"Hooks",Jn);this.use(...e)}walkTokens(e,t){var n,s;let r=[];for(let i of e)switch(r=r.concat(t.call(this,i)),i.type){case"table":{let a=i;for(let o of a.header)r=r.concat(this.walkTokens(o.tokens,t));for(let o of a.rows)for(let c of o)r=r.concat(this.walkTokens(c.tokens,t));break}case"list":{let a=i;r=r.concat(this.walkTokens(a.items,t));break}default:{let a=i;(s=(n=this.defaults.extensions)==null?void 0:n.childTokens)!=null&&s[a.type]?this.defaults.extensions.childTokens[a.type].forEach(o=>{let c=a[o].flat(1/0);r=r.concat(this.walkTokens(c,t))}):a.tokens&&(r=r.concat(this.walkTokens(a.tokens,t)))}}return r}use(...e){let t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach(r=>{let n={...r};if(n.async=this.defaults.async||n.async||!1,r.extensions&&(r.extensions.forEach(s=>{if(!s.name)throw new Error("extension name required");if("renderer"in s){let i=t.renderers[s.name];i?t.renderers[s.name]=function(...a){let o=s.renderer.apply(this,a);return o===!1&&(o=i.apply(this,a)),o}:t.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=t[s.level];i?i.unshift(s.tokenizer):t[s.level]=[s.tokenizer],s.start&&(s.level==="block"?t.startBlock?t.startBlock.push(s.start):t.startBlock=[s.start]:s.level==="inline"&&(t.startInline?t.startInline.push(s.start):t.startInline=[s.start]))}"childTokens"in s&&s.childTokens&&(t.childTokens[s.name]=s.childTokens)}),n.extensions=t),r.renderer){let s=this.defaults.renderer||new Li(this.defaults);for(let i in r.renderer){if(!(i in s))throw new Error(`renderer '${i}' does not exist`);if(["options","parser"].includes(i))continue;let a=i,o=r.renderer[a],c=s[a];s[a]=(...l)=>{let f=o.apply(s,l);return f===!1&&(f=c.apply(s,l)),f||""}}n.renderer=s}if(r.tokenizer){let s=this.defaults.tokenizer||new ji(this.defaults);for(let i in r.tokenizer){if(!(i in s))throw new Error(`tokenizer '${i}' does not exist`);if(["options","rules","lexer"].includes(i))continue;let a=i,o=r.tokenizer[a],c=s[a];s[a]=(...l)=>{let f=o.apply(s,l);return f===!1&&(f=c.apply(s,l)),f}}n.tokenizer=s}if(r.hooks){let s=this.defaults.hooks||new Jn;for(let i in r.hooks){if(!(i in s))throw new Error(`hook '${i}' does not exist`);if(["options","block"].includes(i))continue;let a=i,o=r.hooks[a],c=s[a];Jn.passThroughHooks.has(i)?s[a]=l=>{if(this.defaults.async&&Jn.passThroughHooksRespectAsync.has(i))return(async()=>{let p=await o.call(s,l);return c.call(s,p)})();let f=o.call(s,l);return c.call(s,f)}:s[a]=(...l)=>{if(this.defaults.async)return(async()=>{let p=await o.apply(s,l);return p===!1&&(p=await c.apply(s,l)),p})();let f=o.apply(s,l);return f===!1&&(f=c.apply(s,l)),f}}n.hooks=s}if(r.walkTokens){let s=this.defaults.walkTokens,i=r.walkTokens;n.walkTokens=function(a){let o=[];return o.push(i.call(this,a)),s&&(o=o.concat(s.call(this,a))),o}}this.defaults={...this.defaults,...n}}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,t){return Bt.lex(e,t??this.defaults)}parser(e,t){return Ut.parse(e,t??this.defaults)}parseMarkdown(e){return(t,r)=>{let n={...r},s={...this.defaults,...n},i=this.onError(!!s.silent,!!s.async);if(this.defaults.async===!0&&n.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 t>"u"||t===null)return i(new Error("marked(): input parameter is undefined or null"));if(typeof t!="string")return i(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(t)+", string expected"));if(s.hooks&&(s.hooks.options=s,s.hooks.block=e),s.async)return(async()=>{let a=s.hooks?await s.hooks.preprocess(t):t,o=await(s.hooks?await s.hooks.provideLexer():e?Bt.lex:Bt.lexInline)(a,s),c=s.hooks?await s.hooks.processAllTokens(o):o;s.walkTokens&&await Promise.all(this.walkTokens(c,s.walkTokens));let l=await(s.hooks?await s.hooks.provideParser():e?Ut.parse:Ut.parseInline)(c,s);return s.hooks?await s.hooks.postprocess(l):l})().catch(i);try{s.hooks&&(t=s.hooks.preprocess(t));let a=(s.hooks?s.hooks.provideLexer():e?Bt.lex:Bt.lexInline)(t,s);s.hooks&&(a=s.hooks.processAllTokens(a)),s.walkTokens&&this.walkTokens(a,s.walkTokens);let o=(s.hooks?s.hooks.provideParser():e?Ut.parse:Ut.parseInline)(a,s);return s.hooks&&(o=s.hooks.postprocess(o)),o}catch(a){return i(a)}}}onError(e,t){return r=>{if(r.message+=`
|
|
83
|
+
Please report this to https://github.com/markedjs/marked.`,e){let n="<p>An error occurred:</p><pre>"+sr(r.message+"",!0)+"</pre>";return t?Promise.resolve(n):n}if(t)return Promise.reject(r);throw r}}},Vr=new pI;function Ee(e,t){return Vr.parse(e,t)}Ee.options=Ee.setOptions=function(e){return Vr.setOptions(e),Ee.defaults=Vr.defaults,Qg(Ee.defaults),Ee};Ee.getDefaults=Zc;Ee.defaults=Jr;Ee.use=function(...e){return Vr.use(...e),Ee.defaults=Vr.defaults,Qg(Ee.defaults),Ee};Ee.walkTokens=function(e,t){return Vr.walkTokens(e,t)};Ee.parseInline=Vr.parseInline;Ee.Parser=Ut;Ee.parser=Ut.parse;Ee.Renderer=Li;Ee.TextRenderer=al;Ee.Lexer=Bt;Ee.lexer=Bt.lex;Ee.Tokenizer=ji;Ee.Hooks=Jn;Ee.parse=Ee;Ee.options;Ee.setOptions;Ee.use;Ee.walkTokens;Ee.parseInline;Ut.parse;Bt.lex;Ee.setOptions({breaks:!0,gfm:!0});const Ws=e=>e?new Date(e).toLocaleString():"-",mI=(e,t)=>e.length>t?e.slice(0,t)+"...":e,_I=e=>Qc(e),ci=e=>Qc(e),ts=e=>typeof e=="string"?e:Array.isArray(e)?e.map(ts).join(""):e.type==="text"?e.text??"":e.type==="thinking"?"":e.type==="tool_result"?e.content?ts(e.content):"0":e.content?ts(e.content):"",Pu=e=>{let t="";if(e.summary)t=e.summary;else if(e.content)t=ts(e.content);else{const r=e.message;r!=null&&r.content&&(t=ts(r.content))}return ci(t)},bI=e=>{const t=[],r=/<(ide_[^>]+)>([\s\S]*?)<\/\1>/g;let n=0,s;for(;(s=r.exec(e))!==null;){if(s.index>n){const i=e.slice(n,s.index).trim();i&&t.push({type:"text",content:i})}t.push({type:"ide_tag",tag:s[1],content:s[2].trim()}),n=r.lastIndex}if(n<e.length){const i=e.slice(n).trim();i&&t.push({type:"text",content:i})}return t};var vI=M('<pre class="whitespace-pre-wrap font-mono text-xs text-gh-text-secondary overflow-x-auto"><code> </code></pre>'),yI=M('<pre class="whitespace-pre-wrap font-mono text-xs text-gh-text-secondary overflow-x-auto"> </pre>'),kI=M('<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>'),xI=M('<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),SI=M('<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>'),wI=M('<div class="relative"><!> <!></div>'),II=M('<pre class="whitespace-pre-wrap font-mono text-xs text-gh-text-secondary overflow-x-auto"><code> </code></pre>'),TI=M('<pre class="whitespace-pre-wrap font-mono text-xs text-gh-text-secondary overflow-x-auto"> </pre>');function Ys(e,t){fr(t,!0);let r=Ke(t,"maxLines",3,10),n=tt(!1),s=tt(!1);const i=z(()=>t.content.split(`
|
|
84
|
+
`)),a=z(()=>u(i).length>r()),o=z(()=>u(a)&&!u(n)?u(i).slice(0,r()).join(`
|
|
85
|
+
`):t.content);var c=fe(),l=re(c);{var f=d=>{var g=wI(),_=x(g);{var k=O=>{var D=vI(),N=x(D),I=x(N,!0);v(N),v(D),U(()=>{$e(N,1,`language-${t.lang??""}`),P(I,u(o))}),S(O,D)},b=O=>{var D=yI(),N=x(D,!0);v(D),U(()=>P(N,u(o))),S(O,D)};L(_,O=>{t.lang?O(k):O(b,!1)})}var w=A(_,2);{var $=O=>{var D=xI(),N=A(re(D),2);{var I=m=>{var C=kI();C.__click=()=>H(n,!0);var E=x(C);v(C),U(()=>P(E,`Click to expand (${u(i).length-r()} more lines)`)),S(m,C)};L(N,m=>{u(s)&&m(I)})}S(O,D)},B=O=>{var D=SI();D.__click=()=>H(n,!1),S(O,D)};L(w,O=>{u(n)?O(B,!1):O($)})}v(g),Cr("mouseenter",g,()=>H(s,!0)),Cr("mouseleave",g,()=>H(s,!1)),S(d,g)},p=d=>{var g=fe(),_=re(g);{var k=w=>{var $=II(),B=x($),O=x(B,!0);v(B),v($),U(()=>{$e(B,1,`language-${t.lang??""}`),P(O,t.content)}),S(w,$)},b=w=>{var $=TI(),B=x($,!0);v($),U(()=>P(B,t.content)),S(w,$)};L(_,w=>{t.lang?w(k):w(b,!1)},!0)}S(d,g)};L(l,d=>{u(a)?d(f):d(p,!1)})}S(e,c),hr()}Wt(["click"]);var RI=M('<button class="font-mono hover:underline cursor-pointer bg-transparent border-none text-blue-400 p-0"> </button>'),CI=M('<span class="font-mono opacity-60"> </span>'),EI=M('<span class="font-mono"> </span>'),OI=M('<span class="opacity-60"> </span>'),MI=M('<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>'),AI=M('<button class="font-mono hover:underline cursor-pointer bg-transparent border-none text-purple-400 p-0"> </button>'),NI=M('<span class="font-mono opacity-60"> </span>'),FI=M('<span class="font-mono"> </span>'),PI=M('<span class="font-mono"> </span>'),$I=M('<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>'),jI=M('<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 LI(e,t){fr(t,!0);const r=z(()=>{const l=t.content.match(/(?:opened the file |selected.*from )(\/[^\s]+)/);return l?l[1]:t.content.trim().startsWith("/")?t.content.trim().split(`
|
|
86
|
+
`)[0].split(" ")[0]:null}),n=z(()=>{const l=t.content.match(/lines? (\d+)(?:\s*to\s*(\d+))?/);return l?l[2]?`L${l[1]}-${l[2]}`:`L${l[1]}`:null}),s=async()=>{u(r)&&await Ho(u(r))};var i=fe(),a=re(i);{var o=l=>{var f=MI(),p=A(x(f),2);{var d=_=>{var k=fe(),b=re(k);Va(b,()=>Ja(u(r)),w=>{var $=EI(),B=x($,!0);v($),U(O=>P(B,O),[()=>u(r).split("/").pop()]),S(w,$)},(w,$)=>{var B=fe(),O=re(B);{var D=I=>{var m=RI();m.__click=s;var C=x(m);v(m),U(E=>{Pe(m,"title",u(r)),P(C,`${E??""}${u(n)?`:${u(n)}`:""}`)},[()=>u(r).split("/").pop()]),S(I,m)},N=I=>{var m=CI(),C=x(m,!0);v(m),U(E=>{Pe(m,"title",u(r)),P(C,E)},[()=>u(r).split("/").pop()]),S(I,m)};L(O,I=>{u($)?I(D):I(N,!1)})}S(w,B)}),S(_,k)},g=_=>{var k=OI(),b=x(k,!0);v(k),U(()=>P(b,t.content)),S(_,k)};L(p,_=>{u(r)?_(d):_(g,!1)})}v(f),S(l,f)},c=l=>{var f=fe(),p=re(f);{var d=_=>{var k=$I(),b=x(k),w=A(x(b),2);{var $=O=>{var D=fe(),N=re(D);Va(N,()=>Ja(u(r)),I=>{var m=FI(),C=x(m);v(m),U(E=>P(C,`${E??""}${u(n)?`:${u(n)}`:""}`),[()=>u(r).split("/").pop()]),S(I,m)},(I,m)=>{var C=fe(),E=re(C);{var R=ie=>{var Y=AI();Y.__click=s;var ke=x(Y);v(Y),U(ue=>{Pe(Y,"title",u(r)),P(ke,`${ue??""}${u(n)?`:${u(n)}`:""}`)},[()=>u(r).split("/").pop()]),S(ie,Y)},j=ie=>{var Y=NI(),ke=x(Y);v(Y),U(ue=>{Pe(Y,"title",u(r)),P(ke,`${ue??""}${u(n)?`:${u(n)}`:""}`)},[()=>u(r).split("/").pop()]),S(ie,Y)};L(E,ie=>{u(m)?ie(R):ie(j,!1)})}S(I,C)}),S(O,D)},B=O=>{var D=PI(),N=x(D,!0);v(D),U(I=>P(N,I),[()=>t.content.split(`
|
|
87
|
+
`)[0].slice(0,60)]),S(O,D)};L(w,O=>{u(r)?O($):O(B,!1)})}v(b),v(k),S(_,k)},g=_=>{var k=jI(),b=A(x(k),2),w=x(b);v(b);var $=A(b,2),B=x($);v($),v(k),U(O=>{P(w,`<${t.tag??""}>`),P(B,`${O??""}${t.content.length>50?"...":""}`)},[()=>t.content.slice(0,50)]),S(_,k)};L(p,_=>{t.tag==="ide_selection"?_(d):_(g,!1)},!0)}S(l,f)};L(a,l=>{t.tag==="ide_opened_file"?l(o):l(c,!1)})}S(e,i),hr()}Wt(["click"]);var DI=M('<li><span class="flex-shrink-0"> </span> <span> </span></li>'),BI=M('<ul class="space-y-1.5 mt-1"></ul>');function UI(e,t){const r=i=>{switch(i){case"completed":return"✅";case"in_progress":return"🔄";case"pending":return"⬜"}},n=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=BI();Ct(s,21,()=>t.todos,qt,(i,a)=>{var o=DI(),c=x(o),l=x(c,!0);v(c);var f=A(c,2),p=x(f,!0);v(f),v(o),U((d,g)=>{$e(o,1,`flex items-start gap-2 text-sm ${d??""}`),P(l,g),$e(f,1,zo(u(a).status==="completed"?"line-through opacity-70":"")),P(p,u(a).status==="in_progress"?u(a).activeForm:u(a).content)},[()=>n(u(a).status),()=>r(u(a).status)]),S(i,o)}),v(s),S(e,s)}var qI=M('<button class="opacity-0 group-hover:opacity-100 transition-opacity bg-transparent border-none cursor-pointer p-1 rounded hover:bg-gh-accent/20 text-xs" title="Split session from this message">✂️</button>'),zI=M('<button class="opacity-0 group-hover:opacity-100 transition-opacity bg-transparent border-none cursor-pointer p-1 rounded hover:bg-gh-red/20 text-xs" title="Delete message">🗑️</button>'),VI=M('<button class="text-gh-accent hover:underline cursor-pointer bg-transparent border-none p-0" title="Open backup in VS Code"> </button>'),HI=M('<span class="text-gh-text-secondary"> </span>'),KI=M('<li class="font-mono text-xs truncate"><!></li>'),JI=M('<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>'),GI=M('<p class="mt-1 text-sm text-gh-text-secondary"> </p>'),WI=M('<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>'),YI=M('<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>'),QI=M('<span class="mt-1 text-sm text-gh-text-secondary font-mono"> </span>'),ZI=M('<span class="mt-1 text-sm text-gh-text-secondary font-mono"> </span>'),XI=M('<p class="mt-1 text-sm text-gh-text-secondary"> </p>'),eT=M("<!> <!>",1),tT=M(" <!>",1),rT=M('<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>'),nT=M('<button class="opacity-0 group-hover:opacity-100 transition-opacity bg-transparent border-none cursor-pointer p-1 rounded hover:bg-gh-border text-xs" title="Edit title">✏️</button>'),sT=M('<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>'),iT=M('<div class="message-content text-sm"></div>'),aT=M('<span class="font-semibold text-purple-400"> </span>'),oT=M('<p class="whitespace-pre-wrap"> </p>'),cT=M('<div class="message-content text-sm"><!></div>'),lT=M('<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 $u(e,t){fr(t,!0);const r=R=>{var j=fe(),ie=re(j);{var Y=ke=>{var ue=qI();ue.__click=()=>t.onSplit(t.msg),S(ke,ue)};L(ie,ke=>{t.onSplit&&!s()&&t.msg.uuid&&ke(Y)})}S(R,j)},n=R=>{var j=zI();j.__click=()=>t.onDelete(t.msg),S(R,j)};let s=Ke(t,"isFirst",3,!1);const i=z(()=>t.msg.uuid??""),a=z(()=>t.msg.type==="assistant"),o=z(()=>t.msg.type==="custom-title"),c=z(()=>t.msg.type==="file-history-snapshot"),l=z(()=>t.msg.type==="human"||t.msg.type==="user"),f=z(()=>t.msg.type==="system"&&t.msg.subtype==="local_command"),p=z(()=>t.msg.type==="queue-operation"),d=z(()=>{if(t.msg.type!=="user")return!1;const R=t.msg.message;if(!Array.isArray(R==null?void 0:R.content))return!1;const j=R.content[0];return(j==null?void 0:j.type)==="tool_result"}),g=z(()=>{if(!u(c))return null;const R=t.msg.snapshot,j=(R==null?void 0:R.trackedFileBackups)??{};return{files:Object.entries(j),timestamp:R==null?void 0:R.timestamp}}),_=z(()=>{var Y,ke;if(!u(f))return null;const R=typeof t.msg.content=="string"?t.msg.content:"",j=((Y=R.match(/<command-name>([^<]+)<\/command-name>/))==null?void 0:Y[1])??"",ie=((ke=R.match(/<command-message>([^<]+)<\/command-message>/))==null?void 0:ke[1])??"";return{name:j,message:ie}}),k=["Read","Write","Edit"],b=z(()=>{if(!u(a))return null;const R=t.msg.message;if(!Array.isArray(R==null?void 0:R.content))return null;const j=R.content.find(ie=>typeof ie=="object"&&ie!==null&&ie.type==="tool_use");return j?{name:j.name,input:j.input,filePath:k.includes(j.name)?j.input.file_path:null}:null}),w=z(()=>{if(!u(a))return[];const R=t.msg.message;return Array.isArray(R==null?void 0:R.content)?R.content.filter(j=>typeof j=="object"&&j!==null&&j.type==="thinking"):[]}),$=z(()=>t.msg.customTitle??""),B=z(()=>t.msg.uuid||t.msg.messageId||""),O=z(()=>{if(u(p))return!1;if(u(c)||u(f)||u(o)||u(b)||Pu(t.msg).trim().length>0)return!0;if(t.msg.type==="user"||t.msg.type==="human"){const j=u(d)?"Tool result":"User message";console.warn(`${j} without content:`,cm(t.msg))}return!1}),D=z(()=>u(O)||u(w).length>0),N=z(()=>u(l)?"bg-gh-accent/15 border-l-3 border-l-gh-accent":u(a)?"bg-gh-green/15 border-l-3 border-l-gh-green":u(o)?"bg-purple-500/15 border-l-3 border-l-purple-500":"bg-gh-border-subtle");var I=fe(),m=re(I);{var C=R=>{},E=R=>{var j=fe(),ie=re(j);{var Y=ue=>{var _e=JI(),st=x(_e),Me=x(st),Ge=x(Me);v(Me);var De=A(Me,2),ht=x(De),$t=x(ht,!0);v(ht);var At=A(ht,2);r(At);var F=A(At,2);n(F),v(De),v(st);var K=A(st,2);Ct(K,21,()=>u(g).files,qt,(G,de)=>{var W=z(()=>rm(u(de),2));let Te=()=>u(W)[0],xe=()=>u(W)[1];const Q=z(()=>!!(xe().backupFileName&&t.sessionId));var pe=KI(),Se=x(pe);{var J=Ne=>{var Ce=VI();Ce.__click=()=>Im(t.sessionId,xe().backupFileName);var we=x(Ce,!0);v(Ce),U(Re=>P(we,Re),[()=>ci(Te())]),S(Ne,Ce)},Ae=Ne=>{var Ce=HI(),we=x(Ce,!0);v(Ce),U(Re=>P(we,Re),[()=>ci(Te())]),S(Ne,Ce)};L(Se,Ne=>{u(Q)?Ne(J):Ne(Ae,!1)})}v(pe),U(Ne=>Pe(pe,"title",Ne),[()=>ci(Te())]),S(G,pe)}),v(K),v(_e),U(G=>{Pe(_e,"data-msg-id",u(i)),P(Ge,`📁 File Backups (${u(g).files.length??""})`),P($t,G)},[()=>Ws(u(g).timestamp)]),S(ue,_e)},ke=ue=>{var _e=fe(),st=re(_e);{var Me=De=>{var ht=WI(),$t=x(ht),At=x($t),F=x(At);v(At);var K=A(At,2),G=x(K),de=x(G,!0);v(G);var W=A(G,2);r(W);var Te=A(W,2);n(Te),v(K),v($t);var xe=A($t,2);{var Q=pe=>{var Se=GI(),J=x(Se,!0);v(Se),U(()=>P(J,u(_).message)),S(pe,Se)};L(xe,pe=>{var Se;u(_).message&&u(_).message!==((Se=u(_).name)==null?void 0:Se.slice(1))&&pe(Q)})}v(ht),U(pe=>{Pe(ht,"data-msg-id",u(i)),P(F,`⚡ ${(u(_).name||"Command")??""}`),P(de,pe)},[()=>Ws(t.msg.timestamp)]),S(De,ht)},Ge=De=>{var ht=fe(),$t=re(ht);{var At=K=>{var G=rT(),de=x(G),W=x(de),Te=x(W);v(W);var xe=A(W,2),Q=x(xe),pe=x(Q,!0);v(Q);var Se=A(Q,2);r(Se);var J=A(Se,2);n(J),v(xe),v(de);var Ae=A(de,2);{var Ne=we=>{var Re=fe(),We=re(Re);Va(We,()=>Ja(u(b).filePath),dt=>{var it=ZI(),Ie=x(it,!0);v(it),U(Fe=>P(Ie,Fe),[()=>u(b).filePath.split("/").pop()]),S(dt,it)},(dt,it)=>{var Ie=fe(),Fe=re(Ie);{var mt=me=>{var Z=YI();Z.__click=()=>Ho(u(b).filePath);var Be=x(Z,!0);v(Z),U(be=>{Pe(Z,"title",u(b).filePath),P(Be,be)},[()=>u(b).filePath.split("/").pop()]),S(me,Z)},_t=me=>{var Z=QI(),Be=x(Z,!0);v(Z),U(be=>{Pe(Z,"title",u(b).filePath),P(Be,be)},[()=>u(b).filePath.split("/").pop()]),S(me,Z)};L(Fe,me=>{u(it)?me(mt):me(_t,!1)})}S(dt,Ie)}),S(we,Re)},Ce=we=>{var Re=fe(),We=re(Re);{var dt=Ie=>{var Fe=eT(),mt=re(Fe);{var _t=Z=>{var Be=XI(),be=x(Be,!0);v(Be),U(()=>P(be,u(b).input.description)),S(Z,Be)};L(mt,Z=>{u(b).input.description&&Z(_t)})}var me=A(mt,2);{let Z=z(()=>String(u(b).input.command));Ys(me,{get content(){return u(Z)},lang:"sh",maxLines:3})}S(Ie,Fe)},it=Ie=>{const Fe=z(()=>{const{path:be,...ze}=u(b).input;return{_path:be,input:ze}}),mt=z(()=>Object.keys(u(Fe).input));var _t=fe(),me=re(_t);{var Z=be=>{const ze=z(()=>u(mt)[0]),Ve=z(()=>u(Fe).input[u(ze)]);var at=tT(),St=re(at),ot=A(St);{var jt=ct=>{UI(ct,{get todos(){return u(Ve)}})},Fn=ct=>{{let xr=z(()=>`${u(ze)} = ${JSON.stringify(u(Ve),null,2)}`);Ys(ct,{get content(){return u(xr)},lang:"js",maxLines:1})}};L(ot,ct=>{u(ze)==="todos"&&Array.isArray(u(Ve))?ct(jt):ct(Fn,!1)})}U(ct=>P(St,`${ct??""} `),[()=>(console.info(`${u(ze)} =`,u(Ve)),"")]),S(be,at)},Be=be=>{{let ze=z(()=>JSON.stringify(u(Fe).input,null,2));Ys(be,{get content(){return u(ze)},lang:"json",maxLines:6})}};L(me,be=>{u(mt).length===1?be(Z):be(Be,!1)})}S(Ie,_t)};L(We,Ie=>{u(b).input.command?Ie(dt):Ie(it,!1)},!0)}S(we,Re)};L(Ae,we=>{u(b).filePath?we(Ne):we(Ce,!1)})}v(G),U(we=>{Pe(G,"data-msg-id",u(i)),P(Te,`🔧 ${u(b).name??""}`),P(pe,we)},[()=>Ws(t.msg.timestamp)]),S(K,G)},F=K=>{var G=fe(),de=re(G);{var W=Te=>{var xe=lT(),Q=x(xe),pe=x(Q),Se=x(pe,!0);v(pe);var J=A(pe,2),Ae=x(J),Ne=x(Ae,!0);v(Ae);var Ce=A(Ae,2),we=x(Ce,!0);v(Ce);var Re=A(Ce,2);{var We=me=>{var Z=nT();Z.__click=()=>t.onEditTitle(t.msg),S(me,Z)};L(Re,me=>{u(o)&&t.onEditTitle&&me(We)})}var dt=A(Re,2);r(dt);var it=A(dt,2);n(it),v(J),v(Q);var Ie=A(Q,2);{var Fe=me=>{var Z=iT();Ct(Z,21,()=>u(w),qt,(Be,be,ze)=>{var Ve=sT(),at=x(Ve),St=x(at);v(at);var ot=A(at,2),jt=x(ot,!0);v(ot),v(Ve),U(()=>{P(St,`💭 Thinking ${u(w).length>1?`(${ze+1}/${u(w).length})`:""}`),P(jt,u(be).thinking)}),S(Be,Ve)}),v(Z),S(me,Z)};L(Ie,me=>{u(w).length>0&&me(Fe)})}var mt=A(Ie,2);{var _t=me=>{var Z=cT(),Be=x(Z);{var be=Ve=>{var at=aT(),St=x(at,!0);v(at),U(()=>P(St,u($))),S(Ve,at)},ze=Ve=>{const at=z(()=>Pu(t.msg)),St=z(()=>bI(u(at)));var ot=fe(),jt=re(ot);Ct(jt,17,()=>u(St),qt,(Fn,ct)=>{var xr=fe(),Fs=re(xr);{var _a=gr=>{LI(gr,{get tag(){return u(ct).tag},get content(){return u(ct).content}})},Ps=gr=>{const ba=z(()=>u(ct).content.split(`
|
|
88
|
+
`));var $s=fe(),V=re($s);{var te=pt=>{Ys(pt,{get content(){return u(ct).content},maxLines:10})},Ze=pt=>{var Gr=oT(),va=x(Gr,!0);v(Gr),U(()=>P(va,u(ct).content)),S(pt,Gr)};L(V,pt=>{u(ba).length>10?pt(te):pt(Ze,!1)})}S(gr,$s)};L(Fs,gr=>{u(ct).type==="ide_tag"&&u(ct).tag?gr(_a):gr(Ps,!1)})}S(Fn,xr)}),S(Ve,ot)};L(Be,Ve=>{u(o)?Ve(be):Ve(ze,!1)})}v(Z),S(me,Z)};L(mt,me=>{u(O)&&me(_t)})}v(xe),U(me=>{Pe(xe,"data-msg-id",u(i)),$e(xe,1,`p-4 rounded-lg group relative ${u(N)??""} flex flex-col ${u(D)?"gap-2":""}`),P(Se,u(d)?"OUT":t.msg.type),P(Ne,me),P(we,u(B))},[()=>Ws(t.msg.timestamp)]),S(Te,xe)};L(de,Te=>{u(D)&&Te(W)},!0)}S(K,G)};L($t,K=>{u(b)?K(At):K(F,!1)},!0)}S(De,ht)};L(st,De=>{u(f)&&u(_)?De(Me):De(Ge,!1)},!0)}S(ue,_e)};L(ie,ue=>{u(c)&&u(g)?ue(Y):ue(ke,!1)},!0)}S(R,j)};L(m,R=>{u(p)?R(C):R(E,!1)})}S(e,I),hr()}Wt(["click"]);Wt(["click"]);var uT=M('<span class="tooltip svelte-1yfjzin"> </span>'),fT=M("<button><!></button> <!>",1);function Ua(e,t){let r=Ke(t,"position",3,"bottom"),n=Ke(t,"class",3,""),s=sm(t,["$$slots","$$events","$$legacy","title","children","position","class"]),i=tt(null),a=tt(!1),o=tt("");const c=()=>{if(!u(i))return;const b=u(i).getBoundingClientRect(),w=b.left+b.width/2;r()==="top"?H(o,`left: ${w}px; bottom: ${window.innerHeight-b.top+8}px;`):H(o,`left: ${w}px; top: ${b.bottom+8}px;`)},l=()=>{c(),H(a,!0)},f=()=>{H(a,!1)};var p=fT(),d=re(p);ym(d,()=>({class:`tooltip-btn ${n()??""}`,onmouseenter:l,onmouseleave:f,...s}),void 0,void 0,void 0,"svelte-1yfjzin");var g=x(d);hm(g,()=>t.children),v(d),qo(d,b=>H(i,b),()=>u(i));var _=A(d,2);{var k=b=>{var w=uT(),$=x(w,!0);v(w),U(()=>{Bf(w,u(o)),P($,t.title)}),S(b,w)};L(_,b=>{u(a)&&b(k)})}S(e,p)}var hT=M('<li class="py-2 px-8 text-gh-text-secondary text-sm">Loading...</li>'),dT=M('<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>'),gT=M('<span class="w-5 ml-1"></span>'),pT=M('<span class="flex items-center gap-0.5"><span>🤖</span><span> </span></span>'),mT=M('<span class="flex items-center gap-0.5"><span>📋</span><span> </span></span>'),_T=M('<span class="pl-6 text-[10px] text-gh-text-secondary/70"> </span>'),bT=M('<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>'),vT=M('<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>'),yT=M('<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>'),kT=M('<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>'),xT=M('<ul class="bg-gh-bg-secondary/50 border-t border-gh-border-subtle text-xs"><!> <!> <!> <!></ul>'),ST=M('<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>'),wT=M('<ul class="bg-gh-bg"><!></ul>'),IT=M('<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>'),TT=M('<aside class="bg-gh-bg-secondary border border-gh-border rounded-lg overflow-hidden flex flex-col"><h2 class="p-4 text-base font-semibold border-b border-gh-border bg-gh-bg"> </h2> <ul class="overflow-y-auto flex-1"></ul></aside>');function yR(e,t){fr(t,!0);const r=()=>am(Yc,"$appConfig",n),[n,s]=im(),i=(I,m)=>{var C;return(C=t.projectSessionData.get(I))==null?void 0:C.get(m)},a=I=>{const m=i(I.projectName,I.id);if(m!=null&&m.customTitle)return m.customTitle;if(m!=null&&m.currentSummary){const C=m.currentSummary;return C.length>60?C.slice(0,57)+"...":C}return I.title&&I.title!=="Untitled"?I.title:"Untitled"},o=I=>{const m=i(I.projectName,I.id);return m!=null&&m.customTitle&&(m!=null&&m.currentSummary)?m.currentSummary:m!=null&&m.currentSummary&&I.title&&I.title!=="Untitled"?I.title:m!=null&&m.currentSummary?m.currentSummary:I.title??"No summary available"},c=I=>{const m=i(I.projectName,I.id),C=m!=null&&m.todos?m.todos.sessionTodos.length+m.todos.agentTodos.reduce((E,R)=>E+R.todos.length,0):0;return{agents:(m==null?void 0:m.agents.length)??0,todos:C,summaries:(m==null?void 0:m.summaries.length)??0}},l=z(()=>E2(t.projects,{currentProjectName:r().currentProjectName,homeDir:r().homeDir}));let f=tt(fi(new Set));const p=(I,m)=>{I.stopPropagation(),u(f).has(m)?u(f).delete(m):u(f).add(m),H(f,new Set(u(f)),!0)};let d=tt(null),g=tt(null);const _=(I,m)=>{I.dataTransfer&&(H(d,m,!0),I.dataTransfer.effectAllowed="move",I.dataTransfer.setData("text/plain",JSON.stringify({id:m.id,project:m.projectName})))},k=()=>{H(d,null),H(g,null)},b=(I,m)=>{!u(d)||u(d).projectName===m||(I.preventDefault(),I.dataTransfer&&(I.dataTransfer.dropEffect="move"),H(g,m,!0))},w=()=>{H(g,null)},$=(I,m)=>{var C;I.preventDefault(),H(g,null),!(!u(d)||u(d).projectName===m)&&((C=t.onMoveSession)==null||C.call(t,u(d),m),H(d,null))};var B=TT(),O=x(B),D=x(O);v(O);var N=A(O,2);Ct(N,21,()=>u(l),qt,(I,m)=>{const C=z(()=>u(g)===u(m).name);var E=IT(),R=x(E);R.__click=()=>t.onToggleProject(u(m).name);var j=x(R),ie=x(j,!0);v(j);var Y=A(j,2),ke=x(Y,!0);v(Y);var ue=A(Y,2),_e=x(ue,!0);v(ue),v(R);var st=A(R,2);{var Me=Ge=>{var De=wT(),ht=x(De);{var $t=F=>{var K=hT();S(F,K)},At=F=>{var K=fe(),G=re(K);Ct(G,17,()=>t.projectSessions.get(u(m).name)??[],qt,(de,W)=>{const Te=z(()=>{var V;return((V=t.selectedSession)==null?void 0:V.id)===u(W).id}),xe=z(()=>{var V;return((V=u(d))==null?void 0:V.id)===u(W).id}),Q=z(()=>c(u(W))),pe=z(()=>a(u(W))),Se=z(()=>o(u(W))),J=z(()=>i(u(W).projectName,u(W).id)),Ae=z(()=>{var V,te;return!((V=u(J))!=null&&V.customTitle)&&!((te=u(J))!=null&&te.currentSummary)}),Ne=z(()=>u(f).has(u(W).id)),Ce=z(()=>u(Q).summaries>0||u(Q).agents>0||u(Q).todos>0);var we=ST(),Re=x(we),We=x(Re);{var dt=V=>{var te=dT();te.__click=pt=>p(pt,u(W).id);var Ze=x(te,!0);v(te),U(()=>{Pe(te,"title",u(Ne)?"Collapse":"Expand"),P(Ze,u(Ne)?"▼":"▶")}),S(V,te)},it=V=>{var te=gT();S(V,te)};L(We,V=>{u(Ce)?V(dt):V(it,!1)})}var Ie=A(We,2);Ie.__click=()=>t.onSelectSession(u(W));var Fe=x(Ie),mt=x(Fe,!0);v(Fe);var _t=A(Fe,2),me=x(_t),Z=A(x(me)),Be=x(Z,!0);v(Z),v(me);var be=A(me,2);{var ze=V=>{var te=pT(),Ze=A(x(te)),pt=x(Ze,!0);v(Ze),v(te),U(()=>{Pe(te,"title",`${u(Q).agents??""} agent(s)`),P(pt,u(Q).agents)}),S(V,te)};L(be,V=>{u(Q).agents>0&&V(ze)})}var Ve=A(be,2);{var at=V=>{var te=mT(),Ze=A(x(te)),pt=x(Ze,!0);v(Ze),v(te),U(()=>{Pe(te,"title",`${u(Q).todos??""} todo(s)`),P(pt,u(Q).todos)}),S(V,te)};L(Ve,V=>{u(Q).todos>0&&V(at)})}v(_t),v(Ie);var St=A(Ie,2),ot=x(St),jt=x(ot);{var Fn=V=>{var te=_r();U(Ze=>P(te,Ze),[()=>u(J).currentSummary.length>50?u(J).currentSummary.slice(0,47)+"...":u(J).currentSummary]),S(V,te)},ct=V=>{var te=_r();U(()=>P(te,u(pe))),S(V,te)};L(jt,V=>{var te;(te=u(J))!=null&&te.currentSummary?V(Fn):V(ct,!1)})}v(ot);var xr=A(ot,2),Fs=x(xr);{var _a=V=>{Ua(V,{class:"p-1 rounded hover:bg-gh-green/20 text-xs",onclick:te=>t.onResumeSession(te,u(W)),title:"Resume session",children:(te,Ze)=>{Sa();var pt=_r("▶️");S(te,pt)},$$slots:{default:!0}})};L(Fs,V=>{t.onResumeSession&&V(_a)})}var Ps=A(Fs,2);Ua(Ps,{class:"p-1 rounded hover:bg-gh-border text-xs",onclick:V=>t.onRenameSession(V,u(W)),title:"Rename",children:(V,te)=>{Sa();var Ze=_r("✏️");S(V,Ze)},$$slots:{default:!0}});var gr=A(Ps,2);Ua(gr,{class:"p-1 rounded hover:bg-gh-red/20 text-xs",onclick:V=>t.onDeleteSession(V,u(W)),title:"Delete",children:(V,te)=>{Sa();var Ze=_r("🗑️");S(V,Ze)},$$slots:{default:!0}}),v(xr),v(St),v(Re);var ba=A(Re,2);{var $s=V=>{var te=xT(),Ze=x(te);{var pt=bt=>{var Le=fe(),wt=re(Le);Ct(wt,17,()=>u(J).summaries,qt,(Sr,It,Yt)=>{var Lt=bT();$e(Lt,1,`py-1.5 px-4 pl-8 hover:bg-gh-border-subtle/50 flex flex-col gap-0.5 ${Yt===0?"text-gh-text":"text-gh-text-secondary"}`);var wr=x(Lt),js=A(x(wr),2),fp=x(js,!0);v(js),v(wr);var hp=A(wr,2);{var dp=Pn=>{var ya=_T(),gp=x(ya,!0);v(ya),U(pp=>P(gp,pp),[()=>new Date(u(It).timestamp).toLocaleString()]),S(Pn,ya)};L(hp,Pn=>{u(It).timestamp&&Pn(dp)})}v(Lt),U(Pn=>{Pe(Lt,"title",u(It).summary),P(fp,Pn)},[()=>u(It).summary.length>100?u(It).summary.slice(0,97)+"...":u(It).summary]),S(Sr,Lt)}),S(bt,Le)};L(Ze,bt=>{var Le;(Le=u(J))!=null&&Le.summaries&&u(J).summaries.length>0&&bt(pt)})}var Gr=A(Ze,2);{var va=bt=>{var Le=vT(),wt=A(x(Le),2),Sr=x(wt);v(wt),v(Le),U(()=>P(Sr,`Session Todos (${u(J).todos.sessionTodos.length??""})`)),S(bt,Le)};L(Gr,bt=>{var Le,wt;(wt=(Le=u(J))==null?void 0:Le.todos)!=null&&wt.sessionTodos&&u(J).todos.sessionTodos.length>0&&bt(va)})}var ll=A(Gr,2);{var cp=bt=>{var Le=fe(),wt=re(Le);Ct(wt,17,()=>u(J).todos.agentTodos,qt,(Sr,It)=>{var Yt=yT(),Lt=A(x(Yt),2),wr=x(Lt);v(Lt),v(Yt),U(()=>P(wr,`Agent Todos (${u(It).todos.length??""})`)),S(Sr,Yt)}),S(bt,Le)};L(ll,bt=>{var Le,wt;(wt=(Le=u(J))==null?void 0:Le.todos)!=null&&wt.agentTodos&&bt(cp)})}var lp=A(ll,2);{var up=bt=>{var Le=fe(),wt=re(Le);Ct(wt,17,()=>u(J).agents,qt,(Sr,It)=>{var Yt=kT(),Lt=A(x(Yt),2),wr=x(Lt);v(Lt),v(Yt),U(js=>{Pe(Yt,"title",u(It).name??u(It).id),P(wr,`${js??""} (${u(It).messageCount??""} msgs)`)},[()=>u(It).name??u(It).id.slice(0,12)+"..."]),S(Sr,Yt)}),S(bt,Le)};L(lp,bt=>{var Le;(Le=u(J))!=null&&Le.agents&&u(J).agents.length>0&&bt(up)})}v(te),S(V,te)};L(ba,V=>{u(Ne)&&u(Ce)&&V($s)})}v(we),U(()=>{$e(we,1,`relative border-t border-gh-border-subtle group ${u(Te)?"bg-gh-accent/20 border-l-3 border-l-gh-accent":""} ${u(xe)?"opacity-50":""}`),Pe(Ie,"title",u(Se)),$e(Fe,1,`flex-1 min-w-0 overflow-hidden text-ellipsis whitespace-nowrap ${u(Ae)?"italic text-gh-text-secondary":""}`),P(mt,u(pe)),Pe(me,"title",`${u(W).messageCount??""} messages`),P(Be,u(W).messageCount),$e(St,1,`absolute left-0 right-0 top-0 h-8 flex items-center opacity-0 group-hover:opacity-100 transition-opacity pointer-events-none ${u(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"}`)}),Cr("dragstart",we,V=>_(V,u(W))),Cr("dragend",we,k),S(de,we)}),S(F,K)};L(ht,F=>{t.loadingProject===u(m).name?F($t):F(At,!1)})}v(De),S(Ge,De)};L(st,Ge=>{t.expandedProjects.has(u(m).name)&&Ge(Me)})}v(E),U((Ge,De,ht)=>{$e(R,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 ${Ge??""} ${u(C)?"bg-gh-green/20 ring-2 ring-gh-green ring-inset":""}`),P(ie,De),Pe(Y,"title",u(m).displayName),P(ke,ht),P(_e,u(m).sessionCount)},[()=>t.expandedProjects.has(u(m).name)?"bg-gh-accent/10":"",()=>t.expandedProjects.has(u(m).name)?"▼":"▶",()=>_I(u(m).displayName)]),Cr("dragover",R,Ge=>b(Ge,u(m).name)),Cr("dragleave",R,w),Cr("drop",R,Ge=>$(Ge,u(m).name)),S(I,E)}),v(N),v(B),U(()=>P(D,`Projects (${u(l).length??""})`)),S(e,B),hr(),s()}Wt(["click"]);var RT=M('<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>'),CT=M('<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 ET(e,t){fr(t,!0);let r=Ke(t,"class",3,"");const n=m=>{var R,j;if(m.type!=="user"||!m.uuid)return!1;const C=m.toolUseResult;if(C){if(typeof C=="object")return"answers"in C;if(typeof C=="string"){const ie="The user provided the following reason for the rejection:",Y=C.indexOf(ie);if(Y!==-1)return C.slice(Y+ie.length).trim().length>0}return!1}const E=((R=m.message)==null?void 0:R.content)??m.content;if(!E)return!1;if(typeof E=="string")return E.trim().length>0;if(!Array.isArray(E))return!1;for(const ie of E)if(ie.type==="text"&&((j=ie.text)!=null&&j.trim()))return!0;return!1};let s=null,i=null;const a=()=>{if(s===null||i!==t.messages){s=[];for(let m=0;m<t.messages.length;m++)n(t.messages[m])&&s.push(m);i=t.messages}return s};let o=-1,c=null;const l=()=>{if(c!==t.messages){o=-1;for(let m=t.messages.length-1;m>=0;m--)if(t.messages[m].isCompactSummary){o=m;break}c=t.messages}},f=()=>(l(),o),p=()=>(l(),o>=0);let d=tt(!1);en(()=>{t.messages.length,H(d,p(),!0)});let g=tt(0);const _=()=>{if(!t.scrollContainer)return 0;const m=t.scrollContainer.getBoundingClientRect(),C=t.scrollContainer.querySelectorAll("[data-msg-id]");for(let E=0;E<C.length;E++){const R=C[E];if(R.getBoundingClientRect().top>=m.top-50){const ie=R.getAttribute("data-msg-id"),Y=t.messages.findIndex(ke=>(ke.uuid??`idx-${t.messages.indexOf(ke)}`)===ie);return Y>=0?Y:E}}return 0},k=m=>{if(!t.scrollContainer||m<0||m>=t.messages.length)return;const C=t.messages[m].uuid??`idx-${m}`,E=t.scrollContainer.querySelector(`[data-msg-id="${C}"]`);E&&(E.scrollIntoView({behavior:"smooth",block:"start"}),H(g,m,!0))},b=()=>{var m;(m=t.scrollContainer)==null||m.scrollTo({top:0,behavior:"smooth"}),H(g,0)},w=()=>{t.scrollContainer&&(t.scrollContainer.scrollTo({top:t.scrollContainer.scrollHeight+1e4,behavior:"smooth"}),H(g,t.messages.length-1))},$=()=>{const m=f();m>=0&&k(m)},B=()=>{const m=_(),C=a();for(let E=C.length-1;E>=0;E--)if(C[E]<m){k(C[E]);return}b()},O=()=>{const m=_(),C=a();for(const E of C)if(E>m){k(E);return}w()};var D=fe(),N=re(D);{var I=m=>{var C=CT(),E=x(C);$e(E,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"),E.__click=b;var R=A(E,2);$e(R,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"),R.__click=B;var j=A(R,2);{var ie=ue=>{var _e=RT();$e(_e,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"),_e.__click=$,S(ue,_e)};L(j,ue=>{u(d)&&ue(ie)})}var Y=A(j,2);$e(Y,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"),Y.__click=O;var ke=A(Y,2);$e(ke,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"),ke.__click=w,v(C),U(()=>$e(C,1,`flex gap-0.5 ${r()??""}`,"svelte-12kovyu")),S(m,C)};L(N,m=>{t.messages.length>0&&m(I)})}S(e,D),hr()}Wt(["click"]);var OT=M('<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>'),MT=M(`<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),AT=M('<h2 class="text-base font-semibold">Messages</h2>'),NT=M('<button>🤖 <span class="hidden md:inline"> </span><span class="md:hidden"> </span> </button>'),FT=M("<button> </button>"),PT=M('<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>'),$T=M('<div class="flex items-center justify-center h-full text-gh-text-secondary">Select a session to view</div>'),jT=M('<div class="flex items-center justify-center h-full text-gh-text-secondary">No messages</div>'),LT=M('<div class="p-4 flex flex-col gap-4"></div>'),DT=M('<div class="text-gh-text-secondary text-center py-8">No todos</div>'),BT=M('<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>'),UT=M('<ul class="space-y-2"></ul>'),qT=M('<div class="p-4"><!></div>'),zT=M('<div class="flex items-center justify-center h-full text-gh-text-secondary">Loading agent messages...</div>'),VT=M('<div class="flex items-center justify-center h-full text-gh-text-secondary">No messages</div>'),HT=M('<div class="p-4 flex flex-col gap-4"></div>'),KT=M(`<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>`),JT=M('<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 kR(e,t){fr(t,!0);let r=Ke(t,"todos",19,()=>[]),n=Ke(t,"agents",19,()=>[]),s=Ke(t,"enableScroll",3,!0),i=Ke(t,"externalScrollContainer",3,null),a=Ke(t,"fullWidth",3,!1);const o=z(()=>{var F;return R2(t.customTitle,t.currentSummary,(F=t.session)==null?void 0:F.title,50)});let c=tt("messages"),l=tt(fi([])),f=tt(!1),p=tt(fi([])),d=tt(0),g=tt(null);en(()=>{if(u(d)<=0)return;const F=setInterval(()=>{H(d,Math.max(0,u(d)-1),!0),u(d)===0&&H(p,[],!0)},1e3);return()=>clearInterval(F)}),en(()=>{var F;(F=t.session)==null||F.id,H(c,"messages"),H(l,[],!0)});const _=z(()=>u(c).startsWith("agent:")?u(c).slice(6):null);en(()=>{u(_)&&t.session&&(H(f,!0),Tm(t.session.projectName,t.session.id,u(_)).then(F=>{H(l,F,!0)}).catch(F=>{console.error("Failed to load agent messages:",F),H(l,[],!0)}).finally(()=>{H(f,!1)}))});const k=async()=>{var K;if(u(g)&&clearTimeout(u(g)),!t.session||u(p).length===0)return;const F=[...u(p)].reverse();for(const G of F)try{if(await wm(t.session.projectName,G.sessionId,G.msg,G.index),G.isAgent){const de=[...u(l)];de.splice(G.index,0,G.msg),H(l,de,!0)}else{const de=[...t.messages];de.splice(G.index,0,G.msg),(K=t.onMessagesChange)==null||K.call(t,de)}}catch(de){console.error("Failed to restore message:",de)}H(p,[],!0),H(d,0),H(g,null)},b=async(F,K)=>{var Te,xe;if(!t.session)return;const G=F.uuid||F.messageId||F.leafUuid;if(!G)return;const de=K&&u(_)?u(_):t.session.id;let W;if(K){if(W=u(l).findIndex(Q=>(Q.uuid||Q.messageId||Q.leafUuid)===G),W===-1)return}else if(W=t.messages.findIndex(Q=>(Q.uuid||Q.messageId||Q.leafUuid)===G),W===-1)return;try{if(await Sm(t.session.projectName,de,G),K)H(l,u(l).filter(Q=>(Q.uuid||Q.messageId||Q.leafUuid)!==G),!0);else{const Q=t.messages.filter(pe=>(pe.uuid||pe.messageId||pe.leafUuid)!==G);(Te=t.onMessagesChange)==null||Te.call(t,Q)}H(p,[...u(p),{msg:F,index:W,isAgent:K,sessionId:de}],!0),u(g)&&clearTimeout(u(g)),H(d,10),H(g,setTimeout(()=>{H(p,[],!0),H(d,0),H(g,null)},1e4),!0),(xe=t.onDeleteMessage)==null||xe.call(t,F)}catch(Q){console.error("Failed to delete message:",Q)}},w=F=>{b(F,!0)},$=F=>{b(F,!1)},B=async()=>{if(!t.session)return;const F=`~/.claude/projects/${t.session.projectName}/${t.session.id}.jsonl`;try{await Ho(F)}catch(K){console.error("Failed to open file:",K)}},O=z(()=>t.messages.findIndex(F=>F.type==="user"||F.type==="assistant"||F.type==="human"));let D=tt(void 0);const N=z(()=>i()??u(D));var I=JT(),m=x(I),C=x(m);{var E=F=>{var K=OT();U(()=>Pe(K,"href",t.backUrl)),S(F,K)};L(C,F=>{t.backUrl&&F(E)})}var R=A(C,2),j=x(R);{var ie=F=>{var K=MT(),G=re(K),de=x(G,!0);v(G);var W=A(G,2);W.__click=B;var Te=x(W,!0);v(W),U(xe=>{P(de,xe),P(Te,t.session.id)},[()=>mI(u(o),50)]),S(F,K)},Y=F=>{var K=AT();S(F,K)};L(j,F=>{t.session?F(ie):F(Y,!1)})}v(R);var ke=A(R,2);{var ue=F=>{ET(F,{get messages(){return t.messages},get scrollContainer(){return u(N)}})};L(ke,F=>{u(c)!=="todos"&&F(ue)})}v(m);var _e=A(m,2);{var st=F=>{var K=PT(),G=x(K),de=x(G);de.__click=()=>H(c,"messages");var W=x(de);v(de);var Te=A(de,2);Ct(Te,17,n,qt,(pe,Se)=>{var J=NT();J.__click=()=>H(c,`agent:${u(Se).id}`);var Ae=A(x(J)),Ne=x(Ae,!0);v(Ae);var Ce=A(Ae),we=x(Ce,!0);v(Ce);var Re=A(Ce);v(J),U(We=>{$e(J,1,`px-4 py-2 text-sm font-medium transition-colors whitespace-nowrap ${u(c)===`agent:${u(Se).id}`?"text-gh-accent border-b-2 border-gh-accent":"text-gh-text-secondary hover:text-gh-text hover:bg-gh-border-subtle"}`),P(Ne,u(Se).id),P(we,We),P(Re,` (${u(Se).messageCount??""})`)},[()=>u(Se).id.replace("agent-","")]),S(pe,J)}),v(G);var xe=A(G,2);{var Q=pe=>{var Se=FT();Se.__click=()=>H(c,"todos");var J=x(Se);v(Se),U(()=>{$e(Se,1,`px-4 py-2 text-sm font-medium transition-colors whitespace-nowrap ${u(c)==="todos"?"text-gh-accent border-b-2 border-gh-accent":"text-gh-text-secondary hover:text-gh-text hover:bg-gh-border-subtle"}`),P(J,`✅ Todos (${r().length??""})`)}),S(pe,Se)};L(xe,pe=>{r().length>0&&pe(Q)})}v(K),U(()=>{$e(de,1,`px-4 py-2 text-sm font-medium transition-colors whitespace-nowrap ${u(c)==="messages"?"text-gh-accent border-b-2 border-gh-accent":"text-gh-text-secondary hover:text-gh-text hover:bg-gh-border-subtle"}`),P(W,`💬 Messages (${t.messages.length??""})`)}),S(F,K)};L(_e,F=>{t.session&&F(st)})}var Me=A(_e,2),Ge=x(Me);{var De=F=>{var K=$T();S(F,K)},ht=F=>{var K=fe(),G=re(K);{var de=Te=>{var xe=fe(),Q=re(xe);{var pe=J=>{var Ae=jT();S(J,Ae)},Se=J=>{var Ae=LT();Ct(Ae,23,()=>t.messages,(Ne,Ce)=>Ne.uuid??`idx-${Ce}`,(Ne,Ce,we)=>{{let Re=z(()=>{var dt;return((dt=t.session)==null?void 0:dt.id)??""}),We=z(()=>u(we)===u(O));$u(Ne,{get msg(){return u(Ce)},get sessionId(){return u(Re)},onDelete:$,get onEditTitle(){return t.onEditTitle},get onSplit(){return t.onSplitSession},get isFirst(){return u(We)}})}}),v(Ae),S(J,Ae)};L(Q,J=>{t.messages.length===0?J(pe):J(Se,!1)})}S(Te,xe)},W=Te=>{var xe=fe(),Q=re(xe);{var pe=J=>{var Ae=qT(),Ne=x(Ae);{var Ce=Re=>{var We=DT();S(Re,We)},we=Re=>{var We=UT();Ct(We,21,r,qt,(dt,it)=>{var Ie=BT(),Fe=x(Ie),mt=x(Fe);{var _t=be=>{var ze=_r("✅");S(be,ze)},me=be=>{var ze=fe(),Ve=re(ze);{var at=ot=>{var jt=_r("🔄");S(ot,jt)},St=ot=>{var jt=_r("⬜");S(ot,jt)};L(Ve,ot=>{u(it).status==="in_progress"?ot(at):ot(St,!1)},!0)}S(be,ze)};L(mt,be=>{u(it).status==="completed"?be(_t):be(me,!1)})}v(Fe);var Z=A(Fe,2),Be=x(Z,!0);v(Z),v(Ie),U(()=>{$e(Z,1,zo(u(it).status==="completed"?"text-gh-text-secondary line-through":"")),P(Be,u(it).content)}),S(dt,Ie)}),v(We),S(Re,We)};L(Ne,Re=>{r().length===0?Re(Ce):Re(we,!1)})}v(Ae),S(J,Ae)},Se=J=>{var Ae=fe(),Ne=re(Ae);{var Ce=we=>{var Re=fe(),We=re(Re);{var dt=Ie=>{var Fe=zT();S(Ie,Fe)},it=Ie=>{var Fe=fe(),mt=re(Fe);{var _t=Z=>{var Be=VT();S(Z,Be)},me=Z=>{var Be=HT();Ct(Be,23,()=>u(l),be=>be.uuid,(be,ze,Ve)=>{{let at=z(()=>u(Ve)===0);$u(be,{get msg(){return u(ze)},get sessionId(){return u(_)},onDelete:w,get isFirst(){return u(at)}})}}),v(Be),S(Z,Be)};L(mt,Z=>{u(l).length===0?Z(_t):Z(me,!1)},!0)}S(Ie,Fe)};L(We,Ie=>{u(f)?Ie(dt):Ie(it,!1)})}S(we,Re)};L(Ne,we=>{u(_)&&we(Ce)},!0)}S(J,Ae)};L(Q,J=>{u(c)==="todos"?J(pe):J(Se,!1)},!0)}S(Te,xe)};L(G,Te=>{u(c)==="messages"?Te(de):Te(W,!1)},!0)}S(F,K)};L(Ge,F=>{t.session?F(ht,!1):F(De)})}v(Me),qo(Me,F=>H(D,F),()=>u(D));var $t=A(Me,2);{var At=F=>{var K=KT(),G=x(K),de=x(G,!0);v(G);var W=A(G,2),Te=x(W);v(W);var xe=A(W,2);xe.__click=k;var Q=A(xe,2);Q.__click=()=>{u(g)&&clearTimeout(u(g)),H(p,[],!0),H(d,0)},v(K),U(()=>{P(de,u(p).length===1?"Message deleted":`${u(p).length} messages deleted`),P(Te,`${u(d)??""}s`)}),S(F,K)};L($t,F=>{u(p).length>0&&F(At)})}v(I),U(()=>{$e(I,1,`bg-gh-bg-secondary overflow-hidden flex flex-col h-full ${a()?"":"border border-gh-border rounded-lg"}`),$e(Me,1,`flex-1 ${s()?"overflow-y-auto":""}`)}),S(e,I),hr()}Wt(["click"]);var GT=M('<div><span> </span> <button class="text-white/70 hover:text-white transition-colors" title="Dismiss">✕</button></div>');function xR(e,t){fr(t,!0);let r=Ke(t,"message",15),n=Ke(t,"variant",3,"success"),s=Ke(t,"duration",3,3e3),i=null;const a={success:"bg-gh-green/90",error:"bg-gh-red/90",info:"bg-gh-accent/90",warning:"bg-yellow-600/90"};en(()=>{r()&&(i&&clearTimeout(i),i=setTimeout(()=>r(null),s()))}),nm(()=>{i&&clearTimeout(i)});var o=fe(),c=re(o);{var l=f=>{var p=GT(),d=x(p),g=x(d,!0);v(d);var _=A(d,2);_.__click=()=>r(null),v(p),U(()=>{$e(p,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 ${a[n()]??""}`,"svelte-1cpok13"),P(g,r())}),S(f,p)};L(c,f=>{r()&&f(l)})}S(e,o),hr()}Wt(["click"]);export{qt as A,bR as C,vR as I,yR as P,kR as S,xR as T,nR as a,pR as b,sR as c,Sm as d,gR as e,iR as f,R2 as g,rR as h,hm as i,dR as j,lR as k,tR as l,hR as m,Yc as n,uR as o,oR as p,zf as q,mR as r,fR as s,Pe as t,aR as u,XT as v,$e as w,eR as x,cR as y,Ct as z};
|