speckit-kit 0.0.0 → 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,185 @@
1
+ function zJ(e,t){for(var n=0;n<t.length;n++){const r=t[n];if(typeof r!="string"&&!Array.isArray(r)){for(const i in r)if(i!=="default"&&!(i in e)){const o=Object.getOwnPropertyDescriptor(r,i);o&&Object.defineProperty(e,i,o.get?o:{enumerable:!0,get:()=>r[i]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))r(i);new MutationObserver(i=>{for(const o of i)if(o.type==="childList")for(const a of o.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&r(a)}).observe(document,{childList:!0,subtree:!0});function n(i){const o={};return i.integrity&&(o.integrity=i.integrity),i.referrerPolicy&&(o.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?o.credentials="include":i.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function r(i){if(i.ep)return;i.ep=!0;const o=n(i);fetch(i.href,o)}})();function Xw(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var HI={exports:{}},Cm={};var V2;function BJ(){if(V2)return Cm;V2=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function n(r,i,o){var a=null;if(o!==void 0&&(a=""+o),i.key!==void 0&&(a=""+i.key),"key"in i){o={};for(var c in i)c!=="key"&&(o[c]=i[c])}else o=i;return i=o.ref,{$$typeof:e,type:r,key:a,ref:i!==void 0?i:null,props:o}}return Cm.Fragment=t,Cm.jsx=n,Cm.jsxs=n,Cm}var K2;function qJ(){return K2||(K2=1,HI.exports=BJ()),HI.exports}var P=qJ(),WI={exports:{}},Mm={},GI={exports:{}},YI={};var H2;function UJ(){return H2||(H2=1,(function(e){function t(F,K){var W=F.length;F.push(K);e:for(;0<W;){var X=W-1>>>1,V=F[X];if(0<i(V,K))F[X]=K,F[W]=V,W=X;else break e}}function n(F){return F.length===0?null:F[0]}function r(F){if(F.length===0)return null;var K=F[0],W=F.pop();if(W!==K){F[0]=W;e:for(var X=0,V=F.length,z=V>>>1;X<z;){var Q=2*(X+1)-1,q=F[Q],ie=Q+1,le=F[ie];if(0>i(q,W))ie<V&&0>i(le,q)?(F[X]=le,F[ie]=W,X=ie):(F[X]=q,F[Q]=W,X=Q);else if(ie<V&&0>i(le,W))F[X]=le,F[ie]=W,X=ie;else break e}}return K}function i(F,K){var W=F.sortIndex-K.sortIndex;return W!==0?W:F.id-K.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var o=performance;e.unstable_now=function(){return o.now()}}else{var a=Date,c=a.now();e.unstable_now=function(){return a.now()-c}}var u=[],d=[],h=1,p=null,g=3,y=!1,b=!1,S=!1,w=!1,x=typeof setTimeout=="function"?setTimeout:null,I=typeof clearTimeout=="function"?clearTimeout:null,_=typeof setImmediate<"u"?setImmediate:null;function M(F){for(var K=n(d);K!==null;){if(K.callback===null)r(d);else if(K.startTime<=F)r(d),K.sortIndex=K.expirationTime,t(u,K);else break;K=n(d)}}function C(F){if(S=!1,M(F),!b)if(n(u)!==null)b=!0,E||(E=!0,L());else{var K=n(d);K!==null&&$(C,K.startTime-F)}}var E=!1,T=-1,A=5,U=-1;function R(){return w?!0:!(e.unstable_now()-U<A)}function N(){if(w=!1,E){var F=e.unstable_now();U=F;var K=!0;try{e:{b=!1,S&&(S=!1,I(T),T=-1),y=!0;var W=g;try{t:{for(M(F),p=n(u);p!==null&&!(p.expirationTime>F&&R());){var X=p.callback;if(typeof X=="function"){p.callback=null,g=p.priorityLevel;var V=X(p.expirationTime<=F);if(F=e.unstable_now(),typeof V=="function"){p.callback=V,M(F),K=!0;break t}p===n(u)&&r(u),M(F)}else r(u);p=n(u)}if(p!==null)K=!0;else{var z=n(d);z!==null&&$(C,z.startTime-F),K=!1}}break e}finally{p=null,g=W,y=!1}K=void 0}}finally{K?L():E=!1}}}var L;if(typeof _=="function")L=function(){_(N)};else if(typeof MessageChannel<"u"){var B=new MessageChannel,j=B.port2;B.port1.onmessage=N,L=function(){j.postMessage(null)}}else L=function(){x(N,0)};function $(F,K){T=x(function(){F(e.unstable_now())},K)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(F){F.callback=null},e.unstable_forceFrameRate=function(F){0>F||125<F?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):A=0<F?Math.floor(1e3/F):5},e.unstable_getCurrentPriorityLevel=function(){return g},e.unstable_next=function(F){switch(g){case 1:case 2:case 3:var K=3;break;default:K=g}var W=g;g=K;try{return F()}finally{g=W}},e.unstable_requestPaint=function(){w=!0},e.unstable_runWithPriority=function(F,K){switch(F){case 1:case 2:case 3:case 4:case 5:break;default:F=3}var W=g;g=F;try{return K()}finally{g=W}},e.unstable_scheduleCallback=function(F,K,W){var X=e.unstable_now();switch(typeof W=="object"&&W!==null?(W=W.delay,W=typeof W=="number"&&0<W?X+W:X):W=X,F){case 1:var V=-1;break;case 2:V=250;break;case 5:V=1073741823;break;case 4:V=1e4;break;default:V=5e3}return V=W+V,F={id:h++,callback:K,priorityLevel:F,startTime:W,expirationTime:V,sortIndex:-1},W>X?(F.sortIndex=W,t(d,F),n(u)===null&&F===n(d)&&(S?(I(T),T=-1):S=!0,$(C,W-X))):(F.sortIndex=V,t(u,F),b||y||(b=!0,E||(E=!0,L()))),F},e.unstable_shouldYield=R,e.unstable_wrapCallback=function(F){var K=g;return function(){var W=g;g=K;try{return F.apply(this,arguments)}finally{g=W}}}})(YI)),YI}var W2;function VJ(){return W2||(W2=1,GI.exports=UJ()),GI.exports}var QI={exports:{}},vt={};var G2;function KJ(){if(G2)return vt;G2=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),i=Symbol.for("react.profiler"),o=Symbol.for("react.consumer"),a=Symbol.for("react.context"),c=Symbol.for("react.forward_ref"),u=Symbol.for("react.suspense"),d=Symbol.for("react.memo"),h=Symbol.for("react.lazy"),p=Symbol.for("react.activity"),g=Symbol.iterator;function y(z){return z===null||typeof z!="object"?null:(z=g&&z[g]||z["@@iterator"],typeof z=="function"?z:null)}var b={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},S=Object.assign,w={};function x(z,Q,q){this.props=z,this.context=Q,this.refs=w,this.updater=q||b}x.prototype.isReactComponent={},x.prototype.setState=function(z,Q){if(typeof z!="object"&&typeof z!="function"&&z!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,z,Q,"setState")},x.prototype.forceUpdate=function(z){this.updater.enqueueForceUpdate(this,z,"forceUpdate")};function I(){}I.prototype=x.prototype;function _(z,Q,q){this.props=z,this.context=Q,this.refs=w,this.updater=q||b}var M=_.prototype=new I;M.constructor=_,S(M,x.prototype),M.isPureReactComponent=!0;var C=Array.isArray;function E(){}var T={H:null,A:null,T:null,S:null},A=Object.prototype.hasOwnProperty;function U(z,Q,q){var ie=q.ref;return{$$typeof:e,type:z,key:Q,ref:ie!==void 0?ie:null,props:q}}function R(z,Q){return U(z.type,Q,z.props)}function N(z){return typeof z=="object"&&z!==null&&z.$$typeof===e}function L(z){var Q={"=":"=0",":":"=2"};return"$"+z.replace(/[=:]/g,function(q){return Q[q]})}var B=/\/+/g;function j(z,Q){return typeof z=="object"&&z!==null&&z.key!=null?L(""+z.key):Q.toString(36)}function $(z){switch(z.status){case"fulfilled":return z.value;case"rejected":throw z.reason;default:switch(typeof z.status=="string"?z.then(E,E):(z.status="pending",z.then(function(Q){z.status==="pending"&&(z.status="fulfilled",z.value=Q)},function(Q){z.status==="pending"&&(z.status="rejected",z.reason=Q)})),z.status){case"fulfilled":return z.value;case"rejected":throw z.reason}}throw z}function F(z,Q,q,ie,le){var ee=typeof z;(ee==="undefined"||ee==="boolean")&&(z=null);var J=!1;if(z===null)J=!0;else switch(ee){case"bigint":case"string":case"number":J=!0;break;case"object":switch(z.$$typeof){case e:case t:J=!0;break;case h:return J=z._init,F(J(z._payload),Q,q,ie,le)}}if(J)return le=le(z),J=ie===""?"."+j(z,0):ie,C(le)?(q="",J!=null&&(q=J.replace(B,"$&/")+"/"),F(le,Q,q,"",function(pe){return pe})):le!=null&&(N(le)&&(le=R(le,q+(le.key==null||z&&z.key===le.key?"":(""+le.key).replace(B,"$&/")+"/")+J)),Q.push(le)),1;J=0;var ge=ie===""?".":ie+":";if(C(z))for(var te=0;te<z.length;te++)ie=z[te],ee=ge+j(ie,te),J+=F(ie,Q,q,ee,le);else if(te=y(z),typeof te=="function")for(z=te.call(z),te=0;!(ie=z.next()).done;)ie=ie.value,ee=ge+j(ie,te++),J+=F(ie,Q,q,ee,le);else if(ee==="object"){if(typeof z.then=="function")return F($(z),Q,q,ie,le);throw Q=String(z),Error("Objects are not valid as a React child (found: "+(Q==="[object Object]"?"object with keys {"+Object.keys(z).join(", ")+"}":Q)+"). If you meant to render a collection of children, use an array instead.")}return J}function K(z,Q,q){if(z==null)return z;var ie=[],le=0;return F(z,ie,"","",function(ee){return Q.call(q,ee,le++)}),ie}function W(z){if(z._status===-1){var Q=z._result;Q=Q(),Q.then(function(q){(z._status===0||z._status===-1)&&(z._status=1,z._result=q)},function(q){(z._status===0||z._status===-1)&&(z._status=2,z._result=q)}),z._status===-1&&(z._status=0,z._result=Q)}if(z._status===1)return z._result.default;throw z._result}var X=typeof reportError=="function"?reportError:function(z){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var Q=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof z=="object"&&z!==null&&typeof z.message=="string"?String(z.message):String(z),error:z});if(!window.dispatchEvent(Q))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",z);return}console.error(z)},V={map:K,forEach:function(z,Q,q){K(z,function(){Q.apply(this,arguments)},q)},count:function(z){var Q=0;return K(z,function(){Q++}),Q},toArray:function(z){return K(z,function(Q){return Q})||[]},only:function(z){if(!N(z))throw Error("React.Children.only expected to receive a single React element child.");return z}};return vt.Activity=p,vt.Children=V,vt.Component=x,vt.Fragment=n,vt.Profiler=i,vt.PureComponent=_,vt.StrictMode=r,vt.Suspense=u,vt.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=T,vt.__COMPILER_RUNTIME={__proto__:null,c:function(z){return T.H.useMemoCache(z)}},vt.cache=function(z){return function(){return z.apply(null,arguments)}},vt.cacheSignal=function(){return null},vt.cloneElement=function(z,Q,q){if(z==null)throw Error("The argument must be a React element, but you passed "+z+".");var ie=S({},z.props),le=z.key;if(Q!=null)for(ee in Q.key!==void 0&&(le=""+Q.key),Q)!A.call(Q,ee)||ee==="key"||ee==="__self"||ee==="__source"||ee==="ref"&&Q.ref===void 0||(ie[ee]=Q[ee]);var ee=arguments.length-2;if(ee===1)ie.children=q;else if(1<ee){for(var J=Array(ee),ge=0;ge<ee;ge++)J[ge]=arguments[ge+2];ie.children=J}return U(z.type,le,ie)},vt.createContext=function(z){return z={$$typeof:a,_currentValue:z,_currentValue2:z,_threadCount:0,Provider:null,Consumer:null},z.Provider=z,z.Consumer={$$typeof:o,_context:z},z},vt.createElement=function(z,Q,q){var ie,le={},ee=null;if(Q!=null)for(ie in Q.key!==void 0&&(ee=""+Q.key),Q)A.call(Q,ie)&&ie!=="key"&&ie!=="__self"&&ie!=="__source"&&(le[ie]=Q[ie]);var J=arguments.length-2;if(J===1)le.children=q;else if(1<J){for(var ge=Array(J),te=0;te<J;te++)ge[te]=arguments[te+2];le.children=ge}if(z&&z.defaultProps)for(ie in J=z.defaultProps,J)le[ie]===void 0&&(le[ie]=J[ie]);return U(z,ee,le)},vt.createRef=function(){return{current:null}},vt.forwardRef=function(z){return{$$typeof:c,render:z}},vt.isValidElement=N,vt.lazy=function(z){return{$$typeof:h,_payload:{_status:-1,_result:z},_init:W}},vt.memo=function(z,Q){return{$$typeof:d,type:z,compare:Q===void 0?null:Q}},vt.startTransition=function(z){var Q=T.T,q={};T.T=q;try{var ie=z(),le=T.S;le!==null&&le(q,ie),typeof ie=="object"&&ie!==null&&typeof ie.then=="function"&&ie.then(E,X)}catch(ee){X(ee)}finally{Q!==null&&q.types!==null&&(Q.types=q.types),T.T=Q}},vt.unstable_useCacheRefresh=function(){return T.H.useCacheRefresh()},vt.use=function(z){return T.H.use(z)},vt.useActionState=function(z,Q,q){return T.H.useActionState(z,Q,q)},vt.useCallback=function(z,Q){return T.H.useCallback(z,Q)},vt.useContext=function(z){return T.H.useContext(z)},vt.useDebugValue=function(){},vt.useDeferredValue=function(z,Q){return T.H.useDeferredValue(z,Q)},vt.useEffect=function(z,Q){return T.H.useEffect(z,Q)},vt.useEffectEvent=function(z){return T.H.useEffectEvent(z)},vt.useId=function(){return T.H.useId()},vt.useImperativeHandle=function(z,Q,q){return T.H.useImperativeHandle(z,Q,q)},vt.useInsertionEffect=function(z,Q){return T.H.useInsertionEffect(z,Q)},vt.useLayoutEffect=function(z,Q){return T.H.useLayoutEffect(z,Q)},vt.useMemo=function(z,Q){return T.H.useMemo(z,Q)},vt.useOptimistic=function(z,Q){return T.H.useOptimistic(z,Q)},vt.useReducer=function(z,Q,q){return T.H.useReducer(z,Q,q)},vt.useRef=function(z){return T.H.useRef(z)},vt.useState=function(z){return T.H.useState(z)},vt.useSyncExternalStore=function(z,Q,q){return T.H.useSyncExternalStore(z,Q,q)},vt.useTransition=function(){return T.H.useTransition()},vt.version="19.2.0",vt}var Y2;function Cy(){return Y2||(Y2=1,QI.exports=KJ()),QI.exports}var XI={exports:{}},_i={};var Q2;function HJ(){if(Q2)return _i;Q2=1;var e=Cy();function t(u){var d="https://react.dev/errors/"+u;if(1<arguments.length){d+="?args[]="+encodeURIComponent(arguments[1]);for(var h=2;h<arguments.length;h++)d+="&args[]="+encodeURIComponent(arguments[h])}return"Minified React error #"+u+"; visit "+d+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function n(){}var r={d:{f:n,r:function(){throw Error(t(522))},D:n,C:n,L:n,m:n,X:n,S:n,M:n},p:0,findDOMNode:null},i=Symbol.for("react.portal");function o(u,d,h){var p=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:i,key:p==null?null:""+p,children:u,containerInfo:d,implementation:h}}var a=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function c(u,d){if(u==="font")return"";if(typeof d=="string")return d==="use-credentials"?d:""}return _i.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=r,_i.createPortal=function(u,d){var h=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!d||d.nodeType!==1&&d.nodeType!==9&&d.nodeType!==11)throw Error(t(299));return o(u,d,null,h)},_i.flushSync=function(u){var d=a.T,h=r.p;try{if(a.T=null,r.p=2,u)return u()}finally{a.T=d,r.p=h,r.d.f()}},_i.preconnect=function(u,d){typeof u=="string"&&(d?(d=d.crossOrigin,d=typeof d=="string"?d==="use-credentials"?d:"":void 0):d=null,r.d.C(u,d))},_i.prefetchDNS=function(u){typeof u=="string"&&r.d.D(u)},_i.preinit=function(u,d){if(typeof u=="string"&&d&&typeof d.as=="string"){var h=d.as,p=c(h,d.crossOrigin),g=typeof d.integrity=="string"?d.integrity:void 0,y=typeof d.fetchPriority=="string"?d.fetchPriority:void 0;h==="style"?r.d.S(u,typeof d.precedence=="string"?d.precedence:void 0,{crossOrigin:p,integrity:g,fetchPriority:y}):h==="script"&&r.d.X(u,{crossOrigin:p,integrity:g,fetchPriority:y,nonce:typeof d.nonce=="string"?d.nonce:void 0})}},_i.preinitModule=function(u,d){if(typeof u=="string")if(typeof d=="object"&&d!==null){if(d.as==null||d.as==="script"){var h=c(d.as,d.crossOrigin);r.d.M(u,{crossOrigin:h,integrity:typeof d.integrity=="string"?d.integrity:void 0,nonce:typeof d.nonce=="string"?d.nonce:void 0})}}else d==null&&r.d.M(u)},_i.preload=function(u,d){if(typeof u=="string"&&typeof d=="object"&&d!==null&&typeof d.as=="string"){var h=d.as,p=c(h,d.crossOrigin);r.d.L(u,h,{crossOrigin:p,integrity:typeof d.integrity=="string"?d.integrity:void 0,nonce:typeof d.nonce=="string"?d.nonce:void 0,type:typeof d.type=="string"?d.type:void 0,fetchPriority:typeof d.fetchPriority=="string"?d.fetchPriority:void 0,referrerPolicy:typeof d.referrerPolicy=="string"?d.referrerPolicy:void 0,imageSrcSet:typeof d.imageSrcSet=="string"?d.imageSrcSet:void 0,imageSizes:typeof d.imageSizes=="string"?d.imageSizes:void 0,media:typeof d.media=="string"?d.media:void 0})}},_i.preloadModule=function(u,d){if(typeof u=="string")if(d){var h=c(d.as,d.crossOrigin);r.d.m(u,{as:typeof d.as=="string"&&d.as!=="script"?d.as:void 0,crossOrigin:h,integrity:typeof d.integrity=="string"?d.integrity:void 0})}else r.d.m(u)},_i.requestFormReset=function(u){r.d.r(u)},_i.unstable_batchedUpdates=function(u,d){return u(d)},_i.useFormState=function(u,d,h){return a.H.useFormState(u,d,h)},_i.useFormStatus=function(){return a.H.useHostTransitionStatus()},_i.version="19.2.0",_i}var X2;function Gq(){if(X2)return XI.exports;X2=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),XI.exports=HJ(),XI.exports}var J2;function WJ(){if(J2)return Mm;J2=1;var e=VJ(),t=Cy(),n=Gq();function r(s){var l="https://react.dev/errors/"+s;if(1<arguments.length){l+="?args[]="+encodeURIComponent(arguments[1]);for(var f=2;f<arguments.length;f++)l+="&args[]="+encodeURIComponent(arguments[f])}return"Minified React error #"+s+"; visit "+l+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function i(s){return!(!s||s.nodeType!==1&&s.nodeType!==9&&s.nodeType!==11)}function o(s){var l=s,f=s;if(s.alternate)for(;l.return;)l=l.return;else{s=l;do l=s,(l.flags&4098)!==0&&(f=l.return),s=l.return;while(s)}return l.tag===3?f:null}function a(s){if(s.tag===13){var l=s.memoizedState;if(l===null&&(s=s.alternate,s!==null&&(l=s.memoizedState)),l!==null)return l.dehydrated}return null}function c(s){if(s.tag===31){var l=s.memoizedState;if(l===null&&(s=s.alternate,s!==null&&(l=s.memoizedState)),l!==null)return l.dehydrated}return null}function u(s){if(o(s)!==s)throw Error(r(188))}function d(s){var l=s.alternate;if(!l){if(l=o(s),l===null)throw Error(r(188));return l!==s?null:s}for(var f=s,m=l;;){var v=f.return;if(v===null)break;var k=v.alternate;if(k===null){if(m=v.return,m!==null){f=m;continue}break}if(v.child===k.child){for(k=v.child;k;){if(k===f)return u(v),s;if(k===m)return u(v),l;k=k.sibling}throw Error(r(188))}if(f.return!==m.return)f=v,m=k;else{for(var O=!1,H=v.child;H;){if(H===f){O=!0,f=v,m=k;break}if(H===m){O=!0,m=v,f=k;break}H=H.sibling}if(!O){for(H=k.child;H;){if(H===f){O=!0,f=k,m=v;break}if(H===m){O=!0,m=k,f=v;break}H=H.sibling}if(!O)throw Error(r(189))}}if(f.alternate!==m)throw Error(r(190))}if(f.tag!==3)throw Error(r(188));return f.stateNode.current===f?s:l}function h(s){var l=s.tag;if(l===5||l===26||l===27||l===6)return s;for(s=s.child;s!==null;){if(l=h(s),l!==null)return l;s=s.sibling}return null}var p=Object.assign,g=Symbol.for("react.element"),y=Symbol.for("react.transitional.element"),b=Symbol.for("react.portal"),S=Symbol.for("react.fragment"),w=Symbol.for("react.strict_mode"),x=Symbol.for("react.profiler"),I=Symbol.for("react.consumer"),_=Symbol.for("react.context"),M=Symbol.for("react.forward_ref"),C=Symbol.for("react.suspense"),E=Symbol.for("react.suspense_list"),T=Symbol.for("react.memo"),A=Symbol.for("react.lazy"),U=Symbol.for("react.activity"),R=Symbol.for("react.memo_cache_sentinel"),N=Symbol.iterator;function L(s){return s===null||typeof s!="object"?null:(s=N&&s[N]||s["@@iterator"],typeof s=="function"?s:null)}var B=Symbol.for("react.client.reference");function j(s){if(s==null)return null;if(typeof s=="function")return s.$$typeof===B?null:s.displayName||s.name||null;if(typeof s=="string")return s;switch(s){case S:return"Fragment";case x:return"Profiler";case w:return"StrictMode";case C:return"Suspense";case E:return"SuspenseList";case U:return"Activity"}if(typeof s=="object")switch(s.$$typeof){case b:return"Portal";case _:return s.displayName||"Context";case I:return(s._context.displayName||"Context")+".Consumer";case M:var l=s.render;return s=s.displayName,s||(s=l.displayName||l.name||"",s=s!==""?"ForwardRef("+s+")":"ForwardRef"),s;case T:return l=s.displayName||null,l!==null?l:j(s.type)||"Memo";case A:l=s._payload,s=s._init;try{return j(s(l))}catch{}}return null}var $=Array.isArray,F=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,K=n.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,W={pending:!1,data:null,method:null,action:null},X=[],V=-1;function z(s){return{current:s}}function Q(s){0>V||(s.current=X[V],X[V]=null,V--)}function q(s,l){V++,X[V]=s.current,s.current=l}var ie=z(null),le=z(null),ee=z(null),J=z(null);function ge(s,l){switch(q(ee,l),q(le,s),q(ie,null),l.nodeType){case 9:case 11:s=(s=l.documentElement)&&(s=s.namespaceURI)?h2(s):0;break;default:if(s=l.tagName,l=l.namespaceURI)l=h2(l),s=p2(l,s);else switch(s){case"svg":s=1;break;case"math":s=2;break;default:s=0}}Q(ie),q(ie,s)}function te(){Q(ie),Q(le),Q(ee)}function pe(s){s.memoizedState!==null&&q(J,s);var l=ie.current,f=p2(l,s.type);l!==f&&(q(le,s),q(ie,f))}function oe(s){le.current===s&&(Q(ie),Q(le)),J.current===s&&(Q(J),_m._currentValue=W)}var ye,xe;function je(s){if(ye===void 0)try{throw Error()}catch(f){var l=f.stack.trim().match(/\n( *(at )?)/);ye=l&&l[1]||"",xe=-1<f.stack.indexOf(`
2
+ at`)?" (<anonymous>)":-1<f.stack.indexOf("@")?"@unknown:0:0":""}return`
3
+ `+ye+s+xe}var Ge=!1;function it(s,l){if(!s||Ge)return"";Ge=!0;var f=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var m={DetermineComponentFrameRoot:function(){try{if(l){var we=function(){throw Error()};if(Object.defineProperty(we.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(we,[])}catch(me){var fe=me}Reflect.construct(s,[],we)}else{try{we.call()}catch(me){fe=me}s.call(we.prototype)}}else{try{throw Error()}catch(me){fe=me}(we=s())&&typeof we.catch=="function"&&we.catch(function(){})}}catch(me){if(me&&fe&&typeof me.stack=="string")return[me.stack,fe.stack]}return[null,null]}};m.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var v=Object.getOwnPropertyDescriptor(m.DetermineComponentFrameRoot,"name");v&&v.configurable&&Object.defineProperty(m.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var k=m.DetermineComponentFrameRoot(),O=k[0],H=k[1];if(O&&H){var Z=O.split(`
4
+ `),de=H.split(`
5
+ `);for(v=m=0;m<Z.length&&!Z[m].includes("DetermineComponentFrameRoot");)m++;for(;v<de.length&&!de[v].includes("DetermineComponentFrameRoot");)v++;if(m===Z.length||v===de.length)for(m=Z.length-1,v=de.length-1;1<=m&&0<=v&&Z[m]!==de[v];)v--;for(;1<=m&&0<=v;m--,v--)if(Z[m]!==de[v]){if(m!==1||v!==1)do if(m--,v--,0>v||Z[m]!==de[v]){var be=`
6
+ `+Z[m].replace(" at new "," at ");return s.displayName&&be.includes("<anonymous>")&&(be=be.replace("<anonymous>",s.displayName)),be}while(1<=m&&0<=v);break}}}finally{Ge=!1,Error.prepareStackTrace=f}return(f=s?s.displayName||s.name:"")?je(f):""}function ut(s,l){switch(s.tag){case 26:case 27:case 5:return je(s.type);case 16:return je("Lazy");case 13:return s.child!==l&&l!==null?je("Suspense Fallback"):je("Suspense");case 19:return je("SuspenseList");case 0:case 15:return it(s.type,!1);case 11:return it(s.type.render,!1);case 1:return it(s.type,!0);case 31:return je("Activity");default:return""}}function Dt(s){try{var l="",f=null;do l+=ut(s,f),f=s,s=s.return;while(s);return l}catch(m){return`
7
+ Error generating stack: `+m.message+`
8
+ `+m.stack}}var Ct=Object.prototype.hasOwnProperty,wt=e.unstable_scheduleCallback,Jn=e.unstable_cancelCallback,yt=e.unstable_shouldYield,pn=e.unstable_requestPaint,$t=e.unstable_now,On=e.unstable_getCurrentPriorityLevel,he=e.unstable_ImmediatePriority,_e=e.unstable_UserBlockingPriority,Pe=e.unstable_NormalPriority,Ke=e.unstable_LowPriority,dt=e.unstable_IdlePriority,tn=e.log,Fn=e.unstable_setDisableYieldValue,mn=null,Qe=null;function Ne(s){if(typeof tn=="function"&&Fn(s),Qe&&typeof Qe.setStrictMode=="function")try{Qe.setStrictMode(mn,s)}catch{}}var He=Math.clz32?Math.clz32:Dn,kt=Math.log,cn=Math.LN2;function Dn(s){return s>>>=0,s===0?32:31-(kt(s)/cn|0)|0}var vo=256,Yo=262144,Zr=4194304;function $i(s){var l=s&42;if(l!==0)return l;switch(s&-s){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return s&261888;case 262144:case 524288:case 1048576:case 2097152:return s&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return s&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return s}}function Es(s,l,f){var m=s.pendingLanes;if(m===0)return 0;var v=0,k=s.suspendedLanes,O=s.pingedLanes;s=s.warmLanes;var H=m&134217727;return H!==0?(m=H&~k,m!==0?v=$i(m):(O&=H,O!==0?v=$i(O):f||(f=H&~s,f!==0&&(v=$i(f))))):(H=m&~k,H!==0?v=$i(H):O!==0?v=$i(O):f||(f=m&~s,f!==0&&(v=$i(f)))),v===0?0:l!==0&&l!==v&&(l&k)===0&&(k=v&-v,f=l&-l,k>=f||k===32&&(f&4194048)!==0)?l:v}function ci(s,l){return(s.pendingLanes&~(s.suspendedLanes&~s.pingedLanes)&l)===0}function Le(s,l){switch(s){case 1:case 2:case 4:case 8:case 64:return l+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return l+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function se(){var s=Zr;return Zr<<=1,(Zr&62914560)===0&&(Zr=4194304),s}function ve(s){for(var l=[],f=0;31>f;f++)l.push(s);return l}function Ie(s,l){s.pendingLanes|=l,l!==268435456&&(s.suspendedLanes=0,s.pingedLanes=0,s.warmLanes=0)}function Me(s,l,f,m,v,k){var O=s.pendingLanes;s.pendingLanes=f,s.suspendedLanes=0,s.pingedLanes=0,s.warmLanes=0,s.expiredLanes&=f,s.entangledLanes&=f,s.errorRecoveryDisabledLanes&=f,s.shellSuspendCounter=0;var H=s.entanglements,Z=s.expirationTimes,de=s.hiddenUpdates;for(f=O&~f;0<f;){var be=31-He(f),we=1<<be;H[be]=0,Z[be]=-1;var fe=de[be];if(fe!==null)for(de[be]=null,be=0;be<fe.length;be++){var me=fe[be];me!==null&&(me.lane&=-536870913)}f&=~we}m!==0&&Je(s,m,0),k!==0&&v===0&&s.tag!==0&&(s.suspendedLanes|=k&~(O&~l))}function Je(s,l,f){s.pendingLanes|=l,s.suspendedLanes&=~l;var m=31-He(l);s.entangledLanes|=l,s.entanglements[m]=s.entanglements[m]|1073741824|f&261930}function ot(s,l){var f=s.entangledLanes|=l;for(s=s.entanglements;f;){var m=31-He(f),v=1<<m;v&l|s[m]&l&&(s[m]|=l),f&=~v}}function Ae(s,l){var f=l&-l;return f=(f&42)!==0?1:Mt(f),(f&(s.suspendedLanes|l))!==0?0:f}function Mt(s){switch(s){case 2:s=1;break;case 8:s=4;break;case 32:s=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:s=128;break;case 268435456:s=134217728;break;default:s=0}return s}function at(s){return s&=-s,2<s?8<s?(s&134217727)!==0?32:268435456:8:2}function _t(){var s=K.p;return s!==0?s:(s=window.event,s===void 0?32:$2(s.type))}function Rt(s,l){var f=K.p;try{return K.p=s,l()}finally{K.p=f}}var ze=Math.random().toString(36).slice(2),st="__reactFiber$"+ze,sn="__reactProps$"+ze,_n="__reactContainer$"+ze,ji="__reactEvents$"+ze,Cr="__reactListeners$"+ze,zn="__reactHandles$"+ze,Mr="__reactResources$"+ze,oa="__reactMarker$"+ze;function Qo(s){delete s[st],delete s[sn],delete s[ji],delete s[Cr],delete s[zn]}function So(s){var l=s[st];if(l)return l;for(var f=s.parentNode;f;){if(l=f[_n]||f[st]){if(f=l.alternate,l.child!==null||f!==null&&f.child!==null)for(s=w2(s);s!==null;){if(f=s[st])return f;s=w2(s)}return l}s=f,f=s.parentNode}return null}function Br(s){if(s=s[st]||s[_n]){var l=s.tag;if(l===5||l===6||l===13||l===31||l===26||l===27||l===3)return s}return null}function Ba(s){var l=s.tag;if(l===5||l===26||l===27||l===6)return s.stateNode;throw Error(r(33))}function wo(s){var l=s[Mr];return l||(l=s[Mr]={hoistableStyles:new Map,hoistableScripts:new Map}),l}function Hn(s){s[oa]=!0}var uu=new Set,Rb={};function sa(s,l){aa(s,l),aa(s+"Capture",l)}function aa(s,l){for(Rb[s]=l,s=0;s<l.length;s++)uu.add(l[s])}var Ab=RegExp("^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$"),ql={},Zd={};function iP(s){return Ct.call(Zd,s)?!0:Ct.call(ql,s)?!1:Ab.test(s)?Zd[s]=!0:(ql[s]=!0,!1)}function Ob(s,l,f){if(iP(l))if(f===null)s.removeAttribute(l);else{switch(typeof f){case"undefined":case"function":case"symbol":s.removeAttribute(l);return;case"boolean":var m=l.toLowerCase().slice(0,5);if(m!=="data-"&&m!=="aria-"){s.removeAttribute(l);return}}s.setAttribute(l,""+f)}}function Db(s,l,f){if(f===null)s.removeAttribute(l);else{switch(typeof f){case"undefined":case"function":case"symbol":case"boolean":s.removeAttribute(l);return}s.setAttribute(l,""+f)}}function qa(s,l,f,m){if(m===null)s.removeAttribute(f);else{switch(typeof m){case"undefined":case"function":case"symbol":case"boolean":s.removeAttribute(f);return}s.setAttributeNS(l,f,""+m)}}function Xo(s){switch(typeof s){case"bigint":case"boolean":case"number":case"string":case"undefined":return s;case"object":return s;default:return""}}function oP(s){var l=s.type;return(s=s.nodeName)&&s.toLowerCase()==="input"&&(l==="checkbox"||l==="radio")}function DQ(s,l,f){var m=Object.getOwnPropertyDescriptor(s.constructor.prototype,l);if(!s.hasOwnProperty(l)&&typeof m<"u"&&typeof m.get=="function"&&typeof m.set=="function"){var v=m.get,k=m.set;return Object.defineProperty(s,l,{configurable:!0,get:function(){return v.call(this)},set:function(O){f=""+O,k.call(this,O)}}),Object.defineProperty(s,l,{enumerable:m.enumerable}),{getValue:function(){return f},setValue:function(O){f=""+O},stopTracking:function(){s._valueTracker=null,delete s[l]}}}}function Fk(s){if(!s._valueTracker){var l=oP(s)?"checked":"value";s._valueTracker=DQ(s,l,""+s[l])}}function sP(s){if(!s)return!1;var l=s._valueTracker;if(!l)return!0;var f=l.getValue(),m="";return s&&(m=oP(s)?s.checked?"true":"false":s.value),s=m,s!==f?(l.setValue(s),!0):!1}function Pb(s){if(s=s||(typeof document<"u"?document:void 0),typeof s>"u")return null;try{return s.activeElement||s.body}catch{return s.body}}var PQ=/[\n"\\]/g;function Jo(s){return s.replace(PQ,function(l){return"\\"+l.charCodeAt(0).toString(16)+" "})}function zk(s,l,f,m,v,k,O,H){s.name="",O!=null&&typeof O!="function"&&typeof O!="symbol"&&typeof O!="boolean"?s.type=O:s.removeAttribute("type"),l!=null?O==="number"?(l===0&&s.value===""||s.value!=l)&&(s.value=""+Xo(l)):s.value!==""+Xo(l)&&(s.value=""+Xo(l)):O!=="submit"&&O!=="reset"||s.removeAttribute("value"),l!=null?Bk(s,O,Xo(l)):f!=null?Bk(s,O,Xo(f)):m!=null&&s.removeAttribute("value"),v==null&&k!=null&&(s.defaultChecked=!!k),v!=null&&(s.checked=v&&typeof v!="function"&&typeof v!="symbol"),H!=null&&typeof H!="function"&&typeof H!="symbol"&&typeof H!="boolean"?s.name=""+Xo(H):s.removeAttribute("name")}function aP(s,l,f,m,v,k,O,H){if(k!=null&&typeof k!="function"&&typeof k!="symbol"&&typeof k!="boolean"&&(s.type=k),l!=null||f!=null){if(!(k!=="submit"&&k!=="reset"||l!=null)){Fk(s);return}f=f!=null?""+Xo(f):"",l=l!=null?""+Xo(l):f,H||l===s.value||(s.value=l),s.defaultValue=l}m=m??v,m=typeof m!="function"&&typeof m!="symbol"&&!!m,s.checked=H?s.checked:!!m,s.defaultChecked=!!m,O!=null&&typeof O!="function"&&typeof O!="symbol"&&typeof O!="boolean"&&(s.name=O),Fk(s)}function Bk(s,l,f){l==="number"&&Pb(s.ownerDocument)===s||s.defaultValue===""+f||(s.defaultValue=""+f)}function ef(s,l,f,m){if(s=s.options,l){l={};for(var v=0;v<f.length;v++)l["$"+f[v]]=!0;for(f=0;f<s.length;f++)v=l.hasOwnProperty("$"+s[f].value),s[f].selected!==v&&(s[f].selected=v),v&&m&&(s[f].defaultSelected=!0)}else{for(f=""+Xo(f),l=null,v=0;v<s.length;v++){if(s[v].value===f){s[v].selected=!0,m&&(s[v].defaultSelected=!0);return}l!==null||s[v].disabled||(l=s[v])}l!==null&&(l.selected=!0)}}function lP(s,l,f){if(l!=null&&(l=""+Xo(l),l!==s.value&&(s.value=l),f==null)){s.defaultValue!==l&&(s.defaultValue=l);return}s.defaultValue=f!=null?""+Xo(f):""}function cP(s,l,f,m){if(l==null){if(m!=null){if(f!=null)throw Error(r(92));if($(m)){if(1<m.length)throw Error(r(93));m=m[0]}f=m}f==null&&(f=""),l=f}f=Xo(l),s.defaultValue=f,m=s.textContent,m===f&&m!==""&&m!==null&&(s.value=m),Fk(s)}function tf(s,l){if(l){var f=s.firstChild;if(f&&f===s.lastChild&&f.nodeType===3){f.nodeValue=l;return}}s.textContent=l}var NQ=new Set("animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp".split(" "));function uP(s,l,f){var m=l.indexOf("--")===0;f==null||typeof f=="boolean"||f===""?m?s.setProperty(l,""):l==="float"?s.cssFloat="":s[l]="":m?s.setProperty(l,f):typeof f!="number"||f===0||NQ.has(l)?l==="float"?s.cssFloat=f:s[l]=(""+f).trim():s[l]=f+"px"}function dP(s,l,f){if(l!=null&&typeof l!="object")throw Error(r(62));if(s=s.style,f!=null){for(var m in f)!f.hasOwnProperty(m)||l!=null&&l.hasOwnProperty(m)||(m.indexOf("--")===0?s.setProperty(m,""):m==="float"?s.cssFloat="":s[m]="");for(var v in l)m=l[v],l.hasOwnProperty(v)&&f[v]!==m&&uP(s,v,m)}else for(var k in l)l.hasOwnProperty(k)&&uP(s,k,l[k])}function qk(s){if(s.indexOf("-")===-1)return!1;switch(s){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var LQ=new Map([["acceptCharset","accept-charset"],["htmlFor","for"],["httpEquiv","http-equiv"],["crossOrigin","crossorigin"],["accentHeight","accent-height"],["alignmentBaseline","alignment-baseline"],["arabicForm","arabic-form"],["baselineShift","baseline-shift"],["capHeight","cap-height"],["clipPath","clip-path"],["clipRule","clip-rule"],["colorInterpolation","color-interpolation"],["colorInterpolationFilters","color-interpolation-filters"],["colorProfile","color-profile"],["colorRendering","color-rendering"],["dominantBaseline","dominant-baseline"],["enableBackground","enable-background"],["fillOpacity","fill-opacity"],["fillRule","fill-rule"],["floodColor","flood-color"],["floodOpacity","flood-opacity"],["fontFamily","font-family"],["fontSize","font-size"],["fontSizeAdjust","font-size-adjust"],["fontStretch","font-stretch"],["fontStyle","font-style"],["fontVariant","font-variant"],["fontWeight","font-weight"],["glyphName","glyph-name"],["glyphOrientationHorizontal","glyph-orientation-horizontal"],["glyphOrientationVertical","glyph-orientation-vertical"],["horizAdvX","horiz-adv-x"],["horizOriginX","horiz-origin-x"],["imageRendering","image-rendering"],["letterSpacing","letter-spacing"],["lightingColor","lighting-color"],["markerEnd","marker-end"],["markerMid","marker-mid"],["markerStart","marker-start"],["overlinePosition","overline-position"],["overlineThickness","overline-thickness"],["paintOrder","paint-order"],["panose-1","panose-1"],["pointerEvents","pointer-events"],["renderingIntent","rendering-intent"],["shapeRendering","shape-rendering"],["stopColor","stop-color"],["stopOpacity","stop-opacity"],["strikethroughPosition","strikethrough-position"],["strikethroughThickness","strikethrough-thickness"],["strokeDasharray","stroke-dasharray"],["strokeDashoffset","stroke-dashoffset"],["strokeLinecap","stroke-linecap"],["strokeLinejoin","stroke-linejoin"],["strokeMiterlimit","stroke-miterlimit"],["strokeOpacity","stroke-opacity"],["strokeWidth","stroke-width"],["textAnchor","text-anchor"],["textDecoration","text-decoration"],["textRendering","text-rendering"],["transformOrigin","transform-origin"],["underlinePosition","underline-position"],["underlineThickness","underline-thickness"],["unicodeBidi","unicode-bidi"],["unicodeRange","unicode-range"],["unitsPerEm","units-per-em"],["vAlphabetic","v-alphabetic"],["vHanging","v-hanging"],["vIdeographic","v-ideographic"],["vMathematical","v-mathematical"],["vectorEffect","vector-effect"],["vertAdvY","vert-adv-y"],["vertOriginX","vert-origin-x"],["vertOriginY","vert-origin-y"],["wordSpacing","word-spacing"],["writingMode","writing-mode"],["xmlnsXlink","xmlns:xlink"],["xHeight","x-height"]]),$Q=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function Nb(s){return $Q.test(""+s)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":s}function Ua(){}var Uk=null;function Vk(s){return s=s.target||s.srcElement||window,s.correspondingUseElement&&(s=s.correspondingUseElement),s.nodeType===3?s.parentNode:s}var nf=null,rf=null;function fP(s){var l=Br(s);if(l&&(s=l.stateNode)){var f=s[sn]||null;e:switch(s=l.stateNode,l.type){case"input":if(zk(s,f.value,f.defaultValue,f.defaultValue,f.checked,f.defaultChecked,f.type,f.name),l=f.name,f.type==="radio"&&l!=null){for(f=s;f.parentNode;)f=f.parentNode;for(f=f.querySelectorAll('input[name="'+Jo(""+l)+'"][type="radio"]'),l=0;l<f.length;l++){var m=f[l];if(m!==s&&m.form===s.form){var v=m[sn]||null;if(!v)throw Error(r(90));zk(m,v.value,v.defaultValue,v.defaultValue,v.checked,v.defaultChecked,v.type,v.name)}}for(l=0;l<f.length;l++)m=f[l],m.form===s.form&&sP(m)}break e;case"textarea":lP(s,f.value,f.defaultValue);break e;case"select":l=f.value,l!=null&&ef(s,!!f.multiple,l,!1)}}}var Kk=!1;function hP(s,l,f){if(Kk)return s(l,f);Kk=!0;try{var m=s(l);return m}finally{if(Kk=!1,(nf!==null||rf!==null)&&(xv(),nf&&(l=nf,s=rf,rf=nf=null,fP(l),s)))for(l=0;l<s.length;l++)fP(s[l])}}function Bp(s,l){var f=s.stateNode;if(f===null)return null;var m=f[sn]||null;if(m===null)return null;f=m[l];e:switch(l){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(m=!m.disabled)||(s=s.type,m=!(s==="button"||s==="input"||s==="select"||s==="textarea")),s=!m;break e;default:s=!1}if(s)return null;if(f&&typeof f!="function")throw Error(r(231,l,typeof f));return f}var Va=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Hk=!1;if(Va)try{var qp={};Object.defineProperty(qp,"passive",{get:function(){Hk=!0}}),window.addEventListener("test",qp,qp),window.removeEventListener("test",qp,qp)}catch{Hk=!1}var Ul=null,Wk=null,Lb=null;function pP(){if(Lb)return Lb;var s,l=Wk,f=l.length,m,v="value"in Ul?Ul.value:Ul.textContent,k=v.length;for(s=0;s<f&&l[s]===v[s];s++);var O=f-s;for(m=1;m<=O&&l[f-m]===v[k-m];m++);return Lb=v.slice(s,1<m?1-m:void 0)}function $b(s){var l=s.keyCode;return"charCode"in s?(s=s.charCode,s===0&&l===13&&(s=13)):s=l,s===10&&(s=13),32<=s||s===13?s:0}function jb(){return!0}function mP(){return!1}function eo(s){function l(f,m,v,k,O){this._reactName=f,this._targetInst=v,this.type=m,this.nativeEvent=k,this.target=O,this.currentTarget=null;for(var H in s)s.hasOwnProperty(H)&&(f=s[H],this[H]=f?f(k):k[H]);return this.isDefaultPrevented=(k.defaultPrevented!=null?k.defaultPrevented:k.returnValue===!1)?jb:mP,this.isPropagationStopped=mP,this}return p(l.prototype,{preventDefault:function(){this.defaultPrevented=!0;var f=this.nativeEvent;f&&(f.preventDefault?f.preventDefault():typeof f.returnValue!="unknown"&&(f.returnValue=!1),this.isDefaultPrevented=jb)},stopPropagation:function(){var f=this.nativeEvent;f&&(f.stopPropagation?f.stopPropagation():typeof f.cancelBubble!="unknown"&&(f.cancelBubble=!0),this.isPropagationStopped=jb)},persist:function(){},isPersistent:jb}),l}var du={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(s){return s.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Fb=eo(du),Up=p({},du,{view:0,detail:0}),jQ=eo(Up),Gk,Yk,Vp,zb=p({},Up,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Xk,button:0,buttons:0,relatedTarget:function(s){return s.relatedTarget===void 0?s.fromElement===s.srcElement?s.toElement:s.fromElement:s.relatedTarget},movementX:function(s){return"movementX"in s?s.movementX:(s!==Vp&&(Vp&&s.type==="mousemove"?(Gk=s.screenX-Vp.screenX,Yk=s.screenY-Vp.screenY):Yk=Gk=0,Vp=s),Gk)},movementY:function(s){return"movementY"in s?s.movementY:Yk}}),gP=eo(zb),FQ=p({},zb,{dataTransfer:0}),zQ=eo(FQ),BQ=p({},Up,{relatedTarget:0}),Qk=eo(BQ),qQ=p({},du,{animationName:0,elapsedTime:0,pseudoElement:0}),UQ=eo(qQ),VQ=p({},du,{clipboardData:function(s){return"clipboardData"in s?s.clipboardData:window.clipboardData}}),KQ=eo(VQ),HQ=p({},du,{data:0}),yP=eo(HQ),WQ={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},GQ={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},YQ={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function QQ(s){var l=this.nativeEvent;return l.getModifierState?l.getModifierState(s):(s=YQ[s])?!!l[s]:!1}function Xk(){return QQ}var XQ=p({},Up,{key:function(s){if(s.key){var l=WQ[s.key]||s.key;if(l!=="Unidentified")return l}return s.type==="keypress"?(s=$b(s),s===13?"Enter":String.fromCharCode(s)):s.type==="keydown"||s.type==="keyup"?GQ[s.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Xk,charCode:function(s){return s.type==="keypress"?$b(s):0},keyCode:function(s){return s.type==="keydown"||s.type==="keyup"?s.keyCode:0},which:function(s){return s.type==="keypress"?$b(s):s.type==="keydown"||s.type==="keyup"?s.keyCode:0}}),JQ=eo(XQ),ZQ=p({},zb,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),bP=eo(ZQ),eX=p({},Up,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Xk}),tX=eo(eX),nX=p({},du,{propertyName:0,elapsedTime:0,pseudoElement:0}),rX=eo(nX),iX=p({},zb,{deltaX:function(s){return"deltaX"in s?s.deltaX:"wheelDeltaX"in s?-s.wheelDeltaX:0},deltaY:function(s){return"deltaY"in s?s.deltaY:"wheelDeltaY"in s?-s.wheelDeltaY:"wheelDelta"in s?-s.wheelDelta:0},deltaZ:0,deltaMode:0}),oX=eo(iX),sX=p({},du,{newState:0,oldState:0}),aX=eo(sX),lX=[9,13,27,32],Jk=Va&&"CompositionEvent"in window,Kp=null;Va&&"documentMode"in document&&(Kp=document.documentMode);var cX=Va&&"TextEvent"in window&&!Kp,vP=Va&&(!Jk||Kp&&8<Kp&&11>=Kp),SP=" ",wP=!1;function xP(s,l){switch(s){case"keyup":return lX.indexOf(l.keyCode)!==-1;case"keydown":return l.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function kP(s){return s=s.detail,typeof s=="object"&&"data"in s?s.data:null}var of=!1;function uX(s,l){switch(s){case"compositionend":return kP(l);case"keypress":return l.which!==32?null:(wP=!0,SP);case"textInput":return s=l.data,s===SP&&wP?null:s;default:return null}}function dX(s,l){if(of)return s==="compositionend"||!Jk&&xP(s,l)?(s=pP(),Lb=Wk=Ul=null,of=!1,s):null;switch(s){case"paste":return null;case"keypress":if(!(l.ctrlKey||l.altKey||l.metaKey)||l.ctrlKey&&l.altKey){if(l.char&&1<l.char.length)return l.char;if(l.which)return String.fromCharCode(l.which)}return null;case"compositionend":return vP&&l.locale!=="ko"?null:l.data;default:return null}}var fX={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function _P(s){var l=s&&s.nodeName&&s.nodeName.toLowerCase();return l==="input"?!!fX[s.type]:l==="textarea"}function IP(s,l,f,m){nf?rf?rf.push(m):rf=[m]:nf=m,l=Mv(l,"onChange"),0<l.length&&(f=new Fb("onChange","change",null,f,m),s.push({event:f,listeners:l}))}var Hp=null,Wp=null;function hX(s){a2(s,0)}function Bb(s){var l=Ba(s);if(sP(l))return s}function EP(s,l){if(s==="change")return l}var TP=!1;if(Va){var Zk;if(Va){var e_="oninput"in document;if(!e_){var CP=document.createElement("div");CP.setAttribute("oninput","return;"),e_=typeof CP.oninput=="function"}Zk=e_}else Zk=!1;TP=Zk&&(!document.documentMode||9<document.documentMode)}function MP(){Hp&&(Hp.detachEvent("onpropertychange",RP),Wp=Hp=null)}function RP(s){if(s.propertyName==="value"&&Bb(Wp)){var l=[];IP(l,Wp,s,Vk(s)),hP(hX,l)}}function pX(s,l,f){s==="focusin"?(MP(),Hp=l,Wp=f,Hp.attachEvent("onpropertychange",RP)):s==="focusout"&&MP()}function mX(s){if(s==="selectionchange"||s==="keyup"||s==="keydown")return Bb(Wp)}function gX(s,l){if(s==="click")return Bb(l)}function yX(s,l){if(s==="input"||s==="change")return Bb(l)}function bX(s,l){return s===l&&(s!==0||1/s===1/l)||s!==s&&l!==l}var xo=typeof Object.is=="function"?Object.is:bX;function Gp(s,l){if(xo(s,l))return!0;if(typeof s!="object"||s===null||typeof l!="object"||l===null)return!1;var f=Object.keys(s),m=Object.keys(l);if(f.length!==m.length)return!1;for(m=0;m<f.length;m++){var v=f[m];if(!Ct.call(l,v)||!xo(s[v],l[v]))return!1}return!0}function AP(s){for(;s&&s.firstChild;)s=s.firstChild;return s}function OP(s,l){var f=AP(s);s=0;for(var m;f;){if(f.nodeType===3){if(m=s+f.textContent.length,s<=l&&m>=l)return{node:f,offset:l-s};s=m}e:{for(;f;){if(f.nextSibling){f=f.nextSibling;break e}f=f.parentNode}f=void 0}f=AP(f)}}function DP(s,l){return s&&l?s===l?!0:s&&s.nodeType===3?!1:l&&l.nodeType===3?DP(s,l.parentNode):"contains"in s?s.contains(l):s.compareDocumentPosition?!!(s.compareDocumentPosition(l)&16):!1:!1}function PP(s){s=s!=null&&s.ownerDocument!=null&&s.ownerDocument.defaultView!=null?s.ownerDocument.defaultView:window;for(var l=Pb(s.document);l instanceof s.HTMLIFrameElement;){try{var f=typeof l.contentWindow.location.href=="string"}catch{f=!1}if(f)s=l.contentWindow;else break;l=Pb(s.document)}return l}function t_(s){var l=s&&s.nodeName&&s.nodeName.toLowerCase();return l&&(l==="input"&&(s.type==="text"||s.type==="search"||s.type==="tel"||s.type==="url"||s.type==="password")||l==="textarea"||s.contentEditable==="true")}var vX=Va&&"documentMode"in document&&11>=document.documentMode,sf=null,n_=null,Yp=null,r_=!1;function NP(s,l,f){var m=f.window===f?f.document:f.nodeType===9?f:f.ownerDocument;r_||sf==null||sf!==Pb(m)||(m=sf,"selectionStart"in m&&t_(m)?m={start:m.selectionStart,end:m.selectionEnd}:(m=(m.ownerDocument&&m.ownerDocument.defaultView||window).getSelection(),m={anchorNode:m.anchorNode,anchorOffset:m.anchorOffset,focusNode:m.focusNode,focusOffset:m.focusOffset}),Yp&&Gp(Yp,m)||(Yp=m,m=Mv(n_,"onSelect"),0<m.length&&(l=new Fb("onSelect","select",null,l,f),s.push({event:l,listeners:m}),l.target=sf)))}function fu(s,l){var f={};return f[s.toLowerCase()]=l.toLowerCase(),f["Webkit"+s]="webkit"+l,f["Moz"+s]="moz"+l,f}var af={animationend:fu("Animation","AnimationEnd"),animationiteration:fu("Animation","AnimationIteration"),animationstart:fu("Animation","AnimationStart"),transitionrun:fu("Transition","TransitionRun"),transitionstart:fu("Transition","TransitionStart"),transitioncancel:fu("Transition","TransitionCancel"),transitionend:fu("Transition","TransitionEnd")},i_={},LP={};Va&&(LP=document.createElement("div").style,"AnimationEvent"in window||(delete af.animationend.animation,delete af.animationiteration.animation,delete af.animationstart.animation),"TransitionEvent"in window||delete af.transitionend.transition);function hu(s){if(i_[s])return i_[s];if(!af[s])return s;var l=af[s],f;for(f in l)if(l.hasOwnProperty(f)&&f in LP)return i_[s]=l[f];return s}var $P=hu("animationend"),jP=hu("animationiteration"),FP=hu("animationstart"),SX=hu("transitionrun"),wX=hu("transitionstart"),xX=hu("transitioncancel"),zP=hu("transitionend"),BP=new Map,o_="abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");o_.push("scrollEnd");function Ts(s,l){BP.set(s,l),sa(l,[s])}var qb=typeof reportError=="function"?reportError:function(s){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var l=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof s=="object"&&s!==null&&typeof s.message=="string"?String(s.message):String(s),error:s});if(!window.dispatchEvent(l))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",s);return}console.error(s)},Zo=[],lf=0,s_=0;function Ub(){for(var s=lf,l=s_=lf=0;l<s;){var f=Zo[l];Zo[l++]=null;var m=Zo[l];Zo[l++]=null;var v=Zo[l];Zo[l++]=null;var k=Zo[l];if(Zo[l++]=null,m!==null&&v!==null){var O=m.pending;O===null?v.next=v:(v.next=O.next,O.next=v),m.pending=v}k!==0&&qP(f,v,k)}}function Vb(s,l,f,m){Zo[lf++]=s,Zo[lf++]=l,Zo[lf++]=f,Zo[lf++]=m,s_|=m,s.lanes|=m,s=s.alternate,s!==null&&(s.lanes|=m)}function a_(s,l,f,m){return Vb(s,l,f,m),Kb(s)}function pu(s,l){return Vb(s,null,null,l),Kb(s)}function qP(s,l,f){s.lanes|=f;var m=s.alternate;m!==null&&(m.lanes|=f);for(var v=!1,k=s.return;k!==null;)k.childLanes|=f,m=k.alternate,m!==null&&(m.childLanes|=f),k.tag===22&&(s=k.stateNode,s===null||s._visibility&1||(v=!0)),s=k,k=k.return;return s.tag===3?(k=s.stateNode,v&&l!==null&&(v=31-He(f),s=k.hiddenUpdates,m=s[v],m===null?s[v]=[l]:m.push(l),l.lane=f|536870912),k):null}function Kb(s){if(50<ym)throw ym=0,gI=null,Error(r(185));for(var l=s.return;l!==null;)s=l,l=s.return;return s.tag===3?s.stateNode:null}var cf={};function kX(s,l,f,m){this.tag=s,this.key=f,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=l,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=m,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function ko(s,l,f,m){return new kX(s,l,f,m)}function l_(s){return s=s.prototype,!(!s||!s.isReactComponent)}function Ka(s,l){var f=s.alternate;return f===null?(f=ko(s.tag,l,s.key,s.mode),f.elementType=s.elementType,f.type=s.type,f.stateNode=s.stateNode,f.alternate=s,s.alternate=f):(f.pendingProps=l,f.type=s.type,f.flags=0,f.subtreeFlags=0,f.deletions=null),f.flags=s.flags&65011712,f.childLanes=s.childLanes,f.lanes=s.lanes,f.child=s.child,f.memoizedProps=s.memoizedProps,f.memoizedState=s.memoizedState,f.updateQueue=s.updateQueue,l=s.dependencies,f.dependencies=l===null?null:{lanes:l.lanes,firstContext:l.firstContext},f.sibling=s.sibling,f.index=s.index,f.ref=s.ref,f.refCleanup=s.refCleanup,f}function UP(s,l){s.flags&=65011714;var f=s.alternate;return f===null?(s.childLanes=0,s.lanes=l,s.child=null,s.subtreeFlags=0,s.memoizedProps=null,s.memoizedState=null,s.updateQueue=null,s.dependencies=null,s.stateNode=null):(s.childLanes=f.childLanes,s.lanes=f.lanes,s.child=f.child,s.subtreeFlags=0,s.deletions=null,s.memoizedProps=f.memoizedProps,s.memoizedState=f.memoizedState,s.updateQueue=f.updateQueue,s.type=f.type,l=f.dependencies,s.dependencies=l===null?null:{lanes:l.lanes,firstContext:l.firstContext}),s}function Hb(s,l,f,m,v,k){var O=0;if(m=s,typeof s=="function")l_(s)&&(O=1);else if(typeof s=="string")O=CJ(s,f,ie.current)?26:s==="html"||s==="head"||s==="body"?27:5;else e:switch(s){case U:return s=ko(31,f,l,v),s.elementType=U,s.lanes=k,s;case S:return mu(f.children,v,k,l);case w:O=8,v|=24;break;case x:return s=ko(12,f,l,v|2),s.elementType=x,s.lanes=k,s;case C:return s=ko(13,f,l,v),s.elementType=C,s.lanes=k,s;case E:return s=ko(19,f,l,v),s.elementType=E,s.lanes=k,s;default:if(typeof s=="object"&&s!==null)switch(s.$$typeof){case _:O=10;break e;case I:O=9;break e;case M:O=11;break e;case T:O=14;break e;case A:O=16,m=null;break e}O=29,f=Error(r(130,s===null?"null":typeof s,"")),m=null}return l=ko(O,f,l,v),l.elementType=s,l.type=m,l.lanes=k,l}function mu(s,l,f,m){return s=ko(7,s,m,l),s.lanes=f,s}function c_(s,l,f){return s=ko(6,s,null,l),s.lanes=f,s}function VP(s){var l=ko(18,null,null,0);return l.stateNode=s,l}function u_(s,l,f){return l=ko(4,s.children!==null?s.children:[],s.key,l),l.lanes=f,l.stateNode={containerInfo:s.containerInfo,pendingChildren:null,implementation:s.implementation},l}var KP=new WeakMap;function es(s,l){if(typeof s=="object"&&s!==null){var f=KP.get(s);return f!==void 0?f:(l={value:s,source:l,stack:Dt(l)},KP.set(s,l),l)}return{value:s,source:l,stack:Dt(l)}}var uf=[],df=0,Wb=null,Qp=0,ts=[],ns=0,Vl=null,la=1,ca="";function Ha(s,l){uf[df++]=Qp,uf[df++]=Wb,Wb=s,Qp=l}function HP(s,l,f){ts[ns++]=la,ts[ns++]=ca,ts[ns++]=Vl,Vl=s;var m=la;s=ca;var v=32-He(m)-1;m&=~(1<<v),f+=1;var k=32-He(l)+v;if(30<k){var O=v-v%5;k=(m&(1<<O)-1).toString(32),m>>=O,v-=O,la=1<<32-He(l)+v|f<<v|m,ca=k+s}else la=1<<k|f<<v|m,ca=s}function d_(s){s.return!==null&&(Ha(s,1),HP(s,1,0))}function f_(s){for(;s===Wb;)Wb=uf[--df],uf[df]=null,Qp=uf[--df],uf[df]=null;for(;s===Vl;)Vl=ts[--ns],ts[ns]=null,ca=ts[--ns],ts[ns]=null,la=ts[--ns],ts[ns]=null}function WP(s,l){ts[ns++]=la,ts[ns++]=ca,ts[ns++]=Vl,la=l.id,ca=l.overflow,Vl=s}var ui=null,Bn=null,Qt=!1,Kl=null,rs=!1,h_=Error(r(519));function Hl(s){var l=Error(r(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Xp(es(l,s)),h_}function GP(s){var l=s.stateNode,f=s.type,m=s.memoizedProps;switch(l[st]=s,l[sn]=m,f){case"dialog":Ft("cancel",l),Ft("close",l);break;case"iframe":case"object":case"embed":Ft("load",l);break;case"video":case"audio":for(f=0;f<vm.length;f++)Ft(vm[f],l);break;case"source":Ft("error",l);break;case"img":case"image":case"link":Ft("error",l),Ft("load",l);break;case"details":Ft("toggle",l);break;case"input":Ft("invalid",l),aP(l,m.value,m.defaultValue,m.checked,m.defaultChecked,m.type,m.name,!0);break;case"select":Ft("invalid",l);break;case"textarea":Ft("invalid",l),cP(l,m.value,m.defaultValue,m.children)}f=m.children,typeof f!="string"&&typeof f!="number"&&typeof f!="bigint"||l.textContent===""+f||m.suppressHydrationWarning===!0||d2(l.textContent,f)?(m.popover!=null&&(Ft("beforetoggle",l),Ft("toggle",l)),m.onScroll!=null&&Ft("scroll",l),m.onScrollEnd!=null&&Ft("scrollend",l),m.onClick!=null&&(l.onclick=Ua),l=!0):l=!1,l||Hl(s,!0)}function YP(s){for(ui=s.return;ui;)switch(ui.tag){case 5:case 31:case 13:rs=!1;return;case 27:case 3:rs=!0;return;default:ui=ui.return}}function ff(s){if(s!==ui)return!1;if(!Qt)return YP(s),Qt=!0,!1;var l=s.tag,f;if((f=l!==3&&l!==27)&&((f=l===5)&&(f=s.type,f=!(f!=="form"&&f!=="button")||AI(s.type,s.memoizedProps)),f=!f),f&&Bn&&Hl(s),YP(s),l===13){if(s=s.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(r(317));Bn=S2(s)}else if(l===31){if(s=s.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(r(317));Bn=S2(s)}else l===27?(l=Bn,sc(s.type)?(s=LI,LI=null,Bn=s):Bn=l):Bn=ui?os(s.stateNode.nextSibling):null;return!0}function gu(){Bn=ui=null,Qt=!1}function p_(){var s=Kl;return s!==null&&(io===null?io=s:io.push.apply(io,s),Kl=null),s}function Xp(s){Kl===null?Kl=[s]:Kl.push(s)}var m_=z(null),yu=null,Wa=null;function Wl(s,l,f){q(m_,l._currentValue),l._currentValue=f}function Ga(s){s._currentValue=m_.current,Q(m_)}function g_(s,l,f){for(;s!==null;){var m=s.alternate;if((s.childLanes&l)!==l?(s.childLanes|=l,m!==null&&(m.childLanes|=l)):m!==null&&(m.childLanes&l)!==l&&(m.childLanes|=l),s===f)break;s=s.return}}function y_(s,l,f,m){var v=s.child;for(v!==null&&(v.return=s);v!==null;){var k=v.dependencies;if(k!==null){var O=v.child;k=k.firstContext;e:for(;k!==null;){var H=k;k=v;for(var Z=0;Z<l.length;Z++)if(H.context===l[Z]){k.lanes|=f,H=k.alternate,H!==null&&(H.lanes|=f),g_(k.return,f,s),m||(O=null);break e}k=H.next}}else if(v.tag===18){if(O=v.return,O===null)throw Error(r(341));O.lanes|=f,k=O.alternate,k!==null&&(k.lanes|=f),g_(O,f,s),O=null}else O=v.child;if(O!==null)O.return=v;else for(O=v;O!==null;){if(O===s){O=null;break}if(v=O.sibling,v!==null){v.return=O.return,O=v;break}O=O.return}v=O}}function hf(s,l,f,m){s=null;for(var v=l,k=!1;v!==null;){if(!k){if((v.flags&524288)!==0)k=!0;else if((v.flags&262144)!==0)break}if(v.tag===10){var O=v.alternate;if(O===null)throw Error(r(387));if(O=O.memoizedProps,O!==null){var H=v.type;xo(v.pendingProps.value,O.value)||(s!==null?s.push(H):s=[H])}}else if(v===J.current){if(O=v.alternate,O===null)throw Error(r(387));O.memoizedState.memoizedState!==v.memoizedState.memoizedState&&(s!==null?s.push(_m):s=[_m])}v=v.return}s!==null&&y_(l,s,f,m),l.flags|=262144}function Gb(s){for(s=s.firstContext;s!==null;){if(!xo(s.context._currentValue,s.memoizedValue))return!0;s=s.next}return!1}function bu(s){yu=s,Wa=null,s=s.dependencies,s!==null&&(s.firstContext=null)}function di(s){return QP(yu,s)}function Yb(s,l){return yu===null&&bu(s),QP(s,l)}function QP(s,l){var f=l._currentValue;if(l={context:l,memoizedValue:f,next:null},Wa===null){if(s===null)throw Error(r(308));Wa=l,s.dependencies={lanes:0,firstContext:l},s.flags|=524288}else Wa=Wa.next=l;return f}var _X=typeof AbortController<"u"?AbortController:function(){var s=[],l=this.signal={aborted:!1,addEventListener:function(f,m){s.push(m)}};this.abort=function(){l.aborted=!0,s.forEach(function(f){return f()})}},IX=e.unstable_scheduleCallback,EX=e.unstable_NormalPriority,Rr={$$typeof:_,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function b_(){return{controller:new _X,data:new Map,refCount:0}}function Jp(s){s.refCount--,s.refCount===0&&IX(EX,function(){s.controller.abort()})}var Zp=null,v_=0,pf=0,mf=null;function TX(s,l){if(Zp===null){var f=Zp=[];v_=0,pf=xI(),mf={status:"pending",value:void 0,then:function(m){f.push(m)}}}return v_++,l.then(XP,XP),l}function XP(){if(--v_===0&&Zp!==null){mf!==null&&(mf.status="fulfilled");var s=Zp;Zp=null,pf=0,mf=null;for(var l=0;l<s.length;l++)(0,s[l])()}}function CX(s,l){var f=[],m={status:"pending",value:null,reason:null,then:function(v){f.push(v)}};return s.then(function(){m.status="fulfilled",m.value=l;for(var v=0;v<f.length;v++)(0,f[v])(l)},function(v){for(m.status="rejected",m.reason=v,v=0;v<f.length;v++)(0,f[v])(void 0)}),m}var JP=F.S;F.S=function(s,l){NL=$t(),typeof l=="object"&&l!==null&&typeof l.then=="function"&&TX(s,l),JP!==null&&JP(s,l)};var vu=z(null);function S_(){var s=vu.current;return s!==null?s:In.pooledCache}function Qb(s,l){l===null?q(vu,vu.current):q(vu,l.pool)}function ZP(){var s=S_();return s===null?null:{parent:Rr._currentValue,pool:s}}var gf=Error(r(460)),w_=Error(r(474)),Xb=Error(r(542)),Jb={then:function(){}};function eN(s){return s=s.status,s==="fulfilled"||s==="rejected"}function tN(s,l,f){switch(f=s[f],f===void 0?s.push(l):f!==l&&(l.then(Ua,Ua),l=f),l.status){case"fulfilled":return l.value;case"rejected":throw s=l.reason,rN(s),s;default:if(typeof l.status=="string")l.then(Ua,Ua);else{if(s=In,s!==null&&100<s.shellSuspendCounter)throw Error(r(482));s=l,s.status="pending",s.then(function(m){if(l.status==="pending"){var v=l;v.status="fulfilled",v.value=m}},function(m){if(l.status==="pending"){var v=l;v.status="rejected",v.reason=m}})}switch(l.status){case"fulfilled":return l.value;case"rejected":throw s=l.reason,rN(s),s}throw wu=l,gf}}function Su(s){try{var l=s._init;return l(s._payload)}catch(f){throw f!==null&&typeof f=="object"&&typeof f.then=="function"?(wu=f,gf):f}}var wu=null;function nN(){if(wu===null)throw Error(r(459));var s=wu;return wu=null,s}function rN(s){if(s===gf||s===Xb)throw Error(r(483))}var yf=null,em=0;function Zb(s){var l=em;return em+=1,yf===null&&(yf=[]),tN(yf,s,l)}function tm(s,l){l=l.props.ref,s.ref=l!==void 0?l:null}function ev(s,l){throw l.$$typeof===g?Error(r(525)):(s=Object.prototype.toString.call(l),Error(r(31,s==="[object Object]"?"object with keys {"+Object.keys(l).join(", ")+"}":s)))}function iN(s){function l(ae,ne){if(s){var ue=ae.deletions;ue===null?(ae.deletions=[ne],ae.flags|=16):ue.push(ne)}}function f(ae,ne){if(!s)return null;for(;ne!==null;)l(ae,ne),ne=ne.sibling;return null}function m(ae){for(var ne=new Map;ae!==null;)ae.key!==null?ne.set(ae.key,ae):ne.set(ae.index,ae),ae=ae.sibling;return ne}function v(ae,ne){return ae=Ka(ae,ne),ae.index=0,ae.sibling=null,ae}function k(ae,ne,ue){return ae.index=ue,s?(ue=ae.alternate,ue!==null?(ue=ue.index,ue<ne?(ae.flags|=67108866,ne):ue):(ae.flags|=67108866,ne)):(ae.flags|=1048576,ne)}function O(ae){return s&&ae.alternate===null&&(ae.flags|=67108866),ae}function H(ae,ne,ue,Se){return ne===null||ne.tag!==6?(ne=c_(ue,ae.mode,Se),ne.return=ae,ne):(ne=v(ne,ue),ne.return=ae,ne)}function Z(ae,ne,ue,Se){var nt=ue.type;return nt===S?be(ae,ne,ue.props.children,Se,ue.key):ne!==null&&(ne.elementType===nt||typeof nt=="object"&&nt!==null&&nt.$$typeof===A&&Su(nt)===ne.type)?(ne=v(ne,ue.props),tm(ne,ue),ne.return=ae,ne):(ne=Hb(ue.type,ue.key,ue.props,null,ae.mode,Se),tm(ne,ue),ne.return=ae,ne)}function de(ae,ne,ue,Se){return ne===null||ne.tag!==4||ne.stateNode.containerInfo!==ue.containerInfo||ne.stateNode.implementation!==ue.implementation?(ne=u_(ue,ae.mode,Se),ne.return=ae,ne):(ne=v(ne,ue.children||[]),ne.return=ae,ne)}function be(ae,ne,ue,Se,nt){return ne===null||ne.tag!==7?(ne=mu(ue,ae.mode,Se,nt),ne.return=ae,ne):(ne=v(ne,ue),ne.return=ae,ne)}function we(ae,ne,ue){if(typeof ne=="string"&&ne!==""||typeof ne=="number"||typeof ne=="bigint")return ne=c_(""+ne,ae.mode,ue),ne.return=ae,ne;if(typeof ne=="object"&&ne!==null){switch(ne.$$typeof){case y:return ue=Hb(ne.type,ne.key,ne.props,null,ae.mode,ue),tm(ue,ne),ue.return=ae,ue;case b:return ne=u_(ne,ae.mode,ue),ne.return=ae,ne;case A:return ne=Su(ne),we(ae,ne,ue)}if($(ne)||L(ne))return ne=mu(ne,ae.mode,ue,null),ne.return=ae,ne;if(typeof ne.then=="function")return we(ae,Zb(ne),ue);if(ne.$$typeof===_)return we(ae,Yb(ae,ne),ue);ev(ae,ne)}return null}function fe(ae,ne,ue,Se){var nt=ne!==null?ne.key:null;if(typeof ue=="string"&&ue!==""||typeof ue=="number"||typeof ue=="bigint")return nt!==null?null:H(ae,ne,""+ue,Se);if(typeof ue=="object"&&ue!==null){switch(ue.$$typeof){case y:return ue.key===nt?Z(ae,ne,ue,Se):null;case b:return ue.key===nt?de(ae,ne,ue,Se):null;case A:return ue=Su(ue),fe(ae,ne,ue,Se)}if($(ue)||L(ue))return nt!==null?null:be(ae,ne,ue,Se,null);if(typeof ue.then=="function")return fe(ae,ne,Zb(ue),Se);if(ue.$$typeof===_)return fe(ae,ne,Yb(ae,ue),Se);ev(ae,ue)}return null}function me(ae,ne,ue,Se,nt){if(typeof Se=="string"&&Se!==""||typeof Se=="number"||typeof Se=="bigint")return ae=ae.get(ue)||null,H(ne,ae,""+Se,nt);if(typeof Se=="object"&&Se!==null){switch(Se.$$typeof){case y:return ae=ae.get(Se.key===null?ue:Se.key)||null,Z(ne,ae,Se,nt);case b:return ae=ae.get(Se.key===null?ue:Se.key)||null,de(ne,ae,Se,nt);case A:return Se=Su(Se),me(ae,ne,ue,Se,nt)}if($(Se)||L(Se))return ae=ae.get(ue)||null,be(ne,ae,Se,nt,null);if(typeof Se.then=="function")return me(ae,ne,ue,Zb(Se),nt);if(Se.$$typeof===_)return me(ae,ne,ue,Yb(ne,Se),nt);ev(ne,Se)}return null}function Fe(ae,ne,ue,Se){for(var nt=null,nn=null,We=ne,It=ne=0,Ut=null;We!==null&&It<ue.length;It++){We.index>It?(Ut=We,We=null):Ut=We.sibling;var rn=fe(ae,We,ue[It],Se);if(rn===null){We===null&&(We=Ut);break}s&&We&&rn.alternate===null&&l(ae,We),ne=k(rn,ne,It),nn===null?nt=rn:nn.sibling=rn,nn=rn,We=Ut}if(It===ue.length)return f(ae,We),Qt&&Ha(ae,It),nt;if(We===null){for(;It<ue.length;It++)We=we(ae,ue[It],Se),We!==null&&(ne=k(We,ne,It),nn===null?nt=We:nn.sibling=We,nn=We);return Qt&&Ha(ae,It),nt}for(We=m(We);It<ue.length;It++)Ut=me(We,ae,It,ue[It],Se),Ut!==null&&(s&&Ut.alternate!==null&&We.delete(Ut.key===null?It:Ut.key),ne=k(Ut,ne,It),nn===null?nt=Ut:nn.sibling=Ut,nn=Ut);return s&&We.forEach(function(dc){return l(ae,dc)}),Qt&&Ha(ae,It),nt}function ct(ae,ne,ue,Se){if(ue==null)throw Error(r(151));for(var nt=null,nn=null,We=ne,It=ne=0,Ut=null,rn=ue.next();We!==null&&!rn.done;It++,rn=ue.next()){We.index>It?(Ut=We,We=null):Ut=We.sibling;var dc=fe(ae,We,rn.value,Se);if(dc===null){We===null&&(We=Ut);break}s&&We&&dc.alternate===null&&l(ae,We),ne=k(dc,ne,It),nn===null?nt=dc:nn.sibling=dc,nn=dc,We=Ut}if(rn.done)return f(ae,We),Qt&&Ha(ae,It),nt;if(We===null){for(;!rn.done;It++,rn=ue.next())rn=we(ae,rn.value,Se),rn!==null&&(ne=k(rn,ne,It),nn===null?nt=rn:nn.sibling=rn,nn=rn);return Qt&&Ha(ae,It),nt}for(We=m(We);!rn.done;It++,rn=ue.next())rn=me(We,ae,It,rn.value,Se),rn!==null&&(s&&rn.alternate!==null&&We.delete(rn.key===null?It:rn.key),ne=k(rn,ne,It),nn===null?nt=rn:nn.sibling=rn,nn=rn);return s&&We.forEach(function(FJ){return l(ae,FJ)}),Qt&&Ha(ae,It),nt}function wn(ae,ne,ue,Se){if(typeof ue=="object"&&ue!==null&&ue.type===S&&ue.key===null&&(ue=ue.props.children),typeof ue=="object"&&ue!==null){switch(ue.$$typeof){case y:e:{for(var nt=ue.key;ne!==null;){if(ne.key===nt){if(nt=ue.type,nt===S){if(ne.tag===7){f(ae,ne.sibling),Se=v(ne,ue.props.children),Se.return=ae,ae=Se;break e}}else if(ne.elementType===nt||typeof nt=="object"&&nt!==null&&nt.$$typeof===A&&Su(nt)===ne.type){f(ae,ne.sibling),Se=v(ne,ue.props),tm(Se,ue),Se.return=ae,ae=Se;break e}f(ae,ne);break}else l(ae,ne);ne=ne.sibling}ue.type===S?(Se=mu(ue.props.children,ae.mode,Se,ue.key),Se.return=ae,ae=Se):(Se=Hb(ue.type,ue.key,ue.props,null,ae.mode,Se),tm(Se,ue),Se.return=ae,ae=Se)}return O(ae);case b:e:{for(nt=ue.key;ne!==null;){if(ne.key===nt)if(ne.tag===4&&ne.stateNode.containerInfo===ue.containerInfo&&ne.stateNode.implementation===ue.implementation){f(ae,ne.sibling),Se=v(ne,ue.children||[]),Se.return=ae,ae=Se;break e}else{f(ae,ne);break}else l(ae,ne);ne=ne.sibling}Se=u_(ue,ae.mode,Se),Se.return=ae,ae=Se}return O(ae);case A:return ue=Su(ue),wn(ae,ne,ue,Se)}if($(ue))return Fe(ae,ne,ue,Se);if(L(ue)){if(nt=L(ue),typeof nt!="function")throw Error(r(150));return ue=nt.call(ue),ct(ae,ne,ue,Se)}if(typeof ue.then=="function")return wn(ae,ne,Zb(ue),Se);if(ue.$$typeof===_)return wn(ae,ne,Yb(ae,ue),Se);ev(ae,ue)}return typeof ue=="string"&&ue!==""||typeof ue=="number"||typeof ue=="bigint"?(ue=""+ue,ne!==null&&ne.tag===6?(f(ae,ne.sibling),Se=v(ne,ue),Se.return=ae,ae=Se):(f(ae,ne),Se=c_(ue,ae.mode,Se),Se.return=ae,ae=Se),O(ae)):f(ae,ne)}return function(ae,ne,ue,Se){try{em=0;var nt=wn(ae,ne,ue,Se);return yf=null,nt}catch(We){if(We===gf||We===Xb)throw We;var nn=ko(29,We,null,ae.mode);return nn.lanes=Se,nn.return=ae,nn}finally{}}}var xu=iN(!0),oN=iN(!1),Gl=!1;function x_(s){s.updateQueue={baseState:s.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function k_(s,l){s=s.updateQueue,l.updateQueue===s&&(l.updateQueue={baseState:s.baseState,firstBaseUpdate:s.firstBaseUpdate,lastBaseUpdate:s.lastBaseUpdate,shared:s.shared,callbacks:null})}function Yl(s){return{lane:s,tag:0,payload:null,callback:null,next:null}}function Ql(s,l,f){var m=s.updateQueue;if(m===null)return null;if(m=m.shared,(an&2)!==0){var v=m.pending;return v===null?l.next=l:(l.next=v.next,v.next=l),m.pending=l,l=Kb(s),qP(s,null,f),l}return Vb(s,m,l,f),Kb(s)}function nm(s,l,f){if(l=l.updateQueue,l!==null&&(l=l.shared,(f&4194048)!==0)){var m=l.lanes;m&=s.pendingLanes,f|=m,l.lanes=f,ot(s,f)}}function __(s,l){var f=s.updateQueue,m=s.alternate;if(m!==null&&(m=m.updateQueue,f===m)){var v=null,k=null;if(f=f.firstBaseUpdate,f!==null){do{var O={lane:f.lane,tag:f.tag,payload:f.payload,callback:null,next:null};k===null?v=k=O:k=k.next=O,f=f.next}while(f!==null);k===null?v=k=l:k=k.next=l}else v=k=l;f={baseState:m.baseState,firstBaseUpdate:v,lastBaseUpdate:k,shared:m.shared,callbacks:m.callbacks},s.updateQueue=f;return}s=f.lastBaseUpdate,s===null?f.firstBaseUpdate=l:s.next=l,f.lastBaseUpdate=l}var I_=!1;function rm(){if(I_){var s=mf;if(s!==null)throw s}}function im(s,l,f,m){I_=!1;var v=s.updateQueue;Gl=!1;var k=v.firstBaseUpdate,O=v.lastBaseUpdate,H=v.shared.pending;if(H!==null){v.shared.pending=null;var Z=H,de=Z.next;Z.next=null,O===null?k=de:O.next=de,O=Z;var be=s.alternate;be!==null&&(be=be.updateQueue,H=be.lastBaseUpdate,H!==O&&(H===null?be.firstBaseUpdate=de:H.next=de,be.lastBaseUpdate=Z))}if(k!==null){var we=v.baseState;O=0,be=de=Z=null,H=k;do{var fe=H.lane&-536870913,me=fe!==H.lane;if(me?(qt&fe)===fe:(m&fe)===fe){fe!==0&&fe===pf&&(I_=!0),be!==null&&(be=be.next={lane:0,tag:H.tag,payload:H.payload,callback:null,next:null});e:{var Fe=s,ct=H;fe=l;var wn=f;switch(ct.tag){case 1:if(Fe=ct.payload,typeof Fe=="function"){we=Fe.call(wn,we,fe);break e}we=Fe;break e;case 3:Fe.flags=Fe.flags&-65537|128;case 0:if(Fe=ct.payload,fe=typeof Fe=="function"?Fe.call(wn,we,fe):Fe,fe==null)break e;we=p({},we,fe);break e;case 2:Gl=!0}}fe=H.callback,fe!==null&&(s.flags|=64,me&&(s.flags|=8192),me=v.callbacks,me===null?v.callbacks=[fe]:me.push(fe))}else me={lane:fe,tag:H.tag,payload:H.payload,callback:H.callback,next:null},be===null?(de=be=me,Z=we):be=be.next=me,O|=fe;if(H=H.next,H===null){if(H=v.shared.pending,H===null)break;me=H,H=me.next,me.next=null,v.lastBaseUpdate=me,v.shared.pending=null}}while(!0);be===null&&(Z=we),v.baseState=Z,v.firstBaseUpdate=de,v.lastBaseUpdate=be,k===null&&(v.shared.lanes=0),tc|=O,s.lanes=O,s.memoizedState=we}}function sN(s,l){if(typeof s!="function")throw Error(r(191,s));s.call(l)}function aN(s,l){var f=s.callbacks;if(f!==null)for(s.callbacks=null,s=0;s<f.length;s++)sN(f[s],l)}var bf=z(null),tv=z(0);function lN(s,l){s=rl,q(tv,s),q(bf,l),rl=s|l.baseLanes}function E_(){q(tv,rl),q(bf,bf.current)}function T_(){rl=tv.current,Q(bf),Q(tv)}var _o=z(null),is=null;function Xl(s){var l=s.alternate;q(yr,yr.current&1),q(_o,s),is===null&&(l===null||bf.current!==null||l.memoizedState!==null)&&(is=s)}function C_(s){q(yr,yr.current),q(_o,s),is===null&&(is=s)}function cN(s){s.tag===22?(q(yr,yr.current),q(_o,s),is===null&&(is=s)):Jl()}function Jl(){q(yr,yr.current),q(_o,_o.current)}function Io(s){Q(_o),is===s&&(is=null),Q(yr)}var yr=z(0);function nv(s){for(var l=s;l!==null;){if(l.tag===13){var f=l.memoizedState;if(f!==null&&(f=f.dehydrated,f===null||PI(f)||NI(f)))return l}else if(l.tag===19&&(l.memoizedProps.revealOrder==="forwards"||l.memoizedProps.revealOrder==="backwards"||l.memoizedProps.revealOrder==="unstable_legacy-backwards"||l.memoizedProps.revealOrder==="together")){if((l.flags&128)!==0)return l}else if(l.child!==null){l.child.return=l,l=l.child;continue}if(l===s)break;for(;l.sibling===null;){if(l.return===null||l.return===s)return null;l=l.return}l.sibling.return=l.return,l=l.sibling}return null}var Ya=0,xt=null,vn=null,Ar=null,rv=!1,vf=!1,ku=!1,iv=0,om=0,Sf=null,MX=0;function or(){throw Error(r(321))}function M_(s,l){if(l===null)return!1;for(var f=0;f<l.length&&f<s.length;f++)if(!xo(s[f],l[f]))return!1;return!0}function R_(s,l,f,m,v,k){return Ya=k,xt=l,l.memoizedState=null,l.updateQueue=null,l.lanes=0,F.H=s===null||s.memoizedState===null?HN:K_,ku=!1,k=f(m,v),ku=!1,vf&&(k=dN(l,f,m,v)),uN(s),k}function uN(s){F.H=lm;var l=vn!==null&&vn.next!==null;if(Ya=0,Ar=vn=xt=null,rv=!1,om=0,Sf=null,l)throw Error(r(300));s===null||Or||(s=s.dependencies,s!==null&&Gb(s)&&(Or=!0))}function dN(s,l,f,m){xt=s;var v=0;do{if(vf&&(Sf=null),om=0,vf=!1,25<=v)throw Error(r(301));if(v+=1,Ar=vn=null,s.updateQueue!=null){var k=s.updateQueue;k.lastEffect=null,k.events=null,k.stores=null,k.memoCache!=null&&(k.memoCache.index=0)}F.H=WN,k=l(f,m)}while(vf);return k}function RX(){var s=F.H,l=s.useState()[0];return l=typeof l.then=="function"?sm(l):l,s=s.useState()[0],(vn!==null?vn.memoizedState:null)!==s&&(xt.flags|=1024),l}function A_(){var s=iv!==0;return iv=0,s}function O_(s,l,f){l.updateQueue=s.updateQueue,l.flags&=-2053,s.lanes&=~f}function D_(s){if(rv){for(s=s.memoizedState;s!==null;){var l=s.queue;l!==null&&(l.pending=null),s=s.next}rv=!1}Ya=0,Ar=vn=xt=null,vf=!1,om=iv=0,Sf=null}function Fi(){var s={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Ar===null?xt.memoizedState=Ar=s:Ar=Ar.next=s,Ar}function br(){if(vn===null){var s=xt.alternate;s=s!==null?s.memoizedState:null}else s=vn.next;var l=Ar===null?xt.memoizedState:Ar.next;if(l!==null)Ar=l,vn=s;else{if(s===null)throw xt.alternate===null?Error(r(467)):Error(r(310));vn=s,s={memoizedState:vn.memoizedState,baseState:vn.baseState,baseQueue:vn.baseQueue,queue:vn.queue,next:null},Ar===null?xt.memoizedState=Ar=s:Ar=Ar.next=s}return Ar}function ov(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function sm(s){var l=om;return om+=1,Sf===null&&(Sf=[]),s=tN(Sf,s,l),l=xt,(Ar===null?l.memoizedState:Ar.next)===null&&(l=l.alternate,F.H=l===null||l.memoizedState===null?HN:K_),s}function sv(s){if(s!==null&&typeof s=="object"){if(typeof s.then=="function")return sm(s);if(s.$$typeof===_)return di(s)}throw Error(r(438,String(s)))}function P_(s){var l=null,f=xt.updateQueue;if(f!==null&&(l=f.memoCache),l==null){var m=xt.alternate;m!==null&&(m=m.updateQueue,m!==null&&(m=m.memoCache,m!=null&&(l={data:m.data.map(function(v){return v.slice()}),index:0})))}if(l==null&&(l={data:[],index:0}),f===null&&(f=ov(),xt.updateQueue=f),f.memoCache=l,f=l.data[l.index],f===void 0)for(f=l.data[l.index]=Array(s),m=0;m<s;m++)f[m]=R;return l.index++,f}function Qa(s,l){return typeof l=="function"?l(s):l}function av(s){var l=br();return N_(l,vn,s)}function N_(s,l,f){var m=s.queue;if(m===null)throw Error(r(311));m.lastRenderedReducer=f;var v=s.baseQueue,k=m.pending;if(k!==null){if(v!==null){var O=v.next;v.next=k.next,k.next=O}l.baseQueue=v=k,m.pending=null}if(k=s.baseState,v===null)s.memoizedState=k;else{l=v.next;var H=O=null,Z=null,de=l,be=!1;do{var we=de.lane&-536870913;if(we!==de.lane?(qt&we)===we:(Ya&we)===we){var fe=de.revertLane;if(fe===0)Z!==null&&(Z=Z.next={lane:0,revertLane:0,gesture:null,action:de.action,hasEagerState:de.hasEagerState,eagerState:de.eagerState,next:null}),we===pf&&(be=!0);else if((Ya&fe)===fe){de=de.next,fe===pf&&(be=!0);continue}else we={lane:0,revertLane:de.revertLane,gesture:null,action:de.action,hasEagerState:de.hasEagerState,eagerState:de.eagerState,next:null},Z===null?(H=Z=we,O=k):Z=Z.next=we,xt.lanes|=fe,tc|=fe;we=de.action,ku&&f(k,we),k=de.hasEagerState?de.eagerState:f(k,we)}else fe={lane:we,revertLane:de.revertLane,gesture:de.gesture,action:de.action,hasEagerState:de.hasEagerState,eagerState:de.eagerState,next:null},Z===null?(H=Z=fe,O=k):Z=Z.next=fe,xt.lanes|=we,tc|=we;de=de.next}while(de!==null&&de!==l);if(Z===null?O=k:Z.next=H,!xo(k,s.memoizedState)&&(Or=!0,be&&(f=mf,f!==null)))throw f;s.memoizedState=k,s.baseState=O,s.baseQueue=Z,m.lastRenderedState=k}return v===null&&(m.lanes=0),[s.memoizedState,m.dispatch]}function L_(s){var l=br(),f=l.queue;if(f===null)throw Error(r(311));f.lastRenderedReducer=s;var m=f.dispatch,v=f.pending,k=l.memoizedState;if(v!==null){f.pending=null;var O=v=v.next;do k=s(k,O.action),O=O.next;while(O!==v);xo(k,l.memoizedState)||(Or=!0),l.memoizedState=k,l.baseQueue===null&&(l.baseState=k),f.lastRenderedState=k}return[k,m]}function fN(s,l,f){var m=xt,v=br(),k=Qt;if(k){if(f===void 0)throw Error(r(407));f=f()}else f=l();var O=!xo((vn||v).memoizedState,f);if(O&&(v.memoizedState=f,Or=!0),v=v.queue,F_(mN.bind(null,m,v,s),[s]),v.getSnapshot!==l||O||Ar!==null&&Ar.memoizedState.tag&1){if(m.flags|=2048,wf(9,{destroy:void 0},pN.bind(null,m,v,f,l),null),In===null)throw Error(r(349));k||(Ya&127)!==0||hN(m,l,f)}return f}function hN(s,l,f){s.flags|=16384,s={getSnapshot:l,value:f},l=xt.updateQueue,l===null?(l=ov(),xt.updateQueue=l,l.stores=[s]):(f=l.stores,f===null?l.stores=[s]:f.push(s))}function pN(s,l,f,m){l.value=f,l.getSnapshot=m,gN(l)&&yN(s)}function mN(s,l,f){return f(function(){gN(l)&&yN(s)})}function gN(s){var l=s.getSnapshot;s=s.value;try{var f=l();return!xo(s,f)}catch{return!0}}function yN(s){var l=pu(s,2);l!==null&&oo(l,s,2)}function $_(s){var l=Fi();if(typeof s=="function"){var f=s;if(s=f(),ku){Ne(!0);try{f()}finally{Ne(!1)}}}return l.memoizedState=l.baseState=s,l.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Qa,lastRenderedState:s},l}function bN(s,l,f,m){return s.baseState=f,N_(s,vn,typeof m=="function"?m:Qa)}function AX(s,l,f,m,v){if(uv(s))throw Error(r(485));if(s=l.action,s!==null){var k={payload:v,action:s,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(O){k.listeners.push(O)}};F.T!==null?f(!0):k.isTransition=!1,m(k),f=l.pending,f===null?(k.next=l.pending=k,vN(l,k)):(k.next=f.next,l.pending=f.next=k)}}function vN(s,l){var f=l.action,m=l.payload,v=s.state;if(l.isTransition){var k=F.T,O={};F.T=O;try{var H=f(v,m),Z=F.S;Z!==null&&Z(O,H),SN(s,l,H)}catch(de){j_(s,l,de)}finally{k!==null&&O.types!==null&&(k.types=O.types),F.T=k}}else try{k=f(v,m),SN(s,l,k)}catch(de){j_(s,l,de)}}function SN(s,l,f){f!==null&&typeof f=="object"&&typeof f.then=="function"?f.then(function(m){wN(s,l,m)},function(m){return j_(s,l,m)}):wN(s,l,f)}function wN(s,l,f){l.status="fulfilled",l.value=f,xN(l),s.state=f,l=s.pending,l!==null&&(f=l.next,f===l?s.pending=null:(f=f.next,l.next=f,vN(s,f)))}function j_(s,l,f){var m=s.pending;if(s.pending=null,m!==null){m=m.next;do l.status="rejected",l.reason=f,xN(l),l=l.next;while(l!==m)}s.action=null}function xN(s){s=s.listeners;for(var l=0;l<s.length;l++)(0,s[l])()}function kN(s,l){return l}function _N(s,l){if(Qt){var f=In.formState;if(f!==null){e:{var m=xt;if(Qt){if(Bn){t:{for(var v=Bn,k=rs;v.nodeType!==8;){if(!k){v=null;break t}if(v=os(v.nextSibling),v===null){v=null;break t}}k=v.data,v=k==="F!"||k==="F"?v:null}if(v){Bn=os(v.nextSibling),m=v.data==="F!";break e}}Hl(m)}m=!1}m&&(l=f[0])}}return f=Fi(),f.memoizedState=f.baseState=l,m={pending:null,lanes:0,dispatch:null,lastRenderedReducer:kN,lastRenderedState:l},f.queue=m,f=UN.bind(null,xt,m),m.dispatch=f,m=$_(!1),k=V_.bind(null,xt,!1,m.queue),m=Fi(),v={state:l,dispatch:null,action:s,pending:null},m.queue=v,f=AX.bind(null,xt,v,k,f),v.dispatch=f,m.memoizedState=s,[l,f,!1]}function IN(s){var l=br();return EN(l,vn,s)}function EN(s,l,f){if(l=N_(s,l,kN)[0],s=av(Qa)[0],typeof l=="object"&&l!==null&&typeof l.then=="function")try{var m=sm(l)}catch(O){throw O===gf?Xb:O}else m=l;l=br();var v=l.queue,k=v.dispatch;return f!==l.memoizedState&&(xt.flags|=2048,wf(9,{destroy:void 0},OX.bind(null,v,f),null)),[m,k,s]}function OX(s,l){s.action=l}function TN(s){var l=br(),f=vn;if(f!==null)return EN(l,f,s);br(),l=l.memoizedState,f=br();var m=f.queue.dispatch;return f.memoizedState=s,[l,m,!1]}function wf(s,l,f,m){return s={tag:s,create:f,deps:m,inst:l,next:null},l=xt.updateQueue,l===null&&(l=ov(),xt.updateQueue=l),f=l.lastEffect,f===null?l.lastEffect=s.next=s:(m=f.next,f.next=s,s.next=m,l.lastEffect=s),s}function CN(){return br().memoizedState}function lv(s,l,f,m){var v=Fi();xt.flags|=s,v.memoizedState=wf(1|l,{destroy:void 0},f,m===void 0?null:m)}function cv(s,l,f,m){var v=br();m=m===void 0?null:m;var k=v.memoizedState.inst;vn!==null&&m!==null&&M_(m,vn.memoizedState.deps)?v.memoizedState=wf(l,k,f,m):(xt.flags|=s,v.memoizedState=wf(1|l,k,f,m))}function MN(s,l){lv(8390656,8,s,l)}function F_(s,l){cv(2048,8,s,l)}function DX(s){xt.flags|=4;var l=xt.updateQueue;if(l===null)l=ov(),xt.updateQueue=l,l.events=[s];else{var f=l.events;f===null?l.events=[s]:f.push(s)}}function RN(s){var l=br().memoizedState;return DX({ref:l,nextImpl:s}),function(){if((an&2)!==0)throw Error(r(440));return l.impl.apply(void 0,arguments)}}function AN(s,l){return cv(4,2,s,l)}function ON(s,l){return cv(4,4,s,l)}function DN(s,l){if(typeof l=="function"){s=s();var f=l(s);return function(){typeof f=="function"?f():l(null)}}if(l!=null)return s=s(),l.current=s,function(){l.current=null}}function PN(s,l,f){f=f!=null?f.concat([s]):null,cv(4,4,DN.bind(null,l,s),f)}function z_(){}function NN(s,l){var f=br();l=l===void 0?null:l;var m=f.memoizedState;return l!==null&&M_(l,m[1])?m[0]:(f.memoizedState=[s,l],s)}function LN(s,l){var f=br();l=l===void 0?null:l;var m=f.memoizedState;if(l!==null&&M_(l,m[1]))return m[0];if(m=s(),ku){Ne(!0);try{s()}finally{Ne(!1)}}return f.memoizedState=[m,l],m}function B_(s,l,f){return f===void 0||(Ya&1073741824)!==0&&(qt&261930)===0?s.memoizedState=l:(s.memoizedState=f,s=$L(),xt.lanes|=s,tc|=s,f)}function $N(s,l,f,m){return xo(f,l)?f:bf.current!==null?(s=B_(s,f,m),xo(s,l)||(Or=!0),s):(Ya&42)===0||(Ya&1073741824)!==0&&(qt&261930)===0?(Or=!0,s.memoizedState=f):(s=$L(),xt.lanes|=s,tc|=s,l)}function jN(s,l,f,m,v){var k=K.p;K.p=k!==0&&8>k?k:8;var O=F.T,H={};F.T=H,V_(s,!1,l,f);try{var Z=v(),de=F.S;if(de!==null&&de(H,Z),Z!==null&&typeof Z=="object"&&typeof Z.then=="function"){var be=CX(Z,m);am(s,l,be,Co(s))}else am(s,l,m,Co(s))}catch(we){am(s,l,{then:function(){},status:"rejected",reason:we},Co())}finally{K.p=k,O!==null&&H.types!==null&&(O.types=H.types),F.T=O}}function PX(){}function q_(s,l,f,m){if(s.tag!==5)throw Error(r(476));var v=FN(s).queue;jN(s,v,l,W,f===null?PX:function(){return zN(s),f(m)})}function FN(s){var l=s.memoizedState;if(l!==null)return l;l={memoizedState:W,baseState:W,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Qa,lastRenderedState:W},next:null};var f={};return l.next={memoizedState:f,baseState:f,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Qa,lastRenderedState:f},next:null},s.memoizedState=l,s=s.alternate,s!==null&&(s.memoizedState=l),l}function zN(s){var l=FN(s);l.next===null&&(l=s.alternate.memoizedState),am(s,l.next.queue,{},Co())}function U_(){return di(_m)}function BN(){return br().memoizedState}function qN(){return br().memoizedState}function NX(s){for(var l=s.return;l!==null;){switch(l.tag){case 24:case 3:var f=Co();s=Yl(f);var m=Ql(l,s,f);m!==null&&(oo(m,l,f),nm(m,l,f)),l={cache:b_()},s.payload=l;return}l=l.return}}function LX(s,l,f){var m=Co();f={lane:m,revertLane:0,gesture:null,action:f,hasEagerState:!1,eagerState:null,next:null},uv(s)?VN(l,f):(f=a_(s,l,f,m),f!==null&&(oo(f,s,m),KN(f,l,m)))}function UN(s,l,f){var m=Co();am(s,l,f,m)}function am(s,l,f,m){var v={lane:m,revertLane:0,gesture:null,action:f,hasEagerState:!1,eagerState:null,next:null};if(uv(s))VN(l,v);else{var k=s.alternate;if(s.lanes===0&&(k===null||k.lanes===0)&&(k=l.lastRenderedReducer,k!==null))try{var O=l.lastRenderedState,H=k(O,f);if(v.hasEagerState=!0,v.eagerState=H,xo(H,O))return Vb(s,l,v,0),In===null&&Ub(),!1}catch{}finally{}if(f=a_(s,l,v,m),f!==null)return oo(f,s,m),KN(f,l,m),!0}return!1}function V_(s,l,f,m){if(m={lane:2,revertLane:xI(),gesture:null,action:m,hasEagerState:!1,eagerState:null,next:null},uv(s)){if(l)throw Error(r(479))}else l=a_(s,f,m,2),l!==null&&oo(l,s,2)}function uv(s){var l=s.alternate;return s===xt||l!==null&&l===xt}function VN(s,l){vf=rv=!0;var f=s.pending;f===null?l.next=l:(l.next=f.next,f.next=l),s.pending=l}function KN(s,l,f){if((f&4194048)!==0){var m=l.lanes;m&=s.pendingLanes,f|=m,l.lanes=f,ot(s,f)}}var lm={readContext:di,use:sv,useCallback:or,useContext:or,useEffect:or,useImperativeHandle:or,useLayoutEffect:or,useInsertionEffect:or,useMemo:or,useReducer:or,useRef:or,useState:or,useDebugValue:or,useDeferredValue:or,useTransition:or,useSyncExternalStore:or,useId:or,useHostTransitionStatus:or,useFormState:or,useActionState:or,useOptimistic:or,useMemoCache:or,useCacheRefresh:or};lm.useEffectEvent=or;var HN={readContext:di,use:sv,useCallback:function(s,l){return Fi().memoizedState=[s,l===void 0?null:l],s},useContext:di,useEffect:MN,useImperativeHandle:function(s,l,f){f=f!=null?f.concat([s]):null,lv(4194308,4,DN.bind(null,l,s),f)},useLayoutEffect:function(s,l){return lv(4194308,4,s,l)},useInsertionEffect:function(s,l){lv(4,2,s,l)},useMemo:function(s,l){var f=Fi();l=l===void 0?null:l;var m=s();if(ku){Ne(!0);try{s()}finally{Ne(!1)}}return f.memoizedState=[m,l],m},useReducer:function(s,l,f){var m=Fi();if(f!==void 0){var v=f(l);if(ku){Ne(!0);try{f(l)}finally{Ne(!1)}}}else v=l;return m.memoizedState=m.baseState=v,s={pending:null,lanes:0,dispatch:null,lastRenderedReducer:s,lastRenderedState:v},m.queue=s,s=s.dispatch=LX.bind(null,xt,s),[m.memoizedState,s]},useRef:function(s){var l=Fi();return s={current:s},l.memoizedState=s},useState:function(s){s=$_(s);var l=s.queue,f=UN.bind(null,xt,l);return l.dispatch=f,[s.memoizedState,f]},useDebugValue:z_,useDeferredValue:function(s,l){var f=Fi();return B_(f,s,l)},useTransition:function(){var s=$_(!1);return s=jN.bind(null,xt,s.queue,!0,!1),Fi().memoizedState=s,[!1,s]},useSyncExternalStore:function(s,l,f){var m=xt,v=Fi();if(Qt){if(f===void 0)throw Error(r(407));f=f()}else{if(f=l(),In===null)throw Error(r(349));(qt&127)!==0||hN(m,l,f)}v.memoizedState=f;var k={value:f,getSnapshot:l};return v.queue=k,MN(mN.bind(null,m,k,s),[s]),m.flags|=2048,wf(9,{destroy:void 0},pN.bind(null,m,k,f,l),null),f},useId:function(){var s=Fi(),l=In.identifierPrefix;if(Qt){var f=ca,m=la;f=(m&~(1<<32-He(m)-1)).toString(32)+f,l="_"+l+"R_"+f,f=iv++,0<f&&(l+="H"+f.toString(32)),l+="_"}else f=MX++,l="_"+l+"r_"+f.toString(32)+"_";return s.memoizedState=l},useHostTransitionStatus:U_,useFormState:_N,useActionState:_N,useOptimistic:function(s){var l=Fi();l.memoizedState=l.baseState=s;var f={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return l.queue=f,l=V_.bind(null,xt,!0,f),f.dispatch=l,[s,l]},useMemoCache:P_,useCacheRefresh:function(){return Fi().memoizedState=NX.bind(null,xt)},useEffectEvent:function(s){var l=Fi(),f={impl:s};return l.memoizedState=f,function(){if((an&2)!==0)throw Error(r(440));return f.impl.apply(void 0,arguments)}}},K_={readContext:di,use:sv,useCallback:NN,useContext:di,useEffect:F_,useImperativeHandle:PN,useInsertionEffect:AN,useLayoutEffect:ON,useMemo:LN,useReducer:av,useRef:CN,useState:function(){return av(Qa)},useDebugValue:z_,useDeferredValue:function(s,l){var f=br();return $N(f,vn.memoizedState,s,l)},useTransition:function(){var s=av(Qa)[0],l=br().memoizedState;return[typeof s=="boolean"?s:sm(s),l]},useSyncExternalStore:fN,useId:BN,useHostTransitionStatus:U_,useFormState:IN,useActionState:IN,useOptimistic:function(s,l){var f=br();return bN(f,vn,s,l)},useMemoCache:P_,useCacheRefresh:qN};K_.useEffectEvent=RN;var WN={readContext:di,use:sv,useCallback:NN,useContext:di,useEffect:F_,useImperativeHandle:PN,useInsertionEffect:AN,useLayoutEffect:ON,useMemo:LN,useReducer:L_,useRef:CN,useState:function(){return L_(Qa)},useDebugValue:z_,useDeferredValue:function(s,l){var f=br();return vn===null?B_(f,s,l):$N(f,vn.memoizedState,s,l)},useTransition:function(){var s=L_(Qa)[0],l=br().memoizedState;return[typeof s=="boolean"?s:sm(s),l]},useSyncExternalStore:fN,useId:BN,useHostTransitionStatus:U_,useFormState:TN,useActionState:TN,useOptimistic:function(s,l){var f=br();return vn!==null?bN(f,vn,s,l):(f.baseState=s,[s,f.queue.dispatch])},useMemoCache:P_,useCacheRefresh:qN};WN.useEffectEvent=RN;function H_(s,l,f,m){l=s.memoizedState,f=f(m,l),f=f==null?l:p({},l,f),s.memoizedState=f,s.lanes===0&&(s.updateQueue.baseState=f)}var W_={enqueueSetState:function(s,l,f){s=s._reactInternals;var m=Co(),v=Yl(m);v.payload=l,f!=null&&(v.callback=f),l=Ql(s,v,m),l!==null&&(oo(l,s,m),nm(l,s,m))},enqueueReplaceState:function(s,l,f){s=s._reactInternals;var m=Co(),v=Yl(m);v.tag=1,v.payload=l,f!=null&&(v.callback=f),l=Ql(s,v,m),l!==null&&(oo(l,s,m),nm(l,s,m))},enqueueForceUpdate:function(s,l){s=s._reactInternals;var f=Co(),m=Yl(f);m.tag=2,l!=null&&(m.callback=l),l=Ql(s,m,f),l!==null&&(oo(l,s,f),nm(l,s,f))}};function GN(s,l,f,m,v,k,O){return s=s.stateNode,typeof s.shouldComponentUpdate=="function"?s.shouldComponentUpdate(m,k,O):l.prototype&&l.prototype.isPureReactComponent?!Gp(f,m)||!Gp(v,k):!0}function YN(s,l,f,m){s=l.state,typeof l.componentWillReceiveProps=="function"&&l.componentWillReceiveProps(f,m),typeof l.UNSAFE_componentWillReceiveProps=="function"&&l.UNSAFE_componentWillReceiveProps(f,m),l.state!==s&&W_.enqueueReplaceState(l,l.state,null)}function _u(s,l){var f=l;if("ref"in l){f={};for(var m in l)m!=="ref"&&(f[m]=l[m])}if(s=s.defaultProps){f===l&&(f=p({},f));for(var v in s)f[v]===void 0&&(f[v]=s[v])}return f}function QN(s){qb(s)}function XN(s){console.error(s)}function JN(s){qb(s)}function dv(s,l){try{var f=s.onUncaughtError;f(l.value,{componentStack:l.stack})}catch(m){setTimeout(function(){throw m})}}function ZN(s,l,f){try{var m=s.onCaughtError;m(f.value,{componentStack:f.stack,errorBoundary:l.tag===1?l.stateNode:null})}catch(v){setTimeout(function(){throw v})}}function G_(s,l,f){return f=Yl(f),f.tag=3,f.payload={element:null},f.callback=function(){dv(s,l)},f}function eL(s){return s=Yl(s),s.tag=3,s}function tL(s,l,f,m){var v=f.type.getDerivedStateFromError;if(typeof v=="function"){var k=m.value;s.payload=function(){return v(k)},s.callback=function(){ZN(l,f,m)}}var O=f.stateNode;O!==null&&typeof O.componentDidCatch=="function"&&(s.callback=function(){ZN(l,f,m),typeof v!="function"&&(nc===null?nc=new Set([this]):nc.add(this));var H=m.stack;this.componentDidCatch(m.value,{componentStack:H!==null?H:""})})}function $X(s,l,f,m,v){if(f.flags|=32768,m!==null&&typeof m=="object"&&typeof m.then=="function"){if(l=f.alternate,l!==null&&hf(l,f,v,!0),f=_o.current,f!==null){switch(f.tag){case 31:case 13:return is===null?kv():f.alternate===null&&sr===0&&(sr=3),f.flags&=-257,f.flags|=65536,f.lanes=v,m===Jb?f.flags|=16384:(l=f.updateQueue,l===null?f.updateQueue=new Set([m]):l.add(m),vI(s,m,v)),!1;case 22:return f.flags|=65536,m===Jb?f.flags|=16384:(l=f.updateQueue,l===null?(l={transitions:null,markerInstances:null,retryQueue:new Set([m])},f.updateQueue=l):(f=l.retryQueue,f===null?l.retryQueue=new Set([m]):f.add(m)),vI(s,m,v)),!1}throw Error(r(435,f.tag))}return vI(s,m,v),kv(),!1}if(Qt)return l=_o.current,l!==null?((l.flags&65536)===0&&(l.flags|=256),l.flags|=65536,l.lanes=v,m!==h_&&(s=Error(r(422),{cause:m}),Xp(es(s,f)))):(m!==h_&&(l=Error(r(423),{cause:m}),Xp(es(l,f))),s=s.current.alternate,s.flags|=65536,v&=-v,s.lanes|=v,m=es(m,f),v=G_(s.stateNode,m,v),__(s,v),sr!==4&&(sr=2)),!1;var k=Error(r(520),{cause:m});if(k=es(k,f),gm===null?gm=[k]:gm.push(k),sr!==4&&(sr=2),l===null)return!0;m=es(m,f),f=l;do{switch(f.tag){case 3:return f.flags|=65536,s=v&-v,f.lanes|=s,s=G_(f.stateNode,m,s),__(f,s),!1;case 1:if(l=f.type,k=f.stateNode,(f.flags&128)===0&&(typeof l.getDerivedStateFromError=="function"||k!==null&&typeof k.componentDidCatch=="function"&&(nc===null||!nc.has(k))))return f.flags|=65536,v&=-v,f.lanes|=v,v=eL(v),tL(v,s,f,m),__(f,v),!1}f=f.return}while(f!==null);return!1}var Y_=Error(r(461)),Or=!1;function fi(s,l,f,m){l.child=s===null?oN(l,null,f,m):xu(l,s.child,f,m)}function nL(s,l,f,m,v){f=f.render;var k=l.ref;if("ref"in m){var O={};for(var H in m)H!=="ref"&&(O[H]=m[H])}else O=m;return bu(l),m=R_(s,l,f,O,k,v),H=A_(),s!==null&&!Or?(O_(s,l,v),Xa(s,l,v)):(Qt&&H&&d_(l),l.flags|=1,fi(s,l,m,v),l.child)}function rL(s,l,f,m,v){if(s===null){var k=f.type;return typeof k=="function"&&!l_(k)&&k.defaultProps===void 0&&f.compare===null?(l.tag=15,l.type=k,iL(s,l,k,m,v)):(s=Hb(f.type,null,m,l,l.mode,v),s.ref=l.ref,s.return=l,l.child=s)}if(k=s.child,!rI(s,v)){var O=k.memoizedProps;if(f=f.compare,f=f!==null?f:Gp,f(O,m)&&s.ref===l.ref)return Xa(s,l,v)}return l.flags|=1,s=Ka(k,m),s.ref=l.ref,s.return=l,l.child=s}function iL(s,l,f,m,v){if(s!==null){var k=s.memoizedProps;if(Gp(k,m)&&s.ref===l.ref)if(Or=!1,l.pendingProps=m=k,rI(s,v))(s.flags&131072)!==0&&(Or=!0);else return l.lanes=s.lanes,Xa(s,l,v)}return Q_(s,l,f,m,v)}function oL(s,l,f,m){var v=m.children,k=s!==null?s.memoizedState:null;if(s===null&&l.stateNode===null&&(l.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),m.mode==="hidden"){if((l.flags&128)!==0){if(k=k!==null?k.baseLanes|f:f,s!==null){for(m=l.child=s.child,v=0;m!==null;)v=v|m.lanes|m.childLanes,m=m.sibling;m=v&~k}else m=0,l.child=null;return sL(s,l,k,f,m)}if((f&536870912)!==0)l.memoizedState={baseLanes:0,cachePool:null},s!==null&&Qb(l,k!==null?k.cachePool:null),k!==null?lN(l,k):E_(),cN(l);else return m=l.lanes=536870912,sL(s,l,k!==null?k.baseLanes|f:f,f,m)}else k!==null?(Qb(l,k.cachePool),lN(l,k),Jl(),l.memoizedState=null):(s!==null&&Qb(l,null),E_(),Jl());return fi(s,l,v,f),l.child}function cm(s,l){return s!==null&&s.tag===22||l.stateNode!==null||(l.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),l.sibling}function sL(s,l,f,m,v){var k=S_();return k=k===null?null:{parent:Rr._currentValue,pool:k},l.memoizedState={baseLanes:f,cachePool:k},s!==null&&Qb(l,null),E_(),cN(l),s!==null&&hf(s,l,m,!0),l.childLanes=v,null}function fv(s,l){return l=pv({mode:l.mode,children:l.children},s.mode),l.ref=s.ref,s.child=l,l.return=s,l}function aL(s,l,f){return xu(l,s.child,null,f),s=fv(l,l.pendingProps),s.flags|=2,Io(l),l.memoizedState=null,s}function jX(s,l,f){var m=l.pendingProps,v=(l.flags&128)!==0;if(l.flags&=-129,s===null){if(Qt){if(m.mode==="hidden")return s=fv(l,m),l.lanes=536870912,cm(null,s);if(C_(l),(s=Bn)?(s=v2(s,rs),s=s!==null&&s.data==="&"?s:null,s!==null&&(l.memoizedState={dehydrated:s,treeContext:Vl!==null?{id:la,overflow:ca}:null,retryLane:536870912,hydrationErrors:null},f=VP(s),f.return=l,l.child=f,ui=l,Bn=null)):s=null,s===null)throw Hl(l);return l.lanes=536870912,null}return fv(l,m)}var k=s.memoizedState;if(k!==null){var O=k.dehydrated;if(C_(l),v)if(l.flags&256)l.flags&=-257,l=aL(s,l,f);else if(l.memoizedState!==null)l.child=s.child,l.flags|=128,l=null;else throw Error(r(558));else if(Or||hf(s,l,f,!1),v=(f&s.childLanes)!==0,Or||v){if(m=In,m!==null&&(O=Ae(m,f),O!==0&&O!==k.retryLane))throw k.retryLane=O,pu(s,O),oo(m,s,O),Y_;kv(),l=aL(s,l,f)}else s=k.treeContext,Bn=os(O.nextSibling),ui=l,Qt=!0,Kl=null,rs=!1,s!==null&&WP(l,s),l=fv(l,m),l.flags|=4096;return l}return s=Ka(s.child,{mode:m.mode,children:m.children}),s.ref=l.ref,l.child=s,s.return=l,s}function hv(s,l){var f=l.ref;if(f===null)s!==null&&s.ref!==null&&(l.flags|=4194816);else{if(typeof f!="function"&&typeof f!="object")throw Error(r(284));(s===null||s.ref!==f)&&(l.flags|=4194816)}}function Q_(s,l,f,m,v){return bu(l),f=R_(s,l,f,m,void 0,v),m=A_(),s!==null&&!Or?(O_(s,l,v),Xa(s,l,v)):(Qt&&m&&d_(l),l.flags|=1,fi(s,l,f,v),l.child)}function lL(s,l,f,m,v,k){return bu(l),l.updateQueue=null,f=dN(l,m,f,v),uN(s),m=A_(),s!==null&&!Or?(O_(s,l,k),Xa(s,l,k)):(Qt&&m&&d_(l),l.flags|=1,fi(s,l,f,k),l.child)}function cL(s,l,f,m,v){if(bu(l),l.stateNode===null){var k=cf,O=f.contextType;typeof O=="object"&&O!==null&&(k=di(O)),k=new f(m,k),l.memoizedState=k.state!==null&&k.state!==void 0?k.state:null,k.updater=W_,l.stateNode=k,k._reactInternals=l,k=l.stateNode,k.props=m,k.state=l.memoizedState,k.refs={},x_(l),O=f.contextType,k.context=typeof O=="object"&&O!==null?di(O):cf,k.state=l.memoizedState,O=f.getDerivedStateFromProps,typeof O=="function"&&(H_(l,f,O,m),k.state=l.memoizedState),typeof f.getDerivedStateFromProps=="function"||typeof k.getSnapshotBeforeUpdate=="function"||typeof k.UNSAFE_componentWillMount!="function"&&typeof k.componentWillMount!="function"||(O=k.state,typeof k.componentWillMount=="function"&&k.componentWillMount(),typeof k.UNSAFE_componentWillMount=="function"&&k.UNSAFE_componentWillMount(),O!==k.state&&W_.enqueueReplaceState(k,k.state,null),im(l,m,k,v),rm(),k.state=l.memoizedState),typeof k.componentDidMount=="function"&&(l.flags|=4194308),m=!0}else if(s===null){k=l.stateNode;var H=l.memoizedProps,Z=_u(f,H);k.props=Z;var de=k.context,be=f.contextType;O=cf,typeof be=="object"&&be!==null&&(O=di(be));var we=f.getDerivedStateFromProps;be=typeof we=="function"||typeof k.getSnapshotBeforeUpdate=="function",H=l.pendingProps!==H,be||typeof k.UNSAFE_componentWillReceiveProps!="function"&&typeof k.componentWillReceiveProps!="function"||(H||de!==O)&&YN(l,k,m,O),Gl=!1;var fe=l.memoizedState;k.state=fe,im(l,m,k,v),rm(),de=l.memoizedState,H||fe!==de||Gl?(typeof we=="function"&&(H_(l,f,we,m),de=l.memoizedState),(Z=Gl||GN(l,f,Z,m,fe,de,O))?(be||typeof k.UNSAFE_componentWillMount!="function"&&typeof k.componentWillMount!="function"||(typeof k.componentWillMount=="function"&&k.componentWillMount(),typeof k.UNSAFE_componentWillMount=="function"&&k.UNSAFE_componentWillMount()),typeof k.componentDidMount=="function"&&(l.flags|=4194308)):(typeof k.componentDidMount=="function"&&(l.flags|=4194308),l.memoizedProps=m,l.memoizedState=de),k.props=m,k.state=de,k.context=O,m=Z):(typeof k.componentDidMount=="function"&&(l.flags|=4194308),m=!1)}else{k=l.stateNode,k_(s,l),O=l.memoizedProps,be=_u(f,O),k.props=be,we=l.pendingProps,fe=k.context,de=f.contextType,Z=cf,typeof de=="object"&&de!==null&&(Z=di(de)),H=f.getDerivedStateFromProps,(de=typeof H=="function"||typeof k.getSnapshotBeforeUpdate=="function")||typeof k.UNSAFE_componentWillReceiveProps!="function"&&typeof k.componentWillReceiveProps!="function"||(O!==we||fe!==Z)&&YN(l,k,m,Z),Gl=!1,fe=l.memoizedState,k.state=fe,im(l,m,k,v),rm();var me=l.memoizedState;O!==we||fe!==me||Gl||s!==null&&s.dependencies!==null&&Gb(s.dependencies)?(typeof H=="function"&&(H_(l,f,H,m),me=l.memoizedState),(be=Gl||GN(l,f,be,m,fe,me,Z)||s!==null&&s.dependencies!==null&&Gb(s.dependencies))?(de||typeof k.UNSAFE_componentWillUpdate!="function"&&typeof k.componentWillUpdate!="function"||(typeof k.componentWillUpdate=="function"&&k.componentWillUpdate(m,me,Z),typeof k.UNSAFE_componentWillUpdate=="function"&&k.UNSAFE_componentWillUpdate(m,me,Z)),typeof k.componentDidUpdate=="function"&&(l.flags|=4),typeof k.getSnapshotBeforeUpdate=="function"&&(l.flags|=1024)):(typeof k.componentDidUpdate!="function"||O===s.memoizedProps&&fe===s.memoizedState||(l.flags|=4),typeof k.getSnapshotBeforeUpdate!="function"||O===s.memoizedProps&&fe===s.memoizedState||(l.flags|=1024),l.memoizedProps=m,l.memoizedState=me),k.props=m,k.state=me,k.context=Z,m=be):(typeof k.componentDidUpdate!="function"||O===s.memoizedProps&&fe===s.memoizedState||(l.flags|=4),typeof k.getSnapshotBeforeUpdate!="function"||O===s.memoizedProps&&fe===s.memoizedState||(l.flags|=1024),m=!1)}return k=m,hv(s,l),m=(l.flags&128)!==0,k||m?(k=l.stateNode,f=m&&typeof f.getDerivedStateFromError!="function"?null:k.render(),l.flags|=1,s!==null&&m?(l.child=xu(l,s.child,null,v),l.child=xu(l,null,f,v)):fi(s,l,f,v),l.memoizedState=k.state,s=l.child):s=Xa(s,l,v),s}function uL(s,l,f,m){return gu(),l.flags|=256,fi(s,l,f,m),l.child}var X_={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function J_(s){return{baseLanes:s,cachePool:ZP()}}function Z_(s,l,f){return s=s!==null?s.childLanes&~f:0,l&&(s|=To),s}function dL(s,l,f){var m=l.pendingProps,v=!1,k=(l.flags&128)!==0,O;if((O=k)||(O=s!==null&&s.memoizedState===null?!1:(yr.current&2)!==0),O&&(v=!0,l.flags&=-129),O=(l.flags&32)!==0,l.flags&=-33,s===null){if(Qt){if(v?Xl(l):Jl(),(s=Bn)?(s=v2(s,rs),s=s!==null&&s.data!=="&"?s:null,s!==null&&(l.memoizedState={dehydrated:s,treeContext:Vl!==null?{id:la,overflow:ca}:null,retryLane:536870912,hydrationErrors:null},f=VP(s),f.return=l,l.child=f,ui=l,Bn=null)):s=null,s===null)throw Hl(l);return NI(s)?l.lanes=32:l.lanes=536870912,null}var H=m.children;return m=m.fallback,v?(Jl(),v=l.mode,H=pv({mode:"hidden",children:H},v),m=mu(m,v,f,null),H.return=l,m.return=l,H.sibling=m,l.child=H,m=l.child,m.memoizedState=J_(f),m.childLanes=Z_(s,O,f),l.memoizedState=X_,cm(null,m)):(Xl(l),eI(l,H))}var Z=s.memoizedState;if(Z!==null&&(H=Z.dehydrated,H!==null)){if(k)l.flags&256?(Xl(l),l.flags&=-257,l=tI(s,l,f)):l.memoizedState!==null?(Jl(),l.child=s.child,l.flags|=128,l=null):(Jl(),H=m.fallback,v=l.mode,m=pv({mode:"visible",children:m.children},v),H=mu(H,v,f,null),H.flags|=2,m.return=l,H.return=l,m.sibling=H,l.child=m,xu(l,s.child,null,f),m=l.child,m.memoizedState=J_(f),m.childLanes=Z_(s,O,f),l.memoizedState=X_,l=cm(null,m));else if(Xl(l),NI(H)){if(O=H.nextSibling&&H.nextSibling.dataset,O)var de=O.dgst;O=de,m=Error(r(419)),m.stack="",m.digest=O,Xp({value:m,source:null,stack:null}),l=tI(s,l,f)}else if(Or||hf(s,l,f,!1),O=(f&s.childLanes)!==0,Or||O){if(O=In,O!==null&&(m=Ae(O,f),m!==0&&m!==Z.retryLane))throw Z.retryLane=m,pu(s,m),oo(O,s,m),Y_;PI(H)||kv(),l=tI(s,l,f)}else PI(H)?(l.flags|=192,l.child=s.child,l=null):(s=Z.treeContext,Bn=os(H.nextSibling),ui=l,Qt=!0,Kl=null,rs=!1,s!==null&&WP(l,s),l=eI(l,m.children),l.flags|=4096);return l}return v?(Jl(),H=m.fallback,v=l.mode,Z=s.child,de=Z.sibling,m=Ka(Z,{mode:"hidden",children:m.children}),m.subtreeFlags=Z.subtreeFlags&65011712,de!==null?H=Ka(de,H):(H=mu(H,v,f,null),H.flags|=2),H.return=l,m.return=l,m.sibling=H,l.child=m,cm(null,m),m=l.child,H=s.child.memoizedState,H===null?H=J_(f):(v=H.cachePool,v!==null?(Z=Rr._currentValue,v=v.parent!==Z?{parent:Z,pool:Z}:v):v=ZP(),H={baseLanes:H.baseLanes|f,cachePool:v}),m.memoizedState=H,m.childLanes=Z_(s,O,f),l.memoizedState=X_,cm(s.child,m)):(Xl(l),f=s.child,s=f.sibling,f=Ka(f,{mode:"visible",children:m.children}),f.return=l,f.sibling=null,s!==null&&(O=l.deletions,O===null?(l.deletions=[s],l.flags|=16):O.push(s)),l.child=f,l.memoizedState=null,f)}function eI(s,l){return l=pv({mode:"visible",children:l},s.mode),l.return=s,s.child=l}function pv(s,l){return s=ko(22,s,null,l),s.lanes=0,s}function tI(s,l,f){return xu(l,s.child,null,f),s=eI(l,l.pendingProps.children),s.flags|=2,l.memoizedState=null,s}function fL(s,l,f){s.lanes|=l;var m=s.alternate;m!==null&&(m.lanes|=l),g_(s.return,l,f)}function nI(s,l,f,m,v,k){var O=s.memoizedState;O===null?s.memoizedState={isBackwards:l,rendering:null,renderingStartTime:0,last:m,tail:f,tailMode:v,treeForkCount:k}:(O.isBackwards=l,O.rendering=null,O.renderingStartTime=0,O.last=m,O.tail=f,O.tailMode=v,O.treeForkCount=k)}function hL(s,l,f){var m=l.pendingProps,v=m.revealOrder,k=m.tail;m=m.children;var O=yr.current,H=(O&2)!==0;if(H?(O=O&1|2,l.flags|=128):O&=1,q(yr,O),fi(s,l,m,f),m=Qt?Qp:0,!H&&s!==null&&(s.flags&128)!==0)e:for(s=l.child;s!==null;){if(s.tag===13)s.memoizedState!==null&&fL(s,f,l);else if(s.tag===19)fL(s,f,l);else if(s.child!==null){s.child.return=s,s=s.child;continue}if(s===l)break e;for(;s.sibling===null;){if(s.return===null||s.return===l)break e;s=s.return}s.sibling.return=s.return,s=s.sibling}switch(v){case"forwards":for(f=l.child,v=null;f!==null;)s=f.alternate,s!==null&&nv(s)===null&&(v=f),f=f.sibling;f=v,f===null?(v=l.child,l.child=null):(v=f.sibling,f.sibling=null),nI(l,!1,v,f,k,m);break;case"backwards":case"unstable_legacy-backwards":for(f=null,v=l.child,l.child=null;v!==null;){if(s=v.alternate,s!==null&&nv(s)===null){l.child=v;break}s=v.sibling,v.sibling=f,f=v,v=s}nI(l,!0,f,null,k,m);break;case"together":nI(l,!1,null,null,void 0,m);break;default:l.memoizedState=null}return l.child}function Xa(s,l,f){if(s!==null&&(l.dependencies=s.dependencies),tc|=l.lanes,(f&l.childLanes)===0)if(s!==null){if(hf(s,l,f,!1),(f&l.childLanes)===0)return null}else return null;if(s!==null&&l.child!==s.child)throw Error(r(153));if(l.child!==null){for(s=l.child,f=Ka(s,s.pendingProps),l.child=f,f.return=l;s.sibling!==null;)s=s.sibling,f=f.sibling=Ka(s,s.pendingProps),f.return=l;f.sibling=null}return l.child}function rI(s,l){return(s.lanes&l)!==0?!0:(s=s.dependencies,!!(s!==null&&Gb(s)))}function FX(s,l,f){switch(l.tag){case 3:ge(l,l.stateNode.containerInfo),Wl(l,Rr,s.memoizedState.cache),gu();break;case 27:case 5:pe(l);break;case 4:ge(l,l.stateNode.containerInfo);break;case 10:Wl(l,l.type,l.memoizedProps.value);break;case 31:if(l.memoizedState!==null)return l.flags|=128,C_(l),null;break;case 13:var m=l.memoizedState;if(m!==null)return m.dehydrated!==null?(Xl(l),l.flags|=128,null):(f&l.child.childLanes)!==0?dL(s,l,f):(Xl(l),s=Xa(s,l,f),s!==null?s.sibling:null);Xl(l);break;case 19:var v=(s.flags&128)!==0;if(m=(f&l.childLanes)!==0,m||(hf(s,l,f,!1),m=(f&l.childLanes)!==0),v){if(m)return hL(s,l,f);l.flags|=128}if(v=l.memoizedState,v!==null&&(v.rendering=null,v.tail=null,v.lastEffect=null),q(yr,yr.current),m)break;return null;case 22:return l.lanes=0,oL(s,l,f,l.pendingProps);case 24:Wl(l,Rr,s.memoizedState.cache)}return Xa(s,l,f)}function pL(s,l,f){if(s!==null)if(s.memoizedProps!==l.pendingProps)Or=!0;else{if(!rI(s,f)&&(l.flags&128)===0)return Or=!1,FX(s,l,f);Or=(s.flags&131072)!==0}else Or=!1,Qt&&(l.flags&1048576)!==0&&HP(l,Qp,l.index);switch(l.lanes=0,l.tag){case 16:e:{var m=l.pendingProps;if(s=Su(l.elementType),l.type=s,typeof s=="function")l_(s)?(m=_u(s,m),l.tag=1,l=cL(null,l,s,m,f)):(l.tag=0,l=Q_(null,l,s,m,f));else{if(s!=null){var v=s.$$typeof;if(v===M){l.tag=11,l=nL(null,l,s,m,f);break e}else if(v===T){l.tag=14,l=rL(null,l,s,m,f);break e}}throw l=j(s)||s,Error(r(306,l,""))}}return l;case 0:return Q_(s,l,l.type,l.pendingProps,f);case 1:return m=l.type,v=_u(m,l.pendingProps),cL(s,l,m,v,f);case 3:e:{if(ge(l,l.stateNode.containerInfo),s===null)throw Error(r(387));m=l.pendingProps;var k=l.memoizedState;v=k.element,k_(s,l),im(l,m,null,f);var O=l.memoizedState;if(m=O.cache,Wl(l,Rr,m),m!==k.cache&&y_(l,[Rr],f,!0),rm(),m=O.element,k.isDehydrated)if(k={element:m,isDehydrated:!1,cache:O.cache},l.updateQueue.baseState=k,l.memoizedState=k,l.flags&256){l=uL(s,l,m,f);break e}else if(m!==v){v=es(Error(r(424)),l),Xp(v),l=uL(s,l,m,f);break e}else{switch(s=l.stateNode.containerInfo,s.nodeType){case 9:s=s.body;break;default:s=s.nodeName==="HTML"?s.ownerDocument.body:s}for(Bn=os(s.firstChild),ui=l,Qt=!0,Kl=null,rs=!0,f=oN(l,null,m,f),l.child=f;f;)f.flags=f.flags&-3|4096,f=f.sibling}else{if(gu(),m===v){l=Xa(s,l,f);break e}fi(s,l,m,f)}l=l.child}return l;case 26:return hv(s,l),s===null?(f=I2(l.type,null,l.pendingProps,null))?l.memoizedState=f:Qt||(f=l.type,s=l.pendingProps,m=Rv(ee.current).createElement(f),m[st]=l,m[sn]=s,hi(m,f,s),Hn(m),l.stateNode=m):l.memoizedState=I2(l.type,s.memoizedProps,l.pendingProps,s.memoizedState),null;case 27:return pe(l),s===null&&Qt&&(m=l.stateNode=x2(l.type,l.pendingProps,ee.current),ui=l,rs=!0,v=Bn,sc(l.type)?(LI=v,Bn=os(m.firstChild)):Bn=v),fi(s,l,l.pendingProps.children,f),hv(s,l),s===null&&(l.flags|=4194304),l.child;case 5:return s===null&&Qt&&((v=m=Bn)&&(m=mJ(m,l.type,l.pendingProps,rs),m!==null?(l.stateNode=m,ui=l,Bn=os(m.firstChild),rs=!1,v=!0):v=!1),v||Hl(l)),pe(l),v=l.type,k=l.pendingProps,O=s!==null?s.memoizedProps:null,m=k.children,AI(v,k)?m=null:O!==null&&AI(v,O)&&(l.flags|=32),l.memoizedState!==null&&(v=R_(s,l,RX,null,null,f),_m._currentValue=v),hv(s,l),fi(s,l,m,f),l.child;case 6:return s===null&&Qt&&((s=f=Bn)&&(f=gJ(f,l.pendingProps,rs),f!==null?(l.stateNode=f,ui=l,Bn=null,s=!0):s=!1),s||Hl(l)),null;case 13:return dL(s,l,f);case 4:return ge(l,l.stateNode.containerInfo),m=l.pendingProps,s===null?l.child=xu(l,null,m,f):fi(s,l,m,f),l.child;case 11:return nL(s,l,l.type,l.pendingProps,f);case 7:return fi(s,l,l.pendingProps,f),l.child;case 8:return fi(s,l,l.pendingProps.children,f),l.child;case 12:return fi(s,l,l.pendingProps.children,f),l.child;case 10:return m=l.pendingProps,Wl(l,l.type,m.value),fi(s,l,m.children,f),l.child;case 9:return v=l.type._context,m=l.pendingProps.children,bu(l),v=di(v),m=m(v),l.flags|=1,fi(s,l,m,f),l.child;case 14:return rL(s,l,l.type,l.pendingProps,f);case 15:return iL(s,l,l.type,l.pendingProps,f);case 19:return hL(s,l,f);case 31:return jX(s,l,f);case 22:return oL(s,l,f,l.pendingProps);case 24:return bu(l),m=di(Rr),s===null?(v=S_(),v===null&&(v=In,k=b_(),v.pooledCache=k,k.refCount++,k!==null&&(v.pooledCacheLanes|=f),v=k),l.memoizedState={parent:m,cache:v},x_(l),Wl(l,Rr,v)):((s.lanes&f)!==0&&(k_(s,l),im(l,null,null,f),rm()),v=s.memoizedState,k=l.memoizedState,v.parent!==m?(v={parent:m,cache:m},l.memoizedState=v,l.lanes===0&&(l.memoizedState=l.updateQueue.baseState=v),Wl(l,Rr,m)):(m=k.cache,Wl(l,Rr,m),m!==v.cache&&y_(l,[Rr],f,!0))),fi(s,l,l.pendingProps.children,f),l.child;case 29:throw l.pendingProps}throw Error(r(156,l.tag))}function Ja(s){s.flags|=4}function iI(s,l,f,m,v){if((l=(s.mode&32)!==0)&&(l=!1),l){if(s.flags|=16777216,(v&335544128)===v)if(s.stateNode.complete)s.flags|=8192;else if(BL())s.flags|=8192;else throw wu=Jb,w_}else s.flags&=-16777217}function mL(s,l){if(l.type!=="stylesheet"||(l.state.loading&4)!==0)s.flags&=-16777217;else if(s.flags|=16777216,!R2(l))if(BL())s.flags|=8192;else throw wu=Jb,w_}function mv(s,l){l!==null&&(s.flags|=4),s.flags&16384&&(l=s.tag!==22?se():536870912,s.lanes|=l,If|=l)}function um(s,l){if(!Qt)switch(s.tailMode){case"hidden":l=s.tail;for(var f=null;l!==null;)l.alternate!==null&&(f=l),l=l.sibling;f===null?s.tail=null:f.sibling=null;break;case"collapsed":f=s.tail;for(var m=null;f!==null;)f.alternate!==null&&(m=f),f=f.sibling;m===null?l||s.tail===null?s.tail=null:s.tail.sibling=null:m.sibling=null}}function qn(s){var l=s.alternate!==null&&s.alternate.child===s.child,f=0,m=0;if(l)for(var v=s.child;v!==null;)f|=v.lanes|v.childLanes,m|=v.subtreeFlags&65011712,m|=v.flags&65011712,v.return=s,v=v.sibling;else for(v=s.child;v!==null;)f|=v.lanes|v.childLanes,m|=v.subtreeFlags,m|=v.flags,v.return=s,v=v.sibling;return s.subtreeFlags|=m,s.childLanes=f,l}function zX(s,l,f){var m=l.pendingProps;switch(f_(l),l.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return qn(l),null;case 1:return qn(l),null;case 3:return f=l.stateNode,m=null,s!==null&&(m=s.memoizedState.cache),l.memoizedState.cache!==m&&(l.flags|=2048),Ga(Rr),te(),f.pendingContext&&(f.context=f.pendingContext,f.pendingContext=null),(s===null||s.child===null)&&(ff(l)?Ja(l):s===null||s.memoizedState.isDehydrated&&(l.flags&256)===0||(l.flags|=1024,p_())),qn(l),null;case 26:var v=l.type,k=l.memoizedState;return s===null?(Ja(l),k!==null?(qn(l),mL(l,k)):(qn(l),iI(l,v,null,m,f))):k?k!==s.memoizedState?(Ja(l),qn(l),mL(l,k)):(qn(l),l.flags&=-16777217):(s=s.memoizedProps,s!==m&&Ja(l),qn(l),iI(l,v,s,m,f)),null;case 27:if(oe(l),f=ee.current,v=l.type,s!==null&&l.stateNode!=null)s.memoizedProps!==m&&Ja(l);else{if(!m){if(l.stateNode===null)throw Error(r(166));return qn(l),null}s=ie.current,ff(l)?GP(l):(s=x2(v,m,f),l.stateNode=s,Ja(l))}return qn(l),null;case 5:if(oe(l),v=l.type,s!==null&&l.stateNode!=null)s.memoizedProps!==m&&Ja(l);else{if(!m){if(l.stateNode===null)throw Error(r(166));return qn(l),null}if(k=ie.current,ff(l))GP(l);else{var O=Rv(ee.current);switch(k){case 1:k=O.createElementNS("http://www.w3.org/2000/svg",v);break;case 2:k=O.createElementNS("http://www.w3.org/1998/Math/MathML",v);break;default:switch(v){case"svg":k=O.createElementNS("http://www.w3.org/2000/svg",v);break;case"math":k=O.createElementNS("http://www.w3.org/1998/Math/MathML",v);break;case"script":k=O.createElement("div"),k.innerHTML="<script><\/script>",k=k.removeChild(k.firstChild);break;case"select":k=typeof m.is=="string"?O.createElement("select",{is:m.is}):O.createElement("select"),m.multiple?k.multiple=!0:m.size&&(k.size=m.size);break;default:k=typeof m.is=="string"?O.createElement(v,{is:m.is}):O.createElement(v)}}k[st]=l,k[sn]=m;e:for(O=l.child;O!==null;){if(O.tag===5||O.tag===6)k.appendChild(O.stateNode);else if(O.tag!==4&&O.tag!==27&&O.child!==null){O.child.return=O,O=O.child;continue}if(O===l)break e;for(;O.sibling===null;){if(O.return===null||O.return===l)break e;O=O.return}O.sibling.return=O.return,O=O.sibling}l.stateNode=k;e:switch(hi(k,v,m),v){case"button":case"input":case"select":case"textarea":m=!!m.autoFocus;break e;case"img":m=!0;break e;default:m=!1}m&&Ja(l)}}return qn(l),iI(l,l.type,s===null?null:s.memoizedProps,l.pendingProps,f),null;case 6:if(s&&l.stateNode!=null)s.memoizedProps!==m&&Ja(l);else{if(typeof m!="string"&&l.stateNode===null)throw Error(r(166));if(s=ee.current,ff(l)){if(s=l.stateNode,f=l.memoizedProps,m=null,v=ui,v!==null)switch(v.tag){case 27:case 5:m=v.memoizedProps}s[st]=l,s=!!(s.nodeValue===f||m!==null&&m.suppressHydrationWarning===!0||d2(s.nodeValue,f)),s||Hl(l,!0)}else s=Rv(s).createTextNode(m),s[st]=l,l.stateNode=s}return qn(l),null;case 31:if(f=l.memoizedState,s===null||s.memoizedState!==null){if(m=ff(l),f!==null){if(s===null){if(!m)throw Error(r(318));if(s=l.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(r(557));s[st]=l}else gu(),(l.flags&128)===0&&(l.memoizedState=null),l.flags|=4;qn(l),s=!1}else f=p_(),s!==null&&s.memoizedState!==null&&(s.memoizedState.hydrationErrors=f),s=!0;if(!s)return l.flags&256?(Io(l),l):(Io(l),null);if((l.flags&128)!==0)throw Error(r(558))}return qn(l),null;case 13:if(m=l.memoizedState,s===null||s.memoizedState!==null&&s.memoizedState.dehydrated!==null){if(v=ff(l),m!==null&&m.dehydrated!==null){if(s===null){if(!v)throw Error(r(318));if(v=l.memoizedState,v=v!==null?v.dehydrated:null,!v)throw Error(r(317));v[st]=l}else gu(),(l.flags&128)===0&&(l.memoizedState=null),l.flags|=4;qn(l),v=!1}else v=p_(),s!==null&&s.memoizedState!==null&&(s.memoizedState.hydrationErrors=v),v=!0;if(!v)return l.flags&256?(Io(l),l):(Io(l),null)}return Io(l),(l.flags&128)!==0?(l.lanes=f,l):(f=m!==null,s=s!==null&&s.memoizedState!==null,f&&(m=l.child,v=null,m.alternate!==null&&m.alternate.memoizedState!==null&&m.alternate.memoizedState.cachePool!==null&&(v=m.alternate.memoizedState.cachePool.pool),k=null,m.memoizedState!==null&&m.memoizedState.cachePool!==null&&(k=m.memoizedState.cachePool.pool),k!==v&&(m.flags|=2048)),f!==s&&f&&(l.child.flags|=8192),mv(l,l.updateQueue),qn(l),null);case 4:return te(),s===null&&EI(l.stateNode.containerInfo),qn(l),null;case 10:return Ga(l.type),qn(l),null;case 19:if(Q(yr),m=l.memoizedState,m===null)return qn(l),null;if(v=(l.flags&128)!==0,k=m.rendering,k===null)if(v)um(m,!1);else{if(sr!==0||s!==null&&(s.flags&128)!==0)for(s=l.child;s!==null;){if(k=nv(s),k!==null){for(l.flags|=128,um(m,!1),s=k.updateQueue,l.updateQueue=s,mv(l,s),l.subtreeFlags=0,s=f,f=l.child;f!==null;)UP(f,s),f=f.sibling;return q(yr,yr.current&1|2),Qt&&Ha(l,m.treeForkCount),l.child}s=s.sibling}m.tail!==null&&$t()>Sv&&(l.flags|=128,v=!0,um(m,!1),l.lanes=4194304)}else{if(!v)if(s=nv(k),s!==null){if(l.flags|=128,v=!0,s=s.updateQueue,l.updateQueue=s,mv(l,s),um(m,!0),m.tail===null&&m.tailMode==="hidden"&&!k.alternate&&!Qt)return qn(l),null}else 2*$t()-m.renderingStartTime>Sv&&f!==536870912&&(l.flags|=128,v=!0,um(m,!1),l.lanes=4194304);m.isBackwards?(k.sibling=l.child,l.child=k):(s=m.last,s!==null?s.sibling=k:l.child=k,m.last=k)}return m.tail!==null?(s=m.tail,m.rendering=s,m.tail=s.sibling,m.renderingStartTime=$t(),s.sibling=null,f=yr.current,q(yr,v?f&1|2:f&1),Qt&&Ha(l,m.treeForkCount),s):(qn(l),null);case 22:case 23:return Io(l),T_(),m=l.memoizedState!==null,s!==null?s.memoizedState!==null!==m&&(l.flags|=8192):m&&(l.flags|=8192),m?(f&536870912)!==0&&(l.flags&128)===0&&(qn(l),l.subtreeFlags&6&&(l.flags|=8192)):qn(l),f=l.updateQueue,f!==null&&mv(l,f.retryQueue),f=null,s!==null&&s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(f=s.memoizedState.cachePool.pool),m=null,l.memoizedState!==null&&l.memoizedState.cachePool!==null&&(m=l.memoizedState.cachePool.pool),m!==f&&(l.flags|=2048),s!==null&&Q(vu),null;case 24:return f=null,s!==null&&(f=s.memoizedState.cache),l.memoizedState.cache!==f&&(l.flags|=2048),Ga(Rr),qn(l),null;case 25:return null;case 30:return null}throw Error(r(156,l.tag))}function BX(s,l){switch(f_(l),l.tag){case 1:return s=l.flags,s&65536?(l.flags=s&-65537|128,l):null;case 3:return Ga(Rr),te(),s=l.flags,(s&65536)!==0&&(s&128)===0?(l.flags=s&-65537|128,l):null;case 26:case 27:case 5:return oe(l),null;case 31:if(l.memoizedState!==null){if(Io(l),l.alternate===null)throw Error(r(340));gu()}return s=l.flags,s&65536?(l.flags=s&-65537|128,l):null;case 13:if(Io(l),s=l.memoizedState,s!==null&&s.dehydrated!==null){if(l.alternate===null)throw Error(r(340));gu()}return s=l.flags,s&65536?(l.flags=s&-65537|128,l):null;case 19:return Q(yr),null;case 4:return te(),null;case 10:return Ga(l.type),null;case 22:case 23:return Io(l),T_(),s!==null&&Q(vu),s=l.flags,s&65536?(l.flags=s&-65537|128,l):null;case 24:return Ga(Rr),null;case 25:return null;default:return null}}function gL(s,l){switch(f_(l),l.tag){case 3:Ga(Rr),te();break;case 26:case 27:case 5:oe(l);break;case 4:te();break;case 31:l.memoizedState!==null&&Io(l);break;case 13:Io(l);break;case 19:Q(yr);break;case 10:Ga(l.type);break;case 22:case 23:Io(l),T_(),s!==null&&Q(vu);break;case 24:Ga(Rr)}}function dm(s,l){try{var f=l.updateQueue,m=f!==null?f.lastEffect:null;if(m!==null){var v=m.next;f=v;do{if((f.tag&s)===s){m=void 0;var k=f.create,O=f.inst;m=k(),O.destroy=m}f=f.next}while(f!==v)}}catch(H){yn(l,l.return,H)}}function Zl(s,l,f){try{var m=l.updateQueue,v=m!==null?m.lastEffect:null;if(v!==null){var k=v.next;m=k;do{if((m.tag&s)===s){var O=m.inst,H=O.destroy;if(H!==void 0){O.destroy=void 0,v=l;var Z=f,de=H;try{de()}catch(be){yn(v,Z,be)}}}m=m.next}while(m!==k)}}catch(be){yn(l,l.return,be)}}function yL(s){var l=s.updateQueue;if(l!==null){var f=s.stateNode;try{aN(l,f)}catch(m){yn(s,s.return,m)}}}function bL(s,l,f){f.props=_u(s.type,s.memoizedProps),f.state=s.memoizedState;try{f.componentWillUnmount()}catch(m){yn(s,l,m)}}function fm(s,l){try{var f=s.ref;if(f!==null){switch(s.tag){case 26:case 27:case 5:var m=s.stateNode;break;case 30:m=s.stateNode;break;default:m=s.stateNode}typeof f=="function"?s.refCleanup=f(m):f.current=m}}catch(v){yn(s,l,v)}}function ua(s,l){var f=s.ref,m=s.refCleanup;if(f!==null)if(typeof m=="function")try{m()}catch(v){yn(s,l,v)}finally{s.refCleanup=null,s=s.alternate,s!=null&&(s.refCleanup=null)}else if(typeof f=="function")try{f(null)}catch(v){yn(s,l,v)}else f.current=null}function vL(s){var l=s.type,f=s.memoizedProps,m=s.stateNode;try{e:switch(l){case"button":case"input":case"select":case"textarea":f.autoFocus&&m.focus();break e;case"img":f.src?m.src=f.src:f.srcSet&&(m.srcset=f.srcSet)}}catch(v){yn(s,s.return,v)}}function oI(s,l,f){try{var m=s.stateNode;cJ(m,s.type,f,l),m[sn]=l}catch(v){yn(s,s.return,v)}}function SL(s){return s.tag===5||s.tag===3||s.tag===26||s.tag===27&&sc(s.type)||s.tag===4}function sI(s){e:for(;;){for(;s.sibling===null;){if(s.return===null||SL(s.return))return null;s=s.return}for(s.sibling.return=s.return,s=s.sibling;s.tag!==5&&s.tag!==6&&s.tag!==18;){if(s.tag===27&&sc(s.type)||s.flags&2||s.child===null||s.tag===4)continue e;s.child.return=s,s=s.child}if(!(s.flags&2))return s.stateNode}}function aI(s,l,f){var m=s.tag;if(m===5||m===6)s=s.stateNode,l?(f.nodeType===9?f.body:f.nodeName==="HTML"?f.ownerDocument.body:f).insertBefore(s,l):(l=f.nodeType===9?f.body:f.nodeName==="HTML"?f.ownerDocument.body:f,l.appendChild(s),f=f._reactRootContainer,f!=null||l.onclick!==null||(l.onclick=Ua));else if(m!==4&&(m===27&&sc(s.type)&&(f=s.stateNode,l=null),s=s.child,s!==null))for(aI(s,l,f),s=s.sibling;s!==null;)aI(s,l,f),s=s.sibling}function gv(s,l,f){var m=s.tag;if(m===5||m===6)s=s.stateNode,l?f.insertBefore(s,l):f.appendChild(s);else if(m!==4&&(m===27&&sc(s.type)&&(f=s.stateNode),s=s.child,s!==null))for(gv(s,l,f),s=s.sibling;s!==null;)gv(s,l,f),s=s.sibling}function wL(s){var l=s.stateNode,f=s.memoizedProps;try{for(var m=s.type,v=l.attributes;v.length;)l.removeAttributeNode(v[0]);hi(l,m,f),l[st]=s,l[sn]=f}catch(k){yn(s,s.return,k)}}var Za=!1,Dr=!1,lI=!1,xL=typeof WeakSet=="function"?WeakSet:Set,ei=null;function qX(s,l){if(s=s.containerInfo,MI=$v,s=PP(s),t_(s)){if("selectionStart"in s)var f={start:s.selectionStart,end:s.selectionEnd};else e:{f=(f=s.ownerDocument)&&f.defaultView||window;var m=f.getSelection&&f.getSelection();if(m&&m.rangeCount!==0){f=m.anchorNode;var v=m.anchorOffset,k=m.focusNode;m=m.focusOffset;try{f.nodeType,k.nodeType}catch{f=null;break e}var O=0,H=-1,Z=-1,de=0,be=0,we=s,fe=null;t:for(;;){for(var me;we!==f||v!==0&&we.nodeType!==3||(H=O+v),we!==k||m!==0&&we.nodeType!==3||(Z=O+m),we.nodeType===3&&(O+=we.nodeValue.length),(me=we.firstChild)!==null;)fe=we,we=me;for(;;){if(we===s)break t;if(fe===f&&++de===v&&(H=O),fe===k&&++be===m&&(Z=O),(me=we.nextSibling)!==null)break;we=fe,fe=we.parentNode}we=me}f=H===-1||Z===-1?null:{start:H,end:Z}}else f=null}f=f||{start:0,end:0}}else f=null;for(RI={focusedElem:s,selectionRange:f},$v=!1,ei=l;ei!==null;)if(l=ei,s=l.child,(l.subtreeFlags&1028)!==0&&s!==null)s.return=l,ei=s;else for(;ei!==null;){switch(l=ei,k=l.alternate,s=l.flags,l.tag){case 0:if((s&4)!==0&&(s=l.updateQueue,s=s!==null?s.events:null,s!==null))for(f=0;f<s.length;f++)v=s[f],v.ref.impl=v.nextImpl;break;case 11:case 15:break;case 1:if((s&1024)!==0&&k!==null){s=void 0,f=l,v=k.memoizedProps,k=k.memoizedState,m=f.stateNode;try{var Fe=_u(f.type,v);s=m.getSnapshotBeforeUpdate(Fe,k),m.__reactInternalSnapshotBeforeUpdate=s}catch(ct){yn(f,f.return,ct)}}break;case 3:if((s&1024)!==0){if(s=l.stateNode.containerInfo,f=s.nodeType,f===9)DI(s);else if(f===1)switch(s.nodeName){case"HEAD":case"HTML":case"BODY":DI(s);break;default:s.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((s&1024)!==0)throw Error(r(163))}if(s=l.sibling,s!==null){s.return=l.return,ei=s;break}ei=l.return}}function kL(s,l,f){var m=f.flags;switch(f.tag){case 0:case 11:case 15:tl(s,f),m&4&&dm(5,f);break;case 1:if(tl(s,f),m&4)if(s=f.stateNode,l===null)try{s.componentDidMount()}catch(O){yn(f,f.return,O)}else{var v=_u(f.type,l.memoizedProps);l=l.memoizedState;try{s.componentDidUpdate(v,l,s.__reactInternalSnapshotBeforeUpdate)}catch(O){yn(f,f.return,O)}}m&64&&yL(f),m&512&&fm(f,f.return);break;case 3:if(tl(s,f),m&64&&(s=f.updateQueue,s!==null)){if(l=null,f.child!==null)switch(f.child.tag){case 27:case 5:l=f.child.stateNode;break;case 1:l=f.child.stateNode}try{aN(s,l)}catch(O){yn(f,f.return,O)}}break;case 27:l===null&&m&4&&wL(f);case 26:case 5:tl(s,f),l===null&&m&4&&vL(f),m&512&&fm(f,f.return);break;case 12:tl(s,f);break;case 31:tl(s,f),m&4&&EL(s,f);break;case 13:tl(s,f),m&4&&TL(s,f),m&64&&(s=f.memoizedState,s!==null&&(s=s.dehydrated,s!==null&&(f=XX.bind(null,f),yJ(s,f))));break;case 22:if(m=f.memoizedState!==null||Za,!m){l=l!==null&&l.memoizedState!==null||Dr,v=Za;var k=Dr;Za=m,(Dr=l)&&!k?nl(s,f,(f.subtreeFlags&8772)!==0):tl(s,f),Za=v,Dr=k}break;case 30:break;default:tl(s,f)}}function _L(s){var l=s.alternate;l!==null&&(s.alternate=null,_L(l)),s.child=null,s.deletions=null,s.sibling=null,s.tag===5&&(l=s.stateNode,l!==null&&Qo(l)),s.stateNode=null,s.return=null,s.dependencies=null,s.memoizedProps=null,s.memoizedState=null,s.pendingProps=null,s.stateNode=null,s.updateQueue=null}var Wn=null,to=!1;function el(s,l,f){for(f=f.child;f!==null;)IL(s,l,f),f=f.sibling}function IL(s,l,f){if(Qe&&typeof Qe.onCommitFiberUnmount=="function")try{Qe.onCommitFiberUnmount(mn,f)}catch{}switch(f.tag){case 26:Dr||ua(f,l),el(s,l,f),f.memoizedState?f.memoizedState.count--:f.stateNode&&(f=f.stateNode,f.parentNode.removeChild(f));break;case 27:Dr||ua(f,l);var m=Wn,v=to;sc(f.type)&&(Wn=f.stateNode,to=!1),el(s,l,f),wm(f.stateNode),Wn=m,to=v;break;case 5:Dr||ua(f,l);case 6:if(m=Wn,v=to,Wn=null,el(s,l,f),Wn=m,to=v,Wn!==null)if(to)try{(Wn.nodeType===9?Wn.body:Wn.nodeName==="HTML"?Wn.ownerDocument.body:Wn).removeChild(f.stateNode)}catch(k){yn(f,l,k)}else try{Wn.removeChild(f.stateNode)}catch(k){yn(f,l,k)}break;case 18:Wn!==null&&(to?(s=Wn,y2(s.nodeType===9?s.body:s.nodeName==="HTML"?s.ownerDocument.body:s,f.stateNode),Df(s)):y2(Wn,f.stateNode));break;case 4:m=Wn,v=to,Wn=f.stateNode.containerInfo,to=!0,el(s,l,f),Wn=m,to=v;break;case 0:case 11:case 14:case 15:Zl(2,f,l),Dr||Zl(4,f,l),el(s,l,f);break;case 1:Dr||(ua(f,l),m=f.stateNode,typeof m.componentWillUnmount=="function"&&bL(f,l,m)),el(s,l,f);break;case 21:el(s,l,f);break;case 22:Dr=(m=Dr)||f.memoizedState!==null,el(s,l,f),Dr=m;break;default:el(s,l,f)}}function EL(s,l){if(l.memoizedState===null&&(s=l.alternate,s!==null&&(s=s.memoizedState,s!==null))){s=s.dehydrated;try{Df(s)}catch(f){yn(l,l.return,f)}}}function TL(s,l){if(l.memoizedState===null&&(s=l.alternate,s!==null&&(s=s.memoizedState,s!==null&&(s=s.dehydrated,s!==null))))try{Df(s)}catch(f){yn(l,l.return,f)}}function UX(s){switch(s.tag){case 31:case 13:case 19:var l=s.stateNode;return l===null&&(l=s.stateNode=new xL),l;case 22:return s=s.stateNode,l=s._retryCache,l===null&&(l=s._retryCache=new xL),l;default:throw Error(r(435,s.tag))}}function yv(s,l){var f=UX(s);l.forEach(function(m){if(!f.has(m)){f.add(m);var v=JX.bind(null,s,m);m.then(v,v)}})}function no(s,l){var f=l.deletions;if(f!==null)for(var m=0;m<f.length;m++){var v=f[m],k=s,O=l,H=O;e:for(;H!==null;){switch(H.tag){case 27:if(sc(H.type)){Wn=H.stateNode,to=!1;break e}break;case 5:Wn=H.stateNode,to=!1;break e;case 3:case 4:Wn=H.stateNode.containerInfo,to=!0;break e}H=H.return}if(Wn===null)throw Error(r(160));IL(k,O,v),Wn=null,to=!1,k=v.alternate,k!==null&&(k.return=null),v.return=null}if(l.subtreeFlags&13886)for(l=l.child;l!==null;)CL(l,s),l=l.sibling}var Cs=null;function CL(s,l){var f=s.alternate,m=s.flags;switch(s.tag){case 0:case 11:case 14:case 15:no(l,s),ro(s),m&4&&(Zl(3,s,s.return),dm(3,s),Zl(5,s,s.return));break;case 1:no(l,s),ro(s),m&512&&(Dr||f===null||ua(f,f.return)),m&64&&Za&&(s=s.updateQueue,s!==null&&(m=s.callbacks,m!==null&&(f=s.shared.hiddenCallbacks,s.shared.hiddenCallbacks=f===null?m:f.concat(m))));break;case 26:var v=Cs;if(no(l,s),ro(s),m&512&&(Dr||f===null||ua(f,f.return)),m&4){var k=f!==null?f.memoizedState:null;if(m=s.memoizedState,f===null)if(m===null)if(s.stateNode===null){e:{m=s.type,f=s.memoizedProps,v=v.ownerDocument||v;t:switch(m){case"title":k=v.getElementsByTagName("title")[0],(!k||k[oa]||k[st]||k.namespaceURI==="http://www.w3.org/2000/svg"||k.hasAttribute("itemprop"))&&(k=v.createElement(m),v.head.insertBefore(k,v.querySelector("head > title"))),hi(k,m,f),k[st]=s,Hn(k),m=k;break e;case"link":var O=C2("link","href",v).get(m+(f.href||""));if(O){for(var H=0;H<O.length;H++)if(k=O[H],k.getAttribute("href")===(f.href==null||f.href===""?null:f.href)&&k.getAttribute("rel")===(f.rel==null?null:f.rel)&&k.getAttribute("title")===(f.title==null?null:f.title)&&k.getAttribute("crossorigin")===(f.crossOrigin==null?null:f.crossOrigin)){O.splice(H,1);break t}}k=v.createElement(m),hi(k,m,f),v.head.appendChild(k);break;case"meta":if(O=C2("meta","content",v).get(m+(f.content||""))){for(H=0;H<O.length;H++)if(k=O[H],k.getAttribute("content")===(f.content==null?null:""+f.content)&&k.getAttribute("name")===(f.name==null?null:f.name)&&k.getAttribute("property")===(f.property==null?null:f.property)&&k.getAttribute("http-equiv")===(f.httpEquiv==null?null:f.httpEquiv)&&k.getAttribute("charset")===(f.charSet==null?null:f.charSet)){O.splice(H,1);break t}}k=v.createElement(m),hi(k,m,f),v.head.appendChild(k);break;default:throw Error(r(468,m))}k[st]=s,Hn(k),m=k}s.stateNode=m}else M2(v,s.type,s.stateNode);else s.stateNode=T2(v,m,s.memoizedProps);else k!==m?(k===null?f.stateNode!==null&&(f=f.stateNode,f.parentNode.removeChild(f)):k.count--,m===null?M2(v,s.type,s.stateNode):T2(v,m,s.memoizedProps)):m===null&&s.stateNode!==null&&oI(s,s.memoizedProps,f.memoizedProps)}break;case 27:no(l,s),ro(s),m&512&&(Dr||f===null||ua(f,f.return)),f!==null&&m&4&&oI(s,s.memoizedProps,f.memoizedProps);break;case 5:if(no(l,s),ro(s),m&512&&(Dr||f===null||ua(f,f.return)),s.flags&32){v=s.stateNode;try{tf(v,"")}catch(Fe){yn(s,s.return,Fe)}}m&4&&s.stateNode!=null&&(v=s.memoizedProps,oI(s,v,f!==null?f.memoizedProps:v)),m&1024&&(lI=!0);break;case 6:if(no(l,s),ro(s),m&4){if(s.stateNode===null)throw Error(r(162));m=s.memoizedProps,f=s.stateNode;try{f.nodeValue=m}catch(Fe){yn(s,s.return,Fe)}}break;case 3:if(Dv=null,v=Cs,Cs=Av(l.containerInfo),no(l,s),Cs=v,ro(s),m&4&&f!==null&&f.memoizedState.isDehydrated)try{Df(l.containerInfo)}catch(Fe){yn(s,s.return,Fe)}lI&&(lI=!1,ML(s));break;case 4:m=Cs,Cs=Av(s.stateNode.containerInfo),no(l,s),ro(s),Cs=m;break;case 12:no(l,s),ro(s);break;case 31:no(l,s),ro(s),m&4&&(m=s.updateQueue,m!==null&&(s.updateQueue=null,yv(s,m)));break;case 13:no(l,s),ro(s),s.child.flags&8192&&s.memoizedState!==null!=(f!==null&&f.memoizedState!==null)&&(vv=$t()),m&4&&(m=s.updateQueue,m!==null&&(s.updateQueue=null,yv(s,m)));break;case 22:v=s.memoizedState!==null;var Z=f!==null&&f.memoizedState!==null,de=Za,be=Dr;if(Za=de||v,Dr=be||Z,no(l,s),Dr=be,Za=de,ro(s),m&8192)e:for(l=s.stateNode,l._visibility=v?l._visibility&-2:l._visibility|1,v&&(f===null||Z||Za||Dr||Iu(s)),f=null,l=s;;){if(l.tag===5||l.tag===26){if(f===null){Z=f=l;try{if(k=Z.stateNode,v)O=k.style,typeof O.setProperty=="function"?O.setProperty("display","none","important"):O.display="none";else{H=Z.stateNode;var we=Z.memoizedProps.style,fe=we!=null&&we.hasOwnProperty("display")?we.display:null;H.style.display=fe==null||typeof fe=="boolean"?"":(""+fe).trim()}}catch(Fe){yn(Z,Z.return,Fe)}}}else if(l.tag===6){if(f===null){Z=l;try{Z.stateNode.nodeValue=v?"":Z.memoizedProps}catch(Fe){yn(Z,Z.return,Fe)}}}else if(l.tag===18){if(f===null){Z=l;try{var me=Z.stateNode;v?b2(me,!0):b2(Z.stateNode,!1)}catch(Fe){yn(Z,Z.return,Fe)}}}else if((l.tag!==22&&l.tag!==23||l.memoizedState===null||l===s)&&l.child!==null){l.child.return=l,l=l.child;continue}if(l===s)break e;for(;l.sibling===null;){if(l.return===null||l.return===s)break e;f===l&&(f=null),l=l.return}f===l&&(f=null),l.sibling.return=l.return,l=l.sibling}m&4&&(m=s.updateQueue,m!==null&&(f=m.retryQueue,f!==null&&(m.retryQueue=null,yv(s,f))));break;case 19:no(l,s),ro(s),m&4&&(m=s.updateQueue,m!==null&&(s.updateQueue=null,yv(s,m)));break;case 30:break;case 21:break;default:no(l,s),ro(s)}}function ro(s){var l=s.flags;if(l&2){try{for(var f,m=s.return;m!==null;){if(SL(m)){f=m;break}m=m.return}if(f==null)throw Error(r(160));switch(f.tag){case 27:var v=f.stateNode,k=sI(s);gv(s,k,v);break;case 5:var O=f.stateNode;f.flags&32&&(tf(O,""),f.flags&=-33);var H=sI(s);gv(s,H,O);break;case 3:case 4:var Z=f.stateNode.containerInfo,de=sI(s);aI(s,de,Z);break;default:throw Error(r(161))}}catch(be){yn(s,s.return,be)}s.flags&=-3}l&4096&&(s.flags&=-4097)}function ML(s){if(s.subtreeFlags&1024)for(s=s.child;s!==null;){var l=s;ML(l),l.tag===5&&l.flags&1024&&l.stateNode.reset(),s=s.sibling}}function tl(s,l){if(l.subtreeFlags&8772)for(l=l.child;l!==null;)kL(s,l.alternate,l),l=l.sibling}function Iu(s){for(s=s.child;s!==null;){var l=s;switch(l.tag){case 0:case 11:case 14:case 15:Zl(4,l,l.return),Iu(l);break;case 1:ua(l,l.return);var f=l.stateNode;typeof f.componentWillUnmount=="function"&&bL(l,l.return,f),Iu(l);break;case 27:wm(l.stateNode);case 26:case 5:ua(l,l.return),Iu(l);break;case 22:l.memoizedState===null&&Iu(l);break;case 30:Iu(l);break;default:Iu(l)}s=s.sibling}}function nl(s,l,f){for(f=f&&(l.subtreeFlags&8772)!==0,l=l.child;l!==null;){var m=l.alternate,v=s,k=l,O=k.flags;switch(k.tag){case 0:case 11:case 15:nl(v,k,f),dm(4,k);break;case 1:if(nl(v,k,f),m=k,v=m.stateNode,typeof v.componentDidMount=="function")try{v.componentDidMount()}catch(de){yn(m,m.return,de)}if(m=k,v=m.updateQueue,v!==null){var H=m.stateNode;try{var Z=v.shared.hiddenCallbacks;if(Z!==null)for(v.shared.hiddenCallbacks=null,v=0;v<Z.length;v++)sN(Z[v],H)}catch(de){yn(m,m.return,de)}}f&&O&64&&yL(k),fm(k,k.return);break;case 27:wL(k);case 26:case 5:nl(v,k,f),f&&m===null&&O&4&&vL(k),fm(k,k.return);break;case 12:nl(v,k,f);break;case 31:nl(v,k,f),f&&O&4&&EL(v,k);break;case 13:nl(v,k,f),f&&O&4&&TL(v,k);break;case 22:k.memoizedState===null&&nl(v,k,f),fm(k,k.return);break;case 30:break;default:nl(v,k,f)}l=l.sibling}}function cI(s,l){var f=null;s!==null&&s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(f=s.memoizedState.cachePool.pool),s=null,l.memoizedState!==null&&l.memoizedState.cachePool!==null&&(s=l.memoizedState.cachePool.pool),s!==f&&(s!=null&&s.refCount++,f!=null&&Jp(f))}function uI(s,l){s=null,l.alternate!==null&&(s=l.alternate.memoizedState.cache),l=l.memoizedState.cache,l!==s&&(l.refCount++,s!=null&&Jp(s))}function Ms(s,l,f,m){if(l.subtreeFlags&10256)for(l=l.child;l!==null;)RL(s,l,f,m),l=l.sibling}function RL(s,l,f,m){var v=l.flags;switch(l.tag){case 0:case 11:case 15:Ms(s,l,f,m),v&2048&&dm(9,l);break;case 1:Ms(s,l,f,m);break;case 3:Ms(s,l,f,m),v&2048&&(s=null,l.alternate!==null&&(s=l.alternate.memoizedState.cache),l=l.memoizedState.cache,l!==s&&(l.refCount++,s!=null&&Jp(s)));break;case 12:if(v&2048){Ms(s,l,f,m),s=l.stateNode;try{var k=l.memoizedProps,O=k.id,H=k.onPostCommit;typeof H=="function"&&H(O,l.alternate===null?"mount":"update",s.passiveEffectDuration,-0)}catch(Z){yn(l,l.return,Z)}}else Ms(s,l,f,m);break;case 31:Ms(s,l,f,m);break;case 13:Ms(s,l,f,m);break;case 23:break;case 22:k=l.stateNode,O=l.alternate,l.memoizedState!==null?k._visibility&2?Ms(s,l,f,m):hm(s,l):k._visibility&2?Ms(s,l,f,m):(k._visibility|=2,xf(s,l,f,m,(l.subtreeFlags&10256)!==0||!1)),v&2048&&cI(O,l);break;case 24:Ms(s,l,f,m),v&2048&&uI(l.alternate,l);break;default:Ms(s,l,f,m)}}function xf(s,l,f,m,v){for(v=v&&((l.subtreeFlags&10256)!==0||!1),l=l.child;l!==null;){var k=s,O=l,H=f,Z=m,de=O.flags;switch(O.tag){case 0:case 11:case 15:xf(k,O,H,Z,v),dm(8,O);break;case 23:break;case 22:var be=O.stateNode;O.memoizedState!==null?be._visibility&2?xf(k,O,H,Z,v):hm(k,O):(be._visibility|=2,xf(k,O,H,Z,v)),v&&de&2048&&cI(O.alternate,O);break;case 24:xf(k,O,H,Z,v),v&&de&2048&&uI(O.alternate,O);break;default:xf(k,O,H,Z,v)}l=l.sibling}}function hm(s,l){if(l.subtreeFlags&10256)for(l=l.child;l!==null;){var f=s,m=l,v=m.flags;switch(m.tag){case 22:hm(f,m),v&2048&&cI(m.alternate,m);break;case 24:hm(f,m),v&2048&&uI(m.alternate,m);break;default:hm(f,m)}l=l.sibling}}var pm=8192;function kf(s,l,f){if(s.subtreeFlags&pm)for(s=s.child;s!==null;)AL(s,l,f),s=s.sibling}function AL(s,l,f){switch(s.tag){case 26:kf(s,l,f),s.flags&pm&&s.memoizedState!==null&&MJ(f,Cs,s.memoizedState,s.memoizedProps);break;case 5:kf(s,l,f);break;case 3:case 4:var m=Cs;Cs=Av(s.stateNode.containerInfo),kf(s,l,f),Cs=m;break;case 22:s.memoizedState===null&&(m=s.alternate,m!==null&&m.memoizedState!==null?(m=pm,pm=16777216,kf(s,l,f),pm=m):kf(s,l,f));break;default:kf(s,l,f)}}function OL(s){var l=s.alternate;if(l!==null&&(s=l.child,s!==null)){l.child=null;do l=s.sibling,s.sibling=null,s=l;while(s!==null)}}function mm(s){var l=s.deletions;if((s.flags&16)!==0){if(l!==null)for(var f=0;f<l.length;f++){var m=l[f];ei=m,PL(m,s)}OL(s)}if(s.subtreeFlags&10256)for(s=s.child;s!==null;)DL(s),s=s.sibling}function DL(s){switch(s.tag){case 0:case 11:case 15:mm(s),s.flags&2048&&Zl(9,s,s.return);break;case 3:mm(s);break;case 12:mm(s);break;case 22:var l=s.stateNode;s.memoizedState!==null&&l._visibility&2&&(s.return===null||s.return.tag!==13)?(l._visibility&=-3,bv(s)):mm(s);break;default:mm(s)}}function bv(s){var l=s.deletions;if((s.flags&16)!==0){if(l!==null)for(var f=0;f<l.length;f++){var m=l[f];ei=m,PL(m,s)}OL(s)}for(s=s.child;s!==null;){switch(l=s,l.tag){case 0:case 11:case 15:Zl(8,l,l.return),bv(l);break;case 22:f=l.stateNode,f._visibility&2&&(f._visibility&=-3,bv(l));break;default:bv(l)}s=s.sibling}}function PL(s,l){for(;ei!==null;){var f=ei;switch(f.tag){case 0:case 11:case 15:Zl(8,f,l);break;case 23:case 22:if(f.memoizedState!==null&&f.memoizedState.cachePool!==null){var m=f.memoizedState.cachePool.pool;m!=null&&m.refCount++}break;case 24:Jp(f.memoizedState.cache)}if(m=f.child,m!==null)m.return=f,ei=m;else e:for(f=s;ei!==null;){m=ei;var v=m.sibling,k=m.return;if(_L(m),m===f){ei=null;break e}if(v!==null){v.return=k,ei=v;break e}ei=k}}}var VX={getCacheForType:function(s){var l=di(Rr),f=l.data.get(s);return f===void 0&&(f=s(),l.data.set(s,f)),f},cacheSignal:function(){return di(Rr).controller.signal}},KX=typeof WeakMap=="function"?WeakMap:Map,an=0,In=null,jt=null,qt=0,gn=0,Eo=null,ec=!1,_f=!1,dI=!1,rl=0,sr=0,tc=0,Eu=0,fI=0,To=0,If=0,gm=null,io=null,hI=!1,vv=0,NL=0,Sv=1/0,wv=null,nc=null,qr=0,rc=null,Ef=null,il=0,pI=0,mI=null,LL=null,ym=0,gI=null;function Co(){return(an&2)!==0&&qt!==0?qt&-qt:F.T!==null?xI():_t()}function $L(){if(To===0)if((qt&536870912)===0||Qt){var s=Yo;Yo<<=1,(Yo&3932160)===0&&(Yo=262144),To=s}else To=536870912;return s=_o.current,s!==null&&(s.flags|=32),To}function oo(s,l,f){(s===In&&(gn===2||gn===9)||s.cancelPendingCommit!==null)&&(Tf(s,0),ic(s,qt,To,!1)),Ie(s,f),((an&2)===0||s!==In)&&(s===In&&((an&2)===0&&(Eu|=f),sr===4&&ic(s,qt,To,!1)),da(s))}function jL(s,l,f){if((an&6)!==0)throw Error(r(327));var m=!f&&(l&127)===0&&(l&s.expiredLanes)===0||ci(s,l),v=m?GX(s,l):bI(s,l,!0),k=m;do{if(v===0){_f&&!m&&ic(s,l,0,!1);break}else{if(f=s.current.alternate,k&&!HX(f)){v=bI(s,l,!1),k=!1;continue}if(v===2){if(k=l,s.errorRecoveryDisabledLanes&k)var O=0;else O=s.pendingLanes&-536870913,O=O!==0?O:O&536870912?536870912:0;if(O!==0){l=O;e:{var H=s;v=gm;var Z=H.current.memoizedState.isDehydrated;if(Z&&(Tf(H,O).flags|=256),O=bI(H,O,!1),O!==2){if(dI&&!Z){H.errorRecoveryDisabledLanes|=k,Eu|=k,v=4;break e}k=io,io=v,k!==null&&(io===null?io=k:io.push.apply(io,k))}v=O}if(k=!1,v!==2)continue}}if(v===1){Tf(s,0),ic(s,l,0,!0);break}e:{switch(m=s,k=v,k){case 0:case 1:throw Error(r(345));case 4:if((l&4194048)!==l)break;case 6:ic(m,l,To,!ec);break e;case 2:io=null;break;case 3:case 5:break;default:throw Error(r(329))}if((l&62914560)===l&&(v=vv+300-$t(),10<v)){if(ic(m,l,To,!ec),Es(m,0,!0)!==0)break e;il=l,m.timeoutHandle=m2(FL.bind(null,m,f,io,wv,hI,l,To,Eu,If,ec,k,"Throttled",-0,0),v);break e}FL(m,f,io,wv,hI,l,To,Eu,If,ec,k,null,-0,0)}}break}while(!0);da(s)}function FL(s,l,f,m,v,k,O,H,Z,de,be,we,fe,me){if(s.timeoutHandle=-1,we=l.subtreeFlags,we&8192||(we&16785408)===16785408){we={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Ua},AL(l,k,we);var Fe=(k&62914560)===k?vv-$t():(k&4194048)===k?NL-$t():0;if(Fe=RJ(we,Fe),Fe!==null){il=k,s.cancelPendingCommit=Fe(WL.bind(null,s,l,k,f,m,v,O,H,Z,be,we,null,fe,me)),ic(s,k,O,!de);return}}WL(s,l,k,f,m,v,O,H,Z)}function HX(s){for(var l=s;;){var f=l.tag;if((f===0||f===11||f===15)&&l.flags&16384&&(f=l.updateQueue,f!==null&&(f=f.stores,f!==null)))for(var m=0;m<f.length;m++){var v=f[m],k=v.getSnapshot;v=v.value;try{if(!xo(k(),v))return!1}catch{return!1}}if(f=l.child,l.subtreeFlags&16384&&f!==null)f.return=l,l=f;else{if(l===s)break;for(;l.sibling===null;){if(l.return===null||l.return===s)return!0;l=l.return}l.sibling.return=l.return,l=l.sibling}}return!0}function ic(s,l,f,m){l&=~fI,l&=~Eu,s.suspendedLanes|=l,s.pingedLanes&=~l,m&&(s.warmLanes|=l),m=s.expirationTimes;for(var v=l;0<v;){var k=31-He(v),O=1<<k;m[k]=-1,v&=~O}f!==0&&Je(s,f,l)}function xv(){return(an&6)===0?(bm(0),!1):!0}function yI(){if(jt!==null){if(gn===0)var s=jt.return;else s=jt,Wa=yu=null,D_(s),yf=null,em=0,s=jt;for(;s!==null;)gL(s.alternate,s),s=s.return;jt=null}}function Tf(s,l){var f=s.timeoutHandle;f!==-1&&(s.timeoutHandle=-1,fJ(f)),f=s.cancelPendingCommit,f!==null&&(s.cancelPendingCommit=null,f()),il=0,yI(),In=s,jt=f=Ka(s.current,null),qt=l,gn=0,Eo=null,ec=!1,_f=ci(s,l),dI=!1,If=To=fI=Eu=tc=sr=0,io=gm=null,hI=!1,(l&8)!==0&&(l|=l&32);var m=s.entangledLanes;if(m!==0)for(s=s.entanglements,m&=l;0<m;){var v=31-He(m),k=1<<v;l|=s[v],m&=~k}return rl=l,Ub(),f}function zL(s,l){xt=null,F.H=lm,l===gf||l===Xb?(l=nN(),gn=3):l===w_?(l=nN(),gn=4):gn=l===Y_?8:l!==null&&typeof l=="object"&&typeof l.then=="function"?6:1,Eo=l,jt===null&&(sr=1,dv(s,es(l,s.current)))}function BL(){var s=_o.current;return s===null?!0:(qt&4194048)===qt?is===null:(qt&62914560)===qt||(qt&536870912)!==0?s===is:!1}function qL(){var s=F.H;return F.H=lm,s===null?lm:s}function UL(){var s=F.A;return F.A=VX,s}function kv(){sr=4,ec||(qt&4194048)!==qt&&_o.current!==null||(_f=!0),(tc&134217727)===0&&(Eu&134217727)===0||In===null||ic(In,qt,To,!1)}function bI(s,l,f){var m=an;an|=2;var v=qL(),k=UL();(In!==s||qt!==l)&&(wv=null,Tf(s,l)),l=!1;var O=sr;e:do try{if(gn!==0&&jt!==null){var H=jt,Z=Eo;switch(gn){case 8:yI(),O=6;break e;case 3:case 2:case 9:case 6:_o.current===null&&(l=!0);var de=gn;if(gn=0,Eo=null,Cf(s,H,Z,de),f&&_f){O=0;break e}break;default:de=gn,gn=0,Eo=null,Cf(s,H,Z,de)}}WX(),O=sr;break}catch(be){zL(s,be)}while(!0);return l&&s.shellSuspendCounter++,Wa=yu=null,an=m,F.H=v,F.A=k,jt===null&&(In=null,qt=0,Ub()),O}function WX(){for(;jt!==null;)VL(jt)}function GX(s,l){var f=an;an|=2;var m=qL(),v=UL();In!==s||qt!==l?(wv=null,Sv=$t()+500,Tf(s,l)):_f=ci(s,l);e:do try{if(gn!==0&&jt!==null){l=jt;var k=Eo;t:switch(gn){case 1:gn=0,Eo=null,Cf(s,l,k,1);break;case 2:case 9:if(eN(k)){gn=0,Eo=null,KL(l);break}l=function(){gn!==2&&gn!==9||In!==s||(gn=7),da(s)},k.then(l,l);break e;case 3:gn=7;break e;case 4:gn=5;break e;case 7:eN(k)?(gn=0,Eo=null,KL(l)):(gn=0,Eo=null,Cf(s,l,k,7));break;case 5:var O=null;switch(jt.tag){case 26:O=jt.memoizedState;case 5:case 27:var H=jt;if(O?R2(O):H.stateNode.complete){gn=0,Eo=null;var Z=H.sibling;if(Z!==null)jt=Z;else{var de=H.return;de!==null?(jt=de,_v(de)):jt=null}break t}}gn=0,Eo=null,Cf(s,l,k,5);break;case 6:gn=0,Eo=null,Cf(s,l,k,6);break;case 8:yI(),sr=6;break e;default:throw Error(r(462))}}YX();break}catch(be){zL(s,be)}while(!0);return Wa=yu=null,F.H=m,F.A=v,an=f,jt!==null?0:(In=null,qt=0,Ub(),sr)}function YX(){for(;jt!==null&&!yt();)VL(jt)}function VL(s){var l=pL(s.alternate,s,rl);s.memoizedProps=s.pendingProps,l===null?_v(s):jt=l}function KL(s){var l=s,f=l.alternate;switch(l.tag){case 15:case 0:l=lL(f,l,l.pendingProps,l.type,void 0,qt);break;case 11:l=lL(f,l,l.pendingProps,l.type.render,l.ref,qt);break;case 5:D_(l);default:gL(f,l),l=jt=UP(l,rl),l=pL(f,l,rl)}s.memoizedProps=s.pendingProps,l===null?_v(s):jt=l}function Cf(s,l,f,m){Wa=yu=null,D_(l),yf=null,em=0;var v=l.return;try{if($X(s,v,l,f,qt)){sr=1,dv(s,es(f,s.current)),jt=null;return}}catch(k){if(v!==null)throw jt=v,k;sr=1,dv(s,es(f,s.current)),jt=null;return}l.flags&32768?(Qt||m===1?s=!0:_f||(qt&536870912)!==0?s=!1:(ec=s=!0,(m===2||m===9||m===3||m===6)&&(m=_o.current,m!==null&&m.tag===13&&(m.flags|=16384))),HL(l,s)):_v(l)}function _v(s){var l=s;do{if((l.flags&32768)!==0){HL(l,ec);return}s=l.return;var f=zX(l.alternate,l,rl);if(f!==null){jt=f;return}if(l=l.sibling,l!==null){jt=l;return}jt=l=s}while(l!==null);sr===0&&(sr=5)}function HL(s,l){do{var f=BX(s.alternate,s);if(f!==null){f.flags&=32767,jt=f;return}if(f=s.return,f!==null&&(f.flags|=32768,f.subtreeFlags=0,f.deletions=null),!l&&(s=s.sibling,s!==null)){jt=s;return}jt=s=f}while(s!==null);sr=6,jt=null}function WL(s,l,f,m,v,k,O,H,Z){s.cancelPendingCommit=null;do Iv();while(qr!==0);if((an&6)!==0)throw Error(r(327));if(l!==null){if(l===s.current)throw Error(r(177));if(k=l.lanes|l.childLanes,k|=s_,Me(s,f,k,O,H,Z),s===In&&(jt=In=null,qt=0),Ef=l,rc=s,il=f,pI=k,mI=v,LL=m,(l.subtreeFlags&10256)!==0||(l.flags&10256)!==0?(s.callbackNode=null,s.callbackPriority=0,ZX(Pe,function(){return JL(),null})):(s.callbackNode=null,s.callbackPriority=0),m=(l.flags&13878)!==0,(l.subtreeFlags&13878)!==0||m){m=F.T,F.T=null,v=K.p,K.p=2,O=an,an|=4;try{qX(s,l,f)}finally{an=O,K.p=v,F.T=m}}qr=1,GL(),YL(),QL()}}function GL(){if(qr===1){qr=0;var s=rc,l=Ef,f=(l.flags&13878)!==0;if((l.subtreeFlags&13878)!==0||f){f=F.T,F.T=null;var m=K.p;K.p=2;var v=an;an|=4;try{CL(l,s);var k=RI,O=PP(s.containerInfo),H=k.focusedElem,Z=k.selectionRange;if(O!==H&&H&&H.ownerDocument&&DP(H.ownerDocument.documentElement,H)){if(Z!==null&&t_(H)){var de=Z.start,be=Z.end;if(be===void 0&&(be=de),"selectionStart"in H)H.selectionStart=de,H.selectionEnd=Math.min(be,H.value.length);else{var we=H.ownerDocument||document,fe=we&&we.defaultView||window;if(fe.getSelection){var me=fe.getSelection(),Fe=H.textContent.length,ct=Math.min(Z.start,Fe),wn=Z.end===void 0?ct:Math.min(Z.end,Fe);!me.extend&&ct>wn&&(O=wn,wn=ct,ct=O);var ae=OP(H,ct),ne=OP(H,wn);if(ae&&ne&&(me.rangeCount!==1||me.anchorNode!==ae.node||me.anchorOffset!==ae.offset||me.focusNode!==ne.node||me.focusOffset!==ne.offset)){var ue=we.createRange();ue.setStart(ae.node,ae.offset),me.removeAllRanges(),ct>wn?(me.addRange(ue),me.extend(ne.node,ne.offset)):(ue.setEnd(ne.node,ne.offset),me.addRange(ue))}}}}for(we=[],me=H;me=me.parentNode;)me.nodeType===1&&we.push({element:me,left:me.scrollLeft,top:me.scrollTop});for(typeof H.focus=="function"&&H.focus(),H=0;H<we.length;H++){var Se=we[H];Se.element.scrollLeft=Se.left,Se.element.scrollTop=Se.top}}$v=!!MI,RI=MI=null}finally{an=v,K.p=m,F.T=f}}s.current=l,qr=2}}function YL(){if(qr===2){qr=0;var s=rc,l=Ef,f=(l.flags&8772)!==0;if((l.subtreeFlags&8772)!==0||f){f=F.T,F.T=null;var m=K.p;K.p=2;var v=an;an|=4;try{kL(s,l.alternate,l)}finally{an=v,K.p=m,F.T=f}}qr=3}}function QL(){if(qr===4||qr===3){qr=0,pn();var s=rc,l=Ef,f=il,m=LL;(l.subtreeFlags&10256)!==0||(l.flags&10256)!==0?qr=5:(qr=0,Ef=rc=null,XL(s,s.pendingLanes));var v=s.pendingLanes;if(v===0&&(nc=null),at(f),l=l.stateNode,Qe&&typeof Qe.onCommitFiberRoot=="function")try{Qe.onCommitFiberRoot(mn,l,void 0,(l.current.flags&128)===128)}catch{}if(m!==null){l=F.T,v=K.p,K.p=2,F.T=null;try{for(var k=s.onRecoverableError,O=0;O<m.length;O++){var H=m[O];k(H.value,{componentStack:H.stack})}}finally{F.T=l,K.p=v}}(il&3)!==0&&Iv(),da(s),v=s.pendingLanes,(f&261930)!==0&&(v&42)!==0?s===gI?ym++:(ym=0,gI=s):ym=0,bm(0)}}function XL(s,l){(s.pooledCacheLanes&=l)===0&&(l=s.pooledCache,l!=null&&(s.pooledCache=null,Jp(l)))}function Iv(){return GL(),YL(),QL(),JL()}function JL(){if(qr!==5)return!1;var s=rc,l=pI;pI=0;var f=at(il),m=F.T,v=K.p;try{K.p=32>f?32:f,F.T=null,f=mI,mI=null;var k=rc,O=il;if(qr=0,Ef=rc=null,il=0,(an&6)!==0)throw Error(r(331));var H=an;if(an|=4,DL(k.current),RL(k,k.current,O,f),an=H,bm(0,!1),Qe&&typeof Qe.onPostCommitFiberRoot=="function")try{Qe.onPostCommitFiberRoot(mn,k)}catch{}return!0}finally{K.p=v,F.T=m,XL(s,l)}}function ZL(s,l,f){l=es(f,l),l=G_(s.stateNode,l,2),s=Ql(s,l,2),s!==null&&(Ie(s,2),da(s))}function yn(s,l,f){if(s.tag===3)ZL(s,s,f);else for(;l!==null;){if(l.tag===3){ZL(l,s,f);break}else if(l.tag===1){var m=l.stateNode;if(typeof l.type.getDerivedStateFromError=="function"||typeof m.componentDidCatch=="function"&&(nc===null||!nc.has(m))){s=es(f,s),f=eL(2),m=Ql(l,f,2),m!==null&&(tL(f,m,l,s),Ie(m,2),da(m));break}}l=l.return}}function vI(s,l,f){var m=s.pingCache;if(m===null){m=s.pingCache=new KX;var v=new Set;m.set(l,v)}else v=m.get(l),v===void 0&&(v=new Set,m.set(l,v));v.has(f)||(dI=!0,v.add(f),s=QX.bind(null,s,l,f),l.then(s,s))}function QX(s,l,f){var m=s.pingCache;m!==null&&m.delete(l),s.pingedLanes|=s.suspendedLanes&f,s.warmLanes&=~f,In===s&&(qt&f)===f&&(sr===4||sr===3&&(qt&62914560)===qt&&300>$t()-vv?(an&2)===0&&Tf(s,0):fI|=f,If===qt&&(If=0)),da(s)}function e2(s,l){l===0&&(l=se()),s=pu(s,l),s!==null&&(Ie(s,l),da(s))}function XX(s){var l=s.memoizedState,f=0;l!==null&&(f=l.retryLane),e2(s,f)}function JX(s,l){var f=0;switch(s.tag){case 31:case 13:var m=s.stateNode,v=s.memoizedState;v!==null&&(f=v.retryLane);break;case 19:m=s.stateNode;break;case 22:m=s.stateNode._retryCache;break;default:throw Error(r(314))}m!==null&&m.delete(l),e2(s,f)}function ZX(s,l){return wt(s,l)}var Ev=null,Mf=null,SI=!1,Tv=!1,wI=!1,oc=0;function da(s){s!==Mf&&s.next===null&&(Mf===null?Ev=Mf=s:Mf=Mf.next=s),Tv=!0,SI||(SI=!0,tJ())}function bm(s,l){if(!wI&&Tv){wI=!0;do for(var f=!1,m=Ev;m!==null;){if(s!==0){var v=m.pendingLanes;if(v===0)var k=0;else{var O=m.suspendedLanes,H=m.pingedLanes;k=(1<<31-He(42|s)+1)-1,k&=v&~(O&~H),k=k&201326741?k&201326741|1:k?k|2:0}k!==0&&(f=!0,i2(m,k))}else k=qt,k=Es(m,m===In?k:0,m.cancelPendingCommit!==null||m.timeoutHandle!==-1),(k&3)===0||ci(m,k)||(f=!0,i2(m,k));m=m.next}while(f);wI=!1}}function eJ(){t2()}function t2(){Tv=SI=!1;var s=0;oc!==0&&dJ()&&(s=oc);for(var l=$t(),f=null,m=Ev;m!==null;){var v=m.next,k=n2(m,l);k===0?(m.next=null,f===null?Ev=v:f.next=v,v===null&&(Mf=f)):(f=m,(s!==0||(k&3)!==0)&&(Tv=!0)),m=v}qr!==0&&qr!==5||bm(s),oc!==0&&(oc=0)}function n2(s,l){for(var f=s.suspendedLanes,m=s.pingedLanes,v=s.expirationTimes,k=s.pendingLanes&-62914561;0<k;){var O=31-He(k),H=1<<O,Z=v[O];Z===-1?((H&f)===0||(H&m)!==0)&&(v[O]=Le(H,l)):Z<=l&&(s.expiredLanes|=H),k&=~H}if(l=In,f=qt,f=Es(s,s===l?f:0,s.cancelPendingCommit!==null||s.timeoutHandle!==-1),m=s.callbackNode,f===0||s===l&&(gn===2||gn===9)||s.cancelPendingCommit!==null)return m!==null&&m!==null&&Jn(m),s.callbackNode=null,s.callbackPriority=0;if((f&3)===0||ci(s,f)){if(l=f&-f,l===s.callbackPriority)return l;switch(m!==null&&Jn(m),at(f)){case 2:case 8:f=_e;break;case 32:f=Pe;break;case 268435456:f=dt;break;default:f=Pe}return m=r2.bind(null,s),f=wt(f,m),s.callbackPriority=l,s.callbackNode=f,l}return m!==null&&m!==null&&Jn(m),s.callbackPriority=2,s.callbackNode=null,2}function r2(s,l){if(qr!==0&&qr!==5)return s.callbackNode=null,s.callbackPriority=0,null;var f=s.callbackNode;if(Iv()&&s.callbackNode!==f)return null;var m=qt;return m=Es(s,s===In?m:0,s.cancelPendingCommit!==null||s.timeoutHandle!==-1),m===0?null:(jL(s,m,l),n2(s,$t()),s.callbackNode!=null&&s.callbackNode===f?r2.bind(null,s):null)}function i2(s,l){if(Iv())return null;jL(s,l,!0)}function tJ(){hJ(function(){(an&6)!==0?wt(he,eJ):t2()})}function xI(){if(oc===0){var s=pf;s===0&&(s=vo,vo<<=1,(vo&261888)===0&&(vo=256)),oc=s}return oc}function o2(s){return s==null||typeof s=="symbol"||typeof s=="boolean"?null:typeof s=="function"?s:Nb(""+s)}function s2(s,l){var f=l.ownerDocument.createElement("input");return f.name=l.name,f.value=l.value,s.id&&f.setAttribute("form",s.id),l.parentNode.insertBefore(f,l),s=new FormData(s),f.parentNode.removeChild(f),s}function nJ(s,l,f,m,v){if(l==="submit"&&f&&f.stateNode===v){var k=o2((v[sn]||null).action),O=m.submitter;O&&(l=(l=O[sn]||null)?o2(l.formAction):O.getAttribute("formAction"),l!==null&&(k=l,O=null));var H=new Fb("action","action",null,m,v);s.push({event:H,listeners:[{instance:null,listener:function(){if(m.defaultPrevented){if(oc!==0){var Z=O?s2(v,O):new FormData(v);q_(f,{pending:!0,data:Z,method:v.method,action:k},null,Z)}}else typeof k=="function"&&(H.preventDefault(),Z=O?s2(v,O):new FormData(v),q_(f,{pending:!0,data:Z,method:v.method,action:k},k,Z))},currentTarget:v}]})}}for(var kI=0;kI<o_.length;kI++){var _I=o_[kI],rJ=_I.toLowerCase(),iJ=_I[0].toUpperCase()+_I.slice(1);Ts(rJ,"on"+iJ)}Ts($P,"onAnimationEnd"),Ts(jP,"onAnimationIteration"),Ts(FP,"onAnimationStart"),Ts("dblclick","onDoubleClick"),Ts("focusin","onFocus"),Ts("focusout","onBlur"),Ts(SX,"onTransitionRun"),Ts(wX,"onTransitionStart"),Ts(xX,"onTransitionCancel"),Ts(zP,"onTransitionEnd"),aa("onMouseEnter",["mouseout","mouseover"]),aa("onMouseLeave",["mouseout","mouseover"]),aa("onPointerEnter",["pointerout","pointerover"]),aa("onPointerLeave",["pointerout","pointerover"]),sa("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),sa("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),sa("onBeforeInput",["compositionend","keypress","textInput","paste"]),sa("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),sa("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),sa("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var vm="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),oJ=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(vm));function a2(s,l){l=(l&4)!==0;for(var f=0;f<s.length;f++){var m=s[f],v=m.event;m=m.listeners;e:{var k=void 0;if(l)for(var O=m.length-1;0<=O;O--){var H=m[O],Z=H.instance,de=H.currentTarget;if(H=H.listener,Z!==k&&v.isPropagationStopped())break e;k=H,v.currentTarget=de;try{k(v)}catch(be){qb(be)}v.currentTarget=null,k=Z}else for(O=0;O<m.length;O++){if(H=m[O],Z=H.instance,de=H.currentTarget,H=H.listener,Z!==k&&v.isPropagationStopped())break e;k=H,v.currentTarget=de;try{k(v)}catch(be){qb(be)}v.currentTarget=null,k=Z}}}}function Ft(s,l){var f=l[ji];f===void 0&&(f=l[ji]=new Set);var m=s+"__bubble";f.has(m)||(l2(l,s,2,!1),f.add(m))}function II(s,l,f){var m=0;l&&(m|=4),l2(f,s,m,l)}var Cv="_reactListening"+Math.random().toString(36).slice(2);function EI(s){if(!s[Cv]){s[Cv]=!0,uu.forEach(function(f){f!=="selectionchange"&&(oJ.has(f)||II(f,!1,s),II(f,!0,s))});var l=s.nodeType===9?s:s.ownerDocument;l===null||l[Cv]||(l[Cv]=!0,II("selectionchange",!1,l))}}function l2(s,l,f,m){switch($2(l)){case 2:var v=DJ;break;case 8:v=PJ;break;default:v=BI}f=v.bind(null,l,f,s),v=void 0,!Hk||l!=="touchstart"&&l!=="touchmove"&&l!=="wheel"||(v=!0),m?v!==void 0?s.addEventListener(l,f,{capture:!0,passive:v}):s.addEventListener(l,f,!0):v!==void 0?s.addEventListener(l,f,{passive:v}):s.addEventListener(l,f,!1)}function TI(s,l,f,m,v){var k=m;if((l&1)===0&&(l&2)===0&&m!==null)e:for(;;){if(m===null)return;var O=m.tag;if(O===3||O===4){var H=m.stateNode.containerInfo;if(H===v)break;if(O===4)for(O=m.return;O!==null;){var Z=O.tag;if((Z===3||Z===4)&&O.stateNode.containerInfo===v)return;O=O.return}for(;H!==null;){if(O=So(H),O===null)return;if(Z=O.tag,Z===5||Z===6||Z===26||Z===27){m=k=O;continue e}H=H.parentNode}}m=m.return}hP(function(){var de=k,be=Vk(f),we=[];e:{var fe=BP.get(s);if(fe!==void 0){var me=Fb,Fe=s;switch(s){case"keypress":if($b(f)===0)break e;case"keydown":case"keyup":me=JQ;break;case"focusin":Fe="focus",me=Qk;break;case"focusout":Fe="blur",me=Qk;break;case"beforeblur":case"afterblur":me=Qk;break;case"click":if(f.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":me=gP;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":me=zQ;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":me=tX;break;case $P:case jP:case FP:me=UQ;break;case zP:me=rX;break;case"scroll":case"scrollend":me=jQ;break;case"wheel":me=oX;break;case"copy":case"cut":case"paste":me=KQ;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":me=bP;break;case"toggle":case"beforetoggle":me=aX}var ct=(l&4)!==0,wn=!ct&&(s==="scroll"||s==="scrollend"),ae=ct?fe!==null?fe+"Capture":null:fe;ct=[];for(var ne=de,ue;ne!==null;){var Se=ne;if(ue=Se.stateNode,Se=Se.tag,Se!==5&&Se!==26&&Se!==27||ue===null||ae===null||(Se=Bp(ne,ae),Se!=null&&ct.push(Sm(ne,Se,ue))),wn)break;ne=ne.return}0<ct.length&&(fe=new me(fe,Fe,null,f,be),we.push({event:fe,listeners:ct}))}}if((l&7)===0){e:{if(fe=s==="mouseover"||s==="pointerover",me=s==="mouseout"||s==="pointerout",fe&&f!==Uk&&(Fe=f.relatedTarget||f.fromElement)&&(So(Fe)||Fe[_n]))break e;if((me||fe)&&(fe=be.window===be?be:(fe=be.ownerDocument)?fe.defaultView||fe.parentWindow:window,me?(Fe=f.relatedTarget||f.toElement,me=de,Fe=Fe?So(Fe):null,Fe!==null&&(wn=o(Fe),ct=Fe.tag,Fe!==wn||ct!==5&&ct!==27&&ct!==6)&&(Fe=null)):(me=null,Fe=de),me!==Fe)){if(ct=gP,Se="onMouseLeave",ae="onMouseEnter",ne="mouse",(s==="pointerout"||s==="pointerover")&&(ct=bP,Se="onPointerLeave",ae="onPointerEnter",ne="pointer"),wn=me==null?fe:Ba(me),ue=Fe==null?fe:Ba(Fe),fe=new ct(Se,ne+"leave",me,f,be),fe.target=wn,fe.relatedTarget=ue,Se=null,So(be)===de&&(ct=new ct(ae,ne+"enter",Fe,f,be),ct.target=ue,ct.relatedTarget=wn,Se=ct),wn=Se,me&&Fe)t:{for(ct=sJ,ae=me,ne=Fe,ue=0,Se=ae;Se;Se=ct(Se))ue++;Se=0;for(var nt=ne;nt;nt=ct(nt))Se++;for(;0<ue-Se;)ae=ct(ae),ue--;for(;0<Se-ue;)ne=ct(ne),Se--;for(;ue--;){if(ae===ne||ne!==null&&ae===ne.alternate){ct=ae;break t}ae=ct(ae),ne=ct(ne)}ct=null}else ct=null;me!==null&&c2(we,fe,me,ct,!1),Fe!==null&&wn!==null&&c2(we,wn,Fe,ct,!0)}}e:{if(fe=de?Ba(de):window,me=fe.nodeName&&fe.nodeName.toLowerCase(),me==="select"||me==="input"&&fe.type==="file")var nn=EP;else if(_P(fe))if(TP)nn=yX;else{nn=mX;var We=pX}else me=fe.nodeName,!me||me.toLowerCase()!=="input"||fe.type!=="checkbox"&&fe.type!=="radio"?de&&qk(de.elementType)&&(nn=EP):nn=gX;if(nn&&(nn=nn(s,de))){IP(we,nn,f,be);break e}We&&We(s,fe,de),s==="focusout"&&de&&fe.type==="number"&&de.memoizedProps.value!=null&&Bk(fe,"number",fe.value)}switch(We=de?Ba(de):window,s){case"focusin":(_P(We)||We.contentEditable==="true")&&(sf=We,n_=de,Yp=null);break;case"focusout":Yp=n_=sf=null;break;case"mousedown":r_=!0;break;case"contextmenu":case"mouseup":case"dragend":r_=!1,NP(we,f,be);break;case"selectionchange":if(vX)break;case"keydown":case"keyup":NP(we,f,be)}var It;if(Jk)e:{switch(s){case"compositionstart":var Ut="onCompositionStart";break e;case"compositionend":Ut="onCompositionEnd";break e;case"compositionupdate":Ut="onCompositionUpdate";break e}Ut=void 0}else of?xP(s,f)&&(Ut="onCompositionEnd"):s==="keydown"&&f.keyCode===229&&(Ut="onCompositionStart");Ut&&(vP&&f.locale!=="ko"&&(of||Ut!=="onCompositionStart"?Ut==="onCompositionEnd"&&of&&(It=pP()):(Ul=be,Wk="value"in Ul?Ul.value:Ul.textContent,of=!0)),We=Mv(de,Ut),0<We.length&&(Ut=new yP(Ut,s,null,f,be),we.push({event:Ut,listeners:We}),It?Ut.data=It:(It=kP(f),It!==null&&(Ut.data=It)))),(It=cX?uX(s,f):dX(s,f))&&(Ut=Mv(de,"onBeforeInput"),0<Ut.length&&(We=new yP("onBeforeInput","beforeinput",null,f,be),we.push({event:We,listeners:Ut}),We.data=It)),nJ(we,s,de,f,be)}a2(we,l)})}function Sm(s,l,f){return{instance:s,listener:l,currentTarget:f}}function Mv(s,l){for(var f=l+"Capture",m=[];s!==null;){var v=s,k=v.stateNode;if(v=v.tag,v!==5&&v!==26&&v!==27||k===null||(v=Bp(s,f),v!=null&&m.unshift(Sm(s,v,k)),v=Bp(s,l),v!=null&&m.push(Sm(s,v,k))),s.tag===3)return m;s=s.return}return[]}function sJ(s){if(s===null)return null;do s=s.return;while(s&&s.tag!==5&&s.tag!==27);return s||null}function c2(s,l,f,m,v){for(var k=l._reactName,O=[];f!==null&&f!==m;){var H=f,Z=H.alternate,de=H.stateNode;if(H=H.tag,Z!==null&&Z===m)break;H!==5&&H!==26&&H!==27||de===null||(Z=de,v?(de=Bp(f,k),de!=null&&O.unshift(Sm(f,de,Z))):v||(de=Bp(f,k),de!=null&&O.push(Sm(f,de,Z)))),f=f.return}O.length!==0&&s.push({event:l,listeners:O})}var aJ=/\r\n?/g,lJ=/\u0000|\uFFFD/g;function u2(s){return(typeof s=="string"?s:""+s).replace(aJ,`
9
+ `).replace(lJ,"")}function d2(s,l){return l=u2(l),u2(s)===l}function Sn(s,l,f,m,v,k){switch(f){case"children":typeof m=="string"?l==="body"||l==="textarea"&&m===""||tf(s,m):(typeof m=="number"||typeof m=="bigint")&&l!=="body"&&tf(s,""+m);break;case"className":Db(s,"class",m);break;case"tabIndex":Db(s,"tabindex",m);break;case"dir":case"role":case"viewBox":case"width":case"height":Db(s,f,m);break;case"style":dP(s,m,k);break;case"data":if(l!=="object"){Db(s,"data",m);break}case"src":case"href":if(m===""&&(l!=="a"||f!=="href")){s.removeAttribute(f);break}if(m==null||typeof m=="function"||typeof m=="symbol"||typeof m=="boolean"){s.removeAttribute(f);break}m=Nb(""+m),s.setAttribute(f,m);break;case"action":case"formAction":if(typeof m=="function"){s.setAttribute(f,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof k=="function"&&(f==="formAction"?(l!=="input"&&Sn(s,l,"name",v.name,v,null),Sn(s,l,"formEncType",v.formEncType,v,null),Sn(s,l,"formMethod",v.formMethod,v,null),Sn(s,l,"formTarget",v.formTarget,v,null)):(Sn(s,l,"encType",v.encType,v,null),Sn(s,l,"method",v.method,v,null),Sn(s,l,"target",v.target,v,null)));if(m==null||typeof m=="symbol"||typeof m=="boolean"){s.removeAttribute(f);break}m=Nb(""+m),s.setAttribute(f,m);break;case"onClick":m!=null&&(s.onclick=Ua);break;case"onScroll":m!=null&&Ft("scroll",s);break;case"onScrollEnd":m!=null&&Ft("scrollend",s);break;case"dangerouslySetInnerHTML":if(m!=null){if(typeof m!="object"||!("__html"in m))throw Error(r(61));if(f=m.__html,f!=null){if(v.children!=null)throw Error(r(60));s.innerHTML=f}}break;case"multiple":s.multiple=m&&typeof m!="function"&&typeof m!="symbol";break;case"muted":s.muted=m&&typeof m!="function"&&typeof m!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(m==null||typeof m=="function"||typeof m=="boolean"||typeof m=="symbol"){s.removeAttribute("xlink:href");break}f=Nb(""+m),s.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",f);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":m!=null&&typeof m!="function"&&typeof m!="symbol"?s.setAttribute(f,""+m):s.removeAttribute(f);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":m&&typeof m!="function"&&typeof m!="symbol"?s.setAttribute(f,""):s.removeAttribute(f);break;case"capture":case"download":m===!0?s.setAttribute(f,""):m!==!1&&m!=null&&typeof m!="function"&&typeof m!="symbol"?s.setAttribute(f,m):s.removeAttribute(f);break;case"cols":case"rows":case"size":case"span":m!=null&&typeof m!="function"&&typeof m!="symbol"&&!isNaN(m)&&1<=m?s.setAttribute(f,m):s.removeAttribute(f);break;case"rowSpan":case"start":m==null||typeof m=="function"||typeof m=="symbol"||isNaN(m)?s.removeAttribute(f):s.setAttribute(f,m);break;case"popover":Ft("beforetoggle",s),Ft("toggle",s),Ob(s,"popover",m);break;case"xlinkActuate":qa(s,"http://www.w3.org/1999/xlink","xlink:actuate",m);break;case"xlinkArcrole":qa(s,"http://www.w3.org/1999/xlink","xlink:arcrole",m);break;case"xlinkRole":qa(s,"http://www.w3.org/1999/xlink","xlink:role",m);break;case"xlinkShow":qa(s,"http://www.w3.org/1999/xlink","xlink:show",m);break;case"xlinkTitle":qa(s,"http://www.w3.org/1999/xlink","xlink:title",m);break;case"xlinkType":qa(s,"http://www.w3.org/1999/xlink","xlink:type",m);break;case"xmlBase":qa(s,"http://www.w3.org/XML/1998/namespace","xml:base",m);break;case"xmlLang":qa(s,"http://www.w3.org/XML/1998/namespace","xml:lang",m);break;case"xmlSpace":qa(s,"http://www.w3.org/XML/1998/namespace","xml:space",m);break;case"is":Ob(s,"is",m);break;case"innerText":case"textContent":break;default:(!(2<f.length)||f[0]!=="o"&&f[0]!=="O"||f[1]!=="n"&&f[1]!=="N")&&(f=LQ.get(f)||f,Ob(s,f,m))}}function CI(s,l,f,m,v,k){switch(f){case"style":dP(s,m,k);break;case"dangerouslySetInnerHTML":if(m!=null){if(typeof m!="object"||!("__html"in m))throw Error(r(61));if(f=m.__html,f!=null){if(v.children!=null)throw Error(r(60));s.innerHTML=f}}break;case"children":typeof m=="string"?tf(s,m):(typeof m=="number"||typeof m=="bigint")&&tf(s,""+m);break;case"onScroll":m!=null&&Ft("scroll",s);break;case"onScrollEnd":m!=null&&Ft("scrollend",s);break;case"onClick":m!=null&&(s.onclick=Ua);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!Rb.hasOwnProperty(f))e:{if(f[0]==="o"&&f[1]==="n"&&(v=f.endsWith("Capture"),l=f.slice(2,v?f.length-7:void 0),k=s[sn]||null,k=k!=null?k[f]:null,typeof k=="function"&&s.removeEventListener(l,k,v),typeof m=="function")){typeof k!="function"&&k!==null&&(f in s?s[f]=null:s.hasAttribute(f)&&s.removeAttribute(f)),s.addEventListener(l,m,v);break e}f in s?s[f]=m:m===!0?s.setAttribute(f,""):Ob(s,f,m)}}}function hi(s,l,f){switch(l){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Ft("error",s),Ft("load",s);var m=!1,v=!1,k;for(k in f)if(f.hasOwnProperty(k)){var O=f[k];if(O!=null)switch(k){case"src":m=!0;break;case"srcSet":v=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(r(137,l));default:Sn(s,l,k,O,f,null)}}v&&Sn(s,l,"srcSet",f.srcSet,f,null),m&&Sn(s,l,"src",f.src,f,null);return;case"input":Ft("invalid",s);var H=k=O=v=null,Z=null,de=null;for(m in f)if(f.hasOwnProperty(m)){var be=f[m];if(be!=null)switch(m){case"name":v=be;break;case"type":O=be;break;case"checked":Z=be;break;case"defaultChecked":de=be;break;case"value":k=be;break;case"defaultValue":H=be;break;case"children":case"dangerouslySetInnerHTML":if(be!=null)throw Error(r(137,l));break;default:Sn(s,l,m,be,f,null)}}aP(s,k,H,Z,de,O,v,!1);return;case"select":Ft("invalid",s),m=O=k=null;for(v in f)if(f.hasOwnProperty(v)&&(H=f[v],H!=null))switch(v){case"value":k=H;break;case"defaultValue":O=H;break;case"multiple":m=H;default:Sn(s,l,v,H,f,null)}l=k,f=O,s.multiple=!!m,l!=null?ef(s,!!m,l,!1):f!=null&&ef(s,!!m,f,!0);return;case"textarea":Ft("invalid",s),k=v=m=null;for(O in f)if(f.hasOwnProperty(O)&&(H=f[O],H!=null))switch(O){case"value":m=H;break;case"defaultValue":v=H;break;case"children":k=H;break;case"dangerouslySetInnerHTML":if(H!=null)throw Error(r(91));break;default:Sn(s,l,O,H,f,null)}cP(s,m,v,k);return;case"option":for(Z in f)if(f.hasOwnProperty(Z)&&(m=f[Z],m!=null))switch(Z){case"selected":s.selected=m&&typeof m!="function"&&typeof m!="symbol";break;default:Sn(s,l,Z,m,f,null)}return;case"dialog":Ft("beforetoggle",s),Ft("toggle",s),Ft("cancel",s),Ft("close",s);break;case"iframe":case"object":Ft("load",s);break;case"video":case"audio":for(m=0;m<vm.length;m++)Ft(vm[m],s);break;case"image":Ft("error",s),Ft("load",s);break;case"details":Ft("toggle",s);break;case"embed":case"source":case"link":Ft("error",s),Ft("load",s);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(de in f)if(f.hasOwnProperty(de)&&(m=f[de],m!=null))switch(de){case"children":case"dangerouslySetInnerHTML":throw Error(r(137,l));default:Sn(s,l,de,m,f,null)}return;default:if(qk(l)){for(be in f)f.hasOwnProperty(be)&&(m=f[be],m!==void 0&&CI(s,l,be,m,f,void 0));return}}for(H in f)f.hasOwnProperty(H)&&(m=f[H],m!=null&&Sn(s,l,H,m,f,null))}function cJ(s,l,f,m){switch(l){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var v=null,k=null,O=null,H=null,Z=null,de=null,be=null;for(me in f){var we=f[me];if(f.hasOwnProperty(me)&&we!=null)switch(me){case"checked":break;case"value":break;case"defaultValue":Z=we;default:m.hasOwnProperty(me)||Sn(s,l,me,null,m,we)}}for(var fe in m){var me=m[fe];if(we=f[fe],m.hasOwnProperty(fe)&&(me!=null||we!=null))switch(fe){case"type":k=me;break;case"name":v=me;break;case"checked":de=me;break;case"defaultChecked":be=me;break;case"value":O=me;break;case"defaultValue":H=me;break;case"children":case"dangerouslySetInnerHTML":if(me!=null)throw Error(r(137,l));break;default:me!==we&&Sn(s,l,fe,me,m,we)}}zk(s,O,H,Z,de,be,k,v);return;case"select":me=O=H=fe=null;for(k in f)if(Z=f[k],f.hasOwnProperty(k)&&Z!=null)switch(k){case"value":break;case"multiple":me=Z;default:m.hasOwnProperty(k)||Sn(s,l,k,null,m,Z)}for(v in m)if(k=m[v],Z=f[v],m.hasOwnProperty(v)&&(k!=null||Z!=null))switch(v){case"value":fe=k;break;case"defaultValue":H=k;break;case"multiple":O=k;default:k!==Z&&Sn(s,l,v,k,m,Z)}l=H,f=O,m=me,fe!=null?ef(s,!!f,fe,!1):!!m!=!!f&&(l!=null?ef(s,!!f,l,!0):ef(s,!!f,f?[]:"",!1));return;case"textarea":me=fe=null;for(H in f)if(v=f[H],f.hasOwnProperty(H)&&v!=null&&!m.hasOwnProperty(H))switch(H){case"value":break;case"children":break;default:Sn(s,l,H,null,m,v)}for(O in m)if(v=m[O],k=f[O],m.hasOwnProperty(O)&&(v!=null||k!=null))switch(O){case"value":fe=v;break;case"defaultValue":me=v;break;case"children":break;case"dangerouslySetInnerHTML":if(v!=null)throw Error(r(91));break;default:v!==k&&Sn(s,l,O,v,m,k)}lP(s,fe,me);return;case"option":for(var Fe in f)if(fe=f[Fe],f.hasOwnProperty(Fe)&&fe!=null&&!m.hasOwnProperty(Fe))switch(Fe){case"selected":s.selected=!1;break;default:Sn(s,l,Fe,null,m,fe)}for(Z in m)if(fe=m[Z],me=f[Z],m.hasOwnProperty(Z)&&fe!==me&&(fe!=null||me!=null))switch(Z){case"selected":s.selected=fe&&typeof fe!="function"&&typeof fe!="symbol";break;default:Sn(s,l,Z,fe,m,me)}return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var ct in f)fe=f[ct],f.hasOwnProperty(ct)&&fe!=null&&!m.hasOwnProperty(ct)&&Sn(s,l,ct,null,m,fe);for(de in m)if(fe=m[de],me=f[de],m.hasOwnProperty(de)&&fe!==me&&(fe!=null||me!=null))switch(de){case"children":case"dangerouslySetInnerHTML":if(fe!=null)throw Error(r(137,l));break;default:Sn(s,l,de,fe,m,me)}return;default:if(qk(l)){for(var wn in f)fe=f[wn],f.hasOwnProperty(wn)&&fe!==void 0&&!m.hasOwnProperty(wn)&&CI(s,l,wn,void 0,m,fe);for(be in m)fe=m[be],me=f[be],!m.hasOwnProperty(be)||fe===me||fe===void 0&&me===void 0||CI(s,l,be,fe,m,me);return}}for(var ae in f)fe=f[ae],f.hasOwnProperty(ae)&&fe!=null&&!m.hasOwnProperty(ae)&&Sn(s,l,ae,null,m,fe);for(we in m)fe=m[we],me=f[we],!m.hasOwnProperty(we)||fe===me||fe==null&&me==null||Sn(s,l,we,fe,m,me)}function f2(s){switch(s){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function uJ(){if(typeof performance.getEntriesByType=="function"){for(var s=0,l=0,f=performance.getEntriesByType("resource"),m=0;m<f.length;m++){var v=f[m],k=v.transferSize,O=v.initiatorType,H=v.duration;if(k&&H&&f2(O)){for(O=0,H=v.responseEnd,m+=1;m<f.length;m++){var Z=f[m],de=Z.startTime;if(de>H)break;var be=Z.transferSize,we=Z.initiatorType;be&&f2(we)&&(Z=Z.responseEnd,O+=be*(Z<H?1:(H-de)/(Z-de)))}if(--m,l+=8*(k+O)/(v.duration/1e3),s++,10<s)break}}if(0<s)return l/s/1e6}return navigator.connection&&(s=navigator.connection.downlink,typeof s=="number")?s:5}var MI=null,RI=null;function Rv(s){return s.nodeType===9?s:s.ownerDocument}function h2(s){switch(s){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function p2(s,l){if(s===0)switch(l){case"svg":return 1;case"math":return 2;default:return 0}return s===1&&l==="foreignObject"?0:s}function AI(s,l){return s==="textarea"||s==="noscript"||typeof l.children=="string"||typeof l.children=="number"||typeof l.children=="bigint"||typeof l.dangerouslySetInnerHTML=="object"&&l.dangerouslySetInnerHTML!==null&&l.dangerouslySetInnerHTML.__html!=null}var OI=null;function dJ(){var s=window.event;return s&&s.type==="popstate"?s===OI?!1:(OI=s,!0):(OI=null,!1)}var m2=typeof setTimeout=="function"?setTimeout:void 0,fJ=typeof clearTimeout=="function"?clearTimeout:void 0,g2=typeof Promise=="function"?Promise:void 0,hJ=typeof queueMicrotask=="function"?queueMicrotask:typeof g2<"u"?function(s){return g2.resolve(null).then(s).catch(pJ)}:m2;function pJ(s){setTimeout(function(){throw s})}function sc(s){return s==="head"}function y2(s,l){var f=l,m=0;do{var v=f.nextSibling;if(s.removeChild(f),v&&v.nodeType===8)if(f=v.data,f==="/$"||f==="/&"){if(m===0){s.removeChild(v),Df(l);return}m--}else if(f==="$"||f==="$?"||f==="$~"||f==="$!"||f==="&")m++;else if(f==="html")wm(s.ownerDocument.documentElement);else if(f==="head"){f=s.ownerDocument.head,wm(f);for(var k=f.firstChild;k;){var O=k.nextSibling,H=k.nodeName;k[oa]||H==="SCRIPT"||H==="STYLE"||H==="LINK"&&k.rel.toLowerCase()==="stylesheet"||f.removeChild(k),k=O}}else f==="body"&&wm(s.ownerDocument.body);f=v}while(f);Df(l)}function b2(s,l){var f=s;s=0;do{var m=f.nextSibling;if(f.nodeType===1?l?(f._stashedDisplay=f.style.display,f.style.display="none"):(f.style.display=f._stashedDisplay||"",f.getAttribute("style")===""&&f.removeAttribute("style")):f.nodeType===3&&(l?(f._stashedText=f.nodeValue,f.nodeValue=""):f.nodeValue=f._stashedText||""),m&&m.nodeType===8)if(f=m.data,f==="/$"){if(s===0)break;s--}else f!=="$"&&f!=="$?"&&f!=="$~"&&f!=="$!"||s++;f=m}while(f)}function DI(s){var l=s.firstChild;for(l&&l.nodeType===10&&(l=l.nextSibling);l;){var f=l;switch(l=l.nextSibling,f.nodeName){case"HTML":case"HEAD":case"BODY":DI(f),Qo(f);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(f.rel.toLowerCase()==="stylesheet")continue}s.removeChild(f)}}function mJ(s,l,f,m){for(;s.nodeType===1;){var v=f;if(s.nodeName.toLowerCase()!==l.toLowerCase()){if(!m&&(s.nodeName!=="INPUT"||s.type!=="hidden"))break}else if(m){if(!s[oa])switch(l){case"meta":if(!s.hasAttribute("itemprop"))break;return s;case"link":if(k=s.getAttribute("rel"),k==="stylesheet"&&s.hasAttribute("data-precedence"))break;if(k!==v.rel||s.getAttribute("href")!==(v.href==null||v.href===""?null:v.href)||s.getAttribute("crossorigin")!==(v.crossOrigin==null?null:v.crossOrigin)||s.getAttribute("title")!==(v.title==null?null:v.title))break;return s;case"style":if(s.hasAttribute("data-precedence"))break;return s;case"script":if(k=s.getAttribute("src"),(k!==(v.src==null?null:v.src)||s.getAttribute("type")!==(v.type==null?null:v.type)||s.getAttribute("crossorigin")!==(v.crossOrigin==null?null:v.crossOrigin))&&k&&s.hasAttribute("async")&&!s.hasAttribute("itemprop"))break;return s;default:return s}}else if(l==="input"&&s.type==="hidden"){var k=v.name==null?null:""+v.name;if(v.type==="hidden"&&s.getAttribute("name")===k)return s}else return s;if(s=os(s.nextSibling),s===null)break}return null}function gJ(s,l,f){if(l==="")return null;for(;s.nodeType!==3;)if((s.nodeType!==1||s.nodeName!=="INPUT"||s.type!=="hidden")&&!f||(s=os(s.nextSibling),s===null))return null;return s}function v2(s,l){for(;s.nodeType!==8;)if((s.nodeType!==1||s.nodeName!=="INPUT"||s.type!=="hidden")&&!l||(s=os(s.nextSibling),s===null))return null;return s}function PI(s){return s.data==="$?"||s.data==="$~"}function NI(s){return s.data==="$!"||s.data==="$?"&&s.ownerDocument.readyState!=="loading"}function yJ(s,l){var f=s.ownerDocument;if(s.data==="$~")s._reactRetry=l;else if(s.data!=="$?"||f.readyState!=="loading")l();else{var m=function(){l(),f.removeEventListener("DOMContentLoaded",m)};f.addEventListener("DOMContentLoaded",m),s._reactRetry=m}}function os(s){for(;s!=null;s=s.nextSibling){var l=s.nodeType;if(l===1||l===3)break;if(l===8){if(l=s.data,l==="$"||l==="$!"||l==="$?"||l==="$~"||l==="&"||l==="F!"||l==="F")break;if(l==="/$"||l==="/&")return null}}return s}var LI=null;function S2(s){s=s.nextSibling;for(var l=0;s;){if(s.nodeType===8){var f=s.data;if(f==="/$"||f==="/&"){if(l===0)return os(s.nextSibling);l--}else f!=="$"&&f!=="$!"&&f!=="$?"&&f!=="$~"&&f!=="&"||l++}s=s.nextSibling}return null}function w2(s){s=s.previousSibling;for(var l=0;s;){if(s.nodeType===8){var f=s.data;if(f==="$"||f==="$!"||f==="$?"||f==="$~"||f==="&"){if(l===0)return s;l--}else f!=="/$"&&f!=="/&"||l++}s=s.previousSibling}return null}function x2(s,l,f){switch(l=Rv(f),s){case"html":if(s=l.documentElement,!s)throw Error(r(452));return s;case"head":if(s=l.head,!s)throw Error(r(453));return s;case"body":if(s=l.body,!s)throw Error(r(454));return s;default:throw Error(r(451))}}function wm(s){for(var l=s.attributes;l.length;)s.removeAttributeNode(l[0]);Qo(s)}var ss=new Map,k2=new Set;function Av(s){return typeof s.getRootNode=="function"?s.getRootNode():s.nodeType===9?s:s.ownerDocument}var ol=K.d;K.d={f:bJ,r:vJ,D:SJ,C:wJ,L:xJ,m:kJ,X:IJ,S:_J,M:EJ};function bJ(){var s=ol.f(),l=xv();return s||l}function vJ(s){var l=Br(s);l!==null&&l.tag===5&&l.type==="form"?zN(l):ol.r(s)}var Rf=typeof document>"u"?null:document;function _2(s,l,f){var m=Rf;if(m&&typeof l=="string"&&l){var v=Jo(l);v='link[rel="'+s+'"][href="'+v+'"]',typeof f=="string"&&(v+='[crossorigin="'+f+'"]'),k2.has(v)||(k2.add(v),s={rel:s,crossOrigin:f,href:l},m.querySelector(v)===null&&(l=m.createElement("link"),hi(l,"link",s),Hn(l),m.head.appendChild(l)))}}function SJ(s){ol.D(s),_2("dns-prefetch",s,null)}function wJ(s,l){ol.C(s,l),_2("preconnect",s,l)}function xJ(s,l,f){ol.L(s,l,f);var m=Rf;if(m&&s&&l){var v='link[rel="preload"][as="'+Jo(l)+'"]';l==="image"&&f&&f.imageSrcSet?(v+='[imagesrcset="'+Jo(f.imageSrcSet)+'"]',typeof f.imageSizes=="string"&&(v+='[imagesizes="'+Jo(f.imageSizes)+'"]')):v+='[href="'+Jo(s)+'"]';var k=v;switch(l){case"style":k=Af(s);break;case"script":k=Of(s)}ss.has(k)||(s=p({rel:"preload",href:l==="image"&&f&&f.imageSrcSet?void 0:s,as:l},f),ss.set(k,s),m.querySelector(v)!==null||l==="style"&&m.querySelector(xm(k))||l==="script"&&m.querySelector(km(k))||(l=m.createElement("link"),hi(l,"link",s),Hn(l),m.head.appendChild(l)))}}function kJ(s,l){ol.m(s,l);var f=Rf;if(f&&s){var m=l&&typeof l.as=="string"?l.as:"script",v='link[rel="modulepreload"][as="'+Jo(m)+'"][href="'+Jo(s)+'"]',k=v;switch(m){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":k=Of(s)}if(!ss.has(k)&&(s=p({rel:"modulepreload",href:s},l),ss.set(k,s),f.querySelector(v)===null)){switch(m){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(f.querySelector(km(k)))return}m=f.createElement("link"),hi(m,"link",s),Hn(m),f.head.appendChild(m)}}}function _J(s,l,f){ol.S(s,l,f);var m=Rf;if(m&&s){var v=wo(m).hoistableStyles,k=Af(s);l=l||"default";var O=v.get(k);if(!O){var H={loading:0,preload:null};if(O=m.querySelector(xm(k)))H.loading=5;else{s=p({rel:"stylesheet",href:s,"data-precedence":l},f),(f=ss.get(k))&&$I(s,f);var Z=O=m.createElement("link");Hn(Z),hi(Z,"link",s),Z._p=new Promise(function(de,be){Z.onload=de,Z.onerror=be}),Z.addEventListener("load",function(){H.loading|=1}),Z.addEventListener("error",function(){H.loading|=2}),H.loading|=4,Ov(O,l,m)}O={type:"stylesheet",instance:O,count:1,state:H},v.set(k,O)}}}function IJ(s,l){ol.X(s,l);var f=Rf;if(f&&s){var m=wo(f).hoistableScripts,v=Of(s),k=m.get(v);k||(k=f.querySelector(km(v)),k||(s=p({src:s,async:!0},l),(l=ss.get(v))&&jI(s,l),k=f.createElement("script"),Hn(k),hi(k,"link",s),f.head.appendChild(k)),k={type:"script",instance:k,count:1,state:null},m.set(v,k))}}function EJ(s,l){ol.M(s,l);var f=Rf;if(f&&s){var m=wo(f).hoistableScripts,v=Of(s),k=m.get(v);k||(k=f.querySelector(km(v)),k||(s=p({src:s,async:!0,type:"module"},l),(l=ss.get(v))&&jI(s,l),k=f.createElement("script"),Hn(k),hi(k,"link",s),f.head.appendChild(k)),k={type:"script",instance:k,count:1,state:null},m.set(v,k))}}function I2(s,l,f,m){var v=(v=ee.current)?Av(v):null;if(!v)throw Error(r(446));switch(s){case"meta":case"title":return null;case"style":return typeof f.precedence=="string"&&typeof f.href=="string"?(l=Af(f.href),f=wo(v).hoistableStyles,m=f.get(l),m||(m={type:"style",instance:null,count:0,state:null},f.set(l,m)),m):{type:"void",instance:null,count:0,state:null};case"link":if(f.rel==="stylesheet"&&typeof f.href=="string"&&typeof f.precedence=="string"){s=Af(f.href);var k=wo(v).hoistableStyles,O=k.get(s);if(O||(v=v.ownerDocument||v,O={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},k.set(s,O),(k=v.querySelector(xm(s)))&&!k._p&&(O.instance=k,O.state.loading=5),ss.has(s)||(f={rel:"preload",as:"style",href:f.href,crossOrigin:f.crossOrigin,integrity:f.integrity,media:f.media,hrefLang:f.hrefLang,referrerPolicy:f.referrerPolicy},ss.set(s,f),k||TJ(v,s,f,O.state))),l&&m===null)throw Error(r(528,""));return O}if(l&&m!==null)throw Error(r(529,""));return null;case"script":return l=f.async,f=f.src,typeof f=="string"&&l&&typeof l!="function"&&typeof l!="symbol"?(l=Of(f),f=wo(v).hoistableScripts,m=f.get(l),m||(m={type:"script",instance:null,count:0,state:null},f.set(l,m)),m):{type:"void",instance:null,count:0,state:null};default:throw Error(r(444,s))}}function Af(s){return'href="'+Jo(s)+'"'}function xm(s){return'link[rel="stylesheet"]['+s+"]"}function E2(s){return p({},s,{"data-precedence":s.precedence,precedence:null})}function TJ(s,l,f,m){s.querySelector('link[rel="preload"][as="style"]['+l+"]")?m.loading=1:(l=s.createElement("link"),m.preload=l,l.addEventListener("load",function(){return m.loading|=1}),l.addEventListener("error",function(){return m.loading|=2}),hi(l,"link",f),Hn(l),s.head.appendChild(l))}function Of(s){return'[src="'+Jo(s)+'"]'}function km(s){return"script[async]"+s}function T2(s,l,f){if(l.count++,l.instance===null)switch(l.type){case"style":var m=s.querySelector('style[data-href~="'+Jo(f.href)+'"]');if(m)return l.instance=m,Hn(m),m;var v=p({},f,{"data-href":f.href,"data-precedence":f.precedence,href:null,precedence:null});return m=(s.ownerDocument||s).createElement("style"),Hn(m),hi(m,"style",v),Ov(m,f.precedence,s),l.instance=m;case"stylesheet":v=Af(f.href);var k=s.querySelector(xm(v));if(k)return l.state.loading|=4,l.instance=k,Hn(k),k;m=E2(f),(v=ss.get(v))&&$I(m,v),k=(s.ownerDocument||s).createElement("link"),Hn(k);var O=k;return O._p=new Promise(function(H,Z){O.onload=H,O.onerror=Z}),hi(k,"link",m),l.state.loading|=4,Ov(k,f.precedence,s),l.instance=k;case"script":return k=Of(f.src),(v=s.querySelector(km(k)))?(l.instance=v,Hn(v),v):(m=f,(v=ss.get(k))&&(m=p({},f),jI(m,v)),s=s.ownerDocument||s,v=s.createElement("script"),Hn(v),hi(v,"link",m),s.head.appendChild(v),l.instance=v);case"void":return null;default:throw Error(r(443,l.type))}else l.type==="stylesheet"&&(l.state.loading&4)===0&&(m=l.instance,l.state.loading|=4,Ov(m,f.precedence,s));return l.instance}function Ov(s,l,f){for(var m=f.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),v=m.length?m[m.length-1]:null,k=v,O=0;O<m.length;O++){var H=m[O];if(H.dataset.precedence===l)k=H;else if(k!==v)break}k?k.parentNode.insertBefore(s,k.nextSibling):(l=f.nodeType===9?f.head:f,l.insertBefore(s,l.firstChild))}function $I(s,l){s.crossOrigin==null&&(s.crossOrigin=l.crossOrigin),s.referrerPolicy==null&&(s.referrerPolicy=l.referrerPolicy),s.title==null&&(s.title=l.title)}function jI(s,l){s.crossOrigin==null&&(s.crossOrigin=l.crossOrigin),s.referrerPolicy==null&&(s.referrerPolicy=l.referrerPolicy),s.integrity==null&&(s.integrity=l.integrity)}var Dv=null;function C2(s,l,f){if(Dv===null){var m=new Map,v=Dv=new Map;v.set(f,m)}else v=Dv,m=v.get(f),m||(m=new Map,v.set(f,m));if(m.has(s))return m;for(m.set(s,null),f=f.getElementsByTagName(s),v=0;v<f.length;v++){var k=f[v];if(!(k[oa]||k[st]||s==="link"&&k.getAttribute("rel")==="stylesheet")&&k.namespaceURI!=="http://www.w3.org/2000/svg"){var O=k.getAttribute(l)||"";O=s+O;var H=m.get(O);H?H.push(k):m.set(O,[k])}}return m}function M2(s,l,f){s=s.ownerDocument||s,s.head.insertBefore(f,l==="title"?s.querySelector("head > title"):null)}function CJ(s,l,f){if(f===1||l.itemProp!=null)return!1;switch(s){case"meta":case"title":return!0;case"style":if(typeof l.precedence!="string"||typeof l.href!="string"||l.href==="")break;return!0;case"link":if(typeof l.rel!="string"||typeof l.href!="string"||l.href===""||l.onLoad||l.onError)break;switch(l.rel){case"stylesheet":return s=l.disabled,typeof l.precedence=="string"&&s==null;default:return!0}case"script":if(l.async&&typeof l.async!="function"&&typeof l.async!="symbol"&&!l.onLoad&&!l.onError&&l.src&&typeof l.src=="string")return!0}return!1}function R2(s){return!(s.type==="stylesheet"&&(s.state.loading&3)===0)}function MJ(s,l,f,m){if(f.type==="stylesheet"&&(typeof m.media!="string"||matchMedia(m.media).matches!==!1)&&(f.state.loading&4)===0){if(f.instance===null){var v=Af(m.href),k=l.querySelector(xm(v));if(k){l=k._p,l!==null&&typeof l=="object"&&typeof l.then=="function"&&(s.count++,s=Pv.bind(s),l.then(s,s)),f.state.loading|=4,f.instance=k,Hn(k);return}k=l.ownerDocument||l,m=E2(m),(v=ss.get(v))&&$I(m,v),k=k.createElement("link"),Hn(k);var O=k;O._p=new Promise(function(H,Z){O.onload=H,O.onerror=Z}),hi(k,"link",m),f.instance=k}s.stylesheets===null&&(s.stylesheets=new Map),s.stylesheets.set(f,l),(l=f.state.preload)&&(f.state.loading&3)===0&&(s.count++,f=Pv.bind(s),l.addEventListener("load",f),l.addEventListener("error",f))}}var FI=0;function RJ(s,l){return s.stylesheets&&s.count===0&&Lv(s,s.stylesheets),0<s.count||0<s.imgCount?function(f){var m=setTimeout(function(){if(s.stylesheets&&Lv(s,s.stylesheets),s.unsuspend){var k=s.unsuspend;s.unsuspend=null,k()}},6e4+l);0<s.imgBytes&&FI===0&&(FI=62500*uJ());var v=setTimeout(function(){if(s.waitingForImages=!1,s.count===0&&(s.stylesheets&&Lv(s,s.stylesheets),s.unsuspend)){var k=s.unsuspend;s.unsuspend=null,k()}},(s.imgBytes>FI?50:800)+l);return s.unsuspend=f,function(){s.unsuspend=null,clearTimeout(m),clearTimeout(v)}}:null}function Pv(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Lv(this,this.stylesheets);else if(this.unsuspend){var s=this.unsuspend;this.unsuspend=null,s()}}}var Nv=null;function Lv(s,l){s.stylesheets=null,s.unsuspend!==null&&(s.count++,Nv=new Map,l.forEach(AJ,s),Nv=null,Pv.call(s))}function AJ(s,l){if(!(l.state.loading&4)){var f=Nv.get(s);if(f)var m=f.get(null);else{f=new Map,Nv.set(s,f);for(var v=s.querySelectorAll("link[data-precedence],style[data-precedence]"),k=0;k<v.length;k++){var O=v[k];(O.nodeName==="LINK"||O.getAttribute("media")!=="not all")&&(f.set(O.dataset.precedence,O),m=O)}m&&f.set(null,m)}v=l.instance,O=v.getAttribute("data-precedence"),k=f.get(O)||m,k===m&&f.set(null,v),f.set(O,v),this.count++,m=Pv.bind(this),v.addEventListener("load",m),v.addEventListener("error",m),k?k.parentNode.insertBefore(v,k.nextSibling):(s=s.nodeType===9?s.head:s,s.insertBefore(v,s.firstChild)),l.state.loading|=4}}var _m={$$typeof:_,Provider:null,Consumer:null,_currentValue:W,_currentValue2:W,_threadCount:0};function OJ(s,l,f,m,v,k,O,H,Z){this.tag=1,this.containerInfo=s,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=ve(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=ve(0),this.hiddenUpdates=ve(null),this.identifierPrefix=m,this.onUncaughtError=v,this.onCaughtError=k,this.onRecoverableError=O,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=Z,this.incompleteTransitions=new Map}function A2(s,l,f,m,v,k,O,H,Z,de,be,we){return s=new OJ(s,l,f,O,Z,de,be,we,H),l=1,k===!0&&(l|=24),k=ko(3,null,null,l),s.current=k,k.stateNode=s,l=b_(),l.refCount++,s.pooledCache=l,l.refCount++,k.memoizedState={element:m,isDehydrated:f,cache:l},x_(k),s}function O2(s){return s?(s=cf,s):cf}function D2(s,l,f,m,v,k){v=O2(v),m.context===null?m.context=v:m.pendingContext=v,m=Yl(l),m.payload={element:f},k=k===void 0?null:k,k!==null&&(m.callback=k),f=Ql(s,m,l),f!==null&&(oo(f,s,l),nm(f,s,l))}function P2(s,l){if(s=s.memoizedState,s!==null&&s.dehydrated!==null){var f=s.retryLane;s.retryLane=f!==0&&f<l?f:l}}function zI(s,l){P2(s,l),(s=s.alternate)&&P2(s,l)}function N2(s){if(s.tag===13||s.tag===31){var l=pu(s,67108864);l!==null&&oo(l,s,67108864),zI(s,67108864)}}function L2(s){if(s.tag===13||s.tag===31){var l=Co();l=Mt(l);var f=pu(s,l);f!==null&&oo(f,s,l),zI(s,l)}}var $v=!0;function DJ(s,l,f,m){var v=F.T;F.T=null;var k=K.p;try{K.p=2,BI(s,l,f,m)}finally{K.p=k,F.T=v}}function PJ(s,l,f,m){var v=F.T;F.T=null;var k=K.p;try{K.p=8,BI(s,l,f,m)}finally{K.p=k,F.T=v}}function BI(s,l,f,m){if($v){var v=qI(m);if(v===null)TI(s,l,m,jv,f),j2(s,m);else if(LJ(v,s,l,f,m))m.stopPropagation();else if(j2(s,m),l&4&&-1<NJ.indexOf(s)){for(;v!==null;){var k=Br(v);if(k!==null)switch(k.tag){case 3:if(k=k.stateNode,k.current.memoizedState.isDehydrated){var O=$i(k.pendingLanes);if(O!==0){var H=k;for(H.pendingLanes|=2,H.entangledLanes|=2;O;){var Z=1<<31-He(O);H.entanglements[1]|=Z,O&=~Z}da(k),(an&6)===0&&(Sv=$t()+500,bm(0))}}break;case 31:case 13:H=pu(k,2),H!==null&&oo(H,k,2),xv(),zI(k,2)}if(k=qI(m),k===null&&TI(s,l,m,jv,f),k===v)break;v=k}v!==null&&m.stopPropagation()}else TI(s,l,m,null,f)}}function qI(s){return s=Vk(s),UI(s)}var jv=null;function UI(s){if(jv=null,s=So(s),s!==null){var l=o(s);if(l===null)s=null;else{var f=l.tag;if(f===13){if(s=a(l),s!==null)return s;s=null}else if(f===31){if(s=c(l),s!==null)return s;s=null}else if(f===3){if(l.stateNode.current.memoizedState.isDehydrated)return l.tag===3?l.stateNode.containerInfo:null;s=null}else l!==s&&(s=null)}}return jv=s,null}function $2(s){switch(s){case"beforetoggle":case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"toggle":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 2;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(On()){case he:return 2;case _e:return 8;case Pe:case Ke:return 32;case dt:return 268435456;default:return 32}default:return 32}}var VI=!1,ac=null,lc=null,cc=null,Im=new Map,Em=new Map,uc=[],NJ="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset".split(" ");function j2(s,l){switch(s){case"focusin":case"focusout":ac=null;break;case"dragenter":case"dragleave":lc=null;break;case"mouseover":case"mouseout":cc=null;break;case"pointerover":case"pointerout":Im.delete(l.pointerId);break;case"gotpointercapture":case"lostpointercapture":Em.delete(l.pointerId)}}function Tm(s,l,f,m,v,k){return s===null||s.nativeEvent!==k?(s={blockedOn:l,domEventName:f,eventSystemFlags:m,nativeEvent:k,targetContainers:[v]},l!==null&&(l=Br(l),l!==null&&N2(l)),s):(s.eventSystemFlags|=m,l=s.targetContainers,v!==null&&l.indexOf(v)===-1&&l.push(v),s)}function LJ(s,l,f,m,v){switch(l){case"focusin":return ac=Tm(ac,s,l,f,m,v),!0;case"dragenter":return lc=Tm(lc,s,l,f,m,v),!0;case"mouseover":return cc=Tm(cc,s,l,f,m,v),!0;case"pointerover":var k=v.pointerId;return Im.set(k,Tm(Im.get(k)||null,s,l,f,m,v)),!0;case"gotpointercapture":return k=v.pointerId,Em.set(k,Tm(Em.get(k)||null,s,l,f,m,v)),!0}return!1}function F2(s){var l=So(s.target);if(l!==null){var f=o(l);if(f!==null){if(l=f.tag,l===13){if(l=a(f),l!==null){s.blockedOn=l,Rt(s.priority,function(){L2(f)});return}}else if(l===31){if(l=c(f),l!==null){s.blockedOn=l,Rt(s.priority,function(){L2(f)});return}}else if(l===3&&f.stateNode.current.memoizedState.isDehydrated){s.blockedOn=f.tag===3?f.stateNode.containerInfo:null;return}}}s.blockedOn=null}function Fv(s){if(s.blockedOn!==null)return!1;for(var l=s.targetContainers;0<l.length;){var f=qI(s.nativeEvent);if(f===null){f=s.nativeEvent;var m=new f.constructor(f.type,f);Uk=m,f.target.dispatchEvent(m),Uk=null}else return l=Br(f),l!==null&&N2(l),s.blockedOn=f,!1;l.shift()}return!0}function z2(s,l,f){Fv(s)&&f.delete(l)}function $J(){VI=!1,ac!==null&&Fv(ac)&&(ac=null),lc!==null&&Fv(lc)&&(lc=null),cc!==null&&Fv(cc)&&(cc=null),Im.forEach(z2),Em.forEach(z2)}function zv(s,l){s.blockedOn===l&&(s.blockedOn=null,VI||(VI=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,$J)))}var Bv=null;function B2(s){Bv!==s&&(Bv=s,e.unstable_scheduleCallback(e.unstable_NormalPriority,function(){Bv===s&&(Bv=null);for(var l=0;l<s.length;l+=3){var f=s[l],m=s[l+1],v=s[l+2];if(typeof m!="function"){if(UI(m||f)===null)continue;break}var k=Br(f);k!==null&&(s.splice(l,3),l-=3,q_(k,{pending:!0,data:v,method:f.method,action:m},m,v))}}))}function Df(s){function l(Z){return zv(Z,s)}ac!==null&&zv(ac,s),lc!==null&&zv(lc,s),cc!==null&&zv(cc,s),Im.forEach(l),Em.forEach(l);for(var f=0;f<uc.length;f++){var m=uc[f];m.blockedOn===s&&(m.blockedOn=null)}for(;0<uc.length&&(f=uc[0],f.blockedOn===null);)F2(f),f.blockedOn===null&&uc.shift();if(f=(s.ownerDocument||s).$$reactFormReplay,f!=null)for(m=0;m<f.length;m+=3){var v=f[m],k=f[m+1],O=v[sn]||null;if(typeof k=="function")O||B2(f);else if(O){var H=null;if(k&&k.hasAttribute("formAction")){if(v=k,O=k[sn]||null)H=O.formAction;else if(UI(v)!==null)continue}else H=O.action;typeof H=="function"?f[m+1]=H:(f.splice(m,3),m-=3),B2(f)}}}function q2(){function s(k){k.canIntercept&&k.info==="react-transition"&&k.intercept({handler:function(){return new Promise(function(O){return v=O})},focusReset:"manual",scroll:"manual"})}function l(){v!==null&&(v(),v=null),m||setTimeout(f,20)}function f(){if(!m&&!navigation.transition){var k=navigation.currentEntry;k&&k.url!=null&&navigation.navigate(k.url,{state:k.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var m=!1,v=null;return navigation.addEventListener("navigate",s),navigation.addEventListener("navigatesuccess",l),navigation.addEventListener("navigateerror",l),setTimeout(f,100),function(){m=!0,navigation.removeEventListener("navigate",s),navigation.removeEventListener("navigatesuccess",l),navigation.removeEventListener("navigateerror",l),v!==null&&(v(),v=null)}}}function KI(s){this._internalRoot=s}qv.prototype.render=KI.prototype.render=function(s){var l=this._internalRoot;if(l===null)throw Error(r(409));var f=l.current,m=Co();D2(f,m,s,l,null,null)},qv.prototype.unmount=KI.prototype.unmount=function(){var s=this._internalRoot;if(s!==null){this._internalRoot=null;var l=s.containerInfo;D2(s.current,2,null,s,null,null),xv(),l[_n]=null}};function qv(s){this._internalRoot=s}qv.prototype.unstable_scheduleHydration=function(s){if(s){var l=_t();s={blockedOn:null,target:s,priority:l};for(var f=0;f<uc.length&&l!==0&&l<uc[f].priority;f++);uc.splice(f,0,s),f===0&&F2(s)}};var U2=t.version;if(U2!=="19.2.0")throw Error(r(527,U2,"19.2.0"));K.findDOMNode=function(s){var l=s._reactInternals;if(l===void 0)throw typeof s.render=="function"?Error(r(188)):(s=Object.keys(s).join(","),Error(r(268,s)));return s=d(l),s=s!==null?h(s):null,s=s===null?null:s.stateNode,s};var jJ={bundleType:0,version:"19.2.0",rendererPackageName:"react-dom",currentDispatcherRef:F,reconcilerVersion:"19.2.0"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Uv=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Uv.isDisabled&&Uv.supportsFiber)try{mn=Uv.inject(jJ),Qe=Uv}catch{}}return Mm.createRoot=function(s,l){if(!i(s))throw Error(r(299));var f=!1,m="",v=QN,k=XN,O=JN;return l!=null&&(l.unstable_strictMode===!0&&(f=!0),l.identifierPrefix!==void 0&&(m=l.identifierPrefix),l.onUncaughtError!==void 0&&(v=l.onUncaughtError),l.onCaughtError!==void 0&&(k=l.onCaughtError),l.onRecoverableError!==void 0&&(O=l.onRecoverableError)),l=A2(s,1,!1,null,null,f,m,null,v,k,O,q2),s[_n]=l.current,EI(s),new KI(l)},Mm.hydrateRoot=function(s,l,f){if(!i(s))throw Error(r(299));var m=!1,v="",k=QN,O=XN,H=JN,Z=null;return f!=null&&(f.unstable_strictMode===!0&&(m=!0),f.identifierPrefix!==void 0&&(v=f.identifierPrefix),f.onUncaughtError!==void 0&&(k=f.onUncaughtError),f.onCaughtError!==void 0&&(O=f.onCaughtError),f.onRecoverableError!==void 0&&(H=f.onRecoverableError),f.formState!==void 0&&(Z=f.formState)),l=A2(s,1,!0,l,f??null,m,v,Z,k,O,H,q2),l.context=O2(null),f=l.current,m=Co(),m=Mt(m),v=Yl(m),v.callback=null,Ql(f,v,m),f=m,l.current.lanes=f,Ie(l,f),da(l),s[_n]=l.current,EI(s),new qv(l)},Mm.version="19.2.0",Mm}var Z2;function GJ(){if(Z2)return WI.exports;Z2=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),WI.exports=WJ(),WI.exports}var YJ=GJ(),D=Cy();const xn=Xw(D),MM=zJ({__proto__:null,default:xn},[D]),QJ=e=>typeof e=="function",G=function(e,t){if(typeof e=="function")return function(){return e(arguments)?t.apply(this,arguments):n=>t(n,...arguments)};switch(e){case 0:case 1:throw new RangeError(`Invalid arity ${e}`);case 2:return function(n,r){return arguments.length>=2?t(n,r):function(i){return t(i,n)}};case 3:return function(n,r,i){return arguments.length>=3?t(n,r,i):function(o){return t(o,n,r)}};case 4:return function(n,r,i,o){return arguments.length>=4?t(n,r,i,o):function(a){return t(a,n,r,i)}};case 5:return function(n,r,i,o,a){return arguments.length>=5?t(n,r,i,o,a):function(c){return t(c,n,r,i,o)}};default:return function(){if(arguments.length>=e)return t.apply(this,arguments);const n=arguments;return function(r){return t(r,...n)}}}},Lt=e=>e,Jw=e=>()=>e,HE=Jw(!0),lh=Jw(!1),Yq=Jw(void 0),k0=Yq;function Y(e,t,n,r,i,o,a,c,u){switch(arguments.length){case 1:return e;case 2:return t(e);case 3:return n(t(e));case 4:return r(n(t(e)));case 5:return i(r(n(t(e))));case 6:return o(i(r(n(t(e)))));case 7:return a(o(i(r(n(t(e))))));case 8:return c(a(o(i(r(n(t(e)))))));case 9:return u(c(a(o(i(r(n(t(e))))))));default:{let d=arguments[0];for(let h=1;h<arguments.length;h++)d=arguments[h](d);return d}}}const RM=e=>(t,n)=>t===n||e(t,n),XJ=G(2,(e,t)=>RM((n,r)=>e(t(n),t(r)))),JJ=e=>RM((t,n)=>{if(t.length!==n.length)return!1;for(let r=0;r<t.length;r++)if(!e(t[r],n[r]))return!1;return!0}),e$="effect/GlobalValue";let Rm;const Jt=(e,t)=>(Rm||(globalThis[e$]??=new Map,Rm=globalThis[e$]),Rm.has(e)||Rm.set(e,t()),Rm.get(e)),Qs=e=>typeof e=="string",ad=e=>typeof e=="number",Zw=e=>typeof e=="boolean",ex=e=>typeof e=="bigint",WE=e=>typeof e=="symbol",My=QJ,ZJ=e=>e===void 0,eZ=e=>!1,AM=e=>typeof e=="object"&&e!==null,$l=e=>AM(e)||My(e),ht=G(2,(e,t)=>$l(e)&&t in e),Qq=G(2,(e,t)=>ht(e,"_tag")&&e._tag===t),Pf=e=>e==null,tZ=e=>e!=null,nZ=e=>e instanceof Date,Xq=e=>typeof e=="string"||ht(e,Symbol.iterator),rZ=e=>AM(e)&&!Array.isArray(e),iZ=e=>ht(e,"then")&&My(e.then),tx=e=>`BUG: ${e} - please report an issue at https://github.com/Effect-TS/effect/issues`;let Jq=class Zq{self;called=!1;constructor(t){this.self=t}next(t){return this.called?{value:t,done:!0}:(this.called=!0,{value:this.self,done:!1})}return(t){return{value:t,done:!0}}throw(t){throw t}[Symbol.iterator](){return new Zq(this.self)}};const oZ=335903614,sZ=4150755663,aZ=1481765933,lZ=1284865837,cZ=9007199254740992,uZ=134217728;class dZ{_state;constructor(t,n,r,i){return Pf(n)&&Pf(t)?(n=Math.random()*4294967295>>>0,t=0):Pf(n)&&(n=t,t=0),Pf(i)&&Pf(r)?(i=this._state?this._state[3]:sZ,r=this._state?this._state[2]:oZ):Pf(i)&&(i=r,r=0),this._state=new Int32Array([0,0,r>>>0,((i||0)|1)>>>0]),this._next(),t$(this._state,this._state[0],this._state[1],t>>>0,n>>>0),this._next(),this}getState(){return[this._state[0],this._state[1],this._state[2],this._state[3]]}setState(t){this._state[0]=t[0],this._state[1]=t[1],this._state[2]=t[2],this._state[3]=t[3]|1}integer(t){return Math.round(this.number()*Number.MAX_SAFE_INTEGER)%t}number(){const t=(this._next()&67108863)*1,n=(this._next()&134217727)*1;return(t*uZ+n)/cZ}_next(){const t=this._state[0]>>>0,n=this._state[1]>>>0;fZ(this._state,t,n,aZ,lZ),t$(this._state,this._state[0],this._state[1],this._state[2],this._state[3]);let r=t>>>18,i=(n>>>18|t<<14)>>>0;r=(r^t)>>>0,i=(i^n)>>>0;const o=(i>>>27|r<<5)>>>0,a=t>>>27,c=(-a>>>0&31)>>>0;return(o>>>a|o<<c)>>>0}}function fZ(e,t,n,r,i){let o=(n>>>16)*(i&65535)>>>0,a=(n&65535)*(i>>>16)>>>0,c=(n&65535)*(i&65535)>>>0,u=(n>>>16)*(i>>>16)+((a>>>16)+(o>>>16))>>>0;a=a<<16>>>0,c=c+a>>>0,c>>>0<a>>>0&&(u=u+1>>>0),o=o<<16>>>0,c=c+o>>>0,c>>>0<o>>>0&&(u=u+1>>>0),u=u+Math.imul(n,r)>>>0,u=u+Math.imul(t,i)>>>0,e[0]=u,e[1]=c}function t$(e,t,n,r,i){let o=t+r>>>0;const a=n+i>>>0;a>>>0<n>>>0&&(o=o+1|0),e[0]=o,e[1]=a}const GE=Symbol.for("effect/Utils/YieldWrap");class Ry{#e;constructor(t){this.#e=t}[GE](){return this.#e}}function hZ(e){if(typeof e=="object"&&e!==null&&GE in e)return e[GE]();throw new Error(tx("yieldWrapGet"))}const as=Jt("effect/Utils/isStructuralRegion",()=>({enabled:!1,tester:void 0})),eU={effect_internal_function:e=>e()},pZ={effect_internal_function:e=>{try{return e()}finally{}}},mZ=eU.effect_internal_function(()=>new Error().stack)?.includes("effect_internal_function")===!0,Ui=mZ?eU.effect_internal_function:pZ.effect_internal_function,JI=Jt(Symbol.for("effect/Hash/randomHashCache"),()=>new WeakMap),Ot=Symbol.for("effect/Hash"),tt=e=>{if(as.enabled===!0)return 0;switch(typeof e){case"number":return DM(e);case"bigint":return ur(e.toString(10));case"boolean":return ur(String(e));case"symbol":return ur(String(e));case"string":return ur(e);case"undefined":return ur("undefined");case"function":case"object":return e===null?ur("null"):e instanceof Date?Number.isNaN(e.getTime())?ur("Invalid Date"):tt(e.toISOString()):e instanceof URL?tt(e.href):gZ(e)?e[Ot]():OM(e);default:throw new Error(`BUG: unhandled typeof ${typeof e} - please report an issue at https://github.com/Effect-TS/effect/issues`)}},OM=e=>(JI.has(e)||JI.set(e,DM(Math.floor(Math.random()*Number.MAX_SAFE_INTEGER))),JI.get(e)),Wt=e=>t=>t*53^e,nx=e=>e&3221225471|e>>>1&1073741824,gZ=e=>ht(e,Ot),DM=e=>{if(e!==e||e===1/0)return 0;let t=e|0;for(t!==e&&(t^=e*4294967295);e>4294967295;)t^=e/=4294967295;return nx(t)},ur=e=>{let t=5381,n=e.length;for(;n;)t=t*33^e.charCodeAt(--n);return nx(t)},yZ=(e,t)=>{let n=12289;for(let r=0;r<t.length;r++)n^=Y(ur(t[r]),Wt(tt(e[t[r]])));return nx(n)},tU=e=>yZ(e,Object.keys(e)),Ay=e=>{let t=6151;for(let n=0;n<e.length;n++)t=Y(t,Wt(tt(e[n])));return nx(t)},ir=function(){if(arguments.length===1){const n=arguments[0];return function(r){return Object.defineProperty(n,Ot,{value(){return r},enumerable:!1}),r}}const e=arguments[0],t=arguments[1];return Object.defineProperty(e,Ot,{value(){return t},enumerable:!1}),t},Tt=Symbol.for("effect/Equal");function bt(){return arguments.length===1?e=>_0(e,arguments[0]):_0(arguments[0],arguments[1])}function _0(e,t){if(e===t)return!0;const n=typeof e;if(n!==typeof t)return!1;if(n==="object"||n==="function"){if(e!==null&&t!==null){if(I0(e)&&I0(t))return tt(e)===tt(t)&&e[Tt](t)?!0:as.enabled&&as.tester?as.tester(e,t):!1;if(e instanceof Date&&t instanceof Date){const r=e.getTime(),i=t.getTime();return r===i||Number.isNaN(r)&&Number.isNaN(i)}else if(e instanceof URL&&t instanceof URL)return e.href===t.href}if(as.enabled){if(Array.isArray(e)&&Array.isArray(t))return e.length===t.length&&e.every((r,i)=>_0(r,t[i]));if(Object.getPrototypeOf(e)===Object.prototype&&Object.getPrototypeOf(e)===Object.prototype){const r=Object.keys(e),i=Object.keys(t);if(r.length===i.length){for(const o of r)if(!(o in t&&_0(e[o],t[o])))return as.tester?as.tester(e,t):!1;return!0}}return as.tester?as.tester(e,t):!1}}return as.enabled&&as.tester?as.tester(e,t):!1}const I0=e=>ht(e,Tt),PM=()=>bt,$n=Symbol.for("nodejs.util.inspect.custom"),Yn=e=>{try{if(ht(e,"toJSON")&&My(e.toJSON)&&e.toJSON.length===0)return e.toJSON();if(Array.isArray(e))return e.map(Yn)}catch{return{}}return Pg(e)},ZI="[Circular]";function bZ(e){try{return e.toISOString()}catch{return"Invalid Date"}}function vZ(e){try{const t=e.toString();return typeof t=="string"?t:String(t)}catch{return"[toString threw]"}}function nU(e){return Qs(e)?JSON.stringify(e):String(e)}function Xc(e,t){const n=new WeakSet,r=(a,c)=>{const u=a?.constructor;return u&&u!==Object.prototype.constructor&&u.name?`${u.name}(${c})`:c},i=a=>{try{return Reflect.ownKeys(a)}catch{return["[ownKeys threw]"]}};function o(a,c=0){if(Array.isArray(a))return n.has(a)?ZI:(n.add(a),`[${a.map(u=>o(u,c)).join(",")}]`);if(nZ(a))return bZ(a);if(ht(a,"toString")&&My(a.toString)&&a.toString!==Object.prototype.toString&&a.toString!==Array.prototype.toString){const u=vZ(a);return a instanceof Error&&a.cause?`${u} (cause: ${o(a.cause,c)})`:u}if(Qs(a))return JSON.stringify(a);if(ad(a)||a==null||Zw(a)||WE(a))return String(a);if(ex(a))return String(a)+"n";if(a instanceof Set||a instanceof Map)return n.has(a)?ZI:(n.add(a),`${a.constructor.name}(${o(Array.from(a),c)})`);if($l(a)){if(n.has(a))return ZI;n.add(a);const u=i(a);{const d=`{${u.map(h=>`${nU(h)}:${o(a[h],c)}`).join(",")}}`;return r(a,d)}}return String(a)}return o(e,0)}const _r=e=>JSON.stringify(e,null,2),Eh=(e,t=2)=>{if(typeof e=="string")return e;try{return typeof e=="object"?rU(e,t):String(e)}catch{return String(e)}},rU=(e,t)=>{let n=[];const r=JSON.stringify(e,(i,o)=>typeof o=="object"&&o!==null?n.includes(o)?void 0:n.push(o)&&(Wu.fiberRefs!==void 0&&iU(o)?o[NM](Wu.fiberRefs):o):o,t);return n=void 0,r},NM=Symbol.for("effect/Inspectable/Redactable"),iU=e=>typeof e=="object"&&e!==null&&NM in e,Wu=Jt("effect/Inspectable/redactableState",()=>({fiberRefs:void 0})),SZ=(e,t)=>{const n=Wu.fiberRefs;Wu.fiberRefs=e;try{return t()}finally{Wu.fiberRefs=n}},Pg=e=>iU(e)&&Wu.fiberRefs!==void 0?e[NM](Wu.fiberRefs):e,Xe=(e,t)=>{switch(t.length){case 0:return e;case 1:return t[0](e);case 2:return t[1](t[0](e));case 3:return t[2](t[1](t[0](e)));case 4:return t[3](t[2](t[1](t[0](e))));case 5:return t[4](t[3](t[2](t[1](t[0](e)))));case 6:return t[5](t[4](t[3](t[2](t[1](t[0](e))))));case 7:return t[6](t[5](t[4](t[3](t[2](t[1](t[0](e)))))));case 8:return t[7](t[6](t[5](t[4](t[3](t[2](t[1](t[0](e))))))));case 9:return t[8](t[7](t[6](t[5](t[4](t[3](t[2](t[1](t[0](e)))))))));default:{let n=e;for(let r=0,i=t.length;r<i;r++)n=t[r](n);return n}}},hg="Async",rx="Commit",oi="Failure",BS="OnFailure",E0="OnSuccess",T0="OnSuccessAndFailure",si="Success",oU="Sync",wZ="Tag",np="UpdateRuntimeFlags",C0="While",pg="Iterator",sU="WithRuntime",qS="Yield",LM="RevertFlags";let xZ="3.19.13";const $M=()=>xZ,kZ=Symbol.for("effect/Effect"),_Z=Symbol.for("effect/Stream"),IZ=Symbol.for("effect/Sink"),EZ=Symbol.for("effect/Channel"),Th={_R:e=>e,_E:e=>e,_A:e=>e,_V:$M()},TZ={_A:e=>e,_In:e=>e,_L:e=>e,_E:e=>e,_R:e=>e},CZ={_Env:e=>e,_InErr:e=>e,_InElem:e=>e,_InDone:e=>e,_OutErr:e=>e,_OutElem:e=>e,_OutDone:e=>e},Oy={[kZ]:Th,[_Z]:Th,[IZ]:TZ,[EZ]:CZ,[Tt](e){return this===e},[Ot](){return ir(this,OM(this))},[Symbol.iterator](){return new Jq(new Ry(this))},pipe(){return Xe(this,arguments)}},jM={[Ot](){return ir(this,tU(this))},[Tt](e){const t=Object.keys(this),n=Object.keys(e);if(t.length!==n.length)return!1;for(const r of t)if(!(r in e&&bt(this[r],e[r])))return!1;return!0}},jd={...Oy,_op:rx},MZ={...jd,...jM},RZ=(function(){function e(){}return e.prototype=jd,e})(),aU=Symbol.for("effect/Option"),lU={...Oy,[aU]:{_A:e=>e},[$n](){return this.toJSON()},toString(){return _r(this.toJSON())}},AZ=Object.assign(Object.create(lU),{_tag:"Some",_op:"Some",[Tt](e){return cU(e)&&dU(e)&&bt(this.value,e.value)},[Ot](){return ir(this,Wt(tt(this._tag))(tt(this.value)))},toJSON(){return{_id:"Option",_tag:this._tag,value:Yn(this.value)}}}),OZ=tt("None"),DZ=Object.assign(Object.create(lU),{_tag:"None",_op:"None",[Tt](e){return cU(e)&&uU(e)},[Ot](){return OZ},toJSON(){return{_id:"Option",_tag:this._tag}}}),cU=e=>ht(e,aU),uU=e=>e._tag==="None",dU=e=>e._tag==="Some",fU=Object.create(DZ),YE=e=>{const t=Object.create(AZ);return t.value=e,t},hU=Symbol.for("effect/Either"),pU={...Oy,[hU]:{_R:e=>e},[$n](){return this.toJSON()},toString(){return _r(this.toJSON())}},PZ=Object.assign(Object.create(pU),{_tag:"Right",_op:"Right",[Tt](e){return FM(e)&&gU(e)&&bt(this.right,e.right)},[Ot](){return Wt(tt(this._tag))(tt(this.right))},toJSON(){return{_id:"Either",_tag:this._tag,right:Yn(this.right)}}}),NZ=Object.assign(Object.create(pU),{_tag:"Left",_op:"Left",[Tt](e){return FM(e)&&mU(e)&&bt(this.left,e.left)},[Ot](){return Wt(tt(this._tag))(tt(this.left))},toJSON(){return{_id:"Either",_tag:this._tag,left:Yn(this.left)}}}),FM=e=>ht(e,hU),mU=e=>e._tag==="Left",gU=e=>e._tag==="Right",LZ=e=>{const t=Object.create(NZ);return t.left=e,t},$Z=e=>{const t=Object.create(PZ);return t.right=e,t},St=$Z,gt=LZ,jZ=FM,mi=mU,ba=gU,FZ=G(2,(e,t)=>mi(e)?gt(t(e.left)):St(e.right)),zZ=G(2,(e,t)=>ba(e)?St(t(e.right)):gt(e.left)),Hi=G(2,(e,{onLeft:t,onRight:n})=>mi(e)?t(e.left):n(e.right)),BZ=Hi({onLeft:Lt,onRight:Lt}),yU=G(2,(e,t)=>{if(ba(e))return e.right;throw t(e.left)}),qZ=yU(()=>new Error("getOrThrow called on a Left")),bU=e=>e.length>0,vU=e=>(t,n)=>t===n?0:e(t,n),UZ=vU((e,t)=>e<t?-1:1),SU=G(2,(e,t)=>vU((n,r)=>e(t(n),t(r)))),VZ=e=>G(2,(t,n)=>e(t,n)===1),Oe=()=>fU,De=YE,Zt=uU,Ce=dU,rr=G(2,(e,{onNone:t,onSome:n})=>Zt(e)?t():n(e.value)),Ln=G(2,(e,t)=>Zt(e)?t():e.value),Tc=G(2,(e,t)=>Zt(e)?t():e),KZ=G(2,(e,t)=>Zt(e)?De(t()):e),Dy=e=>e==null?Oe():De(e),Ti=Ln(Yq),wU=e=>(...t)=>{try{return De(e(...t))}catch{return Oe()}},Gu=G(2,(e,t)=>Zt(e)?Oe():De(t(e.value))),ix=G(2,(e,t)=>Zt(e)?Oe():t(e.value)),HZ=G(2,(e,t)=>Zt(e)?Oe():Dy(t(e.value))),WZ=e=>G(2,(t,n)=>Zt(t)?!1:e(t.value,n)),GZ=PM(),YZ=WZ(GZ),QZ=G(2,(e,t)=>Zt(e)?!1:t(e.value)),n$=e=>(t,n)=>Zt(t)?n:Zt(n)?t:De(e(t.value,n.value)),XZ=(...e)=>e,ox=e=>new Array(e),JZ=G(2,(e,t)=>{const n=Math.max(1,Math.floor(e)),r=new Array(n);for(let i=0;i<n;i++)r[i]=t(i);return r}),Kn=e=>Array.isArray(e)?e:Array.from(e),zM=e=>Array.isArray(e)?e:[e],ZZ=G(2,(e,{onEmpty:t,onNonEmpty:n})=>Ir(e)?n(Qi(e),ld(e)):t()),M0=G(2,(e,t)=>[t,...e]),eee=G(2,(e,t)=>[...e,t]),xU=G(2,(e,t)=>Kn(e).concat(Kn(t))),tee=Array.isArray,nee=e=>e.length===0,ree=nee,US=bU,Ir=bU,kU=(e,t)=>e<0||e>=t.length,iee=(e,t)=>Math.floor(Math.min(Math.max(0,e),t.length)),oee=G(2,(e,t)=>{const n=Math.floor(t);return kU(n,e)?Oe():De(e[n])}),_U=G(2,(e,t)=>{const n=Math.floor(t);if(kU(n,e))throw new Error(`Index ${n} out of bounds`);return e[n]}),mg=oee(0),Qi=_U(0),see=e=>Ir(e)?De(IU(e)):Oe(),IU=e=>e[e.length-1],ld=e=>e.slice(1),aee=(e,t)=>{let n=0;for(const r of e){if(!t(r,n))break;n++}return n},lee=G(2,(e,t)=>EU(e,aee(e,t))),cee=G(2,(e,t)=>{const n=Kn(e);return n.slice(iee(t,n),n.length)}),r$=e=>Array.from(e).reverse(),Ng=G(2,(e,t)=>{const n=Array.from(e);return n.sort(t),n}),i$=G(2,(e,t)=>uee(e,t,XZ)),uee=G(3,(e,t,n)=>{const r=Kn(e),i=Kn(t);if(Ir(r)&&Ir(i)){const o=[n(Qi(r),Qi(i))],a=Math.min(r.length,i.length);for(let c=1;c<a;c++)o[c]=n(r[c],i[c]);return o}return[]}),dee=PM(),EU=G(2,(e,t)=>{const n=Array.from(e),r=Math.floor(t);return Ir(n)?r>=1?fee(n,r):[[],n]:[n,[]]}),fee=G(2,(e,t)=>{const n=Math.max(1,Math.floor(t));return n>=e.length?[Jm(e),[]]:[M0(e.slice(1,n),Qi(e)),e.slice(n)]}),Jm=e=>e.slice(),hee=G(3,(e,t,n)=>{const r=Kn(e),i=Kn(t);return Ir(r)?Ir(i)?MU(n)(xU(r,i)):r:i}),VS=G(2,(e,t)=>hee(e,t,dee)),cd=()=>[],$s=e=>[e],Yu=G(2,(e,t)=>e.map(t)),TU=G(2,(e,t)=>{if(ree(e))return[];const n=[];for(let r=0;r<e.length;r++){const i=t(e[r],r);for(let o=0;o<i.length;o++)n.push(i[o])}return n}),pee=TU(Lt),CU=G(2,(e,t)=>{const n=Kn(e),r=[];for(let i=0;i<n.length;i++){const o=t(n[i],i);Ce(o)&&r.push(o.value)}return r}),mee=G(2,(e,t)=>{const n=Kn(e),r=[];for(let i=0;i<n.length;i++)t(n[i],i)&&r.push(n[i]);return r}),BM=G(3,(e,t,n)=>Kn(e).reduce((r,i,o)=>n(r,i,o),t)),o$=(e,t)=>{const n=[];let r=e,i;for(;Ce(i=t(r));){const[o,a]=i.value;n.push(o),r=a}return n},qM=JJ,MU=G(2,(e,t)=>{const n=Kn(e);if(Ir(n)){const r=[Qi(n)],i=ld(n);for(const o of i)r.every(a=>!t(o,a))&&r.push(o);return r}return[]}),gee=e=>MU(e,PM()),rp=G(2,(e,t)=>Kn(e).join(t)),RU=(e,t)=>{switch(t._tag){case"StringKeyword":case"TemplateLiteral":return Object.keys(e);case"SymbolKeyword":return Object.getOwnPropertySymbols(e);case"Refinement":return RU(e,t.from)}},AU=e=>{let t=!1,n;return()=>(t||(n=e(),t=!0),n)},OU=e=>Array.isArray(e),yee=e=>!Array.isArray(e),s$=e=>`[${nU(e)}]`,bee=e=>OU(e)?e.map(s$).join(""):s$(e),Fd=(e,t,n,r)=>{let i=e;return t!==void 0&&(i+=`
10
+ details: ${t}`),r&&(i+=`
11
+ schema (${r._tag}): ${r}`),i},vee=e=>Fd("Unsupported key schema",void 0,void 0,e),See=e=>Fd("Unsupported literal",`literal value: ${Xc(e)}`),a$=e=>Fd("Duplicate index signature",`${e} index signature`),wee=Fd("Unsupported index signature parameter","An index signature parameter type must be `string`, `symbol`, a template literal type or a refinement of the previous types"),xee=Fd("Invalid element","A required element cannot follow an optional element. ts(1257)"),l$=e=>Fd("Duplicate property signature transformation",`Duplicate key ${Xc(e)}`),kee=e=>Fd("Duplicate property signature",`Duplicate key ${Xc(e)}`),_ee=Symbol.for("effect/SchemaId/GreaterThan"),Iee=Symbol.for("effect/SchemaId/Int"),Ch=UZ,Eee=e=>{const t=Math.ceil(Math.log(e)/Math.log(2));return Math.max(Math.pow(2,t),2)},R0=e=>e.replace(/[/\\^$*+?.()|[\]{}]/g,"\\$&"),Tee=Symbol.for("effect/annotation/TypeConstructor"),Cee=Symbol.for("effect/annotation/Brand"),Mee=Symbol.for("effect/annotation/SchemaId"),DU=Symbol.for("effect/annotation/Message"),UM=Symbol.for("effect/annotation/MissingMessage"),VM=Symbol.for("effect/annotation/Identifier"),La=Symbol.for("effect/annotation/Title"),QE=Symbol.for("effect/annotation/AutoTitle"),Py=Symbol.for("effect/annotation/Description"),PU=Symbol.for("effect/annotation/Examples"),NU=Symbol.for("effect/annotation/Default"),LU=Symbol.for("effect/annotation/JSONSchema"),$U=Symbol.for("effect/annotation/Arbitrary"),jU=Symbol.for("effect/annotation/Pretty"),FU=Symbol.for("effect/annotation/Equivalence"),Ree=Symbol.for("effect/annotation/Documentation"),zU=Symbol.for("effect/annotation/Concurrency"),BU=Symbol.for("effect/annotation/Batching"),qU=Symbol.for("effect/annotation/ParseIssueTitle"),UU=Symbol.for("effect/annotation/ParseOptions"),VU=Symbol.for("effect/annotation/DecodingFallback"),KU=Symbol.for("effect/annotation/Surrogate"),Aee=Symbol.for("effect/annotation/StableFilter"),Ji=G(2,(e,t)=>Object.prototype.hasOwnProperty.call(e.annotations,t)?De(e.annotations[t]):Oe()),Oee=Ji(Cee),Dee=Ji(DU),Pee=Ji(UM),HU=Ji(La),WU=Ji(QE),sx=Ji(VM),GU=Ji(Py),Nee=Ji(zU),Lee=Ji(BU),$ee=Ji(qU),jee=Ji(UU),Fee=Ji(VU),YU=Ji(KU),zee=Ji(Aee),Bee=e=>QZ(zee(e),t=>t===!0),QU=Symbol.for("effect/annotation/JSONIdentifier"),qee=Ji(QU),Uee=e=>Tc(qee(e),()=>sx(e));class XU{typeParameters;decodeUnknown;encodeUnknown;annotations;_tag="Declaration";constructor(t,n,r,i={}){this.typeParameters=t,this.decodeUnknown=n,this.encodeUnknown=r,this.annotations=i}toString(){return Ln(Aa(this),()=>"<declaration schema>")}toJSON(){return{_tag:this._tag,typeParameters:this.typeParameters.map(t=>t.toJSON()),annotations:Fr(this.annotations)}}}const jl=e=>t=>t._tag===e;let A0=class{literal;annotations;_tag="Literal";constructor(t,n={}){this.literal=t,this.annotations=n}toString(){return Ln(Aa(this),()=>Xc(this.literal))}toJSON(){return{_tag:this._tag,literal:ex(this.literal)?String(this.literal):this.literal,annotations:Fr(this.annotations)}}};const c$=jl("Literal"),Vee=new A0(null);class Kee{symbol;annotations;_tag="UniqueSymbol";constructor(t,n={}){this.symbol=t,this.annotations=n}toString(){return Ln(Aa(this),()=>Xc(this.symbol))}toJSON(){return{_tag:this._tag,symbol:String(this.symbol),annotations:Fr(this.annotations)}}}class Hee{annotations;_tag="UndefinedKeyword";constructor(t={}){this.annotations=t}toString(){return Jc(this)}toJSON(){return{_tag:this._tag,annotations:Fr(this.annotations)}}}const XE=new Hee({[La]:"undefined"});class Wee{annotations;_tag="VoidKeyword";constructor(t={}){this.annotations=t}toString(){return Jc(this)}toJSON(){return{_tag:this._tag,annotations:Fr(this.annotations)}}}const Gee=new Wee({[La]:"void"});class Yee{annotations;_tag="NeverKeyword";constructor(t={}){this.annotations=t}toString(){return Jc(this)}toJSON(){return{_tag:this._tag,annotations:Fr(this.annotations)}}}const KM=new Yee({[La]:"never"});class Qee{annotations;_tag="UnknownKeyword";constructor(t={}){this.annotations=t}toString(){return Jc(this)}toJSON(){return{_tag:this._tag,annotations:Fr(this.annotations)}}}const Xee=new Qee({[La]:"unknown"});class Jee{annotations;_tag="AnyKeyword";constructor(t={}){this.annotations=t}toString(){return Jc(this)}toJSON(){return{_tag:this._tag,annotations:Fr(this.annotations)}}}const JU=new Jee({[La]:"any"});class Zee{annotations;_tag="StringKeyword";constructor(t={}){this.annotations=t}toString(){return Jc(this)}toJSON(){return{_tag:this._tag,annotations:Fr(this.annotations)}}}const ete=new Zee({[La]:"string",[Py]:"a string"}),tte=jl("StringKeyword");class nte{annotations;_tag="NumberKeyword";constructor(t={}){this.annotations=t}toString(){return Jc(this)}toJSON(){return{_tag:this._tag,annotations:Fr(this.annotations)}}}const rte=new nte({[La]:"number",[Py]:"a number"});class ite{annotations;_tag="BooleanKeyword";constructor(t={}){this.annotations=t}toString(){return Jc(this)}toJSON(){return{_tag:this._tag,annotations:Fr(this.annotations)}}}const ote=new ite({[La]:"boolean",[Py]:"a boolean"}),ste=jl("SymbolKeyword");let ax=class{type;annotations;constructor(t,n={}){this.type=t,this.annotations=n}toJSON(){return{type:this.type.toJSON(),annotations:Fr(this.annotations)}}toString(){return String(this.type)}};class ip extends ax{isOptional;constructor(t,n,r={}){super(t,r),this.isOptional=n}toJSON(){return{type:this.type.toJSON(),isOptional:this.isOptional,annotations:Fr(this.annotations)}}toString(){return String(this.type)+(this.isOptional?"?":"")}}const ZU=e=>e.map(t=>t.type);class HM{elements;rest;isReadonly;annotations;_tag="TupleType";constructor(t,n,r,i={}){this.elements=t,this.rest=n,this.isReadonly=r,this.annotations=i;let o=!1,a=!1;for(const c of t)if(c.isOptional)o=!0;else if(o){a=!0;break}if(a||o&&n.length>1)throw new Error(xee)}toString(){return Ln(Aa(this),()=>ate(this))}toJSON(){return{_tag:this._tag,elements:this.elements.map(t=>t.toJSON()),rest:this.rest.map(t=>t.toJSON()),isReadonly:this.isReadonly,annotations:Fr(this.annotations)}}}const ate=e=>{const t=e.elements.map(String).join(", ");return ZZ(e.rest,{onEmpty:()=>`readonly [${t}]`,onNonEmpty:(n,r)=>{const i=String(n),o=i.includes(" | ")?`(${i})`:i;if(r.length>0){const a=r.map(String).join(", ");return e.elements.length>0?`readonly [${t}, ...${o}[], ${a}]`:`readonly [...${o}[], ${a}]`}else return e.elements.length>0?`readonly [${t}, ...${o}[]]`:`ReadonlyArray<${i}>`}})},WM=jl("TupleType");class Ii extends ip{name;isReadonly;constructor(t,n,r,i,o){super(n,r,o),this.name=t,this.isReadonly=i}toString(){return(this.isReadonly?"readonly ":"")+String(this.name)+(this.isOptional?"?":"")+": "+this.type}toJSON(){return{name:String(this.name),type:this.type.toJSON(),isOptional:this.isOptional,isReadonly:this.isReadonly,annotations:Fr(this.annotations)}}}const eV=e=>{switch(e._tag){case"StringKeyword":case"SymbolKeyword":case"TemplateLiteral":return!0;case"Refinement":return eV(e.from)}return!1};class lx{type;isReadonly;parameter;constructor(t,n,r){if(this.type=n,this.isReadonly=r,eV(t))this.parameter=t;else throw new Error(wee)}toString(){return(this.isReadonly?"readonly ":"")+`[x: ${this.parameter}]: ${this.type}`}toJSON(){return{parameter:this.parameter.toJSON(),type:this.type.toJSON(),isReadonly:this.isReadonly}}}class Qu{annotations;_tag="TypeLiteral";propertySignatures;indexSignatures;constructor(t,n,r={}){this.annotations=r;const i={};for(let a=0;a<t.length;a++){const c=t[a].name;if(Object.prototype.hasOwnProperty.call(i,c))throw new Error(kee(c));i[c]=null}const o={string:!1,symbol:!1};for(let a=0;a<n.length;a++){const c=aV(n[a].parameter);if(tte(c)){if(o.string)throw new Error(a$("string"));o.string=!0}else if(ste(c)){if(o.symbol)throw new Error(a$("symbol"));o.symbol=!0}}this.propertySignatures=t,this.indexSignatures=n}toString(){return Ln(Aa(this),()=>lte(this))}toJSON(){return{_tag:this._tag,propertySignatures:this.propertySignatures.map(t=>t.toJSON()),indexSignatures:this.indexSignatures.map(t=>t.toJSON()),annotations:Fr(this.annotations)}}}const u$=e=>e.map(String).join("; "),lte=e=>{if(e.propertySignatures.length>0){const t=e.propertySignatures.map(String).join("; ");return e.indexSignatures.length>0?`{ ${t}; ${u$(e.indexSignatures)} }`:`{ ${t} }`}else return e.indexSignatures.length>0?`{ ${u$(e.indexSignatures)} }`:"{}"},GM=jl("TypeLiteral"),cte=Ng(SU(Ch,e=>{switch(e._tag){case"AnyKeyword":return 0;case"UnknownKeyword":return 1;case"ObjectKeyword":return 2;case"StringKeyword":case"NumberKeyword":case"BooleanKeyword":case"BigIntKeyword":case"SymbolKeyword":return 3}return 4})),ute={string:"StringKeyword",number:"NumberKeyword",boolean:"BooleanKeyword",bigint:"BigIntKeyword"},tV=e=>TU(e,t=>Ny(t)?tV(t.types):[t]),dte=e=>{const t=cte(e),n=[],r={},i=[];for(const o of t)switch(o._tag){case"NeverKeyword":break;case"AnyKeyword":return[JU];case"UnknownKeyword":return[Xee];case"ObjectKeyword":case"UndefinedKeyword":case"VoidKeyword":case"StringKeyword":case"NumberKeyword":case"BooleanKeyword":case"BigIntKeyword":case"SymbolKeyword":{r[o._tag]||(r[o._tag]=o,n.push(o));break}case"Literal":{const a=typeof o.literal;switch(a){case"string":case"number":case"bigint":case"boolean":{const c=ute[a];!r[c]&&!i.includes(o.literal)&&(i.push(o.literal),n.push(o));break}case"object":{i.includes(o.literal)||(i.push(o.literal),n.push(o));break}}break}case"UniqueSymbol":{!r.SymbolKeyword&&!i.includes(o.symbol)&&(i.push(o.symbol),n.push(o));break}case"TupleType":{r.ObjectKeyword||n.push(o);break}case"TypeLiteral":{o.propertySignatures.length===0&&o.indexSignatures.length===0?r["{}"]||(r["{}"]=o,n.push(o)):r.ObjectKeyword||n.push(o);break}default:n.push(o)}return n};let ma=class JE{types;annotations;static make=(t,n)=>YM(t)?new JE(t,n):t.length===1?t[0]:KM;static unify=(t,n)=>JE.make(dte(tV(t)),n);_tag="Union";constructor(t,n={}){this.types=t,this.annotations=n}toString(){return Ln(Aa(this),()=>this.types.map(String).join(" | "))}toJSON(){return{_tag:this._tag,types:this.types.map(t=>t.toJSON()),annotations:Fr(this.annotations)}}};const fte=(e,t)=>e.map(t),YM=e=>e.length>1,Ny=jl("Union"),e1=Jt(Symbol.for("effect/Schema/AST/toJSONMemoMap"),()=>new WeakMap);class nV{f;annotations;_tag="Suspend";constructor(t,n={}){this.f=t,this.annotations=n,this.f=AU(t)}toString(){return Aa(this).pipe(Tc(()=>ix(wU(this.f)(),t=>Aa(t))),Ln(()=>"<suspended schema>"))}toJSON(){const t=this.f();let n=e1.get(t);return n||(e1.set(t,{_tag:this._tag}),n={_tag:this._tag,ast:t.toJSON(),annotations:Fr(this.annotations)},e1.set(t,n),n)}}const QM=jl("Suspend");let rV=class{from;filter;annotations;_tag="Refinement";constructor(t,n,r={}){this.from=t,this.filter=n,this.annotations=r}toString(){return sx(this).pipe(Ln(()=>rr(lV(this),{onNone:()=>`{ ${this.from} | filter }`,onSome:t=>ud(this.from)?String(this.from)+" & "+t:t})))}toJSON(){return{_tag:this._tag,from:this.from.toJSON(),annotations:Fr(this.annotations)}}};const ud=jl("Refinement"),t1={};let hte=class{from;to;transformation;annotations;_tag="Transformation";constructor(t,n,r,i={}){this.from=t,this.to=n,this.transformation=r,this.annotations=i}toString(){return Ln(Aa(this),()=>`(${String(this.from)} <-> ${String(this.to)})`)}toJSON(){return{_tag:this._tag,from:this.from.toJSON(),to:this.to.toJSON(),annotations:Fr(this.annotations)}}};const XM=jl("Transformation");let pte=class{from;to;decode;encode;constructor(t,n,r,i){this.from=t,this.to=n,this.decode=r,this.encode=i}};class mte{propertySignatureTransformations;_tag="TypeLiteralTransformation";constructor(t){this.propertySignatureTransformations=t;const n={},r={};for(const i of t){const o=i.from;if(n[o])throw new Error(l$(o));n[o]=!0;const a=i.to;if(r[a])throw new Error(l$(a));r[a]=!0}}}const JM=(e,t)=>{const n=Object.getOwnPropertyDescriptors(e),r={...e.annotations};delete r[VM];const i={...r,...t},o=YU(e);return Ce(o)&&(i[KU]=JM(o.value,t)),n.annotations.value=i,Object.create(Object.getPrototypeOf(e),n)},gte="[\\s\\S]*?",yte="[+-]?\\d*\\.?\\d+(?:[Ee][+-]?\\d+)?",iV=(e,t)=>{switch(e._tag){case"Literal":return R0(String(e.literal));case"StringKeyword":return gte;case"NumberKeyword":return yte;case"TemplateLiteral":return oV(e);case"Union":return e.types.map(n=>iV(n)).join("|")}},bte=(e,t,n,r)=>Ny(e)?`(${t})`:t,oV=(e,t,n)=>{let r="";if(e.head!==""){const i=R0(e.head);r+=i}for(const i of e.spans){const o=iV(i.type);if(r+=bte(i.type,o),i.literal!==""){const a=R0(i.literal);r+=a}}return r},vte=e=>new RegExp(`^${oV(e)}$`),d$=(e,t)=>{const n=[],r=[],i=o=>{switch(o._tag){case"NeverKeyword":break;case"StringKeyword":case"SymbolKeyword":case"TemplateLiteral":case"Refinement":r.push(new lx(o,t,!0));break;case"Literal":if(Qs(o.literal)||ad(o.literal))n.push(new Ii(o.literal,t,!1,!0));else throw new Error(See(o.literal));break;case"Enums":{for(const[a,c]of o.enums)n.push(new Ii(c,t,!1,!0));break}case"UniqueSymbol":n.push(new Ii(o.symbol,t,!1,!0));break;case"Union":o.types.forEach(i);break;default:throw new Error(vee(o))}};return i(e),{propertySignatures:n,indexSignatures:r}},sV=e=>t=>{let n;for(const r of e)Object.prototype.hasOwnProperty.call(t.annotations,r)&&(n===void 0&&(n={}),n[r]=t.annotations[r]);return n},Ste=sV([PU,NU,LU,$U,jU,FU]),Bi=e=>{switch(e._tag){case"Declaration":{const t=hs(e.typeParameters,Bi);return t===e.typeParameters?e:new XU(t,e.decodeUnknown,e.encodeUnknown,e.annotations)}case"TupleType":{const t=hs(e.elements,i=>{const o=Bi(i.type);return o===i.type?i:new ip(o,i.isOptional)}),n=ZU(e.rest),r=hs(n,Bi);return t===e.elements&&r===n?e:new HM(t,r.map(i=>new ax(i)),e.isReadonly,e.annotations)}case"TypeLiteral":{const t=hs(e.propertySignatures,r=>{const i=Bi(r.type);return i===r.type?r:new Ii(r.name,i,r.isOptional,r.isReadonly)}),n=hs(e.indexSignatures,r=>{const i=Bi(r.type);return i===r.type?r:new lx(r.parameter,i,r.isReadonly)});return t===e.propertySignatures&&n===e.indexSignatures?e:new Qu(t,n,e.annotations)}case"Union":{const t=hs(e.types,Bi);return t===e.types?e:ma.make(t,e.annotations)}case"Suspend":return new nV(()=>Bi(e.f()),e.annotations);case"Refinement":{const t=Bi(e.from);return t===e.from?e:new rV(t,e.filter,e.annotations)}case"Transformation":{const t=Ste(e);return Bi(t!==void 0?JM(e.to,t):e.to)}}return e};function hs(e,t){let n=!1;const r=ox(e.length);for(let i=0;i<e.length;i++){const o=e[i],a=t(o);a!==o&&(n=!0),r[i]=a}return n?r:e}const fa=(e,t)=>{switch(e._tag){case"Declaration":{const n=hs(e.typeParameters,r=>fa(r));return n===e.typeParameters?e:new XU(n,e.decodeUnknown,e.encodeUnknown)}case"TupleType":{const n=hs(e.elements,o=>{const a=fa(o.type);return a===o.type?o:new ip(a,o.isOptional)}),r=ZU(e.rest),i=hs(r,o=>fa(o));return n===e.elements&&i===r?e:new HM(n,i.map(o=>new ax(o)),e.isReadonly)}case"TypeLiteral":{const n=hs(e.propertySignatures,i=>{const o=fa(i.type);return o===i.type?i:new Ii(i.name,o,i.isOptional,i.isReadonly)}),r=hs(e.indexSignatures,i=>{const o=fa(i.type);return o===i.type?i:new lx(i.parameter,o,i.isReadonly)});return n===e.propertySignatures&&r===e.indexSignatures?e:new Qu(n,r)}case"Union":{const n=hs(e.types,r=>fa(r));return n===e.types?e:ma.make(n)}case"Suspend":{let n;const r=Uee(e);return Ce(r)&&(n={[QU]:`${r.value}Encoded`}),new nV(()=>fa(e.f()),n)}case"Refinement":return fa(e.from);case"Transformation":return fa(e.from)}return e},f$=e=>fa(e),Fr=e=>{const t={};for(const n of Object.getOwnPropertySymbols(e))t[String(n)]=e[n];return t},aV=e=>{switch(e._tag){case"StringKeyword":case"SymbolKeyword":case"TemplateLiteral":return e;case"Refinement":return aV(e.from)}},Jc=e=>Ln(Aa(e),()=>e._tag);function wte(e){return rr(Oee(e),{onNone:()=>"",onSome:t=>t.map(n=>` & Brand<${Xc(n)}>`).join("")})}const lV=e=>HU(e).pipe(Tc(()=>GU(e)),Tc(()=>WU(e)),Gu(t=>t+wte(e))),Aa=e=>Tc(sx(e),()=>lV(e)),cV=Symbol.for("effect/Context/Tag"),O0=Symbol.for("effect/Context/Reference"),xte="effect/STM",kte=Symbol.for(xte),ZM={...Oy,_op:"Tag",[kte]:Th,[cV]:{_Service:e=>e,_Identifier:e=>e},toString(){return _r(this.toJSON())},toJSON(){return{_id:"Tag",key:this.key,stack:this.stack}},[$n](){return this.toJSON()},of(e){return e},context(e){return fV(this,e)}},_te={...ZM,[O0]:O0},Ite=e=>{const t=Error.stackTraceLimit;Error.stackTraceLimit=2;const n=new Error;Error.stackTraceLimit=t;const r=Object.create(ZM);return Object.defineProperty(r,"stack",{get(){return n.stack}}),r.key=e,r},Ete=e=>()=>{const t=Error.stackTraceLimit;Error.stackTraceLimit=2;const n=new Error;Error.stackTraceLimit=t;function r(){}return Object.setPrototypeOf(r,ZM),r.key=e,Object.defineProperty(r,"stack",{get(){return n.stack}}),r},Tte=()=>(e,t)=>{const n=Error.stackTraceLimit;Error.stackTraceLimit=2;const r=new Error;Error.stackTraceLimit=n;function i(){}return Object.setPrototypeOf(i,_te),i.key=e,i.defaultValue=t.defaultValue,Object.defineProperty(i,"stack",{get(){return r.stack}}),i},uV=Symbol.for("effect/Context"),Cte={[uV]:{_Services:e=>e},[Tt](e){if(dV(e)&&this.unsafeMap.size===e.unsafeMap.size){for(const t of this.unsafeMap.keys())if(!e.unsafeMap.has(t)||!bt(this.unsafeMap.get(t),e.unsafeMap.get(t)))return!1;return!0}return!1},[Ot](){return ir(this,DM(this.unsafeMap.size))},pipe(){return Xe(this,arguments)},toString(){return _r(this.toJSON())},toJSON(){return{_id:"Context",services:Array.from(this.unsafeMap).map(Yn)}},[$n](){return this.toJSON()}},dd=e=>{const t=Object.create(Cte);return t.unsafeMap=e,t},Mte=e=>{const t=new Error(`Service not found${e.key?`: ${String(e.key)}`:""}`);if(e.stack){const n=e.stack.split(`
12
+ `);if(n.length>2){const r=n[2].match(/at (.*)/);r&&(t.message=t.message+` (defined at ${r[1]})`)}}if(t.stack){const n=t.stack.split(`
13
+ `);n.splice(1,3),t.stack=n.join(`
14
+ `)}return t},dV=e=>ht(e,uV),Rte=e=>ht(e,cV),Ate=e=>ht(e,O0),Ote=dd(new Map),Dte=()=>Ote,fV=(e,t)=>dd(new Map([[e.key,t]])),Pte=G(3,(e,t,n)=>{const r=new Map(e.unsafeMap);return r.set(t.key,n),dd(r)}),n1=Jt("effect/Context/defaultValueCache",()=>new Map),eR=e=>{if(n1.has(e.key))return n1.get(e.key);const t=e.defaultValue();return n1.set(e.key,t),t},Nte=(e,t)=>e.unsafeMap.has(t.key)?e.unsafeMap.get(t.key):eR(t),hV=G(2,(e,t)=>{if(!e.unsafeMap.has(t.key)){if(O0 in t)return eR(t);throw Mte(t)}return e.unsafeMap.get(t.key)}),Lte=hV,$te=G(2,(e,t)=>e.unsafeMap.has(t.key)?YE(e.unsafeMap.get(t.key)):Ate(t)?YE(eR(t)):fU),jte=G(2,(e,t)=>{const n=new Map(e.unsafeMap);for(const[r,i]of t.unsafeMap)n.set(r,i);return dd(n)}),Fte=(...e)=>{const t=new Map;for(let n=0;n<e.length;n++)e[n].unsafeMap.forEach((r,i)=>{t.set(i,r)});return dd(t)},Go=Ite,zte=dV,Pc=Rte,Ly=Dte,cx=fV,kc=Pte,Oa=Lte,pV=hV,Ai=$te,_s=jte,Bte=Fte,Yt=Ete,ux=Tte,mV=Symbol.for("effect/Chunk");function qte(e,t,n,r,i){for(let o=t;o<Math.min(e.length,t+i);o++)n[r+o-t]=e[o];return n}const gV=[],Ute=e=>RM((t,n)=>t.length===n.length&&Ws(t).every((r,i)=>e(r,xa(n,i)))),Vte=Ute(bt),Kte={[mV]:{_A:e=>e},toString(){return _r(this.toJSON())},toJSON(){return{_id:"Chunk",values:Ws(this).map(Yn)}},[$n](){return this.toJSON()},[Tt](e){return tR(e)&&Vte(this,e)},[Ot](){return ir(this,Ay(Ws(this)))},[Symbol.iterator](){switch(this.backing._tag){case"IArray":return this.backing.array[Symbol.iterator]();case"IEmpty":return gV[Symbol.iterator]();default:return Ws(this)[Symbol.iterator]()}},pipe(){return Xe(this,arguments)}},lr=e=>{const t=Object.create(Kte);switch(t.backing=e,e._tag){case"IEmpty":{t.length=0,t.depth=0,t.left=t,t.right=t;break}case"IConcat":{t.length=e.left.length+e.right.length,t.depth=1+Math.max(e.left.depth,e.right.depth),t.left=e.left,t.right=e.right;break}case"IArray":{t.length=e.array.length,t.depth=0,t.left=Fs,t.right=Fs;break}case"ISingleton":{t.length=1,t.depth=0,t.left=Fs,t.right=Fs;break}case"ISlice":{t.length=e.length,t.depth=e.chunk.depth+1,t.left=Fs,t.right=Fs;break}}return t},tR=e=>ht(e,mV),Fs=lr({_tag:"IEmpty"}),hn=()=>Fs,r1=(...e)=>Gte(e),An=e=>lr({_tag:"ISingleton",a:e}),Da=e=>tR(e)?e:Xs(Kn(e)),ZE=(e,t,n)=>{switch(e.backing._tag){case"IArray":{qte(e.backing.array,0,t,n,e.length);break}case"IConcat":{ZE(e.left,t,n),ZE(e.right,t,n+e.left.length);break}case"ISingleton":{t[n]=e.backing.a;break}case"ISlice":{let r=0,i=n;for(;r<e.length;)t[i]=xa(e,r),r+=1,i+=1;break}}},Hte=e=>{switch(e.backing._tag){case"IEmpty":return gV;case"IArray":return e.backing.array;default:{const t=new Array(e.length);return ZE(e,t,0),e.backing={_tag:"IArray",array:t},e.left=Fs,e.right=Fs,e.depth=0,t}}},Ws=Hte,Wte=e=>{switch(e.backing._tag){case"IEmpty":case"ISingleton":return e;case"IArray":return lr({_tag:"IArray",array:r$(e.backing.array)});case"IConcat":return lr({_tag:"IConcat",left:kl(e.backing.right),right:kl(e.backing.left)});case"ISlice":return Xs(r$(Ws(e)))}},kl=Wte,yV=G(2,(e,t)=>t<0||t>=e.length?Oe():De(xa(e,t))),Xs=e=>e.length===0?hn():e.length===1?An(e[0]):lr({_tag:"IArray",array:e}),Gte=e=>Xs(e),xa=G(2,(e,t)=>{switch(e.backing._tag){case"IEmpty":throw new Error("Index out of bounds");case"ISingleton":{if(t!==0)throw new Error("Index out of bounds");return e.backing.a}case"IArray":{if(t>=e.length||t<0)throw new Error("Index out of bounds");return e.backing.array[t]}case"IConcat":return t<e.left.length?xa(e.left,t):xa(e.right,t-e.left.length);case"ISlice":return xa(e.backing.chunk,t+e.backing.offset)}}),Mh=G(2,(e,t)=>Yr(e,An(t))),ai=G(2,(e,t)=>Yr(An(t),e)),eT=G(2,(e,t)=>{if(t<=0)return Fs;if(t>=e.length)return e;switch(e.backing._tag){case"ISlice":return lr({_tag:"ISlice",chunk:e.backing.chunk,length:t,offset:e.backing.offset});case"IConcat":return t>e.left.length?lr({_tag:"IConcat",left:e.left,right:eT(e.right,t-e.left.length)}):eT(e.left,t);default:return lr({_tag:"ISlice",chunk:e,offset:0,length:t})}}),fd=G(2,(e,t)=>{if(t<=0)return e;if(t>=e.length)return Fs;switch(e.backing._tag){case"ISlice":return lr({_tag:"ISlice",chunk:e.backing.chunk,offset:e.backing.offset+t,length:e.backing.length-t});case"IConcat":return t>e.left.length?fd(e.right,t-e.left.length):lr({_tag:"IConcat",left:fd(e.left,t),right:e.right});default:return lr({_tag:"ISlice",chunk:e,offset:t,length:e.length-t})}}),Yr=G(2,(e,t)=>{if(e.backing._tag==="IEmpty")return t;if(t.backing._tag==="IEmpty")return e;const n=t.depth-e.depth;if(Math.abs(n)<=1)return lr({_tag:"IConcat",left:e,right:t});if(n<-1)if(e.left.depth>=e.right.depth){const r=Yr(e.right,t);return lr({_tag:"IConcat",left:e.left,right:r})}else{const r=Yr(e.right.right,t);if(r.depth===e.depth-3){const i=lr({_tag:"IConcat",left:e.right.left,right:r});return lr({_tag:"IConcat",left:e.left,right:i})}else{const i=lr({_tag:"IConcat",left:e.left,right:e.right.left});return lr({_tag:"IConcat",left:i,right:r})}}else if(t.right.depth>=t.left.depth){const r=Yr(e,t.left);return lr({_tag:"IConcat",left:r,right:t.right})}else{const r=Yr(e,t.left.left);if(r.depth===t.depth-3){const i=lr({_tag:"IConcat",left:r,right:t.left.right});return lr({_tag:"IConcat",left:i,right:t.right})}else{const i=lr({_tag:"IConcat",left:t.left.right,right:t.right});return lr({_tag:"IConcat",left:r,right:i})}}}),bV=G(2,(e,t)=>Xs(CU(e,t))),$y=G(2,(e,t)=>Xs(mee(e,t))),op=e=>e.length===0,_l=e=>e.length>0,dx=yV(0),nR=e=>xa(e,0),va=nR,Yte=e=>yV(e,e.length-1),vV=G(2,(e,t)=>e.backing._tag==="ISingleton"?An(t(e.backing.a,0)):Xs(Y(Ws(e),Yu((n,r)=>t(n,r))))),Qte=G(2,(e,t)=>[eT(e,t),fd(e,t)]),Xte=G(2,(e,t)=>{let n=0;for(const r of Ws(e)){if(t(r))break;n++}return Qte(e,n)}),pl=e=>fd(e,1),SV=BM,tT=Symbol.for("effect/Duration"),wV=BigInt(0),h$=BigInt(24),Vv=BigInt(60),nT=BigInt(1e3),p$=BigInt(1e6),m$=BigInt(1e9),Jte=/^(-?\d+(?:\.\d+)?)\s+(nanos?|micros?|millis?|seconds?|minutes?|hours?|days?|weeks?)$/,Ho=e=>{if(xV(e))return e;if(ad(e))return Il(e);if(ex(e))return i1(e);if(Array.isArray(e)&&e.length===2&&e.every(ad))return e[0]===-1/0||e[1]===-1/0||Number.isNaN(e[0])||Number.isNaN(e[1])?hd:e[0]===1/0||e[1]===1/0?rne:i1(BigInt(Math.round(e[0]*1e9))+BigInt(Math.round(e[1])));if(Qs(e)){const t=Jte.exec(e);if(t){const[n,r,i]=t,o=Number(r);switch(i){case"nano":case"nanos":return i1(BigInt(r));case"micro":case"micros":return ine(BigInt(r));case"milli":case"millis":return Il(o);case"second":case"seconds":return one(o);case"minute":case"minutes":return sne(o);case"hour":case"hours":return ane(o);case"day":case"days":return lne(o);case"week":case"weeks":return cne(o)}}}throw new Error("Invalid DurationInput")},Zte=wU(Ho),g$={_tag:"Millis",millis:0},ene={_tag:"Infinity"},tne={[tT]:tT,[Ot](){return ir(this,tU(this.value))},[Tt](e){return xV(e)&&bne(this,e)},toString(){return`Duration(${Sne(this)})`},toJSON(){switch(this.value._tag){case"Millis":return{_id:"Duration",_tag:"Millis",millis:this.value.millis};case"Nanos":return{_id:"Duration",_tag:"Nanos",hrtime:dne(this)};case"Infinity":return{_id:"Duration",_tag:"Infinity"}}},[$n](){return this.toJSON()},pipe(){return Xe(this,arguments)}},xs=e=>{const t=Object.create(tne);return ad(e)?isNaN(e)||e<=0?t.value=g$:Number.isFinite(e)?Number.isInteger(e)?t.value={_tag:"Millis",millis:e}:t.value={_tag:"Nanos",nanos:BigInt(Math.round(e*1e6))}:t.value=ene:e<=wV?t.value=g$:t.value={_tag:"Nanos",nanos:e},t},xV=e=>ht(e,tT),nne=e=>{switch(e.value._tag){case"Millis":return e.value.millis===0;case"Nanos":return e.value.nanos===wV;case"Infinity":return!1}},hd=xs(0),rne=xs(1/0),i1=e=>xs(e),ine=e=>xs(e*nT),Il=e=>xs(e),one=e=>xs(e*1e3),sne=e=>xs(e*6e4),ane=e=>xs(e*36e5),lne=e=>xs(e*864e5),cne=e=>xs(e*6048e5),pd=e=>fne(e,{onMillis:t=>t,onNanos:t=>Number(t)/1e6}),une=e=>{const t=Ho(e);switch(t.value._tag){case"Infinity":throw new Error("Cannot convert infinite duration to nanos");case"Nanos":return t.value.nanos;case"Millis":return BigInt(Math.round(t.value.millis*1e6))}},dne=e=>{const t=Ho(e);switch(t.value._tag){case"Infinity":return[1/0,0];case"Nanos":return[Number(t.value.nanos/m$),Number(t.value.nanos%m$)];case"Millis":return[Math.floor(t.value.millis/1e3),Math.round(t.value.millis%1e3*1e6)]}},fne=G(2,(e,t)=>{const n=Ho(e);switch(n.value._tag){case"Nanos":return t.onNanos(n.value.nanos);case"Infinity":return t.onMillis(1/0);case"Millis":return t.onMillis(n.value.millis)}}),jy=G(3,(e,t,n)=>{const r=Ho(e),i=Ho(t);if(r.value._tag==="Infinity"||i.value._tag==="Infinity")return n.onMillis(pd(r),pd(i));if(r.value._tag==="Nanos"||i.value._tag==="Nanos"){const o=r.value._tag==="Nanos"?r.value.nanos:BigInt(Math.round(r.value.millis*1e6)),a=i.value._tag==="Nanos"?i.value.nanos:BigInt(Math.round(i.value.millis*1e6));return n.onNanos(o,a)}return n.onMillis(r.value.millis,i.value.millis)}),hne=(e,t)=>jy(e,t,{onMillis:(n,r)=>n===r,onNanos:(n,r)=>n===r}),pne=G(2,(e,t)=>jy(e,t,{onMillis:(n,r)=>xs(n+r),onNanos:(n,r)=>xs(n+r)})),mne=G(2,(e,t)=>jy(e,t,{onMillis:(n,r)=>n<=r,onNanos:(n,r)=>n<=r})),gne=G(2,(e,t)=>jy(e,t,{onMillis:(n,r)=>n>r,onNanos:(n,r)=>n>r})),yne=G(2,(e,t)=>jy(e,t,{onMillis:(n,r)=>n>=r,onNanos:(n,r)=>n>=r})),bne=G(2,(e,t)=>hne(Ho(e),Ho(t))),vne=e=>{const t=Ho(e);if(t.value._tag==="Infinity")return{days:1/0,hours:1/0,minutes:1/0,seconds:1/0,millis:1/0,nanos:1/0};const n=une(t),r=n/p$,i=r/nT,o=i/Vv,a=o/Vv,c=a/h$;return{days:Number(c),hours:Number(a%h$),minutes:Number(o%Vv),seconds:Number(i%Vv),millis:Number(r%nT),nanos:Number(n%p$)}},Sne=e=>{const t=Ho(e);if(t.value._tag==="Infinity")return"Infinity";if(nne(t))return"0";const n=vne(t),r=[];return n.days!==0&&r.push(`${n.days}d`),n.hours!==0&&r.push(`${n.hours}h`),n.minutes!==0&&r.push(`${n.minutes}m`),n.seconds!==0&&r.push(`${n.seconds}s`),n.millis!==0&&r.push(`${n.millis}ms`),n.nanos!==0&&r.push(`${n.nanos}ns`),r.join(" ")},md=5,rR=Math.pow(2,md),wne=rR-1,xne=rR/2,kne=rR/4;function _ne(e){return e-=e>>1&1431655765,e=(e&858993459)+(e>>2&858993459),e=e+(e>>4)&252645135,e+=e>>8,e+=e>>16,e&127}function Rh(e,t){return t>>>e&wne}function eh(e){return 1<<e}function kV(e,t){return _ne(e&t-1)}const Ine=(e,t)=>({value:e,previous:t});function ch(e,t,n,r){let i=r;if(!e){const o=r.length;i=new Array(o);for(let a=0;a<o;++a)i[a]=r[a]}return i[t]=n,i}function _V(e,t,n){const r=n.length-1;let i=0,o=0,a=n;if(e)i=o=t;else for(a=new Array(r);i<t;)a[o++]=n[i++];for(++i;i<=r;)a[o++]=n[i++];return e&&(a.length=r),a}function Ene(e,t,n,r){const i=r.length;if(e){let u=i;for(;u>=t;)r[u--]=r[u];return r[t]=n,r}let o=0,a=0;const c=new Array(i+1);for(;o<t;)c[a++]=r[o++];for(c[t]=n;o<i;)c[++a]=r[o++];return c}class Nc{_tag="EmptyNode";modify(t,n,r,i,o,a){const c=r(Oe());return Zt(c)?new Nc:(++a.value,new Xu(t,i,o,c))}}function Ks(e){return Qq(e,"EmptyNode")}function Tne(e){return Ks(e)||e._tag==="LeafNode"||e._tag==="CollisionNode"}function fx(e,t){return Ks(e)?!1:t===e.edit}class Xu{edit;hash;key;value;_tag="LeafNode";constructor(t,n,r,i){this.edit=t,this.hash=n,this.key=r,this.value=i}modify(t,n,r,i,o,a){if(bt(o,this.key)){const u=r(this.value);return u===this.value?this:Zt(u)?(--a.value,new Nc):fx(this,t)?(this.value=u,this):new Xu(t,i,o,u)}const c=r(Oe());return Zt(c)?this:(++a.value,IV(t,n,this.hash,this,i,new Xu(t,i,o,c)))}}class iR{edit;hash;children;_tag="CollisionNode";constructor(t,n,r){this.edit=t,this.hash=n,this.children=r}modify(t,n,r,i,o,a){if(i===this.hash){const u=fx(this,t),d=this.updateCollisionList(u,t,this.hash,this.children,r,o,a);return d===this.children?this:d.length>1?new iR(t,this.hash,d):d[0]}const c=r(Oe());return Zt(c)?this:(++a.value,IV(t,n,this.hash,this,i,new Xu(t,i,o,c)))}updateCollisionList(t,n,r,i,o,a,c){const u=i.length;for(let h=0;h<u;++h){const p=i[h];if("key"in p&&bt(a,p.key)){const g=p.value,y=o(g);return y===g?i:Zt(y)?(--c.value,_V(t,h,i)):ch(t,h,new Xu(n,r,a,y),i)}}const d=o(Oe());return Zt(d)?i:(++c.value,ch(t,u,new Xu(n,r,a,d),i))}}class Ah{edit;mask;children;_tag="IndexedNode";constructor(t,n,r){this.edit=t,this.mask=n,this.children=r}modify(t,n,r,i,o,a){const c=this.mask,u=this.children,d=Rh(n,i),h=eh(d),p=kV(c,h),g=c&h,y=fx(this,t);if(!g){const I=new Nc().modify(t,n+md,r,i,o,a);return I?u.length>=xne?Mne(t,d,I,c,u):new Ah(t,c|h,Ene(y,p,I,u)):this}const b=u[p],S=b.modify(t,n+md,r,i,o,a);if(b===S)return this;let w=c,x;if(Ks(S)){if(w&=~h,!w)return new Nc;if(u.length<=2&&Tne(u[p^1]))return u[p^1];x=_V(y,p,u)}else x=ch(y,p,S,u);return y?(this.mask=w,this.children=x,this):new Ah(t,w,x)}}class oR{edit;size;children;_tag="ArrayNode";constructor(t,n,r){this.edit=t,this.size=n,this.children=r}modify(t,n,r,i,o,a){let c=this.size;const u=this.children,d=Rh(n,i),h=u[d],p=(h||new Nc).modify(t,n+md,r,i,o,a);if(h===p)return this;const g=fx(this,t);let y;if(Ks(h)&&!Ks(p))++c,y=ch(g,d,p,u);else if(!Ks(h)&&Ks(p)){if(--c,c<=kne)return Cne(t,c,d,u);y=ch(g,d,new Nc,u)}else y=ch(g,d,p,u);return g?(this.size=c,this.children=y,this):new oR(t,c,y)}}function Cne(e,t,n,r){const i=new Array(t-1);let o=0,a=0;for(let c=0,u=r.length;c<u;++c)if(c!==n){const d=r[c];d&&!Ks(d)&&(i[o++]=d,a|=1<<c)}return new Ah(e,a,i)}function Mne(e,t,n,r,i){const o=[];let a=r,c=0;for(let u=0;a;++u)a&1&&(o[u]=i[c++]),a>>>=1;return o[t]=n,new oR(e,c+1,o)}function Rne(e,t,n,r,i,o){if(n===i)return new iR(e,n,[o,r]);const a=Rh(t,n),c=Rh(t,i);if(a===c)return u=>new Ah(e,eh(a)|eh(c),[u]);{const u=a<c?[r,o]:[o,r];return new Ah(e,eh(a)|eh(c),u)}}function IV(e,t,n,r,i,o){let a,c=t;for(;;){const u=Rne(e,c,n,r,i,o);if(typeof u=="function")a=Ine(u,a),c=c+md;else{let d=u;for(;a!=null;)d=a.value(d),a=a.previous;return d}}}const EV="effect/HashMap",rT=Symbol.for(EV),Ane={[rT]:rT,[Symbol.iterator](){return new hx(this,(e,t)=>[e,t])},[Ot](){let e=tt(EV);for(const t of this)e^=Y(tt(t[0]),Wt(tt(t[1])));return ir(this,e)},[Tt](e){if(Pne(e)){if(e._size!==this._size)return!1;for(const t of this){const n=Y(e,aR(t[0],tt(t[0])));if(Zt(n))return!1;if(!bt(t[1],n.value))return!1}return!0}return!1},toString(){return _r(this.toJSON())},toJSON(){return{_id:"HashMap",values:Array.from(this).map(Yn)}},[$n](){return this.toJSON()},pipe(){return Xe(this,arguments)}},sR=(e,t,n,r)=>{const i=Object.create(Ane);return i._editable=e,i._edit=t,i._root=n,i._size=r,i};class hx{map;f;v;constructor(t,n){this.map=t,this.f=n,this.v=TV(this.map._root,this.f,void 0)}next(){if(Zt(this.v))return{done:!0,value:void 0};const t=this.v.value;return this.v=D0(t.cont),{done:!1,value:t.value}}[Symbol.iterator](){return new hx(this.map,this.f)}}const D0=e=>e?CV(e[0],e[1],e[2],e[3],e[4]):Oe(),TV=(e,t,n=void 0)=>{switch(e._tag){case"LeafNode":return Ce(e.value)?De({value:t(e.key,e.value.value),cont:n}):D0(n);case"CollisionNode":case"ArrayNode":case"IndexedNode":{const r=e.children;return CV(r.length,r,0,t,n)}default:return D0(n)}},CV=(e,t,n,r,i)=>{for(;n<e;){const o=t[n++];if(o&&!Ks(o))return TV(o,r,[e,t,n,r,i])}return D0(i)},One=sR(!1,0,new Nc,0),px=()=>One,Dne=e=>{const t=RV(px());for(const n of e)Lg(t,n[0],n[1]);return Fne(t)},Pne=e=>ht(e,rT),Nne=e=>e&&Ks(e._root),Lne=G(2,(e,t)=>aR(e,t,tt(t))),aR=G(3,(e,t,n)=>{let r=e._root,i=0;for(;;)switch(r._tag){case"LeafNode":return bt(t,r.key)?r.value:Oe();case"CollisionNode":{if(n===r.hash){const o=r.children;for(let a=0,c=o.length;a<c;++a){const u=o[a];if("key"in u&&bt(t,u.key))return u.value}}return Oe()}case"IndexedNode":{const o=Rh(i,n),a=eh(o);if(r.mask&a){r=r.children[kV(r.mask,a)],i+=md;break}return Oe()}case"ArrayNode":{if(r=r.children[Rh(i,n)],r){i+=md;break}return Oe()}default:return Oe()}}),$ne=G(2,(e,t)=>Ce(aR(e,t,tt(t)))),Lg=G(3,(e,t,n)=>lR(e,t,()=>De(n))),jne=G(3,(e,t,n)=>e._editable?(e._root=t,e._size=n,e):t===e._root?e:sR(e._editable,e._edit,t,n)),MV=e=>new hx(e,t=>t),P0=e=>e._size,RV=e=>sR(!0,e._edit+1,e._root,e._size),Fne=e=>(e._editable=!1,e),lR=G(3,(e,t,n)=>zne(e,t,tt(t),n)),zne=G(4,(e,t,n,r)=>{const i={value:e._size},o=e._root.modify(e._editable?e._edit:NaN,0,r,n,t,i);return Y(e,jne(o,i.value))}),y$=G(2,(e,t)=>lR(e,t,Oe)),Bne=G(2,(e,t)=>mx(e,px(),(n,r,i)=>Lg(n,i,t(r,i)))),qne=G(2,(e,t)=>mx(e,void 0,(n,r,i)=>t(r,i))),mx=G(3,(e,t,n)=>{const r=e._root;if(r._tag==="LeafNode")return Ce(r.value)?n(t,r.value.value,r.key):t;if(r._tag==="EmptyNode")return t;const i=[r.children];let o;for(;o=i.pop();)for(let a=0,c=o.length;a<c;){const u=o[a++];u&&!Ks(u)&&(u._tag==="LeafNode"?Ce(u.value)&&(t=n(t,u.value.value,u.key)):i.push(u.children))}return t}),AV="effect/HashSet",iT=Symbol.for(AV),Une={[iT]:iT,[Symbol.iterator](){return MV(this._keyMap)},[Ot](){return ir(this,Wt(tt(this._keyMap))(tt(AV)))},[Tt](e){return Vne(e)?P0(this._keyMap)===P0(e._keyMap)&&bt(this._keyMap,e._keyMap):!1},toString(){return _r(this.toJSON())},toJSON(){return{_id:"HashSet",values:Array.from(this).map(Yn)}},[$n](){return this.toJSON()},pipe(){return Xe(this,arguments)}},gx=e=>{const t=Object.create(Une);return t._keyMap=e,t},Vne=e=>ht(e,iT),Kne=gx(px()),yx=()=>Kne,Hne=e=>{const t=cR(yx());for(const n of e)$g(t,n);return uR(t)},Wne=(...e)=>{const t=cR(yx());for(const n of e)$g(t,n);return uR(t)},Gne=G(2,(e,t)=>$ne(e._keyMap,t)),Yne=e=>P0(e._keyMap),cR=e=>gx(RV(e._keyMap)),uR=e=>(e._keyMap._editable=!1,e),OV=G(2,(e,t)=>{const n=cR(e);return t(n),uR(n)}),$g=G(2,(e,t)=>e._keyMap._editable?(Lg(t,!0)(e._keyMap),e):gx(Lg(t,!0)(e._keyMap))),DV=G(2,(e,t)=>e._keyMap._editable?(y$(t)(e._keyMap),e):gx(y$(t)(e._keyMap))),Qne=G(2,(e,t)=>OV(e,n=>{for(const r of t)DV(n,r)})),Xne=G(2,(e,t)=>OV(yx(),n=>{Jne(e,r=>$g(n,r));for(const r of t)$g(n,r)})),Jne=G(2,(e,t)=>qne(e._keyMap,(n,r)=>t(r))),Zne=G(3,(e,t,n)=>mx(e._keyMap,t,(r,i,o)=>n(r,o))),gd=yx,ere=Hne,dR=Wne,tre=Gne,fR=Yne,uh=$g,hR=DV,b$=Qne,jg=Xne,Fg=Zne,v$=Symbol.for("effect/MutableRef"),nre={[v$]:v$,toString(){return _r(this.toJSON())},toJSON(){return{_id:"MutableRef",current:Yn(this.current)}},[$n](){return this.toJSON()},pipe(){return Xe(this,arguments)}},zd=e=>{const t=Object.create(nre);return t.current=e,t},rre=G(3,(e,t,n)=>bt(t,e.current)?(e.current=n,!0):!1),Vt=e=>e.current,Bd=G(2,(e,t)=>(e.current=t,e)),bx="effect/FiberId",yd=Symbol.for(bx),Oh="None",oT="Runtime",sT="Composite",ire=ur(`${bx}-${Oh}`);let ore=class{[yd]=yd;_tag=Oh;id=-1;startTimeMillis=-1;[Ot](){return ire}[Tt](t){return pR(t)&&t._tag===Oh}toString(){return _r(this.toJSON())}toJSON(){return{_id:"FiberId",_tag:this._tag}}[$n](){return this.toJSON()}};class sre{id;startTimeMillis;[yd]=yd;_tag=oT;constructor(t,n){this.id=t,this.startTimeMillis=n}[Ot](){return ir(this,ur(`${bx}-${this._tag}-${this.id}-${this.startTimeMillis}`))}[Tt](t){return pR(t)&&t._tag===oT&&this.id===t.id&&this.startTimeMillis===t.startTimeMillis}toString(){return _r(this.toJSON())}toJSON(){return{_id:"FiberId",_tag:this._tag,id:this.id,startTimeMillis:this.startTimeMillis}}[$n](){return this.toJSON()}}let are=class{left;right;[yd]=yd;_tag=sT;constructor(t,n){this.left=t,this.right=n}_hash;[Ot](){return Y(ur(`${bx}-${this._tag}`),Wt(tt(this.left)),Wt(tt(this.right)),ir(this))}[Tt](t){return pR(t)&&t._tag===sT&&bt(this.left,t.left)&&bt(this.right,t.right)}toString(){return _r(this.toJSON())}toJSON(){return{_id:"FiberId",_tag:this._tag,left:Yn(this.left),right:Yn(this.right)}}[$n](){return this.toJSON()}};const PV=new ore,pR=e=>ht(e,yd),NV=G(2,(e,t)=>e._tag===Oh?t:t._tag===Oh?e:new are(e,t)),lre=e=>Y(e,Fg(PV,(t,n)=>NV(n)(t))),aT=e=>{switch(e._tag){case Oh:return gd();case oT:return dR(e.id);case sT:return Y(aT(e.left),jg(aT(e.right)))}},S$=Jt(Symbol.for("effect/Fiber/Id/_fiberCounter"),()=>zd(0)),vx=e=>Array.from(aT(e)).map(n=>`#${n}`).join(","),cre=()=>{const e=Vt(S$);return Y(S$,Bd(e+1)),new sre(e,Date.now())},bd=PV,ure=NV,dre=lre,fre=vx,LV=cre,mR=px,hre=Dne,pre=Nne,$V=Lne,N0=Lg,jV=MV,FV=P0,mre=lR,gre=Bne,zV=mx,zg=Symbol.for("effect/List"),lT=e=>Kn(e),yre=e=>XJ(qM(e),lT),bre=yre(bt),vre={[zg]:zg,_tag:"Cons",toString(){return _r(this.toJSON())},toJSON(){return{_id:"List",_tag:"Cons",values:lT(this).map(Yn)}},[$n](){return this.toJSON()},[Tt](e){return qV(e)&&this._tag===e._tag&&bre(this,e)},[Ot](){return ir(this,Ay(lT(this)))},[Symbol.iterator](){let e=!1,t=this;return{next(){if(e)return this.return();if(t._tag==="Nil")return e=!0,this.return();const n=t.head;return t=t.tail,{done:e,value:n}},return(n){return e||(e=!0),{done:!0,value:n}}}},pipe(){return Xe(this,arguments)}},L0=(e,t)=>{const n=Object.create(vre);return n.head=e,n.tail=t,n},Sre=ur("Nil"),wre={[zg]:zg,_tag:"Nil",toString(){return _r(this.toJSON())},toJSON(){return{_id:"List",_tag:"Nil"}},[$n](){return this.toJSON()},[Ot](){return Sre},[Tt](e){return qV(e)&&this._tag===e._tag},[Symbol.iterator](){return{next(){return{done:!0,value:void 0}}}},pipe(){return Xe(this,arguments)}},BV=Object.create(wre),qV=e=>ht(e,zg),vl=e=>e._tag==="Nil",gR=e=>e._tag==="Cons",xre=()=>BV,vd=(e,t)=>L0(e,t),Dh=xre,yR=e=>L0(e,BV),kre=G(2,(e,t)=>Ire(t,e)),_re=G(2,(e,t)=>vd(t,e)),Ire=G(2,(e,t)=>{if(vl(e))return t;if(vl(t))return e;{const n=L0(t.head,e);let r=n,i=t.tail;for(;!vl(i);){const o=L0(i.head,e);r.tail=o,r=o,i=i.tail}return n}}),Ere=G(3,(e,t,n)=>{let r=t,i=e;for(;!vl(i);)r=n(r,i.head),i=i.tail;return r}),Tre=e=>{let t=Dh(),n=e;for(;!vl(n);)t=_re(t,n.head),n=n.tail;return t},bR=(function(){function e(t){t&&Object.assign(this,t)}return e.prototype=jM,e})(),Cre=Symbol.for("effect/DifferContextPatch");function w$(e){return e}const Fy={...bR.prototype,[Cre]:{_Value:w$,_Patch:w$}},Mre=Object.assign(Object.create(Fy),{_tag:"Empty"}),Rre=Object.create(Mre),UV=()=>Rre,Are=Object.assign(Object.create(Fy),{_tag:"AndThen"}),Ore=(e,t)=>{const n=Object.create(Are);return n.first=e,n.second=t,n},Dre=Object.assign(Object.create(Fy),{_tag:"AddService"}),Pre=(e,t)=>{const n=Object.create(Dre);return n.key=e,n.service=t,n},Nre=Object.assign(Object.create(Fy),{_tag:"RemoveService"}),Lre=e=>{const t=Object.create(Nre);return t.key=e,t},$re=Object.assign(Object.create(Fy),{_tag:"UpdateService"}),jre=(e,t)=>{const n=Object.create($re);return n.key=e,n.update=t,n},Fre=(e,t)=>{const n=new Map(e.unsafeMap);let r=UV();for(const[i,o]of t.unsafeMap.entries())if(n.has(i)){const a=n.get(i);n.delete(i),bt(a,o)||(r=KS(jre(i,()=>o))(r))}else n.delete(i),r=KS(Pre(i,o))(r);for(const[i]of n.entries())r=KS(Lre(i))(r);return r},KS=G(2,(e,t)=>Ore(e,t)),zre=G(2,(e,t)=>{if(e._tag==="Empty")return t;let n=!1,r=An(e);const i=new Map(t.unsafeMap);for(;_l(r);){const a=va(r),c=pl(r);switch(a._tag){case"Empty":{r=c;break}case"AddService":{i.set(a.key,a.service),r=c;break}case"AndThen":{r=ai(ai(c,a.second),a.first);break}case"RemoveService":{i.delete(a.key),r=c;break}case"UpdateService":{i.set(a.key,a.update(i.get(a.key))),n=!0,r=c;break}}}if(!n)return dd(i);const o=new Map;for(const[a]of t.unsafeMap)i.has(a)&&(o.set(a,i.get(a)),i.delete(a));for(const[a,c]of i)o.set(a,c);return dd(o)}),Bre=Symbol.for("effect/DifferHashSetPatch");function o1(e){return e}const Sx={...bR.prototype,[Bre]:{_Value:o1,_Key:o1,_Patch:o1}},qre=Object.assign(Object.create(Sx),{_tag:"Empty"}),Ure=Object.create(qre),VV=()=>Ure,Vre=Object.assign(Object.create(Sx),{_tag:"AndThen"}),Kre=(e,t)=>{const n=Object.create(Vre);return n.first=e,n.second=t,n},Hre=Object.assign(Object.create(Sx),{_tag:"Add"}),Wre=e=>{const t=Object.create(Hre);return t.value=e,t},Gre=Object.assign(Object.create(Sx),{_tag:"Remove"}),Yre=e=>{const t=Object.create(Gre);return t.value=e,t},Qre=(e,t)=>{const[n,r]=Fg([e,VV()],([i,o],a)=>tre(a)(i)?[hR(a)(i),o]:[i,cT(Wre(a))(o)])(t);return Fg(r,(i,o)=>cT(Yre(o))(i))(n)},cT=G(2,(e,t)=>Kre(e,t)),Xre=G(2,(e,t)=>{if(e._tag==="Empty")return t;let n=t,r=An(e);for(;_l(r);){const i=va(r),o=pl(r);switch(i._tag){case"Empty":{r=o;break}case"AndThen":{r=ai(i.first)(ai(i.second)(o));break}case"Add":{n=uh(i.value)(n),r=o;break}case"Remove":n=hR(i.value)(n),r=o}}return n}),Jre=Symbol.for("effect/DifferReadonlyArrayPatch");function x$(e){return e}const zy={...bR.prototype,[Jre]:{_Value:x$,_Patch:x$}},Zre=Object.assign(Object.create(zy),{_tag:"Empty"}),eie=Object.create(Zre),KV=()=>eie,tie=Object.assign(Object.create(zy),{_tag:"AndThen"}),nie=(e,t)=>{const n=Object.create(tie);return n.first=e,n.second=t,n},rie=Object.assign(Object.create(zy),{_tag:"Append"}),iie=e=>{const t=Object.create(rie);return t.values=e,t},oie=Object.assign(Object.create(zy),{_tag:"Slice"}),sie=(e,t)=>{const n=Object.create(oie);return n.from=e,n.until=t,n},aie=Object.assign(Object.create(zy),{_tag:"Update"}),lie=(e,t)=>{const n=Object.create(aie);return n.index=e,n.patch=t,n},cie=e=>{let t=0,n=KV();for(;t<e.oldValue.length&&t<e.newValue.length;){const r=e.oldValue[t],i=e.newValue[t],o=e.differ.diff(r,i);bt(o,e.differ.empty)||(n=HS(n,lie(t,o))),t=t+1}return t<e.oldValue.length&&(n=HS(n,sie(0,t))),t<e.newValue.length&&(n=HS(n,iie(cee(t)(e.newValue)))),n},HS=G(2,(e,t)=>nie(e,t)),uie=G(3,(e,t,n)=>{if(e._tag==="Empty")return t;let r=t.slice(),i=$s(e);for(;US(i);){const o=Qi(i),a=ld(i);switch(o._tag){case"Empty":{i=a;break}case"AndThen":{a.unshift(o.first,o.second),i=a;break}case"Append":{for(const c of o.values)r.push(c);i=a;break}case"Slice":{r=r.slice(o.from,o.until),i=a;break}case"Update":{r[o.index]=n.patch(o.patch,r[o.index]),i=a;break}}}return r}),die=Symbol.for("effect/Differ"),fie={[die]:{_P:Lt,_V:Lt},pipe(){return Xe(this,arguments)}},sp=e=>{const t=Object.create(fie);return t.empty=e.empty,t.diff=e.diff,t.combine=e.combine,t.patch=e.patch,t},hie=()=>sp({empty:UV(),combine:(e,t)=>KS(t)(e),diff:(e,t)=>Fre(e,t),patch:(e,t)=>zre(t)(e)}),pie=()=>sp({empty:VV(),combine:(e,t)=>cT(t)(e),diff:(e,t)=>Qre(e,t),patch:(e,t)=>Xre(t)(e)}),mie=e=>sp({empty:KV(),combine:(t,n)=>HS(t,n),diff:(t,n)=>cie({oldValue:t,newValue:n,differ:e}),patch:(t,n)=>uie(t,n,e)}),HV=()=>gie((e,t)=>t),gie=e=>sp({empty:Lt,combine:(t,n)=>t===Lt?n:n===Lt?t:r=>n(t(r)),diff:(t,n)=>bt(t,n)?Lt:Jw(n),patch:(t,n)=>e(n,t(n))}),Bg=255,WV=8,uT=e=>e&Bg,dT=e=>e>>WV&Bg,By=(e,t)=>(e&Bg)+((t&e&Bg)<<WV),yie=By(0,0),bie=e=>By(e,e),vie=e=>By(e,0),Sie=G(2,(e,t)=>By(uT(e)&~t,dT(e))),wie=G(2,(e,t)=>e|t),xie=e=>~e>>>0&Bg,kie=0,qd=1,_ie=2,GV=4,fT=16,YV=32,Iie=e=>wx(e,YV),Eie=G(2,(e,t)=>e&~t),Tie=G(2,(e,t)=>e|t),xc=e=>QV(e)&&!Mie(e),QV=e=>wx(e,qd),wx=G(2,(e,t)=>(e&t)!==0),XV=(...e)=>e.reduce((t,n)=>t|n,0),Cie=XV(kie),k$=e=>wx(e,GV),Mie=e=>wx(e,fT),Ju=G(2,(e,t)=>By(e^t,t)),dh=G(2,(e,t)=>e&(xie(uT(t))|dT(t))|uT(t)&dT(t)),_$=sp({empty:yie,diff:(e,t)=>Ju(e,t),combine:(e,t)=>wie(t)(e),patch:(e,t)=>dh(t,e)}),Rie=bie,JV=vie,I$=Sie,ZV=(e,t)=>({_tag:"Par",left:e,right:t}),Kv=(e,t)=>({_tag:"Seq",left:e,right:t}),Aie=e=>{let t=yR(e),n=Dh();for(;;){const[r,i]=Ere(t,[e4(),Dh()],([o,a],c)=>{const[u,d]=Oie(c);return[$ie(o,u),kre(a,d)]});if(n=Die(n,r),vl(i))return Tre(n);t=i}throw new Error("BUG: BlockedRequests.flatten - please report an issue at https://github.com/Effect-TS/effect/issues")},Oie=e=>{let t=e,n=e4(),r=Dh(),i=Dh();for(;;)switch(t._tag){case"Empty":{if(vl(r))return[n,i];t=r.head,r=r.tail;break}case"Par":{r=vd(t.right,r),t=t.left;break}case"Seq":{const o=t.left,a=t.right;switch(o._tag){case"Empty":{t=a;break}case"Par":{const c=o.left,u=o.right;t=ZV(Kv(c,a),Kv(u,a));break}case"Seq":{const c=o.left,u=o.right;t=Kv(c,Kv(u,a));break}case"Single":{t=o,i=vd(a,i);break}}break}case"Single":{if(n=Lie(n,t),vl(r))return[n,i];t=r.head,r=r.tail;break}}throw new Error("BUG: BlockedRequests.step - please report an issue at https://github.com/Effect-TS/effect/issues")},Die=(e,t)=>{if(vl(e))return yR(s1(t));if(jie(t))return e;const n=Vie(e.head),r=Fie(t);return n.length===1&&r.length===1&&bt(n[0],r[0])?vd(Uie(e.head,s1(t)),e.tail):vd(s1(t),e)},Pie=Symbol.for("effect/RequestBlock/RequestBlockParallel"),Nie={_R:e=>e};class vR{map;[Pie]=Nie;constructor(t){this.map=t}}const e4=()=>new vR(mR()),Lie=(e,t)=>new vR(mre(e.map,t.dataSource,n=>KZ(Gu(n,Mh(t.blockedRequest)),()=>An(t.blockedRequest)))),$ie=(e,t)=>new vR(zV(e.map,t.map,(n,r,i)=>N0(n,i,rr($V(n,i),{onNone:()=>r,onSome:o=>Yr(r,o)})))),jie=e=>pre(e.map),Fie=e=>Array.from(jV(e.map)),s1=e=>qie(gre(e.map,t=>An(t))),zie=Symbol.for("effect/RequestBlock/RequestBlockSequential"),Bie={_R:e=>e};class t4{map;[zie]=Bie;constructor(t){this.map=t}}const qie=e=>new t4(e),Uie=(e,t)=>new t4(zV(t.map,e.map,(n,r,i)=>N0(n,i,rr($V(n,i),{onNone:()=>hn(),onSome:o=>Yr(o,r)})))),Vie=e=>Array.from(jV(e.map)),Kie=e=>Array.from(e.map),Ud="Die",Sd="Empty",Vd="Fail",ap="Interrupt",Ph="Parallel",Nh="Sequential",n4="effect/Cause",r4=Symbol.for(n4),Hie={_E:e=>e},lp={[r4]:Hie,[Ot](){return Y(tt(n4),Wt(tt(noe(this))),ir(this))},[Tt](e){return i4(e)&&toe(this,e)},pipe(){return Xe(this,arguments)},toJSON(){switch(this._tag){case"Empty":return{_id:"Cause",_tag:this._tag};case"Die":return{_id:"Cause",_tag:this._tag,defect:Yn(this.defect)};case"Interrupt":return{_id:"Cause",_tag:this._tag,fiberId:this.fiberId.toJSON()};case"Fail":return{_id:"Cause",_tag:this._tag,failure:Yn(this.error)};case"Sequential":case"Parallel":return{_id:"Cause",_tag:this._tag,left:Yn(this.left),right:Yn(this.right)}}},toString(){return Zc(this)},[$n](){return this.toJSON()}},El=(()=>{const e=Object.create(lp);return e._tag=Sd,e})(),Lc=e=>{const t=Object.create(lp);return t._tag=Vd,t.error=e,t},qo=e=>{const t=Object.create(lp);return t._tag=Ud,t.defect=e,t},ms=e=>{const t=Object.create(lp);return t._tag=ap,t.fiberId=e,t},$c=(e,t)=>{const n=Object.create(lp);return n._tag=Ph,n.left=e,n.right=t,n},ni=(e,t)=>{const n=Object.create(lp);return n._tag=Nh,n.left=e,n.right=t,n},i4=e=>ht(e,r4),Wie=e=>e._tag===Sd,Gie=e=>e._tag===Vd,o4=e=>e._tag===Ud,SR=e=>e._tag===Sd?!0:Lh(e,!0,(t,n)=>{switch(n._tag){case Sd:return De(t);case Ud:case Vd:case ap:return De(!1);default:return Oe()}}),s4=e=>Ce(Xie(e)),xx=e=>wR(void 0,ioe)(e),a4=e=>kl(Lh(e,hn(),(t,n)=>n._tag===Vd?De(Y(t,ai(n.error))):Oe())),l4=e=>kl(Lh(e,hn(),(t,n)=>n._tag===Ud?De(Y(t,ai(n.defect))):Oe())),c4=e=>Lh(e,gd(),(t,n)=>n._tag===ap?De(Y(t,uh(n.fiberId))):Oe()),u4=e=>kx(e,t=>t._tag===Vd?De(t.error):Oe()),d4=e=>{const t=u4(e);switch(t._tag){case"None":return St(e);case"Some":return gt(t.value)}},Yie=e=>kx(e,t=>t._tag===Ud?De(t.defect):Oe()),Qie=e=>_x(e,{onEmpty:De(El),onFail:Gu(Lc),onDie:t=>De(qo(t)),onInterrupt:t=>De(ms(t)),onSequential:n$(ni),onParallel:n$($c)}),Xie=e=>kx(e,t=>t._tag===ap?De(t.fiberId):Oe()),E$=e=>_x(e,{onEmpty:El,onFail:()=>El,onDie:qo,onInterrupt:ms,onSequential:ni,onParallel:$c}),Jie=e=>_x(e,{onEmpty:El,onFail:qo,onDie:qo,onInterrupt:ms,onSequential:ni,onParallel:$c}),Zie=G(2,(e,t)=>eoe(e,n=>Lc(t(n)))),eoe=G(2,(e,t)=>_x(e,{onEmpty:El,onFail:n=>t(n),onDie:n=>qo(n),onInterrupt:n=>ms(n),onSequential:(n,r)=>ni(n,r),onParallel:(n,r)=>$c(n,r)})),toe=(e,t)=>{let n=An(e),r=An(t);for(;_l(n)&&_l(r);){const[i,o]=Y(va(n),Lh([gd(),hn()],([u,d],h)=>{const[p,g]=hT(h);return De([Y(u,jg(p)),Y(d,Yr(g))])})),[a,c]=Y(va(r),Lh([gd(),hn()],([u,d],h)=>{const[p,g]=hT(h);return De([Y(u,jg(p)),Y(d,Yr(g))])}));if(!bt(i,a))return!1;n=o,r=c}return!0},noe=e=>roe(An(e),hn()),roe=(e,t)=>{for(;;){const[n,r]=Y(e,BM([gd(),hn()],([o,a],c)=>{const[u,d]=hT(c);return[Y(o,jg(u)),Y(a,Yr(d))]})),i=fR(n)>0?Y(t,ai(n)):t;if(op(r))return kl(i);e=r,t=i}throw new Error(tx("Cause.flattenCauseLoop"))},kx=G(2,(e,t)=>{const n=[e];for(;n.length>0;){const r=n.pop(),i=t(r);switch(i._tag){case"None":{switch(r._tag){case Nh:case Ph:{n.push(r.right),n.push(r.left);break}}break}case"Some":return i}}return Oe()}),hT=e=>{let t=e;const n=[];let r=gd(),i=hn();for(;t!==void 0;)switch(t._tag){case Sd:{if(n.length===0)return[r,i];t=n.pop();break}case Vd:{if(r=uh(r,r1(t._tag,t.error)),n.length===0)return[r,i];t=n.pop();break}case Ud:{if(r=uh(r,r1(t._tag,t.defect)),n.length===0)return[r,i];t=n.pop();break}case ap:{if(r=uh(r,r1(t._tag,t.fiberId)),n.length===0)return[r,i];t=n.pop();break}case Nh:{switch(t.left._tag){case Sd:{t=t.right;break}case Nh:{t=ni(t.left.left,ni(t.left.right,t.right));break}case Ph:{t=$c(ni(t.left.left,t.right),ni(t.left.right,t.right));break}default:{i=ai(i,t.right),t=t.left;break}}break}case Ph:{n.push(t.right),t=t.left;break}}throw new Error(tx("Cause.evaluateCauseLoop"))},ioe={emptyCase:HE,failCase:lh,dieCase:lh,interruptCase:HE,sequentialCase:(e,t,n)=>t&&n,parallelCase:(e,t,n)=>t&&n},T$="SequentialCase",C$="ParallelCase",_x=G(2,(e,{onDie:t,onEmpty:n,onFail:r,onInterrupt:i,onParallel:o,onSequential:a})=>wR(e,void 0,{emptyCase:()=>n,failCase:(c,u)=>r(u),dieCase:(c,u)=>t(u),interruptCase:(c,u)=>i(u),sequentialCase:(c,u,d)=>a(u,d),parallelCase:(c,u,d)=>o(u,d)})),Lh=G(3,(e,t,n)=>{let r=t,i=e;const o=[];for(;i!==void 0;){const a=n(r,i);switch(r=Ce(a)?a.value:r,i._tag){case Nh:{o.push(i.right),i=i.left;break}case Ph:{o.push(i.right),i=i.left;break}default:{i=void 0;break}}i===void 0&&o.length>0&&(i=o.pop())}return r}),wR=G(3,(e,t,n)=>{const r=[e],i=[];for(;r.length>0;){const a=r.pop();switch(a._tag){case Sd:{i.push(St(n.emptyCase(t)));break}case Vd:{i.push(St(n.failCase(t,a.error)));break}case Ud:{i.push(St(n.dieCase(t,a.defect)));break}case ap:{i.push(St(n.interruptCase(t,a.fiberId)));break}case Nh:{r.push(a.right),r.push(a.left),i.push(gt({_tag:T$}));break}case Ph:{r.push(a.right),r.push(a.left),i.push(gt({_tag:C$}));break}}}const o=[];for(;i.length>0;){const a=i.pop();switch(a._tag){case"Left":{switch(a.left._tag){case T$:{const c=o.pop(),u=o.pop(),d=n.sequentialCase(t,c,u);o.push(d);break}case C$:{const c=o.pop(),u=o.pop(),d=n.parallelCase(t,c,u);o.push(d);break}}break}case"Right":{o.push(a.right);break}}}if(o.length===0)throw new Error("BUG: Cause.reduceWithContext - please report an issue at https://github.com/Effect-TS/effect/issues");return o.pop()}),Zc=(e,t)=>xx(e)?"All fibers interrupted without errors.":h4(e).map(function(n){return t?.renderErrorCause!==!0||n.cause===void 0?n.stack:`${n.stack} {
15
+ ${f4(n.cause," ")}
16
+ }`}).join(`
17
+ `),f4=(e,t)=>{const n=e.stack.split(`
18
+ `);let r=`${t}[cause]: ${n[0]}`;for(let i=1,o=n.length;i<o;i++)r+=`
19
+ ${t}${n[i]}`;return e.cause&&(r+=` {
20
+ ${f4(e.cause,`${t} `)}
21
+ ${t}}`),r};class $0 extends globalThis.Error{span=void 0;constructor(t){const n=typeof t=="object"&&t!==null,r=Error.stackTraceLimit;Error.stackTraceLimit=1,super(ooe(t),n&&"cause"in t&&typeof t.cause<"u"?{cause:new $0(t.cause)}:void 0),this.message===""&&(this.message="An error has occurred"),Error.stackTraceLimit=r,this.name=t instanceof Error?t.name:"Error",n&&($h in t&&(this.span=t[$h]),Object.keys(t).forEach(i=>{i in this||(this[i]=t[i])})),this.stack=loe(`${this.name}: ${this.message}`,t instanceof Error&&t.stack?t.stack:"",this.span)}}const ooe=e=>{if(typeof e=="string")return e;if(typeof e=="object"&&e!==null&&e instanceof Error)return e.message;try{if(ht(e,"toString")&&My(e.toString)&&e.toString!==Object.prototype.toString&&e.toString!==globalThis.Array.prototype.toString)return e.toString()}catch{}return rU(e)},soe=/\((.*)\)/g,aoe=Jt("effect/Tracer/spanToTrace",()=>new WeakMap),loe=(e,t,n)=>{const r=[e],i=t.startsWith(e)?t.slice(e.length).split(`
22
+ `):t.split(`
23
+ `);for(let o=1;o<i.length;o++){if(i[o].includes(" at new BaseEffectError")||i[o].includes(" at new YieldableError")){o++;continue}if(i[o].includes("Generator.next")||i[o].includes("effect_internal_function"))break;r.push(i[o].replace(/at .*effect_instruction_i.*\((.*)\)/,"at $1").replace(/EffectPrimitive\.\w+/,"<anonymous>"))}if(n){let o=n,a=0;for(;o&&o._tag==="Span"&&a<10;){const c=aoe.get(o);if(typeof c=="function"){const u=c();if(typeof u=="string"){const d=u.matchAll(soe);let h=!1;for(const[,p]of d)h=!0,r.push(` at ${o.name} (${p})`);h||r.push(` at ${o.name} (${u.replace(/^at /,"")})`)}else r.push(` at ${o.name}`)}else r.push(` at ${o.name}`);o=Ti(o.parent),a++}}return r.join(`
24
+ `)},$h=Symbol.for("effect/SpanAnnotation"),h4=e=>wR(e,void 0,{emptyCase:()=>[],dieCase:(t,n)=>[new $0(n)],failCase:(t,n)=>[new $0(n)],interruptCase:()=>[],parallelCase:(t,n,r)=>[...n,...r],sequentialCase:(t,n,r)=>[...n,...r]}),qy="Pending",Ix="Done",coe="effect/Deferred",uoe=Symbol.for(coe),doe={_E:e=>e,_A:e=>e},foe=e=>({_tag:qy,joiners:e}),p4=e=>({_tag:Ix,effect:e});class Uy{self;called=!1;constructor(t){this.self=t}next(t){return this.called?{value:t,done:!0}:(this.called=!0,{value:this.self,done:!1})}return(t){return{value:t,done:!0}}throw(t){throw t}[Symbol.iterator](){return new Uy(this.self)}}const m4=(e,t)=>{const n=new zr("Blocked");return n.effect_instruction_i0=e,n.effect_instruction_i1=t,n},hoe=e=>{const t=new zr("RunBlocked");return t.effect_instruction_i0=e,t},jh=Symbol.for("effect/Effect");class poe{patch;op;_op=LM;constructor(t,n){this.patch=t,this.op=n}}class zr{_op;effect_instruction_i0=void 0;effect_instruction_i1=void 0;effect_instruction_i2=void 0;trace=void 0;[jh]=Th;constructor(t){this._op=t}[Tt](t){return this===t}[Ot](){return ir(this,OM(this))}pipe(){return Xe(this,arguments)}toJSON(){return{_id:"Effect",_op:this._op,effect_instruction_i0:Yn(this.effect_instruction_i0),effect_instruction_i1:Yn(this.effect_instruction_i1),effect_instruction_i2:Yn(this.effect_instruction_i2)}}toString(){return _r(this.toJSON())}[$n](){return this.toJSON()}[Symbol.iterator](){return new Uy(new Ry(this))}}class g4{_op;effect_instruction_i0=void 0;effect_instruction_i1=void 0;effect_instruction_i2=void 0;trace=void 0;[jh]=Th;constructor(t){this._op=t,this._tag=t}[Tt](t){return Ox(t)&&t._op==="Failure"&&bt(this.effect_instruction_i0,t.effect_instruction_i0)}[Ot](){return Y(ur(this._tag),Wt(tt(this.effect_instruction_i0)),ir(this))}get cause(){return this.effect_instruction_i0}pipe(){return Xe(this,arguments)}toJSON(){return{_id:"Exit",_tag:this._op,cause:this.cause.toJSON()}}toString(){return _r(this.toJSON())}[$n](){return this.toJSON()}[Symbol.iterator](){return new Uy(new Ry(this))}}class y4{_op;effect_instruction_i0=void 0;effect_instruction_i1=void 0;effect_instruction_i2=void 0;trace=void 0;[jh]=Th;constructor(t){this._op=t,this._tag=t}[Tt](t){return Ox(t)&&t._op==="Success"&&bt(this.effect_instruction_i0,t.effect_instruction_i0)}[Ot](){return Y(ur(this._tag),Wt(tt(this.effect_instruction_i0)),ir(this))}get value(){return this.effect_instruction_i0}pipe(){return Xe(this,arguments)}toJSON(){return{_id:"Exit",_tag:this._op,value:Yn(this.value)}}toString(){return _r(this.toJSON())}[$n](){return this.toJSON()}[Symbol.iterator](){return new Uy(new Ry(this))}}const $a=e=>ht(e,jh),Bt=e=>{const t=new zr(sU);return t.effect_instruction_i0=e,t},b4=G(3,(e,t,n)=>ks(r=>ke(e,i=>ke(ka(mt(()=>r(t(i)))),o=>mt(()=>n(i,o)).pipe(Wo({onFailure:a=>{switch(o._tag){case oi:return Er(ni(o.effect_instruction_i0,a));case si:return Er(a)}},onSuccess:()=>o})))))),li=G(2,(e,t)=>ke(e,()=>Re(t))),Ni=e=>li(e,void 0),v4=function(){const e=new zr(rx);switch(arguments.length){case 2:{e.effect_instruction_i0=arguments[0],e.commit=arguments[1];break}case 3:{e.effect_instruction_i0=arguments[0],e.effect_instruction_i1=arguments[1],e.commit=arguments[2];break}case 4:{e.effect_instruction_i0=arguments[0],e.effect_instruction_i1=arguments[1],e.effect_instruction_i2=arguments[2],e.commit=arguments[3];break}default:throw new Error(tx("you're not supposed to end up here"))}return e},j0=(e,t=bd)=>{const n=new zr(hg);let r;return n.effect_instruction_i0=i=>{r=e(i)},n.effect_instruction_i1=t,up(n,i=>$a(r)?r:bn)},S4=(e,t=bd)=>mt(()=>j0(e,t)),Js=(e,t=bd)=>v4(e,function(){let n,r;function i(u){n?n(u):r===void 0&&(r=u)}const o=new zr(hg);o.effect_instruction_i0=u=>{n=u,r&&u(r)},o.effect_instruction_i1=t;let a,c;return this.effect_instruction_i0.length!==1?(c=new AbortController,a=Ui(()=>this.effect_instruction_i0(i,c.signal))):a=Ui(()=>this.effect_instruction_i0(i)),a||c?up(o,u=>(c&&c.abort(),a??bn)):o}),w4=G(2,(e,t)=>{const n=new zr(BS);return n.effect_instruction_i0=e,n.effect_instruction_i1=t,n}),qg=G(2,(e,t)=>Tl(e,{onFailure:t,onSuccess:Re})),M$=Symbol.for("effect/OriginalAnnotation"),xR=(e,t)=>Ce(t)?new Proxy(e,{has(n,r){return r===$h||r===M$||r in n},get(n,r){return r===$h?t.value:r===M$?e:n[r]}}):e,Sa=e=>$l(e)&&!($h in e)?Bt(t=>Er(qo(xR(e,MR(t))))):Er(qo(e)),x4=e=>k4(()=>qo(new zoe(e))),Fh=e=>Tl(e,{onFailure:t=>Re(gt(t)),onSuccess:t=>Re(St(t))}),ka=e=>_4(e,{onFailure:un,onSuccess:dr}),Lr=e=>$l(e)&&!($h in e)?Bt(t=>Er(Lc(xR(e,MR(t))))):Er(Lc(e)),Vy=e=>ke(Te(e),Lr),Er=e=>{const t=new g4(oi);return t.effect_instruction_i0=e,t},k4=e=>ke(Te(e),Er),Ky=Bt(e=>Re(e.id())),cp=e=>Bt(t=>e(t.id())),ke=G(2,(e,t)=>{const n=new zr(E0);return n.effect_instruction_i0=e,n.effect_instruction_i1=t,n}),moe=e=>{const t=new zr("OnStep");return t.effect_instruction_i0=e,t},Kd=e=>ke(e,Lt),_4=G(2,(e,t)=>Wo(e,{onFailure:n=>Re(t.onFailure(n)),onSuccess:n=>Re(t.onSuccess(n))})),Wo=G(2,(e,t)=>{const n=new zr(T0);return n.effect_instruction_i0=e,n.effect_instruction_i1=t.onFailure,n.effect_instruction_i2=t.onSuccess,n}),Tl=G(2,(e,t)=>Wo(e,{onFailure:n=>{if(l4(n).length>0)return Er(Jie(n));const i=a4(n);return i.length>0?t.onFailure(nR(i)):Er(n)},onSuccess:t.onSuccess})),ml=G(2,(e,t)=>mt(()=>{const n=Kn(e),r=ox(n.length);let i=0;return li(kR({while:()=>i<n.length,body:()=>t(n[i],i),step:o=>{r[i++]=o}}),r)})),Ex=G(2,(e,t)=>mt(()=>{const n=Kn(e);let r=0;return kR({while:()=>r<n.length,body:()=>t(n[r],r),step:()=>{r++}})})),Hr=ke(Ky,e=>I4(e)),I4=e=>Er(ms(e)),Tx=e=>{const t=new zr(np);return t.effect_instruction_i0=Rie(qd),t.effect_instruction_i1=()=>e,t},goe=G(2,(e,t)=>ks(n=>ke(ka(n(e)),r=>Zoe(t,r)))),ft=G(2,(e,t)=>ke(e,n=>Te(()=>t(n)))),E4=G(2,(e,t)=>Tl(e,{onFailure:n=>Vy(()=>t.onFailure(n)),onSuccess:n=>Te(()=>t.onSuccess(n))})),Cx=G(2,(e,t)=>Wo(e,{onFailure:n=>{const r=d4(n);switch(r._tag){case"Left":return Vy(()=>t(r.left));case"Right":return Er(r.right)}},onSuccess:Re})),wd=G(2,(e,t)=>ks(n=>Wo(n(e),{onFailure:r=>{const i=un(r);return Wo(t(i),{onFailure:o=>un(ni(r,o)),onSuccess:()=>i})},onSuccess:r=>{const i=dr(r);return Wr(t(i),i)}}))),up=G(2,(e,t)=>wd(e,Dx({onFailure:n=>xx(n)?Ni(t(c4(n))):bn,onSuccess:()=>bn}))),T4=e=>yoe(e,Lt),yoe=G(2,(e,t)=>Tl(e,{onFailure:n=>Sa(t(n)),onSuccess:Re})),Re=e=>{const t=new y4(si);return t.effect_instruction_i0=e,t},mt=e=>{const t=new zr(rx);return t.commit=e,t},Te=e=>{const t=new zr(oU);return t.effect_instruction_i0=e,t},Hy=G(e=>e.length===3||e.length===2&&!($l(e[1])&&"onlyEffect"in e[1]),(e,t)=>ke(e,n=>{const r=typeof t=="function"?t(n):t;return $a(r)?li(r,n):iZ(r)?j0(i=>{r.then(o=>i(Re(n)),o=>i(Lr(new z4(o,"An unknown error occurred in Effect.tap"))))}):Re(n)})),boe=e=>Bt(t=>{const n=t.getFiberRef(gT),r=Y(n,Ln(()=>t.scope()));return e(dp(gT,De(r)))}),Hd=e=>{const t=new zr(np);return t.effect_instruction_i0=JV(qd),t.effect_instruction_i1=()=>e,t},ks=e=>v4(e,function(){const t=new zr(np);return t.effect_instruction_i0=JV(qd),t.effect_instruction_i1=n=>QV(n)?Ui(()=>this.effect_instruction_i0(Tx)):Ui(()=>this.effect_instruction_i0(Hd)),t}),bn=Re(void 0),voe=e=>{const t=new zr(np);return t.effect_instruction_i0=e,t.effect_instruction_i1=void 0,t},Mx=G(2,(e,t)=>ke(t,n=>n?Y(e,ft(De)):Re(Oe()))),kR=e=>{const t=new zr(C0);return t.effect_instruction_i0=e.while,t.effect_instruction_i1=e.body,t.effect_instruction_i2=e.step,t},pT=e=>mt(()=>{const t=new zr(pg);return t.effect_instruction_i0=e(),t}),C4=function(){const e=arguments.length===1?arguments[0]:arguments[1].bind(arguments[0]);return pT(()=>e(Y))},Soe=(e,...t)=>Object.defineProperty(t.length===0?function(...n){return pT(()=>e.apply(this,n))}:function(...n){let r=pT(()=>e.apply(this,n));for(const i of t)r=i(r,...n);return r},"length",{value:e.length,configurable:!0}),woe=G(2,(e,t)=>{const n=new zr(np);return n.effect_instruction_i0=t,n.effect_instruction_i1=()=>e,n}),Wy=e=>{const t=new zr(qS);return typeof e?.priority<"u"?Noe(t,e.priority):t},M4=G(2,(e,t)=>ke(e,n=>ft(t,r=>[n,r]))),Rx=G(2,(e,t)=>ke(e,n=>li(t,n))),Wr=G(2,(e,t)=>ke(e,()=>t)),R4=G(3,(e,t,n)=>ke(e,r=>ft(t,i=>n(r,i)))),Ax=e=>ke(Ky,t=>Y(e,gl(t))),gl=G(2,(e,t)=>ke(e.interruptAsFork(t),()=>e.await)),xoe={_tag:"All",syslog:0,label:"ALL",ordinal:Number.MIN_SAFE_INTEGER,pipe(){return Xe(this,arguments)}},koe={_tag:"Fatal",syslog:2,label:"FATAL",ordinal:5e4,pipe(){return Xe(this,arguments)}},_oe={_tag:"Error",syslog:3,label:"ERROR",ordinal:4e4,pipe(){return Xe(this,arguments)}},A4={_tag:"Warning",syslog:4,label:"WARN",ordinal:3e4,pipe(){return Xe(this,arguments)}},O4={_tag:"Info",syslog:6,label:"INFO",ordinal:2e4,pipe(){return Xe(this,arguments)}},D4={_tag:"Debug",syslog:7,label:"DEBUG",ordinal:1e4,pipe(){return Xe(this,arguments)}},Ioe={_tag:"Trace",syslog:7,label:"TRACE",ordinal:0,pipe(){return Xe(this,arguments)}},Eoe={_tag:"None",syslog:7,label:"OFF",ordinal:Number.MAX_SAFE_INTEGER,pipe(){return Xe(this,arguments)}},Toe="effect/FiberRef",Coe=Symbol.for(Toe),Moe={_A:e=>e},Gy=e=>Bt(t=>dr(t.getFiberRef(e))),Yy=G(2,(e,t)=>ke(Gy(e),t)),F0=G(2,(e,t)=>Roe(e,()=>[void 0,t])),Roe=G(2,(e,t)=>Bt(n=>{const[r,i]=t(n.getFiberRef(e));return n.setFiberRef(e,i),Re(r)})),dp=G(3,(e,t,n)=>b4(Rx(Gy(t),F0(t,n)),()=>e,r=>F0(t,r))),P4=G(3,(e,t,n)=>Yy(t,r=>dp(e,t,n(r)))),Zi=(e,t)=>fp(e,{differ:HV(),fork:t?.fork??Lt,join:t?.join}),Aoe=e=>{const t=pie();return fp(e,{differ:t,fork:t.empty})},Ooe=e=>{const t=mie(HV());return fp(e,{differ:t,fork:t.empty})},N4=e=>{const t=hie();return fp(e,{differ:t,fork:t.empty})},fp=(e,t)=>({...jd,[Coe]:Moe,initial:e,commit(){return Gy(this)},diff:(r,i)=>t.differ.diff(r,i),combine:(r,i)=>t.differ.combine(r,i),patch:r=>i=>t.differ.patch(r,i),fork:t.fork,join:t.join??((r,i)=>i)}),Doe=e=>fp(e,{differ:_$,fork:_$.empty}),eu=Jt(Symbol.for("effect/FiberRef/currentContext"),()=>N4(Ly())),Qy=Jt(Symbol.for("effect/FiberRef/currentSchedulingPriority"),()=>Zi(0)),L4=Jt(Symbol.for("effect/FiberRef/currentMaxOpsBeforeYield"),()=>Zi(2048)),$4=Jt(Symbol.for("effect/FiberRef/currentLogAnnotation"),()=>Zi(mR())),j4=Jt(Symbol.for("effect/FiberRef/currentLogLevel"),()=>Zi(O4)),Poe=Jt(Symbol.for("effect/FiberRef/currentLogSpan"),()=>Zi(Dh())),Noe=G(2,(e,t)=>dp(e,Qy,t)),Loe=Jt(Symbol.for("effect/FiberRef/currentConcurrency"),()=>Zi("unbounded")),$oe=Jt(Symbol.for("effect/FiberRef/currentRequestBatching"),()=>Zi(!0)),joe=Jt(Symbol.for("effect/FiberRef/currentUnhandledErrorLogLevel"),()=>Zi(De(D4))),Foe=Jt(Symbol.for("effect/FiberRef/versionMismatchErrorLogLevel"),()=>Zi(De(A4))),mT=Jt(Symbol.for("effect/FiberRef/currentMetricLabels"),()=>Ooe(cd())),gT=Jt(Symbol.for("effect/FiberRef/currentForkScopeOverride"),()=>Zi(Oe(),{fork:()=>Oe(),join:(e,t)=>e})),Hv=Jt(Symbol.for("effect/FiberRef/currentInterruptedCause"),()=>Zi(El,{fork:()=>El,join:(e,t)=>e})),R$=Symbol.for("effect/Scope"),A$=Symbol.for("effect/CloseableScope"),F4=(e,t)=>e.addFinalizer(()=>Ni(t)),z0=(e,t)=>e.addFinalizer(t),yT=(e,t)=>e.close(t),dl=(e,t)=>e.fork(t),_R=(function(){class e extends globalThis.Error{commit(){return Lr(this)}toJSON(){const n={...this};return this.message&&(n.message=this.message),this.cause&&(n.cause=this.cause),n}[$n](){return this.toString!==globalThis.Error.prototype.toString?this.stack?`${this.toString()}
25
+ ${this.stack.split(`
26
+ `).slice(1).join(`
27
+ `)}`:this.toString():"Bun"in globalThis?Zc(Lc(this),{renderErrorCause:!0}):this}}return Object.assign(e.prototype,MZ),e})(),IR=(e,t)=>{class n extends _R{_tag=t}return Object.assign(n.prototype,e),n.prototype.name=t,n},O$=Symbol.for("effect/Cause/errors/RuntimeException"),zoe=IR({[O$]:O$},"RuntimeException"),Boe=Symbol.for("effect/Cause/errors/InterruptedException"),qoe=e=>ht(e,Boe),D$=Symbol.for("effect/Cause/errors/NoSuchElement"),ER=IR({[D$]:D$},"NoSuchElementException"),P$=Symbol.for("effect/Cause/errors/InvalidPubSubCapacityException"),Uoe=IR({[P$]:P$},"InvalidPubSubCapacityException"),N$=Symbol.for("effect/Cause/errors/UnknownException"),z4=(function(){class e extends _R{_tag="UnknownException";error;constructor(n,r){super(r??"An unknown error occurred",{cause:n}),this.error=n}}return Object.assign(e.prototype,{[N$]:N$,name:"UnknownException"}),e})(),Ox=e=>$a(e)&&"_tag"in e&&(e._tag==="Success"||e._tag==="Failure"),Voe=e=>e._tag==="Failure",Koe=e=>e._tag==="Success",Hoe=G(2,(e,t)=>{switch(e._tag){case oi:return un(e.effect_instruction_i0);case si:return dr(t)}}),a1=e=>Hoe(e,void 0),fh=(e,t)=>Xoe(e,t?.parallel?$c:ni),B4=e=>un(qo(e)),bT=e=>un(Lc(e)),un=e=>{const t=new g4(oi);return t.effect_instruction_i0=e,t},Woe=G(2,(e,t)=>{switch(e._tag){case oi:return un(e.effect_instruction_i0);case si:return t(e.effect_instruction_i0)}}),Goe=e=>Y(e,Woe(Lt)),q4=e=>un(ms(e)),WS=G(2,(e,t)=>{switch(e._tag){case oi:return un(e.effect_instruction_i0);case si:return dr(t(e.effect_instruction_i0))}}),Dx=G(2,(e,{onFailure:t,onSuccess:n})=>{switch(e._tag){case oi:return t(e.effect_instruction_i0);case si:return n(e.effect_instruction_i0)}}),vT=G(2,(e,{onFailure:t,onSuccess:n})=>{switch(e._tag){case oi:return t(e.effect_instruction_i0);case si:return n(e.effect_instruction_i0)}}),dr=e=>{const t=new y4(si);return t.effect_instruction_i0=e,t},gs=dr(void 0),Yoe=G(2,(e,t)=>TR(e,t,{onSuccess:(n,r)=>[n,r],onFailure:ni})),Qoe=G(2,(e,t)=>TR(e,t,{onSuccess:(n,r)=>r,onFailure:ni})),TR=G(3,(e,t,{onFailure:n,onSuccess:r})=>{switch(e._tag){case oi:switch(t._tag){case si:return un(e.effect_instruction_i0);case oi:return un(n(e.effect_instruction_i0,t.effect_instruction_i0))}case si:switch(t._tag){case si:return dr(r(e.effect_instruction_i0,t.effect_instruction_i0));case oi:return un(t.effect_instruction_i0)}}}),Xoe=(e,t)=>{const n=Da(e);return _l(n)?Y(pl(n),BM(Y(va(n),WS(An)),(r,i)=>Y(r,TR(i,{onSuccess:(o,a)=>Y(o,ai(a)),onFailure:t}))),WS(kl),WS(r=>Ws(r)),De):Oe()},hp=e=>({...jd,[uoe]:doe,state:zd(foe([])),commit(){return Zs(this)},blockingOn:e}),Xy=()=>ke(Ky,e=>Joe(e)),Joe=e=>Te(()=>hp(e)),Zs=e=>S4(t=>{const n=Vt(e.state);switch(n._tag){case Ix:return t(n.effect);case qy:return n.joiners.push(t),tse(e,t)}},e.blockingOn),Px=G(2,(e,t)=>Te(()=>{const n=Vt(e.state);switch(n._tag){case Ix:return!1;case qy:{Bd(e.state,p4(t));for(let r=0,i=n.joiners.length;r<i;r++)n.joiners[r](t);return!0}}})),Zoe=G(2,(e,t)=>Px(e,t)),U4=G(2,(e,t)=>Px(e,Er(t))),Nx=G(2,(e,t)=>Px(e,I4(t))),ese=e=>Te(()=>Vt(e.state)._tag===Ix),Jy=G(2,(e,t)=>Px(e,Re(t))),Lx=(e,t)=>{const n=Vt(e.state);if(n._tag===qy){Bd(e.state,p4(t));for(let r=0,i=n.joiners.length;r<i;r++)n.joiners[r](t)}},tse=(e,t)=>Te(()=>{const n=Vt(e.state);if(n._tag===qy){const r=n.joiners.indexOf(t);r>=0&&n.joiners.splice(r,1)}}),nse=Bt(e=>dr(e.currentContext)),Zy=()=>nse,Wd=e=>ke(Zy(),e),pp=G(2,(e,t)=>dp(eu,t)(e)),CR=G(2,(e,t)=>P4(eu,n=>_s(n,t))(e)),V4=G(2,(e,t)=>Wd(n=>pp(e,t(n)))),MR=e=>{const t=e.currentSpan;return t!==void 0&&t._tag==="Span"?De(t):Oe()},mr=Xy,kn=Zs,RR=U4,B0=ese,ri=Jy,AR=Voe,xd=Koe,rse=fh,ise=B4,gg=bT,ys=un,ose=Goe,sse=WS,Wi=Dx,Lo=dr,js=gs,L$=Yoe,Ug=Qoe,$$=Symbol.for("effect/MutableHashMap"),ase={[$$]:$$,[Symbol.iterator](){return new OR(this)},toString(){return _r(this.toJSON())},toJSON(){return{_id:"MutableHashMap",values:Array.from(this).map(Yn)}},[$n](){return this.toJSON()},pipe(){return Xe(this,arguments)}};class OR{self;referentialIterator;bucketIterator;constructor(t){this.self=t,this.referentialIterator=t.referential[Symbol.iterator]()}next(){if(this.bucketIterator!==void 0)return this.bucketIterator.next();const t=this.referentialIterator.next();return t.done?(this.bucketIterator=new lse(this.self.buckets.values()),this.next()):t}[Symbol.iterator](){return new OR(this.self)}}class lse{backing;constructor(t){this.backing=t}currentBucket;next(){if(this.currentBucket===void 0){const n=this.backing.next();if(n.done)return n;this.currentBucket=n.value[Symbol.iterator]()}const t=this.currentBucket.next();return t.done?(this.currentBucket=void 0,this.next()):t}}const cse=()=>{const e=Object.create(ase);return e.referential=new Map,e.buckets=new Map,e.bucketsSize=0,e},Nu=G(2,(e,t)=>{if(I0(t)===!1)return e.referential.has(t)?De(e.referential.get(t)):Oe();const n=t[Ot](),r=e.buckets.get(n);return r===void 0?Oe():use(e,r,t)}),use=(e,t,n,r=!1)=>{for(let i=0,o=t.length;i<o;i++)if(n[Tt](t[i][0])){const a=t[i][1];return r&&(t.splice(i,1),e.bucketsSize--),De(a)}return Oe()},Am=G(2,(e,t)=>Ce(Nu(e,t))),Om=G(3,(e,t,n)=>{if(I0(t)===!1)return e.referential.set(t,n),e;const r=t[Ot](),i=e.buckets.get(r);return i===void 0?(e.buckets.set(r,[[t,n]]),e.bucketsSize++,e):(dse(e,i,t),i.push([t,n]),e.bucketsSize++,e)}),dse=(e,t,n)=>{for(let r=0,i=t.length;r<i;r++)if(n[Tt](t[r][0])){t.splice(r,1),e.bucketsSize--;return}},j$=Symbol.for("effect/MutableList"),fse={[j$]:j$,[Symbol.iterator](){let e=!1,t=this.head;return{next(){if(e)return this.return();if(t==null)return e=!0,this.return();const n=t.value;return t=t.next,{done:e,value:n}},return(n){return e||(e=!0),{done:!0,value:n}}}},toString(){return _r(this.toJSON())},toJSON(){return{_id:"MutableList",values:Array.from(this).map(Yn)}},[$n](){return this.toJSON()},pipe(){return Xe(this,arguments)}},hse=e=>({value:e,removed:!1,prev:void 0,next:void 0}),pse=()=>{const e=Object.create(fse);return e.head=void 0,e.tail=void 0,e._length=0,e},K4=e=>DR(e)===0,DR=e=>e._length,mse=G(2,(e,t)=>{const n=hse(t);return e.head===void 0&&(e.head=n),e.tail===void 0||(e.tail.next=n,n.prev=e.tail),e.tail=n,e._length+=1,e}),gse=e=>{const t=e.head;if(t!==void 0)return yse(e,t),t.value},yse=(e,t)=>{t.removed||(t.removed=!0,t.prev!==void 0&&t.next!==void 0?(t.prev.next=t.next,t.next.prev=t.prev):t.prev!==void 0?(e.tail=t.prev,t.prev.next=void 0):t.next!==void 0?(e.head=t.next,t.next.prev=void 0):(e.tail=void 0,e.head=void 0),e._length>0&&(e._length-=1))},F$=Symbol.for("effect/MutableQueue"),Gn=Symbol.for("effect/mutable/MutableQueue/Empty"),bse={[F$]:F$,[Symbol.iterator](){return Array.from(this.queue)[Symbol.iterator]()},toString(){return _r(this.toJSON())},toJSON(){return{_id:"MutableQueue",values:Array.from(this).map(Yn)}},[$n](){return this.toJSON()},pipe(){return Xe(this,arguments)}},H4=e=>{const t=Object.create(bse);return t.queue=pse(),t.capacity=e,t},W4=e=>H4(e),eb=()=>H4(void 0),PR=e=>DR(e.queue),Zu=e=>K4(e.queue),vse=e=>e.capacity===void 0?1/0:e.capacity,jc=G(2,(e,t)=>{const n=DR(e.queue);return e.capacity!==void 0&&n===e.capacity?!1:(mse(t)(e.queue),!0)}),NR=G(2,(e,t)=>{const n=t[Symbol.iterator]();let r,i=hn(),o=!0;for(;o&&(r=n.next())&&!r.done;)o=jc(r.value)(e);for(;r!=null&&!r.done;)i=ai(r.value)(i),r=n.next();return kl(i)}),_a=G(2,(e,t)=>K4(e.queue)?t:gse(e.queue)),$x=G(2,(e,t)=>{let n=hn(),r=0;for(;r<t;){const i=_a(Gn)(e);if(i===Gn)break;n=ai(i)(n),r+=1}return kl(n)}),Sse="effect/Clock",z$=Symbol.for(Sse),jx=Go("effect/Clock"),wse=2**31-1,B$={unsafeSchedule(e,t){const n=pd(t);if(n>wse)return lh;let r=!1;const i=setTimeout(()=>{r=!0,e()},n);return()=>(clearTimeout(i),!r)}},q$=(function(){const e=BigInt(1e6);if(typeof performance>"u"||typeof performance.now!="function")return()=>BigInt(Date.now())*e;let t;return()=>(t===void 0&&(t=BigInt(Date.now())*e-BigInt(Math.round(performance.now()*1e6))),t+BigInt(Math.round(performance.now()*1e6)))})(),xse=(function(){const e=typeof process=="object"&&"hrtime"in process&&typeof process.hrtime.bigint=="function"?process.hrtime:void 0;if(!e)return q$;const t=q$()-e.bigint();return()=>t+e.bigint()})();class kse{[z$]=z$;unsafeCurrentTimeMillis(){return Date.now()}unsafeCurrentTimeNanos(){return xse()}currentTimeMillis=Te(()=>this.unsafeCurrentTimeMillis());currentTimeNanos=Te(()=>this.unsafeCurrentTimeNanos());scheduler(){return Re(B$)}sleep(t){return Js(n=>{const r=B$.unsafeSchedule(()=>n(bn),t);return Ni(Te(r))})}}const _se=()=>new kse,LR="And",$R="Or",jR="InvalidData",FR="MissingData",zR="SourceUnavailable",BR="Unsupported",Ise="effect/ConfigError",U$=Symbol.for(Ise),mp={_tag:"ConfigError",[U$]:U$},G4=(e,t)=>{const n=Object.create(mp);return n._op=LR,n.left=e,n.right=t,Object.defineProperty(n,"toString",{enumerable:!1,value(){return`${this.left} and ${this.right}`}}),Object.defineProperty(n,"message",{enumerable:!1,get(){return this.toString()}}),n},Y4=(e,t)=>{const n=Object.create(mp);return n._op=$R,n.left=e,n.right=t,Object.defineProperty(n,"toString",{enumerable:!1,value(){return`${this.left} or ${this.right}`}}),Object.defineProperty(n,"message",{enumerable:!1,get(){return this.toString()}}),n},Q4=(e,t,n={pathDelim:"."})=>{const r=Object.create(mp);return r._op=jR,r.path=e,r.message=t,Object.defineProperty(r,"toString",{enumerable:!1,value(){return`(Invalid data at ${Y(this.path,rp(n.pathDelim))}: "${this.message}")`}}),r},kd=(e,t,n={pathDelim:"."})=>{const r=Object.create(mp);return r._op=FR,r.path=e,r.message=t,Object.defineProperty(r,"toString",{enumerable:!1,value(){return`(Missing data at ${Y(this.path,rp(n.pathDelim))}: "${this.message}")`}}),r},Ese=(e,t,n,r={pathDelim:"."})=>{const i=Object.create(mp);return i._op=zR,i.path=e,i.message=t,i.cause=n,Object.defineProperty(i,"toString",{enumerable:!1,value(){return`(Source unavailable at ${Y(this.path,rp(r.pathDelim))}: "${this.message}")`}}),i},Tse=(e,t,n={pathDelim:"."})=>{const r=Object.create(mp);return r._op=BR,r.path=e,r.message=t,Object.defineProperty(r,"toString",{enumerable:!1,value(){return`(Unsupported operation at ${Y(this.path,rp(n.pathDelim))}: "${this.message}")`}}),r},zu=G(2,(e,t)=>{switch(e._op){case LR:return G4(zu(e.left,t),zu(e.right,t));case $R:return Y4(zu(e.left,t),zu(e.right,t));case jR:return Q4([...t,...e.path],e.message);case FR:return kd([...t,...e.path],e.message);case zR:return Ese([...t,...e.path],e.message,e.cause);case BR:return Tse([...t,...e.path],e.message)}}),Cse={andCase:(e,t,n)=>t&&n,orCase:(e,t,n)=>t&&n,invalidDataCase:lh,missingDataCase:HE,sourceUnavailableCase:lh,unsupportedCase:lh},Mse=G(3,(e,t,n)=>{const r=[e],i=[];for(;r.length>0;){const a=r.pop();switch(a._op){case LR:{r.push(a.right),r.push(a.left),i.push(gt({_op:"AndCase"}));break}case $R:{r.push(a.right),r.push(a.left),i.push(gt({_op:"OrCase"}));break}case jR:{i.push(St(n.invalidDataCase(t,a.path,a.message)));break}case FR:{i.push(St(n.missingDataCase(t,a.path,a.message)));break}case zR:{i.push(St(n.sourceUnavailableCase(t,a.path,a.message,a.cause)));break}case BR:{i.push(St(n.unsupportedCase(t,a.path,a.message)));break}}}const o=[];for(;i.length>0;){const a=i.pop();switch(a._op){case"Left":{switch(a.left._op){case"AndCase":{const c=o.pop(),u=o.pop(),d=n.andCase(t,c,u);o.push(d);break}case"OrCase":{const c=o.pop(),u=o.pop(),d=n.orCase(t,c,u);o.push(d);break}}break}case"Right":{o.push(a.right);break}}}if(o.length===0)throw new Error("BUG: ConfigError.reduceWithContext - please report an issue at https://github.com/Effect-TS/effect/issues");return o.pop()}),Rse=e=>Mse(e,void 0,Cse),Ase={_tag:"Empty"},l1=G(2,(e,t)=>{let n=yR(t),r=e;for(;gR(n);){const i=n.head;switch(i._tag){case"Empty":{n=n.tail;break}case"AndThen":{n=vd(i.first,vd(i.second,n.tail));break}case"MapName":{r=Yu(r,i.f),n=n.tail;break}case"Nested":{r=M0(r,i.name),n=n.tail;break}case"Unnested":{if(Y(mg(r),YZ(i.name)))r=ld(r),n=n.tail;else return gt(kd(r,`Expected ${i.name} to be in path in ConfigProvider#unnested`));break}}}return St(r)}),X4="Constant",Ose="Fail",J4="Fallback",Dse="Described",Z4="Lazy",eK="MapOrFail",tK="Nested",nK="Primitive",Pse="Sequence",Nse="HashMap",Lse="ZipWith";var V$={};const q0=(e,t)=>[...e,...t],$se="effect/ConfigProvider",K$=Symbol.for($se),rK=Go("effect/ConfigProvider"),jse="effect/ConfigProviderFlat",H$=Symbol.for(jse),Fse=e=>({[K$]:K$,pipe(){return Xe(this,arguments)},...e}),zse=e=>({[H$]:H$,patch:e.patch,load:(t,n,r=!0)=>e.load(t,n,r),enumerateChildren:e.enumerateChildren}),Bse=e=>Fse({load:t=>ke(ls(e,cd(),t,!1),n=>rr(mg(n),{onNone:()=>Lr(kd(cd(),`Expected a single value having structure: ${t}`)),onSome:Re})),flattened:e}),qse=e=>{const{pathDelim:t,seqDelim:n}=Object.assign({},{pathDelim:"_",seqDelim:","},e),r=u=>Y(u,rp(t)),i=u=>u.split(t),o=()=>typeof process<"u"&&"env"in process&&typeof V$=="object"?V$:{};return Bse(zse({load:(u,d,h=!0)=>{const p=r(u),g=o(),y=p in g?De(g[p]):Oe();return Y(y,Cx(()=>kd(u,`Expected ${p} to exist in the process context`)),ke(b=>Wse(b,u,d,n,h)))},enumerateChildren:u=>Te(()=>{const d=o(),g=Object.keys(d).map(y=>i(y.toUpperCase())).filter(y=>{for(let b=0;b<u.length;b++){const S=Y(u,_U(b)),w=y[b];if(w===void 0||S!==w)return!1}return!0}).flatMap(y=>y.slice(u.length,u.length+1));return ere(g)}),patch:Ase}))},Use=(e,t,n,r)=>{const i=o$(n.length,u=>u>=r.length?Oe():De([e(u),u+1])),o=o$(r.length,u=>u>=n.length?Oe():De([t(u),u+1])),a=q0(n,i),c=q0(r,o);return[a,c]},Vse=(e,t)=>{let n=t;if(n._tag==="Nested"){const r=e.slice();for(;n._tag==="Nested";)r.push(n.name),n=n.config;return r}return e},ls=(e,t,n,r)=>{const i=n;switch(i._tag){case X4:return Re($s(i.value));case Dse:return mt(()=>ls(e,t,i.config,r));case Ose:return Lr(kd(t,i.message));case J4:return Y(mt(()=>ls(e,t,i.first,r)),qg(o=>i.condition(o)?Y(ls(e,t,i.second,r),qg(a=>Lr(Y4(o,a)))):Lr(o)));case Z4:return mt(()=>ls(e,t,i.config(),r));case eK:return mt(()=>Y(ls(e,t,i.original,r),ke(ml(o=>Y(i.mapOrFail(o),Cx(zu(Vse(t,i.original))))))));case tK:return mt(()=>ls(e,q0(t,$s(i.name)),i.config,r));case nK:return Y(l1(t,e.patch),ke(o=>Y(e.load(o,i,r),ke(a=>{if(a.length===0){const c=Y(see(o),Ln(()=>"<n/a>"));return Lr(kd([],`Expected ${i.description} with name ${c}`))}return Re(a)}))));case Pse:return Y(l1(t,e.patch),ke(o=>Y(e.enumerateChildren(o),ke(Yse),ke(a=>a.length===0?mt(()=>ft(ls(e,t,i.config,!0),$s)):Y(ml(a,c=>ls(e,eee(t,`[${c}]`),i.config,!0)),ft(c=>{const u=pee(c);return u.length===0?$s(cd()):$s(u)}))))));case Nse:return mt(()=>Y(l1(t,e.patch),ke(o=>Y(e.enumerateChildren(o),ke(a=>Y(a,ml(c=>ls(e,q0(o,$s(c)),i.valueConfig,r)),ft(c=>c.length===0?$s(mR()):Y(Gse(c),Yu(u=>hre(i$(Kn(a),u)))))))))));case Lse:return mt(()=>Y(ls(e,t,i.left,r),Fh,ke(o=>Y(ls(e,t,i.right,r),Fh,ke(a=>{if(mi(o)&&mi(a))return Lr(G4(o.left,a.left));if(mi(o)&&ba(a))return Lr(o.left);if(ba(o)&&mi(a))return Lr(a.left);if(ba(o)&&ba(a)){const c=Y(t,rp(".")),u=Kse(t,c),[d,h]=Use(u,u,Y(o.right,Yu(St)),Y(a.right,Yu(St)));return Y(d,i$(h),ml(([p,g])=>Y(M4(p,g),ft(([y,b])=>i.zip(y,b)))))}throw new Error("BUG: ConfigProvider.fromFlatLoop - please report an issue at https://github.com/Effect-TS/effect/issues")})))))}},Kse=(e,t)=>n=>gt(kd(e,`The element at index ${n} in a sequence at path "${t}" was missing`)),Hse=(e,t)=>e.split(new RegExp(`\\s*${R0(t)}\\s*`)),Wse=(e,t,n,r,i)=>i?Y(Hse(e,r),ml(o=>n.parse(o.trim())),Cx(zu(t))):Y(n.parse(e),E4({onFailure:zu(t),onSuccess:$s})),Gse=e=>Object.keys(e[0]).map(t=>e.map(n=>n[t])),Yse=e=>Y(ml(e,Xse),E4({onFailure:()=>cd(),onSuccess:Ng(Ch)}),Fh,ft(BZ)),Qse=/^(\[(\d+)\])$/,Xse=e=>{const t=e.match(Qse);if(t!==null){const n=t[2];return Y(n!==void 0&&n.length>0?De(n):Oe(),ix(Jse))}return Oe()},Jse=e=>{const t=Number.parseInt(e);return Number.isNaN(t)?Oe():De(t)},W$=Symbol.for("effect/Console"),Fx=Go("effect/Console"),Zse={[W$]:W$,assert(e,...t){return Te(()=>{console.assert(e,...t)})},clear:Te(()=>{console.clear()}),count(e){return Te(()=>{console.count(e)})},countReset(e){return Te(()=>{console.countReset(e)})},debug(...e){return Te(()=>{console.debug(...e)})},dir(e,t){return Te(()=>{console.dir(e,t)})},dirxml(...e){return Te(()=>{console.dirxml(...e)})},error(...e){return Te(()=>{console.error(...e)})},group(e){return e?.collapsed?Te(()=>console.groupCollapsed(e?.label)):Te(()=>console.group(e?.label))},groupEnd:Te(()=>{console.groupEnd()}),info(...e){return Te(()=>{console.info(...e)})},log(...e){return Te(()=>{console.log(...e)})},table(e,t){return Te(()=>{console.table(e,t)})},time(e){return Te(()=>console.time(e))},timeEnd(e){return Te(()=>console.timeEnd(e))},timeLog(e,...t){return Te(()=>{console.timeLog(e,...t)})},trace(...e){return Te(()=>{console.trace(...e)})},warn(...e){return Te(()=>{console.warn(...e)})},unsafe:console},eae="effect/Random",G$=Symbol.for(eae),tae=Go("effect/Random");class nae{seed;[G$]=G$;PRNG;constructor(t){this.seed=t,this.PRNG=new dZ(t)}get next(){return Te(()=>this.PRNG.number())}get nextBoolean(){return ft(this.next,t=>t>.5)}get nextInt(){return Te(()=>this.PRNG.integer(Number.MAX_SAFE_INTEGER))}nextRange(t,n){return ft(this.next,r=>(n-t)*r+t)}nextIntBetween(t,n){return Te(()=>this.PRNG.integer(n-t)+t)}shuffle(t){return rae(t,n=>this.nextIntBetween(0,n))}}const rae=(e,t)=>mt(()=>Y(Te(()=>Array.from(e)),ke(n=>{const r=[];for(let i=n.length;i>=2;i=i-1)r.push(i);return Y(r,Ex(i=>Y(t(i),ft(o=>iae(n,i-1,o)))),li(Da(n)))}))),iae=(e,t,n)=>{const r=e[t];return e[t]=e[n],e[n]=r,e},oae=e=>new nae(tt(e)),Y$=Symbol.for("effect/Tracer"),sae=e=>({[Y$]:Y$,...e}),iK=Go("effect/Tracer"),oK=Go("effect/ParentSpan"),Q$=(function(){const e="abcdef0123456789",t=e.length;return function(n){let r="";for(let i=0;i<n;i++)r+=e.charAt(Math.floor(Math.random()*t));return r}})();class aae{name;parent;context;startTime;kind;_tag="Span";spanId;traceId="native";sampled=!0;status;attributes;events=[];links;constructor(t,n,r,i,o,a){this.name=t,this.parent=n,this.context=r,this.startTime=o,this.kind=a,this.status={_tag:"Started",startTime:o},this.attributes=new Map,this.traceId=n._tag==="Some"?n.value.traceId:Q$(32),this.spanId=Q$(16),this.links=Array.from(i)}end(t,n){this.status={_tag:"Ended",endTime:t,exit:n,startTime:this.status.startTime}}attribute(t,n){this.attributes.set(t,n)}event(t,n,r){this.events.push([t,n,r??{}])}addLinks(t){this.links.push(...t)}}const lae=sae({span:(e,t,n,r,i,o)=>new aae(e,t,n,r,i,o),context:e=>e()}),cae=Y(Ly(),kc(jx,_se()),kc(Fx,Zse),kc(tae,oae(Math.random())),kc(rK,qse()),kc(iK,lae)),zh=Jt(Symbol.for("effect/DefaultServices/currentServices"),()=>N4(cae)),uae=e=>{const t=Ho(e);return qR(n=>n.sleep(t))},sK=e=>Bt(t=>e(t.currentDefaultServices)),qR=e=>sK(t=>e(t.unsafeMap.get(jx.key))),dae=qR(e=>e.currentTimeMillis),fae=e=>sK(t=>e(t.unsafeMap.get(rK.key))),hae=e=>fae(t=>t.load(e)),UR=uae,Vg=dae,pae=qR;function mae(e){return new Fc(e)}function gae(){return mae(new Map)}const X$=Symbol.for("effect/FiberRefs");class Fc{locals;[X$]=X$;constructor(t){this.locals=t}pipe(){return Xe(this,arguments)}}const yae=(e,t,n,r=!1)=>{const i=e;let o=t,a=n,c=r,u;for(;u===void 0;)if(Ir(o)&&Ir(a)){const d=Qi(o)[0],h=ld(o),p=Qi(a)[0],g=Qi(a)[1],y=ld(a);d.startTimeMillis<p.startTimeMillis?(a=y,c=!0):d.startTimeMillis>p.startTimeMillis?o=h:d.id<p.id?(a=y,c=!0):d.id>p.id?o=h:u=[g,c]}else u=[i.initial,!0];return u},bae=G(3,(e,t,n)=>{const r=new Map(e.locals);return n.locals.forEach((i,o)=>{const a=i[0][1];if(!i[0][0][Tt](t)){if(!r.has(o)){if(bt(a,o.initial))return;r.set(o,[[t,o.join(o.initial,a)]]);return}const c=r.get(o),[u,d]=yae(o,c,i);if(d){const h=o.diff(u,a),p=c[0][1],g=o.join(p,o.patch(h)(p));if(!bt(p,g)){let y;const b=c[0][0];b[Tt](t)?y=[[b,g],...c.slice(1)]:y=[[t,g],...c],r.set(o,y)}}}}),new Fc(r)}),vae=G(2,(e,t)=>{const n=new Map;return aK(e,n,t),new Fc(n)}),aK=(e,t,n)=>{e.locals.forEach((r,i)=>{const o=r[0][1],a=i.patch(i.fork)(o);bt(o,a)?t.set(i,r):t.set(i,[[n,a],...r])})},lK=G(2,(e,t)=>{const n=new Map(e.locals);return n.delete(t),new Fc(n)}),Sae=G(2,(e,t)=>e.locals.has(t)?De(Qi(e.locals.get(t))[1]):Oe()),Kg=G(2,(e,t)=>Y(Sae(e,t),Ln(()=>t.initial))),ST=G(2,(e,{fiberId:t,fiberRef:n,value:r})=>{if(e.locals.size===0)return new Fc(new Map([[n,[[t,r]]]]));const i=new Map(e.locals);return wT(i,t,n,r),new Fc(i)}),wT=(e,t,n,r)=>{const i=e.get(n)??[];let o;if(Ir(i)){const[a,c]=Qi(i);if(a[Tt](t)){if(bt(c,r))return;o=[[t,r],...i.slice(1)]}else o=[[t,r],...i]}else o=[[t,r]];e.set(n,o)},wae=G(2,(e,{entries:t,forkAs:n})=>{if(e.locals.size===0)return new Fc(new Map(t));const r=new Map(e.locals);return n!==void 0&&aK(e,r,n),t.forEach(([i,o])=>{o.length===1?wT(r,o[0][0],i,o[0][1]):o.forEach(([a,c])=>{wT(r,a,i,c)})}),new Fc(r)}),VR=Kg,xae=wae,kae=gae,_ae=xoe,Iae=koe,cK=_oe,uK=A4,dK=O4,fK=D4,Eae=Ioe,Tae=Eoe,Cae=Y(Ch,SU(e=>e.ordinal)),Mae=VZ(Cae),Rae=e=>{switch(e){case"All":return _ae;case"Debug":return fK;case"Error":return cK;case"Fatal":return Iae;case"Info":return dK;case"Trace":return Eae;case"None":return Tae;case"Warning":return uK}},hK=e=>e.replace(/[\s="]/g,"_"),KR=e=>t=>`${hK(t.label)}=${e-t.startTime}ms`,Aae=Oy,Oae=jd,Dae=RZ;class gp extends Dae{}const Bh=Symbol.for("effect/Readable"),HR=Symbol.for("effect/Ref"),WR={_A:e=>e};class Pae extends gp{ref;commit(){return this.get}[HR]=WR;[Bh]=Bh;constructor(t){super(),this.ref=t,this.get=Te(()=>Vt(this.ref))}get;modify(t){return Te(()=>{const n=Vt(this.ref),[r,i]=t(n);return n!==i&&Bd(i)(this.ref),r})}}const GR=e=>new Pae(zd(e)),U0=e=>Te(()=>GR(e)),Ia=e=>e.get,hh=G(2,(e,t)=>e.modify(()=>[void 0,t])),pK=G(2,(e,t)=>e.modify(t)),V0=G(2,(e,t)=>e.modify(n=>[void 0,t(n)])),Nae=G(2,(e,t)=>e.modify(n=>{const r=t(n);return[r,r]})),Lae=HR,Qn=U0,Xi=Ia,xr=pK,_d=hh,bs=V0,$ae=Nae,mK="Empty",gK="Add",yK="Remove",bK="Update",vK="AndThen",jae={_tag:mK},SK=(e,t)=>{const n=new Map(e.locals);let r=jae;for(const[i,o]of t.locals.entries()){const a=Qi(o)[1],c=n.get(i);if(c!==void 0){const u=Qi(c)[1];bt(u,a)||(r=c1({_tag:bK,fiberRef:i,patch:i.diff(u,a)})(r))}else r=c1({_tag:gK,fiberRef:i,value:a})(r);n.delete(i)}for(const[i]of n.entries())r=c1({_tag:yK,fiberRef:i})(r);return r},c1=G(2,(e,t)=>({_tag:vK,first:e,second:t})),wK=G(3,(e,t,n)=>{let r=n,i=$s(e);for(;Ir(i);){const o=Qi(i),a=ld(i);switch(o._tag){case mK:{i=a;break}case gK:{r=ST(r,{fiberId:t,fiberRef:o.fiberRef,value:o.value}),i=a;break}case yK:{r=lK(r,o.fiberRef),i=a;break}case bK:{const c=Kg(r,o.fiberRef);r=ST(r,{fiberId:t,fiberRef:o.fiberRef,value:o.fiberRef.patch(o.patch)(c)}),i=a;break}case vK:{i=M0(o.first)(M0(o.second)(a));break}}}return r}),xK="effect/MetricLabel",xT=Symbol.for(xK);class Fae{key;value;[xT]=xT;_hash;constructor(t,n){this.key=t,this.value=n,this._hash=ur(xK+this.key+this.value)}[Ot](){return this._hash}[Tt](t){return Bae(t)&&this.key===t.key&&this.value===t.value}pipe(){return Xe(this,arguments)}}const zae=(e,t)=>new Fae(e,t),Bae=e=>ht(e,xT),qae=G(e=>$a(e[0]),function(){const e=arguments;return P4(e[0],$4,typeof e[1]=="string"?N0(e[1],e[2]):t=>Object.entries(e[1]).reduce((n,[r,i])=>N0(n,r,i),t))}),Uae=e=>ft(e,De),Vae=G(2,(e,t)=>Wo(e,{onFailure:n=>{const r=t(n);switch(r._tag){case"None":return Er(n);case"Some":return r.value}},onSuccess:Re})),Kae=pae,kK=e=>nle(e,Wae,SK),_K=G(2,(e,t)=>Tl(e,{onFailure:n=>Re(t.onFailure(n)),onSuccess:n=>Re(t.onSuccess(n))})),Hae=e=>{const t=ke(ke(e,()=>Wy()),()=>t);return t},Wae=Bt(e=>Re(e.getFiberRefs())),Gae=e=>_K(e,{onFailure:k0,onSuccess:k0}),zx=e=>(...t)=>{const n=Dy(e);let r;for(let i=0,o=t.length;i<o;i++){const a=t[i];i4(a)&&(r!==void 0?r=ni(r,a):r=a,t=[...t.slice(0,i),...t.slice(i+1)],i--)}return r===void 0&&(r=El),Bt(i=>(i.log(t,r,n),bn))},Yae=zx(fK),Qae=zx(dK),Xae=zx(uK),Jae=zx(cK),J$=G(2,(e,t)=>Wo(e,{onFailure:n=>k4(()=>t(n)),onSuccess:Re})),Zae=e=>ft(e,t=>!t),IK=e=>ole((t,n)=>Y(e,wK(t,n))),ele=e=>e.length>=1?Js((t,n)=>{try{e(n).then(r=>t(Re(r)),r=>t(Sa(r)))}catch(r){t(Sa(r))}}):Js(t=>{try{e().then(n=>t(Re(n)),n=>t(Sa(n)))}catch(n){t(Sa(n))}}),EK=G(3,(e,t,n)=>Wd(r=>pp(e,kc(r,t,n)))),kT=G(3,(e,t,n)=>Wd(r=>ke(n,i=>pp(e,Y(r,kc(t,i)))))),YR=UR,tle=Re(Oe()),nle=G(3,(e,t,n)=>ke(t,r=>ke(e,i=>ft(t,o=>[n(r,o),i])))),rle=G(2,(e,t)=>Wo(e,{onFailure:n=>Wr(t(n),Er(n)),onSuccess:Re})),ile=e=>{let t,n;typeof e=="function"?t=e:(t=e.try,n=e.catch);const r=i=>n?Vy(()=>n(i)):Lr(new z4(i,"An unknown error occurred in Effect.tryPromise"));return t.length>=1?Js((i,o)=>{try{t(o).then(a=>i(Re(a)),a=>i(r(a)))}catch(a){i(r(a))}}):Js(i=>{try{t().then(o=>i(Re(o)),o=>i(r(o)))}catch(o){i(r(o))}})},ole=e=>Bt(t=>(t.setFiberRefs(e(t.id(),t.getFiberRefs())),bn)),sle=G(2,(e,t)=>mt(()=>t()?ft(e,De):Re(Oe()))),ale=e=>ft(Zy(),Ai(e)),lle=e=>ke(Zy(),Ai(e)),TK="Sequential",CK="Parallel",cle="ParallelN",Cc={_tag:TK},_T={_tag:CK},ule=e=>({_tag:cle,parallelism:e}),dle=e=>e._tag===TK,fle=e=>e._tag===CK,K0=Cc,IT=_T,ET=ule,Hg=SK,Wg=wK,Bx="effect/FiberStatus",Id=Symbol.for(Bx),H0="Done",Z$="Running",ej="Suspended",hle=ur(`${Bx}-${H0}`);let ple=class{[Id]=Id;_tag=H0;[Ot](){return hle}[Tt](t){return QR(t)&&t._tag===H0}};class mle{runtimeFlags;[Id]=Id;_tag=Z$;constructor(t){this.runtimeFlags=t}[Ot](){return Y(tt(Bx),Wt(tt(this._tag)),Wt(tt(this.runtimeFlags)),ir(this))}[Tt](t){return QR(t)&&t._tag===Z$&&this.runtimeFlags===t.runtimeFlags}}class gle{runtimeFlags;blockingOn;[Id]=Id;_tag=ej;constructor(t,n){this.runtimeFlags=t,this.blockingOn=n}[Ot](){return Y(tt(Bx),Wt(tt(this._tag)),Wt(tt(this.runtimeFlags)),Wt(tt(this.blockingOn)),ir(this))}[Tt](t){return QR(t)&&t._tag===ej&&this.runtimeFlags===t.runtimeFlags&&bt(this.blockingOn,t.blockingOn)}}const yle=new ple,ble=e=>new mle(e),vle=(e,t)=>new gle(e,t),QR=e=>ht(e,Id),Sle=e=>e._tag===H0,wle=yle,MK=ble,xle=vle,kle=Sle,_le=Symbol.for("effect/Micro"),W0=Symbol.for("effect/Micro/MicroExit"),tj=Symbol.for("effect/Micro/MicroCause"),Ile={_E:Lt};class RK extends globalThis.Error{_tag;traces;[tj];constructor(t,n,r){const i=`MicroCause.${t}`;let o,a,c;if(n instanceof globalThis.Error){o=`(${i}) ${n.name}`,a=n.message;const u=a.split(`
28
+ `).length;c=n.stack?`(${i}) ${n.stack.split(`
29
+ `).slice(0,u+3).join(`
30
+ `)}`:`${o}: ${a}`}else o=i,a=Eh(n,0),c=`${o}: ${a}`;r.length>0&&(c+=`
31
+ ${r.join(`
32
+ `)}`),super(a),this._tag=t,this.traces=r,this[tj]=Ile,this.name=o,this.stack=c}pipe(){return Xe(this,arguments)}toString(){return this.stack}[$n](){return this.stack}}class Ele extends RK{defect;constructor(t,n=[]){super("Die",t,n),this.defect=t}}const Tle=(e,t=[])=>new Ele(e,t);class Cle extends RK{constructor(t=[]){super("Interrupt","interrupted",t)}}const Mle=(e=[])=>new Cle(e),Rle=e=>e._tag==="Interrupt",nj=Symbol.for("effect/Micro/MicroFiber"),Ale={_A:Lt,_E:Lt};class Ole{context;interruptible;[nj];_stack=[];_observers=[];_exit;_children;currentOpCount=0;constructor(t,n=!0){this.context=t,this.interruptible=n,this[nj]=Ale}getRef(t){return Nte(this.context,t)}addObserver(t){return this._exit?(t(this._exit),k0):(this._observers.push(t),()=>{const n=this._observers.indexOf(t);n>=0&&this._observers.splice(n,1)})}_interrupted=!1;unsafeInterrupt(){this._exit||(this._interrupted=!0,this.interruptible&&this.evaluate(tA))}unsafePoll(){return this._exit}evaluate(t){if(this._exit)return;if(this._yielded!==void 0){const i=this._yielded;this._yielded=void 0,i()}const n=this.runLoop(t);if(n===Wv)return;const r=rj.interruptChildren&&rj.interruptChildren(this);if(r!==void 0)return this.evaluate(Y0(r,()=>n));this._exit=n;for(let i=0;i<this._observers.length;i++)this._observers[i](n);this._observers.length=0}runLoop(t){let n=!1,r=t;this.currentOpCount=0;try{for(;;){if(this.currentOpCount++,!n&&this.getRef(nA).shouldYield(this)){n=!0;const i=r;r=Y0($le,()=>i)}if(r=r[TT](this),r===Wv){const i=this._yielded;return W0 in i?(this._yielded=void 0,i):Wv}}}catch(i){return ht(r,TT)?CT(i):CT(`MicroFiber.runLoop: Not a valid effect: ${String(r)}`)}}getCont(t){for(;;){const n=this._stack.pop();if(!n)return;const r=n[G0]&&n[G0](this);if(r)return{[t]:r};if(n[t])return n}}_yielded=void 0;yieldWith(t){return this._yielded=t,Wv}children(){return this._children??=new Set}}const rj=Jt("effect/Micro/fiberMiddleware",()=>({interruptChildren:void 0})),AK=Symbol.for("effect/Micro/identifier"),Gr=Symbol.for("effect/Micro/args"),TT=Symbol.for("effect/Micro/evaluate"),qh=Symbol.for("effect/Micro/successCont"),ph=Symbol.for("effect/Micro/failureCont"),G0=Symbol.for("effect/Micro/ensureCont"),Wv=Symbol.for("effect/Micro/Yield"),Dle={_A:Lt,_E:Lt,_R:Lt},Ple={...Aae,_op:"Micro",[_le]:Dle,pipe(){return Xe(this,arguments)},[Symbol.iterator](){return new Jq(new Ry(this))},toJSON(){return{_id:"Micro",op:this[AK],...Gr in this?{args:this[Gr]}:void 0}},toString(){return _r(this)},[$n](){return _r(this)}};function Nle(e){return CT("Micro.evaluate: Not implemented")}const qx=e=>({...Ple,[AK]:e.op,[TT]:e.eval??Nle,[qh]:e.contA,[ph]:e.contE,[G0]:e.ensure}),XR=e=>{const t=qx(e);return function(){const n=Object.create(t);return n[Gr]=e.single===!1?arguments:arguments[0],n}},OK=e=>{const t={...qx(e),[W0]:W0,_tag:e.op,get[e.prop](){return this[Gr]},toJSON(){return{_id:"MicroExit",_tag:e.op,[e.prop]:this[Gr]}},[Tt](n){return zle(n)&&n._tag===e.op&&bt(this[Gr],n[Gr])},[Ot](){return ir(this,Wt(ur(e.op))(tt(this[Gr])))}};return function(n){const r=Object.create(t);return r[Gr]=n,r[qh]=void 0,r[ph]=void 0,r[G0]=void 0,r}},JR=OK({op:"Success",prop:"value",eval(e){const t=e.getCont(qh);return t?t[qh](this[Gr],e):e.yieldWith(this)}}),DK=OK({op:"Failure",prop:"cause",eval(e){let t=e.getCont(ph);for(;Rle(this[Gr])&&t&&e.interruptible;)t=e.getCont(ph);return t?t[ph](this[Gr],e):e.yieldWith(this)}}),Lle=XR({op:"Yield",eval(e){let t=!1;return e.getRef(nA).scheduleTask(()=>{t||e.evaluate(Ble)},this[Gr]??0),e.yieldWith(()=>{t=!0})}}),$le=Lle(0),jle=JR(void 0),ZR=XR({op:"WithMicroFiber",eval(e){return this[Gr](e)}}),Y0=G(2,(e,t)=>{const n=Object.create(Fle);return n[Gr]=e,n[qh]=t,n}),Fle=qx({op:"OnSuccess",eval(e){return e._stack.push(this),this[Gr]}}),zle=e=>ht(e,W0),PK=JR,eA=DK,tA=eA(Mle()),CT=e=>eA(Tle(e)),Ble=PK(void 0),qle="setImmediate"in globalThis?globalThis.setImmediate:e=>setTimeout(e,0);class NK{tasks=[];running=!1;scheduleTask(t,n){this.tasks.push(t),this.running||(this.running=!0,qle(this.afterScheduled))}afterScheduled=()=>{this.running=!1,this.runTasks()};runTasks(){const t=this.tasks;this.tasks=[];for(let n=0,r=t.length;n<r;n++)t[n]()}shouldYield(t){return t.currentOpCount>=t.getRef(Kle)}flush(){for(;this.tasks.length>0;)this.runTasks()}}const Ule=G(2,(e,t)=>ZR(n=>{const r=n.context;return n.context=t(r),Gle(e,()=>(n.context=r,jle))})),Vle=G(2,(e,t)=>Ule(e,_s(t)));class Kle extends ux()("effect/Micro/currentMaxOpsBeforeYield",{defaultValue:()=>2048}){}class nA extends ux()("effect/Micro/currentScheduler",{defaultValue:()=>new NK}){}const Hle=G(2,(e,t)=>{const n=Object.create(Wle);return n[Gr]=e,n[qh]=t.onSuccess,n[ph]=t.onFailure,n}),Wle=qx({op:"OnSuccessAndFailure",eval(e){return e._stack.push(this),this[Gr]}}),Gle=G(2,(e,t)=>Qle(n=>Hle(n(e),{onFailure:r=>Y0(t(eA(r)),()=>DK(r)),onSuccess:r=>Y0(t(PK(r)),()=>JR(r))}))),LK=XR({op:"SetInterruptible",ensure(e){if(e.interruptible=this[Gr],e._interrupted&&e.interruptible)return()=>tA}}),Yle=e=>ZR(t=>t.interruptible?e:(t.interruptible=!0,t._stack.push(LK(!1)),t._interrupted?tA:e)),Qle=e=>ZR(t=>t.interruptible?(t.interruptible=!1,t._stack.push(LK(!0)),e(Yle)):e(Lt)),Xle=(e,t)=>{const n=new Ole(nA.context(new NK));return n.evaluate(e),n};class $K{buckets=[];scheduleTask(t,n){const r=this.buckets.length;let i,o=0;for(;o<r&&this.buckets[o][0]<=n;o++)i=this.buckets[o];i&&i[0]===n?i[1].push(t):o===r?this.buckets.push([n,[t]]):this.buckets.splice(o,0,[n,[t]])}}class Jle{maxNextTickBeforeTimer;running=!1;tasks=new $K;constructor(t){this.maxNextTickBeforeTimer=t}starveInternal(t){const n=this.tasks.buckets;this.tasks.buckets=[];for(const[r,i]of n)for(let o=0;o<i.length;o++)i[o]();this.tasks.buckets.length===0?this.running=!1:this.starve(t)}starve(t=0){t>=this.maxNextTickBeforeTimer?setTimeout(()=>this.starveInternal(0),0):Promise.resolve(void 0).then(()=>this.starveInternal(t+1))}shouldYield(t){return t.currentOpCount>t.getFiberRef(L4)?t.getFiberRef(Qy):!1}scheduleTask(t,n){this.tasks.scheduleTask(t,n),this.running||(this.running=!0,this.starve())}}const jK=Jt(Symbol.for("effect/Scheduler/defaultScheduler"),()=>new Jle(2048));class FK{tasks=new $K;deferred=!1;scheduleTask(t,n){this.deferred?jK.scheduleTask(t,n):this.tasks.scheduleTask(t,n)}shouldYield(t){return t.currentOpCount>t.getFiberRef(L4)?t.getFiberRef(Qy):!1}flush(){for(;this.tasks.buckets.length>0;){const t=this.tasks.buckets;this.tasks.buckets=[];for(const[n,r]of t)for(let i=0;i<r.length;i++)r[i]()}this.deferred=!0}}const rA=Jt(Symbol.for("effect/FiberRef/currentScheduler"),()=>Zi(jK)),zK=Jt(Symbol.for("effect/FiberRef/currentRequestMap"),()=>Zi(new Map)),ij=(e,t,n,r)=>{switch(e){case void 0:return t();case"unbounded":return n();case"inherit":return Yy(Loe,i=>i==="unbounded"?n():i>1?r(i):t());default:return e>1?r(e):t()}},iA="InterruptSignal",oA="Stateful",sA="Resume",aA="YieldNow",u1=e=>({_tag:iA,cause:e}),GS=e=>({_tag:oA,onFiber:e}),Nf=e=>({_tag:sA,effect:e}),Zle=()=>({_tag:aA}),ece="effect/FiberScope",Q0=Symbol.for(ece);class tce{[Q0]=Q0;fiberId=bd;roots=new Set;add(t,n){this.roots.add(n),n.addObserver(()=>{this.roots.delete(n)})}}class nce{fiberId;parent;[Q0]=Q0;constructor(t,n){this.fiberId=t,this.parent=n}add(t,n){this.parent.tell(GS(r=>{r.addChild(n),n.addObserver(()=>{r.removeChild(n)})}))}}const rce=e=>new nce(e.id(),e),tb=Jt(Symbol.for("effect/FiberScope/Global"),()=>new tce),ice="effect/Fiber",oce=Symbol.for(ice),sce={_E:e=>e,_A:e=>e},ace="effect/Fiber",lce=Symbol.for(ace),cce=e=>e.await,uce=e=>e.inheritAll,Gg=e=>Rx(Kd(e.await),e.inheritAll);({...jd});const dce=e=>e.poll,Tu="effect/FiberCurrent",fce="effect/Logger",hce=Symbol.for(fce),pce={_Message:e=>e,_Output:e=>e},nb=e=>({[hce]:pce,log:e,pipe(){return Xe(this,arguments)}}),mce=/^[^\s"=]*$/,gce=(e,t)=>({annotations:n,cause:r,date:i,fiberId:o,logLevel:a,message:c,spans:u})=>{const d=b=>b.match(mce)?b:e(b),h=(b,S)=>`${hK(b)}=${d(S)}`,p=(b,S)=>" "+h(b,S);let g=h("timestamp",i.toISOString());g+=p("level",a.label),g+=p("fiber",vx(o));const y=zM(c);for(let b=0;b<y.length;b++)g+=p("message",Eh(y[b],t));Wie(r)||(g+=p("cause",Zc(r,{renderErrorCause:!0})));for(const b of u)g+=" "+KR(i.getTime())(b);for(const[b,S]of n)g+=p(b,Eh(S,t));return g},yce=e=>`"${e.replace(/\\([\s\S])|(")/g,"\\$1$2")}"`,bce=nb(gce(yce)),BK=e=>{switch(typeof e){case"bigint":case"function":case"symbol":return String(e);default:return Yn(e)}},vce=(e,...t)=>{let n="";for(let r=0;r<t.length;r++)n+=`\x1B[${t[r]}m`;return n+e+"\x1B[0m"},Sce=(e,...t)=>e,fs={bold:"1",red:"31",green:"32",yellow:"33",blue:"34",cyan:"36",white:"37",gray:"90",black:"30",bgBrightRed:"101"},wce={None:[],All:[],Trace:[fs.gray],Debug:[fs.blue],Info:[fs.green],Warning:[fs.yellow],Error:[fs.red],Fatal:[fs.bgBrightRed,fs.black]},xce={None:"",All:"",Trace:"color:gray",Debug:"color:blue",Info:"color:green",Warning:"color:orange",Error:"color:red",Fatal:"background-color:red;color:white"},kce=e=>`${e.getHours().toString().padStart(2,"0")}:${e.getMinutes().toString().padStart(2,"0")}:${e.getSeconds().toString().padStart(2,"0")}.${e.getMilliseconds().toString().padStart(3,"0")}`,qK=typeof process=="object"&&process!==null&&typeof process.stdout=="object"&&process.stdout!==null,_ce=qK&&process.stdout.isTTY===!0,Ice=qK||"Deno"in globalThis,Ece=e=>{const t=e?.mode??"auto",r=(t==="auto"?Ice?"tty":"browser":t)==="browser",i=typeof e?.colors=="boolean"?e.colors:_ce||r,o=e?.formatDate??kce;return r?Cce({colors:i,formatDate:o}):Tce({colors:i,formatDate:o,stderr:e?.stderr===!0})},Tce=e=>{const t=e.colors?vce:Sce;return nb(({annotations:n,cause:r,context:i,date:o,fiberId:a,logLevel:c,message:u,spans:d})=>{const h=VR(i,zh),p=Oa(h,Fx).unsafe,g=e.stderr===!0?p.error:p.log,y=zM(u);let b=t(`[${e.formatDate(o)}]`,fs.white)+` ${t(c.label,...wce[c._tag])} (${vx(a)})`;if(gR(d)){const w=o.getTime(),x=KR(w);for(const I of d)b+=" "+x(I)}b+=":";let S=0;if(y.length>0){const w=BK(y[0]);typeof w=="string"&&(b+=" "+t(w,fs.bold,fs.cyan),S++)}if(g(b),p.group(),SR(r)||g(Zc(r,{renderErrorCause:!0})),S<y.length)for(;S<y.length;S++)g(Pg(y[S]));if(FV(n)>0)for(const[w,x]of n)g(t(`${w}:`,fs.bold,fs.white),Pg(x));p.groupEnd()})},Cce=e=>{const t=e.colors?"%c":"";return nb(({annotations:n,cause:r,context:i,date:o,fiberId:a,logLevel:c,message:u,spans:d})=>{const h=VR(i,zh),p=Oa(h,Fx).unsafe,g=zM(u);let y=`${t}[${e.formatDate(o)}]`;const b=[];if(e.colors&&b.push("color:gray"),y+=` ${t}${c.label}${t} (${vx(a)})`,e.colors&&b.push(xce[c._tag],""),gR(d)){const w=o.getTime(),x=KR(w);for(const I of d)y+=" "+x(I)}y+=":";let S=0;if(g.length>0){const w=BK(g[0]);typeof w=="string"&&(y+=` ${t}${w}`,e.colors&&b.push("color:deepskyblue"),S++)}if(p.groupCollapsed(y,...b),SR(r)||p.error(Zc(r,{renderErrorCause:!0})),S<g.length)for(;S<g.length;S++)p.log(Pg(g[S]));if(FV(n)>0)for(const[w,x]of n){const I=Pg(x);e.colors?p.log(`%c${w}:`,"color:gray",I):p.log(`${w}:`,I)}p.groupEnd()})},UK="effect/MetricBoundaries",MT=Symbol.for(UK);class Mce{values;[MT]=MT;constructor(t){this.values=t,this._hash=Y(ur(UK),Wt(Ay(this.values)))}_hash;[Ot](){return this._hash}[Tt](t){return Rce(t)&&bt(this.values,t.values)}pipe(){return Xe(this,arguments)}}const Rce=e=>ht(e,MT),Ace=e=>{const t=Y(e,xU(An(Number.POSITIVE_INFINITY)),gee);return new Mce(t)},Oce=e=>Y(JZ(e.count-1,t=>e.start*Math.pow(e.factor,t)),Xs,Ace),Dce="effect/MetricKeyType",VK=Symbol.for(Dce),KK="effect/MetricKeyType/Counter",RT=Symbol.for(KK),Pce="effect/MetricKeyType/Frequency",Nce=Symbol.for(Pce),Lce="effect/MetricKeyType/Gauge",$ce=Symbol.for(Lce),HK="effect/MetricKeyType/Histogram",AT=Symbol.for(HK),jce="effect/MetricKeyType/Summary",Fce=Symbol.for(jce),WK={_In:e=>e,_Out:e=>e};class zce{incremental;bigint;[VK]=WK;[RT]=RT;constructor(t,n){this.incremental=t,this.bigint=n,this._hash=ur(KK)}_hash;[Ot](){return this._hash}[Tt](t){return GK(t)}pipe(){return Xe(this,arguments)}}class Bce{boundaries;[VK]=WK;[AT]=AT;constructor(t){this.boundaries=t,this._hash=Y(ur(HK),Wt(tt(this.boundaries)))}_hash;[Ot](){return this._hash}[Tt](t){return YK(t)&&bt(this.boundaries,t.boundaries)}pipe(){return Xe(this,arguments)}}const qce=e=>new zce(e?.incremental??!1,e?.bigint??!1),Uce=e=>new Bce(e),GK=e=>ht(e,RT),Vce=e=>ht(e,Nce),Kce=e=>ht(e,$ce),YK=e=>ht(e,AT),Hce=e=>ht(e,Fce),Wce="effect/MetricKey",QK=Symbol.for(Wce),Gce={_Type:e=>e},Yce=qM(bt);class lA{name;keyType;description;tags;[QK]=Gce;constructor(t,n,r,i=[]){this.name=t,this.keyType=n,this.description=r,this.tags=i,this._hash=Y(ur(this.name+this.description),Wt(tt(this.keyType)),Wt(Ay(this.tags)))}_hash;[Ot](){return this._hash}[Tt](t){return Qce(t)&&this.name===t.name&&bt(this.keyType,t.keyType)&&bt(this.description,t.description)&&Yce(this.tags,t.tags)}pipe(){return Xe(this,arguments)}}const Qce=e=>ht(e,QK),Xce=(e,t)=>new lA(e,qce(t),Dy(t?.description)),Jce=(e,t,n)=>new lA(e,Uce(t),Dy(n)),Zce=G(2,(e,t)=>t.length===0?e:new lA(e.name,e.keyType,e.description,VS(e.tags,t))),eue="effect/MetricState",rb=Symbol.for(eue),XK="effect/MetricState/Counter",OT=Symbol.for(XK),JK="effect/MetricState/Frequency",DT=Symbol.for(JK),ZK="effect/MetricState/Gauge",PT=Symbol.for(ZK),e5="effect/MetricState/Histogram",NT=Symbol.for(e5),t5="effect/MetricState/Summary",LT=Symbol.for(t5),ib={_A:e=>e};class tue{count;[rb]=ib;[OT]=OT;constructor(t){this.count=t}[Ot](){return Y(tt(XK),Wt(tt(this.count)),ir(this))}[Tt](t){return fue(t)&&this.count===t.count}pipe(){return Xe(this,arguments)}}const nue=qM(bt);class rue{occurrences;[rb]=ib;[DT]=DT;constructor(t){this.occurrences=t}_hash;[Ot](){return Y(ur(JK),Wt(Ay(Kn(this.occurrences.entries()))),ir(this))}[Tt](t){return hue(t)&&nue(Kn(this.occurrences.entries()),Kn(t.occurrences.entries()))}pipe(){return Xe(this,arguments)}}class iue{value;[rb]=ib;[PT]=PT;constructor(t){this.value=t}[Ot](){return Y(tt(ZK),Wt(tt(this.value)),ir(this))}[Tt](t){return pue(t)&&this.value===t.value}pipe(){return Xe(this,arguments)}}class oue{buckets;count;min;max;sum;[rb]=ib;[NT]=NT;constructor(t,n,r,i,o){this.buckets=t,this.count=n,this.min=r,this.max=i,this.sum=o}[Ot](){return Y(tt(e5),Wt(tt(this.buckets)),Wt(tt(this.count)),Wt(tt(this.min)),Wt(tt(this.max)),Wt(tt(this.sum)),ir(this))}[Tt](t){return mue(t)&&bt(this.buckets,t.buckets)&&this.count===t.count&&this.min===t.min&&this.max===t.max&&this.sum===t.sum}pipe(){return Xe(this,arguments)}}class sue{error;quantiles;count;min;max;sum;[rb]=ib;[LT]=LT;constructor(t,n,r,i,o,a){this.error=t,this.quantiles=n,this.count=r,this.min=i,this.max=o,this.sum=a}[Ot](){return Y(tt(t5),Wt(tt(this.error)),Wt(tt(this.quantiles)),Wt(tt(this.count)),Wt(tt(this.min)),Wt(tt(this.max)),Wt(tt(this.sum)),ir(this))}[Tt](t){return gue(t)&&this.error===t.error&&bt(this.quantiles,t.quantiles)&&this.count===t.count&&this.min===t.min&&this.max===t.max&&this.sum===t.sum}pipe(){return Xe(this,arguments)}}const aue=e=>new tue(e),lue=e=>new rue(e),cue=e=>new iue(e),uue=e=>new oue(e.buckets,e.count,e.min,e.max,e.sum),due=e=>new sue(e.error,e.quantiles,e.count,e.min,e.max,e.sum),fue=e=>ht(e,OT),hue=e=>ht(e,DT),pue=e=>ht(e,PT),mue=e=>ht(e,NT),gue=e=>ht(e,LT),yue="effect/MetricHook",bue=Symbol.for(yue),vue={_In:e=>e,_Out:e=>e},ob=e=>({[bue]:vue,pipe(){return Xe(this,arguments)},...e}),oj=BigInt(0),Sue=e=>{let t=e.keyType.bigint?oj:0;const n=e.keyType.incremental?e.keyType.bigint?i=>i>=oj:i=>i>=0:i=>!0,r=i=>{n(i)&&(t=t+i)};return ob({get:()=>aue(t),update:r,modify:r})},wue=e=>{const t=new Map;for(const r of e.keyType.preregisteredWords)t.set(r,0);const n=r=>{const i=t.get(r)??0;t.set(r,i+1)};return ob({get:()=>lue(t),update:n,modify:n})},xue=(e,t)=>{let n=t;return ob({get:()=>cue(n),update:r=>{n=r},modify:r=>{n=n+r}})},kue=e=>{const t=e.keyType.boundaries.values,n=t.length,r=new Uint32Array(n+1),i=new Float64Array(n);let o=0,a=0,c=Number.MAX_VALUE,u=Number.MIN_VALUE;Y(t,Ng(Ch),Yu((p,g)=>{i[g]=p}));const d=p=>{let g=0,y=n;for(;g!==y;){const b=Math.floor(g+(y-g)/2),S=i[b];p<=S?y=b:g=b,y===g+1&&(p<=i[g]?y=g:g=y)}r[g]=r[g]+1,o=o+1,a=a+p,p<c&&(c=p),p>u&&(u=p)},h=()=>{const p=ox(n);let g=0;for(let y=0;y<n;y++){const b=i[y],S=r[y];g=g+S,p[y]=[b,g]}return p};return ob({get:()=>uue({buckets:h(),count:o,min:c,max:u,sum:a}),update:d,modify:d})},_ue=e=>{const{error:t,maxAge:n,maxSize:r,quantiles:i}=e.keyType,o=Y(i,Ng(Ch)),a=ox(r);let c=0,u=0,d=0,h=0,p=0;const g=b=>{const S=[];let w=0;for(;w!==r-1;){const x=a[w];if(x!=null){const[I,_]=x,M=Il(b-I);yne(M,hd)&&mne(M,n)&&S.push(_)}w=w+1}return Iue(t,o,Ng(S,Ch))},y=(b,S)=>{if(r>0){c=c+1;const w=c%r;a[w]=[S,b]}h=u===0?b:Math.min(h,b),p=u===0?b:Math.max(p,b),u=u+1,d=d+b};return ob({get:()=>due({error:t,quantiles:g(Date.now()),count:u,min:h,max:p,sum:d}),update:([b,S])=>y(b,S),modify:([b,S])=>y(b,S)})},Iue=(e,t,n)=>{const r=n.length;if(!Ir(t))return cd();const i=t[0],o=t.slice(1),a=sj(e,r,Oe(),0,i,n),c=$s(a);return o.forEach(u=>{c.push(sj(e,r,a.value,a.consumed,u,a.rest))}),Yu(c,u=>[u.quantile,u.value])},sj=(e,t,n,r,i,o)=>{let a=e,c=t,u=n,d=r,h=i,p=o,g=e,y=t,b=n,S=r,w=i,x=o;for(;;){if(!Ir(p))return{quantile:h,value:Oe(),consumed:d,rest:[]};if(h===1)return{quantile:h,value:De(IU(p)),consumed:d+p.length,rest:[]};const I=Qi(p),_=lee(p,A=>A===I),M=h*c,C=a/2*M,E=d+_[0].length,T=Math.abs(E-M);if(E<M-C){g=a,y=c,b=mg(p),S=E,w=h,x=_[1],a=g,c=y,u=b,d=S,h=w,p=x;continue}if(E>M+C){const A=Zt(u)?De(I):u;return{quantile:h,value:A,consumed:d,rest:p}}switch(u._tag){case"None":{g=a,y=c,b=mg(p),S=E,w=h,x=_[1],a=g,c=y,u=b,d=S,h=w,p=x;continue}case"Some":{const A=Math.abs(M-u.value);if(T<A){g=a,y=c,b=mg(p),S=E,w=h,x=_[1],a=g,c=y,u=b,d=S,h=w,p=x;continue}return{quantile:h,value:De(u.value),consumed:d,rest:p}}}}throw new Error("BUG: MetricHook.resolveQuantiles - please report an issue at https://github.com/Effect-TS/effect/issues")},Eue="effect/MetricPair",Tue=Symbol.for(Eue),Cue={_Type:e=>e},Mue=(e,t)=>({[Tue]:Cue,metricKey:e,metricState:t,pipe(){return Xe(this,arguments)}}),Rue="effect/MetricRegistry",aj=Symbol.for(Rue);class Aue{[aj]=aj;map=cse();snapshot(){const t=[];for(const[n,r]of this.map)t.push(Mue(n,r.get()));return t}get(t){const n=Y(this.map,Nu(t),Ti);if(n==null){if(GK(t.keyType))return this.getCounter(t);if(Kce(t.keyType))return this.getGauge(t);if(Vce(t.keyType))return this.getFrequency(t);if(YK(t.keyType))return this.getHistogram(t);if(Hce(t.keyType))return this.getSummary(t);throw new Error("BUG: MetricRegistry.get - unknown MetricKeyType - please report an issue at https://github.com/Effect-TS/effect/issues")}else return n}getCounter(t){let n=Y(this.map,Nu(t),Ti);if(n==null){const r=Sue(t);Y(this.map,Am(t))||Y(this.map,Om(t,r)),n=r}return n}getFrequency(t){let n=Y(this.map,Nu(t),Ti);if(n==null){const r=wue(t);Y(this.map,Am(t))||Y(this.map,Om(t,r)),n=r}return n}getGauge(t){let n=Y(this.map,Nu(t),Ti);if(n==null){const r=xue(t,t.keyType.bigint?BigInt(0):0);Y(this.map,Am(t))||Y(this.map,Om(t,r)),n=r}return n}getHistogram(t){let n=Y(this.map,Nu(t),Ti);if(n==null){const r=kue(t);Y(this.map,Am(t))||Y(this.map,Om(t,r)),n=r}return n}getSummary(t){let n=Y(this.map,Nu(t),Ti);if(n==null){const r=_ue(t);Y(this.map,Am(t))||Y(this.map,Om(t,r)),n=r}return n}}const Oue=()=>new Aue,Due="effect/Metric",Pue=Symbol.for(Due),Nue={_Type:e=>e,_In:e=>e,_Out:e=>e},lj=Jt(Symbol.for("effect/Metric/globalMetricRegistry"),()=>Oue()),n5=function(e,t,n,r){const i=Object.assign(o=>Hy(o,a=>Fue(i,a)),{[Pue]:Nue,keyType:e,unsafeUpdate:t,unsafeValue:n,unsafeModify:r,register(){return this.unsafeValue([]),this},pipe(){return Xe(this,arguments)}});return i},Ux=(e,t)=>r5(Xce(e,t)),r5=e=>{let t;const n=new WeakMap,r=i=>{if(i.length===0)return t!==void 0||(t=lj.get(e)),t;let o=n.get(i);return o!==void 0||(o=lj.get(Zce(e,i)),n.set(i,o)),o};return n5(e.keyType,(i,o)=>r(o).update(i),i=>r(i).get(),(i,o)=>r(o).modify(i))},Lue=(e,t,n)=>r5(Jce(e,t,n)),$ue=G(3,(e,t,n)=>jue(e,[zae(t,n)])),jue=G(2,(e,t)=>n5(e.keyType,(n,r)=>e.unsafeUpdate(n,VS(t,r)),n=>e.unsafeValue(VS(t,n)),(n,r)=>e.unsafeModify(n,VS(t,r)))),Fue=G(2,(e,t)=>Yy(mT,n=>Te(()=>e.unsafeUpdate(t,n))));({...jM});const zue=G(2,(e,t)=>Yy(zK,n=>Te(()=>{if(n.has(e)){const r=n.get(e);r.state.completed||(r.state.completed=!0,Lx(r.result,t))}}))),Bue="effect/Supervisor",Vx=Symbol.for(Bue),cA={_T:e=>e};class Kx{underlying;value0;[Vx]=cA;constructor(t,n){this.underlying=t,this.value0=n}get value(){return this.value0}onStart(t,n,r,i){this.underlying.onStart(t,n,r,i)}onEnd(t,n){this.underlying.onEnd(t,n)}onEffect(t,n){this.underlying.onEffect(t,n)}onSuspend(t){this.underlying.onSuspend(t)}onResume(t){this.underlying.onResume(t)}map(t){return new Kx(this,Y(this.value,ft(t)))}zip(t){return new Hx(this,t)}}class Hx{left;right;_tag="Zip";[Vx]=cA;constructor(t,n){this.left=t,this.right=n}get value(){return M4(this.left.value,this.right.value)}onStart(t,n,r,i){this.left.onStart(t,n,r,i),this.right.onStart(t,n,r,i)}onEnd(t,n){this.left.onEnd(t,n),this.right.onEnd(t,n)}onEffect(t,n){this.left.onEffect(t,n),this.right.onEffect(t,n)}onSuspend(t){this.left.onSuspend(t),this.right.onSuspend(t)}onResume(t){this.left.onResume(t),this.right.onResume(t)}map(t){return new Kx(this,Y(this.value,ft(t)))}zip(t){return new Hx(this,t)}}const i5=e=>ht(e,Vx)&&Qq(e,"Zip");class que{effect;[Vx]=cA;constructor(t){this.effect=t}get value(){return this.effect}onStart(t,n,r,i){}onEnd(t,n){}onEffect(t,n){}onSuspend(t){}onResume(t){}map(t){return new Kx(this,Y(this.value,ft(t)))}zip(t){return new Hx(this,t)}onRun(t,n){return t()}}const Uue=e=>new que(e),Wx=Jt("effect/Supervisor/none",()=>Uue(bn)),Vue=sp,o5="Empty",s5="AddSupervisor",a5="RemoveSupervisor",l5="AndThen",yg={_tag:o5},YS=(e,t)=>({_tag:l5,first:e,second:t}),Kue=(e,t)=>Hue(t,An(e)),Hue=(e,t)=>{let n=e,r=t;for(;_l(r);){const i=va(r);switch(i._tag){case o5:{r=pl(r);break}case s5:{n=n.zip(i.supervisor),r=pl(r);break}case a5:{n=$T(n,i.supervisor),r=pl(r);break}case l5:{r=ai(i.first)(ai(i.second)(pl(r)));break}}}return n},$T=(e,t)=>bt(e,t)?Wx:i5(e)?$T(e.left,t).zip($T(e.right,t)):e,X0=e=>bt(e,Wx)?gd():i5(e)?Y(X0(e.left),jg(X0(e.right))):dR(e),Wue=(e,t)=>{if(bt(e,t))return yg;const n=X0(e),r=X0(t),i=Y(r,b$(n),Fg(yg,(a,c)=>YS(a,{_tag:s5,supervisor:c}))),o=Y(n,b$(r),Fg(yg,(a,c)=>YS(a,{_tag:a5,supervisor:c})));return YS(i,o)},Gue=Vue({empty:yg,patch:Kue,combine:YS,diff:Wue}),Yue=Ux("effect_fiber_started",{incremental:!0}),cj=Ux("effect_fiber_active"),Que=Ux("effect_fiber_successes",{incremental:!0}),Xue=Ux("effect_fiber_failures",{incremental:!0}),Jue=$ue(Lue("effect_fiber_lifetimes",Oce({start:.5,factor:2,count:35})),"time_unit","milliseconds"),Dm="Continue",Zue="Done",uj="Yield",ede={_E:e=>e,_A:e=>e},Gv=e=>{throw new Error(`BUG: FiberRuntime - ${Eh(e)} - please report an issue at https://github.com/Effect-TS/effect/issues`)},sl=Symbol.for("effect/internal/fiberRuntime/YieldedOp"),al=Jt("effect/internal/fiberRuntime/yieldedOpChannel",()=>({currentOp:null})),Pm={[E0]:(e,t,n)=>Ui(()=>t.effect_instruction_i1(n)),OnStep:(e,t,n)=>dr(dr(n)),[T0]:(e,t,n)=>Ui(()=>t.effect_instruction_i2(n)),[LM]:(e,t,n)=>(e.patchRuntimeFlags(e.currentRuntimeFlags,t.patch),xc(e.currentRuntimeFlags)&&e.isInterrupted()?un(e.getInterruptedCause()):dr(n)),[C0]:(e,t,n)=>(Ui(()=>t.effect_instruction_i2(n)),Ui(()=>t.effect_instruction_i0())?(e.pushStack(t),Ui(()=>t.effect_instruction_i1())):bn),[pg]:(e,t,n)=>{for(;;){const r=Ui(()=>t.effect_instruction_i0.next(n));if(r.done)return dr(r.value);const i=hZ(r.value);if(Ox(i)){if(i._tag==="Failure")return i}else return e.pushStack(t),i;n=i.value}}},tde={[iA]:(e,t,n,r)=>(e.processNewInterruptSignal(r.cause),xc(t)?un(r.cause):n),[sA]:(e,t,n,r)=>{throw new Error("It is illegal to have multiple concurrent run loops in a single fiber")},[oA]:(e,t,n,r)=>(r.onFiber(e,MK(t)),n),[aA]:(e,t,n,r)=>ke(Wy(),()=>n)},nde=e=>Ex(Aie(e),t=>Gs(Kie(t),([n,r])=>{const i=new Map,o=[];for(const c of r){o.push(Ws(c));for(const u of c)i.set(u.request,u)}const a=o.flat();return dp(kde(n.runAll(o),a,()=>a.forEach(c=>{c.listeners.interrupted=!0})),zK,i)},!1,!1)),rde=$M();class c5 extends gp{[oce]=sce;[lce]=ede;_fiberRefs;_fiberId;_queue=new Array;_children=null;_observers=new Array;_running=!1;_stack=[];_asyncInterruptor=null;_asyncBlockingOn=null;_exitValue=null;_steps=[];_isYielding=!1;currentRuntimeFlags;currentOpCount=0;currentSupervisor;currentScheduler;currentTracer;currentSpan;currentContext;currentDefaultServices;constructor(t,n,r){if(super(),this.currentRuntimeFlags=r,this._fiberId=t,this._fiberRefs=n,k$(r)){const i=this.getFiberRef(mT);Yue.unsafeUpdate(1,i),cj.unsafeUpdate(1,i)}this.refreshRefCache()}commit(){return Gg(this)}id(){return this._fiberId}resume(t){this.tell(Nf(t))}get status(){return this.ask((t,n)=>n)}get runtimeFlags(){return this.ask((t,n)=>kle(n)?t.currentRuntimeFlags:n.runtimeFlags)}scope(){return rce(this)}get children(){return this.ask(t=>Array.from(t.getChildren()))}getChildren(){return this._children===null&&(this._children=new Set),this._children}getInterruptedCause(){return this.getFiberRef(Hv)}fiberRefs(){return this.ask(t=>t.getFiberRefs())}ask(t){return mt(()=>{const n=hp(this._fiberId);return this.tell(GS((r,i)=>{Lx(n,Te(()=>t(r,i)))})),Zs(n)})}tell(t){this._queue.push(t),this._running||(this._running=!0,this.drainQueueLaterOnExecutor())}get await(){return Js(t=>{const n=r=>t(Re(r));return this.tell(GS((r,i)=>{r._exitValue!==null?n(this._exitValue):r.addObserver(n)})),Te(()=>this.tell(GS((r,i)=>{r.removeObserver(n)})))},this.id())}get inheritAll(){return Bt((t,n)=>{const r=t.id(),i=t.getFiberRefs(),o=n.runtimeFlags,a=this.getFiberRefs(),c=bae(i,r,a);t.setFiberRefs(c);const u=t.getFiberRef(pj),d=Y(Ju(o,u),I$(qd),I$(fT));return voe(d)})}get poll(){return Te(()=>Dy(this._exitValue))}unsafePoll(){return this._exitValue}interruptAsFork(t){return Te(()=>this.tell(u1(ms(t))))}unsafeInterruptAsFork(t){this.tell(u1(ms(t)))}addObserver(t){this._exitValue!==null?t(this._exitValue):this._observers.push(t)}removeObserver(t){this._observers=this._observers.filter(n=>n!==t)}getFiberRefs(){return this.setFiberRef(pj,this.currentRuntimeFlags),this._fiberRefs}unsafeDeleteFiberRef(t){this._fiberRefs=lK(this._fiberRefs,t)}getFiberRef(t){return this._fiberRefs.locals.has(t)?this._fiberRefs.locals.get(t)[0][1]:t.initial}setFiberRef(t,n){this._fiberRefs=ST(this._fiberRefs,{fiberId:this._fiberId,fiberRef:t,value:n}),this.refreshRefCache()}refreshRefCache(){this.currentDefaultServices=this.getFiberRef(zh),this.currentTracer=this.currentDefaultServices.unsafeMap.get(iK.key),this.currentSupervisor=this.getFiberRef(wde),this.currentScheduler=this.getFiberRef(rA),this.currentContext=this.getFiberRef(eu),this.currentSpan=this.currentContext.unsafeMap.get(oK.key)}setFiberRefs(t){this._fiberRefs=t,this.refreshRefCache()}addChild(t){this.getChildren().add(t)}removeChild(t){this.getChildren().delete(t)}transferChildren(t){const n=this._children;if(this._children=null,n!==null&&n.size>0)for(const r of n)r._exitValue===null&&t.add(this.currentRuntimeFlags,r)}drainQueueOnCurrentThread(){let t=!0;for(;t;){let n=Dm;const r=globalThis[Tu];globalThis[Tu]=this;try{for(;n===Dm;)n=this._queue.length===0?Zue:this.evaluateMessageWhileSuspended(this._queue.splice(0,1)[0])}finally{this._running=!1,globalThis[Tu]=r}this._queue.length>0&&!this._running?(this._running=!0,n===uj?(this.drainQueueLaterOnExecutor(),t=!1):t=!0):t=!1}}drainQueueLaterOnExecutor(){this.currentScheduler.scheduleTask(this.run,this.getFiberRef(Qy))}drainQueueWhileRunning(t,n){let r=n;for(;this._queue.length>0;){const i=this._queue.splice(0,1)[0];r=tde[i._tag](this,t,r,i)}return r}isInterrupted(){return!SR(this.getFiberRef(Hv))}addInterruptedCause(t){const n=this.getFiberRef(Hv);this.setFiberRef(Hv,ni(n,t))}processNewInterruptSignal(t){this.addInterruptedCause(t),this.sendInterruptSignalToAllChildren()}sendInterruptSignalToAllChildren(){if(this._children===null||this._children.size===0)return!1;let t=!1;for(const n of this._children)n.tell(u1(ms(this.id()))),t=!0;return t}interruptAllChildren(){if(this.sendInterruptSignalToAllChildren()){const t=this._children.values();this._children=null;let n=!1;return kR({while:()=>!n,body:()=>{const i=t.next();return i.done?Te(()=>{n=!0}):Ni(i.value.await)},step:()=>{}})}return null}reportExitValue(t){if(k$(this.currentRuntimeFlags)){const n=this.getFiberRef(mT),r=this.id().startTimeMillis,i=Date.now();switch(Jue.unsafeUpdate(i-r,n),cj.unsafeUpdate(-1,n),t._tag){case si:{Que.unsafeUpdate(1,n);break}case oi:{Xue.unsafeUpdate(1,n);break}}}if(t._tag==="Failure"){const n=this.getFiberRef(joe);!xx(t.cause)&&n._tag==="Some"&&this.log("Fiber terminated with an unhandled error",t.cause,n)}}setExitValue(t){this._exitValue=t,this.reportExitValue(t);for(let n=this._observers.length-1;n>=0;n--)this._observers[n](t);this._observers=[]}getLoggers(){return this.getFiberRef(Gx)}log(t,n,r){const i=Ce(r)?r.value:this.getFiberRef(j4),o=this.getFiberRef(ide);if(Mae(o,i))return;const a=this.getFiberRef(Poe),c=this.getFiberRef($4),u=this.getLoggers(),d=this.getFiberRefs();if(fR(u)>0){const h=Oa(this.getFiberRef(zh),jx),p=new Date(h.unsafeCurrentTimeMillis());SZ(d,()=>{for(const g of u)g.log({fiberId:this.id(),logLevel:i,message:t,cause:n,context:d,spans:a,annotations:c,date:p})})}}evaluateMessageWhileSuspended(t){switch(t._tag){case aA:return uj;case iA:return this.processNewInterruptSignal(t.cause),this._asyncInterruptor!==null&&(this._asyncInterruptor(un(t.cause)),this._asyncInterruptor=null),Dm;case sA:return this._asyncInterruptor=null,this._asyncBlockingOn=null,this.evaluateEffect(t.effect),Dm;case oA:return t.onFiber(this,this._exitValue!==null?wle:xle(this.currentRuntimeFlags,this._asyncBlockingOn)),Dm;default:return Gv(t)}}evaluateEffect(t){this.currentSupervisor.onResume(this);try{let n=xc(this.currentRuntimeFlags)&&this.isInterrupted()?un(this.getInterruptedCause()):t;for(;n!==null;){const r=n,i=this.runLoop(r);if(i===sl){const o=al.currentOp;al.currentOp=null,o._op===qS?Iie(this.currentRuntimeFlags)?(this.tell(Zle()),this.tell(Nf(gs)),n=null):n=gs:o._op===hg&&(n=null)}else{this.currentRuntimeFlags=Y(this.currentRuntimeFlags,Tie(fT));const o=this.interruptAllChildren();o!==null?n=ke(o,()=>i):(this._queue.length===0?this.setExitValue(i):this.tell(Nf(i)),n=null)}}}finally{this.currentSupervisor.onSuspend(this)}}start(t){if(this._running)this.tell(Nf(t));else{this._running=!0;const n=globalThis[Tu];globalThis[Tu]=this;try{this.evaluateEffect(t)}finally{this._running=!1,globalThis[Tu]=n,this._queue.length>0&&this.drainQueueLaterOnExecutor()}}}startFork(t){this.tell(Nf(t))}patchRuntimeFlags(t,n){const r=dh(t,n);return globalThis[Tu]=this,this.currentRuntimeFlags=r,r}initiateAsync(t,n){let r=!1;const i=o=>{r||(r=!0,this.tell(Nf(o)))};xc(t)&&(this._asyncInterruptor=i);try{n(i)}catch(o){i(Er(qo(o)))}}pushStack(t){this._stack.push(t),t._op==="OnStep"&&this._steps.push({refs:this.getFiberRefs(),flags:this.currentRuntimeFlags})}popStack(){const t=this._stack.pop();if(t)return t._op==="OnStep"&&this._steps.pop(),t}getNextSuccessCont(){let t=this.popStack();for(;t;){if(t._op!==BS)return t;t=this.popStack()}}getNextFailCont(){let t=this.popStack();for(;t;){if(t._op!==E0&&t._op!==C0&&t._op!==pg)return t;t=this.popStack()}}[wZ](t){return Te(()=>pV(this.currentContext,t))}Left(t){return Lr(t.left)}None(t){return Lr(new ER)}Right(t){return dr(t.right)}Some(t){return dr(t.value)}Micro(t){return j0(n=>{let r=n;const i=Xle(Vle(t,this.currentContext));return i.addObserver(o=>{if(o._tag==="Success")return r(dr(o.value));switch(o.cause._tag){case"Interrupt":return r(un(ms(bd)));case"Fail":return r(Lr(o.cause.error));case"Die":return r(Sa(o.cause.defect))}}),j0(o=>{r=a=>{o(bn)},i.unsafeInterrupt()})})}[oU](t){const n=Ui(()=>t.effect_instruction_i0()),r=this.getNextSuccessCont();return r!==void 0?(r._op in Pm||Gv(r),Pm[r._op](this,r,n)):(al.currentOp=dr(n),sl)}[si](t){const n=t,r=this.getNextSuccessCont();return r!==void 0?(r._op in Pm||Gv(r),Pm[r._op](this,r,n.effect_instruction_i0)):(al.currentOp=n,sl)}[oi](t){const n=t.effect_instruction_i0,r=this.getNextFailCont();if(r!==void 0)switch(r._op){case BS:case T0:return xc(this.currentRuntimeFlags)&&this.isInterrupted()?un(E$(n)):Ui(()=>r.effect_instruction_i1(n));case"OnStep":return xc(this.currentRuntimeFlags)&&this.isInterrupted()?un(E$(n)):dr(un(n));case LM:return this.patchRuntimeFlags(this.currentRuntimeFlags,r.patch),xc(this.currentRuntimeFlags)&&this.isInterrupted()?un(ni(n,this.getInterruptedCause())):un(n);default:Gv(r)}else return al.currentOp=un(n),sl}[sU](t){return Ui(()=>t.effect_instruction_i0(this,MK(this.currentRuntimeFlags)))}Blocked(t){const n=this.getFiberRefs(),r=this.currentRuntimeFlags;if(this._steps.length>0){const i=[],o=this._steps[this._steps.length-1];let a=this.popStack();for(;a&&a._op!=="OnStep";)i.push(a),a=this.popStack();this.setFiberRefs(o.refs),this.currentRuntimeFlags=o.flags;const c=Hg(o.refs,n),u=Ju(o.flags,r);return dr(m4(t.effect_instruction_i0,Bt(d=>{for(;i.length>0;)d.pushStack(i.pop());return d.setFiberRefs(Wg(d.id(),d.getFiberRefs())(c)),d.currentRuntimeFlags=dh(u)(d.currentRuntimeFlags),t.effect_instruction_i1})))}return ks(i=>ke(Yx(hoe(t.effect_instruction_i0)),()=>i(t.effect_instruction_i1)))}RunBlocked(t){return nde(t.effect_instruction_i0)}[np](t){const n=t.effect_instruction_i0,r=this.currentRuntimeFlags,i=dh(r,n);if(xc(i)&&this.isInterrupted())return un(this.getInterruptedCause());if(this.patchRuntimeFlags(this.currentRuntimeFlags,n),t.effect_instruction_i1){const o=Ju(i,r);return this.pushStack(new poe(o,t)),Ui(()=>t.effect_instruction_i1(r))}else return gs}[E0](t){return this.pushStack(t),t.effect_instruction_i0}OnStep(t){return this.pushStack(t),t.effect_instruction_i0}[BS](t){return this.pushStack(t),t.effect_instruction_i0}[T0](t){return this.pushStack(t),t.effect_instruction_i0}[hg](t){return this._asyncBlockingOn=t.effect_instruction_i1,this.initiateAsync(this.currentRuntimeFlags,t.effect_instruction_i0),al.currentOp=t,sl}[qS](t){return this._isYielding=!1,al.currentOp=t,sl}[C0](t){const n=t.effect_instruction_i0,r=t.effect_instruction_i1;return n()?(this.pushStack(t),r()):gs}[pg](t){return Pm[pg](this,t,void 0)}[rx](t){return Ui(()=>t.commit())}runLoop(t){let n=t;for(this.currentOpCount=0;;){if((this.currentRuntimeFlags&_ie)!==0&&this.currentSupervisor.onEffect(this,n),this._queue.length>0&&(n=this.drainQueueWhileRunning(this.currentRuntimeFlags,n)),!this._isYielding){this.currentOpCount+=1;const r=this.currentScheduler.shouldYield(this);if(r!==!1){this._isYielding=!0,this.currentOpCount=0;const i=n;n=ke(Wy({priority:r}),()=>i)}}try{if(n=this.currentTracer.context(()=>{if(rde!==n[jh]._V){const r=this.getFiberRef(Foe);if(r._tag==="Some"){const i=n[jh]._V;this.log(`Executing an Effect versioned ${i} with a Runtime of version ${$M()}, you may want to dedupe the effect dependencies, you can use the language service plugin to detect this at compile time: https://github.com/Effect-TS/language-service`,El,r)}}return this[n._op](n)},this),n===sl){const r=al.currentOp;return r._op===qS||r._op===hg?sl:(al.currentOp=null,r._op===si||r._op===oi?r:un(qo(r)))}}catch(r){n!==sl&&!ht(n,"_op")||!(n._op in this)?n=x4(`Not a valid effect: ${Eh(n)}`):qoe(r)?n=un(ni(qo(r),ms(bd))):n=Sa(r)}}}run=()=>{this.drainQueueOnCurrentThread()}}const ide=Jt("effect/FiberRef/currentMinimumLogLevel",()=>Zi(Rae("Info"))),ode=e=>nb(t=>{const n=VR(t.context,zh);Oa(n,Fx).unsafe.log(e.log(t))}),u5=Jt(Symbol.for("effect/Logger/defaultLogger"),()=>ode(bce)),sde=Jt(Symbol.for("effect/Logger/tracerLogger"),()=>nb(({annotations:e,cause:t,context:n,fiberId:r,logLevel:i,message:o})=>{const a=Ai(Kg(n,eu),oK);if(a._tag==="None"||a.value._tag==="ExternalSpan")return;const c=pV(Kg(n,zh),jx),u={};for(const[d,h]of e)u[d]=h;u["effect.fiberId"]=fre(r),u["effect.logLevel"]=i.label,t!==null&&t._tag!=="Empty"&&(u["effect.cause"]=Zc(t,{renderErrorCause:!0})),a.value.event(Eh(Array.isArray(o)&&o.length===1?o[0]:o),c.unsafeCurrentTimeNanos(),u)})),Gx=Jt(Symbol.for("effect/FiberRef/currentLoggers"),()=>Aoe(dR(u5,sde))),uA=G(e=>$a(e[0]),(e,t)=>Hd(Hy(e,n=>d5(r=>t(n,r))))),d5=e=>Bt(t=>{const n=t.getFiberRefs(),r=Eie(t.currentRuntimeFlags,qd);return ke(h5,i=>z0(i,o=>Bt(a=>{const c=a.getFiberRefs(),u=a.currentRuntimeFlags,d=Hg(c,n),h=Ju(u,r),p=Hg(n,c);return a.setFiberRefs(Wg(d,a.id(),n)),Yg(woe(e(o),h),Te(()=>{a.setFiberRefs(Wg(p,a.id(),a.getFiberRefs()))}))})))}),ade=e=>{if(Array.isArray(e)||Xq(e))return[e,Oe()];const t=Object.keys(e),n=t.length;return[t.map(r=>e[r]),De(r=>{const i={};for(let o=0;o<n;o++)i[t[o]]=r[o];return i})]},lde=(e,t,n)=>{const r=[];for(const i of e)r.push(Fh(i));return ke(Uh(r,Lt,{concurrency:n?.concurrency,batching:n?.batching,concurrentFinalizers:n?.concurrentFinalizers}),i=>{const o=Oe(),a=i.length,c=new Array(a),u=new Array(a);let d=!1;for(let h=0;h<a;h++){const p=i[h];p._tag==="Left"?(c[h]=De(p.left),d=!0):(u[h]=p.right,c[h]=o)}return d?t._tag==="Some"?Lr(t.value(c)):Lr(c):n?.discard?bn:t._tag==="Some"?Re(t.value(u)):Re(u)})},cde=(e,t,n)=>{const r=[];for(const i of e)r.push(Fh(i));return n?.discard?Uh(r,Lt,{concurrency:n?.concurrency,batching:n?.batching,discard:!0,concurrentFinalizers:n?.concurrentFinalizers}):ft(Uh(r,Lt,{concurrency:n?.concurrency,batching:n?.batching,concurrentFinalizers:n?.concurrentFinalizers}),i=>t._tag==="Some"?t.value(i):i)},dA=(e,t)=>{const[n,r]=ade(e);return t?.mode==="validate"?lde(n,r,t):t?.mode==="either"?cde(n,r,t):t?.discard!==!0&&r._tag==="Some"?ft(Uh(n,Lt,t),r.value):Uh(n,Lt,t)},Uh=G(e=>Xq(e[0]),(e,t,n)=>Bt(r=>{const i=n?.batching===!0||n?.batching==="inherit"&&r.getFiberRef($oe);return n?.discard?ij(n.concurrency,()=>Lf(K0,n?.concurrentFinalizers)(o=>i?Gs(e,(a,c)=>o(t(a,c)),!0,!1,1):Ex(e,(a,c)=>o(t(a,c)))),()=>Lf(IT,n?.concurrentFinalizers)(o=>Gs(e,(a,c)=>o(t(a,c)),i,!1)),o=>Lf(ET(o),n?.concurrentFinalizers)(a=>Gs(e,(c,u)=>a(t(c,u)),i,!1,o))):ij(n?.concurrency,()=>Lf(K0,n?.concurrentFinalizers)(o=>i?jT(e,1,(a,c)=>o(t(a,c)),!0):ml(e,(a,c)=>o(t(a,c)))),()=>Lf(IT,n?.concurrentFinalizers)(o=>fA(e,(a,c)=>o(t(a,c)),i)),o=>Lf(ET(o),n?.concurrentFinalizers)(a=>jT(e,o,(c,u)=>a(t(c,u)),i)))})),fA=(e,t,n)=>mt(()=>{const r=Kn(e),i=new Array(r.length);return Wr(Gs(r,(a,c)=>ke(t(a,c),u=>Te(()=>i[c]=u)),n,!1),Re(i))}),Gs=(e,t,n,r,i)=>ks(o=>boe(a=>Bt(c=>{let u=Array.from(e).reverse(),d=u.length;if(d===0)return bn;let h=0,p=!1;const g=i?Math.min(u.length,i):u.length,y=new Set,b=new Array,S=()=>y.forEach(A=>{A.currentScheduler.scheduleTask(()=>{A.unsafeInterruptAsFork(c.id())},0)}),w=new Array,x=new Array,I=new Array,_=()=>{const A=b.filter(({exit:U})=>U._tag==="Failure").sort((U,R)=>U.index<R.index?-1:U.index===R.index?0:1).map(({exit:U})=>U);return A.length===0&&A.push(gs),A},M=(A,U=!1)=>{const R=Hd(a(A)),N=dde(R,c,c.currentRuntimeFlags,tb);return c.currentScheduler.scheduleTask(()=>{U&&N.unsafeInterruptAsFork(c.id()),N.resume(R)},0),N},C=()=>{r||(d-=u.length,u=[]),p=!0,S()},E=n?moe:ka,T=M(Js(A=>{const U=(N,L)=>{N._op==="Blocked"?I.push(N):(b.push({index:L,exit:N}),N._op==="Failure"&&!p&&C())},R=()=>{if(u.length>0){const N=u.pop();let L=h++;const B=()=>{const K=u.pop();return L=h++,ke(Wy(),()=>ke(E(o(t(K,L))),j))},j=K=>u.length>0&&(U(K,L),u.length>0)?B():Re(K),$=ke(E(o(t(N,L))),j),F=M($);w.push(F),y.add(F),p&&F.currentScheduler.scheduleTask(()=>{F.unsafeInterruptAsFork(c.id())},0),F.addObserver(K=>{let W;if(K._op==="Failure"?W=K:W=K.effect_instruction_i0,x.push(F),y.delete(F),U(W,L),b.length===d)A(Re(Ln(fh(_(),{parallel:!0}),()=>gs)));else if(I.length+b.length===d){const X=_(),V=I.map(z=>z.effect_instruction_i0).reduce(ZV);A(Re(m4(V,Gs([Ln(fh(X,{parallel:!0}),()=>gs),...I.map(z=>z.effect_instruction_i1)],z=>z,n,!0,i))))}else R()})}};for(let N=0;N<g;N++)R()}));return Ni(wd(Kd(o(Gg(T))),Dx({onFailure:A=>{C();const U=I.length+1,R=Math.min(typeof i=="number"?i:I.length,I.length),N=Array.from(I);return Js(L=>{let B=0,j=0;const $=(K,W)=>X=>{B++,B===U&&L(dr(un(A))),N.length>0&&W&&F()},F=()=>{M(N.pop(),!0).addObserver($(j,!0)),j++};T.addObserver($(j,!1)),j++;for(let K=0;K<R;K++)F()})},onSuccess:()=>ml(x,A=>A.inheritAll)})))}))),jT=(e,t,n,r)=>mt(()=>{const i=Kn(e),o=new Array(i.length);return Wr(Gs(i,(c,u)=>ft(n(c,u),d=>o[u]=d),r,!1,t),Re(o))}),ude=e=>Bt((t,n)=>Re(hA(e,t,n.runtimeFlags))),Yx=e=>fde(e,tb),hA=(e,t,n,r=null)=>{const i=J0(e,t,n,r);return i.resume(e),i},dde=(e,t,n,r=null)=>J0(e,t,n,r),J0=(e,t,n,r=null)=>{const i=LV(),o=t.getFiberRefs(),a=vae(o,i),c=new c5(i,a,n),u=Kg(a,eu),d=c.currentSupervisor;return d.onStart(u,e,De(t),c),c.addObserver(p=>d.onEnd(p,c)),(r!==null?r:Y(t.getFiberRef(gT),Ln(()=>t.scope()))).add(n,c),c},fde=(e,t)=>Bt((n,r)=>Re(hA(e,n,r.runtimeFlags,t))),dj=e=>Wd(t=>rr(Ai(t,tu),{onNone:()=>e,onSome:n=>{switch(n.strategy._tag){case"Parallel":return e;case"Sequential":case"ParallelN":return ke(dl(n,IT),r=>bp(e,r))}}})),fj=e=>t=>Wd(n=>rr(Ai(n,tu),{onNone:()=>t,onSome:r=>r.strategy._tag==="ParallelN"&&r.strategy.parallelism===e?t:ke(dl(r,ET(e)),i=>bp(t,i))})),Lf=(e,t)=>n=>Wd(r=>rr(Ai(r,tu),{onNone:()=>n(Lt),onSome:i=>{if(t===!0){const o=e._tag==="Parallel"?dj:e._tag==="Sequential"?hj:fj(e.parallelism);switch(i.strategy._tag){case"Parallel":return o(n(dj));case"Sequential":return o(n(hj));case"ParallelN":return o(n(fj(i.strategy.parallelism)))}}else return n(Lt)}})),pA=e=>ke(tu,e),f5=e=>ke(yp(),t=>wd(e(t),n=>t.close(n))),hde=e=>ke(yp(),t=>vde(e,t)),hj=e=>Wd(t=>rr(Ai(t,tu),{onNone:()=>e,onSome:n=>{switch(n.strategy._tag){case"Sequential":return e;case"Parallel":case"ParallelN":return ke(dl(n,K0),r=>bp(e,r))}}})),pde=G(e=>$a(e[1]),(e,t,n)=>sb(e,t,(r,i)=>[r,i],n)),mde=G(e=>$a(e[1]),(e,t,n)=>n?.concurrent!==!0&&(n?.batching===void 0||n.batching===!1)?Rx(e,t):sb(e,t,(r,i)=>r,n)),gde=G(e=>$a(e[1]),(e,t,n)=>n?.concurrent!==!0&&(n?.batching===void 0||n.batching===!1)?Wr(e,t):sb(e,t,(r,i)=>i,n)),sb=G(e=>$a(e[1]),(e,t,n,r)=>ft(dA([e,t],{concurrency:r?.concurrent?2:1,batching:r?.batching,concurrentFinalizers:r?.concurrentFinalizers}),([i,o])=>n(i,o))),tu=Go("effect/Scope"),h5=tu,yde=(e,t)=>{e.state._tag==="Open"&&e.state.finalizers.set({},t)},bde={[R$]:R$,[A$]:A$,pipe(){return Xe(this,arguments)},fork(e){return Te(()=>{const t=p5(e);if(this.state._tag==="Closed")return t.state=this.state,t;const n={},r=i=>t.close(i);return this.state.finalizers.set(n,r),yde(t,i=>Te(()=>{this.state._tag==="Open"&&this.state.finalizers.delete(n)})),t})},close(e){return mt(()=>{if(this.state._tag==="Closed")return bn;const t=Array.from(this.state.finalizers.values()).reverse();return this.state={_tag:"Closed",exit:e},t.length===0?bn:dle(this.strategy)?Y(ml(t,n=>ka(n(e))),ke(n=>Y(fh(n),Gu(a1),Ln(()=>gs)))):fle(this.strategy)?Y(fA(t,n=>ka(n(e)),!1),ke(n=>Y(fh(n,{parallel:!0}),Gu(a1),Ln(()=>gs)))):Y(jT(t,this.strategy.parallelism,n=>ka(n(e)),!1),ke(n=>Y(fh(n,{parallel:!0}),Gu(a1),Ln(()=>gs))))})},addFinalizer(e){return mt(()=>this.state._tag==="Closed"?e(this.state.exit):(this.state.finalizers.set({},e),bn))}},p5=(e=Cc)=>{const t=Object.create(bde);return t.strategy=e,t.state={_tag:"Open",finalizers:new Map},t},yp=(e=Cc)=>Te(()=>p5(e)),bp=G(2,(e,t)=>V4(e,_s(cx(tu,t)))),vde=G(2,(e,t)=>Y(e,bp(t),wd(n=>t.close(n)))),Sde=e=>fp(e,{differ:Gue,fork:yg}),m5=G(2,(e,t)=>Ni(uA(ke(Gy(e),n=>li(F0(e,t),n)),n=>F0(e,n)))),mA=G(2,(e,t)=>Yy(e,n=>m5(e,t(n)))),pj=Doe(Cie),wde=Sde(Wx),xde=e=>Ni(Yx(Ax(e))),g5=G(3,(e,t,n)=>b5(e,t,{onSelfWin:(r,i)=>ke(r.await,o=>{switch(o._tag){case si:return ke(r.inheritAll,()=>n.onSelfDone(o,i));case oi:return n.onSelfDone(o,i)}}),onOtherWin:(r,i)=>ke(r.await,o=>{switch(o._tag){case si:return ke(r.inheritAll,()=>n.onOtherDone(o,i));case oi:return n.onOtherDone(o,i)}})})),y5=G(2,(e,t)=>cp(n=>g5(e,t,{onSelfDone:(r,i)=>vT(r,{onFailure:o=>Y(Gg(i),J$(a=>$c(o,a))),onSuccess:o=>Y(i,gl(n),li(o))}),onOtherDone:(r,i)=>vT(r,{onFailure:o=>Y(Gg(i),J$(a=>$c(a,o))),onSuccess:o=>Y(i,gl(n),li(o))})}))),b5=G(3,(e,t,n)=>Bt((r,i)=>{const o=i.runtimeFlags,a=zd(!0),c=J0(e,r,o,n.selfScope),u=J0(t,r,o,n.otherScope);return Js(d=>{c.addObserver(()=>mj(c,u,n.onSelfWin,a,d)),u.addObserver(()=>mj(u,c,n.onOtherWin,a,d)),c.startFork(e),u.startFork(t)},ure(c.id(),u.id()))})),mj=(e,t,n,r,i)=>{rre(!0,!1)(r)&&i(n(e,t))},Yg=G(2,(e,t)=>ks(n=>Wo(n(e),{onFailure:r=>Wo(t,{onFailure:i=>Er(ni(r,i)),onSuccess:()=>Er(r)}),onSuccess:r=>li(t,r)}))),kde=(e,t,n)=>cp(r=>ke(ke(Yx(Tx(e)),i=>Js(o=>{const a=t.map(d=>d.listeners.count),c=()=>{a.every(d=>d===0)&&t.every(d=>d.result.state.current._tag==="Pending"?!0:!!(d.result.state.current._tag==="Done"&&Ox(d.result.state.current.effect)&&d.result.state.current.effect._tag==="Failure"&&s4(d.result.state.current.effect.cause)))&&(u.forEach(d=>d()),n?.(),o(Ax(i)))};i.addObserver(d=>{u.forEach(h=>h()),o(d)});const u=t.map((d,h)=>{const p=g=>{a[h]=g,c()};return d.listeners.addObserver(p),()=>d.listeners.removeObserver(p)});return c(),Te(()=>{u.forEach(d=>d())})})),()=>mt(()=>{const i=t.flatMap(o=>o.state.completed?[]:[o]);return Ex(i,o=>zue(o.request,q4(r)))}))),Qx=Lc,Qg=qo,_de=ms,Ide=Gie,Ede=o4,Ed=s4,bg=xx,Z0=a4,Vh=l4,Tde=c4,ew=u4,v5=d4,Cde=Qie,S5=Yie,w5=Zie,nu=Zc,Mde="effect/ScheduleInterval",tw=Symbol.for(Mde),x5={[tw]:tw,startMillis:0,endMillis:0},gA=(e,t)=>e>t?x5:{[tw]:tw,startMillis:e,endMillis:t},Rde=G(2,(e,t)=>Ade(e,t)===e),Ade=G(2,(e,t)=>e.endMillis<=t.startMillis?e:t.endMillis<=e.startMillis?t:e.startMillis<t.startMillis?e:t.startMillis<e.startMillis?t:e.endMillis<=t.endMillis?e:t),Ode=e=>e.startMillis>=e.endMillis,Dde=G(2,(e,t)=>{const n=Math.max(e.startMillis,t.startMillis),r=Math.min(e.endMillis,t.endMillis);return gA(n,r)}),Pde=e=>Il(e.endMillis-e.startMillis),Nde=e=>gA(e,Number.POSITIVE_INFINITY),gj=gA,k5=x5,Lde=Rde,$de=Ode,jde=Dde,Fde=Pde,zde=Nde,Bde="effect/ScheduleIntervals",yj=Symbol.for(Bde),_5=e=>({[yj]:yj,intervals:e}),qde=G(2,(e,t)=>Ude(e.intervals,t.intervals,hn())),Ude=(e,t,n)=>{let r=e,i=t,o=n;for(;_l(r)&&_l(i);){const a=Y(va(r),jde(va(i))),c=$de(a)?o:Y(o,ai(a));Y(va(r),Lde(va(i)))?r=pl(r):i=pl(i),o=c}return _5(kl(o))},FT=e=>Y(e.intervals,dx,Ln(()=>k5)).startMillis,Vde=e=>Y(e.intervals,dx,Ln(()=>k5)).endMillis,Kde=G(2,(e,t)=>FT(e)<FT(t)),Hde=e=>_l(e.intervals),Wde=_5,Gde=qde,zT=FT,BT=Vde,Yde=Kde,Qde=Hde,yA="Continue",I5="Done",Xde=e=>({_tag:yA,intervals:e}),Jde=e=>({_tag:yA,intervals:Wde(An(e))}),Zde={_tag:I5},efe=e=>e._tag===yA,tfe=e=>e._tag===I5,nfe=Xde,E5=Jde,Xg=Zde,bj=efe,Jg=tfe,rfe=tu,Mc=F4,ife=z0,bi=yT,vp=bp,T5=dl,vg=yp;class ofe{permits;waiters=new Set;taken=0;constructor(t){this.permits=t}get free(){return this.permits-this.taken}take=t=>S4(n=>{if(this.free<t){const r=()=>{this.free<t||(this.waiters.delete(r),this.taken+=t,n(Re(t)))};return this.waiters.add(r),Te(()=>{this.waiters.delete(r)})}return this.taken+=t,n(Re(t))});updateTakenUnsafe(t,n){return this.taken=n(this.taken),this.waiters.size>0&&t.getFiberRef(rA).scheduleTask(()=>{const r=this.waiters.values();let i=r.next();for(;i.done===!1&&this.free>0;)i.value(),i=r.next()},t.getFiberRef(Qy)),Re(this.free)}updateTaken(t){return Bt(n=>this.updateTakenUnsafe(n,t))}resize=t=>Ni(Bt(n=>(this.permits=t,this.free<0?bn:this.updateTakenUnsafe(n,r=>r))));release=t=>this.updateTaken(n=>n-t);releaseAll=this.updateTaken(t=>0);withPermits=t=>n=>ks(r=>ke(r(this.take(t)),i=>Yg(r(n),this.release(i))));withPermitsIfAvailable=t=>n=>ks(r=>mt(()=>this.free<t?tle:(this.taken+=t,Yg(r(Uae(n)),this.release(t)))))}const C5=e=>new ofe(e),sfe=e=>Te(()=>C5(e)),M5=G(2,(e,t)=>Bt((n,r)=>{const i=t,o=hA(e,n,r.runtimeFlags,tb);if(i.state._tag==="Open"){const a=()=>cp(u=>bt(u,o.id())?bn:Ni(Ax(o))),c={};i.state.finalizers.set(c,a),o.addObserver(()=>{i.state._tag!=="Closed"&&i.state.finalizers.delete(c)})}else o.unsafeInterruptAsFork(n.id());return Re(o)})),afe=e=>pA(t=>M5(e,t)),lfe=G(2,(e,t)=>Y(ka(e),y5(ka(t)),n=>Kd(n))),cfe=G(2,(e,{duration:t,onTimeout:n})=>Kd(ufe(e,{onTimeout:()=>Vy(n),onSuccess:Re,duration:t}))),ufe=G(2,(e,{duration:t,onSuccess:n,onTimeout:r})=>cp(i=>ks(o=>b5(o(e),Tx(YR(t)),{onSelfWin:(a,c)=>ke(a.await,u=>u._tag==="Success"?ke(a.inheritAll,()=>li(gl(c,i),n(u.value))):ke(gl(c,i),()=>un(u.cause))),onOtherWin:(a,c)=>ke(a.await,u=>u._tag==="Success"?ke(a.inheritAll,()=>li(gl(c,i),r())):ke(gl(c,i),()=>un(u.cause))),otherScope:tb})))),dfe="effect/Ref/SynchronizedRef",R5=Symbol.for(dfe),A5={_A:e=>e};class ffe extends gp{ref;withLock;[R5]=A5;[HR]=WR;[Bh]=Bh;constructor(t,n){super(),this.ref=t,this.withLock=n,this.get=Ia(this.ref)}get;commit(){return this.get}modify(t){return this.modifyEffect(n=>Re(t(n)))}modifyEffect(t){return this.withLock(Y(ke(Ia(this.ref),t),ke(([n,r])=>li(hh(this.ref,r),n))))}}const hfe=e=>Te(()=>O5(e)),O5=e=>{const t=GR(e),n=C5(1);return new ffe(t,n.withPermits(1))},qT=Symbol.for("effect/ManagedRuntime"),pfe="Fold",mfe="Fresh",gfe="FromEffect",yfe="Scoped",bfe="Suspend",vfe="Provide",D5="ProvideMerge",Sfe="MergeAll",wfe="ZipWith",zc=cce,vj=uce,Mi=Ax,P5=gl,Zg=xde,th=Gg,UT=dce,Sp=e=>function(){if(arguments.length===1){const t=arguments[0];return(n,...r)=>e(t,n,...r)}return e.apply(this,arguments)},ab=Sp((e,t,n)=>{const r=LV(),i=[[eu,[[r,e.context]]]];n?.scheduler&&i.push([rA,[[r,n.scheduler]]]);let o=xae(e.fiberRefs,{entries:i,forkAs:r});n?.updateRefs&&(o=n.updateRefs(o,r));const a=new c5(r,o,e.runtimeFlags);let c=t;n?.scope&&(c=ke(T5(n.scope,Cc),d=>Wr(F4(d,cp(h=>bt(h,a.id())?bn:gl(a,h))),wd(t,h=>bi(d,h)))));const u=a.currentSupervisor;return u!==Wx&&(u.onStart(e.context,c,Oe(),a),a.addObserver(d=>u.onEnd(d,a))),tb.add(e.runtimeFlags,a),n?.immediate===!1?a.resume(c):a.start(c),a}),VT=Sp((e,t,n={})=>{const r=ab(e,t,n);return n.onExit&&r.addObserver(i=>{n.onExit(i)}),(i,o)=>VT(e)(Y(r,P5(i??bd)),{...o,onExit:o?.onExit?a=>o.onExit(ose(a)):void 0})}),N5=Sp((e,t)=>{const n=bA(e)(t);if(n._tag==="Failure")throw L5(n.effect_instruction_i0);return n.effect_instruction_i0});class xfe extends Error{fiber;_tag="AsyncFiberException";constructor(t){super(`Fiber #${t.id().id} cannot be resolved synchronously. This is caused by using runSync on an effect that performs async work`),this.fiber=t,this.name=this._tag,this.stack=this.message}}const kfe=e=>{const t=Error.stackTraceLimit;Error.stackTraceLimit=0;const n=new xfe(e);return Error.stackTraceLimit=t,n},d1=Symbol.for("effect/Runtime/FiberFailure"),Yv=Symbol.for("effect/Runtime/FiberFailure/Cause");class _fe extends Error{[d1];[Yv];constructor(t){const n=h4(t)[0];super(n?.message||"An error has occurred"),this[d1]=d1,this[Yv]=t,this.name=n?`(FiberFailure) ${n.name}`:"FiberFailure",n?.stack&&(this.stack=n.stack)}toJSON(){return{_id:"FiberFailure",cause:this[Yv].toJSON()}}toString(){return"(FiberFailure) "+Zc(this[Yv],{renderErrorCause:!0})}[$n](){return this.toString()}}const L5=e=>{const t=Error.stackTraceLimit;Error.stackTraceLimit=0;const n=new _fe(e);return Error.stackTraceLimit=t,n},$5=e=>{const t=e;switch(t._op){case"Failure":case"Success":return t;case"Left":return bT(t.left);case"Right":return dr(t.right);case"Some":return dr(t.value);case"None":return bT(new ER)}},bA=Sp((e,t)=>{const n=$5(t);if(n)return n;const r=new FK,i=ab(e)(t,{scheduler:r});r.flush();const o=i.unsafePoll();return o||B4(xR(kfe(i),MR(i)))}),j5=Sp((e,t,n)=>vA(e,t,n).then(r=>{switch(r._tag){case si:return r.effect_instruction_i0;case oi:throw L5(r.effect_instruction_i0)}})),vA=Sp((e,t,n)=>new Promise(r=>{const i=$5(t);i&&r(i);const o=ab(e)(t);o.addObserver(a=>{r(a)}),n?.signal!==void 0&&(n.signal.aborted?o.unsafeInterruptAsFork(o.id()):n.signal.addEventListener("abort",()=>{o.unsafeInterruptAsFork(o.id())},{once:!0}))}));class F5{context;runtimeFlags;fiberRefs;constructor(t,n,r){this.context=t,this.runtimeFlags=n,this.fiberRefs=r}pipe(){return Xe(this,arguments)}}const Ife=e=>new F5(e.context,e.runtimeFlags,e.fiberRefs),z5=()=>Bt((e,t)=>Re(new F5(e.getFiberRef(eu),t.runtimeFlags,e.getFiberRefs()))),Efe=XV(qd,YV,GV),Bc=Ife({context:Ly(),runtimeFlags:Efe,fiberRefs:kae()}),KT=ab(Bc),f1=j5(Bc),Tfe=vA(Bc),HT=N5(Bc),Cfe=bA(Bc),Mfe=G(2,(e,t)=>e.modifyEffect(t)),Rfe="effect/Layer",SA=Symbol.for(Rfe),Afe={_RIn:e=>e,_E:e=>e,_ROut:e=>e},Cl={[SA]:Afe,pipe(){return Xe(this,arguments)}},Ofe="effect/Layer/MemoMap",h1=Symbol.for(Ofe),Dfe=ux()("effect/Layer/CurrentMemoMap",{defaultValue:()=>q5()}),Pfe=e=>ht(e,SA),Nfe=e=>e._op_layer===mfe;class B5{ref;[h1];constructor(t){this.ref=t,this[h1]=h1}getOrElseMemoize(t,n){return Y(Mfe(this.ref,r=>{const i=r.get(t);if(i!==void 0){const[o,a]=i,c=Y(o,ke(([u,d])=>Y(IK(u),li(d))),wd(Dx({onFailure:()=>bn,onSuccess:()=>z0(n,a)})));return Re([c,r])}return Y(U0(0),ke(o=>Y(Xy(),ke(a=>Y(U0(()=>bn),ft(c=>{const u=ks(h=>Y(yp(),ke(p=>Y(h(ke(V5(t,p,!0),g=>kK(g(this)))),ka,ke(g=>{switch(g._tag){case oi:return Y(U4(a,g.effect_instruction_i0),Wr(yT(p,g)),Wr(Er(g.effect_instruction_i0)));case si:return Y(hh(c,y=>Y(yT(p,y),Mx(pK(o,b=>[b===1,b-1])),Ni)),Wr(V0(o,y=>y+1)),Wr(z0(n,y=>Y(Te(()=>r.delete(t)),Wr(Ia(c)),ke(b=>b(y))))),Wr(Jy(a,g.effect_instruction_i0)),li(g.effect_instruction_i0[1]))}}))))),d=[Y(Zs(a),wd(vT({onFailure:()=>bn,onSuccess:()=>V0(o,h=>h+1)}))),h=>Y(Ia(c),ke(p=>p(h)))];return[u,Nfe(t)?r:r.set(t,d)]}))))))}),Kd)}}const Lfe=mt(()=>ft(hfe(new Map),e=>new B5(e))),q5=()=>new B5(O5(new Map)),wA=G(2,(e,t)=>ke(Lfe,n=>U5(e,n,t))),U5=G(3,(e,t,n)=>ke(V5(e,n),r=>EK(r(t),Dfe,t))),V5=(e,t,n=!1)=>{const r=e;switch(r._op_layer){case"Locally":return Te(()=>i=>r.f(i.getOrElseMemoize(r.self,t)));case"ExtendScope":return Te(()=>i=>pA(o=>i.getOrElseMemoize(r.layer,o)));case"Fold":return Te(()=>i=>Y(i.getOrElseMemoize(r.layer,t),Wo({onFailure:o=>i.getOrElseMemoize(r.failureK(o),t),onSuccess:o=>i.getOrElseMemoize(r.successK(o),t)})));case"Fresh":return Te(()=>i=>Y(r.layer,wA(t)));case"FromEffect":return Te(n?()=>i=>r.effect:()=>i=>i.getOrElseMemoize(e,t));case"Provide":return Te(()=>i=>Y(i.getOrElseMemoize(r.first,t),ke(o=>Y(i.getOrElseMemoize(r.second,t),pp(o)))));case"Scoped":return Te(n?()=>i=>bp(r.effect,t):()=>i=>i.getOrElseMemoize(e,t));case"Suspend":return Te(()=>i=>i.getOrElseMemoize(r.evaluate(),t));case"ProvideMerge":return Te(()=>i=>Y(i.getOrElseMemoize(r.first,t),R4(i.getOrElseMemoize(r.second,t),r.zipK)));case"ZipWith":return C4(function*(){const i=yield*dl(t,_T),o=yield*dl(i,Cc),a=yield*dl(i,Cc);return c=>Y(c.getOrElseMemoize(r.first,o),sb(c.getOrElseMemoize(r.second,a),r.zipK,{concurrent:!0}))});case"MergeAll":{const i=r.layers;return ft(dl(t,_T),o=>a=>{const c=new Array(i.length);return ft(Gs(i,Soe(function*(u,d){const h=yield*dl(o,Cc),p=yield*a.getOrElseMemoize(u,h);c[d]=p}),!1,!1),()=>Bte(...c))})}}},$fe=()=>lb(Zy()),jfe=e=>K5(Qx(e)),K5=e=>lb(Er(e)),H5=G(2,(e,t)=>Ufe(e,{onFailure:jfe,onSuccess:t})),Ffe=G(2,(e,t)=>{const n=Pc(e),r=n?e:t;return lb(ft(n?t:e,o=>cx(r,o)))});function lb(e){const t=Object.create(Cl);return t._op_layer=gfe,t.effect=e,t}const zfe=(e,t)=>cb(m5(e,t)),Bfe=(e,t)=>cb(mA(e,t)),qfe=G(2,(e,{onFailure:t,onSuccess:n})=>{const r=Object.create(Cl);return r._op_layer=pfe,r.layer=e,r.failureK=t,r.successK=n,r}),Ufe=G(2,(e,{onFailure:t,onSuccess:n})=>qfe(e,{onFailure:r=>{const i=v5(r);switch(i._tag){case"Left":return t(i.left);case"Right":return K5(i.right)}},onSuccess:n})),Vfe=G(2,(e,t)=>Yfe(e,t,(n,r)=>_s(n,r))),xA=(...e)=>{const t=Object.create(Cl);return t._op_layer=Sfe,t.layers=e,t},W5=G(2,(e,t)=>{const n=Pc(e),r=n?e:t;return G5(ft(n?t:e,o=>cx(r,o)))}),cb=e=>G5(Y(e,li(Ly()))),G5=e=>{const t=Object.create(Cl);return t._op_layer=yfe,t.effect=e,t},Kfe=G(2,(e,t)=>{const n=Pc(e);return lb(Re(cx(n?e:t,n?t:e)))}),Y5=e=>lb(Re(e)),Hfe=Y5(Ly()),Q5=e=>{const t=Object.create(Cl);return t._op_layer=bfe,t.evaluate=e,t},Wfe=G(2,(e,t)=>ke(pA(n=>U5(e,t,n)),n=>Y(z5(),pp(n)))),X5=G(2,(e,t)=>Q5(()=>{const n=Object.create(Cl);return n._op_layer=vfe,n.first=Object.create(Cl,{_op_layer:{value:D5,enumerable:!0},first:{value:$fe(),enumerable:!0},second:{value:Array.isArray(t)?xA(...t):t},zipK:{value:(r,i)=>Y(r,_s(i))}}),n.second=e,n})),Gfe=G(2,(e,t)=>{const n=Object.create(Cl);return n._op_layer=D5,n.first=t,n.second=X5(e,t),n.zipK=(r,i)=>Y(r,_s(i)),n}),Yfe=G(3,(e,t,n)=>Q5(()=>{const r=Object.create(Cl);return r._op_layer=wfe,r.first=e,r.second=t,r.zipK=n,r})),Qfe=e=>{const t=Go("effect/Layer/unwrapScoped/Layer.Layer<R1, E1, A>");return H5(W5(t,e),n=>Oa(n,t))},Sj=G(2,(e,t)=>f5(n=>ke(wA(t,n),r=>CR(e,r)))),wj=G(2,(e,t)=>{const n=Hg(Bc.fiberRefs,t.fiberRefs),r=Ju(Bc.runtimeFlags,t.runtimeFlags);return ks(i=>Bt(o=>{const a=o.getFiberRef(eu),c=o.getFiberRefs(),u=Wg(o.id(),c)(n),d=o.currentRuntimeFlags,h=dh(r)(d),p=Hg(u,c),g=Ju(h,d);return o.setFiberRefs(u),o.currentRuntimeFlags=h,Yg(CR(i(e),_s(a,t.context)),Bt(y=>(y.setFiberRefs(Wg(y.id(),y.getFiberRefs())(p)),y.currentRuntimeFlags=dh(g)(y.currentRuntimeFlags),bn)))}))}),Xfe=G(2,(e,t)=>Array.isArray(t)?Sj(e,xA(...t)):Pfe(t)?Sj(e,t):zte(t)?CR(e,t):qT in t?ke(t.runtimeEffect,n=>wj(e,n)):wj(e,t)),Jfe=(function(){const e=Symbol.for("effect/Data/Error/plainArgs");return{BaseEffectError:class extends _R{constructor(n){super(n?.message,n?.cause?{cause:n.cause}:void 0),n&&(Object.assign(this,n),Object.defineProperty(this,e,{value:n,enumerable:!1}))}toJSON(){return{...this[e],...this}}}}.BaseEffectError})(),Zfe=e=>{const t={BaseEffectError:class extends Jfe{_tag=e}};return t.BaseEffectError.prototype.name=e,t.BaseEffectError},ehe="effect/Schedule",J5=Symbol.for(ehe),the=e=>ht(e,J5),nhe="effect/ScheduleDriver",rhe=Symbol.for(nhe),WT={start:0,now:0,input:void 0,output:void 0,elapsed:hd,elapsedSincePrevious:hd,recurrence:0},GT=ux()("effect/Schedule/CurrentIterationMetadata",{defaultValue:()=>WT}),ihe={_Out:e=>e,_In:e=>e,_R:e=>e},ohe={_Out:e=>e,_In:e=>e,_R:e=>e};class she{initial;step;[J5]=ihe;constructor(t,n){this.initial=t,this.step=n}pipe(){return Xe(this,arguments)}}const xj=(e,t,n,r)=>V0(e,i=>i.recurrence===0?{now:t,input:n,output:r,recurrence:i.recurrence+1,elapsed:hd,elapsedSincePrevious:hd,start:t}:{now:t,input:n,output:r,recurrence:i.recurrence+1,elapsed:Il(t-i.start),elapsedSincePrevious:Il(t-i.now),start:i.start});class ahe{schedule;ref;[rhe]=ohe;constructor(t,n){this.schedule=t,this.ref=n}get state(){return ft(Ia(this.ref),t=>t[1])}get last(){return ke(Ia(this.ref),([t,n])=>{switch(t._tag){case"None":return Vy(()=>new ER);case"Some":return Re(t.value)}})}iterationMeta=GR(WT);get reset(){return hh(this.ref,[Oe(),this.schedule.initial]).pipe(Rx(hh(this.iterationMeta,WT)))}next(t){return Y(ft(Ia(this.ref),n=>n[1]),ke(n=>Y(Vg,ke(r=>Y(mt(()=>this.schedule.step(r,t,n)),ke(([i,o,a])=>{const c=hh(this.ref,[De(o),i]);if(Jg(a))return c.pipe(Wr(Lr(Oe())));const u=zT(a.intervals)-r;if(u<=0)return c.pipe(Wr(xj(this.iterationMeta,r,t,o)),li(o));const d=Il(u);return Y(c,Wr(xj(this.iterationMeta,r,t,o)),Wr(YR(d)),li(o))}))))))}}const wp=(e,t)=>new she(e,t),lhe=G(2,(e,t)=>che(e,n=>Te(()=>t(n)))),che=G(2,(e,t)=>mhe(e,(n,r)=>ft(t(n),i=>pne(r,Ho(i))))),uhe=G(2,(e,t)=>kA(e,(n,r)=>Te(()=>t(n,r)))),kA=G(2,(e,t)=>wp(e.initial,(n,r,i)=>ke(e.step(n,r,i),([o,a,c])=>Jg(c)?Re([o,a,Xg]):ft(t(r,a),u=>u?[o,a,c]:[o,a,Xg])))),Z5=e=>Y(U0([Oe(),e.initial]),ft(t=>new ahe(e,t))),dhe=G(2,(e,t)=>fhe(e,t,Gde)),fhe=G(3,(e,t,n)=>wp([e.initial,t.initial],(r,i,o)=>Y(R4(e.step(r,i,o[0]),t.step(r,i,o[1]),(a,c)=>[a,c]),ke(([[a,c,u],[d,h,p]])=>bj(u)&&bj(p)?YT(e,t,i,a,c,u.intervals,d,h,p.intervals,n):Re([[a,d],[c,h],Xg]))))),YT=(e,t,n,r,i,o,a,c,u,d)=>{const h=d(o,u);return Qde(h)?Re([[r,a],[i,c],nfe(h)]):Y(o,Yde(u))?ke(e.step(BT(o),n,r),([p,g,y])=>Jg(y)?Re([[p,a],[g,c],Xg]):YT(e,t,n,p,g,y.intervals,a,c,u,d)):ke(t.step(BT(u),n,a),([p,g,y])=>Jg(y)?Re([[r,p],[i,g],Xg]):YT(e,t,n,r,i,o,p,g,y.intervals,d))},hhe=G(2,(e,t)=>phe(e,n=>Te(()=>t(n)))),phe=G(2,(e,t)=>wp(e.initial,(n,r,i)=>ke(e.step(n,r,i),([o,a,c])=>ft(t(a),u=>[o,u,c])))),mhe=G(2,(e,t)=>wp(e.initial,(n,r,i)=>ke(e.step(n,r,i),([o,a,c])=>{if(Jg(c))return Re([o,a,c]);const u=c.intervals,d=Fde(gj(n,zT(u)));return ft(t(a,d),h=>{const p=Ho(h),g=zT(u),y=n+pd(p),b=y-g,S=Math.max(0,BT(u)+b),w=gj(y,S);return[o,a,E5(w)]})}))),ghe=e=>wp(e.initial,(t,n,r)=>Y(e.step(t,n,r),ft(([i,o,a])=>[i,n,a]))),yhe=e=>xhe(_A,t=>t<e),bhe=e=>lhe(_A,()=>e),vhe=(e,t)=>wp(e,(n,r,i)=>Te(()=>[t(i),i,E5(zde(n))])),She=G(2,(e,t)=>kA(e,(n,r)=>Zae(t(n)))),whe=G(2,(e,t)=>kA(e,(n,r)=>t(n))),xhe=G(2,(e,t)=>uhe(e,(n,r)=>t(r))),QS=Symbol.for("effect/Schedule/ScheduleDefect");class khe{error;[QS];constructor(t){this.error=t,this[QS]=QS}}const _he=e=>ht(e,QS),kj=e=>qg(e,t=>Sa(new khe(t))),Ihe=e=>rr(kx(e,t=>o4(t)&&_he(t.defect)?De(t.defect):Oe()),{onNone:()=>e,onSome:t=>Lc(t.error)}),Ehe=e=>w4(e,t=>Er(Ihe(t))),_j=G(2,(e,t)=>Che(e,t,(n,r)=>Lr(n))),The=G(2,(e,t)=>{if(the(t))return _j(e,t);const n=t.schedule??ghe(_A),r=t.while?whe(n,a=>{const c=t.while(a);return typeof c=="boolean"?Re(c):kj(c)}):n,i=t.until?She(r,a=>{const c=t.until(a);return typeof c=="boolean"?Re(c):kj(c)}):r,o=t.times?dhe(i,yhe(t.times)).pipe(hhe(a=>a[0])):i;return Ehe(_j(e,o))}),Che=G(3,(e,t,n)=>ke(Z5(t),r=>Tl(e,{onFailure:i=>n(i,Oe()),onSuccess:i=>eH(kT(e,GT,Ia(r.iterationMeta)),r,(o,a)=>kT(n(o,a),GT,Ia(r.iterationMeta)),i)}))),eH=(e,t,n,r)=>Tl(t.next(r),{onFailure:()=>T4(t.last),onSuccess:i=>Tl(e,{onFailure:o=>n(o,De(i)),onSuccess:o=>eH(e,t,n,o)})}),_A=vhe(0,e=>e+1),Gd=$a,ru=dA,ln=Uh,ey=Js,Ij=Bt,ga=Lr,pr=Er,ty=Sa,Ci=x4,re=C4,Mhe=ele,fn=Re,Tn=mt,Ye=Te,ce=bn,qc=Wy,ny=qg,At=w4,p1=Vae,Rhe=Gae,Nm=ile,$f=Hr,$o=Tx,Ic=Hd,IA=ks,vi=li,Gt=Ni,rt=ft,EA=Cx,Ahe=uA,tH=b4,ul=d5,Gi=Yg,TA=h5,QT=f5,Ohe=hde,Dhe=kK,Phe=cp,nH=ude,rH=Yx,ho=M5,Nn=afe,Nhe=Kae,Lhe=YR,$he=cfe,Yd=Zy,iH=V4,Ea=Xfe,Kr=EK,jhe=kT,Ve=ale,oH=lle,Do=Fh,en=ka,sH=goe,Fhe=sle,$e=ke,qs=Kd,m1=y5,aH=lfe,CA=g5,ti=Hy,MA=rle,RA=Hae,Ej=The,Cn=dp,zhe=IK,Bhe=_K,nw=_4,jo=Wo,qhe=Tl,lH=Yae,Uhe=Qae,Vhe=Xae,Rc=Jae,AA=qae,Khe=T4,Hhe=z5,Xx=sfe,Whe=KT,rw=HT,Kh=pde,OA=mde,Ze=gde,Jx=sb,mo=Zi,et=Gy,cH=Gx,uH=j4,Ghe=e=>cb(mA(Gx,uh(e))),Yhe=e=>cb(mA(Gx,hR(e))),Qhe=G(2,(e,t)=>H5(Yhe(e),()=>Ghe(t))),Xhe=SA,ry=wA,dH=Ffe,yl=Hfe,Jhe=Vfe,Ac=xA,ub=zfe,db=Bfe,iy=W5,Zhe=cb,zo=Kfe,epe=Y5,fH=X5,ed=Gfe,tpe=Qfe,npe="effect/QueueEnqueue",hH=Symbol.for(npe),rpe="effect/QueueDequeue",DA=Symbol.for(rpe),ipe="effect/QueueStrategy",PA=Symbol.for(ipe),ope="effect/BackingQueue",spe=Symbol.for(ope),NA={_A:e=>e},ape={_A:e=>e},pH={_In:e=>e},LA={_Out:e=>e};class lpe extends gp{queue;takers;shutdownHook;shutdownFlag;strategy;[hH]=pH;[DA]=LA;constructor(t,n,r,i,o){super(),this.queue=t,this.takers=n,this.shutdownHook=r,this.shutdownFlag=i,this.strategy=o}pipe(){return Xe(this,arguments)}commit(){return this.take}capacity(){return this.queue.capacity()}get size(){return mt(()=>qg(this.unsafeSize(),()=>Hr))}unsafeSize(){return Vt(this.shutdownFlag)?Oe():De(this.queue.length()-PR(this.takers)+this.strategy.surplusSize())}get isEmpty(){return ft(this.size,t=>t<=0)}get isFull(){return ft(this.size,t=>t>=this.capacity())}get shutdown(){return Hd(Bt(t=>(Y(this.shutdownFlag,Bd(!0)),Y(Gs(mh(this.takers),n=>Nx(n,t.id()),!1,!1),Wr(this.strategy.shutdown),Mx(Jy(this.shutdownHook,void 0)),Ni))))}get isShutdown(){return Te(()=>Vt(this.shutdownFlag))}get awaitShutdown(){return Zs(this.shutdownHook)}isActive(){return!Vt(this.shutdownFlag)}unsafeOffer(t){if(Vt(this.shutdownFlag))return!1;let n;if(this.queue.length()===0){const i=Y(this.takers,_a(Gn));i!==Gn?(td(i,t),n=!0):n=!1}else n=!1;if(n)return!0;const r=this.queue.offer(t);return Bu(this.strategy,this.queue,this.takers),r}offer(t){return mt(()=>{if(Vt(this.shutdownFlag))return Hr;let n;if(this.queue.length()===0){const i=Y(this.takers,_a(Gn));i!==Gn?(td(i,t),n=!0):n=!1}else n=!1;if(n)return Re(!0);const r=this.queue.offer(t);return Bu(this.strategy,this.queue,this.takers),r?Re(!0):this.strategy.handleSurplus([t],this.queue,this.takers,this.shutdownFlag)})}offerAll(t){return mt(()=>{if(Vt(this.shutdownFlag))return Hr;const n=Kn(t),r=this.queue.length()===0?Kn(Cpe(this.takers,n.length)):cd,[i,o]=Y(n,EU(r.length));for(let c=0;c<r.length;c++){const u=r[c],d=i[c];td(u,d)}if(o.length===0)return Re(!0);const a=this.queue.offerAll(o);return Bu(this.strategy,this.queue,this.takers),op(a)?Re(!0):this.strategy.handleSurplus(a,this.queue,this.takers,this.shutdownFlag)})}get take(){return Bt(t=>{if(Vt(this.shutdownFlag))return Hr;const n=this.queue.poll(Gn);if(n!==Gn)return this.strategy.unsafeOnQueueEmptySpace(this.queue,this.takers),Re(n);{const r=hp(t.id());return Y(mt(()=>(Y(this.takers,jc(r)),Bu(this.strategy,this.queue,this.takers),Vt(this.shutdownFlag)?Hr:Zs(r))),up(()=>Te(()=>Mpe(this.takers,r))))}})}get takeAll(){return mt(()=>Vt(this.shutdownFlag)?Hr:Te(()=>{const t=this.queue.pollUpTo(Number.POSITIVE_INFINITY);return this.strategy.unsafeOnQueueEmptySpace(this.queue,this.takers),Da(t)}))}takeUpTo(t){return mt(()=>Vt(this.shutdownFlag)?Hr:Te(()=>{const n=this.queue.pollUpTo(t);return this.strategy.unsafeOnQueueEmptySpace(this.queue,this.takers),Da(n)}))}takeBetween(t,n){return mt(()=>mH(this,t,n,hn()))}}const mH=(e,t,n,r)=>n<t?Re(r):Y(Spe(e,n),ke(i=>{const o=t-i.length;return o===1?Y(XT(e),ft(a=>Y(r,Yr(i),Mh(a)))):o>1?Y(XT(e),ke(a=>mH(e,o-1,n-i.length-1,Y(r,Yr(i),Mh(a))))):Re(Y(r,Yr(i)))})),cpe=e=>Y(Te(()=>W4(e)),ke(t=>$A(jA(t),xpe()))),upe=e=>Y(Te(()=>W4(e)),ke(t=>$A(jA(t),_pe()))),dpe=()=>Y(Te(()=>eb()),ke(e=>$A(jA(e),kpe()))),fpe=(e,t,n,r,i)=>new lpe(e,t,n,r,i),$A=(e,t)=>Y(Xy(),ft(n=>fpe(e,eb(),n,zd(!1),t)));class hpe{mutable;[spe]=ape;constructor(t){this.mutable=t}poll(t){return _a(this.mutable,t)}pollUpTo(t){return $x(this.mutable,t)}offerAll(t){return NR(this.mutable,t)}offer(t){return jc(this.mutable,t)}capacity(){return vse(this.mutable)}length(){return PR(this.mutable)}}const jA=e=>new hpe(e),ppe=e=>e.size,mpe=e=>e.isShutdown,gpe=e=>e.shutdown,ype=G(2,(e,t)=>e.offer(t)),bpe=e=>ft(e.takeUpTo(1),dx),XT=e=>e.take,vpe=e=>e.takeAll,Spe=G(2,(e,t)=>e.takeUpTo(t)),wpe=G(3,(e,t,n)=>e.takeBetween(t,n)),xpe=()=>new Ipe,kpe=()=>new Epe,_pe=()=>new Tpe;let Ipe=class{[PA]=NA;putters=eb();surplusSize(){return PR(this.putters)}onCompleteTakersWithEmptyQueue(t){for(;!Zu(this.putters)&&!Zu(t);){const n=_a(t,void 0),r=_a(this.putters,void 0);r[2]&&td(r[1],!0),td(n,r[0])}}get shutdown(){return Y(Ky,ke(t=>Y(Te(()=>mh(this.putters)),ke(n=>Gs(n,([r,i,o])=>o?Y(Nx(i,t),Ni):bn,!1,!1)))))}handleSurplus(t,n,r,i){return Bt(o=>{const a=hp(o.id());return Y(mt(()=>(this.unsafeOffer(t,a),this.unsafeOnQueueEmptySpace(n,r),Bu(this,n,r),Vt(i)?Hr:Zs(a))),up(()=>Te(()=>this.unsafeRemove(a))))})}unsafeOnQueueEmptySpace(t,n){let r=!0;for(;r&&(t.capacity()===Number.POSITIVE_INFINITY||t.length()<t.capacity());){const i=Y(this.putters,_a(Gn));if(i===Gn)r=!1;else{const o=t.offer(i[0]);o&&i[2]?td(i[1],!0):o||iw(this.putters,Y(mh(this.putters),ai(i))),Bu(this,t,n)}}}unsafeOffer(t,n){const r=Kn(t);for(let i=0;i<r.length;i++){const o=r[i];i===r.length-1?Y(this.putters,jc([o,n,!0])):Y(this.putters,jc([o,n,!1]))}}unsafeRemove(t){iw(this.putters,Y(mh(this.putters),$y(([,n])=>n!==t)))}},Epe=class{[PA]=NA;surplusSize(){return 0}get shutdown(){return bn}onCompleteTakersWithEmptyQueue(){}handleSurplus(t,n,r,i){return Re(!1)}unsafeOnQueueEmptySpace(t,n){}},Tpe=class{[PA]=NA;surplusSize(){return 0}get shutdown(){return bn}onCompleteTakersWithEmptyQueue(){}handleSurplus(t,n,r,i){return Te(()=>(this.unsafeOffer(n,t),Bu(this,n,r),!0))}unsafeOnQueueEmptySpace(t,n){}unsafeOffer(t,n){const r=n[Symbol.iterator]();let i,o=!0;for(;!(i=r.next()).done&&o;){if(t.capacity()===0)return;t.poll(Gn),o=t.offer(i.value)}}};const td=(e,t)=>Lx(e,Re(t)),iw=(e,t)=>Y(e,NR(t)),mh=e=>Y(e,$x(Number.POSITIVE_INFINITY)),Cpe=(e,t)=>Y(e,$x(t)),Mpe=(e,t)=>{iw(e,Y(mh(e),$y(n=>t!==n)))},Bu=(e,t,n)=>{let r=!0;for(;r&&t.length()!==0;){const i=Y(n,_a(Gn));if(i!==Gn){const o=t.poll(Gn);o!==Gn?(td(i,o),e.unsafeOnQueueEmptySpace(t,n)):iw(n,Y(mh(n),ai(i))),r=!0}else r=!1}r&&t.length()===0&&!Zu(n)&&e.onCompleteTakersWithEmptyQueue(n)},er=Symbol.for("effect/PubSub/AbsentValue"),gH=(e,t)=>n=>{n.has(e)||n.set(e,new Set),n.get(e).add(t)},Rpe=(e,t)=>n=>{if(!n.has(e))return;const r=n.get(e);r.delete(t),r.size===0&&n.delete(e)},Ape=e=>mt(()=>{const t=yH(e);return FA(t,new rme)}),Ope=e=>mt(()=>{const t=yH(e);return FA(t,new ome)}),Dpe=e=>mt(()=>{const t=jpe(e);return FA(t,new ime)}),Ppe=e=>e.shutdown,Npe=G(2,(e,t)=>e.publish(t)),Lpe=G(2,(e,t)=>e.publishAll(t)),$pe=e=>e.subscribe,yH=e=>{const t=typeof e=="number"?{capacity:e}:e;Jpe(t.capacity);const n=t.replay&&t.replay>0?new SH(Math.ceil(t.replay)):void 0;return t.capacity===1?new Kpe(n):Eee(t.capacity)===t.capacity?new Upe(t.capacity,n):new Bpe(t.capacity,n)},jpe=e=>new Wpe(e?.replay?new SH(e.replay):void 0),Fpe=(e,t,n)=>ft(Xy(),r=>zpe(e,t,e.subscribe(),eb(),r,zd(!1),n)),zpe=(e,t,n,r,i,o,a)=>new Ype(e,t,n,r,i,o,a,e.replayWindow());class Bpe{capacity;replayBuffer;array;publisherIndex=0;subscribers;subscriberCount=0;subscribersIndex=0;constructor(t,n){this.capacity=t,this.replayBuffer=n,this.array=Array.from({length:t}),this.subscribers=Array.from({length:t})}replayWindow(){return this.replayBuffer?new Zx(this.replayBuffer):ek}isEmpty(){return this.publisherIndex===this.subscribersIndex}isFull(){return this.publisherIndex===this.subscribersIndex+this.capacity}size(){return this.publisherIndex-this.subscribersIndex}publish(t){if(this.isFull())return!1;if(this.subscriberCount!==0){const n=this.publisherIndex%this.capacity;this.array[n]=t,this.subscribers[n]=this.subscriberCount,this.publisherIndex+=1}return this.replayBuffer&&this.replayBuffer.offer(t),!0}publishAll(t){if(this.subscriberCount===0)return this.replayBuffer&&this.replayBuffer.offerAll(t),hn();const n=Da(t),r=n.length,i=this.publisherIndex-this.subscribersIndex,o=this.capacity-i,a=Math.min(r,o);if(a===0)return n;let c=0;const u=this.publisherIndex+a;for(;this.publisherIndex!==u;){const d=xa(n,c++),h=this.publisherIndex%this.capacity;this.array[h]=d,this.subscribers[h]=this.subscriberCount,this.publisherIndex+=1,this.replayBuffer&&this.replayBuffer.offer(d)}return fd(n,c)}slide(){if(this.subscribersIndex!==this.publisherIndex){const t=this.subscribersIndex%this.capacity;this.array[t]=er,this.subscribers[t]=0,this.subscribersIndex+=1}this.replayBuffer&&this.replayBuffer.slide()}subscribe(){return this.subscriberCount+=1,new qpe(this,this.publisherIndex,!1)}}class qpe{self;subscriberIndex;unsubscribed;constructor(t,n,r){this.self=t,this.subscriberIndex=n,this.unsubscribed=r}isEmpty(){return this.unsubscribed||this.self.publisherIndex===this.subscriberIndex||this.self.publisherIndex===this.self.subscribersIndex}size(){return this.unsubscribed?0:this.self.publisherIndex-Math.max(this.subscriberIndex,this.self.subscribersIndex)}poll(t){if(this.unsubscribed)return t;if(this.subscriberIndex=Math.max(this.subscriberIndex,this.self.subscribersIndex),this.subscriberIndex!==this.self.publisherIndex){const n=this.subscriberIndex%this.self.capacity,r=this.self.array[n];return this.self.subscribers[n]-=1,this.self.subscribers[n]===0&&(this.self.array[n]=er,this.self.subscribersIndex+=1),this.subscriberIndex+=1,r}return t}pollUpTo(t){if(this.unsubscribed)return hn();this.subscriberIndex=Math.max(this.subscriberIndex,this.self.subscribersIndex);const n=this.self.publisherIndex-this.subscriberIndex,r=Math.min(t,n);if(r<=0)return hn();const i=[],o=this.subscriberIndex+r;for(;this.subscriberIndex!==o;){const a=this.subscriberIndex%this.self.capacity,c=this.self.array[a];this.self.subscribers[a]-=1,this.self.subscribers[a]===0&&(this.self.array[a]=er,this.self.subscribersIndex+=1),i.push(c),this.subscriberIndex+=1}return Da(i)}unsubscribe(){if(!this.unsubscribed)for(this.unsubscribed=!0,this.self.subscriberCount-=1,this.subscriberIndex=Math.max(this.subscriberIndex,this.self.subscribersIndex);this.subscriberIndex!==this.self.publisherIndex;){const t=this.subscriberIndex%this.self.capacity;this.self.subscribers[t]-=1,this.self.subscribers[t]===0&&(this.self.array[t]=er,this.self.subscribersIndex+=1),this.subscriberIndex+=1}}}class Upe{capacity;replayBuffer;array;mask;publisherIndex=0;subscribers;subscriberCount=0;subscribersIndex=0;constructor(t,n){this.capacity=t,this.replayBuffer=n,this.array=Array.from({length:t}),this.mask=t-1,this.subscribers=Array.from({length:t})}replayWindow(){return this.replayBuffer?new Zx(this.replayBuffer):ek}isEmpty(){return this.publisherIndex===this.subscribersIndex}isFull(){return this.publisherIndex===this.subscribersIndex+this.capacity}size(){return this.publisherIndex-this.subscribersIndex}publish(t){if(this.isFull())return!1;if(this.subscriberCount!==0){const n=this.publisherIndex&this.mask;this.array[n]=t,this.subscribers[n]=this.subscriberCount,this.publisherIndex+=1}return this.replayBuffer&&this.replayBuffer.offer(t),!0}publishAll(t){if(this.subscriberCount===0)return this.replayBuffer&&this.replayBuffer.offerAll(t),hn();const n=Da(t),r=n.length,i=this.publisherIndex-this.subscribersIndex,o=this.capacity-i,a=Math.min(r,o);if(a===0)return n;let c=0;const u=this.publisherIndex+a;for(;this.publisherIndex!==u;){const d=xa(n,c++),h=this.publisherIndex&this.mask;this.array[h]=d,this.subscribers[h]=this.subscriberCount,this.publisherIndex+=1,this.replayBuffer&&this.replayBuffer.offer(d)}return fd(n,c)}slide(){if(this.subscribersIndex!==this.publisherIndex){const t=this.subscribersIndex&this.mask;this.array[t]=er,this.subscribers[t]=0,this.subscribersIndex+=1}this.replayBuffer&&this.replayBuffer.slide()}subscribe(){return this.subscriberCount+=1,new Vpe(this,this.publisherIndex,!1)}}class Vpe{self;subscriberIndex;unsubscribed;constructor(t,n,r){this.self=t,this.subscriberIndex=n,this.unsubscribed=r}isEmpty(){return this.unsubscribed||this.self.publisherIndex===this.subscriberIndex||this.self.publisherIndex===this.self.subscribersIndex}size(){return this.unsubscribed?0:this.self.publisherIndex-Math.max(this.subscriberIndex,this.self.subscribersIndex)}poll(t){if(this.unsubscribed)return t;if(this.subscriberIndex=Math.max(this.subscriberIndex,this.self.subscribersIndex),this.subscriberIndex!==this.self.publisherIndex){const n=this.subscriberIndex&this.self.mask,r=this.self.array[n];return this.self.subscribers[n]-=1,this.self.subscribers[n]===0&&(this.self.array[n]=er,this.self.subscribersIndex+=1),this.subscriberIndex+=1,r}return t}pollUpTo(t){if(this.unsubscribed)return hn();this.subscriberIndex=Math.max(this.subscriberIndex,this.self.subscribersIndex);const n=this.self.publisherIndex-this.subscriberIndex,r=Math.min(t,n);if(r<=0)return hn();const i=[],o=this.subscriberIndex+r;for(;this.subscriberIndex!==o;){const a=this.subscriberIndex&this.self.mask,c=this.self.array[a];this.self.subscribers[a]-=1,this.self.subscribers[a]===0&&(this.self.array[a]=er,this.self.subscribersIndex+=1),i.push(c),this.subscriberIndex+=1}return Da(i)}unsubscribe(){if(!this.unsubscribed)for(this.unsubscribed=!0,this.self.subscriberCount-=1,this.subscriberIndex=Math.max(this.subscriberIndex,this.self.subscribersIndex);this.subscriberIndex!==this.self.publisherIndex;){const t=this.subscriberIndex&this.self.mask;this.self.subscribers[t]-=1,this.self.subscribers[t]===0&&(this.self.array[t]=er,this.self.subscribersIndex+=1),this.subscriberIndex+=1}}}class Kpe{replayBuffer;publisherIndex=0;subscriberCount=0;subscribers=0;value=er;capacity=1;constructor(t){this.replayBuffer=t}replayWindow(){return this.replayBuffer?new Zx(this.replayBuffer):ek}pipe(){return Xe(this,arguments)}isEmpty(){return this.subscribers===0}isFull(){return!this.isEmpty()}size(){return this.isEmpty()?0:1}publish(t){return this.isFull()?!1:(this.subscriberCount!==0&&(this.value=t,this.subscribers=this.subscriberCount,this.publisherIndex+=1),this.replayBuffer&&this.replayBuffer.offer(t),!0)}publishAll(t){if(this.subscriberCount===0)return this.replayBuffer&&this.replayBuffer.offerAll(t),hn();const n=Da(t);return op(n)?n:this.publish(nR(n))?fd(n,1):n}slide(){this.isFull()&&(this.subscribers=0,this.value=er),this.replayBuffer&&this.replayBuffer.slide()}subscribe(){return this.subscriberCount+=1,new Hpe(this,this.publisherIndex,!1)}}class Hpe{self;subscriberIndex;unsubscribed;constructor(t,n,r){this.self=t,this.subscriberIndex=n,this.unsubscribed=r}isEmpty(){return this.unsubscribed||this.self.subscribers===0||this.subscriberIndex===this.self.publisherIndex}size(){return this.isEmpty()?0:1}poll(t){if(this.isEmpty())return t;const n=this.self.value;return this.self.subscribers-=1,this.self.subscribers===0&&(this.self.value=er),this.subscriberIndex+=1,n}pollUpTo(t){if(this.isEmpty()||t<1)return hn();const n=this.self.value;return this.self.subscribers-=1,this.self.subscribers===0&&(this.self.value=er),this.subscriberIndex+=1,An(n)}unsubscribe(){this.unsubscribed||(this.unsubscribed=!0,this.self.subscriberCount-=1,this.subscriberIndex!==this.self.publisherIndex&&(this.self.subscribers-=1,this.self.subscribers===0&&(this.self.value=er)))}}class Wpe{replayBuffer;publisherHead={value:er,subscribers:0,next:null};publisherTail=this.publisherHead;publisherIndex=0;subscribersIndex=0;capacity=Number.MAX_SAFE_INTEGER;constructor(t){this.replayBuffer=t}replayWindow(){return this.replayBuffer?new Zx(this.replayBuffer):ek}isEmpty(){return this.publisherHead===this.publisherTail}isFull(){return!1}size(){return this.publisherIndex-this.subscribersIndex}publish(t){const n=this.publisherTail.subscribers;return n!==0&&(this.publisherTail.next={value:t,subscribers:n,next:null},this.publisherTail=this.publisherTail.next,this.publisherIndex+=1),this.replayBuffer&&this.replayBuffer.offer(t),!0}publishAll(t){if(this.publisherTail.subscribers!==0)for(const n of t)this.publish(n);else this.replayBuffer&&this.replayBuffer.offerAll(t);return hn()}slide(){this.publisherHead!==this.publisherTail&&(this.publisherHead=this.publisherHead.next,this.publisherHead.value=er,this.subscribersIndex+=1),this.replayBuffer&&this.replayBuffer.slide()}subscribe(){return this.publisherTail.subscribers+=1,new Gpe(this,this.publisherTail,this.publisherIndex,!1)}}class Gpe{self;subscriberHead;subscriberIndex;unsubscribed;constructor(t,n,r,i){this.self=t,this.subscriberHead=n,this.subscriberIndex=r,this.unsubscribed=i}isEmpty(){if(this.unsubscribed)return!0;let t=!0,n=!0;for(;n;)this.subscriberHead===this.self.publisherTail?n=!1:this.subscriberHead.next.value!==er?(t=!1,n=!1):(this.subscriberHead=this.subscriberHead.next,this.subscriberIndex+=1);return t}size(){return this.unsubscribed?0:this.self.publisherIndex-Math.max(this.subscriberIndex,this.self.subscribersIndex)}poll(t){if(this.unsubscribed)return t;let n=!0,r=t;for(;n;)if(this.subscriberHead===this.self.publisherTail)n=!1;else{const i=this.subscriberHead.next.value;i!==er&&(r=i,this.subscriberHead.subscribers-=1,this.subscriberHead.subscribers===0&&(this.self.publisherHead=this.self.publisherHead.next,this.self.publisherHead.value=er,this.self.subscribersIndex+=1),n=!1),this.subscriberHead=this.subscriberHead.next,this.subscriberIndex+=1}return r}pollUpTo(t){const n=[],r=er;let i=0;for(;i!==t;){const o=this.poll(r);o===r?i=t:(n.push(o),i+=1)}return Da(n)}unsubscribe(){if(!this.unsubscribed)for(this.unsubscribed=!0,this.self.publisherTail.subscribers-=1;this.subscriberHead!==this.self.publisherTail;)this.subscriberHead.next.value!==er&&(this.subscriberHead.subscribers-=1,this.subscriberHead.subscribers===0&&(this.self.publisherHead=this.self.publisherHead.next,this.self.publisherHead.value=er,this.self.subscribersIndex+=1)),this.subscriberHead=this.subscriberHead.next}}class Ype extends gp{pubsub;subscribers;subscription;pollers;shutdownHook;shutdownFlag;strategy;replayWindow;[DA]=LA;constructor(t,n,r,i,o,a,c,u){super(),this.pubsub=t,this.subscribers=n,this.subscription=r,this.pollers=i,this.shutdownHook=o,this.shutdownFlag=a,this.strategy=c,this.replayWindow=u}commit(){return this.take}pipe(){return Xe(this,arguments)}capacity(){return this.pubsub.capacity}isActive(){return!Vt(this.shutdownFlag)}get size(){return mt(()=>Vt(this.shutdownFlag)?Hr:Re(this.subscription.size()+this.replayWindow.remaining))}unsafeSize(){return Vt(this.shutdownFlag)?Oe():De(this.subscription.size()+this.replayWindow.remaining)}get isFull(){return mt(()=>Vt(this.shutdownFlag)?Hr:Re(this.subscription.size()===this.capacity()))}get isEmpty(){return ft(this.size,t=>t===0)}get shutdown(){return Hd(Bt(t=>(Bd(this.shutdownFlag,!0),Y(fA(gh(this.pollers),n=>Nx(n,t.id()),!1),Wr(Te(()=>{this.subscribers.delete(this.subscription),this.subscription.unsubscribe(),this.strategy.unsafeOnPubSubEmptySpace(this.pubsub,this.subscribers)})),Mx(Jy(this.shutdownHook,void 0)),Ni))))}get isShutdown(){return Te(()=>Vt(this.shutdownFlag))}get awaitShutdown(){return Zs(this.shutdownHook)}get take(){return Bt(t=>{if(Vt(this.shutdownFlag))return Hr;if(this.replayWindow.remaining>0){const r=this.replayWindow.take();return Re(r)}const n=Zu(this.pollers)?this.subscription.poll(Gn):Gn;if(n===Gn){const r=hp(t.id());return Y(mt(()=>(Y(this.pollers,jc(r)),Y(this.subscribers,gH(this.subscription,this.pollers)),this.strategy.unsafeCompletePollers(this.pubsub,this.subscribers,this.subscription,this.pollers),Vt(this.shutdownFlag)?Hr:Zs(r))),up(()=>Te(()=>nme(this.pollers,r))))}else return this.strategy.unsafeOnPubSubEmptySpace(this.pubsub,this.subscribers),Re(n)})}get takeAll(){return mt(()=>{if(Vt(this.shutdownFlag))return Hr;const t=Zu(this.pollers)?Zpe(this.subscription):hn();return this.strategy.unsafeOnPubSubEmptySpace(this.pubsub,this.subscribers),this.replayWindow.remaining>0?Re(Yr(this.replayWindow.takeAll(),t)):Re(t)})}takeUpTo(t){return mt(()=>{if(Vt(this.shutdownFlag))return Hr;let n;if(this.replayWindow.remaining>=t){const i=this.replayWindow.takeN(t);return Re(i)}else this.replayWindow.remaining>0&&(n=this.replayWindow.takeAll(),t=t-n.length);const r=Zu(this.pollers)?eme(this.subscription,t):hn();return this.strategy.unsafeOnPubSubEmptySpace(this.pubsub,this.subscribers),Re(n?Yr(n,r):r)})}takeBetween(t,n){return mt(()=>bH(this,t,n,hn()))}}const bH=(e,t,n,r)=>n<t?Re(r):Y(e.takeUpTo(n),ke(i=>{const o=t-i.length;return o===1?Y(e.take,ft(a=>Y(r,Yr(i),Mh(a)))):o>1?Y(e.take,ke(a=>bH(e,o-1,n-i.length-1,Y(r,Yr(i),Mh(a))))):Re(Y(r,Yr(i)))}));class Qpe{pubsub;subscribers;scope;shutdownHook;shutdownFlag;strategy;[hH]=pH;[DA]=LA;constructor(t,n,r,i,o,a){this.pubsub=t,this.subscribers=n,this.scope=r,this.shutdownHook=i,this.shutdownFlag=o,this.strategy=a}capacity(){return this.pubsub.capacity}get size(){return mt(()=>Vt(this.shutdownFlag)?Hr:Te(()=>this.pubsub.size()))}unsafeSize(){return Vt(this.shutdownFlag)?Oe():De(this.pubsub.size())}get isFull(){return ft(this.size,t=>t===this.capacity())}get isEmpty(){return ft(this.size,t=>t===0)}get awaitShutdown(){return Zs(this.shutdownHook)}get isShutdown(){return Te(()=>Vt(this.shutdownFlag))}get shutdown(){return Hd(Bt(t=>(Y(this.shutdownFlag,Bd(!0)),Y(this.scope.close(q4(t.id())),Wr(this.strategy.shutdown),Mx(Jy(this.shutdownHook,void 0)),Ni))))}publish(t){return mt(()=>Vt(this.shutdownFlag)?Hr:this.pubsub.publish(t)?(this.strategy.unsafeCompleteSubscribers(this.pubsub,this.subscribers),Re(!0)):this.strategy.handleSurplus(this.pubsub,this.subscribers,An(t),this.shutdownFlag))}isActive(){return!Vt(this.shutdownFlag)}unsafeOffer(t){return Vt(this.shutdownFlag)?!1:this.pubsub.publish(t)?(this.strategy.unsafeCompleteSubscribers(this.pubsub,this.subscribers),!0):!1}publishAll(t){return mt(()=>{if(Vt(this.shutdownFlag))return Hr;const n=tme(this.pubsub,t);return this.strategy.unsafeCompleteSubscribers(this.pubsub,this.subscribers),op(n)?Re(!0):this.strategy.handleSurplus(this.pubsub,this.subscribers,n,this.shutdownFlag)})}get subscribe(){const t=Hy(dA([this.scope.fork(Cc),Fpe(this.pubsub,this.subscribers,this.strategy)]),n=>n[0].addFinalizer(()=>n[1].shutdown));return ft(uA(t,(n,r)=>n[0].close(r)),n=>n[1])}offer(t){return this.publish(t)}offerAll(t){return this.publishAll(t)}pipe(){return Xe(this,arguments)}}const FA=(e,t)=>ke(yp(),n=>ft(Xy(),r=>Xpe(e,new Map,n,r,zd(!1),t))),Xpe=(e,t,n,r,i,o)=>new Qpe(e,t,n,r,i,o),Jpe=e=>{if(e<=0)throw new Uoe(`Cannot construct PubSub with capacity of ${e}`)},vH=(e,t)=>{Lx(e,Re(t))},ow=(e,t)=>Y(e,NR(t)),gh=e=>Y(e,$x(Number.POSITIVE_INFINITY)),Zpe=e=>e.pollUpTo(Number.POSITIVE_INFINITY),eme=(e,t)=>e.pollUpTo(t),tme=(e,t)=>e.publishAll(t),nme=(e,t)=>{ow(e,Y(gh(e),$y(n=>n!==t)))};class rme{publishers=eb();get shutdown(){return ke(Ky,t=>ke(Te(()=>gh(this.publishers)),n=>Gs(n,([r,i,o])=>o?Y(Nx(i,t),Ni):bn,!1,!1)))}handleSurplus(t,n,r,i){return Bt(o=>{const a=hp(o.id());return Y(mt(()=>(this.unsafeOffer(r,a),this.unsafeOnPubSubEmptySpace(t,n),this.unsafeCompleteSubscribers(t,n),Vt(i)?Hr:Zs(a))),up(()=>Te(()=>this.unsafeRemove(a))))})}unsafeOnPubSubEmptySpace(t,n){let r=!0;for(;r&&!t.isFull();){const i=Y(this.publishers,_a(Gn));if(i===Gn)r=!1;else{const o=t.publish(i[0]);o&&i[2]?vH(i[1],!0):o||ow(this.publishers,Y(gh(this.publishers),ai(i))),this.unsafeCompleteSubscribers(t,n)}}}unsafeCompletePollers(t,n,r,i){return zA(this,t,n,r,i)}unsafeCompleteSubscribers(t,n){return BA(this,t,n)}unsafeOffer(t,n){const r=t[Symbol.iterator]();let i=r.next();if(!i.done)for(;;){const o=i.value;if(i=r.next(),i.done){Y(this.publishers,jc([o,n,!0]));break}Y(this.publishers,jc([o,n,!1]))}}unsafeRemove(t){ow(this.publishers,Y(gh(this.publishers),$y(([n,r])=>r!==t)))}}class ime{get shutdown(){return bn}handleSurplus(t,n,r,i){return Re(!1)}unsafeOnPubSubEmptySpace(t,n){}unsafeCompletePollers(t,n,r,i){return zA(this,t,n,r,i)}unsafeCompleteSubscribers(t,n){return BA(this,t,n)}}class ome{get shutdown(){return bn}handleSurplus(t,n,r,i){return Te(()=>(this.unsafeSlidingPublish(t,r),this.unsafeCompleteSubscribers(t,n),!0))}unsafeOnPubSubEmptySpace(t,n){}unsafeCompletePollers(t,n,r,i){return zA(this,t,n,r,i)}unsafeCompleteSubscribers(t,n){return BA(this,t,n)}unsafeSlidingPublish(t,n){const r=n[Symbol.iterator]();let i=r.next();if(!i.done&&t.capacity>0){let o=i.value,a=!0;for(;a;){t.slide();const c=t.publish(o);c&&(i=r.next())&&!i.done?o=i.value:c&&(a=!1)}}}}const zA=(e,t,n,r,i)=>{let o=!0;for(;o&&!r.isEmpty();){const a=Y(i,_a(Gn));if(a===Gn)Y(n,Rpe(r,i)),Zu(i)?o=!1:Y(n,gH(r,i));else{const c=r.poll(Gn);c===Gn?ow(i,Y(gh(i),ai(a))):(vH(a,c),e.unsafeOnPubSubEmptySpace(t,n))}}},BA=(e,t,n)=>{for(const[r,i]of n)for(const o of i)e.unsafeCompletePollers(t,n,r,o)};class SH{capacity;constructor(t){this.capacity=t}head={value:er,next:null};tail=this.head;size=0;index=0;slide(){this.index++}offer(t){this.tail.value=t,this.tail.next={value:er,next:null},this.tail=this.tail.next,this.size===this.capacity?this.head=this.head.next:this.size+=1}offerAll(t){for(const n of t)this.offer(n)}}class Zx{buffer;head;index;remaining;constructor(t){this.buffer=t,this.index=t.index,this.remaining=t.size,this.head=t.head}fastForward(){for(;this.index<this.buffer.index;)this.head=this.head.next,this.index++}take(){if(this.remaining===0)return;this.index<this.buffer.index&&this.fastForward(),this.remaining--;const t=this.head.value;return this.head=this.head.next,t}takeN(t){if(this.remaining===0)return hn();this.index<this.buffer.index&&this.fastForward();const n=Math.min(t,this.remaining),r=new Array(n);for(let i=0;i<n;i++){const o=this.head.value;this.head=this.head.next,r[i]=o}return this.remaining-=n,Xs(r)}takeAll(){return this.takeN(this.remaining)}}const ek={remaining:0,take:()=>{},takeN:()=>hn(),takeAll:()=>hn()},sme=Ape,ame=Ope,sw=Dpe,Tj=Ppe,Sl=Npe,lme=Lpe,Cj=$pe,qA=cpe,cme=upe,yh=dpe,ume=ppe,dme=mpe,Hh=gpe,fr=ype,Mj=bpe,oy=XT,Rj=vpe,fme=wpe,wH="Continue",hme="Close",pme="Yield",mme="effect/ChannelChildExecutorDecision",Aj=Symbol.for(mme),gme={[Aj]:Aj},xH=e=>{const t=Object.create(gme);return t._tag=wH,t},XS="ContinuationK",yme="ContinuationFinalizer",kH=Symbol.for("effect/ChannelContinuation"),_H={_Env:e=>e,_InErr:e=>e,_InElem:e=>e,_InDone:e=>e,_OutErr:e=>e,_OutDone:e=>e,_OutErr2:e=>e,_OutElem:e=>e,_OutDone2:e=>e};class IH{onSuccess;onHalt;_tag=XS;[kH]=_H;constructor(t,n){this.onSuccess=t,this.onHalt=n}onExit(t){return AR(t)?this.onHalt(t.cause):this.onSuccess(t.value)}}class bme{finalizer;_tag=yme;[kH]=_H;constructor(t){this.finalizer=t}}const EH="PullAfterNext",vme="PullAfterAllEnqueued",Sme="effect/ChannelUpstreamPullStrategy",wme=Symbol.for(Sme),xme={_A:e=>e},kme={[wme]:xme},TH=e=>{const t=Object.create(kme);return t._tag=EH,t.emitSeparator=e,t},CH="BracketOut",MH="Bridge",UA="ConcatAll",RH="Emit",AH="Ensuring",OH="Fail",DH="Fold",PH="FromEffect",NH="PipeTo",_me="Provide",LH="Read",$H="Succeed",jH="SucceedNow",FH="Suspend",Ime="effect/Channel",zH=Symbol.for(Ime),Eme={_Env:e=>e,_InErr:e=>e,_InElem:e=>e,_InDone:e=>e,_OutErr:e=>e,_OutElem:e=>e,_OutDone:e=>e},go={[zH]:Eme,pipe(){return Xe(this,arguments)}},BH=e=>ht(e,zH)||Gd(e),Tme=G(2,(e,t)=>{const n=Object.create(go);return n._tag=CH,n.acquire=()=>e,n.finalizer=t,n}),qH=(e,t,n)=>{const r=Object.create(go);return r._tag=UA,r.combineInners=t,r.combineAll=n,r.onPull=()=>TH(Oe()),r.onEmit=()=>xH,r.value=()=>e,r.k=Lt,r},Cme=G(4,(e,t,n,r)=>{const i=Object.create(go);return i._tag=UA,i.combineInners=n,i.combineAll=r,i.onPull=()=>TH(Oe()),i.onEmit=()=>xH,i.value=()=>e,i.k=t,i}),VA=G(2,(e,t)=>{const n=Object.create(go);return n._tag=MH,n.input=t,n.channel=e,n}),Mme=G(2,(e,t)=>{const n=Object.create(go);return n._tag=AH,n.channel=e,n.finalizer=t,n}),tk=e=>Vn(Qx(e)),Vn=e=>Rme(()=>e),Rme=e=>{const t=Object.create(go);return t._tag=OH,t.error=e,t},on=G(2,(e,t)=>{const n=Object.create(go);return n._tag=DH,n.channel=e,n.k=new IH(t,Vn),n}),wr=e=>{const t=Object.create(go);return t._tag=PH,t.effect=()=>e,t},wi=G(2,(e,t)=>{const n=Object.create(go);return n._tag=NH,n.left=()=>e,n.right=()=>t,n}),KA=e=>Is({onInput:e.onInput,onFailure:t=>Hi(v5(t),{onLeft:e.onFailure,onRight:Vn}),onDone:e.onDone}),Is=e=>{const t=Object.create(go);return t._tag=LH,t.more=e.onInput,t.done=new IH(e.onDone,e.onFailure),t},HA=e=>UH(()=>e),Td=e=>{const t=Object.create(go);return t._tag=jH,t.terminal=e,t},WA=e=>{const t=Object.create(go);return t._tag=FH,t.channel=e,t},UH=e=>{const t=Object.create(go);return t._tag=$H,t.evaluate=e,t},Xr=Td(void 0),Mn=e=>{const t=Object.create(go);return t._tag=RH,t.out=e,t},fb="Done",hb="Emit",xp="FromEffect",pb="Read",Ame=Symbol.for("effect/ChannelState"),Ome={_E:e=>e,_R:e=>e},nk={[Ame]:Ome},jf=()=>{const e=Object.create(nk);return e._tag=fb,e},g1=()=>{const e=Object.create(nk);return e._tag=hb,e},Lm=e=>{const t=Object.create(nk);return t._tag=xp,t.effect=e,t},y1=(e,t,n,r)=>{const i=Object.create(nk);return i._tag=pb,i.upstream=e,i.onEffect=t,i.onEmit=n,i.onDone=r,i},aw=e=>e._tag===xp,Dme=e=>aw(e)?e.effect:ce,Oj=e=>aw(e)?Rhe(e.effect):void 0,VH="PullFromChild",JT="PullFromUpstream",ZT="DrainChildExecutors",KH="Emit";class Qv{childExecutor;parentSubexecutor;onEmit;_tag=VH;constructor(t,n,r){this.childExecutor=t,this.parentSubexecutor=n,this.onEmit=r}close(t){const n=this.childExecutor.close(t),r=this.parentSubexecutor.close(t);return n!==void 0&&r!==void 0?Jx(en(n),en(r),(i,o)=>Y(i,Ug(o))):n!==void 0?n:r!==void 0?r:void 0}enqueuePullFromChild(t){return this}}class Fu{upstreamExecutor;createChild;lastDone;activeChildExecutors;combineChildResults;combineWithChildResult;onPull;onEmit;_tag=JT;constructor(t,n,r,i,o,a,c,u){this.upstreamExecutor=t,this.createChild=n,this.lastDone=r,this.activeChildExecutors=i,this.combineChildResults=o,this.combineWithChildResult=a,this.onPull=c,this.onEmit=u}close(t){const n=this.upstreamExecutor.close(t),i=[...this.activeChildExecutors.map(o=>o!==void 0?o.childExecutor.close(t):void 0),n].reduce((o,a)=>o!==void 0&&a!==void 0?Jx(o,en(a),(c,u)=>Ug(c,u)):o!==void 0?o:a!==void 0?en(a):void 0,void 0);return i}enqueuePullFromChild(t){return new Fu(this.upstreamExecutor,this.createChild,this.lastDone,[...this.activeChildExecutors,t],this.combineChildResults,this.combineWithChildResult,this.onPull,this.onEmit)}}class nh{upstreamExecutor;lastDone;activeChildExecutors;upstreamDone;combineChildResults;combineWithChildResult;onPull;_tag=ZT;constructor(t,n,r,i,o,a,c){this.upstreamExecutor=t,this.lastDone=n,this.activeChildExecutors=r,this.upstreamDone=i,this.combineChildResults=o,this.combineWithChildResult=a,this.onPull=c}close(t){const n=this.upstreamExecutor.close(t),i=[...this.activeChildExecutors.map(o=>o!==void 0?o.childExecutor.close(t):void 0),n].reduce((o,a)=>o!==void 0&&a!==void 0?Jx(o,en(a),(c,u)=>Ug(c,u)):o!==void 0?o:a!==void 0?en(a):void 0,void 0);return i}enqueuePullFromChild(t){return new nh(this.upstreamExecutor,this.lastDone,[...this.activeChildExecutors,t],this.upstreamDone,this.combineChildResults,this.combineWithChildResult,this.onPull)}}class b1{value;next;_tag=KH;constructor(t,n){this.value=t,this.next=n}close(t){const n=this.next.close(t);return n}enqueuePullFromChild(t){return this}}const Pme="Pulled",Nme="NoUpstream",Lme="effect/ChannelUpstreamPullRequest",$me=Symbol.for(Lme),jme={_A:e=>e},HH={[$me]:jme},Dj=e=>{const t=Object.create(HH);return t._tag=Pme,t.value=e,t},Fme=e=>{const t=Object.create(HH);return t._tag=Nme,t.activeDownstreamCount=e,t};class qu{_activeSubexecutor=void 0;_cancelled=void 0;_closeLastSubstream=void 0;_currentChannel;_done=void 0;_doneStack=[];_emitted=void 0;_executeCloseLastSubstream;_input=void 0;_inProgressFinalizer=void 0;_providedEnv;constructor(t,n,r){this._currentChannel=t,this._executeCloseLastSubstream=r,this._providedEnv=n}run(){let t;for(;t===void 0;)if(this._cancelled!==void 0)t=this.processCancellation();else if(this._activeSubexecutor!==void 0)t=this.runSubexecutor();else try{if(this._currentChannel===void 0)t=jf();else switch(Gd(this._currentChannel)&&(this._currentChannel=wr(this._currentChannel)),this._currentChannel._tag){case CH:{t=this.runBracketOut(this._currentChannel);break}case MH:{const n=this._currentChannel.input;if(this._currentChannel=this._currentChannel.channel,this._input!==void 0){const r=this._input;this._input=void 0;const i=()=>$e(n.awaitRead(),()=>Tn(()=>{const o=r.run();switch(o._tag){case fb:return Wi(r.getDone(),{onFailure:a=>n.error(a),onSuccess:a=>n.done(a)});case hb:return $e(n.emit(r.getEmit()),()=>i());case xp:return jo(o.effect,{onFailure:a=>n.error(a),onSuccess:()=>i()});case pb:return GA(o,()=>i(),a=>n.error(a))}}));t=Lm($e(rH($o(i())),o=>Ye(()=>this.addFinalizer(a=>$e(Mi(o),()=>Tn(()=>{const c=this.restorePipe(a,r);return c!==void 0?c:ce}))))))}break}case UA:{const n=new qu(this._currentChannel.value(),this._providedEnv,i=>Ye(()=>{const o=this._closeLastSubstream===void 0?ce:this._closeLastSubstream;this._closeLastSubstream=Y(o,Ze(i))}));n._input=this._input;const r=this._currentChannel;this._activeSubexecutor=new Fu(n,i=>r.k(i),void 0,[],(i,o)=>r.combineInners(i,o),(i,o)=>r.combineAll(i,o),i=>r.onPull(i),i=>r.onEmit(i)),this._closeLastSubstream=void 0,this._currentChannel=void 0;break}case RH:{this._emitted=this._currentChannel.out,this._currentChannel=this._activeSubexecutor!==void 0?void 0:Xr,t=g1();break}case AH:{this.runEnsuring(this._currentChannel);break}case OH:{t=this.doneHalt(this._currentChannel.error());break}case DH:{this._doneStack.push(this._currentChannel.k),this._currentChannel=this._currentChannel.channel;break}case PH:{const n=this._providedEnv===void 0?this._currentChannel.effect():Y(this._currentChannel.effect(),Ea(this._providedEnv));t=Lm(jo(n,{onFailure:r=>{const i=this.doneHalt(r);return i!==void 0&&aw(i)?i.effect:ce},onSuccess:r=>{const i=this.doneSucceed(r);return i!==void 0&&aw(i)?i.effect:ce}}));break}case NH:{const n=this._input,r=new qu(this._currentChannel.left(),this._providedEnv,i=>this._executeCloseLastSubstream(i));r._input=n,this._input=r,this.addFinalizer(i=>{const o=this.restorePipe(i,n);return o!==void 0?o:ce}),this._currentChannel=this._currentChannel.right();break}case _me:{const n=this._providedEnv;this._providedEnv=this._currentChannel.context(),this._currentChannel=this._currentChannel.inner,this.addFinalizer(()=>Ye(()=>{this._providedEnv=n}));break}case LH:{const n=this._currentChannel;t=y1(this._input,Lt,r=>{try{this._currentChannel=n.more(r)}catch(i){this._currentChannel=n.done.onExit(ise(i))}},r=>{const i=o=>n.done.onExit(o);this._currentChannel=i(r)});break}case $H:{t=this.doneSucceed(this._currentChannel.evaluate());break}case jH:{t=this.doneSucceed(this._currentChannel.terminal);break}case FH:{this._currentChannel=this._currentChannel.channel();break}}}catch(n){this._currentChannel=Vn(Qg(n))}return t}getDone(){return this._done}getEmit(){return this._emitted}cancelWith(t){this._cancelled=t}clearInProgressFinalizer(){this._inProgressFinalizer=void 0}storeInProgressFinalizer(t){this._inProgressFinalizer=t}popAllFinalizers(t){const n=[];let r=this._doneStack.pop();for(;r;)r._tag==="ContinuationFinalizer"&&n.push(r.finalizer),r=this._doneStack.pop();const i=n.length===0?ce:S1(n,t);return this.storeInProgressFinalizer(i),i}popNextFinalizers(){const t=[];for(;this._doneStack.length!==0;){const n=this._doneStack[this._doneStack.length-1];if(n._tag===XS)return t;t.push(n),this._doneStack.pop()}return t}restorePipe(t,n){const r=this._input;return this._input=n,r!==void 0?r.close(t):ce}close(t){let n;const r=this._inProgressFinalizer;r!==void 0&&(n=Y(r,Gi(Ye(()=>this.clearInProgressFinalizer()))));let i;const o=this.popAllFinalizers(t);o!==void 0&&(i=Y(o,Gi(Ye(()=>this.clearInProgressFinalizer()))));const a=this._activeSubexecutor===void 0?void 0:this._activeSubexecutor.close(t);if(!(a===void 0&&n===void 0&&i===void 0))return Y(en(v1(a)),Kh(en(v1(n))),Kh(en(v1(i))),rt(([[c,u],d])=>Y(c,Ug(u),Ug(d))),Ic,$e(c=>Tn(()=>c)))}doneSucceed(t){if(this._doneStack.length===0)return this._done=Lo(t),this._currentChannel=void 0,jf();const n=this._doneStack[this._doneStack.length-1];if(n._tag===XS){this._doneStack.pop(),this._currentChannel=n.onSuccess(t);return}const r=this.popNextFinalizers();if(this._doneStack.length===0)return this._doneStack=r.reverse(),this._done=Lo(t),this._currentChannel=void 0,jf();const i=S1(r.map(a=>a.finalizer),Lo(t));this.storeInProgressFinalizer(i);const o=Y(i,Gi(Ye(()=>this.clearInProgressFinalizer())),Ic,$e(()=>Ye(()=>this.doneSucceed(t))));return Lm(o)}doneHalt(t){if(this._doneStack.length===0)return this._done=ys(t),this._currentChannel=void 0,jf();const n=this._doneStack[this._doneStack.length-1];if(n._tag===XS){this._doneStack.pop();try{this._currentChannel=n.onHalt(t)}catch(a){this._currentChannel=Vn(Qg(a))}return}const r=this.popNextFinalizers();if(this._doneStack.length===0)return this._doneStack=r.reverse(),this._done=ys(t),this._currentChannel=void 0,jf();const i=S1(r.map(a=>a.finalizer),ys(t));this.storeInProgressFinalizer(i);const o=Y(i,Gi(Ye(()=>this.clearInProgressFinalizer())),Ic,$e(()=>Ye(()=>this.doneHalt(t))));return Lm(o)}processCancellation(){return this._currentChannel=void 0,this._done=this._cancelled,this._cancelled=void 0,jf()}runBracketOut(t){const n=Ic(jo(this.provide(t.acquire()),{onFailure:r=>Ye(()=>{this._currentChannel=Vn(r)}),onSuccess:r=>Ye(()=>{this.addFinalizer(i=>this.provide(t.finalizer(r,i))),this._currentChannel=Mn(r)})}));return Lm(n)}provide(t){return this._providedEnv===void 0?t:Y(t,Ea(this._providedEnv))}runEnsuring(t){this.addFinalizer(t.finalizer),this._currentChannel=t.channel}addFinalizer(t){this._doneStack.push(new bme(t))}runSubexecutor(){const t=this._activeSubexecutor;switch(t._tag){case VH:return this.pullFromChild(t.childExecutor,t.parentSubexecutor,t.onEmit,t);case JT:return this.pullFromUpstream(t);case ZT:return this.drainChildExecutors(t);case KH:return this._emitted=t.value,this._activeSubexecutor=t.next,g1()}}replaceSubexecutor(t){this._currentChannel=void 0,this._activeSubexecutor=t}finishWithExit(t){const n=Wi(t,{onFailure:r=>this.doneHalt(r),onSuccess:r=>this.doneSucceed(r)});return this._activeSubexecutor=void 0,n===void 0?ce:Dme(n)}finishSubexecutorWithCloseEffect(t,...n){this.addFinalizer(()=>Y(n,ln(i=>Y(Ye(()=>i(t)),$e(o=>o!==void 0?o:ce)),{discard:!0})));const r=Y(t,Wi({onFailure:i=>this.doneHalt(i),onSuccess:i=>this.doneSucceed(i)}));return this._activeSubexecutor=void 0,r}applyUpstreamPullStrategy(t,n,r){switch(r._tag){case EH:{const i=!t||n.some(o=>o!==void 0);return[r.emitSeparator,i?[void 0,...n]:n]}case vme:{const i=!t||n.some(o=>o!==void 0);return[r.emitSeparator,i?[...n,void 0]:n]}}}pullFromChild(t,n,r,i){return y1(t,Lt,o=>{const a=r(o);switch(a._tag){case wH:break;case hme:{this.finishWithDoneValue(t,n,a.value);break}case pme:{const c=n.enqueuePullFromChild(i);this.replaceSubexecutor(c);break}}this._activeSubexecutor=new b1(o,this._activeSubexecutor)},Wi({onFailure:o=>{const a=this.handleSubexecutorFailure(t,n,o);return a===void 0?void 0:Oj(a)},onSuccess:o=>{this.finishWithDoneValue(t,n,o)}}))}finishWithDoneValue(t,n,r){const i=n;switch(i._tag){case JT:{const o=new Fu(i.upstreamExecutor,i.createChild,i.lastDone!==void 0?i.combineChildResults(i.lastDone,r):r,i.activeChildExecutors,i.combineChildResults,i.combineWithChildResult,i.onPull,i.onEmit);this._closeLastSubstream=t.close(Lo(r)),this.replaceSubexecutor(o);break}case ZT:{const o=new nh(i.upstreamExecutor,i.lastDone!==void 0?i.combineChildResults(i.lastDone,r):r,i.activeChildExecutors,i.upstreamDone,i.combineChildResults,i.combineWithChildResult,i.onPull);this._closeLastSubstream=t.close(Lo(r)),this.replaceSubexecutor(o);break}}}handleSubexecutorFailure(t,n,r){return this.finishSubexecutorWithCloseEffect(ys(r),i=>n.close(i),i=>t.close(i))}pullFromUpstream(t){if(t.activeChildExecutors.length===0)return this.performPullFromUpstream(t);const n=t.activeChildExecutors[0],r=new Fu(t.upstreamExecutor,t.createChild,t.lastDone,t.activeChildExecutors.slice(1),t.combineChildResults,t.combineWithChildResult,t.onPull,t.onEmit);if(n===void 0)return this.performPullFromUpstream(r);this.replaceSubexecutor(new Qv(n.childExecutor,r,n.onEmit))}performPullFromUpstream(t){return y1(t.upstreamExecutor,n=>{const r=this._closeLastSubstream===void 0?ce:this._closeLastSubstream;return this._closeLastSubstream=void 0,Y(this._executeCloseLastSubstream(r),Ze(n))},n=>{if(this._closeLastSubstream!==void 0){const a=this._closeLastSubstream;return this._closeLastSubstream=void 0,Y(this._executeCloseLastSubstream(a),rt(()=>{const c=new qu(t.createChild(n),this._providedEnv,this._executeCloseLastSubstream);c._input=this._input;const[u,d]=this.applyUpstreamPullStrategy(!1,t.activeChildExecutors,t.onPull(Dj(n)));this._activeSubexecutor=new Qv(c,new Fu(t.upstreamExecutor,t.createChild,t.lastDone,d,t.combineChildResults,t.combineWithChildResult,t.onPull,t.onEmit),t.onEmit),Ce(u)&&(this._activeSubexecutor=new b1(u.value,this._activeSubexecutor))}))}const r=new qu(t.createChild(n),this._providedEnv,this._executeCloseLastSubstream);r._input=this._input;const[i,o]=this.applyUpstreamPullStrategy(!1,t.activeChildExecutors,t.onPull(Dj(n)));this._activeSubexecutor=new Qv(r,new Fu(t.upstreamExecutor,t.createChild,t.lastDone,o,t.combineChildResults,t.combineWithChildResult,t.onPull,t.onEmit),t.onEmit),Ce(i)&&(this._activeSubexecutor=new b1(i.value,this._activeSubexecutor))},n=>{if(t.activeChildExecutors.some(o=>o!==void 0)){const o=new nh(t.upstreamExecutor,t.lastDone,[void 0,...t.activeChildExecutors],t.upstreamExecutor.getDone(),t.combineChildResults,t.combineWithChildResult,t.onPull);if(this._closeLastSubstream!==void 0){const a=this._closeLastSubstream;return this._closeLastSubstream=void 0,Y(this._executeCloseLastSubstream(a),rt(()=>this.replaceSubexecutor(o)))}this.replaceSubexecutor(o);return}const r=this._closeLastSubstream,i=this.finishSubexecutorWithCloseEffect(Y(n,sse(o=>t.combineWithChildResult(t.lastDone,o))),()=>r,o=>t.upstreamExecutor.close(o));return i===void 0?void 0:Oj(i)})}drainChildExecutors(t){if(t.activeChildExecutors.length===0){const o=this._closeLastSubstream;return o!==void 0&&this.addFinalizer(()=>fn(o)),this.finishSubexecutorWithCloseEffect(t.upstreamDone,()=>o,a=>t.upstreamExecutor.close(a))}const n=t.activeChildExecutors[0],r=t.activeChildExecutors.slice(1);if(n===void 0){const[o,a]=this.applyUpstreamPullStrategy(!0,r,t.onPull(Fme(r.reduce((c,u)=>u!==void 0?c+1:c,0))));return this.replaceSubexecutor(new nh(t.upstreamExecutor,t.lastDone,a,t.upstreamDone,t.combineChildResults,t.combineWithChildResult,t.onPull)),Ce(o)?(this._emitted=o.value,g1()):void 0}const i=new nh(t.upstreamExecutor,t.lastDone,r,t.upstreamDone,t.combineChildResults,t.combineWithChildResult,t.onPull);this.replaceSubexecutor(new Qv(n.childExecutor,i,n.onEmit))}}const v1=e=>e!==void 0?e:ce,S1=(e,t)=>Y(ln(e,n=>en(n(t))),rt(n=>Y(rse(n),Ln(()=>js))),$e(n=>Tn(()=>n))),GA=(e,t,n)=>{const r=[e],i=()=>{const o=r.pop();if(o===void 0||o.upstream===void 0)return Ci("Unexpected end of input for channel execution");const a=o.upstream.run();switch(a._tag){case hb:{const c=o.onEmit(o.upstream.getEmit());return r.length===0?c===void 0?Tn(t):Y(c,jo({onFailure:n,onSuccess:t})):c===void 0?Tn(()=>i()):Y(c,jo({onFailure:n,onSuccess:()=>i()}))}case fb:{const c=o.onDone(o.upstream.getDone());return r.length===0?c===void 0?Tn(t):Y(c,jo({onFailure:n,onSuccess:t})):c===void 0?Tn(()=>i()):Y(c,jo({onFailure:n,onSuccess:()=>i()}))}case xp:return r.push(o),Y(o.onEffect(a.effect),At(c=>Tn(()=>{const u=o.onDone(ys(c));return u===void 0?ce:u})),jo({onFailure:n,onSuccess:()=>i()}));case pb:return r.push(o),r.push(a),Tn(()=>i())}};return i()},YA=G(2,(e,t)=>{const n=(r,i,o)=>tH(Ye(()=>new qu(e,void 0,Lt)),a=>Tn(()=>JS(a.run(),a).pipe(sH(r),Ze(kn(r)),OA(kn(i)))),(a,c)=>{const u=a.close(c);return u===void 0?ce:MA(u,d=>Mc(o,pr(d)))});return IA(r=>ru([T5(t,K0),mr(),mr()]).pipe($e(([i,o,a])=>r(n(o,a,i)).pipe(ho(t),$e(c=>t.addFinalizer(u=>{const d=AR(u)?Tde(u.cause):void 0;return B0(o).pipe($e(h=>h?ri(a,void 0).pipe(Ze(zc(c)),Ze(vj(c))):ri(a,void 0).pipe(Ze(d&&fR(d)>0?P5(c,dre(d)):Mi(c)),Ze(vj(c)))))}).pipe(Ze(r(kn(o)))))))))}),JS=(e,t)=>{const n=e;switch(n._tag){case xp:return Y(n.effect,$e(()=>JS(t.run(),t)));case hb:return JS(t.run(),t);case fb:return Tn(()=>t.getDone());case pb:return GA(n,()=>JS(t.run(),t),pr)}},zme="Done",Bme="Await",qme="effect/ChannelMergeDecision",Ume=Symbol.for(qme),Vme={[Ume]:{_R:e=>e,_E0:e=>e,_Z0:e=>e,_E:e=>e,_Z:e=>e}},Pj=e=>{const t=Object.create(Vme);return t._tag=Bme,t.f=e,t},WH="BothRunning",GH="LeftDone",YH="RightDone",Kme="effect/ChannelMergeState",Nj=Symbol.for(Kme),QA={[Nj]:Nj},w1=(e,t)=>{const n=Object.create(QA);return n._tag=WH,n.left=e,n.right=t,n},Lj=e=>{const t=Object.create(QA);return t._tag=GH,t.f=e,t},$j=e=>{const t=Object.create(QA);return t._tag=YH,t.f=e,t},QH="BackPressure",XH="BufferSliding",Hme="effect/ChannelMergeStrategy",jj=Symbol.for(Hme),JH={[jj]:jj},Wme=e=>{const t=Object.create(JH);return t._tag=QH,t},Gme=e=>{const t=Object.create(JH);return t._tag=XH,t},Yme=G(2,(e,{onBackPressure:t,onBufferSliding:n})=>{switch(e._tag){case QH:return t();case XH:return n()}}),Yf="Empty",Zm="Emit",eg="Error",tg="Done",ZH=e=>({_tag:Yf,notifyProducer:e}),x1=e=>({_tag:Zm,notifyConsumers:e}),Qme=e=>({_tag:eg,cause:e}),Xme=e=>({_tag:tg,done:e});class Jme{ref;constructor(t){this.ref=t}awaitRead(){return qs(xr(this.ref,t=>t._tag===Yf?[kn(t.notifyProducer),t]:[ce,t]))}get close(){return Phe(t=>this.error(_de(t)))}done(t){return qs(xr(this.ref,n=>{switch(n._tag){case Yf:return[kn(n.notifyProducer),n];case Zm:return[ln(n.notifyConsumers,r=>ri(r,gt(t)),{discard:!0}),Xme(t)];case eg:return[$f,n];case tg:return[$f,n]}}))}emit(t){return $e(mr(),n=>qs(xr(this.ref,r=>{switch(r._tag){case Yf:return[kn(r.notifyProducer),r];case Zm:{const i=r.notifyConsumers[0],o=r.notifyConsumers.slice(1);if(i!==void 0)return[ri(i,St(t)),o.length===0?ZH(n):x1(o)];throw new Error("Bug: Channel.SingleProducerAsyncInput.emit - Queue was empty! please report an issue at https://github.com/Effect-TS/effect/issues")}case eg:return[$f,r];case tg:return[$f,r]}})))}error(t){return qs(xr(this.ref,n=>{switch(n._tag){case Yf:return[kn(n.notifyProducer),n];case Zm:return[ln(n.notifyConsumers,r=>RR(r,t),{discard:!0}),Qme(t)];case eg:return[$f,n];case tg:return[$f,n]}}))}get take(){return this.takeWith(t=>ys(w5(t,gt)),t=>Lo(t),t=>gg(St(t)))}takeWith(t,n,r){return $e(mr(),i=>qs(xr(this.ref,o=>{switch(o._tag){case Yf:return[Ze(ri(o.notifyProducer,void 0),nw(kn(i),{onFailure:t,onSuccess:Hi({onLeft:r,onRight:n})})),x1([i])];case Zm:return[nw(kn(i),{onFailure:t,onSuccess:Hi({onLeft:r,onRight:n})}),x1([...o.notifyConsumers,i])];case eg:return[fn(t(o.cause)),o];case tg:return[fn(r(o.done)),o]}})))}}const XA=()=>Y(mr(),$e(e=>Qn(ZH(e))),rt(e=>new Jme(e))),lw=G(2,(e,t)=>Cme(e,t,()=>{},()=>{})),JA=e=>{const t=Is({onInput:()=>t,onFailure:Vn,onDone:HA});return wi(e,t)},e6=G(2,(e,t)=>Mme(e,()=>t)),Zme=e=>on(e,Lt),rk=e=>$r(e.takeWith(Vn,t=>on(Mn(t),()=>rk(e)),HA)),t6=()=>KA({onInput:e=>on(Mn(e),()=>t6()),onFailure:tk,onDone:Td}),n6=G(2,(e,t)=>on(e,n=>UH(()=>t(n)))),ik=G(2,(e,t)=>{const n=KA({onInput:r=>on(Mn(t(r)),()=>n),onFailure:tk,onDone:Td});return wi(e,n)}),ege=G(3,(e,t,n)=>eO(r=>re(function*(){const i=yield*XA(),o=rk(i),a=yield*qA(n);yield*Mc(r,Hh(a));const c=yield*mr(),u=n===Number.POSITIVE_INFINITY?p=>Lt:(yield*Xx(n)).withPermits;yield*(yield*o.pipe(wi(e),bh(r))).pipe(jo({onFailure:p=>fr(a,pr(p)),onSuccess:Hi({onLeft:p=>Ze($o(u(n)(ce)),Gt(fr(a,fn(gt(p))))),onRight:p=>re(function*(){const g=yield*mr(),y=yield*mr();yield*fr(a,rt(kn(g),St)),yield*ri(y,void 0).pipe(Ze(IA(b=>en(b(kn(c))).pipe(aH(en(b(t(p)))),$e(Lt))).pipe(MA(b=>RR(c,b)),sH(g))),u(1),ho(r)),yield*kn(y)})})}),RA,$o,ho(r));const h=$r(nw(qs(oy(a)),{onFailure:Vn,onSuccess:Hi({onLeft:Td,onRight:p=>on(Mn(p),()=>h)})}));return VA(h,i)}))),tge=e=>t=>nge(e)(t,k0),nge=({bufferSize:e=16,concurrency:t,mergeStrategy:n=Wme()})=>(r,i)=>eO(o=>re(function*(){const a=t==="unbounded"?Number.MAX_SAFE_INTEGER:t,c=yield*XA(),u=rk(c),d=yield*qA(e);yield*Mc(o,Hh(d));const h=yield*yh();yield*Mc(o,Hh(h));const p=yield*Qn(Oe()),g=yield*mr(),y=(yield*Xx(a)).withPermits,b=yield*bh(wi(u,r),o);function S(x){return x.pipe($e(Hi({onLeft:I=>fn(De(I)),onRight:I=>vi(fr(d,fn(St(I))),Oe())})),Ej({until:I=>Ce(I)}),$e(I=>bs(p,rr({onNone:()=>De(I.value),onSome:_=>De(i(_,I.value))}))),At(I=>Ed(I)?pr(I):fr(d,pr(I)).pipe(Ze(ri(g,void 0)),Gt)))}yield*b.pipe(jo({onFailure:x=>fr(d,pr(x)).pipe(Ze(fn(!1))),onSuccess:Hi({onLeft:x=>CA($o(kn(g)),$o(y(a)(ce)),{onSelfDone:(I,_)=>vi(Mi(_),!1),onOtherDone:(I,_)=>Ze(Mi(_),Xi(p).pipe($e(rr({onNone:()=>fr(d,fn(gt(x))),onSome:M=>fr(d,fn(gt(i(M,x))))})),vi(!1)))}),onRight:x=>Yme(n,{onBackPressure:()=>re(function*(){const I=yield*mr(),_=QT(C=>bh(wi(u,x),C).pipe($e(E=>m1(en(S(E)),en($o(kn(g))))),$e(Lt)));return yield*ri(I,void 0).pipe(Ze(_),y(1),ho(o)),yield*kn(I),!(yield*B0(g))}),onBufferSliding:()=>re(function*(){const I=yield*mr(),_=yield*mr(),M=yield*ume(h);yield*oy(h).pipe($e(T=>ri(T,void 0)),Fhe(()=>M>=a)),yield*fr(h,I);const C=QT(T=>bh(wi(u,x),T).pipe($e(A=>en(S(A)).pipe(m1(en($o(kn(g)))),m1(en($o(kn(I)))))),$e(Lt)));return yield*ri(_,void 0).pipe(Ze(C),y(1),ho(o)),yield*kn(_),!(yield*B0(g))})})})}),Ej({while:x=>x}),ho(o));const w=Y(oy(d),qs,nw({onFailure:Vn,onSuccess:Hi({onLeft:Td,onRight:x=>on(Mn(x),()=>w)})}),$r);return VA(w,c)})),r6=G(3,(e,t,n)=>tge(n)(ik(e,t))),rge=G(2,(e,t)=>{function n(r){return re(function*(){const i=yield*XA(),o=rk(i),a=yield*bh(wi(o,e),r),c=yield*bh(wi(o,t.other),r);function u(h,p,g){return(y,b,S)=>{function w(x){const I=x;return I._tag===zme?fn(wr(Ze(Mi(p),I.effect))):rt(zc(p),Wi({onFailure:_=>wr(I.f(ys(_))),onSuccess:Hi({onLeft:_=>wr(I.f(Lo(_))),onRight:_=>mb(Mn(_),d(S(I.f)))})}))}return Wi(h,{onFailure:x=>w(y(ys(x))),onSuccess:Hi({onLeft:x=>w(y(Lo(x))),onRight:x=>fn(on(Mn(x),()=>on(wr(ho($o(g),r)),I=>d(b(I,p)))))})})}}function d(h){switch(h._tag){case WH:{const p=$o(th(h.left)),g=$o(th(h.right));return $r(CA(p,g,{onSelfDone:(y,b)=>Ze(Mi(b),u(y,h.right,a)(t.onSelfDone,w1,S=>Lj(S))),onOtherDone:(y,b)=>Ze(Mi(b),u(y,h.left,c)(t.onOtherDone,(S,w)=>w1(w,S),S=>$j(S)))}))}case GH:return $r(rt(en(c),Wi({onFailure:p=>wr(h.f(ys(p))),onSuccess:Hi({onLeft:p=>wr(h.f(Lo(p))),onRight:p=>on(Mn(p),()=>d(Lj(h.f)))})})));case YH:return $r(rt(en(a),Wi({onFailure:p=>wr(h.f(ys(p))),onSuccess:Hi({onLeft:p=>wr(h.f(Lo(p))),onRight:p=>on(Mn(p),()=>d($j(h.f)))})})))}}return wr(Ij(h=>{const p=Ij(b=>(b.transferChildren(h.scope()),ce)),g=$o(a).pipe(Gi(p),ho(r)),y=$o(c).pipe(Gi(p),ho(r));return Jx(g,y,(b,S)=>w1(b,S))})).pipe(on(d),VA(i))})}return eO(n)}),ZA=G(2,(e,t)=>WA(()=>{let n;const r=KA({onInput:o=>on(Mn(o),()=>r),onFailure:o=>(n=lge(o),Vn(Qg(n))),onDone:Td}),i=Is({onInput:o=>Y(Mn(o),on(()=>i)),onFailure:o=>Ede(o)&&cge(o.defect)&&bt(o.defect,n)?tk(o.defect.error):Vn(o),onDone:Td});return wi(wi(wi(e,r),t),i)})),ige=e=>QT(t=>YA(e,t)),oge=e=>ige(JA(e)),i6=e=>$r(IA(t=>rt(vg(),n=>Tme(MA(t(vp(e,n)),r=>bi(n,ys(r))),(r,i)=>bi(n,i))))),o6=e=>sge(rt(TA,t=>on(wr(e(t)),Mn))),bh=G(2,(e,t)=>Kh(Ye(()=>new qu(e,void 0,Lt)),Hhe()).pipe(ti(([n,r])=>ife(t,i=>{const o=n.close(i);return o!==void 0?Ea(o,r):ce})),Ic,rt(([n])=>Tn(()=>eC(n.run(),n))))),eC=(e,t)=>{const n=e;switch(n._tag){case fb:return Wi(t.getDone(),{onFailure:pr,onSuccess:r=>fn(gt(r))});case hb:return fn(St(t.getEmit()));case xp:return Y(n.effect,$e(()=>eC(t.run(),t)));case pb:return GA(n,()=>eC(t.run(),t),r=>pr(r))}},$r=e=>Zme(wr(e)),sge=e=>qH(i6(e),(t,n)=>t,(t,n)=>t),eO=e=>qH(o6(e),(t,n)=>t,(t,n)=>t),ok=e=>s6(0,e.length,e),s6=(e,t,n)=>e===t?Xr:Y(Mn(Y(n,xa(e))),on(()=>s6(e+1,t,n))),age=G(e=>BH(e[1]),(e,t,n)=>n?.concurrent?rge(e,{other:t,onSelfDone:r=>Pj(i=>Tn(()=>L$(r,i))),onOtherDone:r=>Pj(i=>Tn(()=>L$(i,r)))}):on(e,r=>n6(t,i=>[r,i]))),mb=G(e=>BH(e[1]),(e,t,n)=>n?.concurrent?n6(age(e,t,{concurrent:!0}),r=>r[1]):on(e,()=>t)),tC=Symbol.for("effect/Channel/ChannelException"),lge=e=>({_tag:"ChannelException",[tC]:tC,error:e}),cge=e=>ht(e,tC),uge=Symbol.for("effect/Sink"),dge={_A:e=>e,_In:e=>e,_L:e=>e,_E:e=>e,_R:e=>e};class tO{channel;[uge]=dge;constructor(t){this.channel=t}pipe(){return Xe(this,arguments)}}const fge=new tO(JA(t6())),hge=e=>{const t=Is({onInput:n=>Y(wr(ln(n,r=>e(r),{discard:!0})),on(()=>t)),onFailure:Vn,onDone:()=>Xr});return new tO(t)},pge=e=>new tO(wr(e)),a6=e=>Gd(e)?a6(pge(e)):e.channel,mge=Z5,gge=bhe,yge=GT,l6="NotStarted",c6="Previous",u6="Current",bge={_tag:l6},vge=e=>({_tag:c6,fiber:e}),Sge=e=>({_tag:u6,fiber:e}),wge=Symbol.for("effect/Stream/Handoff"),d6="Empty",f6="Full",h6=e=>({_tag:d6,notifyConsumer:e}),xge=(e,t)=>({_tag:f6,value:e,notifyProducer:t}),p6=(e,t)=>n=>{switch(n._tag){case d6:return e(n.notifyConsumer);case f6:return t(n.value,n.notifyProducer)}},kge={_A:e=>e},_ge=()=>Y(mr(),$e(e=>Qn(h6(e))),rt(e=>({[wge]:kge,ref:e}))),ZS=G(2,(e,t)=>$e(mr(),n=>qs(xr(e.ref,r=>Y(r,p6(i=>[Ze(ri(i,void 0),kn(n)),xge(t,n)],(i,o)=>[$e(kn(o),()=>Y(e,ZS(t))),r])))))),nC=e=>$e(mr(),t=>qs(xr(e.ref,n=>Y(n,p6(r=>[$e(kn(r),()=>nC(e)),n],(r,i)=>[vi(ri(i,void 0),r),h6(t)]))))),e0="Emit",t0="Halt",n0="End",Ige=e=>({_tag:e0,elements:e}),Ege=e=>({_tag:t0,cause:e}),Tge=e=>({_tag:n0,reason:e}),Cge="effect/Take",Mge=Symbol.for(Cge),Rge={_A:e=>e,_E:e=>e};class sk{exit;[Mge]=Rge;constructor(t){this.exit=t}pipe(){return Xe(this,arguments)}}const Fj=e=>new sk(Lo(e)),zj=new sk(gg(Oe())),Age=e=>new sk(ys(Y(e,w5(De)))),Oge=e=>new sk(Lo(An(e))),Dge=()=>ga(Oe()),Pge=e=>EA(pr(e),De),Nge="UpstreamEnd",Lge={_tag:Nge},$ge="effect/Stream",m6=Symbol.for($ge),jge={_R:e=>e,_E:e=>e,_A:e=>e};class gr{channel;[m6]=jge;constructor(t){this.channel=t}pipe(){return Xe(this,arguments)}}const g6=e=>ht(e,m6)||Gd(e),nO=4096,Fge=e=>Y(e,zge((t,n)=>bt(n)(t))),zge=G(2,(e,t)=>{const n=r=>Is({onInput:i=>{const[o,a]=SV(i,[r,hn()],([c,u],d)=>Ce(c)&&t(c.value,d)?[De(d),u]:[De(d),Y(u,Mh(d))]);return on(Mn(a),()=>n(o))},onFailure:Vn,onDone:()=>Xr});return new gr(Y(nr(e),wi(n(Oe()))))}),y6=G(2,(e,t)=>new gr(Y(nr(e),mb(nr(t))))),Bge=G(2,(e,t)=>Qd(e,()=>t)),qge=G(2,(e,t)=>R6(n=>re(function*(){const r=yield*_ge();function i(c){return UR(t).pipe(vi(c),ho(n),rt(u=>a(vge(u))))}const o=Is({onInput:c=>rr(Yte(c),{onNone:()=>o,onSome:u=>wr(ZS(r,Ige(An(u)))).pipe(on(()=>o))}),onFailure:c=>wr(ZS(r,Ege(c))),onDone:()=>wr(ZS(r,Tge(Lge)))});function a(c){switch(c._tag){case l6:return $r(nC(r).pipe(rt(u=>{switch(u._tag){case e0:return $r(i(u.elements));case t0:return Vn(u.cause);case n0:return Xr}})));case c6:return $r(nC(r).pipe(ho(n),$e(u=>CA(th(c.fiber),th(u),{onSelfDone:(d,h)=>Wi(d,{onFailure:p=>Mi(h).pipe(vi(Vn(p))),onSuccess:p=>Mi(h).pipe(Ze(fn(Mn(p).pipe(on(()=>a(Sge(u)))))))}),onOtherDone:(d,h)=>Wi(d,{onFailure:p=>Mi(h).pipe(vi(Vn(p))),onSuccess:p=>{switch(p._tag){case e0:return Mi(h).pipe(Ze(i(p.elements)));case t0:return Mi(h).pipe(vi(Vn(p.cause)));case n0:return th(h).pipe(rt(g=>Mn(g).pipe(mb(Xr))))}}})}))));case u6:return $r(th(c.fiber).pipe(rt(u=>{switch(u._tag){case e0:return $r(i(u.elements));case t0:return Vn(u.cause);case n0:return Xr}})))}}return E6(c=>wi(nr(e),o).pipe(YA(c),ho(c))).pipe(Bge(new gr(a(bge))))}))),rC=G(2,(e,t)=>new gr(Y(nr(e),e6(t)))),Uge=G(2,(e,t)=>k6(e,$y(t))),Vge=G(2,(e,t)=>k6(e,bV(t))),Qd=G(e=>g6(e[0]),(e,t,n)=>{const r=n?.bufferSize??16;return n?.switch?iC(n?.concurrency,()=>Bj(e,1,r,t),i=>Bj(e,i,r,t)):iC(n?.concurrency,()=>new gr(lw(nr(e),i=>Y(i,vV(o=>nr(t(o))),SV(Xr,(o,a)=>Y(o,mb(a)))))),i=>new gr(Y(nr(e),lw(ok),r6(o=>nr(t(o)),n))))}),iC=(e,t,n)=>{switch(e){case void 0:return t();case"unbounded":return n(Number.MAX_SAFE_INTEGER);default:return e>1?n(e):t()}},Bj=G(4,(e,t,n,r)=>new gr(Y(nr(e),lw(ok),r6(i=>nr(r(i)),{concurrency:t,mergeStrategy:Gme(),bufferSize:n})))),ak=G(e=>g6(e[0]),(e,t)=>Qd(e,Lt,t)),Kge=e=>{const t=Is({onInput:n=>on(ok(n),()=>t),onFailure:Vn,onDone:()=>Xr});return new gr(Y(nr(e),wi(t)))},Hge=e=>{const t=(r,i)=>{const[o,a]=Y(r,Xte(u=>!xd(u))),c=Y(dx(a),rr({onNone:()=>i,onSome:Wi({onFailure:u=>rr(Cde(u),{onNone:()=>Xr,onSome:Vn}),onSuccess:()=>Xr})}));return Y(Mn(Y(o,bV(u=>xd(u)?De(u.value):Oe()))),on(()=>c))},n=Is({onInput:r=>t(r,n),onFailure:r=>Vn(r),onDone:()=>Xr});return new gr(Y(nr(e),wi(n)))},b6=e=>Kge(Hge(Y(e,x6(t=>t.exit)))),nr=e=>{if("channel"in e)return e.channel;if(Gd(e))return nr(gb(e));throw new TypeError("Expected a Stream.")},v6=e=>new gr(op(e)?Xr:Mn(e)),gb=e=>Y(e,EA(De),Wge),Wge=e=>new gr($r(Bhe(e,{onFailure:rr({onNone:()=>Xr,onSome:tk}),onSuccess:t=>Mn(An(t))}))),S6=(e,t)=>{const n=t?.maxChunkSize??nO;if(t?.scoped){const i=rt(Cj(e),o=>sy(o,{maxChunkSize:n,shutdown:!0}));return t.shutdown?rt(i,rC(Tj(e))):i}const r=Qd(I6(Cj(e)),i=>sy(i,{maxChunkSize:n}));return t?.shutdown?rC(r,Tj(e)):r},w6=e=>T6(()=>tR(e)?v6(e):Gge(e[Symbol.iterator]())),Gge=(e,t=nO)=>Y(Ye(()=>{let n=[];const r=i=>Y(Ye(()=>{let o=i.next();if(t===1)return o.done?Xr:Y(Mn(An(o.value)),on(()=>r(i)));n=[];let a=0;for(;o.done===!1&&(n.push(o.value),a=a+1,!(a>=t));)o=i.next();return a>0?Y(Mn(Xs(n)),on(()=>r(i))):Xr}),$r);return new gr(r(e))}),dye),sy=(e,t)=>Y(fme(e,1,t?.maxChunkSize??nO),At(n=>Y(dme(e),$e(r=>r&&Ed(n)?Dge():Pge(n)))),Jge,t?.shutdown?rC(Hh(e)):Lt),Yge=(...e)=>w6(e),x6=G(2,(e,t)=>new gr(Y(nr(e),ik(vV(t))))),k6=G(2,(e,t)=>new gr(Y(nr(e),ik(t)))),oC=G(2,(e,t)=>{const n=r=>{const i=r.next();if(i.done)return Is({onInput:o=>n(o[Symbol.iterator]()),onFailure:Vn,onDone:HA});{const o=i.value;return $r(rt(t(o),a=>on(Mn(An(a)),()=>n(r))))}};return new gr(Y(nr(e),wi(WA(()=>n(hn()[Symbol.iterator]())))))}),Qge=G(3,(e,t,n)=>new gr(Y(nr(e),lw(ok),ege(n,t),ik(An)))),Xge=G(e=>Symbol.iterator in e[0],(e,t)=>ak(w6(e),t)),Jge=e=>C6(e,t=>Y(rt(t,n=>De([n,t])),ny(rr({onNone:()=>fn(Oe()),onSome:ga})))),Zge=(e,t)=>eye(fn(e),t),eye=(e,t)=>Qd(gb(Kh(e,mge(t))),([n,r])=>{const i=jhe(yge,Xi(r.iterationMeta));return y6(rye(n),uye(n,o=>qhe(r.next(o),{onFailure:fn,onSuccess:()=>rt(i(e),a=>De([a,a]))})))}),_6=G(2,(e,t)=>nr(e).pipe(ZA(a6(t)),oge)),tye=e=>_6(e,fge),nye=G(2,(e,t)=>_6(e,hge(t))),I6=e=>new gr(e6(i6(Y(e,rt(An))),ce)),E6=e=>new gr(o6(t=>e(t).pipe(rt(An)))),rye=e=>v6(An(e)),T6=e=>new gr(WA(()=>nr(e()))),iye=G(2,(e,t)=>oC(e,n=>vi(t(n),n))),oye=G(2,(e,t)=>sye(e,{...t,cost:n=>fn(t.cost(n))})),sye=G(2,(e,t)=>t.strategy==="enforce"?aye(e,t.cost,t.units,t.duration,t.burst??0):lye(e,t.cost,t.units,t.duration,t.burst??0)),aye=(e,t,n,r,i)=>{const o=(c,u)=>Is({onInput:d=>Y(t(d),Kh(Vg),rt(([h,p])=>{const y=(p-u)/pd(r),b=c+y*n,S=n+i<0?Number.POSITIVE_INFINITY:n+i,w=b<0?S:Math.min(b,S);return h<=w?Y(Mn(d),on(()=>o(w-h,p))):o(c,u)}),$r),onFailure:Vn,onDone:()=>Xr}),a=Y(Vg,rt(c=>o(n,c)),$r);return new gr(Y(nr(e),ZA(a)))},lye=(e,t,n,r,i)=>{const o=(c,u)=>Is({onInput:d=>Y(t(d),Kh(Vg),rt(([h,p])=>{const y=(p-u)/pd(r),b=c+y*n,S=n+i<0?Number.POSITIVE_INFINITY:n+i,x=(b<0?S:Math.min(b,S))-h,I=x>=0?0:-x/n,_=Il(Math.max(0,I*pd(r)));return gne(_,hd)?Y(wr(UR(_)),mb(Mn(d)),on(()=>o(x,p))):on(Mn(d),()=>o(x,p))}),$r),onFailure:Vn,onDone:()=>Xr}),a=Y(Vg,rt(c=>o(n,c)),$r);return new gr(Y(nr(e),ZA(a)))},cye=e=>Zge(void 0,gge(e)),C6=(e,t)=>T6(()=>{const n=r=>$r(rt(t(r),rr({onNone:()=>Xr,onSome:([i,o])=>on(Mn(i),()=>n(o))})));return new gr(n(e))}),uye=(e,t)=>C6(e,n=>Y(t(n),rt(Gu(([r,i])=>[An(r),i])))),dye=e=>ak(gb(e)),M6=e=>ak(I6(e)),R6=e=>ak(E6(t=>e(t))),A6=Rse,fye="effect/Config",hye=Symbol.for(fye),pye={_A:e=>e},kp={...jd,[hye]:pye,commit(){return hae(this)}},mye=e=>{const t=Sye("a number property",n=>{const r=Number(n);return Number.isNaN(r)?gt(Q4([],`Expected a number value but received ${Xc(n)}`)):St(r)});return e===void 0?t:bye(t,e)},gye=G(2,(e,t)=>yye(e,n=>St(t(n)))),yye=G(2,(e,t)=>{const n=Object.create(kp);return n._tag=eK,n.original=e,n.mapOrFail=t,n}),bye=G(2,(e,t)=>{const n=Object.create(kp);return n._tag=tK,n.name=t,n.config=e,n}),O6=G(2,(e,t)=>{const n=Object.create(kp);return n._tag=J4,n.first=e,n.second=wye(t.orElse),n.condition=t.if,n}),vye=e=>Y(e,gye(De),O6({orElse:()=>D6(Oe()),if:A6})),Sye=(e,t)=>{const n=Object.create(kp);return n._tag=nK,n.description=e,n.parse=t,n},D6=e=>{const t=Object.create(kp);return t._tag=X4,t.value=e,t.parse=()=>St(e),t},wye=e=>{const t=Object.create(kp);return t._tag=Z4,t.config=e,t},xye=G(2,(e,t)=>O6(e,{orElse:()=>D6(t),if:A6})),Xv=mye,kye=vye,k1=xye,_ye="effect/GroupBy",P6=Symbol.for(_ye),Iye={_R:e=>e,_E:e=>e,_K:e=>e,_V:e=>e},Eye=e=>ht(e,P6),Tye=G(e=>Eye(e[0]),(e,t,n)=>Qd(e.grouped,([r,i])=>t(r,b6(sy(i,{shutdown:!0}))),{concurrency:"unbounded",bufferSize:n?.bufferSize??16})),Cye=e=>({[P6]:Iye,pipe(){return Xe(this,arguments)},grouped:e}),Mye=G(e=>typeof e[0]!="function",(e,t,n)=>n?.key?Tye(Rye(e,n.key,{bufferSize:n.bufferSize}),(r,i)=>oC(i,t)):iC(n?.concurrency,()=>oC(e,t),r=>n?.unordered?Qd(e,i=>gb(t(i)),{concurrency:r}):Qge(e,r,t))),Rye=G(e=>typeof e[0]!="function",(e,t,n)=>{const r=(i,o)=>Is({onInput:a=>on(wr(ln(Aye(a,t),([c,u])=>{const d=i.get(c);return d===void 0?Y(qA(n?.bufferSize??16),$e(h=>Y(Ye(()=>{i.set(c,h)}),Ze(fr(o,Oge([c,h]))),Ze(Y(fr(h,Fj(u)),p1(p=>bg(p)?De(ce):Oe())))))):p1(fr(d,Fj(u)),h=>bg(h)?De(ce):Oe())},{discard:!0})),()=>r(i,o)),onFailure:a=>wr(fr(o,Age(a))),onDone:()=>wr(Y(ln(i.entries(),([a,c])=>Y(fr(c,zj),p1(u=>bg(u)?De(ce):Oe())),{discard:!0}),Ze(fr(o,zj))))});return Cye(R6(i=>re(function*(){const o=new Map,a=yield*yh();return yield*Mc(i,Hh(a)),yield*nr(e).pipe(wi(r(o,a)),JA,YA(i),ho(i),vi(b6(sy(a,{shutdown:!0}))))})))}),Aye=G(2,(e,t)=>{const n=[],r=e[Symbol.iterator](),i=new Map;let o;for(;(o=r.next())&&!o.done;){const a=o.value,c=t(a);if(i.has(c))i.get(c).push(a);else{const u=[a];n.push([c,u]),i.set(c,u)}}return Xs(n.map(a=>[a[0],Xs(a[1])]))});class pi{path;actual;issue;_tag="Pointer";constructor(t,n,r){this.path=t,this.actual=n,this.issue=r}}class qj{actual;message;_tag="Unexpected";constructor(t,n){this.actual=t,this.message=n}}class $m{ast;message;_tag="Missing";actual=void 0;constructor(t,n){this.ast=t,this.message=n}}class vr{ast;actual;issues;output;_tag="Composite";constructor(t,n,r,i){this.ast=t,this.actual=n,this.issues=r,this.output=i}}class _1{ast;actual;kind;issue;_tag="Refinement";constructor(t,n,r,i){this.ast=t,this.actual=n,this.kind=r,this.issue=i}}class I1{ast;actual;kind;issue;_tag="Transformation";constructor(t,n,r,i){this.ast=t,this.actual=n,this.kind=r,this.issue=i}}class fl{ast;actual;message;_tag="Type";constructor(t,n,r){this.ast=t,this.actual=n,this.message=r}}class Uj{ast;actual;message;_tag="Forbidden";constructor(t,n,r){this.ast=t,this.actual=n,this.message=r}}const Vj=Symbol.for("effect/Schema/ParseErrorTypeId");class Oye extends Zfe("ParseError"){[Vj]=Vj;get message(){return this.toString()}toString(){return i0.formatIssueSync(this.issue)}toJSON(){return{_id:"ParseError",message:this.toString()}}[$n](){return this.toJSON()}}const Dye=e=>new Oye({issue:e}),lo=jZ,nd=G(2,(e,t)=>lo(e)?Hi(e,{onLeft:gt,onRight:t}):$e(e,t)),pa=G(2,(e,t)=>lo(e)?zZ(e,t):rt(e,t)),E1=G(2,(e,t)=>lo(e)?FZ(e,t):EA(e,t)),N6=G(2,(e,t)=>lo(e)?Hi(e,{onLeft:t,onRight:St}):ny(e,t)),rO=(e,t)=>t===void 0||ad(t)?e:e===void 0?t:{...e,...t},Pye=(e,t,n)=>{const r=Ao(e);return(i,o)=>r(i,rO(n,o))},L6=(e,t,n)=>{const r=Pye(e,t,n);return(i,o)=>yU(r(i,o),Dye)},Nye=(e,t)=>L6(e.ast,!0,t),$6=(e,t)=>L6(Bi(e.ast),!0,t),iO=(e,t)=>{const n=Ao(Bi(e.ast));return(r,i)=>ba(n(r,{exact:!0,...rO(t,i)}))},Lye=Jt(Symbol.for("effect/ParseResult/decodeMemoMap"),()=>new WeakMap),Ao=(e,t)=>{const n=Lye,r=n.get(e);if(r)return r;const i=$ye(e),o=jee(e),a=Ce(o)?(d,h)=>i(d,rO(h,o.value)):i,c=Fee(e),u=Ce(c)?(d,h)=>r0(N6(a(d,h),c.value),e,d,h):a;return n.set(e,u),u},T1=e=>Ti(Nee(e)),C1=e=>Ti(Lee(e)),$ye=(e,t)=>{switch(e._tag){case"Refinement":{const n=Ao(e.from);return(r,i)=>{i=i??t1;const o=i?.errors==="all",a=nd(N6(n(r,i),c=>{const u=new _1(e,r,"From",c);return o&&Bee(e)&&z6(c)?rr(e.filter(r,i,e),{onNone:()=>gt(u),onSome:d=>gt(new vr(e,r,[u,new _1(e,r,"Predicate",d)]))}):gt(u)}),c=>rr(e.filter(c,i,e),{onNone:()=>St(c),onSome:u=>gt(new _1(e,r,"Predicate",u))}));return r0(a,e,r,i)}}case"Transformation":{const n=zye(e.transformation),r=Ao(e.from),i=Ao(e.to);return(o,a)=>r0(nd(E1(r(o,a),c=>new I1(e,o,"Encoded",c)),c=>nd(E1(n(c,a??t1,e,o),u=>new I1(e,o,"Transformation",u)),u=>E1(i(u,a),d=>new I1(e,o,"Type",d)))),e,o,a)}case"Declaration":{const n=e.decodeUnknown(...e.typeParameters);return(r,i)=>r0(n(r,i??t1,e),e,r,i)}case"Literal":return Mo(e,n=>n===e.literal);case"UniqueSymbol":return Mo(e,n=>n===e.symbol);case"UndefinedKeyword":return Mo(e,ZJ);case"NeverKeyword":return Mo(e,eZ);case"UnknownKeyword":case"AnyKeyword":case"VoidKeyword":return St;case"StringKeyword":return Mo(e,Qs);case"NumberKeyword":return Mo(e,ad);case"BooleanKeyword":return Mo(e,Zw);case"BigIntKeyword":return Mo(e,ex);case"SymbolKeyword":return Mo(e,WE);case"ObjectKeyword":return Mo(e,$l);case"Enums":return Mo(e,n=>e.enums.some(([r,i])=>i===n));case"TemplateLiteral":{const n=vte(e);return Mo(e,r=>Qs(r)&&n.test(r))}case"TupleType":{const n=e.elements.map(d=>Ao(d.type)),r=e.rest.map(d=>Ao(d.type));let i=e.elements.filter(d=>!d.isOptional);e.rest.length>0&&(i=i.concat(e.rest.slice(1)));const o=i.length,a=e.elements.length>0?e.elements.map((d,h)=>h).join(" | "):"never",c=T1(e),u=C1(e);return(d,h)=>{if(!tee(d))return gt(new fl(e,d));const p=h?.errors==="all",g=[];let y=0;const b=[],S=d.length;for(let _=S;_<=o-1;_++){const M=new pi(_,d,new $m(i[_-S]));if(p){g.push([y++,M]);continue}else return gt(new vr(e,d,M,b))}if(e.rest.length===0)for(let _=e.elements.length;_<=S-1;_++){const M=new pi(_,d,new qj(d[_],`is unexpected, expected: ${a}`));if(p){g.push([y++,M]);continue}else return gt(new vr(e,d,M,b))}let w=0,x;for(;w<n.length;w++)if(S<w+1){if(e.elements[w].isOptional)continue}else{const _=n[w],M=_(d[w],h);if(lo(M)){if(mi(M)){const C=new pi(w,d,M.left);if(p){g.push([y++,C]);continue}else return gt(new vr(e,d,C,Rs(b)))}b.push([y++,M.right])}else{const C=y++,E=w;x||(x=[]),x.push(({es:T,output:A})=>$e(Do(M),U=>{if(mi(U)){const R=new pi(E,d,U.left);return p?(T.push([C,R]),ce):gt(new vr(e,d,R,Rs(A)))}return A.push([C,U.right]),ce}))}}if(Ir(r)){const[_,...M]=r;for(;w<S-M.length;w++){const C=_(d[w],h);if(lo(C))if(mi(C)){const E=new pi(w,d,C.left);if(p){g.push([y++,E]);continue}else return gt(new vr(e,d,E,Rs(b)))}else b.push([y++,C.right]);else{const E=y++,T=w;x||(x=[]),x.push(({es:A,output:U})=>$e(Do(C),R=>{if(mi(R)){const N=new pi(T,d,R.left);return p?(A.push([E,N]),ce):gt(new vr(e,d,N,Rs(U)))}else return U.push([E,R.right]),ce}))}}for(let C=0;C<M.length;C++)if(w+=C,!(S<w+1)){const E=M[C](d[w],h);if(lo(E)){if(mi(E)){const T=new pi(w,d,E.left);if(p){g.push([y++,T]);continue}else return gt(new vr(e,d,T,Rs(b)))}b.push([y++,E.right])}else{const T=y++,A=w;x||(x=[]),x.push(({es:U,output:R})=>$e(Do(E),N=>{if(mi(N)){const L=new pi(A,d,N.left);return p?(U.push([T,L]),ce):gt(new vr(e,d,L,Rs(R)))}return R.push([T,N.right]),ce}))}}}const I=({es:_,output:M})=>US(_)?gt(new vr(e,d,Rs(_),Rs(M))):St(Rs(M));if(x&&x.length>0){const _=x;return Tn(()=>{const M={es:Jm(g),output:Jm(b)};return $e(ln(_,C=>C(M),{concurrency:c,batching:u,discard:!0}),()=>I(M))})}return I({output:b,es:g})}}case"TypeLiteral":{if(e.propertySignatures.length===0&&e.indexSignatures.length===0)return Mo(e,tZ);const n=[],r={},i=[];for(const h of e.propertySignatures)n.push([Ao(h.type),h]),r[h.name]=null,i.push(h.name);const o=e.indexSignatures.map(h=>[Ao(h.parameter),Ao(h.type),h.parameter]),a=ma.make(e.indexSignatures.map(h=>h.parameter).concat(i.map(h=>WE(h)?new Kee(h):new A0(h)))),c=Ao(a),u=T1(e),d=C1(e);return(h,p)=>{if(!rZ(h))return gt(new fl(e,h));const g=p?.errors==="all",y=[];let b=0;const S=p?.onExcessProperty==="error",w=p?.onExcessProperty==="preserve",x={};let I;if(S||w){I=Reflect.ownKeys(h);for(const E of I){const T=c(E,p);if(lo(T)&&mi(T))if(S){const A=new pi(E,h,new qj(h[E],`is unexpected, expected: ${String(a)}`));if(g){y.push([b++,A]);continue}else return gt(new vr(e,h,A,x))}else x[E]=h[E]}}let _;const M=p?.exact===!0;for(let E=0;E<n.length;E++){const T=n[E][1],A=T.name,U=Object.prototype.hasOwnProperty.call(h,A);if(!U){if(T.isOptional)continue;if(M){const L=new pi(A,h,new $m(T));if(g){y.push([b++,L]);continue}else return gt(new vr(e,h,L,x))}}const R=n[E][0],N=R(h[A],p);if(lo(N)){if(mi(N)){const L=new pi(A,h,U?N.left:new $m(T));if(g){y.push([b++,L]);continue}else return gt(new vr(e,h,L,x))}x[A]=N.right}else{const L=b++,B=A;_||(_=[]),_.push(({es:j,output:$})=>$e(Do(N),F=>{if(mi(F)){const K=new pi(B,h,U?F.left:new $m(T));return g?(j.push([L,K]),ce):gt(new vr(e,h,K,$))}return $[B]=F.right,ce}))}}for(let E=0;E<o.length;E++){const T=o[E],A=T[0],U=T[1],R=RU(h,T[2]);for(const N of R){const L=A(N,p);if(lo(L)&&ba(L)){const B=U(h[N],p);if(lo(B))if(mi(B)){const j=new pi(N,h,B.left);if(g){y.push([b++,j]);continue}else return gt(new vr(e,h,j,x))}else Object.prototype.hasOwnProperty.call(r,N)||(x[N]=B.right);else{const j=b++,$=N;_||(_=[]),_.push(({es:F,output:K})=>$e(Do(B),W=>{if(mi(W)){const X=new pi($,h,W.left);return g?(F.push([j,X]),ce):gt(new vr(e,h,X,K))}else return Object.prototype.hasOwnProperty.call(r,N)||(K[N]=W.right),ce}))}}}}const C=({es:E,output:T})=>{if(US(E))return gt(new vr(e,h,Rs(E),T));if(p?.propertyOrder==="original"){const A=I||Reflect.ownKeys(h);for(const R of i)A.indexOf(R)===-1&&A.push(R);const U={};for(const R of A)Object.prototype.hasOwnProperty.call(T,R)&&(U[R]=T[R]);return St(U)}return St(T)};if(_&&_.length>0){const E=_;return Tn(()=>{const T={es:Jm(y),output:Object.assign({},x)};return $e(ln(E,A=>A(T),{concurrency:u,batching:d,discard:!0}),()=>C(T))})}return C({es:y,output:x})}}case"Union":{const n=jye(e.types),r=Reflect.ownKeys(n.keys),i=r.length,o=e.types.length,a=new Map;for(let d=0;d<o;d++)a.set(e.types[d],Ao(e.types[d]));const c=T1(e)??1,u=C1(e);return(d,h)=>{const p=[];let g=0,y=[];if(i>0)if(AM(d))for(let w=0;w<i;w++){const x=r[w],I=n.keys[x].buckets;if(Object.prototype.hasOwnProperty.call(d,x)){const _=String(d[x]);if(Object.prototype.hasOwnProperty.call(I,_))y=y.concat(I[_]);else{const{candidates:M,literals:C}=n.keys[x],E=ma.make(C),T=M.length===o?new Qu([new Ii(x,E,!1,!0)],[]):ma.make(M);p.push([g++,new vr(T,d,new pi(x,d,new fl(E,d[x])))])}}else{const{candidates:_,literals:M}=n.keys[x],C=new Ii(x,ma.make(M),!1,!0),E=_.length===o?new Qu([C],[]):ma.make(_);p.push([g++,new vr(E,d,new pi(x,d,new $m(C)))])}}else{const w=n.candidates.length===o?e:ma.make(n.candidates);p.push([g++,new fl(w,d)])}n.otherwise.length>0&&(y=y.concat(n.otherwise));let b;for(let w=0;w<y.length;w++){const x=y[w],I=a.get(x)(d,h);if(lo(I)&&(!b||b.length===0)){if(ba(I))return I;p.push([g++,I.left])}else{const _=g++;b||(b=[]),b.push(M=>Tn(()=>"finalResult"in M?ce:$e(Do(I),C=>(ba(C)?M.finalResult=C:M.es.push([_,C.left]),ce))))}}const S=w=>US(w)?w.length===1&&w[0][1]._tag==="Type"?gt(w[0][1]):gt(new vr(e,d,Rs(w))):gt(new fl(e,d));if(b&&b.length>0){const w=b;return Tn(()=>{const x={es:Jm(p)};return $e(ln(w,I=>I(x),{concurrency:c,batching:u,discard:!0}),()=>"finalResult"in x?x.finalResult:S(x.es))})}return S(p)}}case"Suspend":{const n=AU(()=>Ao(e.f()));return(r,i)=>n()(r,i)}}},Mo=(e,t)=>n=>t(n)?St(n):gt(new fl(e,n)),ng=(e,t)=>{switch(e._tag){case"Declaration":{const n=YU(e);if(Ce(n))return ng(n.value);break}case"TypeLiteral":{const n=[];for(let r=0;r<e.propertySignatures.length;r++){const i=e.propertySignatures[r],o=f$(i.type);c$(o)&&!i.isOptional&&n.push([i.name,o])}return n}case"TupleType":{const n=[];for(let r=0;r<e.elements.length;r++){const i=e.elements[r],o=f$(i.type);c$(o)&&!i.isOptional&&n.push([r,o])}return n}case"Refinement":return ng(e.from);case"Suspend":return ng(e.f());case"Transformation":return ng(e.from)}return[]},jye=(e,t)=>{const n={},r=[],i=[];for(let o=0;o<e.length;o++){const a=e[o],c=ng(a);if(c.length>0){i.push(a);for(let u=0;u<c.length;u++){const[d,h]=c[u],p=String(h.literal);n[d]=n[d]||{buckets:{},literals:[],candidates:[]};const g=n[d].buckets;if(Object.prototype.hasOwnProperty.call(g,p)){if(u<c.length-1)continue;g[p].push(a),n[d].literals.push(h),n[d].candidates.push(a)}else{g[p]=[a],n[d].literals.push(h),n[d].candidates.push(a);break}}}else r.push(a)}return{keys:n,otherwise:r,candidates:i}},r0=(e,t,n,r)=>{if(r?.isEffectAllowed===!0||lo(e))return e;const i=new FK,o=Whe(e,{scheduler:i});i.flush();const a=o.unsafePoll();if(a){if(xd(a))return St(a.value);const c=a.cause;return Ide(c)?gt(c.error):gt(new Uj(t,n,nu(c)))}return gt(new Uj(t,n,"cannot be be resolved synchronously, this is caused by using runSync on an effect that performs async work"))},Fye=([e],[t])=>e>t?1:e<t?-1:0;function Rs(e){return e.sort(Fye).map(t=>t[1])}const zye=(e,t)=>{switch(e._tag){case"FinalTransformation":return e.decode;case"ComposeTransformation":return St;case"TypeLiteralTransformation":return n=>{let r=St(n);for(const i of e.propertySignatureTransformations){const[o,a]=[i.from,i.to],c=i.decode;r=pa(r,d=>{const h=c(Object.prototype.hasOwnProperty.call(d,o)?De(d[o]):Oe());return delete d[o],Ce(h)&&(d[a]=h.value),d})}return r}}},zi=(e,t=[])=>({value:e,forest:t}),i0={formatIssue:e=>pa(Qf(e),Bye),formatIssueSync:e=>{const t=i0.formatIssue(e);return lo(t)?qZ(t):rw(t)},formatError:e=>i0.formatIssue(e.issue),formatErrorSync:e=>i0.formatIssueSync(e.issue)},Bye=e=>e.value+j6(`
33
+ `,e.forest),j6=(e,t)=>{let n="";const r=t.length;let i;for(let o=0;o<r;o++){i=t[o];const a=o===r-1;n+=e+(a?"└":"├")+"─ "+i.value,n+=j6(e+(r>1&&!a?"│ ":" "),i.forest)}return n},qye=e=>{switch(e){case"Encoded":return"Encoded side transformation failure";case"Transformation":return"Transformation process failure";case"Type":return"Type side transformation failure"}},Uye=e=>{switch(e){case"From":return"From side refinement failure";case"Predicate":return"Predicate refinement failure"}},F6=e=>"ast"in e?De(e.ast):Oe(),sC=St(void 0),Vye=e=>F6(e).pipe(ix(Dee),rr({onNone:()=>sC,onSome:t=>{const n=t(e);return Qs(n)?St({message:n,override:!1}):Gd(n)?rt(n,r=>({message:r,override:!1})):Qs(n.message)?St({message:n.message,override:n.override}):rt(n.message,r=>({message:r,override:n.override}))}})),oO=e=>t=>t._tag===e,z6=oO("Composite"),Kj=oO("Refinement"),Hj=oO("Transformation"),Sg=e=>nd(Vye(e),t=>t!==void 0?!t.override&&(z6(e)||Kj(e)&&e.kind==="From"||Hj(e)&&e.kind!=="Transformation")?Hj(e)||Kj(e)?Sg(e.issue):sC:St(t.message):sC),B6=e=>F6(e).pipe(ix($ee),HZ(t=>t(e)),Ti);function Kye(e){return GU(e).pipe(Tc(()=>HU(e)),Tc(()=>WU(e)),Tc(()=>sx(e)),Ln(()=>`{ ${e.from} | filter }`))}function Hye(e){return e.message!==void 0?e.message:`Expected ${ud(e.ast)?Kye(e.ast):String(e.ast)}, actual ${Xc(e.actual)}`}const Wye=e=>pa(Sg(e),t=>t??B6(e)??Hye(e)),Jv=e=>B6(e)??String(e.ast),Gye=e=>e.message??"is forbidden",Yye=e=>e.message??"is unexpected",Qye=e=>{const t=Pee(e.ast);if(Ce(t)){const n=t.value();return Qs(n)?St(n):n}return St(e.message??"is missing")},Qf=e=>{switch(e._tag){case"Type":return pa(Wye(e),zi);case"Forbidden":return St(zi(Jv(e),[zi(Gye(e))]));case"Unexpected":return St(zi(Yye(e)));case"Missing":return pa(Qye(e),zi);case"Transformation":return nd(Sg(e),t=>t!==void 0?St(zi(t)):pa(Qf(e.issue),n=>zi(Jv(e),[zi(qye(e.kind),[n])])));case"Refinement":return nd(Sg(e),t=>t!==void 0?St(zi(t)):pa(Qf(e.issue),n=>zi(Jv(e),[zi(Uye(e.kind),[n])])));case"Pointer":return pa(Qf(e.issue),t=>zi(bee(e.path),[t]));case"Composite":return nd(Sg(e),t=>{if(t!==void 0)return St(zi(t));const n=Jv(e);return OU(e.issues)?pa(ln(e.issues,Qf),r=>zi(n,r)):pa(Qf(e.issues),r=>zi(n,[r]))})}},Xye=Qhe,Jye=u5,Zye=Ece;function Ff(e,t){return ke(e.runtimeEffect,n=>Bt(r=>(r.setFiberRefs(n.fiberRefs),r.currentRuntimeFlags=n.runtimeFlags,pp(t,n.context))))}const ebe={...Oae,[qT]:qT,pipe(){return Xe(this,arguments)},commit(){return this.runtimeEffect}},tbe=(e,t)=>{t=t??q5();const n=HT(yp());let r;const i=Bt(a=>(r||(r=KT(Hy(vp(Wfe(e,t),n),c=>{o.cachedRuntime=c}),{scope:n,scheduler:a.currentScheduler})),Kd(r.await))),o=Object.assign(Object.create(ebe),{memoMap:t,scope:n,runtimeEffect:i,cachedRuntime:void 0,runtime(){return o.cachedRuntime===void 0?f1(o.runtimeEffect):Promise.resolve(o.cachedRuntime)},dispose(){return f1(o.disposeEffect)},disposeEffect:mt(()=>(o.runtimeEffect=Sa("ManagedRuntime disposed"),o.cachedRuntime=void 0,bi(o.scope,gs))),runFork(a,c){return o.cachedRuntime===void 0?KT(Ff(o,a),c):ab(o.cachedRuntime)(a,c)},runSyncExit(a){return o.cachedRuntime===void 0?Cfe(Ff(o,a)):bA(o.cachedRuntime)(a)},runSync(a){return o.cachedRuntime===void 0?HT(Ff(o,a)):N5(o.cachedRuntime)(a)},runPromiseExit(a,c){return o.cachedRuntime===void 0?Tfe(Ff(o,a),c):vA(o.cachedRuntime)(a,c)},runCallback(a,c){return o.cachedRuntime===void 0?VT(Bc)(Ff(o,a),c):VT(o.cachedRuntime)(a,c)},runPromise(a,c){return o.cachedRuntime===void 0?f1(Ff(o,a),c):j5(o.cachedRuntime)(a,c)}});return o},nbe=tbe,rbe=G(e=>$l(e[0]),(e,...t)=>{const n={};for(const r of t)r in e&&(n[r]=e[r]);return n}),ibe=G(e=>$l(e[0]),(e,...t)=>{const n={...e};for(const r of t)delete n[r];return n}),ay=Symbol.for("effect/Schema");function yo(e){return class{[ay]=Wj;static ast=e;static annotations(n){return yo(iu(this.ast,n))}static pipe(){return Xe(this,arguments)}static toString(){return String(e)}static Type;static Encoded;static Context;static[ay]=Wj}}const Wj={_A:e=>e,_I:e=>e,_R:e=>e},Gj={typeConstructor:Tee,schemaId:Mee,message:DU,missingMessage:UM,identifier:VM,title:La,description:Py,examples:PU,default:NU,documentation:Ree,jsonSchema:LU,arbitrary:$U,pretty:jU,equivalence:FU,concurrency:zU,batching:BU,parseIssueTitle:qU,parseOptions:UU,decodingFallback:VU},lk=e=>{if(!e)return{};const t={...e};for(const n in Gj)if(n in e){const r=Gj[n];t[r]=e[n],delete t[n]}return t},iu=(e,t)=>JM(e,lk(t)),ly=e=>ht(e,ay)&&$l(e[ay]);function obe(e){return YM(e)?ma.make(fte(e,t=>new A0(t))):new A0(e[0])}function q6(e,t=obe(e)){return class extends yo(t){static annotations(r){return q6(this.literals,iu(this.ast,r))}static literals=[...e]}}function Si(...e){return Ir(e)?q6(e):U6}class sbe extends yo(XE){}class Ds extends yo(Gee){}class abe extends yo(Vee){}class U6 extends yo(KM){}class lbe extends yo(JU){}class Ht extends yo(ete){}class hr extends yo(rte){}class Bo extends yo(ote){}const cbe=e=>ma.make(e.map(t=>t.ast));function V6(e,t=cbe(e)){return class extends yo(t){static annotations(r){return V6(this.members,iu(this.ast,r))}static members=[...e]}}function _p(...e){return YM(e)?V6(e):Ir(e)?e[0]:U6}const Oo=e=>_p(e,abe),ube=e=>_p(e,sbe),dbe=(e,t)=>new HM(e.map(n=>ly(n)?new ip(n.ast,!1):n.ast),t.map(n=>ly(n)?new ax(n.ast):n.ast),!0);function K6(e,t,n=dbe(e,t)){return class extends yo(n){static annotations(i){return K6(this.elements,this.rest,iu(this.ast,i))}static elements=[...e];static rest=[...t]}}function H6(e,t){return class extends K6([],[e],t){static annotations(r){return H6(this.value,iu(this.ast,r))}static value=e}}const o0=e=>H6(e),aC=e=>e?'"?:"':'":"';class W6 extends ip{isReadonly;defaultValue;_tag="PropertySignatureDeclaration";constructor(t,n,r,i,o){super(t,n,i),this.isReadonly=r,this.defaultValue=o}toString(){const t=aC(this.isOptional),n=String(this.type);return`PropertySignature<${t}, ${n}, never, ${t}, ${n}>`}}class fbe extends ip{isReadonly;defaultValue;constructor(t,n,r,i,o){super(t,n,i),this.isReadonly=r,this.defaultValue=o}}const hbe=e=>e===void 0?"never":Qs(e)?JSON.stringify(e):String(e);class pbe{from;to;decode;encode;_tag="PropertySignatureTransformation";constructor(t,n,r,i){this.from=t,this.to=n,this.decode=r,this.encode=i}toString(){return`PropertySignature<${aC(this.to.isOptional)}, ${this.to.type}, ${hbe(this.from.fromKey)}, ${aC(this.from.isOptional)}, ${this.from.type}>`}}const G6=(e,t)=>{switch(e._tag){case"PropertySignatureDeclaration":return new W6(e.type,e.isOptional,e.isReadonly,{...e.annotations,...t},e.defaultValue);case"PropertySignatureTransformation":return new pbe(e.from,new fbe(e.to.type,e.to.isOptional,e.to.isReadonly,{...e.to.annotations,...t},e.to.defaultValue),e.decode,e.encode)}},Y6=Symbol.for("effect/PropertySignature"),Q6=e=>ht(e,Y6);class sO{ast;[ay];[Y6]=null;_TypeToken;_Key;_EncodedToken;_HasDefault;constructor(t){this.ast=t}pipe(){return Xe(this,arguments)}annotations(t){return new sO(G6(this.ast,lk(t)))}toString(){return String(this.ast)}}class aO extends sO{from;constructor(t,n){super(t),this.from=n}annotations(t){return new aO(G6(this.ast,lk(t)),this.from)}}const wg=e=>{const t=e.ast===XE||e.ast===KM?XE:ube(e).ast;return new aO(new W6(t,!0,!0,{},void 0),e)},mbe=sV([UM]),gbe=(e,t)=>{const n=Reflect.ownKeys(e),r=[];if(n.length>0){const o=[],a=[],c=[];for(let u=0;u<n.length;u++){const d=n[u],h=e[d];if(Q6(h)){const p=h.ast;switch(p._tag){case"PropertySignatureDeclaration":{const g=p.type,y=p.isOptional,b=p.annotations;o.push(new Ii(d,g,y,!0,mbe(p))),a.push(new Ii(d,Bi(g),y,!0,b)),r.push(new Ii(d,g,y,!0,b));break}case"PropertySignatureTransformation":{const g=p.from.fromKey??d;o.push(new Ii(g,p.from.type,p.from.isOptional,!0,p.from.annotations)),a.push(new Ii(d,p.to.type,p.to.isOptional,!0,p.to.annotations)),c.push(new pte(g,d,p.decode,p.encode));break}}}else o.push(new Ii(d,h.ast,!1,!0)),a.push(new Ii(d,Bi(h.ast),!1,!0)),r.push(new Ii(d,h.ast,!1,!0))}if(Ir(c)){const u=[],d=[];for(const h of t){const{indexSignatures:p,propertySignatures:g}=d$(h.key.ast,h.value.ast);g.forEach(y=>{o.push(y),a.push(new Ii(y.name,Bi(y.type),y.isOptional,y.isReadonly,y.annotations))}),p.forEach(y=>{u.push(y),d.push(new lx(y.parameter,Bi(y.type),y.isReadonly))})}return new hte(new Qu(o,u,{[QE]:"Struct (Encoded side)"}),new Qu(a,d,{[QE]:"Struct (Type side)"}),new mte(c))}}const i=[];for(const o of t){const{indexSignatures:a,propertySignatures:c}=d$(o.key.ast,o.value.ast);c.forEach(u=>r.push(u)),a.forEach(u=>i.push(u))}return new Qu(r,i)},ybe=(e,t)=>{const n=Reflect.ownKeys(e);for(const r of n){const i=e[r];if(t[r]===void 0&&Q6(i)){const o=i.ast,a=o._tag==="PropertySignatureDeclaration"?o.defaultValue:o.to.defaultValue;a!==void 0&&(t[r]=a())}}return t};function lO(e,t,n=gbe(e,t)){return class extends yo(n){static annotations(i){return lO(this.fields,this.records,iu(this.ast,i))}static fields={...e};static records=[...t];static make=(i,o)=>{const a=ybe(e,{...i});return tW(o)?a:$6(this)(a)};static pick(...i){return xi(rbe(e,...i))}static omit(...i){return xi(ibe(e,...i))}}}function xi(e,...t){return lO(e,t)}function X6(e,t,n){return class extends lO({},[{key:e,value:t}],n){static annotations(i){return X6(e,t,iu(this.ast,i))}static key=e;static value=t}}const Xf=e=>X6(e.key,e.value),bbe=Symbol.for("effect/SchemaId/Refine");function J6(e,t,n){return class extends yo(n){static annotations(i){return J6(this.from,this.filter,iu(this.ast,i))}static[bbe]=e;static from=e;static filter=t;static make=(i,o)=>tW(o)?i:$6(this)(i)}}const Yj=(e,t,n)=>{if(Zw(e))return e?Oe():De(new fl(t,n));if(Qs(e))return De(new fl(t,n,e));if(e!==void 0){if("_tag"in e)return De(e);const r=new fl(t,n,e.message);return De(Ir(e.path)?new pi(e.path,n,r):r)}return Oe()},vbe=(e,t,n)=>{if(yee(e))return Yj(e,t,n);if(Ir(e)){const r=CU(e,i=>Yj(i,t,n));if(Ir(r))return De(r.length===1?r[0]:new vr(t,n,r))}return Oe()};function Z6(e,t){return n=>{function r(o,a,c){return vbe(e(o,a,c),c,o)}const i=new rV(n.ast,r,lk(t));return J6(n,r,i)}}const Sbe=_ee,wbe=(e,t)=>n=>n.pipe(Z6(r=>r>e,{schemaId:Sbe,title:`greaterThan(${e})`,description:"a positive number",jsonSchema:{exclusiveMinimum:e},...t})),xbe=Iee,kbe=e=>t=>t.pipe(Z6(n=>Number.isSafeInteger(n),{schemaId:xbe,title:"int",description:"an integer",jsonSchema:{type:"integer"},...e})),eW=e=>wbe(0,{title:"positive",...e});class _be extends hr.pipe(kbe({identifier:"Int"})){}function tW(e){return Zw(e)?e:e?.disableValidation??!1}const Qj=Fge,Ibe=qge,zs=Uge,Ebe=Vge,Tbe=Qd,Cbe=gb,rg=S6,Mbe=sy,Hs=x6,cy=Mye,Rbe=Xge,vh=tye,Ml=nye,Abe=iye,Obe=oye,Dbe=cye,M1=M6,Xj=Symbol.for("effect/Subscribable"),Pbe=R5,Nbe="effect/SubscriptionRef",Lbe=Symbol.for(Nbe),$be={_A:e=>e};class jbe extends gp{ref;pubsub;semaphore;[Bh]=Bh;[Xj]=Xj;[Lae]=WR;[Pbe]=A5;[Lbe]=$be;constructor(t,n,r){super(),this.ref=t,this.pubsub=n,this.semaphore=r,this.get=Xi(this.ref)}commit(){return this.get}get;get changes(){return Y(Xi(this.ref),$e(t=>rt(S6(this.pubsub,{scoped:!0}),n=>y6(Yge(t),n))),this.semaphore.withPermits(1),M6)}modify(t){return this.modifyEffect(n=>fn(t(n)))}modifyEffect(t){return Y(Xi(this.ref),$e(t),$e(([n,r])=>Y(_d(this.ref,r),vi(n),OA(Sl(this.pubsub,r)))),this.semaphore.withPermits(1))}}const Fbe=e=>Xi(e.ref),zbe=e=>Y(ru([sw(),Qn(e),Xx(1)]),rt(([t,n,r])=>new jbe(n,t,r))),Bbe=G(2,(e,t)=>Y(_d(e.ref,t),OA(Sl(e.pubsub,t)),e.semaphore.withPermits(1))),xg=Fbe,qbe=zbe,Ube=Bbe,ck=e=>{const t=new WeakSet,n=(r,i)=>{if(i>64)return!1;if(r===null)return!0;switch(typeof r){case"string":case"boolean":return!0;case"number":return Number.isFinite(r);case"object":{if(Array.isArray(r)){if(t.has(r))return!1;t.add(r);for(const o of r)if(!n(o,i+1))return!1;return!0}if(!nW(r)||t.has(r))return!1;t.add(r);for(const o of Object.values(r))if(!n(o,i+1))return!1;return!0}default:return!1}};return n(e,0)},Vbe={maxDepth:6,maxObjectKeys:32,maxArrayLength:32,maxStringLength:256,maxJsonBytes:4*1024,oversizedPreviewBytes:256},Cu=(e,t,n)=>e.length<=t?e:(n.oversized+=1,e.slice(0,t)),Zv=(e,t)=>e?e==="non_serializable"||t==="non_serializable"?"non_serializable":e==="oversized"||t==="oversized"?"oversized":"unknown":t;function nW(e){if(typeof e!="object"||e===null)return!1;const t=Object.getPrototypeOf(e);return t===Object.prototype||t===null}const Kbe=(e,t)=>Number.isFinite(e)?e:(t.nonSerializable+=1,String(e)),lC=(e,t,n,r,i)=>{if(e===null)return null;switch(typeof e){case"string":return Cu(e,t.maxStringLength,n);case"number":return Kbe(e,n);case"boolean":return e;case"bigint":return n.nonSerializable+=1,Cu(e.toString(),t.maxStringLength,n);case"symbol":return n.nonSerializable+=1,Cu(e.toString(),t.maxStringLength,n);case"function":return n.nonSerializable+=1,"[Function]";case"undefined":return n.dropped+=1,null}if(i>=t.maxDepth)return n.oversized+=1,"[Truncated]";if(e instanceof Date)return e.toISOString();if(e instanceof Error)return n.nonSerializable+=1,{name:Cu(e.name,t.maxStringLength,n),message:Cu(e.message,t.maxStringLength,n)};if(typeof e=="object"){if(r.has(e))return n.nonSerializable+=1,"[Circular]";r.add(e)}if(Array.isArray(e)){const u=[],d=Math.min(e.length,t.maxArrayLength);for(let h=0;h<d;h++)u.push(lC(e[h],t,n,r,i+1));return e.length>d&&(n.oversized+=1,u.push(`[...${e.length-d} more]`)),u}if(!nW(e))return n.nonSerializable+=1,Cu(String(e),t.maxStringLength,n);const o=Object.keys(e).sort(),a=Math.min(o.length,t.maxObjectKeys),c={};for(let u=0;u<a;u++){const d=o[u],h=e[d],p=Cu(d,t.maxStringLength,n);if(h===void 0){n.dropped+=1;continue}c[p]=lC(h,t,n,r,i+1)}return o.length>a&&(n.oversized+=1,c.__truncatedKeys=o.length-a),c},ar=(e,t)=>{const n={...Vbe},r={dropped:0,oversized:0,nonSerializable:0},i=new WeakSet;let o;const a=lC(e,n,r,i,0);r.nonSerializable>0&&(o=Zv(o,"non_serializable")),r.oversized>0&&(o=Zv(o,"oversized"));try{const c=JSON.stringify(a);if(c.length>n.maxJsonBytes){o=Zv(o,"oversized");const u=c.slice(0,Math.min(n.oversizedPreviewBytes,n.maxJsonBytes));return{value:{_tag:"oversized",bytes:c.length,preview:u},stats:{dropped:r.dropped,oversized:r.oversized+1,nonSerializable:r.nonSerializable},downgrade:o}}}catch{return o=Zv(o,"non_serializable"),{value:"[Unserializable]",stats:{dropped:r.dropped,oversized:r.oversized,nonSerializable:r.nonSerializable+1},downgrade:o}}return{value:a,stats:{dropped:r.dropped,oversized:r.oversized,nonSerializable:r.nonSerializable},downgrade:o}},Hbe=(e,t)=>e.length<=t?{value:e,truncated:!1}:{value:e.slice(0,t),truncated:!0},Wbe=e=>{try{return{ok:!0,json:JSON.stringify(e)}}catch{return{ok:!1}}},Gbe=e=>{if(typeof e=="string")return e;if(typeof e=="number"||typeof e=="boolean"||typeof e=="bigint")return String(e);if(e instanceof Error)return e.message||e.name||"Error";if(e&&typeof e=="object"&&"message"in e&&typeof e.message=="string")return e.message;try{const t=nu(e,{renderErrorCause:!0});if(typeof t=="string"&&t.length>0)return t}catch{}return"Unknown error"},Fo=(e,t)=>{const r=Gbe(e),{value:i,truncated:o}=Hbe(r,256),a={message:i};if(e instanceof Error){e.name&&e.name!=="Error"&&(a.name=e.name);const u=e;return typeof u.code=="string"&&u.code.length>0?a.code=u.code:typeof u.code=="number"&&Number.isFinite(u.code)&&(a.code=String(u.code)),typeof u.hint=="string"&&u.hint.length>0&&(a.hint=u.hint),{errorSummary:a,downgrade:o?"oversized":void 0}}if(e&&typeof e=="object"){const u=e;typeof u.name=="string"&&u.name.length>0&&(a.name=u.name),typeof u.code=="string"&&u.code.length>0&&(a.code=u.code),typeof u.hint=="string"&&u.hint.length>0&&(a.hint=u.hint)}return Wbe(e).ok?o?{errorSummary:a,downgrade:"oversized"}:i==="Unknown error"?{errorSummary:a,downgrade:"unknown"}:{errorSummary:a}:{errorSummary:a,downgrade:"non_serializable"}},Cd=mo(void 0);class Uc extends Yt("Logix/EffectOpMiddleware")(){}const Ybe=e=>t=>e.reduceRight((n,r)=>r({...t,effect:n}),t.effect),Qbe=(e,t)=>re(function*(){const n=yield*et(Cd),r=e.meta?.linkId,i=typeof r=="string"&&r.length>0?r:n??e.id,o={...e,meta:{...e.meta??{},linkId:i}},a=t.length?Ybe(t)(o):o.effect;return yield*Cn(Cd,i)(a)}),po=mo([]),Vc=mo(void 0),rW=mo(void 0),cC=mo(void 0),Jr=mo("off"),iW=mo({sampleEveryN:32,topK:3}),Xbe=e=>db(iW,()=>e);let Jj=0;const Jbe=()=>(Jj+=1,Jj),Zbe=(e,t)=>`${e}::e${t}`,Zn=(e,t)=>e?t?e==="non_serializable"||t==="non_serializable"?"non_serializable":e==="oversized"||t==="oversized"?"oversized":"unknown":e:t,Zj=new Set,eF=new Set,tF=new Map,kg=new Map,eve=(e,t)=>{const n=kg.get(e);if(!n){kg.set(e,[t]);return}n.push(t),n.length>64&&n.shift()},tve=(e,t)=>{const n=kg.get(e);if(!n||n.length===0){kg.delete(e);return}for(const r of n){const i=r;i.txnId==null&&(i.txnId=t.txnId),(typeof i.txnSeq!="number"||i.txnSeq<=0)&&(i.txnSeq=t.txnSeq)}kg.delete(e)},Wh=e=>{const t=e.moduleId??"unknown",n=(()=>{try{return nu(e.cause,{renderErrorCause:!0})}catch{try{return JSON.stringify(e.cause,null,2)}catch{return String(e.cause)}}})(),r=`[Logix][module=${t}] lifecycle:error
34
+ ${n}`;return Rc(r).pipe(AA({"logix.moduleId":t,"logix.event":"lifecycle:error","logix.cause":n}))},Gh=e=>{const t=e.moduleId??"unknown",n=`[Logix][module=${t}] diagnostic(${e.severity})`,r=`code=${e.code} message=${e.message}${e.actionTag?` action=${e.actionTag}`:""}${e.hint?`
35
+ hint: ${e.hint}`:""}`,i=`${n}
36
+ ${r}`,o=e.severity==="warning"?Vhe(i):e.severity==="info"?Uhe(i):Rc(i),a={"logix.moduleId":t,"logix.event":`diagnostic(${e.severity})`,"logix.diagnostic.code":e.code,"logix.diagnostic.message":e.message};return e.hint&&(a["logix.diagnostic.hint"]=e.hint),e.actionTag&&(a["logix.diagnostic.actionTag"]=e.actionTag),o.pipe(AA(a))},nve=ub(po,[]),oW={record:e=>e.type==="lifecycle:error"?Wh(e):e.type==="diagnostic"&&e.severity!=="info"?Gh(e):ce},rve=ub(po,[oW]),cO=e=>e.length===1&&e[0]===oW,ive={record:e=>e.type==="lifecycle:error"?Wh(e):e.type==="diagnostic"?Gh(e):lH({debugEvent:e})};ub(po,[ive]);const uO=typeof window<"u"&&typeof document<"u",dO=e=>{if(typeof e.type=="string"&&e.type.startsWith("trace:")){const t=e.moduleId??"unknown",n=e.type;return Ye(()=>{console.groupCollapsed("%c[Logix]%c trace %c"+t+"%c "+String(n),"color:#6b7280;font-weight:bold","color:#3b82f6","color:#9ca3af","color:#6b7280"),console.log(e),console.groupEnd()})}if(e.type==="lifecycle:error"){const t=e.moduleId??"unknown",n=(()=>{try{return nu(e.cause,{renderErrorCause:!0})}catch{try{return JSON.stringify(e.cause,null,2)}catch{return String(e.cause)}}})(),r=`${t}|${n}`;return Zj.has(r)?ce:(Zj.add(r),Ye(()=>{console.groupCollapsed("%c[Logix]%c lifecycle:error %c"+t,"color:#ef4444;font-weight:bold","color:#ef4444","color:#9ca3af"),console.error(n),console.groupEnd()}))}if(e.type==="diagnostic"){const t=e.moduleId??"unknown",n=`code=${e.code} message=${e.message}${e.actionTag?` action=${e.actionTag}`:""}${e.hint?`
37
+ hint: ${e.hint}`:""}`,r=e.severity==="warning"?"color:#d97706":e.severity==="info"?"color:#3b82f6":"color:#ef4444",i=e.severity==="warning"?"diagnostic(warning)":e.severity==="info"?"diagnostic(info)":"diagnostic(error)",o=`${t}|${e.code}|${e.message}`;return eF.has(o)?ce:(eF.add(o),Ye(()=>{console.groupCollapsed("%c[Logix]%c "+i+"%c module="+t,"color:#6b7280;font-weight:bold",r,"color:#9ca3af"),e.severity==="warning"?console.warn(n):e.severity==="info"?console.info(n):console.error(n),console.groupEnd()}))}return ce},ove={record:e=>uO?dO(e):e.type==="lifecycle:error"?Wh(e):e.type==="diagnostic"?Gh(e):lH({debugEvent:e})},sve=ub(po,[ove]),ave={record:e=>uO?e.type==="lifecycle:error"||e.type==="diagnostic"&&e.severity!=="info"?dO(e):ce:e.type==="lifecycle:error"?Wh(e):e.type==="diagnostic"&&e.severity!=="info"?Gh(e):ce},lve=ub(po,[ave]);Xye(Jye,Zye({mode:"browser",colors:!0}));const Ue=e=>re(function*(){const t=yield*et(po);if(cO(t)){if(e.type==="lifecycle:error"){yield*Wh(e);return}if(e.type==="diagnostic"){e.severity!=="info"?yield*Gh(e):yield*ce;return}yield*ce;return}if(t.length===0){if(uO){if(e.type==="lifecycle:error"||e.type==="diagnostic"){yield*dO(e);return}yield*ce;return}if(e.type==="lifecycle:error"){yield*Wh(e);return}if(e.type==="diagnostic"){yield*Gh(e);return}yield*ce;return}const n=e,r=yield*et(Jr);let i;const o=()=>(i===void 0&&(i=Date.now()),i);if(n.timestamp===void 0&&(r!=="off"||n.type==="lifecycle:error"||n.type==="diagnostic")&&(n.timestamp=o()),r!=="off"&&n.runtimeLabel===void 0){const a=yield*et(Vc);a&&(n.runtimeLabel=a)}if(n.type==="diagnostic"&&n.txnId===void 0){const a=yield*et(rW);a&&(n.txnId=a)}if(r!=="off"&&n.type==="trace:effectop"&&n.linkId===void 0){const a=yield*et(Cd);a&&(n.linkId=a)}if(t.length===1){yield*t[0].record(n);return}yield*ln(t,a=>a.record(n),{discard:!0})}),cve=(e,t)=>{const n=t?.diagnosticsLevel??"full";if(n==="off")return;const r=n==="light"||n==="sampled",i=typeof e.timestamp=="number"&&Number.isFinite(e.timestamp)?e.timestamp:Date.now(),o=e.moduleId,a=typeof o=="string"&&o.length>0?o:"unknown",c=e.instanceId,u=typeof c=="string"&&c.length>0?c:"unknown",d=e.runtimeLabel,h=typeof d=="string"&&d.length>0?d:void 0,p=e.txnSeq,g=typeof p=="number"&&Number.isFinite(p)&&p>=0?Math.floor(p):0,y=e.txnId,b=typeof y=="string"&&y.length>0?y:g>0?`${u}::t${g}`:void 0,S=(()=>{const E=e.linkId;if(typeof E=="string"&&E.length>0)return E;if(typeof e.type!="string"||!e.type.startsWith("trace:"))return;const U=e.data?.meta?.linkId;if(typeof U=="string"&&U.length>0)return U})(),w=t?.eventSeq,x=typeof w=="number"&&Number.isFinite(w)&&w>0?Math.floor(w):Jbe(),_={eventId:Zbe(u,x),eventSeq:x,moduleId:a,instanceId:u,runtimeLabel:h,txnSeq:g,txnId:b,linkId:S,timestamp:i};let M;const C=E=>M?{...E,downgrade:{reason:M}}:E;switch(e.type){case"module:init":return C({..._,kind:"lifecycle",label:"module:init"});case"module:destroy":return C({..._,kind:"lifecycle",label:"module:destroy"});case"lifecycle:phase":{const E=e,T=r?{type:"lifecycle:phase",phase:E.phase,name:E.name}:{type:"lifecycle:phase",phase:E.phase,name:E.name,payload:E.payload},A=ar(T);return t?.onMetaProjection?.({stats:A.stats,downgrade:A.downgrade}),M=Zn(M,A.downgrade),C({..._,kind:"lifecycle",label:E.name,meta:A.value})}case"action:dispatch":{const E=e.action,T=e.actionTag,A=typeof T=="string"&&T.length>0?T:E?._tag??E?.type,U=String(A??"action:dispatch"),R=U.length>0?U:"unknown",N=e.unknownAction===!0?!0:void 0,L=r?{actionTag:R,...N?{unknownAction:!0}:{}}:{action:E,...N?{unknownAction:!0}:{}},B=ar(L);return t?.onMetaProjection?.({stats:B.stats,downgrade:B.downgrade}),M=Zn(M,B.downgrade),N&&(M=Zn(M,"unknown")),C({..._,kind:"action",label:R,meta:B.value})}case"state:update":{const E=e,T=()=>{const N=t?.resolveConvergeStaticIr;if(!N)return;const L=E.staticIrDigest;if(typeof L!="string"||L.length===0)return;const B=E.dirtySet;if(!B||typeof B!="object"||Array.isArray(B))return;const j=B.rootIds;if(!Array.isArray(j)||j.length===0)return;const F=N(L)?.fieldPaths;if(!Array.isArray(F)||F.length===0)return;const K=[];for(const W of j){if(typeof W!="number"||!Number.isFinite(W))continue;const X=Math.floor(W);if(X<0)continue;const V=F[X];!Array.isArray(V)||V.length===0||V.every(z=>typeof z=="string"&&z.length>0)&&K.push(V)}return K.length>0?K:void 0},A=(()=>{const N=T();if(!N)return E.dirtySet;const L=E.dirtySet;return!L||typeof L!="object"||Array.isArray(L)?E.dirtySet:{...L,rootPaths:N}})(),U=r?{state:E.state,dirtySet:A,patchCount:E.patchCount,patchesTruncated:E.patchesTruncated,patchesTruncatedReason:E.patchesTruncatedReason,staticIrDigest:E.staticIrDigest,commitMode:E.commitMode,priority:E.priority,originKind:E.originKind,originName:E.originName}:{state:E.state,dirtySet:A,patchCount:E.patchCount,patchesTruncated:E.patchesTruncated,patchesTruncatedReason:E.patchesTruncatedReason,staticIrDigest:E.staticIrDigest,commitMode:E.commitMode,priority:E.priority,originKind:E.originKind,originName:E.originName,traitSummary:E.traitSummary,replayEvent:E.replayEvent},R=ar(U);return t?.onMetaProjection?.({stats:R.stats,downgrade:R.downgrade}),M=Zn(M,R.downgrade),b&&(tF.set(u,{txnId:b,txnSeq:g}),tve(u,{txnId:b,txnSeq:g})),C({..._,kind:"state",label:"state:update",meta:R.value})}case"process:start":case"process:stop":case"process:restart":case"process:trigger":case"process:dispatch":case"process:error":{const E=e,T=typeof E.timestampMs=="number"&&Number.isFinite(E.timestampMs)?E.timestampMs:i,A={identity:E.identity,severity:E.severity,eventSeq:E.eventSeq,timestampMs:E.timestampMs,trigger:E.trigger,dispatch:E.dispatch,error:E.error},U=ar(A);t?.onMetaProjection?.({stats:U.stats,downgrade:U.downgrade}),M=Zn(M,U.downgrade);const R=E.type==="process:error"||E.type==="process:restart"?E.error:void 0;return C({..._,timestamp:T,kind:"process",label:E.type,meta:U.value,errorSummary:R})}case"lifecycle:error":{const E=e,T=Fo(E.cause);M=Zn(M,T.downgrade);const A=r?{type:"lifecycle:error",phase:E.phase,name:E.hook}:{type:"lifecycle:error",phase:E.phase,name:E.hook,hook:E.hook,taskId:E.taskId,origin:E.origin,txnSeq:E.txnSeq,opSeq:E.opSeq},U=ar(A);return t?.onMetaProjection?.({stats:U.stats,downgrade:U.downgrade}),M=Zn(M,U.downgrade),C({..._,kind:"lifecycle",label:"lifecycle:error",meta:U.value,errorSummary:T.errorSummary})}case"diagnostic":{const E=e,T={code:E.code,severity:E.severity,message:E.message,hint:E.hint,actionTag:E.actionTag,kind:E.kind,trigger:E.trigger},A=ar(T);return t?.onMetaProjection?.({stats:A.stats,downgrade:A.downgrade}),M=Zn(M,A.downgrade),C({..._,kind:"diagnostic",label:E.code,meta:A.value})}case"warn:priority-inversion":{const E=e,T=r?{tickSeq:E.tickSeq,reason:E.reason,selectorId:E.selectorId}:{tickSeq:E.tickSeq,reason:E.reason,selectorId:E.selectorId},A=ar(T);return t?.onMetaProjection?.({stats:A.stats,downgrade:A.downgrade}),M=Zn(M,A.downgrade),C({..._,kind:"diagnostic",label:E.type,meta:A.value})}case"warn:microtask-starvation":{const E=e,T=r?{tickSeq:E.tickSeq,microtaskChainDepth:E.microtaskChainDepth}:{tickSeq:E.tickSeq,microtaskChainDepth:E.microtaskChainDepth},A=ar(T);return t?.onMetaProjection?.({stats:A.stats,downgrade:A.downgrade}),M=Zn(M,A.downgrade),C({..._,kind:"diagnostic",label:E.type,meta:A.value})}default:{if(typeof e.type!="string"||!e.type.startsWith("trace:"))return;if(e.type==="trace:tick"){const T=e.data,A=r?{tickSeq:T?.tickSeq,phase:T?.phase,schedule:T?.schedule,triggerSummary:T?.triggerSummary,anchors:T?.anchors,budget:T?.budget,backlog:T?.backlog,result:T?.result}:{data:T},U=ar(A);return t?.onMetaProjection?.({stats:U.stats,downgrade:U.downgrade}),M=Zn(M,U.downgrade),C({..._,kind:"devtools",label:e.type,meta:U.value})}if(e.type==="trace:txn-lane"){const T=e.data,A=T?.evidence??T,U=ar(A);t?.onMetaProjection?.({stats:U.stats,downgrade:U.downgrade}),M=Zn(M,U.downgrade);const R=typeof A?.kind=="string"&&A.kind.length>0?String(A.kind):"txn-lane";return C({..._,kind:"txn-lane",label:R,meta:U.value})}if(e.type==="trace:react-render"||e.type==="trace:react-selector"){const T=e.data,A=ar(r?{componentLabel:T?.componentLabel,selectorKey:T?.selectorKey,fieldPaths:T?.fieldPaths,selectorId:T?.selectorId,lane:T?.lane,producer:T?.producer,fallbackReason:T?.fallbackReason,readsDigest:T?.readsDigest,equalsKind:T?.equalsKind,strictModePhase:T?.strictModePhase}:{componentLabel:T?.componentLabel,selectorKey:T?.selectorKey,fieldPaths:T?.fieldPaths,selectorId:T?.selectorId,lane:T?.lane,producer:T?.producer,fallbackReason:T?.fallbackReason,readsDigest:T?.readsDigest,equalsKind:T?.equalsKind,strictModePhase:T?.strictModePhase,meta:T?.meta});t?.onMetaProjection?.({stats:A.stats,downgrade:A.downgrade}),M=Zn(M,A.downgrade);const U=typeof T?.componentLabel=="string"&&T.componentLabel.length>0?T.componentLabel:e.type==="trace:react-selector"?"react-selector":"react-render",R=tF.get(u),N=typeof T?.meta?.txnSeq=="number"&&Number.isFinite(T.meta.txnSeq)&&T.meta.txnSeq>=0?Math.floor(T.meta.txnSeq):void 0,B=(typeof T?.meta?.txnId=="string"&&T.meta.txnId.length>0?T.meta.txnId:void 0)??_.txnId??R?.txnId,j=N??(_.txnSeq>0?_.txnSeq:R?.txnSeq??_.txnSeq),$=C({..._,txnId:B,txnSeq:j,kind:e.type==="trace:react-selector"?"react-selector":"react-render",label:U,meta:A.value});return u!=="unknown"&&($.txnId==null||$.txnSeq<=0)&&eve(u,$),$}if(e.type==="trace:selector:eval"){const T=e.data,A={selectorId:T?.selectorId,lane:T?.lane,producer:T?.producer,fallbackReason:T?.fallbackReason,readsDigest:T?.readsDigest,equalsKind:T?.equalsKind,changed:T?.changed,evalMs:T?.evalMs},U=ar(A);return t?.onMetaProjection?.({stats:U.stats,downgrade:U.downgrade}),M=Zn(M,U.downgrade),C({..._,kind:"devtools",label:e.type,meta:U.value})}if(e.type==="trace:exec-vm"){const T=e.data,A={version:T?.version,stage:T?.stage,hit:T?.hit,reasonCode:T?.reasonCode??T?.reason,reasonDetail:T?.reasonDetail,execIrVersion:T?.execIrVersion,execIrHash:T?.execIrHash,serviceId:T?.serviceId,implId:T?.implId},U=ar(A);return t?.onMetaProjection?.({stats:U.stats,downgrade:U.downgrade}),M=Zn(M,U.downgrade),C({..._,kind:"devtools",label:e.type,meta:U.value})}if(e.type==="trace:trait:converge"){const T=j=>{const $=t?.resolveConvergeStaticIr;if(!$)return;const F=j.staticIrDigest;if(typeof F!="string"||F.length===0)return;const K=j.rootIds;if(!Array.isArray(K)||K.length===0)return;const X=$(F)?.fieldPaths;if(!Array.isArray(X)||X.length===0)return;const V=[];for(const z of K){if(typeof z!="number"||!Number.isFinite(z))continue;const Q=Math.floor(z);if(Q<0||Q>=X.length)continue;const q=X[Q];Array.isArray(q)&&V.push(q)}return V.length>0?V:void 0},A=j=>{if(!j||typeof j!="object"||Array.isArray(j))return j;const $=j,F=$.dirty;if(!F||typeof F!="object"||Array.isArray(F))return j;const K=T({staticIrDigest:$.staticIrDigest,rootIds:F?.rootIds});return K?{...$,dirty:{...F,rootPaths:K}}:j},U=j=>{if(!j||typeof j!="object"||Array.isArray(j))return j;const $=j,F=$.dirty,K=T({staticIrDigest:$.staticIrDigest,rootIds:F?.rootIds}),W=F&&typeof F=="object"&&!Array.isArray(F)?{dirtyAll:F.dirtyAll,...typeof F.reason=="string"?{reason:F.reason}:null,...Array.isArray(F.rootIds)?{rootIds:F.rootIds}:null,...typeof F.rootIdsTruncated=="boolean"?{rootIdsTruncated:F.rootIdsTruncated}:null,...K?{rootPaths:K}:null}:void 0,{top3:X,dirtyRoots:V,...z}=$;return W?{...z,dirty:W}:z},R=j=>{if(!j||typeof j!="object"||Array.isArray(j))return j;const $=j,F=$.dirty,K=F&&typeof F=="object"&&!Array.isArray(F)?{dirtyAll:F.dirtyAll,...typeof F.reason=="string"?{reason:F.reason}:null}:void 0,{dirtyRoots:W,...X}=$;return K?{...X,dirty:K}:X},N=e.data,L=n==="light"?U(N):n==="sampled"?R(N):A(N),B=ar(L);return t?.onMetaProjection?.({stats:B.stats,downgrade:B.downgrade}),M=Zn(M,B.downgrade),C({..._,kind:"trait:converge",label:"trait:converge",meta:B.value})}if(e.type==="trace:trait:check"){const T=N=>{if(!N||typeof N!="object"||Array.isArray(N))return N;const L=N,B=L.degraded,j=B&&typeof B=="object"&&!Array.isArray(B)?{kind:B.kind}:void 0,{degraded:$,...F}=L;return j?{...F,degraded:j}:F},A=e.data,U=r?T(A):A,R=ar(U);return t?.onMetaProjection?.({stats:R.stats,downgrade:R.downgrade}),M=Zn(M,R.downgrade),C({..._,kind:"trait:check",label:"trait:check",meta:R.value})}if(e.type==="trace:trait:validate"){const T=e.data,A=ar(T);return t?.onMetaProjection?.({stats:A.stats,downgrade:A.downgrade}),M=Zn(M,A.downgrade),C({..._,kind:"trait:validate",label:"trait:validate",meta:A.value})}if(e.type==="trace:module:traits"){const T=e.data,A=r?{digest:T?.digest,count:T?.count}:{digest:T?.digest,count:T?.count,traits:T?.traits,provenanceIndex:T?.provenanceIndex},U=ar(A);return t?.onMetaProjection?.({stats:U.stats,downgrade:U.downgrade}),M=Zn(M,U.downgrade),C({..._,kind:"devtools",label:e.type,meta:U.value})}if(e.type==="trace:module:traits:conflict"){const T=e.data,A=r?{conflictCount:T?.conflictCount,traitIds:T?.traitIds}:{conflictCount:T?.conflictCount,conflicts:T?.conflicts},U=ar(A);return t?.onMetaProjection?.({stats:U.stats,downgrade:U.downgrade}),M=Zn(M,U.downgrade),C({..._,kind:"devtools",label:e.type,meta:U.value})}if(e.type==="trace:module:descriptor"){const T=e.data,A=r?{id:T?.id,traits:T?.traits,source:T?.source}:{data:T},U=ar(A);return t?.onMetaProjection?.({stats:U.stats,downgrade:U.downgrade}),M=Zn(M,U.downgrade),C({..._,kind:"devtools",label:e.type,meta:U.value})}if(e.type==="trace:effectop"){const T=e.data,A=T?.meta,U=T?.kind??"service",R=typeof T?.name=="string"?T.name:"effectop",N=typeof A?.moduleId=="string"?A.moduleId:a,L=typeof A?.txnId=="string"&&A.txnId.length>0?A.txnId:_.txnId,B=typeof A?.txnSeq=="number"&&Number.isFinite(A.txnSeq)&&A.txnSeq>=0?Math.floor(A.txnSeq):_.txnSeq,j=r?{id:T?.id,kind:T?.kind,name:T?.name,meta:A}:{id:T?.id,kind:T?.kind,name:T?.name,payload:T?.payload,meta:A},$=ar(j);return t?.onMetaProjection?.({stats:$.stats,downgrade:$.downgrade}),M=Zn(M,$.downgrade),C({..._,moduleId:N,txnId:L,txnSeq:B,kind:U,label:R,meta:$.value})}const E=ar(r?{data:void 0}:{data:e.data});return t?.onMetaProjection?.({stats:E.stats,downgrade:E.downgrade}),M=Zn(M,E.downgrade),C({..._,kind:"devtools",label:e.type,meta:E.value})}}},uve=()=>{},dve=()=>{const e=globalThis.performance;if(e&&typeof e.now=="function")try{const t=e.now();if(typeof t=="number"&&Number.isFinite(t))return t}catch{}return Date.now()},fve=e=>{const t=globalThis.queueMicrotask;if(typeof t=="function")try{t(e);return}catch{}try{Promise.resolve().then(e)}catch{setTimeout(e,0)}},cw=(e,t)=>{const n=setTimeout(t,e);return()=>{try{clearTimeout(n)}catch{}}},hve=()=>{const e=globalThis.MessageChannel;if(typeof e!="function")return;let t;try{t=new e}catch{return}const n=[];let r=!1;const i=()=>{r=!1;const a=n.splice(0,n.length);for(const c of a)if(!c.canceled)try{c.cb()}catch{}};try{t.port1.onmessage=i}catch{return}return a=>{const c={canceled:!1,cb:a};if(n.push(c),!r){r=!0;try{t.port2.postMessage(void 0)}catch{return r=!1,cw(0,a)}}return()=>{c.canceled=!0}}},pve=()=>{const e=globalThis.setImmediate,t=globalThis.clearImmediate;if(typeof e=="function")return n=>{let r;try{r=e(n)}catch{return cw(0,n)}return()=>{if(typeof t=="function")try{t(r)}catch{}}}},mve=()=>{const e=globalThis.requestAnimationFrame,t=globalThis.cancelAnimationFrame;if(typeof e=="function")return n=>{let r;try{r=e(n)}catch{return uve}return()=>{if(typeof t=="function")try{t(r)}catch{}}}},gve=()=>{const e=pve()??hve()??(n=>cw(0,n)),t=mve();return{nowMs:dve,scheduleMicrotask:fve,scheduleMacrotask:e,scheduleAnimationFrame:n=>t?.(n)??e(n),scheduleTimeout:cw}};let nF;const uk=()=>(nF??=gve(),nF),eS=new Map,R1=new Map,A1=new Map,rF=new Map,sW=new Map,O1=new Set,iF={dropped:0,oversized:0};let uC=500;const oF=new Set;let D1=!1;const yve=()=>{oF.size!==0&&(D1||(D1=!0,uk().scheduleMicrotask(()=>{D1=!1;for(const e of oF)e()})))};let aW=!1;const dC=()=>{yve()},bve=e=>{if(aW=!0,typeof e?.bufferSize=="number"&&Number.isFinite(e.bufferSize)){const t=Math.floor(e.bufferSize),n=t>=0?t:0;n!==uC&&(uC=n,dC())}},lW=()=>aW,vve=e=>{sW.set(e.staticIrDigest,e)},Sve={register:vve},wve={record:e=>re(function*(){const t=yield*et(Jr);let n=!1;if(e.type==="trace:instanceLabel"){const o=e.instanceId,a=e.data,c=a&&typeof a=="object"&&"label"in a?String(a.label):void 0;o&&c&&(rF.set(o,c),n=!0)}if(e.type==="module:init"||e.type==="module:destroy"){const o=e.moduleId??"unknown",a=e.runtimeLabel??"unknown",c=e.instanceId,u=`${a}::${o}`,d=eS.get(u)??0;if(e.type==="module:init"){if(eS.set(u,d+1),n=!0,c){const h=`${a}::${o}::${c}`;O1.add(h),R1.delete(h)&&(n=!0),A1.delete(h)&&(n=!0)}}else{const h=d-1;if(h<=0?eS.delete(u)&&(n=!0):(eS.set(u,h),n=!0),c){const p=`${a}::${o}::${c}`;O1.delete(p),R1.delete(p)&&(n=!0),A1.delete(p)&&(n=!0),rF.delete(c)&&(n=!0),n=!0}}}let r=!1;const i=cve(e,{diagnosticsLevel:t,resolveConvergeStaticIr:o=>sW.get(o),onMetaProjection:({stats:o})=>{(o.dropped!==0||o.oversized!==0)&&(r=!0),iF.dropped+=o.dropped,iF.oversized+=o.oversized}});if(r&&(n=!0),!i){n&&dC();return}if(i.kind==="state"&&i.label==="state:update"){const a=`${i.runtimeLabel??"unknown"}::${i.moduleId}::${i.instanceId}`;if(O1.has(a)&&i.meta&&typeof i.meta=="object"&&!Array.isArray(i.meta)){const c=i.meta;"state"in c&&(R1.set(a,c.state),n=!0),"traitSummary"in c&&c.traitSummary!==void 0&&(A1.set(a,c.traitSummary),n=!0)}}uC>0&&(n=!0),n&&dC()})},cW=mo([]),xve=e=>db(cW,t=>[...t,...e]),kve=(e,t)=>`${e}::${t}`,_ve=(e,t)=>`${e}::rq:${t}`,Ive=e=>{const t=e.indexOf("::");if(t<=0)return;const n=e.slice(0,t),r=e.slice(t+2);if(r.length===0)return;const i=r.indexOf("::");if(i<0)return{kind:"module",moduleInstanceKey:`${n}::${r}`};const o=r.slice(0,i),a=r.slice(i+2);if(a.startsWith("rq:")){const c=a.slice(3);return c.length===0?void 0:{kind:"readQuery",moduleInstanceKey:`${n}::${o}`,selectorId:c}}return{kind:"module",moduleInstanceKey:`${n}::${o}`}},Eve=()=>{let e=0;const t=new Map,n=new Map,r=new Map,i=new Map,o=new Map,a=x=>n.get(x)??0,c=x=>r.get(x)??"normal",u=(x,I)=>{const _=n.get(x)??0;n.set(x,_+1),r.set(x,I)};return{getTickSeq:()=>e,getModuleState:x=>t.get(x),getTopicVersion:a,getTopicPriority:c,subscribeTopic:(x,I)=>{const _=Ive(x),M=i.get(x),C=M??new Set,E=C.has(I);if(E||C.add(I),M||i.set(x,C),!E&&_){const T=o.get(_.moduleInstanceKey)??0;o.set(_.moduleInstanceKey,T+1)}return()=>{const T=i.get(x);if(!T)return;if(T.delete(I)&&_){const R=(o.get(_.moduleInstanceKey)??0)-1;R<=0?o.delete(_.moduleInstanceKey):o.set(_.moduleInstanceKey,R)}T.size===0&&i.delete(x)}},getTopicSubscriberCount:x=>i.get(x)?.size??0,getModuleSubscriberCount:x=>o.get(x)??0,registerModuleInstance:x=>{t.set(x.moduleInstanceKey,x.initialState),n.has(x.moduleInstanceKey)||(n.set(x.moduleInstanceKey,0),r.set(x.moduleInstanceKey,"normal"))},unregisterModuleInstance:x=>{t.delete(x)},commitTick:x=>{e=x.tickSeq;for(const[_,M]of x.accepted.modules)t.set(_,M.state);const I=new Map;for(const[_,M]of x.accepted.dirtyTopics){u(_,M);const C=Array.from(i.get(_)??[]);C.length>0&&I.set(_,{priority:M,listeners:C})}return{changedTopics:I}},dispose:()=>{t.clear(),n.clear(),r.clear(),i.clear(),o.clear()}}},sF=(e,t)=>e==="normal"||t==="normal"?"normal":"low",Tve=()=>{let e=new Map,t=new Map;const n=()=>e.size>0||t.size>0,r=c=>{const u=e.get(c.moduleInstanceKey);return u?(e.set(c.moduleInstanceKey,{...c,meta:{...c.meta,priority:sF(u.meta.priority,c.meta.priority)}}),!0):(e.set(c.moduleInstanceKey,c),!1)},i=(c,u)=>{const d=t.get(c);return t.set(c,d?sF(d,u):u),d!=null};return{hasPending:n,enqueueModuleCommit:r,markTopicDirty:i,drain:()=>{if(!n())return;const c={modules:e,dirtyTopics:t};return e=new Map,t=new Map,c},requeue:c=>{for(const[,u]of c.modules)r(u);for(const[u,d]of c.dirtyTopics)i(u,d)}}},ii=mo(!1),uw=mo(!1),aF=(e,t)=>typeof e=="function"?e(t):e,Cve=e=>({pending:{kind:"task:pending",name:e},success:{kind:"service-callback",name:"task:success"},failure:{kind:"service-callback",name:"task:failure"}}),fO=e=>re(function*(){return(yield*et(ii))?(dn()&&(yield*Ue({type:"diagnostic",moduleId:e.moduleId,instanceId:e.instanceId,code:e.code,severity:e.severity,message:e.message,hint:e.hint,actionTag:e.actionTag,kind:e.kind})),!0):!1}),lF=e=>e.resolveConcurrencyPolicy?e.resolveConcurrencyPolicy().pipe(rt(t=>t.concurrencyLimit)):fn(16),tS=(e,t,n,r)=>re(function*(){if(yield*fO({moduleId:t.moduleId,instanceId:t.instanceId,code:"logic::invalid_usage",severity:"error",message:"run*Task is not allowed inside a synchronous StateTransaction body (it may deadlock the txnQueue).",hint:"Call run*Task from the run section of a watcher (e.g. $.onAction/$.onState/$.on); do not call it directly inside a reducer / trait.run / synchronous transaction body. For long-lived flows, use a multi-entry pattern (pending → IO → writeback).",kind:"run_task_in_transaction"}))return;const o=Cve(n.triggerName),a={pending:n.origin?.pending??o.pending,success:n.origin?.success??o.success,failure:n.origin?.failure??o.failure},c=n.pending;c&&(yield*Ic(t.runWithStateTransaction(a.pending,()=>Gt(aF(c,e)))));const u=aF(n.effect,e),d=yield*en(u);if(r&&!(yield*r))return;if(d._tag==="Success"){const g=n.success;g&&(yield*t.runWithStateTransaction(a.success,()=>Gt(g(d.value,e))));return}const h=d.cause;if(Ed(h))return;const p=n.failure;p&&(yield*t.runWithStateTransaction(a.failure,()=>Gt(p(h,e))))}).pipe(At(i=>Ue({type:"diagnostic",moduleId:t.moduleId,instanceId:t.instanceId,code:"task_runner::unhandled_failure",severity:"error",message:"TaskRunner encountered an unhandled failure (pending/IO/writeback).",hint:"Add a failure writeback for this task or handle errors explicitly upstream; avoid fire-and-forget swallowing errors.",actionTag:n.triggerName,kind:"task_runner_unhandled_failure",trigger:{kind:"task",name:n.triggerName}}).pipe(Ze(Rc("TaskRunner error",i))))),nS=(e,t,n,r)=>t==="latest"?re(function*(){const i=yield*Qn(0),o=yield*Qn(void 0);return yield*Ml(e,c=>re(function*(){const u=yield*$ae(i,g=>g+1),d=yield*Xi(o);d&&(yield*Zg(d));const h=Xi(i).pipe(rt(g=>g===u)),p=yield*nH(tS(c,n,r,h));yield*_d(o,p)}))}):t==="exhaust"?re(function*(){const i=yield*lF(n),o=yield*Qn(!1),a=c=>re(function*(){if(yield*xr(o,d=>d?[!1,d]:[!0,!0]))try{yield*tS(c,n,r)}finally{yield*_d(o,!1)}});return yield*vh(e.pipe(cy(a,{concurrency:i})))}):t==="parallel"?re(function*(){const i=yield*lF(n);return yield*vh(e.pipe(cy(o=>tS(o,n,r),{concurrency:i})))}):Ml(e,i=>tS(i,n,r)),Mve=()=>ce,rS=e=>e==="action"?"dispatch":e==="trait-external-store"?"externalStore":e?.includes("timer")?"timer":"unknown",Rve=e=>e==="low"?"nonUrgent":"urgent",cF=(e,t)=>e==="normal"||t==="normal"?"normal":"low",Ave=(e,t)=>{const n=new Map(e.modules);for(const[i,o]of t.modules){const a=n.get(i);a?n.set(i,{...o,meta:{...o.meta,priority:cF(a.meta.priority,o.meta.priority)}}):n.set(i,o)}const r=new Map(e.dirtyTopics);for(const[i,o]of t.dirtyTopics){const a=r.get(i);r.set(i,a?cF(a,o):o)}return{modules:n,dirtyTopics:r}},Ove=()=>({modules:new Map,dirtyTopics:new Map}),Dve=e=>{const t=e.runtimeStore,n=e.hostScheduler,r=e.declarativeLinkRuntime,i=e.queue??Tve(),o={maxSteps:64,urgentStepCap:512,maxDrainRounds:8,microtaskChainDepthLimit:32};let a=0,c=!1,u=0,d,h=0,p=0;const g=ey(M=>{n.scheduleMicrotask(()=>M(ce))}),y=ey((M,C)=>{const E=n.scheduleMacrotask(()=>M(ce));try{C.addEventListener("abort",()=>{E()},{once:!0})}catch{}}),b=()=>re(function*(){if(c)return;c=!0;const M=d;d=void 0;const C=M==null&&u>=Math.max(1,o.microtaskChainDepthLimit),E=M??(C?"microtask_starvation":void 0),T=E?"macrotask":"microtask",A=T,U=u;yield*rH(Cn(ii,!1)(re(function*(){try{yield*Mve(),T==="microtask"?(yield*g,u+=1):(yield*y,u=0);const R={startedAs:A,microtaskChainDepth:T==="macrotask"?U:u,...T==="macrotask"?{forcedMacrotask:!0,reason:E??"unknown"}:{}},N=yield*S(R);N.stable||(d=N.degradeReason==="budget_steps"?"budget":N.degradeReason==="cycle_detected"?"cycle_detected":"unknown")}finally{c=!1,i.hasPending()?yield*b():u=0}})))}),S=M=>re(function*(){if(!i.hasPending())return{stable:!0};a+=1;const C=a,E=yield*et(Jr),T=lW()&&E!=="off",A={drainRounds:0,stable:!0,accepted:Ove()};for(;A.drainRounds<o.maxDrainRounds;){const te=i.drain();if(!te)break;if(A.drainRounds+=1,A.accepted=Ave(A.accepted,te),r&&te.modules.size>0){const pe=Array.from(te.modules.keys());yield*r.applyForSources({tickSeq:C,acceptedModules:A.accepted.modules,changedModuleInstanceKeys:pe})}}i.hasPending()&&(A.stable=!1,A.degradeReason="cycle_detected");const U=[],R=[];for(const te of A.accepted.modules.values())Rve(te.meta.priority)==="urgent"?U.push(te):R.push(te);const N=U.length>o.urgentStepCap,L=N?U.slice(0,o.urgentStepCap):U,B=N?U.slice(o.urgentStepCap):[],j=Math.max(0,o.maxSteps),$=N?[]:R.slice(0,j),F=N?R:R.slice(j);N?(A.stable=!1,A.degradeReason="cycle_detected"):F.length>0&&(A.stable=!1,A.degradeReason=A.degradeReason??"budget_steps");const K=new Map,W=new Map;for(const te of L)K.set(te.moduleInstanceKey,te);for(const te of $)K.set(te.moduleInstanceKey,te);for(const te of B)W.set(te.moduleInstanceKey,te);for(const te of F)W.set(te.moduleInstanceKey,te);const X=new Map,V=new Map;for(const[te,pe]of A.accepted.dirtyTopics){const oe=x(te);oe&&(K.has(oe)?X.set(te,pe):W.has(oe)?V.set(te,pe):X.set(te,pe))}const z={modules:K,dirtyTopics:X},Q=W.size>0||V.size>0?{modules:W,dirtyTopics:V}:void 0;A.deferred=Q;let q,ie,le,ee,J;T&&(q=Date.now(),ie=(()=>{const te=Array.from(A.accepted.modules.values()),pe=new Map;let oe;for(const ye of te){const xe=rS(ye.meta.originKind);pe.set(xe,(pe.get(xe)??0)+1),oe||(oe={kind:xe,moduleId:ye.moduleId,instanceId:ye.instanceId,fieldPath:xe==="externalStore"?ye.meta.originName:void 0,actionTag:xe==="dispatch"?ye.meta.originName:void 0})}return{total:te.length,kinds:Array.from(pe.entries()).map(([ye,xe])=>({kind:ye,count:xe})),primary:oe,coalescedCount:{modules:h,topics:p}}})(),le=(()=>{const te=A.accepted.modules.values().next().value;if(te)return{moduleId:te.moduleId,instanceId:te.instanceId,txnSeq:te.meta.txnSeq,txnId:te.meta.txnId,...typeof te.opSeq=="number"?{opSeq:te.opSeq}:null}})(),ee=(()=>{const te=A.deferred;if(!te)return;const pe=te.modules.size+te.dirtyTopics.size,oe=Array.from(te.modules.values()),ye=oe.filter(it=>rS(it.meta.originKind)==="externalStore").length,xe=oe.find(it=>rS(it.meta.originKind)==="externalStore")??oe[0],je=xe?rS(xe.meta.originKind):"unknown",Ge=xe!=null?{kind:je==="externalStore"?"externalStore":"unknown",moduleId:xe.moduleId,instanceId:xe.instanceId,fieldPath:je==="externalStore"?xe.meta.originName:void 0,storeId:void 0}:void 0;return{pendingExternalInputs:ye,pendingDeferredWork:pe,deferredPrimary:Ge}})(),J={stable:A.stable,...A.stable?null:{degradeReason:A.degradeReason??"unknown"}}),T&&M.forcedMacrotask&&M.reason==="microtask_starvation"&&(yield*Ue({type:"warn:microtask-starvation",moduleId:le?.moduleId,instanceId:le?.instanceId,tickSeq:C,microtaskChainDepth:M.microtaskChainDepth})),T&&(yield*Ue({type:"trace:tick",moduleId:le?.moduleId,instanceId:le?.instanceId,data:{tickSeq:C,phase:"start",timestampMs:q,schedule:M,triggerSummary:ie,anchors:le,budget:{maxSteps:o.maxSteps,elapsedMs:0,steps:0,txnCount:K.size}}})),!A.stable&&T&&(yield*Ue({type:"trace:tick",moduleId:le?.moduleId,instanceId:le?.instanceId,data:{tickSeq:C,phase:"budgetExceeded",timestampMs:Date.now(),schedule:M,triggerSummary:ie,anchors:le,budget:{maxSteps:o.maxSteps,elapsedMs:Math.max(0,Date.now()-q),steps:o.maxSteps,txnCount:K.size},backlog:ee,result:J}})),Q&&i.requeue(Q);const ge=t.commitTick({tickSeq:C,accepted:z});for(const{listeners:te}of ge.changedTopics.values())for(const pe of te)try{pe()}catch{}if(!A.stable&&T&&ee?.deferredPrimary){const te=ee.deferredPrimary;if(te.kind==="externalStore"){const pe=te.moduleId&&te.instanceId?`${te.moduleId}::${te.instanceId}`:void 0;pe&&t.getModuleSubscriberCount(pe)>0&&(yield*Ue({type:"warn:priority-inversion",moduleId:te.moduleId,instanceId:te.instanceId,tickSeq:C,reason:"deferredBacklog"}))}}return T&&(yield*Ue({type:"trace:tick",moduleId:le?.moduleId,instanceId:le?.instanceId,data:{tickSeq:C,phase:"settled",timestampMs:Date.now(),schedule:M,triggerSummary:ie,anchors:le,budget:{maxSteps:o.maxSteps,elapsedMs:Math.max(0,Date.now()-q),steps:K.size,txnCount:K.size},backlog:ee,result:J}})),h=0,p=0,{stable:A.stable,degradeReason:A.degradeReason}}),w=S({startedAs:"unknown"}).pipe(Gt),x=M=>{const C=M.indexOf("::rq:");if(C>0)return M.slice(0,C);if(M.includes("::"))return M};return{getTickSeq:()=>a,onModuleCommit:M=>re(function*(){i.enqueueModuleCommit(M)&&(h+=1),i.markTopicDirty(M.moduleInstanceKey,M.meta.priority)&&(p+=1),yield*b()}),onSelectorChanged:({moduleInstanceKey:M,selectorId:C,priority:E})=>{i.markTopicDirty(_ve(M,C),E)&&(p+=1)},flushNow:w}},Pve=()=>{const e=new Map,t=new Map,n=new Map,r=new Map;return{registerModuleAsSourceLink:c=>{const u={...c,hasValue:!1,lastValue:void 0};e.set(c.id,u);const d=t.get(c.sourceModuleInstanceKey)??new Set;return d.add(c.id),t.set(c.sourceModuleInstanceKey,d),()=>{e.delete(c.id);const h=t.get(c.sourceModuleInstanceKey);h&&(h.delete(c.id),h.size===0&&t.delete(c.sourceModuleInstanceKey))}},registerDeclarativeLink:c=>{const u=new Map;for(const y of c.readNodes)u.set(y.nodeId,y);const d=new Map;for(const y of c.dispatchNodes)d.set(y.nodeId,y);const h=new Map;for(const y of c.ir.edges){const b=y.to;if(!d.has(b))continue;if(h.set(b,(h.get(b)??0)+1),(h.get(b)??0)>1)throw new Error(`[DeclarativeLinkRuntime] Invalid DeclarativeLinkIR: dispatch node has multiple incoming edges (linkId=${c.linkId}, nodeId=${b}).`)}const p=new Map;for(const y of c.ir.edges){const b=y.from,S=y.to;if(!u.has(b)||!d.has(S))continue;const w=p.get(b)??[];w.push(S),p.set(b,w)}const g={...c,readNodeById:u,dispatchNodeById:d,dispatchTargetsByReadNode:p,readNodeState:new Map};n.set(c.linkId,g);for(const y of c.readNodes){const b=r.get(y.moduleInstanceKey)??[];b.push({linkId:c.linkId,nodeId:y.nodeId}),r.set(y.moduleInstanceKey,b)}return()=>{n.delete(c.linkId);for(const y of c.readNodes){const b=r.get(y.moduleInstanceKey);if(!b)continue;const S=b.filter(w=>!(w.linkId===c.linkId&&w.nodeId===y.nodeId));S.length===0?r.delete(y.moduleInstanceKey):r.set(y.moduleInstanceKey,S)}}},applyForSources:c=>re(function*(){let u=!1;for(const d of c.changedModuleInstanceKeys){const h=t.get(d);if(!h||h.size===0)continue;const p=c.acceptedModules.get(d);if(p)for(const g of h){const y=e.get(g);if(!y)continue;let b;try{b=y.readQuery.select(p.state)}catch{continue}const S=y.computeValue(b);y.hasValue&&y.equalsValue(y.lastValue,S)||(y.hasValue=!0,y.lastValue=S,u=!0,yield*y.applyValue(S))}}for(const d of c.changedModuleInstanceKeys){const h=r.get(d);if(!h||h.length===0)continue;const p=c.acceptedModules.get(d);if(p)for(const g of h){const y=n.get(g.linkId);if(!y)continue;const b=y.readNodeById.get(g.nodeId);if(!b)continue;let S;try{S=b.readQuery.select(p.state)}catch{continue}const w=y.readNodeState.get(g.nodeId)??{hasValue:!1,lastValue:void 0};if(!(!w.hasValue||!Object.is(w.lastValue,S)))continue;w.hasValue=!0,w.lastValue=S,y.readNodeState.set(g.nodeId,w);const I=y.dispatchTargetsByReadNode.get(g.nodeId)??[];for(const _ of I){const M=y.dispatchNodeById.get(_);M&&(u=!0,yield*M.dispatch(S))}}}return{scheduled:u}})}};var Nve={};const uW=()=>{try{const e=Nve;return typeof e?.NODE_ENV=="string"?e.NODE_ENV:void 0}catch{return}},dn=()=>uW()!=="production",Lve=()=>dn()?"full":"light";class $ve extends Yt("@logixjs/core/StateTransactionRuntimeConfig")(){}const dk=$ve;class jve extends Yt("@logixjs/core/ReadQueryStrictGateRuntimeConfig")(){}const dW=jve;class Fve extends Yt("@logixjs/core/ReplayModeConfig")(){}const uF=Fve;class zve extends Yt("@logixjs/core/StateTransactionOverrides")(){}const Oc=zve;class Bve extends Yt("@logixjs/core/ConcurrencyPolicy")(){}const fW=Bve;class qve extends Yt("@logixjs/core/ConcurrencyPolicyOverrides")(){}const Uve=qve;class Ip extends Yt("@logixjs/core/RuntimeStore")(){}const hW=iy(Ip,Ahe(Ye(()=>Eve()),e=>Ye(()=>e.dispose())));class Ep extends Yt("@logixjs/core/HostScheduler")(){}const pW=zo(Ep,uk());class hO extends Yt("@logixjs/core/DeclarativeLinkRuntime")(){}const mW=zo(hO,Pve());class Us extends Yt("@logixjs/core/TickScheduler")(){}const gW=e=>dH(Us,re(function*(){const t=yield*Ip,n=yield*hO,r=yield*Ep;return Dve({runtimeStore:t,declarativeLinkRuntime:n,hostScheduler:r})})),Vve=e=>{switch(e){case"reducer":case"trait-computed":case"trait-link":case"trait-external-store":case"source-refresh":case"devtools":case"perf":case"unknown":return e;default:return typeof e=="string"&&e.startsWith("source:")?"source-refresh":"unknown"}},s0=e=>!(!e||e==="*"||/^\d+$/.test(e)||e.includes("[")||e.includes("]")),Qr=e=>{if(typeof e=="string"){const r=Wve(e);if(!r||r.length===0)return;const i=r.filter(s0);return i.length>0?i:void 0}if(e.length===0)return;let t=!1;for(const r of e)if(!s0(r)){t=!0;break}if(!t)return e;const n=e.filter(s0);return n.length>0?n:void 0},fk=(e,t)=>{const n=Math.min(e.length,t.length);for(let r=0;r<n;r++){const i=e[r],o=t[r];if(i!==o)return i<o?-1:1}return e.length-t.length},uy=(e,t)=>{if(e.length>t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0},Kve=e=>{const t={children:new Map},n=new Map,r=new Set;for(let i=0;i<e.length;i++){const o=e[i];let a=t;for(const c of o){const u=a.children;let d=u.get(c);d||(d={children:new Map},u.set(c,d)),a=d}if(a.id=i,o.length>0&&o.some(c=>c.includes("."))){const c=o.join(".");r.add(c),n.delete(c)}if(o.length>0&&o.every(c=>!c.includes(".")&&!c.includes("[")&&!c.includes("]"))){const c=o.join(".");if(r.has(c))continue;if(n.has(c)){r.add(c),n.delete(c);continue}n.set(c,i)}}return{fieldPaths:e,root:t,pathStringToId:n}},dw=(e,t)=>{let n=e.root;for(const r of t){const i=n.children.get(r);if(!i)return;n=i}return n.id},Hve=e=>{let t=2166136261;for(const n of e)t^=n>>>0,t=Math.imul(t,16777619);return t>>>0},yW=e=>{if(e.dirtyAllReason)return{dirtyAll:!0,reason:e.dirtyAllReason,rootIds:[],rootCount:0,keySize:0,keyHash:0};let t=!1,n=!1,r=!1;const i=[];for(const h of e.dirtyPaths??[]){if(h==="*"){t=!0;continue}if(typeof h=="number"){if(!Number.isFinite(h)){n=!0;continue}const y=Math.floor(h);if(y<0){n=!0;continue}if(!e.registry.fieldPaths[y]){r=!0;continue}i.push(y);continue}if(typeof h=="string"){const y=e.registry.pathStringToId?.get(h);if(y!=null){i.push(y);continue}r=!0;continue}const p=Qr(h);if(!p){n=!0;continue}const g=dw(e.registry,p);if(g==null){r=!0;continue}i.push(g)}if(n)return{dirtyAll:!0,reason:"nonTrackablePatch",rootIds:[],rootCount:0,keySize:0,keyHash:0};if(r)return{dirtyAll:!0,reason:"fallbackPolicy",rootIds:[],rootCount:0,keySize:0,keyHash:0};if(t)return{dirtyAll:!0,reason:"unknownWrite",rootIds:[],rootCount:0,keySize:0,keyHash:0};const o=e.registry.fieldPaths;i.sort((h,p)=>{const g=o[h],y=o[p];if(!g||!y)return h-p;const b=fk(g,y);return b!==0?b:h-p});const a=[];let c;for(let h=0;h<i.length;h++){const p=i[h],g=o[p];g&&(c&&uy(c,g)||(a.push(p),c=g))}if(!(a.length>0))return{dirtyAll:!0,reason:"unknownWrite",rootIds:[],rootCount:0,keySize:0,keyHash:0};a.sort((h,p)=>h-p);const d=Hve(a);return{dirtyAll:!1,rootIds:a,rootCount:a.length,keySize:a.length,keyHash:d}},Wve=e=>{if(!e||e==="*")return;const t=e.split(".").filter(r=>r.length>0),n=[];for(const r of t){if(!r)continue;if(r==="*")return;if(r.endsWith("[]")){const o=r.slice(0,-2);o&&n.push(o);continue}const i=/^(.+)\[(\d+)\]$/.exec(r);if(i){n.push(i[1]);continue}if(!/^\d+$/.test(r)){if(r.includes("[")||r.includes("]"))return;n.push(r)}}return n},Rl=e=>{if(e===null)return"null";const t=typeof e;if(t==="string")return JSON.stringify(e);if(t==="number")return Number.isFinite(e)?String(e):"null";if(t==="boolean")return e?"true":"false";if(Array.isArray(e))return`[${e.map(Rl).join(",")}]`;if(t==="object"){const n=e;return`{${Object.keys(n).sort().map(i=>`${JSON.stringify(i)}:${Rl(n[i])}`).join(",")}}`}return"null"},Tp=e=>{let t=2166136261;for(let n=0;n<e.length;n++)t^=e.charCodeAt(n),t=t*16777619>>>0;return t.toString(16).padStart(8,"0")},Gve=Symbol.for("@logixjs/core/externalStoreDescriptor"),pO=e=>{if(!(!e||typeof e!="object"&&typeof e!="function"))return e[Gve]},jm=e=>{const t=new Set;for(const n of e){const r=n.trim();r&&t.add(r)}return Array.from(t).sort()},fC=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),fw=(e,t,n)=>{if(e===null)return null;if(typeof e=="string"||typeof e=="boolean")return e;if(typeof e=="number"){if(!Number.isFinite(e)){n.dropped+=1,n.nonSerializable+=1,n.nonFiniteNumber+=1;return}return e}if(t>=6){n.dropped+=1,n.depthExceeded+=1;return}if(Array.isArray(e)){const r=[];for(const i of e){const o=fw(i,t+1,n);o!==void 0&&r.push(o)}return r}if(fC(e)){const r=Object.keys(e).sort(),i={};for(const o of r){const a=fw(e[o],t+1,n);a!==void 0&&(i[o]=a)}return i}n.dropped+=1,n.nonSerializable+=1},fc=(e,t,n)=>{e.length>=n||e.push(t)},mO=e=>{if(e==null)return{};if(typeof e!="object"||Array.isArray(e))return{report:{invalidInput:!0}};const t=e,n={},r=[];let i=0;const o=[];let a=0;const c=[];let u=0;const d=[];let h=0;const p={dropped:0,nonSerializable:0,depthExceeded:0,nonFiniteNumber:0},g=new Set(["label","description","group","docsUrl","cacheGroup","canonical","tags","annotations"]);for(const C of Object.keys(t))g.has(C)||C.startsWith("x-")||(i+=1,fc(r,C,8));const y=C=>{const E=t[C];if(typeof E!="string")return;const T=E.trim();T&&(n[C]=T)};y("label"),y("description"),y("group"),y("docsUrl"),y("cacheGroup");const b=t.canonical;b!=null&&typeof b!="boolean"?fc(o,"canonical",8):typeof b=="boolean"&&(n.canonical=b);const S=t.tags;if(typeof S=="string"){const C=jm([S]);C.length>0&&(n.tags=C)}else if(Array.isArray(S)){const C=S.filter(T=>typeof T=="string");a+=S.length-C.length;const E=jm(C);E.length>0&&(n.tags=E),a+=C.length-E.length}else S!=null&&fc(o,"tags",8);const w={},x=Object.keys(t).filter(C=>C.startsWith("x-")).sort();for(const C of x){const E=fw(t[C],0,p);E!==void 0?w[C]=E:(h+=1,fc(d,C,8))}const I=t.annotations;if(I!=null&&!fC(I))fc(o,"annotations",8);else if(fC(I)){const C=Object.keys(I).sort();for(const E of C){if(!E.startsWith("x-")){u+=1,fc(c,E,8);continue}const T=fw(I[E],0,p);T!==void 0?w[E]=T:(h+=1,fc(d,E,8))}}Object.keys(w).length>0&&(n.annotations=w);for(const C of["label","description","group","docsUrl","cacheGroup"]){const E=t[C];E!=null&&typeof E!="string"&&fc(o,C,8)}const _=Object.keys(n).length>0?n:void 0,M=(()=>{const C=i>0,E=o.length>0,T=a>0,A=u>0,U=h>0||p.dropped>0;if(!(!C&&!E&&!T&&!A&&!U))return{...C?{unknownKeys:r,unknownKeyCount:i}:{},...E?{droppedKeys:jm(o)}:{},...T?{droppedTagItems:a}:{},...A?{ignoredAnnotationKeys:jm(c),ignoredAnnotationKeyCount:u}:{},...U?{droppedAnnotationKeys:jm(d),droppedAnnotationKeyCount:h,droppedAnnotationValues:p.dropped,droppedAnnotationNonSerializable:p.nonSerializable,droppedAnnotationDepthExceeded:p.depthExceeded,droppedAnnotationNonFiniteNumber:p.nonFiniteNumber}:{}}})();return M?{meta:_,report:M}:{meta:_}},hk=e=>mO(e).meta,dF=e=>{const t={},n=Object.keys(e).sort();for(const r of n)t[r]=e[r];return JSON.stringify(t)},fF=(e,t)=>e===t?!0:!e||!t?!1:dF(e)===dF(t),Yve=(e,t)=>{const n=e.meta;if(!n)return{meta:t.meta,origin:t.origin,conflicts:e.conflicts};if(fF(n,t.meta))return e;const r=[...e.conflicts??[]],i=c=>{r.some(d=>d.origin===c.origin&&fF(d.meta,c.meta))||r.push(c)},o=n.canonical===!0,a=t.meta.canonical===!0;return!o&&a?(i({origin:e.origin??"unknown",meta:n}),{meta:t.meta,origin:t.origin,conflicts:r}):(i({origin:t.origin,meta:t.meta}),{meta:n,origin:e.origin??t.origin,conflicts:r})},Qve=e=>{if(!e||e.length===0)return[];const t=[];for(const n of e){const r=Qr(n);r&&t.push(r)}return t},Xve=e=>e?Qr(e):void 0,bW=e=>{switch(e.kind){case"computed-update":return"computed";case"link-propagate":return"link";case"source-refresh":return"source";case"external-store-sync":return"externalStore";case"check-validate":return"check"}},Jve=(e,t)=>{const n=t.targetFieldPath;if(!n)return;const r=bW(t);return e.entries.find(i=>i.fieldPath===n&&(i.kind===r||r==="check"&&i.kind==="check"||r==="source"&&i.kind==="source"||r==="link"&&i.kind==="link"||r==="computed"&&i.kind==="computed"))},Zve=e=>{if(e){if(e.kind==="computed"||e.kind==="source")return e.meta.deps;if(e.kind==="link"){const t=e.meta.from;return t?[t]:[]}if(e.kind==="externalStore")return[];if(e.kind==="check"){const t=e.meta?.rules??{},n=[];for(const r of Object.keys(t)){const o=t[r]?.deps;o&&n.push(...o)}return n}}},eSe=e=>{const t=e.moduleId,n=e.version??"009",r=new Map;for(const u of e.program.graph.nodes){const d=u.meta;if(!d||typeof d!="object")continue;const h=typeof d.label=="string"?d.label:void 0,p=typeof d.description=="string"?d.description:void 0,g=Array.isArray(d.tags)&&d.tags.every(I=>typeof I=="string")?d.tags:void 0,y=typeof d.group=="string"?d.group:void 0,b=typeof d.docsUrl=="string"?d.docsUrl:void 0,S=typeof d.cacheGroup=="string"?d.cacheGroup:void 0,w=d.annotations,x=w&&typeof w=="object"&&!Array.isArray(w)?w:void 0;(h||p||g||y||b||S||x)&&r.set(u.id,{label:h,description:p,tags:g,group:y,docsUrl:b,cacheGroup:S,annotations:x})}const i=e.program.plan.steps.map(u=>{const d=bW(u),h=Jve(e.program,u),p=Qve(Zve(h)),g=u.targetFieldPath,y=Xve(g),b=y?[y]:[],S=g?r.get(g):void 0,w=()=>{if(d!=="externalStore"||!h||h.kind!=="externalStore")return;const I=pO(h.meta.store),_=I?.storeId,C=h.meta?.priority==="nonUrgent"?"nonUrgent":"urgent",E=hk(h.meta.meta),T=I?.kind==="module"?{kind:"module",storeId:_,moduleId:I.moduleId,...I.instanceId?{instanceKey:I.instanceId}:{},selectorId:I.readQuery.staticIr.selectorId,readsDigest:I.readQuery.staticIr.readsDigest,fallbackReason:I.readQuery.staticIr.fallbackReason}:I?{kind:"external",storeId:_}:{kind:"external",storeId:"unknown"},A=h.meta?.coalesceWindowMs;return{traitId:u.id,storeId:_??"unknown",source:T,ownership:"external-owned",lane:C,...typeof A=="number"&&Number.isFinite(A)&&A>0?{coalesceWindowMs:A}:{},...E?{meta:E}:{}}},x={nodeId:u.id,kind:d,reads:p,writes:d==="check"?[]:b,...d==="externalStore"?{policy:w()}:{},meta:S};return d!=="check"&&g&&!y?{...x,writesUnknown:!0}:x}),o=e.program.graph.edges.map(u=>({edgeId:u.id,from:u.from,to:u.to,kind:u.kind})),a={version:n,moduleId:t,nodes:i,edges:o},c=`stir:${n}:${Tp(Rl(a))}`;return{...a,digest:c}},hF=new Map,tSe=new Map,nSe=8,pF=(e,t)=>{if(!dn())return;const r=eSe({program:t,moduleId:e,version:"009"}).digest;let i=hF.get(e);if(i||(i=new Map,hF.set(e,i)),i.set(r,t),tSe.set(e,r),i.size>nSe){const o=i.keys().next().value;o&&i.delete(o)}},vW=Symbol.for("@logixjs/core/runtimeInternals"),SW=Symbol.for("@logixjs/core/boundInternals"),rSe=Symbol.for("@logixjs/core/moduleTraitsProgram"),gO=(e,t,n)=>{Object.defineProperty(e,t,{value:n,enumerable:!1,configurable:!0,writable:!1})},iSe=(e,t)=>{gO(e,vW,t)},oSe=(e,t)=>{gO(e,SW,t)},mF=(e,t)=>{gO(e,rSe,t)},P1=(e,t)=>{const n=typeof e=="string"&&e.length>0?e:"unknown",r=typeof t=="string"&&t.length>0?t:"unknown";return`moduleId=${n}, instanceId=${r}`},Cp=e=>{const t=e,n=e[vW];if(!n){const i=dn()?["[MissingRuntimeInternals] Runtime internals not installed on ModuleRuntime instance.",`scope: ${P1(t.moduleId,t.instanceId)}`,"fix:","- Ensure ModuleRuntime.make calls internalHooks.installInternalHooks (020 foundation).","- If you created a mock runtime for tests, attach internals or avoid calling internal-only APIs."].join(`
38
+ `):"Runtime internals not installed";throw new Error(i)}const r=t.instanceId;if(typeof r=="string"&&r.length>0&&r!==n.instanceId)throw new Error(dn()?["[InconsistentRuntimeInternals] Runtime internals instanceId mismatch.",`runtime: ${P1(t.moduleId,r)}`,`internals: ${P1(n.moduleId,n.instanceId)}`].join(`
39
+ `):"Runtime internals mismatch");return n},Kc=e=>{const t=e[SW];if(!t){const n=dn()?["[MissingBoundInternals] Bound internals not installed on Bound API instance.","fix:","- Ensure BoundApiRuntime attaches internals (020 foundation).","- If you created a mock bound for tests, attach internals or avoid calling internal-only APIs."].join(`
40
+ `):"Bound internals not installed";throw new Error(n)}return t},yb={currentDebugSinks:po,currentRuntimeLabel:Vc,currentDiagnosticsLevel:Jr},wW=e=>db(Jr,()=>e),sSe=e=>Xbe(e),Md=lW,Ri=Ue,aSe=e=>e&&e!=="auto"?e:uW()==="production"?"prod":"dev",gF=e=>{const t=aSe(e?.mode),n=e?.diagnosticsLevel,r=(()=>{switch(t){case"off":return nve;case"prod":return rve;case"dev":case"auto":return e?.devConsole==="diagnostic"?lve:sve}})();return n?Ac(r,wW(n)):r},lSe=e=>db(po,t=>[...t,...e]);function cSe(e,t){const r=(h=>typeof h=="object"&&h!==null&&"_op_layer"in h)(e),i=r?e:yl,o=r?t:e;bve(o);const a=lSe([wve]),c=xve([Sve]),u=wW(o?.diagnosticsLevel??"light"),d=o?.traitConvergeDiagnosticsSampling?sSe(o.traitConvergeDiagnosticsSampling):yl;return ed(Ac(a,u,d,c),i)}const uSe=e=>db(yb.currentRuntimeLabel,()=>e),_g=e=>typeof e=="function"&&e._kind==="ActionToken"&&typeof e.tag=="string"&&ly(e.schema),dSe=(e,t,n)=>{const r=((...i)=>({_tag:e,payload:i[0]}));return r._kind="ActionToken",r.tag=e,r.schema=t,r},xW=e=>{const t={};for(const[n,r]of Object.entries(e)){if(ly(r)){t[n]=dSe(n,r);continue}if(_g(r)){if(r.tag!==n)throw new Error(`[Logix.Action] actionTag MUST equal key: key="${n}", token.tag="${r.tag}"`);t[n]=r;continue}throw new Error(`[Logix.Action] invalid action def for key "${n}"`)}return t},yF=Go("@logixjs/LifecycleManager"),iS=(e,t)=>t.pipe(jo({onSuccess:()=>ce,onFailure:n=>Rc(`[${e}] failed: ${nu(n)}`)})),zf=(e,t)=>`${e}:${t}`,fSe=e=>re(function*(){const t={maxEventsPerInstance:20,maxEventBytes:4096},n=yield*Qn({identity:e,status:"creating"}),r=[],i=[],o=[],a=[],c=[],u=[],d=[],h=Xi(n),p=(B,j,$)=>Ue({type:"lifecycle:phase",moduleId:e.moduleId,instanceId:e.instanceId,phase:B,name:j,payload:$}),g=(B,j)=>bs(n,$=>({...$,identity:{...$.identity,...j?.runtimeLabel?{runtimeLabel:j.runtimeLabel}:null},status:B,...j?.initOutcome!==void 0?{initOutcome:j.initOutcome}:null,...j?.initProgress!==void 0?{initProgress:j.initProgress}:null})),y=(B,j)=>{const $=r.length;r.push({taskId:zf("initRequired",$),kind:"initRequired",order:$,name:j?.name,effect:B})},b=(B,j)=>{const $=i.length;i.push({taskId:zf("start",$),kind:"start",order:$,name:j?.name,fatalOnFailure:j?.fatalOnFailure,effect:B})},S=(B,j)=>{const $=o.length;o.push({taskId:zf("destroy",$),kind:"destroy",order:$,name:j?.name,effect:B})},w=B=>{d.push(B)},x=(B,j)=>{const $=a.length;a.push({taskId:zf("platformSuspend",$),kind:"platformSuspend",order:$,name:j?.name,effect:B})},I=(B,j)=>{const $=c.length;c.push({taskId:zf("platformResume",$),kind:"platformResume",order:$,name:j?.name,effect:B})},_=(B,j)=>{const $=u.length;u.push({taskId:zf("platformReset",$),kind:"platformReset",order:$,name:j?.name,effect:B})},M=(B,j)=>Ed(B)?ce:Ue({type:"lifecycle:error",moduleId:j.moduleId,instanceId:j.instanceId,cause:B,phase:j.phase,hook:j.hook,taskId:j.taskId,txnSeq:j.txnSeq,opSeq:j.opSeq,origin:j.origin}).pipe(Ze(ln(d,$=>$(B,j).pipe(At(F=>Rc(`[lifecycle.onError] failed: ${nu(F)}`))),{discard:!0}))),C=re(function*(){const B=r.length;if(B===0){yield*g("ready",{initProgress:{total:0,completed:0},initOutcome:{status:"success"}});return}const j=Date.now();yield*p("init","initRequired:start",{total:B}),yield*g("initializing",{initProgress:{total:B,completed:0,current:0,startedAt:j}});let $=0;for(let F=0;F<r.length;F++){yield*g("initializing",{initProgress:{total:B,completed:$,current:F,startedAt:j}});const K=r[F],W=yield*en(K.effect);if(W._tag==="Success"){$+=1,yield*g("initializing",{initProgress:{total:B,completed:$,current:F+1,startedAt:j}});continue}const X=Fo(W.cause);return yield*M(W.cause,{phase:"init",hook:"initRequired",moduleId:e.moduleId,instanceId:e.instanceId,taskId:K.taskId,origin:"initRequired"}),yield*g("failed",{initProgress:{total:B,completed:$,current:F,startedAt:j},initOutcome:{status:"failure",error:X.errorSummary}}),yield*pr(W.cause)}yield*p("init","initRequired:success",{total:B}),yield*g("ready",{initProgress:{total:B,completed:$,current:B,startedAt:j},initOutcome:{status:"success"}})}),E=p("run","start:schedule",{total:i.length}).pipe(Ze(ln(i,B=>Nn(B.effect.pipe(At(j=>M(j,{phase:"run",hook:"start",moduleId:e.moduleId,instanceId:e.instanceId,taskId:B.taskId,origin:"start"})))).pipe(Gt),{discard:!0,concurrency:"unbounded"}))),T=re(function*(){yield*p("destroy","destroy:start",{total:o.length}),yield*g("terminating");for(let B=o.length-1;B>=0;B--){const j=o[B];yield*iS("lifecycle.onDestroy",j.effect.pipe(At($=>M($,{phase:"destroy",hook:"destroy",moduleId:e.moduleId,instanceId:e.instanceId,taskId:j.taskId,origin:"destroy"}))))}yield*g("terminated"),yield*p("destroy","destroy:done",{total:o.length})}),A=re(function*(){if(a.length!==0){yield*p("platform","signal:suspend",{total:a.length});for(const B of a)yield*iS("lifecycle.onSuspend",B.effect.pipe(At(j=>M(j,{phase:"platform",hook:"suspend",moduleId:e.moduleId,instanceId:e.instanceId,taskId:B.taskId,origin:"platform.suspend"}))))}}),U=re(function*(){if(c.length!==0){yield*p("platform","signal:resume",{total:c.length});for(const B of c)yield*iS("lifecycle.onResume",B.effect.pipe(At(j=>M(j,{phase:"platform",hook:"resume",moduleId:e.moduleId,instanceId:e.instanceId,taskId:B.taskId,origin:"platform.resume"}))))}}),R=re(function*(){if(u.length!==0){yield*p("platform","signal:reset",{total:u.length});for(const B of u)yield*iS("lifecycle.onReset",B.effect.pipe(At(j=>M(j,{phase:"platform",hook:"reset",moduleId:e.moduleId,instanceId:e.instanceId,taskId:B.taskId,origin:"platform.reset"}))))}}),N=Ye(()=>({initRequired:r.map(({effect:B,...j})=>j),start:i.map(({effect:B,...j})=>j),destroy:o.map(({effect:B,...j})=>j),platformSuspend:a.map(({effect:B,...j})=>j),platformResume:c.map(({effect:B,...j})=>j),platformReset:u.map(({effect:B,...j})=>j)})),L=Ye(()=>d.length>0);return{identity:e,budgets:t,registerPlatformSuspend:x,registerPlatformResume:I,registerPlatformReset:_,registerInitRequired:y,registerStart:b,registerDestroy:S,registerOnError:w,getStatus:h,setStatus:g,notifyError:M,runPlatformSuspend:A,runPlatformResume:U,runPlatformReset:R,runInitRequired:C,runStart:E,runDestroy:T,hasOnErrorHandlers:L,getTaskSnapshot:N}}),hSe=()=>{const e=globalThis.performance;return e&&typeof e.now=="function"?e.now():Date.now()},pSe=e=>{const t=e.instrumentation??"full",n=e.captureSnapshots??t==="full",r={txnId:"",txnSeq:0,origin:{kind:"unknown"},startedAt:0,baseState:void 0,draft:void 0,initialStateSnapshot:void 0,patches:[],patchCount:0,patchesTruncated:!1,dirtyPathIds:new Set,dirtyAllReason:void 0},i={config:{instrumentation:t,captureSnapshots:n,now:e.now??hSe,moduleId:e.moduleId,instanceId:e.instanceId,getFieldPathIdRegistry:e.getFieldPathIdRegistry},current:void 0,nextTxnSeq:0,scratch:r,recordPatch:()=>{}},o=(u,d,h,p,g,y)=>{const b=i.current;b&&(b.patchCount+=1,bF(b,u,d))},a=256,c=(u,d,h,p,g,y)=>{const b=i.current;if(!b)return;b.patchCount+=1;const S=b.patchCount-1,w=bF(b,u,d);if(b.patchesTruncated||b.patches.length>=a){b.patchesTruncated=!0;return}b.patches.push({opSeq:S,...w!=null?{pathId:w}:null,...h!==void 0?{from:h}:null,...p!==void 0?{to:p}:null,reason:Vve(d),...g?{traitNodeId:g}:null,...typeof y=="number"&&Number.isFinite(y)&&y>=0?{stepId:Math.floor(y)}:null})};return i.recordPatch=t==="full"?c:o,i},mSe=(e,t,n)=>{const{config:r}=e,i=r.now,o=i();e.nextTxnSeq+=1;const a=e.nextTxnSeq,u=`${r.instanceId??"unknown"}::t${a}`,d=r.captureSnapshots?n:void 0,h=e.scratch;h.txnId=u,h.txnSeq=a,h.origin=t,h.startedAt=o,h.baseState=n,h.draft=n,h.initialStateSnapshot=d,h.patches.length=0,h.patchCount=0,h.patchesTruncated=!1,h.fieldPathIdRegistry=e.config.getFieldPathIdRegistry?.(),h.dirtyPathIds.clear(),h.dirtyAllReason=void 0,e.current=h},bF=(e,t,n)=>{if(e.dirtyAllReason)return;if(t===void 0){e.dirtyAllReason="customMutation";return}if(t==="*"){e.dirtyAllReason="unknownWrite";return}const r=e.fieldPathIdRegistry;if(!r){e.dirtyAllReason=n==="reducer"?"customMutation":"fallbackPolicy";return}let i;if(typeof t=="number"){if(!Number.isFinite(t)){e.dirtyAllReason="nonTrackablePatch";return}const o=Math.floor(t);if(o<0){e.dirtyAllReason="nonTrackablePatch";return}if(!r.fieldPaths[o]){e.dirtyAllReason="fallbackPolicy";return}i=o}else if(typeof t=="string"){const o=r.pathStringToId?.get(t);if(o==null){e.dirtyAllReason="fallbackPolicy";return}i=o}else{const o=Qr(t);if(!o){e.dirtyAllReason="nonTrackablePatch";return}const a=dw(r,o);if(a==null){e.dirtyAllReason="fallbackPolicy";return}i=a}return e.dirtyPathIds.add(i),i},hl=(e,t)=>{const n=e.current;n&&(n.draft=t)},vF=(e,t,n,r,i,o,a)=>{e.recordPatch(t,n,r,i,o,a)},gSe=(e,t)=>re(function*(){const n=e.current;if(!n)return;const{config:r}=e,i=r.now,o=n.draft;if(Object.is(o,n.baseState)){e.current=void 0;return}yield*Ube(t,o);const a=i(),c=Math.max(0,a-n.startedAt),u=n.fieldPathIdRegistry,d=u==null?{dirtyAll:!0,reason:n.dirtyAllReason??"fallbackPolicy",rootIds:[],rootCount:0,keySize:0,keyHash:0}:yW({dirtyPaths:n.dirtyPathIds,registry:u,dirtyAllReason:n.dirtyAllReason}),h={txnId:n.txnId,txnSeq:n.txnSeq,origin:n.origin,startedAt:n.startedAt,endedAt:a,durationMs:c,dirtySet:d,patchCount:n.patchCount,patchesTruncated:n.patchesTruncated,...n.patchesTruncated?{patchesTruncatedReason:"max_patches"}:null,initialStateSnapshot:n.initialStateSnapshot,finalStateSnapshot:r.captureSnapshots?o:void 0,patches:e.config.instrumentation==="full"?n.patches.slice():[],moduleId:r.moduleId,instanceId:r.instanceId};return e.current=void 0,h}),ySe=e=>{e.current=void 0};class bSe extends Yt("@logixjs/core/RuntimeServicesRuntimeConfig")(){}const vSe=bSe;class SSe extends Yt("@logixjs/core/RuntimeServicesProviderOverrides")(){}const wSe=SSe;class xSe extends Yt("@logixjs/core/RuntimeServicesInstanceOverrides")(){}const kSe=xSe;class _Se extends Yt("@logixjs/core/FullCutoverGateMode")(){}const ISe=_Se,SF=["builtin","runtime_default","runtime_module","provider","instance"],ESe=(e,t)=>{const n=SF.indexOf(e),r=SF.indexOf(t);return n>=r?e:t},TSe=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),CSe=e=>{if(!TSe(e))return;const t=e.implId,n=e.notes;return{implId:typeof t=="string"&&t.length>0?t:void 0,notes:typeof n=="string"&&n.length>0?n:void 0}},MSe=e=>re(function*(){const t=yield*Ve(vSe),n=yield*Ve(wSe),r=yield*Ve(kSe),i=Ce(t)?t.value:void 0,o=Ce(n)?n.value:void 0,a=Ce(r)?r.value:void 0,c=e.moduleId,u=c&&i?.servicesByModuleId?i.servicesByModuleId[c]:void 0,d=c&&o?.servicesByModuleId?o.servicesByModuleId[c]:void 0;return{runtimeDefault:i?.services,runtimeModule:u,provider:o?.services,providerModule:d,instance:a}});class RSe extends Yt("@logixjs/core/RuntimeServicesRegistry")(){}const ASe=RSe,oS=(e,t,n)=>{const r=t[0];if(!r)throw new Error(`[Logix] RuntimeKernel registry missing builtin impl for: ${e}`);let i;const o=(g,y)=>{const b=y?CSe(y[e]):void 0;!b||!b.implId||(i={scope:g,override:b})};if(o("runtime_default",n.runtimeDefault),o("runtime_module",n.runtimeModule),o("provider",n.provider),o("provider",n.providerModule),o("instance",n.instance),!i)return{impl:r,binding:{serviceId:e,implId:r.implId,implVersion:r.implVersion,scope:"builtin",overridden:!1,notes:r.notes},overridesApplied:[]};const a=i.override.implId,c=t.find(g=>g.implId===a),u=c??r,d=c==null,h=d?`Unknown implId "${a}", falling back to builtin "${r.implId}"`:void 0,p=[i.override.notes,u.notes,h].filter(g=>typeof g=="string"&&g.length>0).join("; ");return{impl:u,binding:{serviceId:e,implId:u.implId,implVersion:u.implVersion,scope:i.scope,overridden:!0,notes:p.length>0?p:void 0},overridesApplied:[d?`${i.scope}:${e}=${a} (fallback=${r.implId})`:`${i.scope}:${e}=${a}`]}},OSe=e=>{let t="builtin";for(const n of e.bindings)t=ESe(t,n.scope);return{moduleId:e.moduleId,instanceId:e.instanceId,scope:t,bindings:e.bindings,overridesApplied:e.overridesApplied}},DSe=Symbol.for("@logixjs/core/runtimeServicesEvidence"),PSe=(e,t,n)=>{Object.defineProperty(e,t,{value:n,enumerable:!1,configurable:!0,writable:!1})},NSe=(e,t)=>{PSe(e,DSe,t)},LSe={requiredServiceIds:["txnQueue","operationRunner","transaction","dispatch"]},$Se=e=>e==="core"?"builtin":e,jSe=e=>{const t=new Set;for(const n of e){if(!n.includes("(fallback="))continue;const r=n.indexOf(":");if(r<0)continue;const i=n.indexOf("=",r+1);if(i<0)continue;const o=n.slice(r+1,i);o.length>0&&t.add(o)}return Array.from(t).sort()},FSe=e=>{const t=new Map;for(const r of e.bindings)t.set(r.serviceId,r);const n=[];for(const r of e.requiredServiceIds){const o=t.get(r)?.implId;(!o||o!==e.expectedImplId)&&n.push(r)}return n},zSe=e=>{const t=$Se(e.requestedKernelId),n=e.coverageMatrix??LSe,r=jSe(e.runtimeServicesEvidence.overridesApplied),i=FSe({expectedImplId:t,requiredServiceIds:n.requiredServiceIds,bindings:e.runtimeServicesEvidence.bindings}),o=i.length===0&&r.length===0,a=e.mode==="fullCutover"?o?"PASS":"FAIL":"PASS",c=e.runtimeServicesEvidence.moduleId,d={moduleId:typeof c=="string"&&c.length>0?c:"unknown",instanceId:e.runtimeServicesEvidence.instanceId,txnSeq:0},h=e.diagnosticsLevel??"off";return{version:"v1",mode:e.mode,requestedKernelId:e.requestedKernelId,verdict:a,fullyActivated:o,missingServiceIds:i,fallbackServiceIds:r,anchor:d,...h==="off"?{}:{details:{expectedImplId:t,bindings:e.runtimeServicesEvidence.bindings,overridesApplied:e.runtimeServicesEvidence.overridesApplied}}}},BSe=e=>typeof e=="string"&&e.length>0&&/^[a-z0-9-]+$/.test(e),qSe={kernelId:"core",packageName:"@logixjs/core"},USe=(e,t=qSe)=>{if(typeof e!="object"||e===null||Array.isArray(e))return t;const n=e;return!BSe(n.kernelId)||typeof n.packageName!="string"||n.packageName.length===0?t:{kernelId:n.kernelId,packageName:n.packageName,...typeof n.packageVersion=="string"&&n.packageVersion.length>0?{packageVersion:n.packageVersion}:{},...typeof n.buildId=="string"&&n.buildId.length>0?{buildId:n.buildId}:{},...Array.isArray(n.capabilities)&&n.capabilities.every(r=>typeof r=="string")?{capabilities:n.capabilities}:{}}};class VSe extends Yt("@logixjs/core/KernelImplementationRef")(){}const KSe=VSe,HSe=()=>re(function*(){const e=yield*Ve(KSe);return USe(Ce(e)?e.value:void 0)}),WSe=Symbol.for("@logixjs/core/kernelImplementationRef"),GSe=(e,t,n)=>{Object.defineProperty(e,t,{value:n,enumerable:!1,configurable:!0,writable:!1})},YSe=(e,t)=>{GSe(e,WSe,t)};class sS extends Yt("@logixjs/core/RuntimeServiceBuiltins")(){}const QSe=e=>typeof e=="string"&&e.length>0?e:void 0,dy=e=>typeof e=="number"&&Number.isInteger(e)&&e>0?e:void 0,bl=e=>typeof e=="number"&&Number.isFinite(e)&&e>0?e:void 0,a0=e=>typeof e=="number"&&Number.isFinite(e)&&e>=0?e:void 0,fy=e=>typeof e=="boolean"?e:void 0;class XSe extends Yt("@logixjs/core/RunSession")(){}const Pa=XSe,N1=Symbol.for("@logixjs/core/runSession/nextRunSeq");let wF=0;const JSe=()=>{try{const e=globalThis,n=(typeof e[N1]=="number"?e[N1]:0)+1;return e[N1]=n,n}catch{return wF+=1,wF}},ZSe=e=>`run-${e}.${JSe()}`,e0e=()=>{const e=new Set,t=new Map;return{once:n=>e.has(n)?!1:(e.add(n),!0),nextSeq:(n,r)=>{const i=t.get(n)??new Map;t.has(n)||t.set(n,i);const a=(i.get(r)??0)+1;return i.set(r,a),a},clear:()=>{e.clear(),t.clear()}}},t0e=e=>{const t=e?.startedAt??Date.now();return{runId:e?.runId??ZSe(t),source:e?.source??{host:"unknown"},startedAt:t,local:e?.local??e0e()}},n0e=e=>zo(Pa,t0e());class r0e extends Yt("@logixjs/core/EvidenceCollector")(){}const i0e=r0e;let xF=0;const kW=()=>(xF+=1,xF),_W=(e,t)=>e?`${e}::o${t}`:`o${t}`,hy=e=>({...e.id?{id:e.id,meta:e.meta}:(()=>{const t=e.meta??{},n=t.instanceId,r=typeof t.opSeq=="number"&&Number.isFinite(t.opSeq)?Math.floor(t.opSeq):kW();return{id:_W(n,r),meta:t.opSeq===r?t:{...t,opSeq:r}}})(),kind:e.kind,name:e.name,payload:e.payload,effect:e.effect}),o0e=e=>re(function*(){if(e.id)return{id:e.id,kind:e.kind,name:e.name,payload:e.payload,meta:e.meta,effect:e.effect};const t=e.meta??{},n=t.instanceId;let r;if(typeof t.opSeq=="number"&&Number.isFinite(t.opSeq))r=Math.floor(t.opSeq);else{const i=yield*Ve(Pa);if(Ce(i)){const o=n??"global";r=i.value.local.nextSeq("opSeq",o)}else r=kW()}return{id:_W(n,r),kind:e.kind,name:e.name,payload:e.payload,meta:t.opSeq===r?t:{...t,opSeq:r},effect:e.effect}}),Yh=(e,t)=>Qbe(e,t),s0e=()=>Ve(Uc).pipe(rt(e=>Ce(e)?e.value.stack:[])),a0e=e=>{const{optionsModuleId:t,instanceId:n,txnContext:r}=e;return(o,a,c,u)=>re(function*(){const d=yield*s0e(),h=r.current?.txnId,p=yield*et(Cd),g=yield*et(Vc),{linkId:y,...b}=c.meta??{},S={...b,moduleId:c.meta?.moduleId??t,instanceId:c.meta?.instanceId??n,runtimeLabel:c.meta?.runtimeLabel??g,txnSeq:c.meta?.txnSeq??r.current?.txnSeq,txnId:c.meta?.txnId??h},w=S;if(!(typeof w.opSeq=="number"&&Number.isFinite(w.opSeq))){const E=yield*Ve(Pa);if(Ce(E)){const T=w.instanceId??"global";w.opSeq=E.value.local.nextSeq("opSeq",T)}}const x=hy({kind:o,name:a,payload:c.payload,effect:u,meta:S}),I=p??x.id,_=x.meta?.linkId===I?x:{...x,meta:{...x.meta??{},linkId:I}},M=d.length?Yh(_,d):_.effect,C=typeof w.opSeq=="number"&&Number.isFinite(w.opSeq)?Math.floor(w.opSeq):void 0;return yield*Cn(Cd,I)(Cn(cC,C)(M))})},kF=(e,t,n)=>Object.assign(new Error(e==="ReducerDuplicateError"?`[ModuleRuntime] Duplicate primary reducer for tag "${t}". Each action tag must have at most one primary reducer.`:`[ModuleRuntime] Late primary reducer registration for tag "${t}". Reducers must be registered before the first dispatch of this tag.`),{_tag:e,tag:t,moduleId:n}),_F=(e,t)=>Ye(()=>{const n=Ws(Vh(e));let r,i;for(const c of n){if(!c||typeof c!="object")continue;const u=c;u._tag==="ReducerDuplicateError"?r=u:u._tag==="ReducerLateRegistrationError"&&(i=u)}const o=[];if(r&&o.push(Ue({type:"diagnostic",moduleId:r.moduleId??t,code:"reducer::duplicate",severity:"error",message:`Primary reducer for tag "${r.tag}" is already registered and cannot be redefined.`,hint:"Ensure each Action tag defines a single primary reducer. If it is defined in both Module.reducers and $.reducer, keep the Module.reducers version or merge into one definition.",actionTag:r.tag})),i&&o.push(Ue({type:"diagnostic",moduleId:i.moduleId??t,code:"reducer::late_registration",severity:"error",message:`Primary reducer for tag "${i.tag}" was registered after actions with this tag had already been dispatched.`,hint:'Move this reducer to Module.make({ reducers }), or ensure $.reducer("tag", ...) runs before the first dispatch.',actionTag:i.tag})),o.length===0)return ce;let a=ce;for(const c of o)a=a.pipe(Ze(c));return a}).pipe(qs),l0=mo(void 0),l0e=e=>{const{optionsModuleId:t,instanceId:n,declaredActionTags:r,initialReducers:i,txnContext:o,readState:a,setStateInternal:c,recordStatePatch:u,actionHub:d,actionCommitHub:h,diagnostics:p,enqueueTransaction:g,resolveConcurrencyPolicy:y,runOperation:b,runWithStateTransaction:S,isDevEnv:w}=e,x=L=>{const B=L?._tag;if(typeof B=="string"&&B.length>0)return B;const j=L?.type;if(typeof j=="string"&&j.length>0)return j;if(B!=null)return String(B);if(j!=null)return String(j)},I=new Map;if(i)for(const[L,B]of Object.entries(i))I.set(L,B);const _=new Set,M=(L,B)=>{if(I.has(L))throw kF("ReducerDuplicateError",L,t);if(_.has(L))throw kF("ReducerLateRegistrationError",L,t);I.set(L,B)},C=L=>{const B=x(L);if(B==null||I.size===0)return ce;const j=B.length>0?B:"unknown";_.add(j);const $=I.get(j);return $?a.pipe($e(F=>re(function*(){const K=[],X=$(F,L,V=>{if(typeof V=="string"){V.length>0&&K.push(V);return}if(typeof V=="number"){Number.isFinite(V)&&K.push(Math.floor(V));return}V.length>0&&K.push(V)});if(!Object.is(X,F)){if(o.current){if(K.length>0){hl(o,X);for(const V of K)u(V,"reducer");return}hl(o,X),u("*","reducer",void 0,X),w()&&(yield*Ue({type:"diagnostic",moduleId:t,instanceId:n,txnSeq:o.current?.txnSeq,txnId:o.current?.txnId,trigger:o.current?.origin,code:"state_transaction::dirty_all_fallback",severity:"warning",message:"Reducer writeback did not provide field-level dirty-set evidence; falling back to dirtyAll scheduling.",hint:"Prefer Logix.Module.Reducer.mutate(...) or $.state.mutate(...) inside the transaction to produce field-level patchPaths.",kind:"dirty_all_fallback:reducer"}));return}yield*c(X,"*","reducer",void 0,X)}}))):ce},E=(L,B,j)=>({kind:j?.kind??"action",name:j?.name??L,details:{_tag:x(B)??"unknown",path:typeof B?.payload?.path=="string"?B.payload.path:void 0,op:(()=>{const $=x(B)??"";return $.includes("Remove")||$.includes("remove")?"remove":$.includes("Append")||$.includes("Prepend")||$.includes("Insert")||$.includes("Swap")||$.includes("Move")||$.includes("append")||$.includes("prepend")||$.includes("insert")||$.includes("swap")||$.includes("move")?"insert":$.includes("Unset")||$.includes("unset")?"unset":"set"})()}}),T=L=>re(function*(){yield*C(L);const B=x(L),j=typeof B=="string"&&B.length>0?B:"unknown",$=r?!r.has(j):!1;yield*Ue({type:"action:dispatch",moduleId:t,action:L,actionTag:j,...$?{unknownAction:!0}:{},instanceId:n,txnSeq:o.current?.txnSeq,txnId:o.current?.txnId});const F=o.current;if(F){const K={txnSeq:F.txnSeq,txnId:F.txnId,commitMode:F.commitMode??"normal",priority:F.priority??"normal",originKind:F.origin.kind,originName:F.origin.name};yield*Sl(h,{value:L,meta:K})}}),A=(L,B)=>b("action","action:dispatch",{payload:L,meta:{moduleId:t,instanceId:n}},S(E("dispatch",L,B),()=>T(L))).pipe(Gt),U=(L,B)=>b("action","action:dispatchLowPriority",{payload:L,meta:{moduleId:t,instanceId:n}},S(E("dispatchLowPriority",L,B),()=>re(function*(){o.current&&(o.current.commitMode="lowPriority",o.current.priority="low"),yield*T(L)}))).pipe(Gt),R=(L,B)=>L.length===0?ce:b("action","action:dispatchBatch",{payload:L,meta:{moduleId:t,instanceId:n}},S({kind:B?.kind??"action",name:B?.name??"dispatchBatch",details:{count:L.length}},()=>re(function*(){o.current&&(o.current.commitMode="batch",o.current.priority="normal");for(const j of L)yield*T(j)}))).pipe(Gt),N=(L,B)=>re(function*(){const j=Date.now();yield*B;const $=Date.now()-j;if($<=0)return;const F=yield*y();yield*p.emitPressureIfNeeded({policy:F,trigger:{kind:"actionHub",name:L},saturatedDurationMs:$})});return{registerReducer:M,dispatch:L=>et(l0).pipe($e(B=>g(A(L,B)).pipe(Ze(N("publish",Sl(d,L)))))),dispatchBatch:L=>et(l0).pipe($e(B=>g(R(L,B)).pipe(Ze(N("publishAll",lme(d,L)))))),dispatchLowPriority:L=>et(l0).pipe($e(B=>g(U(L,B)).pipe(Ze(N("publish",Sl(d,L))))))}},c0e=e=>{const t=e?._tag;if(typeof t=="string"&&t.length>0)return t;const n=e?.type;if(typeof n=="string"&&n.length>0)return n;if(t!=null)return String(t);if(n!=null)return String(n)},u0e=(e,t)=>c0e(e)===t,d0e=(e,t)=>{const n=e.get(t);if(n)return n;const r={nextHandlerSeq:0,handlerIds:new WeakMap};return e.set(t,r),r},f0e=(e,t)=>{const n=e.handlerIds.get(t);if(n)return n;e.nextHandlerSeq+=1;const r=`h${e.nextHandlerSeq}`;return e.handlerIds.set(t,r),r},h0e=e=>{const{moduleId:t,instanceId:n,actions$:r}=e,i=new Map,o=new Map,a=d=>{const h=o.get(d);if(h)return h;const p={handlers:new Map,watcherStarted:!1};return o.set(d,p),p},c=(d,h)=>{if(h.watcherStarted)return ce;h.watcherStarted=!0;const p=Ml(r.pipe(zs(g=>u0e(g,d))),g=>re(function*(){const y=Array.from(h.handlers.values());if(y.length===0)return;const b=g?.payload;yield*ln(y,S=>Nn(re(function*(){const w=yield*en(S.handler(b));if(w._tag==="Success")return;const{errorSummary:x,downgrade:I}=Fo(w.cause),_=I?` (downgrade=${I})`:"";yield*Ue({type:"diagnostic",moduleId:t,instanceId:n,code:"effects::handler_failure",severity:"error",message:`Effect handler failed for actionTag="${S.actionTag}" sourceKey="${S.sourceKey}".${_}`,hint:`${x.name?`${x.name}: `:""}${x.message}`,actionTag:S.actionTag,kind:"effect_handler_failure",trigger:{kind:"effect",name:"handler",details:{actionTag:S.actionTag,sourceKey:S.sourceKey,logicUnitId:S.logicUnitId}}})})),{discard:!0})})).pipe(At(g=>Ue({type:"diagnostic",moduleId:t,instanceId:n,code:"effects::watcher_crashed",severity:"error",message:`Effect watcher crashed for actionTag="${d}".`,hint:Fo(g).errorSummary.message,actionTag:d,kind:"effect_watcher_crashed"})));return Nn(p).pipe(Gt)};return{registerEffect:d=>re(function*(){const h=d.actionTag,p=d.handler,g=d.logicUnit?.logicUnitId??"unknown",y=d.logicUnit?.logicUnitLabel??`logicUnit:${g}`,b=d.logicUnit?.path,S=d0e(i,g),w=f0e(S,p),x=`${g}::${w}`,I=a(h);return I.handlers.has(x)?(yield*Ue({type:"diagnostic",moduleId:t,instanceId:n,code:"effects::duplicate_registration",severity:"warning",message:`Duplicate effect registration ignored for actionTag="${h}" sourceKey="${x}".`,hint:"The runtime de-duplicates effect handlers by (actionTag, sourceKey). If you see this unexpectedly, check repeated setup registration or accidental double-mounting.",actionTag:h,kind:"effect_duplicate_registration",trigger:{kind:"effect",name:"register",details:{actionTag:h,sourceKey:x,phase:d.phase,logicUnitId:g,logicUnitLabel:y,logicUnitPath:b}}}),{sourceKey:x,duplicate:!0}):(I.handlers.set(x,{actionTag:h,sourceKey:x,handler:p,phase:d.phase,logicUnitId:g,logicUnitLabel:y,logicUnitPath:b}),d.phase==="run"&&(yield*Ue({type:"diagnostic",moduleId:t,instanceId:n,code:"effects::dynamic_registration",severity:"warning",message:`Effect registered in run phase for actionTag="${h}" sourceKey="${x}".`,hint:"Run-phase registration only affects future actions; prefer registering effects during setup for deterministic behavior.",actionTag:h,kind:"effect_dynamic_registration",trigger:{kind:"effect",name:"register:run",details:{actionTag:h,sourceKey:x,logicUnitId:g,logicUnitLabel:y,logicUnitPath:b}}})),yield*c(h,I),{sourceKey:x,duplicate:!1})})}},IF=(e,t)=>{if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0};class EF{capacity;buckets=new Map;head;tail;size_=0;hits_=0;misses_=0;evicts_=0;disabled_=!1;disableReason_;constructor(t){const n=Math.floor(t);this.capacity=n>0?n:0}isDisabled(){return this.disabled_}disable(t){this.disabled_||this.disableInternal(t)}get(t,n){if(this.capacity<=0||this.disabled_)return;const r=this.buckets.get(t);if(!r){this.misses_+=1;return}for(const i of r)if(IF(i.rootIds,n))return this.hits_+=1,this.touch(i),i.planStepIds;this.misses_+=1}set(t,n,r){if(this.capacity<=0||this.disabled_)return;const i=this.buckets.get(t)??[];for(const a of i)if(IF(a.rootIds,n)){a.planStepIds=r,this.touch(a),this.buckets.has(t)||this.buckets.set(t,i);return}const o={hash:t,rootIds:n,planStepIds:r};for(i.push(o),this.buckets.set(t,i),this.attachFront(o),this.size_+=1;this.size_>this.capacity;)this.evictOne();this.maybeTriggerLowHitRateProtection()}evidence(t){return{capacity:this.capacity,size:this.size_,hits:this.hits_,misses:this.misses_,evicts:this.evicts_,hit:t.hit,...typeof t.keySize=="number"?{keySize:t.keySize}:null,...t.hit?null:t.missReason?{missReason:t.missReason}:null,...this.disabled_?{disabled:!0,disableReason:this.disableReason_??"unknown"}:null}}maybeTriggerLowHitRateProtection(){if(this.disabled_||this.capacity<=0)return;const t=this.hits_+this.misses_;t<Math.max(64,this.capacity+1)||(t>0?this.hits_/t:1)>.01||this.disable("low_hit_rate")}disableInternal(t){this.disabled_=!0,this.disableReason_=t,this.clearEntries()}clearEntries(){this.buckets.clear(),this.head=void 0,this.tail=void 0,this.size_=0}attachFront(t){t.prev=void 0,t.next=this.head,this.head?this.head.prev=t:this.tail=t,this.head=t}detach(t){const n=t.prev,r=t.next;n?n.next=r:this.head=r,r?r.prev=n:this.tail=n,t.prev=void 0,t.next=void 0}touch(t){this.head!==t&&(this.detach(t),this.attachFront(t))}evictOne(){const t=this.tail;if(!t)return;this.detach(t);const n=this.buckets.get(t.hash);if(n){const r=n.indexOf(t);r>=0&&n.splice(r,1),n.length===0&&this.buckets.delete(t.hash)}this.size_=Math.max(0,this.size_-1),this.evicts_+=1}}class hC extends Error{constructor(t,n,r=[]){super(n),this.code=t,this.fields=r,this.name="StateTraitConfigError"}_tag="StateTraitConfigError"}const hw=e=>`converge_ir_v2:${Tp(Rl({writersKey:e.writersKey,depsKey:e.depsKey,fieldPathsKey:e.fieldPathsKey}))}`,p0e=e=>({staticIrDigest:hw(e.ir),moduleId:e.moduleId,instanceId:e.instanceId,generation:e.ir.generation,fieldPaths:e.ir.fieldPaths,stepOutFieldPathIdByStepId:Array.from(e.ir.stepOutFieldPathIdByStepId),stepSchedulingByStepId:e.ir.stepSchedulingByStepId.slice(),topoOrder:e.ir.topoOrder.slice(),buildDurationMs:e.ir.buildDurationMs}),IW=(e,t)=>{let n=e;for(let r=0;r<t.length;r++){if(n==null)return;n=n[t[r]]}return n},TF=e=>typeof e=="object"&&e!==null,CF=e=>{if(Array.isArray(e))return e.slice();const t=Object.getPrototypeOf(e),n=t===null?Object.create(null):Object.create(t);return Object.assign(n,e)};class m0e{root;owned=new WeakSet;copies=new WeakMap;constructor(t){this.root=t}getRoot(){return this.root}getAt(t){return IW(this.root,t)}setAt(t,n,r){if(t.length===0)return;this.root=this.ensureOwnedRoot();let i=this.root;for(let o=0;o<t.length-1;o++){const a=t[o],c=i[a];if(!TF(c)){const h={};this.owned.add(h),i[a]=h,i=h;continue}if(this.owned.has(c)){i=c;continue}const u=this.copies.get(c),d=u??CF(c);u||this.copies.set(c,d),this.owned.add(d),i[a]=d,i=d}i[t[t.length-1]]=n}ensureOwnedRoot(){const t=this.root;if(!TF(t))return this.root;if(this.owned.has(t))return this.root;const n=this.copies.get(t),r=n??CF(t);return n||this.copies.set(t,r),this.owned.add(r),r}}class MF{root;keys=[];prev=[];had=[];constructor(t){this.root=t}getRoot(){return this.root}getAt(t){return t.length===1?this.root[t[0]]:IW(this.root,t)}setAt(t,n,r){if(t.length!==1)throw new Error("[StateTrait.converge] ShallowInPlaceDraft only supports root-level writes");const i=t[0],o=this.root,a=Object.prototype.hasOwnProperty.call(o,i);this.keys.push(i),this.had.push(a),this.prev.push(a?o[i]:void 0),o[i]=n}rollback(){const t=this.root;for(let n=this.keys.length-1;n>=0;n--){const r=this.keys[n];this.had[n]?t[r]=this.prev[n]:delete t[r]}this.keys.length=0,this.prev.length=0,this.had.length=0}}const RF=new Set,pk=e=>Ve(Pa).pipe(rt(t=>Ce(t)?t.value.local.once(e):RF.has(e)?!1:(RF.add(e),!0))),aS=(e,t=10)=>e.length===0?"":e.length<=t?e.join(", "):`${e.slice(0,t).join(", ")}, …(+${e.length-t})`,g0e=e=>re(function*(){const t=`${e.moduleId??"unknown"}::${e.instanceId??"unknown"}::${e.kind}::${e.fieldPath}`;(yield*pk(`deps_mismatch:${t}`))&&(yield*Ue({type:"diagnostic",moduleId:e.moduleId,instanceId:e.instanceId,code:"state_trait::deps_mismatch",severity:"warning",message:`[deps] ${e.kind} "${e.fieldPath}" declared=[${aS(e.diff.declared)}] reads=[${aS(e.diff.reads)}] missing=[${aS(e.diff.missing)}] unused=[${aS(e.diff.unused)}]`,hint:'deps is the single source of truth for dependencies: incremental scheduling / reverse closures / performance optimizations rely on deps only. Keep deps consistent with actual reads; if you really depend on the whole object, declare a coarser-grained dep (e.g. "profile") to cover sub-field reads.',kind:`deps_mismatch:${e.kind}`}))}),Lu=(e,t,n=new Set)=>{if(t.length===0)return!0;let r=e;for(;;){if(QM(r)){if(n.has(r))return!0;n.add(r),r=r.f();continue}if(ud(r)){r=r.from;continue}break}if(XM(r))return Lu(r.to,t,n)||Lu(r.from,t,n);if(Ny(r))return r.types.some(o=>Lu(o,t,n));if(WM(r)){const o=[];for(const a of r.elements)o.push(a.type);for(const a of r.rest)o.push(a.type);return o.length===0?!0:o.some(a=>Lu(a,t,n))}if(GM(r)){const[o,...a]=t;for(const c of r.propertySignatures)if(String(c.name)===o)return Lu(c.type,a,n);for(const c of r.indexSignatures){let u=c.parameter;for(;ud(u);)u=u.from;const d=u?._tag;if(d==="StringKeyword"||d==="TemplateLiteral")return Lu(c.type,a,n)}return!1}const i=r?._tag;return i==="AnyKeyword"||i==="UnknownKeyword"||i==="ObjectKeyword"||i==="Declaration"},y0e=(e,t)=>{if(!t||t==="$root")return!0;const n=Qr(t);if(!n)return!1;const r=n[0]==="$root"?n.slice(1):n;return Lu(e,r)},b0e=e=>{if(e.kind==="fieldPath")return`- ${e.entryKind} "${e.entryFieldPath}" fieldPath="${e.path}"`;if(e.kind==="dep"){const t=e.ruleName?` rule="${e.ruleName}"`:"";return`- ${e.entryKind} "${e.entryFieldPath}" deps="${e.path}"${t}`}return e.kind==="link_from"?`- link "${e.entryFieldPath}" from="${e.path}"`:e.kind==="check_writeback"?`- check "${e.entryFieldPath}" writeback="${e.path}"`:`- ${e.entryKind} "${e.entryFieldPath}" path="${e.path}"`},v0e=(e,t)=>re(function*(){if(!dn())return;const n=yield*et(Jr);if(n==="off")return;const r=`${t.moduleId??"unknown"}::${t.instanceId}`;if(!(yield*pk(`schema_mismatch:${r}`)))return;const o=e.schemaPaths??[];if(o.length===0)return;const a=e.stateSchema.ast,c=[],u=new Set;for(const p of o){if(y0e(a,p.path))continue;const g=`${p.kind}|${p.entryKind}|${p.entryFieldPath}|${p.ruleName??""}|${p.path}`;u.has(g)||(u.add(g),c.push(p))}if(c.length===0)return;const d=n==="light"?8:24,h=c.slice(0,d).map(b0e);c.length>d&&h.push(`- …(+${c.length-d})`),yield*Ue({type:"diagnostic",moduleId:t.moduleId,instanceId:t.instanceId,code:"state_trait::schema_mismatch",severity:"warning",message:`[schema] The following paths are not declared in stateSchema (total ${c.length}):
41
+ ${h.join(`
42
+ `)}`,hint:"StateTrait writeback will create missing objects/fields. Declare all fieldPath/deps/link.from and errors.* writeback paths in stateSchema, or fix typos in trait paths.",kind:"schema_mismatch"})}),S0e=mo(!1);class AF{size;words;touchedWords;touchedFlags;touchedCount=0;constructor(t,n){const r=Math.max(0,Math.floor(t));this.size=r;const i=Math.ceil(r/32);this.words=new Uint32Array(i),n?.clearStrategy==="touched-words"?(this.touchedWords=new Uint32Array(i),this.touchedFlags=new Uint8Array(i)):(this.touchedWords=void 0,this.touchedFlags=void 0)}clear(){if(!this.touchedWords){this.words.fill(0);return}for(let t=0;t<this.touchedCount;t++){const n=this.touchedWords[t];this.words[n]=0,this.touchedFlags[n]=0}this.touchedCount=0}has(t){if(!(t>=0&&t<this.size))return!1;const n=t/32|0,r=t&31;return(this.words[n]&1<<r)!==0}add(t){if(!(t>=0&&t<this.size))return;const n=t/32|0,i=1<<(t&31),o=this.words[n];(o&i)===0&&(this.words[n]=o|i,this.touchedWords&&this.touchedFlags[n]!==1&&(this.touchedFlags[n]=1,this.touchedWords[this.touchedCount]=n,this.touchedCount+=1))}}const EW=e=>{const t=e.generation,n=e.fieldPathIdRegistry,r=n.fieldPaths,i=r.length,o=new Int32Array(i+1);let a=0;for(let R=0;R<i;R++)o[R]=a,a+=r[R]?.length??0;o[i]=a;const c=new Int32Array(a);for(let R=0;R<i;R++){const N=r[R];if(!N)continue;let L=n.root,B=o[R];for(const j of N){const $=L.children.get(j);if(!$)throw new Error(`[StateTrait.converge] Failed to resolve prefix trie node for pathId=${String(R)} seg=${j}`);L=$;const F=L.id;if(typeof F!="number")throw new Error(`[StateTrait.converge] Missing FieldPathId for prefix of pathId=${String(R)} seg=${j}`);c[B]=F,B+=1}}const u=Int32Array.from(e.topoOrder),d=e.stepsById.length,h=new Uint8Array(d);for(let R=0;R<d;R++)h[R]=e.stepSchedulingByStepId[R]==="deferred"?1:0;const p=[],g=[];for(const R of u)h[R]===1?g.push(R):p.push(R);const y=Int32Array.from(p),b=Int32Array.from(g),S=new Array(d),w=new Int32Array(d),x=new Int32Array(d);x.fill(-1);for(let R=0;R<d;R++){const N=e.stepsById[R];if(N?S[R]=N.kind==="computed"?`computed:${N.fieldPath}`:N.kind==="link"?`link:${N.fieldPath}`:N.fieldPath:S[R]=String(R),w[R]=e.stepOutFieldPathIdByStepId[R],N?.kind==="link"){const L=e.stepDepsFieldPathIdsByStepId[R];L&&L.length>0&&(x[R]=L[0])}}const I=new Int32Array(d+1);let _=0;for(let R=0;R<d;R++){I[R]=_;const N=e.stepDepsFieldPathIdsByStepId[R];_+=N?.length??0}I[d]=_;const M=new Int32Array(_);for(let R=0;R<d;R++){const N=e.stepDepsFieldPathIdsByStepId[R];if(!N||N.length===0)continue;let L=I[R];for(let B=0;B<N.length;B++)M[L]=N[B],L+=1}let C=!0;for(let R=0;R<d;R++){const N=w[R],L=r[N];if(!L||L.length!==1){C=!1;break}}const E=new Int32Array(i);for(let R=0;R<d;R++){const N=w[R];{const j=o[N],$=o[N+1];for(let F=j;F<$;F++){const K=c[F];E[K]=E[K]+1|0}}const L=I[R],B=I[R+1];for(let j=L;j<B;j++){const $=M[j],F=o[$],K=o[$+1];for(let W=F;W<K;W++){const X=c[W];E[X]=E[X]+1|0}}}const T=new Int32Array(i+1);let A=0;for(let R=0;R<i;R++)T[R]=A,A+=E[R];T[i]=A;const U=new Int32Array(A);for(let R=0;R<i;R++)E[R]=T[R];for(let R=0;R<d;R++){const N=w[R];{const j=o[N],$=o[N+1];for(let F=j;F<$;F++){const K=c[F],W=E[K];U[W]=R,E[K]=W+1}}const L=I[R],B=I[R+1];for(let j=L;j<B;j++){const $=M[j],F=o[$],K=o[$+1];for(let W=F;W<K;W++){const X=c[W],V=E[X];U[V]=R,E[X]=V+1}}}return{generation:t,fieldPathsById:r,prefixFieldPathIdsByPathId:c,prefixOffsetsByPathId:o,triggerStepIdsByFieldPathId:U,triggerStepOffsetsByFieldPathId:T,topoOrderInt32:u,topoOrderImmediateInt32:y,topoOrderDeferredInt32:b,stepSchedulingByStepId:h,stepLabelByStepId:S,stepOutFieldPathIdByStepId:w,stepFromFieldPathIdByStepId:x,allOutPathsShallow:C,stepDepsFieldPathIds:M,stepDepsOffsetsByStepId:I,scratch:{dirtyPrefixBitSet:new AF(i),reachableStepBitSet:new AF(d),dirtyPrefixQueue:new Int32Array(i),planStepIds:new Int32Array(d)}}},OF=e=>!e||typeof e!="object"?!1:Array.isArray(e)?!0:!(e instanceof Date||e instanceof RegExp||e instanceof Error||e instanceof Map||e instanceof Set||e instanceof WeakMap||e instanceof WeakSet),L1=e=>e==="__proto__"||e==="prototype"||e==="constructor",w0e=e=>{const t=Array.from(e).filter(i=>typeof i=="string"&&i.length>0);t.sort();const n=(i,o)=>o!==i&&o.startsWith(i+"."),r=[];for(const i of t){let o=!1;for(const a of t)if(n(i,a)){o=!0;break}o||r.push(i)}return r.sort(),r},DF=(e,t)=>e===t||t.startsWith(e+"."),pC=(e,t)=>{const n=Array.from(new Set(e)).filter(a=>typeof a=="string"&&a.length>0);n.sort();const r=Array.from(new Set(t)).filter(a=>typeof a=="string"&&a.length>0);r.sort();const i=r.filter(a=>n.every(c=>!DF(c,a))),o=n.filter(a=>r.every(c=>!DF(a,c)));if(!(i.length===0&&o.length===0))return{reads:r,declared:n,missing:i,unused:o}},mC=(e,t)=>{if(!OF(t))return{value:e(t),reads:[]};const n=new Set,r=new WeakMap,i=new WeakMap,o=(h,p)=>OF(h)?c(h,p):h,a=h=>{if(h&&(typeof h=="object"||typeof h=="function")){const p=i.get(h);if(p)return p}return h},c=(h,p)=>{let g=r.get(h);g||(g=new Map,r.set(h,g));const y=g.get(p);if(y)return y;const b=w=>{w&&n.add(w)},S=new Proxy(h,{get:(w,x,I)=>{if(typeof x=="symbol")return Reflect.get(w,x,I);const _=String(x);if(L1(_))return Reflect.get(w,x,I);const M=p?`${p}.${_}`:_;b(M);const C=Reflect.get(w,x,I);return o(C,M)},has:(w,x)=>{if(typeof x=="symbol")return Reflect.has(w,x);const I=String(x);if(!L1(I)){const _=p?`${p}.${I}`:I;b(_)}return Reflect.has(w,x)},ownKeys:w=>(p&&b(p),Reflect.ownKeys(w)),getOwnPropertyDescriptor:(w,x)=>{if(typeof x=="symbol")return Reflect.getOwnPropertyDescriptor(w,x);const I=String(x);if(!L1(I)){const _=p?`${p}.${I}`:I;b(_)}return Reflect.getOwnPropertyDescriptor(w,x)},set:()=>{throw new Error("[deps-trace] Attempted to mutate state during deps tracing (state is readonly in dev-mode diagnostics).")},defineProperty:()=>{throw new Error("[deps-trace] Attempted to define property on state during deps tracing (state is readonly in dev-mode diagnostics).")},deleteProperty:()=>{throw new Error("[deps-trace] Attempted to delete property on state during deps tracing (state is readonly in dev-mode diagnostics).")}});return g.set(p,S),i.set(S,h),S},u=c(t,"");return{value:a(e(u)),reads:w0e(n)}},x0e=()=>Ve(Uc).pipe(rt(e=>Ce(e)?e.value.stack:[])),TW=e=>e.kind==="computed"?"computed":e.kind==="link"?"link":void 0,k0e=e=>e.kind==="computed"?e.meta?.deps??[]:e.kind==="link"?[e.meta.from]:[],CW=(e,t,n)=>{if(e.kind==="computed"){const r=e.meta?.equals;return r?r(t,n):Object.is(t,n)}return Object.is(t,n)},_0e=(e,t,n,r,i)=>{const o=TW(i);if(!o)return!1;const a=o==="computed"?"trait-computed":"trait-link",c=o==="link"?i.meta.from:void 0,u=t.stepOutFieldPathIdByStepId[r],d=t.fieldPathsById[u],h=t.stepFromFieldPathIdByStepId[r],p=h>=0?t.fieldPathsById[h]:void 0,g=n.getRoot(),y=n.getAt(d);let b;if(o==="computed"){const w=i.meta.derive;b=w(g)}else{if(!p)throw new Error(`[StateTrait.converge] Missing link.from FieldPathId: from="${String(c)}"`);b=n.getAt(p)}return CW(i,y,b)?!1:(n.setAt(d,b,y),e.setDraft(n.getRoot()),e.recordPatch(u,a,y,b),!0)},$1=(e,t,n,r,i,o,a,c)=>{const u=e.moduleId,d=e.instanceId,h=i.fieldPath,p=TW(i);if(!p)return fn(!1);const g=p==="computed"?"trait-computed":"trait-link",y=p==="computed"?"trait-computed":"trait-link",b=p==="computed"?"computed:update":"link:propagate",S=k0e(i),w=p==="link"?i.meta.from:void 0,x=t.stepOutFieldPathIdByStepId[r],I=t.fieldPathsById[x],_=t.stepFromFieldPathIdByStepId[r],M=_>=0?t.fieldPathsById[_]:void 0;return re(function*(){const C=a==="off"?void 0:t.stepLabelByStepId[r]??String(r);let E=!1;if(p==="computed"&&o&&dn()){const R=`${u??"unknown"}::${d??"unknown"}::computed::${h}`;E=yield*pk(`deps_trace:settled:${R}`)}const T=Ye(()=>{const R=n.getRoot(),N=n.getAt(I);let L,B;if(p==="computed"){const $=i.meta.derive;if(E){const F=mC(K=>$(K),R);L=F.value,B=pC(i.meta.deps??[],F.reads)}else L=$(R)}else{if(!M)throw new Error(`[StateTrait.converge] Missing link.from FieldPathId: from="${String(w)}"`);L=n.getAt(M)}return CW(i,N,L)?{changed:!1,depsDiff:B}:(n.setAt(I,L,N),e.setDraft(n.getRoot()),e.recordPatch(x,g,N,L,void 0,r),{changed:!0,depsDiff:B})}).pipe($e(({changed:R,depsDiff:N})=>N&&p==="computed"?g0e({moduleId:u,instanceId:d,kind:"computed",fieldPath:h,diff:N}).pipe(vi(R)):fn(R))),A={moduleId:u,instanceId:d,txnSeq:e.txnSeq,txnId:e.txnId,fieldPath:h,deps:S,...p==="link"?{from:w,to:h}:null,...C?{stepId:C}:null};if(!(typeof A.opSeq=="number"&&Number.isFinite(A.opSeq))){const R=yield*Ve(Pa);if(Ce(R)){const N=d??"global";A.opSeq=R.value.local.nextSeq("opSeq",N)}}const U=hy({kind:y,name:b,effect:T,meta:A});return c.length===0?yield*T:yield*Yh(U,c)})},Fm=e=>{let t,n,r;for(const i of e){const o=i.durationMs;if(!t||o>t.durationMs){r=n,n=t,t=i;continue}if(!n||o>n.durationMs){r=n,n=i;continue}(!r||o>r.durationMs)&&(r=i)}return t?n?r?[t,n,r]:[t,n]:[t]:[]},PF=e=>{if(typeof e!="number"||!Number.isFinite(e))return;const t=Math.floor(e);return t>0?t:void 0},NF=e=>{const{hotspots:t,next:n,topK:r}=e;if(r<=0)return;const i=(()=>{for(let o=0;o<t.length;o++)if(n.durationMs>t[o].durationMs)return o;return t.length})();i>=r||(t.splice(i,0,n),t.length>r&&(t.length=r))},I0e=(e,t)=>re(function*(){yield*v0e(e,t);const n=t.now();let r,i=n;const o=t.getDraft(),a=t.requestedMode??"auto",c=[];let u=a==="dirty"?"dirty":"full";const d=e.convergeIr;if(!d)return{_tag:"Noop"};let h=e.convergeExecIr;if((!h||h.generation!==d.generation)&&(h=EW(d),e.convergeExecIr=h),d.configError)throw new hC(d.configError.code,d.configError.message,d.configError.fields);const p=d.stepsById??[],g=p.length;if(g===0)return{_tag:"Noop"};const y=yield*x0e(),b=yield*et(Jr),S=yield*et(po),w=S.length>0&&!cO(S),x=w,I=w&&b!=="off",_=yield*et(S0e);let M;if(b==="sampled"){const Le=yield*et(iW),se=PF(Le.sampleEveryN)??32,ve=PF(Le.topK)??3,Ie=t.txnSeq,Me=typeof Ie=="number"&&Number.isFinite(Ie)&&Ie>0?(Math.floor(Ie)-1)%se===0:!1;M={strategy:"txnSeq_interval",sampleEveryN:se,topK:ve,sampled:Me}}const C=w&&(b==="full"||M?.sampled===!0),E=b==="full"?3:M?.topK??3,T=C?[]:void 0,A=t.schedulingScope??"all",U=t.schedulingScopeStepIds??(A==="immediate"?h.topoOrderImmediateInt32:A==="deferred"?h.topoOrderDeferredInt32:h.topoOrderInt32),R=U.length,N=h.topoOrderImmediateInt32.length,L=h.topoOrderDeferredInt32.length,B=L>0?{scope:A,immediateStepCount:N,deferredStepCount:L}:void 0;L>0&&(A==="immediate"&&!c.includes("time_slicing_immediate")?c.push("time_slicing_immediate"):A==="deferred"&&!c.includes("time_slicing_deferred")&&c.push("time_slicing_deferred"));const j=Le=>w?Ue({type:"trace:trait:converge",moduleId:t.moduleId,instanceId:t.instanceId,txnSeq:t.txnSeq,txnId:t.txnId,data:Le}):ce,$=d.fieldPathIdRegistry,F=t.dirtyPaths==null?[]:(Array.isArray(t.dirtyPaths),t.dirtyPaths),K=Array.isArray(F)?F.length:typeof F?.size=="number"?F.size:void 0;let W;const X=3,V=1.05,z=128,Q=.5,q=t.configScope??"builtin",ie=t.generation??{generation:d.generation};ie.generation;const le=I?hw(d):"",ee=a==="auto"?t.decisionBudgetMs:void 0,J=t.cacheMissReasonHint;J==="generation_bumped"&&!c.includes("generation_bumped")&&c.push("generation_bumped");const ge=()=>typeof ee=="number"&&Number.isFinite(ee)&&ee>0&&t.now()-n>ee,te=()=>{c.includes("budget_cutoff")||c.push("budget_cutoff")},pe=h.prefixFieldPathIdsByPathId,oe=h.prefixOffsetsByPathId,ye=h.scratch.dirtyPrefixBitSet,xe=h.scratch.reachableStepBitSet,je=h.scratch.dirtyPrefixQueue,Ge=h.scratch.planStepIds,it=h.triggerStepIdsByFieldPathId,ut=h.triggerStepOffsetsByFieldPathId,Dt=Le=>{const se=oe[Le],ve=oe[Le+1];if(!(se==null||ve==null))for(let Ie=se;Ie<ve;Ie++)ye.add(pe[Ie])},Ct=Le=>{const se=oe[Le],ve=oe[Le+1];if(se==null||ve==null)return!1;for(let Ie=se;Ie<ve;Ie++)if(ye.has(pe[Ie]))return!0;return!1},wt=Le=>{const se=h.stepOutFieldPathIdByStepId[Le];if(typeof se=="number"&&Ct(se))return!0;const ve=h.stepDepsOffsetsByStepId[Le],Ie=h.stepDepsOffsetsByStepId[Le+1];if(ve==null||Ie==null)return!1;for(let Me=ve;Me<Ie;Me++)if(Ct(h.stepDepsFieldPathIds[Me]))return!0;return!1},Jn=(Le,se)=>{if(g<32||t.schedulingScopeStepIds!=null){ye.clear();for(let ze=0;ze<Le.length;ze++)Dt(Le[ze]);let at=0,_t=0;for(let ze=0;ze<U.length;ze++){const st=U[ze];if(se?.stopOnDecisionBudget&&(_t+=1,_t>=32&&(_t=0,ge())))return ye.clear(),{budgetCutoff:!0};wt(st)&&(Ge[at]=st,at+=1,Dt(h.stepOutFieldPathIdByStepId[st]))}const Rt=_?Ge.subarray(0,at):new Int32Array(at);return!_&&at>0&&Rt.set(Ge.subarray(0,at)),ye.clear(),{plan:Rt}}ye.clear(),xe.clear();let ve=0;const Ie=at=>{const _t=oe[at],Rt=oe[at+1];if(!(_t==null||Rt==null))for(let ze=_t;ze<Rt;ze++){const st=pe[ze];ye.has(st)||(ye.add(st),je[ve]=st,ve+=1)}};for(let at=0;at<Le.length;at++)Ie(Le[at]);const Me=at=>{if(A==="all")return!0;const _t=h.stepSchedulingByStepId[at];return A==="immediate"?_t===0:_t===1};let Je=0,ot=0;for(;Je<ve;){if(se?.stopOnDecisionBudget&&(ot+=1,ot>=32&&(ot=0,ge())))return ye.clear(),{budgetCutoff:!0};const at=je[Je];Je+=1;const _t=ut[at],Rt=ut[at+1];if(!(_t==null||Rt==null))for(let ze=_t;ze<Rt;ze++){const st=it[ze];Me(st)&&(xe.has(st)||(xe.add(st),Ie(h.stepOutFieldPathIdByStepId[st])))}}let Ae=0;for(let at=0;at<U.length;at++){const _t=U[at];xe.has(_t)&&(Ge[Ae]=_t,Ae+=1)}const Mt=_?Ge.subarray(0,Ae):new Int32Array(Ae);return!_&&Ae>0&&Mt.set(Ge.subarray(0,Ae)),ye.clear(),{plan:Mt}},yt=t.planCache;J==="generation_bumped"&&typeof ie.generationBumpCount=="number"&&ie.generationBumpCount>=3&&yt&&!yt.isDisabled()&&yt.disable("generation_thrash");let pn=!1,$t=0,On;const he=()=>{if(W)return W;W=yW({dirtyPaths:F,registry:$,dirtyAllReason:t.dirtyAllReason});const Le=!W.dirtyAll&&R>0?W.rootCount/R:void 0,se=!W.dirtyAll&&W.rootIds.length>0&&W.rootIds.length<=z&&(Le==null||Le<=Q);return pn=!!yt&&!yt.isDisabled()&&t.schedulingScopeStepIds==null&&se,$t=W.keyHash^(A==="all"?0:A==="immediate"?1:2),On=pn?W.rootIds:void 0,W};let _e=I?{capacity:0,size:0,hits:0,misses:0,evicts:0,hit:!1}:void 0,Pe,Ke;const dt=Le=>{const se=he();if(se.dirtyAll){_e&&yt&&(_e=yt.evidence({hit:!1,keySize:se.keySize,missReason:Le?.missReason??"unknown"}));const Me=U;return Pe=Me.length,{plan:Me,hit:!1}}if(pn&&yt&&On){const Me=yt.get($t,On);if(Me)return _e&&(_e=yt.evidence({hit:!0,keySize:se.keySize})),Pe=Me.length,{plan:Me,hit:!0}}if(Le?.stopOnDecisionBudget&&g>=32&&ge()){_e&&yt&&(_e=yt.evidence({hit:!1,keySize:se.keySize,missReason:Le?.missReason??"unknown"}));const Me=U;return Pe=Me.length,pn&&yt&&On&&yt.set($t,On,Me),{plan:Me,hit:!1,budgetCutoff:!0}}const ve=Jn(se.rootIds,{stopOnDecisionBudget:Le?.stopOnDecisionBudget});if(ve.budgetCutoff){_e&&yt&&(_e=yt.evidence({hit:!1,keySize:se.keySize,missReason:Le?.missReason??"unknown"}));const Me=U;return Pe=Me.length,pn&&yt&&On&&yt.set($t,On,Me),{plan:Me,hit:!1,budgetCutoff:!0}}const Ie=ve.plan??new Int32Array(0);return pn&&yt&&On&&yt.set($t,On,_?Ie.slice():Ie),_e&&yt&&(_e=yt.evidence({hit:!1,keySize:se.keySize,missReason:Le?.missReason??"not_cached"})),Pe=Ie.length,{plan:Ie,hit:!1}},tn=Le=>Le>=1536?.65:Le>=1024?.7:Le>=512?.75:.9,Fn=.9;if(a==="auto")if(t.txnSeq===1)u="full",c.push("cold_start");else if(t.dirtyAllReason)u="full",c.push("dirty_all"),c.push("unknown_write");else if(K===0)u="full",c.push("unknown_write");else{const Le=tn(R),se=typeof K=="number"&&Number.isFinite(K)&&K>=0?R>0?K/R:1:void 0;if(se!=null&&se>=Le)u="full",c.push("near_full");else{const ve=he();if(ve.dirtyAll)u="full",c.push("dirty_all"),c.push("unknown_write");else if(ve.rootIds.length===0)u="full",c.push("unknown_write");else if((R>0?ve.rootCount/R:1)>=Le)u="full",c.push("near_full");else{const{plan:Ie,hit:Me,budgetCutoff:Je}=dt({missReason:J??"not_cached",stopOnDecisionBudget:ee!=null});Je&&te(),Ie?(Ke=Ie,c.push(Me?"cache_hit":"cache_miss"),(R>0?Ie.length/R:1)>=Fn?(u="full",c.push("near_full")):u="dirty"):u="dirty"}}}else{c.push("module_override");const Le=he();if(u==="dirty"){const{plan:se,hit:ve}=dt({missReason:J??"not_cached"});Ke=se,Le.dirtyAll?c.push("dirty_all"):yt&&Le.rootIds.length>0&&c.push(ve?"cache_hit":"cache_miss")}}_e?.disabled&&_e.disableReason==="low_hit_rate"&&!c.includes("low_hit_rate_protection")&&c.push("low_hit_rate_protection");const mn=()=>{if(!x)return;const Le=b==="light"||b==="full"||a==="dirty"||u==="dirty"||W!=null,se=Le&&W==null&&(b==="light"||b==="full")?he():W;return se?.dirtyAll?{dirtyAll:!0,reason:se.reason??"unknownWrite",rootCount:0,...Le?{rootIds:[],rootIdsTruncated:!1}:null}:se?{dirtyAll:!1,rootCount:se.rootCount,...Le?{rootIds:se.rootIds.slice(0,X),rootIdsTruncated:se.rootIds.length>X}:null}:typeof K=="number"&&K===0?{dirtyAll:!0,reason:"unknownWrite",rootCount:0}:typeof K=="number"?{dirtyAll:!1,rootCount:K}:{dirtyAll:!0,reason:"unknownWrite",rootCount:0,...Le?{rootIds:[],rootIdsTruncated:!1}:null}};i=t.now(),a==="auto"&&(r=Math.max(0,i-n));let Qe=0;const Ne=Le=>{const se={totalSteps:g,executedSteps:Le.executedSteps,skippedSteps:Math.max(0,g-Le.executedSteps),changedSteps:Qe,...typeof Pe=="number"?{affectedSteps:Pe}:null},ve={requestedMode:a,executedMode:u,outcome:Le.outcome,configScope:q,staticIrDigest:le,executionBudgetMs:t.budgetMs,executionDurationMs:Le.executionDurationMs,decisionBudgetMs:a==="auto"?t.decisionBudgetMs:void 0,decisionDurationMs:a==="auto"?r:void 0,reasons:c,stepStats:se};if(!x)return ve;if(!I){const Me=mn();return{...ve,dirty:Me}}const Ie=mn();return{...ve,thresholds:{floorRatio:V},dirty:Ie,cache:_e,generation:ie,staticIr:{fieldPathCount:d.fieldPaths.length,stepCount:g,buildDurationMs:d.buildDurationMs},...B?{timeSlicing:B}:{},...M?{diagnosticsSampling:M}:{},...T&&T.length>0?{top3:T.slice()}:{}}},He=b==="full"?[]:void 0;let kt=0;const Dn=t.allowInPlaceDraft===!0&&h.allOutPathsShallow?new MF(o):new m0e(o);let vo=0;const Yo=u==="dirty"?he():void 0,Zr=()=>{Dn instanceof MF&&Dn.rollback(),t.setDraft(o)};try{let Le;if(u==="dirty"&&!Ke&&Yo&&!Yo.dirtyAll){ye.clear();const ve=Yo.rootIds;for(let Ie=0;Ie<ve.length;Ie++)Dt(ve[Ie]);Le=ye}const se=u==="dirty"&&Ke?Ke:U;for(let ve=0;ve<se.length;ve++){const Ie=se[ve],Me=p[Ie];if(!Me)continue;const Je=Me.fieldPath;if(He){if(t.now()-i>t.budgetMs){Zr();const Ae=Math.max(0,t.now()-i),Mt=Fm(He),at={mode:u,budgetMs:t.budgetMs,totalDurationMs:Ae,totalSteps:g,executedSteps:kt,skippedSteps:Math.max(0,g-kt),changedSteps:Qe,top3:Mt};c.includes("budget_cutoff")||c.push("budget_cutoff");const _t=Ne({outcome:"Degraded",executedSteps:kt,executionDurationMs:Ae});return _t&&b!=="off"&&(yield*j(_t)),{_tag:"Degraded",reason:"budget_exceeded",summary:at,..._t?{decision:_t}:null}}}else if(vo+=1,vo>=32&&(vo=0,t.now()-i>t.budgetMs)){Zr(),c.includes("budget_cutoff")||c.push("budget_cutoff");const Ae=Math.max(0,t.now()-i),Mt=w?Ne({outcome:"Degraded",executedSteps:kt,executionDurationMs:Ae}):void 0;return Mt&&b!=="off"&&(yield*j(Mt)),{_tag:"Degraded",reason:"budget_exceeded",...Mt?{decision:Mt}:null}}if(u==="dirty"&&Le&&!wt(Ie))continue;if(kt+=1,He){const Ae=t.now(),Mt=yield*en($1(t,h,Dn,Ie,Me,w,b,y)),at=t.now(),_t=Math.max(0,at-Ae),Rt=Me.kind==="computed"?"computed":"link",ze=h.stepLabelByStepId[Ie]??String(Ie),st=Mt._tag==="Success"?Mt.value:!1;if(T&&NF({hotspots:T,topK:E,next:{kind:Rt,stepId:Ie,outFieldPathId:h.stepOutFieldPathIdByStepId[Ie],durationMs:_t,changed:st}}),He.push({stepId:ze,kind:Rt,fieldPath:Je,durationMs:_t,changed:st}),Mt._tag==="Failure"){const sn=Fo(Mt.cause);Zr();const _n=Math.max(0,t.now()-i),ji=Fm(He),Cr={mode:u,budgetMs:t.budgetMs,totalDurationMs:_n,totalSteps:g,executedSteps:kt,skippedSteps:Math.max(0,g-kt),changedSteps:Qe,top3:ji},zn=Ne({outcome:"Degraded",executedSteps:kt,executionDurationMs:_n});return zn&&b!=="off"&&(yield*j(zn)),{_tag:"Degraded",reason:"runtime_error",errorSummary:sn.errorSummary,errorDowngrade:sn.downgrade,summary:Cr,...zn?{decision:zn}:null}}Mt.value&&(Qe+=1,u==="dirty"&&Le&&Dt(h.stepOutFieldPathIdByStepId[Ie]));continue}if(T){const Ae=t.now(),Mt=yield*en($1(t,h,Dn,Ie,Me,w,b,y)),at=t.now(),_t=Math.max(0,at-Ae),Rt=Me.kind==="computed"?"computed":"link",ze=Mt._tag==="Success"?Mt.value:!1;if(NF({hotspots:T,topK:E,next:{kind:Rt,stepId:Ie,outFieldPathId:h.stepOutFieldPathIdByStepId[Ie],durationMs:_t,changed:ze}}),Mt._tag==="Failure"){const st=Fo(Mt.cause);Zr();const sn=Math.max(0,t.now()-i),_n=Ne({outcome:"Degraded",executedSteps:kt,executionDurationMs:sn});return _n&&b!=="off"&&(yield*j(_n)),{_tag:"Degraded",reason:"runtime_error",errorSummary:st.errorSummary,errorDowngrade:st.downgrade,..._n?{decision:_n}:null}}ze&&(Qe+=1,u==="dirty"&&Le&&Dt(h.stepOutFieldPathIdByStepId[Ie]));continue}if(b==="off"&&y.length===0){try{_0e(t,h,Dn,Ie,Me)&&(Qe+=1,u==="dirty"&&Le&&Dt(h.stepOutFieldPathIdByStepId[Ie]))}catch(Ae){const Mt=Fo(Ae);Zr();const at=Math.max(0,t.now()-i),_t=w?Ne({outcome:"Degraded",executedSteps:kt,executionDurationMs:at}):void 0;return _t&&b!=="off"&&(yield*j(_t)),{_tag:"Degraded",reason:"runtime_error",errorSummary:Mt.errorSummary,errorDowngrade:Mt.downgrade,..._t?{decision:_t}:null}}continue}const ot=yield*en($1(t,h,Dn,Ie,Me,w,b,y));if(ot._tag==="Failure"){const Ae=Fo(ot.cause);Zr();const Mt=Math.max(0,t.now()-i),at=w?Ne({outcome:"Degraded",executedSteps:kt,executionDurationMs:Mt}):void 0;return at&&b!=="off"&&(yield*j(at)),{_tag:"Degraded",reason:"runtime_error",errorSummary:Ae.errorSummary,errorDowngrade:Ae.downgrade,...at?{decision:at}:null}}ot.value&&(Qe+=1,u==="dirty"&&Le&&Dt(h.stepOutFieldPathIdByStepId[Ie]))}}catch(Le){if(Le instanceof hC)throw Le;const se=Fo(Le);Zr();const ve=Math.max(0,t.now()-i),Ie=He?{mode:u,budgetMs:t.budgetMs,totalDurationMs:ve,totalSteps:g,executedSteps:kt,skippedSteps:Math.max(0,g-kt),changedSteps:Qe,top3:Fm(He)}:void 0,Me=w?Ne({outcome:"Degraded",executedSteps:kt,executionDurationMs:ve}):void 0;return Me&&b!=="off"&&(yield*j(Me)),{_tag:"Degraded",reason:"runtime_error",errorSummary:se.errorSummary,errorDowngrade:se.downgrade,...Ie?{summary:Ie}:null,...Me?{decision:Me}:null}}const $i=Math.max(0,t.now()-i),Es=Qe>0?"Converged":"Noop",ci=w?Ne({outcome:Es,executedSteps:kt,executionDurationMs:$i}):void 0;return ci&&b!=="off"&&(yield*j(ci)),Qe>0?{_tag:"Converged",patchCount:Qe,...He?{summary:{mode:u,budgetMs:t.budgetMs,totalDurationMs:$i,totalSteps:g,executedSteps:kt,skippedSteps:Math.max(0,g-kt),changedSteps:Qe,top3:Fm(He)}}:null,...ci?{decision:ci}:null}:{_tag:"Noop",...He?{summary:{mode:u,budgetMs:t.budgetMs,totalDurationMs:$i,totalSteps:g,executedSteps:kt,skippedSteps:Math.max(0,g-kt),changedSteps:Qe,top3:Fm(He)}}:null,...ci?{decision:ci}:null}}),Sr={Remove:"remove",Replace:"replace",Add:"add"},MW=Symbol.for("__MUTATIVE_PROXY_DRAFT__"),E0e=Symbol("__MUTATIVE_RAW_RETURN_SYMBOL__"),c0=Symbol.iterator,Uo={mutable:"mutable",immutable:"immutable"},yO={};function Ig(e,t){return e instanceof Map?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function LF(e,t){if(t in e){let n=Reflect.getPrototypeOf(e);for(;n;){const r=Reflect.getOwnPropertyDescriptor(n,t);if(r)return r;n=Reflect.getPrototypeOf(n)}}}function bO(e){return Object.getPrototypeOf(e)===Set.prototype}function vO(e){return Object.getPrototypeOf(e)===Map.prototype}function Po(e){var t;return(t=e.copy)!==null&&t!==void 0?t:e.original}function Hc(e){return!!Kt(e)}function Kt(e){return typeof e!="object"?null:e?.[MW]}function SO(e){var t;const n=Kt(e);return n?(t=n.copy)!==null&&t!==void 0?t:n.original:e}function ea(e,t){if(!e||typeof e!="object")return!1;let n;return Object.getPrototypeOf(e)===Object.prototype||Array.isArray(e)||e instanceof Map||e instanceof Set||!!t?.mark&&((n=t.mark(e,Uo))===Uo.immutable||typeof n=="function")}function RW(e,t=[]){if(Object.hasOwnProperty.call(e,"key")){const n=e.parent.copy,r=Kt(Al(n,e.key));if(r!==null&&r?.original!==e.original)return null;const i=e.parent.type===3,o=i?Array.from(e.parent.setMap.keys()).indexOf(e.key):e.key;if(!(i&&n.size>o||Ig(n,o)))return null;t.push(o)}if(e.parent)return RW(e.parent,t);t.reverse();try{T0e(e.copy,t)}catch{return null}return t}function Xd(e){return Array.isArray(e)?1:e instanceof Map?2:e instanceof Set?3:0}function Al(e,t){return Xd(e)===2?e.get(t):e[t]}function bb(e,t,n){Xd(e)===2?e.set(t,n):e[t]=n}function j1(e,t){const n=Kt(e);return(n?Po(n):e)[t]}function wl(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}function gC(e){if(e)for(;e.finalities.revoke.length>0;)e.finalities.revoke.pop()()}function Uu(e,t){return t?e:[""].concat(e).map(n=>{const r=`${n}`;return r.indexOf("/")===-1&&r.indexOf("~")===-1?r:r.replace(/~/g,"~0").replace(/\//g,"~1")}).join("/")}function T0e(e,t){for(let n=0;n<t.length-1;n+=1){const r=t[n];if(e=Al(Xd(e)===3?Array.from(e):e,r),typeof e!="object")throw new Error(`Cannot resolve patch at '${t.join("/")}'.`)}return e}function C0e(e){const t=Object.create(Object.getPrototypeOf(e));return Reflect.ownKeys(e).forEach(n=>{let r=Reflect.getOwnPropertyDescriptor(e,n);if(r.enumerable&&r.configurable&&r.writable){t[n]=e[n];return}r.writable||(r.writable=!0,r.configurable=!0),(r.get||r.set)&&(r={configurable:!0,writable:!0,enumerable:r.enumerable,value:e[n]}),Reflect.defineProperty(t,n,r)}),t}const M0e=Object.prototype.propertyIsEnumerable;function AW(e,t){let n;if(Array.isArray(e))return Array.prototype.concat.call(e);if(e instanceof Set){if(!bO(e)){const r=Object.getPrototypeOf(e).constructor;return new r(e.values())}return Set.prototype.difference?Set.prototype.difference.call(e,new Set):new Set(e.values())}else if(e instanceof Map){if(!vO(e)){const r=Object.getPrototypeOf(e).constructor;return new r(e)}return new Map(e)}else if(t?.mark&&(n=t.mark(e,Uo),n!==void 0)&&n!==Uo.mutable){if(n===Uo.immutable)return C0e(e);if(typeof n=="function"){if(t.enablePatches||t.enableAutoFreeze)throw new Error("You can't use mark and patches or auto freeze together.");return n()}throw new Error(`Unsupported mark result: ${n}`)}else if(typeof e=="object"&&Object.getPrototypeOf(e)===Object.prototype){const r={};return Object.keys(e).forEach(i=>{r[i]=e[i]}),Object.getOwnPropertySymbols(e).forEach(i=>{M0e.call(e,i)&&(r[i]=e[i])}),r}else throw new Error("Please check mark() to ensure that it is a stable marker draftable function.")}function Vi(e){e.copy||(e.copy=AW(e.original,e.options))}function ig(e){if(!ea(e))return SO(e);if(Array.isArray(e))return e.map(ig);if(e instanceof Map){const n=Array.from(e.entries()).map(([r,i])=>[r,ig(i)]);if(!vO(e)){const r=Object.getPrototypeOf(e).constructor;return new r(n)}return new Map(n)}if(e instanceof Set){const n=Array.from(e).map(ig);if(!bO(e)){const r=Object.getPrototypeOf(e).constructor;return new r(n)}return new Set(n)}const t=Object.create(Object.getPrototypeOf(e));for(const n in e)t[n]=ig(e[n]);return t}function u0(e){return Hc(e)?ig(e):e}function Ta(e){var t;e.assignedMap=(t=e.assignedMap)!==null&&t!==void 0?t:new Map,e.operated||(e.operated=!0,e.parent&&Ta(e.parent))}function $F(){throw new Error("Cannot modify frozen object")}function Jf(e,t,n,r,i){{n=n??new WeakMap,r=r??[],i=i??[];const a=n.has(e)?n.get(e):e;if(r.length>0){const c=r.indexOf(a);if(a&&typeof a=="object"&&c!==-1)throw r[0]===a?new Error("Forbids circular reference"):new Error(`Forbids circular reference: ~/${i.slice(0,c).map((u,d)=>{if(typeof u=="symbol")return`[${u.toString()}]`;const h=r[d];return typeof u=="object"&&(h instanceof Map||h instanceof Set)?Array.from(h.keys()).indexOf(u):u}).join("/")}`);r.push(a),i.push(t)}else r.push(a)}if(Object.isFrozen(e)||Hc(e)){r.pop(),i.pop();return}switch(Xd(e)){case 2:for(const[c,u]of e)Jf(c,c,n,r,i),Jf(u,c,n,r,i);e.set=e.clear=e.delete=$F;break;case 3:for(const c of e)Jf(c,c,n,r,i);e.add=e.clear=e.delete=$F;break;case 1:Object.freeze(e);let a=0;for(const c of e)Jf(c,a,n,r,i),a+=1;break;default:Object.freeze(e),Object.keys(e).forEach(c=>{const u=e[c];Jf(u,c,n,r,i)})}r.pop(),i.pop()}function wO(e,t){const n=Xd(e);if(n===0)Reflect.ownKeys(e).forEach(r=>{t(r,e[r],e)});else if(n===1){let r=0;for(const i of e)t(r,i,e),r+=1}else e.forEach((r,i)=>t(i,r,e))}function OW(e,t,n){if(Hc(e)||!ea(e,n)||t.has(e)||Object.isFrozen(e))return;const r=e instanceof Set,i=r?new Map:void 0;if(t.add(e),wO(e,(o,a)=>{var c;if(Hc(a)){const u=Kt(a);Vi(u);const d=!((c=u.assignedMap)===null||c===void 0)&&c.size||u.operated?u.copy:u.original;bb(r?i:e,o,d)}else OW(a,t,n)}),i){const o=e,a=Array.from(o);o.clear(),a.forEach(c=>{o.add(i.has(c)?i.get(c):c)})}}function R0e(e,t){const n=e.type===3?e.setMap:e.copy;e.finalities.revoke.length>1&&e.assignedMap.get(t)&&n&&OW(Al(n,t),e.finalities.handledSet,e.options)}function yC(e){e.type===3&&e.copy&&(e.copy.clear(),e.setMap.forEach(t=>{e.copy.add(SO(t))}))}function bC(e,t,n,r){if(e.operated&&e.assignedMap&&e.assignedMap.size>0&&!e.finalized){if(n&&r){const o=RW(e);o&&t(e,o,n,r)}e.finalized=!0}}function xO(e,t,n,r){const i=Kt(n);i&&(i.callbacks||(i.callbacks=[]),i.callbacks.push((o,a)=>{var c;const u=e.type===3?e.setMap:e.copy;if(wl(Al(u,t),n)){let d=i.original;i.copy&&(d=i.copy),yC(e),bC(e,r,o,a),e.options.enableAutoFreeze&&(e.options.updatedValues=(c=e.options.updatedValues)!==null&&c!==void 0?c:new WeakMap,e.options.updatedValues.set(d,i.original)),bb(u,t,d)}}),e.options.enableAutoFreeze&&i.finalities!==e.finalities&&(e.options.enableAutoFreeze=!1)),ea(n,e.options)&&e.finalities.draft.push(()=>{const o=e.type===3?e.setMap:e.copy;wl(Al(o,t),n)&&R0e(e,t)})}function A0e(e,t,n,r,i){let{original:o,assignedMap:a,options:c}=e,u=e.copy;u.length<o.length&&([o,u]=[u,o],[n,r]=[r,n]);for(let d=0;d<o.length;d+=1)if(a.get(d.toString())&&u[d]!==o[d]){const h=t.concat([d]),p=Uu(h,i);n.push({op:Sr.Replace,path:p,value:u0(u[d])}),r.push({op:Sr.Replace,path:p,value:u0(o[d])})}for(let d=o.length;d<u.length;d+=1){const h=t.concat([d]),p=Uu(h,i);n.push({op:Sr.Add,path:p,value:u0(u[d])})}if(o.length<u.length){const{arrayLengthAssignment:d=!0}=c.enablePatches;if(d){const h=t.concat(["length"]),p=Uu(h,i);r.push({op:Sr.Replace,path:p,value:o.length})}else for(let h=u.length;o.length<h;h-=1){const p=t.concat([h-1]),g=Uu(p,i);r.push({op:Sr.Remove,path:g})}}}function O0e({original:e,copy:t,assignedMap:n},r,i,o,a){n.forEach((c,u)=>{const d=Al(e,u),h=u0(Al(t,u)),p=c?Ig(e,u)?Sr.Replace:Sr.Add:Sr.Remove;if(wl(d,h)&&p===Sr.Replace)return;const g=r.concat(u),y=Uu(g,a);i.push(p===Sr.Remove?{op:p,path:y}:{op:p,path:y,value:h}),o.push(p===Sr.Add?{op:Sr.Remove,path:y}:p===Sr.Remove?{op:Sr.Add,path:y,value:d}:{op:Sr.Replace,path:y,value:d})})}function D0e({original:e,copy:t},n,r,i,o){let a=0;e.forEach(c=>{if(!t.has(c)){const u=n.concat([a]),d=Uu(u,o);r.push({op:Sr.Remove,path:d,value:c}),i.unshift({op:Sr.Add,path:d,value:c})}a+=1}),a=0,t.forEach(c=>{if(!e.has(c)){const u=n.concat([a]),d=Uu(u,o);r.push({op:Sr.Add,path:d,value:c}),i.unshift({op:Sr.Remove,path:d,value:c})}a+=1})}function py(e,t,n,r){const{pathAsArray:i=!0}=e.options.enablePatches;switch(e.type){case 0:case 2:return O0e(e,t,n,r,i);case 1:return A0e(e,t,n,r,i);case 3:return D0e(e,t,n,r,i)}}const pw=(e,t,n=!1)=>{if(typeof e=="object"&&e!==null&&(!ea(e,t)||n))throw new Error("Strict mode: Mutable data cannot be accessed directly, please use 'unsafe(callback)' wrap.")},vC={get size(){return Po(Kt(this)).size},has(e){return Po(Kt(this)).has(e)},set(e,t){const n=Kt(this),r=Po(n);return(!r.has(e)||!wl(r.get(e),t))&&(Vi(n),Ta(n),n.assignedMap.set(e,!0),n.copy.set(e,t),xO(n,e,t,py)),this},delete(e){if(!this.has(e))return!1;const t=Kt(this);return Vi(t),Ta(t),t.original.has(e)?t.assignedMap.set(e,!1):t.assignedMap.delete(e),t.copy.delete(e),!0},clear(){const e=Kt(this);if(this.size){Vi(e),Ta(e),e.assignedMap=new Map;for(const[t]of e.original)e.assignedMap.set(t,!1);e.copy.clear()}},forEach(e,t){const n=Kt(this);Po(n).forEach((r,i)=>{e.call(t,this.get(i),i,this)})},get(e){var t,n;const r=Kt(this),i=Po(r).get(e),o=((n=(t=r.options).mark)===null||n===void 0?void 0:n.call(t,i,Uo))===Uo.mutable;if(r.options.strict&&pw(i,r.options,o),o||r.finalized||!ea(i,r.options)||i!==r.original.get(e))return i;const a=yO.createDraft({original:i,parentDraft:r,key:e,finalities:r.finalities,options:r.options});return Vi(r),r.copy.set(e,a),a},keys(){return Po(Kt(this)).keys()},values(){const e=this.keys();return{[c0]:()=>this.values(),next:()=>{const t=e.next();return t.done?t:{done:!1,value:this.get(t.value)}}}},entries(){const e=this.keys();return{[c0]:()=>this.entries(),next:()=>{const t=e.next();if(t.done)return t;const n=this.get(t.value);return{done:!1,value:[t.value,n]}}}},[c0](){return this.entries()}},P0e=Reflect.ownKeys(vC),jF=(e,t,{isValuesIterator:n})=>()=>{var r,i;const o=t.next();if(o.done)return o;const a=o.value;let c=e.setMap.get(a);const u=Kt(c),d=((i=(r=e.options).mark)===null||i===void 0?void 0:i.call(r,c,Uo))===Uo.mutable;if(e.options.strict&&pw(a,e.options,d),!d&&!u&&ea(a,e.options)&&!e.finalized&&e.original.has(a)){const h=yO.createDraft({original:a,parentDraft:e,key:a,finalities:e.finalities,options:e.options});e.setMap.set(a,h),c=h}else u&&(c=u.proxy);return{done:!1,value:n?c:[c,c]}},mw={get size(){return Kt(this).setMap.size},has(e){const t=Kt(this);if(t.setMap.has(e))return!0;Vi(t);const n=Kt(e);return!!(n&&t.setMap.has(n.original))},add(e){const t=Kt(this);return this.has(e)||(Vi(t),Ta(t),t.assignedMap.set(e,!0),t.setMap.set(e,e),xO(t,e,e,py)),this},delete(e){if(!this.has(e))return!1;const t=Kt(this);Vi(t),Ta(t);const n=Kt(e);return n&&t.setMap.has(n.original)?(t.assignedMap.set(n.original,!1),t.setMap.delete(n.original)):(!n&&t.setMap.has(e)?t.assignedMap.set(e,!1):t.assignedMap.delete(e),t.setMap.delete(e))},clear(){if(!this.size)return;const e=Kt(this);Vi(e),Ta(e);for(const t of e.original)e.assignedMap.set(t,!1);e.setMap.clear()},values(){const e=Kt(this);Vi(e);const t=e.setMap.keys();return{[Symbol.iterator]:()=>this.values(),next:jF(e,t,{isValuesIterator:!0})}},entries(){const e=Kt(this);Vi(e);const t=e.setMap.keys();return{[Symbol.iterator]:()=>this.entries(),next:jF(e,t,{isValuesIterator:!1})}},keys(){return this.values()},[c0](){return this.values()},forEach(e,t){const n=this.values();let r=n.next();for(;!r.done;)e.call(t,r.value,r.value,this),r=n.next()}};Set.prototype.difference&&Object.assign(mw,{intersection(e){return Set.prototype.intersection.call(new Set(this.values()),e)},union(e){return Set.prototype.union.call(new Set(this.values()),e)},difference(e){return Set.prototype.difference.call(new Set(this.values()),e)},symmetricDifference(e){return Set.prototype.symmetricDifference.call(new Set(this.values()),e)},isSubsetOf(e){return Set.prototype.isSubsetOf.call(new Set(this.values()),e)},isSupersetOf(e){return Set.prototype.isSupersetOf.call(new Set(this.values()),e)},isDisjointFrom(e){return Set.prototype.isDisjointFrom.call(new Set(this.values()),e)}});const N0e=Reflect.ownKeys(mw),DW={get(e,t,n){var r,i;const o=(r=e.copy)===null||r===void 0?void 0:r[t];if(o&&e.finalities.draftsCache.has(o))return o;if(t===MW)return e;let a;if(e.options.mark){const d=t==="size"&&(e.original instanceof Map||e.original instanceof Set)?Reflect.get(e.original,t):Reflect.get(e.original,t,n);if(a=e.options.mark(d,Uo),a===Uo.mutable)return e.options.strict&&pw(d,e.options,!0),d}const c=Po(e);if(c instanceof Map&&P0e.includes(t))return t==="size"?Object.getOwnPropertyDescriptor(vC,"size").get.call(e.proxy):vC[t].bind(e.proxy);if(c instanceof Set&&N0e.includes(t))return t==="size"?Object.getOwnPropertyDescriptor(mw,"size").get.call(e.proxy):mw[t].bind(e.proxy);if(!Ig(c,t)){const d=LF(c,t);return d?"value"in d?d.value:(i=d.get)===null||i===void 0?void 0:i.call(e.proxy):void 0}const u=c[t];if(e.options.strict&&pw(u,e.options),e.finalized||!ea(u,e.options))return u;if(u===j1(e.original,t)){if(Vi(e),e.copy[t]=kO({original:e.original[t],parentDraft:e,key:e.type===1?Number(t):t,finalities:e.finalities,options:e.options}),typeof a=="function"){const d=Kt(e.copy[t]);return Vi(d),Ta(d),d.copy}return e.copy[t]}return Hc(u)&&e.finalities.draftsCache.add(u),u},set(e,t,n){var r;if(e.type===3||e.type===2)throw new Error("Map/Set draft does not support any property assignment.");let i;if(e.type===1&&t!=="length"&&!(Number.isInteger(i=Number(t))&&i>=0&&(t===0||i===0||String(i)===String(t))))throw new Error("Only supports setting array indices and the 'length' property.");const o=LF(Po(e),t);if(o?.set)return o.set.call(e.proxy,n),!0;const a=j1(Po(e),t),c=Kt(a);return c&&wl(c.original,n)?(e.copy[t]=n,e.assignedMap=(r=e.assignedMap)!==null&&r!==void 0?r:new Map,e.assignedMap.set(t,!1),!0):(wl(n,a)&&(n!==void 0||Ig(e.original,t))||(Vi(e),Ta(e),Ig(e.original,t)&&wl(n,e.original[t])?e.assignedMap.delete(t):e.assignedMap.set(t,!0),e.copy[t]=n,xO(e,t,n,py)),!0)},has(e,t){return t in Po(e)},ownKeys(e){return Reflect.ownKeys(Po(e))},getOwnPropertyDescriptor(e,t){const n=Po(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r&&{writable:!0,configurable:e.type!==1||t!=="length",enumerable:r.enumerable,value:n[t]}},getPrototypeOf(e){return Reflect.getPrototypeOf(e.original)},setPrototypeOf(){throw new Error("Cannot call 'setPrototypeOf()' on drafts")},defineProperty(){throw new Error("Cannot call 'defineProperty()' on drafts")},deleteProperty(e,t){var n;return e.type===1?DW.set.call(this,e,t,void 0,e.proxy):(j1(e.original,t)!==void 0||t in e.original?(Vi(e),Ta(e),e.assignedMap.set(t,!1)):(e.assignedMap=(n=e.assignedMap)!==null&&n!==void 0?n:new Map,e.assignedMap.delete(t)),e.copy&&delete e.copy[t],!0)}};function kO(e){const{original:t,parentDraft:n,key:r,finalities:i,options:o}=e,a=Xd(t),c={type:a,finalized:!1,parent:n,original:t,copy:null,proxy:null,finalities:i,options:o,setMap:a===3?new Map(t.entries()):void 0};(r||"key"in e)&&(c.key=r);const{proxy:u,revoke:d}=Proxy.revocable(a===1?Object.assign([],c):c,DW);if(i.revoke.push(d),c.proxy=u,n){const h=n;h.finalities.draft.push((p,g)=>{var y,b;const S=Kt(u);let w=h.type===3?h.setMap:h.copy;const x=Al(w,r),I=Kt(x);if(I){let _=I.original;I.operated&&(_=SO(x)),yC(I),bC(I,py,p,g),h.options.enableAutoFreeze&&(h.options.updatedValues=(y=h.options.updatedValues)!==null&&y!==void 0?y:new WeakMap,h.options.updatedValues.set(_,I.original)),bb(w,r,_)}(b=S.callbacks)===null||b===void 0||b.forEach(_=>{_(p,g)})})}else{const h=Kt(u);h.finalities.draft.push((p,g)=>{yC(h),bC(h,py,p,g)})}return u}yO.createDraft=kO;function L0e(e,t,n,r,i){var o;const a=Kt(e),c=(o=a?.original)!==null&&o!==void 0?o:e,u=!!t.length;if(a?.operated)for(;a.finalities.draft.length>0;)a.finalities.draft.pop()(n,r);const d=u?t[0]:a?a.operated?a.copy:a.original:e;return a&&gC(a),i&&Jf(d,d,a?.options.updatedValues),[d,n&&u?[{op:Sr.Replace,path:[],value:t[0]}]:n,r&&u?[{op:Sr.Replace,path:[],value:c}]:r]}function $0e(e,t){var n;const r={draft:[],revoke:[],handledSet:new WeakSet,draftsCache:new WeakSet};let i,o;t.enablePatches&&(i=[],o=[]);const c=((n=t.mark)===null||n===void 0?void 0:n.call(t,e,Uo))===Uo.mutable||!ea(e,t)?e:kO({original:e,parentDraft:null,finalities:r,options:t});return[c,(u=[])=>{const[d,h,p]=L0e(c,u,i,o,t.enableAutoFreeze);return t.enablePatches?[d,h,p]:d}]}function SC(e){const{rootDraft:t,value:n,useRawReturn:r=!1,isRoot:i=!0}=e;wO(n,(o,a,c)=>{const u=Kt(a);if(u&&t&&u.finalities===t.finalities){e.isContainDraft=!0;const d=u.original;if(c instanceof Set){const h=Array.from(c);c.clear(),h.forEach(p=>c.add(o===p?d:p))}else bb(c,o,d)}else typeof a=="object"&&a!==null&&(e.value=a,e.isRoot=!1,SC(e))}),i&&(e.isContainDraft||console.warn("The return value does not contain any draft, please use 'rawReturn()' to wrap the return value to improve performance."),r&&console.warn("The return value contains drafts, please don't use 'rawReturn()' to wrap the return value."))}function PW(e){var t;const n=Kt(e);if(!ea(e,n?.options))return e;const r=Xd(e);if(n&&!n.operated)return n.original;let i;function o(){i=r===2?vO(e)?new Map(e):new(Object.getPrototypeOf(e)).constructor(e):r===3?Array.from(n.setMap.values()):AW(e,n?.options)}if(n){n.finalized=!0;try{o()}finally{n.finalized=!1}}else i=e;if(wO(i,(a,c)=>{if(n&&wl(Al(n.original,a),c))return;const u=PW(c);u!==c&&(i===e&&o(),bb(i,a,u))}),r===3){const a=(t=n?.original)!==null&&t!==void 0?t:i;return bO(a)?new Set(i):new(Object.getPrototypeOf(a)).constructor(i)}return i}function FF(e){if(!Hc(e))throw new Error(`current() is only used for Draft, parameter: ${e}`);return PW(e)}const j0e=e=>function t(n,r,i){var o,a,c;if(typeof n=="function"&&typeof r!="function")return function(C,...E){return t(C,T=>n.call(this,T,...E),r)};const u=n,d=r;let h=i;if(typeof r!="function"&&(h=r),h!==void 0&&Object.prototype.toString.call(h)!=="[object Object]")throw new Error(`Invalid options: ${h}, 'options' should be an object.`);h=Object.assign(Object.assign({},e),h);const p=Hc(u)?FF(u):u,g=Array.isArray(h.mark)?((C,E)=>{for(const T of h.mark){if(typeof T!="function")throw new Error(`Invalid mark: ${T}, 'mark' should be a function.`);const A=T(C,E);if(A)return A}}):h.mark,y=(o=h.enablePatches)!==null&&o!==void 0?o:!1,b=(a=h.strict)!==null&&a!==void 0?a:!1,w={enableAutoFreeze:(c=h.enableAutoFreeze)!==null&&c!==void 0?c:!1,mark:g,strict:b,enablePatches:y};if(!ea(p,w)&&typeof p=="object"&&p!==null)throw new Error("Invalid base state: create() only supports plain objects, arrays, Set, Map or using mark() to mark the state as immutable.");const[x,I]=$0e(p,w);if(typeof r!="function"){if(!ea(p,w))throw new Error("Invalid base state: create() only supports plain objects, arrays, Set, Map or using mark() to mark the state as immutable.");return[x,I]}let _;try{_=d(x)}catch(C){throw gC(Kt(x)),C}const M=C=>{const E=Kt(x);if(!Hc(C)){if(C!==void 0&&!wl(C,x)&&E?.operated)throw new Error("Either the value is returned as a new non-draft value, or only the draft is modified without returning any value.");const A=C?.[E0e];if(A){const U=A[0];return w.strict&&typeof C=="object"&&C!==null&&SC({rootDraft:E,value:C,useRawReturn:!0}),I([U])}if(C!==void 0)return typeof C=="object"&&C!==null&&SC({rootDraft:E,value:C}),I([C])}if(C===x||C===void 0)return I([]);const T=Kt(C);if(w===T.options){if(T.operated)throw new Error("Cannot return a modified child draft.");return I([FF(C)])}return I([C])};return _ instanceof Promise?_.then(M,C=>{throw gC(Kt(x)),C}):M(_)},Qh=j0e();Object.prototype.constructor.toString();const F0e=e=>{const t=new Map;for(const n of e.graph.edges){const r=t.get(n.from)??[];r.push(n.to),t.set(n.from,r)}return{_tag:"StateTraitDependencyGraph",reverseAdj:t}},z0e=(e,t)=>{const n=new Set,r=[t];for(;r.length;){const i=r.shift();if(!i)break;if(n.has(i))continue;n.add(i);const o=e.reverseAdj.get(i);if(o)for(const a of o)r.push(a)}return n},rd=Symbol.for("logix.state-trait.validate.skip"),_O=e=>e?e.split(".").map(t=>/^[0-9]+$/.test(t)?Number(t):t):[],cs=(e,t)=>{if(!t||e==null)return e;const n=_O(t);let r=e;for(const i of n){if(r==null)return;r=r[i]}return r},B0e=(e,t,n)=>{if(!t)return;const r=_O(t);if(r.length===0)return;let i=e;for(let a=0;a<r.length-1;a++){const c=r[a],u=r[a+1],d=i[c];(d==null||typeof d!="object")&&(i[c]=typeof u=="number"?[]:{}),i=i[c]}const o=r[r.length-1];i[o]=n},q0e=(e,t)=>{if(!t)return;const n=_O(t);if(n.length===0)return;let r=e;for(let o=0;o<n.length-1;o++){const a=n[o],c=r[a];if(c==null||typeof c!="object")return;r=c}const i=n[n.length-1];if(Array.isArray(r)&&typeof i=="number"){r[i]=void 0;return}r&&typeof r=="object"&&delete r[i]},qi=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),Vs=e=>e??void 0,U0e=e=>{if(e.length!==0){if(e.length===1)return e[0];if(e.every(qi)){const t={};for(const n of e)for(const r of Object.keys(n)){const i=Vs(n[r]);i!==void 0&&(r in t||(t[r]=i))}return Object.keys(t).length>0?t:void 0}return e[0]}},V0e=e=>{if(!e||typeof e!="object"||Array.isArray(e))return!1;const t=e,n=t.message;if(typeof n!="string"||n.length===0)return!1;for(const i of Object.keys(t))if(i!=="message"&&i!=="code"&&i!=="details")return!1;const r=t.code;return!(r!==void 0&&(typeof r!="string"||r.length===0))},gw=e=>{if(e==null)return 0;if(typeof e=="string")return e.length>0?1:0;if(Array.isArray(e))return e.reduce((t,n)=>t+gw(n),0);if(typeof e=="object"){if(V0e(e))return 1;let t=0;for(const[n,r]of Object.entries(e))n!=="$rowId"&&(t+=gw(r));return t}return 1},zF=(()=>{const e=globalThis.performance;return e&&typeof e.now=="function"?()=>e.now():()=>Date.now()})(),K0e=e=>e==="set"||e==="unset"||e==="insert"||e==="remove",NW=e=>Qr(e)??["$root"],H0e=(e,t)=>{if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0},W0e=(e,t)=>{const n=e?.details,r=qi(n)?n:void 0,i=r&&typeof r._tag=="string"?r._tag:void 0,o=e?.kind&&e.kind.length>0?e.kind:"unknown",a=i&&i.length>0?`${o}:${i}`:e?.name&&e.name.length>0?`${o}:${e.name}`:o,c=r?.op,u=K0e(c)?c:"set",d=r&&typeof r.path=="string"?r.path:void 0,h=NW(d??t);return{kind:a,path:h,op:u}},G0e=e=>e.trackBy?"trackBy":e.rowIdStore?"store":"index",Y0e=(e,t,n)=>{if(n!=="trackBy"&&e.op==="set"&&H0e(e.path,t))return{kind:"rowId:degraded:no_trackBy_root_replace",message:"list root was replaced without trackBy; rowId stability is degraded"}},Q0e=(e,t)=>{if(!qi(t))return e;const n=e?{...e}:{};for(const r of Object.keys(t)){const i=Vs(t[r]);i!==void 0&&(r in n||(n[r]=i))}return Object.keys(n).length>0?n:void 0},X0e=(e,t)=>{const n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(const i of n)if(!Object.prototype.hasOwnProperty.call(t,i)||!Object.is(e[i],t[i]))return!1;return!0},wC=(e,t)=>{if(!e||typeof e!="object")return[];const n=e.deps;if(!Array.isArray(n))return[];const r=`${t}[].`,i=[];for(const o of n)if(typeof o=="string"){if(o.startsWith(r)){const a=o.slice(r.length);a&&i.push(a);continue}o.length>0&&!o.includes(".")&&!o.includes("[")&&!o.includes("]")&&i.push(o)}return Array.from(new Set(i)).sort()},J0e=(e,t,n,r)=>{const i=e.meta.rules,o=Object.keys(i).sort();let a,c,u,d=!1,h=!1;const p=new Set,g=n.scope.listPath??n.scope.fieldPath,y=S=>{c||(c=[]);const w=Math.max(c.length,S.length);c.length<w&&(c.length=w);for(let x=0;x<S.length;x++){const I=Q0e(c[x],S[x]);c[x]=I}},b=(S,w,x,I)=>{if(w.length===0||x<=0)return{affectedRows:0,changedRows:0,setCount:0,clearedCount:0};let _=0,M=0,C=0,E=0;for(let T=0;T<x;T++){const A=cs(r?.trace?.errorsRoot,`${S}.rows.${T}`),U=qi(A)?A:void 0,R=I?.[T],N=qi(R)?R:void 0;let L=!1,B=!1,j=!1;for(const $ of w){const F=Vs(U?.[$]),K=Vs(N?.[$]);F!==void 0&&(L=!0),K!==void 0&&(B=!0),!Object.is(F,K)&&(j=!0,K===void 0?F!==void 0&&(E+=1):C+=1)}(L||B)&&(_+=1),j&&(M+=1)}return{affectedRows:_,changedRows:M,setCount:C,clearedCount:E}};for(const S of o){const w=i[S],x=r?.trace?.listPath&&r?.trace?.errorsRoot,I=x?zF():0;try{const _=typeof w=="function"?w(t,n):w&&typeof w=="object"?w.validate(t,n):void 0;if(_===rd)continue;d=!0;for(const C of wC(w,g))p.add(C);if(x){const C=r.trace.listPath,E=r.trace.errorsBasePath,T=wC(w,C),A=Array.isArray(t)?t.length:0,U=Array.isArray(_)?_:qi(_)&&Array.isArray(_.rows)?_.rows:void 0,R=b(E,T,A,U),N=Math.max(0,zF()-I);u||(u=[]),u.push({ruleId:`${e.fieldPath}#${S}`,summary:{scannedRows:A,affectedRows:R.affectedRows,changedRows:R.changedRows,setCount:R.setCount,clearedCount:R.clearedCount,durationMs:N}})}if(_===void 0)continue;if(Array.isArray(_)){y(_);continue}if(qi(_)){const C=_.rows,E=Object.prototype.hasOwnProperty.call(_,"$list");E&&(h=!0);const T=Vs(_.$list);if(T!==void 0&&a===void 0&&(a=T),Array.isArray(C))y(C);else if(!E&&T===void 0){const A=Vs(_);A!==void 0&&a===void 0&&(a=A),h=!0}continue}const M=Vs(_);M!==void 0&&a===void 0&&(a=M),h=!0}catch{}}return d?{listError:a,rows:c,traces:u,touchedKeys:p,touchedListError:h}:rd},BF=e=>{if(!e)return e;const t=e.split(".").filter(Boolean),n=[];for(const r of t){if(/^[0-9]+$/.test(r)){if(n.length===0)continue;const i=n[n.length-1];i.endsWith("[]")||(n[n.length-1]=`${i}[]`);continue}n.push(r)}return n.join(".")},Z0e=e=>{if(e.kind==="root")return[];if(e.kind==="field")return[BF(e.path)];if(e.kind==="list")return[e.path,`${e.path}[]`];const t=`${e.path}[]`,n=e.field?BF(e.field):void 0;return[n?`${t}.${n}`:t]},xC=e=>{if(!Array.isArray(e)||e.length===0)return[];const t=[];for(const n of e)!Number.isInteger(n)||n<0||t.push(n);return t},yw=(e,t)=>{const n=xC(t);return n.length===0?`${e}@@`:`${e}@@${n.join(",")}`},ewe=e=>{const t=new Map;for(const n of e){if(n.target.kind!=="item")continue;const r=yw(n.target.path,n.target.listIndexPath),i=t.get(r)??new Set;i.add(n.target.index),t.set(r,i)}return t},twe=e=>{const t=new Set,n=new Set;for(const r of e)if(r.target.kind==="list"&&r.target.path){if(r.target.listIndexPath&&r.target.listIndexPath.length>0){n.add(yw(r.target.path,r.target.listIndexPath));continue}t.add(r.target.path)}return{all:t,instances:n}},nwe=e=>{const t={submit:4,blur:3,valueChange:2,manual:1};let n="manual",r=t[n];for(const i of e){const o=t[i.mode];o>r&&(r=o,n=i.mode)}return n},rwe=(e,t,n)=>{const r=e.meta.rules,i=Object.keys(r).sort(),o=[];let a=!1;for(const c of i){const u=r[c];try{const d=typeof u=="function"?u(t,n):u&&typeof u=="object"?u.validate(t,n):void 0;if(d===rd)continue;a=!0;const h=Vs(d);h!==void 0&&o.push(h)}catch{}}return a?U0e(o):rd},iwe=(e,t,n)=>re(function*(){const i=(yield*et(Jr))!=="off",o=i?[]:void 0;yield*Ye(()=>{if(n.length===0)return;const a=e.entries.filter(z=>z.kind==="check");if(a.length===0)return;const c=n.some(z=>z.target.kind==="root"),u=t.getDraft(),d=(()=>{if(c)return new Set(a.map(q=>q.fieldPath));const z=F0e(e),Q=new Set;for(const q of n)for(const ie of Z0e(q.target))for(const le of z0e(z,ie))Q.add(le);return Q})(),h=a.filter(z=>d.has(z.fieldPath));if(h.length===0)return;const p=nwe(n);i&&o&&o.push({type:"trace:trait:validate",moduleId:t.moduleId,instanceId:t.instanceId,txnSeq:t.txnSeq,txnId:t.txnId,data:{mode:p,requestCount:n.length,selectedCheckCount:h.length,hasRoot:c}});const g=ewe(n),y=twe(n),b=y.all,S=y.instances,w=(()=>{const z=new Map;for(const Q of n){if(Q.target.kind!=="item"&&Q.target.kind!=="list")continue;const q=yw(Q.target.path,Q.target.listIndexPath);z.set(q,xC(Q.target.listIndexPath))}return z})(),x=[],I=(()=>{const z=new Map,Q=t.listConfigs??[];for(const q of Q)!q||typeof q.path!="string"||z.set(q.path,q);return z})(),_=(z,Q)=>{if(!z||typeof z!="object")return;const q=Q.split(".");let ie=z;for(const le of q){if(ie==null)return;ie=ie[le]}return ie},M=(z,Q)=>Q===void 0?`check:${z}`:`check:${z}@${Q}`,C=Array.from(I.keys()),E=new Set(C),T=z=>{const Q=z.split(".").filter(Boolean);let q;for(let ie=1;ie<Q.length;ie++){const le=Q.slice(0,ie).join(".");E.has(le)&&(q=le)}return q},A=new Map,U=new Map;for(const z of C){const Q=T(z);A.set(z,Q);const q=Q?z.slice(Q.length+1):z;U.set(z,q)}const R=(z,Q)=>{const q=xC(Q);let ie=0,le=A.get(z);for(;le;)ie+=1,le=A.get(le);if(ie===0)return[];if(q.length===ie)return q},N=new Map,L=(z,Q)=>{const q=A.get(z),ie=q?`${z}@@#${Q.join(",")}`:`${z}@@root`,le=N.get(ie);if(le)return le;const ee=I.get(z),J=ee&&typeof ee.trackBy=="string"?ee.trackBy:void 0;if(!q){const Ct=cs(u,z),wt=Array.isArray(Ct)?Ct:[],Jn=t.rowIdStore?t.rowIdStore.ensureList(z,wt,J):void 0,yt={listPath:z,listIndexPath:[],valuePath:z,errorBasePath:`errors.${z}`,items:wt,trackBy:J,rowIds:Jn};return N.set(ie,yt),yt}if(Q.length===0)return;const ge=Q.slice(0,-1),te=Q[Q.length-1],pe=L(q,ge);if(!pe||te<0||te>=pe.items.length)return;const oe=U.get(z)??"";if(!oe)return;const ye=`${pe.valuePath}.${te}.${oe}`,xe=`${pe.errorBasePath}.rows.${te}.${oe}`,je=cs(u,ye),Ge=Array.isArray(je)?je:[],it=pe.rowIds?.[te]??(t.rowIdStore?t.rowIdStore.getRowId(q,te,pe.parentRowId):void 0),ut=t.rowIdStore?t.rowIdStore.ensureList(z,Ge,J,it):void 0,Dt={listPath:z,listIndexPath:Q,valuePath:ye,errorBasePath:xe,parentRowId:it,items:Ge,trackBy:J,rowIds:ut};return N.set(ie,Dt),Dt},B=z=>{const Q=A.get(z);if(!Q){const le=L(z,[]);return le?[le]:[]}const q=B(Q),ie=[];for(const le of q)for(let ee=0;ee<le.items.length;ee++){const J=[...le.listIndexPath,ee],ge=L(z,J);ge&&ie.push(ge)}return ie},j=new Map,$=(z,Q,q)=>{const ie=`${z.errorBasePath}.rows.${Q}`,le=j.get(ie);if(le)return le;const ee=cs(u,ie),J=qi(ee)?{...ee}:{},ge={listPath:z.listPath,listIndexPath:z.listIndexPath,parentRowId:z.parentRowId,index:Q,errorBasePath:z.errorBasePath,errorPath:ie,prev:ee,next:J,stepId:q,removed:!1};return j.set(ie,ge),ge},F=(z,Q,q)=>{if(Q.size===0)return;const ie=q?Object.keys(q):[],le=Object.keys(z.next).filter(J=>J!=="$rowId"),ee=new Set;for(const J of le)Q.has(J)&&ee.add(J);for(const J of ie)Q.has(J)&&ee.add(J);if(ee.size!==0)for(const J of ee){const ge=Vs(q?.[J]);ge===void 0?delete z.next[J]:z.next[J]=ge}};for(const z of h){const Q=z.fieldPath;if(I.get(Q)){const te=Q,pe=(()=>{if(c||b.has(te))return B(te);const oe=new Set;for(const xe of S)xe.startsWith(`${te}@@`)&&oe.add(xe);for(const xe of g.keys())xe.startsWith(`${te}@@`)&&oe.add(xe);if(oe.size===0)return B(te);const ye=[];for(const xe of oe){const je=w.get(xe),Ge=R(te,je);if(!Ge)continue;const it=L(te,Ge);it&&ye.push(it)}return ye})();for(const oe of pe){const ye=oe.items,xe=i?W0e(t.origin,te):void 0,je=i?NW(te):void 0,Ge=i?G0e({trackBy:oe.trackBy,rowIdStore:t.rowIdStore}):void 0,it=i&&xe&&je&&Ge?Y0e(xe,je,Ge):void 0,ut=J0e(z,ye,{mode:p,state:u,scope:{fieldPath:Q,listPath:te,listIndexPath:oe.listIndexPath}},i?{trace:{listPath:te,errorsBasePath:oe.errorBasePath,errorsRoot:u}}:void 0);if(ut===rd)continue;const Dt=ut.touchedKeys;if(i&&o&&xe&&je&&Ge&&ut.traces&&ut.traces.length>0)for(const he of ut.traces){const _e={ruleId:he.ruleId,scopeFieldPath:je,mode:p,trigger:xe,summary:he.summary,rowIdMode:Ge};it&&(_e.degraded=it),o.push({type:"trace:trait:check",moduleId:t.moduleId,instanceId:t.instanceId,txnSeq:t.txnSeq,txnId:t.txnId,data:_e})}const Ct=`${oe.errorBasePath}.$list`,wt=cs(u,Ct),Jn=Vs(ut.listError);ut.touchedListError&&!Object.is(wt,Jn)&&x.push({errorPath:Ct,prev:wt,next:Jn,stepId:M(Q)});const yt=ut.rows??[],pn=cs(u,`${oe.errorBasePath}.rows`),$t=Array.isArray(pn)?pn.length:0,On=Math.max(ye.length,yt.length,$t);for(let he=0;he<On;he++){const _e=`${oe.errorBasePath}.rows.${he}`,Pe=j.get(_e);if(he>=ye.length){if((Pe?.prev??cs(u,_e))===void 0&&!Pe)continue;const He=Pe??$(oe,he,M(Q,he));He.removed=!0;for(const kt of Object.keys(He.next))delete He.next[kt];continue}const Ke=yt[he],dt=qi(Ke)?Ke:void 0;if(Pe){F(Pe,Dt,dt);continue}if(dt&&Object.keys(dt).some(Ne=>Dt.has(Ne))){const Ne=$(oe,he,M(Q,he));F(Ne,Dt,dt);continue}const Fn=cs(u,_e),mn=qi(Fn)&&Object.keys(Fn).some(Ne=>Ne!=="$rowId"&&Dt.has(Ne)),Qe=qi(Fn)&&Object.keys(Fn).length===1&&Object.keys(Fn)[0]==="$rowId";if(mn||Qe){const Ne=$(oe,he,M(Q,he));F(Ne,Dt,void 0)}}}continue}if(Q.endsWith("[]")){const te=Q.slice(0,-2),pe=(()=>{if(c||b.has(te))return B(te);const xe=new Set;for(const Ge of S)Ge.startsWith(`${te}@@`)&&xe.add(Ge);for(const Ge of g.keys())Ge.startsWith(`${te}@@`)&&xe.add(Ge);if(xe.size===0)return B(te);const je=[];for(const Ge of xe){const it=w.get(Ge),ut=R(te,it);if(!ut)continue;const Dt=L(te,ut);Dt&&je.push(Dt)}return je})(),oe=z.meta.rules,ye=Object.keys(oe).sort();for(const xe of pe){const je=yw(te,xe.listIndexPath),Ge=c||b.has(te)||S.has(je)?xe.items.map((it,ut)=>ut):Array.from(g.get(je)??[]);if(Ge.length!==0)for(const it of Ge){if(it<0||it>=xe.items.length)continue;const ut=`${xe.valuePath}.${it}`,Dt=cs(u,ut),Ct=`${xe.errorBasePath}.rows.${it}`,wt=cs(u,Ct),Jn=qi(wt)?wt:void 0,yt=qi(wt)&&Object.keys(wt).length===1&&Object.keys(wt)[0]==="$rowId";let pn,$t;const On={mode:p,state:u,scope:{fieldPath:Q,listPath:te,listIndexPath:xe.listIndexPath,index:it}},he=()=>pn||(pn=$(xe,it,M(Q,it)),pn);for(const _e of ye){const Pe=oe[_e];try{const Ke=typeof Pe=="function"?Pe(Dt,On):Pe&&typeof Pe=="object"?Pe.validate(Dt,On):void 0;if(Ke===rd)continue;const dt=wC(Pe,te);if(dt.length===0)continue;const tn=qi(Ke)?Ke:void 0,Fn=tn&&Object.keys(tn).some(Ne=>Ne!=="$rowId"&&dt.includes(Ne)),mn=Jn&&Object.keys(Jn).some(Ne=>Ne!=="$rowId"&&dt.includes(Ne));if(!pn&&!Fn&&!mn&&!yt)continue;const Qe=he();for(const Ne of dt){if(Ne==="$rowId"||$t?.has(Ne))continue;const He=Vs(tn?.[Ne]);He===void 0?delete Qe.next[Ne]:(Qe.next[Ne]=He,$t||($t=new Set),$t.add(Ne))}}catch{}}}}continue}const ie=Q==="$root"?u:cs(u,Q),le=rwe(z,ie,{mode:p,state:u,scope:{fieldPath:Q}});if(le===rd)continue;const J=(()=>{const te=z?.meta?.writeback,pe=te&&typeof te=="object"?te.path:void 0;return typeof pe=="string"&&pe.startsWith("errors.")?pe:void 0})()??`errors.${Q}`,ge=cs(u,J);Object.is(ge,le)||x.push({errorPath:J,prev:ge,next:le,stepId:M(Q)})}for(const z of j.values()){const Q=z.prev,q=(()=>{if(z.removed||(delete z.next.$rowId,Object.keys(z.next).filter(te=>te!=="$rowId").length===0))return;const le=L(z.listPath,z.listIndexPath),ee=le?.items[z.index],ge={$rowId:(()=>{if(le?.trackBy){const pe=_(ee,le.trackBy);if(pe!==void 0)return String(pe)}const te=le?.rowIds?.[z.index]??t.rowIdStore?.getRowId(z.listPath,z.index,z.parentRowId);return typeof te=="string"&&te.length>0?te:String(z.index)})(),...z.next};return qi(Q)&&X0e(Q,ge)?Q:ge})();Object.is(Q,q)||x.push({errorPath:z.errorPath,prev:Q,next:q,stepId:z.stepId})}if(x.length===0)return;const K="unknown",W=u&&typeof u=="object"&&u.$form&&typeof u.$form=="object"&&!Array.isArray(u.$form)&&typeof u.$form.errorCount=="number"?u.$form.errorCount:void 0,X=W===void 0?0:x.reduce((z,Q)=>z+(gw(Q.next)-gw(Q.prev)),0),V=Qh(u,z=>{for(const Q of x)Q.next===void 0?q0e(z,Q.errorPath):B0e(z,Q.errorPath,Q.next);if(W!==void 0&&X!==0){const Q=z.$form;Q&&typeof Q=="object"&&!Array.isArray(Q)&&(Q.errorCount=Math.max(0,W+X))}});t.setDraft(V);for(const z of x){const Q=Qr(z.errorPath)??[];t.recordPatch(Q,K,z.prev,z.next)}}),o&&o.length>0&&(yield*ln(o,a=>Ue(a),{discard:!0}))}),owe=e=>{const t=new WeakSet,n=r=>{if(r===null)return null;if(typeof r=="string"||typeof r=="number"||typeof r=="boolean")return r;if(typeof r=="bigint")return r.toString();if(typeof r>"u")return"__undefined__";if(typeof r=="symbol")return`__symbol__:${String(r)}`;if(typeof r=="function")return"__function__";if(Array.isArray(r))return r.map(i=>n(i));if(r instanceof Date)return`__date__:${r.toISOString()}`;if(r instanceof Error)return{_tag:"Error",name:r.name,message:r.message};if(r&&typeof r=="object"){const i=r;if(t.has(i))return"__cycle__";t.add(i);const o=r,a=Object.keys(o).sort(),c={};for(const u of a)c[u]=n(o[u]);return c}return String(r)};try{return JSON.stringify(n(e))}catch{return String(e)}},qF=e=>owe(e),us={idle:()=>({status:"idle",keyHash:void 0,data:void 0,error:void 0}),loading:e=>({status:"loading",keyHash:e.keyHash,data:void 0,error:void 0}),success:e=>({status:"success",keyHash:e.keyHash,data:e.data,error:void 0}),error:e=>({status:"error",keyHash:e.keyHash,data:void 0,error:e.error})};class swe extends Yt("@logixjs/core/ResourceRegistry")(){}const UF={ResourceRegistryTag:swe};class bw extends Yt("@logixjs/core/ReplayLog")(){}re(function*(){return yield*(yield*bw).snapshot});re(function*(){yield*(yield*bw).resetCursor});const LW=e=>e?e.split(".").map(t=>/^[0-9]+$/.test(t)?Number(t):t):[],co=(e,t)=>{if(!t||e==null)return e;const n=LW(t);let r=e;for(const i of n){if(r==null)return;if(typeof i=="number"){r=Array.isArray(r)?r[i]:r[String(i)];continue}r=r[i]}return r},Rd=(e,t,n)=>{if(!t)return;const r=LW(t);if(r.length===0)return;let i=e;for(let a=0;a<r.length-1;a++){const c=r[a],u=r[a+1],d=i?.[c];(d==null||typeof d!="object")&&(i[c]=typeof u=="number"?[]:{}),i=i[c]}const o=r[r.length-1];i[o]=n},$W=e=>{const t=typeof e=="string"?e.trim():"";if(!t)return;const n=t.split(".").filter(Boolean);let r=-1;for(let c=0;c<n.length;c++)n[c].endsWith("[]")&&(r=c);if(r<0)return;const i=c=>c.endsWith("[]")?c.slice(0,-2):c,o=n.slice(0,r+1).map(i).join("."),a=n.slice(r+1).map(i).join(".");return{listPath:o,itemPath:a}},og=(e,t,n)=>n?`${e}.${t}.${n}`:`${e}.${t}`,vw=(e,t)=>{if(!e||typeof e!="object")return;const n=t.split(".");let r=e;for(const i of n){if(r==null)return;r=r[i]}return r},VF=(e,t)=>{const n=new Map;for(let r=0;r<e.length;r++){const i=e[r],o=n.get(i)??[];o.push(r),n.set(i,o)}for(let r=0;r<t.length;r++){const i=t[r],o=n.get(i);if(!o||o.length===0)continue;if(o.shift()!==r)return!0}return!1},KF=(e,t)=>e.every(n=>vw(n,t)!==void 0),awe=(e,t,n)=>{if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++)if(!Object.is(vw(e[r],n),vw(t[r],n)))return!1;return!0},lwe=(e,t,n,r)=>{const i=r??(()=>{let h=0;return()=>(h+=1,`r${h}`)})();if(!e)return{ids:t.map(()=>i()),removed:[]};if(e.itemsRef===t)return{ids:e.ids,removed:[]};if(e.itemsRef.length===t.length){if(n){if(KF(e.itemsRef,n)&&KF(t,n)){if(awe(e.itemsRef,t,n))return{ids:e.ids,removed:[]}}else if(!VF(e.itemsRef,t))return{ids:e.ids,removed:[]}}else if(!VF(e.itemsRef,t))return{ids:e.ids,removed:[]}}const a=h=>{if(!n)return h;const p=vw(h,n);return p!==void 0?p:h},c=new Map;for(let h=0;h<e.itemsRef.length;h++){const p=a(e.itemsRef[h]),g=c.get(p)??[];g.push(e.ids[h]),c.set(p,g)}const u=[];for(let h=0;h<t.length;h++){const p=a(t[h]),g=c.get(p);g&&g.length>0?u.push(g.shift()):u.push(i())}const d=[];for(const h of c.values())d.push(...h);return{ids:u,removed:d}},cwe=e=>{const t=new Map;for(let n=0;n<e.length;n++)t.set(e[n],n);return t};class uwe{constructor(t){this.instanceId=t}lists=new Map;removalListeners=new Map;rowIdIndex=new Map;nextRowSeq=0;listKey=(t,n)=>n?`${t}@@${n}`:t;makeRowId=()=>(this.nextRowSeq+=1,this.instanceId?`${this.instanceId}::r${this.nextRowSeq}`:`r${this.nextRowSeq}`);notifyRemoved(t,n){const r=this.removalListeners.get(t);if(!(!r||r.size===0))for(const i of r)try{i(n)}catch{}}removeDescendants(t){const n=[];for(const[r,i]of this.lists.entries())i.parentRowId===t&&n.push(r);for(const r of n){const i=this.lists.get(r);if(i){this.lists.delete(r);for(let o=0;o<i.ids.length;o++){const a=i.ids[o];this.rowIdIndex.delete(a),this.notifyRemoved(i.listPath,a),this.removeDescendants(a)}}}}onRemoved(t,n){const r=this.removalListeners.get(t)??new Set;return r.add(n),this.removalListeners.set(t,r),()=>{const i=this.removalListeners.get(t);i&&(i.delete(n),i.size===0&&this.removalListeners.delete(t))}}getRowId(t,n,r){const i=this.lists.get(this.listKey(t,r));return i?i.ids[n]:void 0}getIndex(t,n){const r=this.rowIdIndex.get(n);if(r&&r.listPath===t)return r.index}ensureList(t,n,r,i){const o=this.listKey(t,i),a=this.lists.get(o),{ids:c,removed:u}=lwe(a,n,r??a?.trackBy,this.makeRowId),d={listPath:t,parentRowId:i,itemsRef:n,ids:c,indexById:cwe(c),trackBy:r??a?.trackBy};if(this.lists.set(o,d),u.length>0)for(const h of u)this.rowIdIndex.delete(h),this.notifyRemoved(t,h),this.removeDescendants(h);for(let h=0;h<c.length;h++){const p=c[h];this.rowIdIndex.set(p,{key:o,listPath:t,index:h})}return c}updateAll(t,n){const r=new Map,i=[];for(const g of n){if(!g||typeof g.path!="string")continue;const y=g.path.trim();y&&(r.set(y,g),i.push(y))}const o=new Set(i),a=g=>{const y=g.split(".").filter(Boolean);let b;for(let S=1;S<y.length;S++){const w=y.slice(0,S).join(".");o.has(w)&&(b=w)}return b},c=new Map,u=new Map,d=new Map;for(const g of i){const y=a(g);c.set(g,y);const b=y?g.slice(y.length+1):g;u.set(g,b);const S=d.get(y)??[];S.push(g),d.set(y,S)}const h=(d.get(void 0)??[]).slice().sort(),p=(g,y,b)=>{const S=r.get(g),w=Array.isArray(b)?b:[],x=this.ensureList(g,w,S?.trackBy,y),I=(d.get(g)??[]).slice().sort();if(I.length!==0)for(let _=0;_<w.length;_++){const M=w[_],C=x[_];if(C)for(const E of I){const T=u.get(E)??"",A=T?co(M,T):void 0;p(E,C,A)}}};for(const g of h){const y=co(t,g);p(g,void 0,y)}}}const dwe=e=>{const t=[];for(const n in e){if(!Object.prototype.hasOwnProperty.call(e,n))continue;const r=e[n];if(!r||typeof r!="object"||r._tag!=="StateTraitList")continue;const o=r.identityHint?.trackBy;t.push({path:n,trackBy:typeof o=="string"?o:void 0})}return t},kC=e=>Ve(Pa).pipe(rt(t=>Ce(t)?t.value.local.once(e):!0)),lS=(e,t=10)=>e.length===0?"":e.length<=t?e.join(", "):`${e.slice(0,t).join(", ")}, …(+${e.length-t})`,HF=e=>re(function*(){const t=`${e.instanceId??"unknown"}::${e.kind}::${e.fieldPath}`;(yield*kC(`deps_mismatch:${t}`))&&(yield*Ue({type:"diagnostic",moduleId:e.moduleId,instanceId:e.instanceId,code:"state_trait::deps_mismatch",severity:"warning",message:`[deps] ${e.kind} "${e.fieldPath}" declared=[${lS(e.diff.declared)}] reads=[${lS(e.diff.reads)}] missing=[${lS(e.diff.missing)}] unused=[${lS(e.diff.unused)}]`,hint:'deps is the single source of truth for dependencies: incremental scheduling / reverse closures / performance optimizations rely on deps only. Keep deps consistent with actual reads; if you really depend on the whole object, declare a coarser-grained dep (e.g. "profile") to cover sub-field reads.',kind:`deps_mismatch:${e.kind}`}))}),WF=()=>Ve(Uc).pipe(rt(e=>Ce(e)?e.value.stack:[])),Sw=(e,t,n,r,i,o)=>{const a=Qr(t)??[];try{Kc(e).txn.recordStatePatch(a,n,r,i,o)}catch{}},bc=(e,t)=>{try{Kc(e).txn.recordReplayEvent(t)}catch{}},zm=e=>{try{const t=Kc(e);return{moduleId:t.moduleId,instanceId:t.instanceId}}catch{return{moduleId:void 0,instanceId:void 0}}},F1=(e,t,n,r,i,o)=>re(function*(){let a=!1;return yield*e.state.mutate(c=>{const u=co(c,t);Object.is(u,n)||(a=!0,Rd(c,t,n),Sw(e,t,r,u,n,o))}),a}),cS=(e,t,n,r,i,o,a,c)=>re(function*(){let u=!1;return yield*e.state.mutate(d=>{const h=co(d,t);if((h&&typeof h=="object"?h.keyHash:void 0)!==n)return;const g=h;Object.is(g,r)||(u=!0,Rd(d,t,r),c&&bc(e,c),Sw(e,t,i,g,r,a))}),u}),fwe=(e,t)=>Ye(()=>{const n=t.getDraft(),r=[];for(const a of e.entries){if(a.kind!=="source")continue;const c=a.fieldPath,u=$W(c);if(u){const g=co(n,u.listPath),y=Array.isArray(g)?g:[];for(let b=0;b<y.length;b++){const S=y[b];let w;try{w=a.meta.key(S)}catch{continue}if(w!==void 0)continue;const x=og(u.listPath,b,u.itemPath),I=co(n,x);if((I&&typeof I=="object"?I.status:void 0)==="idle"){const M=I?.data,C=I?.error;if(M===void 0&&C===void 0)continue}r.push({fieldPath:x,prev:I})}continue}let d;try{d=a.meta.key(n)}catch{continue}if(d!==void 0)continue;const h=co(n,c);if((h&&typeof h=="object"?h.status:void 0)==="idle"){const g=h?.data,y=h?.error;if(g===void 0&&y===void 0)continue}r.push({fieldPath:c,prev:h})}if(r.length===0)return;const i="source-refresh",o=Qh(n,a=>{for(const c of r)Rd(a,c.fieldPath,us.idle())});t.setDraft(o);for(const a of r){const c=Qr(a.fieldPath)??[];t.recordPatch(c,i,a.prev,us.idle(),`source:${a.fieldPath}:idle`)}}),hwe=(e,t,n)=>{if(!t.targetFieldPath)return ce;const r=t.targetFieldPath,i=t.resourceId??n.meta.resource,o=$W(r);let a;try{a=Kc(e)}catch{return ce}const c=a.traits.registerSourceRefresh,u=(S,w,x)=>{if(!w||S!=="live")return ce;const I=x&&typeof x=="object"&&x._tag==="ResourceSnapshot"?x:{_tag:"ResourceSnapshot",resourceId:i,fieldPath:x.fieldPath,keyHash:x.keyHash,concurrency:x.concurrency,phase:x.phase,snapshot:x.snapshot,timestamp:Date.now(),moduleId:x.moduleId,instanceId:x.instanceId};return w.record(I)};if(o){const S=a.traits.rowIdStore;if(!S)return ce;const w=o.listPath,x=o.itemPath;if(!x)return ce;const _=n.meta.concurrency??"switch",M=new Map,C=new Map;let E=0;S.onRemoved(w,R=>{C.delete(R),M.delete(R)});const T=(R,N,L,B)=>re(function*(){let j;return yield*e.state.mutate($=>{const F=S.getIndex(w,R);if(F===void 0)return;const K=og(w,F,x),W=co($,K);Object.is(W,N)||(j=K,Rd($,K,N),Sw(e,K,L,W,N,t.debugInfo?.graphNodeId))}),j}),A=(R,N,L,B,j,$)=>re(function*(){let F;return yield*e.state.mutate(K=>{const W=S.getIndex(w,R);if(W===void 0)return;const X=og(w,W,x),V=co(K,X);if((V&&typeof V=="object"?V.keyHash:void 0)!==N)return;const Q=V;if(!Object.is(Q,L)){if(F=X,Rd(K,X,L),$){const{moduleId:q,instanceId:ie}=zm(e);bc(e,{_tag:"ResourceSnapshot",resourceId:i,fieldPath:X,keyHash:N,concurrency:_,phase:$,snapshot:L,timestamp:Date.now(),moduleId:q,instanceId:ie})}Sw(e,X,B,Q,L,t.debugInfo?.graphNodeId)}}),F}),U=(R,N,L,B,j)=>re(function*(){const{moduleId:$,instanceId:F}=zm(e),K=S.getIndex(w,R),W=K===void 0?void 0:og(w,K,x);let X=us.loading({keyHash:L});if(B==="replay"&&j&&W){const ie=yield*j.consumeNextResourceSnapshot({resourceId:i,fieldPath:W,keyHash:L,phase:"loading"});ie&&(X=ie.snapshot)}const V=yield*T(R,X,"source-refresh");if(V){const ie={_tag:"ResourceSnapshot",resourceId:i,fieldPath:V,keyHash:L,concurrency:_,phase:"loading",snapshot:X,timestamp:Date.now(),moduleId:$,instanceId:F};bc(e,ie),yield*u(B,j,ie)}const z=re(function*(){if(B==="replay"&&j){yield*qc();const ye=V??W;if(!ye)return yield*ce;const xe=yield*j.consumeNextResourceSnapshot({resourceId:i,fieldPath:ye,keyHash:L});return xe?(xe.phase==="success"?yield*A(R,L,xe.snapshot,"source-refresh",`source:${r}:${R}:success`,"success"):xe.phase==="error"&&(yield*A(R,L,xe.snapshot,"source-refresh",`source:${r}:${R}:error`,"error")),yield*ce):yield*ce}const ie=yield*WF(),le=yield*Ve(UF.ResourceRegistryTag),J=(Ce(le)?le.value:void 0)?.specs.get(i);if(!J)return yield*ce;const ge=J.load(N),te={moduleId:$,instanceId:F,fieldPath:r,resourceId:i,key:N,keyHash:L,rowId:R,traitNodeId:t.debugInfo?.graphNodeId,stepId:t.id};if(!(typeof te.opSeq=="number"&&Number.isFinite(te.opSeq))){const ye=yield*Ve(Pa);if(Ce(ye)){const xe=F??"global";te.opSeq=ye.value.local.nextSeq("opSeq",xe)}}const pe=hy({kind:"service",name:i,effect:ge,meta:te}),oe=yield*en(Yh(pe,ie));if(oe._tag==="Success"){const ye=us.success({keyHash:L,data:oe.value}),xe=yield*A(R,L,ye,"source-refresh",`source:${r}:${R}:success`,"success");xe&&(yield*u(B,j,{_tag:"ResourceSnapshot",resourceId:i,fieldPath:xe,keyHash:L,concurrency:_,phase:"success",snapshot:ye,timestamp:Date.now(),moduleId:$,instanceId:F}))}else{const ye=us.error({keyHash:L,error:oe.cause}),xe=yield*A(R,L,ye,"source-refresh",`source:${r}:${R}:error`,"error");xe&&(yield*u(B,j,{_tag:"ResourceSnapshot",resourceId:i,fieldPath:xe,keyHash:L,concurrency:_,phase:"error",snapshot:ye,timestamp:Date.now(),moduleId:$,instanceId:F}))}}).pipe(At(()=>ce)),Q=yield*Nn(Cn(ii,!1)(z)),q=E+=1;M.set(R,{gen:q,fiber:Q,keyHash:L}),yield*Nn(Cn(ii,!1)(zc(Q).pipe(Ze(Ye(()=>{const ie=M.get(R);ie&&ie.gen===q&&M.delete(R)})),Ze(_==="exhaust-trailing"?re(function*(){const ie=C.get(R);C.delete(R),ie&&(yield*U(R,ie.key,ie.keyHash,B,j))}):ce),At(()=>ce))))});return c(r,R=>re(function*(){const{moduleId:N,instanceId:L}=zm(e),B=yield*Ve(uF),j=Ce(B)?B.value.mode:"live",$=yield*Ve(bw),F=Ce($)?$.value:void 0,K=yield*et(uw),W=co(R,w),X=Array.isArray(W)?W:[],V=S.ensureList(w,X),z=`${L??"unknown"}::source::${r}`;if(dn()&&(yield*kC(`deps_trace_settled:${z}`)))try{const Q=X[0];if(Q!==void 0){const ie=mC(ee=>n.meta.key(ee),Q).reads.map(ee=>ee?`${w}[].${ee}`:`${w}[]`),le=pC(n.meta.deps??[],ie);le&&(yield*HF({moduleId:N,instanceId:L,kind:"source",fieldPath:r,diff:le}))}}catch{}for(let Q=0;Q<X.length;Q++){const q=V[Q];if(!q)continue;const ie=og(w,Q,x),le=co(R,ie);let ee;try{ee=n.meta.key(X[Q])}catch{ee=void 0}const J=M.get(q);if(ee===void 0){if(C.delete(q),M.delete(q),le&&typeof le=="object"&&le.status==="idle"&&le.data===void 0&&le.error===void 0)continue;const pe=us.idle(),oe=yield*T(q,pe,"source-refresh");if(oe){const ye={_tag:"ResourceSnapshot",resourceId:i,fieldPath:oe,keyHash:void 0,concurrency:_,phase:"idle",snapshot:pe,timestamp:Date.now(),moduleId:N,instanceId:L};bc(e,ye),yield*u(j,F,ye)}continue}const ge=qF(ee);if(!K&&J&&J.keyHash===ge)continue;const te=le&&typeof le=="object"?le.keyHash:void 0;if(!(!K&&!J&&te===ge)){if(_==="exhaust-trailing"&&J){C.set(q,{key:ee,keyHash:ge});const pe=us.loading({keyHash:ge}),oe=yield*T(q,pe,"source-refresh");if(oe){const ye={_tag:"ResourceSnapshot",resourceId:i,fieldPath:oe,keyHash:ge,concurrency:_,phase:"loading",snapshot:pe,timestamp:Date.now(),moduleId:N,instanceId:L};bc(e,ye),yield*u(j,F,ye)}continue}_==="switch"&&J&&(C.delete(q),M.delete(q)),yield*U(q,ee,ge,j,F)}}})),ce}let d,h=0,p;const y=n.meta.concurrency??"switch",b=(S,w,x,I)=>re(function*(){const{moduleId:_,instanceId:M}=zm(e);let C=us.loading({keyHash:w});if(x==="replay"&&I){const R=yield*I.consumeNextResourceSnapshot({resourceId:i,fieldPath:r,keyHash:w,phase:"loading"});R&&(C=R.snapshot)}if(yield*F1(e,r,C,"source-refresh",`source:${r}:loading`,t.debugInfo?.graphNodeId)){const R={_tag:"ResourceSnapshot",resourceId:i,fieldPath:r,keyHash:w,concurrency:y,phase:"loading",snapshot:C,timestamp:Date.now(),moduleId:_,instanceId:M};bc(e,R),yield*u(x,I,R)}const T=re(function*(){if(x==="replay"&&I){yield*qc();const W=yield*I.consumeNextResourceSnapshot({resourceId:i,fieldPath:r,keyHash:w});if(!W)return yield*ce;if(W.phase==="success"){const X={_tag:"ResourceSnapshot",resourceId:i,fieldPath:r,keyHash:w,concurrency:y,phase:"success",snapshot:W.snapshot,timestamp:Date.now(),moduleId:_,instanceId:M};yield*cS(e,r,w,W.snapshot,"source-refresh",`source:${r}:success`,t.debugInfo?.graphNodeId,X)}else if(W.phase==="error"){const X={_tag:"ResourceSnapshot",resourceId:i,fieldPath:r,keyHash:w,concurrency:y,phase:"error",snapshot:W.snapshot,timestamp:Date.now(),moduleId:_,instanceId:M};yield*cS(e,r,w,W.snapshot,"source-refresh",`source:${r}:error`,t.debugInfo?.graphNodeId,X)}return yield*ce}const R=yield*WF(),N=yield*Ve(UF.ResourceRegistryTag),B=(Ce(N)?N.value:void 0)?.specs.get(i);if(!B)return yield*ce;const j=B.load(S),$={moduleId:_,instanceId:M,fieldPath:r,resourceId:i,key:S,keyHash:w,traitNodeId:t.debugInfo?.graphNodeId,stepId:t.id};if(!(typeof $.opSeq=="number"&&Number.isFinite($.opSeq))){const W=yield*Ve(Pa);if(Ce(W)){const X=M??"global";$.opSeq=W.value.local.nextSeq("opSeq",X)}}const F=hy({kind:"trait-source",name:i,effect:j,meta:$}),K=yield*en(Yh(F,R));if(K._tag==="Success"){const W=us.success({keyHash:w,data:K.value}),X={_tag:"ResourceSnapshot",resourceId:i,fieldPath:r,keyHash:w,concurrency:y,phase:"success",snapshot:W,timestamp:Date.now(),moduleId:_,instanceId:M};(yield*cS(e,r,w,W,"source-refresh",`source:${r}:success`,t.debugInfo?.graphNodeId,X))&&(yield*u(x,I,X))}else{const W=us.error({keyHash:w,error:K.cause}),X={_tag:"ResourceSnapshot",resourceId:i,fieldPath:r,keyHash:w,concurrency:y,phase:"error",snapshot:W,timestamp:Date.now(),moduleId:_,instanceId:M};(yield*cS(e,r,w,W,"source-refresh",`source:${r}:error`,t.debugInfo?.graphNodeId,X))&&(yield*u(x,I,X))}}).pipe(At(()=>ce)),A=yield*Nn(Cn(ii,!1)(T)),U=h+=1;d={gen:U,fiber:A,keyHash:w},yield*Nn(Cn(ii,!1)(zc(A).pipe(Ze(Ye(()=>{d&&d.gen===U&&(d=void 0)})),Ze(y==="exhaust-trailing"?re(function*(){const R=p;p=void 0,R&&(yield*b(R.key,R.keyHash,x,I))}):ce),At(()=>ce))))});return c(r,S=>re(function*(){const{moduleId:w,instanceId:x}=zm(e),I=yield*Ve(uF),_=Ce(I)?I.value.mode:"live",M=yield*Ve(bw),C=Ce(M)?M.value:void 0,E=yield*et(uw);let T;try{T=n.meta.key(S)}catch{T=void 0}const A=`${x??"unknown"}::source::${r}`;if(dn()&&(yield*kC(`deps_trace_settled:${A}`)))try{const R=mC(L=>n.meta.key(L),S),N=pC(n.meta.deps??[],R.reads);N&&(yield*HF({moduleId:w,instanceId:x,kind:"source",fieldPath:r,diff:N}))}catch{}if(T===void 0){d&&(yield*Zg(d.fiber),d=void 0),p=void 0;const R=us.idle();if(yield*F1(e,r,R,"source-refresh",`source:${r}:idle`,t.debugInfo?.graphNodeId)){const L={_tag:"ResourceSnapshot",resourceId:i,fieldPath:r,keyHash:void 0,concurrency:y,phase:"idle",snapshot:R,timestamp:Date.now(),moduleId:w,instanceId:x};bc(e,L),yield*u(_,C,L)}return}const U=qF(T);if(!E){if(d&&d.keyHash===U)return;const R=co(S,r),N=R&&typeof R=="object"?R.keyHash:void 0,L=R&&typeof R=="object"?R.status:void 0;if(L&&L!=="idle"&&N===U)return}if(y==="exhaust-trailing"&&d){p={key:T,keyHash:U};const R=us.loading({keyHash:U});if(yield*F1(e,r,R,"source-refresh",`source:${r}:loading`,t.debugInfo?.graphNodeId)){const L={_tag:"ResourceSnapshot",resourceId:i,fieldPath:r,keyHash:U,concurrency:y,phase:"loading",snapshot:R,timestamp:Date.now(),moduleId:w,instanceId:x};bc(e,L),yield*u(_,C,L)}return}y==="switch"&&d&&(yield*Zg(d.fiber),d=void 0,p=void 0),yield*b(T,U,_,C)})),ce},GF=Symbol.for("@logixjs/core/dirtyAllSetStateHint"),pwe=e=>{if(!e||typeof e!="object")return;const t=e,n=t.sliceStart,r=t.sliceEnd;if(typeof n!="number"||typeof r!="number"||!Number.isFinite(n)||!Number.isFinite(r))return;const i=Math.floor(n),o=Math.floor(r);if(!(i<0||o<=i))return{start:i,end:o}},mwe=e=>{const{moduleId:t,optionsModuleId:n,instanceId:r,stateRef:i,commitHub:o,shouldPublishCommitHub:a,recordStatePatch:c,onCommit:u,enqueueTransaction:d,runOperation:h,txnContext:p,traitConvergeTimeSlicing:g,traitRuntime:y,resolveTraitConvergeConfig:b,isDevEnv:S,maxTxnHistory:w,txnHistory:x,txnById:I}=e,_=re(function*(){const T=yield*et(ii),A=p.current;return T&&A?A.draft:yield*xg(i)}),M=(T,A)=>Cn(ii,!0)(re(function*(){const U=yield*xg(i);mSe(p,T,U);const R=p.current;R.stateTraitValidateRequests=[],R.commitMode="normal",R.priority="normal";const N=T?.details?.stateCommit?.priority;(N==="low"||N==="normal")&&(R.priority=N);const L=p.current?.txnId,B=p.current?.txnSeq;let j;try{j=yield*en(Cn(rW,L)(re(function*(){let $;if(S()){const K=yield*nH(A()),W=5;let X=yield*UT(K);for(let z=0;z<W&&Zt(X);z++)yield*qc(),X=yield*UT(K);Zt(X)&&(yield*Ue({type:"diagnostic",moduleId:n,instanceId:r,txnSeq:B,txnId:L,trigger:T,code:"state_transaction::async_escape",severity:"error",message:"Synchronous StateTransaction body escaped the transaction window (async/await detected).",hint:"No IO/await/sleep/promises inside the transaction window; use run*Task (pending → IO → writeback) or move async logic outside the transaction.",kind:"async_in_transaction"}));const V=yield*zc(K);yield*Wi(V,{onFailure:z=>pr(z),onSuccess:()=>ce})}else yield*A();const F=y.getProgram();if(F&&p.current){const K=yield*b();g.latestConvergeConfig=K;const W=K.traitConvergeTimeSlicing,X=T.kind==="trait:deferred_flush",V=F.convergeExecIr!=null&&F.convergeExecIr.topoOrderDeferredInt32.length>0,z=W.enabled===!0&&V,Q=X?"deferred":z?"immediate":"all",q=X?pwe(T.details):void 0,ie=q&&F.convergeExecIr?F.convergeExecIr.topoOrderDeferredInt32.subarray(q.start,q.end):void 0,le=yield*en(I0e(F,{moduleId:n,instanceId:r,txnSeq:B,txnId:L,configScope:K.configScope,now:p.config.now,budgetMs:K.traitConvergeBudgetMs,decisionBudgetMs:K.traitConvergeDecisionBudgetMs,requestedMode:ie?"full":K.traitConvergeMode,schedulingScope:Q,...ie?{schedulingScopeStepIds:ie}:{},dirtyAllReason:p.current?.dirtyAllReason,dirtyPaths:p.current?.dirtyPathIds,allowInPlaceDraft:p.current!=null&&!Object.is(p.current.draft,p.current.baseState),planCache:y.getConvergePlanCache(),generation:y.getConvergeGeneration(),cacheMissReasonHint:y.getPendingCacheMissReason(),getDraft:()=>p.current.draft,setDraft:te=>{hl(p,te)},recordPatch:(te,pe,oe,ye,xe,je)=>c(te,pe,oe,ye,xe,je)}));if(y.getPendingCacheMissReason()==="generation_bumped"&&y.setPendingCacheMissReason(void 0),le._tag==="Failure"){const pe=[...Z0(le.cause),...Vh(le.cause)].find(oe=>oe instanceof hC);if(pe){const oe=pe.fields??[];yield*Ue({type:"diagnostic",moduleId:n,instanceId:r,txnSeq:B,txnId:L,trigger:T,code:"state_trait::config_error",severity:"error",message:pe.message,hint:pe.code==="CYCLE_DETECTED"?`computed/link graph has a cycle: ${oe.join(", ")}`:`multiple writers detected for the same field: ${oe.join(", ")}`,kind:`state_trait_config_error:${pe.code}`})}return yield*pr(le.cause)}const ee=le.value,J=p.current?.dirtyAllReason,ge=z&&!X&&!J?Array.from(p.current.dirtyPathIds):void 0;if(z&&!X&&ee._tag!=="Degraded"&&(J!=null||ge!=null&&ge.length>0)){const te=Date.now();if(g.firstPendingAtMs=g.firstPendingAtMs??te,g.lastTouchedAtMs=te,J!=null)g.backlogDirtyAllReason=J,g.backlogDirtyPaths.clear();else if(!g.backlogDirtyAllReason&&ge)for(const Ge of ge)g.backlogDirtyPaths.add(Ge);const pe=yield*et(Vc),oe=yield*et(Jr),ye=yield*et(po),xe=yield*Ve(Oc),je=Ce(xe)?xe.value:void 0;g.capturedContext={runtimeLabel:pe,diagnosticsLevel:oe,debugSinks:ye,overrides:je},yield*fr(g.signal,void 0)}$=ee.decision?{converge:ee.decision}:void 0,ee._tag==="Degraded"&&(yield*Ue({type:"diagnostic",moduleId:n,instanceId:r,txnSeq:B,code:ee.reason==="budget_exceeded"?"trait::budget_exceeded":"trait::runtime_error",severity:"warning",message:ee.reason==="budget_exceeded"?"Trait converge exceeded budget; derived fields are frozen for this operation window.":"Trait converge failed at runtime; derived fields are frozen for this operation window.",hint:ee.reason==="budget_exceeded"?"Check whether computed/check contains heavy computation; move it to source/task or split into cacheable derived pieces.":"Check computed/link/check for invalid inputs or impure logic; add equals or guards if needed.",kind:"trait_degraded"}))}if(F&&p.current){const K=X=>{if(X.length<=1)return X;const V={submit:4,blur:3,valueChange:2,manual:1};let z="manual",Q=V[z],q=!1;for(const J of X){const ge=V[J.mode];ge>Q&&(Q=ge,z=J.mode),J.target.kind==="root"&&(q=!0)}if(q)return[{mode:z,target:{kind:"root"}}];const ie=J=>{switch(J.kind){case"field":return`field:${J.path}`;case"list":return`list:${J.path}`;case"item":return`item:${J.path}:${J.index}:${J.field??""}`;case"root":return"root"}},le=[],ee=new Map;for(const J of X){const ge=ie(J.target),te=ee.get(ge);if(!te){ee.set(ge,J),le.push(ge);continue}V[J.mode]>V[te.mode]&&ee.set(ge,{...te,mode:J.mode})}return le.map(J=>ee.get(J)).filter(Boolean)},W=p.current.stateTraitValidateRequests;if(W&&W.length>0){const X=K(W);yield*iwe(F,{moduleId:n,instanceId:r,txnSeq:p.current.txnSeq,txnId:p.current.txnId,origin:p.current.origin,rowIdStore:y.rowIdStore,listConfigs:y.getListConfigs(),getDraft:()=>p.current.draft,setDraft:V=>{hl(p,V)},recordPatch:(V,z,Q,q,ie,le)=>c(V,z,Q,q,ie,le)},X)}}F&&p.current&&(yield*fwe(F,{moduleId:n,instanceId:r,getDraft:()=>p.current.draft,setDraft:K=>{hl(p,K)},recordPatch:(K,W,X,V,z,Q)=>c(K,W,X,V,z,Q)})),yield*h("state","state:update",{meta:{moduleId:n,instanceId:r}},re(function*(){const K=p.current?.lastReplayEvent,W=p.current?.commitMode??"normal",X=p.current?.priority??"normal",V=p.current?p.current[GF]===!0:!1,z=yield*gSe(p,i);if(z){if((V||z.origin.kind==="state"&&z.origin.name==="setState")&&S()&&z.dirtySet?.dirtyAll===!0&&(yield*Ue({type:"diagnostic",moduleId:n,instanceId:r,txnSeq:z.txnSeq,txnId:z.txnId,trigger:z.origin,code:"state_transaction::dirty_all_fallback",severity:"warning",message:"setState/state.update did not provide field-level dirty-set evidence; falling back to dirtyAll scheduling.",hint:"Prefer $.state.mutate(...) or Logix.Module.Reducer.mutate(...) to produce field-level patchPaths; otherwise converge/validate degrades to full-path scheduling.",kind:"dirty_all_fallback:set_state"})),(S()||p.config.instrumentation==="full")&&(x.push(z),I.set(z.txnId,z),x.length>w)){const te=x.shift();te&&I.delete(te.txnId)}const q=z.finalStateSnapshot!==void 0?z.finalStateSnapshot:yield*xg(i),ie=y.getListConfigs();ie.length>0&&y.rowIdStore.updateAll(q,ie);const le={txnSeq:z.txnSeq,txnId:z.txnId,commitMode:W,priority:X,originKind:z.origin.kind,originName:z.origin.name};(!a||a())&&(yield*Sl(o,{value:q,meta:le}));const ee=yield*et(Jr);u&&ee==="off"&&(yield*u({state:q,meta:le,dirtySet:z.dirtySet,diagnosticsLevel:ee}));const J=yield*et(po);if(J.length>0&&!cO(J)){const te=ee!=="off",pe=te?(()=>{const ye=F?.convergeIr;if(!(!ye||ye.configError))return hw(ye)})():void 0,oe=te?(()=>{const ye=ee==="full"?32:3;if(z.dirtySet.dirtyAll)return{dirtyAll:!0,reason:z.dirtySet.reason??"unknownWrite",rootIds:[],rootCount:0,keySize:0,keyHash:0,rootIdsTruncated:!1};const xe=z.dirtySet.rootIds;return{dirtyAll:!1,rootIds:xe.slice(0,ye),rootCount:z.dirtySet.rootCount,keySize:z.dirtySet.keySize,keyHash:z.dirtySet.keyHash,rootIdsTruncated:xe.length>ye}})():void 0;yield*Ue({type:"state:update",moduleId:n,state:q,instanceId:r,txnSeq:z.txnSeq,txnId:z.txnId,staticIrDigest:pe,dirtySet:oe,patchCount:z.patchCount,patchesTruncated:z.patchesTruncated,...z.patchesTruncated?{patchesTruncatedReason:z.patchesTruncatedReason}:null,commitMode:W,priority:X,originKind:z.origin.kind,originName:z.origin.name,traitSummary:$,replayEvent:K})}u&&ee!=="off"&&(yield*u({state:q,meta:le,dirtySet:z.dirtySet,diagnosticsLevel:ee}))}}))})))}finally{}if(j._tag==="Failure")return ySe(p),yield*pr(j.cause)}));return{readState:_,setStateInternal:(T,A,U,R,N,L,B)=>re(function*(){if((yield*et(ii))&&p.current){const $=p.current;hl(p,T),c(A,U,R,N,L,B),A==="*"&&($[GF]=!0);return}yield*d(h("state","state:update",{payload:T,meta:{moduleId:t,instanceId:r}},M({kind:"state",name:"setState"},()=>Ye(()=>{hl(p,T),c(A,U,R,N,L,B)}))))}),runWithStateTransaction:M,__logixGetExecVmAssemblyEvidence:()=>{const A=y.getProgram()?.convergeIr;return!A||A.configError?void 0:{convergeStaticIrDigest:hw(A),convergeGeneration:A.generation}}}},gwe=e=>e==="unbounded"?"unbounded":dy(e),ywe=e=>()=>re(function*(){const c=yield*Ve(fW),u=yield*Ve(Uve),d=Ce(c)?c.value:void 0,h=Ce(u)?u.value:void 0;let p=16,g="builtin",y=16,b="builtin",S=4096,w=!1,x="builtin",I=1e3,_=5e3,M=3e4,C="builtin";const E=(B,j)=>{if(!B)return;let $=!1;const F=gwe(B.concurrencyLimit);F&&(p=F,g=j,F!=="unbounded"&&(y=F,b=j),$=!0);const K=dy(B.losslessBackpressureCapacity);K!=null&&(S=K,$=!0);const W=fy(B.allowUnbounded);W!=null&&(w=W,x=j,$=!0);const X=B.pressureWarningThreshold;if(X&&typeof X=="object"){const z=dy(X.backlogCount);z!=null&&(I=z,$=!0);const Q=bl(X.backlogDurationMs);Q!=null&&(_=Q,$=!0)}const V=bl(B.warningCooldownMs);V!=null&&(M=V,$=!0),$&&(C=j)},T=e.moduleId,A=T&&d?.overridesByModuleId?d.overridesByModuleId[T]:void 0,U=T&&h?.overridesByModuleId?h.overridesByModuleId[T]:void 0;E(d,"runtime_default"),E(A,"runtime_module"),E(h,"provider"),E(U,"provider");const R=p,N=g;typeof p=="string"&&!w&&(p=y,g=b);const L={concurrencyLimit:p,losslessBackpressureCapacity:S,allowUnbounded:w,pressureWarningThreshold:{backlogCount:I,backlogDurationMs:_},warningCooldownMs:M,configScope:C,concurrencyLimitScope:g,requestedConcurrencyLimit:R,requestedConcurrencyLimitScope:N,allowUnboundedScope:x};return e.diagnostics&&(yield*e.diagnostics.emitUnboundedPolicyIfNeeded({policy:L,trigger:{kind:"concurrencyPolicy",name:"resolve"}})),L}),Bf=a0,uS=fy,bwe=e=>{const t=uS(e.stateTransaction?.txnLanes?.enabled)??!0,n=Bf(e.stateTransaction?.txnLanes?.budgetMs)??1,r=Bf(e.stateTransaction?.txnLanes?.debounceMs)??0,i=Bf(e.stateTransaction?.txnLanes?.maxLagMs)??50,o=uS(e.stateTransaction?.txnLanes?.allowCoalesce)??!0,a=e.stateTransaction?.txnLanes?.yieldStrategy==="inputPending"?"inputPending":"baseline";return()=>re(function*(){const c=yield*Ve(dk),u=yield*Ve(Oc),d=Ce(c)?c.value:void 0,h=Ce(u)?u.value:void 0;let p=t,g=n,y=r,b=i,S=o,w=a,x,I="builtin";const _=(U,R)=>{if(!U)return;const N=U.txnLanes!=null?U.txnLanes:U;if(!N||typeof N!="object")return;let L=!1;const B=uS(N.enabled);B!=null&&(p=B,L=!0);const j=N.overrideMode;(j==="forced_off"||j==="forced_sync")&&(x=j,L=!0);const $=Bf(N.budgetMs);$!=null&&(g=$,L=!0);const F=Bf(N.debounceMs);F!=null&&(y=F,L=!0);const K=Bf(N.maxLagMs);K!=null&&(b=K,L=!0);const W=uS(N.allowCoalesce);W!=null&&(S=W,L=!0);const X=N.yieldStrategy;(X==="baseline"||X==="inputPending")&&(w=X,L=!0),L&&(I=R)},M=e.moduleId,C=M&&d?.txnLanesOverridesByModuleId?d.txnLanesOverridesByModuleId[M]:void 0,E=M&&h?.txnLanesOverridesByModuleId?h.txnLanesOverridesByModuleId[M]:void 0;_(d,"runtime_default"),_(C,"runtime_module"),_(h,"provider"),_(E,"provider");const T=x?!1:p;return{enabled:T,...x?{overrideMode:x}:{},configScope:I,budgetMs:g,debounceMs:y,maxLagMs:b,allowCoalesce:S,yieldStrategy:w,queueMode:T?"lanes":"fifo"}})},hc=bl,YF=e=>e==="auto"||e==="full"||e==="dirty"?e:void 0,QF=e=>typeof e=="boolean"?e:void 0,vwe=e=>{const t=hc(e.stateTransaction?.traitConvergeBudgetMs)??200,n=hc(e.stateTransaction?.traitConvergeDecisionBudgetMs)??.5,r=YF(e.stateTransaction?.traitConvergeMode)??"auto",i=QF(e.stateTransaction?.traitConvergeTimeSlicing?.enabled)??!1,o=hc(e.stateTransaction?.traitConvergeTimeSlicing?.debounceMs)??16,a=hc(e.stateTransaction?.traitConvergeTimeSlicing?.maxLagMs)??200;return()=>re(function*(){const c=yield*Ve(dk),u=yield*Ve(Oc),d=Ce(c)?c.value:void 0,h=Ce(u)?u.value:void 0;let p=r,g=t,y=n,b=i,S=o,w=a,x="builtin";const I=(E,T)=>{if(!E)return;let A=!1;const U=YF(E.traitConvergeMode);U&&(p=U,A=!0);const R=hc(E.traitConvergeBudgetMs);R!=null&&(g=R,A=!0);const N=hc(E.traitConvergeDecisionBudgetMs);N!=null&&(y=N,A=!0);const L=E.traitConvergeTimeSlicing;if(L&&typeof L=="object"){const B=QF(L.enabled);B!=null&&(b=B,A=!0);const j=hc(L.debounceMs);j!=null&&(S=j,A=!0);const $=hc(L.maxLagMs);$!=null&&(w=$,A=!0)}A&&(x=T)},_=e.moduleId,M=_&&d?.traitConvergeOverridesByModuleId?d.traitConvergeOverridesByModuleId[_]:void 0,C=_&&h?.traitConvergeOverridesByModuleId?h.traitConvergeOverridesByModuleId[_]:void 0;return I(d,"runtime_default"),I(M,"runtime_module"),I(h,"provider"),I(C,"provider"),{traitConvergeMode:p,traitConvergeBudgetMs:g,traitConvergeDecisionBudgetMs:y,traitConvergeTimeSlicing:{enabled:b,debounceMs:S,maxLagMs:w},configScope:x}})},Swe=e=>{const t=[],n=u=>typeof u=="object"&&u!==null&&u._tag==="StateTraitNode",r=u=>typeof u=="object"&&u!==null&&u._tag==="StateTraitList",i=(u,d)=>u?d?`${u}.${d}`:u:d,o=(u,d)=>!u||u.length===0?[]:u.map(h=>d?i(d,h):h),a=(u,d,h)=>{if(u.kind==="computed"){const p=u.meta,g=p.deps,y=g!==void 0?o(g,h):void 0;return{...u,fieldPath:d,meta:{...p,deps:y}}}if(u.kind==="source"){const p=u.meta,g=p.deps,y=g!==void 0?o(g,h):void 0;return{...u,fieldPath:d,meta:{...p,deps:y,_fieldPath:d}}}if(u.kind==="externalStore"){const p=u.meta;return{...u,fieldPath:d,meta:{...p,_fieldPath:d}}}if(u.kind==="link"){const p=u.meta,g=o([p.from],h)[0]??p.from;return{...u,fieldPath:d,meta:{...p,from:g}}}return{...u,fieldPath:d}},c=(u,d,h,p)=>{const g=(b,S)=>{const w=S.fieldPath??b,x=d?i(d,String(w)):String(w);t.push(a(S,x,d))},y=b=>{if(!b)return;if(typeof b.kind=="string"){g("",b);return}const S=b;for(const w in S){if(!Object.prototype.hasOwnProperty.call(S,w))continue;const x=S[w];x&&g(w,x)}};if(y(h.computed),y(h.source),y(h.link),y(h.externalStore),h.check){const b={},S=p?.checkDepsPrefix??(d.endsWith("[]")?d:""),w=x=>!x||x.length===0?[]:x.map(I=>I===""?u:S?i(S,I):I);for(const x of Object.keys(h.check)){const I=h.check[x];if(typeof I=="function"){b[x]=I;continue}if(I&&typeof I=="object"){const _=hk(I.meta);b[x]={...I,deps:w(I.deps),meta:_};continue}}t.push({fieldPath:u,kind:"check",meta:{rules:b,writeback:{kind:"errors"}}})}};for(const u in e){if(!Object.prototype.hasOwnProperty.call(e,u))continue;const d=e[u];if(!d)continue;if(r(d)){const g=u;d.item&&c(`${g}[]`,`${g}[]`,d.item),d.list&&c(g,g,d.list,{checkDepsPrefix:`${g}[]`});continue}if(n(d)){u==="$root"?c("$root","",d):c(u,u,d);continue}const h=d,p=h.fieldPath??u;t.push(a(h,String(p),""))}return t},wwe=e=>{const t=new Map,n=o=>typeof o=="object"&&o!==null&&o._tag==="StateTraitNode",r=o=>typeof o=="object"&&o!==null&&o._tag==="StateTraitList",i=(o,a)=>{const c=hk(a.meta);c&&t.set(o,c)};for(const o in e){if(!Object.prototype.hasOwnProperty.call(e,o))continue;const a=e[o];if(a){if(r(a)){const c=o;a.item&&i(`${c}[]`,a.item),a.list&&i(c,a.list);continue}if(n(a)){i(o==="$root"?"$root":o,a);continue}}}return t},XF=()=>typeof globalThis.performance<"u"&&typeof globalThis.performance.now=="function"?globalThis.performance.now():Date.now(),xwe=e=>{const t=new Map;for(const a of e){if(a.kind!=="computed"&&a.kind!=="link"&&a.kind!=="source"&&a.kind!=="externalStore")continue;const c=t.get(a.fieldPath)??new Set;c.add(a.kind),t.set(a.fieldPath,c)}const n=[];for(const[a,c]of t.entries())c.size<=1||n.push({fieldPath:a,kinds:Array.from(c).sort()});if(n.length===0)return;n.sort((a,c)=>a.fieldPath<c.fieldPath?-1:a.fieldPath>c.fieldPath?1:0);const r=n.map(a=>a.fieldPath),i=n[0],o=i.kinds.join(" + ");return{code:"MULTIPLE_WRITERS",message:`[StateTrait.build] Multiple writers for field "${i.fieldPath}" (${o}). Only one of computed/link/source/externalStore can write a fieldPath.`,fields:r}},d0=e=>e.kind==="computed"?e.meta?.deps??[]:[e.meta.from],kwe=e=>{const t=new Map;for(const c of e){const u=t.get(c.fieldPath);if(u)return{order:[],configError:{code:"MULTIPLE_WRITERS",message:`[StateTrait.converge] Multiple writers for field "${c.fieldPath}" (${u.kind} + ${c.kind}).`,fields:[c.fieldPath]}};t.set(c.fieldPath,c)}const n=new Set;for(const c of e)n.add(c.fieldPath);const r=new Map,i=new Map;for(const c of n)r.set(c,0),i.set(c,[]);for(const c of e){const u=c.fieldPath,d=d0(c);for(const h of d)n.has(h)&&(i.get(h).push(u),r.set(u,(r.get(u)??0)+1))}const o=[];for(const[c,u]of r.entries())u===0&&o.push(c);const a=[];for(;o.length;){const c=o.shift();a.push(c);const u=i.get(c);for(const d of u){const h=(r.get(d)??0)-1;r.set(d,h),h===0&&o.push(d)}}if(a.length!==n.size){const c=Array.from(n).filter(u=>!a.includes(u));return{order:[],configError:{code:"CYCLE_DETECTED",message:`[StateTrait.converge] Cycle detected in computed/link graph: ${c.join(", ")}`,fields:c}}}return{order:a}},_we=e=>{const t=new Map,n=i=>{const o=Qr(i);o&&t.set(JSON.stringify(o),o)},r=(i,o,a)=>{let c=i;for(;;){if(QM(c)){if(a.has(c))return;a.add(c),c=c.f();continue}if(ud(c)){c=c.from;continue}break}if(XM(c)){r(c.to,o,a),r(c.from,o,a);return}if(Ny(c)){for(const u of c.types)r(u,o,a);return}if(WM(c)){for(const u of c.elements)r(u.type,o,a);for(const u of c.rest)r(u.type,o,a);return}if(GM(c)){for(const u of c.propertySignatures){const d=String(u.name);if(!d)continue;const h=[...o,d];n(h),r(u.type,h,a)}return}};return r(e.ast,[],new Set),Array.from(t.values()).sort(fk)},Iwe=(e,t)=>{const n=XF(),r=0,i=xwe(t),o=t.filter(C=>C.kind==="computed"||C.kind==="link"),a=o.map(C=>`${C.kind}:${C.fieldPath}`).sort().join("|"),c=o.map(C=>{const E=d0(C).slice().sort().join(","),T=C.meta?.scheduling==="deferred"?"d":"i";return`${C.kind}:${C.fieldPath}@${T}=>${E}`}).sort().join("|"),u=new Map;for(const C of o)u.set(C.fieldPath,C);const d=i?{order:[]}:o.length>0?kwe(o):{order:[]},h=d.configError?[]:d.order.map(C=>u.get(C)),p=new Map,g=C=>{for(let E=1;E<=C.length;E++){const T=C.slice(0,E),A=JSON.stringify(T);p.has(A)||p.set(A,T)}};for(const C of _we(e))g(C);for(const C of o){const E=Qr(C.fieldPath);E&&g(E);for(const T of d0(C)){const A=Qr(T);A&&g(A)}}const y=Array.from(p.values()).sort(fk),b=Kve(y),S=Tp(Rl(y)),w=[],x=[],I=[];for(const C of h){const E=Qr(C.fieldPath),T=E!=null?dw(b,E):void 0;if(T==null)throw new Error(`[StateTrait.build] Failed to map converge output fieldPath "${C.fieldPath}" to FieldPathId.`);const A=[];for(const U of d0(C)){const R=Qr(U);if(!R)continue;const N=dw(b,R);N!=null&&A.push(N)}w.push(T),x.push(A),I.push(C.meta?.scheduling==="deferred"?"deferred":"immediate")}const _=h.map((C,E)=>E),M=Math.max(0,XF()-n);return{generation:r,writersKey:a,depsKey:c,fieldPathsKey:S,fieldPaths:y,fieldPathIdRegistry:b,...i?{configError:i}:d.configError?{configError:d.configError}:null,stepsById:h,stepOutFieldPathIdByStepId:w,stepDepsFieldPathIdsByStepId:x,stepSchedulingByStepId:I,topoOrder:_,buildDurationMs:M}},Ewe=e=>{const t=[];if(e.kind==="computed"){const r=e.meta.deps;r&&t.push(...r)}else if(e.kind==="source"){const r=e.meta.deps;r&&t.push(...r)}else if(e.kind==="link")t.push(e.meta.from);else if(e.kind==="check"){const r=e.meta?.rules??{};for(const i of Object.keys(r)){const o=r[i];if(o&&typeof o=="object"){const a=o.deps;a&&t.push(...a)}}}return{fieldId:e.fieldPath,kind:e.kind,meta:e.meta,deps:t}},Twe=(e,t)=>{const n=new Map,r=[],i=[],o=new Map,a=[],c=h=>{let p=n.get(h);return p||(p={id:h,path:h,traits:[]},n.set(h,p)),p};for(const h of e){const p=h.fieldPath,g=c(p),y=Ewe(h);if(g.traits.push(y),h.kind==="computed"){const b=`computed:${p}`;a.push({id:b,kind:"computed-update",targetFieldPath:p});const S=h.meta.deps;if(S)for(const w of S)c(w),i.push({id:`computed:${w}->${p}`,from:w,to:p,kind:"computed"})}else if(h.kind==="link"){const b=h.meta.from;c(b);const S=`link:${b}->${p}`;i.push({id:S,from:b,to:p,kind:"link"}),a.push({id:`link:${p}`,kind:"link-propagate",targetFieldPath:p,sourceFieldPaths:[b],debugInfo:{graphEdgeId:S}})}else if(h.kind==="source"){const b=h.meta.resource,S=hk(h.meta.meta),w=o.get(b);if(w){const I=[...w.ownerFields,p];let _=w.meta,M=w.metaOrigin,C=w.metaConflicts;if(S){const E=Yve({meta:_,origin:M,conflicts:C},{origin:p,meta:S});_=E.meta,M=E.origin,C=E.conflicts}o.set(b,{...w,ownerFields:I,meta:_,metaOrigin:M,metaConflicts:C})}else o.set(b,{resourceId:b,keySelector:`StateTrait.source@${p}`,ownerFields:[p],meta:S,metaOrigin:S?p:void 0});a.push({id:`source:${p}`,kind:"source-refresh",targetFieldPath:p,resourceId:b,keySelectorId:`StateTrait.source@${p}`});const x=h.meta.deps;if(x)for(const I of x)c(I),i.push({id:`source-dep:${I}->${p}`,from:I,to:p,kind:"source-dep"})}else if(h.kind==="externalStore")a.push({id:`external-store:${p}`,kind:"external-store-sync",targetFieldPath:p});else if(h.kind==="check"&&(a.push({id:`check:${p}`,kind:"check-validate",targetFieldPath:p}),y.deps.length>0))for(const b of y.deps)c(b),i.push({id:`check-dep:${b}->${p}`,from:b,to:p,kind:"check-dep"})}for(const h of n.values())r.push({id:h.id,field:h,traits:h.traits,meta:t.get(h.id)});return{graph:{_tag:"StateTraitGraph",nodes:r,edges:i,resources:Array.from(o.values())},plan:{_tag:"StateTraitPlan",steps:a}}},Cwe=e=>{const t=new Map;for(const o of e){if(o.kind!=="link")continue;const a=t.get(o.from)??[];a.push(o.to),t.set(o.from,a)}const n=new Set,r=new Set,i=o=>{if(r.has(o))throw new Error(`[StateTrait.build] link cycle detected at field "${o}". Please check link traits for circular dependencies.`);if(n.has(o))return;n.add(o),r.add(o);const a=t.get(o);if(a)for(const c of a)i(c);r.delete(o)};for(const o of t.keys())n.has(o)||i(o)},Mwe=e=>{const t=new Map,n=i=>{if(!i.path)return;const o=`${i.kind}|${i.entryKind}|${i.entryFieldPath}|${i.ruleName??""}|${i.path}`;t.set(o,i)},r=i=>{const o=i.meta?.writeback,a=o&&typeof o=="object"?o.path:void 0,c=typeof a=="string"&&a.startsWith("errors.")?a:void 0;if(c)return c;const u=i.fieldPath;return u.endsWith("[]")?`errors.${u.slice(0,-2)}`:`errors.${u}`};for(const i of e){if(n({kind:"fieldPath",entryKind:i.kind,entryFieldPath:i.fieldPath,path:i.fieldPath}),i.kind==="computed"||i.kind==="source"){const o=i.meta?.deps??[];for(const a of o)n({kind:"dep",entryKind:i.kind,entryFieldPath:i.fieldPath,path:a})}if(i.kind==="link"&&n({kind:"link_from",entryKind:"link",entryFieldPath:i.fieldPath,path:i.meta.from}),i.kind==="check"){n({kind:"check_writeback",entryKind:"check",entryFieldPath:i.fieldPath,path:r(i)});const o=i.meta?.rules??{};for(const a of Object.keys(o)){const c=o[a];if(!c||typeof c!="object")continue;const u=c.deps??[];for(const d of u)n({kind:"dep",entryKind:"check",entryFieldPath:i.fieldPath,ruleName:a,path:d})}}}return Array.from(t.entries()).sort((i,o)=>i[0]<o[0]?-1:i[0]>o[0]?1:0).map(([,i])=>i)},jW=(e,t)=>{const n=Swe(t),r=wwe(t);for(const a of n){if(a.kind==="computed"&&a.meta.deps===void 0)throw new Error(`[StateTrait.build] Missing explicit deps for computed "${a.fieldPath}". Please use StateTrait.computed({ deps: [...], get: ... }).`);if(a.kind==="source"&&a.meta.deps===void 0)throw new Error(`[StateTrait.build] Missing explicit deps for source "${a.fieldPath}". Please provide meta.deps for StateTrait.source({ deps: [...], ... }).`);if(a.kind==="check"){const c=a.meta?.rules??{};for(const u of Object.keys(c)){const d=c[u];if(typeof d=="function"||!d||typeof d!="object")throw new Error(`[StateTrait.build] Missing explicit deps for check "${a.fieldPath}" rule "${u}". Please use { deps: [...], validate: ... } form.`);if(d.deps===void 0)throw new Error(`[StateTrait.build] Missing explicit deps for check "${a.fieldPath}" rule "${u}". Please provide deps: [...].`)}}}const{graph:i,plan:o}=Twe(n,r);return Cwe(i.edges),{stateSchema:e,spec:t,entries:n,graph:i,plan:o,convergeIr:Iwe(e,n),schemaPaths:Mwe(n)}},Rwe=e=>Ye(()=>{const{runtime:t,runtimeInternals:n}=e;iSe(t,n)});class Awe extends Yt("@logixjs/core/RootContext")(){}const Dc=Awe,IO=e=>{switch(e.type){case"app":return`app:${e.appId}`;case"moduleInstance":return`moduleInstance:${e.moduleId}::${e.instanceId}`;case"uiSubtree":return`uiSubtree:${e.subtreeId}`}},Owe=e=>`${e.processId}@@${IO(e.scope)}`,JF=e=>{const t=IO(e.identity.scope);return`process:${e.identity.processId}::${t}::r${e.runSeq}`},FW=4096,Dwe=16,ZF=(e,t)=>{const n=t?.defaultGuard??FW,r=typeof e=="number"&&Number.isFinite(e)&&e>=0?Math.floor(e):"unbounded";return{configured:r,guard:r==="unbounded"?n:r}},Pwe=e=>re(function*(){const t=e.policy,n=e.defaultQueueGuard??FW;if(t.mode==="latest"){const g=yield*Qn({fiber:void 0,runningId:0,nextId:0}),y=b=>re(function*(){const S=e.assignTriggerSeq(b),[w,x,I]=yield*xr(g,M=>{const C=M.nextId+1;return[[M.fiber,M.runningId,C],{...M,nextId:C,runningId:C}]});if(w&&x!==0){const M=yield*UT(w);Zt(M)&&(yield*Zg(w))}const _=yield*Nn(e.run(S).pipe(Gi(bs(g,M=>M.runningId===I?{...M,runningId:0}:M))));yield*bs(g,M=>({...M,fiber:_}))});return yield*Ml(e.stream,y)}const r=yield*Qn(!1),i=yield*Qn({running:!1,queue:[],peak:0}),o=yield*Qn({active:0,queue:[],peak:0}),a=ZF(t.maxQueue,{defaultGuard:n}),c=ZF(void 0,{defaultGuard:n}),u=typeof t.maxParallel=="number"&&Number.isFinite(t.maxParallel)&&t.maxParallel>=1?Math.floor(t.maxParallel):e.defaultParallelLimit??Dwe,d=()=>Tn(()=>xr(i,g=>{if(g.running||g.queue.length===0)return[Oe(),g];const[y,...b]=g.queue;return[De(y),{...g,running:!0,queue:b}]}).pipe($e(g=>rr(g,{onNone:()=>ce,onSome:y=>Nn(e.run(y).pipe(Gi(bs(i,b=>({...b,running:!1}))),Ze(d()))).pipe(Gt)})))),h=()=>Tn(()=>xr(o,g=>{if(g.active>=u||g.queue.length===0)return[Oe(),g];const[y,...b]=g.queue;return[De(y),{...g,active:g.active+1,queue:b}]}).pipe($e(g=>rr(g,{onNone:()=>ce,onSome:y=>Nn(e.run(y).pipe(Gi(bs(o,b=>({...b,active:Math.max(0,b.active-1)}))),Ze(h()))).pipe(Gt,Ze(h()))})))),p=g=>re(function*(){const y=e.assignTriggerSeq(g);if(t.mode==="drop"){if(!(yield*xr(r,w=>w?[!1,w]:[!0,!0]))){yield*e.onDrop(y);return}yield*Nn(e.run(y).pipe(Gi(_d(r,!1))));return}if(t.mode==="parallel"){const S=yield*xr(o,w=>{const x=[...w.queue,y];return[x.length,{...w,queue:x,peak:Math.max(w.peak,x.length)}]});if(S>c.guard){const w=yield*Xi(o);yield*e.onQueueOverflow({mode:"parallel",currentLength:S,peak:w.peak,limit:c,policy:t});return}yield*h();return}const b=yield*xr(i,S=>{const w=[...S.queue,y];return[w.length,{...S,queue:w,peak:Math.max(S.peak,w.length)}]});if(b>a.guard){const S=yield*Xi(i);yield*e.onQueueOverflow({mode:"serial",currentLength:b,peak:S.peak,limit:a,policy:t});return}yield*d()});return yield*Ml(e.stream,p)}),zW=4*1024,Nwe=50,Lwe=1,$we=e=>({maxEvents:Nwe,maxBytes:zW,emitted:0,dropped:0,downgraded:0,summaryEmitted:!1}),jwe=e=>({type:"process:trigger",identity:e.sourceEvent.identity,trigger:e.sourceEvent.trigger,severity:"warning",eventSeq:e.sourceEvent.eventSeq,timestampMs:e.sourceEvent.timestampMs,error:{message:"Process run event budget exceeded; further trigger/dispatch events are suppressed.",code:"process::event_budget_exceeded",hint:`maxEvents=${e.maxEvents} maxBytes=${e.maxBytes} emitted=${e.emitted} dropped=${e.dropped} downgraded=${e.downgraded}`}}),Fwe=(e,t)=>{const n=Math.max(0,e.maxEvents),r=Math.max(0,e.maxBytes);if(e.summaryEmitted)return[{_tag:"drop"},{...e,dropped:e.dropped+1}];const o=Math.max(0,n-Lwe);if(e.emitted<o){const d=_C(t,{maxBytes:r});return[{_tag:"emit",event:d.event},{...e,emitted:e.emitted+1,downgraded:e.downgraded+(d.downgraded?1:0)}]}const a=e.dropped+1,c=jwe({sourceEvent:t,maxEvents:n,maxBytes:r,emitted:e.emitted,dropped:a,downgraded:e.downgraded}),u=_C(c,{maxBytes:r});return[{_tag:"emitSummary",event:u.event},{...e,emitted:Math.min(n,e.emitted+1),dropped:a,downgraded:e.downgraded+(u.downgraded?1:0),summaryEmitted:!0}]},ez=e=>{const t=JSON.stringify(e);return typeof Buffer<"u"?Buffer.byteLength(t,"utf8"):new TextEncoder().encode(t).length},ww=(e,t)=>e.length<=t?e:e.slice(0,t),zwe=e=>{const t=typeof e.message=="string"&&e.message.length>0?e.message:"Error",n=typeof e.hint=="string"&&e.hint.length>0?ww(e.hint,1024):void 0;return{name:typeof e.name=="string"&&e.name.length>0?e.name:void 0,message:ww(t,256),code:typeof e.code=="string"&&e.code.length>0?e.code:void 0,hint:n}},_C=(e,t)=>{const n=t?.maxBytes??zW;let r=!1,i=e;if(e.error){const u=zwe(e.error);(u.message!==e.error.message||u.hint!==e.error.hint||u.code!==e.error.code||u.name!==e.error.name)&&(r=!0,i={...e,error:u})}if(ez(i)<=n)return{event:i,downgraded:r};if(!i.error?.hint)return{event:i,downgraded:!0};const o=i.error.hint,a=[512,256,128,64,32,0];for(const u of a){const d=u===0?void 0:ww(o,u),h={...i,error:{...i.error,hint:d}};if(ez(h)<=n)return{event:h,downgraded:!0}}return{event:i.error?{...i,error:{...i.error,message:ww(i.error.message,96),hint:void 0}}:i,downgraded:!0}},BW=Symbol.for("@logixjs/core/processMeta"),Bwe=(e,t,n)=>{Object.defineProperty(e,t,{value:n,enumerable:!1,configurable:!0,writable:!1})},qwe=e=>e[BW],Uwe=(e,t)=>(Bwe(e,BW,t),e),IC=e=>typeof e=="object"&&e!==null,Vwe=e=>{if(!IC(e))return;const t=e.ast;if(t&&!(typeof t!="object"&&typeof t!="function"))return t},sg=(e,t,n)=>{const r=new Error(t);return r.code="process::invalid_dot_path",r.hint=n??["Expected dot-path syntax: segments separated by '.', numeric segments represent array indices.",`path: ${e}`,"","examples:","- count","- user.name","- items.0.id"].join(`
43
+ `),r},Kwe=e=>sg(e,"Invalid dot-path: path does not match the state schema.",["The module state schema does not contain the requested dot-path.",`path: ${e}`,"","fix:","- Ensure the path exists in the state schema.","- Use numeric segments for array indices (e.g. items.0.id)."].join(`
44
+ `)),Hwe=e=>{if(typeof e!="string"||e.length===0)return{ok:!1,error:sg(String(e),"dot-path must be a non-empty string")};const t=e.split(".");if(t.length===0)return{ok:!1,error:sg(e,"dot-path must contain at least one segment")};const n=[];for(let r=0;r<t.length;r++){const i=t[r];if(i.length===0)return{ok:!1,error:sg(e,`Invalid dot-path: empty segment at index ${r}.`,["Expected dot-path syntax: segments separated by '.', numeric segments represent array indices.",`path: ${e}`,"","examples:","- count","- user.name","- items.0.id","","fix:","- Remove consecutive dots or trailing dots."].join(`
45
+ `))};if(/^[0-9]+$/.test(i)){const o=Number(i);if(!Number.isFinite(o)||o<0)return{ok:!1,error:sg(e,`Invalid array index segment "${i}" at index ${r}.`)};n.push(Math.floor(o));continue}n.push(i)}return{ok:!0,segments:n}},vc=(e,t,n)=>{if(t.length===0)return e;let r=e;for(;;){if(QM(r)){if(n.has(r))return;n.add(r),r=r.f();continue}if(ud(r)){r=r.from;continue}break}if(XM(r)){const o=vc(r.from,t,n);return o||vc(r.to,t,n)}if(Ny(r)){for(const o of r.types){const a=vc(o,t,n);if(a)return a}return}if(WM(r)){const[o,...a]=t;if(typeof o!="number")return;const c=o<r.elements.length?r.elements[o]:r.rest.length>0?r.rest[0]:void 0;return c?vc(c.type,a,n):void 0}if(GM(r)){const[o,...a]=t;if(o===void 0)return;if(typeof o=="string"){for(const c of r.propertySignatures)if(String(c.name)===o)return vc(c.type,a,n)}for(const c of r.indexSignatures){let u=c.parameter;for(;ud(u);)u=u.from;const d=u?._tag,h=d==="StringKeyword"||d==="TemplateLiteral",p=d==="NumberKeyword";if(typeof o=="string"&&h||typeof o=="number"&&p)return vc(c.type,a,n)}}const i=r?._tag;if(i==="AnyKeyword"||i==="UnknownKeyword"||i==="ObjectKeyword"||i==="Declaration")return r},Wwe=e=>t=>{let n=t;for(const r of e){if(n==null)return;if(typeof r=="number"){if(Array.isArray(n)){n=n[r];continue}if(IC(n)){n=n[String(r)];continue}return}if(IC(n)){n=n[r];continue}return}return n},Gwe=(e,t)=>{const n=Hwe(e);return n.ok?t&&!vc(t,n.segments,new Set)?{ok:!1,error:Kwe(e)}:{ok:!0,selector:Wwe(n.segments),segments:n.segments}:{ok:!1,error:n.error}},Ywe=()=>({failureTimes:[]}),Qwe=(e,t,n)=>{if(e.mode==="failStop")return{decision:"stop",nextState:t,withinWindowFailures:t.failureTimes.length,maxRestarts:0,windowMs:e.windowMs};const r=e.maxRestarts,i=typeof r=="number"&&Number.isFinite(r)&&r>=0?Math.floor(r):0;if(i<=0)return{decision:"stop",nextState:t,withinWindowFailures:t.failureTimes.length,maxRestarts:i,windowMs:e.windowMs};const o=e.windowMs,a=typeof o=="number"&&Number.isFinite(o)&&o>0?Math.floor(o):void 0,c=[...t.failureTimes,n],u=a?c.filter(y=>y>=n-a):c,d=i+1,h=u.length>d?u.slice(u.length-d):u,p=h.length;return{decision:p<=i?"restart":"stop",nextState:{failureTimes:h},withinWindowFailures:p,maxRestarts:i,windowMs:a}};class EO extends Yt("@logixjs/core/ProcessRuntime")(){}const tz=mo(void 0),nz=mo(void 0),z1="runtime:boot",Xwe=e=>`process:${e}`,Jwe=e=>{const t=e.trigger;if(!t)return{};if((t.kind==="moduleAction"||t.kind==="moduleStateChange")&&typeof t.instanceId=="string"&&typeof t.txnSeq=="number"&&Number.isFinite(t.txnSeq)&&t.txnSeq>=1){const n=Math.floor(t.txnSeq);return{txnSeq:n,txnId:`${t.instanceId}::t${n}`}}return{}},rz=(e,t)=>{const n=e.type==="moduleInstance"?e.moduleId:void 0,r=e.type==="moduleInstance"?e.instanceId:void 0;return fO({moduleId:n,instanceId:r,code:"process::invalid_usage",severity:"error",message:"ProcessRuntime scheduling is not allowed inside a synchronous StateTransaction body (it may deadlock the txnQueue).",hint:"Trigger/schedule Process outside the transaction window (e.g. in a watcher's run section or a separate fiber); do not trigger Process directly inside a reducer / synchronous transaction body.",kind:t})},Zwe=e=>{try{const t=Cp(e);return Vwe(t.stateSchema)}catch{return}},exe=(e,t)=>{const n=e.hint;return typeof n=="string"&&n.length>0?(n.includes("moduleId=")||(e.hint=`moduleId=${t}
46
+ ${n}`),e):(e.hint=`moduleId=${t}`,e)},B1=e=>{if(!e||typeof e!="object")return;const t=e;if(typeof t._tag=="string"&&t._tag.length>0)return t._tag;if(typeof t.type=="string"&&t.type.length>0)return t.type},txe=e=>re(function*(){const t=yield*TA,n=500,r=new Map,i=new Map,o=[],a=yield*ame(Math.max(1,Math.min(2048,n))),c=()=>{if(o.length<=n)return;const E=o.length-n;o.splice(0,E)},u=E=>re(function*(){if((yield*et(Jr))==="off")return;const A=E.identity.identity.processId,U=JF(E.identity),R=Xwe(A),{txnSeq:N,txnId:L}=Jwe(E);yield*Ue({type:E.type,moduleId:R,instanceId:U,identity:E.identity,severity:E.severity,eventSeq:E.eventSeq,timestampMs:E.timestampMs,trigger:E.trigger,dispatch:E.dispatch,error:E.error,txnSeq:N,txnId:L})}),d=E=>re(function*(){o.push(E),c(),yield*Sl(a,E),yield*u(E)}),h=E=>re(function*(){const T=yield*et(nz);if(T){const U=yield*xr(T,R=>{const[N,L]=Fwe(R,E);return[N,L]});(U._tag==="emit"||U._tag==="emitSummary")&&(yield*d(U.event));return}const A=_C(E);yield*d(A.event)}),p=(E,T,A,U,R)=>{if(!dn())return ce;const N=E.type==="moduleInstance"?E.moduleId:void 0,L=E.type==="moduleInstance"?E.instanceId:void 0;return Ue({type:"diagnostic",moduleId:N,instanceId:L,code:A,severity:"error",message:U,hint:R,actionTag:T,kind:"process_runtime"})},g=E=>{const T=E.definition.requires??[],A=[];for(const N of E.definition.triggers)(N.kind==="moduleAction"||N.kind==="moduleStateChange")&&A.push(N.moduleId);const U=Array.from(new Set([...T,...A]));if(U.length===0)return[];const R=[];for(const N of U){if(typeof N!="string"||N.length===0)continue;const L=Yt(`@logixjs/Module/${N}`)(),B=Ai(E.env,L);Zt(B)&&R.push(N)}return R},y=(E,T)=>re(function*(){if(E.status.status==="stopped"||E.status.status==="failed"||E.status.status==="stopping")return;const A=E.fiber;E.status={...E.status,status:"stopping",stoppedReason:T},A&&(yield*Mi(A)),yield*Hh(E.platformTriggersQueue),E.status={...E.status,status:"stopped",stoppedReason:T},E.fiber=void 0;const U={type:"process:stop",identity:E.identity,severity:"info",eventSeq:E.nextEventSeq++,timestampMs:Date.now()};yield*h(U);const R=r.get(E.installationKey);R?.pendingStart&&(R.pendingStart=void 0,yield*b(E.installationKey))}),b=E=>re(function*(){const T=r.get(E);if(!T||(T.pendingStart=void 0,yield*rz(T.identity.scope,"process_start_in_transaction")))return;const U=T.currentInstanceId;if(U){const oe=i.get(U);if(oe&&(oe.status.status==="running"||oe.status.status==="starting"))return}const R=T.nextRunSeq++,N={identity:T.identity,runSeq:R},L=JF(N),B=yield*cme(64),j={installationKey:E,processInstanceId:L,identity:N,processId:T.identity.processId,scope:T.identity.scope,forkScope:T.forkScope,platformTriggersQueue:B,status:{identity:N,status:"starting"},nextEventSeq:1,nextTriggerSeq:1};i.set(L,j),T.currentInstanceId=L,T.forkScope!==t&&(yield*Mc(T.forkScope,Tn(()=>{const oe=j.status.status;return oe==="stopped"||oe==="failed"||oe==="stopping"?ce:y(j,"scopeDisposed")}).pipe(At(()=>ce)))),yield*h({type:"process:start",identity:N,severity:"info",eventSeq:j.nextEventSeq++,timestampMs:Date.now()});const $=g(T);if($.length>0){const oe=dn()?["Strict scope dependency resolution: missing required modules in the current scope.",`missing: ${$.join(", ")}`,"","fix:","- Provide the missing module implementation(s) in the same scope via imports.",` Example: RootModule.implement({ imports: [${$[0]}.implement(...).impl], processes: [...] })`,"- Do not rely on cross-scope fallbacks / guessing instances."].join(`
47
+ `):void 0,ye={message:`Missing dependencies in scope: ${$.join(", ")}`,code:"process::missing_dependency",hint:oe};j.status={...j.status,status:"failed",stoppedReason:"failed",lastError:ye},yield*h({type:"process:error",identity:N,severity:"error",eventSeq:j.nextEventSeq++,timestampMs:Date.now(),error:ye}),yield*p(T.identity.scope,T.identity.processId,"process::missing_dependency",ye.message,oe);return}const F=T.definition.diagnosticsLevel!=="off",K=T.env,X=(()=>{if(!F)return K;const oe=T.definition.requires??[];if(oe.length===0)return K;const ye=Array.from(new Set(oe));let xe=K;for(const je of ye){if(typeof je!="string"||je.length===0)continue;const Ge=Yt(`@logixjs/Module/${je}`)(),it=Ai(K,Ge);if(Zt(it))continue;const ut=it.value,Dt=wt=>re(function*(){const Jn=yield*et(tz);if(!Jn)return;const yt=B1(wt)??"unknown",pn=typeof ut.moduleId=="string"?ut.moduleId:je,$t=typeof ut.instanceId=="string"?ut.instanceId:"unknown",On={type:"process:dispatch",identity:N,trigger:Jn,dispatch:{moduleId:pn,instanceId:$t,actionId:yt},severity:"info",eventSeq:j.nextEventSeq++,timestampMs:Date.now()};yield*h(On)}),Ct={...ut,dispatch:wt=>ut.dispatch(wt).pipe(ti(()=>Dt(wt))),dispatchLowPriority:wt=>ut.dispatchLowPriority(wt).pipe(ti(()=>Dt(wt))),dispatchBatch:wt=>ut.dispatchBatch(wt).pipe(ti(()=>ln(wt,Dt,{discard:!0})))};xe=kc(Ge,Ct)(xe)}return xe})(),V=Ea(T.process,X),z=oe=>re(function*(){if(oe.kind==="timer"){const Qe=Zte(oe.timerId);if(Zt(Qe)){const Ne=new Error(`[ProcessRuntime] invalid timerId (expected DurationInput): ${oe.timerId}`);return Ne.code="process::invalid_timer_id",Ne.hint="timerId must be a valid DurationInput string, e.g. '10 millis', '1 seconds', '5 minutes'.",yield*ga(Ne)}return Dbe(Qe.value).pipe(Hs(()=>({kind:"timer",name:oe.name,timerId:oe.timerId})))}if(oe.kind==="moduleAction"){const Qe=Yt(`@logixjs/Module/${oe.moduleId}`)(),Ne=Ai(K,Qe);if(Zt(Ne))return yield*ga(new Error(`Missing module runtime in scope: ${oe.moduleId}`));const He=Ne.value;if(!F){const cn=He.actions$;if(!cn){const Dn=new Error("ModuleRuntime does not provide actions$ (required for moduleAction trigger).");return Dn.code="process::missing_action_stream",Dn.hint=`moduleId=${oe.moduleId}`,yield*ga(Dn)}return cn.pipe(zs(Dn=>B1(Dn)===oe.actionId),Hs(()=>({kind:"moduleAction",name:oe.name,moduleId:oe.moduleId,instanceId:He.instanceId,actionId:oe.actionId,txnSeq:1})))}const kt=He.actionsWithMeta$;if(!kt){const cn=new Error("ModuleRuntime does not provide actionsWithMeta$ (required for moduleAction trigger).");return cn.code="process::missing_action_meta_stream",cn.hint=`moduleId=${oe.moduleId}`,yield*ga(cn)}return kt.pipe(zs(cn=>B1(cn.value)===oe.actionId),Hs(cn=>{const Dn=cn?.meta?.txnSeq;return{kind:"moduleAction",name:oe.name,moduleId:oe.moduleId,instanceId:He.instanceId,actionId:oe.actionId,txnSeq:typeof Dn=="number"?Dn:1}}))}const ye=Yt(`@logixjs/Module/${oe.moduleId}`)(),xe=Ai(K,ye);if(Zt(xe))return yield*ga(new Error(`Missing module runtime in scope: ${oe.moduleId}`));const je=xe.value,Ge=Zwe(je),it=Gwe(oe.path,Ge);if(!it.ok)return yield*ga(exe(it.error,oe.moduleId));const ut=it.selector,Dt=yield*Qn(Oe()),Ct=F,wt=Ct?yield*Qn({windowStartedMs:Date.now(),triggersInWindow:0,lastWarningAtMs:0}):void 0,Jn=127,yt=4,pn=1e3,$t=dn()?20:200,On=3e4;let he=0,_e=0,Pe=0,Ke=0;const dt=()=>typeof performance<"u"&&typeof performance.now=="function"?performance.now():Date.now(),tn=Ct?Qe=>{if(he+=1,(he&Jn)!==0)return ut(Qe);const Ne=dt(),He=ut(Qe),kt=dt()-Ne;return _e+=1,kt>=yt&&(Pe+=1),kt>Ke&&(Ke=kt),He}:ut,Fn=Qe=>wt?re(function*(){const Ne=Date.now(),He=yield*xr(wt,Dn=>{const vo=Ne-Dn.windowStartedMs>=pn,Yo=vo?Ne:Dn.windowStartedMs,Zr=vo?1:Dn.triggersInWindow+1,$i=Ne-Dn.lastWarningAtMs<On,Es=Zr>=$t,ci=Ke>=yt&&_e>0,Le=!$i&&(Es||ci),se=Le?{windowStartedMs:Ne,triggersInWindow:0,lastWarningAtMs:Ne}:{...Dn,windowStartedMs:Yo,triggersInWindow:Zr};return[{shouldWarn:Le,tooFrequent:Es,tooSlow:ci,triggersInWindow:Zr},se]});if(!He.shouldWarn)return;const kt=He.tooFrequent?"process::selector_high_frequency":"process::selector_slow",cn=[`moduleId=${oe.moduleId}`,`path=${oe.path}`,`windowMs=${pn}`,`triggersInWindow=${He.triggersInWindow}`,`threshold=${$t}`,`cooldownMs=${On}`,"","selector sampling:",`calls=${he}`,`sampled=${_e}`,`slowSamples(>=${yt}ms)=${Pe}`,`maxSampleMs=${Ke.toFixed(2)}`,"","notes:","- Ensure the selected value is stable (prefer primitive/tuple; avoid returning fresh objects).","- Narrow the path to reduce change frequency; avoid selecting large objects."].join(`
48
+ `);_e=0,Pe=0,Ke=0,yield*h({type:"process:trigger",identity:N,trigger:Qe,severity:"warning",eventSeq:j.nextEventSeq++,timestampMs:Date.now(),error:{message:"moduleStateChange selector diagnostics warning",code:kt,hint:cn}})}):ce,mn=je.changesWithMeta(tn).pipe(cy(Qe=>Xi(Dt).pipe($e(Ne=>Ce(Ne)&&Object.is(Ne.value,Qe.value)?fn(Oe()):_d(Dt,De(Qe.value)).pipe(vi(De(Qe)))))),Ebe(Qe=>Qe),Hs(Qe=>{const Ne=Qe?.meta?.txnSeq;return{kind:"moduleStateChange",name:oe.name,moduleId:oe.moduleId,instanceId:je.instanceId,path:oe.path,txnSeq:typeof Ne=="number"?Ne:1}}));return Ct?mn.pipe(Abe(Fn)):mn}),Q=(oe,ye)=>Cn(tz,oe)(V.pipe(At(xe=>bg(xe)?ce:ri(ye,xe).pipe(Gt,ny(()=>ce))))),q=(oe,ye)=>F?re(function*(){const xe=yield*Qn($we());return yield*Cn(nz,xe)(le(oe,"info").pipe(Ze(Q(oe,ye))))}):Q(oe,ye),ie=oe=>F?{...oe,triggerSeq:j.nextTriggerSeq++}:oe,le=(oe,ye)=>{if(!F)return ce;const xe={type:"process:trigger",identity:N,trigger:oe,severity:ye,eventSeq:j.nextEventSeq++,timestampMs:Date.now()};return h(xe)},ee=T.definition.concurrency,J=T.definition.triggers.some(oe=>oe.kind==="platformEvent"&&oe.platformEvent===z1),ge=T.definition.triggers.find(oe=>oe.kind==="platformEvent"&&oe.platformEvent===z1),te=re(function*(){const oe=yield*mr(),ye=Mbe(j.platformTriggersQueue),xe=T.definition.triggers.filter(Ct=>Ct.kind!=="platformEvent"),je=yield*ln(xe,z),Ge=Rbe([ye,...je],{concurrency:"unbounded"}),ut=yield*Nn(Pwe({stream:Ge,policy:ee,assignTriggerSeq:ie,run:Ct=>q(Ct,oe),onDrop:Ct=>le(Ct,"warning"),onQueueOverflow:Ct=>{const wt=new Error("Process trigger queue overflow (serial maxQueue guard).");return wt.code="process::serial_queue_overflow",wt.hint=[`mode=${Ct.mode}`,`queue: current=${Ct.currentLength} peak=${Ct.peak}`,`maxQueue: configured=${Ct.limit.configured} guard=${Ct.limit.guard}`,`policy: ${JSON.stringify(Ct.policy)}`,"","fix:","- Configure concurrency.maxQueue (serial) to a finite value, or switch to mode=latest/drop to avoid unbounded backlog."].join(`
49
+ `),ri(oe,Qx(wt)).pipe(Gt,ny(()=>ce))}}));J&&(yield*fr(j.platformTriggersQueue,{kind:"platformEvent",name:ge?.name,platformEvent:z1}));const Dt=yield*kn(oe);return yield*Mi(ut),yield*pr(Dt)}),pe=yield*ho(T.forkScope)(Ohe(te).pipe(At(oe=>re(function*(){if(bg(oe)){if(j.status.status==="stopping")return;j.status={...j.status,status:"stopped",stoppedReason:"scopeDisposed"},j.fiber=void 0,yield*Ic(h({type:"process:stop",identity:N,severity:"info",eventSeq:j.nextEventSeq++,timestampMs:Date.now()}));const it=r.get(E);it?.pendingStart&&(it.pendingStart=void 0,yield*b(E));return}const ye=Ln(ew(oe),()=>Ln(S5(oe),()=>oe)),je=Fo(ye).errorSummary;j.status={...j.status,status:"failed",stoppedReason:"failed",lastError:je},yield*h({type:"process:error",identity:N,severity:"error",eventSeq:j.nextEventSeq++,timestampMs:Date.now(),error:je});const Ge=Qwe(T.definition.errorPolicy,T.supervision,Date.now());T.supervision=Ge.nextState,Ge.decision==="restart"?(yield*h({type:"process:restart",identity:N,severity:"warning",eventSeq:j.nextEventSeq++,timestampMs:Date.now(),error:je}),yield*b(E)):yield*p(T.identity.scope,T.identity.processId,"process::failed_stop","Process failed and stopped (failStop / restart limit reached).",`processId=${T.identity.processId} scopeKey=${T.scopeKey} failures=${Ge.withinWindowFailures} maxRestarts=${Ge.maxRestarts}`)}))));j.fiber=pe,j.status={...j.status,status:"running"},yield*qc()}),S=(E,T)=>re(function*(){const A=qwe(E);if(!A)return;const U=yield*Yd(),R=yield*Ve(rfe),N=Ce(R)?R.value:t,L=IO(T.scope),B={processId:A.definition.processId,scope:T.scope},j=Owe(B),$=r.get(j);if($){if($.env=U,$.forkScope=N,$.enabled=T.enabled??!0,$.installedAt=T.installedAt??$.installedAt,!$.enabled)return $.pendingStart=void 0,{identity:B,enabled:$.enabled,installedAt:$.installedAt};const W=$.currentInstanceId,X=W?i.get(W):void 0,V=X?.status.status;return V==="running"||V==="starting"?((T.mode??"switch")==="switch"&&X&&X.forkScope!==N?($.pendingStart={forkScope:N},yield*Mc(N,Ye(()=>{const Q=r.get(j);Q&&Q.pendingStart?.forkScope===N&&(Q.pendingStart=void 0)}))):$.pendingStart=void 0,{identity:B,enabled:$.enabled,installedAt:$.installedAt}):V==="stopping"?((T.mode??"switch")==="switch"?($.pendingStart={forkScope:N},yield*Mc(N,Ye(()=>{const Q=r.get(j);Q&&Q.pendingStart?.forkScope===N&&(Q.pendingStart=void 0)}))):$.pendingStart=void 0,{identity:B,enabled:$.enabled,installedAt:$.installedAt}):($.pendingStart=void 0,yield*b(j),{identity:B,enabled:$.enabled,installedAt:$.installedAt})}const F=Tn(()=>E);Uwe(F,{...A,installationScope:T.scope});const K={identity:B,scopeKey:L,definition:A.definition,env:U,forkScope:N,process:F,kind:A.kind??"process",enabled:T.enabled??!0,installedAt:T.installedAt,nextRunSeq:1,supervision:Ywe(),pendingStart:void 0};return r.set(j,K),K.enabled&&(yield*b(j)),{identity:B,enabled:K.enabled,installedAt:K.installedAt}}),w=E=>Ye(()=>{const T=E?.scopeType,A=E?.scopeKey,U=[];for(const R of r.values())T&&R.identity.scope.type!==T||A&&R.scopeKey!==A||U.push({identity:R.identity,enabled:R.enabled,installedAt:R.installedAt});return U}),x=E=>Ye(()=>i.get(E)?.status),I=(E,T)=>Tn(()=>{const A=i.get(E);return A?rz(A.scope,"process_control_in_transaction").pipe($e(U=>{if(U)return ce;if(T.action==="stop")return y(A,"manualStop");if(T.action==="restart")return y(A,"manualStop").pipe($e(()=>{const R=r.get(A.installationKey);return R?(R.currentInstanceId=void 0,b(A.installationKey)):ce}));if(T.action==="start"){if(A.status.status==="running"||A.status.status==="starting")return ce;const R=r.get(A.installationKey);return R?(R.currentInstanceId=void 0,b(A.installationKey)):ce}return ce})):ce}),_=E=>re(function*(){if(yield*fO({code:"process::invalid_usage",severity:"error",message:"ProcessRuntime platform events are not allowed inside a synchronous StateTransaction body (it may deadlock the txnQueue).",hint:"Deliver platformEvent outside the transaction window.",kind:"process_platform_event_in_transaction"}))return;const A=Array.from(i.values()),U=E.eventName;yield*ln(A,R=>Tn(()=>{if(R.status.status!=="starting"&&R.status.status!=="running")return ce;const N=r.get(R.installationKey);if(!N)return ce;const L=N.definition.triggers.filter(B=>B.kind==="platformEvent"&&B.platformEvent===U);return L.length===0?ce:ln(L,B=>fr(R.platformTriggersQueue,{kind:"platformEvent",name:B.name,platformEvent:B.platformEvent}),{discard:!0})}),{discard:!0})}),M=rg(a),C=()=>Ye(()=>o.slice());return yield*ul(()=>re(function*(){for(const E of r.values())E.pendingStart=void 0;for(const E of i.values())E.fiber&&(yield*y(E,"scopeDisposed"))}).pipe(At(E=>Ye(()=>{dn()&&console.warn("[ProcessRuntime] finalizer failed",nu(E))})))),{install:S,listInstallations:w,getInstanceStatus:x,controlInstance:I,deliverPlatformEvent:_,events:M,getEventsSnapshot:C}}),nxe=e=>iy(EO,txe());function qW(e){if(!e||typeof e!="object"&&typeof e!="function")return!1;const t=e;return typeof t.selectorId=="string"&&typeof t.select=="function"&&Array.isArray(t.reads)}const f0=e=>{const t=[],n=new Set;for(const r of e){const i=typeof r=="number"?`n:${r}`:`s:${r}`;n.has(i)||(n.add(i),t.push(r))}return t.slice().sort()},rxe=e=>Number.parseInt(e,16),dS=e=>{const t=f0(e);return{count:t.length,hash:rxe(Tp(Rl(t)))}},fS=e=>`rq_${Tp(Rl(e))}`;let iz=0;const oz=new WeakMap,ixe=e=>{const t=oz.get(e);if(t)return t;iz+=1;const n=`rq_u${iz}`;return oz.set(e,n),n},UW=e=>{const t=e.trim();if(t.startsWith("(")&&t.endsWith(")")){const n=t.slice(1,-1).trim();if(!n.startsWith("(")||!n.endsWith(")"))return n}return t},oxe=e=>{const t=e.indexOf("=>");if(t<0)return;const n=e.slice(0,t).trim(),r=e.slice(t+2).trim(),i=UW(n);if(/^[A-Za-z_$][A-Za-z0-9_$]*$/.test(i)){if(r.startsWith("{")){const o=r.match(/^\{\s*return\s+(.+?);?\s*\}\s*$/s);return o?{param:i,body:o[1]?.trim()??""}:void 0}return{param:i,body:r}}},sxe=e=>{const n=e.trim().match(/^function\s*(?:[A-Za-z_$][A-Za-z0-9_$]*\s*)?\(\s*([A-Za-z_$][A-Za-z0-9_$]*)\s*\)\s*\{\s*return\s+(.+?);?\s*\}\s*$/s);if(!n)return;const r=n[1]?.trim()??"";if(!/^[A-Za-z_$][A-Za-z0-9_$]*$/.test(r))return;const i=n[2]?.trim()??"";if(i.length!==0)return{param:r,body:i}},axe=e=>{const t=oxe(e)??sxe(e);if(!t)return;const n=UW(t.body).trim().replace(/;$/,"").trim();{const r=new RegExp(`^${t.param}\\.([A-Za-z0-9_$]+(?:\\.[A-Za-z0-9_$]+)*)$`),i=n.match(r);if(i)return{kind:"path",path:i[1]}}if(n.startsWith("{")&&n.endsWith("}")){const r=n.slice(1,-1).trim();if(r.length===0)return{kind:"struct",entries:[]};const i=r.split(",").map(a=>a.trim()).filter(a=>a.length>0),o=[];for(const a of i){const c=a.indexOf(":");if(c<0)return;const u=a.slice(0,c).trim(),d=a.slice(c+1).trim();if(!/^[A-Za-z_$][A-Za-z0-9_$]*$/.test(u))return;const h=new RegExp(`^${t.param}\\.([A-Za-z0-9_$]+(?:\\.[A-Za-z0-9_$]+)*)$`),p=d.match(h);if(!p)return;o.push([u,p[1]])}return o.sort((a,c)=>a[0]<c[0]?-1:a[0]>c[0]?1:0),{kind:"struct",entries:o}}},sz=2048,hS=new WeakMap,q1=new Map,lxe=(e,t)=>{const n=e.get(t);if(n!==void 0)return e.delete(t),e.set(t,n),n},az=(e,t,n,r)=>{if(e.has(t)&&e.delete(t),e.set(t,n),e.size<=r)return;const i=e.keys().next().value;i!==void 0&&e.delete(i)},cxe=e=>{try{return e.toString()}catch{return""}},VW=e=>{if(qW(e)){const y=f0(e.reads),b=y.length>0?dS(y):void 0,S=e.equalsKind,w={selectorId:e.selectorId,debugKey:e.debugKey,lane:"static",producer:"manual",reads:y,readsDigest:b,equalsKind:S};return{...e,reads:y,lane:"static",producer:"manual",readsDigest:b,staticIr:w}}const t=e,n=(typeof t?.debugKey=="string"&&t.debugKey.length>0?t.debugKey:void 0)??(typeof t.name=="string"&&t.name.length>0?t.name:void 0),r=Array.isArray(t?.fieldPaths)?t.fieldPaths.filter(y=>typeof y=="string"):void 0;if(r&&r.length>0){const y=f0(r),b=dS(y),S=fS({kind:"reads",reads:y});return{selectorId:S,debugKey:n,reads:y,select:t,equalsKind:"objectIs",lane:"static",producer:"jit",readsDigest:b,staticIr:{selectorId:S,debugKey:n,lane:"static",producer:"jit",reads:y,readsDigest:b,equalsKind:"objectIs"}}}const i=hS.get(t);if(i){const y={selectorId:i.selectorId,debugKey:n,lane:"static",producer:"jit",reads:i.reads,readsDigest:i.readsDigest,equalsKind:i.equalsKind};return{selectorId:i.selectorId,debugKey:n,reads:i.reads,select:t,equalsKind:i.equalsKind,lane:"static",producer:"jit",readsDigest:i.readsDigest,staticIr:y}}const o=cxe(t).trim(),a=o.length>0?lxe(q1,o):void 0;if(a){hS.set(t,a);const y={selectorId:a.selectorId,debugKey:n,lane:"static",producer:"jit",reads:a.reads,readsDigest:a.readsDigest,equalsKind:a.equalsKind};return{selectorId:a.selectorId,debugKey:n,reads:a.reads,select:t,equalsKind:a.equalsKind,lane:"static",producer:"jit",readsDigest:a.readsDigest,staticIr:y}}const c=o.length>0?axe(o):void 0;if(c?.kind==="path"){const y=[c.path],b=dS(y),S=fS({kind:"path",path:c.path}),w={selectorId:S,reads:y,readsDigest:b,equalsKind:"objectIs"};return hS.set(t,w),az(q1,o,w,sz),{selectorId:S,debugKey:n,reads:y,select:t,equalsKind:"objectIs",lane:"static",producer:"jit",readsDigest:b,staticIr:{selectorId:S,debugKey:n,lane:"static",producer:"jit",reads:y,readsDigest:b,equalsKind:"objectIs"}}}if(c?.kind==="struct"){const y=f0(c.entries.map(([,I])=>I)),b=dS(y),S=fS({kind:"struct",entries:c.entries}),w={selectorId:S,reads:y,readsDigest:b,equalsKind:"shallowStruct"};return hS.set(t,w),az(q1,o,w,sz),{selectorId:S,debugKey:n,reads:y,select:t,equalsKind:"shallowStruct",lane:"static",producer:"jit",readsDigest:b,staticIr:{selectorId:S,debugKey:n,lane:"static",producer:"jit",reads:y,readsDigest:b,equalsKind:"shallowStruct"}}}const u=o.includes("=>")||o.startsWith("function")?"unsupportedSyntax":"missingDeps",d=o.length===0||o.includes("[native code]"),h=!n||d?"unstableSelectorId":u,p=h==="unstableSelectorId"?ixe(t):fS({kind:"dynamic",debugKey:n,src:o});return{selectorId:p,debugKey:n,reads:[],select:t,equalsKind:"objectIs",lane:"dynamic",producer:"dynamic",fallbackReason:h,staticIr:{selectorId:p,debugKey:n,lane:"dynamic",producer:"dynamic",fallbackReason:h,equalsKind:"objectIs"}}},lz=e=>{if(!e||e.length===0)return;const t=e.map(n=>n.trim()).filter(n=>n.length>0);return t.length>0?t:void 0},uxe=e=>{const t=e.config.mode==="warn"?"warning":"error";return{type:"diagnostic",moduleId:e.details.moduleId,instanceId:e.details.instanceId,txnSeq:e.details.txnSeq,code:"read_query::strict_gate",severity:t,message:`ReadQuery strict gate violated: selector entered dynamic lane (selectorId=${e.details.selectorId}, reason=${e.details.fallbackReason}).`,hint:"Fix: make the selector statically compilable (AOT/JIT) or pass an explicit ReadQuery; or disable/narrow the gate via RuntimeOptions.readQuery.strictGate.requireStatic / denyFallbackReasons.",kind:"read_query:strict_gate",trigger:{kind:"read_query",name:"strict_gate",details:e.details}}},dxe=e=>Object.assign(new Error(`[ReadQueryStrictGateError] selector entered dynamic lane (selectorId=${e.details.selectorId}, reason=${e.details.fallbackReason}).`),{_tag:"ReadQueryStrictGateError",details:e.details}),fxe=e=>{if(e.config.mode==="off")return{verdict:"PASS"};if(e.compiled.lane!=="dynamic")return{verdict:"PASS"};const t=e.compiled.fallbackReason??"missingDeps",r=!!e.config.denyFallbackReasons?.includes(t),i=lz(e.config.requireStatic?.selectorIds),o=lz(e.config.requireStatic?.modules),a=!!i||!!o,c=!!i?.includes(e.compiled.selectorId),u=!!o?.includes(e.moduleId);if(!r&&!(!a||c||u))return{verdict:"PASS"};const h=r?"denyFallbackReason":a?c?"requireStatic:selectorId":"requireStatic:module":"requireStatic:global",p={moduleId:e.moduleId,instanceId:e.instanceId,txnSeq:e.txnSeq,selectorId:e.compiled.selectorId,debugKey:e.compiled.debugKey,fallbackReason:t,rule:h},g=uxe({config:e.config,details:p});if(e.config.mode==="warn")return{verdict:"WARN",diagnostic:g,details:p};const y=dxe({details:p});return{verdict:"FAIL",diagnostic:g,error:y,details:p}},U1=e=>e[0]??"",cz=(e,t)=>uy(e,t)||uy(t,e),hxe=(e,t)=>{if(Object.is(e,t))return!0;if(!e||!t||typeof e!="object"||typeof t!="object"||Array.isArray(e)||Array.isArray(t))return!1;const n=e,r=t,i=Object.keys(n),o=Object.keys(r);if(i.length!==o.length)return!1;for(const a of i)if(!Object.prototype.hasOwnProperty.call(r,a)||!Object.is(n[a],r[a]))return!1;return!0},uz=(e,t,n)=>e.equalsKind==="custom"&&typeof e.equals=="function"?e.equals(t,n):e.equalsKind==="shallowStruct"?hxe(t,n):Object.is(t,n),pS=()=>{const e=globalThis.performance;return e&&typeof e.now=="function"?e.now():Date.now()},pxe=e=>{const{moduleId:t,instanceId:n,getFieldPathIdRegistry:r}=e,i=new Map,o=new Map;return{ensureEntry:d=>{const h=i.get(d.selectorId);return h?fn(h):re(function*(){const p=yield*sw(),g=d.reads.filter(S=>typeof S=="string").map(S=>Qr(S)).filter(S=>S!=null),y=Array.from(new Set(g.map(U1)));for(const S of y){const w=o.get(S);w?w.add(d.selectorId):o.set(S,new Set([d.selectorId]))}const b={selectorId:d.selectorId,readQuery:d,reads:g,readRootKeys:y,hub:p,subscriberCount:0,cachedAtTxnSeq:0,hasValue:!1,cachedValue:void 0};return i.set(d.selectorId,b),b})},releaseEntry:d=>{const h=i.get(d);if(h&&(h.subscriberCount=Math.max(0,h.subscriberCount-1),!(h.subscriberCount>0))){i.delete(d);for(const p of h.readRootKeys){const g=o.get(p);g&&(g.delete(d),g.size===0&&o.delete(p))}}},onCommit:(d,h,p,g,y)=>re(function*(){if(i.size===0)return;const b=g==="light"||g==="full"||g==="sampled",S=p.dirtyAll||p.rootIds.length===0?void 0:r?.(),w=I=>{if(!S||!Number.isFinite(I))return;const _=Math.floor(I);if(_<0)return;const M=S.fieldPaths[_];return M&&Array.isArray(M)?M:void 0};if(i.size===1){const I=i.values().next().value;if(!I||I.subscriberCount===0||!(()=>{if(p.dirtyAll||I.reads.length===0||!S)return!0;for(const N of p.rootIds){const L=w(N);if(!L)return!0;const B=U1(L);if(!(I.readRootKeys.length>0&&!I.readRootKeys.includes(B))){for(const j of I.reads)if(cz(L,j))return!0}}return!1})())return;let M;const C=b?pS():void 0;try{M=I.readQuery.select(d)}catch{b&&(yield*Ue({type:"diagnostic",moduleId:t,instanceId:n,txnSeq:h.txnSeq,txnId:h.txnId,code:"read_query::eval_error",severity:"error",message:"ReadQuery selector threw during evaluation.",hint:"Selectors must be pure and not throw; check the selector implementation and inputs.",kind:"read_query_eval_error",trigger:{kind:"read_query",name:"selector:eval",details:{selectorId:I.selectorId}}}));return}const E=b&&C!=null?Math.max(0,pS()-C):void 0,T=I.hasValue,A=I.cachedValue,U=T?uz(I.readQuery,A,M):!1,R=!T||!U;R&&(I.cachedValue=M,I.hasValue=!0,I.cachedAtTxnSeq=h.txnSeq,y?.(I.selectorId),yield*Sl(I.hub,{value:I.cachedValue,meta:h})),b&&(yield*Ue({type:"trace:selector:eval",moduleId:t,instanceId:n,txnSeq:h.txnSeq,txnId:h.txnId,data:{selectorId:I.selectorId,lane:I.readQuery.lane,producer:I.readQuery.producer,fallbackReason:I.readQuery.fallbackReason,readsDigest:I.readQuery.readsDigest,equalsKind:I.readQuery.equalsKind,changed:R,evalMs:E}}));return}const x=new Set;if(p.dirtyAll)for(const[I,_]of i.entries())_.subscriberCount>0&&x.add(I);else if(S)for(const I of p.rootIds){const _=w(I);if(!_){for(const[E,T]of i.entries())T.subscriberCount>0&&x.add(E);break}const M=U1(_),C=o.get(M);if(C)for(const E of C){if(x.has(E))continue;const T=i.get(E);if(!(!T||T.subscriberCount===0)){if(T.reads.length===0){x.add(E);continue}for(const A of T.reads)if(cz(_,A)){x.add(E);break}}}}else for(const[I,_]of i.entries())_.subscriberCount>0&&x.add(I);if(x.size!==0)for(const I of x){const _=i.get(I);if(!_||_.subscriberCount===0)continue;let M;const C=b?pS():void 0;try{M=_.readQuery.select(d)}catch{b&&(yield*Ue({type:"diagnostic",moduleId:t,instanceId:n,txnSeq:h.txnSeq,txnId:h.txnId,code:"read_query::eval_error",severity:"error",message:"ReadQuery selector threw during evaluation.",hint:"Selectors must be pure and not throw; check the selector implementation and inputs.",kind:"read_query_eval_error",trigger:{kind:"read_query",name:"selector:eval",details:{selectorId:I}}}));continue}const E=b&&C!=null?Math.max(0,pS()-C):void 0,T=_.hasValue,A=_.cachedValue,U=T?uz(_.readQuery,A,M):!1,R=!T||!U;R&&(_.cachedValue=M,_.hasValue=!0,_.cachedAtTxnSeq=h.txnSeq,y?.(I),yield*Sl(_.hub,{value:_.cachedValue,meta:h})),b&&(yield*Ue({type:"trace:selector:eval",moduleId:t,instanceId:n,txnSeq:h.txnSeq,txnId:h.txnId,data:{selectorId:I,lane:_.readQuery.lane,producer:_.readQuery.producer,fallbackReason:_.readQuery.fallbackReason,readsDigest:_.readQuery.readsDigest,equalsKind:_.readQuery.equalsKind,changed:R,evalMs:E}}))}})}},KW=new WeakMap,HW=new Map,mxe=(e,t)=>{KW.set(e,t)},gxe=e=>{KW.delete(e)},yxe=(e,t)=>{HW.set(e,t)},bxe=e=>{HW.delete(e)},vxe=e=>re(function*(){const t=yield*Ve(Oc),n=yield*Ve(Ip),r=yield*Ve(Us),i=yield*et(Jr),o=yield*et(Vc),a=yield*et(po);return{linkId:(yield*et(Cd))??e.nextLinkId(),runtimeLabel:o,diagnosticsLevel:i,debugSinks:a,overridesOpt:t,runtimeStoreOpt:n,tickSchedulerOpt:r}}),Sxe=(e,t)=>{const n=Ce(e.overridesOpt)?Kr(t,Oc,e.overridesOpt.value):t,r=Ce(e.runtimeStoreOpt)?Kr(n,Ip,e.runtimeStoreOpt.value):n;return(Ce(e.tickSchedulerOpt)?Kr(r,Us,e.tickSchedulerOpt.value):r).pipe(Cn(Cd,e.linkId),Cn(Vc,e.runtimeLabel),Cn(Jr,e.diagnosticsLevel),Cn(po,e.debugSinks))},wxe=e=>re(function*(){const t=yield*yh(),n=yield*yh(),r=yield*yh(),i=e.diagnostics;let o=0;const a=()=>(o+=1,`${e.instanceId}::l${o}`),c=yield*mr(),u=yield*Qn({backlogCount:0,waiters:0,signal:c}),d=yield*mr(),h=yield*Qn({backlogCount:0,waiters:0,signal:d}),p=S=>re(function*(){let w;const x=yield*mr();yield*bs(S,I=>{const _=I.backlogCount>0?I.backlogCount-1:0;return I.waiters<=0?{backlogCount:_,waiters:0,signal:I.signal}:(w=I.signal,{backlogCount:_,waiters:I.waiters,signal:x})}),w&&(yield*ri(w,void 0))}),g=(S,w)=>re(function*(){(yield*et(ii))&&(yield*Ue({type:"diagnostic",moduleId:e.moduleId,instanceId:e.instanceId,code:"state_transaction::enqueue_in_transaction",severity:"error",message:"enqueueTransaction is not allowed inside a synchronous StateTransaction body (it may deadlock or violate backpressure constraints).",hint:"Move dispatch/setState calls outside the transaction window, or use a multi-entry pattern (pending → IO → writeback).",kind:"enqueue_in_transaction"}),yield*Ci("enqueueTransaction is not allowed inside a synchronous StateTransaction body"));const I=S==="urgent"?u:h;let _;for(;;){const M=yield*e.resolveConcurrencyPolicy(),C=yield*xr(I,A=>A.backlogCount<w?[{_tag:"acquired"},{backlogCount:A.backlogCount+1,waiters:A.waiters,signal:A.signal}]:[{_tag:"wait",backlogCount:A.backlogCount,signal:A.signal},A]);if(C._tag==="acquired")return;const E=Date.now();_===void 0&&(_=E);const T=E-_;yield*i.emitPressureIfNeeded({policy:M,trigger:{kind:"txnQueue",name:`enqueueTransaction.${S}`},backlogCount:C.backlogCount,saturatedDurationMs:T}),yield*tH(bs(I,A=>({backlogCount:A.backlogCount,waiters:A.waiters+1,signal:A.signal})).pipe(vi(C.signal)),A=>kn(A),()=>bs(I,A=>({backlogCount:A.backlogCount,waiters:A.waiters>0?A.waiters-1:0,signal:A.signal})))}}),y=RA(re(function*(){for(yield*oy(r);;){const S=yield*Mj(t);if(Ce(S)){yield*S.value;continue}const w=yield*Mj(n);if(Ce(w)){yield*w.value;continue}break}}));return yield*Nn(y),(S,w)=>re(function*(){const x=w?S:"urgent",I=w||S,_=x==="urgent"?u:h,C=(yield*e.resolveConcurrencyPolicy()).losslessBackpressureCapacity;yield*g(x,C);const E=yield*mr(),T=yield*vxe({nextLinkId:a}),U=Sxe(T,I).pipe(en,$e(L=>ri(E,L)),Gt,Gi(p(_)));yield*Ic(ru([fr(x==="urgent"?t:n,U),fr(r,void 0)]));const N=yield*kn(E);return yield*Wi(N,{onFailure:L=>pr(L),onSuccess:L=>fn(L)})})}),dz=(e,t)=>e.hasOnErrorHandlers.pipe($e(n=>n||!t?ce:Ue({type:"diagnostic",moduleId:t,code:"lifecycle::missing_on_error",severity:"warning",message:`Module "${t}" received a lifecycle error but has no $.lifecycle.onError handler registered.`,hint:"Add $.lifecycle.onError((cause, context) => ...) at the beginning of this Module's logic to handle logic errors consistently."}))),fz=(e,t)=>Ye(()=>{const r=Ws(Vh(e)).find(a=>a&&typeof a=="object"&&a.name==="MissingModuleRuntimeError");if(!r)return ce;const i=typeof r.tokenId=="string"?r.tokenId:"<unknown module id>",o=Array.isArray(r.fix)&&r.fix.every(a=>typeof a=="string")?r.fix.join(`
50
+ `):void 0;return Ue({type:"diagnostic",moduleId:t,code:"assembly::missing_module_runtime",severity:"error",message:`Missing Module runtime provider for "${i}".`,hint:o??"Provide the child implementation in the same scope (imports), or provide a root singleton at app root.",kind:"assembly_failure"})}).pipe(qs),xxe=()=>dn(),kxe="Service not found:",V1=(e,t)=>re(function*(){let n;try{n=nu(e,{renderErrorCause:!0})}catch{return}n.includes(kxe)&&(yield*Ue({type:"diagnostic",moduleId:t,code:"logic::env_service_not_found",severity:"warning",message:n,hint:"Logic attempted to access an Env service before it was provided. This is a known initialization timing noise in Runtime/React integration. If it happens once during early startup and everything works afterward, it's likely harmless; if it persists or correlates with app issues, verify Runtime.make / RuntimeProvider.layer provides the service."}),yield*Ue({type:"diagnostic",moduleId:t,code:"logic::invalid_phase",severity:"error",message:"$.use is not allowed before Env is fully ready.",hint:"Avoid reading services during setup or before Env is ready; move Env access to the Logic run section, or wrap init via $.lifecycle.onInitRequired.",kind:"env_service_not_ready"}))}),EC=Go("@logixjs/LogicPhaseService");class WW extends Yt("@logixjs/LogicUnitService")(){}const hz=(e,t,n,r)=>Object.assign(new Error(`[LogicPhaseError] ${t} is not allowed in ${n} phase (kind=${e}).`),{_tag:"LogicPhaseError",kind:e,api:t,phase:n,moduleId:r}),K1=(e,t)=>re(function*(){if(!xxe())return;const n=[...Z0(e),...Vh(e)];for(const r of n){const i=r;if(i&&i._tag==="LogicPhaseError"){const o=i,a=o.kind==="use_in_setup"||o.kind==="lifecycle_in_setup"?"The setup phase must not read Env/services or run long-lived logic; move the relevant calls to the run phase.":o.kind==="lifecycle_in_run"?"Do not register $.lifecycle.* in the run phase (setup-only). Move lifecycle registrations to the synchronous part of Module.logic builder (before return).":o.kind==="traits_in_run"||o.kind==="traits_declare_in_run"?"Traits are frozen after setup; move $.traits.declare to LogicPlan.setup or the setup registration phase of Module.logic builder.":"Move logic to the run phase; keep setup for registrations only.";yield*Ue({type:"diagnostic",moduleId:o.moduleId??t,code:"logic::invalid_phase",severity:"error",message:`${o.api??o.kind} is not allowed in ${o.phase} phase.`,hint:a,kind:o.kind});return}}}),GW=Symbol.for("logix.module.logic.meta"),TO=e=>{if(!(!e||typeof e!="object"&&typeof e!="function"))return e[GW]},Ad=(e,t)=>{try{Object.defineProperty(e,GW,{value:t,enumerable:!1,configurable:!0})}catch{}return e},_xe=(e,t)=>{const n=TO(e);return Ad(e,{...n??{},...t})},TC=Go("@logixjs/Platform"),YW=Symbol.for("@logixjs/core/logicPlanEffect"),QW=Symbol.for("@logixjs/core/logicPhaseRef"),XW=Symbol.for("@logixjs/core/logicSkipRun"),CO=(e,t,n)=>{Object.defineProperty(e,t,{value:n,enumerable:!1,configurable:!0,writable:!1})},Ixe=e=>{!e||typeof e!="object"||CO(e,YW,!0)},CC=e=>!!(e&&typeof e=="object"&&e[YW]===!0),mS=(e,t)=>{!e||typeof e!="object"||CO(e,QW,t)},pc=e=>{if(!(!e||typeof e!="object"))return e[QW]},Exe=e=>{!e||typeof e!="object"||CO(e,XW,!0)},Txe=e=>!!(e&&typeof e=="object"&&e[XW]===!0),gS=()=>({current:"run"}),Cxe=e=>{const{tag:t,logics:n,runtime:r,lifecycle:i,moduleId:o,instanceId:a}=e,c=o;return re(function*(){const u=(_,M,C)=>{const E=Kr(Kr(_,yF,i),t,r),T=AA({"logix.moduleId":c})(E),A=C?Kr(T,WW,C):T;return M?Kr(A,EC,{get current(){return M.current}}):A},d=_=>re(function*(){const M=yield*Ve(Dc);if(Zt(M))return yield*_;const C=M.value,E=C.context??(yield*kn(C.ready)),T=yield*Yd(),A=_s(E,T);return yield*Ea(_,A)}),h=_=>_?`${_.file}:${_.line}:${_.column}`:void 0,p=(_,M)=>{const C=TO(_),E=C?.resolvedId??C?.id??`logic#${M+1}`,T=C?.resolvedIdKind??(C?.id?"explicit":"derived"),A=C?.resolvedName??C?.name??E,U=C?.resolvedKind??C?.kind,R=U&&U.length>0?`${U}:`:"",N=C?.resolvedSource??C?.source;return{logicUnitId:E,logicUnitIdKind:T,logicUnitLabel:`logicUnit:${R}${A}`,path:h(N)}},g=_=>{if(Ed(_))return pr(_);const M=[...Z0(_),...Vh(_)].some(E=>E?._tag==="LogicPhaseError"),C=i.notifyError(_,{phase:"run",hook:"unknown",moduleId:o,instanceId:a,origin:"logic.fork"}).pipe(ti(()=>dz(i,o)),ti(()=>fz(_,o)),ti(()=>_F(_,o)),ti(()=>V1(_,o)),ti(()=>K1(_,o)));return M?C:C.pipe($e(()=>pr(_)))},y=_=>Ed(_)?pr(_):ce.pipe(ti(()=>dz(i,o)),ti(()=>fz(_,o)),ti(()=>_F(_,o)),ti(()=>V1(_,o)),ti(()=>K1(_,o)),Ze(pr(_))),b=_=>!!(_&&typeof _=="object"&&"run"in _&&"setup"in _),S=(_,M)=>{const C=pc(_)??M??gS();if(b(_)){const T=_;return pc(T)||mS(T,C),T}const E={setup:ce,run:_};return mS(E,C),E},w=[];let x=0;for(const _ of n){const M=p(_,x);if(x+=1,b(_)){const T=pc(_)??gS(),A=u(_.setup,T,M),U=u(_.run,T,M);T.current="setup",yield*A.pipe(At(g)),w.push(Ye(()=>{T.current="run"}).pipe(Ze(Nn(U.pipe(At(g)))),Gt));continue}if(CC(_)){const T=pc(_)??gS(),A=()=>(()=>{const $={setup:ce,run:ce};return mS($,T),Exe($),$})();T.current="setup";const U=yield*u(_,T,M).pipe(jo({onSuccess:$=>fn(S($,T)),onFailure:$=>[...Z0($),...Vh($)].some(K=>K?._tag==="LogicPhaseError")?K1($,o).pipe(Ze(g($)),vi(A())):V1($,o).pipe(Ze(g($)),Ze(pr($)))})),R=!!pc(U),N=pc(U)??T;R||mS(U,N);const L=u(U.setup,N,M),B=u(U.run,N,M),j=Txe(U);N.current="setup",yield*L.pipe(At(g)),j||w.push(Ye(()=>{N.current="run"}).pipe(Ze(Nn(d(B).pipe(At(g)))),Gt));continue}const C=pc(_),E=u(_,C,M).pipe(At(g));w.push(re(function*(){const T=yield*Nn(d(E));yield*Nn(zc(T).pipe($e(A=>Wi(A,{onFailure:()=>ce,onSuccess:U=>{const R=N=>{const L=pc(N)??gS(),B=u(N.setup,L,M),j=u(N.run,L,M);return L.current="setup",B.pipe(At(g),Ze(Ye(()=>{L.current="run"}).pipe(Ze(Nn(d(j).pipe(At(g)))),Gt)))};return b(U)?R(U):CC(U)?u(U,C,M).pipe(rt(N=>S(N,C)),jo({onFailure:N=>g(N),onSuccess:N=>R(N)})):ce}}))))}))}yield*i.runInitRequired.pipe(At(y));const I=yield*Ve(TC);if(Ce(I)){const _=I.value,M=yield*i.getTaskSnapshot,C={current:"run"},E={get current(){return C.current}},T=U=>Kr(Kr(Kr(Kr(U,TC,_),yF,i),t,r),EC,E),A=(U,R)=>Nn(R(T(U==="suspend"?i.runPlatformSuspend:U==="resume"?i.runPlatformResume:i.runPlatformReset).pipe(Gt)).pipe(At(N=>i.notifyError(N,{phase:"platform",hook:U,moduleId:o,instanceId:a,origin:"platform.subscribe"})))).pipe(Gt);M.platformSuspend.length>0&&(yield*A("suspend",_.lifecycle.onSuspend)),M.platformResume.length>0&&(yield*A("resume",_.lifecycle.onResume)),M.platformReset.length>0&&typeof _.lifecycle.onReset=="function"&&(yield*A("reset",_.lifecycle.onReset))}yield*ln(w,_=>_,{discard:!0}),yield*i.runStart,yield*qc()})},Mxe=e=>`${e.kind}::${typeof e.name=="string"?e.name:""}`,Rxe=Nhe(e=>e.currentTimeMillis),Axe=e=>re(function*(){const t=yield*Qn({}),n=yield*Qn(!1),r=yield*Qn(!1);return{emitPressureIfNeeded:a=>re(function*(){const c=a.policy,u=a.backlogCount??0,d=a.saturatedDurationMs??0,h=c.pressureWarningThreshold;if(!(u>=h.backlogCount||d>=h.backlogDurationMs))return;const g=c.warningCooldownMs,y=yield*Rxe,b=Mxe(a.trigger),S=yield*xr(t,x=>{const I=x[b];return I&&y-I.lastEmittedAtMs<g?[{_tag:"suppress"},{...x,[b]:{lastEmittedAtMs:I.lastEmittedAtMs,suppressedCount:I.suppressedCount+1}}]:[{_tag:"emit",suppressedCount:I?.suppressedCount??0},{...x,[b]:{lastEmittedAtMs:y,suppressedCount:0}}]});if(S._tag==="suppress")return;const w={configScope:c.concurrencyLimitScope,limit:c.concurrencyLimit,backlogCount:u,saturatedDurationMs:d,threshold:{backlogCount:h.backlogCount,backlogDurationMs:h.backlogDurationMs},cooldownMs:g,degradeStrategy:S.suppressedCount>0?"cooldown":"none",suppressedCount:S.suppressedCount,sampleRate:1,droppedCount:0};typeof a.inFlight=="number"&&Number.isFinite(a.inFlight)&&(w.inFlight=a.inFlight),yield*Ue({type:"diagnostic",moduleId:e.moduleId,instanceId:e.instanceId,code:"concurrency::pressure",severity:"warning",message:"Concurrency pressure detected (backpressure / saturation).",hint:"Reduce trigger frequency, split work, switch to runLatest or batch processing; or tune concurrency/backpressure limits via concurrencyPolicy.",kind:"concurrency:pressure",trigger:{kind:a.trigger.kind,name:a.trigger.name,details:w}})}),emitUnboundedPolicyIfNeeded:a=>re(function*(){const c=a.policy;if(c.concurrencyLimit==="unbounded"&&c.allowUnbounded===!0){if(!(yield*xr(n,y=>y?[!1,!0]:[!0,!0])))return;const g={configScope:c.concurrencyLimitScope,limit:c.concurrencyLimit};yield*Ue({type:"diagnostic",moduleId:e.moduleId,instanceId:e.instanceId,code:"concurrency::unbounded_enabled",severity:"error",message:"Unbounded concurrency is enabled (risk: resource exhaustion).",hint:"Enable only for short-lived, controlled, cancelable fan-out; prefer bounded concurrency and increase gradually; avoid piling up long-running or never-ending tasks under unbounded.",kind:"concurrency:unbounded_enabled",trigger:{kind:a.trigger.kind,name:a.trigger.name,details:g}});return}if(!(c.requestedConcurrencyLimit==="unbounded"&&c.concurrencyLimit!=="unbounded")||!(yield*xr(r,p=>p?[!1,!0]:[!0,!0])))return;const h={configScope:c.requestedConcurrencyLimitScope,limit:c.requestedConcurrencyLimit};yield*Ue({type:"diagnostic",moduleId:e.moduleId,instanceId:e.instanceId,code:"concurrency::unbounded_requires_opt_in",severity:"error",message:"Unbounded concurrency was requested but is not allowed; falling back to bounded concurrency.",hint:"If you really need unbounded, explicitly set concurrencyPolicy.allowUnbounded = true; otherwise set concurrencyPolicy.concurrencyLimit to a positive integer limit.",kind:"concurrency:unbounded_blocked",trigger:{kind:a.trigger.kind,name:a.trigger.name,details:h}})})}});let pz=0;const Oxe=()=>(pz+=1,`i${pz}`),mz=(e,t={})=>re(function*(){const r=t.createState?yield*t.createState:yield*qbe(e),i=yield*sw(),o=yield*sw();let a=0;const c=M1(re(function*(){return a+=1,yield*ul(()=>Ye(()=>{a=Math.max(0,a-1)})),rg(i)})),u=t.moduleId??"unknown",d=QSe(t.instanceId)??Oxe(),h=kve(u,d),p=yield*et(Vc),g=yield*fSe({moduleId:u,instanceId:d,runtimeLabel:p}),y=yield*Axe({moduleId:t.moduleId,instanceId:d}),b=yield*Ve(dk),S=Ce(b)?b.value.instrumentation:void 0,w=t.stateTransaction?.instrumentation??S??Lve(),x=vwe({moduleId:t.moduleId,stateTransaction:t.stateTransaction}),I=ywe({moduleId:t.moduleId,diagnostics:y}),_=bwe({moduleId:t.moduleId,stateTransaction:t.stateTransaction}),M=t.createActionHub?yield*t.createActionHub:yield*re(function*(){const se=yield*I();return yield*sme(se.losslessBackpressureCapacity)}),C=128,E={program:void 0,convergePlanCache:void 0,convergeGeneration:{generation:0,generationBumpCount:0},pendingCacheMissReason:void 0,lastConvergeIrKeys:void 0,listConfigs:[]};let T=[],A=new Set;const U=new uwe(d),R=pxe({moduleId:u,instanceId:d,getFieldPathIdRegistry:()=>{const se=E.program?.convergeIr;if(!(!se||se.configError))return se.fieldPathIdRegistry}}),N=pSe({moduleId:u,instanceId:d,instrumentation:w,getFieldPathIdRegistry:()=>{const se=E.program?.convergeIr;if(!(!se||se.configError))return se.fieldPathIdRegistry}}),L=(se,ve,Ie,Me,Je,ot)=>{if(T.length>0){const Ae=N.current?.fieldPathIdRegistry,at=(ze=>{if(ze===void 0)return;if(ze==="*")return"*";if(typeof ze=="number"){if(!Ae||!Number.isFinite(ze))return"*";const sn=Math.floor(ze);if(sn<0)return"*";const _n=Ae.fieldPaths[sn];return _n&&Array.isArray(_n)?_n:"*"}if(typeof ze=="string"){if(!Ae)return"*";const sn=Ae.pathStringToId?.get(ze);if(sn==null)return"*";const _n=Ae.fieldPaths[sn];return _n&&Array.isArray(_n)?_n:"*"}return Qr(ze)??"*"})(se),_t=ze=>{const st=ze.owned??T[0],sn=st?st.join("."):"<unknown>",_n=ze.resolvedPath===void 0?"<unknown>":ze.resolvedPath==="*"?"*":ze.resolvedPath.join("."),ji=new Error(`[ExternalOwnedWriteError] State write overlaps an external-owned field.
51
+ moduleId=${t.moduleId??"unknown"}
52
+ instanceId=${d}
53
+ owned=${sn}
54
+ path=${_n}
55
+ reason=${String(ve)}
56
+ Fix: do not write external-owned fields via reducers/$.state.*; use StateTrait.externalStore to own the field, and avoid setState/state.update (root writes) on modules with external-owned fields.`);throw ji.name="ExternalOwnedWriteError",ji._tag="ExternalOwnedWriteError",ji.moduleId=t.moduleId,ji.instanceId=d,ji.reason=ve,ji.path=se,ji},Rt=ze=>ze===void 0||ze==="*"?_t({resolvedPath:ze}):ze;if(ve==="trait-external-store"){const ze=Rt(at),st=JSON.stringify(ze);A.has(st)||_t({resolvedPath:ze})}else{const ze=Rt(at);for(const st of T)(uy(st,ze)||uy(ze,st))&&_t({resolvedPath:ze,owned:st})}}vF(N,se,ve,Ie,Me,Je,ot)},B=se=>{N.current&&hl(N,se)},$={signal:yield*yh(),backlogDirtyPaths:new Set,backlogDirtyAllReason:void 0,firstPendingAtMs:void 0,lastTouchedAtMs:void 0,latestConvergeConfig:void 0,capturedContext:void 0},F={frozen:!1,contributions:[],snapshot:void 0},K=500,W=[],X=new Map,V=yield*HSe(),z=yield*MSe({moduleId:t.moduleId}),Q=yield*Ve(ASe),q=Ce(Q)?Q.value:void 0,ie=(se,ve)=>{const Ie=q?.implsByServiceId[se];if(!Ie||Ie.length===0)return ve;const Me=Ie,Je=new Set,ot=[];for(const Ae of ve)Je.add(Ae.implId),ot.push(Ae);for(const Ae of Me)!Ae||typeof Ae.implId!="string"||Ae.implId.length===0||Je.has(Ae.implId)||(Je.add(Ae.implId),ot.push(Ae));return ot},le=wxe({moduleId:t.moduleId,instanceId:d,resolveConcurrencyPolicy:I,diagnostics:y}),ee=oS("txnQueue",ie("txnQueue",[{implId:"builtin",implVersion:"v1",make:le},{implId:"trace",implVersion:"v1",make:le,notes:"no-op wrapper (used for override isolation tests)"}]),z),J=yield*ee.impl.make.pipe(Kr(sS,{getBuiltinMake:se=>se==="txnQueue"?le:Ci(`[Logix] builtin make not available: ${se}`)})),ge=fn(a0e({optionsModuleId:t.moduleId,instanceId:d,txnContext:N})),te=oS("operationRunner",ie("operationRunner",[{implId:"builtin",implVersion:"v1",make:ge}]),z),pe=yield*te.impl.make.pipe(Kr(sS,{getBuiltinMake:se=>se==="operationRunner"?ge:Ci(`[Logix] builtin make not available: ${se}`)}));yield*pe("lifecycle","module:init",{meta:{moduleId:u,instanceId:d}},Ue({type:"module:init",moduleId:u,instanceId:d}));const oe=yield*xg(r);yield*pe("state","state:init",{meta:{moduleId:u,instanceId:d}},Ue({type:"state:update",moduleId:u,state:oe,instanceId:d,txnSeq:0}));const ye=yield*Ve(Ip);Ce(ye)&&ye.value.registerModuleInstance({moduleId:u,instanceId:d,moduleInstanceKey:h,initialState:oe});const xe=yield*Ve(Dc),je=Ce(xe)?xe.value:void 0,Ge=yield*Ve(Us);let it=Ce(Ge)?Ge.value:void 0;const ut=((se,ve)=>re(function*(){if(!it){const Ie=yield*Ve(Us);if(Ce(Ie))it=Ie.value;else if(je?.context){const Me=Ai(je.context,Us);Ce(Me)&&(it=Me.value)}}return yield*ve!==void 0?J(se,ve):J(se)})),Dt=Ye(()=>mwe({moduleId:u,optionsModuleId:t.moduleId,instanceId:d,stateRef:r,commitHub:i,shouldPublishCommitHub:()=>a>0,recordStatePatch:L,onCommit:({state:se,meta:ve,dirtySet:Ie,diagnosticsLevel:Me})=>re(function*(){let Je=it;if(!Je){const Ae=yield*Ve(Us);Ce(Ae)&&(Je=Ae.value,it=Ae.value)}let ot=je;if(!ot){const Ae=yield*Ve(Dc);Ce(Ae)&&(ot=Ae.value)}if(!Je&&ot?.context){const Ae=Ai(ot.context,Us);Ce(Ae)&&(Je=Ae.value,it=Ae.value)}if(!Je&&Me!=="off"&&dn()&&(yield*Ue({type:"diagnostic",moduleId:u,instanceId:d,txnSeq:ve.txnSeq,txnId:ve.txnId,trigger:{kind:ve.originKind??"unknown",name:ve.originName??ve.originKind??"unknown"},code:"tick_scheduler::missing_service",severity:"error",message:"TickScheduler service is not visible in ModuleRuntime.onCommit; tickSeq will not advance and RuntimeStore subscribers will not flush.",hint:"Ensure TickSchedulerTag is available in the fiber Env for logic/task/txnQueue execution (AppRuntime baseLayer + RootContext wiring).",kind:"missing_tick_scheduler"})),yield*R.onCommit(se,ve,Ie,Me,Je?Ae=>{Je.onSelectorChanged({moduleInstanceKey:h,selectorId:Ae,priority:ve.priority})}:void 0),Je){const Ae=yield*et(cC),Mt=typeof Ae=="number"&&Number.isFinite(Ae)&&Ae>=0?Math.floor(Ae):void 0;yield*Je.onModuleCommit({moduleId:u,instanceId:d,moduleInstanceKey:h,state:se,meta:ve,opSeq:Mt})}}),enqueueTransaction:ut,runOperation:pe,txnContext:N,traitConvergeTimeSlicing:$,traitRuntime:{getProgram:()=>E.program,getConvergePlanCache:()=>E.convergePlanCache,getConvergeGeneration:()=>E.convergeGeneration,getPendingCacheMissReason:()=>E.pendingCacheMissReason,setPendingCacheMissReason:se=>{E.pendingCacheMissReason=se},rowIdStore:U,getListConfigs:()=>E.listConfigs},resolveTraitConvergeConfig:x,isDevEnv:dn,maxTxnHistory:K,txnHistory:W,txnById:X})),Ct=oS("transaction",ie("transaction",[{implId:"builtin",implVersion:"v1",make:Dt}]),z),{readState:wt,setStateInternal:Jn,runWithStateTransaction:yt}=yield*Ct.impl.make.pipe(Kr(sS,{getBuiltinMake:se=>se==="transaction"?Dt:Ci(`[Logix] builtin make not available: ${se}`)}));let pn=0,$t=0;const On=se=>{let ve=0,Ie,Me;const Je={dirtyPathCount:se.dirtyPathsSnapshot.length};return se.dirtyAllReason&&(Je.dirtyAllReason=se.dirtyAllReason),se.slice&&(Je.sliceStart=se.slice.start,Je.sliceEnd=se.slice.end,Je.sliceTotal=se.slice.total),ut(se.lane,pe("lifecycle","trait:deferredConvergeFlush",{payload:{dirtyPathCount:se.dirtyPathsSnapshot.length},meta:{moduleId:u,instanceId:d}},yt({kind:"trait:deferred_flush",name:"trait:deferredConvergeFlush",details:Je},()=>re(function*(){const ot=N.current;if(ot&&(ve=ot.txnSeq,Ie=ot.txnId),se.captureOpSeq){const Ae=yield*et(cC);typeof Ae=="number"&&Number.isFinite(Ae)&&Ae>=0&&(Me=Math.floor(Ae))}if(ot){se.dirtyAllReason&&(ot.dirtyAllReason=se.dirtyAllReason);for(const Ae of se.dirtyPathsSnapshot)typeof Ae=="number"&&Number.isFinite(Ae)&&Ae>=0&&ot.dirtyPathIds.add(Math.floor(Ae))}})))).pipe(vi({txnSeq:ve,txnId:Ie,opSeq:Me}))};yield*Nn(RA(re(function*(){for(yield*oy($.signal);;){const Cr=$.latestConvergeConfig?.traitConvergeTimeSlicing;if(!Cr?.enabled){$.backlogDirtyPaths.clear(),$.backlogDirtyAllReason=void 0,$.firstPendingAtMs=void 0,$.lastTouchedAtMs=void 0;return}const zn=Date.now(),Mr=$.firstPendingAtMs??zn;$.firstPendingAtMs=Mr;const oa=$.capturedContext,Qo=yield*oa?.overrides?Kr(_(),Oc,oa.overrides):_(),So=Qo.enabled?Qo.debounceMs:Cr.debounceMs,Br=Qo.enabled?Qo.maxLagMs:Cr.maxLagMs,Ba=Math.max(0,zn-Mr),wo=Math.max(0,Br-Ba);if(wo<=0)break;const Hn=Math.max(0,Math.min(So,wo));Hn>0?yield*Lhe(Il(Hn)):yield*qc();const uu=yield*Rj($.signal);if(op(uu))break}const se=Array.from($.backlogDirtyPaths);$.backlogDirtyPaths.clear();const ve=$.backlogDirtyAllReason;$.backlogDirtyAllReason=void 0;const Ie=$.firstPendingAtMs;if($.firstPendingAtMs=void 0,$.lastTouchedAtMs=void 0,se.length===0&&!ve)return;const Me=E.program;if(!Me?.convergeExecIr||Me.convergeExecIr.topoOrderDeferredInt32.length===0)return;const Je=$.capturedContext,ot=yield*Je?.overrides?Kr(_(),Oc,Je.overrides):_(),Ae=Je!=null&&Je.diagnosticsLevel!=="off",Mt=Ae&&(ot.enabled||ot.overrideMode!=null),at=Cr=>{let zn=Cr;return Je?.overrides&&(zn=Kr(zn,Oc,Je.overrides)),Je&&(zn=zn.pipe(Cn(Vc,Je.runtimeLabel),Cn(Jr,Je.diagnosticsLevel),Cn(po,Je.debugSinks))),zn},_t=Ie??Date.now();if(!ot.enabled){const Cr=yield*at(On({dirtyPathsSnapshot:se,dirtyAllReason:ve,lane:"urgent",captureOpSeq:Mt}));if(Mt){const zn=ot.overrideMode==="forced_off"?["forced_off"]:ot.overrideMode==="forced_sync"?["forced_sync"]:["disabled"],Mr={anchor:{moduleId:u,instanceId:d,txnSeq:Cr.txnSeq,...typeof Cr.opSeq=="number"?{opSeq:Cr.opSeq}:{}},lane:"urgent",kind:"trait:deferred_flush",policy:ot,backlog:{pendingCount:0,ageMs:Math.max(0,Date.now()-_t),coalescedCount:pn,canceledCount:$t},starvation:{triggered:!1},reasons:zn};yield*at(Ue({type:"trace:txn-lane",moduleId:u,instanceId:d,txnSeq:Cr.txnSeq,txnId:Cr.txnId,data:{evidence:Mr}}))}return}const Rt=Me.convergeExecIr.topoOrderDeferredInt32.length;let ze=0,st=Math.min(32,Rt),sn=0,_n=Date.now();const ji=()=>{const zn=globalThis.navigator?.scheduling,Mr=zn?.isInputPending;if(typeof Mr!="function")return!1;try{return!!Mr.call(zn)}catch{return!1}};for(;ze<Rt;){const Cr=Math.max(0,Date.now()-_t),zn=Cr>=ot.maxLagMs,Mr=zn?Math.max(ot.budgetMs,ot.budgetMs*4):ot.budgetMs,oa=ze,Qo=Math.min(Rt,ze+st),{sliceDurationMs:So,anchor:Br}=yield*at(re(function*(){const ql=Date.now(),Zd=yield*On({dirtyPathsSnapshot:se,dirtyAllReason:ve,lane:"nonUrgent",slice:{start:oa,end:Qo,total:Rt},captureOpSeq:Ae});return{sliceDurationMs:Math.max(0,Date.now()-ql),anchor:Zd}}));ze=Qo,yield*Rj($.signal);const Ba=$.backlogDirtyPaths.size>0||$.backlogDirtyAllReason!=null,wo=ot.allowCoalesce&&!zn&&Ba,Hn=Math.max(0,Date.now()-_n),uu=Mr>0&&Number.isFinite(Mr)&&Hn>=Mr,Rb=Hn>=16,sa=!wo&&ot.yieldStrategy==="inputPending"?ji():!1,aa=ze<Rt&&!wo&&(sa||uu||Rb),Ab=aa?sa?"input_pending":uu?"budget_exceeded":"forced_frame_yield":"none";if(Ae&&(yield*at(re(function*(){const ql=["queued_non_urgent"];zn&&ql.push("max_lag_forced","starvation_protection"),Ab==="budget_exceeded"&&ql.push("budget_yield");const Zd={anchor:{moduleId:u,instanceId:d,txnSeq:Br.txnSeq,...typeof Br.opSeq=="number"?{opSeq:Br.opSeq}:{}},lane:"nonUrgent",kind:"trait:deferred_flush",policy:ot,backlog:{pendingCount:Math.max(0,Rt-Qo),ageMs:Cr,coalescedCount:pn,canceledCount:$t},budget:{budgetMs:Mr,sliceDurationMs:So,yieldCount:sn,yielded:aa,yieldReason:Ab},starvation:zn?{triggered:!0,reason:"max_lag_exceeded"}:{triggered:!1},reasons:ql};yield*Ue({type:"trace:txn-lane",moduleId:u,instanceId:d,txnSeq:Br.txnSeq,txnId:Br.txnId,data:{evidence:Zd}})}))),wo){pn+=1,$t+=1,Ae&&(yield*at(Ue({type:"trace:txn-lane",moduleId:u,instanceId:d,txnSeq:Br.txnSeq,txnId:Br.txnId,data:{evidence:{anchor:{moduleId:u,instanceId:d,txnSeq:Br.txnSeq,...typeof Br.opSeq=="number"?{opSeq:Br.opSeq}:{}},lane:"nonUrgent",kind:"trait:deferred_flush",policy:ot,backlog:{pendingCount:Math.max(0,Rt-ze),ageMs:Cr,coalescedCount:pn,canceledCount:$t},budget:{budgetMs:Mr,sliceDurationMs:So,yieldCount:sn,yielded:!1,yieldReason:"none"},starvation:{triggered:!1},reasons:["coalesced","canceled"]}}}))),yield*fr($.signal,void 0);break}Mr>0&&Number.isFinite(Mr)&&(So>Mr&&st>1?st=Math.max(1,Math.floor(st/2)):So<Mr/2&&(st=Math.min(Rt,st*2))),aa&&(sn+=1,_n=Date.now(),yield*qc())}($.backlogDirtyPaths.size>0||$.backlogDirtyAllReason!=null)&&(yield*fr($.signal,void 0))})));const he=(()=>{const se=t.tag?.shape?.actionMap;if(!(!se||typeof se!="object"))return new Set(Object.keys(se))})(),_e=Ye(()=>l0e({optionsModuleId:t.moduleId,instanceId:d,declaredActionTags:he,initialReducers:t.reducers,txnContext:N,readState:wt,setStateInternal:Jn,recordStatePatch:L,actionHub:M,actionCommitHub:o,diagnostics:y,enqueueTransaction:ut,resolveConcurrencyPolicy:I,runOperation:pe,runWithStateTransaction:yt,isDevEnv:dn})),Pe=oS("dispatch",ie("dispatch",[{implId:"builtin",implVersion:"v1",make:_e}]),z),Ke=yield*Pe.impl.make.pipe(Kr(sS,{getBuiltinMake:se=>se==="dispatch"?_e:Ci(`[Logix] builtin make not available: ${se}`)})),dt=OSe({moduleId:t.moduleId,instanceId:d,bindings:[ee.binding,te.binding,Ct.binding,Pe.binding],overridesApplied:[...ee.overridesApplied,...te.overridesApplied,...Ct.overridesApplied,...Pe.overridesApplied]});if(V.kernelId!=="core"){const se=yield*Ve(ISe);if((Ce(se)?se.value:"trial")==="fullCutover"){const Ie=zSe({mode:"fullCutover",requestedKernelId:V.kernelId,runtimeServicesEvidence:dt,diagnosticsLevel:dn()?"light":"off"});if(Ie.verdict==="FAIL"){const Me=dn()?["[FullCutoverGateFailed] Runtime assembly detected implicit fallback / missing bindings under fullCutover mode.",`requestedKernelId: ${V.kernelId}`,`missingServiceIds: ${Ie.missingServiceIds.join(",")}`,`fallbackServiceIds: ${Ie.fallbackServiceIds.join(",")}`,`anchor: moduleId=${Ie.anchor.moduleId}, instanceId=${Ie.anchor.instanceId}, txnSeq=${Ie.anchor.txnSeq}`].join(`
57
+ `):"Full cutover gate failed",Je=new Error(Me);throw Je.name="FullCutoverGateFailed",Je.gate=Ie,Je.instanceId=d,Je.moduleId=t.moduleId,Je}}}const tn={moduleId:u,instanceId:d,lifecycleStatus:g.getStatus,getState:wt,setState:se=>Jn(se,"*","unknown",void 0,se),dispatch:se=>Ke.dispatch(se),dispatchBatch:se=>Ke.dispatchBatch(se),dispatchLowPriority:se=>Ke.dispatchLowPriority(se),actions$:rg(M),actionsWithMeta$:rg(o),changes:se=>Hs(r.changes,se).pipe(Qj),changesWithMeta:se=>Hs(c,({value:ve,meta:Ie})=>({value:se(ve),meta:Ie})),changesReadQueryWithMeta:se=>{const ve=se?.staticIr!=null&&typeof se?.lane=="string"&&typeof se?.producer=="string"?se:VW(se);return ve.lane!=="static"?M1(re(function*(){const Ie=yield*Ve(dW);if(Ce(Ie)){const Me=fxe({config:Ie.value,moduleId:u,instanceId:d,txnSeq:0,compiled:ve});Me.verdict==="WARN"?yield*Ue(Me.diagnostic):Me.verdict==="FAIL"&&(yield*Ue(Me.diagnostic),yield*ty(Me.error))}return Hs(c,({value:Me,meta:Je})=>({value:ve.select(Me),meta:Je}))})):M1(re(function*(){const Ie=yield*R.ensureEntry(ve);if(Ie.subscriberCount+=1,yield*ul(()=>Ye(()=>{R.releaseEntry(ve.selectorId)})),!Ie.hasValue){const Me=yield*wt;try{Ie.cachedValue=ve.select(Me),Ie.hasValue=!0,Ie.cachedAtTxnSeq=0}catch{}}return rg(Ie.hub)}))},ref:se=>{if(!se)return r;const ve={get:rt(xg(r),se),modify:()=>Ci("Cannot write to a derived ref")};return{ref:ve,pubsub:{publish:()=>fn(!0)},semaphore:{withPermits:()=>Me=>Me},get:ve.get,modify:ve.modify,changes:Hs(r.changes,se).pipe(Qj)}}};YSe(tn,V),NSe(tn,dt);const Fn=yield*Ve(i0e);Ce(Fn)&&(Fn.value.setKernelImplementationRef(V),(yield*et(Jr))!=="off"&&Fn.value.setRuntimeServicesEvidence(dt));const mn=yield*et(cW),Qe=se=>{if(mn.length!==0)for(const ve of mn)ve.register(se)},Ne=new Map;yield*ul(()=>Ye(()=>{Ne.clear()}));const He=new Map;for(const se of t.imports??[]){const ve=yield*Ve(se);Ce(ve)&&He.set(se,ve.value)}const kt={kind:"imports-scope",get:se=>He.get(se)},cn=t.moduleId!=null?`${t.moduleId}::${d}`:void 0;cn&&yxe(cn,tn);const Dn=(se,ve)=>{const Ie=se.convergeIr,Me=Ie?{writersKey:Ie.writersKey,depsKey:Ie.depsKey}:void 0,Je=ve?.bumpReason;let ot;if(E.lastConvergeIrKeys&&Me?Je?ot=Je:E.lastConvergeIrKeys.writersKey!==Me.writersKey?ot="writers_changed":E.lastConvergeIrKeys.depsKey!==Me.depsKey&&(ot="deps_changed"):E.lastConvergeIrKeys&&!Me&&(ot=Je??"unknown"),ot){const Rt=E.convergeGeneration.generation+1,ze=(E.convergeGeneration.generationBumpCount??0)+1;E.convergeGeneration={generation:Rt,generationBumpCount:ze,lastBumpReason:ot},E.pendingCacheMissReason="generation_bumped",E.convergePlanCache=new EF(C)}E.lastConvergeIrKeys=Me;const Ae=Ie?{...Ie,generation:E.convergeGeneration.generation}:void 0,Mt=Ae&&!Ae.configError?EW(Ae):void 0;E.program={...se,convergeIr:Ae,convergeExecIr:Mt},E.listConfigs=dwe(se.spec);const at=(se?.entries??[]).filter(Rt=>Rt&&Rt.kind==="externalStore"&&typeof Rt.fieldPath=="string").map(Rt=>Qr(Rt.fieldPath)).filter(Rt=>Rt!=null).sort(fk);T=at,A=new Set(at.map(Rt=>JSON.stringify(Rt))),E.convergePlanCache||(E.convergePlanCache=new EF(C)),ve?.exportStaticIr!==!1&&Ae&&!Ae.configError&&mn.length>0&&Qe(p0e({ir:Ae,moduleId:t.moduleId??"unknown",instanceId:d}))};if(!E.program){const se=t.tag?.stateSchema;if(se)try{Dn(jW(se,{}),{exportStaticIr:!1})}catch{}}const vo=se=>{if(!N.current)return;const ve=N.current,Ie=ve.stateTraitValidateRequests??[];Ie.push(se),ve.stateTraitValidateRequests=Ie},Yo=se=>{if(!N.current)return;const ve=N.current;ve.lastReplayEvent={...se,txnId:ve.txnId,trigger:ve.origin}},Zr=(se,ve)=>ut(pe(se.kind,se.name?`txn:${se.name}`:"txn",{meta:{moduleId:t.moduleId,instanceId:d}},yt(se,ve))),$i=(se,ve)=>ut(re(function*(){if(!dn())return;const Ie=X.get(se);if(!Ie)return;const Me=ve==="before"?Ie.initialStateSnapshot:Ie.finalStateSnapshot;Me!==void 0&&(yield*yt({kind:"devtools",name:"time-travel",details:{baseTxnId:se,mode:ve}},()=>Ye(()=>{hl(N,Me),vF(N,"*","devtools")})))})),Es=t.tag?.stateSchema,ci=h0e({moduleId:t.moduleId,instanceId:d,actions$:tn.actions$}),Le={moduleId:t.moduleId,instanceId:d,stateSchema:Es,lifecycle:{registerInitRequired:(se,ve)=>{g.registerInitRequired(se,ve)},registerStart:(se,ve)=>{g.registerStart(se,ve)},registerDestroy:(se,ve)=>{g.registerDestroy(se,ve)},registerOnError:se=>{g.registerOnError(se)},registerPlatformSuspend:(se,ve)=>{g.registerPlatformSuspend(se,ve)},registerPlatformResume:(se,ve)=>{g.registerPlatformResume(se,ve)},registerPlatformReset:(se,ve)=>{g.registerPlatformReset(se,ve)}},imports:kt,txn:{instrumentation:w,registerReducer:Ke.registerReducer,runWithStateTransaction:Zr,updateDraft:B,recordStatePatch:L,recordReplayEvent:Yo,applyTransactionSnapshot:$i},concurrency:{resolveConcurrencyPolicy:I},txnLanes:{resolveTxnLanePolicy:_},traits:{rowIdStore:U,getListConfigs:()=>E.listConfigs,registerSourceRefresh:(se,ve)=>{Ne.set(se,ve)},getSourceRefreshHandler:se=>Ne.get(se),registerStateTraitProgram:Dn,enqueueStateTraitValidateRequest:vo,registerModuleTraitsContribution:se=>{if(F.frozen)throw new Error("[ModuleTraitsFrozen] Cannot register traits contribution after finalize/freeze.");F.contributions.push(se)},freezeModuleTraits:()=>{F.frozen=!0},getModuleTraitsContributions:()=>F.contributions,getModuleTraitsSnapshot:()=>F.snapshot,setModuleTraitsSnapshot:se=>{F.snapshot=se}},effects:{registerEffect:se=>ci.registerEffect(se)},devtools:{registerConvergeStaticIr:Qe}};if(yield*Rwe({runtime:tn,runtimeInternals:Le}),yield*ul(()=>Ye(()=>{He.clear()})),yield*ul(()=>Ye(()=>{Ce(ye)&&ye.value.unregisterModuleInstance(h)})),t.tag&&mxe(t.tag,tn),yield*ul(()=>g.runDestroy.pipe($e(()=>pe("lifecycle","module:destroy",{meta:{moduleId:t.moduleId,instanceId:d}},Ue({type:"module:destroy",moduleId:t.moduleId,instanceId:d}))),ti(()=>Ye(()=>{t.tag&&gxe(t.tag),cn&&bxe(cn)})))),t.tag&&t.logics?.length&&(yield*Cxe({tag:t.tag,logics:t.logics,runtime:tn,lifecycle:g,moduleId:u,instanceId:d})),t.processes&&t.processes.length>0){const se=yield*Yd(),ve=Ai(se,Dc);if(!(Ce(ve)&&Array.isArray(ve.value.appModuleIds)&&ve.value.appModuleIds.includes(u))){const Me=Ai(se,EO),Je=Ce(Me)?Me.value:void 0,ot={type:"moduleInstance",moduleId:u,instanceId:d};yield*ln(t.processes,Ae=>re(function*(){if(Je){const Mt=Je.install(Ae,{scope:ot,enabled:!0,installedAt:"moduleRuntime"});if((t.tag?yield*Mt.pipe(Kr(t.tag,tn)):yield*Mt)!==void 0)return}yield*Nn(Ae)}),{discard:!0})}}return tn}),Dxe=(e,t)=>Qh(e,t),Pxe=e=>{if(typeof e=="string")return e.trim().length>0?"*":void 0;if(!Array.isArray(e))return;const t=[];for(const n of e)if(typeof n=="string"){s0(n)&&t.push(n);continue}return t.length===0?"*":t},xw=(e,t)=>{const n=Qh(e,t,{enablePatches:{pathAsArray:!0,arrayLengthAssignment:!1}});if(!Array.isArray(n))return{nextState:n,patchPaths:[]};const r=n[0],i=n[1]??[],o=new Map;for(const a of i){const c=Pxe(a?.path);if(!c)continue;const u=c==="*"?"*":JSON.stringify(c);o.has(u)||o.set(u,c)}return{nextState:r,patchPaths:Array.from(o.values())}},Nxe=()=>Ve(Uc).pipe(rt(e=>Ce(e)?e.value.stack:[])),Lxe=e=>{if(!e)return{};if(typeof e!="object"&&typeof e!="function")return{};const t=e;return{moduleId:typeof t.moduleId=="string"?t.moduleId:void 0,instanceId:typeof t.instanceId=="string"?t.instanceId:void 0}},$xe=(e,t)=>typeof e=="function"?e(t):e,JW=(e,t)=>{const n=Lxe(e),r=()=>t?t.concurrency.resolveConcurrencyPolicy().pipe(rt(u=>u.concurrencyLimit)):fn(16),i=(u,d,h,p)=>re(function*(){const g=yield*Nxe(),y={...p?.meta??{},policy:p?.policy,tags:p?.tags,trace:p?.trace,moduleId:n.moduleId,instanceId:n.instanceId};if(!(typeof y.opSeq=="number"&&Number.isFinite(y.opSeq))){const S=yield*Ve(Pa);if(Ce(S)){const w=y.instanceId??"global";y.opSeq=S.value.local.nextSeq("opSeq",w)}}const b=hy({kind:"flow",name:u,payload:d,effect:h,meta:y});return yield*Yh(b,g)}),o=u=>d=>$xe(u,d),a=(u,d)=>h=>Ml(h,p=>i("flow.run",p,o(u)(p),d)),c=(u,d)=>h=>re(function*(){const p=yield*r();return yield*vh(h.pipe(cy(g=>i("flow.runParallel",g,o(u)(g),d),{concurrency:p}))).pipe(At(g=>Ue({type:"diagnostic",moduleId:n.moduleId,instanceId:n.instanceId,code:"flow::unhandled_failure",severity:"error",message:"Flow watcher (runParallel) failed with an unhandled error.",hint:"Handle errors explicitly inside the watcher (catch/catchAll) or write back via TaskRunner failure; avoid silent failures.",kind:"flow_unhandled_failure",trigger:{kind:"flow",name:"runParallel"}}).pipe(Ze(pr(g)))))});return{fromAction:u=>e.actions$.pipe(zs(u)),fromState:u=>e.changes(qW(u)?u.select:u),debounce:u=>d=>Ibe(d,u),throttle:u=>d=>Obe(d,{cost:()=>1,units:1,duration:u,strategy:"enforce"}),filter:u=>d=>zs(d,u),run:(u,d)=>h=>a(u,d)(h),runParallel:(u,d)=>h=>c(u,d)(h),runLatest:(u,d)=>h=>vh(Hs(h,p=>i("flow.runLatest",p,o(u)(p),d)).pipe(Tbe(p=>Cbe(p),{switch:!0}))),runExhaust:(u,d)=>h=>re(function*(){const p=yield*r(),g=yield*Qn(!1),y=b=>re(function*(){if(yield*xr(g,w=>w?[!1,w]:[!0,!0]))try{yield*i("flow.runExhaust",b,o(u)(b),d)}finally{yield*_d(g,!1)}});return yield*vh(h.pipe(cy(y,{concurrency:p})))})}},jxe=e=>{let t;const n={with:(r,i)=>(t||r(e)&&(t=i(e)),n),otherwise:r=>t||r(e),exhaustive:()=>t||Ci("[FluentMatch] Non-exhaustive match: no pattern matched value")};return n},Fxe=e=>{let t;const n={with:(r,i)=>(t||e._tag===r&&(t=i(e)),n),otherwise:r=>t||r(e),exhaustive:()=>t||Ci("[FluentMatchTag] Non-exhaustive match: no tag handler matched value")};return n},zxe=e=>typeof e?.id=="string"?String(e.id):typeof e?.key=="string"?String(e.key):"<unknown tag>",gz=(e,t,n)=>{const r=dn(),i=zxe(e),o=r?["- Provide it when creating the runtime tree (Logix.Runtime.make(...,{ layer }) / ManagedRuntime.make(Layer.mergeAll(...))).","- If you're in React and want the current runtime environment singleton, use useModule(ModuleTag).","- Do not rely on nested RuntimeProvider.layer to mock Root.resolve."]:[],a=r?["[MissingRootProviderError] Cannot resolve Tag from root provider.",n?`
58
+ ${n}`:"",`tokenId: ${i}`,`entrypoint: ${t}`,"mode: global","startScope: root","","fix:",...o].filter(u=>u.length>0).join(`
59
+ `):"[MissingRootProviderError] tag not found in root provider",c=new Error(a);return c.name="MissingRootProviderError",c.tokenId=i,c.entrypoint=t,c.mode="global",c.startScope={kind:"root"},c.fix=o,c},Bxe=(e,t)=>re(function*(){const n=t?.entrypoint??"logic.root.resolve",r=yield*Dc,i=r.context??(t?.waitForReady?yield*r.ready:void 0);if(!i)return yield*ty(gz(e,n,"reason: rootContextNotReady"));try{return Oa(i,e)}catch{return yield*ty(gz(e,n))}}),ag=(e,t)=>{const n=JW(e,t);return(r,i)=>{const o=(d,h)=>t.txn.runWithStateTransaction(d,h),a={moduleId:e.moduleId,instanceId:t.instanceId,runWithStateTransaction:o,resolveConcurrencyPolicy:t.concurrency.resolveConcurrencyPolicy},c={debounce:d=>ag(e,t)(n.debounce(d)(r),i),throttle:d=>ag(e,t)(n.throttle(d)(r),i),filter:d=>ag(e,t)(n.filter(d)(r),i),map:d=>ag(e,t)(r.pipe(Hs(d)),i),run(d,h){return n.run(d,h)(r)},runLatest(d,h){return n.runLatest(d,h)(r)},runExhaust(d,h){return n.runExhaust(d,h)(r)},runParallel(d,h){return n.runParallel(d,h)(r)},runFork:d=>Nn(n.run(d)(r)).pipe(Gt),runParallelFork:d=>Nn(n.runParallel(d)(r)).pipe(Gt),runTask:d=>nS(r,"task",a,{...d,triggerName:d.triggerName??i}),runParallelTask:d=>nS(r,"parallel",a,{...d,triggerName:d.triggerName??i}),runLatestTask:d=>nS(r,"latest",a,{...d,triggerName:d.triggerName??i}),runExhaustTask:d=>nS(r,"exhaust",a,{...d,triggerName:d.triggerName??i}),toStream:()=>r,update:d=>Ml(r,h=>a.runWithStateTransaction({kind:"watcher:update",name:i},()=>re(function*(){const p=yield*e.getState,g=d(p,h);if(Gd(g)){const y=yield*en(g);if(y._tag==="Failure"){yield*Rc("Flow error",y.cause);return}yield*e.setState(y.value);return}yield*e.setState(g)}))).pipe(At(h=>Rc("Flow error",h))),mutate:d=>Ml(r,h=>a.runWithStateTransaction({kind:"watcher:mutate",name:i},()=>re(function*(){const p=yield*e.getState,g=t.txn.recordStatePatch,y=t.txn.updateDraft,{nextState:b,patchPaths:S}=xw(p,w=>{d(w,h)});for(const w of S)g(w,"unknown");y(b)}))).pipe(At(h=>Rc("Flow error",h)))};return Object.assign(c,{pipe:function(){const d=arguments;let h=c;for(let p=0;p<d.length;p++)h=d[p](h);return h}})}};function qxe(e,t,n){const r=Cp(t),i=n?.getPhase??(()=>"run"),o=()=>(n?.phaseService?.current??i())==="setup"?"setup":"run",a=(L,B)=>{if((n?.phaseService?.current??i())==="setup")throw hz(L,B,"setup",n?.moduleId)},c=JW(t,r),u=L=>ag(L,r),d=L=>Ue({type:"diagnostic",moduleId:t.moduleId,instanceId:t.instanceId,code:"logic::invalid_phase",severity:"error",message:`${L} is setup-only and is not allowed in run phase.`,hint:"Move $.lifecycle.* calls to the synchronous part of Module.logic builder (before return) for registration; for dynamic resource cleanup in the run phase, use Effect.acquireRelease / Scope finalizer instead of registering onDestroy late.",kind:"lifecycle_in_run"}),h=(L,B)=>u(t)(L,B),p=L=>Ve(Pa).pipe(rt(B=>Ce(B)?B.value.local.once(L):!0));let g;const y=L=>!!(L&&typeof L=="object"&&(L._kind==="ModuleDef"||L._kind==="Module")&&"tag"in L&&Pc(L.tag)),b=(L,B)=>{const j=new Proxy({},{get:(W,X)=>V=>B.dispatch({_tag:X,payload:V})}),$={read:W=>rt(B.getState,W),changes:B.changes,dispatch:B.dispatch,actions$:B.actions$,actions:j},F=Symbol.for("logix.module.handle.extend"),K=L?.[F];return typeof K=="function"?K(B,$)??$:$},S=(L,B)=>re(function*(){if(g==="off")return;const j=`module_descriptor:${String(B.instanceId??"unknown")}`;if(!(yield*p(j)))return;const F=Object.keys(L.tag?.shape?.actionMap??{}),K=Symbol.for("logix.module.internal"),X=(L[K]?.mounted??[]).map(ee=>({kind:String(ee?.kind??"user"),id:String(ee?.id??""),derived:ee?.derived?!0:void 0,name:typeof ee?.name=="string"?ee.name:void 0})),V=L.schemas&&typeof L.schemas=="object"?Object.keys(L.schemas):void 0,z=L.meta&&typeof L.meta=="object"?L.meta:void 0,Q=L.dev?.source,q=r.traits.getModuleTraitsSnapshot(),ie=q?{digest:q.digest,count:q.traits.length}:void 0,le={id:L.id,moduleId:String(B.moduleId),instanceId:String(B.instanceId),actionKeys:F,logicUnits:X,schemaKeys:V,meta:z,source:Q,traits:ie};yield*Ue({type:"trace:module:descriptor",moduleId:B.moduleId,instanceId:B.instanceId,data:le})}),w=L=>re(function*(){const B=typeof L?.id=="string"?L.id:void 0,j=typeof n?.moduleId=="string"?n.moduleId:t.moduleId;if(B&&B===t.moduleId)return t;const $=r.imports.get(L);if($)return $;if(typeof n?.moduleId!="string"){const X=yield*Ve(L);if(Ce(X))return X.value}const F=B??"<unknown module id>",K=dn()?["- Provide the child implementation in the same scope (imports).",` Example: ${j??"ParentModule"}.implement({ imports: [${B??"ChildModule"}.impl], ... })`,"- If you intentionally want a root singleton, provide it at app root (Runtime.make(...,{ layer }) / root imports),"," and use Root.resolve(ModuleTag) (instead of $.use) at the callsite."]:[],W=new Error(dn()?["[MissingModuleRuntimeError] Cannot resolve ModuleRuntime for ModuleTag.","",`tokenId: ${F}`,"entrypoint: logic.$.use","mode: strict",`from: ${j??"<unknown module id>"}`,`startScope: moduleId=${j??"<unknown>"}, instanceId=${String(t.instanceId??"<unknown>")}`,"","fix:",...K].join(`
60
+ `):"[MissingModuleRuntimeError] module runtime not found");return W.tokenId=F,W.entrypoint="logic.$.use",W.mode="strict",W.from=j,W.startScope={moduleId:j,instanceId:String(t.instanceId??"<unknown>")},W.fix=K,W.name="MissingModuleRuntimeError",yield*ty(W)}),x={read:t.getState,update:L=>re(function*(){if(yield*et(ii)){const $=yield*t.getState;return yield*t.setState(L($))}const j=()=>$e(t.getState,$=>t.setState(L($)));return yield*r?r.txn.runWithStateTransaction({kind:"state",name:"update"},j):j()}),mutate:L=>re(function*(){const B=r?.txn.recordStatePatch,j=r?.txn.updateDraft;if(yield*et(ii)){const K=yield*t.getState,{nextState:W,patchPaths:X}=xw(K,V=>{L(V)});for(const V of X)B?.(V,"unknown");j?.(W);return}const F=()=>re(function*(){const K=yield*t.getState,{nextState:W,patchPaths:X}=xw(K,V=>{L(V)});for(const V of X)B?.(V,"unknown");j?.(W)});return yield*r?r.txn.runWithStateTransaction({kind:"state",name:"mutate"},F):F()}),ref:t.ref},I=e.actionMap,_=new Map,M=L=>Object.prototype.hasOwnProperty.call(I,L),C=new Proxy({},{get:(L,B)=>{if(typeof B!="string"||!M(B))return;const j=_.get(B);if(j)return j;const $=I[B],F=(...K)=>t.dispatch($(...K));return _.set(B,F),F},has:(L,B)=>typeof B=="string"&&M(B),ownKeys:()=>Object.keys(I),getOwnPropertyDescriptor:(L,B)=>{if(typeof B=="string"&&M(B))return{enumerable:!0,configurable:!0}}}),N={root:{resolve:L=>(a("root_resolve_in_setup","$.root.resolve"),Bxe(L,{entrypoint:"logic.$.root.resolve",waitForReady:!0}))},state:x,actions:I,dispatchers:C,dispatch:(...L)=>{const[B,j]=L;return typeof B=="string"?t.dispatch({_tag:B,payload:j}):_g(B)?t.dispatch(B(j)):t.dispatch(B)},flow:c,match:L=>jxe(L),matchTag:L=>Fxe(L),lifecycle:{onInitRequired:L=>o()==="run"?d("$.lifecycle.onInitRequired"):(r.lifecycle.registerInitRequired(L),ce),onStart:L=>o()==="run"?d("$.lifecycle.onStart"):(r.lifecycle.registerStart(L),ce),onInit:L=>o()==="run"?d("$.lifecycle.onInit"):(r.lifecycle.registerInitRequired(L),ce),onDestroy:L=>o()==="run"?d("$.lifecycle.onDestroy"):(r.lifecycle.registerDestroy(L),ce),onError:L=>o()==="run"?d("$.lifecycle.onError"):(r.lifecycle.registerOnError(L),ce),onSuspend:L=>o()==="run"?d("$.lifecycle.onSuspend"):(r.lifecycle.registerPlatformSuspend(Gt(L)),ce),onResume:L=>o()==="run"?d("$.lifecycle.onResume"):(r.lifecycle.registerPlatformResume(Gt(L)),ce),onReset:L=>o()==="run"?d("$.lifecycle.onReset"):(r.lifecycle.registerPlatformReset(Gt(L)),ce)},traits:{declare:L=>{if(o()==="run")throw hz("traits_declare_in_run","$.traits.declare","run",n?.moduleId);if(!L||typeof L!="object")throw new Error("[InvalidTraitsDeclaration] $.traits.declare expects an object.");const B=n?.logicUnit??{logicUnitId:"unknown",logicUnitIdKind:"derived",logicUnitLabel:"logicUnit:unknown",path:void 0};r.traits.registerModuleTraitsContribution({traits:L,provenance:{originType:"logicUnit",originId:B.logicUnitId,originIdKind:B.logicUnitIdKind,originLabel:B.logicUnitLabel,path:B.path}})},source:{refresh:(L,B)=>re(function*(){const j=r.traits.getSourceRefreshHandler(L);if(!j)return yield*ce;const $=B?.force===!0,F=W=>$?Cn(uw,!0)(j(W)):j(W);if(yield*et(ii)){const W=yield*t.getState;return yield*F(W)}return yield*r.txn.runWithStateTransaction({kind:"source-refresh",name:L},()=>re(function*(){const W=yield*t.getState;return yield*F(W)}))})}},reducer:(L,B)=>Ye(()=>{r.txn.registerReducer(String(L),B)}),effect:(L,B)=>re(function*(){if(!_g(L))return yield*Ci("[BoundApi.effect] token must be an ActionToken");const j=o(),$=n?.logicUnit;yield*r.effects.registerEffect({actionTag:L.tag,handler:B,phase:j,...$?{logicUnit:{logicUnitId:$.logicUnitId,logicUnitLabel:$.logicUnitLabel,path:$.path}}:{}})}),use:new Proxy(()=>{},{apply:(L,B,[j])=>{if(a("use_in_setup","$.use"),y(j)){const $=j,F=$.tag,K=w(F).pipe(rt(V=>b(F,V))),W=w(F).pipe(ti(V=>S($,V)),rt(V=>b(F,V))),X=et(Jr).pipe(ti(V=>{g=V}),$e(V=>V==="off"?K:W));return Tn(()=>g==="off"?K:g!==void 0?W:X)}return Pc(j)?j._kind==="ModuleTag"?w(j).pipe(rt(F=>b(j,F))):j:ty("BoundApi.use: unsupported argument")}}),onAction:new Proxy(()=>{},{apply:(L,B,j)=>{a("use_in_setup","$.onAction");const $=j[0];if(_g($)){const F=$.tag;return h(t.actions$.pipe(zs(K=>K._tag===F||K.type===F),Hs(K=>K.payload)),F)}if(typeof $=="function")return h(t.actions$.pipe(zs($)));if(typeof $=="string")return h(t.actions$.pipe(zs(F=>F._tag===$||F.type===$)),$);if(typeof $=="object"&&$!==null){if("_tag"in $)return h(t.actions$.pipe(zs(F=>F._tag===$._tag)),String($._tag));if(ly($))return h(t.actions$.pipe(zs(F=>!!Nye($)(F))))}return h(t.actions$)},get:(L,B)=>{if(a("use_in_setup","$.onAction"),typeof B=="string")return h(t.actions$.pipe(zs(j=>j._tag===B||j.type===B)),B)}}),onState:L=>(a("use_in_setup","$.onState"),h(t.changes(L))),on:L=>(a("use_in_setup","$.on"),h(L))};return oSe(N,r),N}function Uxe(e,t){const n={stateSchema:t.state,actionSchema:_p(...Object.entries(t.actions).map(([c,u])=>{const d=u.schema;return xi(d===Ds?{_tag:Si(c),payload:wg(d)}:{_tag:Si(c),payload:d})})),actionMap:t.actions},r=t.reducers&&Object.fromEntries(Object.entries(t.reducers).map(([c,u])=>[c,(d,h,p)=>u(d,h,p)]));class i extends Yt(`@logixjs/Module/${e}`)(){}const o=i,a=Object.assign(o,{_kind:"ModuleTag",id:e,shape:n,stateSchema:n.stateSchema,actionSchema:n.actionSchema,actions:n.actionMap,reducers:t.reducers,logic:c=>{const u=re(function*(){const d=yield*o,h=yield*Ve(WW).pipe(rt(Ti)),p=yield*Ve(EC).pipe(rt(Ti)),g=qxe(n,d,{getPhase:()=>p?.current??"run",phaseService:p,moduleId:e,logicUnit:h});let y;try{y=c(g)}catch(w){if(w?._tag==="LogicPhaseError")return yield*ga(w);throw w}return CC(y)?yield*y:(w=>!!(w&&typeof w=="object"&&"setup"in w&&"run"in w))(y)?y:{setup:ce,run:y}});return Ixe(u),u},live:(c,...u)=>iy(o,mz(c,{tag:o,logics:u,moduleId:e,reducers:r})),implement:c=>{const u=(c.imports??[]).flatMap(S=>S._tag==="ModuleImpl"?[S.module]:[]),d=iy(o,mz(c.initial,{tag:o,logics:c.logics||[],processes:c.processes||[],moduleId:e,imports:u,reducers:r,stateTransaction:c.stateTransaction})),h=c.processes??[],p=S=>({_tag:"ModuleImpl",module:a,layer:S,processes:h,stateTransaction:c.stateTransaction,withLayer:w=>{const x=S.pipe(fH(w)),I=Ac(x,w);return p(I)},withLayers:(...w)=>w.reduce((x,I)=>x.withLayer(I),p(S))}),g=p(d);return(c.imports??[]).reduce((S,w)=>{const x=w._tag==="ModuleImpl"?w.layer:w;return S.withLayer(x)},g)}});return a}const yS=e=>typeof e=="function",Vxe=e=>re(function*(){const t=e.meta?.store,n=pO(t);if(n?.kind==="service"){const r=yield*n.tag;return n.map(r)}return t}),Kxe=(e,t,n)=>re(function*(){const r=t.targetFieldPath;if(!r)return;const i=yield*Yd(),o=yield*Ve(Ep),a=Ce(o)?o.value:uk(),c=ey($=>{a.scheduleMicrotask(()=>$(ce))});let u;try{u=Kc(e)}catch{return}const d=n.meta?.select,h=n.meta?.equals,p=$=>yS(d)?d($):$,g=($,F)=>yS(h)?h($,F):Object.is($,F),y=n.meta?.priority,b=n.meta?.store,S=pO(b);if(S?.kind==="module"){const $=yield*Ve(hO);if(Zt($))return yield*Ci("[StateTrait.externalStore] Missing DeclarativeLinkRuntime service (073).");const F=S.module,K=(()=>{if(F&&typeof F=="object"){const le=F.moduleId,ee=F.instanceId,J=F.getState;if(typeof le=="string"&&le.length>0&&typeof ee=="string"&&ee.length>0&&J)return F;const ge=F.tag;if(ge&&Pc(ge))return u.imports.get(ge);if(Pc(F))return u.imports.get(F)}})();if(!K)return yield*Ci(`[StateTrait.externalStore] Module-as-Source store is unresolved for "${r}". Fix: include the source ModuleTag in module imports (moduleId=${S.moduleId}).`);if(S.instanceId&&S.instanceId!==K.instanceId)return yield*Ci(`[StateTrait.externalStore] Module-as-Source instanceId mismatch for "${r}". descriptor.instanceId=${S.instanceId}, resolved.instanceId=${K.instanceId}`);if(K.moduleId!==S.moduleId)return yield*Ci(`[StateTrait.externalStore] Module-as-Source moduleId mismatch for "${r}". descriptor.moduleId=${S.moduleId}, resolved.moduleId=${K.moduleId}`);const W=S.readQuery.staticIr;W.lane==="static"&&W.readsDigest!=null&&W.fallbackReason==null||(yield*Ue({type:"diagnostic",moduleId:u.moduleId,instanceId:u.instanceId,code:"external_store::module_source_degraded",severity:"warning",message:"[StateTrait.externalStore] Module-as-Source selector is not fully IR-recognizable; falling back to module-topic edge (may reduce perf).",hint:"Fix: provide a static ReadQuery (ReadQuery.make) or annotate selector.fieldPaths to get a stable readsDigest; avoid dynamic lane.",kind:"module_as_source_degraded",trigger:{kind:"trait",name:"externalStore.moduleSource",details:{sourceModuleId:S.moduleId,selectorId:W.selectorId,lane:W.lane,fallbackReason:W.fallbackReason,readsDigest:W.readsDigest}}}));const V=`${K.moduleId}::${K.instanceId}`,z=le=>re(function*(){const ee=yield*et(ii),J=re(function*(){const te=yield*e.state.read,pe=co(te,r);if(g(pe,le))return;const oe=Qh(te,xe=>{Rd(xe,r,le)}),ye=Qr(r)??[];u.txn.recordStatePatch(ye,"trait-external-store",pe,le,t.id),u.txn.updateDraft(oe)});if(ee)return yield*J;const ge=y==="nonUrgent"?"low":"normal";return yield*u.txn.runWithStateTransaction({kind:"trait-external-store",name:r,details:{stateCommit:{priority:ge}}},()=>J.pipe(Gt))}).pipe(Ea(i)),Q=$.value.registerModuleAsSourceLink({id:`${u.instanceId}::externalStore:${t.id}`,sourceModuleInstanceKey:V,readQuery:S.readQuery,computeValue:p,equalsValue:g,applyValue:z});yield*ul(()=>Ye(()=>{Q()}));const q=yield*K.getState,ie=S.readQuery.select(q);yield*z(p(ie));return}const w=S?.kind==="service"?yield*Vxe(n):b;if(!w||typeof w!="object")return yield*Ci(`[StateTrait.externalStore] Invalid store for "${r}". Expected { getSnapshot, subscribe }.`);if(!yS(w.getSnapshot)||!yS(w.subscribe))return yield*Ci(`[StateTrait.externalStore] Invalid store for "${r}". Expected { getSnapshot, subscribe }.`);let x=!1,I,_=!1,M=!1,C;const E=re(function*(){if(_)return;_=!0;const $=I instanceof Error?I.message:typeof I=="string"?I:"unknown";yield*Ue({type:"diagnostic",moduleId:u.moduleId,instanceId:u.instanceId,code:"external_store::snapshot_threw",severity:"warning",message:`[StateTrait.externalStore] store.getSnapshot() threw; trait is fused and will stop syncing for "${r}".`,hint:"Fix: ensure getSnapshot is synchronous and non-throwing; async resources should use StateTrait.source or ExternalStore.fromStream({ current/initial }).",kind:"external_store_fused:get_snapshot",trigger:{kind:"trait",name:"externalStore.getSnapshot",details:{fieldPath:r,traitId:t.id,storeKind:S?.kind??"raw",error:$}}})}),T=()=>{if(!x){if(C){const $=C;M=!1,$();return}M=!0}},A=()=>M?(M=!1,ce):ey(($,F)=>{let K=!1;const W=()=>{K||(K=!0,C=void 0,$(ce))};C=W;try{F.addEventListener("abort",()=>{C===W&&(C=void 0)},{once:!0})}catch{}}),U=()=>{try{return w.getSnapshot()}catch($){x=!0,I=$;return}},R=Cn(ii,!1)(Ye(U)),N=yield*R;if(x){yield*E;return}const L=w.subscribe(T);yield*ul(()=>Ye(()=>{try{L?.()}catch{}}));const B=yield*R;if(x){yield*E;return}const j=$=>re(function*(){const F=yield*et(ii),K=re(function*(){const X=yield*e.state.read,V=co(X,r);if(g(V,$))return;const z=Qh(X,q=>{Rd(q,r,$)}),Q=Qr(r)??[];u.txn.recordStatePatch(Q,"trait-external-store",V,$,t.id),u.txn.updateDraft(z)});if(F)return yield*K;const W=y==="nonUrgent"?"low":"normal";return yield*u.txn.runWithStateTransaction({kind:"trait-external-store",name:r,details:{stateCommit:{priority:W}}},()=>K.pipe(Gt))});yield*j(p(B)),g(N,B)||T(),yield*Nn(Cn(ii,!1)(re(function*(){for(;;){if(yield*A(),x||(yield*c,x))return;const $=yield*R;if(x){yield*E;return}yield*j(p($))}})))}),bS=(e,t=6)=>{if(!(!e||e.length===0))return e.length<=t?e.join(", "):`${e.slice(0,t).join(", ")}, …(+${e.length-t})`},vS=(e,t)=>{if(t!==void 0)return`${e}=${t}`},Hxe=e=>{const t=e.report,n=[];t.invalidInput&&n.push("invalidInput=true");const r=bS(t.unknownKeys,6);r&&n.push(`unknownKeys=[${r}]${typeof t.unknownKeyCount=="number"&&t.unknownKeyCount>t.unknownKeys.length?` total=${t.unknownKeyCount}`:""}`);const i=bS(t.droppedKeys,6);i&&n.push(`droppedKeys=[${i}]`),typeof t.droppedTagItems=="number"&&t.droppedTagItems>0&&n.push(`droppedTagItems=${t.droppedTagItems}`);const o=bS(t.ignoredAnnotationKeys,6);o&&n.push(`ignoredAnnotationKeys=[${o}]${typeof t.ignoredAnnotationKeyCount=="number"&&t.ignoredAnnotationKeyCount>t.ignoredAnnotationKeys.length?` total=${t.ignoredAnnotationKeyCount}`:""}`);const a=bS(t.droppedAnnotationKeys,6);a&&n.push(`droppedAnnotationKeys=[${a}]${typeof t.droppedAnnotationKeyCount=="number"&&t.droppedAnnotationKeyCount>t.droppedAnnotationKeys.length?` total=${t.droppedAnnotationKeyCount}`:""}`);const c=vS("droppedAnnotationValues",t.droppedAnnotationValues);c&&n.push(c);const u=vS("nonSerializable",t.droppedAnnotationNonSerializable),d=vS("depthExceeded",t.droppedAnnotationDepthExceeded),h=vS("nonFiniteNumber",t.droppedAnnotationNonFiniteNumber),p=[u,d,h].filter(g=>g!==void 0);return p.length>0&&n.push(`reasons={${p.join(", ")}}`),`[${e.origin}] ${n.join(" ")}`},Wxe=e=>{const t=e.spec;if(!t||typeof t!="object")return[];const n=a=>typeof a=="object"&&a!==null&&a._tag==="StateTraitNode",r=a=>typeof a=="object"&&a!==null&&a._tag==="StateTraitList",i=[],o=(a,c)=>{const{report:u}=mO(c);u&&i.push({origin:a,report:u})};for(const a of Object.keys(t)){const c=t[a];if(c){if(r(c)){c.item&&n(c.item)&&c.item.meta!==void 0&&o(`node:${a}[]`,c.item.meta),c.list&&n(c.list)&&c.list.meta!==void 0&&o(`node:${a}`,c.list.meta);continue}if(n(c)){if(c.meta===void 0)continue;o(`node:${a==="$root"?"$root":a}`,c.meta);continue}}}return i},Gxe=e=>{const t=[];for(const n of e.entries){if(n.kind!=="source"&&n.kind!=="externalStore")continue;const r=n.meta?.meta;if(r===void 0)continue;const i=n.kind==="source"?`source:${n.fieldPath}`:`externalStore:${n.fieldPath}`,{report:o}=mO(r);o&&t.push({origin:i,report:o})}return t},Yxe=(e,t)=>re(function*(){if(!dn())return;const n=yield*et(Jr);if(n==="off")return;const r=t.moduleId??"unknown";if(!(yield*pk(`meta_sanitize:${r}`)))return;const o=[...Wxe(e),...Gxe(e)];if(o.length===0)return;const a=n==="light"||n==="sampled"?8:24,c=o.slice(0,a).map(Hxe);o.length>a&&c.push(`…(+${o.length-a})`),yield*Ue({type:"diagnostic",moduleId:t.moduleId,instanceId:t.instanceId,code:"state_trait::meta_sanitized",severity:"warning",message:`[meta] TraitMeta contains non-exportable fields/values and will be sanitized (total ${o.length}):
61
+ ${c.join(`
62
+ `)}`,hint:"TraitMeta is export-only (Devtools/Static IR) and MUST be JsonValue. Use `annotations` with `x-*` keys for extension hints; avoid closures/functions/Effect/Fiber/Tag/DOM/BigInt/circular refs. See specs/016 and docs/ssot/platform/contracts/03-control-surface-manifest.md.",kind:"meta_sanitized"})}),Qxe=e=>{const t=new Map;for(const n of e){const r=t.get(n.fieldPath)??[];r.push(n),t.set(n.fieldPath,r)}return t},Xxe=(e,t)=>re(function*(){let n;try{n=Kc(e),n.traits.registerStateTraitProgram(t,{bumpReason:"logic_installed"})}catch{}n&&(yield*Yxe(t,{moduleId:n.moduleId,instanceId:n.instanceId}));const r=Qxe(t.entries),i=o=>{if(!o.targetFieldPath||o.kind!=="source-refresh"&&o.kind!=="external-store-sync")return ce;const a=r.get(o.targetFieldPath);if(!a||a.length===0)return ce;const c=o.kind==="source-refresh"?a.find(u=>u.kind==="source"):a.find(u=>u.kind==="externalStore");return c?o.kind==="source-refresh"?hwe(e,o,c):Kxe(e,o,c):ce};yield*ln(t.plan.steps,o=>i(o)).pipe(Gt)}).pipe(Gt),yz=(e,t)=>jW(e,t),Jxe=(e,t)=>Xxe(e,t);class Zxe extends Error{constructor(t,n){super([`[ModuleTraitsConflictError] Conflicting traitIds found (moduleId=${t}).`,...n.map(r=>r.kind==="duplicate_traitId"?`- duplicate ${r.traitId}: ${r.sources.map(i=>`${i.originType}:${i.originId}`).join(", ")}`:r.kind==="missing_requires"?`- missing requires for ${r.traitId}: ${(r.missing??[]).join(", ")}; sources=${r.sources.map(i=>`${i.originType}:${i.originId}`).join(", ")}`:`- excludes violation for ${r.traitId}: present=${(r.present??[]).join(", ")}; sources=${r.sources.map(i=>`${i.originType}:${i.originId}`).join(", ")}`)].join(`
63
+ `)),this.moduleId=t,this.conflicts=n}_tag="ModuleTraitsConflictError"}const eke=e=>`${e.originType}:${e.originId}:${e.originIdKind}:${e.originLabel}:${e.path??""}`,_c=(e,t)=>e<t?-1:e>t?1:0,bz=(e,t)=>{const n=_c(e.originType,t.originType);if(n!==0)return n;const r=_c(e.originId,t.originId);if(r!==0)return r;const i=_c(e.originIdKind,t.originIdKind);if(i!==0)return i;const o=_c(e.originLabel,t.originLabel);return o!==0?o:_c(String(e.path??""),String(t.path??""))},vz=e=>e==="module"?0:1,tke=(e,t)=>{const n=vz(e.provenance.originType)-vz(t.provenance.originType);if(n!==0)return n;const r=_c(e.provenance.originId,t.provenance.originId);return r!==0?r:_c(e.traitId,t.traitId)},ZW=e=>{if(!Array.isArray(e))return[];const t=[];for(const n of e){if(typeof n!="string")continue;const r=n.trim();r&&t.push(r)}return t},nke=e=>!e||typeof e!="object"?[]:ZW(e.requires),rke=e=>!e||typeof e!="object"?[]:ZW(e.excludes),ike=(e,t)=>{if(t&&typeof t=="object"){const n=t.name;if(typeof n=="string"&&n.trim().length>0)return n.trim()}return e},oke=e=>{if(e&&typeof e=="object"){const t=e.description;if(typeof t=="string"&&t.trim().length>0)return t.trim()}},ske=e=>{const t=new Map,n=new Map,r=[...e.contributions].sort((b,S)=>bz(b.provenance,S.provenance));for(const b of r){const S=b.traits;if(!(!S||typeof S!="object"))for(const w of Object.keys(S).sort()){const x=S[w];if(x===void 0)continue;const I=t.get(w);if(!I){t.set(w,{value:x,provenance:b.provenance});continue}const _=n.get(w)??[I.provenance];_.push(b.provenance),n.set(w,_)}}const i=[],o=b=>{const S=new Map;for(const w of b.sources)S.set(eke(w),w);i.push({...b,sources:Array.from(S.values()).sort(bz)})};for(const b of Array.from(n.keys()).sort())o({kind:"duplicate_traitId",traitId:b,sources:n.get(b)??[]});const a={},c={},u=[],d=[];for(const b of t.keys()){const S=t.get(b);S&&d.push({traitId:b,value:S.value,provenance:S.provenance})}const h=d.slice().sort(tke).map(b=>b.traitId);for(const b of h){const S=t.get(b);S&&(a[b]=S.value,c[b]=S.provenance,u.push({traitId:b,name:ike(b,S.value),description:oke(S.value)}))}const p=new Set(h);for(const b of h){const S=t.get(b);if(!S)continue;const w=nke(S.value);if(w.length>0){const I=w.filter(_=>!p.has(_));I.length>0&&o({kind:"missing_requires",traitId:b,missing:Array.from(new Set(I)).sort(),sources:[S.provenance]})}const x=rke(S.value);if(x.length>0){const I=x.filter(_=>p.has(_));if(I.length>0){const _=[];for(const M of I){const C=t.get(M);C&&_.push(C.provenance)}o({kind:"excludes_violation",traitId:b,present:Array.from(new Set(I)).sort(),sources:[S.provenance,..._]})}}}if(i.length>0){const b={duplicate_traitId:0,missing_requires:1,excludes_violation:2};throw i.sort((S,w)=>{const x=b[S.kind]-b[w.kind];return x!==0?x:_c(S.traitId,w.traitId)}),new Zxe(e.moduleId,i)}const g={moduleId:e.moduleId,traits:u,provenanceIndex:c},y=`mtraits:023:${Tp(Rl(g))}`;return{merged:a,snapshot:{moduleId:e.moduleId,digest:y,traits:u,provenanceIndex:c}}},e9={mutate:e=>(t,n,r)=>{const i=n?.payload;if(!r)return Dxe(t,c=>{e(c,i)});const{nextState:o,patchPaths:a}=xw(t,c=>{e(c,i)});for(const c of a)r(c);return o},mutateMap:e=>{const t={};for(const n of Object.keys(e)){const r=e[n];typeof r=="function"&&(t[n]=e9.mutate(r))}return t}},ake=(e,t)=>Uxe(e,t),lke=(e,t)=>{const n=xW(t.actions),r=ake(e,{state:t.state,actions:n,reducers:t.reducers}),i=t.state,o=t.traits,a=o?yz(i,o):void 0;a&&(mF(r,a),pF(e,a));const c=h=>{const p=r.logic(g=>({setup:Ye(()=>{if(!h||typeof h!="object")return;Kc(g).traits.registerModuleTraitsContribution({traits:h,provenance:{originType:"module",originId:e,originIdKind:"explicit",originLabel:`module:${e}`}})}),run:ce}));return Ad(p,{id:"__logix_internal:traits:module_contrib",kind:"internal",name:"traits:module_contrib",moduleId:e}),p},u=()=>{const h=r.logic(p=>({setup:re(function*(){const g=Kc(p),y=yield*et(Jr),b=g.traits.getModuleTraitsContributions();let S,w;try{({merged:S,snapshot:w}=ske({moduleId:e,contributions:b}))}catch(_){if(y!=="off"&&_&&typeof _=="object"&&_._tag==="ModuleTraitsConflictError"){const M=Array.isArray(_.conflicts)?_.conflicts:[],C=M.map(T=>T&&typeof T=="object"?T.traitId:void 0).filter(T=>typeof T=="string"&&T.length>0).slice(0,20),E=y==="full"?{conflictCount:M.length,conflicts:M}:{conflictCount:M.length,traitIds:C};yield*Ue({type:"trace:module:traits:conflict",moduleId:e,instanceId:g.instanceId,data:E})}throw _}if(g.traits.setModuleTraitsSnapshot(w),g.traits.freezeModuleTraits(),y!=="off"){const _=y==="full"?{digest:w.digest,count:w.traits.length,traits:w.traits,provenanceIndex:w.provenanceIndex}:{digest:w.digest,count:w.traits.length};yield*Ue({type:"trace:module:traits",moduleId:e,instanceId:g.instanceId,data:_})}if(Object.keys(S).length===0)return;const I=b.length===1&&b[0]?.provenance?.originType==="module"&&a?a:yz(i,S);mF(r,I),pF(e,I),yield*Jxe(p,I)}),run:ce}));return Ad(h,{id:"__logix_internal:traits:finalize",kind:"internal",name:"traits:finalize",moduleId:e}),h},d=r.implement;return r.implement=(h=>{const p=h.logics??[],g=t.traits?[c(t.traits)]:[],y=u(),b=[...g,...p,y];return d({...h,logics:b})}),r},cke=e=>ck(e)?e:ar(e).value,Nt=e=>{const t=e.detail!==void 0?cke(e.detail):void 0,n=e.detail!==void 0?`${e.message}
64
+ (detail=${Rl(t)})`:e.message;return Object.assign(new Error(n),{_tag:"WorkflowError",code:e.code,programId:e.programId,source:e.source,detail:t})},uke=e=>e.replace(/~1/g,"/").replace(/~0/g,"~"),dke=e=>e==="0"||!e.startsWith("0")&&/^\d+$/.test(e),fke=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),hke=e=>{if(e==="")return[];if(!e.startsWith("/"))throw Nt({code:"WORKFLOW_INVALID_JSON_POINTER",message:'Invalid JSON Pointer (must be "" or start with "/").',detail:{pointer:e}});const t=e.split("/").slice(1),n=[];for(const r of t){const i=uke(r);n.push(dke(i)?Number(i):i)}return n},kw=(e,t)=>{switch(e.kind){case"payload":return{kind:"payload"};case"payload.path":{const n=e.pointer;if(typeof n!="string")throw Nt({code:"WORKFLOW_INVALID_INPUT_EXPR",message:"InputExpr.payload.path.pointer must be a string.",source:{stepKey:t?.stepKey},detail:{pointer:n}});return{kind:"payload.path",pointer:n,tokens:hke(n)}}case"const":{const n=e.value;if(!ck(n))throw Nt({code:"WORKFLOW_INVALID_INPUT_EXPR",message:"InputExpr.const.value must be JSON-serializable.",source:{stepKey:t?.stepKey},detail:{value:n}});return{kind:"const",value:n}}case"object":{const n=e.fields;if(!n||typeof n!="object"||Array.isArray(n))throw Nt({code:"WORKFLOW_INVALID_INPUT_EXPR",message:"InputExpr.object.fields must be a record.",source:{stepKey:t?.stepKey}});return{kind:"object",fields:Object.entries(n).sort(([i],[o])=>i<o?-1:i>o?1:0).map(([i,o])=>[i,kw(o,t)])}}case"merge":{const n=e.items;if(!Array.isArray(n))throw Nt({code:"WORKFLOW_INVALID_INPUT_EXPR",message:"InputExpr.merge.items must be an array.",source:{stepKey:t?.stepKey}});for(const r of n){const i=fke(r)?r.kind:void 0;if(i!=="object")throw Nt({code:"WORKFLOW_INVALID_MERGE_ITEMS",message:"InputExpr.merge.items must all be InputExpr.object.",source:{stepKey:t?.stepKey},detail:{kind:i}})}return{kind:"merge",items:n.map(r=>kw(r,t))}}}},pke=e=>{if(typeof e!="object"||e===null||Array.isArray(e))return!1;const t=Object.getPrototypeOf(e);return t===Object.prototype||t===null},mke=(e,t)=>{let n=e;for(const r of t){if(n==null)return;if(Array.isArray(n)&&typeof r=="number"){n=n[r];continue}if(typeof n!="object")return;const i=typeof r=="number"?String(r):r;n=n[i]}return n},_w=(e,t)=>{switch(e.kind){case"payload":return t;case"payload.path":return mke(t,e.tokens);case"const":return e.value;case"object":{const n={};for(const[r,i]of e.fields)n[r]=_w(i,t);return n}case"merge":{const n={};for(const r of e.items){const i=_w(r,t);if(pke(i))for(const[o,a]of Object.entries(i))n[o]=a}return n}}},Ls=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),Mu=e=>typeof e=="string"&&e.trim().length>0?e.trim():void 0,gke=e=>{if(typeof e!="number"||!Number.isFinite(e))return;const t=Math.floor(e);return t>=0?t:void 0},Sz=e=>{if(typeof e!="number"||!Number.isFinite(e))return;const t=Math.floor(e);return t>0?t:void 0},yke=e=>{const t=r=>{if(!Ls(r)||r.kind!=="call")return r;const i=r,o=Array.isArray(i.onSuccess)?i.onSuccess:[],a=Array.isArray(i.onFailure)?i.onFailure:[];return{...r,onSuccess:o.map(t),onFailure:a.map(t)}};return{...e,steps:(r=>r.map(t))(e.steps)}};function bke(e,t){if(!Ls(e))throw Nt({code:"WORKFLOW_INVALID_DEF",message:"WorkflowDef must be an object.",detail:{def:e}});if(e.astVersion!==1)throw Nt({code:"WORKFLOW_UNSUPPORTED_VERSION",message:"Unsupported workflow astVersion.",detail:{astVersion:e.astVersion}});if(!Mu(e.localId))throw Nt({code:"WORKFLOW_INVALID_DEF",message:"WorkflowDef.localId must be a non-empty string.",detail:{localId:e.localId}});const n=e.trigger;if(!Ls(n))throw Nt({code:"WORKFLOW_INVALID_TRIGGER",message:"Workflow trigger must be an object.",detail:{trigger:n}});if(n.kind==="action"){if(!Mu(n.actionTag))throw Nt({code:"WORKFLOW_INVALID_TRIGGER",message:"Workflow trigger.actionTag must be a non-empty string.",detail:{trigger:n}})}else if(n.kind==="lifecycle"){const d=n.phase;if(d!=="onStart"&&d!=="onInit")throw Nt({code:"WORKFLOW_INVALID_TRIGGER",message:'Workflow trigger.phase must be "onStart" or "onInit".',detail:{trigger:n}})}else throw Nt({code:"WORKFLOW_INVALID_TRIGGER",message:'Workflow trigger.kind must be "action" or "lifecycle".',detail:{trigger:n}});if(!Array.isArray(e.steps))throw Nt({code:"WORKFLOW_INVALID_DEF",message:"WorkflowDef.steps must be an array.",detail:{steps:e.steps}});const r=new Set,i=(d,h)=>{if(!Ls(d))throw Nt({code:"WORKFLOW_INVALID_STEP",message:"Workflow step must be an object.",detail:{step:d},source:h?{fragmentId:h}:void 0});const p=Mu(d.key);if(!p)throw Nt({code:"WORKFLOW_INVALID_STEP",message:"Workflow step.key must be a non-empty string.",detail:{stepKey:d.key,kind:d.kind},source:h?{fragmentId:h}:void 0});if(r.has(p))throw Nt({code:"WORKFLOW_DUPLICATE_STEP_KEY",message:`Duplicate stepKey "${p}" detected.`,detail:{duplicateKey:p},source:{stepKey:p,...h?{fragmentId:h}:null}});if(r.add(p),d.kind==="dispatch"){if(!Mu(d.actionTag))throw Nt({code:"WORKFLOW_INVALID_STEP",message:"dispatch.actionTag must be a non-empty string.",source:{stepKey:p,...h?{fragmentId:h}:null},detail:{actionTag:d.actionTag}});const g=d.payload;g!==void 0&&wz(g,{stepKey:p});return}if(d.kind==="delay"){if(gke(d.ms)===void 0)throw Nt({code:"WORKFLOW_INVALID_STEP",message:"delay.ms must be a non-negative integer.",source:{stepKey:p,...h?{fragmentId:h}:null},detail:{ms:d.ms}});return}if(d.kind==="call"){if(!Mu(d.serviceId))throw Nt({code:"WORKFLOW_INVALID_SERVICE_ID",message:"call.serviceId must be a non-empty string.",source:{stepKey:p,...h?{fragmentId:h}:null},detail:{serviceId:d.serviceId}});const g=d.input;g!==void 0&&wz(g,{stepKey:p});const y=d.timeoutMs;if(y!==void 0&&Sz(y)===void 0)throw Nt({code:"WORKFLOW_INVALID_STEP",message:"call.timeoutMs must be a positive integer (milliseconds).",source:{stepKey:p,...h?{fragmentId:h}:null},detail:{timeoutMs:y}});const b=d.retry;if(b!==void 0&&(Ls(b)?Sz(b.times):void 0)===void 0)throw Nt({code:"WORKFLOW_INVALID_STEP",message:"call.retry.times must be a positive integer.",source:{stepKey:p,...h?{fragmentId:h}:null},detail:{retry:b}});const S=Array.isArray(d.onSuccess)?d.onSuccess:[],w=Array.isArray(d.onFailure)?d.onFailure:[];for(const x of S)i(x,h);for(const x of w)i(x,h);return}throw Nt({code:"WORKFLOW_INVALID_STEP",message:"Unknown step kind.",source:{stepKey:p,...h?{fragmentId:h}:null},detail:{kind:d.kind}})},o=e.sources,a=new Map;if(o&&typeof o=="object")for(const[d,h]of Object.entries(o))a.set(d,Ls(h)?Mu(h.fragmentId):void 0);for(const d of e.steps){const h=Ls(d)?Mu(d.key):void 0,p=h?a.get(h):void 0;i(d,p)}const c=Ls(e.meta)?e.meta.generator:void 0;if(c!==void 0&&!ck(c))throw Nt({code:"WORKFLOW_INVALID_DEF",message:"WorkflowDef.meta.generator must be JSON-serializable.",detail:{generator:c}});const u=Ls(e.policy)?e.policy:void 0;if(u){const d=u.concurrency;if(d!==void 0&&d!=="latest"&&d!=="exhaust"&&d!=="parallel")throw Nt({code:"WORKFLOW_INVALID_DEF",message:"policy.concurrency must be latest|exhaust|parallel.",detail:{concurrency:d}});const h=u.priority;if(h!==void 0&&h!=="urgent"&&h!=="nonUrgent")throw Nt({code:"WORKFLOW_INVALID_DEF",message:"policy.priority must be urgent|nonUrgent.",detail:{priority:h}})}}const wz=(e,t)=>{const n=r=>{if(!Ls(r))throw Nt({code:"WORKFLOW_INVALID_INPUT_EXPR",message:"InputExpr must be an object.",source:{stepKey:t?.stepKey},detail:{expr:r}});const i=r.kind;switch(i){case"payload":return;case"payload.path":{const o=r.pointer;if(typeof o!="string")throw Nt({code:"WORKFLOW_INVALID_INPUT_EXPR",message:"InputExpr.payload.path.pointer must be a string.",source:{stepKey:t?.stepKey},detail:{pointer:o}});return}case"const":{const o=r.value;if(!ck(o))throw Nt({code:"WORKFLOW_INVALID_INPUT_EXPR",message:"InputExpr.const.value must be JSON-serializable.",source:{stepKey:t?.stepKey}});return}case"object":{const o=r.fields;if(!Ls(o))throw Nt({code:"WORKFLOW_INVALID_INPUT_EXPR",message:"InputExpr.object.fields must be a record.",source:{stepKey:t?.stepKey}});for(const a of Object.values(o))n(a);return}case"merge":{const o=r.items;if(!Array.isArray(o))throw Nt({code:"WORKFLOW_INVALID_INPUT_EXPR",message:"InputExpr.merge.items must be an array.",source:{stepKey:t?.stepKey}});for(const a of o)n(a);return}default:throw Nt({code:"WORKFLOW_INVALID_INPUT_EXPR",message:"Unknown InputExpr kind.",source:{stepKey:t?.stepKey},detail:{kind:i}})}};n(e)},vke=e=>{const t=yke(e.def);bke(t);const n=r=>{const i=r.key;switch(r.kind){case"dispatch":return{kind:"dispatch",key:r.key,actionTag:r.actionTag,...r.payload?{payload:kw(r.payload,{stepKey:i})}:null};case"delay":return{kind:"delay",key:r.key,ms:r.ms};case"call":{const o=r.retry?.times;return{kind:"call",key:r.key,serviceId:r.serviceId,...r.input?{input:kw(r.input,{stepKey:i})}:null,...r.timeoutMs!==void 0?{timeoutMs:r.timeoutMs}:null,...o!==void 0?{retryTimes:o}:null,onSuccess:r.onSuccess.map(n),onFailure:r.onFailure.map(n)}}}};return t.steps.map(n)},t9=Symbol.for("@logixjs/core/workflowRegistry"),MC=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),Iw=e=>typeof e=="object"&&e!==null||typeof e=="function",Ske=e=>e[t9],wke=e=>{const t=Iw(e)?e._tag:void 0;if(typeof t=="string"&&t.length>0)return t;const n=Iw(e)?e.type:void 0;if(typeof n=="string"&&n.length>0)return n;if(t!=null)return String(t);if(n!=null)return String(n)},MO=e=>typeof e=="string"&&e.trim().length>0?e.trim():void 0,xke="logix/kernel/sourceRefresh",n9=(e,t,n,r,i)=>{if(n===xke)return d=>re(function*(){const h=MO(MC(d)?d.fieldPath:void 0);if(!h)throw Nt({code:"WORKFLOW_INVALID_STEP",message:"KernelPort sourceRefresh requires input.fieldPath (non-empty string).",programId:r,source:{stepKey:i},detail:{serviceId:n,input:d}});const p=Cp(e),g=p.traits.getSourceRefreshHandler(h);if(!g)return;const y=MC(d)&&d.force===!0,b=w=>y?Cn(uw,!0)(g(w)):g(w);if(yield*et(ii)){const w=yield*e.getState;yield*b(w);return}yield*p.txn.runWithStateTransaction({kind:"source-refresh",name:h},()=>re(function*(){const w=yield*e.getState;yield*b(w)}))});const o=Go(n),a=Ai(t,o);if(Zt(a))throw Nt({code:"WORKFLOW_MISSING_SERVICE",message:`Missing service for serviceId="${n}".`,programId:r,source:{stepKey:i},detail:{serviceId:n}});const c=a.value;if(typeof c=="function"){const d=c;return h=>d(h)}const u=Iw(c)?c.call:void 0;if(typeof u=="function"){const d=u;return h=>d.call(c,h)}throw Nt({code:"WORKFLOW_INVALID_SERVICE_PORT",message:`Invalid service port for serviceId="${n}" (expected a function or { call(input): Effect }).`,programId:r,source:{stepKey:i},detail:{serviceId:n,portType:typeof c}})},RO=(e,t)=>{const n=r=>{switch(r.kind){case"dispatch":return{kind:"dispatch",key:r.key,actionTag:r.actionTag,...r.payload?{payload:r.payload}:null};case"delay":return{kind:"delay",key:r.key,ms:r.ms};case"call":return{kind:"call",key:r.key,serviceId:r.serviceId,port:t(r.serviceId,r.key),...r.input?{input:r.input}:null,...r.timeoutMs!==void 0?{timeoutMs:r.timeoutMs}:null,...r.retryTimes!==void 0?{retryTimes:r.retryTimes}:null,onSuccess:r.onSuccess.map(n),onFailure:r.onFailure.map(n)}}};return e.map(n)},kke=e=>e.policy?.concurrency??"parallel",_ke=e=>e.policy?.priority??"urgent",xz=(e,t,n)=>`${e}::wf:${t}::r${n}`,mc=e=>re(function*(){const t=yield*o0e({kind:e.kind,name:e.name,effect:e.effect,payload:e.payload,meta:e.meta}),n=e.middleware?.stack??[];return yield*Yh(t,n)}),kz=e=>ey(t=>{let n=!1;const r=e.host.scheduleTimeout(e.ms,()=>{n=!0,e.host.scheduleMicrotask(()=>t(ce))});return Ye(()=>{r()}).pipe(Ze(n?ce:e.onCancel))}),Ike=(e,t)=>re(function*(){if(e.parallelLimiter!==void 0)return;const i=(yield*Cp(t).concurrency.resolveConcurrencyPolicy()).concurrencyLimit;if(i==="unbounded"){e.parallelLimiter=null;return}const o=typeof i=="number"&&Number.isFinite(i)&&i>=1?Math.floor(i):16;e.parallelLimiter=yield*Xx(o)}),Eke=e=>re(function*(){const t=yield*Ve(Dc);if(Zt(t))return yield*e;const n=t.value,r=n.context??(yield*kn(n.ready)),i=yield*Yd(),o=_s(r,i);return yield*Ea(e,o)}),r9=(e,t)=>re(function*(){if(yield*B0(e.portsReady)){yield*kn(e.portsReady);return}if(e.portsResolving){yield*kn(e.portsReady);return}e.portsResolving=!0;const r=yield*Yd();yield*Ye(()=>{const i=new Map;for(const o of e.entries){const a=o.program;if(a.steps)continue;const c=(u,d)=>{const h=i.get(u);if(h)return h;const p=n9(t,r,u,a.programId,d);return i.set(u,p),p};a.steps=RO(a.compiledSteps,c)}}).pipe(ti(()=>ri(e.portsReady,void 0)),At(i=>RR(e.portsReady,i).pipe(Ze(pr(i)))),Gi(Ye(()=>{e.portsResolving=!1})))}),H1=(e,t)=>e==="off"?!1:e==="sampled"?(t&15)===0:!0,RC=e=>re(function*(){const{entry:t,runtime:n,registry:r}=e,{program:i,state:o}=t,a=yield*et(Jr),c=()=>{if(o.mode==="latest"){o.runSeq+=1;const I=o.runSeq,_=xz(n.instanceId,i.programId,I);return{runSeq:I,runId:_,canWriteBack:()=>o.runSeq===I}}o.runSeq+=1;const w=o.runSeq,x=xz(n.instanceId,i.programId,w);return{runSeq:w,runId:x,canWriteBack:()=>!0}};if(o.mode==="exhaust"){if(o.busy){if(a!=="off"){const w=H1(a,o.runSeq),x=w?(yield*Us).getTickSeq():void 0;yield*mc({kind:"flow",name:"workflow.drop",payload:{programId:i.programId,trigger:e.trigger},meta:{moduleId:n.moduleId,instanceId:n.instanceId,programId:i.programId,...x!==void 0?{tickSeq:x}:null,policy:{disableObservers:!w},reason:"exhaust"},effect:ce,middleware:e.middleware})}return}o.busy=!0}const{runSeq:u,runId:d,canWriteBack:h}=c();if(o.mode==="latest"){const w=o.current,x=o.currentRunId;if(w&&(yield*Zg(w),a!=="off")){const I=H1(a,u),_=I?(yield*Us).getTickSeq():void 0;yield*mc({kind:"flow",name:"workflow.cancel",payload:{programId:i.programId,cancelled:x,by:d},meta:{moduleId:n.moduleId,instanceId:n.instanceId,programId:i.programId,..._!==void 0?{tickSeq:_}:null,policy:{disableObservers:!I},reason:"latest",cancelledByRunId:d,cancelledRunId:x},effect:ce,middleware:e.middleware})}o.currentRunId=d}const p=H1(a,u),g={disableObservers:!p},y=re(function*(){const w=yield*Ep,x=yield*Us;if(!i.steps){const U=yield*Yd(),R=new Map,N=(L,B)=>{const j=R.get(L);if(j)return j;const $=n9(n,U,L,i.programId,B);return R.set(L,$),$};i.steps=RO(i.compiledSteps,N)}const I=()=>p?x.getTickSeq():void 0,_=p&&a==="full",M=U=>U?_w(U,e.payload):void 0,C=()=>e.trigger.kind==="action"?e.payload:void 0;let E=!1;const T=U=>re(function*(){for(const R of U){if(!h())return;if(R.kind==="dispatch"){const j=M(R.payload),$={_tag:R.actionTag,payload:j},F=I(),K=i.priority==="nonUrgent"?n.dispatchLowPriority($):n.dispatch($),W=E?Cn(l0,{kind:"workflow.timer",name:`timer:${i.programId}:${R.key}`})(K):K;yield*mc({kind:"flow",name:"workflow.dispatch",payload:{actionTag:R.actionTag},meta:{moduleId:n.moduleId,instanceId:n.instanceId,programId:i.programId,runId:d,stepKey:R.key,...F!==void 0?{tickSeq:F}:null,policy:g},effect:W,middleware:e.middleware}).pipe(Gt);continue}if(R.kind==="delay"){const j=_?`${d}::timer:${R.key}`:void 0,$=(z,Q)=>re(function*(){const q=I();yield*mc({kind:"flow",name:z,payload:{ms:R.ms},meta:{moduleId:n.moduleId,instanceId:n.instanceId,programId:i.programId,runId:d,stepKey:R.key,...j?{timerId:j}:null,...q!==void 0?{tickSeq:q}:null,policy:g,...Q??null},effect:ce,middleware:e.middleware})}),F=_?$("workflow.timer.schedule"):ce,K=_?$("workflow.timer.cancel",{reason:"interrupt"}):ce,W=_?$("workflow.timer.fired"):ce,X=F.pipe(Ze(kz({host:w,ms:R.ms,onCancel:K})),Ze(W)),V=I();yield*mc({kind:"flow",name:"workflow.delay",payload:{ms:R.ms},meta:{moduleId:n.moduleId,instanceId:n.instanceId,programId:i.programId,runId:d,stepKey:R.key,...V!==void 0?{tickSeq:V}:null,...j?{timerId:j}:null,policy:g},effect:X,middleware:e.middleware}).pipe(Gt),E=!0;continue}const N=R.input?_w(R.input,e.payload):C(),L=R.retryTimes??0;let B;for(let j=1;j<=L+1;j+=1){const $=I(),F=mc({kind:"service",name:`workflow.call:${R.serviceId}`,payload:{serviceId:R.serviceId},meta:{moduleId:n.moduleId,instanceId:n.instanceId,programId:i.programId,runId:d,stepKey:R.key,serviceId:R.serviceId,attempt:j,...$!==void 0?{tickSeq:$}:null,policy:g},effect:R.port(N),middleware:e.middleware}),K=R.timeoutMs===void 0?F:re(function*(){const X=R.timeoutMs;if(X===void 0)return yield*F;const V=_?`${d}::timeout:${R.key}:a${j}`:void 0,z=(J,ge)=>re(function*(){const te=I();yield*mc({kind:"flow",name:J,payload:{ms:X},meta:{moduleId:n.moduleId,instanceId:n.instanceId,programId:i.programId,runId:d,stepKey:R.key,attempt:j,...V?{timerId:V}:null,...te!==void 0?{tickSeq:te}:null,policy:g,...ge??null},effect:ce,middleware:e.middleware})}),Q=_?z("workflow.timeout.schedule"):ce,q=_?z("workflow.timeout.cancel",{reason:"interrupt"}):ce,ie=_?z("workflow.timeout.fired"):ce,le=Nt({code:"WORKFLOW_CALL_TIMEOUT",message:`Workflow call timed out (serviceId="${R.serviceId}", timeoutMs=${X}).`,programId:i.programId,source:{stepKey:R.key},detail:{serviceId:R.serviceId,timeoutMs:X,attempt:j}}),ee=Q.pipe(Ze(kz({host:w,ms:X,onCancel:q})),Ze(ie),Ze(ga(le)));return yield*aH(F,ee)}),W=yield*en(K);if(B=W,!h()||xd(W)||Ed(W.cause)||Zt(ew(W.cause)))break;if(!(j<L+1))break}if(B||(B=Lo(void 0)),!h())return;if(xd(B))yield*T(R.onSuccess);else{const j=Ti(ew(B.cause));Iw(j)&&j._tag==="WorkflowError"&&j.code==="WORKFLOW_CALL_TIMEOUT"&&(E=!0),yield*T(R.onFailure)}}}),A=I();yield*mc({kind:"flow",name:"workflow.run",payload:{trigger:e.trigger},meta:{moduleId:n.moduleId,instanceId:n.instanceId,programId:i.programId,runId:d,...A!==void 0?{tickSeq:A}:null,policy:g},effect:T(i.steps),middleware:e.middleware}).pipe(Gt)}),b=r.parallelLimiter?r.parallelLimiter.withPermits(1)(y):y,S=yield*Nn(b.pipe(At(w=>{const{errorSummary:x,downgrade:I}=Fo(w),_=I?` (downgrade=${I})`:"";return Ue({type:"diagnostic",moduleId:n.moduleId,instanceId:n.instanceId,code:"workflow::run_crashed",severity:"error",message:`Workflow run crashed for programId="${i.programId}" runId="${d}".${_}`,hint:`${x.name?`${x.name}: `:""}${x.message}`,actionTag:e.trigger.kind==="action"?e.trigger.actionTag:void 0,kind:"workflow_run_crashed",trigger:{kind:"workflow",name:"run",details:{programId:i.programId,runId:d,trigger:e.trigger}}}).pipe(At(()=>ce))}),Gi(Ye(()=>{o.mode==="exhaust"&&(o.busy=!1)}))));o.mode==="latest"&&(o.current=S)}),i9=e=>re(function*(){const t=Ske(e);if(t)return{moduleId:e.moduleId,instanceId:e.instanceId,registry:t};const n=yield*mr(),r={byActionTag:new Map,entries:[],watcherStarted:!1,watcherStartCount:0,portsResolving:!1,portsReady:n,parallelLimiter:void 0};return Object.defineProperty(e,t9,{value:r,enumerable:!1,configurable:!0,writable:!1}),{moduleId:e.moduleId,instanceId:e.instanceId,registry:r}}),o9=e=>re(function*(){const t=yield*e.moduleTag,{moduleId:n,instanceId:r,registry:i}=yield*i9(t);i.parallelLimiter===void 0&&(yield*Ike(i,t));const o=(d,h)=>{const p=g=>{if(g.kind==="call"||g.kind==="delay")throw Nt({code:"WORKFLOW_INVALID_TRIGGER",message:"Lifecycle onInit programs must not include call/delay (initRequired must stay sync-only; use onStart for IO/time).",programId:h,source:{stepKey:g.key},detail:{kind:g.kind}})};for(const g of d)p(g)},a=d=>d.some(h=>h.kind==="call"),c=(d,h)=>{const p=i.byActionTag.get(d);i.byActionTag.set(d,p?[...p,h]:[h])},u=Cp(t);for(const d of e.programs){const h=d.def,p=MO(h.localId);if(!p)throw Nt({code:"WORKFLOW_INVALID_DEF",message:"Workflow.install: def.localId must be a non-empty string.",detail:{localId:h.localId}});const g=`${n}.${p}`,y=vke({def:h});h.trigger.kind==="lifecycle"&&h.trigger.phase==="onInit"&&o(y,g);const b={programId:g,localId:p,trigger:h.trigger,concurrency:kke(h),priority:_ke(h),compiledSteps:y};a(y)||(b.steps=RO(y,()=>{throw Nt({code:"WORKFLOW_MISSING_SERVICE",message:"Internal error: unexpected call step while resolving call-less program.",programId:g,detail:{programId:g}})}));const S=b.concurrency==="latest"?{mode:"latest",runSeq:0,current:void 0,currentRunId:void 0}:b.concurrency==="exhaust"?{mode:"exhaust",runSeq:0,busy:!1}:{mode:"parallel",runSeq:0},w={program:b,state:S};i.entries.push(w),h.trigger.kind==="action"?c(h.trigger.actionTag,w):h.trigger.phase==="onStart"?u.lifecycle.registerStart(Eke(re(function*(){const x=yield*Ve(Uc),I=Ce(x)?x.value:void 0;yield*r9(i,t).pipe(Khe),yield*RC({entry:w,runtime:t,registry:i,trigger:{kind:"lifecycle",phase:"onStart"},payload:void 0,middleware:I})})),{name:`workflow:${p}`}):u.lifecycle.registerInitRequired(re(function*(){const x=yield*Ve(Uc),I=Ce(x)?x.value:void 0;yield*RC({entry:w,runtime:t,registry:i,trigger:{kind:"lifecycle",phase:"onInit"},payload:void 0,middleware:I})}),{name:`workflow:${p}`})}}),s9=e=>re(function*(){const t=yield*e.moduleTag,r=(yield*i9(t)).registry;if(r.watcherStarted)return;r.watcherStarted=!0,r.watcherStartCount+=1;const i=yield*Ve(Uc),o=Ce(i)?i.value:void 0,a=t.actions$,c=yield*en(r9(r,t));if(AR(c)){const{errorSummary:u,downgrade:d}=Fo(c.cause),h=d?` (downgrade=${d})`:"";yield*Ue({type:"diagnostic",moduleId:t.moduleId,instanceId:t.instanceId,code:"workflow::ports_resolution_failed",severity:"error",message:`Workflow ports resolution failed before starting watcher.${h}`,hint:`${u.name?`${u.name}: `:""}${u.message}`,kind:"workflow_ports_resolution_failed",trigger:{kind:"workflow",name:"portsResolution",details:{entryLabel:e.entryLabel}}});return}yield*Ml(a,u=>re(function*(){const d=wke(u);if(!d)return;const h=r.byActionTag.get(d);if(!h||h.length===0)return;const p=MC(u)?u.payload:void 0;yield*ln(h,g=>RC({entry:g,runtime:t,registry:r,trigger:{kind:"action",actionTag:d},payload:p,middleware:o}),{discard:!0})})).pipe(At(u=>{const{errorSummary:d,downgrade:h}=Fo(u),p=h?` (downgrade=${h})`:"";return Ue({type:"diagnostic",moduleId:t.moduleId,instanceId:t.instanceId,code:"workflow::watcher_crashed",severity:"error",message:`Workflow watcher crashed.${p}`,hint:`${d.name?`${d.name}: `:""}${d.message}`,kind:"workflow_watcher_crashed",trigger:{kind:"workflow",name:"watcher",details:{entryLabel:e.entryLabel}}})})),e.entryLabel}),_z=e=>{const t={setup:o9({moduleTag:e.moduleTag,programs:e.programs}),run:s9({moduleTag:e.moduleTag,entryLabel:"mountAll"})};return Ad(t,{id:"__logix_internal:workflows",kind:"internal",name:"workflows"}),t},Iz=e=>{const t=MO(e.program.def.localId)??"unknown",n={setup:o9({moduleTag:e.moduleTag,programs:[e.program]}),run:s9({moduleTag:e.moduleTag,entryLabel:`install:${t}`})};return Ad(n,{id:`workflow:${t}`,kind:"workflow",name:t}),n},Tke=(e,t)=>Ad(e,t),Bm=Symbol.for("logix.module.internal"),Cke=Symbol.for("logix.module.effects.declared"),a9=e=>{if(!e||typeof e!="object")return!1;const t=e._kind;return t!=="ModuleDef"&&t!=="Module"?!1:Pc(e.tag)},Mke=e=>a9(e)?typeof e.impl=="object"&&e.impl!==null&&e.impl._tag==="ModuleImpl":!1,Rke=e=>Array.isArray(e)?{logic:e[0],options:e[1]}:{logic:e},Ake=(e,t,n)=>{const r=TO(t),i=n?.id,o=r?.id,a=(n?.kind??r?.kind??"user").trim()||"user",c=n?.name??r?.name??(typeof o=="string"&&o.length>0?o:void 0),u=n?.source??r?.source;if(typeof i=="string"&&i.trim().length>0)return{id:i.trim(),derived:!1,kind:a,name:c,source:u,logic:t,origin:{explicitId:i.trim(),defaultId:o}};if(typeof o=="string"&&o.trim().length>0)return{id:o.trim(),derived:!1,kind:a,name:c,source:u,logic:t,origin:{defaultId:o.trim()}};const d=new Set(e.map(b=>b.id)),h=(c??a??"logic").trim()||"logic",p=h.replace(/\s+/g,"_");let g=1;for(;d.has(`${p}#${g}`);)g+=1;return{id:`${p}#${g}`,derived:!0,kind:a,name:c??h,source:u,logic:t,origin:{derivedBase:h}}},SS=(e,t,n)=>{const r=Ake(e,n.logic,n.options);_xe(r.logic,{resolvedId:r.id,resolvedIdKind:r.derived?"derived":"explicit",resolvedKind:r.kind,resolvedName:r.name,resolvedSource:r.source});const i=e.findIndex(u=>u.id===r.id);if(i<0)return{mounted:[...e,r],overrides:t};const o=e[i],a=[...e.slice(0,i),...e.slice(i+1),r],c=[...t,{id:r.id,from:{kind:o.kind,name:o.name,source:o.source,order:i},to:{kind:r.kind,name:r.name,source:r.source,order:a.length-1}}];return{mounted:a,overrides:c}},Ez=e=>e?`${e.file}:${e.line}:${e.column}`:"unknown",Oke=(e,t)=>t.length===0?ce:e.logic(()=>re(function*(){if(!dn()||(yield*et(yb.currentDiagnosticsLevel))==="off")return;const r=yield*e;yield*ln(t,i=>Ri({type:"diagnostic",moduleId:r.moduleId,instanceId:r.instanceId,code:"module_logic::override",severity:"warning",message:`logicUnitId "${i.id}" overridden (last-write-wins).`,hint:`from(#${i.from.order}) kind=${i.from.kind} name=${i.from.name??"unknown"} source=${Ez(i.from.source)}
65
+ to(#${i.to.order}) kind=${i.to.kind} name=${i.to.name??"unknown"} source=${Ez(i.to.source)}`,kind:"logic_unit_override"}),{discard:!0})})),Dke=(e,t,n)=>{if(!t||typeof t!="object"||Object.keys(t).length===0)return ce;const r=e.logic(i=>({setup:re(function*(){const o=i.actions,a=i.effect;if(typeof a!="function")return;const c=new WeakMap;for(const u of Object.keys(t).sort()){const d=o[u];if(!_g(d))continue;const h=t[u];if(Array.isArray(h))for(const p of h){if(typeof p!="function")continue;let g=c.get(p);g||(g=y=>p(i,y),c.set(p,g)),yield*a(d,g)}}}),run:ce}));return Ad(r,{id:"__logix_internal:effects:declared",kind:"internal",name:"effects:declared",moduleId:n}),r},Tz=e=>{const t=e.tag;return(n,r)=>{const i=t.logic(a=>{const c=Object.create(a);return c.self=Tn(()=>a.use(e)),n(c)}),o={id:r?.id,kind:r?.kind,name:r?.name,source:r?.source,moduleId:e.id};return Tke(i,o)}},Pke=(e,t)=>{const n=e.actions,r={};for(const b of Object.keys(r))if(b in n&&n[b]!==r[b])throw new Error(`[Logix.Module.make] action key "${b}" already exists; overriding action schemas is not supported (define a new action tag instead).`);const i={...e.actions,...t?.actions},o=xW(i),c=(()=>{const b=e.effects??{},S={},w=Array.from(new Set([...Object.keys(b),...Object.keys(S)])).sort();if(w.length===0)return;const x={};for(const I of w){if(!(I in o))throw new Error(`[Logix.Module.make] effect key "${I}" does not exist in actionMap.`);const _=b[I],M=S[I],C=Array.isArray(_)?_:_===void 0?[]:null,E=Array.isArray(M)?M:M===void 0?[]:null;if(C===null)throw new Error(`[Logix.Module.make] effects["${I}"] must be an array of handlers.`);if(E===null)throw new Error(`[Logix.Module.make] effects["${I}"] must be an array of handlers.`);const T=[...C,...E].filter(A=>A!==void 0);for(const A of T)if(typeof A!="function")throw new Error(`[Logix.Module.make] effects["${I}"] handlers must be functions.`);T.length>0&&(x[I]=T)}return Object.keys(x).length>0?x:void 0})(),u=b=>{if(!b)return{};const S={};for(const w of Object.keys(b)){const x=b[w];typeof x=="function"&&(S[w]=e9.mutate(x))}return S},d={...u(e.immerReducers),...e.reducers??{},...u(t?.immerReducers)};for(const b of Object.keys(d))if(!(b in o))throw new Error(`[Logix.Module.make] reducer key "${b}" does not exist in actionMap.`);const h=e.schemas||t?.schemas?{...e.schemas??{}}:void 0,p=e.meta||t?.meta?{...e.meta??{}}:void 0,g=e.services||t?.services?{...e.services??{}}:void 0,y=e.dev||t?.dev?{...e.dev??{}}:void 0;return{...e,actions:o,reducers:Object.keys(d).length>0?d:void 0,effects:c,schemas:h,meta:p,services:g,dev:y}};function Nke(e,t,n){const r=Pke(t,n),i=lke(e,{state:r.state,actions:r.actions,reducers:r.reducers,traits:r.traits});r.effects&&typeof r.effects=="object"&&Object.keys(r.effects).length>0&&Object.defineProperty(i,Cke,{value:r.effects,enumerable:!1,configurable:!0,writable:!1});const o={_kind:"ModuleDef",id:e,tag:i,shape:i.shape,stateSchema:i.stateSchema,actionSchema:i.actionSchema,actions:r.actions,reducers:r.reducers,effects:r.effects,live:i.live,schemas:r.schemas,meta:r.meta,services:r.services,dev:r.dev};o.logic=Tz(o),o.implement=u=>{const d=u.initial,h=u.imports,p=u.processes,g=u.stateTransaction,y=Array.isArray(u.__logix_workflowDefs)?u.__logix_workflowDefs:[],b=(u.logics??[]).reduce((x,I)=>SS(x.mounted,x.overrides,{logic:I}),{mounted:[],overrides:[]}),S=x=>{const I=Oke(i,x.overrides),_=Dke(i,r.effects,e),M=[...x.mounted.map(E=>E.logic),_,I];let C=i.implement({initial:d,logics:M,imports:h,processes:p,stateTransaction:g});for(const E of x.layers)C=C.withLayer(E);return C},w=x=>{const I={initial:d,imports:h,processes:p,stateTransaction:g,mounted:x.mounted,overrides:x.overrides,layers:x.layers,workflowDefs:x.workflowDefs,rebuild:()=>S(x)},_={...o,_kind:"Module",impl:S(x)};return Object.defineProperty(_,Bm,{value:I,enumerable:!1,configurable:!0}),_.logic=Tz(_),_.withLogic=(M,C)=>_.withLogics([M,C]),_.withLogics=(...M)=>{const C=_[Bm],T=M.map(Rke).reduce((A,U)=>SS(A.mounted,A.overrides,U),{mounted:C.mounted,overrides:C.overrides});return w({mounted:T.mounted,overrides:T.overrides,layers:C.layers,workflowDefs:C.workflowDefs})},_.withLayer=M=>{const C=_[Bm];return w({mounted:C.mounted,overrides:C.overrides,layers:[...C.layers,M],workflowDefs:C.workflowDefs})},_.withLayers=(...M)=>M.reduce((C,E)=>C.withLayer(E),_),_.withWorkflow=M=>{const C=M?.install,E=typeof C=="function"?C(_.tag):Iz({moduleTag:_.tag,program:M}),T=_[Bm],A=SS(T.mounted,T.overrides,{logic:E}),U=[...T.workflowDefs,M.def];return w({mounted:A.mounted,overrides:A.overrides,layers:T.layers,workflowDefs:U})},_.withWorkflows=M=>{if(!Array.isArray(M)||M.length===0)return _;const C=_z({moduleTag:_.tag,programs:M}),E=_[Bm],T=SS(E.mounted,E.overrides,{logic:C}),A=[...E.workflowDefs,...M.map(U=>U.def)];return w({mounted:T.mounted,overrides:T.overrides,layers:E.layers,workflowDefs:A})},_};return w({mounted:b.mounted,overrides:b.overrides,layers:[],workflowDefs:y})};const a=o.implement,c=(u,d)=>{const h={...o};return h.withWorkflow=p=>{const g=p?.install,y=typeof g=="function"?g(h.tag):Iz({moduleTag:h.tag,program:p});return c([...u,y],[...d,p.def])},h.withWorkflows=p=>{if(!Array.isArray(p)||p.length===0)return h;const g=_z({moduleTag:h.tag,programs:p});return c([...u,g],[...d,...p.map(y=>y.def)])},h.implement=p=>{const g=[...p.logics??[],...u];return a({...p,logics:g,__logix_workflowDefs:d})},h};return o.withWorkflow=u=>c([],[]).withWorkflow(u),o.withWorkflows=u=>c([],[]).withWorkflows(u),o}Go("@logixjs/Runtime");const Lke=VW;class MBe extends Yt("logix/kernel/sourceRefresh")(){}const Cz=e=>{const t=e;return typeof t.key=="string"?t.key:typeof t._id=="string"?t._id:typeof t.toString=="function"?t.toString():"[unknown-tag]"},$ke=e=>{const t=new Map;for(const n of e){const r=String(n.module.id),i=n.module,o=Cz(i),a={key:o,tag:i,ownerModuleId:r,source:"module"},c=t.get(o);if(c?c.push(a):t.set(o,[a]),n.serviceTags&&n.serviceTags.length>0)for(const u of n.serviceTags){const d=Cz(u),h={key:d,tag:u,ownerModuleId:r,source:"service"},p=t.get(d);p?p.push(h):t.set(d,[h])}}return t},jke=e=>{const t=$ke(e),n=[];for(const[o,a]of t){if(a.length<=1)continue;const c=new Set;for(const u of a)c.add(u.ownerModuleId);c.size>1&&n.push({key:o,conflicts:a})}if(n.length===0)return;const r=`[Logix] Tag collision detected:
66
+ `+n.map(o=>{const a=`- key: ${o.key}`,c=o.conflicts.map(u=>` - owner: ${u.ownerModuleId}, source: ${u.source}`);return[a,...c].join(`
67
+ `)}).join(`
68
+ `);throw Object.assign(new Error(r),{_tag:"TagCollisionError",collisions:n})},Fke=e=>{const t=new Set;for(const g of e.modules){const y=String(g.module.id);if(t.has(y))throw new Error(`[Logix] Duplicate Module ID/Tag detected: "${y}".
69
+ Ensure all modules in the application Runtime have unique IDs.`);t.add(y)}jke(e.modules);const n=e.stateTransaction?zo(dk,e.stateTransaction):yl,r=e.concurrencyPolicy?zo(fW,e.concurrencyPolicy):yl,i=e.readQueryStrictGate?zo(dW,e.readQueryStrictGate):yl,o=e.modules.map(g=>String(g.module.id)),a=o.length===1?o[0]:o.slice().sort().join("~"),c=e.hostScheduler!==void 0?zo(Ep,e.hostScheduler):void 0,u=ed(c??pW)(ed(hW)(ed(mW)(gW()))),d=e.layer.pipe(fH(u)),h=Ac(u,d,c??yl,n,r,i,nxe(),dH(Dc,re(function*(){return{context:void 0,ready:yield*mr(),appId:a,appModuleIds:o}}))),p=tpe(re(function*(){const g=yield*TA,[y,b]=yield*Dhe(re(function*(){const w=yield*ry(h,g),x=e.modules.length>0?yield*Ea(ry(e.modules.length===1?e.modules[0].layer:e.modules.slice(1).reduce((C,E)=>Jhe(C,E.layer),e.modules[0].layer),g),w):void 0,I=x?_s(w,x):w,_=Oa(I,Dc);_.context=I,yield*ri(_.ready,I);const M=Oa(I,EO);return yield*ln(e.processes,C=>re(function*(){(yield*Ea(M.install(C,{scope:{type:"app",appId:a},enabled:!0,installedAt:"appRuntime"}),I))===void 0&&(yield*Nn(Ea(e.onError?At(C,e.onError):C,I)))}),{discard:!0}),I})),S=Zhe(zhe(y));return Ac(epe(b),S)}));return{definition:e,layer:p,makeRuntime:()=>nbe(p)}},zke=(e,t)=>{const n=Bke(t)?t:zo(e,t);return{module:e,layer:n}},Bke=e=>typeof e=="object"&&e!==null&&Xhe in e,qke=e=>t=>re(function*(){if(t.meta?.policy?.disableObservers)return yield*t.effect;if(!e?.filter||e.filter(t)){const n=t.meta??{},r={id:t.id,kind:t.kind,name:t.name,payload:t.payload,meta:t.meta};yield*Ri({type:"trace:effectop",moduleId:typeof n.moduleId=="string"?n.moduleId:void 0,instanceId:typeof n.instanceId=="string"?n.instanceId:void 0,runtimeLabel:typeof n.runtimeLabel=="string"?n.runtimeLabel:void 0,txnSeq:typeof n.txnSeq=="number"&&Number.isFinite(n.txnSeq)?Math.floor(n.txnSeq):void 0,data:r})}return yield*t.effect}),Uke=(e,t)=>[...e,qke(t)],Vke=(e,t)=>{let n=e;if(t?.observer!==!1){const r=t?.observer;n=Uke(n,r===void 0?void 0:r)}return n},kr=()=>dn();class Kke extends Yt("@logixjs/core/ScopeRegistry")(){}class RBe extends Yt("@logixjs/core/ScopeRegistry/ScopedRuntime")(){}const Hke=()=>{let e=0;const t=new Map,n=(d,h)=>{const p=t.get(d);if(p){const b=p.get(h);if(b)return b;const S=[];return p.set(h,S),S}const g=[],y=new Map;return y.set(h,g),t.set(d,y),g},r=(d,h)=>{const p=t.get(d);if(!p)return;const g=p.get(h);g&&g.length===0&&p.delete(h),p.size===0&&t.delete(d)};return{register:(d,h,p)=>{e+=1;const g=e,y=n(d,h);return kr()&&y.length>0&&console.debug(`[ScopeRegistry] Multiple registrations detected for scopeId="${d}". This is allowed (LIFO), but usually indicates scopeId collisions or missing cleanup.`),y.push({leaseId:g,value:p}),{release:()=>{const S=t.get(d)?.get(h);if(!S||S.length===0)return;const w=S[S.length-1];if(w&&w.leaseId===g){S.pop(),r(d,h);return}const x=S.findIndex(I=>I.leaseId===g);x>=0&&(S.splice(x,1),r(d,h))}}},get:(d,h)=>{const p=t.get(d)?.get(h);if(!(!p||p.length===0))return p[p.length-1].value},clearToken:(d,h)=>{const p=t.get(d);p&&(p.delete(h),p.size===0&&t.delete(d))},clearScope:d=>{t.delete(d)},clearAll:()=>{t.clear()}}},Wke=()=>zo(Kke,Hke()),Gke=_be.pipe(eW());hr.pipe(eW());const Yke=_p(Si("auto"),Si("full"),Si("dirty")),Qke=_p(Si("full"),Si("light")),Xke=_p(Si("unbounded"),Gke),Bs=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),Ew=(e,t)=>{dn()&&t.length!==0&&console.warn(["[Logix] Invalid runtime config detected.",`context: ${e}`,"issues:"].concat(t.map(n=>`- ${n}`)).join(`
70
+ `))},Vu=(e,t,n)=>{const r=[];for(const i of Object.keys(e))t.has(i)||r.push(`${n}${i}: unknown key`);return r},Mz=(e,t)=>{const n=[];if("concurrencyLimit"in e&&e.concurrencyLimit!=null&&(iO(Xke)(e.concurrencyLimit)||n.push(`${t}concurrencyLimit: expected positive int | "unbounded"`)),"losslessBackpressureCapacity"in e&&e.losslessBackpressureCapacity!=null&&dy(e.losslessBackpressureCapacity)==null&&n.push(`${t}losslessBackpressureCapacity: expected positive int`),"allowUnbounded"in e&&e.allowUnbounded!=null&&fy(e.allowUnbounded)==null&&n.push(`${t}allowUnbounded: expected boolean`),"pressureWarningThreshold"in e&&e.pressureWarningThreshold!=null){const r=e.pressureWarningThreshold;if(!Bs(r))n.push(`${t}pressureWarningThreshold: expected object`);else{const i=r.backlogCount;i!=null&&dy(i)==null&&n.push(`${t}pressureWarningThreshold.backlogCount: expected positive int`);const o=r.backlogDurationMs;o!=null&&bl(o)==null&&n.push(`${t}pressureWarningThreshold.backlogDurationMs: expected positive number`)}}return"warningCooldownMs"in e&&e.warningCooldownMs!=null&&bl(e.warningCooldownMs)==null&&n.push(`${t}warningCooldownMs: expected positive number`),n},Jke=(e,t)=>{if(!dn()||e==null)return;if(!Bs(e)){Ew(t,["expected object"]);return}const n=e,r=[];r.push(...Vu(n,new Set(["concurrencyLimit","losslessBackpressureCapacity","allowUnbounded","pressureWarningThreshold","warningCooldownMs","overridesByModuleId"]),"")),r.push(...Mz(n,""));const i=n.overridesByModuleId;if(i!=null)if(!Bs(i))r.push("overridesByModuleId: expected record");else for(const[o,a]of Object.entries(i)){const c=`overridesByModuleId.${o}.`;if(a!=null){if(!Bs(a)){r.push(`${c}<value>: expected object`);continue}r.push(...Vu(a,new Set(["concurrencyLimit","losslessBackpressureCapacity","allowUnbounded","pressureWarningThreshold","warningCooldownMs"]),c)),r.push(...Mz(a,c))}}Ew(t,r)},Rz=(e,t)=>{const n=[];if("traitConvergeMode"in e&&e.traitConvergeMode!=null&&(iO(Yke)(e.traitConvergeMode)||n.push(`${t}traitConvergeMode: expected "auto" | "full" | "dirty"`)),"traitConvergeBudgetMs"in e&&e.traitConvergeBudgetMs!=null&&bl(e.traitConvergeBudgetMs)==null&&n.push(`${t}traitConvergeBudgetMs: expected positive number`),"traitConvergeDecisionBudgetMs"in e&&e.traitConvergeDecisionBudgetMs!=null&&bl(e.traitConvergeDecisionBudgetMs)==null&&n.push(`${t}traitConvergeDecisionBudgetMs: expected positive number`),"traitConvergeTimeSlicing"in e&&e.traitConvergeTimeSlicing!=null){const r=e.traitConvergeTimeSlicing;if(!Bs(r))n.push(`${t}traitConvergeTimeSlicing: expected object`);else{const i=`${t}traitConvergeTimeSlicing.`;n.push(...Vu(r,new Set(["enabled","debounceMs","maxLagMs"]),i)),"enabled"in r&&r.enabled!=null&&typeof r.enabled!="boolean"&&n.push(`${i}enabled: expected boolean`),"debounceMs"in r&&r.debounceMs!=null&&bl(r.debounceMs)==null&&n.push(`${i}debounceMs: expected positive number`),"maxLagMs"in r&&r.maxLagMs!=null&&bl(r.maxLagMs)==null&&n.push(`${i}maxLagMs: expected positive number`)}}return n},Az=(e,t)=>{const n=[];if("enabled"in e&&e.enabled!=null&&fy(e.enabled)==null&&n.push(`${t}enabled: expected boolean`),"overrideMode"in e&&e.overrideMode!=null){const r=e.overrideMode;(typeof r!="string"||r!=="forced_off"&&r!=="forced_sync")&&n.push(`${t}overrideMode: expected "forced_off" | "forced_sync"`)}if("budgetMs"in e&&e.budgetMs!=null&&a0(e.budgetMs)==null&&n.push(`${t}budgetMs: expected non-negative number`),"debounceMs"in e&&e.debounceMs!=null&&a0(e.debounceMs)==null&&n.push(`${t}debounceMs: expected non-negative number`),"maxLagMs"in e&&e.maxLagMs!=null&&a0(e.maxLagMs)==null&&n.push(`${t}maxLagMs: expected non-negative number`),"allowCoalesce"in e&&e.allowCoalesce!=null&&fy(e.allowCoalesce)==null&&n.push(`${t}allowCoalesce: expected boolean`),"yieldStrategy"in e&&e.yieldStrategy!=null){const r=e.yieldStrategy;(typeof r!="string"||r!=="baseline"&&r!=="inputPending")&&n.push(`${t}yieldStrategy: expected "baseline" | "inputPending"`)}return n},Zke=(e,t)=>{if(!dn()||e==null)return;if(!Bs(e)){Ew(t,["expected object"]);return}const n=[];n.push(...Vu(e,new Set(["instrumentation","traitConvergeBudgetMs","traitConvergeDecisionBudgetMs","traitConvergeMode","traitConvergeTimeSlicing","traitConvergeOverridesByModuleId","txnLanes","txnLanesOverridesByModuleId"]),"")),"instrumentation"in e&&e.instrumentation!=null&&(iO(Qke)(e.instrumentation)||n.push('instrumentation: expected "full" | "light"')),n.push(...Rz(e,""));const r=e.txnLanes;if(r!=null)if(!Bs(r))n.push("txnLanes: expected object");else{const a="txnLanes.";n.push(...Vu(r,new Set(["enabled","overrideMode","budgetMs","debounceMs","maxLagMs","allowCoalesce","yieldStrategy"]),a)),n.push(...Az(r,a))}const i=e.traitConvergeOverridesByModuleId;if(i!=null)if(!Bs(i))n.push("traitConvergeOverridesByModuleId: expected record");else for(const[a,c]of Object.entries(i)){const u=`traitConvergeOverridesByModuleId.${a}.`;if(c!=null){if(!Bs(c)){n.push(`${u}<value>: expected object`);continue}n.push(...Vu(c,new Set(["traitConvergeMode","traitConvergeBudgetMs","traitConvergeDecisionBudgetMs","traitConvergeTimeSlicing"]),u)),n.push(...Rz(c,u))}}const o=e.txnLanesOverridesByModuleId;if(o!=null)if(!Bs(o))n.push("txnLanesOverridesByModuleId: expected record");else for(const[a,c]of Object.entries(o)){const u=`txnLanesOverridesByModuleId.${a}.`;if(c!=null){if(!Bs(c)){n.push(`${u}<value>: expected object`);continue}n.push(...Vu(c,new Set(["enabled","overrideMode","budgetMs","debounceMs","maxLagMs","allowCoalesce","yieldStrategy"]),u)),n.push(...Az(c,u))}}Ew(t,n)},e_e=e=>e?._tag==="ModuleImpl"?e:e?.impl,t_e=(e,t)=>{const n=e_e(e);Jke(t?.concurrencyPolicy,"Runtime.make options.concurrencyPolicy"),Zke(t?.stateTransaction,"Runtime.make options.stateTransaction");const r=t?.debug===!0?gF():t?.debug?gF(t.debug):yl,i=t?.layer??yl,o=t?.debug?Ac(i,r):i;let a=t?.middleware??[];const c=t?.devtools===!0?{}:t?.devtools;if(t?.devtools){const S=c?.observer===!1?!1:c?.observer;a=Vke(a,{observer:S})}const u=a.length>0?zo(Uc,{stack:a}):yl,d=t?.label!=null?Ac(uSe(t.label),o):o,h=t?.devtools?cSe(d,{bufferSize:c?.bufferSize,diagnosticsLevel:c?.diagnosticsLevel,traitConvergeDiagnosticsSampling:c?.traitConvergeDiagnosticsSampling}):d,p=Ac(n0e(),Wke(),h,u),g=(()=>{const S=t?.readQuery?.strictGate;if(!S)return;const w=S.mode??"off";if(w!=="off")return{mode:w,requireStatic:S.requireStatic,denyFallbackReasons:S.denyFallbackReasons}})(),y={layer:p,modules:[zke(n.module,n.layer)],processes:n.processes??[],onError:t?.onError,hostScheduler:t?.hostScheduler,stateTransaction:t?.stateTransaction,concurrencyPolicy:t?.concurrencyPolicy,readQueryStrictGate:g};return Fke(y).makeRuntime()},l9=TC;class n_e{lifecycle={onSuspend:t=>ce,onResume:t=>ce,onReset:t=>ce};emitSuspend=()=>ce;emitResume=()=>ce;emitReset=()=>ce}zo(l9,new n_e);const r_e=()=>typeof window<"u"&&typeof document<"u"?"browser":typeof process<"u"&&typeof process?.versions?.node=="string"?"node":"unknown",i_e=e=>({kind:e,isNode:e==="node",isBrowser:e==="browser"});class o_e extends Yt("@logixjs/RuntimeHost")(){}const s_e=e=>zo(o_e,e);s_e(i_e(r_e()));const a_e=e=>Cp(e).imports,Oz=new WeakMap,c9=e=>{const t=e,n=Oz.get(t);if(n)return n;const r=e.runSync(oH(Ip));return Oz.set(t,r),r},Dz=new WeakMap,l_e=e=>{const t=e,n=Dz.get(t);if(n)return n;const i=e.runSync(oH(Ep))??uk();return Dz.set(t,i),i},c_e=ed(pW)(ed(hW)(ed(mW)(gW()))),Xh=D.createContext(null);class lg extends Yt("@logixjs/react/RuntimeConfig")(){}const uo={gcTime:500,initTimeoutMs:void 0,lowPriorityDelayMs:16,lowPriorityMaxDelayMs:50},cg={gcTime:uo.gcTime,initTimeoutMs:uo.initTimeoutMs,lowPriorityDelayMs:uo.lowPriorityDelayMs,lowPriorityMaxDelayMs:uo.lowPriorityMaxDelayMs,source:"default"},Ec={gcTime:Xv("logix.react.gc_time").pipe(k1(uo.gcTime)),initTimeoutMs:kye(Xv("logix.react.init_timeout_ms")),lowPriorityDelayMs:Xv("logix.react.low_priority_delay_ms").pipe(k1(uo.lowPriorityDelayMs)),lowPriorityMaxDelayMs:Xv("logix.react.low_priority_max_delay_ms").pipe(k1(uo.lowPriorityMaxDelayMs))};re(function*(){const e=yield*Ve(lg);return Ce(e)?e.value.gcTime:yield*Ec.gcTime}),re(function*(){const e=yield*Ve(lg);if(Ce(e)){const n=e.value.initTimeoutMs;return n===void 0?Oe():De(n)}return yield*Ec.initTimeoutMs}),re(function*(){const e=yield*Ve(lg);return Ce(e)?e.value.lowPriorityDelayMs??uo.lowPriorityDelayMs??16:yield*Ec.lowPriorityDelayMs}),re(function*(){const e=yield*Ve(lg);return Ce(e)?e.value.lowPriorityMaxDelayMs??uo.lowPriorityMaxDelayMs??50:yield*Ec.lowPriorityMaxDelayMs});const Pz={load:re(function*(){const e=yield*Ve(lg);if(Ce(e))return{gcTime:e.value.gcTime,initTimeoutMs:e.value.initTimeoutMs,lowPriorityDelayMs:e.value.lowPriorityDelayMs??uo.lowPriorityDelayMs??16,lowPriorityMaxDelayMs:e.value.lowPriorityMaxDelayMs??uo.lowPriorityMaxDelayMs??50,source:"runtime"};const t=yield*Ec.gcTime,n=yield*Ec.initTimeoutMs,r=Ti(n),i=yield*Ec.lowPriorityDelayMs,o=yield*Ec.lowPriorityMaxDelayMs;return t!==uo.gcTime||Ce(n)||i!==uo.lowPriorityDelayMs||o!==uo.lowPriorityMaxDelayMs?{gcTime:t,initTimeoutMs:r,lowPriorityDelayMs:i,lowPriorityMaxDelayMs:o,source:"config"}:cg})};var u_e={};const u9="LOGIX_DOCS_PREFIX",AC=e=>e.replace(/\/+$/,""),d9=e=>e.startsWith("/")?e:`/${e}`,d_e=e=>{try{const n=u_e?.[e];return typeof n=="string"?n:void 0}catch{return}},Nz=()=>{try{const e=globalThis?.location?.origin;return typeof e=="string"&&e.length>0?e:void 0}catch{return}},f_e=()=>{const e=d_e(u9),t=e?AC(e.trim()):void 0;if(t&&t.length>0){if(/^https?:\/\//i.test(t))return t;const r=Nz();return r?AC(`${r}${d9(t)}`):t}const n=Nz();return n?`${n}/zh/docs`:void 0},h_e=e=>{const t=f_e(),n=d9(e);return t?`${AC(t)}${n}`:n},p_e=()=>h_e("/guide/essentials/react-integration"),m_e=()=>u9,Lz=new WeakMap,g_e=100,y_e=16,b_e=({phase:e,policyMode:t})=>{const[n,r]=D.useState(0);D.useEffect(()=>{const o=performance.now(),a=setInterval(()=>{r(Math.round(performance.now()-o))},100);return()=>{clearInterval(a)}},[]);const i=e==="provider.gating"?"Logix 运行时准备中…":"Logix 模块解析中…";return P.jsxs("div",{style:{padding:12,fontSize:13,lineHeight:1.4,opacity:.85,fontFamily:'ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace'},children:[P.jsxs("div",{children:[i," ",n,"ms"]}),P.jsxs("div",{style:{marginTop:6,opacity:.8},children:["policy.mode=",t,"(想“无等待”→ sync;想“少闪烁”→ defer+preload)"]})]})},v_e=e=>e.fallback!==void 0?e.fallback:kr()?P.jsx(b_e,{phase:e.phase,policyMode:e.policyMode}):null,S_e=e=>{!kr()&&!Md()||e.runtime.runPromise(Ri({type:"trace:react.fallback.duration",data:{phase:e.phase,policyMode:e.policyMode,durationMs:Math.round(e.durationMs*100)/100,blockers:e.blockers}})).catch(()=>{})},w_e=e=>{if(!kr())return;const t=g_e,n=e.durationMs>=t,r=e.phase==="react.suspense"&&e.policyMode!=="sync"&&e.durationMs>=y_e&&e.durationMs<t;if(!n&&!r)return;const i=e.runtime,o=Lz.get(i)??new Set;Lz.set(i,o);const c=`${n?"visible":"flash"}::${e.phase}::${e.policyMode}::${e.blockers??"none"}`;if(o.has(c))return;o.add(c);const u=`Docs: ${p_e()} (override via ${m_e()})`,d=n?"[Logix][React] Fallback visible":"[Logix][React] Suspense fallback resolved quickly",h=n?e.phase==="provider.gating"?e.policyMode==="sync"?'Hint: You are using policy.mode="sync", but the provider is still waiting for dependencies (layer/config). Consider using "suspend"/"defer" (default UX), and/or make your layer/config ready earlier.':"Hint: RuntimeProvider is still waiting for dependencies (layer/config/preload). Provide a fallback, use defer+preload, or switch to sync (deterministic, but render-blocking).":'Hint: Suspense fallback is active (module resolve). If you prefer fewer fallbacks, use defer+preload; if you prefer “no waiting”, switch to policy.mode="sync" (moves the cost to render-time sync blocking).':'Hint: This fallback is short. If you want to eliminate the flicker, consider policy.mode="sync" (but it may introduce render-time sync blocking).',p=r?'Example: <RuntimeProvider policy={{ mode: "sync" }} fallback={<Loading />}>…</RuntimeProvider>':e.phase==="provider.gating"?'Example: <RuntimeProvider policy={{ mode: "defer", preload: [MyImpl] }} fallback={<Loading />}>…</RuntimeProvider>':'Example: <RuntimeProvider policy={{ mode: "sync" }} fallback={<Loading />}>…</RuntimeProvider>';(n?console.warn:console.info)(d,`(${Math.round(e.durationMs)}ms)`,`
71
+ `,`phase=${e.phase}`,`
72
+ `,`policy.mode=${e.policyMode}`,e.blockers?`
73
+ blockers=${e.blockers}`:"",`
74
+ `,h,`
75
+ `,p,`
76
+ `,u)},x_e=({runtime:e,phase:t,policyMode:n,blockers:r,children:i})=>(D.useEffect(()=>{const o=performance.now();return()=>{const a=performance.now()-o;S_e({runtime:e,phase:t,policyMode:n,durationMs:a,blockers:r}),w_e({runtime:e,phase:t,policyMode:n,durationMs:a,blockers:r})}},[e,t,n,r]),P.jsx(P.Fragment,{children:i})),k_e=({children:e})=>P.jsx(P.Fragment,{children:e}),$z=e=>{const n=kr()||Md()?x_e:k_e;return P.jsx(n,{...e})},__e=e=>e instanceof Error?e.stack??e.message:String(e),Ru=e=>{kr()&&console.debug("[RuntimeProvider] Scope.close failed",__e(e))},OC=(e,t,n,r)=>{const i=D.useRef(null),[o,a]=D.useState(()=>({binding:null,isLoading:n&&!!t,runtime:e,layer:t,enabled:n}));D.useEffect(()=>{if(!n||!t){const S=i.current;S&&(i.current=null,e.runPromise(bi(S.scope,js)).catch(Ru)),a(w=>w.binding===null&&w.isLoading===!1&&w.layer===void 0&&w.enabled===n?w:{binding:null,isLoading:!1,runtime:w.runtime,layer:void 0,enabled:n});return}const u=i.current;if(u&&u.runtime===e&&u.layer===t&&u.enabled===n){a({binding:u,isLoading:!1,runtime:e,layer:t,enabled:n});return}const d=u??o.binding;kr()&&d&&d.layer!==t&&n&&t&&console.warn("[RuntimeProvider] Rebuilding layer due to a new layer reference. Memoize the Layer in the caller to avoid repeated rebuilds and resource churn."),u&&(i.current=null,e.runPromise(bi(u.scope,js)).catch(Ru));let h=!1;a({binding:null,isLoading:!0,runtime:e,layer:t,enabled:n});const p=rw(vg()),g=re(function*(){const S=yield*ry(t,p),w=M=>iH(vp(M,p),C=>_s(C,S)),x=yield*w(et(cH)),I=yield*w(et(uH)),_=yield*w(et(yb.currentDebugSinks));return{context:S,loggers:x,logLevel:I,debugSinks:_}}),y=S=>{if(h)return e.runPromise(bi(p,js)).catch(Ru);const w=i.current,x={context:S.context,loggers:S.loggers,logLevel:S.logLevel,debugSinks:S.debugSinks,scope:p,runtime:e,layer:t,enabled:n};return i.current=x,a({binding:x,isLoading:!1,runtime:e,layer:t,enabled:n}),w?e.runPromise(bi(w.scope,js)).catch(Ru):Promise.resolve()};let b=!1;try{const S=e.runSync(g);b=!0,y(S)}catch{}return b||e.runPromise(g).then(y).catch(S=>{if(r){const w=Qg(S);e.runFork(r(w,{source:"provider",phase:"provider.layer.build"}).pipe(At(()=>ce)))}e.runPromise(bi(p,js)).catch(Ru),h||(console.error("[RuntimeProvider] Failed to build layer",S),a({binding:null,isLoading:!1,runtime:e,layer:t,enabled:n}))}),()=>{h=!0;const S=i.current;if(S){i.current=null,e.runPromise(bi(S.scope,js)).catch(Ru);return}e.runPromise(bi(p,js)).catch(Ru)}},[e,t,n,r]);const c=o.binding!==null&&o.runtime===e&&o.layer===t&&o.enabled===n&&n&&!!t;return{binding:c?o.binding:null,isLoading:c?o.isLoading:n&&!!t}},f9=(e,t,n,r,i,o)=>{if(t.length===0&&n.length===0&&r.length===0&&i.length===0&&o.length===0)return e;const a=d=>t.reduceRight((h,p)=>iH(h,g=>_s(g,p)),n.reduceRight((h,p)=>vp(h,p),d)),c=d=>{const h=r.length>0?r[r.length-1]:null,p=i.length>0?i[i.length-1]:null,g=o.length>0?o[o.length-1]:null;let y=d;return h&&(y=Cn(cH,h)(y)),p&&(y=Cn(uH,p)(y)),g&&g.length>0&&(y=Cn(yb.currentDebugSinks,g)(y)),y};return{...e,runFork:(d,h)=>e.runFork(c(a(d)),h),runPromise:(d,h)=>e.runPromise(c(a(d)),h),runPromiseExit:(d,h)=>e.runPromiseExit(c(a(d)),h),runSync:d=>e.runSync(c(a(d))),runSyncExit:d=>e.runSyncExit(c(a(d))),runCallback:(d,h)=>e.runCallback(c(a(d)),h)}};xi({value:hr});const I_e=xi({id:Ht,warehouseId:Ht});xi({items:o0(I_e),digest:Ht,errors:lbe});const jz="__LOGIX_REACT_YIELD_BUDGET_MEMORY__",E_e=()=>{const e=globalThis,t=e[jz];if(t&&t.byRuntime instanceof WeakMap)return t;const n={byRuntime:new WeakMap};return e[jz]=n,n},Fz=e=>{const t=E_e(),n=t.byRuntime.get(e);if(n)return n;const r=new Map;return t.byRuntime.set(e,r),r},T_e=(e,t)=>{if(e.length===0)return Number.NaN;const n=Math.min(1,Math.max(0,t)),r=Math.floor(n*(e.length-1));return e[r]},C_e=e=>{if(e.length===0)return Number.NaN;const t=e.slice().sort((n,r)=>n-r);return T_e(t,.95)},ug={shouldYield(e){const t=e.policy?.onlyWhenOverBudgetMs;if(t===void 0)return{shouldYield:!0,reason:"budgetDisabled",p95Ms:void 0};const n=Fz(e.runtime),r=n.get(e.workloadKey)??{seen:!1,samplesMs:[]};if(n.has(e.workloadKey)||n.set(e.workloadKey,r),!r.seen)return r.seen=!0,{shouldYield:!0,reason:"firstRun",p95Ms:void 0};if(r.samplesMs.length===0)return{shouldYield:!0,reason:"insufficientSamples",p95Ms:void 0};const i=C_e(r.samplesMs);return Number.isFinite(i)?i>t?{shouldYield:!0,reason:"overBudget",p95Ms:i}:{shouldYield:!1,reason:"underBudget",p95Ms:i}:{shouldYield:!0,reason:"insufficientSamples",p95Ms:void 0}},record(e){if(!Number.isFinite(e.durationMs)||e.durationMs<0)return;const t=Fz(e.runtime),n=t.get(e.workloadKey)??{seen:!0,samplesMs:[]};t.has(e.workloadKey)||t.set(e.workloadKey,n),n.samplesMs.push(e.durationMs),n.samplesMs.length>20&&n.samplesMs.shift()}},zz=new WeakMap,M_e=500,W1=500,R_e=5,A_e=e=>e instanceof Error?e.stack??e.message:String(e),Bz=new Set,As=(e,t)=>{if(!kr())return;const n=A_e(t);if(n.includes("ManagedRuntime disposed"))return;const r=`${e}
77
+ ${n}`;Bz.has(r)||(Bz.add(r),console.debug(e,n))},qz=e=>{const t=Ti(ew(e));if(t!==void 0)return t;const n=Ti(S5(e));return n!==void 0?n:e},Uz=e=>{switch(e){case"none":return ce;case"microtask":return qc();case"macrotask":return Mhe(()=>new Promise(t=>{setTimeout(t,0)}))}},Vz=(e,t,n)=>{const r=n?.strategy??"microtask";if(r==="none")return{strategy:"none",reason:"disabled"};if(n?.onlyWhenOverBudgetMs===void 0)return{strategy:r};const o=ug.shouldYield({runtime:e,workloadKey:t,policy:n});return o.shouldYield?{strategy:r,reason:o.reason,p95Ms:o.p95Ms}:{strategy:"none",reason:o.reason,p95Ms:o.p95Ms}},Kz=new Set;class O_e{constructor(t,n=M_e){this.runtime=t,this.gcDelayMs=n}entries=new Map;scheduleGC(t,n){if(n.gcTimeout)return;const r=n.gcTime;if(!Number.isFinite(r))return;const i=r<=0?0:r;n.gcTimeout=setTimeout(()=>{const o=this.entries.get(t);if(!(!o||o!==n)&&(o.gcTimeout=void 0,!(o.refCount>0||o.preloadRefCount>0))){if(o.status==="pending"){this.scheduleGC(t,o);return}this.runtime.runPromise(bi(o.scope,js)).catch(a=>{As("[ModuleCache] Scope.close failed",a)}),this.runtime.runPromise(Ri({type:"trace:react.module-instance",moduleId:o.ownerId,instanceId:o.value?.instanceId,data:{event:"gc",key:t}})).catch(a=>{As("[ModuleCache] Debug.record failed",a)}),this.entries.delete(t)}},i)}read(t,n,r,i,o){const a=this.entries.get(t);if(a){if(kr()&&a.ownerId!==void 0&&i!==void 0&&a.ownerId!==i)throw console.error("[ModuleCache.read] resource key ownership mismatch:",`key="${t}" previously owned by "${a.ownerId}",`,`but now requested by "${i}".`),new Error(`[ModuleCache.read] resource key "${t}" has already been claimed by module "${a.ownerId}", but is now requested by module "${i}". Within the same ManagedRuntime, a given key must not be shared across different ModuleImpl definitions. Please ensure each ModuleImpl uses a distinct key when sharing ModuleRuntime instances.`);if(a.status==="pending")throw a.promise;if(a.status==="error")throw a.error;return a.value}const c=rw(vg()),u=`${o?.entrypoint??"unknown"}::${i??"unknown"}`,d=Vz(this.runtime,u,o?.yield),h={scope:c,status:"pending",promise:Promise.resolve(null),refCount:0,preloadRefCount:0,gcTime:r??this.gcDelayMs,ownerId:i,createdBy:"read",workloadKey:u,yieldStrategy:d.strategy};this.scheduleGC(t,h);const p=performance.now(),g=Uz(d.strategy).pipe(Ze(n(c))),y=this.runtime.runFork(g);h.fiber=y;const b=this.runtime.runPromise(zc(y)).then(S=>{if(xd(S))return S.value;throw qz(S.cause)});throw b.then(S=>{h.status="success",h.value=S;const w=performance.now()-p;return ug.record({runtime:this.runtime,workloadKey:u,durationMs:w}),(kr()||Md())&&(this.runtime.runPromise(Ri({type:"trace:react.module.init",moduleId:i,instanceId:S.instanceId,data:{mode:"suspend",key:t,durationMs:Math.round(w*100)/100,yieldStrategy:d.strategy,yieldReason:d.reason,yieldP95Ms:d.p95Ms}})).catch(x=>{As("[ModuleCache] Debug.record failed",x)}),this.runtime.runPromise(Ri({type:"trace:react.module-instance",moduleId:i,instanceId:S.instanceId,data:{event:"attach",key:t,mode:"suspend",gcTime:h.gcTime}})).catch(x=>{As("[ModuleCache] Debug.record failed",x)})),S}).catch(S=>{throw h.status="error",h.error=S,h.gcTime=W1,h.gcTimeout&&(clearTimeout(h.gcTimeout),h.gcTimeout=void 0),this.scheduleGC(t,h),ug.record({runtime:this.runtime,workloadKey:u,durationMs:performance.now()-p}),this.runtime.runPromise(bi(c,gg(S))).catch(w=>{As("[ModuleCache] Scope.close failed",w)}),S}),this.entries.set(t,h),h.promise=b,b}readSync(t,n,r,i,o){const a=this.entries.get(t);if(a){if(kr()&&a.ownerId!==void 0&&i!==void 0&&a.ownerId!==i)throw console.error("[ModuleCache.readSync] resource key ownership mismatch:",`key="${t}" previously owned by "${a.ownerId}",`,`but now requested by "${i}".`),new Error(`[ModuleCache.readSync] resource key "${t}" has already been claimed by module "${a.ownerId}", but is now requested by module "${i}". Within the same ManagedRuntime, a given key must not be shared across different ModuleImpl definitions. Please ensure each ModuleImpl uses a distinct key when sharing ModuleRuntime instances.`);if(a.status==="error")throw a.error;if(a.status==="pending")throw new Error(`[ModuleCache.readSync] encountered pending entry for key="${t}". This usually indicates that the same resource key is being used by both suspend:true (async) and sync consumers. Please either give different keys to async/sync callers, or stick to a single access mode for this resource.`);return a.value}const c=this.runtime.runSync(vg()),u=performance.now();try{const d=this.runtime.runSync(n(c)),h=performance.now()-u,p={scope:c,status:"success",promise:Promise.resolve(d),value:d,refCount:0,preloadRefCount:0,gcTime:r??this.gcDelayMs,ownerId:i,createdBy:"read",workloadKey:`${o?.entrypoint??"unknown"}::${i??"unknown"}`,yieldStrategy:"none"};if(this.scheduleGC(t,p),this.entries.set(t,p),kr()){const g=o?.warnSyncBlockingThresholdMs??R_e;if(g>0&&h>g){const y=`${o?.entrypoint??"unknown"}::${i??"unknown"}::${t}`;if(!Kz.has(y)){Kz.add(y);const b=o?.policyMode==="defer"?'Fix: 当前 policy.mode="defer":请检查该模块是否在 policy.preload 列表中;未预加载的模块仍可能触发二次 fallback 或同步重活。':'Fix: 建议切换到 policy.mode="suspend"(默认),并提供 RuntimeProvider.fallback;必要时启用 yield 策略。',S=o?.policyMode==="defer"?'Example: <RuntimeProvider policy={{ mode: "defer", preload: [MyImpl] }} fallback={<Loading />}>…</RuntimeProvider>':'Example: <RuntimeProvider policy={{ mode: "suspend" }} fallback={<Loading />}>…</RuntimeProvider>';console.warn("[Logix][React] Render-phase sync blocking detected",`(${Math.round(h*100)/100}ms > ${g}ms)`,`
78
+ `,`entrypoint=${o?.entrypoint??"unknown"}`,`
79
+ `,`ownerId=${i??"unknown"}`,`
80
+ `,`key=${t}`,`
81
+ `,b,`
82
+ `,S,`
83
+ `,"Docs: apps/docs/content/docs/guide/essentials/react-integration.md")}}}return(kr()||Md())&&(this.runtime.runPromise(Ri({type:"trace:react.module.init",moduleId:i,instanceId:d.instanceId,data:{mode:"sync",key:t,durationMs:Math.round(h*100)/100,yieldStrategy:"none"}})).catch(g=>{As("[ModuleCache] Debug.record failed",g)}),this.runtime.runPromise(Ri({type:"trace:react.module-instance",moduleId:i,instanceId:d.instanceId,data:{event:"attach",key:t,mode:"sync",gcTime:p.gcTime}})).catch(g=>{As("[ModuleCache] Debug.record failed",g)})),d}catch(d){this.runtime.runPromise(bi(c,gg(d))).catch(p=>{As("[ModuleCache] Scope.close failed",p)});const h={scope:c,status:"error",promise:Promise.reject(d),error:d,refCount:0,preloadRefCount:0,gcTime:W1,ownerId:i,createdBy:"read",workloadKey:`${o?.entrypoint??"unknown"}::${i??"unknown"}`,yieldStrategy:"none"};throw this.scheduleGC(t,h),this.entries.set(t,h),d}}preload(t,n,r){const i=this.entries.get(t);if(i)return i.status==="success"?(i.preloadRefCount+=1,{promise:Promise.resolve(i.value),cancel:()=>{this.cancelPreload(t,i)}}):i.status==="error"?{promise:Promise.reject(i.error),cancel:()=>{}}:(i.preloadRefCount+=1,{promise:i.promise,cancel:()=>{this.cancelPreload(t,i)}});const o=rw(vg()),a=r?.ownerId,c=r?.gcTime??this.gcDelayMs,u=`${r?.entrypoint??"unknown"}::${a??"unknown"}`,d=Vz(this.runtime,u,r?.yield),h={scope:o,status:"pending",promise:Promise.resolve(null),refCount:0,preloadRefCount:1,gcTime:c,ownerId:a,createdBy:"preload",workloadKey:u,yieldStrategy:d.strategy};this.scheduleGC(t,h),this.entries.set(t,h);const p=performance.now(),g=Uz(d.strategy).pipe(Ze(n(o))),y=this.runtime.runFork(g);h.fiber=y;const b=this.runtime.runPromise(zc(y)).then(S=>{if(xd(S))return S.value;throw qz(S.cause)});return h.promise=b,b.then(S=>{h.status="success",h.value=S,ug.record({runtime:this.runtime,workloadKey:u,durationMs:performance.now()-p})}).catch(S=>{h.status="error",h.error=S,h.gcTime=W1,h.gcTimeout&&(clearTimeout(h.gcTimeout),h.gcTimeout=void 0),this.scheduleGC(t,h),ug.record({runtime:this.runtime,workloadKey:u,durationMs:performance.now()-p}),this.runtime.runPromise(bi(o,gg(S))).catch(w=>{As("[ModuleCache] Scope.close failed",w)})}),{promise:b,cancel:()=>{this.cancelPreload(t,h)}}}cancelPreload(t,n){const r=this.entries.get(t);if(!(!r||r!==n)&&(n.preloadRefCount=Math.max(0,n.preloadRefCount-1),!(n.preloadRefCount>0)&&!(n.refCount>0))){if(n.status==="pending"){if(n.createdBy!=="preload"){this.scheduleGC(t,n);return}const i=n.fiber;n.fiber=void 0,this.entries.delete(t),i&&this.runtime.runFork(Mi(i)),this.runtime.runPromise(bi(n.scope,js)).catch(o=>{As("[ModuleCache] Scope.close failed",o)});return}n.gcTimeout&&(clearTimeout(n.gcTimeout),n.gcTimeout=void 0),this.scheduleGC(t,n)}}retain(t){const n=this.entries.get(t);return n?(n.refCount+=1,n.gcTimeout&&(clearTimeout(n.gcTimeout),n.gcTimeout=void 0),()=>{this.release(t)}):()=>{}}release(t){const n=this.entries.get(t);n&&(n.refCount-=1,!(n.refCount>0)&&this.scheduleGC(t,n))}dispose(){for(const[t,n]of this.entries)n.gcTimeout&&clearTimeout(n.gcTimeout),this.runtime.runPromise(bi(n.scope,js)).catch(r=>{As("[ModuleCache] Scope.close failed",r)}),this.entries.delete(t)}}const AO=(e,t,n)=>{const r=zz.get(e);if(r&&r.version===n)return r.cache;r&&r.cache.dispose();const i=new O_e(e,t.gcTime);return zz.set(e,{version:n,cache:i}),i},D_e=e=>{if(e===null)return"null";const t=typeof e;return t==="string"?`s:${e}`:t==="number"?`n:${e}`:t==="boolean"?`b:${e}`:`${t}:${Object.prototype.toString.call(e)}`},P_e=e=>(kr()&&e.some(n=>{if(n===null)return!1;const r=typeof n;return r==="object"||r==="function"})&&console.warn("[ModuleCache] deps contains non-primitive values. stableHash() only distinguishes primitives (string/number/boolean/null/undefined); object/function entries may not trigger expected cache updates. Consider passing explicit primitive deps or controlling invalidation via `key`."),e.map(D_e).join("|")),h9=5,N_e=5,L_e="microtask",p9=e=>!!e&&typeof e=="object"&&e._tag==="ModuleImpl",m9=e=>!e||typeof e!="object"&&typeof e!="function"?!1:e._kind==="ModuleTag",g9=e=>`preload:impl:${e}`,y9=e=>`preload:tag:${e}`,b9=e=>({strategy:e?.strategy??L_e,onlyWhenOverBudgetMs:e?.onlyWhenOverBudgetMs}),$_e=e=>{if(!e)return null;const t=Array.isArray(e)?{handles:e}:e,n=[];for(const r of t.handles??[])(p9(r)||m9(r))&&n.push(r);return{handles:n,concurrency:Math.max(1,t.concurrency??h9),yield:b9(t.yield)}},j_e=e=>{const t=e.parentPolicy?.mode,n=e.policy?.mode??(t!==void 0?t:"suspend"),r=n==="sync"?"sync":"suspend",i=n==="defer"?$_e(e.policy?.preload):null,o=new Map,a=new Map;if(i){for(const c of i.handles)if(p9(c)){const u=c.module.id??"ModuleImpl";o.set(u,g9(u))}else if(m9(c)){const u=c.id??"ModuleTag";a.set(u,y9(u))}}return{mode:n,moduleImplMode:r,moduleTagMode:r,syncBudgetMs:Math.max(0,e.policy?.syncBudgetMs??e.parentPolicy?.syncBudgetMs??N_e),yield:b9(e.policy?.yield??e.parentPolicy?.yield),preload:i?{...i,keysByModuleId:o,keysByTagId:a}:null}},Hz=new WeakMap,F_e=({layer:e,runtime:t,children:n,fallback:r,policy:i,onError:o})=>{const a=D.useContext(Xh),c=z_e(t,a),u=D.useMemo(()=>j_e({policy:i,parentPolicy:a?.policy??null}),[i,a?.policy]),d=xn.useRef(o);d.current=o;const h=D.useMemo(()=>{try{return c9(c),!0}catch{return!1}},[c]),{binding:p}=OC(c,c_e,!h,d.current),{binding:g}=OC(c,e,!!e,d.current),y=D.useMemo(()=>o?{record:j=>{const $=d.current;return $?j.type==="lifecycle:error"?$(j.cause,{source:"provider",phase:"debug.lifecycle_error",moduleId:j.moduleId,instanceId:j.instanceId,runtimeLabel:j.runtimeLabel}).pipe(At(()=>ce)):j.type==="diagnostic"&&j.severity==="error"?$(Qx({code:j.code,message:j.message,hint:j.hint}),{source:"provider",phase:"debug.diagnostic_error",code:j.code,message:j.message,hint:j.hint,moduleId:j.moduleId,instanceId:j.instanceId,runtimeLabel:j.runtimeLabel}).pipe(At(()=>ce)):ce:ce}}:null,[!!o]),b=D.useMemo(()=>{if(!y)return[];if(g)return g.debugSinks;try{return c.runSync(et(yb.currentDebugSinks))}catch{return[]}},[c,g,y]),S=D.useMemo(()=>p||g||y?f9(c,[...p?[p.context]:[],...g?[g.context]:[]],[...p?[p.scope]:[],...g?[g.scope]:[]],g?[g.loggers]:p?[p.loggers]:[],g?[g.logLevel]:p?[p.logLevel]:[],[y?[y,...b]:g?g.debugSinks:[]]):c,[c,b,g,y,p]),w=xn.useRef(!1),[x,I]=D.useState(()=>{const B=u.syncBudgetMs;if(B<=0)return{snapshot:cg,version:1,loaded:!1,loadMode:"none"};if(Hz.has(c))return{snapshot:cg,version:1,loaded:!1,loadMode:"none"};const j=performance.now();try{const $=S.runSync(Pz.load),F=performance.now()-j,K=F>B;return K&&Hz.set(c,!0),{snapshot:$,version:1,loaded:!K,loadMode:"sync",syncDurationMs:F,syncOverBudget:K}}catch{return{snapshot:cg,version:1,loaded:!1,loadMode:"none"}}});D.useEffect(()=>{x.loadMode==="sync"&&(w.current||(w.current=!0,S.runPromise(Ri({type:"trace:react.runtime.config.snapshot",data:{source:x.snapshot.source,mode:"sync",durationMs:x.syncDurationMs!==void 0?Math.round(x.syncDurationMs*100)/100:void 0,syncBudgetMs:u.syncBudgetMs,overBudget:!!x.syncOverBudget}})).catch(()=>{})))},[x,u.syncBudgetMs,S]),D.useEffect(()=>{let B=!1;return S.runPromise(Pz.load).then(j=>{B||(I($=>{if($.snapshot.gcTime===j.gcTime&&$.snapshot.initTimeoutMs===j.initTimeoutMs&&$.snapshot.lowPriorityDelayMs===j.lowPriorityDelayMs&&$.snapshot.lowPriorityMaxDelayMs===j.lowPriorityMaxDelayMs&&$.snapshot.source===j.source&&$.loaded)return $;const K=$.snapshot.gcTime!==j.gcTime;return{snapshot:j,version:K?$.version+1:$.version,loaded:!0,loadMode:"async"}}),S.runPromise(Ri({type:"trace:react.runtime.config.snapshot",data:{source:j.source,mode:"async"}})).catch(()=>{}))}).catch(j=>{B||(console.debug("[RuntimeProvider] Failed to load React runtime config snapshot, fallback to default.",j),I($=>({snapshot:cg,version:$.version,loaded:!0,loadMode:"async"})))}),()=>{B=!0}},[S]);const _=D.useMemo(()=>({runtime:S,reactConfigSnapshot:x.snapshot,configVersion:x.version,policy:u}),[S,x,u]),M=h||p!==null,C=!e||g!==null,E=x.loaded,T=B=>v_e({fallback:r,phase:B,policyMode:u.mode}),[A,U]=D.useState(!1);D.useEffect(()=>{if(u.mode!=="defer"){U(!1);return}U(!1)},[u.mode]);const R=xn.useRef(null);if(D.useEffect(()=>{if(u.mode!=="defer")return;if(U(!1),!u.preload){U(!0);return}if(!C||!E)return;let B=!1;const j=AO(S,x.snapshot,x.version),$=u.preload.handles;if($.length===0){U(!0);return}const F=Math.max(1,u.preload.concurrency??h9),K=new Set;return R.current=K,(async()=>{const X=$.slice(),V=async Q=>{if(B)return;const q=performance.now();if(Q?._tag==="ModuleImpl"){const te=Q.module?.id??"ModuleImpl",pe=u.preload.keysByModuleId.get(te)??g9(te),oe=je=>ry(Q.layer,je).pipe(rt(Ge=>Oa(Ge,Q.module))),ye=j.preload(pe,oe,{ownerId:te,yield:u.preload.yield,entrypoint:"react.runtime.preload",policyMode:"defer"});K.add(ye.cancel),await ye.promise;const xe=performance.now()-q;S.runPromise(Ri({type:"trace:react.module.preload",moduleId:te,data:{mode:"defer",handleKind:"ModuleImpl",key:pe,durationMs:Math.round(xe*100)/100,concurrency:F,yieldStrategy:u.preload.yield.strategy,yieldOnlyWhenOverBudgetMs:u.preload.yield.onlyWhenOverBudgetMs}})).catch(()=>{});return}const ie=Q.id??"ModuleTag",le=u.preload.keysByTagId.get(ie)??y9(ie),ee=te=>Q.pipe(vp(te)),J=j.preload(le,ee,{ownerId:ie,yield:u.preload.yield,entrypoint:"react.runtime.preload",policyMode:"defer"});K.add(J.cancel),await J.promise;const ge=performance.now()-q;S.runPromise(Ri({type:"trace:react.module.preload",data:{mode:"defer",handleKind:"ModuleTag",tokenId:ie,key:le,durationMs:Math.round(ge*100)/100,concurrency:F,yieldStrategy:u.preload.yield.strategy,yieldOnlyWhenOverBudgetMs:u.preload.yield.onlyWhenOverBudgetMs}})).catch(()=>{})},z=Array.from({length:Math.min(F,X.length)},async()=>{for(;!B;){const Q=X.shift();if(!Q)return;await V(Q)}});await Promise.all(z)})().then(()=>{B||U(!0)}).catch(X=>{B||(d.current&&S.runFork(d.current(Qg(X),{source:"provider",phase:"provider.layer.build"}).pipe(At(()=>ce))),U(!0))}),()=>{B=!0,R.current=null;for(const X of K)X()}},[u,C,E,S,x,d]),D.useEffect(()=>{if(u.mode!=="defer"||!A)return;const B=R.current;if(!B||B.size===0)return;R.current=null;const j=Array.from(B);let $=!1;const F=()=>{if(!$){$=!0;for(const W of j)W()}},K=setTimeout(F,0);return()=>{clearTimeout(K),F()}},[u.mode,A]),!(M&&C&&E&&(u.mode!=="defer"||A))){const B=[M?null:"tick",C?null:"layer",E?null:"config",u.mode!=="defer"||A?null:"preload"].filter($=>$!==null),j=B.length>0?B.join("+"):void 0;return P.jsx($z,{runtime:S,phase:"provider.gating",policyMode:u.mode,blockers:j,children:T("provider.gating")})}const L=u.mode==="sync"?n:P.jsx(xn.Suspense,{fallback:P.jsx($z,{runtime:S,phase:"react.suspense",policyMode:u.mode,children:T("react.suspense")}),children:n});return xn.createElement(Xh.Provider,{value:_},L)},z_e=(e,t)=>{const n=e??t?.runtime;if(!n)throw new Error(`[RuntimeProvider] Missing runtime.
84
+
85
+ Fix:
86
+ - Provide \`runtime\` prop: <RuntimeProvider runtime={runtime}>...
87
+ - Or nest under an ancestor RuntimeProvider that provides \`runtime\`.
88
+ `);return n};class mk extends Error{constructor(t){super(`[${t}] RuntimeProvider not found.
89
+
90
+ Fix:
91
+ - Wrap your app (or the calling component subtree) with <RuntimeProvider runtime={runtime}>.
92
+ - If using nested providers, ensure an ancestor RuntimeProvider provides \`runtime\`.
93
+ - If you intended to call this hook outside React, use @logixjs/core directly.
94
+ `),this.name="RuntimeProviderNotFoundError"}}function OO(e){const t=D.useContext(Xh);if(!t)throw new mk("useRuntime");D.useRef(null);const n=D.useMemo(()=>{},[e?.layer,e?.layers]),r=D.useRef(null);D.useEffect(()=>{kr()&&(r.current=null)},[e?.layers]);const{binding:i}=OC(t.runtime,n,!!n);return D.useMemo(()=>i?f9(t.runtime,[i.context],[i.scope],[i.loggers],[i.logLevel],[i.debugSinks]):t.runtime,[t.runtime,i])}const Tw=e=>typeof e=="object"&&e!==null&&"runtime"in e&&"actions"in e&&"dispatch"in e,v9=e=>{const t=new Map;return new Proxy({},{get:(r,i)=>{if(t.has(i))return t.get(i);if(i==="dispatch")return t.set(i,e),e;if(i==="then"||typeof i!="string")return;const o=(...a)=>{const c=a[0];e({_tag:i,payload:c})};return t.set(i,o),o}})};function DC(e,t){const n=new Map;if(t){const i={};for(const[o,a]of Object.entries(t)){const c=Object.assign(((...u)=>{const d=a(...u);return e(d),d}),a);i[o]=c}return i}return new Proxy({},{get:(i,o)=>{if(n.has(o))return n.get(o);if(o==="then"||o==="dispatch"||typeof o!="string")return;const a=(...c)=>{const u=c[0],d={_tag:o,payload:u};return e(d),d};return n.set(o,a),a}})}const B_e=Symbol.for("logix.module.handle.extend"),q_e=e=>typeof e=="object"&&e!==null||typeof e=="function",U_e=(e,t,n)=>{if(!q_e(e))return n;const r=e[B_e];if(typeof r!="function")return n;const i=r(t,n);return!i||typeof i!="object"?n:{...n,...i}},Wz=e=>typeof e=="object"&&e!==null&&"dispatch"in e&&"getState"in e;function DO(e){const t=OO(),n=D.useContext(Xh);if(!n)throw new mk("useModuleRuntime");const r=D.useMemo(()=>AO(n.runtime,n.reactConfigSnapshot,n.configVersion),[n.runtime,n.reactConfigSnapshot,n.configVersion]),i=!Tw(e)&&!Wz(e),o=D.useMemo(()=>{if(Tw(e))return e.runtime;if(Wz(e))return e;const a=e,c=a.id??"ModuleTag",d=n.policy.preload?.keysByTagId.get(c)??`tag:${c}`,h=n.policy.moduleTagMode,p=g=>a.pipe(vp(g));return h==="suspend"?r.read(d,p,void 0,c,{entrypoint:"react.useModuleRuntime",policyMode:n.policy.mode,yield:n.policy.yield}):r.readSync(d,p,void 0,c,{entrypoint:"react.useModuleRuntime",policyMode:n.policy.mode,warnSyncBlockingThresholdMs:5})},[r,n.policy,e]);return D.useEffect(()=>{if(!i||!kr()&&!Md())return;const a=e?.id??"ModuleTag",c=Ri({type:"trace:react.moduleTag.resolve",moduleId:o.moduleId,instanceId:o.instanceId,data:{mode:n.policy.moduleTagMode,tokenId:a,yieldStrategy:n.policy.yield.strategy}});t.runFork(c)},[t,n.policy,o,e,i]),o}var G1={exports:{}},Y1={},Q1={exports:{}},X1={};var Gz;function V_e(){if(Gz)return X1;Gz=1;var e=Cy();function t(p,g){return p===g&&(p!==0||1/p===1/g)||p!==p&&g!==g}var n=typeof Object.is=="function"?Object.is:t,r=e.useState,i=e.useEffect,o=e.useLayoutEffect,a=e.useDebugValue;function c(p,g){var y=g(),b=r({inst:{value:y,getSnapshot:g}}),S=b[0].inst,w=b[1];return o(function(){S.value=y,S.getSnapshot=g,u(S)&&w({inst:S})},[p,y,g]),i(function(){return u(S)&&w({inst:S}),p(function(){u(S)&&w({inst:S})})},[p]),a(y),y}function u(p){var g=p.getSnapshot;p=p.value;try{var y=g();return!n(p,y)}catch{return!0}}function d(p,g){return g()}var h=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?d:c;return X1.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:h,X1}var Yz;function K_e(){return Yz||(Yz=1,Q1.exports=V_e()),Q1.exports}var Qz;function H_e(){if(Qz)return Y1;Qz=1;var e=Cy(),t=K_e();function n(d,h){return d===h&&(d!==0||1/d===1/h)||d!==d&&h!==h}var r=typeof Object.is=="function"?Object.is:n,i=t.useSyncExternalStore,o=e.useRef,a=e.useEffect,c=e.useMemo,u=e.useDebugValue;return Y1.useSyncExternalStoreWithSelector=function(d,h,p,g,y){var b=o(null);if(b.current===null){var S={hasValue:!1,value:null};b.current=S}else S=b.current;b=c(function(){function x(E){if(!I){if(I=!0,_=E,E=g(E),y!==void 0&&S.hasValue){var T=S.value;if(y(T,E))return M=T}return M=E}if(T=M,r(_,E))return T;var A=g(E);return y!==void 0&&y(T,A)?(_=E,T):(_=E,M=A)}var I=!1,_,M,C=p===void 0?null:p;return[function(){return x(h())},C===null?void 0:function(){return x(C())}]},[h,p,g,y]);var w=i(d,b[0],b[1]);return a(function(){S.hasValue=!0,S.value=w},[w]),u(w),w},Y1}var Xz;function W_e(){return Xz||(Xz=1,G1.exports=H_e()),G1.exports}var G_e=W_e();const PC=new WeakMap,Y_e=e=>{const t=PC.get(e);if(t)return t;const n=new Map;return PC.set(e,n),n},S9=(e,t)=>`${e}::${t}`,Q_e=(e,t)=>`${e}::rq:${t}`,w9=e=>c9(e),X_e=e=>l_e(e),x9=(e,t,n)=>{const r=Y_e(e),i=r.get(t);if(i)return i;const o=n();return r.set(t,o),o},J_e=(e,t)=>{const n=PC.get(e);n&&n.delete(t)},k9=e=>{const{runtime:t,runtimeStore:n,topicKey:r}=e,i=X_e(t);let o,a=!1,c;const u=new Set;let d;const h=e.options?.lowPriorityDelayMs??16,p=e.options?.lowPriorityMaxDelayMs??50;let g=!1,y=!1,b,S,w;const x=()=>{y&&(y=!1,b?.(),b=void 0,S?.(),S=void 0,w?.(),w=void 0)},I=()=>{g=!1,x();for(const U of u)try{U()}catch{}},_=U=>{if(U==="low"){if(g||y)return;y=!0;const R=()=>{y&&I()},N=()=>{y&&(w=i.scheduleAnimationFrame(R))};h<=0?N():b=i.scheduleTimeout(h,N),S=i.scheduleTimeout(p,R);return}x(),!g&&(g=!0,i.scheduleMicrotask(I))},M=()=>{try{_(n.getTopicPriority(r))}catch{}},C=()=>{d||(d=n.subscribeTopic(r,M))},E=()=>{if(a)try{const U=n.getTopicVersion(r);o!==U&&_(n.getTopicPriority(r))}catch{}},T=()=>{const U=n.getTopicVersion(r);if(a&&o===U)return c;const R=e.readSnapshot();return o=U,a=!0,c=R,R};return{getSnapshot:T,getServerSnapshot:T,subscribe:U=>{const R=u.size===0;if(u.add(U),C(),E(),R)try{e.onFirstListener?.()}catch{}return()=>{if(u.delete(U),u.size>0)return;try{e.onLastListener?.()}catch{}const N=d;d=void 0,x();try{N?.()}catch{}J_e(t,r)}}}},Z_e=(e,t,n)=>{const r=S9(t.moduleId,t.instanceId),i=w9(e);return x9(e,r,()=>k9({runtime:e,runtimeStore:i,topicKey:r,readSnapshot:()=>{const o=i.getModuleState(r);return o!==void 0?o:e.runSync(t.getState)},options:n}))},eIe=(e,t,n,r)=>{const i=S9(t.moduleId,t.instanceId),o=Q_e(i,n.selectorId),a=w9(e);let c;return x9(e,o,()=>k9({runtime:e,runtimeStore:a,topicKey:o,readSnapshot:()=>{const d=a.getModuleState(i)??e.runSync(t.getState);return n.select(d)},options:r,onFirstListener:()=>{if(c)return;const u=vh(t.changesReadQueryWithMeta(n));c=e.runFork(u)},onLastListener:()=>{const u=c;u&&(c=void 0,e.runFork(Mi(u)))}}))},NC=e=>typeof e=="object"&&e!==null,Jz=e=>NC(e)&&typeof e[Symbol.iterator]=="function",tIe=(e,t)=>{if(Object.is(e,t))return!0;if(!NC(e)||!NC(t))return!1;if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return!1;for(let i=0;i<e.length;i++)if(!Object.is(e[i],t[i]))return!1;return!0}if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(const[i,o]of e)if(!t.has(i)||!Object.is(o,t.get(i)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(const i of e)if(!t.has(i))return!1;return!0}if(Jz(e)&&Jz(t)){const i=e[Symbol.iterator](),o=t[Symbol.iterator]();for(;;){const a=i.next(),c=o.next();if(a.done||c.done)return a.done===c.done;if(!Object.is(a.value,c.value))return!1}}const n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(const i of n)if(!Object.prototype.hasOwnProperty.call(t,i)||!Object.is(e[i],t[i]))return!1;return!0};function ao(e,t,n){const r=D.useContext(Xh);if(!r)throw new mk("useSelector");const i=r.runtime,o=DO(e),a=t??(g=>g),c=D.useMemo(()=>typeof t=="function"?Lke(t):void 0,[t]),u=D.useMemo(()=>typeof n=="function"?n:typeof t!="function"?Object.is:c?.equalsKind==="shallowStruct"?tIe:Object.is,[n,t,c?.equalsKind]),d=typeof t=="function"&&c?.lane==="static"&&c.readsDigest!=null&&c.fallbackReason==null,h=D.useMemo(()=>d&&c?eIe(i,o,c,{lowPriorityDelayMs:r.reactConfigSnapshot.lowPriorityDelayMs,lowPriorityMaxDelayMs:r.reactConfigSnapshot.lowPriorityMaxDelayMs}):Z_e(i,o,{lowPriorityDelayMs:r.reactConfigSnapshot.lowPriorityDelayMs,lowPriorityMaxDelayMs:r.reactConfigSnapshot.lowPriorityMaxDelayMs}),[o,i,r.reactConfigSnapshot.lowPriorityDelayMs,r.reactConfigSnapshot.lowPriorityMaxDelayMs,c,d]),p=G_e.useSyncExternalStoreWithSelector(h.subscribe,h.getSnapshot,h.getServerSnapshot??h.getSnapshot,d?g=>g:g=>a(g),u);return D.useEffect(()=>{if(!kr()&&!Md())return;const g=o.instanceId;let y,b;if(typeof t=="function"){const w=t,x=w.fieldPaths;if(Array.isArray(x)){const _=x.filter(M=>typeof M=="string");y=_.length>0?_.slice():void 0}const I=w.debugKey;b=typeof I=="string"&&I.length>0?I:typeof t.name=="string"&&t.name.length>0?t.name:void 0}const S=Ri({type:"trace:react-selector",moduleId:o.moduleId,instanceId:g,data:{componentLabel:"useSelector",selectorKey:b,fieldPaths:y,selectorId:c?.selectorId,lane:c?.lane,producer:c?.producer,fallbackReason:c?.fallbackReason,readsDigest:c?.readsDigest,equalsKind:c?.equalsKind,strictModePhase:"commit"}});i.runFork(S)},[i,o,t,p,c]),p}const Zz=(e,t,n)=>{const r=e.get(t);if(r)return r;const i=n();return e.set(t,i),i},nIe=new WeakMap,_9=(e,t,n)=>{const r=Zz(nIe,e,()=>new WeakMap),i=Zz(r,t,()=>new WeakMap),o=i.get(n);if(o)return o;const c=a_e(t).get(n);if(c){const y=Object.assign(x=>{e.runFork(c.dispatch(x))},{batch:x=>{e.runFork(c.dispatchBatch(x))},lowPriority:x=>{e.runFork(c.dispatchLowPriority(x))}}),b=v9(y),S=DC(y,n.actions),w={def:n,runtime:c,dispatch:y,actions:b,dispatchers:S,imports:{get:x=>_9(e,c,x)},getState:c.getState,setState:c.setState,actions$:c.actions$,changes:c.changes,ref:c.ref};return i.set(n,w),w}const u=t.moduleId,d=String(n.id),h=t.instanceId,p=kr()?["- Ensure the child is imported in the same scope.",` Example: ${u}.implement({ imports: [${d}.impl], ... })`,"- Ensure parentRuntime is an instance scope (not a ModuleTag singleton)."," Example: useModule(ParentImpl, { key }) / useModule(ParentImpl) / useLocalModule(ParentModule, ...)","- If you intentionally want a singleton (not an imported child), use useModule(Child.tag) (ModuleTag) in the current React runtime environment.","- If you intentionally want the root provider singleton (ignore RuntimeProvider.layer overrides), use runtime.runSync(Root.resolve(Child.tag))."]:[],g=new Error(kr()?["[MissingImportedModuleError] Cannot resolve imported module from parent imports scope.","",`tokenId: ${d}`,"entrypoint: react.useImportedModule/imports.get","mode: strict",`startScope: moduleId=${u}, instanceId=${h}`,"","fix:",...p].join(`
95
+ `):"[MissingImportedModuleError] imported module runtime not found");throw g.tokenId=d,g.entrypoint="react.useImportedModule/imports.get",g.mode="strict",g.startScope={moduleId:u,instanceId:h},g.fix=p,g.name="MissingImportedModuleError",g},rIe=()=>xn.useId(),Au=e=>!!e&&typeof e=="object"&&e._tag==="ModuleImpl",eB=e=>Mke(e),tB=e=>a9(e)&&e._kind==="ModuleDef";function iIe(e,t,n){const r=OO(),i=xn.useContext(Xh);if(!i)throw new mk("useModule");const o=eB(e)?e.impl:tB(e)?e.tag:e;let a,c;if(Au(o))typeof t=="function"?a=t:t&&typeof t=="object"&&(c=t);else if(typeof t=="function"||t===void 0)a=t;else if(t&&typeof t=="object")throw new Error("useModule(handle, options) 仅支持 ModuleImpl 句柄");let u;if(Au(o)){const S=xn.useMemo(()=>AO(r,i.reactConfigSnapshot,i.configVersion),[r,i.reactConfigSnapshot,i.configVersion]),w=c?.deps??[],x=P_e(w),I=c?.suspend===!0,_=I||c?.suspend!==!1&&i.policy.moduleImplMode==="suspend",M=c?.gcTime??i.reactConfigSnapshot.gcTime;let C=_?c?.initTimeoutMs:void 0;if(_&&C===void 0&&(C=i.reactConfigSnapshot.initTimeoutMs),I&&(!c||!c.key)&&kr())throw new Error("[useModule] suspend:true 模式必须显式提供 options.key;请在 Suspense 边界外生成稳定 ID(例如 useId() 或业务 id),并在 useModule(Impl, { suspend: true, key }) 中传入该值。");const E=rIe(),T=o.module.id??"ModuleImpl",U=i.policy.preload?.keysByModuleId.get(T)??c?.key??(_?`impl:${T}`:`impl:${T}:${E}`),R=x?`${U}:${x}`:U,N=T,L=xn.useMemo(()=>$=>ry(o.layer,$).pipe(rt(F=>Oa(F,o.module))),[o]),B=xn.useMemo(()=>!_||C===void 0?L:$=>L($).pipe($he({duration:C,onTimeout:()=>new Error(`[useModule] Module "${N}" initialization timed out after ${C}ms`)})),[L,_,C,N]),j=_?S.read(R,B,M,N,{entrypoint:"react.useModule",policyMode:i.policy.mode,yield:i.policy.yield}):S.readSync(R,B,M,N,{entrypoint:"react.useModule",policyMode:i.policy.mode,warnSyncBlockingThresholdMs:5});xn.useEffect(()=>S.retain(R),[S,R]),u=j}else u=DO(o);if(xn.useEffect(()=>{if(!Au(o))return;const S=c,w=S&&"label"in S&&S.label||S&&S.key;if(!w)return;const x=Ri({type:"trace:instanceLabel",moduleId:o.module.id,instanceId:u.instanceId,data:{label:w}});r.runFork(x)},[r,u,o,c]),xn.useEffect(()=>{if(!kr()&&!Md()||!u.instanceId)return;const S=Ri({type:"trace:react-render",moduleId:u.moduleId,instanceId:u.instanceId,data:{componentLabel:"useModule",strictModePhase:"commit"}});r.runFork(S)},[r,u]),a)return Au(o)?ao(u,a,n):ao(o,a,n);const d=xn.useMemo(()=>{if(eB(e)||tB(e))return e;if(Tw(e))return e.def;if(Au(e))return e.module;if(e&&(typeof e=="object"||typeof e=="function")&&e._kind==="ModuleTag")return e;if(Au(o))return o.module;if(Tw(o))return o.def;if(o&&(typeof o=="object"||typeof o=="function")&&o._kind==="ModuleTag")return o},[e,o]),h=xn.useMemo(()=>{if(!d||typeof d!="object"&&typeof d!="function")return;const S=d;if(!(!S.actions||typeof S.actions!="object"))return S.actions},[d]),p=xn.useMemo(()=>Object.assign(w=>{r.runFork(u.dispatch(w))},{batch:w=>{r.runFork(u.dispatchBatch(w))},lowPriority:w=>{r.runFork(u.dispatchLowPriority(w))}}),[r,u]),g=xn.useMemo(()=>Au(o)?o.module:o,[o]),y=xn.useMemo(()=>v9(p),[p]),b=xn.useMemo(()=>h?DC(p,h):DC(p),[p,h]);return xn.useMemo(()=>{const S={def:d,runtime:u,dispatch:p,actions:y,dispatchers:b,imports:{get:w=>_9(r,u,w)},getState:u.getState,setState:u.setState,actions$:u.actions$,changes:u.changes,ref:u.ref};return U_e(g,u,S)},[r,u,p,y,b,g,d])}function oIe(e){const t=OO(),n=DO(e);return D.useMemo(()=>Object.assign(i=>{t.runFork(n.dispatch(i))},{batch:i=>{t.runFork(n.dispatchBatch(i))},lowPriority:i=>{t.runFork(n.dispatchLowPriority(i))}}),[t,n])}class sIe{constructor(t,n,r){this.suspendRef=t,this.resumeRef=n,this.resetRef=r}lifecycle={onSuspend:t=>bs(this.suspendRef,n=>[...n,t]).pipe(Gt),onResume:t=>bs(this.resumeRef,n=>[...n,t]).pipe(Gt),onReset:t=>bs(this.resetRef,n=>[...n,t]).pipe(Gt)};emitSuspend=()=>Xi(this.suspendRef).pipe($e(t=>ln(t,n=>n,{discard:!0})));emitResume=()=>Xi(this.resumeRef).pipe($e(t=>ln(t,n=>n,{discard:!0})));emitReset=()=>Xi(this.resetRef).pipe($e(t=>ln(t,n=>n,{discard:!0})))}const aIe=re(function*(){const e=yield*Qn([]),t=yield*Qn([]),n=yield*Qn([]);return new sIe(e,t,n)});iy(l9,aIe);var nB="popstate";function lIe(e={}){function t(r,i){let{pathname:o,search:a,hash:c}=r.location;return LC("",{pathname:o,search:a,hash:c},i.state&&i.state.usr||null,i.state&&i.state.key||"default")}function n(r,i){return typeof i=="string"?i:my(i)}return uIe(t,n,null,e)}function jr(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function ta(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function cIe(){return Math.random().toString(36).substring(2,10)}function rB(e,t){return{usr:e.state,key:e.key,idx:t}}function LC(e,t,n=null,r){return{pathname:typeof e=="string"?e:e.pathname,search:"",hash:"",...typeof t=="string"?vb(t):t,state:n,key:t&&t.key||r||cIe()}}function my({pathname:e="/",search:t="",hash:n=""}){return t&&t!=="?"&&(e+=t.charAt(0)==="?"?t:"?"+t),n&&n!=="#"&&(e+=n.charAt(0)==="#"?n:"#"+n),e}function vb(e){let t={};if(e){let n=e.indexOf("#");n>=0&&(t.hash=e.substring(n),e=e.substring(0,n));let r=e.indexOf("?");r>=0&&(t.search=e.substring(r),e=e.substring(0,r)),e&&(t.pathname=e)}return t}function uIe(e,t,n,r={}){let{window:i=document.defaultView,v5Compat:o=!1}=r,a=i.history,c="POP",u=null,d=h();d==null&&(d=0,a.replaceState({...a.state,idx:d},""));function h(){return(a.state||{idx:null}).idx}function p(){c="POP";let w=h(),x=w==null?null:w-d;d=w,u&&u({action:c,location:S.location,delta:x})}function g(w,x){c="PUSH";let I=LC(S.location,w,x);d=h()+1;let _=rB(I,d),M=S.createHref(I);try{a.pushState(_,"",M)}catch(C){if(C instanceof DOMException&&C.name==="DataCloneError")throw C;i.location.assign(M)}o&&u&&u({action:c,location:S.location,delta:1})}function y(w,x){c="REPLACE";let I=LC(S.location,w,x);d=h();let _=rB(I,d),M=S.createHref(I);a.replaceState(_,"",M),o&&u&&u({action:c,location:S.location,delta:0})}function b(w){return dIe(w)}let S={get action(){return c},get location(){return e(i,a)},listen(w){if(u)throw new Error("A history only accepts one active listener");return i.addEventListener(nB,p),u=w,()=>{i.removeEventListener(nB,p),u=null}},createHref(w){return t(i,w)},createURL:b,encodeLocation(w){let x=b(w);return{pathname:x.pathname,search:x.search,hash:x.hash}},push:g,replace:y,go(w){return a.go(w)}};return S}function dIe(e,t=!1){let n="http://localhost";typeof window<"u"&&(n=window.location.origin!=="null"?window.location.origin:window.location.href),jr(n,"No window.location.(origin|href) available to create URL");let r=typeof e=="string"?e:my(e);return r=r.replace(/ $/,"%20"),!t&&r.startsWith("//")&&(r=n+r),new URL(r,n)}function I9(e,t,n="/"){return fIe(e,t,n,!1)}function fIe(e,t,n,r){let i=typeof t=="string"?vb(t):t,o=Ol(i.pathname||"/",n);if(o==null)return null;let a=E9(e);hIe(a);let c=null;for(let u=0;c==null&&u<a.length;++u){let d=C9(o);c=xIe(a[u],d,r)}return c}function E9(e,t=[],n=[],r="",i=!1){let o=(a,c,u=i,d)=>{let h={relativePath:d===void 0?a.path||"":d,caseSensitive:a.caseSensitive===!0,childrenIndex:c,route:a};if(h.relativePath.startsWith("/")){if(!h.relativePath.startsWith(r)&&u)return;jr(h.relativePath.startsWith(r),`Absolute route path "${h.relativePath}" nested under path "${r}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),h.relativePath=h.relativePath.slice(r.length)}let p=xl([r,h.relativePath]),g=n.concat(h);a.children&&a.children.length>0&&(jr(a.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${p}".`),E9(a.children,t,g,p,u)),!(a.path==null&&!a.index)&&t.push({path:p,score:SIe(p,a.index),routesMeta:g})};return e.forEach((a,c)=>{if(a.path===""||!a.path?.includes("?"))o(a,c);else for(let u of T9(a.path))o(a,c,!0,u)}),t}function T9(e){let t=e.split("/");if(t.length===0)return[];let[n,...r]=t,i=n.endsWith("?"),o=n.replace(/\?$/,"");if(r.length===0)return i?[o,""]:[o];let a=T9(r.join("/")),c=[];return c.push(...a.map(u=>u===""?o:[o,u].join("/"))),i&&c.push(...a),c.map(u=>e.startsWith("/")&&u===""?"/":u)}function hIe(e){e.sort((t,n)=>t.score!==n.score?n.score-t.score:wIe(t.routesMeta.map(r=>r.childrenIndex),n.routesMeta.map(r=>r.childrenIndex)))}var pIe=/^:[\w-]+$/,mIe=3,gIe=2,yIe=1,bIe=10,vIe=-2,iB=e=>e==="*";function SIe(e,t){let n=e.split("/"),r=n.length;return n.some(iB)&&(r+=vIe),t&&(r+=gIe),n.filter(i=>!iB(i)).reduce((i,o)=>i+(pIe.test(o)?mIe:o===""?yIe:bIe),r)}function wIe(e,t){return e.length===t.length&&e.slice(0,-1).every((r,i)=>r===t[i])?e[e.length-1]-t[t.length-1]:0}function xIe(e,t,n=!1){let{routesMeta:r}=e,i={},o="/",a=[];for(let c=0;c<r.length;++c){let u=r[c],d=c===r.length-1,h=o==="/"?t:t.slice(o.length)||"/",p=gy({path:u.relativePath,caseSensitive:u.caseSensitive,end:d},h),g=u.route;if(!p&&d&&n&&!r[r.length-1].route.index&&(p=gy({path:u.relativePath,caseSensitive:u.caseSensitive,end:!1},h)),!p)return null;Object.assign(i,p.params),a.push({params:i,pathname:xl([o,p.pathname]),pathnameBase:CIe(xl([o,p.pathnameBase])),route:g}),p.pathnameBase!=="/"&&(o=xl([o,p.pathnameBase]))}return a}function gy(e,t){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[n,r]=kIe(e.path,e.caseSensitive,e.end),i=t.match(n);if(!i)return null;let o=i[0],a=o.replace(/(.)\/+$/,"$1"),c=i.slice(1);return{params:r.reduce((d,{paramName:h,isOptional:p},g)=>{if(h==="*"){let b=c[g]||"";a=o.slice(0,o.length-b.length).replace(/(.)\/+$/,"$1")}const y=c[g];return p&&!y?d[h]=void 0:d[h]=(y||"").replace(/%2F/g,"/"),d},{}),pathname:o,pathnameBase:a,pattern:e}}function kIe(e,t=!1,n=!0){ta(e==="*"||!e.endsWith("*")||e.endsWith("/*"),`Route path "${e}" will be treated as if it were "${e.replace(/\*$/,"/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${e.replace(/\*$/,"/*")}".`);let r=[],i="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(a,c,u)=>(r.push({paramName:c,isOptional:u!=null}),u?"/?([^\\/]+)?":"/([^\\/]+)")).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return e.endsWith("*")?(r.push({paramName:"*"}),i+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?i+="\\/*$":e!==""&&e!=="/"&&(i+="(?:(?=\\/|$))"),[new RegExp(i,t?void 0:"i"),r]}function C9(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return ta(!1,`The URL path "${e}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${t}).`),e}}function Ol(e,t){if(t==="/")return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith("/")?t.length-1:t.length,r=e.charAt(n);return r&&r!=="/"?null:e.slice(n)||"/"}var _Ie=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,IIe=e=>_Ie.test(e);function EIe(e,t="/"){let{pathname:n,search:r="",hash:i=""}=typeof e=="string"?vb(e):e,o;if(n)if(IIe(n))o=n;else{if(n.includes("//")){let a=n;n=n.replace(/\/\/+/g,"/"),ta(!1,`Pathnames cannot have embedded double slashes - normalizing ${a} -> ${n}`)}n.startsWith("/")?o=oB(n.substring(1),"/"):o=oB(n,t)}else o=t;return{pathname:o,search:MIe(r),hash:RIe(i)}}function oB(e,t){let n=t.replace(/\/+$/,"").split("/");return e.split("/").forEach(i=>{i===".."?n.length>1&&n.pop():i!=="."&&n.push(i)}),n.length>1?n.join("/"):"/"}function J1(e,t,n,r){return`Cannot include a '${e}' character in a manually specified \`to.${t}\` field [${JSON.stringify(r)}]. Please separate it out to the \`to.${n}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function TIe(e){return e.filter((t,n)=>n===0||t.route.path&&t.route.path.length>0)}function M9(e){let t=TIe(e);return t.map((n,r)=>r===t.length-1?n.pathname:n.pathnameBase)}function R9(e,t,n,r=!1){let i;typeof e=="string"?i=vb(e):(i={...e},jr(!i.pathname||!i.pathname.includes("?"),J1("?","pathname","search",i)),jr(!i.pathname||!i.pathname.includes("#"),J1("#","pathname","hash",i)),jr(!i.search||!i.search.includes("#"),J1("#","search","hash",i)));let o=e===""||i.pathname==="",a=o?"/":i.pathname,c;if(a==null)c=n;else{let p=t.length-1;if(!r&&a.startsWith("..")){let g=a.split("/");for(;g[0]==="..";)g.shift(),p-=1;i.pathname=g.join("/")}c=p>=0?t[p]:"/"}let u=EIe(i,c),d=a&&a!=="/"&&a.endsWith("/"),h=(o||a===".")&&n.endsWith("/");return!u.pathname.endsWith("/")&&(d||h)&&(u.pathname+="/"),u}var xl=e=>e.join("/").replace(/\/\/+/g,"/"),CIe=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),MIe=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,RIe=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e;function AIe(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");var A9=["POST","PUT","PATCH","DELETE"];new Set(A9);var OIe=["GET",...A9];new Set(OIe);var Mp=D.createContext(null);Mp.displayName="DataRouter";var gk=D.createContext(null);gk.displayName="DataRouterState";D.createContext(!1);var O9=D.createContext({isTransitioning:!1});O9.displayName="ViewTransition";var DIe=D.createContext(new Map);DIe.displayName="Fetchers";var PIe=D.createContext(null);PIe.displayName="Await";var ja=D.createContext(null);ja.displayName="Navigation";var yk=D.createContext(null);yk.displayName="Location";var Fl=D.createContext({outlet:null,matches:[],isDataRoute:!1});Fl.displayName="Route";var PO=D.createContext(null);PO.displayName="RouteError";function NIe(e,{relative:t}={}){jr(Rp(),"useHref() may be used only in the context of a <Router> component.");let{basename:n,navigator:r}=D.useContext(ja),{hash:i,pathname:o,search:a}=Sb(e,{relative:t}),c=o;return n!=="/"&&(c=o==="/"?n:xl([n,o])),r.createHref({pathname:c,search:a,hash:i})}function Rp(){return D.useContext(yk)!=null}function ou(){return jr(Rp(),"useLocation() may be used only in the context of a <Router> component."),D.useContext(yk).location}function sB(e){jr(Rp(),"useMatch() may be used only in the context of a <Router> component.");let{pathname:t}=ou();return D.useMemo(()=>gy(e,C9(t)),[t,e])}var D9="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function P9(e){D.useContext(ja).static||D.useLayoutEffect(e)}function N9(){let{isDataRoute:e}=D.useContext(Fl);return e?GIe():LIe()}function LIe(){jr(Rp(),"useNavigate() may be used only in the context of a <Router> component.");let e=D.useContext(Mp),{basename:t,navigator:n}=D.useContext(ja),{matches:r}=D.useContext(Fl),{pathname:i}=ou(),o=JSON.stringify(M9(r)),a=D.useRef(!1);return P9(()=>{a.current=!0}),D.useCallback((u,d={})=>{if(ta(a.current,D9),!a.current)return;if(typeof u=="number"){n.go(u);return}let h=R9(u,JSON.parse(o),i,d.relative==="path");e==null&&t!=="/"&&(h.pathname=h.pathname==="/"?t:xl([t,h.pathname])),(d.replace?n.replace:n.push)(h,d.state,d)},[t,n,o,i,e])}D.createContext(null);function Sb(e,{relative:t}={}){let{matches:n}=D.useContext(Fl),{pathname:r}=ou(),i=JSON.stringify(M9(n));return D.useMemo(()=>R9(e,JSON.parse(i),r,t==="path"),[e,i,r,t])}function $Ie(e,t,n,r,i){jr(Rp(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:o}=D.useContext(ja),{matches:a}=D.useContext(Fl),c=a[a.length-1],u=c?c.params:{},d=c?c.pathname:"/",h=c?c.pathnameBase:"/",p=c&&c.route;{let I=p&&p.path||"";L9(d,!p||I.endsWith("*")||I.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${d}" (under <Route path="${I}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.
96
+
97
+ Please change the parent <Route path="${I}"> to <Route path="${I==="/"?"*":`${I}/*`}">.`)}let g=ou(),y;y=g;let b=y.pathname||"/",S=b;if(h!=="/"){let I=h.replace(/^\//,"").split("/");S="/"+b.replace(/^\//,"").split("/").slice(I.length).join("/")}let w=I9(e,{pathname:S});return ta(p||w!=null,`No routes matched location "${y.pathname}${y.search}${y.hash}" `),ta(w==null||w[w.length-1].route.element!==void 0||w[w.length-1].route.Component!==void 0||w[w.length-1].route.lazy!==void 0,`Matched leaf route at location "${y.pathname}${y.search}${y.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`),qIe(w&&w.map(I=>Object.assign({},I,{params:Object.assign({},u,I.params),pathname:xl([h,o.encodeLocation?o.encodeLocation(I.pathname.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:I.pathname]),pathnameBase:I.pathnameBase==="/"?h:xl([h,o.encodeLocation?o.encodeLocation(I.pathnameBase.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:I.pathnameBase])})),a,n,r,i)}function jIe(){let e=WIe(),t=AIe(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null,r="rgba(200,200,200, 0.5)",i={padding:"0.5rem",backgroundColor:r},o={padding:"2px 4px",backgroundColor:r},a=null;return console.error("Error handled by React Router default ErrorBoundary:",e),a=D.createElement(D.Fragment,null,D.createElement("p",null,"💿 Hey developer 👋"),D.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",D.createElement("code",{style:o},"ErrorBoundary")," or"," ",D.createElement("code",{style:o},"errorElement")," prop on your route.")),D.createElement(D.Fragment,null,D.createElement("h2",null,"Unexpected Application Error!"),D.createElement("h3",{style:{fontStyle:"italic"}},t),n?D.createElement("pre",{style:i},n):null,a)}var FIe=D.createElement(jIe,null),zIe=class extends D.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,t){return t.location!==e.location||t.revalidation!=="idle"&&e.revalidation==="idle"?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error!==void 0?e.error:t.error,location:t.location,revalidation:e.revalidation||t.revalidation}}componentDidCatch(e,t){this.props.onError?this.props.onError(e,t):console.error("React Router caught the following error during render",e)}render(){return this.state.error!==void 0?D.createElement(Fl.Provider,{value:this.props.routeContext},D.createElement(PO.Provider,{value:this.state.error,children:this.props.component})):this.props.children}};function BIe({routeContext:e,match:t,children:n}){let r=D.useContext(Mp);return r&&r.static&&r.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(r.staticContext._deepestRenderedBoundaryId=t.route.id),D.createElement(Fl.Provider,{value:e},n)}function qIe(e,t=[],n=null,r=null,i=null){if(e==null){if(!n)return null;if(n.errors)e=n.matches;else if(t.length===0&&!n.initialized&&n.matches.length>0)e=n.matches;else return null}let o=e,a=n?.errors;if(a!=null){let h=o.findIndex(p=>p.route.id&&a?.[p.route.id]!==void 0);jr(h>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(a).join(",")}`),o=o.slice(0,Math.min(o.length,h+1))}let c=!1,u=-1;if(n)for(let h=0;h<o.length;h++){let p=o[h];if((p.route.HydrateFallback||p.route.hydrateFallbackElement)&&(u=h),p.route.id){let{loaderData:g,errors:y}=n,b=p.route.loader&&!g.hasOwnProperty(p.route.id)&&(!y||y[p.route.id]===void 0);if(p.route.lazy||b){c=!0,u>=0?o=o.slice(0,u+1):o=[o[0]];break}}}let d=n&&r?(h,p)=>{r(h,{location:n.location,params:n.matches?.[0]?.params??{},errorInfo:p})}:void 0;return o.reduceRight((h,p,g)=>{let y,b=!1,S=null,w=null;n&&(y=a&&p.route.id?a[p.route.id]:void 0,S=p.route.errorElement||FIe,c&&(u<0&&g===0?(L9("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),b=!0,w=null):u===g&&(b=!0,w=p.route.hydrateFallbackElement||null)));let x=t.concat(o.slice(0,g+1)),I=()=>{let _;return y?_=S:b?_=w:p.route.Component?_=D.createElement(p.route.Component,null):p.route.element?_=p.route.element:_=h,D.createElement(BIe,{match:p,routeContext:{outlet:h,matches:x,isDataRoute:n!=null},children:_})};return n&&(p.route.ErrorBoundary||p.route.errorElement||g===0)?D.createElement(zIe,{location:n.location,revalidation:n.revalidation,component:S,error:y,children:I(),routeContext:{outlet:null,matches:x,isDataRoute:!0},onError:d}):I()},null)}function NO(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function UIe(e){let t=D.useContext(Mp);return jr(t,NO(e)),t}function VIe(e){let t=D.useContext(gk);return jr(t,NO(e)),t}function KIe(e){let t=D.useContext(Fl);return jr(t,NO(e)),t}function LO(e){let t=KIe(e),n=t.matches[t.matches.length-1];return jr(n.route.id,`${e} can only be used on routes that contain a unique "id"`),n.route.id}function HIe(){return LO("useRouteId")}function WIe(){let e=D.useContext(PO),t=VIe("useRouteError"),n=LO("useRouteError");return e!==void 0?e:t.errors?.[n]}function GIe(){let{router:e}=UIe("useNavigate"),t=LO("useNavigate"),n=D.useRef(!1);return P9(()=>{n.current=!0}),D.useCallback(async(i,o={})=>{ta(n.current,D9),n.current&&(typeof i=="number"?e.navigate(i):await e.navigate(i,{fromRouteId:t,...o}))},[e,t])}var aB={};function L9(e,t,n){!t&&!aB[e]&&(aB[e]=!0,ta(!1,n))}D.memo(YIe);function YIe({routes:e,future:t,state:n,unstable_onError:r}){return $Ie(e,void 0,n,r,t)}function QIe({basename:e="/",children:t=null,location:n,navigationType:r="POP",navigator:i,static:o=!1}){jr(!Rp(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let a=e.replace(/^\/*/,"/"),c=D.useMemo(()=>({basename:a,navigator:i,static:o,future:{}}),[a,i,o]);typeof n=="string"&&(n=vb(n));let{pathname:u="/",search:d="",hash:h="",state:p=null,key:g="default"}=n,y=D.useMemo(()=>{let b=Ol(u,a);return b==null?null:{location:{pathname:b,search:d,hash:h,state:p,key:g},navigationType:r}},[a,u,d,h,p,g,r]);return ta(y!=null,`<Router basename="${a}"> is not able to match the URL "${u}${d}${h}" because it does not start with the basename, so the <Router> won't render anything.`),y==null?null:D.createElement(ja.Provider,{value:c},D.createElement(yk.Provider,{children:t,value:y}))}var h0="get",p0="application/x-www-form-urlencoded";function bk(e){return e!=null&&typeof e.tagName=="string"}function XIe(e){return bk(e)&&e.tagName.toLowerCase()==="button"}function JIe(e){return bk(e)&&e.tagName.toLowerCase()==="form"}function ZIe(e){return bk(e)&&e.tagName.toLowerCase()==="input"}function e1e(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function t1e(e,t){return e.button===0&&(!t||t==="_self")&&!e1e(e)}var wS=null;function n1e(){if(wS===null)try{new FormData(document.createElement("form"),0),wS=!1}catch{wS=!0}return wS}var r1e=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function Z1(e){return e!=null&&!r1e.has(e)?(ta(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${p0}"`),null):e}function i1e(e,t){let n,r,i,o,a;if(JIe(e)){let c=e.getAttribute("action");r=c?Ol(c,t):null,n=e.getAttribute("method")||h0,i=Z1(e.getAttribute("enctype"))||p0,o=new FormData(e)}else if(XIe(e)||ZIe(e)&&(e.type==="submit"||e.type==="image")){let c=e.form;if(c==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let u=e.getAttribute("formaction")||c.getAttribute("action");if(r=u?Ol(u,t):null,n=e.getAttribute("formmethod")||c.getAttribute("method")||h0,i=Z1(e.getAttribute("formenctype"))||Z1(c.getAttribute("enctype"))||p0,o=new FormData(c,e),!n1e()){let{name:d,type:h,value:p}=e;if(h==="image"){let g=d?`${d}.`:"";o.append(`${g}x`,"0"),o.append(`${g}y`,"0")}else d&&o.append(d,p)}}else{if(bk(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');n=h0,r=null,i=p0,a=e}return o&&i==="text/plain"&&(a=o,o=void 0),{action:r,method:n.toLowerCase(),encType:i,formData:o,body:a}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function $O(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function o1e(e,t,n){let r=typeof e=="string"?new URL(e,typeof window>"u"?"server://singlefetch/":window.location.origin):e;return r.pathname==="/"?r.pathname=`_root.${n}`:t&&Ol(r.pathname,t)==="/"?r.pathname=`${t.replace(/\/$/,"")}/_root.${n}`:r.pathname=`${r.pathname.replace(/\/$/,"")}.${n}`,r}async function s1e(e,t){if(e.id in t)return t[e.id];try{let n=await import(e.module);return t[e.id]=n,n}catch(n){return console.error(`Error loading route module \`${e.module}\`, reloading page...`),console.error(n),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function a1e(e){return e==null?!1:e.href==null?e.rel==="preload"&&typeof e.imageSrcSet=="string"&&typeof e.imageSizes=="string":typeof e.rel=="string"&&typeof e.href=="string"}async function l1e(e,t,n){let r=await Promise.all(e.map(async i=>{let o=t.routes[i.route.id];if(o){let a=await s1e(o,n);return a.links?a.links():[]}return[]}));return f1e(r.flat(1).filter(a1e).filter(i=>i.rel==="stylesheet"||i.rel==="preload").map(i=>i.rel==="stylesheet"?{...i,rel:"prefetch",as:"style"}:{...i,rel:"prefetch"}))}function lB(e,t,n,r,i,o){let a=(u,d)=>n[d]?u.route.id!==n[d].route.id:!0,c=(u,d)=>n[d].pathname!==u.pathname||n[d].route.path?.endsWith("*")&&n[d].params["*"]!==u.params["*"];return o==="assets"?t.filter((u,d)=>a(u,d)||c(u,d)):o==="data"?t.filter((u,d)=>{let h=r.routes[u.route.id];if(!h||!h.hasLoader)return!1;if(a(u,d)||c(u,d))return!0;if(u.route.shouldRevalidate){let p=u.route.shouldRevalidate({currentUrl:new URL(i.pathname+i.search+i.hash,window.origin),currentParams:n[0]?.params||{},nextUrl:new URL(e,window.origin),nextParams:u.params,defaultShouldRevalidate:!0});if(typeof p=="boolean")return p}return!0}):[]}function c1e(e,t,{includeHydrateFallback:n}={}){return u1e(e.map(r=>{let i=t.routes[r.route.id];if(!i)return[];let o=[i.module];return i.clientActionModule&&(o=o.concat(i.clientActionModule)),i.clientLoaderModule&&(o=o.concat(i.clientLoaderModule)),n&&i.hydrateFallbackModule&&(o=o.concat(i.hydrateFallbackModule)),i.imports&&(o=o.concat(i.imports)),o}).flat(1))}function u1e(e){return[...new Set(e)]}function d1e(e){let t={},n=Object.keys(e).sort();for(let r of n)t[r]=e[r];return t}function f1e(e,t){let n=new Set;return new Set(t),e.reduce((r,i)=>{let o=JSON.stringify(d1e(i));return n.has(o)||(n.add(o),r.push({key:o,link:i})),r},[])}function $9(){let e=D.useContext(Mp);return $O(e,"You must render this element inside a <DataRouterContext.Provider> element"),e}function h1e(){let e=D.useContext(gk);return $O(e,"You must render this element inside a <DataRouterStateContext.Provider> element"),e}var jO=D.createContext(void 0);jO.displayName="FrameworkContext";function j9(){let e=D.useContext(jO);return $O(e,"You must render this element inside a <HydratedRouter> element"),e}function p1e(e,t){let n=D.useContext(jO),[r,i]=D.useState(!1),[o,a]=D.useState(!1),{onFocus:c,onBlur:u,onMouseEnter:d,onMouseLeave:h,onTouchStart:p}=t,g=D.useRef(null);D.useEffect(()=>{if(e==="render"&&a(!0),e==="viewport"){let S=x=>{x.forEach(I=>{a(I.isIntersecting)})},w=new IntersectionObserver(S,{threshold:.5});return g.current&&w.observe(g.current),()=>{w.disconnect()}}},[e]),D.useEffect(()=>{if(r){let S=setTimeout(()=>{a(!0)},100);return()=>{clearTimeout(S)}}},[r]);let y=()=>{i(!0)},b=()=>{i(!1),a(!1)};return n?e!=="intent"?[o,g,{}]:[o,g,{onFocus:qm(c,y),onBlur:qm(u,b),onMouseEnter:qm(d,y),onMouseLeave:qm(h,b),onTouchStart:qm(p,y)}]:[!1,g,{}]}function qm(e,t){return n=>{e&&e(n),n.defaultPrevented||t(n)}}function m1e({page:e,...t}){let{router:n}=$9(),r=D.useMemo(()=>I9(n.routes,e,n.basename),[n.routes,e,n.basename]);return r?D.createElement(y1e,{page:e,matches:r,...t}):null}function g1e(e){let{manifest:t,routeModules:n}=j9(),[r,i]=D.useState([]);return D.useEffect(()=>{let o=!1;return l1e(e,t,n).then(a=>{o||i(a)}),()=>{o=!0}},[e,t,n]),r}function y1e({page:e,matches:t,...n}){let r=ou(),{manifest:i,routeModules:o}=j9(),{basename:a}=$9(),{loaderData:c,matches:u}=h1e(),d=D.useMemo(()=>lB(e,t,u,i,r,"data"),[e,t,u,i,r]),h=D.useMemo(()=>lB(e,t,u,i,r,"assets"),[e,t,u,i,r]),p=D.useMemo(()=>{if(e===r.pathname+r.search+r.hash)return[];let b=new Set,S=!1;if(t.forEach(x=>{let I=i.routes[x.route.id];!I||!I.hasLoader||(!d.some(_=>_.route.id===x.route.id)&&x.route.id in c&&o[x.route.id]?.shouldRevalidate||I.hasClientLoader?S=!0:b.add(x.route.id))}),b.size===0)return[];let w=o1e(e,a,"data");return S&&b.size>0&&w.searchParams.set("_routes",t.filter(x=>b.has(x.route.id)).map(x=>x.route.id).join(",")),[w.pathname+w.search]},[a,c,r,i,d,t,e,o]),g=D.useMemo(()=>c1e(h,i),[h,i]),y=g1e(h);return D.createElement(D.Fragment,null,p.map(b=>D.createElement("link",{key:b,rel:"prefetch",as:"fetch",href:b,...n})),g.map(b=>D.createElement("link",{key:b,rel:"modulepreload",href:b,...n})),y.map(({key:b,link:S})=>D.createElement("link",{key:b,nonce:n.nonce,...S})))}function b1e(...e){return t=>{e.forEach(n=>{typeof n=="function"?n(t):n!=null&&(n.current=t)})}}var F9=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{F9&&(window.__reactRouterVersion="7.9.6")}catch{}function v1e({basename:e,children:t,window:n}){let r=D.useRef();r.current==null&&(r.current=lIe({window:n,v5Compat:!0}));let i=r.current,[o,a]=D.useState({action:i.action,location:i.location}),c=D.useCallback(u=>{D.startTransition(()=>a(u))},[a]);return D.useLayoutEffect(()=>i.listen(c),[i,c]),D.createElement(QIe,{basename:e,children:t,location:o.location,navigationType:o.action,navigator:i})}var z9=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,yy=D.forwardRef(function({onClick:t,discover:n="render",prefetch:r="none",relative:i,reloadDocument:o,replace:a,state:c,target:u,to:d,preventScrollReset:h,viewTransition:p,...g},y){let{basename:b}=D.useContext(ja),S=typeof d=="string"&&z9.test(d),w,x=!1;if(typeof d=="string"&&S&&(w=d,F9))try{let U=new URL(window.location.href),R=d.startsWith("//")?new URL(U.protocol+d):new URL(d),N=Ol(R.pathname,b);R.origin===U.origin&&N!=null?d=N+R.search+R.hash:x=!0}catch{ta(!1,`<Link to="${d}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}let I=NIe(d,{relative:i}),[_,M,C]=p1e(r,g),E=k1e(d,{replace:a,state:c,target:u,preventScrollReset:h,relative:i,viewTransition:p});function T(U){t&&t(U),U.defaultPrevented||E(U)}let A=D.createElement("a",{...g,...C,href:w||I,onClick:x||o?t:T,ref:b1e(y,M),target:u,"data-discover":!S&&n==="render"?"true":void 0});return _&&!S?D.createElement(D.Fragment,null,A,D.createElement(m1e,{page:I})):A});yy.displayName="Link";var S1e=D.forwardRef(function({"aria-current":t="page",caseSensitive:n=!1,className:r="",end:i=!1,style:o,to:a,viewTransition:c,children:u,...d},h){let p=Sb(a,{relative:d.relative}),g=ou(),y=D.useContext(gk),{navigator:b,basename:S}=D.useContext(ja),w=y!=null&&C1e(p)&&c===!0,x=b.encodeLocation?b.encodeLocation(p).pathname:p.pathname,I=g.pathname,_=y&&y.navigation&&y.navigation.location?y.navigation.location.pathname:null;n||(I=I.toLowerCase(),_=_?_.toLowerCase():null,x=x.toLowerCase()),_&&S&&(_=Ol(_,S)||_);const M=x!=="/"&&x.endsWith("/")?x.length-1:x.length;let C=I===x||!i&&I.startsWith(x)&&I.charAt(M)==="/",E=_!=null&&(_===x||!i&&_.startsWith(x)&&_.charAt(x.length)==="/"),T={isActive:C,isPending:E,isTransitioning:w},A=C?t:void 0,U;typeof r=="function"?U=r(T):U=[r,C?"active":null,E?"pending":null,w?"transitioning":null].filter(Boolean).join(" ");let R=typeof o=="function"?o(T):o;return D.createElement(yy,{...d,"aria-current":A,className:U,ref:h,style:R,to:a,viewTransition:c},typeof u=="function"?u(T):u)});S1e.displayName="NavLink";var w1e=D.forwardRef(({discover:e="render",fetcherKey:t,navigate:n,reloadDocument:r,replace:i,state:o,method:a=h0,action:c,onSubmit:u,relative:d,preventScrollReset:h,viewTransition:p,...g},y)=>{let b=E1e(),S=T1e(c,{relative:d}),w=a.toLowerCase()==="get"?"get":"post",x=typeof c=="string"&&z9.test(c),I=_=>{if(u&&u(_),_.defaultPrevented)return;_.preventDefault();let M=_.nativeEvent.submitter,C=M?.getAttribute("formmethod")||a;b(M||_.currentTarget,{fetcherKey:t,method:C,navigate:n,replace:i,state:o,relative:d,preventScrollReset:h,viewTransition:p})};return D.createElement("form",{ref:y,method:w,action:S,onSubmit:r?u:I,...g,"data-discover":!x&&e==="render"?"true":void 0})});w1e.displayName="Form";function x1e(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function B9(e){let t=D.useContext(Mp);return jr(t,x1e(e)),t}function k1e(e,{target:t,replace:n,state:r,preventScrollReset:i,relative:o,viewTransition:a}={}){let c=N9(),u=ou(),d=Sb(e,{relative:o});return D.useCallback(h=>{if(t1e(h,t)){h.preventDefault();let p=n!==void 0?n:my(u)===my(d);c(e,{replace:p,state:r,preventScrollReset:i,relative:o,viewTransition:a})}},[u,c,d,n,r,t,e,i,o,a])}var _1e=0,I1e=()=>`__${String(++_1e)}__`;function E1e(){let{router:e}=B9("useSubmit"),{basename:t}=D.useContext(ja),n=HIe();return D.useCallback(async(r,i={})=>{let{action:o,method:a,encType:c,formData:u,body:d}=i1e(r,t);if(i.navigate===!1){let h=i.fetcherKey||I1e();await e.fetch(h,n,i.action||o,{preventScrollReset:i.preventScrollReset,formData:u,body:d,formMethod:i.method||a,formEncType:i.encType||c,flushSync:i.flushSync})}else await e.navigate(i.action||o,{preventScrollReset:i.preventScrollReset,formData:u,body:d,formMethod:i.method||a,formEncType:i.encType||c,replace:i.replace,state:i.state,fromRouteId:n,flushSync:i.flushSync,viewTransition:i.viewTransition})},[e,t,n])}function T1e(e,{relative:t}={}){let{basename:n}=D.useContext(ja),r=D.useContext(Fl);jr(r,"useFormAction must be used inside a RouteContext");let[i]=r.matches.slice(-1),o={...Sb(e||".",{relative:t})},a=ou();if(e==null){o.search=a.search;let c=new URLSearchParams(o.search),u=c.getAll("index");if(u.some(h=>h==="")){c.delete("index"),u.filter(p=>p).forEach(p=>c.append("index",p));let h=c.toString();o.search=h?`?${h}`:""}}return(!e||e===".")&&i.route.index&&(o.search=o.search?o.search.replace(/^\?/,"?index&"):"?index"),n!=="/"&&(o.pathname=o.pathname==="/"?n:xl([n,o.pathname])),my(o)}function C1e(e,{relative:t}={}){let n=D.useContext(O9);jr(n!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:r}=B9("useViewTransitionState"),i=Sb(e,{relative:t});if(!n.isTransitioning)return!1;let o=Ol(n.currentLocation.pathname,r)||n.currentLocation.pathname,a=Ol(n.nextLocation.pathname,r)||n.nextLocation.pathname;return gy(i.pathname,a)!=null||gy(i.pathname,o)!=null}var wb=Gq();const M1e=Xw(wb);function q9(e){const t=e.split(/\r?\n/),n=[],r=/^(#{1,6})\s+(.+?)\s*$/,i=/^User\s+Story\s+(?<num>\d+)\b(?<rest>.*)$/i,o=/\(\s*Priority\s*:\s*(?<priority>P\d+)\s*\)\s*$/i;for(let a=0;a<t.length;a++){const u=(t[a]??"").match(r);if(!u)continue;const h=(u[2]??"").trim().match(i);if(!h?.groups?.num)continue;const p=Number.parseInt(h.groups.num,10);if(!Number.isFinite(p))continue;let g=(h.groups.rest??"").trim();const y=g.match(o);y&&(g=g.slice(0,y.index).trim()),g=g.replace(/^[-–—::]\s*/,"").trim(),n.push({code:`US${p}`,index:p,title:g||`User Story ${p}`,line:a+1})}return n.sort((a,c)=>a.index-c.index)}function FO(e){const t=e.match(/\b(?:FR|NFR|SC)-\d{3}\b/g)??[];return Array.from(new Set(t)).sort()}function cB(e){const t=new Map;for(const n of e){const r=FO(n.raw);for(const i of r){const o=t.get(i)??{done:0,total:0};o.total+=1,n.checked&&(o.done+=1),t.set(i,o)}}return Array.from(t.entries()).sort(([n],[r])=>n.localeCompare(r)).map(([n,r])=>({code:n,total:r.total,done:r.done}))}function uB(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function id(e){let t=e.title;return e.taskId&&(t=t.replace(new RegExp(`^\\s*${uB(e.taskId)}\\b\\s*`),""),t=t.replace(/^\s*[-–—·::]\s*/,"")),e.story&&(t=t.replace(new RegExp(`\\s*\\[${uB(e.story)}\\]\\s*`,"g")," ")),e.parallel&&(t=t.replace(/\s*\[P\]\s*/g," ")),t=t.replace(/\s{2,}/g," ").trim(),t||e.title}function Cw(e){const t=e.length,n=e.filter(r=>r.checked).length;return{total:t,done:n,todo:t-n}}const zO=D.createContext({});function BO(e){const t=D.useRef(null);return t.current===null&&(t.current=e()),t.current}const qO=typeof window<"u",U9=qO?D.useLayoutEffect:D.useEffect,vk=D.createContext(null);function UO(e,t){e.indexOf(t)===-1&&e.push(t)}function VO(e,t){const n=e.indexOf(t);n>-1&&e.splice(n,1)}const Dl=(e,t,n)=>n>t?t:n<e?e:n;let KO=()=>{};const Pl={},V9=e=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(e);function K9(e){return typeof e=="object"&&e!==null}const H9=e=>/^0[^.\s]+$/u.test(e);function HO(e){let t;return()=>(t===void 0&&(t=e()),t)}const ws=e=>e,R1e=(e,t)=>n=>t(e(n)),xb=(...e)=>e.reduce(R1e),by=(e,t,n)=>{const r=t-e;return r===0?1:(n-e)/r};class WO{constructor(){this.subscriptions=[]}add(t){return UO(this.subscriptions,t),()=>VO(this.subscriptions,t)}notify(t,n,r){const i=this.subscriptions.length;if(i)if(i===1)this.subscriptions[0](t,n,r);else for(let o=0;o<i;o++){const a=this.subscriptions[o];a&&a(t,n,r)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}}const Ca=e=>e*1e3,vs=e=>e/1e3;function W9(e,t){return t?e*(1e3/t):0}const G9=(e,t,n)=>(((1-3*n+3*t)*e+(3*n-6*t))*e+3*t)*e,A1e=1e-7,O1e=12;function D1e(e,t,n,r,i){let o,a,c=0;do a=t+(n-t)/2,o=G9(a,r,i)-e,o>0?n=a:t=a;while(Math.abs(o)>A1e&&++c<O1e);return a}function kb(e,t,n,r){if(e===t&&n===r)return ws;const i=o=>D1e(o,0,1,e,n);return o=>o===0||o===1?o:G9(i(o),t,r)}const Y9=e=>t=>t<=.5?e(2*t)/2:(2-e(2*(1-t)))/2,Q9=e=>t=>1-e(1-t),X9=kb(.33,1.53,.69,.99),GO=Q9(X9),J9=Y9(GO),Z9=e=>(e*=2)<1?.5*GO(e):.5*(2-Math.pow(2,-10*(e-1))),YO=e=>1-Math.sin(Math.acos(e)),e8=Q9(YO),t8=Y9(YO),P1e=kb(.42,0,1,1),N1e=kb(0,0,.58,1),n8=kb(.42,0,.58,1),L1e=e=>Array.isArray(e)&&typeof e[0]!="number",r8=e=>Array.isArray(e)&&typeof e[0]=="number",$1e={linear:ws,easeIn:P1e,easeInOut:n8,easeOut:N1e,circIn:YO,circInOut:t8,circOut:e8,backIn:GO,backInOut:J9,backOut:X9,anticipate:Z9},j1e=e=>typeof e=="string",dB=e=>{if(r8(e)){KO(e.length===4);const[t,n,r,i]=e;return kb(t,n,r,i)}else if(j1e(e))return $1e[e];return e},xS=["setup","read","resolveKeyframes","preUpdate","update","preRender","render","postRender"];function F1e(e,t){let n=new Set,r=new Set,i=!1,o=!1;const a=new WeakSet;let c={delta:0,timestamp:0,isProcessing:!1};function u(h){a.has(h)&&(d.schedule(h),e()),h(c)}const d={schedule:(h,p=!1,g=!1)=>{const b=g&&i?n:r;return p&&a.add(h),b.has(h)||b.add(h),h},cancel:h=>{r.delete(h),a.delete(h)},process:h=>{if(c=h,i){o=!0;return}i=!0,[n,r]=[r,n],n.forEach(u),n.clear(),i=!1,o&&(o=!1,d.process(h))}};return d}const z1e=40;function i8(e,t){let n=!1,r=!0;const i={delta:0,timestamp:0,isProcessing:!1},o=()=>n=!0,a=xS.reduce((_,M)=>(_[M]=F1e(o),_),{}),{setup:c,read:u,resolveKeyframes:d,preUpdate:h,update:p,preRender:g,render:y,postRender:b}=a,S=()=>{const _=Pl.useManualTiming?i.timestamp:performance.now();n=!1,Pl.useManualTiming||(i.delta=r?1e3/60:Math.max(Math.min(_-i.timestamp,z1e),1)),i.timestamp=_,i.isProcessing=!0,c.process(i),u.process(i),d.process(i),h.process(i),p.process(i),g.process(i),y.process(i),b.process(i),i.isProcessing=!1,n&&t&&(r=!1,e(S))},w=()=>{n=!0,r=!0,i.isProcessing||e(S)};return{schedule:xS.reduce((_,M)=>{const C=a[M];return _[M]=(E,T=!1,A=!1)=>(n||w(),C.schedule(E,T,A)),_},{}),cancel:_=>{for(let M=0;M<xS.length;M++)a[xS[M]].cancel(_)},state:i,steps:a}}const{schedule:Xn,cancel:Wc,state:gi,steps:eE}=i8(typeof requestAnimationFrame<"u"?requestAnimationFrame:ws,!0);let m0;function B1e(){m0=void 0}const fo={now:()=>(m0===void 0&&fo.set(gi.isProcessing||Pl.useManualTiming?gi.timestamp:performance.now()),m0),set:e=>{m0=e,queueMicrotask(B1e)}},o8=e=>t=>typeof t=="string"&&t.startsWith(e),s8=o8("--"),q1e=o8("var(--"),QO=e=>q1e(e)?U1e.test(e.split("/*")[0].trim()):!1,U1e=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu,Ap={test:e=>typeof e=="number",parse:parseFloat,transform:e=>e},vy={...Ap,transform:e=>Dl(0,1,e)},kS={...Ap,default:1},Eg=e=>Math.round(e*1e5)/1e5,XO=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function V1e(e){return e==null}const K1e=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,JO=(e,t)=>n=>!!(typeof n=="string"&&K1e.test(n)&&n.startsWith(e)||t&&!V1e(n)&&Object.prototype.hasOwnProperty.call(n,t)),a8=(e,t,n)=>r=>{if(typeof r!="string")return r;const[i,o,a,c]=r.match(XO);return{[e]:parseFloat(i),[t]:parseFloat(o),[n]:parseFloat(a),alpha:c!==void 0?parseFloat(c):1}},H1e=e=>Dl(0,255,e),tE={...Ap,transform:e=>Math.round(H1e(e))},Ku={test:JO("rgb","red"),parse:a8("red","green","blue"),transform:({red:e,green:t,blue:n,alpha:r=1})=>"rgba("+tE.transform(e)+", "+tE.transform(t)+", "+tE.transform(n)+", "+Eg(vy.transform(r))+")"};function W1e(e){let t="",n="",r="",i="";return e.length>5?(t=e.substring(1,3),n=e.substring(3,5),r=e.substring(5,7),i=e.substring(7,9)):(t=e.substring(1,2),n=e.substring(2,3),r=e.substring(3,4),i=e.substring(4,5),t+=t,n+=n,r+=r,i+=i),{red:parseInt(t,16),green:parseInt(n,16),blue:parseInt(r,16),alpha:i?parseInt(i,16)/255:1}}const $C={test:JO("#"),parse:W1e,transform:Ku.transform},_b=e=>({test:t=>typeof t=="string"&&t.endsWith(e)&&t.split(" ").length===1,parse:parseFloat,transform:t=>`${t}${e}`}),Sc=_b("deg"),Ma=_b("%"),pt=_b("px"),G1e=_b("vh"),Y1e=_b("vw"),fB={...Ma,parse:e=>Ma.parse(e)/100,transform:e=>Ma.transform(e*100)},rh={test:JO("hsl","hue"),parse:a8("hue","saturation","lightness"),transform:({hue:e,saturation:t,lightness:n,alpha:r=1})=>"hsla("+Math.round(e)+", "+Ma.transform(Eg(t))+", "+Ma.transform(Eg(n))+", "+Eg(vy.transform(r))+")"},Nr={test:e=>Ku.test(e)||$C.test(e)||rh.test(e),parse:e=>Ku.test(e)?Ku.parse(e):rh.test(e)?rh.parse(e):$C.parse(e),transform:e=>typeof e=="string"?e:e.hasOwnProperty("red")?Ku.transform(e):rh.transform(e),getAnimatableNone:e=>{const t=Nr.parse(e);return t.alpha=0,Nr.transform(t)}},Q1e=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function X1e(e){return isNaN(e)&&typeof e=="string"&&(e.match(XO)?.length||0)+(e.match(Q1e)?.length||0)>0}const l8="number",c8="color",J1e="var",Z1e="var(",hB="${}",eEe=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function Sy(e){const t=e.toString(),n=[],r={color:[],number:[],var:[]},i=[];let o=0;const c=t.replace(eEe,u=>(Nr.test(u)?(r.color.push(o),i.push(c8),n.push(Nr.parse(u))):u.startsWith(Z1e)?(r.var.push(o),i.push(J1e),n.push(u)):(r.number.push(o),i.push(l8),n.push(parseFloat(u))),++o,hB)).split(hB);return{values:n,split:c,indexes:r,types:i}}function u8(e){return Sy(e).values}function d8(e){const{split:t,types:n}=Sy(e),r=t.length;return i=>{let o="";for(let a=0;a<r;a++)if(o+=t[a],i[a]!==void 0){const c=n[a];c===l8?o+=Eg(i[a]):c===c8?o+=Nr.transform(i[a]):o+=i[a]}return o}}const tEe=e=>typeof e=="number"?0:Nr.test(e)?Nr.getAnimatableNone(e):e;function nEe(e){const t=u8(e);return d8(e)(t.map(tEe))}const Gc={test:X1e,parse:u8,createTransformer:d8,getAnimatableNone:nEe};function nE(e,t,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?e+(t-e)*6*n:n<1/2?t:n<2/3?e+(t-e)*(2/3-n)*6:e}function rEe({hue:e,saturation:t,lightness:n,alpha:r}){e/=360,t/=100,n/=100;let i=0,o=0,a=0;if(!t)i=o=a=n;else{const c=n<.5?n*(1+t):n+t-n*t,u=2*n-c;i=nE(u,c,e+1/3),o=nE(u,c,e),a=nE(u,c,e-1/3)}return{red:Math.round(i*255),green:Math.round(o*255),blue:Math.round(a*255),alpha:r}}function Mw(e,t){return n=>n>0?t:e}const tr=(e,t,n)=>e+(t-e)*n,rE=(e,t,n)=>{const r=e*e,i=n*(t*t-r)+r;return i<0?0:Math.sqrt(i)},iEe=[$C,Ku,rh],oEe=e=>iEe.find(t=>t.test(e));function pB(e){const t=oEe(e);if(!t)return!1;let n=t.parse(e);return t===rh&&(n=rEe(n)),n}const mB=(e,t)=>{const n=pB(e),r=pB(t);if(!n||!r)return Mw(e,t);const i={...n};return o=>(i.red=rE(n.red,r.red,o),i.green=rE(n.green,r.green,o),i.blue=rE(n.blue,r.blue,o),i.alpha=tr(n.alpha,r.alpha,o),Ku.transform(i))},jC=new Set(["none","hidden"]);function sEe(e,t){return jC.has(e)?n=>n<=0?e:t:n=>n>=1?t:e}function aEe(e,t){return n=>tr(e,t,n)}function ZO(e){return typeof e=="number"?aEe:typeof e=="string"?QO(e)?Mw:Nr.test(e)?mB:uEe:Array.isArray(e)?f8:typeof e=="object"?Nr.test(e)?mB:lEe:Mw}function f8(e,t){const n=[...e],r=n.length,i=e.map((o,a)=>ZO(o)(o,t[a]));return o=>{for(let a=0;a<r;a++)n[a]=i[a](o);return n}}function lEe(e,t){const n={...e,...t},r={};for(const i in n)e[i]!==void 0&&t[i]!==void 0&&(r[i]=ZO(e[i])(e[i],t[i]));return i=>{for(const o in r)n[o]=r[o](i);return n}}function cEe(e,t){const n=[],r={color:0,var:0,number:0};for(let i=0;i<t.values.length;i++){const o=t.types[i],a=e.indexes[o][r[o]],c=e.values[a]??0;n[i]=c,r[o]++}return n}const uEe=(e,t)=>{const n=Gc.createTransformer(t),r=Sy(e),i=Sy(t);return r.indexes.var.length===i.indexes.var.length&&r.indexes.color.length===i.indexes.color.length&&r.indexes.number.length>=i.indexes.number.length?jC.has(e)&&!i.values.length||jC.has(t)&&!r.values.length?sEe(e,t):xb(f8(cEe(r,i),i.values),n):Mw(e,t)};function h8(e,t,n){return typeof e=="number"&&typeof t=="number"&&typeof n=="number"?tr(e,t,n):ZO(e)(e,t)}const dEe=e=>{const t=({timestamp:n})=>e(n);return{start:(n=!0)=>Xn.update(t,n),stop:()=>Wc(t),now:()=>gi.isProcessing?gi.timestamp:fo.now()}},p8=(e,t,n=10)=>{let r="";const i=Math.max(Math.round(t/n),2);for(let o=0;o<i;o++)r+=Math.round(e(o/(i-1))*1e4)/1e4+", ";return`linear(${r.substring(0,r.length-2)})`},Rw=2e4;function eD(e){let t=0;const n=50;let r=e.next(t);for(;!r.done&&t<Rw;)t+=n,r=e.next(t);return t>=Rw?1/0:t}function fEe(e,t=100,n){const r=n({...e,keyframes:[0,t]}),i=Math.min(eD(r),Rw);return{type:"keyframes",ease:o=>r.next(i*o).value/t,duration:vs(i)}}const hEe=5;function m8(e,t,n){const r=Math.max(t-hEe,0);return W9(n-e(r),t-r)}const cr={stiffness:100,damping:10,mass:1,velocity:0,duration:800,bounce:.3,visualDuration:.3,restSpeed:{granular:.01,default:2},restDelta:{granular:.005,default:.5},minDuration:.01,maxDuration:10,minDamping:.05,maxDamping:1},iE=.001;function pEe({duration:e=cr.duration,bounce:t=cr.bounce,velocity:n=cr.velocity,mass:r=cr.mass}){let i,o,a=1-t;a=Dl(cr.minDamping,cr.maxDamping,a),e=Dl(cr.minDuration,cr.maxDuration,vs(e)),a<1?(i=d=>{const h=d*a,p=h*e,g=h-n,y=FC(d,a),b=Math.exp(-p);return iE-g/y*b},o=d=>{const p=d*a*e,g=p*n+n,y=Math.pow(a,2)*Math.pow(d,2)*e,b=Math.exp(-p),S=FC(Math.pow(d,2),a);return(-i(d)+iE>0?-1:1)*((g-y)*b)/S}):(i=d=>{const h=Math.exp(-d*e),p=(d-n)*e+1;return-iE+h*p},o=d=>{const h=Math.exp(-d*e),p=(n-d)*(e*e);return h*p});const c=5/e,u=gEe(i,o,c);if(e=Ca(e),isNaN(u))return{stiffness:cr.stiffness,damping:cr.damping,duration:e};{const d=Math.pow(u,2)*r;return{stiffness:d,damping:a*2*Math.sqrt(r*d),duration:e}}}const mEe=12;function gEe(e,t,n){let r=n;for(let i=1;i<mEe;i++)r=r-e(r)/t(r);return r}function FC(e,t){return e*Math.sqrt(1-t*t)}const yEe=["duration","bounce"],bEe=["stiffness","damping","mass"];function gB(e,t){return t.some(n=>e[n]!==void 0)}function vEe(e){let t={velocity:cr.velocity,stiffness:cr.stiffness,damping:cr.damping,mass:cr.mass,isResolvedFromDuration:!1,...e};if(!gB(e,bEe)&&gB(e,yEe))if(e.visualDuration){const n=e.visualDuration,r=2*Math.PI/(n*1.2),i=r*r,o=2*Dl(.05,1,1-(e.bounce||0))*Math.sqrt(i);t={...t,mass:cr.mass,stiffness:i,damping:o}}else{const n=pEe(e);t={...t,...n,mass:cr.mass},t.isResolvedFromDuration=!0}return t}function Aw(e=cr.visualDuration,t=cr.bounce){const n=typeof e!="object"?{visualDuration:e,keyframes:[0,1],bounce:t}:e;let{restSpeed:r,restDelta:i}=n;const o=n.keyframes[0],a=n.keyframes[n.keyframes.length-1],c={done:!1,value:o},{stiffness:u,damping:d,mass:h,duration:p,velocity:g,isResolvedFromDuration:y}=vEe({...n,velocity:-vs(n.velocity||0)}),b=g||0,S=d/(2*Math.sqrt(u*h)),w=a-o,x=vs(Math.sqrt(u/h)),I=Math.abs(w)<5;r||(r=I?cr.restSpeed.granular:cr.restSpeed.default),i||(i=I?cr.restDelta.granular:cr.restDelta.default);let _;if(S<1){const C=FC(x,S);_=E=>{const T=Math.exp(-S*x*E);return a-T*((b+S*x*w)/C*Math.sin(C*E)+w*Math.cos(C*E))}}else if(S===1)_=C=>a-Math.exp(-x*C)*(w+(b+x*w)*C);else{const C=x*Math.sqrt(S*S-1);_=E=>{const T=Math.exp(-S*x*E),A=Math.min(C*E,300);return a-T*((b+S*x*w)*Math.sinh(A)+C*w*Math.cosh(A))/C}}const M={calculatedDuration:y&&p||null,next:C=>{const E=_(C);if(y)c.done=C>=p;else{let T=C===0?b:0;S<1&&(T=C===0?Ca(b):m8(_,C,E));const A=Math.abs(T)<=r,U=Math.abs(a-E)<=i;c.done=A&&U}return c.value=c.done?a:E,c},toString:()=>{const C=Math.min(eD(M),Rw),E=p8(T=>M.next(C*T).value,C,30);return C+"ms "+E},toTransition:()=>{}};return M}Aw.applyToOptions=e=>{const t=fEe(e,100,Aw);return e.ease=t.ease,e.duration=Ca(t.duration),e.type="keyframes",e};function zC({keyframes:e,velocity:t=0,power:n=.8,timeConstant:r=325,bounceDamping:i=10,bounceStiffness:o=500,modifyTarget:a,min:c,max:u,restDelta:d=.5,restSpeed:h}){const p=e[0],g={done:!1,value:p},y=A=>c!==void 0&&A<c||u!==void 0&&A>u,b=A=>c===void 0?u:u===void 0||Math.abs(c-A)<Math.abs(u-A)?c:u;let S=n*t;const w=p+S,x=a===void 0?w:a(w);x!==w&&(S=x-p);const I=A=>-S*Math.exp(-A/r),_=A=>x+I(A),M=A=>{const U=I(A),R=_(A);g.done=Math.abs(U)<=d,g.value=g.done?x:R};let C,E;const T=A=>{y(g.value)&&(C=A,E=Aw({keyframes:[g.value,b(g.value)],velocity:m8(_,A,g.value),damping:i,stiffness:o,restDelta:d,restSpeed:h}))};return T(0),{calculatedDuration:null,next:A=>{let U=!1;return!E&&C===void 0&&(U=!0,M(A),T(A)),C!==void 0&&A>=C?E.next(A-C):(!U&&M(A),g)}}}function SEe(e,t,n){const r=[],i=n||Pl.mix||h8,o=e.length-1;for(let a=0;a<o;a++){let c=i(e[a],e[a+1]);if(t){const u=Array.isArray(t)?t[a]||ws:t;c=xb(u,c)}r.push(c)}return r}function wEe(e,t,{clamp:n=!0,ease:r,mixer:i}={}){const o=e.length;if(KO(o===t.length),o===1)return()=>t[0];if(o===2&&t[0]===t[1])return()=>t[1];const a=e[0]===e[1];e[0]>e[o-1]&&(e=[...e].reverse(),t=[...t].reverse());const c=SEe(t,r,i),u=c.length,d=h=>{if(a&&h<e[0])return t[0];let p=0;if(u>1)for(;p<e.length-2&&!(h<e[p+1]);p++);const g=by(e[p],e[p+1],h);return c[p](g)};return n?h=>d(Dl(e[0],e[o-1],h)):d}function xEe(e,t){const n=e[e.length-1];for(let r=1;r<=t;r++){const i=by(0,t,r);e.push(tr(n,1,i))}}function kEe(e){const t=[0];return xEe(t,e.length-1),t}function _Ee(e,t){return e.map(n=>n*t)}function IEe(e,t){return e.map(()=>t||n8).splice(0,e.length-1)}function Tg({duration:e=300,keyframes:t,times:n,ease:r="easeInOut"}){const i=L1e(r)?r.map(dB):dB(r),o={done:!1,value:t[0]},a=_Ee(n&&n.length===t.length?n:kEe(t),e),c=wEe(a,t,{ease:Array.isArray(i)?i:IEe(t,i)});return{calculatedDuration:e,next:u=>(o.value=c(u),o.done=u>=e,o)}}const EEe=e=>e!==null;function tD(e,{repeat:t,repeatType:n="loop"},r,i=1){const o=e.filter(EEe),c=i<0||t&&n!=="loop"&&t%2===1?0:o.length-1;return!c||r===void 0?o[c]:r}const TEe={decay:zC,inertia:zC,tween:Tg,keyframes:Tg,spring:Aw};function g8(e){typeof e.type=="string"&&(e.type=TEe[e.type])}class nD{constructor(){this.updateFinished()}get finished(){return this._finished}updateFinished(){this._finished=new Promise(t=>{this.resolve=t})}notifyFinished(){this.resolve()}then(t,n){return this.finished.then(t,n)}}const CEe=e=>e/100;class rD extends nD{constructor(t){super(),this.state="idle",this.startTime=null,this.isStopped=!1,this.currentTime=0,this.holdTime=null,this.playbackSpeed=1,this.stop=()=>{const{motionValue:n}=this.options;n&&n.updatedAt!==fo.now()&&this.tick(fo.now()),this.isStopped=!0,this.state!=="idle"&&(this.teardown(),this.options.onStop?.())},this.options=t,this.initAnimation(),this.play(),t.autoplay===!1&&this.pause()}initAnimation(){const{options:t}=this;g8(t);const{type:n=Tg,repeat:r=0,repeatDelay:i=0,repeatType:o,velocity:a=0}=t;let{keyframes:c}=t;const u=n||Tg;u!==Tg&&typeof c[0]!="number"&&(this.mixKeyframes=xb(CEe,h8(c[0],c[1])),c=[0,100]);const d=u({...t,keyframes:c});o==="mirror"&&(this.mirroredGenerator=u({...t,keyframes:[...c].reverse(),velocity:-a})),d.calculatedDuration===null&&(d.calculatedDuration=eD(d));const{calculatedDuration:h}=d;this.calculatedDuration=h,this.resolvedDuration=h+i,this.totalDuration=this.resolvedDuration*(r+1)-i,this.generator=d}updateTime(t){const n=Math.round(t-this.startTime)*this.playbackSpeed;this.holdTime!==null?this.currentTime=this.holdTime:this.currentTime=n}tick(t,n=!1){const{generator:r,totalDuration:i,mixKeyframes:o,mirroredGenerator:a,resolvedDuration:c,calculatedDuration:u}=this;if(this.startTime===null)return r.next(0);const{delay:d=0,keyframes:h,repeat:p,repeatType:g,repeatDelay:y,type:b,onUpdate:S,finalKeyframe:w}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,t):this.speed<0&&(this.startTime=Math.min(t-i/this.speed,this.startTime)),n?this.currentTime=t:this.updateTime(t);const x=this.currentTime-d*(this.playbackSpeed>=0?1:-1),I=this.playbackSpeed>=0?x<0:x>i;this.currentTime=Math.max(x,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=i);let _=this.currentTime,M=r;if(p){const A=Math.min(this.currentTime,i)/c;let U=Math.floor(A),R=A%1;!R&&A>=1&&(R=1),R===1&&U--,U=Math.min(U,p+1),!!(U%2)&&(g==="reverse"?(R=1-R,y&&(R-=y/c)):g==="mirror"&&(M=a)),_=Dl(0,1,R)*c}const C=I?{done:!1,value:h[0]}:M.next(_);o&&(C.value=o(C.value));let{done:E}=C;!I&&u!==null&&(E=this.playbackSpeed>=0?this.currentTime>=i:this.currentTime<=0);const T=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&E);return T&&b!==zC&&(C.value=tD(h,this.options,w,this.speed)),S&&S(C.value),T&&this.finish(),C}then(t,n){return this.finished.then(t,n)}get duration(){return vs(this.calculatedDuration)}get iterationDuration(){const{delay:t=0}=this.options||{};return this.duration+vs(t)}get time(){return vs(this.currentTime)}set time(t){t=Ca(t),this.currentTime=t,this.startTime===null||this.holdTime!==null||this.playbackSpeed===0?this.holdTime=t:this.driver&&(this.startTime=this.driver.now()-t/this.playbackSpeed),this.driver?.start(!1)}get speed(){return this.playbackSpeed}set speed(t){this.updateTime(fo.now());const n=this.playbackSpeed!==t;this.playbackSpeed=t,n&&(this.time=vs(this.currentTime))}play(){if(this.isStopped)return;const{driver:t=dEe,startTime:n}=this.options;this.driver||(this.driver=t(i=>this.tick(i))),this.options.onPlay?.();const r=this.driver.now();this.state==="finished"?(this.updateFinished(),this.startTime=r):this.holdTime!==null?this.startTime=r-this.holdTime:this.startTime||(this.startTime=n??r),this.state==="finished"&&this.speed<0&&(this.startTime+=this.calculatedDuration),this.holdTime=null,this.state="running",this.driver.start()}pause(){this.state="paused",this.updateTime(fo.now()),this.holdTime=this.currentTime}complete(){this.state!=="running"&&this.play(),this.state="finished",this.holdTime=null}finish(){this.notifyFinished(),this.teardown(),this.state="finished",this.options.onComplete?.()}cancel(){this.holdTime=null,this.startTime=0,this.tick(0),this.teardown(),this.options.onCancel?.()}teardown(){this.state="idle",this.stopDriver(),this.startTime=this.holdTime=null}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(t){return this.startTime=0,this.tick(t,!0)}attachTimeline(t){return this.options.allowFlatten&&(this.options.type="keyframes",this.options.ease="linear",this.initAnimation()),this.driver?.stop(),t.observe(this)}}function MEe(e){for(let t=1;t<e.length;t++)e[t]??(e[t]=e[t-1])}const Hu=e=>e*180/Math.PI,BC=e=>{const t=Hu(Math.atan2(e[1],e[0]));return qC(t)},REe={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scale:e=>(Math.abs(e[0])+Math.abs(e[3]))/2,rotate:BC,rotateZ:BC,skewX:e=>Hu(Math.atan(e[1])),skewY:e=>Hu(Math.atan(e[2])),skew:e=>(Math.abs(e[1])+Math.abs(e[2]))/2},qC=e=>(e=e%360,e<0&&(e+=360),e),yB=BC,bB=e=>Math.sqrt(e[0]*e[0]+e[1]*e[1]),vB=e=>Math.sqrt(e[4]*e[4]+e[5]*e[5]),AEe={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:bB,scaleY:vB,scale:e=>(bB(e)+vB(e))/2,rotateX:e=>qC(Hu(Math.atan2(e[6],e[5]))),rotateY:e=>qC(Hu(Math.atan2(-e[2],e[0]))),rotateZ:yB,rotate:yB,skewX:e=>Hu(Math.atan(e[4])),skewY:e=>Hu(Math.atan(e[1])),skew:e=>(Math.abs(e[1])+Math.abs(e[4]))/2};function UC(e){return e.includes("scale")?1:0}function VC(e,t){if(!e||e==="none")return UC(t);const n=e.match(/^matrix3d\(([-\d.e\s,]+)\)$/u);let r,i;if(n)r=AEe,i=n;else{const c=e.match(/^matrix\(([-\d.e\s,]+)\)$/u);r=REe,i=c}if(!i)return UC(t);const o=r[t],a=i[1].split(",").map(DEe);return typeof o=="function"?o(a):a[o]}const OEe=(e,t)=>{const{transform:n="none"}=getComputedStyle(e);return VC(n,t)};function DEe(e){return parseFloat(e.trim())}const Op=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],Dp=new Set(Op),SB=e=>e===Ap||e===pt,PEe=new Set(["x","y","z"]),NEe=Op.filter(e=>!PEe.has(e));function LEe(e){const t=[];return NEe.forEach(n=>{const r=e.getValue(n);r!==void 0&&(t.push([n,r.get()]),r.set(n.startsWith("scale")?1:0))}),t}const od={width:({x:e},{paddingLeft:t="0",paddingRight:n="0"})=>e.max-e.min-parseFloat(t)-parseFloat(n),height:({y:e},{paddingTop:t="0",paddingBottom:n="0"})=>e.max-e.min-parseFloat(t)-parseFloat(n),top:(e,{top:t})=>parseFloat(t),left:(e,{left:t})=>parseFloat(t),bottom:({y:e},{top:t})=>parseFloat(t)+(e.max-e.min),right:({x:e},{left:t})=>parseFloat(t)+(e.max-e.min),x:(e,{transform:t})=>VC(t,"x"),y:(e,{transform:t})=>VC(t,"y")};od.translateX=od.x;od.translateY=od.y;const sd=new Set;let KC=!1,HC=!1,WC=!1;function y8(){if(HC){const e=Array.from(sd).filter(r=>r.needsMeasurement),t=new Set(e.map(r=>r.element)),n=new Map;t.forEach(r=>{const i=LEe(r);i.length&&(n.set(r,i),r.render())}),e.forEach(r=>r.measureInitialState()),t.forEach(r=>{r.render();const i=n.get(r);i&&i.forEach(([o,a])=>{r.getValue(o)?.set(a)})}),e.forEach(r=>r.measureEndState()),e.forEach(r=>{r.suspendedScrollY!==void 0&&window.scrollTo(0,r.suspendedScrollY)})}HC=!1,KC=!1,sd.forEach(e=>e.complete(WC)),sd.clear()}function b8(){sd.forEach(e=>{e.readKeyframes(),e.needsMeasurement&&(HC=!0)})}function $Ee(){WC=!0,b8(),y8(),WC=!1}class iD{constructor(t,n,r,i,o,a=!1){this.state="pending",this.isAsync=!1,this.needsMeasurement=!1,this.unresolvedKeyframes=[...t],this.onComplete=n,this.name=r,this.motionValue=i,this.element=o,this.isAsync=a}scheduleResolve(){this.state="scheduled",this.isAsync?(sd.add(this),KC||(KC=!0,Xn.read(b8),Xn.resolveKeyframes(y8))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:t,name:n,element:r,motionValue:i}=this;if(t[0]===null){const o=i?.get(),a=t[t.length-1];if(o!==void 0)t[0]=o;else if(r&&n){const c=r.readValue(n,a);c!=null&&(t[0]=c)}t[0]===void 0&&(t[0]=a),i&&o===void 0&&i.set(t[0])}MEe(t)}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(t=!1){this.state="complete",this.onComplete(this.unresolvedKeyframes,this.finalKeyframe,t),sd.delete(this)}cancel(){this.state==="scheduled"&&(sd.delete(this),this.state="pending")}resume(){this.state==="pending"&&this.scheduleResolve()}}const jEe=e=>e.startsWith("--");function FEe(e,t,n){jEe(t)?e.style.setProperty(t,n):e.style[t]=n}const zEe=HO(()=>window.ScrollTimeline!==void 0),BEe={};function qEe(e,t){const n=HO(e);return()=>BEe[t]??n()}const v8=qEe(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0},"linearEasing"),dg=([e,t,n,r])=>`cubic-bezier(${e}, ${t}, ${n}, ${r})`,wB={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:dg([0,.65,.55,1]),circOut:dg([.55,0,1,.45]),backIn:dg([.31,.01,.66,-.59]),backOut:dg([.33,1.53,.69,.99])};function S8(e,t){if(e)return typeof e=="function"?v8()?p8(e,t):"ease-out":r8(e)?dg(e):Array.isArray(e)?e.map(n=>S8(n,t)||wB.easeOut):wB[e]}function UEe(e,t,n,{delay:r=0,duration:i=300,repeat:o=0,repeatType:a="loop",ease:c="easeOut",times:u}={},d=void 0){const h={[t]:n};u&&(h.offset=u);const p=S8(c,i);Array.isArray(p)&&(h.easing=p);const g={delay:r,duration:i,easing:Array.isArray(p)?"linear":p,fill:"both",iterations:o+1,direction:a==="reverse"?"alternate":"normal"};return d&&(g.pseudoElement=d),e.animate(h,g)}function w8(e){return typeof e=="function"&&"applyToOptions"in e}function VEe({type:e,...t}){return w8(e)&&v8()?e.applyToOptions(t):(t.duration??(t.duration=300),t.ease??(t.ease="easeOut"),t)}class KEe extends nD{constructor(t){if(super(),this.finishedTime=null,this.isStopped=!1,!t)return;const{element:n,name:r,keyframes:i,pseudoElement:o,allowFlatten:a=!1,finalKeyframe:c,onComplete:u}=t;this.isPseudoElement=!!o,this.allowFlatten=a,this.options=t,KO(typeof t.type!="string");const d=VEe(t);this.animation=UEe(n,r,i,d,o),d.autoplay===!1&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!o){const h=tD(i,this.options,c,this.speed);this.updateMotionValue?this.updateMotionValue(h):FEe(n,r,h),this.animation.cancel()}u?.(),this.notifyFinished()}}play(){this.isStopped||(this.animation.play(),this.state==="finished"&&this.updateFinished())}pause(){this.animation.pause()}complete(){this.animation.finish?.()}cancel(){try{this.animation.cancel()}catch{}}stop(){if(this.isStopped)return;this.isStopped=!0;const{state:t}=this;t==="idle"||t==="finished"||(this.updateMotionValue?this.updateMotionValue():this.commitStyles(),this.isPseudoElement||this.cancel())}commitStyles(){this.isPseudoElement||this.animation.commitStyles?.()}get duration(){const t=this.animation.effect?.getComputedTiming?.().duration||0;return vs(Number(t))}get iterationDuration(){const{delay:t=0}=this.options||{};return this.duration+vs(t)}get time(){return vs(Number(this.animation.currentTime)||0)}set time(t){this.finishedTime=null,this.animation.currentTime=Ca(t)}get speed(){return this.animation.playbackRate}set speed(t){t<0&&(this.finishedTime=null),this.animation.playbackRate=t}get state(){return this.finishedTime!==null?"finished":this.animation.playState}get startTime(){return Number(this.animation.startTime)}set startTime(t){this.animation.startTime=t}attachTimeline({timeline:t,observe:n}){return this.allowFlatten&&this.animation.effect?.updateTiming({easing:"linear"}),this.animation.onfinish=null,t&&zEe()?(this.animation.timeline=t,ws):n(this)}}const x8={anticipate:Z9,backInOut:J9,circInOut:t8};function HEe(e){return e in x8}function WEe(e){typeof e.ease=="string"&&HEe(e.ease)&&(e.ease=x8[e.ease])}const xB=10;class GEe extends KEe{constructor(t){WEe(t),g8(t),super(t),t.startTime&&(this.startTime=t.startTime),this.options=t}updateMotionValue(t){const{motionValue:n,onUpdate:r,onComplete:i,element:o,...a}=this.options;if(!n)return;if(t!==void 0){n.set(t);return}const c=new rD({...a,autoplay:!1}),u=Ca(this.finishedTime??this.time);n.setWithVelocity(c.sample(u-xB).value,c.sample(u).value,xB),c.stop()}}const kB=(e,t)=>t==="zIndex"?!1:!!(typeof e=="number"||Array.isArray(e)||typeof e=="string"&&(Gc.test(e)||e==="0")&&!e.startsWith("url("));function YEe(e){const t=e[0];if(e.length===1)return!0;for(let n=0;n<e.length;n++)if(e[n]!==t)return!0}function QEe(e,t,n,r){const i=e[0];if(i===null)return!1;if(t==="display"||t==="visibility")return!0;const o=e[e.length-1],a=kB(i,t),c=kB(o,t);return!a||!c?!1:YEe(e)||(n==="spring"||w8(n))&&r}function GC(e){e.duration=0,e.type="keyframes"}const XEe=new Set(["opacity","clipPath","filter","transform"]),JEe=HO(()=>Object.hasOwnProperty.call(Element.prototype,"animate"));function ZEe(e){const{motionValue:t,name:n,repeatDelay:r,repeatType:i,damping:o,type:a}=e;if(!(t?.owner?.current instanceof HTMLElement))return!1;const{onUpdate:u,transformTemplate:d}=t.owner.getProps();return JEe()&&n&&XEe.has(n)&&(n!=="transform"||!d)&&!u&&!r&&i!=="mirror"&&o!==0&&a!=="inertia"}const eTe=40;class tTe extends nD{constructor({autoplay:t=!0,delay:n=0,type:r="keyframes",repeat:i=0,repeatDelay:o=0,repeatType:a="loop",keyframes:c,name:u,motionValue:d,element:h,...p}){super(),this.stop=()=>{this._animation&&(this._animation.stop(),this.stopTimeline?.()),this.keyframeResolver?.cancel()},this.createdAt=fo.now();const g={autoplay:t,delay:n,type:r,repeat:i,repeatDelay:o,repeatType:a,name:u,motionValue:d,element:h,...p},y=h?.KeyframeResolver||iD;this.keyframeResolver=new y(c,(b,S,w)=>this.onKeyframesResolved(b,S,g,!w),u,d,h),this.keyframeResolver?.scheduleResolve()}onKeyframesResolved(t,n,r,i){this.keyframeResolver=void 0;const{name:o,type:a,velocity:c,delay:u,isHandoff:d,onUpdate:h}=r;this.resolvedAt=fo.now(),QEe(t,o,a,c)||((Pl.instantAnimations||!u)&&h?.(tD(t,r,n)),t[0]=t[t.length-1],GC(r),r.repeat=0);const g={startTime:i?this.resolvedAt?this.resolvedAt-this.createdAt>eTe?this.resolvedAt:this.createdAt:this.createdAt:void 0,finalKeyframe:n,...r,keyframes:t},y=!d&&ZEe(g)?new GEe({...g,element:g.motionValue.owner.current}):new rD(g);y.finished.then(()=>this.notifyFinished()).catch(ws),this.pendingTimeline&&(this.stopTimeline=y.attachTimeline(this.pendingTimeline),this.pendingTimeline=void 0),this._animation=y}get finished(){return this._animation?this.animation.finished:this._finished}then(t,n){return this.finished.finally(t).then(()=>{})}get animation(){return this._animation||(this.keyframeResolver?.resume(),$Ee()),this._animation}get duration(){return this.animation.duration}get iterationDuration(){return this.animation.iterationDuration}get time(){return this.animation.time}set time(t){this.animation.time=t}get speed(){return this.animation.speed}get state(){return this.animation.state}set speed(t){this.animation.speed=t}get startTime(){return this.animation.startTime}attachTimeline(t){return this._animation?this.stopTimeline=this.animation.attachTimeline(t):this.pendingTimeline=t,()=>this.stop()}play(){this.animation.play()}pause(){this.animation.pause()}complete(){this.animation.complete()}cancel(){this._animation&&this.animation.cancel(),this.keyframeResolver?.cancel()}}const nTe=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function rTe(e){const t=nTe.exec(e);if(!t)return[,];const[,n,r,i]=t;return[`--${n??r}`,i]}function k8(e,t,n=1){const[r,i]=rTe(e);if(!r)return;const o=window.getComputedStyle(t).getPropertyValue(r);if(o){const a=o.trim();return V9(a)?parseFloat(a):a}return QO(i)?k8(i,t,n+1):i}function oD(e,t){return e?.[t]??e?.default??e}const _8=new Set(["width","height","top","left","right","bottom",...Op]),iTe={test:e=>e==="auto",parse:e=>e},I8=e=>t=>t.test(e),E8=[Ap,pt,Ma,Sc,Y1e,G1e,iTe],_B=e=>E8.find(I8(e));function oTe(e){return typeof e=="number"?e===0:e!==null?e==="none"||e==="0"||H9(e):!0}const sTe=new Set(["brightness","contrast","saturate","opacity"]);function aTe(e){const[t,n]=e.slice(0,-1).split("(");if(t==="drop-shadow")return e;const[r]=n.match(XO)||[];if(!r)return e;const i=n.replace(r,"");let o=sTe.has(t)?1:0;return r!==n&&(o*=100),t+"("+o+i+")"}const lTe=/\b([a-z-]*)\(.*?\)/gu,YC={...Gc,getAnimatableNone:e=>{const t=e.match(lTe);return t?t.map(aTe).join(" "):e}},IB={...Ap,transform:Math.round},cTe={rotate:Sc,rotateX:Sc,rotateY:Sc,rotateZ:Sc,scale:kS,scaleX:kS,scaleY:kS,scaleZ:kS,skew:Sc,skewX:Sc,skewY:Sc,distance:pt,translateX:pt,translateY:pt,translateZ:pt,x:pt,y:pt,z:pt,perspective:pt,transformPerspective:pt,opacity:vy,originX:fB,originY:fB,originZ:pt},sD={borderWidth:pt,borderTopWidth:pt,borderRightWidth:pt,borderBottomWidth:pt,borderLeftWidth:pt,borderRadius:pt,radius:pt,borderTopLeftRadius:pt,borderTopRightRadius:pt,borderBottomRightRadius:pt,borderBottomLeftRadius:pt,width:pt,maxWidth:pt,height:pt,maxHeight:pt,top:pt,right:pt,bottom:pt,left:pt,padding:pt,paddingTop:pt,paddingRight:pt,paddingBottom:pt,paddingLeft:pt,margin:pt,marginTop:pt,marginRight:pt,marginBottom:pt,marginLeft:pt,backgroundPositionX:pt,backgroundPositionY:pt,...cTe,zIndex:IB,fillOpacity:vy,strokeOpacity:vy,numOctaves:IB},uTe={...sD,color:Nr,backgroundColor:Nr,outlineColor:Nr,fill:Nr,stroke:Nr,borderColor:Nr,borderTopColor:Nr,borderRightColor:Nr,borderBottomColor:Nr,borderLeftColor:Nr,filter:YC,WebkitFilter:YC},T8=e=>uTe[e];function C8(e,t){let n=T8(e);return n!==YC&&(n=Gc),n.getAnimatableNone?n.getAnimatableNone(t):void 0}const dTe=new Set(["auto","none","0"]);function fTe(e,t,n){let r=0,i;for(;r<e.length&&!i;){const o=e[r];typeof o=="string"&&!dTe.has(o)&&Sy(o).values.length&&(i=e[r]),r++}if(i&&n)for(const o of t)e[o]=C8(n,i)}class hTe extends iD{constructor(t,n,r,i,o){super(t,n,r,i,o,!0)}readKeyframes(){const{unresolvedKeyframes:t,element:n,name:r}=this;if(!n||!n.current)return;super.readKeyframes();for(let u=0;u<t.length;u++){let d=t[u];if(typeof d=="string"&&(d=d.trim(),QO(d))){const h=k8(d,n.current);h!==void 0&&(t[u]=h),u===t.length-1&&(this.finalKeyframe=d)}}if(this.resolveNoneKeyframes(),!_8.has(r)||t.length!==2)return;const[i,o]=t,a=_B(i),c=_B(o);if(a!==c)if(SB(a)&&SB(c))for(let u=0;u<t.length;u++){const d=t[u];typeof d=="string"&&(t[u]=parseFloat(d))}else od[r]&&(this.needsMeasurement=!0)}resolveNoneKeyframes(){const{unresolvedKeyframes:t,name:n}=this,r=[];for(let i=0;i<t.length;i++)(t[i]===null||oTe(t[i]))&&r.push(i);r.length&&fTe(t,r,n)}measureInitialState(){const{element:t,unresolvedKeyframes:n,name:r}=this;if(!t||!t.current)return;r==="height"&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=od[r](t.measureViewportBox(),window.getComputedStyle(t.current)),n[0]=this.measuredOrigin;const i=n[n.length-1];i!==void 0&&t.getValue(r,i).jump(i,!1)}measureEndState(){const{element:t,name:n,unresolvedKeyframes:r}=this;if(!t||!t.current)return;const i=t.getValue(n);i&&i.jump(this.measuredOrigin,!1);const o=r.length-1,a=r[o];r[o]=od[n](t.measureViewportBox(),window.getComputedStyle(t.current)),a!==null&&this.finalKeyframe===void 0&&(this.finalKeyframe=a),this.removedTransforms?.length&&this.removedTransforms.forEach(([c,u])=>{t.getValue(c).set(u)}),this.resolveNoneKeyframes()}}function pTe(e,t,n){if(e instanceof EventTarget)return[e];if(typeof e=="string"){let r=document;const i=n?.[e]??r.querySelectorAll(e);return i?Array.from(i):[]}return Array.from(e)}const M8=(e,t)=>t&&typeof e=="number"?t.transform(e):e;function R8(e){return K9(e)&&"offsetHeight"in e}const EB=30,mTe=e=>!isNaN(parseFloat(e));class gTe{constructor(t,n={}){this.canTrackVelocity=null,this.events={},this.updateAndNotify=r=>{const i=fo.now();if(this.updatedAt!==i&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(r),this.current!==this.prev&&(this.events.change?.notify(this.current),this.dependents))for(const o of this.dependents)o.dirty()},this.hasAnimated=!1,this.setCurrent(t),this.owner=n.owner}setCurrent(t){this.current=t,this.updatedAt=fo.now(),this.canTrackVelocity===null&&t!==void 0&&(this.canTrackVelocity=mTe(this.current))}setPrevFrameValue(t=this.current){this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt}onChange(t){return this.on("change",t)}on(t,n){this.events[t]||(this.events[t]=new WO);const r=this.events[t].add(n);return t==="change"?()=>{r(),Xn.read(()=>{this.events.change.getSize()||this.stop()})}:r}clearListeners(){for(const t in this.events)this.events[t].clear()}attach(t,n){this.passiveEffect=t,this.stopPassiveEffect=n}set(t){this.passiveEffect?this.passiveEffect(t,this.updateAndNotify):this.updateAndNotify(t)}setWithVelocity(t,n,r){this.set(n),this.prev=void 0,this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt-r}jump(t,n=!0){this.updateAndNotify(t),this.prev=t,this.prevUpdatedAt=this.prevFrameValue=void 0,n&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}dirty(){this.events.change?.notify(this.current)}addDependent(t){this.dependents||(this.dependents=new Set),this.dependents.add(t)}removeDependent(t){this.dependents&&this.dependents.delete(t)}get(){return this.current}getPrevious(){return this.prev}getVelocity(){const t=fo.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||t-this.updatedAt>EB)return 0;const n=Math.min(this.updatedAt-this.prevUpdatedAt,EB);return W9(parseFloat(this.current)-parseFloat(this.prevFrameValue),n)}start(t){return this.stop(),new Promise(n=>{this.hasAnimated=!0,this.animation=t(n),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){this.dependents?.clear(),this.events.destroy?.notify(),this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function Jh(e,t){return new gTe(e,t)}const{schedule:aD}=i8(queueMicrotask,!1),Ps={x:!1,y:!1};function A8(){return Ps.x||Ps.y}function yTe(e){return e==="x"||e==="y"?Ps[e]?null:(Ps[e]=!0,()=>{Ps[e]=!1}):Ps.x||Ps.y?null:(Ps.x=Ps.y=!0,()=>{Ps.x=Ps.y=!1})}function O8(e,t){const n=pTe(e),r=new AbortController,i={passive:!0,...t,signal:r.signal};return[n,i,()=>r.abort()]}function TB(e){return!(e.pointerType==="touch"||A8())}function bTe(e,t,n={}){const[r,i,o]=O8(e,n),a=c=>{if(!TB(c))return;const{target:u}=c,d=t(u,c);if(typeof d!="function"||!u)return;const h=p=>{TB(p)&&(d(p),u.removeEventListener("pointerleave",h))};u.addEventListener("pointerleave",h,i)};return r.forEach(c=>{c.addEventListener("pointerenter",a,i)}),o}const D8=(e,t)=>t?e===t?!0:D8(e,t.parentElement):!1,lD=e=>e.pointerType==="mouse"?typeof e.button!="number"||e.button<=0:e.isPrimary!==!1,vTe=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function STe(e){return vTe.has(e.tagName)||e.tabIndex!==-1}const g0=new WeakSet;function CB(e){return t=>{t.key==="Enter"&&e(t)}}function oE(e,t){e.dispatchEvent(new PointerEvent("pointer"+t,{isPrimary:!0,bubbles:!0}))}const wTe=(e,t)=>{const n=e.currentTarget;if(!n)return;const r=CB(()=>{if(g0.has(n))return;oE(n,"down");const i=CB(()=>{oE(n,"up")}),o=()=>oE(n,"cancel");n.addEventListener("keyup",i,t),n.addEventListener("blur",o,t)});n.addEventListener("keydown",r,t),n.addEventListener("blur",()=>n.removeEventListener("keydown",r),t)};function MB(e){return lD(e)&&!A8()}function xTe(e,t,n={}){const[r,i,o]=O8(e,n),a=c=>{const u=c.currentTarget;if(!MB(c))return;g0.add(u);const d=t(u,c),h=(y,b)=>{window.removeEventListener("pointerup",p),window.removeEventListener("pointercancel",g),g0.has(u)&&g0.delete(u),MB(y)&&typeof d=="function"&&d(y,{success:b})},p=y=>{h(y,u===window||u===document||n.useGlobalTarget||D8(u,y.target))},g=y=>{h(y,!1)};window.addEventListener("pointerup",p,i),window.addEventListener("pointercancel",g,i)};return r.forEach(c=>{(n.useGlobalTarget?window:c).addEventListener("pointerdown",a,i),R8(c)&&(c.addEventListener("focus",d=>wTe(d,i)),!STe(c)&&!c.hasAttribute("tabindex")&&(c.tabIndex=0))}),o}function P8(e){return K9(e)&&"ownerSVGElement"in e}function kTe(e){return P8(e)&&e.tagName==="svg"}const Oi=e=>!!(e&&e.getVelocity),_Te=[...E8,Nr,Gc],ITe=e=>_Te.find(I8(e)),cD=D.createContext({transformPagePoint:e=>e,isStatic:!1,reducedMotion:"never"});function RB(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function ETe(...e){return t=>{let n=!1;const r=e.map(i=>{const o=RB(i,t);return!n&&typeof o=="function"&&(n=!0),o});if(n)return()=>{for(let i=0;i<r.length;i++){const o=r[i];typeof o=="function"?o():RB(e[i],null)}}}}function TTe(...e){return D.useCallback(ETe(...e),e)}class CTe extends D.Component{getSnapshotBeforeUpdate(t){const n=this.props.childRef.current;if(n&&t.isPresent&&!this.props.isPresent){const r=n.offsetParent,i=R8(r)&&r.offsetWidth||0,o=this.props.sizeRef.current;o.height=n.offsetHeight||0,o.width=n.offsetWidth||0,o.top=n.offsetTop,o.left=n.offsetLeft,o.right=i-o.width-o.left}return null}componentDidUpdate(){}render(){return this.props.children}}function MTe({children:e,isPresent:t,anchorX:n,root:r}){const i=D.useId(),o=D.useRef(null),a=D.useRef({width:0,height:0,top:0,left:0,right:0}),{nonce:c}=D.useContext(cD),u=TTe(o,e?.ref);return D.useInsertionEffect(()=>{const{width:d,height:h,top:p,left:g,right:y}=a.current;if(t||!o.current||!d||!h)return;const b=n==="left"?`left: ${g}`:`right: ${y}`;o.current.dataset.motionPopId=i;const S=document.createElement("style");c&&(S.nonce=c);const w=r??document.head;return w.appendChild(S),S.sheet&&S.sheet.insertRule(`
98
+ [data-motion-pop-id="${i}"] {
99
+ position: absolute !important;
100
+ width: ${d}px !important;
101
+ height: ${h}px !important;
102
+ ${b}px !important;
103
+ top: ${p}px !important;
104
+ }
105
+ `),()=>{w.contains(S)&&w.removeChild(S)}},[t]),P.jsx(CTe,{isPresent:t,childRef:o,sizeRef:a,children:D.cloneElement(e,{ref:u})})}const RTe=({children:e,initial:t,isPresent:n,onExitComplete:r,custom:i,presenceAffectsLayout:o,mode:a,anchorX:c,root:u})=>{const d=BO(ATe),h=D.useId();let p=!0,g=D.useMemo(()=>(p=!1,{id:h,initial:t,isPresent:n,custom:i,onExitComplete:y=>{d.set(y,!0);for(const b of d.values())if(!b)return;r&&r()},register:y=>(d.set(y,!1),()=>d.delete(y))}),[n,d,r]);return o&&p&&(g={...g}),D.useMemo(()=>{d.forEach((y,b)=>d.set(b,!1))},[n]),D.useEffect(()=>{!n&&!d.size&&r&&r()},[n]),a==="popLayout"&&(e=P.jsx(MTe,{isPresent:n,anchorX:c,root:u,children:e})),P.jsx(vk.Provider,{value:g,children:e})};function ATe(){return new Map}function N8(e=!0){const t=D.useContext(vk);if(t===null)return[!0,null];const{isPresent:n,onExitComplete:r,register:i}=t,o=D.useId();D.useEffect(()=>{if(e)return i(o)},[e]);const a=D.useCallback(()=>e&&r&&r(o),[o,r,e]);return!n&&r?[!1,a]:[!0]}const _S=e=>e.key||"";function AB(e){const t=[];return D.Children.forEach(e,n=>{D.isValidElement(n)&&t.push(n)}),t}const OTe=({children:e,custom:t,initial:n=!0,onExitComplete:r,presenceAffectsLayout:i=!0,mode:o="sync",propagate:a=!1,anchorX:c="left",root:u})=>{const[d,h]=N8(a),p=D.useMemo(()=>AB(e),[e]),g=a&&!d?[]:p.map(_S),y=D.useRef(!0),b=D.useRef(p),S=BO(()=>new Map),[w,x]=D.useState(p),[I,_]=D.useState(p);U9(()=>{y.current=!1,b.current=p;for(let E=0;E<I.length;E++){const T=_S(I[E]);g.includes(T)?S.delete(T):S.get(T)!==!0&&S.set(T,!1)}},[I,g.length,g.join("-")]);const M=[];if(p!==w){let E=[...p];for(let T=0;T<I.length;T++){const A=I[T],U=_S(A);g.includes(U)||(E.splice(T,0,A),M.push(A))}return o==="wait"&&M.length&&(E=M),_(AB(E)),x(p),null}const{forceRender:C}=D.useContext(zO);return P.jsx(P.Fragment,{children:I.map(E=>{const T=_S(E),A=a&&!d?!1:p===I||g.includes(T),U=()=>{if(S.has(T))S.set(T,!0);else return;let R=!0;S.forEach(N=>{N||(R=!1)}),R&&(C?.(),_(b.current),a&&h?.(),r&&r())};return P.jsx(RTe,{isPresent:A,initial:!y.current||n?void 0:!1,custom:t,presenceAffectsLayout:i,mode:o,root:u,onExitComplete:A?void 0:U,anchorX:c,children:E},T)})})},L8=D.createContext({strict:!1}),OB={animation:["animate","variants","whileHover","whileTap","exit","whileInView","whileFocus","whileDrag"],exit:["exit"],drag:["drag","dragControls"],focus:["whileFocus"],hover:["whileHover","onHoverStart","onHoverEnd"],tap:["whileTap","onTap","onTapStart","onTapCancel"],pan:["onPan","onPanStart","onPanSessionStart","onPanEnd"],inView:["whileInView","onViewportEnter","onViewportLeave"],layout:["layout","layoutId"]},Zh={};for(const e in OB)Zh[e]={isEnabled:t=>OB[e].some(n=>!!t[n])};function DTe(e){for(const t in e)Zh[t]={...Zh[t],...e[t]}}const PTe=new Set(["animate","exit","variants","initial","style","values","variants","transition","transformTemplate","custom","inherit","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","globalTapTarget","ignoreStrict","viewport"]);function Ow(e){return e.startsWith("while")||e.startsWith("drag")&&e!=="draggable"||e.startsWith("layout")||e.startsWith("onTap")||e.startsWith("onPan")||e.startsWith("onLayout")||PTe.has(e)}let $8=e=>!Ow(e);function NTe(e){typeof e=="function"&&($8=t=>t.startsWith("on")?!Ow(t):e(t))}try{NTe(require("@emotion/is-prop-valid").default)}catch{}function LTe(e,t,n){const r={};for(const i in e)i==="values"&&typeof e.values=="object"||($8(i)||n===!0&&Ow(i)||!t&&!Ow(i)||e.draggable&&i.startsWith("onDrag"))&&(r[i]=e[i]);return r}const Sk=D.createContext({});function wk(e){return e!==null&&typeof e=="object"&&typeof e.start=="function"}function wy(e){return typeof e=="string"||Array.isArray(e)}const uD=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],dD=["initial",...uD];function xk(e){return wk(e.animate)||dD.some(t=>wy(e[t]))}function j8(e){return!!(xk(e)||e.variants)}function $Te(e,t){if(xk(e)){const{initial:n,animate:r}=e;return{initial:n===!1||wy(n)?n:void 0,animate:wy(r)?r:void 0}}return e.inherit!==!1?t:{}}function jTe(e){const{initial:t,animate:n}=$Te(e,D.useContext(Sk));return D.useMemo(()=>({initial:t,animate:n}),[DB(t),DB(n)])}function DB(e){return Array.isArray(e)?e.join(" "):e}function PB(e,t){return t.max===t.min?0:e/(t.max-t.min)*100}const Um={correct:(e,t)=>{if(!t.target)return e;if(typeof e=="string")if(pt.test(e))e=parseFloat(e);else return e;const n=PB(e,t.target.x),r=PB(e,t.target.y);return`${n}% ${r}%`}},FTe={correct:(e,{treeScale:t,projectionDelta:n})=>{const r=e,i=Gc.parse(e);if(i.length>5)return r;const o=Gc.createTransformer(e),a=typeof i[0]!="number"?1:0,c=n.x.scale*t.x,u=n.y.scale*t.y;i[0+a]/=c,i[1+a]/=u;const d=tr(c,u,.5);return typeof i[2+a]=="number"&&(i[2+a]/=d),typeof i[3+a]=="number"&&(i[3+a]/=d),o(i)}},QC={borderRadius:{...Um,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:Um,borderTopRightRadius:Um,borderBottomLeftRadius:Um,borderBottomRightRadius:Um,boxShadow:FTe};function F8(e,{layout:t,layoutId:n}){return Dp.has(e)||e.startsWith("origin")||(t||n!==void 0)&&(!!QC[e]||e==="opacity")}const zTe={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},BTe=Op.length;function qTe(e,t,n){let r="",i=!0;for(let o=0;o<BTe;o++){const a=Op[o],c=e[a];if(c===void 0)continue;let u=!0;if(typeof c=="number"?u=c===(a.startsWith("scale")?1:0):u=parseFloat(c)===0,!u||n){const d=M8(c,sD[a]);if(!u){i=!1;const h=zTe[a]||a;r+=`${h}(${d}) `}n&&(t[a]=d)}}return r=r.trim(),n?r=n(t,i?"":r):i&&(r="none"),r}function fD(e,t,n){const{style:r,vars:i,transformOrigin:o}=e;let a=!1,c=!1;for(const u in t){const d=t[u];if(Dp.has(u)){a=!0;continue}else if(s8(u)){i[u]=d;continue}else{const h=M8(d,sD[u]);u.startsWith("origin")?(c=!0,o[u]=h):r[u]=h}}if(t.transform||(a||n?r.transform=qTe(t,e.transform,n):r.transform&&(r.transform="none")),c){const{originX:u="50%",originY:d="50%",originZ:h=0}=o;r.transformOrigin=`${u} ${d} ${h}`}}const hD=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function z8(e,t,n){for(const r in t)!Oi(t[r])&&!F8(r,n)&&(e[r]=t[r])}function UTe({transformTemplate:e},t){return D.useMemo(()=>{const n=hD();return fD(n,t,e),Object.assign({},n.vars,n.style)},[t])}function VTe(e,t){const n=e.style||{},r={};return z8(r,n,e),Object.assign(r,UTe(e,t)),r}function KTe(e,t){const n={},r=VTe(e,t);return e.drag&&e.dragListener!==!1&&(n.draggable=!1,r.userSelect=r.WebkitUserSelect=r.WebkitTouchCallout="none",r.touchAction=e.drag===!0?"none":`pan-${e.drag==="x"?"y":"x"}`),e.tabIndex===void 0&&(e.onTap||e.onTapStart||e.whileTap)&&(n.tabIndex=0),n.style=r,n}const HTe={offset:"stroke-dashoffset",array:"stroke-dasharray"},WTe={offset:"strokeDashoffset",array:"strokeDasharray"};function GTe(e,t,n=1,r=0,i=!0){e.pathLength=1;const o=i?HTe:WTe;e[o.offset]=pt.transform(-r);const a=pt.transform(t),c=pt.transform(n);e[o.array]=`${a} ${c}`}function B8(e,{attrX:t,attrY:n,attrScale:r,pathLength:i,pathSpacing:o=1,pathOffset:a=0,...c},u,d,h){if(fD(e,c,d),u){e.style.viewBox&&(e.attrs.viewBox=e.style.viewBox);return}e.attrs=e.style,e.style={};const{attrs:p,style:g}=e;p.transform&&(g.transform=p.transform,delete p.transform),(g.transform||p.transformOrigin)&&(g.transformOrigin=p.transformOrigin??"50% 50%",delete p.transformOrigin),g.transform&&(g.transformBox=h?.transformBox??"fill-box",delete p.transformBox),t!==void 0&&(p.x=t),n!==void 0&&(p.y=n),r!==void 0&&(p.scale=r),i!==void 0&&GTe(p,i,o,a,!1)}const q8=()=>({...hD(),attrs:{}}),U8=e=>typeof e=="string"&&e.toLowerCase()==="svg";function YTe(e,t,n,r){const i=D.useMemo(()=>{const o=q8();return B8(o,t,U8(r),e.transformTemplate,e.style),{...o.attrs,style:{...o.style}}},[t]);if(e.style){const o={};z8(o,e.style,e),i.style={...o,...i.style}}return i}const QTe=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","switch","symbol","svg","text","tspan","use","view"];function pD(e){return typeof e!="string"||e.includes("-")?!1:!!(QTe.indexOf(e)>-1||/[A-Z]/u.test(e))}function XTe(e,t,n,{latestValues:r},i,o=!1){const c=(pD(e)?YTe:KTe)(t,r,i,e),u=LTe(t,typeof e=="string",o),d=e!==D.Fragment?{...u,...c,ref:n}:{},{children:h}=t,p=D.useMemo(()=>Oi(h)?h.get():h,[h]);return D.createElement(e,{...d,children:p})}function NB(e){const t=[{},{}];return e?.values.forEach((n,r)=>{t[0][r]=n.get(),t[1][r]=n.getVelocity()}),t}function mD(e,t,n,r){if(typeof t=="function"){const[i,o]=NB(r);t=t(n!==void 0?n:e.custom,i,o)}if(typeof t=="string"&&(t=e.variants&&e.variants[t]),typeof t=="function"){const[i,o]=NB(r);t=t(n!==void 0?n:e.custom,i,o)}return t}function y0(e){return Oi(e)?e.get():e}function JTe({scrapeMotionValuesFromProps:e,createRenderState:t},n,r,i){return{latestValues:ZTe(n,r,i,e),renderState:t()}}function ZTe(e,t,n,r){const i={},o=r(e,{});for(const g in o)i[g]=y0(o[g]);let{initial:a,animate:c}=e;const u=xk(e),d=j8(e);t&&d&&!u&&e.inherit!==!1&&(a===void 0&&(a=t.initial),c===void 0&&(c=t.animate));let h=n?n.initial===!1:!1;h=h||a===!1;const p=h?c:a;if(p&&typeof p!="boolean"&&!wk(p)){const g=Array.isArray(p)?p:[p];for(let y=0;y<g.length;y++){const b=mD(e,g[y]);if(b){const{transitionEnd:S,transition:w,...x}=b;for(const I in x){let _=x[I];if(Array.isArray(_)){const M=h?_.length-1:0;_=_[M]}_!==null&&(i[I]=_)}for(const I in S)i[I]=S[I]}}}return i}const V8=e=>(t,n)=>{const r=D.useContext(Sk),i=D.useContext(vk),o=()=>JTe(e,t,r,i);return n?o():BO(o)};function gD(e,t,n){const{style:r}=e,i={};for(const o in r)(Oi(r[o])||t.style&&Oi(t.style[o])||F8(o,e)||n?.getValue(o)?.liveStyle!==void 0)&&(i[o]=r[o]);return i}const eCe=V8({scrapeMotionValuesFromProps:gD,createRenderState:hD});function K8(e,t,n){const r=gD(e,t,n);for(const i in e)if(Oi(e[i])||Oi(t[i])){const o=Op.indexOf(i)!==-1?"attr"+i.charAt(0).toUpperCase()+i.substring(1):i;r[o]=e[i]}return r}const tCe=V8({scrapeMotionValuesFromProps:K8,createRenderState:q8}),nCe=Symbol.for("motionComponentSymbol");function ih(e){return e&&typeof e=="object"&&Object.prototype.hasOwnProperty.call(e,"current")}function rCe(e,t,n){return D.useCallback(r=>{r&&e.onMount&&e.onMount(r),t&&(r?t.mount(r):t.unmount()),n&&(typeof n=="function"?n(r):ih(n)&&(n.current=r))},[t])}const yD=e=>e.replace(/([a-z])([A-Z])/gu,"$1-$2").toLowerCase(),iCe="framerAppearId",H8="data-"+yD(iCe),W8=D.createContext({});function oCe(e,t,n,r,i){const{visualElement:o}=D.useContext(Sk),a=D.useContext(L8),c=D.useContext(vk),u=D.useContext(cD).reducedMotion,d=D.useRef(null);r=r||a.renderer,!d.current&&r&&(d.current=r(e,{visualState:t,parent:o,props:n,presenceContext:c,blockInitialAnimation:c?c.initial===!1:!1,reducedMotionConfig:u}));const h=d.current,p=D.useContext(W8);h&&!h.projection&&i&&(h.type==="html"||h.type==="svg")&&sCe(d.current,n,i,p);const g=D.useRef(!1);D.useInsertionEffect(()=>{h&&g.current&&h.update(n,c)});const y=n[H8],b=D.useRef(!!y&&!window.MotionHandoffIsComplete?.(y)&&window.MotionHasOptimisedAnimation?.(y));return U9(()=>{h&&(g.current=!0,window.MotionIsMounted=!0,h.updateFeatures(),h.scheduleRenderMicrotask(),b.current&&h.animationState&&h.animationState.animateChanges())}),D.useEffect(()=>{h&&(!b.current&&h.animationState&&h.animationState.animateChanges(),b.current&&(queueMicrotask(()=>{window.MotionHandoffMarkAsComplete?.(y)}),b.current=!1),h.enteringChildren=void 0)}),h}function sCe(e,t,n,r){const{layoutId:i,layout:o,drag:a,dragConstraints:c,layoutScroll:u,layoutRoot:d,layoutCrossfade:h}=t;e.projection=new n(e.latestValues,t["data-framer-portal-id"]?void 0:G8(e.parent)),e.projection.setOptions({layoutId:i,layout:o,alwaysMeasureLayout:!!a||c&&ih(c),visualElement:e,animationType:typeof o=="string"?o:"both",initialPromotionConfig:r,crossfade:h,layoutScroll:u,layoutRoot:d})}function G8(e){if(e)return e.options.allowProjection!==!1?e.projection:G8(e.parent)}function sE(e,{forwardMotionProps:t=!1}={},n,r){n&&DTe(n);const i=pD(e)?tCe:eCe;function o(c,u){let d;const h={...D.useContext(cD),...c,layoutId:aCe(c)},{isStatic:p}=h,g=jTe(c),y=i(c,p);if(!p&&qO){lCe();const b=cCe(h);d=b.MeasureLayout,g.visualElement=oCe(e,y,h,r,b.ProjectionNode)}return P.jsxs(Sk.Provider,{value:g,children:[d&&g.visualElement?P.jsx(d,{visualElement:g.visualElement,...h}):null,XTe(e,c,rCe(y,g.visualElement,u),y,p,t)]})}o.displayName=`motion.${typeof e=="string"?e:`create(${e.displayName??e.name??""})`}`;const a=D.forwardRef(o);return a[nCe]=e,a}function aCe({layoutId:e}){const t=D.useContext(zO).id;return t&&e!==void 0?t+"-"+e:e}function lCe(e,t){D.useContext(L8).strict}function cCe(e){const{drag:t,layout:n}=Zh;if(!t&&!n)return{};const r={...t,...n};return{MeasureLayout:t?.isEnabled(e)||n?.isEnabled(e)?r.MeasureLayout:void 0,ProjectionNode:r.ProjectionNode}}function uCe(e,t){if(typeof Proxy>"u")return sE;const n=new Map,r=(o,a)=>sE(o,a,e,t),i=(o,a)=>r(o,a);return new Proxy(i,{get:(o,a)=>a==="create"?r:(n.has(a)||n.set(a,sE(a,void 0,e,t)),n.get(a))})}function Y8({top:e,left:t,right:n,bottom:r}){return{x:{min:t,max:n},y:{min:e,max:r}}}function dCe({x:e,y:t}){return{top:t.min,right:e.max,bottom:t.max,left:e.min}}function fCe(e,t){if(!t)return e;const n=t({x:e.left,y:e.top}),r=t({x:e.right,y:e.bottom});return{top:n.y,left:n.x,bottom:r.y,right:r.x}}function aE(e){return e===void 0||e===1}function XC({scale:e,scaleX:t,scaleY:n}){return!aE(e)||!aE(t)||!aE(n)}function $u(e){return XC(e)||Q8(e)||e.z||e.rotate||e.rotateX||e.rotateY||e.skewX||e.skewY}function Q8(e){return LB(e.x)||LB(e.y)}function LB(e){return e&&e!=="0%"}function Dw(e,t,n){const r=e-n,i=t*r;return n+i}function $B(e,t,n,r,i){return i!==void 0&&(e=Dw(e,i,r)),Dw(e,n,r)+t}function JC(e,t=0,n=1,r,i){e.min=$B(e.min,t,n,r,i),e.max=$B(e.max,t,n,r,i)}function X8(e,{x:t,y:n}){JC(e.x,t.translate,t.scale,t.originPoint),JC(e.y,n.translate,n.scale,n.originPoint)}const jB=.999999999999,FB=1.0000000000001;function hCe(e,t,n,r=!1){const i=n.length;if(!i)return;t.x=t.y=1;let o,a;for(let c=0;c<i;c++){o=n[c],a=o.projectionDelta;const{visualElement:u}=o.options;u&&u.props.style&&u.props.style.display==="contents"||(r&&o.options.layoutScroll&&o.scroll&&o!==o.root&&sh(e,{x:-o.scroll.offset.x,y:-o.scroll.offset.y}),a&&(t.x*=a.x.scale,t.y*=a.y.scale,X8(e,a)),r&&$u(o.latestValues)&&sh(e,o.latestValues))}t.x<FB&&t.x>jB&&(t.x=1),t.y<FB&&t.y>jB&&(t.y=1)}function oh(e,t){e.min=e.min+t,e.max=e.max+t}function zB(e,t,n,r,i=.5){const o=tr(e.min,e.max,i);JC(e,t,n,o,r)}function sh(e,t){zB(e.x,t.x,t.scaleX,t.scale,t.originX),zB(e.y,t.y,t.scaleY,t.scale,t.originY)}function J8(e,t){return Y8(fCe(e.getBoundingClientRect(),t))}function pCe(e,t,n){const r=J8(e,n),{scroll:i}=t;return i&&(oh(r.x,i.offset.x),oh(r.y,i.offset.y)),r}const BB=()=>({translate:0,scale:1,origin:0,originPoint:0}),ah=()=>({x:BB(),y:BB()}),qB=()=>({min:0,max:0}),Vr=()=>({x:qB(),y:qB()}),ZC={current:null},Z8={current:!1};function mCe(){if(Z8.current=!0,!!qO)if(window.matchMedia){const e=window.matchMedia("(prefers-reduced-motion)"),t=()=>ZC.current=e.matches;e.addEventListener("change",t),t()}else ZC.current=!1}const gCe=new WeakMap;function yCe(e,t,n){for(const r in t){const i=t[r],o=n[r];if(Oi(i))e.addValue(r,i);else if(Oi(o))e.addValue(r,Jh(i,{owner:e}));else if(o!==i)if(e.hasValue(r)){const a=e.getValue(r);a.liveStyle===!0?a.jump(i):a.hasAnimated||a.set(i)}else{const a=e.getStaticValue(r);e.addValue(r,Jh(a!==void 0?a:i,{owner:e}))}}for(const r in n)t[r]===void 0&&e.removeValue(r);return t}const UB=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];class bCe{scrapeMotionValuesFromProps(t,n,r){return{}}constructor({parent:t,props:n,presenceContext:r,reducedMotionConfig:i,blockInitialAnimation:o,visualState:a},c={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.values=new Map,this.KeyframeResolver=iD,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{const g=fo.now();this.renderScheduledAt<g&&(this.renderScheduledAt=g,Xn.render(this.render,!1,!0))};const{latestValues:u,renderState:d}=a;this.latestValues=u,this.baseTarget={...u},this.initialValues=n.initial?{...u}:{},this.renderState=d,this.parent=t,this.props=n,this.presenceContext=r,this.depth=t?t.depth+1:0,this.reducedMotionConfig=i,this.options=c,this.blockInitialAnimation=!!o,this.isControllingVariants=xk(n),this.isVariantNode=j8(n),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(t&&t.current);const{willChange:h,...p}=this.scrapeMotionValuesFromProps(n,{},this);for(const g in p){const y=p[g];u[g]!==void 0&&Oi(y)&&y.set(u[g])}}mount(t){this.current=t,gCe.set(t,this),this.projection&&!this.projection.instance&&this.projection.mount(t),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEach((n,r)=>this.bindToMotionValue(r,n)),Z8.current||mCe(),this.shouldReduceMotion=this.reducedMotionConfig==="never"?!1:this.reducedMotionConfig==="always"?!0:ZC.current,this.parent?.addChild(this),this.update(this.props,this.presenceContext)}unmount(){this.projection&&this.projection.unmount(),Wc(this.notifyUpdate),Wc(this.render),this.valueSubscriptions.forEach(t=>t()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent?.removeChild(this);for(const t in this.events)this.events[t].clear();for(const t in this.features){const n=this.features[t];n&&(n.unmount(),n.isMounted=!1)}this.current=null}addChild(t){this.children.add(t),this.enteringChildren??(this.enteringChildren=new Set),this.enteringChildren.add(t)}removeChild(t){this.children.delete(t),this.enteringChildren&&this.enteringChildren.delete(t)}bindToMotionValue(t,n){this.valueSubscriptions.has(t)&&this.valueSubscriptions.get(t)();const r=Dp.has(t);r&&this.onBindTransform&&this.onBindTransform();const i=n.on("change",a=>{this.latestValues[t]=a,this.props.onUpdate&&Xn.preRender(this.notifyUpdate),r&&this.projection&&(this.projection.isTransformDirty=!0),this.scheduleRender()});let o;window.MotionCheckAppearSync&&(o=window.MotionCheckAppearSync(this,t,n)),this.valueSubscriptions.set(t,()=>{i(),o&&o(),n.owner&&n.stop()})}sortNodePosition(t){return!this.current||!this.sortInstanceNodePosition||this.type!==t.type?0:this.sortInstanceNodePosition(this.current,t.current)}updateFeatures(){let t="animation";for(t in Zh){const n=Zh[t];if(!n)continue;const{isEnabled:r,Feature:i}=n;if(!this.features[t]&&i&&r(this.props)&&(this.features[t]=new i(this)),this.features[t]){const o=this.features[t];o.isMounted?o.update():(o.mount(),o.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):Vr()}getStaticValue(t){return this.latestValues[t]}setStaticValue(t,n){this.latestValues[t]=n}update(t,n){(t.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=t,this.prevPresenceContext=this.presenceContext,this.presenceContext=n;for(let r=0;r<UB.length;r++){const i=UB[r];this.propEventSubscriptions[i]&&(this.propEventSubscriptions[i](),delete this.propEventSubscriptions[i]);const o="on"+i,a=t[o];a&&(this.propEventSubscriptions[i]=this.on(i,a))}this.prevMotionValues=yCe(this,this.scrapeMotionValuesFromProps(t,this.prevProps,this),this.prevMotionValues),this.handleChildMotionValue&&this.handleChildMotionValue()}getProps(){return this.props}getVariant(t){return this.props.variants?this.props.variants[t]:void 0}getDefaultTransition(){return this.props.transition}getTransformPagePoint(){return this.props.transformPagePoint}getClosestVariantNode(){return this.isVariantNode?this:this.parent?this.parent.getClosestVariantNode():void 0}addVariantChild(t){const n=this.getClosestVariantNode();if(n)return n.variantChildren&&n.variantChildren.add(t),()=>n.variantChildren.delete(t)}addValue(t,n){const r=this.values.get(t);n!==r&&(r&&this.removeValue(t),this.bindToMotionValue(t,n),this.values.set(t,n),this.latestValues[t]=n.get())}removeValue(t){this.values.delete(t);const n=this.valueSubscriptions.get(t);n&&(n(),this.valueSubscriptions.delete(t)),delete this.latestValues[t],this.removeValueFromRenderState(t,this.renderState)}hasValue(t){return this.values.has(t)}getValue(t,n){if(this.props.values&&this.props.values[t])return this.props.values[t];let r=this.values.get(t);return r===void 0&&n!==void 0&&(r=Jh(n===null?void 0:n,{owner:this}),this.addValue(t,r)),r}readValue(t,n){let r=this.latestValues[t]!==void 0||!this.current?this.latestValues[t]:this.getBaseTargetFromProps(this.props,t)??this.readValueFromInstance(this.current,t,this.options);return r!=null&&(typeof r=="string"&&(V9(r)||H9(r))?r=parseFloat(r):!ITe(r)&&Gc.test(n)&&(r=C8(t,n)),this.setBaseTarget(t,Oi(r)?r.get():r)),Oi(r)?r.get():r}setBaseTarget(t,n){this.baseTarget[t]=n}getBaseTarget(t){const{initial:n}=this.props;let r;if(typeof n=="string"||typeof n=="object"){const o=mD(this.props,n,this.presenceContext?.custom);o&&(r=o[t])}if(n&&r!==void 0)return r;const i=this.getBaseTargetFromProps(this.props,t);return i!==void 0&&!Oi(i)?i:this.initialValues[t]!==void 0&&r===void 0?void 0:this.baseTarget[t]}on(t,n){return this.events[t]||(this.events[t]=new WO),this.events[t].add(n)}notify(t,...n){this.events[t]&&this.events[t].notify(...n)}scheduleRenderMicrotask(){aD.render(this.render)}}class eG extends bCe{constructor(){super(...arguments),this.KeyframeResolver=hTe}sortInstanceNodePosition(t,n){return t.compareDocumentPosition(n)&2?1:-1}getBaseTargetFromProps(t,n){return t.style?t.style[n]:void 0}removeValueFromRenderState(t,{vars:n,style:r}){delete n[t],delete r[t]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:t}=this.props;Oi(t)&&(this.childSubscription=t.on("change",n=>{this.current&&(this.current.textContent=`${n}`)}))}}function tG(e,{style:t,vars:n},r,i){const o=e.style;let a;for(a in t)o[a]=t[a];i?.applyProjectionStyles(o,r);for(a in n)o.setProperty(a,n[a])}function vCe(e){return window.getComputedStyle(e)}class SCe extends eG{constructor(){super(...arguments),this.type="html",this.renderInstance=tG}readValueFromInstance(t,n){if(Dp.has(n))return this.projection?.isProjecting?UC(n):OEe(t,n);{const r=vCe(t),i=(s8(n)?r.getPropertyValue(n):r[n])||0;return typeof i=="string"?i.trim():i}}measureInstanceViewportBox(t,{transformPagePoint:n}){return J8(t,n)}build(t,n,r){fD(t,n,r.transformTemplate)}scrapeMotionValuesFromProps(t,n,r){return gD(t,n,r)}}const nG=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues","viewBox","gradientTransform","pathLength","startOffset","textLength","lengthAdjust"]);function wCe(e,t,n,r){tG(e,t,void 0,r);for(const i in t.attrs)e.setAttribute(nG.has(i)?i:yD(i),t.attrs[i])}class xCe extends eG{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=Vr}getBaseTargetFromProps(t,n){return t[n]}readValueFromInstance(t,n){if(Dp.has(n)){const r=T8(n);return r&&r.default||0}return n=nG.has(n)?n:yD(n),t.getAttribute(n)}scrapeMotionValuesFromProps(t,n,r){return K8(t,n,r)}build(t,n,r){B8(t,n,this.isSVGTag,r.transformTemplate,r.style)}renderInstance(t,n,r,i){wCe(t,n,r,i)}mount(t){this.isSVGTag=U8(t.tagName),super.mount(t)}}const kCe=(e,t)=>pD(e)?new xCe(t):new SCe(t,{allowProjection:e!==D.Fragment});function Sh(e,t,n){const r=e.getProps();return mD(r,t,n!==void 0?n:r.custom,e)}const eM=e=>Array.isArray(e);function _Ce(e,t,n){e.hasValue(t)?e.getValue(t).set(n):e.addValue(t,Jh(n))}function ICe(e){return eM(e)?e[e.length-1]||0:e}function ECe(e,t){const n=Sh(e,t);let{transitionEnd:r={},transition:i={},...o}=n||{};o={...o,...r};for(const a in o){const c=ICe(o[a]);_Ce(e,a,c)}}function TCe(e){return!!(Oi(e)&&e.add)}function tM(e,t){const n=e.getValue("willChange");if(TCe(n))return n.add(t);if(!n&&Pl.WillChange){const r=new Pl.WillChange("auto");e.addValue("willChange",r),r.add(t)}}function rG(e){return e.props[H8]}const CCe=e=>e!==null;function MCe(e,{repeat:t,repeatType:n="loop"},r){const i=e.filter(CCe),o=t&&n!=="loop"&&t%2===1?0:i.length-1;return i[o]}const RCe={type:"spring",stiffness:500,damping:25,restSpeed:10},ACe=e=>({type:"spring",stiffness:550,damping:e===0?2*Math.sqrt(550):30,restSpeed:10}),OCe={type:"keyframes",duration:.8},DCe={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},PCe=(e,{keyframes:t})=>t.length>2?OCe:Dp.has(e)?e.startsWith("scale")?ACe(t[1]):RCe:DCe;function NCe({when:e,delay:t,delayChildren:n,staggerChildren:r,staggerDirection:i,repeat:o,repeatType:a,repeatDelay:c,from:u,elapsed:d,...h}){return!!Object.keys(h).length}const bD=(e,t,n,r={},i,o)=>a=>{const c=oD(r,e)||{},u=c.delay||r.delay||0;let{elapsed:d=0}=r;d=d-Ca(u);const h={keyframes:Array.isArray(n)?n:[null,n],ease:"easeOut",velocity:t.getVelocity(),...c,delay:-d,onUpdate:g=>{t.set(g),c.onUpdate&&c.onUpdate(g)},onComplete:()=>{a(),c.onComplete&&c.onComplete()},name:e,motionValue:t,element:o?void 0:i};NCe(c)||Object.assign(h,PCe(e,h)),h.duration&&(h.duration=Ca(h.duration)),h.repeatDelay&&(h.repeatDelay=Ca(h.repeatDelay)),h.from!==void 0&&(h.keyframes[0]=h.from);let p=!1;if((h.type===!1||h.duration===0&&!h.repeatDelay)&&(GC(h),h.delay===0&&(p=!0)),(Pl.instantAnimations||Pl.skipAnimations)&&(p=!0,GC(h),h.delay=0),h.allowFlatten=!c.type&&!c.ease,p&&!o&&t.get()!==void 0){const g=MCe(h.keyframes,c);if(g!==void 0){Xn.update(()=>{h.onUpdate(g),h.onComplete()});return}}return c.isSync?new rD(h):new tTe(h)};function LCe({protectedKeys:e,needsAnimating:t},n){const r=e.hasOwnProperty(n)&&t[n]!==!0;return t[n]=!1,r}function iG(e,t,{delay:n=0,transitionOverride:r,type:i}={}){let{transition:o=e.getDefaultTransition(),transitionEnd:a,...c}=t;r&&(o=r);const u=[],d=i&&e.animationState&&e.animationState.getState()[i];for(const h in c){const p=e.getValue(h,e.latestValues[h]??null),g=c[h];if(g===void 0||d&&LCe(d,h))continue;const y={delay:n,...oD(o||{},h)},b=p.get();if(b!==void 0&&!p.isAnimating&&!Array.isArray(g)&&g===b&&!y.velocity)continue;let S=!1;if(window.MotionHandoffAnimation){const x=rG(e);if(x){const I=window.MotionHandoffAnimation(x,h,Xn);I!==null&&(y.startTime=I,S=!0)}}tM(e,h),p.start(bD(h,p,g,e.shouldReduceMotion&&_8.has(h)?{type:!1}:y,e,S));const w=p.animation;w&&u.push(w)}return a&&Promise.all(u).then(()=>{Xn.update(()=>{a&&ECe(e,a)})}),u}function oG(e,t,n,r=0,i=1){const o=Array.from(e).sort((d,h)=>d.sortNodePosition(h)).indexOf(t),a=e.size,c=(a-1)*r;return typeof n=="function"?n(o,a):i===1?o*r:c-o*r}function nM(e,t,n={}){const r=Sh(e,t,n.type==="exit"?e.presenceContext?.custom:void 0);let{transition:i=e.getDefaultTransition()||{}}=r||{};n.transitionOverride&&(i=n.transitionOverride);const o=r?()=>Promise.all(iG(e,r,n)):()=>Promise.resolve(),a=e.variantChildren&&e.variantChildren.size?(u=0)=>{const{delayChildren:d=0,staggerChildren:h,staggerDirection:p}=i;return $Ce(e,t,u,d,h,p,n)}:()=>Promise.resolve(),{when:c}=i;if(c){const[u,d]=c==="beforeChildren"?[o,a]:[a,o];return u().then(()=>d())}else return Promise.all([o(),a(n.delay)])}function $Ce(e,t,n=0,r=0,i=0,o=1,a){const c=[];for(const u of e.variantChildren)u.notify("AnimationStart",t),c.push(nM(u,t,{...a,delay:n+(typeof r=="function"?0:r)+oG(e.variantChildren,u,r,i,o)}).then(()=>u.notify("AnimationComplete",t)));return Promise.all(c)}function jCe(e,t,n={}){e.notify("AnimationStart",t);let r;if(Array.isArray(t)){const i=t.map(o=>nM(e,o,n));r=Promise.all(i)}else if(typeof t=="string")r=nM(e,t,n);else{const i=typeof t=="function"?Sh(e,t,n.custom):t;r=Promise.all(iG(e,i,n))}return r.then(()=>{e.notify("AnimationComplete",t)})}function sG(e,t){if(!Array.isArray(t))return!1;const n=t.length;if(n!==e.length)return!1;for(let r=0;r<n;r++)if(t[r]!==e[r])return!1;return!0}const FCe=dD.length;function aG(e){if(!e)return;if(!e.isControllingVariants){const n=e.parent?aG(e.parent)||{}:{};return e.props.initial!==void 0&&(n.initial=e.props.initial),n}const t={};for(let n=0;n<FCe;n++){const r=dD[n],i=e.props[r];(wy(i)||i===!1)&&(t[r]=i)}return t}const zCe=[...uD].reverse(),BCe=uD.length;function qCe(e){return t=>Promise.all(t.map(({animation:n,options:r})=>jCe(e,n,r)))}function UCe(e){let t=qCe(e),n=VB(),r=!0;const i=u=>(d,h)=>{const p=Sh(e,h,u==="exit"?e.presenceContext?.custom:void 0);if(p){const{transition:g,transitionEnd:y,...b}=p;d={...d,...b,...y}}return d};function o(u){t=u(e)}function a(u){const{props:d}=e,h=aG(e.parent)||{},p=[],g=new Set;let y={},b=1/0;for(let w=0;w<BCe;w++){const x=zCe[w],I=n[x],_=d[x]!==void 0?d[x]:h[x],M=wy(_),C=x===u?I.isActive:null;C===!1&&(b=w);let E=_===h[x]&&_!==d[x]&&M;if(E&&r&&e.manuallyAnimateOnMount&&(E=!1),I.protectedKeys={...y},!I.isActive&&C===null||!_&&!I.prevProp||wk(_)||typeof _=="boolean")continue;const T=VCe(I.prevProp,_);let A=T||x===u&&I.isActive&&!E&&M||w>b&&M,U=!1;const R=Array.isArray(_)?_:[_];let N=R.reduce(i(x),{});C===!1&&(N={});const{prevResolvedValues:L={}}=I,B={...L,...N},j=K=>{A=!0,g.has(K)&&(U=!0,g.delete(K)),I.needsAnimating[K]=!0;const W=e.getValue(K);W&&(W.liveStyle=!1)};for(const K in B){const W=N[K],X=L[K];if(y.hasOwnProperty(K))continue;let V=!1;eM(W)&&eM(X)?V=!sG(W,X):V=W!==X,V?W!=null?j(K):g.add(K):W!==void 0&&g.has(K)?j(K):I.protectedKeys[K]=!0}I.prevProp=_,I.prevResolvedValues=N,I.isActive&&(y={...y,...N}),r&&e.blockInitialAnimation&&(A=!1);const $=E&&T;A&&(!$||U)&&p.push(...R.map(K=>{const W={type:x};if(typeof K=="string"&&r&&!$&&e.manuallyAnimateOnMount&&e.parent){const{parent:X}=e,V=Sh(X,K);if(X.enteringChildren&&V){const{delayChildren:z}=V.transition||{};W.delay=oG(X.enteringChildren,e,z)}}return{animation:K,options:W}}))}if(g.size){const w={};if(typeof d.initial!="boolean"){const x=Sh(e,Array.isArray(d.initial)?d.initial[0]:d.initial);x&&x.transition&&(w.transition=x.transition)}g.forEach(x=>{const I=e.getBaseTarget(x),_=e.getValue(x);_&&(_.liveStyle=!0),w[x]=I??null}),p.push({animation:w})}let S=!!p.length;return r&&(d.initial===!1||d.initial===d.animate)&&!e.manuallyAnimateOnMount&&(S=!1),r=!1,S?t(p):Promise.resolve()}function c(u,d){if(n[u].isActive===d)return Promise.resolve();e.variantChildren?.forEach(p=>p.animationState?.setActive(u,d)),n[u].isActive=d;const h=a(u);for(const p in n)n[p].protectedKeys={};return h}return{animateChanges:a,setActive:c,setAnimateFunction:o,getState:()=>n,reset:()=>{n=VB()}}}function VCe(e,t){return typeof t=="string"?t!==e:Array.isArray(t)?!sG(t,e):!1}function Ou(e=!1){return{isActive:e,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function VB(){return{animate:Ou(!0),whileInView:Ou(),whileHover:Ou(),whileTap:Ou(),whileDrag:Ou(),whileFocus:Ou(),exit:Ou()}}class su{constructor(t){this.isMounted=!1,this.node=t}update(){}}class KCe extends su{constructor(t){super(t),t.animationState||(t.animationState=UCe(t))}updateAnimationControlsSubscription(){const{animate:t}=this.node.getProps();wk(t)&&(this.unmountControls=t.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:t}=this.node.getProps(),{animate:n}=this.node.prevProps||{};t!==n&&this.updateAnimationControlsSubscription()}unmount(){this.node.animationState.reset(),this.unmountControls?.()}}let HCe=0;class WCe extends su{constructor(){super(...arguments),this.id=HCe++}update(){if(!this.node.presenceContext)return;const{isPresent:t,onExitComplete:n}=this.node.presenceContext,{isPresent:r}=this.node.prevPresenceContext||{};if(!this.node.animationState||t===r)return;const i=this.node.animationState.setActive("exit",!t);n&&!t&&i.then(()=>{n(this.id)})}mount(){const{register:t,onExitComplete:n}=this.node.presenceContext||{};n&&n(this.id),t&&(this.unmount=t(this.id))}unmount(){}}const GCe={animation:{Feature:KCe},exit:{Feature:WCe}};function xy(e,t,n,r={passive:!0}){return e.addEventListener(t,n,r),()=>e.removeEventListener(t,n)}function Ib(e){return{point:{x:e.pageX,y:e.pageY}}}const YCe=e=>t=>lD(t)&&e(t,Ib(t));function Cg(e,t,n,r){return xy(e,t,YCe(n),r)}const lG=1e-4,QCe=1-lG,XCe=1+lG,cG=.01,JCe=0-cG,ZCe=0+cG;function Yi(e){return e.max-e.min}function eMe(e,t,n){return Math.abs(e-t)<=n}function KB(e,t,n,r=.5){e.origin=r,e.originPoint=tr(t.min,t.max,e.origin),e.scale=Yi(n)/Yi(t),e.translate=tr(n.min,n.max,e.origin)-e.originPoint,(e.scale>=QCe&&e.scale<=XCe||isNaN(e.scale))&&(e.scale=1),(e.translate>=JCe&&e.translate<=ZCe||isNaN(e.translate))&&(e.translate=0)}function Mg(e,t,n,r){KB(e.x,t.x,n.x,r?r.originX:void 0),KB(e.y,t.y,n.y,r?r.originY:void 0)}function HB(e,t,n){e.min=n.min+t.min,e.max=e.min+Yi(t)}function tMe(e,t,n){HB(e.x,t.x,n.x),HB(e.y,t.y,n.y)}function WB(e,t,n){e.min=t.min-n.min,e.max=e.min+Yi(t)}function Pw(e,t,n){WB(e.x,t.x,n.x),WB(e.y,t.y,n.y)}function ds(e){return[e("x"),e("y")]}const uG=({current:e})=>e?e.ownerDocument.defaultView:null,GB=(e,t)=>Math.abs(e-t);function nMe(e,t){const n=GB(e.x,t.x),r=GB(e.y,t.y);return Math.sqrt(n**2+r**2)}class dG{constructor(t,n,{transformPagePoint:r,contextWindow:i=window,dragSnapToOrigin:o=!1,distanceThreshold:a=3}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const g=cE(this.lastMoveEventInfo,this.history),y=this.startEvent!==null,b=nMe(g.offset,{x:0,y:0})>=this.distanceThreshold;if(!y&&!b)return;const{point:S}=g,{timestamp:w}=gi;this.history.push({...S,timestamp:w});const{onStart:x,onMove:I}=this.handlers;y||(x&&x(this.lastMoveEvent,g),this.startEvent=this.lastMoveEvent),I&&I(this.lastMoveEvent,g)},this.handlePointerMove=(g,y)=>{this.lastMoveEvent=g,this.lastMoveEventInfo=lE(y,this.transformPagePoint),Xn.update(this.updatePoint,!0)},this.handlePointerUp=(g,y)=>{this.end();const{onEnd:b,onSessionEnd:S,resumeAnimation:w}=this.handlers;if(this.dragSnapToOrigin&&w&&w(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const x=cE(g.type==="pointercancel"?this.lastMoveEventInfo:lE(y,this.transformPagePoint),this.history);this.startEvent&&b&&b(g,x),S&&S(g,x)},!lD(t))return;this.dragSnapToOrigin=o,this.handlers=n,this.transformPagePoint=r,this.distanceThreshold=a,this.contextWindow=i||window;const c=Ib(t),u=lE(c,this.transformPagePoint),{point:d}=u,{timestamp:h}=gi;this.history=[{...d,timestamp:h}];const{onSessionStart:p}=n;p&&p(t,cE(u,this.history)),this.removeListeners=xb(Cg(this.contextWindow,"pointermove",this.handlePointerMove),Cg(this.contextWindow,"pointerup",this.handlePointerUp),Cg(this.contextWindow,"pointercancel",this.handlePointerUp))}updateHandlers(t){this.handlers=t}end(){this.removeListeners&&this.removeListeners(),Wc(this.updatePoint)}}function lE(e,t){return t?{point:t(e.point)}:e}function YB(e,t){return{x:e.x-t.x,y:e.y-t.y}}function cE({point:e},t){return{point:e,delta:YB(e,fG(t)),offset:YB(e,rMe(t)),velocity:iMe(t,.1)}}function rMe(e){return e[0]}function fG(e){return e[e.length-1]}function iMe(e,t){if(e.length<2)return{x:0,y:0};let n=e.length-1,r=null;const i=fG(e);for(;n>=0&&(r=e[n],!(i.timestamp-r.timestamp>Ca(t)));)n--;if(!r)return{x:0,y:0};const o=vs(i.timestamp-r.timestamp);if(o===0)return{x:0,y:0};const a={x:(i.x-r.x)/o,y:(i.y-r.y)/o};return a.x===1/0&&(a.x=0),a.y===1/0&&(a.y=0),a}function oMe(e,{min:t,max:n},r){return t!==void 0&&e<t?e=r?tr(t,e,r.min):Math.max(e,t):n!==void 0&&e>n&&(e=r?tr(n,e,r.max):Math.min(e,n)),e}function QB(e,t,n){return{min:t!==void 0?e.min+t:void 0,max:n!==void 0?e.max+n-(e.max-e.min):void 0}}function sMe(e,{top:t,left:n,bottom:r,right:i}){return{x:QB(e.x,n,i),y:QB(e.y,t,r)}}function XB(e,t){let n=t.min-e.min,r=t.max-e.max;return t.max-t.min<e.max-e.min&&([n,r]=[r,n]),{min:n,max:r}}function aMe(e,t){return{x:XB(e.x,t.x),y:XB(e.y,t.y)}}function lMe(e,t){let n=.5;const r=Yi(e),i=Yi(t);return i>r?n=by(t.min,t.max-r,e.min):r>i&&(n=by(e.min,e.max-i,t.min)),Dl(0,1,n)}function cMe(e,t){const n={};return t.min!==void 0&&(n.min=t.min-e.min),t.max!==void 0&&(n.max=t.max-e.min),n}const rM=.35;function uMe(e=rM){return e===!1?e=0:e===!0&&(e=rM),{x:JB(e,"left","right"),y:JB(e,"top","bottom")}}function JB(e,t,n){return{min:ZB(e,t),max:ZB(e,n)}}function ZB(e,t){return typeof e=="number"?e:e[t]||0}const dMe=new WeakMap;class fMe{constructor(t){this.openDragLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=Vr(),this.latestPointerEvent=null,this.latestPanInfo=null,this.visualElement=t}start(t,{snapToCursor:n=!1,distanceThreshold:r}={}){const{presenceContext:i}=this.visualElement;if(i&&i.isPresent===!1)return;const o=p=>{const{dragSnapToOrigin:g}=this.getProps();g?this.pauseAnimation():this.stopAnimation(),n&&this.snapToCursor(Ib(p).point)},a=(p,g)=>{const{drag:y,dragPropagation:b,onDragStart:S}=this.getProps();if(y&&!b&&(this.openDragLock&&this.openDragLock(),this.openDragLock=yTe(y),!this.openDragLock))return;this.latestPointerEvent=p,this.latestPanInfo=g,this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),ds(x=>{let I=this.getAxisMotionValue(x).get()||0;if(Ma.test(I)){const{projection:_}=this.visualElement;if(_&&_.layout){const M=_.layout.layoutBox[x];M&&(I=Yi(M)*(parseFloat(I)/100))}}this.originPoint[x]=I}),S&&Xn.postRender(()=>S(p,g)),tM(this.visualElement,"transform");const{animationState:w}=this.visualElement;w&&w.setActive("whileDrag",!0)},c=(p,g)=>{this.latestPointerEvent=p,this.latestPanInfo=g;const{dragPropagation:y,dragDirectionLock:b,onDirectionLock:S,onDrag:w}=this.getProps();if(!y&&!this.openDragLock)return;const{offset:x}=g;if(b&&this.currentDirection===null){this.currentDirection=hMe(x),this.currentDirection!==null&&S&&S(this.currentDirection);return}this.updateAxis("x",g.point,x),this.updateAxis("y",g.point,x),this.visualElement.render(),w&&w(p,g)},u=(p,g)=>{this.latestPointerEvent=p,this.latestPanInfo=g,this.stop(p,g),this.latestPointerEvent=null,this.latestPanInfo=null},d=()=>ds(p=>this.getAnimationState(p)==="paused"&&this.getAxisMotionValue(p).animation?.play()),{dragSnapToOrigin:h}=this.getProps();this.panSession=new dG(t,{onSessionStart:o,onStart:a,onMove:c,onSessionEnd:u,resumeAnimation:d},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:h,distanceThreshold:r,contextWindow:uG(this.visualElement)})}stop(t,n){const r=t||this.latestPointerEvent,i=n||this.latestPanInfo,o=this.isDragging;if(this.cancel(),!o||!i||!r)return;const{velocity:a}=i;this.startAnimation(a);const{onDragEnd:c}=this.getProps();c&&Xn.postRender(()=>c(r,i))}cancel(){this.isDragging=!1;const{projection:t,animationState:n}=this.visualElement;t&&(t.isAnimationBlocked=!1),this.panSession&&this.panSession.end(),this.panSession=void 0;const{dragPropagation:r}=this.getProps();!r&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),n&&n.setActive("whileDrag",!1)}updateAxis(t,n,r){const{drag:i}=this.getProps();if(!r||!IS(t,i,this.currentDirection))return;const o=this.getAxisMotionValue(t);let a=this.originPoint[t]+r[t];this.constraints&&this.constraints[t]&&(a=oMe(a,this.constraints[t],this.elastic[t])),o.set(a)}resolveConstraints(){const{dragConstraints:t,dragElastic:n}=this.getProps(),r=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):this.visualElement.projection?.layout,i=this.constraints;t&&ih(t)?this.constraints||(this.constraints=this.resolveRefConstraints()):t&&r?this.constraints=sMe(r.layoutBox,t):this.constraints=!1,this.elastic=uMe(n),i!==this.constraints&&r&&this.constraints&&!this.hasMutatedConstraints&&ds(o=>{this.constraints!==!1&&this.getAxisMotionValue(o)&&(this.constraints[o]=cMe(r.layoutBox[o],this.constraints[o]))})}resolveRefConstraints(){const{dragConstraints:t,onMeasureDragConstraints:n}=this.getProps();if(!t||!ih(t))return!1;const r=t.current,{projection:i}=this.visualElement;if(!i||!i.layout)return!1;const o=pCe(r,i.root,this.visualElement.getTransformPagePoint());let a=aMe(i.layout.layoutBox,o);if(n){const c=n(dCe(a));this.hasMutatedConstraints=!!c,c&&(a=Y8(c))}return a}startAnimation(t){const{drag:n,dragMomentum:r,dragElastic:i,dragTransition:o,dragSnapToOrigin:a,onDragTransitionEnd:c}=this.getProps(),u=this.constraints||{},d=ds(h=>{if(!IS(h,n,this.currentDirection))return;let p=u&&u[h]||{};a&&(p={min:0,max:0});const g=i?200:1e6,y=i?40:1e7,b={type:"inertia",velocity:r?t[h]:0,bounceStiffness:g,bounceDamping:y,timeConstant:750,restDelta:1,restSpeed:10,...o,...p};return this.startAxisValueAnimation(h,b)});return Promise.all(d).then(c)}startAxisValueAnimation(t,n){const r=this.getAxisMotionValue(t);return tM(this.visualElement,t),r.start(bD(t,r,0,n,this.visualElement,!1))}stopAnimation(){ds(t=>this.getAxisMotionValue(t).stop())}pauseAnimation(){ds(t=>this.getAxisMotionValue(t).animation?.pause())}getAnimationState(t){return this.getAxisMotionValue(t).animation?.state}getAxisMotionValue(t){const n=`_drag${t.toUpperCase()}`,r=this.visualElement.getProps(),i=r[n];return i||this.visualElement.getValue(t,(r.initial?r.initial[t]:void 0)||0)}snapToCursor(t){ds(n=>{const{drag:r}=this.getProps();if(!IS(n,r,this.currentDirection))return;const{projection:i}=this.visualElement,o=this.getAxisMotionValue(n);if(i&&i.layout){const{min:a,max:c}=i.layout.layoutBox[n];o.set(t[n]-tr(a,c,.5))}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:t,dragConstraints:n}=this.getProps(),{projection:r}=this.visualElement;if(!ih(n)||!r||!this.constraints)return;this.stopAnimation();const i={x:0,y:0};ds(a=>{const c=this.getAxisMotionValue(a);if(c&&this.constraints!==!1){const u=c.get();i[a]=lMe({min:u,max:u},this.constraints[a])}});const{transformTemplate:o}=this.visualElement.getProps();this.visualElement.current.style.transform=o?o({},""):"none",r.root&&r.root.updateScroll(),r.updateLayout(),this.resolveConstraints(),ds(a=>{if(!IS(a,t,null))return;const c=this.getAxisMotionValue(a),{min:u,max:d}=this.constraints[a];c.set(tr(u,d,i[a]))})}addListeners(){if(!this.visualElement.current)return;dMe.set(this.visualElement,this);const t=this.visualElement.current,n=Cg(t,"pointerdown",u=>{const{drag:d,dragListener:h=!0}=this.getProps();d&&h&&this.start(u)}),r=()=>{const{dragConstraints:u}=this.getProps();ih(u)&&u.current&&(this.constraints=this.resolveRefConstraints())},{projection:i}=this.visualElement,o=i.addEventListener("measure",r);i&&!i.layout&&(i.root&&i.root.updateScroll(),i.updateLayout()),Xn.read(r);const a=xy(window,"resize",()=>this.scalePositionWithinConstraints()),c=i.addEventListener("didUpdate",(({delta:u,hasLayoutChanged:d})=>{this.isDragging&&d&&(ds(h=>{const p=this.getAxisMotionValue(h);p&&(this.originPoint[h]+=u[h].translate,p.set(p.get()+u[h].translate))}),this.visualElement.render())}));return()=>{a(),n(),o(),c&&c()}}getProps(){const t=this.visualElement.getProps(),{drag:n=!1,dragDirectionLock:r=!1,dragPropagation:i=!1,dragConstraints:o=!1,dragElastic:a=rM,dragMomentum:c=!0}=t;return{...t,drag:n,dragDirectionLock:r,dragPropagation:i,dragConstraints:o,dragElastic:a,dragMomentum:c}}}function IS(e,t,n){return(t===!0||t===e)&&(n===null||n===e)}function hMe(e,t=10){let n=null;return Math.abs(e.y)>t?n="y":Math.abs(e.x)>t&&(n="x"),n}class pMe extends su{constructor(t){super(t),this.removeGroupControls=ws,this.removeListeners=ws,this.controls=new fMe(t)}mount(){const{dragControls:t}=this.node.getProps();t&&(this.removeGroupControls=t.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||ws}unmount(){this.removeGroupControls(),this.removeListeners()}}const e3=e=>(t,n)=>{e&&Xn.postRender(()=>e(t,n))};class mMe extends su{constructor(){super(...arguments),this.removePointerDownListener=ws}onPointerDown(t){this.session=new dG(t,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:uG(this.node)})}createPanHandlers(){const{onPanSessionStart:t,onPanStart:n,onPan:r,onPanEnd:i}=this.node.getProps();return{onSessionStart:e3(t),onStart:e3(n),onMove:r,onEnd:(o,a)=>{delete this.session,i&&Xn.postRender(()=>i(o,a))}}}mount(){this.removePointerDownListener=Cg(this.node.current,"pointerdown",t=>this.onPointerDown(t))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}const b0={hasAnimatedSinceResize:!0,hasEverUpdated:!1};let uE=!1;class gMe extends D.Component{componentDidMount(){const{visualElement:t,layoutGroup:n,switchLayoutGroup:r,layoutId:i}=this.props,{projection:o}=t;o&&(n.group&&n.group.add(o),r&&r.register&&i&&r.register(o),uE&&o.root.didUpdate(),o.addEventListener("animationComplete",()=>{this.safeToRemove()}),o.setOptions({...o.options,onExitComplete:()=>this.safeToRemove()})),b0.hasEverUpdated=!0}getSnapshotBeforeUpdate(t){const{layoutDependency:n,visualElement:r,drag:i,isPresent:o}=this.props,{projection:a}=r;return a&&(a.isPresent=o,uE=!0,i||t.layoutDependency!==n||n===void 0||t.isPresent!==o?a.willUpdate():this.safeToRemove(),t.isPresent!==o&&(o?a.promote():a.relegate()||Xn.postRender(()=>{const c=a.getStack();(!c||!c.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{projection:t}=this.props.visualElement;t&&(t.root.didUpdate(),aD.postRender(()=>{!t.currentAnimation&&t.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:t,layoutGroup:n,switchLayoutGroup:r}=this.props,{projection:i}=t;uE=!0,i&&(i.scheduleCheckAfterUnmount(),n&&n.group&&n.group.remove(i),r&&r.deregister&&r.deregister(i))}safeToRemove(){const{safeToRemove:t}=this.props;t&&t()}render(){return null}}function hG(e){const[t,n]=N8(),r=D.useContext(zO);return P.jsx(gMe,{...e,layoutGroup:r,switchLayoutGroup:D.useContext(W8),isPresent:t,safeToRemove:n})}function yMe(e,t,n){const r=Oi(e)?e:Jh(e);return r.start(bD("",r,t,n)),r.animation}const bMe=(e,t)=>e.depth-t.depth;class vMe{constructor(){this.children=[],this.isDirty=!1}add(t){UO(this.children,t),this.isDirty=!0}remove(t){VO(this.children,t),this.isDirty=!0}forEach(t){this.isDirty&&this.children.sort(bMe),this.isDirty=!1,this.children.forEach(t)}}function SMe(e,t){const n=fo.now(),r=({timestamp:i})=>{const o=i-n;o>=t&&(Wc(r),e(o-t))};return Xn.setup(r,!0),()=>Wc(r)}const pG=["TopLeft","TopRight","BottomLeft","BottomRight"],wMe=pG.length,t3=e=>typeof e=="string"?parseFloat(e):e,n3=e=>typeof e=="number"||pt.test(e);function xMe(e,t,n,r,i,o){i?(e.opacity=tr(0,n.opacity??1,kMe(r)),e.opacityExit=tr(t.opacity??1,0,_Me(r))):o&&(e.opacity=tr(t.opacity??1,n.opacity??1,r));for(let a=0;a<wMe;a++){const c=`border${pG[a]}Radius`;let u=r3(t,c),d=r3(n,c);if(u===void 0&&d===void 0)continue;u||(u=0),d||(d=0),u===0||d===0||n3(u)===n3(d)?(e[c]=Math.max(tr(t3(u),t3(d),r),0),(Ma.test(d)||Ma.test(u))&&(e[c]+="%")):e[c]=d}(t.rotate||n.rotate)&&(e.rotate=tr(t.rotate||0,n.rotate||0,r))}function r3(e,t){return e[t]!==void 0?e[t]:e.borderRadius}const kMe=mG(0,.5,e8),_Me=mG(.5,.95,ws);function mG(e,t,n){return r=>r<e?0:r>t?1:n(by(e,t,r))}function i3(e,t){e.min=t.min,e.max=t.max}function Os(e,t){i3(e.x,t.x),i3(e.y,t.y)}function o3(e,t){e.translate=t.translate,e.scale=t.scale,e.originPoint=t.originPoint,e.origin=t.origin}function s3(e,t,n,r,i){return e-=t,e=Dw(e,1/n,r),i!==void 0&&(e=Dw(e,1/i,r)),e}function IMe(e,t=0,n=1,r=.5,i,o=e,a=e){if(Ma.test(t)&&(t=parseFloat(t),t=tr(a.min,a.max,t/100)-a.min),typeof t!="number")return;let c=tr(o.min,o.max,r);e===o&&(c-=t),e.min=s3(e.min,t,n,c,i),e.max=s3(e.max,t,n,c,i)}function a3(e,t,[n,r,i],o,a){IMe(e,t[n],t[r],t[i],t.scale,o,a)}const EMe=["x","scaleX","originX"],TMe=["y","scaleY","originY"];function l3(e,t,n,r){a3(e.x,t,EMe,n?n.x:void 0,r?r.x:void 0),a3(e.y,t,TMe,n?n.y:void 0,r?r.y:void 0)}function c3(e){return e.translate===0&&e.scale===1}function gG(e){return c3(e.x)&&c3(e.y)}function u3(e,t){return e.min===t.min&&e.max===t.max}function CMe(e,t){return u3(e.x,t.x)&&u3(e.y,t.y)}function d3(e,t){return Math.round(e.min)===Math.round(t.min)&&Math.round(e.max)===Math.round(t.max)}function yG(e,t){return d3(e.x,t.x)&&d3(e.y,t.y)}function f3(e){return Yi(e.x)/Yi(e.y)}function h3(e,t){return e.translate===t.translate&&e.scale===t.scale&&e.originPoint===t.originPoint}class MMe{constructor(){this.members=[]}add(t){UO(this.members,t),t.scheduleRender()}remove(t){if(VO(this.members,t),t===this.prevLead&&(this.prevLead=void 0),t===this.lead){const n=this.members[this.members.length-1];n&&this.promote(n)}}relegate(t){const n=this.members.findIndex(i=>t===i);if(n===0)return!1;let r;for(let i=n;i>=0;i--){const o=this.members[i];if(o.isPresent!==!1){r=o;break}}return r?(this.promote(r),!0):!1}promote(t,n){const r=this.lead;if(t!==r&&(this.prevLead=r,this.lead=t,t.show(),r)){r.instance&&r.scheduleRender(),t.scheduleRender(),t.resumeFrom=r,n&&(t.resumeFrom.preserveOpacity=!0),r.snapshot&&(t.snapshot=r.snapshot,t.snapshot.latestValues=r.animationValues||r.latestValues),t.root&&t.root.isUpdating&&(t.isLayoutDirty=!0);const{crossfade:i}=t.options;i===!1&&r.hide()}}exitAnimationComplete(){this.members.forEach(t=>{const{options:n,resumingFrom:r}=t;n.onExitComplete&&n.onExitComplete(),r&&r.options.onExitComplete&&r.options.onExitComplete()})}scheduleRender(){this.members.forEach(t=>{t.instance&&t.scheduleRender(!1)})}removeLeadSnapshot(){this.lead&&this.lead.snapshot&&(this.lead.snapshot=void 0)}}function RMe(e,t,n){let r="";const i=e.x.translate/t.x,o=e.y.translate/t.y,a=n?.z||0;if((i||o||a)&&(r=`translate3d(${i}px, ${o}px, ${a}px) `),(t.x!==1||t.y!==1)&&(r+=`scale(${1/t.x}, ${1/t.y}) `),n){const{transformPerspective:d,rotate:h,rotateX:p,rotateY:g,skewX:y,skewY:b}=n;d&&(r=`perspective(${d}px) ${r}`),h&&(r+=`rotate(${h}deg) `),p&&(r+=`rotateX(${p}deg) `),g&&(r+=`rotateY(${g}deg) `),y&&(r+=`skewX(${y}deg) `),b&&(r+=`skewY(${b}deg) `)}const c=e.x.scale*t.x,u=e.y.scale*t.y;return(c!==1||u!==1)&&(r+=`scale(${c}, ${u})`),r||"none"}const dE=["","X","Y","Z"],AMe=1e3;let OMe=0;function fE(e,t,n,r){const{latestValues:i}=t;i[e]&&(n[e]=i[e],t.setStaticValue(e,0),r&&(r[e]=0))}function bG(e){if(e.hasCheckedOptimisedAppear=!0,e.root===e)return;const{visualElement:t}=e.options;if(!t)return;const n=rG(t);if(window.MotionHasOptimisedAnimation(n,"transform")){const{layout:i,layoutId:o}=e.options;window.MotionCancelOptimisedAnimation(n,"transform",Xn,!(i||o))}const{parent:r}=e;r&&!r.hasCheckedOptimisedAppear&&bG(r)}function vG({attachResizeListener:e,defaultParent:t,measureScroll:n,checkIsScrollRoot:r,resetTransform:i}){return class{constructor(a={},c=t?.()){this.id=OMe++,this.animationId=0,this.animationCommitId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.hasCheckedOptimisedAppear=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.layoutVersion=0,this.updateScheduled=!1,this.scheduleUpdate=()=>this.update(),this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,this.nodes.forEach(NMe),this.nodes.forEach(FMe),this.nodes.forEach(zMe),this.nodes.forEach(LMe)},this.resolvedRelativeTargetAt=0,this.linkedParentVersion=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=a,this.root=c?c.root||c:this,this.path=c?[...c.path,c]:[],this.parent=c,this.depth=c?c.depth+1:0;for(let u=0;u<this.path.length;u++)this.path[u].shouldResetTransform=!0;this.root===this&&(this.nodes=new vMe)}addEventListener(a,c){return this.eventHandlers.has(a)||this.eventHandlers.set(a,new WO),this.eventHandlers.get(a).add(c)}notifyListeners(a,...c){const u=this.eventHandlers.get(a);u&&u.notify(...c)}hasListeners(a){return this.eventHandlers.has(a)}mount(a){if(this.instance)return;this.isSVG=P8(a)&&!kTe(a),this.instance=a;const{layoutId:c,layout:u,visualElement:d}=this.options;if(d&&!d.current&&d.mount(a),this.root.nodes.add(this),this.parent&&this.parent.children.add(this),this.root.hasTreeAnimated&&(u||c)&&(this.isLayoutDirty=!0),e){let h,p=0;const g=()=>this.root.updateBlockedByResize=!1;Xn.read(()=>{p=window.innerWidth}),e(a,()=>{const y=window.innerWidth;y!==p&&(p=y,this.root.updateBlockedByResize=!0,h&&h(),h=SMe(g,250),b0.hasAnimatedSinceResize&&(b0.hasAnimatedSinceResize=!1,this.nodes.forEach(g3)))})}c&&this.root.registerSharedNode(c,this),this.options.animate!==!1&&d&&(c||u)&&this.addEventListener("didUpdate",({delta:h,hasLayoutChanged:p,hasRelativeLayoutChanged:g,layout:y})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const b=this.options.transition||d.getDefaultTransition()||KMe,{onLayoutAnimationStart:S,onLayoutAnimationComplete:w}=d.getProps(),x=!this.targetLayout||!yG(this.targetLayout,y),I=!p&&g;if(this.options.layoutRoot||this.resumeFrom||I||p&&(x||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0);const _={...oD(b,"layout"),onPlay:S,onComplete:w};(d.shouldReduceMotion||this.options.layoutRoot)&&(_.delay=0,_.type=!1),this.startAnimation(_),this.setAnimationOrigin(h,I)}else p||g3(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=y})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const a=this.getStack();a&&a.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,this.eventHandlers.clear(),Wc(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}isTreeAnimationBlocked(){return this.isAnimationBlocked||this.parent&&this.parent.isTreeAnimationBlocked()||!1}startUpdate(){this.isUpdateBlocked()||(this.isUpdating=!0,this.nodes&&this.nodes.forEach(BMe),this.animationId++)}getTransformTemplate(){const{visualElement:a}=this.options;return a&&a.getProps().transformTemplate}willUpdate(a=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&bG(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let h=0;h<this.path.length;h++){const p=this.path[h];p.shouldResetTransform=!0,p.updateScroll("snapshot"),p.options.layoutRoot&&p.willUpdate(!1)}const{layoutId:c,layout:u}=this.options;if(c===void 0&&!u)return;const d=this.getTransformTemplate();this.prevTransformTemplateValue=d?d(this.latestValues,""):void 0,this.updateSnapshot(),a&&this.notifyListeners("willUpdate")}update(){if(this.updateScheduled=!1,this.isUpdateBlocked()){this.unblockUpdate(),this.clearAllSnapshots(),this.nodes.forEach(p3);return}if(this.animationId<=this.animationCommitId){this.nodes.forEach(m3);return}this.animationCommitId=this.animationId,this.isUpdating?(this.isUpdating=!1,this.nodes.forEach(jMe),this.nodes.forEach(DMe),this.nodes.forEach(PMe)):this.nodes.forEach(m3),this.clearAllSnapshots();const c=fo.now();gi.delta=Dl(0,1e3/60,c-gi.timestamp),gi.timestamp=c,gi.isProcessing=!0,eE.update.process(gi),eE.preRender.process(gi),eE.render.process(gi),gi.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,aD.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach($Me),this.sharedNodes.forEach(qMe)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,Xn.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){Xn.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure(),this.snapshot&&!Yi(this.snapshot.measuredBox.x)&&!Yi(this.snapshot.measuredBox.y)&&(this.snapshot=void 0))}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let u=0;u<this.path.length;u++)this.path[u].updateScroll();const a=this.layout;this.layout=this.measure(!1),this.layoutVersion++,this.layoutCorrected=Vr(),this.isLayoutDirty=!1,this.projectionDelta=void 0,this.notifyListeners("measure",this.layout.layoutBox);const{visualElement:c}=this.options;c&&c.notify("LayoutMeasure",this.layout.layoutBox,a?a.layoutBox:void 0)}updateScroll(a="measure"){let c=!!(this.options.layoutScroll&&this.instance);if(this.scroll&&this.scroll.animationId===this.root.animationId&&this.scroll.phase===a&&(c=!1),c&&this.instance){const u=r(this.instance);this.scroll={animationId:this.root.animationId,phase:a,isRoot:u,offset:n(this.instance),wasRoot:this.scroll?this.scroll.isRoot:u}}}resetTransform(){if(!i)return;const a=this.isLayoutDirty||this.shouldResetTransform||this.options.alwaysMeasureLayout,c=this.projectionDelta&&!gG(this.projectionDelta),u=this.getTransformTemplate(),d=u?u(this.latestValues,""):void 0,h=d!==this.prevTransformTemplateValue;a&&this.instance&&(c||$u(this.latestValues)||h)&&(i(this.instance,d),this.shouldResetTransform=!1,this.scheduleRender())}measure(a=!0){const c=this.measurePageBox();let u=this.removeElementScroll(c);return a&&(u=this.removeTransform(u)),HMe(u),{animationId:this.root.animationId,measuredBox:c,layoutBox:u,latestValues:{},source:this.id}}measurePageBox(){const{visualElement:a}=this.options;if(!a)return Vr();const c=a.measureViewportBox();if(!(this.scroll?.wasRoot||this.path.some(WMe))){const{scroll:d}=this.root;d&&(oh(c.x,d.offset.x),oh(c.y,d.offset.y))}return c}removeElementScroll(a){const c=Vr();if(Os(c,a),this.scroll?.wasRoot)return c;for(let u=0;u<this.path.length;u++){const d=this.path[u],{scroll:h,options:p}=d;d!==this.root&&h&&p.layoutScroll&&(h.wasRoot&&Os(c,a),oh(c.x,h.offset.x),oh(c.y,h.offset.y))}return c}applyTransform(a,c=!1){const u=Vr();Os(u,a);for(let d=0;d<this.path.length;d++){const h=this.path[d];!c&&h.options.layoutScroll&&h.scroll&&h!==h.root&&sh(u,{x:-h.scroll.offset.x,y:-h.scroll.offset.y}),$u(h.latestValues)&&sh(u,h.latestValues)}return $u(this.latestValues)&&sh(u,this.latestValues),u}removeTransform(a){const c=Vr();Os(c,a);for(let u=0;u<this.path.length;u++){const d=this.path[u];if(!d.instance||!$u(d.latestValues))continue;XC(d.latestValues)&&d.updateSnapshot();const h=Vr(),p=d.measurePageBox();Os(h,p),l3(c,d.latestValues,d.snapshot?d.snapshot.layoutBox:void 0,h)}return $u(this.latestValues)&&l3(c,this.latestValues),c}setTargetDelta(a){this.targetDelta=a,this.root.scheduleUpdateProjection(),this.isProjectionDirty=!0}setOptions(a){this.options={...this.options,...a,crossfade:a.crossfade!==void 0?a.crossfade:!0}}clearMeasurements(){this.scroll=void 0,this.layout=void 0,this.snapshot=void 0,this.prevTransformTemplateValue=void 0,this.targetDelta=void 0,this.target=void 0,this.isLayoutDirty=!1}forceRelativeParentToResolveTarget(){this.relativeParent&&this.relativeParent.resolvedRelativeTargetAt!==gi.timestamp&&this.relativeParent.resolveTargetDelta(!0)}resolveTargetDelta(a=!1){const c=this.getLead();this.isProjectionDirty||(this.isProjectionDirty=c.isProjectionDirty),this.isTransformDirty||(this.isTransformDirty=c.isTransformDirty),this.isSharedProjectionDirty||(this.isSharedProjectionDirty=c.isSharedProjectionDirty);const u=!!this.resumingFrom||this!==c;if(!(a||u&&this.isSharedProjectionDirty||this.isProjectionDirty||this.parent?.isProjectionDirty||this.attemptToResolveRelativeTarget||this.root.updateBlockedByResize))return;const{layout:h,layoutId:p}=this.options;if(!this.layout||!(h||p))return;this.resolvedRelativeTargetAt=gi.timestamp;const g=this.getClosestProjectingParent();g&&this.linkedParentVersion!==g.layoutVersion&&!g.options.layoutRoot&&this.removeRelativeTarget(),!this.targetDelta&&!this.relativeTarget&&(g&&g.layout?this.createRelativeTarget(g,this.layout.layoutBox,g.layout.layoutBox):this.removeRelativeTarget()),!(!this.relativeTarget&&!this.targetDelta)&&(this.target||(this.target=Vr(),this.targetWithTransforms=Vr()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),tMe(this.target,this.relativeTarget,this.relativeParent.target)):this.targetDelta?(this.resumingFrom?this.target=this.applyTransform(this.layout.layoutBox):Os(this.target,this.layout.layoutBox),X8(this.target,this.targetDelta)):Os(this.target,this.layout.layoutBox),this.attemptToResolveRelativeTarget&&(this.attemptToResolveRelativeTarget=!1,g&&!!g.resumingFrom==!!this.resumingFrom&&!g.options.layoutScroll&&g.target&&this.animationProgress!==1?this.createRelativeTarget(g,this.target,g.target):this.relativeParent=this.relativeTarget=void 0))}getClosestProjectingParent(){if(!(!this.parent||XC(this.parent.latestValues)||Q8(this.parent.latestValues)))return this.parent.isProjecting()?this.parent:this.parent.getClosestProjectingParent()}isProjecting(){return!!((this.relativeTarget||this.targetDelta||this.options.layoutRoot)&&this.layout)}createRelativeTarget(a,c,u){this.relativeParent=a,this.linkedParentVersion=a.layoutVersion,this.forceRelativeParentToResolveTarget(),this.relativeTarget=Vr(),this.relativeTargetOrigin=Vr(),Pw(this.relativeTargetOrigin,c,u),Os(this.relativeTarget,this.relativeTargetOrigin)}removeRelativeTarget(){this.relativeParent=this.relativeTarget=void 0}calcProjection(){const a=this.getLead(),c=!!this.resumingFrom||this!==a;let u=!0;if((this.isProjectionDirty||this.parent?.isProjectionDirty)&&(u=!1),c&&(this.isSharedProjectionDirty||this.isTransformDirty)&&(u=!1),this.resolvedRelativeTargetAt===gi.timestamp&&(u=!1),u)return;const{layout:d,layoutId:h}=this.options;if(this.isTreeAnimating=!!(this.parent&&this.parent.isTreeAnimating||this.currentAnimation||this.pendingAnimation),this.isTreeAnimating||(this.targetDelta=this.relativeTarget=void 0),!this.layout||!(d||h))return;Os(this.layoutCorrected,this.layout.layoutBox);const p=this.treeScale.x,g=this.treeScale.y;hCe(this.layoutCorrected,this.treeScale,this.path,c),a.layout&&!a.target&&(this.treeScale.x!==1||this.treeScale.y!==1)&&(a.target=a.layout.layoutBox,a.targetWithTransforms=Vr());const{target:y}=a;if(!y){this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender());return}!this.projectionDelta||!this.prevProjectionDelta?this.createProjectionDeltas():(o3(this.prevProjectionDelta.x,this.projectionDelta.x),o3(this.prevProjectionDelta.y,this.projectionDelta.y)),Mg(this.projectionDelta,this.layoutCorrected,y,this.latestValues),(this.treeScale.x!==p||this.treeScale.y!==g||!h3(this.projectionDelta.x,this.prevProjectionDelta.x)||!h3(this.projectionDelta.y,this.prevProjectionDelta.y))&&(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners("projectionUpdate",y))}hide(){this.isVisible=!1}show(){this.isVisible=!0}scheduleRender(a=!0){if(this.options.visualElement?.scheduleRender(),a){const c=this.getStack();c&&c.scheduleRender()}this.resumingFrom&&!this.resumingFrom.instance&&(this.resumingFrom=void 0)}createProjectionDeltas(){this.prevProjectionDelta=ah(),this.projectionDelta=ah(),this.projectionDeltaWithTransform=ah()}setAnimationOrigin(a,c=!1){const u=this.snapshot,d=u?u.latestValues:{},h={...this.latestValues},p=ah();(!this.relativeParent||!this.relativeParent.options.layoutRoot)&&(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!c;const g=Vr(),y=u?u.source:void 0,b=this.layout?this.layout.source:void 0,S=y!==b,w=this.getStack(),x=!w||w.members.length<=1,I=!!(S&&!x&&this.options.crossfade===!0&&!this.path.some(VMe));this.animationProgress=0;let _;this.mixTargetDelta=M=>{const C=M/1e3;y3(p.x,a.x,C),y3(p.y,a.y,C),this.setTargetDelta(p),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(Pw(g,this.layout.layoutBox,this.relativeParent.layout.layoutBox),UMe(this.relativeTarget,this.relativeTargetOrigin,g,C),_&&CMe(this.relativeTarget,_)&&(this.isProjectionDirty=!1),_||(_=Vr()),Os(_,this.relativeTarget)),S&&(this.animationValues=h,xMe(h,d,this.latestValues,C,I,x)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=C},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(a){this.notifyListeners("animationStart"),this.currentAnimation?.stop(),this.resumingFrom?.currentAnimation?.stop(),this.pendingAnimation&&(Wc(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=Xn.update(()=>{b0.hasAnimatedSinceResize=!0,this.motionValue||(this.motionValue=Jh(0)),this.currentAnimation=yMe(this.motionValue,[0,1e3],{...a,velocity:0,isSync:!0,onUpdate:c=>{this.mixTargetDelta(c),a.onUpdate&&a.onUpdate(c)},onStop:()=>{},onComplete:()=>{a.onComplete&&a.onComplete(),this.completeAnimation()}}),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);const a=this.getStack();a&&a.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(AMe),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const a=this.getLead();let{targetWithTransforms:c,target:u,layout:d,latestValues:h}=a;if(!(!c||!u||!d)){if(this!==a&&this.layout&&d&&SG(this.options.animationType,this.layout.layoutBox,d.layoutBox)){u=this.target||Vr();const p=Yi(this.layout.layoutBox.x);u.x.min=a.target.x.min,u.x.max=u.x.min+p;const g=Yi(this.layout.layoutBox.y);u.y.min=a.target.y.min,u.y.max=u.y.min+g}Os(c,u),sh(c,h),Mg(this.projectionDeltaWithTransform,this.layoutCorrected,c,h)}}registerSharedNode(a,c){this.sharedNodes.has(a)||this.sharedNodes.set(a,new MMe),this.sharedNodes.get(a).add(c);const d=c.options.initialPromotionConfig;c.promote({transition:d?d.transition:void 0,preserveFollowOpacity:d&&d.shouldPreserveFollowOpacity?d.shouldPreserveFollowOpacity(c):void 0})}isLead(){const a=this.getStack();return a?a.lead===this:!0}getLead(){const{layoutId:a}=this.options;return a?this.getStack()?.lead||this:this}getPrevLead(){const{layoutId:a}=this.options;return a?this.getStack()?.prevLead:void 0}getStack(){const{layoutId:a}=this.options;if(a)return this.root.sharedNodes.get(a)}promote({needsReset:a,transition:c,preserveFollowOpacity:u}={}){const d=this.getStack();d&&d.promote(this,u),a&&(this.projectionDelta=void 0,this.needsReset=!0),c&&this.setOptions({transition:c})}relegate(){const a=this.getStack();return a?a.relegate(this):!1}resetSkewAndRotation(){const{visualElement:a}=this.options;if(!a)return;let c=!1;const{latestValues:u}=a;if((u.z||u.rotate||u.rotateX||u.rotateY||u.rotateZ||u.skewX||u.skewY)&&(c=!0),!c)return;const d={};u.z&&fE("z",a,d,this.animationValues);for(let h=0;h<dE.length;h++)fE(`rotate${dE[h]}`,a,d,this.animationValues),fE(`skew${dE[h]}`,a,d,this.animationValues);a.render();for(const h in d)a.setStaticValue(h,d[h]),this.animationValues&&(this.animationValues[h]=d[h]);a.scheduleRender()}applyProjectionStyles(a,c){if(!this.instance||this.isSVG)return;if(!this.isVisible){a.visibility="hidden";return}const u=this.getTransformTemplate();if(this.needsReset){this.needsReset=!1,a.visibility="",a.opacity="",a.pointerEvents=y0(c?.pointerEvents)||"",a.transform=u?u(this.latestValues,""):"none";return}const d=this.getLead();if(!this.projectionDelta||!this.layout||!d.target){this.options.layoutId&&(a.opacity=this.latestValues.opacity!==void 0?this.latestValues.opacity:1,a.pointerEvents=y0(c?.pointerEvents)||""),this.hasProjected&&!$u(this.latestValues)&&(a.transform=u?u({},""):"none",this.hasProjected=!1);return}a.visibility="";const h=d.animationValues||d.latestValues;this.applyTransformsToTarget();let p=RMe(this.projectionDeltaWithTransform,this.treeScale,h);u&&(p=u(h,p)),a.transform=p;const{x:g,y}=this.projectionDelta;a.transformOrigin=`${g.origin*100}% ${y.origin*100}% 0`,d.animationValues?a.opacity=d===this?h.opacity??this.latestValues.opacity??1:this.preserveOpacity?this.latestValues.opacity:h.opacityExit:a.opacity=d===this?h.opacity!==void 0?h.opacity:"":h.opacityExit!==void 0?h.opacityExit:0;for(const b in QC){if(h[b]===void 0)continue;const{correct:S,applyTo:w,isCSSVariable:x}=QC[b],I=p==="none"?h[b]:S(h[b],d);if(w){const _=w.length;for(let M=0;M<_;M++)a[w[M]]=I}else x?this.options.visualElement.renderState.vars[b]=I:a[b]=I}this.options.layoutId&&(a.pointerEvents=d===this?y0(c?.pointerEvents)||"":"none")}clearSnapshot(){this.resumeFrom=this.snapshot=void 0}resetTree(){this.root.nodes.forEach(a=>a.currentAnimation?.stop()),this.root.nodes.forEach(p3),this.root.sharedNodes.clear()}}}function DMe(e){e.updateLayout()}function PMe(e){const t=e.resumeFrom?.snapshot||e.snapshot;if(e.isLead()&&e.layout&&t&&e.hasListeners("didUpdate")){const{layoutBox:n,measuredBox:r}=e.layout,{animationType:i}=e.options,o=t.source!==e.layout.source;i==="size"?ds(h=>{const p=o?t.measuredBox[h]:t.layoutBox[h],g=Yi(p);p.min=n[h].min,p.max=p.min+g}):SG(i,t.layoutBox,n)&&ds(h=>{const p=o?t.measuredBox[h]:t.layoutBox[h],g=Yi(n[h]);p.max=p.min+g,e.relativeTarget&&!e.currentAnimation&&(e.isProjectionDirty=!0,e.relativeTarget[h].max=e.relativeTarget[h].min+g)});const a=ah();Mg(a,n,t.layoutBox);const c=ah();o?Mg(c,e.applyTransform(r,!0),t.measuredBox):Mg(c,n,t.layoutBox);const u=!gG(a);let d=!1;if(!e.resumeFrom){const h=e.getClosestProjectingParent();if(h&&!h.resumeFrom){const{snapshot:p,layout:g}=h;if(p&&g){const y=Vr();Pw(y,t.layoutBox,p.layoutBox);const b=Vr();Pw(b,n,g.layoutBox),yG(y,b)||(d=!0),h.options.layoutRoot&&(e.relativeTarget=b,e.relativeTargetOrigin=y,e.relativeParent=h)}}}e.notifyListeners("didUpdate",{layout:n,snapshot:t,delta:c,layoutDelta:a,hasLayoutChanged:u,hasRelativeLayoutChanged:d})}else if(e.isLead()){const{onExitComplete:n}=e.options;n&&n()}e.options.transition=void 0}function NMe(e){e.parent&&(e.isProjecting()||(e.isProjectionDirty=e.parent.isProjectionDirty),e.isSharedProjectionDirty||(e.isSharedProjectionDirty=!!(e.isProjectionDirty||e.parent.isProjectionDirty||e.parent.isSharedProjectionDirty)),e.isTransformDirty||(e.isTransformDirty=e.parent.isTransformDirty))}function LMe(e){e.isProjectionDirty=e.isSharedProjectionDirty=e.isTransformDirty=!1}function $Me(e){e.clearSnapshot()}function p3(e){e.clearMeasurements()}function m3(e){e.isLayoutDirty=!1}function jMe(e){const{visualElement:t}=e.options;t&&t.getProps().onBeforeLayoutMeasure&&t.notify("BeforeLayoutMeasure"),e.resetTransform()}function g3(e){e.finishAnimation(),e.targetDelta=e.relativeTarget=e.target=void 0,e.isProjectionDirty=!0}function FMe(e){e.resolveTargetDelta()}function zMe(e){e.calcProjection()}function BMe(e){e.resetSkewAndRotation()}function qMe(e){e.removeLeadSnapshot()}function y3(e,t,n){e.translate=tr(t.translate,0,n),e.scale=tr(t.scale,1,n),e.origin=t.origin,e.originPoint=t.originPoint}function b3(e,t,n,r){e.min=tr(t.min,n.min,r),e.max=tr(t.max,n.max,r)}function UMe(e,t,n,r){b3(e.x,t.x,n.x,r),b3(e.y,t.y,n.y,r)}function VMe(e){return e.animationValues&&e.animationValues.opacityExit!==void 0}const KMe={duration:.45,ease:[.4,0,.1,1]},v3=e=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(e),S3=v3("applewebkit/")&&!v3("chrome/")?Math.round:ws;function w3(e){e.min=S3(e.min),e.max=S3(e.max)}function HMe(e){w3(e.x),w3(e.y)}function SG(e,t,n){return e==="position"||e==="preserve-aspect"&&!eMe(f3(t),f3(n),.2)}function WMe(e){return e!==e.root&&e.scroll?.wasRoot}const GMe=vG({attachResizeListener:(e,t)=>xy(e,"resize",t),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body.scrollLeft,y:document.documentElement.scrollTop||document.body.scrollTop}),checkIsScrollRoot:()=>!0}),hE={current:void 0},wG=vG({measureScroll:e=>({x:e.scrollLeft,y:e.scrollTop}),defaultParent:()=>{if(!hE.current){const e=new GMe({});e.mount(window),e.setOptions({layoutScroll:!0}),hE.current=e}return hE.current},resetTransform:(e,t)=>{e.style.transform=t!==void 0?t:"none"},checkIsScrollRoot:e=>window.getComputedStyle(e).position==="fixed"}),YMe={pan:{Feature:mMe},drag:{Feature:pMe,ProjectionNode:wG,MeasureLayout:hG}};function x3(e,t,n){const{props:r}=e;e.animationState&&r.whileHover&&e.animationState.setActive("whileHover",n==="Start");const i="onHover"+n,o=r[i];o&&Xn.postRender(()=>o(t,Ib(t)))}class QMe extends su{mount(){const{current:t}=this.node;t&&(this.unmount=bTe(t,(n,r)=>(x3(this.node,r,"Start"),i=>x3(this.node,i,"End"))))}unmount(){}}class XMe extends su{constructor(){super(...arguments),this.isActive=!1}onFocus(){let t=!1;try{t=this.node.current.matches(":focus-visible")}catch{t=!0}!t||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!0),this.isActive=!0)}onBlur(){!this.isActive||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!1),this.isActive=!1)}mount(){this.unmount=xb(xy(this.node.current,"focus",()=>this.onFocus()),xy(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}function k3(e,t,n){const{props:r}=e;if(e.current instanceof HTMLButtonElement&&e.current.disabled)return;e.animationState&&r.whileTap&&e.animationState.setActive("whileTap",n==="Start");const i="onTap"+(n==="End"?"":n),o=r[i];o&&Xn.postRender(()=>o(t,Ib(t)))}class JMe extends su{mount(){const{current:t}=this.node;t&&(this.unmount=xTe(t,(n,r)=>(k3(this.node,r,"Start"),(i,{success:o})=>k3(this.node,i,o?"End":"Cancel")),{useGlobalTarget:this.node.props.globalTapTarget}))}unmount(){}}const iM=new WeakMap,pE=new WeakMap,ZMe=e=>{const t=iM.get(e.target);t&&t(e)},eRe=e=>{e.forEach(ZMe)};function tRe({root:e,...t}){const n=e||document;pE.has(n)||pE.set(n,{});const r=pE.get(n),i=JSON.stringify(t);return r[i]||(r[i]=new IntersectionObserver(eRe,{root:e,...t})),r[i]}function nRe(e,t,n){const r=tRe(t);return iM.set(e,n),r.observe(e),()=>{iM.delete(e),r.unobserve(e)}}const rRe={some:0,all:1};class iRe extends su{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.unmount();const{viewport:t={}}=this.node.getProps(),{root:n,margin:r,amount:i="some",once:o}=t,a={root:n?n.current:void 0,rootMargin:r,threshold:typeof i=="number"?i:rRe[i]},c=u=>{const{isIntersecting:d}=u;if(this.isInView===d||(this.isInView=d,o&&!d&&this.hasEnteredView))return;d&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",d);const{onViewportEnter:h,onViewportLeave:p}=this.node.getProps(),g=d?h:p;g&&g(u)};return nRe(this.node.current,a,c)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:t,prevProps:n}=this.node;["amount","margin","root"].some(oRe(t,n))&&this.startObserver()}unmount(){}}function oRe({viewport:e={}},{viewport:t={}}={}){return n=>e[n]!==t[n]}const sRe={inView:{Feature:iRe},tap:{Feature:JMe},focus:{Feature:XMe},hover:{Feature:QMe}},aRe={layout:{ProjectionNode:wG,MeasureLayout:hG}},lRe={...GCe,...sRe,...YMe,...aRe},Nw=uCe(lRe,kCe);function xG(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e)){var i=e.length;for(t=0;t<i;t++)e[t]&&(n=xG(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function kG(){for(var e,t,n=0,r="",i=arguments.length;n<i;n++)(e=arguments[n])&&(t=xG(e))&&(r&&(r+=" "),r+=t);return r}const _3=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,I3=kG,vD=(e,t)=>n=>{var r;if(t?.variants==null)return I3(e,n?.class,n?.className);const{variants:i,defaultVariants:o}=t,a=Object.keys(i).map(d=>{const h=n?.[d],p=o?.[d];if(h===null)return null;const g=_3(h)||_3(p);return i[d][g]}),c=n&&Object.entries(n).reduce((d,h)=>{let[p,g]=h;return g===void 0||(d[p]=g),d},{}),u=t==null||(r=t.compoundVariants)===null||r===void 0?void 0:r.reduce((d,h)=>{let{class:p,className:g,...y}=h;return Object.entries(y).every(b=>{let[S,w]=b;return Array.isArray(w)?w.includes({...o,...c}[S]):{...o,...c}[S]===w})?[...d,p,g]:d},[]);return I3(e,a,u,n?.class,n?.className)},cRe=(e,t)=>{const n=new Array(e.length+t.length);for(let r=0;r<e.length;r++)n[r]=e[r];for(let r=0;r<t.length;r++)n[e.length+r]=t[r];return n},uRe=(e,t)=>({classGroupId:e,validator:t}),_G=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),Lw="-",E3=[],dRe="arbitrary..",fRe=e=>{const t=pRe(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:a=>{if(a.startsWith("[")&&a.endsWith("]"))return hRe(a);const c=a.split(Lw),u=c[0]===""&&c.length>1?1:0;return IG(c,u,t)},getConflictingClassGroupIds:(a,c)=>{if(c){const u=r[a],d=n[a];return u?d?cRe(d,u):u:d||E3}return n[a]||E3}}},IG=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;const i=e[t],o=n.nextPart.get(i);if(o){const d=IG(e,t+1,o);if(d)return d}const a=n.validators;if(a===null)return;const c=t===0?e.join(Lw):e.slice(t).join(Lw),u=a.length;for(let d=0;d<u;d++){const h=a[d];if(h.validator(c))return h.classGroupId}},hRe=e=>e.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const t=e.slice(1,-1),n=t.indexOf(":"),r=t.slice(0,n);return r?dRe+r:void 0})(),pRe=e=>{const{theme:t,classGroups:n}=e;return mRe(n,t)},mRe=(e,t)=>{const n=_G();for(const r in e){const i=e[r];SD(i,n,r,t)}return n},SD=(e,t,n,r)=>{const i=e.length;for(let o=0;o<i;o++){const a=e[o];gRe(a,t,n,r)}},gRe=(e,t,n,r)=>{if(typeof e=="string"){yRe(e,t,n);return}if(typeof e=="function"){bRe(e,t,n,r);return}vRe(e,t,n,r)},yRe=(e,t,n)=>{const r=e===""?t:EG(t,e);r.classGroupId=n},bRe=(e,t,n,r)=>{if(SRe(e)){SD(e(r),t,n,r);return}t.validators===null&&(t.validators=[]),t.validators.push(uRe(n,e))},vRe=(e,t,n,r)=>{const i=Object.entries(e),o=i.length;for(let a=0;a<o;a++){const[c,u]=i[a];SD(u,EG(t,c),n,r)}},EG=(e,t)=>{let n=e;const r=t.split(Lw),i=r.length;for(let o=0;o<i;o++){const a=r[o];let c=n.nextPart.get(a);c||(c=_G(),n.nextPart.set(a,c)),n=c}return n},SRe=e=>"isThemeGetter"in e&&e.isThemeGetter===!0,wRe=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=Object.create(null),r=Object.create(null);const i=(o,a)=>{n[o]=a,t++,t>e&&(t=0,r=n,n=Object.create(null))};return{get(o){let a=n[o];if(a!==void 0)return a;if((a=r[o])!==void 0)return i(o,a),a},set(o,a){o in n?n[o]=a:i(o,a)}}},oM="!",T3=":",xRe=[],C3=(e,t,n,r,i)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:r,isExternal:i}),kRe=e=>{const{prefix:t,experimentalParseClassName:n}=e;let r=i=>{const o=[];let a=0,c=0,u=0,d;const h=i.length;for(let S=0;S<h;S++){const w=i[S];if(a===0&&c===0){if(w===T3){o.push(i.slice(u,S)),u=S+1;continue}if(w==="/"){d=S;continue}}w==="["?a++:w==="]"?a--:w==="("?c++:w===")"&&c--}const p=o.length===0?i:i.slice(u);let g=p,y=!1;p.endsWith(oM)?(g=p.slice(0,-1),y=!0):p.startsWith(oM)&&(g=p.slice(1),y=!0);const b=d&&d>u?d-u:void 0;return C3(o,y,g,b)};if(t){const i=t+T3,o=r;r=a=>a.startsWith(i)?o(a.slice(i.length)):C3(xRe,!1,a,void 0,!0)}if(n){const i=r;r=o=>n({className:o,parseClassName:i})}return r},_Re=e=>{const t=new Map;return e.orderSensitiveModifiers.forEach((n,r)=>{t.set(n,1e6+r)}),n=>{const r=[];let i=[];for(let o=0;o<n.length;o++){const a=n[o],c=a[0]==="[",u=t.has(a);c||u?(i.length>0&&(i.sort(),r.push(...i),i=[]),r.push(a)):i.push(a)}return i.length>0&&(i.sort(),r.push(...i)),r}},IRe=e=>({cache:wRe(e.cacheSize),parseClassName:kRe(e),sortModifiers:_Re(e),...fRe(e)}),ERe=/\s+/,TRe=(e,t)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:i,sortModifiers:o}=t,a=[],c=e.trim().split(ERe);let u="";for(let d=c.length-1;d>=0;d-=1){const h=c[d],{isExternal:p,modifiers:g,hasImportantModifier:y,baseClassName:b,maybePostfixModifierPosition:S}=n(h);if(p){u=h+(u.length>0?" "+u:u);continue}let w=!!S,x=r(w?b.substring(0,S):b);if(!x){if(!w){u=h+(u.length>0?" "+u:u);continue}if(x=r(b),!x){u=h+(u.length>0?" "+u:u);continue}w=!1}const I=g.length===0?"":g.length===1?g[0]:o(g).join(":"),_=y?I+oM:I,M=_+x;if(a.indexOf(M)>-1)continue;a.push(M);const C=i(x,w);for(let E=0;E<C.length;++E){const T=C[E];a.push(_+T)}u=h+(u.length>0?" "+u:u)}return u},CRe=(...e)=>{let t=0,n,r,i="";for(;t<e.length;)(n=e[t++])&&(r=TG(n))&&(i&&(i+=" "),i+=r);return i},TG=e=>{if(typeof e=="string")return e;let t,n="";for(let r=0;r<e.length;r++)e[r]&&(t=TG(e[r]))&&(n&&(n+=" "),n+=t);return n},MRe=(e,...t)=>{let n,r,i,o;const a=u=>{const d=t.reduce((h,p)=>p(h),e());return n=IRe(d),r=n.cache.get,i=n.cache.set,o=c,c(u)},c=u=>{const d=r(u);if(d)return d;const h=TRe(u,n);return i(u,h),h};return o=a,(...u)=>o(CRe(...u))},RRe=[],Ur=e=>{const t=n=>n[e]||RRe;return t.isThemeGetter=!0,t},CG=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,MG=/^\((?:(\w[\w-]*):)?(.+)\)$/i,ARe=/^\d+\/\d+$/,ORe=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,DRe=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,PRe=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,NRe=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,LRe=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,qf=e=>ARe.test(e),Pt=e=>!!e&&!Number.isNaN(Number(e)),gc=e=>!!e&&Number.isInteger(Number(e)),mE=e=>e.endsWith("%")&&Pt(e.slice(0,-1)),ll=e=>ORe.test(e),$Re=()=>!0,jRe=e=>DRe.test(e)&&!PRe.test(e),RG=()=>!1,FRe=e=>NRe.test(e),zRe=e=>LRe.test(e),BRe=e=>!Be(e)&&!qe(e),qRe=e=>Pp(e,DG,RG),Be=e=>CG.test(e),Du=e=>Pp(e,PG,jRe),gE=e=>Pp(e,WRe,Pt),M3=e=>Pp(e,AG,RG),URe=e=>Pp(e,OG,zRe),ES=e=>Pp(e,NG,FRe),qe=e=>MG.test(e),Vm=e=>Np(e,PG),VRe=e=>Np(e,GRe),R3=e=>Np(e,AG),KRe=e=>Np(e,DG),HRe=e=>Np(e,OG),TS=e=>Np(e,NG,!0),Pp=(e,t,n)=>{const r=CG.exec(e);return r?r[1]?t(r[1]):n(r[2]):!1},Np=(e,t,n=!1)=>{const r=MG.exec(e);return r?r[1]?t(r[1]):n:!1},AG=e=>e==="position"||e==="percentage",OG=e=>e==="image"||e==="url",DG=e=>e==="length"||e==="size"||e==="bg-size",PG=e=>e==="length",WRe=e=>e==="number",GRe=e=>e==="family-name",NG=e=>e==="shadow",YRe=()=>{const e=Ur("color"),t=Ur("font"),n=Ur("text"),r=Ur("font-weight"),i=Ur("tracking"),o=Ur("leading"),a=Ur("breakpoint"),c=Ur("container"),u=Ur("spacing"),d=Ur("radius"),h=Ur("shadow"),p=Ur("inset-shadow"),g=Ur("text-shadow"),y=Ur("drop-shadow"),b=Ur("blur"),S=Ur("perspective"),w=Ur("aspect"),x=Ur("ease"),I=Ur("animate"),_=()=>["auto","avoid","all","avoid-page","page","left","right","column"],M=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],C=()=>[...M(),qe,Be],E=()=>["auto","hidden","clip","visible","scroll"],T=()=>["auto","contain","none"],A=()=>[qe,Be,u],U=()=>[qf,"full","auto",...A()],R=()=>[gc,"none","subgrid",qe,Be],N=()=>["auto",{span:["full",gc,qe,Be]},gc,qe,Be],L=()=>[gc,"auto",qe,Be],B=()=>["auto","min","max","fr",qe,Be],j=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],$=()=>["start","end","center","stretch","center-safe","end-safe"],F=()=>["auto",...A()],K=()=>[qf,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...A()],W=()=>[e,qe,Be],X=()=>[...M(),R3,M3,{position:[qe,Be]}],V=()=>["no-repeat",{repeat:["","x","y","space","round"]}],z=()=>["auto","cover","contain",KRe,qRe,{size:[qe,Be]}],Q=()=>[mE,Vm,Du],q=()=>["","none","full",d,qe,Be],ie=()=>["",Pt,Vm,Du],le=()=>["solid","dashed","dotted","double"],ee=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],J=()=>[Pt,mE,R3,M3],ge=()=>["","none",b,qe,Be],te=()=>["none",Pt,qe,Be],pe=()=>["none",Pt,qe,Be],oe=()=>[Pt,qe,Be],ye=()=>[qf,"full",...A()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[ll],breakpoint:[ll],color:[$Re],container:[ll],"drop-shadow":[ll],ease:["in","out","in-out"],font:[BRe],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[ll],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[ll],shadow:[ll],spacing:["px",Pt],text:[ll],"text-shadow":[ll],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",qf,Be,qe,w]}],container:["container"],columns:[{columns:[Pt,Be,qe,c]}],"break-after":[{"break-after":_()}],"break-before":[{"break-before":_()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:C()}],overflow:[{overflow:E()}],"overflow-x":[{"overflow-x":E()}],"overflow-y":[{"overflow-y":E()}],overscroll:[{overscroll:T()}],"overscroll-x":[{"overscroll-x":T()}],"overscroll-y":[{"overscroll-y":T()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:U()}],"inset-x":[{"inset-x":U()}],"inset-y":[{"inset-y":U()}],start:[{start:U()}],end:[{end:U()}],top:[{top:U()}],right:[{right:U()}],bottom:[{bottom:U()}],left:[{left:U()}],visibility:["visible","invisible","collapse"],z:[{z:[gc,"auto",qe,Be]}],basis:[{basis:[qf,"full","auto",c,...A()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[Pt,qf,"auto","initial","none",Be]}],grow:[{grow:["",Pt,qe,Be]}],shrink:[{shrink:["",Pt,qe,Be]}],order:[{order:[gc,"first","last","none",qe,Be]}],"grid-cols":[{"grid-cols":R()}],"col-start-end":[{col:N()}],"col-start":[{"col-start":L()}],"col-end":[{"col-end":L()}],"grid-rows":[{"grid-rows":R()}],"row-start-end":[{row:N()}],"row-start":[{"row-start":L()}],"row-end":[{"row-end":L()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":B()}],"auto-rows":[{"auto-rows":B()}],gap:[{gap:A()}],"gap-x":[{"gap-x":A()}],"gap-y":[{"gap-y":A()}],"justify-content":[{justify:[...j(),"normal"]}],"justify-items":[{"justify-items":[...$(),"normal"]}],"justify-self":[{"justify-self":["auto",...$()]}],"align-content":[{content:["normal",...j()]}],"align-items":[{items:[...$(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...$(),{baseline:["","last"]}]}],"place-content":[{"place-content":j()}],"place-items":[{"place-items":[...$(),"baseline"]}],"place-self":[{"place-self":["auto",...$()]}],p:[{p:A()}],px:[{px:A()}],py:[{py:A()}],ps:[{ps:A()}],pe:[{pe:A()}],pt:[{pt:A()}],pr:[{pr:A()}],pb:[{pb:A()}],pl:[{pl:A()}],m:[{m:F()}],mx:[{mx:F()}],my:[{my:F()}],ms:[{ms:F()}],me:[{me:F()}],mt:[{mt:F()}],mr:[{mr:F()}],mb:[{mb:F()}],ml:[{ml:F()}],"space-x":[{"space-x":A()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":A()}],"space-y-reverse":["space-y-reverse"],size:[{size:K()}],w:[{w:[c,"screen",...K()]}],"min-w":[{"min-w":[c,"screen","none",...K()]}],"max-w":[{"max-w":[c,"screen","none","prose",{screen:[a]},...K()]}],h:[{h:["screen","lh",...K()]}],"min-h":[{"min-h":["screen","lh","none",...K()]}],"max-h":[{"max-h":["screen","lh",...K()]}],"font-size":[{text:["base",n,Vm,Du]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[r,qe,gE]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",mE,Be]}],"font-family":[{font:[VRe,Be,t]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[i,qe,Be]}],"line-clamp":[{"line-clamp":[Pt,"none",qe,gE]}],leading:[{leading:[o,...A()]}],"list-image":[{"list-image":["none",qe,Be]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",qe,Be]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:W()}],"text-color":[{text:W()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...le(),"wavy"]}],"text-decoration-thickness":[{decoration:[Pt,"from-font","auto",qe,Du]}],"text-decoration-color":[{decoration:W()}],"underline-offset":[{"underline-offset":[Pt,"auto",qe,Be]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:A()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",qe,Be]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",qe,Be]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:X()}],"bg-repeat":[{bg:V()}],"bg-size":[{bg:z()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},gc,qe,Be],radial:["",qe,Be],conic:[gc,qe,Be]},HRe,URe]}],"bg-color":[{bg:W()}],"gradient-from-pos":[{from:Q()}],"gradient-via-pos":[{via:Q()}],"gradient-to-pos":[{to:Q()}],"gradient-from":[{from:W()}],"gradient-via":[{via:W()}],"gradient-to":[{to:W()}],rounded:[{rounded:q()}],"rounded-s":[{"rounded-s":q()}],"rounded-e":[{"rounded-e":q()}],"rounded-t":[{"rounded-t":q()}],"rounded-r":[{"rounded-r":q()}],"rounded-b":[{"rounded-b":q()}],"rounded-l":[{"rounded-l":q()}],"rounded-ss":[{"rounded-ss":q()}],"rounded-se":[{"rounded-se":q()}],"rounded-ee":[{"rounded-ee":q()}],"rounded-es":[{"rounded-es":q()}],"rounded-tl":[{"rounded-tl":q()}],"rounded-tr":[{"rounded-tr":q()}],"rounded-br":[{"rounded-br":q()}],"rounded-bl":[{"rounded-bl":q()}],"border-w":[{border:ie()}],"border-w-x":[{"border-x":ie()}],"border-w-y":[{"border-y":ie()}],"border-w-s":[{"border-s":ie()}],"border-w-e":[{"border-e":ie()}],"border-w-t":[{"border-t":ie()}],"border-w-r":[{"border-r":ie()}],"border-w-b":[{"border-b":ie()}],"border-w-l":[{"border-l":ie()}],"divide-x":[{"divide-x":ie()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":ie()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...le(),"hidden","none"]}],"divide-style":[{divide:[...le(),"hidden","none"]}],"border-color":[{border:W()}],"border-color-x":[{"border-x":W()}],"border-color-y":[{"border-y":W()}],"border-color-s":[{"border-s":W()}],"border-color-e":[{"border-e":W()}],"border-color-t":[{"border-t":W()}],"border-color-r":[{"border-r":W()}],"border-color-b":[{"border-b":W()}],"border-color-l":[{"border-l":W()}],"divide-color":[{divide:W()}],"outline-style":[{outline:[...le(),"none","hidden"]}],"outline-offset":[{"outline-offset":[Pt,qe,Be]}],"outline-w":[{outline:["",Pt,Vm,Du]}],"outline-color":[{outline:W()}],shadow:[{shadow:["","none",h,TS,ES]}],"shadow-color":[{shadow:W()}],"inset-shadow":[{"inset-shadow":["none",p,TS,ES]}],"inset-shadow-color":[{"inset-shadow":W()}],"ring-w":[{ring:ie()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:W()}],"ring-offset-w":[{"ring-offset":[Pt,Du]}],"ring-offset-color":[{"ring-offset":W()}],"inset-ring-w":[{"inset-ring":ie()}],"inset-ring-color":[{"inset-ring":W()}],"text-shadow":[{"text-shadow":["none",g,TS,ES]}],"text-shadow-color":[{"text-shadow":W()}],opacity:[{opacity:[Pt,qe,Be]}],"mix-blend":[{"mix-blend":[...ee(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":ee()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[Pt]}],"mask-image-linear-from-pos":[{"mask-linear-from":J()}],"mask-image-linear-to-pos":[{"mask-linear-to":J()}],"mask-image-linear-from-color":[{"mask-linear-from":W()}],"mask-image-linear-to-color":[{"mask-linear-to":W()}],"mask-image-t-from-pos":[{"mask-t-from":J()}],"mask-image-t-to-pos":[{"mask-t-to":J()}],"mask-image-t-from-color":[{"mask-t-from":W()}],"mask-image-t-to-color":[{"mask-t-to":W()}],"mask-image-r-from-pos":[{"mask-r-from":J()}],"mask-image-r-to-pos":[{"mask-r-to":J()}],"mask-image-r-from-color":[{"mask-r-from":W()}],"mask-image-r-to-color":[{"mask-r-to":W()}],"mask-image-b-from-pos":[{"mask-b-from":J()}],"mask-image-b-to-pos":[{"mask-b-to":J()}],"mask-image-b-from-color":[{"mask-b-from":W()}],"mask-image-b-to-color":[{"mask-b-to":W()}],"mask-image-l-from-pos":[{"mask-l-from":J()}],"mask-image-l-to-pos":[{"mask-l-to":J()}],"mask-image-l-from-color":[{"mask-l-from":W()}],"mask-image-l-to-color":[{"mask-l-to":W()}],"mask-image-x-from-pos":[{"mask-x-from":J()}],"mask-image-x-to-pos":[{"mask-x-to":J()}],"mask-image-x-from-color":[{"mask-x-from":W()}],"mask-image-x-to-color":[{"mask-x-to":W()}],"mask-image-y-from-pos":[{"mask-y-from":J()}],"mask-image-y-to-pos":[{"mask-y-to":J()}],"mask-image-y-from-color":[{"mask-y-from":W()}],"mask-image-y-to-color":[{"mask-y-to":W()}],"mask-image-radial":[{"mask-radial":[qe,Be]}],"mask-image-radial-from-pos":[{"mask-radial-from":J()}],"mask-image-radial-to-pos":[{"mask-radial-to":J()}],"mask-image-radial-from-color":[{"mask-radial-from":W()}],"mask-image-radial-to-color":[{"mask-radial-to":W()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":M()}],"mask-image-conic-pos":[{"mask-conic":[Pt]}],"mask-image-conic-from-pos":[{"mask-conic-from":J()}],"mask-image-conic-to-pos":[{"mask-conic-to":J()}],"mask-image-conic-from-color":[{"mask-conic-from":W()}],"mask-image-conic-to-color":[{"mask-conic-to":W()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:X()}],"mask-repeat":[{mask:V()}],"mask-size":[{mask:z()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",qe,Be]}],filter:[{filter:["","none",qe,Be]}],blur:[{blur:ge()}],brightness:[{brightness:[Pt,qe,Be]}],contrast:[{contrast:[Pt,qe,Be]}],"drop-shadow":[{"drop-shadow":["","none",y,TS,ES]}],"drop-shadow-color":[{"drop-shadow":W()}],grayscale:[{grayscale:["",Pt,qe,Be]}],"hue-rotate":[{"hue-rotate":[Pt,qe,Be]}],invert:[{invert:["",Pt,qe,Be]}],saturate:[{saturate:[Pt,qe,Be]}],sepia:[{sepia:["",Pt,qe,Be]}],"backdrop-filter":[{"backdrop-filter":["","none",qe,Be]}],"backdrop-blur":[{"backdrop-blur":ge()}],"backdrop-brightness":[{"backdrop-brightness":[Pt,qe,Be]}],"backdrop-contrast":[{"backdrop-contrast":[Pt,qe,Be]}],"backdrop-grayscale":[{"backdrop-grayscale":["",Pt,qe,Be]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Pt,qe,Be]}],"backdrop-invert":[{"backdrop-invert":["",Pt,qe,Be]}],"backdrop-opacity":[{"backdrop-opacity":[Pt,qe,Be]}],"backdrop-saturate":[{"backdrop-saturate":[Pt,qe,Be]}],"backdrop-sepia":[{"backdrop-sepia":["",Pt,qe,Be]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":A()}],"border-spacing-x":[{"border-spacing-x":A()}],"border-spacing-y":[{"border-spacing-y":A()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",qe,Be]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[Pt,"initial",qe,Be]}],ease:[{ease:["linear","initial",x,qe,Be]}],delay:[{delay:[Pt,qe,Be]}],animate:[{animate:["none",I,qe,Be]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[S,qe,Be]}],"perspective-origin":[{"perspective-origin":C()}],rotate:[{rotate:te()}],"rotate-x":[{"rotate-x":te()}],"rotate-y":[{"rotate-y":te()}],"rotate-z":[{"rotate-z":te()}],scale:[{scale:pe()}],"scale-x":[{"scale-x":pe()}],"scale-y":[{"scale-y":pe()}],"scale-z":[{"scale-z":pe()}],"scale-3d":["scale-3d"],skew:[{skew:oe()}],"skew-x":[{"skew-x":oe()}],"skew-y":[{"skew-y":oe()}],transform:[{transform:[qe,Be,"","none","gpu","cpu"]}],"transform-origin":[{origin:C()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:ye()}],"translate-x":[{"translate-x":ye()}],"translate-y":[{"translate-y":ye()}],"translate-z":[{"translate-z":ye()}],"translate-none":["translate-none"],accent:[{accent:W()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:W()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",qe,Be]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":A()}],"scroll-mx":[{"scroll-mx":A()}],"scroll-my":[{"scroll-my":A()}],"scroll-ms":[{"scroll-ms":A()}],"scroll-me":[{"scroll-me":A()}],"scroll-mt":[{"scroll-mt":A()}],"scroll-mr":[{"scroll-mr":A()}],"scroll-mb":[{"scroll-mb":A()}],"scroll-ml":[{"scroll-ml":A()}],"scroll-p":[{"scroll-p":A()}],"scroll-px":[{"scroll-px":A()}],"scroll-py":[{"scroll-py":A()}],"scroll-ps":[{"scroll-ps":A()}],"scroll-pe":[{"scroll-pe":A()}],"scroll-pt":[{"scroll-pt":A()}],"scroll-pr":[{"scroll-pr":A()}],"scroll-pb":[{"scroll-pb":A()}],"scroll-pl":[{"scroll-pl":A()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",qe,Be]}],fill:[{fill:["none",...W()]}],"stroke-w":[{stroke:[Pt,Vm,Du,gE]}],stroke:[{stroke:["none",...W()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},QRe=MRe(YRe);function ki(...e){return QRe(kG(e))}const XRe=vD("inline-flex items-center rounded-none border border-foreground px-1.5 py-0.5 text-[11px] font-mono font-bold tracking-wider text-foreground transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",{variants:{variant:{default:"bg-secondary text-secondary-foreground border-foreground",outline:"bg-background border-foreground",info:"bg-info text-info-foreground border-foreground",warning:"bg-warning text-warning-foreground border-foreground",success:"bg-success text-success-foreground border-foreground",danger:"bg-destructive text-destructive-foreground border-destructive"}},defaultVariants:{variant:"default"}});function En({className:e,variant:t,...n}){return P.jsx("div",{className:ki(XRe({variant:t,className:e})),...n})}function sM({task:e,focused:t,onToggle:n,onOpenDetail:r}){const i=id(e),o=e.taskId??`L${e.line}`;return P.jsx(Nw.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0,scale:.98,transition:{duration:.1}},className:"group relative min-w-0 bg-background transition-all duration-200 hover:bg-muted/30",children:P.jsxs("div",{className:"flex min-w-0 items-start gap-3 p-3 border-l-4 border-transparent transition-all duration-200 group-hover:border-accent",children:[P.jsx("input",{className:"mt-1 h-4 w-4 cursor-pointer accent-primary",type:"checkbox",checked:e.checked,onChange:a=>n(a.target.checked)}),P.jsxs("button",{type:"button",className:"min-w-0 flex-1 overflow-hidden text-left outline-none focus-visible:ring-2 focus-visible:ring-ring/50",onClick:r,title:i,children:[P.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-2 text-[11px] text-muted-foreground",children:[P.jsx(En,{variant:"outline",children:o}),e.story?P.jsx(En,{variant:"info",children:e.story}):null,e.parallel?P.jsx(En,{variant:"warning",children:"P"}):null,P.jsxs("span",{className:"ml-auto font-mono opacity-70",children:["L",e.line]})]}),P.jsx("div",{className:"mt-1.5 min-w-0 break-words text-[13.5px] leading-relaxed text-foreground",children:P.jsx("span",{className:e.checked?"text-muted-foreground line-through opacity-70":void 0,children:i})})]})]})})}function $w({storyCode:e,title:t,stats:n,hint:r,tone:i="default",onOpen:o}){const c=i==="danger"?"danger":"info";return P.jsx(Nw.button,{type:"button",initial:{opacity:0},animate:{opacity:1},exit:{opacity:0,scale:.98,transition:{duration:.1}},className:"group relative block w-full outline-none bg-background transition-all duration-200 hover:bg-muted/30",onClick:o,title:t,children:P.jsxs("div",{className:"flex min-w-0 items-start gap-3 p-3 border-l-4 border-transparent transition-all duration-200 group-hover:border-accent",children:[P.jsx(En,{variant:c,className:"mt-0.5 shrink-0",children:e}),P.jsxs("div",{className:"min-w-0 flex-1 text-left",children:[P.jsxs("div",{className:"flex items-center gap-2 text-[11px] font-medium uppercase tracking-wider text-muted-foreground",children:[n?P.jsxs("span",{className:"font-mono",children:[n.done,"/",n.total]}):P.jsx("span",{children:"—"}),r?P.jsx("span",{className:"truncate opacity-70 normal-case tracking-normal",children:r}):null]}),P.jsx("div",{className:"mt-1 min-w-0 break-words text-sm font-bold font-serif leading-relaxed text-foreground",children:t}),n&&n.total>0?P.jsx("div",{className:"mt-2 flex h-1 w-24 gap-px overflow-hidden opacity-50",children:[...Array(n.total)].map((u,d)=>P.jsx("div",{className:`h-full w-full flex-1 ${d<n.done?"bg-foreground":"bg-border"}`},d))}):null]})]})})}function LG({value:e,onChange:t,size:n="md"}){const r=n==="sm"?"h-6":"h-8",i=n==="sm"?"text-[10px]":"text-xs";return P.jsx("div",{role:"tablist","aria-label":"View Mode",className:"inline-flex items-center border border-border divide-x divide-border bg-background",children:["us","task"].map(o=>{const a=e===o;return P.jsx("button",{type:"button",role:"tab","aria-selected":a,onClick:()=>t(o),className:`
106
+ ${r} px-3 min-w-[60px]
107
+ flex items-center justify-center
108
+ font-mono uppercase tracking-widest ${i}
109
+ transition-colors duration-200 outline-none focus-visible:ring-2 focus-visible:ring-ring/50
110
+ ${a?"bg-foreground text-background font-bold":"bg-background text-muted-foreground hover:bg-muted hover:text-foreground"}
111
+ `,children:o},o)})})}function A3(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function wD(...e){return t=>{let n=!1;const r=e.map(i=>{const o=A3(i,t);return!n&&typeof o=="function"&&(n=!0),o});if(n)return()=>{for(let i=0;i<r.length;i++){const o=r[i];typeof o=="function"?o():A3(e[i],null)}}}}function Tr(...e){return D.useCallback(wD(...e),e)}var JRe=Symbol.for("react.lazy"),jw=MM[" use ".trim().toString()];function ZRe(e){return typeof e=="object"&&e!==null&&"then"in e}function $G(e){return e!=null&&typeof e=="object"&&"$$typeof"in e&&e.$$typeof===JRe&&"_payload"in e&&ZRe(e._payload)}function eAe(e){const t=tAe(e),n=D.forwardRef((r,i)=>{let{children:o,...a}=r;$G(o)&&typeof jw=="function"&&(o=jw(o._payload));const c=D.Children.toArray(o),u=c.find(rAe);if(u){const d=u.props.children,h=c.map(p=>p===u?D.Children.count(d)>1?D.Children.only(null):D.isValidElement(d)?d.props.children:null:p);return P.jsx(t,{...a,ref:i,children:D.isValidElement(d)?D.cloneElement(d,void 0,h):null})}return P.jsx(t,{...a,ref:i,children:o})});return n.displayName=`${e}.Slot`,n}var jG=eAe("Slot");function tAe(e){const t=D.forwardRef((n,r)=>{let{children:i,...o}=n;if($G(i)&&typeof jw=="function"&&(i=jw(i._payload)),D.isValidElement(i)){const a=oAe(i),c=iAe(o,i.props);return i.type!==D.Fragment&&(c.ref=r?wD(r,a):a),D.cloneElement(i,c)}return D.Children.count(i)>1?D.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var nAe=Symbol("radix.slottable");function rAe(e){return D.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===nAe}function iAe(e,t){const n={...t};for(const r in t){const i=e[r],o=t[r];/^on[A-Z]/.test(r)?i&&o?n[r]=(...c)=>{const u=o(...c);return i(...c),u}:i&&(n[r]=i):r==="style"?n[r]={...i,...o}:r==="className"&&(n[r]=[i,o].filter(Boolean).join(" "))}return{...e,...n}}function oAe(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}const sAe=vD("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-none text-sm font-bold transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{default:"bg-primary text-primary-foreground border border-foreground shadow-[2px_2px_0_0_var(--foreground)] hover:translate-y-[2px] hover:translate-x-[2px] hover:shadow-none",secondary:"bg-secondary text-secondary-foreground border border-foreground shadow-[2px_2px_0_0_var(--foreground)] hover:translate-y-[2px] hover:translate-x-[2px] hover:shadow-none",outline:"bg-background text-foreground border border-foreground shadow-[2px_2px_0_0_var(--foreground)] hover:translate-y-[2px] hover:translate-x-[2px] hover:shadow-none",ghost:"hover:bg-accent text-foreground border border-transparent",destructive:"bg-destructive text-destructive-foreground border border-destructive shadow-[2px_2px_0_0_var(--foreground)] hover:translate-y-[2px] hover:translate-x-[2px] hover:shadow-none"},size:{default:"h-9 px-4 py-2",sm:"h-8 px-3 text-xs",lg:"h-10 px-6",icon:"h-9 w-9"}},defaultVariants:{variant:"default",size:"default"}}),yi=D.forwardRef(({className:e,variant:t,size:n,asChild:r=!1,...i},o)=>{const a=r?jG:"button";return P.jsx(a,{ref:o,className:ki(sAe({variant:t,size:n,className:e})),...i})});yi.displayName="Button";function aAe({spec:e,allTasks:t,tasks:n,loading:r,stories:i,loadingStories:o,viewMode:a,globalViewMode:c,hasViewModeOverride:u,focusedTaskLine:d,onToggleTask:h,onOpenTask:p,onOpenSpecDetail:g,onOpenStory:y,onChangeViewMode:b}){const S=D.useMemo(()=>{const M=`${String(e.num).padStart(3,"0")}`,C=e.title.replace(/^Feature Specification\s*[::]\s*/i,"").replace(new RegExp(`^${M}\\s*[-–—·:]\\s*`),"").trim();return{num:M,title:C||e.title}},[e.num,e.title]),w=D.useMemo(()=>{const M=n??[],C=new Map,E=[];for(const A of M){const U=A.story;if(!U){E.push(A);continue}const R=C.get(U)??[];R.push(A),C.set(U,R)}for(const A of C.values())A.sort((U,R)=>U.line-R.line);E.sort((A,U)=>A.line-U.line);const T=Array.from(C.keys()).sort((A,U)=>{const R=Number.parseInt(A.replace(/^US/,""),10),N=Number.parseInt(U.replace(/^US/,""),10);return Number.isFinite(R)&&Number.isFinite(N)?R-N:A.localeCompare(U)});return{byStory:C,storyCodes:T,unassigned:E}},[n]),x=D.useMemo(()=>{const M=[],C=new Set;for(const E of i??[])C.has(E.code)||(C.add(E.code),M.push(E.code));for(const E of w.storyCodes)C.has(E)||(C.add(E),M.push(E));return M},[i,w.storyCodes]),I=D.useMemo(()=>new Map((i??[]).map(M=>[M.code,M])),[i]),_=D.useMemo(()=>{const M=t??n??[],C=new Map;for(const T of M){const A=T.story;if(!A)continue;const U=C.get(A)??[];U.push(T),C.set(A,U)}const E=new Map;for(const[T,A]of C.entries())E.set(T,Cw(A));return E},[t,n]);return P.jsxs("div",{className:"group flex h-full w-[360px] flex-col overflow-hidden bg-background transition-all duration-500 hover:bg-muted/20",children:[P.jsxs("div",{className:"sticky top-0 z-10 border-b border-border/10 bg-background px-4 py-3 transition-colors duration-300 group-hover:bg-muted/10 relative overflow-hidden",children:[P.jsx("div",{className:"flex items-start gap-3 relative z-10",children:P.jsx("div",{className:"min-w-0 flex-1",children:P.jsxs("div",{className:"flex min-w-0 items-start gap-2",children:[P.jsx(En,{variant:"outline",className:"mt-0.5 shrink-0 font-mono text-[10px] opacity-50 group-hover:opacity-100 transition-opacity",children:S.num}),P.jsxs("div",{className:"min-w-0 flex-1",children:[P.jsx("div",{className:"break-words text-lg font-bold font-serif text-foreground/80 leading-tight line-clamp-2 transition-colors duration-300 group-hover:text-foreground pr-8",children:S.title}),P.jsx("div",{className:"mt-1 font-mono text-[10px] text-muted-foreground opacity-40 uppercase tracking-widest truncate group-hover:opacity-70 transition-opacity",children:e.id})]})]})})}),e.taskStats&&P.jsx("div",{className:`absolute top-1 right-2 pointer-events-none select-none transform rotate-12 border-2 border-double rounded-sm px-1 py-0.5 text-[9px] font-mono font-black uppercase tracking-widest transition-opacity duration-300
112
+ ${e.taskStats.todo===0?"border-success text-success opacity-80":"border-foreground/40 text-muted-foreground opacity-60 group-hover:opacity-100"}`,children:e.taskStats.todo===0?"PASSED":`${e.taskStats.done}/${e.taskStats.total}`}),P.jsxs("div",{className:"mt-3 flex items-center justify-between gap-2 border-t border-border/40 pt-2",children:[P.jsx("div",{className:"flex items-center gap-2",children:P.jsx(LG,{size:"sm",value:a,onChange:b})}),P.jsx(yi,{variant:"ghost",size:"sm",className:"h-6 px-2 text-[10px] uppercase tracking-widest font-mono text-muted-foreground hover:text-foreground",onClick:g,children:"Read Spec →"})]})]}),P.jsxs("div",{className:"relative scrollbar-none flex-1 overflow-x-hidden overflow-y-auto px-0 py-0",children:[r?P.jsx("div",{className:"absolute inset-x-0 top-0 z-20 h-0.5 w-full overflow-hidden bg-transparent",children:P.jsx("div",{className:"h-full w-full animate-indeterminate-bar bg-accent/50 origin-left"})}):null,!r&&!n?P.jsx("div",{className:"p-4 text-center text-xs font-mono text-muted-foreground uppercase tracking-widest border-b border-dashed border-border/60",children:"No Data"}):null,n||i?P.jsx("div",{className:`transition-opacity duration-200 ${r?"opacity-50 pointer-events-none grayscale":"opacity-100"}`,children:a==="task"?P.jsxs("div",{className:"flex flex-col divide-y divide-dashed divide-border/60 border-b border-dashed border-border/60",children:[n&&n.length===0?P.jsx("div",{className:"p-8 text-center text-xs font-mono text-muted-foreground uppercase tracking-widest",children:"Empty"}):null,(n??[]).map(M=>P.jsx(sM,{task:M,focused:M.line===d,onToggle:C=>h(M,C),onOpenDetail:()=>p(M)},`${e.id}:${M.line}`))]}):P.jsxs("div",{className:"flex flex-col divide-y divide-dashed divide-border/60 border-b border-dashed border-border/60",children:[x.length===0&&w.unassigned.length===0?P.jsx("div",{className:"p-8 text-center text-xs font-mono text-muted-foreground uppercase tracking-widest",children:"No Stories"}):null,x.map(M=>{const C=_.get(M),E=I.get(M)??null,T=!o&&E===null,A=E?.title??M,U=C?`Todo ${C.todo}`:null;return P.jsx($w,{storyCode:M,title:A,stats:C,hint:U,tone:T?"danger":"default",onOpen:()=>y(M)},M)}),w.unassigned.length>0?P.jsx($w,{storyCode:"—",title:"Unassigned",stats:Cw(w.unassigned),hint:null,onOpen:g}):null]})}):null]})]})}function Un(e,t,{checkForDefaultPrevented:n=!0}={}){return function(i){if(e?.(i),n===!1||!i.defaultPrevented)return t?.(i)}}function lAe(e,t){const n=D.createContext(t),r=o=>{const{children:a,...c}=o,u=D.useMemo(()=>c,Object.values(c));return P.jsx(n.Provider,{value:u,children:a})};r.displayName=e+"Provider";function i(o){const a=D.useContext(n);if(a)return a;if(t!==void 0)return t;throw new Error(`\`${o}\` must be used within \`${e}\``)}return[r,i]}function kk(e,t=[]){let n=[];function r(o,a){const c=D.createContext(a),u=n.length;n=[...n,a];const d=p=>{const{scope:g,children:y,...b}=p,S=g?.[e]?.[u]||c,w=D.useMemo(()=>b,Object.values(b));return P.jsx(S.Provider,{value:w,children:y})};d.displayName=o+"Provider";function h(p,g){const y=g?.[e]?.[u]||c,b=D.useContext(y);if(b)return b;if(a!==void 0)return a;throw new Error(`\`${p}\` must be used within \`${o}\``)}return[d,h]}const i=()=>{const o=n.map(a=>D.createContext(a));return function(c){const u=c?.[e]||o;return D.useMemo(()=>({[`__scope${e}`]:{...c,[e]:u}}),[c,u])}};return i.scopeName=e,[r,cAe(i,...t)]}function cAe(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(i=>({useScope:i(),scopeName:i.scopeName}));return function(o){const a=r.reduce((c,{useScope:u,scopeName:d})=>{const p=u(o)[`__scope${d}`];return{...c,...p}},{});return D.useMemo(()=>({[`__scope${t.scopeName}`]:a}),[a])}};return n.scopeName=t.scopeName,n}var Pi=globalThis?.document?D.useLayoutEffect:()=>{},uAe=MM[" useId ".trim().toString()]||(()=>{}),dAe=0;function wh(e){const[t,n]=D.useState(uAe());return Pi(()=>{n(r=>r??String(dAe++))},[e]),t?`radix-${t}`:""}var fAe=MM[" useInsertionEffect ".trim().toString()]||Pi;function aM({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){const[i,o,a]=hAe({defaultProp:t,onChange:n}),c=e!==void 0,u=c?e:i;{const h=D.useRef(e!==void 0);D.useEffect(()=>{const p=h.current;p!==c&&console.warn(`${r} is changing from ${p?"controlled":"uncontrolled"} to ${c?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),h.current=c},[c,r])}const d=D.useCallback(h=>{if(c){const p=pAe(h)?h(e):h;p!==e&&a.current?.(p)}else o(h)},[c,e,o,a]);return[u,d]}function hAe({defaultProp:e,onChange:t}){const[n,r]=D.useState(e),i=D.useRef(n),o=D.useRef(t);return fAe(()=>{o.current=t},[t]),D.useEffect(()=>{i.current!==n&&(o.current?.(n),i.current=n)},[n,i]),[n,r,o]}function pAe(e){return typeof e=="function"}function ky(e){const t=mAe(e),n=D.forwardRef((r,i)=>{const{children:o,...a}=r,c=D.Children.toArray(o),u=c.find(yAe);if(u){const d=u.props.children,h=c.map(p=>p===u?D.Children.count(d)>1?D.Children.only(null):D.isValidElement(d)?d.props.children:null:p);return P.jsx(t,{...a,ref:i,children:D.isValidElement(d)?D.cloneElement(d,void 0,h):null})}return P.jsx(t,{...a,ref:i,children:o})});return n.displayName=`${e}.Slot`,n}function mAe(e){const t=D.forwardRef((n,r)=>{const{children:i,...o}=n;if(D.isValidElement(i)){const a=vAe(i),c=bAe(o,i.props);return i.type!==D.Fragment&&(c.ref=r?wD(r,a):a),D.cloneElement(i,c)}return D.Children.count(i)>1?D.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var gAe=Symbol("radix.slottable");function yAe(e){return D.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===gAe}function bAe(e,t){const n={...t};for(const r in t){const i=e[r],o=t[r];/^on[A-Z]/.test(r)?i&&o?n[r]=(...c)=>{const u=o(...c);return i(...c),u}:i&&(n[r]=i):r==="style"?n[r]={...i,...o}:r==="className"&&(n[r]=[i,o].filter(Boolean).join(" "))}return{...e,...n}}function vAe(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var SAe=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],jn=SAe.reduce((e,t)=>{const n=ky(`Primitive.${t}`),r=D.forwardRef((i,o)=>{const{asChild:a,...c}=i,u=a?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),P.jsx(u,{...c,ref:o})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function wAe(e,t){e&&wb.flushSync(()=>e.dispatchEvent(t))}function Od(e){const t=D.useRef(e);return D.useEffect(()=>{t.current=e}),D.useMemo(()=>(...n)=>t.current?.(...n),[])}function xAe(e,t=globalThis?.document){const n=Od(e);D.useEffect(()=>{const r=i=>{i.key==="Escape"&&n(i)};return t.addEventListener("keydown",r,{capture:!0}),()=>t.removeEventListener("keydown",r,{capture:!0})},[n,t])}var kAe="DismissableLayer",lM="dismissableLayer.update",_Ae="dismissableLayer.pointerDownOutside",IAe="dismissableLayer.focusOutside",O3,FG=D.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),xD=D.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:i,onFocusOutside:o,onInteractOutside:a,onDismiss:c,...u}=e,d=D.useContext(FG),[h,p]=D.useState(null),g=h?.ownerDocument??globalThis?.document,[,y]=D.useState({}),b=Tr(t,T=>p(T)),S=Array.from(d.layers),[w]=[...d.layersWithOutsidePointerEventsDisabled].slice(-1),x=S.indexOf(w),I=h?S.indexOf(h):-1,_=d.layersWithOutsidePointerEventsDisabled.size>0,M=I>=x,C=CAe(T=>{const A=T.target,U=[...d.branches].some(R=>R.contains(A));!M||U||(i?.(T),a?.(T),T.defaultPrevented||c?.())},g),E=MAe(T=>{const A=T.target;[...d.branches].some(R=>R.contains(A))||(o?.(T),a?.(T),T.defaultPrevented||c?.())},g);return xAe(T=>{I===d.layers.size-1&&(r?.(T),!T.defaultPrevented&&c&&(T.preventDefault(),c()))},g),D.useEffect(()=>{if(h)return n&&(d.layersWithOutsidePointerEventsDisabled.size===0&&(O3=g.body.style.pointerEvents,g.body.style.pointerEvents="none"),d.layersWithOutsidePointerEventsDisabled.add(h)),d.layers.add(h),D3(),()=>{n&&d.layersWithOutsidePointerEventsDisabled.size===1&&(g.body.style.pointerEvents=O3)}},[h,g,n,d]),D.useEffect(()=>()=>{h&&(d.layers.delete(h),d.layersWithOutsidePointerEventsDisabled.delete(h),D3())},[h,d]),D.useEffect(()=>{const T=()=>y({});return document.addEventListener(lM,T),()=>document.removeEventListener(lM,T)},[]),P.jsx(jn.div,{...u,ref:b,style:{pointerEvents:_?M?"auto":"none":void 0,...e.style},onFocusCapture:Un(e.onFocusCapture,E.onFocusCapture),onBlurCapture:Un(e.onBlurCapture,E.onBlurCapture),onPointerDownCapture:Un(e.onPointerDownCapture,C.onPointerDownCapture)})});xD.displayName=kAe;var EAe="DismissableLayerBranch",TAe=D.forwardRef((e,t)=>{const n=D.useContext(FG),r=D.useRef(null),i=Tr(t,r);return D.useEffect(()=>{const o=r.current;if(o)return n.branches.add(o),()=>{n.branches.delete(o)}},[n.branches]),P.jsx(jn.div,{...e,ref:i})});TAe.displayName=EAe;function CAe(e,t=globalThis?.document){const n=Od(e),r=D.useRef(!1),i=D.useRef(()=>{});return D.useEffect(()=>{const o=c=>{if(c.target&&!r.current){let u=function(){zG(_Ae,n,d,{discrete:!0})};const d={originalEvent:c};c.pointerType==="touch"?(t.removeEventListener("click",i.current),i.current=u,t.addEventListener("click",i.current,{once:!0})):u()}else t.removeEventListener("click",i.current);r.current=!1},a=window.setTimeout(()=>{t.addEventListener("pointerdown",o)},0);return()=>{window.clearTimeout(a),t.removeEventListener("pointerdown",o),t.removeEventListener("click",i.current)}},[t,n]),{onPointerDownCapture:()=>r.current=!0}}function MAe(e,t=globalThis?.document){const n=Od(e),r=D.useRef(!1);return D.useEffect(()=>{const i=o=>{o.target&&!r.current&&zG(IAe,n,{originalEvent:o},{discrete:!1})};return t.addEventListener("focusin",i),()=>t.removeEventListener("focusin",i)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function D3(){const e=new CustomEvent(lM);document.dispatchEvent(e)}function zG(e,t,n,{discrete:r}){const i=n.originalEvent.target,o=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&i.addEventListener(e,t,{once:!0}),r?wAe(i,o):i.dispatchEvent(o)}var yE="focusScope.autoFocusOnMount",bE="focusScope.autoFocusOnUnmount",P3={bubbles:!1,cancelable:!0},RAe="FocusScope",kD=D.forwardRef((e,t)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:i,onUnmountAutoFocus:o,...a}=e,[c,u]=D.useState(null),d=Od(i),h=Od(o),p=D.useRef(null),g=Tr(t,S=>u(S)),y=D.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;D.useEffect(()=>{if(r){let S=function(_){if(y.paused||!c)return;const M=_.target;c.contains(M)?p.current=M:wc(p.current,{select:!0})},w=function(_){if(y.paused||!c)return;const M=_.relatedTarget;M!==null&&(c.contains(M)||wc(p.current,{select:!0}))},x=function(_){if(document.activeElement===document.body)for(const C of _)C.removedNodes.length>0&&wc(c)};document.addEventListener("focusin",S),document.addEventListener("focusout",w);const I=new MutationObserver(x);return c&&I.observe(c,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",S),document.removeEventListener("focusout",w),I.disconnect()}}},[r,c,y.paused]),D.useEffect(()=>{if(c){L3.add(y);const S=document.activeElement;if(!c.contains(S)){const x=new CustomEvent(yE,P3);c.addEventListener(yE,d),c.dispatchEvent(x),x.defaultPrevented||(AAe(LAe(BG(c)),{select:!0}),document.activeElement===S&&wc(c))}return()=>{c.removeEventListener(yE,d),setTimeout(()=>{const x=new CustomEvent(bE,P3);c.addEventListener(bE,h),c.dispatchEvent(x),x.defaultPrevented||wc(S??document.body,{select:!0}),c.removeEventListener(bE,h),L3.remove(y)},0)}}},[c,d,h,y]);const b=D.useCallback(S=>{if(!n&&!r||y.paused)return;const w=S.key==="Tab"&&!S.altKey&&!S.ctrlKey&&!S.metaKey,x=document.activeElement;if(w&&x){const I=S.currentTarget,[_,M]=OAe(I);_&&M?!S.shiftKey&&x===M?(S.preventDefault(),n&&wc(_,{select:!0})):S.shiftKey&&x===_&&(S.preventDefault(),n&&wc(M,{select:!0})):x===I&&S.preventDefault()}},[n,r,y.paused]);return P.jsx(jn.div,{tabIndex:-1,...a,ref:g,onKeyDown:b})});kD.displayName=RAe;function AAe(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(wc(r,{select:t}),document.activeElement!==n)return}function OAe(e){const t=BG(e),n=N3(t,e),r=N3(t.reverse(),e);return[n,r]}function BG(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const i=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||i?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function N3(e,t){for(const n of e)if(!DAe(n,{upTo:t}))return n}function DAe(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}function PAe(e){return e instanceof HTMLInputElement&&"select"in e}function wc(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&PAe(e)&&t&&e.select()}}var L3=NAe();function NAe(){let e=[];return{add(t){const n=e[0];t!==n&&n?.pause(),e=$3(e,t),e.unshift(t)},remove(t){e=$3(e,t),e[0]?.resume()}}}function $3(e,t){const n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function LAe(e){return e.filter(t=>t.tagName!=="A")}var $Ae="Portal",_D=D.forwardRef((e,t)=>{const{container:n,...r}=e,[i,o]=D.useState(!1);Pi(()=>o(!0),[]);const a=n||i&&globalThis?.document?.body;return a?M1e.createPortal(P.jsx(jn.div,{...r,ref:t}),a):null});_D.displayName=$Ae;function jAe(e,t){return D.useReducer((n,r)=>t[n][r]??n,e)}var _k=e=>{const{present:t,children:n}=e,r=FAe(t),i=typeof n=="function"?n({present:r.isPresent}):D.Children.only(n),o=Tr(r.ref,zAe(i));return typeof n=="function"||r.isPresent?D.cloneElement(i,{ref:o}):null};_k.displayName="Presence";function FAe(e){const[t,n]=D.useState(),r=D.useRef(null),i=D.useRef(e),o=D.useRef("none"),a=e?"mounted":"unmounted",[c,u]=jAe(a,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return D.useEffect(()=>{const d=CS(r.current);o.current=c==="mounted"?d:"none"},[c]),Pi(()=>{const d=r.current,h=i.current;if(h!==e){const g=o.current,y=CS(d);e?u("MOUNT"):y==="none"||d?.display==="none"?u("UNMOUNT"):u(h&&g!==y?"ANIMATION_OUT":"UNMOUNT"),i.current=e}},[e,u]),Pi(()=>{if(t){let d;const h=t.ownerDocument.defaultView??window,p=y=>{const S=CS(r.current).includes(CSS.escape(y.animationName));if(y.target===t&&S&&(u("ANIMATION_END"),!i.current)){const w=t.style.animationFillMode;t.style.animationFillMode="forwards",d=h.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=w)})}},g=y=>{y.target===t&&(o.current=CS(r.current))};return t.addEventListener("animationstart",g),t.addEventListener("animationcancel",p),t.addEventListener("animationend",p),()=>{h.clearTimeout(d),t.removeEventListener("animationstart",g),t.removeEventListener("animationcancel",p),t.removeEventListener("animationend",p)}}else u("ANIMATION_END")},[t,u]),{isPresent:["mounted","unmountSuspended"].includes(c),ref:D.useCallback(d=>{r.current=d?getComputedStyle(d):null,n(d)},[])}}function CS(e){return e?.animationName||"none"}function zAe(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var vE=0;function qG(){D.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??j3()),document.body.insertAdjacentElement("beforeend",e[1]??j3()),vE++,()=>{vE===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),vE--}},[])}function j3(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var ya=function(){return ya=Object.assign||function(t){for(var n,r=1,i=arguments.length;r<i;r++){n=arguments[r];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(t[o]=n[o])}return t},ya.apply(this,arguments)};function UG(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n}function BAe(e,t,n){if(n||arguments.length===2)for(var r=0,i=t.length,o;r<i;r++)(o||!(r in t))&&(o||(o=Array.prototype.slice.call(t,0,r)),o[r]=t[r]);return e.concat(o||Array.prototype.slice.call(t))}var v0="right-scroll-bar-position",S0="width-before-scroll-bar",qAe="with-scroll-bars-hidden",UAe="--removed-body-scroll-bar-size";function SE(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function VAe(e,t){var n=D.useState(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(r){var i=n.value;i!==r&&(n.value=r,n.callback(r,i))}}}})[0];return n.callback=t,n.facade}var KAe=typeof window<"u"?D.useLayoutEffect:D.useEffect,F3=new WeakMap;function HAe(e,t){var n=VAe(null,function(r){return e.forEach(function(i){return SE(i,r)})});return KAe(function(){var r=F3.get(n);if(r){var i=new Set(r),o=new Set(e),a=n.current;i.forEach(function(c){o.has(c)||SE(c,null)}),o.forEach(function(c){i.has(c)||SE(c,a)})}F3.set(n,e)},[e]),n}function WAe(e){return e}function GAe(e,t){t===void 0&&(t=WAe);var n=[],r=!1,i={read:function(){if(r)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(o){var a=t(o,r);return n.push(a),function(){n=n.filter(function(c){return c!==a})}},assignSyncMedium:function(o){for(r=!0;n.length;){var a=n;n=[],a.forEach(o)}n={push:function(c){return o(c)},filter:function(){return n}}},assignMedium:function(o){r=!0;var a=[];if(n.length){var c=n;n=[],c.forEach(o),a=n}var u=function(){var h=a;a=[],h.forEach(o)},d=function(){return Promise.resolve().then(u)};d(),n={push:function(h){a.push(h),d()},filter:function(h){return a=a.filter(h),n}}}};return i}function YAe(e){e===void 0&&(e={});var t=GAe(null);return t.options=ya({async:!0,ssr:!1},e),t}var VG=function(e){var t=e.sideCar,n=UG(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var r=t.read();if(!r)throw new Error("Sidecar medium not found");return D.createElement(r,ya({},n))};VG.isSideCarExport=!0;function QAe(e,t){return e.useMedium(t),VG}var KG=YAe(),wE=function(){},Ik=D.forwardRef(function(e,t){var n=D.useRef(null),r=D.useState({onScrollCapture:wE,onWheelCapture:wE,onTouchMoveCapture:wE}),i=r[0],o=r[1],a=e.forwardProps,c=e.children,u=e.className,d=e.removeScrollBar,h=e.enabled,p=e.shards,g=e.sideCar,y=e.noRelative,b=e.noIsolation,S=e.inert,w=e.allowPinchZoom,x=e.as,I=x===void 0?"div":x,_=e.gapMode,M=UG(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),C=g,E=HAe([n,t]),T=ya(ya({},M),i);return D.createElement(D.Fragment,null,h&&D.createElement(C,{sideCar:KG,removeScrollBar:d,shards:p,noRelative:y,noIsolation:b,inert:S,setCallbacks:o,allowPinchZoom:!!w,lockRef:n,gapMode:_}),a?D.cloneElement(D.Children.only(c),ya(ya({},T),{ref:E})):D.createElement(I,ya({},T,{className:u,ref:E}),c))});Ik.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};Ik.classNames={fullWidth:S0,zeroRight:v0};var XAe=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function JAe(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=XAe();return t&&e.setAttribute("nonce",t),e}function ZAe(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function eOe(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var tOe=function(){var e=0,t=null;return{add:function(n){e==0&&(t=JAe())&&(ZAe(t,n),eOe(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},nOe=function(){var e=tOe();return function(t,n){D.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},HG=function(){var e=nOe(),t=function(n){var r=n.styles,i=n.dynamic;return e(r,i),null};return t},rOe={left:0,top:0,right:0,gap:0},xE=function(e){return parseInt(e||"",10)||0},iOe=function(e){var t=window.getComputedStyle(document.body),n=t[e==="padding"?"paddingLeft":"marginLeft"],r=t[e==="padding"?"paddingTop":"marginTop"],i=t[e==="padding"?"paddingRight":"marginRight"];return[xE(n),xE(r),xE(i)]},oOe=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return rOe;var t=iOe(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},sOe=HG(),xh="data-scroll-locked",aOe=function(e,t,n,r){var i=e.left,o=e.top,a=e.right,c=e.gap;return n===void 0&&(n="margin"),`
113
+ .`.concat(qAe,` {
114
+ overflow: hidden `).concat(r,`;
115
+ padding-right: `).concat(c,"px ").concat(r,`;
116
+ }
117
+ body[`).concat(xh,`] {
118
+ overflow: hidden `).concat(r,`;
119
+ overscroll-behavior: contain;
120
+ `).concat([t&&"position: relative ".concat(r,";"),n==="margin"&&`
121
+ padding-left: `.concat(i,`px;
122
+ padding-top: `).concat(o,`px;
123
+ padding-right: `).concat(a,`px;
124
+ margin-left:0;
125
+ margin-top:0;
126
+ margin-right: `).concat(c,"px ").concat(r,`;
127
+ `),n==="padding"&&"padding-right: ".concat(c,"px ").concat(r,";")].filter(Boolean).join(""),`
128
+ }
129
+
130
+ .`).concat(v0,` {
131
+ right: `).concat(c,"px ").concat(r,`;
132
+ }
133
+
134
+ .`).concat(S0,` {
135
+ margin-right: `).concat(c,"px ").concat(r,`;
136
+ }
137
+
138
+ .`).concat(v0," .").concat(v0,` {
139
+ right: 0 `).concat(r,`;
140
+ }
141
+
142
+ .`).concat(S0," .").concat(S0,` {
143
+ margin-right: 0 `).concat(r,`;
144
+ }
145
+
146
+ body[`).concat(xh,`] {
147
+ `).concat(UAe,": ").concat(c,`px;
148
+ }
149
+ `)},z3=function(){var e=parseInt(document.body.getAttribute(xh)||"0",10);return isFinite(e)?e:0},lOe=function(){D.useEffect(function(){return document.body.setAttribute(xh,(z3()+1).toString()),function(){var e=z3()-1;e<=0?document.body.removeAttribute(xh):document.body.setAttribute(xh,e.toString())}},[])},cOe=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,i=r===void 0?"margin":r;lOe();var o=D.useMemo(function(){return oOe(i)},[i]);return D.createElement(sOe,{styles:aOe(o,!t,i,n?"":"!important")})},cM=!1;if(typeof window<"u")try{var MS=Object.defineProperty({},"passive",{get:function(){return cM=!0,!0}});window.addEventListener("test",MS,MS),window.removeEventListener("test",MS,MS)}catch{cM=!1}var Uf=cM?{passive:!1}:!1,uOe=function(e){return e.tagName==="TEXTAREA"},WG=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!uOe(e)&&n[t]==="visible")},dOe=function(e){return WG(e,"overflowY")},fOe=function(e){return WG(e,"overflowX")},B3=function(e,t){var n=t.ownerDocument,r=t;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var i=GG(e,r);if(i){var o=YG(e,r),a=o[1],c=o[2];if(a>c)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},hOe=function(e){var t=e.scrollTop,n=e.scrollHeight,r=e.clientHeight;return[t,n,r]},pOe=function(e){var t=e.scrollLeft,n=e.scrollWidth,r=e.clientWidth;return[t,n,r]},GG=function(e,t){return e==="v"?dOe(t):fOe(t)},YG=function(e,t){return e==="v"?hOe(t):pOe(t)},mOe=function(e,t){return e==="h"&&t==="rtl"?-1:1},gOe=function(e,t,n,r,i){var o=mOe(e,window.getComputedStyle(t).direction),a=o*r,c=n.target,u=t.contains(c),d=!1,h=a>0,p=0,g=0;do{if(!c)break;var y=YG(e,c),b=y[0],S=y[1],w=y[2],x=S-w-o*b;(b||x)&&GG(e,c)&&(p+=x,g+=b);var I=c.parentNode;c=I&&I.nodeType===Node.DOCUMENT_FRAGMENT_NODE?I.host:I}while(!u&&c!==document.body||u&&(t.contains(c)||t===c));return(h&&Math.abs(p)<1||!h&&Math.abs(g)<1)&&(d=!0),d},RS=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},q3=function(e){return[e.deltaX,e.deltaY]},U3=function(e){return e&&"current"in e?e.current:e},yOe=function(e,t){return e[0]===t[0]&&e[1]===t[1]},bOe=function(e){return`
150
+ .block-interactivity-`.concat(e,` {pointer-events: none;}
151
+ .allow-interactivity-`).concat(e,` {pointer-events: all;}
152
+ `)},vOe=0,Vf=[];function SOe(e){var t=D.useRef([]),n=D.useRef([0,0]),r=D.useRef(),i=D.useState(vOe++)[0],o=D.useState(HG)[0],a=D.useRef(e);D.useEffect(function(){a.current=e},[e]),D.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(i));var S=BAe([e.lockRef.current],(e.shards||[]).map(U3),!0).filter(Boolean);return S.forEach(function(w){return w.classList.add("allow-interactivity-".concat(i))}),function(){document.body.classList.remove("block-interactivity-".concat(i)),S.forEach(function(w){return w.classList.remove("allow-interactivity-".concat(i))})}}},[e.inert,e.lockRef.current,e.shards]);var c=D.useCallback(function(S,w){if("touches"in S&&S.touches.length===2||S.type==="wheel"&&S.ctrlKey)return!a.current.allowPinchZoom;var x=RS(S),I=n.current,_="deltaX"in S?S.deltaX:I[0]-x[0],M="deltaY"in S?S.deltaY:I[1]-x[1],C,E=S.target,T=Math.abs(_)>Math.abs(M)?"h":"v";if("touches"in S&&T==="h"&&E.type==="range")return!1;var A=window.getSelection(),U=A&&A.anchorNode,R=U?U===E||U.contains(E):!1;if(R)return!1;var N=B3(T,E);if(!N)return!0;if(N?C=T:(C=T==="v"?"h":"v",N=B3(T,E)),!N)return!1;if(!r.current&&"changedTouches"in S&&(_||M)&&(r.current=C),!C)return!0;var L=r.current||C;return gOe(L,w,S,L==="h"?_:M)},[]),u=D.useCallback(function(S){var w=S;if(!(!Vf.length||Vf[Vf.length-1]!==o)){var x="deltaY"in w?q3(w):RS(w),I=t.current.filter(function(C){return C.name===w.type&&(C.target===w.target||w.target===C.shadowParent)&&yOe(C.delta,x)})[0];if(I&&I.should){w.cancelable&&w.preventDefault();return}if(!I){var _=(a.current.shards||[]).map(U3).filter(Boolean).filter(function(C){return C.contains(w.target)}),M=_.length>0?c(w,_[0]):!a.current.noIsolation;M&&w.cancelable&&w.preventDefault()}}},[]),d=D.useCallback(function(S,w,x,I){var _={name:S,delta:w,target:x,should:I,shadowParent:wOe(x)};t.current.push(_),setTimeout(function(){t.current=t.current.filter(function(M){return M!==_})},1)},[]),h=D.useCallback(function(S){n.current=RS(S),r.current=void 0},[]),p=D.useCallback(function(S){d(S.type,q3(S),S.target,c(S,e.lockRef.current))},[]),g=D.useCallback(function(S){d(S.type,RS(S),S.target,c(S,e.lockRef.current))},[]);D.useEffect(function(){return Vf.push(o),e.setCallbacks({onScrollCapture:p,onWheelCapture:p,onTouchMoveCapture:g}),document.addEventListener("wheel",u,Uf),document.addEventListener("touchmove",u,Uf),document.addEventListener("touchstart",h,Uf),function(){Vf=Vf.filter(function(S){return S!==o}),document.removeEventListener("wheel",u,Uf),document.removeEventListener("touchmove",u,Uf),document.removeEventListener("touchstart",h,Uf)}},[]);var y=e.removeScrollBar,b=e.inert;return D.createElement(D.Fragment,null,b?D.createElement(o,{styles:bOe(i)}):null,y?D.createElement(cOe,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function wOe(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const xOe=QAe(KG,SOe);var ID=D.forwardRef(function(e,t){return D.createElement(Ik,ya({},e,{ref:t,sideCar:xOe}))});ID.classNames=Ik.classNames;var kOe=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},Kf=new WeakMap,AS=new WeakMap,OS={},kE=0,QG=function(e){return e&&(e.host||QG(e.parentNode))},_Oe=function(e,t){return t.map(function(n){if(e.contains(n))return n;var r=QG(n);return r&&e.contains(r)?r:(console.error("aria-hidden",n,"in not contained inside",e,". Doing nothing"),null)}).filter(function(n){return!!n})},IOe=function(e,t,n,r){var i=_Oe(t,Array.isArray(e)?e:[e]);OS[n]||(OS[n]=new WeakMap);var o=OS[n],a=[],c=new Set,u=new Set(i),d=function(p){!p||c.has(p)||(c.add(p),d(p.parentNode))};i.forEach(d);var h=function(p){!p||u.has(p)||Array.prototype.forEach.call(p.children,function(g){if(c.has(g))h(g);else try{var y=g.getAttribute(r),b=y!==null&&y!=="false",S=(Kf.get(g)||0)+1,w=(o.get(g)||0)+1;Kf.set(g,S),o.set(g,w),a.push(g),S===1&&b&&AS.set(g,!0),w===1&&g.setAttribute(n,"true"),b||g.setAttribute(r,"true")}catch(x){console.error("aria-hidden: cannot operate on ",g,x)}})};return h(t),c.clear(),kE++,function(){a.forEach(function(p){var g=Kf.get(p)-1,y=o.get(p)-1;Kf.set(p,g),o.set(p,y),g||(AS.has(p)||p.removeAttribute(r),AS.delete(p)),y||p.removeAttribute(n)}),kE--,kE||(Kf=new WeakMap,Kf=new WeakMap,AS=new WeakMap,OS={})}},XG=function(e,t,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(e)?e:[e]),i=kOe(e);return i?(r.push.apply(r,Array.from(i.querySelectorAll("[aria-live], script"))),IOe(r,i,n,"aria-hidden")):function(){return null}},Ek="Dialog",[JG]=kk(Ek),[EOe,ia]=JG(Ek),ZG=e=>{const{__scopeDialog:t,children:n,open:r,defaultOpen:i,onOpenChange:o,modal:a=!0}=e,c=D.useRef(null),u=D.useRef(null),[d,h]=aM({prop:r,defaultProp:i??!1,onChange:o,caller:Ek});return P.jsx(EOe,{scope:t,triggerRef:c,contentRef:u,contentId:wh(),titleId:wh(),descriptionId:wh(),open:d,onOpenChange:h,onOpenToggle:D.useCallback(()=>h(p=>!p),[h]),modal:a,children:n})};ZG.displayName=Ek;var e7="DialogTrigger",TOe=D.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,i=ia(e7,n),o=Tr(t,i.triggerRef);return P.jsx(jn.button,{type:"button","aria-haspopup":"dialog","aria-expanded":i.open,"aria-controls":i.contentId,"data-state":CD(i.open),...r,ref:o,onClick:Un(e.onClick,i.onOpenToggle)})});TOe.displayName=e7;var ED="DialogPortal",[COe,t7]=JG(ED,{forceMount:void 0}),n7=e=>{const{__scopeDialog:t,forceMount:n,children:r,container:i}=e,o=ia(ED,t);return P.jsx(COe,{scope:t,forceMount:n,children:D.Children.map(r,a=>P.jsx(_k,{present:n||o.open,children:P.jsx(_D,{asChild:!0,container:i,children:a})}))})};n7.displayName=ED;var Fw="DialogOverlay",r7=D.forwardRef((e,t)=>{const n=t7(Fw,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,o=ia(Fw,e.__scopeDialog);return o.modal?P.jsx(_k,{present:r||o.open,children:P.jsx(ROe,{...i,ref:t})}):null});r7.displayName=Fw;var MOe=ky("DialogOverlay.RemoveScroll"),ROe=D.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,i=ia(Fw,n);return P.jsx(ID,{as:MOe,allowPinchZoom:!0,shards:[i.contentRef],children:P.jsx(jn.div,{"data-state":CD(i.open),...r,ref:t,style:{pointerEvents:"auto",...r.style}})})}),Dd="DialogContent",i7=D.forwardRef((e,t)=>{const n=t7(Dd,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,o=ia(Dd,e.__scopeDialog);return P.jsx(_k,{present:r||o.open,children:o.modal?P.jsx(AOe,{...i,ref:t}):P.jsx(OOe,{...i,ref:t})})});i7.displayName=Dd;var AOe=D.forwardRef((e,t)=>{const n=ia(Dd,e.__scopeDialog),r=D.useRef(null),i=Tr(t,n.contentRef,r);return D.useEffect(()=>{const o=r.current;if(o)return XG(o)},[]),P.jsx(o7,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Un(e.onCloseAutoFocus,o=>{o.preventDefault(),n.triggerRef.current?.focus()}),onPointerDownOutside:Un(e.onPointerDownOutside,o=>{const a=o.detail.originalEvent,c=a.button===0&&a.ctrlKey===!0;(a.button===2||c)&&o.preventDefault()}),onFocusOutside:Un(e.onFocusOutside,o=>o.preventDefault())})}),OOe=D.forwardRef((e,t)=>{const n=ia(Dd,e.__scopeDialog),r=D.useRef(!1),i=D.useRef(!1);return P.jsx(o7,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:o=>{e.onCloseAutoFocus?.(o),o.defaultPrevented||(r.current||n.triggerRef.current?.focus(),o.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:o=>{e.onInteractOutside?.(o),o.defaultPrevented||(r.current=!0,o.detail.originalEvent.type==="pointerdown"&&(i.current=!0));const a=o.target;n.triggerRef.current?.contains(a)&&o.preventDefault(),o.detail.originalEvent.type==="focusin"&&i.current&&o.preventDefault()}})}),o7=D.forwardRef((e,t)=>{const{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:o,...a}=e,c=ia(Dd,n),u=D.useRef(null),d=Tr(t,u);return qG(),P.jsxs(P.Fragment,{children:[P.jsx(kD,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:o,children:P.jsx(xD,{role:"dialog",id:c.contentId,"aria-describedby":c.descriptionId,"aria-labelledby":c.titleId,"data-state":CD(c.open),...a,ref:d,onDismiss:()=>c.onOpenChange(!1)})}),P.jsxs(P.Fragment,{children:[P.jsx(NOe,{titleId:c.titleId}),P.jsx($Oe,{contentRef:u,descriptionId:c.descriptionId})]})]})}),TD="DialogTitle",s7=D.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,i=ia(TD,n);return P.jsx(jn.h2,{id:i.titleId,...r,ref:t})});s7.displayName=TD;var a7="DialogDescription",DOe=D.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,i=ia(a7,n);return P.jsx(jn.p,{id:i.descriptionId,...r,ref:t})});DOe.displayName=a7;var l7="DialogClose",POe=D.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,i=ia(l7,n);return P.jsx(jn.button,{type:"button",...r,ref:t,onClick:Un(e.onClick,()=>i.onOpenChange(!1))})});POe.displayName=l7;function CD(e){return e?"open":"closed"}var c7="DialogTitleWarning",[OBe,u7]=lAe(c7,{contentName:Dd,titleName:TD,docsSlug:"dialog"}),NOe=({titleId:e})=>{const t=u7(c7),n=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users.
153
+
154
+ If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.
155
+
156
+ For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return D.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},LOe="DialogDescriptionWarning",$Oe=({contentRef:e,descriptionId:t})=>{const r=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${u7(LOe).contentName}}.`;return D.useEffect(()=>{const i=e.current?.getAttribute("aria-describedby");t&&i&&(document.getElementById(t)||console.warn(r))},[r,e,t]),null},jOe=ZG,FOe=n7,zOe=r7,d7=i7,f7=s7;const BOe=jOe,qOe=FOe,MD=D.forwardRef(({className:e,children:t,overlayClassName:n,motionProps:r,...i},o)=>P.jsxs(qOe,{forceMount:!0,children:[P.jsx(zOe,{asChild:!0,children:P.jsx(Nw.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.2},className:ki("fixed inset-0 z-50 bg-background/80 backdrop-blur-sm data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",n)})}),P.jsx(d7,{asChild:!0,ref:o,...i,children:P.jsx(Nw.div,{initial:{opacity:0,x:"100%"},animate:{opacity:1,x:0},exit:{opacity:0,x:"100%"},transition:{type:"spring",damping:25,stiffness:200},...r,className:ki("fixed right-0 top-0 z-50 h-screen w-screen bg-background shadow-lg outline-none sm:max-w-md",e),children:t})})]}));MD.displayName=d7.displayName;function h7({open:e,onOpenChange:t,children:n}){return P.jsx(BOe,{open:e,onOpenChange:t,children:P.jsx(OTe,{children:e&&n})})}function UOe(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const VOe=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,KOe=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,HOe={};function V3(e,t){return(HOe.jsx?KOe:VOe).test(e)}const WOe=/[ \t\n\f\r]/g;function GOe(e){return typeof e=="object"?e.type==="text"?K3(e.value):!1:K3(e)}function K3(e){return e.replace(WOe,"")===""}class Eb{constructor(t,n,r){this.normal=n,this.property=t,r&&(this.space=r)}}Eb.prototype.normal={};Eb.prototype.property={};Eb.prototype.space=void 0;function p7(e,t){const n={},r={};for(const i of e)Object.assign(n,i.property),Object.assign(r,i.normal);return new Eb(n,r,t)}function uM(e){return e.toLowerCase()}class bo{constructor(t,n){this.attribute=n,this.property=t}}bo.prototype.attribute="";bo.prototype.booleanish=!1;bo.prototype.boolean=!1;bo.prototype.commaOrSpaceSeparated=!1;bo.prototype.commaSeparated=!1;bo.prototype.defined=!1;bo.prototype.mustUseProperty=!1;bo.prototype.number=!1;bo.prototype.overloadedBoolean=!1;bo.prototype.property="";bo.prototype.spaceSeparated=!1;bo.prototype.space=void 0;let YOe=0;const Et=Jd(),Pr=Jd(),dM=Jd(),Ee=Jd(),Pn=Jd(),kh=Jd(),Ro=Jd();function Jd(){return 2**++YOe}const fM=Object.freeze(Object.defineProperty({__proto__:null,boolean:Et,booleanish:Pr,commaOrSpaceSeparated:Ro,commaSeparated:kh,number:Ee,overloadedBoolean:dM,spaceSeparated:Pn},Symbol.toStringTag,{value:"Module"})),_E=Object.keys(fM);class RD extends bo{constructor(t,n,r,i){let o=-1;if(super(t,n),H3(this,"space",i),typeof r=="number")for(;++o<_E.length;){const a=_E[o];H3(this,_E[o],(r&fM[a])===fM[a])}}}RD.prototype.defined=!0;function H3(e,t,n){n&&(e[t]=n)}function Lp(e){const t={},n={};for(const[r,i]of Object.entries(e.properties)){const o=new RD(r,e.transform(e.attributes||{},r),i,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(o.mustUseProperty=!0),t[r]=o,n[uM(r)]=r,n[uM(o.attribute)]=r}return new Eb(t,n,e.space)}const m7=Lp({properties:{ariaActiveDescendant:null,ariaAtomic:Pr,ariaAutoComplete:null,ariaBusy:Pr,ariaChecked:Pr,ariaColCount:Ee,ariaColIndex:Ee,ariaColSpan:Ee,ariaControls:Pn,ariaCurrent:null,ariaDescribedBy:Pn,ariaDetails:null,ariaDisabled:Pr,ariaDropEffect:Pn,ariaErrorMessage:null,ariaExpanded:Pr,ariaFlowTo:Pn,ariaGrabbed:Pr,ariaHasPopup:null,ariaHidden:Pr,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:Pn,ariaLevel:Ee,ariaLive:null,ariaModal:Pr,ariaMultiLine:Pr,ariaMultiSelectable:Pr,ariaOrientation:null,ariaOwns:Pn,ariaPlaceholder:null,ariaPosInSet:Ee,ariaPressed:Pr,ariaReadOnly:Pr,ariaRelevant:null,ariaRequired:Pr,ariaRoleDescription:Pn,ariaRowCount:Ee,ariaRowIndex:Ee,ariaRowSpan:Ee,ariaSelected:Pr,ariaSetSize:Ee,ariaSort:null,ariaValueMax:Ee,ariaValueMin:Ee,ariaValueNow:Ee,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function g7(e,t){return t in e?e[t]:t}function y7(e,t){return g7(e,t.toLowerCase())}const QOe=Lp({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:kh,acceptCharset:Pn,accessKey:Pn,action:null,allow:null,allowFullScreen:Et,allowPaymentRequest:Et,allowUserMedia:Et,alt:null,as:null,async:Et,autoCapitalize:null,autoComplete:Pn,autoFocus:Et,autoPlay:Et,blocking:Pn,capture:null,charSet:null,checked:Et,cite:null,className:Pn,cols:Ee,colSpan:null,content:null,contentEditable:Pr,controls:Et,controlsList:Pn,coords:Ee|kh,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Et,defer:Et,dir:null,dirName:null,disabled:Et,download:dM,draggable:Pr,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Et,formTarget:null,headers:Pn,height:Ee,hidden:dM,high:Ee,href:null,hrefLang:null,htmlFor:Pn,httpEquiv:Pn,id:null,imageSizes:null,imageSrcSet:null,inert:Et,inputMode:null,integrity:null,is:null,isMap:Et,itemId:null,itemProp:Pn,itemRef:Pn,itemScope:Et,itemType:Pn,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:Et,low:Ee,manifest:null,max:null,maxLength:Ee,media:null,method:null,min:null,minLength:Ee,multiple:Et,muted:Et,name:null,nonce:null,noModule:Et,noValidate:Et,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:Et,optimum:Ee,pattern:null,ping:Pn,placeholder:null,playsInline:Et,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Et,referrerPolicy:null,rel:Pn,required:Et,reversed:Et,rows:Ee,rowSpan:Ee,sandbox:Pn,scope:null,scoped:Et,seamless:Et,selected:Et,shadowRootClonable:Et,shadowRootDelegatesFocus:Et,shadowRootMode:null,shape:null,size:Ee,sizes:null,slot:null,span:Ee,spellCheck:Pr,src:null,srcDoc:null,srcLang:null,srcSet:null,start:Ee,step:null,style:null,tabIndex:Ee,target:null,title:null,translate:null,type:null,typeMustMatch:Et,useMap:null,value:Pr,width:Ee,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:Pn,axis:null,background:null,bgColor:null,border:Ee,borderColor:null,bottomMargin:Ee,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:Et,declare:Et,event:null,face:null,frame:null,frameBorder:null,hSpace:Ee,leftMargin:Ee,link:null,longDesc:null,lowSrc:null,marginHeight:Ee,marginWidth:Ee,noResize:Et,noHref:Et,noShade:Et,noWrap:Et,object:null,profile:null,prompt:null,rev:null,rightMargin:Ee,rules:null,scheme:null,scrolling:Pr,standby:null,summary:null,text:null,topMargin:Ee,valueType:null,version:null,vAlign:null,vLink:null,vSpace:Ee,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:Et,disableRemotePlayback:Et,prefix:null,property:null,results:Ee,security:null,unselectable:null},space:"html",transform:y7}),XOe=Lp({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:Ro,accentHeight:Ee,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:Ee,amplitude:Ee,arabicForm:null,ascent:Ee,attributeName:null,attributeType:null,azimuth:Ee,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:Ee,by:null,calcMode:null,capHeight:Ee,className:Pn,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:Ee,diffuseConstant:Ee,direction:null,display:null,dur:null,divisor:Ee,dominantBaseline:null,download:Et,dx:null,dy:null,edgeMode:null,editable:null,elevation:Ee,enableBackground:null,end:null,event:null,exponent:Ee,externalResourcesRequired:null,fill:null,fillOpacity:Ee,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:kh,g2:kh,glyphName:kh,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:Ee,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:Ee,horizOriginX:Ee,horizOriginY:Ee,id:null,ideographic:Ee,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:Ee,k:Ee,k1:Ee,k2:Ee,k3:Ee,k4:Ee,kernelMatrix:Ro,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:Ee,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:Ee,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:Ee,overlineThickness:Ee,paintOrder:null,panose1:null,path:null,pathLength:Ee,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:Pn,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:Ee,pointsAtY:Ee,pointsAtZ:Ee,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Ro,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Ro,rev:Ro,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Ro,requiredFeatures:Ro,requiredFonts:Ro,requiredFormats:Ro,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:Ee,specularExponent:Ee,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:Ee,strikethroughThickness:Ee,string:null,stroke:null,strokeDashArray:Ro,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:Ee,strokeOpacity:Ee,strokeWidth:null,style:null,surfaceScale:Ee,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Ro,tabIndex:Ee,tableValues:null,target:null,targetX:Ee,targetY:Ee,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:Ro,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:Ee,underlineThickness:Ee,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:Ee,values:null,vAlphabetic:Ee,vMathematical:Ee,vectorEffect:null,vHanging:Ee,vIdeographic:Ee,version:null,vertAdvY:Ee,vertOriginX:Ee,vertOriginY:Ee,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:Ee,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:g7}),b7=Lp({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(e,t){return"xlink:"+t.slice(5).toLowerCase()}}),v7=Lp({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:y7}),S7=Lp({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),JOe={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"},ZOe=/[A-Z]/g,W3=/-[a-z]/g,eDe=/^data[-\w.:]+$/i;function tDe(e,t){const n=uM(t);let r=t,i=bo;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&eDe.test(t)){if(t.charAt(4)==="-"){const o=t.slice(5).replace(W3,rDe);r="data"+o.charAt(0).toUpperCase()+o.slice(1)}else{const o=t.slice(4);if(!W3.test(o)){let a=o.replace(ZOe,nDe);a.charAt(0)!=="-"&&(a="-"+a),t="data"+a}}i=RD}return new i(r,t)}function nDe(e){return"-"+e.toLowerCase()}function rDe(e){return e.charAt(1).toUpperCase()}const iDe=p7([m7,QOe,b7,v7,S7],"html"),AD=p7([m7,XOe,b7,v7,S7],"svg");function oDe(e){return e.join(" ").trim()}var Hf={},IE,G3;function sDe(){if(G3)return IE;G3=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,t=/\n/g,n=/^\s*/,r=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,i=/^:\s*/,o=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,a=/^[;\s]*/,c=/^\s+|\s+$/g,u=`
157
+ `,d="/",h="*",p="",g="comment",y="declaration";function b(w,x){if(typeof w!="string")throw new TypeError("First argument must be a string");if(!w)return[];x=x||{};var I=1,_=1;function M(j){var $=j.match(t);$&&(I+=$.length);var F=j.lastIndexOf(u);_=~F?j.length-F:_+j.length}function C(){var j={line:I,column:_};return function($){return $.position=new E(j),U(),$}}function E(j){this.start=j,this.end={line:I,column:_},this.source=x.source}E.prototype.content=w;function T(j){var $=new Error(x.source+":"+I+":"+_+": "+j);if($.reason=j,$.filename=x.source,$.line=I,$.column=_,$.source=w,!x.silent)throw $}function A(j){var $=j.exec(w);if($){var F=$[0];return M(F),w=w.slice(F.length),$}}function U(){A(n)}function R(j){var $;for(j=j||[];$=N();)$!==!1&&j.push($);return j}function N(){var j=C();if(!(d!=w.charAt(0)||h!=w.charAt(1))){for(var $=2;p!=w.charAt($)&&(h!=w.charAt($)||d!=w.charAt($+1));)++$;if($+=2,p===w.charAt($-1))return T("End of comment missing");var F=w.slice(2,$-2);return _+=2,M(F),w=w.slice($),_+=2,j({type:g,comment:F})}}function L(){var j=C(),$=A(r);if($){if(N(),!A(i))return T("property missing ':'");var F=A(o),K=j({type:y,property:S($[0].replace(e,p)),value:F?S(F[0].replace(e,p)):p});return A(a),K}}function B(){var j=[];R(j);for(var $;$=L();)$!==!1&&(j.push($),R(j));return j}return U(),B()}function S(w){return w?w.replace(c,p):p}return IE=b,IE}var Y3;function aDe(){if(Y3)return Hf;Y3=1;var e=Hf&&Hf.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(Hf,"__esModule",{value:!0}),Hf.default=n;const t=e(sDe());function n(r,i){let o=null;if(!r||typeof r!="string")return o;const a=(0,t.default)(r),c=typeof i=="function";return a.forEach(u=>{if(u.type!=="declaration")return;const{property:d,value:h}=u;c?i(d,h,u):h&&(o=o||{},o[d]=h)}),o}return Hf}var Km={},Q3;function lDe(){if(Q3)return Km;Q3=1,Object.defineProperty(Km,"__esModule",{value:!0}),Km.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,t=/-([a-z])/g,n=/^[^-]+$/,r=/^-(webkit|moz|ms|o|khtml)-/,i=/^-(ms)-/,o=function(d){return!d||n.test(d)||e.test(d)},a=function(d,h){return h.toUpperCase()},c=function(d,h){return"".concat(h,"-")},u=function(d,h){return h===void 0&&(h={}),o(d)?d:(d=d.toLowerCase(),h.reactCompat?d=d.replace(i,c):d=d.replace(r,c),d.replace(t,a))};return Km.camelCase=u,Km}var Hm,X3;function cDe(){if(X3)return Hm;X3=1;var e=Hm&&Hm.__importDefault||function(i){return i&&i.__esModule?i:{default:i}},t=e(aDe()),n=lDe();function r(i,o){var a={};return!i||typeof i!="string"||(0,t.default)(i,function(c,u){c&&u&&(a[(0,n.camelCase)(c,o)]=u)}),a}return r.default=r,Hm=r,Hm}var uDe=cDe();const dDe=Xw(uDe),w7=x7("end"),OD=x7("start");function x7(e){return t;function t(n){const r=n&&n.position&&n.position[e]||{};if(typeof r.line=="number"&&r.line>0&&typeof r.column=="number"&&r.column>0)return{line:r.line,column:r.column,offset:typeof r.offset=="number"&&r.offset>-1?r.offset:void 0}}}function fDe(e){const t=OD(e),n=w7(e);if(t&&n)return{start:t,end:n}}function Rg(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?J3(e.position):"start"in e||"end"in e?J3(e):"line"in e||"column"in e?hM(e):""}function hM(e){return Z3(e&&e.line)+":"+Z3(e&&e.column)}function J3(e){return hM(e&&e.start)+"-"+hM(e&&e.end)}function Z3(e){return e&&typeof e=="number"?e:1}class Li extends Error{constructor(t,n,r){super(),typeof n=="string"&&(r=n,n=void 0);let i="",o={},a=!1;if(n&&("line"in n&&"column"in n?o={place:n}:"start"in n&&"end"in n?o={place:n}:"type"in n?o={ancestors:[n],place:n.position}:o={...n}),typeof t=="string"?i=t:!o.cause&&t&&(a=!0,i=t.message,o.cause=t),!o.ruleId&&!o.source&&typeof r=="string"){const u=r.indexOf(":");u===-1?o.ruleId=r:(o.source=r.slice(0,u),o.ruleId=r.slice(u+1))}if(!o.place&&o.ancestors&&o.ancestors){const u=o.ancestors[o.ancestors.length-1];u&&(o.place=u.position)}const c=o.place&&"start"in o.place?o.place.start:o.place;this.ancestors=o.ancestors||void 0,this.cause=o.cause||void 0,this.column=c?c.column:void 0,this.fatal=void 0,this.file="",this.message=i,this.line=c?c.line:void 0,this.name=Rg(o.place)||"1:1",this.place=o.place||void 0,this.reason=this.message,this.ruleId=o.ruleId||void 0,this.source=o.source||void 0,this.stack=a&&o.cause&&typeof o.cause.stack=="string"?o.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}Li.prototype.file="";Li.prototype.name="";Li.prototype.reason="";Li.prototype.message="";Li.prototype.stack="";Li.prototype.column=void 0;Li.prototype.line=void 0;Li.prototype.ancestors=void 0;Li.prototype.cause=void 0;Li.prototype.fatal=void 0;Li.prototype.place=void 0;Li.prototype.ruleId=void 0;Li.prototype.source=void 0;const DD={}.hasOwnProperty,hDe=new Map,pDe=/[A-Z]/g,mDe=new Set(["table","tbody","thead","tfoot","tr"]),gDe=new Set(["td","th"]),k7="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function yDe(e,t){if(!t||t.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const n=t.filePath||void 0;let r;if(t.development){if(typeof t.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");r=IDe(n,t.jsxDEV)}else{if(typeof t.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof t.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");r=_De(n,t.jsx,t.jsxs)}const i={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:r,elementAttributeNameCase:t.elementAttributeNameCase||"react",evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space==="svg"?AD:iDe,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},o=_7(i,e,void 0);return o&&typeof o!="string"?o:i.create(e,i.Fragment,{children:o||void 0},void 0)}function _7(e,t,n){if(t.type==="element")return bDe(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return vDe(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return wDe(e,t,n);if(t.type==="mdxjsEsm")return SDe(e,t);if(t.type==="root")return xDe(e,t,n);if(t.type==="text")return kDe(e,t)}function bDe(e,t,n){const r=e.schema;let i=r;t.tagName.toLowerCase()==="svg"&&r.space==="html"&&(i=AD,e.schema=i),e.ancestors.push(t);const o=E7(e,t.tagName,!1),a=EDe(e,t);let c=ND(e,t);return mDe.has(t.tagName)&&(c=c.filter(function(u){return typeof u=="string"?!GOe(u):!0})),I7(e,a,o,t),PD(a,c),e.ancestors.pop(),e.schema=r,e.create(t,o,a,n)}function vDe(e,t){if(t.data&&t.data.estree&&e.evaluater){const r=t.data.estree.body[0];return r.type,e.evaluater.evaluateExpression(r.expression)}_y(e,t.position)}function SDe(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);_y(e,t.position)}function wDe(e,t,n){const r=e.schema;let i=r;t.name==="svg"&&r.space==="html"&&(i=AD,e.schema=i),e.ancestors.push(t);const o=t.name===null?e.Fragment:E7(e,t.name,!0),a=TDe(e,t),c=ND(e,t);return I7(e,a,o,t),PD(a,c),e.ancestors.pop(),e.schema=r,e.create(t,o,a,n)}function xDe(e,t,n){const r={};return PD(r,ND(e,t)),e.create(t,e.Fragment,r,n)}function kDe(e,t){return t.value}function I7(e,t,n,r){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=r)}function PD(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function _De(e,t,n){return r;function r(i,o,a,c){const d=Array.isArray(a.children)?n:t;return c?d(o,a,c):d(o,a)}}function IDe(e,t){return n;function n(r,i,o,a){const c=Array.isArray(o.children),u=OD(r);return t(i,o,a,c,{columnNumber:u?u.column-1:void 0,fileName:e,lineNumber:u?u.line:void 0},void 0)}}function EDe(e,t){const n={};let r,i;for(i in t.properties)if(i!=="children"&&DD.call(t.properties,i)){const o=CDe(e,i,t.properties[i]);if(o){const[a,c]=o;e.tableCellAlignToStyle&&a==="align"&&typeof c=="string"&&gDe.has(t.tagName)?r=c:n[a]=c}}if(r){const o=n.style||(n.style={});o[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=r}return n}function TDe(e,t){const n={};for(const r of t.attributes)if(r.type==="mdxJsxExpressionAttribute")if(r.data&&r.data.estree&&e.evaluater){const o=r.data.estree.body[0];o.type;const a=o.expression;a.type;const c=a.properties[0];c.type,Object.assign(n,e.evaluater.evaluateExpression(c.argument))}else _y(e,t.position);else{const i=r.name;let o;if(r.value&&typeof r.value=="object")if(r.value.data&&r.value.data.estree&&e.evaluater){const c=r.value.data.estree.body[0];c.type,o=e.evaluater.evaluateExpression(c.expression)}else _y(e,t.position);else o=r.value===null?!0:r.value;n[i]=o}return n}function ND(e,t){const n=[];let r=-1;const i=e.passKeys?new Map:hDe;for(;++r<t.children.length;){const o=t.children[r];let a;if(e.passKeys){const u=o.type==="element"?o.tagName:o.type==="mdxJsxFlowElement"||o.type==="mdxJsxTextElement"?o.name:void 0;if(u){const d=i.get(u)||0;a=u+"-"+d,i.set(u,d+1)}}const c=_7(e,o,a);c!==void 0&&n.push(c)}return n}function CDe(e,t,n){const r=tDe(e.schema,t);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?UOe(n):oDe(n)),r.property==="style"){let i=typeof n=="object"?n:MDe(e,String(n));return e.stylePropertyNameCase==="css"&&(i=RDe(i)),["style",i]}return[e.elementAttributeNameCase==="react"&&r.space?JOe[r.property]||r.property:r.attribute,n]}}function MDe(e,t){try{return dDe(t,{reactCompat:!0})}catch(n){if(e.ignoreInvalidStyle)return{};const r=n,i=new Li("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:r,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw i.file=e.filePath||void 0,i.url=k7+"#cannot-parse-style-attribute",i}}function E7(e,t,n){let r;if(!n)r={type:"Literal",value:t};else if(t.includes(".")){const i=t.split(".");let o=-1,a;for(;++o<i.length;){const c=V3(i[o])?{type:"Identifier",name:i[o]}:{type:"Literal",value:i[o]};a=a?{type:"MemberExpression",object:a,property:c,computed:!!(o&&c.type==="Literal"),optional:!1}:c}r=a}else r=V3(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(r.type==="Literal"){const i=r.value;return DD.call(e.components,i)?e.components[i]:i}if(e.evaluater)return e.evaluater.evaluateExpression(r);_y(e)}function _y(e,t){const n=new Li("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:t,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw n.file=e.filePath||void 0,n.url=k7+"#cannot-handle-mdx-estrees-without-createevaluater",n}function RDe(e){const t={};let n;for(n in e)DD.call(e,n)&&(t[ADe(n)]=e[n]);return t}function ADe(e){let t=e.replace(pDe,ODe);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function ODe(e){return"-"+e.toLowerCase()}const EE={action:["form"],cite:["blockquote","del","ins","q"],data:["object"],formAction:["button","input"],href:["a","area","base","link"],icon:["menuitem"],itemId:null,manifest:["html"],ping:["a","area"],poster:["video"],src:["audio","embed","iframe","img","input","script","source","track","video"]},DDe={};function LD(e,t){const n=DDe,r=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,i=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return T7(e,r,i)}function T7(e,t,n){if(PDe(e)){if("value"in e)return e.type==="html"&&!n?"":e.value;if(t&&"alt"in e&&e.alt)return e.alt;if("children"in e)return eq(e.children,t,n)}return Array.isArray(e)?eq(e,t,n):""}function eq(e,t,n){const r=[];let i=-1;for(;++i<e.length;)r[i]=T7(e[i],t,n);return r.join("")}function PDe(e){return!!(e&&typeof e=="object")}const tq=document.createElement("i");function $D(e){const t="&"+e+";";tq.innerHTML=t;const n=tq.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function Vo(e,t,n,r){const i=e.length;let o=0,a;if(t<0?t=-t>i?0:i+t:t=t>i?i:t,n=n>0?n:0,r.length<1e4)a=Array.from(r),a.unshift(t,n),e.splice(...a);else for(n&&e.splice(t,n);o<r.length;)a=r.slice(o,o+1e4),a.unshift(t,0),e.splice(...a),o+=1e4,t+=1e4}function ps(e,t){return e.length>0?(Vo(e,e.length,0,t),e):t}const nq={}.hasOwnProperty;function C7(e){const t={};let n=-1;for(;++n<e.length;)NDe(t,e[n]);return t}function NDe(e,t){let n;for(n in t){const i=(nq.call(e,n)?e[n]:void 0)||(e[n]={}),o=t[n];let a;if(o)for(a in o){nq.call(i,a)||(i[a]=[]);const c=o[a];LDe(i[a],Array.isArray(c)?c:c?[c]:[])}}}function LDe(e,t){let n=-1;const r=[];for(;++n<t.length;)(t[n].add==="after"?e:r).push(t[n]);Vo(e,0,0,r)}function M7(e,t){const n=Number.parseInt(e,t);return n<9||n===11||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)===65535||(n&65535)===65534||n>1114111?"�":String.fromCodePoint(n)}function Ys(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const Ki=au(/[A-Za-z]/),Di=au(/[\dA-Za-z]/),$De=au(/[#-'*+\--9=?A-Z^-~]/);function zw(e){return e!==null&&(e<32||e===127)}const pM=au(/\d/),jDe=au(/[\dA-Fa-f]/),FDe=au(/[!-/:-@[-`{-~]/);function lt(e){return e!==null&&e<-2}function Rn(e){return e!==null&&(e<0||e===32)}function zt(e){return e===-2||e===-1||e===32}const Tk=au(new RegExp("\\p{P}|\\p{S}","u")),Pd=au(/\s/);function au(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function $p(e){const t=[];let n=-1,r=0,i=0;for(;++n<e.length;){const o=e.charCodeAt(n);let a="";if(o===37&&Di(e.charCodeAt(n+1))&&Di(e.charCodeAt(n+2)))i=2;else if(o<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(o))||(a=String.fromCharCode(o));else if(o>55295&&o<57344){const c=e.charCodeAt(n+1);o<56320&&c>56319&&c<57344?(a=String.fromCharCode(o,c),i=1):a="�"}else a=String.fromCharCode(o);a&&(t.push(e.slice(r,n),encodeURIComponent(a)),r=n+i+1,a=""),i&&(n+=i,i=0)}return t.join("")+e.slice(r)}function Xt(e,t,n,r){const i=r?r-1:Number.POSITIVE_INFINITY;let o=0;return a;function a(u){return zt(u)?(e.enter(n),c(u)):t(u)}function c(u){return zt(u)&&o++<i?(e.consume(u),c):(e.exit(n),t(u))}}const zDe={tokenize:BDe};function BDe(e){const t=e.attempt(this.parser.constructs.contentInitial,r,i);let n;return t;function r(c){if(c===null){e.consume(c);return}return e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),Xt(e,t,"linePrefix")}function i(c){return e.enter("paragraph"),o(c)}function o(c){const u=e.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=u),n=u,a(c)}function a(c){if(c===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(c);return}return lt(c)?(e.consume(c),e.exit("chunkText"),o):(e.consume(c),a)}}const qDe={tokenize:UDe},rq={tokenize:VDe};function UDe(e){const t=this,n=[];let r=0,i,o,a;return c;function c(_){if(r<n.length){const M=n[r];return t.containerState=M[1],e.attempt(M[0].continuation,u,d)(_)}return d(_)}function u(_){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,i&&I();const M=t.events.length;let C=M,E;for(;C--;)if(t.events[C][0]==="exit"&&t.events[C][1].type==="chunkFlow"){E=t.events[C][1].end;break}x(r);let T=M;for(;T<t.events.length;)t.events[T][1].end={...E},T++;return Vo(t.events,C+1,0,t.events.slice(M)),t.events.length=T,d(_)}return c(_)}function d(_){if(r===n.length){if(!i)return g(_);if(i.currentConstruct&&i.currentConstruct.concrete)return b(_);t.interrupt=!!(i.currentConstruct&&!i._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(rq,h,p)(_)}function h(_){return i&&I(),x(r),g(_)}function p(_){return t.parser.lazy[t.now().line]=r!==n.length,a=t.now().offset,b(_)}function g(_){return t.containerState={},e.attempt(rq,y,b)(_)}function y(_){return r++,n.push([t.currentConstruct,t.containerState]),g(_)}function b(_){if(_===null){i&&I(),x(0),e.consume(_);return}return i=i||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:i,contentType:"flow",previous:o}),S(_)}function S(_){if(_===null){w(e.exit("chunkFlow"),!0),x(0),e.consume(_);return}return lt(_)?(e.consume(_),w(e.exit("chunkFlow")),r=0,t.interrupt=void 0,c):(e.consume(_),S)}function w(_,M){const C=t.sliceStream(_);if(M&&C.push(null),_.previous=o,o&&(o.next=_),o=_,i.defineSkip(_.start),i.write(C),t.parser.lazy[_.start.line]){let E=i.events.length;for(;E--;)if(i.events[E][1].start.offset<a&&(!i.events[E][1].end||i.events[E][1].end.offset>a))return;const T=t.events.length;let A=T,U,R;for(;A--;)if(t.events[A][0]==="exit"&&t.events[A][1].type==="chunkFlow"){if(U){R=t.events[A][1].end;break}U=!0}for(x(r),E=T;E<t.events.length;)t.events[E][1].end={...R},E++;Vo(t.events,A+1,0,t.events.slice(T)),t.events.length=E}}function x(_){let M=n.length;for(;M-- >_;){const C=n[M];t.containerState=C[1],C[0].exit.call(t,e)}n.length=_}function I(){i.write([null]),o=void 0,i=void 0,t.containerState._closeFlow=void 0}}function VDe(e,t,n){return Xt(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function ep(e){if(e===null||Rn(e)||Pd(e))return 1;if(Tk(e))return 2}function Ck(e,t,n){const r=[];let i=-1;for(;++i<e.length;){const o=e[i].resolveAll;o&&!r.includes(o)&&(t=o(t,n),r.push(o))}return t}const mM={name:"attention",resolveAll:KDe,tokenize:HDe};function KDe(e,t){let n=-1,r,i,o,a,c,u,d,h;for(;++n<e.length;)if(e[n][0]==="enter"&&e[n][1].type==="attentionSequence"&&e[n][1]._close){for(r=n;r--;)if(e[r][0]==="exit"&&e[r][1].type==="attentionSequence"&&e[r][1]._open&&t.sliceSerialize(e[r][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[r][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[r][1].end.offset-e[r][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;u=e[r][1].end.offset-e[r][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;const p={...e[r][1].end},g={...e[n][1].start};iq(p,-u),iq(g,u),a={type:u>1?"strongSequence":"emphasisSequence",start:p,end:{...e[r][1].end}},c={type:u>1?"strongSequence":"emphasisSequence",start:{...e[n][1].start},end:g},o={type:u>1?"strongText":"emphasisText",start:{...e[r][1].end},end:{...e[n][1].start}},i={type:u>1?"strong":"emphasis",start:{...a.start},end:{...c.end}},e[r][1].end={...a.start},e[n][1].start={...c.end},d=[],e[r][1].end.offset-e[r][1].start.offset&&(d=ps(d,[["enter",e[r][1],t],["exit",e[r][1],t]])),d=ps(d,[["enter",i,t],["enter",a,t],["exit",a,t],["enter",o,t]]),d=ps(d,Ck(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),d=ps(d,[["exit",o,t],["enter",c,t],["exit",c,t],["exit",i,t]]),e[n][1].end.offset-e[n][1].start.offset?(h=2,d=ps(d,[["enter",e[n][1],t],["exit",e[n][1],t]])):h=0,Vo(e,r-1,n-r+3,d),n=r+d.length-h-2;break}}for(n=-1;++n<e.length;)e[n][1].type==="attentionSequence"&&(e[n][1].type="data");return e}function HDe(e,t){const n=this.parser.constructs.attentionMarkers.null,r=this.previous,i=ep(r);let o;return a;function a(u){return o=u,e.enter("attentionSequence"),c(u)}function c(u){if(u===o)return e.consume(u),c;const d=e.exit("attentionSequence"),h=ep(u),p=!h||h===2&&i||n.includes(u),g=!i||i===2&&h||n.includes(r);return d._open=!!(o===42?p:p&&(i||!g)),d._close=!!(o===42?g:g&&(h||!p)),t(u)}}function iq(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const WDe={name:"autolink",tokenize:GDe};function GDe(e,t,n){let r=0;return i;function i(y){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(y),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),o}function o(y){return Ki(y)?(e.consume(y),a):y===64?n(y):d(y)}function a(y){return y===43||y===45||y===46||Di(y)?(r=1,c(y)):d(y)}function c(y){return y===58?(e.consume(y),r=0,u):(y===43||y===45||y===46||Di(y))&&r++<32?(e.consume(y),c):(r=0,d(y))}function u(y){return y===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(y),e.exit("autolinkMarker"),e.exit("autolink"),t):y===null||y===32||y===60||zw(y)?n(y):(e.consume(y),u)}function d(y){return y===64?(e.consume(y),h):$De(y)?(e.consume(y),d):n(y)}function h(y){return Di(y)?p(y):n(y)}function p(y){return y===46?(e.consume(y),r=0,h):y===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(y),e.exit("autolinkMarker"),e.exit("autolink"),t):g(y)}function g(y){if((y===45||Di(y))&&r++<63){const b=y===45?g:p;return e.consume(y),b}return n(y)}}const Tb={partial:!0,tokenize:YDe};function YDe(e,t,n){return r;function r(o){return zt(o)?Xt(e,i,"linePrefix")(o):i(o)}function i(o){return o===null||lt(o)?t(o):n(o)}}const R7={continuation:{tokenize:XDe},exit:JDe,name:"blockQuote",tokenize:QDe};function QDe(e,t,n){const r=this;return i;function i(a){if(a===62){const c=r.containerState;return c.open||(e.enter("blockQuote",{_container:!0}),c.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(a),e.exit("blockQuoteMarker"),o}return n(a)}function o(a){return zt(a)?(e.enter("blockQuotePrefixWhitespace"),e.consume(a),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(a))}}function XDe(e,t,n){const r=this;return i;function i(a){return zt(a)?Xt(e,o,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(a):o(a)}function o(a){return e.attempt(R7,t,n)(a)}}function JDe(e){e.exit("blockQuote")}const A7={name:"characterEscape",tokenize:ZDe};function ZDe(e,t,n){return r;function r(o){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(o),e.exit("escapeMarker"),i}function i(o){return FDe(o)?(e.enter("characterEscapeValue"),e.consume(o),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(o)}}const O7={name:"characterReference",tokenize:ePe};function ePe(e,t,n){const r=this;let i=0,o,a;return c;function c(p){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(p),e.exit("characterReferenceMarker"),u}function u(p){return p===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(p),e.exit("characterReferenceMarkerNumeric"),d):(e.enter("characterReferenceValue"),o=31,a=Di,h(p))}function d(p){return p===88||p===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(p),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),o=6,a=jDe,h):(e.enter("characterReferenceValue"),o=7,a=pM,h(p))}function h(p){if(p===59&&i){const g=e.exit("characterReferenceValue");return a===Di&&!$D(r.sliceSerialize(g))?n(p):(e.enter("characterReferenceMarker"),e.consume(p),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return a(p)&&i++<o?(e.consume(p),h):n(p)}}const oq={partial:!0,tokenize:nPe},sq={concrete:!0,name:"codeFenced",tokenize:tPe};function tPe(e,t,n){const r=this,i={partial:!0,tokenize:C};let o=0,a=0,c;return u;function u(E){return d(E)}function d(E){const T=r.events[r.events.length-1];return o=T&&T[1].type==="linePrefix"?T[2].sliceSerialize(T[1],!0).length:0,c=E,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),h(E)}function h(E){return E===c?(a++,e.consume(E),h):a<3?n(E):(e.exit("codeFencedFenceSequence"),zt(E)?Xt(e,p,"whitespace")(E):p(E))}function p(E){return E===null||lt(E)?(e.exit("codeFencedFence"),r.interrupt?t(E):e.check(oq,S,M)(E)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),g(E))}function g(E){return E===null||lt(E)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),p(E)):zt(E)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),Xt(e,y,"whitespace")(E)):E===96&&E===c?n(E):(e.consume(E),g)}function y(E){return E===null||lt(E)?p(E):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),b(E))}function b(E){return E===null||lt(E)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),p(E)):E===96&&E===c?n(E):(e.consume(E),b)}function S(E){return e.attempt(i,M,w)(E)}function w(E){return e.enter("lineEnding"),e.consume(E),e.exit("lineEnding"),x}function x(E){return o>0&&zt(E)?Xt(e,I,"linePrefix",o+1)(E):I(E)}function I(E){return E===null||lt(E)?e.check(oq,S,M)(E):(e.enter("codeFlowValue"),_(E))}function _(E){return E===null||lt(E)?(e.exit("codeFlowValue"),I(E)):(e.consume(E),_)}function M(E){return e.exit("codeFenced"),t(E)}function C(E,T,A){let U=0;return R;function R($){return E.enter("lineEnding"),E.consume($),E.exit("lineEnding"),N}function N($){return E.enter("codeFencedFence"),zt($)?Xt(E,L,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)($):L($)}function L($){return $===c?(E.enter("codeFencedFenceSequence"),B($)):A($)}function B($){return $===c?(U++,E.consume($),B):U>=a?(E.exit("codeFencedFenceSequence"),zt($)?Xt(E,j,"whitespace")($):j($)):A($)}function j($){return $===null||lt($)?(E.exit("codeFencedFence"),T($)):A($)}}}function nPe(e,t,n){const r=this;return i;function i(a){return a===null?n(a):(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),o)}function o(a){return r.parser.lazy[r.now().line]?n(a):t(a)}}const TE={name:"codeIndented",tokenize:iPe},rPe={partial:!0,tokenize:oPe};function iPe(e,t,n){const r=this;return i;function i(d){return e.enter("codeIndented"),Xt(e,o,"linePrefix",5)(d)}function o(d){const h=r.events[r.events.length-1];return h&&h[1].type==="linePrefix"&&h[2].sliceSerialize(h[1],!0).length>=4?a(d):n(d)}function a(d){return d===null?u(d):lt(d)?e.attempt(rPe,a,u)(d):(e.enter("codeFlowValue"),c(d))}function c(d){return d===null||lt(d)?(e.exit("codeFlowValue"),a(d)):(e.consume(d),c)}function u(d){return e.exit("codeIndented"),t(d)}}function oPe(e,t,n){const r=this;return i;function i(a){return r.parser.lazy[r.now().line]?n(a):lt(a)?(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),i):Xt(e,o,"linePrefix",5)(a)}function o(a){const c=r.events[r.events.length-1];return c&&c[1].type==="linePrefix"&&c[2].sliceSerialize(c[1],!0).length>=4?t(a):lt(a)?i(a):n(a)}}const sPe={name:"codeText",previous:lPe,resolve:aPe,tokenize:cPe};function aPe(e){let t=e.length-4,n=3,r,i;if((e[n][1].type==="lineEnding"||e[n][1].type==="space")&&(e[t][1].type==="lineEnding"||e[t][1].type==="space")){for(r=n;++r<t;)if(e[r][1].type==="codeTextData"){e[n][1].type="codeTextPadding",e[t][1].type="codeTextPadding",n+=2,t-=2;break}}for(r=n-1,t++;++r<=t;)i===void 0?r!==t&&e[r][1].type!=="lineEnding"&&(i=r):(r===t||e[r][1].type==="lineEnding")&&(e[i][1].type="codeTextData",r!==i+2&&(e[i][1].end=e[r-1][1].end,e.splice(i+2,r-i-2),t-=r-i-2,r=i+2),i=void 0);return e}function lPe(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function cPe(e,t,n){let r=0,i,o;return a;function a(p){return e.enter("codeText"),e.enter("codeTextSequence"),c(p)}function c(p){return p===96?(e.consume(p),r++,c):(e.exit("codeTextSequence"),u(p))}function u(p){return p===null?n(p):p===32?(e.enter("space"),e.consume(p),e.exit("space"),u):p===96?(o=e.enter("codeTextSequence"),i=0,h(p)):lt(p)?(e.enter("lineEnding"),e.consume(p),e.exit("lineEnding"),u):(e.enter("codeTextData"),d(p))}function d(p){return p===null||p===32||p===96||lt(p)?(e.exit("codeTextData"),u(p)):(e.consume(p),d)}function h(p){return p===96?(e.consume(p),i++,h):i===r?(e.exit("codeTextSequence"),e.exit("codeText"),t(p)):(o.type="codeTextData",d(p))}}class uPe{constructor(t){this.left=t?[...t]:[],this.right=[]}get(t){if(t<0||t>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+t+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return t<this.left.length?this.left[t]:this.right[this.right.length-t+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(t,n){const r=n??Number.POSITIVE_INFINITY;return r<this.left.length?this.left.slice(t,r):t>this.left.length?this.right.slice(this.right.length-r+this.left.length,this.right.length-t+this.left.length).reverse():this.left.slice(t).concat(this.right.slice(this.right.length-r+this.left.length).reverse())}splice(t,n,r){const i=n||0;this.setCursor(Math.trunc(t));const o=this.right.splice(this.right.length-i,Number.POSITIVE_INFINITY);return r&&Wm(this.left,r),o.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(t){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(t)}pushMany(t){this.setCursor(Number.POSITIVE_INFINITY),Wm(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),Wm(this.right,t.reverse())}setCursor(t){if(!(t===this.left.length||t>this.left.length&&this.right.length===0||t<0&&this.left.length===0))if(t<this.left.length){const n=this.left.splice(t,Number.POSITIVE_INFINITY);Wm(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);Wm(this.left,n.reverse())}}}function Wm(e,t){let n=0;if(t.length<1e4)e.push(...t);else for(;n<t.length;)e.push(...t.slice(n,n+1e4)),n+=1e4}function D7(e){const t={};let n=-1,r,i,o,a,c,u,d;const h=new uPe(e);for(;++n<h.length;){for(;n in t;)n=t[n];if(r=h.get(n),n&&r[1].type==="chunkFlow"&&h.get(n-1)[1].type==="listItemPrefix"&&(u=r[1]._tokenizer.events,o=0,o<u.length&&u[o][1].type==="lineEndingBlank"&&(o+=2),o<u.length&&u[o][1].type==="content"))for(;++o<u.length&&u[o][1].type!=="content";)u[o][1].type==="chunkText"&&(u[o][1]._isInFirstContentOfListItem=!0,o++);if(r[0]==="enter")r[1].contentType&&(Object.assign(t,dPe(h,n)),n=t[n],d=!0);else if(r[1]._container){for(o=n,i=void 0;o--;)if(a=h.get(o),a[1].type==="lineEnding"||a[1].type==="lineEndingBlank")a[0]==="enter"&&(i&&(h.get(i)[1].type="lineEndingBlank"),a[1].type="lineEnding",i=o);else if(!(a[1].type==="linePrefix"||a[1].type==="listItemIndent"))break;i&&(r[1].end={...h.get(i)[1].start},c=h.slice(i,n),c.unshift(r),h.splice(i,n-i+1,c))}}return Vo(e,0,Number.POSITIVE_INFINITY,h.slice(0)),!d}function dPe(e,t){const n=e.get(t)[1],r=e.get(t)[2];let i=t-1;const o=[];let a=n._tokenizer;a||(a=r.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(a._contentTypeTextTrailing=!0));const c=a.events,u=[],d={};let h,p,g=-1,y=n,b=0,S=0;const w=[S];for(;y;){for(;e.get(++i)[1]!==y;);o.push(i),y._tokenizer||(h=r.sliceStream(y),y.next||h.push(null),p&&a.defineSkip(y.start),y._isInFirstContentOfListItem&&(a._gfmTasklistFirstContentOfListItem=!0),a.write(h),y._isInFirstContentOfListItem&&(a._gfmTasklistFirstContentOfListItem=void 0)),p=y,y=y.next}for(y=n;++g<c.length;)c[g][0]==="exit"&&c[g-1][0]==="enter"&&c[g][1].type===c[g-1][1].type&&c[g][1].start.line!==c[g][1].end.line&&(S=g+1,w.push(S),y._tokenizer=void 0,y.previous=void 0,y=y.next);for(a.events=[],y?(y._tokenizer=void 0,y.previous=void 0):w.pop(),g=w.length;g--;){const x=c.slice(w[g],w[g+1]),I=o.pop();u.push([I,I+x.length-1]),e.splice(I,2,x)}for(u.reverse(),g=-1;++g<u.length;)d[b+u[g][0]]=b+u[g][1],b+=u[g][1]-u[g][0]-1;return d}const fPe={resolve:pPe,tokenize:mPe},hPe={partial:!0,tokenize:gPe};function pPe(e){return D7(e),e}function mPe(e,t){let n;return r;function r(c){return e.enter("content"),n=e.enter("chunkContent",{contentType:"content"}),i(c)}function i(c){return c===null?o(c):lt(c)?e.check(hPe,a,o)(c):(e.consume(c),i)}function o(c){return e.exit("chunkContent"),e.exit("content"),t(c)}function a(c){return e.consume(c),e.exit("chunkContent"),n.next=e.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,i}}function gPe(e,t,n){const r=this;return i;function i(a){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),Xt(e,o,"linePrefix")}function o(a){if(a===null||lt(a))return n(a);const c=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes("codeIndented")&&c&&c[1].type==="linePrefix"&&c[2].sliceSerialize(c[1],!0).length>=4?t(a):e.interrupt(r.parser.constructs.flow,n,t)(a)}}function P7(e,t,n,r,i,o,a,c,u){const d=u||Number.POSITIVE_INFINITY;let h=0;return p;function p(x){return x===60?(e.enter(r),e.enter(i),e.enter(o),e.consume(x),e.exit(o),g):x===null||x===32||x===41||zw(x)?n(x):(e.enter(r),e.enter(a),e.enter(c),e.enter("chunkString",{contentType:"string"}),S(x))}function g(x){return x===62?(e.enter(o),e.consume(x),e.exit(o),e.exit(i),e.exit(r),t):(e.enter(c),e.enter("chunkString",{contentType:"string"}),y(x))}function y(x){return x===62?(e.exit("chunkString"),e.exit(c),g(x)):x===null||x===60||lt(x)?n(x):(e.consume(x),x===92?b:y)}function b(x){return x===60||x===62||x===92?(e.consume(x),y):y(x)}function S(x){return!h&&(x===null||x===41||Rn(x))?(e.exit("chunkString"),e.exit(c),e.exit(a),e.exit(r),t(x)):h<d&&x===40?(e.consume(x),h++,S):x===41?(e.consume(x),h--,S):x===null||x===32||x===40||zw(x)?n(x):(e.consume(x),x===92?w:S)}function w(x){return x===40||x===41||x===92?(e.consume(x),S):S(x)}}function N7(e,t,n,r,i,o){const a=this;let c=0,u;return d;function d(y){return e.enter(r),e.enter(i),e.consume(y),e.exit(i),e.enter(o),h}function h(y){return c>999||y===null||y===91||y===93&&!u||y===94&&!c&&"_hiddenFootnoteSupport"in a.parser.constructs?n(y):y===93?(e.exit(o),e.enter(i),e.consume(y),e.exit(i),e.exit(r),t):lt(y)?(e.enter("lineEnding"),e.consume(y),e.exit("lineEnding"),h):(e.enter("chunkString",{contentType:"string"}),p(y))}function p(y){return y===null||y===91||y===93||lt(y)||c++>999?(e.exit("chunkString"),h(y)):(e.consume(y),u||(u=!zt(y)),y===92?g:p)}function g(y){return y===91||y===92||y===93?(e.consume(y),c++,p):p(y)}}function L7(e,t,n,r,i,o){let a;return c;function c(g){return g===34||g===39||g===40?(e.enter(r),e.enter(i),e.consume(g),e.exit(i),a=g===40?41:g,u):n(g)}function u(g){return g===a?(e.enter(i),e.consume(g),e.exit(i),e.exit(r),t):(e.enter(o),d(g))}function d(g){return g===a?(e.exit(o),u(a)):g===null?n(g):lt(g)?(e.enter("lineEnding"),e.consume(g),e.exit("lineEnding"),Xt(e,d,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),h(g))}function h(g){return g===a||g===null||lt(g)?(e.exit("chunkString"),d(g)):(e.consume(g),g===92?p:h)}function p(g){return g===a||g===92?(e.consume(g),h):h(g)}}function Ag(e,t){let n;return r;function r(i){return lt(i)?(e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),n=!0,r):zt(i)?Xt(e,r,n?"linePrefix":"lineSuffix")(i):t(i)}}const yPe={name:"definition",tokenize:vPe},bPe={partial:!0,tokenize:SPe};function vPe(e,t,n){const r=this;let i;return o;function o(y){return e.enter("definition"),a(y)}function a(y){return N7.call(r,e,c,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(y)}function c(y){return i=Ys(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),y===58?(e.enter("definitionMarker"),e.consume(y),e.exit("definitionMarker"),u):n(y)}function u(y){return Rn(y)?Ag(e,d)(y):d(y)}function d(y){return P7(e,h,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(y)}function h(y){return e.attempt(bPe,p,p)(y)}function p(y){return zt(y)?Xt(e,g,"whitespace")(y):g(y)}function g(y){return y===null||lt(y)?(e.exit("definition"),r.parser.defined.push(i),t(y)):n(y)}}function SPe(e,t,n){return r;function r(c){return Rn(c)?Ag(e,i)(c):n(c)}function i(c){return L7(e,o,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(c)}function o(c){return zt(c)?Xt(e,a,"whitespace")(c):a(c)}function a(c){return c===null||lt(c)?t(c):n(c)}}const wPe={name:"hardBreakEscape",tokenize:xPe};function xPe(e,t,n){return r;function r(o){return e.enter("hardBreakEscape"),e.consume(o),i}function i(o){return lt(o)?(e.exit("hardBreakEscape"),t(o)):n(o)}}const kPe={name:"headingAtx",resolve:_Pe,tokenize:IPe};function _Pe(e,t){let n=e.length-2,r=3,i,o;return e[r][1].type==="whitespace"&&(r+=2),n-2>r&&e[n][1].type==="whitespace"&&(n-=2),e[n][1].type==="atxHeadingSequence"&&(r===n-1||n-4>r&&e[n-2][1].type==="whitespace")&&(n-=r+1===n?2:4),n>r&&(i={type:"atxHeadingText",start:e[r][1].start,end:e[n][1].end},o={type:"chunkText",start:e[r][1].start,end:e[n][1].end,contentType:"text"},Vo(e,r,n-r+1,[["enter",i,t],["enter",o,t],["exit",o,t],["exit",i,t]])),e}function IPe(e,t,n){let r=0;return i;function i(h){return e.enter("atxHeading"),o(h)}function o(h){return e.enter("atxHeadingSequence"),a(h)}function a(h){return h===35&&r++<6?(e.consume(h),a):h===null||Rn(h)?(e.exit("atxHeadingSequence"),c(h)):n(h)}function c(h){return h===35?(e.enter("atxHeadingSequence"),u(h)):h===null||lt(h)?(e.exit("atxHeading"),t(h)):zt(h)?Xt(e,c,"whitespace")(h):(e.enter("atxHeadingText"),d(h))}function u(h){return h===35?(e.consume(h),u):(e.exit("atxHeadingSequence"),c(h))}function d(h){return h===null||h===35||Rn(h)?(e.exit("atxHeadingText"),c(h)):(e.consume(h),d)}}const EPe=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],aq=["pre","script","style","textarea"],TPe={concrete:!0,name:"htmlFlow",resolveTo:RPe,tokenize:APe},CPe={partial:!0,tokenize:DPe},MPe={partial:!0,tokenize:OPe};function RPe(e){let t=e.length;for(;t--&&!(e[t][0]==="enter"&&e[t][1].type==="htmlFlow"););return t>1&&e[t-2][1].type==="linePrefix"&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e}function APe(e,t,n){const r=this;let i,o,a,c,u;return d;function d(q){return h(q)}function h(q){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(q),p}function p(q){return q===33?(e.consume(q),g):q===47?(e.consume(q),o=!0,S):q===63?(e.consume(q),i=3,r.interrupt?t:V):Ki(q)?(e.consume(q),a=String.fromCharCode(q),w):n(q)}function g(q){return q===45?(e.consume(q),i=2,y):q===91?(e.consume(q),i=5,c=0,b):Ki(q)?(e.consume(q),i=4,r.interrupt?t:V):n(q)}function y(q){return q===45?(e.consume(q),r.interrupt?t:V):n(q)}function b(q){const ie="CDATA[";return q===ie.charCodeAt(c++)?(e.consume(q),c===ie.length?r.interrupt?t:L:b):n(q)}function S(q){return Ki(q)?(e.consume(q),a=String.fromCharCode(q),w):n(q)}function w(q){if(q===null||q===47||q===62||Rn(q)){const ie=q===47,le=a.toLowerCase();return!ie&&!o&&aq.includes(le)?(i=1,r.interrupt?t(q):L(q)):EPe.includes(a.toLowerCase())?(i=6,ie?(e.consume(q),x):r.interrupt?t(q):L(q)):(i=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(q):o?I(q):_(q))}return q===45||Di(q)?(e.consume(q),a+=String.fromCharCode(q),w):n(q)}function x(q){return q===62?(e.consume(q),r.interrupt?t:L):n(q)}function I(q){return zt(q)?(e.consume(q),I):R(q)}function _(q){return q===47?(e.consume(q),R):q===58||q===95||Ki(q)?(e.consume(q),M):zt(q)?(e.consume(q),_):R(q)}function M(q){return q===45||q===46||q===58||q===95||Di(q)?(e.consume(q),M):C(q)}function C(q){return q===61?(e.consume(q),E):zt(q)?(e.consume(q),C):_(q)}function E(q){return q===null||q===60||q===61||q===62||q===96?n(q):q===34||q===39?(e.consume(q),u=q,T):zt(q)?(e.consume(q),E):A(q)}function T(q){return q===u?(e.consume(q),u=null,U):q===null||lt(q)?n(q):(e.consume(q),T)}function A(q){return q===null||q===34||q===39||q===47||q===60||q===61||q===62||q===96||Rn(q)?C(q):(e.consume(q),A)}function U(q){return q===47||q===62||zt(q)?_(q):n(q)}function R(q){return q===62?(e.consume(q),N):n(q)}function N(q){return q===null||lt(q)?L(q):zt(q)?(e.consume(q),N):n(q)}function L(q){return q===45&&i===2?(e.consume(q),F):q===60&&i===1?(e.consume(q),K):q===62&&i===4?(e.consume(q),z):q===63&&i===3?(e.consume(q),V):q===93&&i===5?(e.consume(q),X):lt(q)&&(i===6||i===7)?(e.exit("htmlFlowData"),e.check(CPe,Q,B)(q)):q===null||lt(q)?(e.exit("htmlFlowData"),B(q)):(e.consume(q),L)}function B(q){return e.check(MPe,j,Q)(q)}function j(q){return e.enter("lineEnding"),e.consume(q),e.exit("lineEnding"),$}function $(q){return q===null||lt(q)?B(q):(e.enter("htmlFlowData"),L(q))}function F(q){return q===45?(e.consume(q),V):L(q)}function K(q){return q===47?(e.consume(q),a="",W):L(q)}function W(q){if(q===62){const ie=a.toLowerCase();return aq.includes(ie)?(e.consume(q),z):L(q)}return Ki(q)&&a.length<8?(e.consume(q),a+=String.fromCharCode(q),W):L(q)}function X(q){return q===93?(e.consume(q),V):L(q)}function V(q){return q===62?(e.consume(q),z):q===45&&i===2?(e.consume(q),V):L(q)}function z(q){return q===null||lt(q)?(e.exit("htmlFlowData"),Q(q)):(e.consume(q),z)}function Q(q){return e.exit("htmlFlow"),t(q)}}function OPe(e,t,n){const r=this;return i;function i(a){return lt(a)?(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),o):n(a)}function o(a){return r.parser.lazy[r.now().line]?n(a):t(a)}}function DPe(e,t,n){return r;function r(i){return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),e.attempt(Tb,t,n)}}const PPe={name:"htmlText",tokenize:NPe};function NPe(e,t,n){const r=this;let i,o,a;return c;function c(V){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(V),u}function u(V){return V===33?(e.consume(V),d):V===47?(e.consume(V),C):V===63?(e.consume(V),_):Ki(V)?(e.consume(V),A):n(V)}function d(V){return V===45?(e.consume(V),h):V===91?(e.consume(V),o=0,b):Ki(V)?(e.consume(V),I):n(V)}function h(V){return V===45?(e.consume(V),y):n(V)}function p(V){return V===null?n(V):V===45?(e.consume(V),g):lt(V)?(a=p,K(V)):(e.consume(V),p)}function g(V){return V===45?(e.consume(V),y):p(V)}function y(V){return V===62?F(V):V===45?g(V):p(V)}function b(V){const z="CDATA[";return V===z.charCodeAt(o++)?(e.consume(V),o===z.length?S:b):n(V)}function S(V){return V===null?n(V):V===93?(e.consume(V),w):lt(V)?(a=S,K(V)):(e.consume(V),S)}function w(V){return V===93?(e.consume(V),x):S(V)}function x(V){return V===62?F(V):V===93?(e.consume(V),x):S(V)}function I(V){return V===null||V===62?F(V):lt(V)?(a=I,K(V)):(e.consume(V),I)}function _(V){return V===null?n(V):V===63?(e.consume(V),M):lt(V)?(a=_,K(V)):(e.consume(V),_)}function M(V){return V===62?F(V):_(V)}function C(V){return Ki(V)?(e.consume(V),E):n(V)}function E(V){return V===45||Di(V)?(e.consume(V),E):T(V)}function T(V){return lt(V)?(a=T,K(V)):zt(V)?(e.consume(V),T):F(V)}function A(V){return V===45||Di(V)?(e.consume(V),A):V===47||V===62||Rn(V)?U(V):n(V)}function U(V){return V===47?(e.consume(V),F):V===58||V===95||Ki(V)?(e.consume(V),R):lt(V)?(a=U,K(V)):zt(V)?(e.consume(V),U):F(V)}function R(V){return V===45||V===46||V===58||V===95||Di(V)?(e.consume(V),R):N(V)}function N(V){return V===61?(e.consume(V),L):lt(V)?(a=N,K(V)):zt(V)?(e.consume(V),N):U(V)}function L(V){return V===null||V===60||V===61||V===62||V===96?n(V):V===34||V===39?(e.consume(V),i=V,B):lt(V)?(a=L,K(V)):zt(V)?(e.consume(V),L):(e.consume(V),j)}function B(V){return V===i?(e.consume(V),i=void 0,$):V===null?n(V):lt(V)?(a=B,K(V)):(e.consume(V),B)}function j(V){return V===null||V===34||V===39||V===60||V===61||V===96?n(V):V===47||V===62||Rn(V)?U(V):(e.consume(V),j)}function $(V){return V===47||V===62||Rn(V)?U(V):n(V)}function F(V){return V===62?(e.consume(V),e.exit("htmlTextData"),e.exit("htmlText"),t):n(V)}function K(V){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(V),e.exit("lineEnding"),W}function W(V){return zt(V)?Xt(e,X,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(V):X(V)}function X(V){return e.enter("htmlTextData"),a(V)}}const jD={name:"labelEnd",resolveAll:FPe,resolveTo:zPe,tokenize:BPe},LPe={tokenize:qPe},$Pe={tokenize:UPe},jPe={tokenize:VPe};function FPe(e){let t=-1;const n=[];for(;++t<e.length;){const r=e[t][1];if(n.push(e[t]),r.type==="labelImage"||r.type==="labelLink"||r.type==="labelEnd"){const i=r.type==="labelImage"?4:2;r.type="data",t+=i}}return e.length!==n.length&&Vo(e,0,e.length,n),e}function zPe(e,t){let n=e.length,r=0,i,o,a,c;for(;n--;)if(i=e[n][1],o){if(i.type==="link"||i.type==="labelLink"&&i._inactive)break;e[n][0]==="enter"&&i.type==="labelLink"&&(i._inactive=!0)}else if(a){if(e[n][0]==="enter"&&(i.type==="labelImage"||i.type==="labelLink")&&!i._balanced&&(o=n,i.type!=="labelLink")){r=2;break}}else i.type==="labelEnd"&&(a=n);const u={type:e[o][1].type==="labelLink"?"link":"image",start:{...e[o][1].start},end:{...e[e.length-1][1].end}},d={type:"label",start:{...e[o][1].start},end:{...e[a][1].end}},h={type:"labelText",start:{...e[o+r+2][1].end},end:{...e[a-2][1].start}};return c=[["enter",u,t],["enter",d,t]],c=ps(c,e.slice(o+1,o+r+3)),c=ps(c,[["enter",h,t]]),c=ps(c,Ck(t.parser.constructs.insideSpan.null,e.slice(o+r+4,a-3),t)),c=ps(c,[["exit",h,t],e[a-2],e[a-1],["exit",d,t]]),c=ps(c,e.slice(a+1)),c=ps(c,[["exit",u,t]]),Vo(e,o,e.length,c),e}function BPe(e,t,n){const r=this;let i=r.events.length,o,a;for(;i--;)if((r.events[i][1].type==="labelImage"||r.events[i][1].type==="labelLink")&&!r.events[i][1]._balanced){o=r.events[i][1];break}return c;function c(g){return o?o._inactive?p(g):(a=r.parser.defined.includes(Ys(r.sliceSerialize({start:o.end,end:r.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(g),e.exit("labelMarker"),e.exit("labelEnd"),u):n(g)}function u(g){return g===40?e.attempt(LPe,h,a?h:p)(g):g===91?e.attempt($Pe,h,a?d:p)(g):a?h(g):p(g)}function d(g){return e.attempt(jPe,h,p)(g)}function h(g){return t(g)}function p(g){return o._balanced=!0,n(g)}}function qPe(e,t,n){return r;function r(p){return e.enter("resource"),e.enter("resourceMarker"),e.consume(p),e.exit("resourceMarker"),i}function i(p){return Rn(p)?Ag(e,o)(p):o(p)}function o(p){return p===41?h(p):P7(e,a,c,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(p)}function a(p){return Rn(p)?Ag(e,u)(p):h(p)}function c(p){return n(p)}function u(p){return p===34||p===39||p===40?L7(e,d,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(p):h(p)}function d(p){return Rn(p)?Ag(e,h)(p):h(p)}function h(p){return p===41?(e.enter("resourceMarker"),e.consume(p),e.exit("resourceMarker"),e.exit("resource"),t):n(p)}}function UPe(e,t,n){const r=this;return i;function i(c){return N7.call(r,e,o,a,"reference","referenceMarker","referenceString")(c)}function o(c){return r.parser.defined.includes(Ys(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(c):n(c)}function a(c){return n(c)}}function VPe(e,t,n){return r;function r(o){return e.enter("reference"),e.enter("referenceMarker"),e.consume(o),e.exit("referenceMarker"),i}function i(o){return o===93?(e.enter("referenceMarker"),e.consume(o),e.exit("referenceMarker"),e.exit("reference"),t):n(o)}}const KPe={name:"labelStartImage",resolveAll:jD.resolveAll,tokenize:HPe};function HPe(e,t,n){const r=this;return i;function i(c){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(c),e.exit("labelImageMarker"),o}function o(c){return c===91?(e.enter("labelMarker"),e.consume(c),e.exit("labelMarker"),e.exit("labelImage"),a):n(c)}function a(c){return c===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(c):t(c)}}const WPe={name:"labelStartLink",resolveAll:jD.resolveAll,tokenize:GPe};function GPe(e,t,n){const r=this;return i;function i(a){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(a),e.exit("labelMarker"),e.exit("labelLink"),o}function o(a){return a===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(a):t(a)}}const CE={name:"lineEnding",tokenize:YPe};function YPe(e,t){return n;function n(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),Xt(e,t,"linePrefix")}}const w0={name:"thematicBreak",tokenize:QPe};function QPe(e,t,n){let r=0,i;return o;function o(d){return e.enter("thematicBreak"),a(d)}function a(d){return i=d,c(d)}function c(d){return d===i?(e.enter("thematicBreakSequence"),u(d)):r>=3&&(d===null||lt(d))?(e.exit("thematicBreak"),t(d)):n(d)}function u(d){return d===i?(e.consume(d),r++,u):(e.exit("thematicBreakSequence"),zt(d)?Xt(e,c,"whitespace")(d):c(d))}}const so={continuation:{tokenize:eNe},exit:nNe,name:"list",tokenize:ZPe},XPe={partial:!0,tokenize:rNe},JPe={partial:!0,tokenize:tNe};function ZPe(e,t,n){const r=this,i=r.events[r.events.length-1];let o=i&&i[1].type==="linePrefix"?i[2].sliceSerialize(i[1],!0).length:0,a=0;return c;function c(y){const b=r.containerState.type||(y===42||y===43||y===45?"listUnordered":"listOrdered");if(b==="listUnordered"?!r.containerState.marker||y===r.containerState.marker:pM(y)){if(r.containerState.type||(r.containerState.type=b,e.enter(b,{_container:!0})),b==="listUnordered")return e.enter("listItemPrefix"),y===42||y===45?e.check(w0,n,d)(y):d(y);if(!r.interrupt||y===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),u(y)}return n(y)}function u(y){return pM(y)&&++a<10?(e.consume(y),u):(!r.interrupt||a<2)&&(r.containerState.marker?y===r.containerState.marker:y===41||y===46)?(e.exit("listItemValue"),d(y)):n(y)}function d(y){return e.enter("listItemMarker"),e.consume(y),e.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||y,e.check(Tb,r.interrupt?n:h,e.attempt(XPe,g,p))}function h(y){return r.containerState.initialBlankLine=!0,o++,g(y)}function p(y){return zt(y)?(e.enter("listItemPrefixWhitespace"),e.consume(y),e.exit("listItemPrefixWhitespace"),g):n(y)}function g(y){return r.containerState.size=o+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(y)}}function eNe(e,t,n){const r=this;return r.containerState._closeFlow=void 0,e.check(Tb,i,o);function i(c){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,Xt(e,t,"listItemIndent",r.containerState.size+1)(c)}function o(c){return r.containerState.furtherBlankLines||!zt(c)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,a(c)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(JPe,t,a)(c))}function a(c){return r.containerState._closeFlow=!0,r.interrupt=void 0,Xt(e,e.attempt(so,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(c)}}function tNe(e,t,n){const r=this;return Xt(e,i,"listItemIndent",r.containerState.size+1);function i(o){const a=r.events[r.events.length-1];return a&&a[1].type==="listItemIndent"&&a[2].sliceSerialize(a[1],!0).length===r.containerState.size?t(o):n(o)}}function nNe(e){e.exit(this.containerState.type)}function rNe(e,t,n){const r=this;return Xt(e,i,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function i(o){const a=r.events[r.events.length-1];return!zt(o)&&a&&a[1].type==="listItemPrefixWhitespace"?t(o):n(o)}}const lq={name:"setextUnderline",resolveTo:iNe,tokenize:oNe};function iNe(e,t){let n=e.length,r,i,o;for(;n--;)if(e[n][0]==="enter"){if(e[n][1].type==="content"){r=n;break}e[n][1].type==="paragraph"&&(i=n)}else e[n][1].type==="content"&&e.splice(n,1),!o&&e[n][1].type==="definition"&&(o=n);const a={type:"setextHeading",start:{...e[r][1].start},end:{...e[e.length-1][1].end}};return e[i][1].type="setextHeadingText",o?(e.splice(i,0,["enter",a,t]),e.splice(o+1,0,["exit",e[r][1],t]),e[r][1].end={...e[o][1].end}):e[r][1]=a,e.push(["exit",a,t]),e}function oNe(e,t,n){const r=this;let i;return o;function o(d){let h=r.events.length,p;for(;h--;)if(r.events[h][1].type!=="lineEnding"&&r.events[h][1].type!=="linePrefix"&&r.events[h][1].type!=="content"){p=r.events[h][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||p)?(e.enter("setextHeadingLine"),i=d,a(d)):n(d)}function a(d){return e.enter("setextHeadingLineSequence"),c(d)}function c(d){return d===i?(e.consume(d),c):(e.exit("setextHeadingLineSequence"),zt(d)?Xt(e,u,"lineSuffix")(d):u(d))}function u(d){return d===null||lt(d)?(e.exit("setextHeadingLine"),t(d)):n(d)}}const sNe={tokenize:aNe};function aNe(e){const t=this,n=e.attempt(Tb,r,e.attempt(this.parser.constructs.flowInitial,i,Xt(e,e.attempt(this.parser.constructs.flow,i,e.attempt(fPe,i)),"linePrefix")));return n;function r(o){if(o===null){e.consume(o);return}return e.enter("lineEndingBlank"),e.consume(o),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n}function i(o){if(o===null){e.consume(o);return}return e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),t.currentConstruct=void 0,n}}const lNe={resolveAll:j7()},cNe=$7("string"),uNe=$7("text");function $7(e){return{resolveAll:j7(e==="text"?dNe:void 0),tokenize:t};function t(n){const r=this,i=this.parser.constructs[e],o=n.attempt(i,a,c);return a;function a(h){return d(h)?o(h):c(h)}function c(h){if(h===null){n.consume(h);return}return n.enter("data"),n.consume(h),u}function u(h){return d(h)?(n.exit("data"),o(h)):(n.consume(h),u)}function d(h){if(h===null)return!0;const p=i[h];let g=-1;if(p)for(;++g<p.length;){const y=p[g];if(!y.previous||y.previous.call(r,r.previous))return!0}return!1}}}function j7(e){return t;function t(n,r){let i=-1,o;for(;++i<=n.length;)o===void 0?n[i]&&n[i][1].type==="data"&&(o=i,i++):(!n[i]||n[i][1].type!=="data")&&(i!==o+2&&(n[o][1].end=n[i-1][1].end,n.splice(o+2,i-o-2),i=o+2),o=void 0);return e?e(n,r):n}}function dNe(e,t){let n=0;for(;++n<=e.length;)if((n===e.length||e[n][1].type==="lineEnding")&&e[n-1][1].type==="data"){const r=e[n-1][1],i=t.sliceStream(r);let o=i.length,a=-1,c=0,u;for(;o--;){const d=i[o];if(typeof d=="string"){for(a=d.length;d.charCodeAt(a-1)===32;)c++,a--;if(a)break;a=-1}else if(d===-2)u=!0,c++;else if(d!==-1){o++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(c=0),c){const d={type:n===e.length||u||c<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:o?a:r.start._bufferIndex+a,_index:r.start._index+o,line:r.end.line,column:r.end.column-c,offset:r.end.offset-c},end:{...r.end}};r.end={...d.start},r.start.offset===r.end.offset?Object.assign(r,d):(e.splice(n,0,["enter",d,t],["exit",d,t]),n+=2)}n++}return e}const fNe={42:so,43:so,45:so,48:so,49:so,50:so,51:so,52:so,53:so,54:so,55:so,56:so,57:so,62:R7},hNe={91:yPe},pNe={[-2]:TE,[-1]:TE,32:TE},mNe={35:kPe,42:w0,45:[lq,w0],60:TPe,61:lq,95:w0,96:sq,126:sq},gNe={38:O7,92:A7},yNe={[-5]:CE,[-4]:CE,[-3]:CE,33:KPe,38:O7,42:mM,60:[WDe,PPe],91:WPe,92:[wPe,A7],93:jD,95:mM,96:sPe},bNe={null:[mM,lNe]},vNe={null:[42,95]},SNe={null:[]},wNe=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:vNe,contentInitial:hNe,disable:SNe,document:fNe,flow:mNe,flowInitial:pNe,insideSpan:bNe,string:gNe,text:yNe},Symbol.toStringTag,{value:"Module"}));function xNe(e,t,n){let r={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0};const i={},o=[];let a=[],c=[];const u={attempt:T(C),check:T(E),consume:I,enter:_,exit:M,interrupt:T(E,{interrupt:!0})},d={code:null,containerState:{},defineSkip:S,events:[],now:b,parser:e,previous:null,sliceSerialize:g,sliceStream:y,write:p};let h=t.tokenize.call(d,u);return t.resolveAll&&o.push(t),d;function p(N){return a=ps(a,N),w(),a[a.length-1]!==null?[]:(A(t,0),d.events=Ck(o,d.events,d),d.events)}function g(N,L){return _Ne(y(N),L)}function y(N){return kNe(a,N)}function b(){const{_bufferIndex:N,_index:L,line:B,column:j,offset:$}=r;return{_bufferIndex:N,_index:L,line:B,column:j,offset:$}}function S(N){i[N.line]=N.column,R()}function w(){let N;for(;r._index<a.length;){const L=a[r._index];if(typeof L=="string")for(N=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===N&&r._bufferIndex<L.length;)x(L.charCodeAt(r._bufferIndex));else x(L)}}function x(N){h=h(N)}function I(N){lt(N)?(r.line++,r.column=1,r.offset+=N===-3?2:1,R()):N!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===a[r._index].length&&(r._bufferIndex=-1,r._index++)),d.previous=N}function _(N,L){const B=L||{};return B.type=N,B.start=b(),d.events.push(["enter",B,d]),c.push(B),B}function M(N){const L=c.pop();return L.end=b(),d.events.push(["exit",L,d]),L}function C(N,L){A(N,L.from)}function E(N,L){L.restore()}function T(N,L){return B;function B(j,$,F){let K,W,X,V;return Array.isArray(j)?Q(j):"tokenize"in j?Q([j]):z(j);function z(ee){return J;function J(ge){const te=ge!==null&&ee[ge],pe=ge!==null&&ee.null,oe=[...Array.isArray(te)?te:te?[te]:[],...Array.isArray(pe)?pe:pe?[pe]:[]];return Q(oe)(ge)}}function Q(ee){return K=ee,W=0,ee.length===0?F:q(ee[W])}function q(ee){return J;function J(ge){return V=U(),X=ee,ee.partial||(d.currentConstruct=ee),ee.name&&d.parser.constructs.disable.null.includes(ee.name)?le():ee.tokenize.call(L?Object.assign(Object.create(d),L):d,u,ie,le)(ge)}}function ie(ee){return N(X,V),$}function le(ee){return V.restore(),++W<K.length?q(K[W]):F}}}function A(N,L){N.resolveAll&&!o.includes(N)&&o.push(N),N.resolve&&Vo(d.events,L,d.events.length-L,N.resolve(d.events.slice(L),d)),N.resolveTo&&(d.events=N.resolveTo(d.events,d))}function U(){const N=b(),L=d.previous,B=d.currentConstruct,j=d.events.length,$=Array.from(c);return{from:j,restore:F};function F(){r=N,d.previous=L,d.currentConstruct=B,d.events.length=j,c=$,R()}}function R(){r.line in i&&r.column<2&&(r.column=i[r.line],r.offset+=i[r.line]-1)}}function kNe(e,t){const n=t.start._index,r=t.start._bufferIndex,i=t.end._index,o=t.end._bufferIndex;let a;if(n===i)a=[e[n].slice(r,o)];else{if(a=e.slice(n,i),r>-1){const c=a[0];typeof c=="string"?a[0]=c.slice(r):a.shift()}o>0&&a.push(e[i].slice(0,o))}return a}function _Ne(e,t){let n=-1;const r=[];let i;for(;++n<e.length;){const o=e[n];let a;if(typeof o=="string")a=o;else switch(o){case-5:{a="\r";break}case-4:{a=`
158
+ `;break}case-3:{a=`\r
159
+ `;break}case-2:{a=t?" ":" ";break}case-1:{if(!t&&i)continue;a=" ";break}default:a=String.fromCharCode(o)}i=o===-2,r.push(a)}return r.join("")}function INe(e){const r={constructs:C7([wNe,...(e||{}).extensions||[]]),content:i(zDe),defined:[],document:i(qDe),flow:i(sNe),lazy:{},string:i(cNe),text:i(uNe)};return r;function i(o){return a;function a(c){return xNe(r,o,c)}}}function ENe(e){for(;!D7(e););return e}const cq=/[\0\t\n\r]/g;function TNe(){let e=1,t="",n=!0,r;return i;function i(o,a,c){const u=[];let d,h,p,g,y;for(o=t+(typeof o=="string"?o.toString():new TextDecoder(a||void 0).decode(o)),p=0,t="",n&&(o.charCodeAt(0)===65279&&p++,n=void 0);p<o.length;){if(cq.lastIndex=p,d=cq.exec(o),g=d&&d.index!==void 0?d.index:o.length,y=o.charCodeAt(g),!d){t=o.slice(p);break}if(y===10&&p===g&&r)u.push(-3),r=void 0;else switch(r&&(u.push(-5),r=void 0),p<g&&(u.push(o.slice(p,g)),e+=g-p),y){case 0:{u.push(65533),e++;break}case 9:{for(h=Math.ceil(e/4)*4,u.push(-2);e++<h;)u.push(-1);break}case 10:{u.push(-4),e=1;break}default:r=!0,e=1}p=g+1}return c&&(r&&u.push(-5),t&&u.push(t),u.push(null)),u}}const CNe=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function MNe(e){return e.replace(CNe,RNe)}function RNe(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const i=n.charCodeAt(1),o=i===120||i===88;return M7(n.slice(o?2:1),o?16:10)}return $D(n)||e}const F7={}.hasOwnProperty;function ANe(e,t,n){return typeof t!="string"&&(n=t,t=void 0),ONe(n)(ENe(INe(n).document().write(TNe()(e,t,!0))))}function ONe(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:o(Ct),autolinkProtocol:U,autolinkEmail:U,atxHeading:o(Ge),blockQuote:o(pe),characterEscape:U,characterReference:U,codeFenced:o(oe),codeFencedFenceInfo:a,codeFencedFenceMeta:a,codeIndented:o(oe,a),codeText:o(ye,a),codeTextData:U,data:U,codeFlowValue:U,definition:o(xe),definitionDestinationString:a,definitionLabelString:a,definitionTitleString:a,emphasis:o(je),hardBreakEscape:o(it),hardBreakTrailing:o(it),htmlFlow:o(ut,a),htmlFlowData:U,htmlText:o(ut,a),htmlTextData:U,image:o(Dt),label:a,link:o(Ct),listItem:o(Jn),listItemValue:g,listOrdered:o(wt,p),listUnordered:o(wt),paragraph:o(yt),reference:q,referenceString:a,resourceDestinationString:a,resourceTitleString:a,setextHeading:o(Ge),strong:o(pn),thematicBreak:o(On)},exit:{atxHeading:u(),atxHeadingSequence:C,autolink:u(),autolinkEmail:te,autolinkProtocol:ge,blockQuote:u(),characterEscapeValue:R,characterReferenceMarkerHexadecimal:le,characterReferenceMarkerNumeric:le,characterReferenceValue:ee,characterReference:J,codeFenced:u(w),codeFencedFence:S,codeFencedFenceInfo:y,codeFencedFenceMeta:b,codeFlowValue:R,codeIndented:u(x),codeText:u($),codeTextData:R,data:R,definition:u(),definitionDestinationString:M,definitionLabelString:I,definitionTitleString:_,emphasis:u(),hardBreakEscape:u(L),hardBreakTrailing:u(L),htmlFlow:u(B),htmlFlowData:R,htmlText:u(j),htmlTextData:R,image:u(K),label:X,labelText:W,lineEnding:N,link:u(F),listItem:u(),listOrdered:u(),listUnordered:u(),paragraph:u(),referenceString:ie,resourceDestinationString:V,resourceTitleString:z,resource:Q,setextHeading:u(A),setextHeadingLineSequence:T,setextHeadingText:E,strong:u(),thematicBreak:u()}};z7(t,(e||{}).mdastExtensions||[]);const n={};return r;function r(he){let _e={type:"root",children:[]};const Pe={stack:[_e],tokenStack:[],config:t,enter:c,exit:d,buffer:a,resume:h,data:n},Ke=[];let dt=-1;for(;++dt<he.length;)if(he[dt][1].type==="listOrdered"||he[dt][1].type==="listUnordered")if(he[dt][0]==="enter")Ke.push(dt);else{const tn=Ke.pop();dt=i(he,tn,dt)}for(dt=-1;++dt<he.length;){const tn=t[he[dt][0]];F7.call(tn,he[dt][1].type)&&tn[he[dt][1].type].call(Object.assign({sliceSerialize:he[dt][2].sliceSerialize},Pe),he[dt][1])}if(Pe.tokenStack.length>0){const tn=Pe.tokenStack[Pe.tokenStack.length-1];(tn[1]||uq).call(Pe,void 0,tn[0])}for(_e.position={start:yc(he.length>0?he[0][1].start:{line:1,column:1,offset:0}),end:yc(he.length>0?he[he.length-2][1].end:{line:1,column:1,offset:0})},dt=-1;++dt<t.transforms.length;)_e=t.transforms[dt](_e)||_e;return _e}function i(he,_e,Pe){let Ke=_e-1,dt=-1,tn=!1,Fn,mn,Qe,Ne;for(;++Ke<=Pe;){const He=he[Ke];switch(He[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{He[0]==="enter"?dt++:dt--,Ne=void 0;break}case"lineEndingBlank":{He[0]==="enter"&&(Fn&&!Ne&&!dt&&!Qe&&(Qe=Ke),Ne=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:Ne=void 0}if(!dt&&He[0]==="enter"&&He[1].type==="listItemPrefix"||dt===-1&&He[0]==="exit"&&(He[1].type==="listUnordered"||He[1].type==="listOrdered")){if(Fn){let kt=Ke;for(mn=void 0;kt--;){const cn=he[kt];if(cn[1].type==="lineEnding"||cn[1].type==="lineEndingBlank"){if(cn[0]==="exit")continue;mn&&(he[mn][1].type="lineEndingBlank",tn=!0),cn[1].type="lineEnding",mn=kt}else if(!(cn[1].type==="linePrefix"||cn[1].type==="blockQuotePrefix"||cn[1].type==="blockQuotePrefixWhitespace"||cn[1].type==="blockQuoteMarker"||cn[1].type==="listItemIndent"))break}Qe&&(!mn||Qe<mn)&&(Fn._spread=!0),Fn.end=Object.assign({},mn?he[mn][1].start:He[1].end),he.splice(mn||Ke,0,["exit",Fn,He[2]]),Ke++,Pe++}if(He[1].type==="listItemPrefix"){const kt={type:"listItem",_spread:!1,start:Object.assign({},He[1].start),end:void 0};Fn=kt,he.splice(Ke,0,["enter",kt,He[2]]),Ke++,Pe++,Qe=void 0,Ne=!0}}}return he[_e][1]._spread=tn,Pe}function o(he,_e){return Pe;function Pe(Ke){c.call(this,he(Ke),Ke),_e&&_e.call(this,Ke)}}function a(){this.stack.push({type:"fragment",children:[]})}function c(he,_e,Pe){this.stack[this.stack.length-1].children.push(he),this.stack.push(he),this.tokenStack.push([_e,Pe||void 0]),he.position={start:yc(_e.start),end:void 0}}function u(he){return _e;function _e(Pe){he&&he.call(this,Pe),d.call(this,Pe)}}function d(he,_e){const Pe=this.stack.pop(),Ke=this.tokenStack.pop();if(Ke)Ke[0].type!==he.type&&(_e?_e.call(this,he,Ke[0]):(Ke[1]||uq).call(this,he,Ke[0]));else throw new Error("Cannot close `"+he.type+"` ("+Rg({start:he.start,end:he.end})+"): it’s not open");Pe.position.end=yc(he.end)}function h(){return LD(this.stack.pop())}function p(){this.data.expectingFirstListItemValue=!0}function g(he){if(this.data.expectingFirstListItemValue){const _e=this.stack[this.stack.length-2];_e.start=Number.parseInt(this.sliceSerialize(he),10),this.data.expectingFirstListItemValue=void 0}}function y(){const he=this.resume(),_e=this.stack[this.stack.length-1];_e.lang=he}function b(){const he=this.resume(),_e=this.stack[this.stack.length-1];_e.meta=he}function S(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function w(){const he=this.resume(),_e=this.stack[this.stack.length-1];_e.value=he.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function x(){const he=this.resume(),_e=this.stack[this.stack.length-1];_e.value=he.replace(/(\r?\n|\r)$/g,"")}function I(he){const _e=this.resume(),Pe=this.stack[this.stack.length-1];Pe.label=_e,Pe.identifier=Ys(this.sliceSerialize(he)).toLowerCase()}function _(){const he=this.resume(),_e=this.stack[this.stack.length-1];_e.title=he}function M(){const he=this.resume(),_e=this.stack[this.stack.length-1];_e.url=he}function C(he){const _e=this.stack[this.stack.length-1];if(!_e.depth){const Pe=this.sliceSerialize(he).length;_e.depth=Pe}}function E(){this.data.setextHeadingSlurpLineEnding=!0}function T(he){const _e=this.stack[this.stack.length-1];_e.depth=this.sliceSerialize(he).codePointAt(0)===61?1:2}function A(){this.data.setextHeadingSlurpLineEnding=void 0}function U(he){const Pe=this.stack[this.stack.length-1].children;let Ke=Pe[Pe.length-1];(!Ke||Ke.type!=="text")&&(Ke=$t(),Ke.position={start:yc(he.start),end:void 0},Pe.push(Ke)),this.stack.push(Ke)}function R(he){const _e=this.stack.pop();_e.value+=this.sliceSerialize(he),_e.position.end=yc(he.end)}function N(he){const _e=this.stack[this.stack.length-1];if(this.data.atHardBreak){const Pe=_e.children[_e.children.length-1];Pe.position.end=yc(he.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(_e.type)&&(U.call(this,he),R.call(this,he))}function L(){this.data.atHardBreak=!0}function B(){const he=this.resume(),_e=this.stack[this.stack.length-1];_e.value=he}function j(){const he=this.resume(),_e=this.stack[this.stack.length-1];_e.value=he}function $(){const he=this.resume(),_e=this.stack[this.stack.length-1];_e.value=he}function F(){const he=this.stack[this.stack.length-1];if(this.data.inReference){const _e=this.data.referenceType||"shortcut";he.type+="Reference",he.referenceType=_e,delete he.url,delete he.title}else delete he.identifier,delete he.label;this.data.referenceType=void 0}function K(){const he=this.stack[this.stack.length-1];if(this.data.inReference){const _e=this.data.referenceType||"shortcut";he.type+="Reference",he.referenceType=_e,delete he.url,delete he.title}else delete he.identifier,delete he.label;this.data.referenceType=void 0}function W(he){const _e=this.sliceSerialize(he),Pe=this.stack[this.stack.length-2];Pe.label=MNe(_e),Pe.identifier=Ys(_e).toLowerCase()}function X(){const he=this.stack[this.stack.length-1],_e=this.resume(),Pe=this.stack[this.stack.length-1];if(this.data.inReference=!0,Pe.type==="link"){const Ke=he.children;Pe.children=Ke}else Pe.alt=_e}function V(){const he=this.resume(),_e=this.stack[this.stack.length-1];_e.url=he}function z(){const he=this.resume(),_e=this.stack[this.stack.length-1];_e.title=he}function Q(){this.data.inReference=void 0}function q(){this.data.referenceType="collapsed"}function ie(he){const _e=this.resume(),Pe=this.stack[this.stack.length-1];Pe.label=_e,Pe.identifier=Ys(this.sliceSerialize(he)).toLowerCase(),this.data.referenceType="full"}function le(he){this.data.characterReferenceType=he.type}function ee(he){const _e=this.sliceSerialize(he),Pe=this.data.characterReferenceType;let Ke;Pe?(Ke=M7(_e,Pe==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):Ke=$D(_e);const dt=this.stack[this.stack.length-1];dt.value+=Ke}function J(he){const _e=this.stack.pop();_e.position.end=yc(he.end)}function ge(he){R.call(this,he);const _e=this.stack[this.stack.length-1];_e.url=this.sliceSerialize(he)}function te(he){R.call(this,he);const _e=this.stack[this.stack.length-1];_e.url="mailto:"+this.sliceSerialize(he)}function pe(){return{type:"blockquote",children:[]}}function oe(){return{type:"code",lang:null,meta:null,value:""}}function ye(){return{type:"inlineCode",value:""}}function xe(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function je(){return{type:"emphasis",children:[]}}function Ge(){return{type:"heading",depth:0,children:[]}}function it(){return{type:"break"}}function ut(){return{type:"html",value:""}}function Dt(){return{type:"image",title:null,url:"",alt:null}}function Ct(){return{type:"link",title:null,url:"",children:[]}}function wt(he){return{type:"list",ordered:he.type==="listOrdered",start:null,spread:he._spread,children:[]}}function Jn(he){return{type:"listItem",spread:he._spread,checked:null,children:[]}}function yt(){return{type:"paragraph",children:[]}}function pn(){return{type:"strong",children:[]}}function $t(){return{type:"text",value:""}}function On(){return{type:"thematicBreak"}}}function yc(e){return{line:e.line,column:e.column,offset:e.offset}}function z7(e,t){let n=-1;for(;++n<t.length;){const r=t[n];Array.isArray(r)?z7(e,r):DNe(e,r)}}function DNe(e,t){let n;for(n in t)if(F7.call(t,n))switch(n){case"canContainEols":{const r=t[n];r&&e[n].push(...r);break}case"transforms":{const r=t[n];r&&e[n].push(...r);break}case"enter":case"exit":{const r=t[n];r&&Object.assign(e[n],r);break}}}function uq(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+Rg({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+Rg({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+Rg({start:t.start,end:t.end})+") is still open")}function PNe(e){const t=this;t.parser=n;function n(r){return ANe(r,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function NNe(e,t){const n={type:"element",tagName:"blockquote",properties:{},children:e.wrap(e.all(t),!0)};return e.patch(t,n),e.applyData(t,n)}function LNe(e,t){const n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:`
160
+ `}]}function $Ne(e,t){const n=t.value?t.value+`
161
+ `:"",r={},i=t.lang?t.lang.split(/\s+/):[];i.length>0&&(r.className=["language-"+i[0]]);let o={type:"element",tagName:"code",properties:r,children:[{type:"text",value:n}]};return t.meta&&(o.data={meta:t.meta}),e.patch(t,o),o=e.applyData(t,o),o={type:"element",tagName:"pre",properties:{},children:[o]},e.patch(t,o),o}function jNe(e,t){const n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function FNe(e,t){const n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function zNe(e,t){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",r=String(t.identifier).toUpperCase(),i=$p(r.toLowerCase()),o=e.footnoteOrder.indexOf(r);let a,c=e.footnoteCounts.get(r);c===void 0?(c=0,e.footnoteOrder.push(r),a=e.footnoteOrder.length):a=o+1,c+=1,e.footnoteCounts.set(r,c);const u={type:"element",tagName:"a",properties:{href:"#"+n+"fn-"+i,id:n+"fnref-"+i+(c>1?"-"+c:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(a)}]};e.patch(t,u);const d={type:"element",tagName:"sup",properties:{},children:[u]};return e.patch(t,d),e.applyData(t,d)}function BNe(e,t){const n={type:"element",tagName:"h"+t.depth,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function qNe(e,t){if(e.options.allowDangerousHtml){const n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}}function B7(e,t){const n=t.referenceType;let r="]";if(n==="collapsed"?r+="[]":n==="full"&&(r+="["+(t.label||t.identifier)+"]"),t.type==="imageReference")return[{type:"text",value:"!["+t.alt+r}];const i=e.all(t),o=i[0];o&&o.type==="text"?o.value="["+o.value:i.unshift({type:"text",value:"["});const a=i[i.length-1];return a&&a.type==="text"?a.value+=r:i.push({type:"text",value:r}),i}function UNe(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return B7(e,t);const i={src:$p(r.url||""),alt:t.alt};r.title!==null&&r.title!==void 0&&(i.title=r.title);const o={type:"element",tagName:"img",properties:i,children:[]};return e.patch(t,o),e.applyData(t,o)}function VNe(e,t){const n={src:$p(t.url)};t.alt!==null&&t.alt!==void 0&&(n.alt=t.alt),t.title!==null&&t.title!==void 0&&(n.title=t.title);const r={type:"element",tagName:"img",properties:n,children:[]};return e.patch(t,r),e.applyData(t,r)}function KNe(e,t){const n={type:"text",value:t.value.replace(/\r?\n|\r/g," ")};e.patch(t,n);const r={type:"element",tagName:"code",properties:{},children:[n]};return e.patch(t,r),e.applyData(t,r)}function HNe(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return B7(e,t);const i={href:$p(r.url||"")};r.title!==null&&r.title!==void 0&&(i.title=r.title);const o={type:"element",tagName:"a",properties:i,children:e.all(t)};return e.patch(t,o),e.applyData(t,o)}function WNe(e,t){const n={href:$p(t.url)};t.title!==null&&t.title!==void 0&&(n.title=t.title);const r={type:"element",tagName:"a",properties:n,children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function GNe(e,t,n){const r=e.all(t),i=n?YNe(n):q7(t),o={},a=[];if(typeof t.checked=="boolean"){const h=r[0];let p;h&&h.type==="element"&&h.tagName==="p"?p=h:(p={type:"element",tagName:"p",properties:{},children:[]},r.unshift(p)),p.children.length>0&&p.children.unshift({type:"text",value:" "}),p.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:t.checked,disabled:!0},children:[]}),o.className=["task-list-item"]}let c=-1;for(;++c<r.length;){const h=r[c];(i||c!==0||h.type!=="element"||h.tagName!=="p")&&a.push({type:"text",value:`
162
+ `}),h.type==="element"&&h.tagName==="p"&&!i?a.push(...h.children):a.push(h)}const u=r[r.length-1];u&&(i||u.type!=="element"||u.tagName!=="p")&&a.push({type:"text",value:`
163
+ `});const d={type:"element",tagName:"li",properties:o,children:a};return e.patch(t,d),e.applyData(t,d)}function YNe(e){let t=!1;if(e.type==="list"){t=e.spread||!1;const n=e.children;let r=-1;for(;!t&&++r<n.length;)t=q7(n[r])}return t}function q7(e){const t=e.spread;return t??e.children.length>1}function QNe(e,t){const n={},r=e.all(t);let i=-1;for(typeof t.start=="number"&&t.start!==1&&(n.start=t.start);++i<r.length;){const a=r[i];if(a.type==="element"&&a.tagName==="li"&&a.properties&&Array.isArray(a.properties.className)&&a.properties.className.includes("task-list-item")){n.className=["contains-task-list"];break}}const o={type:"element",tagName:t.ordered?"ol":"ul",properties:n,children:e.wrap(r,!0)};return e.patch(t,o),e.applyData(t,o)}function XNe(e,t){const n={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function JNe(e,t){const n={type:"root",children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)}function ZNe(e,t){const n={type:"element",tagName:"strong",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function eLe(e,t){const n=e.all(t),r=n.shift(),i=[];if(r){const a={type:"element",tagName:"thead",properties:{},children:e.wrap([r],!0)};e.patch(t.children[0],a),i.push(a)}if(n.length>0){const a={type:"element",tagName:"tbody",properties:{},children:e.wrap(n,!0)},c=OD(t.children[1]),u=w7(t.children[t.children.length-1]);c&&u&&(a.position={start:c,end:u}),i.push(a)}const o={type:"element",tagName:"table",properties:{},children:e.wrap(i,!0)};return e.patch(t,o),e.applyData(t,o)}function tLe(e,t,n){const r=n?n.children:void 0,o=(r?r.indexOf(t):1)===0?"th":"td",a=n&&n.type==="table"?n.align:void 0,c=a?a.length:t.children.length;let u=-1;const d=[];for(;++u<c;){const p=t.children[u],g={},y=a?a[u]:void 0;y&&(g.align=y);let b={type:"element",tagName:o,properties:g,children:[]};p&&(b.children=e.all(p),e.patch(p,b),b=e.applyData(p,b)),d.push(b)}const h={type:"element",tagName:"tr",properties:{},children:e.wrap(d,!0)};return e.patch(t,h),e.applyData(t,h)}function nLe(e,t){const n={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}const dq=9,fq=32;function rLe(e){const t=String(e),n=/\r?\n|\r/g;let r=n.exec(t),i=0;const o=[];for(;r;)o.push(hq(t.slice(i,r.index),i>0,!0),r[0]),i=r.index+r[0].length,r=n.exec(t);return o.push(hq(t.slice(i),i>0,!1)),o.join("")}function hq(e,t,n){let r=0,i=e.length;if(t){let o=e.codePointAt(r);for(;o===dq||o===fq;)r++,o=e.codePointAt(r)}if(n){let o=e.codePointAt(i-1);for(;o===dq||o===fq;)i--,o=e.codePointAt(i-1)}return i>r?e.slice(r,i):""}function iLe(e,t){const n={type:"text",value:rLe(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function oLe(e,t){const n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}const sLe={blockquote:NNe,break:LNe,code:$Ne,delete:jNe,emphasis:FNe,footnoteReference:zNe,heading:BNe,html:qNe,imageReference:UNe,image:VNe,inlineCode:KNe,linkReference:HNe,link:WNe,listItem:GNe,list:QNe,paragraph:XNe,root:JNe,strong:ZNe,table:eLe,tableCell:nLe,tableRow:tLe,text:iLe,thematicBreak:oLe,toml:DS,yaml:DS,definition:DS,footnoteDefinition:DS};function DS(){}const U7=-1,Mk=0,Og=1,Bw=2,FD=3,zD=4,BD=5,qD=6,V7=7,K7=8,pq=typeof self=="object"?self:globalThis,aLe=(e,t)=>{const n=(i,o)=>(e.set(o,i),i),r=i=>{if(e.has(i))return e.get(i);const[o,a]=t[i];switch(o){case Mk:case U7:return n(a,i);case Og:{const c=n([],i);for(const u of a)c.push(r(u));return c}case Bw:{const c=n({},i);for(const[u,d]of a)c[r(u)]=r(d);return c}case FD:return n(new Date(a),i);case zD:{const{source:c,flags:u}=a;return n(new RegExp(c,u),i)}case BD:{const c=n(new Map,i);for(const[u,d]of a)c.set(r(u),r(d));return c}case qD:{const c=n(new Set,i);for(const u of a)c.add(r(u));return c}case V7:{const{name:c,message:u}=a;return n(new pq[c](u),i)}case K7:return n(BigInt(a),i);case"BigInt":return n(Object(BigInt(a)),i);case"ArrayBuffer":return n(new Uint8Array(a).buffer,a);case"DataView":{const{buffer:c}=new Uint8Array(a);return n(new DataView(c),a)}}return n(new pq[o](a),i)};return r},mq=e=>aLe(new Map,e)(0),Wf="",{toString:lLe}={},{keys:cLe}=Object,Gm=e=>{const t=typeof e;if(t!=="object"||!e)return[Mk,t];const n=lLe.call(e).slice(8,-1);switch(n){case"Array":return[Og,Wf];case"Object":return[Bw,Wf];case"Date":return[FD,Wf];case"RegExp":return[zD,Wf];case"Map":return[BD,Wf];case"Set":return[qD,Wf];case"DataView":return[Og,n]}return n.includes("Array")?[Og,n]:n.includes("Error")?[V7,n]:[Bw,n]},PS=([e,t])=>e===Mk&&(t==="function"||t==="symbol"),uLe=(e,t,n,r)=>{const i=(a,c)=>{const u=r.push(a)-1;return n.set(c,u),u},o=a=>{if(n.has(a))return n.get(a);let[c,u]=Gm(a);switch(c){case Mk:{let h=a;switch(u){case"bigint":c=K7,h=a.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+u);h=null;break;case"undefined":return i([U7],a)}return i([c,h],a)}case Og:{if(u){let g=a;return u==="DataView"?g=new Uint8Array(a.buffer):u==="ArrayBuffer"&&(g=new Uint8Array(a)),i([u,[...g]],a)}const h=[],p=i([c,h],a);for(const g of a)h.push(o(g));return p}case Bw:{if(u)switch(u){case"BigInt":return i([u,a.toString()],a);case"Boolean":case"Number":case"String":return i([u,a.valueOf()],a)}if(t&&"toJSON"in a)return o(a.toJSON());const h=[],p=i([c,h],a);for(const g of cLe(a))(e||!PS(Gm(a[g])))&&h.push([o(g),o(a[g])]);return p}case FD:return i([c,a.toISOString()],a);case zD:{const{source:h,flags:p}=a;return i([c,{source:h,flags:p}],a)}case BD:{const h=[],p=i([c,h],a);for(const[g,y]of a)(e||!(PS(Gm(g))||PS(Gm(y))))&&h.push([o(g),o(y)]);return p}case qD:{const h=[],p=i([c,h],a);for(const g of a)(e||!PS(Gm(g)))&&h.push(o(g));return p}}const{message:d}=a;return i([c,{name:u,message:d}],a)};return o},gq=(e,{json:t,lossy:n}={})=>{const r=[];return uLe(!(t||n),!!t,new Map,r)(e),r},qw=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?mq(gq(e,t)):structuredClone(e):(e,t)=>mq(gq(e,t));function dLe(e,t){const n=[{type:"text",value:"↩"}];return t>1&&n.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(t)}]}),n}function fLe(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function hLe(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",n=e.options.footnoteBackContent||dLe,r=e.options.footnoteBackLabel||fLe,i=e.options.footnoteLabel||"Footnotes",o=e.options.footnoteLabelTagName||"h2",a=e.options.footnoteLabelProperties||{className:["sr-only"]},c=[];let u=-1;for(;++u<e.footnoteOrder.length;){const d=e.footnoteById.get(e.footnoteOrder[u]);if(!d)continue;const h=e.all(d),p=String(d.identifier).toUpperCase(),g=$p(p.toLowerCase());let y=0;const b=[],S=e.footnoteCounts.get(p);for(;S!==void 0&&++y<=S;){b.length>0&&b.push({type:"text",value:" "});let I=typeof n=="string"?n:n(u,y);typeof I=="string"&&(I={type:"text",value:I}),b.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+g+(y>1?"-"+y:""),dataFootnoteBackref:"",ariaLabel:typeof r=="string"?r:r(u,y),className:["data-footnote-backref"]},children:Array.isArray(I)?I:[I]})}const w=h[h.length-1];if(w&&w.type==="element"&&w.tagName==="p"){const I=w.children[w.children.length-1];I&&I.type==="text"?I.value+=" ":w.children.push({type:"text",value:" "}),w.children.push(...b)}else h.push(...b);const x={type:"element",tagName:"li",properties:{id:t+"fn-"+g},children:e.wrap(h,!0)};e.patch(d,x),c.push(x)}if(c.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:o,properties:{...qw(a),id:"footnote-label"},children:[{type:"text",value:i}]},{type:"text",value:`
164
+ `},{type:"element",tagName:"ol",properties:{},children:e.wrap(c,!0)},{type:"text",value:`
165
+ `}]}}const Rk=(function(e){if(e==null)return yLe;if(typeof e=="function")return Ak(e);if(typeof e=="object")return Array.isArray(e)?pLe(e):mLe(e);if(typeof e=="string")return gLe(e);throw new Error("Expected function, string, or object as test")});function pLe(e){const t=[];let n=-1;for(;++n<e.length;)t[n]=Rk(e[n]);return Ak(r);function r(...i){let o=-1;for(;++o<t.length;)if(t[o].apply(this,i))return!0;return!1}}function mLe(e){const t=e;return Ak(n);function n(r){const i=r;let o;for(o in e)if(i[o]!==t[o])return!1;return!0}}function gLe(e){return Ak(t);function t(n){return n&&n.type===e}}function Ak(e){return t;function t(n,r,i){return!!(bLe(n)&&e.call(this,n,typeof r=="number"?r:void 0,i||void 0))}}function yLe(){return!0}function bLe(e){return e!==null&&typeof e=="object"&&"type"in e}const H7=[],vLe=!0,gM=!1,SLe="skip";function W7(e,t,n,r){let i;typeof t=="function"&&typeof n!="function"?(r=n,n=t):i=t;const o=Rk(i),a=r?-1:1;c(e,void 0,[])();function c(u,d,h){const p=u&&typeof u=="object"?u:{};if(typeof p.type=="string"){const y=typeof p.tagName=="string"?p.tagName:typeof p.name=="string"?p.name:void 0;Object.defineProperty(g,"name",{value:"node ("+(u.type+(y?"<"+y+">":""))+")"})}return g;function g(){let y=H7,b,S,w;if((!t||o(u,d,h[h.length-1]||void 0))&&(y=wLe(n(u,h)),y[0]===gM))return y;if("children"in u&&u.children){const x=u;if(x.children&&y[0]!==SLe)for(S=(r?x.children.length:-1)+a,w=h.concat(x);S>-1&&S<x.children.length;){const I=x.children[S];if(b=c(I,S,w)(),b[0]===gM)return b;S=typeof b[1]=="number"?b[1]:S+a}}return y}}}function wLe(e){return Array.isArray(e)?e:typeof e=="number"?[vLe,e]:e==null?H7:[e]}function UD(e,t,n,r){let i,o,a;typeof t=="function"&&typeof n!="function"?(o=void 0,a=t,i=n):(o=t,a=n,i=r),W7(e,o,c,i);function c(u,d){const h=d[d.length-1],p=h?h.children.indexOf(u):void 0;return a(u,p,h)}}const yM={}.hasOwnProperty,xLe={};function kLe(e,t){const n=t||xLe,r=new Map,i=new Map,o=new Map,a={...sLe,...n.handlers},c={all:d,applyData:ILe,definitionById:r,footnoteById:i,footnoteCounts:o,footnoteOrder:[],handlers:a,one:u,options:n,patch:_Le,wrap:TLe};return UD(e,function(h){if(h.type==="definition"||h.type==="footnoteDefinition"){const p=h.type==="definition"?r:i,g=String(h.identifier).toUpperCase();p.has(g)||p.set(g,h)}}),c;function u(h,p){const g=h.type,y=c.handlers[g];if(yM.call(c.handlers,g)&&y)return y(c,h,p);if(c.options.passThrough&&c.options.passThrough.includes(g)){if("children"in h){const{children:S,...w}=h,x=qw(w);return x.children=c.all(h),x}return qw(h)}return(c.options.unknownHandler||ELe)(c,h,p)}function d(h){const p=[];if("children"in h){const g=h.children;let y=-1;for(;++y<g.length;){const b=c.one(g[y],h);if(b){if(y&&g[y-1].type==="break"&&(!Array.isArray(b)&&b.type==="text"&&(b.value=yq(b.value)),!Array.isArray(b)&&b.type==="element")){const S=b.children[0];S&&S.type==="text"&&(S.value=yq(S.value))}Array.isArray(b)?p.push(...b):p.push(b)}}}return p}}function _Le(e,t){e.position&&(t.position=fDe(e))}function ILe(e,t){let n=t;if(e&&e.data){const r=e.data.hName,i=e.data.hChildren,o=e.data.hProperties;if(typeof r=="string")if(n.type==="element")n.tagName=r;else{const a="children"in n?n.children:[n];n={type:"element",tagName:r,properties:{},children:a}}n.type==="element"&&o&&Object.assign(n.properties,qw(o)),"children"in n&&n.children&&i!==null&&i!==void 0&&(n.children=i)}return n}function ELe(e,t){const n=t.data||{},r="value"in t&&!(yM.call(n,"hProperties")||yM.call(n,"hChildren"))?{type:"text",value:t.value}:{type:"element",tagName:"div",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function TLe(e,t){const n=[];let r=-1;for(t&&n.push({type:"text",value:`
166
+ `});++r<e.length;)r&&n.push({type:"text",value:`
167
+ `}),n.push(e[r]);return t&&e.length>0&&n.push({type:"text",value:`
168
+ `}),n}function yq(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function bq(e,t){const n=kLe(e,t),r=n.one(e,void 0),i=hLe(n),o=Array.isArray(r)?{type:"root",children:r}:r||{type:"root",children:[]};return i&&o.children.push({type:"text",value:`
169
+ `},i),o}function CLe(e,t){return e&&"run"in e?async function(n,r){const i=bq(n,{file:r,...t});await e.run(i,r)}:function(n,r){return bq(n,{file:r,...e||t})}}function vq(e){if(e)throw e}var ME,Sq;function MLe(){if(Sq)return ME;Sq=1;var e=Object.prototype.hasOwnProperty,t=Object.prototype.toString,n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,i=function(d){return typeof Array.isArray=="function"?Array.isArray(d):t.call(d)==="[object Array]"},o=function(d){if(!d||t.call(d)!=="[object Object]")return!1;var h=e.call(d,"constructor"),p=d.constructor&&d.constructor.prototype&&e.call(d.constructor.prototype,"isPrototypeOf");if(d.constructor&&!h&&!p)return!1;var g;for(g in d);return typeof g>"u"||e.call(d,g)},a=function(d,h){n&&h.name==="__proto__"?n(d,h.name,{enumerable:!0,configurable:!0,value:h.newValue,writable:!0}):d[h.name]=h.newValue},c=function(d,h){if(h==="__proto__")if(e.call(d,h)){if(r)return r(d,h).value}else return;return d[h]};return ME=function u(){var d,h,p,g,y,b,S=arguments[0],w=1,x=arguments.length,I=!1;for(typeof S=="boolean"&&(I=S,S=arguments[1]||{},w=2),(S==null||typeof S!="object"&&typeof S!="function")&&(S={});w<x;++w)if(d=arguments[w],d!=null)for(h in d)p=c(S,h),g=c(d,h),S!==g&&(I&&g&&(o(g)||(y=i(g)))?(y?(y=!1,b=p&&i(p)?p:[]):b=p&&o(p)?p:{},a(S,{name:h,newValue:u(I,b,g)})):typeof g<"u"&&a(S,{name:h,newValue:g}));return S},ME}var RLe=MLe();const RE=Xw(RLe);function bM(e){if(typeof e!="object"||e===null)return!1;const t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}function ALe(){const e=[],t={run:n,use:r};return t;function n(...i){let o=-1;const a=i.pop();if(typeof a!="function")throw new TypeError("Expected function as last argument, not "+a);c(null,...i);function c(u,...d){const h=e[++o];let p=-1;if(u){a(u);return}for(;++p<i.length;)(d[p]===null||d[p]===void 0)&&(d[p]=i[p]);i=d,h?OLe(h,c)(...d):a(null,...d)}}function r(i){if(typeof i!="function")throw new TypeError("Expected `middelware` to be a function, not "+i);return e.push(i),t}}function OLe(e,t){let n;return r;function r(...a){const c=e.length>a.length;let u;c&&a.push(i);try{u=e.apply(this,a)}catch(d){const h=d;if(c&&n)throw h;return i(h)}c||(u&&u.then&&typeof u.then=="function"?u.then(o,i):u instanceof Error?i(u):o(u))}function i(a,...c){n||(n=!0,t(a,...c))}function o(a){i(null,a)}}const ha={basename:DLe,dirname:PLe,extname:NLe,join:LLe,sep:"/"};function DLe(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');Cb(e);let n=0,r=-1,i=e.length,o;if(t===void 0||t.length===0||t.length>e.length){for(;i--;)if(e.codePointAt(i)===47){if(o){n=i+1;break}}else r<0&&(o=!0,r=i+1);return r<0?"":e.slice(n,r)}if(t===e)return"";let a=-1,c=t.length-1;for(;i--;)if(e.codePointAt(i)===47){if(o){n=i+1;break}}else a<0&&(o=!0,a=i+1),c>-1&&(e.codePointAt(i)===t.codePointAt(c--)?c<0&&(r=i):(c=-1,r=a));return n===r?r=a:r<0&&(r=e.length),e.slice(n,r)}function PLe(e){if(Cb(e),e.length===0)return".";let t=-1,n=e.length,r;for(;--n;)if(e.codePointAt(n)===47){if(r){t=n;break}}else r||(r=!0);return t<0?e.codePointAt(0)===47?"/":".":t===1&&e.codePointAt(0)===47?"//":e.slice(0,t)}function NLe(e){Cb(e);let t=e.length,n=-1,r=0,i=-1,o=0,a;for(;t--;){const c=e.codePointAt(t);if(c===47){if(a){r=t+1;break}continue}n<0&&(a=!0,n=t+1),c===46?i<0?i=t:o!==1&&(o=1):i>-1&&(o=-1)}return i<0||n<0||o===0||o===1&&i===n-1&&i===r+1?"":e.slice(i,n)}function LLe(...e){let t=-1,n;for(;++t<e.length;)Cb(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":$Le(n)}function $Le(e){Cb(e);const t=e.codePointAt(0)===47;let n=jLe(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function jLe(e,t){let n="",r=0,i=-1,o=0,a=-1,c,u;for(;++a<=e.length;){if(a<e.length)c=e.codePointAt(a);else{if(c===47)break;c=47}if(c===47){if(!(i===a-1||o===1))if(i!==a-1&&o===2){if(n.length<2||r!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(u=n.lastIndexOf("/"),u!==n.length-1){u<0?(n="",r=0):(n=n.slice(0,u),r=n.length-1-n.lastIndexOf("/")),i=a,o=0;continue}}else if(n.length>0){n="",r=0,i=a,o=0;continue}}t&&(n=n.length>0?n+"/..":"..",r=2)}else n.length>0?n+="/"+e.slice(i+1,a):n=e.slice(i+1,a),r=a-i-1;i=a,o=0}else c===46&&o>-1?o++:o=-1}return n}function Cb(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const FLe={cwd:zLe};function zLe(){return"/"}function vM(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function BLe(e){if(typeof e=="string")e=new URL(e);else if(!vM(e)){const t=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code="ERR_INVALID_ARG_TYPE",t}if(e.protocol!=="file:"){const t=new TypeError("The URL must be of scheme file");throw t.code="ERR_INVALID_URL_SCHEME",t}return qLe(e)}function qLe(e){if(e.hostname!==""){const r=new TypeError('File URL host must be "localhost" or empty on darwin');throw r.code="ERR_INVALID_FILE_URL_HOST",r}const t=e.pathname;let n=-1;for(;++n<t.length;)if(t.codePointAt(n)===37&&t.codePointAt(n+1)===50){const r=t.codePointAt(n+2);if(r===70||r===102){const i=new TypeError("File URL path must not include encoded / characters");throw i.code="ERR_INVALID_FILE_URL_PATH",i}}return decodeURIComponent(t)}const AE=["history","path","basename","stem","extname","dirname"];class G7{constructor(t){let n;t?vM(t)?n={path:t}:typeof t=="string"||ULe(t)?n={value:t}:n=t:n={},this.cwd="cwd"in n?"":FLe.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let r=-1;for(;++r<AE.length;){const o=AE[r];o in n&&n[o]!==void 0&&n[o]!==null&&(this[o]=o==="history"?[...n[o]]:n[o])}let i;for(i in n)AE.includes(i)||(this[i]=n[i])}get basename(){return typeof this.path=="string"?ha.basename(this.path):void 0}set basename(t){DE(t,"basename"),OE(t,"basename"),this.path=ha.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?ha.dirname(this.path):void 0}set dirname(t){wq(this.basename,"dirname"),this.path=ha.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?ha.extname(this.path):void 0}set extname(t){if(OE(t,"extname"),wq(this.dirname,"extname"),t){if(t.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(t.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=ha.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){vM(t)&&(t=BLe(t)),DE(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?ha.basename(this.path,this.extname):void 0}set stem(t){DE(t,"stem"),OE(t,"stem"),this.path=ha.join(this.dirname||"",t+(this.extname||""))}fail(t,n,r){const i=this.message(t,n,r);throw i.fatal=!0,i}info(t,n,r){const i=this.message(t,n,r);return i.fatal=void 0,i}message(t,n,r){const i=new Li(t,n,r);return this.path&&(i.name=this.path+":"+i.name,i.file=this.path),i.fatal=!1,this.messages.push(i),i}toString(t){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(t||void 0).decode(this.value)}}function OE(e,t){if(e&&e.includes(ha.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+ha.sep+"`")}function DE(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function wq(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function ULe(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const VLe=(function(e){const r=this.constructor.prototype,i=r[e],o=function(){return i.apply(o,arguments)};return Object.setPrototypeOf(o,r),o}),KLe={}.hasOwnProperty;class VD extends VLe{constructor(){super("copy"),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=ALe()}copy(){const t=new VD;let n=-1;for(;++n<this.attachers.length;){const r=this.attachers[n];t.use(...r)}return t.data(RE(!0,{},this.namespace)),t}data(t,n){return typeof t=="string"?arguments.length===2?(LE("data",this.frozen),this.namespace[t]=n,this):KLe.call(this.namespace,t)&&this.namespace[t]||void 0:t?(LE("data",this.frozen),this.namespace=t,this):this.namespace}freeze(){if(this.frozen)return this;const t=this;for(;++this.freezeIndex<this.attachers.length;){const[n,...r]=this.attachers[this.freezeIndex];if(r[0]===!1)continue;r[0]===!0&&(r[0]=void 0);const i=n.call(t,...r);typeof i=="function"&&this.transformers.use(i)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(t){this.freeze();const n=NS(t),r=this.parser||this.Parser;return PE("parse",r),r(String(n),n)}process(t,n){const r=this;return this.freeze(),PE("process",this.parser||this.Parser),NE("process",this.compiler||this.Compiler),n?i(void 0,n):new Promise(i);function i(o,a){const c=NS(t),u=r.parse(c);r.run(u,c,function(h,p,g){if(h||!p||!g)return d(h);const y=p,b=r.stringify(y,g);GLe(b)?g.value=b:g.result=b,d(h,g)});function d(h,p){h||!p?a(h):o?o(p):n(void 0,p)}}}processSync(t){let n=!1,r;return this.freeze(),PE("processSync",this.parser||this.Parser),NE("processSync",this.compiler||this.Compiler),this.process(t,i),kq("processSync","process",n),r;function i(o,a){n=!0,vq(o),r=a}}run(t,n,r){xq(t),this.freeze();const i=this.transformers;return!r&&typeof n=="function"&&(r=n,n=void 0),r?o(void 0,r):new Promise(o);function o(a,c){const u=NS(n);i.run(t,u,d);function d(h,p,g){const y=p||t;h?c(h):a?a(y):r(void 0,y,g)}}}runSync(t,n){let r=!1,i;return this.run(t,n,o),kq("runSync","run",r),i;function o(a,c){vq(a),i=c,r=!0}}stringify(t,n){this.freeze();const r=NS(n),i=this.compiler||this.Compiler;return NE("stringify",i),xq(t),i(t,r)}use(t,...n){const r=this.attachers,i=this.namespace;if(LE("use",this.frozen),t!=null)if(typeof t=="function")u(t,n);else if(typeof t=="object")Array.isArray(t)?c(t):a(t);else throw new TypeError("Expected usable value, not `"+t+"`");return this;function o(d){if(typeof d=="function")u(d,[]);else if(typeof d=="object")if(Array.isArray(d)){const[h,...p]=d;u(h,p)}else a(d);else throw new TypeError("Expected usable value, not `"+d+"`")}function a(d){if(!("plugins"in d)&&!("settings"in d))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");c(d.plugins),d.settings&&(i.settings=RE(!0,i.settings,d.settings))}function c(d){let h=-1;if(d!=null)if(Array.isArray(d))for(;++h<d.length;){const p=d[h];o(p)}else throw new TypeError("Expected a list of plugins, not `"+d+"`")}function u(d,h){let p=-1,g=-1;for(;++p<r.length;)if(r[p][0]===d){g=p;break}if(g===-1)r.push([d,...h]);else if(h.length>0){let[y,...b]=h;const S=r[g][1];bM(S)&&bM(y)&&(y=RE(!0,S,y)),r[g]=[d,y,...b]}}}}const HLe=new VD().freeze();function PE(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function NE(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function LE(e,t){if(t)throw new Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function xq(e){if(!bM(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function kq(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function NS(e){return WLe(e)?e:new G7(e)}function WLe(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function GLe(e){return typeof e=="string"||YLe(e)}function YLe(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const QLe="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",_q=[],Iq={allowDangerousHtml:!0},XLe=/^(https?|ircs?|mailto|xmpp)$/i,JLe=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"className",id:"remove-classname"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function ZLe(e){const t=e2e(e),n=t2e(e);return n2e(t.runSync(t.parse(n),n),e)}function e2e(e){const t=e.rehypePlugins||_q,n=e.remarkPlugins||_q,r=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...Iq}:Iq;return HLe().use(PNe).use(n).use(CLe,r).use(t)}function t2e(e){const t=e.children||"",n=new G7;return typeof t=="string"&&(n.value=t),n}function n2e(e,t){const n=t.allowedElements,r=t.allowElement,i=t.components,o=t.disallowedElements,a=t.skipHtml,c=t.unwrapDisallowed,u=t.urlTransform||r2e;for(const h of JLe)Object.hasOwn(t,h.from)&&(""+h.from+(h.to?"use `"+h.to+"` instead":"remove it")+QLe+h.id,void 0);return UD(e,d),yDe(e,{Fragment:P.Fragment,components:i,ignoreInvalidStyle:!0,jsx:P.jsx,jsxs:P.jsxs,passKeys:!0,passNode:!0});function d(h,p,g){if(h.type==="raw"&&g&&typeof p=="number")return a?g.children.splice(p,1):g.children[p]={type:"text",value:h.value},p;if(h.type==="element"){let y;for(y in EE)if(Object.hasOwn(EE,y)&&Object.hasOwn(h.properties,y)){const b=h.properties[y],S=EE[y];(S===null||S.includes(h.tagName))&&(h.properties[y]=u(String(b||""),y,h))}}if(h.type==="element"){let y=n?!n.includes(h.tagName):o?o.includes(h.tagName):!1;if(!y&&r&&typeof p=="number"&&(y=!r(h,p,g)),y&&g&&typeof p=="number")return c&&h.children?g.children.splice(p,1,...h.children):g.children.splice(p,1),p}}}function r2e(e){const t=e.indexOf(":"),n=e.indexOf("?"),r=e.indexOf("#"),i=e.indexOf("/");return t===-1||i!==-1&&t>i||n!==-1&&t>n||r!==-1&&t>r||XLe.test(e.slice(0,t))?e:""}function Eq(e,t){const n=String(e);if(typeof t!="string")throw new TypeError("Expected character");let r=0,i=n.indexOf(t);for(;i!==-1;)r++,i=n.indexOf(t,i+t.length);return r}function i2e(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function o2e(e,t,n){const i=Rk((n||{}).ignore||[]),o=s2e(t);let a=-1;for(;++a<o.length;)W7(e,"text",c);function c(d,h){let p=-1,g;for(;++p<h.length;){const y=h[p],b=g?g.children:void 0;if(i(y,b?b.indexOf(y):void 0,g))return;g=y}if(g)return u(d,h)}function u(d,h){const p=h[h.length-1],g=o[a][0],y=o[a][1];let b=0;const w=p.children.indexOf(d);let x=!1,I=[];g.lastIndex=0;let _=g.exec(d.value);for(;_;){const M=_.index,C={index:_.index,input:_.input,stack:[...h,d]};let E=y(..._,C);if(typeof E=="string"&&(E=E.length>0?{type:"text",value:E}:void 0),E===!1?g.lastIndex=M+1:(b!==M&&I.push({type:"text",value:d.value.slice(b,M)}),Array.isArray(E)?I.push(...E):E&&I.push(E),b=M+_[0].length,x=!0),!g.global)break;_=g.exec(d.value)}return x?(b<d.value.length&&I.push({type:"text",value:d.value.slice(b)}),p.children.splice(w,1,...I)):I=[d],w+I.length}}function s2e(e){const t=[];if(!Array.isArray(e))throw new TypeError("Expected find and replace tuple or list of tuples");const n=!e[0]||Array.isArray(e[0])?e:[e];let r=-1;for(;++r<n.length;){const i=n[r];t.push([a2e(i[0]),l2e(i[1])])}return t}function a2e(e){return typeof e=="string"?new RegExp(i2e(e),"g"):e}function l2e(e){return typeof e=="function"?e:function(){return e}}const $E="phrasing",jE=["autolink","link","image","label"];function c2e(){return{transforms:[g2e],enter:{literalAutolink:d2e,literalAutolinkEmail:FE,literalAutolinkHttp:FE,literalAutolinkWww:FE},exit:{literalAutolink:m2e,literalAutolinkEmail:p2e,literalAutolinkHttp:f2e,literalAutolinkWww:h2e}}}function u2e(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:$E,notInConstruct:jE},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:$E,notInConstruct:jE},{character:":",before:"[ps]",after:"\\/",inConstruct:$E,notInConstruct:jE}]}}function d2e(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function FE(e){this.config.enter.autolinkProtocol.call(this,e)}function f2e(e){this.config.exit.autolinkProtocol.call(this,e)}function h2e(e){this.config.exit.data.call(this,e);const t=this.stack[this.stack.length-1];t.type,t.url="http://"+this.sliceSerialize(e)}function p2e(e){this.config.exit.autolinkEmail.call(this,e)}function m2e(e){this.exit(e)}function g2e(e){o2e(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,y2e],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),b2e]],{ignore:["link","linkReference"]})}function y2e(e,t,n,r,i){let o="";if(!Y7(i)||(/^w/i.test(t)&&(n=t+n,t="",o="http://"),!v2e(n)))return!1;const a=S2e(n+r);if(!a[0])return!1;const c={type:"link",title:null,url:o+t+a[0],children:[{type:"text",value:t+a[0]}]};return a[1]?[c,{type:"text",value:a[1]}]:c}function b2e(e,t,n,r){return!Y7(r,!0)||/[-\d_]$/.test(n)?!1:{type:"link",title:null,url:"mailto:"+t+"@"+n,children:[{type:"text",value:t+"@"+n}]}}function v2e(e){const t=e.split(".");return!(t.length<2||t[t.length-1]&&(/_/.test(t[t.length-1])||!/[a-zA-Z\d]/.test(t[t.length-1]))||t[t.length-2]&&(/_/.test(t[t.length-2])||!/[a-zA-Z\d]/.test(t[t.length-2])))}function S2e(e){const t=/[!"&'),.:;<>?\]}]+$/.exec(e);if(!t)return[e,void 0];e=e.slice(0,t.index);let n=t[0],r=n.indexOf(")");const i=Eq(e,"(");let o=Eq(e,")");for(;r!==-1&&i>o;)e+=n.slice(0,r+1),n=n.slice(r+1),r=n.indexOf(")"),o++;return[e,n]}function Y7(e,t){const n=e.input.charCodeAt(e.index-1);return(e.index===0||Pd(n)||Tk(n))&&(!t||n!==47)}Q7.peek=M2e;function w2e(){this.buffer()}function x2e(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function k2e(){this.buffer()}function _2e(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function I2e(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=Ys(this.sliceSerialize(e)).toLowerCase(),n.label=t}function E2e(e){this.exit(e)}function T2e(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=Ys(this.sliceSerialize(e)).toLowerCase(),n.label=t}function C2e(e){this.exit(e)}function M2e(){return"["}function Q7(e,t,n,r){const i=n.createTracker(r);let o=i.move("[^");const a=n.enter("footnoteReference"),c=n.enter("reference");return o+=i.move(n.safe(n.associationId(e),{after:"]",before:o})),c(),a(),o+=i.move("]"),o}function R2e(){return{enter:{gfmFootnoteCallString:w2e,gfmFootnoteCall:x2e,gfmFootnoteDefinitionLabelString:k2e,gfmFootnoteDefinition:_2e},exit:{gfmFootnoteCallString:I2e,gfmFootnoteCall:E2e,gfmFootnoteDefinitionLabelString:T2e,gfmFootnoteDefinition:C2e}}}function A2e(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:n,footnoteReference:Q7},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function n(r,i,o,a){const c=o.createTracker(a);let u=c.move("[^");const d=o.enter("footnoteDefinition"),h=o.enter("label");return u+=c.move(o.safe(o.associationId(r),{before:u,after:"]"})),h(),u+=c.move("]:"),r.children&&r.children.length>0&&(c.shift(4),u+=c.move((t?`
170
+ `:" ")+o.indentLines(o.containerFlow(r,c.current()),t?X7:O2e))),d(),u}}function O2e(e,t,n){return t===0?e:X7(e,t,n)}function X7(e,t,n){return(n?"":" ")+e}const D2e=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];J7.peek=j2e;function P2e(){return{canContainEols:["delete"],enter:{strikethrough:L2e},exit:{strikethrough:$2e}}}function N2e(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:D2e}],handlers:{delete:J7}}}function L2e(e){this.enter({type:"delete",children:[]},e)}function $2e(e){this.exit(e)}function J7(e,t,n,r){const i=n.createTracker(r),o=n.enter("strikethrough");let a=i.move("~~");return a+=n.containerPhrasing(e,{...i.current(),before:a,after:"~"}),a+=i.move("~~"),o(),a}function j2e(){return"~"}function F2e(e){return e.length}function z2e(e,t){const n=t||{},r=(n.align||[]).concat(),i=n.stringLength||F2e,o=[],a=[],c=[],u=[];let d=0,h=-1;for(;++h<e.length;){const S=[],w=[];let x=-1;for(e[h].length>d&&(d=e[h].length);++x<e[h].length;){const I=B2e(e[h][x]);if(n.alignDelimiters!==!1){const _=i(I);w[x]=_,(u[x]===void 0||_>u[x])&&(u[x]=_)}S.push(I)}a[h]=S,c[h]=w}let p=-1;if(typeof r=="object"&&"length"in r)for(;++p<d;)o[p]=Tq(r[p]);else{const S=Tq(r);for(;++p<d;)o[p]=S}p=-1;const g=[],y=[];for(;++p<d;){const S=o[p];let w="",x="";S===99?(w=":",x=":"):S===108?w=":":S===114&&(x=":");let I=n.alignDelimiters===!1?1:Math.max(1,u[p]-w.length-x.length);const _=w+"-".repeat(I)+x;n.alignDelimiters!==!1&&(I=w.length+I+x.length,I>u[p]&&(u[p]=I),y[p]=I),g[p]=_}a.splice(1,0,g),c.splice(1,0,y),h=-1;const b=[];for(;++h<a.length;){const S=a[h],w=c[h];p=-1;const x=[];for(;++p<d;){const I=S[p]||"";let _="",M="";if(n.alignDelimiters!==!1){const C=u[p]-(w[p]||0),E=o[p];E===114?_=" ".repeat(C):E===99?C%2?(_=" ".repeat(C/2+.5),M=" ".repeat(C/2-.5)):(_=" ".repeat(C/2),M=_):M=" ".repeat(C)}n.delimiterStart!==!1&&!p&&x.push("|"),n.padding!==!1&&!(n.alignDelimiters===!1&&I==="")&&(n.delimiterStart!==!1||p)&&x.push(" "),n.alignDelimiters!==!1&&x.push(_),x.push(I),n.alignDelimiters!==!1&&x.push(M),n.padding!==!1&&x.push(" "),(n.delimiterEnd!==!1||p!==d-1)&&x.push("|")}b.push(n.delimiterEnd===!1?x.join("").replace(/ +$/,""):x.join(""))}return b.join(`
171
+ `)}function B2e(e){return e==null?"":String(e)}function Tq(e){const t=typeof e=="string"?e.codePointAt(0):0;return t===67||t===99?99:t===76||t===108?108:t===82||t===114?114:0}function q2e(e,t,n,r){const i=n.enter("blockquote"),o=n.createTracker(r);o.move("> "),o.shift(2);const a=n.indentLines(n.containerFlow(e,o.current()),U2e);return i(),a}function U2e(e,t,n){return">"+(n?"":" ")+e}function V2e(e,t){return Cq(e,t.inConstruct,!0)&&!Cq(e,t.notInConstruct,!1)}function Cq(e,t,n){if(typeof t=="string"&&(t=[t]),!t||t.length===0)return n;let r=-1;for(;++r<t.length;)if(e.includes(t[r]))return!0;return!1}function Mq(e,t,n,r){let i=-1;for(;++i<n.unsafe.length;)if(n.unsafe[i].character===`
172
+ `&&V2e(n.stack,n.unsafe[i]))return/[ \t]/.test(r.before)?"":" ";return`\\
173
+ `}function K2e(e,t){const n=String(e);let r=n.indexOf(t),i=r,o=0,a=0;if(typeof t!="string")throw new TypeError("Expected substring");for(;r!==-1;)r===i?++o>a&&(a=o):o=1,i=r+t.length,r=n.indexOf(t,i);return a}function H2e(e,t){return!!(t.options.fences===!1&&e.value&&!e.lang&&/[^ \r\n]/.test(e.value)&&!/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(e.value))}function W2e(e){const t=e.options.fence||"`";if(t!=="`"&&t!=="~")throw new Error("Cannot serialize code with `"+t+"` for `options.fence`, expected `` ` `` or `~`");return t}function G2e(e,t,n,r){const i=W2e(n),o=e.value||"",a=i==="`"?"GraveAccent":"Tilde";if(H2e(e,n)){const p=n.enter("codeIndented"),g=n.indentLines(o,Y2e);return p(),g}const c=n.createTracker(r),u=i.repeat(Math.max(K2e(o,i)+1,3)),d=n.enter("codeFenced");let h=c.move(u);if(e.lang){const p=n.enter(`codeFencedLang${a}`);h+=c.move(n.safe(e.lang,{before:h,after:" ",encode:["`"],...c.current()})),p()}if(e.lang&&e.meta){const p=n.enter(`codeFencedMeta${a}`);h+=c.move(" "),h+=c.move(n.safe(e.meta,{before:h,after:`
174
+ `,encode:["`"],...c.current()})),p()}return h+=c.move(`
175
+ `),o&&(h+=c.move(o+`
176
+ `)),h+=c.move(u),d(),h}function Y2e(e,t,n){return(n?"":" ")+e}function KD(e){const t=e.options.quote||'"';if(t!=='"'&&t!=="'")throw new Error("Cannot serialize title with `"+t+"` for `options.quote`, expected `\"`, or `'`");return t}function Q2e(e,t,n,r){const i=KD(n),o=i==='"'?"Quote":"Apostrophe",a=n.enter("definition");let c=n.enter("label");const u=n.createTracker(r);let d=u.move("[");return d+=u.move(n.safe(n.associationId(e),{before:d,after:"]",...u.current()})),d+=u.move("]: "),c(),!e.url||/[\0- \u007F]/.test(e.url)?(c=n.enter("destinationLiteral"),d+=u.move("<"),d+=u.move(n.safe(e.url,{before:d,after:">",...u.current()})),d+=u.move(">")):(c=n.enter("destinationRaw"),d+=u.move(n.safe(e.url,{before:d,after:e.title?" ":`
177
+ `,...u.current()}))),c(),e.title&&(c=n.enter(`title${o}`),d+=u.move(" "+i),d+=u.move(n.safe(e.title,{before:d,after:i,...u.current()})),d+=u.move(i),c()),a(),d}function X2e(e){const t=e.options.emphasis||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize emphasis with `"+t+"` for `options.emphasis`, expected `*`, or `_`");return t}function Iy(e){return"&#x"+e.toString(16).toUpperCase()+";"}function Uw(e,t,n){const r=ep(e),i=ep(t);return r===void 0?i===void 0?n==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:i===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:r===1?i===void 0?{inside:!1,outside:!1}:i===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:i===void 0?{inside:!1,outside:!1}:i===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}Z7.peek=J2e;function Z7(e,t,n,r){const i=X2e(n),o=n.enter("emphasis"),a=n.createTracker(r),c=a.move(i);let u=a.move(n.containerPhrasing(e,{after:i,before:c,...a.current()}));const d=u.charCodeAt(0),h=Uw(r.before.charCodeAt(r.before.length-1),d,i);h.inside&&(u=Iy(d)+u.slice(1));const p=u.charCodeAt(u.length-1),g=Uw(r.after.charCodeAt(0),p,i);g.inside&&(u=u.slice(0,-1)+Iy(p));const y=a.move(i);return o(),n.attentionEncodeSurroundingInfo={after:g.outside,before:h.outside},c+u+y}function J2e(e,t,n){return n.options.emphasis||"*"}function Z2e(e,t){let n=!1;return UD(e,function(r){if("value"in r&&/\r?\n|\r/.test(r.value)||r.type==="break")return n=!0,gM}),!!((!e.depth||e.depth<3)&&LD(e)&&(t.options.setext||n))}function e$e(e,t,n,r){const i=Math.max(Math.min(6,e.depth||1),1),o=n.createTracker(r);if(Z2e(e,n)){const h=n.enter("headingSetext"),p=n.enter("phrasing"),g=n.containerPhrasing(e,{...o.current(),before:`
178
+ `,after:`
179
+ `});return p(),h(),g+`
180
+ `+(i===1?"=":"-").repeat(g.length-(Math.max(g.lastIndexOf("\r"),g.lastIndexOf(`
181
+ `))+1))}const a="#".repeat(i),c=n.enter("headingAtx"),u=n.enter("phrasing");o.move(a+" ");let d=n.containerPhrasing(e,{before:"# ",after:`
182
+ `,...o.current()});return/^[\t ]/.test(d)&&(d=Iy(d.charCodeAt(0))+d.slice(1)),d=d?a+" "+d:a,n.options.closeAtx&&(d+=" "+a),u(),c(),d}eY.peek=t$e;function eY(e){return e.value||""}function t$e(){return"<"}tY.peek=n$e;function tY(e,t,n,r){const i=KD(n),o=i==='"'?"Quote":"Apostrophe",a=n.enter("image");let c=n.enter("label");const u=n.createTracker(r);let d=u.move("![");return d+=u.move(n.safe(e.alt,{before:d,after:"]",...u.current()})),d+=u.move("]("),c(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(c=n.enter("destinationLiteral"),d+=u.move("<"),d+=u.move(n.safe(e.url,{before:d,after:">",...u.current()})),d+=u.move(">")):(c=n.enter("destinationRaw"),d+=u.move(n.safe(e.url,{before:d,after:e.title?" ":")",...u.current()}))),c(),e.title&&(c=n.enter(`title${o}`),d+=u.move(" "+i),d+=u.move(n.safe(e.title,{before:d,after:i,...u.current()})),d+=u.move(i),c()),d+=u.move(")"),a(),d}function n$e(){return"!"}nY.peek=r$e;function nY(e,t,n,r){const i=e.referenceType,o=n.enter("imageReference");let a=n.enter("label");const c=n.createTracker(r);let u=c.move("![");const d=n.safe(e.alt,{before:u,after:"]",...c.current()});u+=c.move(d+"]["),a();const h=n.stack;n.stack=[],a=n.enter("reference");const p=n.safe(n.associationId(e),{before:u,after:"]",...c.current()});return a(),n.stack=h,o(),i==="full"||!d||d!==p?u+=c.move(p+"]"):i==="shortcut"?u=u.slice(0,-1):u+=c.move("]"),u}function r$e(){return"!"}rY.peek=i$e;function rY(e,t,n){let r=e.value||"",i="`",o=-1;for(;new RegExp("(^|[^`])"+i+"([^`]|$)").test(r);)i+="`";for(/[^ \r\n]/.test(r)&&(/^[ \r\n]/.test(r)&&/[ \r\n]$/.test(r)||/^`|`$/.test(r))&&(r=" "+r+" ");++o<n.unsafe.length;){const a=n.unsafe[o],c=n.compilePattern(a);let u;if(a.atBreak)for(;u=c.exec(r);){let d=u.index;r.charCodeAt(d)===10&&r.charCodeAt(d-1)===13&&d--,r=r.slice(0,d)+" "+r.slice(u.index+1)}}return i+r+i}function i$e(){return"`"}function iY(e,t){const n=LD(e);return!!(!t.options.resourceLink&&e.url&&!e.title&&e.children&&e.children.length===1&&e.children[0].type==="text"&&(n===e.url||"mailto:"+n===e.url)&&/^[a-z][a-z+.-]+:/i.test(e.url)&&!/[\0- <>\u007F]/.test(e.url))}oY.peek=o$e;function oY(e,t,n,r){const i=KD(n),o=i==='"'?"Quote":"Apostrophe",a=n.createTracker(r);let c,u;if(iY(e,n)){const h=n.stack;n.stack=[],c=n.enter("autolink");let p=a.move("<");return p+=a.move(n.containerPhrasing(e,{before:p,after:">",...a.current()})),p+=a.move(">"),c(),n.stack=h,p}c=n.enter("link"),u=n.enter("label");let d=a.move("[");return d+=a.move(n.containerPhrasing(e,{before:d,after:"](",...a.current()})),d+=a.move("]("),u(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(u=n.enter("destinationLiteral"),d+=a.move("<"),d+=a.move(n.safe(e.url,{before:d,after:">",...a.current()})),d+=a.move(">")):(u=n.enter("destinationRaw"),d+=a.move(n.safe(e.url,{before:d,after:e.title?" ":")",...a.current()}))),u(),e.title&&(u=n.enter(`title${o}`),d+=a.move(" "+i),d+=a.move(n.safe(e.title,{before:d,after:i,...a.current()})),d+=a.move(i),u()),d+=a.move(")"),c(),d}function o$e(e,t,n){return iY(e,n)?"<":"["}sY.peek=s$e;function sY(e,t,n,r){const i=e.referenceType,o=n.enter("linkReference");let a=n.enter("label");const c=n.createTracker(r);let u=c.move("[");const d=n.containerPhrasing(e,{before:u,after:"]",...c.current()});u+=c.move(d+"]["),a();const h=n.stack;n.stack=[],a=n.enter("reference");const p=n.safe(n.associationId(e),{before:u,after:"]",...c.current()});return a(),n.stack=h,o(),i==="full"||!d||d!==p?u+=c.move(p+"]"):i==="shortcut"?u=u.slice(0,-1):u+=c.move("]"),u}function s$e(){return"["}function HD(e){const t=e.options.bullet||"*";if(t!=="*"&&t!=="+"&&t!=="-")throw new Error("Cannot serialize items with `"+t+"` for `options.bullet`, expected `*`, `+`, or `-`");return t}function a$e(e){const t=HD(e),n=e.options.bulletOther;if(!n)return t==="*"?"-":"*";if(n!=="*"&&n!=="+"&&n!=="-")throw new Error("Cannot serialize items with `"+n+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(n===t)throw new Error("Expected `bullet` (`"+t+"`) and `bulletOther` (`"+n+"`) to be different");return n}function l$e(e){const t=e.options.bulletOrdered||".";if(t!=="."&&t!==")")throw new Error("Cannot serialize items with `"+t+"` for `options.bulletOrdered`, expected `.` or `)`");return t}function aY(e){const t=e.options.rule||"*";if(t!=="*"&&t!=="-"&&t!=="_")throw new Error("Cannot serialize rules with `"+t+"` for `options.rule`, expected `*`, `-`, or `_`");return t}function c$e(e,t,n,r){const i=n.enter("list"),o=n.bulletCurrent;let a=e.ordered?l$e(n):HD(n);const c=e.ordered?a==="."?")":".":a$e(n);let u=t&&n.bulletLastUsed?a===n.bulletLastUsed:!1;if(!e.ordered){const h=e.children?e.children[0]:void 0;if((a==="*"||a==="-")&&h&&(!h.children||!h.children[0])&&n.stack[n.stack.length-1]==="list"&&n.stack[n.stack.length-2]==="listItem"&&n.stack[n.stack.length-3]==="list"&&n.stack[n.stack.length-4]==="listItem"&&n.indexStack[n.indexStack.length-1]===0&&n.indexStack[n.indexStack.length-2]===0&&n.indexStack[n.indexStack.length-3]===0&&(u=!0),aY(n)===a&&h){let p=-1;for(;++p<e.children.length;){const g=e.children[p];if(g&&g.type==="listItem"&&g.children&&g.children[0]&&g.children[0].type==="thematicBreak"){u=!0;break}}}}u&&(a=c),n.bulletCurrent=a;const d=n.containerFlow(e,r);return n.bulletLastUsed=a,n.bulletCurrent=o,i(),d}function u$e(e){const t=e.options.listItemIndent||"one";if(t!=="tab"&&t!=="one"&&t!=="mixed")throw new Error("Cannot serialize items with `"+t+"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");return t}function d$e(e,t,n,r){const i=u$e(n);let o=n.bulletCurrent||HD(n);t&&t.type==="list"&&t.ordered&&(o=(typeof t.start=="number"&&t.start>-1?t.start:1)+(n.options.incrementListMarker===!1?0:t.children.indexOf(e))+o);let a=o.length+1;(i==="tab"||i==="mixed"&&(t&&t.type==="list"&&t.spread||e.spread))&&(a=Math.ceil(a/4)*4);const c=n.createTracker(r);c.move(o+" ".repeat(a-o.length)),c.shift(a);const u=n.enter("listItem"),d=n.indentLines(n.containerFlow(e,c.current()),h);return u(),d;function h(p,g,y){return g?(y?"":" ".repeat(a))+p:(y?o:o+" ".repeat(a-o.length))+p}}function f$e(e,t,n,r){const i=n.enter("paragraph"),o=n.enter("phrasing"),a=n.containerPhrasing(e,r);return o(),i(),a}const h$e=Rk(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function p$e(e,t,n,r){return(e.children.some(function(a){return h$e(a)})?n.containerPhrasing:n.containerFlow).call(n,e,r)}function m$e(e){const t=e.options.strong||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}lY.peek=g$e;function lY(e,t,n,r){const i=m$e(n),o=n.enter("strong"),a=n.createTracker(r),c=a.move(i+i);let u=a.move(n.containerPhrasing(e,{after:i,before:c,...a.current()}));const d=u.charCodeAt(0),h=Uw(r.before.charCodeAt(r.before.length-1),d,i);h.inside&&(u=Iy(d)+u.slice(1));const p=u.charCodeAt(u.length-1),g=Uw(r.after.charCodeAt(0),p,i);g.inside&&(u=u.slice(0,-1)+Iy(p));const y=a.move(i+i);return o(),n.attentionEncodeSurroundingInfo={after:g.outside,before:h.outside},c+u+y}function g$e(e,t,n){return n.options.strong||"*"}function y$e(e,t,n,r){return n.safe(e.value,r)}function b$e(e){const t=e.options.ruleRepetition||3;if(t<3)throw new Error("Cannot serialize rules with repetition `"+t+"` for `options.ruleRepetition`, expected `3` or more");return t}function v$e(e,t,n){const r=(aY(n)+(n.options.ruleSpaces?" ":"")).repeat(b$e(n));return n.options.ruleSpaces?r.slice(0,-1):r}const cY={blockquote:q2e,break:Mq,code:G2e,definition:Q2e,emphasis:Z7,hardBreak:Mq,heading:e$e,html:eY,image:tY,imageReference:nY,inlineCode:rY,link:oY,linkReference:sY,list:c$e,listItem:d$e,paragraph:f$e,root:p$e,strong:lY,text:y$e,thematicBreak:v$e};function S$e(){return{enter:{table:w$e,tableData:Rq,tableHeader:Rq,tableRow:k$e},exit:{codeText:_$e,table:x$e,tableData:zE,tableHeader:zE,tableRow:zE}}}function w$e(e){const t=e._align;this.enter({type:"table",align:t.map(function(n){return n==="none"?null:n}),children:[]},e),this.data.inTable=!0}function x$e(e){this.exit(e),this.data.inTable=void 0}function k$e(e){this.enter({type:"tableRow",children:[]},e)}function zE(e){this.exit(e)}function Rq(e){this.enter({type:"tableCell",children:[]},e)}function _$e(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,I$e));const n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function I$e(e,t){return t==="|"?t:e}function E$e(e){const t=e||{},n=t.tableCellPadding,r=t.tablePipeAlign,i=t.stringLength,o=n?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:`
183
+ `,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:g,table:a,tableCell:u,tableRow:c}};function a(y,b,S,w){return d(h(y,S,w),y.align)}function c(y,b,S,w){const x=p(y,S,w),I=d([x]);return I.slice(0,I.indexOf(`
184
+ `))}function u(y,b,S,w){const x=S.enter("tableCell"),I=S.enter("phrasing"),_=S.containerPhrasing(y,{...w,before:o,after:o});return I(),x(),_}function d(y,b){return z2e(y,{align:b,alignDelimiters:r,padding:n,stringLength:i})}function h(y,b,S){const w=y.children;let x=-1;const I=[],_=b.enter("table");for(;++x<w.length;)I[x]=p(w[x],b,S);return _(),I}function p(y,b,S){const w=y.children;let x=-1;const I=[],_=b.enter("tableRow");for(;++x<w.length;)I[x]=u(w[x],y,b,S);return _(),I}function g(y,b,S){let w=cY.inlineCode(y,b,S);return S.stack.includes("tableCell")&&(w=w.replace(/\|/g,"\\$&")),w}}function T$e(){return{exit:{taskListCheckValueChecked:Aq,taskListCheckValueUnchecked:Aq,paragraph:M$e}}}function C$e(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:R$e}}}function Aq(e){const t=this.stack[this.stack.length-2];t.type,t.checked=e.type==="taskListCheckValueChecked"}function M$e(e){const t=this.stack[this.stack.length-2];if(t&&t.type==="listItem"&&typeof t.checked=="boolean"){const n=this.stack[this.stack.length-1];n.type;const r=n.children[0];if(r&&r.type==="text"){const i=t.children;let o=-1,a;for(;++o<i.length;){const c=i[o];if(c.type==="paragraph"){a=c;break}}a===n&&(r.value=r.value.slice(1),r.value.length===0?n.children.shift():n.position&&r.position&&typeof r.position.start.offset=="number"&&(r.position.start.column++,r.position.start.offset++,n.position.start=Object.assign({},r.position.start)))}}this.exit(e)}function R$e(e,t,n,r){const i=e.children[0],o=typeof e.checked=="boolean"&&i&&i.type==="paragraph",a="["+(e.checked?"x":" ")+"] ",c=n.createTracker(r);o&&c.move(a);let u=cY.listItem(e,t,n,{...r,...c.current()});return o&&(u=u.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,d)),u;function d(h){return h+a}}function A$e(){return[c2e(),R2e(),P2e(),S$e(),T$e()]}function O$e(e){return{extensions:[u2e(),A2e(e),N2e(),E$e(e),C$e()]}}const D$e={tokenize:F$e,partial:!0},uY={tokenize:z$e,partial:!0},dY={tokenize:B$e,partial:!0},fY={tokenize:q$e,partial:!0},P$e={tokenize:U$e,partial:!0},hY={name:"wwwAutolink",tokenize:$$e,previous:mY},pY={name:"protocolAutolink",tokenize:j$e,previous:gY},zl={name:"emailAutolink",tokenize:L$e,previous:yY},Fa={};function N$e(){return{text:Fa}}let Pu=48;for(;Pu<123;)Fa[Pu]=zl,Pu++,Pu===58?Pu=65:Pu===91&&(Pu=97);Fa[43]=zl;Fa[45]=zl;Fa[46]=zl;Fa[95]=zl;Fa[72]=[zl,pY];Fa[104]=[zl,pY];Fa[87]=[zl,hY];Fa[119]=[zl,hY];function L$e(e,t,n){const r=this;let i,o;return a;function a(p){return!SM(p)||!yY.call(r,r.previous)||WD(r.events)?n(p):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),c(p))}function c(p){return SM(p)?(e.consume(p),c):p===64?(e.consume(p),u):n(p)}function u(p){return p===46?e.check(P$e,h,d)(p):p===45||p===95||Di(p)?(o=!0,e.consume(p),u):h(p)}function d(p){return e.consume(p),i=!0,u}function h(p){return o&&i&&Ki(r.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),t(p)):n(p)}}function $$e(e,t,n){const r=this;return i;function i(a){return a!==87&&a!==119||!mY.call(r,r.previous)||WD(r.events)?n(a):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(D$e,e.attempt(uY,e.attempt(dY,o),n),n)(a))}function o(a){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),t(a)}}function j$e(e,t,n){const r=this;let i="",o=!1;return a;function a(p){return(p===72||p===104)&&gY.call(r,r.previous)&&!WD(r.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),i+=String.fromCodePoint(p),e.consume(p),c):n(p)}function c(p){if(Ki(p)&&i.length<5)return i+=String.fromCodePoint(p),e.consume(p),c;if(p===58){const g=i.toLowerCase();if(g==="http"||g==="https")return e.consume(p),u}return n(p)}function u(p){return p===47?(e.consume(p),o?d:(o=!0,u)):n(p)}function d(p){return p===null||zw(p)||Rn(p)||Pd(p)||Tk(p)?n(p):e.attempt(uY,e.attempt(dY,h),n)(p)}function h(p){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),t(p)}}function F$e(e,t,n){let r=0;return i;function i(a){return(a===87||a===119)&&r<3?(r++,e.consume(a),i):a===46&&r===3?(e.consume(a),o):n(a)}function o(a){return a===null?n(a):t(a)}}function z$e(e,t,n){let r,i,o;return a;function a(d){return d===46||d===95?e.check(fY,u,c)(d):d===null||Rn(d)||Pd(d)||d!==45&&Tk(d)?u(d):(o=!0,e.consume(d),a)}function c(d){return d===95?r=!0:(i=r,r=void 0),e.consume(d),a}function u(d){return i||r||!o?n(d):t(d)}}function B$e(e,t){let n=0,r=0;return i;function i(a){return a===40?(n++,e.consume(a),i):a===41&&r<n?o(a):a===33||a===34||a===38||a===39||a===41||a===42||a===44||a===46||a===58||a===59||a===60||a===63||a===93||a===95||a===126?e.check(fY,t,o)(a):a===null||Rn(a)||Pd(a)?t(a):(e.consume(a),i)}function o(a){return a===41&&r++,e.consume(a),i}}function q$e(e,t,n){return r;function r(c){return c===33||c===34||c===39||c===41||c===42||c===44||c===46||c===58||c===59||c===63||c===95||c===126?(e.consume(c),r):c===38?(e.consume(c),o):c===93?(e.consume(c),i):c===60||c===null||Rn(c)||Pd(c)?t(c):n(c)}function i(c){return c===null||c===40||c===91||Rn(c)||Pd(c)?t(c):r(c)}function o(c){return Ki(c)?a(c):n(c)}function a(c){return c===59?(e.consume(c),r):Ki(c)?(e.consume(c),a):n(c)}}function U$e(e,t,n){return r;function r(o){return e.consume(o),i}function i(o){return Di(o)?n(o):t(o)}}function mY(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||Rn(e)}function gY(e){return!Ki(e)}function yY(e){return!(e===47||SM(e))}function SM(e){return e===43||e===45||e===46||e===95||Di(e)}function WD(e){let t=e.length,n=!1;for(;t--;){const r=e[t][1];if((r.type==="labelLink"||r.type==="labelImage")&&!r._balanced){n=!0;break}if(r._gfmAutolinkLiteralWalkedInto){n=!1;break}}return e.length>0&&!n&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}const V$e={tokenize:J$e,partial:!0};function K$e(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:Y$e,continuation:{tokenize:Q$e},exit:X$e}},text:{91:{name:"gfmFootnoteCall",tokenize:G$e},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:H$e,resolveTo:W$e}}}}function H$e(e,t,n){const r=this;let i=r.events.length;const o=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let a;for(;i--;){const u=r.events[i][1];if(u.type==="labelImage"){a=u;break}if(u.type==="gfmFootnoteCall"||u.type==="labelLink"||u.type==="label"||u.type==="image"||u.type==="link")break}return c;function c(u){if(!a||!a._balanced)return n(u);const d=Ys(r.sliceSerialize({start:a.end,end:r.now()}));return d.codePointAt(0)!==94||!o.includes(d.slice(1))?n(u):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(u),e.exit("gfmFootnoteCallLabelMarker"),t(u))}}function W$e(e,t){let n=e.length;for(;n--;)if(e[n][1].type==="labelImage"&&e[n][0]==="enter"){e[n][1];break}e[n+1][1].type="data",e[n+3][1].type="gfmFootnoteCallLabelMarker";const r={type:"gfmFootnoteCall",start:Object.assign({},e[n+3][1].start),end:Object.assign({},e[e.length-1][1].end)},i={type:"gfmFootnoteCallMarker",start:Object.assign({},e[n+3][1].end),end:Object.assign({},e[n+3][1].end)};i.end.column++,i.end.offset++,i.end._bufferIndex++;const o={type:"gfmFootnoteCallString",start:Object.assign({},i.end),end:Object.assign({},e[e.length-1][1].start)},a={type:"chunkString",contentType:"string",start:Object.assign({},o.start),end:Object.assign({},o.end)},c=[e[n+1],e[n+2],["enter",r,t],e[n+3],e[n+4],["enter",i,t],["exit",i,t],["enter",o,t],["enter",a,t],["exit",a,t],["exit",o,t],e[e.length-2],e[e.length-1],["exit",r,t]];return e.splice(n,e.length-n+1,...c),e}function G$e(e,t,n){const r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let o=0,a;return c;function c(p){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(p),e.exit("gfmFootnoteCallLabelMarker"),u}function u(p){return p!==94?n(p):(e.enter("gfmFootnoteCallMarker"),e.consume(p),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",d)}function d(p){if(o>999||p===93&&!a||p===null||p===91||Rn(p))return n(p);if(p===93){e.exit("chunkString");const g=e.exit("gfmFootnoteCallString");return i.includes(Ys(r.sliceSerialize(g)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(p),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):n(p)}return Rn(p)||(a=!0),o++,e.consume(p),p===92?h:d}function h(p){return p===91||p===92||p===93?(e.consume(p),o++,d):d(p)}}function Y$e(e,t,n){const r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let o,a=0,c;return u;function u(b){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(b),e.exit("gfmFootnoteDefinitionLabelMarker"),d}function d(b){return b===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(b),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",h):n(b)}function h(b){if(a>999||b===93&&!c||b===null||b===91||Rn(b))return n(b);if(b===93){e.exit("chunkString");const S=e.exit("gfmFootnoteDefinitionLabelString");return o=Ys(r.sliceSerialize(S)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(b),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),g}return Rn(b)||(c=!0),a++,e.consume(b),b===92?p:h}function p(b){return b===91||b===92||b===93?(e.consume(b),a++,h):h(b)}function g(b){return b===58?(e.enter("definitionMarker"),e.consume(b),e.exit("definitionMarker"),i.includes(o)||i.push(o),Xt(e,y,"gfmFootnoteDefinitionWhitespace")):n(b)}function y(b){return t(b)}}function Q$e(e,t,n){return e.check(Tb,t,e.attempt(V$e,t,n))}function X$e(e){e.exit("gfmFootnoteDefinition")}function J$e(e,t,n){const r=this;return Xt(e,i,"gfmFootnoteDefinitionIndent",5);function i(o){const a=r.events[r.events.length-1];return a&&a[1].type==="gfmFootnoteDefinitionIndent"&&a[2].sliceSerialize(a[1],!0).length===4?t(o):n(o)}}function Z$e(e){let n=(e||{}).singleTilde;const r={name:"strikethrough",tokenize:o,resolveAll:i};return n==null&&(n=!0),{text:{126:r},insideSpan:{null:[r]},attentionMarkers:{null:[126]}};function i(a,c){let u=-1;for(;++u<a.length;)if(a[u][0]==="enter"&&a[u][1].type==="strikethroughSequenceTemporary"&&a[u][1]._close){let d=u;for(;d--;)if(a[d][0]==="exit"&&a[d][1].type==="strikethroughSequenceTemporary"&&a[d][1]._open&&a[u][1].end.offset-a[u][1].start.offset===a[d][1].end.offset-a[d][1].start.offset){a[u][1].type="strikethroughSequence",a[d][1].type="strikethroughSequence";const h={type:"strikethrough",start:Object.assign({},a[d][1].start),end:Object.assign({},a[u][1].end)},p={type:"strikethroughText",start:Object.assign({},a[d][1].end),end:Object.assign({},a[u][1].start)},g=[["enter",h,c],["enter",a[d][1],c],["exit",a[d][1],c],["enter",p,c]],y=c.parser.constructs.insideSpan.null;y&&Vo(g,g.length,0,Ck(y,a.slice(d+1,u),c)),Vo(g,g.length,0,[["exit",p,c],["enter",a[u][1],c],["exit",a[u][1],c],["exit",h,c]]),Vo(a,d-1,u-d+3,g),u=d+g.length-2;break}}for(u=-1;++u<a.length;)a[u][1].type==="strikethroughSequenceTemporary"&&(a[u][1].type="data");return a}function o(a,c,u){const d=this.previous,h=this.events;let p=0;return g;function g(b){return d===126&&h[h.length-1][1].type!=="characterEscape"?u(b):(a.enter("strikethroughSequenceTemporary"),y(b))}function y(b){const S=ep(d);if(b===126)return p>1?u(b):(a.consume(b),p++,y);if(p<2&&!n)return u(b);const w=a.exit("strikethroughSequenceTemporary"),x=ep(b);return w._open=!x||x===2&&!!S,w._close=!S||S===2&&!!x,c(b)}}}class eje{constructor(){this.map=[]}add(t,n,r){tje(this,t,n,r)}consume(t){if(this.map.sort(function(o,a){return o[0]-a[0]}),this.map.length===0)return;let n=this.map.length;const r=[];for(;n>0;)n-=1,r.push(t.slice(this.map[n][0]+this.map[n][1]),this.map[n][2]),t.length=this.map[n][0];r.push(t.slice()),t.length=0;let i=r.pop();for(;i;){for(const o of i)t.push(o);i=r.pop()}this.map.length=0}}function tje(e,t,n,r){let i=0;if(!(n===0&&r.length===0)){for(;i<e.map.length;){if(e.map[i][0]===t){e.map[i][1]+=n,e.map[i][2].push(...r);return}i+=1}e.map.push([t,n,r])}}function nje(e,t){let n=!1;const r=[];for(;t<e.length;){const i=e[t];if(n){if(i[0]==="enter")i[1].type==="tableContent"&&r.push(e[t+1][1].type==="tableDelimiterMarker"?"left":"none");else if(i[1].type==="tableContent"){if(e[t-1][1].type==="tableDelimiterMarker"){const o=r.length-1;r[o]=r[o]==="left"?"center":"right"}}else if(i[1].type==="tableDelimiterRow")break}else i[0]==="enter"&&i[1].type==="tableDelimiterRow"&&(n=!0);t+=1}return r}function rje(){return{flow:{null:{name:"table",tokenize:ije,resolveAll:oje}}}}function ije(e,t,n){const r=this;let i=0,o=0,a;return c;function c(R){let N=r.events.length-1;for(;N>-1;){const j=r.events[N][1].type;if(j==="lineEnding"||j==="linePrefix")N--;else break}const L=N>-1?r.events[N][1].type:null,B=L==="tableHead"||L==="tableRow"?E:u;return B===E&&r.parser.lazy[r.now().line]?n(R):B(R)}function u(R){return e.enter("tableHead"),e.enter("tableRow"),d(R)}function d(R){return R===124||(a=!0,o+=1),h(R)}function h(R){return R===null?n(R):lt(R)?o>1?(o=0,r.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(R),e.exit("lineEnding"),y):n(R):zt(R)?Xt(e,h,"whitespace")(R):(o+=1,a&&(a=!1,i+=1),R===124?(e.enter("tableCellDivider"),e.consume(R),e.exit("tableCellDivider"),a=!0,h):(e.enter("data"),p(R)))}function p(R){return R===null||R===124||Rn(R)?(e.exit("data"),h(R)):(e.consume(R),R===92?g:p)}function g(R){return R===92||R===124?(e.consume(R),p):p(R)}function y(R){return r.interrupt=!1,r.parser.lazy[r.now().line]?n(R):(e.enter("tableDelimiterRow"),a=!1,zt(R)?Xt(e,b,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(R):b(R))}function b(R){return R===45||R===58?w(R):R===124?(a=!0,e.enter("tableCellDivider"),e.consume(R),e.exit("tableCellDivider"),S):C(R)}function S(R){return zt(R)?Xt(e,w,"whitespace")(R):w(R)}function w(R){return R===58?(o+=1,a=!0,e.enter("tableDelimiterMarker"),e.consume(R),e.exit("tableDelimiterMarker"),x):R===45?(o+=1,x(R)):R===null||lt(R)?M(R):C(R)}function x(R){return R===45?(e.enter("tableDelimiterFiller"),I(R)):C(R)}function I(R){return R===45?(e.consume(R),I):R===58?(a=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(R),e.exit("tableDelimiterMarker"),_):(e.exit("tableDelimiterFiller"),_(R))}function _(R){return zt(R)?Xt(e,M,"whitespace")(R):M(R)}function M(R){return R===124?b(R):R===null||lt(R)?!a||i!==o?C(R):(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(R)):C(R)}function C(R){return n(R)}function E(R){return e.enter("tableRow"),T(R)}function T(R){return R===124?(e.enter("tableCellDivider"),e.consume(R),e.exit("tableCellDivider"),T):R===null||lt(R)?(e.exit("tableRow"),t(R)):zt(R)?Xt(e,T,"whitespace")(R):(e.enter("data"),A(R))}function A(R){return R===null||R===124||Rn(R)?(e.exit("data"),T(R)):(e.consume(R),R===92?U:A)}function U(R){return R===92||R===124?(e.consume(R),A):A(R)}}function oje(e,t){let n=-1,r=!0,i=0,o=[0,0,0,0],a=[0,0,0,0],c=!1,u=0,d,h,p;const g=new eje;for(;++n<e.length;){const y=e[n],b=y[1];y[0]==="enter"?b.type==="tableHead"?(c=!1,u!==0&&(Oq(g,t,u,d,h),h=void 0,u=0),d={type:"table",start:Object.assign({},b.start),end:Object.assign({},b.end)},g.add(n,0,[["enter",d,t]])):b.type==="tableRow"||b.type==="tableDelimiterRow"?(r=!0,p=void 0,o=[0,0,0,0],a=[0,n+1,0,0],c&&(c=!1,h={type:"tableBody",start:Object.assign({},b.start),end:Object.assign({},b.end)},g.add(n,0,[["enter",h,t]])),i=b.type==="tableDelimiterRow"?2:h?3:1):i&&(b.type==="data"||b.type==="tableDelimiterMarker"||b.type==="tableDelimiterFiller")?(r=!1,a[2]===0&&(o[1]!==0&&(a[0]=a[1],p=LS(g,t,o,i,void 0,p),o=[0,0,0,0]),a[2]=n)):b.type==="tableCellDivider"&&(r?r=!1:(o[1]!==0&&(a[0]=a[1],p=LS(g,t,o,i,void 0,p)),o=a,a=[o[1],n,0,0])):b.type==="tableHead"?(c=!0,u=n):b.type==="tableRow"||b.type==="tableDelimiterRow"?(u=n,o[1]!==0?(a[0]=a[1],p=LS(g,t,o,i,n,p)):a[1]!==0&&(p=LS(g,t,a,i,n,p)),i=0):i&&(b.type==="data"||b.type==="tableDelimiterMarker"||b.type==="tableDelimiterFiller")&&(a[3]=n)}for(u!==0&&Oq(g,t,u,d,h),g.consume(t.events),n=-1;++n<t.events.length;){const y=t.events[n];y[0]==="enter"&&y[1].type==="table"&&(y[1]._align=nje(t.events,n))}return e}function LS(e,t,n,r,i,o){const a=r===1?"tableHeader":r===2?"tableDelimiter":"tableData",c="tableContent";n[0]!==0&&(o.end=Object.assign({},Zf(t.events,n[0])),e.add(n[0],0,[["exit",o,t]]));const u=Zf(t.events,n[1]);if(o={type:a,start:Object.assign({},u),end:Object.assign({},u)},e.add(n[1],0,[["enter",o,t]]),n[2]!==0){const d=Zf(t.events,n[2]),h=Zf(t.events,n[3]),p={type:c,start:Object.assign({},d),end:Object.assign({},h)};if(e.add(n[2],0,[["enter",p,t]]),r!==2){const g=t.events[n[2]],y=t.events[n[3]];if(g[1].end=Object.assign({},y[1].end),g[1].type="chunkText",g[1].contentType="text",n[3]>n[2]+1){const b=n[2]+1,S=n[3]-n[2]-1;e.add(b,S,[])}}e.add(n[3]+1,0,[["exit",p,t]])}return i!==void 0&&(o.end=Object.assign({},Zf(t.events,i)),e.add(i,0,[["exit",o,t]]),o=void 0),o}function Oq(e,t,n,r,i){const o=[],a=Zf(t.events,n);i&&(i.end=Object.assign({},a),o.push(["exit",i,t])),r.end=Object.assign({},a),o.push(["exit",r,t]),e.add(n+1,0,o)}function Zf(e,t){const n=e[t],r=n[0]==="enter"?"start":"end";return n[1][r]}const sje={name:"tasklistCheck",tokenize:lje};function aje(){return{text:{91:sje}}}function lje(e,t,n){const r=this;return i;function i(u){return r.previous!==null||!r._gfmTasklistFirstContentOfListItem?n(u):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(u),e.exit("taskListCheckMarker"),o)}function o(u){return Rn(u)?(e.enter("taskListCheckValueUnchecked"),e.consume(u),e.exit("taskListCheckValueUnchecked"),a):u===88||u===120?(e.enter("taskListCheckValueChecked"),e.consume(u),e.exit("taskListCheckValueChecked"),a):n(u)}function a(u){return u===93?(e.enter("taskListCheckMarker"),e.consume(u),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),c):n(u)}function c(u){return lt(u)?t(u):zt(u)?e.check({tokenize:cje},t,n)(u):n(u)}}function cje(e,t,n){return Xt(e,r,"whitespace");function r(i){return i===null?n(i):t(i)}}function uje(e){return C7([N$e(),K$e(),Z$e(e),rje(),aje()])}const dje={};function fje(e){const t=this,n=e||dje,r=t.data(),i=r.micromarkExtensions||(r.micromarkExtensions=[]),o=r.fromMarkdownExtensions||(r.fromMarkdownExtensions=[]),a=r.toMarkdownExtensions||(r.toMarkdownExtensions=[]);i.push(uje(n)),o.push(A$e()),a.push(O$e(n))}function cl(e){const t=e?.position?.start?.line;return typeof t=="number"?t:null}function Gf(e){switch(e){case 1:return"mt-4 text-lg font-semibold text-foreground";case 2:return"mt-4 text-base font-semibold text-foreground";case 3:return"mt-3 text-sm font-semibold text-foreground";default:return"mt-3 text-sm font-semibold text-foreground"}}function bY({markdown:e,highlightLine:t}){if(e.trim()==="")return P.jsx("div",{className:"text-sm text-muted-foreground",children:"(空)"});const n=i=>typeof t=="number"&&i===t,r=i=>{const o=cl(i);return o?{"data-md-line":o}:{}};return P.jsx("div",{className:"min-w-0",children:P.jsx(ZLe,{remarkPlugins:[fje],components:{h1:({node:i,children:o})=>{const a=cl(i);return P.jsx("h1",{...r(i),className:[Gf(1),n(a)?"speckit-task-highlight":null].filter(Boolean).join(" "),children:o})},h2:({node:i,children:o})=>{const a=cl(i);return P.jsx("h2",{...r(i),className:[Gf(2),n(a)?"speckit-task-highlight":null].filter(Boolean).join(" "),children:o})},h3:({node:i,children:o})=>{const a=cl(i);return P.jsx("h3",{...r(i),className:[Gf(3),n(a)?"speckit-task-highlight":null].filter(Boolean).join(" "),children:o})},h4:({node:i,children:o})=>{const a=cl(i);return P.jsx("h4",{...r(i),className:[Gf(4),n(a)?"speckit-task-highlight":null].filter(Boolean).join(" "),children:o})},h5:({node:i,children:o})=>{const a=cl(i);return P.jsx("h5",{...r(i),className:[Gf(5),n(a)?"speckit-task-highlight":null].filter(Boolean).join(" "),children:o})},h6:({node:i,children:o})=>{const a=cl(i);return P.jsx("h6",{...r(i),className:[Gf(6),n(a)?"speckit-task-highlight":null].filter(Boolean).join(" "),children:o})},hr:()=>P.jsx("hr",{className:"my-2 border-border/60"}),p:({node:i,children:o})=>{const a=cl(i);return P.jsx("p",{"data-md-line":a??void 0,className:["whitespace-pre-wrap break-words text-sm leading-6 text-foreground/90",n(a)?"speckit-task-highlight":null].filter(Boolean).join(" "),children:o})},ul:({children:i})=>P.jsx("ul",{className:"ml-5 list-disc space-y-1 text-sm text-foreground/90",children:i}),ol:({children:i})=>P.jsx("ol",{className:"ml-5 list-decimal space-y-1 text-sm text-foreground/90",children:i}),li:({node:i,children:o})=>{const a=cl(i);return P.jsx("li",{"data-md-line":a??void 0,className:["whitespace-pre-wrap break-words",n(a)?"speckit-task-highlight":null].filter(Boolean).join(" "),children:o})},a:({href:i,children:o})=>P.jsx("a",{href:i,target:"_blank",rel:"noreferrer",className:"text-primary underline decoration-primary/40 underline-offset-2 hover:decoration-primary/60",children:o}),pre:({children:i})=>P.jsx("pre",{className:"max-w-full overflow-x-auto rounded-xl border border-border/60 bg-muted p-3 font-mono text-xs leading-5 text-foreground",children:i}),code:({node:i,className:o,children:a,...c})=>{const u=typeof a=="string"?a:Array.isArray(a)&&a.every(h=>typeof h=="string")?a.join(""):null;return(o?.includes("language-")??!1)||(u?.includes(`
185
+ `)??!1)?P.jsx("code",{className:o,...c,children:a}):P.jsx("code",{className:["rounded bg-muted px-1 py-0.5 font-mono text-[12px] text-foreground",o??null].filter(Boolean).join(" "),...c,children:a})},input:({node:i,type:o,...a})=>o!=="checkbox"?P.jsx("input",{type:o,...a}):P.jsx("input",{type:"checkbox",className:"mr-2 align-middle",disabled:!0,readOnly:!0,...a}),table:({children:i})=>P.jsx("div",{className:"max-w-full overflow-x-auto",children:P.jsx("table",{className:"w-full border-collapse text-sm text-foreground/90",children:i})}),th:({children:i})=>P.jsx("th",{className:"border border-border/60 bg-muted px-2 py-1 text-left font-medium",children:i}),td:({children:i})=>P.jsx("td",{className:"border border-border/60 px-2 py-1 align-top",children:i}),blockquote:({children:i})=>P.jsx("blockquote",{className:"border-l-2 border-border/60 pl-3 text-sm text-muted-foreground",children:i})},children:e})})}function hje({tasks:e,highlightLine:t,onOpenTask:n}){const r=D.useMemo(()=>Array.from(e).sort((i,o)=>i.line-o.line),[e]);return r.length===0?P.jsx("div",{className:"text-sm text-muted-foreground",children:"No tasks in tasks.md"}):P.jsx("div",{className:"flex flex-col gap-0 divide-y divide-dashed divide-border/40 pr-2",children:r.map(i=>{const o=id(i),a=FO(i.raw),c=t===i.line,u=i.taskId??`L${i.line}`;return P.jsxs("button",{id:`task-line-${i.line}`,type:"button",className:c?"group relative flex w-full items-start gap-3 bg-accent/10 px-3 py-3 text-left transition-colors hover:bg-accent/15":"group relative flex w-full items-start gap-3 px-3 py-3 text-left transition-colors hover:bg-muted/40",onClick:()=>n(i),children:[P.jsx("span",{className:i.checked?"mt-0.5 flex h-4 w-4 shrink-0 items-center justify-center rounded-none border border-success bg-success/10 text-[10px] font-bold text-success-foreground":"mt-0.5 flex h-4 w-4 shrink-0 items-center justify-center rounded-none border border-border bg-background transition-colors group-hover:border-foreground",children:i.checked?"✓":""}),P.jsxs("div",{className:"min-w-0 flex-1",children:[P.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[P.jsx(En,{variant:"outline",className:"h-5 rounded-none px-1 font-mono text-[10px] text-muted-foreground group-hover:border-foreground group-hover:text-foreground",children:u}),i.story?P.jsx(En,{variant:"outline",className:"h-5 rounded-none border-border px-1 font-mono text-[10px] text-muted-foreground group-hover:border-foreground group-hover:text-foreground",children:i.story}):null,i.parallel?P.jsx(En,{variant:"outline",className:"h-5 rounded-none border-warning/50 px-1 font-mono text-[10px] text-warning group-hover:border-warning",children:"P"}):null,P.jsxs("span",{className:"ml-auto font-mono text-[10px] text-muted-foreground opacity-50",children:["L",i.line]})]}),P.jsx("div",{className:i.checked?"mt-1.5 break-words text-sm font-serif text-muted-foreground line-through opacity-60":"mt-1.5 break-words text-sm font-serif text-foreground font-medium",children:o}),a.length>0?P.jsx("div",{className:"mt-2 flex flex-wrap gap-1",children:a.map(d=>P.jsx("span",{className:"inline-block border-b border-dashed border-muted-foreground/30 font-mono text-[10px] text-muted-foreground",children:d},d))}):null]})]},i.line)})})}const pje=2e3,mje=["spec.md","quickstart.md","data-model.md","research.md","plan.md","tasks.md"];function gje(e){switch(e){case"spec.md":return"Requirements";case"quickstart.md":return"Quickstart";case"data-model.md":return"Data Model";case"research.md":return"Research";case"plan.md":return"Implementation";case"tasks.md":return"Tasks Checklist"}}function yje({open:e,specId:t,spec:n,tasks:r,fileName:i,viewMode:o,loadingFile:a,fileError:c,content:u,loadingSpec:d,specError:h,specMarkdown:p,artifactExists:g,expandedStoryCode:y,pendingScrollToTaskLine:b,pendingScrollToStoryLine:S,highlightTaskLine:w,isFullscreen:x,onToggleFullscreen:I,onClose:_,onSelectFile:M,onSetViewMode:C,onChangeContent:E,onSave:T,onToggleStory:A,onJumpToTaskLine:U,onDidScrollToTaskLine:R,onJumpToStoryLine:N,onDidScrollToStoryLine:L,onClearHighlight:B,onOpenTask:j}){const $=n?.id??t,F=D.useRef(null),[K,W]=D.useState(null),X=D.useRef(null),V=D.useMemo(()=>mje.filter(ee=>g[ee]===!0),[g]);D.useEffect(()=>{V.length!==0&&(V.includes(i)||M(V[0]??"spec.md"))},[V,i,M]),D.useEffect(()=>()=>{X.current!==null&&(window.clearTimeout(X.current),X.current=null)},[]),D.useEffect(()=>{if(o!=="preview"||i!=="tasks.md"||b===null)return;const ee=`task-line-${b}`,J=document.getElementById(ee);if(!J)return;const ge=b;J.scrollIntoView({block:"center",behavior:"smooth"}),R(ge);const te=window.setTimeout(()=>{B()},1500);return()=>window.clearTimeout(te)},[o,i,b,r,R,B]),D.useEffect(()=>{if(o!=="preview"||i!=="spec.md"||S===null)return;const ee=F.current;if(!ee)return;const J=[`h1[data-md-line="${S}"]`,`h2[data-md-line="${S}"]`,`h3[data-md-line="${S}"]`,`h4[data-md-line="${S}"]`,`h5[data-md-line="${S}"]`,`h6[data-md-line="${S}"]`,`[data-md-line="${S}"]`].join(", "),ge=ee.querySelector(J);if(!(ge instanceof HTMLElement))return;const te=S;requestAnimationFrame(()=>{ge.scrollIntoView({block:"center",behavior:"smooth"}),L(te),W(te),X.current!==null&&(window.clearTimeout(X.current),X.current=null),X.current=window.setTimeout(()=>{W(pe=>pe===te?null:pe),X.current=null},pje)})},[o,i,S,u,L]);const z=D.useMemo(()=>q9(p),[p]),Q=D.useMemo(()=>new Map(z.map(ee=>[ee.code,ee])),[z]),q=D.useMemo(()=>{const ee=r??[],J=new Map,ge=[];for(const pe of ee){const oe=pe.story;if(!oe){ge.push(pe);continue}const ye=J.get(oe)??[];ye.push(pe),J.set(oe,ye)}for(const pe of J.values())pe.sort((oe,ye)=>oe.line-ye.line);ge.sort((pe,oe)=>pe.line-oe.line);const te=Array.from(J.keys()).sort((pe,oe)=>{const ye=Number.parseInt(pe.replace(/^US/,""),10),xe=Number.parseInt(oe.replace(/^US/,""),10);return Number.isFinite(ye)&&Number.isFinite(xe)?ye-xe:pe.localeCompare(oe)});return{byStory:J,storyCodes:te,unassigned:ge}},[r]),ie=D.useMemo(()=>{const ee=Array.from(new Set([...q.storyCodes,...Array.from(Q.keys())])).sort((ge,te)=>{const pe=Number.parseInt(ge.replace(/^US/,""),10),oe=Number.parseInt(te.replace(/^US/,""),10);return Number.isFinite(pe)&&Number.isFinite(oe)?pe-oe:ge.localeCompare(te)}),J=[];for(const ge of ee){const te=Q.get(ge)??null,pe=q.byStory.get(ge)??[],oe=cB(pe);J.push({storyCode:ge,storyTitle:te?.title??ge,storyLine:te?.line??null,tasks:pe,refStats:oe,stats:Cw(pe),missingInSpec:te===null})}return J},[q.byStory,q.storyCodes,Q]),le=D.useMemo(()=>{if(q.unassigned.length===0)return null;const ee=cB(q.unassigned);return{tasks:q.unassigned,refStats:ee,stats:Cw(q.unassigned)}},[q.unassigned]);return P.jsx(h7,{open:e,onOpenChange:ee=>!ee&&_(),children:P.jsxs(MD,{className:x?"fixed inset-0 h-full w-full sm:max-w-none rounded-none border-none shadow-none outline-none":"w-[1200px] sm:max-w-none rounded-none border-l border-border bg-background shadow-none outline-none",overlayClassName:x?"hidden":"bg-foreground/20 transition-opacity duration-300",motionProps:{initial:x?!1:{x:"100%"},animate:{x:0},exit:x?{x:0}:{x:"100%"},transition:x?{duration:0}:{type:"spring",stiffness:350,damping:40}},"aria-describedby":void 0,children:[P.jsx(f7,{className:"sr-only",children:"Spec Detail"}),P.jsx("div",{className:x?"absolute inset-0":"h-full w-full",children:t?P.jsxs("div",{className:"flex h-full flex-col bg-background",children:[P.jsxs("div",{className:"relative flex-none overflow-hidden border-b-4 border-double border-border/40 bg-background px-6 py-5",children:[P.jsxs("div",{className:"relative z-10 flex items-start justify-between gap-6",children:[P.jsxs("div",{className:"min-w-0",children:[P.jsxs("div",{className:"flex items-center gap-3",children:[P.jsx("div",{className:"font-mono text-xs font-bold text-muted-foreground opacity-50",children:n?String(n.num).padStart(3,"0"):"---"}),P.jsx("div",{className:"truncate text-2xl font-bold font-serif tracking-tight text-foreground",children:n?.title??"—"})]}),P.jsx("div",{className:"mt-1 flex items-center gap-2",children:$?P.jsx("span",{className:"font-mono text-[10px] uppercase tracking-widest text-muted-foreground opacity-70",children:$}):null})]}),P.jsxs("div",{className:"flex items-center gap-2",children:[P.jsx(yi,{type:"button",variant:"ghost",size:"icon",className:"h-9 w-9 rounded-none border border-transparent hover:border-border hover:bg-muted focus-visible:ring-0",onClick:I,"aria-label":x?"Exit fullscreen":"Fullscreen",children:x?P.jsx("svg",{className:"h-5 w-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:P.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 3H5a2 2 0 0 0-2 2v4m18 0V5a2 2 0 0 0-2-2h-4M3 15v4a2 2 0 0 0 2 2h4m10 0h4a2 2 0 0 0 2-2v-4"})}):P.jsx("svg",{className:"h-5 w-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:P.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 3H5a2 2 0 0 0-2 2v3m18 0V5a2 2 0 0 0-2-2h-3M3 16v3a2 2 0 0 0 2 2h3m8 0h3a2 2 0 0 0 2-2v-3"})})}),P.jsx(yi,{type:"button",variant:"ghost",size:"icon",className:"h-9 w-9 rounded-none border border-transparent hover:border-border hover:bg-destructive/10 hover:text-destructive focus-visible:ring-0",onClick:_,"aria-label":"Close",children:P.jsx("svg",{className:"h-5 w-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:P.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]})]}),n?.taskStats&&P.jsx("div",{className:`pointer-events-none absolute right-16 top-2 select-none border-4 border-double px-2 py-1 font-mono text-sm font-black uppercase tracking-widest opacity-20 transition-opacity duration-300 md:right-32 md:top-4 md:text-xl md:opacity-10 ${n.taskStats.todo===0?"rotate-12 border-success text-success":"-rotate-12 border-foreground text-foreground"}`,children:n.taskStats.todo===0?"PASSED":"WORK IN PROGRESS"})]}),P.jsxs("div",{className:"flex flex-1 overflow-hidden",children:[P.jsxs("div",{className:"flex w-[200px] shrink-0 flex-col border-r border-border/50 bg-background",children:[P.jsx("div",{className:"px-4 py-4 text-xs font-bold uppercase tracking-wider text-muted-foreground",children:"Artifacts"}),P.jsx("div",{className:"scrollbar-none flex-1 space-y-0.5 overflow-y-auto px-2 pb-3",children:V.map(ee=>{const J=i===ee;return P.jsxs("button",{type:"button",className:J?"group w-full border-l-2 border-foreground bg-muted/30 px-4 py-3 text-left transition-all duration-300":"group w-full border-l-2 border-transparent px-4 py-3 text-left transition-all duration-300 hover:bg-muted/10 hover:border-border/50",onClick:()=>M(ee),children:[P.jsx("div",{className:`font-mono text-[13px] ${J?"font-medium text-foreground":"text-muted-foreground"}`,children:ee}),P.jsx("div",{className:`mt-0.5 text-[11px] ${J?"text-muted-foreground":"text-muted-foreground/70 group-hover:text-muted-foreground"}`,children:gje(ee)})]},ee)})})]}),P.jsxs("div",{className:"flex w-[480px] shrink-0 flex-col border-r border-border/30 bg-background",children:[P.jsxs("div",{className:"flex h-12 flex-none items-center border-b border-border/30 px-4",children:[P.jsx("div",{className:"text-xs font-semibold text-foreground",children:"Correlation (US → Tasks → Refs)"}),h?P.jsx("div",{className:"mt-2 rounded-md border border-destructive/20 bg-destructive/10 px-2 py-1 text-[11px] text-destructive",children:h}):null]}),P.jsxs("div",{className:"scrollbar-none flex-1 overflow-y-auto p-4",children:[r!==void 0&&ie.length===0&&!le?P.jsx("div",{className:"text-sm text-muted-foreground",children:"No correlated tasks found in current spec."}):null,P.jsxs("div",{className:"flex flex-col gap-0 divide-y divide-dashed divide-border/40",children:[ie.map(ee=>P.jsxs("div",{className:"py-6 px-2 transition-colors duration-500 hover:bg-muted/5 group",children:[P.jsxs("div",{className:"flex items-start justify-between gap-3",children:[P.jsx("div",{className:"min-w-0",children:P.jsxs("div",{className:"flex min-w-0 items-start gap-2",children:[ee.storyLine!==null?P.jsx("button",{type:"button",className:ee.missingInSpec?"mt-0.5 shrink-0 cursor-pointer rounded-none border border-destructive px-1.5 py-0.5 font-mono text-[11px] font-bold text-destructive transition-colors hover:bg-destructive hover:text-destructive-foreground":"mt-0.5 shrink-0 cursor-pointer rounded-none border border-border px-1.5 py-0.5 font-mono text-[11px] font-bold text-muted-foreground transition-colors hover:border-foreground hover:bg-foreground hover:text-background",onClick:()=>N(ee.storyLine??1),children:ee.storyCode}):P.jsx("span",{className:ee.missingInSpec?"mt-0.5 shrink-0 rounded-none border border-destructive px-1.5 py-0.5 font-mono text-[11px] font-bold text-destructive":"mt-0.5 shrink-0 rounded-none border border-border px-1.5 py-0.5 font-mono text-[11px] font-bold text-muted-foreground",children:ee.storyCode}),P.jsxs("div",{className:"min-w-0",children:[P.jsx("div",{className:"truncate text-sm font-semibold text-foreground",children:ee.storyTitle}),P.jsx("div",{className:"mt-1 text-[11px] text-muted-foreground",children:ee.missingInSpec?"User Story title not found in spec.md":`spec.md#L${ee.storyLine??1}`})]})]})}),P.jsxs("div",{className:"flex shrink-0 items-start gap-2",children:[P.jsxs(En,{variant:"outline",className:"font-mono text-[11px] rounded-none",children:[ee.stats.done,"/",ee.stats.total]}),ee.tasks.length>0?P.jsx(yi,{type:"button",variant:"outline",size:"sm",className:"h-6 px-2 py-0.5 text-[11px]",onClick:()=>A(ee.storyCode),children:y===ee.storyCode?"Collapse":"Expand"}):null]})]}),P.jsx("div",{className:"mt-2 h-1.5 w-full overflow-hidden rounded-none bg-border/40",children:P.jsx("div",{className:"h-full bg-success",style:{width:ee.stats.total>0?`${Math.round(ee.stats.done/ee.stats.total*100)}%`:"0%"}})}),P.jsx("div",{className:"mt-2 flex flex-wrap gap-1",children:ee.tasks.map(J=>{const ge=id(J);return P.jsx("button",{type:"button",className:J.checked?"rounded-none bg-success/10 px-2 py-1 text-[11px] text-success-foreground hover:bg-success/15":"rounded-none bg-muted px-2 py-1 text-[11px] text-muted-foreground hover:bg-accent",title:J.taskId?`${J.taskId} · ${ge}`:ge,onClick:()=>U(J.line),children:J.taskId??`L${J.line}`},J.line)})}),ee.refStats.length>0?P.jsx("div",{className:"mt-2 flex flex-wrap gap-1",children:ee.refStats.map(J=>P.jsxs(En,{variant:"outline",className:"font-mono text-[11px] rounded-none",title:`${J.done}/${J.total}`,children:[J.code," ",J.done,"/",J.total]},J.code))}):null,ee.tasks.length>0&&y===ee.storyCode?P.jsx("div",{className:"mt-3 space-y-2",children:ee.tasks.map(J=>{const ge=id(J),te=FO(J.raw);return P.jsxs("div",{className:"group/task flex flex-col p-2 transition-colors duration-300 hover:bg-muted/20 border-l-2 border-transparent hover:border-accent/50",children:[P.jsxs("div",{className:"flex items-start gap-2",children:[P.jsx("button",{type:"button",className:"min-w-0 flex-1 break-words text-left text-sm text-foreground outline-none hover:underline focus-visible:ring-2 focus-visible:ring-ring/50 rounded-none",onClick:()=>j(J),children:P.jsx("span",{className:J.checked?"line-through text-muted-foreground opacity-80":void 0,children:J.taskId?`${J.taskId} · ${ge}`:ge})}),P.jsxs("span",{className:"shrink-0 font-mono text-[11px] text-muted-foreground opacity-70",children:["L",J.line]})]}),te.length>0?P.jsx("div",{className:"mt-2 flex flex-wrap gap-1",children:te.map(pe=>P.jsx(En,{variant:"outline",className:"font-mono text-[11px] text-muted-foreground rounded-none",children:pe},pe))}):null]},J.line)})}):null]},ee.storyCode)),le?P.jsxs("div",{className:"py-6 px-2 border-t border-dashed border-border/40",children:[P.jsxs("div",{className:"flex items-start justify-between gap-3",children:[P.jsx("div",{className:"min-w-0",children:P.jsxs("div",{className:"flex min-w-0 items-start gap-2",children:[P.jsx(En,{variant:"outline",className:"mt-0.5 shrink-0 font-mono text-[11px] rounded-none",children:"Unassigned"}),P.jsxs("div",{className:"min-w-0",children:[P.jsx("div",{className:"truncate text-sm font-semibold text-foreground",children:"Tasks without [USn]"}),P.jsx("div",{className:"mt-1 text-[11px] text-muted-foreground",children:"No `[USn]` tags in tasks.md"})]})]})}),P.jsxs(En,{variant:"outline",className:"font-mono text-[11px] rounded-none",children:[le.stats.done,"/",le.stats.total]})]}),P.jsx("div",{className:"mt-2 flex flex-wrap gap-1",children:le.tasks.map(ee=>{const J=id(ee);return P.jsx("button",{type:"button",className:ee.checked?"rounded-none bg-success/10 px-2 py-1 text-[11px] text-success-foreground hover:bg-success/15":"rounded-none bg-muted px-2 py-1 text-[11px] text-muted-foreground hover:bg-accent",title:ee.taskId?`${ee.taskId} · ${J}`:J,onClick:()=>U(ee.line),children:ee.taskId??`L${ee.line}`},ee.line)})}),le.refStats.length>0?P.jsx("div",{className:"mt-2 flex flex-wrap gap-1",children:le.refStats.map(ee=>P.jsxs(En,{variant:"outline",className:"font-mono text-[11px] rounded-none",title:`${ee.done}/${ee.total}`,children:[ee.code," ",ee.done,"/",ee.total]},ee.code))}):null]}):null]})]})]}),P.jsxs("div",{className:"flex min-w-0 flex-1 flex-col overflow-hidden bg-card",children:[P.jsxs("div",{className:"flex h-12 flex-none items-center justify-between border-b border-border/30 bg-card px-4",children:[P.jsx("div",{className:"min-w-0",children:P.jsx("div",{className:"truncate font-mono text-xs text-muted-foreground",children:i})}),P.jsxs("div",{className:"ml-auto flex items-center gap-3",children:[o==="edit"?P.jsx(yi,{type:"button",size:"sm",variant:"outline",className:"h-7 border-border px-3 font-mono text-[10px] tracking-wider hover:bg-foreground hover:text-background",disabled:a,onClick:T,children:"SAVE"}):null,P.jsxs("div",{className:"flex items-center border border-border bg-background",children:[P.jsx("button",{type:"button",className:o==="preview"?"bg-foreground px-3 py-1.5 font-mono text-[10px] font-bold tracking-wider text-background transition-colors":"bg-transparent px-3 py-1.5 font-mono text-[10px] font-bold tracking-wider text-muted-foreground transition-colors hover:bg-muted hover:text-foreground",onClick:()=>C("preview"),children:"PREVIEW"}),P.jsx("div",{className:"h-3 w-px bg-border"}),P.jsx("button",{type:"button",className:o==="edit"?"bg-foreground px-3 py-1.5 font-mono text-[10px] font-bold tracking-wider text-background transition-colors":"bg-transparent px-3 py-1.5 font-mono text-[10px] font-bold tracking-wider text-muted-foreground transition-colors hover:bg-muted hover:text-foreground",onClick:()=>C("edit"),children:"EDIT"})]})]})]}),c?P.jsx("div",{className:"mt-2 rounded-md border border-destructive/20 bg-destructive/10 px-3 py-2 text-xs text-destructive",children:c}):null,P.jsx("div",{className:"flex-1 overflow-hidden",children:o==="edit"?P.jsx("textarea",{className:"h-full w-full resize-none border-0 bg-transparent p-4 font-mono text-xs leading-5 text-foreground outline-none placeholder:text-muted-foreground",value:u,onChange:ee=>E(ee.target.value),placeholder:a?"Loading…":"File Content"}):P.jsx("div",{ref:F,className:"scrollbar-none h-full overflow-y-auto p-4",children:i==="tasks.md"&&r?P.jsx(hje,{tasks:r,highlightLine:w,onOpenTask:j}):P.jsx(bY,{markdown:u,highlightLine:i==="spec.md"?K:null})})})]})]})]}):null})]})})}function Dq(e,[t,n]){return Math.min(n,Math.max(t,e))}function bje(e){const t=e+"CollectionProvider",[n,r]=kk(t),[i,o]=n(t,{collectionRef:{current:null},itemMap:new Map}),a=S=>{const{scope:w,children:x}=S,I=xn.useRef(null),_=xn.useRef(new Map).current;return P.jsx(i,{scope:w,itemMap:_,collectionRef:I,children:x})};a.displayName=t;const c=e+"CollectionSlot",u=ky(c),d=xn.forwardRef((S,w)=>{const{scope:x,children:I}=S,_=o(c,x),M=Tr(w,_.collectionRef);return P.jsx(u,{ref:M,children:I})});d.displayName=c;const h=e+"CollectionItemSlot",p="data-radix-collection-item",g=ky(h),y=xn.forwardRef((S,w)=>{const{scope:x,children:I,..._}=S,M=xn.useRef(null),C=Tr(w,M),E=o(h,x);return xn.useEffect(()=>(E.itemMap.set(M,{ref:M,..._}),()=>void E.itemMap.delete(M))),P.jsx(g,{[p]:"",ref:C,children:I})});y.displayName=h;function b(S){const w=o(e+"CollectionConsumer",S);return xn.useCallback(()=>{const I=w.collectionRef.current;if(!I)return[];const _=Array.from(I.querySelectorAll(`[${p}]`));return Array.from(w.itemMap.values()).sort((E,T)=>_.indexOf(E.ref.current)-_.indexOf(T.ref.current))},[w.collectionRef,w.itemMap])}return[{Provider:a,Slot:d,ItemSlot:y},b,r]}var vje=D.createContext(void 0);function Sje(e){const t=D.useContext(vje);return e||t||"ltr"}const wje=["top","right","bottom","left"],Yc=Math.min,No=Math.max,Vw=Math.round,$S=Math.floor,Ra=e=>({x:e,y:e}),xje={left:"right",right:"left",bottom:"top",top:"bottom"},kje={start:"end",end:"start"};function wM(e,t,n){return No(e,Yc(t,n))}function Nl(e,t){return typeof e=="function"?e(t):e}function Ll(e){return e.split("-")[0]}function jp(e){return e.split("-")[1]}function GD(e){return e==="x"?"y":"x"}function YD(e){return e==="y"?"height":"width"}const _je=new Set(["top","bottom"]);function wa(e){return _je.has(Ll(e))?"y":"x"}function QD(e){return GD(wa(e))}function Ije(e,t,n){n===void 0&&(n=!1);const r=jp(e),i=QD(e),o=YD(i);let a=i==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[o]>t.floating[o]&&(a=Kw(a)),[a,Kw(a)]}function Eje(e){const t=Kw(e);return[xM(e),t,xM(t)]}function xM(e){return e.replace(/start|end/g,t=>kje[t])}const Pq=["left","right"],Nq=["right","left"],Tje=["top","bottom"],Cje=["bottom","top"];function Mje(e,t,n){switch(e){case"top":case"bottom":return n?t?Nq:Pq:t?Pq:Nq;case"left":case"right":return t?Tje:Cje;default:return[]}}function Rje(e,t,n,r){const i=jp(e);let o=Mje(Ll(e),n==="start",r);return i&&(o=o.map(a=>a+"-"+i),t&&(o=o.concat(o.map(xM)))),o}function Kw(e){return e.replace(/left|right|bottom|top/g,t=>xje[t])}function Aje(e){return{top:0,right:0,bottom:0,left:0,...e}}function vY(e){return typeof e!="number"?Aje(e):{top:e,right:e,bottom:e,left:e}}function Hw(e){const{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function Lq(e,t,n){let{reference:r,floating:i}=e;const o=wa(t),a=QD(t),c=YD(a),u=Ll(t),d=o==="y",h=r.x+r.width/2-i.width/2,p=r.y+r.height/2-i.height/2,g=r[c]/2-i[c]/2;let y;switch(u){case"top":y={x:h,y:r.y-i.height};break;case"bottom":y={x:h,y:r.y+r.height};break;case"right":y={x:r.x+r.width,y:p};break;case"left":y={x:r.x-i.width,y:p};break;default:y={x:r.x,y:r.y}}switch(jp(t)){case"start":y[a]-=g*(n&&d?-1:1);break;case"end":y[a]+=g*(n&&d?-1:1);break}return y}const Oje=async(e,t,n)=>{const{placement:r="bottom",strategy:i="absolute",middleware:o=[],platform:a}=n,c=o.filter(Boolean),u=await(a.isRTL==null?void 0:a.isRTL(t));let d=await a.getElementRects({reference:e,floating:t,strategy:i}),{x:h,y:p}=Lq(d,r,u),g=r,y={},b=0;for(let S=0;S<c.length;S++){const{name:w,fn:x}=c[S],{x:I,y:_,data:M,reset:C}=await x({x:h,y:p,initialPlacement:r,placement:g,strategy:i,middlewareData:y,rects:d,platform:a,elements:{reference:e,floating:t}});h=I??h,p=_??p,y={...y,[w]:{...y[w],...M}},C&&b<=50&&(b++,typeof C=="object"&&(C.placement&&(g=C.placement),C.rects&&(d=C.rects===!0?await a.getElementRects({reference:e,floating:t,strategy:i}):C.rects),{x:h,y:p}=Lq(d,g,u)),S=-1)}return{x:h,y:p,placement:g,strategy:i,middlewareData:y}};async function Ey(e,t){var n;t===void 0&&(t={});const{x:r,y:i,platform:o,rects:a,elements:c,strategy:u}=e,{boundary:d="clippingAncestors",rootBoundary:h="viewport",elementContext:p="floating",altBoundary:g=!1,padding:y=0}=Nl(t,e),b=vY(y),w=c[g?p==="floating"?"reference":"floating":p],x=Hw(await o.getClippingRect({element:(n=await(o.isElement==null?void 0:o.isElement(w)))==null||n?w:w.contextElement||await(o.getDocumentElement==null?void 0:o.getDocumentElement(c.floating)),boundary:d,rootBoundary:h,strategy:u})),I=p==="floating"?{x:r,y:i,width:a.floating.width,height:a.floating.height}:a.reference,_=await(o.getOffsetParent==null?void 0:o.getOffsetParent(c.floating)),M=await(o.isElement==null?void 0:o.isElement(_))?await(o.getScale==null?void 0:o.getScale(_))||{x:1,y:1}:{x:1,y:1},C=Hw(o.convertOffsetParentRelativeRectToViewportRelativeRect?await o.convertOffsetParentRelativeRectToViewportRelativeRect({elements:c,rect:I,offsetParent:_,strategy:u}):I);return{top:(x.top-C.top+b.top)/M.y,bottom:(C.bottom-x.bottom+b.bottom)/M.y,left:(x.left-C.left+b.left)/M.x,right:(C.right-x.right+b.right)/M.x}}const Dje=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:i,rects:o,platform:a,elements:c,middlewareData:u}=t,{element:d,padding:h=0}=Nl(e,t)||{};if(d==null)return{};const p=vY(h),g={x:n,y:r},y=QD(i),b=YD(y),S=await a.getDimensions(d),w=y==="y",x=w?"top":"left",I=w?"bottom":"right",_=w?"clientHeight":"clientWidth",M=o.reference[b]+o.reference[y]-g[y]-o.floating[b],C=g[y]-o.reference[y],E=await(a.getOffsetParent==null?void 0:a.getOffsetParent(d));let T=E?E[_]:0;(!T||!await(a.isElement==null?void 0:a.isElement(E)))&&(T=c.floating[_]||o.floating[b]);const A=M/2-C/2,U=T/2-S[b]/2-1,R=Yc(p[x],U),N=Yc(p[I],U),L=R,B=T-S[b]-N,j=T/2-S[b]/2+A,$=wM(L,j,B),F=!u.arrow&&jp(i)!=null&&j!==$&&o.reference[b]/2-(j<L?R:N)-S[b]/2<0,K=F?j<L?j-L:j-B:0;return{[y]:g[y]+K,data:{[y]:$,centerOffset:j-$-K,...F&&{alignmentOffset:K}},reset:F}}}),Pje=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:i,middlewareData:o,rects:a,initialPlacement:c,platform:u,elements:d}=t,{mainAxis:h=!0,crossAxis:p=!0,fallbackPlacements:g,fallbackStrategy:y="bestFit",fallbackAxisSideDirection:b="none",flipAlignment:S=!0,...w}=Nl(e,t);if((n=o.arrow)!=null&&n.alignmentOffset)return{};const x=Ll(i),I=wa(c),_=Ll(c)===c,M=await(u.isRTL==null?void 0:u.isRTL(d.floating)),C=g||(_||!S?[Kw(c)]:Eje(c)),E=b!=="none";!g&&E&&C.push(...Rje(c,S,b,M));const T=[c,...C],A=await Ey(t,w),U=[];let R=((r=o.flip)==null?void 0:r.overflows)||[];if(h&&U.push(A[x]),p){const j=Ije(i,a,M);U.push(A[j[0]],A[j[1]])}if(R=[...R,{placement:i,overflows:U}],!U.every(j=>j<=0)){var N,L;const j=(((N=o.flip)==null?void 0:N.index)||0)+1,$=T[j];if($&&(!(p==="alignment"?I!==wa($):!1)||R.every(W=>wa(W.placement)===I?W.overflows[0]>0:!0)))return{data:{index:j,overflows:R},reset:{placement:$}};let F=(L=R.filter(K=>K.overflows[0]<=0).sort((K,W)=>K.overflows[1]-W.overflows[1])[0])==null?void 0:L.placement;if(!F)switch(y){case"bestFit":{var B;const K=(B=R.filter(W=>{if(E){const X=wa(W.placement);return X===I||X==="y"}return!0}).map(W=>[W.placement,W.overflows.filter(X=>X>0).reduce((X,V)=>X+V,0)]).sort((W,X)=>W[1]-X[1])[0])==null?void 0:B[0];K&&(F=K);break}case"initialPlacement":F=c;break}if(i!==F)return{reset:{placement:F}}}return{}}}};function $q(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function jq(e){return wje.some(t=>e[t]>=0)}const Nje=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n}=t,{strategy:r="referenceHidden",...i}=Nl(e,t);switch(r){case"referenceHidden":{const o=await Ey(t,{...i,elementContext:"reference"}),a=$q(o,n.reference);return{data:{referenceHiddenOffsets:a,referenceHidden:jq(a)}}}case"escaped":{const o=await Ey(t,{...i,altBoundary:!0}),a=$q(o,n.floating);return{data:{escapedOffsets:a,escaped:jq(a)}}}default:return{}}}}},SY=new Set(["left","top"]);async function Lje(e,t){const{placement:n,platform:r,elements:i}=e,o=await(r.isRTL==null?void 0:r.isRTL(i.floating)),a=Ll(n),c=jp(n),u=wa(n)==="y",d=SY.has(a)?-1:1,h=o&&u?-1:1,p=Nl(t,e);let{mainAxis:g,crossAxis:y,alignmentAxis:b}=typeof p=="number"?{mainAxis:p,crossAxis:0,alignmentAxis:null}:{mainAxis:p.mainAxis||0,crossAxis:p.crossAxis||0,alignmentAxis:p.alignmentAxis};return c&&typeof b=="number"&&(y=c==="end"?b*-1:b),u?{x:y*h,y:g*d}:{x:g*d,y:y*h}}const $je=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:i,y:o,placement:a,middlewareData:c}=t,u=await Lje(t,e);return a===((n=c.offset)==null?void 0:n.placement)&&(r=c.arrow)!=null&&r.alignmentOffset?{}:{x:i+u.x,y:o+u.y,data:{...u,placement:a}}}}},jje=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:i}=t,{mainAxis:o=!0,crossAxis:a=!1,limiter:c={fn:w=>{let{x,y:I}=w;return{x,y:I}}},...u}=Nl(e,t),d={x:n,y:r},h=await Ey(t,u),p=wa(Ll(i)),g=GD(p);let y=d[g],b=d[p];if(o){const w=g==="y"?"top":"left",x=g==="y"?"bottom":"right",I=y+h[w],_=y-h[x];y=wM(I,y,_)}if(a){const w=p==="y"?"top":"left",x=p==="y"?"bottom":"right",I=b+h[w],_=b-h[x];b=wM(I,b,_)}const S=c.fn({...t,[g]:y,[p]:b});return{...S,data:{x:S.x-n,y:S.y-r,enabled:{[g]:o,[p]:a}}}}}},Fje=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:r,placement:i,rects:o,middlewareData:a}=t,{offset:c=0,mainAxis:u=!0,crossAxis:d=!0}=Nl(e,t),h={x:n,y:r},p=wa(i),g=GD(p);let y=h[g],b=h[p];const S=Nl(c,t),w=typeof S=="number"?{mainAxis:S,crossAxis:0}:{mainAxis:0,crossAxis:0,...S};if(u){const _=g==="y"?"height":"width",M=o.reference[g]-o.floating[_]+w.mainAxis,C=o.reference[g]+o.reference[_]-w.mainAxis;y<M?y=M:y>C&&(y=C)}if(d){var x,I;const _=g==="y"?"width":"height",M=SY.has(Ll(i)),C=o.reference[p]-o.floating[_]+(M&&((x=a.offset)==null?void 0:x[p])||0)+(M?0:w.crossAxis),E=o.reference[p]+o.reference[_]+(M?0:((I=a.offset)==null?void 0:I[p])||0)-(M?w.crossAxis:0);b<C?b=C:b>E&&(b=E)}return{[g]:y,[p]:b}}}},zje=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,r;const{placement:i,rects:o,platform:a,elements:c}=t,{apply:u=()=>{},...d}=Nl(e,t),h=await Ey(t,d),p=Ll(i),g=jp(i),y=wa(i)==="y",{width:b,height:S}=o.floating;let w,x;p==="top"||p==="bottom"?(w=p,x=g===(await(a.isRTL==null?void 0:a.isRTL(c.floating))?"start":"end")?"left":"right"):(x=p,w=g==="end"?"top":"bottom");const I=S-h.top-h.bottom,_=b-h.left-h.right,M=Yc(S-h[w],I),C=Yc(b-h[x],_),E=!t.middlewareData.shift;let T=M,A=C;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(A=_),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(T=I),E&&!g){const R=No(h.left,0),N=No(h.right,0),L=No(h.top,0),B=No(h.bottom,0);y?A=b-2*(R!==0||N!==0?R+N:No(h.left,h.right)):T=S-2*(L!==0||B!==0?L+B:No(h.top,h.bottom))}await u({...t,availableWidth:A,availableHeight:T});const U=await a.getDimensions(c.floating);return b!==U.width||S!==U.height?{reset:{rects:!0}}:{}}}};function Ok(){return typeof window<"u"}function Fp(e){return wY(e)?(e.nodeName||"").toLowerCase():"#document"}function Ko(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function za(e){var t;return(t=(wY(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function wY(e){return Ok()?e instanceof Node||e instanceof Ko(e).Node:!1}function na(e){return Ok()?e instanceof Element||e instanceof Ko(e).Element:!1}function Na(e){return Ok()?e instanceof HTMLElement||e instanceof Ko(e).HTMLElement:!1}function Fq(e){return!Ok()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Ko(e).ShadowRoot}const Bje=new Set(["inline","contents"]);function Mb(e){const{overflow:t,overflowX:n,overflowY:r,display:i}=ra(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!Bje.has(i)}const qje=new Set(["table","td","th"]);function Uje(e){return qje.has(Fp(e))}const Vje=[":popover-open",":modal"];function Dk(e){return Vje.some(t=>{try{return e.matches(t)}catch{return!1}})}const Kje=["transform","translate","scale","rotate","perspective"],Hje=["transform","translate","scale","rotate","perspective","filter"],Wje=["paint","layout","strict","content"];function XD(e){const t=JD(),n=na(e)?ra(e):e;return Kje.some(r=>n[r]?n[r]!=="none":!1)||(n.containerType?n.containerType!=="normal":!1)||!t&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!t&&(n.filter?n.filter!=="none":!1)||Hje.some(r=>(n.willChange||"").includes(r))||Wje.some(r=>(n.contain||"").includes(r))}function Gje(e){let t=Qc(e);for(;Na(t)&&!tp(t);){if(XD(t))return t;if(Dk(t))return null;t=Qc(t)}return null}function JD(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const Yje=new Set(["html","body","#document"]);function tp(e){return Yje.has(Fp(e))}function ra(e){return Ko(e).getComputedStyle(e)}function Pk(e){return na(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Qc(e){if(Fp(e)==="html")return e;const t=e.assignedSlot||e.parentNode||Fq(e)&&e.host||za(e);return Fq(t)?t.host:t}function xY(e){const t=Qc(e);return tp(t)?e.ownerDocument?e.ownerDocument.body:e.body:Na(t)&&Mb(t)?t:xY(t)}function Ty(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const i=xY(e),o=i===((r=e.ownerDocument)==null?void 0:r.body),a=Ko(i);if(o){const c=kM(a);return t.concat(a,a.visualViewport||[],Mb(i)?i:[],c&&n?Ty(c):[])}return t.concat(i,Ty(i,[],n))}function kM(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function kY(e){const t=ra(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const i=Na(e),o=i?e.offsetWidth:n,a=i?e.offsetHeight:r,c=Vw(n)!==o||Vw(r)!==a;return c&&(n=o,r=a),{width:n,height:r,$:c}}function ZD(e){return na(e)?e:e.contextElement}function _h(e){const t=ZD(e);if(!Na(t))return Ra(1);const n=t.getBoundingClientRect(),{width:r,height:i,$:o}=kY(t);let a=(o?Vw(n.width):n.width)/r,c=(o?Vw(n.height):n.height)/i;return(!a||!Number.isFinite(a))&&(a=1),(!c||!Number.isFinite(c))&&(c=1),{x:a,y:c}}const Qje=Ra(0);function _Y(e){const t=Ko(e);return!JD()||!t.visualViewport?Qje:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Xje(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==Ko(e)?!1:t}function Nd(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const i=e.getBoundingClientRect(),o=ZD(e);let a=Ra(1);t&&(r?na(r)&&(a=_h(r)):a=_h(e));const c=Xje(o,n,r)?_Y(o):Ra(0);let u=(i.left+c.x)/a.x,d=(i.top+c.y)/a.y,h=i.width/a.x,p=i.height/a.y;if(o){const g=Ko(o),y=r&&na(r)?Ko(r):r;let b=g,S=kM(b);for(;S&&r&&y!==b;){const w=_h(S),x=S.getBoundingClientRect(),I=ra(S),_=x.left+(S.clientLeft+parseFloat(I.paddingLeft))*w.x,M=x.top+(S.clientTop+parseFloat(I.paddingTop))*w.y;u*=w.x,d*=w.y,h*=w.x,p*=w.y,u+=_,d+=M,b=Ko(S),S=kM(b)}}return Hw({width:h,height:p,x:u,y:d})}function Nk(e,t){const n=Pk(e).scrollLeft;return t?t.left+n:Nd(za(e)).left+n}function IY(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-Nk(e,n),i=n.top+t.scrollTop;return{x:r,y:i}}function Jje(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e;const o=i==="fixed",a=za(r),c=t?Dk(t.floating):!1;if(r===a||c&&o)return n;let u={scrollLeft:0,scrollTop:0},d=Ra(1);const h=Ra(0),p=Na(r);if((p||!p&&!o)&&((Fp(r)!=="body"||Mb(a))&&(u=Pk(r)),Na(r))){const y=Nd(r);d=_h(r),h.x=y.x+r.clientLeft,h.y=y.y+r.clientTop}const g=a&&!p&&!o?IY(a,u):Ra(0);return{width:n.width*d.x,height:n.height*d.y,x:n.x*d.x-u.scrollLeft*d.x+h.x+g.x,y:n.y*d.y-u.scrollTop*d.y+h.y+g.y}}function Zje(e){return Array.from(e.getClientRects())}function eFe(e){const t=za(e),n=Pk(e),r=e.ownerDocument.body,i=No(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),o=No(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let a=-n.scrollLeft+Nk(e);const c=-n.scrollTop;return ra(r).direction==="rtl"&&(a+=No(t.clientWidth,r.clientWidth)-i),{width:i,height:o,x:a,y:c}}const zq=25;function tFe(e,t){const n=Ko(e),r=za(e),i=n.visualViewport;let o=r.clientWidth,a=r.clientHeight,c=0,u=0;if(i){o=i.width,a=i.height;const h=JD();(!h||h&&t==="fixed")&&(c=i.offsetLeft,u=i.offsetTop)}const d=Nk(r);if(d<=0){const h=r.ownerDocument,p=h.body,g=getComputedStyle(p),y=h.compatMode==="CSS1Compat"&&parseFloat(g.marginLeft)+parseFloat(g.marginRight)||0,b=Math.abs(r.clientWidth-p.clientWidth-y);b<=zq&&(o-=b)}else d<=zq&&(o+=d);return{width:o,height:a,x:c,y:u}}const nFe=new Set(["absolute","fixed"]);function rFe(e,t){const n=Nd(e,!0,t==="fixed"),r=n.top+e.clientTop,i=n.left+e.clientLeft,o=Na(e)?_h(e):Ra(1),a=e.clientWidth*o.x,c=e.clientHeight*o.y,u=i*o.x,d=r*o.y;return{width:a,height:c,x:u,y:d}}function Bq(e,t,n){let r;if(t==="viewport")r=tFe(e,n);else if(t==="document")r=eFe(za(e));else if(na(t))r=rFe(t,n);else{const i=_Y(e);r={x:t.x-i.x,y:t.y-i.y,width:t.width,height:t.height}}return Hw(r)}function EY(e,t){const n=Qc(e);return n===t||!na(n)||tp(n)?!1:ra(n).position==="fixed"||EY(n,t)}function iFe(e,t){const n=t.get(e);if(n)return n;let r=Ty(e,[],!1).filter(c=>na(c)&&Fp(c)!=="body"),i=null;const o=ra(e).position==="fixed";let a=o?Qc(e):e;for(;na(a)&&!tp(a);){const c=ra(a),u=XD(a);!u&&c.position==="fixed"&&(i=null),(o?!u&&!i:!u&&c.position==="static"&&!!i&&nFe.has(i.position)||Mb(a)&&!u&&EY(e,a))?r=r.filter(h=>h!==a):i=c,a=Qc(a)}return t.set(e,r),r}function oFe(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e;const a=[...n==="clippingAncestors"?Dk(t)?[]:iFe(t,this._c):[].concat(n),r],c=a[0],u=a.reduce((d,h)=>{const p=Bq(t,h,i);return d.top=No(p.top,d.top),d.right=Yc(p.right,d.right),d.bottom=Yc(p.bottom,d.bottom),d.left=No(p.left,d.left),d},Bq(t,c,i));return{width:u.right-u.left,height:u.bottom-u.top,x:u.left,y:u.top}}function sFe(e){const{width:t,height:n}=kY(e);return{width:t,height:n}}function aFe(e,t,n){const r=Na(t),i=za(t),o=n==="fixed",a=Nd(e,!0,o,t);let c={scrollLeft:0,scrollTop:0};const u=Ra(0);function d(){u.x=Nk(i)}if(r||!r&&!o)if((Fp(t)!=="body"||Mb(i))&&(c=Pk(t)),r){const y=Nd(t,!0,o,t);u.x=y.x+t.clientLeft,u.y=y.y+t.clientTop}else i&&d();o&&!r&&i&&d();const h=i&&!r&&!o?IY(i,c):Ra(0),p=a.left+c.scrollLeft-u.x-h.x,g=a.top+c.scrollTop-u.y-h.y;return{x:p,y:g,width:a.width,height:a.height}}function BE(e){return ra(e).position==="static"}function qq(e,t){if(!Na(e)||ra(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return za(e)===n&&(n=n.ownerDocument.body),n}function TY(e,t){const n=Ko(e);if(Dk(e))return n;if(!Na(e)){let i=Qc(e);for(;i&&!tp(i);){if(na(i)&&!BE(i))return i;i=Qc(i)}return n}let r=qq(e,t);for(;r&&Uje(r)&&BE(r);)r=qq(r,t);return r&&tp(r)&&BE(r)&&!XD(r)?n:r||Gje(e)||n}const lFe=async function(e){const t=this.getOffsetParent||TY,n=this.getDimensions,r=await n(e.floating);return{reference:aFe(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function cFe(e){return ra(e).direction==="rtl"}const uFe={convertOffsetParentRelativeRectToViewportRelativeRect:Jje,getDocumentElement:za,getClippingRect:oFe,getOffsetParent:TY,getElementRects:lFe,getClientRects:Zje,getDimensions:sFe,getScale:_h,isElement:na,isRTL:cFe};function CY(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function dFe(e,t){let n=null,r;const i=za(e);function o(){var c;clearTimeout(r),(c=n)==null||c.disconnect(),n=null}function a(c,u){c===void 0&&(c=!1),u===void 0&&(u=1),o();const d=e.getBoundingClientRect(),{left:h,top:p,width:g,height:y}=d;if(c||t(),!g||!y)return;const b=$S(p),S=$S(i.clientWidth-(h+g)),w=$S(i.clientHeight-(p+y)),x=$S(h),_={rootMargin:-b+"px "+-S+"px "+-w+"px "+-x+"px",threshold:No(0,Yc(1,u))||1};let M=!0;function C(E){const T=E[0].intersectionRatio;if(T!==u){if(!M)return a();T?a(!1,T):r=setTimeout(()=>{a(!1,1e-7)},1e3)}T===1&&!CY(d,e.getBoundingClientRect())&&a(),M=!1}try{n=new IntersectionObserver(C,{..._,root:i.ownerDocument})}catch{n=new IntersectionObserver(C,_)}n.observe(e)}return a(!0),o}function fFe(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:i=!0,ancestorResize:o=!0,elementResize:a=typeof ResizeObserver=="function",layoutShift:c=typeof IntersectionObserver=="function",animationFrame:u=!1}=r,d=ZD(e),h=i||o?[...d?Ty(d):[],...Ty(t)]:[];h.forEach(x=>{i&&x.addEventListener("scroll",n,{passive:!0}),o&&x.addEventListener("resize",n)});const p=d&&c?dFe(d,n):null;let g=-1,y=null;a&&(y=new ResizeObserver(x=>{let[I]=x;I&&I.target===d&&y&&(y.unobserve(t),cancelAnimationFrame(g),g=requestAnimationFrame(()=>{var _;(_=y)==null||_.observe(t)})),n()}),d&&!u&&y.observe(d),y.observe(t));let b,S=u?Nd(e):null;u&&w();function w(){const x=Nd(e);S&&!CY(S,x)&&n(),S=x,b=requestAnimationFrame(w)}return n(),()=>{var x;h.forEach(I=>{i&&I.removeEventListener("scroll",n),o&&I.removeEventListener("resize",n)}),p?.(),(x=y)==null||x.disconnect(),y=null,u&&cancelAnimationFrame(b)}}const hFe=$je,pFe=jje,mFe=Pje,gFe=zje,yFe=Nje,Uq=Dje,bFe=Fje,vFe=(e,t,n)=>{const r=new Map,i={platform:uFe,...n},o={...i.platform,_c:r};return Oje(e,t,{...i,platform:o})};var SFe=typeof document<"u",wFe=function(){},x0=SFe?D.useLayoutEffect:wFe;function Ww(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,r,i;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!Ww(e[r],t[r]))return!1;return!0}if(i=Object.keys(e),n=i.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,i[r]))return!1;for(r=n;r--!==0;){const o=i[r];if(!(o==="_owner"&&e.$$typeof)&&!Ww(e[o],t[o]))return!1}return!0}return e!==e&&t!==t}function MY(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Vq(e,t){const n=MY(e);return Math.round(t*n)/n}function qE(e){const t=D.useRef(e);return x0(()=>{t.current=e}),t}function xFe(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:i,elements:{reference:o,floating:a}={},transform:c=!0,whileElementsMounted:u,open:d}=e,[h,p]=D.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[g,y]=D.useState(r);Ww(g,r)||y(r);const[b,S]=D.useState(null),[w,x]=D.useState(null),I=D.useCallback(W=>{W!==E.current&&(E.current=W,S(W))},[]),_=D.useCallback(W=>{W!==T.current&&(T.current=W,x(W))},[]),M=o||b,C=a||w,E=D.useRef(null),T=D.useRef(null),A=D.useRef(h),U=u!=null,R=qE(u),N=qE(i),L=qE(d),B=D.useCallback(()=>{if(!E.current||!T.current)return;const W={placement:t,strategy:n,middleware:g};N.current&&(W.platform=N.current),vFe(E.current,T.current,W).then(X=>{const V={...X,isPositioned:L.current!==!1};j.current&&!Ww(A.current,V)&&(A.current=V,wb.flushSync(()=>{p(V)}))})},[g,t,n,N,L]);x0(()=>{d===!1&&A.current.isPositioned&&(A.current.isPositioned=!1,p(W=>({...W,isPositioned:!1})))},[d]);const j=D.useRef(!1);x0(()=>(j.current=!0,()=>{j.current=!1}),[]),x0(()=>{if(M&&(E.current=M),C&&(T.current=C),M&&C){if(R.current)return R.current(M,C,B);B()}},[M,C,B,R,U]);const $=D.useMemo(()=>({reference:E,floating:T,setReference:I,setFloating:_}),[I,_]),F=D.useMemo(()=>({reference:M,floating:C}),[M,C]),K=D.useMemo(()=>{const W={position:n,left:0,top:0};if(!F.floating)return W;const X=Vq(F.floating,h.x),V=Vq(F.floating,h.y);return c?{...W,transform:"translate("+X+"px, "+V+"px)",...MY(F.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:X,top:V}},[n,c,F.floating,h.x,h.y]);return D.useMemo(()=>({...h,update:B,refs:$,elements:F,floatingStyles:K}),[h,B,$,F,K])}const kFe=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:r,padding:i}=typeof e=="function"?e(n):e;return r&&t(r)?r.current!=null?Uq({element:r.current,padding:i}).fn(n):{}:r?Uq({element:r,padding:i}).fn(n):{}}}},_Fe=(e,t)=>({...hFe(e),options:[e,t]}),IFe=(e,t)=>({...pFe(e),options:[e,t]}),EFe=(e,t)=>({...bFe(e),options:[e,t]}),TFe=(e,t)=>({...mFe(e),options:[e,t]}),CFe=(e,t)=>({...gFe(e),options:[e,t]}),MFe=(e,t)=>({...yFe(e),options:[e,t]}),RFe=(e,t)=>({...kFe(e),options:[e,t]});var AFe="Arrow",RY=D.forwardRef((e,t)=>{const{children:n,width:r=10,height:i=5,...o}=e;return P.jsx(jn.svg,{...o,ref:t,width:r,height:i,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:P.jsx("polygon",{points:"0,0 30,0 15,10"})})});RY.displayName=AFe;var OFe=RY;function DFe(e){const[t,n]=D.useState(void 0);return Pi(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const r=new ResizeObserver(i=>{if(!Array.isArray(i)||!i.length)return;const o=i[0];let a,c;if("borderBoxSize"in o){const u=o.borderBoxSize,d=Array.isArray(u)?u[0]:u;a=d.inlineSize,c=d.blockSize}else a=e.offsetWidth,c=e.offsetHeight;n({width:a,height:c})});return r.observe(e,{box:"border-box"}),()=>r.unobserve(e)}else n(void 0)},[e]),t}var eP="Popper",[AY,OY]=kk(eP),[PFe,DY]=AY(eP),PY=e=>{const{__scopePopper:t,children:n}=e,[r,i]=D.useState(null);return P.jsx(PFe,{scope:t,anchor:r,onAnchorChange:i,children:n})};PY.displayName=eP;var NY="PopperAnchor",LY=D.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:r,...i}=e,o=DY(NY,n),a=D.useRef(null),c=Tr(t,a),u=D.useRef(null);return D.useEffect(()=>{const d=u.current;u.current=r?.current||a.current,d!==u.current&&o.onAnchorChange(u.current)}),r?null:P.jsx(jn.div,{...i,ref:c})});LY.displayName=NY;var tP="PopperContent",[NFe,LFe]=AY(tP),$Y=D.forwardRef((e,t)=>{const{__scopePopper:n,side:r="bottom",sideOffset:i=0,align:o="center",alignOffset:a=0,arrowPadding:c=0,avoidCollisions:u=!0,collisionBoundary:d=[],collisionPadding:h=0,sticky:p="partial",hideWhenDetached:g=!1,updatePositionStrategy:y="optimized",onPlaced:b,...S}=e,w=DY(tP,n),[x,I]=D.useState(null),_=Tr(t,J=>I(J)),[M,C]=D.useState(null),E=DFe(M),T=E?.width??0,A=E?.height??0,U=r+(o!=="center"?"-"+o:""),R=typeof h=="number"?h:{top:0,right:0,bottom:0,left:0,...h},N=Array.isArray(d)?d:[d],L=N.length>0,B={padding:R,boundary:N.filter(jFe),altBoundary:L},{refs:j,floatingStyles:$,placement:F,isPositioned:K,middlewareData:W}=xFe({strategy:"fixed",placement:U,whileElementsMounted:(...J)=>fFe(...J,{animationFrame:y==="always"}),elements:{reference:w.anchor},middleware:[_Fe({mainAxis:i+A,alignmentAxis:a}),u&&IFe({mainAxis:!0,crossAxis:!1,limiter:p==="partial"?EFe():void 0,...B}),u&&TFe({...B}),CFe({...B,apply:({elements:J,rects:ge,availableWidth:te,availableHeight:pe})=>{const{width:oe,height:ye}=ge.reference,xe=J.floating.style;xe.setProperty("--radix-popper-available-width",`${te}px`),xe.setProperty("--radix-popper-available-height",`${pe}px`),xe.setProperty("--radix-popper-anchor-width",`${oe}px`),xe.setProperty("--radix-popper-anchor-height",`${ye}px`)}}),M&&RFe({element:M,padding:c}),FFe({arrowWidth:T,arrowHeight:A}),g&&MFe({strategy:"referenceHidden",...B})]}),[X,V]=zY(F),z=Od(b);Pi(()=>{K&&z?.()},[K,z]);const Q=W.arrow?.x,q=W.arrow?.y,ie=W.arrow?.centerOffset!==0,[le,ee]=D.useState();return Pi(()=>{x&&ee(window.getComputedStyle(x).zIndex)},[x]),P.jsx("div",{ref:j.setFloating,"data-radix-popper-content-wrapper":"",style:{...$,transform:K?$.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:le,"--radix-popper-transform-origin":[W.transformOrigin?.x,W.transformOrigin?.y].join(" "),...W.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:P.jsx(NFe,{scope:n,placedSide:X,onArrowChange:C,arrowX:Q,arrowY:q,shouldHideArrow:ie,children:P.jsx(jn.div,{"data-side":X,"data-align":V,...S,ref:_,style:{...S.style,animation:K?void 0:"none"}})})})});$Y.displayName=tP;var jY="PopperArrow",$Fe={top:"bottom",right:"left",bottom:"top",left:"right"},FY=D.forwardRef(function(t,n){const{__scopePopper:r,...i}=t,o=LFe(jY,r),a=$Fe[o.placedSide];return P.jsx("span",{ref:o.onArrowChange,style:{position:"absolute",left:o.arrowX,top:o.arrowY,[a]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[o.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[o.placedSide],visibility:o.shouldHideArrow?"hidden":void 0},children:P.jsx(OFe,{...i,ref:n,style:{...i.style,display:"block"}})})});FY.displayName=jY;function jFe(e){return e!==null}var FFe=e=>({name:"transformOrigin",options:e,fn(t){const{placement:n,rects:r,middlewareData:i}=t,a=i.arrow?.centerOffset!==0,c=a?0:e.arrowWidth,u=a?0:e.arrowHeight,[d,h]=zY(n),p={start:"0%",center:"50%",end:"100%"}[h],g=(i.arrow?.x??0)+c/2,y=(i.arrow?.y??0)+u/2;let b="",S="";return d==="bottom"?(b=a?p:`${g}px`,S=`${-u}px`):d==="top"?(b=a?p:`${g}px`,S=`${r.floating.height+u}px`):d==="right"?(b=`${-u}px`,S=a?p:`${y}px`):d==="left"&&(b=`${r.floating.width+u}px`,S=a?p:`${y}px`),{data:{x:b,y:S}}}});function zY(e){const[t,n="center"]=e.split("-");return[t,n]}var zFe=PY,BFe=LY,qFe=$Y,UFe=FY;function VFe(e){const t=D.useRef({value:e,previous:e});return D.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var BY=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),KFe="VisuallyHidden",HFe=D.forwardRef((e,t)=>P.jsx(jn.span,{...e,ref:t,style:{...BY,...e.style}}));HFe.displayName=KFe;var WFe=[" ","Enter","ArrowUp","ArrowDown"],GFe=[" ","Enter"],Ld="Select",[Lk,$k,YFe]=bje(Ld),[zp]=kk(Ld,[YFe,OY]),jk=OY(),[QFe,lu]=zp(Ld),[XFe,JFe]=zp(Ld),qY=e=>{const{__scopeSelect:t,children:n,open:r,defaultOpen:i,onOpenChange:o,value:a,defaultValue:c,onValueChange:u,dir:d,name:h,autoComplete:p,disabled:g,required:y,form:b}=e,S=jk(t),[w,x]=D.useState(null),[I,_]=D.useState(null),[M,C]=D.useState(!1),E=Sje(d),[T,A]=aM({prop:r,defaultProp:i??!1,onChange:o,caller:Ld}),[U,R]=aM({prop:a,defaultProp:c,onChange:u,caller:Ld}),N=D.useRef(null),L=w?b||!!w.closest("form"):!0,[B,j]=D.useState(new Set),$=Array.from(B).map(F=>F.props.value).join(";");return P.jsx(zFe,{...S,children:P.jsxs(QFe,{required:y,scope:t,trigger:w,onTriggerChange:x,valueNode:I,onValueNodeChange:_,valueNodeHasChildren:M,onValueNodeHasChildrenChange:C,contentId:wh(),value:U,onValueChange:R,open:T,onOpenChange:A,dir:E,triggerPointerDownPosRef:N,disabled:g,children:[P.jsx(Lk.Provider,{scope:t,children:P.jsx(XFe,{scope:e.__scopeSelect,onNativeOptionAdd:D.useCallback(F=>{j(K=>new Set(K).add(F))},[]),onNativeOptionRemove:D.useCallback(F=>{j(K=>{const W=new Set(K);return W.delete(F),W})},[]),children:n})}),L?P.jsxs(fQ,{"aria-hidden":!0,required:y,tabIndex:-1,name:h,autoComplete:p,value:U,onChange:F=>R(F.target.value),disabled:g,form:b,children:[U===void 0?P.jsx("option",{value:""}):null,Array.from(B)]},$):null]})})};qY.displayName=Ld;var UY="SelectTrigger",VY=D.forwardRef((e,t)=>{const{__scopeSelect:n,disabled:r=!1,...i}=e,o=jk(n),a=lu(UY,n),c=a.disabled||r,u=Tr(t,a.onTriggerChange),d=$k(n),h=D.useRef("touch"),[p,g,y]=pQ(S=>{const w=d().filter(_=>!_.disabled),x=w.find(_=>_.value===a.value),I=mQ(w,S,x);I!==void 0&&a.onValueChange(I.value)}),b=S=>{c||(a.onOpenChange(!0),y()),S&&(a.triggerPointerDownPosRef.current={x:Math.round(S.pageX),y:Math.round(S.pageY)})};return P.jsx(BFe,{asChild:!0,...o,children:P.jsx(jn.button,{type:"button",role:"combobox","aria-controls":a.contentId,"aria-expanded":a.open,"aria-required":a.required,"aria-autocomplete":"none",dir:a.dir,"data-state":a.open?"open":"closed",disabled:c,"data-disabled":c?"":void 0,"data-placeholder":hQ(a.value)?"":void 0,...i,ref:u,onClick:Un(i.onClick,S=>{S.currentTarget.focus(),h.current!=="mouse"&&b(S)}),onPointerDown:Un(i.onPointerDown,S=>{h.current=S.pointerType;const w=S.target;w.hasPointerCapture(S.pointerId)&&w.releasePointerCapture(S.pointerId),S.button===0&&S.ctrlKey===!1&&S.pointerType==="mouse"&&(b(S),S.preventDefault())}),onKeyDown:Un(i.onKeyDown,S=>{const w=p.current!=="";!(S.ctrlKey||S.altKey||S.metaKey)&&S.key.length===1&&g(S.key),!(w&&S.key===" ")&&WFe.includes(S.key)&&(b(),S.preventDefault())})})})});VY.displayName=UY;var KY="SelectValue",HY=D.forwardRef((e,t)=>{const{__scopeSelect:n,className:r,style:i,children:o,placeholder:a="",...c}=e,u=lu(KY,n),{onValueNodeHasChildrenChange:d}=u,h=o!==void 0,p=Tr(t,u.onValueNodeChange);return Pi(()=>{d(h)},[d,h]),P.jsx(jn.span,{...c,ref:p,style:{pointerEvents:"none"},children:hQ(u.value)?P.jsx(P.Fragment,{children:a}):o})});HY.displayName=KY;var ZFe="SelectIcon",WY=D.forwardRef((e,t)=>{const{__scopeSelect:n,children:r,...i}=e;return P.jsx(jn.span,{"aria-hidden":!0,...i,ref:t,children:r||"▼"})});WY.displayName=ZFe;var eze="SelectPortal",GY=e=>P.jsx(_D,{asChild:!0,...e});GY.displayName=eze;var $d="SelectContent",YY=D.forwardRef((e,t)=>{const n=lu($d,e.__scopeSelect),[r,i]=D.useState();if(Pi(()=>{i(new DocumentFragment)},[]),!n.open){const o=r;return o?wb.createPortal(P.jsx(QY,{scope:e.__scopeSelect,children:P.jsx(Lk.Slot,{scope:e.__scopeSelect,children:P.jsx("div",{children:e.children})})}),o):null}return P.jsx(XY,{...e,ref:t})});YY.displayName=$d;var Ns=10,[QY,cu]=zp($d),tze="SelectContentImpl",nze=ky("SelectContent.RemoveScroll"),XY=D.forwardRef((e,t)=>{const{__scopeSelect:n,position:r="item-aligned",onCloseAutoFocus:i,onEscapeKeyDown:o,onPointerDownOutside:a,side:c,sideOffset:u,align:d,alignOffset:h,arrowPadding:p,collisionBoundary:g,collisionPadding:y,sticky:b,hideWhenDetached:S,avoidCollisions:w,...x}=e,I=lu($d,n),[_,M]=D.useState(null),[C,E]=D.useState(null),T=Tr(t,J=>M(J)),[A,U]=D.useState(null),[R,N]=D.useState(null),L=$k(n),[B,j]=D.useState(!1),$=D.useRef(!1);D.useEffect(()=>{if(_)return XG(_)},[_]),qG();const F=D.useCallback(J=>{const[ge,...te]=L().map(ye=>ye.ref.current),[pe]=te.slice(-1),oe=document.activeElement;for(const ye of J)if(ye===oe||(ye?.scrollIntoView({block:"nearest"}),ye===ge&&C&&(C.scrollTop=0),ye===pe&&C&&(C.scrollTop=C.scrollHeight),ye?.focus(),document.activeElement!==oe))return},[L,C]),K=D.useCallback(()=>F([A,_]),[F,A,_]);D.useEffect(()=>{B&&K()},[B,K]);const{onOpenChange:W,triggerPointerDownPosRef:X}=I;D.useEffect(()=>{if(_){let J={x:0,y:0};const ge=pe=>{J={x:Math.abs(Math.round(pe.pageX)-(X.current?.x??0)),y:Math.abs(Math.round(pe.pageY)-(X.current?.y??0))}},te=pe=>{J.x<=10&&J.y<=10?pe.preventDefault():_.contains(pe.target)||W(!1),document.removeEventListener("pointermove",ge),X.current=null};return X.current!==null&&(document.addEventListener("pointermove",ge),document.addEventListener("pointerup",te,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",ge),document.removeEventListener("pointerup",te,{capture:!0})}}},[_,W,X]),D.useEffect(()=>{const J=()=>W(!1);return window.addEventListener("blur",J),window.addEventListener("resize",J),()=>{window.removeEventListener("blur",J),window.removeEventListener("resize",J)}},[W]);const[V,z]=pQ(J=>{const ge=L().filter(oe=>!oe.disabled),te=ge.find(oe=>oe.ref.current===document.activeElement),pe=mQ(ge,J,te);pe&&setTimeout(()=>pe.ref.current.focus())}),Q=D.useCallback((J,ge,te)=>{const pe=!$.current&&!te;(I.value!==void 0&&I.value===ge||pe)&&(U(J),pe&&($.current=!0))},[I.value]),q=D.useCallback(()=>_?.focus(),[_]),ie=D.useCallback((J,ge,te)=>{const pe=!$.current&&!te;(I.value!==void 0&&I.value===ge||pe)&&N(J)},[I.value]),le=r==="popper"?_M:JY,ee=le===_M?{side:c,sideOffset:u,align:d,alignOffset:h,arrowPadding:p,collisionBoundary:g,collisionPadding:y,sticky:b,hideWhenDetached:S,avoidCollisions:w}:{};return P.jsx(QY,{scope:n,content:_,viewport:C,onViewportChange:E,itemRefCallback:Q,selectedItem:A,onItemLeave:q,itemTextRefCallback:ie,focusSelectedItem:K,selectedItemText:R,position:r,isPositioned:B,searchRef:V,children:P.jsx(ID,{as:nze,allowPinchZoom:!0,children:P.jsx(kD,{asChild:!0,trapped:I.open,onMountAutoFocus:J=>{J.preventDefault()},onUnmountAutoFocus:Un(i,J=>{I.trigger?.focus({preventScroll:!0}),J.preventDefault()}),children:P.jsx(xD,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:o,onPointerDownOutside:a,onFocusOutside:J=>J.preventDefault(),onDismiss:()=>I.onOpenChange(!1),children:P.jsx(le,{role:"listbox",id:I.contentId,"data-state":I.open?"open":"closed",dir:I.dir,onContextMenu:J=>J.preventDefault(),...x,...ee,onPlaced:()=>j(!0),ref:T,style:{display:"flex",flexDirection:"column",outline:"none",...x.style},onKeyDown:Un(x.onKeyDown,J=>{const ge=J.ctrlKey||J.altKey||J.metaKey;if(J.key==="Tab"&&J.preventDefault(),!ge&&J.key.length===1&&z(J.key),["ArrowUp","ArrowDown","Home","End"].includes(J.key)){let pe=L().filter(oe=>!oe.disabled).map(oe=>oe.ref.current);if(["ArrowUp","End"].includes(J.key)&&(pe=pe.slice().reverse()),["ArrowUp","ArrowDown"].includes(J.key)){const oe=J.target,ye=pe.indexOf(oe);pe=pe.slice(ye+1)}setTimeout(()=>F(pe)),J.preventDefault()}})})})})})})});XY.displayName=tze;var rze="SelectItemAlignedPosition",JY=D.forwardRef((e,t)=>{const{__scopeSelect:n,onPlaced:r,...i}=e,o=lu($d,n),a=cu($d,n),[c,u]=D.useState(null),[d,h]=D.useState(null),p=Tr(t,T=>h(T)),g=$k(n),y=D.useRef(!1),b=D.useRef(!0),{viewport:S,selectedItem:w,selectedItemText:x,focusSelectedItem:I}=a,_=D.useCallback(()=>{if(o.trigger&&o.valueNode&&c&&d&&S&&w&&x){const T=o.trigger.getBoundingClientRect(),A=d.getBoundingClientRect(),U=o.valueNode.getBoundingClientRect(),R=x.getBoundingClientRect();if(o.dir!=="rtl"){const oe=R.left-A.left,ye=U.left-oe,xe=T.left-ye,je=T.width+xe,Ge=Math.max(je,A.width),it=window.innerWidth-Ns,ut=Dq(ye,[Ns,Math.max(Ns,it-Ge)]);c.style.minWidth=je+"px",c.style.left=ut+"px"}else{const oe=A.right-R.right,ye=window.innerWidth-U.right-oe,xe=window.innerWidth-T.right-ye,je=T.width+xe,Ge=Math.max(je,A.width),it=window.innerWidth-Ns,ut=Dq(ye,[Ns,Math.max(Ns,it-Ge)]);c.style.minWidth=je+"px",c.style.right=ut+"px"}const N=g(),L=window.innerHeight-Ns*2,B=S.scrollHeight,j=window.getComputedStyle(d),$=parseInt(j.borderTopWidth,10),F=parseInt(j.paddingTop,10),K=parseInt(j.borderBottomWidth,10),W=parseInt(j.paddingBottom,10),X=$+F+B+W+K,V=Math.min(w.offsetHeight*5,X),z=window.getComputedStyle(S),Q=parseInt(z.paddingTop,10),q=parseInt(z.paddingBottom,10),ie=T.top+T.height/2-Ns,le=L-ie,ee=w.offsetHeight/2,J=w.offsetTop+ee,ge=$+F+J,te=X-ge;if(ge<=ie){const oe=N.length>0&&w===N[N.length-1].ref.current;c.style.bottom="0px";const ye=d.clientHeight-S.offsetTop-S.offsetHeight,xe=Math.max(le,ee+(oe?q:0)+ye+K),je=ge+xe;c.style.height=je+"px"}else{const oe=N.length>0&&w===N[0].ref.current;c.style.top="0px";const xe=Math.max(ie,$+S.offsetTop+(oe?Q:0)+ee)+te;c.style.height=xe+"px",S.scrollTop=ge-ie+S.offsetTop}c.style.margin=`${Ns}px 0`,c.style.minHeight=V+"px",c.style.maxHeight=L+"px",r?.(),requestAnimationFrame(()=>y.current=!0)}},[g,o.trigger,o.valueNode,c,d,S,w,x,o.dir,r]);Pi(()=>_(),[_]);const[M,C]=D.useState();Pi(()=>{d&&C(window.getComputedStyle(d).zIndex)},[d]);const E=D.useCallback(T=>{T&&b.current===!0&&(_(),I?.(),b.current=!1)},[_,I]);return P.jsx(oze,{scope:n,contentWrapper:c,shouldExpandOnScrollRef:y,onScrollButtonChange:E,children:P.jsx("div",{ref:u,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:M},children:P.jsx(jn.div,{...i,ref:p,style:{boxSizing:"border-box",maxHeight:"100%",...i.style}})})})});JY.displayName=rze;var ize="SelectPopperPosition",_M=D.forwardRef((e,t)=>{const{__scopeSelect:n,align:r="start",collisionPadding:i=Ns,...o}=e,a=jk(n);return P.jsx(qFe,{...a,...o,ref:t,align:r,collisionPadding:i,style:{boxSizing:"border-box",...o.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});_M.displayName=ize;var[oze,nP]=zp($d,{}),IM="SelectViewport",ZY=D.forwardRef((e,t)=>{const{__scopeSelect:n,nonce:r,...i}=e,o=cu(IM,n),a=nP(IM,n),c=Tr(t,o.onViewportChange),u=D.useRef(0);return P.jsxs(P.Fragment,{children:[P.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:r}),P.jsx(Lk.Slot,{scope:n,children:P.jsx(jn.div,{"data-radix-select-viewport":"",role:"presentation",...i,ref:c,style:{position:"relative",flex:1,overflow:"hidden auto",...i.style},onScroll:Un(i.onScroll,d=>{const h=d.currentTarget,{contentWrapper:p,shouldExpandOnScrollRef:g}=a;if(g?.current&&p){const y=Math.abs(u.current-h.scrollTop);if(y>0){const b=window.innerHeight-Ns*2,S=parseFloat(p.style.minHeight),w=parseFloat(p.style.height),x=Math.max(S,w);if(x<b){const I=x+y,_=Math.min(b,I),M=I-_;p.style.height=_+"px",p.style.bottom==="0px"&&(h.scrollTop=M>0?M:0,p.style.justifyContent="flex-end")}}}u.current=h.scrollTop})})})]})});ZY.displayName=IM;var eQ="SelectGroup",[sze,aze]=zp(eQ),lze=D.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,i=wh();return P.jsx(sze,{scope:n,id:i,children:P.jsx(jn.div,{role:"group","aria-labelledby":i,...r,ref:t})})});lze.displayName=eQ;var tQ="SelectLabel",nQ=D.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,i=aze(tQ,n);return P.jsx(jn.div,{id:i.id,...r,ref:t})});nQ.displayName=tQ;var Gw="SelectItem",[cze,rQ]=zp(Gw),iQ=D.forwardRef((e,t)=>{const{__scopeSelect:n,value:r,disabled:i=!1,textValue:o,...a}=e,c=lu(Gw,n),u=cu(Gw,n),d=c.value===r,[h,p]=D.useState(o??""),[g,y]=D.useState(!1),b=Tr(t,I=>u.itemRefCallback?.(I,r,i)),S=wh(),w=D.useRef("touch"),x=()=>{i||(c.onValueChange(r),c.onOpenChange(!1))};if(r==="")throw new Error("A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return P.jsx(cze,{scope:n,value:r,disabled:i,textId:S,isSelected:d,onItemTextChange:D.useCallback(I=>{p(_=>_||(I?.textContent??"").trim())},[]),children:P.jsx(Lk.ItemSlot,{scope:n,value:r,disabled:i,textValue:h,children:P.jsx(jn.div,{role:"option","aria-labelledby":S,"data-highlighted":g?"":void 0,"aria-selected":d&&g,"data-state":d?"checked":"unchecked","aria-disabled":i||void 0,"data-disabled":i?"":void 0,tabIndex:i?void 0:-1,...a,ref:b,onFocus:Un(a.onFocus,()=>y(!0)),onBlur:Un(a.onBlur,()=>y(!1)),onClick:Un(a.onClick,()=>{w.current!=="mouse"&&x()}),onPointerUp:Un(a.onPointerUp,()=>{w.current==="mouse"&&x()}),onPointerDown:Un(a.onPointerDown,I=>{w.current=I.pointerType}),onPointerMove:Un(a.onPointerMove,I=>{w.current=I.pointerType,i?u.onItemLeave?.():w.current==="mouse"&&I.currentTarget.focus({preventScroll:!0})}),onPointerLeave:Un(a.onPointerLeave,I=>{I.currentTarget===document.activeElement&&u.onItemLeave?.()}),onKeyDown:Un(a.onKeyDown,I=>{u.searchRef?.current!==""&&I.key===" "||(GFe.includes(I.key)&&x(),I.key===" "&&I.preventDefault())})})})})});iQ.displayName=Gw;var fg="SelectItemText",oQ=D.forwardRef((e,t)=>{const{__scopeSelect:n,className:r,style:i,...o}=e,a=lu(fg,n),c=cu(fg,n),u=rQ(fg,n),d=JFe(fg,n),[h,p]=D.useState(null),g=Tr(t,x=>p(x),u.onItemTextChange,x=>c.itemTextRefCallback?.(x,u.value,u.disabled)),y=h?.textContent,b=D.useMemo(()=>P.jsx("option",{value:u.value,disabled:u.disabled,children:y},u.value),[u.disabled,u.value,y]),{onNativeOptionAdd:S,onNativeOptionRemove:w}=d;return Pi(()=>(S(b),()=>w(b)),[S,w,b]),P.jsxs(P.Fragment,{children:[P.jsx(jn.span,{id:u.textId,...o,ref:g}),u.isSelected&&a.valueNode&&!a.valueNodeHasChildren?wb.createPortal(o.children,a.valueNode):null]})});oQ.displayName=fg;var sQ="SelectItemIndicator",aQ=D.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return rQ(sQ,n).isSelected?P.jsx(jn.span,{"aria-hidden":!0,...r,ref:t}):null});aQ.displayName=sQ;var EM="SelectScrollUpButton",lQ=D.forwardRef((e,t)=>{const n=cu(EM,e.__scopeSelect),r=nP(EM,e.__scopeSelect),[i,o]=D.useState(!1),a=Tr(t,r.onScrollButtonChange);return Pi(()=>{if(n.viewport&&n.isPositioned){let c=function(){const d=u.scrollTop>0;o(d)};const u=n.viewport;return c(),u.addEventListener("scroll",c),()=>u.removeEventListener("scroll",c)}},[n.viewport,n.isPositioned]),i?P.jsx(uQ,{...e,ref:a,onAutoScroll:()=>{const{viewport:c,selectedItem:u}=n;c&&u&&(c.scrollTop=c.scrollTop-u.offsetHeight)}}):null});lQ.displayName=EM;var TM="SelectScrollDownButton",cQ=D.forwardRef((e,t)=>{const n=cu(TM,e.__scopeSelect),r=nP(TM,e.__scopeSelect),[i,o]=D.useState(!1),a=Tr(t,r.onScrollButtonChange);return Pi(()=>{if(n.viewport&&n.isPositioned){let c=function(){const d=u.scrollHeight-u.clientHeight,h=Math.ceil(u.scrollTop)<d;o(h)};const u=n.viewport;return c(),u.addEventListener("scroll",c),()=>u.removeEventListener("scroll",c)}},[n.viewport,n.isPositioned]),i?P.jsx(uQ,{...e,ref:a,onAutoScroll:()=>{const{viewport:c,selectedItem:u}=n;c&&u&&(c.scrollTop=c.scrollTop+u.offsetHeight)}}):null});cQ.displayName=TM;var uQ=D.forwardRef((e,t)=>{const{__scopeSelect:n,onAutoScroll:r,...i}=e,o=cu("SelectScrollButton",n),a=D.useRef(null),c=$k(n),u=D.useCallback(()=>{a.current!==null&&(window.clearInterval(a.current),a.current=null)},[]);return D.useEffect(()=>()=>u(),[u]),Pi(()=>{c().find(h=>h.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:"nearest"})},[c]),P.jsx(jn.div,{"aria-hidden":!0,...i,ref:t,style:{flexShrink:0,...i.style},onPointerDown:Un(i.onPointerDown,()=>{a.current===null&&(a.current=window.setInterval(r,50))}),onPointerMove:Un(i.onPointerMove,()=>{o.onItemLeave?.(),a.current===null&&(a.current=window.setInterval(r,50))}),onPointerLeave:Un(i.onPointerLeave,()=>{u()})})}),uze="SelectSeparator",dQ=D.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return P.jsx(jn.div,{"aria-hidden":!0,...r,ref:t})});dQ.displayName=uze;var CM="SelectArrow",dze=D.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,i=jk(n),o=lu(CM,n),a=cu(CM,n);return o.open&&a.position==="popper"?P.jsx(UFe,{...i,...r,ref:t}):null});dze.displayName=CM;var fze="SelectBubbleInput",fQ=D.forwardRef(({__scopeSelect:e,value:t,...n},r)=>{const i=D.useRef(null),o=Tr(r,i),a=VFe(t);return D.useEffect(()=>{const c=i.current;if(!c)return;const u=window.HTMLSelectElement.prototype,h=Object.getOwnPropertyDescriptor(u,"value").set;if(a!==t&&h){const p=new Event("change",{bubbles:!0});h.call(c,t),c.dispatchEvent(p)}},[a,t]),P.jsx(jn.select,{...n,style:{...BY,...n.style},ref:o,defaultValue:t})});fQ.displayName=fze;function hQ(e){return e===""||e===void 0}function pQ(e){const t=Od(e),n=D.useRef(""),r=D.useRef(0),i=D.useCallback(a=>{const c=n.current+a;t(c),(function u(d){n.current=d,window.clearTimeout(r.current),d!==""&&(r.current=window.setTimeout(()=>u(""),1e3))})(c)},[t]),o=D.useCallback(()=>{n.current="",window.clearTimeout(r.current)},[]);return D.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,i,o]}function mQ(e,t,n){const i=t.length>1&&Array.from(t).every(d=>d===t[0])?t[0]:t,o=n?e.indexOf(n):-1;let a=hze(e,Math.max(o,0));i.length===1&&(a=a.filter(d=>d!==n));const u=a.find(d=>d.textValue.toLowerCase().startsWith(i.toLowerCase()));return u!==n?u:void 0}function hze(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var pze=qY,gQ=VY,mze=HY,gze=WY,yze=GY,yQ=YY,bze=ZY,bQ=nQ,vQ=iQ,vze=oQ,Sze=aQ,SQ=lQ,wQ=cQ,xQ=dQ;const wze=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),xze=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,n,r)=>r?r.toUpperCase():n.toLowerCase()),Kq=e=>{const t=xze(e);return t.charAt(0).toUpperCase()+t.slice(1)},kQ=(...e)=>e.filter((t,n,r)=>!!t&&t.trim()!==""&&r.indexOf(t)===n).join(" ").trim(),kze=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0};var _ze={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};const Ize=D.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:i="",children:o,iconNode:a,...c},u)=>D.createElement("svg",{ref:u,..._ze,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:kQ("lucide",i),...!o&&!kze(c)&&{"aria-hidden":"true"},...c},[...a.map(([d,h])=>D.createElement(d,h)),...Array.isArray(o)?o:[o]]));const rP=(e,t)=>{const n=D.forwardRef(({className:r,...i},o)=>D.createElement(Ize,{ref:o,iconNode:t,className:kQ(`lucide-${wze(Kq(e))}`,`lucide-${e}`,r),...i}));return n.displayName=Kq(e),n};const Eze=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],Tze=rP("check",Eze);const Cze=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],_Q=rP("chevron-down",Cze);const Mze=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],Rze=rP("chevron-up",Mze),Aze=pze,Oze=mze,IQ=D.forwardRef(({className:e,children:t,...n},r)=>P.jsxs(gQ,{ref:r,className:ki("flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",e),...n,children:[t,P.jsx(gze,{asChild:!0,children:P.jsx(_Q,{className:"h-4 w-4 opacity-50"})})]}));IQ.displayName=gQ.displayName;const EQ=D.forwardRef(({className:e,...t},n)=>P.jsx(SQ,{ref:n,className:ki("flex cursor-default items-center justify-center py-1",e),...t,children:P.jsx(Rze,{className:"h-4 w-4"})}));EQ.displayName=SQ.displayName;const TQ=D.forwardRef(({className:e,...t},n)=>P.jsx(wQ,{ref:n,className:ki("flex cursor-default items-center justify-center py-1",e),...t,children:P.jsx(_Q,{className:"h-4 w-4"})}));TQ.displayName=wQ.displayName;const CQ=D.forwardRef(({className:e,children:t,position:n="popper",...r},i)=>P.jsx(yze,{children:P.jsxs(yQ,{ref:i,className:ki("relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",n==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",e),position:n,...r,children:[P.jsx(EQ,{}),P.jsx(bze,{className:ki("p-1",n==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:t}),P.jsx(TQ,{})]})}));CQ.displayName=yQ.displayName;const Dze=D.forwardRef(({className:e,...t},n)=>P.jsx(bQ,{ref:n,className:ki("py-1.5 pl-8 pr-2 text-sm font-semibold",e),...t}));Dze.displayName=bQ.displayName;const ju=D.forwardRef(({className:e,children:t,...n},r)=>P.jsxs(vQ,{ref:r,className:ki("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...n,children:[P.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:P.jsx(Sze,{children:P.jsx(Tze,{className:"h-4 w-4"})})}),P.jsx(vze,{children:t})]}));ju.displayName=vQ.displayName;const Pze=D.forwardRef(({className:e,...t},n)=>P.jsx(xQ,{ref:n,className:ki("-mx-1 my-1 h-px bg-muted",e),...t}));Pze.displayName=xQ.displayName;function Nze(e,t,n){const r=e.scrollTop,i=t-r,o=performance.now();function a(c){const u=c-o,d=Math.min(u/n,1),h=1-Math.pow(1-d,3);e.scrollTop=r+i*h,d<1&&requestAnimationFrame(a)}requestAnimationFrame(a)}const jS="speckit-task-highlight",Lze=3e3;function $ze({open:e,specId:t,task:n,fileName:r,viewMode:i,content:o,loading:a,error:c,onClose:u,onSelectFile:d,onSetViewMode:h,onChangeContent:p,onSave:g}){const y=D.useRef(null),b=D.useRef(null),S=D.useRef(null),w=D.useRef(null),x=D.useMemo(()=>{if(!n)return"详情";const I=id(n);return n.taskId?n.taskId+" · "+I:I},[n]);return D.useEffect(()=>()=>{w.current!==null&&(window.clearTimeout(w.current),w.current=null),S.current&&(S.current.classList.remove(jS),S.current=null)},[]),D.useEffect(()=>{if(!n||r!=="tasks.md"||i!=="preview"||b.current===n.line)return;const I=y.current;if(!I)return;const _=I.querySelector(`[data-md-line="${n.line}"]`),M=Array.from(new Set([n.taskId,id(n),n.title])).filter(E=>typeof E=="string"&&E.trim()!==""),C=_??(M.length>0?Array.from(I.querySelectorAll("li")).find(E=>{const T=E.textContent??"";return M.some(A=>T.includes(A))})??null:null);C instanceof HTMLElement&&(b.current=n.line,requestAnimationFrame(()=>{const E=I.getBoundingClientRect(),T=C.getBoundingClientRect(),A=T.top-E.top,U=I.scrollTop+A-I.clientHeight/2+T.height/2;Nze(I,U,600),w.current!==null&&(window.clearTimeout(w.current),w.current=null);const R=S.current;R&&R!==C&&R.classList.remove(jS),C.classList.add(jS),S.current=C,w.current=window.setTimeout(()=>{C.classList.remove(jS),S.current===C&&(S.current=null),w.current=null},Lze)}))},[n,r,i,o]),P.jsx(h7,{open:e,onOpenChange:I=>!I&&u(),children:P.jsxs(MD,{className:"right-4 top-4 bottom-4 h-auto w-[800px] sm:max-w-none rounded-none border border-border shadow-2xl outline-none",overlayClassName:"bg-black/10 backdrop-blur-[1px]",motionProps:{initial:{opacity:0,x:20,scale:.98},animate:{opacity:1,x:0,scale:1},exit:{opacity:0,x:20,scale:.98},transition:{type:"spring",damping:25,stiffness:300}},"aria-describedby":void 0,children:[P.jsx(f7,{className:"sr-only",children:"Task Detail"}),t&&n?P.jsxs("div",{className:"flex h-full flex-col bg-background",children:[P.jsx("div",{className:"flex-none border-b-4 border-double border-border/40 bg-background px-6 py-5",children:P.jsxs("div",{className:"flex items-start justify-between gap-6",children:[P.jsxs("div",{className:"min-w-0",children:[P.jsx("div",{className:"text-xl font-bold font-serif leading-6 text-foreground break-words",children:x}),P.jsxs("div",{className:"mt-2 flex flex-wrap items-center gap-2",children:[P.jsx(En,{variant:"outline",className:"rounded-none font-mono",children:t}),P.jsxs(En,{variant:"outline",className:"rounded-none font-mono",children:["L",n.line]})]})]}),P.jsx(yi,{type:"button",variant:"ghost",size:"icon",onClick:u,"aria-label":"Close",children:P.jsx("svg",{className:"h-5 w-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:P.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]})}),P.jsx("div",{className:"flex h-12 flex-none items-center border-b border-border/30 bg-background px-6",children:P.jsxs("div",{className:"flex w-full items-center justify-between",children:[P.jsxs("div",{className:"flex items-center gap-3",children:[P.jsx("label",{className:"font-mono text-[10px] font-bold uppercase tracking-wider text-muted-foreground",children:"Source"}),P.jsx("div",{className:"relative",children:P.jsxs(Aze,{value:r,onValueChange:I=>d(I),children:[P.jsx(IQ,{className:"h-7 w-40 rounded-none border-border bg-background px-3 font-mono text-[11px] text-foreground transition-colors hover:border-foreground focus:ring-0",children:P.jsx(Oze,{placeholder:"Select Source"})}),P.jsxs(CQ,{className:"rounded-none border-border bg-popover font-mono text-[11px]",children:[P.jsx(ju,{value:"tasks.md",className:"rounded-none text-[11px]",children:"tasks.md"}),P.jsx(ju,{value:"quickstart.md",className:"rounded-none text-[11px]",children:"quickstart.md"}),P.jsx(ju,{value:"data-model.md",className:"rounded-none text-[11px]",children:"data-model.md"}),P.jsx(ju,{value:"research.md",className:"rounded-none text-[11px]",children:"research.md"}),P.jsx(ju,{value:"plan.md",className:"rounded-none text-[11px]",children:"plan.md"}),P.jsx(ju,{value:"spec.md",className:"rounded-none text-[11px]",children:"spec.md"})]})]})})]}),P.jsxs("div",{className:"flex items-center gap-3",children:[c?P.jsx("span",{className:"text-xs text-destructive",children:c}):null,i==="edit"&&P.jsx(yi,{type:"button",size:"sm",variant:"outline",className:"h-7 rounded-none border-border px-3 font-mono text-[10px] tracking-wider hover:bg-foreground hover:text-background",disabled:a,onClick:g,children:a?"SAVING...":"SAVE"}),P.jsxs("div",{className:"flex items-center border border-border bg-background",children:[P.jsx("button",{type:"button",className:i==="preview"?"bg-foreground px-3 py-1.5 font-mono text-[10px] font-bold tracking-wider text-background transition-colors":"bg-transparent px-3 py-1.5 font-mono text-[10px] font-bold tracking-wider text-muted-foreground transition-colors hover:bg-muted hover:text-foreground",onClick:()=>h("preview"),children:"PREVIEW"}),P.jsx("div",{className:"h-3 w-px bg-border"}),P.jsx("button",{type:"button",className:i==="edit"?"bg-foreground px-3 py-1.5 font-mono text-[10px] font-bold tracking-wider text-background transition-colors":"bg-transparent px-3 py-1.5 font-mono text-[10px] font-bold tracking-wider text-muted-foreground transition-colors hover:bg-muted hover:text-foreground",onClick:()=>h("edit"),children:"EDIT"})]})]})]})}),P.jsx("div",{className:"flex-1 overflow-hidden bg-card",children:i==="preview"?P.jsx("div",{ref:y,className:"scrollbar-none h-full overflow-y-auto p-6",children:P.jsx(bY,{markdown:o})}):P.jsx("textarea",{className:"h-full w-full resize-none border-0 bg-transparent p-6 font-mono text-[13px] leading-6 text-foreground outline-none placeholder:text-muted-foreground",value:o,onChange:I=>p(I.target.value),placeholder:a?"加载中…":"文件内容…",spellCheck:!1})})]}):null]})})}const Yw=Si("spec.md","plan.md","tasks.md","quickstart.md","data-model.md","research.md"),jze=xi({total:hr,done:hr,todo:hr}),Fze=xi({id:Ht,num:hr,title:Ht,taskStats:wg(jze)}),zze=xi({line:hr,checked:Bo,raw:Ht,title:Ht,taskId:wg(Ht),parallel:wg(Bo),story:wg(Ht)}),Bze=xi({code:Ht,index:hr,title:Ht,line:hr}),qze=xi({open:Bo,specId:Oo(Ht),fileName:Yw,viewMode:Si("preview","edit"),loadingFile:Bo,fileError:Oo(Ht),content:Ht,expandedStoryCode:Oo(Ht),pendingScrollToTaskLine:Oo(hr),pendingScrollToStoryLine:Oo(hr),highlightTaskLine:Oo(hr),loadingSpec:Bo,specError:Oo(Ht),specMarkdown:Ht,artifactExists:Xf({key:Ht,value:Bo})}),Uze=xi({open:Bo,specId:Oo(Ht),taskLine:Oo(hr),fileName:Yw,viewMode:Si("preview","edit"),loading:Bo,error:Oo(Ht),content:Ht}),MQ=xi({specId:Ht,line:hr}),Vze=xi({hideDoneTasks:Bo,viewMode:Si("task","us"),viewModeBySpec:Xf({key:Ht,value:Si("task","us")}),refreshSeq:hr,error:Oo(Ht),specs:o0(Fze),tasksBySpec:Xf({key:Ht,value:o0(zze)}),loadingBySpec:Xf({key:Ht,value:Bo}),storiesBySpec:Xf({key:Ht,value:o0(Bze)}),loadingStoriesBySpec:Xf({key:Ht,value:Bo}),specDetail:qze,taskDetail:Uze,focusedTask:Oo(MQ)}),Kze={"board/refresh":Ds,"board/setHideDone":Bo,"board/setViewMode":Si("task","us"),"board/setSpecViewMode":xi({specId:Ht,mode:Si("task","us")}),"board/clearSpecViewMode":Ht,"board/toggleTask":xi({specId:Ht,line:hr,checked:Bo}),"specDetail/open":Ht,"specDetail/close":Ds,"specDetail/selectFile":Yw,"specDetail/setViewMode":Si("preview","edit"),"specDetail/setContent":Ht,"specDetail/save":Ds,"specDetail/toggleStory":Ht,"specDetail/jumpToTask":hr,"specDetail/didScrollToTask":hr,"specDetail/jumpToStory":hr,"specDetail/didScrollToStory":hr,"specDetail/clearHighlight":Ds,"taskDetail/open":xi({specId:Ht,line:hr}),"taskDetail/close":Ds,"taskDetail/selectFile":Yw,"taskDetail/setViewMode":Si("preview","edit"),"taskDetail/setContent":Ht,"taskDetail/save":Ds,"board/focusNext":Ds,"board/focusPrev":Ds,"board/toggleFocusedTask":Ds,"board/openFocusedTask":Ds,"board/setFocusedTask":Oo(MQ)},Bl=Nke("SpeckitKanbanApp",{state:Vze,actions:Kze});class Ih extends Error{status;tag;constructor(t,n,r){super(`[${t}] ${n}: ${r}`),this.status=t,this.tag=n}}async function Ym(e,t){const n=await fetch(e,t);if(n.ok)return await n.json();if((n.headers.get("content-type")??"").includes("application/json")){const i=await n.json();throw new Ih(n.status,i._tag??"Error",i.message??"Unknown error")}throw new Ih(n.status,"Error",await n.text())}const Qm={listSpecs:()=>Ym("/api/specs"),listTasks:e=>Ym(`/api/specs/${encodeURIComponent(e)}/tasks`),toggleTask:(e,t,n)=>Ym(`/api/specs/${encodeURIComponent(e)}/tasks/toggle`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({line:t,checked:n})}),readFile:(e,t)=>Ym(`/api/specs/${encodeURIComponent(e)}/files/${encodeURIComponent(t)}`),writeFile:(e,t,n)=>Ym(`/api/specs/${encodeURIComponent(e)}/files/${encodeURIComponent(t)}`,{method:"PUT",headers:{"content-type":"application/json"},body:JSON.stringify({content:n})})};class Ss extends Yt("SpecboardApi")(){}const Dg=e=>e instanceof Ih&&e.status===404&&e.tag==="NotFoundError",Ei=e=>e instanceof Error?e.message:String(e),Hze=()=>typeof window>"u"?!1:/^\/specs\/[^/]+\/?$/.test(window.location.pathname),Qw=e=>{const t=e.length,n=e.filter(r=>r.checked).length;return{total:t,done:n,todo:t-n}},Hq=(e,t)=>e.viewModeBySpec[t]??e.viewMode,RQ=e=>e.hideDoneTasks?e.specs.filter(t=>{const n=t.taskStats;return!n||n.total===0?!0:n.todo>0}):e.specs,Wq=e=>{const t=RQ(e);if(!e.specDetail.open)return t;const n=e.specDetail.specId;if(!n||t.some(i=>i.id===n))return t;const r=e.specs.find(i=>i.id===n);return r?[...t,r]:t},Wze=Bl.logic(e=>({setup:ce,run:re(function*(){const t=e.onAction("board/setHideDone").mutate((o,a)=>{o.hideDoneTasks=a.payload}),n=e.onAction("board/setViewMode").mutate((o,a)=>{o.viewMode=a.payload,o.viewModeBySpec={}}),r=e.onAction("board/setSpecViewMode").mutate((o,a)=>{o.viewModeBySpec[a.payload.specId]=a.payload.mode}),i=e.onAction("board/clearSpecViewMode").mutate((o,a)=>{delete o.viewModeBySpec[a.payload]});yield*ru([t,n,r,i],{concurrency:"unbounded"})})})),Gze=Bl.logic(e=>({setup:ce,run:re(function*(){const t=yield*e.use(Ss),n=yield*Do(t.listSpecs());yield*e.state.mutate(i=>{if(n._tag==="Left"){i.error=Ei(n.left),i.specs=[],i.tasksBySpec={},i.loadingBySpec={},i.storiesBySpec={},i.loadingStoriesBySpec={};return}i.error=null,i.specs=Array.from(n.right.items),i.tasksBySpec={},i.loadingBySpec={},i.storiesBySpec={},i.loadingStoriesBySpec={}}),yield*e.onAction("board/refresh").runLatestTask({pending:i=>e.state.mutate(o=>{o.error=null,o.refreshSeq+=1,o.tasksBySpec={},o.loadingBySpec={},o.storiesBySpec={},o.loadingStoriesBySpec={}}),effect:i=>re(function*(){return yield*(yield*e.use(Ss)).listSpecs()}),success:(i,o)=>e.state.mutate(a=>{a.specs=Array.from(i.items)}),failure:(i,o)=>e.state.mutate(a=>{a.error=Ei(i)})})})})),Yze=Bl.logic(e=>({setup:ce,run:re(function*(){yield*e.flow.fromState(r=>{const i=r,o=Wq(i),a=o.map(d=>d.id).join("|"),c=o.map(d=>`${d.id}:${Hq(i,d.id)}`).join("|"),u=[i.specDetail.open?`specDetail:${i.specDetail.specId??""}`:"specDetail:off",i.taskDetail.open?`taskDetail:${i.taskDetail.specId??""}:${i.taskDetail.taskLine??""}`:"taskDetail:off"].join("|");return`${a}::${c}::${i.refreshSeq}::${u}`}).pipe(e.flow.runLatest(re(function*(){const r=yield*e.state.read;if(Hze()||r.specDetail.open||r.taskDetail.open)return;const i=yield*e.use(Ss),o=Wq(r);yield*ln(o,a=>re(function*(){const c=yield*e.state.read,u=a.id,d=c.tasksBySpec[u]!==void 0,h=c.loadingBySpec[u]??!1,p=Hq(c,u),g=c.storiesBySpec[u]!==void 0,y=c.loadingStoriesBySpec[u]??!1,b=!d&&!h,S=p==="us"&&!g&&!y;b&&(yield*re(function*(){yield*e.state.mutate(x=>{x.loadingBySpec[u]=!0});const w=yield*Do(i.listTasks(u));yield*e.state.mutate(x=>{if(w._tag==="Right"){x.tasksBySpec[u]=Array.from(w.right.tasks);return}if(Dg(w.left)){x.tasksBySpec[u]=[];return}x.error=Ei(w.left),x.tasksBySpec[u]=[]})}).pipe(Gi(e.state.mutate(w=>{w.loadingBySpec[u]=!1})))),S&&(yield*re(function*(){yield*e.state.mutate(x=>{x.loadingStoriesBySpec[u]=!0});const w=yield*Do(i.readFile(u,"spec.md"));yield*e.state.mutate(x=>{if(w._tag==="Right"){x.storiesBySpec[u]=Array.from(q9(w.right.content));return}if(Dg(w.left)){x.storiesBySpec[u]=[];return}x.error=Ei(w.left),x.storiesBySpec[u]=[]})}).pipe(Gi(e.state.mutate(w=>{w.loadingStoriesBySpec[u]=!1}))))}),{concurrency:4})})))})})),Qze=Bl.logic(e=>({setup:ce,run:re(function*(){const t=(i,o,a)=>re(function*(){const c=yield*e.use(Ss),u=yield*Do(c.toggleTask(i,o,a));yield*e.state.mutate(d=>{if(u._tag==="Left"){d.error=Ei(u.left);return}const h=Array.from(u.right.tasks);d.tasksBySpec[i]=h;const p=Qw(h);d.specs=d.specs.map(g=>g.id===i?{...g,taskStats:p}:g)})}),n=e.onAction("board/toggleTask").runParallelFork(i=>t(i.payload.specId,i.payload.line,i.payload.checked)),r=e.onAction("board/toggleFocusedTask").runParallelFork(()=>re(function*(){const i=yield*e.state.read,o=i.focusedTask;if(!o)return;const c=i.tasksBySpec[o.specId]?.find(u=>u.line===o.line);c&&(yield*t(o.specId,o.line,!c.checked))}));yield*ru([n,r],{concurrency:"unbounded"})})})),Xze=Bl.logic(e=>({setup:ce,run:re(function*(){const t=e.onAction("specDetail/close").mutate(y=>{y.specDetail.open=!1,y.specDetail.specId=null,y.specDetail.viewMode="preview"}),n=e.onAction("specDetail/toggleStory").mutate((y,b)=>{y.specDetail.expandedStoryCode=y.specDetail.expandedStoryCode===b.payload?null:b.payload}),r=e.onAction("specDetail/jumpToStory").mutate((y,b)=>{y.specDetail.fileName="spec.md",y.specDetail.viewMode="preview",y.specDetail.loadingFile=!1,y.specDetail.fileError=null,y.specDetail.content=y.specDetail.specMarkdown,y.specDetail.pendingScrollToStoryLine=b.payload}),i=e.onAction("specDetail/selectFile").runLatestTask({pending:y=>e.state.mutate(b=>{b.specDetail.fileName=y.payload,b.specDetail.viewMode="preview",b.specDetail.loadingFile=!0,b.specDetail.fileError=null}),effect:y=>re(function*(){const S=(yield*e.state.read).specDetail.specId;if(!S)return{name:y.payload,content:"",isNotFound:!1};const w=yield*e.use(Ss),x=yield*Do(w.readFile(S,y.payload));return x._tag==="Right"?{name:y.payload,content:x.right.content,isNotFound:!1}:{name:y.payload,content:"",isNotFound:Dg(x.left),error:Ei(x.left)}}),success:y=>e.state.mutate(b=>{if(b.specDetail.loadingFile=!1,y.isNotFound){b.specDetail.fileError=y.error??"文件不存在",b.specDetail.artifactExists[y.name]=!1;return}if("error"in y&&y.error){b.specDetail.fileError=y.error;return}b.specDetail.content=y.content,b.specDetail.artifactExists[y.name]=!0,y.name==="spec.md"&&(b.specDetail.specMarkdown=y.content,b.specDetail.specError=null)}),failure:y=>e.state.mutate(b=>{b.specDetail.loadingFile=!1,b.specDetail.fileError=Ei(y)})}),o=e.onAction("specDetail/setViewMode").mutate((y,b)=>{y.specDetail.viewMode=b.payload}),a=e.onAction("specDetail/setContent").mutate((y,b)=>{y.specDetail.content=b.payload,y.specDetail.fileName==="spec.md"&&(y.specDetail.specMarkdown=b.payload)}),c=e.onAction("specDetail/open").runLatestTask({pending:y=>e.state.mutate(b=>{b.specDetail.open=!0,b.specDetail.specId=y.payload,b.specDetail.fileName="spec.md",b.specDetail.viewMode="preview",b.specDetail.loadingFile=!0,b.specDetail.fileError=null,b.specDetail.content="",b.specDetail.expandedStoryCode=null,b.specDetail.pendingScrollToTaskLine=null,b.specDetail.pendingScrollToStoryLine=null,b.specDetail.highlightTaskLine=null,b.specDetail.loadingSpec=!0,b.specDetail.specError=null,b.specDetail.specMarkdown="",b.specDetail.artifactExists={}}),effect:y=>re(function*(){const b=yield*e.use(Ss),S=y.payload,w=yield*Do(b.readFile(S,"spec.md")),x=yield*Do(b.listTasks(S)),_=yield*ln(["quickstart.md","data-model.md","research.md","plan.md","tasks.md"],M=>b.readFile(S,M).pipe(vi({name:M,exists:!0}),ny(()=>fn({name:M,exists:!1}))),{concurrency:"unbounded"});return{specId:S,specMd:w,tasks:x,checks:_}}),success:y=>e.state.mutate(b=>{b.specDetail.loadingFile=!1,b.specDetail.loadingSpec=!1;for(const S of y.checks)S.exists===!0&&(b.specDetail.artifactExists[S.name]=!0),S.exists===!1&&(b.specDetail.artifactExists[S.name]=!1);if(y.tasks._tag==="Right"){const S=Array.from(y.tasks.right.tasks);b.tasksBySpec[y.specId]=S;const w=Qw(S);b.specs=b.specs.map(x=>x.id===y.specId?{...x,taskStats:w}:x)}else Dg(y.tasks.left)?b.tasksBySpec[y.specId]=[]:b.error=Ei(y.tasks.left);if(y.specMd._tag==="Right"){b.specDetail.content=y.specMd.right.content,b.specDetail.specMarkdown=y.specMd.right.content,b.specDetail.artifactExists["spec.md"]=!0,b.specDetail.specError=null;return}b.specDetail.specError=Ei(y.specMd.left),Dg(y.specMd.left)&&(b.specDetail.artifactExists["spec.md"]=!1)}),failure:y=>e.state.mutate(b=>{b.specDetail.loadingFile=!1,b.specDetail.loadingSpec=!1,b.specDetail.fileError=Ei(y),b.specDetail.specError=Ei(y)})}),u=e.onAction("specDetail/jumpToTask").mutate((y,b)=>{y.specDetail.fileName="tasks.md",y.specDetail.viewMode="preview",y.specDetail.pendingScrollToTaskLine=b.payload}),d=e.onAction("specDetail/didScrollToTask").mutate((y,b)=>{y.specDetail.pendingScrollToTaskLine=null,y.specDetail.highlightTaskLine=b.payload}),h=e.onAction("specDetail/didScrollToStory").mutate(y=>{y.specDetail.pendingScrollToStoryLine=null}),p=e.onAction("specDetail/clearHighlight").mutate(y=>{y.specDetail.highlightTaskLine=null}),g=e.onAction("specDetail/save").runExhaustTask({pending:()=>e.state.mutate(y=>{y.specDetail.loadingFile=!0,y.specDetail.fileError=null}),effect:()=>re(function*(){const y=yield*e.use(Ss),b=yield*e.state.read,S=b.specDetail.specId;if(!S)return{kind:"noop"};const w=b.specDetail.fileName,x=b.specDetail.content;if(yield*y.writeFile(S,w,x),w==="tasks.md"){const I=yield*y.listTasks(S);return{kind:"tasks",specId:S,tasks:I.tasks}}return w==="spec.md"?{kind:"specs",specs:(yield*y.listSpecs()).items}:{kind:"ok",specId:S,name:w}}),success:y=>e.state.mutate(b=>{if(b.specDetail.loadingFile=!1,y.kind!=="noop"){if(y.kind==="tasks"){b.tasksBySpec[y.specId]=Array.from(y.tasks),b.specs=b.specs.map(S=>S.id===y.specId?{...S,taskStats:Qw(y.tasks)}:S),b.specDetail.artifactExists["tasks.md"]=!0;return}if(y.kind==="specs"){b.specs=Array.from(y.specs),b.specDetail.artifactExists["spec.md"]=!0;return}b.specDetail.artifactExists[b.specDetail.fileName]=!0}}),failure:y=>e.state.mutate(b=>{b.specDetail.loadingFile=!1,b.specDetail.fileError=Ei(y)})});yield*ru([c,t,i,o,a,g,n,r,u,d,h,p],{concurrency:"unbounded"})})})),Jze=Bl.logic(e=>({setup:ce,run:re(function*(){const t=e.onAction("taskDetail/close").mutate(u=>{u.taskDetail.open=!1,u.taskDetail.specId=null,u.taskDetail.taskLine=null}),n=e.onAction("taskDetail/selectFile").runLatestTask({pending:u=>e.state.mutate(d=>{d.taskDetail.fileName=u.payload,d.taskDetail.viewMode="preview",d.taskDetail.loading=!0,d.taskDetail.error=null}),effect:u=>re(function*(){const h=(yield*e.state.read).taskDetail.specId;return h?{content:(yield*(yield*e.use(Ss)).readFile(h,u.payload)).content}:{content:""}}),success:u=>e.state.mutate(d=>{d.taskDetail.loading=!1,d.taskDetail.content=u.content}),failure:u=>e.state.mutate(d=>{d.taskDetail.loading=!1,d.taskDetail.error=Ei(u)})}),r=e.onAction("taskDetail/setContent").mutate((u,d)=>{u.taskDetail.content=d.payload}),i=e.onAction("taskDetail/setViewMode").mutate((u,d)=>{u.taskDetail.viewMode=d.payload}),o=e.onAction("taskDetail/open").runLatestTask({pending:u=>e.state.mutate(d=>{d.taskDetail.open=!0,d.taskDetail.specId=u.payload.specId,d.taskDetail.taskLine=u.payload.line,d.taskDetail.fileName="tasks.md",d.taskDetail.viewMode="preview",d.taskDetail.loading=!0,d.taskDetail.error=null,d.taskDetail.content=""}),effect:u=>re(function*(){return{content:(yield*(yield*e.use(Ss)).readFile(u.payload.specId,"tasks.md")).content}}),success:u=>e.state.mutate(d=>{d.taskDetail.loading=!1,d.taskDetail.content=u.content}),failure:u=>e.state.mutate(d=>{d.taskDetail.loading=!1,d.taskDetail.error=Ei(u)})}),a=e.onAction("board/openFocusedTask").runLatestTask({pending:()=>e.state.mutate(u=>{const d=u.focusedTask;d&&(u.taskDetail.open=!0,u.taskDetail.specId=d.specId,u.taskDetail.taskLine=d.line,u.taskDetail.fileName="tasks.md",u.taskDetail.viewMode="preview",u.taskDetail.loading=!0,u.taskDetail.error=null,u.taskDetail.content="")}),effect:()=>re(function*(){const d=(yield*e.state.read).taskDetail.specId;return d?{content:(yield*(yield*e.use(Ss)).readFile(d,"tasks.md")).content}:{content:""}}),success:u=>e.state.mutate(d=>{d.taskDetail.loading=!1,d.taskDetail.content=u.content}),failure:u=>e.state.mutate(d=>{d.taskDetail.loading=!1,d.taskDetail.error=Ei(u)})}),c=e.onAction("taskDetail/save").runExhaustTask({pending:()=>e.state.mutate(u=>{u.taskDetail.loading=!0,u.taskDetail.error=null}),effect:()=>re(function*(){const u=yield*e.use(Ss),d=yield*e.state.read,h=d.taskDetail.specId;if(!h)return{kind:"noop"};const p=d.taskDetail.fileName,g=d.taskDetail.content;if(yield*u.writeFile(h,p,g),p==="tasks.md"){const y=yield*u.listTasks(h);return{kind:"tasks",specId:h,tasks:y.tasks}}return p==="spec.md"?{kind:"specs",specs:(yield*u.listSpecs()).items}:{kind:"ok"}}),success:u=>e.state.mutate(d=>{d.taskDetail.loading=!1,u.kind==="tasks"?(d.tasksBySpec[u.specId]=Array.from(u.tasks),d.specs=d.specs.map(h=>h.id===u.specId?{...h,taskStats:Qw(u.tasks)}:h)):u.kind==="specs"&&(d.specs=Array.from(u.specs))}),failure:u=>e.state.mutate(d=>{d.taskDetail.loading=!1,d.taskDetail.error=Ei(u)})});yield*ru([o,a,t,n,r,c,i],{concurrency:"unbounded"})})})),Zze=Bl.logic(e=>({setup:ce,run:re(function*(){const t=o=>{const a=RQ(o),c=[];for(const u of a){const d=o.tasksBySpec[u.id];if(!d)continue;const h=o.hideDoneTasks?d.filter(p=>!p.checked):d;if(!(o.hideDoneTasks&&h.length===0))for(const p of h)c.push({specId:u.id,task:p})}return c},n=e.onAction("board/focusNext").mutate(o=>{const a=t(o);if(a.length===0)return;const c=o.focusedTask;if(!c){o.focusedTask={specId:a[0].specId,line:a[0].task.line};return}const u=a.findIndex(d=>d.specId===c.specId&&d.task.line===c.line);if(u===-1){o.focusedTask={specId:a[0].specId,line:a[0].task.line};return}if(u<a.length-1){const d=a[u+1];o.focusedTask={specId:d.specId,line:d.task.line}}}),r=e.onAction("board/focusPrev").mutate(o=>{const a=t(o);if(a.length===0)return;const c=o.focusedTask;if(!c){const d=a[a.length-1];o.focusedTask={specId:d.specId,line:d.task.line};return}const u=a.findIndex(d=>d.specId===c.specId&&d.task.line===c.line);if(u===-1){const d=a[a.length-1];o.focusedTask={specId:d.specId,line:d.task.line};return}if(u>0){const d=a[u-1];o.focusedTask={specId:d.specId,line:d.task.line}}}),i=e.onAction("board/setFocusedTask").mutate((o,a)=>{o.focusedTask=a.payload});yield*ru([n,r,i],{concurrency:"unbounded"})})})),eBe={hideDoneTasks:!0,viewMode:"us",viewModeBySpec:{},refreshSeq:0,error:null,specs:[],tasksBySpec:{},loadingBySpec:{},storiesBySpec:{},loadingStoriesBySpec:{},specDetail:{open:!1,specId:null,fileName:"spec.md",viewMode:"preview",loadingFile:!1,fileError:null,content:"",expandedStoryCode:null,pendingScrollToTaskLine:null,pendingScrollToStoryLine:null,highlightTaskLine:null,loadingSpec:!1,specError:null,specMarkdown:"",artifactExists:{}},taskDetail:{open:!1,specId:null,taskLine:null,fileName:"tasks.md",viewMode:"preview",loading:!1,error:null,content:""},focusedTask:null},AQ=Bl.implement({initial:eBe,logics:[Gze,Wze,Yze,Qze,Xze,Jze,Zze]});AQ.impl;function tBe({specDetailOpen:e,taskDetailOpen:t,onCloseDrawers:n,dispatch:r}){D.useEffect(()=>{const i=o=>{if(!(o.target instanceof HTMLInputElement||o.target instanceof HTMLTextAreaElement||o.target instanceof HTMLSelectElement)&&!(e||t))switch(o.key){case"j":case"ArrowDown":o.preventDefault(),r({_tag:"board/focusNext"});break;case"k":case"ArrowUp":o.preventDefault(),r({_tag:"board/focusPrev"});break;case" ":o.preventDefault(),r({_tag:"board/toggleFocusedTask"});break;case"Enter":o.preventDefault(),r({_tag:"board/openFocusedTask"});break}};return window.addEventListener("keydown",i),()=>window.removeEventListener("keydown",i)},[e,t,n,r])}const nBe=vD("bg-card text-card-foreground",{variants:{variant:{elevated:"bg-card border border-border shadow-[var(--shadow-elevated)]",inset:"bg-muted/10 border border-border shadow-[var(--shadow-inset)]",flat:"bg-card border border-border"},padding:{none:"",sm:"p-3",md:"p-4",lg:"p-6"}},defaultVariants:{variant:"elevated",padding:"md"}});function FS({className:e,variant:t,padding:n,asChild:r=!1,...i}){const o=r?jG:"div";return P.jsx(o,{className:ki(nBe({variant:t,padding:n,className:e})),...i})}function UE({className:e,...t}){return P.jsx("div",{className:ki("flex flex-col gap-1.5",e),...t})}function VE({className:e,...t}){return P.jsx("p",{className:ki("text-base font-semibold leading-tight",e),...t})}function KE({className:e,...t}){return P.jsx("p",{className:ki("text-sm text-muted-foreground",e),...t})}function zS({className:e,...t}){return P.jsx("div",{className:ki("min-w-0",e),...t})}function rBe(){return P.jsxs("div",{className:"h-screen w-screen overflow-hidden bg-background",children:[P.jsx("header",{className:"border-b-4 border-double border-border/40 bg-background",children:P.jsxs("div",{className:"mx-auto flex max-w-6xl items-center justify-between gap-4 px-6 py-6",children:[P.jsxs("div",{className:"min-w-0",children:[P.jsx("div",{className:"text-2xl font-bold font-serif tracking-tight text-foreground",children:"Speckit Kit"}),P.jsx("div",{className:"mt-1 text-sm text-muted-foreground font-mono italic",children:"Design System Showcase · Vol. 1"})]}),P.jsxs("nav",{className:"flex items-center gap-2",children:[P.jsx(yi,{asChild:!0,variant:"ghost",size:"sm",className:"font-serif",children:P.jsx(yy,{to:"/",children:"← Back to Kanban"})}),P.jsx(yi,{asChild:!0,variant:"secondary",size:"sm",className:"font-mono text-xs uppercase tracking-wider",children:P.jsx(yy,{to:"/design-system",children:"System"})})]})]})}),P.jsx("main",{className:"scrollbar-none h-full overflow-y-auto pb-16",children:P.jsxs("div",{className:"mx-auto flex max-w-6xl flex-col gap-12 px-6 py-12",children:[P.jsxs("section",{children:[P.jsxs("div",{className:"flex items-center gap-4 border-b border-dashed border-border/40 pb-4 mb-8",children:[P.jsx("h2",{className:"text-2xl font-bold font-serif text-foreground",children:"Buttons"}),P.jsx(En,{variant:"outline",className:"font-mono text-[10px] uppercase tracking-widest",children:"ui/button"})]}),P.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[P.jsx(yi,{children:"Default"}),P.jsx(yi,{variant:"secondary",children:"Secondary"}),P.jsx(yi,{variant:"outline",children:"Outline"}),P.jsx(yi,{variant:"ghost",children:"Ghost"}),P.jsx(yi,{variant:"destructive",children:"Destructive"}),P.jsx(yi,{disabled:!0,children:"Disabled"})]})]}),P.jsxs("section",{children:[P.jsxs("div",{className:"flex items-center gap-4 border-b border-dashed border-border/40 pb-4 mb-8",children:[P.jsx("h2",{className:"text-2xl font-bold font-serif text-foreground",children:"Badges / Stamps"}),P.jsx(En,{variant:"outline",className:"font-mono text-[10px] uppercase tracking-widest",children:"ui/badge"})]}),P.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[P.jsx(En,{children:"Default"}),P.jsx(En,{variant:"info",children:"Info"}),P.jsx(En,{variant:"success",children:"Success"}),P.jsx(En,{variant:"warning",children:"Warning"}),P.jsx(En,{variant:"danger",children:"Danger"}),P.jsx(En,{variant:"outline",children:"Outline"})]})]}),P.jsxs("section",{children:[P.jsxs("div",{className:"flex items-center gap-4 border-b border-dashed border-border/40 pb-4 mb-8",children:[P.jsx("h2",{className:"text-2xl font-bold font-serif text-foreground",children:"Cards / Panes"}),P.jsx(En,{variant:"outline",className:"font-mono text-[10px] uppercase tracking-widest",children:"ui/card"})]}),P.jsxs("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-3",children:[P.jsxs(FS,{variant:"elevated",children:[P.jsxs(UE,{children:[P.jsx(VE,{className:"font-serif",children:"Elevated"}),P.jsx(KE,{children:"Hard shadow lift"})]}),P.jsx(zS,{children:P.jsx("div",{className:"text-sm text-muted-foreground",children:"Used for main content blocks."})})]}),P.jsxs(FS,{variant:"inset",children:[P.jsxs(UE,{children:[P.jsx(VE,{className:"font-serif",children:"Inset"}),P.jsx(KE,{children:"Recessed grouping"})]}),P.jsx(zS,{children:P.jsx("div",{className:"text-sm text-muted-foreground",children:"Used for containers."})})]}),P.jsxs(FS,{variant:"flat",children:[P.jsxs(UE,{children:[P.jsx(VE,{className:"font-serif",children:"Flat"}),P.jsx(KE,{children:"Structure only"})]}),P.jsx(zS,{children:P.jsx("div",{className:"text-sm text-muted-foreground",children:"Used for static data."})})]})]})]}),P.jsxs("section",{children:[P.jsxs("div",{className:"flex items-center gap-4 border-b border-dashed border-border/40 pb-4 mb-8",children:[P.jsx("h2",{className:"text-2xl font-bold font-serif text-foreground",children:"Interactives & Motion"}),P.jsx(En,{variant:"outline",className:"font-mono text-[10px] uppercase tracking-widest",children:"Real Components"})]}),P.jsxs("div",{className:"mt-4 grid grid-cols-1 gap-8 md:grid-cols-2",children:[P.jsxs("div",{className:"space-y-4",children:[P.jsx("div",{className:"text-sm font-medium text-muted-foreground",children:"Task Cards (Spring Entry + Hover Lift)"}),P.jsxs("div",{className:"w-[360px] space-y-2",children:[P.jsx(sM,{task:{line:1,checked:!1,raw:"- [ ] T-101 Implement login flow",title:"Implement login flow",taskId:"T-101",story:"US1"},onToggle:()=>{},onOpenDetail:()=>{}}),P.jsx(sM,{task:{line:2,checked:!0,raw:"- [x] T-102 Setup database schema",title:"Setup database schema",taskId:"T-102",parallel:!0},onToggle:()=>{},onOpenDetail:()=>{}})]})]}),P.jsxs("div",{className:"space-y-4",children:[P.jsx("div",{className:"text-sm font-medium text-muted-foreground",children:"User Story Cards"}),P.jsxs("div",{className:"w-[360px] space-y-2",children:[P.jsx($w,{storyCode:"US1",title:"User Authentication",stats:{total:5,done:2,todo:3},hint:"Todo 3",onOpen:()=>{}}),P.jsx($w,{storyCode:"US2",title:"Payment Gateway Integration",stats:void 0,tone:"danger",hint:"Missing in spec",onOpen:()=>{}})]})]})]})]}),P.jsxs("section",{children:[P.jsxs("div",{className:"flex items-center gap-3",children:[P.jsx("h2",{className:"text-lg font-semibold text-foreground",children:"Highlight"}),P.jsx(En,{variant:"outline",className:"font-mono",children:".speckit-task-highlight"})]}),P.jsx("div",{className:"mt-4",children:P.jsx(FS,{variant:"flat",children:P.jsx(zS,{children:P.jsx("div",{className:"speckit-task-highlight inline-block rounded-xl px-2 py-1 text-sm bg-muted",children:"这个块用于验证「滚动居中 + 2 秒高亮」的视觉效果"})})})})]})]})})]})}function iBe(e){return`/specs/${encodeURIComponent(e)}`}function oBe(){const e=iIe(Bl),t=oIe(e),n=N9(),i=sB("/specs/:specId")?.params?.specId??null,o=i!==null,a=sB("/design-system")!==null,c=ao(e,N=>N.hideDoneTasks),u=ao(e,N=>N.viewMode),d=ao(e,N=>N.viewModeBySpec),h=ao(e,N=>N.storiesBySpec),p=ao(e,N=>N.loadingStoriesBySpec),g=ao(e,N=>N.error),y=ao(e,N=>N.specs),b=ao(e,N=>N.tasksBySpec),S=ao(e,N=>N.loadingBySpec),w=ao(e,N=>N.specDetail),x=ao(e,N=>N.taskDetail),I=ao(e,N=>N.focusedTask);D.useEffect(()=>{i&&(w.open&&w.specId===i||t({_tag:"specDetail/open",payload:i}))},[i,w.open,w.specId,t]);const _=D.useCallback(()=>{o&&n("/"),t({_tag:"specDetail/close"})},[o,n,t]),M=D.useCallback(()=>{const N=w.specId;if(N){if(o){n("/");return}n(iBe(N))}},[w.specId,o,n]),C=D.useCallback(()=>{t({_tag:"taskDetail/close"}),o&&n("/"),t({_tag:"specDetail/close"})},[t,o,n]);tBe({specDetailOpen:w.open||o,taskDetailOpen:x.open,onCloseDrawers:C,dispatch:t});const E=D.useMemo(()=>c?y.filter(N=>{const L=N.taskStats;return!L||L.total===0?!0:L.todo>0}):y,[y,c]),T=D.useMemo(()=>E.map(N=>{const L=b[N.id],B=c&&L?L.filter(X=>!X.checked):L,$=L!==void 0&&L.length>0&&B?.length===0,F=c&&$,K=d[N.id]??u,W=d[N.id]??null;return{spec:N,allTasks:L,tasks:B,loading:S[N.id]??!1,stories:h[N.id],loadingStories:p[N.id]??!1,viewMode:K,viewModeOverride:W,hide:F}}).filter(N=>!N.hide),[E,b,S,h,p,c,u,d]),A=D.useMemo(()=>!w.open||!w.specId?null:y.find(N=>N.id===w.specId)??null,[w.open,w.specId,y]),U=D.useMemo(()=>!x.open||!x.specId||x.taskLine===null?null:(b[x.specId]??[]).find(L=>L.line===x.taskLine)??null,[x.open,x.specId,x.taskLine,b]),R=x.open||w.open&&!o;return a?P.jsx(rBe,{}):P.jsxs("div",{className:"h-screen w-screen overflow-hidden bg-background",children:[!o&&P.jsxs("div",{className:`flex h-full flex-col bg-background transition-all duration-300 ease-out ${R?"opacity-30 pointer-events-none grayscale":""}`,children:[P.jsxs("div",{className:"grid grid-cols-[1fr_auto_1fr] items-center gap-4 border-b-4 border-double border-border/40 bg-background px-6 py-4",children:[P.jsxs("div",{className:"flex min-w-0 items-center gap-4",children:[P.jsx("h1",{className:"text-2xl font-black tracking-tight text-foreground font-serif",children:"Speckit Board"}),P.jsx("div",{className:"hidden border-l-2 border-border pl-4 md:block",children:P.jsx("div",{className:"font-mono text-[10px] font-bold uppercase tracking-widest text-muted-foreground opacity-60",children:"Specifications · Stories · Tasks"})})]}),P.jsx("div",{className:"justify-self-center",children:P.jsx(LG,{value:u,onChange:N=>t({_tag:"board/setViewMode",payload:N})})}),P.jsxs("div",{className:"flex items-center justify-self-end gap-6",children:[P.jsxs("label",{className:"flex cursor-pointer items-center gap-2 text-xs font-medium text-muted-foreground hover:text-foreground transition-colors group",children:[P.jsxs("div",{className:"relative flex items-center justify-center",children:[P.jsx("input",{className:"peer h-4 w-4 appearance-none border border-border bg-background transition-colors checked:bg-foreground checked:border-foreground hover:border-foreground/50 rounded-none cursor-pointer",type:"checkbox",checked:c,onChange:N=>t({_tag:"board/setHideDone",payload:N.target.checked})}),P.jsx("svg",{className:"pointer-events-none absolute h-3 w-3 text-background opacity-0 peer-checked:opacity-100",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:3,children:P.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})})]}),P.jsx("span",{className:"font-mono text-[11px] font-bold uppercase tracking-wider group-hover:text-foreground",children:"Hide Done"})]}),P.jsx("div",{className:"h-6 w-px bg-border/40"}),P.jsx(yy,{to:"/design-system",className:"font-mono text-[11px] font-bold uppercase tracking-wider text-muted-foreground hover:text-foreground hover:underline underline-offset-4 decoration-border",children:"Design System"}),P.jsx(yi,{variant:"outline",size:"icon",className:"h-9 w-9 rounded-none border-border hover:bg-foreground hover:text-background transition-colors",onClick:()=>window.location.reload(),title:"Refresh",children:P.jsx("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:P.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})})})]})]}),g?P.jsx("div",{className:"border-b border-destructive/20 bg-destructive/10 px-6 py-2 text-sm text-destructive",children:g}):null,P.jsx("div",{className:"scrollbar-none flex-1 overflow-x-auto overflow-y-hidden bg-background p-0",children:P.jsx("div",{className:"flex h-full min-w-max divide-x divide-border/30 border-l border-border/30",children:T.map(({spec:N,allTasks:L,tasks:B,loading:j,stories:$,loadingStories:F,viewMode:K,viewModeOverride:W})=>P.jsx(aAe,{spec:N,allTasks:L,tasks:B,loading:j,stories:$,loadingStories:F,viewMode:K,globalViewMode:u,hasViewModeOverride:W!==null,focusedTaskLine:I?.specId===N.id?I.line:null,onOpenSpecDetail:()=>t({_tag:"specDetail/open",payload:N.id}),onToggleTask:(X,V)=>t({_tag:"board/toggleTask",payload:{specId:N.id,line:X.line,checked:V}}),onOpenTask:X=>t({_tag:"taskDetail/open",payload:{specId:N.id,line:X.line}}),onOpenStory:X=>{t.batch([{_tag:"specDetail/open",payload:N.id},{_tag:"specDetail/toggleStory",payload:X}])},onChangeViewMode:X=>{if(X===u){if(W===null)return;t({_tag:"board/clearSpecViewMode",payload:N.id});return}W!==X&&t({_tag:"board/setSpecViewMode",payload:{specId:N.id,mode:X}})}},N.id))})})]}),P.jsx(yje,{open:w.open||o,specId:w.specId??i,spec:A,tasks:w.specId?b[w.specId]:void 0,fileName:w.fileName,viewMode:w.viewMode,loadingFile:w.loadingFile,fileError:w.fileError,content:w.content,loadingSpec:w.loadingSpec,specError:w.specError,specMarkdown:w.specMarkdown,artifactExists:w.artifactExists,expandedStoryCode:w.expandedStoryCode,pendingScrollToTaskLine:w.pendingScrollToTaskLine,pendingScrollToStoryLine:w.pendingScrollToStoryLine,highlightTaskLine:w.highlightTaskLine,isFullscreen:o,onToggleFullscreen:M,onClose:_,onSelectFile:N=>t({_tag:"specDetail/selectFile",payload:N}),onSetViewMode:N=>t({_tag:"specDetail/setViewMode",payload:N}),onChangeContent:N=>t({_tag:"specDetail/setContent",payload:N}),onSave:()=>t({_tag:"specDetail/save"}),onToggleStory:N=>t({_tag:"specDetail/toggleStory",payload:N}),onJumpToTaskLine:N=>t({_tag:"specDetail/jumpToTask",payload:N}),onDidScrollToTaskLine:N=>t({_tag:"specDetail/didScrollToTask",payload:N}),onJumpToStoryLine:N=>t({_tag:"specDetail/jumpToStory",payload:N}),onDidScrollToStoryLine:N=>t({_tag:"specDetail/didScrollToStory",payload:N}),onClearHighlight:()=>t({_tag:"specDetail/clearHighlight"}),onOpenTask:N=>{w.specId&&t({_tag:"taskDetail/open",payload:{specId:w.specId,line:N.line}})}}),P.jsx($ze,{open:x.open,specId:x.specId,task:U,fileName:x.fileName,viewMode:x.viewMode,content:x.content,loading:x.loading,error:x.error,onClose:()=>t({_tag:"taskDetail/close"}),onSelectFile:N=>t({_tag:"taskDetail/selectFile",payload:N}),onSetViewMode:N=>t({_tag:"taskDetail/setViewMode",payload:N}),onChangeContent:N=>t({_tag:"taskDetail/setContent",payload:N}),onSave:()=>t({_tag:"taskDetail/save"})})]})}const Xm=e=>e instanceof Ih?e:e instanceof Error?new Ih(0,"Error",e.message):new Ih(0,"Error",String(e)),sBe=zo(Ss,{listSpecs:()=>Nm({try:()=>Qm.listSpecs(),catch:Xm}),listTasks:e=>Nm({try:()=>Qm.listTasks(e),catch:Xm}),toggleTask:(e,t,n)=>Nm({try:()=>Qm.toggleTask(e,t,n),catch:Xm}),readFile:(e,t)=>Nm({try:()=>Qm.readFile(e,t),catch:Xm}),writeFile:(e,t,n)=>Nm({try:()=>Qm.writeFile(e,t,n),catch:Xm})}),aBe=sBe,lBe=AQ,cBe=t_e(lBe,{label:"SpeckitKanban",layer:aBe}),OQ=document.getElementById("app");if(!OQ)throw new Error("Root element #app not found");YJ.createRoot(OQ).render(P.jsx(F_e,{runtime:cBe,policy:{mode:"sync"},children:P.jsx(v1e,{children:P.jsx(oBe,{})})}));