@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.
@@ -0,0 +1,693 @@
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"]'))r(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"&&r(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 r(o){if(o.ep)return;o.ep=!0;const c=s(o);fetch(o.href,c)}})();var Rc={exports:{}},tr={};var $m;function Mx(){if($m)return tr;$m=1;var n=Symbol.for("react.transitional.element"),i=Symbol.for("react.fragment");function s(r,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:r,key:d,ref:o!==void 0?o:null,props:c}}return tr.Fragment=i,tr.jsx=s,tr.jsxs=s,tr}var Im;function Rx(){return Im||(Im=1,Rc.exports=Mx()),Rc.exports}var v=Rx(),Dc={exports:{}},pe={};var Vm;function Dx(){if(Vm)return pe;Vm=1;var n=Symbol.for("react.transitional.element"),i=Symbol.for("react.portal"),s=Symbol.for("react.fragment"),r=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"),g=Symbol.for("react.memo"),x=Symbol.for("react.lazy"),b=Symbol.for("react.activity"),R=Symbol.iterator;function B(T){return T===null||typeof T!="object"?null:(T=R&&T[R]||T["@@iterator"],typeof T=="function"?T:null)}var O={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},L=Object.assign,_={};function H(T,j,q){this.props=T,this.context=j,this.refs=_,this.updater=q||O}H.prototype.isReactComponent={},H.prototype.setState=function(T,j){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,j,"setState")},H.prototype.forceUpdate=function(T){this.updater.enqueueForceUpdate(this,T,"forceUpdate")};function Z(){}Z.prototype=H.prototype;function K(T,j,q){this.props=T,this.context=j,this.refs=_,this.updater=q||O}var F=K.prototype=new Z;F.constructor=K,L(F,H.prototype),F.isPureReactComponent=!0;var Y=Array.isArray;function A(){}var k={H:null,A:null,T:null,S:null},w=Object.prototype.hasOwnProperty;function $(T,j,q){var J=q.ref;return{$$typeof:n,type:T,key:j,ref:J!==void 0?J:null,props:q}}function te(T,j){return $(T.type,j,T.props)}function se(T){return typeof T=="object"&&T!==null&&T.$$typeof===n}function oe(T){var j={"=":"=0",":":"=2"};return"$"+T.replace(/[=:]/g,function(q){return j[q]})}var he=/\/+/g;function me(T,j){return typeof T=="object"&&T!==null&&T.key!=null?oe(""+T.key):j.toString(36)}function ce(T){switch(T.status){case"fulfilled":return T.value;case"rejected":throw T.reason;default:switch(typeof T.status=="string"?T.then(A,A):(T.status="pending",T.then(function(j){T.status==="pending"&&(T.status="fulfilled",T.value=j)},function(j){T.status==="pending"&&(T.status="rejected",T.reason=j)})),T.status){case"fulfilled":return T.value;case"rejected":throw T.reason}}throw T}function U(T,j,q,J,le){var de=typeof T;(de==="undefined"||de==="boolean")&&(T=null);var ge=!1;if(T===null)ge=!0;else switch(de){case"bigint":case"string":case"number":ge=!0;break;case"object":switch(T.$$typeof){case n:case i:ge=!0;break;case x:return ge=T._init,U(ge(T._payload),j,q,J,le)}}if(ge)return le=le(T),ge=J===""?"."+me(T,0):J,Y(le)?(q="",ge!=null&&(q=ge.replace(he,"$&/")+"/"),U(le,j,q,"",function(dn){return dn})):le!=null&&(se(le)&&(le=te(le,q+(le.key==null||T&&T.key===le.key?"":(""+le.key).replace(he,"$&/")+"/")+ge)),j.push(le)),1;ge=0;var Ie=J===""?".":J+":";if(Y(T))for(var De=0;De<T.length;De++)J=T[De],de=Ie+me(J,De),ge+=U(J,j,q,de,le);else if(De=B(T),typeof De=="function")for(T=De.call(T),De=0;!(J=T.next()).done;)J=J.value,de=Ie+me(J,De++),ge+=U(J,j,q,de,le);else if(de==="object"){if(typeof T.then=="function")return U(ce(T),j,q,J,le);throw j=String(T),Error("Objects are not valid as a React child (found: "+(j==="[object Object]"?"object with keys {"+Object.keys(T).join(", ")+"}":j)+"). If you meant to render a collection of children, use an array instead.")}return ge}function P(T,j,q){if(T==null)return T;var J=[],le=0;return U(T,J,"","",function(de){return j.call(q,de,le++)}),J}function ae(T){if(T._status===-1){var j=T._result;j=j(),j.then(function(q){(T._status===0||T._status===-1)&&(T._status=1,T._result=q)},function(q){(T._status===0||T._status===-1)&&(T._status=2,T._result=q)}),T._status===-1&&(T._status=0,T._result=j)}if(T._status===1)return T._result.default;throw T._result}var xe=typeof reportError=="function"?reportError:function(T){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var j=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(j))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",T);return}console.error(T)},Ce={map:P,forEach:function(T,j,q){P(T,function(){j.apply(this,arguments)},q)},count:function(T){var j=0;return P(T,function(){j++}),j},toArray:function(T){return P(T,function(j){return j})||[]},only:function(T){if(!se(T))throw Error("React.Children.only expected to receive a single React element child.");return T}};return pe.Activity=b,pe.Children=Ce,pe.Component=H,pe.Fragment=s,pe.Profiler=o,pe.PureComponent=K,pe.StrictMode=r,pe.Suspense=m,pe.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=k,pe.__COMPILER_RUNTIME={__proto__:null,c:function(T){return k.H.useMemoCache(T)}},pe.cache=function(T){return function(){return T.apply(null,arguments)}},pe.cacheSignal=function(){return null},pe.cloneElement=function(T,j,q){if(T==null)throw Error("The argument must be a React element, but you passed "+T+".");var J=L({},T.props),le=T.key;if(j!=null)for(de in j.key!==void 0&&(le=""+j.key),j)!w.call(j,de)||de==="key"||de==="__self"||de==="__source"||de==="ref"&&j.ref===void 0||(J[de]=j[de]);var de=arguments.length-2;if(de===1)J.children=q;else if(1<de){for(var ge=Array(de),Ie=0;Ie<de;Ie++)ge[Ie]=arguments[Ie+2];J.children=ge}return $(T.type,le,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,j,q){var J,le={},de=null;if(j!=null)for(J in j.key!==void 0&&(de=""+j.key),j)w.call(j,J)&&J!=="key"&&J!=="__self"&&J!=="__source"&&(le[J]=j[J]);var ge=arguments.length-2;if(ge===1)le.children=q;else if(1<ge){for(var Ie=Array(ge),De=0;De<ge;De++)Ie[De]=arguments[De+2];le.children=Ie}if(T&&T.defaultProps)for(J in ge=T.defaultProps,ge)le[J]===void 0&&(le[J]=ge[J]);return $(T,de,le)},pe.createRef=function(){return{current:null}},pe.forwardRef=function(T){return{$$typeof:h,render:T}},pe.isValidElement=se,pe.lazy=function(T){return{$$typeof:x,_payload:{_status:-1,_result:T},_init:ae}},pe.memo=function(T,j){return{$$typeof:g,type:T,compare:j===void 0?null:j}},pe.startTransition=function(T){var j=k.T,q={};k.T=q;try{var J=T(),le=k.S;le!==null&&le(q,J),typeof J=="object"&&J!==null&&typeof J.then=="function"&&J.then(A,xe)}catch(de){xe(de)}finally{j!==null&&q.types!==null&&(j.types=q.types),k.T=j}},pe.unstable_useCacheRefresh=function(){return k.H.useCacheRefresh()},pe.use=function(T){return k.H.use(T)},pe.useActionState=function(T,j,q){return k.H.useActionState(T,j,q)},pe.useCallback=function(T,j){return k.H.useCallback(T,j)},pe.useContext=function(T){return k.H.useContext(T)},pe.useDebugValue=function(){},pe.useDeferredValue=function(T,j){return k.H.useDeferredValue(T,j)},pe.useEffect=function(T,j){return k.H.useEffect(T,j)},pe.useEffectEvent=function(T){return k.H.useEffectEvent(T)},pe.useId=function(){return k.H.useId()},pe.useImperativeHandle=function(T,j,q){return k.H.useImperativeHandle(T,j,q)},pe.useInsertionEffect=function(T,j){return k.H.useInsertionEffect(T,j)},pe.useLayoutEffect=function(T,j){return k.H.useLayoutEffect(T,j)},pe.useMemo=function(T,j){return k.H.useMemo(T,j)},pe.useOptimistic=function(T,j){return k.H.useOptimistic(T,j)},pe.useReducer=function(T,j,q){return k.H.useReducer(T,j,q)},pe.useRef=function(T){return k.H.useRef(T)},pe.useState=function(T){return k.H.useState(T)},pe.useSyncExternalStore=function(T,j,q){return k.H.useSyncExternalStore(T,j,q)},pe.useTransition=function(){return k.H.useTransition()},pe.version="19.2.8",pe}var Fm;function vf(){return Fm||(Fm=1,Dc.exports=Dx()),Dc.exports}var Q=vf(),Cc={exports:{}},nr={},Oc={exports:{}},zc={};var Hm;function Cx(){return Hm||(Hm=1,(function(n){function i(U,P){var ae=U.length;U.push(P);e:for(;0<ae;){var xe=ae-1>>>1,Ce=U[xe];if(0<o(Ce,P))U[xe]=P,U[ae]=Ce,ae=xe;else break e}}function s(U){return U.length===0?null:U[0]}function r(U){if(U.length===0)return null;var P=U[0],ae=U.pop();if(ae!==P){U[0]=ae;e:for(var xe=0,Ce=U.length,T=Ce>>>1;xe<T;){var j=2*(xe+1)-1,q=U[j],J=j+1,le=U[J];if(0>o(q,ae))J<Ce&&0>o(le,q)?(U[xe]=le,U[J]=ae,xe=J):(U[xe]=q,U[j]=ae,xe=j);else if(J<Ce&&0>o(le,ae))U[xe]=le,U[J]=ae,xe=J;else break e}}return P}function o(U,P){var ae=U.sortIndex-P.sortIndex;return ae!==0?ae:U.id-P.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=[],g=[],x=1,b=null,R=3,B=!1,O=!1,L=!1,_=!1,H=typeof setTimeout=="function"?setTimeout:null,Z=typeof clearTimeout=="function"?clearTimeout:null,K=typeof setImmediate<"u"?setImmediate:null;function F(U){for(var P=s(g);P!==null;){if(P.callback===null)r(g);else if(P.startTime<=U)r(g),P.sortIndex=P.expirationTime,i(m,P);else break;P=s(g)}}function Y(U){if(L=!1,F(U),!O)if(s(m)!==null)O=!0,A||(A=!0,oe());else{var P=s(g);P!==null&&ce(Y,P.startTime-U)}}var A=!1,k=-1,w=5,$=-1;function te(){return _?!0:!(n.unstable_now()-$<w)}function se(){if(_=!1,A){var U=n.unstable_now();$=U;var P=!0;try{e:{O=!1,L&&(L=!1,Z(k),k=-1),B=!0;var ae=R;try{t:{for(F(U),b=s(m);b!==null&&!(b.expirationTime>U&&te());){var xe=b.callback;if(typeof xe=="function"){b.callback=null,R=b.priorityLevel;var Ce=xe(b.expirationTime<=U);if(U=n.unstable_now(),typeof Ce=="function"){b.callback=Ce,F(U),P=!0;break t}b===s(m)&&r(m),F(U)}else r(m);b=s(m)}if(b!==null)P=!0;else{var T=s(g);T!==null&&ce(Y,T.startTime-U),P=!1}}break e}finally{b=null,R=ae,B=!1}P=void 0}}finally{P?oe():A=!1}}}var oe;if(typeof K=="function")oe=function(){K(se)};else if(typeof MessageChannel<"u"){var he=new MessageChannel,me=he.port2;he.port1.onmessage=se,oe=function(){me.postMessage(null)}}else oe=function(){H(se,0)};function ce(U,P){k=H(function(){U(n.unstable_now())},P)}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(U){U.callback=null},n.unstable_forceFrameRate=function(U){0>U||125<U?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):w=0<U?Math.floor(1e3/U):5},n.unstable_getCurrentPriorityLevel=function(){return R},n.unstable_next=function(U){switch(R){case 1:case 2:case 3:var P=3;break;default:P=R}var ae=R;R=P;try{return U()}finally{R=ae}},n.unstable_requestPaint=function(){_=!0},n.unstable_runWithPriority=function(U,P){switch(U){case 1:case 2:case 3:case 4:case 5:break;default:U=3}var ae=R;R=U;try{return P()}finally{R=ae}},n.unstable_scheduleCallback=function(U,P,ae){var xe=n.unstable_now();switch(typeof ae=="object"&&ae!==null?(ae=ae.delay,ae=typeof ae=="number"&&0<ae?xe+ae:xe):ae=xe,U){case 1:var Ce=-1;break;case 2:Ce=250;break;case 5:Ce=1073741823;break;case 4:Ce=1e4;break;default:Ce=5e3}return Ce=ae+Ce,U={id:x++,callback:P,priorityLevel:U,startTime:ae,expirationTime:Ce,sortIndex:-1},ae>xe?(U.sortIndex=ae,i(g,U),s(m)===null&&U===s(g)&&(L?(Z(k),k=-1):L=!0,ce(Y,ae-xe))):(U.sortIndex=Ce,i(m,U),O||B||(O=!0,A||(A=!0,oe()))),U},n.unstable_shouldYield=te,n.unstable_wrapCallback=function(U){var P=R;return function(){var ae=R;R=P;try{return U.apply(this,arguments)}finally{R=ae}}}})(zc)),zc}var qm;function Ox(){return qm||(qm=1,Oc.exports=Cx()),Oc.exports}var _c={exports:{}},Et={};var Ym;function zx(){if(Ym)return Et;Ym=1;var n=vf();function i(m){var g="https://react.dev/errors/"+m;if(1<arguments.length){g+="?args[]="+encodeURIComponent(arguments[1]);for(var x=2;x<arguments.length;x++)g+="&args[]="+encodeURIComponent(arguments[x])}return"Minified React error #"+m+"; visit "+g+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function s(){}var r={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,g,x){var b=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:o,key:b==null?null:""+b,children:m,containerInfo:g,implementation:x}}var d=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function h(m,g){if(m==="font")return"";if(typeof g=="string")return g==="use-credentials"?g:""}return Et.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=r,Et.createPortal=function(m,g){var x=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!g||g.nodeType!==1&&g.nodeType!==9&&g.nodeType!==11)throw Error(i(299));return c(m,g,null,x)},Et.flushSync=function(m){var g=d.T,x=r.p;try{if(d.T=null,r.p=2,m)return m()}finally{d.T=g,r.p=x,r.d.f()}},Et.preconnect=function(m,g){typeof m=="string"&&(g?(g=g.crossOrigin,g=typeof g=="string"?g==="use-credentials"?g:"":void 0):g=null,r.d.C(m,g))},Et.prefetchDNS=function(m){typeof m=="string"&&r.d.D(m)},Et.preinit=function(m,g){if(typeof m=="string"&&g&&typeof g.as=="string"){var x=g.as,b=h(x,g.crossOrigin),R=typeof g.integrity=="string"?g.integrity:void 0,B=typeof g.fetchPriority=="string"?g.fetchPriority:void 0;x==="style"?r.d.S(m,typeof g.precedence=="string"?g.precedence:void 0,{crossOrigin:b,integrity:R,fetchPriority:B}):x==="script"&&r.d.X(m,{crossOrigin:b,integrity:R,fetchPriority:B,nonce:typeof g.nonce=="string"?g.nonce:void 0})}},Et.preinitModule=function(m,g){if(typeof m=="string")if(typeof g=="object"&&g!==null){if(g.as==null||g.as==="script"){var x=h(g.as,g.crossOrigin);r.d.M(m,{crossOrigin:x,integrity:typeof g.integrity=="string"?g.integrity:void 0,nonce:typeof g.nonce=="string"?g.nonce:void 0})}}else g==null&&r.d.M(m)},Et.preload=function(m,g){if(typeof m=="string"&&typeof g=="object"&&g!==null&&typeof g.as=="string"){var x=g.as,b=h(x,g.crossOrigin);r.d.L(m,x,{crossOrigin:b,integrity:typeof g.integrity=="string"?g.integrity:void 0,nonce:typeof g.nonce=="string"?g.nonce:void 0,type:typeof g.type=="string"?g.type:void 0,fetchPriority:typeof g.fetchPriority=="string"?g.fetchPriority:void 0,referrerPolicy:typeof g.referrerPolicy=="string"?g.referrerPolicy:void 0,imageSrcSet:typeof g.imageSrcSet=="string"?g.imageSrcSet:void 0,imageSizes:typeof g.imageSizes=="string"?g.imageSizes:void 0,media:typeof g.media=="string"?g.media:void 0})}},Et.preloadModule=function(m,g){if(typeof m=="string")if(g){var x=h(g.as,g.crossOrigin);r.d.m(m,{as:typeof g.as=="string"&&g.as!=="script"?g.as:void 0,crossOrigin:x,integrity:typeof g.integrity=="string"?g.integrity:void 0})}else r.d.m(m)},Et.requestFormReset=function(m){r.d.r(m)},Et.unstable_batchedUpdates=function(m,g){return m(g)},Et.useFormState=function(m,g,x){return d.H.useFormState(m,g,x)},Et.useFormStatus=function(){return d.H.useHostTransitionStatus()},Et.version="19.2.8",Et}var Xm;function _x(){if(Xm)return _c.exports;Xm=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(),_c.exports=zx(),_c.exports}var Km;function Ux(){if(Km)return nr;Km=1;var n=Ox(),i=vf(),s=_x();function r(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(r(188))}function g(e){var t=e.alternate;if(!t){if(t=c(e),t===null)throw Error(r(188));return t!==e?null:e}for(var a=e,l=t;;){var u=a.return;if(u===null)break;var f=u.alternate;if(f===null){if(l=u.return,l!==null){a=l;continue}break}if(u.child===f.child){for(f=u.child;f;){if(f===a)return m(u),e;if(f===l)return m(u),t;f=f.sibling}throw Error(r(188))}if(a.return!==l.return)a=u,l=f;else{for(var p=!1,y=u.child;y;){if(y===a){p=!0,a=u,l=f;break}if(y===l){p=!0,l=u,a=f;break}y=y.sibling}if(!p){for(y=f.child;y;){if(y===a){p=!0,a=f,l=u;break}if(y===l){p=!0,l=f,a=u;break}y=y.sibling}if(!p)throw Error(r(189))}}if(a.alternate!==l)throw Error(r(190))}if(a.tag!==3)throw Error(r(188));return a.stateNode.current===a?e:t}function x(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=x(e),t!==null)return t;e=e.sibling}return null}var b=Object.assign,R=Symbol.for("react.element"),B=Symbol.for("react.transitional.element"),O=Symbol.for("react.portal"),L=Symbol.for("react.fragment"),_=Symbol.for("react.strict_mode"),H=Symbol.for("react.profiler"),Z=Symbol.for("react.consumer"),K=Symbol.for("react.context"),F=Symbol.for("react.forward_ref"),Y=Symbol.for("react.suspense"),A=Symbol.for("react.suspense_list"),k=Symbol.for("react.memo"),w=Symbol.for("react.lazy"),$=Symbol.for("react.activity"),te=Symbol.for("react.memo_cache_sentinel"),se=Symbol.iterator;function oe(e){return e===null||typeof e!="object"?null:(e=se&&e[se]||e["@@iterator"],typeof e=="function"?e:null)}var he=Symbol.for("react.client.reference");function me(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===he?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case L:return"Fragment";case H:return"Profiler";case _:return"StrictMode";case Y:return"Suspense";case A:return"SuspenseList";case $:return"Activity"}if(typeof e=="object")switch(e.$$typeof){case O:return"Portal";case K:return e.displayName||"Context";case Z:return(e._context.displayName||"Context")+".Consumer";case F:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case k:return t=e.displayName||null,t!==null?t:me(e.type)||"Memo";case w:t=e._payload,e=e._init;try{return me(e(t))}catch{}}return null}var ce=Array.isArray,U=i.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,P=s.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ae={pending:!1,data:null,method:null,action:null},xe=[],Ce=-1;function T(e){return{current:e}}function j(e){0>Ce||(e.current=xe[Ce],xe[Ce]=null,Ce--)}function q(e,t){Ce++,xe[Ce]=e.current,e.current=t}var J=T(null),le=T(null),de=T(null),ge=T(null);function Ie(e,t){switch(q(de,t),q(le,e),q(J,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?um(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=um(t),e=cm(t,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}j(J),q(J,e)}function De(){j(J),j(le),j(de)}function dn(e){e.memoizedState!==null&&q(ge,e);var t=J.current,a=cm(t,e.type);t!==a&&(q(le,e),q(J,a))}function Rn(e){le.current===e&&(j(J),j(le)),ge.current===e&&(j(ge),Zs._currentValue=ae)}var zi,Dt;function Bt(e){if(zi===void 0)try{throw Error()}catch(a){var t=a.stack.trim().match(/\n( *(at )?)/);zi=t&&t[1]||"",Dt=-1<a.stack.indexOf(`
2
+ at`)?" (<anonymous>)":-1<a.stack.indexOf("@")?"@unknown:0:0":""}return`
3
+ `+zi+e+Dt}var Te=!1;function Qt(e,t){if(!e||Te)return"";Te=!0;var a=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var l={DetermineComponentFrameRoot:function(){try{if(t){var V=function(){throw Error()};if(Object.defineProperty(V.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(V,[])}catch(N){var z=N}Reflect.construct(e,[],V)}else{try{V.call()}catch(N){z=N}e.call(V.prototype)}}else{try{throw Error()}catch(N){z=N}(V=e())&&typeof V.catch=="function"&&V.catch(function(){})}}catch(N){if(N&&z&&typeof N.stack=="string")return[N.stack,z.stack]}return[null,null]}};l.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var u=Object.getOwnPropertyDescriptor(l.DetermineComponentFrameRoot,"name");u&&u.configurable&&Object.defineProperty(l.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var f=l.DetermineComponentFrameRoot(),p=f[0],y=f[1];if(p&&y){var S=p.split(`
4
+ `),C=y.split(`
5
+ `);for(u=l=0;l<S.length&&!S[l].includes("DetermineComponentFrameRoot");)l++;for(;u<C.length&&!C[u].includes("DetermineComponentFrameRoot");)u++;if(l===S.length||u===C.length)for(l=S.length-1,u=C.length-1;1<=l&&0<=u&&S[l]!==C[u];)u--;for(;1<=l&&0<=u;l--,u--)if(S[l]!==C[u]){if(l!==1||u!==1)do if(l--,u--,0>u||S[l]!==C[u]){var G=`
6
+ `+S[l].replace(" at new "," at ");return e.displayName&&G.includes("<anonymous>")&&(G=G.replace("<anonymous>",e.displayName)),G}while(1<=l&&0<=u);break}}}finally{Te=!1,Error.prepareStackTrace=a}return(a=e?e.displayName||e.name:"")?Bt(a):""}function ee(e,t){switch(e.tag){case 26:case 27:case 5:return Bt(e.type);case 16:return Bt("Lazy");case 13:return e.child!==t&&t!==null?Bt("Suspense Fallback"):Bt("Suspense");case 19:return Bt("SuspenseList");case 0:case 15:return Qt(e.type,!1);case 11:return Qt(e.type.render,!1);case 1:return Qt(e.type,!0);case 31:return Bt("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(l){return`
7
+ Error generating stack: `+l.message+`
8
+ `+l.stack}}var ye=Object.prototype.hasOwnProperty,Oe=n.unstable_scheduleCallback,Pe=n.unstable_cancelCallback,Fe=n.unstable_shouldYield,xt=n.unstable_requestPaint,He=n.unstable_now,hn=n.unstable_getCurrentPriorityLevel,St=n.unstable_ImmediatePriority,Gt=n.unstable_UserBlockingPriority,Dn=n.unstable_NormalPriority,fa=n.unstable_LowPriority,Cn=n.unstable_IdlePriority,_i=n.log,At=n.unstable_setDisableYieldValue,dt=null,Xe=null;function wt(e){if(typeof _i=="function"&&At(e),Xe&&typeof Xe.setStrictMode=="function")try{Xe.setStrictMode(dt,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 vr=256,br=262144,xr=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 Sr(e,t,a){var l=e.pendingLanes;if(l===0)return 0;var u=0,f=e.suspendedLanes,p=e.pingedLanes;e=e.warmLanes;var y=l&134217727;return y!==0?(l=y&~f,l!==0?u=ki(l):(p&=y,p!==0?u=ki(p):a||(a=y&~e,a!==0&&(u=ki(a))))):(y=l&~f,y!==0?u=ki(y):p!==0?u=ki(p):a||(a=l&~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 hv(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 Hf(){var e=xr;return xr<<=1,(xr&62914560)===0&&(xr=4194304),e}function mo(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 pv(e,t,a,l,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 y=e.entanglements,S=e.expirationTimes,C=e.hiddenUpdates;for(a=p&~a;0<a;){var G=31-tt(a),V=1<<G;y[G]=0,S[G]=-1;var z=C[G];if(z!==null)for(C[G]=null,G=0;G<z.length;G++){var N=z[G];N!==null&&(N.lane&=-536870913)}a&=~V}l!==0&&qf(e,l,0),f!==0&&u===0&&e.tag!==0&&(e.suspendedLanes|=f&~(p&~t))}function qf(e,t,a){e.pendingLanes|=t,e.suspendedLanes&=~t;var l=31-tt(t);e.entangledLanes|=t,e.entanglements[l]=e.entanglements[l]|1073741824|a&261930}function Yf(e,t){var a=e.entangledLanes|=t;for(e=e.entanglements;a;){var l=31-tt(a),u=1<<l;u&t|e[l]&t&&(e[l]|=t),a&=~u}}function Xf(e,t){var a=t&-t;return a=(a&42)!==0?1:go(a),(a&(e.suspendedLanes|t))!==0?0:a}function go(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 yo(e){return e&=-e,2<e?8<e?(e&134217727)!==0?32:268435456:8:2}function Kf(){var e=P.p;return e!==0?e:(e=window.event,e===void 0?32:Um(e.type))}function Pf(e,t){var a=P.p;try{return P.p=e,t()}finally{P.p=a}}var Jn=Math.random().toString(36).slice(2),mt="__reactFiber$"+Jn,Ct="__reactProps$"+Jn,da="__reactContainer$"+Jn,vo="__reactEvents$"+Jn,mv="__reactListeners$"+Jn,gv="__reactHandles$"+Jn,Qf="__reactResources$"+Jn,ds="__reactMarker$"+Jn;function bo(e){delete e[mt],delete e[Ct],delete e[vo],delete e[mv],delete e[gv]}function ha(e){var t=e[mt];if(t)return t;for(var a=e.parentNode;a;){if(t=a[da]||a[mt]){if(a=t.alternate,t.child!==null||a!==null&&a.child!==null)for(e=ym(e);e!==null;){if(a=e[mt])return a;e=ym(e)}return t}e=a,a=e.parentNode}return null}function pa(e){if(e=e[mt]||e[da]){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(r(33))}function ma(e){var t=e[Qf];return t||(t=e[Qf]={hoistableStyles:new Map,hoistableScripts:new Map}),t}function ht(e){e[ds]=!0}var Zf=new Set,Wf={};function Li(e,t){ga(e,t),ga(e+"Capture",t)}function ga(e,t){for(Wf[e]=t,e=0;e<t.length;e++)Zf.add(t[e])}var yv=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]*$"),Jf={},ed={};function vv(e){return ye.call(ed,e)?!0:ye.call(Jf,e)?!1:yv.test(e)?ed[e]=!0:(Jf[e]=!0,!1)}function wr(e,t,a){if(vv(t))if(a===null)e.removeAttribute(t);else{switch(typeof a){case"undefined":case"function":case"symbol":e.removeAttribute(t);return;case"boolean":var l=t.toLowerCase().slice(0,5);if(l!=="data-"&&l!=="aria-"){e.removeAttribute(t);return}}e.setAttribute(t,""+a)}}function Er(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 On(e,t,a,l){if(l===null)e.removeAttribute(a);else{switch(typeof l){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(a);return}e.setAttributeNS(t,a,""+l)}}function Zt(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function td(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function bv(e,t,a){var l=Object.getOwnPropertyDescriptor(e.constructor.prototype,t);if(!e.hasOwnProperty(t)&&typeof l<"u"&&typeof l.get=="function"&&typeof l.set=="function"){var u=l.get,f=l.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:l.enumerable}),{getValue:function(){return a},setValue:function(p){a=""+p},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function xo(e){if(!e._valueTracker){var t=td(e)?"checked":"value";e._valueTracker=bv(e,t,""+e[t])}}function nd(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var a=t.getValue(),l="";return e&&(l=td(e)?e.checked?"true":"false":e.value),e=l,e!==a?(t.setValue(e),!0):!1}function Tr(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 xv=/[\n"\\]/g;function Wt(e){return e.replace(xv,function(t){return"\\"+t.charCodeAt(0).toString(16)+" "})}function So(e,t,a,l,u,f,p,y){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=""+Zt(t)):e.value!==""+Zt(t)&&(e.value=""+Zt(t)):p!=="submit"&&p!=="reset"||e.removeAttribute("value"),t!=null?wo(e,p,Zt(t)):a!=null?wo(e,p,Zt(a)):l!=null&&e.removeAttribute("value"),u==null&&f!=null&&(e.defaultChecked=!!f),u!=null&&(e.checked=u&&typeof u!="function"&&typeof u!="symbol"),y!=null&&typeof y!="function"&&typeof y!="symbol"&&typeof y!="boolean"?e.name=""+Zt(y):e.removeAttribute("name")}function id(e,t,a,l,u,f,p,y){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)){xo(e);return}a=a!=null?""+Zt(a):"",t=t!=null?""+Zt(t):a,y||t===e.value||(e.value=t),e.defaultValue=t}l=l??u,l=typeof l!="function"&&typeof l!="symbol"&&!!l,e.checked=y?e.checked:!!l,e.defaultChecked=!!l,p!=null&&typeof p!="function"&&typeof p!="symbol"&&typeof p!="boolean"&&(e.name=p),xo(e)}function wo(e,t,a){t==="number"&&Tr(e.ownerDocument)===e||e.defaultValue===""+a||(e.defaultValue=""+a)}function ya(e,t,a,l){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&&l&&(e[a].defaultSelected=!0)}else{for(a=""+Zt(a),t=null,u=0;u<e.length;u++){if(e[u].value===a){e[u].selected=!0,l&&(e[u].defaultSelected=!0);return}t!==null||e[u].disabled||(t=e[u])}t!==null&&(t.selected=!0)}}function ad(e,t,a){if(t!=null&&(t=""+Zt(t),t!==e.value&&(e.value=t),a==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=a!=null?""+Zt(a):""}function sd(e,t,a,l){if(t==null){if(l!=null){if(a!=null)throw Error(r(92));if(ce(l)){if(1<l.length)throw Error(r(93));l=l[0]}a=l}a==null&&(a=""),t=a}a=Zt(t),e.defaultValue=a,l=e.textContent,l===a&&l!==""&&l!==null&&(e.value=l),xo(e)}function va(e,t){if(t){var a=e.firstChild;if(a&&a===e.lastChild&&a.nodeType===3){a.nodeValue=t;return}}e.textContent=t}var Sv=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 rd(e,t,a){var l=t.indexOf("--")===0;a==null||typeof a=="boolean"||a===""?l?e.setProperty(t,""):t==="float"?e.cssFloat="":e[t]="":l?e.setProperty(t,a):typeof a!="number"||a===0||Sv.has(t)?t==="float"?e.cssFloat=a:e[t]=(""+a).trim():e[t]=a+"px"}function ld(e,t,a){if(t!=null&&typeof t!="object")throw Error(r(62));if(e=e.style,a!=null){for(var l in a)!a.hasOwnProperty(l)||t!=null&&t.hasOwnProperty(l)||(l.indexOf("--")===0?e.setProperty(l,""):l==="float"?e.cssFloat="":e[l]="");for(var u in t)l=t[u],t.hasOwnProperty(u)&&a[u]!==l&&rd(e,u,l)}else for(var f in t)t.hasOwnProperty(f)&&rd(e,f,t[f])}function Eo(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 wv=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"]]),Ev=/^[\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 Ar(e){return Ev.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function zn(){}var To=null;function Ao(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var ba=null,xa=null;function od(e){var t=pa(e);if(t&&(e=t.stateNode)){var a=e[Ct]||null;e:switch(e=t.stateNode,t.type){case"input":if(So(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="'+Wt(""+t)+'"][type="radio"]'),t=0;t<a.length;t++){var l=a[t];if(l!==e&&l.form===e.form){var u=l[Ct]||null;if(!u)throw Error(r(90));So(l,u.value,u.defaultValue,u.defaultValue,u.checked,u.defaultChecked,u.type,u.name)}}for(t=0;t<a.length;t++)l=a[t],l.form===e.form&&nd(l)}break e;case"textarea":ad(e,a.value,a.defaultValue);break e;case"select":t=a.value,t!=null&&ya(e,!!a.multiple,t,!1)}}}var Mo=!1;function ud(e,t,a){if(Mo)return e(t,a);Mo=!0;try{var l=e(t);return l}finally{if(Mo=!1,(ba!==null||xa!==null)&&(dl(),ba&&(t=ba,e=xa,xa=ba=null,od(t),e)))for(t=0;t<e.length;t++)od(e[t])}}function ps(e,t){var a=e.stateNode;if(a===null)return null;var l=a[Ct]||null;if(l===null)return null;a=l[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":(l=!l.disabled)||(e=e.type,l=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!l;break e;default:e=!1}if(e)return null;if(a&&typeof a!="function")throw Error(r(231,t,typeof a));return a}var _n=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Ro=!1;if(_n)try{var ms={};Object.defineProperty(ms,"passive",{get:function(){Ro=!0}}),window.addEventListener("test",ms,ms),window.removeEventListener("test",ms,ms)}catch{Ro=!1}var ei=null,Do=null,Mr=null;function cd(){if(Mr)return Mr;var e,t=Do,a=t.length,l,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(l=1;l<=p&&t[a-l]===u[f-l];l++);return Mr=u.slice(e,1<l?1-l:void 0)}function Rr(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 Dr(){return!0}function fd(){return!1}function Ot(e){function t(a,l,u,f,p){this._reactName=a,this._targetInst=u,this.type=l,this.nativeEvent=f,this.target=p,this.currentTarget=null;for(var y in e)e.hasOwnProperty(y)&&(a=e[y],this[y]=a?a(f):f[y]);return this.isDefaultPrevented=(f.defaultPrevented!=null?f.defaultPrevented:f.returnValue===!1)?Dr:fd,this.isPropagationStopped=fd,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=Dr)},stopPropagation:function(){var a=this.nativeEvent;a&&(a.stopPropagation?a.stopPropagation():typeof a.cancelBubble!="unknown"&&(a.cancelBubble=!0),this.isPropagationStopped=Dr)},persist:function(){},isPersistent:Dr}),t}var ji={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Cr=Ot(ji),gs=b({},ji,{view:0,detail:0}),Tv=Ot(gs),Co,Oo,ys,Or=b({},gs,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:_o,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"?(Co=e.screenX-ys.screenX,Oo=e.screenY-ys.screenY):Oo=Co=0,ys=e),Co)},movementY:function(e){return"movementY"in e?e.movementY:Oo}}),dd=Ot(Or),Av=b({},Or,{dataTransfer:0}),Mv=Ot(Av),Rv=b({},gs,{relatedTarget:0}),zo=Ot(Rv),Dv=b({},ji,{animationName:0,elapsedTime:0,pseudoElement:0}),Cv=Ot(Dv),Ov=b({},ji,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),zv=Ot(Ov),_v=b({},ji,{data:0}),hd=Ot(_v),Uv={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Nv={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"},kv={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Lv(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=kv[e])?!!t[e]:!1}function _o(){return Lv}var jv=b({},gs,{key:function(e){if(e.key){var t=Uv[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=Rr(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?Nv[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:_o,charCode:function(e){return e.type==="keypress"?Rr(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?Rr(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),Bv=Ot(jv),Gv=b({},Or,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),pd=Ot(Gv),$v=b({},gs,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:_o}),Iv=Ot($v),Vv=b({},ji,{propertyName:0,elapsedTime:0,pseudoElement:0}),Fv=Ot(Vv),Hv=b({},Or,{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}),qv=Ot(Hv),Yv=b({},ji,{newState:0,oldState:0}),Xv=Ot(Yv),Kv=[9,13,27,32],Uo=_n&&"CompositionEvent"in window,vs=null;_n&&"documentMode"in document&&(vs=document.documentMode);var Pv=_n&&"TextEvent"in window&&!vs,md=_n&&(!Uo||vs&&8<vs&&11>=vs),gd=" ",yd=!1;function vd(e,t){switch(e){case"keyup":return Kv.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function bd(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Sa=!1;function Qv(e,t){switch(e){case"compositionend":return bd(t);case"keypress":return t.which!==32?null:(yd=!0,gd);case"textInput":return e=t.data,e===gd&&yd?null:e;default:return null}}function Zv(e,t){if(Sa)return e==="compositionend"||!Uo&&vd(e,t)?(e=cd(),Mr=Do=ei=null,Sa=!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 md&&t.locale!=="ko"?null:t.data;default:return null}}var Wv={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 xd(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!Wv[e.type]:t==="textarea"}function Sd(e,t,a,l){ba?xa?xa.push(l):xa=[l]:ba=l,t=bl(t,"onChange"),0<t.length&&(a=new Cr("onChange","change",null,a,l),e.push({event:a,listeners:t}))}var bs=null,xs=null;function Jv(e){im(e,0)}function zr(e){var t=hs(e);if(nd(t))return e}function wd(e,t){if(e==="change")return t}var Ed=!1;if(_n){var No;if(_n){var ko="oninput"in document;if(!ko){var Td=document.createElement("div");Td.setAttribute("oninput","return;"),ko=typeof Td.oninput=="function"}No=ko}else No=!1;Ed=No&&(!document.documentMode||9<document.documentMode)}function Ad(){bs&&(bs.detachEvent("onpropertychange",Md),xs=bs=null)}function Md(e){if(e.propertyName==="value"&&zr(xs)){var t=[];Sd(t,xs,e,Ao(e)),ud(Jv,t)}}function eb(e,t,a){e==="focusin"?(Ad(),bs=t,xs=a,bs.attachEvent("onpropertychange",Md)):e==="focusout"&&Ad()}function tb(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return zr(xs)}function nb(e,t){if(e==="click")return zr(t)}function ib(e,t){if(e==="input"||e==="change")return zr(t)}function ab(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var $t=typeof Object.is=="function"?Object.is:ab;function Ss(e,t){if($t(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;var a=Object.keys(e),l=Object.keys(t);if(a.length!==l.length)return!1;for(l=0;l<a.length;l++){var u=a[l];if(!ye.call(t,u)||!$t(e[u],t[u]))return!1}return!0}function Rd(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Dd(e,t){var a=Rd(e);e=0;for(var l;a;){if(a.nodeType===3){if(l=e+a.textContent.length,e<=t&&l>=t)return{node:a,offset:t-e};e=l}e:{for(;a;){if(a.nextSibling){a=a.nextSibling;break e}a=a.parentNode}a=void 0}a=Rd(a)}}function Cd(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Cd(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Od(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=Tr(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=Tr(e.document)}return t}function Lo(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 sb=_n&&"documentMode"in document&&11>=document.documentMode,wa=null,jo=null,ws=null,Bo=!1;function zd(e,t,a){var l=a.window===a?a.document:a.nodeType===9?a:a.ownerDocument;Bo||wa==null||wa!==Tr(l)||(l=wa,"selectionStart"in l&&Lo(l)?l={start:l.selectionStart,end:l.selectionEnd}:(l=(l.ownerDocument&&l.ownerDocument.defaultView||window).getSelection(),l={anchorNode:l.anchorNode,anchorOffset:l.anchorOffset,focusNode:l.focusNode,focusOffset:l.focusOffset}),ws&&Ss(ws,l)||(ws=l,l=bl(jo,"onSelect"),0<l.length&&(t=new Cr("onSelect","select",null,t,a),e.push({event:t,listeners:l}),t.target=wa)))}function Bi(e,t){var a={};return a[e.toLowerCase()]=t.toLowerCase(),a["Webkit"+e]="webkit"+t,a["Moz"+e]="moz"+t,a}var Ea={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")},Go={},_d={};_n&&(_d=document.createElement("div").style,"AnimationEvent"in window||(delete Ea.animationend.animation,delete Ea.animationiteration.animation,delete Ea.animationstart.animation),"TransitionEvent"in window||delete Ea.transitionend.transition);function Gi(e){if(Go[e])return Go[e];if(!Ea[e])return e;var t=Ea[e],a;for(a in t)if(t.hasOwnProperty(a)&&a in _d)return Go[e]=t[a];return e}var Ud=Gi("animationend"),Nd=Gi("animationiteration"),kd=Gi("animationstart"),rb=Gi("transitionrun"),lb=Gi("transitionstart"),ob=Gi("transitioncancel"),Ld=Gi("transitionend"),jd=new Map,$o="abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");$o.push("scrollEnd");function pn(e,t){jd.set(e,t),Li(t,[e])}var _r=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)},Jt=[],Ta=0,Io=0;function Ur(){for(var e=Ta,t=Io=Ta=0;t<e;){var a=Jt[t];Jt[t++]=null;var l=Jt[t];Jt[t++]=null;var u=Jt[t];Jt[t++]=null;var f=Jt[t];if(Jt[t++]=null,l!==null&&u!==null){var p=l.pending;p===null?u.next=u:(u.next=p.next,p.next=u),l.pending=u}f!==0&&Bd(a,u,f)}}function Nr(e,t,a,l){Jt[Ta++]=e,Jt[Ta++]=t,Jt[Ta++]=a,Jt[Ta++]=l,Io|=l,e.lanes|=l,e=e.alternate,e!==null&&(e.lanes|=l)}function Vo(e,t,a,l){return Nr(e,t,a,l),kr(e)}function $i(e,t){return Nr(e,null,null,t),kr(e)}function Bd(e,t,a){e.lanes|=a;var l=e.alternate;l!==null&&(l.lanes|=a);for(var u=!1,f=e.return;f!==null;)f.childLanes|=a,l=f.alternate,l!==null&&(l.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,l=e[u],l===null?e[u]=[t]:l.push(t),t.lane=a|536870912),f):null}function kr(e){if(50<Hs)throw Hs=0,Zu=null,Error(r(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var Aa={};function ub(e,t,a,l){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=l,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function It(e,t,a,l){return new ub(e,t,a,l)}function Fo(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Un(e,t){var a=e.alternate;return a===null?(a=It(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 Gd(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 Lr(e,t,a,l,u,f){var p=0;if(l=e,typeof e=="function")Fo(e)&&(p=1);else if(typeof e=="string")p=px(e,a,J.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(e){case $:return e=It(31,a,t,u),e.elementType=$,e.lanes=f,e;case L:return Ii(a.children,u,f,t);case _:p=8,u|=24;break;case H:return e=It(12,a,t,u|2),e.elementType=H,e.lanes=f,e;case Y:return e=It(13,a,t,u),e.elementType=Y,e.lanes=f,e;case A:return e=It(19,a,t,u),e.elementType=A,e.lanes=f,e;default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case K:p=10;break e;case Z:p=9;break e;case F:p=11;break e;case k:p=14;break e;case w:p=16,l=null;break e}p=29,a=Error(r(130,e===null?"null":typeof e,"")),l=null}return t=It(p,a,t,u),t.elementType=e,t.type=l,t.lanes=f,t}function Ii(e,t,a,l){return e=It(7,e,l,t),e.lanes=a,e}function Ho(e,t,a){return e=It(6,e,null,t),e.lanes=a,e}function $d(e){var t=It(18,null,null,0);return t.stateNode=e,t}function qo(e,t,a){return t=It(4,e.children!==null?e.children:[],e.key,t),t.lanes=a,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var Id=new WeakMap;function en(e,t){if(typeof e=="object"&&e!==null){var a=Id.get(e);return a!==void 0?a:(t={value:e,source:t,stack:W(t)},Id.set(e,t),t)}return{value:e,source:t,stack:W(t)}}var Ma=[],Ra=0,jr=null,Es=0,tn=[],nn=0,ti=null,bn=1,xn="";function Nn(e,t){Ma[Ra++]=Es,Ma[Ra++]=jr,jr=e,Es=t}function Vd(e,t,a){tn[nn++]=bn,tn[nn++]=xn,tn[nn++]=ti,ti=e;var l=bn;e=xn;var u=32-tt(l)-1;l&=~(1<<u),a+=1;var f=32-tt(t)+u;if(30<f){var p=u-u%5;f=(l&(1<<p)-1).toString(32),l>>=p,u-=p,bn=1<<32-tt(t)+u|a<<u|l,xn=f+e}else bn=1<<f|a<<u|l,xn=e}function Yo(e){e.return!==null&&(Nn(e,1),Vd(e,1,0))}function Xo(e){for(;e===jr;)jr=Ma[--Ra],Ma[Ra]=null,Es=Ma[--Ra],Ma[Ra]=null;for(;e===ti;)ti=tn[--nn],tn[nn]=null,xn=tn[--nn],tn[nn]=null,bn=tn[--nn],tn[nn]=null}function Fd(e,t){tn[nn++]=bn,tn[nn++]=xn,tn[nn++]=ti,bn=t.id,xn=t.overflow,ti=e}var gt=null,qe=null,Re=!1,ni=null,an=!1,Ko=Error(r(519));function ii(e){var t=Error(r(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Ts(en(t,e)),Ko}function Hd(e){var t=e.stateNode,a=e.type,l=e.memoizedProps;switch(t[mt]=e,t[Ct]=l,a){case"dialog":we("cancel",t),we("close",t);break;case"iframe":case"object":case"embed":we("load",t);break;case"video":case"audio":for(a=0;a<Ys.length;a++)we(Ys[a],t);break;case"source":we("error",t);break;case"img":case"image":case"link":we("error",t),we("load",t);break;case"details":we("toggle",t);break;case"input":we("invalid",t),id(t,l.value,l.defaultValue,l.checked,l.defaultChecked,l.type,l.name,!0);break;case"select":we("invalid",t);break;case"textarea":we("invalid",t),sd(t,l.value,l.defaultValue,l.children)}a=l.children,typeof a!="string"&&typeof a!="number"&&typeof a!="bigint"||t.textContent===""+a||l.suppressHydrationWarning===!0||lm(t.textContent,a)?(l.popover!=null&&(we("beforetoggle",t),we("toggle",t)),l.onScroll!=null&&we("scroll",t),l.onScrollEnd!=null&&we("scrollend",t),l.onClick!=null&&(t.onclick=zn),t=!0):t=!1,t||ii(e,!0)}function qd(e){for(gt=e.return;gt;)switch(gt.tag){case 5:case 31:case 13:an=!1;return;case 27:case 3:an=!0;return;default:gt=gt.return}}function Da(e){if(e!==gt)return!1;if(!Re)return qd(e),Re=!0,!1;var t=e.tag,a;if((a=t!==3&&t!==27)&&((a=t===5)&&(a=e.type,a=!(a!=="form"&&a!=="button")||dc(e.type,e.memoizedProps)),a=!a),a&&qe&&ii(e),qd(e),t===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(r(317));qe=gm(e)}else if(t===31){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(r(317));qe=gm(e)}else t===27?(t=qe,yi(e.type)?(e=yc,yc=null,qe=e):qe=t):qe=gt?rn(e.stateNode.nextSibling):null;return!0}function Vi(){qe=gt=null,Re=!1}function Po(){var e=ni;return e!==null&&(Nt===null?Nt=e:Nt.push.apply(Nt,e),ni=null),e}function Ts(e){ni===null?ni=[e]:ni.push(e)}var Qo=T(null),Fi=null,kn=null;function ai(e,t,a){q(Qo,t._currentValue),t._currentValue=a}function Ln(e){e._currentValue=Qo.current,j(Qo)}function Zo(e,t,a){for(;e!==null;){var l=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,l!==null&&(l.childLanes|=t)):l!==null&&(l.childLanes&t)!==t&&(l.childLanes|=t),e===a)break;e=e.return}}function Wo(e,t,a,l){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 y=f;f=u;for(var S=0;S<t.length;S++)if(y.context===t[S]){f.lanes|=a,y=f.alternate,y!==null&&(y.lanes|=a),Zo(f.return,a,e),l||(p=null);break e}f=y.next}}else if(u.tag===18){if(p=u.return,p===null)throw Error(r(341));p.lanes|=a,f=p.alternate,f!==null&&(f.lanes|=a),Zo(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 Ca(e,t,a,l){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(r(387));if(p=p.memoizedProps,p!==null){var y=u.type;$t(u.pendingProps.value,p.value)||(e!==null?e.push(y):e=[y])}}else if(u===ge.current){if(p=u.alternate,p===null)throw Error(r(387));p.memoizedState.memoizedState!==u.memoizedState.memoizedState&&(e!==null?e.push(Zs):e=[Zs])}u=u.return}e!==null&&Wo(t,e,a,l),t.flags|=262144}function Br(e){for(e=e.firstContext;e!==null;){if(!$t(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function Hi(e){Fi=e,kn=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function yt(e){return Yd(Fi,e)}function Gr(e,t){return Fi===null&&Hi(e),Yd(e,t)}function Yd(e,t){var a=t._currentValue;if(t={context:t,memoizedValue:a,next:null},kn===null){if(e===null)throw Error(r(308));kn=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else kn=kn.next=t;return a}var cb=typeof AbortController<"u"?AbortController:function(){var e=[],t=this.signal={aborted:!1,addEventListener:function(a,l){e.push(l)}};this.abort=function(){t.aborted=!0,e.forEach(function(a){return a()})}},fb=n.unstable_scheduleCallback,db=n.unstable_NormalPriority,rt={$$typeof:K,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Jo(){return{controller:new cb,data:new Map,refCount:0}}function As(e){e.refCount--,e.refCount===0&&fb(db,function(){e.controller.abort()})}var Ms=null,eu=0,Oa=0,za=null;function hb(e,t){if(Ms===null){var a=Ms=[];eu=0,Oa=ic(),za={status:"pending",value:void 0,then:function(l){a.push(l)}}}return eu++,t.then(Xd,Xd),t}function Xd(){if(--eu===0&&Ms!==null){za!==null&&(za.status="fulfilled");var e=Ms;Ms=null,Oa=0,za=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function pb(e,t){var a=[],l={status:"pending",value:null,reason:null,then:function(u){a.push(u)}};return e.then(function(){l.status="fulfilled",l.value=t;for(var u=0;u<a.length;u++)(0,a[u])(t)},function(u){for(l.status="rejected",l.reason=u,u=0;u<a.length;u++)(0,a[u])(void 0)}),l}var Kd=U.S;U.S=function(e,t){zp=He(),typeof t=="object"&&t!==null&&typeof t.then=="function"&&hb(e,t),Kd!==null&&Kd(e,t)};var qi=T(null);function tu(){var e=qi.current;return e!==null?e:Ve.pooledCache}function $r(e,t){t===null?q(qi,qi.current):q(qi,t.pool)}function Pd(){var e=tu();return e===null?null:{parent:rt._currentValue,pool:e}}var _a=Error(r(460)),nu=Error(r(474)),Ir=Error(r(542)),Vr={then:function(){}};function Qd(e){return e=e.status,e==="fulfilled"||e==="rejected"}function Zd(e,t,a){switch(a=e[a],a===void 0?e.push(t):a!==t&&(t.then(zn,zn),t=a),t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,Jd(e),e;default:if(typeof t.status=="string")t.then(zn,zn);else{if(e=Ve,e!==null&&100<e.shellSuspendCounter)throw Error(r(482));e=t,e.status="pending",e.then(function(l){if(t.status==="pending"){var u=t;u.status="fulfilled",u.value=l}},function(l){if(t.status==="pending"){var u=t;u.status="rejected",u.reason=l}})}switch(t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,Jd(e),e}throw Xi=t,_a}}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,_a):a}}var Xi=null;function Wd(){if(Xi===null)throw Error(r(459));var e=Xi;return Xi=null,e}function Jd(e){if(e===_a||e===Ir)throw Error(r(483))}var Ua=null,Rs=0;function Fr(e){var t=Rs;return Rs+=1,Ua===null&&(Ua=[]),Zd(Ua,e,t)}function Ds(e,t){t=t.props.ref,e.ref=t!==void 0?t:null}function Hr(e,t){throw t.$$typeof===R?Error(r(525)):(e=Object.prototype.toString.call(t),Error(r(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e)))}function eh(e){function t(M,E){if(e){var D=M.deletions;D===null?(M.deletions=[E],M.flags|=16):D.push(E)}}function a(M,E){if(!e)return null;for(;E!==null;)t(M,E),E=E.sibling;return null}function l(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=Un(M,E),M.index=0,M.sibling=null,M}function f(M,E,D){return M.index=D,e?(D=M.alternate,D!==null?(D=D.index,D<E?(M.flags|=67108866,E):D):(M.flags|=67108866,E)):(M.flags|=1048576,E)}function p(M){return e&&M.alternate===null&&(M.flags|=67108866),M}function y(M,E,D,I){return E===null||E.tag!==6?(E=Ho(D,M.mode,I),E.return=M,E):(E=u(E,D),E.return=M,E)}function S(M,E,D,I){var ue=D.type;return ue===L?G(M,E,D.props.children,I,D.key):E!==null&&(E.elementType===ue||typeof ue=="object"&&ue!==null&&ue.$$typeof===w&&Yi(ue)===E.type)?(E=u(E,D.props),Ds(E,D),E.return=M,E):(E=Lr(D.type,D.key,D.props,null,M.mode,I),Ds(E,D),E.return=M,E)}function C(M,E,D,I){return E===null||E.tag!==4||E.stateNode.containerInfo!==D.containerInfo||E.stateNode.implementation!==D.implementation?(E=qo(D,M.mode,I),E.return=M,E):(E=u(E,D.children||[]),E.return=M,E)}function G(M,E,D,I,ue){return E===null||E.tag!==7?(E=Ii(D,M.mode,I,ue),E.return=M,E):(E=u(E,D),E.return=M,E)}function V(M,E,D){if(typeof E=="string"&&E!==""||typeof E=="number"||typeof E=="bigint")return E=Ho(""+E,M.mode,D),E.return=M,E;if(typeof E=="object"&&E!==null){switch(E.$$typeof){case B:return D=Lr(E.type,E.key,E.props,null,M.mode,D),Ds(D,E),D.return=M,D;case O:return E=qo(E,M.mode,D),E.return=M,E;case w:return E=Yi(E),V(M,E,D)}if(ce(E)||oe(E))return E=Ii(E,M.mode,D,null),E.return=M,E;if(typeof E.then=="function")return V(M,Fr(E),D);if(E.$$typeof===K)return V(M,Gr(M,E),D);Hr(M,E)}return null}function z(M,E,D,I){var ue=E!==null?E.key:null;if(typeof D=="string"&&D!==""||typeof D=="number"||typeof D=="bigint")return ue!==null?null:y(M,E,""+D,I);if(typeof D=="object"&&D!==null){switch(D.$$typeof){case B:return D.key===ue?S(M,E,D,I):null;case O:return D.key===ue?C(M,E,D,I):null;case w:return D=Yi(D),z(M,E,D,I)}if(ce(D)||oe(D))return ue!==null?null:G(M,E,D,I,null);if(typeof D.then=="function")return z(M,E,Fr(D),I);if(D.$$typeof===K)return z(M,E,Gr(M,D),I);Hr(M,D)}return null}function N(M,E,D,I,ue){if(typeof I=="string"&&I!==""||typeof I=="number"||typeof I=="bigint")return M=M.get(D)||null,y(E,M,""+I,ue);if(typeof I=="object"&&I!==null){switch(I.$$typeof){case B:return M=M.get(I.key===null?D:I.key)||null,S(E,M,I,ue);case O:return M=M.get(I.key===null?D:I.key)||null,C(E,M,I,ue);case w:return I=Yi(I),N(M,E,D,I,ue)}if(ce(I)||oe(I))return M=M.get(D)||null,G(E,M,I,ue,null);if(typeof I.then=="function")return N(M,E,D,Fr(I),ue);if(I.$$typeof===K)return N(M,E,D,Gr(E,I),ue);Hr(E,I)}return null}function ne(M,E,D,I){for(var ue=null,ze=null,re=E,be=E=0,Me=null;re!==null&&be<D.length;be++){re.index>be?(Me=re,re=null):Me=re.sibling;var _e=z(M,re,D[be],I);if(_e===null){re===null&&(re=Me);break}e&&re&&_e.alternate===null&&t(M,re),E=f(_e,E,be),ze===null?ue=_e:ze.sibling=_e,ze=_e,re=Me}if(be===D.length)return a(M,re),Re&&Nn(M,be),ue;if(re===null){for(;be<D.length;be++)re=V(M,D[be],I),re!==null&&(E=f(re,E,be),ze===null?ue=re:ze.sibling=re,ze=re);return Re&&Nn(M,be),ue}for(re=l(re);be<D.length;be++)Me=N(re,M,be,D[be],I),Me!==null&&(e&&Me.alternate!==null&&re.delete(Me.key===null?be:Me.key),E=f(Me,E,be),ze===null?ue=Me:ze.sibling=Me,ze=Me);return e&&re.forEach(function(wi){return t(M,wi)}),Re&&Nn(M,be),ue}function fe(M,E,D,I){if(D==null)throw Error(r(151));for(var ue=null,ze=null,re=E,be=E=0,Me=null,_e=D.next();re!==null&&!_e.done;be++,_e=D.next()){re.index>be?(Me=re,re=null):Me=re.sibling;var wi=z(M,re,_e.value,I);if(wi===null){re===null&&(re=Me);break}e&&re&&wi.alternate===null&&t(M,re),E=f(wi,E,be),ze===null?ue=wi:ze.sibling=wi,ze=wi,re=Me}if(_e.done)return a(M,re),Re&&Nn(M,be),ue;if(re===null){for(;!_e.done;be++,_e=D.next())_e=V(M,_e.value,I),_e!==null&&(E=f(_e,E,be),ze===null?ue=_e:ze.sibling=_e,ze=_e);return Re&&Nn(M,be),ue}for(re=l(re);!_e.done;be++,_e=D.next())_e=N(re,M,be,_e.value,I),_e!==null&&(e&&_e.alternate!==null&&re.delete(_e.key===null?be:_e.key),E=f(_e,E,be),ze===null?ue=_e:ze.sibling=_e,ze=_e);return e&&re.forEach(function(Ax){return t(M,Ax)}),Re&&Nn(M,be),ue}function Ge(M,E,D,I){if(typeof D=="object"&&D!==null&&D.type===L&&D.key===null&&(D=D.props.children),typeof D=="object"&&D!==null){switch(D.$$typeof){case B:e:{for(var ue=D.key;E!==null;){if(E.key===ue){if(ue=D.type,ue===L){if(E.tag===7){a(M,E.sibling),I=u(E,D.props.children),I.return=M,M=I;break e}}else if(E.elementType===ue||typeof ue=="object"&&ue!==null&&ue.$$typeof===w&&Yi(ue)===E.type){a(M,E.sibling),I=u(E,D.props),Ds(I,D),I.return=M,M=I;break e}a(M,E);break}else t(M,E);E=E.sibling}D.type===L?(I=Ii(D.props.children,M.mode,I,D.key),I.return=M,M=I):(I=Lr(D.type,D.key,D.props,null,M.mode,I),Ds(I,D),I.return=M,M=I)}return p(M);case O:e:{for(ue=D.key;E!==null;){if(E.key===ue)if(E.tag===4&&E.stateNode.containerInfo===D.containerInfo&&E.stateNode.implementation===D.implementation){a(M,E.sibling),I=u(E,D.children||[]),I.return=M,M=I;break e}else{a(M,E);break}else t(M,E);E=E.sibling}I=qo(D,M.mode,I),I.return=M,M=I}return p(M);case w:return D=Yi(D),Ge(M,E,D,I)}if(ce(D))return ne(M,E,D,I);if(oe(D)){if(ue=oe(D),typeof ue!="function")throw Error(r(150));return D=ue.call(D),fe(M,E,D,I)}if(typeof D.then=="function")return Ge(M,E,Fr(D),I);if(D.$$typeof===K)return Ge(M,E,Gr(M,D),I);Hr(M,D)}return typeof D=="string"&&D!==""||typeof D=="number"||typeof D=="bigint"?(D=""+D,E!==null&&E.tag===6?(a(M,E.sibling),I=u(E,D),I.return=M,M=I):(a(M,E),I=Ho(D,M.mode,I),I.return=M,M=I),p(M)):a(M,E)}return function(M,E,D,I){try{Rs=0;var ue=Ge(M,E,D,I);return Ua=null,ue}catch(re){if(re===_a||re===Ir)throw re;var ze=It(29,re,null,M.mode);return ze.lanes=I,ze.return=M,ze}}}var Ki=eh(!0),th=eh(!1),si=!1;function iu(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function au(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 l=e.updateQueue;if(l===null)return null;if(l=l.shared,(Ue&2)!==0){var u=l.pending;return u===null?t.next=t:(t.next=u.next,u.next=t),l.pending=t,t=kr(e),Bd(e,null,a),t}return Nr(e,l,t,a),kr(e)}function Cs(e,t,a){if(t=t.updateQueue,t!==null&&(t=t.shared,(a&4194048)!==0)){var l=t.lanes;l&=e.pendingLanes,a|=l,t.lanes=a,Yf(e,a)}}function su(e,t){var a=e.updateQueue,l=e.alternate;if(l!==null&&(l=l.updateQueue,a===l)){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:l.baseState,firstBaseUpdate:u,lastBaseUpdate:f,shared:l.shared,callbacks:l.callbacks},e.updateQueue=a;return}e=a.lastBaseUpdate,e===null?a.firstBaseUpdate=t:e.next=t,a.lastBaseUpdate=t}var ru=!1;function Os(){if(ru){var e=za;if(e!==null)throw e}}function zs(e,t,a,l){ru=!1;var u=e.updateQueue;si=!1;var f=u.firstBaseUpdate,p=u.lastBaseUpdate,y=u.shared.pending;if(y!==null){u.shared.pending=null;var S=y,C=S.next;S.next=null,p===null?f=C:p.next=C,p=S;var G=e.alternate;G!==null&&(G=G.updateQueue,y=G.lastBaseUpdate,y!==p&&(y===null?G.firstBaseUpdate=C:y.next=C,G.lastBaseUpdate=S))}if(f!==null){var V=u.baseState;p=0,G=C=S=null,y=f;do{var z=y.lane&-536870913,N=z!==y.lane;if(N?(Ae&z)===z:(l&z)===z){z!==0&&z===Oa&&(ru=!0),G!==null&&(G=G.next={lane:0,tag:y.tag,payload:y.payload,callback:null,next:null});e:{var ne=e,fe=y;z=t;var Ge=a;switch(fe.tag){case 1:if(ne=fe.payload,typeof ne=="function"){V=ne.call(Ge,V,z);break e}V=ne;break e;case 3:ne.flags=ne.flags&-65537|128;case 0:if(ne=fe.payload,z=typeof ne=="function"?ne.call(Ge,V,z):ne,z==null)break e;V=b({},V,z);break e;case 2:si=!0}}z=y.callback,z!==null&&(e.flags|=64,N&&(e.flags|=8192),N=u.callbacks,N===null?u.callbacks=[z]:N.push(z))}else N={lane:z,tag:y.tag,payload:y.payload,callback:y.callback,next:null},G===null?(C=G=N,S=V):G=G.next=N,p|=z;if(y=y.next,y===null){if(y=u.shared.pending,y===null)break;N=y,y=N.next,N.next=null,u.lastBaseUpdate=N,u.shared.pending=null}}while(!0);G===null&&(S=V),u.baseState=S,u.firstBaseUpdate=C,u.lastBaseUpdate=G,f===null&&(u.shared.lanes=0),di|=p,e.lanes=p,e.memoizedState=V}}function nh(e,t){if(typeof e!="function")throw Error(r(191,e));e.call(t)}function ih(e,t){var a=e.callbacks;if(a!==null)for(e.callbacks=null,e=0;e<a.length;e++)nh(a[e],t)}var Na=T(null),qr=T(0);function ah(e,t){e=qn,q(qr,e),q(Na,t),qn=e|t.baseLanes}function lu(){q(qr,qn),q(Na,Na.current)}function ou(){qn=qr.current,j(Na),j(qr)}var Vt=T(null),sn=null;function oi(e){var t=e.alternate;q(nt,nt.current&1),q(Vt,e),sn===null&&(t===null||Na.current!==null||t.memoizedState!==null)&&(sn=e)}function uu(e){q(nt,nt.current),q(Vt,e),sn===null&&(sn=e)}function sh(e){e.tag===22?(q(nt,nt.current),q(Vt,e),sn===null&&(sn=e)):ui()}function ui(){q(nt,nt.current),q(Vt,Vt.current)}function Ft(e){j(Vt),sn===e&&(sn=null),j(nt)}var nt=T(0);function Yr(e){for(var t=e;t!==null;){if(t.tag===13){var a=t.memoizedState;if(a!==null&&(a=a.dehydrated,a===null||mc(a)||gc(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 jn=0,ve=null,je=null,lt=null,Xr=!1,ka=!1,Pi=!1,Kr=0,_s=0,La=null,mb=0;function We(){throw Error(r(321))}function cu(e,t){if(t===null)return!1;for(var a=0;a<t.length&&a<e.length;a++)if(!$t(e[a],t[a]))return!1;return!0}function fu(e,t,a,l,u,f){return jn=f,ve=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,U.H=e===null||e.memoizedState===null?Vh:Mu,Pi=!1,f=a(l,u),Pi=!1,ka&&(f=lh(t,a,l,u)),rh(e),f}function rh(e){U.H=ks;var t=je!==null&&je.next!==null;if(jn=0,lt=je=ve=null,Xr=!1,_s=0,La=null,t)throw Error(r(300));e===null||ot||(e=e.dependencies,e!==null&&Br(e)&&(ot=!0))}function lh(e,t,a,l){ve=e;var u=0;do{if(ka&&(La=null),_s=0,ka=!1,25<=u)throw Error(r(301));if(u+=1,lt=je=null,e.updateQueue!=null){var f=e.updateQueue;f.lastEffect=null,f.events=null,f.stores=null,f.memoCache!=null&&(f.memoCache.index=0)}U.H=Fh,f=t(a,l)}while(ka);return f}function gb(){var e=U.H,t=e.useState()[0];return t=typeof t.then=="function"?Us(t):t,e=e.useState()[0],(je!==null?je.memoizedState:null)!==e&&(ve.flags|=1024),t}function du(){var e=Kr!==0;return Kr=0,e}function hu(e,t,a){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~a}function pu(e){if(Xr){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}Xr=!1}jn=0,lt=je=ve=null,ka=!1,_s=Kr=0,La=null}function Mt(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return lt===null?ve.memoizedState=lt=e:lt=lt.next=e,lt}function it(){if(je===null){var e=ve.alternate;e=e!==null?e.memoizedState:null}else e=je.next;var t=lt===null?ve.memoizedState:lt.next;if(t!==null)lt=t,je=e;else{if(e===null)throw ve.alternate===null?Error(r(467)):Error(r(310));je=e,e={memoizedState:je.memoizedState,baseState:je.baseState,baseQueue:je.baseQueue,queue:je.queue,next:null},lt===null?ve.memoizedState=lt=e:lt=lt.next=e}return lt}function Pr(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Us(e){var t=_s;return _s+=1,La===null&&(La=[]),e=Zd(La,e,t),t=ve,(lt===null?t.memoizedState:lt.next)===null&&(t=t.alternate,U.H=t===null||t.memoizedState===null?Vh:Mu),e}function Qr(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return Us(e);if(e.$$typeof===K)return yt(e)}throw Error(r(438,String(e)))}function mu(e){var t=null,a=ve.updateQueue;if(a!==null&&(t=a.memoCache),t==null){var l=ve.alternate;l!==null&&(l=l.updateQueue,l!==null&&(l=l.memoCache,l!=null&&(t={data:l.data.map(function(u){return u.slice()}),index:0})))}if(t==null&&(t={data:[],index:0}),a===null&&(a=Pr(),ve.updateQueue=a),a.memoCache=t,a=t.data[t.index],a===void 0)for(a=t.data[t.index]=Array(e),l=0;l<e;l++)a[l]=te;return t.index++,a}function Bn(e,t){return typeof t=="function"?t(e):t}function Zr(e){var t=it();return gu(t,je,e)}function gu(e,t,a){var l=e.queue;if(l===null)throw Error(r(311));l.lastRenderedReducer=a;var u=e.baseQueue,f=l.pending;if(f!==null){if(u!==null){var p=u.next;u.next=f.next,f.next=p}t.baseQueue=u=f,l.pending=null}if(f=e.baseState,u===null)e.memoizedState=f;else{t=u.next;var y=p=null,S=null,C=t,G=!1;do{var V=C.lane&-536870913;if(V!==C.lane?(Ae&V)===V:(jn&V)===V){var z=C.revertLane;if(z===0)S!==null&&(S=S.next={lane:0,revertLane:0,gesture:null,action:C.action,hasEagerState:C.hasEagerState,eagerState:C.eagerState,next:null}),V===Oa&&(G=!0);else if((jn&z)===z){C=C.next,z===Oa&&(G=!0);continue}else V={lane:0,revertLane:C.revertLane,gesture:null,action:C.action,hasEagerState:C.hasEagerState,eagerState:C.eagerState,next:null},S===null?(y=S=V,p=f):S=S.next=V,ve.lanes|=z,di|=z;V=C.action,Pi&&a(f,V),f=C.hasEagerState?C.eagerState:a(f,V)}else z={lane:V,revertLane:C.revertLane,gesture:C.gesture,action:C.action,hasEagerState:C.hasEagerState,eagerState:C.eagerState,next:null},S===null?(y=S=z,p=f):S=S.next=z,ve.lanes|=V,di|=V;C=C.next}while(C!==null&&C!==t);if(S===null?p=f:S.next=y,!$t(f,e.memoizedState)&&(ot=!0,G&&(a=za,a!==null)))throw a;e.memoizedState=f,e.baseState=p,e.baseQueue=S,l.lastRenderedState=f}return u===null&&(l.lanes=0),[e.memoizedState,l.dispatch]}function yu(e){var t=it(),a=t.queue;if(a===null)throw Error(r(311));a.lastRenderedReducer=e;var l=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);$t(f,t.memoizedState)||(ot=!0),t.memoizedState=f,t.baseQueue===null&&(t.baseState=f),a.lastRenderedState=f}return[f,l]}function oh(e,t,a){var l=ve,u=it(),f=Re;if(f){if(a===void 0)throw Error(r(407));a=a()}else a=t();var p=!$t((je||u).memoizedState,a);if(p&&(u.memoizedState=a,ot=!0),u=u.queue,xu(fh.bind(null,l,u,e),[e]),u.getSnapshot!==t||p||lt!==null&&lt.memoizedState.tag&1){if(l.flags|=2048,ja(9,{destroy:void 0},ch.bind(null,l,u,a,t),null),Ve===null)throw Error(r(349));f||(jn&127)!==0||uh(l,t,a)}return a}function uh(e,t,a){e.flags|=16384,e={getSnapshot:t,value:a},t=ve.updateQueue,t===null?(t=Pr(),ve.updateQueue=t,t.stores=[e]):(a=t.stores,a===null?t.stores=[e]:a.push(e))}function ch(e,t,a,l){t.value=a,t.getSnapshot=l,dh(t)&&hh(e)}function fh(e,t,a){return a(function(){dh(t)&&hh(e)})}function dh(e){var t=e.getSnapshot;e=e.value;try{var a=t();return!$t(e,a)}catch{return!0}}function hh(e){var t=$i(e,2);t!==null&&kt(t,e,2)}function vu(e){var t=Mt();if(typeof e=="function"){var a=e;if(e=a(),Pi){wt(!0);try{a()}finally{wt(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Bn,lastRenderedState:e},t}function ph(e,t,a,l){return e.baseState=a,gu(e,je,typeof l=="function"?l:Bn)}function yb(e,t,a,l,u){if(el(e))throw Error(r(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)}};U.T!==null?a(!0):f.isTransition=!1,l(f),a=t.pending,a===null?(f.next=t.pending=f,mh(t,f)):(f.next=a.next,t.pending=a.next=f)}}function mh(e,t){var a=t.action,l=t.payload,u=e.state;if(t.isTransition){var f=U.T,p={};U.T=p;try{var y=a(u,l),S=U.S;S!==null&&S(p,y),gh(e,t,y)}catch(C){bu(e,t,C)}finally{f!==null&&p.types!==null&&(f.types=p.types),U.T=f}}else try{f=a(u,l),gh(e,t,f)}catch(C){bu(e,t,C)}}function gh(e,t,a){a!==null&&typeof a=="object"&&typeof a.then=="function"?a.then(function(l){yh(e,t,l)},function(l){return bu(e,t,l)}):yh(e,t,a)}function yh(e,t,a){t.status="fulfilled",t.value=a,vh(t),e.state=a,t=e.pending,t!==null&&(a=t.next,a===t?e.pending=null:(a=a.next,t.next=a,mh(e,a)))}function bu(e,t,a){var l=e.pending;if(e.pending=null,l!==null){l=l.next;do t.status="rejected",t.reason=a,vh(t),t=t.next;while(t!==l)}e.action=null}function vh(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function bh(e,t){return t}function xh(e,t){if(Re){var a=Ve.formState;if(a!==null){e:{var l=ve;if(Re){if(qe){t:{for(var u=qe,f=an;u.nodeType!==8;){if(!f){u=null;break t}if(u=rn(u.nextSibling),u===null){u=null;break t}}f=u.data,u=f==="F!"||f==="F"?u:null}if(u){qe=rn(u.nextSibling),l=u.data==="F!";break e}}ii(l)}l=!1}l&&(t=a[0])}}return a=Mt(),a.memoizedState=a.baseState=t,l={pending:null,lanes:0,dispatch:null,lastRenderedReducer:bh,lastRenderedState:t},a.queue=l,a=Gh.bind(null,ve,l),l.dispatch=a,l=vu(!1),f=Au.bind(null,ve,!1,l.queue),l=Mt(),u={state:t,dispatch:null,action:e,pending:null},l.queue=u,a=yb.bind(null,ve,u,f,a),u.dispatch=a,l.memoizedState=e,[t,a,!1]}function Sh(e){var t=it();return wh(t,je,e)}function wh(e,t,a){if(t=gu(e,t,bh)[0],e=Zr(Bn)[0],typeof t=="object"&&t!==null&&typeof t.then=="function")try{var l=Us(t)}catch(p){throw p===_a?Ir:p}else l=t;t=it();var u=t.queue,f=u.dispatch;return a!==t.memoizedState&&(ve.flags|=2048,ja(9,{destroy:void 0},vb.bind(null,u,a),null)),[l,f,e]}function vb(e,t){e.action=t}function Eh(e){var t=it(),a=je;if(a!==null)return wh(t,a,e);it(),t=t.memoizedState,a=it();var l=a.queue.dispatch;return a.memoizedState=e,[t,l,!1]}function ja(e,t,a,l){return e={tag:e,create:a,deps:l,inst:t,next:null},t=ve.updateQueue,t===null&&(t=Pr(),ve.updateQueue=t),a=t.lastEffect,a===null?t.lastEffect=e.next=e:(l=a.next,a.next=e,e.next=l,t.lastEffect=e),e}function Th(){return it().memoizedState}function Wr(e,t,a,l){var u=Mt();ve.flags|=e,u.memoizedState=ja(1|t,{destroy:void 0},a,l===void 0?null:l)}function Jr(e,t,a,l){var u=it();l=l===void 0?null:l;var f=u.memoizedState.inst;je!==null&&l!==null&&cu(l,je.memoizedState.deps)?u.memoizedState=ja(t,f,a,l):(ve.flags|=e,u.memoizedState=ja(1|t,f,a,l))}function Ah(e,t){Wr(8390656,8,e,t)}function xu(e,t){Jr(2048,8,e,t)}function bb(e){ve.flags|=4;var t=ve.updateQueue;if(t===null)t=Pr(),ve.updateQueue=t,t.events=[e];else{var a=t.events;a===null?t.events=[e]:a.push(e)}}function Mh(e){var t=it().memoizedState;return bb({ref:t,nextImpl:e}),function(){if((Ue&2)!==0)throw Error(r(440));return t.impl.apply(void 0,arguments)}}function Rh(e,t){return Jr(4,2,e,t)}function Dh(e,t){return Jr(4,4,e,t)}function Ch(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 Oh(e,t,a){a=a!=null?a.concat([e]):null,Jr(4,4,Ch.bind(null,t,e),a)}function Su(){}function zh(e,t){var a=it();t=t===void 0?null:t;var l=a.memoizedState;return t!==null&&cu(t,l[1])?l[0]:(a.memoizedState=[e,t],e)}function _h(e,t){var a=it();t=t===void 0?null:t;var l=a.memoizedState;if(t!==null&&cu(t,l[1]))return l[0];if(l=e(),Pi){wt(!0);try{e()}finally{wt(!1)}}return a.memoizedState=[l,t],l}function wu(e,t,a){return a===void 0||(jn&1073741824)!==0&&(Ae&261930)===0?e.memoizedState=t:(e.memoizedState=a,e=Up(),ve.lanes|=e,di|=e,a)}function Uh(e,t,a,l){return $t(a,t)?a:Na.current!==null?(e=wu(e,a,l),$t(e,t)||(ot=!0),e):(jn&42)===0||(jn&1073741824)!==0&&(Ae&261930)===0?(ot=!0,e.memoizedState=a):(e=Up(),ve.lanes|=e,di|=e,t)}function Nh(e,t,a,l,u){var f=P.p;P.p=f!==0&&8>f?f:8;var p=U.T,y={};U.T=y,Au(e,!1,t,a);try{var S=u(),C=U.S;if(C!==null&&C(y,S),S!==null&&typeof S=="object"&&typeof S.then=="function"){var G=pb(S,l);Ns(e,t,G,Yt(e))}else Ns(e,t,l,Yt(e))}catch(V){Ns(e,t,{then:function(){},status:"rejected",reason:V},Yt())}finally{P.p=f,p!==null&&y.types!==null&&(p.types=y.types),U.T=p}}function xb(){}function Eu(e,t,a,l){if(e.tag!==5)throw Error(r(476));var u=kh(e).queue;Nh(e,u,t,ae,a===null?xb:function(){return Lh(e),a(l)})}function kh(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:Bn,lastRenderedState:ae},next:null};var a={};return t.next={memoizedState:a,baseState:a,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Bn,lastRenderedState:a},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function Lh(e){var t=kh(e);t.next===null&&(t=e.alternate.memoizedState),Ns(e,t.next.queue,{},Yt())}function Tu(){return yt(Zs)}function jh(){return it().memoizedState}function Bh(){return it().memoizedState}function Sb(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var a=Yt();e=ri(a);var l=li(t,e,a);l!==null&&(kt(l,t,a),Cs(l,t,a)),t={cache:Jo()},e.payload=t;return}t=t.return}}function wb(e,t,a){var l=Yt();a={lane:l,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null},el(e)?$h(t,a):(a=Vo(e,t,a,l),a!==null&&(kt(a,e,l),Ih(a,t,l)))}function Gh(e,t,a){var l=Yt();Ns(e,t,a,l)}function Ns(e,t,a,l){var u={lane:l,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null};if(el(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,y=f(p,a);if(u.hasEagerState=!0,u.eagerState=y,$t(y,p))return Nr(e,t,u,0),Ve===null&&Ur(),!1}catch{}if(a=Vo(e,t,u,l),a!==null)return kt(a,e,l),Ih(a,t,l),!0}return!1}function Au(e,t,a,l){if(l={lane:2,revertLane:ic(),gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null},el(e)){if(t)throw Error(r(479))}else t=Vo(e,a,l,2),t!==null&&kt(t,e,2)}function el(e){var t=e.alternate;return e===ve||t!==null&&t===ve}function $h(e,t){ka=Xr=!0;var a=e.pending;a===null?t.next=t:(t.next=a.next,a.next=t),e.pending=t}function Ih(e,t,a){if((a&4194048)!==0){var l=t.lanes;l&=e.pendingLanes,a|=l,t.lanes=a,Yf(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 Vh={readContext:yt,use:Qr,useCallback:function(e,t){return Mt().memoizedState=[e,t===void 0?null:t],e},useContext:yt,useEffect:Ah,useImperativeHandle:function(e,t,a){a=a!=null?a.concat([e]):null,Wr(4194308,4,Ch.bind(null,t,e),a)},useLayoutEffect:function(e,t){return Wr(4194308,4,e,t)},useInsertionEffect:function(e,t){Wr(4,2,e,t)},useMemo:function(e,t){var a=Mt();t=t===void 0?null:t;var l=e();if(Pi){wt(!0);try{e()}finally{wt(!1)}}return a.memoizedState=[l,t],l},useReducer:function(e,t,a){var l=Mt();if(a!==void 0){var u=a(t);if(Pi){wt(!0);try{a(t)}finally{wt(!1)}}}else u=t;return l.memoizedState=l.baseState=u,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:u},l.queue=e,e=e.dispatch=wb.bind(null,ve,e),[l.memoizedState,e]},useRef:function(e){var t=Mt();return e={current:e},t.memoizedState=e},useState:function(e){e=vu(e);var t=e.queue,a=Gh.bind(null,ve,t);return t.dispatch=a,[e.memoizedState,a]},useDebugValue:Su,useDeferredValue:function(e,t){var a=Mt();return wu(a,e,t)},useTransition:function(){var e=vu(!1);return e=Nh.bind(null,ve,e.queue,!0,!1),Mt().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,a){var l=ve,u=Mt();if(Re){if(a===void 0)throw Error(r(407));a=a()}else{if(a=t(),Ve===null)throw Error(r(349));(Ae&127)!==0||uh(l,t,a)}u.memoizedState=a;var f={value:a,getSnapshot:t};return u.queue=f,Ah(fh.bind(null,l,f,e),[e]),l.flags|=2048,ja(9,{destroy:void 0},ch.bind(null,l,f,a,t),null),a},useId:function(){var e=Mt(),t=Ve.identifierPrefix;if(Re){var a=xn,l=bn;a=(l&~(1<<32-tt(l)-1)).toString(32)+a,t="_"+t+"R_"+a,a=Kr++,0<a&&(t+="H"+a.toString(32)),t+="_"}else a=mb++,t="_"+t+"r_"+a.toString(32)+"_";return e.memoizedState=t},useHostTransitionStatus:Tu,useFormState:xh,useActionState:xh,useOptimistic:function(e){var t=Mt();t.memoizedState=t.baseState=e;var a={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=a,t=Au.bind(null,ve,!0,a),a.dispatch=t,[e,t]},useMemoCache:mu,useCacheRefresh:function(){return Mt().memoizedState=Sb.bind(null,ve)},useEffectEvent:function(e){var t=Mt(),a={impl:e};return t.memoizedState=a,function(){if((Ue&2)!==0)throw Error(r(440));return a.impl.apply(void 0,arguments)}}},Mu={readContext:yt,use:Qr,useCallback:zh,useContext:yt,useEffect:xu,useImperativeHandle:Oh,useInsertionEffect:Rh,useLayoutEffect:Dh,useMemo:_h,useReducer:Zr,useRef:Th,useState:function(){return Zr(Bn)},useDebugValue:Su,useDeferredValue:function(e,t){var a=it();return Uh(a,je.memoizedState,e,t)},useTransition:function(){var e=Zr(Bn)[0],t=it().memoizedState;return[typeof e=="boolean"?e:Us(e),t]},useSyncExternalStore:oh,useId:jh,useHostTransitionStatus:Tu,useFormState:Sh,useActionState:Sh,useOptimistic:function(e,t){var a=it();return ph(a,je,e,t)},useMemoCache:mu,useCacheRefresh:Bh};Mu.useEffectEvent=Mh;var Fh={readContext:yt,use:Qr,useCallback:zh,useContext:yt,useEffect:xu,useImperativeHandle:Oh,useInsertionEffect:Rh,useLayoutEffect:Dh,useMemo:_h,useReducer:yu,useRef:Th,useState:function(){return yu(Bn)},useDebugValue:Su,useDeferredValue:function(e,t){var a=it();return je===null?wu(a,e,t):Uh(a,je.memoizedState,e,t)},useTransition:function(){var e=yu(Bn)[0],t=it().memoizedState;return[typeof e=="boolean"?e:Us(e),t]},useSyncExternalStore:oh,useId:jh,useHostTransitionStatus:Tu,useFormState:Eh,useActionState:Eh,useOptimistic:function(e,t){var a=it();return je!==null?ph(a,je,e,t):(a.baseState=e,[e,a.queue.dispatch])},useMemoCache:mu,useCacheRefresh:Bh};Fh.useEffectEvent=Mh;function Ru(e,t,a,l){t=e.memoizedState,a=a(l,t),a=a==null?t:b({},t,a),e.memoizedState=a,e.lanes===0&&(e.updateQueue.baseState=a)}var Du={enqueueSetState:function(e,t,a){e=e._reactInternals;var l=Yt(),u=ri(l);u.payload=t,a!=null&&(u.callback=a),t=li(e,u,l),t!==null&&(kt(t,e,l),Cs(t,e,l))},enqueueReplaceState:function(e,t,a){e=e._reactInternals;var l=Yt(),u=ri(l);u.tag=1,u.payload=t,a!=null&&(u.callback=a),t=li(e,u,l),t!==null&&(kt(t,e,l),Cs(t,e,l))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var a=Yt(),l=ri(a);l.tag=2,t!=null&&(l.callback=t),t=li(e,l,a),t!==null&&(kt(t,e,a),Cs(t,e,a))}};function Hh(e,t,a,l,u,f,p){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(l,f,p):t.prototype&&t.prototype.isPureReactComponent?!Ss(a,l)||!Ss(u,f):!0}function qh(e,t,a,l){e=t.state,typeof t.componentWillReceiveProps=="function"&&t.componentWillReceiveProps(a,l),typeof t.UNSAFE_componentWillReceiveProps=="function"&&t.UNSAFE_componentWillReceiveProps(a,l),t.state!==e&&Du.enqueueReplaceState(t,t.state,null)}function Qi(e,t){var a=t;if("ref"in t){a={};for(var l in t)l!=="ref"&&(a[l]=t[l])}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 Yh(e){_r(e)}function Xh(e){console.error(e)}function Kh(e){_r(e)}function tl(e,t){try{var a=e.onUncaughtError;a(t.value,{componentStack:t.stack})}catch(l){setTimeout(function(){throw l})}}function Ph(e,t,a){try{var l=e.onCaughtError;l(a.value,{componentStack:a.stack,errorBoundary:t.tag===1?t.stateNode:null})}catch(u){setTimeout(function(){throw u})}}function Cu(e,t,a){return a=ri(a),a.tag=3,a.payload={element:null},a.callback=function(){tl(e,t)},a}function Qh(e){return e=ri(e),e.tag=3,e}function Zh(e,t,a,l){var u=a.type.getDerivedStateFromError;if(typeof u=="function"){var f=l.value;e.payload=function(){return u(f)},e.callback=function(){Ph(t,a,l)}}var p=a.stateNode;p!==null&&typeof p.componentDidCatch=="function"&&(e.callback=function(){Ph(t,a,l),typeof u!="function"&&(hi===null?hi=new Set([this]):hi.add(this));var y=l.stack;this.componentDidCatch(l.value,{componentStack:y!==null?y:""})})}function Eb(e,t,a,l,u){if(a.flags|=32768,l!==null&&typeof l=="object"&&typeof l.then=="function"){if(t=a.alternate,t!==null&&Ca(t,a,u,!0),a=Vt.current,a!==null){switch(a.tag){case 31:case 13:return sn===null?hl():a.alternate===null&&Je===0&&(Je=3),a.flags&=-257,a.flags|=65536,a.lanes=u,l===Vr?a.flags|=16384:(t=a.updateQueue,t===null?a.updateQueue=new Set([l]):t.add(l),ec(e,l,u)),!1;case 22:return a.flags|=65536,l===Vr?a.flags|=16384:(t=a.updateQueue,t===null?(t={transitions:null,markerInstances:null,retryQueue:new Set([l])},a.updateQueue=t):(a=t.retryQueue,a===null?t.retryQueue=new Set([l]):a.add(l)),ec(e,l,u)),!1}throw Error(r(435,a.tag))}return ec(e,l,u),hl(),!1}if(Re)return t=Vt.current,t!==null?((t.flags&65536)===0&&(t.flags|=256),t.flags|=65536,t.lanes=u,l!==Ko&&(e=Error(r(422),{cause:l}),Ts(en(e,a)))):(l!==Ko&&(t=Error(r(423),{cause:l}),Ts(en(t,a))),e=e.current.alternate,e.flags|=65536,u&=-u,e.lanes|=u,l=en(l,a),u=Cu(e.stateNode,l,u),su(e,u),Je!==4&&(Je=2)),!1;var f=Error(r(520),{cause:l});if(f=en(f,a),Fs===null?Fs=[f]:Fs.push(f),Je!==4&&(Je=2),t===null)return!0;l=en(l,a),a=t;do{switch(a.tag){case 3:return a.flags|=65536,e=u&-u,a.lanes|=e,e=Cu(a.stateNode,l,e),su(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=Qh(u),Zh(u,e,a,l),su(a,u),!1}a=a.return}while(a!==null);return!1}var Ou=Error(r(461)),ot=!1;function vt(e,t,a,l){t.child=e===null?th(t,null,a,l):Ki(t,e.child,a,l)}function Wh(e,t,a,l,u){a=a.render;var f=t.ref;if("ref"in l){var p={};for(var y in l)y!=="ref"&&(p[y]=l[y])}else p=l;return Hi(t),l=fu(e,t,a,p,f,u),y=du(),e!==null&&!ot?(hu(e,t,u),Gn(e,t,u)):(Re&&y&&Yo(t),t.flags|=1,vt(e,t,l,u),t.child)}function Jh(e,t,a,l,u){if(e===null){var f=a.type;return typeof f=="function"&&!Fo(f)&&f.defaultProps===void 0&&a.compare===null?(t.tag=15,t.type=f,ep(e,t,f,l,u)):(e=Lr(a.type,null,l,t,t.mode,u),e.ref=t.ref,e.return=t,t.child=e)}if(f=e.child,!Bu(e,u)){var p=f.memoizedProps;if(a=a.compare,a=a!==null?a:Ss,a(p,l)&&e.ref===t.ref)return Gn(e,t,u)}return t.flags|=1,e=Un(f,l),e.ref=t.ref,e.return=t,t.child=e}function ep(e,t,a,l,u){if(e!==null){var f=e.memoizedProps;if(Ss(f,l)&&e.ref===t.ref)if(ot=!1,t.pendingProps=l=f,Bu(e,u))(e.flags&131072)!==0&&(ot=!0);else return t.lanes=e.lanes,Gn(e,t,u)}return zu(e,t,a,l,u)}function tp(e,t,a,l){var u=l.children,f=e!==null?e.memoizedState:null;if(e===null&&t.stateNode===null&&(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),l.mode==="hidden"){if((t.flags&128)!==0){if(f=f!==null?f.baseLanes|a:a,e!==null){for(l=t.child=e.child,u=0;l!==null;)u=u|l.lanes|l.childLanes,l=l.sibling;l=u&~f}else l=0,t.child=null;return np(e,t,f,a,l)}if((a&536870912)!==0)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&$r(t,f!==null?f.cachePool:null),f!==null?ah(t,f):lu(),sh(t);else return l=t.lanes=536870912,np(e,t,f!==null?f.baseLanes|a:a,a,l)}else f!==null?($r(t,f.cachePool),ah(t,f),ui(),t.memoizedState=null):(e!==null&&$r(t,null),lu(),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 np(e,t,a,l,u){var f=tu();return f=f===null?null:{parent:rt._currentValue,pool:f},t.memoizedState={baseLanes:a,cachePool:f},e!==null&&$r(t,null),lu(),sh(t),e!==null&&Ca(e,t,l,!0),t.childLanes=u,null}function nl(e,t){return t=al({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function ip(e,t,a){return Ki(t,e.child,null,a),e=nl(t,t.pendingProps),e.flags|=2,Ft(t),t.memoizedState=null,e}function Tb(e,t,a){var l=t.pendingProps,u=(t.flags&128)!==0;if(t.flags&=-129,e===null){if(Re){if(l.mode==="hidden")return e=nl(t,l),t.lanes=536870912,Ls(null,e);if(uu(t),(e=qe)?(e=mm(e,an),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,qe=null)):e=null,e===null)throw ii(t);return t.lanes=536870912,null}return nl(t,l)}var f=e.memoizedState;if(f!==null){var p=f.dehydrated;if(uu(t),u)if(t.flags&256)t.flags&=-257,t=ip(e,t,a);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(r(558));else if(ot||Ca(e,t,a,!1),u=(a&e.childLanes)!==0,ot||u){if(l=Ve,l!==null&&(p=Xf(l,a),p!==0&&p!==f.retryLane))throw f.retryLane=p,$i(e,p),kt(l,e,p),Ou;hl(),t=ip(e,t,a)}else e=f.treeContext,qe=rn(p.nextSibling),gt=t,Re=!0,ni=null,an=!1,e!==null&&Fd(t,e),t=nl(t,l),t.flags|=4096;return t}return e=Un(e.child,{mode:l.mode,children:l.children}),e.ref=t.ref,t.child=e,e.return=t,e}function il(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(r(284));(e===null||e.ref!==a)&&(t.flags|=4194816)}}function zu(e,t,a,l,u){return Hi(t),a=fu(e,t,a,l,void 0,u),l=du(),e!==null&&!ot?(hu(e,t,u),Gn(e,t,u)):(Re&&l&&Yo(t),t.flags|=1,vt(e,t,a,u),t.child)}function ap(e,t,a,l,u,f){return Hi(t),t.updateQueue=null,a=lh(t,l,a,u),rh(e),l=du(),e!==null&&!ot?(hu(e,t,f),Gn(e,t,f)):(Re&&l&&Yo(t),t.flags|=1,vt(e,t,a,f),t.child)}function sp(e,t,a,l,u){if(Hi(t),t.stateNode===null){var f=Aa,p=a.contextType;typeof p=="object"&&p!==null&&(f=yt(p)),f=new a(l,f),t.memoizedState=f.state!==null&&f.state!==void 0?f.state:null,f.updater=Du,t.stateNode=f,f._reactInternals=t,f=t.stateNode,f.props=l,f.state=t.memoizedState,f.refs={},iu(t),p=a.contextType,f.context=typeof p=="object"&&p!==null?yt(p):Aa,f.state=t.memoizedState,p=a.getDerivedStateFromProps,typeof p=="function"&&(Ru(t,a,p,l),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&&Du.enqueueReplaceState(f,f.state,null),zs(t,l,f,u),Os(),f.state=t.memoizedState),typeof f.componentDidMount=="function"&&(t.flags|=4194308),l=!0}else if(e===null){f=t.stateNode;var y=t.memoizedProps,S=Qi(a,y);f.props=S;var C=f.context,G=a.contextType;p=Aa,typeof G=="object"&&G!==null&&(p=yt(G));var V=a.getDerivedStateFromProps;G=typeof V=="function"||typeof f.getSnapshotBeforeUpdate=="function",y=t.pendingProps!==y,G||typeof f.UNSAFE_componentWillReceiveProps!="function"&&typeof f.componentWillReceiveProps!="function"||(y||C!==p)&&qh(t,f,l,p),si=!1;var z=t.memoizedState;f.state=z,zs(t,l,f,u),Os(),C=t.memoizedState,y||z!==C||si?(typeof V=="function"&&(Ru(t,a,V,l),C=t.memoizedState),(S=si||Hh(t,a,S,l,z,C,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=l,t.memoizedState=C),f.props=l,f.state=C,f.context=p,l=S):(typeof f.componentDidMount=="function"&&(t.flags|=4194308),l=!1)}else{f=t.stateNode,au(e,t),p=t.memoizedProps,G=Qi(a,p),f.props=G,V=t.pendingProps,z=f.context,C=a.contextType,S=Aa,typeof C=="object"&&C!==null&&(S=yt(C)),y=a.getDerivedStateFromProps,(C=typeof y=="function"||typeof f.getSnapshotBeforeUpdate=="function")||typeof f.UNSAFE_componentWillReceiveProps!="function"&&typeof f.componentWillReceiveProps!="function"||(p!==V||z!==S)&&qh(t,f,l,S),si=!1,z=t.memoizedState,f.state=z,zs(t,l,f,u),Os();var N=t.memoizedState;p!==V||z!==N||si||e!==null&&e.dependencies!==null&&Br(e.dependencies)?(typeof y=="function"&&(Ru(t,a,y,l),N=t.memoizedState),(G=si||Hh(t,a,G,l,z,N,S)||e!==null&&e.dependencies!==null&&Br(e.dependencies))?(C||typeof f.UNSAFE_componentWillUpdate!="function"&&typeof f.componentWillUpdate!="function"||(typeof f.componentWillUpdate=="function"&&f.componentWillUpdate(l,N,S),typeof f.UNSAFE_componentWillUpdate=="function"&&f.UNSAFE_componentWillUpdate(l,N,S)),typeof f.componentDidUpdate=="function"&&(t.flags|=4),typeof f.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof f.componentDidUpdate!="function"||p===e.memoizedProps&&z===e.memoizedState||(t.flags|=4),typeof f.getSnapshotBeforeUpdate!="function"||p===e.memoizedProps&&z===e.memoizedState||(t.flags|=1024),t.memoizedProps=l,t.memoizedState=N),f.props=l,f.state=N,f.context=S,l=G):(typeof f.componentDidUpdate!="function"||p===e.memoizedProps&&z===e.memoizedState||(t.flags|=4),typeof f.getSnapshotBeforeUpdate!="function"||p===e.memoizedProps&&z===e.memoizedState||(t.flags|=1024),l=!1)}return f=l,il(e,t),l=(t.flags&128)!==0,f||l?(f=t.stateNode,a=l&&typeof a.getDerivedStateFromError!="function"?null:f.render(),t.flags|=1,e!==null&&l?(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=Gn(e,t,u),e}function rp(e,t,a,l){return Vi(),t.flags|=256,vt(e,t,a,l),t.child}var _u={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Uu(e){return{baseLanes:e,cachePool:Pd()}}function Nu(e,t,a){return e=e!==null?e.childLanes&~a:0,t&&(e|=qt),e}function lp(e,t,a){var l=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(Re){if(u?oi(t):ui(),(e=qe)?(e=mm(e,an),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,qe=null)):e=null,e===null)throw ii(t);return gc(e)?t.lanes=32:t.lanes=536870912,null}var y=l.children;return l=l.fallback,u?(ui(),u=t.mode,y=al({mode:"hidden",children:y},u),l=Ii(l,u,a,null),y.return=t,l.return=t,y.sibling=l,t.child=y,l=t.child,l.memoizedState=Uu(a),l.childLanes=Nu(e,p,a),t.memoizedState=_u,Ls(null,l)):(oi(t),ku(t,y))}var S=e.memoizedState;if(S!==null&&(y=S.dehydrated,y!==null)){if(f)t.flags&256?(oi(t),t.flags&=-257,t=Lu(e,t,a)):t.memoizedState!==null?(ui(),t.child=e.child,t.flags|=128,t=null):(ui(),y=l.fallback,u=t.mode,l=al({mode:"visible",children:l.children},u),y=Ii(y,u,a,null),y.flags|=2,l.return=t,y.return=t,l.sibling=y,t.child=l,Ki(t,e.child,null,a),l=t.child,l.memoizedState=Uu(a),l.childLanes=Nu(e,p,a),t.memoizedState=_u,t=Ls(null,l));else if(oi(t),gc(y)){if(p=y.nextSibling&&y.nextSibling.dataset,p)var C=p.dgst;p=C,l=Error(r(419)),l.stack="",l.digest=p,Ts({value:l,source:null,stack:null}),t=Lu(e,t,a)}else if(ot||Ca(e,t,a,!1),p=(a&e.childLanes)!==0,ot||p){if(p=Ve,p!==null&&(l=Xf(p,a),l!==0&&l!==S.retryLane))throw S.retryLane=l,$i(e,l),kt(p,e,l),Ou;mc(y)||hl(),t=Lu(e,t,a)}else mc(y)?(t.flags|=192,t.child=e.child,t=null):(e=S.treeContext,qe=rn(y.nextSibling),gt=t,Re=!0,ni=null,an=!1,e!==null&&Fd(t,e),t=ku(t,l.children),t.flags|=4096);return t}return u?(ui(),y=l.fallback,u=t.mode,S=e.child,C=S.sibling,l=Un(S,{mode:"hidden",children:l.children}),l.subtreeFlags=S.subtreeFlags&65011712,C!==null?y=Un(C,y):(y=Ii(y,u,a,null),y.flags|=2),y.return=t,l.return=t,l.sibling=y,t.child=l,Ls(null,l),l=t.child,y=e.child.memoizedState,y===null?y=Uu(a):(u=y.cachePool,u!==null?(S=rt._currentValue,u=u.parent!==S?{parent:S,pool:S}:u):u=Pd(),y={baseLanes:y.baseLanes|a,cachePool:u}),l.memoizedState=y,l.childLanes=Nu(e,p,a),t.memoizedState=_u,Ls(e.child,l)):(oi(t),a=e.child,e=a.sibling,a=Un(a,{mode:"visible",children:l.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 ku(e,t){return t=al({mode:"visible",children:t},e.mode),t.return=e,e.child=t}function al(e,t){return e=It(22,e,null,t),e.lanes=0,e}function Lu(e,t,a){return Ki(t,e.child,null,a),e=ku(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function op(e,t,a){e.lanes|=t;var l=e.alternate;l!==null&&(l.lanes|=t),Zo(e.return,t,a)}function ju(e,t,a,l,u,f){var p=e.memoizedState;p===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:l,tail:a,tailMode:u,treeForkCount:f}:(p.isBackwards=t,p.rendering=null,p.renderingStartTime=0,p.last=l,p.tail=a,p.tailMode=u,p.treeForkCount=f)}function up(e,t,a){var l=t.pendingProps,u=l.revealOrder,f=l.tail;l=l.children;var p=nt.current,y=(p&2)!==0;if(y?(p=p&1|2,t.flags|=128):p&=1,q(nt,p),vt(e,t,l,a),l=Re?Es:0,!y&&e!==null&&(e.flags&128)!==0)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&op(e,a,t);else if(e.tag===19)op(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&&Yr(e)===null&&(u=a),a=a.sibling;a=u,a===null?(u=t.child,t.child=null):(u=a.sibling,a.sibling=null),ju(t,!1,u,a,f,l);break;case"backwards":case"unstable_legacy-backwards":for(a=null,u=t.child,t.child=null;u!==null;){if(e=u.alternate,e!==null&&Yr(e)===null){t.child=u;break}e=u.sibling,u.sibling=a,a=u,u=e}ju(t,!0,a,null,f,l);break;case"together":ju(t,!1,null,null,void 0,l);break;default:t.memoizedState=null}return t.child}function Gn(e,t,a){if(e!==null&&(t.dependencies=e.dependencies),di|=t.lanes,(a&t.childLanes)===0)if(e!==null){if(Ca(e,t,a,!1),(a&t.childLanes)===0)return null}else return null;if(e!==null&&t.child!==e.child)throw Error(r(153));if(t.child!==null){for(e=t.child,a=Un(e,e.pendingProps),t.child=a,a.return=t;e.sibling!==null;)e=e.sibling,a=a.sibling=Un(e,e.pendingProps),a.return=t;a.sibling=null}return t.child}function Bu(e,t){return(e.lanes&t)!==0?!0:(e=e.dependencies,!!(e!==null&&Br(e)))}function Ab(e,t,a){switch(t.tag){case 3:Ie(t,t.stateNode.containerInfo),ai(t,rt,e.memoizedState.cache),Vi();break;case 27:case 5:dn(t);break;case 4:Ie(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,uu(t),null;break;case 13:var l=t.memoizedState;if(l!==null)return l.dehydrated!==null?(oi(t),t.flags|=128,null):(a&t.child.childLanes)!==0?lp(e,t,a):(oi(t),e=Gn(e,t,a),e!==null?e.sibling:null);oi(t);break;case 19:var u=(e.flags&128)!==0;if(l=(a&t.childLanes)!==0,l||(Ca(e,t,a,!1),l=(a&t.childLanes)!==0),u){if(l)return up(e,t,a);t.flags|=128}if(u=t.memoizedState,u!==null&&(u.rendering=null,u.tail=null,u.lastEffect=null),q(nt,nt.current),l)break;return null;case 22:return t.lanes=0,tp(e,t,a,t.pendingProps);case 24:ai(t,rt,e.memoizedState.cache)}return Gn(e,t,a)}function cp(e,t,a){if(e!==null)if(e.memoizedProps!==t.pendingProps)ot=!0;else{if(!Bu(e,a)&&(t.flags&128)===0)return ot=!1,Ab(e,t,a);ot=(e.flags&131072)!==0}else ot=!1,Re&&(t.flags&1048576)!==0&&Vd(t,Es,t.index);switch(t.lanes=0,t.tag){case 16:e:{var l=t.pendingProps;if(e=Yi(t.elementType),t.type=e,typeof e=="function")Fo(e)?(l=Qi(e,l),t.tag=1,t=sp(null,t,e,l,a)):(t.tag=0,t=zu(null,t,e,l,a));else{if(e!=null){var u=e.$$typeof;if(u===F){t.tag=11,t=Wh(null,t,e,l,a);break e}else if(u===k){t.tag=14,t=Jh(null,t,e,l,a);break e}}throw t=me(e)||e,Error(r(306,t,""))}}return t;case 0:return zu(e,t,t.type,t.pendingProps,a);case 1:return l=t.type,u=Qi(l,t.pendingProps),sp(e,t,l,u,a);case 3:e:{if(Ie(t,t.stateNode.containerInfo),e===null)throw Error(r(387));l=t.pendingProps;var f=t.memoizedState;u=f.element,au(e,t),zs(t,l,null,a);var p=t.memoizedState;if(l=p.cache,ai(t,rt,l),l!==f.cache&&Wo(t,[rt],a,!0),Os(),l=p.element,f.isDehydrated)if(f={element:l,isDehydrated:!1,cache:p.cache},t.updateQueue.baseState=f,t.memoizedState=f,t.flags&256){t=rp(e,t,l,a);break e}else if(l!==u){u=en(Error(r(424)),t),Ts(u),t=rp(e,t,l,a);break e}else for(e=t.stateNode.containerInfo,e.nodeType===9?e=e.body:e=e.nodeName==="HTML"?e.ownerDocument.body:e,qe=rn(e.firstChild),gt=t,Re=!0,ni=null,an=!0,a=th(t,null,l,a),t.child=a;a;)a.flags=a.flags&-3|4096,a=a.sibling;else{if(Vi(),l===u){t=Gn(e,t,a);break e}vt(e,t,l,a)}t=t.child}return t;case 26:return il(e,t),e===null?(a=Sm(t.type,null,t.pendingProps,null))?t.memoizedState=a:Re||(a=t.type,e=t.pendingProps,l=xl(de.current).createElement(a),l[mt]=t,l[Ct]=e,bt(l,a,e),ht(l),t.stateNode=l):t.memoizedState=Sm(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return dn(t),e===null&&Re&&(l=t.stateNode=vm(t.type,t.pendingProps,de.current),gt=t,an=!0,u=qe,yi(t.type)?(yc=u,qe=rn(l.firstChild)):qe=u),vt(e,t,t.pendingProps.children,a),il(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&Re&&((u=l=qe)&&(l=tx(l,t.type,t.pendingProps,an),l!==null?(t.stateNode=l,gt=t,qe=rn(l.firstChild),an=!1,u=!0):u=!1),u||ii(t)),dn(t),u=t.type,f=t.pendingProps,p=e!==null?e.memoizedProps:null,l=f.children,dc(u,f)?l=null:p!==null&&dc(u,p)&&(t.flags|=32),t.memoizedState!==null&&(u=fu(e,t,gb,null,null,a),Zs._currentValue=u),il(e,t),vt(e,t,l,a),t.child;case 6:return e===null&&Re&&((e=a=qe)&&(a=nx(a,t.pendingProps,an),a!==null?(t.stateNode=a,gt=t,qe=null,e=!0):e=!1),e||ii(t)),null;case 13:return lp(e,t,a);case 4:return Ie(t,t.stateNode.containerInfo),l=t.pendingProps,e===null?t.child=Ki(t,null,l,a):vt(e,t,l,a),t.child;case 11:return Wh(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 l=t.pendingProps,ai(t,t.type,l.value),vt(e,t,l.children,a),t.child;case 9:return u=t.type._context,l=t.pendingProps.children,Hi(t),u=yt(u),l=l(u),t.flags|=1,vt(e,t,l,a),t.child;case 14:return Jh(e,t,t.type,t.pendingProps,a);case 15:return ep(e,t,t.type,t.pendingProps,a);case 19:return up(e,t,a);case 31:return Tb(e,t,a);case 22:return tp(e,t,a,t.pendingProps);case 24:return Hi(t),l=yt(rt),e===null?(u=tu(),u===null&&(u=Ve,f=Jo(),u.pooledCache=f,f.refCount++,f!==null&&(u.pooledCacheLanes|=a),u=f),t.memoizedState={parent:l,cache:u},iu(t),ai(t,rt,u)):((e.lanes&a)!==0&&(au(e,t),zs(t,null,null,a),Os()),u=e.memoizedState,f=t.memoizedState,u.parent!==l?(u={parent:l,cache:l},t.memoizedState=u,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=u),ai(t,rt,l)):(l=f.cache,ai(t,rt,l),l!==u.cache&&Wo(t,[rt],a,!0))),vt(e,t,t.pendingProps.children,a),t.child;case 29:throw t.pendingProps}throw Error(r(156,t.tag))}function $n(e){e.flags|=4}function Gu(e,t,a,l,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(jp())e.flags|=8192;else throw Xi=Vr,nu}else e.flags&=-16777217}function fp(e,t){if(t.type!=="stylesheet"||(t.state.loading&4)!==0)e.flags&=-16777217;else if(e.flags|=16777216,!Mm(t))if(jp())e.flags|=8192;else throw Xi=Vr,nu}function sl(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag!==22?Hf():536870912,e.lanes|=t,Ia|=t)}function js(e,t){if(!Re)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 l=null;a!==null;)a.alternate!==null&&(l=a),a=a.sibling;l===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:l.sibling=null}}function Ye(e){var t=e.alternate!==null&&e.alternate.child===e.child,a=0,l=0;if(t)for(var u=e.child;u!==null;)a|=u.lanes|u.childLanes,l|=u.subtreeFlags&65011712,l|=u.flags&65011712,u.return=e,u=u.sibling;else for(u=e.child;u!==null;)a|=u.lanes|u.childLanes,l|=u.subtreeFlags,l|=u.flags,u.return=e,u=u.sibling;return e.subtreeFlags|=l,e.childLanes=a,t}function Mb(e,t,a){var l=t.pendingProps;switch(Xo(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Ye(t),null;case 1:return Ye(t),null;case 3:return a=t.stateNode,l=null,e!==null&&(l=e.memoizedState.cache),t.memoizedState.cache!==l&&(t.flags|=2048),Ln(rt),De(),a.pendingContext&&(a.context=a.pendingContext,a.pendingContext=null),(e===null||e.child===null)&&(Da(t)?$n(t):e===null||e.memoizedState.isDehydrated&&(t.flags&256)===0||(t.flags|=1024,Po())),Ye(t),null;case 26:var u=t.type,f=t.memoizedState;return e===null?($n(t),f!==null?(Ye(t),fp(t,f)):(Ye(t),Gu(t,u,null,l,a))):f?f!==e.memoizedState?($n(t),Ye(t),fp(t,f)):(Ye(t),t.flags&=-16777217):(e=e.memoizedProps,e!==l&&$n(t),Ye(t),Gu(t,u,e,l,a)),null;case 27:if(Rn(t),a=de.current,u=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==l&&$n(t);else{if(!l){if(t.stateNode===null)throw Error(r(166));return Ye(t),null}e=J.current,Da(t)?Hd(t):(e=vm(u,l,a),t.stateNode=e,$n(t))}return Ye(t),null;case 5:if(Rn(t),u=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==l&&$n(t);else{if(!l){if(t.stateNode===null)throw Error(r(166));return Ye(t),null}if(f=J.current,Da(t))Hd(t);else{var p=xl(de.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 l.is=="string"?p.createElement("select",{is:l.is}):p.createElement("select"),l.multiple?f.multiple=!0:l.size&&(f.size=l.size);break;default:f=typeof l.is=="string"?p.createElement(u,{is:l.is}):p.createElement(u)}}f[mt]=t,f[Ct]=l;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,l),u){case"button":case"input":case"select":case"textarea":l=!!l.autoFocus;break e;case"img":l=!0;break e;default:l=!1}l&&$n(t)}}return Ye(t),Gu(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,a),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==l&&$n(t);else{if(typeof l!="string"&&t.stateNode===null)throw Error(r(166));if(e=de.current,Da(t)){if(e=t.stateNode,a=t.memoizedProps,l=null,u=gt,u!==null)switch(u.tag){case 27:case 5:l=u.memoizedProps}e[mt]=t,e=!!(e.nodeValue===a||l!==null&&l.suppressHydrationWarning===!0||lm(e.nodeValue,a)),e||ii(t,!0)}else e=xl(e).createTextNode(l),e[mt]=t,t.stateNode=e}return Ye(t),null;case 31:if(a=t.memoizedState,e===null||e.memoizedState!==null){if(l=Da(t),a!==null){if(e===null){if(!l)throw Error(r(318));if(e=t.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(r(557));e[mt]=t}else Vi(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;Ye(t),e=!1}else a=Po(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=a),e=!0;if(!e)return t.flags&256?(Ft(t),t):(Ft(t),null);if((t.flags&128)!==0)throw Error(r(558))}return Ye(t),null;case 13:if(l=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(u=Da(t),l!==null&&l.dehydrated!==null){if(e===null){if(!u)throw Error(r(318));if(u=t.memoizedState,u=u!==null?u.dehydrated:null,!u)throw Error(r(317));u[mt]=t}else Vi(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;Ye(t),u=!1}else u=Po(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=u),u=!0;if(!u)return t.flags&256?(Ft(t),t):(Ft(t),null)}return Ft(t),(t.flags&128)!==0?(t.lanes=a,t):(a=l!==null,e=e!==null&&e.memoizedState!==null,a&&(l=t.child,u=null,l.alternate!==null&&l.alternate.memoizedState!==null&&l.alternate.memoizedState.cachePool!==null&&(u=l.alternate.memoizedState.cachePool.pool),f=null,l.memoizedState!==null&&l.memoizedState.cachePool!==null&&(f=l.memoizedState.cachePool.pool),f!==u&&(l.flags|=2048)),a!==e&&a&&(t.child.flags|=8192),sl(t,t.updateQueue),Ye(t),null);case 4:return De(),e===null&&lc(t.stateNode.containerInfo),Ye(t),null;case 10:return Ln(t.type),Ye(t),null;case 19:if(j(nt),l=t.memoizedState,l===null)return Ye(t),null;if(u=(t.flags&128)!==0,f=l.rendering,f===null)if(u)js(l,!1);else{if(Je!==0||e!==null&&(e.flags&128)!==0)for(e=t.child;e!==null;){if(f=Yr(e),f!==null){for(t.flags|=128,js(l,!1),e=f.updateQueue,t.updateQueue=e,sl(t,e),t.subtreeFlags=0,e=a,a=t.child;a!==null;)Gd(a,e),a=a.sibling;return q(nt,nt.current&1|2),Re&&Nn(t,l.treeForkCount),t.child}e=e.sibling}l.tail!==null&&He()>cl&&(t.flags|=128,u=!0,js(l,!1),t.lanes=4194304)}else{if(!u)if(e=Yr(f),e!==null){if(t.flags|=128,u=!0,e=e.updateQueue,t.updateQueue=e,sl(t,e),js(l,!0),l.tail===null&&l.tailMode==="hidden"&&!f.alternate&&!Re)return Ye(t),null}else 2*He()-l.renderingStartTime>cl&&a!==536870912&&(t.flags|=128,u=!0,js(l,!1),t.lanes=4194304);l.isBackwards?(f.sibling=t.child,t.child=f):(e=l.last,e!==null?e.sibling=f:t.child=f,l.last=f)}return l.tail!==null?(e=l.tail,l.rendering=e,l.tail=e.sibling,l.renderingStartTime=He(),e.sibling=null,a=nt.current,q(nt,u?a&1|2:a&1),Re&&Nn(t,l.treeForkCount),e):(Ye(t),null);case 22:case 23:return Ft(t),ou(),l=t.memoizedState!==null,e!==null?e.memoizedState!==null!==l&&(t.flags|=8192):l&&(t.flags|=8192),l?(a&536870912)!==0&&(t.flags&128)===0&&(Ye(t),t.subtreeFlags&6&&(t.flags|=8192)):Ye(t),a=t.updateQueue,a!==null&&sl(t,a.retryQueue),a=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(a=e.memoizedState.cachePool.pool),l=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(l=t.memoizedState.cachePool.pool),l!==a&&(t.flags|=2048),e!==null&&j(qi),null;case 24:return a=null,e!==null&&(a=e.memoizedState.cache),t.memoizedState.cache!==a&&(t.flags|=2048),Ln(rt),Ye(t),null;case 25:return null;case 30:return null}throw Error(r(156,t.tag))}function Rb(e,t){switch(Xo(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Ln(rt),De(),e=t.flags,(e&65536)!==0&&(e&128)===0?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return Rn(t),null;case 31:if(t.memoizedState!==null){if(Ft(t),t.alternate===null)throw Error(r(340));Vi()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(Ft(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(r(340));Vi()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return j(nt),null;case 4:return De(),null;case 10:return Ln(t.type),null;case 22:case 23:return Ft(t),ou(),e!==null&&j(qi),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return Ln(rt),null;case 25:return null;default:return null}}function dp(e,t){switch(Xo(t),t.tag){case 3:Ln(rt),De();break;case 26:case 27:case 5:Rn(t);break;case 4:De();break;case 31:t.memoizedState!==null&&Ft(t);break;case 13:Ft(t);break;case 19:j(nt);break;case 10:Ln(t.type);break;case 22:case 23:Ft(t),ou(),e!==null&&j(qi);break;case 24:Ln(rt)}}function Bs(e,t){try{var a=t.updateQueue,l=a!==null?a.lastEffect:null;if(l!==null){var u=l.next;a=u;do{if((a.tag&e)===e){l=void 0;var f=a.create,p=a.inst;l=f(),p.destroy=l}a=a.next}while(a!==u)}}catch(y){Le(t,t.return,y)}}function ci(e,t,a){try{var l=t.updateQueue,u=l!==null?l.lastEffect:null;if(u!==null){var f=u.next;l=f;do{if((l.tag&e)===e){var p=l.inst,y=p.destroy;if(y!==void 0){p.destroy=void 0,u=t;var S=a,C=y;try{C()}catch(G){Le(u,S,G)}}}l=l.next}while(l!==f)}}catch(G){Le(t,t.return,G)}}function hp(e){var t=e.updateQueue;if(t!==null){var a=e.stateNode;try{ih(t,a)}catch(l){Le(e,e.return,l)}}}function pp(e,t,a){a.props=Qi(e.type,e.memoizedProps),a.state=e.memoizedState;try{a.componentWillUnmount()}catch(l){Le(e,t,l)}}function Gs(e,t){try{var a=e.ref;if(a!==null){switch(e.tag){case 26:case 27:case 5:var l=e.stateNode;break;case 30:l=e.stateNode;break;default:l=e.stateNode}typeof a=="function"?e.refCleanup=a(l):a.current=l}}catch(u){Le(e,t,u)}}function Sn(e,t){var a=e.ref,l=e.refCleanup;if(a!==null)if(typeof l=="function")try{l()}catch(u){Le(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){Le(e,t,u)}else a.current=null}function mp(e){var t=e.type,a=e.memoizedProps,l=e.stateNode;try{e:switch(t){case"button":case"input":case"select":case"textarea":a.autoFocus&&l.focus();break e;case"img":a.src?l.src=a.src:a.srcSet&&(l.srcset=a.srcSet)}}catch(u){Le(e,e.return,u)}}function $u(e,t,a){try{var l=e.stateNode;Pb(l,e.type,a,t),l[Ct]=t}catch(u){Le(e,e.return,u)}}function gp(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&yi(e.type)||e.tag===4}function Iu(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||gp(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 Vu(e,t,a){var l=e.tag;if(l===5||l===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=zn));else if(l!==4&&(l===27&&yi(e.type)&&(a=e.stateNode,t=null),e=e.child,e!==null))for(Vu(e,t,a),e=e.sibling;e!==null;)Vu(e,t,a),e=e.sibling}function rl(e,t,a){var l=e.tag;if(l===5||l===6)e=e.stateNode,t?a.insertBefore(e,t):a.appendChild(e);else if(l!==4&&(l===27&&yi(e.type)&&(a=e.stateNode),e=e.child,e!==null))for(rl(e,t,a),e=e.sibling;e!==null;)rl(e,t,a),e=e.sibling}function yp(e){var t=e.stateNode,a=e.memoizedProps;try{for(var l=e.type,u=t.attributes;u.length;)t.removeAttributeNode(u[0]);bt(t,l,a),t[mt]=e,t[Ct]=a}catch(f){Le(e,e.return,f)}}var In=!1,ut=!1,Fu=!1,vp=typeof WeakSet=="function"?WeakSet:Set,pt=null;function Db(e,t){if(e=e.containerInfo,cc=Rl,e=Od(e),Lo(e)){if("selectionStart"in e)var a={start:e.selectionStart,end:e.selectionEnd};else e:{a=(a=e.ownerDocument)&&a.defaultView||window;var l=a.getSelection&&a.getSelection();if(l&&l.rangeCount!==0){a=l.anchorNode;var u=l.anchorOffset,f=l.focusNode;l=l.focusOffset;try{a.nodeType,f.nodeType}catch{a=null;break e}var p=0,y=-1,S=-1,C=0,G=0,V=e,z=null;t:for(;;){for(var N;V!==a||u!==0&&V.nodeType!==3||(y=p+u),V!==f||l!==0&&V.nodeType!==3||(S=p+l),V.nodeType===3&&(p+=V.nodeValue.length),(N=V.firstChild)!==null;)z=V,V=N;for(;;){if(V===e)break t;if(z===a&&++C===u&&(y=p),z===f&&++G===l&&(S=p),(N=V.nextSibling)!==null)break;V=z,z=V.parentNode}V=N}a=y===-1||S===-1?null:{start:y,end:S}}else a=null}a=a||{start:0,end:0}}else a=null;for(fc={focusedElem:e,selectionRange:a},Rl=!1,pt=t;pt!==null;)if(t=pt,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,pt=e;else for(;pt!==null;){switch(t=pt,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,l=a.stateNode;try{var ne=Qi(a.type,u);e=l.getSnapshotBeforeUpdate(ne,f),l.__reactInternalSnapshotBeforeUpdate=e}catch(fe){Le(a,a.return,fe)}}break;case 3:if((e&1024)!==0){if(e=t.stateNode.containerInfo,a=e.nodeType,a===9)pc(e);else if(a===1)switch(e.nodeName){case"HEAD":case"HTML":case"BODY":pc(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(r(163))}if(e=t.sibling,e!==null){e.return=t.return,pt=e;break}pt=t.return}}function bp(e,t,a){var l=a.flags;switch(a.tag){case 0:case 11:case 15:Fn(e,a),l&4&&Bs(5,a);break;case 1:if(Fn(e,a),l&4)if(e=a.stateNode,t===null)try{e.componentDidMount()}catch(p){Le(a,a.return,p)}else{var u=Qi(a.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(u,t,e.__reactInternalSnapshotBeforeUpdate)}catch(p){Le(a,a.return,p)}}l&64&&hp(a),l&512&&Gs(a,a.return);break;case 3:if(Fn(e,a),l&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{ih(e,t)}catch(p){Le(a,a.return,p)}}break;case 27:t===null&&l&4&&yp(a);case 26:case 5:Fn(e,a),t===null&&l&4&&mp(a),l&512&&Gs(a,a.return);break;case 12:Fn(e,a);break;case 31:Fn(e,a),l&4&&wp(e,a);break;case 13:Fn(e,a),l&4&&Ep(e,a),l&64&&(e=a.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(a=jb.bind(null,a),ix(e,a))));break;case 22:if(l=a.memoizedState!==null||In,!l){t=t!==null&&t.memoizedState!==null||ut,u=In;var f=ut;In=l,(ut=t)&&!f?Hn(e,a,(a.subtreeFlags&8772)!==0):Fn(e,a),In=u,ut=f}break;case 30:break;default:Fn(e,a)}}function xp(e){var t=e.alternate;t!==null&&(e.alternate=null,xp(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&bo(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 Ke=null,zt=!1;function Vn(e,t,a){for(a=a.child;a!==null;)Sp(e,t,a),a=a.sibling}function Sp(e,t,a){if(Xe&&typeof Xe.onCommitFiberUnmount=="function")try{Xe.onCommitFiberUnmount(dt,a)}catch{}switch(a.tag){case 26:ut||Sn(a,t),Vn(e,t,a),a.memoizedState?a.memoizedState.count--:a.stateNode&&(a=a.stateNode,a.parentNode.removeChild(a));break;case 27:ut||Sn(a,t);var l=Ke,u=zt;yi(a.type)&&(Ke=a.stateNode,zt=!1),Vn(e,t,a),Ks(a.stateNode),Ke=l,zt=u;break;case 5:ut||Sn(a,t);case 6:if(l=Ke,u=zt,Ke=null,Vn(e,t,a),Ke=l,zt=u,Ke!==null)if(zt)try{(Ke.nodeType===9?Ke.body:Ke.nodeName==="HTML"?Ke.ownerDocument.body:Ke).removeChild(a.stateNode)}catch(f){Le(a,t,f)}else try{Ke.removeChild(a.stateNode)}catch(f){Le(a,t,f)}break;case 18:Ke!==null&&(zt?(e=Ke,hm(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,a.stateNode),Pa(e)):hm(Ke,a.stateNode));break;case 4:l=Ke,u=zt,Ke=a.stateNode.containerInfo,zt=!0,Vn(e,t,a),Ke=l,zt=u;break;case 0:case 11:case 14:case 15:ci(2,a,t),ut||ci(4,a,t),Vn(e,t,a);break;case 1:ut||(Sn(a,t),l=a.stateNode,typeof l.componentWillUnmount=="function"&&pp(a,t,l)),Vn(e,t,a);break;case 21:Vn(e,t,a);break;case 22:ut=(l=ut)||a.memoizedState!==null,Vn(e,t,a),ut=l;break;default:Vn(e,t,a)}}function wp(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{Pa(e)}catch(a){Le(t,t.return,a)}}}function Ep(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{Pa(e)}catch(a){Le(t,t.return,a)}}function Cb(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new vp),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new vp),t;default:throw Error(r(435,e.tag))}}function ll(e,t){var a=Cb(e);t.forEach(function(l){if(!a.has(l)){a.add(l);var u=Bb.bind(null,e,l);l.then(u,u)}})}function _t(e,t){var a=t.deletions;if(a!==null)for(var l=0;l<a.length;l++){var u=a[l],f=e,p=t,y=p;e:for(;y!==null;){switch(y.tag){case 27:if(yi(y.type)){Ke=y.stateNode,zt=!1;break e}break;case 5:Ke=y.stateNode,zt=!1;break e;case 3:case 4:Ke=y.stateNode.containerInfo,zt=!0;break e}y=y.return}if(Ke===null)throw Error(r(160));Sp(f,p,u),Ke=null,zt=!1,f=u.alternate,f!==null&&(f.return=null),u.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)Tp(t,e),t=t.sibling}var mn=null;function Tp(e,t){var a=e.alternate,l=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:_t(t,e),Ut(e),l&4&&(ci(3,e,e.return),Bs(3,e),ci(5,e,e.return));break;case 1:_t(t,e),Ut(e),l&512&&(ut||a===null||Sn(a,a.return)),l&64&&In&&(e=e.updateQueue,e!==null&&(l=e.callbacks,l!==null&&(a=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=a===null?l:a.concat(l))));break;case 26:var u=mn;if(_t(t,e),Ut(e),l&512&&(ut||a===null||Sn(a,a.return)),l&4){var f=a!==null?a.memoizedState:null;if(l=e.memoizedState,a===null)if(l===null)if(e.stateNode===null){e:{l=e.type,a=e.memoizedProps,u=u.ownerDocument||u;t:switch(l){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(l),u.head.insertBefore(f,u.querySelector("head > title"))),bt(f,l,a),f[mt]=e,ht(f),l=f;break e;case"link":var p=Tm("link","href",u).get(l+(a.href||""));if(p){for(var y=0;y<p.length;y++)if(f=p[y],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(y,1);break t}}f=u.createElement(l),bt(f,l,a),u.head.appendChild(f);break;case"meta":if(p=Tm("meta","content",u).get(l+(a.content||""))){for(y=0;y<p.length;y++)if(f=p[y],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(y,1);break t}}f=u.createElement(l),bt(f,l,a),u.head.appendChild(f);break;default:throw Error(r(468,l))}f[mt]=e,ht(f),l=f}e.stateNode=l}else Am(u,e.type,e.stateNode);else e.stateNode=Em(u,l,e.memoizedProps);else f!==l?(f===null?a.stateNode!==null&&(a=a.stateNode,a.parentNode.removeChild(a)):f.count--,l===null?Am(u,e.type,e.stateNode):Em(u,l,e.memoizedProps)):l===null&&e.stateNode!==null&&$u(e,e.memoizedProps,a.memoizedProps)}break;case 27:_t(t,e),Ut(e),l&512&&(ut||a===null||Sn(a,a.return)),a!==null&&l&4&&$u(e,e.memoizedProps,a.memoizedProps);break;case 5:if(_t(t,e),Ut(e),l&512&&(ut||a===null||Sn(a,a.return)),e.flags&32){u=e.stateNode;try{va(u,"")}catch(ne){Le(e,e.return,ne)}}l&4&&e.stateNode!=null&&(u=e.memoizedProps,$u(e,u,a!==null?a.memoizedProps:u)),l&1024&&(Fu=!0);break;case 6:if(_t(t,e),Ut(e),l&4){if(e.stateNode===null)throw Error(r(162));l=e.memoizedProps,a=e.stateNode;try{a.nodeValue=l}catch(ne){Le(e,e.return,ne)}}break;case 3:if(El=null,u=mn,mn=Sl(t.containerInfo),_t(t,e),mn=u,Ut(e),l&4&&a!==null&&a.memoizedState.isDehydrated)try{Pa(t.containerInfo)}catch(ne){Le(e,e.return,ne)}Fu&&(Fu=!1,Ap(e));break;case 4:l=mn,mn=Sl(e.stateNode.containerInfo),_t(t,e),Ut(e),mn=l;break;case 12:_t(t,e),Ut(e);break;case 31:_t(t,e),Ut(e),l&4&&(l=e.updateQueue,l!==null&&(e.updateQueue=null,ll(e,l)));break;case 13:_t(t,e),Ut(e),e.child.flags&8192&&e.memoizedState!==null!=(a!==null&&a.memoizedState!==null)&&(ul=He()),l&4&&(l=e.updateQueue,l!==null&&(e.updateQueue=null,ll(e,l)));break;case 22:u=e.memoizedState!==null;var S=a!==null&&a.memoizedState!==null,C=In,G=ut;if(In=C||u,ut=G||S,_t(t,e),ut=G,In=C,Ut(e),l&8192)e:for(t=e.stateNode,t._visibility=u?t._visibility&-2:t._visibility|1,u&&(a===null||S||In||ut||Zi(e)),a=null,t=e;;){if(t.tag===5||t.tag===26){if(a===null){S=a=t;try{if(f=S.stateNode,u)p=f.style,typeof p.setProperty=="function"?p.setProperty("display","none","important"):p.display="none";else{y=S.stateNode;var V=S.memoizedProps.style,z=V!=null&&V.hasOwnProperty("display")?V.display:null;y.style.display=z==null||typeof z=="boolean"?"":(""+z).trim()}}catch(ne){Le(S,S.return,ne)}}}else if(t.tag===6){if(a===null){S=t;try{S.stateNode.nodeValue=u?"":S.memoizedProps}catch(ne){Le(S,S.return,ne)}}}else if(t.tag===18){if(a===null){S=t;try{var N=S.stateNode;u?pm(N,!0):pm(S.stateNode,!1)}catch(ne){Le(S,S.return,ne)}}}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}l&4&&(l=e.updateQueue,l!==null&&(a=l.retryQueue,a!==null&&(l.retryQueue=null,ll(e,a))));break;case 19:_t(t,e),Ut(e),l&4&&(l=e.updateQueue,l!==null&&(e.updateQueue=null,ll(e,l)));break;case 30:break;case 21:break;default:_t(t,e),Ut(e)}}function Ut(e){var t=e.flags;if(t&2){try{for(var a,l=e.return;l!==null;){if(gp(l)){a=l;break}l=l.return}if(a==null)throw Error(r(160));switch(a.tag){case 27:var u=a.stateNode,f=Iu(e);rl(e,f,u);break;case 5:var p=a.stateNode;a.flags&32&&(va(p,""),a.flags&=-33);var y=Iu(e);rl(e,y,p);break;case 3:case 4:var S=a.stateNode.containerInfo,C=Iu(e);Vu(e,C,S);break;default:throw Error(r(161))}}catch(G){Le(e,e.return,G)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function Ap(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;Ap(t),t.tag===5&&t.flags&1024&&t.stateNode.reset(),e=e.sibling}}function Fn(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)bp(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"&&pp(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 Hn(e,t,a){for(a=a&&(t.subtreeFlags&8772)!==0,t=t.child;t!==null;){var l=t.alternate,u=e,f=t,p=f.flags;switch(f.tag){case 0:case 11:case 15:Hn(u,f,a),Bs(4,f);break;case 1:if(Hn(u,f,a),l=f,u=l.stateNode,typeof u.componentDidMount=="function")try{u.componentDidMount()}catch(C){Le(l,l.return,C)}if(l=f,u=l.updateQueue,u!==null){var y=l.stateNode;try{var S=u.shared.hiddenCallbacks;if(S!==null)for(u.shared.hiddenCallbacks=null,u=0;u<S.length;u++)nh(S[u],y)}catch(C){Le(l,l.return,C)}}a&&p&64&&hp(f),Gs(f,f.return);break;case 27:yp(f);case 26:case 5:Hn(u,f,a),a&&l===null&&p&4&&mp(f),Gs(f,f.return);break;case 12:Hn(u,f,a);break;case 31:Hn(u,f,a),a&&p&4&&wp(u,f);break;case 13:Hn(u,f,a),a&&p&4&&Ep(u,f);break;case 22:f.memoizedState===null&&Hn(u,f,a),Gs(f,f.return);break;case 30:break;default:Hn(u,f,a)}t=t.sibling}}function Hu(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 qu(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 gn(e,t,a,l){if(t.subtreeFlags&10256)for(t=t.child;t!==null;)Mp(e,t,a,l),t=t.sibling}function Mp(e,t,a,l){var u=t.flags;switch(t.tag){case 0:case 11:case 15:gn(e,t,a,l),u&2048&&Bs(9,t);break;case 1:gn(e,t,a,l);break;case 3:gn(e,t,a,l),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){gn(e,t,a,l),e=t.stateNode;try{var f=t.memoizedProps,p=f.id,y=f.onPostCommit;typeof y=="function"&&y(p,t.alternate===null?"mount":"update",e.passiveEffectDuration,-0)}catch(S){Le(t,t.return,S)}}else gn(e,t,a,l);break;case 31:gn(e,t,a,l);break;case 13:gn(e,t,a,l);break;case 23:break;case 22:f=t.stateNode,p=t.alternate,t.memoizedState!==null?f._visibility&2?gn(e,t,a,l):$s(e,t):f._visibility&2?gn(e,t,a,l):(f._visibility|=2,Ba(e,t,a,l,(t.subtreeFlags&10256)!==0||!1)),u&2048&&Hu(p,t);break;case 24:gn(e,t,a,l),u&2048&&qu(t.alternate,t);break;default:gn(e,t,a,l)}}function Ba(e,t,a,l,u){for(u=u&&((t.subtreeFlags&10256)!==0||!1),t=t.child;t!==null;){var f=e,p=t,y=a,S=l,C=p.flags;switch(p.tag){case 0:case 11:case 15:Ba(f,p,y,S,u),Bs(8,p);break;case 23:break;case 22:var G=p.stateNode;p.memoizedState!==null?G._visibility&2?Ba(f,p,y,S,u):$s(f,p):(G._visibility|=2,Ba(f,p,y,S,u)),u&&C&2048&&Hu(p.alternate,p);break;case 24:Ba(f,p,y,S,u),u&&C&2048&&qu(p.alternate,p);break;default:Ba(f,p,y,S,u)}t=t.sibling}}function $s(e,t){if(t.subtreeFlags&10256)for(t=t.child;t!==null;){var a=e,l=t,u=l.flags;switch(l.tag){case 22:$s(a,l),u&2048&&Hu(l.alternate,l);break;case 24:$s(a,l),u&2048&&qu(l.alternate,l);break;default:$s(a,l)}t=t.sibling}}var Is=8192;function Ga(e,t,a){if(e.subtreeFlags&Is)for(e=e.child;e!==null;)Rp(e,t,a),e=e.sibling}function Rp(e,t,a){switch(e.tag){case 26:Ga(e,t,a),e.flags&Is&&e.memoizedState!==null&&mx(a,mn,e.memoizedState,e.memoizedProps);break;case 5:Ga(e,t,a);break;case 3:case 4:var l=mn;mn=Sl(e.stateNode.containerInfo),Ga(e,t,a),mn=l;break;case 22:e.memoizedState===null&&(l=e.alternate,l!==null&&l.memoizedState!==null?(l=Is,Is=16777216,Ga(e,t,a),Is=l):Ga(e,t,a));break;default:Ga(e,t,a)}}function Dp(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 l=t[a];pt=l,Op(l,e)}Dp(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)Cp(e),e=e.sibling}function Cp(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,ol(e)):Vs(e);break;default:Vs(e)}}function ol(e){var t=e.deletions;if((e.flags&16)!==0){if(t!==null)for(var a=0;a<t.length;a++){var l=t[a];pt=l,Op(l,e)}Dp(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:ci(8,t,t.return),ol(t);break;case 22:a=t.stateNode,a._visibility&2&&(a._visibility&=-3,ol(t));break;default:ol(t)}e=e.sibling}}function Op(e,t){for(;pt!==null;){var a=pt;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 l=a.memoizedState.cachePool.pool;l!=null&&l.refCount++}break;case 24:As(a.memoizedState.cache)}if(l=a.child,l!==null)l.return=a,pt=l;else e:for(a=e;pt!==null;){l=pt;var u=l.sibling,f=l.return;if(xp(l),l===a){pt=null;break e}if(u!==null){u.return=f,pt=u;break e}pt=f}}}var Ob={getCacheForType:function(e){var t=yt(rt),a=t.data.get(e);return a===void 0&&(a=e(),t.data.set(e,a)),a},cacheSignal:function(){return yt(rt).controller.signal}},zb=typeof WeakMap=="function"?WeakMap:Map,Ue=0,Ve=null,Se=null,Ae=0,ke=0,Ht=null,fi=!1,$a=!1,Yu=!1,qn=0,Je=0,di=0,Wi=0,Xu=0,qt=0,Ia=0,Fs=null,Nt=null,Ku=!1,ul=0,zp=0,cl=1/0,fl=null,hi=null,ct=0,pi=null,Va=null,Yn=0,Pu=0,Qu=null,_p=null,Hs=0,Zu=null;function Yt(){return(Ue&2)!==0&&Ae!==0?Ae&-Ae:U.T!==null?ic():Kf()}function Up(){if(qt===0)if((Ae&536870912)===0||Re){var e=br;br<<=1,(br&3932160)===0&&(br=262144),qt=e}else qt=536870912;return e=Vt.current,e!==null&&(e.flags|=32),qt}function kt(e,t,a){(e===Ve&&(ke===2||ke===9)||e.cancelPendingCommit!==null)&&(Fa(e,0),mi(e,Ae,qt,!1)),fs(e,a),((Ue&2)===0||e!==Ve)&&(e===Ve&&((Ue&2)===0&&(Wi|=a),Je===4&&mi(e,Ae,qt,!1)),wn(e))}function Np(e,t,a){if((Ue&6)!==0)throw Error(r(327));var l=!a&&(t&127)===0&&(t&e.expiredLanes)===0||cs(e,t),u=l?Nb(e,t):Ju(e,t,!0),f=l;do{if(u===0){$a&&!l&&mi(e,t,0,!1);break}else{if(a=e.current.alternate,f&&!_b(a)){u=Ju(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 y=e;u=Fs;var S=y.current.memoizedState.isDehydrated;if(S&&(Fa(y,p).flags|=256),p=Ju(y,p,!1),p!==2){if(Yu&&!S){y.errorRecoveryDisabledLanes|=f,Wi|=f,u=4;break e}f=Nt,Nt=u,f!==null&&(Nt===null?Nt=f:Nt.push.apply(Nt,f))}u=p}if(f=!1,u!==2)continue}}if(u===1){Fa(e,0),mi(e,t,0,!0);break}e:{switch(l=e,f=u,f){case 0:case 1:throw Error(r(345));case 4:if((t&4194048)!==t)break;case 6:mi(l,t,qt,!fi);break e;case 2:Nt=null;break;case 3:case 5:break;default:throw Error(r(329))}if((t&62914560)===t&&(u=ul+300-He(),10<u)){if(mi(l,t,qt,!fi),Sr(l,0,!0)!==0)break e;Yn=t,l.timeoutHandle=fm(kp.bind(null,l,a,Nt,fl,Ku,t,qt,Wi,Ia,fi,f,"Throttled",-0,0),u);break e}kp(l,a,Nt,fl,Ku,t,qt,Wi,Ia,fi,f,null,-0,0)}}break}while(!0);wn(e)}function kp(e,t,a,l,u,f,p,y,S,C,G,V,z,N){if(e.timeoutHandle=-1,V=t.subtreeFlags,V&8192||(V&16785408)===16785408){V={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:zn},Rp(t,f,V);var ne=(f&62914560)===f?ul-He():(f&4194048)===f?zp-He():0;if(ne=gx(V,ne),ne!==null){Yn=f,e.cancelPendingCommit=ne(Fp.bind(null,e,t,f,a,l,u,p,y,S,G,V,null,z,N)),mi(e,f,p,!C);return}}Fp(e,t,f,a,l,u,p,y,S)}function _b(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 l=0;l<a.length;l++){var u=a[l],f=u.getSnapshot;u=u.value;try{if(!$t(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,l){t&=~Xu,t&=~Wi,e.suspendedLanes|=t,e.pingedLanes&=~t,l&&(e.warmLanes|=t),l=e.expirationTimes;for(var u=t;0<u;){var f=31-tt(u),p=1<<f;l[f]=-1,u&=~p}a!==0&&qf(e,a,t)}function dl(){return(Ue&6)===0?(qs(0),!1):!0}function Wu(){if(Se!==null){if(ke===0)var e=Se.return;else e=Se,kn=Fi=null,pu(e),Ua=null,Rs=0,e=Se;for(;e!==null;)dp(e.alternate,e),e=e.return;Se=null}}function Fa(e,t){var a=e.timeoutHandle;a!==-1&&(e.timeoutHandle=-1,Wb(a)),a=e.cancelPendingCommit,a!==null&&(e.cancelPendingCommit=null,a()),Yn=0,Wu(),Ve=e,Se=a=Un(e.current,null),Ae=t,ke=0,Ht=null,fi=!1,$a=cs(e,t),Yu=!1,Ia=qt=Xu=Wi=di=Je=0,Nt=Fs=null,Ku=!1,(t&8)!==0&&(t|=t&32);var l=e.entangledLanes;if(l!==0)for(e=e.entanglements,l&=t;0<l;){var u=31-tt(l),f=1<<u;t|=e[u],l&=~f}return qn=t,Ur(),a}function Lp(e,t){ve=null,U.H=ks,t===_a||t===Ir?(t=Wd(),ke=3):t===nu?(t=Wd(),ke=4):ke=t===Ou?8:t!==null&&typeof t=="object"&&typeof t.then=="function"?6:1,Ht=t,Se===null&&(Je=1,tl(e,en(t,e.current)))}function jp(){var e=Vt.current;return e===null?!0:(Ae&4194048)===Ae?sn===null:(Ae&62914560)===Ae||(Ae&536870912)!==0?e===sn:!1}function Bp(){var e=U.H;return U.H=ks,e===null?ks:e}function Gp(){var e=U.A;return U.A=Ob,e}function hl(){Je=4,fi||(Ae&4194048)!==Ae&&Vt.current!==null||($a=!0),(di&134217727)===0&&(Wi&134217727)===0||Ve===null||mi(Ve,Ae,qt,!1)}function Ju(e,t,a){var l=Ue;Ue|=2;var u=Bp(),f=Gp();(Ve!==e||Ae!==t)&&(fl=null,Fa(e,t)),t=!1;var p=Je;e:do try{if(ke!==0&&Se!==null){var y=Se,S=Ht;switch(ke){case 8:Wu(),p=6;break e;case 3:case 2:case 9:case 6:Vt.current===null&&(t=!0);var C=ke;if(ke=0,Ht=null,Ha(e,y,S,C),a&&$a){p=0;break e}break;default:C=ke,ke=0,Ht=null,Ha(e,y,S,C)}}Ub(),p=Je;break}catch(G){Lp(e,G)}while(!0);return t&&e.shellSuspendCounter++,kn=Fi=null,Ue=l,U.H=u,U.A=f,Se===null&&(Ve=null,Ae=0,Ur()),p}function Ub(){for(;Se!==null;)$p(Se)}function Nb(e,t){var a=Ue;Ue|=2;var l=Bp(),u=Gp();Ve!==e||Ae!==t?(fl=null,cl=He()+500,Fa(e,t)):$a=cs(e,t);e:do try{if(ke!==0&&Se!==null){t=Se;var f=Ht;t:switch(ke){case 1:ke=0,Ht=null,Ha(e,t,f,1);break;case 2:case 9:if(Qd(f)){ke=0,Ht=null,Ip(t);break}t=function(){ke!==2&&ke!==9||Ve!==e||(ke=7),wn(e)},f.then(t,t);break e;case 3:ke=7;break e;case 4:ke=5;break e;case 7:Qd(f)?(ke=0,Ht=null,Ip(t)):(ke=0,Ht=null,Ha(e,t,f,7));break;case 5:var p=null;switch(Se.tag){case 26:p=Se.memoizedState;case 5:case 27:var y=Se;if(p?Mm(p):y.stateNode.complete){ke=0,Ht=null;var S=y.sibling;if(S!==null)Se=S;else{var C=y.return;C!==null?(Se=C,pl(C)):Se=null}break t}}ke=0,Ht=null,Ha(e,t,f,5);break;case 6:ke=0,Ht=null,Ha(e,t,f,6);break;case 8:Wu(),Je=6;break e;default:throw Error(r(462))}}kb();break}catch(G){Lp(e,G)}while(!0);return kn=Fi=null,U.H=l,U.A=u,Ue=a,Se!==null?0:(Ve=null,Ae=0,Ur(),Je)}function kb(){for(;Se!==null&&!Fe();)$p(Se)}function $p(e){var t=cp(e.alternate,e,qn);e.memoizedProps=e.pendingProps,t===null?pl(e):Se=t}function Ip(e){var t=e,a=t.alternate;switch(t.tag){case 15:case 0:t=ap(a,t,t.pendingProps,t.type,void 0,Ae);break;case 11:t=ap(a,t,t.pendingProps,t.type.render,t.ref,Ae);break;case 5:pu(t);default:dp(a,t),t=Se=Gd(t,qn),t=cp(a,t,qn)}e.memoizedProps=e.pendingProps,t===null?pl(e):Se=t}function Ha(e,t,a,l){kn=Fi=null,pu(t),Ua=null,Rs=0;var u=t.return;try{if(Eb(e,u,t,a,Ae)){Je=1,tl(e,en(a,e.current)),Se=null;return}}catch(f){if(u!==null)throw Se=u,f;Je=1,tl(e,en(a,e.current)),Se=null;return}t.flags&32768?(Re||l===1?e=!0:$a||(Ae&536870912)!==0?e=!1:(fi=e=!0,(l===2||l===9||l===3||l===6)&&(l=Vt.current,l!==null&&l.tag===13&&(l.flags|=16384))),Vp(t,e)):pl(t)}function pl(e){var t=e;do{if((t.flags&32768)!==0){Vp(t,fi);return}e=t.return;var a=Mb(t.alternate,t,qn);if(a!==null){Se=a;return}if(t=t.sibling,t!==null){Se=t;return}Se=t=e}while(t!==null);Je===0&&(Je=5)}function Vp(e,t){do{var a=Rb(e.alternate,e);if(a!==null){a.flags&=32767,Se=a;return}if(a=e.return,a!==null&&(a.flags|=32768,a.subtreeFlags=0,a.deletions=null),!t&&(e=e.sibling,e!==null)){Se=e;return}Se=e=a}while(e!==null);Je=6,Se=null}function Fp(e,t,a,l,u,f,p,y,S){e.cancelPendingCommit=null;do ml();while(ct!==0);if((Ue&6)!==0)throw Error(r(327));if(t!==null){if(t===e.current)throw Error(r(177));if(f=t.lanes|t.childLanes,f|=Io,pv(e,a,f,p,y,S),e===Ve&&(Se=Ve=null,Ae=0),Va=t,pi=e,Yn=a,Pu=f,Qu=u,_p=l,(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?(e.callbackNode=null,e.callbackPriority=0,Gb(Dn,function(){return Kp(),null})):(e.callbackNode=null,e.callbackPriority=0),l=(t.flags&13878)!==0,(t.subtreeFlags&13878)!==0||l){l=U.T,U.T=null,u=P.p,P.p=2,p=Ue,Ue|=4;try{Db(e,t,a)}finally{Ue=p,P.p=u,U.T=l}}ct=1,Hp(),qp(),Yp()}}function Hp(){if(ct===1){ct=0;var e=pi,t=Va,a=(t.flags&13878)!==0;if((t.subtreeFlags&13878)!==0||a){a=U.T,U.T=null;var l=P.p;P.p=2;var u=Ue;Ue|=4;try{Tp(t,e);var f=fc,p=Od(e.containerInfo),y=f.focusedElem,S=f.selectionRange;if(p!==y&&y&&y.ownerDocument&&Cd(y.ownerDocument.documentElement,y)){if(S!==null&&Lo(y)){var C=S.start,G=S.end;if(G===void 0&&(G=C),"selectionStart"in y)y.selectionStart=C,y.selectionEnd=Math.min(G,y.value.length);else{var V=y.ownerDocument||document,z=V&&V.defaultView||window;if(z.getSelection){var N=z.getSelection(),ne=y.textContent.length,fe=Math.min(S.start,ne),Ge=S.end===void 0?fe:Math.min(S.end,ne);!N.extend&&fe>Ge&&(p=Ge,Ge=fe,fe=p);var M=Dd(y,fe),E=Dd(y,Ge);if(M&&E&&(N.rangeCount!==1||N.anchorNode!==M.node||N.anchorOffset!==M.offset||N.focusNode!==E.node||N.focusOffset!==E.offset)){var D=V.createRange();D.setStart(M.node,M.offset),N.removeAllRanges(),fe>Ge?(N.addRange(D),N.extend(E.node,E.offset)):(D.setEnd(E.node,E.offset),N.addRange(D))}}}}for(V=[],N=y;N=N.parentNode;)N.nodeType===1&&V.push({element:N,left:N.scrollLeft,top:N.scrollTop});for(typeof y.focus=="function"&&y.focus(),y=0;y<V.length;y++){var I=V[y];I.element.scrollLeft=I.left,I.element.scrollTop=I.top}}Rl=!!cc,fc=cc=null}finally{Ue=u,P.p=l,U.T=a}}e.current=t,ct=2}}function qp(){if(ct===2){ct=0;var e=pi,t=Va,a=(t.flags&8772)!==0;if((t.subtreeFlags&8772)!==0||a){a=U.T,U.T=null;var l=P.p;P.p=2;var u=Ue;Ue|=4;try{bp(e,t.alternate,t)}finally{Ue=u,P.p=l,U.T=a}}ct=3}}function Yp(){if(ct===4||ct===3){ct=0,xt();var e=pi,t=Va,a=Yn,l=_p;(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?ct=5:(ct=0,Va=pi=null,Xp(e,e.pendingLanes));var u=e.pendingLanes;if(u===0&&(hi=null),yo(a),t=t.stateNode,Xe&&typeof Xe.onCommitFiberRoot=="function")try{Xe.onCommitFiberRoot(dt,t,void 0,(t.current.flags&128)===128)}catch{}if(l!==null){t=U.T,u=P.p,P.p=2,U.T=null;try{for(var f=e.onRecoverableError,p=0;p<l.length;p++){var y=l[p];f(y.value,{componentStack:y.stack})}}finally{U.T=t,P.p=u}}(Yn&3)!==0&&ml(),wn(e),u=e.pendingLanes,(a&261930)!==0&&(u&42)!==0?e===Zu?Hs++:(Hs=0,Zu=e):Hs=0,qs(0)}}function Xp(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,As(t)))}function ml(){return Hp(),qp(),Yp(),Kp()}function Kp(){if(ct!==5)return!1;var e=pi,t=Pu;Pu=0;var a=yo(Yn),l=U.T,u=P.p;try{P.p=32>a?32:a,U.T=null,a=Qu,Qu=null;var f=pi,p=Yn;if(ct=0,Va=pi=null,Yn=0,(Ue&6)!==0)throw Error(r(331));var y=Ue;if(Ue|=4,Cp(f.current),Mp(f,f.current,p,a),Ue=y,qs(0,!1),Xe&&typeof Xe.onPostCommitFiberRoot=="function")try{Xe.onPostCommitFiberRoot(dt,f)}catch{}return!0}finally{P.p=u,U.T=l,Xp(e,t)}}function Pp(e,t,a){t=en(a,t),t=Cu(e.stateNode,t,2),e=li(e,t,2),e!==null&&(fs(e,2),wn(e))}function Le(e,t,a){if(e.tag===3)Pp(e,e,a);else for(;t!==null;){if(t.tag===3){Pp(t,e,a);break}else if(t.tag===1){var l=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof l.componentDidCatch=="function"&&(hi===null||!hi.has(l))){e=en(a,e),a=Qh(2),l=li(t,a,2),l!==null&&(Zh(a,l,t,e),fs(l,2),wn(l));break}}t=t.return}}function ec(e,t,a){var l=e.pingCache;if(l===null){l=e.pingCache=new zb;var u=new Set;l.set(t,u)}else u=l.get(t),u===void 0&&(u=new Set,l.set(t,u));u.has(a)||(Yu=!0,u.add(a),e=Lb.bind(null,e,t,a),t.then(e,e))}function Lb(e,t,a){var l=e.pingCache;l!==null&&l.delete(t),e.pingedLanes|=e.suspendedLanes&a,e.warmLanes&=~a,Ve===e&&(Ae&a)===a&&(Je===4||Je===3&&(Ae&62914560)===Ae&&300>He()-ul?(Ue&2)===0&&Fa(e,0):Xu|=a,Ia===Ae&&(Ia=0)),wn(e)}function Qp(e,t){t===0&&(t=Hf()),e=$i(e,t),e!==null&&(fs(e,t),wn(e))}function jb(e){var t=e.memoizedState,a=0;t!==null&&(a=t.retryLane),Qp(e,a)}function Bb(e,t){var a=0;switch(e.tag){case 31:case 13:var l=e.stateNode,u=e.memoizedState;u!==null&&(a=u.retryLane);break;case 19:l=e.stateNode;break;case 22:l=e.stateNode._retryCache;break;default:throw Error(r(314))}l!==null&&l.delete(t),Qp(e,a)}function Gb(e,t){return Oe(e,t)}var gl=null,qa=null,tc=!1,yl=!1,nc=!1,gi=0;function wn(e){e!==qa&&e.next===null&&(qa===null?gl=qa=e:qa=qa.next=e),yl=!0,tc||(tc=!0,Ib())}function qs(e,t){if(!nc&&yl){nc=!0;do for(var a=!1,l=gl;l!==null;){if(e!==0){var u=l.pendingLanes;if(u===0)var f=0;else{var p=l.suspendedLanes,y=l.pingedLanes;f=(1<<31-tt(42|e)+1)-1,f&=u&~(p&~y),f=f&201326741?f&201326741|1:f?f|2:0}f!==0&&(a=!0,em(l,f))}else f=Ae,f=Sr(l,l===Ve?f:0,l.cancelPendingCommit!==null||l.timeoutHandle!==-1),(f&3)===0||cs(l,f)||(a=!0,em(l,f));l=l.next}while(a);nc=!1}}function $b(){Zp()}function Zp(){yl=tc=!1;var e=0;gi!==0&&Zb()&&(e=gi);for(var t=He(),a=null,l=gl;l!==null;){var u=l.next,f=Wp(l,t);f===0?(l.next=null,a===null?gl=u:a.next=u,u===null&&(qa=a)):(a=l,(e!==0||(f&3)!==0)&&(yl=!0)),l=u}ct!==0&&ct!==5||qs(e),gi!==0&&(gi=0)}function Wp(e,t){for(var a=e.suspendedLanes,l=e.pingedLanes,u=e.expirationTimes,f=e.pendingLanes&-62914561;0<f;){var p=31-tt(f),y=1<<p,S=u[p];S===-1?((y&a)===0||(y&l)!==0)&&(u[p]=hv(y,t)):S<=t&&(e.expiredLanes|=y),f&=~y}if(t=Ve,a=Ae,a=Sr(e,e===t?a:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),l=e.callbackNode,a===0||e===t&&(ke===2||ke===9)||e.cancelPendingCommit!==null)return l!==null&&l!==null&&Pe(l),e.callbackNode=null,e.callbackPriority=0;if((a&3)===0||cs(e,a)){if(t=a&-a,t===e.callbackPriority)return t;switch(l!==null&&Pe(l),yo(a)){case 2:case 8:a=Gt;break;case 32:a=Dn;break;case 268435456:a=Cn;break;default:a=Dn}return l=Jp.bind(null,e),a=Oe(a,l),e.callbackPriority=t,e.callbackNode=a,t}return l!==null&&l!==null&&Pe(l),e.callbackPriority=2,e.callbackNode=null,2}function Jp(e,t){if(ct!==0&&ct!==5)return e.callbackNode=null,e.callbackPriority=0,null;var a=e.callbackNode;if(ml()&&e.callbackNode!==a)return null;var l=Ae;return l=Sr(e,e===Ve?l:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),l===0?null:(Np(e,l,t),Wp(e,He()),e.callbackNode!=null&&e.callbackNode===a?Jp.bind(null,e):null)}function em(e,t){if(ml())return null;Np(e,t,!0)}function Ib(){Jb(function(){(Ue&6)!==0?Oe(St,$b):Zp()})}function ic(){if(gi===0){var e=Oa;e===0&&(e=vr,vr<<=1,(vr&261888)===0&&(vr=256)),gi=e}return gi}function tm(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:Ar(""+e)}function nm(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 Vb(e,t,a,l,u){if(t==="submit"&&a&&a.stateNode===u){var f=tm((u[Ct]||null).action),p=l.submitter;p&&(t=(t=p[Ct]||null)?tm(t.formAction):p.getAttribute("formAction"),t!==null&&(f=t,p=null));var y=new Cr("action","action",null,l,u);e.push({event:y,listeners:[{instance:null,listener:function(){if(l.defaultPrevented){if(gi!==0){var S=p?nm(u,p):new FormData(u);Eu(a,{pending:!0,data:S,method:u.method,action:f},null,S)}}else typeof f=="function"&&(y.preventDefault(),S=p?nm(u,p):new FormData(u),Eu(a,{pending:!0,data:S,method:u.method,action:f},f,S))},currentTarget:u}]})}}for(var ac=0;ac<$o.length;ac++){var sc=$o[ac],Fb=sc.toLowerCase(),Hb=sc[0].toUpperCase()+sc.slice(1);pn(Fb,"on"+Hb)}pn(Ud,"onAnimationEnd"),pn(Nd,"onAnimationIteration"),pn(kd,"onAnimationStart"),pn("dblclick","onDoubleClick"),pn("focusin","onFocus"),pn("focusout","onBlur"),pn(rb,"onTransitionRun"),pn(lb,"onTransitionStart"),pn(ob,"onTransitionCancel"),pn(Ld,"onTransitionEnd"),ga("onMouseEnter",["mouseout","mouseover"]),ga("onMouseLeave",["mouseout","mouseover"]),ga("onPointerEnter",["pointerout","pointerover"]),ga("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(" "),qb=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Ys));function im(e,t){t=(t&4)!==0;for(var a=0;a<e.length;a++){var l=e[a],u=l.event;l=l.listeners;e:{var f=void 0;if(t)for(var p=l.length-1;0<=p;p--){var y=l[p],S=y.instance,C=y.currentTarget;if(y=y.listener,S!==f&&u.isPropagationStopped())break e;f=y,u.currentTarget=C;try{f(u)}catch(G){_r(G)}u.currentTarget=null,f=S}else for(p=0;p<l.length;p++){if(y=l[p],S=y.instance,C=y.currentTarget,y=y.listener,S!==f&&u.isPropagationStopped())break e;f=y,u.currentTarget=C;try{f(u)}catch(G){_r(G)}u.currentTarget=null,f=S}}}}function we(e,t){var a=t[vo];a===void 0&&(a=t[vo]=new Set);var l=e+"__bubble";a.has(l)||(am(t,e,2,!1),a.add(l))}function rc(e,t,a){var l=0;t&&(l|=4),am(a,e,l,t)}var vl="_reactListening"+Math.random().toString(36).slice(2);function lc(e){if(!e[vl]){e[vl]=!0,Zf.forEach(function(a){a!=="selectionchange"&&(qb.has(a)||rc(a,!1,e),rc(a,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[vl]||(t[vl]=!0,rc("selectionchange",!1,t))}}function am(e,t,a,l){switch(Um(t)){case 2:var u=bx;break;case 8:u=xx;break;default:u=wc}a=u.bind(null,t,a,e),u=void 0,!Ro||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(u=!0),l?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 oc(e,t,a,l,u){var f=l;if((t&1)===0&&(t&2)===0&&l!==null)e:for(;;){if(l===null)return;var p=l.tag;if(p===3||p===4){var y=l.stateNode.containerInfo;if(y===u)break;if(p===4)for(p=l.return;p!==null;){var S=p.tag;if((S===3||S===4)&&p.stateNode.containerInfo===u)return;p=p.return}for(;y!==null;){if(p=ha(y),p===null)return;if(S=p.tag,S===5||S===6||S===26||S===27){l=f=p;continue e}y=y.parentNode}}l=l.return}ud(function(){var C=f,G=Ao(a),V=[];e:{var z=jd.get(e);if(z!==void 0){var N=Cr,ne=e;switch(e){case"keypress":if(Rr(a)===0)break e;case"keydown":case"keyup":N=Bv;break;case"focusin":ne="focus",N=zo;break;case"focusout":ne="blur",N=zo;break;case"beforeblur":case"afterblur":N=zo;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":N=dd;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":N=Mv;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":N=Iv;break;case Ud:case Nd:case kd:N=Cv;break;case Ld:N=Fv;break;case"scroll":case"scrollend":N=Tv;break;case"wheel":N=qv;break;case"copy":case"cut":case"paste":N=zv;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":N=pd;break;case"toggle":case"beforetoggle":N=Xv}var fe=(t&4)!==0,Ge=!fe&&(e==="scroll"||e==="scrollend"),M=fe?z!==null?z+"Capture":null:z;fe=[];for(var E=C,D;E!==null;){var I=E;if(D=I.stateNode,I=I.tag,I!==5&&I!==26&&I!==27||D===null||M===null||(I=ps(E,M),I!=null&&fe.push(Xs(E,I,D))),Ge)break;E=E.return}0<fe.length&&(z=new N(z,ne,null,a,G),V.push({event:z,listeners:fe}))}}if((t&7)===0){e:{if(z=e==="mouseover"||e==="pointerover",N=e==="mouseout"||e==="pointerout",z&&a!==To&&(ne=a.relatedTarget||a.fromElement)&&(ha(ne)||ne[da]))break e;if((N||z)&&(z=G.window===G?G:(z=G.ownerDocument)?z.defaultView||z.parentWindow:window,N?(ne=a.relatedTarget||a.toElement,N=C,ne=ne?ha(ne):null,ne!==null&&(Ge=c(ne),fe=ne.tag,ne!==Ge||fe!==5&&fe!==27&&fe!==6)&&(ne=null)):(N=null,ne=C),N!==ne)){if(fe=dd,I="onMouseLeave",M="onMouseEnter",E="mouse",(e==="pointerout"||e==="pointerover")&&(fe=pd,I="onPointerLeave",M="onPointerEnter",E="pointer"),Ge=N==null?z:hs(N),D=ne==null?z:hs(ne),z=new fe(I,E+"leave",N,a,G),z.target=Ge,z.relatedTarget=D,I=null,ha(G)===C&&(fe=new fe(M,E+"enter",ne,a,G),fe.target=D,fe.relatedTarget=Ge,I=fe),Ge=I,N&&ne)t:{for(fe=Yb,M=N,E=ne,D=0,I=M;I;I=fe(I))D++;I=0;for(var ue=E;ue;ue=fe(ue))I++;for(;0<D-I;)M=fe(M),D--;for(;0<I-D;)E=fe(E),I--;for(;D--;){if(M===E||E!==null&&M===E.alternate){fe=M;break t}M=fe(M),E=fe(E)}fe=null}else fe=null;N!==null&&sm(V,z,N,fe,!1),ne!==null&&Ge!==null&&sm(V,Ge,ne,fe,!0)}}e:{if(z=C?hs(C):window,N=z.nodeName&&z.nodeName.toLowerCase(),N==="select"||N==="input"&&z.type==="file")var ze=wd;else if(xd(z))if(Ed)ze=ib;else{ze=tb;var re=eb}else N=z.nodeName,!N||N.toLowerCase()!=="input"||z.type!=="checkbox"&&z.type!=="radio"?C&&Eo(C.elementType)&&(ze=wd):ze=nb;if(ze&&(ze=ze(e,C))){Sd(V,ze,a,G);break e}re&&re(e,z,C),e==="focusout"&&C&&z.type==="number"&&C.memoizedProps.value!=null&&wo(z,"number",z.value)}switch(re=C?hs(C):window,e){case"focusin":(xd(re)||re.contentEditable==="true")&&(wa=re,jo=C,ws=null);break;case"focusout":ws=jo=wa=null;break;case"mousedown":Bo=!0;break;case"contextmenu":case"mouseup":case"dragend":Bo=!1,zd(V,a,G);break;case"selectionchange":if(sb)break;case"keydown":case"keyup":zd(V,a,G)}var be;if(Uo)e:{switch(e){case"compositionstart":var Me="onCompositionStart";break e;case"compositionend":Me="onCompositionEnd";break e;case"compositionupdate":Me="onCompositionUpdate";break e}Me=void 0}else Sa?vd(e,a)&&(Me="onCompositionEnd"):e==="keydown"&&a.keyCode===229&&(Me="onCompositionStart");Me&&(md&&a.locale!=="ko"&&(Sa||Me!=="onCompositionStart"?Me==="onCompositionEnd"&&Sa&&(be=cd()):(ei=G,Do="value"in ei?ei.value:ei.textContent,Sa=!0)),re=bl(C,Me),0<re.length&&(Me=new hd(Me,e,null,a,G),V.push({event:Me,listeners:re}),be?Me.data=be:(be=bd(a),be!==null&&(Me.data=be)))),(be=Pv?Qv(e,a):Zv(e,a))&&(Me=bl(C,"onBeforeInput"),0<Me.length&&(re=new hd("onBeforeInput","beforeinput",null,a,G),V.push({event:re,listeners:Me}),re.data=be)),Vb(V,e,C,a,G)}im(V,t)})}function Xs(e,t,a){return{instance:e,listener:t,currentTarget:a}}function bl(e,t){for(var a=t+"Capture",l=[];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&&l.unshift(Xs(e,u,f)),u=ps(e,t),u!=null&&l.push(Xs(e,u,f))),e.tag===3)return l;e=e.return}return[]}function Yb(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function sm(e,t,a,l,u){for(var f=t._reactName,p=[];a!==null&&a!==l;){var y=a,S=y.alternate,C=y.stateNode;if(y=y.tag,S!==null&&S===l)break;y!==5&&y!==26&&y!==27||C===null||(S=C,u?(C=ps(a,f),C!=null&&p.unshift(Xs(a,C,S))):u||(C=ps(a,f),C!=null&&p.push(Xs(a,C,S)))),a=a.return}p.length!==0&&e.push({event:t,listeners:p})}var Xb=/\r\n?/g,Kb=/\u0000|\uFFFD/g;function rm(e){return(typeof e=="string"?e:""+e).replace(Xb,`
9
+ `).replace(Kb,"")}function lm(e,t){return t=rm(t),rm(e)===t}function Be(e,t,a,l,u,f){switch(a){case"children":typeof l=="string"?t==="body"||t==="textarea"&&l===""||va(e,l):(typeof l=="number"||typeof l=="bigint")&&t!=="body"&&va(e,""+l);break;case"className":Er(e,"class",l);break;case"tabIndex":Er(e,"tabindex",l);break;case"dir":case"role":case"viewBox":case"width":case"height":Er(e,a,l);break;case"style":ld(e,l,f);break;case"data":if(t!=="object"){Er(e,"data",l);break}case"src":case"href":if(l===""&&(t!=="a"||a!=="href")){e.removeAttribute(a);break}if(l==null||typeof l=="function"||typeof l=="symbol"||typeof l=="boolean"){e.removeAttribute(a);break}l=Ar(""+l),e.setAttribute(a,l);break;case"action":case"formAction":if(typeof l=="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"&&Be(e,t,"name",u.name,u,null),Be(e,t,"formEncType",u.formEncType,u,null),Be(e,t,"formMethod",u.formMethod,u,null),Be(e,t,"formTarget",u.formTarget,u,null)):(Be(e,t,"encType",u.encType,u,null),Be(e,t,"method",u.method,u,null),Be(e,t,"target",u.target,u,null)));if(l==null||typeof l=="symbol"||typeof l=="boolean"){e.removeAttribute(a);break}l=Ar(""+l),e.setAttribute(a,l);break;case"onClick":l!=null&&(e.onclick=zn);break;case"onScroll":l!=null&&we("scroll",e);break;case"onScrollEnd":l!=null&&we("scrollend",e);break;case"dangerouslySetInnerHTML":if(l!=null){if(typeof l!="object"||!("__html"in l))throw Error(r(61));if(a=l.__html,a!=null){if(u.children!=null)throw Error(r(60));e.innerHTML=a}}break;case"multiple":e.multiple=l&&typeof l!="function"&&typeof l!="symbol";break;case"muted":e.muted=l&&typeof l!="function"&&typeof l!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(l==null||typeof l=="function"||typeof l=="boolean"||typeof l=="symbol"){e.removeAttribute("xlink:href");break}a=Ar(""+l),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":l!=null&&typeof l!="function"&&typeof l!="symbol"?e.setAttribute(a,""+l):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":l&&typeof l!="function"&&typeof l!="symbol"?e.setAttribute(a,""):e.removeAttribute(a);break;case"capture":case"download":l===!0?e.setAttribute(a,""):l!==!1&&l!=null&&typeof l!="function"&&typeof l!="symbol"?e.setAttribute(a,l):e.removeAttribute(a);break;case"cols":case"rows":case"size":case"span":l!=null&&typeof l!="function"&&typeof l!="symbol"&&!isNaN(l)&&1<=l?e.setAttribute(a,l):e.removeAttribute(a);break;case"rowSpan":case"start":l==null||typeof l=="function"||typeof l=="symbol"||isNaN(l)?e.removeAttribute(a):e.setAttribute(a,l);break;case"popover":we("beforetoggle",e),we("toggle",e),wr(e,"popover",l);break;case"xlinkActuate":On(e,"http://www.w3.org/1999/xlink","xlink:actuate",l);break;case"xlinkArcrole":On(e,"http://www.w3.org/1999/xlink","xlink:arcrole",l);break;case"xlinkRole":On(e,"http://www.w3.org/1999/xlink","xlink:role",l);break;case"xlinkShow":On(e,"http://www.w3.org/1999/xlink","xlink:show",l);break;case"xlinkTitle":On(e,"http://www.w3.org/1999/xlink","xlink:title",l);break;case"xlinkType":On(e,"http://www.w3.org/1999/xlink","xlink:type",l);break;case"xmlBase":On(e,"http://www.w3.org/XML/1998/namespace","xml:base",l);break;case"xmlLang":On(e,"http://www.w3.org/XML/1998/namespace","xml:lang",l);break;case"xmlSpace":On(e,"http://www.w3.org/XML/1998/namespace","xml:space",l);break;case"is":wr(e,"is",l);break;case"innerText":case"textContent":break;default:(!(2<a.length)||a[0]!=="o"&&a[0]!=="O"||a[1]!=="n"&&a[1]!=="N")&&(a=wv.get(a)||a,wr(e,a,l))}}function uc(e,t,a,l,u,f){switch(a){case"style":ld(e,l,f);break;case"dangerouslySetInnerHTML":if(l!=null){if(typeof l!="object"||!("__html"in l))throw Error(r(61));if(a=l.__html,a!=null){if(u.children!=null)throw Error(r(60));e.innerHTML=a}}break;case"children":typeof l=="string"?va(e,l):(typeof l=="number"||typeof l=="bigint")&&va(e,""+l);break;case"onScroll":l!=null&&we("scroll",e);break;case"onScrollEnd":l!=null&&we("scrollend",e);break;case"onClick":l!=null&&(e.onclick=zn);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!Wf.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[Ct]||null,f=f!=null?f[a]:null,typeof f=="function"&&e.removeEventListener(t,f,u),typeof l=="function")){typeof f!="function"&&f!==null&&(a in e?e[a]=null:e.hasAttribute(a)&&e.removeAttribute(a)),e.addEventListener(t,l,u);break e}a in e?e[a]=l:l===!0?e.setAttribute(a,""):wr(e,a,l)}}}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":we("error",e),we("load",e);var l=!1,u=!1,f;for(f in a)if(a.hasOwnProperty(f)){var p=a[f];if(p!=null)switch(f){case"src":l=!0;break;case"srcSet":u=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(r(137,t));default:Be(e,t,f,p,a,null)}}u&&Be(e,t,"srcSet",a.srcSet,a,null),l&&Be(e,t,"src",a.src,a,null);return;case"input":we("invalid",e);var y=f=p=u=null,S=null,C=null;for(l in a)if(a.hasOwnProperty(l)){var G=a[l];if(G!=null)switch(l){case"name":u=G;break;case"type":p=G;break;case"checked":S=G;break;case"defaultChecked":C=G;break;case"value":f=G;break;case"defaultValue":y=G;break;case"children":case"dangerouslySetInnerHTML":if(G!=null)throw Error(r(137,t));break;default:Be(e,t,l,G,a,null)}}id(e,f,y,S,C,p,u,!1);return;case"select":we("invalid",e),l=p=f=null;for(u in a)if(a.hasOwnProperty(u)&&(y=a[u],y!=null))switch(u){case"value":f=y;break;case"defaultValue":p=y;break;case"multiple":l=y;default:Be(e,t,u,y,a,null)}t=f,a=p,e.multiple=!!l,t!=null?ya(e,!!l,t,!1):a!=null&&ya(e,!!l,a,!0);return;case"textarea":we("invalid",e),f=u=l=null;for(p in a)if(a.hasOwnProperty(p)&&(y=a[p],y!=null))switch(p){case"value":l=y;break;case"defaultValue":u=y;break;case"children":f=y;break;case"dangerouslySetInnerHTML":if(y!=null)throw Error(r(91));break;default:Be(e,t,p,y,a,null)}sd(e,l,u,f);return;case"option":for(S in a)a.hasOwnProperty(S)&&(l=a[S],l!=null)&&(S==="selected"?e.selected=l&&typeof l!="function"&&typeof l!="symbol":Be(e,t,S,l,a,null));return;case"dialog":we("beforetoggle",e),we("toggle",e),we("cancel",e),we("close",e);break;case"iframe":case"object":we("load",e);break;case"video":case"audio":for(l=0;l<Ys.length;l++)we(Ys[l],e);break;case"image":we("error",e),we("load",e);break;case"details":we("toggle",e);break;case"embed":case"source":case"link":we("error",e),we("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(C in a)if(a.hasOwnProperty(C)&&(l=a[C],l!=null))switch(C){case"children":case"dangerouslySetInnerHTML":throw Error(r(137,t));default:Be(e,t,C,l,a,null)}return;default:if(Eo(t)){for(G in a)a.hasOwnProperty(G)&&(l=a[G],l!==void 0&&uc(e,t,G,l,a,void 0));return}}for(y in a)a.hasOwnProperty(y)&&(l=a[y],l!=null&&Be(e,t,y,l,a,null))}function Pb(e,t,a,l){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,y=null,S=null,C=null,G=null;for(N in a){var V=a[N];if(a.hasOwnProperty(N)&&V!=null)switch(N){case"checked":break;case"value":break;case"defaultValue":S=V;default:l.hasOwnProperty(N)||Be(e,t,N,null,l,V)}}for(var z in l){var N=l[z];if(V=a[z],l.hasOwnProperty(z)&&(N!=null||V!=null))switch(z){case"type":f=N;break;case"name":u=N;break;case"checked":C=N;break;case"defaultChecked":G=N;break;case"value":p=N;break;case"defaultValue":y=N;break;case"children":case"dangerouslySetInnerHTML":if(N!=null)throw Error(r(137,t));break;default:N!==V&&Be(e,t,z,N,l,V)}}So(e,p,y,S,C,G,f,u);return;case"select":N=p=y=z=null;for(f in a)if(S=a[f],a.hasOwnProperty(f)&&S!=null)switch(f){case"value":break;case"multiple":N=S;default:l.hasOwnProperty(f)||Be(e,t,f,null,l,S)}for(u in l)if(f=l[u],S=a[u],l.hasOwnProperty(u)&&(f!=null||S!=null))switch(u){case"value":z=f;break;case"defaultValue":y=f;break;case"multiple":p=f;default:f!==S&&Be(e,t,u,f,l,S)}t=y,a=p,l=N,z!=null?ya(e,!!a,z,!1):!!l!=!!a&&(t!=null?ya(e,!!a,t,!0):ya(e,!!a,a?[]:"",!1));return;case"textarea":N=z=null;for(y in a)if(u=a[y],a.hasOwnProperty(y)&&u!=null&&!l.hasOwnProperty(y))switch(y){case"value":break;case"children":break;default:Be(e,t,y,null,l,u)}for(p in l)if(u=l[p],f=a[p],l.hasOwnProperty(p)&&(u!=null||f!=null))switch(p){case"value":z=u;break;case"defaultValue":N=u;break;case"children":break;case"dangerouslySetInnerHTML":if(u!=null)throw Error(r(91));break;default:u!==f&&Be(e,t,p,u,l,f)}ad(e,z,N);return;case"option":for(var ne in a)z=a[ne],a.hasOwnProperty(ne)&&z!=null&&!l.hasOwnProperty(ne)&&(ne==="selected"?e.selected=!1:Be(e,t,ne,null,l,z));for(S in l)z=l[S],N=a[S],l.hasOwnProperty(S)&&z!==N&&(z!=null||N!=null)&&(S==="selected"?e.selected=z&&typeof z!="function"&&typeof z!="symbol":Be(e,t,S,z,l,N));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)z=a[fe],a.hasOwnProperty(fe)&&z!=null&&!l.hasOwnProperty(fe)&&Be(e,t,fe,null,l,z);for(C in l)if(z=l[C],N=a[C],l.hasOwnProperty(C)&&z!==N&&(z!=null||N!=null))switch(C){case"children":case"dangerouslySetInnerHTML":if(z!=null)throw Error(r(137,t));break;default:Be(e,t,C,z,l,N)}return;default:if(Eo(t)){for(var Ge in a)z=a[Ge],a.hasOwnProperty(Ge)&&z!==void 0&&!l.hasOwnProperty(Ge)&&uc(e,t,Ge,void 0,l,z);for(G in l)z=l[G],N=a[G],!l.hasOwnProperty(G)||z===N||z===void 0&&N===void 0||uc(e,t,G,z,l,N);return}}for(var M in a)z=a[M],a.hasOwnProperty(M)&&z!=null&&!l.hasOwnProperty(M)&&Be(e,t,M,null,l,z);for(V in l)z=l[V],N=a[V],!l.hasOwnProperty(V)||z===N||z==null&&N==null||Be(e,t,V,z,l,N)}function om(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function Qb(){if(typeof performance.getEntriesByType=="function"){for(var e=0,t=0,a=performance.getEntriesByType("resource"),l=0;l<a.length;l++){var u=a[l],f=u.transferSize,p=u.initiatorType,y=u.duration;if(f&&y&&om(p)){for(p=0,y=u.responseEnd,l+=1;l<a.length;l++){var S=a[l],C=S.startTime;if(C>y)break;var G=S.transferSize,V=S.initiatorType;G&&om(V)&&(S=S.responseEnd,p+=G*(S<y?1:(y-C)/(S-C)))}if(--l,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 cc=null,fc=null;function xl(e){return e.nodeType===9?e:e.ownerDocument}function um(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 cm(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 dc(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 hc=null;function Zb(){var e=window.event;return e&&e.type==="popstate"?e===hc?!1:(hc=e,!0):(hc=null,!1)}var fm=typeof setTimeout=="function"?setTimeout:void 0,Wb=typeof clearTimeout=="function"?clearTimeout:void 0,dm=typeof Promise=="function"?Promise:void 0,Jb=typeof queueMicrotask=="function"?queueMicrotask:typeof dm<"u"?function(e){return dm.resolve(null).then(e).catch(ex)}:fm;function ex(e){setTimeout(function(){throw e})}function yi(e){return e==="head"}function hm(e,t){var a=t,l=0;do{var u=a.nextSibling;if(e.removeChild(a),u&&u.nodeType===8)if(a=u.data,a==="/$"||a==="/&"){if(l===0){e.removeChild(u),Pa(t);return}l--}else if(a==="$"||a==="$?"||a==="$~"||a==="$!"||a==="&")l++;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,y=f.nodeName;f[ds]||y==="SCRIPT"||y==="STYLE"||y==="LINK"&&f.rel.toLowerCase()==="stylesheet"||a.removeChild(f),f=p}}else a==="body"&&Ks(e.ownerDocument.body);a=u}while(a);Pa(t)}function pm(e,t){var a=e;e=0;do{var l=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||""),l&&l.nodeType===8)if(a=l.data,a==="/$"){if(e===0)break;e--}else a!=="$"&&a!=="$?"&&a!=="$~"&&a!=="$!"||e++;a=l}while(a)}function pc(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":pc(a),bo(a);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(a.rel.toLowerCase()==="stylesheet")continue}e.removeChild(a)}}function tx(e,t,a,l){for(;e.nodeType===1;){var u=a;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!l&&(e.nodeName!=="INPUT"||e.type!=="hidden"))break}else if(l){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=rn(e.nextSibling),e===null)break}return null}function nx(e,t,a){if(t==="")return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!a||(e=rn(e.nextSibling),e===null))return null;return e}function mm(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!t||(e=rn(e.nextSibling),e===null))return null;return e}function mc(e){return e.data==="$?"||e.data==="$~"}function gc(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState!=="loading"}function ix(e,t){var a=e.ownerDocument;if(e.data==="$~")e._reactRetry=t;else if(e.data!=="$?"||a.readyState!=="loading")t();else{var l=function(){t(),a.removeEventListener("DOMContentLoaded",l)};a.addEventListener("DOMContentLoaded",l),e._reactRetry=l}}function rn(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 yc=null;function gm(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var a=e.data;if(a==="/$"||a==="/&"){if(t===0)return rn(e.nextSibling);t--}else a!=="$"&&a!=="$!"&&a!=="$?"&&a!=="$~"&&a!=="&"||t++}e=e.nextSibling}return null}function ym(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 vm(e,t,a){switch(t=xl(a),e){case"html":if(e=t.documentElement,!e)throw Error(r(452));return e;case"head":if(e=t.head,!e)throw Error(r(453));return e;case"body":if(e=t.body,!e)throw Error(r(454));return e;default:throw Error(r(451))}}function Ks(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);bo(e)}var ln=new Map,bm=new Set;function Sl(e){return typeof e.getRootNode=="function"?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var Xn=P.d;P.d={f:ax,r:sx,D:rx,C:lx,L:ox,m:ux,X:fx,S:cx,M:dx};function ax(){var e=Xn.f(),t=dl();return e||t}function sx(e){var t=pa(e);t!==null&&t.tag===5&&t.type==="form"?Lh(t):Xn.r(e)}var Ya=typeof document>"u"?null:document;function xm(e,t,a){var l=Ya;if(l&&typeof t=="string"&&t){var u=Wt(t);u='link[rel="'+e+'"][href="'+u+'"]',typeof a=="string"&&(u+='[crossorigin="'+a+'"]'),bm.has(u)||(bm.add(u),e={rel:e,crossOrigin:a,href:t},l.querySelector(u)===null&&(t=l.createElement("link"),bt(t,"link",e),ht(t),l.head.appendChild(t)))}}function rx(e){Xn.D(e),xm("dns-prefetch",e,null)}function lx(e,t){Xn.C(e,t),xm("preconnect",e,t)}function ox(e,t,a){Xn.L(e,t,a);var l=Ya;if(l&&e&&t){var u='link[rel="preload"][as="'+Wt(t)+'"]';t==="image"&&a&&a.imageSrcSet?(u+='[imagesrcset="'+Wt(a.imageSrcSet)+'"]',typeof a.imageSizes=="string"&&(u+='[imagesizes="'+Wt(a.imageSizes)+'"]')):u+='[href="'+Wt(e)+'"]';var f=u;switch(t){case"style":f=Xa(e);break;case"script":f=Ka(e)}ln.has(f)||(e=b({rel:"preload",href:t==="image"&&a&&a.imageSrcSet?void 0:e,as:t},a),ln.set(f,e),l.querySelector(u)!==null||t==="style"&&l.querySelector(Ps(f))||t==="script"&&l.querySelector(Qs(f))||(t=l.createElement("link"),bt(t,"link",e),ht(t),l.head.appendChild(t)))}}function ux(e,t){Xn.m(e,t);var a=Ya;if(a&&e){var l=t&&typeof t.as=="string"?t.as:"script",u='link[rel="modulepreload"][as="'+Wt(l)+'"][href="'+Wt(e)+'"]',f=u;switch(l){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":f=Ka(e)}if(!ln.has(f)&&(e=b({rel:"modulepreload",href:e},t),ln.set(f,e),a.querySelector(u)===null)){switch(l){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(a.querySelector(Qs(f)))return}l=a.createElement("link"),bt(l,"link",e),ht(l),a.head.appendChild(l)}}}function cx(e,t,a){Xn.S(e,t,a);var l=Ya;if(l&&e){var u=ma(l).hoistableStyles,f=Xa(e);t=t||"default";var p=u.get(f);if(!p){var y={loading:0,preload:null};if(p=l.querySelector(Ps(f)))y.loading=5;else{e=b({rel:"stylesheet",href:e,"data-precedence":t},a),(a=ln.get(f))&&vc(e,a);var S=p=l.createElement("link");ht(S),bt(S,"link",e),S._p=new Promise(function(C,G){S.onload=C,S.onerror=G}),S.addEventListener("load",function(){y.loading|=1}),S.addEventListener("error",function(){y.loading|=2}),y.loading|=4,wl(p,t,l)}p={type:"stylesheet",instance:p,count:1,state:y},u.set(f,p)}}}function fx(e,t){Xn.X(e,t);var a=Ya;if(a&&e){var l=ma(a).hoistableScripts,u=Ka(e),f=l.get(u);f||(f=a.querySelector(Qs(u)),f||(e=b({src:e,async:!0},t),(t=ln.get(u))&&bc(e,t),f=a.createElement("script"),ht(f),bt(f,"link",e),a.head.appendChild(f)),f={type:"script",instance:f,count:1,state:null},l.set(u,f))}}function dx(e,t){Xn.M(e,t);var a=Ya;if(a&&e){var l=ma(a).hoistableScripts,u=Ka(e),f=l.get(u);f||(f=a.querySelector(Qs(u)),f||(e=b({src:e,async:!0,type:"module"},t),(t=ln.get(u))&&bc(e,t),f=a.createElement("script"),ht(f),bt(f,"link",e),a.head.appendChild(f)),f={type:"script",instance:f,count:1,state:null},l.set(u,f))}}function Sm(e,t,a,l){var u=(u=de.current)?Sl(u):null;if(!u)throw Error(r(446));switch(e){case"meta":case"title":return null;case"style":return typeof a.precedence=="string"&&typeof a.href=="string"?(t=Xa(a.href),a=ma(u).hoistableStyles,l=a.get(t),l||(l={type:"style",instance:null,count:0,state:null},a.set(t,l)),l):{type:"void",instance:null,count:0,state:null};case"link":if(a.rel==="stylesheet"&&typeof a.href=="string"&&typeof a.precedence=="string"){e=Xa(a.href);var f=ma(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(Ps(e)))&&!f._p&&(p.instance=f,p.state.loading=5),ln.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},ln.set(e,a),f||hx(u,e,a,p.state))),t&&l===null)throw Error(r(528,""));return p}if(t&&l!==null)throw Error(r(529,""));return null;case"script":return t=a.async,a=a.src,typeof a=="string"&&t&&typeof t!="function"&&typeof t!="symbol"?(t=Ka(a),a=ma(u).hoistableScripts,l=a.get(t),l||(l={type:"script",instance:null,count:0,state:null},a.set(t,l)),l):{type:"void",instance:null,count:0,state:null};default:throw Error(r(444,e))}}function Xa(e){return'href="'+Wt(e)+'"'}function Ps(e){return'link[rel="stylesheet"]['+e+"]"}function wm(e){return b({},e,{"data-precedence":e.precedence,precedence:null})}function hx(e,t,a,l){e.querySelector('link[rel="preload"][as="style"]['+t+"]")?l.loading=1:(t=e.createElement("link"),l.preload=t,t.addEventListener("load",function(){return l.loading|=1}),t.addEventListener("error",function(){return l.loading|=2}),bt(t,"link",a),ht(t),e.head.appendChild(t))}function Ka(e){return'[src="'+Wt(e)+'"]'}function Qs(e){return"script[async]"+e}function Em(e,t,a){if(t.count++,t.instance===null)switch(t.type){case"style":var l=e.querySelector('style[data-href~="'+Wt(a.href)+'"]');if(l)return t.instance=l,ht(l),l;var u=b({},a,{"data-href":a.href,"data-precedence":a.precedence,href:null,precedence:null});return l=(e.ownerDocument||e).createElement("style"),ht(l),bt(l,"style",u),wl(l,a.precedence,e),t.instance=l;case"stylesheet":u=Xa(a.href);var f=e.querySelector(Ps(u));if(f)return t.state.loading|=4,t.instance=f,ht(f),f;l=wm(a),(u=ln.get(u))&&vc(l,u),f=(e.ownerDocument||e).createElement("link"),ht(f);var p=f;return p._p=new Promise(function(y,S){p.onload=y,p.onerror=S}),bt(f,"link",l),t.state.loading|=4,wl(f,a.precedence,e),t.instance=f;case"script":return f=Ka(a.src),(u=e.querySelector(Qs(f)))?(t.instance=u,ht(u),u):(l=a,(u=ln.get(f))&&(l=b({},a),bc(l,u)),e=e.ownerDocument||e,u=e.createElement("script"),ht(u),bt(u,"link",l),e.head.appendChild(u),t.instance=u);case"void":return null;default:throw Error(r(443,t.type))}else t.type==="stylesheet"&&(t.state.loading&4)===0&&(l=t.instance,t.state.loading|=4,wl(l,a.precedence,e));return t.instance}function wl(e,t,a){for(var l=a.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),u=l.length?l[l.length-1]:null,f=u,p=0;p<l.length;p++){var y=l[p];if(y.dataset.precedence===t)f=y;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 vc(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.title==null&&(e.title=t.title)}function bc(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.integrity==null&&(e.integrity=t.integrity)}var El=null;function Tm(e,t,a){if(El===null){var l=new Map,u=El=new Map;u.set(a,l)}else u=El,l=u.get(a),l||(l=new Map,u.set(a,l));if(l.has(e))return l;for(l.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 y=l.get(p);y?y.push(f):l.set(p,[f])}}return l}function Am(e,t,a){e=e.ownerDocument||e,e.head.insertBefore(a,t==="title"?e.querySelector("head > title"):null)}function px(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 Mm(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function mx(e,t,a,l){if(a.type==="stylesheet"&&(typeof l.media!="string"||matchMedia(l.media).matches!==!1)&&(a.state.loading&4)===0){if(a.instance===null){var u=Xa(l.href),f=t.querySelector(Ps(u));if(f){t=f._p,t!==null&&typeof t=="object"&&typeof t.then=="function"&&(e.count++,e=Tl.bind(e),t.then(e,e)),a.state.loading|=4,a.instance=f,ht(f);return}f=t.ownerDocument||t,l=wm(l),(u=ln.get(u))&&vc(l,u),f=f.createElement("link"),ht(f);var p=f;p._p=new Promise(function(y,S){p.onload=y,p.onerror=S}),bt(f,"link",l),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=Tl.bind(e),t.addEventListener("load",a),t.addEventListener("error",a))}}var xc=0;function gx(e,t){return e.stylesheets&&e.count===0&&Ml(e,e.stylesheets),0<e.count||0<e.imgCount?function(a){var l=setTimeout(function(){if(e.stylesheets&&Ml(e,e.stylesheets),e.unsuspend){var f=e.unsuspend;e.unsuspend=null,f()}},6e4+t);0<e.imgBytes&&xc===0&&(xc=62500*Qb());var u=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&Ml(e,e.stylesheets),e.unsuspend)){var f=e.unsuspend;e.unsuspend=null,f()}},(e.imgBytes>xc?50:800)+t);return e.unsuspend=a,function(){e.unsuspend=null,clearTimeout(l),clearTimeout(u)}}:null}function Tl(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Ml(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var Al=null;function Ml(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,Al=new Map,t.forEach(yx,e),Al=null,Tl.call(e))}function yx(e,t){if(!(t.state.loading&4)){var a=Al.get(e);if(a)var l=a.get(null);else{a=new Map,Al.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),l=p)}l&&a.set(null,l)}u=t.instance,p=u.getAttribute("data-precedence"),f=a.get(p)||l,f===l&&a.set(null,u),a.set(p,u),this.count++,l=Tl.bind(this),u.addEventListener("load",l),u.addEventListener("error",l),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:K,Provider:null,Consumer:null,_currentValue:ae,_currentValue2:ae,_threadCount:0};function vx(e,t,a,l,u,f,p,y,S){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=mo(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=mo(0),this.hiddenUpdates=mo(null),this.identifierPrefix=l,this.onUncaughtError=u,this.onCaughtError=f,this.onRecoverableError=p,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=S,this.incompleteTransitions=new Map}function Rm(e,t,a,l,u,f,p,y,S,C,G,V){return e=new vx(e,t,a,p,S,C,G,V,y),t=1,f===!0&&(t|=24),f=It(3,null,null,t),e.current=f,f.stateNode=e,t=Jo(),t.refCount++,e.pooledCache=t,t.refCount++,f.memoizedState={element:l,isDehydrated:a,cache:t},iu(f),e}function Dm(e){return e?(e=Aa,e):Aa}function Cm(e,t,a,l,u,f){u=Dm(u),l.context===null?l.context=u:l.pendingContext=u,l=ri(t),l.payload={element:a},f=f===void 0?null:f,f!==null&&(l.callback=f),a=li(e,l,t),a!==null&&(kt(a,e,t),Cs(a,e,t))}function Om(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var a=e.retryLane;e.retryLane=a!==0&&a<t?a:t}}function Sc(e,t){Om(e,t),(e=e.alternate)&&Om(e,t)}function zm(e){if(e.tag===13||e.tag===31){var t=$i(e,67108864);t!==null&&kt(t,e,67108864),Sc(e,67108864)}}function _m(e){if(e.tag===13||e.tag===31){var t=Yt();t=go(t);var a=$i(e,t);a!==null&&kt(a,e,t),Sc(e,t)}}var Rl=!0;function bx(e,t,a,l){var u=U.T;U.T=null;var f=P.p;try{P.p=2,wc(e,t,a,l)}finally{P.p=f,U.T=u}}function xx(e,t,a,l){var u=U.T;U.T=null;var f=P.p;try{P.p=8,wc(e,t,a,l)}finally{P.p=f,U.T=u}}function wc(e,t,a,l){if(Rl){var u=Ec(l);if(u===null)oc(e,t,l,Dl,a),Nm(e,l);else if(wx(u,e,t,a,l))l.stopPropagation();else if(Nm(e,l),t&4&&-1<Sx.indexOf(e)){for(;u!==null;){var f=pa(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 y=f;for(y.pendingLanes|=2,y.entangledLanes|=2;p;){var S=1<<31-tt(p);y.entanglements[1]|=S,p&=~S}wn(f),(Ue&6)===0&&(cl=He()+500,qs(0))}}break;case 31:case 13:y=$i(f,2),y!==null&&kt(y,f,2),dl(),Sc(f,2)}if(f=Ec(l),f===null&&oc(e,t,l,Dl,a),f===u)break;u=f}u!==null&&l.stopPropagation()}else oc(e,t,l,null,a)}}function Ec(e){return e=Ao(e),Tc(e)}var Dl=null;function Tc(e){if(Dl=null,e=ha(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 Dl=e,null}function Um(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(hn()){case St:return 2;case Gt:return 8;case Dn:case fa:return 32;case Cn:return 268435456;default:return 32}default:return 32}}var Ac=!1,vi=null,bi=null,xi=null,Ws=new Map,Js=new Map,Si=[],Sx="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 Nm(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,l,u,f){return e===null||e.nativeEvent!==f?(e={blockedOn:t,domEventName:a,eventSystemFlags:l,nativeEvent:f,targetContainers:[u]},t!==null&&(t=pa(t),t!==null&&zm(t)),e):(e.eventSystemFlags|=l,t=e.targetContainers,u!==null&&t.indexOf(u)===-1&&t.push(u),e)}function wx(e,t,a,l,u){switch(t){case"focusin":return vi=er(vi,e,t,a,l,u),!0;case"dragenter":return bi=er(bi,e,t,a,l,u),!0;case"mouseover":return xi=er(xi,e,t,a,l,u),!0;case"pointerover":var f=u.pointerId;return Ws.set(f,er(Ws.get(f)||null,e,t,a,l,u)),!0;case"gotpointercapture":return f=u.pointerId,Js.set(f,er(Js.get(f)||null,e,t,a,l,u)),!0}return!1}function km(e){var t=ha(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,Pf(e.priority,function(){_m(a)});return}}else if(t===31){if(t=h(a),t!==null){e.blockedOn=t,Pf(e.priority,function(){_m(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 Cl(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var a=Ec(e.nativeEvent);if(a===null){a=e.nativeEvent;var l=new a.constructor(a.type,a);To=l,a.target.dispatchEvent(l),To=null}else return t=pa(a),t!==null&&zm(t),e.blockedOn=a,!1;t.shift()}return!0}function Lm(e,t,a){Cl(e)&&a.delete(t)}function Ex(){Ac=!1,vi!==null&&Cl(vi)&&(vi=null),bi!==null&&Cl(bi)&&(bi=null),xi!==null&&Cl(xi)&&(xi=null),Ws.forEach(Lm),Js.forEach(Lm)}function Ol(e,t){e.blockedOn===t&&(e.blockedOn=null,Ac||(Ac=!0,n.unstable_scheduleCallback(n.unstable_NormalPriority,Ex)))}var zl=null;function jm(e){zl!==e&&(zl=e,n.unstable_scheduleCallback(n.unstable_NormalPriority,function(){zl===e&&(zl=null);for(var t=0;t<e.length;t+=3){var a=e[t],l=e[t+1],u=e[t+2];if(typeof l!="function"){if(Tc(l||a)===null)continue;break}var f=pa(a);f!==null&&(e.splice(t,3),t-=3,Eu(f,{pending:!0,data:u,method:a.method,action:l},l,u))}}))}function Pa(e){function t(S){return Ol(S,e)}vi!==null&&Ol(vi,e),bi!==null&&Ol(bi,e),xi!==null&&Ol(xi,e),Ws.forEach(t),Js.forEach(t);for(var a=0;a<Si.length;a++){var l=Si[a];l.blockedOn===e&&(l.blockedOn=null)}for(;0<Si.length&&(a=Si[0],a.blockedOn===null);)km(a),a.blockedOn===null&&Si.shift();if(a=(e.ownerDocument||e).$$reactFormReplay,a!=null)for(l=0;l<a.length;l+=3){var u=a[l],f=a[l+1],p=u[Ct]||null;if(typeof f=="function")p||jm(a);else if(p){var y=null;if(f&&f.hasAttribute("formAction")){if(u=f,p=f[Ct]||null)y=p.formAction;else if(Tc(u)!==null)continue}else y=p.action;typeof y=="function"?a[l+1]=y:(a.splice(l,3),l-=3),jm(a)}}}function Bm(){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),l||setTimeout(a,20)}function a(){if(!l&&!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 l=!1,u=null;return navigation.addEventListener("navigate",e),navigation.addEventListener("navigatesuccess",t),navigation.addEventListener("navigateerror",t),setTimeout(a,100),function(){l=!0,navigation.removeEventListener("navigate",e),navigation.removeEventListener("navigatesuccess",t),navigation.removeEventListener("navigateerror",t),u!==null&&(u(),u=null)}}}function Mc(e){this._internalRoot=e}_l.prototype.render=Mc.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(r(409));var a=t.current,l=Yt();Cm(a,l,e,t,null,null)},_l.prototype.unmount=Mc.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;Cm(e.current,2,null,e,null,null),dl(),t[da]=null}};function _l(e){this._internalRoot=e}_l.prototype.unstable_scheduleHydration=function(e){if(e){var t=Kf();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&&km(e)}};var Gm=i.version;if(Gm!=="19.2.8")throw Error(r(527,Gm,"19.2.8"));P.findDOMNode=function(e){var t=e._reactInternals;if(t===void 0)throw typeof e.render=="function"?Error(r(188)):(e=Object.keys(e).join(","),Error(r(268,e)));return e=g(t),e=e!==null?x(e):null,e=e===null?null:e.stateNode,e};var Tx={bundleType:0,version:"19.2.8",rendererPackageName:"react-dom",currentDispatcherRef:U,reconcilerVersion:"19.2.8"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Ul=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Ul.isDisabled&&Ul.supportsFiber)try{dt=Ul.inject(Tx),Xe=Ul}catch{}}return nr.createRoot=function(e,t){if(!o(e))throw Error(r(299));var a=!1,l="",u=Yh,f=Xh,p=Kh;return t!=null&&(t.unstable_strictMode===!0&&(a=!0),t.identifierPrefix!==void 0&&(l=t.identifierPrefix),t.onUncaughtError!==void 0&&(u=t.onUncaughtError),t.onCaughtError!==void 0&&(f=t.onCaughtError),t.onRecoverableError!==void 0&&(p=t.onRecoverableError)),t=Rm(e,1,!1,null,null,a,l,null,u,f,p,Bm),e[da]=t.current,lc(e),new Mc(t)},nr.hydrateRoot=function(e,t,a){if(!o(e))throw Error(r(299));var l=!1,u="",f=Yh,p=Xh,y=Kh,S=null;return a!=null&&(a.unstable_strictMode===!0&&(l=!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&&(y=a.onRecoverableError),a.formState!==void 0&&(S=a.formState)),t=Rm(e,1,!0,t,a??null,l,u,S,f,p,y,Bm),t.context=Dm(null),a=t.current,l=Yt(),l=go(l),u=ri(l),u.callback=null,li(a,u,l),a=l,t.current.lanes=a,fs(t,a),wn(t),e[da]=t.current,lc(e),new _l(t)},nr.version="19.2.8",nr}var Pm;function Nx(){if(Pm)return Cc.exports;Pm=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=Ux(),Cc.exports}var kx=Nx();const $e={interactions:"interactions",steps:"steps",errors:"errors",retries:"retries",cpuMs:"cpu.ms",cpuUtilization:"cpu.utilization",tokensInput:"tokens.input",tokensOutput:"tokens.output",tokensCacheRead:"tokens.cacheRead",tokensReasoning:"tokens.reasoning"};function jt(n,i){const s=n[i];return typeof s=="number"&&Number.isFinite(s)?s:void 0}function Zl(n,i){for(const[s,r]of Object.entries(i)){if(typeof r!="number"||!Number.isFinite(r))continue;const o=s;n[o]=(n[o]??0)+r}}const Lx=[$e.tokensInput,$e.tokensOutput,$e.tokensCacheRead];function vn(n){let i=0,s=!1;for(const r of Lx){const o=jt(n,r);o!==void 0&&(s=!0,i+=o)}return s?i:void 0}function es(n){return{input:jt(n,$e.tokensInput)??0,output:jt(n,$e.tokensOutput)??0,cacheRead:jt(n,$e.tokensCacheRead)??0,reasoning:jt(n,$e.tokensReasoning)??0}}function I0(n){const i=vn(n.measures);if(i!==void 0)return Qm(i/1e3,200);const s=jt(n.measures,$e.cpuMs);if(s!==void 0)return Qm(s/1e3,200)}function un(n){return jt(n.measures,$e.interactions)}function bf(n){return jt(n.measures,$e.steps)??0}function la(n){return jt(n.measures,$e.errors)??0}function Jc(n){return jt(n.measures,$e.retries)??0}function Qm(n,i){return Math.min(1,Math.log1p(Math.max(0,n))/Math.log1p(i))}const jx=new Set(["running","waiting"]);function V0(n){return jx.has(n)}function Fl(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 xf=9e4;function Zm(n,i){if(n.waitingSince===void 0)return;const s=n.waitingSince,r=Math.max(s,i);n.waitingMs+=r-s,n.waits.push({start:s,end:r})}function Bx(n,i){const s=`${i.source.id}:${i.source.instance}`;let r=n.sources.get(s);r||(r={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,r)),r.events++,i.occurredAt<r.firstSeenAt&&(r.firstSeenAt=i.occurredAt),i.occurredAt>r.lastSeenAt&&(r.lastSeenAt=i.occurredAt),i.stratum&&(r.strata[i.stratum]=(r.strata[i.stratum]??0)+1);const o=i.provenance?.sourceVersion;o&&(r.sourceVersions?r.sourceVersions.includes(o)||r.sourceVersions.push(o):r.sourceVersions=[o])}function Gx(n,i){if(n.seen.has(i.id))return;n.seen.add(i.id),i.occurredAt>n.now&&(n.now=i.occurredAt),Bx(n,i);const s=i.core??{},r=i.occurredAt;switch(i.subject.type){case"machine":{const o=n.machines.get(i.subject.id);if(o)s.measures&&(o.activity={observedAt:r,measures:{...s.measures},validForMs:s.measureValidityMs,basis:i.basis,assumption:i.assumption});else{const c={id:i.subject.id,name:s.machineName??i.subject.id,kind:s.machineKind??"laptop",parentId:s.parentId,firstSeenAt:r};s.measures&&(c.activity={observedAt:r,measures:{...s.measures},validForMs:s.measureValidityMs,basis:i.basis,assumption:i.assumption}),n.machines.set(c.id,c)}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:r,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=r)}break}case"execution":$x(n,i,r);break;case"process":Ix(n,i,r);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:r});break}}}function $x(n,i,s){const r=i.core??{},o=i.subject.id;if(i.kind==="began"){if(n.executions.has(o))return;const d={id:o,sessionId:r.sessionId??r.parentId??"",machineId:r.machineId??"",label:r.label??o,executor:r.executor??"unknown",model:r.model,status:"running",startedAt:s,lastActivityAt:s,measures:{},waitingMs:0,waits:[],parentId:r.parentId,depth:r.depth??0,startBasis:i.basis,boundsAssumption:i.assumption};r.measures&&Zl(d.measures,r.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":{r.measures&&Zl(c.measures,r.measures),c.lastActivityAt=s,c.status==="idle"&&(c.status="running",n.active.add(o));break}case"blocked":{if(!V0(c.status))break;c.status="waiting",c.waitingSince=s,c.waitReason=r.blockedOn??"input",c.lastActivityAt=s;break}case"resumed":{Zm(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=r.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=r.outcome??"completed",d&&(c.failure={code:r.failureCode??"ERROR",message:r.failureMessage??"Execution failed"}),Zm(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 Ix(n,i,s){const r=i.core??{},o=i.subject.id,c=r.pid??Number(i.attrs?.["os.pid"]??0);if(i.kind==="began"){if(n.processes.has(o))return;const h={id:o,machineId:r.machineId??"",pid:c,ppid:r.ppid??(typeof i.attrs?.["os.ppid"]=="number"?i.attrs["os.ppid"]:void 0),command:r.label??r.executor??String(c),startedAt:s,lastSeenAt:s,status:"running",measures:{}};r.measures&&Zl(h.measures,r.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),r.measures){const h=r.measures[$e.cpuMs];typeof h=="number"&&(d.measures[$e.cpuMs]=h);const{[$e.cpuMs]:m,...g}=r.measures;Zl(d.measures,g)}}else i.kind==="ended"&&(d.endedAt=s,d.lastSeenAt=Math.max(d.lastSeenAt,s),d.status="exited",d.endInferred=i.basis==="inferred")}function Vx(n,i){for(let s=0;s<i.length;s++)Gx(n,i[s])}function Fx(n,i){i>n.now&&(n.now=i),i=n.now;for(const s of n.active){const r=n.executions.get(s);if(!r){n.active.delete(s);continue}r.status==="running"&&i-r.lastActivityAt>xf&&(r.status="idle")}}const Hx=`Wall-clock time covered by recorded run intervals, with parallel intervals counted once and waiting included. An open running record becomes idle after ${xf/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.`,Xt=n=>({value:n,basis:"measured"}),ir=(n,i)=>({value:n,basis:"inferred",assumption:i});function F0(n){if(n.length===0)return[];n.sort((s,r)=>s.start-r.start);const i=[{start:n[0].start,end:n[0].end}];for(let s=1;s<n.length;s++){const r=n[s],o=i[i.length-1];r.start<=o.end?r.end>o.end&&(o.end=r.end):i.push({start:r.start,end:r.end})}return i}function qx(n){let i=0;for(const s of n)i+=s.end-s.start;return i}function Yx(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,r=i[0]?.at??0,o=0;for(const c of i)s>=2&&(o+=c.at-r),s+=c.delta,r=c.at;return o}function H0(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,r=0,o=i[0].t;for(const c of i)s+=c.d,s>r&&(r=s,o=c.t);return{peak:r,at:o}}function Xx(n){if(n.length===0)return;const i=[...n].sort((r,o)=>r-o),s=i.length>>1;return i.length%2?i[s]:(i[s-1]+i[s])/2}function ra(n,i,s=n.startedAt){const r=Math.max(s,n.startedAt),o=Math.min(i,n.endedAt??(n.status==="idle"?n.lastActivityAt:i));return{start:r,end:Math.max(r,o)}}function Ri(n,i){return n.waitingMs+(n.waitingSince===void 0?0:Math.max(0,i-n.waitingSince))}function q0(n){const i=n.now,s=[...n.executions.values()];let r=0,o=0,c=0;const d={tokens:0,tools:0,requests:0};let h=0,m=0,g=0,x=0,b=0;const R=[],B=new Map;for(const Y of s){r+=bf(Y),jt(Y.measures,$e.steps)!==void 0&&d.requests++;const A=vn(Y.measures),k=un(Y);A!==void 0&&(o+=A,d.tokens++),k!==void 0&&(c+=k,d.tools++),Y.status==="completed"&&Y.outcome!=="interrupted"?h++:Y.status==="failed"?m++:Y.status==="waiting"?g++:Y.status==="idle"&&x++;const w=ra(Y,i,n.dayStart);R.push(w),b+=Y.waitingMs,Y.waitingSince!==void 0&&(b+=Math.max(0,i-Y.waitingSince));let $=B.get(Y.machineId);$||($={machineId:Y.machineId,executions:0,tokens:0,computeTime:0},B.set(Y.machineId,$)),$.executions++,$.tokens+=vn(Y.measures)??0,$.computeTime+=w.end-w.start}const O=F0(R.map(Y=>({...Y}))),{peak:L,at:_}=H0(R),H=Kx(n),Z=Qx(H);let K=null;for(const Y of H)(!K||Y.end-Y.start>K.end-K.start)&&(K=Y);let F=0;for(const Y of n.sessions.values())Y.executionIds.some(A=>n.executions.has(A))&&F++;return{requests:Xt(r),sessions:Xt(F),executions:Xt(s.length),tokens:Xt(o),toolCalls:Xt(c),accounting:d,timeInFlight:ir(qx(O),Hx),parallelTime:ir(Yx(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(Y=>Y.startBasis==="inferred"||Y.endBasis==="inferred"||Y.status==="idle")?ir(L,"Peak overlap of the recorded run intervals in this period. Some bounds are inferred, or an idle interval ends at its last observed output."):Xt(L),peakConcurrencyAt:Xt(_),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(K,"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:Xt(b),completed:Xt(h),failed:Xt(m),waiting:Xt(g),idle:Xt(x),byMachine:B,contextSpans:H,transfers:Xt(n.transfers.size)}}function Kx(n){const i=[];for(const r of n.executions.values()){const o=n.sessions.get(r.sessionId);if(!o?.context)continue;const c=ra(r,n.now,n.dayStart);c.end>c.start&&i.push({context:o.context,...c})}i.sort((r,o)=>r.start-o.start);const s=[];for(const r of i){const o=s[s.length-1];o&&o.context===r.context&&r.start<=o.end?r.end>o.end&&(o.end=r.end):o&&o.context===r.context?r.start-o.end<=Px?o.end=Math.max(o.end,r.end):s.push({context:r.context,start:r.start,end:r.end}):s.push({context:r.context,start:r.start,end:r.end})}return s}const Px=15*6e4;function Qx(n){let i=-1/0,s=new Set,r,o=0;const c=()=>{const d=s.size===1?[...s][0]:void 0;r!==void 0&&d!==void 0&&r!==d&&o++,r=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 Zx(n){return{key:n,runs:0,tokens:0,tokenRuns:0,medianRuns:0,computeMs:0,failed:0,waitingMs:0,toolCalls:0}}function Uc(n,i){const s=new Map,r=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=Zx(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 g=r.get(c);g||(g=[],r.set(c,g)),g.push(h)}const m=ra(o,n.now,n.dayStart);d.computeMs+=m.end-m.start,d.waitingMs+=Ri(o,n.now),d.toolCalls+=un(o)??0,o.status==="failed"&&d.failed++}for(const[o,c]of r){const d=s.get(o);d&&(d.medianTokens=Xx(c),d.medianRuns=c.length)}return[...s.values()].sort((o,c)=>c.computeMs-o.computeMs)}function Wx(n){const i={input:0,output:0,cacheRead:0,reasoning:0,total:0};for(const s of n.executions.values()){const r=es(s.measures);i.input+=r.input,i.output+=r.output,i.cacheRead+=r.cacheRead,i.reasoning+=r.reasoning}return i.total=i.input+i.output+i.cacheRead,i}function Jx(n){const i={count:0,totalMs:0,longestMs:0,openNow:0};for(const s of n.executions.values()){for(const r of s.waits){i.count++;const o=r.end-r.start;i.totalMs+=o,o>i.longestMs&&(i.longestMs=o)}if(s.waitingSince!==void 0){i.count++,i.openNow++;const r=n.now-s.waitingSince;i.totalMs+=r,r>i.longestMs&&(i.longestMs=r)}}return i}function e1(n){const i={toolCalls:0,toolErrors:0,retries:0,failed:0,interrupted:0,completed:0};for(const s of n.executions.values())i.toolCalls+=un(s)??0,i.toolErrors+=la(s),i.retries+=Jc(s),s.status==="failed"?i.failed++:s.outcome==="interrupted"?i.interrupted++:s.outcome==="completed"&&i.completed++;return i}function t1(n){return n1(n).map(i=>({hour:new Date(i.from).getHours(),computeMs:i.computeMs,runs:i.runs,peak:i.peak}))}function n1(n,i){const s=[...n.executions.values()].map(d=>{const h=ra(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 r=F0(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(),g=r.reduce((b,R)=>b+Math.max(0,Math.min(R.end,m)-Math.max(R.start,d)),0),x=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:g,runs:x.length,peak:H0(x).peak}),d=m}return c}const Y0=1e3,Wm=60*Y0;function Ze(n){if(!Number.isFinite(n)||n<=0)return"0m";if(n<Wm)return`${Math.max(1,Math.round(n/Y0))}s`;const i=Math.round(n/Wm),s=Math.floor(i/60),r=i%60;return s===0?`${r}m`:r===0?`${s}h`:`${s}h ${r}m`}function ft(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:ft(n)}function Nc(n,i){if(i<=0)return"—";const s=n/i*100;return s>0&&s<1?"<1%":`${Math.round(s)}%`}function i1(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 a1=6e4;function X0(n,i){const s=[],r=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(r.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>a1&&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}}const En={spanX:1160,strataTop:812,strataHeight:360},s1=3,r1=4,Jm=30,K0=74;function P0(n){return Jm+n*(K0-Jm)}function eg(n,i,s){let r=null,o=1/0;for(const d of n.disturbances){const h=P0(d.extent),m=i-d.x,g=(s-d.y)*1.5,x=Math.hypot(m,g);x<h*1.3&&x<o&&(o=x,r={kind:"disturbance",id:d.id,x:d.x,y:d.y})}if(r)return r;for(const d of n.couplings){const h=n.masses.find(L=>L.id===d.fromMassId),m=n.masses.find(L=>L.id===d.toMassId);if(!h||!m)continue;const g=m.x-h.x,x=m.y-h.y,b=g*g+x*x;if(b===0)continue;const R=((i-h.x)*g+(s-h.y)*x)/b;if(R<.05||R>.95)continue;const B=h.x+g*R,O=h.y+x*R;if(Math.hypot(i-B,(s-O)*1.5)<50)return{kind:"coupling",id:d.id,x:B,y:O}}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)),g=i/En.spanX;let x=null,b=1/0;const R=s1/En.spanX,B=r1/En.spanX;for(const O of n.strata){if(O.lane!==m)continue;const L=Math.max(R,O.endFraction-O.startFraction);g<O.startFraction-B||g>O.startFraction+L+B||L<b&&(b=L,x={kind:"stratum",id:O.id,x:i,y:s})}if(x)return x}return null}function l1(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 Wl(n,i=0){return l1(n+"#"+i)%1e5/1e5}const kc=[{x:430,y:508,extentX:300,extentY:186},{x:838,y:322,extentX:186,extentY:116}];function o1(n){if(n<kc.length)return kc[n];const s=-.9+(n-kc.length)*1.15;return{x:620+Math.cos(s)*520,y:300+Math.sin(s)*250,extentX:150,extentY:94}}function u1(n){const i=s=>s==="laptop"?0:s==="desktop"?1:2;return[...n].sort((s,r)=>i(s.kind)-i(r.kind)||s.firstSeenAt-r.firstSeenAt||(s.id<r.id?-1:s.id>r.id?1:0))}function ef(n,i){const s=Wl(i,1),r=Wl(i,2),o=s*Math.PI*2+r*2.399963,c=.34+.46*Math.sqrt(r);return{x:n.x+Math.cos(o)*n.extentX*c,y:n.y+Math.sin(o)*n.extentY*c}}function c1(n,i,s=new Map){const r=new Map,o=new Map,c=new Map,d=(m,g)=>Math.hypot(m.x-g.x,(m.y-g.y)*1.5),h=(m,g)=>{const x=new Set;for(let b=m;b&&!x.has(b);b=s.get(b)?.parentId){if(b===g)return!0;x.add(b)}return!1};for(const m of[...i].sort((g,x)=>g.startedAt-x.startedAt||(g.id<x.id?-1:g.id>x.id?1:0))){const g=n.get(m.machineId);if(!g)continue;const x=(o.get(m.machineId)??[]).filter(O=>O.until>=m.startedAt),b=x.filter(O=>!h(O.session,m.sessionId)&&!h(m.sessionId,O.session));let R=ef(g,m.id);const B=O=>Math.min(...b.map(L=>d(O,L)));if(B(R)<K0*2.05){let O=c.get(m.machineId);if(!O){O=[];for(let _=-7;_<=7;_++)for(let H=-9;H<=9;H++)_*_+H*H>81||O.push({x:g.x+_*g.extentX/10,y:g.y+H*g.extentY/10});c.set(m.machineId,O)}let L=B(R);for(const _ of O){const H=B(_);H>L&&(R=_,L=H)}}r.set(m.id,R),x.push({...R,until:m.endedAt===void 0?1/0:m.endedAt+45e3,session:m.sessionId}),o.set(m.machineId,x)}return r}const tg=64,f1=8,d1=8,ng=16,ig=.45;function h1(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 ag=.32;function p1(n){const i=I0(n),s=n.depth>0?.62:1;return i===void 0?ag*s:Math.min(1,(ag+.68*i)*s)}function m1(n,i){const s=Math.max(1,(n.endedAt??i)-n.startedAt),r=(un(n)??0)/(s/6e4);return Math.min(1,.25+r/24)}function sg(n){return(n.status==="failed"?3:n.status==="waiting"?2:n.status==="running"?1:0)*1e15+n.lastActivityAt}function g1(n){const i=new Set,s=new Set,r=new Map,o=new Map,c=(d,h,m)=>{const g=d.get(h);g?g.push(m):d.set(h,[m])};for(const d of n.relationships){const{from:h,to:m,kind:g}=d;g==="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"?r.set(h.id,m.id):h.type==="session"&&m.type==="execution"&&r.set(m.id,h.id)):g==="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:r,sameExecution:o}}function y1(n,i){const r=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?r:(r+o)/2,d=I0(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 rg(n){let i=1;for(const s of n)i*=1-Math.min(1,Math.max(0,s));return 1-i}function lg(n,i,s,r){const o=Math.max(n,s),c=Math.min(i,r);if(c<o)return 0;const d=Math.max(i,r)-Math.min(n,s);return d<=0?1:(c-o)/d}function v1(n){const i=n.now,s=u1(n.machines.values()).slice(0,f1),r=new Map,o=[];s.forEach((A,k)=>{const w=o1(k);r.set(A.id,w),o.push({id:A.id,name:A.name,kind:A.kind,x:w.x,y:w.y,extentX:w.extentX,extentY:w.extentY,prominence:b1(A,i),...A.activity?.validForMs===void 0?{}:{activityValidUntil:A.activity.observedAt+A.activity.validForMs},seed:Wl(A.id,7)})});const c=45e3,d=[];for(const A of n.executions.values())(A.status==="completed"||A.status==="failed")&&i-(A.endedAt??i)>c||A.status==="idle"&&i-A.lastActivityAt>c*4||r.has(A.machineId)&&d.push(A);d.length>tg&&(d.sort((A,k)=>sg(k)-sg(A)),d.length=tg);const h=g1(n),m=c1(r,n.executions.values(),n.sessions),g=A=>{const k=r.get(A.machineId),{x:w,y:$}=m.get(A.id)??ef(k,A.id),te=n.sessions.get(A.sessionId);return{id:A.id,massId:A.machineId,sessionId:A.sessionId,x:w,y:$,extent:p1(A),energy:h1(A,i),rate:m1(A,i),phase:Wl(A.id,3)*Math.PI*2,status:A.status,label:A.label,projectLabel:te?.projectLabel,taskLabel:te?.taskLabel,statusSince:A.waitingSince??A.endedAt??A.startedAt,articulation:y1(A,h),shoulder:0,observers:1}},x=new Set(d.map(A=>A.id)),b=new Set,R=[],B=A=>[A.startedAt,A.endedAt??i];for(const A of[...d].sort((k,w)=>k.id<w.id?-1:1)){if(b.has(A.id))continue;const k=[A];b.add(A.id);for(let he=0;he<k.length;he++)for(const me of h.sameExecution.get(k[he].id)??[])!x.has(me)||b.has(me)||(b.add(me),k.push(n.executions.get(me)));if(k.length===1){R.push(g(A));continue}const w=k.map(g),$=w.reduce((he,me)=>me.articulation>he.articulation||me.articulation===he.articulation&&me.id<he.id?me:he);let te=1;const[se,oe]=B(n.executions.get($.id));for(const he of k){const[me,ce]=B(he);te=Math.min(te,lg(se,oe,me,ce))}R.push({...$,extent:Math.max(...w.map(he=>he.extent)),energy:Math.max(...w.map(he=>he.energy)),articulation:rg(w.map(he=>he.articulation)),shoulder:Math.min(ig,1-te),observers:k.length})}const O=new Map;for(const A of R){if(h.runObservesSession.has(A.id))continue;const k=O.get(A.sessionId);k?k.push(A):O.set(A.sessionId,[A])}const L=new Map,_=[];for(const A of R){const k=h.runObservesSession.get(A.id),w=k?O.get(k):void 0;if(!k||!w||w.length===0){if(_.push(A),k){const ce=O.get(A.sessionId);ce?ce.push(A):O.set(A.sessionId,[A])}continue}const $=n.executions.get(A.id);let te=1/0,se=-1/0;for(const ce of w){const[U,P]=B(n.executions.get(ce.id));te=Math.min(te,U),se=Math.max(se,P)}const[oe,he]=B($),me=L.get(k)??{articulations:[],coincidence:1};me.articulations.push(A.articulation),me.coincidence=Math.min(me.coincidence,lg(oe,he,te,se)),L.set(k,me)}const H=[];for(const A of[...O.keys()].sort()){const k=O.get(A),w=n.sessions.get(A);if(!w||k.length===0)continue;let $=0,te=0;for(const ce of k)$+=ce.x,te+=ce.y;$/=k.length,te/=k.length;let se=0,oe=0;for(const ce of k){const U=P0(ce.extent);se=Math.max(se,Math.abs(ce.x-$)+U*1.5),oe=Math.max(oe,Math.abs(ce.y-te)+U)}const he=L.get(A),me=Math.max(...k.map(ce=>ce.articulation));H.push({id:A,massId:k[0].massId,x:$,y:te,extentX:Math.max(se,52),extentY:Math.max(oe,36),presence:1,articulation:he?rg([me,...he.articulations]):me,parentId:w.parentId,empty:!1,shoulder:he?Math.min(ig,1-he.coincidence):0,observers:1+(he?.articulations.length??0),label:w.label??w.executor??A,projectLabel:w.projectLabel,taskLabel:w.taskLabel})}for(const A of[...n.sessions.values()].sort((k,w)=>k.id<w.id?-1:1)){if(A.executionIds.length>0||A.endedAt!==void 0&&i-A.endedAt>c)continue;const k=r.get(A.machineId);if(!k)continue;const{x:w,y:$}=ef(k,`session-presence:${A.id}`);H.push({id:A.id,massId:A.machineId,x:w,y:$,extentX:64,extentY:42,presence:1,articulation:h.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(H.length>ng){const A=k=>k.empty?0:O.get(k.id)?.length??0;H.sort((k,w)=>A(w)-A(k)||(k.id<w.id?-1:1)),H.length=ng}const Z=[];for(const A of n.transfers.values())if(A.endedAt===void 0&&!(!r.has(A.fromMachineId)||!r.has(A.toMachineId))){if(Z.length>=d1)break;Z.push({id:A.id,fromMassId:A.fromMachineId,toMassId:A.toMachineId,energy:1,label:A.label})}const K=new Map;s.forEach((A,k)=>K.set(A.id,k));const F=Math.max(1,n.dayEnd-n.dayStart),Y=[];for(const A of n.executions.values()){const k=K.get(A.machineId);if(k===void 0)continue;const w=(A.startedAt-n.dayStart)/F,$=((A.endedAt??i)-n.dayStart)/F;Y.push({id:A.id,massId:A.machineId,lane:k,startFraction:Math.max(0,Math.min(1,w)),endFraction:Math.max(0,Math.min(1,$)),status:A.status,label:A.label})}return{time:i,masses:o,disturbances:_,plinths:H,couplings:Z,strata:Y}}function b1(n,i){const s=n.activity;if(!s||s.validForMs===void 0||i<s.observedAt||i-s.observedAt>=s.validForMs)return 0;const r=jt(s.measures,$e.cpuUtilization);return r===void 0||!Number.isFinite(r)?0:Math.min(1,Math.max(0,r))}const Hl="synthetic";let x1=0;const Lt=(n,i,s,r)=>({id:`syn:${(x1++).toString(36)}`,source:{id:Hl,instance:"replay"},occurredAt:n,observedAt:n,clock:"wall",kind:i,subject:s,core:r,basis:"measured",stratum:"stored-semantics"});function S1(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,w1=60*Qa,og=["~/atlas","~/harbour-cli","~/ledger","~/studio-site"],ug=[{id:"macbook",name:"MACBOOK",kind:"laptop",firstSeenAt:0},{id:"mini",name:"MINI-PC",kind:"desktop",firstSeenAt:0}];function cg(n,i){return{[$e.tokensInput]:Math.round(400+i()*3e3*n),[$e.tokensOutput]:Math.round(60+i()*500*n),[$e.tokensCacheRead]:Math.round(1200+i()*9e3*n),[$e.tokensReasoning]:Math.round(20+i()*300*n)}}function E1(n={}){const i=n.seed??57,s=n.dayStart??Date.parse("2026-08-29T07:00:00Z"),r=n.duration??15*w1,o=n.runCount??24,c=n.failureRate??.09,d=n.waitRate??.2,h=s+r,m=S1(i),g=[];for(const B of ug)g.push(Lt(s,"began",{type:"machine",id:B.id},{machineName:B.name,machineKind:B.kind}));const x=Math.max(1,Math.round(o/4));let b=0,R=0;for(let B=0;B<x;B++){const O=s+B/x*r+m()*20*Qa,L=2+Math.floor(m()*4);for(let _=0;_<L;_++){const H=ug[m()<.66?0:1],Z=og[Math.floor(m()*og.length)],K=`syn-session-${b++}`,F=O+_*(2+m()*9)*Qa;if(F>h)continue;const Y=m()<.7?"deepseek-v4-flash":"deepseek-v4";g.push({...Lt(F,"began",{type:"session",id:K},{machineId:H.id,executor:Hl,model:Y}),attrs:{context:Z}});const A=`syn-proc-${R++}`,k=Z.split("/").pop().toUpperCase();g.push(Lt(F,"began",{type:"execution",id:A},{machineId:H.id,sessionId:K,label:k,executor:Hl,model:Y,depth:0}));const w=m()<.35,$=(w?25+m()*95:2+m()*14)*Qa,te=Math.max(1,Math.ceil($/(xf*.6))),se=w?4:1;let oe=F;const he=$/te;for(let ce=0;ce<te&&(oe+=he,!(oe>h));ce++)g.push(Lt(oe,"progressed",{type:"execution",id:A},{measures:{...cg(se,m),[$e.interactions]:Math.floor(m()*4),[$e.errors]:m()<.06?1:0,[$e.steps]:1}}));if(m()<d){const ce=F+$*(.35+m()*.3),U=ce+(1+m()*18)*Qa;ce<h&&(g.push(Lt(ce,"blocked",{type:"execution",id:A},{blockedOn:"approval"})),U<h&&g.push(Lt(U,"resumed",{type:"execution",id:A})))}if(w&&m()<.5){const ce=`syn-proc-${R++}`,U=F+$*.25,P=U+$*.4;U<h&&g.push(Lt(U,"began",{type:"execution",id:ce},{machineId:H.id,sessionId:K,label:`${k} · SUB`,executor:Hl,model:Y,parentId:A,depth:1}),Lt((U+P)/2,"progressed",{type:"execution",id:ce},{measures:{...cg(1,m),[$e.interactions]:3,[$e.steps]:4}}),Lt(Math.min(h,P),"ended",{type:"execution",id:ce},{outcome:"completed"}))}const me=Math.min(h,F+$);if(m()<c?g.push(Lt(me,"ended",{type:"execution",id:A},{outcome:"error",failureCode:"TRANSPORT",failureMessage:"Provider request failed"})):g.push(Lt(me,"ended",{type:"execution",id:A},{outcome:"completed"})),g.push(Lt(me,"ended",{type:"session",id:K})),H.id==="mini"&&m()<.3){const ce=me+3e4,U=ce+(1+m()*4)*Qa;if(U<h){const P=`syn-xfer-${R}`;g.push({...Lt(ce,"began",{type:"artifact",id:P},{label:"ARTIFACT SYNC",machineId:"mini"}),attrs:{"syn.transfer":!0,"syn.from":"mini","syn.to":"macbook","syn.bytes":Math.round(2e8+m()*3e9)}},{...Lt(U,"ended",{type:"artifact",id:P}),attrs:{"syn.transfer":!0}})}}}}return g.sort((B,O)=>B.occurredAt-O.occurredAt),{events:g,dayStart:s,dayEnd:h}}class T1{constructor(i={},s=180){this.timeScale=s;const r=E1(i);this.script=r.events,this.dayStart=r.dayStart,this.dayEnd=r.dayEnd,this.simNow=r.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 r=this.dayStart+(Date.now()-s)*this.timeScale;this.advanceTo(r),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 fg(n){const i=Fl(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),V0(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 A1(){const n=await fetch("/api/state");if(!n.ok)throw new Error(`state failed: ${n.status}`);return n.json()}async function tf(n,i){try{const s=await fetch(`/api/collect?from=${n}&to=${i}`),r=await s.json().catch(()=>({}));return{ok:s.ok,fault:r.fault,error:r.error}}catch(s){return{ok:!1,error:s instanceof Error?s.message:String(s)}}}async function nf(n,i,s=!1){const r=await fetch(`/api/world?from=${n}&to=${i}${s?"&window=live":""}`);if(!r.ok)throw new Error(`world failed: ${r.status}`);return r.json()}async function M1(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 R1=4e3,D1=3;class C1{constructor(i,s,r={}){this.initial=i,this.state=s,this.options=r,this.lastCollect=i.to}initial;state;options;timer=null;stopped=!1;lastCollect;generation=0;failures=0;trouble=null;get pollMs(){return this.options.pollMs??R1}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(fg(this.initial.world),this.initial.waits)});const s=async()=>{if(this.stopped)return;this.running=!0;const r=++this.generation;try{const o=Date.now(),c=await tf(this.lastCollect,o);c.fault&&this.report({kind:"store-fault",message:c.fault.message,detail:c.fault.remedy,consecutiveFailures:0});const d=await nf(this.initial.from,o,!0);if(this.stopped||r!==this.generation)return;this.lastCollect=o,this.failures=0,c.fault||this.report(null),i(fg(d.world),d.waits)}catch(o){this.failures++,this.failures>=D1&&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 Sf=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 fn extends Sf{constructor(i){super({...i,severity:"error"}),this.name="ValidationError"}}function O1(n){return new Sf({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 z1(n,i){if(!n)return;const s=(i??[]).filter(r=>!n.has(r));if(s.length)throw O1(s)}const _1={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 mr(n){const i=globalThis.GPUBufferUsage;return n.reduce((s,r)=>s|U1(r,i),0)}function U1(n,i){const s=n.toUpperCase();return i?.[s]??_1[n]}function dg(){return globalThis.GPUMapMode?.READ??1}const N1={copy_src:1,copy_dst:2,texture_binding:4,storage_binding:8,render_attachment:16};function k1(n){const i=globalThis.GPUTextureUsage;return n.reduce((s,r)=>s|L1(r,i),0)}function L1(n,i){const s=n.toUpperCase();return i?.[s]??N1[n]}function Q0(n){return"__vgpuMockBytes"in n}function hg(n){return"__vgpuMockBytes"in n}let j1=1;function lo(n){return Object.freeze({kind:n,id:j1++})}class oo{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 r of s)r(i);return!0}}class Di{device;gpu;options;ownership;destroySignal=new oo;identity=lo("buffer");destroyed=!1;constructor(i,s,r,o="owned"){this.device=i,this.gpu=s,this.options=r,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 fn({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(r){throw this.ownership!=="external"?r:Nl("Buffer.write","The external GPUBuffer rejected the write operation.",r)}}async read(i,s=0){this.#e("Buffer.read"),this.ownership==="external"&&this.validateExternalOperation("read",s,i,"copy_src");try{const r=await this.device.readback.read(this.gpu,i,s);return this.#e("Buffer.read"),r}catch(r){throw r instanceof fn||this.ownership!=="external"?r:Nl("Buffer.read","The external GPUBuffer rejected the read operation.",r)}}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,r,o){if(!(Number.isSafeInteger(s)&&s>=0&&s%4===0&&Number.isSafeInteger(r)&&r>=0&&r%4===0&&s<=this.options.size&&r<=this.options.size-s))throw Nl(`Buffer.${i}`,"External buffer offsets and lengths must be non-negative, 4-byte aligned, and within the buffer size.");if((this.gpu.usage&mr([o]))===0)throw Nl(`Buffer.${i}`,`External buffer is missing ${o.toUpperCase()} usage.`)}}function Nl(n,i,s){return new fn({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 B1(n){if(I1(n))throw V1();const i={version:1,mappings:[]},s={version:1,modules:[{path:"<runtime>",text:n}],diagnostics:[],sourceMap:i,cacheKey:G1(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 G1(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 r of n.matchAll(s))i.push(r[2]);return i}function I1(n){const i=n.replace(/\/\*[\s\S]*?\*\//g,"").replace(/\/\/.*$/gm,"").trimStart();return i.startsWith("import ")||i.startsWith("import{")}function V1(){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 pg=mr(["copy_dst","map_read"]);class F1{device;constructor(i){this.device=i}async read(i,s,r){if(Q0(i))return i.__vgpuMockBytes.slice(r,r+s).buffer;const o=this.device.createBuffer({size:s,usage:pg});try{const c=this.device.createCommandEncoder();c.copyBufferToBuffer(i,r,o,0,s),this.device.queue.submit([c.finish()]),await o.mapAsync(dg());const d=o.getMappedRange().slice(0);return mg(o),d}finally{gg(o)}}async readTexture(i,s,r){const[o,c]=s,d=Jl(r,"Readback.readTexture"),h=d.bytesPerPixel,m=H1(o*h,256),g=m*c,x=this.device.createBuffer({size:g,usage:pg});let b;try{const R=this.device.createCommandEncoder();R.copyTextureToBuffer({texture:i},{buffer:x,bytesPerRow:m,rowsPerImage:c},{width:o,height:c}),this.device.queue.submit([R.finish()]),await x.mapAsync(dg());const B=new Uint8Array(x.getMappedRange());b=new Uint8Array(o*c*h);for(let O=0;O<c;O++){const L=O*m,_=O*o*h;b.set(B.subarray(L,L+o*h),_)}mg(x)}finally{gg(x)}return d.swizzle==="bgra-to-rgba"&&Z0(b),b}destroy(){}}function mg(n){try{n.unmap()}catch{}}function gg(n){try{n.destroy()}catch{}}function H1(n,i){return Math.ceil(n/i)*i}const yg={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 Jl(n,i){const s=yg[n];if(s)return s;throw new fn({code:"VGPU-CORE-UNSUPPORTED-FORMAT",message:`Texture.read does not support format ${n}. Supported formats: ${Object.keys(yg).join(", ")}.`,where:i})}function q1(n,i,s="Texture.readFloats"){const r=Jl(i,s),o=r.bytesPerPixel/r.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++)r.componentType==="unorm8"?d[m]=h.getUint8(m)/255:r.componentType==="float16"?d[m]=Y1(h.getUint16(m*2,!0)):d[m]=h.getFloat32(m*4,!0);return d}function Y1(n){const i=n&32768?-1:1,s=n>>10&31,r=n&1023;return s===0?i*r*2**-24:s===31?r===0?i*Number.POSITIVE_INFINITY:Number.NaN:i*(r+1024)*2**(s-25)}function X1(n,i,s){const r=n.slice(0,i[0]*i[1]*s.bytesPerPixel);return s.swizzle==="bgra-to-rgba"&&Z0(r),r}function Z0(n){for(let i=0;i<n.length;i+=4){const s=n[i];n[i]=n[i+2],n[i+2]=s}}function K1(n){return{size:n,usage:mr(["copy_src","copy_dst"])}}class P1{gpu;guard;constructor(i,s=()=>{}){this.gpu=i,this.guard=s}writeBuffer(i,s,r){this.guard("Queue.writeBuffer"),this.gpu.writeBuffer(i,s,r)}async flush(){this.guard("Queue.flush"),await this.gpu.onSubmittedWorkDone?.(),this.guard("Queue.flush")}}class Q1{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 Z1=Symbol.for("vgpu/Texture"),W1=Symbol.for("vgpu/Texture/resizeLock");class rs{device;ownership;[Z1]=!0;destroySignal=new oo;identity=lo("texture");currentGpu;currentOptions;defaultView=null;resizeLock;destroyed=!1;constructor(i,s,r,o="owned"){this.device=i,this.ownership=o,this.currentGpu=s,this.currentOptions=r,Object.defineProperty(this,W1,{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 fn({code:"VGPU-CORE-EXTERNAL-TEXTURE",message:"Texture wraps an externally owned GPUTexture and cannot be resized.",where:"Texture.resize"});if(this.resizeLock)throw new fn({code:"VGPU-CORE-TEXTURE-RESIZE-LOCKED",message:this.resizeLock,where:"Texture.resize"});const s=this.options.size[2]??1,r=i[2]??s;if(this.options.size[0]===i[0]&&this.options.size[1]===i[1]&&s===r)return!1;const o=i[2]===void 0&&this.options.size[2]===void 0?[i[0],i[1]]:[i[0],i[1],r],c={...this.options,size:o},d=this.gpu;return this.currentGpu=this.device.gpu.createTexture(W0(c)),this.currentOptions=c,this.defaultView=null,d.destroy(),!0}async read(){this.assertAlive("Texture.read");const i=Jl(this.options.format,"Texture.read");if(hg(this.gpu))return X1(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 Jl(this.options.format,"Texture.readFloats"),q1(await this.read(),this.options.format)}destroy(){this.destroyed||(this.destroyed=!0,this.defaultView=null,this.destroySignal.emit(this),this.ownership!=="external"&&(hg(this.gpu)||this.gpu.destroy()))}dispose(){this.destroy()}assertAlive(i="Texture"){if(this.destroyed)throw new fn({code:"VGPU-CORE-TEXTURE-DESTROYED",message:"Texture is destroyed",where:i});this.device.assertUsable?.(i)}}function W0(n){const i={label:n.label,size:{width:n.size[0],height:n.size[1],depthOrArrayLayers:n.size[2]??1},format:n.format,usage:k1(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 J1{gpu;adapterInfo;queue;readback;isCompatibilityMode;scopes=[];ownership;state="alive";lossInfo;observeLoss=!0;constructor(i,s=null,r="owned",o={}){this.gpu=i,this.adapterInfo=s,Object.defineProperty(this,"assertUsable",{value:h=>this.#e(h)}),this.ownership=typeof r=="string"?r:"owned";const c=typeof r=="string"?o:r;this.isCompatibilityMode=c.isCompatibilityMode??!1,this.queue=new P1(i.queue,h=>this.#e(h)),this.readback=new F1(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"?B1(i):i;return new Q1(this.gpu.createShaderModule({code:s.wgsl}),s)}createTexture(i){return this.#e("Device.createTexture"),new rs(this,this.gpu.createTexture(W0(i)),i)}createBuffer(i){this.#e("Device.createBuffer");const s=eS(i);s&&this.captureError(s);const r=s?K1(Math.max(4,i.size||4)):tS(i);return new Di(this,this.gpu.createBuffer(r),i)}wrapBuffer(i){if(this.#e("Device.wrapBuffer"),!iS(i))throw new fn({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:sS(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]??nS(s)??null}#e(i){if(this.state==="alive")return;if(this.state==="disposed")throw new fn({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,r=this.lossInfo?.message;throw new fn({code:"VGPU-DEVICE-LOST",message:`The GPU device was lost${s?` (${s})`:""}${r?`: ${r}`:"."}`,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 eS(n){return!Number.isFinite(n.size)||n.size<=0?vg("Buffer size must be greater than zero."):n.usage.length===0?vg("Buffer usage must not be empty."):null}function vg(n){return new fn({code:"VGPU-CORE-INVALID-USAGE",message:n,where:"Device.createBuffer"})}function tS(n){return{label:n.label,size:n.size,usage:mr(n.usage)}}function nS(n){return n?new fn({code:"VGPU-CORE-VALIDATION",message:n.message,where:"GPUDevice.popErrorScope",cause:n}):null}function iS(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 aS=["map_read","map_write","copy_src","copy_dst","index","vertex","uniform","storage","indirect","query_resolve"];function sS(n){return aS.filter(i=>(n&mr([i]))!==0)}const J0=new WeakMap,rS=new WeakMap;function lS(n,i){return J0.set(n,oS(i)),n}function or(n){return J0.get(n)}function ey(n){return rS.get(n)}function oS(n){return{entries:n.entries.map(i=>({...i}))}}let ie=class extends Sf{};function uS(n,i,s,r,o,c){const d=i==="vertex"?"Vertex":"Fragment",h=i==="vertex"?"VERTEX":"FRAGMENT",m=`maxStorageBuffersIn${d}Stage`;return new ie({code:`VGPU-LIMIT-STORAGE-${h}`,message:`${d} entry '${s}' in '${n}' uses ${r} storage buffer(s), but device limit ${m} is ${o}.`,fix:i==="vertex"?`Request init({ requiredLimits: { ${m}: ${r} } }) if the adapter supports it, or move vertex data to geometry(gpu, ...) vertex streams.`:`Request init({ requiredLimits: { ${m}: ${r} } }) if the adapter supports it, or reduce fragment storage buffers.`,where:`${n}.pipelineLayout`,detail:{stage:i,entryPoint:s,count:r,limit:o,bindings:c.map(({name:g,group:x,binding:b})=>({name:g,group:x,binding:b}))}})}function cS(n,i,s,r,o){return new ie({code:"VGPU-SET-TEXTURE-FILTERABILITY",message:`${r} (${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:r,samplerName:o?.name,samplerGroup:o?.group,samplerBinding:o?.binding}})}function fS(n,i){const s=$S(n,i);return new ie({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 ty(n,i){const s=i==="lib"?"lib-owned by its first JS set()":"user-owned by its first resource set()",r=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 ie({code:"VGPU-R1-OWNERSHIP-FLIP",message:`\`${n}\` is ${s}; ownership cannot change. ${r}`,where:"set"})}function dS(n,i){return new ie({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 hS(n,i,s,r){return new ie({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:r})}function ss(n,i,s){return new ie({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 bg(n,i){return new ie({code:"VGPU-BLEND-INVALID",message:`Invalid blend '${String(i)}' in '${n}'.`,fix:'Use "alpha", "additive", "premultiplied", or { color, alpha? } components.',where:"draw"})}function xg(n,i){return new ie({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 Sg(n,i){return new ie({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 af(n,i,s="draw"){return new ie({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 pS(n,i){return new ie({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 mS(n,i){return new ie({code:"VGPU-FRONTFACE-INVALID",message:`Invalid frontFace '${String(i)}' in '${n}'.`,fix:'Use "ccw" or "cw"; omit it for counter-clockwise.',where:"draw"})}function wg(n,i){return new ie({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 Kn(n,i){return new ie({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 ie({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 ql(n,i,s="draw"){return new ie({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 kl(n,i,s="draw"){return new ie({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 Yl(n,i,s="draw"){return new ie({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 ia(n,i,s){return new ie({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 gS(){return new ie({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 Eg(n,i="expected a number in [0, 1].",s='Use 1 (default), or 0 with depth: { compare: "greater" } for reversed-Z.'){return new ie({code:"VGPU-PASS-CLEARDEPTH-INVALID",message:`clearDepth received ${String(n)}; ${i}`,fix:s,where:"Frame.pass"})}function Pn(n){return new ie({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 Lc(n){return new ie({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 yS(){return new ie({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 Tg(n){return new ie({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 vS(){return new ie({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 sa(n,i,s="Frame.pass"){return new ie({code:"VGPU-PASS-DEPTH-READONLY",message:`depthReadOnly ${n}`,fix:i,where:s})}function bS(){return new ie({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 ie({code:"VGPU-TIMER-INVALID",message:`Invalid timer use: ${n}`,fix:i,where:s})}function xS(n,i){return new ie({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 SS(n,i,s="visibility"){return new ie({code:"VGPU-VIS-INVALID",message:`Invalid visibility use: ${n}`,fix:i,where:s})}function wS(){return new ie({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 ES(){return new ie({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 sf(n="Frame.pass"){return new ie({code:"VGPU-TARGET-REQUIRED",message:"Target required. Fix: pass surface(gpu, canvas) or target(gpu, { size }) as { target }.",where:n})}function TS(n,i,s,r){return new ie({code:n,message:`${n}: ${s}`,fix:r,where:i})}function wf(n,i){return TS("VGPU-MESH-RANGE-INVALID",n,i,"Use index ranges for indexed geometries, vertex ranges otherwise, within geometry counts.")}function AS(n){return new ie({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 ie({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 Ag(n){return new ie({code:"VGPU-COMPILE-DISPOSED",message:"GPU disposed during pipeline compilation.",where:n})}function Ll(n,i){return new ie({code:"VGPU-COMPILE-SIGNATURE-INVALID",message:`Invalid TargetSignature: ${i}`,fix:"Pass { colors, depth?, sampleCount?:1|4 } or a Target.",where:n})}function MS(n){return new ie({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 ny(){return new ie({code:"VGPU-TARGET-SIZE-REQUIRED",message:"Target size required. Fix: target(gpu, { size: [w,h] }); update surface-derived targets in onResize.",where:"target"})}function iy(n){return new ie({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 RS(){return new ie({code:"VGPU-SURFACE-CONTEXT",message:"Canvas WebGPU context failed. Fix: check navigator.gpu and remove any existing 2d/webgl context.",where:"surface"})}function DS(n){return new ie({code:"VGPU-SURFACE-DUPLICATE",message:`Canvas already has surface${n?` '${n}'`:""}. Fix: reuse or dispose it.`,where:"surface"})}function CS(n){return new ie({code:"VGPU-SURFACE-DISPOSED",message:`Surface '${n??"surface"}' is disposed. Fix: call surface(gpu, canvas).`,where:"surface"})}function OS(){return new ie({code:"VGPU-SURFACE-AUTORESIZE-UNSUPPORTED",message:"autoResize needs clientWidth. Fix: call surface.resize([w,h]) for OffscreenCanvas; onResize still fires.",where:"surface"})}function zS(n){return new ie({code:"VGPU-SURFACE-RESIZE-REENTRANT",message:`Cannot resize this surface${n?` '${n}'`:""} in onResize. Fix: resize derived targets only.`,where:"surface.resize"})}function _S(n){return new ie({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 ay(){return new ie({code:"VGPU-FRAME-REENTRANT",message:"Nested frame(gpu) is invalid. Fix: queue work for the next frame.",where:"frame"})}function US(n,i){return new ie({code:"VGPU-QUERY-READBACK",message:`${n} dropped a query readback: ${jS(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 Mg(n){return new ie({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 NS(n){return new ie({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 kS(n){return new ie({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 Wn(n,i,s){return new ie({code:"VGPU-R1-BINDING-INCOMPATIBLE-RESOURCE",message:`binding \`${n.name}\` @group(${n.group}) @binding(${n.binding}) needs ${i}.`,fix:s,where:"set"})}function Rt(n,i,s){return new ie({code:"VGPU-RING1-UNSUPPORTED",message:i,fix:s,where:n})}function jl(n){return BS(n)&&n.version!==1?new ie({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 ie({code:"VGPU-SHADER-SOURCE-INVALID",message:`VGPU-SHADER-SOURCE-INVALID: expected WGSL or { version, wgsl }, got ${GS(n)}. Fix: configure @vgpu/wgsl loader-vite or loader-webpack.`,where:"shader source"})}function LS(n){return new ie({code:"VGPU-R1-STORAGE-ALIASING",message:"`src` and writable `dst` alias. Fix: alternate them with pingPongStorage(gpu).",where:n})}function jS(n){return n instanceof Error?`${n.name}: ${n.message}`:String(n)}function BS(n){return typeof n=="object"&&n!==null&&"version"in n}function GS(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 $S(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 Rg=["scheduler","resource","service"];function uo(n){return{name:n}}const sy=new WeakMap;function IS(n){const i=sy.get(n);if(!i)throw new ie({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 VS{device;#e=new Map;#t=new Map(Rg.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 r=this.#e.get(i);if(r!==void 0)return r;const o=s(this);return this.#e.set(i,o),o}peekService(i){return this.#e.get(i)}own(i,s){const r=this.#t.get(i);return r.add(s),()=>{r.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 r=[...this.#n];if(!r.length){console.error(i);return}for(const o of r)try{o(i)}catch(c){console.error(c)}});return this.trackDelivery(s)}trackDelivery(i){const s=Promise.resolve(i).then(()=>{},r=>{console.error(r)});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 Rg){const s=this.#t.get(i);for(const r of[...s])r();s.clear()}this.#e.clear(),this.#a.clear(),this.#n.clear(),this.device.dispose()}}}function FS(n){const i=new VS(n),s={device:n,gpu:n.gpu,get disposed(){return i.disposed},onError:r=>i.addErrorListener(r),settled:()=>i.settled(),dispose:()=>{i.dispose()}};return sy.set(s,i),s}async function HS(n,i={},s){return FS(await qS(n,i,s))}async function qS(n,i,s){return i.adapter||s?(i.adapter??s()).requestDevice(i):YS(i)}async function YS(n){const s=await globalThis.navigator.gpu?.requestAdapter({powerPreference:n.powerPreference});if(!s)throw Rt("init","navigator.gpu.requestAdapter() returned null.");z1(s.features,n.requiredFeatures);const r=await s.requestDevice({requiredFeatures:n.requiredFeatures,requiredLimits:n.requiredLimits});return new J1(r,s.info??null)}function at(n,i){n.assertUsable(i)}function Dg(n,i){n.assertUsable(i)}const ry=Symbol("vgpu.bindingResource");function XS(n){return typeof(typeof n=="object"&&n!==null?n[ry]:void 0)=="function"?n:void 0}const rf=Symbol("vgpu.geometry.layoutResolver");function Mn(n,i){const s=IS(n);if(s.disposed)throw KS(i);return s}function KS(n){return new ie({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 PS(n,i){let s=()=>{};const r=i({trackSettled:o=>{n.trackDelivery(o)},errorSink:o=>n.reportError(o),onDispose:()=>{s()}});return s=n.own("resource",()=>r.dispose()),r}function ly(n,i,s,r){const o=n.own("resource",()=>s(i));return r?.(o),i}class oy extends Error{code;line;column;severity;metadata;relatedDiagnostics;fix;where;cause;constructor(i,s,r=1,o=1,c="error"){super(s),this.name="VGPUError",this.code=i,this.line=r,this.column=o,this.severity=c}}function QS(n,i,s={}){const r=new oy(n,i,s.line??1,s.column??1,s.severity??"error");return s.fix!==void 0&&(r.fix=s.fix),s.where!==void 0&&(r.where=s.where),s.cause!==void 0&&(r.cause=s.cause),s.metadata!==void 0&&(r.metadata=s.metadata),r}function et(n,i,s=1,r=1){return new oy(n,i,s,r)}const ZS=new Set(["fn","struct","const","alias","var","override"]);function WS(n){const i=[],s=[],r=[];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(uy(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]=JS(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",g=m?ew(n,h.text==="export"?o+1:o+3):o,x=n[g];if(x&&ZS.has(x.text)){const b=tw(n,g);s.push({name:b,localName:b,kind:x.text}),m&&r.push({name:b,localName:b,kind:x.text}),c=!0}o++}return{imports:i,exports:r,locals:s}}function JS(n,i){let s=i+1;const r=[];if(n[s]?.text==="{"){for(s++;n[s]&&n[s].text!=="}";){if(uy(n[s])){s++;continue}const d=Bc(n[s]);let h=d;s++,n[s]?.text==="as"&&(h=Bc(n[s+1]),s+=2),r.push({imported:d,local:h}),n[s]?.text===","&&s++}s++,jc(n[s],"from"),s++}else if(n[s]?.text==="*")jc(n[s+1],"as"),r.push({imported:"*",local:Bc(n[s+2]),namespace:!0}),s+=3,jc(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:r,start:n[i].start,end:n[s-1].end},s]}function ew(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 tw(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 jc(n,i){if(n?.text!==i)throw et("VGPU-WGSL-IMP-DEFAULT",`Expected ${i}`,n?.line,n?.column)}function Bc(n){if(n?.kind!=="ident")throw et("VGPU-WGSL-IMP-DEFAULT","Expected identifier",n?.line,n?.column);return n.text}function uy(n){return n.kind==="lineComment"||n.kind==="blockComment"}function nw(n,i){return i==="uniform"||i==="storage"?"buffer":n.kind==="sampler"?"sampler":n.kind==="texture"?n.textureKind==="texture_external"?"externalTexture":"texture":"unknown"}function iw(n,i,s,r,o){if(n==="buffer")return aw(i,s,o);if(r.kind==="sampler")return sw(r);if(r.kind==="texture")return r.textureKind==="texture_external"?{kind:"externalTexture",externalTexture:{}}:r.textureKind.startsWith("texture_storage_")?rw(r):lw(r)}function aw(n,i,s){return{kind:"buffer",buffer:{type:n==="uniform"?"uniform":i==="read"?"read-only-storage":"storage",hasDynamicOffset:!1,minBindingSize:s?.size}}}function sw(n){return{kind:"sampler",sampler:{type:n.comparison?"comparison":"filtering"}}}function rw(n){return{kind:"storageTexture",storageTexture:{access:uw(n.access),format:n.texelFormat??"rgba8unorm",viewDimension:cy(n.dimension)}}}function lw(n){return{kind:"texture",texture:{sampleType:ow(n),viewDimension:cy(n.dimension),multisampled:n.dimension==="multisampled_2d"||n.dimension==="depth_multisampled_2d"}}}function ow(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 cy(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 uw(n){return n==="read"?"read-only":n==="read_write"?"read-write":"write-only"}const on=(1n<<64n)-1n,aa=11400714785074694791n,rr=14029467366897019727n,Cg=1609587929392839161n,fy=9650029242287828579n,Og=2870177450012600261n;function cw(n,i=0n){const s=new TextEncoder().encode(n);let r=0,o;if(s.length>=32){let c=i+aa+rr,d=i+rr,h=i,m=i-aa;const g=s.length-32;do c=Wa(c,sr(s,r)),r+=8,d=Wa(d,sr(s,r)),r+=8,h=Wa(h,sr(s,r)),r+=8,m=Wa(m,sr(s,r)),r+=8;while(r<=g);o=Mi(c,1n)+Mi(d,7n)+Mi(h,12n)+Mi(m,18n),o=Bl(o,c),o=Bl(o,d),o=Bl(o,h),o=Bl(o,m)}else o=i+Og;for(o=o+BigInt(s.length)&on;r+8<=s.length;)o^=Wa(0n,sr(s,r)),o=Mi(o,27n)*aa+fy&on,r+=8;for(r+4<=s.length&&(o^=fw(s,r)*aa&on,o=Mi(o,23n)*rr+Cg&on,r+=4);r<s.length;)o^=BigInt(s[r])*Og&on,o=Mi(o,11n)*aa&on,r++;return o^=o>>33n,o=o*rr&on,o^=o>>29n,o=o*Cg&on,o^=o>>32n,o.toString(16).padStart(16,"0")}function Wa(n,i){return Mi(n+i*rr&on,31n)*aa&on}function Bl(n,i){return n^=Wa(0n,i),n*aa+fy&on}function Mi(n,i){return(n<<i|n>>64n-i)&on}function sr(n,i){let s=0n;for(let r=7;r>=0;r--)s=(s<<8n)+BigInt(n[i+r]);return s}function fw(n,i){return BigInt(n[i])|BigInt(n[i+1])<<8n|BigInt(n[i+2])<<16n|BigInt(n[i+3])<<24n}function dw(n){return cw(n)}function hw(n){return dw(n).slice(0,8)}function pw(n,i){return`_vgsl_${hw(n)}__${i}`}function Pt(n,i){const s=n.find(c=>c.name===i);if(!s)return;const r=s.args.map(c=>c.text).join(""),o=Number(r.replace(/[ui]$/,""));return Number.isFinite(o)?o:void 0}function Ef(n){const i=[[]];let s=0,r=0;for(const o of n){if(o.text==="<"?s++:o.text===">"?s=Math.max(0,s-1):o.text==="("?r++:o.text===")"&&(r=Math.max(0,r-1)),o.text===","&&s===0&&r===0){i.push([]);continue}i[i.length-1].push(o)}return i.map(dy).filter(o=>o.length>0)}function dy(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 mw(n){if(n!==void 0&&hy(n))return Number(n.replace(/[ui]$/,""))}function hy(n){return/^(0|[1-9][0-9]*)([ui])?$/.test(n)}function py(n){if(n==="read"||n==="write"||n==="read_write")return n}function gw(n){return["f32","f16","i32","u32","bool"].find(i=>i===n)}function yw(n){return{kind:"scalar",name:n==="f"?"f32":n==="h"?"f16":n==="i"?"i32":"u32"}}function my(n){return n==="f16"?2:4}function ua(n,i){return Math.ceil(i/n)*n}function Tn(n){const i=dy(n);if(i.length===0)throw et("VGPU-WGSL-REFLECT-TYPE","Expected WGSL type");const s=i.map(c=>c.text).join(""),r=vw(s);if(r)return r;if(i[1]?.text==="<"){const c=i[0].text,d=Ef(i.slice(2,-1)),h=bw(c,d);if(h)return h}const o=xw(s);return o||Sw(s)}function vw(n){const i=gw(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:yw(s[2])};const r=n.match(/^mat([234])x([234])([fh])$/);if(r){const o=r[3]==="h"?{kind:"scalar",name:"f16"}:{kind:"scalar",name:"f32"};return{kind:"matrix",columns:Number(r[1]),rows:Number(r[2]),element:o}}}function bw(n,i){if(n==="array"){const s=i[1]?.map(o=>o.text).join(""),r=s===void 0?void 0:mw(s);return{kind:"array",element:Tn(i[0]??[]),count:r,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:py(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 xw(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 Sw(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 ca(n,i,s){for(let r=i;r<n.length;r++)if(n[r].text===s)return r;throw et("VGPU-WGSL-REFLECT-PARSE",`Expected ${s}`,n[i]?.line,n[i]?.column)}function ww(n,i,s,r){for(let o=i;o<s;o++)if(n[o].text===r)return o}function co(n,i,s){let r=0;for(let o=i;o<n.length;o++)if((n[o].text==="{"||n[o].text==="(")&&r++,(n[o].text==="}"||n[o].text===")")&&(r=Math.max(0,r-1)),r===0&&n[o].text===s)return o;return n.length}function Tf(n,i){const s=n[i].text,r=s==="("?")":s==="{"?"}":">";let o=0;for(let c=i;c<n.length;c++)if(n[c].text===s&&o++,n[c].text===r&&(o--,o===0))return c;throw et("VGPU-WGSL-REFLECT-PARSE",`Unclosed ${s}`,n[i]?.line,n[i]?.column)}function Af(n,i){const s=[];let r=i;for(;n[r]?.text==="@";){const o=n[r],c=Oi(n[r+1]);r+=2;let d=[];if(n[r]?.text==="("){const h=Tf(n,r);d=n.slice(r+1,h),r=h+1}s.push({name:c,args:d,token:o})}return[s,r]}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 Ew(n){const i=n.find(r=>r.name==="workgroup_size");if(!i)return;const s=Ef(i.args).map(r=>Number(r.map(o=>o.text).join("")));return[s[0]??1,s[1]??1,s[2]??1]}function Tw(n,i){if(n[i]?.text!=="<")return{after:i};const s=ca(n,i,">"),r=Ef(n.slice(i+1,s)).map(o=>o.map(c=>c.text).join(""));return{addressSpace:r[0],access:py(r[1]),after:s+1}}function Aw(n){const i=[],s=[],r=[],o=[],c=[],d=[],h=n.tokens.filter(x=>x.kind!=="lineComment"&&x.kind!=="blockComment");let m=0,g=0;for(;m<h.length;){const x=h[m];if(x.text==="{"){g++,m++;continue}if(x.text==="}"){g=Math.max(0,g-1),m++;continue}if(g>0){m++;continue}const b=m,[R,B]=Af(h,m);m=B,h[m]?.text==="export"&&m++;const O=h[m]?.text;if(O==="enable"){h[m+1]?.kind==="ident"&&d.push(h[m+1].text),m=co(h,m,";")+1;continue}if(O==="struct"){const L=Mw(n,h,m);L.item&&i.push(L.item),m=L.next;continue}if(O==="alias"){const L=Rw(n,h,m);L.item&&s.push(L.item),m=L.next;continue}if(O==="var"){const L=Dw(n,h,m,R);L.item&&r.push(L.item),m=L.next;continue}if(O==="fn"){const L=Cw(n,h,m,R);L.item&&o.push(L.item),m=L.next;continue}if(O==="override"){const L=zw(h,m,R);L.item&&c.push(L.item),m=L.next;continue}m=Math.max(b+1,m+1)}return{structs:i,aliases:s,vars:r,entries:o,overrides:c,features:d}}function Mw(n,i,s,r){const o=Oi(i[s+1]),c=ca(i,s+2,"{"),d=Tf(i,c);return{item:{name:o,originalName:o,mangledName:Mf(n,o,"struct"),members:_w(i.slice(c+1,d)),path:n.path},next:d+1}}function Rw(n,i,s,r){const o=Oi(i[s+1]),c=ca(i,s+2,"="),d=co(i,c+1,";");return{item:{name:o,originalName:o,mangledName:Mf(n,o,"alias"),target:Tn(i.slice(c+1,d)),path:n.path},next:d+1}}function Dw(n,i,s,r){const{addressSpace:o,access:c,after:d}=Tw(i,s+1),h=Oi(i[d]),m=ca(i,d+1,":"),g=co(i,m+1,";");return{item:{path:n.path,name:h,mangledName:Uw(r)?h:Mf(n,h,"var"),attrs:r,addressSpace:o,access:c,type:Tn(i.slice(m+1,g))},next:g+1}}function Cw(n,i,s,r){const o=Oi(i[s+1]),c=r.find(m=>m.name==="vertex"||m.name==="fragment"||m.name==="compute")?.name;if(!c)return{item:void 0,next:s+1};const d=ca(i,s+2,"("),h=Tf(i,d);return{item:{name:o,mangledName:o,stage:c,workgroupSize:Ew(r),path:n.path,params:Ow(i.slice(d+1,h))},next:h+1}}function Ow(n){const i=[];let s=0;for(;s<n.length;){const[r,o]=Af(n,s);if(s=o,!n[s]||n[s].text===","){s++;continue}const c=Oi(n[s]),d=ca(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:r,type:Tn(n.slice(d+1,h))}),s=h+1}return i}function zw(n,i,s){const r=Oi(n[i+1]),o=co(n,i+1,";"),c=ww(n,i+2,o,"=");return{item:{name:r,mangledName:r,id:Pt(s,"id"),defaultValue:c===void 0?void 0:n.slice(c+1,o).map(d=>d.text).join("")},next:o+1}}function _w(n){const i=[];let s=0;for(;s<n.length;){const[r,o]=Af(n,s);if(s=o,!n[s]||n[s].text===","||n[s].text===";"){s++;continue}const c=Oi(n[s]),d=ca(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:r,type:Tn(n.slice(d+1,h)),align:Pt(r,"align"),size:Pt(r,"size")}),s=h+1}return i}function Mf(n,i,s){return s==="override"?i:pw(n.path,i)}function Uw(n){return Pt(n,"group")!==void 0||Pt(n,"binding")!==void 0}const Nw="literal length required for auto layout; use draw.group(n, bg) manual binding",kw="VGPUError: `bool` is not host-shareable in uniform/storage. Fix: use `u32` (0 | 1) → struct Params { enabled: u32 }",gy="use a manual group claim (`draw.group(n, bg)`)";function Lw(n=1,i=1){return et("VGPU-WGSL-REFLECT-ARRAY-LENGTH",Nw,n,i)}function yy(n=1,i=1){return et("VGPU-WGSL-REFLECT-BOOL-HOST-SHAREABLE",kw,n,i)}function eo(n,i,s=1,r=1){return et("VGPU-WGSL-REFLECT-UNKNOWN-TYPE",`type '${n}' is unknown in ${i}; ${gy}`,s,r)}function zg(n,i,s=1,r=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,r)}function vy(n,i=1,s=1){return et("VGPU-WGSL-REFLECT-NON-HOST-SHAREABLE",`Type ${n} is not host-shareable; ${gy}`,i,s)}const ls="naga-standard";function jw(n,i,s){const r=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"});r.set(d.structs[0]?.path??d.aliases[0]?.path??d.vars[0]?.path??"",h)}const o=new Map(n.map(d=>[d.path,r.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)Bw(d,m,h,n,o);c.set(d.path,h)}return c}function Bw(n,i,s,r,o,c){const d=$w(i,n.path,r),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 g=h?.get(m.imported);g&&s.set(m.local,g)}}function Gw(n,i){const s=new Map,r=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:oa(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:oa(d.target,d.path,i)};r.set(d.mangledName,h),o.set(d.mangledName,h)}}return{structs:s,aliases:r,byMangled:o}}function oa(n,i,s,r){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 zg(n.name)}const c=s.get(i)?.get(n.name);if(c?.kind==="namespace")throw zg(n.name);if(!c)throw eo(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:oa(n.element,i,s)};case"texture":return{...n,sampleType:n.sampleType?oa(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 lf(n,i){const s=os(n,i);switch(s.kind){case"array":case"atomic":case"vector":case"matrix":case"ptr":return{...s,element:lf(s.element,i)};case"texture":return{...s,sampleType:s.sampleType?lf(s.sampleType,i):void 0};default:return s}}function $w(n,i,s,r){const o=void 0;if(o!==void 0&&s.some(g=>g.path===o))return o;const c=n.from,d=i.slice(0,i.lastIndexOf("/")+1),h=c.startsWith("/")?c:Iw(`${d}${c}`);return[c,h].find(g=>s.some(x=>x.path===g))??o??h}function Iw(n){const i=n.startsWith("/"),s=[];for(const r of n.split("/"))!r||r==="."||(r===".."?s.pop():s.push(r));return`${i?"/":""}${s.join("/")}`}function gr(n,i,s=as(n),r=s,o){const c=o?lf(n,o):n;return Vw(c,i,s,r,o)}function Vw(n,i,s,r,o){switch(n.kind){case"scalar":return Fw(n,i,s,r);case"atomic":return Hw(n,i,s,r);case"vector":return qw(n,i,s,r,o);case"matrix":return Yw(n,i,s,r,o);case"array":return Xw(n,i,s,r,o);case"identifier":return Pw(n,i,s,r,o);default:throw vy(as(n))}}function Fw(n,i,s,r){const o=my(n.name);if(n.name==="bool")throw yy();return{name:s,mangledName:r,addressSpace:i,layoutMode:ls,type:n,align:o,size:o}}function Hw(n,i,s,r){return{name:s,mangledName:r,addressSpace:i,layoutMode:ls,type:n,align:4,size:4}}function qw(n,i,s,r,o){const d=gr(n.element,i,s,r,o).size??4,h=n.width===2?d*2:d*4;return{name:s,mangledName:r,addressSpace:i,layoutMode:ls,type:n,align:h,size:d*n.width}}function Yw(n,i,s,r,o){const c={kind:"vector",width:n.rows,element:n.element},d=gr(c,i,`${s}[]`,`${r}[]`,o),h=ua(d.align,d.size??0);return{name:s,mangledName:r,addressSpace:i,layoutMode:ls,type:n,align:d.align,size:h*n.columns,stride:h,element:d}}function Xw(n,i,s,r,o){Kw(n.countExpression);const c=gr(n.element,i,`${s}[]`,`${r}[]`,o),d=ua(fr(n.element,i,o),c.size??0);return{name:s,mangledName:r,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 Kw(n){if(n!==void 0&&!hy(n))throw Lw()}function Pw(n,i,s,r,o){if(!o)throw eo(n.name,"<unknown>");const c=o.structs.get(n.mangledName??n.name);if(!c)throw eo(n.name,"<unknown>");const d=[];let h=0,m=1;for(const x of c.members){const b=Qw(x,i,h,o);d.push(b.member),h=Zw(i,x.type,b.offset,b.member.size??0,o),m=Math.max(m,b.member.align)}const g=Jw(i,m);return{name:s,mangledName:r,addressSpace:i,layoutMode:ls,type:n,align:g,size:ua(g,h),members:d}}function Qw(n,i,s,r){const o=gr(n.type,i,n.name,n.name,r),c=Math.max(fr(n.type,i,r),n.align??1),d=Math.max(o.size??0,n.size??0),h=ua(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 Zw(n,i,s,r,o){return s+(n==="uniform"&&Ww(i,o)?ua(16,r):r)}function Ww(n,i){const s=os(n,i);return s.kind==="identifier"&&i.structs.has(s.mangledName??s.name)}function Jw(n,i){return n==="uniform"?ua(16,i):i}function fr(n,i,s){const r=s?os(n,s):n,o=Xl(r,i,s);return i==="uniform"&&e2(r,s)?ua(16,o):o}function e2(n,i){return n.kind==="array"||n.kind==="identifier"&&!!i?.structs.get(n.mangledName??n.name)}function Xl(n,i,s){const r=s?os(n,s):n;switch(r.kind){case"scalar":return t2(r.name);case"atomic":return 4;case"vector":return r.width===2?Xl(r.element,i,s)*2:Xl(r.element,i,s)*4;case"matrix":return Xl({kind:"vector",width:r.rows,element:r.element},i,s);case"array":return fr(r.element,i,s);case"identifier":return n2(r,i,s);default:throw vy(as(r))}}function t2(n){if(n==="bool")throw yy();return my(n)}function n2(n,i,s){const r=s?.structs.get(n.mangledName??n.name);if(!r)throw eo(n.name,"<unknown>");return Math.max(1,...r.members.map(o=>Math.max(fr(o.type,i,s),o.align??1)))}const i2=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"]),a2=new Set(["import","export","from","as"]),by=new Set([...i2,...a2]),s2=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"]),r2=new Set(["binding_array"]),l2=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"]),o2=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"]),u2=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"]),c2=new Set(["align","binding","blend_src","builtin","compute","diagnostic","fragment","group","id","interpolate","invariant","location","must_use","size","vertex","workgroup_size"]),f2=new Set(["function","private","storage","uniform","workgroup"]),d2=new Set(["read","read_write","write"]),h2=new Set(["bgra8unorm","r32float","r32sint","r32uint","rg32float","rg32sint","rg32uint","rgba16float","rgba16sint","rgba16uint","rgba32float","rgba32sint","rgba32uint","rgba8sint","rgba8snorm","rgba8uint","rgba8unorm"]);[...by,...s2,...r2,...l2,...o2,...u2,...c2,...f2,...d2,...h2];const p2="VGPU-WGSL-IDENT-NONASCII",m2="https://github.com/vercel-labs/vgpu/issues/294";function g2(n,i){const s=[];let r=0,o=1,c=1;const d=(m,g,x,b,R)=>s.push({kind:m,text:n.slice(g,x),start:g,end:x,line:b,column:R}),h=()=>{n[r]===`
10
+ `?(o++,c=1):c++,r++};for(;r<n.length;){const m=n[r];if(/\s/.test(m)){h();continue}const g=r,x=o,b=c;if(m==="/"&&n[r+1]==="/"){for(;r<n.length&&n[r]!==`
11
+ `;)h();d("lineComment",g,r,x,b);continue}if(m==="/"&&n[r+1]==="*"){let R=0;for(;r<n.length;){if(n[r]==="/"&&n[r+1]==="*"){R++,h(),h();continue}if(n[r]==="*"&&n[r+1]==="/"){if(R--,h(),h(),R===0){d("blockComment",g,r,x,b);break}continue}h()}if(R!==0)throw et("VGPU-WGSL-LEX-UNTERM-COMMENT","Unterminated block comment",x,b);continue}if(m==='"'||m==="'"){const R=m;for(h();r<n.length&&n[r]!==R;){if(n[r]===`
12
+ `)throw et("VGPU-WGSL-LEX-UNTERM-STRING","Unterminated string",x,b);n[r]==="\\"&&h(),h()}if(r>=n.length)throw et("VGPU-WGSL-LEX-UNTERM-STRING","Unterminated string",x,b);h(),d("string",g,r,x,b);continue}if(/[A-Za-z_]/.test(m)){for(;r<n.length&&/[A-Za-z0-9_]/.test(n[r]);)h();const R=n.slice(g,r);d(by.has(R)?"keyword":"ident",g,r,x,b);continue}if(/[0-9]/.test(m)||m==="."&&/[0-9]/.test(n[r+1]??"")){for(m==="."&&h();r<n.length;){const R=n[r];if(/[A-Za-z0-9_.]/.test(R)){h();continue}if((R==="+"||R==="-")&&v2(n[r-1])&&/[0-9]/.test(n[r+1]??"")){h();continue}break}d("number",g,r,x,b);continue}if(m.charCodeAt(0)>127)throw y2(n,r,o,c,i);h(),d("punct",g,r,x,b)}return s}function y2(n,i,s,r,o){let c=i;for(;c>0&&_g(n[c-1]);)c--;let d=i+1;for(;d<n.length&&_g(n[d]);)d++;const h=n.slice(c,d),m=r-(i-c),g=o===void 0?"":` in ${o}`,x=QS(p2,`Non-ASCII identifier '${h}'${g} 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 ${m2}`,line:s,column:m});return x.range={file:o,start:{line:s,column:m}},x}function _g(n){return n.charCodeAt(0)>127||/[A-Za-z0-9_]/.test(n)}function v2(n){return n==="e"||n==="E"||n==="p"||n==="P"}const b2=/^_vgsl_[0-9a-f]{8,16}__[A-Za-z_][A-Za-z0-9_]*$/,x2=new Set(["fn","struct","const","alias","var","override"]);function xy(n){return new S2(n).analyze()}class S2{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 r=this.tokens[s];if(!Qn(r)){if(r.text==="{"){i++;continue}if(r.text==="}"){i--,i<0&&(this.moduleFallback("unmatched top-level closing brace",s),i=0);continue}if(i===0){if(r.text==="@"){s=this.preserveAttribute(s);continue}if(r.text==="enable"||r.text==="requires"||r.text==="diagnostic"||r.text==="const_assert"){s=this.preserveStatement(s,"directive");continue}if(r.text!=="export"){if(r.text==="struct"){s=this.collectStruct(s);continue}if(r.text==="fn"){s=this.collectFunction(s);continue}if(r.text==="const"||r.text==="alias"||r.text==="var"||r.text==="override"){s=this.preserveGlobalDeclaration(s);continue}r.kind==="keyword"&&!x2.has(r.text)&&this.moduleFallback(`unexpected top-level keyword '${r.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 r=this.nextSig(s);if(r===void 0||this.tokens[r]?.text!=="{")return this.moduleFallback("struct without body",i),s;const o=this.findMatching(r,"{","}");if(o===void 0)return this.moduleFallback("unclosed struct body",r),r;for(let c=r;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 r=this.tokens[s].text,o=b2.test(r)&&!this.hasEntryAttributeBefore(i);this.addDeclaration(r,"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 g=this.createScope("function",this.moduleScopeId,this.functions.length,c);return this.functions.push({id:this.functions.length,name:r,nameTokenIndex:s,scopeId:g,bodyStartToken:h,bodyEndToken:m,skipped:!1,fallbackReasons:[]}),this.collectParams(c,d,g,this.functions.length-1),this.scopes[g].endToken=m,m}collectParams(i,s,r,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,r,o,!0);const h=this.nextSig(c);c=this.preserveTypeFrom(h+1,[",",")"],s)}}}}preserveFunctionSignatureTail(i,s){for(let r=i;r<s;r++){const o=this.tokens[r];if(!Qn(o)){if(o.text==="@"){r=this.preserveAttribute(r);continue}o.kind==="ident"&&this.preserveToken(r,"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 r=this.findNextIdent(s);r!==void 0&&(this.preserveToken(r,"global"),this.addDeclaration(this.tokens[r].text,"global",r,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],r=[],o=(h,m)=>{const g=this.createScope(h,s[s.length-1],i.id,m);return s.push(g),g},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 x=this.nextSig(h);x!==void 0&&this.tokens[x]?.kind==="ident"&&this.preserveToken(x,"member");continue}if(m.text==="enable"||m.text==="requires"||m.text==="diagnostic"){h=this.preserveStatement(h,"directive");continue}if(m.text==="for"){const x=o("for-init",h),b=this.nextSig(h);(b===void 0||this.tokens[b]?.text!=="(")&&this.functionFallback(i,"for without parenthesized header",h),r.push({scopeId:x,headerDepth:0,awaitingBody:!1});continue}const g=r[r.length-1];if(g&&g.bodyDepth===void 0&&(m.text==="("&&g.headerDepth++,m.text===")"&&(g.headerDepth--,g.headerDepth<=0&&(g.awaitingBody=!0))),m.text==="{"){d++;const x=w2(r,b=>b.awaitingBody&&b.bodyDepth===void 0);x&&(x.bodyDepth=d),o("block",h);continue}if(m.text==="}"){const x=d;for(c(h),d--;r.length>0&&r[r.length-1].bodyDepth===x;)c(h),r.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 x=this.resolve(m.text,s);x!==void 0?this.references.push({name:m.text,tokenIndex:h,declarationId:x,scopeId:s[s.length-1],functionId:i.id}):this.preserveToken(h,"unknown")}}for(;s.length>2;)c(i.bodyEndToken)}collectLocalDeclaration(i,s,r){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 g=this.findMatching(m,"<",">");if(g===void 0)return this.functionFallback(r,"unparseable var template",m),m;this.preserveRange(m,g,"type"),c=g+1}}const d=this.findNextIdent(c);if(d===void 0||d>=r.bodyEndToken)return this.functionFallback(r,`${o} without identifier`,i),i;this.addDeclaration(this.tokens[d].text,o,d,s,r.id,!0,this.findStatementEnd(i));const h=this.nextSig(d);return h!==void 0&&this.tokens[h]?.text===":"?this.preserveTypeFrom(h+1,["=",";",",",")"],r.bodyEndToken):d}addDeclaration(i,s,r,o,c,d,h){const m=this.declarations.length;return this.declarations.push({id:m,name:i,kind:s,tokenIndex:r,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 r=this.pendingSymbols[s];r.activateAfter>=i||(this.activateSymbol(r.name,r.id,r.scopeId),this.pendingSymbols.splice(s,1))}}activateSymbol(i,s,r){let o=this.symbolsByScope.get(r);o||(o=new Map,this.symbolsByScope.set(r,o)),o.has(i)||o.set(i,s)}resolve(i,s){for(let r=s.length-1;r>=0;r--){const o=this.symbolsByScope.get(s[r])?.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 r=this.nextSig(s);if(r===void 0||this.tokens[r]?.text!=="(")return s;const o=this.findMatching(r,"(",")");return o===void 0?(this.preserveRange(r,r,"attribute"),r):(this.preserveRange(r,o,"attribute"),o)}preserveTypeFrom(i,s,r){let o=0,c=0,d=0,h=i-1;for(let m=i;m<r;m++){const g=this.tokens[m];if(!Qn(g)){if(o===0&&c===0&&d===0&&s.includes(g.text))return Math.max(i-1,m-1);if(g.text==="<")o++;else if(g.text===">")o=Math.max(0,o-1);else if(g.text==="(")c++;else if(g.text===")"){if(c===0&&s.includes(")"))return Math.max(i-1,m-1);c=Math.max(0,c-1)}else g.text==="["?d++:g.text==="]"&&(d=Math.max(0,d-1));g.kind==="ident"&&this.preserveToken(m,"type"),h=m}}return h}preserveStatement(i,s){const r=this.findStatementEnd(i);return this.preserveRange(i,r,s),r}preserveRange(i,s,r){for(let o=i;o<=s;o++)this.tokens[o]&&this.tokens[o].kind!=="lineComment"&&this.tokens[o].kind!=="blockComment"&&this.preserveToken(o,r)}preserveToken(i,s){this.preserved.has(i)||this.preserved.set(i,s)}createScope(i,s,r,o){const c=this.scopes.length;return this.scopes.push({id:c,kind:i,parentId:s,functionId:r,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 r=this.tokens[s];if(!Qn(r)){if(r.kind==="ident")return s;if(r.text!=="@")return}}}findNextText(i,s){for(let r=i;r<this.tokens.length;r++)if(!Qn(this.tokens[r])&&this.tokens[r].text===s)return r}findStatementEnd(i){let s=0;for(let r=i;r<this.tokens.length;r++){const o=this.tokens[r].text;if(o==="(")s++;else if(o===")")s=Math.max(0,s-1);else if(s===0&&(o===";"||o==="{"||o==="}"))return r}return this.tokens.length-1}findMatching(i,s,r){let o=0;for(let c=i;c<this.tokens.length;c++){const d=this.tokens[c].text;if(d===s&&o++,d===r&&(o--,o===0))return c}}hasEntryAttributeBefore(i){for(let s=i-1;s>=0;s--){const r=this.tokens[s];if(!Qn(r)){if(r.text===")"||r.kind==="ident"||r.text==="@"){const o=r.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,r){i.skipped=!0,i.fallbackReasons.push(`${s} at token ${r}`)}}function w2(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 E2=new Set(["textureSample","textureSampleBias","textureSampleLevel","textureSampleGrad","textureGather","textureSampleBaseClampToEdge"]),T2=new Set(["textureSampleCompare","textureSampleCompareLevel","textureGatherCompare"]);function A2(n,i,s){const r=new Map;for(let o=0;o<n.length;o++){const c=n[o],d=i[o],h=xy(c.tokens),m=new Map;for(const x of d.vars){const b=Pt(x.attrs,"group"),R=Pt(x.attrs,"binding"),B=h.declarations.find(O=>O.kind==="global"&&O.name===x.name);b!==void 0&&R!==void 0&&B&&m.set(B.id,{group:b,binding:R})}const g=new Map;for(const x of h.declarations){if(x.kind!=="function")continue;const b=h.functions.find(R=>R.nameTokenIndex===x.tokenIndex);b&&g.set(x.id,b.id)}for(const x of d.entries){const b=h.functions.find(L=>L.name===x.name),R=[];let B=h.fallback.wholeModule||!b;!B&&b&&(B=!Sy(b.id,new Map,new Set,h,m,g,R));const O=b?O2(b.id,h,m,g):s.map(of);r.set(x,B?z2(s,O):_2(R))}}return r}function Sy(n,i,s,r,o,c,d){const h=r.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 g=r.references.filter(b=>b.functionId===n),x=new Map(g.map(b=>[b.tokenIndex,b]));for(let b=h.bodyStartToken+1;b<h.bodyEndToken;b++){const R=r.tokens[b]?.text,B=E2.has(R??"")?"filtering":T2.has(R??"")?"comparison":void 0,O=x.get(b),L=O&&c.get(O.declarationId);if(!B&&L===void 0)continue;const _=C2(r,b);if(_===void 0||r.tokens[_]?.text!=="(")continue;const H=D2(r,_);if(!H)return!1;const Z=H.map(([K,F])=>M2(K,F,r,o,i));if(B){const K=R==="textureGather"&&!R2(H[0],r,o,i)?1:0,F=Z[K],Y=Z[K+1];if(!F||!Y)return!1;d.push({texture:F,sampler:Y,mode:B})}else{const K=r.declarations.filter(Y=>Y.kind==="param"&&Y.functionId===L).sort((Y,A)=>Y.tokenIndex-A.tokenIndex),F=new Map;for(let Y=0;Y<K.length;Y++)Z[Y]&&F.set(K[Y].id,Z[Y]);if(!Sy(L,F,s,r,o,c,d))return!1}}return!0}function M2(n,i,s,r,o){for(const c of s.references){if(c.tokenIndex<n||c.tokenIndex>i)continue;const d=r.get(c.declarationId)??o.get(c.declarationId);if(d)return d}}function R2(n,i,s,r){const o=i.references.find(c=>c.tokenIndex>=n[0]&&c.tokenIndex<=n[1]);return o?.tokenIndex===n[0]?s.get(o.declarationId)??r.get(o.declarationId):void 0}function D2(n,i){const s=[];let r=1,o=0,c=0,d=0,h=i+1;for(let m=i+1;m<n.tokens.length;m++){const g=n.tokens[m].text;if(g==="(")r++;else if(g===")"){if(r--,r===0)return s.push([h,m-1]),s}else g==="["?o++:g==="]"?o--:g==="{"?c++:g==="}"?c--:g==="<"?d++:g===">"?d--:g===","&&r===1&&o===0&&c===0&&d===0&&(s.push([h,m-1]),h=m+1)}}function C2(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 O2(n,i,s,r){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 g=s.get(m.declarationId);g&&d.set(`${g.group}:${g.binding}`,g);const x=r.get(m.declarationId);x!==void 0&&o.push(x)}}}return[...d.values()]}function z2(n,i){const s=new Set(i.map(d=>`${d.group}:${d.binding}`)),r=n.filter(d=>s.has(`${d.group}:${d.binding}`)),o=r.filter(d=>d.bindingLayout?.kind==="texture"&&d.bindingLayout.texture.sampleType==="unfilterable-float"&&!d.bindingLayout.texture.multisampled),c=r.filter(d=>d.bindingLayout?.kind==="sampler"&&d.bindingLayout.sampler.type==="filtering");return o.flatMap(d=>c.map(h=>({texture:of(d),sampler:of(h),mode:"filtering"})))}function of(n){return{group:n.group,binding:n.binding}}function _2(n){const i=new Set;return n.filter(s=>{const r=`${s.texture.group}:${s.texture.binding}:${s.sampler.group}:${s.sampler.binding}:${s.mode}`;return i.has(r)?!1:(i.add(r),!0)})}function U2(n,i){const s=n.map(Aw),r=jw(n,s),o=Gw(s,r),c=[],d=[];for(const g of s)for(const x of g.vars){const b=Pt(x.attrs,"group"),R=Pt(x.attrs,"binding");if(b===void 0||R===void 0)continue;const B=oa(x.type,x.path,r),O=nw(B,x.addressSpace),L=x.addressSpace==="uniform"||x.addressSpace==="storage"?gr(B,x.addressSpace,x.name,x.mangledName,o):void 0;L&&d.push(L),c.push({group:b,binding:R,name:x.name,mangledName:x.mangledName,type:B,kind:O,addressSpace:x.addressSpace,access:x.access,struct:B.kind==="identifier"?o.structs.get(B.mangledName??B.name):void 0,layout:L,bindingLayout:iw(O,x.addressSpace,x.access,B,L)})}c.sort((g,x)=>g.group-x.group||g.binding-x.binding);const h=N2(n,s,c),m=A2(n,s,c);return{bindings:c,entryPoints:s.flatMap(g=>g.entries.map(x=>k2(x,s.flatMap(b=>b.structs),r,o,h.get(x)??c,m.get(x)??[]))),overrides:s.flatMap(g=>g.overrides),featuresRequired:[...new Set(s.flatMap(g=>g.features))],aliases:[...o.aliases.values()],structs:[...o.structs.values()],hostShareableLayouts:d}}function N2(n,i,s){const r=new Map;for(let o=0;o<n.length;o++){const c=n[o],d=i[o],h=xy(c.tokens),m=h.fallback.wholeModule,g=new Map;for(const b of h.declarations){if(b.kind!=="function")continue;const R=h.functions.find(B=>B.nameTokenIndex===b.tokenIndex);R&&g.set(b.id,R.id)}const x=new Map;for(const b of d.vars){const R=Pt(b.attrs,"group"),B=Pt(b.attrs,"binding");if(R===void 0||B===void 0)continue;const O=h.declarations.find(L=>L.kind==="global"&&L.name===b.name);O&&x.set(O.id,{group:R,binding:B})}for(const b of d.entries){const R=h.functions.find(_=>_.name===b.name);if(m||!R){r.set(b,s);continue}const B=[R.id],O=new Set,L=new Map;for(;B.length;){const _=B.pop();if(!O.has(_)&&(O.add(_),!!h.functions[_]))for(const H of h.references){if(H.functionId!==_)continue;const Z=x.get(H.declarationId);Z&&L.set(`${Z.group}:${Z.binding}`,Z);const K=g.get(H.declarationId);K!==void 0&&B.push(K)}}r.set(b,[...L.values()].sort((_,H)=>_.group-H.group||_.binding-H.binding))}}return r}function k2(n,i,s,r,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:L2(n,i,s,r)}:{}}}function L2(n,i,s,r){const o=[];for(const c of n.params){if(Ug(c.attrs,"builtin"))continue;const d=oa(c.type,n.path,s),h=Pt(c.attrs,"location");if(h!==void 0){o.push({name:c.name,location:h,type:d});continue}const m=os(d,r);if(m.kind!=="identifier")continue;const g=i.find(b=>b.mangledName===(m.mangledName??m.name)),x=r.structs.get(m.mangledName??m.name);if(g)for(let b=0;b<g.members.length;b++){const R=g.members[b];if(Ug(R.attrs,"builtin"))continue;const B=Pt(R.attrs,"location");B!==void 0&&o.push({name:R.name,location:B,type:x?.members[b]?.type??oa(R.type,g.path,s)})}}return o}function Ug(n,i){return n.some(s=>s.name===i)}function Rf(n,i="<runtime>"){const s=g2(n,i),r=WS(s);if(r.imports.length>0)throw et("VGPU-WGSL-REFLECT-SOURCE-IMPORT","reflectSource() accepts a single raw WGSL string; use resolveShader() for WGSL import graphs.");return U2([{path:i,source:n,tokens:s,parsed:r}])}function Df(){const n=new Map;return{getOrCreate(i,s,r,o){const c=r.map(to),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=to(i);for(const[r,o]of n)o.identities.includes(s)&&n.delete(r)},clearDraw(i){const s=`${i}:`;for(const r of n.keys())r.startsWith(s)&&n.delete(r)},dispose(){n.clear()}}}function to(n){return typeof n=="string"||typeof n=="number"?String(n):`${n.kind}:${n.id}`}function dr(n,i,s){const r=n[i];if(!r)throw new ie({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 r}const no=new WeakMap;function ur(n,i){if(!n.gpu.pushErrorScope||!n.gpu.popErrorScope)return;n.gpu.pushErrorScope("validation");const s=no.get(n.gpu);s?s.push(i):no.set(n.gpu,[i])}function cn(n){const i=no.get(n.gpu);if(!i?.length||!n.gpu.popErrorScope)return;const s=i.pop();return i.length||no.delete(n.gpu),{context:s,error:n.gpu.popErrorScope()}}function wy(n){const i=[];let s=cn(n);for(;s;)i.push(s),s=cn(n);return i}function j2(n){const i=cn(n);i&&Of(i)}function Ey(n){for(const i of wy(n))Of(i)}function Kt(n){for(const i of n)Of(i)}function Cf(n){return n.gpu.queue.onSubmittedWorkDone?.()??Promise.resolve()}function Ty(n,i=[],s={}){return G2(n,i,s.errorSink??$2)}function io(n,i){return{context:n.context,error:B2(n.error,i.error)}}async function B2(n,i){const s=await Promise.allSettled([n,i]);for(const o of s)if(o.status==="fulfilled"&&o.value)return o.value;const r=s.find(o=>o.status==="rejected");if(r?.status==="rejected")throw r.reason;return null}async function G2(n,i,s){await Cf(n);for(const r of i)try{const o=await r.error;o&&await s(ss(r.context.label,r.context.group,o))}catch(o){await s(ss(r.context.label,r.context.group,o))}}function Of(n){n.error.catch(()=>{})}function $2(n){console.error(n)}function Ay(n,i,s,r){try{i.end()}catch(o){const c=wy(n);Kt(s),Kt(c),s.length=0;const d=c[0]?.context??r;throw d?ss(d.label,d.group,o):o}}let I2=1;const Ng=new WeakMap;function V2(n){return n===null||typeof n!="object"||ArrayBuffer.isView(n)||n instanceof ArrayBuffer||Array.isArray(n)?!0:n instanceof Di||n instanceof rs?!1:!Ry(n)}function uf(n){return typeof n!="object"||n===null||Array.isArray(n)||ArrayBuffer.isView(n)||n instanceof ArrayBuffer||n instanceof Di||n instanceof rs?!1:!Ry(n)}function kg(n,i,s){switch(n.bindingLayout?.kind){case"buffer":return F2(n,i,s);case"texture":return H2(n,i,s);case"sampler":return q2(n,i);case"storageTexture":throw Wn(n,"storage texture","Pass a storage-compatible texture.");case"externalTexture":throw Wn(n,"external texture","Pass a compatible GPUExternalTexture.");default:throw Wn(n,"reflected resource","Fix shader reflection bindingLayout.")}}function F2(n,i,s){const r=XS(i);if(r)return r[ry](n,s.sourceHint);if(i instanceof Di)return Dg(i,`${s.sourceHint}.set`),X2(n,i.options.usage),{resource:{buffer:i.gpu},identity:i.resourceIdentity,unsubscribe:o=>i.onDestroy(o)};if(P2(i))return Dg(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(Cy(i))return{resource:i,identity:hr(i.buffer)};if(zf(i))return{resource:{buffer:i},identity:hr(i)};throw Wn(n,"buffer",`Pass a compatible Buffer/Uniform: ${n.name}.set({ ${n.name}: gpu.device.createBuffer(...) }).`)}function H2(n,i,s){const r=My(i);if(r){const o=r.color;Lg(n,o,s);const c=r.onTexturesRecreated?.bind(r);return{resource:o.createView(),identity:o.resourceIdentity,unsubscribe:d=>r.onDestroy(d),onRecreate:c?d=>c(d):void 0}}if(i instanceof rs)return K2(n,i.usage),Lg(n,i,s),{resource:i.createView(),identity:i.resourceIdentity,unsubscribe:o=>i.onDestroy(o)};if(Dy(i))return{resource:i.createView(),identity:i.resourceIdentity??hr(i)};if(typeof i=="object"&&i!==null)return{resource:i,identity:hr(i)};throw Wn(n,"texture/target",`Pass a Texture or Target: ${n.name}.set({ ${n.name}: scene.color }) or set({ ${n.name}: scene }).`)}function q2(n,i){if(Y2(i))return{resource:i,identity:hr(i)};throw Wn(n,"sampler",`Use the cached sampler: set({ ${n.name}: sampler(gpu) }).`)}function Y2(n){return typeof n!="object"||n===null||n instanceof Di||n instanceof rs?!1:!zf(n)&&!Cy(n)&&!Dy(n)&&!My(n)}function X2(n,i){const s=n.bindingLayout?.kind==="buffer"?n.bindingLayout.buffer.type:void 0;if(s==="uniform"&&!i.includes("uniform"))throw Wn(n,"uniform buffer","Create with usage: ['uniform','copy_dst'].");if((s==="storage"||s==="read-only-storage")&&!i.includes("storage"))throw Wn(n,"storage buffer","Create with usage: ['storage','copy_dst'].")}function K2(n,i){if(!i.includes("texture_binding")&&!i.includes("render_attachment"))throw Wn(n,"sampled texture","Use texture_binding usage or a sampleable Target.")}function Lg(n,i,s){if(!(!s.filterableTexture||s.float32Filterable)&&(i.format==="r32float"||i.format==="rg32float"||i.format==="rgba32float"))throw cS(s.sourceHint,n,i.format,i.label??"texture",s.pairedSampler)}function My(n){if(typeof n!="object"||n===null)return;const i=n;if(!(!i.resourceIdentity||!i.color||typeof i.onDestroy!="function"))return i}function Ry(n){const i=n;return"gpu"in i||"bindGroup"in i||"createView"in i||"resourceIdentity"in i}function hr(n){if(typeof n!="object"||n===null)return`value:${String(n)}`;let i=Ng.get(n);return i||(i={kind:"external",id:I2++},Ng.set(n,i)),i}function P2(n){return typeof n=="object"&&n!==null&&"gpu"in n&&"size"in n&&"buffer"in n&&n.buffer instanceof Di}function Dy(n){return typeof n=="object"&&n!==null&&typeof n.createView=="function"}function Cy(n){return typeof n=="object"&&n!==null&&"buffer"in n&&zf(n.buffer)}function zf(n){return typeof n=="object"&&n!==null&&"size"in n&&"usage"in n&&typeof n.destroy=="function"}function Q2(n,i){Z2(n);const s=new ArrayBuffer(n.size);return _f(new DataView(s),n,0,i),s}function Z2(n){if(n.size===void 0)throw Rt("set",`No se puede inferir byteLength para layout runtime-sized '${n.name}'.`)}function _f(n,i,s,r){if(i.members)return W2(n,i.members,s,r);J2(n,i,s,r)}function W2(n,i,s,r){const o=r;for(const c of i)_f(n,c.layout,s+c.offset,o?.[c.name])}function J2(n,i,s,r){switch(i.type.kind){case"scalar":return Uf(n,s,i.type.name,r);case"vector":return eE(n,s,i.type,r);case"matrix":return tE(n,i,s,r);case"array":return nE(n,i,s,r);default:throw Rt("set",`No hay writer para layout ${i.type.kind}.`)}}function Uf(n,i,s,r){s==="f32"?n.setFloat32(i,Number(r??0),!0):s==="i32"?n.setInt32(i,Number(r??0),!0):s==="u32"||s==="bool"?n.setUint32(i,s==="bool"?r?1:0:Number(r??0),!0):n.setUint16(i,iE(Number(r??0)),!0)}function eE(n,i,s,r){const o=r,c=Oy(s.element);for(let d=0;d<s.width;d++)Uf(n,i+d*c,Nf(s.element),o?.[d]??0)}function tE(n,i,s,r){const o=i.type,c=r,d=Oy(o.element),h=i.stride??16;for(let m=0;m<o.columns;m++)for(let g=0;g<o.rows;g++)Uf(n,s+m*h+g*d,Nf(o.element),c?.[m*o.rows+g]??0)}function nE(n,i,s,r){const o=r,c=i.stride??i.element?.size??0;if(!i.element)throw Rt("set","Array layout sin element layout.");for(let d=0;d<(o?.length??0);d++)_f(n,i.element,s+d*c,o[d])}function Oy(n){return Nf(n)==="f16"?2:4}function Nf(n){if(n.kind!=="scalar")throw Rt("set",`Expected scalar, got ${n.kind}`);return n.name}function iE(n){const i=new Float32Array(1),s=new Uint32Array(i.buffer);i[0]=n;const r=s[0],o=r>>16&32768,c=r&8388607,d=r>>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 jg=new WeakMap;function zy(n,i){const s=new Map,r=new Set;for(const c of i){const d=c.stage==="vertex"?1:c.stage==="fragment"?2:4;for(const h of dr(c,"bindings","visibility")){const m=`${h.group}:${h.binding}`;s.set(m,(s.get(m)??0)|d)}for(const h of dr(c,"samplingPairs","visibility"))h.mode==="filtering"&&r.add(`${h.texture.group}:${h.texture.binding}`)}const o=c=>s.get(`${c.group}:${c.binding}`)??0;return Object.defineProperty(o,"filterable",{value:r}),o}function _y(n,i,s=kf){return n.flatMap(r=>{if(r.group!==i)return[];const o=s(r);return o===0?[]:[{binding:r.binding,visibility:o,...oE(r,s.filterable?.has(`${r.group}:${r.binding}`)??!1)}]})}function Uy(n,i,s,r=kf){const o=new Map,c=s.bindings.filter(h=>r(h)!==0).map(h=>h.group),d=Math.max(-1,...c);for(let h=0;h<=d;h++)o.set(h,sE(n,i,s,h,r));return o}function aE(n,i){return n.gpu.createPipelineLayout({bindGroupLayouts:rE(i)})}function sE(n,i,s,r,o=kf){return Ny(n,`${i}.group${r}.bgl`,_y(s.bindings,r,o))}function Ny(n,i,s){let r=jg.get(n.gpu);r||(r=new Map,jg.set(n.gpu,r));const o=JSON.stringify(s),c=r.get(o);if(c)return c;const d=lS(n.gpu.createBindGroupLayout({label:i,entries:s}),{entries:s});return r.set(o,d),d}function rE(n){const i=Math.max(-1,...n.keys()),s=[];for(let r=0;r<=i;r++)s.push(lE(n,r));return s}function lE(n,i){const s=n.get(i);if(!s)throw Rt("pipelineLayout",`Bind groups must be contiguous for pipeline layout; missing group(${i}).`);return s}function oE(n,i){const s=n.bindingLayout;if(!s)throw Rt("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"}}:uE(s)}function uE(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 kf(n){const i=globalThis.GPUShaderStage,s=i?.VERTEX??1,r=i?.FRAGMENT??2,o=i?.COMPUTE??4;return n.kind==="buffer"?s|r|o:r|o}function ky(n){const i=cE(n.reflection),s=[...n.bindGroupLayouts.keys()].sort((w,$)=>w-$),r=new Map;function o(w){const $=[];for(const[te,se]of Object.entries(w))$.push(...d(te,se));return $}function c(w){const $=n.bindGroupLayouts.get(w.info.group);return!!$&&!!or($)?.entries.some(te=>te.binding===w.info.binding)}function d(w,$){const te=i.get(w);if(te)return h(te,w,$);const se=fE(w,i,n.label);if(!se)throw Rt(`${n.label}.set`,`Binding '${w}' does not exist in '${n.label}'.`);return m(se,w,$)}function h(w,$,te){Y(w.info.group);const se=Bg(w.info,te);Gg(w,$,se);const oe=Kl(w.identity);return se==="lib"?g(w,mE(w.libValue,te)):b(w,te),c(w)?Gc(w,oe):[]}function m(w,$,te){Y(w.info.group);const se=Bg(w.info,te);if(Gg(w,$,se),dE(w,$,se),se!=="lib")throw Rt(`${n.label}.set`,`Member '${$}' needs a JS value; set resource '${w.info.name}' instead.`);const oe=Kl(w.identity);return g(w,{...gE(w.libValue),[$]:te}),c(w)?Gc(w,oe):[]}function g(w,$){const te=k(w);w.libValue=$;const se=Q2(te,$);w.buffer||A(w,te.size),w.bytes=se,w.buffer.write(se,0)}function x(w){const $=or(n.bindGroupLayouts.get(w.group))?.entries.find(oe=>oe.binding===w.binding),te=n.reflection.entryPoints.flatMap(oe=>dr(oe,"samplingPairs",n.label)).find(oe=>oe.mode==="filtering"&&oe.texture.group===w.group&&oe.texture.binding===w.binding),se=te&&n.reflection.bindings.find(oe=>oe.group===te.sampler.group&&oe.binding===te.sampler.binding);return{sourceHint:n.label,filterableTexture:$?.texture?.sampleType==="float",float32Filterable:n.device.features.has("float32-filterable"),pairedSampler:se}}function b(w,$){const te=kg(w.info,$,x(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,$))}function R(w,$){const te=Kl(w.identity);w.identity&&n.cache.evictIdentity(w.identity);const se=kg(w.info,$,x(w.info));if(w.unsubscribe?.(),w.unsubscribeRecreate?.(),w.resource=se.resource,w.identity=se.identity,w.unsubscribe=se.unsubscribe?.(()=>{w.identity&&n.cache.evictIdentity(w.identity)}),w.unsubscribeRecreate=se.onRecreate?.(()=>R(w,$)),c(w))for(const oe of Gc(w,te))n.onIdentityChange?.(oe)}function B(w,$,te){O(w),hE(n.label,w,$,te);const se=r.has(w)?`claimed-group:${w}`:void 0;return r.set(w,$),se}function O(w){const $=n.bindGroupLayouts.get(w);if(!$)throw Rt(`${n.label}.layout`,`@group(${w}) does not exist in '${n.label}'.`);return $}function L(){return s.map(_)}function _(w){const $=r.get(w);if($)return{group:w,bindGroup:$,offsets:[],claimValidation:H($,w)};const te=new Set(or(O(w))?.entries.map(ce=>ce.binding)),se=n.reflection.bindings.filter(ce=>ce.group===w&&te.has(ce.binding)),oe=Z(se),he=K(se),me=n.cache.getOrCreate(n.drawId,w,he,()=>n.device.gpu.createBindGroup({label:`${n.label}.group${w}`,layout:O(w),entries:oe}));return{group:w,bindGroup:me,offsets:[]}}function H(w,$){return ey(w)?void 0:{label:n.label,group:$}}function Z(w){return w.map($=>{const te=F($);return{binding:$.binding,resource:te.resource}})}function K(w){return w.map($=>F($).identity)}function F(w){const $=i.get(w.name);if(!$?.resource||!$.identity)throw fS(n.label,w);return $}function Y(w){if(r.has(w))throw dS(n.label,w)}function A(w,$){w.buffer=n.device.createBuffer({size:$,usage:["uniform","copy_dst"],label:`${n.label}.${w.info.name}`}),w.resource={buffer:w.buffer.gpu,offset:0,size:$},w.identity=w.buffer.resourceIdentity,w.unsubscribe=w.buffer.onDestroy(()=>n.cache.evictIdentity(w.buffer.resourceIdentity))}function k(w){if(w.info.kind!=="buffer"||!w.info.layout?.size)throw Rt(`${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:B,layout:O,bindGroups:L,bindingState(w){const $=i.get(w);if(!(!$?.ownership||!$.resource||!$.identity))return{info:$.info,ownership:$.ownership,resource:$.resource,identity:$.identity}}}}function cE(n){return new Map(n.bindings.map(i=>[i.name,{info:i,memberOwnership:new Map}]))}function fE(n,i,s){let r;for(const o of i.values())if(o.info.layout?.members?.some(c=>c.name===n)){if(r)throw Rt(`${s}.set`,`Binding member '${n}' is ambiguous in '${s}'; set the complete binding.`);r=o}return r}function Bg(n,i){return n.bindingLayout?.kind==="buffer"&&V2(i)?"lib":"user"}function Gg(n,i,s){if(n.ownership&&n.ownership!==s)throw ty(i,n.ownership);n.ownership??=s}function dE(n,i,s){const r=n.memberOwnership.get(i);if(r&&r!==s)throw ty(i,r);n.memberOwnership.set(i,s)}function hE(n,i,s,r){const o=ey(s);if(!o)return;const c=or(r);if(!c)return;const d=pE(c.entries,o.layout.entries);if(d)throw hS(n,i,d)}function pE(n,i){if(n.length!==i.length)return`expected ${n.length} bindings and received ${i.length}`;const s=$g(n),r=$g(i);for(const[o,c]of s){const d=r.get(o);if(!d)return`missing @binding(${o})`;if(Ig(c)!==Ig(d))return`@binding(${o}) does not match the reflected layout`}}function $g(n){return new Map(n.map(i=>[i.binding,i]))}function Ig(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 Gc(n,i){const s=Kl(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 Kl(n){return n===void 0?void 0:to(n)}function mE(n,i){return uf(n)&&uf(i)?{...n,...i}:i}function gE(n){return uf(n)?n:{}}const yE="rgba8unorm",Lf=Object.freeze([0,0,0,1]);function ao(n,i){const s=n,r=Array.isArray(n)?n:[s?.r,s?.g,s?.b,s?.a];if(r.length!==4||!r.every(o=>typeof o=="number"&&Number.isFinite(o)))throw _S(i);return jf(n)}function jf(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 Pl(n){return n.colors??[{format:n.format??yE}]}function Ly(n){return n.depth===!0?"depth24plus":n.depth||void 0}function jy(n){const i=n.msaa;if(i===!0||i===4)return 4;if(i===void 0||i===!1)return 1;const s=ny();throw s.code="VGPU-TARGET-MSAA-INVALID",s.message=`msaa received ${i}; WebGPU 1|4; use true`,s}function vE(n,i){if(!n?.size)throw ny();const s=Ly(n);if(s==="stencil8")throw MS(s);if(jy(n)===4)for(const r of Pl(n))bE(r.format,i)}function bE(n,i){if(i.isCompatibilityMode&&n==="rgba16float")throw Rt("target","Dawn compatibility mode does not support rgba16float+msaa.","Use rgba8unorm for MSAA here, or disable msaa.")}function xE(n,i,s,r){const o={view:(i??n).createView(),resolveTarget:i?n.createView():void 0,loadOp:r?"load":"clear",storeOp:i?"discard":"store"};return r||(o.clearValue=By(s)),o}function SE(n,i,s,r,o){if(o){const d={view:n.createView(),depthReadOnly:!0};return pr(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&&pr(n.format)&&(c.stencilLoadOp=i?"load":"clear",c.stencilStoreOp=n.sampleCount>1?"discard":"store",i||(c.stencilClearValue=r??0)),c}function pr(n){return!!n&&n.includes("stencil")}function By(n){return Array.isArray(n)?{r:n[0],g:n[1],b:n[2],a:n[3]}:n}function Gy(n,i){return n[0]===i[0]&&n[1]===i[1]}function fo(n){return typeof n=="object"&&n!==null&&typeof n.renderPassDescriptor=="function"}let wE=1,EE=1;const TE=new WeakMap,AE=new WeakMap;function ME(n){return fo(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 $y(n){return`${n.colors.join(",")}:${n.depth??"none"}:${n.sampleCount??1}`}function RE(n,i){if(!Array.isArray(n.colors)||n.colors.length===0)throw Ll(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 Ll(i,`colors must contain only GPUTextureFormat strings; received ${String(s)}.`);if(n.depth!==void 0&&(typeof n.depth!="string"||n.depth.length===0))throw Ll(i,"depth must be a GPUTextureFormat string.");const r=n.sampleCount??1;if(r!==1&&r!==4)throw Ll(i,`sampleCount must be 1 or 4; received ${String(r)}.`)}function DE(n){const i=`${Hg(TE,n.module,()=>wE++)}|${Hg(AE,n.pipelineLayout,()=>EE++)}|${UE(n.vertexBufferLayouts??[])}|${$y(n.signature)}`,s=n.topology||n.stripIndexFormat?`${i}|${n.topology??"triangle-list"}|${n.stripIndexFormat??"none"}`:i,r=n.cullMode||n.frontFace?`${s}|${n.cullMode??"none"}|${n.frontFace??"ccw"}`:s,o=n.unclippedDepth?`${r}|unclipped`:r,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,g=n.entryKey?`${m}|${n.entryKey}`:m;return n.fragmentKey?`${g}|${n.fragmentKey}`:g}function cf(n,i,s,r,o){if(r===void 0)return i.find(d=>d.stage===s);if(typeof r!="string")throw Yl(n,`${s} received ${ff(r)}; expected an entry point name string.`,o);const c=i.find(d=>d.name===r);if(!c)throw Yl(n,`"${r}" matches no entry point in the shader; available entry points: ${Vg(i)}.`,o);if(c.stage!==s)throw Yl(n,`"${r}" is a @${c.stage} entry point, not @${s}; available entry points: ${Vg(i)}.`,o);return c}function Vg(n){return n.length?n.map(i=>`"${i.name}" (@${i.stage})`).join(", "):"none"}function Iy(n,i,s,r){if(i!==void 0&&(typeof i!="object"||i===null||Array.isArray(i)))throw kl(n,`received ${ff(i)}; expected { overrideNameOrId: number | boolean }.`,r);const o=new Map(s.map(d=>[Fg(d),d])),c={};for(const[d,h]of Object.entries(i??{})){if(!o.has(d))throw kl(n,`"${d}" matches no override in the shader; available overrides: ${CE(s)}.`,r);if(typeof h=="boolean"){c[d]=h?1:0;continue}if(typeof h!="number"||!Number.isFinite(h))throw kl(n,`"${d}" received ${ff(h)}; use a finite number or a boolean (WebGPU converts the value to the override's WGSL type, and NaN/Infinity fail that conversion).`,r);c[d]=h}for(const d of s){const h=Fg(d);if(d.defaultValue===void 0&&!(h in c))throw kl(n,`override '${d.name}' has no default value and must be provided; add constants: { "${h}": value }.`,r)}return Object.keys(c).length===0?{}:{constants:c,constantsKey:OE(c)}}function Fg(n){return n.id!==void 0?String(n.id):n.name}function CE(n){return n.length?n.map(i=>i.id!==void 0?`"${i.id}" (@id of ${i.name})`:`"${i.name}"`).join(", "):"none"}function OE(n){return`cn~${Object.entries(n).sort(([i],[s])=>i<s?-1:i>s?1:0).map(([i,s])=>`${i}=${s}`).join("~")}`}function ff(n){if(typeof n=="string")return`"${n}"`;try{return JSON.stringify(n)??String(n)}catch{return String(n)}}function Vy(n){const i=new Map;return{get(s,r){let o=i.get(s);return o||(o=n.gpu.createShaderModule({label:r,code:s}),i.set(s,o)),o},dispose(){i.clear()}}}function Fy(n){const i=new Map;return{get(s){const r=NE(s);let o=i.get(r);return o||(o=n.gpu.createPipelineLayout({bindGroupLayouts:kE(s)}),i.set(r,o)),o},dispose(){i.clear()}}}function Hy(n,i={}){return new zE(n,i)}class zE{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,r){this.#o(r.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,r);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,r){this.#o(r.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=_E();c.pending=d,this.#e.set(i,c);let h;try{h=s()}catch(m){const g=ar(r.where,m,r.signature);return d.reject(g),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(r.where,m,r.signature)))}),d.promise}dispose(){if(this.#a)return;this.#a=!0;const i=Ag("gpu.dispose");for(const s of this.#e.values())s.pending?.reject(i);this.#e.clear(),this.#t.clear(),this.#i?.()}#s(i,s,r,o){const c=this.device.gpu,d=typeof c.pushErrorScope=="function"&&typeof c.popErrorScope=="function";d&&c.pushErrorScope("validation");try{const h=r();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,r){const o=this.device.gpu.popErrorScope().then(c=>{if(!c)return;const d=ar(r.where,c,r.signature);return this.#e.get(i)===s&&this.#e.delete(i),this.#n(d)},c=>{const d=ar(r.where,c,r.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 Ag(i)}#u(i){this.#t.add(i),i.catch(()=>{}).then(()=>this.#t.delete(i),()=>this.#t.delete(i))}}function _E(){let n,i;const s=new Promise((r,o)=>{n=r,i=o});return s.catch(()=>{}),{promise:s,resolve:n,reject:i}}function Hg(n,i,s){let r=n.get(i);return r||(r=s(),n.set(i,r)),r}function UE(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 NE(n){return JSON.stringify([...n.entries()].map(([i,s])=>({group:i,entries:jE(s)})))}function kE(n){const i=Math.max(-1,...n.keys()),s=[];for(let r=0;r<=i;r++)s.push(LE(n,r));return s}function LE(n,i){const s=n.get(i);if(!s)throw AS(i);return s}function jE(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 BE=uo("frame-state");function qy(n){return n.service(BE,GE)}function GE(){const n=new Set;let i=qg(),s=!1,r=!1;const o={time:0,deltaTime:0,frameCount:0,advanceBy(c){o.deltaTime=c,o.time+=c,r=!0},tick(){if(s)throw ay();s=!0;try{const c=qg();r?r=!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 qg(){return globalThis.performance?.now?.()??Date.now()}function $E(n,i,s={}){const r=Mn(n,"surface"),o=VE(r),c=o.get(i);if(c&&!c.disposed)throw DS(c.label);const d=new Xy(r.device,i,s,g=>{o.get(g.canvas)===g&&o.delete(g.canvas),h(),m()}),h=qy(r).onAdvance(()=>d.applyAutoResize()),m=r.own("resource",()=>d.dispose());return o.set(i,d),d}const IE=uo("surfaces");function VE(n){return n.service(IE,()=>new Map)}let lr=0,Bf=0;function FE(){return lr>0}function HE(){return Bf>0}function qE(){Bf+=1}function YE(){Bf-=1}function Yy(n){return n instanceof Xy}class Xy{device;canvas;options;unregister;resourceIdentity=lo("render-target");label;context;autoResize;layoutBacked;format;#e=new oo;#t=new Set;#n=new Set;#i;#a;#s=!1;#l=!1;constructor(i,s,r,o){this.device=i,this.canvas=s,this.options=r,this.unregister=o,this.label=r.label,this.#a=r.clearColor===void 0?Lf:ao(r.clearColor,"surface.clearColor");const c=s.getContext("webgpu");if(!c)throw RS();if(this.context=c,this.layoutBacked=XE(s),r.autoResize===!0&&!this.layoutBacked)throw OS();this.autoResize=r.autoResize??(r.size?!1:this.layoutBacked),this.#i=Xg(r.dpr),this.format=r.format??PE();const d=KE(s,r,this.layoutBacked,this.#i);(r.size||this.layoutBacked)&&Yg(s,d),c.configure({device:i.gpu,format:this.format,alphaMode:r.alphaMode??"premultiplied",colorSpace:r.colorSpace??"srgb",usage:QE()})}get gpu(){return this.context}get size(){return this.#r(),Ql(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 jf(this.#a)}set clearColor(i){this.#a=ao(i,"surface.clearColor")}get disposed(){return this.#s}resize(i){if(this.#r(),this.#l)throw zS(this.options.label);this.#c(so(i),this.#i,!0)}applyAutoResize(){if(this.#s||!this.autoResize||!this.layoutBacked)return;const i=Xg(this.options.dpr),s=Ky(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:r}=i;this.#r();const o={view:this.context.getCurrentTexture().createView(),loadOp:r?"load":"clear",storeOp:"store"};return r||(o.clearValue=By(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,r){const o=!Gy(Ql(this.canvas),i);this.#i=s,o&&(Yg(this.canvas,i),this.#o(),r&&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=Ql(this.canvas);return{width:i[0],height:i[1],dpr:this.#i,surface:this}}#r(){if(this.#s)throw CS(this.options.label)}}function XE(n){return typeof n.clientWidth=="number"}function KE(n,i,s,r){return i.size?so(i.size):s?Ky(n,r):so(Ql(n))}function Ky(n,i){const s=n;return so([Math.round(s.clientWidth*i),Math.round(s.clientHeight*i)])}function Ql(n){const i=n;return[i.width,i.height]}function Yg(n,i){const s=n;s.width=i[0],s.height=i[1]}function so(n){return[Math.max(1,Math.floor(n[0])),Math.max(1,Math.floor(n[1]))]}function Xg(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 PE(){return globalThis.navigator?.gpu?.getPreferredCanvasFormat?.()??"bgra8unorm"}function QE(){const n=globalThis.GPUTextureUsage;return n?n.RENDER_ATTACHMENT|n.TEXTURE_BINDING|n.COPY_SRC:void 0}const ZE={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 Py(n,i,s,r){const o=typeof s=="object"&&s!==null?s.buffer:void 0,c=Kg(s)?s:Kg(o)?o:void 0;if(!c)throw ia(n,`received ${Pg(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 ia(n,`offset must be an integer >= 0; received ${Pg(d)}.`,i);if(d%4!==0)throw ia(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 ia(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}=ZE[r];if(d+h>c.size)throw ia(n,`${r} 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 Kg(n){return typeof n=="object"&&n!==null&&"gpu"in n&&"size"in n&&n.buffer instanceof Di}function Pg(n){if(typeof n=="string")return`"${n}"`;try{return JSON.stringify(n)??String(n)}catch{return String(n)}}const ro=Symbol("vgpu.frame.drawable");function WE(n){return n?.[ro]}const JE=Symbol("vgpu.frame.bundle");function eT(n){return n?.[JE]}const Gf=Symbol("vgpu.frame.passAttachment");function tT(n){return typeof n?.[Gf]=="function"?n:void 0}function nT(n,i){return ho(Mn(n,"sampler")).sampler(i)}let Qg=1;function iT(n){const i=new Map,s=new WeakMap;return{sampler(r={}){const o=df(r);let c=i.get(o);return c||(c=n.gpu.createSampler(r),i.set(o,c),s.set(c,{kind:"sampler",id:Qg++})),c},identity(r){let o=s.get(r);return o||(o={kind:"sampler",id:Qg++},s.set(r,o)),o}}}function df(n){if(n===null||typeof n!="object")return JSON.stringify(n);if(Array.isArray(n))return`[${n.map(df).join(",")}]`;const i=n;return`{${Object.keys(i).sort().map(s=>`${JSON.stringify(s)}:${df(i[s])}`).join(",")}}`}const aT=uo("render-service");function ho(n){return n.service(aT,sT)}function sT(n){const i=n.device,s=Df(),r=Hy(i,{errorSink:h=>n.reportError(h),registerSettledSource:h=>n.registerSettledSource(h)}),o=Vy(i),c=Fy(i),d=iT(i);return n.own("service",()=>{r.dispose(),o.dispose(),c.dispose(),s.dispose()}),{binds:s,pipelines:r,shaderModules:o,pipelineLayouts:c,sampler:h=>d.sampler(h)}}function $f(n){if(typeof n=="string")return n;if(!rT(n)||!("version"in n)||n.version!==1)throw jl(n);const s=n.wgsl;if(typeof s!="string")throw jl(n);return s}function rT(n){return typeof n=="object"&&n!==null}function Gl(n,i){const s=Mn(n,"draw"),r=ho(s),o=$f(i.shader);return new Zy(s.device,o,{...i,shader:o},r.binds,void 0,r.pipelines,r.shaderModules,r.pipelineLayouts,c=>s.reportError(c),c=>{s.trackDelivery(c)})}let lT=1;const Qy=new WeakMap;class Zy{source;label;#e=new Map;constructor(i,s,r,o=Df(),c,d=Hy(i),h=Vy(i),m=Fy(i),g,x){this.source=s,at(i,"Draw.constructor"),this.label=r.label??"draw";const b=lT++,R=Rf(s,`${this.label}.wgsl`),B=gT(this.label,r.entry),O=cf(this.label,R.entryPoints,"vertex",B.vertex,"draw"),L=cf(this.label,R.entryPoints,"fragment",B.fragment,"draw"),_=yT(R,O,L),H=[O,L].filter(ae=>!!ae),Z=zy(R.bindings,H);oT(i,this.label,R.bindings,H,Z);const K=r.geometry,F=O?dr(O,"inputs",this.label):[],Y=K&&rf in K?K[rf](F,`${this.label}.geometry`):K?.vertexBufferLayouts,A=new Map(Uy(i,this.label,R,Z)),k=m.get(A),w=h.get(s,`${this.label}.shader`),$=NT(),te=fT(this.label,r),se=hT(this.label,r,te),oe=vT(i,this.label,r),he=wT(i,this.label,r),me=MT(this.label,r),ce=DT(this.label,r),U=Iy(this.label,r.constants,R.overrides,"draw"),P=ky({device:i,label:this.label,drawId:b,reflection:R,bindGroupLayouts:A,cache:o,onIdentityChange:ae=>$.markStale({kind:"binding-identity",drawLabel:this.label,...ae})});Qy.set(this,{id:b,device:i,opts:r,vertexBufferLayouts:Y,cache:o,defaultTarget:c,reflection:R,visibility:Z,vertexEntry:O?.name??"vs_main",fragmentEntry:L?.name??"fs_main",entryKey:_,setCore:P,bindGroupLayouts:A,pipelineLayout:k,shaderModule:w,pipelineStore:d,pipelineLayouts:m,errorSink:g,trackSettled:x,resolvedPipelineKeys:new Set,recordedIn:$,...te,...se,...oe,...he,...me,...ce,...U}),r.set&&this.set(r.set);for(const ae of r.targets??[])this.compileSync(ae)}get gpu(){const i=Ee(this);for(const s of i.resolvedPipelineKeys){const r=i.pipelineStore.getReady(s);if(r)return r}}get targets(){return Ee(this).opts.targets}get[ro](){return this}writesDepth(){return zT(this)}stencilWritingOps(){return _T(this)}set(i){const s=Ee(this);at(s.device,`${this.label}.set`);for(const r of s.setCore.set(i))s.recordedIn.markStale({kind:"binding-identity",drawLabel:this.label,...r});return this}group(i,s){const r=Ee(this);at(r.device,`${this.label}.group`);const o=this.#e.get(i)??this.layout(i),c=r.setCore.claimGroup(i,s,o);return r.recordedIn.markStale({kind:"group-claim",drawLabel:this.label,group:i,previousIdentity:c,newIdentity:`claimed-group:${i}`}),this}layout(i,s={}){return at(Ee(this).device,`${this.label}.layout`),s.dynamicOffsets?this.#t(i):Ee(this).setCore.layout(i)}#t(i){const s=Ee(this);s.setCore.layout(i);const r=this.#e.get(i);if(r)return r;const o=LT(this,i),c=Ny(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={}){at(Ee(this).device,`${this.label}.draw`);const s=fo(i)?{target:i}:i,r=Ee(this),o=s.target??r.defaultTarget;if(!o)throw sf(`${this.label}.draw`);c0(o,`${this.label}.draw`);const c=r.device.gpu.createCommandEncoder(),d=c.beginRenderPass(o.renderPassDescriptor()),h=[];try{this.encode(d,o,s,b=>h.push(b))}catch(b){Kt(h),Ey(r.device);try{d.end()}catch{}throw b}Ay(r.device,d,h,h[0]?.context);let m;const g=h[0]?.context;g&&ur(r.device,g);try{m=c.finish()}catch(b){const R=g?cn(r.device):void 0;Kt(h),R&&Kt([R]);const B=R?.context??g;if(B){u0(r,B.label,B.group,b);return}throw b}if(g){const b=cn(r.device);b&&(h[0]=h[0]?io(b,h[0]):b)}const x=h[0]?.context;x&&ur(r.device,x);try{r.device.gpu.queue.submit([m])}catch(b){const R=x?cn(r.device):void 0;Kt(h),R&&Kt([R]);const B=R?.context??x;if(B){u0(r,B.label,B.group,b);return}throw b}if(x){const b=cn(r.device);b&&(h[0]=h[0]?io(b,h[0]):b)}if(h.length){const b=Ty(r.device,h,{errorSink:r.errorSink});r.trackSettled?.(b)}}encode(i,s,r={},o){at(Ee(this).device,`${this.label}.encode`);const c=this.pipelineFor(s,!0);if(!c)return;i.setPipeline(c);const d=Ee(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,r,o);this.#l(i,r)}#n(i,s,r,o){const c=kT(r.offsets,s.group,s.offsets);if(!s.claimValidation||!o){i.setBindGroup(s.group,s.bindGroup,c);return}ur(Ee(this).device,s.claimValidation);try{i.setBindGroup(s.group,s.bindGroup,c)}catch(h){throw j2(Ee(this).device),ss(s.claimValidation.label,s.claimValidation.group,h)}const d=cn(Ee(this).device);d&&o(d)}compile(i){at(Ee(this).device,`${this.label}.compile`);const{key:s,signature:r,signatureKey:o}=this.#i(i,`${this.label}.compile`);return Ee(this).pipelineStore.getAsync(s,()=>this.#u(r),{where:`${this.label}.compile`,signature:o}).then(()=>(at(Ee(this).device,`${this.label}.compile`),Ee(this).resolvedPipelineKeys.add(s),this))}compileSync(i){at(Ee(this).device,`${this.label}.compileSync`);const{key:s,signature:r,signatureKey:o}=this.#i(i,`${this.label}.compileSync`);return Ee(this).pipelineStore.getSync(s,()=>this.#o(r),{where:`${this.label}.compileSync`,signature:o})&&Ee(this).resolvedPipelineKeys.add(s),this}pipelineFor(i,s=!1){at(Ee(this).device,`${this.label}.pipelineFor`);const{key:r,signature:o,signatureKey:c}=this.#i(i,`${this.label}.pipelineFor`,s),d=Ee(this).pipelineStore.getSync(r,()=>this.#o(o),{where:`${this.label}.pipelineFor`,signature:c});return d&&Ee(this).resolvedPipelineKeys.add(r),d}pipelineForAsync(i){at(Ee(this).device,`${this.label}.pipelineForAsync`);const{key:s,signature:r,signatureKey:o}=this.#i(i,`${this.label}.pipelineForAsync`);return Ee(this).pipelineStore.getAsync(s,()=>this.#u(r),{where:`${this.label}.pipelineForAsync`,signature:o}).then(d=>(at(Ee(this).device,`${this.label}.pipelineForAsync`),Ee(this).resolvedPipelineKeys.add(s),d))}#i(i,s,r=!1){const o=this.#a(i,s,r),c=$y(o);return{signature:o,signatureKey:c,key:this.#s(o)}}#a(i,s,r=!1){const o=Ee(this),c=i??o.defaultTarget;if(!c)throw sf(s);r||c0(c,s);const d=ME(c);if(RE(d,s),o.colorStates&&o.colorStates.length!==d.colors.length)throw af(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 ql(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)&&!pr(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=Ee(this),r=s.opts.geometry;return DE({module:s.shaderModule,pipelineLayout:s.pipelineLayout,vertexBufferLayouts:s.vertexBufferLayouts,signature:i,fragmentKey:s.fragmentKey,topology:r?.topology,stripIndexFormat:Wy(r),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 r=Ee(this).opts.geometry;if(r?.vertexBuffers&&r.vertexBuffers.forEach((c,d)=>i.setVertexBuffer(d,c)),s.indirect!==void 0)return this.#c(i,r,s);const o=cT(this.label,r,Ee(this).opts,s);if(!r?.indexBuffer)return i.draw(o.vertexCount,o.instanceCount,o.firstVertex,o.firstInstance);i.setIndexBuffer(r.indexBuffer,r.indexFormat??"uint32"),i.drawIndexed(o.indexCount,o.instanceCount,o.firstIndex,o.baseVertex,o.firstInstance)}#c(i,s,r){const o=`${this.label}.draw`,c=uT.find(g=>r[g]!==void 0);if(c!==void 0)throw ia(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}=Py(this.label,o,r.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=Ee(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:Zg(i,s),...s.constants?{constants:s.constants}:{}},primitive:Wg(s.opts.geometry,s.cullMode,s.frontFace,s.unclippedDepth),depthStencil:a0(i,s),multisample:l0(i,s)})}#u(i){const s=Ee(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:Zg(i,s),...s.constants?{constants:s.constants}:{}},primitive:Wg(s.opts.geometry,s.cullMode,s.frontFace,s.unclippedDepth),depthStencil:a0(i,s),multisample:l0(i,s)})}}function oT(n,i,s,r,o){const c=n.limits;for(const[d,h,m]of[["vertex",1,"maxStorageBuffersInVertexStage"],["fragment",2,"maxStorageBuffersInFragmentStage"]]){const g=r.find(R=>R.stage===d);if(!g)continue;const x=s.filter(R=>R.bindingLayout?.kind==="buffer"&&R.bindingLayout.buffer.type!=="uniform"&&o(R)&h),b=c[m]??c.maxStorageBuffersPerShaderStage;if(b!==void 0&&x.length>b)throw uS(i,d,g.name,x.length,b,x)}}const uT=["vertices","indices","instances","firstVertex","firstIndex","baseVertex","firstInstance"];function Zg(n,i){return n.colors.map((s,r)=>{const o=i.colorStates?.[r],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 cT(n,i,s,r){Ti(n,"DrawOptions.instances",s.instances),Ti(n,"DrawOptions.vertices",s.vertices),Ti(n,"DrawOptions.firstInstance",s.firstInstance),Ti(n,"DrawCallOptions.instances",r.instances),Ei(n,"DrawCallOptions.vertices",r.vertices),Ei(n,"DrawCallOptions.indices",r.indices),Ei(n,"DrawCallOptions.firstVertex",r.firstVertex),Ei(n,"DrawCallOptions.firstIndex",r.firstIndex),Ei(n,"DrawCallOptions.baseVertex",r.baseVertex),Ti(n,"DrawCallOptions.firstInstance",r.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&&rf in i?i:void 0),h=r.firstVertex??i?.firstVertex??0,m=r.vertices??i?.vertexCount??s.vertices??3,g=r.firstIndex??i?.firstIndex??0,x=r.indices??i?.indexCount??0,b=r.baseVertex??i?.baseVertex??0;if(o)Jg(n,"index",g,x,d?.indexCount);else if(r.indices!==void 0||r.firstIndex!==void 0||r.baseVertex!==void 0)throw wf(`${n}.draw`,"Index range needs an indexed geometry.");return o||Jg(n,"vertex",h,m,d?.vertexCount),{instanceCount:r.instances??s.instances??i?.instanceCount??1,firstInstance:r.firstInstance??s.firstInstance??0,vertexCount:m,firstVertex:h,indexCount:x,firstIndex:g,baseVertex:b}}function Wy(n){const i=n?.topology??"triangle-list";return n?.stripIndexFormat??(i.endsWith("strip")?n?.indexFormat:void 0)}function Wg(n,i,s,r){const o=n?.topology??"triangle-list",c=Wy(n),d=c?{topology:o,stripIndexFormat:c}:{topology:o};return i!==void 0&&(d.cullMode=i),s!==void 0&&(d.frontFace=s),r&&(d.unclippedDepth=!0),d}function Jg(n,i,s,r,o){if(!(o===void 0||s+r<=o))throw wf(`${n}.draw`,`${i} range [${s}, ${s+r}) exceeds parent geometry ${i} count ${o}.`)}function Ei(n,i,s){if(!(s===void 0||Number.isInteger(s)&&s>=0))throw wf(`${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 ie({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 fT(n,i){const s=i.blend===void 0?void 0:Jy(n,i.blend),r=i.writeMask===void 0?void 0:nv(n,i.writeMask),o=i.colors===void 0?void 0:dT(n,i.colors),c=o?`${o0(s,r)}@${o.map(OT).join("@")}`:s||r!==void 0?o0(s,r):void 0;return{blendState:s,writeMask:r,colorStates:o,fragmentKey:c}}function dT(n,i){if(!Array.isArray(i))throw af(n,`colors must be an array; received ${Qe(i)}.`);return i.map((s,r)=>{if(s==null)return null;if(typeof s!="object"||Array.isArray(s))throw af(n,`colors[${r}] must be null or { blend?, writeMask? }; received ${Qe(s)}.`);const o=s.blend===void 0?void 0:Jy(`${n}.colors[${r}]`,s.blend),c=s.writeMask===void 0?void 0:nv(`${n}.colors[${r}]`,s.writeMask);return!o&&c===void 0?null:{blendState:o,writeMask:c}})}function Jy(n,i){if(i==="alpha")return $l({src:"src-alpha",dst:"one-minus-src-alpha"},{src:"one",dst:"one-minus-src-alpha"});if(i==="premultiplied")return $l({src:"one",dst:"one-minus-src-alpha"},{src:"one",dst:"one-minus-src-alpha"});if(i==="additive")return $l({src:"one",dst:"one"},{src:"one",dst:"one"});if(typeof i!="object"||i===null||!e0(i.color))throw bg(n,i);const s=i.color,r=i.alpha;if(r!==void 0&&!e0(r))throw bg(n,i);return $l(s,r??s)}function e0(n){return typeof n=="object"&&n!==null&&typeof n.src=="string"&&typeof n.dst=="string"}function $l(n,i){return{color:t0(n),alpha:t0(i)}}function t0(n){return{srcFactor:n.src,dstFactor:n.dst,operation:n.op??"add"}}function hT(n,i,s){if(i.blendConstant===void 0)return{};const r=i.blendConstant;if(!Array.isArray(r)||r.length!==4||r.some(o=>typeof o!="number"||!Number.isFinite(o)))throw xg(n,`received ${Qe(r)}; expected [r, g, b, a] finite numbers.`);if(!pT(s).some(o=>o&&mT(o)))throw xg(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:r[0],g:r[1],b:r[2],a:r[3]}}}function pT(n){return n.colorStates?n.colorStates.map(i=>i?.blendState??n.blendState):[n.blendState]}function mT(n){return[n.color.srcFactor,n.color.dstFactor,n.alpha.srcFactor,n.alpha.dstFactor].some(i=>i==="constant"||i==="one-minus-constant")}function gT(n,i){if(i===void 0)return{};if(typeof i!="object"||i===null||Array.isArray(i))throw Yl(n,`received ${Qe(i)}; expected { vertex?, fragment? } entry point names.`);return i}function yT(n,i,s){const r=n.entryPoints.find(c=>c.stage==="vertex"),o=n.entryPoints.find(c=>c.stage==="fragment");if(!(i===r&&s===o))return`en~${i?.name??""}~${s?.name??""}`}function vT(n,i,s){const r=s.cull===void 0?void 0:xT(i,s.cull),o=s.frontFace===void 0?void 0:ST(i,s.frontFace),c=s.unclippedDepth===void 0?void 0:bT(n,i,s.unclippedDepth);return{cullMode:r,frontFace:o,unclippedDepth:c}}function bT(n,i,s){if(typeof s!="boolean")throw wg(i,`received ${Qe(s)}; expected a boolean.`);if(s){if(!n.features.has("depth-clip-control"))throw wg(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 xT(n,i){if(i==="none"||i==="front"||i==="back")return i;throw pS(n,i)}function ST(n,i){if(i==="ccw"||i==="cw")return i;throw mS(n,i)}const ev={depthWriteEnabled:!0,depthCompare:"less-equal"},tv=["never","less","equal","less-equal","greater","not-equal","greater-equal","always"],n0=-2147483648,i0=2147483647;function a0(n,i){if(n.depth)return{format:n.depth,...i.depthState??ev,...i.stencilState??{}}}function wT(n,i,s){if(s.depth===void 0)return{};const r=ET(n,i,s.depth,s.geometry?.topology??"triangle-list");return{depthState:r,depthKey:TT(r)}}function ET(n,i,s,r){if(s===!1)return{depthWriteEnabled:!1,depthCompare:"always"};if(typeof s!="object"||s===null)throw Kn(i,`received ${Qe(s)}.`);if(s.write!==void 0&&typeof s.write!="boolean")throw Kn(i,`write must be a boolean; received ${Qe(s.write)}.`);if(s.compare!==void 0&&!tv.includes(s.compare))throw Kn(i,`compare must be a GPUCompareFunction; received ${Qe(s.compare)}.`);if(s.bias!==void 0&&!Number.isInteger(s.bias))throw Kn(i,`bias must be an integer (WebGPU depthBias is i32); received ${Qe(s.bias)}.`);if(s.bias!==void 0&&(s.bias<n0||s.bias>i0))throw Kn(i,`bias must fit in the i32 range [${n0}, ${i0}] (WebGPU depthBias is i32); received ${Qe(s.bias)}.`);if(s.biasSlopeScale!==void 0&&!Number.isFinite(s.biasSlopeScale))throw Kn(i,`biasSlopeScale must be a finite number; received ${Qe(s.biasSlopeScale)}.`);if(s.biasClamp!==void 0&&!Number.isFinite(s.biasClamp))throw Kn(i,`biasClamp must be a finite number; received ${Qe(s.biasClamp)}.`);const o=s.bias??0,c=s.biasSlopeScale??0,d=s.biasClamp??0;if((o!==0||c!==0||d!==0)&&!r.startsWith("triangle"))throw Kn(i,`bias, biasSlopeScale, and biasClamp must be 0 for "${r}" topology.`);if(d!==0&&n.isCompatibilityMode)throw Kn(i,`biasClamp must be 0 on a compatibility-mode device; received ${Qe(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 TT(n){return`${n.depthWriteEnabled?1:0}~${n.depthCompare}~${n.depthBias??0}~${n.depthBiasSlopeScale??0}~${n.depthBiasClamp??0}`}const AT=["keep","zero","replace","invert","increment-clamp","decrement-clamp","increment-wrap","decrement-wrap"];function MT(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 ${Qe(s)}; expected { front?, back?, readMask?, writeMask?, ref? }.`);const r=s.front===void 0?void 0:s0(n,"front",s.front),o=s.back===void 0?void 0:s0(n,"back",s.back);$c(n,"readMask",s.readMask),$c(n,"writeMask",s.writeMask),$c(n,"ref",s.ref);const c={...r?{stencilFront:r}:{},...o??r?{stencilBack:o??{...r}}:{},...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:RT(c)}:{},...s.ref!==void 0?{stencilRef:s.ref}:{}}}function s0(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 ${Qe(s)}.`);if(s.compare!==void 0&&!tv.includes(s.compare))throw is(n,`${i}.compare must be a GPUCompareFunction; received ${Qe(s.compare)}.`);for(const[r,o]of[["fail",s.fail],["depthFail",s.depthFail],["pass",s.pass]])if(o!==void 0&&!AT.includes(o))throw is(n,`${i}.${r} must be a GPUStencilOperation; received ${Qe(o)}.`);return{compare:s.compare??"always",failOp:s.fail??"keep",depthFailOp:s.depthFail??"keep",passOp:s.pass??"keep"}}function $c(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 ${Qe(s)}.`)}function RT(n){return`st~${r0(n.stencilFront)}~${r0(n.stencilBack)}~${n.stencilReadMask??4294967295}~${n.stencilWriteMask??4294967295}`}function r0(n){return n?`${n.compare},${n.failOp},${n.depthFailOp},${n.passOp}`:"default"}function l0(n,i){return{count:n.sampleCount??1,...i.multisampleState??{}}}function DT(n,i){if(i.multisample===void 0)return{};const s=i.multisample;if(typeof s!="object"||s===null||Array.isArray(s))throw ql(n,`received ${Qe(s)}; expected { alphaToCoverage?, mask? }.`);if(s.alphaToCoverage!==void 0&&typeof s.alphaToCoverage!="boolean")throw ql(n,`alphaToCoverage must be a boolean; received ${Qe(s.alphaToCoverage)}.`);if(s.mask!==void 0&&(typeof s.mask!="number"||!Number.isInteger(s.mask)||s.mask<0||s.mask>4294967295))throw ql(n,`mask must be an integer in [0, 0xFFFFFFFF] (WebGPU GPUSampleMask is u32); received ${Qe(s.mask)}.`);const r={...s.alphaToCoverage!==void 0?{alphaToCoverageEnabled:s.alphaToCoverage}:{},...s.mask!==void 0?{mask:s.mask}:{}};return r.alphaToCoverageEnabled===void 0&&r.mask===void 0?{}:{multisampleState:r,multisampleKey:CT(r)}}function CT(n){return`ms~${n.alphaToCoverageEnabled?1:0}~${n.mask??4294967295}`}function nv(n,i){if(!Array.isArray(i))throw Sg(n,Qe(i));let s=0;for(const r of i)if(r==="r")s|=1;else if(r==="g")s|=2;else if(r==="b")s|=4;else if(r==="a")s|=8;else throw Sg(n,Qe(r));return s}function o0(n,i){return`${iv(n)};${i??15}`}function iv(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 OT(n){return n?`${n.blendState?iv(n.blendState):"inherit"};${n.writeMask??"inherit"}`:"inherit"}function Qe(n){if(typeof n=="string")return`"${n}"`;try{return JSON.stringify(n)??String(n)}catch{return String(n)}}function zT(n){return(Ee(n).depthState??ev).depthWriteEnabled}function _T(n){const i=Ee(n),s=i.stencilState;if(!s||s.stencilWriteMask===0)return[];const r=i.cullMode??"none",o=[],c=(d,h)=>{if(h)for(const[m,g]of[["fail",h.failOp],["depthFail",h.depthFailOp],["pass",h.passOp]])g!==void 0&&g!=="keep"&&o.push(`${d}.${m}: "${g}"`)};return r!=="front"&&c("front",s.stencilFront),r!=="back"&&c("back",s.stencilBack),o}function UT(n,i,s,r={},o){n.encode(i,s,r,o)}function Ee(n){const i=Qy.get(n);if(!i)throw new TypeError("Invalid Draw instance");return i}function u0(n,i,s,r){const o=(async()=>{await Cf(n.device),at(n.device,`${i}.validation`);const c=ss(i,s,r);n.errorSink?await n.errorSink(c):console.error(c)})();return n.trackSettled?.(o),o}function NT(){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 kT(n,i,s){return n?Array.isArray(n)?n:n[i]??s:s}function LT(n,i){const s=Ee(n);return _y(s.reflection.bindings,i,s.visibility).map(jT)}function jT(n){return n.buffer?{...n,buffer:{...n.buffer,hasDynamicOffset:!0}}:n}function c0(n,i){if(Yy(n)&&!HE())throw iy(i)}function f0(n,i,s={}){if("geometry"in s)throw Rt("effect","effect() never accepts vertex buffers; use draw(gpu, { shader, geometry: geometry(gpu, descriptor) }).");const r=Mn(n,"effect"),o=ho(r);return new BT(r.device,$f(i),s,o.binds,void 0,o.pipelines,o.shaderModules,o.pipelineLayouts,c=>r.reportError(c),c=>{r.trackDelivery(c)})}const av=new WeakMap;class BT{get gpu(){return Ji(this).gpu}constructor(i,s,r={},o,c,d,h,m,g,x){const b=GT(s),R=new Zy(i,b,{shader:b,set:r.set,label:r.label??"effect",blend:r.blend,writeMask:r.writeMask},o,c,d,h,m,g,x);av.set(this,R)}set(i){return Ji(this).set(i),this}draw(i={}){Ji(this).draw(fo(i)?{target:i}:i)}compile(i){return Ji(this).compile(i).then(()=>this)}compileSync(i){return Ji(this).compileSync(i),this}encode(i,s,r={},o){UT(Ji(this),i,s,r,o)}get[ro](){return Ji(this)[ro]}}function Ji(n){const i=av.get(n);if(!i)throw new TypeError("Invalid Effect instance");return i}function GT(n){return $T(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 $T(n){return Rf(n,"effect.wgsl").entryPoints.some(i=>i.stage==="vertex")}function IT(n,i,s={}){const r=Mn(n,"compute");return new FT(r.device,$f(i),s,ho(r).binds)}let VT=1;class FT{device;source;opts;cache;id=VT++;label;reflection;entryPoint;setCore;bindGroupLayouts;pipelineLayout;shaderModule;pipeline;#e;constructor(i,s,r={},o=Df()){this.device=i,this.source=s,this.opts=r,this.cache=o,at(i,"Compute.constructor"),this.label=r.label??"compute",this.reflection=Rf(s,`${this.label}.wgsl`);const c=HT(this.reflection,this.label,r.entry);this.entryPoint=c.name;const{constants:d}=Iy(this.label,r.constants,this.reflection.overrides,"compute");this.bindGroupLayouts=Uy(i,this.label,this.reflection,zy(this.reflection.bindings,[c])),this.pipelineLayout=aE(i,this.bindGroupLayouts),this.shaderModule=i.gpu.createShaderModule({label:`${this.label}.shader`,code:s}),this.pipeline=i.gpu.createComputePipeline({label:`${this.label}.pipeline`,layout:this.pipelineLayout,compute:{module:this.shaderModule,entryPoint:this.entryPoint,...d?{constants:d}:{}}}),this.setCore=ky({device:i,label:this.label,drawId:this.id,reflection:this.reflection,bindGroupLayouts:this.bindGroupLayouts,cache:this.cache});const h=new Set(dr(c,"bindings",this.label).map(m=>`${m.group}:${m.binding}`));this.#e=this.reflection.bindings.filter(m=>m.kind==="buffer"&&m.addressSpace==="storage"&&h.has(`${m.group}:${m.binding}`)),r.set&&this.set(r.set)}set(i){return at(this.device,`${this.label}.set`),this.setCore.set(i),this}dispatch(i,s,r){at(this.device,`${this.label}.dispatch`);const o=typeof i=="object"&&i!==null?this.#t(i,s,r):void 0;this.#n();const c=this.device.gpu.createCommandEncoder({label:`${this.label}.encoder`}),d=c.beginComputePass({label:`${this.label}.pass`});d.setPipeline(this.pipeline);for(const h of this.setCore.bindGroups())d.setBindGroup(h.group,h.bindGroup,h.offsets);o?d.dispatchWorkgroupsIndirect(o.buffer,o.offset):d.dispatchWorkgroups(i,s??1,r??1),d.end(),this.device.gpu.queue.submit([c.finish()])}#t(i,s,r){const o=`${this.label}.dispatch`;if(s!==void 0||r!==void 0)throw ia(this.label,"indirect cannot be combined with explicit workgroup counts in the same call; the GPU reads the counts from the buffer, so the CPU-side values would be ignored.",o);return Py(this.label,o,i.indirect,"dispatchWorkgroupsIndirect")}#n(){if(!this.#e.length)return;const i=new Map;for(const s of this.#e){const r=this.setCore.bindingState(s.name);if(!r)continue;const o=to(r.identity);i.has(o)||i.set(o,[]),i.get(o).push({identity:r.identity,writable:s.access!=="read"})}for(const s of i.values())if(!(s.length<2)&&s.some(r=>r.writable))throw LS(`${this.label}.dispatch`)}}function HT(n,i,s){const r=cf(i,n.entryPoints,"compute",s,"compute");if(!r)throw Rt(`${i}.compute`,"The compute shader requires a @compute entry point.");return r}function qT(n,i){return XT(Mn(n,"frame")).frame(i)}const YT=uo("frame-runner");function XT(n){return n.service(YT,i=>{const s=qy(i);return new aA(()=>{let r=()=>{};const o=new KT(i.device,void 0,c=>i.reportError(c),c=>{i.trackDelivery(c)},()=>r());return r=i.own("scheduler",()=>o.cancel()),o},()=>s.tick(),r=>i.own("scheduler",()=>r.stop()))})}class KT{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,r,o,c){this.device=i,this.defaultTarget=s,this.errorSink=r,this.trackSettled=o,this.releaseLifecycle=c,at(i,"Frame.constructor"),this.#e=i.gpu.createCommandEncoder({label:"vgpu.frame"})}pass(i,s){if(this.#s)throw Mg("Frame.pass");at(this.device,"Frame.pass");const r=fo(i),o=typeof s=="function"?s:L=>L.draw(s),c=r?i:i.target??this.defaultTarget;if(!c)throw sf("Frame.pass");if(Yy(c)&&this.#a)throw iy("Frame.pass");const d=r?void 0:i.clear,h=d===!1;if(h&&c.sampleCount===4)throw gS();const m=r?void 0:i.clearDepth;if(m!==void 0){if(typeof m!="number"||!(m>=0&&m<=1))throw Eg(m);if(h)throw yS();if(!c.depth)throw Eg(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 g=r?void 0:i.clearStencil;if(g!==void 0){if(typeof g!="number"||!Number.isInteger(g)||g<0||g>4294967295)throw Tg(`received ${String(g)}; expected an integer in [0, 0xFFFFFFFF] (WebGPU GPUStencilValue).`);if(h)throw vS();const L=c.depth?.format;if(!pr(L))throw Tg(`received ${String(g)}, but the target's depth format ${L?`"${L}"`:"(none)"} has no stencil aspect, so clearStencil would have no effect.`)}const x=r?void 0:i.depthReadOnly;if(x!==void 0&&typeof x!="boolean")throw sa(`received ${Ci(x)}; expected a boolean.`,"Pass depthReadOnly: true to open the pass with a read-only depth attachment, or omit it.");if(x){if(!c.depth)throw sa("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 bS();if(m!==void 0)throw sa("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(g!==void 0)throw sa("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=r?void 0:tA(i.viewport,this.device.gpu.limits,c.size),R=r?void 0:nA(i.scissor,c.size),B=[];let O;try{const L=r||i.timer===void 0?void 0:this.#r(i.timer,c,B,JT),H=(r||i.visibility===void 0?void 0:this.#r(i.visibility,c,B,eA))?.occlusion;let Z=c.renderPassDescriptor({clear:d===void 0||d===!0||d===!1?c.clearColor??Lf:d,preserve:h,clearDepth:m,clearStencil:g,depthReadOnly:x});L?.timestampWrites&&(Z={...Z,timestampWrites:L.timestampWrites}),H&&(Z={...Z,occlusionQuerySet:H.querySet}),O=this.#e.beginRenderPass(Z),b&&O.setViewport(b.x,b.y,b.width,b.height,b.minDepth,b.maxDepth),R&&O.setScissorRect(R[0],R[1],R[2],R[3]),this.#l=!0;try{o(new PT(O,c,this.#t,x===!0,H,this,K=>{if(at(this.device,K),this.#s)throw Mg(K)}))}finally{this.#l=!1}}catch(L){this.#u(B),Kt(this.#t),this.#t.length=0,Ey(this.device);try{O?.end()}catch{}throw L}Ay(this.device,O,this.#t)}submit(){if(this.#a||this.#s)return;at(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?cn(this.device):void 0;Kt(this.#t),c&&Kt([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=cn(this.device);o&&(this.#t[0]=this.#t[0]?io(o,this.#t[0]):o)}const r=this.#t[0]?.context;r&&ur(this.device,r);try{this.device.gpu.queue.submit([i])}catch(o){this.#c(this.#o());const c=r?cn(this.device):void 0;Kt(this.#t),c&&Kt([c]);const d=c?.context??r;if(!d)throw o;this.done=this.#h(this.#d(d.label,d.group,o));return}if(r){const o=cn(this.device);o&&(this.#t[0]=this.#t[0]?io(o,this.#t[0]):o)}for(const o of this.#f())o.frameSubmitted(this);this.#c(this.#i),this.done=this.#h(Ty(this.device,this.#t,{errorSink:this.errorSink}))}cancel(){if(!this.#s){if(this.#a)throw kS("Frame.cancel");if(this.#l)throw NS("Frame.cancel");this.#s=!0,this.releaseLifecycle?.(),this.#c(this.#o()),this.#n.clear(),this.#i.clear(),Kt(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,r,o){const c=tT(i);if(!c)throw o(i);let d;try{d=c[Gf]({frame:this,device:this.device,target:s})}catch(h){throw this.#u(this.#n),h}return this.#n.add(d.owner),r.push(d.owner),d}async#d(i,s,r){await Cf(this.device),at(this.device,"Frame.validation");const o=ss(i,s,r);this.errorSink?await this.errorSink(o):console.error(o)}#h(i){return this.trackSettled?.(i),i}}class PT{encoder;target;validations;depthReadOnly;occlusionSource;frame;assertFrameOpen;#e=!1;constructor(i,s,r,o=!1,c,d,h){this.encoder=i,this.target=s,this.validations=r,this.depthReadOnly=o,this.occlusionSource=c,this.frame=d,this.assertFrameOpen=h}draw(i,s={}){this.assertFrameOpen?.("FramePass.draw");const r=ZT(i);this.depthReadOnly&&QT(r,this.target),r.encode(this.encoder,this.target,s,o=>this.validations.push(o))}occlusion(i,s){if(this.assertFrameOpen?.("FramePass.occlusion"),!this.occlusionSource)throw wS();if(this.#e)throw ES();const r=this.occlusionSource.beginQuery(i,this.frame);this.encoder.beginOcclusionQuery(r),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 sa("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(r=>eT(r)??WT());for(const r of s)r.assertReplayable(this.target);this.encoder.executeBundles(s.map(r=>r.gpu))}}function QT(n,i){if(n.writesDepth())throw sa(`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(pr(i.depth?.format)){const s=n.stencilWritingOps();if(s.length)throw sa(`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 ZT(n){const i=WE(n);if(!i)throw new TypeError("Invalid Effect instance: pass.draw() expects a Draw or an Effect created by this library.");return i}function WT(){throw new ie({code:"VGPU-R3-BUNDLE-INVALID",message:"p.bundles() expected bundles created by bundle(gpu, { target }, cb).",where:"FramePass.bundles"})}function JT(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 eA(n){return SS(`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 tA(n,i,s){if(n===void 0)return;if(typeof n!="object"||n===null||Array.isArray(n))throw Pn(`received ${Ci(n)}; expected { x?, y?, width, height, minDepth?, maxDepth? }.`);const{x:r=0,y:o=0,width:c,height:d,minDepth:h=0,maxDepth:m=1}=n;for(const[R,B]of[["x",r],["y",o],["width",c],["height",d],["minDepth",h],["maxDepth",m]])if(typeof B!="number"||!Number.isFinite(B))throw Pn(`${R} received ${Ci(B)}; expected a finite number.`);const g=i.maxTextureDimension2D,x=g*2,b=`target is ${s[0]}x${s[1]}px, device maxTextureDimension2D is ${g}`;if(!(c>=0&&c<=g))throw Pn(`width ${c} is outside [0, ${g}] (${b}).`);if(!(d>=0&&d<=g))throw Pn(`height ${d} is outside [0, ${g}] (${b}).`);if(!(r>=-x&&r+c<=x-1))throw Pn(`x ${r} with width ${c} is outside [${-x}, ${x-1}] (${b}).`);if(!(o>=-x&&o+d<=x-1))throw Pn(`y ${o} with height ${d} is outside [${-x}, ${x-1}] (${b}).`);if(!(h>=0&&h<=1))throw Pn(`minDepth ${h} is outside [0, 1].`);if(!(m>=0&&m<=1))throw Pn(`maxDepth ${m} is outside [0, 1].`);if(!(h<=m))throw Pn(`minDepth ${h} exceeds maxDepth ${m}.`);return{x:r,y:o,width:c,height:d,minDepth:h,maxDepth:m}}function nA(n,i){if(n===void 0)return;if(!Array.isArray(n)||n.length!==4)throw Lc(`received ${Ci(n)}; expected [x, y, width, height].`);const[s,r,o,c]=n;for(const[m,g]of[["x",s],["y",r],["width",o],["height",c]])if(typeof g!="number"||!Number.isInteger(g)||g<0)throw Lc(`${m} received ${Ci(g)}; expected a non-negative integer.`);const[d,h]=i;if(s+o>d||r+c>h)throw Lc(`[${s}, ${r}, ${o}, ${c}] exceeds the target's current size ${d}x${h}px (x + width <= ${d}, y + height <= ${h}).`);return[s,r,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 iA(n){const i=n?.code;return i==="VGPU-DEVICE-DISPOSED"||i==="VGPU-DEVICE-LOST"}class aA{createFrame;advance;trackLoop;#e=!1;constructor(i,s,r){this.createFrame=i,this.advance=s,this.trackLoop=r}frame(i){if(this.#e||FE())throw ay();this.#e=!0,qE();try{this.advance();const s=this.createFrame();if(i)try{i(s)}finally{try{s.submit()}catch(r){if(!iA(r))throw r}}return s}finally{YE(),this.#e=!1}}loop(i,s={}){let r=!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 g=R=>{r||(sA(R,h,d)&&(h=R,this.frame(i)),r||(m=o(g)))};m=o(g);let x;const b={stop(){r=!0,c(m),x?.(),x=void 0}};return x=this.trackLoop?.(b),b}}function sA(n,i,s){return i===void 0||s<=0?!0:n-i>=s}function d0(n,i){return new hf(Mn(n,"target").device,i)}class hf{device;options;resourceIdentity=lo("render-target");#e=new oo;#t=new Set;#n;#i;#a;#s;#l;constructor(i,s){this.device=i,this.options=s,vE(s,i),this.#l=s.clearColor===void 0?Lf:ao(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 Pl(this.options)[0]?.format??"rgba8unorm"}get clearColor(){return jf(this.#l)}set clearColor(i){this.#l=ao(i,"target.clearColor")}get sampleCount(){return jy(this.options)}resize(i){Gy(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:r,clearDepth:o,clearStencil:c,depthReadOnly:d}=i;return{colorAttachments:this.#i.map((h,m)=>xE(h,this.#a?.[m],s,r)),depthStencilAttachment:this.#s?SE(this.#s,r,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 Pl(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 Pl(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=Ly(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 ea(n,i,s="read-write"){const r=Mn(n,"storage"),o=typeof s=="string"?{access:s}:s,c=rA(r.device,i,o.access??"read-write",void 0,o.indirect??!1);return ly(r,c,d=>d.destroy(),d=>{c.onDestroy(d)})}class If{size;access;buffer;constructor(i,s){this.buffer=i,this.access=s,this.size=i.options.size}static create(i,s,r,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 If(h,r)}read(){return this.buffer.read(this.size)}write(i,s=0){this.buffer.write(lA(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 rA(n,i,s,r,o=!1){return If.create(n,i,s,r,o)}function lA(n){if(n instanceof ArrayBuffer||ArrayBuffer.isView(n))return n;throw new TypeError("StorageBuffer.write() requires ArrayBuffer or ArrayBufferView.")}function oA(n,i,s,r={}){const o=Mn(n,"pingPong");return cA(o.device,i,s,r,c=>uA(o,c))}function uA(n,i){return ly(n,i,s=>s.destroy(),s=>{i.onDestroy(s)})}function cA(n,i,s,r={},o=fA){const c=[h0(i),h0(s)],d={...r,size:c},h=o(new hf(n,p0(d,r.label,"ping"))),m=o(new hf(n,p0(d,r.label,"pong")));return new dA([h,m])}function fA(n){return n}class dA{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 h0(n){return Math.max(1,Math.floor(n))}function p0(n,i,s){return i?{...n,label:`${i}.${s}`}:n}const Ic=8,hA=globalThis.GPUMapMode?.READ??1;function pA(n,i){return new mA(n,i)}class mA{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 r=s.label??"vgpu.query-ring";this.#e=r;const o=s.capacity*Ic;this.querySet=i.gpu.createQuerySet({type:s.type,count:s.capacity,label:r}),this.#t=i.createBuffer({size:o,usage:["query_resolve","copy_src"],label:`${r}.resolve`}),this.#n=Array.from({length:s.depth??3},(c,d)=>({buffer:i.createBuffer({size:o,usage:["map_read","copy_dst"],label:`${r}.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 r=this.#h();if(!r)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,r.buffer.gpu,0,o*Ic),this.#o={staging:r,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 r=s.staging.buffer.gpu.mapAsync(hA).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?.(r)}#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*Ic))}catch(r){throw this.#p(i.staging),r}try{i.staging.buffer.gpu.unmap()}catch(r){throw i.staging.retired=!0,r}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=US(this.#e,i),r=this.#a;if(!r){console.error(s);return}try{Promise.resolve(r(s)).catch(o=>{console.error(o)})}catch(o){console.error(o)}}}const m0=32,pf=4096,g0=pf/2,gA=1/1e6;class yA{name;owner;constructor(i,s){this.name=i,this.owner=s}[Gf](i){return{owner:this.owner,timestampWrites:this.owner.attachSpan(this,i.frame,i.device)}}}function vA(n){const i=Mn(n,"timer");return PS(i,s=>new bA(i.device,s))}class bA{#e;#t;#n=new Map;#i=new Set;#a;#s=m0*2;#l=m0*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 ${SA(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 yA(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,r){if(this.#v("Frame.pass"),r!==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>=g0)throw xS(g0,pf);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 r=this.#d;this.#d+=1,this.#a.onSubmitted(o=>{r<=this.#h||(this.#h=r,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(pf,xA(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 r={};for(const{name:c,begin:d}of i){const h=s[d]??0n,m=s[d+1]??0n;r[c]=m>h?Number(m-h)*gA:0}const o=Object.freeze(r);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 pA(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 xA(n){let i=1;for(;i<n;)i*=2;return i}function SA(n){return typeof n=="string"?`'${n}'`:String(n)}function y0(n){return HS("browser",n)}const sv=`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: 4 vec4 each (fourth: target, renderer deadline, identity generation, live flag)
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, integrated angular travel, 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 * 4u].xy; }
73
+ fn massExtent(i: u32) -> vec2f { return massData[i * 4u].zw; }
74
+ @group(0) @binding(7) var<storage, read> massResponse: array<vec4f>;
75
+ fn massShape(i: u32) -> vec4f {
76
+ let shape = massData[i * 4u + 1u];
77
+ return vec4f(shape.xyz * massResponse[i].w, shape.w);
78
+ }
79
+ fn massPhase(i: u32) -> f32 { return massData[i * 4u + 2u].x; }
80
+ fn massTint(i: u32) -> vec3f { return massData[i * 4u + 2u].yzw; }
81
+ `,wA=`// FIELD-SPEC §5: bounded viscous response. This is material, never telemetry.
82
+ struct ResponseParams { rect: vec4f, view: vec4f, counts: vec4f, layer: vec4f,
83
+ layer2: vec4f, grid: vec4f, fill: vec4f, fieldRect: vec4f, sheet: vec4f }
84
+ @group(0) @binding(0) var<storage, read> P: ResponseParams;
85
+ @group(0) @binding(1) var<storage, read> massData: array<vec4f>;
86
+ // value, identity generation, local phase, deformation factor. Eight entries, no history growth.
87
+ @group(0) @binding(2) var<storage, read_write> response: array<vec4f>;
88
+
89
+ @compute @workgroup_size(8)
90
+ fn main(@builtin(global_invocation_id) id: vec3u) {
91
+ let i = id.x;
92
+ if (i >= u32(P.counts.x)) { return; }
93
+ let drive = massData[i * 4u + 3u];
94
+ var rt = response[i];
95
+ if (rt.y != drive.z) { rt = vec4f(0.0, drive.z, massData[i * 4u + 2u].x, 1.0); }
96
+ let fresh = drive.w > 0.5 && P.sheet.y < drive.y;
97
+ let observed = clamp(drive.x, 0.0, 1.0);
98
+ let destination = select(0.0, observed * smoothstep(0.04, 0.12, observed), fresh);
99
+ // Historical/legacy prominence remains a static shape, with no claim of ongoing observation.
100
+ if (drive.w < 0.5) {
101
+ response[i] = vec4f(0.0, drive.z, rt.z, 1.0 + drive.x);
102
+ return;
103
+ }
104
+ let dt = max(0.0, P.sheet.z);
105
+ let rate = select(1.1, 2.6, destination > rt.x);
106
+ // Elapsed time, including long stalls; the canonical deadline independently removes stale drive.
107
+ let step = dt;
108
+ rt.x = rt.x + (destination - rt.x) * (1.0 - exp(-rate * step));
109
+ if (abs(rt.x - destination) < 0.0005) { rt.x = destination; }
110
+ rt.z = (rt.z + dt * 1.2566370614) % 6.2831853072;
111
+ // This 5 s carrier is an authored encoding of a fresh CPU rate, never measured CPU cycles.
112
+ // Suppress ordinary idle noise; loss of freshness releases the material and its carrier together.
113
+ let carrier = 0.12 * smoothstep(0.04, 0.12, rt.x) * rt.x * sin(rt.z);
114
+ rt.w = 1.0 + rt.x + carrier;
115
+ if (P.sheet.w > 0.5) { rt.x = destination; rt.w = 1.0 + destination; }
116
+ response[i] = rt;
117
+ }
118
+ `,EA=`@group(0) @binding(4) var prevTex : texture_2d<f32>;
119
+ @group(0) @binding(5) var prevSamp : sampler;
120
+
121
+ const DEPOSIT_RATE : f32 = 0.02;
122
+ const DECAY_RATE : f32 = 0.05;
123
+
124
+ @fragment
125
+ fn fs_main(@location(0) uv: vec2f) -> @location(0) vec4f {
126
+ let prev = textureSampleLevel(prevTex, prevSamp, uv, 0.0);
127
+ let dt = P.counts.w;
128
+
129
+ // Texel back to world space over the fixed residue rect.
130
+ let world = vec2f(
131
+ mix(P.fieldRect.x, P.fieldRect.z, uv.x),
132
+ mix(P.fieldRect.y, P.fieldRect.w, uv.y)
133
+ );
134
+
135
+ // --- process deposition -------------------------------------------------
136
+ var deposit = 0.0;
137
+ let dn = u32(P.counts.y);
138
+ for (var i = 0u; i < dn; i = i + 1u) {
139
+ let a = distData[i * 3u];
140
+ let b = distData[i * 3u + 1u];
141
+ let radius = a.z;
142
+ let energy = b.w;
143
+ if (energy <= 0.001) { continue; }
144
+ let d = length(vec2f(world.x - a.x, (world.y - a.y) * 1.5));
145
+ if (d > radius * 2.4) { continue; }
146
+ let falloff = exp(-sq(d / (radius * 1.7)));
147
+ deposit = deposit + energy * falloff;
148
+ }
149
+
150
+ // --- transfer deposition ------------------------------------------------
151
+ var coupleDeposit = 0.0;
152
+ let cn = u32(P.counts.z);
153
+ for (var i = 0u; i < cn; i = i + 1u) {
154
+ let c = coupData[i];
155
+ let a = massPos(u32(c.x));
156
+ let b = massPos(u32(c.y));
157
+ let v = b - a;
158
+ let l2 = dot(v, v);
159
+ if (l2 < 1.0) { continue; }
160
+ let u = dot(world - a, v) / l2;
161
+ if (u < -0.05 || u > 1.05) { continue; }
162
+ let proj = a + v * u;
163
+ let p = length(world - proj) / 44.0;
164
+ coupleDeposit = coupleDeposit + c.z * exp(-p * p * 1.4)
165
+ * exp(-quad((u - 0.5) / 0.5));
166
+ }
167
+
168
+ let r = prev.r + (deposit * DEPOSIT_RATE - prev.r * DECAY_RATE) * dt;
169
+ let g = prev.g + (coupleDeposit * DEPOSIT_RATE * 1.5 - prev.g * DECAY_RATE) * dt;
170
+
171
+ // Clamped so a pathological source can never drive residue unbounded.
172
+ return vec4f(clamp(r, 0.0, 4.0), clamp(g, 0.0, 4.0), 0.0, 1.0);
173
+ }
174
+ `,TA=`@group(0) @binding(4) var residueTex : texture_2d<f32>;
175
+ @group(0) @binding(5) var residueSamp : sampler;
176
+
177
+ // plinths: 3 vec4 each — session presence (FIELD-SPEC §15)
178
+ // 0: x, y, extentX, extentY
179
+ // 1: presence, articulation, parentIndex + 1 (0 = none), empty flag
180
+ // 2: shoulder, nested flag, unused, unused
181
+ @group(0) @binding(6) var<storage, read> plinthData : array<vec4f>;
182
+
183
+ const MAX_PLINTHS : u32 = 16u;
184
+
185
+ const RES_X0 : f32 = 0.0;
186
+ const RES_Y0 : f32 = 0.0;
187
+ const RES_X1 : f32 = 1160.0;
188
+ const RES_Y1 : f32 = 812.0;
189
+
190
+ fn residueAt(world: vec2f) -> vec2f {
191
+ let uv = vec2f(
192
+ (world.x - RES_X0) / (RES_X1 - RES_X0),
193
+ (world.y - RES_Y0) / (RES_Y1 - RES_Y0)
194
+ );
195
+ if (uv.x < 0.0 || uv.x > 1.0 || uv.y < 0.0 || uv.y > 1.0) { return vec2f(0.0); }
196
+ return textureSampleLevel(residueTex, residueSamp, uv, 0.0).rg;
197
+ }
198
+
199
+ /** FIELD-SPEC §7 — the sheet sags toward mass. */
200
+ fn shiftAt(world: vec2f, t: f32) -> f32 {
201
+ var dy = 0.0;
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 n = (world - pos) / ext;
207
+ let g = exp(-dot(n, n) * 0.85);
208
+ dy = dy + massShape(i).z * n.y * g * 1.6;
209
+ }
210
+
211
+ // Coupling flattens the sheet between two machines (FIELD-SPEC §8).
212
+ let cn = u32(P.counts.z);
213
+ let res = residueAt(world);
214
+ for (var i = 0u; i < cn; i = i + 1u) {
215
+ let c = coupData[i];
216
+ let a = massPos(u32(c.x));
217
+ let b = massPos(u32(c.y));
218
+ let v = b - a;
219
+ let l2 = dot(v, v);
220
+ if (l2 < 1.0) { continue; }
221
+ let u = dot(world - a, v) / l2;
222
+ if (u < -0.05 || u > 1.05) { continue; }
223
+ let proj = a + v * u;
224
+ let off = (world.y - proj.y) / 62.0;
225
+ let env = exp(-off * off) * exp(-quad((u - 0.5) / 0.55));
226
+ dy = dy - off * 62.0 * 0.42 * env * (0.7 + 0.3 * sin(t * 2.4 - u * 6.0)) * c.z;
227
+ dy = dy - off * 10.0 * env * res.g;
228
+ }
229
+ return dy;
230
+ }
231
+
232
+ /** FIELD-SPEC §6 — the height field. */
233
+ fn heightAt(world: vec2f, t: f32) -> f32 {
234
+ let x = world.x;
235
+ let y = world.y;
236
+
237
+ // Base medium.
238
+ var v = 3.1 * sin(x * 0.021 + y * 0.013) * sin(y * 0.017 - x * 0.008)
239
+ + 1.7 * sin(x * 0.045 - y * 0.031)
240
+ + 1.1 * sin(y * 0.062 + x * 0.017);
241
+
242
+ // Mass: a lobed well with a raised rim. Permanent.
243
+ let mn = u32(P.counts.x);
244
+ for (var i = 0u; i < mn; i = i + 1u) {
245
+ let pos = massPos(i);
246
+ let ext = massExtent(i);
247
+ let shape = massShape(i);
248
+ let ph = massPhase(i);
249
+ let n = (world - pos) / ext;
250
+ let r = length(n);
251
+ let th = atan2(n.y, n.x);
252
+ let lobe = shape.w;
253
+ let wob = 1.0 + lobe * sin(3.0 * th + ph) * 0.5 + lobe * 0.3 * sin(5.0 * th - ph);
254
+ let rr = r / max(0.35, wob);
255
+ v = v - shape.x * exp(-rr * rr * 1.05);
256
+ v = v + shape.y * exp(-sq((rr - 1.02) / 0.42));
257
+ }
258
+
259
+ // Activity: temporary, local, independent. Anisotropic — wider than tall.
260
+ //
261
+ // Articulation (FIELD-SPEC §16) is spent on definition only: it damps the ripple terms, softens
262
+ // and widens the collar so the rim stops closing, and — when co-observing sources disagree on
263
+ // extent — raises a faint doubled shoulder inside the object's own trough. The bulge amplitude
264
+ // itself is NEVER scaled by articulation: unknown stays heavy.
265
+ let dn = u32(P.counts.y);
266
+ for (var i = 0u; i < dn; i = i + 1u) {
267
+ let a = distData[i * 3u];
268
+ let b = distData[i * 3u + 1u];
269
+ let c = distData[i * 3u + 2u];
270
+ let amp = a.w;
271
+ if (amp <= 0.01) { continue; }
272
+ let radius = a.z;
273
+ let travel = c.z;
274
+ let phase = b.y;
275
+ let artic = c.x;
276
+ let rip = 0.15 + 0.85 * artic;
277
+ let d = length(vec2f(x - a.x, (y - a.y) * 1.5));
278
+ if (d > radius * 4.0) { continue; }
279
+ let e = exp(-sq(d / radius));
280
+ v = v + amp * e * (0.78 + 0.22 * sin(travel + phase) * rip);
281
+ v = v - amp * 0.34 * (0.25 + 0.75 * artic)
282
+ * exp(-sq((d - radius * 1.5) / (radius * 0.62 * (1.0 + (1.0 - artic) * 1.4))));
283
+ v = v + amp * 0.16 * rip * exp(-d / (radius * 2.1)) * sin(d * 0.13 - travel * 2.6 + phase);
284
+ if (c.y > 0.02) {
285
+ v = v + amp * 0.11 * exp(-sq((d - radius * (0.72 + c.y)) / (radius * 0.3)));
286
+ }
287
+ }
288
+
289
+ // SESSION PRESENCE (FIELD-SPEC §15): a flat-topped plinth per live session raises grouped
290
+ // executions onto one platform, so an existing contour closes around the set. A spawned child
291
+ // is a plinth growing out of the parent plinth. An empty-but-known session keeps only its rim.
292
+ let pn = min(u32(P.grid.w), MAX_PLINTHS);
293
+ var lv : array<f32, MAX_PLINTHS>;
294
+ for (var i = 0u; i < pn; i = i + 1u) {
295
+ let pa = plinthData[i * 3u];
296
+ let pb = plinthData[i * 3u + 1u];
297
+ let pc = plinthData[i * 3u + 2u];
298
+ let n = (world - pa.xy) / pa.zw;
299
+ let r2 = dot(n, n);
300
+ let presence = pb.x;
301
+ let plateau = 1.0 / (1.0 + pow(max(r2, 1e-5), 2.6));
302
+ lv[i] = plateau * presence;
303
+ if (pb.w > 0.5) {
304
+ // Presence without content: the rim of a session nothing ever ran in.
305
+ v = v + 4.5 * presence * exp(-sq((sqrt(r2) - 1.0) / 0.3));
306
+ } else {
307
+ let plinth = select(17.0, 13.0, pc.y > 0.5) * presence;
308
+ v = v + plinth * plateau;
309
+ if (pc.x > 0.02) {
310
+ // Co-observation shoulder: sources agree on the computation, not exactly on its extent.
311
+ // A concentric bench inside the plateau edge — never a separate closed rim.
312
+ v = v + plinth * 0.3 * pc.x * exp(-sq((sqrt(r2) - 0.78) / 0.13));
313
+ }
314
+ }
315
+ }
316
+
317
+ // THE KEEL: where two unrelated plateaus overlap, the ground between them drops — the same
318
+ // trough vocabulary already used around bulges, so contours cannot bridge it and proximity alone
319
+ // can never close a line. Parent and spawned child are exempt and still share a wall. Shallow by
320
+ // design: it must never read as a machine-level rift.
321
+ for (var i = 0u; i < pn; i = i + 1u) {
322
+ for (var j = i + 1u; j < pn; j = j + 1u) {
323
+ if (lv[i] < 0.02 || lv[j] < 0.02) { continue; }
324
+ let pi = u32(plinthData[i * 3u + 1u].z);
325
+ let pj = u32(plinthData[j * 3u + 1u].z);
326
+ if (pi == j + 1u || pj == i + 1u) { continue; }
327
+ let lo = min(lv[i], lv[j]);
328
+ let o = lo / max(lv[i], lv[j]);
329
+ v = v - 30.0 * o * sqrt(o) * lo;
330
+ }
331
+ }
332
+
333
+ // Residue: what the field remembers. One texture read, not a walk through history.
334
+ if (P.layer2.w > 0.5) {
335
+ let res = residueAt(world);
336
+ v = v + 62.0 * 0.15 * res.r;
337
+ }
338
+
339
+ // Coupling ridge.
340
+ let cn = u32(P.counts.z);
341
+ let resC = residueAt(world);
342
+ for (var i = 0u; i < cn; i = i + 1u) {
343
+ let c = coupData[i];
344
+ let a = massPos(u32(c.x));
345
+ let b = massPos(u32(c.y));
346
+ let vv = b - a;
347
+ let l2 = dot(vv, vv);
348
+ if (l2 < 1.0) { continue; }
349
+ let u = dot(world - a, vv) / l2;
350
+ if (u < -0.05 || u > 1.05) { continue; }
351
+ let proj = a + vv * u;
352
+ let p = length(world - proj) / 44.0;
353
+ let envc = exp(-p * p) * exp(-quad((u - 0.5) / 0.56));
354
+ v = v + 34.0 * envc * (0.5 + 0.5 * sin(u * 13.0 - t * 4.6)) * c.z;
355
+ v = v - 14.0 * exp(-sq(abs(p) - 1.5)) * envc * c.z;
356
+ v = v + 9.0 * resC.g * exp(-p * p * 1.4) * exp(-quad((u - 0.5) / 0.5));
357
+ }
358
+
359
+ return v;
360
+ }
361
+
362
+ /**
363
+ * Local articulation (FIELD-SPEC §16): the sheet resolves coarser near unresolved objects, so line
364
+ * cadence carries the meaning. Weighted blend over disturbances and plinths, with a prior toward 1
365
+ * so the empty medium — and everything far from an observed object — keeps its full cadence.
366
+ */
367
+ fn articAt(world: vec2f) -> f32 {
368
+ var num = 0.0;
369
+ var den = 0.35;
370
+ let dn = u32(P.counts.y);
371
+ for (var i = 0u; i < dn; i = i + 1u) {
372
+ let a = distData[i * 3u];
373
+ let b = distData[i * 3u + 1u];
374
+ if (b.w <= 0.001) { continue; }
375
+ let dx = (world.x - a.x) / (a.z * 2.0);
376
+ let dy = (world.y - a.y) * 1.5 / (a.z * 2.0);
377
+ let w = exp(-(dx * dx + dy * dy)) * b.w;
378
+ num = num + w * distData[i * 3u + 2u].x;
379
+ den = den + w;
380
+ }
381
+ let pn = min(u32(P.grid.w), MAX_PLINTHS);
382
+ for (var i = 0u; i < pn; i = i + 1u) {
383
+ let pa = plinthData[i * 3u];
384
+ let pb = plinthData[i * 3u + 1u];
385
+ if (pb.x <= 0.01) { continue; }
386
+ let dx = (world.x - pa.x) / (pa.z * 1.3);
387
+ let dy = (world.y - pa.y) / (pa.w * 1.3);
388
+ let w = exp(-(dx * dx + dy * dy)) * pb.x * 0.8;
389
+ num = num + w * pb.y;
390
+ den = den + w;
391
+ }
392
+ return clamp((num + 0.35) / den, 0.1, 1.0);
393
+ }
394
+
395
+ @fragment
396
+ fn fs_main(@location(0) uv: vec2f) -> @location(0) vec4f {
397
+ let world = vec2f(
398
+ mix(P.fieldRect.x, P.fieldRect.z, uv.x),
399
+ mix(P.fieldRect.y, P.fieldRect.w, uv.y)
400
+ );
401
+ let t = P.view.w;
402
+ return vec4f(heightAt(world, t), shiftAt(world, t), articAt(world), 1.0);
403
+ }
404
+ `,AA=`@group(0) @binding(4) var fieldTex : texture_2d<f32>;
405
+ @group(0) @binding(5) var fieldSamp : sampler;
406
+
407
+ struct VOut {
408
+ @builtin(position) pos : vec4f,
409
+ @location(0) color : vec4f,
410
+ };
411
+
412
+ fn fieldSample(world: vec2f) -> vec3f {
413
+ let uv = vec2f(
414
+ (world.x - P.fieldRect.x) / (P.fieldRect.z - P.fieldRect.x),
415
+ (world.y - P.fieldRect.y) / (P.fieldRect.w - P.fieldRect.y)
416
+ );
417
+ // r: height, g: shift, b: local articulation.
418
+ return textureSampleLevel(fieldTex, fieldSamp, clamp(uv, vec2f(0.0), vec2f(1.0)), 0.0).rgb;
419
+ }
420
+
421
+ /** FIELD-SPEC §10 — line colour is the base ink pulled toward nearby mass tints. */
422
+ fn tintMix(world: vec2f) -> vec3f {
423
+ var acc = vec3f(226.0, 223.0, 215.0);
424
+ var w = 1.0;
425
+ let mn = u32(P.counts.x);
426
+ for (var i = 0u; i < mn; i = i + 1u) {
427
+ let pos = massPos(i);
428
+ let ext = massExtent(i) * 1.5;
429
+ let n = (world - pos) / ext;
430
+ let k = exp(-dot(n, n)) * 0.85;
431
+ acc = acc + massTint(i) * k;
432
+ w = w + k;
433
+ }
434
+ return acc / w / 255.0;
435
+ }
436
+
437
+ /** Screen-space y of the sheet at world x on the given row baseline. */
438
+ fn rowPoint(x: f32, by: f32, dzW: f32, ampF: f32) -> f32 {
439
+ let wy = by + dzW;
440
+ let sh = fieldSample(vec2f(x, wy)).g;
441
+ let yy = wy + sh * ampF;
442
+ let hv = fieldSample(vec2f(x, yy)).r * ampF;
443
+ let worldY = by - hv + sh * 0.55 * ampF;
444
+ return (worldY - P.rect.y) * P.view.z;
445
+ }
446
+ `,MA=`@vertex
447
+ fn vs_main(@builtin(vertex_index) vi: u32, @builtin(instance_index) ii: u32) -> VOut {
448
+ let cols = u32(P.grid.x);
449
+ let isLine = ii & 1u;
450
+ let seg = ii >> 1u;
451
+ let row = seg / cols;
452
+ let col = seg % cols;
453
+
454
+ let k = P.view.z;
455
+ let stepW = P.layer.y / k;
456
+ let rowsW = P.layer.x / k;
457
+ let dzW = P.layer2.y / k;
458
+ // FIELD-SPEC §10 — amplitude compensation when zoomed in.
459
+ let ampF = P.layer.z * select(1.0, 1.6 / k, k > 1.0);
460
+
461
+ let x0 = P.rect.x - stepW * 2.0 + f32(col) * stepW;
462
+ let x1 = x0 + stepW;
463
+ let by = P.rect.y - rowsW * 0.6 + f32(row) * rowsW;
464
+
465
+ let sy0 = rowPoint(x0, by, dzW, ampF);
466
+ let sy1 = rowPoint(x1, by, dzW, ampF);
467
+ let sx0 = (x0 - P.rect.x) * k + P.layer2.z;
468
+ let sx1 = (x1 - P.rect.x) * k + P.layer2.z;
469
+
470
+ var p = vec2f(0.0);
471
+ var color = vec4f(0.0);
472
+
473
+ if (isLine == 0u) {
474
+ // Fill: from this segment down over the farther rows it occludes.
475
+ //
476
+ // ── Why the fill stops where it does ──────────────────────────────────────────────────────
477
+ // The approved material ran every fill to the bottom of the viewport. Composited far to near
478
+ // that is exactly the hidden-line algorithm, but it also means a pixel is written once per row
479
+ // above it: at the 9 px near-row spacing on a 914 px tall viewport, about 107 blended
480
+ // fragments per pixel across the three layers (measured; see the performance investigation),
481
+ // and that overdraw grows with width × height² × dpr². It was three quarters of the frame's
482
+ // GPU time on an M4 and dwarfs everything else the field draws.
483
+ //
484
+ // Below the next 'reach' rows' lines a fill can no longer be seen: the fills of those rows
485
+ // land on top of it, each at this layer's fill alpha, so whatever it contributed is scaled by
486
+ // (1 - alpha)^reach — below one 8-bit step for the reach chosen per layer in FILL_REACH. So
487
+ // the fill stops at the LOWEST of the next 'reach' rows' lines at each end of the segment, and
488
+ // the rows between it and there keep exactly the occlusion and haze they had. The bottom edge
489
+ // is straight between the two ends, which bounds the straight segments of those rows.
490
+ //
491
+ // Reach 0 restores the original geometry, and the last 'reach' rows keep it, so the sheet's
492
+ // edge against the strata band is untouched.
493
+ var bottom = P.view.y + 60.0;
494
+ let reach = u32(P.sheet.x);
495
+ let rows = u32(P.grid.y);
496
+ let isBottom = (vi == 2u) || (vi == 4u) || (vi == 5u);
497
+ if (isBottom && reach > 0u && row + reach < rows) {
498
+ let xb = select(x0, x1, vi != 5u);
499
+ var b = select(sy0, sy1, vi != 5u);
500
+ for (var j = 1u; j <= reach; j = j + 1u) {
501
+ b = max(b, rowPoint(xb, by + f32(j) * rowsW, dzW, ampF));
502
+ }
503
+ // Half a pixel of slack over the nearer rows' own vertex arithmetic.
504
+ bottom = b + 0.5;
505
+ }
506
+ switch (vi) {
507
+ case 0u: { p = vec2f(sx0, sy0); }
508
+ case 1u: { p = vec2f(sx1, sy1); }
509
+ case 2u: { p = vec2f(sx1, bottom); }
510
+ case 3u: { p = vec2f(sx0, sy0); }
511
+ case 4u: { p = vec2f(sx1, bottom); }
512
+ default: { p = vec2f(sx0, bottom); }
513
+ }
514
+ color = P.fill;
515
+ } else {
516
+ // Line: a quad along the segment, width and alpha from local slope (FIELD-SPEC §10).
517
+ let slope = min(1.0, abs(sy1 - sy0) / max(0.001, P.layer.y));
518
+ // Keep the authored emphasis levels, but cross their boundaries continuously. A moving
519
+ // contour must not flash brighter/thicker in one frame just because its slope crossed a bin.
520
+ let low = smoothstep(0.08, 0.14, slope);
521
+ let mid = smoothstep(0.25, 0.35, slope);
522
+ let high = smoothstep(0.54, 0.70, slope);
523
+ var bucketA = 0.17;
524
+ bucketA += 0.15 * low + 0.28 * mid + 0.38 * high;
525
+ let bucketW = 0.75 + 0.25 * low + 0.35 * mid + 0.45 * high;
526
+
527
+ // OBSERVATION RESOLUTION (FIELD-SPEC §16): near an unresolved object the sheet's own line
528
+ // cadence loosens — segments dash out, thin and dim. Never the height: mass stays, definition
529
+ // varies. The blend prior keeps the empty medium at full cadence, so a fully resolved field
530
+ // renders exactly as it did before articulation existed.
531
+ let art = fieldSample(vec2f((x0 + x1) * 0.5, by)).b;
532
+ if (art <= 0.85) {
533
+ let dash = (1.0 - art) * 9.0 + 1.5;
534
+ // World-anchored phase (scaled to screen), so the cadence sits still under panning.
535
+ let phase = fract(x0 * k * 0.7 / (dash * 2.2)) * dash * 2.2;
536
+ if (phase > dash * 1.15) {
537
+ var cut: VOut;
538
+ cut.pos = vec4f(-10.0, -10.0, 0.0, 1.0);
539
+ cut.color = vec4f(0.0);
540
+ return cut;
541
+ }
542
+ }
543
+ let artA = 0.34 + 0.66 * art;
544
+ let artW = 0.7 + 0.3 * art;
545
+
546
+ let width = max(0.6, bucketW * artW * min(2.1, k) * P.layer2.x);
547
+ let dir = normalize(vec2f(sx1 - sx0, sy1 - sy0) + vec2f(0.0001, 0.0));
548
+ let nrm = vec2f(-dir.y, dir.x) * (width * 0.5);
549
+
550
+ switch (vi) {
551
+ case 0u: { p = vec2f(sx0, sy0) - nrm; }
552
+ case 1u: { p = vec2f(sx1, sy1) - nrm; }
553
+ case 2u: { p = vec2f(sx1, sy1) + nrm; }
554
+ case 3u: { p = vec2f(sx0, sy0) - nrm; }
555
+ case 4u: { p = vec2f(sx1, sy1) + nrm; }
556
+ default: { p = vec2f(sx0, sy0) + nrm; }
557
+ }
558
+ let rgb = tintMix(vec2f((x0 + x1) * 0.5, by));
559
+ color = vec4f(rgb, bucketA * artA * P.layer.w);
560
+ }
561
+
562
+ var out: VOut;
563
+ 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);
564
+ out.color = color;
565
+ return out;
566
+ }
567
+
568
+ @fragment
569
+ fn fs_main(in: VOut) -> @location(0) vec4f {
570
+ return vec4f(in.color.rgb * in.color.a, in.color.a);
571
+ }
572
+ `,RA=`struct VOut {
573
+ @builtin(position) pos : vec4f,
574
+ @location(0) local : vec2f,
575
+ @location(1) color : vec3f,
576
+ @location(2) weight : f32,
577
+ };
578
+
579
+ fn statusColor(idx: f32) -> vec3f {
580
+ if (idx < 0.5) { return vec3f(240.0, 195.0, 116.0) / 255.0; } // running
581
+ if (idx < 1.5) { return vec3f(150.0, 175.0, 196.0) / 255.0; } // waiting
582
+ if (idx < 2.5) { return vec3f(206.0, 104.0, 90.0) / 255.0; } // failed
583
+ if (idx < 3.5) { return vec3f(180.0, 210.0, 175.0) / 255.0; } // completed
584
+ return vec3f(230.0, 227.0, 219.0) / 255.0; // idle
585
+ }
586
+
587
+ fn statusPulse(idx: f32, t: f32, travel: f32, phase: f32) -> f32 {
588
+ if (idx < 0.5) { return 0.55 + 0.35 * sin(travel * 2.0 + phase); }
589
+ if (idx < 1.5) { return 0.40 + 0.08 * sin(t * 0.6); }
590
+ if (idx < 2.5) { return 0.50 + 0.50 * sin(t * 30.0); }
591
+ if (idx < 3.5) { return 0.35; }
592
+ return 0.15;
593
+ }
594
+
595
+ @vertex
596
+ fn vs_main(@builtin(vertex_index) vi: u32, @builtin(instance_index) ii: u32) -> VOut {
597
+ let a = distData[ii * 3u];
598
+ let b = distData[ii * 3u + 1u];
599
+ let k = P.view.z;
600
+ let t = P.view.w;
601
+
602
+ let statusIdx = b.z;
603
+ let failed = select(1.0, 1.3, statusIdx > 1.5 && statusIdx < 2.5);
604
+ let radius = max(2.4, 3.4 * k) * failed * 3.2;
605
+
606
+ let centre = vec2f((a.x - P.rect.x) * k, (a.y - P.rect.y) * k);
607
+ let corner = vec2f(
608
+ select(-1.0, 1.0, (vi == 1u) || (vi == 2u) || (vi == 4u)),
609
+ select(-1.0, 1.0, (vi == 2u) || (vi == 4u) || (vi == 5u))
610
+ );
611
+ let p = centre + corner * radius;
612
+
613
+ var out: VOut;
614
+ 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);
615
+ out.local = corner;
616
+ out.color = statusColor(statusIdx);
617
+ // Articulation dims the core's confidence, never the field's mass (FIELD-SPEC §16).
618
+ let artic = distData[ii * 3u + 2u].x;
619
+ out.weight = statusPulse(statusIdx, t, distData[ii * 3u + 2u].z, b.y) * 0.9 * clamp(b.w, 0.0, 1.0)
620
+ * (0.22 + 0.78 * artic);
621
+ return out;
622
+ }
623
+
624
+ @fragment
625
+ fn fs_main(in: VOut) -> @location(0) vec4f {
626
+ let d = length(in.local);
627
+ if (d > 1.0) { discard; }
628
+ // Radial falloff matching the design's gradient stops.
629
+ let a = (1.0 - d) * (1.0 - d) * in.weight;
630
+ return vec4f(in.color * a, a);
631
+ }
632
+ `,DA=`// per stratum: startFraction, endFraction, lane, statusIndex
633
+ @group(0) @binding(4) var<storage, read> strataData : array<vec4f>;
634
+
635
+ struct VOut {
636
+ @builtin(position) pos : vec4f,
637
+ @location(0) t : f32,
638
+ @location(1) color : vec3f,
639
+ @location(2) alpha : f32,
640
+ };
641
+
642
+ const STRATA_TOP : f32 = 812.0;
643
+ const STRATA_H : f32 = 360.0;
644
+ const SPAN_X : f32 = 1160.0;
645
+ const MIN_W : f32 = 3.0;
646
+
647
+ @vertex
648
+ fn vs_main(@builtin(vertex_index) vi: u32, @builtin(instance_index) ii: u32) -> VOut {
649
+ let s = strataData[ii];
650
+ let laneCount = max(1.0, P.grid.z);
651
+ let laneH = STRATA_H / laneCount;
652
+ let top = STRATA_TOP + s.z * laneH;
653
+
654
+ let wx0 = s.x * SPAN_X;
655
+ let wx1 = max(wx0 + MIN_W, s.y * SPAN_X);
656
+ let k = P.view.z;
657
+
658
+ let sx0 = (wx0 - P.rect.x) * k;
659
+ let sx1 = (wx1 - P.rect.x) * k;
660
+ let sy0 = (top - P.rect.y) * k;
661
+ let sy1 = (top + laneH - P.rect.y) * k;
662
+
663
+ let right = (vi == 1u) || (vi == 2u) || (vi == 4u);
664
+ let lower = (vi == 2u) || (vi == 4u) || (vi == 5u);
665
+ let p = vec2f(select(sx0, sx1, right), select(sy0, sy1, lower));
666
+
667
+ // Failed runs read red; otherwise the lane's machine tint.
668
+ var col = massTint(u32(s.z)) / 255.0;
669
+ if (s.w > 1.5 && s.w < 2.5) { col = vec3f(206.0, 104.0, 90.0) / 255.0; }
670
+
671
+ var out: VOut;
672
+ 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);
673
+ out.t = select(0.0, 1.0, right);
674
+ out.color = col;
675
+ out.alpha = 0.30;
676
+ return out;
677
+ }
678
+
679
+ @fragment
680
+ fn fs_main(in: VOut) -> @location(0) vec4f {
681
+ // Left-to-right gradient to transparent, as in the approved design.
682
+ let a = in.alpha * (1.0 - in.t);
683
+ return vec4f(in.color * a, a);
684
+ }
685
+ `,CA=wA,Il=8,v0=64,b0=8,x0=16,OA={x0:0,y0:0,x1:1160,y1:812},S0=256;function po(n){return`
686
+
687
+ `+sv+`
688
+
689
+ `+n}function zA(n){return`
690
+
691
+ `+sv+`
692
+
693
+ `+AA+n}const _A=po(EA),UA=po(TA),w0=zA(MA),NA=po(RA),kA=po(DA),rv=.34,lv=3.4,E0={zoom:1,cx:580,cy:406},LA=-260,jA=1420,BA=-260,GA=1300,$A=.58,IA=.72,mf=1.7,VA=1.45;function FA(n,i){return n==="strata"?i>IA?"environment":"strata":n==="proximity"?i<VA?"environment":"proximity":i<$A?"strata":i>mf?"proximity":"environment"}function HA(n){return n.width/En.spanX}function An(n,i){return HA(i)*n.zoom}function yr(n){return n.zoom=Math.max(rv,Math.min(lv,n.zoom)),n.cx=Math.max(LA,Math.min(jA,n.cx)),n.cy=Math.max(BA,Math.min(GA,n.cy)),n}function qA(n,i,s){const r=An(n,i),o=i.width/r,c=i.height/r;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 gf(n,i,s,r){const o=An(s,r),c=r.width/o,d=r.height/o;return[s.cx-c/2+n/o,s.cy-d/2+i/o]}function Vc(n,i,s,r){const o=An(s,r),c=r.width/o,d=r.height/o;return[(n-(s.cx-c/2))*o,(i-(s.cy-d/2))*o]}function Fc(n,i,s,r,o){const[c,d]=gf(s,r,n,o);n.zoom=Math.max(rv,Math.min(lv,n.zoom*i));const h=An(n,o);n.cx=c-s/h+o.width/h/2,n.cy=d-r/h+o.height/h/2,yr(n)}function T0(n,i,s,r){const o=An(n,r);n.cx+=i/o,n.cy+=s/o,yr(n)}function YA(n,i,s,r=7){const o=1-Math.exp(-r*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 XA(n,i,s){return yr({zoom:s,cx:n,cy:i})}const Vl=120,KA="field",PA=5,QA=2,A0=30;class ZA{intervalMs=new Float32Array(Vl);cpuMs=new Float32Array(Vl);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,r){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)%Vl,this.filled<Vl&&this.filled++,this.lastIntervalMs=c}this.lastFrameAt=i,this.lastCpuMs=s,this.frames++,this.disturbances=r,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<A0?0:this.bakeSum/this.bakeSamples}maybeAdapt(i){if(i-this.lastEvalAt<2e3||this.filled<45)return;const s=this.bakeCost();this.bakeSamples<A0||(this.lastEvalAt=i,this.bakeSum=0,this.bakeSamples=0,!(s<=0)&&(s>PA&&this.resolutionScale>.5?(this.resolutionScale=Math.max(.5,this.resolutionScale-.15),this.pendingResize=!0):s<QA&&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 Zn=[{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]}],M0={running:0,waiting:1,failed:2,completed:3,idle:4},R0={laptop:[214,176,116],desktop:[168,186,150],server:[150,190,175]},D0=512;function Hc(n,i){return i.time>i.wall+2e3?0:(n-Math.max(i.time,i.wall))/1e3}const WA=[3,2,2],C0=0,qc=1,ta=2,O0=1,z0=1,JA=4,eM=1600,_0=.004;function tM(n){return n.msSinceInteraction<eM?O0:n.couplings>0||n.maxEnergy>_0?z0:n.maxSettling>_0?JA:n.dirty?O0:1/0}class nM{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(Il*16);distArr=new Float32Array(v0*3*4);coupArr=new Float32Array(b0*4);strataArr=new Float32Array(D0*4);plinthArr=new Float32Array(x0*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;materialTime=0;materialDt=0;pendingMaterialDt=0;massResponseUntil=0;projectionAnchor=null;massTokens=new Uint32Array(Il);massIDs=[];responseBuf;responseCompute;reducedMotion=!1;setReducedMotion(i){this.reducedMotion!==i&&(this.dirty=!0),this.reducedMotion=i}lastInteractionAt=0;disposed=!1;landscapeDirty=!0;perf=new ZA;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 y0({requiredFeatures:["timestamp-query"]})}catch{return await y0()}}),!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=vA(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=d0(this.gpu,{size:[this.headless.width,this.headless.height],format:"rgba8unorm"});else{const c=this.canvas;await iM(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=oA(this.gpu,S0,S0,{format:"rgba16float"});const[i,s]=this.fieldSize();this.fieldTarget=d0(this.gpu,{size:[i,s],format:"rgba16float"}),this.paramsBufs=Array.from({length:5},()=>ea(this.gpu,this.params.byteLength,"read")),this.massBuf=ea(this.gpu,this.massArr.byteLength,"read"),this.responseBuf=ea(this.gpu,Il*16,"read-write"),this.responseCompute=IT(this.gpu,CA,{set:{P:this.paramsBufs[qc],massData:this.massBuf,response:this.responseBuf}}),this.distBuf=ea(this.gpu,this.distArr.byteLength,"read"),this.coupBuf=ea(this.gpu,this.coupArr.byteLength,"read"),this.strataBuf=ea(this.gpu,this.strataArr.byteLength,"read"),this.plinthBuf=ea(this.gpu,this.plinthArr.byteLength,"read");const r=nT(this.gpu,{minFilter:"linear",magFilter:"linear"});this.linearSampler=r,this.residueFx=f0(this.gpu,_A,{set:{P:this.paramsBufs[C0],massData:this.massBuf,distData:this.distBuf,coupData:this.coupBuf,prevTex:this.residue.read,prevSamp:r}}),this.fieldFx=f0(this.gpu,UA,{set:{P:this.paramsBufs[qc],massData:this.massBuf,distData:this.distBuf,coupData:this.coupBuf,residueTex:this.residue.read,residueSamp:r,plinthData:this.plinthBuf,massResponse:this.responseBuf}}),this.sheetDraw=Gl(this.gpu,{shader:w0,vertices:6,blend:"premultiplied",set:{P:this.paramsBufs[ta],massData:this.massBuf,fieldTex:this.fieldTarget,fieldSamp:r}}),this.coresDraw=Gl(this.gpu,{shader:NA,vertices:6,blend:"additive",set:{P:this.paramsBufs[ta],distData:this.distBuf}}),this.strataDraw=Gl(this.gpu,{shader:kA,vertices:6,blend:"premultiplied",set:{P:this.paramsBufs[ta],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,r=i.clientWidth||s?.clientWidth||1280,o=i.clientHeight||s?.clientHeight||720;return[Math.max(1,r),Math.max(1,o)]}fieldSize(){const i=this.perf.resolutionScale,s=this.headless?.width??this.canvas?.clientWidth??640,r=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,r)*i));return[o,c]}attachProbe(i){this.probe=i}setLandscape(i,s){const r=this.probe?performance.now():0;if((!this.projectionAnchor||i.time>this.projectionAnchor.time)&&(this.projectionAnchor={time:i.time,at:this.materialTime+this.pendingMaterialDt+(this.running?Math.max(0,performance.now()-this.lastFrameAt)/1e3:0),wall:s??(this.headless?i.time:Date.now())}),this.projectionAnchor)for(const c of i.masses)c.prominence>.04&&c.activityValidUntil!==void 0&&(this.massResponseUntil=Math.max(this.massResponseUntil,this.projectionAnchor.at+Hc(c.activityValidUntil,this.projectionAnchor)+8));this.landscape=i,this.landscapeDirty=!0,this.generation++,this.probe&&(this.probe.landscapes++,queueMicrotask(()=>this.probe?.landscapeMs.push(performance.now()-r)));const o=this.generation;for(const c of i.disturbances){let d=this.runtime.get(c.id);const h=.9+c.rate*1.15;d||(d={energy:0,target:c.energy,frequency:h,travel:this.simTime*h%(10*Math.PI),status:c.status,statusSince:c.statusSince,seen:o,extent:c.extent,toExtent:c.extent},this.runtime.set(c.id,d)),d.target=c.energy,d.frequency=h,d.status=c.status,d.statusSince=c.statusSince,d.seen=o,d.toExtent=c.extent}for(const[c,d]of this.runtime)d.seen!==o&&(d.target=0,d.energy<.002&&this.runtime.delete(c));for(const c of i.plinths){let d=this.plinthRuntime.get(c.id);d||(d={presence:0,target:c.presence,x:c.x,y:c.y,extentX:c.extentX,extentY:c.extentY,toX:c.x,toY:c.y,toExtentX:c.extentX,toExtentY:c.extentY,seen:o},this.plinthRuntime.set(c.id,d)),d.target=c.presence,d.toX=c.x,d.toY=c.y,d.toExtentX=c.extentX,d.toExtentY=c.extentY,d.seen=o,this.plinthStatics.set(c.id,c)}for(const[c,d]of this.plinthRuntime)d.seen!==o&&(d.target=0,d.presence<.002&&(this.plinthRuntime.delete(c),this.plinthStatics.delete(c)))}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 r=this.currentStride(s);if(this.probe?.noteRefresh(s,r),r===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+r;const o=s-this.lastFrameAt;this.lastFrameAt=s,this.lastStride=r;const c=this.probe?.debug.fixedDt??null,d=c!==null?c:Math.min(.1,o/1e3);this.renderFrame(d,o/1e3)};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,r=0;for(const d of this.runtime.values()){d.energy>s&&(s=d.energy);const h=Math.abs(d.target-d.energy);h>r&&(r=h);const m=Math.abs(d.toExtent-d.extent);m>r&&(r=m)}for(const d of this.plinthRuntime.values()){const h=Math.abs(d.target-d.presence);h>r&&(r=h)}const o=this.projectionAnchor,c=this.materialTime+Math.max(0,i-this.lastFrameAt)/1e3;if(this.materialTime<this.massResponseUntil&&(r=Math.max(r,1)),o)for(const d of this.landscape.masses){if(d.activityValidUntil===void 0)continue;const h=o.at+Hc(d.activityValidUntil,o);d.prominence>.08&&c<h&&!this.reducedMotion&&(s=Math.max(s,d.prominence))}return tM({dirty:this.dirty||this.landscapeDirty,msSinceInteraction:i-this.lastInteractionAt,couplings:this.couplingCount,maxEnergy:s,maxSettling:r})}stepPhysics(i){const s=this.simTime;for(const r of this.runtime.values()){let o=r.target;if(r.travel=(r.travel+i*r.frequency)%(10*Math.PI),r.status==="failed"){const d=Math.max(0,s-r.statusSince/1e3);d<1.4?o=r.target*(1+.45*Math.sin(d*44)):o=r.target*Math.max(0,1-(d-1.4)/2.2)*.22}const c=o>r.energy?2.6:1.1;r.energy+=(o-r.energy)*(1-Math.exp(-c*i)),r.energy<5e-4&&o===0&&(r.energy=0),r.extent+=(r.toExtent-r.extent)*(1-Math.exp(-3*i))}for(const r of this.plinthRuntime.values()){const o=r.target>r.presence?1.8:.9;r.presence+=(r.target-r.presence)*(1-Math.exp(-o*i)),r.presence<5e-4&&r.target===0&&(r.presence=0);const c=1-Math.exp(-3*i);r.x+=(r.toX-r.x)*c,r.y+=(r.toY-r.y)*c,r.extentX+=(r.toExtentX-r.extentX)*c,r.extentY+=(r.toExtentY-r.extentY)*c}}packStatics(){const{masses:i,couplings:s,strata:r}=this.landscape;this.massIndex.clear(),this.massArr.fill(0),this.massCount=Math.min(i.length,Il);for(let o=0;o<this.massCount;o++){const c=i[o];this.massIndex.set(c.id,o);const d=o*16;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=R0[c.kind]??R0.laptop;this.massArr[d+9]=m[0],this.massArr[d+10]=m[1],this.massArr[d+11]=m[2],this.massIDs[o]!==c.id&&(this.massIDs[o]=c.id,this.massTokens[o]++),this.massArr[d+12]=Number.isFinite(c.prominence)?Math.min(1,Math.max(0,c.prominence)):0;const g=this.projectionAnchor;this.massArr[d+13]=c.activityValidUntil===void 0||!g?0:g.at+Hc(c.activityValidUntil,g),this.massArr[d+14]=this.massTokens[o],this.massArr[d+15]=c.activityValidUntil===void 0?0:1}this.massIDs.length=this.massCount,this.massBuf.write(this.massArr),this.coupArr.fill(0),this.couplingCount=0;for(const o of s){if(this.couplingCount>=b0)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(r.length,D0);for(let o=0;o<this.strataCount;o++){const c=r[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]=M0[c.status]}this.strataBuf.write(this.strataArr)}packDisturbances(){this.distArr.fill(0);let i=0;for(const s of this.landscape.disturbances){if(i>=v0)break;const r=this.runtime.get(s.id),o=r?r.energy:s.energy;if(o<=5e-4)continue;const c=r?r.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]=M0[s.status],this.distArr[m+7]=o,this.distArr[m+8]=s.articulation,this.distArr[m+9]=s.shoulder,this.distArr[m+10]=r?.travel??0,i++}this.disturbanceCount=i,this.distBuf.write(this.distArr)}packPlinths(){this.plinthArr.fill(0);const i=[];let s=0;for(const[r,o]of this.plinthRuntime){if(s>=x0)break;if(o.presence<=5e-4)continue;const c=this.plinthStatics.get(r);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:r,parentId:c.parentId}),s++}for(let r=0;r<i.length;r++){const o=i[r].parentId,c=o?i.findIndex(d=>d.id===o):-1;this.plinthArr[r*12+6]=c+1,this.plinthArr[r*12+9]=c>=0?1:0}this.plinthCount=s,this.plinthBuf.write(this.plinthArr)}packParams(i,s,r,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=Zn[o]??Zn[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]=r.x0,c[29]=r.y0,c[30]=r.x1,c[31]=r.y1;const m=i>=ta?WA[o]??0:0;c[32]=this.probe?.debug.fillReach??m,c[33]=this.materialTime,c[34]=this.materialDt,c[35]=this.reducedMotion?1:0,this.paramsBufs[i].write(c)}colsFor(i,s){const r=i/s,o=this.rect.x1-this.rect.x0+r*4;return Math.max(2,Math.min(1024,Math.ceil(o/r)))}rowsFor(i,s){const r=i/s,c=Math.min(this.rect.y1,832)+90/s-(this.rect.y0-r*.6);return Math.max(2,Math.min(512,Math.ceil(c/r)))}renderOnce(i){this.renderFrame(Math.min(.1,i),i)}async debugField(){const i=await this.fieldTarget.readFloats();let s=1/0,r=-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>r&&(r=d))}return{min:s,max:r,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,s=i){if(this.disposed)return;const r=performance.now();if(this.pendingMaterialDt+=Number.isFinite(s)?Math.max(0,s):0,this.simTime+=i,yr(this.camera),this.headless){const[_,H]=this.output.size;this.view.width=_,this.view.height=H}else{const _=this.canvas;if(_&&(_.clientWidth===0||_.clientHeight===0)){this.perf.resetPacing(),this.lastDrawnAt=0;return}const[H,Z]=this.cssSize();if(H!==this.view.width||Z!==this.view.height){this.view.width=H,this.view.height=Z;const K=Math.min(this.maxDpr,globalThis.devicePixelRatio||1);this.canvas.width=Math.round(H*K),this.canvas.height=Math.round(Z*K),this.surf?.resize([H,Z]);const[F,Y]=this.fieldSize();this.fieldTarget.resize([F,Y]),this.probe&&(this.probe.canvasResizes++,this.probe.note(`canvas ${H}×${Z} css → ${_?.width}×${_?.height}, field ${F}×${Y}`))}}qA(this.camera,this.view,this.rect),this.materialDt=this.pendingMaterialDt,this.pendingMaterialDt=0,this.materialTime+=this.materialDt,this.stepPhysics(i),this.landscapeDirty&&this.packStatics(),this.landscapeDirty=!1,this.packDisturbances(),this.packPlinths();const o=(this.rect.x1-this.rect.x0)*.12,c=(this.rect.y1-this.rect.y0)*.16,d={x0:this.rect.x0-o,y0:this.rect.y0-c,x1:this.rect.x1+o,y1:this.rect.y1+c},h=An(this.camera,this.view);this.packParams(C0,i,OA,0),this.packParams(qc,i,d,0);for(let _=0;_<Zn.length;_++)this.packParams(ta+_,i,d,_);const m=this.probe?this.probe.debug:null,g=m&&(m.skipFill||m.skipLine)?this.sheetVariantDraw(m):this.sheetDraw,x=this.probe?performance.now():0;let b=0;const R=[];this.responseCompute.dispatch(1),qT(this.gpu,_=>{m?.skipResidue||(this.residueFx.set({prevTex:this.residue.read}),_.pass(this.spans?{target:this.residue.write,clear:!1,timer:this.spans.residue}:{target:this.residue.write,clear:!1},this.residueFx),b++),m?.skipField||(this.fieldFx.set({residueTex:this.residue.write}),_.pass(this.spans?{target:this.fieldTarget,clear:!0,timer:this.spans.field}:{target:this.fieldTarget,clear:!0},this.fieldFx),b++);let H=0;const Z=(F,Y)=>{const A=Zn[Y],k=this.colsFor(A.step,h),w=this.rowsFor(A.rows,h),$=k*w*2;this.probe&&R.push({cols:k,rows:w,instances:$}),!(m&&!m.layers[Y])&&(H+=$,g.set({P:this.paramsBufs[ta+Y]}),F.draw(g,{instances:$}))},K=[.024,.027,.035,1];if(m?.splitLayers&&this.layerSpans.length===Zn.length){for(let F=0;F<Zn.length;F++)_.pass(F===0?{target:this.output,clear:K,timer:this.layerSpans[F]}:{target:this.output,clear:!1,timer:this.layerSpans[F]},Y=>Z(Y,F)),b++;_.pass(this.spans?{target:this.output,clear:!1,timer:this.spans.overlay}:{target:this.output,clear:!1},F=>{this.strataCount>0&&!m?.skipStrata&&F.draw(this.strataDraw,{instances:this.strataCount}),this.disturbanceCount>0&&!m?.skipCores&&F.draw(this.coresDraw,{instances:this.disturbanceCount})}),b++}else _.pass(this.spans?{target:this.output,clear:K,timer:this.spans.sheet}:{target:this.output,clear:K},F=>{for(let Y=0;Y<Zn.length;Y++)Z(F,Y);this.strataCount>0&&!m?.skipStrata&&F.draw(this.strataDraw,{instances:this.strataCount}),this.disturbanceCount>0&&!m?.skipCores&&F.draw(this.coresDraw,{instances:this.disturbanceCount})}),b++;this.lastInstances=H+this.strataCount+this.disturbanceCount}),this.residue.swap(),this.dirty=!1;const B=this.probe?performance.now():0;if(!m?.skipSubscribers)for(const _ of this.frameSubscribers)_(this.view);const O=performance.now(),L=this.lastDrawnAt>0?r-this.lastDrawnAt:0;if(this.lastDrawnAt=r,this.perf.sample(r,O-r,this.disturbanceCount),this.probe&&(this.probe.noteFrame({interval:L,stride:this.lastStride,prep:x-r,encode:B-x,post:O-B,total:O-r}),this.captureScene(b,R)),this.perf.wantsResize()){const[_,H]=this.fieldSize(),[Z,K]=this.fieldTarget.size;(_!==Z||H!==K)&&(this.fieldTarget.resize([_,H]),this.probe&&(this.probe.fieldResizes++,this.probe.note(`field texture ${Z}×${K} → ${_}×${H} (scale ${this.perf.resolutionScale.toFixed(2)})`)))}}sheetVariantDraw(i){const s=`${i.skipFill?"F":""}${i.skipLine?"L":""}`;let r=this.sheetVariants.get(s);return!r&&this.probe&&(r=Gl(this.gpu,{shader:this.probe.sheetVariant(w0,{skipFill:i.skipFill,skipLine:i.skipLine}),vertices:6,blend:"premultiplied",set:{P:this.paramsBufs[ta],massData:this.massBuf,fieldTex:this.fieldTarget,fieldSamp:this.linearSampler}}),this.sheetVariants.set(s,r),this.probe.note(`sheet variant '${s}' compiled`)),r??this.sheetDraw}captureScene(i,s){if(!this.probe)return;const r=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 x=0;x<Zn.length;x++){const R=Zn[x].rows/h,B=this.rect.y0-R*.6,O=s[x]?.rows??0;for(let L=0;L<O;L++){const _=(B+L*R-this.rect.y0)*h;_<o&&(m+=(o-Math.max(0,_))/o)}}let g=0;for(const x of s)g+=x.instances;this.probe.scene={cssW:r,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:g+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 iM(n,i=2e3){return n.clientWidth>0&&n.clientHeight>0?Promise.resolve():new Promise(s=>{let r=!1;const o=()=>{r||(r=!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 X={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)"},st={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)"},Tt="'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, monospace",Ja="0 0 6px rgba(5,6,8,0.95)",aM={backgroundImage:"radial-gradient(rgba(230,227,219,0.05) 0.5px, rgba(0,0,0,0) 0.6px)",backgroundSize:"3px 3px"},sM={background:"radial-gradient(96% 82% at 44% 56%, rgba(0,0,0,0) 42%, rgba(3,3,5,0.9) 100%)"},rM={background:"linear-gradient(to bottom, rgba(6,8,11,0.7), rgba(6,8,11,0))"};let Yc=Promise.resolve();function lM({landscape:n,onHover:i,onSelect:s,anchor:r,children:o,onBand:c,onReady:d,depth:h,overlay:m,inset:g,keepVisible:x,compact:b=!1}){const R=Q.useRef(null),B=Q.useRef(null),O=Q.useRef(null),L=Q.useRef({...E0}),_=Q.useRef(n),H=Q.useRef(new Map),Z=Q.useRef(null),K=Q.useRef(null),F=Q.useRef(null),Y=Q.useRef(null),A=Q.useRef(null),k=Q.useRef(new Map),w=Q.useRef(null),$=Q.useRef({key:"",w:0,h:0,label:!1}),[te,se]=Q.useState("init"),[oe,he]=Q.useState(null),[me,ce]=Q.useState("environment"),[U,P]=Q.useState([]),[ae,xe]=Q.useState("grab");_.current=n,Q.useEffect(()=>{const ee=B.current;if(!ee)return;let W=!1,ye=null;const Oe=window.matchMedia("(prefers-reduced-motion: reduce)"),Pe=()=>ye?.setReducedMotion(Oe.matches);Oe.addEventListener("change",Pe);const Fe=Yc.then(async()=>{if(!W){if(ye=new nM({canvas:ee,camera:L.current}),Pe(),await ye.init(),W){ye.dispose(),ye=null;return}O.current=ye,ye.setLandscape(_.current),ye.start(),se("ready"),d?.(ye)}}).catch(xt=>{W||(he(xt instanceof Error?xt.message:String(xt)),se("failed"))});return Yc=Fe,()=>{W=!0,Oe.removeEventListener("change",Pe),O.current=null,Yc=Fe.then(()=>{ye?.dispose(),ye=null})}},[]),Q.useEffect(()=>{O.current?.setLandscape(n)},[n]),Q.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+(W.activityValidUntil!==void 0&&n.time>=W.activityValidUntil?" · UNOBSERVED":""),color:"rgba(230,227,219,0.78)",size:10});if(me==="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:st[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})}P(ee)},[n,me]),Q.useLayoutEffect(()=>{const ee=O.current;if(!ee)return;let W=0;const ye=Oe=>{const Pe=L.current,Fe=performance.now(),xt=W===0?1/60:Math.min(.1,(Fe-W)/1e3);W=Fe,Y.current&&(YA(Pe,Y.current,xt)&&(Y.current=null),ee.noteInteraction());const He=FA(Ce.current,Pe.zoom);He!==Ce.current&&(Ce.current=He,ce(He),c?.(He));for(const[At,dt]of H.current){const Xe=j.current.get(At);if(!Xe)continue;const[wt,tt]=Vc(Xe.wx,Xe.wy,Pe,Oe),Ui=wt>-200&&wt<Oe.width+200&&tt>-80&&tt<Oe.height+80;dt.style.visibility=Ui?"visible":"hidden",dt.style.transform=`translate3d(${wt}px, ${tt}px, 0) translate(-50%, -100%)`}const hn=Z.current,St=T.current;if(hn&&St){const[At,dt]=Vc(St.x,St.y,Pe,Oe),Xe=hn.firstElementChild;Xe&&$.current.key!==St.id&&($.current={key:St.id,w:Xe.offsetWidth,h:Xe.offsetHeight,label:Xe.dataset.anchorPlacement==="label"});const{w:wt,h:tt,label:Ui}=$.current;let Ni=Ui?-wt/2:18,us=Ui?-tt-14:-tt/2;!Ui&&At+Ni+wt>Oe.width-12&&(Ni=-wt-18),Ni=Math.max(12-At,Ni),us=Math.min(Math.max(12-dt,us),Oe.height-12-tt-dt),hn.style.transform=`translate3d(${At+Ni}px, ${dt+us}px, 0)`,hn.style.visibility=At>-300&&At<Oe.width+300&&dt>-300&&dt<Oe.height+300?"visible":"hidden"}const Gt=Pe.cy+Oe.height/An(Pe,Oe)/2,Dn=Gt>En.strataTop+40,fa=Gt>En.strataTop+En.strataHeight*.7,Cn=K.current,_i=Cn?.querySelector("[data-depth-label]");if(_i){const At=Dn?fa?"FIELD — TODAY":"FIELD — SURFACE + TODAY":"FIELD — LIVE";_i.textContent!==At&&(_i.textContent=At)}if(Cn){const At=Cn.querySelector("[data-depth-summary]"),dt=Cn.querySelector("[data-depth-deep]");if(At&&(At.style.display=Dn?"inline-flex":"none"),dt){const Xe=dt.dataset.depthSuppressed==="true";dt.style.display=fa&&!Xe?"block":"none"}}};return ee.onFrame(ye)},[te,c]);const Ce=Q.useRef("environment"),T=Q.useRef(null),j=Q.useRef(new Map);T.current=r,Q.useEffect(()=>{j.current=new Map(U.map(ee=>[ee.id,ee]))},[U]);const q=Q.useCallback(()=>{const ee=R.current;return{width:ee?.clientWidth??1,height:ee?.clientHeight??1}},[]),J=g?.right??0,le=g?.bottom??0,de=x?.id??null,ge=x?.x??0,Ie=x?.y??0;Q.useEffect(()=>{const ee=O.current;if(!ee||!de||J===0&&le===0)return;const W=q(),ye={...Y.current??L.current},Oe=An(ye,W);if(Oe<=0)return;const[Pe,Fe]=Vc(ge,Ie,ye,W);let xt=!1;if(J>0){const He=W.width-J-40;Pe>He&&(ye.cx+=(Pe-(W.width-J)/2)/Oe,xt=!0)}if(le>0){const He=W.height-le-40;Fe>He&&(ye.cy+=(Fe-(He-60))/Oe,xt=!0)}Fe<70&&(ye.cy-=(110-Fe)/Oe,xt=!0),xt&&(Y.current=yr(ye),ee.noteInteraction())},[de,ge,Ie,J,le,q]);const De=Q.useCallback(ee=>{const W=R.current.getBoundingClientRect();return[ee.clientX-W.left,ee.clientY-W.top]},[]),dn=Q.useCallback(ee=>{const W=O.current;if(!W)return;const[ye,Oe]=De(ee);Y.current=null,ee.ctrlKey||ee.metaKey?Fc(L.current,Math.exp(-ee.deltaY*.012),ye,Oe,q()):T0(L.current,ee.deltaX,ee.deltaY,q()),W.noteInteraction()},[De,q]);Q.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 Rn=Q.useCallback(ee=>{const W=De(ee);ee.isPrimary&&k.current.clear(),k.current.set(ee.pointerId,W),Y.current=null;try{R.current?.setPointerCapture(ee.pointerId)}catch{}if(k.current.size===1)F.current={x:W[0],y:W[1],moved:!1},xe("grabbing");else if(k.current.size===2){const[ye,Oe]=[...k.current.values()];w.current={distance:Math.hypot(ye[0]-Oe[0],ye[1]-Oe[1]),zoom:L.current.zoom},F.current=null}O.current?.noteInteraction()},[De]),zi=Q.useCallback(ee=>{const W=O.current;if(!W)return;const ye=De(ee),Oe=k.current.has(ee.pointerId);Oe&&k.current.set(ee.pointerId,ye);const Pe=w.current;if(Pe&&k.current.size>=2){const[St,Gt]=[...k.current.values()],Dn=Math.hypot(St[0]-Gt[0],St[1]-Gt[1]),fa=(St[0]+Gt[0])/2,Cn=(St[1]+Gt[1])/2,_i=Pe.zoom*(Dn/Math.max(12,Pe.distance));Fc(L.current,_i/L.current.zoom,fa,Cn,q()),W.noteInteraction();return}const Fe=F.current;if(Oe&&Fe){const St=ye[0]-Fe.x,Gt=ye[1]-Fe.y;(Math.abs(St)>4||Math.abs(Gt)>4)&&(Fe.moved=!0),T0(L.current,-St,-Gt,q()),Fe.x=ye[0],Fe.y=ye[1],W.noteInteraction();return}if(ee.pointerType==="touch")return;const[xt,He]=gf(ye[0],ye[1],L.current,q()),hn=eg(_.current,xt,He);xe(hn?"pointer":"grab"),(hn||A.current)&&W.noteInteraction(),A.current=hn,i(hn)},[De,i,q]),Dt=Q.useCallback(ee=>{const W=k.current.get(ee.pointerId)??De(ee);k.current.delete(ee.pointerId),k.current.size<2&&(w.current=null);const ye=F.current;if(F.current=null,xe("grab"),!ye||ye.moved)return;const[Oe,Pe]=gf(W[0],W[1],L.current,q()),Fe=eg(_.current,Oe,Pe);if(s(Fe),Fe&&Fe.kind!=="stratum"){const xt=Fe.kind==="mass"?mf:mf+.5;Y.current=XA(Fe.x,Fe.y,Math.max(L.current.zoom,xt))}O.current?.noteInteraction()},[De,s,q]),Bt=Q.useCallback(()=>{F.current=null,w.current=null,k.current.clear(),xe("grab")},[]),Te=Q.useCallback(()=>{Y.current={...E0},O.current?.noteInteraction(),s(null)},[s]),Qt=Q.useCallback(ee=>{const W=q();Fc(L.current,ee,W.width/2,W.height/2,W),O.current?.noteInteraction()},[q]);return v.jsxs("div",{style:{position:"relative",flex:1,minHeight:0},children:[v.jsxs("div",{ref:R,onWheel:dn,onPointerDown:Rn,onPointerMove:zi,onPointerUp:Dt,onPointerCancel:Dt,onLostPointerCapture:ee=>{k.current.delete(ee.pointerId),k.current.size<2&&(w.current=null)},onPointerLeave:ee=>{ee.pointerType!=="touch"&&(Bt(),i(null))},style:{position:"absolute",inset:0,overflow:"hidden",background:X.bg,cursor:ae},children:[v.jsx("canvas",{ref:B,style:{display:"block",width:"100%",height:"100%"}}),v.jsx("div",{style:{position:"absolute",inset:0,pointerEvents:"none",...aM}}),v.jsx("div",{style:{position:"absolute",inset:0,pointerEvents:"none",...sM}}),v.jsx("div",{style:{position:"absolute",left:0,right:0,top:0,height:"16%",pointerEvents:"none",...rM}}),v.jsxs("div",{style:{position:"absolute",inset:0,pointerEvents:"none"},children:[U.map(ee=>v.jsx("div",{ref:W=>{W?H.current.set(ee.id,W):H.current.delete(ee.id)},style:{position:"absolute",left:0,top:0,willChange:"transform",visibility:"hidden",fontFamily:Tt,fontSize:ee.size,letterSpacing:"0.22em",color:ee.color,whiteSpace:"nowrap",textTransform:"uppercase"},children:ee.text},ee.id)),r&&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:K,style:{position:"absolute",inset:0,pointerEvents:"none"},children:h}),te==="failed"&&v.jsx("div",{style:{position:"absolute",inset:0,display:"grid",placeItems:"center",fontFamily:Tt,fontSize:11,letterSpacing:"0.18em",color:st.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:X.chrome,letterSpacing:"0.08em"},children:oe})]})})]}),v.jsx(oM,{onSurface:Te,onZoom:Qt,compact:b})]})}function oM({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:X.ink,fontFamily:Tt,fontSize:8.5,letterSpacing:"0.1em",cursor:"pointer"},children:"SURF"})});const r={background:"transparent",border:`1px solid ${X.chromeDim}`,color:X.chromeStrong,fontFamily:Tt,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:r,onClick:()=>i(1.35),"aria-label":"Zoom in",children:"+"}),v.jsx("button",{style:r,onClick:()=>i(1/1.35),"aria-label":"Zoom out",children:"−"}),v.jsx("button",{style:r,onClick:n,children:"SURFACE"})]})}function uM(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 ${ft(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 ${ft(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 cM(n,i,s){if(s&&s.reported===0)return yf("WAITING ON YOU","—",void 0,{note:"not reported by sources in this window"});const r=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 yf("WAITING ON YOU",Ze(n.value),n,{tone:n.value>0?"waiting":void 0,note:[r,o].filter(Boolean).join(" · ")||void 0})}function yf(n,i,s,r={}){const o=s?.basis==="inferred";return{key:n,value:i,inferred:o,assumption:o?s?.assumption:void 0,...r}}function Xc(n,i,s,r,o){return yf(n,s>0?ft(i.value):"—",i,{note:s===0?"not reported in this window":[o,s<r?`reported for ${s} of ${r} runs`:void 0].filter(Boolean).join(" · ")||void 0})}const U0="(no model)";function yn({name:n,value:i,measure:s,accent:r,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 ${X.hairline}`,cursor:c?"help":"default"},children:[v.jsxs("div",{style:{fontSize:9.5,letterSpacing:"0.22em",color:X.chrome,display:"flex",alignItems:"baseline",gap:6},children:[n,c&&v.jsx("span",{style:{color:X.chromeDim,letterSpacing:"0.1em"},children:"inferred"})]}),v.jsx("div",{style:{fontSize:21,letterSpacing:"0.02em",color:r??X.ink,fontVariantNumeric:"tabular-nums"},children:i}),o&&v.jsx("div",{style:{fontSize:9.5,color:X.chromeDim},children:o})]})}function na({title:n,children:i}){return v.jsxs("div",{style:{marginTop:40},children:[v.jsx("div",{style:{fontSize:9.5,letterSpacing:"0.24em",color:X.chrome},children:n}),v.jsx("div",{style:{marginTop:12},children:i})]})}function ov({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 Kc({rows:n,max:i,label:s,color:r,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:X.body},children:s(c.key)}),v.jsxs("span",{style:{color:X.chromeMid},children:[c.runs," ",c.runs===1?"run":"runs",c.tokenRuns>0?` · ${ft(c.tokens)} tok`:""," · ",Ze(c.computeMs),c.failed>0&&v.jsxs("span",{style:{color:st.failed},children:[" · ",c.failed," failed"]})]})]}),v.jsx(ov,{fraction:i>0?c.computeMs/i:0,color:r}),o&&(()=>{const d=uM(c);return v.jsx("div",{title:d.title,style:{fontSize:9.5,letterSpacing:"0.06em",color:d.absent?X.chromeDim:X.chrome,cursor:"help",fontVariantNumeric:"tabular-nums"},children:d.text})})()]},c.key))})}function fM({world:n,waitEvidence:i}){const s=Q.useMemo(()=>q0(n),[n]),r=Q.useMemo(()=>X0(n,s),[n,s]),o=Q.useMemo(()=>Wx(n),[n]),c=Q.useMemo(()=>Jx(n),[n]),d=cM(s.waitingOnYou,c,i),h=Q.useMemo(()=>e1(n),[n]),m=Q.useMemo(()=>t1(n),[n]),g=Q.useMemo(()=>Uc(n,(A,k)=>k?.context),[n]),x=Q.useMemo(()=>Uc(n,A=>A.model??U0),[n]),b=Q.useMemo(()=>Uc(n,A=>A.machineId),[n]),R=Q.useMemo(()=>[...n.executions.values()].filter(A=>A.status==="failed").sort((A,k)=>k.startedAt-A.startedAt),[n]),B=s.longestContextSpan.value,O=Xc("REQUESTS",s.requests,s.accounting.requests,s.executions.value),L=Xc("TOKENS",s.tokens,s.accounting.tokens,s.executions.value,`${Nc(o.cacheRead,o.total)} cache reads`),_=Xc("TOOL CALLS",s.toolCalls,s.accounting.tools,s.executions.value,h.toolErrors>0?`${h.toolErrors} tool errors`:void 0),H=g[0]?.computeMs??0,Z=x[0]?.computeMs??0,K=b[0]?.computeMs??0,F=m.reduce((A,k)=>k.computeMs>A.computeMs?k:A,m[0]),Y=[...n.executions.values()].filter(A=>A.depth>0).length;return v.jsxs("div",{style:{flex:1,overflowY:"auto",padding:"28px 48px 80px",fontFamily:Tt,color:X.ink},children:[v.jsxs("div",{style:{marginBottom:34,maxWidth:900},children:[v.jsx("div",{style:{fontSize:9.5,letterSpacing:"0.24em",color:X.chrome},children:"WORK SHAPE"}),v.jsx("div",{style:{fontSize:34,letterSpacing:"0.08em",marginTop:10,color:X.accentBright},children:r.headline}),v.jsx("div",{style:{marginTop:14,display:"flex",flexDirection:"column",gap:7},children:r.clauses.map(A=>v.jsx("div",{style:{fontSize:12,lineHeight:1.65,color:X.body,letterSpacing:"0.02em"},children:A},A))})]}),v.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(190px, 1fr))",gap:"0 40px"},children:[v.jsx(yn,{name:"REQUESTS",value:O.value,measure:s.requests,note:O.note}),v.jsx(yn,{name:"RUNS",value:String(s.executions.value),measure:s.executions,note:Y>0?`${Y} of them sub-agents`:void 0}),v.jsx(yn,{name:"SESSIONS",value:String(s.sessions.value),measure:s.sessions}),v.jsx(yn,{name:"TOKENS",value:L.value,measure:s.tokens,note:L.note}),v.jsx(yn,{name:"TOOL CALLS",value:_.value,measure:s.toolCalls,note:_.note}),v.jsx(yn,{name:"TIME IN FLIGHT",value:Ze(s.timeInFlight.value),measure:s.timeInFlight}),v.jsx(yn,{name:"PEAK CONCURRENCY",value:s.peakConcurrency.value>0?`${s.peakConcurrency.value} · ${ts(s.peakConcurrencyAt.value)}`:"0",measure:s.peakConcurrency}),v.jsx(yn,{name:"CONTEXT CHANGES",value:String(s.contextSwitches.value),measure:s.contextSwitches,note:`sequential only · known contexts: ${g.filter(A=>A.key.length>0).length}`}),v.jsx(yn,{name:"LONGEST CONTEXT SPAN",value:B?Ze(B.end-B.start):"—",measure:s.longestContextSpan,note:B?`${cr(B.context)} · ${ts(B.start)}–${ts(B.end)}`:void 0}),v.jsx(yn,{name:d.key,value:d.value,measure:d.value==="—"?void 0:s.waitingOnYou,accent:d.tone==="waiting"?st.waiting:void 0,note:d.note}),v.jsx(yn,{name:"FAILED",value:String(h.failed),accent:h.failed>0?st.failed:void 0,note:h.interrupted>0||h.retries>0?`${h.interrupted} stopped · ${h.retries} retries`:void 0})]}),m.length>0&&v.jsxs(na,{title:"HOUR BY HOUR",children:[v.jsx("div",{style:{display:"flex",alignItems:"flex-end",gap:3,height:84},children:m.map((A,k)=>{const w=A.computeMs/36e5;return v.jsx("div",{title:`${String(A.hour).padStart(2,"0")}:00 — ${Ze(A.computeMs)} in flight, ${A.runs} runs, peak ${A.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:A.peak>1?"rgba(240,195,116,0.75)":"rgba(214,176,116,0.38)"}})},k)})}),v.jsxs("div",{style:{display:"flex",justifyContent:"space-between",marginTop:6,fontSize:9,letterSpacing:"0.16em",color:X.chromeDim},children:[v.jsxs("span",{children:[String(m[0].hour).padStart(2,"0"),":00"]}),v.jsxs("span",{children:["busiest ",String(F.hour).padStart(2,"0"),":00 · ",Ze(F.computeMs)," ","of that hour"]}),v.jsxs("span",{children:[String(m[m.length-1].hour).padStart(2,"0"),":00"]})]})]}),v.jsx(na,{title:"WHERE THE TIME WENT",children:v.jsx(Kc,{rows:g,max:H,label:cr,color:"rgba(240,195,116,0.6)"})}),b.length>0&&v.jsx(na,{title:"BY MACHINE",children:v.jsx(Kc,{rows:b,max:K,label:A=>n.machines.get(A)?.name??A,color:"rgba(168,186,150,0.6)"})}),x.length>0&&v.jsx(na,{title:"BY MODEL",children:v.jsx(Kc,{rows:x,max:Z,label:A=>A===U0?"model not observed":A,color:"rgba(150,175,196,0.6)",median:!0})}),v.jsxs(na,{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(([A,k,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:X.body},children:A}),v.jsxs("span",{style:{color:X.chromeMid},children:[ft(k)," · ",Nc(k,o.total)]})]}),v.jsx(ov,{fraction:k/Math.max(1,o.total),color:w})]},A))}),o.reasoning>0&&v.jsxs("div",{style:{marginTop:16,fontSize:11,color:X.body},children:["Of output: ",ft(o.reasoning)," reasoning tokens · ",Nc(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:X.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(na,{title:"FAILURES",children:v.jsx("div",{style:{display:"flex",flexDirection:"column",gap:9},children:R.slice(0,12).map(A=>v.jsxs("div",{style:{display:"flex",gap:16,fontSize:11,borderTop:`1px solid ${X.hairline}`,paddingTop:8},children:[v.jsx("span",{style:{color:X.chromeMid,minWidth:46},children:ts(A.startedAt)}),v.jsx("span",{style:{color:X.body,minWidth:160},children:A.label}),v.jsxs("span",{style:{color:st.failed},children:[A.failure?.code,": ",A.failure?.message]})]},A.id))})}),v.jsx(dM,{})]})}function dM(){return v.jsx(na,{title:"NOT AVAILABLE FROM THESE SOURCES",children:v.jsxs("div",{style:{maxWidth:760,fontSize:10.5,lineHeight:1.8,color:X.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 hM(n,i,s){return n===void 0?i===void 0?0:1:i===void 0?-1:s==="asc"?n-i:i-n}const Pc=100,N0="58px minmax(180px,1.4fr) 104px 132px 84px 68px 76px 70px 56px",k0=4,pM=8,uv="rgba(230,227,219,0.09)",L0="rgba(230,227,219,0.55)",j0="rgba(230,227,219,0.22)",mM="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 gM(n){const i=(Math.log10(Math.max(n,1))-k0)/(pM-k0),s=Math.max(0,Math.min(1,i))*100;return{width:n>0?`max(2px, ${s.toFixed(1)}%)`:"0",over:i>1}}function yM({tokens:n}){const{width:i,over:s}=gM(n);return v.jsxs("div",{style:{marginTop:3,height:1,background:uv,position:"relative"},children:[v.jsx("div",{style:{height:1,width:i,background:L0}}),s&&v.jsx("div",{style:{position:"absolute",right:0,top:-2,width:1,height:5,background:L0}})]})}function vM(){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:uv}}),[0,25,50,75].map(n=>v.jsx("div",{style:{position:"absolute",left:`${n}%`,top:0,width:1,height:3,background:j0}},n)),v.jsx("div",{style:{position:"absolute",right:0,top:0,width:1,height:3,background:j0}})]})}function bM(n){return n.outcome==="interrupted"?"STOPPED":n.status}function xM(n){return n.outcome==="interrupted"?X.chromeMid:st[n.status]}function Ai({children:n,align:i="left",color:s}){return v.jsx("div",{style:{textAlign:i,color:s??X.chromeMid,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:n})}function SM({p:n,session:i,now:s,onShowInField:r}){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",ft(es(n.measures).input)],["OUTPUT",ft(es(n.measures).output)],["CACHE READ",ft(es(n.measures).cacheRead)],["REASONING",ft(es(n.measures).reasoning)]],["REQUESTS",String(bf(n))],["TOOL CALLS",ns(un(n),"not observed")]];return la(n)>0&&d.push(["TOOL ERRORS",String(la(n)),st.failed]),Jc(n)>0&&d.push(["PROVIDER RETRIES",String(Jc(n)),st.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"}`,st.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 ${X.panelBorder}`,margin:"2px 0 6px",background:"rgba(230,227,219,0.02)"},children:[d.map(([h,m,g])=>v.jsxs("div",{style:{display:"flex",justifyContent:"space-between",gap:12},children:[v.jsx("span",{style:{fontSize:9.5,letterSpacing:"0.16em",color:X.chrome},children:h}),v.jsx("span",{style:{fontSize:10.5,color:g??X.body,fontVariantNumeric:"tabular-nums",overflow:"hidden",textOverflow:"ellipsis"},children:m})]},h)),n.failure&&v.jsxs("div",{style:{gridColumn:"1 / -1",fontSize:10.5,color:st.failed},children:[n.failure.code,": ",n.failure.message]}),c&&n.boundsAssumption&&v.jsxs("div",{style:{gridColumn:"1 / -1",fontSize:9.5,color:X.chromeMid},children:["timing inferred — ",n.boundsAssumption]}),v.jsx("div",{style:{gridColumn:"1 / -1",marginTop:4},children:v.jsx("button",{onClick:h=>{h.stopPropagation(),r()},style:{background:"transparent",border:`1px solid ${X.hairline}`,color:X.chromeMid,fontFamily:Tt,fontSize:9,letterSpacing:"0.16em",padding:"5px 10px",cursor:"pointer"},children:"SHOW IN FIELD →"})})]})}function wM({world:n,selectedId:i,onSelect:s}){const[r,o]=Q.useState("all"),[c,d]=Q.useState("time"),[h,m]=Q.useState(Pc),[g,x]=Q.useState(null),b=Q.useMemo(()=>{let _=[...n.executions.values()];r==="stopped"?_=_.filter(K=>K.outcome==="interrupted"):r!=="all"&&(_=_.filter(K=>K.status===r&&K.outcome!=="interrupted"));const H=K=>{const F=ra(K,n.now,n.dayStart);return F.end-F.start},Z={time:(K,F)=>F.startedAt-K.startedAt,duration:(K,F)=>H(F)-H(K),tokens:(K,F)=>hM(vn(K.measures),vn(F.measures),"desc"),tools:(K,F)=>(un(F)??0)-(un(K)??0),waited:(K,F)=>Ri(F,n.now)-Ri(K,n.now)};return _.sort(Z[c])},[n,r,c]),R=Q.useMemo(()=>{const _={all:n.executions.size,stopped:0};for(const H of n.executions.values())H.outcome==="interrupted"?_.stopped++:_[H.status]=(_[H.status]??0)+1;return _},[n]),B=Q.useMemo(()=>{let _=0,H=0,Z=0,K=0,F=0,Y=0;for(const A of b){const k=vn(A.measures),w=un(A);k!==void 0&&(_+=k,F++),w!==void 0&&(Z+=w,Y++);const $=ra(A,n.now,n.dayStart);H+=$.end-$.start,K+=Ri(A,n.now)}return{tokens:_,compute:H,tools:Z,waited:K,tokenRuns:F,toolRuns:Y}},[b,n]),O=b.slice(0,h),L=(_,H,Z="left")=>v.jsxs("div",{onClick:()=>d(_),style:{textAlign:Z,cursor:"pointer",color:c===_?X.ink:X.chrome},children:[H,c===_?" ↓":""]});return v.jsxs("div",{style:{flex:1,overflowY:"auto",padding:"24px 48px 80px",fontFamily:Tt,color:X.ink},children:[v.jsx("div",{style:{display:"flex",gap:10,flexWrap:"wrap",marginBottom:14},children:["all","running","waiting","idle","completed","failed","stopped"].map(_=>{const H=r===_,Z=R[_]??0;return v.jsxs("button",{onClick:()=>{o(_),m(Pc)},style:{background:"transparent",border:`1px solid ${H?"rgba(230,227,219,0.6)":X.hairline}`,color:H?X.ink:X.chromeMid,fontFamily:Tt,fontSize:9.5,letterSpacing:"0.16em",padding:"6px 11px",cursor:"pointer",textTransform:"uppercase"},children:[_," ",Z>0&&v.jsx("span",{style:{color:X.chromeDim},children:Z})]},_)})}),v.jsxs("div",{style:{fontSize:10,letterSpacing:"0.12em",color:X.chromeDim,marginBottom:14,fontVariantNumeric:"tabular-nums"},children:[b.length," ",b.length===1?"run":"runs"," shown · ",B.tokenRuns?`${ft(B.tokens)} tok (${B.tokenRuns}/${b.length} reported)`:"tokens not reported"," ·"," ",Ze(B.compute)," summed run intervals in period · ",B.toolRuns?`${ft(B.tools)} tool calls (${B.toolRuns}/${b.length} reported)`:"tools not reported",B.waited>0&&` · ${Ze(B.waited)} blocked on you`]}),v.jsxs("div",{style:{display:"grid",gridTemplateColumns:N0,gap:"0 14px",fontSize:9,letterSpacing:"0.18em",color:X.chrome,paddingBottom:8,borderBottom:`1px solid ${X.hairline}`,alignItems:"end"},children:[L("time","START"),v.jsx("div",{children:"RUN"}),v.jsx("div",{children:"CONTEXT"}),v.jsx("div",{children:"MODEL"}),v.jsx("div",{children:"STATUS"}),L("duration","IN PERIOD","right"),v.jsxs("div",{onClick:()=>d("tokens"),title:mM,style:{cursor:"help"},children:[v.jsxs("div",{style:{textAlign:"right",color:c==="tokens"?X.ink:X.chrome},children:["TOKENS",c==="tokens"?" ↓":""]}),v.jsx(vM,{})]}),L("waited","WAITED","right"),L("tools","TOOLS","right")]}),O.map(_=>{const H=n.sessions.get(_.sessionId),Z=vn(_.measures),K=_.id===i,F=g===_.id;return v.jsxs("div",{children:[v.jsxs("div",{onClick:()=>x(F?null:_.id),style:{display:"grid",gridTemplateColumns:N0,gap:"0 14px",fontSize:11,padding:"9px 0",borderBottom:"1px solid rgba(230,227,219,0.05)",cursor:"pointer",background:K||F?"rgba(240,195,116,0.07)":"transparent",fontVariantNumeric:"tabular-nums"},children:[v.jsx(Ai,{children:ts(_.startedAt)}),v.jsxs(Ai,{color:K||F?X.accentBright:X.body,children:[_.depth>0&&v.jsx("span",{style:{color:X.chromeDim},children:"└ "}),_.label]}),v.jsx(Ai,{children:H?cr(H.context):"—"}),v.jsx(Ai,{color:_.model?void 0:X.chromeDim,children:_.model??"—"}),v.jsx("div",{style:{fontSize:9,letterSpacing:"0.14em",color:xM(_),textTransform:"uppercase"},children:bM(_)}),v.jsxs(Ai,{align:"right",children:[_.startBasis==="inferred"||_.endBasis==="inferred"?"~":"",Ze(ra(_,n.now,n.dayStart).end-Math.max(_.startedAt,n.dayStart))]}),v.jsxs("div",{children:[v.jsx(Ai,{align:"right",color:Z===void 0?X.chromeDim:void 0,children:ns(Z,"—")}),Z!==void 0&&v.jsx(yM,{tokens:Z})]}),v.jsx(Ai,{align:"right",color:Ri(_,n.now)>0?st.waiting:X.chromeDim,children:Ri(_,n.now)>0?Ze(Ri(_,n.now)):"—"}),v.jsxs(Ai,{align:"right",color:un(_)===void 0?X.chromeDim:void 0,children:[ns(un(_),"—"),la(_)>0&&v.jsxs("span",{style:{color:st.failed},children:[" /",la(_)]})]})]}),F&&v.jsx(SM,{p:_,session:H,now:n.now,onShowInField:()=>s(_.id)})]},_.id)}),b.length===0&&v.jsx("div",{style:{padding:"28px 0",fontSize:11,color:X.chromeMid},children:"Nothing matching in this window."}),b.length>h&&v.jsxs("button",{onClick:()=>m(_=>_+Pc),style:{marginTop:18,background:"transparent",border:`1px solid ${X.hairline}`,color:X.chromeMid,fontFamily:Tt,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:X.panel,borderLeft:`1px solid ${X.panelBorder}`,padding:"9px 13px",minWidth:170,maxWidth:320,fontFamily:Tt,backdropFilter:"blur(2px)"};function Ne({name:n,detail:i,color:s,title:r,tag:o}){return v.jsxs("div",{title:r,style:{display:"flex",alignItems:"baseline",justifyContent:"space-between",gap:16,fontSize:10.5,cursor:r?"help":void 0},children:[v.jsxs("span",{style:{color:X.chromeMid,letterSpacing:"0.1em",whiteSpace:"nowrap"},children:[n,o&&v.jsxs("span",{style:{color:X.chromeDim,letterSpacing:"0.06em"},children:[" ",o]})]}),v.jsx("span",{style:{fontSize:10,fontWeight:500,letterSpacing:"0.14em",color:s??X.chromeStrong,whiteSpace:"nowrap",textAlign:"right",overflow:"hidden",textOverflow:"ellipsis",maxWidth:190},children:i})]})}function Zc({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:X.ink,textTransform:"uppercase"},children:n}),v.jsx("div",{onClick:i,role:"button",style:{fontSize:11,color:X.chromeMid,cursor:"pointer"},children:"×"})]})}function Vf({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:X.chromeDim},children:n})}function EM(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 TM(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 B0={"ran-as":"RAN AS","same-as":"SAME AS",spawned:"SPAWNED",contains:"CONTAINS",produced:"PRODUCED"};function G0({world:n,subject:i}){const s=n.relationships.filter(r=>r.from.type===i.type&&r.from.id===i.id||r.to.type===i.type&&r.to.id===i.id);return s.length===0?null:v.jsxs(v.Fragment,{children:[v.jsx(Vf,{label:"RELATED"}),s.slice(0,6).map((r,o)=>{const c=r.from.type===i.type&&r.from.id===i.id,d=c?r.to:r.from,h=c?B0[r.kind]:r.kind==="spawned"?"SPAWNED BY":B0[r.kind],m=EM(r);return v.jsx(Ne,{name:h,tag:m.grade==="contextual"?`${m.label} · inferred`:m.label,detail:TM(n,d),color:m.grade==="contextual"?X.chromeMid:void 0,title:r.assumption??(r.via?`via ${r.via}`:void 0)},`${r.kind}:${d.type}:${d.id}:${o}`)})]})}function AM({type:n,id:i}){const[s,r]=Q.useState(null);return Q.useEffect(()=>{let o=!1;r(null);const c=setTimeout(()=>{M1(n,i).then(({events:d})=>{o||r(MM(d))}).catch(()=>{o||r(null)})},180);return()=>{o=!0,clearTimeout(c)}},[n,i]),!s||s.facts.length===0&&!s.provenance?null:v.jsxs(v.Fragment,{children:[v.jsx(Vf,{label:"NATIVE RECORD"}),s.facts.map(([o,c])=>v.jsx(Ne,{name:o,detail:c,color:X.chromeMid},o)),s.provenance&&v.jsxs("div",{title:s.provenance,style:{fontSize:8.5,letterSpacing:"0.04em",color:X.chromeDim,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",cursor:"help"},children:["read from ",s.provenance]})]})}function MM(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 RM({p:n,now:i}){const s=(n.endedAt??i)-n.startedAt,r=n.startBasis==="inferred",o=n.endBasis==="inferred",c=r||o;return v.jsxs(v.Fragment,{children:[v.jsx(Ne,{name:"STARTED",tag:r?"inferred":void 0,detail:ts(n.startedAt),title:r?n.boundsAssumption:void 0}),v.jsx(Ne,{name:"ELAPSED",tag:c?"inferred":void 0,detail:Ze(s),title:c?n.boundsAssumption:void 0})]})}function Ff({hit:n,world:i,landscape:s,band:r,density:o,onClose:c}){if(n.kind==="mass"){const O=i.machines.get(n.id);if(!O)return null;const L=[];let _=0,H;for(const F of i.executions.values()){if(F.machineId!==O.id)continue;const Y=vn(F.measures);Y!==void 0&&(H=(H??0)+Y),F.status==="running"||F.status==="waiting"?L.push({id:F.id,label:F.label,status:F.status}):_++}const Z=i.processTotals,K=new Set;for(const F of i.relationships)F.kind==="ran-as"&&(F.from.type==="process"&&K.add(F.from.id),F.to.type==="process"&&K.add(F.to.id));return v.jsxs("div",{style:Qc,children:[v.jsx(Zc,{text:O.name,onClose:c}),L.length===0?v.jsx("div",{style:{fontSize:10,color:X.chrome},children:"idle — nothing active"}):L.slice(0,8).map(F=>v.jsx(Ne,{name:F.label,detail:F.status.toUpperCase(),color:st[F.status]},F.id)),v.jsx("div",{style:{height:4}}),v.jsx(Ne,{name:"RAN TODAY",detail:String(_)}),v.jsx(Ne,{name:"TOKENS",detail:ns(H),title:H===void 0?"No execution in this window reported token accounting.":void 0}),O.activity&&O.activity.validForMs!==void 0&&i.now-O.activity.observedAt<=O.activity.validForMs&&jt(O.activity.measures,$e.cpuUtilization)!==void 0&&v.jsx(Ne,{name:"CPU ACTIVITY",tag:O.activity.basis,detail:`${Math.round((jt(O.activity.measures,$e.cpuUtilization)??0)*100)}%`,title:O.activity.assumption}),Z&&v.jsxs(v.Fragment,{children:[v.jsx(Vf,{label:"MACHINE STRATUM"}),v.jsx(Ne,{name:"PROCESSES OBSERVED",detail:String(Z.observed)}),v.jsx(Ne,{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(Ne,{name:"ATTRIBUTED",detail:`${K.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(Ne,{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 O=i.transfers.get(n.id);if(!O)return null;const L=i.machines.get(O.fromMachineId)?.name??O.fromMachineId,_=i.machines.get(O.toMachineId)?.name??O.toMachineId;return v.jsxs("div",{style:Qc,children:[v.jsx(Zc,{text:`${L} → ${_}`,onClose:c}),v.jsx(Ne,{name:"STATUS",detail:"TRANSFERRING",color:st.running}),v.jsx(Ne,{name:"WHAT",detail:O.label}),v.jsx(Ne,{name:"SIZE",detail:i1(O.bytes)}),v.jsx(Ne,{name:"ELAPSED",detail:Ze(i.now-O.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),g=s.disturbances.find(O=>O.id===n.id),x=o==="full"||o!=="compact"&&(r==="proximity"||n.kind==="stratum"),b=x,R=vn(d.measures),B=es(d.measures);return v.jsxs("div",{style:Qc,children:[v.jsx(Zc,{text:d.label,onClose:c}),v.jsx(Ne,{name:"STATUS",detail:d.status.toUpperCase(),color:st[d.status]}),v.jsx(Ne,{name:"MACHINE",detail:m?.name??d.machineId}),v.jsx(RM,{p:d,now:i.now}),b&&v.jsxs(v.Fragment,{children:[v.jsx(Ne,{name:"TOKENS",detail:ns(R),title:R===void 0?"This source does not persist token accounting.":void 0}),v.jsx(Ne,{name:"REQUESTS",detail:String(bf(d))}),v.jsx(Ne,{name:"TOOL CALLS",detail:ns(un(d)),title:un(d)===void 0?"This source does not count discrete operations.":void 0})]}),x&&v.jsxs(v.Fragment,{children:[v.jsx("div",{style:{height:4}}),h&&v.jsx(Ne,{name:"CONTEXT",detail:cr(h.context)}),v.jsx(Ne,{name:"PROVIDER",detail:d.executor}),v.jsx(Ne,{name:"MODEL",detail:d.model??"NOT OBSERVED",color:d.model?void 0:X.chromeMid,title:d.model?void 0:"This source does not record the model."}),R!==void 0&&v.jsxs(v.Fragment,{children:[v.jsx(Ne,{name:"CACHE READ",detail:ft(B.cacheRead)}),v.jsx(Ne,{name:"REASONING",detail:ft(B.reasoning)})]}),la(d)>0&&v.jsx(Ne,{name:"TOOL ERRORS",detail:String(la(d)),color:st.failed}),d.waitingMs>0&&v.jsx(Ne,{name:"WAITED ON YOU",detail:Ze(d.waitingMs),color:st.waiting}),d.depth>0&&v.jsx(Ne,{name:"SUB-AGENT",detail:`depth ${d.depth}`}),h?.parentId&&v.jsx(Ne,{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."}),g&&v.jsx(Ne,{name:"FIELD ENERGY",detail:g.energy.toFixed(2)}),v.jsx(G0,{world:i,subject:{type:"execution",id:d.id}}),h&&v.jsx(G0,{world:i,subject:{type:"session",id:h.id}}),v.jsx(AM,{type:"execution",id:d.id})]}),d.failure&&v.jsxs("div",{style:{marginTop:4,fontSize:9.5,letterSpacing:"0.06em",color:st.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:X.chromeMid},children:"stopped before finishing"})]})}function DM({hit:n,world:i}){let s="",r="",o=X.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}`,r="TRANSFERRING",o=st.running}else{const c=i.executions.get(n.id);if(!c)return null;s=c.label,r=c.status.toUpperCase(),o=st[c.status]}return v.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",gap:2,pointerEvents:"none",whiteSpace:"nowrap",fontFamily:Tt},children:[v.jsx("div",{style:{fontSize:10.5,fontWeight:500,letterSpacing:"0.18em",color:X.hoverInk,background:"rgba(5,6,8,0.88)",padding:"4px 9px"},children:s}),r&&v.jsx("div",{style:{fontSize:9.5,letterSpacing:"0.22em",color:o,textShadow:Ja},children:r})]})}function CM(n){return[`${ft(n.requests.value)} REQ`,`${n.sessions.value} SESS`,`${Ze(n.timeInFlight.value)}`,`${n.accounting.tokens>0?ft(n.tokens.value):"—"} TOK`].join(" · ")}function OM(n){return[`${ft(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?ft(n.tokens.value):"—"} TOK`].join(" · ")}function zM({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:Tt},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:X.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(r=>v.jsx("div",{style:{fontSize:10.5,lineHeight:1.6,color:X.chromeMid,textShadow:Ja},children:r},r))}),v.jsx("div",{style:{marginTop:7,fontSize:9.5,lineHeight:1.6,color:X.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:X.chromeDim},children:"·"}),v.jsx("span",{style:{fontSize:10.5,letterSpacing:"0.18em",color:"rgba(230,227,219,0.6)",textShadow:Ja},children:s?CM(n):OM(n)})]})]})]})}const _M=560;function $0(n,i,s){return Math.min(n,i)<_M||s?i>=n?"portrait":"landscape":"desktop"}function UM(){const[n,i]=Q.useState(()=>typeof window>"u"?"desktop":$0(window.innerWidth,window.innerHeight,window.matchMedia("(pointer: coarse)").matches));return Q.useEffect(()=>{const s=window.matchMedia("(pointer: coarse)"),r=()=>i($0(window.innerWidth,window.innerHeight,s.matches));return r(),window.addEventListener("resize",r),window.addEventListener("orientationchange",r),s.addEventListener("change",r),()=>{window.removeEventListener("resize",r),window.removeEventListener("orientationchange",r),s.removeEventListener("change",r)}},[]),n}const cv=250,fv=150;function NM(n,i,s,r){return i?n==="landscape"?{right:cv,bottom:0}:n==="portrait"?{right:0,bottom:s?Math.round(r*.6):fv}:{right:0,bottom:0}:{right:0,bottom:0}}const dv={fontSize:9,letterSpacing:"0.16em",color:X.chromeMid};function kM(n){return v.jsxs("div",{style:{position:"absolute",right:0,top:0,bottom:0,width:cv,boxSizing:"border-box",background:X.panel,borderLeft:`1px solid ${X.panelBorder}`,padding:"16px 16px 14px",display:"flex",flexDirection:"column",gap:10,fontFamily:Tt,pointerEvents:"auto"},children:[v.jsx(Ff,{...n,density:"full"}),v.jsx("div",{style:{marginTop:"auto",...dv},children:"TAP FIELD TO DISMISS"})]})}function LM({detent:n,onToggleDetent:i,viewportHeight:s,...r}){const o=n==="expanded",c=o?Math.round(s*.6):fv;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 ${X.panelBorder}`,padding:"10px 18px 18px",display:"flex",flexDirection:"column",gap:10,fontFamily:Tt,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(Ff,{...r,density:o?"full":"compact"})}),v.jsx("div",{style:{marginTop:"auto",...dv},children:o?"TAP HANDLE TO COLLAPSE":"TAP HANDLE FOR FULL TELEMETRY"})]})}function jM(){return"capture"}function BM(n){return`${n.message}. ${n.remedy} Nothing observed since this appeared has been saved.`}const Wc={label:"TODAY",tone:"normal",detail:"Midnight to now."},GM={normal:X.chromeMid,warn:"rgba(240,195,116,0.9)",error:"rgba(206,104,90,0.9)"};function $M(){const n=Date.now(),i=new Date(n);return i.setHours(0,0,0,0),{start:i.getTime(),now:n}}const IM=250,VM={time:0,masses:[],disturbances:[],plinths:[],couplings:[],strata:[]};function FM(){const[n,i]=Q.useState(jM),[s,r]=Q.useState("field"),[o,c]=Q.useState(null),[d,h]=Q.useState(Wc),[m,g]=Q.useState(VM),[x,b]=Q.useState(0),[R,B]=Q.useState(null),[O,L]=Q.useState(null),[_,H]=Q.useState("environment"),[Z,K]=Q.useState(null),[F,Y]=Q.useState("peek"),A=UM(),k=Q.useRef(Fl(Date.now(),Date.now())),w=Q.useRef(void 0),$=Q.useRef(null),te=Q.useRef(null),se=Q.useRef(!1);Q.useEffect(()=>{let j=!1,q=null;h(Wc);async function J(){if(n==="synthetic"||n==="fixture"){let Te;if(Te=new T1({seed:57}),h({label:"REPLAY",tone:"normal",detail:"A deterministic synthetic day, replayed at speed. Not your telemetry."}),j)return;const Qt=Te.bounds();k.current=Fl(Qt.dayStart,Qt.dayEnd),w.current=void 0,$.current=Te,c(Te.info()),L(null),B(null),q=Te.subscribe(ee=>{Vx(k.current,ee),se.current=!0}),se.current=!0;return}const{start:le,now:de}=$M();await tf(le,de);const ge=await A1();let Ie=await nf(le,de,!0);if(Ie.world.executions.length===0&&Ie.world.sessions.length===0){const Te=de-2592e5;await tf(Te,de),Ie=await nf(Te,de,!0),(Ie.world.executions.length>0||Ie.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 De=Object.entries(ge.observation??{}).flatMap(([Te,Qt])=>Object.entries(Qt.strata).filter(([ee,W])=>W==="partial"||W==="failed"&&ee!=="live-semantics").map(([ee,W])=>`${Te} ${ee} ${W}`)),dn=Object.entries(ge.sources).filter(([,Te])=>(Te.presence??(Te.available?"observing":"not-installed"))==="failed").map(([Te])=>Te),Rn=Object.entries(ge.sources).filter(([,Te])=>Te.presence==="not-installed").map(([Te])=>Te),zi=ge.store.bySource.filter(Te=>Te.source!=="host"),Dt=ge.health;ge.fault?h({label:"STORE LOST",tone:"error",detail:BM(ge.fault)}):Dt&&!Dt.store.ok?h({label:"STORE DEGRADED",tone:"error",detail:Dt.store.remedy??"Some stored rows could not be read."}):Dt&&Dt.failingSources.length>0?h({label:"SOURCE FAILING",tone:"error",detail:`Installed and failing every collection round: ${Dt.failingSources.join(", ")}. `+(Dt.collection[Dt.failingSources[0]]?.lastError??"")+" Other sources and captured history are unaffected."}):ge.mode==="os-only"?h({label:"OS ONLY",tone:"normal",detail:"Observing this machine’s processes. No AI runtime state was found here"+(Rn.length?` (looked for ${Rn.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."}):(dn.length||De.length)&&h({label:"PARTIAL",tone:"warn",detail:[dn.length?`Installed but unreadable: ${dn.join(", ")}.`:"",De.length?`Reduced observation depth: ${De.join("; ")}. The computation is still observed; some semantics are not.`:"","Captured history is intact."].filter(Boolean).join(" ")});const Bt=new C1(Ie,ge,{onTrouble:Te=>{if(!j){if(!Te)return h(Wc);h(Te.kind==="store-fault"?{label:"STORE LOST",tone:"error",detail:`${Te.message} ${Te.detail}`}:{label:"CAPTURE FAILING",tone:"error",detail:`${Te.message}. ${Te.detail}. The field is showing the last world it received.`})}}});j||(k.current=Fl(Ie.from,Ie.to),$.current=Bt,c(Bt.info()),L(null),B(null),q=Bt.subscribe((Te,Qt)=>{k.current=Te,w.current=Qt,se.current=!0}),se.current=!0)}return J().catch(le=>{j||h({label:"SOURCE FAILED",tone:"error",detail:le instanceof Error?le.message:String(le)})}),()=>{j=!0,$.current=null,q?.()}},[n]),Q.useEffect(()=>{const j=setInterval(()=>{const q=k.current,J=$.current?.now()??Date.now();if(Fx(q,Math.max(q.now,J)),!se.current)return;se.current=!1;const le=v1(q);g(le),b(de=>de+1)},IM);return()=>clearInterval(j)},[]),Q.useEffect(()=>{const j=setInterval(()=>{const q=te.current?.perf.snapshot();q&&K({fps:q.fps,gpuMs:q.gpuMs,scale:q.scale})},1e3);return()=>clearInterval(j)},[]);const oe=k.current,he=Q.useMemo(()=>q0(oe),[x]),me=Q.useMemo(()=>X0(oe,he),[he]),ce=Q.useCallback(j=>B(j),[]),U=Q.useCallback(j=>{const q=m.disturbances.find(le=>le.id===j),J=m.strata.find(le=>le.id===j);!q&&!J||(L({kind:q?"disturbance":"stratum",id:j,x:q?.x??0,y:q?.y??0}),r("field"))},[m]),P=O??R,ae=A!=="desktop",xe=typeof window>"u"?800:window.innerHeight,Ce=Q.useMemo(()=>NM(A,!!O,F==="expanded",xe),[A,O,F,xe]),T=P&&(!O&&P.kind==="disturbance"?v.jsx("div",{"data-anchor-placement":"label",children:v.jsx(DM,{hit:P,world:oe})}):v.jsx("div",{"data-anchor-placement":"panel",children:v.jsx(Ff,{hit:P,world:oe,landscape:m,band:_,onClose:()=>L(null)})}));return v.jsxs("div",{style:{position:"fixed",inset:0,display:"flex",flexDirection:"column",background:X.bg,color:X.ink,fontFamily:Tt},children:[v.jsx(HM,{view:s,setView:r,feed:n,setFeed:i,sourceInfo:o,window:d}),s==="today"&&v.jsx(fM,{world:oe,waitEvidence:w.current}),s==="log"&&v.jsx(wM,{world:oe,selectedId:O?.id??null,onSelect:U}),v.jsx("div",{style:{display:s==="field"?"contents":"none"},children:v.jsx(lM,{landscape:m,onHover:ce,onSelect:L,anchor:ae?null:P,onBand:H,compact:ae,inset:Ce,keepVisible:O,overlay:ae&&O?A==="landscape"?v.jsx(kM,{hit:O,world:oe,landscape:m,band:_,onClose:()=>L(null)}):v.jsx(LM,{hit:O,world:oe,landscape:m,band:_,detent:F,onToggleDetent:()=>Y(j=>j==="peek"?"expanded":"peek"),viewportHeight:xe,onClose:()=>L(null)}):null,onReady:j=>{te.current=j},depth:v.jsx(zM,{metrics:he,shape:me,compact:ae}),children:T})}),v.jsx(qM,{view:s,perf:Z,touch:ae})]})}function HM({view:n,setView:i,feed:s,setFeed:r,sourceInfo:o,window:c}){const d=(g,x)=>{const b=n===g;return v.jsx("button",{onClick:()=>i(g),style:{background:"transparent",border:"none",padding:0,cursor:"pointer",fontFamily:Tt,letterSpacing:"0.22em",fontSize:b?12.5:9.5,color:b?X.ink:X.chromeDim},children:x},g)},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 ${X.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:X.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:GM[c.tone],flexShrink:0}}),v.jsx("span",{style:{fontSize:10,letterSpacing:"0.2em",color:X.chromeStrong,whiteSpace:"nowrap"},children:c.label})]}),v.jsxs("button",{onClick:()=>r(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?X.chromeDim:X.accent},children:h?"○":"●"}),v.jsx("span",{style:{fontSize:9.5,letterSpacing:"0.16em",color:X.chrome},children:h?"SYNTHETIC":"CAPTURE"})]})]})]})}function qM({view:n,perf:i,touch:s}){return v.jsxs("div",{style:{display:"flex",alignItems:"baseline",gap:14,padding:"10px 24px 14px",borderTop:`1px solid ${X.hairline}`,fontSize:10.5,letterSpacing:"0.16em",color:X.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:X.accentBright},children:" · TOKEN RULE: LOG 10k–100M"})]}):"HOVER AN INFERRED MEASURE FOR THE ASSUMPTION BEHIND IT"}),v.jsx("span",{style:{marginLeft:"auto",color:X.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)}%`:""}`:""})]})}kx.createRoot(document.getElementById("root")).render(v.jsx(Q.StrictMode,{children:v.jsx(FM,{})}));