@ycodium-ai/plugin-team 0.2.3250 → 0.2.3254

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/assets/ui.js CHANGED
@@ -290,7 +290,7 @@ ${n(d)}}`;f=i(l,p)}}return r.delete(l),f}return String(l)}return u(e,0)}var Ku="
290
290
  `);a.splice(1,3),t.stack=a.join(`
291
291
  `)}return t};var $t=Lc;var On="~effect/time/Duration",Og=BigInt(0),Mg=BigInt(1);var Fg=BigInt(1e3);var Mn=e=>BigInt(e<0?Math.ceil(e-.5):Math.floor(e+.5)),Bc=e=>Mn(e*1e6),Ac=(e,t)=>e.includes(".")?Mn(Number(e)*Number(t)):BigInt(e)*t;var Bg=/^(-?\d+(?:\.\d+)?)\s+(nanos?|micros?|millis?|seconds?|minutes?|hours?|days?|weeks?)$/,Oi=e=>{switch(typeof e){case"number":return Mc(e);case"bigint":return Dn(e);case"string":{if(e==="Infinity")return Di;if(e==="-Infinity")return Oc;let t=Bg.exec(e);if(!t)break;let[a,r,o]=t;if(o==="nano"||o==="nanos")return Dn(Ac(r,Mg));if(o==="micro"||o==="micros")return Dn(Ac(r,Fg));let n=Number(r);switch(o){case"milli":case"millis":return Mc(n);case"second":case"seconds":return Gg(n);case"minute":case"minutes":return $g(n);case"hour":case"hours":return Wg(n);case"day":case"days":return jg(n);case"week":case"weeks":return zg(n)}break}case"object":{if(e===null)break;if(On in e)return e;if(Array.isArray(e))return e.length!==2||!e.every(pn)?Rc(e):Number.isNaN(e[0])||Number.isNaN(e[1])?Hg:e[0]===-1/0||e[1]===-1/0?Oc:e[0]===1/0||e[1]===1/0?Di:ct(Mn(e[0]*1e9+e[1]));let t=e,a=0;return t.weeks&&(a+=t.weeks*6048e5),t.days&&(a+=t.days*864e5),t.hours&&(a+=t.hours*36e5),t.minutes&&(a+=t.minutes*6e4),t.seconds&&(a+=t.seconds*1e3),t.milliseconds&&(a+=t.milliseconds),!t.microseconds&&!t.nanoseconds?ct(a):ct(Mn(a*1e6+(t.microseconds??0)*1e3+(t.nanoseconds??0)))}}return Rc(e)},Rc=e=>{throw new Error(`Invalid Input: ${e}`)};var Dc={_tag:"Millis",millis:0},Ug={_tag:"Infinity"},Ng={_tag:"NegativeInfinity"},_g={[On]:On,[de](){return ai(this.value)},[fe](e){return qg(e)&&Zg(this,e)},toString(){switch(this.value._tag){case"Infinity":return"Infinity";case"NegativeInfinity":return"-Infinity";case"Nanos":return`${this.value.nanos} nanos`;case"Millis":return`${this.value.millis} millis`}},toJSON(){switch(this.value._tag){case"Millis":return{_id:"Duration",_tag:"Millis",millis:this.value.millis};case"Nanos":return{_id:"Duration",_tag:"Nanos",nanos:String(this.value.nanos)};case"Infinity":return{_id:"Duration",_tag:"Infinity"};case"NegativeInfinity":return{_id:"Duration",_tag:"NegativeInfinity"}}},[Et](){return this.toJSON()},pipe(){return We(this,arguments)}},ct=e=>{let t=Object.create(_g);return typeof e=="number"?isNaN(e)||e===0||Object.is(e,-0)?t.value=Dc:Number.isFinite(e)?Number.isInteger(e)?t.value={_tag:"Millis",millis:e}:t.value={_tag:"Nanos",nanos:Bc(e)}:t.value=e>0?Ug:Ng:e===Og?t.value=Dc:t.value={_tag:"Nanos",nanos:e},t},qg=e=>X(e,On);var Hg=ct(0),Di=ct(1/0),Oc=ct(-1/0),Dn=e=>ct(e);var Mc=e=>ct(e),Gg=e=>ct(e*1e3),$g=e=>ct(e*6e4),Wg=e=>ct(e*36e5),jg=e=>ct(e*864e5),zg=e=>ct(e*6048e5),Uc=e=>Kg(Oi(e),{onMillis:_e,onNanos:t=>Number(t)/1e6,onInfinity:()=>1/0,onNegativeInfinity:()=>-1/0});var Fc=e=>{let t=Oi(e);switch(t.value._tag){case"Infinity":case"NegativeInfinity":throw new Error("Cannot convert infinite duration to nanos");case"Nanos":return t.value.nanos;case"Millis":return Bc(t.value.millis)}};var Kg=V(2,(e,t)=>{switch(e.value._tag){case"Millis":return t.onMillis(e.value.millis);case"Nanos":return t.onNanos(e.value.nanos);case"Infinity":return t.onInfinity();case"NegativeInfinity":return(t.onNegativeInfinity??t.onInfinity)()}}),Vg=V(3,(e,t,a)=>e.value._tag==="Infinity"||e.value._tag==="NegativeInfinity"||t.value._tag==="Infinity"||t.value._tag==="NegativeInfinity"?a.onInfinity(e,t):e.value._tag==="Millis"?t.value._tag==="Millis"?a.onMillis(e.value.millis,t.value.millis):a.onNanos(Fc(e),t.value.nanos):a.onNanos(e.value.nanos,Fc(t)));var Jg=(e,t)=>Vg(e,t,{onMillis:(a,r)=>a===r,onNanos:(a,r)=>a===r,onInfinity:(a,r)=>a.value._tag===r.value._tag});var Zg=V(2,(e,t)=>Jg(e,t));var Bi=$t("effect/Scheduler",{fiberCached:!0,defaultValue:()=>new fo}),Nc="setImmediate"in globalThis?e=>{let t=globalThis.setImmediate(e);return()=>globalThis.clearImmediate(t)}:e=>{let t=setTimeout(e,0);return()=>clearTimeout(t)},Yg=e=>{let t=!1;return queueMicrotask(()=>{t||e()}),()=>{t=!0}},Mi=class{buckets=[];scheduleTask(t,a){let r=this.buckets,o=r.length,n,i=0;for(;i<o&&!(r[i][0]>a);i++)n=r[i];n&&n[0]===a?n[1].push(t):i===o?r.push([a,[t]]):r.splice(i,0,[a,[t]])}drain(){let t=this.buckets;return this.buckets=[],t}},fo=class{executionMode;setImmediate;constructor(t="async",a){this.executionMode=t,this.setImmediate=a??(t==="sync"?Yg:Nc)}shouldYield(t){return t.currentOpCount>=t.maxOpsBeforeYield}makeDispatcher(){return new Fi(this.setImmediate)}},Fi=class{tasks=new Mi;running=void 0;setImmediate;constructor(t=Nc){this.setImmediate=t}scheduleTask(t,a){this.tasks.scheduleTask(t,a),this.running===void 0&&(this.running=this.setImmediate(this.afterScheduled))}afterScheduled=()=>{this.running=void 0,this.runTasks()};runTasks(){let t=this.tasks.drain();for(let a=0;a<t.length;a++){let r=t[a][1];for(let o=0;o<r.length;o++)r[o]()}}flush(){for(;this.tasks.buckets.length>0;)this.running!==void 0&&(this.running(),this.running=void 0),this.runTasks()}},_c=$t("effect/Scheduler/MaxOpsBeforeYield",{fiberCached:!0,defaultValue:()=>2048}),qc=$t("effect/Scheduler/PreventSchedulerYield",{fiberCached:!0,defaultValue:()=>!1});var Hc="effect/Tracer/ParentSpan";var Gc="effect/Tracer";var $c="effect/observability/Metric/FiberRuntimeMetricsKey";var Wc=$t("effect/References/CurrentStackFrame",{fiberCached:!0,defaultValue:dr});var jc=$t("effect/References/CurrentLogLevel",{fiberCached:!0,defaultValue:()=>"Info"}),zc=$t("effect/References/MinimumLogLevel",{fiberCached:!0,defaultValue:()=>"Info"});var Ni=class extends mr{fiberId;constructor(t,a=ro){super("Interrupt",a,"Interrupted"),this.fiberId=t}toString(){return`Interrupt(${this.fiberId})`}toJSON(){return{_tag:"Interrupt",fiberId:this.fiberId}}[fe](t){return Tn(t)&&this.fiberId===t.fiberId&&this.annotations===t.annotations}[de](){return qe(ge(`${this._tag}:${this.fiberId}`))(hn(this.annotations))}};var Yc=e=>new ta([new Ni(e)]);var Vi=e=>{for(let t=0;t<e.reasons.length;t++){let a=e.reasons[t];if(a._tag==="Fail")return uo(a.error)}return Wa(e)};var Qc=e=>e.reasons.some(Tn);var ed=V(2,(e,t)=>{if(e.reasons.length===0)return t;if(t.reasons.length===0)return e;let a=new ta(gc(e.reasons,t.reasons));return Ce(e,a)?e:a}),td=V(2,(e,t)=>{let a=!1,r=e.reasons.map(o=>so(o)?(a=!0,new hr(t(o.error),o.annotations)):o);return a?oo(r):e});var Kc="~effect/Fiber",sx={_A:_e,_E:_e},ix={id:0},lx=()=>globalThis[fr],Fn=class{constructor(t,a=!0){this[Kc]=sx,this.setContext(t),this.id=++ix.id,this.currentOpCount=0,this.interruptible=a,this._stack=[],this._observers=[],this._exit=void 0,this._children=void 0,this._interruptedCause=void 0,this._yielded=void 0,this._running=!1,this._deferredInterrupt=!1,this.runtimeMetrics?.recordFiberStart(this.context)}[Kc];id;interruptible;currentOpCount;_stack;_observers;_exit;_children;_interruptedCause;_yielded;_running;_deferredInterrupt;context;currentScheduler;currentTracerContext;currentSpan;currentLogLevel;minimumLogLevel;currentStackFrame;runtimeMetrics;maxOpsBeforeYield;currentPreventYield;_dispatcher=void 0;get currentDispatcher(){return this._dispatcher??=this.currentScheduler.makeDispatcher()}getRef(t){return co(this.context,t)}addObserver(t){return this._exit?(t(this._exit),Js):(this._observers.push(t),()=>{let a=this._observers.indexOf(t);a>=0&&this._observers.splice(a,1)})}interruptUnsafe(t,a){if(this._exit)return;let r=Yc(t);this.currentStackFrame&&(r=no(r,Ai(di,this.currentStackFrame))),a&&(r=no(r,a)),this._interruptedCause=this._interruptedCause?ed(this._interruptedCause,r):r,this.interruptible&&(this._running?this._deferredInterrupt=!0:this.evaluate(Wt(this._interruptedCause)))}pollUnsafe(){return this._exit}evaluate(t){if(this._exit)return;if(this._yielded!==void 0){let n=this._yielded;this._yielded=void 0,n()}let a=this.runLoop(t);if(a===Ha)return;let r=Vc.interruptChildren&&Vc.interruptChildren(this);if(r!==void 0)return this.evaluate(ft(r,()=>a));this._exit=a,this.runtimeMetrics?.recordFiberEnd(this.context,this._exit);let o=this._observers.splice(0);for(let n=0;n<o.length;n++)o[n](a);this._stack.length=0,this._children=void 0,this.context=Pi()}runLoop(t){let a=globalThis[fr];globalThis[fr]=this;let r=this._running;this._running=!0;let o=!1,n=t;this.currentOpCount=0;try{for(;;){if(this._deferredInterrupt&&(this._deferredInterrupt=!1,n=Wt(this._interruptedCause)),this.currentOpCount++,!o&&!this.currentPreventYield&&this.currentScheduler.shouldYield(this)){o=!0;let i=n;n=ft(Ji,()=>i)}if(n=this.currentTracerContext?this.currentTracerContext(n,this):n[Le](this),n===Ha){let i=this._yielded;if(_a in i)return this._deferredInterrupt=!1,this._yielded=void 0,i;if(this._deferredInterrupt){this._yielded=void 0,i();continue}return Ha}}}catch(i){return X(n,Le)?this.runLoop(Ia(i)):Ia(`Fiber.runLoop: Not a valid effect: ${String(n)}`)}finally{this._running=r,globalThis[fr]=a}}getCont(t){if(this._deferredInterrupt)return this._deferredInterrupt=!1,ux;for(;;){let a=this._stack.pop();if(!a)return;let r=a[Sa]&&a[Sa](this);if(r)return r[t]=r,r;if(a[t])return a}}yieldWith(t){return this._yielded=t,Ha}children(){return this._children??=new Set}pipe(){return We(this,arguments)}setContext(t){let a=this.context;if(this.context=t,a!==void 0&&kc(a,t))return;let r=this.getRef(Bi);r!==this.currentScheduler&&(this.currentScheduler=r,this._dispatcher=void 0),this.currentSpan=Rn(t,Hc),this.currentLogLevel=this.getRef(jc),this.minimumLogLevel=this.getRef(zc),this.currentStackFrame=this.getRef(Wc),this.maxOpsBeforeYield=this.getRef(_c),this.currentPreventYield=this.getRef(qc),this.runtimeMetrics=Rn(t,$c);let o=Rn(t,Gc);this.currentTracerContext=o?o.context:void 0}get currentSpanLocal(){return this.currentSpan?._tag==="Span"?this.currentSpan:void 0}},ux={[tt](e,t){return Wt(t._interruptedCause)},[Pt](e,t){return Wt(t._interruptedCause)}},Vc={interruptChildren:void 0},ad=e=>{if(!e.currentStackFrame)return;let t=new Map;return t.set(ac.key,e.currentStackFrame),An(t)};var cx=e=>mo(t=>{let a=e[Symbol.iterator](),r=[],o;function n(){let i=a.next();for(;!i.done;){if(i.value._exit){r.push(i.value._exit),i=a.next();continue}o=i.value.addObserver(s=>{r.push(s),n()});return}t(dt(r))}return n(),Ir(()=>o?.())});var Jc=e=>$a(t=>{let a=ad(t),r=Pn();for(let o of e)o.interruptUnsafe(t.id,a),r.push(o);return fd(cx(r))});var dt=ut,Wt=At,Lr=gr,Ir=yt({op:"Sync",[Le](e){let t=this[U](),a=e.getCont(tt);return a?a[tt](t,e):e.yieldWith(ut(t))}}),za=yt({op:"Suspend",[Le](e){return this[U]()}});var rd=kn({onFailure:Lr,onSuccess:dt});var od=yt({op:"Yield",[Le](e){let t=!1;return e.currentDispatcher.scheduleTask(()=>{t||e.evaluate(oa)},this[U]??0),e.yieldWith(()=>{t=!0})}}),Ji=od(0);var nd=dt(Gt());var sd=e=>za(()=>Wt(Ht(e))),Zi=e=>Ia(e),id=e=>za(()=>Lr(Ht(e))),yr=dt(void 0);var Xi=e=>{let t=typeof e=="function"?e:e.try,a=typeof e=="function"?r=>new po(r,"An error occurred in Effect.try"):e.catch;return za(()=>{try{return dt(Ht(t))}catch(r){return Lr(Ht(()=>a(r)))}})};var ld=e=>{let t=typeof e=="function"?e:e.try,a=typeof e=="function"?r=>new po(r,"An error occurred in Effect.tryPromise"):e.catch;return ud(function(r,o){let n=i=>{try{r(Lr(Ht(()=>a(i))))}catch(s){r(Zi(s))}};try{Ht(()=>t(o)).then(i=>r(dt(i)),n)}catch(i){n(i)}},t.length!==0)};var ud=yt({op:"Async",single:!1,[Le](e){let t=Ht(()=>this[U][0].bind(e.currentScheduler)),a=!1,r=!1,o=this[U][1]?new AbortController:void 0,n=t(i=>{a||(a=!0,r?e.evaluate(i):r=i)},o?.signal);return r!==!1?r:(r=!0,e._yielded=()=>{a=!0},o===void 0&&n===void 0?Ha:(e._stack.push(dx(()=>(a=!0,o?.abort(),n??oa))),Ha))}}),dx=yt({op:"AsyncFinalizer",[Sa](e){e.interruptible&&(e.interruptible=!1,e._stack.push(el))},[Pt](e,t){return Qc(e)?ft(this[U](),()=>Wt(e)):Wt(e)}}),mo=e=>ud(e,e.length>=2),cd=mo(Js);var fx=(e,t)=>Object.defineProperty(t,"length",{value:e,configurable:!0});var dd=(e,...t)=>fx(e.length,t.length===0?function(){return Zc(()=>e.apply(this,arguments))}:function(){let a=Zc(()=>e.apply(this,arguments));for(let r of t)a=r(a);return a}),Zc=e=>{try{let t=e(),a;for(;;){let r=t.next(a);if(r.done)return dt(r.value);let o=r.value;if(o&&o._tag==="Success"){a=o.value;continue}else{if(o&&o._tag==="Failure")return r.value;{let n=!0;return za(()=>n?(n=!1,ft(r.value,i=>Xc(t,i))):za(()=>Xc(e())))}}}}catch(t){return Zi(t)}},Xc=yt({op:"Iterator",single:!1,[tt](e,t){let a=this[U][0];for(;;){let r=a.next(e);if(r.done)return dt(r.value);if(ke(r.value)){if(r.value._tag==="Failure")return r.value}else return t._stack.push(this),r.value;e=r.value.value}},[Le](e){return this[tt](this[U][1],e)}});var fd=e=>ft(e,t=>oa);var ft=V(2,(e,t)=>{let a=Object.create(px);return a[U]=e,a[tt]=t.length!==1?r=>t(r):t,a}),px=aa({op:"OnSuccess",[Le](e){return e._stack.push(this),this[U]}});var ke=e=>_a in e,pd=V(2,(e,t)=>ke(e)?e._tag==="Success"?t(e.value):e:ft(e,t));var ho=V(2,(e,t)=>ft(e,a=>dt(Ht(()=>t(a))))),md=V(2,(e,t)=>ke(e)?xd(e,t):ho(e,t)),hd=V(2,(e,t)=>ke(e)?Sd(e,t):Ld(e,t));var gd=e=>e._tag==="Success";var oa=ut(void 0),xd=V(2,(e,t)=>e._tag==="Success"?ut(t(e.value)):e),Sd=V(2,(e,t)=>{if(e._tag==="Success")return e;let a=Vi(e.cause);return vn(a)?e:gr(t(a.success))});var Yi=V(2,(e,t)=>{let a=Object.create(mx);return a[U]=e,a[Pt]=t.length!==1?r=>t(r):t,a}),mx=aa({op:"OnFailure",[Le](e){return e._stack.push(this),this[U]}});var Id=V(3,(e,t,a)=>Yi(e,r=>{let o=t(r);return vn(o)?Wt(o.failure):Ht(()=>a(o.success,r))})),yd=V(2,(e,t)=>Id(e,Vi,a=>t(a)));var Ld=V(2,(e,t)=>yd(e,a=>id(()=>t(a))));var Eb=aa({op:"OnSuccessAndFailure",[Le](e){return e._stack.push(this),this[U]}});var Qi=e=>ke(e)?ut(e):hx(e),hx=yt({op:"Exit",[Le](e){return e._stack.push(this),this[U]},[tt](e,t,a){return dt(a??ut(e))},[Pt](e,t,a){return dt(a??At(e))}});var gx=yt({op:"OnExit",single:!1,[Le](e){return e._stack.push(this),this[U][0]},[Sa](e){e.interruptible&&this[U][2]!==!0&&(e._stack.push(el),e.interruptible=!1)},[tt](e,t,a){a??=ut(e);let r=this[U][1](a);return r?ft(r,o=>a):a},[Pt](e,t,a){a??=At(e);let r=this[U][1](a);return r?ft(r,o=>a):a}});var bd=e=>$a(t=>(t.interruptible&&(t.interruptible=!1,t._stack.push(el)),e)),xx=yt({op:"SetInterruptible",[Sa](e){if(e.interruptible=this[U],e._interruptedCause&&e.interruptible)return()=>Wt(e._interruptedCause)}}),el=xx(!0);var Sx=yt({op:"While",[tt](e,t){return this[U].step(e),this[U].while()?(t._stack.push(this),this[U].body()):oa},[Le](e){return this[U].while()?(e._stack.push(this),this[U].body()):oa}});var Ix=e=>{let t=e.onItem,a=e.step,r=(o,n,i,s)=>{for(;i<s;i++){let u=n[i],l=t(o,u,i);if(!ke(l))return ft(Qi(l),f=>a(o,u,f,i)??r(o,n,i+1,s)??yr);let d=a(o,u,l,i);if(d)return d._tag==="Failure"?d:void 0}};return(o,n,i)=>{let s=0,u=i?.end??n.length,l=i?.concurrency??1;if(l===1)return r(o,n,0,u);let d=i?.orderedStep===!0&&l>1,f=!1,m,p,h,x=!1,g,y,T=s,E=d?new Array(u):void 0,A=C=>{let b=Ia(C);return g=b,f=!0,x=!0,p&&p.size>0?ft(bd(Jc(Array.from(p))),()=>b):b},_=(C,b,P)=>{if(!d)return a(o,C,b,P);if(g)return g;for(E[P]=b;T<u;){let L=E[T];if(L===void 0)return;E[T]=void 0;let R=T++,M=a(o,n[R],L,R);if(M)return M}},N=()=>{let C=!1;for(;!g&&s<u;s++){let b=n[s],P=y??t(o,b,s);if(ke(P)){if(g=_(b,P,s),g)break}else if(m){y=void 0;let L=yx(m,P,!0,!0,"inherit");if(L._exit){if(g=_(b,L._exit,s),g)break;continue}p.add(L);let R=s;if(L.addObserver(M=>{p.delete(L);try{if(g){if(!x&&M._tag==="Failure")for(let F of M.cause.reasons)F._tag!=="Interrupt"&&(g._tag==="Failure"?g.cause.reasons.push(F):g=At(oo([F])))}else{let F=_(b,M,R);F&&(g=F._tag==="Failure"?At(oo(F.cause.reasons.slice())):F,N())}if(C){let F=N();F&&h(F)}else f&&p.size===0&&h(g??yr)}catch(F){h(A(F))}}),p.size<l)continue;C=!0,s++;return}else return mo(L=>{m=lx(),p=new Set,y=P,h=L;let R;try{R=N()}catch(M){return L(A(M))}return R?L(R):za(()=>(g=oa,x=!0,p?Jc(p):yr))})}if(f=!0,g){if(p&&p.size>0){let b=ad(m);p.forEach(P=>P.interruptUnsafe(m.id,b));return}if(h||g._tag==="Failure")return g}else if(h)if(p)p.size===0&&h(yr);else return oa};return N()}},go=()=>Ix;var yx=(e,t,a=!1,r=!1,o=!1)=>{let n=e,i=o==="inherit"?n.interruptible:!o,s=new Fn(n.context,i);return a?s.evaluate(t):n.currentDispatcher.scheduleTask(()=>s.evaluate(t),0),!r&&!s._exit&&(n.children().add(s),s.addObserver(()=>n._children.delete(s))),s};var Cd=e=>(t,a)=>{let r=new Fn(a?.scheduler?Ec(e,Bi,a.scheduler):e,a?.uninterruptible!==!0);if(r.evaluate(t),r._exit)return r;if(a?.signal)if(a.signal.aborted)r.interruptUnsafe();else{let o=()=>r.interruptUnsafe();a.signal.addEventListener("abort",o,{once:!0}),r.addObserver(()=>a.signal.removeEventListener("abort",o))}return a?.onFiberStart&&a.onFiberStart(r),r};var wd=e=>{let t=Cd(e);return a=>{if(ke(a))return a;let r=new fo("sync"),o=t(a,{scheduler:r});return o._dispatcher?.flush(),o._exit??Ia(new Bn(o))}},Td=wd(Pi());var vd=$t("effect/Clock",{defaultValue:()=>new _i}),Ui=2**31-1,_i=class{currentTimeMillisUnsafe(){return Date.now()}currentTimeMillis=Ir(()=>this.currentTimeMillisUnsafe());currentTimeNanosUnsafe(){return Lx()}currentTimeNanos=Ir(()=>this.currentTimeNanosUnsafe());monotonicTimeNanosUnsafe(){return Ed()}monotonicTimeNanos=Ir(()=>this.monotonicTimeNanosUnsafe());sleep(t){return this.sleepMillis(Uc(t))}sleepMillis(t){return t<=0?Ji:Number.isFinite(t)?mo(a=>{let r=t>Ui?this.sleepMillis(t-Ui):yr,o=setTimeout(()=>a(r),Math.min(t,Ui));return Ir(()=>clearTimeout(o))}):cd}},kd=BigInt(1e6),Ed=(function(){let e=globalThis.process?.hrtime;if(typeof e?.bigint=="function")return()=>e.bigint();if(typeof performance<"u"&&typeof performance.now=="function")return()=>BigInt(Math.round(performance.now()*1e6));let t=BigInt(0);return()=>{let a=BigInt(Date.now())*kd;return a>t&&(t=a),t}})(),Lx=(function(){let e=BigInt(1e9),t;return()=>{let a=Ed(),r=BigInt(Date.now())*kd;if(t===void 0)t=r-a;else{let o=t+a;(r>o?r-o:o-r)>e&&(t=r-a)}return t+a}})(),tl=e=>$a(t=>e(t.getRef(vd)));var al=tl(e=>e.currentTimeMillis);var qi="~effect/Cause/TimeoutError";var Hi=class extends ra("TimeoutError"){[qi]=qi;constructor(t){super({message:t})}},Gi="~effect/Cause/IllegalArgumentError";var $i=class extends ra("IllegalArgumentError"){[Gi]=Gi;constructor(t){super({message:t})}},Wi="~effect/Cause/ExceededCapacityError";var ji=class extends ra("ExceededCapacityError"){[Wi]=Wi;constructor(t){super({message:t})}},zi="~effect/Cause/AsyncFiberError";var Bn=class extends ra("AsyncFiberError"){[zi]=zi;constructor(t){super({message:"An asynchronous Effect was executed with Effect.runSync",fiber:t})}},Ki="~effect/Cause/UnknownError";var po=class extends ra("UnknownError"){[Ki]=Ki;constructor(t,a){super({message:a,cause:t})}};var bx="~effect/Logger",Pb={[bx]:{_Message:_e,_Output:_e},pipe(){return We(this,arguments)}};var ja={bold:"1",red:"31",green:"32",yellow:"33",blue:"34",cyan:"36",white:"37",gray:"90",black:"30",bgBrightRed:"101"},Ab={None:[],All:[],Trace:[ja.gray],Debug:[ja.blue],Info:[ja.green],Warn:[ja.yellow],Error:[ja.red],Fatal:[ja.bgBrightRed,ja.black]};var Un=so;var ya=td;var Nn=ra;var rl=ut,_n=At,br=gr;var Cr=oa;var wr=gd;var Ad=al;var Hn="~effect/time/DateTime",Gn="~effect/time/DateTime/TimeZone",Rd={[Hn]:Hn,pipe(){return We(this,arguments)},[Et](){return this.toString()},toJSON(){return $n(this).toJSON()}},wx={...Rd,_tag:"Utc",[de](){return Fa(this.epochMilliseconds)},[fe](e){return nl(e)&&e._tag==="Utc"&&this.epochMilliseconds===e.epochMilliseconds},toString(){return`DateTime.Utc(${$n(this).toJSON()})`}},CC={...Rd,_tag:"Zoned",[de](){return qe(Fa(this.epochMilliseconds))(ae(this.zone))},[fe](e){return nl(e)&&e._tag==="Zoned"&&this.epochMilliseconds===e.epochMilliseconds&&Ce(this.zone,e.zone)},toString(){return`DateTime.Zoned(${_d(this)})`}},Dd={[Gn]:Gn,[Et](){return this.toString()}},wC={...Dd,_tag:"Named",[de](){return ge(`Named:${this.id}`)},[fe](e){return sl(e)&&e._tag==="Named"&&this.id===e.id},toString(){return`TimeZone.Named(${this.id})`},toJSON(){return{_id:"TimeZone",_tag:"Named",id:this.id}}},TC={...Dd,_tag:"Offset",[de](){return ge(`Offset:${this.offset}`)},[fe](e){return sl(e)&&e._tag==="Offset"&&this.offset===e.offset},toString(){return`TimeZone.Offset(${Fd(this.offset)})`},toJSON(){return{_id:"TimeZone",_tag:"Offset",offset:this.offset}}};var nl=e=>X(e,Hn);var sl=e=>X(e,Gn);var Tx=e=>{let t=Object.create(wx);return t.epochMilliseconds=e,Object.defineProperty(t,"partsUtc",{value:void 0,enumerable:!1,writable:!0}),t};var vC=-864e13+720*60*1e3,kC=864e13-840*60*1e3;var Od=ho(Ad,Tx);var $n=e=>new Date(e.epochMilliseconds),il=e=>{if(e._tag==="Utc")return new Date(e.epochMilliseconds);if(e.zone._tag==="Offset")return new Date(e.epochMilliseconds+e.zone.offset);if(e.adjustedEpochMilliseconds!==void 0)return new Date(e.adjustedEpochMilliseconds);let t=e.zone.format.formatToParts(e.epochMilliseconds).filter(r=>r.type!=="literal"),a=new Date(0);return a.setUTCFullYear(Number(t[2].value),Number(t[0].value)-1,Number(t[1].value)),a.setUTCHours(Number(t[3].value),Number(t[4].value),Number(t[5].value),Number(t[6].value)),e.adjustedEpochMilliseconds=a.getTime(),a},Md=e=>il(e).getTime()-Ud(e),Fd=e=>{let t=Math.abs(e),a=Math.floor(t/(3600*1e3)),r=Math.round(t%(3600*1e3)/(60*1e3));return r===60&&(a+=1,r=0),`${e<0?"-":"+"}${String(a).padStart(2,"0")}:${String(r).padStart(2,"0")}`},Bd=e=>Fd(Md(e)),Ud=e=>e.epochMilliseconds;var EC=1440*60*1e3;var Nd=e=>$n(e).toISOString();var ol=e=>{let t=il(e);return e._tag==="Utc"?t.toISOString():`${t.toISOString().slice(0,-1)}${Bd(e)}`},_d=e=>e.zone._tag==="Offset"?ol(e):`${ol(e)}[${e.zone.id}]`;var qd=ld,we=dt,ll=nd;var Ie=Lr;var Tr=sd;var ul=Xi;var Hd=rd;var Ka=ft;var Wn=Qi,cl=ho;var La=Yi;var vr=Td;var kr=md,dl=hd;var Dt=pd;var fl=dd;var Gd=Od;var $d=Nd;var Wd="~effect/encoding/EncodingError",Io=class extends Nn("EncodingError"){[Wd]=Wd};var zn=e=>jd(typeof e=="string"?Ex.encode(e):e),Kn=e=>{let t=Px(e),a=t.length;if(a%4!==0)return Wa(new Io({kind:"Decode",module:"Base64",input:t,message:`Length must be a multiple of 4, but is ${a}`}));let r=t.indexOf("=");if(r!==-1&&(r<a-2||r===a-2&&t[a-1]!=="="))return Wa(new Io({kind:"Decode",module:"Base64",input:t,message:"Found a '=' character, but it is not at the end"}));try{let o=t.endsWith("==")?2:t.endsWith("=")?1:0,n=new Uint8Array(3*(a/4)-o);for(let i=0,s=0;i<a;i+=4,s+=3){let u=jn(t.charCodeAt(i))<<18|jn(t.charCodeAt(i+1))<<12|jn(t.charCodeAt(i+2))<<6|jn(t.charCodeAt(i+3));n[s]=u>>16,n[s+1]=u>>8&255,n[s+2]=u&255}return uo(n)}catch(o){return Wa(new Io({kind:"Decode",module:"Base64",input:t,message:o instanceof Error?o.message:"Invalid input"}))}};var Ex=new TextEncoder;var Px=e=>e.replace(/[\n\r]/g,""),jd=e=>{let t=e.length,a="",r;for(r=2;r<t;r+=3)a+=na[e[r-2]>>2],a+=na[(e[r-2]&3)<<4|e[r-1]>>4],a+=na[(e[r-1]&15)<<2|e[r]>>6],a+=na[e[r]&63];return r===t+1&&(a+=na[e[r-2]>>2],a+=na[(e[r-2]&3)<<4],a+="=="),r===t&&(a+=na[e[r-2]>>2],a+=na[(e[r-2]&3)<<4|e[r-1]>>4],a+=na[(e[r-1]&15)<<2],a+="="),a};function jn(e){if(e>=zd.length)throw new TypeError(`Invalid character ${String.fromCharCode(e)}`);let t=zd[e];if(t===255)throw new TypeError(`Invalid character ${String.fromCharCode(e)}`);return t}var na=["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","0","1","2","3","4","5","6","7","8","9","+","/"],zd=[255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,62,255,255,255,63,52,53,54,55,56,57,58,59,60,61,255,255,255,0,255,255,255,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,255,255,255,255,255,255,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51];function pl(e){return e.checks?e.checks[e.checks.length-1].annotations:e.annotations}function Vd(e){return t=>pl(t)?.[e]}var yo="~structural";var ml="~sentinels";var hl=Vd("identifier");var Vn=qt(e=>{let t=hl(e);return typeof t=="string"?t:e.getExpected(Vn)});var bo="~effect/SchemaIssue/Issue";function Il(e){return X(e,bo)&&e[bo]===bo}var Lt=class{[bo]=bo;toString(){return Ox(this)}},Jn=class extends Lt{_tag="Filter";filter;issue;constructor(t,a){super(),this.filter=t,this.issue=a}},Zn=class extends Lt{_tag="Encoding";ast;issue;constructor(t,a){super(),this.ast=t,this.issue=a}},Ot=class extends Lt{_tag="Pointer";path;issue;constructor(t,a){super(),this.path=t,this.issue=a}},Pr=class extends Lt{_tag="MissingKey";annotations;constructor(t){super(),this.annotations=t}},Co=class extends Lt{_tag="UnexpectedKey";ast;constructor(t){super(),this.ast=t}},Oe=class extends Lt{_tag="Composite";ast;issues;constructor(t,a){super(),this.ast=t,this.issues=a}},sa=class extends Lt{_tag="InvalidType";ast;constructor(t){super(),this.ast=t}},je=class extends Lt{_tag="InvalidValue";annotations;constructor(t){super(),this.annotations=t}};var Ar=class extends Lt{_tag="AnyOf";ast;issues;constructor(t,a){super(),this.ast=t,this.issues=a}},Xn=class extends Lt{_tag="OneOf";ast;successes;constructor(t,a){super(),this.ast=t,this.successes=a}};function xl(e){if(Il(e))return e;if(typeof e=="string")return new je({message:e});let t=typeof e.issue=="string"?new je({message:e.issue}):e.issue;return new Ot(e.path,t)}function Jd(e){if(e!==void 0)return typeof e=="boolean"?e?void 0:new je:xl(e)}function Zd(e,t){return Array.isArray(t)?En(t)?t.length===1?xl(t[0]):new Oe(e,xc(t,xl)):void 0:Jd(t)}var Ax=e=>{let t=wo(e);if(t!==void 0)return t;switch(e._tag){case"InvalidType":return Sl(Vn(e.ast));case"InvalidValue":return"Expected a valid value";case"MissingKey":return"Missing key";case"UnexpectedKey":return"Expected no excess property";case"Forbidden":return"Forbidden operation";case"OneOf":return"Expected exactly one member to match"}},Rx=e=>wo(e.issue)??wo(e);function Sl(e){return`Expected ${e}`}function Er(e,t,a,r){switch(e._tag){case"Filter":{let o=r(e);return o!==void 0?[{path:t,message:o}]:e.issue._tag==="InvalidValue"?[{path:t,message:Sl(Xd(e.filter))}]:Er(e.issue,t,a,r)}case"Encoding":return Er(e.issue,t,a,r);case"Pointer":return Er(e.issue,[...t,...e.path],a,r);case"Composite":return e.issues.flatMap(o=>Er(o,t,a,r));case"AnyOf":return e.issues.length===0?[{path:t,message:wo(e)??Sl(Vn(e.ast))}]:e.issues.flatMap(o=>Er(o,t,a,r));default:return[{path:t,message:a(e)}]}}function Xd(e){let t=e.annotations?.expected;if(typeof t=="string")return t;switch(e._tag){case"Filter":return"<filter>";case"FilterGroup":return e.checks.map(a=>Xd(a)).join(" & ")}}function Dx(){return e=>Er(e,[],Ax,Rx).map(Mx).join(`
292
292
  `)}var Ox=Dx();function Mx(e){let t=e.message;if(e.path&&e.path.length>0){let a=Vu(e.path);t+=`
293
- at ${a}`}return t}function wo(e){switch(e._tag){case"InvalidType":case"OneOf":case"Composite":case"AnyOf":return Lo(e.ast.annotations);case"InvalidValue":case"Forbidden":return Lo(e.annotations);case"MissingKey":return Lo(e.annotations,"messageMissingKey");case"UnexpectedKey":return Lo(e.ast.annotations,"messageUnexpectedKey");case"Filter":return Lo(e.filter.annotations);case"Encoding":return wo(e.issue)}}function Lo(e,t="message"){let a=e?.[t];if(typeof a=="string")return a}function To(e){let t;for(let a of e.reasons){if(!Un(a)||!Il(a.error))return;t??=a.error}return t}function Yn(e,t){let a=To(e);if(a===void 0)throw new Error(t,{cause:e});return a}var re=Symbol();var ia=rl,Dr=ia(re),Ze=ia(re),Qn=e=>e===re?Gt():Rt(e),yl=e=>e._tag==="None"?Dr:ia(e.value);var Or=class e extends Yr{run;constructor(t){super(),this.run=t}map(t){return new e((a,r)=>this.run(a,r).pipe(kr(Si(t))))}compose(t){return ef(this)?t:ef(t)?this:new e((a,r)=>this.run(a,r).pipe(Dt(o=>t.run(o,r))))}};var tf=new Or(we);function ef(e){return e.run===tf.run}function Mr(){return tf}function Bx(e){return new Or((t,a)=>io(t)?ll:e(t.value,a))}function pt(e){return af(Si(e))}function vo(e){return Bx((t,a)=>e(t,a).pipe(kr(Rt)))}function af(e){return new Or(t=>we(e(t)))}function Ll(e){return new Or(t=>{let a=hc(t,Zs);return xr(a)?we(a):kr(e,Rt)})}function es(){return pt(globalThis.String)}function ts(){return pt(globalThis.Number)}function rf(){return pt(zn)}function of(){return vo(e=>dl(Hd(Kn(e)),()=>new je({message:"Expected a valid Base64 string"})))}var ko="~effect/SchemaTransformation/Transformation",mt=class e{[ko]=ko;_tag="Transformation";decode;encode;constructor(t,a){this.decode=t,this.encode=a}flip(){return new e(this.encode,this.decode)}compose(t){return new e(this.decode.compose(t.decode),t.encode.compose(this.encode))}};function _x(e){return X(e,ko)&&e[ko]===ko}var Cl=e=>_x(e)?e:new mt(e.decode,e.encode);function Eo(e){return new mt(vo(e.decode),vo(e.encode))}function nf(e){return new mt(pt(e.decode),pt(e.encode))}var qx=new mt(Mr(),Mr());function wl(){return qx}var as=new mt(ts(),es());var sf=Eo({decode:e=>URL.canParse(e)?we(new URL(e)):Ie(new je({message:"Expected a valid URL string"})),encode:e=>we(e.href)});var lf=new mt(of(),rf());function Za(e){return t=>t._tag===e}var gf=Za("Declaration");var Wx=Za("Never");var Fr=Za("Literal"),Tl=Za("UniqueSymbol");var xf=Za("Arrays"),jx=Za("Objects");var zx=Za("Suspend"),ht=class{to;transformation;constructor(t,a){this.to=t,this.transformation=a}},Nl={},la=class{isOptional;isMutable;defaultValue;annotations;constructor(t,a,r=void 0,o=void 0){this.isOptional=t,this.isMutable=a,this.defaultValue=r,this.annotations=o}},cf="~effect/Schema",bt=class{[cf]=cf;annotations;checks;encoding;context;constructor(t=void 0,a=void 0,r=void 0,o=void 0){this.annotations=t,this.checks=a,this.encoding=r,this.context=o}toString(){return`<${this._tag}>`}},rs=class e extends bt{_tag="Declaration";typeParameters;run;encodingChecks;constructor(t,a,r,o,n,i,s){super(r,o,n,i),this.typeParameters=t,this.run=a,this.encodingChecks=s}getParser(){let t;return(a,r)=>a===re?Dr:(t??=this.run(this.typeParameters))(a,this,r)}_rebuild(t,a,r){let o=Br(this.typeParameters,t);return o===this.typeParameters&&a===this.checks&&r===this.encodingChecks?this:new e(o,this.run,this.annotations,a,void 0,this.context,r)}recur(t){return this._rebuild(t,this.checks,this.encodingChecks)}flip(t){return this._rebuild(t,this.encodingChecks,this.checks)}getExpected(){let t=this.annotations?.expected;return typeof t=="string"?t:"<Declaration>"}},vl=class extends bt{_tag="Null";getParser(){return Of(this,null)}getExpected(){return"null"}},Sf=new vl;var kl=class extends bt{_tag="Unknown";getParser(){return Mo(this,Hu)}getExpected(){return"unknown"}},Ao=new kl;var ba=class extends bt{_tag="Literal";literal;constructor(t,a,r,o,n){if(super(a,r,o,n),typeof t=="number"&&!globalThis.Number.isFinite(t))throw new Error(`A numeric literal must be finite, got ${pe(t)}`);this.literal=t}getParser(){return Of(this,this.literal)}matchPart(t,a){return t===globalThis.String(this.literal)?this.literal:void 0}toCodecJson(){return typeof this.literal=="bigint"?df(this):this}toCodecStringTree(){return typeof this.literal=="string"?this:df(this)}getExpected(){return typeof this.literal=="string"?JSON.stringify(this.literal):globalThis.String(this.literal)}};function df(e){let t=globalThis.String(e.literal);return Xe(e,[new ht(new ba(t),new mt(pt(()=>e.literal),pt(()=>t)))])}var El=class extends bt{_tag="String";getParser(){return Mo(this,fn)}matchPart(t,a){let r=this.checks;return r&&!a.disableChecks&&Ta(r,t,void 0,this,a)?void 0:t}getExpected(){return"string"}},Ro=new El,Pl=class extends bt{_tag="Number";getParser(){return Mo(this,pn)}matchKey(t,a){return this._match(nS,t,a)}matchPart(t,a){return this._match(Ul,t,a)}_match(t,a,r){if(!t.test(a))return;let o=globalThis.Number(a);return r.disableChecks||!this.checks?o:Ta(this.checks,o,void 0,this,r)?void 0:o}toCodecJson(){return this.checks&&(Al(this.checks,"effect/schema/isFinite")||Al(this.checks,"effect/schema/isInt"))?this:Xe(this,[Kx(this.checks)])}toCodecStringTree(){return this.toCodecJson()===this?Xe(this,[sS]):Xe(this,[iS])}getExpected(){return"number"}};function Al(e,t){return e.some(a=>a.annotations?.representation?.id===t||a._tag==="FilterGroup"&&Al(a.checks,t))}function Kx(e){let t=e?Nr(is,e):is;return new ht(new Ja([t,wf],"anyOf"),new mt(ts(),pt(a=>globalThis.Number.isFinite(a)?a:globalThis.String(a))))}var _l=new Pl,Rl=class extends bt{_tag="Boolean";getParser(){return Mo(this,_u)}getExpected(){return"boolean"}},If=new Rl;var Do=class e extends bt{_tag="Arrays";isMutable;elements;rest;encodingChecks;constructor(t,a,r,o,n,i,s,u){super(o,n,i,s),this.isMutable=t,this.elements=a,this.rest=r,this.encodingChecks=u;let l=!1;for(let d=0;d<a.length;d++)if(wa(a[d]))l=!0;else if(l)throw new Error("A required element cannot follow an optional element. ts(1257)");if(l&&r.length>1)throw new Error("A required element cannot follow an optional element. ts(1257)");for(let d=1;d<r.length;d++)if(wa(r[d]))throw new Error("An optional element cannot follow a rest element. ts(1266)")}getParser(t){let a=this,r,o,n=a.elements.length,i=Math.max(0,a.rest.length-1);function s(u,l){return l<n?r[l]:l>=u?o[l-u+1]:o[0]}return fl(function*(u,l){if(u===re)return re;if(!Array.isArray(u))return yield*Ie(new sa(a));r||(r=a.elements.map(h=>({ast:h,parser:t(h)})),o=a.rest.map(h=>({ast:h,parser:t(h)})));let d=u.length,f={ast:a,getParser:s,input:u,len:d,tailThreshold:Math.max(n,d-i),output:new globalThis.Array(d),issues:void 0,options:l},m=ql(l?.concurrency),p=Vx(f,u,{concurrency:m?.concurrency,end:a.rest.length===0?n:Math.max(d,n+i)});if(p&&(yield*p),a.rest.length===0&&d>n)for(let h=n;h<=d-1;h++){let x=new Ot([h],new Co(a));if(l.errors==="all")f.issues?f.issues.push(x):f.issues=[x];else return yield*Ie(new Oe(a,[x]))}return f.issues?yield*Ie(new Oe(a,f.issues)):f.output})}_rebuild(t,a,r){let o=Br(this.elements,t),n=Br(this.rest,t);return o===this.elements&&n===this.rest&&a===this.checks&&r===this.encodingChecks?this:new e(this.isMutable,o,n,this.annotations,a,void 0,this.context,r)}recur(t){return this._rebuild(t,this.checks,this.encodingChecks)}flip(t){return this._rebuild(t,this.encodingChecks,this.checks)}getExpected(){return"array"}},Vx=go()({onItem(e,t,a){let r=a<e.len?t:re;return e.getParser(e.tailThreshold,a).parser(r,e.options)},step(e,t,a,r){if(a._tag==="Failure")return os(e,e.ast,r,a);let o=a===Ze?t:a[U];if(o!==re)e.output[r]=o;else{let n=e.getParser(e.tailThreshold,r);if(wa(n.ast))return;let i=new Ot([r],new Pr(n.ast.context?.annotations));if(e.options.errors==="all")e.issues?e.issues.push(i):e.issues=[i];else return br(new Oe(e.ast,[i]))}}}),ql=e=>(e=e==="unbounded"?1/0:e??1,e>1?{concurrency:e}:void 0),os=(e,t,a,r)=>{if(r.cause.reasons.length===0)return r;let o=To(r.cause);if(o===void 0)return _n(ya(r.cause,i=>new Oe(t,[new Ot([a],i)])));let n=new Ot([a],o);if(e.options.errors==="all")e.issues?e.issues.push(n):e.issues=[n];else return br(new Oe(t,[n]))},yf="[+-]?\\d*\\.?\\d+(?:[Ee][+-]?\\d+)?";function Dl(e,t,a=Nl){let r,o;function n(i){switch(i._tag){case"String":case"TemplateLiteral":return(r??=Object.keys(e)).filter(s=>i.matchPart(s,a)!==void 0);case"Number":return(r??=Object.keys(e)).filter(s=>i.matchKey(s,a)!==void 0);case"Symbol":return(o??=Object.getOwnPropertySymbols(e)).filter(s=>i.matchKey(s,a)!==void 0);case"Union":return[...new Set(i.types.flatMap(n))];default:return[]}}return n(Xl(ds(t)))}var ns=class{name;type;constructor(t,a){this.name=t,this.type=a}};function Ol(e){switch(e._tag){case"String":case"Number":case"Symbol":case"TemplateLiteral":return!0;case"Union":return e.types.every(Ol);default:return!1}}function Jx(e){return Ol(e)&&Ol(ds(e))}var Ml=class{parameter;type;constructor(t,a){if(!Jx(t))throw new Error(`Invalid index signature parameter ${t._tag}`);if(this.parameter=t,this.type=a,wa(a)&&!Df(a))throw new Error("Cannot use `Schema.optionalKey` with index signatures, use `Schema.optional` instead.")}},Fl=class e extends bt{_tag="Objects";propertySignatures;indexSignatures;encodingChecks;constructor(t,a,r,o,n,i,s){super(r,o,n,i),this.propertySignatures=t,this.indexSignatures=a,this.encodingChecks=s;let u=t.map(l=>l.name).filter((l,d,f)=>f.indexOf(l)!==d);if(u.length>0)throw new Error(`Duplicate identifiers: ${JSON.stringify(u)}. ts(2300)`)}getParser(t){let a=this,r=[];for(let p of a.propertySignatures)r.push(p.name);let o=r.length,n=a.indexSignatures.length,i=o&&n?new Set(r):void 0;if(!o&&!n)return Mo(a,qu);let s,u,l=(p,h,x,g,y)=>{if(y._tag==="Failure")return os(p,a,h,y)??Cr;let T=y===Ze?g:y[U];if(x!==re&&T!==re){if(o&&(i.has(h)||i.has(x)))return Cr;Ua(p.out,x,T)}return Cr},d=(p,h,x,g)=>{if(!g){let A=x.parserKey(h,p.options);if(!ke(A))return Ka(Wn(A),_=>d(p,h,x,_));g=A}if(g._tag==="Failure")return os(p,a,h,g)??Cr;let y=g===Ze?h:g[U],T=p.input[h],E=x.parserValue(T,p.options);return ke(E)?l(p,h,y,T,E):Ka(Wn(E),A=>l(p,h,y,T,A))},f=(p,h,x)=>{let g=p.input[h],y=x.parserValue(g,p.options);return ke(y)?l(p,h,h,g,y):Ka(Wn(y),T=>l(p,h,h,g,T))},m=n?go()({onItem:(p,[h,x])=>d(p,h,x),step:(p,h,x)=>x._tag==="Failure"?x:void 0}):void 0;return fl(function*(p,h){if(p===re)return re;if(!(typeof p=="object"&&p!==null&&!Array.isArray(p)))return yield*Ie(new sa(a));s||(s=a.propertySignatures.map(C=>({parser:t(C.type),name:C.name,type:C.type})),u=n?a.indexSignatures.map(C=>({is:C,parserKey:t(Xl(C.parameter)),parserValue:t(C.type)})):void 0);let x=p,g={},y={ast:a,input:x,out:g,issues:void 0,options:h},T=h.errors==="all",E=h.onExcessProperty==="error",A=h.onExcessProperty==="preserve",_;if(!n&&(E||A)){i??=new Set(r),_=Reflect.ownKeys(x);for(let C=0;C<_.length;C++){let b=_[C];if(!i.has(b))if(E){let P=new Ot([b],new Co(a));if(T){y.issues?y.issues.push(P):y.issues=[P];continue}else return yield*Ie(new Oe(a,[P]))}else Ua(g,b,x[b])}}let N=ql(h?.concurrency);if(o){let C=Zx(y,s,N);C&&(yield*C)}if(n&&!N)for(let C=0;C<n;C++){let b=u[C],P=b.is.parameter===Ro?f:d,L=b.is.parameter===Ro?Object.keys(x):Dl(x,b.is.parameter,h);for(let R=0;R<L.length;R++){let M=P(y,L[R],b);if(!ke(M))yield*M;else if(M._tag==="Failure")return yield*M}}else if(m){let C=Pn();for(let P=0;P<n;P++){let L=u[P],R=Dl(x,L.is.parameter,h);for(let M=0;M<R.length;M++)C.push([R[M],L])}let b=m(y,C,N);b&&(yield*b)}if(y.issues)return yield*Ie(new Oe(a,y.issues));if(h.propertyOrder==="original"){let C=(_??Reflect.ownKeys(x)).concat(r),b={};for(let P of C)Object.hasOwn(g,P)&&Ua(b,P,g[P]);return b}return g})}_rebuild(t,a,r,o){let n=Br(this.propertySignatures,s=>{let u=t(s.type);return u===s.type?s:new ns(s.name,u)}),i=Br(this.indexSignatures,s=>{let u=a(s.parameter),l=t(s.type);return u===s.parameter&&l===s.type?s:new Ml(u,l)});return n===this.propertySignatures&&i===this.indexSignatures&&r===this.checks&&o===this.encodingChecks?this:new e(n,i,this.annotations,r,void 0,this.context,o)}flip(t){return this._rebuild(t,t,this.encodingChecks,this.checks)}recur(t,a=t){return this._rebuild(t,a,this.checks,this.encodingChecks)}getExpected(){return this.propertySignatures.length===0&&this.indexSignatures.length===0?"object | array":"object"}},Zx=go()({onItem(e,t){if(!Object.hasOwn(e.input,t.name))return t.parser(re,e.options);let a=e.input[t.name];return Ua(e.out,t.name,a),t.parser(a,e.options)},step(e,t,a){if(a._tag==="Failure")return os(e,e.ast,t.name,a);if(a===Ze)return;let r=a[U];if(r!==re){Ua(e.out,t.name,r);return}if(delete e.out[t.name],!wa(t.type)){let o=new Ot([t.name],new Pr(t.type.context?.annotations));if(e.options.errors==="all"){e.issues?e.issues.push(o):e.issues=[o];return}else return br(new Oe(e.ast,[o]))}}});function Lf(e,t){return e?t?[...e,...t]:e:t}function Hl(e,t,a){return new Fl(Reflect.ownKeys(e).map(r=>new ns(r,e[r].ast)),[],a,t)}function Gl(e){return e.ast}function $l(e,t=void 0){return new Do(!1,e.map(a=>a.ast),[],void 0,t)}function ls(e,t,a){return new Ja(e.map(Gl),t,void 0,a)}var Wl=qt(e=>{for(;;){if(zx(e))return Ao;let t=e.encoding;if(!t)return e.recur?.(Wl,_e)??e;if(t.some(a=>a.transformation._tag==="Middleware"&&a.transformation.decode!==_e))return Ao;e=t[t.length-1].to}});function bf(e){switch(e._tag){case"Null":return["null"];case"Undefined":return["undefined"];case"String":case"TemplateLiteral":return["string"];case"Number":return["number"];case"Boolean":return["boolean"];case"Symbol":case"UniqueSymbol":return["symbol"];case"BigInt":return["bigint"];case"Arrays":return["array"];case"ObjectKeyword":return["object","array","function"];case"Objects":return e.propertySignatures.length||e.indexSignatures.length?["object"]:["string","number","boolean","symbol","bigint","object","array","function"];case"Enum":return Array.from(new Set(e.enums.map(([,t])=>typeof t)));case"Literal":return[typeof e.literal];case"Union":return Array.from(new Set(e.types.flatMap(bf)));default:return["null","undefined","string","number","boolean","symbol","bigint","object","array","function"]}}function jl(e){switch(e._tag){default:return[];case"Declaration":{let t=e.annotations?.[ml];return Array.isArray(t)?t:[]}case"Objects":return e.propertySignatures.flatMap(t=>{let a=t.type;if(!wa(a)){if(Fr(a))return[{key:t.name,literal:a.literal}];if(Tl(a))return[{key:t.name,literal:a.symbol}]}return[]});case"Arrays":return e.elements.flatMap((t,a)=>{if(!wa(t)){if(Fr(t))return[{key:a,literal:t.literal}];if(Tl(t))return[{key:a,literal:t.symbol}]}return[]});case"Suspend":return jl(e.thunk())}}var ff=new WeakMap,Po=Object.freeze([]);function Xx(e){let t=ff.get(e);if(t)return t;t={};let a;for(let r=0;r<e.length;r++){let o=e[r],n=Wl(o);if(Wx(n))continue;if(a!==null)if(Fr(n)||Tl(n)){a??=new Map;let s=Fr(n)?n.literal:n.symbol,u=a.get(s);u||a.set(s,u=[]),u.push(o)}else a=null;let i=jl(n);if(i.length){t.bySentinel??=new Map;for(let{key:s,literal:u}of i){let l=t.bySentinel.get(s);l||t.bySentinel.set(s,l=new Map);let d=l.get(u);d||l.set(u,d=[]),d[d.length-1]!==r&&d.push(r)}}else{t.otherwise??={};let s=bf(n);for(let u of s)(t.otherwise[u]??=[]).push(r)}}if(a)a.forEach(Object.freeze),t=r=>a.get(r)??Po;else if(t.bySentinel?.size===1&&!t.otherwise)for(let[r,o]of t.bySentinel){let n=o;for(let[i,s]of o)n.set(i,Object.freeze(s.map(u=>e[u])));t=i=>mn(i)&&Object.hasOwn(i,r)?n.get(i[r])??Po:Po}return ff.set(e,t),t}function Yx(e){return t=>{let a=Wl(t);return a._tag==="Literal"?a.literal===e:a._tag==="UniqueSymbol"?a.symbol===e:!0}}function Cf(e,t){let a=Xx(t);if(typeof a=="function")return a(e);let r=e===null?"null":Array.isArray(e)?"array":typeof e;if(a.bySentinel){let o=a.otherwise?.[r]??Po;if(mn(e)){let n=new Set(o);for(let[i,s]of a.bySentinel)if(Object.hasOwn(e,i)){let u=s.get(e[i]);if(u)for(let l of u)n.add(l)}return Array.from(n).sort((i,s)=>i-s).map(i=>t[i])}return o.map(n=>t[n])}return(a.otherwise?.[r]??Po).map(o=>t[o]).filter(Yx(e))}var Ja=class e extends bt{_tag="Union";types;mode;encodingChecks;constructor(t,a,r,o,n,i,s){super(r,o,n,i),this.types=t,this.mode=a,this.encodingChecks=s}getParser(t){let a=this;return(r,o)=>{if(r===re)return Dr;let n=Cf(r,a.types);if(n.length===1){let l=t(n[0])(r,o);return l._tag==="Success"?l:ke(l)?pf(a,l.cause):La(l,d=>pf(a,d))}let i={ast:a,recur:t,input:r,out:void 0,successes:a.mode==="oneOf"?[]:void 0,issues:void 0,options:o},s=ql(o?.concurrency),u=Qx(i,n,s?{...s,orderedStep:!0}:void 0);return u?Dt(u,l=>i.out===Ze?we(r):i.out??Ie(new Ar(a,i.issues??[]))):i.out??Ie(new Ar(a,i.issues??[]))}}_rebuild(t,a,r){let o=Br(this.types,t);return o===this.types&&a===this.checks&&r===this.encodingChecks?this:new e(o,this.mode,this.annotations,a,void 0,this.context,r)}recur(t){return this._rebuild(t,this.checks,this.encodingChecks)}flip(t){return this._rebuild(t,this.encodingChecks,this.checks)}matchPart(t,a){for(let r of this.types){let o=r.matchPart(t,a);if(o!==void 0)return o}}getExpected(t){let a=this.annotations?.expected;if(typeof a=="string")return a;if(this.types.length===0)return"never";let r=this.types.map(o=>{let n=ds(o);switch(n._tag){case"Arrays":{let i=n.elements.filter(Fr);if(i.length>0)return`${mf(n.isMutable)}[ ${i.map(s=>t(s)+hf(s.context?.isOptional)).join(", ")}, ... ]`;break}case"Objects":{let i=n.propertySignatures.filter(s=>Fr(s.type));if(i.length>0)return`{ ${i.map(s=>`${mf(s.type.context?.isMutable)}${pr(s.name)}${hf(s.type.context?.isOptional)}: ${t(s.type)}`).join(", ")}, ... }`;break}}return t(n)});return Array.from(new Set(r)).join(" | ")}};function pf(e,t){let a=To(t);return a?br(new Ar(e,[a])):_n(t)}var Qx=go()({onItem(e,t){return e.recur(t)(e.input,e.options)},step(e,t,a){if(a._tag==="Failure"){let r=To(a.cause);if(r===void 0)return a;e.issues?e.issues.push(r):e.issues=[r]}else{if(e.out&&e.successes)return e.successes.push(t),br(new Xn(e.ast,e.successes));if(e.out=a,e.successes)e.successes.push(t);else return Cr}}}),wf=new Ja([new ba("Infinity"),new ba("-Infinity"),new ba("NaN")],"anyOf");function mf(e){return e?"":"readonly "}function hf(e){return e?"?":""}var Bl=class e extends Yr{_tag="Filter";run;annotations;aborted;constructor(t,a=void 0,r=!1){super(),this.run=t,this.annotations=a,this.aborted=r}annotate(t){return new e(this.run,{...this.annotations,...t},this.aborted)}abort(){return new e(this.run,this.annotations,!0)}and(t,a){return new ss([this,t],a)}},ss=class e extends Yr{_tag="FilterGroup";checks;annotations;constructor(t,a=void 0){super(),this.checks=t,this.annotations=a}annotate(t){return new e(this.checks,{...this.annotations,...t})}and(t,a){return new e([this,t],a)}};function us(e,t,a=!1){return new Bl((r,o,n)=>Zd(o,e(r,o,n)),t,a)}function Tf(e){return us(t=>globalThis.Number.isFinite(t),{expected:"a finite number",representation:{id:"effect/schema/isFinite",payload:null},toJsonSchema:()=>({type:"number"}),toCode:()=>({runtime:"Schema.isFinite()"}),arbitrary:{constraint:{noInfinity:!0,noNaN:!0}},...e})}var is=Nr(_l,[Tf()]);function zl(e,t){let a=e.source,r=new globalThis.RegExp(a,e.flags);return us(o=>(r.lastIndex=0,r.test(o)),{expected:`a string matching the RegExp ${a}`,representation:{id:"effect/schema/isPattern",payload:{source:a,flags:e.flags}},toJsonSchema:()=>({pattern:a}),arbitrary:{constraint:{patterns:[e.source]}},...t})}function Oo(e,t){let a=Object.getOwnPropertyDescriptors(e);return t(a),Object.create(Object.getPrototypeOf(e),a)}function Xe(e,t){return e.encoding===t?e:Oo(e,a=>{a.encoding.value=t})}function Kl(e,t){return e.context===t?e:Oo(e,a=>{a.context.value=t})}function Vl(e,t){if(e.checks){let a=e.checks[e.checks.length-1];return vf(e,Li(e.checks.slice(0,-1),a.annotate(t)))}return Oo(e,a=>{a.annotations.value={...a.annotations.value,...t}})}function vf(e,t){if(e._tag==="Suspend"&&t)throw new Error("Cannot add checks to Suspend");return e.checks===t?e:Oo(e,a=>{a.checks.value=t})}function Nr(e,t){return vf(e,Lf(e.checks,t))}function cs(e,t){let a=t(e.to);return a===e.to?e:new ht(a,e.transformation)}function kf(e,t){let a=e,r=a[a.length-1],o=cs(r,t);return o===r?e:Li(e.slice(0,e.length-1),o)}function eS(e){return t=>t.encoding?Xe(t,kf(t.encoding,e)):t}function Ef(e){function t(a){return a.encoding?Xe(a,kf(a.encoding,t)):e(a)}return qt(t)}function tS(e,t,a){let r=new ht(e,t);return Xe(a,a.encoding?[...a.encoding,r]:[r])}function Br(e,t){let a=!1,r=new Array(e.length);for(let o=0;o<e.length;o++){let n=e[o],i=t(n);i!==n&&(a=!0),r[o]=i}return a?r:e}function Jl(e,t){let a=e.context?new la(e.context.isOptional,e.context.isMutable,e.context.defaultValue,{...e.context.annotations,...t}):new la(!1,!1,void 0,t);return Kl(e,a)}var aS=eS(Zl);function Zl(e){let t=e.context?e.context.isOptional===!1?new la(!0,e.context.isMutable,e.context.defaultValue,e.context.annotations):e.context:new la(!0,!1);return aS(Kl(e,t))}function Pf(e,t){let a=new mt(Ll(t),Mr()),r=[new ht(Ao,a)],o=e.context?new la(e.context.isOptional,e.context.isMutable,r,e.context.annotations):new la(!1,!1,r);return Kl(e,o)}function Af(e,t,a){return tS(e,a,t)}function wa(e){return e.context?.isOptional??!1}function Rf(e){return e.annotations?.[yo]===!0||e._tag==="FilterGroup"&&e.checks.every(Rf)}function rS(e){function t(r){return Rf(r)?[r]:r._tag==="FilterGroup"?r.checks.flatMap(t):[]}let a=e.flatMap(t);return bi(a)?a:void 0}var Ur=qt(e=>{if(e.encoding)return Ur(Xe(e,void 0));let t=e,a=t.recur?.(Ur)??t,r=a.encodingChecks;if(r){let o=a===e?r:xf(a)||jx(a)||gf(a)&&a.typeParameters.length>0?rS(r):void 0;return Oo(a,n=>{n.encodingChecks.value=void 0,n.checks.value=Lf(a.checks,o)})}return a}),ds=qt(e=>Ur(Ca(e)));function oS(e,t){let a=t,r=a.length,o=a[r-1],n=[new ht(Ca(Xe(e,void 0)),a[0].transformation.flip())];for(let s=1;s<r;s++)n.unshift(new ht(Ca(a[s-1].to),a[s].transformation.flip()));let i=Ca(o.to);return i.encoding?Xe(i,[...i.encoding,...n]):Xe(i,n)}var Ca=qt(e=>{if(e.encoding)return oS(e,e.encoding);let t=e;return t.flip?.(Ca)??t.recur?.(Ca)??t});function Df(e){switch(e._tag){case"Undefined":return!0;case"Union":return e.types.some(Df);default:return!1}}function Of(e,t){let a=ia(t);return r=>r===re?Dr:r===t?a:Ie(new sa(e))}function Mo(e,t){return a=>a===re?Dr:t(a)?Ze:Ie(new sa(e))}var Xl=Ef(e=>{switch(e._tag){default:return e;case"Number":return e.toCodecStringTree();case"Union":return e.recur(Xl)}});var Ul=new globalThis.RegExp(`^${yf}$`),nS=new globalThis.RegExp(`^(?:${yf}|Infinity|-Infinity|NaN)$`);function Mf(e){return zl(Ul,{expected:"a string representing a finite number",representation:{id:"effect/schema/isStringFinite",payload:null},toJsonSchema:()=>({pattern:Ul.source}),...e})}var Ff=Nr(Ro,[Mf()]),sS=new ht(Ff,as),iS=new ht(new Ja([Ff,wf],"anyOf"),as),lS="-?\\d+",AE=new globalThis.RegExp(`^${lS}$`);var uS="Symbol\\((.*)\\)",RE=new globalThis.RegExp(`^${uS}$`);function Ta(e,t,a,r,o){for(let n=0;n<e.length;n++){let i=e[n];if(i._tag==="FilterGroup"){if(a=Ta(i.checks,t,a,r,o),a&&(o.errors!=="all"||a[a.length-1].filter.aborted))return a}else{let s=i.run(t,r,o);if(s){let u=new Jn(i,s);if(a?a.push(u):a=[u],o.errors!=="all"||i.aborted)return a}}}return a}var Yl="~effect/Schema/Class";var Fo="~effect/SchemaError/SchemaError",Bo=class extends Nn("SchemaError"){[Fo]=Fo;constructor(t){super({issue:t})}get message(){return this.issue.toString()}toString(){return`SchemaError(${this.message})`}};function Bf(e){return X(e,Fo)&&e[Fo]===Fo}var Uo=qt(e=>{switch(e._tag){case"Declaration":{let t=e.annotations?.[Yl];if(to(t)){let a=t(e.typeParameters);return Xe(e,[cs(a,Uo)])}return e}case"Objects":case"Arrays":return e.recur(t=>{let a=t.context?.defaultValue;if(a){let r=Uo(t);return Xe(r,r.encoding?[...r.encoding,...a]:a)}return Uo(t)});case"Suspend":return e.recur(Uo);default:return e}});function ps(e){let t=Uo(Ur(e.ast)),a=Hf(t);return(r,o)=>a(r,o?.disableChecks?o?.parseOptions?{...o.parseOptions,disableChecks:!0}:{disableChecks:!0}:o?.parseOptions)}function tu(e){let t=ps(e);return(a,r)=>{let o=vr(t(a,r));return wr(o)?Rt(o.value):(Yn(o.cause,"Option adapter can only return none for schema issues"),Gt())}}function _f(e){let t=ps(e);return(a,r)=>{let o=vr(t(a,r));if(wr(o))return o.value;let n=Yn(o.cause,"Constructor adapter can only throw schema issues");throw new Error(n.toString(),{cause:n})}}function au(e,t){let a=Hf(e.ast);return t===void 0?a:(r,o)=>a(r,fs(t,o))}function qf(e,t){return fS(au(e,t))}var fs=(e,t)=>t?{...e,...t}:e,Uf=e=>e===re?Ie(new je):we(e);function Hf(e){let t;return(a,r)=>{let o=(t??=eu(e))(a,r??Nl);return o===Ze?we(a):ke(o)?o[U]===re?Uf(re):o:Dt(o,Uf)}}function dS(e){return(t,a)=>vr(e(t,a))}function fS(e){let t=dS(e);return(a,r)=>{let o=t(a,r);return wr(o)?Rt(o.value):(Yn(o.cause,"Option adapter can only return none for schema issues"),Gt())}}var Nf=new WeakMap;function eu(e){let t=Nf.get(e);return t||Nf.set(e,t=pS(e)),t}function pS(e){let t=e.getParser(eu),a=e.checks,r=e.encoding,o=e.encodingChecks,n=(a?a[a.length-1].annotations:e.annotations)?.parseOptions;if(!r&&!a&&!o)return n?(u,l)=>t(u,fs(l,n)):t;let i,s=(u,l)=>{let d=t(u,l);if(o&&!l.disableChecks)if(ke(d)){if(d._tag==="Success"){let f=d===Ze?u:d[U];if(u!==re&&f!==re){let m=Ta(o,u,void 0,e,l);m&&(d=Ie(new Oe(e,m)))}}}else d=Ka(d,f=>{if(u!==re&&f!==re){let m=Ta(o,u,void 0,e,l);if(m)return Ie(new Oe(e,m))}return we(f)});if(a&&!l.disableChecks)if(ke(d)){if(d._tag==="Success"){let f=d===Ze?u:d[U];if(f===re)return d;let m=Ta(a,f,void 0,e,l);m&&(d=Ie(new Oe(e,m)))}}else d=Ka(d,f=>{if(f!==re){let m=Ta(a,f,void 0,e,l);if(m)return Ie(new Oe(e,m))}return we(f)});return d};return r?(u,l)=>{n&&(l=fs(l,n));let d=i??=r.map(p=>eu(p.to)),f=u,m=d[d.length-1](u,l);for(let p=r.length-1;p>=0;p--){let h=r[p].transformation,x;if(ke(m)&&m._tag==="Success"){let g=Qn(m===Ze?f:m[U]);x=h._tag==="Transformation"?h.decode.run(g,l):h.decode(ia(g),l)}else h._tag==="Transformation"?x=Dt(m,g=>h.decode.run(Qn(g),l)):x=h.decode(kr(m,Qn),l);if(m=ke(x)&&x._tag==="Success"?yl(x[U]):Dt(x,yl),p!==0){let g=d[p-1];m._tag==="Success"?(f=m[U],m=g(f,l)):m=Dt(m,y=>{let T=g(y,l);return T===Ze?ia(y):T})}}if(m._tag==="Success"){let p=m[U],h=s(p,l);return h===Ze?m:h}return m=La(m,p=>Tr(()=>ya(p,h=>new Zn(e,h)))),Dt(m,p=>{let h=s(p,l);return h===Ze?ia(p):h})}:n?(u,l)=>s(u,fs(l,n)):s}var ru="~effect/Schema/Schema";var mS={[ru]:ru,pipe(){return We(this,arguments)},annotate(e){return this.rebuild(Vl(this.ast,e))},annotateKey(e){return this.rebuild(Jl(this.ast,e))},check(...e){return this.rebuild(Nr(this.ast,e))}};function ou(e,t){function a(){}let r=Object.defineProperties(Object.setPrototypeOf(a,mS),Object.getOwnPropertyDescriptors({...t}));r.ast=e,r.rebuild=n=>ou(n,t);let o=ps(r);return r.makeEffect=(n,i)=>nu(o(n,i)),r.make=_f(r),r.makeOption=tu(r),r}function nu(e){return La(e,t=>Tr(()=>ya(t,a=>new Bo(a))))}var ms=e=>e;function xS(){return(e,t,a)=>He(new rs(e.map(Gl),r=>t(r.map(o=>He(o))),a))}function SS(e,t){return xS()([],()=>(a,r)=>e(a)?we(a):Ie(new sa(r)),t)}function IS(e,t){let a=au(e,t);return(r,o)=>nu(a(r,o))}function yS(e,t){let a;for(let r of e.reasons){if(!Un(r)||!Bf(r.error))throw new globalThis.Error(t,{cause:e});a??=r.error}if(a===void 0)throw new globalThis.Error(t,{cause:e});return a}function LS(e){let t=vr(e);if(wr(t))return t.value;throw yS(t.cause,"Sync adapter can only throw schema errors")}var _r=qf;function ze(e,t){let a=IS(e,t);return(r,o)=>LS(a(r,o))}var He=ou;var K=ms(e=>He(Zl(e.ast),{schema:e}));function se(e){let t=He(new ba(e),{literal:e,transform(a){return t.pipe(wS(se(a),{decode:pt(()=>a),encode:pt(()=>e)}))}});return t}var No=He(Ao),bS=He(Sf);var S=He(Ro),at=He(_l),rt=He(If);function Wf(e,t){return He(e,{fields:t,mapFields(a,r){let o=a(this.fields);return Wf(Hl(o,r?.unsafePreserveChecks?this.ast.checks:void 0),o)}})}function w(e){return Wf(Hl(e,void 0),e)}function jf(e,t){return He(e,{elements:t,mapElements(a,r){let o=a(this.elements);return jf($l(o,r?.unsafePreserveChecks?this.ast.checks:void 0),o)}})}function CS(e){return jf($l(e),e)}var ee=ms(e=>He(new Do(!1,[],[e.ast]),{value:e}));function zf(e,t){return He(e,{members:t,mapMembers(a,r){let o=a(this.members);return zf(ls(o,this.ast.mode,r?.unsafePreserveChecks?this.ast.checks:void 0),o)}})}function Me(e,t){return zf(ls(e,t?.mode??"anyOf",void 0),e)}function Ct(e){let t=e.map(se);return He(ls(t,"anyOf",void 0),{literals:e,members:t,mapMembers(a){return Me(a(this.members))},pick(a){return Ct(a)},transform(a){return Me(t.map((r,o)=>r.transform(a[o])))}})}var Fe=ms(e=>Me([e,bS]));function wS(e,t){return a=>He(Af(a.ast,e.ast,t?Cl(t):wl()),{from:a,to:e})}function TS(e){return t=>He(Pf(t.ast,vS(e)),{schema:t})}function vS(e){return La(e,t=>Tr(()=>ya(t,a=>a.issue)))}function $f(e){return se(e).pipe(TS(we(e)))}function qr(e,t){return SS(a=>a instanceof e,t)}function Hr(){return(e,t)=>new ht(e.ast,Cl(t))}var Gr=us;function su(e,t){let a=e.source,r=e.flags,o=r===""?`new RegExp(${pe(a)})`:`new RegExp(${pe(a)}, ${pe(r)})`;return zl(e,{toCode:()=>({runtime:`Schema.isPattern(${o})`}),...t})}function kS(e){let t=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/;return su(t,{expected:"a base64 encoded string",representation:{id:"effect/schema/isBase64",payload:null},toJsonSchema:()=>({pattern:t.source}),toCode:()=>({runtime:"Schema.isBase64()"}),...e})}var _o=He(is);function ES(e){let t=mc(e.order),a=e.formatter??pe;return(r,o)=>Gr(n=>t(n,r),{expected:`a value greater than or equal to ${a(r)}`,arbitrary:{constraint:{ordered:{order:e.order,minimum:r}}},...e.annotate?.(r),...o})}function PS(e){if(!globalThis.Number.isFinite(e))throw new globalThis.RangeError(`Expected a finite number, got ${pe(e)}`);return e}var va=ES({order:pc,annotate:e=>({representation:{id:"effect/schema/isGreaterThanOrEqualTo",payload:{minimum:PS(e)}},toJsonSchema:()=>({minimum:e}),toCode:()=>({runtime:`Schema.isGreaterThanOrEqualTo(${pe(e)})`})})});function AS(e){return Gr(t=>globalThis.Number.isSafeInteger(t),{expected:"an integer",representation:{id:"effect/schema/isInt",payload:null},toJsonSchema:()=>({type:"integer"}),toCode:()=>({runtime:"Schema.isInt()"}),arbitrary:{constraint:{integer:!0}},...e})}var gt=at.check(AS());function Kf(e,t){return e=Math.max(0,Math.floor(e)),Gr(a=>a.length>=e,{expected:`a value with a length of at least ${e}`,representation:{id:"effect/schema/isMinLength",payload:{minLength:e}},toJsonSchema:({type:a})=>a==="array"?{minItems:e}:{minLength:e},toCode:()=>({runtime:`Schema.isMinLength(${e})`}),[yo]:!0,arbitrary:{constraint:{minLength:e}},...t})}function Vf(e,t){return e=Math.max(0,Math.floor(e)),Gr(a=>a.length<=e,{expected:`a value with a length of at most ${e}`,representation:{id:"effect/schema/isMaxLength",payload:{maxLength:e}},toJsonSchema:({type:a})=>a==="array"?{maxItems:e}:{maxLength:e},toCode:()=>({runtime:`Schema.isMaxLength(${e})`}),[yo]:!0,arbitrary:{constraint:{maxLength:e}},...t})}var UA=qr(globalThis.RegExp,{representation:{id:"effect/schema/RegExp",payload:null},toCode:()=>({runtime:"Schema.RegExp",Type:"globalThis.RegExp"}),expected:"RegExp",toCodecJson:()=>Hr()(w({source:S,flags:S}),Eo({decode:e=>ul({try:()=>new globalThis.RegExp(e.source,e.flags),catch:()=>new je({message:"Expected valid RegExp source and flags"})}),encode:e=>we({source:e.source,flags:e.flags})})),toArbitrary:()=>e=>e.tuple(e.constantFrom(".",".*","\\d+","\\w+","[a-z]+","[A-Z]+","[0-9]+","^[a-zA-Z0-9]+$","^\\d{4}-\\d{2}-\\d{2}$"),e.uniqueArray(e.constantFrom("g","i","m","s","u","y"),{minLength:0,maxLength:6}).map(t=>t.join(""))).map(([t,a])=>new globalThis.RegExp(t,a)),toEquivalence:()=>(e,t)=>e.source===t.source&&e.flags===t.flags});var RS=S.annotate({expected:"a string that will be decoded as a URL"}),NA=qr(globalThis.URL,{representation:{id:"effect/schema/URL",payload:null},toCode:()=>({runtime:"Schema.URL",Type:"globalThis.URL"}),expected:"URL",toCodecJson:()=>Hr()(RS,sf),toArbitrary:()=>e=>e.webUrl().map(t=>new globalThis.URL(t)),toEquivalence:()=>(e,t)=>e.toString()===t.toString()});var DS=qr(globalThis.File,{representation:{id:"effect/schema/File",payload:null},toCode:()=>({runtime:"Schema.File",Type:"globalThis.File"}),expected:"File",toCodecJson:()=>Hr()(w({data:S.check(kS()),type:S,name:S,lastModified:gt}),Eo({decode:e=>kn(Kn(e.data),{onFailure:()=>Ie(new je({message:"Expected a valid Base64 string"})),onSuccess:t=>{let a=new globalThis.Uint8Array(t);return we(new globalThis.File([a],e.name,{type:e.type,lastModified:e.lastModified}))}}),encode:e=>qd({try:async()=>{let t=new globalThis.Uint8Array(await e.arrayBuffer());return{data:zn(t),type:e.type,name:e.name,lastModified:e.lastModified}},catch:()=>new je({message:"Expected File to be readable"})})}))});var _A=qr(globalThis.FormData,{representation:{id:"effect/schema/FormData",payload:null},toCode:()=>({runtime:"Schema.FormData",Type:"globalThis.FormData"}),expected:"FormData",toCodecJson:()=>Hr()(ee(CS([S,Me([w({_tag:$f("String"),value:S}),w({_tag:$f("File"),value:DS})])])),Eo({decode:e=>{let t=new globalThis.FormData;for(let[a,r]of e)t.append(a,r.value);return we(t)},encode:e=>we(globalThis.Array.from(e.entries()).map(([t,a])=>typeof a=="string"?[t,{_tag:"String",value:a}]:[t,{_tag:"File",value:a}]))}))});var qA=qr(globalThis.URLSearchParams,{representation:{id:"effect/schema/URLSearchParams",payload:null},toCode:()=>({runtime:"Schema.URLSearchParams",Type:"globalThis.URLSearchParams"}),expected:"URLSearchParams",toCodecJson:()=>Hr()(S.annotate({expected:"a query string that will be decoded as URLSearchParams"}),nf({decode:e=>new globalThis.URLSearchParams(e),encode:e=>e.toString()}))});var OS=S.annotate({expected:"a base64 encoded string that will be decoded as Uint8Array",format:"byte",contentEncoding:"base64"}),HA=qr(globalThis.Uint8Array,{representation:{id:"effect/schema/Uint8Array",payload:null},toCode:()=>({runtime:"Schema.Uint8Array",Type:"globalThis.Uint8Array"}),expected:"Uint8Array",toCodecJson:()=>Hr()(OS,lf),toArbitrary:()=>e=>e.uint8Array()});var MS=/^[A-Za-z0-9_-]{1,64}$/,iu=40,qo=8,hs=w({memberId:S,name:S,principal:K(w({kind:se("remote-agent"),principalId:S}))}),FS=Ct(["member-count","invalid-member-id","invalid-name","duplicate-member-id","duplicate-name","lead-not-member","lead-remote","duplicate-principal","invalid-principal"]);function BS(e){if(e.members.length<1||e.members.length>qo)return"member-count";let t=new Set,a=new Set,r=new Set;for(let o of e.members){if(!MS.test(o.memberId))return"invalid-member-id";let n=o.name.trim();if(n.length<1||n.length>iu)return"invalid-name";if(t.has(o.memberId))return"duplicate-member-id";let i=n.toLowerCase();if(a.has(i))return"duplicate-name";if(o.principal!==void 0){let{principalId:s}=o.principal;if(s.trim().length===0)return"invalid-principal";if(r.has(s))return"duplicate-principal";if(r.add(s),o.memberId===e.leadMemberId)return"lead-remote"}t.add(o.memberId),a.add(i)}return t.has(e.leadMemberId)?null:"lead-not-member"}var lu=w({projectId:S,members:ee(hs),leadMemberId:S,revision:gt.check(va(1)),updatedAt:S}).check(Gr(e=>BS(e)===null)),GA=w({version:se(1),roster:lu}),$A=w({projectId:S}),WA=w({projectId:S,members:ee(hs),leadMemberId:S,expectedRevision:gt.check(va(0))}),US=w({_tag:se("TeamRosterRejection"),commandType:se("setRoster"),code:Me([FS,Ct(["invalid-payload","stale-revision"])])}),Jf=Me([w({revision:gt.check(va(1))}),US]);be();var KA=cl(Gd,$d);var _S=/^[A-Za-z0-9_-]{1,64}$/,Zf=4e3,Xf=e=>{let t=e.trim();return t.length>=1&&t.length<=Zf?t:null},Yf=w({projectId:S,goalId:S.check(su(_S)),goal:S.check(Kf(1),Vf(Zf)),titleSeed:K(S),leadMemberId:S,threads:ee(w({memberId:S,threadId:S})),remoteMembers:K(ee(w({memberId:S,principalId:S}))),startedAt:S});var qS=w({version:se(1),goal:Yf}),fR=w({projectId:S}),Qf=Fe(w({...Yf.fields,members:ee(w({memberId:S,name:Fe(S),threadId:K(S),principalId:K(S)}))})),gs=e=>e.filter(t=>t.threadId!==void 0),HS=w({projectId:S,goal:S,titleSeed:K(S),requestId:S}),GS=w({_tag:se("TeamGoalRejection"),commandType:se("startGoal"),code:Ct(["invalid-payload","invalid-goal","invalid-request-id","no-roster","no-default-model","model-unavailable"])}),ep=Me([w({goalId:S,leadThreadId:S,leadName:Fe(S)}),GS]);var pR=Xs("ProviderSelectionError"),mR=_r(HS),hR=_r(w({pluginId:se("team"),name:se("team/goal-started"),data:qS}));function xs(e){let t=ha();return a=>t(e.find(r=>r.stateId===a.stateId)??a)}var ua=()=>Array.from(crypto.getRandomValues(new Uint8Array(16)),e=>e.toString(16).padStart(2,"0")).join("");function J(){let e=z().i18n.usePluginTranslation();return{t:(t,a)=>e(t,a)}}function uu({rosterMembers:e,remoteAgents:t}){let{t:a}=J();return r=>(r===void 0?void 0:e.find(o=>o.principal?.principalId===r)?.name??t.find(o=>o.principalId===r)?.label)??a("detail.actor.remoteAgentFallback")}function jt({members:e,rosterMembers:t,remoteAgents:a,people:r,viewerKey:o}){let{t:n}=J(),i=f=>f.threadId===void 0?void 0:e.find(m=>m.threadId===f.threadId)?.name,s=f=>o!==void 0&&f.personKey===o?n("detail.actor.you"):r.find(m=>m.key===f.personKey)?.displayName??n("detail.actor.human"),u=uu({rosterMembers:t,remoteAgents:a}),l=f=>u(f.principalId),d=f=>f==="team"?n("detail.actor.team"):n("detail.actor.plugin",{pluginId:f});return{pluginName:d,actorName:f=>{switch(f.kind){case"human":return s(f);case"agent":return i(f)??n("detail.actor.otherAgent");case"remote-agent":return l(f);case"plugin":return d(f.pluginId??"");case"local-cli":return n("detail.actor.localCli");default:return n("detail.actor.system")}},assigneeNames:f=>f.map(p=>p.kind==="remote-agent"?l(p):p.kind==="agent"?i(p)??n("board.other"):p.kind==="human"?s(p):n("board.other")).join(", ")}}var $r=e=>new Date(e).toLocaleString();be();function cu(e){let t=z().ui.ProjectToolkitSwitch;return t===void 0?null:he(t,e)}function Ge(e){return(t=>he(z().ui[e],{...t,className:`ycodium-team-ui ${typeof t.className=="string"?t.className:""}`}))}var ye=Ge("Badge"),ka=Ge("Alert"),Ea=Object.assign(Ge("AlertDescription"),{displayName:"AlertDescription"}),Ss=Ge("Card"),Is=Ge("CardPanel"),Xa=Ge("Menu"),Ya=Ge("MenuTrigger"),Qa=Ge("MenuPopup"),zt=Ge("MenuItem"),ys=Ge("Select"),Ls=Ge("SelectTrigger"),bs=Ge("SelectValue"),Cs=Ge("SelectPopup"),Ho=Ge("SelectItem"),tp=Ge("Collapsible"),ap=Ge("CollapsibleTrigger"),rp=Ge("CollapsiblePanel");function q(e){return he(z().ui.Button,e)}function er(e){return he(z().ui.Input,e)}function Ke(e){return he(z().ui.Label,e)}function Pa(e){return he(z().ui.Textarea,e)}function Go(e){return he(z().ui.AlertDialog,e)}function op(e){return he(z().ui.AlertDialogClose,e)}function $o(e){return he(z().ui.AlertDialogDescription,e)}function Wo(e){return he(z().ui.AlertDialogFooter,e)}function jo(e){return he(z().ui.AlertDialogPopup,e)}function zo(e){return he(z().ui.AlertDialogTitle,e)}function ws(e){return he(z().ui.ChoiceList,e)}function np(e){return he(z().ui.Empty,e)}function sp(e){return he(z().ui.EmptyHeader,e)}function ip(e){return he(z().ui.EmptyTitle,e)}function lp(e){return he(z().ui.EmptyDescription,e)}var{jsx:c,jsxs:I,Fragment:nt}=window.__ycodiumPluginHost.jsxRuntime;var $S=ze(ep),WS={"invalid-payload":"goal.invalidPayload","invalid-goal":"goal.invalidGoal","invalid-request-id":"goal.invalidRequestId","no-roster":"goal.noRoster","no-default-model":"goal.noDefaultModel","model-unavailable":"goal.modelUnavailable"};function up({environmentId:e,projectId:t,roster:a,current:r,rosterMembers:o,remoteAgents:n,goalItem:i,states:s,onOpenGoalItem:u,loadFailed:l,reload:d,disabled:f=!1}){let m=z(),{t:p}=J(),h=kt(),x=r??null,g=r===void 0&&!l,[y,T]=v(""),[E,A]=v(null),[_,N]=v(!1),[C,b]=v(!1),[P,L]=v(null),R=D(null),M=D(!1);W(()=>{let k={};return R.current=k,()=>{R.current=null}},[]);let F=a!==null&&a.members.some(k=>k.memberId===a.leadMemberId&&k.principal===void 0),te=Xf(y),le=f||g||_,oe=!le&&!l&&F&&te!==null,Q=async()=>{if(!oe||te===null||M.current)return;let k=R.current,H=E??{projectId:t,goal:te,requestId:ua()};M.current=!0,A(H),N(!0),b(!1),L(null);try{let $=$S(await m.commands.invoke("startGoal",H,{environmentId:e}));if(R.current!==k)return;if("code"in $){L(WS[$.code]);return}A(null),T("")}catch{if(R.current!==k)return;L("goal.startFailed")}finally{R.current===k&&(await d(),R.current===k&&(M.current=!1,N(!1)))}},Ee=x?.members.find(k=>k.memberId===x.leadMemberId)?.threadId;return I("div",{className:"flex flex-col gap-3",children:[c(du,{current:x,rosterMembers:o,remoteAgents:n,goalItem:i,states:s,onOpenGoalItem:u,children:Ee!==void 0?c(q,{variant:"outline",onClick:()=>m.openThread({environmentId:e,threadId:Ee}),children:p("goal.openLead")}):null}),c(Ke,{htmlFor:h,children:p("goal.label")}),c(Pa,{id:h,"aria-label":p("goal.label"),"aria-describedby":F?void 0:`${h}-hint`,rows:3,value:y,disabled:le||C,onChange:k=>{T(k.target.value),A(null),L(null)}}),F?null:c("p",{id:`${h}-hint`,className:"text-sm text-muted-foreground",children:p("goal.rosterRequired")}),l||P?c("p",{role:"alert",className:"text-sm text-destructive-foreground",children:p(P??"goal.loadFailed")}):null,g?c("p",{role:"status",children:p("goal.loading")}):null,I("div",{className:"flex gap-2",children:[c(q,{disabled:!oe||C,onClick:()=>{oe&&(x!==null&&E===null?b(!0):Q())},children:p(_?"goal.starting":E!==null?"goal.retry":x!==null?"goal.startNew":"goal.start")}),l?c(q,{variant:"outline",disabled:le,onClick:d,children:p("goal.reload")}):null]}),c(Go,{open:C,onOpenChange:b,children:I(jo,{children:[c(zo,{children:p("goal.confirmTitle")}),c($o,{children:p("goal.confirmDescription")}),I(Wo,{children:[c(op,{render:c(q,{variant:"outline"}),onClick:()=>b(!1),children:p("goal.cancel")}),c(q,{disabled:!oe,onClick:Q,children:p("goal.confirmStart")})]})]})})]})}function du({current:e,rosterMembers:t,remoteAgents:a,goalItem:r,states:o,onOpenGoalItem:n,children:i}){let{t:s}=J(),u=uu({rosterMembers:t,remoteAgents:a}),l=xs(o),d=e?.members.find(m=>m.memberId===e.leadMemberId),f=e?.members.filter(m=>m.principalId!==void 0)??[];return e===null?null:I("div",{className:"flex min-w-0 flex-wrap items-center gap-2",children:[c("p",{className:"min-w-0 whitespace-pre-wrap break-words text-sm",children:s("goal.current",{goal:e.goal})}),c("p",{className:"text-sm text-muted-foreground",children:s("goal.lead",{name:d?.name??s("goal.unknownLead")})}),r!==void 0?c(jS,{goalItem:r,label:l,onOpen:n}):null,i,f.length>0?I("p",{className:"flex flex-wrap items-center gap-2 text-sm text-muted-foreground",children:[c("span",{children:s("goal.remoteMembers")}),f.map(m=>I("span",{className:"flex items-center gap-1",children:[c("span",{children:m.name??u(m.principalId)}),c(ye,{variant:"outline",children:s("roster.remote")})]},m.memberId))]}):null]})}function jS({goalItem:e,label:t,onOpen:a}){let{t:r}=J();return I("span",{className:"flex items-center gap-1",children:[c(ye,{variant:e.state.group==="completed"?"success":e.state.group==="cancelled"?"muted":"info",children:r("goal.item",{number:e.sequenceId,state:t(e.state)})}),c(q,{type:"button",variant:"outline",size:"sm","aria-label":r("goal.openItem",{number:e.sequenceId}),onClick:()=>a(e.workItemId),children:r("detail.open")})]})}be();var or=rh(mp());be();var Vo=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function tr(e){let t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function vs(e){return"nodeType"in e}function Ve(e){var t,a;return e?tr(e)?e:vs(e)&&(t=(a=e.ownerDocument)==null?void 0:a.defaultView)!=null?t:window:window}function ks(e){let{Document:t}=Ve(e);return e instanceof t}function Wr(e){return tr(e)?!1:e instanceof Ve(e).HTMLElement}function pu(e){return e instanceof Ve(e).SVGElement}function ar(e){return e?tr(e)?e.document:vs(e)?ks(e)?e:Wr(e)||pu(e)?e.ownerDocument:document:document:document}var Kt=Vo?js:W;function Jo(e){let t=D(e);return Kt(()=>{t.current=e}),Se(function(){for(var a=arguments.length,r=new Array(a),o=0;o<a;o++)r[o]=arguments[o];return t.current==null?void 0:t.current(...r)},[])}function gp(){let e=D(null),t=Se((r,o)=>{e.current=setInterval(r,o)},[]),a=Se(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[t,a]}function jr(e,t){t===void 0&&(t=[e]);let a=D(e);return Kt(()=>{a.current!==e&&(a.current=e)},t),a}function zr(e,t){let a=D();return Y(()=>{let r=e(a.current);return a.current=r,r},[...t])}function Zo(e){let t=Jo(e),a=D(null),r=Se(o=>{o!==a.current&&t?.(o,a.current),a.current=o},[]);return[a,r]}function Xo(e){let t=D();return W(()=>{t.current=e},[e]),t.current}var fu={};function Yo(e,t){return Y(()=>{if(t)return t;let a=fu[e]==null?0:fu[e]+1;return fu[e]=a,e+"-"+a},[e,t])}function xp(e){return function(t){for(var a=arguments.length,r=new Array(a>1?a-1:0),o=1;o<a;o++)r[o-1]=arguments[o];return r.reduce((n,i)=>{let s=Object.entries(i);for(let[u,l]of s){let d=n[u];d!=null&&(n[u]=d+e*l)}return n},{...t})}}var rr=xp(1),Qo=xp(-1);function JS(e){return"clientX"in e&&"clientY"in e}function Es(e){if(!e)return!1;let{KeyboardEvent:t}=Ve(e.target);return t&&e instanceof t}function ZS(e){if(!e)return!1;let{TouchEvent:t}=Ve(e.target);return t&&e instanceof t}function en(e){if(ZS(e)){if(e.touches&&e.touches.length){let{clientX:t,clientY:a}=e.touches[0];return{x:t,y:a}}else if(e.changedTouches&&e.changedTouches.length){let{clientX:t,clientY:a}=e.changedTouches[0];return{x:t,y:a}}}return JS(e)?{x:e.clientX,y:e.clientY}:null}var Ra=Object.freeze({Translate:{toString(e){if(!e)return;let{x:t,y:a}=e;return"translate3d("+(t?Math.round(t):0)+"px, "+(a?Math.round(a):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;let{scaleX:t,scaleY:a}=e;return"scaleX("+t+") scaleY("+a+")"}},Transform:{toString(e){if(e)return[Ra.Translate.toString(e),Ra.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:a,easing:r}=e;return t+" "+a+"ms "+r}}}),hp="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function Sp(e){return e.matches(hp)?e:e.querySelector(hp)}be();var XS={display:"none"};function Ip(e){let{id:t,value:a}=e;return me.createElement("div",{id:t,style:XS},a)}function yp(e){let{id:t,announcement:a,ariaLiveType:r="assertive"}=e,o={position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};return me.createElement("div",{id:t,style:o,role:"status","aria-live":r,"aria-atomic":!0},a)}function Lp(){let[e,t]=v("");return{announce:Se(r=>{r!=null&&t(r)},[]),announcement:e}}var Mp=Yt(null);function YS(e){let t=vt(Mp);W(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)},[e,t])}function QS(){let[e]=v(()=>new Set),t=Se(r=>(e.add(r),()=>e.delete(r)),[e]);return[Se(r=>{let{type:o,event:n}=r;e.forEach(i=>{var s;return(s=i[o])==null?void 0:s.call(i,n)})},[e]),t]}var eI={draggable:`
293
+ at ${a}`}return t}function wo(e){switch(e._tag){case"InvalidType":case"OneOf":case"Composite":case"AnyOf":return Lo(e.ast.annotations);case"InvalidValue":case"Forbidden":return Lo(e.annotations);case"MissingKey":return Lo(e.annotations,"messageMissingKey");case"UnexpectedKey":return Lo(e.ast.annotations,"messageUnexpectedKey");case"Filter":return Lo(e.filter.annotations);case"Encoding":return wo(e.issue)}}function Lo(e,t="message"){let a=e?.[t];if(typeof a=="string")return a}function To(e){let t;for(let a of e.reasons){if(!Un(a)||!Il(a.error))return;t??=a.error}return t}function Yn(e,t){let a=To(e);if(a===void 0)throw new Error(t,{cause:e});return a}var re=Symbol();var ia=rl,Dr=ia(re),Ze=ia(re),Qn=e=>e===re?Gt():Rt(e),yl=e=>e._tag==="None"?Dr:ia(e.value);var Or=class e extends Yr{run;constructor(t){super(),this.run=t}map(t){return new e((a,r)=>this.run(a,r).pipe(kr(Si(t))))}compose(t){return ef(this)?t:ef(t)?this:new e((a,r)=>this.run(a,r).pipe(Dt(o=>t.run(o,r))))}};var tf=new Or(we);function ef(e){return e.run===tf.run}function Mr(){return tf}function Bx(e){return new Or((t,a)=>io(t)?ll:e(t.value,a))}function pt(e){return af(Si(e))}function vo(e){return Bx((t,a)=>e(t,a).pipe(kr(Rt)))}function af(e){return new Or(t=>we(e(t)))}function Ll(e){return new Or(t=>{let a=hc(t,Zs);return xr(a)?we(a):kr(e,Rt)})}function es(){return pt(globalThis.String)}function ts(){return pt(globalThis.Number)}function rf(){return pt(zn)}function of(){return vo(e=>dl(Hd(Kn(e)),()=>new je({message:"Expected a valid Base64 string"})))}var ko="~effect/SchemaTransformation/Transformation",mt=class e{[ko]=ko;_tag="Transformation";decode;encode;constructor(t,a){this.decode=t,this.encode=a}flip(){return new e(this.encode,this.decode)}compose(t){return new e(this.decode.compose(t.decode),t.encode.compose(this.encode))}};function _x(e){return X(e,ko)&&e[ko]===ko}var Cl=e=>_x(e)?e:new mt(e.decode,e.encode);function Eo(e){return new mt(vo(e.decode),vo(e.encode))}function nf(e){return new mt(pt(e.decode),pt(e.encode))}var qx=new mt(Mr(),Mr());function wl(){return qx}var as=new mt(ts(),es());var sf=Eo({decode:e=>URL.canParse(e)?we(new URL(e)):Ie(new je({message:"Expected a valid URL string"})),encode:e=>we(e.href)});var lf=new mt(of(),rf());function Za(e){return t=>t._tag===e}var gf=Za("Declaration");var Wx=Za("Never");var Fr=Za("Literal"),Tl=Za("UniqueSymbol");var xf=Za("Arrays"),jx=Za("Objects");var zx=Za("Suspend"),ht=class{to;transformation;constructor(t,a){this.to=t,this.transformation=a}},Nl={},la=class{isOptional;isMutable;defaultValue;annotations;constructor(t,a,r=void 0,o=void 0){this.isOptional=t,this.isMutable=a,this.defaultValue=r,this.annotations=o}},cf="~effect/Schema",bt=class{[cf]=cf;annotations;checks;encoding;context;constructor(t=void 0,a=void 0,r=void 0,o=void 0){this.annotations=t,this.checks=a,this.encoding=r,this.context=o}toString(){return`<${this._tag}>`}},rs=class e extends bt{_tag="Declaration";typeParameters;run;encodingChecks;constructor(t,a,r,o,n,i,s){super(r,o,n,i),this.typeParameters=t,this.run=a,this.encodingChecks=s}getParser(){let t;return(a,r)=>a===re?Dr:(t??=this.run(this.typeParameters))(a,this,r)}_rebuild(t,a,r){let o=Br(this.typeParameters,t);return o===this.typeParameters&&a===this.checks&&r===this.encodingChecks?this:new e(o,this.run,this.annotations,a,void 0,this.context,r)}recur(t){return this._rebuild(t,this.checks,this.encodingChecks)}flip(t){return this._rebuild(t,this.encodingChecks,this.checks)}getExpected(){let t=this.annotations?.expected;return typeof t=="string"?t:"<Declaration>"}},vl=class extends bt{_tag="Null";getParser(){return Of(this,null)}getExpected(){return"null"}},Sf=new vl;var kl=class extends bt{_tag="Unknown";getParser(){return Mo(this,Hu)}getExpected(){return"unknown"}},Ao=new kl;var ba=class extends bt{_tag="Literal";literal;constructor(t,a,r,o,n){if(super(a,r,o,n),typeof t=="number"&&!globalThis.Number.isFinite(t))throw new Error(`A numeric literal must be finite, got ${pe(t)}`);this.literal=t}getParser(){return Of(this,this.literal)}matchPart(t,a){return t===globalThis.String(this.literal)?this.literal:void 0}toCodecJson(){return typeof this.literal=="bigint"?df(this):this}toCodecStringTree(){return typeof this.literal=="string"?this:df(this)}getExpected(){return typeof this.literal=="string"?JSON.stringify(this.literal):globalThis.String(this.literal)}};function df(e){let t=globalThis.String(e.literal);return Xe(e,[new ht(new ba(t),new mt(pt(()=>e.literal),pt(()=>t)))])}var El=class extends bt{_tag="String";getParser(){return Mo(this,fn)}matchPart(t,a){let r=this.checks;return r&&!a.disableChecks&&Ta(r,t,void 0,this,a)?void 0:t}getExpected(){return"string"}},Ro=new El,Pl=class extends bt{_tag="Number";getParser(){return Mo(this,pn)}matchKey(t,a){return this._match(nS,t,a)}matchPart(t,a){return this._match(Ul,t,a)}_match(t,a,r){if(!t.test(a))return;let o=globalThis.Number(a);return r.disableChecks||!this.checks?o:Ta(this.checks,o,void 0,this,r)?void 0:o}toCodecJson(){return this.checks&&(Al(this.checks,"effect/schema/isFinite")||Al(this.checks,"effect/schema/isInt"))?this:Xe(this,[Kx(this.checks)])}toCodecStringTree(){return this.toCodecJson()===this?Xe(this,[sS]):Xe(this,[iS])}getExpected(){return"number"}};function Al(e,t){return e.some(a=>a.annotations?.representation?.id===t||a._tag==="FilterGroup"&&Al(a.checks,t))}function Kx(e){let t=e?Nr(is,e):is;return new ht(new Ja([t,wf],"anyOf"),new mt(ts(),pt(a=>globalThis.Number.isFinite(a)?a:globalThis.String(a))))}var _l=new Pl,Rl=class extends bt{_tag="Boolean";getParser(){return Mo(this,_u)}getExpected(){return"boolean"}},If=new Rl;var Do=class e extends bt{_tag="Arrays";isMutable;elements;rest;encodingChecks;constructor(t,a,r,o,n,i,s,u){super(o,n,i,s),this.isMutable=t,this.elements=a,this.rest=r,this.encodingChecks=u;let l=!1;for(let d=0;d<a.length;d++)if(wa(a[d]))l=!0;else if(l)throw new Error("A required element cannot follow an optional element. ts(1257)");if(l&&r.length>1)throw new Error("A required element cannot follow an optional element. ts(1257)");for(let d=1;d<r.length;d++)if(wa(r[d]))throw new Error("An optional element cannot follow a rest element. ts(1266)")}getParser(t){let a=this,r,o,n=a.elements.length,i=Math.max(0,a.rest.length-1);function s(u,l){return l<n?r[l]:l>=u?o[l-u+1]:o[0]}return fl(function*(u,l){if(u===re)return re;if(!Array.isArray(u))return yield*Ie(new sa(a));r||(r=a.elements.map(h=>({ast:h,parser:t(h)})),o=a.rest.map(h=>({ast:h,parser:t(h)})));let d=u.length,f={ast:a,getParser:s,input:u,len:d,tailThreshold:Math.max(n,d-i),output:new globalThis.Array(d),issues:void 0,options:l},m=ql(l?.concurrency),p=Vx(f,u,{concurrency:m?.concurrency,end:a.rest.length===0?n:Math.max(d,n+i)});if(p&&(yield*p),a.rest.length===0&&d>n)for(let h=n;h<=d-1;h++){let x=new Ot([h],new Co(a));if(l.errors==="all")f.issues?f.issues.push(x):f.issues=[x];else return yield*Ie(new Oe(a,[x]))}return f.issues?yield*Ie(new Oe(a,f.issues)):f.output})}_rebuild(t,a,r){let o=Br(this.elements,t),n=Br(this.rest,t);return o===this.elements&&n===this.rest&&a===this.checks&&r===this.encodingChecks?this:new e(this.isMutable,o,n,this.annotations,a,void 0,this.context,r)}recur(t){return this._rebuild(t,this.checks,this.encodingChecks)}flip(t){return this._rebuild(t,this.encodingChecks,this.checks)}getExpected(){return"array"}},Vx=go()({onItem(e,t,a){let r=a<e.len?t:re;return e.getParser(e.tailThreshold,a).parser(r,e.options)},step(e,t,a,r){if(a._tag==="Failure")return os(e,e.ast,r,a);let o=a===Ze?t:a[U];if(o!==re)e.output[r]=o;else{let n=e.getParser(e.tailThreshold,r);if(wa(n.ast))return;let i=new Ot([r],new Pr(n.ast.context?.annotations));if(e.options.errors==="all")e.issues?e.issues.push(i):e.issues=[i];else return br(new Oe(e.ast,[i]))}}}),ql=e=>(e=e==="unbounded"?1/0:e??1,e>1?{concurrency:e}:void 0),os=(e,t,a,r)=>{if(r.cause.reasons.length===0)return r;let o=To(r.cause);if(o===void 0)return _n(ya(r.cause,i=>new Oe(t,[new Ot([a],i)])));let n=new Ot([a],o);if(e.options.errors==="all")e.issues?e.issues.push(n):e.issues=[n];else return br(new Oe(t,[n]))},yf="[+-]?\\d*\\.?\\d+(?:[Ee][+-]?\\d+)?";function Dl(e,t,a=Nl){let r,o;function n(i){switch(i._tag){case"String":case"TemplateLiteral":return(r??=Object.keys(e)).filter(s=>i.matchPart(s,a)!==void 0);case"Number":return(r??=Object.keys(e)).filter(s=>i.matchKey(s,a)!==void 0);case"Symbol":return(o??=Object.getOwnPropertySymbols(e)).filter(s=>i.matchKey(s,a)!==void 0);case"Union":return[...new Set(i.types.flatMap(n))];default:return[]}}return n(Xl(ds(t)))}var ns=class{name;type;constructor(t,a){this.name=t,this.type=a}};function Ol(e){switch(e._tag){case"String":case"Number":case"Symbol":case"TemplateLiteral":return!0;case"Union":return e.types.every(Ol);default:return!1}}function Jx(e){return Ol(e)&&Ol(ds(e))}var Ml=class{parameter;type;constructor(t,a){if(!Jx(t))throw new Error(`Invalid index signature parameter ${t._tag}`);if(this.parameter=t,this.type=a,wa(a)&&!Df(a))throw new Error("Cannot use `Schema.optionalKey` with index signatures, use `Schema.optional` instead.")}},Fl=class e extends bt{_tag="Objects";propertySignatures;indexSignatures;encodingChecks;constructor(t,a,r,o,n,i,s){super(r,o,n,i),this.propertySignatures=t,this.indexSignatures=a,this.encodingChecks=s;let u=t.map(l=>l.name).filter((l,d,f)=>f.indexOf(l)!==d);if(u.length>0)throw new Error(`Duplicate identifiers: ${JSON.stringify(u)}. ts(2300)`)}getParser(t){let a=this,r=[];for(let p of a.propertySignatures)r.push(p.name);let o=r.length,n=a.indexSignatures.length,i=o&&n?new Set(r):void 0;if(!o&&!n)return Mo(a,qu);let s,u,l=(p,h,x,g,y)=>{if(y._tag==="Failure")return os(p,a,h,y)??Cr;let T=y===Ze?g:y[U];if(x!==re&&T!==re){if(o&&(i.has(h)||i.has(x)))return Cr;Ua(p.out,x,T)}return Cr},d=(p,h,x,g)=>{if(!g){let A=x.parserKey(h,p.options);if(!ke(A))return Ka(Wn(A),_=>d(p,h,x,_));g=A}if(g._tag==="Failure")return os(p,a,h,g)??Cr;let y=g===Ze?h:g[U],T=p.input[h],E=x.parserValue(T,p.options);return ke(E)?l(p,h,y,T,E):Ka(Wn(E),A=>l(p,h,y,T,A))},f=(p,h,x)=>{let g=p.input[h],y=x.parserValue(g,p.options);return ke(y)?l(p,h,h,g,y):Ka(Wn(y),T=>l(p,h,h,g,T))},m=n?go()({onItem:(p,[h,x])=>d(p,h,x),step:(p,h,x)=>x._tag==="Failure"?x:void 0}):void 0;return fl(function*(p,h){if(p===re)return re;if(!(typeof p=="object"&&p!==null&&!Array.isArray(p)))return yield*Ie(new sa(a));s||(s=a.propertySignatures.map(C=>({parser:t(C.type),name:C.name,type:C.type})),u=n?a.indexSignatures.map(C=>({is:C,parserKey:t(Xl(C.parameter)),parserValue:t(C.type)})):void 0);let x=p,g={},y={ast:a,input:x,out:g,issues:void 0,options:h},T=h.errors==="all",E=h.onExcessProperty==="error",A=h.onExcessProperty==="preserve",_;if(!n&&(E||A)){i??=new Set(r),_=Reflect.ownKeys(x);for(let C=0;C<_.length;C++){let b=_[C];if(!i.has(b))if(E){let P=new Ot([b],new Co(a));if(T){y.issues?y.issues.push(P):y.issues=[P];continue}else return yield*Ie(new Oe(a,[P]))}else Ua(g,b,x[b])}}let N=ql(h?.concurrency);if(o){let C=Zx(y,s,N);C&&(yield*C)}if(n&&!N)for(let C=0;C<n;C++){let b=u[C],P=b.is.parameter===Ro?f:d,L=b.is.parameter===Ro?Object.keys(x):Dl(x,b.is.parameter,h);for(let R=0;R<L.length;R++){let M=P(y,L[R],b);if(!ke(M))yield*M;else if(M._tag==="Failure")return yield*M}}else if(m){let C=Pn();for(let P=0;P<n;P++){let L=u[P],R=Dl(x,L.is.parameter,h);for(let M=0;M<R.length;M++)C.push([R[M],L])}let b=m(y,C,N);b&&(yield*b)}if(y.issues)return yield*Ie(new Oe(a,y.issues));if(h.propertyOrder==="original"){let C=(_??Reflect.ownKeys(x)).concat(r),b={};for(let P of C)Object.hasOwn(g,P)&&Ua(b,P,g[P]);return b}return g})}_rebuild(t,a,r,o){let n=Br(this.propertySignatures,s=>{let u=t(s.type);return u===s.type?s:new ns(s.name,u)}),i=Br(this.indexSignatures,s=>{let u=a(s.parameter),l=t(s.type);return u===s.parameter&&l===s.type?s:new Ml(u,l)});return n===this.propertySignatures&&i===this.indexSignatures&&r===this.checks&&o===this.encodingChecks?this:new e(n,i,this.annotations,r,void 0,this.context,o)}flip(t){return this._rebuild(t,t,this.encodingChecks,this.checks)}recur(t,a=t){return this._rebuild(t,a,this.checks,this.encodingChecks)}getExpected(){return this.propertySignatures.length===0&&this.indexSignatures.length===0?"object | array":"object"}},Zx=go()({onItem(e,t){if(!Object.hasOwn(e.input,t.name))return t.parser(re,e.options);let a=e.input[t.name];return Ua(e.out,t.name,a),t.parser(a,e.options)},step(e,t,a){if(a._tag==="Failure")return os(e,e.ast,t.name,a);if(a===Ze)return;let r=a[U];if(r!==re){Ua(e.out,t.name,r);return}if(delete e.out[t.name],!wa(t.type)){let o=new Ot([t.name],new Pr(t.type.context?.annotations));if(e.options.errors==="all"){e.issues?e.issues.push(o):e.issues=[o];return}else return br(new Oe(e.ast,[o]))}}});function Lf(e,t){return e?t?[...e,...t]:e:t}function Hl(e,t,a){return new Fl(Reflect.ownKeys(e).map(r=>new ns(r,e[r].ast)),[],a,t)}function Gl(e){return e.ast}function $l(e,t=void 0){return new Do(!1,e.map(a=>a.ast),[],void 0,t)}function ls(e,t,a){return new Ja(e.map(Gl),t,void 0,a)}var Wl=qt(e=>{for(;;){if(zx(e))return Ao;let t=e.encoding;if(!t)return e.recur?.(Wl,_e)??e;if(t.some(a=>a.transformation._tag==="Middleware"&&a.transformation.decode!==_e))return Ao;e=t[t.length-1].to}});function bf(e){switch(e._tag){case"Null":return["null"];case"Undefined":return["undefined"];case"String":case"TemplateLiteral":return["string"];case"Number":return["number"];case"Boolean":return["boolean"];case"Symbol":case"UniqueSymbol":return["symbol"];case"BigInt":return["bigint"];case"Arrays":return["array"];case"ObjectKeyword":return["object","array","function"];case"Objects":return e.propertySignatures.length||e.indexSignatures.length?["object"]:["string","number","boolean","symbol","bigint","object","array","function"];case"Enum":return Array.from(new Set(e.enums.map(([,t])=>typeof t)));case"Literal":return[typeof e.literal];case"Union":return Array.from(new Set(e.types.flatMap(bf)));default:return["null","undefined","string","number","boolean","symbol","bigint","object","array","function"]}}function jl(e){switch(e._tag){default:return[];case"Declaration":{let t=e.annotations?.[ml];return Array.isArray(t)?t:[]}case"Objects":return e.propertySignatures.flatMap(t=>{let a=t.type;if(!wa(a)){if(Fr(a))return[{key:t.name,literal:a.literal}];if(Tl(a))return[{key:t.name,literal:a.symbol}]}return[]});case"Arrays":return e.elements.flatMap((t,a)=>{if(!wa(t)){if(Fr(t))return[{key:a,literal:t.literal}];if(Tl(t))return[{key:a,literal:t.symbol}]}return[]});case"Suspend":return jl(e.thunk())}}var ff=new WeakMap,Po=Object.freeze([]);function Xx(e){let t=ff.get(e);if(t)return t;t={};let a;for(let r=0;r<e.length;r++){let o=e[r],n=Wl(o);if(Wx(n))continue;if(a!==null)if(Fr(n)||Tl(n)){a??=new Map;let s=Fr(n)?n.literal:n.symbol,u=a.get(s);u||a.set(s,u=[]),u.push(o)}else a=null;let i=jl(n);if(i.length){t.bySentinel??=new Map;for(let{key:s,literal:u}of i){let l=t.bySentinel.get(s);l||t.bySentinel.set(s,l=new Map);let d=l.get(u);d||l.set(u,d=[]),d[d.length-1]!==r&&d.push(r)}}else{t.otherwise??={};let s=bf(n);for(let u of s)(t.otherwise[u]??=[]).push(r)}}if(a)a.forEach(Object.freeze),t=r=>a.get(r)??Po;else if(t.bySentinel?.size===1&&!t.otherwise)for(let[r,o]of t.bySentinel){let n=o;for(let[i,s]of o)n.set(i,Object.freeze(s.map(u=>e[u])));t=i=>mn(i)&&Object.hasOwn(i,r)?n.get(i[r])??Po:Po}return ff.set(e,t),t}function Yx(e){return t=>{let a=Wl(t);return a._tag==="Literal"?a.literal===e:a._tag==="UniqueSymbol"?a.symbol===e:!0}}function Cf(e,t){let a=Xx(t);if(typeof a=="function")return a(e);let r=e===null?"null":Array.isArray(e)?"array":typeof e;if(a.bySentinel){let o=a.otherwise?.[r]??Po;if(mn(e)){let n=new Set(o);for(let[i,s]of a.bySentinel)if(Object.hasOwn(e,i)){let u=s.get(e[i]);if(u)for(let l of u)n.add(l)}return Array.from(n).sort((i,s)=>i-s).map(i=>t[i])}return o.map(n=>t[n])}return(a.otherwise?.[r]??Po).map(o=>t[o]).filter(Yx(e))}var Ja=class e extends bt{_tag="Union";types;mode;encodingChecks;constructor(t,a,r,o,n,i,s){super(r,o,n,i),this.types=t,this.mode=a,this.encodingChecks=s}getParser(t){let a=this;return(r,o)=>{if(r===re)return Dr;let n=Cf(r,a.types);if(n.length===1){let l=t(n[0])(r,o);return l._tag==="Success"?l:ke(l)?pf(a,l.cause):La(l,d=>pf(a,d))}let i={ast:a,recur:t,input:r,out:void 0,successes:a.mode==="oneOf"?[]:void 0,issues:void 0,options:o},s=ql(o?.concurrency),u=Qx(i,n,s?{...s,orderedStep:!0}:void 0);return u?Dt(u,l=>i.out===Ze?we(r):i.out??Ie(new Ar(a,i.issues??[]))):i.out??Ie(new Ar(a,i.issues??[]))}}_rebuild(t,a,r){let o=Br(this.types,t);return o===this.types&&a===this.checks&&r===this.encodingChecks?this:new e(o,this.mode,this.annotations,a,void 0,this.context,r)}recur(t){return this._rebuild(t,this.checks,this.encodingChecks)}flip(t){return this._rebuild(t,this.encodingChecks,this.checks)}matchPart(t,a){for(let r of this.types){let o=r.matchPart(t,a);if(o!==void 0)return o}}getExpected(t){let a=this.annotations?.expected;if(typeof a=="string")return a;if(this.types.length===0)return"never";let r=this.types.map(o=>{let n=ds(o);switch(n._tag){case"Arrays":{let i=n.elements.filter(Fr);if(i.length>0)return`${mf(n.isMutable)}[ ${i.map(s=>t(s)+hf(s.context?.isOptional)).join(", ")}, ... ]`;break}case"Objects":{let i=n.propertySignatures.filter(s=>Fr(s.type));if(i.length>0)return`{ ${i.map(s=>`${mf(s.type.context?.isMutable)}${pr(s.name)}${hf(s.type.context?.isOptional)}: ${t(s.type)}`).join(", ")}, ... }`;break}}return t(n)});return Array.from(new Set(r)).join(" | ")}};function pf(e,t){let a=To(t);return a?br(new Ar(e,[a])):_n(t)}var Qx=go()({onItem(e,t){return e.recur(t)(e.input,e.options)},step(e,t,a){if(a._tag==="Failure"){let r=To(a.cause);if(r===void 0)return a;e.issues?e.issues.push(r):e.issues=[r]}else{if(e.out&&e.successes)return e.successes.push(t),br(new Xn(e.ast,e.successes));if(e.out=a,e.successes)e.successes.push(t);else return Cr}}}),wf=new Ja([new ba("Infinity"),new ba("-Infinity"),new ba("NaN")],"anyOf");function mf(e){return e?"":"readonly "}function hf(e){return e?"?":""}var Bl=class e extends Yr{_tag="Filter";run;annotations;aborted;constructor(t,a=void 0,r=!1){super(),this.run=t,this.annotations=a,this.aborted=r}annotate(t){return new e(this.run,{...this.annotations,...t},this.aborted)}abort(){return new e(this.run,this.annotations,!0)}and(t,a){return new ss([this,t],a)}},ss=class e extends Yr{_tag="FilterGroup";checks;annotations;constructor(t,a=void 0){super(),this.checks=t,this.annotations=a}annotate(t){return new e(this.checks,{...this.annotations,...t})}and(t,a){return new e([this,t],a)}};function us(e,t,a=!1){return new Bl((r,o,n)=>Zd(o,e(r,o,n)),t,a)}function Tf(e){return us(t=>globalThis.Number.isFinite(t),{expected:"a finite number",representation:{id:"effect/schema/isFinite",payload:null},toJsonSchema:()=>({type:"number"}),toCode:()=>({runtime:"Schema.isFinite()"}),arbitrary:{constraint:{noInfinity:!0,noNaN:!0}},...e})}var is=Nr(_l,[Tf()]);function zl(e,t){let a=e.source,r=new globalThis.RegExp(a,e.flags);return us(o=>(r.lastIndex=0,r.test(o)),{expected:`a string matching the RegExp ${a}`,representation:{id:"effect/schema/isPattern",payload:{source:a,flags:e.flags}},toJsonSchema:()=>({pattern:a}),arbitrary:{constraint:{patterns:[e.source]}},...t})}function Oo(e,t){let a=Object.getOwnPropertyDescriptors(e);return t(a),Object.create(Object.getPrototypeOf(e),a)}function Xe(e,t){return e.encoding===t?e:Oo(e,a=>{a.encoding.value=t})}function Kl(e,t){return e.context===t?e:Oo(e,a=>{a.context.value=t})}function Vl(e,t){if(e.checks){let a=e.checks[e.checks.length-1];return vf(e,Li(e.checks.slice(0,-1),a.annotate(t)))}return Oo(e,a=>{a.annotations.value={...a.annotations.value,...t}})}function vf(e,t){if(e._tag==="Suspend"&&t)throw new Error("Cannot add checks to Suspend");return e.checks===t?e:Oo(e,a=>{a.checks.value=t})}function Nr(e,t){return vf(e,Lf(e.checks,t))}function cs(e,t){let a=t(e.to);return a===e.to?e:new ht(a,e.transformation)}function kf(e,t){let a=e,r=a[a.length-1],o=cs(r,t);return o===r?e:Li(e.slice(0,e.length-1),o)}function eS(e){return t=>t.encoding?Xe(t,kf(t.encoding,e)):t}function Ef(e){function t(a){return a.encoding?Xe(a,kf(a.encoding,t)):e(a)}return qt(t)}function tS(e,t,a){let r=new ht(e,t);return Xe(a,a.encoding?[...a.encoding,r]:[r])}function Br(e,t){let a=!1,r=new Array(e.length);for(let o=0;o<e.length;o++){let n=e[o],i=t(n);i!==n&&(a=!0),r[o]=i}return a?r:e}function Jl(e,t){let a=e.context?new la(e.context.isOptional,e.context.isMutable,e.context.defaultValue,{...e.context.annotations,...t}):new la(!1,!1,void 0,t);return Kl(e,a)}var aS=eS(Zl);function Zl(e){let t=e.context?e.context.isOptional===!1?new la(!0,e.context.isMutable,e.context.defaultValue,e.context.annotations):e.context:new la(!0,!1);return aS(Kl(e,t))}function Pf(e,t){let a=new mt(Ll(t),Mr()),r=[new ht(Ao,a)],o=e.context?new la(e.context.isOptional,e.context.isMutable,r,e.context.annotations):new la(!1,!1,r);return Kl(e,o)}function Af(e,t,a){return tS(e,a,t)}function wa(e){return e.context?.isOptional??!1}function Rf(e){return e.annotations?.[yo]===!0||e._tag==="FilterGroup"&&e.checks.every(Rf)}function rS(e){function t(r){return Rf(r)?[r]:r._tag==="FilterGroup"?r.checks.flatMap(t):[]}let a=e.flatMap(t);return bi(a)?a:void 0}var Ur=qt(e=>{if(e.encoding)return Ur(Xe(e,void 0));let t=e,a=t.recur?.(Ur)??t,r=a.encodingChecks;if(r){let o=a===e?r:xf(a)||jx(a)||gf(a)&&a.typeParameters.length>0?rS(r):void 0;return Oo(a,n=>{n.encodingChecks.value=void 0,n.checks.value=Lf(a.checks,o)})}return a}),ds=qt(e=>Ur(Ca(e)));function oS(e,t){let a=t,r=a.length,o=a[r-1],n=[new ht(Ca(Xe(e,void 0)),a[0].transformation.flip())];for(let s=1;s<r;s++)n.unshift(new ht(Ca(a[s-1].to),a[s].transformation.flip()));let i=Ca(o.to);return i.encoding?Xe(i,[...i.encoding,...n]):Xe(i,n)}var Ca=qt(e=>{if(e.encoding)return oS(e,e.encoding);let t=e;return t.flip?.(Ca)??t.recur?.(Ca)??t});function Df(e){switch(e._tag){case"Undefined":return!0;case"Union":return e.types.some(Df);default:return!1}}function Of(e,t){let a=ia(t);return r=>r===re?Dr:r===t?a:Ie(new sa(e))}function Mo(e,t){return a=>a===re?Dr:t(a)?Ze:Ie(new sa(e))}var Xl=Ef(e=>{switch(e._tag){default:return e;case"Number":return e.toCodecStringTree();case"Union":return e.recur(Xl)}});var Ul=new globalThis.RegExp(`^${yf}$`),nS=new globalThis.RegExp(`^(?:${yf}|Infinity|-Infinity|NaN)$`);function Mf(e){return zl(Ul,{expected:"a string representing a finite number",representation:{id:"effect/schema/isStringFinite",payload:null},toJsonSchema:()=>({pattern:Ul.source}),...e})}var Ff=Nr(Ro,[Mf()]),sS=new ht(Ff,as),iS=new ht(new Ja([Ff,wf],"anyOf"),as),lS="-?\\d+",AE=new globalThis.RegExp(`^${lS}$`);var uS="Symbol\\((.*)\\)",RE=new globalThis.RegExp(`^${uS}$`);function Ta(e,t,a,r,o){for(let n=0;n<e.length;n++){let i=e[n];if(i._tag==="FilterGroup"){if(a=Ta(i.checks,t,a,r,o),a&&(o.errors!=="all"||a[a.length-1].filter.aborted))return a}else{let s=i.run(t,r,o);if(s){let u=new Jn(i,s);if(a?a.push(u):a=[u],o.errors!=="all"||i.aborted)return a}}}return a}var Yl="~effect/Schema/Class";var Fo="~effect/SchemaError/SchemaError",Bo=class extends Nn("SchemaError"){[Fo]=Fo;constructor(t){super({issue:t})}get message(){return this.issue.toString()}toString(){return`SchemaError(${this.message})`}};function Bf(e){return X(e,Fo)&&e[Fo]===Fo}var Uo=qt(e=>{switch(e._tag){case"Declaration":{let t=e.annotations?.[Yl];if(to(t)){let a=t(e.typeParameters);return Xe(e,[cs(a,Uo)])}return e}case"Objects":case"Arrays":return e.recur(t=>{let a=t.context?.defaultValue;if(a){let r=Uo(t);return Xe(r,r.encoding?[...r.encoding,...a]:a)}return Uo(t)});case"Suspend":return e.recur(Uo);default:return e}});function ps(e){let t=Uo(Ur(e.ast)),a=Hf(t);return(r,o)=>a(r,o?.disableChecks?o?.parseOptions?{...o.parseOptions,disableChecks:!0}:{disableChecks:!0}:o?.parseOptions)}function tu(e){let t=ps(e);return(a,r)=>{let o=vr(t(a,r));return wr(o)?Rt(o.value):(Yn(o.cause,"Option adapter can only return none for schema issues"),Gt())}}function _f(e){let t=ps(e);return(a,r)=>{let o=vr(t(a,r));if(wr(o))return o.value;let n=Yn(o.cause,"Constructor adapter can only throw schema issues");throw new Error(n.toString(),{cause:n})}}function au(e,t){let a=Hf(e.ast);return t===void 0?a:(r,o)=>a(r,fs(t,o))}function qf(e,t){return fS(au(e,t))}var fs=(e,t)=>t?{...e,...t}:e,Uf=e=>e===re?Ie(new je):we(e);function Hf(e){let t;return(a,r)=>{let o=(t??=eu(e))(a,r??Nl);return o===Ze?we(a):ke(o)?o[U]===re?Uf(re):o:Dt(o,Uf)}}function dS(e){return(t,a)=>vr(e(t,a))}function fS(e){let t=dS(e);return(a,r)=>{let o=t(a,r);return wr(o)?Rt(o.value):(Yn(o.cause,"Option adapter can only return none for schema issues"),Gt())}}var Nf=new WeakMap;function eu(e){let t=Nf.get(e);return t||Nf.set(e,t=pS(e)),t}function pS(e){let t=e.getParser(eu),a=e.checks,r=e.encoding,o=e.encodingChecks,n=(a?a[a.length-1].annotations:e.annotations)?.parseOptions;if(!r&&!a&&!o)return n?(u,l)=>t(u,fs(l,n)):t;let i,s=(u,l)=>{let d=t(u,l);if(o&&!l.disableChecks)if(ke(d)){if(d._tag==="Success"){let f=d===Ze?u:d[U];if(u!==re&&f!==re){let m=Ta(o,u,void 0,e,l);m&&(d=Ie(new Oe(e,m)))}}}else d=Ka(d,f=>{if(u!==re&&f!==re){let m=Ta(o,u,void 0,e,l);if(m)return Ie(new Oe(e,m))}return we(f)});if(a&&!l.disableChecks)if(ke(d)){if(d._tag==="Success"){let f=d===Ze?u:d[U];if(f===re)return d;let m=Ta(a,f,void 0,e,l);m&&(d=Ie(new Oe(e,m)))}}else d=Ka(d,f=>{if(f!==re){let m=Ta(a,f,void 0,e,l);if(m)return Ie(new Oe(e,m))}return we(f)});return d};return r?(u,l)=>{n&&(l=fs(l,n));let d=i??=r.map(p=>eu(p.to)),f=u,m=d[d.length-1](u,l);for(let p=r.length-1;p>=0;p--){let h=r[p].transformation,x;if(ke(m)&&m._tag==="Success"){let g=Qn(m===Ze?f:m[U]);x=h._tag==="Transformation"?h.decode.run(g,l):h.decode(ia(g),l)}else h._tag==="Transformation"?x=Dt(m,g=>h.decode.run(Qn(g),l)):x=h.decode(kr(m,Qn),l);if(m=ke(x)&&x._tag==="Success"?yl(x[U]):Dt(x,yl),p!==0){let g=d[p-1];m._tag==="Success"?(f=m[U],m=g(f,l)):m=Dt(m,y=>{let T=g(y,l);return T===Ze?ia(y):T})}}if(m._tag==="Success"){let p=m[U],h=s(p,l);return h===Ze?m:h}return m=La(m,p=>Tr(()=>ya(p,h=>new Zn(e,h)))),Dt(m,p=>{let h=s(p,l);return h===Ze?ia(p):h})}:n?(u,l)=>s(u,fs(l,n)):s}var ru="~effect/Schema/Schema";var mS={[ru]:ru,pipe(){return We(this,arguments)},annotate(e){return this.rebuild(Vl(this.ast,e))},annotateKey(e){return this.rebuild(Jl(this.ast,e))},check(...e){return this.rebuild(Nr(this.ast,e))}};function ou(e,t){function a(){}let r=Object.defineProperties(Object.setPrototypeOf(a,mS),Object.getOwnPropertyDescriptors({...t}));r.ast=e,r.rebuild=n=>ou(n,t);let o=ps(r);return r.makeEffect=(n,i)=>nu(o(n,i)),r.make=_f(r),r.makeOption=tu(r),r}function nu(e){return La(e,t=>Tr(()=>ya(t,a=>new Bo(a))))}var ms=e=>e;function xS(){return(e,t,a)=>He(new rs(e.map(Gl),r=>t(r.map(o=>He(o))),a))}function SS(e,t){return xS()([],()=>(a,r)=>e(a)?we(a):Ie(new sa(r)),t)}function IS(e,t){let a=au(e,t);return(r,o)=>nu(a(r,o))}function yS(e,t){let a;for(let r of e.reasons){if(!Un(r)||!Bf(r.error))throw new globalThis.Error(t,{cause:e});a??=r.error}if(a===void 0)throw new globalThis.Error(t,{cause:e});return a}function LS(e){let t=vr(e);if(wr(t))return t.value;throw yS(t.cause,"Sync adapter can only throw schema errors")}var _r=qf;function ze(e,t){let a=IS(e,t);return(r,o)=>LS(a(r,o))}var He=ou;var K=ms(e=>He(Zl(e.ast),{schema:e}));function se(e){let t=He(new ba(e),{literal:e,transform(a){return t.pipe(wS(se(a),{decode:pt(()=>a),encode:pt(()=>e)}))}});return t}var No=He(Ao),bS=He(Sf);var S=He(Ro),at=He(_l),rt=He(If);function Wf(e,t){return He(e,{fields:t,mapFields(a,r){let o=a(this.fields);return Wf(Hl(o,r?.unsafePreserveChecks?this.ast.checks:void 0),o)}})}function w(e){return Wf(Hl(e,void 0),e)}function jf(e,t){return He(e,{elements:t,mapElements(a,r){let o=a(this.elements);return jf($l(o,r?.unsafePreserveChecks?this.ast.checks:void 0),o)}})}function CS(e){return jf($l(e),e)}var ee=ms(e=>He(new Do(!1,[],[e.ast]),{value:e}));function zf(e,t){return He(e,{members:t,mapMembers(a,r){let o=a(this.members);return zf(ls(o,this.ast.mode,r?.unsafePreserveChecks?this.ast.checks:void 0),o)}})}function Me(e,t){return zf(ls(e,t?.mode??"anyOf",void 0),e)}function Ct(e){let t=e.map(se);return He(ls(t,"anyOf",void 0),{literals:e,members:t,mapMembers(a){return Me(a(this.members))},pick(a){return Ct(a)},transform(a){return Me(t.map((r,o)=>r.transform(a[o])))}})}var Fe=ms(e=>Me([e,bS]));function wS(e,t){return a=>He(Af(a.ast,e.ast,t?Cl(t):wl()),{from:a,to:e})}function TS(e){return t=>He(Pf(t.ast,vS(e)),{schema:t})}function vS(e){return La(e,t=>Tr(()=>ya(t,a=>a.issue)))}function $f(e){return se(e).pipe(TS(we(e)))}function qr(e,t){return SS(a=>a instanceof e,t)}function Hr(){return(e,t)=>new ht(e.ast,Cl(t))}var Gr=us;function su(e,t){let a=e.source,r=e.flags,o=r===""?`new RegExp(${pe(a)})`:`new RegExp(${pe(a)}, ${pe(r)})`;return zl(e,{toCode:()=>({runtime:`Schema.isPattern(${o})`}),...t})}function kS(e){let t=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/;return su(t,{expected:"a base64 encoded string",representation:{id:"effect/schema/isBase64",payload:null},toJsonSchema:()=>({pattern:t.source}),toCode:()=>({runtime:"Schema.isBase64()"}),...e})}var _o=He(is);function ES(e){let t=mc(e.order),a=e.formatter??pe;return(r,o)=>Gr(n=>t(n,r),{expected:`a value greater than or equal to ${a(r)}`,arbitrary:{constraint:{ordered:{order:e.order,minimum:r}}},...e.annotate?.(r),...o})}function PS(e){if(!globalThis.Number.isFinite(e))throw new globalThis.RangeError(`Expected a finite number, got ${pe(e)}`);return e}var va=ES({order:pc,annotate:e=>({representation:{id:"effect/schema/isGreaterThanOrEqualTo",payload:{minimum:PS(e)}},toJsonSchema:()=>({minimum:e}),toCode:()=>({runtime:`Schema.isGreaterThanOrEqualTo(${pe(e)})`})})});function AS(e){return Gr(t=>globalThis.Number.isSafeInteger(t),{expected:"an integer",representation:{id:"effect/schema/isInt",payload:null},toJsonSchema:()=>({type:"integer"}),toCode:()=>({runtime:"Schema.isInt()"}),arbitrary:{constraint:{integer:!0}},...e})}var gt=at.check(AS());function Kf(e,t){return e=Math.max(0,Math.floor(e)),Gr(a=>a.length>=e,{expected:`a value with a length of at least ${e}`,representation:{id:"effect/schema/isMinLength",payload:{minLength:e}},toJsonSchema:({type:a})=>a==="array"?{minItems:e}:{minLength:e},toCode:()=>({runtime:`Schema.isMinLength(${e})`}),[yo]:!0,arbitrary:{constraint:{minLength:e}},...t})}function Vf(e,t){return e=Math.max(0,Math.floor(e)),Gr(a=>a.length<=e,{expected:`a value with a length of at most ${e}`,representation:{id:"effect/schema/isMaxLength",payload:{maxLength:e}},toJsonSchema:({type:a})=>a==="array"?{maxItems:e}:{maxLength:e},toCode:()=>({runtime:`Schema.isMaxLength(${e})`}),[yo]:!0,arbitrary:{constraint:{maxLength:e}},...t})}var UA=qr(globalThis.RegExp,{representation:{id:"effect/schema/RegExp",payload:null},toCode:()=>({runtime:"Schema.RegExp",Type:"globalThis.RegExp"}),expected:"RegExp",toCodecJson:()=>Hr()(w({source:S,flags:S}),Eo({decode:e=>ul({try:()=>new globalThis.RegExp(e.source,e.flags),catch:()=>new je({message:"Expected valid RegExp source and flags"})}),encode:e=>we({source:e.source,flags:e.flags})})),toArbitrary:()=>e=>e.tuple(e.constantFrom(".",".*","\\d+","\\w+","[a-z]+","[A-Z]+","[0-9]+","^[a-zA-Z0-9]+$","^\\d{4}-\\d{2}-\\d{2}$"),e.uniqueArray(e.constantFrom("g","i","m","s","u","y"),{minLength:0,maxLength:6}).map(t=>t.join(""))).map(([t,a])=>new globalThis.RegExp(t,a)),toEquivalence:()=>(e,t)=>e.source===t.source&&e.flags===t.flags});var RS=S.annotate({expected:"a string that will be decoded as a URL"}),NA=qr(globalThis.URL,{representation:{id:"effect/schema/URL",payload:null},toCode:()=>({runtime:"Schema.URL",Type:"globalThis.URL"}),expected:"URL",toCodecJson:()=>Hr()(RS,sf),toArbitrary:()=>e=>e.webUrl().map(t=>new globalThis.URL(t)),toEquivalence:()=>(e,t)=>e.toString()===t.toString()});var DS=qr(globalThis.File,{representation:{id:"effect/schema/File",payload:null},toCode:()=>({runtime:"Schema.File",Type:"globalThis.File"}),expected:"File",toCodecJson:()=>Hr()(w({data:S.check(kS()),type:S,name:S,lastModified:gt}),Eo({decode:e=>kn(Kn(e.data),{onFailure:()=>Ie(new je({message:"Expected a valid Base64 string"})),onSuccess:t=>{let a=new globalThis.Uint8Array(t);return we(new globalThis.File([a],e.name,{type:e.type,lastModified:e.lastModified}))}}),encode:e=>qd({try:async()=>{let t=new globalThis.Uint8Array(await e.arrayBuffer());return{data:zn(t),type:e.type,name:e.name,lastModified:e.lastModified}},catch:()=>new je({message:"Expected File to be readable"})})}))});var _A=qr(globalThis.FormData,{representation:{id:"effect/schema/FormData",payload:null},toCode:()=>({runtime:"Schema.FormData",Type:"globalThis.FormData"}),expected:"FormData",toCodecJson:()=>Hr()(ee(CS([S,Me([w({_tag:$f("String"),value:S}),w({_tag:$f("File"),value:DS})])])),Eo({decode:e=>{let t=new globalThis.FormData;for(let[a,r]of e)t.append(a,r.value);return we(t)},encode:e=>we(globalThis.Array.from(e.entries()).map(([t,a])=>typeof a=="string"?[t,{_tag:"String",value:a}]:[t,{_tag:"File",value:a}]))}))});var qA=qr(globalThis.URLSearchParams,{representation:{id:"effect/schema/URLSearchParams",payload:null},toCode:()=>({runtime:"Schema.URLSearchParams",Type:"globalThis.URLSearchParams"}),expected:"URLSearchParams",toCodecJson:()=>Hr()(S.annotate({expected:"a query string that will be decoded as URLSearchParams"}),nf({decode:e=>new globalThis.URLSearchParams(e),encode:e=>e.toString()}))});var OS=S.annotate({expected:"a base64 encoded string that will be decoded as Uint8Array",format:"byte",contentEncoding:"base64"}),HA=qr(globalThis.Uint8Array,{representation:{id:"effect/schema/Uint8Array",payload:null},toCode:()=>({runtime:"Schema.Uint8Array",Type:"globalThis.Uint8Array"}),expected:"Uint8Array",toCodecJson:()=>Hr()(OS,lf),toArbitrary:()=>e=>e.uint8Array()});var MS=/^[A-Za-z0-9_-]{1,64}$/,iu=40,qo=8,hs=w({memberId:S,name:S,principal:K(w({kind:se("remote-agent"),principalId:S}))}),FS=Ct(["member-count","invalid-member-id","invalid-name","duplicate-member-id","duplicate-name","lead-not-member","lead-remote","duplicate-principal","invalid-principal"]);function BS(e){if(e.members.length<1||e.members.length>qo)return"member-count";let t=new Set,a=new Set,r=new Set;for(let o of e.members){if(!MS.test(o.memberId))return"invalid-member-id";let n=o.name.trim();if(n.length<1||n.length>iu)return"invalid-name";if(t.has(o.memberId))return"duplicate-member-id";let i=n.toLowerCase();if(a.has(i))return"duplicate-name";if(o.principal!==void 0){let{principalId:s}=o.principal;if(s.trim().length===0)return"invalid-principal";if(r.has(s))return"duplicate-principal";if(r.add(s),o.memberId===e.leadMemberId)return"lead-remote"}t.add(o.memberId),a.add(i)}return t.has(e.leadMemberId)?null:"lead-not-member"}var lu=w({projectId:S,members:ee(hs),leadMemberId:S,revision:gt.check(va(1)),updatedAt:S}).check(Gr(e=>BS(e)===null)),GA=w({version:se(1),roster:lu}),$A=w({projectId:S}),WA=w({projectId:S,members:ee(hs),leadMemberId:S,expectedRevision:gt.check(va(0))}),US=w({_tag:se("TeamRosterRejection"),commandType:se("setRoster"),code:Me([FS,Ct(["invalid-payload","stale-revision"])])}),Jf=Me([w({revision:gt.check(va(1))}),US]);be();var KA=cl(Gd,$d);var _S=/^[A-Za-z0-9_-]{1,64}$/;var Zf=4e3,Xf=e=>{let t=e.trim();return t.length>=1&&t.length<=Zf?t:null},Yf=w({projectId:S,goalId:S.check(su(_S)),goal:S.check(Kf(1),Vf(Zf)),titleSeed:K(S),leadMemberId:S,threads:ee(w({memberId:S,threadId:S})),remoteMembers:K(ee(w({memberId:S,principalId:S}))),startedAt:S});var qS=w({version:se(1),goal:Yf}),fR=w({projectId:S}),Qf=Fe(w({...Yf.fields,members:ee(w({memberId:S,name:Fe(S),threadId:K(S),principalId:K(S)}))})),gs=e=>e.filter(t=>t.threadId!==void 0),HS=w({projectId:S,goal:S,titleSeed:K(S),requestId:S}),GS=w({_tag:se("TeamGoalRejection"),commandType:se("startGoal"),code:Ct(["invalid-payload","invalid-goal","invalid-request-id","no-roster","no-default-model","model-unavailable"])}),ep=Me([w({goalId:S,leadThreadId:S,leadName:Fe(S)}),GS]);var pR=Xs("ProviderSelectionError"),mR=_r(HS),hR=_r(w({pluginId:se("team"),name:se("team/goal-started"),data:qS}));function xs(e){let t=ha();return a=>t(e.find(r=>r.stateId===a.stateId)??a)}var ua=()=>Array.from(crypto.getRandomValues(new Uint8Array(16)),e=>e.toString(16).padStart(2,"0")).join("");function J(){let e=z().i18n.usePluginTranslation();return{t:(t,a)=>e(t,a)}}function uu({rosterMembers:e,remoteAgents:t}){let{t:a}=J();return r=>(r===void 0?void 0:e.find(o=>o.principal?.principalId===r)?.name??t.find(o=>o.principalId===r)?.label)??a("detail.actor.remoteAgentFallback")}function jt({members:e,rosterMembers:t,remoteAgents:a,people:r,viewerKey:o}){let{t:n}=J(),i=f=>f.threadId===void 0?void 0:e.find(m=>m.threadId===f.threadId)?.name,s=f=>o!==void 0&&f.personKey===o?n("detail.actor.you"):r.find(m=>m.key===f.personKey)?.displayName??n("detail.actor.human"),u=uu({rosterMembers:t,remoteAgents:a}),l=f=>u(f.principalId),d=f=>f==="team"?n("detail.actor.team"):n("detail.actor.plugin",{pluginId:f});return{pluginName:d,actorName:f=>{switch(f.kind){case"human":return s(f);case"agent":return i(f)??n("detail.actor.otherAgent");case"remote-agent":return l(f);case"plugin":return d(f.pluginId??"");case"local-cli":return n("detail.actor.localCli");default:return n("detail.actor.system")}},assigneeNames:f=>f.map(p=>p.kind==="remote-agent"?l(p):p.kind==="agent"?i(p)??n("board.other"):p.kind==="human"?s(p):n("board.other")).join(", ")}}var $r=e=>new Date(e).toLocaleString();be();function cu(e){let t=z().ui.ProjectToolkitSwitch;return t===void 0?null:he(t,e)}function Ge(e){return(t=>he(z().ui[e],{...t,className:`ycodium-team-ui ${typeof t.className=="string"?t.className:""}`}))}var ye=Ge("Badge"),ka=Ge("Alert"),Ea=Object.assign(Ge("AlertDescription"),{displayName:"AlertDescription"}),Ss=Ge("Card"),Is=Ge("CardPanel"),Xa=Ge("Menu"),Ya=Ge("MenuTrigger"),Qa=Ge("MenuPopup"),zt=Ge("MenuItem"),ys=Ge("Select"),Ls=Ge("SelectTrigger"),bs=Ge("SelectValue"),Cs=Ge("SelectPopup"),Ho=Ge("SelectItem"),tp=Ge("Collapsible"),ap=Ge("CollapsibleTrigger"),rp=Ge("CollapsiblePanel");function q(e){return he(z().ui.Button,e)}function er(e){return he(z().ui.Input,e)}function Ke(e){return he(z().ui.Label,e)}function Pa(e){return he(z().ui.Textarea,e)}function Go(e){return he(z().ui.AlertDialog,e)}function op(e){return he(z().ui.AlertDialogClose,e)}function $o(e){return he(z().ui.AlertDialogDescription,e)}function Wo(e){return he(z().ui.AlertDialogFooter,e)}function jo(e){return he(z().ui.AlertDialogPopup,e)}function zo(e){return he(z().ui.AlertDialogTitle,e)}function ws(e){return he(z().ui.ChoiceList,e)}function np(e){return he(z().ui.Empty,e)}function sp(e){return he(z().ui.EmptyHeader,e)}function ip(e){return he(z().ui.EmptyTitle,e)}function lp(e){return he(z().ui.EmptyDescription,e)}var{jsx:c,jsxs:I,Fragment:nt}=window.__ycodiumPluginHost.jsxRuntime;var $S=ze(ep),WS={"invalid-payload":"goal.invalidPayload","invalid-goal":"goal.invalidGoal","invalid-request-id":"goal.invalidRequestId","no-roster":"goal.noRoster","no-default-model":"goal.noDefaultModel","model-unavailable":"goal.modelUnavailable"};function up({environmentId:e,projectId:t,roster:a,current:r,rosterMembers:o,remoteAgents:n,goalItem:i,states:s,onOpenGoalItem:u,loadFailed:l,reload:d,disabled:f=!1}){let m=z(),{t:p}=J(),h=kt(),x=r??null,g=r===void 0&&!l,[y,T]=v(""),[E,A]=v(null),[_,N]=v(!1),[C,b]=v(!1),[P,L]=v(null),R=D(null),M=D(!1);W(()=>{let k={};return R.current=k,()=>{R.current=null}},[]);let F=a!==null&&a.members.some(k=>k.memberId===a.leadMemberId&&k.principal===void 0),te=Xf(y),le=f||g||_,oe=!le&&!l&&F&&te!==null,Q=async()=>{if(!oe||te===null||M.current)return;let k=R.current,H=E??{projectId:t,goal:te,requestId:ua()};M.current=!0,A(H),N(!0),b(!1),L(null);try{let $=$S(await m.commands.invoke("startGoal",H,{environmentId:e}));if(R.current!==k)return;if("code"in $){L(WS[$.code]);return}A(null),T("")}catch{if(R.current!==k)return;L("goal.startFailed")}finally{R.current===k&&(await d(),R.current===k&&(M.current=!1,N(!1)))}},Ee=x?.members.find(k=>k.memberId===x.leadMemberId)?.threadId;return I("div",{className:"flex flex-col gap-3",children:[c(du,{current:x,rosterMembers:o,remoteAgents:n,goalItem:i,states:s,onOpenGoalItem:u,children:Ee!==void 0?c(q,{variant:"outline",onClick:()=>m.openThread({environmentId:e,threadId:Ee}),children:p("goal.openLead")}):null}),c(Ke,{htmlFor:h,children:p("goal.label")}),c(Pa,{id:h,"aria-label":p("goal.label"),"aria-describedby":F?void 0:`${h}-hint`,rows:3,value:y,disabled:le||C,onChange:k=>{T(k.target.value),A(null),L(null)}}),F?null:c("p",{id:`${h}-hint`,className:"text-sm text-muted-foreground",children:p("goal.rosterRequired")}),l||P?c("p",{role:"alert",className:"text-sm text-destructive-foreground",children:p(P??"goal.loadFailed")}):null,g?c("p",{role:"status",children:p("goal.loading")}):null,I("div",{className:"flex gap-2",children:[c(q,{disabled:!oe||C,onClick:()=>{oe&&(x!==null&&E===null?b(!0):Q())},children:p(_?"goal.starting":E!==null?"goal.retry":x!==null?"goal.startNew":"goal.start")}),l?c(q,{variant:"outline",disabled:le,onClick:d,children:p("goal.reload")}):null]}),c(Go,{open:C,onOpenChange:b,children:I(jo,{children:[c(zo,{children:p("goal.confirmTitle")}),c($o,{children:p("goal.confirmDescription")}),I(Wo,{children:[c(op,{render:c(q,{variant:"outline"}),onClick:()=>b(!1),children:p("goal.cancel")}),c(q,{disabled:!oe,onClick:Q,children:p("goal.confirmStart")})]})]})})]})}function du({current:e,rosterMembers:t,remoteAgents:a,goalItem:r,states:o,onOpenGoalItem:n,children:i}){let{t:s}=J(),u=uu({rosterMembers:t,remoteAgents:a}),l=xs(o),d=e?.members.find(m=>m.memberId===e.leadMemberId),f=e?.members.filter(m=>m.principalId!==void 0)??[];return e===null?null:I("div",{className:"flex min-w-0 flex-wrap items-center gap-2",children:[c("p",{className:"min-w-0 whitespace-pre-wrap break-words text-sm",children:s("goal.current",{goal:e.goal})}),c("p",{className:"text-sm text-muted-foreground",children:s("goal.lead",{name:d?.name??s("goal.unknownLead")})}),r!==void 0?c(jS,{goalItem:r,label:l,onOpen:n}):null,i,f.length>0?I("p",{className:"flex flex-wrap items-center gap-2 text-sm text-muted-foreground",children:[c("span",{children:s("goal.remoteMembers")}),f.map(m=>I("span",{className:"flex items-center gap-1",children:[c("span",{children:m.name??u(m.principalId)}),c(ye,{variant:"outline",children:s("roster.remote")})]},m.memberId))]}):null]})}function jS({goalItem:e,label:t,onOpen:a}){let{t:r}=J();return I("span",{className:"flex items-center gap-1",children:[c(ye,{variant:e.state.group==="completed"?"success":e.state.group==="cancelled"?"muted":"info",children:r("goal.item",{number:e.sequenceId,state:t(e.state)})}),c(q,{type:"button",variant:"outline",size:"sm","aria-label":r("goal.openItem",{number:e.sequenceId}),onClick:()=>a(e.workItemId),children:r("detail.open")})]})}be();var or=rh(mp());be();var Vo=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function tr(e){let t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function vs(e){return"nodeType"in e}function Ve(e){var t,a;return e?tr(e)?e:vs(e)&&(t=(a=e.ownerDocument)==null?void 0:a.defaultView)!=null?t:window:window}function ks(e){let{Document:t}=Ve(e);return e instanceof t}function Wr(e){return tr(e)?!1:e instanceof Ve(e).HTMLElement}function pu(e){return e instanceof Ve(e).SVGElement}function ar(e){return e?tr(e)?e.document:vs(e)?ks(e)?e:Wr(e)||pu(e)?e.ownerDocument:document:document:document}var Kt=Vo?js:W;function Jo(e){let t=D(e);return Kt(()=>{t.current=e}),Se(function(){for(var a=arguments.length,r=new Array(a),o=0;o<a;o++)r[o]=arguments[o];return t.current==null?void 0:t.current(...r)},[])}function gp(){let e=D(null),t=Se((r,o)=>{e.current=setInterval(r,o)},[]),a=Se(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[t,a]}function jr(e,t){t===void 0&&(t=[e]);let a=D(e);return Kt(()=>{a.current!==e&&(a.current=e)},t),a}function zr(e,t){let a=D();return Y(()=>{let r=e(a.current);return a.current=r,r},[...t])}function Zo(e){let t=Jo(e),a=D(null),r=Se(o=>{o!==a.current&&t?.(o,a.current),a.current=o},[]);return[a,r]}function Xo(e){let t=D();return W(()=>{t.current=e},[e]),t.current}var fu={};function Yo(e,t){return Y(()=>{if(t)return t;let a=fu[e]==null?0:fu[e]+1;return fu[e]=a,e+"-"+a},[e,t])}function xp(e){return function(t){for(var a=arguments.length,r=new Array(a>1?a-1:0),o=1;o<a;o++)r[o-1]=arguments[o];return r.reduce((n,i)=>{let s=Object.entries(i);for(let[u,l]of s){let d=n[u];d!=null&&(n[u]=d+e*l)}return n},{...t})}}var rr=xp(1),Qo=xp(-1);function JS(e){return"clientX"in e&&"clientY"in e}function Es(e){if(!e)return!1;let{KeyboardEvent:t}=Ve(e.target);return t&&e instanceof t}function ZS(e){if(!e)return!1;let{TouchEvent:t}=Ve(e.target);return t&&e instanceof t}function en(e){if(ZS(e)){if(e.touches&&e.touches.length){let{clientX:t,clientY:a}=e.touches[0];return{x:t,y:a}}else if(e.changedTouches&&e.changedTouches.length){let{clientX:t,clientY:a}=e.changedTouches[0];return{x:t,y:a}}}return JS(e)?{x:e.clientX,y:e.clientY}:null}var Ra=Object.freeze({Translate:{toString(e){if(!e)return;let{x:t,y:a}=e;return"translate3d("+(t?Math.round(t):0)+"px, "+(a?Math.round(a):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;let{scaleX:t,scaleY:a}=e;return"scaleX("+t+") scaleY("+a+")"}},Transform:{toString(e){if(e)return[Ra.Translate.toString(e),Ra.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:a,easing:r}=e;return t+" "+a+"ms "+r}}}),hp="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function Sp(e){return e.matches(hp)?e:e.querySelector(hp)}be();var XS={display:"none"};function Ip(e){let{id:t,value:a}=e;return me.createElement("div",{id:t,style:XS},a)}function yp(e){let{id:t,announcement:a,ariaLiveType:r="assertive"}=e,o={position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};return me.createElement("div",{id:t,style:o,role:"status","aria-live":r,"aria-atomic":!0},a)}function Lp(){let[e,t]=v("");return{announce:Se(r=>{r!=null&&t(r)},[]),announcement:e}}var Mp=Yt(null);function YS(e){let t=vt(Mp);W(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)},[e,t])}function QS(){let[e]=v(()=>new Set),t=Se(r=>(e.add(r),()=>e.delete(r)),[e]);return[Se(r=>{let{type:o,event:n}=r;e.forEach(i=>{var s;return(s=i[o])==null?void 0:s.call(i,n)})},[e]),t]}var eI={draggable:`
294
294
  To pick up a draggable item, press the space bar.
295
295
  While dragging, use the arrow keys to move the item.
296
296
  Press space again to drop the item in its new position, or press escape to cancel.