@probnaya/057-cli 1.3.0 → 1.4.0

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.
@@ -1,649 +0,0 @@
1
- (function(){const i=document.createElement("link").relList;if(i&&i.supports&&i.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))l(o);new MutationObserver(o=>{for(const c of o)if(c.type==="childList")for(const d of c.addedNodes)d.tagName==="LINK"&&d.rel==="modulepreload"&&l(d)}).observe(document,{childList:!0,subtree:!0});function s(o){const c={};return o.integrity&&(c.integrity=o.integrity),o.referrerPolicy&&(c.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?c.credentials="include":o.crossOrigin==="anonymous"?c.credentials="omit":c.credentials="same-origin",c}function l(o){if(o.ep)return;o.ep=!0;const c=s(o);fetch(o.href,c)}})();var Tc={exports:{}},tr={};var _m;function bx(){if(_m)return tr;_m=1;var n=Symbol.for("react.transitional.element"),i=Symbol.for("react.fragment");function s(l,o,c){var d=null;if(c!==void 0&&(d=""+c),o.key!==void 0&&(d=""+o.key),"key"in o){c={};for(var h in o)h!=="key"&&(c[h]=o[h])}else c=o;return o=c.ref,{$$typeof:n,type:l,key:d,ref:o!==void 0?o:null,props:c}}return tr.Fragment=i,tr.jsx=s,tr.jsxs=s,tr}var Um;function xx(){return Um||(Um=1,Tc.exports=bx()),Tc.exports}var v=xx(),Ac={exports:{}},pe={};var Nm;function Sx(){if(Nm)return pe;Nm=1;var n=Symbol.for("react.transitional.element"),i=Symbol.for("react.portal"),s=Symbol.for("react.fragment"),l=Symbol.for("react.strict_mode"),o=Symbol.for("react.profiler"),c=Symbol.for("react.consumer"),d=Symbol.for("react.context"),h=Symbol.for("react.forward_ref"),m=Symbol.for("react.suspense"),y=Symbol.for("react.memo"),S=Symbol.for("react.lazy"),b=Symbol.for("react.activity"),R=Symbol.iterator;function L(T){return T===null||typeof T!="object"?null:(T=R&&T[R]||T["@@iterator"],typeof T=="function"?T:null)}var j={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},D=Object.assign,B={};function Q(T,k,H){this.props=T,this.context=k,this.refs=B,this.updater=H||j}Q.prototype.isReactComponent={},Q.prototype.setState=function(T,k){if(typeof T!="object"&&typeof T!="function"&&T!=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,T,k,"setState")},Q.prototype.forceUpdate=function(T){this.updater.enqueueForceUpdate(this,T,"forceUpdate")};function Z(){}Z.prototype=Q.prototype;function F(T,k,H){this.props=T,this.context=k,this.refs=B,this.updater=H||j}var V=F.prototype=new Z;V.constructor=F,D(V,Q.prototype),V.isPureReactComponent=!0;var K=Array.isArray;function Y(){}var A={H:null,A:null,T:null,S:null},w=Object.prototype.hasOwnProperty;function N(T,k,H){var J=H.ref;return{$$typeof:n,type:T,key:k,ref:J!==void 0?J:null,props:H}}function te(T,k){return N(T.type,k,T.props)}function ne(T){return typeof T=="object"&&T!==null&&T.$$typeof===n}function le(T){var k={"=":"=0",":":"=2"};return"$"+T.replace(/[=:]/g,function(H){return k[H]})}var Ge=/\/+/g;function de(T,k){return typeof T=="object"&&T!==null&&T.key!=null?le(""+T.key):k.toString(36)}function ue(T){switch(T.status){case"fulfilled":return T.value;case"rejected":throw T.reason;default:switch(typeof T.status=="string"?T.then(Y,Y):(T.status="pending",T.then(function(k){T.status==="pending"&&(T.status="fulfilled",T.value=k)},function(k){T.status==="pending"&&(T.status="rejected",T.reason=k)})),T.status){case"fulfilled":return T.value;case"rejected":throw T.reason}}throw T}function z(T,k,H,J,oe){var he=typeof T;(he==="undefined"||he==="boolean")&&(T=null);var me=!1;if(T===null)me=!0;else switch(he){case"bigint":case"string":case"number":me=!0;break;case"object":switch(T.$$typeof){case n:case i:me=!0;break;case S:return me=T._init,z(me(T._payload),k,H,J,oe)}}if(me)return oe=oe(T),me=J===""?"."+de(T,0):J,K(oe)?(H="",me!=null&&(H=me.replace(Ge,"$&/")+"/"),z(oe,k,H,"",function(fn){return fn})):oe!=null&&(ne(oe)&&(oe=te(oe,H+(oe.key==null||T&&T.key===oe.key?"":(""+oe.key).replace(Ge,"$&/")+"/")+me)),k.push(oe)),1;me=0;var $e=J===""?".":J+":";if(K(T))for(var Re=0;Re<T.length;Re++)J=T[Re],he=$e+de(J,Re),me+=z(J,k,H,he,oe);else if(Re=L(T),typeof Re=="function")for(T=Re.call(T),Re=0;!(J=T.next()).done;)J=J.value,he=$e+de(J,Re++),me+=z(J,k,H,he,oe);else if(he==="object"){if(typeof T.then=="function")return z(ue(T),k,H,J,oe);throw k=String(T),Error("Objects are not valid as a React child (found: "+(k==="[object Object]"?"object with keys {"+Object.keys(T).join(", ")+"}":k)+"). If you meant to render a collection of children, use an array instead.")}return me}function X(T,k,H){if(T==null)return T;var J=[],oe=0;return z(T,J,"","",function(he){return k.call(H,he,oe++)}),J}function ae(T){if(T._status===-1){var k=T._result;k=k(),k.then(function(H){(T._status===0||T._status===-1)&&(T._status=1,T._result=H)},function(H){(T._status===0||T._status===-1)&&(T._status=2,T._result=H)}),T._status===-1&&(T._status=0,T._result=k)}if(T._status===1)return T._result.default;throw T._result}var be=typeof reportError=="function"?reportError:function(T){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var k=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof T=="object"&&T!==null&&typeof T.message=="string"?String(T.message):String(T),error:T});if(!window.dispatchEvent(k))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",T);return}console.error(T)},De={map:X,forEach:function(T,k,H){X(T,function(){k.apply(this,arguments)},H)},count:function(T){var k=0;return X(T,function(){k++}),k},toArray:function(T){return X(T,function(k){return k})||[]},only:function(T){if(!ne(T))throw Error("React.Children.only expected to receive a single React element child.");return T}};return pe.Activity=b,pe.Children=De,pe.Component=Q,pe.Fragment=s,pe.Profiler=o,pe.PureComponent=F,pe.StrictMode=l,pe.Suspense=m,pe.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=A,pe.__COMPILER_RUNTIME={__proto__:null,c:function(T){return A.H.useMemoCache(T)}},pe.cache=function(T){return function(){return T.apply(null,arguments)}},pe.cacheSignal=function(){return null},pe.cloneElement=function(T,k,H){if(T==null)throw Error("The argument must be a React element, but you passed "+T+".");var J=D({},T.props),oe=T.key;if(k!=null)for(he in k.key!==void 0&&(oe=""+k.key),k)!w.call(k,he)||he==="key"||he==="__self"||he==="__source"||he==="ref"&&k.ref===void 0||(J[he]=k[he]);var he=arguments.length-2;if(he===1)J.children=H;else if(1<he){for(var me=Array(he),$e=0;$e<he;$e++)me[$e]=arguments[$e+2];J.children=me}return N(T.type,oe,J)},pe.createContext=function(T){return T={$$typeof:d,_currentValue:T,_currentValue2:T,_threadCount:0,Provider:null,Consumer:null},T.Provider=T,T.Consumer={$$typeof:c,_context:T},T},pe.createElement=function(T,k,H){var J,oe={},he=null;if(k!=null)for(J in k.key!==void 0&&(he=""+k.key),k)w.call(k,J)&&J!=="key"&&J!=="__self"&&J!=="__source"&&(oe[J]=k[J]);var me=arguments.length-2;if(me===1)oe.children=H;else if(1<me){for(var $e=Array(me),Re=0;Re<me;Re++)$e[Re]=arguments[Re+2];oe.children=$e}if(T&&T.defaultProps)for(J in me=T.defaultProps,me)oe[J]===void 0&&(oe[J]=me[J]);return N(T,he,oe)},pe.createRef=function(){return{current:null}},pe.forwardRef=function(T){return{$$typeof:h,render:T}},pe.isValidElement=ne,pe.lazy=function(T){return{$$typeof:S,_payload:{_status:-1,_result:T},_init:ae}},pe.memo=function(T,k){return{$$typeof:y,type:T,compare:k===void 0?null:k}},pe.startTransition=function(T){var k=A.T,H={};A.T=H;try{var J=T(),oe=A.S;oe!==null&&oe(H,J),typeof J=="object"&&J!==null&&typeof J.then=="function"&&J.then(Y,be)}catch(he){be(he)}finally{k!==null&&H.types!==null&&(k.types=H.types),A.T=k}},pe.unstable_useCacheRefresh=function(){return A.H.useCacheRefresh()},pe.use=function(T){return A.H.use(T)},pe.useActionState=function(T,k,H){return A.H.useActionState(T,k,H)},pe.useCallback=function(T,k){return A.H.useCallback(T,k)},pe.useContext=function(T){return A.H.useContext(T)},pe.useDebugValue=function(){},pe.useDeferredValue=function(T,k){return A.H.useDeferredValue(T,k)},pe.useEffect=function(T,k){return A.H.useEffect(T,k)},pe.useEffectEvent=function(T){return A.H.useEffectEvent(T)},pe.useId=function(){return A.H.useId()},pe.useImperativeHandle=function(T,k,H){return A.H.useImperativeHandle(T,k,H)},pe.useInsertionEffect=function(T,k){return A.H.useInsertionEffect(T,k)},pe.useLayoutEffect=function(T,k){return A.H.useLayoutEffect(T,k)},pe.useMemo=function(T,k){return A.H.useMemo(T,k)},pe.useOptimistic=function(T,k){return A.H.useOptimistic(T,k)},pe.useReducer=function(T,k,H){return A.H.useReducer(T,k,H)},pe.useRef=function(T){return A.H.useRef(T)},pe.useState=function(T){return A.H.useState(T)},pe.useSyncExternalStore=function(T,k,H){return A.H.useSyncExternalStore(T,k,H)},pe.useTransition=function(){return A.H.useTransition()},pe.version="19.2.8",pe}var km;function df(){return km||(km=1,Ac.exports=Sx()),Ac.exports}var P=df(),Mc={exports:{}},nr={},Rc={exports:{}},Dc={};var Lm;function wx(){return Lm||(Lm=1,(function(n){function i(z,X){var ae=z.length;z.push(X);e:for(;0<ae;){var be=ae-1>>>1,De=z[be];if(0<o(De,X))z[be]=X,z[ae]=De,ae=be;else break e}}function s(z){return z.length===0?null:z[0]}function l(z){if(z.length===0)return null;var X=z[0],ae=z.pop();if(ae!==X){z[0]=ae;e:for(var be=0,De=z.length,T=De>>>1;be<T;){var k=2*(be+1)-1,H=z[k],J=k+1,oe=z[J];if(0>o(H,ae))J<De&&0>o(oe,H)?(z[be]=oe,z[J]=ae,be=J):(z[be]=H,z[k]=ae,be=k);else if(J<De&&0>o(oe,ae))z[be]=oe,z[J]=ae,be=J;else break e}}return X}function o(z,X){var ae=z.sortIndex-X.sortIndex;return ae!==0?ae:z.id-X.id}if(n.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var c=performance;n.unstable_now=function(){return c.now()}}else{var d=Date,h=d.now();n.unstable_now=function(){return d.now()-h}}var m=[],y=[],S=1,b=null,R=3,L=!1,j=!1,D=!1,B=!1,Q=typeof setTimeout=="function"?setTimeout:null,Z=typeof clearTimeout=="function"?clearTimeout:null,F=typeof setImmediate<"u"?setImmediate:null;function V(z){for(var X=s(y);X!==null;){if(X.callback===null)l(y);else if(X.startTime<=z)l(y),X.sortIndex=X.expirationTime,i(m,X);else break;X=s(y)}}function K(z){if(D=!1,V(z),!j)if(s(m)!==null)j=!0,Y||(Y=!0,le());else{var X=s(y);X!==null&&ue(K,X.startTime-z)}}var Y=!1,A=-1,w=5,N=-1;function te(){return B?!0:!(n.unstable_now()-N<w)}function ne(){if(B=!1,Y){var z=n.unstable_now();N=z;var X=!0;try{e:{j=!1,D&&(D=!1,Z(A),A=-1),L=!0;var ae=R;try{t:{for(V(z),b=s(m);b!==null&&!(b.expirationTime>z&&te());){var be=b.callback;if(typeof be=="function"){b.callback=null,R=b.priorityLevel;var De=be(b.expirationTime<=z);if(z=n.unstable_now(),typeof De=="function"){b.callback=De,V(z),X=!0;break t}b===s(m)&&l(m),V(z)}else l(m);b=s(m)}if(b!==null)X=!0;else{var T=s(y);T!==null&&ue(K,T.startTime-z),X=!1}}break e}finally{b=null,R=ae,L=!1}X=void 0}}finally{X?le():Y=!1}}}var le;if(typeof F=="function")le=function(){F(ne)};else if(typeof MessageChannel<"u"){var Ge=new MessageChannel,de=Ge.port2;Ge.port1.onmessage=ne,le=function(){de.postMessage(null)}}else le=function(){Q(ne,0)};function ue(z,X){A=Q(function(){z(n.unstable_now())},X)}n.unstable_IdlePriority=5,n.unstable_ImmediatePriority=1,n.unstable_LowPriority=4,n.unstable_NormalPriority=3,n.unstable_Profiling=null,n.unstable_UserBlockingPriority=2,n.unstable_cancelCallback=function(z){z.callback=null},n.unstable_forceFrameRate=function(z){0>z||125<z?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):w=0<z?Math.floor(1e3/z):5},n.unstable_getCurrentPriorityLevel=function(){return R},n.unstable_next=function(z){switch(R){case 1:case 2:case 3:var X=3;break;default:X=R}var ae=R;R=X;try{return z()}finally{R=ae}},n.unstable_requestPaint=function(){B=!0},n.unstable_runWithPriority=function(z,X){switch(z){case 1:case 2:case 3:case 4:case 5:break;default:z=3}var ae=R;R=z;try{return X()}finally{R=ae}},n.unstable_scheduleCallback=function(z,X,ae){var be=n.unstable_now();switch(typeof ae=="object"&&ae!==null?(ae=ae.delay,ae=typeof ae=="number"&&0<ae?be+ae:be):ae=be,z){case 1:var De=-1;break;case 2:De=250;break;case 5:De=1073741823;break;case 4:De=1e4;break;default:De=5e3}return De=ae+De,z={id:S++,callback:X,priorityLevel:z,startTime:ae,expirationTime:De,sortIndex:-1},ae>be?(z.sortIndex=ae,i(y,z),s(m)===null&&z===s(y)&&(D?(Z(A),A=-1):D=!0,ue(K,ae-be))):(z.sortIndex=De,i(m,z),j||L||(j=!0,Y||(Y=!0,le()))),z},n.unstable_shouldYield=te,n.unstable_wrapCallback=function(z){var X=R;return function(){var ae=R;R=X;try{return z.apply(this,arguments)}finally{R=ae}}}})(Dc)),Dc}var jm;function Ex(){return jm||(jm=1,Rc.exports=wx()),Rc.exports}var Cc={exports:{}},wt={};var Bm;function Tx(){if(Bm)return wt;Bm=1;var n=df();function i(m){var y="https://react.dev/errors/"+m;if(1<arguments.length){y+="?args[]="+encodeURIComponent(arguments[1]);for(var S=2;S<arguments.length;S++)y+="&args[]="+encodeURIComponent(arguments[S])}return"Minified React error #"+m+"; visit "+y+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function s(){}var l={d:{f:s,r:function(){throw Error(i(522))},D:s,C:s,L:s,m:s,X:s,S:s,M:s},p:0,findDOMNode:null},o=Symbol.for("react.portal");function c(m,y,S){var b=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:o,key:b==null?null:""+b,children:m,containerInfo:y,implementation:S}}var d=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function h(m,y){if(m==="font")return"";if(typeof y=="string")return y==="use-credentials"?y:""}return wt.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=l,wt.createPortal=function(m,y){var S=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!y||y.nodeType!==1&&y.nodeType!==9&&y.nodeType!==11)throw Error(i(299));return c(m,y,null,S)},wt.flushSync=function(m){var y=d.T,S=l.p;try{if(d.T=null,l.p=2,m)return m()}finally{d.T=y,l.p=S,l.d.f()}},wt.preconnect=function(m,y){typeof m=="string"&&(y?(y=y.crossOrigin,y=typeof y=="string"?y==="use-credentials"?y:"":void 0):y=null,l.d.C(m,y))},wt.prefetchDNS=function(m){typeof m=="string"&&l.d.D(m)},wt.preinit=function(m,y){if(typeof m=="string"&&y&&typeof y.as=="string"){var S=y.as,b=h(S,y.crossOrigin),R=typeof y.integrity=="string"?y.integrity:void 0,L=typeof y.fetchPriority=="string"?y.fetchPriority:void 0;S==="style"?l.d.S(m,typeof y.precedence=="string"?y.precedence:void 0,{crossOrigin:b,integrity:R,fetchPriority:L}):S==="script"&&l.d.X(m,{crossOrigin:b,integrity:R,fetchPriority:L,nonce:typeof y.nonce=="string"?y.nonce:void 0})}},wt.preinitModule=function(m,y){if(typeof m=="string")if(typeof y=="object"&&y!==null){if(y.as==null||y.as==="script"){var S=h(y.as,y.crossOrigin);l.d.M(m,{crossOrigin:S,integrity:typeof y.integrity=="string"?y.integrity:void 0,nonce:typeof y.nonce=="string"?y.nonce:void 0})}}else y==null&&l.d.M(m)},wt.preload=function(m,y){if(typeof m=="string"&&typeof y=="object"&&y!==null&&typeof y.as=="string"){var S=y.as,b=h(S,y.crossOrigin);l.d.L(m,S,{crossOrigin:b,integrity:typeof y.integrity=="string"?y.integrity:void 0,nonce:typeof y.nonce=="string"?y.nonce:void 0,type:typeof y.type=="string"?y.type:void 0,fetchPriority:typeof y.fetchPriority=="string"?y.fetchPriority:void 0,referrerPolicy:typeof y.referrerPolicy=="string"?y.referrerPolicy:void 0,imageSrcSet:typeof y.imageSrcSet=="string"?y.imageSrcSet:void 0,imageSizes:typeof y.imageSizes=="string"?y.imageSizes:void 0,media:typeof y.media=="string"?y.media:void 0})}},wt.preloadModule=function(m,y){if(typeof m=="string")if(y){var S=h(y.as,y.crossOrigin);l.d.m(m,{as:typeof y.as=="string"&&y.as!=="script"?y.as:void 0,crossOrigin:S,integrity:typeof y.integrity=="string"?y.integrity:void 0})}else l.d.m(m)},wt.requestFormReset=function(m){l.d.r(m)},wt.unstable_batchedUpdates=function(m,y){return m(y)},wt.useFormState=function(m,y,S){return d.H.useFormState(m,y,S)},wt.useFormStatus=function(){return d.H.useHostTransitionStatus()},wt.version="19.2.8",wt}var Gm;function Ax(){if(Gm)return Cc.exports;Gm=1;function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(i){console.error(i)}}return n(),Cc.exports=Tx(),Cc.exports}var $m;function Mx(){if($m)return nr;$m=1;var n=Ex(),i=df(),s=Ax();function l(e){var t="https://react.dev/errors/"+e;if(1<arguments.length){t+="?args[]="+encodeURIComponent(arguments[1]);for(var a=2;a<arguments.length;a++)t+="&args[]="+encodeURIComponent(arguments[a])}return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function o(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function c(e){var t=e,a=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,(t.flags&4098)!==0&&(a=t.return),e=t.return;while(e)}return t.tag===3?a:null}function d(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function h(e){if(e.tag===31){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function m(e){if(c(e)!==e)throw Error(l(188))}function y(e){var t=e.alternate;if(!t){if(t=c(e),t===null)throw Error(l(188));return t!==e?null:e}for(var a=e,r=t;;){var u=a.return;if(u===null)break;var f=u.alternate;if(f===null){if(r=u.return,r!==null){a=r;continue}break}if(u.child===f.child){for(f=u.child;f;){if(f===a)return m(u),e;if(f===r)return m(u),t;f=f.sibling}throw Error(l(188))}if(a.return!==r.return)a=u,r=f;else{for(var p=!1,g=u.child;g;){if(g===a){p=!0,a=u,r=f;break}if(g===r){p=!0,r=u,a=f;break}g=g.sibling}if(!p){for(g=f.child;g;){if(g===a){p=!0,a=f,r=u;break}if(g===r){p=!0,r=f,a=u;break}g=g.sibling}if(!p)throw Error(l(189))}}if(a.alternate!==r)throw Error(l(190))}if(a.tag!==3)throw Error(l(188));return a.stateNode.current===a?e:t}function S(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=S(e),t!==null)return t;e=e.sibling}return null}var b=Object.assign,R=Symbol.for("react.element"),L=Symbol.for("react.transitional.element"),j=Symbol.for("react.portal"),D=Symbol.for("react.fragment"),B=Symbol.for("react.strict_mode"),Q=Symbol.for("react.profiler"),Z=Symbol.for("react.consumer"),F=Symbol.for("react.context"),V=Symbol.for("react.forward_ref"),K=Symbol.for("react.suspense"),Y=Symbol.for("react.suspense_list"),A=Symbol.for("react.memo"),w=Symbol.for("react.lazy"),N=Symbol.for("react.activity"),te=Symbol.for("react.memo_cache_sentinel"),ne=Symbol.iterator;function le(e){return e===null||typeof e!="object"?null:(e=ne&&e[ne]||e["@@iterator"],typeof e=="function"?e:null)}var Ge=Symbol.for("react.client.reference");function de(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===Ge?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case D:return"Fragment";case Q:return"Profiler";case B:return"StrictMode";case K:return"Suspense";case Y:return"SuspenseList";case N:return"Activity"}if(typeof e=="object")switch(e.$$typeof){case j:return"Portal";case F:return e.displayName||"Context";case Z:return(e._context.displayName||"Context")+".Consumer";case V:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case A:return t=e.displayName||null,t!==null?t:de(e.type)||"Memo";case w:t=e._payload,e=e._init;try{return de(e(t))}catch{}}return null}var ue=Array.isArray,z=i.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,X=s.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ae={pending:!1,data:null,method:null,action:null},be=[],De=-1;function T(e){return{current:e}}function k(e){0>De||(e.current=be[De],be[De]=null,De--)}function H(e,t){De++,be[De]=e.current,e.current=t}var J=T(null),oe=T(null),he=T(null),me=T(null);function $e(e,t){switch(H(he,t),H(oe,e),H(J,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?tm(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=tm(t),e=nm(t,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}k(J),H(J,e)}function Re(){k(J),k(oe),k(he)}function fn(e){e.memoizedState!==null&&H(me,e);var t=J.current,a=nm(t,e.type);t!==a&&(H(oe,e),H(J,a))}function Mn(e){oe.current===e&&(k(J),k(oe)),me.current===e&&(k(me),Zs._currentValue=ae)}var zi,Mt;function kt(e){if(zi===void 0)try{throw Error()}catch(a){var t=a.stack.trim().match(/\n( *(at )?)/);zi=t&&t[1]||"",Mt=-1<a.stack.indexOf(`
2
- at`)?" (<anonymous>)":-1<a.stack.indexOf("@")?"@unknown:0:0":""}return`
3
- `+zi+e+Mt}var Ee=!1;function Kt(e,t){if(!e||Ee)return"";Ee=!0;var a=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var r={DetermineComponentFrameRoot:function(){try{if(t){var I=function(){throw Error()};if(Object.defineProperty(I.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(I,[])}catch(U){var _=U}Reflect.construct(e,[],I)}else{try{I.call()}catch(U){_=U}e.call(I.prototype)}}else{try{throw Error()}catch(U){_=U}(I=e())&&typeof I.catch=="function"&&I.catch(function(){})}}catch(U){if(U&&_&&typeof U.stack=="string")return[U.stack,_.stack]}return[null,null]}};r.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var u=Object.getOwnPropertyDescriptor(r.DetermineComponentFrameRoot,"name");u&&u.configurable&&Object.defineProperty(r.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var f=r.DetermineComponentFrameRoot(),p=f[0],g=f[1];if(p&&g){var x=p.split(`
4
- `),O=g.split(`
5
- `);for(u=r=0;r<x.length&&!x[r].includes("DetermineComponentFrameRoot");)r++;for(;u<O.length&&!O[u].includes("DetermineComponentFrameRoot");)u++;if(r===x.length||u===O.length)for(r=x.length-1,u=O.length-1;1<=r&&0<=u&&x[r]!==O[u];)u--;for(;1<=r&&0<=u;r--,u--)if(x[r]!==O[u]){if(r!==1||u!==1)do if(r--,u--,0>u||x[r]!==O[u]){var G=`
6
- `+x[r].replace(" at new "," at ");return e.displayName&&G.includes("<anonymous>")&&(G=G.replace("<anonymous>",e.displayName)),G}while(1<=r&&0<=u);break}}}finally{Ee=!1,Error.prepareStackTrace=a}return(a=e?e.displayName||e.name:"")?kt(a):""}function ee(e,t){switch(e.tag){case 26:case 27:case 5:return kt(e.type);case 16:return kt("Lazy");case 13:return e.child!==t&&t!==null?kt("Suspense Fallback"):kt("Suspense");case 19:return kt("SuspenseList");case 0:case 15:return Kt(e.type,!1);case 11:return Kt(e.type.render,!1);case 1:return Kt(e.type,!0);case 31:return kt("Activity");default:return""}}function W(e){try{var t="",a=null;do t+=ee(e,a),a=e,e=e.return;while(e);return t}catch(r){return`
7
- Error generating stack: `+r.message+`
8
- `+r.stack}}var ye=Object.prototype.hasOwnProperty,Ce=n.unstable_scheduleCallback,Ke=n.unstable_cancelCallback,Qe=n.unstable_shouldYield,Qt=n.unstable_requestPaint,Ve=n.unstable_now,dn=n.unstable_getCurrentPriorityLevel,xt=n.unstable_ImmediatePriority,Lt=n.unstable_UserBlockingPriority,Rn=n.unstable_NormalPriority,ua=n.unstable_LowPriority,Dn=n.unstable_IdlePriority,_i=n.log,Tt=n.unstable_setDisableYieldValue,ft=null,Ye=null;function St(e){if(typeof _i=="function"&&Tt(e),Ye&&typeof Ye.setStrictMode=="function")try{Ye.setStrictMode(ft,e)}catch{}}var tt=Math.clz32?Math.clz32:us,Ui=Math.log,Ni=Math.LN2;function us(e){return e>>>=0,e===0?32:31-(Ui(e)/Ni|0)|0}var yr=256,vr=262144,br=4194304;function ki(e){var t=e&42;if(t!==0)return t;switch(e&-e){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 e&261888;case 262144:case 524288:case 1048576:case 2097152:return e&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function xr(e,t,a){var r=e.pendingLanes;if(r===0)return 0;var u=0,f=e.suspendedLanes,p=e.pingedLanes;e=e.warmLanes;var g=r&134217727;return g!==0?(r=g&~f,r!==0?u=ki(r):(p&=g,p!==0?u=ki(p):a||(a=g&~e,a!==0&&(u=ki(a))))):(g=r&~f,g!==0?u=ki(g):p!==0?u=ki(p):a||(a=r&~e,a!==0&&(u=ki(a)))),u===0?0:t!==0&&t!==u&&(t&f)===0&&(f=u&-u,a=t&-t,f>=a||f===32&&(a&4194048)!==0)?t:u}function cs(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function rv(e,t){switch(e){case 1:case 2:case 4:case 8:case 64:return t+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 t+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 Lf(){var e=br;return br<<=1,(br&62914560)===0&&(br=4194304),e}function fo(e){for(var t=[],a=0;31>a;a++)t.push(e);return t}function fs(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function lv(e,t,a,r,u,f){var p=e.pendingLanes;e.pendingLanes=a,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=a,e.entangledLanes&=a,e.errorRecoveryDisabledLanes&=a,e.shellSuspendCounter=0;var g=e.entanglements,x=e.expirationTimes,O=e.hiddenUpdates;for(a=p&~a;0<a;){var G=31-tt(a),I=1<<G;g[G]=0,x[G]=-1;var _=O[G];if(_!==null)for(O[G]=null,G=0;G<_.length;G++){var U=_[G];U!==null&&(U.lane&=-536870913)}a&=~I}r!==0&&jf(e,r,0),f!==0&&u===0&&e.tag!==0&&(e.suspendedLanes|=f&~(p&~t))}function jf(e,t,a){e.pendingLanes|=t,e.suspendedLanes&=~t;var r=31-tt(t);e.entangledLanes|=t,e.entanglements[r]=e.entanglements[r]|1073741824|a&261930}function Bf(e,t){var a=e.entangledLanes|=t;for(e=e.entanglements;a;){var r=31-tt(a),u=1<<r;u&t|e[r]&t&&(e[r]|=t),a&=~u}}function Gf(e,t){var a=t&-t;return a=(a&42)!==0?1:ho(a),(a&(e.suspendedLanes|t))!==0?0:a}function ho(e){switch(e){case 2:e=1;break;case 8:e=4;break;case 32:e=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:e=128;break;case 268435456:e=134217728;break;default:e=0}return e}function po(e){return e&=-e,2<e?8<e?(e&134217727)!==0?32:268435456:8:2}function $f(){var e=X.p;return e!==0?e:(e=window.event,e===void 0?32:Am(e.type))}function If(e,t){var a=X.p;try{return X.p=e,t()}finally{X.p=a}}var Jn=Math.random().toString(36).slice(2),mt="__reactFiber$"+Jn,Rt="__reactProps$"+Jn,ca="__reactContainer$"+Jn,mo="__reactEvents$"+Jn,ov="__reactListeners$"+Jn,uv="__reactHandles$"+Jn,Vf="__reactResources$"+Jn,ds="__reactMarker$"+Jn;function go(e){delete e[mt],delete e[Rt],delete e[mo],delete e[ov],delete e[uv]}function fa(e){var t=e[mt];if(t)return t;for(var a=e.parentNode;a;){if(t=a[ca]||a[mt]){if(a=t.alternate,t.child!==null||a!==null&&a.child!==null)for(e=um(e);e!==null;){if(a=e[mt])return a;e=um(e)}return t}e=a,a=e.parentNode}return null}function da(e){if(e=e[mt]||e[ca]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function hs(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(l(33))}function ha(e){var t=e[Vf];return t||(t=e[Vf]={hoistableStyles:new Map,hoistableScripts:new Map}),t}function dt(e){e[ds]=!0}var Ff=new Set,Hf={};function Li(e,t){pa(e,t),pa(e+"Capture",t)}function pa(e,t){for(Hf[e]=t,e=0;e<t.length;e++)Ff.add(t[e])}var cv=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]*$"),qf={},Yf={};function fv(e){return ye.call(Yf,e)?!0:ye.call(qf,e)?!1:cv.test(e)?Yf[e]=!0:(qf[e]=!0,!1)}function Sr(e,t,a){if(fv(t))if(a===null)e.removeAttribute(t);else{switch(typeof a){case"undefined":case"function":case"symbol":e.removeAttribute(t);return;case"boolean":var r=t.toLowerCase().slice(0,5);if(r!=="data-"&&r!=="aria-"){e.removeAttribute(t);return}}e.setAttribute(t,""+a)}}function wr(e,t,a){if(a===null)e.removeAttribute(t);else{switch(typeof a){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(t);return}e.setAttribute(t,""+a)}}function Cn(e,t,a,r){if(r===null)e.removeAttribute(a);else{switch(typeof r){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(a);return}e.setAttributeNS(t,a,""+r)}}function Pt(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function Xf(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function dv(e,t,a){var r=Object.getOwnPropertyDescriptor(e.constructor.prototype,t);if(!e.hasOwnProperty(t)&&typeof r<"u"&&typeof r.get=="function"&&typeof r.set=="function"){var u=r.get,f=r.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return u.call(this)},set:function(p){a=""+p,f.call(this,p)}}),Object.defineProperty(e,t,{enumerable:r.enumerable}),{getValue:function(){return a},setValue:function(p){a=""+p},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function yo(e){if(!e._valueTracker){var t=Xf(e)?"checked":"value";e._valueTracker=dv(e,t,""+e[t])}}function Kf(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var a=t.getValue(),r="";return e&&(r=Xf(e)?e.checked?"true":"false":e.value),e=r,e!==a?(t.setValue(e),!0):!1}function Er(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}var hv=/[\n"\\]/g;function Zt(e){return e.replace(hv,function(t){return"\\"+t.charCodeAt(0).toString(16)+" "})}function vo(e,t,a,r,u,f,p,g){e.name="",p!=null&&typeof p!="function"&&typeof p!="symbol"&&typeof p!="boolean"?e.type=p:e.removeAttribute("type"),t!=null?p==="number"?(t===0&&e.value===""||e.value!=t)&&(e.value=""+Pt(t)):e.value!==""+Pt(t)&&(e.value=""+Pt(t)):p!=="submit"&&p!=="reset"||e.removeAttribute("value"),t!=null?bo(e,p,Pt(t)):a!=null?bo(e,p,Pt(a)):r!=null&&e.removeAttribute("value"),u==null&&f!=null&&(e.defaultChecked=!!f),u!=null&&(e.checked=u&&typeof u!="function"&&typeof u!="symbol"),g!=null&&typeof g!="function"&&typeof g!="symbol"&&typeof g!="boolean"?e.name=""+Pt(g):e.removeAttribute("name")}function Qf(e,t,a,r,u,f,p,g){if(f!=null&&typeof f!="function"&&typeof f!="symbol"&&typeof f!="boolean"&&(e.type=f),t!=null||a!=null){if(!(f!=="submit"&&f!=="reset"||t!=null)){yo(e);return}a=a!=null?""+Pt(a):"",t=t!=null?""+Pt(t):a,g||t===e.value||(e.value=t),e.defaultValue=t}r=r??u,r=typeof r!="function"&&typeof r!="symbol"&&!!r,e.checked=g?e.checked:!!r,e.defaultChecked=!!r,p!=null&&typeof p!="function"&&typeof p!="symbol"&&typeof p!="boolean"&&(e.name=p),yo(e)}function bo(e,t,a){t==="number"&&Er(e.ownerDocument)===e||e.defaultValue===""+a||(e.defaultValue=""+a)}function ma(e,t,a,r){if(e=e.options,t){t={};for(var u=0;u<a.length;u++)t["$"+a[u]]=!0;for(a=0;a<e.length;a++)u=t.hasOwnProperty("$"+e[a].value),e[a].selected!==u&&(e[a].selected=u),u&&r&&(e[a].defaultSelected=!0)}else{for(a=""+Pt(a),t=null,u=0;u<e.length;u++){if(e[u].value===a){e[u].selected=!0,r&&(e[u].defaultSelected=!0);return}t!==null||e[u].disabled||(t=e[u])}t!==null&&(t.selected=!0)}}function Pf(e,t,a){if(t!=null&&(t=""+Pt(t),t!==e.value&&(e.value=t),a==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=a!=null?""+Pt(a):""}function Zf(e,t,a,r){if(t==null){if(r!=null){if(a!=null)throw Error(l(92));if(ue(r)){if(1<r.length)throw Error(l(93));r=r[0]}a=r}a==null&&(a=""),t=a}a=Pt(t),e.defaultValue=a,r=e.textContent,r===a&&r!==""&&r!==null&&(e.value=r),yo(e)}function ga(e,t){if(t){var a=e.firstChild;if(a&&a===e.lastChild&&a.nodeType===3){a.nodeValue=t;return}}e.textContent=t}var pv=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 Wf(e,t,a){var r=t.indexOf("--")===0;a==null||typeof a=="boolean"||a===""?r?e.setProperty(t,""):t==="float"?e.cssFloat="":e[t]="":r?e.setProperty(t,a):typeof a!="number"||a===0||pv.has(t)?t==="float"?e.cssFloat=a:e[t]=(""+a).trim():e[t]=a+"px"}function Jf(e,t,a){if(t!=null&&typeof t!="object")throw Error(l(62));if(e=e.style,a!=null){for(var r in a)!a.hasOwnProperty(r)||t!=null&&t.hasOwnProperty(r)||(r.indexOf("--")===0?e.setProperty(r,""):r==="float"?e.cssFloat="":e[r]="");for(var u in t)r=t[u],t.hasOwnProperty(u)&&a[u]!==r&&Wf(e,u,r)}else for(var f in t)t.hasOwnProperty(f)&&Wf(e,f,t[f])}function xo(e){if(e.indexOf("-")===-1)return!1;switch(e){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 mv=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"]]),gv=/^[\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 Tr(e){return gv.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function On(){}var So=null;function wo(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var ya=null,va=null;function ed(e){var t=da(e);if(t&&(e=t.stateNode)){var a=e[Rt]||null;e:switch(e=t.stateNode,t.type){case"input":if(vo(e,a.value,a.defaultValue,a.defaultValue,a.checked,a.defaultChecked,a.type,a.name),t=a.name,a.type==="radio"&&t!=null){for(a=e;a.parentNode;)a=a.parentNode;for(a=a.querySelectorAll('input[name="'+Zt(""+t)+'"][type="radio"]'),t=0;t<a.length;t++){var r=a[t];if(r!==e&&r.form===e.form){var u=r[Rt]||null;if(!u)throw Error(l(90));vo(r,u.value,u.defaultValue,u.defaultValue,u.checked,u.defaultChecked,u.type,u.name)}}for(t=0;t<a.length;t++)r=a[t],r.form===e.form&&Kf(r)}break e;case"textarea":Pf(e,a.value,a.defaultValue);break e;case"select":t=a.value,t!=null&&ma(e,!!a.multiple,t,!1)}}}var Eo=!1;function td(e,t,a){if(Eo)return e(t,a);Eo=!0;try{var r=e(t);return r}finally{if(Eo=!1,(ya!==null||va!==null)&&(fl(),ya&&(t=ya,e=va,va=ya=null,ed(t),e)))for(t=0;t<e.length;t++)ed(e[t])}}function ps(e,t){var a=e.stateNode;if(a===null)return null;var r=a[Rt]||null;if(r===null)return null;a=r[t];e:switch(t){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(r=!r.disabled)||(e=e.type,r=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!r;break e;default:e=!1}if(e)return null;if(a&&typeof a!="function")throw Error(l(231,t,typeof a));return a}var zn=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),To=!1;if(zn)try{var ms={};Object.defineProperty(ms,"passive",{get:function(){To=!0}}),window.addEventListener("test",ms,ms),window.removeEventListener("test",ms,ms)}catch{To=!1}var ei=null,Ao=null,Ar=null;function nd(){if(Ar)return Ar;var e,t=Ao,a=t.length,r,u="value"in ei?ei.value:ei.textContent,f=u.length;for(e=0;e<a&&t[e]===u[e];e++);var p=a-e;for(r=1;r<=p&&t[a-r]===u[f-r];r++);return Ar=u.slice(e,1<r?1-r:void 0)}function Mr(e){var t=e.keyCode;return"charCode"in e?(e=e.charCode,e===0&&t===13&&(e=13)):e=t,e===10&&(e=13),32<=e||e===13?e:0}function Rr(){return!0}function id(){return!1}function Dt(e){function t(a,r,u,f,p){this._reactName=a,this._targetInst=u,this.type=r,this.nativeEvent=f,this.target=p,this.currentTarget=null;for(var g in e)e.hasOwnProperty(g)&&(a=e[g],this[g]=a?a(f):f[g]);return this.isDefaultPrevented=(f.defaultPrevented!=null?f.defaultPrevented:f.returnValue===!1)?Rr:id,this.isPropagationStopped=id,this}return b(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var a=this.nativeEvent;a&&(a.preventDefault?a.preventDefault():typeof a.returnValue!="unknown"&&(a.returnValue=!1),this.isDefaultPrevented=Rr)},stopPropagation:function(){var a=this.nativeEvent;a&&(a.stopPropagation?a.stopPropagation():typeof a.cancelBubble!="unknown"&&(a.cancelBubble=!0),this.isPropagationStopped=Rr)},persist:function(){},isPersistent:Rr}),t}var ji={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Dr=Dt(ji),gs=b({},ji,{view:0,detail:0}),yv=Dt(gs),Mo,Ro,ys,Cr=b({},gs,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Co,button:0,buttons:0,relatedTarget:function(e){return e.relatedTarget===void 0?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return"movementX"in e?e.movementX:(e!==ys&&(ys&&e.type==="mousemove"?(Mo=e.screenX-ys.screenX,Ro=e.screenY-ys.screenY):Ro=Mo=0,ys=e),Mo)},movementY:function(e){return"movementY"in e?e.movementY:Ro}}),ad=Dt(Cr),vv=b({},Cr,{dataTransfer:0}),bv=Dt(vv),xv=b({},gs,{relatedTarget:0}),Do=Dt(xv),Sv=b({},ji,{animationName:0,elapsedTime:0,pseudoElement:0}),wv=Dt(Sv),Ev=b({},ji,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),Tv=Dt(Ev),Av=b({},ji,{data:0}),sd=Dt(Av),Mv={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Rv={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"},Dv={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Cv(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=Dv[e])?!!t[e]:!1}function Co(){return Cv}var Ov=b({},gs,{key:function(e){if(e.key){var t=Mv[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=Mr(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?Rv[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Co,charCode:function(e){return e.type==="keypress"?Mr(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?Mr(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),zv=Dt(Ov),_v=b({},Cr,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),rd=Dt(_v),Uv=b({},gs,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Co}),Nv=Dt(Uv),kv=b({},ji,{propertyName:0,elapsedTime:0,pseudoElement:0}),Lv=Dt(kv),jv=b({},Cr,{deltaX:function(e){return"deltaX"in e?e.deltaX:"wheelDeltaX"in e?-e.wheelDeltaX:0},deltaY:function(e){return"deltaY"in e?e.deltaY:"wheelDeltaY"in e?-e.wheelDeltaY:"wheelDelta"in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0}),Bv=Dt(jv),Gv=b({},ji,{newState:0,oldState:0}),$v=Dt(Gv),Iv=[9,13,27,32],Oo=zn&&"CompositionEvent"in window,vs=null;zn&&"documentMode"in document&&(vs=document.documentMode);var Vv=zn&&"TextEvent"in window&&!vs,ld=zn&&(!Oo||vs&&8<vs&&11>=vs),od=" ",ud=!1;function cd(e,t){switch(e){case"keyup":return Iv.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function fd(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var ba=!1;function Fv(e,t){switch(e){case"compositionend":return fd(t);case"keypress":return t.which!==32?null:(ud=!0,od);case"textInput":return e=t.data,e===od&&ud?null:e;default:return null}}function Hv(e,t){if(ba)return e==="compositionend"||!Oo&&cd(e,t)?(e=nd(),Ar=Ao=ei=null,ba=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case"compositionend":return ld&&t.locale!=="ko"?null:t.data;default:return null}}var qv={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 dd(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!qv[e.type]:t==="textarea"}function hd(e,t,a,r){ya?va?va.push(r):va=[r]:ya=r,t=vl(t,"onChange"),0<t.length&&(a=new Dr("onChange","change",null,a,r),e.push({event:a,listeners:t}))}var bs=null,xs=null;function Yv(e){Qp(e,0)}function Or(e){var t=hs(e);if(Kf(t))return e}function pd(e,t){if(e==="change")return t}var md=!1;if(zn){var zo;if(zn){var _o="oninput"in document;if(!_o){var gd=document.createElement("div");gd.setAttribute("oninput","return;"),_o=typeof gd.oninput=="function"}zo=_o}else zo=!1;md=zo&&(!document.documentMode||9<document.documentMode)}function yd(){bs&&(bs.detachEvent("onpropertychange",vd),xs=bs=null)}function vd(e){if(e.propertyName==="value"&&Or(xs)){var t=[];hd(t,xs,e,wo(e)),td(Yv,t)}}function Xv(e,t,a){e==="focusin"?(yd(),bs=t,xs=a,bs.attachEvent("onpropertychange",vd)):e==="focusout"&&yd()}function Kv(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return Or(xs)}function Qv(e,t){if(e==="click")return Or(t)}function Pv(e,t){if(e==="input"||e==="change")return Or(t)}function Zv(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var jt=typeof Object.is=="function"?Object.is:Zv;function Ss(e,t){if(jt(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;var a=Object.keys(e),r=Object.keys(t);if(a.length!==r.length)return!1;for(r=0;r<a.length;r++){var u=a[r];if(!ye.call(t,u)||!jt(e[u],t[u]))return!1}return!0}function bd(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function xd(e,t){var a=bd(e);e=0;for(var r;a;){if(a.nodeType===3){if(r=e+a.textContent.length,e<=t&&r>=t)return{node:a,offset:t-e};e=r}e:{for(;a;){if(a.nextSibling){a=a.nextSibling;break e}a=a.parentNode}a=void 0}a=bd(a)}}function Sd(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Sd(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function wd(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=Er(e.document);t instanceof e.HTMLIFrameElement;){try{var a=typeof t.contentWindow.location.href=="string"}catch{a=!1}if(a)e=t.contentWindow;else break;t=Er(e.document)}return t}function Uo(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}var Wv=zn&&"documentMode"in document&&11>=document.documentMode,xa=null,No=null,ws=null,ko=!1;function Ed(e,t,a){var r=a.window===a?a.document:a.nodeType===9?a:a.ownerDocument;ko||xa==null||xa!==Er(r)||(r=xa,"selectionStart"in r&&Uo(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),ws&&Ss(ws,r)||(ws=r,r=vl(No,"onSelect"),0<r.length&&(t=new Dr("onSelect","select",null,t,a),e.push({event:t,listeners:r}),t.target=xa)))}function Bi(e,t){var a={};return a[e.toLowerCase()]=t.toLowerCase(),a["Webkit"+e]="webkit"+t,a["Moz"+e]="moz"+t,a}var Sa={animationend:Bi("Animation","AnimationEnd"),animationiteration:Bi("Animation","AnimationIteration"),animationstart:Bi("Animation","AnimationStart"),transitionrun:Bi("Transition","TransitionRun"),transitionstart:Bi("Transition","TransitionStart"),transitioncancel:Bi("Transition","TransitionCancel"),transitionend:Bi("Transition","TransitionEnd")},Lo={},Td={};zn&&(Td=document.createElement("div").style,"AnimationEvent"in window||(delete Sa.animationend.animation,delete Sa.animationiteration.animation,delete Sa.animationstart.animation),"TransitionEvent"in window||delete Sa.transitionend.transition);function Gi(e){if(Lo[e])return Lo[e];if(!Sa[e])return e;var t=Sa[e],a;for(a in t)if(t.hasOwnProperty(a)&&a in Td)return Lo[e]=t[a];return e}var Ad=Gi("animationend"),Md=Gi("animationiteration"),Rd=Gi("animationstart"),Jv=Gi("transitionrun"),eb=Gi("transitionstart"),tb=Gi("transitioncancel"),Dd=Gi("transitionend"),Cd=new Map,jo="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(" ");jo.push("scrollEnd");function hn(e,t){Cd.set(e,t),Li(t,[e])}var zr=typeof reportError=="function"?reportError:function(e){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var t=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof e=="object"&&e!==null&&typeof e.message=="string"?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",e);return}console.error(e)},Wt=[],wa=0,Bo=0;function _r(){for(var e=wa,t=Bo=wa=0;t<e;){var a=Wt[t];Wt[t++]=null;var r=Wt[t];Wt[t++]=null;var u=Wt[t];Wt[t++]=null;var f=Wt[t];if(Wt[t++]=null,r!==null&&u!==null){var p=r.pending;p===null?u.next=u:(u.next=p.next,p.next=u),r.pending=u}f!==0&&Od(a,u,f)}}function Ur(e,t,a,r){Wt[wa++]=e,Wt[wa++]=t,Wt[wa++]=a,Wt[wa++]=r,Bo|=r,e.lanes|=r,e=e.alternate,e!==null&&(e.lanes|=r)}function Go(e,t,a,r){return Ur(e,t,a,r),Nr(e)}function $i(e,t){return Ur(e,null,null,t),Nr(e)}function Od(e,t,a){e.lanes|=a;var r=e.alternate;r!==null&&(r.lanes|=a);for(var u=!1,f=e.return;f!==null;)f.childLanes|=a,r=f.alternate,r!==null&&(r.childLanes|=a),f.tag===22&&(e=f.stateNode,e===null||e._visibility&1||(u=!0)),e=f,f=f.return;return e.tag===3?(f=e.stateNode,u&&t!==null&&(u=31-tt(a),e=f.hiddenUpdates,r=e[u],r===null?e[u]=[t]:r.push(t),t.lane=a|536870912),f):null}function Nr(e){if(50<Hs)throw Hs=0,Ku=null,Error(l(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var Ea={};function nb(e,t,a,r){this.tag=e,this.key=a,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Bt(e,t,a,r){return new nb(e,t,a,r)}function $o(e){return e=e.prototype,!(!e||!e.isReactComponent)}function _n(e,t){var a=e.alternate;return a===null?(a=Bt(e.tag,t,e.key,e.mode),a.elementType=e.elementType,a.type=e.type,a.stateNode=e.stateNode,a.alternate=e,e.alternate=a):(a.pendingProps=t,a.type=e.type,a.flags=0,a.subtreeFlags=0,a.deletions=null),a.flags=e.flags&65011712,a.childLanes=e.childLanes,a.lanes=e.lanes,a.child=e.child,a.memoizedProps=e.memoizedProps,a.memoizedState=e.memoizedState,a.updateQueue=e.updateQueue,t=e.dependencies,a.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},a.sibling=e.sibling,a.index=e.index,a.ref=e.ref,a.refCleanup=e.refCleanup,a}function zd(e,t){e.flags&=65011714;var a=e.alternate;return a===null?(e.childLanes=0,e.lanes=t,e.child=null,e.subtreeFlags=0,e.memoizedProps=null,e.memoizedState=null,e.updateQueue=null,e.dependencies=null,e.stateNode=null):(e.childLanes=a.childLanes,e.lanes=a.lanes,e.child=a.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=a.memoizedProps,e.memoizedState=a.memoizedState,e.updateQueue=a.updateQueue,e.type=a.type,t=a.dependencies,e.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),e}function kr(e,t,a,r,u,f){var p=0;if(r=e,typeof e=="function")$o(e)&&(p=1);else if(typeof e=="string")p=lx(e,a,J.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(e){case N:return e=Bt(31,a,t,u),e.elementType=N,e.lanes=f,e;case D:return Ii(a.children,u,f,t);case B:p=8,u|=24;break;case Q:return e=Bt(12,a,t,u|2),e.elementType=Q,e.lanes=f,e;case K:return e=Bt(13,a,t,u),e.elementType=K,e.lanes=f,e;case Y:return e=Bt(19,a,t,u),e.elementType=Y,e.lanes=f,e;default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case F:p=10;break e;case Z:p=9;break e;case V:p=11;break e;case A:p=14;break e;case w:p=16,r=null;break e}p=29,a=Error(l(130,e===null?"null":typeof e,"")),r=null}return t=Bt(p,a,t,u),t.elementType=e,t.type=r,t.lanes=f,t}function Ii(e,t,a,r){return e=Bt(7,e,r,t),e.lanes=a,e}function Io(e,t,a){return e=Bt(6,e,null,t),e.lanes=a,e}function _d(e){var t=Bt(18,null,null,0);return t.stateNode=e,t}function Vo(e,t,a){return t=Bt(4,e.children!==null?e.children:[],e.key,t),t.lanes=a,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var Ud=new WeakMap;function Jt(e,t){if(typeof e=="object"&&e!==null){var a=Ud.get(e);return a!==void 0?a:(t={value:e,source:t,stack:W(t)},Ud.set(e,t),t)}return{value:e,source:t,stack:W(t)}}var Ta=[],Aa=0,Lr=null,Es=0,en=[],tn=0,ti=null,bn=1,xn="";function Un(e,t){Ta[Aa++]=Es,Ta[Aa++]=Lr,Lr=e,Es=t}function Nd(e,t,a){en[tn++]=bn,en[tn++]=xn,en[tn++]=ti,ti=e;var r=bn;e=xn;var u=32-tt(r)-1;r&=~(1<<u),a+=1;var f=32-tt(t)+u;if(30<f){var p=u-u%5;f=(r&(1<<p)-1).toString(32),r>>=p,u-=p,bn=1<<32-tt(t)+u|a<<u|r,xn=f+e}else bn=1<<f|a<<u|r,xn=e}function Fo(e){e.return!==null&&(Un(e,1),Nd(e,1,0))}function Ho(e){for(;e===Lr;)Lr=Ta[--Aa],Ta[Aa]=null,Es=Ta[--Aa],Ta[Aa]=null;for(;e===ti;)ti=en[--tn],en[tn]=null,xn=en[--tn],en[tn]=null,bn=en[--tn],en[tn]=null}function kd(e,t){en[tn++]=bn,en[tn++]=xn,en[tn++]=ti,bn=t.id,xn=t.overflow,ti=e}var gt=null,Fe=null,Me=!1,ni=null,nn=!1,qo=Error(l(519));function ii(e){var t=Error(l(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Ts(Jt(t,e)),qo}function Ld(e){var t=e.stateNode,a=e.type,r=e.memoizedProps;switch(t[mt]=e,t[Rt]=r,a){case"dialog":Se("cancel",t),Se("close",t);break;case"iframe":case"object":case"embed":Se("load",t);break;case"video":case"audio":for(a=0;a<Ys.length;a++)Se(Ys[a],t);break;case"source":Se("error",t);break;case"img":case"image":case"link":Se("error",t),Se("load",t);break;case"details":Se("toggle",t);break;case"input":Se("invalid",t),Qf(t,r.value,r.defaultValue,r.checked,r.defaultChecked,r.type,r.name,!0);break;case"select":Se("invalid",t);break;case"textarea":Se("invalid",t),Zf(t,r.value,r.defaultValue,r.children)}a=r.children,typeof a!="string"&&typeof a!="number"&&typeof a!="bigint"||t.textContent===""+a||r.suppressHydrationWarning===!0||Jp(t.textContent,a)?(r.popover!=null&&(Se("beforetoggle",t),Se("toggle",t)),r.onScroll!=null&&Se("scroll",t),r.onScrollEnd!=null&&Se("scrollend",t),r.onClick!=null&&(t.onclick=On),t=!0):t=!1,t||ii(e,!0)}function jd(e){for(gt=e.return;gt;)switch(gt.tag){case 5:case 31:case 13:nn=!1;return;case 27:case 3:nn=!0;return;default:gt=gt.return}}function Ma(e){if(e!==gt)return!1;if(!Me)return jd(e),Me=!0,!1;var t=e.tag,a;if((a=t!==3&&t!==27)&&((a=t===5)&&(a=e.type,a=!(a!=="form"&&a!=="button")||uc(e.type,e.memoizedProps)),a=!a),a&&Fe&&ii(e),jd(e),t===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(l(317));Fe=om(e)}else if(t===31){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(l(317));Fe=om(e)}else t===27?(t=Fe,yi(e.type)?(e=pc,pc=null,Fe=e):Fe=t):Fe=gt?sn(e.stateNode.nextSibling):null;return!0}function Vi(){Fe=gt=null,Me=!1}function Yo(){var e=ni;return e!==null&&(_t===null?_t=e:_t.push.apply(_t,e),ni=null),e}function Ts(e){ni===null?ni=[e]:ni.push(e)}var Xo=T(null),Fi=null,Nn=null;function ai(e,t,a){H(Xo,t._currentValue),t._currentValue=a}function kn(e){e._currentValue=Xo.current,k(Xo)}function Ko(e,t,a){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,r!==null&&(r.childLanes|=t)):r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t),e===a)break;e=e.return}}function Qo(e,t,a,r){var u=e.child;for(u!==null&&(u.return=e);u!==null;){var f=u.dependencies;if(f!==null){var p=u.child;f=f.firstContext;e:for(;f!==null;){var g=f;f=u;for(var x=0;x<t.length;x++)if(g.context===t[x]){f.lanes|=a,g=f.alternate,g!==null&&(g.lanes|=a),Ko(f.return,a,e),r||(p=null);break e}f=g.next}}else if(u.tag===18){if(p=u.return,p===null)throw Error(l(341));p.lanes|=a,f=p.alternate,f!==null&&(f.lanes|=a),Ko(p,a,e),p=null}else p=u.child;if(p!==null)p.return=u;else for(p=u;p!==null;){if(p===e){p=null;break}if(u=p.sibling,u!==null){u.return=p.return,p=u;break}p=p.return}u=p}}function Ra(e,t,a,r){e=null;for(var u=t,f=!1;u!==null;){if(!f){if((u.flags&524288)!==0)f=!0;else if((u.flags&262144)!==0)break}if(u.tag===10){var p=u.alternate;if(p===null)throw Error(l(387));if(p=p.memoizedProps,p!==null){var g=u.type;jt(u.pendingProps.value,p.value)||(e!==null?e.push(g):e=[g])}}else if(u===me.current){if(p=u.alternate,p===null)throw Error(l(387));p.memoizedState.memoizedState!==u.memoizedState.memoizedState&&(e!==null?e.push(Zs):e=[Zs])}u=u.return}e!==null&&Qo(t,e,a,r),t.flags|=262144}function jr(e){for(e=e.firstContext;e!==null;){if(!jt(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function Hi(e){Fi=e,Nn=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function yt(e){return Bd(Fi,e)}function Br(e,t){return Fi===null&&Hi(e),Bd(e,t)}function Bd(e,t){var a=t._currentValue;if(t={context:t,memoizedValue:a,next:null},Nn===null){if(e===null)throw Error(l(308));Nn=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else Nn=Nn.next=t;return a}var ib=typeof AbortController<"u"?AbortController:function(){var e=[],t=this.signal={aborted:!1,addEventListener:function(a,r){e.push(r)}};this.abort=function(){t.aborted=!0,e.forEach(function(a){return a()})}},ab=n.unstable_scheduleCallback,sb=n.unstable_NormalPriority,st={$$typeof:F,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Po(){return{controller:new ib,data:new Map,refCount:0}}function As(e){e.refCount--,e.refCount===0&&ab(sb,function(){e.controller.abort()})}var Ms=null,Zo=0,Da=0,Ca=null;function rb(e,t){if(Ms===null){var a=Ms=[];Zo=0,Da=ec(),Ca={status:"pending",value:void 0,then:function(r){a.push(r)}}}return Zo++,t.then(Gd,Gd),t}function Gd(){if(--Zo===0&&Ms!==null){Ca!==null&&(Ca.status="fulfilled");var e=Ms;Ms=null,Da=0,Ca=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function lb(e,t){var a=[],r={status:"pending",value:null,reason:null,then:function(u){a.push(u)}};return e.then(function(){r.status="fulfilled",r.value=t;for(var u=0;u<a.length;u++)(0,a[u])(t)},function(u){for(r.status="rejected",r.reason=u,u=0;u<a.length;u++)(0,a[u])(void 0)}),r}var $d=z.S;z.S=function(e,t){Ep=Ve(),typeof t=="object"&&t!==null&&typeof t.then=="function"&&rb(e,t),$d!==null&&$d(e,t)};var qi=T(null);function Wo(){var e=qi.current;return e!==null?e:Ie.pooledCache}function Gr(e,t){t===null?H(qi,qi.current):H(qi,t.pool)}function Id(){var e=Wo();return e===null?null:{parent:st._currentValue,pool:e}}var Oa=Error(l(460)),Jo=Error(l(474)),$r=Error(l(542)),Ir={then:function(){}};function Vd(e){return e=e.status,e==="fulfilled"||e==="rejected"}function Fd(e,t,a){switch(a=e[a],a===void 0?e.push(t):a!==t&&(t.then(On,On),t=a),t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,qd(e),e;default:if(typeof t.status=="string")t.then(On,On);else{if(e=Ie,e!==null&&100<e.shellSuspendCounter)throw Error(l(482));e=t,e.status="pending",e.then(function(r){if(t.status==="pending"){var u=t;u.status="fulfilled",u.value=r}},function(r){if(t.status==="pending"){var u=t;u.status="rejected",u.reason=r}})}switch(t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,qd(e),e}throw Xi=t,Oa}}function Yi(e){try{var t=e._init;return t(e._payload)}catch(a){throw a!==null&&typeof a=="object"&&typeof a.then=="function"?(Xi=a,Oa):a}}var Xi=null;function Hd(){if(Xi===null)throw Error(l(459));var e=Xi;return Xi=null,e}function qd(e){if(e===Oa||e===$r)throw Error(l(483))}var za=null,Rs=0;function Vr(e){var t=Rs;return Rs+=1,za===null&&(za=[]),Fd(za,e,t)}function Ds(e,t){t=t.props.ref,e.ref=t!==void 0?t:null}function Fr(e,t){throw t.$$typeof===R?Error(l(525)):(e=Object.prototype.toString.call(t),Error(l(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e)))}function Yd(e){function t(M,E){if(e){var C=M.deletions;C===null?(M.deletions=[E],M.flags|=16):C.push(E)}}function a(M,E){if(!e)return null;for(;E!==null;)t(M,E),E=E.sibling;return null}function r(M){for(var E=new Map;M!==null;)M.key!==null?E.set(M.key,M):E.set(M.index,M),M=M.sibling;return E}function u(M,E){return M=_n(M,E),M.index=0,M.sibling=null,M}function f(M,E,C){return M.index=C,e?(C=M.alternate,C!==null?(C=C.index,C<E?(M.flags|=67108866,E):C):(M.flags|=67108866,E)):(M.flags|=1048576,E)}function p(M){return e&&M.alternate===null&&(M.flags|=67108866),M}function g(M,E,C,$){return E===null||E.tag!==6?(E=Io(C,M.mode,$),E.return=M,E):(E=u(E,C),E.return=M,E)}function x(M,E,C,$){var ce=C.type;return ce===D?G(M,E,C.props.children,$,C.key):E!==null&&(E.elementType===ce||typeof ce=="object"&&ce!==null&&ce.$$typeof===w&&Yi(ce)===E.type)?(E=u(E,C.props),Ds(E,C),E.return=M,E):(E=kr(C.type,C.key,C.props,null,M.mode,$),Ds(E,C),E.return=M,E)}function O(M,E,C,$){return E===null||E.tag!==4||E.stateNode.containerInfo!==C.containerInfo||E.stateNode.implementation!==C.implementation?(E=Vo(C,M.mode,$),E.return=M,E):(E=u(E,C.children||[]),E.return=M,E)}function G(M,E,C,$,ce){return E===null||E.tag!==7?(E=Ii(C,M.mode,$,ce),E.return=M,E):(E=u(E,C),E.return=M,E)}function I(M,E,C){if(typeof E=="string"&&E!==""||typeof E=="number"||typeof E=="bigint")return E=Io(""+E,M.mode,C),E.return=M,E;if(typeof E=="object"&&E!==null){switch(E.$$typeof){case L:return C=kr(E.type,E.key,E.props,null,M.mode,C),Ds(C,E),C.return=M,C;case j:return E=Vo(E,M.mode,C),E.return=M,E;case w:return E=Yi(E),I(M,E,C)}if(ue(E)||le(E))return E=Ii(E,M.mode,C,null),E.return=M,E;if(typeof E.then=="function")return I(M,Vr(E),C);if(E.$$typeof===F)return I(M,Br(M,E),C);Fr(M,E)}return null}function _(M,E,C,$){var ce=E!==null?E.key:null;if(typeof C=="string"&&C!==""||typeof C=="number"||typeof C=="bigint")return ce!==null?null:g(M,E,""+C,$);if(typeof C=="object"&&C!==null){switch(C.$$typeof){case L:return C.key===ce?x(M,E,C,$):null;case j:return C.key===ce?O(M,E,C,$):null;case w:return C=Yi(C),_(M,E,C,$)}if(ue(C)||le(C))return ce!==null?null:G(M,E,C,$,null);if(typeof C.then=="function")return _(M,E,Vr(C),$);if(C.$$typeof===F)return _(M,E,Br(M,C),$);Fr(M,C)}return null}function U(M,E,C,$,ce){if(typeof $=="string"&&$!==""||typeof $=="number"||typeof $=="bigint")return M=M.get(C)||null,g(E,M,""+$,ce);if(typeof $=="object"&&$!==null){switch($.$$typeof){case L:return M=M.get($.key===null?C:$.key)||null,x(E,M,$,ce);case j:return M=M.get($.key===null?C:$.key)||null,O(E,M,$,ce);case w:return $=Yi($),U(M,E,C,$,ce)}if(ue($)||le($))return M=M.get(C)||null,G(E,M,$,ce,null);if(typeof $.then=="function")return U(M,E,C,Vr($),ce);if($.$$typeof===F)return U(M,E,C,Br(E,$),ce);Fr(E,$)}return null}function ie(M,E,C,$){for(var ce=null,Oe=null,re=E,ve=E=0,Ae=null;re!==null&&ve<C.length;ve++){re.index>ve?(Ae=re,re=null):Ae=re.sibling;var ze=_(M,re,C[ve],$);if(ze===null){re===null&&(re=Ae);break}e&&re&&ze.alternate===null&&t(M,re),E=f(ze,E,ve),Oe===null?ce=ze:Oe.sibling=ze,Oe=ze,re=Ae}if(ve===C.length)return a(M,re),Me&&Un(M,ve),ce;if(re===null){for(;ve<C.length;ve++)re=I(M,C[ve],$),re!==null&&(E=f(re,E,ve),Oe===null?ce=re:Oe.sibling=re,Oe=re);return Me&&Un(M,ve),ce}for(re=r(re);ve<C.length;ve++)Ae=U(re,M,ve,C[ve],$),Ae!==null&&(e&&Ae.alternate!==null&&re.delete(Ae.key===null?ve:Ae.key),E=f(Ae,E,ve),Oe===null?ce=Ae:Oe.sibling=Ae,Oe=Ae);return e&&re.forEach(function(wi){return t(M,wi)}),Me&&Un(M,ve),ce}function fe(M,E,C,$){if(C==null)throw Error(l(151));for(var ce=null,Oe=null,re=E,ve=E=0,Ae=null,ze=C.next();re!==null&&!ze.done;ve++,ze=C.next()){re.index>ve?(Ae=re,re=null):Ae=re.sibling;var wi=_(M,re,ze.value,$);if(wi===null){re===null&&(re=Ae);break}e&&re&&wi.alternate===null&&t(M,re),E=f(wi,E,ve),Oe===null?ce=wi:Oe.sibling=wi,Oe=wi,re=Ae}if(ze.done)return a(M,re),Me&&Un(M,ve),ce;if(re===null){for(;!ze.done;ve++,ze=C.next())ze=I(M,ze.value,$),ze!==null&&(E=f(ze,E,ve),Oe===null?ce=ze:Oe.sibling=ze,Oe=ze);return Me&&Un(M,ve),ce}for(re=r(re);!ze.done;ve++,ze=C.next())ze=U(re,M,ve,ze.value,$),ze!==null&&(e&&ze.alternate!==null&&re.delete(ze.key===null?ve:ze.key),E=f(ze,E,ve),Oe===null?ce=ze:Oe.sibling=ze,Oe=ze);return e&&re.forEach(function(vx){return t(M,vx)}),Me&&Un(M,ve),ce}function Be(M,E,C,$){if(typeof C=="object"&&C!==null&&C.type===D&&C.key===null&&(C=C.props.children),typeof C=="object"&&C!==null){switch(C.$$typeof){case L:e:{for(var ce=C.key;E!==null;){if(E.key===ce){if(ce=C.type,ce===D){if(E.tag===7){a(M,E.sibling),$=u(E,C.props.children),$.return=M,M=$;break e}}else if(E.elementType===ce||typeof ce=="object"&&ce!==null&&ce.$$typeof===w&&Yi(ce)===E.type){a(M,E.sibling),$=u(E,C.props),Ds($,C),$.return=M,M=$;break e}a(M,E);break}else t(M,E);E=E.sibling}C.type===D?($=Ii(C.props.children,M.mode,$,C.key),$.return=M,M=$):($=kr(C.type,C.key,C.props,null,M.mode,$),Ds($,C),$.return=M,M=$)}return p(M);case j:e:{for(ce=C.key;E!==null;){if(E.key===ce)if(E.tag===4&&E.stateNode.containerInfo===C.containerInfo&&E.stateNode.implementation===C.implementation){a(M,E.sibling),$=u(E,C.children||[]),$.return=M,M=$;break e}else{a(M,E);break}else t(M,E);E=E.sibling}$=Vo(C,M.mode,$),$.return=M,M=$}return p(M);case w:return C=Yi(C),Be(M,E,C,$)}if(ue(C))return ie(M,E,C,$);if(le(C)){if(ce=le(C),typeof ce!="function")throw Error(l(150));return C=ce.call(C),fe(M,E,C,$)}if(typeof C.then=="function")return Be(M,E,Vr(C),$);if(C.$$typeof===F)return Be(M,E,Br(M,C),$);Fr(M,C)}return typeof C=="string"&&C!==""||typeof C=="number"||typeof C=="bigint"?(C=""+C,E!==null&&E.tag===6?(a(M,E.sibling),$=u(E,C),$.return=M,M=$):(a(M,E),$=Io(C,M.mode,$),$.return=M,M=$),p(M)):a(M,E)}return function(M,E,C,$){try{Rs=0;var ce=Be(M,E,C,$);return za=null,ce}catch(re){if(re===Oa||re===$r)throw re;var Oe=Bt(29,re,null,M.mode);return Oe.lanes=$,Oe.return=M,Oe}}}var Ki=Yd(!0),Xd=Yd(!1),si=!1;function eu(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function tu(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function ri(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function li(e,t,a){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,(_e&2)!==0){var u=r.pending;return u===null?t.next=t:(t.next=u.next,u.next=t),r.pending=t,t=Nr(e),Od(e,null,a),t}return Ur(e,r,t,a),Nr(e)}function Cs(e,t,a){if(t=t.updateQueue,t!==null&&(t=t.shared,(a&4194048)!==0)){var r=t.lanes;r&=e.pendingLanes,a|=r,t.lanes=a,Bf(e,a)}}function nu(e,t){var a=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,a===r)){var u=null,f=null;if(a=a.firstBaseUpdate,a!==null){do{var p={lane:a.lane,tag:a.tag,payload:a.payload,callback:null,next:null};f===null?u=f=p:f=f.next=p,a=a.next}while(a!==null);f===null?u=f=t:f=f.next=t}else u=f=t;a={baseState:r.baseState,firstBaseUpdate:u,lastBaseUpdate:f,shared:r.shared,callbacks:r.callbacks},e.updateQueue=a;return}e=a.lastBaseUpdate,e===null?a.firstBaseUpdate=t:e.next=t,a.lastBaseUpdate=t}var iu=!1;function Os(){if(iu){var e=Ca;if(e!==null)throw e}}function zs(e,t,a,r){iu=!1;var u=e.updateQueue;si=!1;var f=u.firstBaseUpdate,p=u.lastBaseUpdate,g=u.shared.pending;if(g!==null){u.shared.pending=null;var x=g,O=x.next;x.next=null,p===null?f=O:p.next=O,p=x;var G=e.alternate;G!==null&&(G=G.updateQueue,g=G.lastBaseUpdate,g!==p&&(g===null?G.firstBaseUpdate=O:g.next=O,G.lastBaseUpdate=x))}if(f!==null){var I=u.baseState;p=0,G=O=x=null,g=f;do{var _=g.lane&-536870913,U=_!==g.lane;if(U?(Te&_)===_:(r&_)===_){_!==0&&_===Da&&(iu=!0),G!==null&&(G=G.next={lane:0,tag:g.tag,payload:g.payload,callback:null,next:null});e:{var ie=e,fe=g;_=t;var Be=a;switch(fe.tag){case 1:if(ie=fe.payload,typeof ie=="function"){I=ie.call(Be,I,_);break e}I=ie;break e;case 3:ie.flags=ie.flags&-65537|128;case 0:if(ie=fe.payload,_=typeof ie=="function"?ie.call(Be,I,_):ie,_==null)break e;I=b({},I,_);break e;case 2:si=!0}}_=g.callback,_!==null&&(e.flags|=64,U&&(e.flags|=8192),U=u.callbacks,U===null?u.callbacks=[_]:U.push(_))}else U={lane:_,tag:g.tag,payload:g.payload,callback:g.callback,next:null},G===null?(O=G=U,x=I):G=G.next=U,p|=_;if(g=g.next,g===null){if(g=u.shared.pending,g===null)break;U=g,g=U.next,U.next=null,u.lastBaseUpdate=U,u.shared.pending=null}}while(!0);G===null&&(x=I),u.baseState=x,u.firstBaseUpdate=O,u.lastBaseUpdate=G,f===null&&(u.shared.lanes=0),di|=p,e.lanes=p,e.memoizedState=I}}function Kd(e,t){if(typeof e!="function")throw Error(l(191,e));e.call(t)}function Qd(e,t){var a=e.callbacks;if(a!==null)for(e.callbacks=null,e=0;e<a.length;e++)Kd(a[e],t)}var _a=T(null),Hr=T(0);function Pd(e,t){e=Hn,H(Hr,e),H(_a,t),Hn=e|t.baseLanes}function au(){H(Hr,Hn),H(_a,_a.current)}function su(){Hn=Hr.current,k(_a),k(Hr)}var Gt=T(null),an=null;function oi(e){var t=e.alternate;H(nt,nt.current&1),H(Gt,e),an===null&&(t===null||_a.current!==null||t.memoizedState!==null)&&(an=e)}function ru(e){H(nt,nt.current),H(Gt,e),an===null&&(an=e)}function Zd(e){e.tag===22?(H(nt,nt.current),H(Gt,e),an===null&&(an=e)):ui()}function ui(){H(nt,nt.current),H(Gt,Gt.current)}function $t(e){k(Gt),an===e&&(an=null),k(nt)}var nt=T(0);function qr(e){for(var t=e;t!==null;){if(t.tag===13){var a=t.memoizedState;if(a!==null&&(a=a.dehydrated,a===null||dc(a)||hc(a)))return t}else if(t.tag===19&&(t.memoizedProps.revealOrder==="forwards"||t.memoizedProps.revealOrder==="backwards"||t.memoizedProps.revealOrder==="unstable_legacy-backwards"||t.memoizedProps.revealOrder==="together")){if((t.flags&128)!==0)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var Ln=0,ge=null,Le=null,rt=null,Yr=!1,Ua=!1,Qi=!1,Xr=0,_s=0,Na=null,ob=0;function We(){throw Error(l(321))}function lu(e,t){if(t===null)return!1;for(var a=0;a<t.length&&a<e.length;a++)if(!jt(e[a],t[a]))return!1;return!0}function ou(e,t,a,r,u,f){return Ln=f,ge=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,z.H=e===null||e.memoizedState===null?Nh:Eu,Qi=!1,f=a(r,u),Qi=!1,Ua&&(f=Jd(t,a,r,u)),Wd(e),f}function Wd(e){z.H=ks;var t=Le!==null&&Le.next!==null;if(Ln=0,rt=Le=ge=null,Yr=!1,_s=0,Na=null,t)throw Error(l(300));e===null||lt||(e=e.dependencies,e!==null&&jr(e)&&(lt=!0))}function Jd(e,t,a,r){ge=e;var u=0;do{if(Ua&&(Na=null),_s=0,Ua=!1,25<=u)throw Error(l(301));if(u+=1,rt=Le=null,e.updateQueue!=null){var f=e.updateQueue;f.lastEffect=null,f.events=null,f.stores=null,f.memoCache!=null&&(f.memoCache.index=0)}z.H=kh,f=t(a,r)}while(Ua);return f}function ub(){var e=z.H,t=e.useState()[0];return t=typeof t.then=="function"?Us(t):t,e=e.useState()[0],(Le!==null?Le.memoizedState:null)!==e&&(ge.flags|=1024),t}function uu(){var e=Xr!==0;return Xr=0,e}function cu(e,t,a){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~a}function fu(e){if(Yr){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}Yr=!1}Ln=0,rt=Le=ge=null,Ua=!1,_s=Xr=0,Na=null}function At(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return rt===null?ge.memoizedState=rt=e:rt=rt.next=e,rt}function it(){if(Le===null){var e=ge.alternate;e=e!==null?e.memoizedState:null}else e=Le.next;var t=rt===null?ge.memoizedState:rt.next;if(t!==null)rt=t,Le=e;else{if(e===null)throw ge.alternate===null?Error(l(467)):Error(l(310));Le=e,e={memoizedState:Le.memoizedState,baseState:Le.baseState,baseQueue:Le.baseQueue,queue:Le.queue,next:null},rt===null?ge.memoizedState=rt=e:rt=rt.next=e}return rt}function Kr(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Us(e){var t=_s;return _s+=1,Na===null&&(Na=[]),e=Fd(Na,e,t),t=ge,(rt===null?t.memoizedState:rt.next)===null&&(t=t.alternate,z.H=t===null||t.memoizedState===null?Nh:Eu),e}function Qr(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return Us(e);if(e.$$typeof===F)return yt(e)}throw Error(l(438,String(e)))}function du(e){var t=null,a=ge.updateQueue;if(a!==null&&(t=a.memoCache),t==null){var r=ge.alternate;r!==null&&(r=r.updateQueue,r!==null&&(r=r.memoCache,r!=null&&(t={data:r.data.map(function(u){return u.slice()}),index:0})))}if(t==null&&(t={data:[],index:0}),a===null&&(a=Kr(),ge.updateQueue=a),a.memoCache=t,a=t.data[t.index],a===void 0)for(a=t.data[t.index]=Array(e),r=0;r<e;r++)a[r]=te;return t.index++,a}function jn(e,t){return typeof t=="function"?t(e):t}function Pr(e){var t=it();return hu(t,Le,e)}function hu(e,t,a){var r=e.queue;if(r===null)throw Error(l(311));r.lastRenderedReducer=a;var u=e.baseQueue,f=r.pending;if(f!==null){if(u!==null){var p=u.next;u.next=f.next,f.next=p}t.baseQueue=u=f,r.pending=null}if(f=e.baseState,u===null)e.memoizedState=f;else{t=u.next;var g=p=null,x=null,O=t,G=!1;do{var I=O.lane&-536870913;if(I!==O.lane?(Te&I)===I:(Ln&I)===I){var _=O.revertLane;if(_===0)x!==null&&(x=x.next={lane:0,revertLane:0,gesture:null,action:O.action,hasEagerState:O.hasEagerState,eagerState:O.eagerState,next:null}),I===Da&&(G=!0);else if((Ln&_)===_){O=O.next,_===Da&&(G=!0);continue}else I={lane:0,revertLane:O.revertLane,gesture:null,action:O.action,hasEagerState:O.hasEagerState,eagerState:O.eagerState,next:null},x===null?(g=x=I,p=f):x=x.next=I,ge.lanes|=_,di|=_;I=O.action,Qi&&a(f,I),f=O.hasEagerState?O.eagerState:a(f,I)}else _={lane:I,revertLane:O.revertLane,gesture:O.gesture,action:O.action,hasEagerState:O.hasEagerState,eagerState:O.eagerState,next:null},x===null?(g=x=_,p=f):x=x.next=_,ge.lanes|=I,di|=I;O=O.next}while(O!==null&&O!==t);if(x===null?p=f:x.next=g,!jt(f,e.memoizedState)&&(lt=!0,G&&(a=Ca,a!==null)))throw a;e.memoizedState=f,e.baseState=p,e.baseQueue=x,r.lastRenderedState=f}return u===null&&(r.lanes=0),[e.memoizedState,r.dispatch]}function pu(e){var t=it(),a=t.queue;if(a===null)throw Error(l(311));a.lastRenderedReducer=e;var r=a.dispatch,u=a.pending,f=t.memoizedState;if(u!==null){a.pending=null;var p=u=u.next;do f=e(f,p.action),p=p.next;while(p!==u);jt(f,t.memoizedState)||(lt=!0),t.memoizedState=f,t.baseQueue===null&&(t.baseState=f),a.lastRenderedState=f}return[f,r]}function eh(e,t,a){var r=ge,u=it(),f=Me;if(f){if(a===void 0)throw Error(l(407));a=a()}else a=t();var p=!jt((Le||u).memoizedState,a);if(p&&(u.memoizedState=a,lt=!0),u=u.queue,yu(ih.bind(null,r,u,e),[e]),u.getSnapshot!==t||p||rt!==null&&rt.memoizedState.tag&1){if(r.flags|=2048,ka(9,{destroy:void 0},nh.bind(null,r,u,a,t),null),Ie===null)throw Error(l(349));f||(Ln&127)!==0||th(r,t,a)}return a}function th(e,t,a){e.flags|=16384,e={getSnapshot:t,value:a},t=ge.updateQueue,t===null?(t=Kr(),ge.updateQueue=t,t.stores=[e]):(a=t.stores,a===null?t.stores=[e]:a.push(e))}function nh(e,t,a,r){t.value=a,t.getSnapshot=r,ah(t)&&sh(e)}function ih(e,t,a){return a(function(){ah(t)&&sh(e)})}function ah(e){var t=e.getSnapshot;e=e.value;try{var a=t();return!jt(e,a)}catch{return!0}}function sh(e){var t=$i(e,2);t!==null&&Ut(t,e,2)}function mu(e){var t=At();if(typeof e=="function"){var a=e;if(e=a(),Qi){St(!0);try{a()}finally{St(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:jn,lastRenderedState:e},t}function rh(e,t,a,r){return e.baseState=a,hu(e,Le,typeof r=="function"?r:jn)}function cb(e,t,a,r,u){if(Jr(e))throw Error(l(485));if(e=t.action,e!==null){var f={payload:u,action:e,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(p){f.listeners.push(p)}};z.T!==null?a(!0):f.isTransition=!1,r(f),a=t.pending,a===null?(f.next=t.pending=f,lh(t,f)):(f.next=a.next,t.pending=a.next=f)}}function lh(e,t){var a=t.action,r=t.payload,u=e.state;if(t.isTransition){var f=z.T,p={};z.T=p;try{var g=a(u,r),x=z.S;x!==null&&x(p,g),oh(e,t,g)}catch(O){gu(e,t,O)}finally{f!==null&&p.types!==null&&(f.types=p.types),z.T=f}}else try{f=a(u,r),oh(e,t,f)}catch(O){gu(e,t,O)}}function oh(e,t,a){a!==null&&typeof a=="object"&&typeof a.then=="function"?a.then(function(r){uh(e,t,r)},function(r){return gu(e,t,r)}):uh(e,t,a)}function uh(e,t,a){t.status="fulfilled",t.value=a,ch(t),e.state=a,t=e.pending,t!==null&&(a=t.next,a===t?e.pending=null:(a=a.next,t.next=a,lh(e,a)))}function gu(e,t,a){var r=e.pending;if(e.pending=null,r!==null){r=r.next;do t.status="rejected",t.reason=a,ch(t),t=t.next;while(t!==r)}e.action=null}function ch(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function fh(e,t){return t}function dh(e,t){if(Me){var a=Ie.formState;if(a!==null){e:{var r=ge;if(Me){if(Fe){t:{for(var u=Fe,f=nn;u.nodeType!==8;){if(!f){u=null;break t}if(u=sn(u.nextSibling),u===null){u=null;break t}}f=u.data,u=f==="F!"||f==="F"?u:null}if(u){Fe=sn(u.nextSibling),r=u.data==="F!";break e}}ii(r)}r=!1}r&&(t=a[0])}}return a=At(),a.memoizedState=a.baseState=t,r={pending:null,lanes:0,dispatch:null,lastRenderedReducer:fh,lastRenderedState:t},a.queue=r,a=zh.bind(null,ge,r),r.dispatch=a,r=mu(!1),f=wu.bind(null,ge,!1,r.queue),r=At(),u={state:t,dispatch:null,action:e,pending:null},r.queue=u,a=cb.bind(null,ge,u,f,a),u.dispatch=a,r.memoizedState=e,[t,a,!1]}function hh(e){var t=it();return ph(t,Le,e)}function ph(e,t,a){if(t=hu(e,t,fh)[0],e=Pr(jn)[0],typeof t=="object"&&t!==null&&typeof t.then=="function")try{var r=Us(t)}catch(p){throw p===Oa?$r:p}else r=t;t=it();var u=t.queue,f=u.dispatch;return a!==t.memoizedState&&(ge.flags|=2048,ka(9,{destroy:void 0},fb.bind(null,u,a),null)),[r,f,e]}function fb(e,t){e.action=t}function mh(e){var t=it(),a=Le;if(a!==null)return ph(t,a,e);it(),t=t.memoizedState,a=it();var r=a.queue.dispatch;return a.memoizedState=e,[t,r,!1]}function ka(e,t,a,r){return e={tag:e,create:a,deps:r,inst:t,next:null},t=ge.updateQueue,t===null&&(t=Kr(),ge.updateQueue=t),a=t.lastEffect,a===null?t.lastEffect=e.next=e:(r=a.next,a.next=e,e.next=r,t.lastEffect=e),e}function gh(){return it().memoizedState}function Zr(e,t,a,r){var u=At();ge.flags|=e,u.memoizedState=ka(1|t,{destroy:void 0},a,r===void 0?null:r)}function Wr(e,t,a,r){var u=it();r=r===void 0?null:r;var f=u.memoizedState.inst;Le!==null&&r!==null&&lu(r,Le.memoizedState.deps)?u.memoizedState=ka(t,f,a,r):(ge.flags|=e,u.memoizedState=ka(1|t,f,a,r))}function yh(e,t){Zr(8390656,8,e,t)}function yu(e,t){Wr(2048,8,e,t)}function db(e){ge.flags|=4;var t=ge.updateQueue;if(t===null)t=Kr(),ge.updateQueue=t,t.events=[e];else{var a=t.events;a===null?t.events=[e]:a.push(e)}}function vh(e){var t=it().memoizedState;return db({ref:t,nextImpl:e}),function(){if((_e&2)!==0)throw Error(l(440));return t.impl.apply(void 0,arguments)}}function bh(e,t){return Wr(4,2,e,t)}function xh(e,t){return Wr(4,4,e,t)}function Sh(e,t){if(typeof t=="function"){e=e();var a=t(e);return function(){typeof a=="function"?a():t(null)}}if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function wh(e,t,a){a=a!=null?a.concat([e]):null,Wr(4,4,Sh.bind(null,t,e),a)}function vu(){}function Eh(e,t){var a=it();t=t===void 0?null:t;var r=a.memoizedState;return t!==null&&lu(t,r[1])?r[0]:(a.memoizedState=[e,t],e)}function Th(e,t){var a=it();t=t===void 0?null:t;var r=a.memoizedState;if(t!==null&&lu(t,r[1]))return r[0];if(r=e(),Qi){St(!0);try{e()}finally{St(!1)}}return a.memoizedState=[r,t],r}function bu(e,t,a){return a===void 0||(Ln&1073741824)!==0&&(Te&261930)===0?e.memoizedState=t:(e.memoizedState=a,e=Ap(),ge.lanes|=e,di|=e,a)}function Ah(e,t,a,r){return jt(a,t)?a:_a.current!==null?(e=bu(e,a,r),jt(e,t)||(lt=!0),e):(Ln&42)===0||(Ln&1073741824)!==0&&(Te&261930)===0?(lt=!0,e.memoizedState=a):(e=Ap(),ge.lanes|=e,di|=e,t)}function Mh(e,t,a,r,u){var f=X.p;X.p=f!==0&&8>f?f:8;var p=z.T,g={};z.T=g,wu(e,!1,t,a);try{var x=u(),O=z.S;if(O!==null&&O(g,x),x!==null&&typeof x=="object"&&typeof x.then=="function"){var G=lb(x,r);Ns(e,t,G,Ft(e))}else Ns(e,t,r,Ft(e))}catch(I){Ns(e,t,{then:function(){},status:"rejected",reason:I},Ft())}finally{X.p=f,p!==null&&g.types!==null&&(p.types=g.types),z.T=p}}function hb(){}function xu(e,t,a,r){if(e.tag!==5)throw Error(l(476));var u=Rh(e).queue;Mh(e,u,t,ae,a===null?hb:function(){return Dh(e),a(r)})}function Rh(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:ae,baseState:ae,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:jn,lastRenderedState:ae},next:null};var a={};return t.next={memoizedState:a,baseState:a,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:jn,lastRenderedState:a},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function Dh(e){var t=Rh(e);t.next===null&&(t=e.alternate.memoizedState),Ns(e,t.next.queue,{},Ft())}function Su(){return yt(Zs)}function Ch(){return it().memoizedState}function Oh(){return it().memoizedState}function pb(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var a=Ft();e=ri(a);var r=li(t,e,a);r!==null&&(Ut(r,t,a),Cs(r,t,a)),t={cache:Po()},e.payload=t;return}t=t.return}}function mb(e,t,a){var r=Ft();a={lane:r,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null},Jr(e)?_h(t,a):(a=Go(e,t,a,r),a!==null&&(Ut(a,e,r),Uh(a,t,r)))}function zh(e,t,a){var r=Ft();Ns(e,t,a,r)}function Ns(e,t,a,r){var u={lane:r,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null};if(Jr(e))_h(t,u);else{var f=e.alternate;if(e.lanes===0&&(f===null||f.lanes===0)&&(f=t.lastRenderedReducer,f!==null))try{var p=t.lastRenderedState,g=f(p,a);if(u.hasEagerState=!0,u.eagerState=g,jt(g,p))return Ur(e,t,u,0),Ie===null&&_r(),!1}catch{}if(a=Go(e,t,u,r),a!==null)return Ut(a,e,r),Uh(a,t,r),!0}return!1}function wu(e,t,a,r){if(r={lane:2,revertLane:ec(),gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null},Jr(e)){if(t)throw Error(l(479))}else t=Go(e,a,r,2),t!==null&&Ut(t,e,2)}function Jr(e){var t=e.alternate;return e===ge||t!==null&&t===ge}function _h(e,t){Ua=Yr=!0;var a=e.pending;a===null?t.next=t:(t.next=a.next,a.next=t),e.pending=t}function Uh(e,t,a){if((a&4194048)!==0){var r=t.lanes;r&=e.pendingLanes,a|=r,t.lanes=a,Bf(e,a)}}var ks={readContext:yt,use:Qr,useCallback:We,useContext:We,useEffect:We,useImperativeHandle:We,useLayoutEffect:We,useInsertionEffect:We,useMemo:We,useReducer:We,useRef:We,useState:We,useDebugValue:We,useDeferredValue:We,useTransition:We,useSyncExternalStore:We,useId:We,useHostTransitionStatus:We,useFormState:We,useActionState:We,useOptimistic:We,useMemoCache:We,useCacheRefresh:We};ks.useEffectEvent=We;var Nh={readContext:yt,use:Qr,useCallback:function(e,t){return At().memoizedState=[e,t===void 0?null:t],e},useContext:yt,useEffect:yh,useImperativeHandle:function(e,t,a){a=a!=null?a.concat([e]):null,Zr(4194308,4,Sh.bind(null,t,e),a)},useLayoutEffect:function(e,t){return Zr(4194308,4,e,t)},useInsertionEffect:function(e,t){Zr(4,2,e,t)},useMemo:function(e,t){var a=At();t=t===void 0?null:t;var r=e();if(Qi){St(!0);try{e()}finally{St(!1)}}return a.memoizedState=[r,t],r},useReducer:function(e,t,a){var r=At();if(a!==void 0){var u=a(t);if(Qi){St(!0);try{a(t)}finally{St(!1)}}}else u=t;return r.memoizedState=r.baseState=u,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:u},r.queue=e,e=e.dispatch=mb.bind(null,ge,e),[r.memoizedState,e]},useRef:function(e){var t=At();return e={current:e},t.memoizedState=e},useState:function(e){e=mu(e);var t=e.queue,a=zh.bind(null,ge,t);return t.dispatch=a,[e.memoizedState,a]},useDebugValue:vu,useDeferredValue:function(e,t){var a=At();return bu(a,e,t)},useTransition:function(){var e=mu(!1);return e=Mh.bind(null,ge,e.queue,!0,!1),At().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,a){var r=ge,u=At();if(Me){if(a===void 0)throw Error(l(407));a=a()}else{if(a=t(),Ie===null)throw Error(l(349));(Te&127)!==0||th(r,t,a)}u.memoizedState=a;var f={value:a,getSnapshot:t};return u.queue=f,yh(ih.bind(null,r,f,e),[e]),r.flags|=2048,ka(9,{destroy:void 0},nh.bind(null,r,f,a,t),null),a},useId:function(){var e=At(),t=Ie.identifierPrefix;if(Me){var a=xn,r=bn;a=(r&~(1<<32-tt(r)-1)).toString(32)+a,t="_"+t+"R_"+a,a=Xr++,0<a&&(t+="H"+a.toString(32)),t+="_"}else a=ob++,t="_"+t+"r_"+a.toString(32)+"_";return e.memoizedState=t},useHostTransitionStatus:Su,useFormState:dh,useActionState:dh,useOptimistic:function(e){var t=At();t.memoizedState=t.baseState=e;var a={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=a,t=wu.bind(null,ge,!0,a),a.dispatch=t,[e,t]},useMemoCache:du,useCacheRefresh:function(){return At().memoizedState=pb.bind(null,ge)},useEffectEvent:function(e){var t=At(),a={impl:e};return t.memoizedState=a,function(){if((_e&2)!==0)throw Error(l(440));return a.impl.apply(void 0,arguments)}}},Eu={readContext:yt,use:Qr,useCallback:Eh,useContext:yt,useEffect:yu,useImperativeHandle:wh,useInsertionEffect:bh,useLayoutEffect:xh,useMemo:Th,useReducer:Pr,useRef:gh,useState:function(){return Pr(jn)},useDebugValue:vu,useDeferredValue:function(e,t){var a=it();return Ah(a,Le.memoizedState,e,t)},useTransition:function(){var e=Pr(jn)[0],t=it().memoizedState;return[typeof e=="boolean"?e:Us(e),t]},useSyncExternalStore:eh,useId:Ch,useHostTransitionStatus:Su,useFormState:hh,useActionState:hh,useOptimistic:function(e,t){var a=it();return rh(a,Le,e,t)},useMemoCache:du,useCacheRefresh:Oh};Eu.useEffectEvent=vh;var kh={readContext:yt,use:Qr,useCallback:Eh,useContext:yt,useEffect:yu,useImperativeHandle:wh,useInsertionEffect:bh,useLayoutEffect:xh,useMemo:Th,useReducer:pu,useRef:gh,useState:function(){return pu(jn)},useDebugValue:vu,useDeferredValue:function(e,t){var a=it();return Le===null?bu(a,e,t):Ah(a,Le.memoizedState,e,t)},useTransition:function(){var e=pu(jn)[0],t=it().memoizedState;return[typeof e=="boolean"?e:Us(e),t]},useSyncExternalStore:eh,useId:Ch,useHostTransitionStatus:Su,useFormState:mh,useActionState:mh,useOptimistic:function(e,t){var a=it();return Le!==null?rh(a,Le,e,t):(a.baseState=e,[e,a.queue.dispatch])},useMemoCache:du,useCacheRefresh:Oh};kh.useEffectEvent=vh;function Tu(e,t,a,r){t=e.memoizedState,a=a(r,t),a=a==null?t:b({},t,a),e.memoizedState=a,e.lanes===0&&(e.updateQueue.baseState=a)}var Au={enqueueSetState:function(e,t,a){e=e._reactInternals;var r=Ft(),u=ri(r);u.payload=t,a!=null&&(u.callback=a),t=li(e,u,r),t!==null&&(Ut(t,e,r),Cs(t,e,r))},enqueueReplaceState:function(e,t,a){e=e._reactInternals;var r=Ft(),u=ri(r);u.tag=1,u.payload=t,a!=null&&(u.callback=a),t=li(e,u,r),t!==null&&(Ut(t,e,r),Cs(t,e,r))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var a=Ft(),r=ri(a);r.tag=2,t!=null&&(r.callback=t),t=li(e,r,a),t!==null&&(Ut(t,e,a),Cs(t,e,a))}};function Lh(e,t,a,r,u,f,p){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(r,f,p):t.prototype&&t.prototype.isPureReactComponent?!Ss(a,r)||!Ss(u,f):!0}function jh(e,t,a,r){e=t.state,typeof t.componentWillReceiveProps=="function"&&t.componentWillReceiveProps(a,r),typeof t.UNSAFE_componentWillReceiveProps=="function"&&t.UNSAFE_componentWillReceiveProps(a,r),t.state!==e&&Au.enqueueReplaceState(t,t.state,null)}function Pi(e,t){var a=t;if("ref"in t){a={};for(var r in t)r!=="ref"&&(a[r]=t[r])}if(e=e.defaultProps){a===t&&(a=b({},a));for(var u in e)a[u]===void 0&&(a[u]=e[u])}return a}function Bh(e){zr(e)}function Gh(e){console.error(e)}function $h(e){zr(e)}function el(e,t){try{var a=e.onUncaughtError;a(t.value,{componentStack:t.stack})}catch(r){setTimeout(function(){throw r})}}function Ih(e,t,a){try{var r=e.onCaughtError;r(a.value,{componentStack:a.stack,errorBoundary:t.tag===1?t.stateNode:null})}catch(u){setTimeout(function(){throw u})}}function Mu(e,t,a){return a=ri(a),a.tag=3,a.payload={element:null},a.callback=function(){el(e,t)},a}function Vh(e){return e=ri(e),e.tag=3,e}function Fh(e,t,a,r){var u=a.type.getDerivedStateFromError;if(typeof u=="function"){var f=r.value;e.payload=function(){return u(f)},e.callback=function(){Ih(t,a,r)}}var p=a.stateNode;p!==null&&typeof p.componentDidCatch=="function"&&(e.callback=function(){Ih(t,a,r),typeof u!="function"&&(hi===null?hi=new Set([this]):hi.add(this));var g=r.stack;this.componentDidCatch(r.value,{componentStack:g!==null?g:""})})}function gb(e,t,a,r,u){if(a.flags|=32768,r!==null&&typeof r=="object"&&typeof r.then=="function"){if(t=a.alternate,t!==null&&Ra(t,a,u,!0),a=Gt.current,a!==null){switch(a.tag){case 31:case 13:return an===null?dl():a.alternate===null&&Je===0&&(Je=3),a.flags&=-257,a.flags|=65536,a.lanes=u,r===Ir?a.flags|=16384:(t=a.updateQueue,t===null?a.updateQueue=new Set([r]):t.add(r),Zu(e,r,u)),!1;case 22:return a.flags|=65536,r===Ir?a.flags|=16384:(t=a.updateQueue,t===null?(t={transitions:null,markerInstances:null,retryQueue:new Set([r])},a.updateQueue=t):(a=t.retryQueue,a===null?t.retryQueue=new Set([r]):a.add(r)),Zu(e,r,u)),!1}throw Error(l(435,a.tag))}return Zu(e,r,u),dl(),!1}if(Me)return t=Gt.current,t!==null?((t.flags&65536)===0&&(t.flags|=256),t.flags|=65536,t.lanes=u,r!==qo&&(e=Error(l(422),{cause:r}),Ts(Jt(e,a)))):(r!==qo&&(t=Error(l(423),{cause:r}),Ts(Jt(t,a))),e=e.current.alternate,e.flags|=65536,u&=-u,e.lanes|=u,r=Jt(r,a),u=Mu(e.stateNode,r,u),nu(e,u),Je!==4&&(Je=2)),!1;var f=Error(l(520),{cause:r});if(f=Jt(f,a),Fs===null?Fs=[f]:Fs.push(f),Je!==4&&(Je=2),t===null)return!0;r=Jt(r,a),a=t;do{switch(a.tag){case 3:return a.flags|=65536,e=u&-u,a.lanes|=e,e=Mu(a.stateNode,r,e),nu(a,e),!1;case 1:if(t=a.type,f=a.stateNode,(a.flags&128)===0&&(typeof t.getDerivedStateFromError=="function"||f!==null&&typeof f.componentDidCatch=="function"&&(hi===null||!hi.has(f))))return a.flags|=65536,u&=-u,a.lanes|=u,u=Vh(u),Fh(u,e,a,r),nu(a,u),!1}a=a.return}while(a!==null);return!1}var Ru=Error(l(461)),lt=!1;function vt(e,t,a,r){t.child=e===null?Xd(t,null,a,r):Ki(t,e.child,a,r)}function Hh(e,t,a,r,u){a=a.render;var f=t.ref;if("ref"in r){var p={};for(var g in r)g!=="ref"&&(p[g]=r[g])}else p=r;return Hi(t),r=ou(e,t,a,p,f,u),g=uu(),e!==null&&!lt?(cu(e,t,u),Bn(e,t,u)):(Me&&g&&Fo(t),t.flags|=1,vt(e,t,r,u),t.child)}function qh(e,t,a,r,u){if(e===null){var f=a.type;return typeof f=="function"&&!$o(f)&&f.defaultProps===void 0&&a.compare===null?(t.tag=15,t.type=f,Yh(e,t,f,r,u)):(e=kr(a.type,null,r,t,t.mode,u),e.ref=t.ref,e.return=t,t.child=e)}if(f=e.child,!ku(e,u)){var p=f.memoizedProps;if(a=a.compare,a=a!==null?a:Ss,a(p,r)&&e.ref===t.ref)return Bn(e,t,u)}return t.flags|=1,e=_n(f,r),e.ref=t.ref,e.return=t,t.child=e}function Yh(e,t,a,r,u){if(e!==null){var f=e.memoizedProps;if(Ss(f,r)&&e.ref===t.ref)if(lt=!1,t.pendingProps=r=f,ku(e,u))(e.flags&131072)!==0&&(lt=!0);else return t.lanes=e.lanes,Bn(e,t,u)}return Du(e,t,a,r,u)}function Xh(e,t,a,r){var u=r.children,f=e!==null?e.memoizedState:null;if(e===null&&t.stateNode===null&&(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),r.mode==="hidden"){if((t.flags&128)!==0){if(f=f!==null?f.baseLanes|a:a,e!==null){for(r=t.child=e.child,u=0;r!==null;)u=u|r.lanes|r.childLanes,r=r.sibling;r=u&~f}else r=0,t.child=null;return Kh(e,t,f,a,r)}if((a&536870912)!==0)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&Gr(t,f!==null?f.cachePool:null),f!==null?Pd(t,f):au(),Zd(t);else return r=t.lanes=536870912,Kh(e,t,f!==null?f.baseLanes|a:a,a,r)}else f!==null?(Gr(t,f.cachePool),Pd(t,f),ui(),t.memoizedState=null):(e!==null&&Gr(t,null),au(),ui());return vt(e,t,u,a),t.child}function Ls(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function Kh(e,t,a,r,u){var f=Wo();return f=f===null?null:{parent:st._currentValue,pool:f},t.memoizedState={baseLanes:a,cachePool:f},e!==null&&Gr(t,null),au(),Zd(t),e!==null&&Ra(e,t,r,!0),t.childLanes=u,null}function tl(e,t){return t=il({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function Qh(e,t,a){return Ki(t,e.child,null,a),e=tl(t,t.pendingProps),e.flags|=2,$t(t),t.memoizedState=null,e}function yb(e,t,a){var r=t.pendingProps,u=(t.flags&128)!==0;if(t.flags&=-129,e===null){if(Me){if(r.mode==="hidden")return e=tl(t,r),t.lanes=536870912,Ls(null,e);if(ru(t),(e=Fe)?(e=lm(e,nn),e=e!==null&&e.data==="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:ti!==null?{id:bn,overflow:xn}:null,retryLane:536870912,hydrationErrors:null},a=_d(e),a.return=t,t.child=a,gt=t,Fe=null)):e=null,e===null)throw ii(t);return t.lanes=536870912,null}return tl(t,r)}var f=e.memoizedState;if(f!==null){var p=f.dehydrated;if(ru(t),u)if(t.flags&256)t.flags&=-257,t=Qh(e,t,a);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(l(558));else if(lt||Ra(e,t,a,!1),u=(a&e.childLanes)!==0,lt||u){if(r=Ie,r!==null&&(p=Gf(r,a),p!==0&&p!==f.retryLane))throw f.retryLane=p,$i(e,p),Ut(r,e,p),Ru;dl(),t=Qh(e,t,a)}else e=f.treeContext,Fe=sn(p.nextSibling),gt=t,Me=!0,ni=null,nn=!1,e!==null&&kd(t,e),t=tl(t,r),t.flags|=4096;return t}return e=_n(e.child,{mode:r.mode,children:r.children}),e.ref=t.ref,t.child=e,e.return=t,e}function nl(e,t){var a=t.ref;if(a===null)e!==null&&e.ref!==null&&(t.flags|=4194816);else{if(typeof a!="function"&&typeof a!="object")throw Error(l(284));(e===null||e.ref!==a)&&(t.flags|=4194816)}}function Du(e,t,a,r,u){return Hi(t),a=ou(e,t,a,r,void 0,u),r=uu(),e!==null&&!lt?(cu(e,t,u),Bn(e,t,u)):(Me&&r&&Fo(t),t.flags|=1,vt(e,t,a,u),t.child)}function Ph(e,t,a,r,u,f){return Hi(t),t.updateQueue=null,a=Jd(t,r,a,u),Wd(e),r=uu(),e!==null&&!lt?(cu(e,t,f),Bn(e,t,f)):(Me&&r&&Fo(t),t.flags|=1,vt(e,t,a,f),t.child)}function Zh(e,t,a,r,u){if(Hi(t),t.stateNode===null){var f=Ea,p=a.contextType;typeof p=="object"&&p!==null&&(f=yt(p)),f=new a(r,f),t.memoizedState=f.state!==null&&f.state!==void 0?f.state:null,f.updater=Au,t.stateNode=f,f._reactInternals=t,f=t.stateNode,f.props=r,f.state=t.memoizedState,f.refs={},eu(t),p=a.contextType,f.context=typeof p=="object"&&p!==null?yt(p):Ea,f.state=t.memoizedState,p=a.getDerivedStateFromProps,typeof p=="function"&&(Tu(t,a,p,r),f.state=t.memoizedState),typeof a.getDerivedStateFromProps=="function"||typeof f.getSnapshotBeforeUpdate=="function"||typeof f.UNSAFE_componentWillMount!="function"&&typeof f.componentWillMount!="function"||(p=f.state,typeof f.componentWillMount=="function"&&f.componentWillMount(),typeof f.UNSAFE_componentWillMount=="function"&&f.UNSAFE_componentWillMount(),p!==f.state&&Au.enqueueReplaceState(f,f.state,null),zs(t,r,f,u),Os(),f.state=t.memoizedState),typeof f.componentDidMount=="function"&&(t.flags|=4194308),r=!0}else if(e===null){f=t.stateNode;var g=t.memoizedProps,x=Pi(a,g);f.props=x;var O=f.context,G=a.contextType;p=Ea,typeof G=="object"&&G!==null&&(p=yt(G));var I=a.getDerivedStateFromProps;G=typeof I=="function"||typeof f.getSnapshotBeforeUpdate=="function",g=t.pendingProps!==g,G||typeof f.UNSAFE_componentWillReceiveProps!="function"&&typeof f.componentWillReceiveProps!="function"||(g||O!==p)&&jh(t,f,r,p),si=!1;var _=t.memoizedState;f.state=_,zs(t,r,f,u),Os(),O=t.memoizedState,g||_!==O||si?(typeof I=="function"&&(Tu(t,a,I,r),O=t.memoizedState),(x=si||Lh(t,a,x,r,_,O,p))?(G||typeof f.UNSAFE_componentWillMount!="function"&&typeof f.componentWillMount!="function"||(typeof f.componentWillMount=="function"&&f.componentWillMount(),typeof f.UNSAFE_componentWillMount=="function"&&f.UNSAFE_componentWillMount()),typeof f.componentDidMount=="function"&&(t.flags|=4194308)):(typeof f.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=O),f.props=r,f.state=O,f.context=p,r=x):(typeof f.componentDidMount=="function"&&(t.flags|=4194308),r=!1)}else{f=t.stateNode,tu(e,t),p=t.memoizedProps,G=Pi(a,p),f.props=G,I=t.pendingProps,_=f.context,O=a.contextType,x=Ea,typeof O=="object"&&O!==null&&(x=yt(O)),g=a.getDerivedStateFromProps,(O=typeof g=="function"||typeof f.getSnapshotBeforeUpdate=="function")||typeof f.UNSAFE_componentWillReceiveProps!="function"&&typeof f.componentWillReceiveProps!="function"||(p!==I||_!==x)&&jh(t,f,r,x),si=!1,_=t.memoizedState,f.state=_,zs(t,r,f,u),Os();var U=t.memoizedState;p!==I||_!==U||si||e!==null&&e.dependencies!==null&&jr(e.dependencies)?(typeof g=="function"&&(Tu(t,a,g,r),U=t.memoizedState),(G=si||Lh(t,a,G,r,_,U,x)||e!==null&&e.dependencies!==null&&jr(e.dependencies))?(O||typeof f.UNSAFE_componentWillUpdate!="function"&&typeof f.componentWillUpdate!="function"||(typeof f.componentWillUpdate=="function"&&f.componentWillUpdate(r,U,x),typeof f.UNSAFE_componentWillUpdate=="function"&&f.UNSAFE_componentWillUpdate(r,U,x)),typeof f.componentDidUpdate=="function"&&(t.flags|=4),typeof f.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof f.componentDidUpdate!="function"||p===e.memoizedProps&&_===e.memoizedState||(t.flags|=4),typeof f.getSnapshotBeforeUpdate!="function"||p===e.memoizedProps&&_===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=U),f.props=r,f.state=U,f.context=x,r=G):(typeof f.componentDidUpdate!="function"||p===e.memoizedProps&&_===e.memoizedState||(t.flags|=4),typeof f.getSnapshotBeforeUpdate!="function"||p===e.memoizedProps&&_===e.memoizedState||(t.flags|=1024),r=!1)}return f=r,nl(e,t),r=(t.flags&128)!==0,f||r?(f=t.stateNode,a=r&&typeof a.getDerivedStateFromError!="function"?null:f.render(),t.flags|=1,e!==null&&r?(t.child=Ki(t,e.child,null,u),t.child=Ki(t,null,a,u)):vt(e,t,a,u),t.memoizedState=f.state,e=t.child):e=Bn(e,t,u),e}function Wh(e,t,a,r){return Vi(),t.flags|=256,vt(e,t,a,r),t.child}var Cu={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Ou(e){return{baseLanes:e,cachePool:Id()}}function zu(e,t,a){return e=e!==null?e.childLanes&~a:0,t&&(e|=Vt),e}function Jh(e,t,a){var r=t.pendingProps,u=!1,f=(t.flags&128)!==0,p;if((p=f)||(p=e!==null&&e.memoizedState===null?!1:(nt.current&2)!==0),p&&(u=!0,t.flags&=-129),p=(t.flags&32)!==0,t.flags&=-33,e===null){if(Me){if(u?oi(t):ui(),(e=Fe)?(e=lm(e,nn),e=e!==null&&e.data!=="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:ti!==null?{id:bn,overflow:xn}:null,retryLane:536870912,hydrationErrors:null},a=_d(e),a.return=t,t.child=a,gt=t,Fe=null)):e=null,e===null)throw ii(t);return hc(e)?t.lanes=32:t.lanes=536870912,null}var g=r.children;return r=r.fallback,u?(ui(),u=t.mode,g=il({mode:"hidden",children:g},u),r=Ii(r,u,a,null),g.return=t,r.return=t,g.sibling=r,t.child=g,r=t.child,r.memoizedState=Ou(a),r.childLanes=zu(e,p,a),t.memoizedState=Cu,Ls(null,r)):(oi(t),_u(t,g))}var x=e.memoizedState;if(x!==null&&(g=x.dehydrated,g!==null)){if(f)t.flags&256?(oi(t),t.flags&=-257,t=Uu(e,t,a)):t.memoizedState!==null?(ui(),t.child=e.child,t.flags|=128,t=null):(ui(),g=r.fallback,u=t.mode,r=il({mode:"visible",children:r.children},u),g=Ii(g,u,a,null),g.flags|=2,r.return=t,g.return=t,r.sibling=g,t.child=r,Ki(t,e.child,null,a),r=t.child,r.memoizedState=Ou(a),r.childLanes=zu(e,p,a),t.memoizedState=Cu,t=Ls(null,r));else if(oi(t),hc(g)){if(p=g.nextSibling&&g.nextSibling.dataset,p)var O=p.dgst;p=O,r=Error(l(419)),r.stack="",r.digest=p,Ts({value:r,source:null,stack:null}),t=Uu(e,t,a)}else if(lt||Ra(e,t,a,!1),p=(a&e.childLanes)!==0,lt||p){if(p=Ie,p!==null&&(r=Gf(p,a),r!==0&&r!==x.retryLane))throw x.retryLane=r,$i(e,r),Ut(p,e,r),Ru;dc(g)||dl(),t=Uu(e,t,a)}else dc(g)?(t.flags|=192,t.child=e.child,t=null):(e=x.treeContext,Fe=sn(g.nextSibling),gt=t,Me=!0,ni=null,nn=!1,e!==null&&kd(t,e),t=_u(t,r.children),t.flags|=4096);return t}return u?(ui(),g=r.fallback,u=t.mode,x=e.child,O=x.sibling,r=_n(x,{mode:"hidden",children:r.children}),r.subtreeFlags=x.subtreeFlags&65011712,O!==null?g=_n(O,g):(g=Ii(g,u,a,null),g.flags|=2),g.return=t,r.return=t,r.sibling=g,t.child=r,Ls(null,r),r=t.child,g=e.child.memoizedState,g===null?g=Ou(a):(u=g.cachePool,u!==null?(x=st._currentValue,u=u.parent!==x?{parent:x,pool:x}:u):u=Id(),g={baseLanes:g.baseLanes|a,cachePool:u}),r.memoizedState=g,r.childLanes=zu(e,p,a),t.memoizedState=Cu,Ls(e.child,r)):(oi(t),a=e.child,e=a.sibling,a=_n(a,{mode:"visible",children:r.children}),a.return=t,a.sibling=null,e!==null&&(p=t.deletions,p===null?(t.deletions=[e],t.flags|=16):p.push(e)),t.child=a,t.memoizedState=null,a)}function _u(e,t){return t=il({mode:"visible",children:t},e.mode),t.return=e,e.child=t}function il(e,t){return e=Bt(22,e,null,t),e.lanes=0,e}function Uu(e,t,a){return Ki(t,e.child,null,a),e=_u(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function ep(e,t,a){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),Ko(e.return,t,a)}function Nu(e,t,a,r,u,f){var p=e.memoizedState;p===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:a,tailMode:u,treeForkCount:f}:(p.isBackwards=t,p.rendering=null,p.renderingStartTime=0,p.last=r,p.tail=a,p.tailMode=u,p.treeForkCount=f)}function tp(e,t,a){var r=t.pendingProps,u=r.revealOrder,f=r.tail;r=r.children;var p=nt.current,g=(p&2)!==0;if(g?(p=p&1|2,t.flags|=128):p&=1,H(nt,p),vt(e,t,r,a),r=Me?Es:0,!g&&e!==null&&(e.flags&128)!==0)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&ep(e,a,t);else if(e.tag===19)ep(e,a,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;e.sibling===null;){if(e.return===null||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}switch(u){case"forwards":for(a=t.child,u=null;a!==null;)e=a.alternate,e!==null&&qr(e)===null&&(u=a),a=a.sibling;a=u,a===null?(u=t.child,t.child=null):(u=a.sibling,a.sibling=null),Nu(t,!1,u,a,f,r);break;case"backwards":case"unstable_legacy-backwards":for(a=null,u=t.child,t.child=null;u!==null;){if(e=u.alternate,e!==null&&qr(e)===null){t.child=u;break}e=u.sibling,u.sibling=a,a=u,u=e}Nu(t,!0,a,null,f,r);break;case"together":Nu(t,!1,null,null,void 0,r);break;default:t.memoizedState=null}return t.child}function Bn(e,t,a){if(e!==null&&(t.dependencies=e.dependencies),di|=t.lanes,(a&t.childLanes)===0)if(e!==null){if(Ra(e,t,a,!1),(a&t.childLanes)===0)return null}else return null;if(e!==null&&t.child!==e.child)throw Error(l(153));if(t.child!==null){for(e=t.child,a=_n(e,e.pendingProps),t.child=a,a.return=t;e.sibling!==null;)e=e.sibling,a=a.sibling=_n(e,e.pendingProps),a.return=t;a.sibling=null}return t.child}function ku(e,t){return(e.lanes&t)!==0?!0:(e=e.dependencies,!!(e!==null&&jr(e)))}function vb(e,t,a){switch(t.tag){case 3:$e(t,t.stateNode.containerInfo),ai(t,st,e.memoizedState.cache),Vi();break;case 27:case 5:fn(t);break;case 4:$e(t,t.stateNode.containerInfo);break;case 10:ai(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,ru(t),null;break;case 13:var r=t.memoizedState;if(r!==null)return r.dehydrated!==null?(oi(t),t.flags|=128,null):(a&t.child.childLanes)!==0?Jh(e,t,a):(oi(t),e=Bn(e,t,a),e!==null?e.sibling:null);oi(t);break;case 19:var u=(e.flags&128)!==0;if(r=(a&t.childLanes)!==0,r||(Ra(e,t,a,!1),r=(a&t.childLanes)!==0),u){if(r)return tp(e,t,a);t.flags|=128}if(u=t.memoizedState,u!==null&&(u.rendering=null,u.tail=null,u.lastEffect=null),H(nt,nt.current),r)break;return null;case 22:return t.lanes=0,Xh(e,t,a,t.pendingProps);case 24:ai(t,st,e.memoizedState.cache)}return Bn(e,t,a)}function np(e,t,a){if(e!==null)if(e.memoizedProps!==t.pendingProps)lt=!0;else{if(!ku(e,a)&&(t.flags&128)===0)return lt=!1,vb(e,t,a);lt=(e.flags&131072)!==0}else lt=!1,Me&&(t.flags&1048576)!==0&&Nd(t,Es,t.index);switch(t.lanes=0,t.tag){case 16:e:{var r=t.pendingProps;if(e=Yi(t.elementType),t.type=e,typeof e=="function")$o(e)?(r=Pi(e,r),t.tag=1,t=Zh(null,t,e,r,a)):(t.tag=0,t=Du(null,t,e,r,a));else{if(e!=null){var u=e.$$typeof;if(u===V){t.tag=11,t=Hh(null,t,e,r,a);break e}else if(u===A){t.tag=14,t=qh(null,t,e,r,a);break e}}throw t=de(e)||e,Error(l(306,t,""))}}return t;case 0:return Du(e,t,t.type,t.pendingProps,a);case 1:return r=t.type,u=Pi(r,t.pendingProps),Zh(e,t,r,u,a);case 3:e:{if($e(t,t.stateNode.containerInfo),e===null)throw Error(l(387));r=t.pendingProps;var f=t.memoizedState;u=f.element,tu(e,t),zs(t,r,null,a);var p=t.memoizedState;if(r=p.cache,ai(t,st,r),r!==f.cache&&Qo(t,[st],a,!0),Os(),r=p.element,f.isDehydrated)if(f={element:r,isDehydrated:!1,cache:p.cache},t.updateQueue.baseState=f,t.memoizedState=f,t.flags&256){t=Wh(e,t,r,a);break e}else if(r!==u){u=Jt(Error(l(424)),t),Ts(u),t=Wh(e,t,r,a);break e}else for(e=t.stateNode.containerInfo,e.nodeType===9?e=e.body:e=e.nodeName==="HTML"?e.ownerDocument.body:e,Fe=sn(e.firstChild),gt=t,Me=!0,ni=null,nn=!0,a=Xd(t,null,r,a),t.child=a;a;)a.flags=a.flags&-3|4096,a=a.sibling;else{if(Vi(),r===u){t=Bn(e,t,a);break e}vt(e,t,r,a)}t=t.child}return t;case 26:return nl(e,t),e===null?(a=hm(t.type,null,t.pendingProps,null))?t.memoizedState=a:Me||(a=t.type,e=t.pendingProps,r=bl(he.current).createElement(a),r[mt]=t,r[Rt]=e,bt(r,a,e),dt(r),t.stateNode=r):t.memoizedState=hm(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return fn(t),e===null&&Me&&(r=t.stateNode=cm(t.type,t.pendingProps,he.current),gt=t,nn=!0,u=Fe,yi(t.type)?(pc=u,Fe=sn(r.firstChild)):Fe=u),vt(e,t,t.pendingProps.children,a),nl(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&Me&&((u=r=Fe)&&(r=Kb(r,t.type,t.pendingProps,nn),r!==null?(t.stateNode=r,gt=t,Fe=sn(r.firstChild),nn=!1,u=!0):u=!1),u||ii(t)),fn(t),u=t.type,f=t.pendingProps,p=e!==null?e.memoizedProps:null,r=f.children,uc(u,f)?r=null:p!==null&&uc(u,p)&&(t.flags|=32),t.memoizedState!==null&&(u=ou(e,t,ub,null,null,a),Zs._currentValue=u),nl(e,t),vt(e,t,r,a),t.child;case 6:return e===null&&Me&&((e=a=Fe)&&(a=Qb(a,t.pendingProps,nn),a!==null?(t.stateNode=a,gt=t,Fe=null,e=!0):e=!1),e||ii(t)),null;case 13:return Jh(e,t,a);case 4:return $e(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=Ki(t,null,r,a):vt(e,t,r,a),t.child;case 11:return Hh(e,t,t.type,t.pendingProps,a);case 7:return vt(e,t,t.pendingProps,a),t.child;case 8:return vt(e,t,t.pendingProps.children,a),t.child;case 12:return vt(e,t,t.pendingProps.children,a),t.child;case 10:return r=t.pendingProps,ai(t,t.type,r.value),vt(e,t,r.children,a),t.child;case 9:return u=t.type._context,r=t.pendingProps.children,Hi(t),u=yt(u),r=r(u),t.flags|=1,vt(e,t,r,a),t.child;case 14:return qh(e,t,t.type,t.pendingProps,a);case 15:return Yh(e,t,t.type,t.pendingProps,a);case 19:return tp(e,t,a);case 31:return yb(e,t,a);case 22:return Xh(e,t,a,t.pendingProps);case 24:return Hi(t),r=yt(st),e===null?(u=Wo(),u===null&&(u=Ie,f=Po(),u.pooledCache=f,f.refCount++,f!==null&&(u.pooledCacheLanes|=a),u=f),t.memoizedState={parent:r,cache:u},eu(t),ai(t,st,u)):((e.lanes&a)!==0&&(tu(e,t),zs(t,null,null,a),Os()),u=e.memoizedState,f=t.memoizedState,u.parent!==r?(u={parent:r,cache:r},t.memoizedState=u,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=u),ai(t,st,r)):(r=f.cache,ai(t,st,r),r!==u.cache&&Qo(t,[st],a,!0))),vt(e,t,t.pendingProps.children,a),t.child;case 29:throw t.pendingProps}throw Error(l(156,t.tag))}function Gn(e){e.flags|=4}function Lu(e,t,a,r,u){if((t=(e.mode&32)!==0)&&(t=!1),t){if(e.flags|=16777216,(u&335544128)===u)if(e.stateNode.complete)e.flags|=8192;else if(Cp())e.flags|=8192;else throw Xi=Ir,Jo}else e.flags&=-16777217}function ip(e,t){if(t.type!=="stylesheet"||(t.state.loading&4)!==0)e.flags&=-16777217;else if(e.flags|=16777216,!vm(t))if(Cp())e.flags|=8192;else throw Xi=Ir,Jo}function al(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag!==22?Lf():536870912,e.lanes|=t,Ga|=t)}function js(e,t){if(!Me)switch(e.tailMode){case"hidden":t=e.tail;for(var a=null;t!==null;)t.alternate!==null&&(a=t),t=t.sibling;a===null?e.tail=null:a.sibling=null;break;case"collapsed":a=e.tail;for(var r=null;a!==null;)a.alternate!==null&&(r=a),a=a.sibling;r===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:r.sibling=null}}function He(e){var t=e.alternate!==null&&e.alternate.child===e.child,a=0,r=0;if(t)for(var u=e.child;u!==null;)a|=u.lanes|u.childLanes,r|=u.subtreeFlags&65011712,r|=u.flags&65011712,u.return=e,u=u.sibling;else for(u=e.child;u!==null;)a|=u.lanes|u.childLanes,r|=u.subtreeFlags,r|=u.flags,u.return=e,u=u.sibling;return e.subtreeFlags|=r,e.childLanes=a,t}function bb(e,t,a){var r=t.pendingProps;switch(Ho(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return He(t),null;case 1:return He(t),null;case 3:return a=t.stateNode,r=null,e!==null&&(r=e.memoizedState.cache),t.memoizedState.cache!==r&&(t.flags|=2048),kn(st),Re(),a.pendingContext&&(a.context=a.pendingContext,a.pendingContext=null),(e===null||e.child===null)&&(Ma(t)?Gn(t):e===null||e.memoizedState.isDehydrated&&(t.flags&256)===0||(t.flags|=1024,Yo())),He(t),null;case 26:var u=t.type,f=t.memoizedState;return e===null?(Gn(t),f!==null?(He(t),ip(t,f)):(He(t),Lu(t,u,null,r,a))):f?f!==e.memoizedState?(Gn(t),He(t),ip(t,f)):(He(t),t.flags&=-16777217):(e=e.memoizedProps,e!==r&&Gn(t),He(t),Lu(t,u,e,r,a)),null;case 27:if(Mn(t),a=he.current,u=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&Gn(t);else{if(!r){if(t.stateNode===null)throw Error(l(166));return He(t),null}e=J.current,Ma(t)?Ld(t):(e=cm(u,r,a),t.stateNode=e,Gn(t))}return He(t),null;case 5:if(Mn(t),u=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&Gn(t);else{if(!r){if(t.stateNode===null)throw Error(l(166));return He(t),null}if(f=J.current,Ma(t))Ld(t);else{var p=bl(he.current);switch(f){case 1:f=p.createElementNS("http://www.w3.org/2000/svg",u);break;case 2:f=p.createElementNS("http://www.w3.org/1998/Math/MathML",u);break;default:switch(u){case"svg":f=p.createElementNS("http://www.w3.org/2000/svg",u);break;case"math":f=p.createElementNS("http://www.w3.org/1998/Math/MathML",u);break;case"script":f=p.createElement("div"),f.innerHTML="<script><\/script>",f=f.removeChild(f.firstChild);break;case"select":f=typeof r.is=="string"?p.createElement("select",{is:r.is}):p.createElement("select"),r.multiple?f.multiple=!0:r.size&&(f.size=r.size);break;default:f=typeof r.is=="string"?p.createElement(u,{is:r.is}):p.createElement(u)}}f[mt]=t,f[Rt]=r;e:for(p=t.child;p!==null;){if(p.tag===5||p.tag===6)f.appendChild(p.stateNode);else if(p.tag!==4&&p.tag!==27&&p.child!==null){p.child.return=p,p=p.child;continue}if(p===t)break e;for(;p.sibling===null;){if(p.return===null||p.return===t)break e;p=p.return}p.sibling.return=p.return,p=p.sibling}t.stateNode=f;e:switch(bt(f,u,r),u){case"button":case"input":case"select":case"textarea":r=!!r.autoFocus;break e;case"img":r=!0;break e;default:r=!1}r&&Gn(t)}}return He(t),Lu(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,a),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==r&&Gn(t);else{if(typeof r!="string"&&t.stateNode===null)throw Error(l(166));if(e=he.current,Ma(t)){if(e=t.stateNode,a=t.memoizedProps,r=null,u=gt,u!==null)switch(u.tag){case 27:case 5:r=u.memoizedProps}e[mt]=t,e=!!(e.nodeValue===a||r!==null&&r.suppressHydrationWarning===!0||Jp(e.nodeValue,a)),e||ii(t,!0)}else e=bl(e).createTextNode(r),e[mt]=t,t.stateNode=e}return He(t),null;case 31:if(a=t.memoizedState,e===null||e.memoizedState!==null){if(r=Ma(t),a!==null){if(e===null){if(!r)throw Error(l(318));if(e=t.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(l(557));e[mt]=t}else Vi(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;He(t),e=!1}else a=Yo(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=a),e=!0;if(!e)return t.flags&256?($t(t),t):($t(t),null);if((t.flags&128)!==0)throw Error(l(558))}return He(t),null;case 13:if(r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(u=Ma(t),r!==null&&r.dehydrated!==null){if(e===null){if(!u)throw Error(l(318));if(u=t.memoizedState,u=u!==null?u.dehydrated:null,!u)throw Error(l(317));u[mt]=t}else Vi(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;He(t),u=!1}else u=Yo(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=u),u=!0;if(!u)return t.flags&256?($t(t),t):($t(t),null)}return $t(t),(t.flags&128)!==0?(t.lanes=a,t):(a=r!==null,e=e!==null&&e.memoizedState!==null,a&&(r=t.child,u=null,r.alternate!==null&&r.alternate.memoizedState!==null&&r.alternate.memoizedState.cachePool!==null&&(u=r.alternate.memoizedState.cachePool.pool),f=null,r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(f=r.memoizedState.cachePool.pool),f!==u&&(r.flags|=2048)),a!==e&&a&&(t.child.flags|=8192),al(t,t.updateQueue),He(t),null);case 4:return Re(),e===null&&ac(t.stateNode.containerInfo),He(t),null;case 10:return kn(t.type),He(t),null;case 19:if(k(nt),r=t.memoizedState,r===null)return He(t),null;if(u=(t.flags&128)!==0,f=r.rendering,f===null)if(u)js(r,!1);else{if(Je!==0||e!==null&&(e.flags&128)!==0)for(e=t.child;e!==null;){if(f=qr(e),f!==null){for(t.flags|=128,js(r,!1),e=f.updateQueue,t.updateQueue=e,al(t,e),t.subtreeFlags=0,e=a,a=t.child;a!==null;)zd(a,e),a=a.sibling;return H(nt,nt.current&1|2),Me&&Un(t,r.treeForkCount),t.child}e=e.sibling}r.tail!==null&&Ve()>ul&&(t.flags|=128,u=!0,js(r,!1),t.lanes=4194304)}else{if(!u)if(e=qr(f),e!==null){if(t.flags|=128,u=!0,e=e.updateQueue,t.updateQueue=e,al(t,e),js(r,!0),r.tail===null&&r.tailMode==="hidden"&&!f.alternate&&!Me)return He(t),null}else 2*Ve()-r.renderingStartTime>ul&&a!==536870912&&(t.flags|=128,u=!0,js(r,!1),t.lanes=4194304);r.isBackwards?(f.sibling=t.child,t.child=f):(e=r.last,e!==null?e.sibling=f:t.child=f,r.last=f)}return r.tail!==null?(e=r.tail,r.rendering=e,r.tail=e.sibling,r.renderingStartTime=Ve(),e.sibling=null,a=nt.current,H(nt,u?a&1|2:a&1),Me&&Un(t,r.treeForkCount),e):(He(t),null);case 22:case 23:return $t(t),su(),r=t.memoizedState!==null,e!==null?e.memoizedState!==null!==r&&(t.flags|=8192):r&&(t.flags|=8192),r?(a&536870912)!==0&&(t.flags&128)===0&&(He(t),t.subtreeFlags&6&&(t.flags|=8192)):He(t),a=t.updateQueue,a!==null&&al(t,a.retryQueue),a=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(a=e.memoizedState.cachePool.pool),r=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(r=t.memoizedState.cachePool.pool),r!==a&&(t.flags|=2048),e!==null&&k(qi),null;case 24:return a=null,e!==null&&(a=e.memoizedState.cache),t.memoizedState.cache!==a&&(t.flags|=2048),kn(st),He(t),null;case 25:return null;case 30:return null}throw Error(l(156,t.tag))}function xb(e,t){switch(Ho(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return kn(st),Re(),e=t.flags,(e&65536)!==0&&(e&128)===0?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return Mn(t),null;case 31:if(t.memoizedState!==null){if($t(t),t.alternate===null)throw Error(l(340));Vi()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if($t(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(l(340));Vi()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return k(nt),null;case 4:return Re(),null;case 10:return kn(t.type),null;case 22:case 23:return $t(t),su(),e!==null&&k(qi),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return kn(st),null;case 25:return null;default:return null}}function ap(e,t){switch(Ho(t),t.tag){case 3:kn(st),Re();break;case 26:case 27:case 5:Mn(t);break;case 4:Re();break;case 31:t.memoizedState!==null&&$t(t);break;case 13:$t(t);break;case 19:k(nt);break;case 10:kn(t.type);break;case 22:case 23:$t(t),su(),e!==null&&k(qi);break;case 24:kn(st)}}function Bs(e,t){try{var a=t.updateQueue,r=a!==null?a.lastEffect:null;if(r!==null){var u=r.next;a=u;do{if((a.tag&e)===e){r=void 0;var f=a.create,p=a.inst;r=f(),p.destroy=r}a=a.next}while(a!==u)}}catch(g){ke(t,t.return,g)}}function ci(e,t,a){try{var r=t.updateQueue,u=r!==null?r.lastEffect:null;if(u!==null){var f=u.next;r=f;do{if((r.tag&e)===e){var p=r.inst,g=p.destroy;if(g!==void 0){p.destroy=void 0,u=t;var x=a,O=g;try{O()}catch(G){ke(u,x,G)}}}r=r.next}while(r!==f)}}catch(G){ke(t,t.return,G)}}function sp(e){var t=e.updateQueue;if(t!==null){var a=e.stateNode;try{Qd(t,a)}catch(r){ke(e,e.return,r)}}}function rp(e,t,a){a.props=Pi(e.type,e.memoizedProps),a.state=e.memoizedState;try{a.componentWillUnmount()}catch(r){ke(e,t,r)}}function Gs(e,t){try{var a=e.ref;if(a!==null){switch(e.tag){case 26:case 27:case 5:var r=e.stateNode;break;case 30:r=e.stateNode;break;default:r=e.stateNode}typeof a=="function"?e.refCleanup=a(r):a.current=r}}catch(u){ke(e,t,u)}}function Sn(e,t){var a=e.ref,r=e.refCleanup;if(a!==null)if(typeof r=="function")try{r()}catch(u){ke(e,t,u)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof a=="function")try{a(null)}catch(u){ke(e,t,u)}else a.current=null}function lp(e){var t=e.type,a=e.memoizedProps,r=e.stateNode;try{e:switch(t){case"button":case"input":case"select":case"textarea":a.autoFocus&&r.focus();break e;case"img":a.src?r.src=a.src:a.srcSet&&(r.srcset=a.srcSet)}}catch(u){ke(e,e.return,u)}}function ju(e,t,a){try{var r=e.stateNode;Vb(r,e.type,a,t),r[Rt]=t}catch(u){ke(e,e.return,u)}}function op(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&yi(e.type)||e.tag===4}function Bu(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||op(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.tag===27&&yi(e.type)||e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function Gu(e,t,a){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?(a.nodeType===9?a.body:a.nodeName==="HTML"?a.ownerDocument.body:a).insertBefore(e,t):(t=a.nodeType===9?a.body:a.nodeName==="HTML"?a.ownerDocument.body:a,t.appendChild(e),a=a._reactRootContainer,a!=null||t.onclick!==null||(t.onclick=On));else if(r!==4&&(r===27&&yi(e.type)&&(a=e.stateNode,t=null),e=e.child,e!==null))for(Gu(e,t,a),e=e.sibling;e!==null;)Gu(e,t,a),e=e.sibling}function sl(e,t,a){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?a.insertBefore(e,t):a.appendChild(e);else if(r!==4&&(r===27&&yi(e.type)&&(a=e.stateNode),e=e.child,e!==null))for(sl(e,t,a),e=e.sibling;e!==null;)sl(e,t,a),e=e.sibling}function up(e){var t=e.stateNode,a=e.memoizedProps;try{for(var r=e.type,u=t.attributes;u.length;)t.removeAttributeNode(u[0]);bt(t,r,a),t[mt]=e,t[Rt]=a}catch(f){ke(e,e.return,f)}}var $n=!1,ot=!1,$u=!1,cp=typeof WeakSet=="function"?WeakSet:Set,ht=null;function Sb(e,t){if(e=e.containerInfo,lc=Ml,e=wd(e),Uo(e)){if("selectionStart"in e)var a={start:e.selectionStart,end:e.selectionEnd};else e:{a=(a=e.ownerDocument)&&a.defaultView||window;var r=a.getSelection&&a.getSelection();if(r&&r.rangeCount!==0){a=r.anchorNode;var u=r.anchorOffset,f=r.focusNode;r=r.focusOffset;try{a.nodeType,f.nodeType}catch{a=null;break e}var p=0,g=-1,x=-1,O=0,G=0,I=e,_=null;t:for(;;){for(var U;I!==a||u!==0&&I.nodeType!==3||(g=p+u),I!==f||r!==0&&I.nodeType!==3||(x=p+r),I.nodeType===3&&(p+=I.nodeValue.length),(U=I.firstChild)!==null;)_=I,I=U;for(;;){if(I===e)break t;if(_===a&&++O===u&&(g=p),_===f&&++G===r&&(x=p),(U=I.nextSibling)!==null)break;I=_,_=I.parentNode}I=U}a=g===-1||x===-1?null:{start:g,end:x}}else a=null}a=a||{start:0,end:0}}else a=null;for(oc={focusedElem:e,selectionRange:a},Ml=!1,ht=t;ht!==null;)if(t=ht,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,ht=e;else for(;ht!==null;){switch(t=ht,f=t.alternate,e=t.flags,t.tag){case 0:if((e&4)!==0&&(e=t.updateQueue,e=e!==null?e.events:null,e!==null))for(a=0;a<e.length;a++)u=e[a],u.ref.impl=u.nextImpl;break;case 11:case 15:break;case 1:if((e&1024)!==0&&f!==null){e=void 0,a=t,u=f.memoizedProps,f=f.memoizedState,r=a.stateNode;try{var ie=Pi(a.type,u);e=r.getSnapshotBeforeUpdate(ie,f),r.__reactInternalSnapshotBeforeUpdate=e}catch(fe){ke(a,a.return,fe)}}break;case 3:if((e&1024)!==0){if(e=t.stateNode.containerInfo,a=e.nodeType,a===9)fc(e);else if(a===1)switch(e.nodeName){case"HEAD":case"HTML":case"BODY":fc(e);break;default:e.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((e&1024)!==0)throw Error(l(163))}if(e=t.sibling,e!==null){e.return=t.return,ht=e;break}ht=t.return}}function fp(e,t,a){var r=a.flags;switch(a.tag){case 0:case 11:case 15:Vn(e,a),r&4&&Bs(5,a);break;case 1:if(Vn(e,a),r&4)if(e=a.stateNode,t===null)try{e.componentDidMount()}catch(p){ke(a,a.return,p)}else{var u=Pi(a.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(u,t,e.__reactInternalSnapshotBeforeUpdate)}catch(p){ke(a,a.return,p)}}r&64&&sp(a),r&512&&Gs(a,a.return);break;case 3:if(Vn(e,a),r&64&&(e=a.updateQueue,e!==null)){if(t=null,a.child!==null)switch(a.child.tag){case 27:case 5:t=a.child.stateNode;break;case 1:t=a.child.stateNode}try{Qd(e,t)}catch(p){ke(a,a.return,p)}}break;case 27:t===null&&r&4&&up(a);case 26:case 5:Vn(e,a),t===null&&r&4&&lp(a),r&512&&Gs(a,a.return);break;case 12:Vn(e,a);break;case 31:Vn(e,a),r&4&&pp(e,a);break;case 13:Vn(e,a),r&4&&mp(e,a),r&64&&(e=a.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(a=Ob.bind(null,a),Pb(e,a))));break;case 22:if(r=a.memoizedState!==null||$n,!r){t=t!==null&&t.memoizedState!==null||ot,u=$n;var f=ot;$n=r,(ot=t)&&!f?Fn(e,a,(a.subtreeFlags&8772)!==0):Vn(e,a),$n=u,ot=f}break;case 30:break;default:Vn(e,a)}}function dp(e){var t=e.alternate;t!==null&&(e.alternate=null,dp(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&go(t)),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}var Xe=null,Ct=!1;function In(e,t,a){for(a=a.child;a!==null;)hp(e,t,a),a=a.sibling}function hp(e,t,a){if(Ye&&typeof Ye.onCommitFiberUnmount=="function")try{Ye.onCommitFiberUnmount(ft,a)}catch{}switch(a.tag){case 26:ot||Sn(a,t),In(e,t,a),a.memoizedState?a.memoizedState.count--:a.stateNode&&(a=a.stateNode,a.parentNode.removeChild(a));break;case 27:ot||Sn(a,t);var r=Xe,u=Ct;yi(a.type)&&(Xe=a.stateNode,Ct=!1),In(e,t,a),Ks(a.stateNode),Xe=r,Ct=u;break;case 5:ot||Sn(a,t);case 6:if(r=Xe,u=Ct,Xe=null,In(e,t,a),Xe=r,Ct=u,Xe!==null)if(Ct)try{(Xe.nodeType===9?Xe.body:Xe.nodeName==="HTML"?Xe.ownerDocument.body:Xe).removeChild(a.stateNode)}catch(f){ke(a,t,f)}else try{Xe.removeChild(a.stateNode)}catch(f){ke(a,t,f)}break;case 18:Xe!==null&&(Ct?(e=Xe,sm(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,a.stateNode),Xa(e)):sm(Xe,a.stateNode));break;case 4:r=Xe,u=Ct,Xe=a.stateNode.containerInfo,Ct=!0,In(e,t,a),Xe=r,Ct=u;break;case 0:case 11:case 14:case 15:ci(2,a,t),ot||ci(4,a,t),In(e,t,a);break;case 1:ot||(Sn(a,t),r=a.stateNode,typeof r.componentWillUnmount=="function"&&rp(a,t,r)),In(e,t,a);break;case 21:In(e,t,a);break;case 22:ot=(r=ot)||a.memoizedState!==null,In(e,t,a),ot=r;break;default:In(e,t,a)}}function pp(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{Xa(e)}catch(a){ke(t,t.return,a)}}}function mp(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{Xa(e)}catch(a){ke(t,t.return,a)}}function wb(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new cp),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new cp),t;default:throw Error(l(435,e.tag))}}function rl(e,t){var a=wb(e);t.forEach(function(r){if(!a.has(r)){a.add(r);var u=zb.bind(null,e,r);r.then(u,u)}})}function Ot(e,t){var a=t.deletions;if(a!==null)for(var r=0;r<a.length;r++){var u=a[r],f=e,p=t,g=p;e:for(;g!==null;){switch(g.tag){case 27:if(yi(g.type)){Xe=g.stateNode,Ct=!1;break e}break;case 5:Xe=g.stateNode,Ct=!1;break e;case 3:case 4:Xe=g.stateNode.containerInfo,Ct=!0;break e}g=g.return}if(Xe===null)throw Error(l(160));hp(f,p,u),Xe=null,Ct=!1,f=u.alternate,f!==null&&(f.return=null),u.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)gp(t,e),t=t.sibling}var pn=null;function gp(e,t){var a=e.alternate,r=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:Ot(t,e),zt(e),r&4&&(ci(3,e,e.return),Bs(3,e),ci(5,e,e.return));break;case 1:Ot(t,e),zt(e),r&512&&(ot||a===null||Sn(a,a.return)),r&64&&$n&&(e=e.updateQueue,e!==null&&(r=e.callbacks,r!==null&&(a=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=a===null?r:a.concat(r))));break;case 26:var u=pn;if(Ot(t,e),zt(e),r&512&&(ot||a===null||Sn(a,a.return)),r&4){var f=a!==null?a.memoizedState:null;if(r=e.memoizedState,a===null)if(r===null)if(e.stateNode===null){e:{r=e.type,a=e.memoizedProps,u=u.ownerDocument||u;t:switch(r){case"title":f=u.getElementsByTagName("title")[0],(!f||f[ds]||f[mt]||f.namespaceURI==="http://www.w3.org/2000/svg"||f.hasAttribute("itemprop"))&&(f=u.createElement(r),u.head.insertBefore(f,u.querySelector("head > title"))),bt(f,r,a),f[mt]=e,dt(f),r=f;break e;case"link":var p=gm("link","href",u).get(r+(a.href||""));if(p){for(var g=0;g<p.length;g++)if(f=p[g],f.getAttribute("href")===(a.href==null||a.href===""?null:a.href)&&f.getAttribute("rel")===(a.rel==null?null:a.rel)&&f.getAttribute("title")===(a.title==null?null:a.title)&&f.getAttribute("crossorigin")===(a.crossOrigin==null?null:a.crossOrigin)){p.splice(g,1);break t}}f=u.createElement(r),bt(f,r,a),u.head.appendChild(f);break;case"meta":if(p=gm("meta","content",u).get(r+(a.content||""))){for(g=0;g<p.length;g++)if(f=p[g],f.getAttribute("content")===(a.content==null?null:""+a.content)&&f.getAttribute("name")===(a.name==null?null:a.name)&&f.getAttribute("property")===(a.property==null?null:a.property)&&f.getAttribute("http-equiv")===(a.httpEquiv==null?null:a.httpEquiv)&&f.getAttribute("charset")===(a.charSet==null?null:a.charSet)){p.splice(g,1);break t}}f=u.createElement(r),bt(f,r,a),u.head.appendChild(f);break;default:throw Error(l(468,r))}f[mt]=e,dt(f),r=f}e.stateNode=r}else ym(u,e.type,e.stateNode);else e.stateNode=mm(u,r,e.memoizedProps);else f!==r?(f===null?a.stateNode!==null&&(a=a.stateNode,a.parentNode.removeChild(a)):f.count--,r===null?ym(u,e.type,e.stateNode):mm(u,r,e.memoizedProps)):r===null&&e.stateNode!==null&&ju(e,e.memoizedProps,a.memoizedProps)}break;case 27:Ot(t,e),zt(e),r&512&&(ot||a===null||Sn(a,a.return)),a!==null&&r&4&&ju(e,e.memoizedProps,a.memoizedProps);break;case 5:if(Ot(t,e),zt(e),r&512&&(ot||a===null||Sn(a,a.return)),e.flags&32){u=e.stateNode;try{ga(u,"")}catch(ie){ke(e,e.return,ie)}}r&4&&e.stateNode!=null&&(u=e.memoizedProps,ju(e,u,a!==null?a.memoizedProps:u)),r&1024&&($u=!0);break;case 6:if(Ot(t,e),zt(e),r&4){if(e.stateNode===null)throw Error(l(162));r=e.memoizedProps,a=e.stateNode;try{a.nodeValue=r}catch(ie){ke(e,e.return,ie)}}break;case 3:if(wl=null,u=pn,pn=xl(t.containerInfo),Ot(t,e),pn=u,zt(e),r&4&&a!==null&&a.memoizedState.isDehydrated)try{Xa(t.containerInfo)}catch(ie){ke(e,e.return,ie)}$u&&($u=!1,yp(e));break;case 4:r=pn,pn=xl(e.stateNode.containerInfo),Ot(t,e),zt(e),pn=r;break;case 12:Ot(t,e),zt(e);break;case 31:Ot(t,e),zt(e),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,rl(e,r)));break;case 13:Ot(t,e),zt(e),e.child.flags&8192&&e.memoizedState!==null!=(a!==null&&a.memoizedState!==null)&&(ol=Ve()),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,rl(e,r)));break;case 22:u=e.memoizedState!==null;var x=a!==null&&a.memoizedState!==null,O=$n,G=ot;if($n=O||u,ot=G||x,Ot(t,e),ot=G,$n=O,zt(e),r&8192)e:for(t=e.stateNode,t._visibility=u?t._visibility&-2:t._visibility|1,u&&(a===null||x||$n||ot||Zi(e)),a=null,t=e;;){if(t.tag===5||t.tag===26){if(a===null){x=a=t;try{if(f=x.stateNode,u)p=f.style,typeof p.setProperty=="function"?p.setProperty("display","none","important"):p.display="none";else{g=x.stateNode;var I=x.memoizedProps.style,_=I!=null&&I.hasOwnProperty("display")?I.display:null;g.style.display=_==null||typeof _=="boolean"?"":(""+_).trim()}}catch(ie){ke(x,x.return,ie)}}}else if(t.tag===6){if(a===null){x=t;try{x.stateNode.nodeValue=u?"":x.memoizedProps}catch(ie){ke(x,x.return,ie)}}}else if(t.tag===18){if(a===null){x=t;try{var U=x.stateNode;u?rm(U,!0):rm(x.stateNode,!1)}catch(ie){ke(x,x.return,ie)}}}else if((t.tag!==22&&t.tag!==23||t.memoizedState===null||t===e)&&t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break e;for(;t.sibling===null;){if(t.return===null||t.return===e)break e;a===t&&(a=null),t=t.return}a===t&&(a=null),t.sibling.return=t.return,t=t.sibling}r&4&&(r=e.updateQueue,r!==null&&(a=r.retryQueue,a!==null&&(r.retryQueue=null,rl(e,a))));break;case 19:Ot(t,e),zt(e),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,rl(e,r)));break;case 30:break;case 21:break;default:Ot(t,e),zt(e)}}function zt(e){var t=e.flags;if(t&2){try{for(var a,r=e.return;r!==null;){if(op(r)){a=r;break}r=r.return}if(a==null)throw Error(l(160));switch(a.tag){case 27:var u=a.stateNode,f=Bu(e);sl(e,f,u);break;case 5:var p=a.stateNode;a.flags&32&&(ga(p,""),a.flags&=-33);var g=Bu(e);sl(e,g,p);break;case 3:case 4:var x=a.stateNode.containerInfo,O=Bu(e);Gu(e,O,x);break;default:throw Error(l(161))}}catch(G){ke(e,e.return,G)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function yp(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;yp(t),t.tag===5&&t.flags&1024&&t.stateNode.reset(),e=e.sibling}}function Vn(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)fp(e,t.alternate,t),t=t.sibling}function Zi(e){for(e=e.child;e!==null;){var t=e;switch(t.tag){case 0:case 11:case 14:case 15:ci(4,t,t.return),Zi(t);break;case 1:Sn(t,t.return);var a=t.stateNode;typeof a.componentWillUnmount=="function"&&rp(t,t.return,a),Zi(t);break;case 27:Ks(t.stateNode);case 26:case 5:Sn(t,t.return),Zi(t);break;case 22:t.memoizedState===null&&Zi(t);break;case 30:Zi(t);break;default:Zi(t)}e=e.sibling}}function Fn(e,t,a){for(a=a&&(t.subtreeFlags&8772)!==0,t=t.child;t!==null;){var r=t.alternate,u=e,f=t,p=f.flags;switch(f.tag){case 0:case 11:case 15:Fn(u,f,a),Bs(4,f);break;case 1:if(Fn(u,f,a),r=f,u=r.stateNode,typeof u.componentDidMount=="function")try{u.componentDidMount()}catch(O){ke(r,r.return,O)}if(r=f,u=r.updateQueue,u!==null){var g=r.stateNode;try{var x=u.shared.hiddenCallbacks;if(x!==null)for(u.shared.hiddenCallbacks=null,u=0;u<x.length;u++)Kd(x[u],g)}catch(O){ke(r,r.return,O)}}a&&p&64&&sp(f),Gs(f,f.return);break;case 27:up(f);case 26:case 5:Fn(u,f,a),a&&r===null&&p&4&&lp(f),Gs(f,f.return);break;case 12:Fn(u,f,a);break;case 31:Fn(u,f,a),a&&p&4&&pp(u,f);break;case 13:Fn(u,f,a),a&&p&4&&mp(u,f);break;case 22:f.memoizedState===null&&Fn(u,f,a),Gs(f,f.return);break;case 30:break;default:Fn(u,f,a)}t=t.sibling}}function Iu(e,t){var a=null;e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(a=e.memoizedState.cachePool.pool),e=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(e=t.memoizedState.cachePool.pool),e!==a&&(e!=null&&e.refCount++,a!=null&&As(a))}function Vu(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&As(e))}function mn(e,t,a,r){if(t.subtreeFlags&10256)for(t=t.child;t!==null;)vp(e,t,a,r),t=t.sibling}function vp(e,t,a,r){var u=t.flags;switch(t.tag){case 0:case 11:case 15:mn(e,t,a,r),u&2048&&Bs(9,t);break;case 1:mn(e,t,a,r);break;case 3:mn(e,t,a,r),u&2048&&(e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&As(e)));break;case 12:if(u&2048){mn(e,t,a,r),e=t.stateNode;try{var f=t.memoizedProps,p=f.id,g=f.onPostCommit;typeof g=="function"&&g(p,t.alternate===null?"mount":"update",e.passiveEffectDuration,-0)}catch(x){ke(t,t.return,x)}}else mn(e,t,a,r);break;case 31:mn(e,t,a,r);break;case 13:mn(e,t,a,r);break;case 23:break;case 22:f=t.stateNode,p=t.alternate,t.memoizedState!==null?f._visibility&2?mn(e,t,a,r):$s(e,t):f._visibility&2?mn(e,t,a,r):(f._visibility|=2,La(e,t,a,r,(t.subtreeFlags&10256)!==0||!1)),u&2048&&Iu(p,t);break;case 24:mn(e,t,a,r),u&2048&&Vu(t.alternate,t);break;default:mn(e,t,a,r)}}function La(e,t,a,r,u){for(u=u&&((t.subtreeFlags&10256)!==0||!1),t=t.child;t!==null;){var f=e,p=t,g=a,x=r,O=p.flags;switch(p.tag){case 0:case 11:case 15:La(f,p,g,x,u),Bs(8,p);break;case 23:break;case 22:var G=p.stateNode;p.memoizedState!==null?G._visibility&2?La(f,p,g,x,u):$s(f,p):(G._visibility|=2,La(f,p,g,x,u)),u&&O&2048&&Iu(p.alternate,p);break;case 24:La(f,p,g,x,u),u&&O&2048&&Vu(p.alternate,p);break;default:La(f,p,g,x,u)}t=t.sibling}}function $s(e,t){if(t.subtreeFlags&10256)for(t=t.child;t!==null;){var a=e,r=t,u=r.flags;switch(r.tag){case 22:$s(a,r),u&2048&&Iu(r.alternate,r);break;case 24:$s(a,r),u&2048&&Vu(r.alternate,r);break;default:$s(a,r)}t=t.sibling}}var Is=8192;function ja(e,t,a){if(e.subtreeFlags&Is)for(e=e.child;e!==null;)bp(e,t,a),e=e.sibling}function bp(e,t,a){switch(e.tag){case 26:ja(e,t,a),e.flags&Is&&e.memoizedState!==null&&ox(a,pn,e.memoizedState,e.memoizedProps);break;case 5:ja(e,t,a);break;case 3:case 4:var r=pn;pn=xl(e.stateNode.containerInfo),ja(e,t,a),pn=r;break;case 22:e.memoizedState===null&&(r=e.alternate,r!==null&&r.memoizedState!==null?(r=Is,Is=16777216,ja(e,t,a),Is=r):ja(e,t,a));break;default:ja(e,t,a)}}function xp(e){var t=e.alternate;if(t!==null&&(e=t.child,e!==null)){t.child=null;do t=e.sibling,e.sibling=null,e=t;while(e!==null)}}function Vs(e){var t=e.deletions;if((e.flags&16)!==0){if(t!==null)for(var a=0;a<t.length;a++){var r=t[a];ht=r,wp(r,e)}xp(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)Sp(e),e=e.sibling}function Sp(e){switch(e.tag){case 0:case 11:case 15:Vs(e),e.flags&2048&&ci(9,e,e.return);break;case 3:Vs(e);break;case 12:Vs(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,ll(e)):Vs(e);break;default:Vs(e)}}function ll(e){var t=e.deletions;if((e.flags&16)!==0){if(t!==null)for(var a=0;a<t.length;a++){var r=t[a];ht=r,wp(r,e)}xp(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:ci(8,t,t.return),ll(t);break;case 22:a=t.stateNode,a._visibility&2&&(a._visibility&=-3,ll(t));break;default:ll(t)}e=e.sibling}}function wp(e,t){for(;ht!==null;){var a=ht;switch(a.tag){case 0:case 11:case 15:ci(8,a,t);break;case 23:case 22:if(a.memoizedState!==null&&a.memoizedState.cachePool!==null){var r=a.memoizedState.cachePool.pool;r!=null&&r.refCount++}break;case 24:As(a.memoizedState.cache)}if(r=a.child,r!==null)r.return=a,ht=r;else e:for(a=e;ht!==null;){r=ht;var u=r.sibling,f=r.return;if(dp(r),r===a){ht=null;break e}if(u!==null){u.return=f,ht=u;break e}ht=f}}}var Eb={getCacheForType:function(e){var t=yt(st),a=t.data.get(e);return a===void 0&&(a=e(),t.data.set(e,a)),a},cacheSignal:function(){return yt(st).controller.signal}},Tb=typeof WeakMap=="function"?WeakMap:Map,_e=0,Ie=null,xe=null,Te=0,Ne=0,It=null,fi=!1,Ba=!1,Fu=!1,Hn=0,Je=0,di=0,Wi=0,Hu=0,Vt=0,Ga=0,Fs=null,_t=null,qu=!1,ol=0,Ep=0,ul=1/0,cl=null,hi=null,ut=0,pi=null,$a=null,qn=0,Yu=0,Xu=null,Tp=null,Hs=0,Ku=null;function Ft(){return(_e&2)!==0&&Te!==0?Te&-Te:z.T!==null?ec():$f()}function Ap(){if(Vt===0)if((Te&536870912)===0||Me){var e=vr;vr<<=1,(vr&3932160)===0&&(vr=262144),Vt=e}else Vt=536870912;return e=Gt.current,e!==null&&(e.flags|=32),Vt}function Ut(e,t,a){(e===Ie&&(Ne===2||Ne===9)||e.cancelPendingCommit!==null)&&(Ia(e,0),mi(e,Te,Vt,!1)),fs(e,a),((_e&2)===0||e!==Ie)&&(e===Ie&&((_e&2)===0&&(Wi|=a),Je===4&&mi(e,Te,Vt,!1)),wn(e))}function Mp(e,t,a){if((_e&6)!==0)throw Error(l(327));var r=!a&&(t&127)===0&&(t&e.expiredLanes)===0||cs(e,t),u=r?Rb(e,t):Pu(e,t,!0),f=r;do{if(u===0){Ba&&!r&&mi(e,t,0,!1);break}else{if(a=e.current.alternate,f&&!Ab(a)){u=Pu(e,t,!1),f=!1;continue}if(u===2){if(f=t,e.errorRecoveryDisabledLanes&f)var p=0;else p=e.pendingLanes&-536870913,p=p!==0?p:p&536870912?536870912:0;if(p!==0){t=p;e:{var g=e;u=Fs;var x=g.current.memoizedState.isDehydrated;if(x&&(Ia(g,p).flags|=256),p=Pu(g,p,!1),p!==2){if(Fu&&!x){g.errorRecoveryDisabledLanes|=f,Wi|=f,u=4;break e}f=_t,_t=u,f!==null&&(_t===null?_t=f:_t.push.apply(_t,f))}u=p}if(f=!1,u!==2)continue}}if(u===1){Ia(e,0),mi(e,t,0,!0);break}e:{switch(r=e,f=u,f){case 0:case 1:throw Error(l(345));case 4:if((t&4194048)!==t)break;case 6:mi(r,t,Vt,!fi);break e;case 2:_t=null;break;case 3:case 5:break;default:throw Error(l(329))}if((t&62914560)===t&&(u=ol+300-Ve(),10<u)){if(mi(r,t,Vt,!fi),xr(r,0,!0)!==0)break e;qn=t,r.timeoutHandle=im(Rp.bind(null,r,a,_t,cl,qu,t,Vt,Wi,Ga,fi,f,"Throttled",-0,0),u);break e}Rp(r,a,_t,cl,qu,t,Vt,Wi,Ga,fi,f,null,-0,0)}}break}while(!0);wn(e)}function Rp(e,t,a,r,u,f,p,g,x,O,G,I,_,U){if(e.timeoutHandle=-1,I=t.subtreeFlags,I&8192||(I&16785408)===16785408){I={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:On},bp(t,f,I);var ie=(f&62914560)===f?ol-Ve():(f&4194048)===f?Ep-Ve():0;if(ie=ux(I,ie),ie!==null){qn=f,e.cancelPendingCommit=ie(kp.bind(null,e,t,f,a,r,u,p,g,x,G,I,null,_,U)),mi(e,f,p,!O);return}}kp(e,t,f,a,r,u,p,g,x)}function Ab(e){for(var t=e;;){var a=t.tag;if((a===0||a===11||a===15)&&t.flags&16384&&(a=t.updateQueue,a!==null&&(a=a.stores,a!==null)))for(var r=0;r<a.length;r++){var u=a[r],f=u.getSnapshot;u=u.value;try{if(!jt(f(),u))return!1}catch{return!1}}if(a=t.child,t.subtreeFlags&16384&&a!==null)a.return=t,t=a;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function mi(e,t,a,r){t&=~Hu,t&=~Wi,e.suspendedLanes|=t,e.pingedLanes&=~t,r&&(e.warmLanes|=t),r=e.expirationTimes;for(var u=t;0<u;){var f=31-tt(u),p=1<<f;r[f]=-1,u&=~p}a!==0&&jf(e,a,t)}function fl(){return(_e&6)===0?(qs(0),!1):!0}function Qu(){if(xe!==null){if(Ne===0)var e=xe.return;else e=xe,Nn=Fi=null,fu(e),za=null,Rs=0,e=xe;for(;e!==null;)ap(e.alternate,e),e=e.return;xe=null}}function Ia(e,t){var a=e.timeoutHandle;a!==-1&&(e.timeoutHandle=-1,qb(a)),a=e.cancelPendingCommit,a!==null&&(e.cancelPendingCommit=null,a()),qn=0,Qu(),Ie=e,xe=a=_n(e.current,null),Te=t,Ne=0,It=null,fi=!1,Ba=cs(e,t),Fu=!1,Ga=Vt=Hu=Wi=di=Je=0,_t=Fs=null,qu=!1,(t&8)!==0&&(t|=t&32);var r=e.entangledLanes;if(r!==0)for(e=e.entanglements,r&=t;0<r;){var u=31-tt(r),f=1<<u;t|=e[u],r&=~f}return Hn=t,_r(),a}function Dp(e,t){ge=null,z.H=ks,t===Oa||t===$r?(t=Hd(),Ne=3):t===Jo?(t=Hd(),Ne=4):Ne=t===Ru?8:t!==null&&typeof t=="object"&&typeof t.then=="function"?6:1,It=t,xe===null&&(Je=1,el(e,Jt(t,e.current)))}function Cp(){var e=Gt.current;return e===null?!0:(Te&4194048)===Te?an===null:(Te&62914560)===Te||(Te&536870912)!==0?e===an:!1}function Op(){var e=z.H;return z.H=ks,e===null?ks:e}function zp(){var e=z.A;return z.A=Eb,e}function dl(){Je=4,fi||(Te&4194048)!==Te&&Gt.current!==null||(Ba=!0),(di&134217727)===0&&(Wi&134217727)===0||Ie===null||mi(Ie,Te,Vt,!1)}function Pu(e,t,a){var r=_e;_e|=2;var u=Op(),f=zp();(Ie!==e||Te!==t)&&(cl=null,Ia(e,t)),t=!1;var p=Je;e:do try{if(Ne!==0&&xe!==null){var g=xe,x=It;switch(Ne){case 8:Qu(),p=6;break e;case 3:case 2:case 9:case 6:Gt.current===null&&(t=!0);var O=Ne;if(Ne=0,It=null,Va(e,g,x,O),a&&Ba){p=0;break e}break;default:O=Ne,Ne=0,It=null,Va(e,g,x,O)}}Mb(),p=Je;break}catch(G){Dp(e,G)}while(!0);return t&&e.shellSuspendCounter++,Nn=Fi=null,_e=r,z.H=u,z.A=f,xe===null&&(Ie=null,Te=0,_r()),p}function Mb(){for(;xe!==null;)_p(xe)}function Rb(e,t){var a=_e;_e|=2;var r=Op(),u=zp();Ie!==e||Te!==t?(cl=null,ul=Ve()+500,Ia(e,t)):Ba=cs(e,t);e:do try{if(Ne!==0&&xe!==null){t=xe;var f=It;t:switch(Ne){case 1:Ne=0,It=null,Va(e,t,f,1);break;case 2:case 9:if(Vd(f)){Ne=0,It=null,Up(t);break}t=function(){Ne!==2&&Ne!==9||Ie!==e||(Ne=7),wn(e)},f.then(t,t);break e;case 3:Ne=7;break e;case 4:Ne=5;break e;case 7:Vd(f)?(Ne=0,It=null,Up(t)):(Ne=0,It=null,Va(e,t,f,7));break;case 5:var p=null;switch(xe.tag){case 26:p=xe.memoizedState;case 5:case 27:var g=xe;if(p?vm(p):g.stateNode.complete){Ne=0,It=null;var x=g.sibling;if(x!==null)xe=x;else{var O=g.return;O!==null?(xe=O,hl(O)):xe=null}break t}}Ne=0,It=null,Va(e,t,f,5);break;case 6:Ne=0,It=null,Va(e,t,f,6);break;case 8:Qu(),Je=6;break e;default:throw Error(l(462))}}Db();break}catch(G){Dp(e,G)}while(!0);return Nn=Fi=null,z.H=r,z.A=u,_e=a,xe!==null?0:(Ie=null,Te=0,_r(),Je)}function Db(){for(;xe!==null&&!Qe();)_p(xe)}function _p(e){var t=np(e.alternate,e,Hn);e.memoizedProps=e.pendingProps,t===null?hl(e):xe=t}function Up(e){var t=e,a=t.alternate;switch(t.tag){case 15:case 0:t=Ph(a,t,t.pendingProps,t.type,void 0,Te);break;case 11:t=Ph(a,t,t.pendingProps,t.type.render,t.ref,Te);break;case 5:fu(t);default:ap(a,t),t=xe=zd(t,Hn),t=np(a,t,Hn)}e.memoizedProps=e.pendingProps,t===null?hl(e):xe=t}function Va(e,t,a,r){Nn=Fi=null,fu(t),za=null,Rs=0;var u=t.return;try{if(gb(e,u,t,a,Te)){Je=1,el(e,Jt(a,e.current)),xe=null;return}}catch(f){if(u!==null)throw xe=u,f;Je=1,el(e,Jt(a,e.current)),xe=null;return}t.flags&32768?(Me||r===1?e=!0:Ba||(Te&536870912)!==0?e=!1:(fi=e=!0,(r===2||r===9||r===3||r===6)&&(r=Gt.current,r!==null&&r.tag===13&&(r.flags|=16384))),Np(t,e)):hl(t)}function hl(e){var t=e;do{if((t.flags&32768)!==0){Np(t,fi);return}e=t.return;var a=bb(t.alternate,t,Hn);if(a!==null){xe=a;return}if(t=t.sibling,t!==null){xe=t;return}xe=t=e}while(t!==null);Je===0&&(Je=5)}function Np(e,t){do{var a=xb(e.alternate,e);if(a!==null){a.flags&=32767,xe=a;return}if(a=e.return,a!==null&&(a.flags|=32768,a.subtreeFlags=0,a.deletions=null),!t&&(e=e.sibling,e!==null)){xe=e;return}xe=e=a}while(e!==null);Je=6,xe=null}function kp(e,t,a,r,u,f,p,g,x){e.cancelPendingCommit=null;do pl();while(ut!==0);if((_e&6)!==0)throw Error(l(327));if(t!==null){if(t===e.current)throw Error(l(177));if(f=t.lanes|t.childLanes,f|=Bo,lv(e,a,f,p,g,x),e===Ie&&(xe=Ie=null,Te=0),$a=t,pi=e,qn=a,Yu=f,Xu=u,Tp=r,(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?(e.callbackNode=null,e.callbackPriority=0,_b(Rn,function(){return $p(),null})):(e.callbackNode=null,e.callbackPriority=0),r=(t.flags&13878)!==0,(t.subtreeFlags&13878)!==0||r){r=z.T,z.T=null,u=X.p,X.p=2,p=_e,_e|=4;try{Sb(e,t,a)}finally{_e=p,X.p=u,z.T=r}}ut=1,Lp(),jp(),Bp()}}function Lp(){if(ut===1){ut=0;var e=pi,t=$a,a=(t.flags&13878)!==0;if((t.subtreeFlags&13878)!==0||a){a=z.T,z.T=null;var r=X.p;X.p=2;var u=_e;_e|=4;try{gp(t,e);var f=oc,p=wd(e.containerInfo),g=f.focusedElem,x=f.selectionRange;if(p!==g&&g&&g.ownerDocument&&Sd(g.ownerDocument.documentElement,g)){if(x!==null&&Uo(g)){var O=x.start,G=x.end;if(G===void 0&&(G=O),"selectionStart"in g)g.selectionStart=O,g.selectionEnd=Math.min(G,g.value.length);else{var I=g.ownerDocument||document,_=I&&I.defaultView||window;if(_.getSelection){var U=_.getSelection(),ie=g.textContent.length,fe=Math.min(x.start,ie),Be=x.end===void 0?fe:Math.min(x.end,ie);!U.extend&&fe>Be&&(p=Be,Be=fe,fe=p);var M=xd(g,fe),E=xd(g,Be);if(M&&E&&(U.rangeCount!==1||U.anchorNode!==M.node||U.anchorOffset!==M.offset||U.focusNode!==E.node||U.focusOffset!==E.offset)){var C=I.createRange();C.setStart(M.node,M.offset),U.removeAllRanges(),fe>Be?(U.addRange(C),U.extend(E.node,E.offset)):(C.setEnd(E.node,E.offset),U.addRange(C))}}}}for(I=[],U=g;U=U.parentNode;)U.nodeType===1&&I.push({element:U,left:U.scrollLeft,top:U.scrollTop});for(typeof g.focus=="function"&&g.focus(),g=0;g<I.length;g++){var $=I[g];$.element.scrollLeft=$.left,$.element.scrollTop=$.top}}Ml=!!lc,oc=lc=null}finally{_e=u,X.p=r,z.T=a}}e.current=t,ut=2}}function jp(){if(ut===2){ut=0;var e=pi,t=$a,a=(t.flags&8772)!==0;if((t.subtreeFlags&8772)!==0||a){a=z.T,z.T=null;var r=X.p;X.p=2;var u=_e;_e|=4;try{fp(e,t.alternate,t)}finally{_e=u,X.p=r,z.T=a}}ut=3}}function Bp(){if(ut===4||ut===3){ut=0,Qt();var e=pi,t=$a,a=qn,r=Tp;(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?ut=5:(ut=0,$a=pi=null,Gp(e,e.pendingLanes));var u=e.pendingLanes;if(u===0&&(hi=null),po(a),t=t.stateNode,Ye&&typeof Ye.onCommitFiberRoot=="function")try{Ye.onCommitFiberRoot(ft,t,void 0,(t.current.flags&128)===128)}catch{}if(r!==null){t=z.T,u=X.p,X.p=2,z.T=null;try{for(var f=e.onRecoverableError,p=0;p<r.length;p++){var g=r[p];f(g.value,{componentStack:g.stack})}}finally{z.T=t,X.p=u}}(qn&3)!==0&&pl(),wn(e),u=e.pendingLanes,(a&261930)!==0&&(u&42)!==0?e===Ku?Hs++:(Hs=0,Ku=e):Hs=0,qs(0)}}function Gp(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,As(t)))}function pl(){return Lp(),jp(),Bp(),$p()}function $p(){if(ut!==5)return!1;var e=pi,t=Yu;Yu=0;var a=po(qn),r=z.T,u=X.p;try{X.p=32>a?32:a,z.T=null,a=Xu,Xu=null;var f=pi,p=qn;if(ut=0,$a=pi=null,qn=0,(_e&6)!==0)throw Error(l(331));var g=_e;if(_e|=4,Sp(f.current),vp(f,f.current,p,a),_e=g,qs(0,!1),Ye&&typeof Ye.onPostCommitFiberRoot=="function")try{Ye.onPostCommitFiberRoot(ft,f)}catch{}return!0}finally{X.p=u,z.T=r,Gp(e,t)}}function Ip(e,t,a){t=Jt(a,t),t=Mu(e.stateNode,t,2),e=li(e,t,2),e!==null&&(fs(e,2),wn(e))}function ke(e,t,a){if(e.tag===3)Ip(e,e,a);else for(;t!==null;){if(t.tag===3){Ip(t,e,a);break}else if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof r.componentDidCatch=="function"&&(hi===null||!hi.has(r))){e=Jt(a,e),a=Vh(2),r=li(t,a,2),r!==null&&(Fh(a,r,t,e),fs(r,2),wn(r));break}}t=t.return}}function Zu(e,t,a){var r=e.pingCache;if(r===null){r=e.pingCache=new Tb;var u=new Set;r.set(t,u)}else u=r.get(t),u===void 0&&(u=new Set,r.set(t,u));u.has(a)||(Fu=!0,u.add(a),e=Cb.bind(null,e,t,a),t.then(e,e))}function Cb(e,t,a){var r=e.pingCache;r!==null&&r.delete(t),e.pingedLanes|=e.suspendedLanes&a,e.warmLanes&=~a,Ie===e&&(Te&a)===a&&(Je===4||Je===3&&(Te&62914560)===Te&&300>Ve()-ol?(_e&2)===0&&Ia(e,0):Hu|=a,Ga===Te&&(Ga=0)),wn(e)}function Vp(e,t){t===0&&(t=Lf()),e=$i(e,t),e!==null&&(fs(e,t),wn(e))}function Ob(e){var t=e.memoizedState,a=0;t!==null&&(a=t.retryLane),Vp(e,a)}function zb(e,t){var a=0;switch(e.tag){case 31:case 13:var r=e.stateNode,u=e.memoizedState;u!==null&&(a=u.retryLane);break;case 19:r=e.stateNode;break;case 22:r=e.stateNode._retryCache;break;default:throw Error(l(314))}r!==null&&r.delete(t),Vp(e,a)}function _b(e,t){return Ce(e,t)}var ml=null,Fa=null,Wu=!1,gl=!1,Ju=!1,gi=0;function wn(e){e!==Fa&&e.next===null&&(Fa===null?ml=Fa=e:Fa=Fa.next=e),gl=!0,Wu||(Wu=!0,Nb())}function qs(e,t){if(!Ju&&gl){Ju=!0;do for(var a=!1,r=ml;r!==null;){if(e!==0){var u=r.pendingLanes;if(u===0)var f=0;else{var p=r.suspendedLanes,g=r.pingedLanes;f=(1<<31-tt(42|e)+1)-1,f&=u&~(p&~g),f=f&201326741?f&201326741|1:f?f|2:0}f!==0&&(a=!0,Yp(r,f))}else f=Te,f=xr(r,r===Ie?f:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),(f&3)===0||cs(r,f)||(a=!0,Yp(r,f));r=r.next}while(a);Ju=!1}}function Ub(){Fp()}function Fp(){gl=Wu=!1;var e=0;gi!==0&&Hb()&&(e=gi);for(var t=Ve(),a=null,r=ml;r!==null;){var u=r.next,f=Hp(r,t);f===0?(r.next=null,a===null?ml=u:a.next=u,u===null&&(Fa=a)):(a=r,(e!==0||(f&3)!==0)&&(gl=!0)),r=u}ut!==0&&ut!==5||qs(e),gi!==0&&(gi=0)}function Hp(e,t){for(var a=e.suspendedLanes,r=e.pingedLanes,u=e.expirationTimes,f=e.pendingLanes&-62914561;0<f;){var p=31-tt(f),g=1<<p,x=u[p];x===-1?((g&a)===0||(g&r)!==0)&&(u[p]=rv(g,t)):x<=t&&(e.expiredLanes|=g),f&=~g}if(t=Ie,a=Te,a=xr(e,e===t?a:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r=e.callbackNode,a===0||e===t&&(Ne===2||Ne===9)||e.cancelPendingCommit!==null)return r!==null&&r!==null&&Ke(r),e.callbackNode=null,e.callbackPriority=0;if((a&3)===0||cs(e,a)){if(t=a&-a,t===e.callbackPriority)return t;switch(r!==null&&Ke(r),po(a)){case 2:case 8:a=Lt;break;case 32:a=Rn;break;case 268435456:a=Dn;break;default:a=Rn}return r=qp.bind(null,e),a=Ce(a,r),e.callbackPriority=t,e.callbackNode=a,t}return r!==null&&r!==null&&Ke(r),e.callbackPriority=2,e.callbackNode=null,2}function qp(e,t){if(ut!==0&&ut!==5)return e.callbackNode=null,e.callbackPriority=0,null;var a=e.callbackNode;if(pl()&&e.callbackNode!==a)return null;var r=Te;return r=xr(e,e===Ie?r:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r===0?null:(Mp(e,r,t),Hp(e,Ve()),e.callbackNode!=null&&e.callbackNode===a?qp.bind(null,e):null)}function Yp(e,t){if(pl())return null;Mp(e,t,!0)}function Nb(){Yb(function(){(_e&6)!==0?Ce(xt,Ub):Fp()})}function ec(){if(gi===0){var e=Da;e===0&&(e=yr,yr<<=1,(yr&261888)===0&&(yr=256)),gi=e}return gi}function Xp(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:Tr(""+e)}function Kp(e,t){var a=t.ownerDocument.createElement("input");return a.name=t.name,a.value=t.value,e.id&&a.setAttribute("form",e.id),t.parentNode.insertBefore(a,t),e=new FormData(e),a.parentNode.removeChild(a),e}function kb(e,t,a,r,u){if(t==="submit"&&a&&a.stateNode===u){var f=Xp((u[Rt]||null).action),p=r.submitter;p&&(t=(t=p[Rt]||null)?Xp(t.formAction):p.getAttribute("formAction"),t!==null&&(f=t,p=null));var g=new Dr("action","action",null,r,u);e.push({event:g,listeners:[{instance:null,listener:function(){if(r.defaultPrevented){if(gi!==0){var x=p?Kp(u,p):new FormData(u);xu(a,{pending:!0,data:x,method:u.method,action:f},null,x)}}else typeof f=="function"&&(g.preventDefault(),x=p?Kp(u,p):new FormData(u),xu(a,{pending:!0,data:x,method:u.method,action:f},f,x))},currentTarget:u}]})}}for(var tc=0;tc<jo.length;tc++){var nc=jo[tc],Lb=nc.toLowerCase(),jb=nc[0].toUpperCase()+nc.slice(1);hn(Lb,"on"+jb)}hn(Ad,"onAnimationEnd"),hn(Md,"onAnimationIteration"),hn(Rd,"onAnimationStart"),hn("dblclick","onDoubleClick"),hn("focusin","onFocus"),hn("focusout","onBlur"),hn(Jv,"onTransitionRun"),hn(eb,"onTransitionStart"),hn(tb,"onTransitionCancel"),hn(Dd,"onTransitionEnd"),pa("onMouseEnter",["mouseout","mouseover"]),pa("onMouseLeave",["mouseout","mouseover"]),pa("onPointerEnter",["pointerout","pointerover"]),pa("onPointerLeave",["pointerout","pointerover"]),Li("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),Li("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),Li("onBeforeInput",["compositionend","keypress","textInput","paste"]),Li("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),Li("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),Li("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Ys="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(" "),Bb=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Ys));function Qp(e,t){t=(t&4)!==0;for(var a=0;a<e.length;a++){var r=e[a],u=r.event;r=r.listeners;e:{var f=void 0;if(t)for(var p=r.length-1;0<=p;p--){var g=r[p],x=g.instance,O=g.currentTarget;if(g=g.listener,x!==f&&u.isPropagationStopped())break e;f=g,u.currentTarget=O;try{f(u)}catch(G){zr(G)}u.currentTarget=null,f=x}else for(p=0;p<r.length;p++){if(g=r[p],x=g.instance,O=g.currentTarget,g=g.listener,x!==f&&u.isPropagationStopped())break e;f=g,u.currentTarget=O;try{f(u)}catch(G){zr(G)}u.currentTarget=null,f=x}}}}function Se(e,t){var a=t[mo];a===void 0&&(a=t[mo]=new Set);var r=e+"__bubble";a.has(r)||(Pp(t,e,2,!1),a.add(r))}function ic(e,t,a){var r=0;t&&(r|=4),Pp(a,e,r,t)}var yl="_reactListening"+Math.random().toString(36).slice(2);function ac(e){if(!e[yl]){e[yl]=!0,Ff.forEach(function(a){a!=="selectionchange"&&(Bb.has(a)||ic(a,!1,e),ic(a,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[yl]||(t[yl]=!0,ic("selectionchange",!1,t))}}function Pp(e,t,a,r){switch(Am(t)){case 2:var u=dx;break;case 8:u=hx;break;default:u=bc}a=u.bind(null,t,a,e),u=void 0,!To||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(u=!0),r?u!==void 0?e.addEventListener(t,a,{capture:!0,passive:u}):e.addEventListener(t,a,!0):u!==void 0?e.addEventListener(t,a,{passive:u}):e.addEventListener(t,a,!1)}function sc(e,t,a,r,u){var f=r;if((t&1)===0&&(t&2)===0&&r!==null)e:for(;;){if(r===null)return;var p=r.tag;if(p===3||p===4){var g=r.stateNode.containerInfo;if(g===u)break;if(p===4)for(p=r.return;p!==null;){var x=p.tag;if((x===3||x===4)&&p.stateNode.containerInfo===u)return;p=p.return}for(;g!==null;){if(p=fa(g),p===null)return;if(x=p.tag,x===5||x===6||x===26||x===27){r=f=p;continue e}g=g.parentNode}}r=r.return}td(function(){var O=f,G=wo(a),I=[];e:{var _=Cd.get(e);if(_!==void 0){var U=Dr,ie=e;switch(e){case"keypress":if(Mr(a)===0)break e;case"keydown":case"keyup":U=zv;break;case"focusin":ie="focus",U=Do;break;case"focusout":ie="blur",U=Do;break;case"beforeblur":case"afterblur":U=Do;break;case"click":if(a.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":U=ad;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":U=bv;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":U=Nv;break;case Ad:case Md:case Rd:U=wv;break;case Dd:U=Lv;break;case"scroll":case"scrollend":U=yv;break;case"wheel":U=Bv;break;case"copy":case"cut":case"paste":U=Tv;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":U=rd;break;case"toggle":case"beforetoggle":U=$v}var fe=(t&4)!==0,Be=!fe&&(e==="scroll"||e==="scrollend"),M=fe?_!==null?_+"Capture":null:_;fe=[];for(var E=O,C;E!==null;){var $=E;if(C=$.stateNode,$=$.tag,$!==5&&$!==26&&$!==27||C===null||M===null||($=ps(E,M),$!=null&&fe.push(Xs(E,$,C))),Be)break;E=E.return}0<fe.length&&(_=new U(_,ie,null,a,G),I.push({event:_,listeners:fe}))}}if((t&7)===0){e:{if(_=e==="mouseover"||e==="pointerover",U=e==="mouseout"||e==="pointerout",_&&a!==So&&(ie=a.relatedTarget||a.fromElement)&&(fa(ie)||ie[ca]))break e;if((U||_)&&(_=G.window===G?G:(_=G.ownerDocument)?_.defaultView||_.parentWindow:window,U?(ie=a.relatedTarget||a.toElement,U=O,ie=ie?fa(ie):null,ie!==null&&(Be=c(ie),fe=ie.tag,ie!==Be||fe!==5&&fe!==27&&fe!==6)&&(ie=null)):(U=null,ie=O),U!==ie)){if(fe=ad,$="onMouseLeave",M="onMouseEnter",E="mouse",(e==="pointerout"||e==="pointerover")&&(fe=rd,$="onPointerLeave",M="onPointerEnter",E="pointer"),Be=U==null?_:hs(U),C=ie==null?_:hs(ie),_=new fe($,E+"leave",U,a,G),_.target=Be,_.relatedTarget=C,$=null,fa(G)===O&&(fe=new fe(M,E+"enter",ie,a,G),fe.target=C,fe.relatedTarget=Be,$=fe),Be=$,U&&ie)t:{for(fe=Gb,M=U,E=ie,C=0,$=M;$;$=fe($))C++;$=0;for(var ce=E;ce;ce=fe(ce))$++;for(;0<C-$;)M=fe(M),C--;for(;0<$-C;)E=fe(E),$--;for(;C--;){if(M===E||E!==null&&M===E.alternate){fe=M;break t}M=fe(M),E=fe(E)}fe=null}else fe=null;U!==null&&Zp(I,_,U,fe,!1),ie!==null&&Be!==null&&Zp(I,Be,ie,fe,!0)}}e:{if(_=O?hs(O):window,U=_.nodeName&&_.nodeName.toLowerCase(),U==="select"||U==="input"&&_.type==="file")var Oe=pd;else if(dd(_))if(md)Oe=Pv;else{Oe=Kv;var re=Xv}else U=_.nodeName,!U||U.toLowerCase()!=="input"||_.type!=="checkbox"&&_.type!=="radio"?O&&xo(O.elementType)&&(Oe=pd):Oe=Qv;if(Oe&&(Oe=Oe(e,O))){hd(I,Oe,a,G);break e}re&&re(e,_,O),e==="focusout"&&O&&_.type==="number"&&O.memoizedProps.value!=null&&bo(_,"number",_.value)}switch(re=O?hs(O):window,e){case"focusin":(dd(re)||re.contentEditable==="true")&&(xa=re,No=O,ws=null);break;case"focusout":ws=No=xa=null;break;case"mousedown":ko=!0;break;case"contextmenu":case"mouseup":case"dragend":ko=!1,Ed(I,a,G);break;case"selectionchange":if(Wv)break;case"keydown":case"keyup":Ed(I,a,G)}var ve;if(Oo)e:{switch(e){case"compositionstart":var Ae="onCompositionStart";break e;case"compositionend":Ae="onCompositionEnd";break e;case"compositionupdate":Ae="onCompositionUpdate";break e}Ae=void 0}else ba?cd(e,a)&&(Ae="onCompositionEnd"):e==="keydown"&&a.keyCode===229&&(Ae="onCompositionStart");Ae&&(ld&&a.locale!=="ko"&&(ba||Ae!=="onCompositionStart"?Ae==="onCompositionEnd"&&ba&&(ve=nd()):(ei=G,Ao="value"in ei?ei.value:ei.textContent,ba=!0)),re=vl(O,Ae),0<re.length&&(Ae=new sd(Ae,e,null,a,G),I.push({event:Ae,listeners:re}),ve?Ae.data=ve:(ve=fd(a),ve!==null&&(Ae.data=ve)))),(ve=Vv?Fv(e,a):Hv(e,a))&&(Ae=vl(O,"onBeforeInput"),0<Ae.length&&(re=new sd("onBeforeInput","beforeinput",null,a,G),I.push({event:re,listeners:Ae}),re.data=ve)),kb(I,e,O,a,G)}Qp(I,t)})}function Xs(e,t,a){return{instance:e,listener:t,currentTarget:a}}function vl(e,t){for(var a=t+"Capture",r=[];e!==null;){var u=e,f=u.stateNode;if(u=u.tag,u!==5&&u!==26&&u!==27||f===null||(u=ps(e,a),u!=null&&r.unshift(Xs(e,u,f)),u=ps(e,t),u!=null&&r.push(Xs(e,u,f))),e.tag===3)return r;e=e.return}return[]}function Gb(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function Zp(e,t,a,r,u){for(var f=t._reactName,p=[];a!==null&&a!==r;){var g=a,x=g.alternate,O=g.stateNode;if(g=g.tag,x!==null&&x===r)break;g!==5&&g!==26&&g!==27||O===null||(x=O,u?(O=ps(a,f),O!=null&&p.unshift(Xs(a,O,x))):u||(O=ps(a,f),O!=null&&p.push(Xs(a,O,x)))),a=a.return}p.length!==0&&e.push({event:t,listeners:p})}var $b=/\r\n?/g,Ib=/\u0000|\uFFFD/g;function Wp(e){return(typeof e=="string"?e:""+e).replace($b,`
9
- `).replace(Ib,"")}function Jp(e,t){return t=Wp(t),Wp(e)===t}function je(e,t,a,r,u,f){switch(a){case"children":typeof r=="string"?t==="body"||t==="textarea"&&r===""||ga(e,r):(typeof r=="number"||typeof r=="bigint")&&t!=="body"&&ga(e,""+r);break;case"className":wr(e,"class",r);break;case"tabIndex":wr(e,"tabindex",r);break;case"dir":case"role":case"viewBox":case"width":case"height":wr(e,a,r);break;case"style":Jf(e,r,f);break;case"data":if(t!=="object"){wr(e,"data",r);break}case"src":case"href":if(r===""&&(t!=="a"||a!=="href")){e.removeAttribute(a);break}if(r==null||typeof r=="function"||typeof r=="symbol"||typeof r=="boolean"){e.removeAttribute(a);break}r=Tr(""+r),e.setAttribute(a,r);break;case"action":case"formAction":if(typeof r=="function"){e.setAttribute(a,"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 f=="function"&&(a==="formAction"?(t!=="input"&&je(e,t,"name",u.name,u,null),je(e,t,"formEncType",u.formEncType,u,null),je(e,t,"formMethod",u.formMethod,u,null),je(e,t,"formTarget",u.formTarget,u,null)):(je(e,t,"encType",u.encType,u,null),je(e,t,"method",u.method,u,null),je(e,t,"target",u.target,u,null)));if(r==null||typeof r=="symbol"||typeof r=="boolean"){e.removeAttribute(a);break}r=Tr(""+r),e.setAttribute(a,r);break;case"onClick":r!=null&&(e.onclick=On);break;case"onScroll":r!=null&&Se("scroll",e);break;case"onScrollEnd":r!=null&&Se("scrollend",e);break;case"dangerouslySetInnerHTML":if(r!=null){if(typeof r!="object"||!("__html"in r))throw Error(l(61));if(a=r.__html,a!=null){if(u.children!=null)throw Error(l(60));e.innerHTML=a}}break;case"multiple":e.multiple=r&&typeof r!="function"&&typeof r!="symbol";break;case"muted":e.muted=r&&typeof r!="function"&&typeof r!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(r==null||typeof r=="function"||typeof r=="boolean"||typeof r=="symbol"){e.removeAttribute("xlink:href");break}a=Tr(""+r),e.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",a);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":r!=null&&typeof r!="function"&&typeof r!="symbol"?e.setAttribute(a,""+r):e.removeAttribute(a);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":r&&typeof r!="function"&&typeof r!="symbol"?e.setAttribute(a,""):e.removeAttribute(a);break;case"capture":case"download":r===!0?e.setAttribute(a,""):r!==!1&&r!=null&&typeof r!="function"&&typeof r!="symbol"?e.setAttribute(a,r):e.removeAttribute(a);break;case"cols":case"rows":case"size":case"span":r!=null&&typeof r!="function"&&typeof r!="symbol"&&!isNaN(r)&&1<=r?e.setAttribute(a,r):e.removeAttribute(a);break;case"rowSpan":case"start":r==null||typeof r=="function"||typeof r=="symbol"||isNaN(r)?e.removeAttribute(a):e.setAttribute(a,r);break;case"popover":Se("beforetoggle",e),Se("toggle",e),Sr(e,"popover",r);break;case"xlinkActuate":Cn(e,"http://www.w3.org/1999/xlink","xlink:actuate",r);break;case"xlinkArcrole":Cn(e,"http://www.w3.org/1999/xlink","xlink:arcrole",r);break;case"xlinkRole":Cn(e,"http://www.w3.org/1999/xlink","xlink:role",r);break;case"xlinkShow":Cn(e,"http://www.w3.org/1999/xlink","xlink:show",r);break;case"xlinkTitle":Cn(e,"http://www.w3.org/1999/xlink","xlink:title",r);break;case"xlinkType":Cn(e,"http://www.w3.org/1999/xlink","xlink:type",r);break;case"xmlBase":Cn(e,"http://www.w3.org/XML/1998/namespace","xml:base",r);break;case"xmlLang":Cn(e,"http://www.w3.org/XML/1998/namespace","xml:lang",r);break;case"xmlSpace":Cn(e,"http://www.w3.org/XML/1998/namespace","xml:space",r);break;case"is":Sr(e,"is",r);break;case"innerText":case"textContent":break;default:(!(2<a.length)||a[0]!=="o"&&a[0]!=="O"||a[1]!=="n"&&a[1]!=="N")&&(a=mv.get(a)||a,Sr(e,a,r))}}function rc(e,t,a,r,u,f){switch(a){case"style":Jf(e,r,f);break;case"dangerouslySetInnerHTML":if(r!=null){if(typeof r!="object"||!("__html"in r))throw Error(l(61));if(a=r.__html,a!=null){if(u.children!=null)throw Error(l(60));e.innerHTML=a}}break;case"children":typeof r=="string"?ga(e,r):(typeof r=="number"||typeof r=="bigint")&&ga(e,""+r);break;case"onScroll":r!=null&&Se("scroll",e);break;case"onScrollEnd":r!=null&&Se("scrollend",e);break;case"onClick":r!=null&&(e.onclick=On);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!Hf.hasOwnProperty(a))e:{if(a[0]==="o"&&a[1]==="n"&&(u=a.endsWith("Capture"),t=a.slice(2,u?a.length-7:void 0),f=e[Rt]||null,f=f!=null?f[a]:null,typeof f=="function"&&e.removeEventListener(t,f,u),typeof r=="function")){typeof f!="function"&&f!==null&&(a in e?e[a]=null:e.hasAttribute(a)&&e.removeAttribute(a)),e.addEventListener(t,r,u);break e}a in e?e[a]=r:r===!0?e.setAttribute(a,""):Sr(e,a,r)}}}function bt(e,t,a){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Se("error",e),Se("load",e);var r=!1,u=!1,f;for(f in a)if(a.hasOwnProperty(f)){var p=a[f];if(p!=null)switch(f){case"src":r=!0;break;case"srcSet":u=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(l(137,t));default:je(e,t,f,p,a,null)}}u&&je(e,t,"srcSet",a.srcSet,a,null),r&&je(e,t,"src",a.src,a,null);return;case"input":Se("invalid",e);var g=f=p=u=null,x=null,O=null;for(r in a)if(a.hasOwnProperty(r)){var G=a[r];if(G!=null)switch(r){case"name":u=G;break;case"type":p=G;break;case"checked":x=G;break;case"defaultChecked":O=G;break;case"value":f=G;break;case"defaultValue":g=G;break;case"children":case"dangerouslySetInnerHTML":if(G!=null)throw Error(l(137,t));break;default:je(e,t,r,G,a,null)}}Qf(e,f,g,x,O,p,u,!1);return;case"select":Se("invalid",e),r=p=f=null;for(u in a)if(a.hasOwnProperty(u)&&(g=a[u],g!=null))switch(u){case"value":f=g;break;case"defaultValue":p=g;break;case"multiple":r=g;default:je(e,t,u,g,a,null)}t=f,a=p,e.multiple=!!r,t!=null?ma(e,!!r,t,!1):a!=null&&ma(e,!!r,a,!0);return;case"textarea":Se("invalid",e),f=u=r=null;for(p in a)if(a.hasOwnProperty(p)&&(g=a[p],g!=null))switch(p){case"value":r=g;break;case"defaultValue":u=g;break;case"children":f=g;break;case"dangerouslySetInnerHTML":if(g!=null)throw Error(l(91));break;default:je(e,t,p,g,a,null)}Zf(e,r,u,f);return;case"option":for(x in a)a.hasOwnProperty(x)&&(r=a[x],r!=null)&&(x==="selected"?e.selected=r&&typeof r!="function"&&typeof r!="symbol":je(e,t,x,r,a,null));return;case"dialog":Se("beforetoggle",e),Se("toggle",e),Se("cancel",e),Se("close",e);break;case"iframe":case"object":Se("load",e);break;case"video":case"audio":for(r=0;r<Ys.length;r++)Se(Ys[r],e);break;case"image":Se("error",e),Se("load",e);break;case"details":Se("toggle",e);break;case"embed":case"source":case"link":Se("error",e),Se("load",e);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(O in a)if(a.hasOwnProperty(O)&&(r=a[O],r!=null))switch(O){case"children":case"dangerouslySetInnerHTML":throw Error(l(137,t));default:je(e,t,O,r,a,null)}return;default:if(xo(t)){for(G in a)a.hasOwnProperty(G)&&(r=a[G],r!==void 0&&rc(e,t,G,r,a,void 0));return}}for(g in a)a.hasOwnProperty(g)&&(r=a[g],r!=null&&je(e,t,g,r,a,null))}function Vb(e,t,a,r){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var u=null,f=null,p=null,g=null,x=null,O=null,G=null;for(U in a){var I=a[U];if(a.hasOwnProperty(U)&&I!=null)switch(U){case"checked":break;case"value":break;case"defaultValue":x=I;default:r.hasOwnProperty(U)||je(e,t,U,null,r,I)}}for(var _ in r){var U=r[_];if(I=a[_],r.hasOwnProperty(_)&&(U!=null||I!=null))switch(_){case"type":f=U;break;case"name":u=U;break;case"checked":O=U;break;case"defaultChecked":G=U;break;case"value":p=U;break;case"defaultValue":g=U;break;case"children":case"dangerouslySetInnerHTML":if(U!=null)throw Error(l(137,t));break;default:U!==I&&je(e,t,_,U,r,I)}}vo(e,p,g,x,O,G,f,u);return;case"select":U=p=g=_=null;for(f in a)if(x=a[f],a.hasOwnProperty(f)&&x!=null)switch(f){case"value":break;case"multiple":U=x;default:r.hasOwnProperty(f)||je(e,t,f,null,r,x)}for(u in r)if(f=r[u],x=a[u],r.hasOwnProperty(u)&&(f!=null||x!=null))switch(u){case"value":_=f;break;case"defaultValue":g=f;break;case"multiple":p=f;default:f!==x&&je(e,t,u,f,r,x)}t=g,a=p,r=U,_!=null?ma(e,!!a,_,!1):!!r!=!!a&&(t!=null?ma(e,!!a,t,!0):ma(e,!!a,a?[]:"",!1));return;case"textarea":U=_=null;for(g in a)if(u=a[g],a.hasOwnProperty(g)&&u!=null&&!r.hasOwnProperty(g))switch(g){case"value":break;case"children":break;default:je(e,t,g,null,r,u)}for(p in r)if(u=r[p],f=a[p],r.hasOwnProperty(p)&&(u!=null||f!=null))switch(p){case"value":_=u;break;case"defaultValue":U=u;break;case"children":break;case"dangerouslySetInnerHTML":if(u!=null)throw Error(l(91));break;default:u!==f&&je(e,t,p,u,r,f)}Pf(e,_,U);return;case"option":for(var ie in a)_=a[ie],a.hasOwnProperty(ie)&&_!=null&&!r.hasOwnProperty(ie)&&(ie==="selected"?e.selected=!1:je(e,t,ie,null,r,_));for(x in r)_=r[x],U=a[x],r.hasOwnProperty(x)&&_!==U&&(_!=null||U!=null)&&(x==="selected"?e.selected=_&&typeof _!="function"&&typeof _!="symbol":je(e,t,x,_,r,U));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 fe in a)_=a[fe],a.hasOwnProperty(fe)&&_!=null&&!r.hasOwnProperty(fe)&&je(e,t,fe,null,r,_);for(O in r)if(_=r[O],U=a[O],r.hasOwnProperty(O)&&_!==U&&(_!=null||U!=null))switch(O){case"children":case"dangerouslySetInnerHTML":if(_!=null)throw Error(l(137,t));break;default:je(e,t,O,_,r,U)}return;default:if(xo(t)){for(var Be in a)_=a[Be],a.hasOwnProperty(Be)&&_!==void 0&&!r.hasOwnProperty(Be)&&rc(e,t,Be,void 0,r,_);for(G in r)_=r[G],U=a[G],!r.hasOwnProperty(G)||_===U||_===void 0&&U===void 0||rc(e,t,G,_,r,U);return}}for(var M in a)_=a[M],a.hasOwnProperty(M)&&_!=null&&!r.hasOwnProperty(M)&&je(e,t,M,null,r,_);for(I in r)_=r[I],U=a[I],!r.hasOwnProperty(I)||_===U||_==null&&U==null||je(e,t,I,_,r,U)}function em(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function Fb(){if(typeof performance.getEntriesByType=="function"){for(var e=0,t=0,a=performance.getEntriesByType("resource"),r=0;r<a.length;r++){var u=a[r],f=u.transferSize,p=u.initiatorType,g=u.duration;if(f&&g&&em(p)){for(p=0,g=u.responseEnd,r+=1;r<a.length;r++){var x=a[r],O=x.startTime;if(O>g)break;var G=x.transferSize,I=x.initiatorType;G&&em(I)&&(x=x.responseEnd,p+=G*(x<g?1:(g-O)/(x-O)))}if(--r,t+=8*(f+p)/(u.duration/1e3),e++,10<e)break}}if(0<e)return t/e/1e6}return navigator.connection&&(e=navigator.connection.downlink,typeof e=="number")?e:5}var lc=null,oc=null;function bl(e){return e.nodeType===9?e:e.ownerDocument}function tm(e){switch(e){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function nm(e,t){if(e===0)switch(t){case"svg":return 1;case"math":return 2;default:return 0}return e===1&&t==="foreignObject"?0:e}function uc(e,t){return e==="textarea"||e==="noscript"||typeof t.children=="string"||typeof t.children=="number"||typeof t.children=="bigint"||typeof t.dangerouslySetInnerHTML=="object"&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var cc=null;function Hb(){var e=window.event;return e&&e.type==="popstate"?e===cc?!1:(cc=e,!0):(cc=null,!1)}var im=typeof setTimeout=="function"?setTimeout:void 0,qb=typeof clearTimeout=="function"?clearTimeout:void 0,am=typeof Promise=="function"?Promise:void 0,Yb=typeof queueMicrotask=="function"?queueMicrotask:typeof am<"u"?function(e){return am.resolve(null).then(e).catch(Xb)}:im;function Xb(e){setTimeout(function(){throw e})}function yi(e){return e==="head"}function sm(e,t){var a=t,r=0;do{var u=a.nextSibling;if(e.removeChild(a),u&&u.nodeType===8)if(a=u.data,a==="/$"||a==="/&"){if(r===0){e.removeChild(u),Xa(t);return}r--}else if(a==="$"||a==="$?"||a==="$~"||a==="$!"||a==="&")r++;else if(a==="html")Ks(e.ownerDocument.documentElement);else if(a==="head"){a=e.ownerDocument.head,Ks(a);for(var f=a.firstChild;f;){var p=f.nextSibling,g=f.nodeName;f[ds]||g==="SCRIPT"||g==="STYLE"||g==="LINK"&&f.rel.toLowerCase()==="stylesheet"||a.removeChild(f),f=p}}else a==="body"&&Ks(e.ownerDocument.body);a=u}while(a);Xa(t)}function rm(e,t){var a=e;e=0;do{var r=a.nextSibling;if(a.nodeType===1?t?(a._stashedDisplay=a.style.display,a.style.display="none"):(a.style.display=a._stashedDisplay||"",a.getAttribute("style")===""&&a.removeAttribute("style")):a.nodeType===3&&(t?(a._stashedText=a.nodeValue,a.nodeValue=""):a.nodeValue=a._stashedText||""),r&&r.nodeType===8)if(a=r.data,a==="/$"){if(e===0)break;e--}else a!=="$"&&a!=="$?"&&a!=="$~"&&a!=="$!"||e++;a=r}while(a)}function fc(e){var t=e.firstChild;for(t&&t.nodeType===10&&(t=t.nextSibling);t;){var a=t;switch(t=t.nextSibling,a.nodeName){case"HTML":case"HEAD":case"BODY":fc(a),go(a);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(a.rel.toLowerCase()==="stylesheet")continue}e.removeChild(a)}}function Kb(e,t,a,r){for(;e.nodeType===1;){var u=a;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!r&&(e.nodeName!=="INPUT"||e.type!=="hidden"))break}else if(r){if(!e[ds])switch(t){case"meta":if(!e.hasAttribute("itemprop"))break;return e;case"link":if(f=e.getAttribute("rel"),f==="stylesheet"&&e.hasAttribute("data-precedence"))break;if(f!==u.rel||e.getAttribute("href")!==(u.href==null||u.href===""?null:u.href)||e.getAttribute("crossorigin")!==(u.crossOrigin==null?null:u.crossOrigin)||e.getAttribute("title")!==(u.title==null?null:u.title))break;return e;case"style":if(e.hasAttribute("data-precedence"))break;return e;case"script":if(f=e.getAttribute("src"),(f!==(u.src==null?null:u.src)||e.getAttribute("type")!==(u.type==null?null:u.type)||e.getAttribute("crossorigin")!==(u.crossOrigin==null?null:u.crossOrigin))&&f&&e.hasAttribute("async")&&!e.hasAttribute("itemprop"))break;return e;default:return e}}else if(t==="input"&&e.type==="hidden"){var f=u.name==null?null:""+u.name;if(u.type==="hidden"&&e.getAttribute("name")===f)return e}else return e;if(e=sn(e.nextSibling),e===null)break}return null}function Qb(e,t,a){if(t==="")return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!a||(e=sn(e.nextSibling),e===null))return null;return e}function lm(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!t||(e=sn(e.nextSibling),e===null))return null;return e}function dc(e){return e.data==="$?"||e.data==="$~"}function hc(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState!=="loading"}function Pb(e,t){var a=e.ownerDocument;if(e.data==="$~")e._reactRetry=t;else if(e.data!=="$?"||a.readyState!=="loading")t();else{var r=function(){t(),a.removeEventListener("DOMContentLoaded",r)};a.addEventListener("DOMContentLoaded",r),e._reactRetry=r}}function sn(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break;if(t===8){if(t=e.data,t==="$"||t==="$!"||t==="$?"||t==="$~"||t==="&"||t==="F!"||t==="F")break;if(t==="/$"||t==="/&")return null}}return e}var pc=null;function om(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var a=e.data;if(a==="/$"||a==="/&"){if(t===0)return sn(e.nextSibling);t--}else a!=="$"&&a!=="$!"&&a!=="$?"&&a!=="$~"&&a!=="&"||t++}e=e.nextSibling}return null}function um(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var a=e.data;if(a==="$"||a==="$!"||a==="$?"||a==="$~"||a==="&"){if(t===0)return e;t--}else a!=="/$"&&a!=="/&"||t++}e=e.previousSibling}return null}function cm(e,t,a){switch(t=bl(a),e){case"html":if(e=t.documentElement,!e)throw Error(l(452));return e;case"head":if(e=t.head,!e)throw Error(l(453));return e;case"body":if(e=t.body,!e)throw Error(l(454));return e;default:throw Error(l(451))}}function Ks(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);go(e)}var rn=new Map,fm=new Set;function xl(e){return typeof e.getRootNode=="function"?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var Yn=X.d;X.d={f:Zb,r:Wb,D:Jb,C:ex,L:tx,m:nx,X:ax,S:ix,M:sx};function Zb(){var e=Yn.f(),t=fl();return e||t}function Wb(e){var t=da(e);t!==null&&t.tag===5&&t.type==="form"?Dh(t):Yn.r(e)}var Ha=typeof document>"u"?null:document;function dm(e,t,a){var r=Ha;if(r&&typeof t=="string"&&t){var u=Zt(t);u='link[rel="'+e+'"][href="'+u+'"]',typeof a=="string"&&(u+='[crossorigin="'+a+'"]'),fm.has(u)||(fm.add(u),e={rel:e,crossOrigin:a,href:t},r.querySelector(u)===null&&(t=r.createElement("link"),bt(t,"link",e),dt(t),r.head.appendChild(t)))}}function Jb(e){Yn.D(e),dm("dns-prefetch",e,null)}function ex(e,t){Yn.C(e,t),dm("preconnect",e,t)}function tx(e,t,a){Yn.L(e,t,a);var r=Ha;if(r&&e&&t){var u='link[rel="preload"][as="'+Zt(t)+'"]';t==="image"&&a&&a.imageSrcSet?(u+='[imagesrcset="'+Zt(a.imageSrcSet)+'"]',typeof a.imageSizes=="string"&&(u+='[imagesizes="'+Zt(a.imageSizes)+'"]')):u+='[href="'+Zt(e)+'"]';var f=u;switch(t){case"style":f=qa(e);break;case"script":f=Ya(e)}rn.has(f)||(e=b({rel:"preload",href:t==="image"&&a&&a.imageSrcSet?void 0:e,as:t},a),rn.set(f,e),r.querySelector(u)!==null||t==="style"&&r.querySelector(Qs(f))||t==="script"&&r.querySelector(Ps(f))||(t=r.createElement("link"),bt(t,"link",e),dt(t),r.head.appendChild(t)))}}function nx(e,t){Yn.m(e,t);var a=Ha;if(a&&e){var r=t&&typeof t.as=="string"?t.as:"script",u='link[rel="modulepreload"][as="'+Zt(r)+'"][href="'+Zt(e)+'"]',f=u;switch(r){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":f=Ya(e)}if(!rn.has(f)&&(e=b({rel:"modulepreload",href:e},t),rn.set(f,e),a.querySelector(u)===null)){switch(r){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(a.querySelector(Ps(f)))return}r=a.createElement("link"),bt(r,"link",e),dt(r),a.head.appendChild(r)}}}function ix(e,t,a){Yn.S(e,t,a);var r=Ha;if(r&&e){var u=ha(r).hoistableStyles,f=qa(e);t=t||"default";var p=u.get(f);if(!p){var g={loading:0,preload:null};if(p=r.querySelector(Qs(f)))g.loading=5;else{e=b({rel:"stylesheet",href:e,"data-precedence":t},a),(a=rn.get(f))&&mc(e,a);var x=p=r.createElement("link");dt(x),bt(x,"link",e),x._p=new Promise(function(O,G){x.onload=O,x.onerror=G}),x.addEventListener("load",function(){g.loading|=1}),x.addEventListener("error",function(){g.loading|=2}),g.loading|=4,Sl(p,t,r)}p={type:"stylesheet",instance:p,count:1,state:g},u.set(f,p)}}}function ax(e,t){Yn.X(e,t);var a=Ha;if(a&&e){var r=ha(a).hoistableScripts,u=Ya(e),f=r.get(u);f||(f=a.querySelector(Ps(u)),f||(e=b({src:e,async:!0},t),(t=rn.get(u))&&gc(e,t),f=a.createElement("script"),dt(f),bt(f,"link",e),a.head.appendChild(f)),f={type:"script",instance:f,count:1,state:null},r.set(u,f))}}function sx(e,t){Yn.M(e,t);var a=Ha;if(a&&e){var r=ha(a).hoistableScripts,u=Ya(e),f=r.get(u);f||(f=a.querySelector(Ps(u)),f||(e=b({src:e,async:!0,type:"module"},t),(t=rn.get(u))&&gc(e,t),f=a.createElement("script"),dt(f),bt(f,"link",e),a.head.appendChild(f)),f={type:"script",instance:f,count:1,state:null},r.set(u,f))}}function hm(e,t,a,r){var u=(u=he.current)?xl(u):null;if(!u)throw Error(l(446));switch(e){case"meta":case"title":return null;case"style":return typeof a.precedence=="string"&&typeof a.href=="string"?(t=qa(a.href),a=ha(u).hoistableStyles,r=a.get(t),r||(r={type:"style",instance:null,count:0,state:null},a.set(t,r)),r):{type:"void",instance:null,count:0,state:null};case"link":if(a.rel==="stylesheet"&&typeof a.href=="string"&&typeof a.precedence=="string"){e=qa(a.href);var f=ha(u).hoistableStyles,p=f.get(e);if(p||(u=u.ownerDocument||u,p={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},f.set(e,p),(f=u.querySelector(Qs(e)))&&!f._p&&(p.instance=f,p.state.loading=5),rn.has(e)||(a={rel:"preload",as:"style",href:a.href,crossOrigin:a.crossOrigin,integrity:a.integrity,media:a.media,hrefLang:a.hrefLang,referrerPolicy:a.referrerPolicy},rn.set(e,a),f||rx(u,e,a,p.state))),t&&r===null)throw Error(l(528,""));return p}if(t&&r!==null)throw Error(l(529,""));return null;case"script":return t=a.async,a=a.src,typeof a=="string"&&t&&typeof t!="function"&&typeof t!="symbol"?(t=Ya(a),a=ha(u).hoistableScripts,r=a.get(t),r||(r={type:"script",instance:null,count:0,state:null},a.set(t,r)),r):{type:"void",instance:null,count:0,state:null};default:throw Error(l(444,e))}}function qa(e){return'href="'+Zt(e)+'"'}function Qs(e){return'link[rel="stylesheet"]['+e+"]"}function pm(e){return b({},e,{"data-precedence":e.precedence,precedence:null})}function rx(e,t,a,r){e.querySelector('link[rel="preload"][as="style"]['+t+"]")?r.loading=1:(t=e.createElement("link"),r.preload=t,t.addEventListener("load",function(){return r.loading|=1}),t.addEventListener("error",function(){return r.loading|=2}),bt(t,"link",a),dt(t),e.head.appendChild(t))}function Ya(e){return'[src="'+Zt(e)+'"]'}function Ps(e){return"script[async]"+e}function mm(e,t,a){if(t.count++,t.instance===null)switch(t.type){case"style":var r=e.querySelector('style[data-href~="'+Zt(a.href)+'"]');if(r)return t.instance=r,dt(r),r;var u=b({},a,{"data-href":a.href,"data-precedence":a.precedence,href:null,precedence:null});return r=(e.ownerDocument||e).createElement("style"),dt(r),bt(r,"style",u),Sl(r,a.precedence,e),t.instance=r;case"stylesheet":u=qa(a.href);var f=e.querySelector(Qs(u));if(f)return t.state.loading|=4,t.instance=f,dt(f),f;r=pm(a),(u=rn.get(u))&&mc(r,u),f=(e.ownerDocument||e).createElement("link"),dt(f);var p=f;return p._p=new Promise(function(g,x){p.onload=g,p.onerror=x}),bt(f,"link",r),t.state.loading|=4,Sl(f,a.precedence,e),t.instance=f;case"script":return f=Ya(a.src),(u=e.querySelector(Ps(f)))?(t.instance=u,dt(u),u):(r=a,(u=rn.get(f))&&(r=b({},a),gc(r,u)),e=e.ownerDocument||e,u=e.createElement("script"),dt(u),bt(u,"link",r),e.head.appendChild(u),t.instance=u);case"void":return null;default:throw Error(l(443,t.type))}else t.type==="stylesheet"&&(t.state.loading&4)===0&&(r=t.instance,t.state.loading|=4,Sl(r,a.precedence,e));return t.instance}function Sl(e,t,a){for(var r=a.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),u=r.length?r[r.length-1]:null,f=u,p=0;p<r.length;p++){var g=r[p];if(g.dataset.precedence===t)f=g;else if(f!==u)break}f?f.parentNode.insertBefore(e,f.nextSibling):(t=a.nodeType===9?a.head:a,t.insertBefore(e,t.firstChild))}function mc(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.title==null&&(e.title=t.title)}function gc(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.integrity==null&&(e.integrity=t.integrity)}var wl=null;function gm(e,t,a){if(wl===null){var r=new Map,u=wl=new Map;u.set(a,r)}else u=wl,r=u.get(a),r||(r=new Map,u.set(a,r));if(r.has(e))return r;for(r.set(e,null),a=a.getElementsByTagName(e),u=0;u<a.length;u++){var f=a[u];if(!(f[ds]||f[mt]||e==="link"&&f.getAttribute("rel")==="stylesheet")&&f.namespaceURI!=="http://www.w3.org/2000/svg"){var p=f.getAttribute(t)||"";p=e+p;var g=r.get(p);g?g.push(f):r.set(p,[f])}}return r}function ym(e,t,a){e=e.ownerDocument||e,e.head.insertBefore(a,t==="title"?e.querySelector("head > title"):null)}function lx(e,t,a){if(a===1||t.itemProp!=null)return!1;switch(e){case"meta":case"title":return!0;case"style":if(typeof t.precedence!="string"||typeof t.href!="string"||t.href==="")break;return!0;case"link":if(typeof t.rel!="string"||typeof t.href!="string"||t.href===""||t.onLoad||t.onError)break;return t.rel==="stylesheet"?(e=t.disabled,typeof t.precedence=="string"&&e==null):!0;case"script":if(t.async&&typeof t.async!="function"&&typeof t.async!="symbol"&&!t.onLoad&&!t.onError&&t.src&&typeof t.src=="string")return!0}return!1}function vm(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function ox(e,t,a,r){if(a.type==="stylesheet"&&(typeof r.media!="string"||matchMedia(r.media).matches!==!1)&&(a.state.loading&4)===0){if(a.instance===null){var u=qa(r.href),f=t.querySelector(Qs(u));if(f){t=f._p,t!==null&&typeof t=="object"&&typeof t.then=="function"&&(e.count++,e=El.bind(e),t.then(e,e)),a.state.loading|=4,a.instance=f,dt(f);return}f=t.ownerDocument||t,r=pm(r),(u=rn.get(u))&&mc(r,u),f=f.createElement("link"),dt(f);var p=f;p._p=new Promise(function(g,x){p.onload=g,p.onerror=x}),bt(f,"link",r),a.instance=f}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(a,t),(t=a.state.preload)&&(a.state.loading&3)===0&&(e.count++,a=El.bind(e),t.addEventListener("load",a),t.addEventListener("error",a))}}var yc=0;function ux(e,t){return e.stylesheets&&e.count===0&&Al(e,e.stylesheets),0<e.count||0<e.imgCount?function(a){var r=setTimeout(function(){if(e.stylesheets&&Al(e,e.stylesheets),e.unsuspend){var f=e.unsuspend;e.unsuspend=null,f()}},6e4+t);0<e.imgBytes&&yc===0&&(yc=62500*Fb());var u=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&Al(e,e.stylesheets),e.unsuspend)){var f=e.unsuspend;e.unsuspend=null,f()}},(e.imgBytes>yc?50:800)+t);return e.unsuspend=a,function(){e.unsuspend=null,clearTimeout(r),clearTimeout(u)}}:null}function El(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Al(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var Tl=null;function Al(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,Tl=new Map,t.forEach(cx,e),Tl=null,El.call(e))}function cx(e,t){if(!(t.state.loading&4)){var a=Tl.get(e);if(a)var r=a.get(null);else{a=new Map,Tl.set(e,a);for(var u=e.querySelectorAll("link[data-precedence],style[data-precedence]"),f=0;f<u.length;f++){var p=u[f];(p.nodeName==="LINK"||p.getAttribute("media")!=="not all")&&(a.set(p.dataset.precedence,p),r=p)}r&&a.set(null,r)}u=t.instance,p=u.getAttribute("data-precedence"),f=a.get(p)||r,f===r&&a.set(null,u),a.set(p,u),this.count++,r=El.bind(this),u.addEventListener("load",r),u.addEventListener("error",r),f?f.parentNode.insertBefore(u,f.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(u,e.firstChild)),t.state.loading|=4}}var Zs={$$typeof:F,Provider:null,Consumer:null,_currentValue:ae,_currentValue2:ae,_threadCount:0};function fx(e,t,a,r,u,f,p,g,x){this.tag=1,this.containerInfo=e,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=fo(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=fo(0),this.hiddenUpdates=fo(null),this.identifierPrefix=r,this.onUncaughtError=u,this.onCaughtError=f,this.onRecoverableError=p,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=x,this.incompleteTransitions=new Map}function bm(e,t,a,r,u,f,p,g,x,O,G,I){return e=new fx(e,t,a,p,x,O,G,I,g),t=1,f===!0&&(t|=24),f=Bt(3,null,null,t),e.current=f,f.stateNode=e,t=Po(),t.refCount++,e.pooledCache=t,t.refCount++,f.memoizedState={element:r,isDehydrated:a,cache:t},eu(f),e}function xm(e){return e?(e=Ea,e):Ea}function Sm(e,t,a,r,u,f){u=xm(u),r.context===null?r.context=u:r.pendingContext=u,r=ri(t),r.payload={element:a},f=f===void 0?null:f,f!==null&&(r.callback=f),a=li(e,r,t),a!==null&&(Ut(a,e,t),Cs(a,e,t))}function wm(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var a=e.retryLane;e.retryLane=a!==0&&a<t?a:t}}function vc(e,t){wm(e,t),(e=e.alternate)&&wm(e,t)}function Em(e){if(e.tag===13||e.tag===31){var t=$i(e,67108864);t!==null&&Ut(t,e,67108864),vc(e,67108864)}}function Tm(e){if(e.tag===13||e.tag===31){var t=Ft();t=ho(t);var a=$i(e,t);a!==null&&Ut(a,e,t),vc(e,t)}}var Ml=!0;function dx(e,t,a,r){var u=z.T;z.T=null;var f=X.p;try{X.p=2,bc(e,t,a,r)}finally{X.p=f,z.T=u}}function hx(e,t,a,r){var u=z.T;z.T=null;var f=X.p;try{X.p=8,bc(e,t,a,r)}finally{X.p=f,z.T=u}}function bc(e,t,a,r){if(Ml){var u=xc(r);if(u===null)sc(e,t,r,Rl,a),Mm(e,r);else if(mx(u,e,t,a,r))r.stopPropagation();else if(Mm(e,r),t&4&&-1<px.indexOf(e)){for(;u!==null;){var f=da(u);if(f!==null)switch(f.tag){case 3:if(f=f.stateNode,f.current.memoizedState.isDehydrated){var p=ki(f.pendingLanes);if(p!==0){var g=f;for(g.pendingLanes|=2,g.entangledLanes|=2;p;){var x=1<<31-tt(p);g.entanglements[1]|=x,p&=~x}wn(f),(_e&6)===0&&(ul=Ve()+500,qs(0))}}break;case 31:case 13:g=$i(f,2),g!==null&&Ut(g,f,2),fl(),vc(f,2)}if(f=xc(r),f===null&&sc(e,t,r,Rl,a),f===u)break;u=f}u!==null&&r.stopPropagation()}else sc(e,t,r,null,a)}}function xc(e){return e=wo(e),Sc(e)}var Rl=null;function Sc(e){if(Rl=null,e=fa(e),e!==null){var t=c(e);if(t===null)e=null;else{var a=t.tag;if(a===13){if(e=d(t),e!==null)return e;e=null}else if(a===31){if(e=h(t),e!==null)return e;e=null}else if(a===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null)}}return Rl=e,null}function Am(e){switch(e){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(dn()){case xt:return 2;case Lt:return 8;case Rn:case ua:return 32;case Dn:return 268435456;default:return 32}default:return 32}}var wc=!1,vi=null,bi=null,xi=null,Ws=new Map,Js=new Map,Si=[],px="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 Mm(e,t){switch(e){case"focusin":case"focusout":vi=null;break;case"dragenter":case"dragleave":bi=null;break;case"mouseover":case"mouseout":xi=null;break;case"pointerover":case"pointerout":Ws.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":Js.delete(t.pointerId)}}function er(e,t,a,r,u,f){return e===null||e.nativeEvent!==f?(e={blockedOn:t,domEventName:a,eventSystemFlags:r,nativeEvent:f,targetContainers:[u]},t!==null&&(t=da(t),t!==null&&Em(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,u!==null&&t.indexOf(u)===-1&&t.push(u),e)}function mx(e,t,a,r,u){switch(t){case"focusin":return vi=er(vi,e,t,a,r,u),!0;case"dragenter":return bi=er(bi,e,t,a,r,u),!0;case"mouseover":return xi=er(xi,e,t,a,r,u),!0;case"pointerover":var f=u.pointerId;return Ws.set(f,er(Ws.get(f)||null,e,t,a,r,u)),!0;case"gotpointercapture":return f=u.pointerId,Js.set(f,er(Js.get(f)||null,e,t,a,r,u)),!0}return!1}function Rm(e){var t=fa(e.target);if(t!==null){var a=c(t);if(a!==null){if(t=a.tag,t===13){if(t=d(a),t!==null){e.blockedOn=t,If(e.priority,function(){Tm(a)});return}}else if(t===31){if(t=h(a),t!==null){e.blockedOn=t,If(e.priority,function(){Tm(a)});return}}else if(t===3&&a.stateNode.current.memoizedState.isDehydrated){e.blockedOn=a.tag===3?a.stateNode.containerInfo:null;return}}}e.blockedOn=null}function Dl(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var a=xc(e.nativeEvent);if(a===null){a=e.nativeEvent;var r=new a.constructor(a.type,a);So=r,a.target.dispatchEvent(r),So=null}else return t=da(a),t!==null&&Em(t),e.blockedOn=a,!1;t.shift()}return!0}function Dm(e,t,a){Dl(e)&&a.delete(t)}function gx(){wc=!1,vi!==null&&Dl(vi)&&(vi=null),bi!==null&&Dl(bi)&&(bi=null),xi!==null&&Dl(xi)&&(xi=null),Ws.forEach(Dm),Js.forEach(Dm)}function Cl(e,t){e.blockedOn===t&&(e.blockedOn=null,wc||(wc=!0,n.unstable_scheduleCallback(n.unstable_NormalPriority,gx)))}var Ol=null;function Cm(e){Ol!==e&&(Ol=e,n.unstable_scheduleCallback(n.unstable_NormalPriority,function(){Ol===e&&(Ol=null);for(var t=0;t<e.length;t+=3){var a=e[t],r=e[t+1],u=e[t+2];if(typeof r!="function"){if(Sc(r||a)===null)continue;break}var f=da(a);f!==null&&(e.splice(t,3),t-=3,xu(f,{pending:!0,data:u,method:a.method,action:r},r,u))}}))}function Xa(e){function t(x){return Cl(x,e)}vi!==null&&Cl(vi,e),bi!==null&&Cl(bi,e),xi!==null&&Cl(xi,e),Ws.forEach(t),Js.forEach(t);for(var a=0;a<Si.length;a++){var r=Si[a];r.blockedOn===e&&(r.blockedOn=null)}for(;0<Si.length&&(a=Si[0],a.blockedOn===null);)Rm(a),a.blockedOn===null&&Si.shift();if(a=(e.ownerDocument||e).$$reactFormReplay,a!=null)for(r=0;r<a.length;r+=3){var u=a[r],f=a[r+1],p=u[Rt]||null;if(typeof f=="function")p||Cm(a);else if(p){var g=null;if(f&&f.hasAttribute("formAction")){if(u=f,p=f[Rt]||null)g=p.formAction;else if(Sc(u)!==null)continue}else g=p.action;typeof g=="function"?a[r+1]=g:(a.splice(r,3),r-=3),Cm(a)}}}function Om(){function e(f){f.canIntercept&&f.info==="react-transition"&&f.intercept({handler:function(){return new Promise(function(p){return u=p})},focusReset:"manual",scroll:"manual"})}function t(){u!==null&&(u(),u=null),r||setTimeout(a,20)}function a(){if(!r&&!navigation.transition){var f=navigation.currentEntry;f&&f.url!=null&&navigation.navigate(f.url,{state:f.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var r=!1,u=null;return navigation.addEventListener("navigate",e),navigation.addEventListener("navigatesuccess",t),navigation.addEventListener("navigateerror",t),setTimeout(a,100),function(){r=!0,navigation.removeEventListener("navigate",e),navigation.removeEventListener("navigatesuccess",t),navigation.removeEventListener("navigateerror",t),u!==null&&(u(),u=null)}}}function Ec(e){this._internalRoot=e}zl.prototype.render=Ec.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(l(409));var a=t.current,r=Ft();Sm(a,r,e,t,null,null)},zl.prototype.unmount=Ec.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;Sm(e.current,2,null,e,null,null),fl(),t[ca]=null}};function zl(e){this._internalRoot=e}zl.prototype.unstable_scheduleHydration=function(e){if(e){var t=$f();e={blockedOn:null,target:e,priority:t};for(var a=0;a<Si.length&&t!==0&&t<Si[a].priority;a++);Si.splice(a,0,e),a===0&&Rm(e)}};var zm=i.version;if(zm!=="19.2.8")throw Error(l(527,zm,"19.2.8"));X.findDOMNode=function(e){var t=e._reactInternals;if(t===void 0)throw typeof e.render=="function"?Error(l(188)):(e=Object.keys(e).join(","),Error(l(268,e)));return e=y(t),e=e!==null?S(e):null,e=e===null?null:e.stateNode,e};var yx={bundleType:0,version:"19.2.8",rendererPackageName:"react-dom",currentDispatcherRef:z,reconcilerVersion:"19.2.8"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var _l=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!_l.isDisabled&&_l.supportsFiber)try{ft=_l.inject(yx),Ye=_l}catch{}}return nr.createRoot=function(e,t){if(!o(e))throw Error(l(299));var a=!1,r="",u=Bh,f=Gh,p=$h;return t!=null&&(t.unstable_strictMode===!0&&(a=!0),t.identifierPrefix!==void 0&&(r=t.identifierPrefix),t.onUncaughtError!==void 0&&(u=t.onUncaughtError),t.onCaughtError!==void 0&&(f=t.onCaughtError),t.onRecoverableError!==void 0&&(p=t.onRecoverableError)),t=bm(e,1,!1,null,null,a,r,null,u,f,p,Om),e[ca]=t.current,ac(e),new Ec(t)},nr.hydrateRoot=function(e,t,a){if(!o(e))throw Error(l(299));var r=!1,u="",f=Bh,p=Gh,g=$h,x=null;return a!=null&&(a.unstable_strictMode===!0&&(r=!0),a.identifierPrefix!==void 0&&(u=a.identifierPrefix),a.onUncaughtError!==void 0&&(f=a.onUncaughtError),a.onCaughtError!==void 0&&(p=a.onCaughtError),a.onRecoverableError!==void 0&&(g=a.onRecoverableError),a.formState!==void 0&&(x=a.formState)),t=bm(e,1,!0,t,a??null,r,u,x,f,p,g,Om),t.context=xm(null),a=t.current,r=Ft(),r=ho(r),u=ri(r),u.callback=null,li(a,u,r),a=r,t.current.lanes=a,fs(t,a),wn(t),e[ca]=t.current,ac(e),new zl(t)},nr.version="19.2.8",nr}var Im;function Rx(){if(Im)return Mc.exports;Im=1;function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(i){console.error(i)}}return n(),Mc.exports=Mx(),Mc.exports}var Dx=Rx();const qe={interactions:"interactions",steps:"steps",errors:"errors",retries:"retries",cpuMs:"cpu.ms",tokensInput:"tokens.input",tokensOutput:"tokens.output",tokensCacheRead:"tokens.cacheRead",tokensReasoning:"tokens.reasoning"};function yn(n,i){const s=n[i];return typeof s=="number"&&Number.isFinite(s)?s:void 0}function Ql(n,i){for(const[s,l]of Object.entries(i)){if(typeof l!="number"||!Number.isFinite(l))continue;const o=s;n[o]=(n[o]??0)+l}}const Cx=[qe.tokensInput,qe.tokensOutput,qe.tokensCacheRead];function vn(n){let i=0,s=!1;for(const l of Cx){const o=yn(n,l);o!==void 0&&(s=!0,i+=o)}return s?i:void 0}function es(n){return{input:yn(n,qe.tokensInput)??0,output:yn(n,qe.tokensOutput)??0,cacheRead:yn(n,qe.tokensCacheRead)??0,reasoning:yn(n,qe.tokensReasoning)??0}}function j0(n){const i=vn(n.measures);if(i!==void 0)return Vm(i/1e3,200);const s=yn(n.measures,qe.cpuMs);if(s!==void 0)return Vm(s/1e3,200)}function on(n){return yn(n.measures,qe.interactions)}function hf(n){return yn(n.measures,qe.steps)??0}function sa(n){return yn(n.measures,qe.errors)??0}function Kc(n){return yn(n.measures,qe.retries)??0}function Vm(n,i){return Math.min(1,Math.log1p(Math.max(0,n))/Math.log1p(i))}const Ox=new Set(["running","waiting"]);function B0(n){return Ox.has(n)}function Il(n,i){return{now:n,dayStart:n,dayEnd:i,machines:new Map,sources:new Map,sessions:new Map,executions:new Map,processes:new Map,artifacts:new Map,transfers:new Map,relationships:[],active:new Set,seen:new Set}}const pf=9e4;function Fm(n,i){if(n.waitingSince===void 0)return;const s=n.waitingSince,l=Math.max(s,i);n.waitingMs+=l-s,n.waits.push({start:s,end:l})}function zx(n,i){const s=`${i.source.id}:${i.source.instance}`;let l=n.sources.get(s);l||(l={id:i.source.id,instance:i.source.instance,origin:i.source.instance,firstSeenAt:i.occurredAt,lastSeenAt:i.occurredAt,events:0,strata:{}},n.sources.set(s,l)),l.events++,i.occurredAt<l.firstSeenAt&&(l.firstSeenAt=i.occurredAt),i.occurredAt>l.lastSeenAt&&(l.lastSeenAt=i.occurredAt),i.stratum&&(l.strata[i.stratum]=(l.strata[i.stratum]??0)+1);const o=i.provenance?.sourceVersion;o&&(l.sourceVersions?l.sourceVersions.includes(o)||l.sourceVersions.push(o):l.sourceVersions=[o])}function _x(n,i){if(n.seen.has(i.id))return;n.seen.add(i.id),i.occurredAt>n.now&&(n.now=i.occurredAt),zx(n,i);const s=i.core??{},l=i.occurredAt;switch(i.subject.type){case"machine":{if(n.machines.has(i.subject.id))break;const o={id:i.subject.id,name:s.machineName??i.subject.id,kind:s.machineKind??"laptop",parentId:s.parentId,firstSeenAt:l};n.machines.set(o.id,o);break}case"session":{if(i.kind==="began"){const o=n.sessions.get(i.subject.id);if(o){o.parentId===void 0&&s.parentId&&(o.parentId=s.parentId),o.projectLabel===void 0&&s.projectLabel&&(o.projectLabel=s.projectLabel),o.taskLabel===void 0&&s.taskLabel&&(o.taskLabel=s.taskLabel);break}const c={id:i.subject.id,machineId:s.machineId??"",label:s.label,projectLabel:s.projectLabel,taskLabel:s.taskLabel,context:i.attrs?.context??s.label??"",executor:s.executor,model:s.model,startedAt:l,executionIds:[],parentId:s.parentId};n.sessions.set(c.id,c)}else if(i.kind==="ended"){const o=n.sessions.get(i.subject.id);o&&(o.endedAt=l)}break}case"execution":Ux(n,i,l);break;case"process":Nx(n,i,l);break;case"artifact":{if(n.artifacts.has(i.subject.id))break;n.artifacts.set(i.subject.id,{id:i.subject.id,kind:"file",path:s.label??i.subject.id,firstSeenAt:l});break}}}function Ux(n,i,s){const l=i.core??{},o=i.subject.id;if(i.kind==="began"){if(n.executions.has(o))return;const d={id:o,sessionId:l.sessionId??l.parentId??"",machineId:l.machineId??"",label:l.label??o,executor:l.executor??"unknown",model:l.model,status:"running",startedAt:s,lastActivityAt:s,measures:{},waitingMs:0,waits:[],parentId:l.parentId,depth:l.depth??0,startBasis:i.basis,boundsAssumption:i.assumption};l.measures&&Ql(d.measures,l.measures),n.executions.set(o,d),n.active.add(o),n.sessions.get(d.sessionId)?.executionIds.push(o);return}const c=n.executions.get(o);if(c)switch(c.endBasis==="inferred"&&c.endedAt!==void 0&&s>c.endedAt&&(i.kind==="progressed"||i.kind==="blocked"||i.kind==="resumed")&&(delete c.endedAt,delete c.endBasis,delete c.outcome,delete c.failure,c.startBasis!=="inferred"&&delete c.boundsAssumption,c.status="running",n.active.add(o)),i.kind){case"progressed":{l.measures&&Ql(c.measures,l.measures),c.lastActivityAt=s,c.status==="idle"&&(c.status="running",n.active.add(o));break}case"blocked":{if(!B0(c.status))break;c.status="waiting",c.waitingSince=s,c.waitReason=l.blockedOn??"input",c.lastActivityAt=s;break}case"resumed":{Fm(c,s),c.status="running",c.waitingSince=void 0,c.waitReason=void 0,c.lastActivityAt=s,n.active.add(o);break}case"ended":{const d=l.outcome==="error";c.status=d?"failed":"completed",c.endedAt=s,c.endBasis=i.basis,i.assumption&&!c.boundsAssumption&&(c.boundsAssumption=i.assumption),c.lastActivityAt=s,c.outcome=l.outcome??"completed",d&&(c.failure={code:l.failureCode??"ERROR",message:l.failureMessage??"Execution failed"}),Fm(c,s),c.waitingSince=void 0,c.waitReason=void 0,n.active.delete(o);break}case"observed":c.lastActivityAt=Math.max(c.lastActivityAt,s);break}}function Nx(n,i,s){const l=i.core??{},o=i.subject.id,c=Number(i.attrs?.["os.pid"]??0);if(i.kind==="began"){if(n.processes.has(o))return;const h={id:o,machineId:l.machineId??"",pid:c,ppid:typeof i.attrs?.["os.ppid"]=="number"?i.attrs["os.ppid"]:void 0,command:l.label??l.executor??String(c),startedAt:s,lastSeenAt:s,status:"running",measures:{}};l.measures&&Ql(h.measures,l.measures),n.processes.set(o,h);return}const d=n.processes.get(o);if(d)if(i.kind==="observed"||i.kind==="progressed"){if(d.lastSeenAt=Math.max(d.lastSeenAt,s),l.measures){const h=l.measures[qe.cpuMs];typeof h=="number"&&(d.measures[qe.cpuMs]=h);const{[qe.cpuMs]:m,...y}=l.measures;Ql(d.measures,y)}}else i.kind==="ended"&&(d.endedAt=s,d.lastSeenAt=Math.max(d.lastSeenAt,s),d.status="exited",d.endInferred=i.basis==="inferred")}function kx(n,i){for(let s=0;s<i.length;s++)_x(n,i[s])}function Lx(n,i){i>n.now&&(n.now=i),i=n.now;for(const s of n.active){const l=n.executions.get(s);if(!l){n.active.delete(s);continue}l.status==="running"&&i-l.lastActivityAt>pf&&(l.status="idle")}}const jx=`Wall-clock time covered by recorded run intervals, with parallel intervals counted once and waiting included. An open running record becomes idle after ${pf/1e3} seconds without an event; its interval then stops at its last event instead of the period end. Explicit waits still count to the period end. A later event or ending includes the intervening silence again. The estimate can decrease or be revised. In flight is not computing time or human attention.`,Ht=n=>({value:n,basis:"measured"}),ir=(n,i)=>({value:n,basis:"inferred",assumption:i});function G0(n){if(n.length===0)return[];n.sort((s,l)=>s.start-l.start);const i=[{start:n[0].start,end:n[0].end}];for(let s=1;s<n.length;s++){const l=n[s],o=i[i.length-1];l.start<=o.end?l.end>o.end&&(o.end=l.end):i.push({start:l.start,end:l.end})}return i}function Bx(n){let i=0;for(const s of n)i+=s.end-s.start;return i}function Gx(n){const i=n.filter(c=>c.end>c.start).flatMap(c=>[{at:c.start,delta:1},{at:c.end,delta:-1}]).sort((c,d)=>c.at-d.at||c.delta-d.delta);let s=0,l=i[0]?.at??0,o=0;for(const c of i)s>=2&&(o+=c.at-l),s+=c.delta,l=c.at;return o}function $0(n){if(n.length===0)return{peak:0,at:0};const i=[];for(const c of n)i.push({t:c.start,d:1}),i.push({t:c.end,d:-1});i.sort((c,d)=>c.t-d.t||c.d-d.d);let s=0,l=0,o=i[0].t;for(const c of i)s+=c.d,s>l&&(l=s,o=c.t);return{peak:l,at:o}}function $x(n){if(n.length===0)return;const i=[...n].sort((l,o)=>l-o),s=i.length>>1;return i.length%2?i[s]:(i[s-1]+i[s])/2}function aa(n,i,s=n.startedAt){const l=Math.max(s,n.startedAt),o=Math.min(i,n.endedAt??(n.status==="idle"?n.lastActivityAt:i));return{start:l,end:Math.max(l,o)}}function Ri(n,i){return n.waitingMs+(n.waitingSince===void 0?0:Math.max(0,i-n.waitingSince))}function I0(n){const i=n.now,s=[...n.executions.values()];let l=0,o=0,c=0;const d={tokens:0,tools:0,requests:0};let h=0,m=0,y=0,S=0,b=0;const R=[],L=new Map;for(const K of s){l+=hf(K),yn(K.measures,qe.steps)!==void 0&&d.requests++;const Y=vn(K.measures),A=on(K);Y!==void 0&&(o+=Y,d.tokens++),A!==void 0&&(c+=A,d.tools++),K.status==="completed"&&K.outcome!=="interrupted"?h++:K.status==="failed"?m++:K.status==="waiting"?y++:K.status==="idle"&&S++;const w=aa(K,i,n.dayStart);R.push(w),b+=K.waitingMs,K.waitingSince!==void 0&&(b+=Math.max(0,i-K.waitingSince));let N=L.get(K.machineId);N||(N={machineId:K.machineId,executions:0,tokens:0,computeTime:0},L.set(K.machineId,N)),N.executions++,N.tokens+=vn(K.measures)??0,N.computeTime+=w.end-w.start}const j=G0(R.map(K=>({...K}))),{peak:D,at:B}=$0(R),Q=Ix(n),Z=Fx(Q);let F=null;for(const K of Q)(!F||K.end-K.start>F.end-F.start)&&(F=K);let V=0;for(const K of n.sessions.values())K.executionIds.some(Y=>n.executions.has(Y))&&V++;return{requests:Ht(l),sessions:Ht(V),executions:Ht(s.length),tokens:Ht(o),toolCalls:Ht(c),accounting:d,timeInFlight:ir(Bx(j),jx),parallelTime:ir(Gx(R),"Wall-clock time in this period with at least two runs in flight. Parallel intervals count once; waiting is included and trailing idle silence is excluded."),peakConcurrency:s.some(K=>K.startBasis==="inferred"||K.endBasis==="inferred"||K.status==="idle")?ir(D,"Peak overlap of the recorded run intervals in this period. Some bounds are inferred, or an idle interval ends at its last observed output."):Ht(D),peakConcurrencyAt:Ht(B),contextSwitches:ir(Z,"Changes between successive non-overlapping groups of runs, each confined to one known working directory. Groups containing concurrent work in different directories are excluded. This does not measure human attention."),longestContextSpan:ir(F,"Longest span of consecutive runs in one working directory, including gaps of up to 15 minutes. Other contexts may run concurrently. This does not measure human focus."),waitingOnYou:Ht(b),completed:Ht(h),failed:Ht(m),waiting:Ht(y),idle:Ht(S),byMachine:L,contextSpans:Q,transfers:Ht(n.transfers.size)}}function Ix(n){const i=[];for(const l of n.executions.values()){const o=n.sessions.get(l.sessionId);if(!o?.context)continue;const c=aa(l,n.now,n.dayStart);c.end>c.start&&i.push({context:o.context,...c})}i.sort((l,o)=>l.start-o.start);const s=[];for(const l of i){const o=s[s.length-1];o&&o.context===l.context&&l.start<=o.end?l.end>o.end&&(o.end=l.end):o&&o.context===l.context?l.start-o.end<=Vx?o.end=Math.max(o.end,l.end):s.push({context:l.context,start:l.start,end:l.end}):s.push({context:l.context,start:l.start,end:l.end})}return s}const Vx=15*6e4;function Fx(n){let i=-1/0,s=new Set,l,o=0;const c=()=>{const d=s.size===1?[...s][0]:void 0;l!==void 0&&d!==void 0&&l!==d&&o++,l=d};for(const d of n)d.end<=d.start||(d.start>=i&&(s.size>0&&c(),s=new Set),s.add(d.context),i=Math.max(i,d.end));return s.size>0&&c(),o}function Hx(n){return{key:n,runs:0,tokens:0,tokenRuns:0,medianRuns:0,computeMs:0,failed:0,waitingMs:0,toolCalls:0}}function Oc(n,i){const s=new Map,l=new Map;for(const o of n.executions.values()){const c=i(o,n.sessions.get(o.sessionId));if(c===void 0)continue;let d=s.get(c);d||(d=Hx(c),s.set(c,d)),d.runs++;const h=vn(o.measures);if(h!==void 0&&(d.tokens+=h,d.tokenRuns++,o.endedAt!==void 0&&o.startedAt>=n.dayStart&&o.endedAt<=n.now&&o.endedAt<n.dayEnd)){let y=l.get(c);y||(y=[],l.set(c,y)),y.push(h)}const m=aa(o,n.now,n.dayStart);d.computeMs+=m.end-m.start,d.waitingMs+=Ri(o,n.now),d.toolCalls+=on(o)??0,o.status==="failed"&&d.failed++}for(const[o,c]of l){const d=s.get(o);d&&(d.medianTokens=$x(c),d.medianRuns=c.length)}return[...s.values()].sort((o,c)=>c.computeMs-o.computeMs)}function qx(n){const i={input:0,output:0,cacheRead:0,reasoning:0,total:0};for(const s of n.executions.values()){const l=es(s.measures);i.input+=l.input,i.output+=l.output,i.cacheRead+=l.cacheRead,i.reasoning+=l.reasoning}return i.total=i.input+i.output+i.cacheRead,i}function Yx(n){const i={count:0,totalMs:0,longestMs:0,openNow:0};for(const s of n.executions.values()){for(const l of s.waits){i.count++;const o=l.end-l.start;i.totalMs+=o,o>i.longestMs&&(i.longestMs=o)}if(s.waitingSince!==void 0){i.count++,i.openNow++;const l=n.now-s.waitingSince;i.totalMs+=l,l>i.longestMs&&(i.longestMs=l)}}return i}function Xx(n){const i={toolCalls:0,toolErrors:0,retries:0,failed:0,interrupted:0,completed:0};for(const s of n.executions.values())i.toolCalls+=on(s)??0,i.toolErrors+=sa(s),i.retries+=Kc(s),s.status==="failed"?i.failed++:s.outcome==="interrupted"?i.interrupted++:s.outcome==="completed"&&i.completed++;return i}function Kx(n){return Qx(n).map(i=>({hour:new Date(i.from).getHours(),computeMs:i.computeMs,runs:i.runs,peak:i.peak}))}function Qx(n,i){const s=[...n.executions.values()].map(d=>{const h=aa(d,n.now);return{start:Math.max(n.dayStart,h.start),end:Math.min(n.now,h.end)}}).filter(d=>d.end>d.start);if(s.length===0)return[];const l=G0(s.map(d=>({...d}))),o=new Date(n.dayStart);o.setMinutes(0,0,0);const c=[];for(let d=o.getTime();d<n.now;){const h=new Date(d);h.setTime(d+36e5);const m=h.getTime(),y=l.reduce((b,R)=>b+Math.max(0,Math.min(R.end,m)-Math.max(R.start,d)),0),S=s.filter(b=>b.start<m&&b.end>d).map(b=>({start:Math.max(b.start,d),end:Math.min(b.end,m)}));c.push({from:d,to:m,computeMs:y,runs:S.length,peak:$0(S).peak}),d=m}return c}const V0=1e3,Hm=60*V0;function Ze(n){if(!Number.isFinite(n)||n<=0)return"0m";if(n<Hm)return`${Math.max(1,Math.round(n/V0))}s`;const i=Math.round(n/Hm),s=Math.floor(i/60),l=i%60;return s===0?`${l}m`:l===0?`${s}h`:`${s}h ${l}m`}function ct(n){if(!Number.isFinite(n))return"—";const i=Math.abs(n);return i>=1e9?`${(n/1e9).toFixed(i>=1e10?0:2)}B`:i>=1e6?`${(n/1e6).toFixed(i>=1e7?0:2)}M`:i>=1e3?`${(n/1e3).toFixed(i>=1e4?0:1)}k`:String(Math.round(n))}function ns(n,i="NOT OBSERVED"){return n===void 0?i:ct(n)}function zc(n,i){if(i<=0)return"—";const s=n/i*100;return s>0&&s<1?"<1%":`${Math.round(s)}%`}function Px(n){return n===void 0||!Number.isFinite(n)?"—":n>=1e9?`${(n/1e9).toFixed(1)} GB`:n>=1e6?`${(n/1e6).toFixed(0)} MB`:n>=1e3?`${(n/1e3).toFixed(0)} KB`:`${n} B`}function ts(n){const i=new Date(n);return`${String(i.getHours()).padStart(2,"0")}:${String(i.getMinutes()).padStart(2,"0")}`}function cr(n){const i=n.split("/").filter(Boolean);return i[i.length-1]??n}const Zx=6e4;function F0(n,i){const s=[],l=i.contextSpans,o=i.longestContextSpan.value;if(i.executions.value===0)return{headline:"NO RUN RECORDS",clauses:["No runs observed in this window. This does not establish inactivity."]};const c=i.peakConcurrency.value>1?`UP TO ${i.peakConcurrency.value} RUNS AT ONCE`:"ONE RUN AT A TIME";if(i.peakConcurrency.value>=2?(s.push(`Up to ${i.peakConcurrency.value} runs in flight at once; ${Ze(i.timeInFlight.value)} of wall-clock time had a run in flight.`),s.push(`Parallel runs overlapped for ${Ze(i.parallelTime.value)} within this period; each instant counts once.`)):s.push(`Runs happened one at a time, across ${Ze(i.timeInFlight.value)} of wall-clock time.`),o&&s.push(`The longest context span covered ${Ze(o.end-o.start)} in ${cr(o.context)}; gaps of up to 15 minutes are included.`),i.contextSwitches.value>0){const d=new Set(l.map(h=>h.context)).size;s.push(`${i.contextSwitches.value} sequential ${i.contextSwitches.value===1?"change":"changes"} between working directories, across ${d} contexts; concurrent contexts are excluded.`)}if(i.waitingOnYou.value>Zx&&s.push(`${Ze(i.waitingOnYou.value)} was spent with a run waiting on your answer.`),i.failed.value>0&&s.push(`${i.failed.value} of ${i.executions.value} runs ended in failure; ${i.completed.value} completed.`),i.byMachine.size>1){const d=[...i.byMachine.values()].sort((h,m)=>m.computeTime-h.computeTime).map(h=>`${n.machines.get(h.machineId)?.name??h.machineId} ${Ze(h.computeTime)}`);s.push(`Summed run intervals by machine: ${d.join(", ")}.`)}return{headline:c,clauses:s}}function Wx(n){let i=2166136261;for(let s=0;s<n.length;s++)i^=n.charCodeAt(s),i=Math.imul(i,16777619);return i>>>0}function Pl(n,i=0){return Wx(n+"#"+i)%1e5/1e5}const _c=[{x:430,y:508,extentX:300,extentY:186},{x:838,y:322,extentX:186,extentY:116}];function Jx(n){if(n<_c.length)return _c[n];const s=-.9+(n-_c.length)*1.15;return{x:620+Math.cos(s)*520,y:300+Math.sin(s)*250,extentX:150,extentY:94}}function e1(n){const i=s=>s==="laptop"?0:s==="desktop"?1:2;return[...n].sort((s,l)=>i(s.kind)-i(l.kind)||s.firstSeenAt-l.firstSeenAt||(s.id<l.id?-1:s.id>l.id?1:0))}function qm(n,i){const s=Pl(i,1),l=Pl(i,2),o=s*Math.PI*2+l*2.399963,c=.34+.46*Math.sqrt(l);return{x:n.x+Math.cos(o)*n.extentX*c,y:n.y+Math.sin(o)*n.extentY*c}}const En={spanX:1160,strataTop:812,strataHeight:360},t1=3,n1=4,Ym=30,i1=74;function H0(n){return Ym+n*(i1-Ym)}function Xm(n,i,s){let l=null,o=1/0;for(const d of n.disturbances){const h=H0(d.extent),m=i-d.x,y=(s-d.y)*1.5,S=Math.hypot(m,y);S<h*1.3&&S<o&&(o=S,l={kind:"disturbance",id:d.id,x:d.x,y:d.y})}if(l)return l;for(const d of n.couplings){const h=n.masses.find(D=>D.id===d.fromMassId),m=n.masses.find(D=>D.id===d.toMassId);if(!h||!m)continue;const y=m.x-h.x,S=m.y-h.y,b=y*y+S*S;if(b===0)continue;const R=((i-h.x)*y+(s-h.y)*S)/b;if(R<.05||R>.95)continue;const L=h.x+y*R,j=h.y+S*R;if(Math.hypot(i-L,(s-j)*1.5)<50)return{kind:"coupling",id:d.id,x:L,y:j}}for(const d of n.masses){const h=(i-d.x)/d.extentX,m=(s-d.y)/d.extentY;if(h*h+m*m<1.1)return{kind:"mass",id:d.id,x:d.x,y:d.y}}const c=En.strataTop;if(s>=c&&s<=c+En.strataHeight){const d=Math.max(1,n.masses.length),h=En.strataHeight/d,m=Math.min(d-1,Math.floor((s-c)/h)),y=i/En.spanX;let S=null,b=1/0;const R=t1/En.spanX,L=n1/En.spanX;for(const j of n.strata){if(j.lane!==m)continue;const D=Math.max(R,j.endFraction-j.startFraction);y<j.startFraction-L||y>j.startFraction+D+L||D<b&&(b=D,S={kind:"stratum",id:j.id,x:i,y:s})}if(S)return S}return null}const Km=64,a1=8,s1=8,Qm=16,Pm=.45;function r1(n,i){switch(n.status){case"running":{const s=i-n.lastActivityAt;return .55+.45*Math.exp(-s/45e3)}case"waiting":return .08;case"failed":return .9;case"completed":return 0;case"idle":return .03}}const Zm=.32;function l1(n){const i=j0(n),s=n.depth>0?.62:1;return i===void 0?Zm*s:Math.min(1,(Zm+.68*i)*s)}function o1(n,i){const s=Math.max(1,(n.endedAt??i)-n.startedAt),l=(on(n)??0)/(s/6e4);return Math.min(1,.25+l/24)}function Wm(n){return(n.status==="failed"?3:n.status==="waiting"?2:n.status==="running"?1:0)*1e15+n.lastActivityAt}function u1(n){const i=new Set,s=new Set,l=new Map,o=new Map,c=(d,h,m)=>{const y=d.get(h);y?y.push(m):d.set(h,[m])};for(const d of n.relationships){const{from:h,to:m,kind:y}=d;y==="ran-as"?(h.type==="execution"&&i.add(h.id),m.type==="execution"&&i.add(m.id),h.type==="session"&&m.type==="process"&&s.add(h.id),m.type==="session"&&h.type==="process"&&s.add(m.id),h.type==="execution"&&m.type==="session"?l.set(h.id,m.id):h.type==="session"&&m.type==="execution"&&l.set(m.id,h.id)):y==="same-as"&&h.type==="execution"&&m.type==="execution"&&(i.add(h.id),i.add(m.id),c(o,h.id,m.id),c(o,m.id,h.id))}return{resolvedExecutions:i,sessionsWithProcess:s,runObservesSession:l,sameExecution:o}}function c1(n,i){const l=n.startBasis===void 0?.5:n.startBasis==="measured"?1:0,o=n.endBasis===void 0?.5:n.endBasis==="measured"?1:0,c=n.endedAt===void 0?l:(l+o)/2,d=j0(n)===void 0?0:1,h=i.resolvedExecutions.has(n.id)||i.sessionsWithProcess.has(n.sessionId)?1:0;return(1+c+d+h)/4}function Jm(n){let i=1;for(const s of n)i*=1-Math.min(1,Math.max(0,s));return 1-i}function eg(n,i,s,l){const o=Math.max(n,s),c=Math.min(i,l);if(c<o)return 0;const d=Math.max(i,l)-Math.min(n,s);return d<=0?1:(c-o)/d}function f1(n){const i=n.now,s=e1(n.machines.values()).slice(0,a1),l=new Map,o=[];let c=1;const d=new Map;for(const A of n.executions.values()){const w=(d.get(A.machineId)??0)+1;d.set(A.machineId,w),w>c&&(c=w)}s.forEach((A,w)=>{const N=Jx(w);l.set(A.id,N),o.push({id:A.id,name:A.name,kind:A.kind,x:N.x,y:N.y,extentX:N.extentX,extentY:N.extentY,prominence:(d.get(A.id)??0)/c,seed:Pl(A.id,7)})});const h=45e3,m=[];for(const A of n.executions.values())(A.status==="completed"||A.status==="failed")&&i-(A.endedAt??i)>h||A.status==="idle"&&i-A.lastActivityAt>h*4||l.has(A.machineId)&&m.push(A);m.length>Km&&(m.sort((A,w)=>Wm(w)-Wm(A)),m.length=Km);const y=u1(n),S=A=>{const w=l.get(A.machineId),{x:N,y:te}=qm(w,A.id),ne=n.sessions.get(A.sessionId);return{id:A.id,massId:A.machineId,sessionId:A.sessionId,x:N,y:te,extent:l1(A),energy:r1(A,i),rate:o1(A,i),phase:Pl(A.id,3)*Math.PI*2,status:A.status,label:A.label,projectLabel:ne?.projectLabel,taskLabel:ne?.taskLabel,statusSince:A.waitingSince??A.endedAt??A.startedAt,articulation:c1(A,y),shoulder:0,observers:1}},b=new Set(m.map(A=>A.id)),R=new Set,L=[],j=A=>[A.startedAt,A.endedAt??i];for(const A of[...m].sort((w,N)=>w.id<N.id?-1:1)){if(R.has(A.id))continue;const w=[A];R.add(A.id);for(let de=0;de<w.length;de++)for(const ue of y.sameExecution.get(w[de].id)??[])!b.has(ue)||R.has(ue)||(R.add(ue),w.push(n.executions.get(ue)));if(w.length===1){L.push(S(A));continue}const N=w.map(S),te=N.reduce((de,ue)=>ue.articulation>de.articulation||ue.articulation===de.articulation&&ue.id<de.id?ue:de);let ne=1;const[le,Ge]=j(n.executions.get(te.id));for(const de of w){const[ue,z]=j(de);ne=Math.min(ne,eg(le,Ge,ue,z))}L.push({...te,extent:Math.max(...N.map(de=>de.extent)),energy:Math.max(...N.map(de=>de.energy)),articulation:Jm(N.map(de=>de.articulation)),shoulder:Math.min(Pm,1-ne),observers:w.length})}const D=new Map;for(const A of L){if(y.runObservesSession.has(A.id))continue;const w=D.get(A.sessionId);w?w.push(A):D.set(A.sessionId,[A])}const B=new Map,Q=[];for(const A of L){const w=y.runObservesSession.get(A.id),N=w?D.get(w):void 0;if(!w||!N||N.length===0){if(Q.push(A),w){const z=D.get(A.sessionId);z?z.push(A):D.set(A.sessionId,[A])}continue}const te=n.executions.get(A.id);let ne=1/0,le=-1/0;for(const z of N){const[X,ae]=j(n.executions.get(z.id));ne=Math.min(ne,X),le=Math.max(le,ae)}const[Ge,de]=j(te),ue=B.get(w)??{articulations:[],coincidence:1};ue.articulations.push(A.articulation),ue.coincidence=Math.min(ue.coincidence,eg(Ge,de,ne,le)),B.set(w,ue)}const Z=[];for(const A of[...D.keys()].sort()){const w=D.get(A),N=n.sessions.get(A);if(!N||w.length===0)continue;let te=0,ne=0;for(const z of w)te+=z.x,ne+=z.y;te/=w.length,ne/=w.length;let le=0,Ge=0;for(const z of w){const X=H0(z.extent);le=Math.max(le,Math.abs(z.x-te)+X*1.5),Ge=Math.max(Ge,Math.abs(z.y-ne)+X)}const de=B.get(A),ue=Math.max(...w.map(z=>z.articulation));Z.push({id:A,massId:w[0].massId,x:te,y:ne,extentX:Math.max(le,52),extentY:Math.max(Ge,36),presence:1,articulation:de?Jm([ue,...de.articulations]):ue,parentId:N.parentId,empty:!1,shoulder:de?Math.min(Pm,1-de.coincidence):0,observers:1+(de?.articulations.length??0),label:N.label??N.executor??A,projectLabel:N.projectLabel,taskLabel:N.taskLabel})}for(const A of[...n.sessions.values()].sort((w,N)=>w.id<N.id?-1:1)){if(A.executionIds.length>0||A.endedAt!==void 0&&i-A.endedAt>h)continue;const w=l.get(A.machineId);if(!w)continue;const{x:N,y:te}=qm(w,`session-presence:${A.id}`);Z.push({id:A.id,massId:A.machineId,x:N,y:te,extentX:64,extentY:42,presence:1,articulation:y.sessionsWithProcess.has(A.id)?.5:.25,parentId:A.parentId,empty:!0,shoulder:0,observers:1,label:A.label??A.executor??A.id,projectLabel:A.projectLabel,taskLabel:A.taskLabel})}if(Z.length>Qm){const A=w=>w.empty?0:D.get(w.id)?.length??0;Z.sort((w,N)=>A(N)-A(w)||(w.id<N.id?-1:1)),Z.length=Qm}const F=[];for(const A of n.transfers.values())if(A.endedAt===void 0&&!(!l.has(A.fromMachineId)||!l.has(A.toMachineId))){if(F.length>=s1)break;F.push({id:A.id,fromMassId:A.fromMachineId,toMassId:A.toMachineId,energy:1,label:A.label})}const V=new Map;s.forEach((A,w)=>V.set(A.id,w));const K=Math.max(1,n.dayEnd-n.dayStart),Y=[];for(const A of n.executions.values()){const w=V.get(A.machineId);if(w===void 0)continue;const N=(A.startedAt-n.dayStart)/K,te=((A.endedAt??i)-n.dayStart)/K;Y.push({id:A.id,massId:A.machineId,lane:w,startFraction:Math.max(0,Math.min(1,N)),endFraction:Math.max(0,Math.min(1,te)),status:A.status,label:A.label})}return{time:i,masses:o,disturbances:Q,plinths:Z,couplings:F,strata:Y}}const Vl="synthetic";let d1=0;const Nt=(n,i,s,l)=>({id:`syn:${(d1++).toString(36)}`,source:{id:Vl,instance:"replay"},occurredAt:n,observedAt:n,clock:"wall",kind:i,subject:s,core:l,basis:"measured",stratum:"stored-semantics"});function h1(n){let i=n>>>0;return()=>{i=i+1831565813>>>0;let s=Math.imul(i^i>>>15,1|i);return s=s+Math.imul(s^s>>>7,61|s)^s,((s^s>>>14)>>>0)/4294967296}}const Qa=6e4,p1=60*Qa,tg=["~/atlas","~/harbour-cli","~/ledger","~/studio-site"],ng=[{id:"macbook",name:"MACBOOK",kind:"laptop",firstSeenAt:0},{id:"mini",name:"MINI-PC",kind:"desktop",firstSeenAt:0}];function ig(n,i){return{[qe.tokensInput]:Math.round(400+i()*3e3*n),[qe.tokensOutput]:Math.round(60+i()*500*n),[qe.tokensCacheRead]:Math.round(1200+i()*9e3*n),[qe.tokensReasoning]:Math.round(20+i()*300*n)}}function m1(n={}){const i=n.seed??57,s=n.dayStart??Date.parse("2026-08-29T07:00:00Z"),l=n.duration??15*p1,o=n.runCount??24,c=n.failureRate??.09,d=n.waitRate??.2,h=s+l,m=h1(i),y=[];for(const L of ng)y.push(Nt(s,"began",{type:"machine",id:L.id},{machineName:L.name,machineKind:L.kind}));const S=Math.max(1,Math.round(o/4));let b=0,R=0;for(let L=0;L<S;L++){const j=s+L/S*l+m()*20*Qa,D=2+Math.floor(m()*4);for(let B=0;B<D;B++){const Q=ng[m()<.66?0:1],Z=tg[Math.floor(m()*tg.length)],F=`syn-session-${b++}`,V=j+B*(2+m()*9)*Qa;if(V>h)continue;const K=m()<.7?"deepseek-v4-flash":"deepseek-v4";y.push({...Nt(V,"began",{type:"session",id:F},{machineId:Q.id,executor:Vl,model:K}),attrs:{context:Z}});const Y=`syn-proc-${R++}`,A=Z.split("/").pop().toUpperCase();y.push(Nt(V,"began",{type:"execution",id:Y},{machineId:Q.id,sessionId:F,label:A,executor:Vl,model:K,depth:0}));const w=m()<.35,N=(w?25+m()*95:2+m()*14)*Qa,te=Math.max(1,Math.ceil(N/(pf*.6))),ne=w?4:1;let le=V;const Ge=N/te;for(let ue=0;ue<te&&(le+=Ge,!(le>h));ue++)y.push(Nt(le,"progressed",{type:"execution",id:Y},{measures:{...ig(ne,m),[qe.interactions]:Math.floor(m()*4),[qe.errors]:m()<.06?1:0,[qe.steps]:1}}));if(m()<d){const ue=V+N*(.35+m()*.3),z=ue+(1+m()*18)*Qa;ue<h&&(y.push(Nt(ue,"blocked",{type:"execution",id:Y},{blockedOn:"approval"})),z<h&&y.push(Nt(z,"resumed",{type:"execution",id:Y})))}if(w&&m()<.5){const ue=`syn-proc-${R++}`,z=V+N*.25,X=z+N*.4;z<h&&y.push(Nt(z,"began",{type:"execution",id:ue},{machineId:Q.id,sessionId:F,label:`${A} · SUB`,executor:Vl,model:K,parentId:Y,depth:1}),Nt((z+X)/2,"progressed",{type:"execution",id:ue},{measures:{...ig(1,m),[qe.interactions]:3,[qe.steps]:4}}),Nt(Math.min(h,X),"ended",{type:"execution",id:ue},{outcome:"completed"}))}const de=Math.min(h,V+N);if(m()<c?y.push(Nt(de,"ended",{type:"execution",id:Y},{outcome:"error",failureCode:"TRANSPORT",failureMessage:"Provider request failed"})):y.push(Nt(de,"ended",{type:"execution",id:Y},{outcome:"completed"})),y.push(Nt(de,"ended",{type:"session",id:F})),Q.id==="mini"&&m()<.3){const ue=de+3e4,z=ue+(1+m()*4)*Qa;if(z<h){const X=`syn-xfer-${R}`;y.push({...Nt(ue,"began",{type:"artifact",id:X},{label:"ARTIFACT SYNC",machineId:"mini"}),attrs:{"syn.transfer":!0,"syn.from":"mini","syn.to":"macbook","syn.bytes":Math.round(2e8+m()*3e9)}},{...Nt(z,"ended",{type:"artifact",id:X}),attrs:{"syn.transfer":!0}})}}}}return y.sort((L,j)=>L.occurredAt-j.occurredAt),{events:y,dayStart:s,dayEnd:h}}class g1{constructor(i={},s=180){this.timeScale=s;const l=m1(i);this.script=l.events,this.dayStart=l.dayStart,this.dayEnd=l.dayEnd,this.simNow=l.dayStart}timeScale;script;dayStart;dayEnd;cursor=0;simNow;timer=null;listener=null;batch=[];info(){return{id:"synthetic",name:"SYNTHETIC",kind:"synthetic",detail:`${this.script.length} events · ${this.timeScale}× replay`}}bounds(){return{dayStart:this.dayStart,dayEnd:this.dayEnd}}now(){return this.simNow}advanceTo(i){for(this.simNow=Math.max(this.simNow,i),this.batch.length=0;this.cursor<this.script.length&&this.script[this.cursor].occurredAt<=i;)this.batch.push(this.script[this.cursor++]);return this.batch.length&&this.listener&&this.listener(this.batch),this.batch}get exhausted(){return this.cursor>=this.script.length}subscribe(i){this.listener=i;const s=Date.now();return this.timer=setInterval(()=>{const l=this.dayStart+(Date.now()-s)*this.timeScale;this.advanceTo(l),this.exhausted&&this.timer&&(clearInterval(this.timer),this.timer=null)},250),()=>{this.timer&&clearInterval(this.timer),this.timer=null,this.listener=null}}simTimeAt(i,s){return this.dayStart+(s-i)*this.timeScale}}function ag(n){const i=Il(n.dayStart,n.dayEnd);i.now=n.now;for(const s of n.machines)i.machines.set(s.id,s);for(const s of n.sources)i.sources.set(`${s.id}:${s.instance}`,s);for(const s of n.sessions)i.sessions.set(s.id,s);for(const s of n.executions)i.executions.set(s.id,s),B0(s.status)&&i.active.add(s.id);for(const s of n.processes)i.processes.set(s.id,s);return i.processTotals=n.processTotals,i.relationships=n.relationships,i}async function y1(){const n=await fetch("/api/state");if(!n.ok)throw new Error(`state failed: ${n.status}`);return n.json()}async function Qc(n,i){try{const s=await fetch(`/api/collect?from=${n}&to=${i}`),l=await s.json().catch(()=>({}));return{ok:s.ok,fault:l.fault,error:l.error}}catch(s){return{ok:!1,error:s instanceof Error?s.message:String(s)}}}async function Pc(n,i){const s=await fetch(`/api/world?from=${n}&to=${i}`);if(!s.ok)throw new Error(`world failed: ${s.status}`);return s.json()}async function v1(n,i){const s=await fetch(`/api/detail?type=${n}&id=${encodeURIComponent(i)}`);if(!s.ok)throw new Error(`detail failed: ${s.status}`);return s.json()}const b1=4e3,x1=3;class S1{constructor(i,s,l={}){this.initial=i,this.state=s,this.options=l,this.lastCollect=i.to}initial;state;options;timer=null;stopped=!1;lastCollect;generation=0;failures=0;trouble=null;get pollMs(){return this.options.pollMs??b1}get inFlight(){return this.running}running=!1;report(i){this.trouble?.kind===i?.kind&&this.trouble?.consecutiveFailures===i?.consecutiveFailures||(this.trouble=i,this.options.onTrouble?.(i))}info(){return{id:"capture",name:"CAPTURE",kind:"live",detail:this.state.store.bySource.filter(s=>s.source!=="host").map(s=>`${s.source} ${s.events}`).join(" · ")||"no sources have contributed yet"}}bounds(){return{dayStart:this.initial.from,dayEnd:this.initial.to}}now(){return Date.now()}relationships(){return this.initial.world.relationships}subscribe(i){queueMicrotask(()=>{this.stopped||i(ag(this.initial.world),this.initial.waits)});const s=async()=>{if(this.stopped)return;this.running=!0;const l=++this.generation;try{const o=Date.now(),c=await Qc(this.lastCollect,o);c.fault&&this.report({kind:"store-fault",message:c.fault.message,detail:c.fault.remedy,consecutiveFailures:0});const d=await Pc(this.initial.from,o);if(this.stopped||l!==this.generation)return;this.lastCollect=o,this.failures=0,c.fault||this.report(null),i(ag(d.world),d.waits)}catch(o){this.failures++,this.failures>=x1&&this.report({kind:"capture-failing",message:`capture has failed ${this.failures} times in a row`,detail:o instanceof Error?o.message:String(o),consecutiveFailures:this.failures})}finally{this.running=!1,this.stopped||(this.timer=setTimeout(()=>{s()},this.pollMs))}};return this.timer=setTimeout(()=>{s()},this.pollMs),()=>{this.stopped=!0,this.timer&&clearTimeout(this.timer),this.timer=null}}}let mf=class extends Error{code;severity;fix;where;cause;detail;constructor(i){super(i.message,{cause:i.cause}),this.name="VGPUError",this.code=i.code,this.severity=i.severity??"error",this.fix=i.fix,this.where=i.where,this.cause=i.cause,this.detail=i.detail}};class cn extends mf{constructor(i){super({...i,severity:"error"}),this.name="ValidationError"}}function w1(n){return new mf({code:"VGPU-FEATURE-UNSUPPORTED",message:`Adapter does not support requested feature(s): ${n.map(i=>`"${i}"`).join(", ")}.`,fix:"Remove the unsupported name(s) from init({ requiredFeatures: [...] }) or run on an adapter that supports them; gate optional code paths on device.features after init.",where:"init"})}function E1(n,i){if(!n)return;const s=(i??[]).filter(l=>!n.has(l));if(s.length)throw w1(s)}const T1={map_read:1,map_write:2,copy_src:4,copy_dst:8,index:16,vertex:32,uniform:64,storage:128,indirect:256,query_resolve:512};function pr(n){const i=globalThis.GPUBufferUsage;return n.reduce((s,l)=>s|A1(l,i),0)}function A1(n,i){const s=n.toUpperCase();return i?.[s]??T1[n]}function sg(){return globalThis.GPUMapMode?.READ??1}const M1={copy_src:1,copy_dst:2,texture_binding:4,storage_binding:8,render_attachment:16};function R1(n){const i=globalThis.GPUTextureUsage;return n.reduce((s,l)=>s|D1(l,i),0)}function D1(n,i){const s=n.toUpperCase();return i?.[s]??M1[n]}function q0(n){return"__vgpuMockBytes"in n}function rg(n){return"__vgpuMockBytes"in n}let C1=1;function so(n){return Object.freeze({kind:n,id:C1++})}class ro{callbacks=new Set;destroyed=!1;onDestroy(i,s){return this.destroyed?(s(i),()=>{}):(this.callbacks.add(s),()=>{this.callbacks.delete(s)})}emit(i){if(this.destroyed)return!1;this.destroyed=!0;const s=[...this.callbacks];this.callbacks.clear();for(const l of s)l(i);return!0}}class Di{device;gpu;options;ownership;destroySignal=new ro;identity=so("buffer");destroyed=!1;constructor(i,s,l,o="owned"){this.device=i,this.gpu=s,this.options=l,this.ownership=o,Object.defineProperty(this,"assertUsable",{value:c=>this.#e(c)})}get resourceIdentity(){return this.identity}onDestroy(i){return this.destroySignal.onDestroy(this,i)}#e(i="Buffer"){if(this.destroyed)throw new cn({code:"VGPU-BUFFER-DISPOSED",message:"Buffer is destroyed.",where:i,fix:"Wrap or create a live GPUBuffer before using it."});this.device.assertUsable(i)}write(i,s=0){this.#e("Buffer.write"),this.ownership==="external"&&this.validateExternalOperation("write",s,i.byteLength,"copy_dst");try{this.device.queue.writeBuffer(this.gpu,s,i)}catch(l){throw this.ownership!=="external"?l:Ul("Buffer.write","The external GPUBuffer rejected the write operation.",l)}}async read(i,s=0){this.#e("Buffer.read"),this.ownership==="external"&&this.validateExternalOperation("read",s,i,"copy_src");try{const l=await this.device.readback.read(this.gpu,i,s);return this.#e("Buffer.read"),l}catch(l){throw l instanceof cn||this.ownership!=="external"?l:Ul("Buffer.read","The external GPUBuffer rejected the read operation.",l)}}destroy(){this.destroyed||(this.destroyed=!0,this.destroySignal.emit(this),this.ownership==="owned"&&!q0(this.gpu)&&this.gpu.destroy())}dispose(){this.destroy()}validateExternalOperation(i,s,l,o){if(!(Number.isSafeInteger(s)&&s>=0&&s%4===0&&Number.isSafeInteger(l)&&l>=0&&l%4===0&&s<=this.options.size&&l<=this.options.size-s))throw Ul(`Buffer.${i}`,"External buffer offsets and lengths must be non-negative, 4-byte aligned, and within the buffer size.");if((this.gpu.usage&pr([o]))===0)throw Ul(`Buffer.${i}`,`External buffer is missing ${o.toUpperCase()} usage.`)}}function Ul(n,i,s){return new cn({code:"VGPU-EXTERNAL-BUFFER-VALIDATION",message:i,where:n,cause:s,fix:"Use a buffer with the required usage flags and an aligned in-range operation."})}function O1(n){if(U1(n))throw N1();const i={version:1,mappings:[]},s={version:1,modules:[{path:"<runtime>",text:n}],diagnostics:[],sourceMap:i,cacheKey:z1(n)};return{kind:"wgsl",wgsl:n,source:{text:n,path:"<runtime>",imports:[]},ast:s,sourceMap:i,diagnostics:[],cacheKey:s.cacheKey,entryPoints:_1(n),stats:{lines:n.split(/\r?\n/).length,bytes:new TextEncoder().encode(n).byteLength,bindGroups:0}}}function z1(n){let i=2166136261;for(let s=0;s<n.length;s++)i=Math.imul(i^n.charCodeAt(s),16777619);return{default:`vgpu-wgsl-1:${(i>>>0).toString(16).padStart(8,"0")}`}}function _1(n){const i=[],s=/@(vertex|fragment|compute)\s+fn\s+([A-Za-z_][A-Za-z0-9_]*)/g;for(const l of n.matchAll(s))i.push(l[2]);return i}function U1(n){const i=n.replace(/\/\*[\s\S]*?\*\//g,"").replace(/\/\/.*$/gm,"").trimStart();return i.startsWith("import ")||i.startsWith("import{")}function N1(){const n=new Error("Runtime WGSL strings cannot contain import statements. Use a build-time loader or @vgpu/wgsl/runtime.");return n.name="VGPUWGSLRuntimeImportError",n.code="VGPU-WGSL-RUNTIME-IMPORT",n.severity="error",n.source="wgsl",n}const lg=pr(["copy_dst","map_read"]);class k1{device;constructor(i){this.device=i}async read(i,s,l){if(q0(i))return i.__vgpuMockBytes.slice(l,l+s).buffer;const o=this.device.createBuffer({size:s,usage:lg});try{const c=this.device.createCommandEncoder();c.copyBufferToBuffer(i,l,o,0,s),this.device.queue.submit([c.finish()]),await o.mapAsync(sg());const d=o.getMappedRange().slice(0);return og(o),d}finally{ug(o)}}async readTexture(i,s,l){const[o,c]=s,d=Zl(l,"Readback.readTexture"),h=d.bytesPerPixel,m=L1(o*h,256),y=m*c,S=this.device.createBuffer({size:y,usage:lg});let b;try{const R=this.device.createCommandEncoder();R.copyTextureToBuffer({texture:i},{buffer:S,bytesPerRow:m,rowsPerImage:c},{width:o,height:c}),this.device.queue.submit([R.finish()]),await S.mapAsync(sg());const L=new Uint8Array(S.getMappedRange());b=new Uint8Array(o*c*h);for(let j=0;j<c;j++){const D=j*m,B=j*o*h;b.set(L.subarray(D,D+o*h),B)}og(S)}finally{ug(S)}return d.swizzle==="bgra-to-rgba"&&Y0(b),b}destroy(){}}function og(n){try{n.unmap()}catch{}}function ug(n){try{n.destroy()}catch{}}function L1(n,i){return Math.ceil(n/i)*i}const cg={r8unorm:{bytesPerPixel:1,components:1,componentType:"unorm8"},rg8unorm:{bytesPerPixel:2,components:2,componentType:"unorm8"},rgba8unorm:{bytesPerPixel:4,components:4,componentType:"unorm8"},"rgba8unorm-srgb":{bytesPerPixel:4,components:4,componentType:"unorm8"},bgra8unorm:{bytesPerPixel:4,components:4,componentType:"unorm8",swizzle:"bgra-to-rgba"},"bgra8unorm-srgb":{bytesPerPixel:4,components:4,componentType:"unorm8",swizzle:"bgra-to-rgba"},r16float:{bytesPerPixel:2,components:1,componentType:"float16"},rg16float:{bytesPerPixel:4,components:2,componentType:"float16"},rgba16float:{bytesPerPixel:8,components:4,componentType:"float16"},r32float:{bytesPerPixel:4,components:1,componentType:"float32"},rg32float:{bytesPerPixel:8,components:2,componentType:"float32"},rgba32float:{bytesPerPixel:16,components:4,componentType:"float32"}};function Zl(n,i){const s=cg[n];if(s)return s;throw new cn({code:"VGPU-CORE-UNSUPPORTED-FORMAT",message:`Texture.read does not support format ${n}. Supported formats: ${Object.keys(cg).join(", ")}.`,where:i})}function j1(n,i,s="Texture.readFloats"){const l=Zl(i,s),o=l.bytesPerPixel/l.components,c=Math.floor(n.byteLength/o),d=new Float32Array(c),h=new DataView(n.buffer,n.byteOffset,n.byteLength);for(let m=0;m<c;m++)l.componentType==="unorm8"?d[m]=h.getUint8(m)/255:l.componentType==="float16"?d[m]=B1(h.getUint16(m*2,!0)):d[m]=h.getFloat32(m*4,!0);return d}function B1(n){const i=n&32768?-1:1,s=n>>10&31,l=n&1023;return s===0?i*l*2**-24:s===31?l===0?i*Number.POSITIVE_INFINITY:Number.NaN:i*(l+1024)*2**(s-25)}function G1(n,i,s){const l=n.slice(0,i[0]*i[1]*s.bytesPerPixel);return s.swizzle==="bgra-to-rgba"&&Y0(l),l}function Y0(n){for(let i=0;i<n.length;i+=4){const s=n[i];n[i]=n[i+2],n[i+2]=s}}function $1(n){return{size:n,usage:pr(["copy_src","copy_dst"])}}class I1{gpu;guard;constructor(i,s=()=>{}){this.gpu=i,this.guard=s}writeBuffer(i,s,l){this.guard("Queue.writeBuffer"),this.gpu.writeBuffer(i,s,l)}async flush(){this.guard("Queue.flush"),await this.gpu.onSubmittedWorkDone?.(),this.guard("Queue.flush")}}class V1{gpu;resolved;constructor(i,s){this.gpu=i,this.resolved=s}dispose(){}get kind(){return this.resolved.kind}get source(){return this.resolved.source}get code(){return this.resolved.wgsl}get entryPoints(){return this.resolved.entryPoints}get stats(){return this.resolved.stats}}const F1=Symbol.for("vgpu/Texture"),H1=Symbol.for("vgpu/Texture/resizeLock");class rs{device;ownership;[F1]=!0;destroySignal=new ro;identity=so("texture");currentGpu;currentOptions;defaultView=null;resizeLock;destroyed=!1;constructor(i,s,l,o="owned"){this.device=i,this.ownership=o,this.currentGpu=s,this.currentOptions=l,Object.defineProperty(this,H1,{value:c=>{this.resizeLock=c}})}get gpu(){return this.currentGpu}get options(){return this.currentOptions}get size(){return this.options.size}get format(){return this.options.format}get usage(){return this.options.usage}get mipLevelCount(){return this.options.mipLevelCount??1}get sampleCount(){return this.options.sampleCount??1}get dimension(){return this.options.dimension??"2d"}get viewFormats(){return this.options.viewFormats??[]}get label(){return this.options.label}get resourceIdentity(){return this.identity}onDestroy(i){return this.destroySignal.onDestroy(this,i)}get view(){return this.assertAlive(),this.defaultView??=this.createView(),this.defaultView}createView(i){return this.assertAlive("Texture.createView"),this.gpu.createView(i)}resize(i){if(this.assertAlive(),this.ownership==="external")throw new cn({code:"VGPU-CORE-EXTERNAL-TEXTURE",message:"Texture wraps an externally owned GPUTexture and cannot be resized.",where:"Texture.resize"});if(this.resizeLock)throw new cn({code:"VGPU-CORE-TEXTURE-RESIZE-LOCKED",message:this.resizeLock,where:"Texture.resize"});const s=this.options.size[2]??1,l=i[2]??s;if(this.options.size[0]===i[0]&&this.options.size[1]===i[1]&&s===l)return!1;const o=i[2]===void 0&&this.options.size[2]===void 0?[i[0],i[1]]:[i[0],i[1],l],c={...this.options,size:o},d=this.gpu;return this.currentGpu=this.device.gpu.createTexture(X0(c)),this.currentOptions=c,this.defaultView=null,d.destroy(),!0}async read(){this.assertAlive("Texture.read");const i=Zl(this.options.format,"Texture.read");if(rg(this.gpu))return G1(this.gpu.__vgpuMockBytes,this.options.size,i);const s=await this.device.readback.readTexture(this.gpu,this.options.size,this.options.format);return this.assertAlive("Texture.read"),s}async readFloats(){return Zl(this.options.format,"Texture.readFloats"),j1(await this.read(),this.options.format)}destroy(){this.destroyed||(this.destroyed=!0,this.defaultView=null,this.destroySignal.emit(this),this.ownership!=="external"&&(rg(this.gpu)||this.gpu.destroy()))}dispose(){this.destroy()}assertAlive(i="Texture"){if(this.destroyed)throw new cn({code:"VGPU-CORE-TEXTURE-DESTROYED",message:"Texture is destroyed",where:i});this.device.assertUsable?.(i)}}function X0(n){const i={label:n.label,size:{width:n.size[0],height:n.size[1],depthOrArrayLayers:n.size[2]??1},format:n.format,usage:R1(n.usage)};return n.mipLevelCount!==void 0&&(i.mipLevelCount=n.mipLevelCount),n.sampleCount!==void 0&&(i.sampleCount=n.sampleCount),n.dimension!==void 0&&(i.dimension=n.dimension),n.viewFormats!==void 0&&(i.viewFormats=[...n.viewFormats]),i}class q1{gpu;adapterInfo;queue;readback;isCompatibilityMode;scopes=[];ownership;state="alive";lossInfo;observeLoss=!0;constructor(i,s=null,l="owned",o={}){this.gpu=i,this.adapterInfo=s,Object.defineProperty(this,"assertUsable",{value:h=>this.#e(h)}),this.ownership=typeof l=="string"?l:"owned";const c=typeof l=="string"?o:l;this.isCompatibilityMode=c.isCompatibilityMode??!1,this.queue=new I1(i.queue,h=>this.#e(h)),this.readback=new k1(i);const d=i.lost;d&&typeof d.then=="function"&&Promise.resolve(d).then(h=>{!this.observeLoss||this.state!=="alive"||(this.lossInfo=h,this.state="lost")},()=>{})}get limits(){return this.#e("Device.limits"),this.gpu.limits}get features(){return this.#e("Device.features"),this.gpu.features}createShader(i){this.#e("Device.createShader");const s=typeof i=="string"?O1(i):i;return new V1(this.gpu.createShaderModule({code:s.wgsl}),s)}createTexture(i){return this.#e("Device.createTexture"),new rs(this,this.gpu.createTexture(X0(i)),i)}createBuffer(i){this.#e("Device.createBuffer");const s=Y1(i);s&&this.captureError(s);const l=s?$1(Math.max(4,i.size||4)):X1(i);return new Di(this,this.gpu.createBuffer(l),i)}wrapBuffer(i){if(this.#e("Device.wrapBuffer"),!Q1(i))throw new cn({code:"VGPU-EXTERNAL-BUFFER-INVALID",message:"Device.wrapBuffer requires a GPUBuffer with finite size and usage properties.",where:"Device.wrapBuffer",fix:"Pass a live GPUBuffer created for this GPUDevice."});const s={size:i.size,usage:Z1(i.usage),...i.label?{label:i.label}:{}};return new Di(this,i,s,"external")}pushErrorScope(i){this.#e("Device.pushErrorScope"),this.scopes.push([]),this.gpu.pushErrorScope?.(i)}async popErrorScope(){this.#e("Device.popErrorScope");const i=this.scopes.pop(),s=await this.gpu.popErrorScope?.();return this.#e("Device.popErrorScope"),i?.[0]??K1(s)??null}#e(i){if(this.state==="alive")return;if(this.state==="disposed")throw new cn({code:"VGPU-DEVICE-DISPOSED",message:"The GPU device wrapper has been disposed.",where:i,fix:"Create a new Gpu instance before performing more work."});const s=this.lossInfo?.reason,l=this.lossInfo?.message;throw new cn({code:"VGPU-DEVICE-LOST",message:`The GPU device was lost${s?` (${s})`:""}${l?`: ${l}`:"."}`,where:i,cause:this.lossInfo})}destroy(){if(this.state==="disposed")return;const i=this.state==="lost";this.state="disposed",this.observeLoss=!1,this.scopes.length=0,this.readback.destroy(),this.ownership==="owned"&&!i&&this.gpu.destroy()}dispose(){this.destroy()}captureError(i){const s=this.scopes.at(-1);if(s)s.push(i);else throw i}}function Y1(n){return!Number.isFinite(n.size)||n.size<=0?fg("Buffer size must be greater than zero."):n.usage.length===0?fg("Buffer usage must not be empty."):null}function fg(n){return new cn({code:"VGPU-CORE-INVALID-USAGE",message:n,where:"Device.createBuffer"})}function X1(n){return{label:n.label,size:n.size,usage:pr(n.usage)}}function K1(n){return n?new cn({code:"VGPU-CORE-VALIDATION",message:n.message,where:"GPUDevice.popErrorScope",cause:n}):null}function Q1(n){if(typeof n!="object"&&typeof n!="function"||n===null)return!1;const i=n;return Number.isSafeInteger(i.size)&&(i.size??-1)>=0&&Number.isSafeInteger(i.usage)&&(i.usage??-1)>=0&&typeof i.destroy=="function"}const P1=["map_read","map_write","copy_src","copy_dst","index","vertex","uniform","storage","indirect","query_resolve"];function Z1(n){return P1.filter(i=>(n&pr([i]))!==0)}const K0=new WeakMap,W1=new WeakMap;function J1(n,i){return K0.set(n,eS(i)),n}function or(n){return K0.get(n)}function Q0(n){return W1.get(n)}function eS(n){return{entries:n.entries.map(i=>({...i}))}}let se=class extends mf{};function tS(n,i,s,l,o,c){const d=i==="vertex"?"Vertex":"Fragment",h=i==="vertex"?"VERTEX":"FRAGMENT",m=`maxStorageBuffersIn${d}Stage`;return new se({code:`VGPU-LIMIT-STORAGE-${h}`,message:`${d} entry '${s}' in '${n}' uses ${l} storage buffer(s), but device limit ${m} is ${o}.`,fix:i==="vertex"?`Request init({ requiredLimits: { ${m}: ${l} } }) if the adapter supports it, or move vertex data to geometry(gpu, ...) vertex streams.`:`Request init({ requiredLimits: { ${m}: ${l} } }) if the adapter supports it, or reduce fragment storage buffers.`,where:`${n}.pipelineLayout`,detail:{stage:i,entryPoint:s,count:l,limit:o,bindings:c.map(({name:y,group:S,binding:b})=>({name:y,group:S,binding:b}))}})}function nS(n,i,s,l,o){return new se({code:"VGPU-SET-TEXTURE-FILTERABILITY",message:`${l} (${s}) cannot satisfy filtering texture '${i.name}' @group(${i.group}) @binding(${i.binding}).`,fix:"Use a filterable format; request float32-filterable for rgba32float when supported; or use textureLoad without a sampler.",where:`${n}.set`,detail:{format:s,group:i.group,binding:i.binding,bindingName:i.name,resourceName:l,samplerName:o?.name,samplerGroup:o?.group,samplerBinding:o?.binding}})}function iS(n,i){const s=zS(n,i);return new se({code:"VGPU-R1-BINDING-NEVER-SET",message:`Unset \`${i.name}\` @group(${i.group}) @binding(${i.binding}) in '${n}'. Fix: ${s}; or ${n}.group(${i.group}, bindGroup).`,where:`${n}.draw`})}function P0(n,i){const s=i==="lib"?"lib-owned by its first JS set()":"user-owned by its first resource set()",l=i==="lib"?`Fix: pass a resource from the start: wave.set({ ${n}: new Uniform(gpu.device, { size: 4 }) }).`:`Fix: pass JS values from the first set(): wave.set({ ${n}: jsValue }).`;return new se({code:"VGPU-R1-OWNERSHIP-FLIP",message:`\`${n}\` is ${s}; ownership cannot change. ${l}`,where:"set"})}function aS(n,i){return new se({code:"VGPU-R4-GROUP-CLAIMED",message:`group ${i} of '${n}' is claimed; set() cannot update it.`,fix:`Call set() first, or build from ${n}.layout(${i}); pass dynamic offsets to p.draw().`,where:`${n}.set`})}function sS(n,i,s,l){return new se({code:"VGPU-R4-GROUP-INCOMPATIBLE",message:`claimed group ${i} in '${n}' is incompatible: ${s}.`,fix:`Build from ${n}.layout(${i}, { dynamicOffsets? }) then call ${n}.group(${i}, bindGroup).`,where:`${n}.group`,cause:l})}function ss(n,i,s){return new se({code:"VGPU-R4-GROUP-VALIDATION",message:`WebGPU rejected claimed group ${i} in '${n}'.`,fix:`Build from ${n}.layout(${i}); pass offsets via p.draw(draw, { offsets: { ${i}: [...] } }).`,where:`${n}.draw`,cause:s,detail:{drawLabel:n,group:i}})}function dg(n,i){return new se({code:"VGPU-BLEND-INVALID",message:`Invalid blend '${String(i)}' in '${n}'.`,fix:'Use "alpha", "additive", "premultiplied", or { color, alpha? } components.',where:"draw"})}function hg(n,i){return new se({code:"VGPU-BLEND-CONSTANT-INVALID",message:`Invalid blendConstant in '${n}': ${i}`,fix:'Use [r, g, b, a] finite numbers with a blend whose color or alpha uses "constant"/"one-minus-constant"; omit it to keep the pass default (0, 0, 0, 0).',where:"draw"})}function pg(n,i){return new se({code:"VGPU-WRITEMASK-INVALID",message:`Invalid writeMask ${i} in '${n}'.`,fix:"Use an array of r/g/b/a; omit it for all channels.",where:"draw"})}function Zc(n,i,s="draw"){return new se({code:"VGPU-COLORS-INVALID",message:`Invalid colors in '${n}': ${i}`,fix:"Use one { blend?, writeMask? } or null entry per color attachment of the target, aligned by index; omit colors to apply the top-level blend/writeMask to every attachment.",where:s})}function rS(n,i){return new se({code:"VGPU-CULL-INVALID",message:`Invalid cull '${String(i)}' in '${n}'.`,fix:'Use "none", "front", or "back"; omit it for no culling.',where:"draw"})}function lS(n,i){return new se({code:"VGPU-FRONTFACE-INVALID",message:`Invalid frontFace '${String(i)}' in '${n}'.`,fix:'Use "ccw" or "cw"; omit it for counter-clockwise.',where:"draw"})}function mg(n,i){return new se({code:"VGPU-UNCLIPPED-DEPTH-INVALID",message:`Invalid unclippedDepth in '${n}': ${i}`,fix:'Use a boolean. unclippedDepth: true needs the "depth-clip-control" device feature — request it with init({ requiredFeatures: ["depth-clip-control"] }) on an adapter that supports it. Omit the option to keep depth clipping.',where:"draw"})}function Xn(n,i){return new se({code:"VGPU-DEPTH-INVALID",message:`Invalid depth in '${n}': ${i}`,fix:'Use false or { write?, compare?, bias?, biasSlopeScale?, biasClamp? }; omit it for { write: true, compare: "less-equal" }.',where:"draw"})}function is(n,i,s="draw"){return new se({code:"VGPU-STENCIL-INVALID",message:`Invalid stencil in '${n}': ${i}`,fix:`Use { front?, back?, readMask?, writeMask?, ref? } with GPUCompareFunction/GPUStencilOperation faces and u32 masks, against a target whose depth format has a stencil aspect (depth: "depth24plus-stencil8"); omit it for WebGPU's pass-through defaults.`,where:s})}function Fl(n,i,s="draw"){return new se({code:"VGPU-MULTISAMPLE-INVALID",message:`Invalid multisample in '${n}': ${i}`,fix:"Use { alphaToCoverage?, mask? }: alphaToCoverage needs a target created with msaa: true, and mask must be an integer in [0, 0xFFFFFFFF] (bits above the target's sampleCount are ignored). Omit multisample for full-coverage defaults.",where:s})}function Nl(n,i,s="draw"){return new se({code:"VGPU-CONSTANTS-INVALID",message:`Invalid constants in '${n}': ${i}`,fix:"Key WGSL `override` constants by name, or by the decimal string of N when the declaration has @id(N); values are finite numbers or booleans, converted to the override's WGSL type (bool/i32/u32/f32/f16). Every override without a default value must be provided. Omit constants to keep the WGSL defaults.",where:s})}function Hl(n,i,s="draw"){return new se({code:"VGPU-ENTRY-INVALID",message:`Invalid entry in '${n}': ${i}`,fix:"Name an entry point declared in the shader with the matching stage — { vertex?, fragment? } strings for draw, one @compute name string for compute. Omit entry (or a field) to use the first entry point of that stage.",where:s})}function Pa(n,i,s){return new se({code:"VGPU-INDIRECT-INVALID",message:`Invalid indirect in '${n}': ${i}`,fix:"Pass a storage buffer created with storage(gpu, bytes, { indirect: true }) — bare, or as { buffer, offset? } with a 4-aligned byte offset — sized so the GPU-read arguments fit: 16 bytes for drawIndirect, 20 for drawIndexedIndirect, 12 for dispatchWorkgroupsIndirect. Omit indirect to use CPU-side counts.",where:s})}function oS(){return new se({code:"VGPU-PASS-PRESERVE-MSAA",message:"clear:false cannot preserve MSAA; use a non-MSAA target.",fix:"Use non-MSAA for accumulation.",where:"Frame.pass"})}function gg(n,i="expected a number in [0, 1].",s='Use 1 (default), or 0 with depth: { compare: "greater" } for reversed-Z.'){return new se({code:"VGPU-PASS-CLEARDEPTH-INVALID",message:`clearDepth received ${String(n)}; ${i}`,fix:s,where:"Frame.pass"})}function Kn(n){return new se({code:"VGPU-PASS-VIEWPORT-INVALID",message:`Invalid viewport: ${n}`,fix:"Use { x?, y?, width, height, minDepth?, maxDepth? } finite numbers within device limits; omit it for the full target.",where:"Frame.pass"})}function Uc(n){return new se({code:"VGPU-PASS-SCISSOR-INVALID",message:`Invalid scissor: ${n}`,fix:"Use [x, y, width, height] non-negative integers with x + width and y + height within the target's current pixel size; omit it for the full target.",where:"Frame.pass"})}function uS(){return new se({code:"VGPU-PASS-PRESERVE-CLEARDEPTH",message:"clear:false preserves depth; clearDepth cannot apply.",fix:"Remove clearDepth, or let the pass clear.",where:"Frame.pass"})}function yg(n){return new se({code:"VGPU-PASS-CLEARSTENCIL-INVALID",message:`clearStencil ${n}`,fix:`Use an integer in [0, 0xFFFFFFFF] on a target whose depth format has a stencil aspect, e.g. depth: "depth24plus-stencil8"; the value is masked to the stencil aspect's bit width.`,where:"Frame.pass"})}function cS(){return new se({code:"VGPU-PASS-PRESERVE-CLEARSTENCIL",message:"clear:false preserves stencil; clearStencil cannot apply.",fix:"Remove clearStencil, or let the pass clear.",where:"Frame.pass"})}function ia(n,i,s="Frame.pass"){return new se({code:"VGPU-PASS-DEPTH-READONLY",message:`depthReadOnly ${n}`,fix:i,where:s})}function fS(){return new se({code:"VGPU-PASS-DEPTH-READONLY-MSAA",message:`depthReadOnly cannot read an MSAA target's depth: multisampled depth is stored with storeOp "discard", so a read-only pass tests against discarded contents.`,fix:"Use a non-MSAA target for read-only depth, or drop depthReadOnly and let the pass own its depth.",where:"Frame.pass"})}function Za(n,i,s="timer"){return new se({code:"VGPU-TIMER-INVALID",message:`Invalid timer use: ${n}`,fix:i,where:s})}function dS(n,i){return new se({code:"VGPU-TIMER-CAPACITY",message:`frame exceeds ${n} timed spans; a timer holds one timestamp query set and WebGPU createQuerySet requires count <= ${i} (2 queries per span).`,fix:"Time fewer passes per frame, or spread timing across frames.",where:"Frame.pass"})}function hS(n,i,s="visibility"){return new se({code:"VGPU-VIS-INVALID",message:`Invalid visibility use: ${n}`,fix:i,where:s})}function pS(){return new se({code:"VGPU-QUERY-NO-VISIBILITY",message:"occlusion() needs the pass to be opened with a visibility instance; the render pass has no occlusionQuerySet to write into.",fix:"Open the pass with f.pass({ target, visibility: vis }, ...) using the visibility(gpu) instance that created the query handle.",where:"FramePass.occlusion"})}function mS(){return new se({code:"VGPU-QUERY-NESTED",message:"occlusion() cannot nest inside an active occlusion() body; WebGPU allows one active occlusion query per pass at a time.",fix:"Encode each occlusion scope sequentially: p.occlusion(a, ...); p.occlusion(b, ...).",where:"FramePass.occlusion"})}function Wc(n="Frame.pass"){return new se({code:"VGPU-TARGET-REQUIRED",message:"Target required. Fix: pass surface(gpu, canvas) or target(gpu, { size }) as { target }.",where:n})}function gS(n,i,s,l){return new se({code:n,message:`${n}: ${s}`,fix:l,where:i})}function gf(n,i){return gS("VGPU-MESH-RANGE-INVALID",n,i,"Use index ranges for indexed geometries, vertex ranges otherwise, within geometry counts.")}function yS(n){return new se({code:"VGPU-PIPELINE-LAYOUT-GAP",message:`Pipeline bind group ${n} is missing.`,fix:"Use consecutive @group() indices starting at 0.",where:"pipeline layout"})}function ar(n,i,s){return new se({code:"VGPU-COMPILE-FAILED",message:"WebGPU pipeline compilation failed.",fix:"Check WGSL, vertex layouts, and target signature.",where:n,cause:i,detail:s?{signature:s}:void 0})}function vg(n){return new se({code:"VGPU-COMPILE-DISPOSED",message:"GPU disposed during pipeline compilation.",where:n})}function kl(n,i){return new se({code:"VGPU-COMPILE-SIGNATURE-INVALID",message:`Invalid TargetSignature: ${i}`,fix:"Pass { colors, depth?, sampleCount?:1|4 } or a Target.",where:n})}function vS(n){return new se({code:"VGPU-TARGET-DEPTH-STENCIL-ONLY",message:`depth received '${n}'; stencil-only depth targets are not supported yet.`,fix:'Use a format with a depth aspect such as "depth24plus" or "depth24plus-stencil8".',where:"target"})}function Z0(){return new se({code:"VGPU-TARGET-SIZE-REQUIRED",message:"Target size required. Fix: target(gpu, { size: [w,h] }); update surface-derived targets in onResize.",where:"target"})}function W0(n){return new se({code:"VGPU-SURFACE-NOT-IN-FRAME",message:"Surface targets are only available inside frame(gpu).",fix:"surface passes must run inside frame(gpu, ...); precompile against an offscreen target(gpu, ...) instead",where:n})}function bS(){return new se({code:"VGPU-SURFACE-CONTEXT",message:"Canvas WebGPU context failed. Fix: check navigator.gpu and remove any existing 2d/webgl context.",where:"surface"})}function xS(n){return new se({code:"VGPU-SURFACE-DUPLICATE",message:`Canvas already has surface${n?` '${n}'`:""}. Fix: reuse or dispose it.`,where:"surface"})}function SS(n){return new se({code:"VGPU-SURFACE-DISPOSED",message:`Surface '${n??"surface"}' is disposed. Fix: call surface(gpu, canvas).`,where:"surface"})}function wS(){return new se({code:"VGPU-SURFACE-AUTORESIZE-UNSUPPORTED",message:"autoResize needs clientWidth. Fix: call surface.resize([w,h]) for OffscreenCanvas; onResize still fires.",where:"surface"})}function ES(n){return new se({code:"VGPU-SURFACE-RESIZE-REENTRANT",message:`Cannot resize this surface${n?` '${n}'`:""} in onResize. Fix: resize derived targets only.`,where:"surface.resize"})}function TS(n){return new se({code:"VGPU-CLEAR-COLOR-INVALID",message:`Invalid ${n}: expected four finite numbers.`,fix:"Assign [r, g, b, a] or a GPUColor object ({ r, g, b, a }).",where:n})}function J0(){return new se({code:"VGPU-FRAME-REENTRANT",message:"Nested frame(gpu) is invalid. Fix: queue work for the next frame.",where:"frame"})}function AS(n,i){return new se({code:"VGPU-QUERY-READBACK",message:`${n} dropped a query readback: ${DS(i)}`,fix:"Usually a lost or destroyed device: recreate the gpu (and the timer/visibility instance) before reading queries again. Results resume on the next successful readback; the frame itself is unaffected.",where:"QueryRing.onSubmitted",cause:i})}function bg(n){return new se({code:"VGPU-FRAME-CANCELED",message:"the frame was canceled; its command encoder was dropped and nothing more can be encoded or submitted on it.",fix:"Open a new frame(gpu) for further work; cancel() is the last operation on a frame.",where:n})}function MS(n){return new se({code:"VGPU-FRAME-PASS-ACTIVE",message:"the frame cannot be canceled while a pass callback is active.",fix:"Return from the frame.pass(...) callback first, then call frame.cancel(); this keeps pass descriptor resources alive until the pass is closed.",where:n})}function RS(n){return new se({code:"VGPU-FRAME-SUBMITTED",message:"the frame was already submitted; submitted GPU work cannot be canceled.",fix:"Call cancel() only on a frame you decided not to submit; the frame you did submit needs no cleanup.",where:n})}function Zn(n,i,s){return new se({code:"VGPU-R1-BINDING-INCOMPATIBLE-RESOURCE",message:`binding \`${n.name}\` @group(${n.group}) @binding(${n.binding}) needs ${i}.`,fix:s,where:"set"})}function Yt(n,i,s){return new se({code:"VGPU-RING1-UNSUPPORTED",message:i,fix:s,where:n})}function Ll(n){return CS(n)&&n.version!==1?new se({code:"VGPU-SHADER-SOURCE-INVALID",message:`VGPU-SHADER-SOURCE-INVALID: unsupported ShaderSource v${String(n.version)}; expected v1. Fix: update vgpu or regenerate it.`,where:"shader source"}):new se({code:"VGPU-SHADER-SOURCE-INVALID",message:`VGPU-SHADER-SOURCE-INVALID: expected WGSL or { version, wgsl }, got ${OS(n)}. Fix: configure @vgpu/wgsl loader-vite or loader-webpack.`,where:"shader source"})}function DS(n){return n instanceof Error?`${n.name}: ${n.message}`:String(n)}function CS(n){return typeof n=="object"&&n!==null&&"version"in n}function OS(n){if(typeof n!="object"||n===null)return typeof n;try{const i=JSON.stringify(n);return i.length>80?`${i.slice(0,77)}...`:i}catch{return"object"}}function zS(n,i){switch(i.kind){case"sampler":return`${n}.set({${i.name}:sampler(gpu)})`;case"texture":return`${n}.set({${i.name}:scene.color})`;case"buffer":return i.addressSpace==="uniform"?`${n}.set({${i.name}:{ /* values */ }})`:`${n}.set({${i.name}:buffer})`;default:return`${n}.set({${i.name}:resource})`}}const xg=["scheduler","resource","service"];function lo(n){return{name:n}}const ey=new WeakMap;function _S(n){const i=ey.get(n);if(!i)throw new se({code:"VGPU-GPU-FOREIGN",message:"This object was not created by init(); it has no vgpu kernel.",fix:"Pass the gpu returned by init() from vgpu, vgpu/node or vgpu/mock.",where:"gpu"});return i}class US{device;#e=new Map;#t=new Map(xg.map(i=>[i,new Set]));#n=new Set;#i=new Set;#a=new Set;#s=!1;constructor(i){this.device=i}get disposed(){return this.#s}service(i,s){const l=this.#e.get(i);if(l!==void 0)return l;const o=s(this);return this.#e.set(i,o),o}peekService(i){return this.#e.get(i)}own(i,s){const l=this.#t.get(i);return l.add(s),()=>{l.delete(s)}}addErrorListener(i){return this.#n.add(i),()=>{this.#n.delete(i)}}reportError(i){if(this.#s)return Promise.resolve();const s=Promise.resolve().then(()=>{const l=[...this.#n];if(!l.length){console.error(i);return}for(const o of l)try{o(i)}catch(c){console.error(c)}});return this.trackDelivery(s)}trackDelivery(i){const s=Promise.resolve(i).then(()=>{},l=>{console.error(l)});return this.#i.add(s),s.finally(()=>this.#i.delete(s)),s}registerSettledSource(i){return this.#a.add(i),()=>{this.#a.delete(i)}}async settled(){const i=[...this.#i,...[...this.#a].flatMap(s=>s())];await Promise.allSettled(i)}dispose(){if(!this.#s){this.#s=!0;for(const i of xg){const s=this.#t.get(i);for(const l of[...s])l();s.clear()}this.#e.clear(),this.#a.clear(),this.#n.clear(),this.device.dispose()}}}function NS(n){const i=new US(n),s={device:n,gpu:n.gpu,get disposed(){return i.disposed},onError:l=>i.addErrorListener(l),settled:()=>i.settled(),dispose:()=>{i.dispose()}};return ey.set(s,i),s}async function kS(n,i={},s){return NS(await LS(n,i,s))}async function LS(n,i,s){return i.adapter||s?(i.adapter??s()).requestDevice(i):jS(i)}async function jS(n){const s=await globalThis.navigator.gpu?.requestAdapter({powerPreference:n.powerPreference});if(!s)throw Yt("init","navigator.gpu.requestAdapter() returned null.");E1(s.features,n.requiredFeatures);const l=await s.requestDevice({requiredFeatures:n.requiredFeatures,requiredLimits:n.requiredLimits});return new q1(l,s.info??null)}function pt(n,i){n.assertUsable(i)}function Sg(n,i){n.assertUsable(i)}const ty=Symbol("vgpu.bindingResource");function BS(n){return typeof(typeof n=="object"&&n!==null?n[ty]:void 0)=="function"?n:void 0}const Jc=Symbol("vgpu.geometry.layoutResolver");function Wn(n,i){const s=_S(n);if(s.disposed)throw GS(i);return s}function GS(n){return new se({code:"VGPU-GPU-DISPOSED",message:`${n}() ran after gpu.dispose(); the device and everything it owned are gone.`,fix:"Create resources before disposing the gpu, or init() a new one.",where:n})}function $S(n,i){let s=()=>{};const l=i({trackSettled:o=>{n.trackDelivery(o)},errorSink:o=>n.reportError(o),onDispose:()=>{s()}});return s=n.own("resource",()=>l.dispose()),l}function ny(n,i,s,l){const o=n.own("resource",()=>s(i));return l?.(o),i}class iy extends Error{code;line;column;severity;metadata;relatedDiagnostics;fix;where;cause;constructor(i,s,l=1,o=1,c="error"){super(s),this.name="VGPUError",this.code=i,this.line=l,this.column=o,this.severity=c}}function IS(n,i,s={}){const l=new iy(n,i,s.line??1,s.column??1,s.severity??"error");return s.fix!==void 0&&(l.fix=s.fix),s.where!==void 0&&(l.where=s.where),s.cause!==void 0&&(l.cause=s.cause),s.metadata!==void 0&&(l.metadata=s.metadata),l}function et(n,i,s=1,l=1){return new iy(n,i,s,l)}const VS=new Set(["fn","struct","const","alias","var","override"]);function FS(n){const i=[],s=[],l=[];let o=0,c=!1,d=0;for(;o<n.length;){const h=n[o];if(h.text==="{"){d++,o++;continue}if(h.text==="}"){d=Math.max(0,d-1),o++;continue}if(ay(h)){o++;continue}if(d>0){o++;continue}if(h.text==="import"){if(c)throw et("VGPU-WGSL-IMP-ORDER","Imports must precede declarations",h.line,h.column);const[b,R]=HS(n,o);i.push(b),o=R;continue}if(h.text==="export"&&n[o+1]?.text==="{")throw et("VGPU-WGSL-EXP-REEXPORT-CYCLE","Re-export cycles are not supported",h.line,h.column);if(h.text==="@"&&n[o+2]?.text==="export"&&n[o+3]?.text==="@")throw et("VGPU-WGSL-EXP-NOTDECL","Repeated export attributes",h.line,h.column);const m=h.text==="export"||h.text==="@"&&n[o+2]?.text==="export",y=m?qS(n,h.text==="export"?o+1:o+3):o,S=n[y];if(S&&VS.has(S.text)){const b=YS(n,y);s.push({name:b,localName:b,kind:S.text}),m&&l.push({name:b,localName:b,kind:S.text}),c=!0}o++}return{imports:i,exports:l,locals:s}}function HS(n,i){let s=i+1;const l=[];if(n[s]?.text==="{"){for(s++;n[s]&&n[s].text!=="}";){if(ay(n[s])){s++;continue}const d=kc(n[s]);let h=d;s++,n[s]?.text==="as"&&(h=kc(n[s+1]),s+=2),l.push({imported:d,local:h}),n[s]?.text===","&&s++}s++,Nc(n[s],"from"),s++}else if(n[s]?.text==="*")Nc(n[s+1],"as"),l.push({imported:"*",local:kc(n[s+2]),namespace:!0}),s+=3,Nc(n[s],"from"),s++;else throw n[s]?.kind==="string"?et("VGPU-WGSL-IMP-SIDEEFFECT","Side-effect imports are not supported",n[s].line,n[s].column):et("VGPU-WGSL-IMP-DEFAULT","Default imports are not supported",n[s]?.line,n[s]?.column);const o=n[s];if(o?.kind!=="string")throw et("VGPU-WGSL-RES-NOTFOUND","Import path must be a string",o?.line,o?.column);const c=o.text.slice(1,-1);return s++,n[s]?.text===";"&&s++,[{from:c,bindings:l,start:n[i].start,end:n[s-1].end},s]}function qS(n,i){for(;n[i]?.text==="@";){if(i+=2,n[i]?.text==="(")for(;n[i]&&n[i].text!==")";)i++;n[i]?.text===")"&&i++}return i}function YS(n,i){let s=i+1;if(n[i]?.text==="var"&&n[s]?.text==="<")for(;n[s]&&n[s].text!==">";)s++;for(;s<n.length;s++)if(n[s].kind==="ident")return n[s].text;throw et("VGPU-WGSL-EXP-NOTDECL","Exported declaration has no name",n[i]?.line,n[i]?.column)}function Nc(n,i){if(n?.text!==i)throw et("VGPU-WGSL-IMP-DEFAULT",`Expected ${i}`,n?.line,n?.column)}function kc(n){if(n?.kind!=="ident")throw et("VGPU-WGSL-IMP-DEFAULT","Expected identifier",n?.line,n?.column);return n.text}function ay(n){return n.kind==="lineComment"||n.kind==="blockComment"}function XS(n,i){return i==="uniform"||i==="storage"?"buffer":n.kind==="sampler"?"sampler":n.kind==="texture"?n.textureKind==="texture_external"?"externalTexture":"texture":"unknown"}function KS(n,i,s,l,o){if(n==="buffer")return QS(i,s,o);if(l.kind==="sampler")return PS(l);if(l.kind==="texture")return l.textureKind==="texture_external"?{kind:"externalTexture",externalTexture:{}}:l.textureKind.startsWith("texture_storage_")?ZS(l):WS(l)}function QS(n,i,s){return{kind:"buffer",buffer:{type:n==="uniform"?"uniform":i==="read"?"read-only-storage":"storage",hasDynamicOffset:!1,minBindingSize:s?.size}}}function PS(n){return{kind:"sampler",sampler:{type:n.comparison?"comparison":"filtering"}}}function ZS(n){return{kind:"storageTexture",storageTexture:{access:ew(n.access),format:n.texelFormat??"rgba8unorm",viewDimension:sy(n.dimension)}}}function WS(n){return{kind:"texture",texture:{sampleType:JS(n),viewDimension:sy(n.dimension),multisampled:n.dimension==="multisampled_2d"||n.dimension==="depth_multisampled_2d"}}}function JS(n){if(n.textureKind.startsWith("texture_depth_"))return"depth";const i=n.sampleType;return i?.kind==="scalar"&&i.name==="i32"?"sint":i?.kind==="scalar"&&i.name==="u32"?"uint":"unfilterable-float"}function sy(n){switch(n){case"1d":return"1d";case"2d_array":case"depth_2d_array":return"2d-array";case"cube":case"depth_cube":return"cube";case"cube_array":case"depth_cube_array":return"cube-array";case"3d":return"3d";default:return"2d"}}function ew(n){return n==="read"?"read-only":n==="read_write"?"read-write":"write-only"}const ln=(1n<<64n)-1n,na=11400714785074694791n,rr=14029467366897019727n,wg=1609587929392839161n,ry=9650029242287828579n,Eg=2870177450012600261n;function tw(n,i=0n){const s=new TextEncoder().encode(n);let l=0,o;if(s.length>=32){let c=i+na+rr,d=i+rr,h=i,m=i-na;const y=s.length-32;do c=Wa(c,sr(s,l)),l+=8,d=Wa(d,sr(s,l)),l+=8,h=Wa(h,sr(s,l)),l+=8,m=Wa(m,sr(s,l)),l+=8;while(l<=y);o=Mi(c,1n)+Mi(d,7n)+Mi(h,12n)+Mi(m,18n),o=jl(o,c),o=jl(o,d),o=jl(o,h),o=jl(o,m)}else o=i+Eg;for(o=o+BigInt(s.length)&ln;l+8<=s.length;)o^=Wa(0n,sr(s,l)),o=Mi(o,27n)*na+ry&ln,l+=8;for(l+4<=s.length&&(o^=nw(s,l)*na&ln,o=Mi(o,23n)*rr+wg&ln,l+=4);l<s.length;)o^=BigInt(s[l])*Eg&ln,o=Mi(o,11n)*na&ln,l++;return o^=o>>33n,o=o*rr&ln,o^=o>>29n,o=o*wg&ln,o^=o>>32n,o.toString(16).padStart(16,"0")}function Wa(n,i){return Mi(n+i*rr&ln,31n)*na&ln}function jl(n,i){return n^=Wa(0n,i),n*na+ry&ln}function Mi(n,i){return(n<<i|n>>64n-i)&ln}function sr(n,i){let s=0n;for(let l=7;l>=0;l--)s=(s<<8n)+BigInt(n[i+l]);return s}function nw(n,i){return BigInt(n[i])|BigInt(n[i+1])<<8n|BigInt(n[i+2])<<16n|BigInt(n[i+3])<<24n}function iw(n){return tw(n)}function aw(n){return iw(n).slice(0,8)}function sw(n,i){return`_vgsl_${aw(n)}__${i}`}function Xt(n,i){const s=n.find(c=>c.name===i);if(!s)return;const l=s.args.map(c=>c.text).join(""),o=Number(l.replace(/[ui]$/,""));return Number.isFinite(o)?o:void 0}function yf(n){const i=[[]];let s=0,l=0;for(const o of n){if(o.text==="<"?s++:o.text===">"?s=Math.max(0,s-1):o.text==="("?l++:o.text===")"&&(l=Math.max(0,l-1)),o.text===","&&s===0&&l===0){i.push([]);continue}i[i.length-1].push(o)}return i.map(ly).filter(o=>o.length>0)}function ly(n){let i=0,s=n.length;for(;i<s&&n[i].text===",";)i++;for(;s>i&&n[s-1].text===",";)s--;return n.slice(i,s)}function rw(n){if(n!==void 0&&oy(n))return Number(n.replace(/[ui]$/,""))}function oy(n){return/^(0|[1-9][0-9]*)([ui])?$/.test(n)}function uy(n){if(n==="read"||n==="write"||n==="read_write")return n}function lw(n){return["f32","f16","i32","u32","bool"].find(i=>i===n)}function ow(n){return{kind:"scalar",name:n==="f"?"f32":n==="h"?"f16":n==="i"?"i32":"u32"}}function cy(n){return n==="f16"?2:4}function la(n,i){return Math.ceil(i/n)*n}function Tn(n){const i=ly(n);if(i.length===0)throw et("VGPU-WGSL-REFLECT-TYPE","Expected WGSL type");const s=i.map(c=>c.text).join(""),l=uw(s);if(l)return l;if(i[1]?.text==="<"){const c=i[0].text,d=yf(i.slice(2,-1)),h=cw(c,d);if(h)return h}const o=fw(s);return o||dw(s)}function uw(n){const i=lw(n);if(i)return{kind:"scalar",name:i};const s=n.match(/^vec([234])([fiuh])$/);if(s)return{kind:"vector",width:Number(s[1]),element:ow(s[2])};const l=n.match(/^mat([234])x([234])([fh])$/);if(l){const o=l[3]==="h"?{kind:"scalar",name:"f16"}:{kind:"scalar",name:"f32"};return{kind:"matrix",columns:Number(l[1]),rows:Number(l[2]),element:o}}}function cw(n,i){if(n==="array"){const s=i[1]?.map(o=>o.text).join(""),l=s===void 0?void 0:rw(s);return{kind:"array",element:Tn(i[0]??[]),count:l,countExpression:s}}if(n==="atomic")return{kind:"atomic",element:Tn(i[0]??[])};if(n==="vec2"||n==="vec3"||n==="vec4")return{kind:"vector",width:Number(n.slice(3)),element:Tn(i[0]??[])};if(/^mat[234]x[234]$/.test(n))return{kind:"matrix",columns:Number(n[3]),rows:Number(n[5]),element:Tn(i[0]??[])};if(n==="ptr")return{kind:"ptr",addressSpace:i[0]?.map(s=>s.text).join("")??"",element:Tn(i[1]??[]),access:i[2]?.map(s=>s.text).join("")};if(n==="sampler")return{kind:"sampler",comparison:!1};if(n.startsWith("texture_storage_"))return{kind:"texture",textureKind:n,dimension:n.slice(16),texelFormat:i[0]?.map(s=>s.text).join(""),access:uy(i[1]?.map(s=>s.text).join(""))};if(n.startsWith("texture_"))return{kind:"texture",textureKind:n,dimension:n.slice(8),sampleType:i[0]?Tn(i[0]):void 0}}function fw(n){if(n==="sampler"||n==="sampler_comparison")return{kind:"sampler",comparison:n==="sampler_comparison"};if(n==="texture_external")return{kind:"texture",textureKind:n};if(n.startsWith("texture_depth_"))return{kind:"texture",textureKind:n,dimension:n.slice(8)};if(n.startsWith("texture_"))return{kind:"texture",textureKind:n,dimension:n.slice(8)}}function dw(n){return{kind:"identifier",name:n}}function Oi(n){if(n?.kind!=="ident"&&n?.kind!=="keyword")throw et("VGPU-WGSL-REFLECT-PARSE","Expected identifier",n?.line,n?.column);return n.text}function oa(n,i,s){for(let l=i;l<n.length;l++)if(n[l].text===s)return l;throw et("VGPU-WGSL-REFLECT-PARSE",`Expected ${s}`,n[i]?.line,n[i]?.column)}function hw(n,i,s,l){for(let o=i;o<s;o++)if(n[o].text===l)return o}function oo(n,i,s){let l=0;for(let o=i;o<n.length;o++)if((n[o].text==="{"||n[o].text==="(")&&l++,(n[o].text==="}"||n[o].text===")")&&(l=Math.max(0,l-1)),l===0&&n[o].text===s)return o;return n.length}function vf(n,i){const s=n[i].text,l=s==="("?")":s==="{"?"}":">";let o=0;for(let c=i;c<n.length;c++)if(n[c].text===s&&o++,n[c].text===l&&(o--,o===0))return c;throw et("VGPU-WGSL-REFLECT-PARSE",`Unclosed ${s}`,n[i]?.line,n[i]?.column)}function bf(n,i){const s=[];let l=i;for(;n[l]?.text==="@";){const o=n[l],c=Oi(n[l+1]);l+=2;let d=[];if(n[l]?.text==="("){const h=vf(n,l);d=n.slice(l+1,h),l=h+1}s.push({name:c,args:d,token:o})}return[s,l]}function as(n){switch(n.kind){case"scalar":return n.name;case"identifier":return n.name;case"vector":return`vec${n.width}<${as(n.element)}>`;case"matrix":return`mat${n.columns}x${n.rows}<${as(n.element)}>`;case"array":return`array<${as(n.element)}${n.count===void 0?"":`,${n.count}`}>`;default:return n.kind}}function pw(n){const i=n.find(l=>l.name==="workgroup_size");if(!i)return;const s=yf(i.args).map(l=>Number(l.map(o=>o.text).join("")));return[s[0]??1,s[1]??1,s[2]??1]}function mw(n,i){if(n[i]?.text!=="<")return{after:i};const s=oa(n,i,">"),l=yf(n.slice(i+1,s)).map(o=>o.map(c=>c.text).join(""));return{addressSpace:l[0],access:uy(l[1]),after:s+1}}function gw(n){const i=[],s=[],l=[],o=[],c=[],d=[],h=n.tokens.filter(S=>S.kind!=="lineComment"&&S.kind!=="blockComment");let m=0,y=0;for(;m<h.length;){const S=h[m];if(S.text==="{"){y++,m++;continue}if(S.text==="}"){y=Math.max(0,y-1),m++;continue}if(y>0){m++;continue}const b=m,[R,L]=bf(h,m);m=L,h[m]?.text==="export"&&m++;const j=h[m]?.text;if(j==="enable"){h[m+1]?.kind==="ident"&&d.push(h[m+1].text),m=oo(h,m,";")+1;continue}if(j==="struct"){const D=yw(n,h,m);D.item&&i.push(D.item),m=D.next;continue}if(j==="alias"){const D=vw(n,h,m);D.item&&s.push(D.item),m=D.next;continue}if(j==="var"){const D=bw(n,h,m,R);D.item&&l.push(D.item),m=D.next;continue}if(j==="fn"){const D=xw(n,h,m,R);D.item&&o.push(D.item),m=D.next;continue}if(j==="override"){const D=ww(h,m,R);D.item&&c.push(D.item),m=D.next;continue}m=Math.max(b+1,m+1)}return{structs:i,aliases:s,vars:l,entries:o,overrides:c,features:d}}function yw(n,i,s,l){const o=Oi(i[s+1]),c=oa(i,s+2,"{"),d=vf(i,c);return{item:{name:o,originalName:o,mangledName:xf(n,o,"struct"),members:Ew(i.slice(c+1,d)),path:n.path},next:d+1}}function vw(n,i,s,l){const o=Oi(i[s+1]),c=oa(i,s+2,"="),d=oo(i,c+1,";");return{item:{name:o,originalName:o,mangledName:xf(n,o,"alias"),target:Tn(i.slice(c+1,d)),path:n.path},next:d+1}}function bw(n,i,s,l){const{addressSpace:o,access:c,after:d}=mw(i,s+1),h=Oi(i[d]),m=oa(i,d+1,":"),y=oo(i,m+1,";");return{item:{path:n.path,name:h,mangledName:Tw(l)?h:xf(n,h,"var"),attrs:l,addressSpace:o,access:c,type:Tn(i.slice(m+1,y))},next:y+1}}function xw(n,i,s,l){const o=Oi(i[s+1]),c=l.find(m=>m.name==="vertex"||m.name==="fragment"||m.name==="compute")?.name;if(!c)return{item:void 0,next:s+1};const d=oa(i,s+2,"("),h=vf(i,d);return{item:{name:o,mangledName:o,stage:c,workgroupSize:pw(l),path:n.path,params:Sw(i.slice(d+1,h))},next:h+1}}function Sw(n){const i=[];let s=0;for(;s<n.length;){const[l,o]=bf(n,s);if(s=o,!n[s]||n[s].text===","){s++;continue}const c=Oi(n[s]),d=oa(n,s+1,":");let h=d+1,m=0;for(;h<n.length&&(n[h].text==="<"&&m++,n[h].text===">"&&(m=Math.max(0,m-1)),!(m===0&&n[h].text===","));)h++;i.push({name:c,attrs:l,type:Tn(n.slice(d+1,h))}),s=h+1}return i}function ww(n,i,s){const l=Oi(n[i+1]),o=oo(n,i+1,";"),c=hw(n,i+2,o,"=");return{item:{name:l,mangledName:l,id:Xt(s,"id"),defaultValue:c===void 0?void 0:n.slice(c+1,o).map(d=>d.text).join("")},next:o+1}}function Ew(n){const i=[];let s=0;for(;s<n.length;){const[l,o]=bf(n,s);if(s=o,!n[s]||n[s].text===","||n[s].text===";"){s++;continue}const c=Oi(n[s]),d=oa(n,s+1,":");let h=d+1,m=0;for(;h<n.length&&(n[h].text==="<"&&m++,n[h].text===">"&&(m=Math.max(0,m-1)),!(m===0&&(n[h].text===","||n[h].text===";")));)h++;i.push({name:c,attrs:l,type:Tn(n.slice(d+1,h)),align:Xt(l,"align"),size:Xt(l,"size")}),s=h+1}return i}function xf(n,i,s){return s==="override"?i:sw(n.path,i)}function Tw(n){return Xt(n,"group")!==void 0||Xt(n,"binding")!==void 0}const Aw="literal length required for auto layout; use draw.group(n, bg) manual binding",Mw="VGPUError: `bool` is not host-shareable in uniform/storage. Fix: use `u32` (0 | 1) → struct Params { enabled: u32 }",fy="use a manual group claim (`draw.group(n, bg)`)";function Rw(n=1,i=1){return et("VGPU-WGSL-REFLECT-ARRAY-LENGTH",Aw,n,i)}function dy(n=1,i=1){return et("VGPU-WGSL-REFLECT-BOOL-HOST-SHAREABLE",Mw,n,i)}function Wl(n,i,s=1,l=1){return et("VGPU-WGSL-REFLECT-UNKNOWN-TYPE",`type '${n}' is unknown in ${i}; ${fy}`,s,l)}function Tg(n,i,s=1,l=1){return et("VGPU-WGSL-REFLECT-NS-TYPE",`type '${n}' is a namespace-member import; use a named import or manual @group(1+) binding`,s,l)}function hy(n,i=1,s=1){return et("VGPU-WGSL-REFLECT-NON-HOST-SHAREABLE",`Type ${n} is not host-shareable; ${fy}`,i,s)}const ls="naga-standard";function Dw(n,i,s){const l=new Map;for(const d of i){const h=new Map;for(const m of[...d.structs,...d.aliases])h.set(m.originalName,{path:m.path,name:m.originalName,mangledName:m.mangledName,kind:"members"in m?"struct":"alias"});l.set(d.structs[0]?.path??d.aliases[0]?.path??d.vars[0]?.path??"",h)}const o=new Map(n.map(d=>[d.path,l.get(d.path)??new Map])),c=new Map;for(const d of n){const h=new Map(o.get(d.path));for(const m of d.parsed.imports)Cw(d,m,h,n,o);c.set(d.path,h)}return c}function Cw(n,i,s,l,o,c){const d=zw(i,n.path,l),h=o.get(d);for(const m of i.bindings){if(m.namespace){s.set(m.local,{path:d,name:m.local,mangledName:m.local,kind:"namespace"});continue}const y=h?.get(m.imported);y&&s.set(m.local,y)}}function Ow(n,i){const s=new Map,l=new Map,o=new Map;for(const c of n){for(const d of c.structs){const h={name:d.name,mangledName:d.mangledName,members:d.members.map(m=>({name:m.name,type:ra(m.type,d.path,i),align:m.align,size:m.size}))};s.set(d.mangledName,h),o.set(d.mangledName,h)}for(const d of c.aliases){const h={name:d.name,mangledName:d.mangledName,target:ra(d.target,d.path,i)};l.set(d.mangledName,h),o.set(d.mangledName,h)}}return{structs:s,aliases:l,byMangled:o}}function ra(n,i,s,l){switch(n.kind){case"identifier":{const o=n.name.indexOf(".");if(o>0){const d=n.name.slice(0,o);if(s.get(i)?.get(d)?.kind==="namespace")throw Tg(n.name)}const c=s.get(i)?.get(n.name);if(c?.kind==="namespace")throw Tg(n.name);if(!c)throw Wl(n.name,i);return{kind:"identifier",name:c.name,mangledName:c.mangledName}}case"array":case"atomic":case"vector":case"matrix":case"ptr":return{...n,element:ra(n.element,i,s)};case"texture":return{...n,sampleType:n.sampleType?ra(n.sampleType,i,s):void 0};default:return n}}function os(n,i){if(!i||n.kind!=="identifier")return n;const s=i.aliases.get(n.mangledName??n.name);return s?os(s.target,i):n}function ef(n,i){const s=os(n,i);switch(s.kind){case"array":case"atomic":case"vector":case"matrix":case"ptr":return{...s,element:ef(s.element,i)};case"texture":return{...s,sampleType:s.sampleType?ef(s.sampleType,i):void 0};default:return s}}function zw(n,i,s,l){const o=void 0;if(o!==void 0&&s.some(y=>y.path===o))return o;const c=n.from,d=i.slice(0,i.lastIndexOf("/")+1),h=c.startsWith("/")?c:_w(`${d}${c}`);return[c,h].find(y=>s.some(S=>S.path===y))??o??h}function _w(n){const i=n.startsWith("/"),s=[];for(const l of n.split("/"))!l||l==="."||(l===".."?s.pop():s.push(l));return`${i?"/":""}${s.join("/")}`}function mr(n,i,s=as(n),l=s,o){const c=o?ef(n,o):n;return Uw(c,i,s,l,o)}function Uw(n,i,s,l,o){switch(n.kind){case"scalar":return Nw(n,i,s,l);case"atomic":return kw(n,i,s,l);case"vector":return Lw(n,i,s,l,o);case"matrix":return jw(n,i,s,l,o);case"array":return Bw(n,i,s,l,o);case"identifier":return $w(n,i,s,l,o);default:throw hy(as(n))}}function Nw(n,i,s,l){const o=cy(n.name);if(n.name==="bool")throw dy();return{name:s,mangledName:l,addressSpace:i,layoutMode:ls,type:n,align:o,size:o}}function kw(n,i,s,l){return{name:s,mangledName:l,addressSpace:i,layoutMode:ls,type:n,align:4,size:4}}function Lw(n,i,s,l,o){const d=mr(n.element,i,s,l,o).size??4,h=n.width===2?d*2:d*4;return{name:s,mangledName:l,addressSpace:i,layoutMode:ls,type:n,align:h,size:d*n.width}}function jw(n,i,s,l,o){const c={kind:"vector",width:n.rows,element:n.element},d=mr(c,i,`${s}[]`,`${l}[]`,o),h=la(d.align,d.size??0);return{name:s,mangledName:l,addressSpace:i,layoutMode:ls,type:n,align:d.align,size:h*n.columns,stride:h,element:d}}function Bw(n,i,s,l,o){Gw(n.countExpression);const c=mr(n.element,i,`${s}[]`,`${l}[]`,o),d=la(fr(n.element,i,o),c.size??0);return{name:s,mangledName:l,addressSpace:i,layoutMode:ls,type:n,align:fr(n,i,o),size:n.count===void 0?void 0:d*n.count,stride:d,element:c,runtimeSized:n.count===void 0}}function Gw(n){if(n!==void 0&&!oy(n))throw Rw()}function $w(n,i,s,l,o){if(!o)throw Wl(n.name,"<unknown>");const c=o.structs.get(n.mangledName??n.name);if(!c)throw Wl(n.name,"<unknown>");const d=[];let h=0,m=1;for(const S of c.members){const b=Iw(S,i,h,o);d.push(b.member),h=Vw(i,S.type,b.offset,b.member.size??0,o),m=Math.max(m,b.member.align)}const y=Hw(i,m);return{name:s,mangledName:l,addressSpace:i,layoutMode:ls,type:n,align:y,size:la(y,h),members:d}}function Iw(n,i,s,l){const o=mr(n.type,i,n.name,n.name,l),c=Math.max(fr(n.type,i,l),n.align??1),d=Math.max(o.size??0,n.size??0),h=la(c,s);return{member:{name:n.name,offset:h,align:c,size:d,type:n.type,layout:o,explicitAlign:n.align,explicitSize:n.size},offset:h}}function Vw(n,i,s,l,o){return s+(n==="uniform"&&Fw(i,o)?la(16,l):l)}function Fw(n,i){const s=os(n,i);return s.kind==="identifier"&&i.structs.has(s.mangledName??s.name)}function Hw(n,i){return n==="uniform"?la(16,i):i}function fr(n,i,s){const l=s?os(n,s):n,o=ql(l,i,s);return i==="uniform"&&qw(l,s)?la(16,o):o}function qw(n,i){return n.kind==="array"||n.kind==="identifier"&&!!i?.structs.get(n.mangledName??n.name)}function ql(n,i,s){const l=s?os(n,s):n;switch(l.kind){case"scalar":return Yw(l.name);case"atomic":return 4;case"vector":return l.width===2?ql(l.element,i,s)*2:ql(l.element,i,s)*4;case"matrix":return ql({kind:"vector",width:l.rows,element:l.element},i,s);case"array":return fr(l.element,i,s);case"identifier":return Xw(l,i,s);default:throw hy(as(l))}}function Yw(n){if(n==="bool")throw dy();return cy(n)}function Xw(n,i,s){const l=s?.structs.get(n.mangledName??n.name);if(!l)throw Wl(n.name,"<unknown>");return Math.max(1,...l.members.map(o=>Math.max(fr(o.type,i,s),o.align??1)))}const Kw=new Set(["alias","break","case","const","const_assert","continue","continuing","default","diagnostic","discard","else","enable","false","fn","for","if","let","loop","override","requires","return","struct","switch","true","var","while"]),Qw=new Set(["import","export","from","as"]),py=new Set([...Kw,...Qw]),Pw=new Set(["NULL","Self","abstract","active","alignas","alignof","as","asm","asm_fragment","async","attribute","auto","await","become","cast","catch","class","co_await","co_return","co_yield","coherent","column_major","common","compile","compile_fragment","concept","const_cast","consteval","constexpr","constinit","crate","debugger","decltype","delete","demote","demote_to_helper","do","dynamic_cast","enum","explicit","export","extends","extern","external","fallthrough","filter","final","finally","friend","from","fxgroup","get","goto","groupshared","highp","impl","implements","import","inline","instanceof","interface","layout","lowp","macro","macro_rules","match","mediump","meta","mod","module","move","mut","mutable","namespace","new","nil","noexcept","noinline","nointerpolation","non_coherent","noncoherent","noperspective","null","nullptr","of","operator","package","packoffset","partition","pass","patch","pixelfragment","precise","precision","premerge","priv","protected","pub","public","readonly","ref","regardless","register","reinterpret_cast","require","resource","restrict","self","set","shared","sizeof","smooth","snorm","static","static_assert","static_cast","std","subroutine","super","target","template","this","thread_local","throw","trait","try","type","typedef","typeid","typename","typeof","union","unless","unorm","unsafe","unsized","use","using","varying","virtual","volatile","wgsl","where","with","writeonly","yield"]),Zw=new Set(["binding_array"]),Ww=new Set(["array","atomic","bool","f16","f32","i32","mat2x2","mat2x3","mat2x4","mat3x2","mat3x3","mat3x4","mat4x2","mat4x3","mat4x4","ptr","sampler","sampler_comparison","texture_1d","texture_2d","texture_2d_array","texture_3d","texture_cube","texture_cube_array","texture_depth_2d","texture_depth_2d_array","texture_depth_cube","texture_depth_cube_array","texture_depth_multisampled_2d","texture_external","texture_multisampled_2d","texture_storage_1d","texture_storage_2d","texture_storage_2d_array","texture_storage_3d","u32","vec2","vec2f","vec2h","vec2i","vec2u","vec3","vec3f","vec3h","vec3i","vec3u","vec4","vec4f","vec4h","vec4i","vec4u"]),Jw=new Set(["abs","acos","acosh","all","any","arrayLength","asin","asinh","atan","atan2","atanh","ceil","clamp","cos","cosh","countLeadingZeros","countOneBits","countTrailingZeros","cross","degrees","determinant","distance","dot","dot4I8Packed","dot4U8Packed","dpdx","dpdxCoarse","dpdxFine","dpdy","dpdyCoarse","dpdyFine","exp","exp2","extractBits","faceForward","firstLeadingBit","firstTrailingBit","floor","fma","fract","frexp","fwidth","fwidthCoarse","fwidthFine","insertBits","inverseSqrt","ldexp","length","log","log2","max","min","mix","modf","normalize","pack2x16float","pack2x16snorm","pack2x16unorm","pack4x8snorm","pack4x8unorm","pack4xI8","pack4xU8","pack4xI8Clamp","pack4xU8Clamp","pow","quantizeToF16","radians","reflect","refract","reverseBits","round","saturate","select","sign","sin","sinh","smoothstep","sqrt","step","storageBarrier","tan","tanh","textureBarrier","textureDimensions","textureGather","textureGatherCompare","textureLoad","textureNumLayers","textureNumLevels","textureNumSamples","textureSample","textureSampleBaseClampToEdge","textureSampleBias","textureSampleCompare","textureSampleCompareLevel","textureSampleGrad","textureSampleLevel","textureStore","transpose","trunc","unpack2x16float","unpack2x16snorm","unpack2x16unorm","unpack4x8snorm","unpack4x8unorm","unpack4xI8","unpack4xU8","workgroupBarrier"]),e2=new Set(["frag_depth","front_facing","global_invocation_id","instance_index","local_invocation_id","local_invocation_index","num_workgroups","position","sample_index","sample_mask","subgroup_invocation_id","subgroup_size","vertex_index","workgroup_id"]),t2=new Set(["align","binding","blend_src","builtin","compute","diagnostic","fragment","group","id","interpolate","invariant","location","must_use","size","vertex","workgroup_size"]),n2=new Set(["function","private","storage","uniform","workgroup"]),i2=new Set(["read","read_write","write"]),a2=new Set(["bgra8unorm","r32float","r32sint","r32uint","rg32float","rg32sint","rg32uint","rgba16float","rgba16sint","rgba16uint","rgba32float","rgba32sint","rgba32uint","rgba8sint","rgba8snorm","rgba8uint","rgba8unorm"]);[...py,...Pw,...Zw,...Ww,...Jw,...e2,...t2,...n2,...i2,...a2];const s2="VGPU-WGSL-IDENT-NONASCII",r2="https://github.com/vercel-labs/vgpu/issues/294";function l2(n,i){const s=[];let l=0,o=1,c=1;const d=(m,y,S,b,R)=>s.push({kind:m,text:n.slice(y,S),start:y,end:S,line:b,column:R}),h=()=>{n[l]===`
10
- `?(o++,c=1):c++,l++};for(;l<n.length;){const m=n[l];if(/\s/.test(m)){h();continue}const y=l,S=o,b=c;if(m==="/"&&n[l+1]==="/"){for(;l<n.length&&n[l]!==`
11
- `;)h();d("lineComment",y,l,S,b);continue}if(m==="/"&&n[l+1]==="*"){let R=0;for(;l<n.length;){if(n[l]==="/"&&n[l+1]==="*"){R++,h(),h();continue}if(n[l]==="*"&&n[l+1]==="/"){if(R--,h(),h(),R===0){d("blockComment",y,l,S,b);break}continue}h()}if(R!==0)throw et("VGPU-WGSL-LEX-UNTERM-COMMENT","Unterminated block comment",S,b);continue}if(m==='"'||m==="'"){const R=m;for(h();l<n.length&&n[l]!==R;){if(n[l]===`
12
- `)throw et("VGPU-WGSL-LEX-UNTERM-STRING","Unterminated string",S,b);n[l]==="\\"&&h(),h()}if(l>=n.length)throw et("VGPU-WGSL-LEX-UNTERM-STRING","Unterminated string",S,b);h(),d("string",y,l,S,b);continue}if(/[A-Za-z_]/.test(m)){for(;l<n.length&&/[A-Za-z0-9_]/.test(n[l]);)h();const R=n.slice(y,l);d(py.has(R)?"keyword":"ident",y,l,S,b);continue}if(/[0-9]/.test(m)||m==="."&&/[0-9]/.test(n[l+1]??"")){for(m==="."&&h();l<n.length;){const R=n[l];if(/[A-Za-z0-9_.]/.test(R)){h();continue}if((R==="+"||R==="-")&&u2(n[l-1])&&/[0-9]/.test(n[l+1]??"")){h();continue}break}d("number",y,l,S,b);continue}if(m.charCodeAt(0)>127)throw o2(n,l,o,c,i);h(),d("punct",y,l,S,b)}return s}function o2(n,i,s,l,o){let c=i;for(;c>0&&Ag(n[c-1]);)c--;let d=i+1;for(;d<n.length&&Ag(n[d]);)d++;const h=n.slice(c,d),m=l-(i-c),y=o===void 0?"":` in ${o}`,S=IS(s2,`Non-ASCII identifier '${h}'${y} at line ${s} column ${m}; vgpu's WGSL pipeline supports ASCII identifiers only`,{fix:`Rename '${h}' using ASCII letters, digits and '_'. Unicode (XID) identifiers are tracked in ${r2}`,line:s,column:m});return S.range={file:o,start:{line:s,column:m}},S}function Ag(n){return n.charCodeAt(0)>127||/[A-Za-z0-9_]/.test(n)}function u2(n){return n==="e"||n==="E"||n==="p"||n==="P"}const c2=/^_vgsl_[0-9a-f]{8,16}__[A-Za-z_][A-Za-z0-9_]*$/,f2=new Set(["fn","struct","const","alias","var","override"]);function my(n){return new d2(n).analyze()}class d2{tokens;scopes=[];declarations=[];references=[];functions=[];preserved=new Map;symbolsByScope=new Map;moduleFallbackReasons=[];pendingSymbols=[];moduleScopeId;constructor(i){this.tokens=i,this.moduleScopeId=this.createScope("module",void 0,void 0,0)}analyze(){this.collectTopLevel();for(const i of this.functions)this.walkFunction(i);return{tokens:this.tokens,scopes:this.scopes,declarations:this.declarations,references:this.references,functions:this.functions,preservedTokens:[...this.preserved.entries()].map(([i,s])=>({tokenIndex:i,reason:s})),fallback:{wholeModule:this.moduleFallbackReasons.length>0,reasons:this.moduleFallbackReasons}}}collectTopLevel(){let i=0;for(let s=0;s<this.tokens.length;s++){const l=this.tokens[s];if(!Qn(l)){if(l.text==="{"){i++;continue}if(l.text==="}"){i--,i<0&&(this.moduleFallback("unmatched top-level closing brace",s),i=0);continue}if(i===0){if(l.text==="@"){s=this.preserveAttribute(s);continue}if(l.text==="enable"||l.text==="requires"||l.text==="diagnostic"||l.text==="const_assert"){s=this.preserveStatement(s,"directive");continue}if(l.text!=="export"){if(l.text==="struct"){s=this.collectStruct(s);continue}if(l.text==="fn"){s=this.collectFunction(s);continue}if(l.text==="const"||l.text==="alias"||l.text==="var"||l.text==="override"){s=this.preserveGlobalDeclaration(s);continue}l.kind==="keyword"&&!f2.has(l.text)&&this.moduleFallback(`unexpected top-level keyword '${l.text}'`,s)}}}}i!==0&&this.moduleFallback("unclosed top-level brace",this.tokens.length-1),this.scopes[this.moduleScopeId].endToken=Math.max(0,this.tokens.length-1)}collectStruct(i){const s=this.nextSig(i);if(s===void 0||this.tokens[s]?.kind!=="ident")return this.moduleFallback("struct without name",i),i;this.preserveToken(s,"global");const l=this.nextSig(s);if(l===void 0||this.tokens[l]?.text!=="{")return this.moduleFallback("struct without body",i),s;const o=this.findMatching(l,"{","}");if(o===void 0)return this.moduleFallback("unclosed struct body",l),l;for(let c=l;c<=o;c++)this.tokens[c]?.kind==="ident"&&this.preserveToken(c,"struct");return o}collectFunction(i){const s=this.nextSig(i);if(s===void 0||this.tokens[s]?.kind!=="ident")return this.moduleFallback("function without name",i),i;const l=this.tokens[s].text,o=c2.test(l)&&!this.hasEntryAttributeBefore(i);this.addDeclaration(l,"function",s,this.moduleScopeId,void 0,o),o||this.preserveToken(s,"global");const c=this.nextSig(s);if(c===void 0||this.tokens[c]?.text!=="(")return this.moduleFallback("function without parameter list",s),s;const d=this.findMatching(c,"(",")");if(d===void 0)return this.moduleFallback("unclosed function parameter list",c),c;const h=this.findNextText(d+1,"{");if(h===void 0)return this.moduleFallback("function without body",d),d;this.preserveFunctionSignatureTail(d+1,h);const m=this.findMatching(h,"{","}");if(m===void 0)return this.moduleFallback("unclosed function body",h),h;const y=this.createScope("function",this.moduleScopeId,this.functions.length,c);return this.functions.push({id:this.functions.length,name:l,nameTokenIndex:s,scopeId:y,bodyStartToken:h,bodyEndToken:m,skipped:!1,fallbackReasons:[]}),this.collectParams(c,d,y,this.functions.length-1),this.scopes[y].endToken=m,m}collectParams(i,s,l,o){for(let c=i+1;c<s;c++){const d=this.tokens[c];if(!Qn(d)){if(d.text==="@"){c=this.preserveAttribute(c);continue}if(d.kind==="ident"&&this.nextSig(c)!==void 0&&this.tokens[this.nextSig(c)]?.text===":"){this.addDeclaration(d.text,"param",c,l,o,!0);const h=this.nextSig(c);c=this.preserveTypeFrom(h+1,[",",")"],s)}}}}preserveFunctionSignatureTail(i,s){for(let l=i;l<s;l++){const o=this.tokens[l];if(!Qn(o)){if(o.text==="@"){l=this.preserveAttribute(l);continue}o.kind==="ident"&&this.preserveToken(l,"type")}}}preserveGlobalDeclaration(i){let s=i+1;if(this.tokens[i]?.text==="var"){const c=this.nextSig(i);if(c!==void 0&&this.tokens[c]?.text==="<"){const d=this.findMatching(c,"<",">");if(d===void 0)return this.moduleFallback("unparseable top-level var template",c),c;this.preserveRange(c,d,"type"),s=d+1}}const l=this.findNextIdent(s);l!==void 0&&(this.preserveToken(l,"global"),this.addDeclaration(this.tokens[l].text,"global",l,this.moduleScopeId,void 0,!1));const o=this.findStatementEnd(i);for(let c=i;c<=o;c++)this.tokens[c]?.kind==="ident"&&this.preserveToken(c,"global");return o}walkFunction(i){const s=[this.moduleScopeId,i.scopeId],l=[],o=(h,m)=>{const y=this.createScope(h,s[s.length-1],i.id,m);return s.push(y),y},c=h=>{if(s.length<=2){this.functionFallback(i,"scope frame underflow",h);return}const m=s.pop();return this.scopes[m].endToken=h,m};o("block",i.bodyStartToken);let d=1;for(let h=i.bodyStartToken+1;h<i.bodyEndToken;h++){this.activatePendingSymbols(h);const m=this.tokens[h];if(Qn(m))continue;if(m.text==="@"){h=this.preserveAttribute(h);continue}if(m.text==="."){const S=this.nextSig(h);S!==void 0&&this.tokens[S]?.kind==="ident"&&this.preserveToken(S,"member");continue}if(m.text==="enable"||m.text==="requires"||m.text==="diagnostic"){h=this.preserveStatement(h,"directive");continue}if(m.text==="for"){const S=o("for-init",h),b=this.nextSig(h);(b===void 0||this.tokens[b]?.text!=="(")&&this.functionFallback(i,"for without parenthesized header",h),l.push({scopeId:S,headerDepth:0,awaitingBody:!1});continue}const y=l[l.length-1];if(y&&y.bodyDepth===void 0&&(m.text==="("&&y.headerDepth++,m.text===")"&&(y.headerDepth--,y.headerDepth<=0&&(y.awaitingBody=!0))),m.text==="{"){d++;const S=h2(l,b=>b.awaitingBody&&b.bodyDepth===void 0);S&&(S.bodyDepth=d),o("block",h);continue}if(m.text==="}"){const S=d;for(c(h),d--;l.length>0&&l[l.length-1].bodyDepth===S;)c(h),l.pop();d<0&&this.functionFallback(i,"unmatched closing brace",h);continue}if(m.text===":"){h=this.preserveTypeFrom(h+1,["=",";",",",")","{"],i.bodyEndToken);continue}if(m.text==="-"&&this.tokens[this.nextSig(h)??-1]?.text===">"){h=this.preserveTypeFrom((this.nextSig(h)??h)+1,["{"],i.bodyEndToken);continue}if(m.text==="let"||m.text==="const"||m.text==="var"){h=this.collectLocalDeclaration(h,s[s.length-1],i);continue}if(m.kind==="ident"&&!this.preserved.has(h)){const S=this.resolve(m.text,s);S!==void 0?this.references.push({name:m.text,tokenIndex:h,declarationId:S,scopeId:s[s.length-1],functionId:i.id}):this.preserveToken(h,"unknown")}}for(;s.length>2;)c(i.bodyEndToken)}collectLocalDeclaration(i,s,l){const o=this.tokens[i].text;let c=i+1;if(o==="var"){const m=this.nextSig(i);if(m!==void 0&&this.tokens[m]?.text==="<"){const y=this.findMatching(m,"<",">");if(y===void 0)return this.functionFallback(l,"unparseable var template",m),m;this.preserveRange(m,y,"type"),c=y+1}}const d=this.findNextIdent(c);if(d===void 0||d>=l.bodyEndToken)return this.functionFallback(l,`${o} without identifier`,i),i;this.addDeclaration(this.tokens[d].text,o,d,s,l.id,!0,this.findStatementEnd(i));const h=this.nextSig(d);return h!==void 0&&this.tokens[h]?.text===":"?this.preserveTypeFrom(h+1,["=",";",",",")"],l.bodyEndToken):d}addDeclaration(i,s,l,o,c,d,h){const m=this.declarations.length;return this.declarations.push({id:m,name:i,kind:s,tokenIndex:l,scopeId:o,functionId:c,safeToRename:d}),h!==void 0?this.pendingSymbols.push({name:i,id:m,scopeId:o,activateAfter:h}):this.activateSymbol(i,m,o),m}activatePendingSymbols(i){for(let s=this.pendingSymbols.length-1;s>=0;s--){const l=this.pendingSymbols[s];l.activateAfter>=i||(this.activateSymbol(l.name,l.id,l.scopeId),this.pendingSymbols.splice(s,1))}}activateSymbol(i,s,l){let o=this.symbolsByScope.get(l);o||(o=new Map,this.symbolsByScope.set(l,o)),o.has(i)||o.set(i,s)}resolve(i,s){for(let l=s.length-1;l>=0;l--){const o=this.symbolsByScope.get(s[l])?.get(i);if(o!==void 0)return o}}preserveAttribute(i){this.preserveToken(i,"attribute");const s=this.nextSig(i);if(s===void 0)return i;this.preserveToken(s,"attribute");const l=this.nextSig(s);if(l===void 0||this.tokens[l]?.text!=="(")return s;const o=this.findMatching(l,"(",")");return o===void 0?(this.preserveRange(l,l,"attribute"),l):(this.preserveRange(l,o,"attribute"),o)}preserveTypeFrom(i,s,l){let o=0,c=0,d=0,h=i-1;for(let m=i;m<l;m++){const y=this.tokens[m];if(!Qn(y)){if(o===0&&c===0&&d===0&&s.includes(y.text))return Math.max(i-1,m-1);if(y.text==="<")o++;else if(y.text===">")o=Math.max(0,o-1);else if(y.text==="(")c++;else if(y.text===")"){if(c===0&&s.includes(")"))return Math.max(i-1,m-1);c=Math.max(0,c-1)}else y.text==="["?d++:y.text==="]"&&(d=Math.max(0,d-1));y.kind==="ident"&&this.preserveToken(m,"type"),h=m}}return h}preserveStatement(i,s){const l=this.findStatementEnd(i);return this.preserveRange(i,l,s),l}preserveRange(i,s,l){for(let o=i;o<=s;o++)this.tokens[o]&&this.tokens[o].kind!=="lineComment"&&this.tokens[o].kind!=="blockComment"&&this.preserveToken(o,l)}preserveToken(i,s){this.preserved.has(i)||this.preserved.set(i,s)}createScope(i,s,l,o){const c=this.scopes.length;return this.scopes.push({id:c,kind:i,parentId:s,functionId:l,startToken:o}),c}nextSig(i){for(let s=i+1;s<this.tokens.length;s++)if(!Qn(this.tokens[s]))return s}findNextIdent(i){for(let s=i;s<this.tokens.length;s++){const l=this.tokens[s];if(!Qn(l)){if(l.kind==="ident")return s;if(l.text!=="@")return}}}findNextText(i,s){for(let l=i;l<this.tokens.length;l++)if(!Qn(this.tokens[l])&&this.tokens[l].text===s)return l}findStatementEnd(i){let s=0;for(let l=i;l<this.tokens.length;l++){const o=this.tokens[l].text;if(o==="(")s++;else if(o===")")s=Math.max(0,s-1);else if(s===0&&(o===";"||o==="{"||o==="}"))return l}return this.tokens.length-1}findMatching(i,s,l){let o=0;for(let c=i;c<this.tokens.length;c++){const d=this.tokens[c].text;if(d===s&&o++,d===l&&(o--,o===0))return c}}hasEntryAttributeBefore(i){for(let s=i-1;s>=0;s--){const l=this.tokens[s];if(!Qn(l)){if(l.text===")"||l.kind==="ident"||l.text==="@"){const o=l.text;if(o==="compute"||o==="vertex"||o==="fragment")return!0;continue}break}}return!1}moduleFallback(i,s){this.moduleFallbackReasons.push(`${i} at token ${s}`)}functionFallback(i,s,l){i.skipped=!0,i.fallbackReasons.push(`${s} at token ${l}`)}}function h2(n,i){for(let s=n.length-1;s>=0;s--)if(i(n[s]))return n[s]}function Qn(n){return n.kind==="lineComment"||n.kind==="blockComment"}const p2=new Set(["textureSample","textureSampleBias","textureSampleLevel","textureSampleGrad","textureGather","textureSampleBaseClampToEdge"]),m2=new Set(["textureSampleCompare","textureSampleCompareLevel","textureGatherCompare"]);function g2(n,i,s){const l=new Map;for(let o=0;o<n.length;o++){const c=n[o],d=i[o],h=my(c.tokens),m=new Map;for(const S of d.vars){const b=Xt(S.attrs,"group"),R=Xt(S.attrs,"binding"),L=h.declarations.find(j=>j.kind==="global"&&j.name===S.name);b!==void 0&&R!==void 0&&L&&m.set(L.id,{group:b,binding:R})}const y=new Map;for(const S of h.declarations){if(S.kind!=="function")continue;const b=h.functions.find(R=>R.nameTokenIndex===S.tokenIndex);b&&y.set(S.id,b.id)}for(const S of d.entries){const b=h.functions.find(D=>D.name===S.name),R=[];let L=h.fallback.wholeModule||!b;!L&&b&&(L=!gy(b.id,new Map,new Set,h,m,y,R));const j=b?S2(b.id,h,m,y):s.map(tf);l.set(S,L?w2(s,j):E2(R))}}return l}function gy(n,i,s,l,o,c,d){const h=l.functions[n];if(!h||h.skipped)return!1;const m=`${n}|${[...i].map(([b,R])=>`${b}:${R.group}:${R.binding}`).join(",")}`;if(s.has(m))return!0;s.add(m);const y=l.references.filter(b=>b.functionId===n),S=new Map(y.map(b=>[b.tokenIndex,b]));for(let b=h.bodyStartToken+1;b<h.bodyEndToken;b++){const R=l.tokens[b]?.text,L=p2.has(R??"")?"filtering":m2.has(R??"")?"comparison":void 0,j=S.get(b),D=j&&c.get(j.declarationId);if(!L&&D===void 0)continue;const B=x2(l,b);if(B===void 0||l.tokens[B]?.text!=="(")continue;const Q=b2(l,B);if(!Q)return!1;const Z=Q.map(([F,V])=>y2(F,V,l,o,i));if(L){const F=R==="textureGather"&&!v2(Q[0],l,o,i)?1:0,V=Z[F],K=Z[F+1];if(!V||!K)return!1;d.push({texture:V,sampler:K,mode:L})}else{const F=l.declarations.filter(K=>K.kind==="param"&&K.functionId===D).sort((K,Y)=>K.tokenIndex-Y.tokenIndex),V=new Map;for(let K=0;K<F.length;K++)Z[K]&&V.set(F[K].id,Z[K]);if(!gy(D,V,s,l,o,c,d))return!1}}return!0}function y2(n,i,s,l,o){for(const c of s.references){if(c.tokenIndex<n||c.tokenIndex>i)continue;const d=l.get(c.declarationId)??o.get(c.declarationId);if(d)return d}}function v2(n,i,s,l){const o=i.references.find(c=>c.tokenIndex>=n[0]&&c.tokenIndex<=n[1]);return o?.tokenIndex===n[0]?s.get(o.declarationId)??l.get(o.declarationId):void 0}function b2(n,i){const s=[];let l=1,o=0,c=0,d=0,h=i+1;for(let m=i+1;m<n.tokens.length;m++){const y=n.tokens[m].text;if(y==="(")l++;else if(y===")"){if(l--,l===0)return s.push([h,m-1]),s}else y==="["?o++:y==="]"?o--:y==="{"?c++:y==="}"?c--:y==="<"?d++:y===">"?d--:y===","&&l===1&&o===0&&c===0&&d===0&&(s.push([h,m-1]),h=m+1)}}function x2(n,i){for(let s=i+1;s<n.tokens.length;s++)if(n.tokens[s].kind!=="lineComment"&&n.tokens[s].kind!=="blockComment")return s}function S2(n,i,s,l){const o=[n],c=new Set,d=new Map;for(;o.length;){const h=o.pop();if(!c.has(h)){c.add(h);for(const m of i.references){if(m.functionId!==h)continue;const y=s.get(m.declarationId);y&&d.set(`${y.group}:${y.binding}`,y);const S=l.get(m.declarationId);S!==void 0&&o.push(S)}}}return[...d.values()]}function w2(n,i){const s=new Set(i.map(d=>`${d.group}:${d.binding}`)),l=n.filter(d=>s.has(`${d.group}:${d.binding}`)),o=l.filter(d=>d.bindingLayout?.kind==="texture"&&d.bindingLayout.texture.sampleType==="unfilterable-float"&&!d.bindingLayout.texture.multisampled),c=l.filter(d=>d.bindingLayout?.kind==="sampler"&&d.bindingLayout.sampler.type==="filtering");return o.flatMap(d=>c.map(h=>({texture:tf(d),sampler:tf(h),mode:"filtering"})))}function tf(n){return{group:n.group,binding:n.binding}}function E2(n){const i=new Set;return n.filter(s=>{const l=`${s.texture.group}:${s.texture.binding}:${s.sampler.group}:${s.sampler.binding}:${s.mode}`;return i.has(l)?!1:(i.add(l),!0)})}function T2(n,i){const s=n.map(gw),l=Dw(n,s),o=Ow(s,l),c=[],d=[];for(const y of s)for(const S of y.vars){const b=Xt(S.attrs,"group"),R=Xt(S.attrs,"binding");if(b===void 0||R===void 0)continue;const L=ra(S.type,S.path,l),j=XS(L,S.addressSpace),D=S.addressSpace==="uniform"||S.addressSpace==="storage"?mr(L,S.addressSpace,S.name,S.mangledName,o):void 0;D&&d.push(D),c.push({group:b,binding:R,name:S.name,mangledName:S.mangledName,type:L,kind:j,addressSpace:S.addressSpace,access:S.access,struct:L.kind==="identifier"?o.structs.get(L.mangledName??L.name):void 0,layout:D,bindingLayout:KS(j,S.addressSpace,S.access,L,D)})}c.sort((y,S)=>y.group-S.group||y.binding-S.binding);const h=A2(n,s,c),m=g2(n,s,c);return{bindings:c,entryPoints:s.flatMap(y=>y.entries.map(S=>M2(S,s.flatMap(b=>b.structs),l,o,h.get(S)??c,m.get(S)??[]))),overrides:s.flatMap(y=>y.overrides),featuresRequired:[...new Set(s.flatMap(y=>y.features))],aliases:[...o.aliases.values()],structs:[...o.structs.values()],hostShareableLayouts:d}}function A2(n,i,s){const l=new Map;for(let o=0;o<n.length;o++){const c=n[o],d=i[o],h=my(c.tokens),m=h.fallback.wholeModule,y=new Map;for(const b of h.declarations){if(b.kind!=="function")continue;const R=h.functions.find(L=>L.nameTokenIndex===b.tokenIndex);R&&y.set(b.id,R.id)}const S=new Map;for(const b of d.vars){const R=Xt(b.attrs,"group"),L=Xt(b.attrs,"binding");if(R===void 0||L===void 0)continue;const j=h.declarations.find(D=>D.kind==="global"&&D.name===b.name);j&&S.set(j.id,{group:R,binding:L})}for(const b of d.entries){const R=h.functions.find(B=>B.name===b.name);if(m||!R){l.set(b,s);continue}const L=[R.id],j=new Set,D=new Map;for(;L.length;){const B=L.pop();if(!j.has(B)&&(j.add(B),!!h.functions[B]))for(const Q of h.references){if(Q.functionId!==B)continue;const Z=S.get(Q.declarationId);Z&&D.set(`${Z.group}:${Z.binding}`,Z);const F=y.get(Q.declarationId);F!==void 0&&L.push(F)}}l.set(b,[...D.values()].sort((B,Q)=>B.group-Q.group||B.binding-Q.binding))}}return l}function M2(n,i,s,l,o,c){return{name:n.name,mangledName:n.mangledName,stage:n.stage,...n.workgroupSize?{workgroupSize:n.workgroupSize}:{},bindings:o.map(({group:d,binding:h})=>({group:d,binding:h})),samplingPairs:c,...n.stage==="vertex"?{inputs:R2(n,i,s,l)}:{}}}function R2(n,i,s,l){const o=[];for(const c of n.params){if(Mg(c.attrs,"builtin"))continue;const d=ra(c.type,n.path,s),h=Xt(c.attrs,"location");if(h!==void 0){o.push({name:c.name,location:h,type:d});continue}const m=os(d,l);if(m.kind!=="identifier")continue;const y=i.find(b=>b.mangledName===(m.mangledName??m.name)),S=l.structs.get(m.mangledName??m.name);if(y)for(let b=0;b<y.members.length;b++){const R=y.members[b];if(Mg(R.attrs,"builtin"))continue;const L=Xt(R.attrs,"location");L!==void 0&&o.push({name:R.name,location:L,type:S?.members[b]?.type??ra(R.type,y.path,s)})}}return o}function Mg(n,i){return n.some(s=>s.name===i)}function yy(n,i="<runtime>"){const s=l2(n,i),l=FS(s);if(l.imports.length>0)throw et("VGPU-WGSL-REFLECT-SOURCE-IMPORT","reflectSource() accepts a single raw WGSL string; use resolveShader() for WGSL import graphs.");return T2([{path:i,source:n,tokens:s,parsed:l}])}function vy(){const n=new Map;return{getOrCreate(i,s,l,o){const c=l.map(nf),d=`${i}:${s}:${c.join("|")}`,h=n.get(d);if(h)return h.bindGroup;const m=o();return n.set(d,{identities:c,bindGroup:m}),m},evictIdentity(i){const s=nf(i);for(const[l,o]of n)o.identities.includes(s)&&n.delete(l)},clearDraw(i){const s=`${i}:`;for(const l of n.keys())l.startsWith(s)&&n.delete(l)},dispose(){n.clear()}}}function nf(n){return typeof n=="string"||typeof n=="number"?String(n):`${n.kind}:${n.id}`}function Jl(n,i,s){const l=n[i];if(!l)throw new se({code:"VGPU-REFLECT-ENTRY-METADATA-MISSING",message:`Entry point '${n.name}' has no reflected ${i}.`,fix:"Pass the reflection from reflectSource()/resolveShader().",where:s});return l}const eo=new WeakMap;function ur(n,i){if(!n.gpu.pushErrorScope||!n.gpu.popErrorScope)return;n.gpu.pushErrorScope("validation");const s=eo.get(n.gpu);s?s.push(i):eo.set(n.gpu,[i])}function un(n){const i=eo.get(n.gpu);if(!i?.length||!n.gpu.popErrorScope)return;const s=i.pop();return i.length||eo.delete(n.gpu),{context:s,error:n.gpu.popErrorScope()}}function by(n){const i=[];let s=un(n);for(;s;)i.push(s),s=un(n);return i}function D2(n){const i=un(n);i&&wf(i)}function xy(n){for(const i of by(n))wf(i)}function qt(n){for(const i of n)wf(i)}function Sf(n){return n.gpu.queue.onSubmittedWorkDone?.()??Promise.resolve()}function Sy(n,i=[],s={}){return O2(n,i,s.errorSink??z2)}function to(n,i){return{context:n.context,error:C2(n.error,i.error)}}async function C2(n,i){const s=await Promise.allSettled([n,i]);for(const o of s)if(o.status==="fulfilled"&&o.value)return o.value;const l=s.find(o=>o.status==="rejected");if(l?.status==="rejected")throw l.reason;return null}async function O2(n,i,s){await Sf(n);for(const l of i)try{const o=await l.error;o&&await s(ss(l.context.label,l.context.group,o))}catch(o){await s(ss(l.context.label,l.context.group,o))}}function wf(n){n.error.catch(()=>{})}function z2(n){console.error(n)}function wy(n,i,s,l){try{i.end()}catch(o){const c=by(n);qt(s),qt(c),s.length=0;const d=c[0]?.context??l;throw d?ss(d.label,d.group,o):o}}let _2=1;const Rg=new WeakMap;function U2(n){return n===null||typeof n!="object"||ArrayBuffer.isView(n)||n instanceof ArrayBuffer||Array.isArray(n)?!0:n instanceof Di||n instanceof rs?!1:!Ty(n)}function af(n){return typeof n!="object"||n===null||Array.isArray(n)||ArrayBuffer.isView(n)||n instanceof ArrayBuffer||n instanceof Di||n instanceof rs?!1:!Ty(n)}function Dg(n,i,s){switch(n.bindingLayout?.kind){case"buffer":return N2(n,i,s);case"texture":return k2(n,i,s);case"sampler":return L2(n,i);case"storageTexture":throw Zn(n,"storage texture","Pass a storage-compatible texture.");case"externalTexture":throw Zn(n,"external texture","Pass a compatible GPUExternalTexture.");default:throw Zn(n,"reflected resource","Fix shader reflection bindingLayout.")}}function N2(n,i,s){const l=BS(i);if(l)return l[ty](n,s.sourceHint);if(i instanceof Di)return Sg(i,`${s.sourceHint}.set`),B2(n,i.options.usage),{resource:{buffer:i.gpu},identity:i.resourceIdentity,unsubscribe:o=>i.onDestroy(o)};if($2(i))return Sg(i.buffer,`${s.sourceHint}.set`),{resource:{buffer:i.gpu,offset:0,size:i.size},identity:i.buffer.resourceIdentity,unsubscribe:o=>i.buffer.onDestroy(o)};if(My(i))return{resource:i,identity:dr(i.buffer)};if(Ef(i))return{resource:{buffer:i},identity:dr(i)};throw Zn(n,"buffer",`Pass a compatible Buffer/Uniform: ${n.name}.set({ ${n.name}: gpu.device.createBuffer(...) }).`)}function k2(n,i,s){const l=Ey(i);if(l){const o=l.color;Cg(n,o,s);const c=l.onTexturesRecreated?.bind(l);return{resource:o.createView(),identity:o.resourceIdentity,unsubscribe:d=>l.onDestroy(d),onRecreate:c?d=>c(d):void 0}}if(i instanceof rs)return G2(n,i.usage),Cg(n,i,s),{resource:i.createView(),identity:i.resourceIdentity,unsubscribe:o=>i.onDestroy(o)};if(Ay(i))return{resource:i.createView(),identity:i.resourceIdentity??dr(i)};if(typeof i=="object"&&i!==null)return{resource:i,identity:dr(i)};throw Zn(n,"texture/target",`Pass a Texture or Target: ${n.name}.set({ ${n.name}: scene.color }) or set({ ${n.name}: scene }).`)}function L2(n,i){if(j2(i))return{resource:i,identity:dr(i)};throw Zn(n,"sampler",`Use the cached sampler: set({ ${n.name}: sampler(gpu) }).`)}function j2(n){return typeof n!="object"||n===null||n instanceof Di||n instanceof rs?!1:!Ef(n)&&!My(n)&&!Ay(n)&&!Ey(n)}function B2(n,i){const s=n.bindingLayout?.kind==="buffer"?n.bindingLayout.buffer.type:void 0;if(s==="uniform"&&!i.includes("uniform"))throw Zn(n,"uniform buffer","Create with usage: ['uniform','copy_dst'].");if((s==="storage"||s==="read-only-storage")&&!i.includes("storage"))throw Zn(n,"storage buffer","Create with usage: ['storage','copy_dst'].")}function G2(n,i){if(!i.includes("texture_binding")&&!i.includes("render_attachment"))throw Zn(n,"sampled texture","Use texture_binding usage or a sampleable Target.")}function Cg(n,i,s){if(!(!s.filterableTexture||s.float32Filterable)&&(i.format==="r32float"||i.format==="rg32float"||i.format==="rgba32float"))throw nS(s.sourceHint,n,i.format,i.label??"texture",s.pairedSampler)}function Ey(n){if(typeof n!="object"||n===null)return;const i=n;if(!(!i.resourceIdentity||!i.color||typeof i.onDestroy!="function"))return i}function Ty(n){const i=n;return"gpu"in i||"bindGroup"in i||"createView"in i||"resourceIdentity"in i}function dr(n){if(typeof n!="object"||n===null)return`value:${String(n)}`;let i=Rg.get(n);return i||(i={kind:"external",id:_2++},Rg.set(n,i)),i}function $2(n){return typeof n=="object"&&n!==null&&"gpu"in n&&"size"in n&&"buffer"in n&&n.buffer instanceof Di}function Ay(n){return typeof n=="object"&&n!==null&&typeof n.createView=="function"}function My(n){return typeof n=="object"&&n!==null&&"buffer"in n&&Ef(n.buffer)}function Ef(n){return typeof n=="object"&&n!==null&&"size"in n&&"usage"in n&&typeof n.destroy=="function"}function I2(n,i){V2(n);const s=new ArrayBuffer(n.size);return Tf(new DataView(s),n,0,i),s}function V2(n){if(n.size===void 0)throw Yt("set",`No se puede inferir byteLength para layout runtime-sized '${n.name}'.`)}function Tf(n,i,s,l){if(i.members)return F2(n,i.members,s,l);H2(n,i,s,l)}function F2(n,i,s,l){const o=l;for(const c of i)Tf(n,c.layout,s+c.offset,o?.[c.name])}function H2(n,i,s,l){switch(i.type.kind){case"scalar":return Af(n,s,i.type.name,l);case"vector":return q2(n,s,i.type,l);case"matrix":return Y2(n,i,s,l);case"array":return X2(n,i,s,l);default:throw Yt("set",`No hay writer para layout ${i.type.kind}.`)}}function Af(n,i,s,l){s==="f32"?n.setFloat32(i,Number(l??0),!0):s==="i32"?n.setInt32(i,Number(l??0),!0):s==="u32"||s==="bool"?n.setUint32(i,s==="bool"?l?1:0:Number(l??0),!0):n.setUint16(i,K2(Number(l??0)),!0)}function q2(n,i,s,l){const o=l,c=Ry(s.element);for(let d=0;d<s.width;d++)Af(n,i+d*c,Mf(s.element),o?.[d]??0)}function Y2(n,i,s,l){const o=i.type,c=l,d=Ry(o.element),h=i.stride??16;for(let m=0;m<o.columns;m++)for(let y=0;y<o.rows;y++)Af(n,s+m*h+y*d,Mf(o.element),c?.[m*o.rows+y]??0)}function X2(n,i,s,l){const o=l,c=i.stride??i.element?.size??0;if(!i.element)throw Yt("set","Array layout sin element layout.");for(let d=0;d<(o?.length??0);d++)Tf(n,i.element,s+d*c,o[d])}function Ry(n){return Mf(n)==="f16"?2:4}function Mf(n){if(n.kind!=="scalar")throw Yt("set",`Expected scalar, got ${n.kind}`);return n.name}function K2(n){const i=new Float32Array(1),s=new Uint32Array(i.buffer);i[0]=n;const l=s[0],o=l>>16&32768,c=l&8388607,d=l>>23&255;if(d===255)return o|(c?32256:31744);const h=d-127+15;return h>=31?o|31744:h<=0?h<-10?o:o|(c|8388608)>>1-h+13:o|h<<10|c>>13}const Og=new WeakMap;function Q2(n,i){const s=new Map,l=new Set;for(const c of i){const d=c.stage==="vertex"?1:c.stage==="fragment"?2:4;for(const h of Jl(c,"bindings","visibility")){const m=`${h.group}:${h.binding}`;s.set(m,(s.get(m)??0)|d)}for(const h of Jl(c,"samplingPairs","visibility"))h.mode==="filtering"&&l.add(`${h.texture.group}:${h.texture.binding}`)}const o=c=>s.get(`${c.group}:${c.binding}`)??0;return Object.defineProperty(o,"filterable",{value:l}),o}function Dy(n,i,s=Rf){return n.flatMap(l=>{if(l.group!==i)return[];const o=s(l);return o===0?[]:[{binding:l.binding,visibility:o,...W2(l,s.filterable?.has(`${l.group}:${l.binding}`)??!1)}]})}function P2(n,i,s,l=Rf){const o=new Map,c=s.bindings.filter(h=>l(h)!==0).map(h=>h.group),d=Math.max(-1,...c);for(let h=0;h<=d;h++)o.set(h,Z2(n,i,s,h,l));return o}function Z2(n,i,s,l,o=Rf){return Cy(n,`${i}.group${l}.bgl`,Dy(s.bindings,l,o))}function Cy(n,i,s){let l=Og.get(n.gpu);l||(l=new Map,Og.set(n.gpu,l));const o=JSON.stringify(s),c=l.get(o);if(c)return c;const d=J1(n.gpu.createBindGroupLayout({label:i,entries:s}),{entries:s});return l.set(o,d),d}function W2(n,i){const s=n.bindingLayout;if(!s)throw Yt("bindGroupLayout",`Binding '${n.name}' does not have a reflected bindingLayout.`);return i&&s.kind==="texture"&&s.texture.sampleType==="unfilterable-float"&&!s.texture.multisampled?{texture:{...s.texture,sampleType:"float"}}:J2(s)}function J2(n){switch(n.kind){case"buffer":return{buffer:{...n.buffer}};case"sampler":return{sampler:{...n.sampler}};case"texture":return{texture:{...n.texture}};case"storageTexture":return{storageTexture:{...n.storageTexture}};case"externalTexture":return{externalTexture:{}}}}function Rf(n){const i=globalThis.GPUShaderStage,s=i?.VERTEX??1,l=i?.FRAGMENT??2,o=i?.COMPUTE??4;return n.kind==="buffer"?s|l|o:l|o}function eE(n){const i=tE(n.reflection),s=[...n.bindGroupLayouts.keys()].sort((w,N)=>w-N),l=new Map;function o(w){const N=[];for(const[te,ne]of Object.entries(w))N.push(...d(te,ne));return N}function c(w){const N=n.bindGroupLayouts.get(w.info.group);return!!N&&!!or(N)?.entries.some(te=>te.binding===w.info.binding)}function d(w,N){const te=i.get(w);if(te)return h(te,w,N);const ne=nE(w,i,n.label);if(!ne)throw Yt(`${n.label}.set`,`Binding '${w}' does not exist in '${n.label}'.`);return m(ne,w,N)}function h(w,N,te){K(w.info.group);const ne=zg(w.info,te);_g(w,N,ne);const le=Yl(w.identity);return ne==="lib"?y(w,rE(w.libValue,te)):b(w,te),c(w)?Lc(w,le):[]}function m(w,N,te){K(w.info.group);const ne=zg(w.info,te);if(_g(w,N,ne),iE(w,N,ne),ne!=="lib")throw Yt(`${n.label}.set`,`Member '${N}' needs a JS value; set resource '${w.info.name}' instead.`);const le=Yl(w.identity);return y(w,{...lE(w.libValue),[N]:te}),c(w)?Lc(w,le):[]}function y(w,N){const te=A(w);w.libValue=N;const ne=I2(te,N);w.buffer||Y(w,te.size),w.bytes=ne,w.buffer.write(ne,0)}function S(w){const N=or(n.bindGroupLayouts.get(w.group))?.entries.find(le=>le.binding===w.binding),te=n.reflection.entryPoints.flatMap(le=>Jl(le,"samplingPairs",n.label)).find(le=>le.mode==="filtering"&&le.texture.group===w.group&&le.texture.binding===w.binding),ne=te&&n.reflection.bindings.find(le=>le.group===te.sampler.group&&le.binding===te.sampler.binding);return{sourceHint:n.label,filterableTexture:N?.texture?.sampleType==="float",float32Filterable:n.device.features.has("float32-filterable"),pairedSampler:ne}}function b(w,N){const te=Dg(w.info,N,S(w.info));w.unsubscribe?.(),w.unsubscribeRecreate?.(),w.resource=te.resource,w.identity=te.identity,w.unsubscribe=te.unsubscribe?.(()=>{w.identity&&n.cache.evictIdentity(w.identity)}),w.unsubscribeRecreate=te.onRecreate?.(()=>R(w,N))}function R(w,N){const te=Yl(w.identity);w.identity&&n.cache.evictIdentity(w.identity);const ne=Dg(w.info,N,S(w.info));if(w.unsubscribe?.(),w.unsubscribeRecreate?.(),w.resource=ne.resource,w.identity=ne.identity,w.unsubscribe=ne.unsubscribe?.(()=>{w.identity&&n.cache.evictIdentity(w.identity)}),w.unsubscribeRecreate=ne.onRecreate?.(()=>R(w,N)),c(w))for(const le of Lc(w,te))n.onIdentityChange?.(le)}function L(w,N,te){j(w),aE(n.label,w,N,te);const ne=l.has(w)?`claimed-group:${w}`:void 0;return l.set(w,N),ne}function j(w){const N=n.bindGroupLayouts.get(w);if(!N)throw Yt(`${n.label}.layout`,`@group(${w}) does not exist in '${n.label}'.`);return N}function D(){return s.map(B)}function B(w){const N=l.get(w);if(N)return{group:w,bindGroup:N,offsets:[],claimValidation:Q(N,w)};const te=new Set(or(j(w))?.entries.map(ue=>ue.binding)),ne=n.reflection.bindings.filter(ue=>ue.group===w&&te.has(ue.binding)),le=Z(ne),Ge=F(ne),de=n.cache.getOrCreate(n.drawId,w,Ge,()=>n.device.gpu.createBindGroup({label:`${n.label}.group${w}`,layout:j(w),entries:le}));return{group:w,bindGroup:de,offsets:[]}}function Q(w,N){return Q0(w)?void 0:{label:n.label,group:N}}function Z(w){return w.map(N=>{const te=V(N);return{binding:N.binding,resource:te.resource}})}function F(w){return w.map(N=>V(N).identity)}function V(w){const N=i.get(w.name);if(!N?.resource||!N.identity)throw iS(n.label,w);return N}function K(w){if(l.has(w))throw aS(n.label,w)}function Y(w,N){w.buffer=n.device.createBuffer({size:N,usage:["uniform","copy_dst"],label:`${n.label}.${w.info.name}`}),w.resource={buffer:w.buffer.gpu,offset:0,size:N},w.identity=w.buffer.resourceIdentity,w.unsubscribe=w.buffer.onDestroy(()=>n.cache.evictIdentity(w.buffer.resourceIdentity))}function A(w){if(w.info.kind!=="buffer"||!w.info.layout?.size)throw Yt(`${n.label}.set`,`Binding '${w.info.name}' needs a compatible resource, not JS.`);return w.info.layout}return{get groups(){return s},set:o,claimGroup:L,layout:j,bindGroups:D,bindingState(w){const N=i.get(w);if(!(!N?.ownership||!N.resource||!N.identity))return{info:N.info,ownership:N.ownership,resource:N.resource,identity:N.identity}}}}function tE(n){return new Map(n.bindings.map(i=>[i.name,{info:i,memberOwnership:new Map}]))}function nE(n,i,s){let l;for(const o of i.values())if(o.info.layout?.members?.some(c=>c.name===n)){if(l)throw Yt(`${s}.set`,`Binding member '${n}' is ambiguous in '${s}'; set the complete binding.`);l=o}return l}function zg(n,i){return n.bindingLayout?.kind==="buffer"&&U2(i)?"lib":"user"}function _g(n,i,s){if(n.ownership&&n.ownership!==s)throw P0(i,n.ownership);n.ownership??=s}function iE(n,i,s){const l=n.memberOwnership.get(i);if(l&&l!==s)throw P0(i,l);n.memberOwnership.set(i,s)}function aE(n,i,s,l){const o=Q0(s);if(!o)return;const c=or(l);if(!c)return;const d=sE(c.entries,o.layout.entries);if(d)throw sS(n,i,d)}function sE(n,i){if(n.length!==i.length)return`expected ${n.length} bindings and received ${i.length}`;const s=Ug(n),l=Ug(i);for(const[o,c]of s){const d=l.get(o);if(!d)return`missing @binding(${o})`;if(Ng(c)!==Ng(d))return`@binding(${o}) does not match the reflected layout`}}function Ug(n){return new Map(n.map(i=>[i.binding,i]))}function Ng(n){return JSON.stringify({binding:n.binding,visibility:n.visibility,buffer:n.buffer,sampler:n.sampler,texture:n.texture,storageTexture:n.storageTexture,externalTexture:n.externalTexture?{}:void 0})}function Lc(n,i){const s=Yl(n.identity);return!s||i===s?[]:[{group:n.info.group,binding:n.info.binding,bindingName:n.info.name,bindingKind:n.info.kind,previousIdentity:i,newIdentity:s}]}function Yl(n){return n===void 0?void 0:nf(n)}function rE(n,i){return af(n)&&af(i)?{...n,...i}:i}function lE(n){return af(n)?n:{}}const oE="rgba8unorm",Df=Object.freeze([0,0,0,1]);function no(n,i){const s=n,l=Array.isArray(n)?n:[s?.r,s?.g,s?.b,s?.a];if(l.length!==4||!l.every(o=>typeof o=="number"&&Number.isFinite(o)))throw TS(i);return Cf(n)}function Cf(n){const i=n;return Array.isArray(n)?[n[0],n[1],n[2],n[3]]:{r:i.r,g:i.g,b:i.b,a:i.a}}function Xl(n){return n.colors??[{format:n.format??oE}]}function Oy(n){return n.depth===!0?"depth24plus":n.depth||void 0}function zy(n){const i=n.msaa;if(i===!0||i===4)return 4;if(i===void 0||i===!1)return 1;const s=Z0();throw s.code="VGPU-TARGET-MSAA-INVALID",s.message=`msaa received ${i}; WebGPU 1|4; use true`,s}function uE(n,i){if(!n?.size)throw Z0();const s=Oy(n);if(s==="stencil8")throw vS(s);if(zy(n)===4)for(const l of Xl(n))cE(l.format,i)}function cE(n,i){if(i.isCompatibilityMode&&n==="rgba16float")throw Yt("target","Dawn compatibility mode does not support rgba16float+msaa.","Use rgba8unorm for MSAA here, or disable msaa.")}function fE(n,i,s,l){const o={view:(i??n).createView(),resolveTarget:i?n.createView():void 0,loadOp:l?"load":"clear",storeOp:i?"discard":"store"};return l||(o.clearValue=_y(s)),o}function dE(n,i,s,l,o){if(o){const d={view:n.createView(),depthReadOnly:!0};return hr(n.format)&&(d.stencilReadOnly=!0),d}const c={view:n.createView(),depthLoadOp:i?"load":"clear",depthStoreOp:n.sampleCount>1?"discard":"store"};return i||(c.depthClearValue=s??1),n.format&&hr(n.format)&&(c.stencilLoadOp=i?"load":"clear",c.stencilStoreOp=n.sampleCount>1?"discard":"store",i||(c.stencilClearValue=l??0)),c}function hr(n){return!!n&&n.includes("stencil")}function _y(n){return Array.isArray(n)?{r:n[0],g:n[1],b:n[2],a:n[3]}:n}function Uy(n,i){return n[0]===i[0]&&n[1]===i[1]}function uo(n){return typeof n=="object"&&n!==null&&typeof n.renderPassDescriptor=="function"}let hE=1,pE=1;const mE=new WeakMap,gE=new WeakMap;function yE(n){return uo(n)?{colors:n.colors.map(i=>i.format),depth:n.depth?.format,sampleCount:n.sampleCount}:typeof n!="object"||n===null?{colors:[]}:{colors:Array.isArray(n.colors)?[...n.colors]:n.colors??[],depth:n.depth,sampleCount:n.sampleCount??1}}function Ny(n){return`${n.colors.join(",")}:${n.depth??"none"}:${n.sampleCount??1}`}function vE(n,i){if(!Array.isArray(n.colors)||n.colors.length===0)throw kl(i,"colors must be a non-empty array.");const s=n.colors.find(o=>typeof o!="string"||o.length===0);if(s!==void 0)throw kl(i,`colors must contain only GPUTextureFormat strings; received ${String(s)}.`);if(n.depth!==void 0&&(typeof n.depth!="string"||n.depth.length===0))throw kl(i,"depth must be a GPUTextureFormat string.");const l=n.sampleCount??1;if(l!==1&&l!==4)throw kl(i,`sampleCount must be 1 or 4; received ${String(l)}.`)}function bE(n){const i=`${Bg(mE,n.module,()=>hE++)}|${Bg(gE,n.pipelineLayout,()=>pE++)}|${AE(n.vertexBufferLayouts??[])}|${Ny(n.signature)}`,s=n.topology||n.stripIndexFormat?`${i}|${n.topology??"triangle-list"}|${n.stripIndexFormat??"none"}`:i,l=n.cullMode||n.frontFace?`${s}|${n.cullMode??"none"}|${n.frontFace??"ccw"}`:s,o=n.unclippedDepth?`${l}|unclipped`:l,c=n.depthKey?`${o}|${n.depthKey}`:o,d=n.stencilKey?`${c}|${n.stencilKey}`:c,h=n.multisampleKey?`${d}|${n.multisampleKey}`:d,m=n.constantsKey?`${h}|${n.constantsKey}`:h,y=n.entryKey?`${m}|${n.entryKey}`:m;return n.fragmentKey?`${y}|${n.fragmentKey}`:y}function kg(n,i,s,l,o){if(l===void 0)return i.find(d=>d.stage===s);if(typeof l!="string")throw Hl(n,`${s} received ${sf(l)}; expected an entry point name string.`,o);const c=i.find(d=>d.name===l);if(!c)throw Hl(n,`"${l}" matches no entry point in the shader; available entry points: ${Lg(i)}.`,o);if(c.stage!==s)throw Hl(n,`"${l}" is a @${c.stage} entry point, not @${s}; available entry points: ${Lg(i)}.`,o);return c}function Lg(n){return n.length?n.map(i=>`"${i.name}" (@${i.stage})`).join(", "):"none"}function xE(n,i,s,l){if(i!==void 0&&(typeof i!="object"||i===null||Array.isArray(i)))throw Nl(n,`received ${sf(i)}; expected { overrideNameOrId: number | boolean }.`,l);const o=new Map(s.map(d=>[jg(d),d])),c={};for(const[d,h]of Object.entries(i??{})){if(!o.has(d))throw Nl(n,`"${d}" matches no override in the shader; available overrides: ${SE(s)}.`,l);if(typeof h=="boolean"){c[d]=h?1:0;continue}if(typeof h!="number"||!Number.isFinite(h))throw Nl(n,`"${d}" received ${sf(h)}; use a finite number or a boolean (WebGPU converts the value to the override's WGSL type, and NaN/Infinity fail that conversion).`,l);c[d]=h}for(const d of s){const h=jg(d);if(d.defaultValue===void 0&&!(h in c))throw Nl(n,`override '${d.name}' has no default value and must be provided; add constants: { "${h}": value }.`,l)}return Object.keys(c).length===0?{}:{constants:c,constantsKey:wE(c)}}function jg(n){return n.id!==void 0?String(n.id):n.name}function SE(n){return n.length?n.map(i=>i.id!==void 0?`"${i.id}" (@id of ${i.name})`:`"${i.name}"`).join(", "):"none"}function wE(n){return`cn~${Object.entries(n).sort(([i],[s])=>i<s?-1:i>s?1:0).map(([i,s])=>`${i}=${s}`).join("~")}`}function sf(n){if(typeof n=="string")return`"${n}"`;try{return JSON.stringify(n)??String(n)}catch{return String(n)}}function ky(n){const i=new Map;return{get(s,l){let o=i.get(s);return o||(o=n.gpu.createShaderModule({label:l,code:s}),i.set(s,o)),o},dispose(){i.clear()}}}function Ly(n){const i=new Map;return{get(s){const l=ME(s);let o=i.get(l);return o||(o=n.gpu.createPipelineLayout({bindGroupLayouts:RE(s)}),i.set(l,o)),o},dispose(){i.clear()}}}function jy(n,i={}){return new EE(n,i)}class EE{device;#e=new Map;#t=new Set;#n;#i;#a=!1;constructor(i,s){this.device=i,this.#n=s.errorSink??(()=>{}),this.#i=s.registerSettledSource?.(()=>[...this.#t])}getReady(i){return this.#e.get(i)?.pipeline}getSync(i,s,l){this.#o(l.where);const o=this.#e.get(i);if(o?.pipeline)return o.pipeline;const c=o??{};o||this.#e.set(i,c);const d=this.#s(i,c,s,l);if(!d){c.pending||this.#e.delete(i);return}return c.pipeline=d,c.pending?.resolve(d),c.pending=void 0,d}getAsync(i,s,l){this.#o(l.where);const o=this.#e.get(i);if(o?.pipeline)return Promise.resolve(o.pipeline);if(o?.pending)return o.pending.promise;const c={},d=TE();c.pending=d,this.#e.set(i,c);let h;try{h=s()}catch(m){const y=ar(l.where,m,l.signature);return d.reject(y),this.#e.delete(i),d.promise}return this.#u(h),h.then(m=>{this.#e.get(i)!==c||c.pipeline||c.pending!==d||(c.pipeline=m,c.pending=void 0,d.resolve(m))},m=>{this.#e.get(i)!==c||c.pipeline||c.pending!==d||(c.pending=void 0,this.#e.delete(i),d.reject(ar(l.where,m,l.signature)))}),d.promise}dispose(){if(this.#a)return;this.#a=!0;const i=vg("gpu.dispose");for(const s of this.#e.values())s.pending?.reject(i);this.#e.clear(),this.#t.clear(),this.#i?.()}#s(i,s,l,o){const c=this.device.gpu,d=typeof c.pushErrorScope=="function"&&typeof c.popErrorScope=="function";d&&c.pushErrorScope("validation");try{const h=l();return d&&this.#l(i,s,o),h}catch(h){d&&this.#c();const m=ar(o.where,h,o.signature);this.#n(m);return}}#l(i,s,l){const o=this.device.gpu.popErrorScope().then(c=>{if(!c)return;const d=ar(l.where,c,l.signature);return this.#e.get(i)===s&&this.#e.delete(i),this.#n(d)},c=>{const d=ar(l.where,c,l.signature);return this.#e.get(i)===s&&this.#e.delete(i),this.#n(d)});this.#u(o)}#c(){const i=this.device.gpu.popErrorScope?.();i&&i.catch(()=>{})}#o(i){if(this.#a)throw vg(i)}#u(i){this.#t.add(i),i.catch(()=>{}).then(()=>this.#t.delete(i),()=>this.#t.delete(i))}}function TE(){let n,i;const s=new Promise((l,o)=>{n=l,i=o});return s.catch(()=>{}),{promise:s,resolve:n,reject:i}}function Bg(n,i,s){let l=n.get(i);return l||(l=s(),n.set(i,l)),l}function AE(n){return JSON.stringify(n.map(i=>({arrayStride:i.arrayStride,stepMode:i.stepMode??"vertex",attributes:[...i.attributes].map(s=>({shaderLocation:s.shaderLocation,offset:s.offset,format:s.format}))})))}function ME(n){return JSON.stringify([...n.entries()].map(([i,s])=>({group:i,entries:CE(s)})))}function RE(n){const i=Math.max(-1,...n.keys()),s=[];for(let l=0;l<=i;l++)s.push(DE(n,l));return s}function DE(n,i){const s=n.get(i);if(!s)throw yS(i);return s}function CE(n){return(or(n)?.entries??[]).map(i=>({binding:i.binding,visibility:i.visibility,buffer:i.buffer?{...i.buffer}:void 0,sampler:i.sampler?{...i.sampler}:void 0,texture:i.texture?{...i.texture}:void 0,storageTexture:i.storageTexture?{...i.storageTexture}:void 0,externalTexture:i.externalTexture?{...i.externalTexture}:void 0}))}const OE=lo("frame-state");function By(n){return n.service(OE,zE)}function zE(){const n=new Set;let i=Gg(),s=!1,l=!1;const o={time:0,deltaTime:0,frameCount:0,advanceBy(c){o.deltaTime=c,o.time+=c,l=!0},tick(){if(s)throw J0();s=!0;try{const c=Gg();l?l=!1:(o.deltaTime=Math.max(0,(c-i)/1e3),o.time+=o.deltaTime),i=c,o.frameCount+=1;for(const d of[...n])d()}finally{s=!1}},onAdvance(c){return n.add(c),()=>{n.delete(c)}}};return o}function Gg(){return globalThis.performance?.now?.()??Date.now()}function _E(n,i,s={}){const l=Wn(n,"surface"),o=NE(l),c=o.get(i);if(c&&!c.disposed)throw xS(c.label);const d=new $y(l.device,i,s,y=>{o.get(y.canvas)===y&&o.delete(y.canvas),h(),m()}),h=By(l).onAdvance(()=>d.applyAutoResize()),m=l.own("resource",()=>d.dispose());return o.set(i,d),d}const UE=lo("surfaces");function NE(n){return n.service(UE,()=>new Map)}let lr=0,Of=0;function kE(){return lr>0}function LE(){return Of>0}function jE(){Of+=1}function BE(){Of-=1}function Gy(n){return n instanceof $y}class $y{device;canvas;options;unregister;resourceIdentity=so("render-target");label;context;autoResize;layoutBacked;format;#e=new ro;#t=new Set;#n=new Set;#i;#a;#s=!1;#l=!1;constructor(i,s,l,o){this.device=i,this.canvas=s,this.options=l,this.unregister=o,this.label=l.label,this.#a=l.clearColor===void 0?Df:no(l.clearColor,"surface.clearColor");const c=s.getContext("webgpu");if(!c)throw bS();if(this.context=c,this.layoutBacked=GE(s),l.autoResize===!0&&!this.layoutBacked)throw wS();this.autoResize=l.autoResize??(l.size?!1:this.layoutBacked),this.#i=Ig(l.dpr),this.format=l.format??IE();const d=$E(s,l,this.layoutBacked,this.#i);(l.size||this.layoutBacked)&&$g(s,d),c.configure({device:i.gpu,format:this.format,alphaMode:l.alphaMode??"premultiplied",colorSpace:l.colorSpace??"srgb",usage:VE()})}get gpu(){return this.context}get size(){return this.#r(),Kl(this.canvas)}get texelSize(){const i=this.size;return[1/i[0],1/i[1]]}get color(){return this.#r(),new rs(this.device,this.context.getCurrentTexture(),{size:this.size,format:this.format,usage:["render_attachment","texture_binding","copy_src"],label:this.options.label?`${this.options.label}.color`:"surface.color"},"external")}get colors(){return[this.color]}get depth(){this.#r()}get sampleCount(){return this.#r(),1}get dpr(){return this.#i}get clearColor(){return Cf(this.#a)}set clearColor(i){this.#a=no(i,"surface.clearColor")}get disposed(){return this.#s}resize(i){if(this.#r(),this.#l)throw ES(this.options.label);this.#c(io(i),this.#i,!0)}applyAutoResize(){if(this.#s||!this.autoResize||!this.layoutBacked)return;const i=Ig(this.options.dpr),s=Iy(this.canvas,i);this.#c(s,i,!0)}onResize(i){this.#r(),this.#t.add(i),this.#l=!0,lr+=1;try{i(this.#f())}finally{lr-=1,this.#l=!1}return()=>{this.#t.delete(i)}}async read(){return this.#r(),this.color.read()}async readFloats(){return this.#r(),this.color.readFloats()}onDestroy(i){return this.#r(),this.#e.onDestroy(this,i)}onTexturesRecreated(i){return this.#r(),this.#n.add(i),()=>{this.#n.delete(i)}}renderPassDescriptor(i={}){const{clear:s=[0,0,0,1],preserve:l}=i;this.#r();const o={view:this.context.getCurrentTexture().createView(),loadOp:l?"load":"clear",storeOp:"store"};return l||(o.clearValue=_y(s)),{colorAttachments:[o]}}dispose(){if(!this.#s){this.#s=!0;try{this.context.unconfigure?.()}catch{}this.unregister(this),this.#t.clear(),this.#n.clear(),this.#e.emit(this)}}#c(i,s,l){const o=!Uy(Kl(this.canvas),i);this.#i=s,o&&($g(this.canvas,i),this.#o(),l&&this.#u())}#o(){for(const i of[...this.#n])i()}#u(){this.#l=!0,lr+=1;try{const i=this.#f();for(const s of[...this.#t])s(i)}finally{lr-=1,this.#l=!1}}#f(){const i=Kl(this.canvas);return{width:i[0],height:i[1],dpr:this.#i,surface:this}}#r(){if(this.#s)throw SS(this.options.label)}}function GE(n){return typeof n.clientWidth=="number"}function $E(n,i,s,l){return i.size?io(i.size):s?Iy(n,l):io(Kl(n))}function Iy(n,i){const s=n;return io([Math.round(s.clientWidth*i),Math.round(s.clientHeight*i)])}function Kl(n){const i=n;return[i.width,i.height]}function $g(n,i){const s=n;s.width=i[0],s.height=i[1]}function io(n){return[Math.max(1,Math.floor(n[0])),Math.max(1,Math.floor(n[1]))]}function Ig(n){const i=globalThis.devicePixelRatio??1;return Array.isArray(n)?Math.min(n[1],Math.max(n[0],i)):typeof n=="number"?n:i}function IE(){return globalThis.navigator?.gpu?.getPreferredCanvasFormat?.()??"bgra8unorm"}function VE(){const n=globalThis.GPUTextureUsage;return n?n.RENDER_ATTACHMENT|n.TEXTURE_BINDING|n.COPY_SRC:void 0}const FE={drawIndirect:{bytes:16,args:"4 u32 values: vertexCount, instanceCount, firstVertex, firstInstance"},drawIndexedIndirect:{bytes:20,args:"5 32-bit values: indexCount, instanceCount, firstIndex, baseVertex (signed), firstInstance"},dispatchWorkgroupsIndirect:{bytes:12,args:"3 u32 values: workgroupCountX, workgroupCountY, workgroupCountZ"}};function HE(n,i,s,l){const o=typeof s=="object"&&s!==null?s.buffer:void 0,c=Vg(s)?s:Vg(o)?o:void 0;if(!c)throw Pa(n,`received ${Fg(s)}; expected a StorageBuffer or { buffer, offset? }.`,i);const d=c===s?0:s.offset??0;if(typeof d!="number"||!Number.isInteger(d)||d<0)throw Pa(n,`offset must be an integer >= 0; received ${Fg(d)}.`,i);if(d%4!==0)throw Pa(n,`offset must be a multiple of 4 (WebGPU requires "indirectOffset is a multiple of 4"); received ${d}.`,i);if(!c.buffer.options.usage.includes("indirect"))throw Pa(n,`the buffer lacks the "indirect" usage (WebGPU requires "indirectBuffer.usage contains INDIRECT"); create it with storage(gpu, ${c.size}, { indirect: true }).`,i);const{bytes:h,args:m}=FE[l];if(d+h>c.size)throw Pa(n,`${l} reads ${h} bytes (${m}) at offset ${d}, but offset + ${h} = ${d+h} exceeds the buffer size ${c.size}.`,i);return{buffer:c.gpu,offset:d}}function Vg(n){return typeof n=="object"&&n!==null&&"gpu"in n&&"size"in n&&n.buffer instanceof Di}function Fg(n){if(typeof n=="string")return`"${n}"`;try{return JSON.stringify(n)??String(n)}catch{return String(n)}}const ao=Symbol("vgpu.frame.drawable");function qE(n){return n?.[ao]}const YE=Symbol("vgpu.frame.bundle");function XE(n){return n?.[YE]}const zf=Symbol("vgpu.frame.passAttachment");function KE(n){return typeof n?.[zf]=="function"?n:void 0}function QE(n,i){return _f(Wn(n,"sampler")).sampler(i)}let Hg=1;function PE(n){const i=new Map,s=new WeakMap;return{sampler(l={}){const o=rf(l);let c=i.get(o);return c||(c=n.gpu.createSampler(l),i.set(o,c),s.set(c,{kind:"sampler",id:Hg++})),c},identity(l){let o=s.get(l);return o||(o={kind:"sampler",id:Hg++},s.set(l,o)),o}}}function rf(n){if(n===null||typeof n!="object")return JSON.stringify(n);if(Array.isArray(n))return`[${n.map(rf).join(",")}]`;const i=n;return`{${Object.keys(i).sort().map(s=>`${JSON.stringify(s)}:${rf(i[s])}`).join(",")}}`}const ZE=lo("render-service");function _f(n){return n.service(ZE,WE)}function WE(n){const i=n.device,s=vy(),l=jy(i,{errorSink:h=>n.reportError(h),registerSettledSource:h=>n.registerSettledSource(h)}),o=ky(i),c=Ly(i),d=PE(i);return n.own("service",()=>{l.dispose(),o.dispose(),c.dispose(),s.dispose()}),{binds:s,pipelines:l,shaderModules:o,pipelineLayouts:c,sampler:h=>d.sampler(h)}}function Vy(n){if(typeof n=="string")return n;if(!JE(n)||!("version"in n)||n.version!==1)throw Ll(n);const s=n.wgsl;if(typeof s!="string")throw Ll(n);return s}function JE(n){return typeof n=="object"&&n!==null}function Bl(n,i){const s=Wn(n,"draw"),l=_f(s),o=Vy(i.shader);return new Hy(s.device,o,{...i,shader:o},l.binds,void 0,l.pipelines,l.shaderModules,l.pipelineLayouts,c=>s.reportError(c),c=>{s.trackDelivery(c)})}let eT=1;const Fy=new WeakMap;class Hy{source;label;#e=new Map;constructor(i,s,l,o=vy(),c,d=jy(i),h=ky(i),m=Ly(i),y,S){this.source=s,pt(i,"Draw.constructor"),this.label=l.label??"draw";const b=eT++,R=yy(s,`${this.label}.wgsl`),L=uT(this.label,l.entry),j=kg(this.label,R.entryPoints,"vertex",L.vertex,"draw"),D=kg(this.label,R.entryPoints,"fragment",L.fragment,"draw"),B=cT(R,j,D),Q=[j,D].filter(ae=>!!ae),Z=Q2(R.bindings,Q);tT(i,this.label,R.bindings,Q,Z);const F=l.geometry,V=j?Jl(j,"inputs",this.label):[],K=F&&Jc in F?F[Jc](V,`${this.label}.geometry`):F?.vertexBufferLayouts,Y=new Map(P2(i,this.label,R,Z)),A=m.get(Y),w=h.get(s,`${this.label}.shader`),N=RT(),te=aT(this.label,l),ne=rT(this.label,l,te),le=fT(i,this.label,l),Ge=mT(i,this.label,l),de=bT(this.label,l),ue=ST(this.label,l),z=xE(this.label,l.constants,R.overrides,"draw"),X=eE({device:i,label:this.label,drawId:b,reflection:R,bindGroupLayouts:Y,cache:o,onIdentityChange:ae=>N.markStale({kind:"binding-identity",drawLabel:this.label,...ae})});Fy.set(this,{id:b,device:i,opts:l,vertexBufferLayouts:K,cache:o,defaultTarget:c,reflection:R,visibility:Z,vertexEntry:j?.name??"vs_main",fragmentEntry:D?.name??"fs_main",entryKey:B,setCore:X,bindGroupLayouts:Y,pipelineLayout:A,shaderModule:w,pipelineStore:d,pipelineLayouts:m,errorSink:y,trackSettled:S,resolvedPipelineKeys:new Set,recordedIn:N,...te,...ne,...le,...Ge,...de,...ue,...z}),l.set&&this.set(l.set);for(const ae of l.targets??[])this.compileSync(ae)}get gpu(){const i=we(this);for(const s of i.resolvedPipelineKeys){const l=i.pipelineStore.getReady(s);if(l)return l}}get targets(){return we(this).opts.targets}get[ao](){return this}writesDepth(){return TT(this)}stencilWritingOps(){return AT(this)}set(i){const s=we(this);pt(s.device,`${this.label}.set`);for(const l of s.setCore.set(i))s.recordedIn.markStale({kind:"binding-identity",drawLabel:this.label,...l});return this}group(i,s){const l=we(this);pt(l.device,`${this.label}.group`);const o=this.#e.get(i)??this.layout(i),c=l.setCore.claimGroup(i,s,o);return l.recordedIn.markStale({kind:"group-claim",drawLabel:this.label,group:i,previousIdentity:c,newIdentity:`claimed-group:${i}`}),this}layout(i,s={}){return pt(we(this).device,`${this.label}.layout`),s.dynamicOffsets?this.#t(i):we(this).setCore.layout(i)}#t(i){const s=we(this);s.setCore.layout(i);const l=this.#e.get(i);if(l)return l;const o=CT(this,i),c=Cy(s.device,`${this.label}.group${i}.dynamic.bgl`,o);return this.#e.set(i,c),s.bindGroupLayouts.set(i,c),s.pipelineLayout=s.pipelineLayouts.get(s.bindGroupLayouts),c}draw(i={}){pt(we(this).device,`${this.label}.draw`);const s=uo(i)?{target:i}:i,l=we(this),o=s.target??l.defaultTarget;if(!o)throw Wc(`${this.label}.draw`);a0(o,`${this.label}.draw`);const c=l.device.gpu.createCommandEncoder(),d=c.beginRenderPass(o.renderPassDescriptor()),h=[];try{this.encode(d,o,s,b=>h.push(b))}catch(b){qt(h),xy(l.device);try{d.end()}catch{}throw b}wy(l.device,d,h,h[0]?.context);let m;const y=h[0]?.context;y&&ur(l.device,y);try{m=c.finish()}catch(b){const R=y?un(l.device):void 0;qt(h),R&&qt([R]);const L=R?.context??y;if(L){i0(l,L.label,L.group,b);return}throw b}if(y){const b=un(l.device);b&&(h[0]=h[0]?to(b,h[0]):b)}const S=h[0]?.context;S&&ur(l.device,S);try{l.device.gpu.queue.submit([m])}catch(b){const R=S?un(l.device):void 0;qt(h),R&&qt([R]);const L=R?.context??S;if(L){i0(l,L.label,L.group,b);return}throw b}if(S){const b=un(l.device);b&&(h[0]=h[0]?to(b,h[0]):b)}if(h.length){const b=Sy(l.device,h,{errorSink:l.errorSink});l.trackSettled?.(b)}}encode(i,s,l={},o){pt(we(this).device,`${this.label}.encode`);const c=this.pipelineFor(s,!0);if(!c)return;i.setPipeline(c);const d=we(this);d.blendConstant&&i.setBlendConstant(d.blendConstant),d.stencilRef!==void 0&&i.setStencilReference(d.stencilRef);for(const h of d.setCore.bindGroups())this.#n(i,h,l,o);this.#l(i,l)}#n(i,s,l,o){const c=DT(l.offsets,s.group,s.offsets);if(!s.claimValidation||!o){i.setBindGroup(s.group,s.bindGroup,c);return}ur(we(this).device,s.claimValidation);try{i.setBindGroup(s.group,s.bindGroup,c)}catch(h){throw D2(we(this).device),ss(s.claimValidation.label,s.claimValidation.group,h)}const d=un(we(this).device);d&&o(d)}compile(i){pt(we(this).device,`${this.label}.compile`);const{key:s,signature:l,signatureKey:o}=this.#i(i,`${this.label}.compile`);return we(this).pipelineStore.getAsync(s,()=>this.#u(l),{where:`${this.label}.compile`,signature:o}).then(()=>(pt(we(this).device,`${this.label}.compile`),we(this).resolvedPipelineKeys.add(s),this))}compileSync(i){pt(we(this).device,`${this.label}.compileSync`);const{key:s,signature:l,signatureKey:o}=this.#i(i,`${this.label}.compileSync`);return we(this).pipelineStore.getSync(s,()=>this.#o(l),{where:`${this.label}.compileSync`,signature:o})&&we(this).resolvedPipelineKeys.add(s),this}pipelineFor(i,s=!1){pt(we(this).device,`${this.label}.pipelineFor`);const{key:l,signature:o,signatureKey:c}=this.#i(i,`${this.label}.pipelineFor`,s),d=we(this).pipelineStore.getSync(l,()=>this.#o(o),{where:`${this.label}.pipelineFor`,signature:c});return d&&we(this).resolvedPipelineKeys.add(l),d}pipelineForAsync(i){pt(we(this).device,`${this.label}.pipelineForAsync`);const{key:s,signature:l,signatureKey:o}=this.#i(i,`${this.label}.pipelineForAsync`);return we(this).pipelineStore.getAsync(s,()=>this.#u(l),{where:`${this.label}.pipelineForAsync`,signature:o}).then(d=>(pt(we(this).device,`${this.label}.pipelineForAsync`),we(this).resolvedPipelineKeys.add(s),d))}#i(i,s,l=!1){const o=this.#a(i,s,l),c=Ny(o);return{signature:o,signatureKey:c,key:this.#s(o)}}#a(i,s,l=!1){const o=we(this),c=i??o.defaultTarget;if(!c)throw Wc(s);l||a0(c,s);const d=yE(c);if(vE(d,s),o.colorStates&&o.colorStates.length!==d.colors.length)throw Zc(this.label,`expected one entry per color attachment; colors has ${o.colorStates.length}, but the target signature has ${d.colors.length}.`,s);if(o.multisampleState?.alphaToCoverageEnabled&&(d.sampleCount??1)<=1)throw Fl(this.label,`alphaToCoverage requires a multisampled target, but the target signature has sampleCount ${d.sampleCount??1}; create the target with msaa: true.`,s);if((o.stencilState||o.stencilRef!==void 0)&&!hr(d.depth))throw is(this.label,`stencil requires a depth format with a stencil aspect, but the target signature has ${d.depth?`"${d.depth}"`:"no depth"}; create the target with depth: "depth24plus-stencil8".`,s);return d}#s(i){const s=we(this),l=s.opts.geometry;return bE({module:s.shaderModule,pipelineLayout:s.pipelineLayout,vertexBufferLayouts:s.vertexBufferLayouts,signature:i,fragmentKey:s.fragmentKey,topology:l?.topology,stripIndexFormat:qy(l),cullMode:s.cullMode,frontFace:s.frontFace,unclippedDepth:s.unclippedDepth,depthKey:s.depthKey,stencilKey:s.stencilKey,multisampleKey:s.multisampleKey,constantsKey:s.constantsKey,entryKey:s.entryKey})}#l(i,s={}){const l=we(this).opts.geometry;if(l?.vertexBuffers&&l.vertexBuffers.forEach((c,d)=>i.setVertexBuffer(d,c)),s.indirect!==void 0)return this.#c(i,l,s);const o=iT(this.label,l,we(this).opts,s);if(!l?.indexBuffer)return i.draw(o.vertexCount,o.instanceCount,o.firstVertex,o.firstInstance);i.setIndexBuffer(l.indexBuffer,l.indexFormat??"uint32"),i.drawIndexed(o.indexCount,o.instanceCount,o.firstIndex,o.baseVertex,o.firstInstance)}#c(i,s,l){const o=`${this.label}.draw`,c=nT.find(y=>l[y]!==void 0);if(c!==void 0)throw Pa(this.label,`indirect cannot be combined with ${c} in the same call; the GPU reads the draw arguments from the buffer, so the CPU-side value would be ignored.`,o);const d=!!s?.indexBuffer,{buffer:h,offset:m}=HE(this.label,o,l.indirect,d?"drawIndexedIndirect":"drawIndirect");if(!d)return i.drawIndirect(h,m);i.setIndexBuffer(s.indexBuffer,s.indexFormat??"uint32"),i.drawIndexedIndirect(h,m)}#o(i){const s=we(this);return s.device.gpu.createRenderPipeline({label:`${this.label}.pipeline`,layout:s.pipelineLayout,vertex:{module:s.shaderModule,entryPoint:s.vertexEntry,buffers:[...s.vertexBufferLayouts??[]],...s.constants?{constants:s.constants}:{}},fragment:{module:s.shaderModule,entryPoint:s.fragmentEntry,targets:qg(i,s),...s.constants?{constants:s.constants}:{}},primitive:Yg(s.opts.geometry,s.cullMode,s.frontFace,s.unclippedDepth),depthStencil:Wg(i,s),multisample:t0(i,s)})}#u(i){const s=we(this);return s.device.gpu.createRenderPipelineAsync({label:`${this.label}.pipeline`,layout:s.pipelineLayout,vertex:{module:s.shaderModule,entryPoint:s.vertexEntry,buffers:[...s.vertexBufferLayouts??[]],...s.constants?{constants:s.constants}:{}},fragment:{module:s.shaderModule,entryPoint:s.fragmentEntry,targets:qg(i,s),...s.constants?{constants:s.constants}:{}},primitive:Yg(s.opts.geometry,s.cullMode,s.frontFace,s.unclippedDepth),depthStencil:Wg(i,s),multisample:t0(i,s)})}}function tT(n,i,s,l,o){const c=n.limits;for(const[d,h,m]of[["vertex",1,"maxStorageBuffersInVertexStage"],["fragment",2,"maxStorageBuffersInFragmentStage"]]){const y=l.find(R=>R.stage===d);if(!y)continue;const S=s.filter(R=>R.bindingLayout?.kind==="buffer"&&R.bindingLayout.buffer.type!=="uniform"&&o(R)&h),b=c[m]??c.maxStorageBuffersPerShaderStage;if(b!==void 0&&S.length>b)throw tS(i,d,y.name,S.length,b,S)}}const nT=["vertices","indices","instances","firstVertex","firstIndex","baseVertex","firstInstance"];function qg(n,i){return n.colors.map((s,l)=>{const o=i.colorStates?.[l],c=o?.blendState??i.blendState,d=o?.writeMask??i.writeMask,h={format:s};return c&&(h.blend=c),d!==void 0&&(h.writeMask=d),h})}function iT(n,i,s,l){Ti(n,"DrawOptions.instances",s.instances),Ti(n,"DrawOptions.vertices",s.vertices),Ti(n,"DrawOptions.firstInstance",s.firstInstance),Ti(n,"DrawCallOptions.instances",l.instances),Ei(n,"DrawCallOptions.vertices",l.vertices),Ei(n,"DrawCallOptions.indices",l.indices),Ei(n,"DrawCallOptions.firstVertex",l.firstVertex),Ei(n,"DrawCallOptions.firstIndex",l.firstIndex),Ei(n,"DrawCallOptions.baseVertex",l.baseVertex),Ti(n,"DrawCallOptions.firstInstance",l.firstInstance),Ti(n,"GeometryLike.vertexCount",i?.vertexCount),Ti(n,"GeometryLike.indexCount",i?.indexCount),Ti(n,"GeometryLike.instanceCount",i?.instanceCount),Ei(n,"GeometryLike.firstVertex",i?.firstVertex),Ei(n,"GeometryLike.firstIndex",i?.firstIndex),Ei(n,"GeometryLike.baseVertex",i?.baseVertex);const o=!!i?.indexBuffer,d=i?.geometry??(i&&Jc in i?i:void 0),h=l.firstVertex??i?.firstVertex??0,m=l.vertices??i?.vertexCount??s.vertices??3,y=l.firstIndex??i?.firstIndex??0,S=l.indices??i?.indexCount??0,b=l.baseVertex??i?.baseVertex??0;if(o)Xg(n,"index",y,S,d?.indexCount);else if(l.indices!==void 0||l.firstIndex!==void 0||l.baseVertex!==void 0)throw gf(`${n}.draw`,"Index range needs an indexed geometry.");return o||Xg(n,"vertex",h,m,d?.vertexCount),{instanceCount:l.instances??s.instances??i?.instanceCount??1,firstInstance:l.firstInstance??s.firstInstance??0,vertexCount:m,firstVertex:h,indexCount:S,firstIndex:y,baseVertex:b}}function qy(n){const i=n?.topology??"triangle-list";return n?.stripIndexFormat??(i.endsWith("strip")?n?.indexFormat:void 0)}function Yg(n,i,s,l){const o=n?.topology??"triangle-list",c=qy(n),d=c?{topology:o,stripIndexFormat:c}:{topology:o};return i!==void 0&&(d.cullMode=i),s!==void 0&&(d.frontFace=s),l&&(d.unclippedDepth=!0),d}function Xg(n,i,s,l,o){if(!(o===void 0||s+l<=o))throw gf(`${n}.draw`,`${i} range [${s}, ${s+l}) exceeds parent geometry ${i} count ${o}.`)}function Ei(n,i,s){if(!(s===void 0||Number.isInteger(s)&&s>=0))throw gf(`${n}.draw`,`${i} must be an integer >= 0; received ${String(s)}.`)}function Ti(n,i,s){if(s!==void 0&&!(Number.isInteger(s)&&s>=0))throw new se({code:"VGPU-R1-DRAW-COUNT",message:`${i} of '${n}' must be an integer >= 0; received ${String(s)}. Use 0 only when you want to issue a valid draw with no vertices/instances.`,where:`${n}.draw`})}function aT(n,i){const s=i.blend===void 0?void 0:Yy(n,i.blend),l=i.writeMask===void 0?void 0:Qy(n,i.writeMask),o=i.colors===void 0?void 0:sT(n,i.colors),c=o?`${n0(s,l)}@${o.map(ET).join("@")}`:s||l!==void 0?n0(s,l):void 0;return{blendState:s,writeMask:l,colorStates:o,fragmentKey:c}}function sT(n,i){if(!Array.isArray(i))throw Zc(n,`colors must be an array; received ${Pe(i)}.`);return i.map((s,l)=>{if(s==null)return null;if(typeof s!="object"||Array.isArray(s))throw Zc(n,`colors[${l}] must be null or { blend?, writeMask? }; received ${Pe(s)}.`);const o=s.blend===void 0?void 0:Yy(`${n}.colors[${l}]`,s.blend),c=s.writeMask===void 0?void 0:Qy(`${n}.colors[${l}]`,s.writeMask);return!o&&c===void 0?null:{blendState:o,writeMask:c}})}function Yy(n,i){if(i==="alpha")return Gl({src:"src-alpha",dst:"one-minus-src-alpha"},{src:"one",dst:"one-minus-src-alpha"});if(i==="premultiplied")return Gl({src:"one",dst:"one-minus-src-alpha"},{src:"one",dst:"one-minus-src-alpha"});if(i==="additive")return Gl({src:"one",dst:"one"},{src:"one",dst:"one"});if(typeof i!="object"||i===null||!Kg(i.color))throw dg(n,i);const s=i.color,l=i.alpha;if(l!==void 0&&!Kg(l))throw dg(n,i);return Gl(s,l??s)}function Kg(n){return typeof n=="object"&&n!==null&&typeof n.src=="string"&&typeof n.dst=="string"}function Gl(n,i){return{color:Qg(n),alpha:Qg(i)}}function Qg(n){return{srcFactor:n.src,dstFactor:n.dst,operation:n.op??"add"}}function rT(n,i,s){if(i.blendConstant===void 0)return{};const l=i.blendConstant;if(!Array.isArray(l)||l.length!==4||l.some(o=>typeof o!="number"||!Number.isFinite(o)))throw hg(n,`received ${Pe(l)}; expected [r, g, b, a] finite numbers.`);if(!lT(s).some(o=>o&&oT(o)))throw hg(n,`no color target's effective blend uses a "constant"/"one-minus-constant" factor (colors[i].blend replaces the top-level blend for that target), so blendConstant would have no effect.`);return{blendConstant:{r:l[0],g:l[1],b:l[2],a:l[3]}}}function lT(n){return n.colorStates?n.colorStates.map(i=>i?.blendState??n.blendState):[n.blendState]}function oT(n){return[n.color.srcFactor,n.color.dstFactor,n.alpha.srcFactor,n.alpha.dstFactor].some(i=>i==="constant"||i==="one-minus-constant")}function uT(n,i){if(i===void 0)return{};if(typeof i!="object"||i===null||Array.isArray(i))throw Hl(n,`received ${Pe(i)}; expected { vertex?, fragment? } entry point names.`);return i}function cT(n,i,s){const l=n.entryPoints.find(c=>c.stage==="vertex"),o=n.entryPoints.find(c=>c.stage==="fragment");if(!(i===l&&s===o))return`en~${i?.name??""}~${s?.name??""}`}function fT(n,i,s){const l=s.cull===void 0?void 0:hT(i,s.cull),o=s.frontFace===void 0?void 0:pT(i,s.frontFace),c=s.unclippedDepth===void 0?void 0:dT(n,i,s.unclippedDepth);return{cullMode:l,frontFace:o,unclippedDepth:c}}function dT(n,i,s){if(typeof s!="boolean")throw mg(i,`received ${Pe(s)}; expected a boolean.`);if(s){if(!n.features.has("depth-clip-control"))throw mg(i,'the device lacks the "depth-clip-control" feature; request it at init: init({ requiredFeatures: ["depth-clip-control"] }) on an adapter that supports it.');return!0}}function hT(n,i){if(i==="none"||i==="front"||i==="back")return i;throw rS(n,i)}function pT(n,i){if(i==="ccw"||i==="cw")return i;throw lS(n,i)}const Xy={depthWriteEnabled:!0,depthCompare:"less-equal"},Ky=["never","less","equal","less-equal","greater","not-equal","greater-equal","always"],Pg=-2147483648,Zg=2147483647;function Wg(n,i){if(n.depth)return{format:n.depth,...i.depthState??Xy,...i.stencilState??{}}}function mT(n,i,s){if(s.depth===void 0)return{};const l=gT(n,i,s.depth,s.geometry?.topology??"triangle-list");return{depthState:l,depthKey:yT(l)}}function gT(n,i,s,l){if(s===!1)return{depthWriteEnabled:!1,depthCompare:"always"};if(typeof s!="object"||s===null)throw Xn(i,`received ${Pe(s)}.`);if(s.write!==void 0&&typeof s.write!="boolean")throw Xn(i,`write must be a boolean; received ${Pe(s.write)}.`);if(s.compare!==void 0&&!Ky.includes(s.compare))throw Xn(i,`compare must be a GPUCompareFunction; received ${Pe(s.compare)}.`);if(s.bias!==void 0&&!Number.isInteger(s.bias))throw Xn(i,`bias must be an integer (WebGPU depthBias is i32); received ${Pe(s.bias)}.`);if(s.bias!==void 0&&(s.bias<Pg||s.bias>Zg))throw Xn(i,`bias must fit in the i32 range [${Pg}, ${Zg}] (WebGPU depthBias is i32); received ${Pe(s.bias)}.`);if(s.biasSlopeScale!==void 0&&!Number.isFinite(s.biasSlopeScale))throw Xn(i,`biasSlopeScale must be a finite number; received ${Pe(s.biasSlopeScale)}.`);if(s.biasClamp!==void 0&&!Number.isFinite(s.biasClamp))throw Xn(i,`biasClamp must be a finite number; received ${Pe(s.biasClamp)}.`);const o=s.bias??0,c=s.biasSlopeScale??0,d=s.biasClamp??0;if((o!==0||c!==0||d!==0)&&!l.startsWith("triangle"))throw Xn(i,`bias, biasSlopeScale, and biasClamp must be 0 for "${l}" topology.`);if(d!==0&&n.isCompatibilityMode)throw Xn(i,`biasClamp must be 0 on a compatibility-mode device; received ${Pe(s.biasClamp)}.`);return{depthWriteEnabled:s.write??!0,depthCompare:s.compare??"less-equal",...o!==0?{depthBias:o}:{},...c!==0?{depthBiasSlopeScale:c}:{},...d!==0?{depthBiasClamp:d}:{}}}function yT(n){return`${n.depthWriteEnabled?1:0}~${n.depthCompare}~${n.depthBias??0}~${n.depthBiasSlopeScale??0}~${n.depthBiasClamp??0}`}const vT=["keep","zero","replace","invert","increment-clamp","decrement-clamp","increment-wrap","decrement-wrap"];function bT(n,i){if(i.stencil===void 0)return{};const s=i.stencil;if(typeof s!="object"||s===null||Array.isArray(s))throw is(n,`received ${Pe(s)}; expected { front?, back?, readMask?, writeMask?, ref? }.`);const l=s.front===void 0?void 0:Jg(n,"front",s.front),o=s.back===void 0?void 0:Jg(n,"back",s.back);jc(n,"readMask",s.readMask),jc(n,"writeMask",s.writeMask),jc(n,"ref",s.ref);const c={...l?{stencilFront:l}:{},...o??l?{stencilBack:o??{...l}}:{},...s.readMask!==void 0?{stencilReadMask:s.readMask}:{},...s.writeMask!==void 0?{stencilWriteMask:s.writeMask}:{}},d=c.stencilFront!==void 0||c.stencilBack!==void 0||c.stencilReadMask!==void 0||c.stencilWriteMask!==void 0;return!d&&s.ref===void 0?{}:{...d?{stencilState:c,stencilKey:xT(c)}:{},...s.ref!==void 0?{stencilRef:s.ref}:{}}}function Jg(n,i,s){if(typeof s!="object"||s===null||Array.isArray(s))throw is(n,`${i} must be a { compare?, fail?, depthFail?, pass? } object; received ${Pe(s)}.`);if(s.compare!==void 0&&!Ky.includes(s.compare))throw is(n,`${i}.compare must be a GPUCompareFunction; received ${Pe(s.compare)}.`);for(const[l,o]of[["fail",s.fail],["depthFail",s.depthFail],["pass",s.pass]])if(o!==void 0&&!vT.includes(o))throw is(n,`${i}.${l} must be a GPUStencilOperation; received ${Pe(o)}.`);return{compare:s.compare??"always",failOp:s.fail??"keep",depthFailOp:s.depthFail??"keep",passOp:s.pass??"keep"}}function jc(n,i,s){if(s!==void 0&&(typeof s!="number"||!Number.isInteger(s)||s<0||s>4294967295))throw is(n,`${i} must be an integer in [0, 0xFFFFFFFF] (WebGPU GPUStencilValue is u32); received ${Pe(s)}.`)}function xT(n){return`st~${e0(n.stencilFront)}~${e0(n.stencilBack)}~${n.stencilReadMask??4294967295}~${n.stencilWriteMask??4294967295}`}function e0(n){return n?`${n.compare},${n.failOp},${n.depthFailOp},${n.passOp}`:"default"}function t0(n,i){return{count:n.sampleCount??1,...i.multisampleState??{}}}function ST(n,i){if(i.multisample===void 0)return{};const s=i.multisample;if(typeof s!="object"||s===null||Array.isArray(s))throw Fl(n,`received ${Pe(s)}; expected { alphaToCoverage?, mask? }.`);if(s.alphaToCoverage!==void 0&&typeof s.alphaToCoverage!="boolean")throw Fl(n,`alphaToCoverage must be a boolean; received ${Pe(s.alphaToCoverage)}.`);if(s.mask!==void 0&&(typeof s.mask!="number"||!Number.isInteger(s.mask)||s.mask<0||s.mask>4294967295))throw Fl(n,`mask must be an integer in [0, 0xFFFFFFFF] (WebGPU GPUSampleMask is u32); received ${Pe(s.mask)}.`);const l={...s.alphaToCoverage!==void 0?{alphaToCoverageEnabled:s.alphaToCoverage}:{},...s.mask!==void 0?{mask:s.mask}:{}};return l.alphaToCoverageEnabled===void 0&&l.mask===void 0?{}:{multisampleState:l,multisampleKey:wT(l)}}function wT(n){return`ms~${n.alphaToCoverageEnabled?1:0}~${n.mask??4294967295}`}function Qy(n,i){if(!Array.isArray(i))throw pg(n,Pe(i));let s=0;for(const l of i)if(l==="r")s|=1;else if(l==="g")s|=2;else if(l==="b")s|=4;else if(l==="a")s|=8;else throw pg(n,Pe(l));return s}function n0(n,i){return`${Py(n)};${i??15}`}function Py(n){if(!n)return"none;none";const i=n.color,s=n.alpha;return`${i.srcFactor},${i.dstFactor},${i.operation};${s.srcFactor},${s.dstFactor},${s.operation}`}function ET(n){return n?`${n.blendState?Py(n.blendState):"inherit"};${n.writeMask??"inherit"}`:"inherit"}function Pe(n){if(typeof n=="string")return`"${n}"`;try{return JSON.stringify(n)??String(n)}catch{return String(n)}}function TT(n){return(we(n).depthState??Xy).depthWriteEnabled}function AT(n){const i=we(n),s=i.stencilState;if(!s||s.stencilWriteMask===0)return[];const l=i.cullMode??"none",o=[],c=(d,h)=>{if(h)for(const[m,y]of[["fail",h.failOp],["depthFail",h.depthFailOp],["pass",h.passOp]])y!==void 0&&y!=="keep"&&o.push(`${d}.${m}: "${y}"`)};return l!=="front"&&c("front",s.stencilFront),l!=="back"&&c("back",s.stencilBack),o}function MT(n,i,s,l={},o){n.encode(i,s,l,o)}function we(n){const i=Fy.get(n);if(!i)throw new TypeError("Invalid Draw instance");return i}function i0(n,i,s,l){const o=(async()=>{await Sf(n.device),pt(n.device,`${i}.validation`);const c=ss(i,s,l);n.errorSink?await n.errorSink(c):console.error(c)})();return n.trackSettled?.(o),o}function RT(){const n=new Set;return{add(i){n.add(i)},delete(i){n.delete(i)},list(){return[...n]},markStale(i){for(const s of n)s.markStale(i)}}}function DT(n,i,s){return n?Array.isArray(n)?n:n[i]??s:s}function CT(n,i){const s=we(n);return Dy(s.reflection.bindings,i,s.visibility).map(OT)}function OT(n){return n.buffer?{...n,buffer:{...n.buffer,hasDynamicOffset:!0}}:n}function a0(n,i){if(Gy(n)&&!LE())throw W0(i)}function s0(n,i,s={}){if("geometry"in s)throw Yt("effect","effect() never accepts vertex buffers; use draw(gpu, { shader, geometry: geometry(gpu, descriptor) }).");const l=Wn(n,"effect"),o=_f(l);return new zT(l.device,Vy(i),s,o.binds,void 0,o.pipelines,o.shaderModules,o.pipelineLayouts,c=>l.reportError(c),c=>{l.trackDelivery(c)})}const Zy=new WeakMap;class zT{get gpu(){return Ji(this).gpu}constructor(i,s,l={},o,c,d,h,m,y,S){const b=_T(s),R=new Hy(i,b,{shader:b,set:l.set,label:l.label??"effect",blend:l.blend,writeMask:l.writeMask},o,c,d,h,m,y,S);Zy.set(this,R)}set(i){return Ji(this).set(i),this}draw(i={}){Ji(this).draw(uo(i)?{target:i}:i)}compile(i){return Ji(this).compile(i).then(()=>this)}compileSync(i){return Ji(this).compileSync(i),this}encode(i,s,l={},o){MT(Ji(this),i,s,l,o)}get[ao](){return Ji(this)[ao]}}function Ji(n){const i=Zy.get(n);if(!i)throw new TypeError("Invalid Effect instance");return i}function _T(n){return UT(n)?n:`
13
- struct VgpuFullscreenVertexOut {
14
- @builtin(position) position: vec4f,
15
- @location(0) uv: vec2f,
16
- };
17
- @vertex fn vgpu_fullscreen_vs(@builtin(vertex_index) vi: u32) -> VgpuFullscreenVertexOut {
18
- var pos = array<vec2f, 3>(vec2f(-1.0, -1.0), vec2f(3.0, -1.0), vec2f(-1.0, 3.0));
19
- var uv = array<vec2f, 3>(vec2f(0.0, 1.0), vec2f(2.0, 1.0), vec2f(0.0, -1.0));
20
- var out: VgpuFullscreenVertexOut;
21
- out.position = vec4f(pos[vi], 0.0, 1.0);
22
- out.uv = uv[vi];
23
- return out;
24
- }
25
- ${n}`}function UT(n){return yy(n,"effect.wgsl").entryPoints.some(i=>i.stage==="vertex")}function NT(n,i){return LT(Wn(n,"frame")).frame(i)}const kT=lo("frame-runner");function LT(n){return n.service(kT,i=>{const s=By(i);return new XT(()=>{let l=()=>{};const o=new jT(i.device,void 0,c=>i.reportError(c),c=>{i.trackDelivery(c)},()=>l());return l=i.own("scheduler",()=>o.cancel()),o},()=>s.tick(),l=>i.own("scheduler",()=>l.stop()))})}class jT{device;defaultTarget;errorSink;trackSettled;releaseLifecycle;done=Promise.resolve();#e;#t=[];#n=new Set;#i=new Set;#a=!1;#s=!1;#l=!1;constructor(i,s,l,o,c){this.device=i,this.defaultTarget=s,this.errorSink=l,this.trackSettled=o,this.releaseLifecycle=c,pt(i,"Frame.constructor"),this.#e=i.gpu.createCommandEncoder({label:"vgpu.frame"})}pass(i,s){if(this.#s)throw bg("Frame.pass");pt(this.device,"Frame.pass");const l=uo(i),o=typeof s=="function"?s:D=>D.draw(s),c=l?i:i.target??this.defaultTarget;if(!c)throw Wc("Frame.pass");if(Gy(c)&&this.#a)throw W0("Frame.pass");const d=l?void 0:i.clear,h=d===!1;if(h&&c.sampleCount===4)throw oS();const m=l?void 0:i.clearDepth;if(m!==void 0){if(typeof m!="number"||!(m>=0&&m<=1))throw gg(m);if(h)throw uS();if(!c.depth)throw gg(m,"but the target has no depth attachment, so clearDepth would have no effect.","Create the target with depth: true (or a depth format), or drop clearDepth.")}const y=l?void 0:i.clearStencil;if(y!==void 0){if(typeof y!="number"||!Number.isInteger(y)||y<0||y>4294967295)throw yg(`received ${String(y)}; expected an integer in [0, 0xFFFFFFFF] (WebGPU GPUStencilValue).`);if(h)throw cS();const D=c.depth?.format;if(!hr(D))throw yg(`received ${String(y)}, but the target's depth format ${D?`"${D}"`:"(none)"} has no stencil aspect, so clearStencil would have no effect.`)}const S=l?void 0:i.depthReadOnly;if(S!==void 0&&typeof S!="boolean")throw ia(`received ${Ci(S)}; expected a boolean.`,"Pass depthReadOnly: true to open the pass with a read-only depth attachment, or omit it.");if(S){if(!c.depth)throw ia("is set, but the target has no depth attachment, so there is nothing to make read-only.","Create the target with depth: true (or a depth format), or drop depthReadOnly.");if(c.sampleCount===4)throw fS();if(m!==void 0)throw ia("cannot be combined with clearDepth; a read-only depth aspect omits its load/store ops and is never cleared.","Remove clearDepth, or drop depthReadOnly.");if(y!==void 0)throw ia("cannot be combined with clearStencil; a read-only stencil aspect omits its load/store ops and is never cleared.","Remove clearStencil, or drop depthReadOnly.")}const b=l?void 0:HT(i.viewport,this.device.gpu.limits,c.size),R=l?void 0:qT(i.scissor,c.size),L=[];let j;try{const D=l||i.timer===void 0?void 0:this.#r(i.timer,c,L,VT),Q=(l||i.visibility===void 0?void 0:this.#r(i.visibility,c,L,FT))?.occlusion;let Z=c.renderPassDescriptor({clear:d===void 0||d===!0||d===!1?c.clearColor??Df:d,preserve:h,clearDepth:m,clearStencil:y,depthReadOnly:S});D?.timestampWrites&&(Z={...Z,timestampWrites:D.timestampWrites}),Q&&(Z={...Z,occlusionQuerySet:Q.querySet}),j=this.#e.beginRenderPass(Z),b&&j.setViewport(b.x,b.y,b.width,b.height,b.minDepth,b.maxDepth),R&&j.setScissorRect(R[0],R[1],R[2],R[3]),this.#l=!0;try{o(new BT(j,c,this.#t,S===!0,Q,this,F=>{if(pt(this.device,F),this.#s)throw bg(F)}))}finally{this.#l=!1}}catch(D){this.#u(L),qt(this.#t),this.#t.length=0,xy(this.device);try{j?.end()}catch{}throw D}wy(this.device,j,this.#t)}submit(){if(this.#a||this.#s)return;pt(this.device,"Frame.submit"),this.#a=!0,this.releaseLifecycle?.();for(const o of this.#f())o.finalizeFrame(this,this.#e);let i;const s=this.#t[0]?.context;s&&ur(this.device,s);try{i=this.#e.finish()}catch(o){this.#c(this.#o());const c=s?un(this.device):void 0;qt(this.#t),c&&qt([c]);const d=c?.context??s;if(!d)throw o;this.done=this.#h(this.#d(d.label,d.group,o));return}if(s){const o=un(this.device);o&&(this.#t[0]=this.#t[0]?to(o,this.#t[0]):o)}const l=this.#t[0]?.context;l&&ur(this.device,l);try{this.device.gpu.queue.submit([i])}catch(o){this.#c(this.#o());const c=l?un(this.device):void 0;qt(this.#t),c&&qt([c]);const d=c?.context??l;if(!d)throw o;this.done=this.#h(this.#d(d.label,d.group,o));return}if(l){const o=un(this.device);o&&(this.#t[0]=this.#t[0]?to(o,this.#t[0]):o)}for(const o of this.#f())o.frameSubmitted(this);this.#c(this.#i),this.done=this.#h(Sy(this.device,this.#t,{errorSink:this.errorSink}))}cancel(){if(!this.#s){if(this.#a)throw RS("Frame.cancel");if(this.#l)throw MS("Frame.cancel");this.#s=!0,this.releaseLifecycle?.(),this.#c(this.#o()),this.#n.clear(),this.#i.clear(),qt(this.#t),this.#t.length=0}}#c(i){for(const s of[...i])s.frameAbandoned(this)}#o(){return[...this.#n,...this.#i]}#u(i){for(const s of[...i])this.#n.delete(s),this.#i.add(s)}#f(){return[...this.#n].filter(i=>!this.#i.has(i))}#r(i,s,l,o){const c=KE(i);if(!c)throw o(i);let d;try{d=c[zf]({frame:this,device:this.device,target:s})}catch(h){throw this.#u(this.#n),h}return this.#n.add(d.owner),l.push(d.owner),d}async#d(i,s,l){await Sf(this.device),pt(this.device,"Frame.validation");const o=ss(i,s,l);this.errorSink?await this.errorSink(o):console.error(o)}#h(i){return this.trackSettled?.(i),i}}class BT{encoder;target;validations;depthReadOnly;occlusionSource;frame;assertFrameOpen;#e=!1;constructor(i,s,l,o=!1,c,d,h){this.encoder=i,this.target=s,this.validations=l,this.depthReadOnly=o,this.occlusionSource=c,this.frame=d,this.assertFrameOpen=h}draw(i,s={}){this.assertFrameOpen?.("FramePass.draw");const l=$T(i);this.depthReadOnly&&GT(l,this.target),l.encode(this.encoder,this.target,s,o=>this.validations.push(o))}occlusion(i,s){if(this.assertFrameOpen?.("FramePass.occlusion"),!this.occlusionSource)throw pS();if(this.#e)throw mS();const l=this.occlusionSource.beginQuery(i,this.frame);this.encoder.beginOcclusionQuery(l),this.#e=!0;try{typeof s=="function"?s():this.draw(s)}finally{this.#e=!1,this.encoder.endOcclusionQuery()}}bundles(...i){if(this.assertFrameOpen?.("FramePass.bundles"),this.depthReadOnly)throw ia("pass cannot replay bundles: bundle records bundles with writable depth/stencil, and WebGPU only executes read-only-recorded bundles in a read-only pass.","Encode the draws directly with pass.draw(...) inside the depthReadOnly pass.","FramePass.bundles");const s=i.map(l=>XE(l)??IT());for(const l of s)l.assertReplayable(this.target);this.encoder.executeBundles(s.map(l=>l.gpu))}}function GT(n,i){if(n.writesDepth())throw ia(`pass cannot encode draw '${n.label}': its depth state writes depth (the default is write: true). Give the draw depth: { write: false } (or depth: false to disable depth testing).`,"Use depth: { write: false } on the draw, or open the pass without depthReadOnly.","FramePass.draw");if(hr(i.depth?.format)){const s=n.stencilWritingOps();if(s.length)throw ia(`pass cannot encode draw '${n.label}': its stencil ops can write (${s.join(", ")}), and the pass's stencil aspect is read-only too.`,'Use "keep" for those ops or stencil writeMask: 0, or open the pass without depthReadOnly.',"FramePass.draw")}}function $T(n){const i=qE(n);if(!i)throw new TypeError("Invalid Effect instance: pass.draw() expects a Draw or an Effect created by this library.");return i}function IT(){throw new se({code:"VGPU-R3-BUNDLE-INVALID",message:"p.bundles() expected bundles created by bundle(gpu, { target }, cb).",where:"FramePass.bundles"})}function VT(n){return Za(`FramePassOptions.timer received ${Ci(n)}; expected a TimerSpan from timer.span(name).`,'Create const passTimer = timer(gpu) once, then pass passTimer.span("name") per pass.',"Frame.pass")}function FT(n){return hS(`FramePassOptions.visibility received ${Ci(n)}; expected a Visibility from visibility(gpu).`,"Create const vis = visibility(gpu) once, then pass { target, visibility: vis } per pass.","Frame.pass")}function HT(n,i,s){if(n===void 0)return;if(typeof n!="object"||n===null||Array.isArray(n))throw Kn(`received ${Ci(n)}; expected { x?, y?, width, height, minDepth?, maxDepth? }.`);const{x:l=0,y:o=0,width:c,height:d,minDepth:h=0,maxDepth:m=1}=n;for(const[R,L]of[["x",l],["y",o],["width",c],["height",d],["minDepth",h],["maxDepth",m]])if(typeof L!="number"||!Number.isFinite(L))throw Kn(`${R} received ${Ci(L)}; expected a finite number.`);const y=i.maxTextureDimension2D,S=y*2,b=`target is ${s[0]}x${s[1]}px, device maxTextureDimension2D is ${y}`;if(!(c>=0&&c<=y))throw Kn(`width ${c} is outside [0, ${y}] (${b}).`);if(!(d>=0&&d<=y))throw Kn(`height ${d} is outside [0, ${y}] (${b}).`);if(!(l>=-S&&l+c<=S-1))throw Kn(`x ${l} with width ${c} is outside [${-S}, ${S-1}] (${b}).`);if(!(o>=-S&&o+d<=S-1))throw Kn(`y ${o} with height ${d} is outside [${-S}, ${S-1}] (${b}).`);if(!(h>=0&&h<=1))throw Kn(`minDepth ${h} is outside [0, 1].`);if(!(m>=0&&m<=1))throw Kn(`maxDepth ${m} is outside [0, 1].`);if(!(h<=m))throw Kn(`minDepth ${h} exceeds maxDepth ${m}.`);return{x:l,y:o,width:c,height:d,minDepth:h,maxDepth:m}}function qT(n,i){if(n===void 0)return;if(!Array.isArray(n)||n.length!==4)throw Uc(`received ${Ci(n)}; expected [x, y, width, height].`);const[s,l,o,c]=n;for(const[m,y]of[["x",s],["y",l],["width",o],["height",c]])if(typeof y!="number"||!Number.isInteger(y)||y<0)throw Uc(`${m} received ${Ci(y)}; expected a non-negative integer.`);const[d,h]=i;if(s+o>d||l+c>h)throw Uc(`[${s}, ${l}, ${o}, ${c}] exceeds the target's current size ${d}x${h}px (x + width <= ${d}, y + height <= ${h}).`);return[s,l,o,c]}function Ci(n){return typeof n=="string"?`'${n}'`:Array.isArray(n)?`[${n.map(i=>Ci(i)).join(", ")}]`:typeof n=="object"&&n!==null?"an object":String(n)}function YT(n){const i=n?.code;return i==="VGPU-DEVICE-DISPOSED"||i==="VGPU-DEVICE-LOST"}class XT{createFrame;advance;trackLoop;#e=!1;constructor(i,s,l){this.createFrame=i,this.advance=s,this.trackLoop=l}frame(i){if(this.#e||kE())throw J0();this.#e=!0,jE();try{this.advance();const s=this.createFrame();if(i)try{i(s)}finally{try{s.submit()}catch(l){if(!YT(l))throw l}}return s}finally{BE(),this.#e=!1}}loop(i,s={}){let l=!1;const o=globalThis.requestAnimationFrame??(R=>setTimeout(()=>R(performance.now()),16)),c=globalThis.cancelAnimationFrame??(R=>clearTimeout(R)),d=s.fps&&s.fps>0?1e3/s.fps:0;let h,m=0;const y=R=>{l||(KT(R,h,d)&&(h=R,this.frame(i)),l||(m=o(y)))};m=o(y);let S;const b={stop(){l=!0,c(m),S?.(),S=void 0}};return S=this.trackLoop?.(b),b}}function KT(n,i,s){return i===void 0||s<=0?!0:n-i>=s}function r0(n,i){return new lf(Wn(n,"target").device,i)}class lf{device;options;resourceIdentity=so("render-target");#e=new ro;#t=new Set;#n;#i;#a;#s;#l;constructor(i,s){this.device=i,this.options=s,uE(s,i),this.#l=s.clearColor===void 0?Df:no(s.clearColor,"target.clearColor"),this.#n=s.size,this.#i=this.#f(),this.#a=this.sampleCount===4?this.#r():void 0,this.#s=this.#d()}get gpu(){return this.color.gpu}get size(){return this.#n}get texelSize(){return[1/this.#n[0],1/this.#n[1]]}get color(){return this.#i[0]}get colors(){return this.#i}get depth(){return this.#s}get format(){return Xl(this.options)[0]?.format??"rgba8unorm"}get clearColor(){return Cf(this.#l)}set clearColor(i){this.#l=no(i,"target.clearColor")}get sampleCount(){return zy(this.options)}resize(i){Uy(this.#n,i)||this.#c(i)}async read(){return this.color.read()}async readFloats(){return this.color.readFloats()}onDestroy(i){return this.#e.onDestroy(this,i)}onTexturesRecreated(i){return this.#t.add(i),()=>{this.#t.delete(i)}}destroy(){this.#e.emit(this),this.#t.clear(),this.#u()}renderPassDescriptor(i={}){const{clear:s=[0,0,0,1],preserve:l,clearDepth:o,clearStencil:c,depthReadOnly:d}=i;return{colorAttachments:this.#i.map((h,m)=>fE(h,this.#a?.[m],s,l)),depthStencilAttachment:this.#s?dE(this.#s,l,o,c,d):void 0}}#c(i){this.#u(),this.#n=[i[0],i[1]],this.#i=this.#f(),this.#a=this.sampleCount===4?this.#r():void 0,this.#s=this.#d(),this.#o()}#o(){for(const i of[...this.#t])i()}#u(){for(const i of this.#i)i.destroy();for(const i of this.#a??[])i.destroy();this.#s?.destroy()}#f(){return Xl(this.options).map((i,s)=>this.device.createTexture({size:this.#n,format:i.format,usage:["render_attachment","texture_binding","copy_src"],sampleCount:1,label:this.options.label?`${this.options.label}.color${s}.resolve`:void 0}))}#r(){return Xl(this.options).map((i,s)=>this.device.createTexture({size:this.#n,format:i.format,usage:["render_attachment"],sampleCount:4,label:this.options.label?`${this.options.label}.color${s}`:void 0}))}#d(){const i=Oy(this.options);return i?this.device.createTexture({size:this.#n,format:i,usage:["render_attachment","texture_binding"],sampleCount:this.sampleCount,label:this.options.label?`${this.options.label}.depth`:void 0}):void 0}}function Ka(n,i,s="read-write"){const l=Wn(n,"storage"),o=typeof s=="string"?{access:s}:s,c=QT(l.device,i,o.access??"read-write",void 0,o.indirect??!1);return ny(l,c,d=>d.destroy(),d=>{c.onDestroy(d)})}class Uf{size;access;buffer;constructor(i,s){this.buffer=i,this.access=s,this.size=i.options.size}static create(i,s,l,o,c=!1){const d=c?["storage","copy_dst","copy_src","indirect"]:["storage","copy_dst","copy_src"],h=i.createBuffer({size:s,usage:d,label:o});return new Uf(h,l)}read(){return this.buffer.read(this.size)}write(i,s=0){this.buffer.write(PT(i),s)}get gpu(){return this.buffer.gpu}get resourceIdentity(){return this.buffer.resourceIdentity}onDestroy(i){return this.buffer.onDestroy(i)}destroy(){this.buffer.destroy()}}function QT(n,i,s,l,o=!1){return Uf.create(n,i,s,l,o)}function PT(n){if(n instanceof ArrayBuffer||ArrayBuffer.isView(n))return n;throw new TypeError("StorageBuffer.write() requires ArrayBuffer or ArrayBufferView.")}function ZT(n,i,s,l={}){const o=Wn(n,"pingPong");return JT(o.device,i,s,l,c=>WT(o,c))}function WT(n,i){return ny(n,i,s=>s.destroy(),s=>{i.onDestroy(s)})}function JT(n,i,s,l={},o=eA){const c=[l0(i),l0(s)],d={...l,size:c},h=o(new lf(n,o0(d,l.label,"ping"))),m=o(new lf(n,o0(d,l.label,"pong")));return new tA([h,m])}function eA(n){return n}class tA{halves;#e=0;constructor(i){this.halves=i}get read(){return this.halves[this.#e]}get write(){return this.halves[this.#e^1]}swap(){this.#e^=1}}function l0(n){return Math.max(1,Math.floor(n))}function o0(n,i,s){return i?{...n,label:`${i}.${s}`}:n}const Bc=8,nA=globalThis.GPUMapMode?.READ??1;function iA(n,i){return new aA(n,i)}class aA{querySet;capacity;#e;#t;#n;#i;#a;#s=0;#l=0;#c=-1;#o;#u=0;#f=0;#r=!1;#d=!1;constructor(i,s){this.capacity=s.capacity;const l=s.label??"vgpu.query-ring";this.#e=l;const o=s.capacity*Bc;this.querySet=i.gpu.createQuerySet({type:s.type,count:s.capacity,label:l}),this.#t=i.createBuffer({size:o,usage:["query_resolve","copy_src"],label:`${l}.resolve`}),this.#n=Array.from({length:s.depth??3},(c,d)=>({buffer:i.createBuffer({size:o,usage:["map_read","copy_dst"],label:`${l}.staging${d}`}),mapPending:!1,retired:!1})),this.#i=s.trackSettled,this.#a=s.errorSink}encodeResolve(i,s){if(this.#o=void 0,this.#r||s<=0)return!1;const l=this.#h();if(!l)return!1;const o=Math.min(s,this.capacity);return i.resolveQuerySet(this.querySet,0,o,this.#t.gpu,0),i.copyBufferToBuffer(this.#t.gpu,0,l.buffer.gpu,0,o*Bc),this.#o={staging:l,usedCount:o,seq:this.#l},this.#l+=1,this.#s+=1,!0}onSubmitted(i){const s=this.#o;if(this.#o=void 0,!s)return;s.staging.mapPending=!0,this.#u+=1;const l=s.staging.buffer.gpu.mapAsync(nA).then(()=>{const o=this.#m(s);s.seq<=this.#c||(this.#c=s.seq,i(o))}).catch(o=>{this.#y(o)}).finally(()=>{s.staging.mapPending=!1,this.#u-=1,this.#g()});this.#i?.(l)}#h(){for(let i=0;i<this.#n.length;i+=1){const s=this.#n[this.#s%this.#n.length];if(!s.retired)return s.mapPending?void 0:s;this.#s+=1}}#m(i){let s;try{s=new BigUint64Array(i.staging.buffer.gpu.getMappedRange().slice(0,i.usedCount*Bc))}catch(l){throw this.#p(i.staging),l}try{i.staging.buffer.gpu.unmap()}catch(l){throw i.staging.retired=!0,l}return s}#p(i){try{i.buffer.gpu.unmap()}catch{i.retired=!0}}retain(){this.#f+=1}release(){this.#f>0&&(this.#f-=1),this.#g()}dispose(){this.#r||(this.#r=!0,this.#o=void 0,this.#g())}#g(){if(!(!this.#r||this.#d||this.#u>0||this.#f>0)){this.#d=!0,this.querySet.destroy(),this.#t.dispose();for(const i of this.#n)i.buffer.dispose()}}#y(i){const s=AS(this.#e,i),l=this.#a;if(!l){console.error(s);return}try{Promise.resolve(l(s)).catch(o=>{console.error(o)})}catch(o){console.error(o)}}}const u0=32,of=4096,c0=of/2,sA=1/1e6;class rA{name;owner;constructor(i,s){this.name=i,this.owner=s}[zf](i){return{owner:this.owner,timestampWrites:this.owner.attachSpan(this,i.frame,i.device)}}}function lA(n){const i=Wn(n,"timer");return $S(i,s=>new oA(i.device,s))}class oA{#e;#t;#n=new Map;#i=new Set;#a;#s=u0*2;#l=u0*2;#c;#o=[];#u=new Set;#f=0;#r;#d=0;#h=-1;#m=new Map;#p=!1;constructor(i,s={}){if(!i.features.has("timestamp-query"))throw Za('timer(gpu) needs the "timestamp-query" device feature — request it at init: init({ requiredFeatures: ["timestamp-query"] }).','Pass init({ requiredFeatures: ["timestamp-query"] }) on an adapter that supports it; gate optional timing on gpu.device.features.has("timestamp-query").');this.#e=i,this.#t=s,this.#a=this.#x()}span(i){if(this.#v("Timer.span"),typeof i!="string"||i.length===0)throw Za(`span name received ${cA(i)}; expected a non-empty string.`,'Name each timed pass, e.g. timer.span("shadows").',"Timer.span");let s=this.#n.get(i);return s||(s=new rA(i,this),this.#n.set(i,s)),s}onResults(i){return this.#v("Timer.onResults"),this.#i.add(i),()=>{this.#i.delete(i)}}dispose(){this.#p||(this.#p=!0,this.#i.clear(),this.#n.clear(),this.#u.clear(),this.#o=[],this.#r=void 0,this.#a.dispose(),this.#t.onDispose?.())}attachSpan(i,s,l){if(this.#v("Frame.pass"),l!==this.#e)throw Za(`span '${i.name}' belongs to a timer created on a different gpu; timestamp queries cannot cross devices.`,"Create one timer(gpu) per gpu and use its spans only with that gpu's frames.","Frame.pass");if(s!==this.#c&&this.#g(s),this.#u.has(i.name))throw Za(`duplicate span '${i.name}' in one frame; each result key holds a single begin/end pair per frame.`,`Use one timer.span(name) per pass per frame, e.g. timer.span("${i.name}-2") for the second pass.`,"Frame.pass");if(this.#u.size>=c0)throw dS(c0,of);this.#u.add(i.name);const o=this.#u.size*2-2;if(this.#l<o+2&&(this.#l=o+2),!(o+2>this.#a.capacity))return this.#f=o+2,this.#o.push({name:i.name,begin:o}),this.#S(s),{querySet:this.#a.querySet,beginningOfPassWriteIndex:o,endOfPassWriteIndex:o+1}}finalizeFrame(i,s){this.#r=void 0,!(this.#p||i!==this.#c||this.#f===0)&&this.#a.encodeResolve(s,this.#f)&&(this.#r=[...this.#o])}frameSubmitted(i){if(this.#b(i),i!==this.#c||this.#p)return;const s=this.#r;if(this.#r=void 0,!s||s.length===0)return;const l=this.#d;this.#d+=1,this.#a.onSubmitted(o=>{l<=this.#h||(this.#h=l,this.#y(s,o))})}frameAbandoned(i){i===this.#c&&(this.#r=void 0),this.#b(i)}#g(i){this.#l>this.#a.capacity&&(this.#a.dispose(),this.#s=Math.min(of,uA(this.#l)),this.#a=this.#x()),this.#l=this.#s,this.#c=i,this.#o=[],this.#u.clear(),this.#f=0}#y(i,s){const l={};for(const{name:c,begin:d}of i){const h=s[d]??0n,m=s[d+1]??0n;l[c]=m>h?Number(m-h)*sA:0}const o=Object.freeze(l);for(const c of[...this.#i])try{c(o)}catch(d){console.error(d)}}#S(i){this.#m.has(i)||(this.#m.set(i,this.#a),this.#a.retain())}#b(i){const s=this.#m.get(i);s&&(this.#m.delete(i),s.release())}#x(){return iA(this.#e,{type:"timestamp",capacity:this.#s,label:"vgpu.timer",trackSettled:this.#t.trackSettled,errorSink:this.#t.errorSink})}#v(i){if(this.#p)throw Za("the timer is disposed.","Create a new timer with timer(gpu).",i)}}function uA(n){let i=1;for(;i<n;)i*=2;return i}function cA(n){return typeof n=="string"?`'${n}'`:String(n)}function f0(n){return kS("browser",n)}const Wy=`struct Params {
26
- // visible world rect: x0, y0, x1, y1
27
- rect : vec4f,
28
- // viewportW, viewportH, scale (px per world unit), time (seconds)
29
- view : vec4f,
30
- // massCount, disturbanceCount, couplingCount, dt
31
- counts : vec4f,
32
- // rowsScreen, stepScreen, amp, alpha
33
- layer : vec4f,
34
- // lineWidth, dz, parallaxX, showResidue
35
- layer2 : vec4f,
36
- // columns, rows, laneCount, plinthCount
37
- grid : vec4f,
38
- fill : vec4f,
39
- // padded field rect used by the field texture: x0, y0, x1, y1
40
- fieldRect : vec4f,
41
- // fill reach in rows (0 = every fill runs to the viewport bottom), unused, unused, unused
42
- sheet : vec4f,
43
- };
44
-
45
- // Storage rather than uniform: every array below is packed by hand into a Float32Array, and this
46
- // keeps the whole parameter block on the same footing instead of splitting the packing across two
47
- // binding conventions.
48
- @group(0) @binding(0) var<storage, read> P : Params;
49
-
50
- // masses: 3 vec4 each
51
- // 0: pos.xy, extent.xy
52
- // 1: depth, rim, pull, lobe
53
- // 2: phase, tint.rgb
54
- @group(0) @binding(1) var<storage, read> massData : array<vec4f>;
55
-
56
- // disturbances: 3 vec4 each
57
- // 0: x, y, radius, amplitude
58
- // 1: frequency, phase, statusIndex, energy
59
- // 2: articulation, shoulder, unused, unused
60
- @group(0) @binding(2) var<storage, read> distData : array<vec4f>;
61
-
62
- // couplings: 1 vec4 each — fromMassIndex, toMassIndex, energy, unused
63
- @group(0) @binding(3) var<storage, read> coupData : array<vec4f>;
64
-
65
- // WGSL's pow() is exp2(y * log2(x)) and returns NaN for a negative base. The approved material
66
- // squares plenty of signed quantities — offsets from a rim, distances either side of a ridge — so
67
- // every one of those must be a multiplication, not a pow. A single NaN propagates through the
68
- // baked field texture and blanks the entire sheet.
69
- fn sq(x: f32) -> f32 { return x * x; }
70
- fn quad(x: f32) -> f32 { let s = x * x; return s * s; }
71
-
72
- fn massPos(i: u32) -> vec2f { return massData[i * 3u].xy; }
73
- fn massExtent(i: u32) -> vec2f { return massData[i * 3u].zw; }
74
- fn massShape(i: u32) -> vec4f { return massData[i * 3u + 1u]; }
75
- fn massPhase(i: u32) -> f32 { return massData[i * 3u + 2u].x; }
76
- fn massTint(i: u32) -> vec3f { return massData[i * 3u + 2u].yzw; }
77
- `,fA=`@group(0) @binding(4) var prevTex : texture_2d<f32>;
78
- @group(0) @binding(5) var prevSamp : sampler;
79
-
80
- const DEPOSIT_RATE : f32 = 0.02;
81
- const DECAY_RATE : f32 = 0.05;
82
-
83
- @fragment
84
- fn fs_main(@location(0) uv: vec2f) -> @location(0) vec4f {
85
- let prev = textureSampleLevel(prevTex, prevSamp, uv, 0.0);
86
- let dt = P.counts.w;
87
-
88
- // Texel back to world space over the fixed residue rect.
89
- let world = vec2f(
90
- mix(P.fieldRect.x, P.fieldRect.z, uv.x),
91
- mix(P.fieldRect.y, P.fieldRect.w, uv.y)
92
- );
93
-
94
- // --- process deposition -------------------------------------------------
95
- var deposit = 0.0;
96
- let dn = u32(P.counts.y);
97
- for (var i = 0u; i < dn; i = i + 1u) {
98
- let a = distData[i * 3u];
99
- let b = distData[i * 3u + 1u];
100
- let radius = a.z;
101
- let energy = b.w;
102
- if (energy <= 0.001) { continue; }
103
- let d = length(vec2f(world.x - a.x, (world.y - a.y) * 1.5));
104
- if (d > radius * 2.4) { continue; }
105
- let falloff = exp(-sq(d / (radius * 1.7)));
106
- deposit = deposit + energy * falloff;
107
- }
108
-
109
- // --- transfer deposition ------------------------------------------------
110
- var coupleDeposit = 0.0;
111
- let cn = u32(P.counts.z);
112
- for (var i = 0u; i < cn; i = i + 1u) {
113
- let c = coupData[i];
114
- let a = massPos(u32(c.x));
115
- let b = massPos(u32(c.y));
116
- let v = b - a;
117
- let l2 = dot(v, v);
118
- if (l2 < 1.0) { continue; }
119
- let u = dot(world - a, v) / l2;
120
- if (u < -0.05 || u > 1.05) { continue; }
121
- let proj = a + v * u;
122
- let p = length(world - proj) / 44.0;
123
- coupleDeposit = coupleDeposit + c.z * exp(-p * p * 1.4)
124
- * exp(-quad((u - 0.5) / 0.5));
125
- }
126
-
127
- let r = prev.r + (deposit * DEPOSIT_RATE - prev.r * DECAY_RATE) * dt;
128
- let g = prev.g + (coupleDeposit * DEPOSIT_RATE * 1.5 - prev.g * DECAY_RATE) * dt;
129
-
130
- // Clamped so a pathological source can never drive residue unbounded.
131
- return vec4f(clamp(r, 0.0, 4.0), clamp(g, 0.0, 4.0), 0.0, 1.0);
132
- }
133
- `,dA=`@group(0) @binding(4) var residueTex : texture_2d<f32>;
134
- @group(0) @binding(5) var residueSamp : sampler;
135
-
136
- // plinths: 3 vec4 each — session presence (FIELD-SPEC §15)
137
- // 0: x, y, extentX, extentY
138
- // 1: presence, articulation, parentIndex + 1 (0 = none), empty flag
139
- // 2: shoulder, nested flag, unused, unused
140
- @group(0) @binding(6) var<storage, read> plinthData : array<vec4f>;
141
-
142
- const MAX_PLINTHS : u32 = 16u;
143
-
144
- const RES_X0 : f32 = 0.0;
145
- const RES_Y0 : f32 = 0.0;
146
- const RES_X1 : f32 = 1160.0;
147
- const RES_Y1 : f32 = 812.0;
148
-
149
- fn residueAt(world: vec2f) -> vec2f {
150
- let uv = vec2f(
151
- (world.x - RES_X0) / (RES_X1 - RES_X0),
152
- (world.y - RES_Y0) / (RES_Y1 - RES_Y0)
153
- );
154
- if (uv.x < 0.0 || uv.x > 1.0 || uv.y < 0.0 || uv.y > 1.0) { return vec2f(0.0); }
155
- return textureSampleLevel(residueTex, residueSamp, uv, 0.0).rg;
156
- }
157
-
158
- /** FIELD-SPEC §7 — the sheet sags toward mass. */
159
- fn shiftAt(world: vec2f, t: f32) -> f32 {
160
- var dy = 0.0;
161
- let mn = u32(P.counts.x);
162
- for (var i = 0u; i < mn; i = i + 1u) {
163
- let pos = massPos(i);
164
- let ext = massExtent(i);
165
- let n = (world - pos) / ext;
166
- let g = exp(-dot(n, n) * 0.85);
167
- dy = dy + massShape(i).z * n.y * g * 1.6;
168
- }
169
-
170
- // Coupling flattens the sheet between two machines (FIELD-SPEC §8).
171
- let cn = u32(P.counts.z);
172
- let res = residueAt(world);
173
- for (var i = 0u; i < cn; i = i + 1u) {
174
- let c = coupData[i];
175
- let a = massPos(u32(c.x));
176
- let b = massPos(u32(c.y));
177
- let v = b - a;
178
- let l2 = dot(v, v);
179
- if (l2 < 1.0) { continue; }
180
- let u = dot(world - a, v) / l2;
181
- if (u < -0.05 || u > 1.05) { continue; }
182
- let proj = a + v * u;
183
- let off = (world.y - proj.y) / 62.0;
184
- let env = exp(-off * off) * exp(-quad((u - 0.5) / 0.55));
185
- dy = dy - off * 62.0 * 0.42 * env * (0.7 + 0.3 * sin(t * 2.4 - u * 6.0)) * c.z;
186
- dy = dy - off * 10.0 * env * res.g;
187
- }
188
- return dy;
189
- }
190
-
191
- /** FIELD-SPEC §6 — the height field. */
192
- fn heightAt(world: vec2f, t: f32) -> f32 {
193
- let x = world.x;
194
- let y = world.y;
195
-
196
- // Base medium.
197
- var v = 3.1 * sin(x * 0.021 + y * 0.013) * sin(y * 0.017 - x * 0.008)
198
- + 1.7 * sin(x * 0.045 - y * 0.031)
199
- + 1.1 * sin(y * 0.062 + x * 0.017);
200
-
201
- // Mass: a lobed well with a raised rim. Permanent.
202
- let mn = u32(P.counts.x);
203
- for (var i = 0u; i < mn; i = i + 1u) {
204
- let pos = massPos(i);
205
- let ext = massExtent(i);
206
- let shape = massShape(i);
207
- let ph = massPhase(i);
208
- let n = (world - pos) / ext;
209
- let r = length(n);
210
- let th = atan2(n.y, n.x);
211
- let lobe = shape.w;
212
- let wob = 1.0 + lobe * sin(3.0 * th + ph) * 0.5 + lobe * 0.3 * sin(5.0 * th - ph);
213
- let rr = r / max(0.35, wob);
214
- v = v - shape.x * exp(-rr * rr * 1.05);
215
- v = v + shape.y * exp(-sq((rr - 1.02) / 0.42));
216
- }
217
-
218
- // Activity: temporary, local, independent. Anisotropic — wider than tall.
219
- //
220
- // Articulation (FIELD-SPEC §16) is spent on definition only: it damps the ripple terms, softens
221
- // and widens the collar so the rim stops closing, and — when co-observing sources disagree on
222
- // extent — raises a faint doubled shoulder inside the object's own trough. The bulge amplitude
223
- // itself is NEVER scaled by articulation: unknown stays heavy.
224
- let dn = u32(P.counts.y);
225
- for (var i = 0u; i < dn; i = i + 1u) {
226
- let a = distData[i * 3u];
227
- let b = distData[i * 3u + 1u];
228
- let c = distData[i * 3u + 2u];
229
- let amp = a.w;
230
- if (amp <= 0.01) { continue; }
231
- let radius = a.z;
232
- let freq = b.x;
233
- let phase = b.y;
234
- let artic = c.x;
235
- let rip = 0.15 + 0.85 * artic;
236
- let d = length(vec2f(x - a.x, (y - a.y) * 1.5));
237
- if (d > radius * 4.0) { continue; }
238
- let e = exp(-sq(d / radius));
239
- v = v + amp * e * (0.78 + 0.22 * sin(t * freq + phase) * rip);
240
- v = v - amp * 0.34 * (0.25 + 0.75 * artic)
241
- * exp(-sq((d - radius * 1.5) / (radius * 0.62 * (1.0 + (1.0 - artic) * 1.4))));
242
- v = v + amp * 0.16 * rip * exp(-d / (radius * 2.1)) * sin(d * 0.13 - t * freq * 2.6 + phase);
243
- if (c.y > 0.02) {
244
- v = v + amp * 0.11 * exp(-sq((d - radius * (0.72 + c.y)) / (radius * 0.3)));
245
- }
246
- }
247
-
248
- // SESSION PRESENCE (FIELD-SPEC §15): a flat-topped plinth per live session raises grouped
249
- // executions onto one platform, so an existing contour closes around the set. A spawned child
250
- // is a plinth growing out of the parent plinth. An empty-but-known session keeps only its rim.
251
- let pn = min(u32(P.grid.w), MAX_PLINTHS);
252
- var lv : array<f32, MAX_PLINTHS>;
253
- for (var i = 0u; i < pn; i = i + 1u) {
254
- let pa = plinthData[i * 3u];
255
- let pb = plinthData[i * 3u + 1u];
256
- let pc = plinthData[i * 3u + 2u];
257
- let n = (world - pa.xy) / pa.zw;
258
- let r2 = dot(n, n);
259
- let presence = pb.x;
260
- let plateau = 1.0 / (1.0 + pow(max(r2, 1e-5), 2.6));
261
- lv[i] = plateau * presence;
262
- if (pb.w > 0.5) {
263
- // Presence without content: the rim of a session nothing ever ran in.
264
- v = v + 4.5 * presence * exp(-sq((sqrt(r2) - 1.0) / 0.3));
265
- } else {
266
- let plinth = select(17.0, 13.0, pc.y > 0.5) * presence;
267
- v = v + plinth * plateau;
268
- if (pc.x > 0.02) {
269
- // Co-observation shoulder: sources agree on the computation, not exactly on its extent.
270
- // A concentric bench inside the plateau edge — never a separate closed rim.
271
- v = v + plinth * 0.3 * pc.x * exp(-sq((sqrt(r2) - 0.78) / 0.13));
272
- }
273
- }
274
- }
275
-
276
- // THE KEEL: where two unrelated plateaus overlap, the ground between them drops — the same
277
- // trough vocabulary already used around bulges, so contours cannot bridge it and proximity alone
278
- // can never close a line. Parent and spawned child are exempt and still share a wall. Shallow by
279
- // design: it must never read as a machine-level rift.
280
- for (var i = 0u; i < pn; i = i + 1u) {
281
- for (var j = i + 1u; j < pn; j = j + 1u) {
282
- if (lv[i] < 0.02 || lv[j] < 0.02) { continue; }
283
- let pi = u32(plinthData[i * 3u + 1u].z);
284
- let pj = u32(plinthData[j * 3u + 1u].z);
285
- if (pi == j + 1u || pj == i + 1u) { continue; }
286
- let lo = min(lv[i], lv[j]);
287
- let o = lo / max(lv[i], lv[j]);
288
- v = v - 30.0 * o * sqrt(o) * lo;
289
- }
290
- }
291
-
292
- // Residue: what the field remembers. One texture read, not a walk through history.
293
- if (P.layer2.w > 0.5) {
294
- let res = residueAt(world);
295
- v = v + 62.0 * 0.15 * res.r;
296
- }
297
-
298
- // Coupling ridge.
299
- let cn = u32(P.counts.z);
300
- let resC = residueAt(world);
301
- for (var i = 0u; i < cn; i = i + 1u) {
302
- let c = coupData[i];
303
- let a = massPos(u32(c.x));
304
- let b = massPos(u32(c.y));
305
- let vv = b - a;
306
- let l2 = dot(vv, vv);
307
- if (l2 < 1.0) { continue; }
308
- let u = dot(world - a, vv) / l2;
309
- if (u < -0.05 || u > 1.05) { continue; }
310
- let proj = a + vv * u;
311
- let p = length(world - proj) / 44.0;
312
- let envc = exp(-p * p) * exp(-quad((u - 0.5) / 0.56));
313
- v = v + 34.0 * envc * (0.5 + 0.5 * sin(u * 13.0 - t * 4.6)) * c.z;
314
- v = v - 14.0 * exp(-sq(abs(p) - 1.5)) * envc * c.z;
315
- v = v + 9.0 * resC.g * exp(-p * p * 1.4) * exp(-quad((u - 0.5) / 0.5));
316
- }
317
-
318
- return v;
319
- }
320
-
321
- /**
322
- * Local articulation (FIELD-SPEC §16): the sheet resolves coarser near unresolved objects, so line
323
- * cadence carries the meaning. Weighted blend over disturbances and plinths, with a prior toward 1
324
- * so the empty medium — and everything far from an observed object — keeps its full cadence.
325
- */
326
- fn articAt(world: vec2f) -> f32 {
327
- var num = 0.0;
328
- var den = 0.35;
329
- let dn = u32(P.counts.y);
330
- for (var i = 0u; i < dn; i = i + 1u) {
331
- let a = distData[i * 3u];
332
- let b = distData[i * 3u + 1u];
333
- if (b.w <= 0.001) { continue; }
334
- let dx = (world.x - a.x) / (a.z * 2.0);
335
- let dy = (world.y - a.y) * 1.5 / (a.z * 2.0);
336
- let w = exp(-(dx * dx + dy * dy)) * b.w;
337
- num = num + w * distData[i * 3u + 2u].x;
338
- den = den + w;
339
- }
340
- let pn = min(u32(P.grid.w), MAX_PLINTHS);
341
- for (var i = 0u; i < pn; i = i + 1u) {
342
- let pa = plinthData[i * 3u];
343
- let pb = plinthData[i * 3u + 1u];
344
- if (pb.x <= 0.01) { continue; }
345
- let dx = (world.x - pa.x) / (pa.z * 1.3);
346
- let dy = (world.y - pa.y) / (pa.w * 1.3);
347
- let w = exp(-(dx * dx + dy * dy)) * pb.x * 0.8;
348
- num = num + w * pb.y;
349
- den = den + w;
350
- }
351
- return clamp((num + 0.35) / den, 0.1, 1.0);
352
- }
353
-
354
- @fragment
355
- fn fs_main(@location(0) uv: vec2f) -> @location(0) vec4f {
356
- let world = vec2f(
357
- mix(P.fieldRect.x, P.fieldRect.z, uv.x),
358
- mix(P.fieldRect.y, P.fieldRect.w, uv.y)
359
- );
360
- let t = P.view.w;
361
- return vec4f(heightAt(world, t), shiftAt(world, t), articAt(world), 1.0);
362
- }
363
- `,hA=`@group(0) @binding(4) var fieldTex : texture_2d<f32>;
364
- @group(0) @binding(5) var fieldSamp : sampler;
365
-
366
- struct VOut {
367
- @builtin(position) pos : vec4f,
368
- @location(0) color : vec4f,
369
- };
370
-
371
- fn fieldSample(world: vec2f) -> vec3f {
372
- let uv = vec2f(
373
- (world.x - P.fieldRect.x) / (P.fieldRect.z - P.fieldRect.x),
374
- (world.y - P.fieldRect.y) / (P.fieldRect.w - P.fieldRect.y)
375
- );
376
- // r: height, g: shift, b: local articulation.
377
- return textureSampleLevel(fieldTex, fieldSamp, clamp(uv, vec2f(0.0), vec2f(1.0)), 0.0).rgb;
378
- }
379
-
380
- /** FIELD-SPEC §10 — line colour is the base ink pulled toward nearby mass tints. */
381
- fn tintMix(world: vec2f) -> vec3f {
382
- var acc = vec3f(226.0, 223.0, 215.0);
383
- var w = 1.0;
384
- let mn = u32(P.counts.x);
385
- for (var i = 0u; i < mn; i = i + 1u) {
386
- let pos = massPos(i);
387
- let ext = massExtent(i) * 1.5;
388
- let n = (world - pos) / ext;
389
- let k = exp(-dot(n, n)) * 0.85;
390
- acc = acc + massTint(i) * k;
391
- w = w + k;
392
- }
393
- return acc / w / 255.0;
394
- }
395
-
396
- /** Screen-space y of the sheet at world x on the given row baseline. */
397
- fn rowPoint(x: f32, by: f32, dzW: f32, ampF: f32) -> f32 {
398
- let wy = by + dzW;
399
- let sh = fieldSample(vec2f(x, wy)).g;
400
- let yy = wy + sh * ampF;
401
- let hv = fieldSample(vec2f(x, yy)).r * ampF;
402
- let worldY = by - hv + sh * 0.55 * ampF;
403
- return (worldY - P.rect.y) * P.view.z;
404
- }
405
- `,pA=`@vertex
406
- fn vs_main(@builtin(vertex_index) vi: u32, @builtin(instance_index) ii: u32) -> VOut {
407
- let cols = u32(P.grid.x);
408
- let isLine = ii & 1u;
409
- let seg = ii >> 1u;
410
- let row = seg / cols;
411
- let col = seg % cols;
412
-
413
- let k = P.view.z;
414
- let stepW = P.layer.y / k;
415
- let rowsW = P.layer.x / k;
416
- let dzW = P.layer2.y / k;
417
- // FIELD-SPEC §10 — amplitude compensation when zoomed in.
418
- let ampF = P.layer.z * select(1.0, 1.6 / k, k > 1.0);
419
-
420
- let x0 = P.rect.x - stepW * 2.0 + f32(col) * stepW;
421
- let x1 = x0 + stepW;
422
- let by = P.rect.y - rowsW * 0.6 + f32(row) * rowsW;
423
-
424
- let sy0 = rowPoint(x0, by, dzW, ampF);
425
- let sy1 = rowPoint(x1, by, dzW, ampF);
426
- let sx0 = (x0 - P.rect.x) * k + P.layer2.z;
427
- let sx1 = (x1 - P.rect.x) * k + P.layer2.z;
428
-
429
- var p = vec2f(0.0);
430
- var color = vec4f(0.0);
431
-
432
- if (isLine == 0u) {
433
- // Fill: from this segment down over the farther rows it occludes.
434
- //
435
- // ── Why the fill stops where it does ──────────────────────────────────────────────────────
436
- // The approved material ran every fill to the bottom of the viewport. Composited far to near
437
- // that is exactly the hidden-line algorithm, but it also means a pixel is written once per row
438
- // above it: at the 9 px near-row spacing on a 914 px tall viewport, about 107 blended
439
- // fragments per pixel across the three layers (measured; see the performance investigation),
440
- // and that overdraw grows with width × height² × dpr². It was three quarters of the frame's
441
- // GPU time on an M4 and dwarfs everything else the field draws.
442
- //
443
- // Below the next 'reach' rows' lines a fill can no longer be seen: the fills of those rows
444
- // land on top of it, each at this layer's fill alpha, so whatever it contributed is scaled by
445
- // (1 - alpha)^reach — below one 8-bit step for the reach chosen per layer in FILL_REACH. So
446
- // the fill stops at the LOWEST of the next 'reach' rows' lines at each end of the segment, and
447
- // the rows between it and there keep exactly the occlusion and haze they had. The bottom edge
448
- // is straight between the two ends, which bounds the straight segments of those rows.
449
- //
450
- // Reach 0 restores the original geometry, and the last 'reach' rows keep it, so the sheet's
451
- // edge against the strata band is untouched.
452
- var bottom = P.view.y + 60.0;
453
- let reach = u32(P.sheet.x);
454
- let rows = u32(P.grid.y);
455
- let isBottom = (vi == 2u) || (vi == 4u) || (vi == 5u);
456
- if (isBottom && reach > 0u && row + reach < rows) {
457
- let xb = select(x0, x1, vi != 5u);
458
- var b = select(sy0, sy1, vi != 5u);
459
- for (var j = 1u; j <= reach; j = j + 1u) {
460
- b = max(b, rowPoint(xb, by + f32(j) * rowsW, dzW, ampF));
461
- }
462
- // Half a pixel of slack over the nearer rows' own vertex arithmetic.
463
- bottom = b + 0.5;
464
- }
465
- switch (vi) {
466
- case 0u: { p = vec2f(sx0, sy0); }
467
- case 1u: { p = vec2f(sx1, sy1); }
468
- case 2u: { p = vec2f(sx1, bottom); }
469
- case 3u: { p = vec2f(sx0, sy0); }
470
- case 4u: { p = vec2f(sx1, bottom); }
471
- default: { p = vec2f(sx0, bottom); }
472
- }
473
- color = P.fill;
474
- } else {
475
- // Line: a quad along the segment, width and alpha from local slope (FIELD-SPEC §10).
476
- let slope = min(1.0, abs(sy1 - sy0) / max(0.001, P.layer.y));
477
- var bucketA = 0.17;
478
- var bucketW = 0.75;
479
- if (slope > 0.62) { bucketA = 0.98; bucketW = 1.80; }
480
- else if (slope > 0.30) { bucketA = 0.60; bucketW = 1.35; }
481
- else if (slope > 0.11) { bucketA = 0.32; bucketW = 1.00; }
482
-
483
- // OBSERVATION RESOLUTION (FIELD-SPEC §16): near an unresolved object the sheet's own line
484
- // cadence loosens — segments dash out, thin and dim. Never the height: mass stays, definition
485
- // varies. The blend prior keeps the empty medium at full cadence, so a fully resolved field
486
- // renders exactly as it did before articulation existed.
487
- let art = fieldSample(vec2f((x0 + x1) * 0.5, by)).b;
488
- if (art <= 0.85) {
489
- let dash = (1.0 - art) * 9.0 + 1.5;
490
- // World-anchored phase (scaled to screen), so the cadence sits still under panning.
491
- let phase = fract(x0 * k * 0.7 / (dash * 2.2)) * dash * 2.2;
492
- if (phase > dash * 1.15) {
493
- var cut: VOut;
494
- cut.pos = vec4f(-10.0, -10.0, 0.0, 1.0);
495
- cut.color = vec4f(0.0);
496
- return cut;
497
- }
498
- }
499
- let artA = 0.34 + 0.66 * art;
500
- let artW = 0.7 + 0.3 * art;
501
-
502
- let width = max(0.6, bucketW * artW * min(2.1, k) * P.layer2.x);
503
- let dir = normalize(vec2f(sx1 - sx0, sy1 - sy0) + vec2f(0.0001, 0.0));
504
- let nrm = vec2f(-dir.y, dir.x) * (width * 0.5);
505
-
506
- switch (vi) {
507
- case 0u: { p = vec2f(sx0, sy0) - nrm; }
508
- case 1u: { p = vec2f(sx1, sy1) - nrm; }
509
- case 2u: { p = vec2f(sx1, sy1) + nrm; }
510
- case 3u: { p = vec2f(sx0, sy0) - nrm; }
511
- case 4u: { p = vec2f(sx1, sy1) + nrm; }
512
- default: { p = vec2f(sx0, sy0) + nrm; }
513
- }
514
- let rgb = tintMix(vec2f((x0 + x1) * 0.5, by));
515
- color = vec4f(rgb, bucketA * artA * P.layer.w);
516
- }
517
-
518
- var out: VOut;
519
- out.pos = vec4f(p.x / P.view.x * 2.0 - 1.0, 1.0 - p.y / P.view.y * 2.0, 0.0, 1.0);
520
- out.color = color;
521
- return out;
522
- }
523
-
524
- @fragment
525
- fn fs_main(in: VOut) -> @location(0) vec4f {
526
- return vec4f(in.color.rgb * in.color.a, in.color.a);
527
- }
528
- `,mA=`struct VOut {
529
- @builtin(position) pos : vec4f,
530
- @location(0) local : vec2f,
531
- @location(1) color : vec3f,
532
- @location(2) weight : f32,
533
- };
534
-
535
- fn statusColor(idx: f32) -> vec3f {
536
- if (idx < 0.5) { return vec3f(240.0, 195.0, 116.0) / 255.0; } // running
537
- if (idx < 1.5) { return vec3f(150.0, 175.0, 196.0) / 255.0; } // waiting
538
- if (idx < 2.5) { return vec3f(206.0, 104.0, 90.0) / 255.0; } // failed
539
- if (idx < 3.5) { return vec3f(180.0, 210.0, 175.0) / 255.0; } // completed
540
- return vec3f(230.0, 227.0, 219.0) / 255.0; // idle
541
- }
542
-
543
- fn statusPulse(idx: f32, t: f32, freq: f32, phase: f32) -> f32 {
544
- if (idx < 0.5) { return 0.55 + 0.35 * sin(t * freq * 2.0 + phase); }
545
- if (idx < 1.5) { return 0.40 + 0.08 * sin(t * 0.6); }
546
- if (idx < 2.5) { return 0.50 + 0.50 * sin(t * 30.0); }
547
- if (idx < 3.5) { return 0.35; }
548
- return 0.15;
549
- }
550
-
551
- @vertex
552
- fn vs_main(@builtin(vertex_index) vi: u32, @builtin(instance_index) ii: u32) -> VOut {
553
- let a = distData[ii * 3u];
554
- let b = distData[ii * 3u + 1u];
555
- let k = P.view.z;
556
- let t = P.view.w;
557
-
558
- let statusIdx = b.z;
559
- let failed = select(1.0, 1.3, statusIdx > 1.5 && statusIdx < 2.5);
560
- let radius = max(2.4, 3.4 * k) * failed * 3.2;
561
-
562
- let centre = vec2f((a.x - P.rect.x) * k, (a.y - P.rect.y) * k);
563
- let corner = vec2f(
564
- select(-1.0, 1.0, (vi == 1u) || (vi == 2u) || (vi == 4u)),
565
- select(-1.0, 1.0, (vi == 2u) || (vi == 4u) || (vi == 5u))
566
- );
567
- let p = centre + corner * radius;
568
-
569
- var out: VOut;
570
- out.pos = vec4f(p.x / P.view.x * 2.0 - 1.0, 1.0 - p.y / P.view.y * 2.0, 0.0, 1.0);
571
- out.local = corner;
572
- out.color = statusColor(statusIdx);
573
- // Articulation dims the core's confidence, never the field's mass (FIELD-SPEC §16).
574
- let artic = distData[ii * 3u + 2u].x;
575
- out.weight = statusPulse(statusIdx, t, b.x, b.y) * 0.9 * clamp(b.w, 0.0, 1.0)
576
- * (0.22 + 0.78 * artic);
577
- return out;
578
- }
579
-
580
- @fragment
581
- fn fs_main(in: VOut) -> @location(0) vec4f {
582
- let d = length(in.local);
583
- if (d > 1.0) { discard; }
584
- // Radial falloff matching the design's gradient stops.
585
- let a = (1.0 - d) * (1.0 - d) * in.weight;
586
- return vec4f(in.color * a, a);
587
- }
588
- `,gA=`// per stratum: startFraction, endFraction, lane, statusIndex
589
- @group(0) @binding(4) var<storage, read> strataData : array<vec4f>;
590
-
591
- struct VOut {
592
- @builtin(position) pos : vec4f,
593
- @location(0) t : f32,
594
- @location(1) color : vec3f,
595
- @location(2) alpha : f32,
596
- };
597
-
598
- const STRATA_TOP : f32 = 812.0;
599
- const STRATA_H : f32 = 360.0;
600
- const SPAN_X : f32 = 1160.0;
601
- const MIN_W : f32 = 3.0;
602
-
603
- @vertex
604
- fn vs_main(@builtin(vertex_index) vi: u32, @builtin(instance_index) ii: u32) -> VOut {
605
- let s = strataData[ii];
606
- let laneCount = max(1.0, P.grid.z);
607
- let laneH = STRATA_H / laneCount;
608
- let top = STRATA_TOP + s.z * laneH;
609
-
610
- let wx0 = s.x * SPAN_X;
611
- let wx1 = max(wx0 + MIN_W, s.y * SPAN_X);
612
- let k = P.view.z;
613
-
614
- let sx0 = (wx0 - P.rect.x) * k;
615
- let sx1 = (wx1 - P.rect.x) * k;
616
- let sy0 = (top - P.rect.y) * k;
617
- let sy1 = (top + laneH - P.rect.y) * k;
618
-
619
- let right = (vi == 1u) || (vi == 2u) || (vi == 4u);
620
- let lower = (vi == 2u) || (vi == 4u) || (vi == 5u);
621
- let p = vec2f(select(sx0, sx1, right), select(sy0, sy1, lower));
622
-
623
- // Failed runs read red; otherwise the lane's machine tint.
624
- var col = massTint(u32(s.z)) / 255.0;
625
- if (s.w > 1.5 && s.w < 2.5) { col = vec3f(206.0, 104.0, 90.0) / 255.0; }
626
-
627
- var out: VOut;
628
- out.pos = vec4f(p.x / P.view.x * 2.0 - 1.0, 1.0 - p.y / P.view.y * 2.0, 0.0, 1.0);
629
- out.t = select(0.0, 1.0, right);
630
- out.color = col;
631
- out.alpha = 0.30;
632
- return out;
633
- }
634
-
635
- @fragment
636
- fn fs_main(in: VOut) -> @location(0) vec4f {
637
- // Left-to-right gradient to transparent, as in the approved design.
638
- let a = in.alpha * (1.0 - in.t);
639
- return vec4f(in.color * a, a);
640
- }
641
- `,d0=8,h0=64,p0=8,m0=16,yA={x0:0,y0:0,x1:1160,y1:812},g0=256;function co(n){return`
642
-
643
- `+Wy+`
644
-
645
- `+n}function vA(n){return`
646
-
647
- `+Wy+`
648
-
649
- `+hA+n}const bA=co(fA),xA=co(dA),y0=vA(pA),SA=co(mA),wA=co(gA),Jy=.34,ev=3.4,v0={zoom:1,cx:580,cy:406},EA=-260,TA=1420,AA=-260,MA=1300,RA=.58,DA=.72,uf=1.7,CA=1.45;function OA(n,i){return n==="strata"?i>DA?"environment":"strata":n==="proximity"?i<CA?"environment":"proximity":i<RA?"strata":i>uf?"proximity":"environment"}function zA(n){return n.width/En.spanX}function An(n,i){return zA(i)*n.zoom}function gr(n){return n.zoom=Math.max(Jy,Math.min(ev,n.zoom)),n.cx=Math.max(EA,Math.min(TA,n.cx)),n.cy=Math.max(AA,Math.min(MA,n.cy)),n}function _A(n,i,s){const l=An(n,i),o=i.width/l,c=i.height/l;return s.x0=n.cx-o/2,s.y0=n.cy-c/2,s.x1=n.cx+o/2,s.y1=n.cy+c/2,s}function cf(n,i,s,l){const o=An(s,l),c=l.width/o,d=l.height/o;return[s.cx-c/2+n/o,s.cy-d/2+i/o]}function Gc(n,i,s,l){const o=An(s,l),c=l.width/o,d=l.height/o;return[(n-(s.cx-c/2))*o,(i-(s.cy-d/2))*o]}function $c(n,i,s,l,o){const[c,d]=cf(s,l,n,o);n.zoom=Math.max(Jy,Math.min(ev,n.zoom*i));const h=An(n,o);n.cx=c-s/h+o.width/h/2,n.cy=d-l/h+o.height/h/2,gr(n)}function b0(n,i,s,l){const o=An(n,l);n.cx+=i/o,n.cy+=s/o,gr(n)}function UA(n,i,s,l=7){const o=1-Math.exp(-l*s),c=i.zoom-n.zoom,d=i.cx-n.cx,h=i.cy-n.cy;n.zoom+=c*o,n.cx+=d*o,n.cy+=h*o;const m=Math.abs(c)<.001&&Math.abs(d)<.4&&Math.abs(h)<.4;return m&&(n.zoom=i.zoom,n.cx=i.cx,n.cy=i.cy),m}function NA(n,i,s){return gr({zoom:s,cx:n,cy:i})}const $l=120,kA="field",LA=5,jA=2,x0=30;class BA{intervalMs=new Float32Array($l);cpuMs=new Float32Array($l);cursor=0;filled=0;lastFrameAt=0;frames=0;lastIntervalMs=0;lastCpuMs=0;gpuMs={};disturbances=0;fps=0;resolutionScale=1;get canAdapt(){return this.bakeSamples>0}lastEvalAt=0;pendingResize=!1;bakeSum=0;bakeSamples=0;sample(i,s,l){const o=this.gpuMs[kA];if(o!==void 0&&o>0&&(this.bakeSum+=o,this.bakeSamples++),this.lastFrameAt>0){const c=i-this.lastFrameAt;this.intervalMs[this.cursor]=c,this.cpuMs[this.cursor]=s,this.cursor=(this.cursor+1)%$l,this.filled<$l&&this.filled++,this.lastIntervalMs=c}this.lastFrameAt=i,this.lastCpuMs=s,this.frames++,this.disturbances=l,this.fps=this.averageInterval>0?1e3/this.averageInterval:0,this.maybeAdapt(i)}resetPacing(){this.lastFrameAt=0}get averageInterval(){if(this.filled===0)return 0;let i=0;for(let s=0;s<this.filled;s++)i+=this.intervalMs[s];return i/this.filled}get averageCpuMs(){if(this.filled===0)return 0;let i=0;for(let s=0;s<this.filled;s++)i+=this.cpuMs[s];return i/this.filled}get totalGpuMs(){let i=0;for(const s in this.gpuMs)i+=this.gpuMs[s];return i}bakeCost(){return this.bakeSamples<x0?0:this.bakeSum/this.bakeSamples}maybeAdapt(i){if(i-this.lastEvalAt<2e3||this.filled<45)return;const s=this.bakeCost();this.bakeSamples<x0||(this.lastEvalAt=i,this.bakeSum=0,this.bakeSamples=0,!(s<=0)&&(s>LA&&this.resolutionScale>.5?(this.resolutionScale=Math.max(.5,this.resolutionScale-.15),this.pendingResize=!0):s<jA&&this.resolutionScale<1&&(this.resolutionScale=Math.min(1,this.resolutionScale+.1),this.pendingResize=!0)))}wantsResize(){return this.pendingResize?(this.pendingResize=!1,!0):!1}snapshot(){return{fps:this.fps,intervalMs:this.averageInterval,cpuMs:this.averageCpuMs,gpuMs:this.totalGpuMs,frames:this.frames,scale:this.resolutionScale,disturbances:this.disturbances}}}const Pn=[{rows:22,step:11,amp:.5,alpha:.4,lw:.75,dz:-190,px:44,fill:[5,6,8,.9]},{rows:14,step:9,amp:.74,alpha:.72,lw:.9,dz:-92,px:18,fill:[5,6,8,.94]},{rows:9,step:7.5,amp:1,alpha:1,lw:1,dz:0,px:0,fill:[4,5,7,.965]}],S0={running:0,waiting:1,failed:2,completed:3,idle:4},w0={laptop:[214,176,116],desktop:[168,186,150],server:[150,190,175]},E0=512,GA=[3,2,2],T0=0,A0=1,ea=2,M0=1,R0=2,$A=4,IA=1600,D0=.004;function VA(n){return n.msSinceInteraction<IA?M0:n.couplings>0||n.maxEnergy>D0?R0:n.maxSettling>D0?$A:n.dirty?M0:1/0}class FA{gpu;surf=null;output;residue;fieldTarget;gpuTimer=null;spans=null;layerSpans=[];probe=null;sheetVariants=new Map;linearSampler;residueFx;fieldFx;sheetDraw;coresDraw;strataDraw;paramsBufs=[];massBuf;distBuf;coupBuf;strataBuf;plinthBuf;params=new Float32Array(36);massArr=new Float32Array(d0*3*4);distArr=new Float32Array(h0*3*4);coupArr=new Float32Array(p0*4);strataArr=new Float32Array(E0*4);plinthArr=new Float32Array(m0*3*4);rect={x0:0,y0:0,x1:0,y1:0};landscape={time:0,masses:[],disturbances:[],plinths:[],couplings:[],strata:[]};massIndex=new Map;runtime=new Map;plinthRuntime=new Map;plinthStatics=new Map;frameSubscribers=new Set;generation=0;lastInstances=0;strataCount=0;disturbanceCount=0;couplingCount=0;massCount=0;plinthCount=0;raf=0;refreshCount=0;lastStride=1;lastDrawnAt=0;nextDrawAt=0;dirty=!0;running=!1;lastFrameAt=0;simTime=0;lastInteractionAt=0;disposed=!1;landscapeDirty=!0;perf=new BA;camera;canvas;headless;maxDpr;initGpu;view={width:1,height:1};constructor(i){if(this.canvas=i.canvas??null,this.headless=i.headless??null,this.camera=i.camera,this.maxDpr=i.maxDpr??1.25,this.initGpu=i.initGpu??(async()=>{try{return await f0({requiredFeatures:["timestamp-query"]})}catch{return await f0()}}),!this.canvas&&!this.headless)throw new Error("FieldRenderer needs either a canvas or a headless size")}async init(){this.gpu=await this.initGpu();try{const c=lA(this.gpu);this.gpuTimer=c,this.spans={residue:c.span("residue"),field:c.span("field"),sheet:c.span("sheet"),overlay:c.span("overlay")},this.layerSpans=[0,1,2].map(d=>c.span(`sheet${d}`)),c.onResults(d=>{this.perf.gpuMs=d,this.probe?.noteGpu(d)}),this.probe?.note("timestamp-query available")}catch(c){this.gpuTimer=null,this.spans=null,this.layerSpans=[],this.probe?.note(`timestamp-query unavailable: ${c instanceof Error?c.message:String(c)}`)}if(this.headless)this.output=r0(this.gpu,{size:[this.headless.width,this.headless.height],format:"rgba8unorm"});else{const c=this.canvas;await HA(c);const d=Math.min(this.maxDpr,globalThis.devicePixelRatio||1),[h,m]=this.cssSize();c.width=Math.round(h*d),c.height=Math.round(m*d),this.surf=_E(this.gpu,c,{dpr:d,autoResize:!0}),this.output=this.surf,this.view.width=h,this.view.height=m}this.residue=ZT(this.gpu,g0,g0,{format:"rgba16float"});const[i,s]=this.fieldSize();this.fieldTarget=r0(this.gpu,{size:[i,s],format:"rgba16float"}),this.paramsBufs=Array.from({length:5},()=>Ka(this.gpu,this.params.byteLength,"read")),this.massBuf=Ka(this.gpu,this.massArr.byteLength,"read"),this.distBuf=Ka(this.gpu,this.distArr.byteLength,"read"),this.coupBuf=Ka(this.gpu,this.coupArr.byteLength,"read"),this.strataBuf=Ka(this.gpu,this.strataArr.byteLength,"read"),this.plinthBuf=Ka(this.gpu,this.plinthArr.byteLength,"read");const l=QE(this.gpu,{minFilter:"linear",magFilter:"linear"});this.linearSampler=l,this.residueFx=s0(this.gpu,bA,{set:{P:this.paramsBufs[T0],massData:this.massBuf,distData:this.distBuf,coupData:this.coupBuf,prevTex:this.residue.read,prevSamp:l}}),this.fieldFx=s0(this.gpu,xA,{set:{P:this.paramsBufs[A0],massData:this.massBuf,distData:this.distBuf,coupData:this.coupBuf,residueTex:this.residue.read,residueSamp:l,plinthData:this.plinthBuf}}),this.sheetDraw=Bl(this.gpu,{shader:y0,vertices:6,blend:"premultiplied",set:{P:this.paramsBufs[ea],massData:this.massBuf,fieldTex:this.fieldTarget,fieldSamp:l}}),this.coresDraw=Bl(this.gpu,{shader:SA,vertices:6,blend:"additive",set:{P:this.paramsBufs[ea],distData:this.distBuf}}),this.strataDraw=Bl(this.gpu,{shader:wA,vertices:6,blend:"premultiplied",set:{P:this.paramsBufs[ea],massData:this.massBuf,strataData:this.strataBuf}});const o={colors:[this.output.format]};await Promise.all([this.residueFx.compile(this.residue.write),this.fieldFx.compile(this.fieldTarget),this.sheetDraw.compile(o),this.coresDraw.compile(o),this.strataDraw.compile(o)])}cssSize(){const i=this.canvas;if(!i)return[this.headless.width,this.headless.height];const s=i.parentElement,l=i.clientWidth||s?.clientWidth||1280,o=i.clientHeight||s?.clientHeight||720;return[Math.max(1,l),Math.max(1,o)]}fieldSize(){const i=this.perf.resolutionScale,s=this.headless?.width??this.canvas?.clientWidth??640,l=this.headless?.height??this.canvas?.clientHeight??480,o=Math.max(160,Math.round(Math.min(768,s)*i)),c=Math.max(120,Math.round(Math.min(576,l)*i));return[o,c]}attachProbe(i){this.probe=i}setLandscape(i){const s=this.probe?performance.now():0;this.landscape=i,this.landscapeDirty=!0,this.generation++,this.probe&&(this.probe.landscapes++,queueMicrotask(()=>this.probe?.landscapeMs.push(performance.now()-s)));const l=this.generation;for(const o of i.disturbances){let c=this.runtime.get(o.id);c||(c={energy:0,target:o.energy,status:o.status,statusSince:o.statusSince,seen:l,extent:o.extent,toExtent:o.extent},this.runtime.set(o.id,c)),c.target=o.energy,c.status=o.status,c.statusSince=o.statusSince,c.seen=l,c.toExtent=o.extent}for(const[o,c]of this.runtime)c.seen!==l&&(c.target=0,c.energy<.002&&this.runtime.delete(o));for(const o of i.plinths){let c=this.plinthRuntime.get(o.id);c||(c={presence:0,target:o.presence,x:o.x,y:o.y,extentX:o.extentX,extentY:o.extentY,toX:o.x,toY:o.y,toExtentX:o.extentX,toExtentY:o.extentY,seen:l},this.plinthRuntime.set(o.id,c)),c.target=o.presence,c.toX=o.x,c.toY=o.y,c.toExtentX=o.extentX,c.toExtentY=o.extentY,c.seen=l,this.plinthStatics.set(o.id,o)}for(const[o,c]of this.plinthRuntime)c.seen!==l&&(c.target=0,c.presence<.002&&(this.plinthRuntime.delete(o),this.plinthStatics.delete(o)))}noteInteraction(){this.lastInteractionAt=performance.now(),this.dirty=!0}onFrame(i){return this.frameSubscribers.add(i),()=>this.frameSubscribers.delete(i)}start(){if(this.running||this.disposed)return;this.running=!0,this.lastFrameAt=performance.now(),this.refreshCount=0,this.nextDrawAt=0;const i=s=>{if(!this.running)return;this.raf=requestAnimationFrame(i),this.refreshCount++;const l=this.currentStride(s);if(this.probe?.noteRefresh(s,l),l===1/0){this.perf.resetPacing(),this.lastDrawnAt=0,this.lastFrameAt=s,this.nextDrawAt=this.refreshCount+1;return}if(this.refreshCount<this.nextDrawAt)return;this.nextDrawAt=this.refreshCount+l;const o=s-this.lastFrameAt;this.lastFrameAt=s,this.lastStride=l;const c=this.probe?.debug.fixedDt??null,d=c!==null?c:Math.min(.1,o/1e3);this.renderFrame(d)};this.raf=requestAnimationFrame(i)}stop(){this.running=!1,this.raf&&cancelAnimationFrame(this.raf),this.raf=0}invalidate(){this.dirty=!0}currentStride(i){let s=0,l=0;for(const o of this.runtime.values()){o.energy>s&&(s=o.energy);const c=Math.abs(o.target-o.energy);c>l&&(l=c);const d=Math.abs(o.toExtent-o.extent);d>l&&(l=d)}for(const o of this.plinthRuntime.values()){const c=Math.abs(o.target-o.presence);c>l&&(l=c)}return VA({dirty:this.dirty||this.landscapeDirty,msSinceInteraction:i-this.lastInteractionAt,couplings:this.couplingCount,maxEnergy:s,maxSettling:l})}stepPhysics(i){const s=this.simTime;for(const l of this.runtime.values()){let o=l.target;if(l.status==="failed"){const d=Math.max(0,s-l.statusSince/1e3);d<1.4?o=l.target*(1+.45*Math.sin(d*44)):o=l.target*Math.max(0,1-(d-1.4)/2.2)*.22}const c=o>l.energy?2.6:1.1;l.energy+=(o-l.energy)*(1-Math.exp(-c*i)),l.energy<5e-4&&o===0&&(l.energy=0),l.extent+=(l.toExtent-l.extent)*(1-Math.exp(-3*i))}for(const l of this.plinthRuntime.values()){const o=l.target>l.presence?1.8:.9;l.presence+=(l.target-l.presence)*(1-Math.exp(-o*i)),l.presence<5e-4&&l.target===0&&(l.presence=0);const c=1-Math.exp(-3*i);l.x+=(l.toX-l.x)*c,l.y+=(l.toY-l.y)*c,l.extentX+=(l.toExtentX-l.extentX)*c,l.extentY+=(l.toExtentY-l.extentY)*c}}packStatics(){const{masses:i,couplings:s,strata:l}=this.landscape;this.massIndex.clear(),this.massArr.fill(0),this.massCount=Math.min(i.length,d0);for(let o=0;o<this.massCount;o++){const c=i[o];this.massIndex.set(c.id,o);const d=o*12;this.massArr[d+0]=c.x,this.massArr[d+1]=c.y,this.massArr[d+2]=c.extentX,this.massArr[d+3]=c.extentY;const h=c.extentX/300;this.massArr[d+4]=72*h,this.massArr[d+5]=27*h,this.massArr[d+6]=30*h,this.massArr[d+7]=.34+c.seed*.12,this.massArr[d+8]=c.seed*Math.PI*2;const m=w0[c.kind]??w0.laptop;this.massArr[d+9]=m[0],this.massArr[d+10]=m[1],this.massArr[d+11]=m[2]}this.massBuf.write(this.massArr),this.coupArr.fill(0),this.couplingCount=0;for(const o of s){if(this.couplingCount>=p0)break;const c=this.massIndex.get(o.fromMassId),d=this.massIndex.get(o.toMassId);if(c===void 0||d===void 0)continue;const h=this.couplingCount*4;this.coupArr[h+0]=c,this.coupArr[h+1]=d,this.coupArr[h+2]=o.energy,this.couplingCount++}this.coupBuf.write(this.coupArr),this.strataArr.fill(0),this.strataCount=Math.min(l.length,E0);for(let o=0;o<this.strataCount;o++){const c=l[o],d=o*4;this.strataArr[d+0]=c.startFraction,this.strataArr[d+1]=c.endFraction,this.strataArr[d+2]=Math.min(c.lane,this.massCount-1),this.strataArr[d+3]=S0[c.status]}this.strataBuf.write(this.strataArr)}packDisturbances(){this.distArr.fill(0);let i=0;for(const s of this.landscape.disturbances){if(i>=h0)break;const l=this.runtime.get(s.id),o=l?l.energy:s.energy;if(o<=5e-4)continue;const c=l?l.extent:s.extent,d=30+c*44,h=d*(.62+.22*c),m=i*12;this.distArr[m+0]=s.x,this.distArr[m+1]=s.y,this.distArr[m+2]=d,this.distArr[m+3]=h*o,this.distArr[m+4]=.9+s.rate*1.15,this.distArr[m+5]=s.phase,this.distArr[m+6]=S0[s.status],this.distArr[m+7]=o,this.distArr[m+8]=s.articulation,this.distArr[m+9]=s.shoulder,i++}this.disturbanceCount=i,this.distBuf.write(this.distArr)}packPlinths(){this.plinthArr.fill(0);const i=[];let s=0;for(const[l,o]of this.plinthRuntime){if(s>=m0)break;if(o.presence<=5e-4)continue;const c=this.plinthStatics.get(l);if(!c)continue;const d=s*12;this.plinthArr[d+0]=o.x,this.plinthArr[d+1]=o.y,this.plinthArr[d+2]=o.extentX,this.plinthArr[d+3]=o.extentY,this.plinthArr[d+4]=o.presence,this.plinthArr[d+5]=c.articulation,this.plinthArr[d+7]=c.empty?1:0,this.plinthArr[d+8]=c.shoulder,i.push({id:l,parentId:c.parentId}),s++}for(let l=0;l<i.length;l++){const o=i[l].parentId,c=o?i.findIndex(d=>d.id===o):-1;this.plinthArr[l*12+6]=c+1,this.plinthArr[l*12+9]=c>=0?1:0}this.plinthCount=s,this.plinthBuf.write(this.plinthArr)}packParams(i,s,l,o){const c=this.params,d=An(this.camera,this.view);c[0]=this.rect.x0,c[1]=this.rect.y0,c[2]=this.rect.x1,c[3]=this.rect.y1,c[4]=this.view.width,c[5]=this.view.height,c[6]=d,c[7]=this.simTime,c[8]=this.massCount,c[9]=this.disturbanceCount,c[10]=this.couplingCount,c[11]=s;const h=Pn[o]??Pn[0];c[12]=h.rows,c[13]=h.step,c[14]=h.amp,c[15]=h.alpha,c[16]=h.lw,c[17]=h.dz,c[18]=h.px,c[19]=1,c[20]=this.colsFor(h.step,d),c[21]=this.rowsFor(h.rows,d),c[22]=Math.max(1,this.massCount),c[23]=this.plinthCount,c[24]=h.fill[0]/255*h.fill[3],c[25]=h.fill[1]/255*h.fill[3],c[26]=h.fill[2]/255*h.fill[3],c[27]=h.fill[3],c[28]=l.x0,c[29]=l.y0,c[30]=l.x1,c[31]=l.y1;const m=i>=ea?GA[o]??0:0;c[32]=this.probe?.debug.fillReach??m,c[33]=0,c[34]=0,c[35]=0,this.paramsBufs[i].write(c)}colsFor(i,s){const l=i/s,o=this.rect.x1-this.rect.x0+l*4;return Math.max(2,Math.min(1024,Math.ceil(o/l)))}rowsFor(i,s){const l=i/s,c=Math.min(this.rect.y1,832)+90/s-(this.rect.y0-l*.6);return Math.max(2,Math.min(512,Math.ceil(c/l)))}renderOnce(i){this.renderFrame(Math.min(.25,i))}async debugField(){const i=await this.fieldTarget.readFloats();let s=1/0,l=-1/0,o=0;for(let c=0;c<i.length;c+=4){const d=i[c];Number.isNaN(d)?o++:(d<s&&(s=d),d>l&&(l=d))}return{min:s,max:l,nan:o,sample:Array.from(i.slice(0,16))}}stats(){return{runtimeEntries:this.runtime.size,disturbances:this.disturbanceCount,plinths:this.plinthCount,strata:this.strataCount,couplings:this.couplingCount,instances:this.lastInstances}}renderFrame(i){if(this.disposed)return;const s=performance.now();if(this.simTime+=i,gr(this.camera),this.headless){const[D,B]=this.output.size;this.view.width=D,this.view.height=B}else{const D=this.canvas;if(D&&(D.clientWidth===0||D.clientHeight===0)){this.perf.resetPacing(),this.lastDrawnAt=0;return}const[B,Q]=this.cssSize();if(B!==this.view.width||Q!==this.view.height){this.view.width=B,this.view.height=Q;const Z=Math.min(this.maxDpr,globalThis.devicePixelRatio||1);this.canvas.width=Math.round(B*Z),this.canvas.height=Math.round(Q*Z),this.surf?.resize([B,Q]);const[F,V]=this.fieldSize();this.fieldTarget.resize([F,V]),this.probe&&(this.probe.canvasResizes++,this.probe.note(`canvas ${B}×${Q} css → ${D?.width}×${D?.height}, field ${F}×${V}`))}}_A(this.camera,this.view,this.rect),this.stepPhysics(i),this.landscapeDirty&&(this.packStatics(),this.landscapeDirty=!1),this.packDisturbances(),this.packPlinths();const l=(this.rect.x1-this.rect.x0)*.12,o=(this.rect.y1-this.rect.y0)*.16,c={x0:this.rect.x0-l,y0:this.rect.y0-o,x1:this.rect.x1+l,y1:this.rect.y1+o},d=An(this.camera,this.view);this.packParams(T0,i,yA,0),this.packParams(A0,i,c,0);for(let D=0;D<Pn.length;D++)this.packParams(ea+D,i,c,D);const h=this.probe?this.probe.debug:null,m=h&&(h.skipFill||h.skipLine)?this.sheetVariantDraw(h):this.sheetDraw,y=this.probe?performance.now():0;let S=0;const b=[];NT(this.gpu,D=>{h?.skipResidue||(this.residueFx.set({prevTex:this.residue.read}),D.pass(this.spans?{target:this.residue.write,clear:!1,timer:this.spans.residue}:{target:this.residue.write,clear:!1},this.residueFx),S++),h?.skipField||(this.fieldFx.set({residueTex:this.residue.write}),D.pass(this.spans?{target:this.fieldTarget,clear:!0,timer:this.spans.field}:{target:this.fieldTarget,clear:!0},this.fieldFx),S++);let B=0;const Q=(F,V)=>{const K=Pn[V],Y=this.colsFor(K.step,d),A=this.rowsFor(K.rows,d),w=Y*A*2;this.probe&&b.push({cols:Y,rows:A,instances:w}),!(h&&!h.layers[V])&&(B+=w,m.set({P:this.paramsBufs[ea+V]}),F.draw(m,{instances:w}))},Z=[.024,.027,.035,1];if(h?.splitLayers&&this.layerSpans.length===Pn.length){for(let F=0;F<Pn.length;F++)D.pass(F===0?{target:this.output,clear:Z,timer:this.layerSpans[F]}:{target:this.output,clear:!1,timer:this.layerSpans[F]},V=>Q(V,F)),S++;D.pass(this.spans?{target:this.output,clear:!1,timer:this.spans.overlay}:{target:this.output,clear:!1},F=>{this.strataCount>0&&!h?.skipStrata&&F.draw(this.strataDraw,{instances:this.strataCount}),this.disturbanceCount>0&&!h?.skipCores&&F.draw(this.coresDraw,{instances:this.disturbanceCount})}),S++}else D.pass(this.spans?{target:this.output,clear:Z,timer:this.spans.sheet}:{target:this.output,clear:Z},F=>{for(let V=0;V<Pn.length;V++)Q(F,V);this.strataCount>0&&!h?.skipStrata&&F.draw(this.strataDraw,{instances:this.strataCount}),this.disturbanceCount>0&&!h?.skipCores&&F.draw(this.coresDraw,{instances:this.disturbanceCount})}),S++;this.lastInstances=B+this.strataCount+this.disturbanceCount}),this.residue.swap(),this.dirty=!1;const R=this.probe?performance.now():0;if(!h?.skipSubscribers)for(const D of this.frameSubscribers)D(this.view);const L=performance.now(),j=this.lastDrawnAt>0?s-this.lastDrawnAt:0;if(this.lastDrawnAt=s,this.perf.sample(s,L-s,this.disturbanceCount),this.probe&&(this.probe.noteFrame({interval:j,stride:this.lastStride,prep:y-s,encode:R-y,post:L-R,total:L-s}),this.captureScene(S,b)),this.perf.wantsResize()){const[D,B]=this.fieldSize(),[Q,Z]=this.fieldTarget.size;(D!==Q||B!==Z)&&(this.fieldTarget.resize([D,B]),this.probe&&(this.probe.fieldResizes++,this.probe.note(`field texture ${Q}×${Z} → ${D}×${B} (scale ${this.perf.resolutionScale.toFixed(2)})`)))}}sheetVariantDraw(i){const s=`${i.skipFill?"F":""}${i.skipLine?"L":""}`;let l=this.sheetVariants.get(s);return!l&&this.probe&&(l=Bl(this.gpu,{shader:this.probe.sheetVariant(y0,{skipFill:i.skipFill,skipLine:i.skipLine}),vertices:6,blend:"premultiplied",set:{P:this.paramsBufs[ea],massData:this.massBuf,fieldTex:this.fieldTarget,fieldSamp:this.linearSampler}}),this.sheetVariants.set(s,l),this.probe.note(`sheet variant '${s}' compiled`)),l??this.sheetDraw}captureScene(i,s){if(!this.probe)return;const l=this.view.width,o=this.view.height,c=this.canvas?.width??this.output.size[0],d=this.canvas?.height??this.output.size[1],h=An(this.camera,this.view);let m=0;for(let S=0;S<Pn.length;S++){const R=Pn[S].rows/h,L=this.rect.y0-R*.6,j=s[S]?.rows??0;for(let D=0;D<j;D++){const B=(L+D*R-this.rect.y0)*h;B<o&&(m+=(o-Math.max(0,B))/o)}}let y=0;for(const S of s)y+=S.instances;this.probe.scene={cssW:l,cssH:o,canvasW:c,canvasH:d,dpr:this.surf?.dpr??1,devicePixelRatio:globalThis.devicePixelRatio??1,resolutionScale:this.perf.resolutionScale,fieldW:this.fieldTarget.size[0],fieldH:this.fieldTarget.size[1],zoom:this.camera.zoom,masses:this.massCount,disturbances:this.disturbanceCount,plinths:this.plinthCount,couplings:this.couplingCount,strata:this.strataCount,runtimeEntries:this.runtime.size,layers:s,instances:y+this.strataCount+this.disturbanceCount,passes:i,fillOverdraw:m,fillFragments:m*c*d}}dispose(){this.stop(),this.disposed=!0,this.runtime.clear(),this.plinthRuntime.clear(),this.plinthStatics.clear(),this.massIndex.clear(),this.frameSubscribers.clear(),this.gpuTimer?.dispose(),this.gpuTimer=null,this.probe?.dispose(),this.gpu?.dispose()}}function HA(n,i=2e3){return n.clientWidth>0&&n.clientHeight>0?Promise.resolve():new Promise(s=>{let l=!1;const o=()=>{l||(l=!0,c.disconnect(),clearTimeout(d),s())},c=new ResizeObserver(()=>{n.clientWidth>0&&n.clientHeight>0&&o()});c.observe(n);const d=setTimeout(o,i)})}const q={bg:"#050608",ink:"#e6e3db",accent:"#d9a441",accentBright:"#f0c374",hoverInk:"#f5cf8b",panel:"rgba(7,8,11,0.94)",panelBorder:"rgba(230,227,219,0.4)",hairline:"rgba(230,227,219,0.14)",chrome:"rgba(230,227,219,0.62)",chromeDim:"rgba(230,227,219,0.4)",chromeMid:"rgba(230,227,219,0.7)",chromeStrong:"rgba(230,227,219,0.82)",body:"rgba(230,227,219,0.88)"},at={running:"rgba(240,195,116,0.85)",waiting:"rgba(150,175,196,0.85)",failed:"rgba(206,104,90,0.9)",completed:"rgba(180,210,175,0.75)",idle:"rgba(230,227,219,0.62)"},Et="'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, monospace",Ja="0 0 6px rgba(5,6,8,0.95)",qA={backgroundImage:"radial-gradient(rgba(230,227,219,0.05) 0.5px, rgba(0,0,0,0) 0.6px)",backgroundSize:"3px 3px"},YA={background:"radial-gradient(96% 82% at 44% 56%, rgba(0,0,0,0) 42%, rgba(3,3,5,0.9) 100%)"},XA={background:"linear-gradient(to bottom, rgba(6,8,11,0.7), rgba(6,8,11,0))"};let Ic=Promise.resolve();function KA({landscape:n,onHover:i,onSelect:s,anchor:l,children:o,onBand:c,onReady:d,depth:h,overlay:m,inset:y,keepVisible:S,compact:b=!1}){const R=P.useRef(null),L=P.useRef(null),j=P.useRef(null),D=P.useRef({...v0}),B=P.useRef(n),Q=P.useRef(new Map),Z=P.useRef(null),F=P.useRef(null),V=P.useRef(null),K=P.useRef(null),Y=P.useRef(null),A=P.useRef(new Map),w=P.useRef(null),N=P.useRef({key:"",w:0,h:0,label:!1}),[te,ne]=P.useState("init"),[le,Ge]=P.useState(null),[de,ue]=P.useState("environment"),[z,X]=P.useState([]),[ae,be]=P.useState("grab");B.current=n,P.useEffect(()=>{const ee=L.current;if(!ee)return;let W=!1,ye=null;const Ce=Ic.then(async()=>{if(!W){if(ye=new FA({canvas:ee,camera:D.current}),await ye.init(),W){ye.dispose(),ye=null;return}j.current=ye,ye.setLandscape(B.current),ye.start(),ne("ready"),d?.(ye)}}).catch(Ke=>{W||(Ge(Ke instanceof Error?Ke.message:String(Ke)),ne("failed"))});return Ic=Ce,()=>{W=!0,j.current=null,Ic=Ce.then(()=>{ye?.dispose(),ye=null})}},[]),P.useEffect(()=>{j.current?.setLandscape(n)},[n]),P.useEffect(()=>{const ee=[];for(const W of n.masses)ee.push({id:`mass:${W.id}`,wx:W.x,wy:W.y+W.extentY+26,text:W.name,color:"rgba(230,227,219,0.78)",size:10});if(de==="proximity"){for(const W of n.disturbances)W.energy<.02&&W.status!=="completed"||ee.push({id:`dist:${W.id}`,wx:W.x,wy:W.y-30-W.extent*40,text:`${W.label} · ${W.status}`,color:at[W.status],size:9});for(const W of n.plinths)ee.push({id:`plinth:${W.id}`,wx:W.x,wy:W.y-W.extentY-16,text:`${W.parentId?"└ ":""}${W.label}${W.observers>1?` · ${W.observers} obs`:""}`,color:`rgba(240,195,116,${(.16+.5*W.articulation).toFixed(2)})`,size:9})}X(ee)},[n,de]),P.useLayoutEffect(()=>{const ee=j.current;if(!ee)return;let W=0;const ye=Ce=>{const Ke=D.current,Qe=performance.now(),Qt=W===0?1/60:Math.min(.1,(Qe-W)/1e3);W=Qe,K.current&&(UA(Ke,K.current,Qt)&&(K.current=null),ee.noteInteraction());const Ve=OA(De.current,Ke.zoom);Ve!==De.current&&(De.current=Ve,ue(Ve),c?.(Ve));for(const[Tt,ft]of Q.current){const Ye=k.current.get(Tt);if(!Ye)continue;const[St,tt]=Gc(Ye.wx,Ye.wy,Ke,Ce),Ui=St>-200&&St<Ce.width+200&&tt>-80&&tt<Ce.height+80;ft.style.visibility=Ui?"visible":"hidden",ft.style.transform=`translate3d(${St}px, ${tt}px, 0) translate(-50%, -100%)`}const dn=Z.current,xt=T.current;if(dn&&xt){const[Tt,ft]=Gc(xt.x,xt.y,Ke,Ce),Ye=dn.firstElementChild;Ye&&N.current.key!==xt.id&&(N.current={key:xt.id,w:Ye.offsetWidth,h:Ye.offsetHeight,label:Ye.dataset.anchorPlacement==="label"});const{w:St,h:tt,label:Ui}=N.current;let Ni=Ui?-St/2:18,us=Ui?-tt-14:-tt/2;!Ui&&Tt+Ni+St>Ce.width-12&&(Ni=-St-18),Ni=Math.max(12-Tt,Ni),us=Math.min(Math.max(12-ft,us),Ce.height-12-tt-ft),dn.style.transform=`translate3d(${Tt+Ni}px, ${ft+us}px, 0)`,dn.style.visibility=Tt>-300&&Tt<Ce.width+300&&ft>-300&&ft<Ce.height+300?"visible":"hidden"}const Lt=Ke.cy+Ce.height/An(Ke,Ce)/2,Rn=Lt>En.strataTop+40,ua=Lt>En.strataTop+En.strataHeight*.7,Dn=F.current,_i=Dn?.querySelector("[data-depth-label]");if(_i){const Tt=Rn?ua?"FIELD — TODAY":"FIELD — SURFACE + TODAY":"FIELD — LIVE";_i.textContent!==Tt&&(_i.textContent=Tt)}if(Dn){const Tt=Dn.querySelector("[data-depth-summary]"),ft=Dn.querySelector("[data-depth-deep]");if(Tt&&(Tt.style.display=Rn?"inline-flex":"none"),ft){const Ye=ft.dataset.depthSuppressed==="true";ft.style.display=ua&&!Ye?"block":"none"}}};return ee.onFrame(ye)},[te,c]);const De=P.useRef("environment"),T=P.useRef(null),k=P.useRef(new Map);T.current=l,P.useEffect(()=>{k.current=new Map(z.map(ee=>[ee.id,ee]))},[z]);const H=P.useCallback(()=>{const ee=R.current;return{width:ee?.clientWidth??1,height:ee?.clientHeight??1}},[]),J=y?.right??0,oe=y?.bottom??0,he=S?.id??null,me=S?.x??0,$e=S?.y??0;P.useEffect(()=>{const ee=j.current;if(!ee||!he||J===0&&oe===0)return;const W=H(),ye={...K.current??D.current},Ce=An(ye,W);if(Ce<=0)return;const[Ke,Qe]=Gc(me,$e,ye,W);let Qt=!1;if(J>0){const Ve=W.width-J-40;Ke>Ve&&(ye.cx+=(Ke-(W.width-J)/2)/Ce,Qt=!0)}if(oe>0){const Ve=W.height-oe-40;Qe>Ve&&(ye.cy+=(Qe-(Ve-60))/Ce,Qt=!0)}Qe<70&&(ye.cy-=(110-Qe)/Ce,Qt=!0),Qt&&(K.current=gr(ye),ee.noteInteraction())},[he,me,$e,J,oe,H]);const Re=P.useCallback(ee=>{const W=R.current.getBoundingClientRect();return[ee.clientX-W.left,ee.clientY-W.top]},[]),fn=P.useCallback(ee=>{const W=j.current;if(!W)return;const[ye,Ce]=Re(ee);K.current=null,ee.ctrlKey||ee.metaKey?$c(D.current,Math.exp(-ee.deltaY*.012),ye,Ce,H()):b0(D.current,ee.deltaX,ee.deltaY,H()),W.noteInteraction()},[Re,H]);P.useEffect(()=>{const ee=R.current;if(!ee)return;const W=ye=>ye.preventDefault();return ee.addEventListener("wheel",W,{passive:!1}),()=>ee.removeEventListener("wheel",W)},[]);const Mn=P.useCallback(ee=>{const W=Re(ee);ee.isPrimary&&A.current.clear(),A.current.set(ee.pointerId,W),K.current=null;try{R.current?.setPointerCapture(ee.pointerId)}catch{}if(A.current.size===1)V.current={x:W[0],y:W[1],moved:!1},be("grabbing");else if(A.current.size===2){const[ye,Ce]=[...A.current.values()];w.current={distance:Math.hypot(ye[0]-Ce[0],ye[1]-Ce[1]),zoom:D.current.zoom},V.current=null}j.current?.noteInteraction()},[Re]),zi=P.useCallback(ee=>{const W=j.current;if(!W)return;const ye=Re(ee),Ce=A.current.has(ee.pointerId);Ce&&A.current.set(ee.pointerId,ye);const Ke=w.current;if(Ke&&A.current.size>=2){const[xt,Lt]=[...A.current.values()],Rn=Math.hypot(xt[0]-Lt[0],xt[1]-Lt[1]),ua=(xt[0]+Lt[0])/2,Dn=(xt[1]+Lt[1])/2,_i=Ke.zoom*(Rn/Math.max(12,Ke.distance));$c(D.current,_i/D.current.zoom,ua,Dn,H()),W.noteInteraction();return}const Qe=V.current;if(Ce&&Qe){const xt=ye[0]-Qe.x,Lt=ye[1]-Qe.y;(Math.abs(xt)>4||Math.abs(Lt)>4)&&(Qe.moved=!0),b0(D.current,-xt,-Lt,H()),Qe.x=ye[0],Qe.y=ye[1],W.noteInteraction();return}if(ee.pointerType==="touch")return;const[Qt,Ve]=cf(ye[0],ye[1],D.current,H()),dn=Xm(B.current,Qt,Ve);be(dn?"pointer":"grab"),(dn||Y.current)&&W.noteInteraction(),Y.current=dn,i(dn)},[Re,i,H]),Mt=P.useCallback(ee=>{const W=A.current.get(ee.pointerId)??Re(ee);A.current.delete(ee.pointerId),A.current.size<2&&(w.current=null);const ye=V.current;if(V.current=null,be("grab"),!ye||ye.moved)return;const[Ce,Ke]=cf(W[0],W[1],D.current,H()),Qe=Xm(B.current,Ce,Ke);if(s(Qe),Qe&&Qe.kind!=="stratum"){const Qt=Qe.kind==="mass"?uf:uf+.5;K.current=NA(Qe.x,Qe.y,Math.max(D.current.zoom,Qt))}j.current?.noteInteraction()},[Re,s,H]),kt=P.useCallback(()=>{V.current=null,w.current=null,A.current.clear(),be("grab")},[]),Ee=P.useCallback(()=>{K.current={...v0},j.current?.noteInteraction(),s(null)},[s]),Kt=P.useCallback(ee=>{const W=H();$c(D.current,ee,W.width/2,W.height/2,W),j.current?.noteInteraction()},[H]);return v.jsxs("div",{style:{position:"relative",flex:1,minHeight:0},children:[v.jsxs("div",{ref:R,onWheel:fn,onPointerDown:Mn,onPointerMove:zi,onPointerUp:Mt,onPointerCancel:Mt,onLostPointerCapture:ee=>{A.current.delete(ee.pointerId),A.current.size<2&&(w.current=null)},onPointerLeave:ee=>{ee.pointerType!=="touch"&&(kt(),i(null))},style:{position:"absolute",inset:0,overflow:"hidden",background:q.bg,cursor:ae},children:[v.jsx("canvas",{ref:L,style:{display:"block",width:"100%",height:"100%"}}),v.jsx("div",{style:{position:"absolute",inset:0,pointerEvents:"none",...qA}}),v.jsx("div",{style:{position:"absolute",inset:0,pointerEvents:"none",...YA}}),v.jsx("div",{style:{position:"absolute",left:0,right:0,top:0,height:"16%",pointerEvents:"none",...XA}}),v.jsxs("div",{style:{position:"absolute",inset:0,pointerEvents:"none"},children:[z.map(ee=>v.jsx("div",{ref:W=>{W?Q.current.set(ee.id,W):Q.current.delete(ee.id)},style:{position:"absolute",left:0,top:0,willChange:"transform",visibility:"hidden",fontFamily:Et,fontSize:ee.size,letterSpacing:"0.22em",color:ee.color,whiteSpace:"nowrap",textTransform:"uppercase"},children:ee.text},ee.id)),l&&v.jsx("div",{ref:Z,style:{position:"absolute",left:0,top:0,willChange:"transform",visibility:"hidden",pointerEvents:"auto"},children:o})]}),m&&v.jsx("div",{style:{position:"absolute",inset:0,pointerEvents:"none"},children:m}),h&&v.jsx("div",{ref:F,style:{position:"absolute",inset:0,pointerEvents:"none"},children:h}),te==="failed"&&v.jsx("div",{style:{position:"absolute",inset:0,display:"grid",placeItems:"center",fontFamily:Et,fontSize:11,letterSpacing:"0.18em",color:at.failed,textAlign:"center",padding:40},children:v.jsxs("div",{children:[v.jsx("div",{children:"FIELD UNAVAILABLE — WEBGPU DID NOT START"}),v.jsx("div",{style:{marginTop:10,color:q.chrome,letterSpacing:"0.08em"},children:le})]})})]}),v.jsx(QA,{onSurface:Ee,onZoom:Kt,compact:b})]})}function QA({onSurface:n,onZoom:i,compact:s}){if(s)return v.jsx("div",{style:{position:"absolute",right:14,bottom:18},children:v.jsx("button",{onClick:n,style:{width:52,height:52,borderRadius:"50%",background:"rgba(7,8,11,0.9)",border:"1px solid rgba(230,227,219,0.5)",color:q.ink,fontFamily:Et,fontSize:8.5,letterSpacing:"0.1em",cursor:"pointer"},children:"SURF"})});const l={background:"transparent",border:`1px solid ${q.chromeDim}`,color:q.chromeStrong,fontFamily:Et,fontSize:10,letterSpacing:"0.14em",padding:"7px 12px",cursor:"pointer"};return v.jsxs("div",{style:{position:"absolute",right:16,bottom:16,display:"flex",gap:8},children:[v.jsx("button",{style:l,onClick:()=>i(1.35),"aria-label":"Zoom in",children:"+"}),v.jsx("button",{style:l,onClick:()=>i(1/1.35),"aria-label":"Zoom out",children:"−"}),v.jsx("button",{style:l,onClick:n,children:"SURFACE"})]})}function PA(n){if(n.medianTokens===void 0)return n.tokenRuns>0?{text:"no complete runs in this window for a median",title:"Token accounting is present. The median requires ended runs with both bounds inside this window; open and boundary-crossing runs are excluded.",absent:!0}:{text:"no token accounting",title:"No run in this group reports token accounting, so there is no figure — not a figure of zero.",absent:!0};if(n.medianRuns===1)return{text:`single run ${ct(n.medianTokens)}`,title:"One ended run fully inside this window reports accounting, so this is its figure, not a median. Open and boundary-crossing runs are excluded.",absent:!1};const i=n.medianRuns===n.runs?`${n.runs}`:`${n.medianRuns} of ${n.runs}`;return{text:`median ${ct(n.medianTokens)} over ${i} runs`,title:`Median billed tokens per complete run, over the runs in this group fully inside this window that have ended and whose source reports token accounting — ${n.medianRuns} of ${n.runs} here. Runs still in flight are excluded: their totals are partial. Boundary-crossing runs are excluded. Runs whose source persists no accounting are excluded: absence is not zero. Same window as the rest of TODAY.`,absent:!1}}function ZA(n,i,s){if(s&&s.reported===0)return ff("WAITING ON YOU","—",void 0,{note:"not reported by sources in this window"});const l=i.count>0?`${i.count} ${i.count===1?"block":"blocks"} · longest ${Ze(i.longestMs)}`:void 0,o=s&&s.reported<s.runs?`from the ${s.reported} of ${s.runs} runs whose sources report waits`:void 0;return ff("WAITING ON YOU",Ze(n.value),n,{tone:n.value>0?"waiting":void 0,note:[l,o].filter(Boolean).join(" · ")||void 0})}function ff(n,i,s,l={}){const o=s?.basis==="inferred";return{key:n,value:i,inferred:o,assumption:o?s?.assumption:void 0,...l}}function Vc(n,i,s,l,o){return ff(n,s>0?ct(i.value):"—",i,{note:s===0?"not reported in this window":[o,s<l?`reported for ${s} of ${l} runs`:void 0].filter(Boolean).join(" · ")||void 0})}const C0="(no model)";function gn({name:n,value:i,measure:s,accent:l,note:o}){const c=s?.basis==="inferred";return v.jsxs("div",{title:c?s?.assumption:void 0,style:{display:"flex",flexDirection:"column",gap:5,padding:"12px 0",borderTop:`1px solid ${q.hairline}`,cursor:c?"help":"default"},children:[v.jsxs("div",{style:{fontSize:9.5,letterSpacing:"0.22em",color:q.chrome,display:"flex",alignItems:"baseline",gap:6},children:[n,c&&v.jsx("span",{style:{color:q.chromeDim,letterSpacing:"0.1em"},children:"inferred"})]}),v.jsx("div",{style:{fontSize:21,letterSpacing:"0.02em",color:l??q.ink,fontVariantNumeric:"tabular-nums"},children:i}),o&&v.jsx("div",{style:{fontSize:9.5,color:q.chromeDim},children:o})]})}function ta({title:n,children:i}){return v.jsxs("div",{style:{marginTop:40},children:[v.jsx("div",{style:{fontSize:9.5,letterSpacing:"0.24em",color:q.chrome},children:n}),v.jsx("div",{style:{marginTop:12},children:i})]})}function tv({fraction:n,color:i}){return v.jsx("div",{style:{height:3,background:"rgba(230,227,219,0.08)",width:"100%"},children:v.jsx("div",{style:{height:"100%",width:`${Math.max(.5,Math.min(1,n)*100)}%`,background:i}})})}function Fc({rows:n,max:i,label:s,color:l,median:o=!1}){return v.jsx("div",{style:{display:"flex",flexDirection:"column",gap:10},children:n.map(c=>v.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:5},children:[v.jsxs("div",{style:{display:"flex",justifyContent:"space-between",gap:16,fontSize:11,fontVariantNumeric:"tabular-nums"},children:[v.jsx("span",{style:{color:q.body},children:s(c.key)}),v.jsxs("span",{style:{color:q.chromeMid},children:[c.runs," ",c.runs===1?"run":"runs",c.tokenRuns>0?` · ${ct(c.tokens)} tok`:""," · ",Ze(c.computeMs),c.failed>0&&v.jsxs("span",{style:{color:at.failed},children:[" · ",c.failed," failed"]})]})]}),v.jsx(tv,{fraction:i>0?c.computeMs/i:0,color:l}),o&&(()=>{const d=PA(c);return v.jsx("div",{title:d.title,style:{fontSize:9.5,letterSpacing:"0.06em",color:d.absent?q.chromeDim:q.chrome,cursor:"help",fontVariantNumeric:"tabular-nums"},children:d.text})})()]},c.key))})}function WA({world:n,waitEvidence:i}){const s=P.useMemo(()=>I0(n),[n]),l=P.useMemo(()=>F0(n,s),[n,s]),o=P.useMemo(()=>qx(n),[n]),c=P.useMemo(()=>Yx(n),[n]),d=ZA(s.waitingOnYou,c,i),h=P.useMemo(()=>Xx(n),[n]),m=P.useMemo(()=>Kx(n),[n]),y=P.useMemo(()=>Oc(n,(Y,A)=>A?.context),[n]),S=P.useMemo(()=>Oc(n,Y=>Y.model??C0),[n]),b=P.useMemo(()=>Oc(n,Y=>Y.machineId),[n]),R=P.useMemo(()=>[...n.executions.values()].filter(Y=>Y.status==="failed").sort((Y,A)=>A.startedAt-Y.startedAt),[n]),L=s.longestContextSpan.value,j=Vc("REQUESTS",s.requests,s.accounting.requests,s.executions.value),D=Vc("TOKENS",s.tokens,s.accounting.tokens,s.executions.value,`${zc(o.cacheRead,o.total)} cache reads`),B=Vc("TOOL CALLS",s.toolCalls,s.accounting.tools,s.executions.value,h.toolErrors>0?`${h.toolErrors} tool errors`:void 0),Q=y[0]?.computeMs??0,Z=S[0]?.computeMs??0,F=b[0]?.computeMs??0,V=m.reduce((Y,A)=>A.computeMs>Y.computeMs?A:Y,m[0]),K=[...n.executions.values()].filter(Y=>Y.depth>0).length;return v.jsxs("div",{style:{flex:1,overflowY:"auto",padding:"28px 48px 80px",fontFamily:Et,color:q.ink},children:[v.jsxs("div",{style:{marginBottom:34,maxWidth:900},children:[v.jsx("div",{style:{fontSize:9.5,letterSpacing:"0.24em",color:q.chrome},children:"WORK SHAPE"}),v.jsx("div",{style:{fontSize:34,letterSpacing:"0.08em",marginTop:10,color:q.accentBright},children:l.headline}),v.jsx("div",{style:{marginTop:14,display:"flex",flexDirection:"column",gap:7},children:l.clauses.map(Y=>v.jsx("div",{style:{fontSize:12,lineHeight:1.65,color:q.body,letterSpacing:"0.02em"},children:Y},Y))})]}),v.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(190px, 1fr))",gap:"0 40px"},children:[v.jsx(gn,{name:"REQUESTS",value:j.value,measure:s.requests,note:j.note}),v.jsx(gn,{name:"RUNS",value:String(s.executions.value),measure:s.executions,note:K>0?`${K} of them sub-agents`:void 0}),v.jsx(gn,{name:"SESSIONS",value:String(s.sessions.value),measure:s.sessions}),v.jsx(gn,{name:"TOKENS",value:D.value,measure:s.tokens,note:D.note}),v.jsx(gn,{name:"TOOL CALLS",value:B.value,measure:s.toolCalls,note:B.note}),v.jsx(gn,{name:"TIME IN FLIGHT",value:Ze(s.timeInFlight.value),measure:s.timeInFlight}),v.jsx(gn,{name:"PEAK CONCURRENCY",value:s.peakConcurrency.value>0?`${s.peakConcurrency.value} · ${ts(s.peakConcurrencyAt.value)}`:"0",measure:s.peakConcurrency}),v.jsx(gn,{name:"CONTEXT CHANGES",value:String(s.contextSwitches.value),measure:s.contextSwitches,note:`sequential only · known contexts: ${y.filter(Y=>Y.key.length>0).length}`}),v.jsx(gn,{name:"LONGEST CONTEXT SPAN",value:L?Ze(L.end-L.start):"—",measure:s.longestContextSpan,note:L?`${cr(L.context)} · ${ts(L.start)}–${ts(L.end)}`:void 0}),v.jsx(gn,{name:d.key,value:d.value,measure:d.value==="—"?void 0:s.waitingOnYou,accent:d.tone==="waiting"?at.waiting:void 0,note:d.note}),v.jsx(gn,{name:"FAILED",value:String(h.failed),accent:h.failed>0?at.failed:void 0,note:h.interrupted>0||h.retries>0?`${h.interrupted} stopped · ${h.retries} retries`:void 0})]}),m.length>0&&v.jsxs(ta,{title:"HOUR BY HOUR",children:[v.jsx("div",{style:{display:"flex",alignItems:"flex-end",gap:3,height:84},children:m.map((Y,A)=>{const w=Y.computeMs/36e5;return v.jsx("div",{title:`${String(Y.hour).padStart(2,"0")}:00 — ${Ze(Y.computeMs)} in flight, ${Y.runs} runs, peak ${Y.peak}`,style:{flex:1,minWidth:4,height:"100%",display:"flex",flexDirection:"column",justifyContent:"flex-end"},children:v.jsx("div",{style:{height:`${Math.max(1,w*100)}%`,background:Y.peak>1?"rgba(240,195,116,0.75)":"rgba(214,176,116,0.38)"}})},A)})}),v.jsxs("div",{style:{display:"flex",justifyContent:"space-between",marginTop:6,fontSize:9,letterSpacing:"0.16em",color:q.chromeDim},children:[v.jsxs("span",{children:[String(m[0].hour).padStart(2,"0"),":00"]}),v.jsxs("span",{children:["busiest ",String(V.hour).padStart(2,"0"),":00 · ",Ze(V.computeMs)," ","of that hour"]}),v.jsxs("span",{children:[String(m[m.length-1].hour).padStart(2,"0"),":00"]})]})]}),v.jsx(ta,{title:"WHERE THE TIME WENT",children:v.jsx(Fc,{rows:y,max:Q,label:cr,color:"rgba(240,195,116,0.6)"})}),b.length>0&&v.jsx(ta,{title:"BY MACHINE",children:v.jsx(Fc,{rows:b,max:F,label:Y=>n.machines.get(Y)?.name??Y,color:"rgba(168,186,150,0.6)"})}),S.length>0&&v.jsx(ta,{title:"BY MODEL",children:v.jsx(Fc,{rows:S,max:Z,label:Y=>Y===C0?"model not observed":Y,color:"rgba(150,175,196,0.6)",median:!0})}),v.jsxs(ta,{title:"TOKEN COMPOSITION",children:[v.jsx("div",{style:{display:"flex",flexDirection:"column",gap:10},children:s.accounting.tokens>0&&[["CACHE READS",o.cacheRead,"rgba(150,175,196,0.6)"],["INPUT",o.input,"rgba(240,195,116,0.6)"],["OUTPUT",o.output,"rgba(180,210,175,0.7)"]].map(([Y,A,w])=>v.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:5},children:[v.jsxs("div",{style:{display:"flex",justifyContent:"space-between",fontSize:11,fontVariantNumeric:"tabular-nums"},children:[v.jsx("span",{style:{color:q.body},children:Y}),v.jsxs("span",{style:{color:q.chromeMid},children:[ct(A)," · ",zc(A,o.total)]})]}),v.jsx(tv,{fraction:A/Math.max(1,o.total),color:w})]},Y))}),o.reasoning>0&&v.jsxs("div",{style:{marginTop:16,fontSize:11,color:q.body},children:["Of output: ",ct(o.reasoning)," reasoning tokens · ",zc(o.reasoning,o.output)," of output. Reasoning is included in output, never added to the total again."]}),v.jsx("div",{style:{marginTop:12,fontSize:10,lineHeight:1.7,color:q.chromeDim},children:s.accounting.tokens===0?"Token accounting is not reported in this window.":"Input, output and cache reads form the total. Cache reads count replayed context, not newly generated output."})]}),R.length>0&&v.jsx(ta,{title:"FAILURES",children:v.jsx("div",{style:{display:"flex",flexDirection:"column",gap:9},children:R.slice(0,12).map(Y=>v.jsxs("div",{style:{display:"flex",gap:16,fontSize:11,borderTop:`1px solid ${q.hairline}`,paddingTop:8},children:[v.jsx("span",{style:{color:q.chromeMid,minWidth:46},children:ts(Y.startedAt)}),v.jsx("span",{style:{color:q.body,minWidth:160},children:Y.label}),v.jsxs("span",{style:{color:at.failed},children:[Y.failure?.code,": ",Y.failure?.message]})]},Y.id))})}),v.jsx(JA,{})]})}function JA(){return v.jsx(ta,{title:"NOT AVAILABLE FROM THESE SOURCES",children:v.jsxs("div",{style:{maxWidth:760,fontSize:10.5,lineHeight:1.8,color:q.chromeDim},children:[v.jsx("div",{children:"COST — every source here reports tokens or CPU time; none reports money. Converting one to the other needs a price table 057 does not have, so no cost figure is shown anywhere."}),v.jsx("div",{style:{marginTop:8},children:"TOKENS, FROM SOME SOURCES — Cursor persists no usage and 0x2F records none; their runs read NOT OBSERVED rather than 0, and the token totals sum only the runs that report."}),v.jsx("div",{style:{marginTop:8},children:"CLAUDE IN A BROWSER — Claude on claude.ai (chat, Claude Design, cloud Claude Code sessions) runs on Anthropic's servers and writes nothing to this Mac. Only Claude Code sessions that run here (a terminal, an editor, the desktop app's Code tab) leave the files 057 reads; the browser is seen as a process, never as work."}),v.jsx("div",{style:{marginTop:8},children:"MACHINE-TO-MACHINE TRANSFER — every observed source is single-host. Transfers are modelled and the field renders them, but no real adapter emits one; only the synthetic source does."}),v.jsx("div",{style:{marginTop:8},children:"PROCESS EXITS — the OS collector samples; an exit is inferred from disappearance between samples, never witnessed."}),v.jsx("div",{style:{marginTop:8},children:"OUTCOME QUALITY — the log records that a run completed, not whether the work was any good."})]})})}function eM(n,i,s){return n===void 0?i===void 0?0:1:i===void 0?-1:s==="asc"?n-i:i-n}const Hc=100,O0="58px minmax(180px,1.4fr) 104px 132px 84px 68px 76px 70px 56px",z0=4,tM=8,nv="rgba(230,227,219,0.09)",_0="rgba(230,227,219,0.55)",U0="rgba(230,227,219,0.22)",nM="Billed token volume. The rule beneath each figure places that volume on a fixed logarithmic scale from 10k to 100M; the ticks mark 100k, 1M and 10M. The scale never changes with filtering, sorting or the time window, so two runs are always comparable. A full rule with an end stop is 100M or more. An empty track is a total this source counted and found to be zero. No track at all means it reports no token accounting — which is not zero.";function iM(n){const i=(Math.log10(Math.max(n,1))-z0)/(tM-z0),s=Math.max(0,Math.min(1,i))*100;return{width:n>0?`max(2px, ${s.toFixed(1)}%)`:"0",over:i>1}}function aM({tokens:n}){const{width:i,over:s}=iM(n);return v.jsxs("div",{style:{marginTop:3,height:1,background:nv,position:"relative"},children:[v.jsx("div",{style:{height:1,width:i,background:_0}}),s&&v.jsx("div",{style:{position:"absolute",right:0,top:-2,width:1,height:5,background:_0}})]})}function sM(){return v.jsxs("div",{style:{marginTop:3,height:3,position:"relative"},children:[v.jsx("div",{style:{position:"absolute",left:0,right:0,top:1,height:1,background:nv}}),[0,25,50,75].map(n=>v.jsx("div",{style:{position:"absolute",left:`${n}%`,top:0,width:1,height:3,background:U0}},n)),v.jsx("div",{style:{position:"absolute",right:0,top:0,width:1,height:3,background:U0}})]})}function rM(n){return n.outcome==="interrupted"?"STOPPED":n.status}function lM(n){return n.outcome==="interrupted"?q.chromeMid:at[n.status]}function Ai({children:n,align:i="left",color:s}){return v.jsx("div",{style:{textAlign:i,color:s??q.chromeMid,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:n})}function oM({p:n,session:i,now:s,onShowInField:l}){const o=vn(n.measures),c=n.startBasis==="inferred"||n.endBasis==="inferred",d=[["CONTEXT",i?i.context:"—"],["PROVIDER",n.executor],["MODEL",n.model??"not observed"],["STARTED",`${n.startBasis==="inferred"?"~":""}${new Date(n.startedAt).toLocaleTimeString()}`],["ENDED",n.endedAt?`${n.endBasis==="inferred"?"~":""}${new Date(n.endedAt).toLocaleTimeString()}`:"still open"],...o===void 0?[["TOKENS","not observed"]]:[["INPUT",ct(es(n.measures).input)],["OUTPUT",ct(es(n.measures).output)],["CACHE READ",ct(es(n.measures).cacheRead)],["REASONING",ct(es(n.measures).reasoning)]],["REQUESTS",String(hf(n))],["TOOL CALLS",ns(on(n),"not observed")]];return sa(n)>0&&d.push(["TOOL ERRORS",String(sa(n)),at.failed]),Kc(n)>0&&d.push(["PROVIDER RETRIES",String(Kc(n)),at.waiting]),(n.waits.length>0||n.waitingMs>0||n.waitingSince!==void 0)&&d.push(["BLOCKED ON YOU",`${Ze(Ri(n,s))}${n.waitingSince===void 0?"":" · still waiting"}`,at.waiting]),n.depth>0&&d.push(["SUB-AGENT",`depth ${n.depth}`]),v.jsxs("div",{style:{gridColumn:"1 / -1",display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(180px, 1fr))",gap:"6px 28px",padding:"12px 0 14px 16px",borderLeft:`1px solid ${q.panelBorder}`,margin:"2px 0 6px",background:"rgba(230,227,219,0.02)"},children:[d.map(([h,m,y])=>v.jsxs("div",{style:{display:"flex",justifyContent:"space-between",gap:12},children:[v.jsx("span",{style:{fontSize:9.5,letterSpacing:"0.16em",color:q.chrome},children:h}),v.jsx("span",{style:{fontSize:10.5,color:y??q.body,fontVariantNumeric:"tabular-nums",overflow:"hidden",textOverflow:"ellipsis"},children:m})]},h)),n.failure&&v.jsxs("div",{style:{gridColumn:"1 / -1",fontSize:10.5,color:at.failed},children:[n.failure.code,": ",n.failure.message]}),c&&n.boundsAssumption&&v.jsxs("div",{style:{gridColumn:"1 / -1",fontSize:9.5,color:q.chromeMid},children:["timing inferred — ",n.boundsAssumption]}),v.jsx("div",{style:{gridColumn:"1 / -1",marginTop:4},children:v.jsx("button",{onClick:h=>{h.stopPropagation(),l()},style:{background:"transparent",border:`1px solid ${q.hairline}`,color:q.chromeMid,fontFamily:Et,fontSize:9,letterSpacing:"0.16em",padding:"5px 10px",cursor:"pointer"},children:"SHOW IN FIELD →"})})]})}function uM({world:n,selectedId:i,onSelect:s}){const[l,o]=P.useState("all"),[c,d]=P.useState("time"),[h,m]=P.useState(Hc),[y,S]=P.useState(null),b=P.useMemo(()=>{let B=[...n.executions.values()];l==="stopped"?B=B.filter(F=>F.outcome==="interrupted"):l!=="all"&&(B=B.filter(F=>F.status===l&&F.outcome!=="interrupted"));const Q=F=>{const V=aa(F,n.now,n.dayStart);return V.end-V.start},Z={time:(F,V)=>V.startedAt-F.startedAt,duration:(F,V)=>Q(V)-Q(F),tokens:(F,V)=>eM(vn(F.measures),vn(V.measures),"desc"),tools:(F,V)=>(on(V)??0)-(on(F)??0),waited:(F,V)=>Ri(V,n.now)-Ri(F,n.now)};return B.sort(Z[c])},[n,l,c]),R=P.useMemo(()=>{const B={all:n.executions.size,stopped:0};for(const Q of n.executions.values())Q.outcome==="interrupted"?B.stopped++:B[Q.status]=(B[Q.status]??0)+1;return B},[n]),L=P.useMemo(()=>{let B=0,Q=0,Z=0,F=0,V=0,K=0;for(const Y of b){const A=vn(Y.measures),w=on(Y);A!==void 0&&(B+=A,V++),w!==void 0&&(Z+=w,K++);const N=aa(Y,n.now,n.dayStart);Q+=N.end-N.start,F+=Ri(Y,n.now)}return{tokens:B,compute:Q,tools:Z,waited:F,tokenRuns:V,toolRuns:K}},[b,n]),j=b.slice(0,h),D=(B,Q,Z="left")=>v.jsxs("div",{onClick:()=>d(B),style:{textAlign:Z,cursor:"pointer",color:c===B?q.ink:q.chrome},children:[Q,c===B?" ↓":""]});return v.jsxs("div",{style:{flex:1,overflowY:"auto",padding:"24px 48px 80px",fontFamily:Et,color:q.ink},children:[v.jsx("div",{style:{display:"flex",gap:10,flexWrap:"wrap",marginBottom:14},children:["all","running","waiting","idle","completed","failed","stopped"].map(B=>{const Q=l===B,Z=R[B]??0;return v.jsxs("button",{onClick:()=>{o(B),m(Hc)},style:{background:"transparent",border:`1px solid ${Q?"rgba(230,227,219,0.6)":q.hairline}`,color:Q?q.ink:q.chromeMid,fontFamily:Et,fontSize:9.5,letterSpacing:"0.16em",padding:"6px 11px",cursor:"pointer",textTransform:"uppercase"},children:[B," ",Z>0&&v.jsx("span",{style:{color:q.chromeDim},children:Z})]},B)})}),v.jsxs("div",{style:{fontSize:10,letterSpacing:"0.12em",color:q.chromeDim,marginBottom:14,fontVariantNumeric:"tabular-nums"},children:[b.length," ",b.length===1?"run":"runs"," shown · ",L.tokenRuns?`${ct(L.tokens)} tok (${L.tokenRuns}/${b.length} reported)`:"tokens not reported"," ·"," ",Ze(L.compute)," summed run intervals in period · ",L.toolRuns?`${ct(L.tools)} tool calls (${L.toolRuns}/${b.length} reported)`:"tools not reported",L.waited>0&&` · ${Ze(L.waited)} blocked on you`]}),v.jsxs("div",{style:{display:"grid",gridTemplateColumns:O0,gap:"0 14px",fontSize:9,letterSpacing:"0.18em",color:q.chrome,paddingBottom:8,borderBottom:`1px solid ${q.hairline}`,alignItems:"end"},children:[D("time","START"),v.jsx("div",{children:"RUN"}),v.jsx("div",{children:"CONTEXT"}),v.jsx("div",{children:"MODEL"}),v.jsx("div",{children:"STATUS"}),D("duration","IN PERIOD","right"),v.jsxs("div",{onClick:()=>d("tokens"),title:nM,style:{cursor:"help"},children:[v.jsxs("div",{style:{textAlign:"right",color:c==="tokens"?q.ink:q.chrome},children:["TOKENS",c==="tokens"?" ↓":""]}),v.jsx(sM,{})]}),D("waited","WAITED","right"),D("tools","TOOLS","right")]}),j.map(B=>{const Q=n.sessions.get(B.sessionId),Z=vn(B.measures),F=B.id===i,V=y===B.id;return v.jsxs("div",{children:[v.jsxs("div",{onClick:()=>S(V?null:B.id),style:{display:"grid",gridTemplateColumns:O0,gap:"0 14px",fontSize:11,padding:"9px 0",borderBottom:"1px solid rgba(230,227,219,0.05)",cursor:"pointer",background:F||V?"rgba(240,195,116,0.07)":"transparent",fontVariantNumeric:"tabular-nums"},children:[v.jsx(Ai,{children:ts(B.startedAt)}),v.jsxs(Ai,{color:F||V?q.accentBright:q.body,children:[B.depth>0&&v.jsx("span",{style:{color:q.chromeDim},children:"└ "}),B.label]}),v.jsx(Ai,{children:Q?cr(Q.context):"—"}),v.jsx(Ai,{color:B.model?void 0:q.chromeDim,children:B.model??"—"}),v.jsx("div",{style:{fontSize:9,letterSpacing:"0.14em",color:lM(B),textTransform:"uppercase"},children:rM(B)}),v.jsxs(Ai,{align:"right",children:[B.startBasis==="inferred"||B.endBasis==="inferred"?"~":"",Ze(aa(B,n.now,n.dayStart).end-Math.max(B.startedAt,n.dayStart))]}),v.jsxs("div",{children:[v.jsx(Ai,{align:"right",color:Z===void 0?q.chromeDim:void 0,children:ns(Z,"—")}),Z!==void 0&&v.jsx(aM,{tokens:Z})]}),v.jsx(Ai,{align:"right",color:Ri(B,n.now)>0?at.waiting:q.chromeDim,children:Ri(B,n.now)>0?Ze(Ri(B,n.now)):"—"}),v.jsxs(Ai,{align:"right",color:on(B)===void 0?q.chromeDim:void 0,children:[ns(on(B),"—"),sa(B)>0&&v.jsxs("span",{style:{color:at.failed},children:[" /",sa(B)]})]})]}),V&&v.jsx(oM,{p:B,session:Q,now:n.now,onShowInField:()=>s(B.id)})]},B.id)}),b.length===0&&v.jsx("div",{style:{padding:"28px 0",fontSize:11,color:q.chromeMid},children:"Nothing matching in this window."}),b.length>h&&v.jsxs("button",{onClick:()=>m(B=>B+Hc),style:{marginTop:18,background:"transparent",border:`1px solid ${q.hairline}`,color:q.chromeMid,fontFamily:Et,fontSize:9.5,letterSpacing:"0.16em",padding:"8px 14px",cursor:"pointer"},children:["SHOW MORE — ",b.length-h," REMAINING"]})]})}const qc={display:"flex",flexDirection:"column",gap:5,background:q.panel,borderLeft:`1px solid ${q.panelBorder}`,padding:"9px 13px",minWidth:170,maxWidth:320,fontFamily:Et,backdropFilter:"blur(2px)"};function Ue({name:n,detail:i,color:s,title:l,tag:o}){return v.jsxs("div",{title:l,style:{display:"flex",alignItems:"baseline",justifyContent:"space-between",gap:16,fontSize:10.5,cursor:l?"help":void 0},children:[v.jsxs("span",{style:{color:q.chromeMid,letterSpacing:"0.1em",whiteSpace:"nowrap"},children:[n,o&&v.jsxs("span",{style:{color:q.chromeDim,letterSpacing:"0.06em"},children:[" ",o]})]}),v.jsx("span",{style:{fontSize:10,fontWeight:500,letterSpacing:"0.14em",color:s??q.chromeStrong,whiteSpace:"nowrap",textAlign:"right",overflow:"hidden",textOverflow:"ellipsis",maxWidth:190},children:i})]})}function Yc({text:n,onClose:i}){return v.jsxs("div",{style:{display:"flex",alignItems:"baseline",justifyContent:"space-between",gap:14},children:[v.jsx("div",{style:{fontSize:10,letterSpacing:"0.18em",color:q.ink,textTransform:"uppercase"},children:n}),v.jsx("div",{onClick:i,role:"button",style:{fontSize:11,color:q.chromeMid,cursor:"pointer"},children:"×"})]})}function Nf({label:n}){return v.jsx("div",{style:{marginTop:5,paddingTop:5,borderTop:"1px solid rgba(230,227,219,0.08)",fontSize:8.5,letterSpacing:"0.2em",color:q.chromeDim},children:n})}function cM(n){if(n.basis==="measured")return{label:"recorded",grade:"recorded"};const i=n.via?.split("|")[0];return i==="agent.session"?{label:"session identity",grade:"identity"}:i==="os.process"?{label:"process identity",grade:"identity"}:i==="fs.cwd"?{label:"directory overlap",grade:"contextual"}:{label:"inferred",grade:"contextual"}}function fM(n,i){switch(i.type){case"process":{const s=n.processes.get(i.id);return s?`PID ${s.pid} · ${s.command}`:i.id}case"session":return n.sessions.get(i.id)?.label??i.id;case"execution":return n.executions.get(i.id)?.label??i.id;case"machine":return n.machines.get(i.id)?.name??i.id;default:return i.id}}const N0={"ran-as":"RAN AS","same-as":"SAME AS",spawned:"SPAWNED",contains:"CONTAINS",produced:"PRODUCED"};function k0({world:n,subject:i}){const s=n.relationships.filter(l=>l.from.type===i.type&&l.from.id===i.id||l.to.type===i.type&&l.to.id===i.id);return s.length===0?null:v.jsxs(v.Fragment,{children:[v.jsx(Nf,{label:"RELATED"}),s.slice(0,6).map((l,o)=>{const c=l.from.type===i.type&&l.from.id===i.id,d=c?l.to:l.from,h=c?N0[l.kind]:l.kind==="spawned"?"SPAWNED BY":N0[l.kind],m=cM(l);return v.jsx(Ue,{name:h,tag:m.grade==="contextual"?`${m.label} · inferred`:m.label,detail:fM(n,d),color:m.grade==="contextual"?q.chromeMid:void 0,title:l.assumption??(l.via?`via ${l.via}`:void 0)},`${l.kind}:${d.type}:${d.id}:${o}`)})]})}function dM({type:n,id:i}){const[s,l]=P.useState(null);return P.useEffect(()=>{let o=!1;l(null);const c=setTimeout(()=>{v1(n,i).then(({events:d})=>{o||l(hM(d))}).catch(()=>{o||l(null)})},180);return()=>{o=!0,clearTimeout(c)}},[n,i]),!s||s.facts.length===0&&!s.provenance?null:v.jsxs(v.Fragment,{children:[v.jsx(Nf,{label:"NATIVE RECORD"}),s.facts.map(([o,c])=>v.jsx(Ue,{name:o,detail:c,color:q.chromeMid},o)),s.provenance&&v.jsxs("div",{title:s.provenance,style:{fontSize:8.5,letterSpacing:"0.04em",color:q.chromeDim,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",cursor:"help"},children:["read from ",s.provenance]})]})}function hM(n){const i=new Map;let s;for(const o of n){for(const[c,d]of Object.entries(o.attrs??{}))!c.includes(".")||d===void 0||d===null||d===""||i.set(c,d);!s&&o.provenance?.path&&(s=o.provenance.path)}return{facts:[...i.entries()].slice(0,10).map(([o,c])=>[o,typeof c=="object"?JSON.stringify(c):String(c)]),provenance:s}}function pM({p:n,now:i}){const s=(n.endedAt??i)-n.startedAt,l=n.startBasis==="inferred",o=n.endBasis==="inferred",c=l||o;return v.jsxs(v.Fragment,{children:[v.jsx(Ue,{name:"STARTED",tag:l?"inferred":void 0,detail:ts(n.startedAt),title:l?n.boundsAssumption:void 0}),v.jsx(Ue,{name:"ELAPSED",tag:c?"inferred":void 0,detail:Ze(s),title:c?n.boundsAssumption:void 0})]})}function kf({hit:n,world:i,landscape:s,band:l,density:o,onClose:c}){if(n.kind==="mass"){const j=i.machines.get(n.id);if(!j)return null;const D=[];let B=0,Q;for(const V of i.executions.values()){if(V.machineId!==j.id)continue;const K=vn(V.measures);K!==void 0&&(Q=(Q??0)+K),V.status==="running"||V.status==="waiting"?D.push({id:V.id,label:V.label,status:V.status}):B++}const Z=i.processTotals,F=new Set;for(const V of i.relationships)V.kind==="ran-as"&&(V.from.type==="process"&&F.add(V.from.id),V.to.type==="process"&&F.add(V.to.id));return v.jsxs("div",{style:qc,children:[v.jsx(Yc,{text:j.name,onClose:c}),D.length===0?v.jsx("div",{style:{fontSize:10,color:q.chrome},children:"idle — nothing active"}):D.slice(0,8).map(V=>v.jsx(Ue,{name:V.label,detail:V.status.toUpperCase(),color:at[V.status]},V.id)),v.jsx("div",{style:{height:4}}),v.jsx(Ue,{name:"RAN TODAY",detail:String(B)}),v.jsx(Ue,{name:"TOKENS",detail:ns(Q),title:Q===void 0?"No execution in this window reported token accounting.":void 0}),Z&&v.jsxs(v.Fragment,{children:[v.jsx(Nf,{label:"MACHINE STRATUM"}),v.jsx(Ue,{name:"PROCESSES OBSERVED",detail:String(Z.observed)}),v.jsx(Ue,{name:"SEEN IN LAST 5 MIN",detail:String(Z.recentlySeen),title:"Processes with a liveness observation in the last five minutes. The sampler only records a process when it is doing something, and never witnesses an exit — so recency is the honest liveness signal, not an unexpired status."}),v.jsx(Ue,{name:"ATTRIBUTED",detail:`${F.size} of ${Z.observed}`,title:"Processes tied to a session or execution by resolved identity. The rest are machine activity with no known semantic identity — observed, not explained."}),Z.exitsInferred>0&&v.jsx(Ue,{name:"EXITS",tag:"inferred",detail:String(Z.exitsInferred),title:"An exit is never witnessed by the sampler; it is inferred from disappearance between samples."})]})]})}if(n.kind==="coupling"){const j=i.transfers.get(n.id);if(!j)return null;const D=i.machines.get(j.fromMachineId)?.name??j.fromMachineId,B=i.machines.get(j.toMachineId)?.name??j.toMachineId;return v.jsxs("div",{style:qc,children:[v.jsx(Yc,{text:`${D} → ${B}`,onClose:c}),v.jsx(Ue,{name:"STATUS",detail:"TRANSFERRING",color:at.running}),v.jsx(Ue,{name:"WHAT",detail:j.label}),v.jsx(Ue,{name:"SIZE",detail:Px(j.bytes)}),v.jsx(Ue,{name:"ELAPSED",detail:Ze(i.now-j.startedAt)})]})}const d=i.executions.get(n.id);if(!d)return null;const h=i.sessions.get(d.sessionId),m=i.machines.get(d.machineId),y=s.disturbances.find(j=>j.id===n.id),S=o==="full"||o!=="compact"&&(l==="proximity"||n.kind==="stratum"),b=S,R=vn(d.measures),L=es(d.measures);return v.jsxs("div",{style:qc,children:[v.jsx(Yc,{text:d.label,onClose:c}),v.jsx(Ue,{name:"STATUS",detail:d.status.toUpperCase(),color:at[d.status]}),v.jsx(Ue,{name:"MACHINE",detail:m?.name??d.machineId}),v.jsx(pM,{p:d,now:i.now}),b&&v.jsxs(v.Fragment,{children:[v.jsx(Ue,{name:"TOKENS",detail:ns(R),title:R===void 0?"This source does not persist token accounting.":void 0}),v.jsx(Ue,{name:"REQUESTS",detail:String(hf(d))}),v.jsx(Ue,{name:"TOOL CALLS",detail:ns(on(d)),title:on(d)===void 0?"This source does not count discrete operations.":void 0})]}),S&&v.jsxs(v.Fragment,{children:[v.jsx("div",{style:{height:4}}),h&&v.jsx(Ue,{name:"CONTEXT",detail:cr(h.context)}),v.jsx(Ue,{name:"PROVIDER",detail:d.executor}),v.jsx(Ue,{name:"MODEL",detail:d.model??"NOT OBSERVED",color:d.model?void 0:q.chromeMid,title:d.model?void 0:"This source does not record the model."}),R!==void 0&&v.jsxs(v.Fragment,{children:[v.jsx(Ue,{name:"CACHE READ",detail:ct(L.cacheRead)}),v.jsx(Ue,{name:"REASONING",detail:ct(L.reasoning)})]}),sa(d)>0&&v.jsx(Ue,{name:"TOOL ERRORS",detail:String(sa(d)),color:at.failed}),d.waitingMs>0&&v.jsx(Ue,{name:"WAITED ON YOU",detail:Ze(d.waitingMs),color:at.waiting}),d.depth>0&&v.jsx(Ue,{name:"SUB-AGENT",detail:`depth ${d.depth}`}),h?.parentId&&v.jsx(Ue,{name:"SESSION SPAWNED BY",tag:"recorded",detail:i.sessions.get(h.parentId)?.label??h.parentId,title:"The session's own runtime recorded which session started it."}),y&&v.jsx(Ue,{name:"FIELD ENERGY",detail:y.energy.toFixed(2)}),v.jsx(k0,{world:i,subject:{type:"execution",id:d.id}}),h&&v.jsx(k0,{world:i,subject:{type:"session",id:h.id}}),v.jsx(dM,{type:"execution",id:d.id})]}),d.failure&&v.jsxs("div",{style:{marginTop:4,fontSize:9.5,letterSpacing:"0.06em",color:at.failed,maxWidth:280},children:[d.failure.code,": ",d.failure.message]}),d.outcome==="interrupted"&&!d.failure&&v.jsx("div",{style:{marginTop:4,fontSize:9.5,color:q.chromeMid},children:"stopped before finishing"})]})}function mM({hit:n,world:i}){let s="",l="",o=q.chromeMid;if(n.kind==="mass")s=i.machines.get(n.id)?.name??n.id;else if(n.kind==="coupling"){const c=i.transfers.get(n.id),d=c?i.machines.get(c.fromMachineId)?.name??"":"",h=c?i.machines.get(c.toMachineId)?.name??"":"";s=`${d} → ${h}`,l="TRANSFERRING",o=at.running}else{const c=i.executions.get(n.id);if(!c)return null;s=c.label,l=c.status.toUpperCase(),o=at[c.status]}return v.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",gap:2,pointerEvents:"none",whiteSpace:"nowrap",fontFamily:Et},children:[v.jsx("div",{style:{fontSize:10.5,fontWeight:500,letterSpacing:"0.18em",color:q.hoverInk,background:"rgba(5,6,8,0.88)",padding:"4px 9px"},children:s}),l&&v.jsx("div",{style:{fontSize:9.5,letterSpacing:"0.22em",color:o,textShadow:Ja},children:l})]})}function gM(n){return[`${ct(n.requests.value)} REQ`,`${n.sessions.value} SESS`,`${Ze(n.timeInFlight.value)}`,`${n.accounting.tokens>0?ct(n.tokens.value):"—"} TOK`].join(" · ")}function yM(n){return[`${ct(n.requests.value)} REQUESTS`,`${n.sessions.value} SESSIONS`,`${Ze(n.timeInFlight.value)} IN FLIGHT`,`PEAK ${n.peakConcurrency.value}`,`${n.contextSwitches.value} CONTEXT CHANGES`,`${n.accounting.tokens>0?ct(n.tokens.value):"—"} TOK`].join(" · ")}function vM({metrics:n,shape:i,compact:s=!1}){return v.jsxs("div",{style:{position:"absolute",left:20,bottom:16,right:s?82:236,display:"flex",flexDirection:"column",gap:8,pointerEvents:"none",fontFamily:Et},children:[v.jsxs("div",{"data-depth-deep":!0,"data-depth-suppressed":s?"true":void 0,style:{display:"none",maxWidth:720,background:"linear-gradient(to right, rgba(5,6,8,0.92) 0%, rgba(5,6,8,0.86) 70%, rgba(5,6,8,0) 100%)",padding:"10px 42px 10px 0",margin:"0 0 -2px -6px",paddingLeft:6},children:[v.jsxs("div",{style:{fontSize:9.5,letterSpacing:"0.24em",color:q.chrome,textShadow:Ja},children:["WORK SHAPE — ",i.headline]}),v.jsx("div",{style:{marginTop:6,display:"flex",flexDirection:"column",gap:3},children:i.clauses.slice(0,3).map(l=>v.jsx("div",{style:{fontSize:10.5,lineHeight:1.6,color:q.chromeMid,textShadow:Ja},children:l},l))}),v.jsx("div",{style:{marginTop:7,fontSize:9.5,lineHeight:1.6,color:q.chromeDim,textShadow:Ja,maxWidth:620},children:"NOT AVAILABLE FROM THESE SOURCES — cost (every source reports tokens or CPU time, none reports money) and machine-to-machine transfer (every observed source is single-host)."})]}),v.jsxs("div",{style:{display:"flex",alignItems:"baseline",gap:10,flexWrap:"wrap",background:"linear-gradient(to right, rgba(5,6,8,0.92) 0%, rgba(5,6,8,0.86) 80%, rgba(5,6,8,0) 100%)",padding:"4px 42px 4px 6px",margin:"0 0 0 -6px"},children:[v.jsx("span",{"data-depth-label":!0,style:{fontSize:10.5,letterSpacing:"0.18em",color:"rgba(230,227,219,0.74)",textShadow:Ja},children:"FIELD — LIVE"}),v.jsxs("span",{"data-depth-summary":!0,style:{display:"none",alignItems:"baseline",gap:10},children:[v.jsx("span",{style:{color:q.chromeDim},children:"·"}),v.jsx("span",{style:{fontSize:10.5,letterSpacing:"0.18em",color:"rgba(230,227,219,0.6)",textShadow:Ja},children:s?gM(n):yM(n)})]})]})]})}const bM=560;function L0(n,i,s){return Math.min(n,i)<bM||s?i>=n?"portrait":"landscape":"desktop"}function xM(){const[n,i]=P.useState(()=>typeof window>"u"?"desktop":L0(window.innerWidth,window.innerHeight,window.matchMedia("(pointer: coarse)").matches));return P.useEffect(()=>{const s=window.matchMedia("(pointer: coarse)"),l=()=>i(L0(window.innerWidth,window.innerHeight,s.matches));return l(),window.addEventListener("resize",l),window.addEventListener("orientationchange",l),s.addEventListener("change",l),()=>{window.removeEventListener("resize",l),window.removeEventListener("orientationchange",l),s.removeEventListener("change",l)}},[]),n}const iv=250,av=150;function SM(n,i,s,l){return i?n==="landscape"?{right:iv,bottom:0}:n==="portrait"?{right:0,bottom:s?Math.round(l*.6):av}:{right:0,bottom:0}:{right:0,bottom:0}}const sv={fontSize:9,letterSpacing:"0.16em",color:q.chromeMid};function wM(n){return v.jsxs("div",{style:{position:"absolute",right:0,top:0,bottom:0,width:iv,boxSizing:"border-box",background:q.panel,borderLeft:`1px solid ${q.panelBorder}`,padding:"16px 16px 14px",display:"flex",flexDirection:"column",gap:10,fontFamily:Et,pointerEvents:"auto"},children:[v.jsx(kf,{...n,density:"full"}),v.jsx("div",{style:{marginTop:"auto",...sv},children:"TAP FIELD TO DISMISS"})]})}function EM({detent:n,onToggleDetent:i,viewportHeight:s,...l}){const o=n==="expanded",c=o?Math.round(s*.6):av;return v.jsxs("div",{style:{position:"absolute",left:0,right:0,bottom:0,height:c,boxSizing:"border-box",background:"rgba(7,8,11,0.96)",borderTop:`1px solid ${q.panelBorder}`,padding:"10px 18px 18px",display:"flex",flexDirection:"column",gap:10,fontFamily:Et,pointerEvents:"auto",transition:"height 180ms ease-out"},children:[v.jsx("button",{onClick:i,"aria-label":o?"Collapse":"Expand",style:{alignSelf:"center",width:44,height:4,borderRadius:2,border:"none",padding:0,background:"rgba(230,227,219,0.42)",cursor:"pointer",marginBottom:2,flexShrink:0}}),v.jsx("div",{style:{overflow:"hidden",flex:1,minHeight:0},children:v.jsx(kf,{...l,density:o?"full":"compact"})}),v.jsx("div",{style:{marginTop:"auto",...sv},children:o?"TAP HANDLE TO COLLAPSE":"TAP HANDLE FOR FULL TELEMETRY"})]})}function TM(){return"capture"}function AM(n){return`${n.message}. ${n.remedy} Nothing observed since this appeared has been saved.`}const Xc={label:"TODAY",tone:"normal",detail:"Midnight to now."},MM={normal:q.chromeMid,warn:"rgba(240,195,116,0.9)",error:"rgba(206,104,90,0.9)"};function RM(){const n=Date.now(),i=new Date(n);return i.setHours(0,0,0,0),{start:i.getTime(),now:n}}const DM=250,CM={time:0,masses:[],disturbances:[],plinths:[],couplings:[],strata:[]};function OM(){const[n,i]=P.useState(TM),[s,l]=P.useState("field"),[o,c]=P.useState(null),[d,h]=P.useState(Xc),[m,y]=P.useState(CM),[S,b]=P.useState(0),[R,L]=P.useState(null),[j,D]=P.useState(null),[B,Q]=P.useState("environment"),[Z,F]=P.useState(null),[V,K]=P.useState("peek"),Y=xM(),A=P.useRef(Il(Date.now(),Date.now())),w=P.useRef(void 0),N=P.useRef(null),te=P.useRef(null),ne=P.useRef(!1);P.useEffect(()=>{let k=!1,H=null;h(Xc);async function J(){if(n==="synthetic"||n==="fixture"){let Ee;if(Ee=new g1({seed:57}),h({label:"REPLAY",tone:"normal",detail:"A deterministic synthetic day, replayed at speed. Not your telemetry."}),k)return;const Kt=Ee.bounds();A.current=Il(Kt.dayStart,Kt.dayEnd),w.current=void 0,N.current=Ee,c(Ee.info()),D(null),L(null),H=Ee.subscribe(ee=>{kx(A.current,ee),ne.current=!0}),ne.current=!0;return}const{start:oe,now:he}=RM();await Qc(oe,he);const me=await y1();let $e=await Pc(oe,he);if($e.world.executions.length===0&&$e.world.sessions.length===0){const Ee=he-2592e5;await Qc(Ee,he),$e=await Pc(Ee,he),($e.world.executions.length>0||$e.world.sessions.length>0)&&h({label:"LAST 72H",tone:"warn",detail:"Nothing ran today, so the window was widened to the last 72 hours."})}const Re=Object.entries(me.observation??{}).flatMap(([Ee,Kt])=>Object.entries(Kt.strata).filter(([ee,W])=>W==="partial"||W==="failed"&&ee!=="live-semantics").map(([ee,W])=>`${Ee} ${ee} ${W}`)),fn=Object.entries(me.sources).filter(([,Ee])=>(Ee.presence??(Ee.available?"observing":"not-installed"))==="failed").map(([Ee])=>Ee),Mn=Object.entries(me.sources).filter(([,Ee])=>Ee.presence==="not-installed").map(([Ee])=>Ee),zi=me.store.bySource.filter(Ee=>Ee.source!=="host"),Mt=me.health;me.fault?h({label:"STORE LOST",tone:"error",detail:AM(me.fault)}):Mt&&!Mt.store.ok?h({label:"STORE DEGRADED",tone:"error",detail:Mt.store.remedy??"Some stored rows could not be read."}):Mt&&Mt.failingSources.length>0?h({label:"SOURCE FAILING",tone:"error",detail:`Installed and failing every collection round: ${Mt.failingSources.join(", ")}. `+(Mt.collection[Mt.failingSources[0]]?.lastError??"")+" Other sources and captured history are unaffected."}):me.mode==="os-only"?h({label:"OS ONLY",tone:"normal",detail:"Observing this machine’s processes. No AI runtime state was found here"+(Mn.length?` (looked for ${Mn.join(", ")})`:"")+" — that is a valid mode, not a fault. Install or use one and its sessions appear here."}):zi.length===0?h({label:"NOTHING YET",tone:"warn",detail:"Nothing has been captured yet. OS processes are sampled locally every few seconds; AI runtime state is read from each runtime’s own files when it exists."}):(fn.length||Re.length)&&h({label:"PARTIAL",tone:"warn",detail:[fn.length?`Installed but unreadable: ${fn.join(", ")}.`:"",Re.length?`Reduced observation depth: ${Re.join("; ")}. The computation is still observed; some semantics are not.`:"","Captured history is intact."].filter(Boolean).join(" ")});const kt=new S1($e,me,{onTrouble:Ee=>{if(!k){if(!Ee)return h(Xc);h(Ee.kind==="store-fault"?{label:"STORE LOST",tone:"error",detail:`${Ee.message} ${Ee.detail}`}:{label:"CAPTURE FAILING",tone:"error",detail:`${Ee.message}. ${Ee.detail}. The field is showing the last world it received.`})}}});k||(A.current=Il($e.from,$e.to),N.current=kt,c(kt.info()),D(null),L(null),H=kt.subscribe((Ee,Kt)=>{A.current=Ee,w.current=Kt,ne.current=!0}),ne.current=!0)}return J().catch(oe=>{k||h({label:"SOURCE FAILED",tone:"error",detail:oe instanceof Error?oe.message:String(oe)})}),()=>{k=!0,N.current=null,H?.()}},[n]),P.useEffect(()=>{const k=setInterval(()=>{const H=A.current,J=N.current?.now()??Date.now();if(Lx(H,Math.max(H.now,J)),!ne.current)return;ne.current=!1;const oe=f1(H);y(oe),b(he=>he+1)},DM);return()=>clearInterval(k)},[]),P.useEffect(()=>{const k=setInterval(()=>{const H=te.current?.perf.snapshot();H&&F({fps:H.fps,gpuMs:H.gpuMs,scale:H.scale})},1e3);return()=>clearInterval(k)},[]);const le=A.current,Ge=P.useMemo(()=>I0(le),[S]),de=P.useMemo(()=>F0(le,Ge),[Ge]),ue=P.useCallback(k=>L(k),[]),z=P.useCallback(k=>{const H=m.disturbances.find(oe=>oe.id===k),J=m.strata.find(oe=>oe.id===k);!H&&!J||(D({kind:H?"disturbance":"stratum",id:k,x:H?.x??0,y:H?.y??0}),l("field"))},[m]),X=j??R,ae=Y!=="desktop",be=typeof window>"u"?800:window.innerHeight,De=P.useMemo(()=>SM(Y,!!j,V==="expanded",be),[Y,j,V,be]),T=X&&(!j&&X.kind==="disturbance"?v.jsx("div",{"data-anchor-placement":"label",children:v.jsx(mM,{hit:X,world:le})}):v.jsx("div",{"data-anchor-placement":"panel",children:v.jsx(kf,{hit:X,world:le,landscape:m,band:B,onClose:()=>D(null)})}));return v.jsxs("div",{style:{position:"fixed",inset:0,display:"flex",flexDirection:"column",background:q.bg,color:q.ink,fontFamily:Et},children:[v.jsx(zM,{view:s,setView:l,feed:n,setFeed:i,sourceInfo:o,window:d}),s==="today"&&v.jsx(WA,{world:le,waitEvidence:w.current}),s==="log"&&v.jsx(uM,{world:le,selectedId:j?.id??null,onSelect:z}),v.jsx("div",{style:{display:s==="field"?"contents":"none"},children:v.jsx(KA,{landscape:m,onHover:ue,onSelect:D,anchor:ae?null:X,onBand:Q,compact:ae,inset:De,keepVisible:j,overlay:ae&&j?Y==="landscape"?v.jsx(wM,{hit:j,world:le,landscape:m,band:B,onClose:()=>D(null)}):v.jsx(EM,{hit:j,world:le,landscape:m,band:B,detent:V,onToggleDetent:()=>K(k=>k==="peek"?"expanded":"peek"),viewportHeight:be,onClose:()=>D(null)}):null,onReady:k=>{te.current=k},depth:v.jsx(vM,{metrics:Ge,shape:de,compact:ae}),children:T})}),v.jsx(_M,{view:s,perf:Z,touch:ae})]})}function zM({view:n,setView:i,feed:s,setFeed:l,sourceInfo:o,window:c}){const d=(y,S)=>{const b=n===y;return v.jsx("button",{onClick:()=>i(y),style:{background:"transparent",border:"none",padding:0,cursor:"pointer",fontFamily:Et,letterSpacing:"0.22em",fontSize:b?12.5:9.5,color:b?q.ink:q.chromeDim},children:S},y)},h=s==="synthetic",m=[c.detail,o?.detail].filter(Boolean).join(" ");return v.jsxs("div",{style:{display:"flex",alignItems:"center",gap:14,padding:"16px 24px 15px",borderBottom:`1px solid ${q.hairline}`,flexWrap:"nowrap",overflow:"hidden"},children:[v.jsx("div",{style:{fontSize:11,letterSpacing:"0.3em",color:"rgba(230,227,219,0.5)",flexShrink:0},children:"057"}),v.jsx("div",{className:"hdr-tagline",style:{fontSize:8.5,letterSpacing:"0.24em",color:q.chromeDim,flexShrink:0,whiteSpace:"nowrap"},children:"PERSONAL COMPUTATIONAL TELEMETRY"}),v.jsx("div",{className:"hdr-tagline",style:{width:1,height:12,background:"rgba(230,227,219,0.12)",flexShrink:0,margin:"0 10px"}}),v.jsxs("div",{style:{display:"flex",alignItems:"baseline",gap:20,flexShrink:0},children:[d("field","FIELD"),d("today","TODAY"),d("log","PROCESS LOG")]}),v.jsxs("div",{style:{marginLeft:"auto",display:"flex",alignItems:"center",gap:22,minWidth:0},children:[v.jsxs("div",{title:m,style:{display:"flex",alignItems:"center",gap:9,flexShrink:0,cursor:"help"},children:[v.jsx("span",{style:{width:5,height:5,borderRadius:"50%",background:MM[c.tone],flexShrink:0}}),v.jsx("span",{style:{fontSize:10,letterSpacing:"0.2em",color:q.chromeStrong,whiteSpace:"nowrap"},children:c.label})]}),v.jsxs("button",{onClick:()=>l(h?"capture":"synthetic"),title:h?"Switch to CAPTURE":"Switch to SYNTHETIC",style:{background:"transparent",border:"none",padding:"3px 0",cursor:"pointer",display:"flex",alignItems:"center",gap:8,flexShrink:0},children:[v.jsx("span",{style:{fontSize:10,color:h?q.chromeDim:q.accent},children:h?"○":"●"}),v.jsx("span",{style:{fontSize:9.5,letterSpacing:"0.16em",color:q.chrome},children:h?"SYNTHETIC":"CAPTURE"})]})]})]})}function _M({view:n,perf:i,touch:s}){return v.jsxs("div",{style:{display:"flex",alignItems:"baseline",gap:14,padding:"10px 24px 14px",borderTop:`1px solid ${q.hairline}`,fontSize:10.5,letterSpacing:"0.16em",color:q.chrome,flexWrap:"wrap"},children:[v.jsx("span",{children:n==="field"?s?"DRAG TO PAN · PINCH TO ZOOM · TAP TO INSPECT":"SCROLL TO PAN · ⌃SCROLL / PINCH TO ZOOM · CLICK TO INSPECT · ZOOM OUT FOR TODAY":n==="log"?v.jsxs(v.Fragment,{children:["CLICK A ROW FOR THE FULL RECORD · CLICK A COLUMN TO SORT",v.jsx("span",{style:{color:q.accentBright},children:" · TOKEN RULE: LOG 10k–100M"})]}):"HOVER AN INFERRED MEASURE FOR THE ASSUMPTION BEHIND IT"}),v.jsx("span",{style:{marginLeft:"auto",color:q.chromeDim,fontSize:9.5},children:n==="field"&&i&&i.fps>0?`${Math.round(i.fps)}FPS${i.gpuMs>0?` · ${i.gpuMs.toFixed(1)}MS GPU`:""}${i.scale<1?` · ${Math.round(i.scale*100)}%`:""}`:""})]})}Dx.createRoot(document.getElementById("root")).render(v.jsx(P.StrictMode,{children:v.jsx(OM,{})}));